diff --git a/CODEOWNERS b/CODEOWNERS index 4f7ab1dad900229e988205402075da217e03f536..638941c1a2a1765ad2a55dd81cf65ca72dce37be 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -338,7 +338,7 @@ zh-cn/application-dev/reference/apis/js-apis-distributedMissionManager.md @chenm zh-cn/application-dev/reference/apis/js-apis-document.md @panqinxu @zengyawen @bubble_mao @jinhaihw zh-cn/application-dev/reference/apis/js-apis-effectKit.md @zhangqiang183 @ge-yafang @wind_zj @zxg-gitee zh-cn/application-dev/reference/apis/js-apis-emitter.md @jayleehw @RayShih @li-weifeng2 @currydavids -zh-cn/application-dev/reference/apis/js-apis-EnterpriseAdminExtensionAbility.md @Buda-Liu @ningningW @budda-wang @yangqing3 +zh-cn/application-dev/reference/apis/js-apis-EnterpriseAdminExtensionAbility.md @liuzuming @ningningW @yangqing3 zh-cn/application-dev/reference/apis/js-apis-environment.md @panqinxu @zengyawen @bubble_mao @jinhaihw zh-cn/application-dev/reference/apis/js-apis-errorManager.md @littlejerry1 @RayShih @gwang2008 @chengxingzhen zh-cn/application-dev/reference/apis/js-apis-eventhub.md @jayleehw @RayShih @li-weifeng2 @currydavids @@ -384,7 +384,7 @@ zh-cn/application-dev/reference/apis/js-apis-lightweightmap.md @gongjunsong @ge- zh-cn/application-dev/reference/apis/js-apis-lightweightset.md @gongjunsong @ge-yafang @flyingwolf @BlackStone zh-cn/application-dev/reference/apis/js-apis-linkedlist.md @gongjunsong @ge-yafang @flyingwolf @BlackStone zh-cn/application-dev/reference/apis/js-apis-list.md @gongjunsong @ge-yafang @flyingwolf @BlackStone -zh-cn/application-dev/reference/apis/js-apis-logs.md @huaweimaxuchu @ningningW @niulihua @tomatodevboy +zh-cn/application-dev/reference/apis/js-apis-logs.md @gongjunsong @ge-yafang @flyingwolf @BlackStone zh-cn/application-dev/reference/apis/js-apis-media.md @liuyuehua1 @zengyawen @xxb-wzy @currydavids zh-cn/application-dev/reference/apis/js-apis-medialibrary.md @panqinxu @zengyawen @bubble_mao @jinhaihw zh-cn/application-dev/reference/apis/js-apis-mediaquery.md @huaweimaxuchu @HelloCrease @niulihua @tomatodevboy @@ -397,7 +397,7 @@ zh-cn/application-dev/reference/apis/js-apis-notification.md @jayleehw @RayShih zh-cn/application-dev/reference/apis/js-apis-observer.md @zhang-hai-feng @zengyawen @jyh926 @gaoxi785 zh-cn/application-dev/reference/apis/js-apis-osAccount.md @nianCode @zengyawen @JiDong-CS @murphy1984 zh-cn/application-dev/reference/apis/js-apis-particleAbility.md @littlejerry1 @RayShih @gwang2008 @chengxingzhen -zh-cn/application-dev/reference/apis/js-apis-pasteboard.md @feng-aiwen @ge-yafang @gong-a-shi @logic42 +zh-cn/application-dev/reference/apis/js-apis-pasteboard.md @han-zhengshi @ge-yafang @logic42 zh-cn/application-dev/reference/apis/js-apis-permissionrequestresult.md @littlejerry1 @RayShih @gwang2008 @chengxingzhen zh-cn/application-dev/reference/apis/js-apis-plainarray.md @gongjunsong @ge-yafang @flyingwolf @BlackStone zh-cn/application-dev/reference/apis/js-apis-pointer.md @yuanxinying @ningningW @cococoler @alien0208 @@ -415,7 +415,7 @@ zh-cn/application-dev/reference/apis/js-apis-resource-manager.md @Buda-Liu @ning zh-cn/application-dev/reference/apis/js-apis-router.md @huaweimaxuchu @HelloCrease @niulihua @tomatodevboy zh-cn/application-dev/reference/apis/js-apis-rpc.md @xuepianpian @RayShih @zhaopeng_gitee @vagrant_world zh-cn/application-dev/reference/apis/js-apis-runninglock.md @aqxyjay @zengyawen @aqxyjay @alien0208 -zh-cn/application-dev/reference/apis/js-apis-screen-lock.md @feng-aiwen @ningningW @wangzhangjun @murphy1984 + zh-cn/application-dev/reference/apis/js-apis-screen.md @zhangqiang183 @ge-yafang @zhouyaoying @zxg-gitee zh-cn/application-dev/reference/apis/js-apis-screenshot.md @zhangqiang183 @ge-yafang @zhouyaoying @zxg-gitee zh-cn/application-dev/reference/apis/js-apis-securityLabel.md @panqinxu @zengyawen @bubble_mao @jinhaihw @@ -435,6 +435,7 @@ zh-cn/application-dev/reference/apis/js-apis-system-bluetooth.md @cheng_guohong zh-cn/application-dev/reference/apis/js-apis-system-brightness.md @aqxyjay @zengyawen @aqxyjay @alien0208 zh-cn/application-dev/reference/apis/js-apis-system-cipher.md @gaoyong @zengyawen @niejiteng @jumozhanjiang zh-cn/application-dev/reference/apis/js-apis-system-configuration.md @Buda-Liu @ningningW @budda-wang @tomatodevboy +zh-cn/application-dev/reference/apis/js-apis-system-date-time.md @feng-aiwen @ningningW @illybyy @murphy1984 zh-cn/application-dev/reference/apis/js-apis-system-device.md @mupceet @zengyawen @handyohos @nan-xiansen zh-cn/application-dev/reference/apis/js-apis-system-fetch.md @zhang-hai-feng @zengyawen @jyh926 @gaoxi785 zh-cn/application-dev/reference/apis/js-apis-system-file.md @panqinxu @zengyawen @bubble_mao @jinhaihw @@ -455,7 +456,7 @@ zh-cn/application-dev/reference/apis/js-apis-system-vibrate.md @hellohyh001 @nin zh-cn/application-dev/reference/apis/js-apis-telephony-data.md @zhang-hai-feng @zengyawen @jyh926 @gaoxi785 zh-cn/application-dev/reference/apis/js-apis-testRunner.md @inter515 @littlejerry1 @RayShih @inter515 @jiyong zh-cn/application-dev/reference/apis/js-apis-thermal.md @aqxyjay @zengyawen @aqxyjay @alien0208 -zh-cn/application-dev/reference/apis/js-apis-timer.md @huaweimaxuchu @HelloCrease @niulihua @tomatodevboy +zh-cn/application-dev/reference/apis/js-apis-timer.md @gongjunsong @ge-yafang @flyingwolf @BlackStone zh-cn/application-dev/reference/apis/js-apis-touchevent.md @mayunteng_1 @ningningW @cococoler @alien0208 zh-cn/application-dev/reference/apis/js-apis-treemap.md @gongjunsong @ge-yafang @flyingwolf @BlackStone zh-cn/application-dev/reference/apis/js-apis-treeset.md @gongjunsong @ge-yafang @flyingwolf @BlackStone @@ -520,7 +521,7 @@ zh-cn/application-dev/reference/apis/js-apis-bundleManager.md @shuaytao @RayShih zh-cn/application-dev/reference/apis/js-apis-bundleMonitor.md @shuaytao @RayShih @wangzhen107 @inter515 zh-cn/application-dev/reference/apis/js-apis-colorSpaceManager.md @zhangqiang183 @ge-yafang @wind_zj @zxg-gitee zh-cn/application-dev/reference/apis/js-apis-commonEventManager.md @jayleehw @RayShih @li-weifeng2 @currydavids -zh-cn/application-dev/reference/apis/js-apis-configPolicy.md @Buda-Liu @ningningW @budda-wang @yangqing3 +zh-cn/application-dev/reference/apis/js-apis-configPolicy.md @liuzuming @ningningW @yangqing3 zh-cn/application-dev/reference/apis/js-apis-cooperate.md @yuanxinying @ningningW @cococoler @alien0208 zh-cn/application-dev/reference/apis/js-apis-cryptoFramework.md @gaoyong @zengyawen @niejiteng @jumozhanjiang zh-cn/application-dev/reference/apis/js-apis-cert.md @gaoyong @zengyawen @niejiteng @jumozhanjiang @@ -528,8 +529,14 @@ zh-cn/application-dev/reference/apis/js-apis-curve.md @huaweimaxuchu @HelloCreas zh-cn/application-dev/reference/apis/js-apis-defaultAppManager.md @shuaytao @RayShih @wangzhen107 @inter515 zh-cn/application-dev/reference/apis/js-apis-distributedBundle.md @shuaytao @RayShih @wangzhen107 @inter515 zh-cn/application-dev/reference/apis/js-apis-distributedKVStore.md @feng-aiwen @ge-yafang @gong-a-shi @logic42 -zh-cn/application-dev/reference/apis/js-apis-enterprise-adminManager.md @Buda-Liu @ningningW @budda-wang @yangqing3 -zh-cn/application-dev/reference/apis/js-apis-enterprise-dateTimeManager.md @Buda-Liu @ningningW @budda-wang @yangqing3 +zh-cn/application-dev/reference/apis/js-apis-enterprise-accountManager.md @liuzuming @ningningW @yangqing3 +zh-cn/application-dev/reference/apis/js-apis-enterprise-adminManager.md @liuzuming @ningningW @yangqing3 +zh-cn/application-dev/reference/apis/js-apis-enterprise-bundleManager.md @liuzuming @ningningW @yangqing3 +zh-cn/application-dev/reference/apis/js-apis-enterprise-dateTimeManager.md @liuzuming @ningningW @yangqing3 +zh-cn/application-dev/reference/apis/js-apis-enterprise-deviceControl.md @liuzuming @ningningW @yangqing3 +zh-cn/application-dev/reference/apis/js-apis-enterprise-deviceInfo.md @liuzuming @ningningW @yangqing3 +zh-cn/application-dev/reference/apis/js-apis-enterprise-networkManager.md @liuzuming @ningningW @yangqing3 +zh-cn/application-dev/reference/apis/js-apis-enterprise-wifiManager.md @liuzuming @ningningW @yangqing3 zh-cn/application-dev/reference/apis/js-apis-fileAccess.md @panqinxu @zengyawen @bubble_mao @jinhaihw zh-cn/application-dev/reference/apis/js-apis-fileExtensionInfo.md @panqinxu @zengyawen @bubble_mao @jinhaihw zh-cn/application-dev/reference/apis/js-apis-freeInstall.md @shuaytao @RayShih @wangzhen107 @inter515 diff --git a/README_zh.md b/README_zh.md index 6e71a0abd9fba5cbe4b4de47c77437d3a851aa45..b69235fdbdc19771dbae119f8873b610a7adf65c 100644 --- a/README_zh.md +++ b/README_zh.md @@ -18,7 +18,7 @@ - master:最新开发版本。 - - OpenHarmony 3.2 Beta5版本:点击[此处](zh-cn/release-notes/OpenHarmony-v3.2-beta5.md)了解版本详情。 + - OpenHarmony 3.2 Release版本:点击[此处](zh-cn/release-notes/OpenHarmony-v3.2-release.md)了解版本详情。 - OpenHarmony 3.1 Release版本:点击[此处](zh-cn/release-notes/OpenHarmony-v3.1-release.md)了解版本详情。 diff --git a/en/OpenHarmony-Overview.md b/en/OpenHarmony-Overview.md index 594fb355e417b047d93b1de9d413540a2c839190..1aecb0171e73b02bcbcb9347497f594bf96c912e 100644 --- a/en/OpenHarmony-Overview.md +++ b/en/OpenHarmony-Overview.md @@ -127,7 +127,7 @@ The following table describes the subsystems of OpenHarmony. For details about t | Build | Provides a compilation and building framework based on Generate Ninja (GN) and Ninja. | All systems | | Test | The test-driven development mode is used during the development process. You can develop new cases or modify existing cases to test new or enhanced system features. The test helps you develop high-quality code in the development phase.| All systems | | Data Management | Provides local data management and distributed data management:
- Local application data management for lightweight preference databases and relational databases
- Distributed data service to provide applications with the capability to store data in the databases of different devices| Standard system | -| Programming Language Runtime| Provides the compilation and execution environment for programs developed with JavaScript or C/C++, basic libraries that support the runtime, and the runtime-associated APIs, compilers, and auxiliary tools.| All systems | +| Compiler and Runtime | Provides the compilation and execution environment for programs developed with JavaScript or C/C++, basic libraries that support the runtime, and the runtime-associated APIs, compilers, and auxiliary tools.| All systems | | Distributed Scheduler| Starts, registers, queries, and manages system services. | All systems | | JS UI Framework | OpenHarmony JS UI framework supports web-development-like paradigm. | All systems | | Multimedia | Provides easy-to-use APIs for developing multimedia components such as audio, video, and camera, and enables applications to use multimedia resources of the system.| All systems | @@ -189,7 +189,7 @@ For details about how to obtain the source code of OpenHarmony, see [Source Code ## How to Participate -For details about how to join in the OpenHarmony community, see [OpenHarmony Community](https://gitee.com/openharmony/community/blob/master/README-EN.md) +For details about how to join in the OpenHarmony community, see [OpenHarmony Community](https://gitee.com/openharmony/community/blob/master/README_EN.md) For details about how to contribute, see [How to contribute](contribute/how-to-contribute.md). diff --git a/en/application-dev/IDL/idl-guidelines.md b/en/application-dev/IDL/idl-guidelines.md index f165215bad4d663b794c249f8029d33aeeda5863..a7ce0ec46adeeca0dd697cd8dabde834b7cc14fc 100644 --- a/en/application-dev/IDL/idl-guidelines.md +++ b/en/application-dev/IDL/idl-guidelines.md @@ -3,7 +3,7 @@ ## IDL Overview To ensure successful communications between the client and server, interfaces recognized by both parties must be defined. The OpenHarmony Interface Definition Language (IDL) is a tool for defining such interfaces. OpenHarmony IDL decomposes objects to be transferred into primitives that can be understood by the operating system and encapsulates cross-boundary objects based on developers' requirements. - **Figure 1** IDL interface description +**Figure 1** IDL interface description ![IDL-interface-description](./figures/IDL-interface-description.png) @@ -156,11 +156,13 @@ On DevEco Studio, choose **Tools > SDK Manager** to view the local installation Go to the local installation path, choose **toolchains > 3.x.x.x** (the folder named after the version number), and check whether the executable file of IDL exists. -> **NOTE**: Use the SDK of the latest version. The use of an earlier version may cause errors in some statements. +> **NOTE** +> +> Use the SDK of the latest version. The use of an earlier version may cause errors in some statements. -If the executable file does not exist, download the SDK package from the mirror as instructed in the [Release Notes](../../release-notes). The following uses the [3.2 Beta3](../../release-notes/OpenHarmony-v3.2-beta3.md#acquiring-source-code-from-mirrors) as an example. +If the executable file does not exist, download the SDK package from the mirror as instructed in the [Release Notes](../../release-notes). The following uses [3.2 Beta3](../../release-notes/OpenHarmony-v3.2-beta3.md) as an example. -For details about how to replace the SDK package, see [Guide to Switching to Full SDK](../quick-start/full-sdk-switch-guide.md). +For details about how to replace the SDK package, see [Full SDK Compilation Guide](../quick-start/full-sdk-compile-guide.md). After obtaining the executable file, perform subsequent development steps based on your scenario. @@ -176,6 +178,8 @@ You can use TS to create IDL files. interface OHOS.IIdlTestService { int TestIntTransaction([in] int data); void TestStringTransaction([in] String data); + void TestMapTransaction([in] Map data); + int TestArrayTransaction([in] String[] data); } ``` @@ -183,7 +187,9 @@ Run the **idl -gen-ts -d *dir* -c dir/IIdlTestService.idl** command in the folde -*dir* next to **d** is the target output folder. For example, if the target output folder is **IIdlTestServiceTs**, run the **idl -gen-ts -d IIdlTestServiceTs -c IIdlTestServiceTs/IIdlTestService.idl** command in the folder where the executable file is located. The interface file, stub file, and proxy file are generated in the *dir* directory (**IIdlTestServiceTs** directory in this example) in the execution environment. -> **NOTE**: The generated interface class file name must be the same as that of the .idl file. Otherwise, an error occurs during code generation. +> **NOTE** +> +> The generated interface class file name must be the same as that of the .idl file. Otherwise, an error occurs during code generation. For example, for an .idl file named **IIdlTestService.idl** and target output directory named **IIdlTestServiceTs**, the directory structure is similar to the following: @@ -203,6 +209,8 @@ The stub class generated by IDL is an abstract implementation of the interface c ```ts import {testIntTransactionCallback} from "./i_idl_test_service"; import {testStringTransactionCallback} from "./i_idl_test_service"; +import {testMapTransactionCallback} from "./i_idl_test_service"; +import {testArrayTransactionCallback} from "./i_idl_test_service"; import IIdlTestService from "./i_idl_test_service"; import rpc from "@ohos.rpc"; @@ -211,8 +219,8 @@ export default class IdlTestServiceStub extends rpc.RemoteObject implements IIdl super(des); } - async onRemoteRequestEx(code: number, data, reply, option): Promise { - console.log("onRemoteRequestEx called, code = " + code); + async onRemoteMessageRequest(code: number, data, reply, option): Promise { + console.log("onRemoteMessageRequest called, code = " + code); switch(code) { case IdlTestServiceStub.COMMAND_TEST_INT_TRANSACTION: { let _data = data.readInt(); @@ -231,6 +239,29 @@ export default class IdlTestServiceStub extends rpc.RemoteObject implements IIdl }); return true; } + case IdlTestServiceStub.COMMAND_TEST_MAP_TRANSACTION: { + let _data = new Map(); + let _dataSize = data.readInt(); + for (let i = 0; i < _dataSize; ++i) { + let key = data.readInt(); + let value = data.readInt(); + _data.set(key, value); + } + this.testMapTransaction(_data, (errCode) => { + reply.writeInt(errCode); + }); + return true; + } + case IdlTestServiceStub.COMMAND_TEST_ARRAY_TRANSACTION: { + let _data = data.readStringArray(); + this.testArrayTransaction(_data, (errCode, returnValue) => { + reply.writeInt(errCode); + if (errCode == 0) { + reply.writeInt(returnValue); + } + }); + return true; + } default: { console.log("invalid request code" + code); break; @@ -241,17 +272,23 @@ export default class IdlTestServiceStub extends rpc.RemoteObject implements IIdl testIntTransaction(data: number, callback: testIntTransactionCallback): void{} testStringTransaction(data: string, callback: testStringTransactionCallback): void{} + testMapTransaction(data: Map, callback: testMapTransactionCallback): void{} + testArrayTransaction(data: string[], callback: testArrayTransactionCallback): void{} static readonly COMMAND_TEST_INT_TRANSACTION = 1; static readonly COMMAND_TEST_STRING_TRANSACTION = 2; + static readonly COMMAND_TEST_MAP_TRANSACTION = 3; + static readonly COMMAND_TEST_ARRAY_TRANSACTION = 4; } ``` -You need to inherit the interface class defined in the IDL file and implement the methods in the class. The following code snippet shows how to inherit the **IdlTestServiceStub** interface class and implement the **testIntTransaction** and **testStringTransaction** methods. +You need to inherit the interface class defined in the IDL file and implement the methods in the class. The following code snippet shows how to inherit the **IdlTestServiceStub** interface class and implement the **testIntTransaction**, **testStringTransaction**, **testMapTransaction**, and **testArrayTransaction** methods. ```ts import {testIntTransactionCallback} from "./i_idl_test_service" import {testStringTransactionCallback} from "./i_idl_test_service" +import {testMapTransactionCallback} from "./i_idl_test_service"; +import {testArrayTransactionCallback} from "./i_idl_test_service"; import IdlTestServiceStub from "./idl_test_service_stub" @@ -265,6 +302,14 @@ class IdlTestImp extends IdlTestServiceStub { { callback(0); } + testMapTransaction(data: Map, callback: testMapTransactionCallback): void + { + callback(0); + } + testArrayTransaction(data: string[], callback: testArrayTransactionCallback): void + { + callback(0, 1); + } } ``` @@ -320,11 +365,28 @@ function callbackTestStringTransaction(result: number): void { } } +function callbackTestMapTransaction(result: number): void { + if (result == 0) { + console.log('case 3 success'); + } +} + +function callbackTestArrayTransaction(result: number, ret: number): void { + if (result == 0 && ret == 124) { + console.log('case 4 success'); + } +} + var onAbilityConnectDone = { onConnect:function (elementName, proxy) { let testProxy = new IdlTestServiceProxy(proxy); + let testMap = new Map(); + testMap.set(1, 1); + testMap.set(1, 2); testProxy.testIntTransaction(123, callbackTestIntTransaction); testProxy.testStringTransaction('hello', callbackTestStringTransaction); + testProxy.testMapTransaction(testMap, callbackTestMapTransaction); + testProxy.testArrayTransaction(['1','2'], callbackTestMapTransaction); }, onDisconnect:function (elementName) { console.log('onDisconnectService onDisconnect'); diff --git a/en/application-dev/Readme-EN.md b/en/application-dev/Readme-EN.md index a627e1116a792c5d4fc885ae01aa6ccb172b7b1d..73bbd2d608562535e3272c1a659bcebbd39b125a 100644 --- a/en/application-dev/Readme-EN.md +++ b/en/application-dev/Readme-EN.md @@ -17,7 +17,6 @@ - Application Package Structure - [Application Package Structure in Stage Model)](quick-start/application-package-structure-stage.md) - [Application Package Structure in FA Model](quick-start/application-package-structure-fa.md) - - [HAR File Structure](quick-start/har-structure.md) - Multi-HAP Mechanism - [Multi-HAP Design Objectives](quick-start/multi-hap-objective.md) - [Multi-HAP Build View](quick-start/multi-hap-build-view.md) @@ -49,7 +48,7 @@ - Development - [Application Models](application-models/Readme-EN.md) - [UI Development](ui/Readme-EN.md) - - [Common Event and Notification](notification/Readme-EN.md) + - [Notification](notification/Readme-EN.md) - [Window Manager](windowmanager/Readme-EN.md) - [WebGL](webgl/Readme-EN.md) - [Media](media/Readme-EN.md) @@ -57,7 +56,7 @@ - [Connectivity](connectivity/Readme-EN.md) - [Data Management](database/Readme-EN.md) - [File Management](file-management/Readme-EN.md) - - [Telephony](telephony/Readme-EN.md) + - [Telephony Service](telephony/Readme-EN.md) - [Task Management](task-management/Readme-EN.md) - [Device Management](device/Readme-EN.md) - [Device Usage Statistics](device-usage-statistics/Readme-EN.md) diff --git a/en/application-dev/ability-deprecated/ability-delegator.md b/en/application-dev/ability-deprecated/ability-delegator.md index f72a192dc510c28104511fb1530a915c9f9827cc..b32d472176a5b6270fece94ae4bd8ae9a7bd73fa 100644 --- a/en/application-dev/ability-deprecated/ability-delegator.md +++ b/en/application-dev/ability-deprecated/ability-delegator.md @@ -63,7 +63,7 @@ For details about how to use DevEco Studio to start the test framework, see [Ope **Example** ```javascript -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' function onAbilityCreateCallback(data) { console.info("onAbilityCreateCallback"); @@ -87,11 +87,11 @@ abilityDelegator.addAbilityMonitor(monitor).then(() => { **Modules to Import** ```javascript -import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; +import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry' ``` ```javascript -var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); +var abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator() ``` ### Starting an Ability and Listening for the Ability State diff --git a/en/application-dev/ability-deprecated/context-userguide.md b/en/application-dev/ability-deprecated/context-userguide.md index 1340e72918e141dd3b95b5ddc8dbc11258f83493..79cae1da5611b0736f7d11a5bb0cfb9b48df3f0a 100644 --- a/en/application-dev/ability-deprecated/context-userguide.md +++ b/en/application-dev/ability-deprecated/context-userguide.md @@ -250,9 +250,9 @@ In the stage model, in the onWindowStageCreate lifecycle of an ability, you can Use the API described in the table below to obtain the context associated with an ArkTS page. -| API | Description | -| :------------------------------------ | :--------------------------- | -| getContext(component: Object): Object | Obtains the **Context** object associated with a component on the page.| +| API | Description | +| :------------------------------------ | :----------------------------------------------------------- | +| getContext(component: Object): Object | Obtains the **Context** object associated with a component on the page.
Since API version 9, this API is supported in ArkTS widgets.| **Example** diff --git a/en/application-dev/ability-deprecated/fa-dataability.md b/en/application-dev/ability-deprecated/fa-dataability.md index 8d94e8f225a3966d676e6c7631968c25f5634531..217f617db77ff329eb1d0fa0eef7dcb6172cf45a 100644 --- a/en/application-dev/ability-deprecated/fa-dataability.md +++ b/en/application-dev/ability-deprecated/fa-dataability.md @@ -154,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 diff --git a/en/application-dev/ability-deprecated/fa-formability.md b/en/application-dev/ability-deprecated/fa-formability.md index 5c08a1b0b3955472d6f3b16cf7a343a083a0116a..96ed58d8ef2206d6c66e413d0a6fc34423651974 100644 --- a/en/application-dev/ability-deprecated/fa-formability.md +++ b/en/application-dev/ability-deprecated/fa-formability.md @@ -25,7 +25,7 @@ Carry out the following operations to develop the widget provider based on the [ 1. Implement lifecycle callbacks by using the **LifecycleForm** APIs. 2. Create a **FormBindingData** instance. 3. Update a widget by using the **FormProvider** APIs. -4. Develop the widget UI pages. +4. Develop the widget UI page. ## Available APIs @@ -231,7 +231,7 @@ You should override **onDestroy** to implement widget data deletion. } ``` -For details about how to implement persistent data storage, see [Lightweight Data Store Development](../database/database-preference-guidelines.md). +For details about how to implement persistent data storage, see [Data Persistence by User Preferences](../database/data-persistence-by-preferences.md). The **Want** object passed in by the widget host to the widget provider contains a flag that specifies whether the requested widget is normal or temporary. @@ -402,3 +402,5 @@ The code snippet is as follows: } } ``` + + \ No newline at end of file diff --git a/en/application-dev/ability-deprecated/fa-pageability.md b/en/application-dev/ability-deprecated/fa-pageability.md index 28b5ce36e292acc9e350f8ae96cb7bcf17f8c8c3..e28c0f2823ff61f6c60f469eaaf9d197184e8f50 100644 --- a/en/application-dev/ability-deprecated/fa-pageability.md +++ b/en/application-dev/ability-deprecated/fa-pageability.md @@ -47,7 +47,7 @@ You can specify the launch type by setting **launchType** in the **config.json** | Launch Type | Description |Description | | ----------- | ------- |---------------- | -| standard | Multi-instance | A new instance is started each time an ability starts.| +| standard | Multi-instance | A new instance is started each time an ability starts.| | singleton | Singleton | The ability has only one instance in the system. If an instance already exists when an ability is started, that instance is reused.| By default, **singleton** is used. diff --git a/en/application-dev/ability-deprecated/stage-ability-continuation.md b/en/application-dev/ability-deprecated/stage-ability-continuation.md index b53d57d849c8c771b92d4e86a2095163aab0a395..f99966aff24d9b465627ba475cda018671820809 100644 --- a/en/application-dev/ability-deprecated/stage-ability-continuation.md +++ b/en/application-dev/ability-deprecated/stage-ability-continuation.md @@ -6,7 +6,7 @@ Ability continuation is to continue the current mission of an application, inclu ## Available APIs -The following table lists the APIs used for ability continuation. For details about the APIs, see [Ability](../reference/apis/js-apis-application-ability.md). +The following table lists the APIs used for ability continuation. For details about the APIs, see [UIAbility](../reference/apis/js-apis-app-ability-uiAbility.md). **Table 1** Ability continuation APIs @@ -48,96 +48,88 @@ The code snippets provided below are all from [Sample](https://gitee.com/openhar } ``` - - - - Configure the application startup type. - - If **launchType** is set to **standard** in the **module.json5** file, the application is of the multi-instance launch type. During ability continuation, regardless of whether the application is already open, the target starts the application and restores the UI page. If **launchType** is set to **singleton**, the application is of the singleton launch type. If the application is already open, the target clears the existing page stack and restores the UI page. For more information, see "Launch Type" in [Ability Development](./stage-ability.md). + + If **launchType** is set to **multiton** in the **module.json5** file, the application is of the multi-instance launch type. During ability continuation, regardless of whether the application is already open, the target starts the application and restores the UI page. If **launchType** is set to **singleton**, the application is of the singleton launch type. If the application is already open, the target clears the existing page stack and restores the UI page. For more information, see "Launch Type" in [Ability Development](./stage-ability.md). + + Configure a multi-instance application as follows: + + ```javascript + { + "module": { + "abilities": [ + { + "launchType": "multiton" + } + ] + } + } + ``` + + Configure a singleton application as follows or retain the default settings of **launchType**: + + ```javascript + { + "module": { + "abilities": [ + { + "launchType": "singleton" + } + ] + } + } + ``` + + - Apply for the distributed permissions. - Configure a multi-instance application as follows: + Declare the **DISTRIBUTED_DATASYNC** permission in the **module.json5** file for the application. - ```javascript - { - "module": { - "abilities": [ - { - "launchType": "standard" - } - ] - } - } - ``` + ```javascript + "requestPermissions": [ + { + "name": "ohos.permission.DISTRIBUTED_DATASYNC" + }, + ``` - Configure a singleton application as follows or retain the default settings of **launchType**: + This permission must be granted by the user in a dialog box when the application is started for the first time. To enable the application to display a dialog box to ask for the permission, add the following code to **onWindowStageCreate** of the **Ability** class: - ```javascript - { - "module": { - "abilities": [ - { - "launchType": "singleton" + ```javascript + requestPermissions = async () => { + let permissions: Array = [ + "ohos.permission.DISTRIBUTED_DATASYNC" + ]; + let needGrantPermission = false + let accessManger = accessControl.createAtManager() + Logger.info("app permission get bundle info") + let bundleInfo = await bundle.getApplicationInfo(BUNDLE_NAME, 0, 100) + Logger.info(`app permission query permission ${bundleInfo.accessTokenId.toString()}`) + for (const permission of permissions) { + Logger.info(`app permission query grant status ${permission}`) + try { + let grantStatus = await accessManger.verifyAccessToken(bundleInfo.accessTokenId, permission) + if (grantStatus === PERMISSION_REJECT) { + needGrantPermission = true + break; + } + } catch (err) { + Logger.error(`app permission query grant status error ${permission} ${JSON.stringify(err)}`) + needGrantPermission = true + break; + } + } + if (needGrantPermission) { + Logger.info("app permission needGrantPermission") + try { + await accessManger.requestPermissionsFromUser(this.context, permissions) + } catch (err) { + Logger.error(`app permission ${JSON.stringify(err)}`) + } + } else { + Logger.info("app permission already granted") + } } - ] - } - } - ``` - - - - - Apply for the distributed permissions. - - Declare the **DISTRIBUTED_DATASYNC** permission in the **module.json5** file for the application. - - ```javascript - "requestPermissions": [ - { - "name": "ohos.permission.DISTRIBUTED_DATASYNC" - }, - ``` - - - - This permission must be granted by the user in a dialog box when the application is started for the first time. To enable the application to display a dialog box to ask for the permission, add the following code to **onWindowStageCreate** of the **Ability** class: - - ```javascript - requestPermissions = async () => { - let permissions: Array = [ - "ohos.permission.DISTRIBUTED_DATASYNC" - ]; - let needGrantPermission = false - let accessManger = accessControl.createAtManager() - Logger.info("app permission get bundle info") - let bundleInfo = await bundle.getApplicationInfo(BUNDLE_NAME, 0, 100) - Logger.info(`app permission query permission ${bundleInfo.accessTokenId.toString()}`) - for (const permission of permissions) { - Logger.info(`app permission query grant status ${permission}`) - try { - let grantStatus = await accessManger.verifyAccessToken(bundleInfo.accessTokenId, permission) - if (grantStatus === PERMISSION_REJECT) { - needGrantPermission = true - break; - } - } catch (err) { - Logger.error(`app permission query grant status error ${permission} ${JSON.stringify(err)}`) - needGrantPermission = true - break; - } - } - if (needGrantPermission) { - Logger.info("app permission needGrantPermission") - try { - await accessManger.requestPermissionsFromUser(this.context, permissions) - } catch (err) { - Logger.error(`app permission ${JSON.stringify(err)}`) - } - } else { - Logger.info("app permission already granted") - } - } - ``` - - + ``` + 2. Implement the **onContinue()** API. @@ -155,7 +147,7 @@ The code snippets provided below are all from [Sample](https://gitee.com/openhar You can obtain the target device ID (identified by the key **targetDevice**) and the version number (identified by the key **version**) of the application installed on the target device from the **wantParam** parameter of this API. The version number can be used for compatibility check. If the current application version is incompatible with that on the target device, **OnContinueResult.MISMATCH** can be returned to reject the continuation request. - Example + Example: ```javascript onContinue(wantParam : {[key: string]: any}) { @@ -168,8 +160,6 @@ The code snippets provided below are all from [Sample](https://gitee.com/openhar } ``` - - 3. Implement the continuation logic in the **onCreate()** or **onNewWant()** API. The **onCreate()** API is called by the target. When the ability is started on the target device, this API is called to instruct the application to synchronize the memory data and UI component state, and triggers page restoration after the synchronization is complete. If the continuation logic is not implemented, the ability will be started in common startup mode and the page cannot be restored. @@ -178,11 +168,9 @@ The code snippets provided below are all from [Sample](https://gitee.com/openhar After data restore is complete, call **restoreWindowStage** to trigger page restoration. - - You can also use **want.parameters.version** in the **want** parameter to obtain the application version number of the initiator. - - Example + + Example: ```javascript import UIAbility from '@ohos.app.ability.UIAbility'; @@ -190,7 +178,7 @@ The code snippets provided below are all from [Sample](https://gitee.com/openhar export default class EntryAbility extends UIAbility { storage : LocalStorag; - + onCreate(want, launchParam) { Logger.info(`EntryAbility onCreate ${AbilityConstant.LaunchReason.CONTINUATION}`) if (launchParam.launchReason == AbilityConstant.LaunchReason.CONTINUATION) { @@ -211,7 +199,7 @@ For a singleton ability, use **onNewWant()** to achieve the same implementation. Use distributed objects. -Distributed objects allow cross-device data synchronization like local variables. For two devices that form a Super Device, when data in the distributed data object of an application is added, deleted, or modified on a device, the data for the same application is also updated on the other device. Both devices can listen for the data changes and online and offline states of the other. For details, see [Distributed Data Object Development](../database/database-distributedobject-guidelines.md). +Distributed objects allow cross-device data synchronization like local variables. For two devices that form a Super Device, when data in the distributed data object of an application is added, deleted, or modified on a device, the data for the same application is also updated on the other device. Both devices can listen for the data changes and online and offline states of the other. For details, see [Sharing Distributed Data Objects](../database/data-sync-of-distributed-data-object.md). In the ability continuation scenario, the distributed data object is used to synchronize the memory data from the local device to the target device. @@ -249,8 +237,6 @@ In the ability continuation scenario, the distributed data object is used to syn }); ``` - - - The target device obtains the session ID from **onCreate()**, creates a distributed object, and associates the distributed object with the session ID. In this way, the distributed object can be synchronized. Before calling **restoreWindowStage**, ensure that all distributed objects required for continuation have been associated. ```javascript @@ -283,8 +269,6 @@ In the ability continuation scenario, the distributed data object is used to syn } ``` - - ### More Information 1. Timeout @@ -294,15 +278,13 @@ In the ability continuation scenario, the distributed data object is used to syn 2. By default, the system supports page stack information migration, which means that the page stack of the initiator will be automatically migrated to the target device. No adaptation is required. - - ### Restrictions 1. The continuation must be performed between the same ability, which means the same bundle name, module name, and ability name. For details, see [Application Package Structure Configuration File](../quick-start/module-configuration-file.md). 2. Currently, the application can only implement the continuation capability. The continuation action must be initiated by the system. - - ### Best Practice For better user experience, you are advised to use the **wantParam** parameter to transmit data smaller than 100 KB and use distributed objects to transmit data larger than 100 KB. + + \ No newline at end of file diff --git a/en/application-dev/ability-deprecated/stage-ability.md b/en/application-dev/ability-deprecated/stage-ability.md index 60f954c78f306193e7bfefe1e6ceee2babf86da4..2cd18f7aa3052cee86785d55bc81d68cfdece802 100644 --- a/en/application-dev/ability-deprecated/stage-ability.md +++ b/en/application-dev/ability-deprecated/stage-ability.md @@ -12,8 +12,8 @@ An ability can be launched in the **standard**, **singleton**, or **specified** | Launch Type | Description |Action | | ----------- | ------- |---------------- | -| standard | Standard mode | A new instance is started each time an ability starts.| -| singleton | Singleton mode | The ability has only one instance in the system. If an instance already exists when an ability is started, that instance is reused.| +| multiton | Multi-instance mode| A new instance is started each time an ability starts.| +| singleton | Singleton mode | Default type. The ability has only one instance in the system. If an instance already exists when an ability is started, that instance is reused.| | specified | Instance-specific| The internal service of an ability determines whether to create multiple instances during running.| By default, the singleton mode is used. The following is an example of the **module.json5** file: @@ -39,7 +39,7 @@ The table below describes the APIs provided by the **AbilityStage** class, which |onAcceptWant(want: Want): string|Called when a specified ability is started.| |onConfigurationUpdated(config: Configuration): void|Called when the global configuration is updated.| -The table below describes the APIs provided by the **Ability** class. For details about the APIs, see [Ability](../reference/apis/js-apis-application-ability.md). +The table below describes the APIs provided by the **Ability** class. For details about the APIs, see [UIAbility](../reference/apis/js-apis-app-ability-uiAbility.md). **Table 2** Ability APIs @@ -190,7 +190,7 @@ export default class EntryAbility extends UIAbility { ``` ## Starting an Ability ### Available APIs -The **Ability** class has the **context** attribute, which belongs to the **AbilityContext** class. The **AbilityContext** class has the **abilityInfo**, **currentHapModuleInfo**, and other attributes as well as the APIs used for starting abilities. For details, see [AbilityContext](../reference/apis/js-apis-ability-context.md). +The **Ability** class has the **context** attribute, which belongs to the **AbilityContext** class. The **AbilityContext** class has the **abilityInfo**, **currentHapModuleInfo**, and other attributes as well as the APIs used for starting abilities. For details, see [AbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md). **Table 3** AbilityContext APIs |API|Description| @@ -207,7 +207,7 @@ The **Ability** class has the **context** attribute, which belongs to the **Abil An application can obtain the context of an **Ability** instance through **this.context** and then use the **startAbility** API in the **AbilityContext** class to start the ability. The ability can be started by specifying **Want**, **StartOptions**, and **accountId**, and the operation result can be returned using a callback or **Promise** instance. The sample code is as follows: ```ts let context = this.context -var want = { +let want = { "deviceId": "", "bundleName": "com.example.MyApplication", "abilityName": "EntryAbility" @@ -224,7 +224,7 @@ context.startAbility(want).then(() => { In the cross-device scenario, you must specify the ID of the remote device. The sample code is as follows: ```ts let context = this.context -var want = { +let want = { "deviceId": getRemoteDeviceId(), "bundleName": "com.example.MyApplication", "abilityName": "EntryAbility" @@ -239,9 +239,9 @@ Obtain the ID of a specified device from **DeviceManager**. The sample code is a ```ts import deviceManager from '@ohos.distributedHardware.deviceManager'; function getRemoteDeviceId() { - if (typeof dmClass === 'object' && dmClass != null) { - var list = dmClass.getTrustedDeviceListSync(); - if (typeof (list) == 'undefined' || typeof (list.length) == 'undefined') { + if (typeof dmClass === 'object' && dmClass !== null) { + let list = dmClass.getTrustedDeviceListSync(); + if (typeof (list) === 'undefined' || typeof (list.length) === 'undefined') { console.log("EntryAbility onButtonClick getRemoteDeviceId err: list is null"); return; } diff --git a/en/application-dev/ability-deprecated/stage-call.md b/en/application-dev/ability-deprecated/stage-call.md index 71f5f6934dda385161f4adcb95837924c691c278..d9269295e06633fa0f55bdebad51eb1c354f2934 100644 --- a/en/application-dev/ability-deprecated/stage-call.md +++ b/en/application-dev/ability-deprecated/stage-call.md @@ -31,12 +31,12 @@ The ability call process is as follows: > Currently, only system applications can use the ability call. ## Available APIs -The table below describes the ability call APIs. For details, see [Ability](../reference/apis/js-apis-application-ability.md#caller). +The table below describes the ability call APIs. For details, see [UIAbility](../reference/apis/js-apis-app-ability-uiAbility.md#caller). **Table 2** Ability call APIs |API|Description| |:------|:------| -|startAbilityByCall(want: Want): Promise\|Starts an ability in the foreground (through the **want** configuration) or background (default) and obtains the **Caller** object for communication with the ability. For details, see [AbilityContext](../reference/apis/js-apis-ability-context.md#abilitycontextstartabilitybycall) or **ServiceExtensionContext**.| +|startAbilityByCall(want: Want): Promise\|Starts an ability in the foreground (through the **want** configuration) or background (default) and obtains the **Caller** object for communication with the ability. For details, see [AbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartabilitybycall) or **ServiceExtensionContext**.| |on(method: string, callback: CalleeCallBack): void|Callback invoked when the callee ability registers a method.| |off(method: string): void|Callback invoked when the callee ability deregisters a method.| |call(method: string, data: rpc.Sequenceable): Promise\|Sends agreed sequenceable data to the callee ability.| @@ -47,242 +47,263 @@ The table below describes the ability call APIs. For details, see [Ability](../r ## How to Develop The procedure for developing the ability call is as follows: 1. Create a callee ability. - 2. Access the callee ability. ### Creating a Callee Ability For the callee ability, implement the callback to receive data and the methods to marshal and unmarshal data. When data needs to be received, use **on()** to register a listener. When data does not need to be received, use **off()** to deregister the listener. -**1. Configure the ability launch type.** - - Set **launchType** of the callee ability to **singleton** in the **module.json5** file. -|JSON Field|Description| -|:------|:------| -|"launchType"|Ability launch type. Set this parameter to **singleton**.| - -An example of the ability configuration is as follows: -```json -"abilities":[{ - "name": ".CalleeAbility", - "srcEntrance": "./ets/CalleeAbility/CalleeAbility.ts", - "launchType": "singleton", - "description": "$string:CalleeAbility_desc", - "icon": "$media:icon", - "label": "$string:CalleeAbility_label", - "visible": true -}] -``` -**2. Import the Ability module.** -```ts -import Ability from '@ohos.app.ability.UIAbility' -``` -**3. Define the agreed sequenceable data.** - - The data formats sent and received by the caller and callee abilities must be consistent. In the following example, the data formats are number and string. The code snippet is as follows: -```ts -export default 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 - } -} -``` -**4. Implement Callee.on and Callee.off.** - - The time to register a listener for the callee ability depends on your application. The data sent and received before the listener is registered and that after the listener is deregistered are not processed. In the following example, the **MSG_SEND_METHOD** listener is registered in **onCreate** of the ability and deregistered in **onDestroy**. After receiving sequenceable data, the application processes the data and returns the data result. You need to implement processing based on service requirements. The code snippet is as follows: -```ts -const TAG: string = '[CalleeAbility]' -const MSG_SEND_METHOD: string = 'CallSendMsg' - -function sendMsgCallback(data) { - console.log('CalleeSortFunc called') - - // Obtain the sequenceable data sent by the caller ability. - let receivedData = new MySequenceable(0, '') - data.readSequenceable(receivedData) - console.log(`receiveData[${receivedData.num}, ${receivedData.str}]`) - - // Process the data. - // Return the sequenceable data result to the caller ability. - return new MySequenceable(receivedData.num + 1, `send ${receivedData.str} succeed`) -} - -export default class CalleeAbility extends Ability { - onCreate(want, launchParam) { - try { - this.callee.on(MSG_SEND_METHOD, sendMsgCallback) - } catch (error) { - console.log(`${MSG_SEND_METHOD} register failed with error ${JSON.stringify(error)}`) - } - } - - onDestroy() { - try { - this.callee.off(MSG_SEND_METHOD) - } catch (error) { - console.error(TAG, `${MSG_SEND_METHOD} unregister failed with error ${JSON.stringify(error)}`) - } - } -} -``` +1. **Configure the ability launch type.** + + Set **launchType** of the callee ability to **singleton** in the **module.json5** file. + + |JSON Field|Description| + |:------|:------| + |"launchType"|Ability launch type. Set this parameter to **singleton**.| + + An example of the ability configuration is as follows: + + ```json + "abilities":[{ + "name": ".CalleeAbility", + "srcEntry": "./ets/CalleeAbility/CalleeAbility.ts", + "launchType": "singleton", + "description": "$string:CalleeAbility_desc", + "icon": "$media:icon", + "label": "$string:CalleeAbility_label", + "exported": true + }] + ``` + +2. **Import the UIAbility module.** + + ```ts + import UIAbility from '@ohos.app.ability.UIAbility'; + ``` + +3. **Define the agreed sequenceable data.** + + The data formats sent and received by the caller and callee abilities must be consistent. In the following example, the data formats are number and string. The code snippet is as follows: + + ```ts + export default 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 + } + } + ``` + +4. **Implement Callee.on and Callee.off.** + + The time to register a listener for the callee ability depends on your application. The data sent and received before the listener is registered and that after the listener is deregistered are not processed. In the following example, the **MSG_SEND_METHOD** listener is registered in **onCreate** of the ability and deregistered in **onDestroy**. After receiving sequenceable data, the application processes the data and returns the data result. You need to implement processing based on service requirements. The code snippet is as follows: + + ```ts + const TAG: string = '[CalleeAbility]' + const MSG_SEND_METHOD: string = 'CallSendMsg' + + function sendMsgCallback(data) { + console.log('CalleeSortFunc called') + + // Obtain the sequenceable data sent by the caller ability. + let receivedData = new MySequenceable(0, '') + data.readSequenceable(receivedData) + console.log(`receiveData[${receivedData.num}, ${receivedData.str}]`) + + // Process the data. + // Return the sequenceable data result to the caller ability. + return new MySequenceable(receivedData.num + 1, `send ${receivedData.str} succeed`) + } + + export default class CalleeAbility extends Ability { + onCreate(want, launchParam) { + try { + this.callee.on(MSG_SEND_METHOD, sendMsgCallback) + } catch (error) { + console.log(`${MSG_SEND_METHOD} register failed with error ${JSON.stringify(error)}`) + } + } + + onDestroy() { + try { + this.callee.off(MSG_SEND_METHOD) + } catch (error) { + console.error(TAG, `${MSG_SEND_METHOD} unregister failed with error ${JSON.stringify(error)}`) + } + } + } + ``` ### Accessing the Callee Ability -**1. Import the Ability module.** -```ts -import Ability from '@ohos.app.ability.UIAbility' -``` -**2. Obtain the Caller object.** - - The **context** attribute of the ability implements **startAbilityByCall** to obtain the **Caller** object for communication. The following example uses **this.context** to obtain the **context** attribute of the ability, uses **startAbilityByCall** to start the callee ability, obtain the **Caller** object, and register the **onRelease** listener of the caller ability. You need to implement processing based on service requirements. The code snippet is as follows: -```ts -// Register the onRelease listener of the caller ability. -private regOnRelease(caller) { - try { - caller.on("release", (msg) => { - console.log(`caller onRelease is called ${msg}`) - }) - console.log('caller register OnRelease succeed') - } catch (error) { - console.log(`caller register OnRelease failed with ${error}`) - } -} - -async onButtonGetCaller() { - try { - this.caller = await context.startAbilityByCall({ - bundleName: 'com.samples.CallApplication', - abilityName: 'CalleeAbility' - }) - if (this.caller === undefined) { - console.log('get caller failed') - return - } - console.log('get caller success') - this.regOnRelease(this.caller) - } catch (error) { - console.log(`get caller failed with ${error}`) - } -} -``` - In the cross-device scenario, you need to specify the ID of the peer device. The code snippet is as follows: -```ts -async onButtonGetRemoteCaller() { - var caller = undefined - var context = this.context - - context.startAbilityByCall({ - deviceId: getRemoteDeviceId(), - bundleName: 'com.samples.CallApplication', - abilityName: 'CalleeAbility' - }).then((data) => { - if (data != null) { - caller = data - console.log('get remote caller success') - // Register the onRelease listener of the caller ability. - caller.on("release", (msg) => { - console.log(`remote caller onRelease is called ${msg}`) - }) - console.log('remote caller register OnRelease succeed') - } - }).catch((error) => { - console.error(`get remote caller failed with ${error}`) - }) -} -``` - Obtain the ID of the peer device from **DeviceManager**. Note that the **getTrustedDeviceListSync** API is open only to system applications. The code snippet is as follows: -```ts -import deviceManager from '@ohos.distributedHardware.deviceManager'; -var dmClass; -function getRemoteDeviceId() { - if (typeof dmClass === 'object' && dmClass != null) { - var list = dmClass.getTrustedDeviceListSync() - if (typeof (list) == 'undefined' || typeof (list.length) == 'undefined') { - console.log("EntryAbility onButtonClick getRemoteDeviceId err: list is null") - return - } - console.log("EntryAbility onButtonClick getRemoteDeviceId success:" + list[0].deviceId) - return list[0].deviceId - } else { - console.log("EntryAbility onButtonClick getRemoteDeviceId err: dmClass is null") - } -} -``` - In the cross-device scenario, your application must also apply for the data synchronization permission from end users. The code snippet is as follows: -```ts -import abilityAccessCtrl from '@ohos.abilityAccessCtrl.d.ts'; - -requestPermission() { - let context = this.context - let permissions: Array = ['ohos.permission.DISTRIBUTED_DATASYNC'] - let atManager = abilityAccessCtrl.createAtManager(); - atManager.requestPermissionsFromUser(context, permissions).then((data) => { - console.log("Succeed to request permission from user with data: "+ JSON.stringify(data)) - }).catch((error) => { - console.log("Failed to request permission from user with error: "+ JSON.stringify(error)) - }) -} -``` -**3. Send agreed sequenceable data.** - - The sequenceable data can be sent to the callee ability with or without a return value. The method and sequenceable data must be consistent with those of the callee ability. The following example describes how to send data to the callee ability. The code snippet is as follows: -```ts -const MSG_SEND_METHOD: string = 'CallSendMsg' -async onButtonCall() { - try { - let msg = new MySequenceable(1, 'origin_Msg') - await this.caller.call(MSG_SEND_METHOD, msg) - } catch (error) { - console.log(`caller call failed with ${error}`) - } -} -``` - - In the following, **CallWithResult** is used to send data **originMsg** to the callee ability and assign the data processed by the **CallSendMsg** method to **backMsg**. The code snippet is as follows: -```ts -const MSG_SEND_METHOD: string = 'CallSendMsg' -originMsg: string = '' -backMsg: string = '' -async onButtonCallWithResult(originMsg, backMsg) { - try { - let msg = new MySequenceable(1, originMsg) - const data = await this.caller.callWithResult(MSG_SEND_METHOD, msg) - console.log('caller callWithResult succeed') - - let result = new MySequenceable(0, '') - data.readSequenceable(result) - backMsg(result.str) - console.log(`caller result is [${result.num}, ${result.str}]`) - } catch (error) { - console.log(`caller callWithResult failed with ${error}`) - } -} -``` -**4. Release the Caller object.** - - When the **Caller** object is no longer required, use **release()** to release it. The code snippet is as follows: -```ts -releaseCall() { - try { - this.caller.release() - this.caller = undefined - console.log('caller release succeed') - } catch (error) { - console.log(`caller release failed with ${error}`) - } -} -``` +1. **Import the Ability module.** + + ```ts + import UIAbility from '@ohos.app.ability.UIAbility'; + ``` + +2. **Obtain the Caller object.** + + The **context** attribute of the ability implements **startAbilityByCall** to obtain the **Caller** object for communication. The following example uses **this.context** to obtain the **context** attribute of the ability, uses **startAbilityByCall** to start the callee ability, obtain the **Caller** object, and register the **onRelease** listener of the caller ability. You need to implement processing based on service requirements. The code snippet is as follows: + + ```ts + // Register the onRelease listener of the caller ability. + private regOnRelease(caller) { + try { + caller.on("release", (msg) => { + console.log(`caller onRelease is called ${msg}`) + }) + console.log('caller register OnRelease succeed') + } catch (error) { + console.log(`caller register OnRelease failed with ${error}`) + } + } + + async onButtonGetCaller() { + try { + this.caller = await context.startAbilityByCall({ + bundleName: 'com.samples.CallApplication', + abilityName: 'CalleeAbility' + }) + if (this.caller === undefined) { + console.log('get caller failed') + return + } + console.log('get caller success') + this.regOnRelease(this.caller) + } catch (error) { + console.log(`get caller failed with ${error}`) + } + } + ``` + + In the cross-device scenario, you need to specify the ID of the peer device. The code snippet is as follows: + + ```ts + async onButtonGetRemoteCaller() { + var caller = undefined + var context = this.context + + context.startAbilityByCall({ + deviceId: getRemoteDeviceId(), + bundleName: 'com.samples.CallApplication', + abilityName: 'CalleeAbility' + }).then((data) => { + if (data != null) { + caller = data + console.log('get remote caller success') + // Register the onRelease listener of the caller ability. + caller.on("release", (msg) => { + console.log(`remote caller onRelease is called ${msg}`) + }) + console.log('remote caller register OnRelease succeed') + } + }).catch((error) => { + console.error(`get remote caller failed with ${error}`) + }) + } + ``` + + Obtain the ID of the peer device from **DeviceManager**. Note that the **getTrustedDeviceListSync** API is open only to system applications. The code snippet is as follows: + + ```ts + import deviceManager from '@ohos.distributedHardware.deviceManager'; + var dmClass; + function getRemoteDeviceId() { + if (typeof dmClass === 'object' && dmClass != null) { + var list = dmClass.getTrustedDeviceListSync() + if (typeof (list) == 'undefined' || typeof (list.length) == 'undefined') { + console.log("EntryAbility onButtonClick getRemoteDeviceId err: list is null") + return + } + console.log("EntryAbility onButtonClick getRemoteDeviceId success:" + list[0].deviceId) + return list[0].deviceId + } else { + console.log("EntryAbility onButtonClick getRemoteDeviceId err: dmClass is null") + } + } + ``` + + In the cross-device scenario, your application must also apply for the data synchronization permission from end users. The code snippet is as follows: + + ```ts + import abilityAccessCtrl from '@ohos.abilityAccessCtrl.d.ts'; + + requestPermission() { + let context = this.context + let permissions: Array = ['ohos.permission.DISTRIBUTED_DATASYNC'] + let atManager = abilityAccessCtrl.createAtManager(); + atManager.requestPermissionsFromUser(context, permissions).then((data) => { + console.log("Succeed to request permission from user with data: "+ JSON.stringify(data)) + }).catch((error) => { + console.log("Failed to request permission from user with error: "+ JSON.stringify(error)) + }) + } + ``` + +3. **Send agreed sequenceable data.** + + The sequenceable data can be sent to the callee ability with or without a return value. The method and sequenceable data must be consistent with those of the callee ability. The following example describes how to send data to the callee ability. The code snippet is as follows: + + ```ts + const MSG_SEND_METHOD: string = 'CallSendMsg' + async onButtonCall() { + try { + let msg = new MySequenceable(1, 'origin_Msg') + await this.caller.call(MSG_SEND_METHOD, msg) + } catch (error) { + console.log(`caller call failed with ${error}`) + } + } + ``` + + In the following, **CallWithResult** is used to send data **originMsg** to the callee ability and assign the data processed by the **CallSendMsg** method to **backMsg**. The code snippet is as follows: + + ```ts + const MSG_SEND_METHOD: string = 'CallSendMsg' + originMsg: string = '' + backMsg: string = '' + async onButtonCallWithResult(originMsg, backMsg) { + try { + let msg = new MySequenceable(1, originMsg) + const data = await this.caller.callWithResult(MSG_SEND_METHOD, msg) + console.log('caller callWithResult succeed') + + let result = new MySequenceable(0, '') + data.readSequenceable(result) + backMsg(result.str) + console.log(`caller result is [${result.num}, ${result.str}]`) + } catch (error) { + console.log(`caller callWithResult failed with ${error}`) + } + } + ``` + +4. **Release the Caller object.** + + When the **Caller** object is no longer required, use **release()** to release it. The code snippet is as follows: + + ```ts + releaseCall() { + try { + this.caller.release() + this.caller = undefined + console.log('caller release succeed') + } catch (error) { + console.log(`caller release failed with ${error}`) + } + } + ``` \ No newline at end of file diff --git a/en/application-dev/ability-deprecated/stage-formextension.md b/en/application-dev/ability-deprecated/stage-formextension.md index bc1c54afe9d2e323f0938bca250f83737df9cbdb..8a0425f4fab41b97cd15ecb9986f77b4a108ae7a 100644 --- a/en/application-dev/ability-deprecated/stage-formextension.md +++ b/en/application-dev/ability-deprecated/stage-formextension.md @@ -135,7 +135,7 @@ To create a widget in the stage model, you need to implement lifecycle callbacks | Name | Description | Data Type | Default Value Allowed | | ----------- | ------------------------------------------------------------ | ---------- | -------------------- | | name | Name of the Extension ability. This field must be specified. | String | No | - | srcEntrance | Path of the Extension ability lifecycle code. This field must be specified.| String | No | + | srcEntry | Path of the Extension ability lifecycle code. This field must be specified.| String | No | | description | Description of the Extension ability. The value can be a string or a resource index to descriptions in multiple languages.| String | Yes (initial value: left empty)| | icon | Index of the Extension ability icon file. | String | Yes (initial value: left empty)| | label | Descriptive information about the Extension ability presented externally. The value can be a string or a resource index to the description.| String | Yes (initial value: left empty)| @@ -150,7 +150,7 @@ To create a widget in the stage model, you need to implement lifecycle callbacks ```json "extensionAbilities": [{ "name": "FormAbility", - "srcEntrance": "./ets/FormAbility/FormAbility.ts", + "srcEntry": "./ets/FormAbility/FormAbility.ts", "label": "$string:form_FormAbility_label", "description": "$string:form_FormAbility_desc", "type": "form", @@ -242,7 +242,7 @@ You should override **onDestroy** to implement widget data deletion. } ``` -For details about how to implement persistent data storage, see [Lightweight Data Store Development](../database/database-preference-guidelines.md). +For details about how to implement persistent data storage, see [Application Data Persistence Overview](../database/app-data-persistence-overview.md). The **Want** object passed in by the widget host to the widget provider contains a flag that specifies whether the requested widget is normal or temporary. @@ -366,7 +366,7 @@ You can set router and message events for components on a widget. The router eve 1. Set the **onclick** field in the HML file to **routerEvent** or **messageEvent**, depending on the **actions** settings in the JSON file. 2. Set the router event. - **action**: **"router"**, which indicates a router event. - - **abilityName**: target ability name, for example, **EntryAbility**, which is the default UIAbility name in DevEco Studio for the stage model. + - **abilityName**: target ability name, for example, **EntryAbility**, which is the default main ability name in DevEco Studio for the stage model. - **params**: custom parameters of the target ability. Set them as required. The value can be obtained from **parameters** in **want** used for starting the target ability. For example, in the lifecycle function **onCreate** of the EntryAbility in the stage model, you can obtain **want** and its **parameters** field. 3. Set the message event. - **action**: **"message"**, which indicates a message event. @@ -413,3 +413,5 @@ The code snippet is as follows: } } ``` + + \ No newline at end of file diff --git a/en/application-dev/ability-deprecated/stage-serviceextension.md b/en/application-dev/ability-deprecated/stage-serviceextension.md index aee8f9c8116dffb49956a2bb9a1cad2ad263a166..8f77e3251d56ff8023d8215546a38b0614f5c8b3 100644 --- a/en/application-dev/ability-deprecated/stage-serviceextension.md +++ b/en/application-dev/ability-deprecated/stage-serviceextension.md @@ -33,8 +33,8 @@ OpenHarmony does not support creation of a Service Extension ability for third-p "icon": "$media:icon", "description": "service", "type": "service", - "visible": true, - "srcEntrance": "./ets/ServiceExtAbility/ServiceExtAbility.ts" + "exported": true, + "srcEntry": "./ets/ServiceExtAbility/ServiceExtAbility.ts" }] ``` diff --git a/en/application-dev/application-dev-guide-for-gitee.md b/en/application-dev/application-dev-guide-for-gitee.md index 96e956f86e1528c5946c094b204c83e6e7d96222..1ad5989d2cf8258c46e219a239a2c8c5a1d1274c 100644 --- a/en/application-dev/application-dev-guide-for-gitee.md +++ b/en/application-dev/application-dev-guide-for-gitee.md @@ -24,14 +24,17 @@ First thing first, familiarize yourself with the two cornerstone frameworks in O All applications should be developed on top of these frameworks. Then, equip yourself for developing the key features, with the following guidelines: -- [Common Event and Notification](notification/Readme-EN.md) + +- [Web](web/web-component-overview.md) +- [Notification](notification/Readme-EN.md) - [Window Manager](windowmanager/Readme-EN.md) - [WebGL](webgl/Readme-EN.md) - [Media](media/Readme-EN.md) - [Security](security/Readme-EN.md) - [Connectivity](connectivity/Readme-EN.md) -- [Telephony](telephony/Readme-EN.md) +- [Telephony Service](telephony/Readme-EN.md) - [Data Management](database/Readme-EN.md) +- [File Management](file-management/Readme-EN.md) - [Task Management](task-management/Readme-EN.md) - [Device Management](device/Readme-EN.md) - [Device Usage Statistics](device-usage-statistics/Readme-EN.md) @@ -69,3 +72,5 @@ They are organized as follows: ### Readme For details about the principles and basic information of each subsystem, see the README file in [docs/en/readme](../readme). + + \ No newline at end of file diff --git a/en/application-dev/application-dev-guide.md b/en/application-dev/application-dev-guide.md index 650eaf0b956e544bd19e8892b0c6946a6839beb5..8170d075cf08e8258b7c8b3731661f0e4959c6aa 100644 --- a/en/application-dev/application-dev-guide.md +++ b/en/application-dev/application-dev-guide.md @@ -4,7 +4,7 @@ The application development documents provide reference for you to develop appli The documents are carefully organized as follows: -### Getting Started +## Getting Started [Here](quick-start/start-overview.md) you'll learn how to quickly get started with OpenHarmony application development. @@ -12,7 +12,7 @@ Browse the documents on the instructions for quickly building your first applica Check out the development fundamentals, which comprise descriptions of the package structure configuration file for OpenHarmony applications and the instructions for use of resource files. -### Development +## Development To facilitate your application development, we provide development guidelines for key features. @@ -24,14 +24,17 @@ First thing first, familiarize yourself with the two cornerstone frameworks in O All applications should be developed on top of these frameworks. Then, equip yourself for developing the key features, with the following guidelines: -- [Common Event and Notification](notification/notification-overview.md) + +- [Web](web/web-component-overview.md) +- [Notification](notification/notification-overview.md) - [Window Manager](windowmanager/window-overview.md) - [WebGL](webgl/webgl-overview.md) -- [Media](media/audio-overview.md) +- [Media](media/media-application-overview.md) - [Security](security/userauth-overview.md) - [Connectivity](connectivity/ipc-rpc-overview.md) -- [Telephony](telephony/telephony-overview.md) -- [Data Management](database/database-mdds-overview.md) +- [Telephony Service](telephony/telephony-overview.md) +- [Data Management](database/data-mgmt-overview.md) +- [File Management](file-management/file-management-overview.md) - [Task Management](task-management/background-task-overview.md) - [Device](device/usb-overview.md) - [Device Usage Statistics](device-usage-statistics/device-usage-statistics-overview.md) @@ -41,30 +44,28 @@ Then, equip yourself for developing the key features, with the following guideli - [OpenHarmony IDL Specifications and User Guide](IDL/idl-guidelines.md) - [Using Native APIs in Application Projects](napi/napi-guidelines.md) -### Tools +## Tools DevEco Studio is a high-performance integrated development environment (IDE) recommended for developing OpenHarmony applications. [Here](https://developer.harmonyos.com/en/docs/documentation/doc-guides/ohos-deveco-studio-overview-0000001263280421) you can learn everything about DevEco Studio, including how to use this tool to create a project and sign, debug, and run an application. -### Hands-On Tutorials +## Hands-On Tutorials To make you better understand how functions work together and jumpstart your application development projects, we provide stripped-down, real-world [samples](https://gitee.com/openharmony/applications_app_samples/blob/master/README.md) and [codelabs](https://gitee.com/openharmony/codelabs). -### API References +## API References API references encompass all components and APIs available in OpenHarmony, helping you use and integrate APIs more effectively. They are organized as follows: -- [Component Reference (TypeScript-based Declarative Development Paradigm)](reference/arkui-ts/Readme-EN.md) - -- [Component Reference (JavaScript-based Web-like Development Paradigm)](reference/arkui-js/Readme-EN.md) - -- [JS Service Widget UI Components](reference/js-service-widget-ui/Readme-EN.md) - -- [JS and TS APIs](reference/apis/js-apis-ability-dataUriUtils.md) - +- [Component Reference (TypeScript-based Declarative Development Paradigm)](reference/arkui-ts/ts-components-summary.md) +- [Component Reference (JavaScript-compatible Web-like Development Paradigm-ArkUI.Full)](reference/arkui-js/js-components-common-attributes.md) +- [Component Reference (JavaScript-compatible Web-like Development Paradigm-ArkUI.Lite)](reference/arkui-js-lite/js-framework-file.md) +- [JS Service Widget UI Components](reference/js-service-widget-ui/js-service-widget-file.md) +- [JS and TS APIs](reference/apis/development-intro.md) - Native APIs - [Standard Library](reference/native-lib/third_party_libc/musl.md) - - [Node_API](reference/native-lib/third_party_napi/napi.md) + - [Node_API](reference/native-lib/third_party_napi/napi.md) + \ No newline at end of file diff --git a/en/application-dev/application-models/Readme-EN.md b/en/application-dev/application-models/Readme-EN.md index efc515db54971c76432f02b5f409990ecbd767b7..b38074f214762a1d42474e7e12005314427d3ee1 100644 --- a/en/application-dev/application-models/Readme-EN.md +++ b/en/application-dev/application-models/Readme-EN.md @@ -17,9 +17,11 @@ - ExtensionAbility Component - [ExtensionAbility Component Overview](extensionability-overview.md) - [ServiceExtensionAbility](serviceextensionability.md) - - [DataShareExtensionAbility](datashareextensionability.md) - [FormExtensionAbility (Widget)](widget-development-stage.md) - - [StaticSubscriberExtensionAbility](static-subscriber-extension-ability.md) + - [AccessibilityExtensionAbility](accessibilityextensionability.md) + - [EnterpriseAdminExtensionAbility](enterprise-extensionAbility.md) + - [InputMethodExtensionAbility](inputmethodextentionability.md) + - [WindowExtensionAbility](windowextensionability.md) - [AbilityStage Component Container](abilitystage.md) - [Context](application-context-stage.md) - Want @@ -32,15 +34,19 @@ - [Component Startup Rules](component-startup-rules.md) - Inter-Device Application Component Interaction (Continuation) - [Continuation Overview](inter-device-interaction-hop-overview.md) - - [Cross-Device Migration](hop-cross-device-migration.md) - - [Multi-device Collaboration](hop-multi-device-collaboration.md) + - [Cross-Device Migration (for System Applications Only)](hop-cross-device-migration.md) + - [Multi-device Collaboration (for System Applications Only)](hop-multi-device-collaboration.md) + - [Subscribing to System Environment Variable Changes](subscribe-system-environment-variable-changes.md) - IPC - [Process Model](process-model-stage.md) - Common Events - [Introduction to Common Events](common-event-overview.md) - - [Subscribing to Common Events](common-event-subscription.md) + - Common Event Subscription + - [Common Event Subscription Overview](common-event-subscription-overview.md) + - [Subscribing to Common Events in Dynamic Mode](common-event-subscription.md) + - [Subscribing to Common Events in Static Mode (for System Applications Only)](common-event-static-subscription.md) + - [Unsubscribing from Common Events](common-event-unsubscription.md) - [Publishing Common Events](common-event-publish.md) - - [Unsubscribing from Common Events](common-event-unsubscription.md) - [Background Services](background-services.md) - Inter-Thread Communication - [Thread Model](thread-model-stage.md) @@ -50,6 +56,7 @@ - [Mission Management Scenarios](mission-management-overview.md) - [Mission Management and Launch Type](mission-management-launch-type.md) - [Page Stack and MissionList](page-mission-stack.md) + - [Setting the Icon and Name of a Mission Snapshot](mission-set-icon-name-for-task-snapshot.md) - [Application Configuration File](config-file-stage.md) - FA Model Development - [FA Model Development Overview](fa-model-development-overview.md) @@ -63,7 +70,7 @@ - [Creating a PageAbility](create-pageability.md) - [Starting a Local PageAbility](start-local-pageability.md) - [Stopping a PageAbility](stop-pageability.md) - - [Starting a Remote PageAbility](start-remote-pageability.md) + - [Starting a Remote PageAbility (for System Applications Only)](start-remote-pageability.md) - [Starting a Specified Page](start-page.md) - [Window Properties](window-properties.md) - [Requesting Permissions](request-permissions.md) diff --git a/en/application-dev/application-models/ability-startup-with-explicit-want.md b/en/application-dev/application-models/ability-startup-with-explicit-want.md index 9186379f32299ee7a42b7f82af4fc7f464c160d1..6b61b06311a519e959e87d826e4a27c8b2b3d208 100644 --- a/en/application-dev/application-models/ability-startup-with-explicit-want.md +++ b/en/application-dev/application-models/ability-startup-with-explicit-want.md @@ -1,4 +1,7 @@ # Using Explicit Want to Start an Ability +When a user touches a button in an application, the application often needs to start a UIAbility component to complete a specific task. If the **abilityName** and **bundleName** parameters are specified when starting a UIAbility, then the explicit Want is used. -When a user touches a button in an application, the application often needs to start a UIAbility component to complete a specific task. If the **abilityName** and **bundleName** parameters are specified when starting a UIAbility, the explicit Want is used. For details about how to use the explicit Want, see [Starting UIAbility in the Same Application](uiability-intra-device-interaction.md#starting-uiability-in-the-same-application). +## Using Explicit Want + +The user touches a button in the application to start the UIAbility component to complete a specific task. To start the UIAbility component in explicit Want mode, the **abilityName** and **bundleName** parameters must be specified. For details, see [Starting UIAbility in the Same Application](uiability-intra-device-interaction.md#starting-uiability-in-the-same-application). diff --git a/en/application-dev/application-models/ability-startup-with-implicit-want.md b/en/application-dev/application-models/ability-startup-with-implicit-want.md index 6550e5c628c642cf227cfde5f74eef7b61c8a52b..dbd65bb560d7531bb6e00b21c004815fda1a997c 100644 --- a/en/application-dev/application-models/ability-startup-with-implicit-want.md +++ b/en/application-dev/application-models/ability-startup-with-implicit-want.md @@ -1,77 +1,78 @@ # Using Implicit Want to Open a Website - -## Prerequisites - -One or more browsers are installed on your device. - -The **module.json5** of a browser application is as follows: +This section uses the operation of using a browser to open a website as an example. It is assumed that one or more browser applications are installed on the device. To ensure that the browser application can work properly, configure the [module.json5 file](../quick-start/module-configuration-file.md) as follows: ```json -"skills": [ - { - "entities": [ - "entity.system.browsable" - // ... - ], - "actions": [ - "ohos.want.action.viewData" - // ... - ], - "uris": [ - { - "scheme": "https", - "host": "www.test.com", - "port": "8080", - // Prefix matching is used. - "pathStartWith": "query", - "type": "text/*" - }, +{ + "module": { + // ... + "abilities": [ { - "scheme": "http", // ... + "skills": [ + { + "entities": [ + "entity.system.home", + "entity.system.browsable" + // ... + ], + "actions": [ + "action.system.home", + "ohos.want.action.viewData" + // ... + ], + "uris": [ + { + "scheme": "https", + "host": "www.test.com", + "port": "8080", + // Prefix matching is used. + "pathStartWith": "query" + }, + { + "scheme": "http", + // ... + } + // ... + ] + } + ] } - // ... ] - }, -] + } +} ``` +In the initiator UIAbility, use implicit Want to start the browser application. -## How to Develop +```ts +import common from '@ohos.app.ability.common'; -1. Use the custom function **implicitStartAbility** to start an ability. - - ```ts - async implicitStartAbility() { - try { - let want = { - // Uncomment the line below if you want to implicitly query data only in the specific bundle. - // bundleName: "com.example.myapplication", - "action": "ohos.want.action.viewData", - // entities can be omitted. - "entities": [ "entity.system.browsable" ], - "uri": "https://www.test.com:8080/query/student", - "type": "text/plain" - } - let context = getContext(this) as common.UIAbilityContext; - await context.startAbility(want) - console.info(`explicit start ability succeed`) - } catch (error) { - console.info(`explicit start ability failed with ${error.code}`) - } - } - ``` - - The matching process is as follows: - 1. If **action** in the passed **want** parameter is specified and is included in **actions** under **skills**, the matching is successful. - - 2. If **entities** in the passed **want** parameter is specified and is included in **entities** under **skills**, the matching is successful. +function implicitStartAbility() { + let context = getContext(this) as common.UIAbilityContext; + let wantInfo = { + // Uncomment the line below if you want to implicitly query data only in the specific bundle. + // bundleName: 'com.example.myapplication', + 'action': 'ohos.want.action.viewData', + // entities can be omitted. + 'entities': ['entity.system.browsable'], + 'uri': 'https://www.test.com:8080/query/student' + } + context.startAbility(wantInfo).then(() => { + // ... + }).catch((err) => { + // ... + }) +} +``` - 3. If **uri** in the passed **want** parameter is included in **uris** under **skills**, which is concatenated into `https://www.test.com:8080/query*` (where \* is a wildcard), the matching is successful. +The matching process is as follows: - 4. If **type** in the passed **want** parameter is specified and is included in **type** under **skills**, the matching is successful. +1. If **action** in the passed **want** parameter is specified and is included in **actions** under **skills** of the ability to match, the matching is successful. +2. If **entities** in the passed **want** parameter is specified and is included in **entities** under **skills** of the ability to match, the matching is successful. +3. If **uri** in the passed **want** parameter is included in **uris** under **skills** of the ability to match, which is concatenated into https://www.test.com:8080/query* (where * is a wildcard), the matching is successful. +4. If **type** in the passed **want** parameter is specified and is included in **type** under **skills** of the ability to match, the matching is successful. -2. When there are multiple matching applications, a dialog box is displayed for you to select one of them. +If there are multiple matching applications, the system displays a dialog box for you to select one of them. The following figure shows an example. - ![stage-want1](figures/stage-want1.png) +![](figures/ability-startup-with-implicit-want1.png) \ No newline at end of file diff --git a/en/application-dev/application-models/abilitystage.md b/en/application-dev/application-models/abilitystage.md index 4e0a273f850b4919d0964580ebed89c053c273f7..9a4e71d3fa696ee6f2707545b80456df34fe85ac 100644 --- a/en/application-dev/application-models/abilitystage.md +++ b/en/application-dev/application-models/abilitystage.md @@ -29,6 +29,18 @@ AbilityStage is not automatically generated in the default project of DevEco Stu } } ``` + +4. Set **srcEntry** in the [module.json5 file](../quick-start/module-configuration-file.md) to the code path of the module. + ```json + { + "module": { + "name": "entry", + "type": "entry", + "srcEntry": "./ets/myabilitystage/MyAbilityStage.ts", + // ... + } + } + ``` [AbilityStage](../reference/apis/js-apis-app-ability-abilityStage.md) has the lifecycle callback [onCreate()](../reference/apis/js-apis-app-ability-abilityStage.md#abilitystageoncreate) and the event callbacks [onAcceptWant()](../reference/apis/js-apis-app-ability-abilityStage.md#abilitystageonacceptwant), [onConfigurationUpdated()](../reference/apis/js-apis-app-ability-abilityStage.md#abilitystageonconfigurationupdate), and [onMemoryLevel()](../reference/apis/js-apis-app-ability-abilityStage.md#abilitystageonmemorylevel). @@ -41,6 +53,7 @@ AbilityStage is not automatically generated in the default project of DevEco Stu - **onConfigurationUpdated()** event callback: triggered when the global system configuration changes. The global system configuration, such as the system language and theme, are defined in the [Configuration](../reference/apis/js-apis-app-ability-configuration.md) class before project configuration. - **onMemoryLevel()** event callback: triggered when the system adjusts the memory. + When an application is switched to the background, it is cached in the background. This adversely affects the overall system performance. When system resources are insufficient, the system reclaims memory from applications in multiple ways. For example, the system may stop applications to release memory for executing key tasks. To further maintain the balance of the system memory and prevent the system from stopping application processes, you can subscribe to the system memory changes in the **onMemoryLevel()** lifecycle callback of AbilityStage to release unnecessary resources. @@ -54,4 +67,3 @@ When an application is switched to the background, it is cached in the backgroun } } ``` - diff --git a/en/application-dev/application-models/application-context-stage.md b/en/application-dev/application-models/application-context-stage.md index de07a3600a27b619f144a4f22223e17616f80805..5308d1899a46ffb9907a18bd74a7920627ac720b 100644 --- a/en/application-dev/application-models/application-context-stage.md +++ b/en/application-dev/application-models/application-context-stage.md @@ -19,10 +19,10 @@ ```ts import UIAbility from '@ohos.app.ability.UIAbility'; export default class EntryAbility extends UIAbility { - onCreate(want, launchParam) { - let uiAbilityContext = this.context; - // ... - } + onCreate(want, launchParam) { + let uiAbilityContext = this.context; + // ... + } } ``` @@ -34,21 +34,21 @@ ```ts import ServiceExtensionAbility from '@ohos.app.ability.ServiceExtensionAbility'; export default class MyService extends ServiceExtensionAbility { - onCreate(want) { - let serviceExtensionContext = this.context; - // ... - } + onCreate(want) { + let serviceExtensionContext = this.context; + // ... + } } ``` - [AbilityStageContext](../reference/apis/js-apis-inner-application-abilityStageContext.md): module-level context. It provides **HapModuleInfo** and **Configuration** in addition to those provided by the base class **Context**. ```ts - import AbilityStage from "@ohos.app.ability.AbilityStage"; + import AbilityStage from '@ohos.app.ability.AbilityStage'; export default class MyAbilityStage extends AbilityStage { - onCreate() { - let abilityStageContext = this.context; - // ... - } + onCreate() { + let abilityStageContext = this.context; + // ... + } } ``` - [ApplicationContext](../reference/apis/js-apis-inner-application-applicationContext.md): application-level context. It provides APIs for subscribing to application component lifecycle changes, system memory changes, and system environment changes. The application-level context can be obtained from UIAbility, ExtensionAbility, and AbilityStage. @@ -56,10 +56,10 @@ ```ts import UIAbility from '@ohos.app.ability.UIAbility'; export default class EntryAbility extends UIAbility { - onCreate(want, launchParam) { - let applicationContext = this.context.getApplicationContext(); - // ... - } + onCreate(want, launchParam) { + let applicationContext = this.context.getApplicationContext(); + // ... + } } ``` @@ -71,7 +71,7 @@ This topic describes how to use the context in the following scenarios: - [Obtaining the Application Development Path](#obtaining-the-application-development-path) -- [Obtaining and Modifying Encrypted Areas](#obtaining-and-modifying-encrypted-areas) +- [Obtaining and Modifying Encryption Areas](#obtaining-and-modifying-encryption-areas) - [Creating Context of Another Application or Module](#creating-context-of-another-application-or-module) - [Subscribing to UIAbility Lifecycle Changes in a Process](#subscribing-to-uiability-lifecycle-changes-in-a-process) @@ -84,13 +84,13 @@ The following table describes the application development paths obtained from co | Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| cacheDir | string | Yes| No| Cache directory of the application on the internal storage.
It is the content of **Storage** of an application under **Settings > Apps & services > Apps**.| -| tempDir | string | Yes| No| Temporary file directory of the application.
Files in this directory are deleted after the application is uninstalled.| -| filesDir | string | Yes| No| File directory of the application on the internal storage.
Files in this directory may be synchronized to other directories during application migration or backup.| -| databaseDir | string | Yes| No| Storage directory of the local database.| -| bundleCodeDir | string | Yes| No| Installation directory of the application on the internal storage.| -| distributedFilesDir | string | Yes| No| Storage directory of distributed application data files.| -| preferencesDir | string | Yes| Yes| Preferences directory of the application.| +| bundleCodeDir | string | Yes | No | Path for storing the application's installation package, that is, installation directory of the application on the internal storage. | +| cacheDir | string | Yes| No| Path for storing the application's cache files, that is, cache directory of the application on the internal storage.
It is the content of **Storage** of an application under **Settings > Apps & services > Apps**.| +| filesDir | string | Yes | No | Path for storing the application's common files, that is, file directory of the application on the internal storage.
Files in this directory may be synchronized to other directories during application migration or backup.| +| preferencesDir | string | Yes | Yes | Path for storing the application's preference files, that is, preferences directory of the application. | +| tempDir | string | Yes | No | Path for storing the application's temporary files.
Files in this directory are deleted after the application is uninstalled.| +| databaseDir | string | Yes | No | Path for storing the application's database, that is, storage directory of the local database. | +| distributedFilesDir | string | Yes| No| Path for storing the application's distributed files.| The capability of obtaining the application development path is provided by the base class **Context**. This capability is also provided by **ApplicationContext**, **AbilityStageContext**, **UIAbilityContext**, and **ExtensionContext**. However, the paths obtained from different contexts may differ, as shown below. @@ -127,16 +127,16 @@ The sample code for obtaining the application development paths is as follows: import UIAbility from '@ohos.app.ability.UIAbility'; export default class EntryAbility extends UIAbility { - onCreate(want, launchParam) { - let cacheDir = this.context.cacheDir; - let tempDir = this.context.tempDir; - let filesDir = this.context.filesDir; - let databaseDir = this.context.databaseDir; - let bundleCodeDir = this.context.bundleCodeDir; - let distributedFilesDir = this.context.distributedFilesDir; - let preferencesDir = this.context.preferencesDir; - // ... - } + onCreate(want, launchParam) { + let cacheDir = this.context.cacheDir; + let tempDir = this.context.tempDir; + let filesDir = this.context.filesDir; + let databaseDir = this.context.databaseDir; + let bundleCodeDir = this.context.bundleCodeDir; + let distributedFilesDir = this.context.distributedFilesDir; + let preferencesDir = this.context.preferencesDir; + // ... + } } ``` @@ -144,45 +144,52 @@ export default class EntryAbility extends UIAbility { > > The sample code obtains the sandbox path of the application development path. The absolute path can be obtained by running the **find / -name ** command in the hdc shell after file creation or modification. -### Obtaining and Modifying Encrypted Areas +### Obtaining and Modifying Encryption Areas -You can read and write [the area attribute in the context](../reference/apis/js-apis-inner-application-context.md) to obtain and set an encrypted area. Two encryption levels are supported: +Encrypting application files enhances data security by preventing files from unauthorized access. Different application files require different levels of protection. For private files, such as alarms and wallpapers, the application must place them in the device-level encryption area (EL1) to ensure that they can be accessed before the user enters the password. For sensitive files, such as personal privacy data, the application must place them in the user-level encryption area (EL2). -- AreaMode.EL1: device-level encryption area, which is accessible after the device is powered on. +In practice, you need to select a proper encrypted area based on scenario-specific requirements to protect application data security. The proper use of EL1 and the EL2 can efficiently improve the security. -- AreaMode.EL2: user-level encryption area, which is accessible only after the device is powered on and the password is entered (for the first time). +> **NOTE** +> +> - AreaMode.EL1: device-level encryption area, which is accessible after the device is powered on. +> +> - AreaMode.EL2: user-level encryption area, which is accessible only after the device is powered on and the password is entered (for the first time). + +You can obtain and set the encryption area by reading and writing the [area attribute in Context](../reference/apis/js-apis-inner-application-context.md). ```ts import UIAbility from '@ohos.app.ability.UIAbility'; export default class EntryAbility extends UIAbility { - onCreate(want, launchParam) { - // Before storing common information, switch the encryption level to EL1. - if (this.context.area === 1) {// Obtain the area. - this.context.area = 0; // Modify the area. - } - // Store common information. - - // Before storing sensitive information, switch the encryption level to EL2. - if (this.context.area === 0) { // Obtain the area. - this.context.area = 1; // Modify the area. - } - // Store sensitive information. + onCreate(want, launchParam) { + // Before storing common information, switch the encryption level to EL1. + if (this.context.area === 1) {// Obtain the area. + this.context.area = 0; // Modify the area. } + // Store common information. + + // Before storing sensitive information, switch the encryption level to EL2. + if (this.context.area === 0) { // Obtain the area. + this.context.area = 1; // Modify the area. + } + // Store sensitive information. + } } ``` ### Creating Context of Another Application or Module -The base class **Context** provides the [createBundleContext(bundleName:string)](../reference/apis/js-apis-inner-application-context.md#contextcreatebundlecontext), [createModuleContext(moduleName:string)](../reference/apis/js-apis-inner-application-context.md#contextcreatemodulecontext), and [createModuleContext(bundleName:string, moduleName:string)](../reference/apis/js-apis-inner-application-context.md#contextcreatemodulecontext-1) methods for creating the context of other applications or modules, so as to obtain the resource information, for example, [obtaining the application development paths](#obtaining-the-application-development-path) of other modules. +The base class **Context** provides [createBundleContext(bundleName:string)](../reference/apis/js-apis-inner-application-context.md#contextcreatebundlecontext), [createModuleContext(moduleName:string)](../reference/apis/js-apis-inner-application-context.md#contextcreatemodulecontext), and [createModuleContext(bundleName:string, moduleName:string)](../reference/apis/js-apis-inner-application-context.md#contextcreatemodulecontext-1) to create the context of other applications or modules, so as to obtain the resource information, for example, [obtaining the application development paths](#obtaining-the-application-development-path) of other modules. - Call **createBundleContext(bundleName:string)** to create the context of another application. > **NOTE** > > To obtain the context of another application: > - > - Request the **ohos.permission.GET_BUNDLE_INFO_PRIVILEGED** permission. For details, see [Permission Application Guide](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). + > - Request the **ohos.permission.GET_BUNDLE_INFO_PRIVILEGED** permission. For details, see [Declaring Permissions in the Configuration File](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). + > > - This is a system API and cannot be called by third-party applications. For example, application information displayed on the home screen includes the application name and icon. The home screen application calls the foregoing method to obtain the context information, so as to obtain the resource information including the application name and icon. @@ -191,12 +198,12 @@ The base class **Context** provides the [createBundleContext(bundleName:string)] import UIAbility from '@ohos.app.ability.UIAbility'; export default class EntryAbility extends UIAbility { - onCreate(want, launchParam) { - let bundleName2 = "com.example.application"; - let context2 = this.context.createBundleContext(bundleName2); - let label2 = context2.applicationInfo.label; - // ... - } + onCreate(want, launchParam) { + let bundleName2 = 'com.example.application'; + let context2 = this.context.createBundleContext(bundleName2); + let label2 = context2.applicationInfo.label; + // ... + } } ``` @@ -205,99 +212,113 @@ The base class **Context** provides the [createBundleContext(bundleName:string)] > > To obtain the context of a specified module of another application: > - > - Request the **ohos.permission.GET_BUNDLE_INFO_PRIVILEGED** permission. For details, see [Permission Application Guide](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). + > - Request the **ohos.permission.GET_BUNDLE_INFO_PRIVILEGED** permission. For details, see [Declaring Permissions in the Configuration File](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). + > > - This is a system API and cannot be called by third-party applications. - + ```ts import UIAbility from '@ohos.app.ability.UIAbility'; export default class EntryAbility extends UIAbility { - onCreate(want, launchParam) { - let bundleName2 = "com.example.application"; - let moduleName2 = "module1"; - let context2 = this.context.createModuleContext(bundleName2, moduleName2); - // ... - } + onCreate(want, launchParam) { + let bundleName2 = 'com.example.application'; + let moduleName2 = 'module1'; + let context2 = this.context.createModuleContext(bundleName2, moduleName2); + // ... + } } ``` - + - Call **createModuleContext(moduleName:string)** to obtain the context of another module in the current application. After obtaining the context, you can obtain the resource information of that module. ```ts import UIAbility from '@ohos.app.ability.UIAbility'; export default class EntryAbility extends UIAbility { - onCreate(want, launchParam) { - let moduleName2 = "module1"; - let context2 = this.context.createModuleContext(moduleName2); - // ... - } + onCreate(want, launchParam) { + let moduleName2 = 'module1'; + let context2 = this.context.createModuleContext(moduleName2); + // ... + } } ``` ### Subscribing to UIAbility Lifecycle Changes in a Process -In the DFX statistics scenario of an application, if you need to collect statistics on the stay duration and access frequency of a page, you can subscribe to UIAbility lifecycle changes. +In the DFX statistics scenario of an application, if you need to collect statistics on the stay duration and access frequency of a page, you can subscribe to UIAbility lifecycle changes in a process. -[ApplicationContext](../reference/apis/js-apis-inner-application-applicationContext.md) provides APIs for subscribing to UIAbility lifecycle changes in a process. When the UIAbility lifecycle changes in a process, for example, being created or destroyed, becoming visible or invisible, or gaining or losing focus, the corresponding callback is triggered, and a listener ID is returned. The ID is incremented by 1 each time the listener is registered. When the number of listeners exceeds the upper limit (2^63-1), -1 is returned. The following uses [UIAbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md) as an example. +[ApplicationContext](../reference/apis/js-apis-inner-application-applicationContext) provides APIs for subscribing to UIAbility lifecycle changes in a process. When the UIAbility lifecycle changes in a process, for example, being created or destroyed, becoming visible or invisible, or gaining or losing focus, the corresponding callback is triggered. Each time the callback is registered, a listener lifecycle ID is returned, with the value incremented by 1 each time. When the number of listeners exceeds the upper limit (2^63-1), **-1** is returned. The following uses [UIAbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md) as an example. ```ts import UIAbility from '@ohos.app.ability.UIAbility'; import window from '@ohos.window'; -const TAG: string = "[Example].[Entry].[EntryAbility]"; +const TAG: string = '[Example].[Entry].[EntryAbility]'; export default class EntryAbility extends UIAbility { - lifecycleId: number; - - onCreate(want, launchParam) { - let abilityLifecycleCallback = { - onAbilityCreate(uiability) { - console.info(TAG, "onAbilityCreate uiability:" + JSON.stringify(uiability)); - }, - onWindowStageCreate(uiability, windowStage) { - console.info(TAG, "onWindowStageCreate uiability:" + JSON.stringify(uiability)); - console.info(TAG, "onWindowStageCreate windowStage:" + JSON.stringify(windowStage)); - }, - onWindowStageActive(uiability, windowStage) { - console.info(TAG, "onWindowStageActive uiability:" + JSON.stringify(uiability)); - console.info(TAG, "onWindowStageActive windowStage:" + JSON.stringify(windowStage)); - }, - onWindowStageInactive(uiability, windowStage) { - console.info(TAG, "onWindowStageInactive uiability:" + JSON.stringify(uiability)); - console.info(TAG, "onWindowStageInactive windowStage:" + JSON.stringify(windowStage)); - }, - onWindowStageDestroy(uiability, windowStage) { - console.info(TAG, "onWindowStageDestroy uiability:" + JSON.stringify(uiability)); - console.info(TAG, "onWindowStageDestroy windowStage:" + JSON.stringify(windowStage)); - }, - onAbilityDestroy(uiability) { - console.info(TAG, "onAbilityDestroy uiability:" + JSON.stringify(uiability)); - }, - onAbilityForeground(uiability) { - console.info(TAG, "onAbilityForeground uiability:" + JSON.stringify(uiability)); - }, - onAbilityBackground(uiability) { - console.info(TAG, "onAbilityBackground uiability:" + JSON.stringify(uiability)); - }, - onAbilityContinue(uiability) { - console.info(TAG, "onAbilityContinue uiability:" + JSON.stringify(uiability)); - } - } - // 1. Obtain the application context through the context attribute. - let applicationContext = this.context.getApplicationContext(); - // 2. Register a listener for the lifecycle changes through the application context. - this.lifecycleId = applicationContext.on("abilityLifecycle", abilityLifecycleCallback); - console.info(TAG, "register callback number: " + JSON.stringify(this.lifecycleId)); + // Define a lifecycle ID. + lifecycleId: number; + + onCreate(want, launchParam) { + // Define a lifecycle callback object. + let abilityLifecycleCallback = { + // Called when a UIAbility is created. + onAbilityCreate(uiAbility) { + console.log(TAG, `onAbilityCreate uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`); + }, + // Called when a window is created. + onWindowStageCreate(uiAbility, windowStage: window.WindowStage) { + console.log(TAG, `onWindowStageCreate uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`); + console.log(TAG, `onWindowStageCreate windowStage: ${JSON.stringify(windowStage)}`); + }, + // Called when the window becomes active. + onWindowStageActive(uiAbility, windowStage: window.WindowStage) { + console.log(TAG, `onWindowStageActive uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`); + console.log(TAG, `onWindowStageActive windowStage: ${JSON.stringify(windowStage)}`); + }, + // Called when the window becomes inactive. + onWindowStageInactive(uiAbility, windowStage: window.WindowStage) { + console.log(TAG, `onWindowStageInactive uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`); + console.log(TAG, `onWindowStageInactive windowStage: ${JSON.stringify(windowStage)}`); + }, + // Called when the window is destroyed. + onWindowStageDestroy(uiAbility, windowStage: window.WindowStage) { + console.log(TAG, `onWindowStageDestroy uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`); + console.log(TAG, `onWindowStageDestroy windowStage: ${JSON.stringify(windowStage)}`); + }, + // Called when the UIAbility is destroyed. + onAbilityDestroy(uiAbility) { + console.log(TAG, `onAbilityDestroy uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`); + }, + // Called when the UIAbility is switched from the background to the foreground. + onAbilityForeground(uiAbility) { + console.log(TAG, `onAbilityForeground uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`); + }, + // Called when the UIAbility is switched from the foreground to the background. + onAbilityBackground(uiAbility) { + console.log(TAG, `onAbilityBackground uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`); + }, + // Called when UIAbility is continued on another device. + onAbilityContinue(uiAbility) { + console.log(TAG, `onAbilityContinue uiAbility.launchWant: ${JSON.stringify(uiAbility.launchWant)}`); + } } + // Obtain the application context. + let applicationContext = this.context.getApplicationContext(); + // Register the application lifecycle callback. + this.lifecycleId = applicationContext.on('abilityLifecycle', abilityLifecycleCallback); + console.log(TAG, `register callback number: ${this.lifecycleId}`); + } - onDestroy() { - let applicationContext = this.context.getApplicationContext(); - applicationContext.off("abilityLifecycle", this.lifecycleId, (error, data) => { - console.info(TAG, "unregister callback success, err: " + JSON.stringify(error)); - }); - } + // ... + + onDestroy() { + // Obtain the application context. + let applicationContext = this.context.getApplicationContext(); + // Deregister the application lifecycle callback. + applicationContext.off('abilityLifecycle', this.lifecycleId); + } } ``` diff --git a/en/application-dev/application-models/common-event-overview.md b/en/application-dev/application-models/common-event-overview.md index 0d3788b41b516d0af9619d320ceeefc3f52c74c5..e8be9abaa3015a5512c47af55d2f364be0de79ad 100644 --- a/en/application-dev/application-models/common-event-overview.md +++ b/en/application-dev/application-models/common-event-overview.md @@ -15,14 +15,15 @@ Common events are classified into system common events and custom common events. Common events are also classified into unordered, ordered, and sticky common events. -- Unordered common events: CES forwards common events based on the subscription sequence, regardless of whether subscribers receive the events. +- Unordered common events: common events that CES forwards regardless of whether subscribers receive the events and when they subscribe to the events. -- Ordered common event: CES forwards common events to the next subscriber only after receiving a reply from the previous subscriber. +- Ordered common events: common events that CES forwards based on the subscriber priority. CES forwards common events to the subscriber with lower priority only after receiving a reply from the previous subscriber with higher priority. Subscribers with the same priority receive common events in a random order. -- Sticky common event: a public event that can be sent to a subscriber before they initiate a subscription. Only system applications or system services can send sticky common event, and they must request the **ohos.permission.COMMONEVENT_STICKY** permission. For details about the configuration, see [Permission Application Guide](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). +- Sticky common events: common events that can be sent to a subscriber before or after they initiate a subscription. Only system applications and system services can send sticky common events, which remain in the system after being sent. The sends must first request the **ohos.permission.COMMONEVENT_STICKY** permission. For details about the configuration, see [Permission Application Guide](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). Each application can subscribe to common events as required. After your application subscribes to a common event, the system sends it to your application every time the event is published. Such an event may be published by the system, other applications, or your own application. **Figure 1** Common events + ![common-event](figures/common-event.png) \ No newline at end of file diff --git a/en/application-dev/application-models/common-event-static-subscription.md b/en/application-dev/application-models/common-event-static-subscription.md new file mode 100644 index 0000000000000000000000000000000000000000..85852f5712df84107c6593160d276ed33557baf9 --- /dev/null +++ b/en/application-dev/application-models/common-event-static-subscription.md @@ -0,0 +1,105 @@ +# Subscribing to Common Events in Static Mode (for System Applications Only) + +## When to Use + +A static subscriber is started once it receives a target event published by the system or application. At the same time, the **onReceiveEvent** callback is triggered, in which you can implement the service logic. For example, if an application needs to execute some initialization tasks during device power-on, the application can subscribe to the power-on event in static mode. After receiving the power-on event, the application is started to execute the initialization tasks. Subscribing to a common event in static mode is achieved by configuring a declaration file and implementing a class that inherits from **StaticSubscriberExtensionAbility**. Note that this subscribing mode has negative impact on system power consumption. Therefore, exercise caution when using this mode. + +## How to Develop + +1. Declaring a Static Subscriber + + To declare a static subscriber, create an ExtensionAbility, which is derived from the **StaticSubscriberExtensionAbility** class, in the project. The sample code is as follows: + + ```ts + import StaticSubscriberExtensionAbility from '@ohos.application.StaticSubscriberExtensionAbility' + + export default class StaticSubscriber extends StaticSubscriberExtensionAbility { + onReceiveEvent(event) { + console.log('onReceiveEvent, event:' + event.event); + } + } + ``` + + You can implement service logic in the **onReceiveEvent** callback. + + + +2. Project Configuration for a Static Subscriber + + After writing the static subscriber code, configure the subscriber in the **module.json5** file. The configuration format is as follows: + + ```ts + { + "module": { + ...... + "extensionAbilities": [ + { + "name": "StaticSubscriber", + "srcEntrance": "./ets/StaticSubscriber/StaticSubscriber.ts", + "description": "$string:StaticSubscriber_desc", + "icon": "$media:icon", + "label": "$string:StaticSubscriber_label", + "type": "staticSubscriber", + "visible": true, + "metadata": [ + { + "name": "ohos.extension.staticSubscriber", + "resource": "$profile:subscribe" + } + ] + } + ] + ...... + } + } + ``` + + Pay attention to the following fields in the JSON file: + + - **srcEntrance**: entry file path of the ExtensionAbility, that is, the file path of the static subscriber declared in Step 2. + + - **type**: ExtensionAbility type. For a static subscriber, set this field to **staticSubscriber**. + + - **metadata**: level-2 configuration file information of the ExtensionAbility. The configuration information varies according to the ExtensionAbility type. Therefore, you must use different config files to indicate the specific configuration. + - **name**: name of the ExtensionAbility. For a static subscriber, declare the name as **ohos.extension.staticSubscriber** for successful identification. + - **resource**: path that stores the ExtensionAbility configuration, which is customizable. In this example, the path is **resources/base/profile/subscribe.json**. + + A level-2 configuration file pointed to by **metadata** must be in the following format: + + ```ts + { + "commonEvents": [ + { + "name": "xxx", + "permission": "xxx", + "events":[ + "xxx" + ] + } + ] + } + ``` + + If the level-2 configuration file is not declared in this format, the file cannot be identified. The fields are described as follows: + + - **name**: name of the ExtensionAbility, which must be the same as the name of **extensionAbility** declared in **module.json5**. + + - **permission**: permission required for the publisher. If a publisher without the required permission attempts to publish an event, the event is regarded as invalid and will not be published. + + - **events**: list of target events to subscribe to. + +3. Device System Configuration + + In the device system configuration file **/system/etc/app/install_list_capability.json**, add the bundle name of the static subscriber. + + ```json + { + "install_list": [ + { + "bundleName": "ohos.extension.staticSubscriber", + "allowCommonEvent": ["usual.event.A", "usual.event.B"], + } + ] + } + ``` + diff --git a/en/application-dev/application-models/common-event-subscription-overview.md b/en/application-dev/application-models/common-event-subscription-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..20064af92d3df2e6f7ab7d62c4f71f911848057a --- /dev/null +++ b/en/application-dev/application-models/common-event-subscription-overview.md @@ -0,0 +1,7 @@ +# Common Event Subscription Overview + +​The common event service provides two subscription modes: dynamic and static. The biggest difference between these two modes is that dynamic subscription requires the application to be running, while static subscription does not. + +- In dynamic subscription mode, a subscriber subscribes to common events by calling an API during the running period. For details, see [Subscribing to Common Events in Dynamic Mode](common-event-subscription.md). + +- In static subscription mode, a subscriber subscribes to common events by configuring a declaration file and implementing a class that inherits from StaticSubscriberExtensionAbility. For details, see [Subscribing to Common Events in Static Mode](common-event-static-subscription.md). diff --git a/en/application-dev/application-models/common-event-subscription.md b/en/application-dev/application-models/common-event-subscription.md index ce61e40458a7cbd5c9ec226138535da93d3766b1..6cdc52ef9b798e48a911892f965db8fbf2aaa67f 100644 --- a/en/application-dev/application-models/common-event-subscription.md +++ b/en/application-dev/application-models/common-event-subscription.md @@ -1,9 +1,9 @@ -# Subscribing to Common Events +# Subscribing to Common Events in Dynamic Mode ## When to Use -You can create a subscriber object to subscribe to a common event so as to obtain the parameters passed in the event. Certain system common events [require specific permissions](../security/accesstoken-guidelines.md) to subscribe to. For details, see [Required Permissions](../reference/apis/js-apis-commonEventManager.md#support). +In dynamic subscription mode, an application subscribes to a common event when it is running. If the subscribed event is published during the running period, the subscriber application will receive the event, together with the parameters passed in the event. For example, if an application expects to be notified of low battery so that it can reduce power consumption accordingly when running, then the application can subscribe to the low-battery event. Upon receiving the event, the application can close some unnecessary tasks to reduce power consumption. Certain system common events [require specific permissions](../security/accesstoken-guidelines.md) to subscribe to. For details, see [Required Permissions](../reference/apis/js-apis-commonEventManager.md#support). ## Available APIs diff --git a/en/application-dev/application-models/common-event-unsubscription.md b/en/application-dev/application-models/common-event-unsubscription.md index c87017ef08c05e8a22097c4bd2a05f52fc758134..1a44675d61947325a8c1a8790ff5f53626e43f57 100644 --- a/en/application-dev/application-models/common-event-unsubscription.md +++ b/en/application-dev/application-models/common-event-unsubscription.md @@ -1,9 +1,9 @@ -# Unsubscribing from Common Events +# Unsubscribing from Common Events in Dynamic Mode ## When to Use -You can call [unsubscribe()](../reference/apis/js-apis-commonEventManager.md#commoneventmanagerunsubscribe) to unsubscribe from a common event that is no longer required. +You can call [unsubscribe()](../reference/apis/js-apis-commonEventManager.md#commoneventmanagerunsubscribe) to unsubscribe from a common event that is no longer required in dynamic mode. ## Available APIs @@ -21,12 +21,12 @@ You can call [unsubscribe()](../reference/apis/js-apis-commonEventManager.md#com import commonEventManager from '@ohos.commonEventManager'; ``` -2. Subscribe to an event by following the procedure described in [Subscribing to Common Events](common-event-subscription.md). +2. Subscribe to an event by following the procedure described in [Subscribing to Common Events in Dynamic Mode](common-event-subscription.md). 3. Call **unsubscribe** in **CommonEvent** to unsubscribe from the common event. ```ts - // The subscriber object iscreated during event subscription. + // The subscriber object is created during event subscription. if (subscriber !== null) { commonEventManager.unsubscribe(subscriber, (err) => { if (err) { diff --git a/en/application-dev/application-models/component-startup-rules.md b/en/application-dev/application-models/component-startup-rules.md index 0e6c2ce33c68913221c7b09f02e96327b0ea1c30..26b2446893aea096611f896e878ef15888830afa 100644 --- a/en/application-dev/application-models/component-startup-rules.md +++ b/en/application-dev/application-models/component-startup-rules.md @@ -30,7 +30,7 @@ In view of this, OpenHarmony formulates a set of component startup rules, as fol - An application is considered as a foreground application only when the application process gains focus or its UIAbility component is running in the foreground. - Verify the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. -- **When the startAbilityByCall() method is used, verify the call permission.** For details, see [Using Ability Call to Implement UIAbility Interaction](uiability-intra-device-interaction.md#using-ability-call-to-implement-uiability-interaction) and [Using Cross-Device Ability Call](hop-multi-device-collaboration.md#using-cross-device-ability-call). +- **When the startAbilityByCall() method is used, verify the call permission.** For details, see [Using Call to Implement UIAbility Interaction](uiability-intra-device-interaction.md#using-call-to-implement-uiability-interaction) and [Using Cross-Device Call](hop-multi-device-collaboration.md#using-cross-device-call). - Verify the **ohos.permission.ABILITY_BACKGROUND_COMMUNICATION** permission. diff --git a/en/application-dev/application-models/create-pageability.md b/en/application-dev/application-models/create-pageability.md index 783646ff4cfd5fa2ab193005bfa9d182dc75b70c..d0f308ebc08e035d5568ee0e127a9739e400d124 100644 --- a/en/application-dev/application-models/create-pageability.md +++ b/en/application-dev/application-models/create-pageability.md @@ -76,22 +76,22 @@ In the FA model, you can call **getContext** of **featureAbility** to obtain the The following code snippet shows how to use **getContext()** to obtain the application context and distributed directory: ```ts -import featureAbility from '@ohos.ability.featureAbility' -import fileIo from '@ohos.fileio' +import featureAbility from '@ohos.ability.featureAbility'; +import fs from '@ohos.file.fs'; (async () => { - let dir: string + let dir: string; try { - console.info('Begin to getOrCreateDistributedDir') - dir = await featureAbility.getContext().getOrCreateDistributedDir() + console.info('Begin to getOrCreateDistributedDir'); + dir = await featureAbility.getContext().getOrCreateDistributedDir(); console.info('distribute dir is ' + dir) } catch (error) { - console.error('getOrCreateDistributedDir failed with ' + error) + console.error('getOrCreateDistributedDir failed with ' + error); } let fd: number; let path = dir + "/a.txt"; - fd = fileIo.openSync(path, 0o2 | 0o100, 0o666); - fileIo.close(fd); + fd = fs.openSync(path, fs.OpenMode.READ_WRITE).fd; + fs.close(fd); })() ``` diff --git a/en/application-dev/application-models/data-share-via-want.md b/en/application-dev/application-models/data-share-via-want.md index c04bea2916647804b51022cee1853f3b5d0a7d90..d5512e0c446b94dcf384504f11ff25d458cfeafc 100644 --- a/en/application-dev/application-models/data-share-via-want.md +++ b/en/application-dev/application-models/data-share-via-want.md @@ -1,111 +1,133 @@ # Using Want to Share Data Between Applications - Users often need to share data (such as a text or an image) from one application to another. The following uses PDF file sharing as an example to describe how to use Want to share data between applications. +Data sharing requires two UIAbility components (one for the sharing party and the other for the shared party) and one system component (used as the application sharing box). When the sharing party initiates data sharing by calling **startAbility()**, the system implicitly matches and displays all applications that support the type of data to share. After the user selects an application, the system starts the application to complete data sharing. -## Prerequisites - -1. There are two UIAbility components (one for the sharing party and the other for the shared party) and one system component (used as the application selector). When the sharing party initiates data sharing through **startAbility()**, the application selector is started. The system implicitly matches and displays all applications that support the type of data to share. After the user selects an application, the system starts that application to complete data sharing. - -2. In this section, data sharing is triggered by touching a button. You can use other ways to trigger data sharing during application development. This section focuses on the Want configuration used for data sharing. - -3. The following actions are involved in this section: - - **ACTION_SELECT (ohos.want.action.select)**: action of displaying the application selector. - - **ACTION_SEND_DATA (ohos.want.action.sendData)**: action of launching the UI for sending a single data record. It is used to transfer data to the shared party. - - -## How to Develop - -- Sharing party - 1. In the stage mode, the [File Descriptor (FD)](../reference/apis/js-apis-fileio.md#fileioopensync) is used for file transfer. This example assumes that the path of the file to share is obtained. - - ```ts - import fileIO from '@ohos.fileio'; - - // let path = ... - // Open the file whose path is a variable. - let fileFd = fileIO.openSync(path, 0o102, 0o666); - ``` - - 2. As described in the prerequisites, the sharing party starts an application selector and shares the data to the selector, and the selector transfers the data to the shared party. Want of the sharing party must be nested at two layers. At the first layer, implicit Want is used together with the **ohos.want.action.select** action to display the application selector. At the second layer, complete Want is declared in the custom field **parameters** to transfer the data to share. - - ```ts - import wantConstant from '@ohos.app.ability.wantConstant'; - - // let path = ... - // let fileFd = ... - // let fileSize = ... - let want = { - / This action is used to implicitly match the application selector. - action: wantConstant.Action.ACTION_SELECT, - // This is the custom parameter in the first layer of Want, - / which is intended to add information to the application selector. - parameters: { - // MIME type of PDF. - "ability.picker.type": "application/pdf", - "ability.picker.fileNames": [path], - "ability.picker.fileSizes": [fileSize], - // This nested Want ,which will be directly sent to the selected application. - "ability.want.params.INTENT": { - "action": "ohos.want.action.sendData", - "type": "application/pdf", - "parameters": { - "keyFd": {"type": "FD", "value": fileFd} - } - } - } +In this section, data sharing is triggered by touching a button. You can use other ways to trigger data sharing during application development. This section focuses on how to configure Want to implement data sharing. + +The following actions are involved for data sharing: + +- **ohos.want.action.select**: action of starting the application sharing box. +- **ohos.want.action.sendData**: action of sending a single data record, that is, transferring data to the shared party. + +## Sharing Party + +The sharing party starts an application sharing box and transfers the data to the shared party. Therefore, Want of the sharing party must be nested at two layers. In the first layer, implicit Want is used together with the **ohos.want.action.select** action to display the application sharing box. In the second layer, the data to share is declared + +in the custom field **parameters**, and then the Want that includes the **ohos.want.action.sendData** action and the **parameters** field is transferred to the application sharing box. The shared party obtains the shared data from **parameters**. + +```ts +import common from '@ohos.app.ability.common'; + +let fileType = 'application/pdf'; +let fileName = 'TestFile.pdf'; +let fileFd = -1; // Obtain the file descriptor (FD) of the file to share. +let fileSize; // Obtain the size of the file to share. + +function implicitStartAbility() { + let context = getContext(this) as common.UIAbilityContext; + let wantInfo = { + / This action is used to implicitly match the application sharing box. + action: 'ohos.want.action.select', + // This is the custom parameter in the first layer of Want, + / which is intended to add information to the application sharing box. + parameters: { + // MIME type of PDF. + 'ability.picker.type': fileType, + 'ability.picker.fileNames': [fileName], + 'ability.picker.fileSizes': [fileSize], + // This is nested Want ,which will be directly sent to the selected application. + 'ability.want.params.INTENT': { + 'action': 'ohos.want.action.sendData', + 'type': 'application/pdf', + 'parameters': { + 'keyFd': { 'type': 'FD', 'value': fileFd } + } } - ``` - - In the preceding code, the custom field **parameters** is used. The **ability.picker.\*** fields in the first-layer **parameters** are used to pass the information to be displayed on the application selector. The following fields are involved: - - - **"ability.picker.type"**: The application selector renders the file type icon based on this field. - - **"ability.picker.fileNames"**: The application selector displays the file name based on this field. - - **"ability.picker.fileSizes"**: The application selector displays the file size based on this field. The unit is byte. - - **"ability.picker.fileNames"** and **"ability.picker.fileSizes"** are arrays and have a one-to-one mapping. - - For example, when **"ability.picker.type"** is **"application/pdf"**, **"ability.picker.fileNames"** is **"["APIs.pdf"]"**, and **"ability.picker.fileSizes"** is **"[350 \* 1024]"**, the application selector is displayed as follows: - - ![stage-want2](figures/stage-want2.png) - - In the preceding code, the **ability.want.params.INTENT** field is nested Want. In this field, **action** and **type** are used for implicit matching by the application selector. For details about implicit matching, see [Matching Rules of Implicit Want](explicit-implicit-want-mappings.md#matching-rules-of-implicit-want). After the user selects an application, the nested Want of the **ability.want.params.INTENT** field is passed to that application. - -- Shared party - 1. As mentioned above, the application selector performs implicit matching based on the **ability.want.params.INTENT** field. Therefore, you must set **skills** in the ability configuration file (**module.json5** file in the stage model) of the shared party as follows: - - ```ts - "skills": [ - { - "entities": [ + } + } + context.startAbility(wantInfo).then(() => { + // ... + }).catch((err) => { + // ... + }) +} +``` + +> **NOTE** +> +> Data sharing can be implemented only in FD format. For details about how to obtain the FD and file name, see [File Management](../reference/apis/js-apis-file-fs.md). + +In the preceding code, under the custom field **parameters**, the following **ability.picker.*** fields are used to pass the information to be displayed on the application sharing box: + +- **ability.picker.type**: file type icon. +- **ability.picker.fileNames**: file name. +- **ability.picker.fileSizes**: file size, in bytes. +- **ability.picker.fileNames** and **ability.picker.fileSizes** are arrays and have a one-to-one mapping. + +The following figure shows an example. + +![](figures/ability-startup-with-implicit-want2.png) + +## Shared Party + +To enable the shared party to identify the shared content, configure **skills** in the [module.json5 file](../quick-start/module-configuration-file.md) of the UIAbility of the shared party. The **actions** and **type** fields in **uris** match the **action** and **type** fields in **ability.want.params.INTENT** of the sharing party, respectively. + +```json +{ + "module": { + // ... + "abilities": [ + { + // ... + "skills": [ + { // ... - ], - "actions": [ + "actions": [ + "action.system.home", "ohos.want.action.sendData" // ... - ], - "uris": [ - { - "type": "application/pdf" - }, - // ... - ] - }, - ] - ``` - - The **actions** and **type** fields in **uris** match the **action** and **type** fields in **ability.want.params.INTENT**, respectively. - - Files can be transferred in FD mode, but not URI mode. In implicit matching, the **type** field in Want must match the **type** field in **uris** under **skills** of the shared party. Therefore, specify only the **type** field in **uris**. If **host** and **port** are specified, the matching fails. The application selector initiates implicit matching based on **ability.want.params.INTENT**. Therefore, when the **uri** field added to **ability.want.params.INTENT** matches the **uris** field under **skills**, the matching is successful and additional data can be transferred. - 2. After the application selector starts the shared party, the system calls **onCreate** and passes **ability.want.params.INTENT** to the **want** parameter. - - ```ts - onCreate(want, launchParam) { - // When keyFd is undefined, the application crashes. - if (want["parameters"]["keyFd"] !== undefined) { - // Receive the file descriptor. - let fd = want["parameters"]["keyFd"].value; - // ... - } + ], + "uris": [ + { + "type": "application/pdf" + }, + ] + } + ] } - ``` + ] + } +} +``` + +After the user selects an application, the Want nested in the **ability.want.params.INTENT** field is passed to that application. The UIAbility of the shared party, after being started, can call [onCreate()](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityoncreate) or [onNewWant()](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityonnewwant) to obtain the passed Want. + +The following is an example of the Want obtained. You can use the FD of the shared file to perform required operations. + +```json +{ + "deviceId": "", + "bundleName": "com.example.myapplication", + "abilityName": "EntryAbility", + "moduleName": "entry", + "uri": "", + "type": "application/pdf", + "flags": 0, + "action": "ohos.want.action.sendData", + "parameters": { + "component.startup.newRules": true, + "keyFd": { + "type": "FD", + "value": 36 + }, + "mime-type": "application/pdf", + "moduleName": "entry", + "ohos.aafwk.param.callerPid": 3488, + "ohos.aafwk.param.callerToken": 537379209, + "ohos.aafwk.param.callerUid": 20010014 + }, + "entities": [] +} +``` diff --git a/en/application-dev/application-models/datashareextensionability.md b/en/application-dev/application-models/datashareextensionability.md index 5b07ba68180fbcc2a51047d37ca9a82addd89cd8..f671848f890277af92fc23869c5db0d57b02a316 100644 --- a/en/application-dev/application-models/datashareextensionability.md +++ b/en/application-dev/application-models/datashareextensionability.md @@ -1,4 +1,4 @@ -# DataShareExtensionAbility +# DataShareExtensionAbility (for System Applications Only) -DataShareExtensionAbility is available only for system application. It provides the data sharing capability. System applications can implement a DataShareExtensionAbility or access an existing DataShareExtensionAbility in the system. Third-party applications can only access an existing DataShareExtensionAbility. For details, see [DataShare Development](../database/database-datashare-guidelines.md). +DataShareExtensionAbility provides the data sharing capability. System applications can implement a DataShareExtensionAbility or access an existing DataShareExtensionAbility in the system. Third-party applications can only access an existing DataShareExtensionAbility. For details, see [DataShare Development](../database/database-datashare-guidelines.md). diff --git a/en/application-dev/application-models/enterprise-extensionAbility.md b/en/application-dev/application-models/enterprise-extensionAbility.md index 514e254f77981977c7c425a4ea2ddbebbcff9ca8..0038b41e5b4f654d8c7924ec1232bb342dd616cb 100644 --- a/en/application-dev/application-models/enterprise-extensionAbility.md +++ b/en/application-dev/application-models/enterprise-extensionAbility.md @@ -1,54 +1,51 @@ # EnterpriseAdminExtensionAbility Development -## Introduction +## Introduction to EnterpriseAdminExtensionAbility -**EnterpriseAdminExtensionAbility** is essential to a mobile device management (MDM) application. When developing an MDM application for an enterprise, you must inherit the **EnterpriseAdminExtensionAbility** class and have the MDM service logic implemented in an **EnterpriseAdminExtensionAbility** instance. The **EnterpriseAdminExtensionAbility** class provides callbacks for the enable, disable, install, and uninstall events of a device administrator application, implementing notification of system administrator status changes. +EnterpriseAdminExtensionAbility is a mandatory component for Mobile Device Management (MDM) applications. When developing MDM applications for enterprises, you need to inherit EnterpriseAdminExtensionAbility and implement MDM service logic in the EnterpriseAdminExtensionAbility instance. EnterpriseAdminExtensionAbility implements notifications of system management status changes and defines the callbacks for when a device administrator application is enabled or disabled or an application is installed or uninstalled. ## Constraints -- ***Function constraints*** +EnterpriseAdminExtensionAbility is applicable only to enterprise administrator applications. - The APIs provided can be used only by device administrator applications. - - -## Scenarios: Listening for the Enable, Disable, Install, and Uninstall Events of a Device Administrator Application +## Observing Activation/Deactivation of a Device Administrator Application and Installation/Removal of an Application ### Overview -**onAdminEnabled**: called when the enterprise administrator or employee deploys an MDM application and enables the DeviceAdmin permission for the application. The MDM application can set the initialization policy in the **onAdminEnabled** callback. +**onAdminEnabled**: When an enterprise administrator or employee deploys an MDM application and activates the device administrator application, this callback is invoked to notify the MDM application that the DeviceAdmin permission is activated. The initialization policy of the MDM application can set in **onAdminEnabled**. -**onAdminDisabled**: called when the system or employee disables the DeviceAdmin permission to notify the enterprise administrator that the device is no longer managed. +**onAdminDisabled**: When the device administrator application is deactivated, the callback is invoked to notify the MDM application that the DeviceAdmin permission is deactivated. -**onBundleAdded**: called to notify the enterprise administrator that the specified MDM application is installed on the device. In enterprise application administration settings, after the enterprise administrator subscribes to application installation and uninstallation events, the MDM application reports the events through the callbacks. +**onBundleAdded**: The enterprise administrator can subscribe to application installation and uninstallation events. When an application is installed on an enterprise device, the MDM application reports the event in this callback to notify the enterprise administrator. -**onBundleRemoved**: called to notify the enterprise administrator that the specified MDM application is uninstalled on the device. +**onBundleRemoved**: When an application is removed from an enterprise device, the MDM application reports the event in this callback to notify the enterprise administrator. ### Available APIs | Class | API | Description | -| :------------------------------ | ----------------------------------------- | ---------------------------- | -| EnterpriseAdminExtensionAbility | onAdminDisabled(): void | Called when the device administrator application is enabled.| -| EnterpriseAdminExtensionAbility | onBundleAdded(bundleName: string): void | Called when the MDM application is installed. | -| EnterpriseAdminExtensionAbility | onAdminEnabled(): void | Called when the device administrator application is disabled. | -| EnterpriseAdminExtensionAbility | onBundleRemoved(bundleName: string): void | Called when the MDM application is uninstalled. | +| ------------------------------ | ----------------------------------------- | ---------------------------- | +| EnterpriseAdminExtensionAbility | onAdminEnabled(): void | Called when a device administrator application is activated. | +| EnterpriseAdminExtensionAbility | onAdminDisabled(): void | Called when a device administrator application is deactivated.| +| EnterpriseAdminExtensionAbility | onBundleAdded(bundleName: string): void | Called when an application is installed on a device. | +| EnterpriseAdminExtensionAbility | onBundleRemoved(bundleName: string): void | Called when an application is removed from a device. | ### How to Develop -To implement **EnterpriseAdminExtensionAbility**, enable the device administrator application and create an **ExtensionAbility** instance from the code directory of the device administrator application. The procedure is as follows: +To implement EnterpriseAdminExtensionAbility, you need to activate the device administrator application and create **ExtensionAbility** in the code directory of the device administrator application. The procedure is as follows: 1. In the **ets** directory of the target module, right-click and choose **New > Directory** to create a directory named **EnterpriseExtAbility**. -2. Right-click the **EnterpriseExtAbility** directory and choose **New > TypeScript File** to create a file named **EnterpriseExtAbility.ts**. -3. Open the **EnterpriseExtAbility.ts** file and import the **EnterpriseAdminExtensionAbility** module. Customize a class that inherits from **EnterpriseAdminExtensionAbility** and add the required callbacks, such as **onAdminEnabled()** and **onAdminDisabled()**, through which the enterprise administrator can receive notification when the device administrator application is enabled or disabled. +2. Right-click the **EnterpriseExtAbility** directory, and choose **New > TypeScript File** to create a file named **EnterpriseExtAbility.ts**. +3. Open the **EnterpriseExtAbility.ts** file and import the **EnterpriseAdminExtensionAbility** module. Inherit the **EnterpriseAdminExtensionAbility** module to the custom class and add application notification callbacks, such as **onAdminEnabled()** and **onAdminDisabled()**. When the device administrator application is activated or deactivated, the device administrator can receive notifications. ```ts import EnterpriseAdminExtensionAbility from '@ohos.enterprise.EnterpriseAdminExtensionAbility'; - + export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility { - + onAdminEnabled() { console.info("onAdminEnabled"); } - + onAdminDisabled() { console.info("onAdminDisabled"); } @@ -56,14 +53,14 @@ To implement **EnterpriseAdminExtensionAbility**, enable the device administrato onBundleAdded(bundleName: string) { console.info("EnterpriseAdminAbility onBundleAdded bundleName:" + bundleName) } - + onBundleRemoved(bundleName: string) { console.info("EnterpriseAdminAbility onBundleRemoved bundleName" + bundleName) } }; ``` -4. Register **ServiceExtensionAbility** in the [module.json5](../quick-start/module-configuration-file.md) file of the target module. Among the parameters, set **type** to **enterpriseAdmin** and **srcEntrance** to the code path of the current ExtensionAbility. +4. Register **ServiceExtensionAbility** in the [**module.json5**](../quick-start/module-configuration-file.md) file corresponding to the project module. Set **type** to **enterpriseAdmin** and **srcEntrance** to the path of the ExtensionAbility code. ```ts "extensionAbilities": [ @@ -78,10 +75,9 @@ To implement **EnterpriseAdminExtensionAbility**, enable the device administrato ## Example -Use the **subscribeManagedEvent** and **unsubscribeManagedEvent** APIs in the **@ohos.enterprise.adminManager** module to subscribe to and unsubscribe from the application installation and uninstallation event, respectively. After the subscription is successful, the MDM application notifies the enterprise administrator when it is installed or uninstalled on the device. +Use **subscribeManagedEvent** in the **@ohos.enterprise.adminManager** module to subscribe to application installation and removal events. When an application is installed or removed, the MDM application is notified of the event. Then, the MDM application reports the event in the callback to notify the enterprise administrator. To unsubscribe from events, use **unsubscribeManagedEvent**. ```ts - @State managedEvents: Array = [0,1] @State subscribeManagedEventMsg: string = "" @State unsubscribeManagedEventMsg: string = "" @@ -108,4 +104,3 @@ Use the **subscribeManagedEvent** and **unsubscribeManagedEvent** APIs in the ** } ``` - diff --git a/en/application-dev/application-models/explicit-implicit-want-mappings.md b/en/application-dev/application-models/explicit-implicit-want-mappings.md index 16854efb9236dc6bdc9fbe990c9cbe3581495633..9e748a31795e3afc713e7091067a8164e8a623cc 100644 --- a/en/application-dev/application-models/explicit-implicit-want-mappings.md +++ b/en/application-dev/application-models/explicit-implicit-want-mappings.md @@ -62,7 +62,7 @@ The system matches the **action** attribute in the **want** parameter passed by **Figure 1** Matching rules of action in the want parameter - ![want-action](figures/want-action.png) + ![want-action](figures/want-action.png) ### Matching Rules of entities in the want Parameter @@ -79,19 +79,15 @@ The system matches the **entities** attribute in the **want** parameter passed b - If **entities** in the passed **want** parameter is specified, and **entities** under **skills** of an ability is specified but does not contain **entities** in the passed **want** parameter, the matching fails. - Figure 2 Matching rule of entities in the want parameter + **Figure 2** Matching rule of entities in the want parameter - ![want-entities](figures/want-entities.png) + ![want-entities](figures/want-entities.png) ### Matching Rules of uri and type in the want Parameter When the **uri** and **type** parameters are specified in the **want** parameter to initiate a component startup request, the system traverses the list of installed components and matches the **uris** array under **skills** of the abilities one by one. If one of the **uris** arrays under **skills** matches the **uri** and **type** in the passed **want**, the matching is successful. -Figure 3 Matching rules when uri and type are specified in the want parameter - -![want-uri-type1](figures/want-uri-type1.png) - There are four combinations of **uri** and **type** settings. The matching rules are as follows: - Neither **uri** or **type** is specified in the **want** parameter. @@ -111,11 +107,17 @@ There are four combinations of **uri** and **type** settings. The matching rules - If the **uris** array under **skills** of an ability is unspecified, the matching fails. - If the **uris** array under **skills** of an ability contains an element whose [uri is matched](#matching-rules-of-uri) and [type is matched](#matching-rules-of-type), the matching is successful. Otherwise, the matching fails. +Leftmost URI matching: When only **scheme**, a combination of **scheme** and **host**, or a combination of **scheme**, **host**, and **port** is configured in the **uris** array under **skills** of the ability, +the matching is successful only if the leftmost URI in the passed **want** parameter matches **scheme**, the combination of **scheme** and **host**, or the combination of **scheme**, **host**, and **port**. -To simplify the description, **uri** and **type** passed in the **want** parameter are called **w_uri** and **w_type**, respectively; the **uris** array under **skills** of an ability to match is called **s_uris**; each element in the array is called **s_uri**. Matching is performed from top to bottom. +**Figure 3** Matching rules when uri and type are specified in the want parameter + ![want-uri-type1](figures/want-uri-type1.png) + + +To simplify the description, **uri** and **type** passed in the **want** parameter are called **w_uri** and **w_type**, respectively; the **uris** array under **skills** of an ability to match is called **s_uris**; each element in the array is called **s_uri**. Matching is performed from top to bottom. -Figure 4 Matching rules of uri and type in the want parameter +**Figure 4** Matching rules of uri and type in the want parameter ![want-uri-type2](figures/want-uri-type2.png) @@ -128,7 +130,9 @@ To simplify the description, **uri** in the passed **want** parameter is called - If **host** of **s_uri** is unspecified and **scheme** of **w_uri** and **scheme** of **s_uri** are the same, the matching is successful. Otherwise, the matching fails. -- If **path**, **pathStartWith**, and **pathRegex** of **s_uri** are unspecified and **w_uri** and **s_uri** are the same, the matching is successful. Otherwise, the matching fails. +- If **port** of **s_uri** is unspecified and the combination of **scheme** and **host** of **w_uri** is the same as the combination of **scheme** and **host** of **s_uri**, the matching is successful. Otherwise, the matching fails. + +- If **path**, **pathStartWith**, and **pathRegex** of **s_uri** are unspecified and the combination of **scheme**, **host**, and **port** of **w_uri** is the same as the combination of **scheme**, **host**, and **port** of **s_uri**, the matching is successful. Otherwise, the matching fails. - If **path** of **s_uri** is specified and the **full path expressions** of **w_uri** and **s_uri** are the same, the matching is successful. Otherwise, the matching of **pathStartWith** continues. @@ -139,12 +143,17 @@ To simplify the description, **uri** in the passed **want** parameter is called > **NOTE** > > The **scheme**, **host**, **port**, **path**, **pathStartWith**, and **pathRegex** attributes of **uris** under **skills** of an ability are concatenated. If **path**, **pathStartWith**, and **pathRegex** are declared in sequence, **uris** can be concatenated into the following expressions: -> +> > - **Full path expression**: `scheme://host:port/path` -> +> > - **Prefix expression**: `scheme://host:port/pathStartWith` -> +> > - **Regular expression**: `scheme://host:port/pathRegex` +> +> - **Prefix URI expression**: When only **scheme**, a combination of **scheme** and **host**, or a combination of **scheme**, **host**, and **port** is configured in the configuration file, the matching is successful if a URI prefixed with the configuration file is passed in. +> * `scheme://` +> * `scheme://host` +> * `scheme://host:port` ### Matching Rules of type diff --git a/en/application-dev/application-models/extensionability-overview.md b/en/application-dev/application-models/extensionability-overview.md index 8b3197383e17810cfee7c044611cf2286f4a987d..a287fe9ac7a590bb8675a0ae0f459463ade4ff1b 100644 --- a/en/application-dev/application-models/extensionability-overview.md +++ b/en/application-dev/application-models/extensionability-overview.md @@ -9,7 +9,7 @@ An [ExtensionAbilityType](../reference/apis/js-apis-bundleManager.md#extensionab - [FormExtensionAbility](../reference/apis/js-apis-app-form-formExtensionAbility.md): ExtensionAbility component of the form type, which provides APIs related to widgets. -- [WorkSchedulerExtensionAbility](../reference/apis/js-apis-resourceschedule-workScheduler.md): ExtensionAbility component of the work_scheduler type, which provides callbacks for Work Scheduler tasks. +- [WorkSchedulerExtensionAbility](../reference/apis/js-apis-WorkSchedulerExtensionAbility.md): ExtensionAbility component of the work_scheduler type, which provides callbacks for Work Scheduler tasks. - [InputMethodExtensionAbility](../reference/apis/js-apis-inputmethod.md): ExtensionAbility component of the input_method type, which provides an input method framework that can be used to hide the keyboard, obtain the list of installed input methods, display the dialog box for input method selection, and more. @@ -21,10 +21,16 @@ An [ExtensionAbilityType](../reference/apis/js-apis-bundleManager.md#extensionab - [StaticSubscriberExtensionAbility](../reference/apis/js-apis-application-staticSubscriberExtensionAbility.md): ExtensionAbility component of the static_subscriber type, which provides APIs for static broadcast. -- [WindowExtensionAbility](../reference/apis/js-apis-application-windowExtensionAbility.md): ExtensionAbility component of the window type, which allows system applications to display UIs of other applications. +- [WindowExtensionAbility](../reference/apis/js-apis-application-windowExtensionAbility.md): ExtensionAbility component of the window type, which allows a system application to be embedded in and displayed over another application. - [EnterpriseAdminExtensionAbility](../reference/apis/js-apis-EnterpriseAdminExtensionAbility.md): ExtensionAbility component of the enterprise_admin type, which provides APIs for processing enterprise management events, such as application installation events on devices and events indicating too many incorrect screen-lock password attempts. +> **NOTE**
+> 1. Third-party applications cannot implement ServiceExtensionAbility, DataShareExtensionAbility, StaticSubscriberExtensionAbility, or WindowExtensionAbility. +> +> 2. To implement transaction processing in the background for a third-party application, use background tasks rather than ServiceExtensionAbility. For details, see [Background Task](../task-management/background-task-overview.md). +> +> 3. Third-party applications can use other types of ExtensionAbility components that have been defined. ## Using ExtensionAbility of the Specified Type diff --git a/en/application-dev/application-models/figures/ability-startup-with-implicit-want1.png b/en/application-dev/application-models/figures/ability-startup-with-implicit-want1.png new file mode 100644 index 0000000000000000000000000000000000000000..3f871f4816dfcf60a5c30e39b6d0ead2f8eb711e Binary files /dev/null and b/en/application-dev/application-models/figures/ability-startup-with-implicit-want1.png differ diff --git a/en/application-dev/application-models/figures/ability-startup-with-implicit-want2.png b/en/application-dev/application-models/figures/ability-startup-with-implicit-want2.png new file mode 100644 index 0000000000000000000000000000000000000000..4f1656a3c20e472e260e8e125c42b47c11a35abb Binary files /dev/null and b/en/application-dev/application-models/figures/ability-startup-with-implicit-want2.png differ diff --git a/en/application-dev/application-models/figures/common-event.png b/en/application-dev/application-models/figures/common-event.png index 24b51ff8718ae504ba69c1e12656d4daad797a62..fe2591d12d5f2c570d7be942d33ec330a6eb6c98 100644 Binary files a/en/application-dev/application-models/figures/common-event.png and b/en/application-dev/application-models/figures/common-event.png differ diff --git a/en/application-dev/application-models/figures/mission-chain3.png b/en/application-dev/application-models/figures/mission-chain3.png index e02c135ad4a90f99bb65bdccd821d29990b9536e..0357874ea633a490da800ef5baa2e70d53ce6a2d 100644 Binary files a/en/application-dev/application-models/figures/mission-chain3.png and b/en/application-dev/application-models/figures/mission-chain3.png differ diff --git a/en/application-dev/application-models/figures/mission-list-recent.png b/en/application-dev/application-models/figures/mission-list-recent.png new file mode 100644 index 0000000000000000000000000000000000000000..bfc35532ad4907fd3a1bfcb61110ed393ea19d1c Binary files /dev/null and b/en/application-dev/application-models/figures/mission-list-recent.png differ diff --git a/en/application-dev/application-models/figures/mission-set-task-snapshot-icon.png b/en/application-dev/application-models/figures/mission-set-task-snapshot-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..9d1ba2503f4e1a5d3b2aafdd93923c3f6c411998 Binary files /dev/null and b/en/application-dev/application-models/figures/mission-set-task-snapshot-icon.png differ diff --git a/en/application-dev/application-models/figures/mission-set-task-snapshot-label.png b/en/application-dev/application-models/figures/mission-set-task-snapshot-label.png new file mode 100644 index 0000000000000000000000000000000000000000..c8348685cc0fd521186aa10e8d04495422fc0206 Binary files /dev/null and b/en/application-dev/application-models/figures/mission-set-task-snapshot-label.png differ diff --git a/en/application-dev/application-models/figures/stage-want1.png b/en/application-dev/application-models/figures/stage-want1.png deleted file mode 100644 index 558f0a8588d7785eaad1402e68d6ba60c3118f27..0000000000000000000000000000000000000000 Binary files a/en/application-dev/application-models/figures/stage-want1.png and /dev/null differ diff --git a/en/application-dev/application-models/figures/stage-want2.png b/en/application-dev/application-models/figures/stage-want2.png deleted file mode 100644 index 72829adade52ee11419d726f19e218ec4de15220..0000000000000000000000000000000000000000 Binary files a/en/application-dev/application-models/figures/stage-want2.png and /dev/null differ diff --git a/en/application-dev/application-models/figures/start-uiability-floating-window.png b/en/application-dev/application-models/figures/start-uiability-floating-window.png new file mode 100644 index 0000000000000000000000000000000000000000..8626c3704f3e60c8efb3d6b6ea0468a7c2958a4f Binary files /dev/null and b/en/application-dev/application-models/figures/start-uiability-floating-window.png differ diff --git a/en/application-dev/application-models/figures/uiability-intra-device-interaction.png b/en/application-dev/application-models/figures/uiability-intra-device-interaction.png index 92292f2c6ef4c9cbd06da2a523f27b571a957e2b..344cf05e96c539ca73fdb9282625a1d1cb8584e7 100644 Binary files a/en/application-dev/application-models/figures/uiability-intra-device-interaction.png and b/en/application-dev/application-models/figures/uiability-intra-device-interaction.png differ diff --git a/en/application-dev/application-models/figures/want-uri-type1.png b/en/application-dev/application-models/figures/want-uri-type1.png index e0fe40d1a3cd40b72379bd947aaf2e3977021b32..ed53694a9608e8529c5e4633fca42b041bc7ab76 100644 Binary files a/en/application-dev/application-models/figures/want-uri-type1.png and b/en/application-dev/application-models/figures/want-uri-type1.png differ diff --git a/en/application-dev/application-models/hop-cross-device-migration.md b/en/application-dev/application-models/hop-cross-device-migration.md index 6d30435a819da49855cf9ae818bac419a1c0b614..c51e82e15f4e14f4b42b25e656543a01d84406fb 100644 --- a/en/application-dev/application-models/hop-cross-device-migration.md +++ b/en/application-dev/application-models/hop-cross-device-migration.md @@ -1,9 +1,9 @@ -# Cross-Device Migration +# Cross-Device Migration (for System Applications Only) ## When to Use -Cross-device migration is available only for system applications. The main task is to migrate the current task (including the page control status) of an application to the target device so that the task can continue on it. Cross-device migration supports the following functionalities: +The main task of cross-device migration is to migrate the current task (including the page control status) of an application to the target device so that the task can continue on it. Cross-device migration supports the following functionalities: - Storage and restoration of custom data @@ -47,25 +47,16 @@ The table below describes the main APIs used for cross-device migration. For det ## How to Develop -1. Configure the data synchronization permission in the **module.json5** file. The sample code is as follows: - - ```json - { - "module": { - "requestPermissions":[ - { - "name" : "ohos.permission.DISTRIBUTED_DATASYNC", - } - ] - } - } - ``` +1. Request the **ohos.permission.DISTRIBUTED_DATASYNC** permission. For details, see [Declaring Permissions in the Configuration File](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). -2. Configure the fields related to cross-device migration in the configuration file. - - Configure the application to support migration. - +2. Display a dialog box to ask authorization from the user when the application is started for the first time. For details, see [Requesting User Authorization](../security/accesstoken-guidelines.md#requesting-user-authorization). - Set the **continuable** field in the **module.json5** file to **true**. The default value is **false**. If this parameter is set to **false**, the application cannot be continued on the target device. +3. Configure the fields related to cross-device migration in the configuration file. + + Configure the application to support migration. + Set the **continuable** field in the **module.json5** file to **true**. The default value is **false**. If this parameter is set to **false**, the application cannot be continued on the target device. + + ```json { "module": { @@ -80,47 +71,31 @@ The table below describes the main APIs used for cross-device migration. For det } ``` - - Configure the application launch type. For details, see [UIAbility Component Launch Type](uiability-launch-type.md). - -3. Request the data synchronization permission. The sample code for displaying a dialog box to request the permission is as follows: - - ```ts - requestPermission() { - let context = this.context - let permissions: Array = ['ohos.permission.DISTRIBUTED_DATASYNC'] - context.requestPermissionsFromUser(permissions).then((data) => { - console.info("Succeed to request permission from user with data: "+ JSON.stringify(data)) - }).catch((error) => { - console.info("Failed to request permission from user with error: "+ JSON.stringify(error)) - }) - } - ``` + Configure the application launch type. For details, see [UIAbility Component Launch Type](uiability-launch-type.md). 4. Implement [onContinue()](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncontinue) in the UIAbility of the initiator. - [onContinue()](../reference/apis/js-apis-app-ability-uiAbility.md#abilityoncontinue) is called on the initiator. You can save the data in this method to implement application compatibility check and migration decision. - - Saving migrated data: You can save the data to be migrated in key-value pairs in **wantParam**. - Checking application compatibility: You can obtain the version number of the target application from **wantParam** and check the compatibility between the target application and the current application. - Making a migration decision: You can determine whether to support the migration based on the return value of **onContinue()**. For details about the return value, see [Available APIs](#available-apis). - The sample code is as follows: - - ```ts - import UIAbility from '@ohos.app.ability.UIAbility'; - import AbilityConstant from '@ohos.app.ability.AbilityConstant'; - - onContinue(wantParam : {[key: string]: any}) { - console.info(`onContinue version = ${wantParam.version}, targetDevice: ${wantParam.targetDevice}`) - let workInput = AppStorage.Get('ContinueWork'); - // Set the user input data into wantParam. - wantParam["work"] = workInput // set user input data into want params - console.info(`onContinue input = ${wantParam["input"]}`); - return AbilityConstant.OnContinueResult.AGREE - } - ``` + The sample code is as follows: + + ```ts + import UIAbility from '@ohos.app.ability.UIAbility'; + import AbilityConstant from '@ohos.app.ability.AbilityConstant'; + + onContinue(wantParam : {[key: string]: any}) { + console.info(`onContinue version = ${wantParam.version}, targetDevice: ${wantParam.targetDevice}`) + let workInput = AppStorage.Get('ContinueWork'); + // Set the user input data into wantParam. + wantParam["work"] = workInput // set user input data into want params + console.info(`onContinue input = ${wantParam["input"]}`); + return AbilityConstant.OnContinueResult.AGREE + } + ``` 5. Implement **onCreate()** and **onNewWant()** in the UIAbility of the target application to implement data restoration. - Implementation example of **onCreate** in the multi-instance scenario diff --git a/en/application-dev/application-models/hop-multi-device-collaboration.md b/en/application-dev/application-models/hop-multi-device-collaboration.md index fe22c3b33db46b5a353295582a5cc6a27f690d20..adbaef7a927f61bc04b7b9066264f8367ef90d76 100644 --- a/en/application-dev/application-models/hop-multi-device-collaboration.md +++ b/en/application-dev/application-models/hop-multi-device-collaboration.md @@ -1,9 +1,9 @@ -# Multi-device Collaboration +# Multi-device Collaboration (for System Applications Only) ## When to Use -Multi-device coordination is available only for system applications. It involves the following scenarios: +Multi-device coordination involves the following scenarios: - [Starting UIAbility and ServiceExtensionAbility Across Devices (No Data Returned)](#starting-uiability-and-serviceextensionability-across-devices-no-data-returned) @@ -11,7 +11,7 @@ Multi-device coordination is available only for system applications. It involves - [Connecting to ServiceExtensionAbility Across Devices](#connecting-to-serviceextensionability-across-devices) -- [Using Cross-Device Ability Call](#using-cross-device-ability-call) +- [Using Cross-Device Call](#using-cross-device-call) ## Multi-Device Collaboration Process @@ -47,24 +47,12 @@ On device A, touch the **Start** button provided by the initiator application to ### How to Develop -1. Request the **ohos.permission.DISTRIBUTED_DATASYNC** permission. For details, see [Permission Application Guide](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). +1. Request the **ohos.permission.DISTRIBUTED_DATASYNC** permission. For details, see [Declaring Permissions in the Configuration File](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). -2. Request the data synchronization permission. The sample code for displaying a dialog box to request the permission is as follows: - - ```ts - requestPermission() { - let context = this.context; - let permissions: Array = ['ohos.permission.DISTRIBUTED_DATASYNC']; - context.requestPermissionsFromUser(permissions).then((data) => { - console.info("Succeed to request permission from user with data: "+ JSON.stringify(data)); - }).catch((error) => { - console.info("Failed to request permission from user with error: "+ JSON.stringify(error)); - }) - } - ``` +2. Display a dialog box to ask authorization from the user when the application is started for the first time. For details, see [Requesting User Authorization](../security/accesstoken-guidelines.md#requesting-user-authorization). 3. Obtain the device ID of the target device. - + ```ts import deviceManager from '@ohos.distributedHardware.deviceManager'; @@ -94,7 +82,7 @@ On device A, touch the **Start** button provided by the initiator application to ``` 4. Set the target component parameters, and call [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) to start UIAbility or ServiceExtensionAbility. - + ```ts let want = { deviceId: getRemoteDeviceId(), @@ -102,7 +90,7 @@ On device A, touch the **Start** button provided by the initiator application to abilityName: 'FuncAbility', moduleName: 'module1', // moduleName is optional. } - // context is the ability-level context of the initiator UIAbility. + // context is the AbilityContext of the initiator UIAbility. this.context.startAbility(want).then(() => { // ... }).catch((err) => { @@ -118,35 +106,23 @@ On device A, touch the **Start** button provided by the initiator application to ### Available APIs -**Table 2** APIs for starting an ability across devices and returning the result data +**Table 2** APIs for starting a UIAbility across devices and returning the result data | API| Description| | -------- | -------- | | startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): void; | Starts a UIAbility. This API uses an asynchronous callback to return the result when the UIAbility is terminated.| -| terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<void>): void;| Terminates this UIAbility. This API uses an asynchronous callback to return the ability result information. It is used together with **startAbilityForResult**.| -| terminateSelfWithResult(parameter: AbilityResult): Promise<void>; | Terminates this UIAbility. This API uses a promise to return the ability result information. It is used together with **startAbilityForResult**.| +| terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<void>): void;| Terminates this UIAbility. This API uses an asynchronous callback to return the result information. It is used together with **startAbilityForResult**.| +| terminateSelfWithResult(parameter: AbilityResult): Promise<void>; | Terminates this UIAbility. This API uses a promise to return the result information. It is used together with **startAbilityForResult**.| ### How to Develop -1. Request the **ohos.permission.DISTRIBUTED_DATASYNC** permission. For details, see [Permission Application Guide](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). +1. Request the **ohos.permission.DISTRIBUTED_DATASYNC** permission. For details, see [Declaring Permissions in the Configuration File](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). -2. Request the data synchronization permission. The sample code for displaying a dialog box to request the permission is as follows: - - ```ts - requestPermission() { - let context = this.context; - let permissions: Array = ['ohos.permission.DISTRIBUTED_DATASYNC']; - context.requestPermissionsFromUser(permissions).then((data) => { - console.info("Succeed to request permission from user with data: "+ JSON.stringify(data)); - }).catch((error) => { - console.info("Failed to request permission from user with error: "+ JSON.stringify(error)); - }) - } - ``` +2. Display a dialog box to ask authorization from the user when the application is started for the first time. For details, see [Requesting User Authorization](../security/accesstoken-guidelines.md#requesting-user-authorization). 3. Set the target component parameters on the initiator, and call **startAbilityForResult()** to start the target UIAbility. **data** in the asynchronous callback is used to receive the information returned by the target UIAbility to the initiator UIAbility after the target UIAbility terminates itself. For details about how to implement **getRemoteDeviceId()**, see [Starting UIAbility and ServiceExtensionAbility Across Devices (No Data Returned)](#starting-uiability-and-serviceextensionability-across-devices-no-data-returned). - + ```ts let want = { deviceId: getRemoteDeviceId(), @@ -154,7 +130,7 @@ On device A, touch the **Start** button provided by the initiator application to abilityName: 'FuncAbility', moduleName: 'module1', // moduleName is optional. } - // context is the ability-level context of the initiator UIAbility. + // context is the AbilityContext of the initiator UIAbility. this.context.startAbilityForResult(want).then((data) => { // ... }).catch((err) => { @@ -163,7 +139,7 @@ On device A, touch the **Start** button provided by the initiator application to ``` 4. After the UIAbility task at the target device is complete, call **terminateSelfWithResult()** to return the data to the initiator UIAbility. - + ```ts const RESULT_CODE: number = 1001; let abilityResult = { @@ -174,20 +150,20 @@ On device A, touch the **Start** button provided by the initiator application to moduleName: 'module1', }, } - // context is the ability-level context of the target UIAbility. + // context is the AbilityContext of the target UIAbility. this.context.terminateSelfWithResult(abilityResult, (err) => { // ... }); ``` 5. The initiator UIAbility receives the information returned by the target UIAbility and processes the information. - + ```ts const RESULT_CODE: number = 1001; // ... - // context is the ability-level context of the initiator UIAbility. + // context is the UIAbilityContext of the initiator UIAbility. this.context.startAbilityForResult(want).then((data) => { if (data?.resultCode === RESULT_CODE) { // Parse the information returned by the target UIAbility. @@ -218,21 +194,9 @@ A system application can connect to a service on another device by calling [conn ### How to Develop -1. Request the **ohos.permission.DISTRIBUTED_DATASYNC** permission. For details, see [Permission Application Guide](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). - -2. Request the data synchronization permission. The sample code for displaying a dialog box to request the permission is as follows: - - ```ts - requestPermission() { - let context = this.context; - let permissions: Array = ['ohos.permission.DISTRIBUTED_DATASYNC']; - context.requestPermissionsFromUser(permissions).then((data) => { - console.info("Succeed to request permission from user with data: "+ JSON.stringify(data)); - }).catch((error) => { - console.info("Failed to request permission from user with error: "+ JSON.stringify(error)); - }) - } - ``` +1. Request the **ohos.permission.DISTRIBUTED_DATASYNC** permission. For details, see [Declaring Permissions in the Configuration File](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). + +2. Display a dialog box to ask authorization from the user when the application is started for the first time. For details, see [Requesting User Authorization](../security/accesstoken-guidelines.md#requesting-user-authorization). 3. (Optional) [Implement a background service](serviceextensionability.md#implementing-a-background-service). Perform this operation only if no background service is available. @@ -292,7 +256,7 @@ A system application can connect to a service on another device by calling [conn For details about how to implement **getRemoteDeviceId()**, see [Starting UIAbility and ServiceExtensionAbility Across Devices (No Data Returned)](#starting-uiability-and-serviceextensionability-across-devices-no-data-returned). 5. Disconnect the connection. Use **disconnectServiceExtensionAbility()** to disconnect from the background service. - + ```ts let connectionId = 1 // ID returned when the service is connected through connectServiceExtensionAbility. this.context.disconnectServiceExtensionAbility(connectionId).then((data) => { @@ -303,111 +267,97 @@ A system application can connect to a service on another device by calling [conn ``` -## Using Cross-Device Ability Call +## Using Cross-Device Call -The basic principle of cross-device ability call is the same as that of intra-device ability call. For details, see [Using Ability Call to Implement UIAbility Interaction](uiability-intra-device-interaction.md#using-ability-call-to-implement-uiability-interaction). +The basic principle of cross-device call is the same as that of intra-device call. For details, see [Using Call to Implement UIAbility Interaction (for System Applications Only)](uiability-intra-device-interaction.md#using-call-to-implement-uiability-interaction-for-system-applications-only). -The following describes how to implement multi-device collaboration through cross-device ability call. +The following describes how to implement multi-device collaboration through cross-device call. ### Available APIs -**Table 4** Ability call APIs +**Table 4** Call APIs | API| Description| | -------- | -------- | | startAbilityByCall(want: Want): Promise<Caller>; | Starts a UIAbility in the foreground or background and obtains the caller object for communicating with the UIAbility.| -| on(method: string, callback: CalleeCallBack): void | Callback invoked when the callee ability registers a method.| -| off(method: string): void | Callback invoked when the callee ability deregisters a method.| -| call(method: string, data: rpc.Sequenceable): Promise<void> | Sends agreed sequenceable data to the callee ability.| -| callWithResult(method: string, data: rpc.Sequenceable): Promise<rpc.MessageParcel> | Sends agreed sequenceable data to the callee ability and obtains the agreed sequenceable data returned by the callee ability.| +| on(method: string, callback: CalleeCallBack): void | Callback invoked when the CalleeAbility registers a method.| +| off(method: string): void | Callback invoked when the CalleeAbility deregisters a method.| +| call(method: string, data: rpc.Parcelable): Promise<void> | Sends agreed parcelable data to the CalleeAbility.| +| callWithResult(method: string, data: rpc.Parcelable): Promise<rpc.MessageSequence>| Sends agreed parcelable data to the CalleeAbility and obtains the agreed parcelable data returned by the CalleeAbility.| | release(): void | Releases the caller object.| -| on(type: "release", callback: OnReleaseCallback): void | Callback invoked when the caller object is released.| +| on(type: "release", callback: OnReleaseCallback): void | Callback invoked when the caller object is released.| ### How to Develop -1. Request the **ohos.permission.DISTRIBUTED_DATASYNC** permission. For details, see [Permission Application Guide](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). - -2. Request the data synchronization permission. The sample code for displaying a dialog box to request the permission is as follows: - - ```ts - requestPermission() { - let context = this.context; - let permissions: Array = ['ohos.permission.DISTRIBUTED_DATASYNC']; - context.requestPermissionsFromUser(permissions).then((data) => { - console.info("Succeed to request permission from user with data: "+ JSON.stringify(data)); - }).catch((error) => { - console.info("Failed to request permission from user with error: "+ JSON.stringify(error)); - }) - } - ``` +1. Request the **ohos.permission.DISTRIBUTED_DATASYNC** permission. For details, see [Declaring Permissions in the Configuration File](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). -3. Create the callee ability. +2. Display a dialog box to ask authorization from the user when the application is started for the first time. For details, see [Requesting User Authorization](../security/accesstoken-guidelines.md#requesting-user-authorization). + +3. Create the CalleeAbility. - For the callee ability, implement the callback to receive data and the methods to marshal and unmarshal data. When data needs to be received, use **on()** to register a listener. When data does not need to be received, use **off()** to deregister the listener. + For the CalleeAbility, implement the callback to receive data and the methods to marshal and unmarshal data. When data needs to be received, use **on()** to register a listener. When data does not need to be received, use **off()** to deregister the listener. - 1. Configure the launch type of the UIAbility. + 1. Configure the launch type of the UIAbility. - Set **launchType** of the callee ability to **singleton** in the **module.json5** file. + Set **launchType** of the CalleeAbility to **singleton** in the **module.json5** file. - | JSON Field| Description| - | -------- | -------- | - | "launchType"| Ability launch type. Set this parameter to **singleton**.| + | JSON Field| Description| + | -------- | -------- | + | "launchType"| UIAbility launch type. Set this parameter to **singleton**.| - An example of the UIAbility configuration is as follows: + An example of the UIAbility configuration is as follows: - - ```json - "abilities":[{ - "name": ".CalleeAbility", - "srcEntrance": "./ets/CalleeAbility/CalleeAbility.ts", - "launchType": "singleton", - "description": "$string:CalleeAbility_desc", - "icon": "$media:icon", - "label": "$string:CalleeAbility_label", - "visible": true - }] - ``` + + ```json + "abilities":[{ + "name": ".CalleeAbility", + "srcEntrance": "./ets/CalleeAbility/CalleeAbility.ts", + "launchType": "singleton", + "description": "$string:CalleeAbility_desc", + "icon": "$media:icon", + "label": "$string:CalleeAbility_label", + "visible": true + }] + ``` + 2. Import the **UIAbility** module. + + ```ts + import Ability from '@ohos.app.ability.UIAbility'; + ``` + 3. Define the agreed parcelable data. - 2. Import the **UIAbility** module. - - ```ts - import Ability from '@ohos.app.ability.UIAbility'; - ``` - - 3. Define the agreed sequenceable data. - - The data formats sent and received by the caller and callee abilities must be consistent. In the following example, the data formats are number and string. - - ```ts - export default 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; - } - } - ``` + The data formats sent and received by the CallerAbility and CalleeAbility must be consistent. In the following example, the data formats are number and string. - 4. Implement **Callee.on** and **Callee.off**. - - In the following example, the **MSG_SEND_METHOD** listener is registered in **onCreate()** of the ability and deregistered in **onDestroy()**. After receiving sequenceable data, the application processes the data and returns the data result. You need to implement processing based on service requirements. - + + ```ts + export default class MyParcelable { + num: number = 0; + str: string = ""; + + constructor(num, string) { + this.num = num; + this.str = string; + } + + marshalling(messageSequence) { + messageSequence.writeInt(this.num); + messageSequence.writeString(this.str); + return true; + } + + unmarshalling(messageSequence) { + this.num = messageSequence.readInt(); + this.str = messageSequence.readString(); + return true; + } + } + ``` + 4. Implement **Callee.on** and **Callee.off**. + + In the following example, the **MSG_SEND_METHOD** listener is registered in **onCreate()** of the UIAbility and deregistered in **onDestroy()**. After receiving parcelable data, the application processes the data and returns the data result. You need to implement processing based on service requirements. + ```ts const TAG: string = '[CalleeAbility]'; const MSG_SEND_METHOD: string = 'CallSendMsg'; @@ -415,14 +365,14 @@ The following describes how to implement multi-device collaboration through cros function sendMsgCallback(data) { console.info('CalleeSortFunc called'); - // Obtain the sequenceable data sent by the caller ability. - let receivedData = new MySequenceable(0, ''); - data.readSequenceable(receivedData); + // Obtain the parcelable data sent by the CallerAbility. + let receivedData = new MyParcelable(0, ''); + data.readParcelable(receivedData); console.info(`receiveData[${receivedData.num}, ${receivedData.str}]`); // Process the data. - // Return the sequenceable data result to the caller ability. - return new MySequenceable(receivedData.num + 1, `send ${receivedData.str} succeed`); + // Return the parcelable data result to the CallerAbility. + return new MyParcelable(receivedData.num + 1, `send ${receivedData.str} succeed`); } export default class CalleeAbility extends Ability { @@ -436,25 +386,24 @@ The following describes how to implement multi-device collaboration through cros onDestroy() { try { - this.callee.off(MSG_SEND_METHOD); + this.callee.off(MSG_SEND_METHOD); } catch (error) { console.error(TAG, `${MSG_SEND_METHOD} unregister failed with error ${JSON.stringify(error)}`); } } } ``` - -4. Obtain the caller object and access the callee ability. + +4. Obtain the caller object and access the CalleeAbility. 1. Import the **UIAbility** module. ```ts import Ability from '@ohos.app.ability.UIAbility'; ``` - 2. Obtain the caller object. - - The **context** attribute of the ability implements **startAbilityByCall** to obtain the caller object for communication. The following example uses **this.context** to obtain the **context** attribute of the ability, uses **startAbilityByCall** to start the callee ability, obtain the caller object, and register the **onRelease** listener of the caller ability. You need to implement processing based on service requirements. - + + The **context** attribute of the UIAbility implements **startAbilityByCall** to obtain the caller object for communication. The following example uses **this.context** to obtain the **context** attribute of the UIAbility, uses **startAbilityByCall** to start the CalleeAbility, obtain the caller object, and register the **onRelease** and **onRemoteStateChange** listeners of the CallerAbility. You need to implement processing based on service requirements. + ```ts async onButtonGetRemoteCaller() { @@ -469,11 +418,19 @@ The following describes how to implement multi-device collaboration through cros if (data != null) { caller = data; console.info('get remote caller success'); - // Register the onRelease() listener of the caller ability. + // Register the onRelease listener of the CallerAbility. caller.onRelease((msg) => { console.info(`remote caller onRelease is called ${msg}`); }) console.info('remote caller register OnRelease succeed'); + // Register the onRemoteStateChange listener of the CallerAbility. + try { + caller.onRemoteStateChange((str) => { + console.log('Remote state changed ' + str); + }); + } catch (error) { + console.log('Caller.onRemoteStateChange catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + } } }).catch((error) => { console.error(`get remote caller failed with ${error}`); @@ -483,21 +440,21 @@ The following describes how to implement multi-device collaboration through cros For details about how to implement **getRemoteDeviceId()**, see [Starting UIAbility and ServiceExtensionAbility Across Devices (No Data Returned)](#starting-uiability-and-serviceextensionability-across-devices-no-data-returned). -5. Sends agreed sequenceable data to the callee ability. - 1. The sequenceable data can be sent to the callee ability with or without a return value. The method and sequenceable data must be consistent with those of the callee ability. The following example describes how to send data to the callee ability. +5. Sends agreed parcelable data to the CalleeAbility. + 1. The parcelable data can be sent to the CalleeAbility with or without a return value. The method and parcelable data must be consistent with those of the CalleeAbility. The following example describes how to send data to the CalleeAbility. ```ts const MSG_SEND_METHOD: string = 'CallSendMsg'; async onButtonCall() { try { - let msg = new MySequenceable(1, 'origin_Msg'); + let msg = new MyParcelable(1, 'origin_Msg'); await this.caller.call(MSG_SEND_METHOD, msg); } catch (error) { console.info(`caller call failed with ${error}`); } } ``` - 2. In the following, **CallWithResult** is used to send data **originMsg** to the callee ability and assign the data processed by the **CallSendMsg** method to **backMsg**. + 2. In the following, **CallWithResult** is used to send data **originMsg** to the CalleeAbility and assign the data processed by the **CallSendMsg** method to **backMsg**. ```ts const MSG_SEND_METHOD: string = 'CallSendMsg'; @@ -505,12 +462,12 @@ The following describes how to implement multi-device collaboration through cros backMsg: string = ''; async onButtonCallWithResult(originMsg, backMsg) { try { - let msg = new MySequenceable(1, originMsg); + let msg = new MyParcelable(1, originMsg); const data = await this.caller.callWithResult(MSG_SEND_METHOD, msg); console.info('caller callWithResult succeed'); - let result = new MySequenceable(0, ''); - data.readSequenceable(result); + let result = new MyParcelable(0, ''); + data.readParcelable(result); backMsg(result.str); console.info(`caller result is [${result.num}, ${result.str}]`); } catch (error) { diff --git a/en/application-dev/application-models/inputmethodextentionability.md b/en/application-dev/application-models/inputmethodextentionability.md new file mode 100644 index 0000000000000000000000000000000000000000..8a7856f402bf30b1610521e3cf05dda7145c3509 --- /dev/null +++ b/en/application-dev/application-models/inputmethodextentionability.md @@ -0,0 +1,366 @@ +# InputMethodExtensionAbility Development + +[InputMethodExtensionAbility](../reference/apis/js-apis-inputmethod-extension-ability.md) is an ExtensionAbility component of the inputMethod type that provides extension capabilities for the input method framework. + +InputMethodExtensionAbility can be started or connected by other application components to process transactions in the background based on the request of the caller. + + +InputMethodExtensionAbility provides related capabilities through the [InputMethodExtensionContext](../reference/apis/js-apis-inputmethod-extension-context.md). + + +## Implementing an Input Method Application + +InputMethodExtensionAbility provides the **onCreate()** and **onDestory()** callbacks, as described below. Override them as required. + +- **onCreate** + + This callback is triggered when a service is created for the first time. You can perform initialization operations, for example, registering a common event listener. + + > **NOTE** + > + > If a service has been created, starting it again does not trigger the **onCreate()** callback. + +- **onDestroy** + + This callback is triggered when the service is no longer used and the instance is ready for destruction. You can clear resources in this callback, for example, deregister the listener. + + +## How to Develop + +To implement an input method application, manually create an InputMethodExtensionAbility component in DevEco Studio. The procedure is as follows: + +In the **ets** directory of the target module, right-click and choose **New** > **Extention Ability** > **InputMethod** to a minimum template of InputMethodExtensionAbility. + +> **NOTE** +> +> When compiling the input method application, use the signature at the system_basic level. Otherwise, the application will not be able to start the keyboard. + +The minimum template implements an input method application with the most basic features, such as starting the keyboard, entering text, and deleting input. You can diversify the feature set of the application by, for example, adding the feature to hide the keyboard. + +The minimum template contains four files: **KeyboardController.ts**, **InputMethodService.ts**, **Index.ets**, and **KeyboardKeyData.ts**. The file directory is as follows: + +``` +/src/main/ +├── ets/inputmethodextability +│ └──model/KeyboardController.ts # Shows the keyboard. +│ └──InputMethodService.ts # Customizes a class that inherits from InputMethodExtensionAbility and add the required lifecycle callbacks. +│ └──pages +│ └── Index.ets # Draws the keyboard and adds the input and deletion features. +│ └── KeyboardKeyData.ts # Defines keyboard attributes. +├── resources/base/profile/main_pages.json +``` + +## File Introduction + +1. **InputMethodService.ts** file: + + In this file, add the dependency package for importing InputMethodExtensionAbility. Customize a class that inherits from InputMethodExtensionAbility and add the required lifecycle callbacks. + + ```ts + import InputMethodExtensionAbility from '@ohos.InputMethodExtensionAbility'; + import { KeyboardController } from './model/KeyboardController' + + export default class InputDemoService extends InputMethodExtensionAbility { + private keyboardController: KeyboardController; + + onCreate(want) { + this.keyboardController = new KeyboardController(this.context); + this.keyboardController.onCreate(); // Initialize the window and register an event listener for the input method framework. + } + + onDestroy() { + console.log("onDestroy."); + this.context.destroy(); + } + } + ``` + +2. **KeyboardController.ts** file: + + ```ts + import inputMethodEngine from '@ohos.inputMethodEngine'; + import display from '@ohos.display'; + import windowManager from '@ohos.window'; + + // Call the getInputMethodAbility API to obtain an instance, and then call the other APIs of the input method framework based on the instance. + globalThis.inputAbility = inputMethodEngine.getInputMethodAbility(); + + export class KeyboardController { + mContext; // Save the context attribute in InputMethodExtensionAbility. + WINDOW_TYPE_INPUT_METHOD_FLOAT = 2105; // Define the window type. The value 2105 indicates the input method window type, which is used to create an input method application window. + windowName = 'inputApp'; + private windowHeight: number = 0; + private windowWidth: number = 0; + private nonBarPosition: number = 0; + private isWindowShowing: boolean = false; + + constructor(context) { + this.mContext = context; + } + + public onCreate(): void + { + this.initWindow(); // Initialize the window. + this.registerListener(); // Register an event listener for the input method framework. + } + + public onDestroy(): void // Destroy the instance. + { + this.unRegisterListener(); // Deregister the event listener. + let win = windowManager.findWindow(this.windowName); + win.destroyWindow(); // Destroy the window. + this.mContext.terminateSelf(); // Terminate the InputMethodExtensionAbility service. + } + + private initWindow(): void // Initialize the window. + { + let dis = display.getDefaultDisplaySync(); + let dWidth = dis.width; + let dHeight = dis.height; + let keyHeightRate = 0.47; + let keyHeight = dHeight * keyHeightRate; + this.windowWidth = dWidth; + this.windowHeight = keyHeight; + this.nonBarPosition = dHeight - keyHeight; + + let config = { + name: this.windowName, + windowType: this.WINDOW_TYPE_INPUT_METHOD_FLOAT, + ctx: this.mContext + } + windowManager.createWindow(config).then((win) => { // Create a window of the specified type. + win.resize(dWidth, keyHeight).then(() => { + win.moveWindowTo(0, this.nonBarPosition).then(() => { + win.setUIContent('pages/InputMethodExtAbility/Index').then(() => { + }); + }); + }); + }); + } + + private registerListener(): void + { + this.registerInputListener(); // Register an event listener for the input method framework service. + globalThis.inputAbility.on('keyboardShow', () => {// Register an event listener for the keyboard . + if (this.isWindowShowing) { + return; + } + this.isWindowShowing = true; + this.showHighWindow(); // Show the window. + }); + ... + // Register a listener for keyboard hiding. + } + + private registerInputListener() { // Register a listener for the enabling and disabling events of the input method framework service. + globalThis.inputAbility.on('inputStart', (kbController, textInputClient) => { + globalThis.textInputClient = textInputClient; // This is an input method client instance, based on which you can call the functional APIs that the input method framework provides for the input method application. + globalThis.keyboardController = kbController; + }) + globalThis.inputAbility.on('inputStop', (imeId) => { + if (imeId == "Bundle name/Ability name") { + this.onDestroy(); + } + }); + } + + private unRegisterListener(): void + { + globalThis.inputAbility.off('inputStart'); + globalThis.inputAbility.off('inputStop', () => {}); + globalThis.inputAbility.off('keyboardShow'); + } + + private showHighWindow() { + let win = windowManager.findWindow(this.windowName) + win.resize(this.windowWidth, this.windowHeight).then(() => { + win.moveWindowTo(0, this.nonBarPosition).then(() => { + win.showWindow().then(() => { + this.isWindowShowing = false; + }) + }) + }) + } + } + ``` + +3. **KeyboardKeyData.ts** file: + + In this file you can define the content displayed on the soft keyboard. + + ```ts + export interface sourceListType { + content: string, + } + + export let numberSourceListData: sourceListType[] = [ + { + content: '1' + }, + { + content: '2' + }, + { + content: '3' + }, + { + content: '4' + }, + { + content: '5' + }, + { + content: '6' + }, + { + content: '7' + }, + { + content: '8' + }, + { + content: '9' + }, + { + content: '0' + } + ] + ``` + +4. **Index.ets** file: + + This file describes the functions of keys. For example, the number keys print numbers in the text box, and the delete key deletes what's entered. + + Add the path to this file to the **src** field in the **resources/base/profile/main_pages.json** file. + + ```ets + import { numberSourceListData, sourceListType } from './keyboardKeyData' + + @Component + struct keyItem { + private keyValue: sourceListType + @State keyBgc: string = "#fff" + @State keyFontColor: string = "#000" + + build() { + Column() { + Flex({ direction: FlexDirection.Column, + alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text(this.keyValue.content).fontSize(20).fontColor(this.keyFontColor) + } + } + .backgroundColor(this.keyBgc) + .borderRadius(6) + .width("8%") + .height("65%") + .onTouch((event: TouchEvent) => { + if (event.type === TouchType.Down) { + globalThis.textInputClient.insertText(this.keyValue.content); + } + }) + } + } + + // Component used for deletion. + @Component + export struct deleteItem { + @State keyBgc: string = "#fff" + @State keyFontColor: string = "#000" + + build() { + Column() { + Flex({ direction: FlexDirection.Column, + alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text("Delete").fontSize(20).fontColor(this.keyFontColor) + } + } + .backgroundColor(this.keyBgc) + .width("13%") + .borderRadius(6) + .onTouch((event: TouchEvent) => { + if (event.type === TouchType.Down) { + globalThis.textInputClient.deleteForward(1); + } + }) + } + } + + // Numeric keyboard + @Component + struct numberMenu { + private numberList: sourceListType[] + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceEvenly }) { + Flex({ justifyContent: FlexAlign.SpaceBetween }) { + ForEach(this.numberList, (item: sourceListType) => { // First row on the numeric keyboard + keyItem({ keyValue: item }) + }, (item: sourceListType) => item.content); + } + .padding({ top: "2%" }) + .width("96%") + .height("25%") + + Flex({ justifyContent: FlexAlign.SpaceBetween }) { + deleteItem() + } + .width("96%") + .height("25%") + } + } + } + + @Entry + @Component + struct Index { + private numberList: sourceListType[] = numberSourceListData + + build() { + Stack() { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.End + }) { + Flex({ + direction: FlexDirection.Column, + alignItems: ItemAlign.Center, + justifyContent: FlexAlign.SpaceBetween + }) { + numberMenu({ + numberList: this.numberList + }) + } + .align(Alignment.End) + .width("100%") + .height("75%") + } + .height("100%").align(Alignment.End).backgroundColor("#cdd0d7") + } + .position({ x: 0, y: 0 }).zIndex(99999) + } + } + ``` + + Register the InputMethodExtensionAbility in the [module.json5 file](../quick-start/module-configuration-file.md) corresponding to the target module. Set **type** to **"inputMethod"** and **srcEntrance** to the code path of the InputMethodExtensionAbility component. + + ```ts + { + "module": { + // ... + "extensionAbilities": [ + { + "description": "inputMethod", + "icon": "$media:icon", + "name": "InputMethodExtAbility", + "srcEntrance": "./ets/inputmethodextability/InputMethodService.ts", + "type": "inputMethod", + "visible": true, + } + ] + } + } + ``` + + + diff --git a/en/application-dev/application-models/itc-with-worker.md b/en/application-dev/application-models/itc-with-worker.md index 8cbe53eeea067ae1875a8ff4b73bc4cde7bdd629..996ab941b0244571dff6116a45ab5e2165cf1184 100644 --- a/en/application-dev/application-models/itc-with-worker.md +++ b/en/application-dev/application-models/itc-with-worker.md @@ -18,7 +18,7 @@ To develop the Worker mode, perform the following steps: } ``` -2. Create the **worker.js** file based on the configuration in **build-profile.json5**. +2. Create the **worker.ts** file based on the configuration in **build-profile.json5**. ```ts import worker from '@ohos.worker'; @@ -58,7 +58,7 @@ To develop the Worker mode, perform the following steps: ```ts import worker from '@ohos.worker'; - let wk = new worker.ThreadWorker("../workers/worker.js"); + let wk = new worker.ThreadWorker("../workers/worker.ts"); // Send a message to the worker thread. wk.postMessage("message from main thread.") @@ -74,6 +74,6 @@ To develop the Worker mode, perform the following steps: > **NOTE** > -> - If the relative path of **worker.ts** configured in **build-profile.json5** is **./src/main/ets/workers/worker.ts**, pass in the path **entry/ets/workers/worker.ts** when creating a worker thread in the stage model, and pass in the path **../workers/worker.js** when creating a worker thread in the FA model. +> - If the relative path of **worker.ts** configured in **build-profile.json5** is **./src/main/ets/workers/worker.ts**, pass in the path **entry/ets/workers/worker.ts** when creating a worker thread in the stage model, and pass in the path **../workers/worker.ts** when creating a worker thread in the FA model. > > - For details about the data types supported between the main thread and worker thread, see [Sequenceable Data Types](../reference/apis/js-apis-worker.md#sequenceable-data-types). diff --git a/en/application-dev/application-models/mission-management-overview.md b/en/application-dev/application-models/mission-management-overview.md index 3346e8105deef0dce6dc785b7e88b10e2a4ce3e1..ba55ebb136ebffca0294bf69013f2f2ab4392e7f 100644 --- a/en/application-dev/application-models/mission-management-overview.md +++ b/en/application-dev/application-models/mission-management-overview.md @@ -30,102 +30,100 @@ Missions are managed by system applications (such as home screen), rather than t A UIAbility instance corresponds to an independent mission. Therefore, when an application calls [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) to start a UIAbility, a mission is created. - -To call [missionManager](../reference/apis/js-apis-application-missionManager.md) to manage missions, the home screen application must request the **ohos.permission.MANAGE_MISSIONS** permission. For details about the configuration, see [Permission Application Guide](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). - - -You can use **missionManager** to manage missions, for example, listening for mission changes, obtaining mission information or snapshots, and clearing, locking, or unlocking missions. The sample code is as follows: - - - -```ts -import missionManager from '@ohos.app.ability.missionManager' - -let listener = { - // Listen for mission creation. - onMissionCreated: function (mission) { - console.info("--------onMissionCreated-------") - }, - // Listen for mission destruction. - onMissionDestroyed: function (mission) { - console.info("--------onMissionDestroyed-------") - }, - // Listen for mission snapshot changes. - onMissionSnapshotChanged: function (mission) { - console.info("--------onMissionSnapshotChanged-------") - }, - // Listen for switching the mission to the foreground. - onMissionMovedToFront: function (mission) { - console.info("--------onMissionMovedToFront-------") - }, - // Listen for mission icon changes. - onMissionIconUpdated: function (mission, icon) { - console.info("--------onMissionIconUpdated-------") - }, - // Listen for mission name changes. - onMissionLabelUpdated: function (mission) { - console.info("--------onMissionLabelUpdated-------") - }, - // Listen for mission closure events. - onMissionClosed: function (mission) { - console.info("--------onMissionClosed-------") - } -}; - -// 1. Register a mission change listener. -let listenerId = missionManager.on('mission', listener); - -// 2. Obtain the latest 20 missions in the system. -missionManager.getMissionInfos("", 20, (error, missions) => { - console.info("getMissionInfos is called, error.code = " + error.code); - console.info("size = " + missions.length); - console.info("missions = " + JSON.stringify(missions)); -}); - -// 3. Obtain the detailed information about a mission. -let missionId = 11; // The mission ID 11 is only an example. -let mission = missionManager.getMissionInfo("", missionId).catch(function (err) { - console.info(err); -}); - -// 4. Obtain the mission snapshot. -missionManager.getMissionSnapShot("", missionId, (error, snapshot) => { - console.info("getMissionSnapShot is called, error.code = " + error.code); - console.info("bundleName = " + snapshot.ability.bundleName); -}) - -// 5. Obtain the low-resolution mission snapshot. -missionManager.getLowResolutionMissionSnapShot("", missionId, (error, snapshot) => { - console.info("getLowResolutionMissionSnapShot is called, error.code = " + error.code); - console.info("bundleName = " + snapshot.ability.bundleName); -}) - -// 6. Lock or unlock the mission. -missionManager.lockMission(missionId).then(() => { - console.info("lockMission is called "); -}); - -missionManager.unlockMission(missionId).then(() => { - console.info("unlockMission is called "); -}); - -// 7. Switch the mission to the foreground. -missionManager.moveMissionToFront(missionId).then(() => { - console.info("moveMissionToFront is called "); -}); - -// 8. Clear a single mission. -missionManager.clearMission(missionId).then(() => { - console.info("clearMission is called "); -}); - -// 9. Clear all missions. -missionManager.clearAllMissions().catch(function (err) { - console.info(err); -}); - -// 10. Deregister the mission change listener. -missionManager.off('mission', listenerId, (error) => { - console.info("unregisterMissionListener"); -}) -``` +To call [missionManager](../reference/apis/js-apis-application-missionManager.md) to manage missions, the home screen application must request the **ohos.permission.MANAGE_MISSIONS** permission. For details about the configuration, see [Declaring Permissions in the Configuration File](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). + +You can use **missionManager** to manage missions, for example, listening for mission changes, obtaining mission information or snapshots, and clearing, locking, or unlocking missions. + + ```ts + import missionManager from '@ohos.app.ability.missionManager' + + let listener = { + // Listen for mission creation. + onMissionCreated: function (mission) { + console.info("--------onMissionCreated-------") + }, + // Listen for mission destruction. + onMissionDestroyed: function (mission) { + console.info("--------onMissionDestroyed-------") + }, + // Listen for mission snapshot changes. + onMissionSnapshotChanged: function (mission) { + console.info("--------onMissionSnapshotChanged-------") + }, + // Listen for switching the mission to the foreground. + onMissionMovedToFront: function (mission) { + console.info("--------onMissionMovedToFront-------") + }, + // Listen for mission icon changes. + onMissionIconUpdated: function (mission, icon) { + console.info("--------onMissionIconUpdated-------") + }, + // Listen for mission name changes. + onMissionLabelUpdated: function (mission) { + console.info("--------onMissionLabelUpdated-------") + }, + // Listen for mission closure events. + onMissionClosed: function (mission) { + console.info("--------onMissionClosed-------") + } + }; + + // 1. Register a mission change listener. + let listenerId = missionManager.on('mission', listener); + + // 2. Obtain the latest 20 missions in the system. + missionManager.getMissionInfos("", 20, (error, missions) => { + console.info("getMissionInfos is called, error.code = " + error.code); + console.info("size = " + missions.length); + console.info("missions = " + JSON.stringify(missions)); + }); + + // 3. Obtain the detailed information about a mission. + let missionId = 11; // The mission ID 11 is only an example. + let mission = missionManager.getMissionInfo("", missionId).catch(function (err) { + console.info(err); + }); + + // 4. Obtain the mission snapshot. + missionManager.getMissionSnapShot("", missionId, (error, snapshot) => { + console.info("getMissionSnapShot is called, error.code = " + error.code); + console.info("bundleName = " + snapshot.ability.bundleName); + }) + + // 5. Obtain the low-resolution mission snapshot. + missionManager.getLowResolutionMissionSnapShot("", missionId, (error, snapshot) => { + console.info("getLowResolutionMissionSnapShot is called, error.code = " + error.code); + console.info("bundleName = " + snapshot.ability.bundleName); + }) + + // 6. Lock or unlock the mission. + missionManager.lockMission(missionId).then(() => { + console.info("lockMission is called "); + }); + + missionManager.unlockMission(missionId).then(() => { + console.info("unlockMission is called "); + }); + + // 7. Switch the mission to the foreground. + missionManager.moveMissionToFront(missionId).then(() => { + console.info("moveMissionToFront is called "); + }); + + // 8. Clear a single mission. + missionManager.clearMission(missionId).then(() => { + console.info("clearMission is called "); + }); + + // 9. Clear all missions. + missionManager.clearAllMissions().catch(function (err) { + console.info(err); + }); + + // 10. Deregister the mission change listener. + missionManager.off('mission', listenerId, (error) => { + console.info("unregisterMissionListener"); + }) + ``` + + diff --git a/en/application-dev/application-models/mission-set-icon-name-for-task-snapshot.md b/en/application-dev/application-models/mission-set-icon-name-for-task-snapshot.md new file mode 100644 index 0000000000000000000000000000000000000000..9fdc03477c0552f523a0ee9c40c6fa5b8d7c4363 --- /dev/null +++ b/en/application-dev/application-models/mission-set-icon-name-for-task-snapshot.md @@ -0,0 +1,51 @@ +# Setting the Icon and Name of a Mission Snapshot + +Setting a unique icon and name for each mission snapshot of an application helps you better manage the missions and functions of the application. + +By default, the **icon** and **label** fields in the [abilities tag](../quick-start/module-configuration-file.md#abilities) of the [module.json5 file](../quick-start/module-configuration-file.md) are used to set the icon and label. + +Figure 1 Mission snapshot of a UIAbility + +![](figures/mission-list-recent.png) + +You can also use [UIAbilityContext.setMissionIcon()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextsetmissionicon) and [UIAbilityContext.setMissionLabel()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextsetmissionlabel) to customize the icon and name for a mission snapshot. For example, for a UIAbility instance with the launch type set to **standard**, you can configure the icon and name for each mission snapshot based on different functions. + +This document describes the following operations: + +- [Setting a Mission Snapshot Icon (for System Applications Only)](#setting-a-mission-snapshot-icon-for-system-applications-only) +- [Setting a Mission Snapshot Name](#setting-a-mission-snapshot-name) + +## Setting a Mission Snapshot Icon (for System Applications Only) + +Call [UIAbilityContext.setMissionIcon()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextsetmissionicon) to set the icon of a mission snapshot. The icon is an object of the [PixelMap](../reference/apis/js-apis-image.md#pixelmap7) type. For details about how to obtain the context, see [Obtaining the Context of UIAbility](uiability-usage.md#obtaining-the-context-of-uiability). +```ts +let imagePixelMap: PixelMap = undefined; // Obtain the PixelMap information. + +this.context.setMissionIcon(imagePixelMap, (err) => { + console.error(`setMissionLabel failed, code is ${err.code}, message is ${err.message}`); +}) +``` + +The display effect is shown below. + +Figure 2 Mission snapshot icon + +![](figures/mission-set-task-snapshot-icon.png) + +## Setting a Mission Snapshot Name + +Call [UIAbilityContext.setMissionLabel()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextsetmissionlabel) to set the name of a mission snapshot. + +```ts +this.context.setMissionLabel('test').then(() => { + console.info('setMissionLabel succeeded.'); +}).catch((err) => { + console.error(`setMissionLabel failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +The display effect is shown below. + +Figure 3 Mission snapshot name + +![](figures/mission-set-task-snapshot-label.png) \ No newline at end of file diff --git a/en/application-dev/application-models/request-permissions.md b/en/application-dev/application-models/request-permissions.md index 670860d87dbb56adceb02f4ca350c24b61260d30..a29b793c9949d1080c8322681ba27cf6495f29ac 100644 --- a/en/application-dev/application-models/request-permissions.md +++ b/en/application-dev/application-models/request-permissions.md @@ -9,37 +9,7 @@ During application development, you must declare the required permission in the To declare a permission in **config.json**, add **reqPermissions** under **module** and list the permission. +For example, to request the permission to access the calendar, perform the following steps: -For example, to declare the permission to access the calendar, request the **ohos.permission.READ_CALENDAR** permission. For details, see [Permission Application Guide](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). - - -The sample code in the **config.json** file is as follows: - -```json -{ - "module": { - // ... - "reqPermissions": [ - { - "name": "ohos.permission.READ_CALENDAR" - // ... - } - ] - } -} -``` - - -Request the permission from uses in the form of a dialog box: - -```ts -import featureAbility from '@ohos.ability.featureAbility'; - -let context = featureAbility.getContext(); -let permissions: Array = ['ohos.permission.READ_CALENDAR'] -context.requestPermissionsFromUser(permissions, 1).then((data) => { - console.info("Succeed to request permission from user with data: " + JSON.stringify(data)) -}).catch((error) => { - console.info("Failed to request permission from user with error: " + JSON.stringify(error)) -}) -``` +1. Request the **ohos.permission.DISTRIBUTED_DATASYNC** permission. For details, see [Declaring Permissions in the Configuration File](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). +2. Display a dialog box to ask authorization from the user when the application is started for the first time. For details, see [Requesting User Authorization](../security/accesstoken-guidelines.md#requesting-user-authorization). diff --git a/en/application-dev/application-models/serviceextensionability.md b/en/application-dev/application-models/serviceextensionability.md index d64d884b1e3021193f63445913886830218df6e1..9ff7a0ae5d6df7574da19565c81411236dba3dda 100644 --- a/en/application-dev/application-models/serviceextensionability.md +++ b/en/application-dev/application-models/serviceextensionability.md @@ -18,9 +18,9 @@ Each type of ExtensionAbility has its own context. ServiceExtensionAbility has [ This topic describes how to use ServiceExtensionAbility in the following scenarios: -- [Implementing a Background Service](#implementing-a-background-service) +- [Implementing a Background Service (for System Applications Only)](#implementing-a-background-service-for-system-applications-only) -- [Starting a Background Service](#starting-a-background-service) +- [Starting a Background Service (for System Applications Only)](#starting-a-background-service-for-system-applications-only) - [Connecting to a Background Service](#connecting-to-a-background-service) @@ -33,9 +33,9 @@ This topic describes how to use ServiceExtensionAbility in the following scenari > - Third-party applications can connect to ServiceExtensionAbility provided by the system only when they gain focus in the foreground. -## Implementing a Background Service +## Implementing a Background Service (for System Applications Only) -This feature applies only to system applications. [ServiceExtensionAbility](../reference/apis/js-apis-app-ability-serviceExtensionAbility.md) provides the callbacks **onCreate()**, **onRequest()**, **onConnect()**, **onDisconnect()**, and **onDestory()**. Override them as required. The following figure shows the lifecycle of ServiceExtensionAbility. +[ServiceExtensionAbility](../reference/apis/js-apis-app-ability-serviceExtensionAbility.md) provides the callbacks **onCreate()**, **onRequest()**, **onConnect()**, **onDisconnect()**, and **onDestory()**. Override them as required. The following figure shows the lifecycle of ServiceExtensionAbility. **Figure 1** ServiceExtensionAbility lifecycle ![ServiceExtensionAbility-lifecycle](figures/ServiceExtensionAbility-lifecycle.png) @@ -164,9 +164,9 @@ To implement a background service, manually create a ServiceExtensionAbility com ``` -## Starting a Background Service +## Starting a Background Service (for System Applications Only) -This feature applies only to system applications. A system application uses the [startServiceExtensionAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#abilitycontextstartserviceextensionability) method to start a background service. The [onRequest()](../reference/apis/js-apis-app-ability-serviceExtensionAbility.md#serviceextensionabilityonrequest) callback is invoked, and the **Want** object passed by the caller is received through the callback. After the background service is started, its lifecycle is independent of that of the client. In other words, even if the client is destroyed, the background service can still run. Therefore, the background service must be stopped by calling [terminateSelf()](../reference/apis/js-apis-inner-application-serviceExtensionContext.md#serviceextensioncontextterminateself) when its work is complete. Alternatively, another component can call [stopServiceExtensionAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#abilitycontextstopserviceextensionability) to stop the background service. +A system application uses the [startServiceExtensionAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#abilitycontextstartserviceextensionability) method to start a background service. The [onRequest()](../reference/apis/js-apis-app-ability-serviceExtensionAbility.md#serviceextensionabilityonrequest) callback is invoked, and the **Want** object passed by the caller is received through the callback. After the background service is started, its lifecycle is independent of that of the client. In other words, even if the client is destroyed, the background service can still run. Therefore, the background service must be stopped by calling [terminateSelf()](../reference/apis/js-apis-inner-application-serviceExtensionContext.md#serviceextensioncontextterminateself) when its work is complete. Alternatively, another component can call [stopServiceExtensionAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#abilitycontextstopserviceextensionability) to stop the background service. > **NOTE** > diff --git a/en/application-dev/application-models/stage-model-development-overview.md b/en/application-dev/application-models/stage-model-development-overview.md index d7f8123a379fc7950820e531a14f45dfca68f961..451649bdb1a63147b79f8c7e2d4523d6c651c548 100644 --- a/en/application-dev/application-models/stage-model-development-overview.md +++ b/en/application-dev/application-models/stage-model-development-overview.md @@ -10,7 +10,7 @@ The following figure shows the basic concepts used in the stage model. - [UIAbility component](uiability-overview.md) and [ExtensionAbility component](extensionability-overview.md) - The stage model provides two types of application components: UIAbility and ExtensionAbility. Both have specific classes and support object-oriented development. They are the specific implementation of the abstract ability concept on the stage model. They are also units scheduled by the Ability Manager Service (AMS), which schedules their lifecycles as well. + The stage model provides two types of application components: UIAbility and ExtensionAbility. Both have specific classes and support object-oriented development. - UIAbility has the UI and is mainly used for user interaction. For example, with UIAbility, the Gallery application can display images in the liquid layout. After a user selects an image, it uses a new UI to display the image details. The user can touch the **Back** button to return to the liquid layout. The lifecycle of the UIAbility component contains the creation, destruction, foreground, and background states. Display-related states are exposed through WindowStage events. @@ -22,6 +22,7 @@ The following figure shows the basic concepts used in the stage model. - [Context](application-context-stage.md) In the stage model, Context and its derived classes provide a variety of resources and capabilities that can be called during the runtime. The UIAbility component and ExtensionAbility derived classes have different Context classes. These classes, which all inherit from the base class Context, provide different capabilities. + - [AbilityStage](abilitystage.md) Each HAP of the Entry or Feature type has an AbilityStage class instance during the runtime. When the code in the HAP is loaded to the process for the first time, the system creates an AbilityStage class instance first. Each UIAbility class defined in the HAP is associated with this class instance after instantiation. Through this class instance, you can obtain the runtime information of the UIAbility instances in the HAP. diff --git a/en/application-dev/application-models/start-remote-pageability.md b/en/application-dev/application-models/start-remote-pageability.md index 4e998a15d23d298bfdb402bd18ea0db2a9f819eb..36ee305b49698c1f6e6cf216174f77212f1d53e4 100644 --- a/en/application-dev/application-models/start-remote-pageability.md +++ b/en/application-dev/application-models/start-remote-pageability.md @@ -1,7 +1,7 @@ -# Starting a Remote PageAbility +# Starting a Remote PageAbility (for System Applications Only) -This feature applies only to system applications. The **startAbility()** method in the **featureAbility** class is used to start a remote PageAbility. +The **startAbility()** method in the **featureAbility** class is used to start a remote PageAbility. In addition to **'\@ohos.ability.featureAbility'**, you must import **'\@ohos.distributedHardware.deviceManager'**, which provides account-independent distributed device networking capabilities. Then you can use **getTrustedDeviceListSync** of the **DeviceManager** module to obtain the remote device ID and pass the remote device ID in the **want** parameter for starting the remote PageAbility. diff --git a/en/application-dev/application-models/static-subscriber-extension-ability.md b/en/application-dev/application-models/static-subscriber-extension-ability.md deleted file mode 100644 index ae6d9a80b7ab6c693d06e7bfe8bfb11b4db94ab8..0000000000000000000000000000000000000000 --- a/en/application-dev/application-models/static-subscriber-extension-ability.md +++ /dev/null @@ -1,107 +0,0 @@ -# StaticSubscriberExtensionAbility Development - -## Scenario Description - -​The common event service provides two subscription modes: dynamic and static. In dynamic subscription mode, a subscriber calls an API during the running period to subscribe to common events. For details, see [Subscribing to Common Events](common-event-subscription.md). In static subscription mode, no common event subscription API is called. A common event is subscribed by configuring a declaration file and implementing a class that inherits from **StaticSubscriberExtensionAbility**. A static subscriber is started once it receives a target event (for example, a power-on event) published by the system or application. At the same time, the **onReceiveEvent** callback is triggered, in which you can implement the service logic. **The static subscriber APIs are system APIs and can be used only by system applications that have passed the system-level power consumption review.** - - - -## How to Develop - -1. Prerequisites - - The application must meet the following requirements: - - The application is a system application. - - The application is developed using the full SDK. - - The application's power consumption has passed the system-level power consumption review. If you want to use static subscription in the debugging phase, add the bundle name of your application to the system configuration file **/etc/static_subscriber_config.json**. - - - -2. Declaring a Static Subscriber - - To declare a static subscriber, create an ExtensionAbility, which is derived from the **StaticSubscriberExtensionAbility** class, in the project. The sample code is as follows: - - ```ts - import StaticSubscriberExtensionAbility from '@ohos.application.StaticSubscriberExtensionAbility' - - export default class StaticSubscriber extends StaticSubscriberExtensionAbility { - onReceiveEvent(event) { - console.log('onReceiveEvent, event:' + event.event); - } - } - ``` - - You can implement service logic in the **onReceiveEvent** callback. - - - -3. Project Configuration for a Static Subscriber - - After writing the static subscriber code, configure the subscriber in the **module.json5** file. The configuration format is as follows: - - ```ts - { - "module": { - ...... - "extensionAbilities": [ - { - "name": "StaticSubscriber", - "srcEntrance": "./ets/StaticSubscriber/StaticSubscriber.ts", - "description": "$string:StaticSubscriber_desc", - "icon": "$media:icon", - "label": "$string:StaticSubscriber_label", - "type": "staticSubscriber", - "visible": true, - "metadata": [ - { - "name": "ohos.extension.staticSubscriber", - "resource": "$profile:subscribe" - } - ] - } - ] - ...... - } - } - ``` - - Pay attention to the following fields in the JSON file: - - **srcEntrance**: entry file path of the ExtensionAbility, that is, the file path of the static subscriber declared in Step 2. - - **type**: ExtensionAbility type. For a static subscriber, set this field to **staticSubscriber**. - - **metadata**: level-2 configuration file information of the ExtensionAbility. The configuration information varies according to the ExtensionAbility type. Therefore, you must use different config files to indicate the specific configuration. The **metadata** field contains two keywords: **name** and **resource**. The **name** field indicates the ExtensionAbility type name. For a static subscriber, declare the name as **ohos.extension.staticSubscriber** for successful identification. The **resource** field indicates the path that stores the ExtensionAbility configuration, which is customizable. In this example, the path is **resources/base/profile/subscribe.json**. - - A level-2 configuration file pointed to by **metadata** must be in the following format: - - ```ts - { - "commonEvents": [ - { - "name": "xxx", - "permission": "xxx", - "events":[ - "xxx" - ] - } - ] - } - ``` - - If the level-2 configuration file is not declared in this format, the file cannot be identified. The fields are described as follows: - - **name**: name of the ExtensionAbility, which must be the same as the name of **extensionAbility** declared in **module.json5**. - - **permission**: permission required by the publisher. If a publisher without the required permission attempts to publish an event, the event is regarded as invalid and will not be published. - - **events**: list of subscribed target events - - - -## Samples - -For details about how to develop StaticSubscriberExtensionAbility, see [StaticSubscriber (ArkTS, API version 9, Full SDK)](https://gitee.com/openharmony/applications_app_samples/tree/master/ability/StaticSubscriber). diff --git a/en/application-dev/application-models/subscribe-system-environment-variable-changes.md b/en/application-dev/application-models/subscribe-system-environment-variable-changes.md new file mode 100644 index 0000000000000000000000000000000000000000..c231f483e9bcd8f83faf49d40007730d0f854de5 --- /dev/null +++ b/en/application-dev/application-models/subscribe-system-environment-variable-changes.md @@ -0,0 +1,172 @@ +# Subscribing to System Environment Variable Changes + +System environment variables are system settings (for example, the system language or screen direction) of a device that may change during the running of an application. + +By subscribing to the changes of system environment variables, the application can detect the changes in a timely manner and process the changes accordingly, providing better user experience. For example, when the system language changes, the application can display the UI in the new language; when the user rotates the device to landscape or portrait mode, the application can re-arrange the UI to adapt to the new screen orientation and size. + +The system environment variable changes are usually triggered by options in **Settings** or icons in **Control Panel**. For details about the system environment variables that support subscription, see [Configuration](../reference/apis/js-apis-app-ability-configuration.md). + +In OpenHarmony, you can subscribe to system environment variable changes in the following ways: + +- [Using ApplicationContext for Subscription](#using-applicationcontext-for-subscription) +- [Using AbilityStage for Subscription](#using-abilitystage-for-subscription) +- [Using UIAbility for Subscription](#using-uiability-for-subscription) +- [Using ExtensionAbility for Subscription](#using-extensionability-for-subscription) + +## Using ApplicationContext for Subscription + +[ApplicationContext](../reference/apis/js-apis-inner-application-applicationContext.md) provides an API for registering a callback function to subscribe to the system environment variable changes. It also provides an API for deregistration so you can release related resources when they are no longer needed. + +1. Call **ApplicationContext.on(type: 'environment', callback: EnvironmentCallback)** to subscribe to changes in system environment variables. The code snippet below is used to subscribe to system language changes on a page. + + ```ts + import common from '@ohos.app.ability.common'; + + @Entry + @Component + struct Index { + private context = getContext(this) as common.UIAbilityContext; + private callbackId: number; // ID of the subscription for system environment variable changes. + + subscribeConfigurationUpdate() { + let systemLanguage: string = this.context.config.language; // Obtain the system language in use. + + // 1. Obtain an ApplicationContext object. + let applicationContext = this.context.getApplicationContext(); + + // 2. Subscribe to system environment variable changes through ApplicationContext. + let environmentCallback = { + onConfigurationUpdated(newConfig) { + console.info(`onConfigurationUpdated systemLanguage is ${systemLanguage}, newConfig: ${JSON.stringify(newConfig)}`); + + if (this.systemLanguage !== newConfig.language) { + console.info(`systemLanguage from ${systemLanguage} changed to ${newConfig.language}`); + systemLanguage = newConfig.language; // Save the new system language as the system language in use, which will be used for comparison. + } + }, + onMemoryLevel(level) { + console.info(`onMemoryLevel level: ${level}`); + } + } + + this.callbackId = applicationContext.on('environment', environmentCallback); + } + + // Page display. + build() { + // ... + } + } + ``` + +2. Call **ApplicationContext.off(type: 'environment', callbackId: number)** to release the resources. + + ```ts + import common from '@ohos.app.ability.common'; + + @Entry + @Component + struct Index { + private context = getContext(this) as common.UIAbilityContext; + private callbackId: number; // ID of the subscription for system environment variable changes. + + unsubscribeConfigurationUpdate() { + let applicationContext = this.context.getApplicationContext(); + applicationContext.off('environment', this.callbackId); + } + + // Page display. + build() { + // ... + } + } + ``` + +## Using AbilityStage for Subscription + +The AbilityStage component provides the [AbilityStage.onConfigurationUpdate()](../reference/apis/js-apis-app-ability-abilityStage.md#abilitystageonconfigurationupdate) callback for subscribing to system environment variable changes. This callback is invoked when a system environment variable changes. In this callback, the latest system environment configuration is obtained through the [Configuration](../reference/apis/js-apis-app-ability-configuration.md) object. + +> **NOTE** +> +> - AbilityStage is not automatically generated in the default project of DevEco Studio. For details about how to create an AbilityStage file, see [AbilityStage Component Container](abilitystage.md). +> - The callback used to subscribe to system environment variable changes has the same lifecycle as the [AbilityStage](../reference/apis/js-apis-app-ability-abilityStage.md) instance and will be destroyed when the instance is destroyed. + +The code snippet below uses the [AbilityStage.onConfigurationUpdate()](../reference/apis/js-apis-app-ability-abilityStage.md#abilitystageonconfigurationupdate) callback to subscribe to the system language changes. + +```ts +import AbilityStage from '@ohos.app.ability.AbilityStage'; + +let systemLanguage: string; // System language in use. + +export default class MyAbilityStage extends AbilityStage { + onCreate() { + systemLanguage = this.context.config.language; // Obtain the system language in use when the AbilityStage instance is loaded for the first time. + console.info(`systemLanguage is ${systemLanguage} `); + } + + onConfigurationUpdate(newConfig) { + console.info(`onConfigurationUpdated systemLanguage is ${systemLanguage}, newConfig: ${JSON.stringify(newConfig)}`); + + if (systemLanguage !== newConfig.language) { + console.info(`systemLanguage from ${systemLanguage} changed to ${newConfig.language}`); + systemLanguage = newConfig.language; // Save the new system language as the system language in use, which will be used for comparison. + } + } +} +``` + +## Using UIAbility for Subscription + +The UIAbility component provides the **UIAbility.onConfigurationUpdate()** callback for subscribing to system environment variable changes. This callback is invoked when a system environment variable changes. In this callback, the latest system environment configuration is obtained through the [Configuration](../reference/apis/js-apis-app-ability-configuration.md) object, without restarting the UIAbility. + +> **NOTE** +> +> The callback used to subscribe to system environment variable changes has the same lifecycle as the UIAbility instance and will be destroyed when the instance is destroyed. + +The code snippet below uses the **onConfigurationUpdate()** callback to subscribe to the system language changes. + +```ts +import UIAbility from '@ohos.app.ability.UIAbility'; + +let systemLanguage: string; // System language in use. + +export default class EntryAbility extends UIAbility { + onCreate(want, launchParam) { + systemLanguage = this.context.config.language; // Obtain the system language in use when the UIAbility instance is loaded for the first time. + console.info(`systemLanguage is ${systemLanguage} `); + } + + onConfigurationUpdate(newConfig) { + console.info(`onConfigurationUpdated systemLanguage is ${systemLanguage}, newConfig: ${JSON.stringify(newConfig)}`); + + if (systemLanguage !== newConfig.language) { + console.info(`systemLanguage from ${systemLanguage} changed to ${newConfig.language}`); + systemLanguage = newConfig.language; // Save the new system language as the system language in use, which will be used for comparison. + } + } + + // ... +} +``` + +## Using ExtensionAbility for Subscription + +The ExtensionAbility component provides the **onConfigurationUpdate()** callback for subscribing system environment variable changes. This callback is invoked when a system environment variable changes. In this callback, the latest system environment configuration is obtained through the [Configuration](../reference/apis/js-apis-app-ability-configuration.md) object. + +> **NOTE** +> +> The callback used to subscribe to system environment variable changes has the same lifecycle as the ExtensionAbility instance and will be destroyed when the instance is destroyed. + +The code snippet below uses FormExtensionAbility as an example to describe how to use the **onConfigurationUpdate()** callback to subscribe to system environment variable changes. + +```ts +import FormExtensionAbility from '@ohos.app.form.FormExtensionAbility'; + +export default class EntryFormAbility extends FormExtensionAbility { + onConfigurationUpdate(newConfig) { + console.info(`newConfig is ${JSON.stringify(newConfig)}`); + } + + // ... +} +``` diff --git a/en/application-dev/application-models/uiability-data-sync-with-ui.md b/en/application-dev/application-models/uiability-data-sync-with-ui.md index 9ed8c8d6f3b307ef44097f1ff67e6dcf472f91a5..e5e5b7b54f2ad8e98048a08599360806e3ea578d 100644 --- a/en/application-dev/application-models/uiability-data-sync-with-ui.md +++ b/en/application-dev/application-models/uiability-data-sync-with-ui.md @@ -80,7 +80,7 @@ Before using the APIs provided by **EventHub**, you must obtain an **EventHub** 4. After **event1** is used, you can call [eventHub.off()](../reference/apis/js-apis-inner-application-eventHub.md#eventhuboff) to unsubscribe from the event. ```ts - // context is the ability-level context of the UIAbility instance. + // context is the AbilityContext of the UIAbility instance. this.context.eventHub.off('event1'); ``` @@ -240,10 +240,6 @@ The following provides an example to describe the object overwritten problem in struct Index { onPageShow() { let ctx = globalThis.context; // Obtain the context from globalThis and use it. - let permissions = ['com.example.permission'] - ctx.requestPermissionsFromUser(permissions,(result) => { - // ... - }); } // Page display. build() { @@ -251,7 +247,7 @@ The following provides an example to describe the object overwritten problem in } } ``` - + 3. In the UIAbilityB file, [UIAbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md) is stored in **globalThis** and has the same name as that in the UIAbilityA file. ```ts @@ -274,10 +270,6 @@ The following provides an example to describe the object overwritten problem in struct Index { onPageShow() { let ctx = globalThis.context; // Obtain the context from globalThis and use it. - let permissions = ['com.example.permission'] - ctx.requestPermissionsFromUser(permissions,(result) => { - console.info('requestPermissionsFromUser result:' + JSON.stringify(result)); - }); } // Page display. build() { @@ -285,7 +277,7 @@ The following provides an example to describe the object overwritten problem in } } ``` - + 5. Switch the UIAbilityB instance to the background and switch the UIAbilityA instance to the foreground. In this case, UIAbilityA will not enter the **onCreate()** lifecycle again. ```ts @@ -307,10 +299,6 @@ The following provides an example to describe the object overwritten problem in struct Index { onPageShow() { let ctx = globalThis.context; // The context in globalThis is the context of UIAbilityB. - let permissions=['com.example.permission']; - ctx.requestPermissionsFromUser(permissions,(result) => { // Using this object causes a process breakdown. - console.info('requestPermissionsFromUser result:' + JSON.stringify(result)); - }); } // Page display. build() { diff --git a/en/application-dev/application-models/uiability-intra-device-interaction.md b/en/application-dev/application-models/uiability-intra-device-interaction.md index ac3c18e36de67e66e496a92da2269c063503ce7e..c8ba4ec50fa9b67805685468f0b3ab5cdada2377 100644 --- a/en/application-dev/application-models/uiability-intra-device-interaction.md +++ b/en/application-dev/application-models/uiability-intra-device-interaction.md @@ -15,9 +15,11 @@ This topic describes the UIAbility interaction modes in the following scenarios. - [Starting UIAbility of Another Application and Obtaining the Return Result](#starting-uiability-of-another-application-and-obtaining-the-return-result) +- [Starting UIAbility with Window Mode Specified (for System Applications Only)](#starting-uiability-with-window-mode-specified-for-system-applications-only) + - [Starting a Specified Page of UIAbility](#starting-a-specified-page-of-uiability) -- [Using Ability Call to Implement UIAbility Interaction](#using-ability-call-to-implement-uiability-interaction) +- [Using Call to Implement UIAbility Interaction (for System Applications Only)](#using-call-to-implement-uiability-interaction-for-system-applications-only) ## Starting UIAbility in the Same Application @@ -29,45 +31,52 @@ Assume that your application has two UIAbility components: EntryAbility and Func 1. In EntryAbility, call [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) to start UIAbility. The [want](../reference/apis/js-apis-app-ability-want.md) parameter is the entry parameter for starting the UIAbility instance. In the **want** parameter, **bundleName** indicates the bundle name of the application to start; **abilityName** indicates the name of the UIAbility to start; **moduleName** is required only when the target UIAbility belongs to a different module; **parameters** is used to carry custom information. For details about how to obtain the context, see [Obtaining the Context of UIAbility](uiability-usage.md#obtaining-the-context-of-uiability). ```ts + let context = ...; // UIAbilityContext let wantInfo = { - deviceId: '', // An empty deviceId indicates the local device. - bundleName: 'com.example.myapplication', - abilityName: 'FuncAbility', - moduleName: 'module1', // moduleName is optional. - parameters: {// Custom information. - info: 'From the Index page of EntryAbility', - }, + deviceId: '', // An empty deviceId indicates the local device. + bundleName: 'com.example.myapplication', + abilityName: 'FuncAbility', + moduleName: 'module1', // moduleName is optional. + parameters: {// Custom information. + info: 'From the Index page of EntryAbility', + }, } - // context is the ability-level context of the initiator UIAbility. - this.context.startAbility(wantInfo).then(() => { - // ... + // context is the UIAbilityContext of the initiator UIAbility. + context.startAbility(wantInfo).then(() => { + // ... }).catch((err) => { - // ... + // ... }) ``` - -2. Use the FuncAbility lifecycle callback to receive the parameters passed from EntryAbility. + +2. In FuncAbility, use [onCreate()](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityoncreate) or [onNewWant()](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityonnewwant) to receive the parameters passed in by EntryAbility. ```ts import UIAbility from '@ohos.app.ability.UIAbility'; import window from '@ohos.window'; export default class FuncAbility extends UIAbility { - onCreate(want, launchParam) { - // Receive the parameters passed by the caller UIAbility. - let funcAbilityWant = want; - let info = funcAbilityWant?.parameters?.info; - // ... - } + onCreate(want, launchParam) { + // Receive the parameters passed by the initiator UIAbility. + let funcAbilityWant = want; + let info = funcAbilityWant?.parameters?.info; + // ... + } } ``` + > **NOTE**
+ > + > In FuncAbility started, you can obtain the PID and bundle name of the UIAbility through **parameters** in the passed **want** parameter. + 3. To stop the **UIAbility** instance after the FuncAbility service is complete, call [terminateSelf()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateself) in FuncAbility. ```ts - // context is the ability-level context of the UIAbility instance to stop. - this.context.terminateSelf((err) => { - // ... + let context = ...; // UIAbilityContext + + // context is the UIAbilityContext of the UIAbility instance to stop. + context.terminateSelf((err) => { + // ... }); ``` @@ -85,67 +94,70 @@ When starting FuncAbility from EntryAbility, you want the result to be returned 1. In EntryAbility, call [startAbilityForResult()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult) to start FuncAbility. Use **data** in the asynchronous callback to receive information returned after FuncAbility stops itself. For details about how to obtain the context, see [Obtaining the Context of UIAbility](uiability-usage.md#obtaining-the-context-of-uiability). ```ts + let context = ...; // UIAbilityContext let wantInfo = { - deviceId: '', // An empty deviceId indicates the local device. - bundleName: 'com.example.myapplication', - abilityName: 'FuncAbility', - moduleName: 'module1', // moduleName is optional. - parameters: {// Custom information. - info: 'From the Index page of EntryAbility', - }, + deviceId: '', // An empty deviceId indicates the local device. + bundleName: 'com.example.myapplication', + abilityName: 'FuncAbility', + moduleName: 'module1', // moduleName is optional. + parameters: {// Custom information. + info: 'From the Index page of EntryAbility', + }, } - // context is the ability-level context of the initiator UIAbility. - this.context.startAbilityForResult(wantInfo).then((data) => { - // ... + // context is the UIAbilityContext of the initiator UIAbility. + context.startAbilityForResult(wantInfo).then((data) => { + // ... }).catch((err) => { - // ... + // ... }) ``` - + 2. Call [terminateSelfWithResult()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult) to stop FuncAbility. Use the input parameter **abilityResult** to carry the information that FuncAbility needs to return to EntryAbility. ```ts + let context = ...; // UIAbilityContext const RESULT_CODE: number = 1001; let abilityResult = { - resultCode: RESULT_CODE, - want: { - bundleName: 'com.example.myapplication', - abilityName: 'FuncAbility', - moduleName: 'module1', - parameters: { - info: 'From the Index page of FuncAbility', - }, + resultCode: RESULT_CODE, + want: { + bundleName: 'com.example.myapplication', + abilityName: 'FuncAbility', + moduleName: 'module1', + parameters: { + info: 'From the Index page of FuncAbility', }, + }, } - // context is the ability-level context of the callee UIAbility. - this.context.terminateSelfWithResult(abilityResult, (err) => { - // ... + // context is the AbilityContext of the target UIAbility. + context.terminateSelfWithResult(abilityResult, (err) => { + // ... }); ``` - + 3. After FuncAbility stops itself, EntryAbility uses [startAbilityForResult()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult) to receive the information returned by FuncAbility. The value of **RESULT_CODE** must be the same as the preceding value. ```ts + let context = ...; // UIAbilityContext const RESULT_CODE: number = 1001; // ... - // context is the ability-level context of the initiator UIAbility. - this.context.startAbilityForResult(want).then((data) => { - if (data?.resultCode === RESULT_CODE) { - // Parse the information returned by the callee UIAbility. - let info = data.want?.parameters?.info; - // ... - } - }).catch((err) => { + // context is the UIAbilityContext of the initiator UIAbility. + context.startAbilityForResult(wantInfo).then((data) => { + if (data?.resultCode === RESULT_CODE) { + // Parse the information returned by the target UIAbility. + let info = data.want?.parameters?.info; // ... + } + }).catch((err) => { + // ... }) ``` ## Starting UIAbility of Another Application -Generally, the user only needs to do a common operation (for example, selecting a document application to view the document content) to start the UIAbility of another application. The [implicit Want launch mode](want-overview.md#types-of-want) is recommended. The system identifies a matched UIAbility and starts it based on the **want** parameter of the caller. +Generally, the user only needs to do a common operation (for example, selecting a document application to view the document content) to start the UIAbility of another application. The [implicit Want launch mode](want-overview.md#types-of-want) is recommended. The system identifies a matched UIAbility and starts it based on the **want** parameter of the initiator UIAbility. There are two ways to start **UIAbility**: [explicit and implicit](want-overview.md). @@ -181,36 +193,38 @@ This section describes how to start the UIAbility of another application through } ``` -2. Include **entities** and **actions** of the caller's **want** parameter into **entities** and **actions** under **skills** of the target UIAbility. After the system matches the UIAbility that meets the **entities** and **actions** information, a dialog box is displayed, showing the list of matched UIAbility instances for users to select. For details about how to obtain the context, see [Obtaining the Context of UIAbility](uiability-usage.md#obtaining-the-context-of-uiability). +2. Include **entities** and **actions** of the initiator UIAbility's **want** parameter into **entities** and **actions** under **skills** of the target UIAbility. After the system matches the UIAbility that meets the **entities** and **actions** information, a dialog box is displayed, showing the list of matched UIAbility instances for users to select. For details about how to obtain the context, see [Obtaining the Context of UIAbility](uiability-usage.md#obtaining-the-context-of-uiability). ```ts + let context = ...; // UIAbilityContext let wantInfo = { - deviceId: '', // An empty deviceId indicates the local device. - // Uncomment the line below if you want to implicitly query data only in the specific bundle. - // bundleName: 'com.example.myapplication', - action: 'ohos.want.action.viewData', - // entities can be omitted. - entities: ['entity.system.default'], + deviceId: '', // An empty deviceId indicates the local device. + // Uncomment the line below if you want to implicitly query data only in the specific bundle. + // bundleName: 'com.example.myapplication', + action: 'ohos.want.action.viewData', + // entities can be omitted. + entities: ['entity.system.default'], } - // context is the ability-level context of the initiator UIAbility. - this.context.startAbility(wantInfo).then(() => { - // ... + // context is the UIAbilityContext of the initiator UIAbility. + context.startAbility(wantInfo).then(() => { + // ... }).catch((err) => { - // ... + // ... }) ``` - - The following figure shows the effect. When you click **Open PDF**, a dialog box is displayed for you to select. - - ![uiability-intra-device-interaction](figures/uiability-intra-device-interaction.png) + + The following figure shows the effect. When you click **Open PDF**, a dialog box is displayed for you to select. + ![](figures/uiability-intra-device-interaction.png) 3. To stop the **UIAbility** instance after the document application is used, call [terminateSelf()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateself). ```ts - // context is the ability-level context of the UIAbility instance to stop. - this.context.terminateSelf((err) => { - // ... + let context = ...; // UIAbilityContext + + // context is the AbilityContext of the UIAbility instance to stop. + context.terminateSelf((err) => { + // ... }); ``` @@ -245,68 +259,121 @@ If you want to obtain the return result when using implicit Want to start the UI } ``` -2. Call [startAbilityForResult()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult) to start the UIAbility of the payment application. Include **entities** and **actions** of the caller's **want** parameter into **entities** and **actions** under **skills** of the target UIAbility. Use **data** in the asynchronous callback to receive the information returned to the caller after the payment UIAbility stops itself. After the system matches the UIAbility that meets the **entities** and **actions** information, a dialog box is displayed, showing the list of matched UIAbility instances for users to select. +2. Call [startAbilityForResult()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult) to start the UIAbility of the payment application. Include **entities** and **actions** of the initiator UIAbility's **want** parameter into **entities** and **actions** under **skills** of the target UIAbility. Use **data** in the asynchronous callback to receive the information returned to the initiator UIAbility after the payment UIAbility stops itself. After the system matches the UIAbility that meets the **entities** and **actions** information, a dialog box is displayed, showing the list of matched UIAbility instances for users to select. ```ts + let context = ...; // UIAbilityContext let wantInfo = { - deviceId: '', // An empty deviceId indicates the local device. - // Uncomment the line below if you want to implicitly query data only in the specific bundle. - // bundleName: 'com.example.myapplication', - action: 'ohos.want.action.editData', - // entities can be omitted. - entities: ['entity.system.default'], + deviceId: '', // An empty deviceId indicates the local device. + // Uncomment the line below if you want to implicitly query data only in the specific bundle. + // bundleName: 'com.example.myapplication', + action: 'ohos.want.action.editData', + // entities can be omitted. + entities: ['entity.system.default'], } - // context is the ability-level context of the initiator UIAbility. - this.context.startAbilityForResult(wantInfo).then((data) => { - // ... + // context is the UIAbilityContext of the initiator UIAbility. + context.startAbilityForResult(wantInfo).then((data) => { + // ... }).catch((err) => { - // ... + // ... }) ``` - + 3. After the payment is finished, call [terminateSelfWithResult()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult) to stop the payment UIAbility and return the **abilityResult** parameter. ```ts + let context = ...; // UIAbilityContext const RESULT_CODE: number = 1001; let abilityResult = { - resultCode: RESULT_CODE, - want: { - bundleName: 'com.example.myapplication', - abilityName: 'EntryAbility', - moduleName: 'entry', - parameters: { - payResult: 'OKay', - }, + resultCode: RESULT_CODE, + want: { + bundleName: 'com.example.myapplication', + abilityName: 'EntryAbility', + moduleName: 'entry', + parameters: { + payResult: 'OKay', }, + }, } - // context is the ability-level context of the callee UIAbility. - this.context.terminateSelfWithResult(abilityResult, (err) => { - // ... + // context is the AbilityContext of the target UIAbility. + context.terminateSelfWithResult(abilityResult, (err) => { + // ... }); ``` - + 4. Receive the information returned by the payment application in the callback of the [startAbilityForResult()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult) method. The value of **RESULT_CODE** must be the same as that returned by [terminateSelfWithResult()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextterminateselfwithresult). ```ts + let context = ...; // UIAbilityContext const RESULT_CODE: number = 1001; let want = { // Want parameter information. }; - // context is the ability-level context of the initiator UIAbility. - this.context.startAbilityForResult(want).then((data) => { - if (data?.resultCode === RESULT_CODE) { - // Parse the information returned by the callee UIAbility. - let payResult = data.want?.parameters?.payResult; - // ... - } - }).catch((err) => { + // context is the UIAbilityContext of the initiator UIAbility. + context.startAbilityForResult(want).then((data) => { + if (data?.resultCode === RESULT_CODE) { + // Parse the information returned by the target UIAbility. + let payResult = data.want?.parameters?.payResult; // ... + } + }).catch((err) => { + // ... }) ``` +## Starting UIAbility with Window Mode Specified (for System Applications Only) + +By specifying the window mode when starting the UIAbility of an application, the application can be displayed in different window modes, which can be full-screen, floating window, or split-screen. + +In full-screen mode, an application occupies the entire screen after being started. Users cannot view other windows or applications. This mode is suitable for an application that requires users to focus on a specific task or UI. + +In floating window mode, an application is displayed on the screen as a floating window after being started. Users can easily switch to other windows or applications. The mode is suitable for an application that requires users to process multiple tasks at the same time. + +In split-screen mode, two applications occupy the entire screen, with one on the left or in the upper part of the screen and the other on the right or in the lower part. This mode helps users improve multi-task processing efficiency. + +The window mode is specified by the **windowMode** field in the [StartOptions](../reference/apis/js-apis-app-ability-startOptions.md) parameter of [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability). + +> **NOTE** +> +> 1. If the **windowMode** field is not specified, the UIAbility is started in the default window mode. +> 2. To ensure that the application can be displayed in the required window mode, check the **supportWindowMode** field in the [abilities](../quick-start/module-configuration-file.md#abilities) tag in the [module.json5 file](../quick-start/module-configuration-file.md) of the UIAbility and make sure the specified window mode is supported. + +The following uses the floating window mode as an example to describe how to start the FuncAbility from the EntryAbility page. + +1. Add the [StartOptions](../reference/apis/js-apis-app-ability-startOptions.md) parameter in [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability). +2. Set the **windowMode** field in the [StartOptions](../reference/apis/js-apis-app-ability-startOptions.md) parameter to **WINDOW_MODE_FLOATING**, indicating that the UIAbility will be displayed in a floating window. + +For details about how to obtain the context, see [Obtaining the Context of UIAbility](uiability-usage.md#obtaining-the-context-of-uiability). + +```ts +import AbilityConstant from '@ohos.app.ability.AbilityConstant'; + +let context = ...; // UIAbilityContext +let wantInfo = { + deviceId: '', // An empty deviceId indicates the local device. + bundleName: 'com.example.myapplication', + abilityName: 'FuncAbility', + moduleName: 'module1', // moduleName is optional. + parameters: {// Custom information. + info: 'From the Index page of EntryAbility', + }, +} +let options = { + windowMode: AbilityConstant.WindowMode.WINDOW_MODE_FLOATING +} +// context is the UIAbilityContext of the initiator UIAbility. +context.startAbility(wantInfo, options).then(() => { + // ... +}).catch((err) => { + // ... +}) +``` + +The display effect is shown below. +![](figures/start-uiability-floating-window.png) ## Starting a Specified Page of UIAbility @@ -315,10 +382,11 @@ A UIAbility component can have multiple pages. When it is started in different s ### Specifying a Startup Page -When the caller UIAbility starts another UIAbility, it usually needs to redirect to a specified page. For example, FuncAbility contains two pages: Index (corresponding to the home page) and Second (corresponding to function A page). You can configure the specified page URL in the **want** parameter by adding a custom parameter to **parameters** in **want**. For details about how to obtain the context, see [Obtaining the Context of UIAbility](uiability-usage.md#obtaining-the-context-of-uiability). +When the initiator UIAbility starts another UIAbility, it usually needs to redirect to a specified page. For example, FuncAbility contains two pages: Index (corresponding to the home page) and Second (corresponding to function A page). You can configure the specified page URL in the **want** parameter by adding a custom parameter to **parameters** in **want**. For details about how to obtain the context, see [Obtaining the Context of UIAbility](uiability-usage.md#obtaining-the-context-of-uiability). ```ts +let context = ...; // UIAbilityContext let wantInfo = { deviceId: '', // An empty deviceId indicates the local device. bundleName: 'com.example.myapplication', @@ -328,8 +396,8 @@ let wantInfo = { router: 'funcA', }, } -// context is the ability-level context of the initiator UIAbility. -this.context.startAbility(wantInfo).then(() => { +// context is the UIAbilityContext of the initiator UIAbility. +context.startAbility(wantInfo).then(() => { // ... }).catch((err) => { // ... @@ -347,25 +415,25 @@ import UIAbility from '@ohos.app.ability.UIAbility' import Window from '@ohos.window' export default class FuncAbility extends UIAbility { - funcAbilityWant; - - onCreate(want, launchParam) { - // Receive the parameters passed by the caller UIAbility. - this.funcAbilityWant = want; - } - - onWindowStageCreate(windowStage: Window.WindowStage) { - // Main window is created. Set a main page for this ability. - let url = 'pages/Index'; - if (this.funcAbilityWant?.parameters?.router) { - if (this.funcAbilityWant.parameters.router === 'funA') { - url = 'pages/Second'; - } - } - windowStage.loadContent(url, (err, data) => { - // ... - }); + funcAbilityWant; + + onCreate(want, launchParam) { + // Receive the parameters passed by the initiator UIAbility. + this.funcAbilityWant = want; + } + + onWindowStageCreate(windowStage: Window.WindowStage) { + // Main window is created. Set a main page for this UIAbility. + let url = 'pages/Index'; + if (this.funcAbilityWant?.parameters?.router) { + if (this.funcAbilityWant.parameters.router === 'funA') { + url = 'pages/Second'; + } } + windowStage.loadContent(url, (err, data) => { + // ... + }); + } } ``` @@ -384,11 +452,11 @@ In summary, when a UIAbility instance of application A has been created and the import UIAbility from '@ohos.app.ability.UIAbility' export default class FuncAbility extends UIAbility { - onNewWant(want, launchParam) { - // Receive the parameters passed by the caller UIAbility. - globalThis.funcAbilityWant = want; - // ... - } + onNewWant(want, launchParam) { + // Receive the parameters passed by the initiator UIAbility. + globalThis.funcAbilityWant = want; + // ... + } } ``` @@ -419,215 +487,200 @@ In summary, when a UIAbility instance of application A has been created and the > **NOTE** > -> When the [launch type of the callee UIAbility](uiability-launch-type.md) is set to **standard**, a new instance is created each time the callee UIAbility is started. In this case, the [onNewWant()](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonnewwant) callback will not be invoked. +> When the [launch type of the target UIAbility](uiability-launch-type.md) is set to **standard**, a new instance is created each time the target UIAbility is started. In this case, the [onNewWant()](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonnewwant) callback will not be invoked. -## Using Ability Call to Implement UIAbility Interaction +## Using Call to Implement UIAbility Interaction (for System Applications Only) -This feature applies only to system applications. Ability call is an extension of the UIAbility capability. It enables the UIAbility to be invoked by and communicate with external systems. The UIAbility invoked can be either started in the foreground or created and run in the background. You can use the ability call to implement data sharing between two UIAbility instances (caller ability and callee ability) through IPC. +Call is an extension of the UIAbility capability. It enables the UIAbility to be invoked by and communicate with external systems. The UIAbility invoked can be either started in the foreground or created and run in the background. You can use the call to implement data sharing between two UIAbility instances (CallerAbility and CalleeAbility) through IPC. -The core API used for the ability call is **startAbilityByCall**, which differs from **startAbility** in the following ways: +The core API used for the call is **startAbilityByCall**, which differs from **startAbility** in the following ways: -- **startAbilityByCall** supports ability launch in the foreground and background, whereas **startAbility** supports ability launch in the foreground only. +- **startAbilityByCall** supports UIAbility launch in the foreground and background, whereas **startAbility** supports UIAbility launch in the foreground only. -- The caller ability can use the caller object returned by **startAbilityByCall** to communicate with the callee ability, but **startAbility** does not provide the communication capability. +- The CallerAbility can use the caller object returned by **startAbilityByCall** to communicate with the CalleeAbility, but **startAbility** does not provide the communication capability. -Ability call is usually used in the following scenarios: +Call is usually used in the following scenarios: -- Communicating with the callee ability +- Communicating with the CalleeAbility -- Starting the callee ability in the background +- Starting the CalleeAbility in the background -**Table 1** Terms used in the ability call +**Table 1** Terms used in the call | **Term**| Description| | -------- | -------- | -| CallerAbility | UIAbility that triggers the ability call.| -| CalleeAbility | UIAbility invoked by the ability call.| -| Caller | Object returned by **startAbilityByCall** and used by the caller ability to communicate with the callee ability.| -| Callee | Object held by the callee ability to communicate with the caller ability.| +| CallerAbility| UIAbility that triggers the call.| +| CalleeAbility | UIAbility invoked by the call.| +| Caller | Object returned by **startAbilityByCall** and used by the CallerAbility to communicate with the CalleeAbility.| +| Callee | Object held by the CalleeAbility to communicate with the CallerAbility.| -The following figure shows the ability call process. +The following figure shows the call process. -Figure 1 Ability call process + Figure 1 Call process -![call](figures/call.png) + ![call](figures/call.png) -- The caller ability uses **startAbilityByCall** to obtain a caller object and uses **call()** of the caller object to send data to the callee ability. +- The CallerAbility uses **startAbilityByCall** to obtain a caller object and uses **call()** of the caller object to send data to the CalleeAbility. -- The callee ability, which holds a **Callee** object, uses **on()** of the **Callee** object to register a callback. This callback is invoked when the callee ability receives data from the caller ability. +- The CalleeAbility, which holds a **Callee** object, uses **on()** of the **Callee** object to register a callback. This callback is invoked when the CalleeAbility receives data from the CallerAbility. > **NOTE** -> 1. Currently, only system applications can use the ability call. +> 1. Currently, only system applications can use the call. > -> 2. The launch type of the callee ability must be **singleton**. +> 2. The launch type of the CalleeAbility must be **singleton**. > -> 3. Both local (intra-device) and cross-device ability calls are supported. The following describes how to initiate a local call. For details about how to initiate a cross-device ability call, see [Using Cross-Device Ability Call](hop-multi-device-collaboration.md#using-cross-device-ability-call). +> 3. Both local (intra-device) and cross-device calls are supported. The following describes how to initiate a local call. For details about how to initiate a cross-device call, see [Using Cross-Device Call](hop-multi-device-collaboration.md#using-cross-device-call). ### Available APIs -The following table describes the main APIs used for the ability call. For details, see [AbilityContext](../reference/apis/js-apis-app-ability-uiAbility.md#caller). +The following table describes the main APIs used for the call. For details, see [AbilityContext](../reference/apis/js-apis-app-ability-uiAbility.md#caller). -**Table 2** Ability call APIs + **Table 2** Call APIs | API| Description| | -------- | -------- | | startAbilityByCall(want: Want): Promise<Caller> | Starts a UIAbility in the foreground (through the **want** configuration) or background (default) and obtains the caller object for communication with the UIAbility. For details, see [AbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md#abilitycontextstartabilitybycall) or [ServiceExtensionContext](../reference/apis/js-apis-inner-application-serviceExtensionContext.md#serviceextensioncontextstartabilitybycall).| -| on(method: string, callback: CalleeCallBack): void | Callback invoked when the callee ability registers a method.| -| off(method: string): void | Callback invoked when the callee ability deregisters a method.| -| call(method: string, data: rpc.Sequenceable): Promise<void> | Sends agreed sequenceable data to the callee ability.| -| callWithResult(method: string, data: rpc.Sequenceable): Promise<rpc.MessageParcel> | Sends agreed sequenceable data to the callee ability and obtains the agreed sequenceable data returned by the callee ability.| +| on(method: string, callback: CalleeCallBack): void | Callback invoked when the CalleeAbility registers a method.| +| off(method: string): void | Callback invoked when the CalleeAbility deregisters a method.| +| call(method: string, data: rpc.Parcelable): Promise<void> | Sends agreed parcelable data to the CalleeAbility.| +| callWithResult(method: string, data: rpc.Parcelable): Promise<rpc.MessageSequence> | Sends agreed parcelable data to the CalleeAbility and obtains the agreed parcelable data returned by the CalleeAbility.| | release(): void | Releases the caller object.| | on(type: "release", callback: OnReleaseCallback): void | Callback invoked when the caller object is released.| -The implementation of using the ability call for UIAbility interaction involves two parts. +The implementation of using the call for UIAbility interaction involves two parts. -- [Creating a Callee Ability](#creating-a-callee-ability) +- [Creating a CalleeAbility](#creating-a-calleeability) -- [Accessing the Callee Ability](#accessing-the-callee-ability) +- [Accessing the CalleeAbility](#accessing-the-calleeability) -### Creating a Callee Ability +### Creating a CalleeAbility -For the callee ability, implement the callback to receive data and the methods to marshal and unmarshal data. When data needs to be received, use **on()** to register a listener. When data does not need to be received, use **off()** to deregister the listener. +For the CalleeAbility, implement the callback to receive data and the methods to marshal and unmarshal data. When data needs to be received, use **on()** to register a listener. When data does not need to be received, use **off()** to deregister the listener. -1. Configure the ability launch type. +1. Configure the launch type of the UIAbility. + + For example, set the launch type of the CalleeAbility to **singleton**. For details, see [UIAbility Component Launch Type](uiability-launch-type.md). - Set **launchType** of the callee ability to **singleton** in the **module.json5** file. - - | JSON Field| Description| - | -------- | -------- | - | "launchType" | Ability launch type. Set this parameter to **singleton**.| - - An example of the ability configuration is as follows: - - ```json - "abilities":[{ - "name": ".CalleeAbility", - "srcEntrance": "./ets/CalleeAbility/CalleeAbility.ts", - "launchType": "singleton", - "description": "$string:CalleeAbility_desc", - "icon": "$media:icon", - "label": "$string:CalleeAbility_label", - "visible": true - }] - ``` - 2. Import the **UIAbility** module. - + ```ts - import Ability from '@ohos.app.ability.UIAbility'; + import UIAbility from '@ohos.app.ability.UIAbility'; ``` -3. Define the agreed sequenceable data. +3. Define the agreed parcelable data. - The data formats sent and received by the caller and callee abilities must be consistent. In the following example, the data formats are number and string. + The data formats sent and received by the CallerAbility and CalleeAbility must be consistent. In the following example, the data formats are number and string. + ```ts - export default class MySequenceable { - num: number = 0 - str: string = "" + export default class MyParcelable { + num: number = 0; + str: string = ''; - constructor(num, string) { - this.num = num - this.str = string - } + constructor(num, string) { + this.num = num; + this.str = string; + } - marshalling(messageParcel) { - messageParcel.writeInt(this.num) - messageParcel.writeString(this.str) - return true - } + marshalling(messageSequence) { + messageSequence.writeInt(this.num); + messageSequence.writeString(this.str); + return true + } - unmarshalling(messageParcel) { - this.num = messageParcel.readInt() - this.str = messageParcel.readString() - return true - } + unmarshalling(messageSequence) { + this.num = messageSequence.readInt(); + this.str = messageSequence.readString(); + return true; + } } ``` 4. Implement **Callee.on** and **Callee.off**. - The time to register a listener for the callee ability depends on your application. The data sent and received before the listener is registered and that after the listener is deregistered are not processed. In the following example, the **MSG_SEND_METHOD** listener is registered in **onCreate** of the ability and deregistered in **onDestroy**. After receiving sequenceable data, the application processes the data and returns the data result. You need to implement processing based on service requirements. The sample code is as follows: + The time to register a listener for the CalleeAbility depends on your application. The data sent and received before the listener is registered and that after the listener is deregistered are not processed. In the following example, the **MSG_SEND_METHOD** listener is registered in **onCreate** of the UIAbility and deregistered in **onDestroy**. After receiving parcelable data, the application processes the data and returns the data result. You need to implement processing based on service requirements. The sample code is as follows: + ```ts const TAG: string = '[CalleeAbility]'; const MSG_SEND_METHOD: string = 'CallSendMsg'; function sendMsgCallback(data) { - console.info('CalleeSortFunc called'); + console.info('CalleeSortFunc called'); - // Obtain the sequenceable data sent by the caller ability. - let receivedData = new MySequenceable(0, ''); - data.readSequenceable(receivedData); - console.info(`receiveData[${receivedData.num}, ${receivedData.str}]`); + // Obtain the parcelable data sent by the CallerAbility. + let receivedData = new MyParcelable(0, ''); + data.readParcelable(receivedData); + console.info(`receiveData[${receivedData.num}, ${receivedData.str}]`); - // Process the data. - // Return the sequenceable data result to the caller ability. - return new MySequenceable(receivedData.num + 1, `send ${receivedData.str} succeed`); + // Process the data. + // Return the parcelable data result to the CallerAbility. + return new MyParcelable(receivedData.num + 1, `send ${receivedData.str} succeed`); } - export default class CalleeAbility extends Ability { - onCreate(want, launchParam) { - try { - this.callee.on(MSG_SEND_METHOD, sendMsgCallback); - } catch (error) { - console.info(`${MSG_SEND_METHOD} register failed with error ${JSON.stringify(error)}`); - } + export default class CalleeAbility extends UIAbility { + onCreate(want, launchParam) { + try { + this.callee.on(MSG_SEND_METHOD, sendMsgCallback); + } catch (error) { + console.info(`${MSG_SEND_METHOD} register failed with error ${JSON.stringify(error)}`); } + } - onDestroy() { - try { - this.callee.off(MSG_SEND_METHOD); - } catch (error) { - console.error(TAG, `${MSG_SEND_METHOD} unregister failed with error ${JSON.stringify(error)}`); - } + onDestroy() { + try { + this.callee.off(MSG_SEND_METHOD); + } catch (error) { + console.error(TAG, `${MSG_SEND_METHOD} unregister failed with error ${JSON.stringify(error)}`); } + } } ``` -### Accessing the Callee Ability +### Accessing the CalleeAbility 1. Import the **UIAbility** module. ```ts - import Ability from '@ohos.app.ability.UIAbility'; + import UIAbility from '@ohos.app.ability.UIAbility'; ``` 2. Obtain the caller interface. - - The **context** attribute of the ability implements **startAbilityByCall** to obtain the caller object for communication. The following example uses **this.context** to obtain the **context** attribute of the ability, uses **startAbilityByCall** to start the callee ability, obtain the caller object, and register the **onRelease** listener of the caller ability. You need to implement processing based on service requirements. + The **UIAbilityContext** attribute implements **startAbilityByCall** to obtain the caller object for communication. The following example uses **this.context** to obtain the **UIAbilityContext**, uses **startAbilityByCall** to start the CalleeAbility, obtain the caller object, and register the **onRelease** listener of the CallerAbility. You need to implement processing based on service requirements. + + ```ts - // Register the onRelease() listener of the caller ability. + // Register the onRelease() listener of the CallerAbility. private regOnRelease(caller) { - try { - caller.on("release", (msg) => { - console.info(`caller onRelease is called ${msg}`); - }) - console.info('caller register OnRelease succeed'); - } catch (error) { - console.info(`caller register OnRelease failed with ${error}`); - } + try { + caller.on('release', (msg) => { + console.info(`caller onRelease is called ${msg}`); + }) + console.info('caller register OnRelease succeed'); + } catch (error) { + console.info(`caller register OnRelease failed with ${error}`); + } } async onButtonGetCaller() { - try { - this.caller = await context.startAbilityByCall({ - bundleName: 'com.samples.CallApplication', - abilityName: 'CalleeAbility' - }) - if (this.caller === undefined) { - console.info('get caller failed') - return - } - console.info('get caller success') - this.regOnRelease(this.caller) - } catch (error) { - console.info(`get caller failed with ${error}`) + try { + this.caller = await context.startAbilityByCall({ + bundleName: 'com.samples.CallApplication', + abilityName: 'CalleeAbility' + }) + if (this.caller === undefined) { + console.info('get caller failed') + return } + console.info('get caller success') + this.regOnRelease(this.caller) + } catch (error) { + console.info(`get caller failed with ${error}`) + } } ``` diff --git a/en/application-dev/application-models/uiability-launch-type.md b/en/application-dev/application-models/uiability-launch-type.md index 70c212ed46e769dbdf4e0c1fd347403c463f6004..6442ffc4359254bbed7d7da85ec4b753f0f3eea4 100644 --- a/en/application-dev/application-models/uiability-launch-type.md +++ b/en/application-dev/application-models/uiability-launch-type.md @@ -19,7 +19,7 @@ Each time [startAbility()](../reference/apis/js-apis-inner-application-uiAbility **Figure 1** Demonstration effect in singleton mode -![uiability-launch-type1](figures/uiability-launch-type1.png) +![uiability-launch-type1](figures/uiability-launch-type1.png) > **NOTE** > @@ -47,9 +47,9 @@ To use the singleton mode, set **launchType** in the [module.json5 configuration In standard mode, each time [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) is called, a new UIAbility instance of this type is created in the application process. Multiple UIAbility instances of this type are displayed in **Recents**. -**Figure 2** Demonstration effect in standard mode +**Figure 2** Demonstration effect in standard mode -![standard-mode](figures/standard-mode.png) +![standard-mode](figures/standard-mode.png) To use the standard mode, set **launchType** in the [module.json5 configuration file](../quick-start/module-configuration-file.md) to **standard**. @@ -75,12 +75,12 @@ The **specified** mode is used in some special scenarios. For example, in a docu **Figure 3** Demonstration effect in specified mode -![uiability-launch-type2](figures/uiability-launch-type2.png) +![uiability-launch-type2](figures/uiability-launch-type2.png) -For example, there are EntryAbility and SpecifiedAbility, and the launch type of SpecifiedAbility is set to **specified**. You are required to start SpecifiedAbility from EntryAbility. +For example, there are two UIAbility components: EntryAbility and SpecifiedAbility (with the launch type **specified**). You are required to start SpecifiedAbility from EntryAbility. + +1. In SpecifiedAbility, set the **launchType** field in the [module.json5 file](../quick-start/module-configuration-file.md) to **specified**. -1. In SpecifiedAbility, set the **launchType** field in the [module.json5 configuration file](../quick-start/module-configuration-file.md) to **specified**. - ```json { "module": { @@ -95,9 +95,8 @@ For example, there are EntryAbility and SpecifiedAbility, and the launch type of } ``` -2. Before a UIAbility instance is created, you can create a unique string key for the instance. The key is bound to the UIAbility instance when it is created. Each time [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) is called, the application is asked which UIAbility instance is used to respond to the [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) request. - In EntryAbility, add a custom parameter, for example, **instanceKey**, to the [want](want-overview.md) parameter in [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) to distinguish the UIAbility instances. - +2. Create a unique string key for the instance. Each time [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) is called, the application, based on the key, identifies the UIAbility instance used to respond to the request. In EntryAbility, add a custom parameter, for example, **instanceKey**, to the **want** parameter in [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) to distinguish the UIAbility instance. + ```ts // Configure an independent key for each UIAbility instance. // For example, in the document usage scenario, use the document path as the key. @@ -114,17 +113,18 @@ For example, there are EntryAbility and SpecifiedAbility, and the launch type of instanceKey: getInstance(), }, } - // context is the ability-level context of the initiator UIAbility. + // context is the UIAbilityContext of the initiator UIAbility. this.context.startAbility(want).then(() => { // ... }).catch((err) => { // ... }) ``` - -3. During running, the internal service of UIAbility determines whether to create multiple instances. If the key is matched, the UIAbility instance bound to the key is started. Otherwise, a new UIAbility instance is created. - The launch type of SpecifiedAbility is set to **specified**. Before SpecifiedAbility is started, the [onAcceptWant()](../reference/apis/js-apis-app-ability-abilityStage.md#abilitystageonacceptwant) callback of the corresponding AbilityStage instance is invoked to parse the input **want** parameter and obtain the custom parameter **instanceKey**. A string key identifier is returned through the [onAcceptWant()](../reference/apis/js-apis-app-ability-abilityStage.md#abilitystageonacceptwant) callback of the AbilityStage instance. [If the returned key corresponds to a started UIAbility instance](mission-management-launch-type.md#fig14520125175314), that UIAbility instance is switched to the foreground and gains focus again. Otherwise, a new instance is created and started. - + +3. Before SpecifiedAbility is started, the [onAcceptWant()](../reference/apis/js-apis-app-ability-abilityStage.md#abilitystageonacceptwant) callback of the corresponding AbilityStage instance is invoked to obtain the key of the UIAbility, because the launch type of SpecifiedAbility is set to **specified**. If a UIAbility instance matching the key exists, the system starts the UIAbility instance and invokes its [onNewWant()](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonnewwant) callback. Otherwise, the system creates a new UIAbility instance and invokes its [onCreate()](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityoncreate) and [onWindowStageCreate()](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityonwindowstagecreate) callbacks. + + In the sample code, the [onAcceptWant()](../reference/apis/js-apis-app-ability-abilityStage.md#abilitystageonacceptwant) callback parses the **want** parameter to obtain the custom parameter **instanceKey**. The service logic returns a key string based on **instanceKey** parameter to identify the UIAbility instance. If the returned key maps to a started UIAbility instance, the system pulls the UIAbility instance back to the foreground and obtains the focus. If the returned key does not map to a started UIAbility instance, the system creates a new UIAbility instance and starts it. + ```ts import AbilityStage from '@ohos.app.ability.AbilityStage'; @@ -133,7 +133,7 @@ For example, there are EntryAbility and SpecifiedAbility, and the launch type of // In the AbilityStage instance of the callee, a key value corresponding to a UIAbility instance is returned for UIAbility whose launch type is specified. // In this example, SpecifiedAbility of module1 is returned. if (want.abilityName === 'SpecifiedAbility') { - // The returned string key is a custom string. + // The returned key string is a custom string. return `SpecifiedAbilityInstance_${want.parameters.instanceKey}`; } @@ -141,22 +141,17 @@ For example, there are EntryAbility and SpecifiedAbility, and the launch type of } } ``` - + > **NOTE** > > 1. Assume that the application already has a UIAbility instance created, and the launch type of the UIAbility instance is set to **specified**. If [startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability) is called again to start the UIAbility instance, and the [onAcceptWant()](../reference/apis/js-apis-app-ability-abilityStage.md#abilitystageonacceptwant) callback of [AbilityStage](../reference/apis/js-apis-app-ability-abilityStage.md) matches a created UIAbility instance, the original UIAbility instance is started, and no new UIAbility instance is created. In this case, the [onNewWant()](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonnewwant) callback is invoked, but the [onCreate()](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityoncreate) and [onWindowStageCreate()](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityonwindowstagecreate) callbacks are not. > 2. AbilityStage is not automatically generated in the default project of DevEco Studio. For details about how to create an AbilityStage file, see [AbilityStage Component Container](abilitystage.md). - - For example, in the document application, different key values are bound to different document instances. Each time a document is created, a new key value (for example, file path) is passed, and a new UIAbility instance is created when UIAbility is started in AbilityStage. However, when you open an existing document, the same UIAbility instance is started again in AbilityStage. - -The following steps are used as an example. + For example, in the document application, different keys are bound to different document instances. Each time a document is created, a new key (for example, file path) is passed, and a new UIAbility instance is created when UIAbility is started in AbilityStage. However, when you open an existing document, the same UIAbility instance is started again in AbilityStage. + + The following steps are used as an example. + 1. Open file A. A UIAbility instance, for example, UIAbility instance 1, is started. - 2. Close the process of file A in **Recents**. UIAbility instance 1 is destroyed. Return to the home screen and open file A again. A new UIAbility instance is started, for example, UIAbility instance 2. - 3. Return to the home screen and open file B. A new UIAbility instance is started, for example, UIAbility instance 3. - - 4. Return to the home screen and open file A again. UIAbility instance 2 is started. - - \ No newline at end of file + 4. Return to the home screen and open file A again. UIAbility instance 2 is started. This is because the system automatically matches the key of the UIAbility instance and starts the UIAbility instance that has a matching key. In this example, UIAbility instance 2 has the same key as file A. Therefore, the system pulls back UIAbility instance 2 and focuses it without creating a new instance. diff --git a/en/application-dev/application-models/uiability-overview.md b/en/application-dev/application-models/uiability-overview.md index 14cb5c4652749c97dd6e50c4232b6f65fb6feaab..cd059b9555bfd80c02c9bce66f4c50cd58fff568 100644 --- a/en/application-dev/application-models/uiability-overview.md +++ b/en/application-dev/application-models/uiability-overview.md @@ -3,10 +3,27 @@ ## Overview -UIAbility has the UI and is mainly used for user interaction. +UIAbility is a type of application component that provides the UI for user interaction. -UIAbility is the basic unit scheduled by the system and provides a window for applications to draw UIs. A UIAbility component can implement a functional module through multiple pages. Each UIAbility component instance corresponds to a mission in **Recents**. +The following design philosophy is behind UIAbility: +1. Native support for [cross-device migration](hop-cross-device-migration.md) and [multi-device collaboration](hop-multi-device-collaboration.md) at the application component level + +2. Support for multiple device types and window forms + +For details, see [Interpretation of the Application Model](application-model-description.md). + +The UIAbility division principles and suggestions are as follows: + +UIAbility is the basic unit scheduled by the system and provides a window for applications to draw UIs. An application can contain one or more UIAbility components. For example, for a payment application, you can use two UIAbility components to carry the entry and payment functionalities. + +Each UIAbility component instance is displayed as a mission in Recents. + +You can develop a single UIAbility or multiple UIAbilities for your application based on service requirements. + +- If you want only one mission to be displayed in Recents, use one UIAbility and multiple pages. + +- If you want multiple missions to be displayed in Recents or multiple windows to be opened simultaneously, use multiple UIAbilities. ## Privacy Statement Configuration @@ -32,8 +49,3 @@ To enable an application to properly use a UIAbility component, declare the UIAb } } ``` - -> **NOTE** -> -> For the ability composition, see [Adding an Ability to a Module](https://developer.harmonyos.com/en/docs/documentation/doc-guides-V3/ohos-adding-ability-0000001218280664-V3). - diff --git a/en/application-dev/application-models/windowextensionability.md b/en/application-dev/application-models/windowextensionability.md new file mode 100644 index 0000000000000000000000000000000000000000..069897ad02435070ac470f5d2d3d528c76b417e8 --- /dev/null +++ b/en/application-dev/application-models/windowextensionability.md @@ -0,0 +1,112 @@ +# WindowExtensionAbility + +[WindowExtensionAbility](../reference/apis/js-apis-application-windowExtensionAbility.md) is a type of ExtensionAbility component that allows a system application to be embedded in and displayed over another application. + + +The WindowExtensionAbility component must be used together with the [AbilityComponent](../reference/arkui-ts/ts-container-ability-component.md) to process services of the started application. WindowExtensionAbility is run in connection mode. A system application must use the AbilityComponent to start the WindowExtensionAbility component. + +Each ExtensionAbility has its own context. For WindowExtensionAbility, +the context is [WindowExtensionContext](../reference/apis/js-apis-inner-application-windowExtensionContext.md). + +> **NOTE** +> +> **WindowExtensionAbility** is a system API. To embed a third-party application in another application and display it over the application, switch to the full SDK by following the instructions provided in [Guide to Switching to Full SDK](../../application-dev/quick-start/full-sdk-switch-guide.md). +> + + +## Setting an Embedded Ability (for System Applications Only) + +The **WindowExtensionAbility** class provides **onConnect()**, **onDisconnect()**, and **onWindowReady()** lifecycle callbacks, which can be overridden. + +- The **onWindowReady()** callback is invoked when a window is created for the ability. + +- The **onConnect()** callback is invoked when the AbilityComponent corresponding to the window connects to the ability. + +- The **onDisconnect()** callback is invoked when the AbilityComponent disconnects from the ability. + + +**How to Develop** + +To implement an embedded application, manually create a WindowExtensionAbility in DevEco Studio as follows: + +1. In the **ets** directory of the **Module** project, right-click and choose **New > Directory** to create a directory named **WindowExtAbility**. + +2. Right-click the **WindowExtAbility** directory, and choose **New > TypeScript File** to create a file named **WindowExtAbility.ts**. + +3. Open the **WindowExtAbility.ts** file and import the dependency package of **WindowExtensionAbility**. Customize a class that inherits from **WindowExtensionAbility** and implement the **onWindowReady()**, **onConnect()**, and **onDisconnect()** lifecycle callbacks. + + ```ts + import Extension from '@ohos.application.WindowExtensionAbility' + + export default class WindowExtAbility extends Extension { + onWindowReady(window) { + window.loadContent('WindowExtAbility/pages/index1').then(() => { + window.getProperties().then((pro) => { + console.log("WindowExtension " + JSON.stringify(pro)); + }) + window.show(); + }) + } + + onConnect(want) { + console.info('JSWindowExtension onConnect ' + want.abilityName); + } + + onDisconnect(want) { + console.info('JSWindowExtension onDisconnect ' + want.abilityName); + } + } + ``` + +4. Register the WindowExtensionAbility in the [module.json5 file](../quick-start/module-configuration-file.md) corresponding to the **Module** project. Set **type** to **"window"** and **srcEntrance** to the code path of the ExtensionAbility component. + + ```json + { + "module": { + "extensionAbilities": [ + { + "name": "WindowExtAbility", + "srcEntrance": "./ets/WindowExtAbility/WindowExtAbility.ts", + "icon": "$media:icon", + "description": "WindowExtension", + "type": "window", + "visible": true, + } + ], + } + } + ``` + + +## Starting an Embedded Ability (for System Applications Only) + +System applications can load the created WindowExtensionAbility through the AbilityComponent. + +**How to Develop** + +1. To connect to an embedded application, add the AbilityComponent to the corresponding pages in the DevEco Studio project. + +2. Set **bundleName** and **abilityName** in the AbilityComponent. + +3. Set the width and height. The sample code is as follows: + +```ts +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + AbilityComponent({ abilityName: "WindowExtAbility", bundleName: "com.example.WindowExtAbility"}) + .width(500) + .height(500) + } + .width('100%') + } + .height('100%') + .backgroundColor(0x64BB5c) + } +} +``` diff --git a/en/application-dev/application-test/arkxtest-guidelines.md b/en/application-dev/application-test/arkxtest-guidelines.md index bd82cae45fb4c673f014bcc13cfc02beb3853a2e..64edba5e9f4d4ebbd6b7bfbff44c4b01c8a67d4d 100644 --- a/en/application-dev/application-test/arkxtest-guidelines.md +++ b/en/application-dev/application-test/arkxtest-guidelines.md @@ -108,7 +108,7 @@ You write a UI test script based on the unit test framework, adding the invoking In this example, the UI test script is written based on the preceding unit test script. First, add the dependency package, as shown below: ```js -import {UiDriver,BY,UiComponent,MatchPattern} from '@ohos.uitest' +import {Driver,ON,Component,MatchPattern} from '@ohos.uitest' ``` Then, write specific test code. Specifically, implement the click action on the started application page and add checkpoint check cases. @@ -131,16 +131,16 @@ export default function abilityTest() { expect(Ability.context.abilityInfo.name).assertEqual('EntryAbility'); }) //ui test code - //init uidriver - var driver = await UiDriver.create(); + //init driver + var driver = await Driver.create(); await driver.delayMs(1000); - //find button by text 'Next' - var button = await driver.findComponent(BY.text('Next')); + //find button on text 'Next' + var button = await driver.findComponent(ON.text('Next')); //click button await button.click(); await driver.delayMs(1000); //check text - await driver.assertComponentExist(BY.text('after click')); + await driver.assertComponentExist(ON.text('after click')); await driver.pressBack(); done(); }) @@ -195,14 +195,15 @@ The framework supports multiple test case execution modes, which are triggered b | itName | Test case to be executed. | {itName} | -s itName testAttributeIt | | timeout | Timeout interval for executing a test case. | Positive integer (unit: ms). If no value is set, the default value 5000 is used. | -s timeout 15000 | | breakOnError | Whether to enable break-on-error mode. When this mode is enabled, the test execution process exits if a test assertion error or any other error occurs.| **true**/**false** (default value) | -s breakOnError true | +| random | Whether to execute test cases in random sequence.| **true**/**false** (default value) | -s random true | | testType | Type of the test case to be executed. | function, performance, power, reliability, security, global, compatibility, user, standard, safety, resilience| -s testType function | | level | Level of the test case to be executed. | 0, 1, 2, 3, 4 | -s level 0 | -| size | Size of the test case to be executed. | small, medium, large | -s size small | +| size | Size of the test case to be executed. | small, medium, large | -s size small | | stress | Number of times that the test case is executed. | Positive integer | -s stress 1000 | **Running Commands** -> Configure hdc-related environment variables, and then perform the following: +> Before running commands in the CLI, make sure hdc-related environment variables have been configured. - Open the CLI. - Run the **aa test** commands. diff --git a/en/application-dev/application-test/figures/Execute.PNG b/en/application-dev/application-test/figures/Execute.PNG index ba96bdfdaf430249f3506153a45c6fe439eda5cc..0260b7983a13851dc1ef8e45928f952eb509a7d8 100644 Binary files a/en/application-dev/application-test/figures/Execute.PNG and b/en/application-dev/application-test/figures/Execute.PNG differ diff --git a/en/application-dev/connectivity/Readme-EN.md b/en/application-dev/connectivity/Readme-EN.md index 578e2a3c56c8a1f6cce377eb39ef9a7756d74491..7176cb8fb438cbe8beec5b36bdd290c0b01bbd1f 100755 --- a/en/application-dev/connectivity/Readme-EN.md +++ b/en/application-dev/connectivity/Readme-EN.md @@ -5,6 +5,10 @@ - [HTTP Data Request](http-request.md) - [WebSocket Connection](websocket-connection.md) - [Socket Connection](socket-connection.md) + - [Network Policy Management](net-policy-management.md) + - [Network Sharing](net-sharing.md) + - [Ethernet Connection](net-ethernet.md) + - [Network Connection Management](net-connection-manager.md) - IPC & RPC - [IPC & RPC Overview](ipc-rpc-overview.md) - [IPC & RPC Development](ipc-rpc-development-guideline.md) diff --git a/en/application-dev/connectivity/http-request.md b/en/application-dev/connectivity/http-request.md index da1a7e1c517f284037a41a88e2167b6d1d2406aa..39ada2bc9b21b8e5d157806f5164c02219c65296 100644 --- a/en/application-dev/connectivity/http-request.md +++ b/en/application-dev/connectivity/http-request.md @@ -1,6 +1,6 @@ # HTTP Data Request -## Use Cases +## When to Use An application can initiate a data request over HTTP. Common HTTP methods include **GET**, **POST**, **OPTIONS**, **HEAD**, **PUT**, **DELETE**, **TRACE**, and **CONNECT**. @@ -14,40 +14,49 @@ For details about how to apply for permissions, see [Access Control Development] The following table provides only a simple description of the related APIs. For details, see [API Reference](../reference/apis/js-apis-http.md). -| API | Description | -| ----------------------------------------- | --------------------------------------------------------- | -| createHttp() | Creates an HTTP request. | -| request() | Initiates an HTTP request to a given URL. | -| destroy() | Destroys an HTTP request. | +| API | Description | +| ----------------------------------------- | ----------------------------------- | +| createHttp() | Creates an HTTP request. | +| request() | Initiates an HTTP request to a given URL. | +| request2()10+ | Initiates an HTTP network request based on the URL and returns a streaming response.| +| destroy() | Destroys an HTTP request. | | on(type: 'headersReceive') | Registers an observer for HTTP Response Header events. | -| off(type: 'headersReceive') | Unregisters the observer for HTTP Response Header events. | +| off(type: 'headersReceive') | Unregisters the observer for HTTP Response Header events.| +| once\('headersReceive'\)8+ | Registers a one-time observer for HTTP Response Header events.| +| on\('dataReceive'\)10+ | Registers an observer for events indicating receiving of HTTP streaming responses. | +| off\('dataReceive'\)10+ | Unregisters the observer for events indicating receiving of HTTP streaming responses. | +| on\('dataEnd'\)10+ | Registers an observer for events indicating completion of receiving HTTP streaming responses. | +| off\('dataEnd'\)10+ | Unregisters the observer for events indicating completion of receiving HTTP streaming responses.| +| on\('dataProgress'\)10+ | Registers an observer for events indicating progress of receiving HTTP streaming responses. | +| off\('dataProgress'\)10+ | Unregisters the observer for events indicating progress of receiving HTTP streaming responses.| -## How to Develop +## How to Develop request APIs -1. Import the required HTTP module. -2. Create an **HttpRequest** object. -3. (Optional) Listen for HTTP Response Header events. -4. Initiate an HTTP request to a given URL. -5. (Optional) Process the HTTP Response Header event and the return result of the HTTP request. +1. Import the **http** namespace from **@ohos.net.http.d.ts**. +2. Call **createHttp()** to create an **HttpRequest** object. +3. Call **httpRequest.on()** to subscribe to HTTP response header events. This API returns a response earlier than the request. You can subscribe to HTTP response header events based on service requirements. +4. Call **httpRequest.request()** to initiate a network request. You need to pass in the URL and optional parameters of the HTTP request. +5. Parse the returned result based on service requirements. +6. Call **off()** to unsubscribe from HTTP response header events. +7. Call **httpRequest.destroy()** to release resources after the request is processed. ```js +// Import the http namespace. import http from '@ohos.net.http'; -// Each HttpRequest corresponds to an HttpRequestTask object and cannot be reused. +// Each httpRequest corresponds to an HTTP request task and cannot be reused. let httpRequest = http.createHttp(); - -// Subscribe to the HTTP response header, which is returned earlier than HttpRequest. You can subscribe to HTTP Response Header events based on service requirements. -// on('headerReceive', AsyncCallback) will be replaced by on('headersReceive', Callback) in API version 8. 8+ +// This API is used to listen for the HTTP Response Header event, which is returned earlier than the result of the HTTP request. It is up to you whether to listen for HTTP Response Header events. +// on('headerReceive', AsyncCallback) is replaced by on('headersReceive', Callback) since API version 8. httpRequest.on('headersReceive', (header) => { console.info('header: ' + JSON.stringify(header)); }); - httpRequest.request( - // Set the URL of the HTTP request. You need to define the URL. Set the parameters of the request in extraData. + // Customize EXAMPLE_URL in extraData on your own. It is up to you whether to add parameters to the URL. "EXAMPLE_URL", { method: http.RequestMethod.POST, // Optional. The default value is http.RequestMethod.GET. - // You can add the header field based on service requirements. + // You can add header fields based on service requirements. header: { 'Content-Type': 'application/json' }, @@ -55,21 +64,105 @@ httpRequest.request( extraData: { "data": "data to send", }, - connectTimeout: 60000, // Optional. The default value is 60000, in ms. + expectDataType: http.HttpDataType.STRING, // Optional. This field specifies the type of the return data. + usingCache: true, // Optional. The default value is true. + priority: 1, // Optional. The default value is 1. + connectTimeout: 60000 // Optional. The default value is 60000, in ms. readTimeout: 60000, // Optional. The default value is 60000, in ms. + usingProtocol: http.HttpProtocol.HTTP1_1, // Optional. The default protocol type is automatically specified by the system. + usingProxy: false, // Optional. By default, network proxy is not used. This field is supported since API 10. }, (err, data) => { if (!err) { - // data.result contains the HTTP response. Parse the response based on service requirements. - console.info('Result:' + data.result); - console.info('code:' + data.responseCode); - // data.header contains the HTTP response header. Parse the content based on service requirements. + // data.result carries the HTTP response. Parse the response based on service requirements. + console.info('Result:' + JSON.stringify(data.result)); + console.info('code:' + JSON.stringify(data.responseCode)); + // data.header carries the HTTP response header. Parse the content based on service requirements. console.info('header:' + JSON.stringify(data.header)); - console.info('cookies:' + data.cookies); // 8+ + console.info('cookies:' + JSON.stringify(data.cookies)); // 8+ } else { console.info('error:' + JSON.stringify(err)); - // Call the destroy() method to destroy the request if it is no longer needed. + // Unsubscribe from HTTP Response Header events. + httpRequest.off('headersReceive'); + // Call the destroy() method to release resources after HttpRequest is complete. httpRequest.destroy(); } } ); ``` + +## How to Develop request2 APIs + +1. Import the **http** namespace from **@ohos.net.http.d.ts**. +2. Call **createHttp()** to create an **HttpRequest** object. +3. Depending on your need, call **on()** of the **HttpRequest** object to subscribe to HTTP response header events as well as events indicating receiving of HTTP streaming responses, progress of receiving HTTP streaming responses, and completion of receiving HTTP streaming responses. +4. Call **request2()** to initiate a network request. You need to pass in the URL and optional parameters of the HTTP request. +5. Parse the returned response code as needed. +6. Call **off()** of the **HttpRequest** object to unsubscribe from the related events. +7. Call **httpRequest.destroy()** to release resources after the request is processed. + +```js +// Import the http namespace. +import http from '@ohos.net.http' + +// Each httpRequest corresponds to an HTTP request task and cannot be reused. +let httpRequest = http.createHttp(); +// Subscribe to HTTP response header events. +httpRequest.on('headersReceive', (header) => { + console.info('header: ' + JSON.stringify(header)); +}); +// Subscribe to events indicating receiving of HTTP streaming responses. +let res = ''; +httpRequest.on('dataReceive', (data) => { + res += data; + console.info('res: ' + res); +}); +// Subscribe to events indicating completion of receiving HTTP streaming responses. +httpRequest.on('dataEnd', () => { + console.info('No more data in response, data receive end'); +}); +// Subscribe to events indicating progress of receiving HTTP streaming responses. +httpRequest.on('dataProgress', (data) => { + console.log("dataProgress receiveSize:" + data.receiveSize+ ", totalSize:" + data.totalSize); +}); + +httpRequest.request2( + // Customize EXAMPLE_URL in extraData on your own. It is up to you whether to add parameters to the URL. + "EXAMPLE_URL", + { + method: http.RequestMethod.POST, // Optional. The default value is http.RequestMethod.GET. + // You can add header fields based on service requirements. + header: { + 'Content-Type': 'application/json' + }, + // This field is used to transfer data when the POST request is used. + extraData: { + "data": "data to send", + }, + expectDataType: http.HttpDataType.STRING, // Optional. This field specifies the type of the return data. + usingCache: true, // Optional. The default value is true. + priority: 1, // Optional. The default value is 1. + connectTimeout: 60000 // Optional. The default value is 60000, in ms. + readTimeout: 60000, // Optional. The default value is 60000, in ms. If a large amount of data needs to be transmitted, you are advised to set this parameter to a larger value to ensure normal data transmission. + usingProtocol: http.HttpProtocol.HTTP1_1, // Optional. The default protocol type is automatically specified by the system. + }, (err, data) => { + console.info('error:' + JSON.stringify(err)); + console.info('ResponseCode :' + JSON.stringify(data)); + // Unsubscribe from HTTP Response Header events. + httpRequest.off('headersReceive'); + // Unregister the observer for events indicating receiving of HTTP streaming responses. + httpRequest.off('dataReceive'); + // Unregister the observer for events indicating progress of receiving HTTP streaming responses. + httpRequest.off('dataProgress'); + // Unregister the observer for events indicating completion of receiving HTTP streaming responses. + httpRequest.off('dataEnd'); + // Call the destroy() method to release resources after HttpRequest is complete. + httpRequest.destroy(); + } +); + +``` + +## Samples +The following sample is provided to help you better understand how to develop the HTTP data request feature: +- [HTTP Data Request (ArkTS) (API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Connectivity/Http) +- [HTTP Communication (ArkTS) (API9)](https://gitee.com/openharmony/codelabs/tree/master/NetworkManagement/SmartChatEtsOH) diff --git a/en/application-dev/connectivity/ipc-rpc-development-guideline.md b/en/application-dev/connectivity/ipc-rpc-development-guideline.md index 5512d7a016754c94174fe269d5ed58424a218fb6..89bff0d4a168c74309f6bc711a3725fd4c9aad1b 100644 --- a/en/application-dev/connectivity/ipc-rpc-development-guideline.md +++ b/en/application-dev/connectivity/ipc-rpc-development-guideline.md @@ -1,4 +1,4 @@ -# IPC & RPC Development Guidelines +# IPC & RPC Development ## When to Use diff --git a/en/application-dev/connectivity/net-connection-manager.md b/en/application-dev/connectivity/net-connection-manager.md new file mode 100644 index 0000000000000000000000000000000000000000..1eddb3b5bbe47cb4d02123986647955d0492629e --- /dev/null +++ b/en/application-dev/connectivity/net-connection-manager.md @@ -0,0 +1,246 @@ +# Network Connection Management + +## Introduction +The Network Connection Management module provides basic network management capabilities, including management of Wi-Fi/cellular/Ethernet connection priorities, network quality evaluation, subscription to network connection status changes, query of network connection information, and DNS resolution. + +> **NOTE** +> To maximize the application running efficiency, most API calls are called asynchronously in callback or promise mode. The following code examples use the callback mode. For details about the APIs, see [sms API Reference](../reference/apis/js-apis-net-connection.md). + +## Basic Concepts +- Producer: a provider of data networks, such as Wi-Fi, cellular, and Ethernet. +- Consumer: a user of data networks, for example, an application or a system service. +- Network probe: a mechanism used to detect the network availability to prevent the switch from an available network to an unavailable network. The probe type can be binding network detection, DNS detection, HTTP detection, or HTTPS detection. +- Network selection: a mechanism used to select the optimal network when multiple networks coexist. It is triggered when the network status, network information, or network quality evaluation score changes. + +## **Constraints** +- Programming language: C++ and JS +- System: Linux kernel +- 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. + +## When to Use +Typical application scenarios of network connection management are as follows: +- Subscribing to status changes of the specified network +- Obtaining the list of all registered networks +- Querying network connection information based on the data network +- Resolving the domain name of a network to obtain all IP addresses + +The following describes the development procedure specific to each application scenario. +## Available APIs +For the complete list of APIs and example code, see [Network Connection Management](../reference/apis/js-apis-net-connection.md). + +| Type| API| Description| +| ---- | ---- | ---- | +| ohos.net.connection | function getDefaultNet(callback: AsyncCallback\): void; |Creates a **NetHandle** object that contains the **netId** of the default network. This API uses an asynchronous callback to return the result.| +| ohos.net.connection | function getGlobalHttpProxy10+(callback: AsyncCallback\): void;| Obtains the global HTTP proxy for the network. This API uses an asynchronous callback to return the result.| +| ohos.net.connection | function setGlobalHttpProxy10+(httpProxy: HttpProxy, callback: AsyncCallback): void;| Sets the global HTTP proxy for the network. This API uses an asynchronous callback to return the result.| +| ohos.net.connection | function getAppNet9+(callback: AsyncCallback\): void;| Obtains a **NetHandle** object that contains the **netId** of the network bound to the application. This API uses an asynchronous callback to return the result.| +| ohos.net.connection | function setAppNet9+(netHandle: NetHandle, callback: AsyncCallback\): void;| Binds an application to the specified network. The application can access the external network only through this network. This API uses an asynchronous callback to return the result.| +| ohos.net.connection | function getDefaultNetSync9+(): NetHandle; |Obtains the default active data network in synchronous mode. You can use **getNetCapabilities** to obtain information such as the network type and capabilities.| +| ohos.net.connection | function hasDefaultNet(callback: AsyncCallback\): void; |Checks whether the default network is available. This API uses an asynchronous callback to return the result.| +| ohos.net.connection | function getAllNets(callback: AsyncCallback\>): void;| Obtains the list of **NetHandle** objects of the connected network. This API uses an asynchronous callback to return the result.| +| ohos.net.connection | function getConnectionProperties(netHandle: NetHandle, callback: AsyncCallback\): void; |Obtains link information of the default network. This API uses an asynchronous callback to return the result.| +| ohos.net.connection | function getNetCapabilities(netHandle: NetHandle, callback: AsyncCallback\): void; |Obtains the capability set of the default network. This API uses an asynchronous callback to return the result.| +| ohos.net.connection | function isDefaultNetMetered9+(callback: AsyncCallback): void; |Checks whether the data traffic usage on the current network is metered. This API uses an asynchronous callback to return the result.| +| ohos.net.connection | function reportNetConnected(netHandle: NetHandle, callback: AsyncCallback\): void;| Reports a **netAavailable** event to NetManager. If this API is called, the application considers that its network status (ohos.net.connection.NetCap.NET_CAPABILITY_VAILDATED) is inconsistent with that of NetManager. This API uses an asynchronous callback to return the result.| +| ohos.net.connection | function reportNetDisconnected(netHandle: NetHandle, callback: AsyncCallback\): void;| Reports a **netAavailable** event to NetManager. If this API is called, the application considers that its network status (ohos.net.connection.NetCap.NET_CAPABILITY_VAILDATED) is inconsistent with that of NetManager. This API uses an asynchronous callback to return the result.| +| ohos.net.connection | function getAddressesByName(host: string, callback: AsyncCallback\>): void; |Obtains all IP addresses of the specified network by resolving the domain name. This API uses an asynchronous callback to return the result.| +| ohos.net.connection | function enableAirplaneMode(callback: AsyncCallback\): void; | Enables the airplane mode. This API uses an asynchronous callback to return the result.| +| ohos.net.connection | function disableAirplaneMode(callback: AsyncCallback\): void;| Disables the airplane mode. This API uses an asynchronous callback to return the result.| +| ohos.net.connection | function createNetConnection(netSpecifier?: NetSpecifier, timeout?: number): NetConnection; | Creates a **NetConnection** object. **netSpecifier** specifies the network, and **timeout** specifies the timeout interval in ms. **timeout** is configurable only when **netSpecifier** is specified. If neither of them is present, the default network is used.| +| ohos.net.connection.NetHandle | bindSocket(socketParam: TCPSocket \| UDPSocket, callback: AsyncCallback\): void; | Binds a **TCPSocket** or **UDPSocket** to the current network. This API uses an asynchronous callback to return the result.| +| ohos.net.connection.NetHandle | getAddressesByName(host: string, callback: AsyncCallback\>): void; |Obtains all IP addresses of the default network by resolving the domain name. This API uses an asynchronous callback to return the result.| +| ohos.net.connection.NetHandle | getAddressByName(host: string, callback: AsyncCallback\): void; |Obtains an IP address of the specified network by resolving the domain name. This API uses an asynchronous callback to return the result.| +| ohos.net.connection.NetConnection | on(type: 'netAvailable', callback: Callback\): void; |Subscribes to **netAvailable** events.| +| ohos.net.connection.NetConnection | on(type: 'netCapabilitiesChange', callback: Callback\<{ netHandle: NetHandle, netCap: NetCapabilities }>): void; |Subscribes to **netCapabilitiesChange** events.| +| ohos.net.connection.NetConnection | on(type: 'netConnectionPropertiesChange', callback: Callback\<{ netHandle: NetHandle, connectionProperties: ConnectionProperties }>): void; |Subscribes to **netConnectionPropertiesChange** events.| +| ohos.net.connection.NetConnection | on(type: 'netBlockStatusChange', callback: Callback<{ netHandle: NetHandle, blocked: boolean }>): void; |Subscribes to **netBlockStatusChange** events.| +| ohos.net.connection.NetConnection | on(type: 'netLost', callback: Callback\): void; |Subscribes to **netLost** events.| +| ohos.net.connection.NetConnection | on(type: 'netUnavailable', callback: Callback\): void; |Subscribes to **netUnavailable** events.| +| ohos.net.connection.NetConnection | register(callback: AsyncCallback\): void; |Registers an observer for the default network or the network specified in **createNetConnection**.| +| ohos.net.connection.NetConnection | unregister(callback: AsyncCallback\): void; |Unregisters the observer for the default network or the network specified in **createNetConnection**.| + +## Subscribing to Status Changes of the Specified Network + +1. Import the connection namespace from **@ohos.net.connection.d.ts**. + +2. Call **createNetConnection()** to create a **NetConnection** object. You can specify the network type, capability, and timeout interval. If you do not specify parameters, the default values will be used. + +3. Call **conn.on()** to subscribe to the target event. You must pass in **type** and **callback**. + +4. Call **conn.register()** to subscribe to network status changes of the specified network. + +5. When the network is available, the callback will be invoked to return the **netAvailable** event. When the network is unavailable, the callback will be invoked to return the **netUnavailable** event. + +6. Call **conn.unregister()** to unsubscribe from the network status changes if required. + +```js + // Import the connection namespace. + import connection from '@ohos.net.connection' + + let netCap = { + // Assume that the default network is Wi-Fi. If you need to create a cellular network connection, set the network type to CELLULAR. + bearerTypes: [connection.NetBearType.BEARER_CELLULAR], + // Set the network capability to INTERNET. + networkCap: [connection.NetCap.NET_CAPABILITY_INTERNET], + }; + let netSpec = { + netCapabilities: netCap, + }; + + // Set the timeout value to 10s. The default value is 0. + let timeout = 10 * 1000; + + // Create a NetConnection object. + let conn = connection.createNetConnection(netSpec, timeout); + + // Listen to network status change events. If the network is available, an on_netAvailable event is returned. + conn.on('netAvailable', (data=> { + console.log("net is available, netId is " + data.netId); + })); + + // Listen to network status change events. If the network is unavailable, an on_netUnavailable event is returned. + conn.on('netUnavailable', (data=> { + console.log("net is unavailable, netId is " + data.netId); + })); + + // Register an observer for network status changes. + conn.register((err, data) => {}); + + // Unregister the observer for network status changes. + conn.unregister((err, data) => {}); +``` + +## Obtaining the List of All Registered Networks + +### How to Develop + +1. Import the connection namespace from **@ohos.net.connection.d.ts**. + +2. Call **getAllNets** to obtain the list of all connected networks. + +```js + // Import the connection namespace. + import connection from '@ohos.net.connection' + + // Obtain the list of all connected networks. + connection.getAllNets((err, data) => { + console.log(JSON.stringify(err)); + console.log(JSON.stringify(data)); + if (data) { + this.netList = data; + } + }) +``` + +## Querying Network Capability Information and Connection Information of Specified Data Network + +### How to Develop + +1. Import the connection namespace from **@ohos.net.connection.d.ts**. + +2. Call **getDefaultNet** to obtain the default data network via **NetHandle** or call **getAllNets** to obtain the list of all connected networks via **Array\**. + +3. Call **getNetCapabilities** to obtain the network capability information of the data network specified by **NetHandle**. The capability information includes information such as the network type (cellular, Wi-Fi, or Ethernet network) and the specific network capabilities. + +4. Call **getConnectionProperties** to obtain the connection information of the data network specified by **NetHandle**. + +```js + // Import the connection namespace. + import connection from '@ohos.net.connection' + + // Call getDefaultNet to obtain the default data network specified by **NetHandle**. + connection.getDefaultNet((err, data) => { + console.log(JSON.stringify(err)); + console.log(JSON.stringify(data)); + if (data) { + this.netHandle = data; + } + }) + + // Obtain the network capability information of the data network specified by **NetHandle**. The capability information includes information such as the network type and specific network capabilities. + connection.getNetCapabilities(this.netHandle, (err, data) => { + console.log(JSON.stringify(err)); + + // Obtain the network type via bearerTypes. + for (let item of data.bearerTypes) { + if (item == 0) { + // Cellular network + console.log(JSON.stringify("BEARER_CELLULAR")); + } else if (item == 1) { + // Wi-Fi network + console.log(JSON.stringify("BEARER_WIFI")); + } else if (item == 3) { + // Ethernet network + console.log(JSON.stringify("BEARER_ETHERNET")); + } + } + + // Obtain the specific network capabilities via networkCap. + for (let item of data.networkCap) { + if (item == 0) { + // The network can connect to the carrier's Multimedia Messaging Service Center (MMSC) to send and receive multimedia messages. + console.log(JSON.stringify("NET_CAPABILITY_MMS")); + } else if (item == 11) { + // The network traffic is not metered. + console.log(JSON.stringify("NET_CAPABILITY_NOT_METERED")); + } else if (item == 12) { + // The network has the Internet access capability, which is set by the network provider. + console.log(JSON.stringify("NET_CAPABILITY_INTERNET")); + } else if (item == 15) { + // The network does not use a Virtual Private Network (VPN). + console.log(JSON.stringify("NET_CAPABILITY_NOT_VPN")); + } else if (item == 16) { + // The Internet access capability of the network is successfully verified by the connection management module. + console.log(JSON.stringify("NET_CAPABILITY_VALIDATED")); + } + } + }) + + // Obtain the connection information of the data network specified by NetHandle. Connection information includes link and route information. + connection.getConnectionProperties(this.netHandle, (err, data) => { + console.log(JSON.stringify(err)); + console.log(JSON.stringify(data)); + }) + + // Call getAllNets to obtain the list of all connected networks via Array. + connection.getAllNets((err, data) => { + console.log(JSON.stringify(err)); + console.log(JSON.stringify(data)); + if (data) { + this.netList = data; + } + }) + + for (let item of this.netList) { + // Obtain the network capability information of the network specified by each netHandle on the network list cyclically. + connection.getNetCapabilities(item, (err, data) => { + console.log(JSON.stringify(err)); + console.log(JSON.stringify(data)); + }) + + // Obtain the connection information of the network specified by each netHandle on the network list cyclically. + connection.getConnectionProperties(item, (err, data) => { + console.log(JSON.stringify(err)); + console.log(JSON.stringify(data)); + }) + } +``` + +## Resolving the domain name of a network to obtain all IP addresses + +### How to Develop + +1. Import the connection namespace from **@ohos.net.connection.d.ts**. + +2. Call **getAddressesByName** to use the default network to resolve the host name to obtain the list of all IP addresses. + +```js + // Import the connection namespace. + import connection from '@ohos.net.connection' + + // Use the default network to resolve the host name to obtain the list of all IP addresses. + connection.getAddressesByName(this.host, (err, data) => { + console.log(JSON.stringify(err)); + console.log(JSON.stringify(data)); + }) +``` diff --git a/en/application-dev/connectivity/net-ethernet.md b/en/application-dev/connectivity/net-ethernet.md new file mode 100644 index 0000000000000000000000000000000000000000..85c4ef4fc15f4c2228eb8351ddb5cd730ff5fe94 --- /dev/null +++ b/en/application-dev/connectivity/net-ethernet.md @@ -0,0 +1,140 @@ +# Ethernet Connection + +## Introduction +The Ethernet Connection module allows a device to access the Internet through a network cable. +After a device is connected to the Ethernet through a network cable, the device can obtain a series of network attributes, such as the dynamically allocated IP address, subnet mask, gateway, and DNS. You can manually configure and obtain the network attributes of the device in static mode. + +> **NOTE** +> To maximize the application running efficiency, most API calls are called asynchronously in callback or promise mode. The following code examples use the callback mode. For details about the APIs, see [sms API Reference](../reference/apis/js-apis-net-ethernet.md). + +## **Constraints** +- Programming language: C++ and JS +- System: Linux kernel +- 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. + +## When to Use +Typical application scenarios of Ethernet connection are as follows: +- Dynamically assigning a series of network attributes, such as the IP address, subnet mask, gateway, and DNS in DHCP mode to enable network access +- Configuring a series of network attributes, such as the IP address, subnet mask, gateway, and DNS, in static mode to enable network access. + +The following describes the development procedure specific to each application scenario. + +## Available APIs +For the complete list of APIs and example code, see [Ethernet Connection](../reference/apis/js-apis-net-ethernet.md). + +| Type| API| Description| +| ---- | ---- | ---- | +| ohos.net.ethernet | function setIfaceConfig(iface: string, ic: InterfaceConfiguration, callback: AsyncCallback\): void | Configures the network attributes of the specified Ethernet network. This API uses an asynchronous callback to return the result.| +| ohos.net.ethernet | function getIfaceConfig(iface: string, callback: AsyncCallback\): void | Obtains the network attributes of the specified Ethernet network. This API uses an asynchronous callback to return the result.| +| ohos.net.ethernet | function isIfaceActive(iface: string, callback: AsyncCallback\): void | Checks whether the specified network port is active. This API uses an asynchronous callback to return the result.| +| ohos.net.ethernet | function getAllActiveIfaces(callback: AsyncCallback\>): void; | Obtains the list of all active network ports. This API uses an asynchronous callback to return the result.| + +## Ethernet Connection – DHCP Mode + +1. Use a network cable to connect the device to a network port. +2. Import the **ethernet** namespace from **@ohos.net.ethernet**. +3. Call **getAllActiveIfaces** to obtain the list of all active network ports, for example, **eth0** and **eth1**. +4. Call **isIfaceActive** in user mode to check whether the **eth0** port is active. +5. Call **getIfaceConfig** in user mode to obtain the static network attributes of the **eth0** port. By default, an unconfigured Ethernet network uses the DHCP mode, in which the Ethernet network obtains the automatically assigned network attributes. + +```js + // Import the ethernet namespace from @ohos.net.ethernet. + import ethernet from '@ohos.net.ethernet' + + // Call getAllActiveIfaces to obtain the list of all active network ports. + ethernet.getAllActiveIfaces((error, data) => { + if (error) { + console.log("getAllActiveIfaces callback error = " + error); + } else { + console.log("getAllActiveIfaces callback data.length = " + data.length); + for (let i = 0; i < data.length; i++) { + console.log("getAllActiveIfaces callback = " + data[i]); + } + } + }); + + // Call isIfaceActive to check whether the specified network port is active. + ethernet.isIfaceActive("eth0", (error, data) => { + if (error) { + console.log("isIfaceActive callback error = " + error); + } else { + console.log("isIfaceActive callback = " + data); + } + }); + + // Call getIfaceConfig to obtain the network attributes of the specified Ethernet network. + ethernet.getIfaceConfig("eth0", (error, data) => { + if (error) { + console.log("getIfaceConfig callback error = " + error); + } else { + console.log("getIfaceConfig callback mode = " + data.mode); + console.log("getIfaceConfig callback ipAddr = " + data.ipAddr); + console.log("getIfaceConfig callback routeAddr = " + data.routeAddr); + console.log("getIfaceConfig callback gateAddr = " + data.gateAddr); + console.log("getIfaceConfig callback maskAddr = " + data.maskAddr); + console.log("getIfaceConfig callback dns0Addr = " + data.dns0Addr); + console.log("getIfaceConfig callback dns1Addr = " + data.dns1Addr); + } + }); +``` +## Ethernet Connection – Static Mode + +### How to Develop + +1. Use a network cable to connect the device to a network port. +2. Import the **ethernet** namespace from **@ohos.net.ethernet**. +3. Call **getAllActiveIfaces** in user mode to obtain the list of all active network ports, for example, **eth0** and **eth1**. +4. Call **isIfaceActive** in user mode to check whether the **eth0** port is active. +5. Call **setIfaceConfig** in user mode to set the **eth0** port to the static mode, in which you need to manually assign the network attributes (including the IP address, subnet mask, gateway, and DNS). +6. Call **getIfaceConfig** in user mode to obtain the static network attributes of the **eth0** port. + +```js + // Import the ethernet namespace from @ohos.net.ethernet. + import ethernet from '@ohos.net.ethernet' + + // Call getAllActiveIfaces to obtain the list of all active network ports. + ethernet.getAllActiveIfaces((error, data) => { + if (error) { + console.log("getAllActiveIfaces callback error = " + error); + } else { + console.log("getAllActiveIfaces callback data.length = " + data.length); + for (let i = 0; i < data.length; i++) { + console.log("getAllActiveIfaces callback = " + data[i]); + } + } + }); + + // Call isIfaceActive to check whether the specified network port is active. + ethernet.isIfaceActive("eth0", (error, data) => { + if (error) { + console.log("isIfaceActive callback error = " + error); + } else { + console.log("isIfaceActive callback = " + data); + } + }); + + // Call setIfaceConfig to configure the network attributes of the specified Ethernet network. + ethernet.setIfaceConfig("eth0", {mode:ethernet.STATIC,ipAddr:"192.168.xx.xx", routeAddr:"192.168.xx.xx", + gateAddr:"192.168.xx.xx", maskAddr:"255.255.xx.xx", dnsAddr0:"1.1.xx.xx", dnsAddr1:"2.2.xx.xx"},(error) => { + if (error) { + console.log("setIfaceConfig callback error = " + error); + } else { + console.log("setIfaceConfig callback ok "); + } + }); + + // Call getIfaceConfig to obtain the network attributes of the specified Ethernet network. + ethernet.getIfaceConfig("eth0", (error, data) => { + if (error) { + console.log("getIfaceConfig callback error = " + error); + } else { + console.log("getIfaceConfig callback mode = " + data.mode); + console.log("getIfaceConfig callback ipAddr = " + data.ipAddr); + console.log("getIfaceConfig callback routeAddr = " + data.routeAddr); + console.log("getIfaceConfig callback gateAddr = " + data.gateAddr); + console.log("getIfaceConfig callback maskAddr = " + data.maskAddr); + console.log("getIfaceConfig callback dns0Addr = " + data.dns0Addr); + console.log("getIfaceConfig callback dns1Addr = " + data.dns1Addr); + } + }); +``` diff --git a/en/application-dev/connectivity/net-mgmt-overview.md b/en/application-dev/connectivity/net-mgmt-overview.md index 3c8eeb552b811344396afcc6e5316e5daa24ee8b..0ad30c35cc9b4d5e90b2c8fe90cac7ca2e413a57 100644 --- a/en/application-dev/connectivity/net-mgmt-overview.md +++ b/en/application-dev/connectivity/net-mgmt-overview.md @@ -2,15 +2,19 @@ Network management functions include: -- [HTTP Data Request](http-request.md): Initiates a data request through HTTP. -- [WebSocket Connection](websocket-connection.md): Establishes a bidirectional connection between the server and client through WebSocket. -- [Socket Connection](socket-connection.md): Transmits data through Socket. +- [HTTP data request](http-request.md): Initiates a data request through HTTP. +- [WebSocket connection](websocket-connection.md): Establishes a bidirectional connection between the server and client through WebSocket. +- [Socket connection](socket-connection.md): Transmits data through Socket. +- [Network policy management](net-policy-management.md): Restricts network capabilities by setting network policies, including cellular network policy, sleep/power-saving mode policy, and background network policy, and resets network policies as needed. +- [Network sharing](net-sharing.md): Shares a device's Internet connection with other connected devices by means of Wi-Fi hotspot, Bluetooth, and USB sharing, and queries the network sharing state and shared mobile data volume. +- [Ethernet connection](net-ethernet.md): Provides wired network capabilities, which allow you to set the IP address, subnet mask, gateway, and Domain Name System (DNS) server of a wired network. +- [Network connection management](net-connection-manager.md): Provides basic network management capabilities, including management of Wi-Fi/cellular/Ethernet connection priorities, network quality evaluation, subscription to network connection status changes, query of network connection information, and DNS resolution. ## Constraints To use the functions of the network management module, you must obtain the permissions listed in the following table. -| Permission | Description | +| Permission | Description | | -------------------------------- | -------------------------------------- | | ohos.permission.GET_NETWORK_INFO | Allows an application to obtain the network connection information. | | ohos.permission.SET_NETWORK_INFO | Allows an application to modify the network connection state. | diff --git a/en/application-dev/connectivity/net-policy-management.md b/en/application-dev/connectivity/net-policy-management.md new file mode 100644 index 0000000000000000000000000000000000000000..6450bd671e565fdffafb7eeed499e123893a45a3 --- /dev/null +++ b/en/application-dev/connectivity/net-policy-management.md @@ -0,0 +1,402 @@ +# Network Policy Management + +## Introduction + +The Network Policy Management module allows you to restrict network capabilities by setting network policies, including cellular network policy, sleep/power-saving mode policy, and background network policy, and to reset network policies as needed. + +> **NOTE** +> To maximize the application running efficiency, most API calls are called asynchronously in callback or promise mode. The following code examples use the callback mode. For details about the APIs, see [sms API Reference](../reference/apis/js-apis-net-policy.md). + +## Basic Concepts + +- Sleep mode: A mode in which the system shuts down some idle components and peripherals to enter the low-power mode and restricts some applications from accessing the network. +- Power-saving mode: A mode in which the system disables certain functions and features to save power. When this mode is enabled, the system performance deteriorates and some applications are restricted from accessing the network. +- Traffic-saving mode: A mode in which the system restricts background applications that use the metering network. It is equivalent to the background network policy. +- Cellular network: A mobile communication network. +- Metering network: A mobile network with preconfigured traffic quota, WLAN network, or Ethernet network. + +## **Constraints** + +- Programming language: C++ and JS +- System: Linux kernel +- 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. + +## When to Use + +Typical application scenarios of network policy management are as follows: + +- Managing the metering network policy: Set the metering network quota and obtain the configured metering network policy. +- Managing network access for an application in the background: Set and obtain the status of the background network restriction switch, and check whether the application indicated by the specified UID can access the network in the background. +- Managing the metering network access policy: Set and obtain the policy for the application indicated by the specified UID to access the metering network, and obtain the UIDs of the applications for which the policy is configured. +- Restoring network policies +- Checking whether an application indicated by the specified UID can access a metering or non-metering network +- Adding a UID to or removing a UID from the sleep mode allowlist, and obtaining the sleep mode allowlist +- Adding a UID to or removing a UID from the power-saving mode allowlist, and obtaining the power-saving mode allowlist +- Updating the network notification policy + +The following describes the development procedure specific to each application scenario. + +## Available APIs + +For the complete list of APIs and example code, see [Network Policy Management](../reference/apis/js-apis-net-policy.md). + +| Type| API| Description| +| ---- | ---- | ---- | +| ohos.net.policy | function setBackgroundPolicy(isAllowed: boolean, callback: AsyncCallback\): void |Sets a background network policy. This API uses an asynchronous callback to return the result.| +| ohos.net.policy | function isBackgroundAllowed(callback: AsyncCallback\): void; |Obtains the background network policy. This API uses an asynchronous callback to return the result.| +| ohos.net.policy | function setPolicyByUid(uid: number, policy: NetUidPolicy, callback: AsyncCallback\): void; |Sets an application-specific network policy by **uid**. This API uses an asynchronous callback to return the result.| +| ohos.net.policy | function getPolicyByUid(uid: number, callback: AsyncCallback\): void;| Obtains an application-specific network policy by **uid**. This API uses an asynchronous callback to return the result.| +| ohos.net.policy | function getUidsByPolicy(policy: NetUidPolicy, callback: AsyncCallback\>): void; | Obtains the UID array of applications configured with a certain application-specific network policy. This API uses an asynchronous callback to return the result.| +| ohos.net.policy | function getNetQuotaPolicies(callback: AsyncCallback\>): void; |Obtains the network quota policies. This API uses an asynchronous callback to return the result.| +| ohos.net.policy | function setNetQuotaPolicies(quotaPolicies: Array\, callback: AsyncCallback\): void; |Sets an array of network quota policies. This API uses an asynchronous callback to return the result.| +| ohos.net.policy | function restoreAllPolicies(iccid: string, callback: AsyncCallback\): void; | Restores all the policies (cellular network, background network, firewall, and application-specific network policies) for the given SIM card. This API uses an asynchronous callback to return the result.| +| ohos.net.policy | function isUidNetAllowed(uid: number, isMetered: boolean, callback: AsyncCallback\): void; | Checks whether an application is allowed to access metering or non-metering networks. This API uses an asynchronous callback to return the result.| +| ohos.net.policy | function isUidNetAllowed(uid: number, iface: string, callback: AsyncCallback\): void; | Checks whether an application is allowed to access the given network. This API uses an asynchronous callback to return the result.| +| ohos.net.policy | function setDeviceIdleAllowList(uid: number, isAllowed: boolean, callback: AsyncCallback\): void; | Sets whether to add an application to the device idle allowlist. This API uses an asynchronous callback to return the result.| +| ohos.net.policy | function getDeviceIdleAllowList(callback: AsyncCallback\>): void; | Obtains the UID array of applications that are on the device idle allowlist. This API uses an asynchronous callback to return the result.| +| ohos.net.policy | function getBackgroundPolicyByUid(uid: number, callback: AsyncCallback\): void; | Obtains the background network policies configured for the given application. This API uses an asynchronous callback to return the result.| +| ohos.net.policy | function resetPolicies(iccid: string, callback: AsyncCallback\): void; | Restores all the policies (cellular network, background network, firewall, and application-specific network policies) for the given SIM card. This API uses an asynchronous callback to return the result.| +| ohos.net.policy | function updateRemindPolicy(netType: NetBearType, iccid: string, remindType: RemindType, callback: AsyncCallback\): void; | Updates a reminder policy. This API uses an asynchronous callback to return the result.| +| ohos.net.policy | function setPowerSaveAllowList(uid: number, isAllowed: boolean, callback: AsyncCallback\): void; | Sets whether to add an application to the power-saving allowlist. This API uses an asynchronous callback to return the result.| +| ohos.net.policy | function getPowerSaveAllowList(callback: AsyncCallback\>): void; | Obtains the UID array of applications that are on the power-saving allowlist. This API uses an asynchronous callback to return the result.| +| ohos.net.policy | function on(type: "netUidPolicyChange", callback: Callback\<{ uid: number, policy: NetUidPolicy }>): void; | Subscribes to policy changes. This API uses an asynchronous callback to return the result.| +| ohos.net.policy | function off(type: "netUidPolicyChange", callback: Callback\<{ uid: number, policy: NetUidPolicy }>): void; | Unsubscribes from policy changes. This API uses an asynchronous callback to return the result.| +| ohos.net.policy | function on(type: "netUidRuleChange", callback: Callback\<{ uid: number, rule: NetUidRule }>): void; | Subscribes to rule changes. This API uses an asynchronous callback to return the result.| +| ohos.net.policy | function off(type: "netUidRuleChange", callback: Callback\<{ uid: number, rule: NetUidRule }>): void; | Unsubscribes from rule changes. This API uses an asynchronous callback to return the result.| +| ohos.net.policy | function on(type: "netMeteredIfacesChange", callback: Callback\>): void; | Subscribes to metered **iface** changes. This API uses an asynchronous callback to return the result.| +| ohos.net.policy | function off(type: "netMeteredIfacesChange", callback: Callback\>): void; | Unsubscribes from metered **iface** changes. This API uses an asynchronous callback to return the result.| +| ohos.net.policy | function on(type: "netQuotaPolicyChange", callback: Callback\>): void; | Subscribes to network quota policy changes. This API uses an asynchronous callback to return the result.| +| ohos.net.policy | function off(type: "netQuotaPolicyChange", callback: Callback\>): void; | Unsubscribes from network quota policy changes. This API uses an asynchronous callback to return the result.| +| ohos.net.policy | function on(type: "netBackgroundPolicyChange", callback: Callback\): void; | Subscribes to background network policy changes. This API uses an asynchronous callback to return the result.| +| ohos.net.policy | function off(type: "netBackgroundPolicyChange", callback: Callback\): void; | Unsubscribes from background network policy changes. This API uses an asynchronous callback to return the result.| + +## Managing the Metering Network Policy + +1. Import the **policy** namespace from **@ohos.net.policy.d.ts**. + +2. Call **setNetQuotaPolicies** to configure the metering network policy. + +3. Call **getNetQuotaPolicies** to obtain the configured metering network policy. + +```js + // Import the policy namespace. + import policy from '@ohos.net.policy'; + + addNetQuotaPolicy(){ + let param = { + // For details about the value of netType, see [NetBearType](../reference/apis/js-apis-net-connection.md#netbeartype). + netType:Number.parseInt(this.netType), + + // Integrated circuit card identifier (ICCID) of the SIM card on the metering cellular network. It is not available for an Ethernet or Wi-Fi network. + iccid:this.iccid, + + // Used together with ICCID on the metering cellular network. It is used independently on an Ethernet or Wi-Fi network. + ident:this.ident, + + // Metering start time, for example, M1, D1, and Y1. + periodDuration:this.periodDuration, + + // Set the traffic threshold for generating an alarm to an integer greater than 0. + warningBytes:Number.parseInt(this.warningBytes), + + // Set the traffic quota to an integer greater than 0. + limitBytes:Number.parseInt(this.limitBytes), + + // Specify whether the network is a metering network. The value true means a metering network and false means a non-metering network. + metered:Boolean(Number.parseInt(this.metered)),https://gitee.com/openharmony/docs/pulls/14404 + // For details about the action triggered after the traffic limit is reached, see [LimitAction](../reference/apis/js-apis-net-policy.md#limitaction). + limitAction:Number.parseInt(this.limitAction) + }; + this.netQuotaPolicyList.push(param); + }, + + // Subscribe to metered iface changes. + policy.on('netMeteredIfacesChange', (data) => { + this.log('on netMeteredIfacesChange: ' + JSON.stringify(data)); + }); + + // Subscribe to metering network policy changes. + policy.on('netQuotaPolicyChange', (data) => { + this.log('on netQuotaPolicyChange: ' + JSON.stringify(data)); + }); + + // Call setNetQuotaPolicies to configure the metering network policy. + setNetQuotaPolicies(){ + this.dialogType = DialogType.HIDE; + policy.setNetQuotaPolicies(this.netQuotaPolicyList, (err, data) => { + console.log(JSON.stringify(err)); + console.log(JSON.stringify(data)); + }); + }, + + // Call getNetQuotaPolicies to obtain the configured metering network policy. + getNetQuotaPolicies(){ + policy.getNetQuotaPolicies((err, data) => { + this.callBack(err, data); + if(data){ + this.netQuotaPolicyList = data; + } + }); + }, + + // Unsubscribe from metered iface changes. + policy.off('netMeteredIfacesChange', (data) => { + this.log('off netMeteredIfacesChange: ' + JSON.stringify(data)); + }); + + // Unsubscribe from metering network policy changes. + policy.off('netQuotaPolicyChange', (data) => { + this.log('off netQuotaPolicyChange: ' + JSON.stringify(data)); + }); +``` + +## Managing Network Access for an Application in the Background + +### How to Develop + +1. Import the **policy** namespace from **@ohos.net.policy.d.ts**. + +2. Call **setBackgroundAllowed** to enable or disable the background network restriction switch. + +3. Call **isBackgroundAllowed** to check whether the background network restriction switch is enabled or disabled. + +4. Call **getBackgroundPolicyByUid** to check whether the application indicated b the specified UID can access the network in the background. + +```js + // Import the policy namespace. + import policy from '@ohos.net.policy' + + // Subscribe to background network policy changes. + policy.on('netBackgroundPolicyChange', (data) => { + this.log('on netBackgroundPolicyChange: ' + JSON.stringify(data)); + }); + + // Call setBackgroundAllowed to enable or disable the background network restriction switch. + setBackgroundAllowed() { + policy.setBackgroundAllowed(Boolean(Number.parseInt(this.isBoolean)), (err, data) => { + console.log(JSON.stringify(err)); + console.log(JSON.stringify(data)) + }); + }, + + // Call isBackgroundAllowed to check whether the background network restriction switch is enabled or disabled. + isBackgroundAllowed() { + policy.isBackgroundAllowed((err, data) => { + console.log(JSON.stringify(err)); + console.log(JSON.stringify(data)) + }); + }, + + // Call getBackgroundPolicyByUid to check whether the application indicated b the specified UID can access the network in the background. + getBackgroundPolicyByUid() { + policy.getBackgroundPolicyByUid(Number.parseInt(this.firstParam), (err, data) => { + console.log(JSON.stringify(err)); + console.log(JSON.stringify(data)) + }); + }, + + // Unsubscribe from background network policy changes. + policy.off('netBackgroundPolicyChange', (data) => { + this.log('off netBackgroundPolicyChange: ' + JSON.stringify(data)); + }); +``` + +## Managing the Metering Network Access Policy + +### How to Develop + +1. Import the **policy** namespace from **@ohos.net.policy.d.ts**. + +2. Call **setPolicyByUid** to set whether the application indicated by the specified UID can access the network in the background. + +3. Call **getPolicyByUid** to check whether the metering network access policy for the application indicated by the specified UID. + +4. Call **getUidsByPolicy** to obtain the UIDs of the applications for which the metering network access policy is configured. + +```js + // Import the policy namespace. + import policy from '@ohos.net.policy' + + // Subscribe to policy changes of the application indicated by the specified UID. + policy.on('netUidPolicyChange', (data) => { + this.log('on netUidPolicyChange: ' + JSON.stringify(data)); + }); + + // Subscribe to rule changes of the application indicated by the specified UID. + policy.on('netUidRuleChange', (data) => { + this.log('on netUidRuleChange: ' + JSON.stringify(data)); + }); + + // Call setPolicyByUid to set whether the application indicated by the specified UID can access the network in the background. + setPolicyByUid() { + let param = { + uid: Number.parseInt(this.firstParam), policy: Number.parseInt(this.currentNetUidPolicy) + } + policy.setPolicyByUid(Number.parseInt(this.firstParam), Number.parseInt(this.currentNetUidPolicy), (err, data) => { + console.log(JSON.stringify(err)); + console.log(JSON.stringify(data)) + }); + }, + + // Call getPolicyByUid to check whether the metering network access policy for the application indicated by the specified UID. + getPolicyByUid() { + policy.getPolicyByUid(Number.parseInt(this.firstParam), (err, data) => { + console.log(JSON.stringify(err)); + console.log(JSON.stringify(data)) + }); + }, + + // Call getUidsByPolicy to obtain the UIDs of the applications for which the metering network access policy is configured. + getUidsByPolicy(){ + policy.getUidsByPolicy(Number.parseInt(this.currentNetUidPolicy), (err, data) => { + console.log(JSON.stringify(err)); + console.log(JSON.stringify(data)) + }); + }, + + // Unsubscribe from policy changes of the application indicated by the specified UID. + policy.off('netUidPolicyChange', (data) => { + this.log('off netUidPolicyChange: ' + JSON.stringify(data)); + }); + + // Unsubscribe from rule changes of the application indicated by the specified UID. + policy.off('netUidRuleChange', (data) => { + this.log('off netUidRuleChange: ' + JSON.stringify(data)); + }); + +``` + +## Restoring Network Policies + +### How to Develop + +1. Import the **policy** namespace from **@ohos.net.policy.d.ts**. + +2. Call **restoreAllPolicies** to restore all network policies. + +```js + // Import the policy namespace. + import policy from '@ohos.net.policy' + + // Call restoreAllPolicies to restore all network policies. + restoreAllPolicies(){ + policy.restoreAllPolicies(this.firstParam, (err, data) => { + console.log(JSON.stringify(err)); + console.log(JSON.stringify(data)) + }); + }, +``` + +## Checking Access to a Metering or Non-metering Network + +### How to Develop + +1. Import the **policy** namespace from **@ohos.net.policy.d.ts**. + +2. Call **isUidNetAllowed** to check whether the UID can access the metering or non-metering network. + +```js + // Import the policy namespace. + import policy from '@ohos.net.policy' + + // Call isUidNetAllowed to check whether the application indicated by the specified UID can access the metering or non-metering network. + isUidNetAllowedIsMetered(){ + let param = { + uid: Number.parseInt(this.firstParam), isMetered: Boolean(Number.parseInt(this.isBoolean)) + } + policy.isUidNetAllowed(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean)), (err, data) => { + console.log(JSON.stringify(err)); + console.log(JSON.stringify(data)) + }); + }, +``` + +## Managing the Sleep Mode Allowlist + +### How to Develop + +1. Import the **policy** namespace from **@ohos.net.policy.d.ts**. + +2. Call **setDeviceIdleAllowList** to add a UID to or remove a UID from the sleep mode allowlist. + +3. Call **getDeviceIdleAllowList** to obtain the UIDs added to the sleep mode allowlist. + +```js + // Import the policy namespace. + import policy from '@ohos.net.policy' + + // Call setDeviceIdleAllowList to add a UID to or remove a UID from the sleep mode allowlist. + setDeviceIdleAllowList(){ + let param = { + uid: Number.parseInt(this.firstParam), isAllowed: Boolean(Number.parseInt(this.isBoolean)) + } + policy.setDeviceIdleAllowList(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean)), (err, data) => { + console.log(JSON.stringify(err)); + console.log(JSON.stringify(data)) + }); + }, + + // Call getDeviceIdleAllowList to obtain the UIDs added to the sleep mode allowlist. + getDeviceIdleAllowList(){ + policy.getDeviceIdleAllowList((err, data) => { + console.log(JSON.stringify(err)); + console.log(JSON.stringify(data)) + }); + }, +``` + +## Managing the Power-saving Mode Allowlist + +### How to Develop + +1. Import the **policy** namespace from **@ohos.net.policy.d.ts**. +2. Call **setPowerSaveAllowList** to add a UID to or remove a UID from the power-saving mode allowlist. +3. Call **getPowerSaveAllowList** to obtain the UIDs added to the power-saving mode allowlist. + +```js + // Import the policy namespace. + import policy from '@ohos.net.policy' + + // Call setPowerSaveAllowList to add a UID to or remove a UID from the power-saving mode allowlist. + setPowerSaveAllowList(){ + let param = { + uid: Number.parseInt(this.firstParam), isAllowed: Boolean(Number.parseInt(this.isBoolean)) + } + policy.setPowerSaveAllowList(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean)), (err, data) => { + console.log(JSON.stringify(err)); + console.log(JSON.stringify(data)) + }); + }, + + // Call getPowerSaveAllowList to obtain the UIDs added to the power-saving mode allowlist. + getPowerSaveAllowList(){ + policy.getPowerSaveAllowList((err, data) => { + console.log(JSON.stringify(err)); + console.log(JSON.stringify(data)) + }); + }, +``` + +## Updating the Network Notification Policy + +### How to Develop + +1. Import the **policy** namespace from **@ohos.net.policy.d.ts**. + +2. Call **updateRemindPolicy** to update the network notification policy. + +```js + // Import the policy namespace. + import policy from '@ohos.net.policy' + + // Call updateRemindPolicy to update the network notification policy. + updateRemindPolicy() { + let param = { + netType: Number.parseInt(this.netType), iccid: this.firstParam, remindType: this.currentRemindType + } + policy.updateRemindPolicy(Number.parseInt(this.netType), this.firstParam, Number.parseInt(this.currentRemindType), (err, data) => { + console.log(JSON.stringify(err)); + console.log(JSON.stringify(data)) + }); + }, +``` diff --git a/en/application-dev/connectivity/net-sharing.md b/en/application-dev/connectivity/net-sharing.md new file mode 100644 index 0000000000000000000000000000000000000000..d5bc9cf2f8817723f0f23d666c45997a6735f706 --- /dev/null +++ b/en/application-dev/connectivity/net-sharing.md @@ -0,0 +1,130 @@ +# Network Sharing + +## Introduction +The Network Sharing module allows you to share your device's Internet connection with other connected devices by means of Wi-Fi hotspot, Bluetooth, and USB sharing. It also allows you to query the network sharing state and shared mobile data volume. + +> **NOTE** +> To maximize the application running efficiency, most API calls are called asynchronously in callback or promise mode. The following code examples use the callback mode. For details about the APIs, see [sms API Reference](../reference/apis/js-apis-net-sharing.md). + +## Basic Concepts +- Wi-Fi sharing: Shares the network through a Wi-Fi hotspot. +- Bluetooth sharing: Shares the network through Bluetooth. +- USB tethering: Shares the network using a USB flash drive. + +## **Constraints** +- Programming language: C++ and JS +- System: Linux kernel +- 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. + +## When to Use +Typical network sharing scenarios are as follows: +- Enabling network sharing +- Disabling network sharing +- Obtaining the data traffic of the shared network + +The following describes the development procedure specific to each application scenario. +## Available APIs +For the complete list of APIs and example code, see [Network Sharing](../reference/apis/js-apis-net-sharing.md). + +| Type| API| Description| +| ---- | ---- | ---- | +| ohos.net.sharing | function isSharingSupported(callback: AsyncCallback\): void; | Checks whether the system supports network sharing. This API uses an asynchronous callback to return the result.| +| ohos.net.sharing | function isSharing(callback: AsyncCallback\): void; | Checks whether network sharing is active. This API uses an asynchronous callback to return the result.| +| ohos.net.sharing | function startSharing(type: SharingIfaceType, callback: AsyncCallback\): void; | Starts network sharing. This API uses an asynchronous callback to return the result.| +| ohos.net.sharing | function stopSharing(type: SharingIfaceType, callback: AsyncCallback\): void; | Stops network sharing. This API uses an asynchronous callback to return the result.| +| ohos.net.sharing | function getStatsRxBytes(callback: AsyncCallback\): void; | Obtains the received data traffic during network sharing, in KB. This API uses an asynchronous callback to return the result.| +| ohos.net.sharing | function getStatsTxBytes(callback: AsyncCallback\): void; | Obtains the sent data traffic during network sharing, in KB. This API uses an asynchronous callback to return the result.| +| ohos.net.sharing | function getStatsTotalBytes(callback: AsyncCallback\): void; | Obtains the total data traffic during network sharing, in KB. This API uses an asynchronous callback to return the result.| +| ohos.net.sharing | function getSharingIfaces(state: SharingIfaceState, callback: AsyncCallback\>): void; | Obtains the names of network interface cards (NICs) in the specified network sharing state.. This API uses an asynchronous callback to return the result.| +| ohos.net.sharing | function getSharingState(type: SharingIfaceType, callback: AsyncCallback\): void; | Obtains the network sharing state of the specified type. This API uses an asynchronous callback to return the result.| +| ohos.net.sharing | function getSharableRegexes(type: SharingIfaceType, callback: AsyncCallback\>): void; | Obtains regular expressions of NICs of a specified type. This API uses an asynchronous callback to return the result.| +| ohos.net.sharing | function on(type: 'sharingStateChange', callback: Callback\): void; | Subscribes to network sharing state changes.| +| ohos.net.sharing | function off(type: 'sharingStateChange', callback?: Callback\): void; | Unsubscribes from network sharing state changes.| +| ohos.net.sharing | unction on(type: 'interfaceSharingStateChange', callback: Callback\<{ type: SharingIfaceType, iface: string, state: SharingIfaceState }>): void; | Subscribes to network sharing state changes of the specified NIC.| +| ohos.net.sharing | function off(type: 'interfaceSharingStateChange', callback?: Callback\<{ type: SharingIfaceType, iface: string, state: SharingIfaceState }>): void; | Unsubscribes from network sharing state changes of the specified NIC.| +| ohos.net.sharing | function on(type: 'sharingUpstreamChange', callback: Callback\): void; | Subscribes to upstream NIC changes.| +| ohos.net.sharing | function off(type: 'sharingUpstreamChange', callback?: Callback\): void; | Unsubscribes from upstream NIC changes.| + +## Enabling Network Sharing + +1. Import the **sharing** namespace from **@ohos.net.sharing**. +2. Subscribe to network sharing state changes. +3. Call **startSharing** to start network sharing of the specified type. +4. Return the callback for successfully starting network sharing. + +```js + // Import the sharing namespace from @ohos.net.sharing. + import sharing from '@ohos.net.sharing' + + // Subscribe to network sharing state changes. + sharing.on('sharingStateChange', (error, data) => { + console.log(JSON.stringify(error)); + console.log(JSON.stringify(data)); + }); + + // Call startSharing to start network sharing of the specified type. + sharing.startSharing(sharing.SharingIfaceType.SHARING_WIFI, (error) => { + console.log(JSON.stringify(error)); + }); +``` + +## Disabling network sharing + +### How to Develop + +1. Import the **sharing** namespace from **@ohos.net.sharing**. +2. Subscribe to network sharing state changes. +3. Call **stopSharing** to stop network sharing of the specified type. +4. Return the callback for successfully stopping network sharing. + +```js + // Import the sharing namespace from @ohos.net.sharing. + import sharing from '@ohos.net.sharing' + + // Subscribe to network sharing state changes. + sharing.on('sharingStateChange', (error, data) => { + console.log(JSON.stringify(error)); + console.log(JSON.stringify(data)); + }); + + // Call stopSharing to stop network sharing of the specified type. + sharing.stopSharing(sharing.SharingIfaceType.SHARING_WIFI, (error) => { + console.log(JSON.stringify(error)); + }); +``` + +## Obtaining the data traffic of the shared network + +### How to Develop + +1. Import the **sharing** namespace from **@ohos.net.sharing**. +2. Call **startSharing** to start network sharing of the specified type. +3. Call **getStatsTotalBytes** to obtain the data traffic generated during data sharing. +4. Call **stopSharing** to stop network sharing of the specified type and clear the data volume of network sharing. + +```js + // Import the sharing namespace from @ohos.net.sharing. + import sharing from '@ohos.net.sharing' + + // Call startSharing to start network sharing of the specified type. + sharing.startSharing(sharing.SharingIfaceType.SHARING_WIFI, (error) => { + console.log(JSON.stringify(error)); + }); + + // Call getStatsTotalBytes to obtain the data traffic generated during data sharing. + sharing.getStatsTotalBytes((error, data) => { + console.log(JSON.stringify(error)); + console.log(JSON.stringify(data)); + }); + + // Call stopSharing to stop network sharing of the specified type and clear the data volume of network sharing. + sharing.stopSharing(sharing.SharingIfaceType.SHARING_WIFI, (error) => { + console.log(JSON.stringify(error)); + }); + + // Call getStatsTotalBytes again. The data volume of network sharing has been cleared. + sharing.getStatsTotalBytes((error, data) => { + console.log(JSON.stringify(error)); + console.log(JSON.stringify(data)); + }); +``` diff --git a/en/application-dev/connectivity/socket-connection.md b/en/application-dev/connectivity/socket-connection.md index da5bea318e2b60da5641b9cf01ee73c926802c16..5cae73b2a5c84f280aea80e299605ee80ac2553a 100644 --- a/en/application-dev/connectivity/socket-connection.md +++ b/en/application-dev/connectivity/socket-connection.md @@ -1,46 +1,83 @@ # Socket Connection +## Introduction -## Use Cases +The Socket Connection module allows an application to transmit data over a Socket connection through the TCP, UDP, or TLS protocol. -Your application can transmit data through Socket connections. Currently, the TCP and UDP protocols are supported. +## Basic Concepts +- Socket: An abstraction of endpoints for bidirectional communication between application processes running on different hosts in a network. +- TCP: Transmission Control Protocol, which is a byte stream–based transport layer communication protocol that is connection-oriented and reliable. +- UDP: User Datagram Protocol, which is a simple datagram-oriented transport layer communication protocol. +- TLS: Transport Layer Security, which is a protocol that ensures the data confidentiality and integrity between communication programs. + +## When to Use + +Applications transmit data over TCP, UDP, or TLS Socket connections. The main application scenarios are as follows: + +- Implementing data transmission over TCP/UDP Socket connections +- Implementing encrypted data transmission over TLS Socket connections ## Available APIs -The Socket connection function is mainly implemented by the Socket module. The following table describes the related APIs. +For the complete list of APIs and example code, see [Socket Connection](../reference/apis/js-apis-socket.md). -| API| Description | +Socket connection functions are mainly implemented by the **socket** module. The following table describes the related APIs. + +| API| Description| | -------- | -------- | -| constructUDPSocketInstance() | Creates a **UDPSocket** object. | -| constructTCPSocketInstance() | Creates a **TCPSocket** object. | -| bind() | Binds the IP address and port number. | +| constructUDPSocketInstance() | Creates a **UDPSocket** object.| +| constructTCPSocketInstance() | Creates a **TCPSocket** object.| +| bind() | Binds the IP address and port number.| | send() | Sends data.| -| close() | Closes a Socket connection. | -| getState() | Obtains the Socket connection status. | -| connect() | Connects to the specified IP address and port. This function is supported only for TCP. | -| getRemoteAddress() | Obtains the peer address of the Socket connection. This function is supported only for TCP. The **connect** API must have been called before you use this API. | -| on(type: 'message') | Enables listening for **message** events of the Socket connection. | -| off(type: 'message') | Disables listening for **message** events of the Socket connection. | -| on(type: 'close') | Enables listening for **close** events of the Socket connection. | -| off(type: 'close') | Disables listening for **close** events of the Socket connection. | -| on(type: 'error') | Enables listening for **error** events of the Socket connection. | -| off(type: 'error') | Disables listening for **error** events of the Socket connection. | -| on(type: 'listening') | Enables listening for **listening** events of the UDPSocket connection. | -| off(type: 'listening') | Disables listening for **listening** events of the UDPSocket connection. | -| on(type: 'connect') | Enables listening for **connect** events of the TCPSocket connection. | -| off(type: 'connect') | Disables listening for **connect** events of the TCPSocket connection. | +| close() | Closes a Socket connection.| +| getState() | Obtains the Socket connection status.| +| connect() | Connects to the specified IP address and port. This function is supported only for TCP.| +| getRemoteAddress() | Obtains the peer address of the Socket connection. This function is supported only for TCP. The **connect** API must have been called before you use this API.| +| on(type: 'message') | Subscribes to **message** events of the Socket connection.| +| off(type: 'message') | Unsubscribes from **message** events of the Socket connection.| +| on(type: 'close') | Subscribes to **close** events of the Socket connection.| +| off(type: 'close') | Unsubscribes from **close** events of the Socket connection.| +| on(type: 'error') | Subscribes to **error** events of the Socket connection.| +| off(type: 'error') | Unsubscribes from **error** events of the Socket connection.| +| on(type: 'listening') | Subscribes to **listening** events of the UDP Socket connection. | +| off(type: 'listening') | Unsubscribes from **listening** events of the UDP Socket connection. | +| on(type: 'connect') | Subscribes to **connect** events of the TCP Socket connection. | +| off(type: 'connect') | Unsubscribes from **connect** events of the TCP Socket connection.| + +TLS Socket connection functions are mainly provided by the **tls_socket** module. The following table describes the related APIs. +| API| Description| +| -------- | -------- | +| constructTLSSocketInstance() | Creates a **TLSSocket** object.| +| bind() | Binds the IP address and port number.| +| close(type: 'error') | Closes a Socket connection.| +| connect() | Sets up a connection to the specified IP address and port number.| +| getCertificate() | Obtains an object representing the local certificate.| +| getCipherSuite() | Obtains a list containing information about the negotiated cipher suite.| +| getProtocol() | Obtains a string containing the SSL/TLS protocol version negotiated for the current connection.| +| getRemoteAddress() | Obtains the peer address of the TLS Socket connection.| +| getRemoteCertificate() | Obtains an object representing a peer certificate.| +| getSignatureAlgorithms() | Obtains a list containing signature algorithms shared between the server and client, in descending order of priority.| +| getState() | Obtains the TLS Socket connection status.| +| off(type: 'close') | Unsubscribes from **close** events of the TLS Socket connection.| +| off(type: 'error') | Unsubscribes from **error** events of the TLS Socket connection.| +| off(type: 'message') | Unsubscribes from **message** events of the TLS Socket connection.| +| on(type: 'close') | Subscribes to **close** events of the TLS Socket connection.| +| on(type: 'error') | Subscribes to **error** events of the TLS Socket connection.| +| on(type: 'message') | Subscribes to **message** events of the TLS Socket connection.| +| send() | Sends data.| +| setExtraOptions() | Sets other properties of the TLS Socket connection.| -## How to Develop +## Transmitting Data over TCP/UDP Socket Connections -The implementation is similar for UDPSocket and TCPSocket. The following uses the TCPSocket as an example. +The implementation is similar for UDP Socket and TCP Socket connections. The following uses data transmission over a TCP Socket connection as an example. -1. Import the required Socket module. +1. Import the required **socket** module. 2. Create a **TCPSocket** object. -3. (Optional) Enable listening for TCPSocket events. +3. (Optional) Subscribe to TCP Socket connection events. 4. Bind the IP address and port number. The port number can be specified or randomly allocated by the system. @@ -48,15 +85,15 @@ The implementation is similar for UDPSocket and TCPSocket. The following uses th 6. Send data. -7. Enable the TCPSocket connection to be automatically closed after use. - +7. Enable the TCP Socket connection to be automatically closed after use. + ```js import socket from '@ohos.net.socket' - + // Create a TCPSocket object. let tcp = socket.constructTCPSocketInstance(); - - // Enable listening for TCPSocket events. + + // Subscribe to TCP Socket connection events. tcp.on('message', value => { console.log("on message") let buffer = value.message @@ -73,7 +110,7 @@ The implementation is similar for UDPSocket and TCPSocket. The following uses th tcp.on('close', () => { console.log("on close") }); - + // Bind the local IP address and port number. let bindAddress = { address: '192.168.xx.xx', @@ -86,6 +123,7 @@ The implementation is similar for UDPSocket and TCPSocket. The following uses th return; } console.log('bind success'); + // Set up a connection to the specified IP address and port number. let connectAddress = { address: '192.168.xx.xx', @@ -100,6 +138,7 @@ The implementation is similar for UDPSocket and TCPSocket. The following uses th return; } console.log('connect success'); + // Send data. tcp.send({ data: 'Hello, server!' @@ -112,7 +151,8 @@ The implementation is similar for UDPSocket and TCPSocket. The following uses th }) }); }); - // Enable the TCPSocket connection to be automatically closed after use. Then, disable listening for TCPSocket events. + + // Enable the TCP Socket connection to be automatically closed after use. Then, disable listening for TCP Socket connection events. setTimeout(() => { tcp.close((err) => { console.log('close socket.') @@ -122,3 +162,160 @@ The implementation is similar for UDPSocket and TCPSocket. The following uses th tcp.off('close'); }, 30 * 1000); ``` + +## Implementing Encrypted Data Transmission over TLS Socket Connections + +### How to Develop + +TLS Socket connection process on the client: + +1. Import the required **socket** module. + +2. Bind the IP address and port number of the server. + +3. For two-way authentication, upload the client CA certificate and digital certificate. For one-way authentication, upload the client CA certificate. + +4. Create a **TLSSocket** object. + +5. (Optional) Subscribe to TLS Socket connection events. + +6. Send data. + +7. Enable the TLS Socket connection to be automatically closed after use. + +```js + import socket from '@ohos.net.socket' + + // Create a TLS Socket connection (for two-way authentication). + let tlsTwoWay = socket.constructTLSSocketInstance(); + + // Subscribe to TLS Socket connection events. + tlsTwoWay.on('message', value => { + console.log("on message") + let buffer = value.message + let dataView = new DataView(buffer) + let str = "" + for (let i = 0; i < dataView.byteLength; ++i) { + str += String.fromCharCode(dataView.getUint8(i)) + } + console.log("on connect received:" + str) + }); + tlsTwoWay.on('connect', () => { + console.log("on connect") + }); + tlsTwoWay.on('close', () => { + console.log("on close") + }); + + // Bind the local IP address and port number. + tlsTwoWay.bind({address: '192.168.xxx.xxx', port: xxxx, family: 1}, err => { + if (err) { + console.log('bind fail'); + return; + } + console.log('bind success'); + }); + + // Set the communication parameters. + let options = { + ALPNProtocols: ["spdy/1", "http/1.1"], + + // Set up a connection to the specified IP address and port number. + address: { + address: "192.168.xx.xxx", + port: xxxx, // Port + family: 1, + }, + + // Set the parameters used for authentication during communication. + secureOptions: { + key: "xxxx", // Key + cert: "xxxx", // Digital certificate + ca: ["xxxx"], // CA certificate + passwd: "xxxx", // Password for generating the key + protocols: [socket.Protocol.TLSv12], // Communication protocol + useRemoteCipherPrefer: true, // Whether to preferentially use the peer cipher suite + signatureAlgorithms: "rsa_pss_rsae_sha256:ECDSA+SHA256", // Signature algorithm + cipherSuite: "AES256-SHA256", // Cipher suite + }, + }; + + // Set up a connection. + tlsTwoWay.connect(options, (err, data) => { + console.error(err); + console.log(data); + }); + + // Enable the TCP Socket connection to be automatically closed after use. Then, disable listening for TCP Socket connection events. + tlsTwoWay.close((err) => { + if (err) { + console.log("close callback error = " + err); + } else { + console.log("close success"); + } + tlsTwoWay.off('message'); + tlsTwoWay.off('connect'); + tlsTwoWay.off('close'); + }); + + // Create a TLS Socket connection (for one-way authentication). + let tlsOneWay = socket.constructTLSSocketInstance(); // One way authentication + + // Subscribe to TLS Socket connection events. + tlsTwoWay.on('message', value => { + console.log("on message") + let buffer = value.message + let dataView = new DataView(buffer) + let str = "" + for (let i = 0;i < dataView.byteLength; ++i) { + str += String.fromCharCode(dataView.getUint8(i)) + } + console.log("on connect received:" + str) + }); + tlsTwoWay.on('connect', () => { + console.log("on connect") + }); + tlsTwoWay.on('close', () => { + console.log("on close") + }); + + // Bind the local IP address and port number. + tlsOneWay.bind({address: '192.168.xxx.xxx', port: xxxx, family: 1}, err => { + if (err) { + console.log('bind fail'); + return; + } + console.log('bind success'); + }); + + // Set the communication parameters. + let oneWayOptions = { + address: { + address: "192.168.xxx.xxx", + port: xxxx, + family: 1, + }, + secureOptions: { + ca: ["xxxx","xxxx"], // CA certificate + cipherSuite: "AES256-SHA256", // Cipher suite + }, + }; + + // Set up a connection. + tlsOneWay.connect(oneWayOptions, (err, data) => { + console.error(err); + console.log(data); + }); + + // Enable the TCP Socket connection to be automatically closed after use. Then, disable listening for TCP Socket connection events. + tlsTwoWay.close((err) => { + if (err) { + console.log("close callback error = " + err); + } else { + console.log("close success"); + } + tlsTwoWay.off('message'); + tlsTwoWay.off('connect'); + tlsTwoWay.off('close'); + }); +``` diff --git a/en/application-dev/database/database-datashare-guidelines.md b/en/application-dev/database/database-datashare-guidelines.md index 1f25dccf2a36f3bbedb5728291e8e11b3292476e..580811158051b5b6d5d2137f4b14654a46e891b9 100644 --- a/en/application-dev/database/database-datashare-guidelines.md +++ b/en/application-dev/database/database-datashare-guidelines.md @@ -34,7 +34,7 @@ There are two roles in **DataShare**: - Data provider: adds, deletes, modifies, and queries data, opens files, and shares data. - Data consumer: accesses the data provided by the provider using **DataShareHelper**. -### Data Provider Application Development (Only for System Applications) +### Data Provider Application Development (for System Applications Only) [DataShareExtensionAbility](../reference/apis/js-apis-application-dataShareExtensionAbility.md) provides the following APIs. You can override these APIs as required. diff --git a/en/application-dev/database/database-mdds-guidelines.md b/en/application-dev/database/database-mdds-guidelines.md index b72874536b968593cbb7a3c8d5fd865eb1720b35..b84b668ce377b03561f7f7fdd3cdd6eb5fb0d796 100644 --- a/en/application-dev/database/database-mdds-guidelines.md +++ b/en/application-dev/database/database-mdds-guidelines.md @@ -13,7 +13,7 @@ For details about the APIs, see [Distributed KV Store](../reference/apis/js-apis | API | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | -| createKVManager(config: KVManagerConfig, callback: AsyncCallback<KVManager>): void
createKVManager(config: KVManagerConfig): Promise<KVManager> | Creates a **KvManager** object for database management. | +| createKVManager(config: KVManagerConfig): KVManager | Creates a **KvManager** object for database management. | | getKVStore<T extends KVStore>(storeId: string, options: Options, callback: AsyncCallback<T>): void
getKVStore<T extends KVStore>(storeId: string, options: Options): Promise<T> | Creates and obtains a 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. | | delete(key: string, callback: AsyncCallback<void>): void
delete(key: string): Promise<void> | Deletes data. | @@ -117,16 +117,10 @@ The following uses a single KV store as an example to describe the development p bundleName: 'com.example.datamanagertest', context:context, } - distributedKVStore.createKVManager(kvManagerConfig, function (err, manager) { - if (err) { - console.error(`Failed to create KVManager. code is ${err.code},message is ${err.message}`); - return; - } - console.log('Created KVManager successfully'); - kvManager = manager; - }); + kvManager = distributedKVStore.createKVManager(kvManagerConfig); + console.log("Created KVManager successfully"); } catch (e) { - console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); + console.error(`Failed to create KVManager. Code is ${e.code}, message is ${e.message}`); } ``` @@ -150,14 +144,14 @@ The following uses a single KV store as an example to describe the development p }; kvManager.getKVStore('storeId', options, function (err, store) { if (err) { - console.error(`Failed to get KVStore: code is ${err.code},message is ${err.message}`); + console.error(`Failed to get KVStore: code is ${err.code}, message is ${err.message}`); return; } console.log('Obtained KVStore successfully'); kvStore = store; }); } catch (e) { - console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred. Code is ${e.code}, message is ${e.message}`); } ``` @@ -175,7 +169,7 @@ The following uses a single KV store as an example to describe the development p console.log(`dataChange callback call data: ${data}`); }); }catch(e){ - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred. Code is ${e.code}, message is ${e.message}`); } ``` @@ -192,13 +186,13 @@ The following uses a single KV store as an example to describe the development p try { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT, function (err,data) { if (err != undefined) { - console.error(`Failed to put.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put data. Code is ${err.code}, message is ${err.message}`); return; } - console.log('Put data successfully'); + console.log("Put data successfully"); }); }catch (e) { - console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred. Code is ${e.code}, message is ${e.message}`); } ``` @@ -215,20 +209,20 @@ The following uses a single KV store as an example to describe the development p try { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT, function (err,data) { if (err != undefined) { - console.error(`Failed to put.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put data. Code is ${err.code}, message is ${err.message}`); return; } - console.log('Put data successfully'); + console.log("Put data successfully"); kvStore.get(KEY_TEST_STRING_ELEMENT, function (err,data) { if (err != undefined) { - console.error(`Failed to get data.code is ${err.code},message is ${err.message}`); + console.error(`Failed to obtain data. Code is ${err.code}, message is ${err.message}`); return; } console.log(`Obtained data successfully:${data}`); }); }); }catch (e) { - console.error(`Failed to get.code is ${e.code},message is ${e.message}`); + console.error(`Failed to obtain data. Code is ${e.code}, message is ${e.message}`); } ``` @@ -262,7 +256,7 @@ The following uses a single KV store as an example to describe the development p // 1000 indicates that the maximum delay is 1000 ms. kvStore.sync(deviceIds, distributedKVStore.SyncMode.PUSH_ONLY, 1000); } catch (e) { - console.error(`An unexpected error occurred. code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred. Code is ${e.code}, message is ${e.message}`); } } }); diff --git a/en/application-dev/database/database-preference-guidelines.md b/en/application-dev/database/database-preference-guidelines.md index e5c9faa1477565541a94076e2fb568e69b2f5cf6..724e273675061c4b6969fb3fcd6f6cbdd984a15f 100644 --- a/en/application-dev/database/database-preference-guidelines.md +++ b/en/application-dev/database/database-preference-guidelines.md @@ -114,21 +114,19 @@ You can use the following APIs to delete a **Preferences** instance or data file ```ts // Obtain the context. import UIAbility from '@ohos.app.ability.UIAbility'; - let context = null; let preferences = null; export default class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage){ - context = this.context; + onWindowStageCreate(windowStage) { + let promise = data_preferences.getPreferences(this.context, 'mystore'); + promise.then((pref) => { + preferences = pref; + }).catch((err) => { + console.info("Failed to get the preferences."); + }) } } - let promise = data_preferences.getPreferences(context, 'mystore'); - promise.then((pref) => { - preferences = pref; - }).catch((err) => { - console.info("Failed to get the preferences."); - }) ``` 3. Write data. diff --git a/en/application-dev/device/Readme-EN.md b/en/application-dev/device/Readme-EN.md index abf5154a8caa1473367960eea7b9118598ce706a..6ce8d1b16951d5fb739d97c102cb8d3be3f628d7 100644 --- a/en/application-dev/device/Readme-EN.md +++ b/en/application-dev/device/Readme-EN.md @@ -1,19 +1,21 @@ -# Device +# Device Management +- USB Service + - [USB Service Overview](usb-overview.md) + - [USB Service Development](usb-guidelines.md) - Location - [Location Service Development](location-guidelines.md) -- Multimodal Input - - [Input Device Development](inputdevice-guidelines.md) - - [Mouse Pointer Development](pointerstyle-guidelines.md) - Sensor - [Sensor Overview](sensor-overview.md) - [Sensor Development](sensor-guidelines.md) +- Vibrator + - [Vibrator Overview](vibrator-overview.md) + - [Vibrator Development](vibrator-guidelines.md) +- Multimodal Input + - [Input Device Development](inputdevice-guidelines.md) + - [Mouse Pointer Development](pointerstyle-guidelines.md) - Update Service - [Sample Server Overview](sample-server-overview.md) - [Sample Server Development](sample-server-guidelines.md) -- USB Service - - [USB Service Overview](usb-overview.md) - - [USB Service Development](usb-guidelines.md) -- Vibrator - - [Vibrator Overview](vibrator-overview.md) - - [Vibrator Development](vibrator-guidelines.md) \ No newline at end of file +- Stationary + - [Stationary Development](stationary-guidelines.md) diff --git a/en/application-dev/device/inputdevice-guidelines.md b/en/application-dev/device/inputdevice-guidelines.md index da6eef71d750b74e01d1ea8a9eaaf49b1bf598cb..c15955d9b01239605d0ce1afa9bfe5f693b22940 100644 --- a/en/application-dev/device/inputdevice-guidelines.md +++ b/en/application-dev/device/inputdevice-guidelines.md @@ -29,7 +29,6 @@ When a user enters text, the input method determines whether to launch the virtu 1. Call the **getDeviceList** API to obtain the list of connected input devices. Call the **getKeyboardType** API to traverse all connected devices to check whether a physical keyboard exists. If a physical keyboard exists, mark the physical keyboard as connected. This step ensures that your application detects all inserted input devices before listening for device hot swap events. 2. Call the **on** API to listen for device hot swap events. If a physical keyboard is inserted, mark the physical keyboard as connected. If a physical keyboard is removed, mark the physical keyboard as disconnected. -3. When a user enters text, check whether a physical keyboard is connected. If a physical keyboard is not connected, launch the virtual keyboard. ```js @@ -65,6 +64,4 @@ try { } catch (error) { console.log(`Execute failed, error: ${JSON.stringify(error, [`code`, `message`])}`); } - // 3. Determine whether to launch the virtual keyboard based on the value of isPhysicalKeyboardExist. - // TODO ``` diff --git a/en/application-dev/device/pointerstyle-guidelines.md b/en/application-dev/device/pointerstyle-guidelines.md index cecab92b282e2da7a3bb966bcedeefa84768f22e..bcc09093eed4440a0c5e62c5d4cfe37a3f954c87 100644 --- a/en/application-dev/device/pointerstyle-guidelines.md +++ b/en/application-dev/device/pointerstyle-guidelines.md @@ -15,11 +15,11 @@ import pointer from '@ohos.multimodalInput.pointer'; The following table lists the common APIs for mouse pointer management. For details about the APIs, see [ohos.multimodalInput.pointer](../reference/apis/js-apis-pointer.md). | Instance | API | Description | -| ------- | ------------------------------------------------------------ | --------------------------------------------------------------- | -| pointer | function isPointerVisible(callback: AsyncCallback\): void; | Checks the visible status of the mouse pointer. | -| pointer | function setPointerVisible(visible: boolean, callback: AsyncCallback\): void; | Sets the visible status of the mouse pointer. This setting takes effect for the mouse pointer globally. | +| ------- | ------------------------------------------------------------ | ------------------------------------------------------------ | +| pointer | function isPointerVisible(callback: AsyncCallback\): void; | Checks the visible status of the mouse pointer. | +| pointer | function setPointerVisible(visible: boolean, callback: AsyncCallback\): void; | Sets the visible status of the mouse pointer. This setting takes effect for the mouse pointer globally.| | pointer | function setPointerStyle(windowId: number, pointerStyle: PointerStyle, callback: AsyncCallback\): void; | Sets the mouse pointer style. This setting takes effect for the mouse pointer style of a specified window. | -| pointer | function getPointerStyle(windowId: number, callback: AsyncCallback\): void; | Obtains the mouse pointer style. | +| pointer | function getPointerStyle(windowId: number, callback: AsyncCallback\): void; | Obtains the mouse pointer style. | ## Hiding the Mouse Pointer @@ -77,43 +77,48 @@ When designing a color picker, you can have the mouse pointer switched to the co 5. Set the mouse pointer to the default style. ```js +import pointer from '@ohos.multimodalInput.pointer'; import window from '@ohos.window'; // 1. Enable the color pickup function. // 2. Obtain the window ID. -window.getTopWindow((error, windowClass) => { - windowClass.getProperties((error, data) => { - var windowId = data.id; - if (windowId < 0) { - console.log(`Invalid windowId`); - return; - } - try { - // 3. Set the mouse pointer to the color picker style. - pointer.setPointerStyle(windowId, pointer.PointerStyle.COLOR_SUCKER).then(() => { - console.log(`Successfully set mouse pointer style`); - }); - } catch (error) { - console.log(`Failed to set the pointer style, error=${JSON.stringify(error)}, msg=${JSON.stringify(message)}`); - } - }); +window.getLastWindow(this.context, (error, windowClass) => { + if (error.code) { + console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error)); + return; + } + var windowId = windowClass.getWindowProperties().id; + if (windowId < 0) { + console.log(`Invalid windowId`); + return; + } + try { + // 3. Set the mouse pointer to the color picker style. + pointer.setPointerStyle(windowId, pointer.PointerStyle.COLOR_SUCKER).then(() => { + console.log(`Successfully set mouse pointer style`); + }); + } catch (error) { + console.log(`Failed to set the pointer style, error=${JSON.stringify(error)}, msg=${JSON.stringify(`message`)}`); + } }); // 4. End color pickup. -window.getTopWindow((error, windowClass) => { - windowClass.getProperties((error, data) => { - var windowId = data.id; - if (windowId < 0) { - console.log(`Invalid windowId`); - return; - } - try { - // 5. Set the mouse pointer to the default style. - pointer.setPointerStyle(windowId, pointer.PointerStyle.DEFAULT).then(() => { - console.log(`Successfully set mouse pointer style`); - }); - } catch (error) { - console.log(`Failed to set the pointer style, error=${JSON.stringify(error)}, msg=${JSON.stringify(message)}`); - } - }); +window.getLastWindow(this.context, (error, windowClass) => { + if (error.code) { + console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error)); + return; + } + var windowId = windowClass.getWindowProperties().id; + if (windowId < 0) { + console.log(`Invalid windowId`); + return; + } + try { + // 5. Set the mouse pointer to the default style. + pointer.setPointerStyle(windowId, pointer.PointerStyle.DEFAULT).then(() => { + console.log(`Successfully set mouse pointer style`); + }); + } catch (error) { + console.log(`Failed to set the pointer style, error=${JSON.stringify(error)}, msg=${JSON.stringify(`message`)}`); + } }); ``` diff --git a/en/application-dev/device/stationary-guidelines.md b/en/application-dev/device/stationary-guidelines.md new file mode 100644 index 0000000000000000000000000000000000000000..9f6693027a29f48c2c434b842df74beb5209f319 --- /dev/null +++ b/en/application-dev/device/stationary-guidelines.md @@ -0,0 +1,84 @@ +# Stationary Development + + +## When to Use + +An application can call the **Stationary** module to obtain the device status, for example, whether the device is absolutely or relatively still. + +For details about the APIs, see [Stationary](../reference/apis/js-apis-stationary.md). + +## Device Status Type Parameters + +| Name| Description| +| -------- | -------- | +| still | Absolutely still.| +| relativeStill | Relatively still.| + +## Parameters for Subscribing to Device Status events + +| Name | Value | Description | +| ------------------------------ | ---- | ---------------------------------------- | +| ENTER | 1 | Event indicating entering device status. | +| EXIT | 2 | Event indicating exiting device status.| +| ENTER_EXIT | 3 | Event indicating entering and exiting device status.| + +## Returned Device Status Parameters + +| Name | Value | Description | +| ------------------------------ | ---- | ---------------------------------------- | +| ENTER | 1 | Entering device status. | +| EXIT | 2 | Exiting device status.| + +## Available APIs + +| Module | Name | Description | +| ------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | +| ohos.stationary | on(activity: ActivityType, event: ActivityEvent, reportLatencyNs: number, callback: Callback<ActivityResponse>): void | Subscribes to the device status. This API uses an asynchronous callback to return the result.| +| ohos.stationary | once(activity: ActivityType, callback: Callback<ActivityResponse>): void | Obtains the device status. This API uses an asynchronous callback to return the result.| +| ohos.stationary | off(activity: ActivityType, event: ActivityEvent, callback?: Callback<ActivityResponse>): void | Unsubscribes from the device status. | + +## Constraints + +The device must support the acceleration sensor. + +## How to Develop + +1. Subscribe to the event indicating entering the absolute still state, and the event is reported every 1 second. + + ```js + import stationary from '@ohos.stationary'; + var reportLatencyNs = 1000000000; + try { + stationary.on('still', stationary.ActivityEvent.ENTER, reportLatencyNs, (data) => { + console.log('data='+ JSON.stringify(data)); + }) + } catch (err) { + console.error('errCode: ' + err.code + ' ,msg: ' + err.message); + } + ``` + +2. Obtain the event indicating entering the absolute still state. + + ```js + import stationary from '@ohos.stationary'; + try { + stationary.once('still', (data) => { + console.log('data='+ JSON.stringify(data)); + }) + } catch (err) { + console.error('errCode: ' + err.code + ' ,msg: ' + err.message); + } + ``` + +3. Unsubscribe from the event indicating entering the absolute still state. + + ```js + import stationary from '@ohos.stationary'; + try { + stationary.off('still', stationary.ActivityEvent.ENTER, (data) => { + console.log('data='+ JSON.stringify(data)); + }) + } catch (err) { + console.error('errCode: ' + err.code + ' ,msg: ' + err.message); + } + ``` diff --git a/en/application-dev/device/usb-guidelines.md b/en/application-dev/device/usb-guidelines.md index c4f5131536a1f0b55ae973bdf7cdf04d2b8f0980..68c8c3de013e75d56854bf0cf0e3a71aca9eb261 100644 --- a/en/application-dev/device/usb-guidelines.md +++ b/en/application-dev/device/usb-guidelines.md @@ -130,8 +130,6 @@ You can set a USB device as the USB host to connect to other USB devices for dat usb.bulkTransfer(pipe, inEndpoint, dataUint8Array, 15000).then(dataLength => { if (dataLength >= 0) { console.info("usb readData result Length : " + dataLength); - let resultStr = this.ab2str(dataUint8Array); // Convert uint8 data into a string. - console.info("usb readData buffer : " + resultStr); } else { console.info("usb readData failed : " + dataLength); } diff --git a/en/application-dev/device/vibrator-guidelines.md b/en/application-dev/device/vibrator-guidelines.md index 36b08b2acd96e2d65fc14a936f1c3e9c9dd31a88..c028f5be4890c476bab762cfc8b0f0d12d9fdda8 100644 --- a/en/application-dev/device/vibrator-guidelines.md +++ b/en/application-dev/device/vibrator-guidelines.md @@ -16,6 +16,10 @@ For details about the APIs, see [Vibrator](../reference/apis/js-apis-vibrator.md | ohos.vibrator | startVibration(effect: VibrateEffect, attribute: VibrateAttribute, callback: AsyncCallback<void>): void | Starts vibration with the specified effect and attribute. This API uses an asynchronous callback to return the result.| | ohos.vibrator | stopVibration(stopMode: VibratorStopMode): Promise<void> | Stops vibration in the specified mode. This API uses a promise to return the result. | | ohos.vibrator | stopVibration(stopMode: VibratorStopMode, callback: AsyncCallback<void>): void | Stops vibration in the specified mode. This API uses an asynchronous callback to return the result. | +| ohos.vibrator | stopVibration(): Promise<void> | Stops vibration in all modes. This API uses a promise to return the result. | +| ohos.vibrator | stopVibration(callback: AsyncCallback<void>): void | Stops vibration in all modes. This API uses an asynchronous callback to return the result. | +| ohos.vibrator | isSupportEffect(effectId: string): Promise<boolean> | Checks whether the passed effect ID is supported. This API uses a promise to return the result. The value **true** means that the passed effect ID is supported, and **false** means the opposite. | +| ohos.vibrator | isSupportEffect(effectId: string, callback: AsyncCallback<boolean>): void | Checks whether the passed effect ID is supported. This API uses an asynchronous callback to return the result. The value **true** means that the passed effect ID is supported, and **false** means the opposite. | ## How to Develop @@ -27,7 +31,7 @@ For details about the APIs, see [Vibrator](../reference/apis/js-apis-vibrator.md ```js import vibrator from '@ohos.vibrator'; try { - vibrator.startVibration({ + vibrator.startVibration({ // To use startVibration, you must configure the ohos.permission.VIBRATE permission. type: 'time', duration: 1000, }, { @@ -50,7 +54,7 @@ For details about the APIs, see [Vibrator](../reference/apis/js-apis-vibrator.md ```js import vibrator from '@ohos.vibrator'; try { - // Stop vibration in VIBRATOR_STOP_MODE_TIME mode. + // Stop vibration in VIBRATOR_STOP_MODE_TIME mode. To use stopVibration, you must configure the ohos.permission.VIBRATE permission. vibrator.stopVibration(vibrator.VibratorStopMode.VIBRATOR_STOP_MODE_TIME, function (error) { if (error) { console.log('error.code' + error.code + 'error.message' + error.message); @@ -62,3 +66,72 @@ For details about the APIs, see [Vibrator](../reference/apis/js-apis-vibrator.md console.info('errCode: ' + err.code + ' ,msg: ' + err.message); } ``` + +4. Stop vibration in all modes. + + ```js + import vibrator from '@ohos.vibrator'; + // To use startVibration and stopVibration, you must configure the ohos.permission.VIBRATE permission. + try { + vibrator.startVibration({ + type: 'time', + duration: 1000, + }, { + id: 0, + usage: 'alarm' + }, (error) => { + if (error) { + console.error('vibrate fail, error.code: ' + error.code + 'error.message: ', + error.message); + return; + } + console.log('Callback returned to indicate a successful vibration.'); + }); + // Stop vibration in all modes. + vibrator.stopVibration(function (error) { + if (error) { + console.log('error.code' + error.code + 'error.message' + error.message); + return; + } + console.log('Callback returned to indicate successful.'); + }) + } catch (error) { + console.info('errCode: ' + error.code + ' ,msg: ' + error.message); + } + ``` + +5. Check whether the passed effect ID is supported. + + ```js + import vibrator from '@ohos.vibrator'; + try { + // Check whether 'haptic.clock.timer' is supported. + vibrator.isSupportEffect('haptic.clock.timer', function (err, state) { + if (err) { + console.error('isSupportEffect failed, error:' + JSON.stringify(err)); + return; + } + console.log('The effectId is ' + (state ? 'supported' : 'unsupported')); + if (state) { + try { + vibrator.startVibration({ // To use startVibration, you must configure the ohos.permission.VIBRATE permission. + type: 'preset', + effectId: 'haptic.clock.timer', + count: 1, + }, { + usage: 'unknown' + }, (error) => { + if(error) { + console.error('haptic.clock.timer vibrator error:' + JSON.stringify(error)); + } else { + console.log('haptic.clock.timer vibrator success'); + } + }); + } catch (error) { + console.error('Exception in, error:' + JSON.stringify(error)); + } + } + }) + } catch (error) { + console.error('Exception in, error:' + JSON.stringify(error)); + } + ``` diff --git a/en/application-dev/dfx/Readme-EN.md b/en/application-dev/dfx/Readme-EN.md index 4ed700a49b94ef0c296ec27eaf9c5cde96575234..c6b449f197ba66d8bd6f4021abffe6ce31a69028 100644 --- a/en/application-dev/dfx/Readme-EN.md +++ b/en/application-dev/dfx/Readme-EN.md @@ -1,13 +1,9 @@ # DFX -- Application Event Logging - - [Development of Application Event Logging](hiappevent-guidelines.md) -- Distributed Call Chain Tracing - - [Development of Distributed Call Chain Tracing](hitracechain-guidelines.md) -- HiLog - - [HiLog Development](hilog-guidelines.md) -- Performance Tracing - - [Development of Performance Tracing](hitracemeter-guidelines.md) +- [Development of Application Event Logging](hiappevent-guidelines.md) +- [Development of Performance Tracing](hitracemeter-guidelines.md) +- [Development of Distributed Call Chain Tracing](hitracechain-guidelines.md) +- [HiLog Development (Native)](hilog-guidelines.md) - Error Management - [Development of Error Manager](errormanager-guidelines.md) - - [Development of Application Recovery](apprecovery-guidelines.md) + - [Development of Application Recovery](apprecovery-guidelines.md) \ No newline at end of file diff --git a/en/application-dev/dfx/apprecovery-guidelines.md b/en/application-dev/dfx/apprecovery-guidelines.md index 67176a77ff4cacda15de76a3390275f59f3a6aa4..5c297d3357d83feb0b6c1465f67ec2b085ade7b3 100644 --- a/en/application-dev/dfx/apprecovery-guidelines.md +++ b/en/application-dev/dfx/apprecovery-guidelines.md @@ -1,62 +1,80 @@ -# Development of Application Recovery +# Application Recovery Development ## When to Use -During application running, some unexpected behaviors are inevitable. For example, unprocessed exceptions and errors are thrown, and the call or running constraints of the framework are violated. +During application running, some unexpected behaviors are inevitable. For example, unprocessed exceptions and errors are thrown, and the call or running constraints of the recovery framework are violated. -By default, the processes will exit as exception handling. However, if user data is generated during application use, process exits may interrupt user operations and cause data loss. -In this way, application recovery APIs may help you save temporary data, restart an application after it exits, and restore its status and data, which deliver a better user experience. +Process exit is treated as the default exception handling method. However, if user data is generated during application use, process exit may interrupt user operations and cause data loss. +Application recovery helps to restore the application state and save temporary data upon next startup in the case of an abnormal process exit, thus providing more consistent user experience. The application state includes two parts, namely, the page stack of the and the data saved in **onSaveState**. -Currently, the APIs support only the development of an application that adopts the stage model, single process, and single ability. +In API version 9, application recovery is supported only for a single ability of the application developed using the stage model. Application state saving and automatic restart are performed when a JsError occurs. + +In API version 10, application recovery is also supported for multiple abilities of the application developed using the stage model. Application state storage and restore are performed when an AppFreeze occurs. If an application is killed in control mode, the application state will be restored upon next startup. ## Available APIs -The application recovery APIs are provided by the **appRecovery** module, which can be imported via **import**. For details, please refer to [Development Example](#development-example). This document describes behaviors of APIs in API version 9, and the content will update with changes. +The application recovery APIs are provided by the **appRecovery** module, which can be imported via **import**. For details, see [Development Example](#development-example). ### Available APIs -| API | Description | -| ------------------------------------------------------------ | ------------------------------------------------------------ | -| enableAppRecovery(restart?: RestartFlag, saveOccasion?: SaveOccasionFlag, saveMode?: SaveModeFlag) : void; | Enables the application recovery function. | -| saveAppState(): boolean; | Saves the ability status of an application. | -| restartApp(): void; | Restarts the current process. If there is saved ability status, it will be passed to the **want** parameter's **wantParam** attribute of the **onCreate** lifecycle callback of the ability.| +| API | Description | +| ------------------------------------------------------------ | ---------------------------------------------------- | +| enableAppRecovery(restart?: RestartFlag, saveOccasion?: SaveOccasionFlag, saveMode?: SaveModeFlag) : void;9+ | Enables application recovery. After this API is called, the first ability that is displayed when the application is started from the initiator can be restored.| +| saveAppState(): boolean;9+ | Saves the state of the ability that supports recovery in the current application.| +| restartApp(): void;9+ | Restarts the current process and starts the ability specified by **setRestartWant**. If no ability is specified, a foreground ability that supports recovery is restarted.| +| saveAppState(context?: UIAbilityContext): boolean;10+ | Saves the ability state specified by **Context**.| +| setRestartWant(want: Want): void;10+ | Sets the abilities to restart when **restartApp** is actively called and **RestartFlag** is not **NO_RESTART**. The abilities must be under the same bundle name and must be a **UiAbility**.| + +No error will be thrown if the preceding APIs are used in the troubleshooting scenario. The following are some notes on API usage: + +**enableAppRecovery**: This API should be called during application initialization. For example, you can call this API in **onCreate** of **AbilityStage**. For details, see [Parameter Description](../reference/apis/js-apis-app-ability-appRecovery.md). + +**saveAppState**: After this API is called, the recovery framework invokes **onSaveState** for all abilities that support recovery in the current process. If you choose to save data in **onSaveState**, the related data and ability page stack are persistently stored in the local cache of the application. To save data of the specified ability, you need to specify the context corresponding to that ability. + +**setRestartWant**: This API specifies the ability to be restarted by **appRecovery**. -The APIs are used for troubleshooting and do not return any exception. Therefore, you need to be familiar with when they are used. +**restartApp**: After this API is called, the recovery framework kills the current process and restarts the ability specified by **setRestartWant**, with **APP_RECOVERY** set as the startup cause. In API version 9 and scenarios where an ability is not specified by **setRestartWant**, the last foreground ability that supports recovery is started. If the no foreground ability supports recovery, the application crashes. If a saved state is available for the restarted ability, the saved state is passed as the **wantParam** attribute in the **want** parameter of the ability's **onCreate** callback. -**enableAppRecovery**: This API should be called during application initialization. For example, you can call this API in **onCreate** of **AbilityStage**. For details, please refer to the [parameter description](../reference/apis/js-apis-app-ability-appRecovery.md). +### Application State Management +Since API version 10, application recovery is not limited to automatic restart in the case of an exception. Therefore, you need to understand when the application will load the saved state. +If the last exit of an application is not initiated by a user and a saved state is available for recovery, the startup reason is set to **APP_RECOVERY** when the application is started by the user next time, and the recovery state of the application is cleared. +The application recovery status flag is set when **saveAppState** is actively or passively called. The flag is cleared when the application exits normally or the saved state is consumed. (A normal exit is usually triggered by pressing the back key or clearing recent tasks.) -**saveAppState**: After this API is called, the framework calls back **onSaveState** of the ability. If data saving is agreed to in this method, relevant data and the page stack of the ability are persisted to the local cache of the application. +![Application recovery status management](./figures/application_recovery_status_management.png) -**restartApp**: After this API is called, the framework kills the current application process and restarts the ability in the foreground, with **APP_RECOVERY** specified as the startup cause. +### Application State Saving and Restore +API version 10 or later supports saving of the application state when an application is suspended. If a JsError occurs, **onSaveState** is called in the main thread. If an AppFreeze occurs, however, the main thread may be suspended, and therefore **onSaveState** is called in a non-main thread. The following figure shows the main service flow. -### Framework Fault Management Process +![Application recovery from the freezing state](./figures/application_recovery_from_freezing.png) +When the application is suspended, the callback is not executed in the JS thread. Therefore, you are advised not to use the imported dynamic Native library or access the **thread_local** object created by the main thread in the code of the **onSaveState** callback. + +### Framework Fault Management Fault management is an important way for applications to deliver a better user experience. The application framework offers three methods for application fault management: fault listening, fault rectification, and fault query. -- Fault listening refers to the process of registering [ErrorObserver](../reference/apis/js-apis-application-errorManager.md#errorobserver) via [errorManager](../reference/apis/js-apis-application-errorManager.md), listening for fault occurrence, and notifying the fault listener. +- Fault listening refers to the process of registering an [ErrorObserver](../reference/apis/js-apis-inner-application-errorObserver.md) via [errorManager](../reference/apis/js-apis-app-ability-errorManager.md), listening for faults, and notifying the listener of the faults. -- Fault rectification refers to [appRecovery](../reference/apis/js-apis-app-ability-appRecovery.md) and restarts an application to restore its status previous to a fault. +- Fault rectification refers to the process of restoring the application state and data through [appRecovery](../reference/apis/js-apis-app-ability-appRecovery.md). -- Fault query indicates that [faultLogger](../reference/apis/js-apis-faultLogger.md) obtains the fault information using its query API. +- Fault query is the process of calling APIs of [faultLogger](../reference/apis/js-apis-faultLogger.md) to obtain the fault information. -The figure below does not illustrate the time when [faultLogger](../reference/apis/js-apis-faultLogger.md) is called. You can refer to [LastExitReason](../reference/apis/js-apis-app-ability-abilityConstant.md#abilityconstantlastexitreason) passed during application initialization to determine whether to call [faultLogger](../reference/apis/js-apis-faultLogger.md) to query the information about the last fault. +The figure below does not illustrate the time when [faultLogger](../reference/apis/js-apis-faultLogger.md) is called. You can refer to the [LastExitReason](../reference/apis/js-apis-app-ability-abilityConstant.md#abilityconstantlastexitreason) passed during application initialization to determine whether to call [faultLogger](../reference/apis/js-apis-faultLogger.md) to query information about the previous fault. ![Fault rectification process](./figures/fault_rectification.png) +It is recommended that you call [errorManager](../reference/apis/js-apis-app-ability-errorManager.md) to handle the exception. After the processing is complete, you can call the **saveAppState** API and restart the application. +If you do not register [ErrorObserver](../reference/apis/js-apis-inner-application-errorObserver.md) or enable application recovery, the application process will exit according to the default processing logic of the system. Users can restart the application from the home screen. +If you have enabled application recovery, the recovery framework first checks whether application state saving is supported and whether the application state saving is enabled. If so, the recovery framework invokes [onSaveState](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityonsavestate) of the [Ability](../reference/apis/js-apis-app-ability-uiAbility.md). Finally, the application is restarted. -It is recommended that you call [errorManager](../reference/apis/js-apis-application-errorManager.md) to process the exception. After the processing is complete, you can call the status saving API and restart the application. -If you do not register [ErrorObserver](../reference/apis/js-apis-application-errorManager.md#errorobserver) or enable application recovery, the application process will exit according to the default processing logic of the system. Users can restart the application from the home screen. -If you have enabled application recovery, the framework first checks whether a fault allows for ability status saving and whether you have configured ability status saving. If so, [onSaveState](../reference/apis/js-apis-application-ability.md#abilityonsavestate) of [Ability](../reference/apis/js-apis-application-ability.md#ability) is called back. Finally, the application is restarted. - -### Scenarios Supported by Application Fault Management APIs +### Supported Application Recovery Scenarios Common fault types include JavaScript application crash, application freezing, and C++ application crash. Generally, an application is closed when a crash occurs. Application freezing occurs when the application does not respond. The fault type can be ignored for the upper layer of an application. The recovery framework implements fault management in different scenarios based on the fault type. -| Fault | Fault Listening| Status Saving| Automatic Restart| Log Query| -| ------------------------------------------------------------ | -------- | -------- | -------- | -------- | -| [JS_CRASH](../reference/apis/js-apis-faultLogger.md#faulttype) | Supported | Supported | Supported | Supported | -| [APP_FREEZE](../reference/apis/js-apis-faultLogger.md#faulttype) | Not supported | Not supported | Supported | Supported | -| [CPP_CRASH](../reference/apis/js-apis-faultLogger.md#faulttype) | Not supported | Not supported | Not supported | Supported | +| Fault | Fault Listening | State Saving| Automatic Restart| Log Query| +| ----------|--------- |--------- |--------- |--------- | +| [JS_CRASH](../reference/apis/js-apis-faultLogger.md#faulttype) | Supported|Supported|Supported|Supported| +| [APP_FREEZE](../reference/apis/js-apis-faultLogger.md#faulttype) | Not supported|Supported|Supported|Supported| +| [CPP_CRASH](../reference/apis/js-apis-faultLogger.md#faulttype) | Not supported|Not supported|Not supported|Supported| -**Status Saving** in the table header means status saving when a fault occurs. To protect user data as much as possible in the application freezing fault, you can adopt either the periodic or automatic way, and the latter will save user data when an ability is switched to the background. +**State Saving** in the table header means saving of the application state when a fault occurs. To protect user data as much as possible when an AppFreeze occurs, you can adopt either the periodic or automatic way, and the latter will save user data when an ability is switched to the background. @@ -78,11 +96,23 @@ export default class MyAbilityStage extends AbilityStage { appRecovery.SaveModeFlag.SAVE_WITH_FILE); } } +``` +### Enabling Application Recovery for the Specified Abilities +Generally, the ability configuration list is named **module.json5**. +```json +{ + "abilities": [ + { + "name": "EntryAbility", + "recoverable": true, + }] +} + ``` ### Saving and Restoring Data -After enabling **appRecovery**, you can use this function by either actively or passively saving the status and restoring data in the ability. +After enabling **appRecovery**, you can use this function by either actively or passively saving the application state and restoring data in the ability. The following is an example of **EntryAbility**: #### Importing the Service Package @@ -93,14 +123,14 @@ import appRecovery from '@ohos.app.ability.appRecovery'; import AbilityConstant from '@ohos.app.ability.AbilityConstant'; ``` -#### Actively Saving Status and Restoring Data +#### Actively Saving the Application State and Restoring Data -- Define and register the [ErrorObserver](../reference/apis/js-apis-application-errorManager.md#errorobserver) callback. +- Define and register the [ErrorObserver](../reference/apis/js-apis-inner-application-errorObserver.md) callback. For details about its usage, see [errorManager](../reference/apis/js-apis-app-ability-errorManager.md). ```ts var registerId = -1; var callback = { - onUnhandledException: function (errMsg) { + onUnhandledException(errMsg) { console.log(errMsg); appRecovery.saveAppState(); appRecovery.restartApp(); @@ -108,11 +138,11 @@ import AbilityConstant from '@ohos.app.ability.AbilityConstant'; } onWindowStageCreate(windowStage) { - // Main window is created. Set a main page for this ability. + // Main window is created, set main page for this ability console.log("[Demo] EntryAbility onWindowStageCreate") globalThis.registerObserver = (() => { - registerId = errorManager.registerErrorObserver(callback); + registerId = errorManager.on('error', callback); }) windowStage.loadContent("pages/index", null); @@ -125,16 +155,16 @@ After the callback triggers **appRecovery.saveAppState()**, **onSaveState(state, ```ts onSaveState(state, wantParams) { - // Save application data. + // Ability has called to save app data console.log("[Demo] EntryAbility onSaveState") wantParams["myData"] = "my1234567"; - return AbilityConstant.onSaveResult.ALL_AGREE; + return AbilityConstant.OnSaveResult.ALL_AGREE; } ``` - Restore data. -After the callback triggers **appRecovery.restartApp()**, the application is restarted. After the restart, **onCreate(want, launchParam)** of **EntryAbility** is called, and the saved data is in **parameters** of **want**. +After the callback triggers **appRecovery.restartApp()**, the application is restarted. After the restart, **onCreate(want, launchParam)** of **EntryAbility** is called, and the saved data is stored in **parameters** of **want**. ```ts storage: LocalStorage @@ -150,24 +180,24 @@ onCreate(want, launchParam) { } ``` -- Deregister **ErrorObserver callback**. +- Unregister the **ErrorObserver** callback. ```ts onWindowStageDestroy() { - // Main window is destroyed to release UI resources. + // Main window is destroyed, release UI related resources console.log("[Demo] EntryAbility onWindowStageDestroy") globalThis.unRegisterObserver = (() => { - errorManager.unregisterErrorObserver(registerId, (result) => { - console.log("[Demo] result " + result.code + ";" + result.message) + errorManager.off('error', registerId, (err) => { + console.error("[Demo] err:", err); }); }) } ``` -#### Passively Saving Status and Restoring Data +#### Passively Saving the Application State and Restoring Data -This is triggered by the recovery framework. You do not need to register **ErrorObserver callback**. You only need to implement **onSaveState** of the ability for status saving and **onCreate** of the ability for data restoration. +This is triggered by the recovery framework. You do not need to register an **ErrorObserver** callback. You only need to implement **onSaveState** for application state saving and **onCreate** for data restore. ```ts export default class EntryAbility extends Ability { @@ -184,10 +214,10 @@ export default class EntryAbility extends Ability { } onSaveState(state, wantParams) { - // Save application data. + // Ability has called to save app data console.log("[Demo] EntryAbility onSaveState") wantParams["myData"] = "my1234567"; - return AbilityConstant.onSaveResult.ALL_AGREE; + return AbilityConstant.OnSaveResult.ALL_AGREE; } } ``` diff --git a/en/application-dev/dfx/errormanager-guidelines.md b/en/application-dev/dfx/errormanager-guidelines.md index 667339c3b3dbaa101cfbda8eeacbc8f11c2fd03d..4679cfcfc78893590fe73eab770e49fc68a1a828 100644 --- a/en/application-dev/dfx/errormanager-guidelines.md +++ b/en/application-dev/dfx/errormanager-guidelines.md @@ -12,11 +12,11 @@ Application error management APIs are provided by the **errorManager** module. F | 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. | +| on(type: "error", 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.| +| off(type: "error", observerId: number, callback: AsyncCallback\): void | Unregisters an observer in callback mode. The number passed to this API is the SN of the registered observer. | +| off(type: "error", 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). +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 @@ -39,22 +39,23 @@ When an asynchronous callback is used, the return value can be processed directl import UIAbility from '@ohos.app.ability.UIAbility'; import errorManager from '@ohos.app.ability.errorManager'; -var registerId = -1; -var callback = { +let registerId = -1; +let callback = { onUnhandledException: function (errMsg) { console.log(errMsg); } } -export default class EntryAbility extends Ability { + +export default class EntryAbility extends UIAbility { onCreate(want, launchParam) { console.log("[Demo] EntryAbility onCreate") - registerId = errorManager.registerErrorObserver(callback); + registerId = errorManager.on("error", callback); globalThis.abilityWant = want; } onDestroy() { console.log("[Demo] EntryAbility onDestroy") - errorManager.unregisterErrorObserver(registerId, (result) => { + errorManager.off("error", registerId, (result) => { console.log("[Demo] result " + result.code + ";" + result.message) }); } diff --git a/en/application-dev/dfx/figures/application_recovery_from_freezing.png b/en/application-dev/dfx/figures/application_recovery_from_freezing.png new file mode 100644 index 0000000000000000000000000000000000000000..968b4cefc5e898209cdae117c7f9f667bc9fbd64 Binary files /dev/null and b/en/application-dev/dfx/figures/application_recovery_from_freezing.png differ diff --git a/en/application-dev/dfx/figures/application_recovery_status_management.png b/en/application-dev/dfx/figures/application_recovery_status_management.png new file mode 100644 index 0000000000000000000000000000000000000000..762504c1d1027be87233e589988be2091640191b Binary files /dev/null and b/en/application-dev/dfx/figures/application_recovery_status_management.png differ diff --git a/en/application-dev/dfx/figures/fault_rectification.png b/en/application-dev/dfx/figures/fault_rectification.png index 67aa40592f7bcad23e216222e898c1f1327a4efb..a178b2691616d406d2668806ffcd4f89c8ca82a3 100644 Binary files a/en/application-dev/dfx/figures/fault_rectification.png and b/en/application-dev/dfx/figures/fault_rectification.png differ diff --git a/en/application-dev/dfx/hiappevent-guidelines.md b/en/application-dev/dfx/hiappevent-guidelines.md index 9991e10c731d9130a7c1f52154e18ac19bce336d..569b16d587af811d32e425a534ab4dc0df6a4be6 100644 --- a/en/application-dev/dfx/hiappevent-guidelines.md +++ b/en/application-dev/dfx/hiappevent-guidelines.md @@ -45,7 +45,7 @@ The following table provides only a brief description of related APIs. For detai The following example illustrates how to log and subscribe to button click events of users. -1. Create an eTS application project. In the displayed **Project** window, choose **entry** > **src** > **main** > **ets** > **entryability** > **EntryAbility.ts**, and double-click **EntryAbility.ts**. Then, add an event watcher to subscribe to button click events. The complete sample code is as follows: +1. Create an ArkTS application project. In the displayed **Project** window, choose **entry** > **src** > **main** > **ets** > **entryability** > **EntryAbility.ts**, and double-click **EntryAbility.ts**. Then, add an event watcher to subscribe to button click events. The complete sample code is as follows: ```js import hilog from '@ohos.hilog'; @@ -146,9 +146,3 @@ The following example illustrates how to log and subscribe to button click event HiAppEvent eventPkg.size=124 HiAppEvent eventPkg.info={"domain_":"button","name_":"click","type_":4,"time_":1670268234523,"tz_":"+0800","pid_":3295,"tid_":3309,"click_time":100} ``` - -## Samples - -The following sample is provided to help you better understand how to develop the application event logging feature: - -- [`JsDotTest`: Event Logging (JS) (API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/DFX/JsDotTest) diff --git a/en/application-dev/faqs/Readme-EN.md b/en/application-dev/faqs/Readme-EN.md index 7eb9cad6b546996a47e92cd01b03f783a1f4a6d2..63535a32ae16eca13b03d20b4bce93569e2fe1d0 100644 --- a/en/application-dev/faqs/Readme-EN.md +++ b/en/application-dev/faqs/Readme-EN.md @@ -18,5 +18,4 @@ - [Native API Usage](faqs-native.md) - [Usage of Third- and Fourth-Party Libraries](faqs-third-party-library.md) - [IDE Usage](faqs-ide.md) -- [hdc_std Command Usage](faqs-hdc-std.md) - [Development Board](faqs-development-board.md) \ No newline at end of file diff --git a/en/application-dev/faqs/faqs-bundle.md b/en/application-dev/faqs/faqs-bundle.md index 61a5277c6d4a1493d0281fdd66b88a99a07141ae..fda41c42bccc357d6b8800ce3f5401e1e2abbceb 100644 --- a/en/application-dev/faqs/faqs-bundle.md +++ b/en/application-dev/faqs/faqs-bundle.md @@ -14,7 +14,7 @@ Applicable to: OpenHarmony SDK 3.2.3.5, stage model of API version 9 Obtain the bundle name through **context.abilityInfo.bundleName**. -Reference: [AbilityContext](../reference/apis/js-apis-ability-context.md) and [AbilityInfo](../reference/apis/js-apis-bundle-AbilityInfo.md) +Reference: [AbilityInfo](../reference/apis/js-apis-bundle-AbilityInfo.md) ## How do I obtain an application icon? diff --git a/en/application-dev/faqs/faqs-device-management.md b/en/application-dev/faqs/faqs-device-management.md index dd836eb11abfbee3979f5a604eb5aa734d0d9112..ea71edd6c9940437e197be35e60a6638c73ae88d 100644 --- a/en/application-dev/faqs/faqs-device-management.md +++ b/en/application-dev/faqs/faqs-device-management.md @@ -2,23 +2,21 @@ ## How do I obtain the DPI of a device? -Applicable to: OpenHarmony SDK 3.2.2.5, stage model of API version 9 - -Import the **\@ohos.display** module and call the **getDefaultDisplay** API. +Applicable to: OpenHarmony 3.2 Beta5, stage model of API version 9 -Example: +Import the **@ohos.display** module and call the **getDefaultDisplaySync** API. +**Example** ``` import display from '@ohos.display'; -display.getDefaultDisplay((err, data) => { - if (err.code) { - console.error('Test Failed to obtain the default display object. Code: ' + JSON.stringify(err)); - return; - } - console.info('Test Succeeded in obtaining the default display object. Data:' + JSON.stringify(data)); - console.info('Test densityDPI:' + JSON.stringify(data.densityDPI)); -}); +let displayClass = null; +try { + displayClass = display.getDefaultDisplaySync(); + console.info('Test densityDPI:' + JSON.stringify(data.densityDPI)); +} catch (exception) { + console.error('Failed to obtain the default display object. Code: ' + JSON.stringify(exception)); +} ``` ## How do I obtain the type of the device where the application is running? diff --git a/en/application-dev/faqs/faqs-hdc-std.md b/en/application-dev/faqs/faqs-hdc-std.md deleted file mode 100644 index 60f93da61d7d78a4e148b65c0e30d379b1e1206d..0000000000000000000000000000000000000000 --- a/en/application-dev/faqs/faqs-hdc-std.md +++ /dev/null @@ -1,87 +0,0 @@ -# hdc_std Command Usage - -## Common Log Commands - -Applicable to: OpenHarmony SDK 3.2.2.5 - -Clearing logs: hdc_std shell hilog -r - -Increasing the buffer size to 20 MB: hdc_std shell hilog -G 20M - -Capturing logs: hdc_std shell hilog > log.txt - -## What should I do to avoid log flow control? - -Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9 - -- Disabling log flow control: hdc_std shell hilog -Q pidoff - -- Disabling the privacy flag: hdc_std shell hilog -p off - -- Increasing the log buffer to 200 MB: hdc_std shell hilog -G 200M - -- Enabling the log function of the specific domain (that is, disabling the global log function): hdc_std shell hilog –b D –D 0xd0xxxxx - -After performing the preceding operations, restart the DevEco Studio. - -## What should I do if the HAP installed on the development board through the IDE cannot be opened? - -Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9 - -Check whether the SDK version is consistent with the system version on the development board. You are advised to use the SDK version and system version that are released on the same day. - -## How do I upload files using the hdc command? - -Applicable to: OpenHarmony SDK 3.2.2.5 - -Run the **hdc_std file send** command. - -## How do I prevent the screen of the RK3568 development board from turning off? - -Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9 - -Run the **hdc_std shell "power-shell setmode 602"** command. - -## How do I start an ability using the hdc command? - -Applicable to: OpenHarmony SDK 3.2.5.3, stage model of API version 9 - -Run the **hdc\_std shell aa start -a AbilityName -b bundleName -m moduleName** command. - -## How do I change the read and write permissions on a file directory on the development board? - -Applicable to: OpenHarmony SDK 3.2.5.6, stage model of API version 9 - -Run the **hdc\_std shell mount -o remount,rw /** command. - -## What should I do if the error message "Unknown file option -r" is displayed when hdc_std file recv is run? - -Applicable to: OpenHarmony SDK 3.2.5.6, stage model of API version 9 - -1. Use the the hdc tool in the device image or SDK of the same version. - -2. Remove any Chinese characters or spaces from the directory specified for the hdc tool. - -## How do I uninstall an application using the hdc command? - -Applicable to: OpenHarmony SDK 3.2.2.5 - -Run the **hdc\_std uninstall [-k] [package_name]** command. - -## How do I check whether the system is 32-bit or 64-bit? - -Applicable to: OpenHarmony SDK 3.2.5.5 - -Run the **hdc\_std shell getconf LONG_BIT** command. - -If **64** is returned, the system is a 64-bit one. Otherwise, the system is a 32-bit one. - -## How do I view the component tree structure? - -Applicable to: OpenHarmony SDK 3.2.5.5 - -1. Run the **hdc\_std shell** command to launch the CLI. - -2. Run the **aa dump -a** command to find **abilityID**. - -3. Run the **aa dump -i [abilityID] -c -render** command to view the component tree. diff --git a/en/application-dev/faqs/faqs-language.md b/en/application-dev/faqs/faqs-language.md index 22a450b4c8e37dc85a28c2ea3b972b03d6ea16ae..6d3ded94a76155feae22d761bdb63422e07f0316 100644 --- a/en/application-dev/faqs/faqs-language.md +++ b/en/application-dev/faqs/faqs-language.md @@ -251,7 +251,6 @@ Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9 To listen for in-depth changes of **@State** decorated variables, you can use **@Observed** and **@ObjectLink** decorators. -Reference: [@Observed and @ObjectLink](../quick-start/arkts-state-mgmt-page-level.md#observed-and-objectlink) ## How do I implement character string encoding and decoding? diff --git a/en/application-dev/faqs/faqs-web-arkts.md b/en/application-dev/faqs/faqs-web-arkts.md index be2d58f82d54c9b95596ad3e767954fb7acfceca..6fe2c75a4bf0bc9b1d2f73929a34dc618c503d5b 100644 --- a/en/application-dev/faqs/faqs-web-arkts.md +++ b/en/application-dev/faqs/faqs-web-arkts.md @@ -76,4 +76,4 @@ Applicable to: OpenHarmony SDK 3.2.7.5, stage model of API version 9 4. Use message port 0 on the application side to send messages to message port 1 on the HTML side. -Reference: [Web](../reference/arkui-ts/ts-basic-components-web.md#postmessage9) +Reference: [Web](../reference/arkui-ts/ts-basic-components-web.md) diff --git a/en/application-dev/file-management/medialibrary-filepath-guidelines.md b/en/application-dev/file-management/medialibrary-filepath-guidelines.md index 4c7e2ecd4db6723a66930e624bd4b36b556330d1..1e310ef9312499bb131affb620ac7758e5033778 100644 --- a/en/application-dev/file-management/medialibrary-filepath-guidelines.md +++ b/en/application-dev/file-management/medialibrary-filepath-guidelines.md @@ -136,7 +136,7 @@ async function copySandbox2Public() { console.error('file asset get failed, message = ' + err); } let fdPub = await fileAsset.open('rw'); - let fdSand = await fs.open(sandboxDirPath + 'testFile.txt', OpenMode.READ_WRITE); + let fdSand = await fs.open(sandboxDirPath + 'testFile.txt', fs.OpenMode.READ_WRITE); await fs.copyFile(fdSand.fd, fdPub); await fileAsset.close(fdPub); await fs.close(fdSand.fd); @@ -174,7 +174,7 @@ async function example() { const context = getContext(this); let media = mediaLibrary.getMediaLibrary(context); const path = await media.getPublicDirectory(DIR_DOCUMENTS); - media.createAsset(mediaType, "testFile.text", path).then((asset) => { + media.createAsset(mediaType, "testFile.txt", path).then((asset) => { console.info("createAsset successfully:" + JSON.stringify(asset)); }).catch((err) => { console.error("createAsset failed with error: " + err); diff --git a/en/application-dev/file-management/medialibrary-resource-guidelines.md b/en/application-dev/file-management/medialibrary-resource-guidelines.md index 7d120ec9a4fa9fd38ba92be97ee7fdd5a6f33816..b5691ad2e7505f0b1df617dd94c933b09de350e7 100644 --- a/en/application-dev/file-management/medialibrary-resource-guidelines.md +++ b/en/application-dev/file-management/medialibrary-resource-guidelines.md @@ -42,14 +42,11 @@ async function example() { const context = getContext(this); let media = mediaLibrary.getMediaLibrary(context); const fetchFileResult = await media.getFileAssets(option); - fetchFileResult.getFirstObject().then((fileAsset) => { + fetchFileResult.getFirstObject().then(async (fileAsset) => { console.log('getFirstObject.displayName : ' + fileAsset.displayName); for (let i = 1; i < fetchFileResult.getCount(); i++) { - fetchFileResult.getNextObject().then((fileAsset) => { - console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); - }).catch((err) => { - console.error('Failed to get next object: ' + err); - }); + let fileAsset = await fetchFileResult.getNextObject(); + console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); } }).catch((err) => { console.error('Failed to get first object: ' + err); @@ -75,14 +72,11 @@ async function example() { const context = getContext(this); let media = mediaLibrary.getMediaLibrary(context); const fetchFileResult = await media.getFileAssets(option); - fetchFileResult.getFirstObject().then((fileAsset) => { + fetchFileResult.getFirstObject().then(async (fileAsset) => { console.info('getFirstObject.displayName : ' + fileAsset.displayName); for (let i = 1; i < fetchFileResult.getCount(); i++) { - fetchFileResult.getNextObject().then((fileAsset) => { - console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); - }).catch((err) => { - console.error('Failed to get next object: ' + err); - }); + let fileAsset = await fetchFileResult.getNextObject(); + console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); } }).catch((err) => { console.error('Failed to get first object: ' + err); @@ -108,14 +102,11 @@ async function example() { const context = getContext(this); let media = mediaLibrary.getMediaLibrary(context); const fetchFileResult = await media.getFileAssets(option); - fetchFileResult.getFirstObject().then((fileAsset) => { + fetchFileResult.getFirstObject().then(async (fileAsset) => { console.info('getFirstObject.displayName : ' + fileAsset.displayName); for (let i = 1; i < fetchFileResult.getCount(); i++) { - fetchFileResult.getNextObject().then((fileAsset) => { - console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); - }).catch((err) => { - console.error('Failed to get next object: ' + err); - }); + let fileAsset = await fetchFileResult.getNextObject(); + console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); } }).catch((err) => { console.error('Failed to get first object: ' + err); @@ -156,7 +147,7 @@ async function example() { ## Obtaining Images and Videos in an Album You can obtain media assets in an album in either of the following ways: -- Call [MediaLibrary.getFileAssets](../reference/apis/js-apis-medialibrary.md#getfileassets7-1) with an album specified, as described in [Querying Media Assets with the Specfied Album Name](#querying-media-assets-with-the-specified-album-name). +- Call [MediaLibrary.getFileAssets](../reference/apis/js-apis-medialibrary.md#getfileassets7-1) with an album specified, as described in [Querying Media Assets with the Specified Album Name](#querying-media-assets-with-the-specified-album-name). - Call [Album.getFileAssets](../reference/apis/js-apis-medialibrary.md#getfileassets7-3) to obtain an **Album** instance, so as to obtain the media assets in it. **Prerequisites** diff --git a/en/application-dev/internationalization/i18n-guidelines.md b/en/application-dev/internationalization/i18n-guidelines.md index 8218f2561376c4119f66be0175c5c9ea16c7d024..e78bdb6437b26b8a30ee23f9fdec380087297b33 100644 --- a/en/application-dev/internationalization/i18n-guidelines.md +++ b/en/application-dev/internationalization/i18n-guidelines.md @@ -6,7 +6,7 @@ The [intl](intl-guidelines.md) module provides basic i18n capabilities through t ## Obtaining and Setting i18n Information -The system provides APIs to configure information such as the system language, preferred language, country or region, 24-hour clock, and local digit switch. +The following table lists the APIs used to configure information such as the system language, preferred language, country or region, 24-hour clock, and use of local digits. ### Available APIs @@ -30,15 +30,15 @@ The system provides APIs to configure information such as the system language, p | System | getPreferredLanguageList()9+ | Obtains the preferred language list. | | System | getFirstPreferredLanguage()9+ | Obtains the first language in the preferred language list. | | System | getAppPreferredLanguage()9+ | Obtains the preferred language of an application. | -| System | setUsingLocalDigit(flag: boolean)9+ | Sets whether to enable the local digit switch. | -| System | getUsingLocalDigit()9+ | Checks whether the local digit switch is turned on. | +| System | setUsingLocalDigit(flag: boolean)9+ | Specifies whether to enable use of local digits. | +| System | getUsingLocalDigit()9+ | Checks whether use of local digits is enabled. | | | isRTL(locale:string):boolean9+ | Checks whether the locale uses a right-to-left (RTL) language.| ### How to Develop 1. Import the **i18n** module. ```js - import I18n from '@ohos.i18n' + import I18n from '@ohos.i18n'; ``` 2. Obtain and set the system language. @@ -51,7 +51,7 @@ The system provides APIs to configure information such as the system language, p I18n.System.setSystemLanguage("en"); // Set the system language to en. let language = I18n.System.getSystemLanguage(); // language = "en" } catch(error) { - console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`) + console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`); } ``` @@ -65,7 +65,7 @@ The system provides APIs to configure information such as the system language, p I18n.System.setSystemRegion("CN"); // Set the system country to CN. let region = I18n.System.getSystemRegion(); // region = "CN" } catch(error) { - console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`) + console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`); } ``` @@ -79,7 +79,7 @@ The system provides APIs to configure information such as the system language, p I18n.System.setSystemLocale("zh-Hans-CN"); // Set the system locale to zh-Hans-CN. let locale = I18n.System.getSystemLocale(); // locale = "zh-Hans-CN" } catch(error) { - console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`) + console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`); } ``` @@ -92,7 +92,7 @@ The system provides APIs to configure information such as the system language, p let rtl = I18n.isRTL("zh-CN"); // rtl = false rtl = I18n.isRTL("ar"); // rtl = true } catch(error) { - console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`) + console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`); } ``` @@ -106,7 +106,7 @@ The system provides APIs to configure information such as the system language, p I18n.System.set24HourClock(true); let hourClock = I18n.System.is24HourClock(); // hourClock = true } catch(error) { - console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`) + console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`); } ``` @@ -121,7 +121,7 @@ The system provides APIs to configure information such as the system language, p let sentenceCase = false; let localizedLanguage = I18n.System.getDisplayLanguage(language, locale, sentenceCase); // localizedLanguage = "English" } catch(error) { - console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`) + console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`); } ``` @@ -136,7 +136,7 @@ The system provides APIs to configure information such as the system language, p let sentenceCase = false; let localizedCountry = I18n.System.getDisplayCountry(country, locale, sentenceCase); // localizedCountry = "U.S." } catch(error) { - console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`) + console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`); } ``` @@ -150,7 +150,7 @@ The system provides APIs to configure information such as the system language, p let languageList = I18n.System.getSystemLanguages(); // languageList = ["en-Latn-US", "zh-Hans"] let countryList = I18n.System.getSystemCountries("zh"); // countryList = ["ZW", "YT", ..., "CN", "DE"], 240 countries and regions in total } catch(error) { - console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`) + console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`); } ``` @@ -162,7 +162,7 @@ The system provides APIs to configure information such as the system language, p try { let isSuggest = I18n.System.isSuggested("zh", "CN"); // isSuggest = true } catch(error) { - console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`) + console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`); } ``` @@ -182,7 +182,7 @@ The system provides APIs to configure information such as the system language, p let firstPreferredLanguage = I18n.System.getFirstPreferredLanguage(); // firstPreferredLanguage = "en-GB" let appPreferredLanguage = I18n.System.getAppPreferredLanguage(); // Set the preferred language of the application to en-GB if the application contains en-GB resources. } catch(error) { - console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`) + console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`); } ``` @@ -190,14 +190,14 @@ The system provides APIs to configure information such as the system language, p Call **setUsingLocalDigit** to enable the local digit switch. (This is a system API and can be called only by system applications with the UPDATE_CONFIGURATION permission.) Call **getUsingLocalDigit** to check whether the local digit switch is enabled. - Currently, the local digit switch applies only to the following languages: "ar", "as", "bn", "fa", "mr", "my", "ne", and "ur". + Currently, use of local digits is supported only for the following languages: **ar**, **as**, **bn**, **fa**, **mr**, **my**, **ne**, **ur**. ```js try { I18n.System.setUsingLocalDigit(true); // Enable the local digit switch. let status = I18n.System.getUsingLocalDigit(); // status = true } catch(error) { - console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`) + console.error(`call i18n.System interface failed, error code: ${error.code}, message: ${error.message}`); } ``` @@ -220,14 +220,14 @@ try { | Calendar | getMinimalDaysInFirstWeek():number8+ | Obtains the minimum number of days in the first week of a year. | | Calendar | setMinimalDaysInFirstWeek(value:number): void8+ | Sets the minimum number of days in the first week of a year. | | Calendar | getDisplayName(locale:string):string8+ | Obtains the localized display of the **Calendar** object. | -| Calendar | isWeekend(date?:Date):boolean8+ | Checks whether the specified date in this **Calendar** object is a weekend. | +| Calendar | isWeekend(date?:Date):boolean8+ | Checks whether a given date is a weekend in the calendar. | ### How to Develop 1. Import the **i18n** module. ```js - import I18n from '@ohos.i18n' + import I18n from '@ohos.i18n'; ``` 2. Instantiate a **Calendar** object. @@ -254,7 +254,7 @@ try { Call **set** to set the year, month, day, hour, minute, and second for the **Calendar** object. ```js - calendar.set(2021, 12, 21, 6, 0, 0) + calendar.set(2021, 12, 21, 6, 0, 0); ``` 5. Set and obtain the time zone for the **Calendar** object. @@ -317,7 +317,7 @@ try { 1. Import the **i18n** module. ```js - import I18n from '@ohos.i18n' + import I18n from '@ohos.i18n'; ``` 2. Instantiate a **PhoneNumberFormat** object. @@ -359,7 +359,7 @@ The **I18NUtil** class provides an API to implement measurement conversion. 1. Import the **i18n** module. ```js - import I18n from '@ohos.i18n' + import I18n from '@ohos.i18n'; ``` 2. Convert a measurement unit. @@ -393,7 +393,7 @@ The **I18NUtil** class provides an API to implement measurement conversion. 1. Import the **i18n** module. ```js - import I18n from '@ohos.i18n' + import I18n from '@ohos.i18n'; ``` 2. Instantiates an **IndexUtil** object. @@ -418,7 +418,7 @@ The **I18NUtil** class provides an API to implement measurement conversion. Call **addLocale** to add the alphabet index of a new locale to the current index list. ```js - indexUtil.addLocale("ar") + indexUtil.addLocale("ar"); ``` 5. Obtain the index of a string. @@ -454,7 +454,7 @@ When a text is displayed in more than one line, use [BreakIterator8](../referenc 1. Import the **i18n** module. ```js - import I18n from '@ohos.i18n' + import I18n from '@ohos.i18n'; ``` 2. Instantiate a **BreakIterator** object. @@ -462,7 +462,7 @@ When a text is displayed in more than one line, use [BreakIterator8](../referenc Call **getLineInstance** to instantiate a **BreakIterator** object. ```js - let locale = "en-US" + let locale = "en-US"; let breakIterator = I18n.getLineInstance(locale); ``` @@ -531,7 +531,7 @@ When a text is displayed in more than one line, use [BreakIterator8](../referenc 1. Import the **i18n** module. ```js - import I18n from '@ohos.i18n' + import I18n from '@ohos.i18n'; ``` 2. Instantiate the **TimeZone** object, and obtain the time zone information. @@ -592,7 +592,7 @@ Call [Transliterator](../reference/apis/js-apis-i18n.md#transliterator9) APIs to 1. Import the **i18n** module. ```js - import I18n from '@ohos.i18n' + import I18n from '@ohos.i18n'; ``` 2. Obtains the transliterator ID list. @@ -637,7 +637,7 @@ Call [Transliterator](../reference/apis/js-apis-i18n.md#transliterator9) APIs to 1. Import the **i18n** module. ```js - import I18n from '@ohos.i18n' + import I18n from '@ohos.i18n'; ``` 2. Check the input character has a certain attribute. @@ -719,7 +719,7 @@ Call [Transliterator](../reference/apis/js-apis-i18n.md#transliterator9) APIs to 1. Import the **i18n** module. ```js - import I18n from '@ohos.i18n' + import I18n from '@ohos.i18n'; ``` 2. Check the sequence of year, month, and day in a date. diff --git a/en/application-dev/internationalization/intl-guidelines.md b/en/application-dev/internationalization/intl-guidelines.md index 609af84500cecb0ce5bda8409216b6957182885f..fcac5325292b27f349f6c3dcadb627dca2dd0c03 100644 --- a/en/application-dev/internationalization/intl-guidelines.md +++ b/en/application-dev/internationalization/intl-guidelines.md @@ -2,7 +2,7 @@ The **intl** module provides basic i18n capabilities, such as time and date formatting, number formatting, and string sorting, through the standard i18n APIs defined in ECMA 402. For more details about APIs and their usage, see [intl](../reference/apis/js-apis-intl.md). -The [I18N](i18n-guidelines.md) module provides enhanced I18N capabilities through supplementary interfaces that are not defined in ECMA 402. It works with the Intl module to provide a complete suite of I18N capabilities. +The [i18n](../reference/apis/js-apis-i18n.md) module provides enhanced I18N capabilities through supplementary interfaces that are not defined in ECMA 402. It works with the Intl module to provide a complete suite of I18N capabilities. ## Setting Locale Information @@ -25,7 +25,7 @@ The [I18N](i18n-guidelines.md) module provides enhanced I18N capabilities throug Importing an incorrect bundle can lead to unexpected API behavior. ```js - import Intl from '@ohos.intl' + import Intl from '@ohos.intl'; ``` 2. Instantiates a **Locale** object. @@ -100,7 +100,7 @@ The [I18N](i18n-guidelines.md) module provides enhanced I18N capabilities throug Importing an incorrect bundle can lead to unexpected API behavior. ```js - import Intl from '@ohos.intl' + import Intl from '@ohos.intl'; ``` 2. Instantiate a **DateTimeFormat** object. @@ -111,7 +111,7 @@ The [I18N](i18n-guidelines.md) module provides enhanced I18N capabilities throug let dateTimeFormat = new Intl.DateTimeFormat(); ``` - Alternatively, use your own locale and formatting parameters to create a **DateTimeFormat** object. Formatting parameters are optional. For a full list of formatting parameters, see [DateTimeOptions](../reference/apis/js-apis-intl.md#datetimeoptions). + Alternatively, use your own locale and formatting parameters to create a **DateTimeFormat** object. Formatting parameters are optional. For a full list of formatting parameters, see [DateTimeOptions](../reference/apis/js-apis-intl.md#datetimeoptions9). ```js let options = {dateStyle: "full", timeStyle: "full"}; @@ -150,7 +150,7 @@ The [I18N](i18n-guidelines.md) module provides enhanced I18N capabilities throug let resolvedOptions = dateTimeFormat.resolvedOptions(); // resolvedOptions = {"locale": "zh-CN", "calendar": "gregorian", "dateStyle":"full", "timeStyle":"full", "timeZone": "CST"} ``` -## Number Formatting +## Formatting Numbers [NumberFormat](../reference/apis/js-apis-intl.md#numberformat) provides APIs to implement the number formatting specific to a locale. @@ -170,7 +170,7 @@ The [I18N](i18n-guidelines.md) module provides enhanced I18N capabilities throug Importing an incorrect bundle can lead to unexpected API behavior. ```js - import Intl from '@ohos.intl' + import Intl from '@ohos.intl'; ``` 2. Instantiate a **NumberFormat** object. @@ -181,7 +181,7 @@ The [I18N](i18n-guidelines.md) module provides enhanced I18N capabilities throug let numberFormat = new Intl.NumberFormat(); ``` - Alternatively, use your own locale and formatting parameters to create a **NumberFormat** object. Formatting parameters are optional. For a full list of formatting parameters, see [NumberOptions](../reference/apis/js-apis-intl.md#numberoptions). + Alternatively, use your own locale and formatting parameters to create a **NumberFormat** object. Formatting parameters are optional. For a full list of formatting parameters, see [NumberOptions](../reference/apis/js-apis-intl.md#numberoptions9). ```js let options = {compactDisplay: "short", notation: "compact"}; @@ -195,7 +195,7 @@ The [I18N](i18n-guidelines.md) module provides enhanced I18N capabilities throug ```js let options = {compactDisplay: "short", notation: "compact"}; let numberFormat = new Intl.NumberFormat("zh-CN", options); - let number = 1234.5678 + let number = 1234.5678; let formatResult = numberFormat.format(number); // formatResult = "1235" ``` @@ -209,7 +209,7 @@ The [I18N](i18n-guidelines.md) module provides enhanced I18N capabilities throug let resolvedOptions = numberFormat.resolvedOptions(); // resolvedOptions = {"locale": "zh-CN", "compactDisplay": "short", "notation": "compact", "numberingSystem": "Latn"} ``` -## String Sorting +## Sorting Strings Users in different regions have different requirements for string sorting. [Collator](../reference/apis/js-apis-intl.md#collator8) provides APIs to sort character strings specific to a locale. @@ -229,7 +229,7 @@ Users in different regions have different requirements for string sorting. [Coll Importing an incorrect bundle can lead to unexpected API behavior. ```js - import Intl from '@ohos.intl' + import Intl from '@ohos.intl'; ``` 2. Instantiate a **Collator** object. @@ -240,7 +240,7 @@ Users in different regions have different requirements for string sorting. [Coll let collator = new Intl.Collator(); ``` - Alternatively, use your own locale and formatting parameters to create a **Collator** object. For a full list of parameters, see [CollatorOptions](../reference/apis/js-apis-intl.md#collatoroptions8). + Alternatively, use your own locale and formatting parameters to create a **Collator** object. For a full list of parameters, see [CollatorOptions](../reference/apis/js-apis-intl.md#collatoroptions9). The **sensitivity** parameter is used to specify the levels of differences that will be used for string comparison. The value **base** indicates that only characters are compared, but not the accent and capitalization. For example, 'a' != 'b', 'a' == '', 'a'=='A'. The value **accent** indicates that the accent is considered, but not the capitalization. For example, 'a' != 'b', 'a' == '', 'a'=='A'. The value **case** indicates that the capitalization is considered, but the accent. For example, 'a' != 'b', 'a' == '', 'a'=='A'. The value **variant** indicates that the accent and capitalization are considered. For example, 'a' != 'b', 'a' == '', 'a'=='A'. ```js @@ -290,7 +290,7 @@ According to grammars in certain languages, the singular or plural form of a nou Importing an incorrect bundle can lead to unexpected API behavior. ```js - import Intl from '@ohos.intl' + import Intl from '@ohos.intl'; ``` 2. Instantiate a **PluralRules** object. @@ -301,7 +301,7 @@ According to grammars in certain languages, the singular or plural form of a nou let pluralRules = new Intl.PluralRules(); ``` - Alternatively, use your own locale and formatting parameters to create a **PluralRules** object. For a full list of parameters, see [PluralRulesOptions](../reference/apis/js-apis-intl.md#pluralrulesoptions8). + Alternatively, use your own locale and formatting parameters to create a **PluralRules** object. For a full list of parameters, see [PluralRulesOptions](../reference/apis/js-apis-intl.md#pluralrulesoptions9). ```js let pluralRules = new Intl.PluralRules("zh-CN", {localeMatcher: "best fit", type: "cardinal"}); @@ -313,11 +313,11 @@ According to grammars in certain languages, the singular or plural form of a nou ```js let pluralRules = new Intl.PluralRules("zh-CN", {localeMatcher: "best fit", type: "cardinal"}); - let number = 1234.5678 + let number = 1234.5678; let categoryResult = pluralRules.select(number); // categoryResult = "other" ``` -## Formatting Relative Time +## Formatting the Relative Time [RelativeTimeFormat](../reference/apis/js-apis-intl.md#relativetimeformat8) provides APIs to format the relative time for a specific locale. @@ -338,7 +338,7 @@ According to grammars in certain languages, the singular or plural form of a nou Importing an incorrect bundle can lead to unexpected API behavior. ```js - import Intl from '@ohos.intl' + import Intl from '@ohos.intl'; ``` 2. Instantiate a **RelativeTimeFormat** object. @@ -349,7 +349,7 @@ According to grammars in certain languages, the singular or plural form of a nou let relativeTimeFormat = new Intl.RelativeTimeFormat(); ``` - Alternatively, use your own locale and formatting parameters to create a **RelativeTimeFormat** object. Formatting parameters are optional. For a full list of formatting parameters, see [RelativeTimeFormatInputOptions](../reference/apis/js-apis-intl.md#relativetimeformatinputoptions8). + Alternatively, use your own locale and formatting parameters to create a **RelativeTimeFormat** object. Formatting parameters are optional. For a full list of formatting parameters, see [RelativeTimeFormatInputOptions](../reference/apis/js-apis-intl.md#relativetimeformatinputoptions9). ```js let relativeTimeFormat = new Intl.RelativeTimeFormat("zh-CN", {numeric: "always", style: "long"}); @@ -362,7 +362,7 @@ According to grammars in certain languages, the singular or plural form of a nou ```js let relativeTimeFormat = new Intl.RelativeTimeFormat("zh-CN", {numeric: "always", style: "long"}); let number = 2; - let unit = "year" + let unit = "year"; let formatResult = relativeTimeFormat.format(number, unit); // 2 years later ``` @@ -373,7 +373,7 @@ According to grammars in certain languages, the singular or plural form of a nou ```js let relativeTimeFormat = new Intl.RelativeTimeFormat("zh-CN", {numeric: "always", style: "long"}); let number = 2; - let unit = "year" + let unit = "year"; let formatPartsResult = relativeTimeFormat.formatToParts(number, unit); // formatPartsResult = [{"type": "integer", "value": "2", "unit": "year"}, {"type":"literal", "value": "years later"}] ``` @@ -385,11 +385,3 @@ According to grammars in certain languages, the singular or plural form of a nou let relativeTimeFormat = new Intl.RelativeTimeFormat("zh-CN", {numeric: "always", style: "long"}); let options = relativeTimeFormat.resolvedOptions(); // options = {"locale": "zh-CN", "style": "long", "numeric": "always", "numberingSystem": "latn"} ``` - -## Samples - -The following sample is provided to help you better understand how to develop internationalization capabilities: - --[`International`: Internationalization (JS) (API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/UI/International) - --[`International`: Internationalization (ArkTS) (API8) (Full SDK)](https://gitee.com/openharmony/applications_app_samples/tree/master/common/International) diff --git a/en/application-dev/media/Readme-EN.md b/en/application-dev/media/Readme-EN.md index 926a2718a48dcefd217e503932f9d9f997d1275e..f3a233ca129527db112459ab5110df49b8e1052d 100755 --- a/en/application-dev/media/Readme-EN.md +++ b/en/application-dev/media/Readme-EN.md @@ -1,29 +1,60 @@ # Media +- [Media Application Overview](media-application-overview.md) - Audio and Video - - [Audio Overview](audio-overview.md) - - [Audio Rendering Development](audio-renderer.md) - - [Audio Stream Management Development](audio-stream-manager.md) - - [Audio Capture Development](audio-capturer.md) - - [OpenSL ES Audio Playback Development](opensles-playback.md) - - [OpenSL ES Audio Recording Development](opensles-capture.md) - - [Audio Interruption Mode Development](audio-interruptmode.md) - - [Volume Management Development](audio-volume-manager.md) - - [Audio Routing and Device Management Development](audio-routing-manager.md) - - [AVPlayer Development (Recommended)](avplayer-playback.md) - - [AVRecorder Development (Recommended)](avrecorder.md) - - [Audio Playback Development](audio-playback.md) - - [Audio Recording Development](audio-recorder.md) - - [Video Playback Development](video-playback.md) - - [Video Recording Development](video-recorder.md) - -- AVSession + - [Audio and Video Overview](av-overview.md) + - [AVPlayer and AVRecorder](avplayer-avrecorder-overview.md) + - Audio Playback + - [Audio Playback Overview](audio-playback-overview.md) + - [Using AVPlayer for Audio Playback](using-avplayer-for-playback.md) + - [Using AudioRenderer for Audio Playback](using-audiorenderer-for-playback.md) + - [Using OpenSL ES for Audio Playback](using-opensl-es-for-playback.md) + - [Using TonePlayer for Audio Playback (for System Applications Only)](using-toneplayer-for-playback.md) + - [Audio Playback Concurrency Policy](audio-playback-concurrency.md) + - [Volume Management](volume-management.md) + - [Audio Playback Stream Management](audio-playback-stream-management.md) + - [Audio Output Device Management](audio-output-device-management.md) + - [Distributed Audio Playback (for System Applications Only)](distributed-audio-playback.md) + - Audio Recording + - [Audio Recording Overview](audio-recording-overview.md) + - [Using AVRecorder for Audio Recording](using-avrecorder-for-recording.md) + - [Using AudioCapturer for Audio Recording](using-audiocapturer-for-recording.md) + - [Using OpenSL ES for Audio Recording](using-opensl-es-for-recording.md) + - [Microphone Management](mic-management.md) + - [Audio Recording Stream Management](audio-recording-stream-management.md) + - [Audio Input Device Management](audio-input-device-management.md) + - Audio Call + - [Audio Call Overview](audio-call-overview.md) + - [Developing Audio Call](audio-call-development.md) + - [Video Playback](video-playback.md) + - [Video Recording](video-recording.md) +- AVSession (for System Applications Only) - [AVSession Overview](avsession-overview.md) - - [AVSession Development](avsession-guidelines.md) - + - Local AVSession + - [Local AVSession Overview](local-avsession-overview.md) + - [AVSession Provider](using-avsession-developer.md) + - [AVSession Controller](using-avsession-controller.md) + - Distributed AVSession + - [Distributed AVSession Overview](distributed-avsession-overview.md) + - [Using Distributed AVSession](using-distributed-avsession.md) +- Camera (for System Applications Only) + - [Camera Overview](camera-overview.md) + - Camera Development + - [Camera Development Preparations](camera-preparation.md) + - [Device Input Management](camera-device-input.md) + - [Session Management](camera-session-management.md) + - [Camera Preview](camera-preview.md) + - [Camera Photographing](camera-shooting.md) + - [Video Recording](camera-recording.md) + - [Camera Metadata](camera-metadata.md) + - Best Practices + - [Camera Photographing Sample](camera-shooting-case.md) + - [Video Recording Sample](camera-recording-case.md) - Image - - [Image Development](image.md) - -- Camera - - [Camera Development](camera.md) - - [Distributed Camera Development](remote-camera.md) + - [Image Overview](image-overview.md) + - [Image Decoding](image-decoding.md) + - Image Processing + - [Image Transformation](image-transformation.md) + - [Pixel Map Operation](image-pixelmap-operation.md) + - [Image Encoding](image-encoding.md) + - [Image Tool](image-tool.md) diff --git a/en/application-dev/media/audio-call-development.md b/en/application-dev/media/audio-call-development.md new file mode 100644 index 0000000000000000000000000000000000000000..8234c837c2ce985c2a1a7dc91c7e0002fb3d4a69 --- /dev/null +++ b/en/application-dev/media/audio-call-development.md @@ -0,0 +1,259 @@ +# Developing Audio Call + +During an audio call, audio output (playing the peer voice) and audio input (recording the local voice) are carried out simultaneously. You can use the AudioRenderer to implement audio output and the AudioCapturer to implement audio input. + +Before starting or stopping using the audio call service, the application needs to check the [audio scene](audio-call-overview.md#audio-scene) and [ringer mode](audio-call-overview.md#ringer-mode) to adopt proper audio management and prompt policies. + +The sample code below demonstrates the basic process of using the AudioRenderer and AudioCapturer to implement the audio call service, without the process of call data transmission. In actual development, the peer call data transmitted over the network needs to be decoded and played, and the sample code uses the process of reading an audio file instead; the local call data needs to be encoded and packed and then sent to the peer over the network, and the sample code uses the process of writing an audio file instead. + +## Using AudioRenderer to Play the Peer Voice + +This process is similar to the process of [using AudioRenderer to develop audio playback](using-audiorenderer-for-playback.md). The key differences lie in the **audioRendererInfo** parameter and audio data source. In the **audioRendererInfo** parameter used for audio calling, **content** must be set to **CONTENT_TYPE_SPEECH**, and **usage** must be set to **STREAM_USAGE_VOICE_COMMUNICATION**. + +```ts +import audio from '@ohos.multimedia.audio'; +import fs from '@ohos.file.fs'; +const TAG = 'VoiceCallDemoForAudioRenderer'; +// The process is similar to the process of using AudioRenderer to develop audio playback. The key differences lie in the audioRendererInfo parameter and audio data source. +export default class VoiceCallDemoForAudioRenderer { + private renderModel = undefined; + private audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, // Sampling rate. + channels: audio.AudioChannel.CHANNEL_2, // Channel. + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, // Sampling format. + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW // Encoding format. + } + private audioRendererInfo = { + // Parameters corresponding to the call scenario need to be used. + content: audio.ContentType.CONTENT_TYPE_SPEECH, // Audio content type: speech. + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, // Audio stream usage type: voice communication. + rendererFlags: 0 // AudioRenderer flag. The default value is 0. + } + private audioRendererOptions = { + streamInfo: this.audioStreamInfo, + rendererInfo: this.audioRendererInfo + } + // Create an AudioRenderer instance, and set the events to listen for. + init() { + audio.createAudioRenderer(this.audioRendererOptions, (err, renderer) => { // Create an AudioRenderer instance. + if (!err) { + console.info(`${TAG}: creating AudioRenderer success`); + this.renderModel = renderer; + this.renderModel.on('stateChange', (state) => { // Set the events to listen for. A callback is invoked when the AudioRenderer is switched to the specified state. + if (state == 1) { + console.info('audio renderer state is: STATE_PREPARED'); + } + if (state == 2) { + console.info('audio renderer state is: STATE_RUNNING'); + } + }); + this.renderModel.on('markReach', 1000, (position) => { // Subscribe to the markReach event. A callback is triggered when the number of rendered frames reaches 1000. + if (position == 1000) { + console.info('ON Triggered successfully'); + } + }); + } else { + console.info(`${TAG}: creating AudioRenderer failed, error: ${err.message}`); + } + }); + } + // Start audio rendering. + async start() { + let stateGroup = [audio.AudioState.STATE_PREPARED, audio.AudioState.STATE_PAUSED, audio.AudioState.STATE_STOPPED]; + if (stateGroup.indexOf(this.renderModel.state) === -1) { // Rendering can be started only when the AudioRenderer is in the STATE_PREPARED, STATE_PAUSED, or STATE_STOPPED state. + console.error(TAG + 'start failed'); + return; + } + await this.renderModel.start(); // Start rendering. + const bufferSize = await this.renderModel.getBufferSize(); + // The process of reading audio file data is used as an example. In actual audio call development, audio data transmitted from the peer needs to be read. + let context = getContext(this); + let path = context.filesDir; + + const filePath = path + '/voice_call_data.wav'; // Sandbox path. The actual path is /data/storage/el2/base/haps/entry/files/voice_call_data.wav. + let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); + let stat = await fs.stat(filePath); + let buf = new ArrayBuffer(bufferSize); + let len = stat.size % bufferSize === 0 ? Math.floor(stat.size / bufferSize) : Math.floor(stat.size / bufferSize + 1); + for (let i = 0; i < len; i++) { + let options = { + offset: i * bufferSize, + length: bufferSize + }; + let readsize = await fs.read(file.fd, buf, options); + // buf indicates the audio data to be written to the buffer. Before calling AudioRenderer.write(), you can preprocess the audio data for personalized playback. The AudioRenderer reads the audio data written to the buffer for rendering. + let writeSize = await new Promise((resolve, reject) => { + this.renderModel.write(buf, (err, writeSize) => { + if (err) { + reject(err); + } else { + resolve(writeSize); + } + }); + }); + if (this.renderModel.state === audio.AudioState.STATE_RELEASED) { // The rendering stops if the AudioRenderer is in the STATE_RELEASED state. + fs.close(file); + await this.renderModel.stop(); + } + if (this.renderModel.state === audio.AudioState.STATE_RUNNING) { + if (i === len - 1) { // The rendering stops if the file finishes reading. + fs.close(file); + await this.renderModel.stop(); + } + } + } + } + // Pause the rendering. + async pause() { + // Rendering can be paused only when the AudioRenderer is in the STATE_RUNNING state. + if (this.renderModel.state !== audio.AudioState.STATE_RUNNING) { + console.info('Renderer is not running'); + return; + } + await this.renderModel.pause(); // Pause rendering. + if (this.renderModel.state === audio.AudioState.STATE_PAUSED) { + console.info('Renderer is paused.'); + } else { + console.error('Pausing renderer failed.'); + } + } + // Stop rendering. + async stop() { + // Rendering can be stopped only when the AudioRenderer is in the STATE_RUNNING or STATE_PAUSED state. + if (this.renderModel.state !== audio.AudioState.STATE_RUNNING && this.renderModel.state !== audio.AudioState.STATE_PAUSED) { + console.info('Renderer is not running or paused.'); + return; + } + await this.renderModel.stop(); // Stop rendering. + if (this.renderModel.state === audio.AudioState.STATE_STOPPED) { + console.info('Renderer stopped.'); + } else { + console.error('Stopping renderer failed.'); + } + } + // Release the instance. + async release() { + // The AudioRenderer can be released only when it is not in the STATE_RELEASED state. + if (this.renderModel.state === audio.AudioState.STATE_RELEASED) { + console.info('Renderer already released'); + return; + } + await this.renderModel.release(); // Release the instance. + if (this.renderModel.state === audio.AudioState.STATE_RELEASED) { + console.info('Renderer released'); + } else { + console.error('Renderer release failed.'); + } + } +} +``` + +## Using AudioCapturer to Record the Local Voice + +This process is similar to the process of [using AudioCapturer to develop audio recording](using-audiocapturer-for-recording.md). The key differences lie in the **audioCapturerInfo** parameter and audio data stream direction. In the **audioCapturerInfo** parameter used for audio calling, **source** must be set to **SOURCE_TYPE_VOICE_COMMUNICATION**. + +```ts +import audio from '@ohos.multimedia.audio'; +import fs from '@ohos.file.fs'; +const TAG = 'VoiceCallDemoForAudioCapturer'; +// The process is similar to the process of using AudioCapturer to develop audio recording. The key differences lie in the audioCapturerInfo parameter and audio data stream direction. +export default class VoiceCallDemoForAudioCapturer { + private audioCapturer = undefined; + private audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, // Sampling rate. + channels: audio.AudioChannel.CHANNEL_1, // Channel. + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, // Sampling format. + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW // Encoding format. + } + private audioCapturerInfo = { + // Parameters corresponding to the call scenario need to be used. + source: audio.SourceType.SOURCE_TYPE_VOICE_COMMUNICATION, // Audio source type: voice communication. + capturerFlags: 0 // AudioCapturer flag. The default value is 0. + } + private audioCapturerOptions = { + streamInfo: this.audioStreamInfo, + capturerInfo: this.audioCapturerInfo + } + // Create an AudioCapturer instance, and set the events to listen for. + init() { + audio.createAudioCapturer(this.audioCapturerOptions, (err, capturer) => { // Create an AudioCapturer instance. + if (err) { + console.error(`Invoke createAudioCapturer failed, code is ${err.code}, message is ${err.message}`); + return; + } + console.info(`${TAG}: create AudioCapturer success`); + this.audioCapturer = capturer; + this.audioCapturer.on('markReach', 1000, (position) => { // Subscribe to the markReach event. A callback is triggered when the number of captured frames reaches 1000. + if (position === 1000) { + console.info('ON Triggered successfully'); + } + }); + this.audioCapturer.on('periodReach', 2000, (position) => { // Subscribe to the periodReach event. A callback is triggered when the number of captured frames reaches 2000. + if (position === 2000) { + console.info('ON Triggered successfully'); + } + }); + }); + } + // Start audio recording. + async start() { + let stateGroup = [audio.AudioState.STATE_PREPARED, audio.AudioState.STATE_PAUSED, audio.AudioState.STATE_STOPPED]; + if (stateGroup.indexOf(this.audioCapturer.state) === -1) { // Recording can be started only when the AudioRenderer is in the STATE_PREPARED, STATE_PAUSED, or STATE_STOPPED state. + console.error(`${TAG}: start failed`); + return; + } + await this.audioCapturer.start(); // Start recording. + // The following describes how to write audio data to a file. In actual audio call development, the local audio data needs to be encoded and packed, and then sent to the peer through the network. + let context = getContext(this); + const path = context.filesDir + '/voice_call_data.wav'; // Path for storing the recorded audio file. + let file = fs.openSync(path, 0o2 | 0o100); // Create the file if it does not exist. + let fd = file.fd; + let numBuffersToCapture = 150; // Write data for 150 times. + let count = 0; + while (numBuffersToCapture) { + let bufferSize = await this.audioCapturer.getBufferSize(); + let buffer = await this.audioCapturer.read(bufferSize, true); + let options = { + offset: count * bufferSize, + length: bufferSize + }; + if (buffer === undefined) { + console.error(`${TAG}: read buffer failed`); + } else { + let number = fs.writeSync(fd, buffer, options); + console.info(`${TAG}: write date: ${number}`); + } + numBuffersToCapture--; + count++; + } + } + // Stop recording. + async stop() { + // The AudioCapturer can be stopped only when it is in STATE_RUNNING or STATE_PAUSED state. + if (this.audioCapturer.state !== audio.AudioState.STATE_RUNNING && this.audioCapturer.state !== audio.AudioState.STATE_PAUSED) { + console.info('Capturer is not running or paused'); + return; + } + await this.audioCapturer.stop(); // Stop recording. + if (this.audioCapturer.state === audio.AudioState.STATE_STOPPED) { + console.info('Capturer stopped'); + } else { + console.error('Capturer stop failed'); + } + } + // Release the instance. + async release() { + // The AudioCapturer can be released only when it is not in the STATE_RELEASED or STATE_NEW state. + if (this.audioCapturer.state === audio.AudioState.STATE_RELEASED || this.audioCapturer.state === audio.AudioState.STATE_NEW) { + console.info('Capturer already released'); + return; + } + await this.audioCapturer.release(); // Release the instance. + if (this.audioCapturer.state == audio.AudioState.STATE_RELEASED) { + console.info('Capturer released'); + } else { + console.error('Capturer release failed'); + } + } +} +``` diff --git a/en/application-dev/media/audio-call-overview.md b/en/application-dev/media/audio-call-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..1462198c201203da3eecc902de556c005ad3aae9 --- /dev/null +++ b/en/application-dev/media/audio-call-overview.md @@ -0,0 +1,49 @@ +# Audio Call Development + +Typically, audio calls are classified into VoIP calls and cellular calls. + +- Voice over Internet Protocol (VoIP) is a technology that enables you to make voice calls using a broadband Internet connection. During a VoIP call, call information is packed into data packets and transmitted over the network. Therefore, the VoIP call has high requirements on the network quality, and the call quality is closely related to the network connection speed. + +- Cellular call refers to the traditional telephony service provided by carriers. Currently, APIs for developing cellular calling are available only for system applications. + +When developing the audio call service, you must use a proper audio processing policy based on the [audio scene](#audio-scene) and [ringer mode](#ringer-mode). + +## Audio Scene + +When an application uses the audio call service, the system switches to the call-related audio scene (specified by [AudioScene](../reference/apis/js-apis-audio.md#audioscene8)). The system has preset multiple audio scenes, including ringing, cellular call, and voice chat, and uses a scene-specific policy to process audio. + +For example, in the cellular call audio scene, the system prioritizes voice clarity. To deliver a crystal clear voice during calls, the system uses the 3A algorithm to preprocess audio data, suppress echoes, eliminates background noise, and adjusts the volume range. The 3A algorithm refers to three audio processing algorithms: Acoustic Echo Cancellation (AEC), Active Noise Control (ANC), and Automatic Gain Control (AGC). + +Currently, the following audio scenes are preset: + +- **AUDIO_SCENE_DEFAULT**: default audio scene, which can be used in all scenarios except audio calls. + +- **AUDIO_SCENE_RINGING**: ringing audio scene, which is used when a call is coming and is open only to system applications. + +- **AUDIO_SCENE_PHONE_CALL**: cellular call audio scene, which is used for cellular calls and is open only to system applications. + +- **AUDIO_SCENE_VOICE_CHAT**: voice chat scene, which is used for VoIP calls. + +The application can call **getAudioScene** in the [AudioManager](../reference/apis/js-apis-audio.md#audiomanager) class to obtain the audio scene in use. Before starting or stopping using the audio call service, the application can call this API to check whether the system has switched to the suitable audio scene. + +## Ringer Mode + +When an audio call is coming, the application notifies the user by playing a ringtone or vibrating, depending on the setting of [AudioRingMode](../reference/apis/js-apis-audio.md#audioringmode). + +The system has preset the following ringer modes: + +- **RINGER_MODE_SILENT**: silent mode, in which no sound is played when a call is coming in. + +- **RINGER_MODE_VIBRATE**: vibration mode, in which no sound is played but the device vibrates when a call is coming in. + +- **RINGER_MODE_NORMAL**: normal mode, in which a ringtone is played when a call is coming in. + +The application can call **getRingerMode** in the [AudioVolumeGroupManager](../reference/apis/js-apis-audio.md#audiovolumegroupmanager9) class to obtain the ringer mode in use so as to use a proper policy to notify the user. + +If the application wants to obtain the ringer mode changes in time, it can call **on('ringerModeChange')** in the **AudioVolumeGroupManager** class to listen for the changes. When the ringer mode changes, it will receive a notification and can make adjustment accordingly. + +## Audio Device Switching During a Call + +When a call is coming, the system selects an appropriate audio device based on the default priority. The application can switch the call to another audio device as required. + +The audio devices that can be used for the audio call are specified by [CommunicationDeviceType](../reference/apis/js-apis-audio.md#communicationdevicetype9). The application can call **isCommunicationDeviceActive** in the [AudioRoutingManager](../reference/apis/js-apis-audio.md#audioroutingmanager9) class to check whether a communication device is active. It can also call **setCommunicationDevice** in the **AudioRoutingManager** class to set a communication device to the active state so that the device can be used for the call. diff --git a/en/application-dev/media/audio-capturer.md b/en/application-dev/media/audio-capturer.md deleted file mode 100644 index 8371b6248d71f48e9088da849dc36c3edb2be3cf..0000000000000000000000000000000000000000 --- a/en/application-dev/media/audio-capturer.md +++ /dev/null @@ -1,254 +0,0 @@ -# Audio Capture Development - -## Introduction - -You can use the APIs provided by **AudioCapturer** to record raw audio files, thereby implementing audio data collection. - -**Status check**: During application development, you are advised to use **on('stateChange')** to subscribe to state changes of the **AudioCapturer** instance. This is because some operations can be performed only when the audio capturer is in a given state. If the application performs an operation when the audio capturer is not in the given state, the system may throw an exception or generate other undefined behavior. - -## Working Principles - -This following figure shows the audio capturer state transitions. - -**Figure 1** Audio capturer state transitions - -![audio-capturer-state](figures/audio-capturer-state.png) - -- **PREPARED**: The audio capturer enters this state by calling **create()**. -- **RUNNING**: The audio capturer enters this state by calling **start()** when it is in the **PREPARED** state or by calling **start()** when it is in the **STOPPED** state. -- **STOPPED**: The audio capturer in the **RUNNING** state can call **stop()** to stop playing audio data. -- **RELEASED**: The audio capturer in the **PREPARED** or **STOPPED** state can use **release()** to release all occupied hardware and software resources. It will not transit to any other state after it enters the **RELEASED** state. - -## Constraints - -Before developing the audio data collection feature, configure the **ohos.permission.MICROPHONE** permission for your application. For details, see [Permission Application Guide](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). - -## How to Develop - -For details about the APIs, see [AudioCapturer in Audio Management](../reference/apis/js-apis-audio.md#audiocapturer8). - -1. Use **createAudioCapturer()** to create an **AudioCapturer** instance. - - Set parameters of the **AudioCapturer** instance in **audioCapturerOptions**. This instance is used to capture audio, control and obtain the recording state, and register a callback for notification. - - ```js - import audio from '@ohos.multimedia.audio'; - - let audioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - let audioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 // 0 is the extended flag bit of the audio capturer. The default value is 0. - } - - let audioCapturerOptions = { - streamInfo: audioStreamInfo, - capturerInfo: audioCapturerInfo - } - - let audioCapturer = await audio.createAudioCapturer(audioCapturerOptions); - console.log('AudioRecLog: Create audio capturer success.'); - ``` - -2. Use **start()** to start audio recording. - - The capturer state will be **STATE_RUNNING** once the audio capturer is started. The application can then begin reading buffers. - - ```js - import audio from '@ohos.multimedia.audio'; - - async function startCapturer() { - let state = audioCapturer.state; - // The audio capturer should be in the STATE_PREPARED, STATE_PAUSED, or STATE_STOPPED state after being started. - if (state != audio.AudioState.STATE_PREPARED || state != audio.AudioState.STATE_PAUSED || - state != audio.AudioState.STATE_STOPPED) { - console.info('Capturer is not in a correct state to start'); - return; - } - await audioCapturer.start(); - - state = audioCapturer.state; - if (state == audio.AudioState.STATE_RUNNING) { - console.info('AudioRecLog: Capturer started'); - } else { - console.error('AudioRecLog: Capturer start failed'); - } - } - ``` - -3. Read the captured audio data and convert it to a byte stream. Call **read()** repeatedly to read the data until the application stops the recording. - - The following example shows how to write recorded data into a file. - - ```js - import fs from '@ohos.file.fs'; - - let state = audioCapturer.state; - // The read operation can be performed only when the state is STATE_RUNNING. - if (state != audio.AudioState.STATE_RUNNING) { - console.info('Capturer is not in a correct state to read'); - return; - } - - const path = '/data/data/.pulse_dir/capture_js.wav'; // Path for storing the collected audio file. - let file = fs.openSync(filePath, 0o2); - let fd = file.fd; - if (file !== null) { - console.info('AudioRecLog: file created'); - } else { - console.info('AudioRecLog: file create : FAILED'); - return; - } - - if (fd !== null) { - console.info('AudioRecLog: file fd opened in append mode'); - } - - let numBuffersToCapture = 150; // Write data for 150 times. - let count = 0; - while (numBuffersToCapture) { - let bufferSize = await audioCapturer.getBufferSize(); - let buffer = await audioCapturer.read(bufferSize, true); - let options = { - offset: count * this.bufferSize, - length: this.bufferSize - } - if (typeof(buffer) == undefined) { - console.info('AudioRecLog: read buffer failed'); - } else { - let number = fs.writeSync(fd, buffer, options); - console.info(`AudioRecLog: data written: ${number}`); - } - numBuffersToCapture--; - count++; - } - ``` - -4. Once the recording is complete, call **stop()** to stop the recording. - - ```js - async function StopCapturer() { - let state = audioCapturer.state; - // The audio capturer can be stopped only when it is in STATE_RUNNING or STATE_PAUSED state. - if (state != audio.AudioState.STATE_RUNNING && state != audio.AudioState.STATE_PAUSED) { - console.info('AudioRecLog: Capturer is not running or paused'); - return; - } - - await audioCapturer.stop(); - - state = audioCapturer.state; - if (state == audio.AudioState.STATE_STOPPED) { - console.info('AudioRecLog: Capturer stopped'); - } else { - console.error('AudioRecLog: Capturer stop failed'); - } - } - ``` - -5. After the task is complete, call **release()** to release related resources. - - ```js - async function releaseCapturer() { - let state = audioCapturer.state; - // The audio capturer can be released only when it is not in the STATE_RELEASED or STATE_NEW state. - if (state == audio.AudioState.STATE_RELEASED || state == audio.AudioState.STATE_NEW) { - console.info('AudioRecLog: Capturer already released'); - return; - } - - await audioCapturer.release(); - - state = audioCapturer.state; - if (state == audio.AudioState.STATE_RELEASED) { - console.info('AudioRecLog: Capturer released'); - } else { - console.info('AudioRecLog: Capturer release failed'); - } - } - ``` - -6. (Optional) Obtain the audio capturer information. - - You can use the following code to obtain the audio capturer information: - - ```js - // Obtain the audio capturer state. - let state = audioCapturer.state; - - // Obtain the audio capturer information. - let audioCapturerInfo : audio.AuduioCapturerInfo = await audioCapturer.getCapturerInfo(); - - // Obtain the audio stream information. - let audioStreamInfo : audio.AudioStreamInfo = await audioCapturer.getStreamInfo(); - - // Obtain the audio stream ID. - let audioStreamId : number = await audioCapturer.getAudioStreamId(); - - // Obtain the Unix timestamp, in nanoseconds. - let audioTime : number = await audioCapturer.getAudioTime(); - - // Obtain a proper minimum buffer size. - let bufferSize : number = await audioCapturer.getBufferSize(); - ``` - -7. (Optional) Use **on('markReach')** to subscribe to the mark reached event, and use **off('markReach')** to unsubscribe from the event. - - After the mark reached event is subscribed to, when the number of frames collected by the audio capturer reaches the specified value, a callback is triggered and the specified value is returned. - - ```js - audioCapturer.on('markReach', (reachNumber) => { - console.info('Mark reach event Received'); - console.info(`The Capturer reached frame: ${reachNumber}`); - }); - - audioCapturer.off('markReach'); // Unsubscribe from the mark reached event. This event will no longer be listened for. - ``` - -8. (Optional) Use **on('periodReach')** to subscribe to the period reached event, and use **off('periodReach')** to unsubscribe from the event. - - After the period reached event is subscribed to, each time the number of frames collected by the audio capturer reaches the specified value, a callback is triggered and the specified value is returned. - - ```js - audioCapturer.on('periodReach', (reachNumber) => { - console.info('Period reach event Received'); - console.info(`In this period, the Capturer reached frame: ${reachNumber}`); - }); - - audioCapturer.off('periodReach'); // Unsubscribe from the period reached event. This event will no longer be listened for. - ``` - -9. If your application needs to perform some operations when the audio capturer state is updated, it can subscribe to the state change event. When the audio capturer state is updated, the application receives a callback containing the event type. - - ```js - audioCapturer.on('stateChange', (state) => { - console.info(`AudioCapturerLog: Changed State to : ${state}`) - switch (state) { - case audio.AudioState.STATE_PREPARED: - console.info('--------CHANGE IN AUDIO STATE----------PREPARED--------------'); - console.info('Audio State is : Prepared'); - break; - case audio.AudioState.STATE_RUNNING: - console.info('--------CHANGE IN AUDIO STATE----------RUNNING--------------'); - console.info('Audio State is : Running'); - break; - case audio.AudioState.STATE_STOPPED: - console.info('--------CHANGE IN AUDIO STATE----------STOPPED--------------'); - console.info('Audio State is : stopped'); - break; - case audio.AudioState.STATE_RELEASED: - console.info('--------CHANGE IN AUDIO STATE----------RELEASED--------------'); - console.info('Audio State is : released'); - break; - default: - console.info('--------CHANGE IN AUDIO STATE----------INVALID--------------'); - console.info('Audio State is : invalid'); - break; - } - }); - ``` diff --git a/en/application-dev/media/audio-input-device-management.md b/en/application-dev/media/audio-input-device-management.md new file mode 100644 index 0000000000000000000000000000000000000000..ebdadfaad7a9316cf055d3216ac3a94a1b052a33 --- /dev/null +++ b/en/application-dev/media/audio-input-device-management.md @@ -0,0 +1,88 @@ +# Audio Input Device Management + +If a device is connected to multiple audio input devices, you can use **AudioRoutingManager** to specify an audio input device to record audio. For details about the API reference, see [AudioRoutingManager](../reference/apis/js-apis-audio.md#audioroutingmanager9). + +## Creating an AudioRoutingManager Instance + +Before using **AudioRoutingManager** to manage audio devices, import the audio module and create an **AudioManager** instance. + +```ts +import audio from '@ohos.multimedia.audio'; // Import the audio module. + +let audioManager = audio.getAudioManager(); // Create an AudioManager instance. + +let audioRoutingManager = audioManager.getRoutingManager(); // Call an API of AudioManager to create an AudioRoutingManager instance. +``` + +## Supported Audio Input Device Types + +The table below lists the supported audio input devices. + +| Name| Value| Description| +| -------- | -------- | -------- | +| WIRED_HEADSET | 3 | Wired headset with a microphone.| +| BLUETOOTH_SCO | 7 | Bluetooth device using Synchronous Connection Oriented (SCO) links.| +| MIC | 15 | Microphone.| +| USB_HEADSET | 22 | USB Type-C headset.| + +## Obtaining Input Device Information + +Use **getDevices()** to obtain information about all the input devices. + +```ts +audioRoutingManager.getDevices(audio.DeviceFlag.INPUT_DEVICES_FLAG).then((data) => { + console.info('Promise returned to indicate that the device list is obtained.'); +}); +``` + +## Listening for Device Connection State Changes + +Set a listener to listen for changes of the device connection state. When a device is connected or disconnected, a callback is triggered. + +```ts +// Listen for connection state changes of audio devices. +audioRoutingManager.on('deviceChange', audio.DeviceFlag.INPUT_DEVICES_FLAG, (deviceChanged) => { + console.info('device change type: ' + deviceChanged.type); // Device connection state change. The value 0 means that the device is connected and 1 means that the device is disconnected. + console.info('device descriptor size : ' + deviceChanged.deviceDescriptors.length); + console.info('device change descriptor: ' + deviceChanged.deviceDescriptors[0].deviceRole); // Device role. + console.info('device change descriptor: ' + deviceChanged.deviceDescriptors[0].deviceType); // Device type. +}); + +// Cancel the listener for the connection state changes of audio devices. +audioRoutingManager.off('deviceChange', (deviceChanged) => { + console.info('Should be no callback.'); +}); +``` + +## Selecting an Audio Input Device (for System Applications only) + +Currently, only one input device can be selected, and the device ID is used as the unique identifier. For details about audio device descriptors, see [AudioDeviceDescriptors](../reference/apis/js-apis-audio.md#audiodevicedescriptors). + +> **NOTE** +> +> The user can connect to a group of audio devices (for example, a pair of Bluetooth headsets), but the system treats them as one device (a group of devices that share the same device ID). + +```ts +let inputAudioDeviceDescriptor = [{ + deviceRole : audio.DeviceRole.INPUT_DEVICE, + deviceType : audio.DeviceType.EARPIECE, + id : 1, + name : "", + address : "", + sampleRates : [44100], + channelCounts : [2], + channelMasks : [0], + networkId : audio.LOCAL_NETWORK_ID, + interruptGroupId : 1, + volumeGroupId : 1, +}]; + +async function getRoutingManager(){ + audioRoutingManager.selectInputDevice(inputAudioDeviceDescriptor).then(() => { + console.info('Invoke selectInputDevice succeeded.'); + }).catch((err) => { + console.error(`Invoke selectInputDevice failed, code is ${err.code}, message is ${err.message}`); + }); +} + +``` diff --git a/en/application-dev/media/audio-interruptmode.md b/en/application-dev/media/audio-interruptmode.md deleted file mode 100644 index 48a53bf5d5990ac88aae1271466a6aa36d52ac98..0000000000000000000000000000000000000000 --- a/en/application-dev/media/audio-interruptmode.md +++ /dev/null @@ -1,55 +0,0 @@ -# Audio Interruption Mode Development - -## Introduction -The audio interruption mode is used to control the playback of multiple audio streams. - -Audio applications can set the audio interruption mode to independent or shared under **AudioRenderer**. - -In shared mode, multiple audio streams share one session ID. In independent mode, each audio stream has an independent session ID. - -**Asynchronous operation**: To prevent the UI thread from being blocked, most **AudioRenderer** calls are asynchronous. Each API provides the callback and promise functions. The following examples use the promise functions. - -## How to Develop - -For details about the APIs, see [AudioRenderer in Audio Management](../reference/apis/js-apis-audio.md#audiorenderer8). - -1. Use **createAudioRenderer()** to create an **AudioRenderer** instance. - - Set parameters of the **AudioRenderer** instance in **audioRendererOptions**. - - This instance is used to render audio, control and obtain the rendering status, and register a callback for notification. - -```js - import audio from '@ohos.multimedia.audio'; - - var audioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var audioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var audioRendererOptions = { - streamInfo: audioStreamInfo, - rendererInfo: audioRendererInfo - } - -let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); - ``` - -2. Set the audio interruption mode. - - After the **AudioRenderer** instance is initialized, you can set the audio interruption mode.
- - ```js - var mode_ = audio.InterruptMode.SHARE_MODE; - await this.audioRenderer.setInterruptMode(mode_).then(() => { - console.log('[JSAR] [SetInterruptMode] Setting: '+ (mode_ == 0? " share mode":"independent mode") + "success"); - }); - ``` diff --git a/en/application-dev/media/audio-output-device-management.md b/en/application-dev/media/audio-output-device-management.md new file mode 100644 index 0000000000000000000000000000000000000000..ad20276c60ce7e535f99778e18d04e4e50e29dc6 --- /dev/null +++ b/en/application-dev/media/audio-output-device-management.md @@ -0,0 +1,90 @@ +# Audio Output Device Management + +If a device is connected to multiple audio output devices, you can use **AudioRoutingManager** to specify an audio output device to play audio. For details about the API reference, see [AudioRoutingManager](../reference/apis/js-apis-audio.md#audioroutingmanager9). + +## Creating an AudioRoutingManager Instance + +Before using **AudioRoutingManager** to manage audio devices, import the audio module and create an **AudioManager** instance. + +```ts +import audio from '@ohos.multimedia.audio'; // Import the audio module. + +let audioManager = audio.getAudioManager(); // Create an AudioManager instance. + +let audioRoutingManager = audioManager.getRoutingManager(); // Call an API of AudioManager to create an AudioRoutingManager instance. +``` + +## Supported Audio Output Device Types + +The table below lists the supported audio output devices. + +| Name| Value| Description| +| -------- | -------- | -------- | +| EARPIECE | 1 | Earpiece.| +| SPEAKER | 2 | Speaker.| +| WIRED_HEADSET | 3 | Wired headset with a microphone.| +| WIRED_HEADPHONES | 4 | Wired headset without microphone.| +| BLUETOOTH_SCO | 7 | Bluetooth device using Synchronous Connection Oriented (SCO) links.| +| BLUETOOTH_A2DP | 8 | Bluetooth device using Advanced Audio Distribution Profile (A2DP) links.| +| USB_HEADSET | 22 | USB Type-C headset.| + +## Obtaining Output Device Information + +Use **getDevices()** to obtain information about all the output devices. + +```ts +audioRoutingManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data) => { + console.info('Promise returned to indicate that the device list is obtained.'); +}); +``` + +## Listening for Device Connection State Changes + +Set a listener to listen for changes of the device connection state. When a device is connected or disconnected, a callback is triggered. + +```ts +// Listen for connection state changes of audio devices. +audioRoutingManager.on('deviceChange', audio.DeviceFlag.OUTPUT_DEVICES_FLAG, (deviceChanged) => { + console.info('device change type: ' + deviceChanged.type); // Device connection state change. The value 0 means that the device is connected and 1 means that the device is disconnected. + console.info('device descriptor size : ' + deviceChanged.deviceDescriptors.length); + console.info('device change descriptor: ' + deviceChanged.deviceDescriptors[0].deviceRole); // Device role. + console.info('device change descriptor: ' + deviceChanged.deviceDescriptors[0].deviceType); // Device type. +}); + +// Cancel the listener for the connection state changes of audio devices. +audioRoutingManager.off('deviceChange', (deviceChanged) => { + console.info('Should be no callback.'); +}); +``` + +## Selecting an Audio Output Device (for System Applications only) + +Currently, only one output device can be selected, and the device ID is used as the unique identifier. For details about audio device descriptors, see [AudioDeviceDescriptors](../reference/apis/js-apis-audio.md#audiodevicedescriptors). + +> **NOTE** +> +> The user can connect to a group of audio devices (for example, a pair of Bluetooth headsets), but the system treats them as one device (a group of devices that share the same device ID). + +```ts +let outputAudioDeviceDescriptor = [{ + deviceRole : audio.DeviceRole.OUTPUT_DEVICE, + deviceType : audio.DeviceType.SPEAKER, + id : 1, + name : "", + address : "", + sampleRates : [44100], + channelCounts : [2], + channelMasks : [0], + networkId : audio.LOCAL_NETWORK_ID, + interruptGroupId : 1, + volumeGroupId : 1, +}]; + +async function selectOutputDevice(){ + audioRoutingManager.selectOutputDevice(outputAudioDeviceDescriptor).then(() => { + console.info('Invoke selectOutputDevice succeeded.'); + }).catch((err) => { + console.error(`Invoke selectOutputDevice failed, code is ${err.code}, message is ${err.message}`); + }); +} +``` diff --git a/en/application-dev/media/audio-overview.md b/en/application-dev/media/audio-overview.md deleted file mode 100755 index e1fd93eab8238b8ae55c9ce3dff2e807a1585a00..0000000000000000000000000000000000000000 --- a/en/application-dev/media/audio-overview.md +++ /dev/null @@ -1,20 +0,0 @@ -# Audio Overview - -You can use APIs provided by the audio module to implement audio-related features, including audio playback and volume management. - -## Basic Concepts - -- **Sampling** - Sampling is a process to obtain discrete-time signals by extracting samples from analog signals in a continuous time domain at a specific interval. - -- **Sampling rate** - Sampling rate is the number of samples extracted from a continuous signal per second to form a discrete signal. It is measured in Hz. Generally, human hearing range is from 20 Hz to 20 kHz. Common audio sampling rates include 8 kHz, 11.025 kHz, 22.05 kHz, 16 kHz, 37.8 kHz, 44.1 kHz, 48 kHz, 96 kHz, and 192 kHz. - -- **Channel** - Channels refer to different spatial positions where independent audio signals are recorded or played. The number of channels is the number of audio sources used during audio recording, or the number of speakers used for audio playback. - -- **Audio frame** - Audio data is in stream form. For the convenience of audio algorithm processing and transmission, it is generally agreed that a data amount in a unit of 2.5 to 60 milliseconds is one audio frame. This unit is called sampling time, and its length is specific to codecs and the application requirements. - -- **PCM**
- Pulse code modulation (PCM) is a method used to digitally represent sampled analog signals. It converts continuous-time analog signals into discrete-time digital signal samples. diff --git a/en/application-dev/media/audio-playback-concurrency.md b/en/application-dev/media/audio-playback-concurrency.md new file mode 100644 index 0000000000000000000000000000000000000000..0b36594f6bef62c7ba7588bc8977af67609a6c9d --- /dev/null +++ b/en/application-dev/media/audio-playback-concurrency.md @@ -0,0 +1,119 @@ +# Audio Playback Concurrency Policy + +## Audio Interruption Policy + +If multiple audio streams are played at the same time, the user may feel uncomfortable or even painful. To address this issue, OpenHarmony presets the audio interruption policy so that only the audio stream holding audio focus can be played. + +When an application attempts to play an audio, the system requests audio focus for the audio stream. The audio stream that gains the focus can be played. If the request is rejected, the audio stream cannot be played. If the audio stream is interrupted by another, it loses the focus and therefore the playback is paused. All these actions are automatically performed by the system and do not require additional operations on the application. However, to maintain state consistency between the application and the system and ensure good user experience, it is recommended that the application [listen for the audio interruption event](#listening-for-the-audio-interruption-event) and perform the corresponding processing when receiving such an event (specified by [InterruptEvent](../reference/apis/js-apis-audio.md#interruptevent9)). + +OpenHarmony presets two [audio interruption modes](#audio-interruption-mode) to specify whether audio concurrency is controlled by the application or system. You can choose a mode for each of the audio streams created by the same application. + +The audio interruption policy determines the operations (for example, pause, resume, duck, or unduck) to be performed on the audio stream. These operations can be performed by the system or application. To distinguish the body that executes the operations, the [audio interruption type](#audio-interruption-type) is introduced, and two audio interruption types are preset. + +### Audio Interruption Mode + +Two audio interruption modes, specified by [InterruptMode](../reference/apis/js-apis-audio.md#interruptmode9), are preset in the audio interruption policy: + +- **SHARED_MODE**: Multiple audio streams created by an application share one audio focus. The concurrency rules between these audio streams are determined by the application, without the use of the audio interruption policy. However, if another application needs to play audio while one of these audio streams is being played, the audio interruption policy is triggered. + +- **INDEPENDENT_MODE**: Each audio stream created by an application has an independent audio focus. When multiple audio streams are played concurrently, the audio interruption policy is triggered. + +The application can select an audio interruption mode as required. By default, the **SHARED_MODE** is used. + +You can set the audio interruption mode in either of the following ways: + +- If you [use the AVPlayer to develop audio playback](using-avplayer-for-playback.md), set the [audioInterruptMode](../reference/apis/js-apis-media.md#avplayer9) attribute of the AVPlayer to set the audio interruption mode. + +- If you [use the AudioRenderer to develop audio playback](using-audiorenderer-for-playback.md), call [setInterruptMode](../reference/apis/js-apis-audio.md#setinterruptmode9) of the AudioRenderer to set the audio interruption mode. + + +### Audio Interruption Type + +The audio interruption policy (containing two audio interruption modes) determines the operation to be performed on each audio stream. These operations can be carried out by the system or application. To distinguish the executors, the audio interruption type, specified by [InterruptForceType](../reference/apis/js-apis-audio.md#interruptforcetype9), is introduced. + +- **INTERRUPT_FORCE**: The operation is performed by the system. The system forcibly interrupts audio playback. + +- **INTERRUPT_SHARE**: The operation is performed by the application. The application can take action or ignore as required. + +For the pause operation, the **INTERRUPT_FORCE** type is always used and cannot be changed by the application. However, the application can choose to use **INTERRUPT_SHARE** for other operations, such as the resume operation. The application can obtain the audio interruption type based on the value of the member variable **forceType** in the audio interruption event. + +During audio playback, the system automatically requests, holds, and releases the focus for the audio stream. When audio interruption occurs, the system forcibly pauses or stops playing or ducks the volume down for the audio stream, and sends an audio interruption event callback to the application. To maintain state consistency between the application and the system and ensure good user experience, it is recommended that the application [listen for the audio interruption event](#listening-for-the-audio-interruption-event) and perform processing when receiving such an event. + +For operations that cannot be forcibly performed by the system (for example, resume), the system sends the audio interruption event containing **INTERRUPT_SHARE**, and the application can choose to take action or ignore. + +## Listening for the Audio Interruption Event + +Your application are advised to listen for the audio interruption event when playing audio. When audio interruption occurs, the system performs processing on the audio stream according to the preset policy, and sends the audio interruption event to the application. + +Upon the receipt of the event, the application carries out processing based on the event content to ensure that the application state is consistent with the expected effect. + +You can use either of the following methods to listen for the audio interruption event: + +- If you [use the AVPlayer to develop audio playback](using-avplayer-for-playback.md), call [on('audioInterrupt')](../reference/apis/js-apis-media.md#onaudiointerrupt9) of the AVPlayer to listen for the event. + +- If you [use the AudioRenderer to develop audio playback](using-audiorenderer-for-playback.md), call [on('audioInterrupt')](../reference/apis/js-apis-audio.md#onaudiointerrupt9) of the AudioRenderer to listen for the event. + + To deliver an optimal user experience, the application needs to perform processing based on the event content. The following uses the AudioRenderer as an example to describe the recommended application processing. (The recommended processing is similar if the AVPlayer is used to develop audio playback.) You can customize the code to implement your own audio playback functionality or application processing based on service requirements. + +```ts +let isPlay; // An identifier specifying whether the audio stream is being played. In actual development, this parameter corresponds to the module related to the audio playback state. +let isDucked; // An identifier specifying whether to duck the volume down. In actual development, this parameter corresponds to the module related to the audio volume. +let started; // An identifier specifying whether the start operation is successful. + +async function onAudioInterrupt(){ + // The AudioRenderer is used as an example to describe how to develop audio playback. The audioRenderer variable is the AudioRenderer instance created for playback. + audioRenderer.on('audioInterrupt', async(interruptEvent) => { + // When an audio interruption event occurs, the audioRenderer receives the interruptEvent callback and performs processing based on the content in the callback. + // The audioRenderer reads the value of interruptEvent.forceType to see whether the system has forcibly performed the operation. + // The audioRenderer then reads the value of interruptEvent.hintType and performs corresponding processing. + if (interruptEvent.forceType === audio.InterruptForceType.INTERRUPT_FORCE) { + // If the value of interruptEvent.forceType is INTERRUPT_FORCE, the system has performed audio-related processing, and the application needs to update its state and make adjustments accordingly. + switch (interruptEvent.hintType) { + case audio.InterruptHint.INTERRUPT_HINT_PAUSE: + // The system has paused the audio stream (the focus is temporarily lost). To ensure state consistency, the application needs to switch to the audio paused state. + // Temporarily losing the focus: After the other audio stream releases the focus, the current audio stream will receive the audio interruption event corresponding to resume and automatically resume the playback. + isPlay = false; // A simplified processing indicating several operations for switching the application to the audio paused state. + break; + case audio.InterruptHint.INTERRUPT_HINT_STOP: + // The system has stopped the audio stream (the focus is permanently lost). To ensure state consistency, the application needs to switch to the audio paused state. + // Permanently losing the focus: No audio interruption event will be received. The user must manually trigger the operation to resume playback. + isPlay = false; // A simplified processing indicating several operations for switching the application to the audio paused state. + break; + case audio.InterruptHint.INTERRUPT_HINT_DUCK: + // The system has ducked the volume down (20% of the normal volume by default). To ensure state consistency, the application needs to switch to the volume decreased state. + // If the application does not want to play at a lower volume, it can select another processing mode, for example, proactively pausing the playback. + isDucked = true; // A simplified processing indicating several operations for switching the application to the volume decreased state. + break; + case audio.InterruptHint.INTERRUPT_HINT_UNDUCK: + // The system has restored the audio volume to normal. To ensure state consistency, the application needs to switch to the normal volume state. + isDucked = false; // A simplified processing indicating several operations for switching the application to the normal volume state. + break; + default: + break; + } + } else if (interruptEvent.forceType === audio.InterruptForceType.INTERRUPT_SHARE) { + // If the value of interruptEvent.forceType is INTERRUPT_SHARE, the application can take action or ignore as required. + switch (interruptEvent.hintType) { + case audio.InterruptHint.INTERRUPT_HINT_RESUME: + // The paused audio stream can be played. It is recommended that the application continue to play the audio stream and switch to the audio playing state. + // If the application does not want to continue the playback, it can ignore the event. + // To continue the playback, the application needs to call start(), and use the identifier variable started to record the execution result of start(). + await audioRenderer.start().then(async function () { + started = true; // Calling start() is successful. + }).catch((err) => { + started = false; // Calling start() fails. + }); + // If calling start() is successful, the application needs to switch to the audio playing state. + if (started) { + isPlay = true; // A simplified processing indicating several operations for switching the application to the audio playing state. + } else { + // Resuming the audio playback fails. + } + break; + default: + break; + } + } + }); +} +``` diff --git a/en/application-dev/media/audio-playback-overview.md b/en/application-dev/media/audio-playback-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..d17970d6de9b8b238db74d971ad5f58c605462eb --- /dev/null +++ b/en/application-dev/media/audio-playback-overview.md @@ -0,0 +1,25 @@ +# Audio Playback Development + +## Selecting an Audio Playback Development Mode + +OpenHarmony provides multiple classes for you to develop audio playback applications. You can select them based on the audio data formats, audio sources, audio usage scenarios, and even the programming language you use. Selecting a suitable class helps you reduce development workload and your application deliver a better effect. + +- [AVPlayer](using-avplayer-for-playback.md): provides ArkTS and JS APIs to implement audio and video playback. It also supports parsing streaming media and local assets, decapsulating media assets, decoding audio, and outputting audio. It can play audio files in MP3 and M4A formats, but not in PCM format. + +- [AudioRenderer](using-audiorenderer-for-playback.md): provides ArkTS and JS API to implement audio output. It supports only the PCM format and requires applications to continuously write audio data. The applications can perform data preprocessing, for example, setting the sampling rate and bit width of audio files, before audio input. This class can be used to develop more professional and diverse playback applications. To use this class, you must have basic audio processing knowledge. + +- [OpenSLES](using-opensl-es-for-playback.md): provides a set of standard, cross-platform, yet unique native audio APIs. It supports audio output in PCM format and is applicable to playback applications that are ported from other embedded platforms or that implements audio output at the native layer. + +- [TonePlayer](using-toneplayer-for-playback.md): provides ArkTS and JS API to implement the playback of dialing tones and ringback tones. It can be used to play the content selected from a fixed type range, without requiring the input of media assets or audio data. This class is application to specific scenarios where dialing tones and ringback tones are played. is available only to system applications. + +- Applications often need to use short sound effects, such as camera shutter sound effect, key press sound effect, and game shooting sound effect. Currently, only the **AVPlayer** class can implement audio file playback. More APIs will be provided to support this scenario in later versions. + +## Precautions for Developing Audio Playback Applications + +To enable your application to play a video in the background or when the screen is off, the application must meet the following conditions: + +1. The application is registered with the system for unified management through the **AVSession** APIs. Otherwise, the playback will be forcibly stopped when the application switches to the background. For details, see [AVSession Development](avsession-overview.md). + +2. The application must request a continuous task to prevent from being suspended. For details, see [Continuous Task Development](../task-management/continuous-task-dev-guide.md). + +If the playback is interrupted when the application switches to the background, you can view the log to see whether the application has requested a continuous task. If the application has requested a continuous task, there is no log recording **pause id**; otherwise, there is a log recording **pause id**. diff --git a/en/application-dev/media/audio-playback-stream-management.md b/en/application-dev/media/audio-playback-stream-management.md new file mode 100644 index 0000000000000000000000000000000000000000..c6cf398b8403b3f799a1db20716021c91ca6e078 --- /dev/null +++ b/en/application-dev/media/audio-playback-stream-management.md @@ -0,0 +1,120 @@ +# Audio Playback Stream Management + +An audio playback application must notice audio stream state changes and perform corresponding operations. For example, when detecting that an audio stream is being played or paused, the application must change the UI display of the **Play** button. + +## Reading or Listening for Audio Stream State Changes in the Application + +Create an AudioRenderer by referring to [Using AudioRenderer for Audio Playback](using-audiorenderer-for-playback.md) or [audio.createAudioRenderer](../reference/apis/js-apis-audio.md#audiocreateaudiorenderer8). Then obtain the audio stream state changes in either of the following ways: + +- Check the [state](../reference/apis/js-apis-audio.md#attributes) of the AudioRenderer. + + ```ts + let audioRendererState = audioRenderer.state; + console.info(`Current state is: ${audioRendererState }`) + ``` + +- Register **stateChange** to listen for state changes of the AudioRenderer. + + ```ts + audioRenderer.on('stateChange', (rendererState) => { + console.info(`State change to: ${rendererState}`) + }); + ``` + +The application then performs an operation, for example, changing the display of the **Play** button, by comparing the obtained state with [AudioState](../reference/apis/js-apis-audio.md#audiostate8). + +## Reading or Listening for Changes in All Audio Streams + +If an application needs to obtain the change information about all audio streams, it can use **AudioStreamManager** to read or listen for the changes of all audio streams. + +> **NOTE** +> +> The audio stream change information marked as the system API can be viewed only by system applications. + +The figure below shows the call relationship of audio stream management. + +![Call relationship of audio stream management](figures/audio-stream-mgmt-invoking-relationship.png) + +During application development, first use **getStreamManager()** to create an **AudioStreamManager** instance. Then call **on('audioRendererChange')** to listen for audio stream changes and obtain a notification when the audio stream state or device changes. To cancel the listening for these changes, call **off('audioRendererChange')**. You can also call **getCurrentAudioRendererInfoArray()** to obtain information such as the unique ID of the playback stream, UID of the playback stream client, and stream status. + +For details about the APIs, see [AudioStreamManager](../reference/apis/js-apis-audio.md#audiostreammanager9). + +## How to Develop + +1. Create an **AudioStreamManager** instance. + + Before using **AudioStreamManager** APIs, you must use **getStreamManager()** to create an **AudioStreamManager** instance. + + ```ts + import audio from '@ohos.multimedia.audio'; + let audioManager = audio.getAudioManager(); + let audioStreamManager = audioManager.getStreamManager(); + ``` + +2. Use **on('audioRendererChange')** to listen for audio playback stream changes. If the application needs to receive a notification when the audio playback stream state or device changes, it can subscribe to this event. + + ```ts + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + let AudioRendererChangeInfo = AudioRendererChangeInfoArray[i]; + console.info(`## RendererChange on is called for ${i} ##`); + console.info(`StreamId for ${i} is: ${AudioRendererChangeInfo.streamId}`); + console.info(`Content ${i} is: ${AudioRendererChangeInfo.rendererInfo.content}`); + console.info(`Stream ${i} is: ${AudioRendererChangeInfo.rendererInfo.usage}`); + console.info(`Flag ${i} is: ${AudioRendererChangeInfo.rendererInfo.rendererFlags}`); + for (let j = 0;j < AudioRendererChangeInfo.deviceDescriptors.length; j++) { + console.info(`Id: ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].id}`); + console.info(`Type: ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].deviceType}`); + console.info(`Role: ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].deviceRole}`); + console.info(`Name: ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].name}`); + console.info(`Address: ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].address}`); + console.info(`SampleRates: ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].sampleRates[0]}`); + console.info(`ChannelCount ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].channelCounts[0]}`); + console.info(`ChannelMask: ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].channelMasks}`); + } + } + }); + ``` + +3. (Optional) Use **off('audioRendererChange')** to cancel listening for audio playback stream changes. + + ```ts + audioStreamManager.off('audioRendererChange'); + console.info('RendererChange Off is called '); + ``` + +4. (Optional) Call **getCurrentAudioRendererInfoArray()** to obtain the information about all audio playback streams. + + This API can be used to obtain the unique ID of the audio playback stream, UID of the audio playback client, audio status, and other information about the audio player. + > **NOTE** + > + > Before listening for state changes of all audio streams, the application must request the **ohos.permission.USE_BLUETOOTH** [permission](../security/accesstoken-guidelines.md), for the device name and device address (Bluetooth related attributes) to be displayed correctly. + + ```ts + async function getCurrentAudioRendererInfoArray(){ + await audioStreamManager.getCurrentAudioRendererInfoArray().then( function (AudioRendererChangeInfoArray) { + console.info(`getCurrentAudioRendererInfoArray Get Promise is called `); + if (AudioRendererChangeInfoArray != null) { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + let AudioRendererChangeInfo = AudioRendererChangeInfoArray[i]; + console.info(`StreamId for ${i} is: ${AudioRendererChangeInfo.streamId}`); + console.info(`Content ${i} is: ${AudioRendererChangeInfo.rendererInfo.content}`); + console.info(`Stream ${i} is: ${AudioRendererChangeInfo.rendererInfo.usage}`); + console.info(`Flag ${i} is: ${AudioRendererChangeInfo.rendererInfo.rendererFlags}`); + for (let j = 0;j < AudioRendererChangeInfo.deviceDescriptors.length; j++) { + console.info(`Id: ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].id}`); + console.info(`Type: ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].deviceType}`); + console.info(`Role: ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].deviceRole}`); + console.info(`Name: ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].name}`); + console.info(`Address: ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].address}`); + console.info(`SampleRates: ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].sampleRates[0]}`); + console.info(`ChannelCount ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].channelCounts[0]}`); + console.info(`ChannelMask: ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].channelMasks}`); + } + } + } + }).catch((err) => { + console.error(`Invoke getCurrentAudioRendererInfoArray failed, code is ${err.code}, message is ${err.message}`); + }); + } + ``` diff --git a/en/application-dev/media/audio-playback.md b/en/application-dev/media/audio-playback.md deleted file mode 100644 index 1c7953d32b8ecee4c0ff34e82ab8d13947ac9271..0000000000000000000000000000000000000000 --- a/en/application-dev/media/audio-playback.md +++ /dev/null @@ -1,243 +0,0 @@ -# Audio Playback Development - -## Introduction - -You can use audio playback APIs to convert audio data into audible analog signals and play the signals using output devices. You can also manage playback tasks. For example, you can control the playback and volume, obtain track information, and release resources. - -## Working Principles - -The following figures show the audio playback state transition and the interaction with external modules for audio playback. - -**Figure 1** Audio playback state transition - -![en-us_image_audio_state_machine](figures/en-us_image_audio_state_machine.png) - -**NOTE**: If the status is **Idle**, setting the **src** attribute does not change the status. In addition, after the **src** attribute is set successfully, you must call **reset()** before setting it to another value. - - - -**Figure 2** Interaction with external modules for audio playback - -![en-us_image_audio_player](figures/en-us_image_audio_player.png) - -**NOTE**: When a third-party application calls the JS interface provided by the JS interface layer to implement a feature, the framework layer invokes the audio component through the media service of the native framework and outputs the audio data decoded by the software to the audio HDI of the hardware interface layer to implement audio playback. - -## How to Develop - -For details about the APIs, see [AudioPlayer in the Media API](../reference/apis/js-apis-media.md#audioplayer). - -> **NOTE** -> -> The method for obtaining the path in the FA model is different from that in the stage model. For details about how to obtain the path, see [Application Sandbox Path Guidelines](../reference/apis/js-apis-fileio.md#guidelines). - -### Full-Process Scenario - -The full audio playback process includes creating an instance, setting the URI, playing audio, seeking to the playback position, setting the volume, pausing playback, obtaining track information, stopping playback, resetting the player, and releasing resources. - -For details about the **src** types supported by **AudioPlayer**, see the [src attribute](../reference/apis/js-apis-media.md#audioplayer_attributes). - -```js -import media from '@ohos.multimedia.media' -import fs from '@ohos.file.fs' - -// Print the stream track information. -function printfDescription(obj) { - for (let item in obj) { - let property = obj[item]; - console.info('audio key is ' + item); - console.info('audio value is ' + property); - } -} - -// 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. - 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.on('play', () => { // Set the 'play' event callback. - console.info('audio play success'); - audioPlayer.pause(); // Trigger the 'pause' event callback and pause the playback. - }); - 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.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.on('reset', () => { // Set the 'reset' event callback. - console.info('audio reset success'); - audioPlayer.release(); // Release the AudioPlayer instance. - audioPlayer = undefined; - }); - 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.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') { - for (let i = 0; i < arrlist.length; i++) { - printfDescription(arrlist[i]); - } - } else { - console.log(`audio getTrackDescription fail, error:${error.message}`); - } - 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. - console.info('audio play finish'); - }); - 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}`); - }); -} - -async function audioPlayerDemo() { - // 1. Create an AudioPlayer instance. - let audioPlayer = media.createAudioPlayer(); - setCallBack(audioPlayer); // Set the event callbacks. - // 2. Set the URI of the audio file. - let fdPath = 'fd://' - let pathDir = "/data/storage/el2/base/haps/entry/files" // The path used here is an example. Obtain the path based on project requirements. - // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\01.mp3 /data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files" command. - let path = pathDir + '/01.mp3' - let file = await fs.open(path); - fdPath = fdPath + '' + file.fd; - audioPlayer.src = fdPath; // Set the src attribute and trigger the 'dataLoad' event callback. -} -``` - -### Normal Playback Scenario - -```js -import media from '@ohos.multimedia.media' -import fs from '@ohos.file.fs' - -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. - console.info('audio set source success'); - audioPlayer.play(); // Call the play() API to start the playback and trigger 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. - console.info('audio play finish'); - audioPlayer.release(); // Release the AudioPlayer instance. - audioPlayer = undefined; - }); - } - - async audioPlayerDemo() { - let audioPlayer = media.createAudioPlayer(); // Create an AudioPlayer instance. - this.setCallBack(audioPlayer); // Set the event callbacks. - let fdPath = 'fd://' - let pathDir = "/data/storage/el2/base/haps/entry/files" // The path used here is an example. Obtain the path based on project requirements. - // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\01.mp3 /data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files" command. - let path = pathDir + '/01.mp3' - let file = await fs.open(path); - fdPath = fdPath + '' + file.fd; - audioPlayer.src = fdPath; // Set the src attribute and trigger the 'dataLoad' event callback. - } -} -``` - -### Switching to the Next Song - -```js -import media from '@ohos.multimedia.media' -import fs from '@ohos.file.fs' - -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. - console.info('audio set source success'); - audioPlayer.play(); // Call the play() API to start the playback and trigger 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.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. - } else { - audioPlayer.release(); // Release the AudioPlayer instance. - audioPlayer = undefined; - } - }); - } - - async nextMusic(audioPlayer) { - this.isNextMusic = true; - let nextFdPath = 'fd://' - let pathDir = "/data/storage/el2/base/haps/entry/files" // The path used here is an example. Obtain the path based on project requirements. - // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\02.mp3 /data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files" command. - let nextpath = pathDir + '/02.mp3' - let nextFile = await fs.open(nextpath); - nextFdPath = nextFdPath + '' + nextFile.fd; - audioPlayer.src = nextFdPath; // Set the src attribute and trigger the 'dataLoad' event callback. - } - - async audioPlayerDemo() { - let audioPlayer = media.createAudioPlayer(); // Create an AudioPlayer instance. - this.setCallBack(audioPlayer); // Set the event callbacks. - let fdPath = 'fd://' - let pathDir = "/data/storage/el2/base/haps/entry/files" // The path used here is an example. Obtain the path based on project requirements. - // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\01.mp3 /data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files" command. - let path = pathDir + '/01.mp3' - let file = await fs.open(path); - fdPath = fdPath + '' + file.fd; - audioPlayer.src = fdPath; // Set the src attribute and trigger the 'dataLoad' event callback. - } -} -``` - -### Looping a Song - -```js -import media from '@ohos.multimedia.media' -import fs from '@ohos.file.fs' - -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. - 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.on('play', () => { // Set the 'play' event callback to start loop playback. - console.info('audio play success'); - }); - } - - async audioPlayerDemo() { - let audioPlayer = media.createAudioPlayer(); // Create an AudioPlayer instance. - this.setCallBack(audioPlayer); // Set the event callbacks. - let fdPath = 'fd://' - let pathDir = "/data/storage/el2/base/haps/entry/files" // The path used here is an example. Obtain the path based on project requirements. - // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\01.mp3 /data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files" command. - let path = pathDir + '/01.mp3' - let file = await fs.open(path); - fdPath = fdPath + '' + file.fd; - audioPlayer.src = fdPath; // Set the src attribute and trigger the 'dataLoad' event callback. - } -} -``` diff --git a/en/application-dev/media/audio-recorder.md b/en/application-dev/media/audio-recorder.md deleted file mode 100644 index 78650a61d0a803811394e623ab0bc46155438ba9..0000000000000000000000000000000000000000 --- a/en/application-dev/media/audio-recorder.md +++ /dev/null @@ -1,197 +0,0 @@ -# Audio Recording Development - -## Introduction - -During audio recording, audio signals are captured, encoded, and saved to files. You can specify parameters such as the sampling rate, number of audio channels, encoding format, encapsulation format, and output file path for audio recording. - -## Working Principles - -The following figures show the audio recording state transition and the interaction with external modules for audio recording. - -**Figure 1** Audio recording state transition - -![en-us_image_audio_recorder_state_machine](figures/en-us_image_audio_recorder_state_machine.png) - - - -**Figure 2** Interaction with external modules for audio recording - -![en-us_image_audio_recorder_zero](figures/en-us_image_audio_recorder_zero.png) - -**NOTE**: When a third-party recording application or recorder calls the JS interface provided by the JS interface layer to implement a feature, the framework layer invokes the audio component through the media service of the native framework to obtain the audio data captured through the audio HDI. The framework layer then encodes the audio data through software and saves the encoded and encapsulated audio data to a file to implement audio recording. - -## Constraints - -Before developing audio recording, configure the **ohos.permission.MICROPHONE** permission for your application. For details about the configuration, see [Permission Application Guide](../security/accesstoken-guidelines.md). - -## How to Develop - -For details about the APIs, see [AudioRecorder in the Media API](../reference/apis/js-apis-media.md#audiorecorder). - -### Full-Process Scenario - -The full audio recording process includes creating an instance, setting recording parameters, starting, pausing, resuming, and stopping recording, and releasing resources. - -```js -import media from '@ohos.multimedia.media' -import mediaLibrary from '@ohos.multimedia.mediaLibrary' -export class AudioRecorderDemo { - private testFdNumber; // Used to save the FD address. - - // Set the callbacks related to audio recording. - setCallBack(audioRecorder) { - audioRecorder.on('prepare', () => { // Set the prepare event callback. - console.log('prepare success'); - audioRecorder.start(); // Call the start API to start recording and trigger the start event callback. - }); - audioRecorder.on('start', () => { // Set the start event callback. - console.log('audio recorder start success'); - audioRecorder.pause(); // Call the pause API to pause recording and trigger the pause event callback. - }); - audioRecorder.on('pause', () => { // Set the pause event callback. - console.log('audio recorder pause success'); - audioRecorder.resume(); // Call the resume API to resume recording and trigger the resume event callback. - }); - audioRecorder.on('resume', () => { // Set the resume event callback. - console.log('audio recorder resume success'); - audioRecorder.stop(); // Call the stop API to stop recording and trigger the stop event callback. - }); - audioRecorder.on('stop', () => { // Set the stop event callback. - console.log('audio recorder stop success'); - audioRecorder.reset(); // Call the reset API to reset the recorder and trigger the reset event callback. - }); - audioRecorder.on('reset', () => { // Set the reset event callback. - console.log('audio recorder reset success'); - audioRecorder.release(); // Call the release API to release resources and trigger the release event callback. - }); - audioRecorder.on('release', () => { // Set the release event callback. - console.log('audio recorder release success'); - audioRecorder = undefined; - }); - audioRecorder.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}`); - }); - } - - // pathName indicates the passed recording file name, for example, 01.mp3. The generated file address is /storage/media/100/local/files/Video/01.mp3. - // To use the media library, declare the following permissions: ohos.permission.MEDIA_LOCATION, ohos.permission.WRITE_MEDIA, and ohos.permission.READ_MEDIA. - async getFd(pathName) { - let displayName = pathName; - const mediaTest = mediaLibrary.getMediaLibrary(); - let fileKeyObj = mediaLibrary.FileKey; - let mediaType = mediaLibrary.MediaType.VIDEO; - let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); - let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath); - if (dataUri != undefined) { - let args = dataUri.id.toString(); - let fetchOp = { - selections : fileKeyObj.ID + "=?", - selectionArgs : [args], - } - let fetchFileResult = await mediaTest.getFileAssets(fetchOp); - let fileAsset = await fetchFileResult.getAllObject(); - let fdNumber = await fileAsset[0].open('Rw'); - this.testFdNumber = "fd://" + fdNumber.toString(); - } - } - - async audioRecorderDemo() { - // 1. Create an AudioRecorder instance. - let audioRecorder = media.createAudioRecorder(); - // 2. Set the callbacks. - this.setCallBack(audioRecorder); - await this.getFd('01.mp3'); // Call the getFd method to obtain the FD address of the file to be recorded. - // 3. Set the recording parameters. - let audioRecorderConfig = { - audioEncodeBitRate : 22050, - audioSampleRate : 22050, - numberOfChannels : 2, - uri : this.testFdNumber, // testFdNumber is generated by getFd. - location : { latitude : 30, longitude : 130}, - audioEncoderMime : media.CodecMimeType.AUDIO_AAC, - fileFormat : media.ContainerFormatType.CFT_MPEG_4A, - } - audioRecorder.prepare(audioRecorderConfig); // Call the prepare method to trigger the prepare event callback. - } -} -``` - -### Normal Recording Scenario - -Unlike the full-process scenario, the normal recording scenario does not include the process of pausing and resuming recording. - -```js -import media from '@ohos.multimedia.media' -import mediaLibrary from '@ohos.multimedia.mediaLibrary' -export class AudioRecorderDemo { - private testFdNumber; // Used to save the FD address. - - // Set the callbacks related to audio recording. - setCallBack(audioRecorder) { - audioRecorder.on('prepare', () => { // Set the prepare event callback. - console.log('prepare success'); - audioRecorder.start(); // Call the start API to start recording and trigger the start event callback. - }); - audioRecorder.on('start', () => { // Set the start event callback. - console.log('audio recorder start success'); - audioRecorder.stop(); // Call the stop API to stop recording and trigger the stop event callback. - }); - audioRecorder.on('stop', () => { // Set the stop event callback. - console.log('audio recorder stop success'); - audioRecorder.release(); // Call the release API to release resources and trigger the release event callback. - }); - audioRecorder.on('release', () => { // Set the release event callback. - console.log('audio recorder release success'); - audioRecorder = undefined; - }); - audioRecorder.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}`); - }); - } - - // pathName indicates the passed recording file name, for example, 01.mp3. The generated file address is /storage/media/100/local/files/Video/01.mp3. - // To use the media library, declare the following permissions: ohos.permission.MEDIA_LOCATION, ohos.permission.WRITE_MEDIA, and ohos.permission.READ_MEDIA. - async getFd(pathName) { - let displayName = pathName; - const mediaTest = mediaLibrary.getMediaLibrary(); - let fileKeyObj = mediaLibrary.FileKey; - let mediaType = mediaLibrary.MediaType.VIDEO; - let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); - let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath); - if (dataUri != undefined) { - let args = dataUri.id.toString(); - let fetchOp = { - selections : fileKeyObj.ID + "=?", - selectionArgs : [args], - } - let fetchFileResult = await mediaTest.getFileAssets(fetchOp); - let fileAsset = await fetchFileResult.getAllObject(); - let fdNumber = await fileAsset[0].open('Rw'); - this.testFdNumber = "fd://" + fdNumber.toString(); - } - } - - async audioRecorderDemo() { - // 1. Create an AudioRecorder instance. - let audioRecorder = media.createAudioRecorder(); - // 2. Set the callbacks. - this.setCallBack(audioRecorder); - await this.getFd('01.mp3'); // Call the getFd method to obtain the FD address of the file to be recorded. - // 3. Set the recording parameters. - let audioRecorderConfig = { - audioEncodeBitRate : 22050, - audioSampleRate : 22050, - numberOfChannels : 2, - uri : this.testFdNumber, // testFdNumber is generated by getFd. - location : { latitude : 30, longitude : 130}, - audioEncoderMime : media.CodecMimeType.AUDIO_AAC, - fileFormat : media.ContainerFormatType.CFT_MPEG_4A, - } - audioRecorder.prepare(audioRecorderConfig); // Call the prepare method to trigger the prepare event callback. - } -} -``` diff --git a/en/application-dev/media/audio-recording-overview.md b/en/application-dev/media/audio-recording-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..698255fddd78d98f9e635b16b3db94e6980bd4a0 --- /dev/null +++ b/en/application-dev/media/audio-recording-overview.md @@ -0,0 +1,17 @@ +# Audio Recording Development + +## Selecting an Audio Recording Development Mode + +OpenHarmony provides multiple classes for you to develop audio recording applications. You can select them based on the recording output formats, audio usage scenarios, and even the programming language you use. Selecting a suitable class helps you reduce development workload and your application deliver a better effect. + +- [AVRecorder](using-avrecorder-for-recording.md): provides ArkTS and JS APIs to implement audio and video recording. It also supports audio input, audio encoding, and media encapsulation. You can directly call device hardware, such as microphone, for recording and generate M4A audio files. + +- [AudioCapturer](using-audiocapturer-for-recording.md): provides ArkTS and JS API to implement audio input. It supports only the PCM format and requires applications to continuously read audio data. The application can perform data processing after audio output. This class can be used to develop more professional and diverse recording applications. To use this class, you must have basic audio processing knowledge. + +- [OpenSLES](using-opensl-es-for-recording.md): provides a set of standard, cross-platform, yet unique native audio APIs. It supports audio input in PCM format and is applicable to recording applications that are ported from other embedded platforms or that implements audio input at the native layer. + +## Precautions for Developing Audio Recording Applications + +The application must request the **ohos.permission.MICROPHONE** permission from the user before invoking the microphone to record audio. + +For details about how to request the permission, see [Permission Application Guide](../security/accesstoken-guidelines.md). For details about how to use and manage microphones, see [Microphone Management](mic-management.md). diff --git a/en/application-dev/media/audio-recording-stream-management.md b/en/application-dev/media/audio-recording-stream-management.md new file mode 100644 index 0000000000000000000000000000000000000000..8161d1bd5bbe5fbc55560ab557570baaaa99976a --- /dev/null +++ b/en/application-dev/media/audio-recording-stream-management.md @@ -0,0 +1,118 @@ +# Audio Recording Stream Management + +An audio recording application must notice audio stream state changes and perform corresponding operations. For example, when detecting that the user stops recording, the application must notify the user that the recording finishes. + +## Reading or Listening for Audio Stream State Changes in the Application + +Create an AudioCapturer by referring to [Using AudioCapturer for Audio Recording](using-audiocapturer-for-recording.md) or [audio.createAudioCapturer](../reference/apis/js-apis-audio.md#audiocreateaudiocapturer8). Then obtain the audio stream state changes in either of the following ways: + +- Check the [state](../reference/apis/js-apis-audio.md#attributes) of the AudioCapturer. + + ```ts + let audioCapturerState = audioCapturer.state; + console.info(`Current state is: ${audioCapturerState }`) + ``` + +- Register **stateChange** to listen for state changes of the AudioCapturer. + + ```ts + audioCapturer.on('stateChange', (capturerState) => { + console.info(`State change to: ${capturerState}`) + }); + ``` + +The application then performs an operation, for example, displays a message indicating the end of the recording, by comparing the obtained state with [AudioState](../reference/apis/js-apis-audio.md#audiostate8). + +## Reading or Listening for Changes in All Audio Streams + +If an application needs to obtain the change information about all audio streams, it can use **AudioStreamManager** to read or listen for the changes of all audio streams. + +> **NOTE** +> +> The audio stream change information marked as the system API can be viewed only by system applications. + +The figure below shows the call relationship of audio stream management. + +![Call relationship of recording stream management](figures/invoking-relationship-recording-stream-mgmt.png) + +During application development, first use **getStreamManager()** to create an **AudioStreamManager** instance. Then call **on('audioCapturerChange')** to listen for audio stream changes and obtain a notification when the audio stream state or device changes. To cancel the listening for these changes, call **off('audioCapturerChange')**. You can call **getCurrentAudioCapturerInfoArray()** to obtain information such as the unique ID of the recording stream, UID of the recording stream client, and stream status. + +For details about the APIs, see [AudioStreamManager](../reference/apis/js-apis-audio.md#audiostreammanager9). + + +## How to Develop + +1. Create an **AudioStreamManager** instance. + + Before using **AudioStreamManager** APIs, you must use **getStreamManager()** to create an **AudioStreamManager** instance. + + ```ts + import audio from '@ohos.multimedia.audio'; + let audioManager = audio.getAudioManager(); + let audioStreamManager = audioManager.getStreamManager(); + ``` + +2. Use **on('audioCapturerChange')** to listen for audio recording stream changes. If the application needs to receive a notification when the audio recording stream state or device changes, it can subscribe to this event. + + ```ts + audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(`## CapChange on is called for element ${i} ##`); + console.info(`StreamId for ${i} is: ${AudioCapturerChangeInfoArray[i].streamId}`); + console.info(`Source for ${i} is: ${AudioCapturerChangeInfoArray[i].capturerInfo.source}`); + console.info(`Flag ${i} is: ${AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags}`); + let devDescriptor = AudioCapturerChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`Id: ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`Type: ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`Role: ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`Name: ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`Address: ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`SampleRates: ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`ChannelCounts ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`ChannelMask: ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + } + }); + ``` + +3. (Optional) Use **off('audioCapturerChange')** to cancel listening for audio recording stream changes. + + ```ts + audioStreamManager.off('audioCapturerChange'); + console.info('CapturerChange Off is called'); + ``` + +4. (Optional) Call **getCurrentAudioCapturerInfoArray()** to obtain information about the current audio recording stream. + + This API can be used to obtain the unique ID of the audio recording stream, UID of the audio recording client, audio status, and other information about the AudioCapturer. + > **NOTE** + > + > Before listening for state changes of all audio streams, the application must request the **ohos.permission.USE_BLUETOOTH** [permission](../security/accesstoken-guidelines.md), for the device name and device address (Bluetooth related attributes) to be displayed correctly. + + ```ts + async function getCurrentAudioCapturerInfoArray(){ + await audioStreamManager.getCurrentAudioCapturerInfoArray().then( function (AudioCapturerChangeInfoArray) { + console.info('getCurrentAudioCapturerInfoArray Get Promise Called '); + if (AudioCapturerChangeInfoArray != null) { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(`StreamId for ${i} is: ${AudioCapturerChangeInfoArray[i].streamId}`); + console.info(`Source for ${i} is: ${AudioCapturerChangeInfoArray[i].capturerInfo.source}`); + console.info(`Flag ${i} is: ${AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags}`); + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`Id: ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`Type: ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`Role: ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`Name: ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`Address: ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`SampleRates: ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`ChannelCounts ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`ChannelMask: ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + } + } + }).catch((err) => { + console.error(`Invoke getCurrentAudioCapturerInfoArray failed, code is ${err.code}, message is ${err.message}`); + }); + } + ``` diff --git a/en/application-dev/media/audio-renderer.md b/en/application-dev/media/audio-renderer.md deleted file mode 100644 index 4a39544e7483b68d0bc15b00d643c8403dbded46..0000000000000000000000000000000000000000 --- a/en/application-dev/media/audio-renderer.md +++ /dev/null @@ -1,538 +0,0 @@ -# Audio Rendering Development - -## Introduction - -**AudioRenderer** provides APIs for rendering audio files and controlling playback. It also supports audio interruption. You can use the APIs provided by **AudioRenderer** to play audio files in output devices and manage playback tasks. -Before calling the APIs, be familiar with the following terms: - -- **Audio interruption**: When an audio stream with a higher priority needs to be played, the audio renderer interrupts the stream with a lower priority. For example, if a call comes in when the user is listening to music, the music playback, which is the lower priority stream, is paused. -- **Status check**: During application development, you are advised to use **on('stateChange')** to subscribe to state changes of the **AudioRenderer** instance. This is because some operations can be performed only when the audio renderer is in a given state. If the application performs an operation when the audio renderer is not in the given state, the system may throw an exception or generate other undefined behavior. -- **Asynchronous operation**: To prevent the UI thread from being blocked, most **AudioRenderer** calls are asynchronous. Each API provides the callback and promise functions. The following examples use the promise functions. For more information, see [AudioRenderer in Audio Management](../reference/apis/js-apis-audio.md#audiorenderer8). -- **Audio interruption mode**: OpenHarmony provides two audio interruption modes: **shared mode** and **independent mode**. In shared mode, all **AudioRenderer** instances created by the same application share one focus object, and there is no focus transfer inside the application. Therefore, no callback will be triggered. In independent mode, each **AudioRenderer** instance has an independent focus object, and focus transfer is triggered by focus preemption. When focus transfer occurs, the **AudioRenderer** instance that is having the focus receives a notification through the callback. By default, the shared mode is used. You can call **setInterruptMode()** to switch to the independent mode. - -## Working Principles - -The following figure shows the audio renderer state transitions. - -**Figure 1** Audio renderer state transitions - -![audio-renderer-state](figures/audio-renderer-state.png) - -- **PREPARED**: The audio renderer enters this state by calling **create()**. - -- **RUNNING**: The audio renderer enters this state by calling **start()** when it is in the **PREPARED** state or by calling **start()** when it is in the **STOPPED** state. - -- **PAUSED**: The audio renderer enters this state by calling **pause()** when it is in the **RUNNING** state. When the audio playback is paused, it can call **start()** to resume the playback. - -- **STOPPED**: The audio renderer enters this state by calling **stop()** when it is in the **PAUSED** or **RUNNING** state. - -- **RELEASED**: The audio renderer enters this state by calling **release()** when it is in the **PREPARED**, **PAUSED**, or **STOPPED** state. In this state, the audio renderer releases all occupied hardware and software resources and will not transit to any other state. - -## How to Develop - -For details about the APIs, see [AudioRenderer in Audio Management](../reference/apis/js-apis-audio.md#audiorenderer8). - -1. Use **createAudioRenderer()** to create an **AudioRenderer** instance. - - Set parameters of the **AudioRenderer** instance in **audioRendererOptions**. This instance is used to render audio, control and obtain the rendering status, and register a callback for notification. - - ```js - import audio from '@ohos.multimedia.audio'; - - let audioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - let audioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 // 0 is the extended flag bit of the audio renderer. The default value is 0. - } - let audioRendererOptions = { - streamInfo: audioStreamInfo, - rendererInfo: audioRendererInfo - } - - let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); - console.log("Create audio renderer success."); - ``` - -2. Use **start()** to start audio rendering. - - ```js - async function startRenderer() { - let state = audioRenderer.state; - // The audio renderer should be in the STATE_PREPARED, STATE_PAUSED, or STATE_STOPPED state when start() is called. - if (state != audio.AudioState.STATE_PREPARED && state != audio.AudioState.STATE_PAUSED && - state != audio.AudioState.STATE_STOPPED) { - console.info('Renderer is not in a correct state to start'); - return; - } - - await audioRenderer.start(); - - state = audioRenderer.state; - if (state == audio.AudioState.STATE_RUNNING) { - console.info('Renderer started'); - } else { - console.error('Renderer start failed'); - } - } - ``` - The renderer state will be **STATE_RUNNING** once the audio renderer is started. The application can then begin reading buffers. - - -3. Call **write()** to write data to the buffer. - - Read the audio data to be played to the buffer. Call **write()** repeatedly to write the data to the buffer. - - ```js - import fs from '@ohos.file.fs'; - import audio from '@ohos.multimedia.audio'; - - async function writeBuffer(buf) { - // The write operation can be performed only when the state is STATE_RUNNING. - if (audioRenderer.state != audio.AudioState.STATE_RUNNING) { - console.error('Renderer is not running, do not write'); - return; - } - let writtenbytes = await audioRenderer.write(buf); - console.info(`Actual written bytes: ${writtenbytes} `); - if (writtenbytes < 0) { - console.error('Write buffer failed. check the state of renderer'); - } - } - - // Set a proper buffer size for the audio renderer. You can also select a buffer of another size. - const bufferSize = await audioRenderer.getBufferSize(); - let dir = globalThis.fileDir; // You must use the sandbox path. - const filePath = dir + '/file_example_WAV_2MG.wav'; // The file to render is in the following path: /data/storage/el2/base/haps/entry/files/file_example_WAV_2MG.wav - console.info(`file filePath: ${ filePath}`); - - let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); - let stat = await fs.stat(filePath); // Music file information. - let buf = new ArrayBuffer(bufferSize); - let len = stat.size % this.bufferSize == 0 ? Math.floor(stat.size / this.bufferSize) : Math.floor(stat.size / this.bufferSize + 1); - for (let i = 0;i < len; i++) { - let options = { - offset: i * this.bufferSize, - length: this.bufferSize - } - let readsize = await fs.read(file.fd, buf, options) - let writeSize = await new Promise((resolve,reject)=>{ - this.audioRenderer.write(buf,(err,writeSize)=>{ - if(err){ - reject(err) - }else{ - resolve(writeSize) - } - }) - }) - } - - fs.close(file) - await audioRenderer.stop(); // Stop rendering. - await audioRenderer.release(); // Releases the resources. - ``` - -4. (Optional) Call **pause()** or **stop()** to pause or stop rendering. - - ```js - async function pauseRenderer() { - let state = audioRenderer.state; - // The audio renderer can be paused only when it is in the STATE_RUNNING state. - if (state != audio.AudioState.STATE_RUNNING) { - console.info('Renderer is not running'); - return; - } - - await audioRenderer.pause(); - - state = audioRenderer.state; - if (state == audio.AudioState.STATE_PAUSED) { - console.info('Renderer paused'); - } else { - console.error('Renderer pause failed'); - } - } - - async function stopRenderer() { - let state = audioRenderer.state; - // The audio renderer can be stopped only when it is in STATE_RUNNING or STATE_PAUSED state. - if (state != audio.AudioState.STATE_RUNNING && state != audio.AudioState.STATE_PAUSED) { - console.info('Renderer is not running or paused'); - return; - } - - await audioRenderer.stop(); - - state = audioRenderer.state; - if (state == audio.AudioState.STATE_STOPPED) { - console.info('Renderer stopped'); - } else { - console.error('Renderer stop failed'); - } - } - ``` - -5. (Optional) Call **drain()** to clear the buffer. - - ```js - async function drainRenderer() { - let state = audioRenderer.state; - // drain() can be used only when the audio renderer is in the STATE_RUNNING state. - if (state != audio.AudioState.STATE_RUNNING) { - console.info('Renderer is not running'); - return; - } - - await audioRenderer.drain(); - state = audioRenderer.state; - } - ``` - -6. After the task is complete, call **release()** to release related resources. - - **AudioRenderer** uses a large number of system resources. Therefore, ensure that the resources are released after the task is complete. - - ```js - async function releaseRenderer() { - let state = audioRenderer.state; - // The audio renderer can be released only when it is not in the STATE_RELEASED or STATE_NEW state. - if (state == audio.AudioState.STATE_RELEASED || state == audio.AudioState.STATE_NEW) { - console.info('Renderer already released'); - return; - } - await audioRenderer.release(); - - state = audioRenderer.state; - if (state == audio.AudioState.STATE_RELEASED) { - console.info('Renderer released'); - } else { - console.info('Renderer release failed'); - } - } - ``` - -7. (Optional) Obtain the audio renderer information. - - You can use the following code to obtain the audio renderer information: - - ```js - // Obtain the audio renderer state. - let state = audioRenderer.state; - - // Obtain the audio renderer information. - let audioRendererInfo : audio.AudioRendererInfo = await audioRenderer.getRendererInfo(); - - // Obtain the audio stream information. - let audioStreamInfo : audio.AudioStreamInfo = await audioRenderer.getStreamInfo(); - - // Obtain the audio stream ID. - let audioStreamId : number = await audioRenderer.getAudioStreamId(); - - // Obtain the Unix timestamp, in nanoseconds. - let audioTime : number = await audioRenderer.getAudioTime(); - - // Obtain a proper minimum buffer size. - let bufferSize : number = await audioRenderer.getBufferSize(); - - // Obtain the audio renderer rate. - let renderRate : audio.AudioRendererRate = await audioRenderer.getRenderRate(); - ``` - -8. (Optional) Set the audio renderer information. - - You can use the following code to set the audio renderer information: - - ```js - // Set the audio renderer rate to RENDER_RATE_NORMAL. - let renderRate : audio.AudioRendererRate = audio.AudioRendererRate.RENDER_RATE_NORMAL; - await audioRenderer.setRenderRate(renderRate); - - // Set the interruption mode of the audio renderer to SHARE_MODE. - let interruptMode : audio.InterruptMode = audio.InterruptMode.SHARE_MODE; - await audioRenderer.setInterruptMode(interruptMode); - - // Set the volume of the stream to 0.5. - let volume : number = 0.5; - await audioRenderer.setVolume(volume); - ``` - -9. (Optional) Use **on('audioInterrupt')** to subscribe to the audio interruption event, and use **off('audioInterrupt')** to unsubscribe from the event. - - Audio interruption means that Stream A will be interrupted when Stream B with a higher or equal priority requests to become active and use the output device. - - In some cases, the audio renderer performs forcible operations such as pausing and ducking, and notifies the application through **InterruptEvent**. In other cases, the application can choose to act on the **InterruptEvent** or ignore it. - - In the case of audio interruption, the application may encounter write failures. To avoid such failures, interruption-unaware applications can use **audioRenderer.state** to check the audio renderer state before writing audio data. The applications can obtain more details by subscribing to the audio interruption events. For details, see [InterruptEvent](../reference/apis/js-apis-audio.md#interruptevent9). - - It should be noted that the audio interruption event subscription of the **AudioRenderer** module is slightly different from **on('interrupt')** in [AudioManager](../reference/apis/js-apis-audio.md#audiomanager). The **on('interrupt')** and **off('interrupt')** APIs are deprecated since API version 9. In the **AudioRenderer** module, you only need to call **on('audioInterrupt')** to listen for focus change events. When the **AudioRenderer** instance created by the application performs actions such as start, stop, and pause, it requests the focus, which triggers focus transfer and in return enables the related **AudioRenderer** instance to receive a notification through the callback. For instances other than **AudioRenderer**, such as frequency modulation (FM) and voice wakeup, the application does not create an instance. In this case, the application can call **on('interrupt')** in **AudioManager** to receive a focus change notification. - - ```js - audioRenderer.on('audioInterrupt', (interruptEvent) => { - console.info('InterruptEvent Received'); - console.info(`InterruptType: ${interruptEvent.eventType}`); - console.info(`InterruptForceType: ${interruptEvent.forceType}`); - console.info(`AInterruptHint: ${interruptEvent.hintType}`); - - if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_FORCE) { - switch (interruptEvent.hintType) { - // Forcible pausing initiated by the audio framework. To prevent data loss, stop the write operation. - case audio.InterruptHint.INTERRUPT_HINT_PAUSE: - isPlay = false; - break; - // Forcible stopping initiated by the audio framework. To prevent data loss, stop the write operation. - case audio.InterruptHint.INTERRUPT_HINT_STOP: - isPlay = false; - break; - // Forcible ducking initiated by the audio framework. - case audio.InterruptHint.INTERRUPT_HINT_DUCK: - break; - // Undocking initiated by the audio framework. - case audio.InterruptHint.INTERRUPT_HINT_UNDUCK: - break; - } - } else if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_SHARE) { - switch (interruptEvent.hintType) { - // Notify the application that the rendering starts. - case audio.InterruptHint.INTERRUPT_HINT_RESUME: - startRenderer(); - break; - // Notify the application that the audio stream is interrupted. The application then determines whether to continue. (In this example, the application pauses the rendering.) - case audio.InterruptHint.INTERRUPT_HINT_PAUSE: - isPlay = false; - pauseRenderer(); - break; - } - } - }); - - audioRenderer.off('audioInterrupt'); // Unsubscribe from the audio interruption event. This event will no longer be listened for. - ``` - -10. (Optional) Use **on('markReach')** to subscribe to the mark reached event, and use **off('markReach')** to unsubscribe from the event. - - After the mark reached event is subscribed to, when the number of frames rendered by the audio renderer reaches the specified value, a callback is triggered and the specified value is returned. - - ```js - audioRenderer.on('markReach', (reachNumber) => { - console.info('Mark reach event Received'); - console.info(`The renderer reached frame: ${reachNumber}`); - }); - - audioRenderer.off('markReach'); // Unsubscribe from the mark reached event. This event will no longer be listened for. - ``` - -11. (Optional) Use **on('periodReach')** to subscribe to the period reached event, and use **off('periodReach')** to unsubscribe from the event. - - After the period reached event is subscribed to, each time the number of frames rendered by the audio renderer reaches the specified value, a callback is triggered and the specified value is returned. - - ```js - audioRenderer.on('periodReach', (reachNumber) => { - console.info('Period reach event Received'); - console.info(`In this period, the renderer reached frame: ${reachNumber} `); - }); - - audioRenderer.off('periodReach'); // Unsubscribe from the period reached event. This event will no longer be listened for. - ``` - -12. (Optional) Use **on('stateChange')** to subscribe to audio renderer state changes. - - After the **stateChange** event is subscribed to, when the audio renderer state changes, a callback is triggered and the audio renderer state is returned. - - ```js - audioRenderer.on('stateChange', (audioState) => { - console.info('State change event Received'); - console.info(`Current renderer state is: ${audioState}`); - }); - ``` - -13. (Optional) Handle exceptions of **on()**. - - If the string or the parameter type passed in **on()** is incorrect , the application throws an exception. In this case, you can use **try catch** to capture the exception. - - ```js - try { - audioRenderer.on('invalidInput', () => { // The string is invalid. - }) - } catch (err) { - console.info(`Call on function error, ${err}`); // The application throws exception 401. - } - try { - audioRenderer.on(1, () => { // The type of the input parameter is incorrect. - }) - } catch (err) { - console.info(`Call on function error, ${err}`); // The application throws exception 6800101. - } - ``` - -14. (Optional) Refer to the complete example of **on('audioInterrupt')**. - - Create **AudioRender1** and **AudioRender2** in an application, configure the independent interruption mode, and call **on('audioInterrupt')** to subscribe to audio interruption events. At the beginning, **AudioRender1** has the focus. When **AudioRender2** attempts to obtain the focus, **AudioRender1** receives a focus transfer notification and the related log information is printed. If the shared mode is used, the log information will not be printed during application running. - - ```js - async runningAudioRender1(){ - let audioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - let audioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 // 0 is the extended flag bit of the audio renderer. The default value is 0. - } - let audioRendererOptions = { - streamInfo: audioStreamInfo, - rendererInfo: audioRendererInfo - } - - // 1.1 Create an instance. - audioRenderer1 = await audio.createAudioRenderer(audioRendererOptions); - console.info("Create audio renderer 1 success."); - - // 1.2 Set the independent mode. - audioRenderer1.setInterruptMode(1).then( data => { - console.info('audioRenderer1 setInterruptMode Success!'); - }).catch((err) => { - console.error(`audioRenderer1 setInterruptMode Fail: ${err}`); - }); - - // 1.3 Set the listener. - audioRenderer1.on('audioInterrupt', async(interruptEvent) => { - console.info(`audioRenderer1 on audioInterrupt : ${JSON.stringify(interruptEvent)}`) - }); - - // 1.4 Start rendering. - await audioRenderer1.start(); - console.info('startAudioRender1 success'); - - // 1.5 Obtain the buffer size, which is the proper minimum buffer size of the audio renderer. You can also select a buffer of another size. - const bufferSize = await audioRenderer1.getBufferSize(); - console.info(`audio bufferSize: ${bufferSize}`); - - // 1.6 Obtain the original audio data file. - let dir = globalThis.fileDir; // You must use the sandbox path. - const path1 = dir + '/music001_48000_32_1.wav'; // The file to render is in the following path: /data/storage/el2/base/haps/entry/files/music001_48000_32_1.wav - console.info(`audioRender1 file path: ${ path1}`); - let file1 = fs.openSync(path1, fs.OpenMode.READ_ONLY); - let stat = await fs.stat(path1); // Music file information. - let buf = new ArrayBuffer(bufferSize); - let len = stat.size % this.bufferSize == 0 ? Math.floor(stat.size / this.bufferSize) : Math.floor(stat.size / this.bufferSize + 1); - - // 1.7 Render the original audio data in the buffer by using audioRender. - for (let i = 0;i < len; i++) { - let options = { - offset: i * this.bufferSize, - length: this.bufferSize - } - let readsize = await fs.read(file.fd, buf, options) - let writeSize = await new Promise((resolve,reject)=>{ - this.audioRenderer1.write(buf,(err,writeSize)=>{ - if(err){ - reject(err) - }else{ - resolve(writeSize) - } - }) - }) - } - fs.close(file1) - await audioRenderer1.stop(); // Stop rendering. - await audioRenderer1.release(); Releases the resources. - } - - async runningAudioRender2(){ - let audioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - let audioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 // 0 is the extended flag bit of the audio renderer. The default value is 0. - } - let audioRendererOptions = { - streamInfo: audioStreamInfo, - rendererInfo: audioRendererInfo - } - - // 2.1 Create another instance. - audioRenderer2 = await audio.createAudioRenderer(audioRendererOptions); - console.info("Create audio renderer 2 success."); - - // 2.2 Set the independent mode. - audioRenderer2.setInterruptMode(1).then( data => { - console.info('audioRenderer2 setInterruptMode Success!'); - }).catch((err) => { - console.error(`audioRenderer2 setInterruptMode Fail: ${err}`); - }); - - // 2.3 Set the listener. - audioRenderer2.on('audioInterrupt', async(interruptEvent) => { - console.info(`audioRenderer2 on audioInterrupt : ${JSON.stringify(interruptEvent)}`) - }); - - // 2.4 Start rendering. - await audioRenderer2.start(); - console.info('startAudioRender2 success'); - - // 2.5 Obtain the buffer size. - const bufferSize = await audioRenderer2.getBufferSize(); - console.info(`audio bufferSize: ${bufferSize}`); - - // 2.6 Read the original audio data file. - let dir = globalThis.fileDir; // You must use the sandbox path. - const path2 = dir + '/music002_48000_32_1.wav'; // The file to render is in the following path: /data/storage/el2/base/haps/entry/files/music002_48000_32_1.wav - console.info(`audioRender2 file path: ${ path2}`); - let file2 = fs.openSync(path2, fs.OpenMode.READ_ONLY); - let stat = await fs.stat(path2); // Music file information. - let buf = new ArrayBuffer(bufferSize); - let len = stat.size % this.bufferSize == 0 ? Math.floor(stat.size / this.bufferSize) : Math.floor(stat.size / this.bufferSize + 1); - - // 2.7 Render the original audio data in the buffer by using audioRender. - for (let i = 0;i < len; i++) { - let options = { - offset: i * this.bufferSize, - length: this.bufferSize - } - let readsize = await fs.read(file.fd, buf, options) - let writeSize = await new Promise((resolve,reject)=>{ - this.audioRenderer2.write(buf,(err,writeSize)=>{ - if(err){ - reject(err) - }else{ - resolve(writeSize) - } - }) - }) - } - fs.close(file2) - await audioRenderer2.stop(); // Stop rendering. - await audioRenderer2.release(); // Releases the resources. - } - - async writeBuffer(buf, audioRender) { - let writtenbytes; - await audioRender.write(buf).then((value) => { - writtenbytes = value; - console.info(`Actual written bytes: ${writtenbytes} `); - }); - if (typeof(writtenbytes) != 'number' || writtenbytes < 0) { - console.error('get Write buffer failed. check the state of renderer'); - } - } - - // Integrated invoking entry. - async test(){ - await runningAudioRender1(); - await runningAudioRender2(); - } - - ``` diff --git a/en/application-dev/media/audio-routing-manager.md b/en/application-dev/media/audio-routing-manager.md deleted file mode 100644 index 55febdca0fad968d946601fce4faed99bc148dd2..0000000000000000000000000000000000000000 --- a/en/application-dev/media/audio-routing-manager.md +++ /dev/null @@ -1,111 +0,0 @@ -# Audio Routing and Device Management Development - -## Overview - -The **AudioRoutingManager** module provides APIs for audio routing and device management. You can use the APIs to obtain the current input and output audio devices, listen for connection status changes of audio devices, and activate communication devices. - -## Working Principles - -The figure below shows the common APIs provided by the **AudioRoutingManager** module. - -**Figure 1** Common APIs of AudioRoutingManager - -![en-us_image_audio_routing_manager](figures/en-us_image_audio_routing_manager.png) - -You can use these APIs to obtain the device list, subscribe to or unsubscribe from device connection status changes, activate communication devices, and obtain their activation status. For details, see [Audio Management](../reference/apis/js-apis-audio.md). - - -## How to Develop - -For details about the APIs, see [AudioRoutingManager in Audio Management](../reference/apis/js-apis-audio.md#audioroutingmanager9). - -1. Obtain an **AudioRoutingManager** instance. - - Before using an API in **AudioRoutingManager**, you must use **getRoutingManager()** to obtain an **AudioRoutingManager** instance. - - ```js - import audio from '@ohos.multimedia.audio'; - async loadAudioRoutingManager() { - var audioRoutingManager = await audio.getAudioManager().getRoutingManager(); - console.info('audioRoutingManager------create-------success.'); - } - - ``` - -2. (Optional) Obtain the device list and subscribe to device connection status changes. - - To obtain the device list (such as input, output, distributed input, and distributed output devices) or listen for connection status changes of audio devices, refer to the following code: - - ```js - import audio from '@ohos.multimedia.audio'; - // Obtain an AudioRoutingManager instance. - async loadAudioRoutingManager() { - var audioRoutingManager = await audio.getAudioManager().getRoutingManager(); - console.info('audioRoutingManager------create-------success.'); - } - // Obtain information about all audio devices. (You can set DeviceFlag as required.) - async getDevices() { - await loadAudioRoutingManager(); - await audioRoutingManager.getDevices(audio.DeviceFlag.ALL_DEVICES_FLAG).then((data) => { - console.info(`getDevices success and data is: ${JSON.stringify(data)}.`); - }); - } - // Subscribe to connection status changes of audio devices. - async onDeviceChange() { - await loadAudioRoutingManager(); - await audioRoutingManager.on('deviceChange', audio.DeviceFlag.ALL_DEVICES_FLAG, (deviceChanged) => { - console.info('on device change type : ' + deviceChanged.type); - console.info('on device descriptor size : ' + deviceChanged.deviceDescriptors.length); - console.info('on device change descriptor : ' + deviceChanged.deviceDescriptors[0].deviceRole); - console.info('on device change descriptor : ' + deviceChanged.deviceDescriptors[0].deviceType); - }); - } - // Unsubscribe from the connection status changes of audio devices. - async offDeviceChange() { - await loadAudioRoutingManager(); - await audioRoutingManager.off('deviceChange', (deviceChanged) => { - console.info('off device change type : ' + deviceChanged.type); - console.info('off device descriptor size : ' + deviceChanged.deviceDescriptors.length); - console.info('off device change descriptor : ' + deviceChanged.deviceDescriptors[0].deviceRole); - console.info('off device change descriptor : ' + deviceChanged.deviceDescriptors[0].deviceType); - }); - } - // Complete process: Call APIs to obtain all devices and subscribe to device changes, then manually change the connection status of a device (for example, wired headset), and finally call APIs to obtain all devices and unsubscribe from the device changes. - async test(){ - await getDevices(); - await onDeviceChange()(); - // Manually disconnect or connect devices. - await getDevices(); - await offDeviceChange(); - } - ``` - -3. (Optional) Activate a communication device and obtain its activation status. - - ```js - import audio from '@ohos.multimedia.audio'; - // Obtain an AudioRoutingManager instance. - async loadAudioRoutingManager() { - var audioRoutingManager = await audio.getAudioManager().getRoutingManager(); - console.info('audioRoutingManager------create-------success.'); - } - // Activate a communication device. - async setCommunicationDevice() { - await loadAudioRoutingManager(); - await audioRoutingManager.setCommunicationDevice(audio.CommunicationDeviceType.SPEAKER, true).then(() => { - console.info('setCommunicationDevice true is success.'); - }); - } - // Obtain the activation status of the communication device. - async isCommunicationDeviceActive() { - await loadAudioRoutingManager(); - await audioRoutingManager.isCommunicationDeviceActive(audio.CommunicationDeviceType.SPEAKER).then((value) => { - console.info(`CommunicationDevice state is: ${value}.`); - }); - } - // Complete process: Activate a device and obtain the activation status. - async test(){ - await setCommunicationDevice(); - await isCommunicationDeviceActive(); - } - ``` diff --git a/en/application-dev/media/audio-stream-manager.md b/en/application-dev/media/audio-stream-manager.md deleted file mode 100644 index 44ec37cd11f3666131214e5e908a1ce761fea111..0000000000000000000000000000000000000000 --- a/en/application-dev/media/audio-stream-manager.md +++ /dev/null @@ -1,164 +0,0 @@ -# Audio Stream Management Development - -## Introduction - -You can use **AudioStreamManager** to manage audio streams. - -## Working Principles - -The following figure shows the calling relationship of **AudioStreamManager** APIs. - -**Figure 1** AudioStreamManager API calling relationship - -![en-us_image_audio_stream_manager](figures/en-us_image_audio_stream_manager.png) - -**NOTE**: During application development, use **getStreamManager()** to create an **AudioStreamManager** instance. Then, you can call **on('audioRendererChange')** or **on('audioCapturerChange')** to listen for status, client, and audio attribute changes of the audio playback or recording application. To cancel the listening for these changes, call **off('audioRendererChange')** or **off('audioCapturerChange')**. You can call **getCurrentAudioRendererInfoArray()** to obtain information about the audio playback application, such as the unique audio stream ID, UID of the audio playback client, and audio status. Similarly, you can call **getCurrentAudioCapturerInfoArray()** to obtain information about the audio recording application. - -## How to Develop - -For details about the APIs, see [AudioStreamManager](../reference/apis/js-apis-audio.md#audiostreammanager9). - -1. Create an **AudioStreamManager** instance. - - Before using **AudioStreamManager** APIs, you must use **getStreamManager()** to create an **AudioStreamManager** instance. - - ```js - var audioManager = audio.getAudioManager(); - var audioStreamManager = audioManager.getStreamManager(); - ``` - -2. (Optional) Call **on('audioRendererChange')** to listen for audio renderer changes. - - If an application needs to receive notifications when the audio playback application status, audio playback client, or audio attribute changes, it can subscribe to this event. For more events that can be subscribed to, see [Audio Management](../reference/apis/js-apis-audio.md). - - ```js - audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { - AudioRendererChangeInfo = AudioRendererChangeInfoArray[i]; - console.info('## RendererChange on is called for ' + i + ' ##'); - console.info('StreamId for ' + i + ' is:' + AudioRendererChangeInfo.streamId); - console.info('ClientUid for ' + i + ' is:' + AudioRendererChangeInfo.clientUid); - console.info('Content for ' + i + ' is:' + AudioRendererChangeInfo.rendererInfo.content); - console.info('Stream for ' + i + ' is:' + AudioRendererChangeInfo.rendererInfo.usage); - console.info('Flag ' + i + ' is:' + AudioRendererChangeInfo.rendererInfo.rendererFlags); - console.info('State for ' + i + ' is:' + AudioRendererChangeInfo.rendererState); - var devDescriptor = AudioRendererChangeInfo.deviceDescriptors; - for (let j = 0; j < AudioRendererChangeInfo.deviceDescriptors.length; j++) { - console.info('Id:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].id); - console.info('Type:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].deviceType); - console.info('Role:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].deviceRole); - console.info('Name:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].name); - console.info('Address:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].address); - console.info('SampleRates:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].sampleRates[0]); - console.info('ChannelCounts' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].channelCounts[0]); - console.info('ChannelMask:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].channelMasks); - } - } - }); - ``` - -3. (Optional) Call **off('audioRendererChange')** to cancel listening for audio renderer changes. - - ```js - audioStreamManager.off('audioRendererChange'); - console.info('######### RendererChange Off is called #########'); - ``` - -4. (Optional) Call **on('audioCapturerChange')** to listen for audio capturer changes. - - If an application needs to receive notifications when the audio recording application status, audio recording client, or audio attribute changes, it can subscribe to this event. For more events that can be subscribed to, see [Audio Management](../reference/apis/js-apis-audio.md). - - ```js - audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { - for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { - console.info(' ## audioCapturerChange on is called for element ' + i + ' ##'); - console.info('StreamId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); - console.info('ClientUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); - console.info('Source for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); - console.info('Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); - console.info('State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); - for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { - console.info('Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); - console.info('Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); - console.info('Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); - console.info('Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); - console.info('Address:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); - console.info('SampleRates:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); - console.info('ChannelCounts' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); - console.info('ChannelMask:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); - } - } - }); - ``` - -5. (Optional) Call **off('audioCapturerChange')** to cancel listening for audio capturer changes. - - ```js - audioStreamManager.off('audioCapturerChange'); - console.info('######### CapturerChange Off is called #########'); - ``` - -6. (Optional) Call **getCurrentAudioRendererInfoArray()** to obtain information about the current audio renderer. - - This API can be used to obtain the unique ID of the audio stream, UID of the audio playback client, audio status, and other information about the audio player. Before calling this API, a third-party application must have the **ohos.permission.USE_BLUETOOTH** permission configured, for the device name and device address to be displayed correctly. - - ```js - await audioStreamManager.getCurrentAudioRendererInfoArray().then( function (AudioRendererChangeInfoArray) { - console.info('######### Get Promise is called ##########'); - if (AudioRendererChangeInfoArray != null) { - for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { - AudioRendererChangeInfo = AudioRendererChangeInfoArray[i]; - console.info('StreamId for ' + i +' is:' + AudioRendererChangeInfo.streamId); - console.info('ClientUid for ' + i + ' is:' + AudioRendererChangeInfo.clientUid); - console.info('Content ' + i + ' is:' + AudioRendererChangeInfo.rendererInfo.content); - console.info('Stream' + i +' is:' + AudioRendererChangeInfo.rendererInfo.usage); - console.info('Flag' + i + ' is:' + AudioRendererChangeInfo.rendererInfo.rendererFlags); - console.info('State for ' + i + ' is:' + AudioRendererChangeInfo.rendererState); - var devDescriptor = AudioRendererChangeInfo.deviceDescriptors; - for (let j = 0; j < AudioRendererChangeInfo.deviceDescriptors.length; j++) { - console.info('Id:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].id); - console.info('Type:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].deviceType); - console.info('Role:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].deviceRole); - console.info('Name:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].name); - console.info('Address:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].address); - console.info('SampleRates:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].sampleRates[0]); - console.info('ChannelCounts' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].channelCounts[0]); - console.info('ChannelMask:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].channelMasks); - } - } - } - }).catch((err) => { - console.log('getCurrentAudioRendererInfoArray :ERROR: ' + err.message); - }); - ``` - -7. (Optional) Call **getCurrentAudioCapturerInfoArray()** to obtain information about the current audio capturer. - This API can be used to obtain the unique ID of the audio stream, UID of the audio recording client, audio status, and other information about the audio capturer. Before calling this API, a third-party application must have the **ohos.permission.USE_BLUETOOTH** permission configured, for the device name and device address to be displayed correctly. - - ```js - await audioStreamManager.getCurrentAudioCapturerInfoArray().then( function (AudioCapturerChangeInfoArray) { - console.info('getCurrentAudioCapturerInfoArray: **** Get Promise Called ****'); - if (AudioCapturerChangeInfoArray != null) { - for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { - console.info('StreamId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); - console.info('ClientUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); - console.info('Source for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); - console.info('Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); - console.info('State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); - var devDescriptor = AudioCapturerChangeInfoArray[i].deviceDescriptors; - for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { - console.info('Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); - console.info('Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); - console.info('Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); - console.info('Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name) - console.info('Address:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); - console.info('SampleRates:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); - console.info('ChannelCounts' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); - console.info('ChannelMask:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); - } - } - } - }).catch((err) => { - console.log('getCurrentAudioCapturerInfoArray :ERROR: ' + err.message); - }); - ``` diff --git a/en/application-dev/media/audio-volume-manager.md b/en/application-dev/media/audio-volume-manager.md deleted file mode 100644 index 28ed3dcbc8709609d092a96065a70996b4f487b5..0000000000000000000000000000000000000000 --- a/en/application-dev/media/audio-volume-manager.md +++ /dev/null @@ -1,126 +0,0 @@ -# Volume Management Development - -## Overview - -The **AudioVolumeManager** module provides APIs for volume management. You can use the APIs to obtain the volume of a stream, listen for ringer mode changes, and mute a microphone. - -## Working Principles - -The figure below shows the common APIs provided by the **AudioVolumeManager** module. - -**Figure 1** Common APIs of AudioVolumeManager - -![en-us_image_audio_volume_manager](figures/en-us_image_audio_volume_manager.png) - -**AudioVolumeManager** provides the APIs for subscribing to system volume changes and obtaining the audio volume group manager (an **AudioVolumeGroupManager** instance). Before calling any API in **AudioVolumeGroupManager**, you must call **getVolumeGroupManager** to obtain an **AudioVolumeGroupManager** instance. You can use the APIs provided by **AudioVolumeGroupManager** to obtain the volume of a stream, mute a microphone, and listen for microphone state changes. For details, see [Audio Management](../reference/apis/js-apis-audio.md). - -## Constraints - -Before developing a microphone management application, configure the permission **ohos.permission.MICROPHONE** for the application. To set the microphone state, configure the permission **ohos.permission.MANAGE_AUDIO_CONFIG** (a system permission). For details, see [Permission Application Guide](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file). - -## How to Develop - -For details about the APIs, see [AudioVolumeManager in Audio Management](../reference/apis/js-apis-audio.md#audiovolumemanager9) - -1. Obtain an **AudioVolumeGroupManager** instance. - - Before using an API in **AudioVolumeGroupManager**, you must use **getVolumeGroupManager()** to obtain an **AudioStreamManager** instance. - - ```js - import audio from '@ohos.multimedia.audio'; - async loadVolumeGroupManager() { - const groupid = audio.DEFAULT_VOLUME_GROUP_ID; - var audioVolumeGroupManager = await audio.getAudioManager().getVolumeManager().getVolumeGroupManager(groupid); - console.error('audioVolumeGroupManager create success.'); - } - - ``` - -2. (Optional) Obtain the volume information and ringer mode. - - To obtain the volume information of an audio stream (such as the ringtone, voice call, media, and voice assistant) or obtain the ringer mode (silent, vibration, or normal) of the current device, refer to the code below. For more details, see [Audio Management](../reference/apis/js-apis-audio.md). - - ```js - import audio from '@ohos.multimedia.audio'; - async loadVolumeGroupManager() { - const groupid = audio.DEFAULT_VOLUME_GROUP_ID; - var audioVolumeGroupManager = await audio.getAudioManager().getVolumeManager().getVolumeGroupManager(groupid); - console.info('audioVolumeGroupManager create success.'); - } - - // Obtain the volume of a stream. The value ranges from 0 to 15. - async getVolume() { - await loadVolumeGroupManager(); - await audioVolumeGroupManager.getVolume(audio.AudioVolumeType.MEDIA).then((value) => { - console.info(`getVolume success and volume is: ${value}.`); - }); - } - // Obtain the minimum volume of a stream. - async getMinVolume() { - await loadVolumeGroupManager(); - await audioVolumeGroupManager.getMinVolume(audio.AudioVolumeType.MEDIA).then((value) => { - console.info(`getMinVolume success and volume is: ${value}.`); - }); - } - // Obtain the maximum volume of a stream. - async getMaxVolume() { - await loadVolumeGroupManager(); - await audioVolumeGroupManager.getMaxVolume(audio.AudioVolumeType.MEDIA).then((value) => { - console.info(`getMaxVolume success and volume is: ${value}.`); - }); - } - // Obtain the ringer mode in use: silent (0) | vibrate (1) | normal (2). - async getRingerMode() { - await loadVolumeGroupManager(); - await audioVolumeGroupManager.getRingerMode().then((value) => { - console.info(`getRingerMode success and RingerMode is: ${value}.`); - }); - } - ``` - -3. (Optional) Obtain and set the microphone state, and subscribe to microphone state changes. - - To obtain and set the microphone state or subscribe to microphone state changes, refer to the following code: - - ```js - import audio from '@ohos.multimedia.audio'; - async loadVolumeGroupManager() { - const groupid = audio.DEFAULT_VOLUME_GROUP_ID; - var audioVolumeGroupManager = await audio.getAudioManager().getVolumeManager().getVolumeGroupManager(groupid); - console.info('audioVolumeGroupManager create success.'); - } - - async on() { // Subscribe to microphone state changes. - await loadVolumeGroupManager(); - await audioVolumeGroupManager.audioVolumeGroupManager.on('micStateChange', (micStateChange) => { - console.info(`Current microphone status is: ${micStateChange.mute} `); - }); - } - - async isMicrophoneMute() { // Check whether the microphone is muted. - await audioVolumeGroupManager.audioVolumeGroupManager.isMicrophoneMute().then((value) => { - console.info(`isMicrophoneMute is: ${value}.`); - }); - } - - async setMicrophoneMuteTrue() { // Mute the microphone. - await loadVolumeGroupManager(); - await audioVolumeGroupManager.audioVolumeGroupManager.setMicrophoneMute(true).then(() => { - console.info('setMicrophoneMute to mute.'); - }); - } - - async setMicrophoneMuteFalse() { // Unmute the microphone. - await loadVolumeGroupManager(); - await audioVolumeGroupManager.audioVolumeGroupManager.setMicrophoneMute(false).then(() => { - console.info('setMicrophoneMute to not mute.'); - }); - } - async test(){ // Complete process: Subscribe to microphone state changes, obtain the microphone state, mute the microphone, obtain the microphone state, and then unmute the microphone. - await on(); - await isMicrophoneMute(); - await setMicrophoneMuteTrue(); - await isMicrophoneMute(); - await setMicrophoneMuteFalse(); - } - ``` diff --git a/en/application-dev/media/av-overview.md b/en/application-dev/media/av-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..eb0ea76dbfa90a3d3e3dd13e98ecf40876714310 --- /dev/null +++ b/en/application-dev/media/av-overview.md @@ -0,0 +1,66 @@ +# Audio and Video Overview + +You will learn how to use the audio and video APIs provided by the multimedia subsystem to develop a wealth of audio and video playback or recording scenarios. For example, you can use the **TonePlayer** class to implement simple prompt tones so that a drip sound is played upon the receipt of a new message, or use the **AVPlayer** class to develop a music player, which can loop a piece of music. + +For every functionality provided by the multimedia subsystem, you will learn multiple implementation modes, each of which corresponds to a specific usage scenario. You will also learn the sub-functionalities in these scenarios. For example, in the **Audio Playback** chapter, you will learn audio concurrency policies, volume management, and output device processing methods. All these will help you develop an application with more comprehensive features. + +This development guide applies only to audio and video playback and recording, which are implemented by the [@ohos.multimedia.audio](../reference/apis/js-apis-audio.md) and [@ohos.multimedia.media](../reference/apis/js-apis-media.md) modules. The UI, image processing, media storage, or other related capabilities are not covered. + +## Development Description + +Before developing an audio feature, especially before implementing audio data processing, you are advised to understand the following acoustic concepts. This will help you understand how the OpenHarmony APIs control the audio module and how to develop audio and video applications that are easier to use and deliver better experience. + +- Audio quantization process: sampling > quantization > encoding + +- Concepts related to audio quantization: analog signal, digital signal, sampling rate, audio channel, sample format, bit width, bit rate, common encoding formats (such as AAC, MP3, PCM, and WMA), and common encapsulation formats (such as WAV, MPA, FLAC, AAC, and OGG) + +Before developing features related to audio and video playback, you are advised to understand the following concepts: + +- Playback process: network protocol > container format > audio and video codec > graphics/audio rendering +- Network protocols: HLS, HTTP, HTTPS, and more +- Container formats: MP4, MKV, MPEG-TS, WebM, and more +- Encoding formats: H.263/H.264/H.265, MPEG4/MPEG2, and more + +## Introduction to Audio Streams + +An audio stream is an independent audio data processing unit that has a specific audio format and audio usage scenario information. The audio stream can be used in playback and recording scenarios, and supports independent volume adjustment and audio device routing. + +The basic audio stream information is defined by [AudioStreamInfo](../reference/apis/js-apis-audio.md#audiostreaminfo8), which includes the sampling, audio channel, bit width, and encoding information. It describes the basic attributes of audio data and is mandatory for creating an audio playback or recording stream. To enable the audio module to correctly process audio data, the configured basic information must match the transmitted audio data. + +### Audio Stream Usage Scenario Information + +In addition to the basic information (which describes only audio data), an audio stream has usage scenario information. This is because audio streams differ in the volume, device routing, and concurrency policy. The system chooses an appropriate processing policy for an audio stream based on the usage scenario information, thereby delivering the optimal user experience. + +- Playback scenario + +Information about the audio playback scenario is defined by using [StreamUsage](../reference/apis/js-apis-audio.md#streamusage) and [ContentType](../reference/apis/js-apis-audio.md#contenttype). + +- **StreamUsage** specifies the usage type of an audio stream, for example, used for media, voice communication, voice assistant, notification, and ringtone. + +- **ContentType** specifies the content type of data in an audio stream, for example, speech, music, movie, notification tone, and ringtone. + +- Recording scenario + +Information about the audio stream recording scenario is defined by [SourceType](../reference/apis/js-apis-audio.md#sourcetype8). + + **SourceType** specifies the recording source type of an audio stream, including the mic source, voice recognition source, and voice communication source. + +## Supported Audio Formats + +The APIs of the audio module support PCM encoding, including AudioRenderer, AudioCapturer, TonePlayer, and OpenSL ES. + +Be familiar with the following about the audio format: + +- The common audio sampling rates are supported: 8000, 11025, 12000, 16000, 22050, 24000, 32000, 44100, 48000, 64000, and 96000, in units of Hz. For details, see [AudioSamplingRate](../reference/apis/js-apis-audio.md#audiosamplingrate8). + +The sampling rate varies according to the device type. + +- Mono and stereo are supported. For details, see [AudioChannel](../reference/apis/js-apis-audio.md#audiochannel8). + +- The following sampling formats are supported: U8 (unsigned 8-bit integer), S16LE (signed 16-bit integer, little endian), S24LE (signed 24-bit integer, little endian), S32LE (signed 32-bit integer, little endian), and F32LE (signed 32-bit floating point number, little endian). For details, see [AudioSampleFormat](../reference/apis/js-apis-audio.md#audiosampleformat8). + +Due to system restrictions, only some devices support the sampling formats S24LE, S32LE, and F32LE. + + Little endian means that the most significant byte is stored at the largest memory address and the least significant byte of data is stored at the smallest. This storage mode effectively combines the memory address with the bit weight of the data. Specifically, the largest memory address has a high weight, and the smallest memory address has a low weight. + +The audio and video formats supported by the APIs of the media module are described in [AVPlayer and AVRecorder](avplayer-avrecorder-overview.md). diff --git a/en/application-dev/media/avplayer-avrecorder-overview.md b/en/application-dev/media/avplayer-avrecorder-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..051ca3b66ce1839046a2e783a8c274c304625045 --- /dev/null +++ b/en/application-dev/media/avplayer-avrecorder-overview.md @@ -0,0 +1,148 @@ +# AVPlayer and AVRecorder + +The media module provides the [AVPlayer](#avplayer) and [AVRecorder](#avrecorder) class to implement audio and video playback and recording. + +## AVPlayer + +The AVPlayer transcodes audio and video media assets (such as MP4, MP3, MKV, and MPEG-TS) into renderable images and hearable audio analog signals, and plays the audio and video through output devices. + +The AVPlayer provides the integrated playback capability. This means that your application only needs to provide streaming media sources to implement media playback. It does not need to parse or decode data. + + +### Audio Playback + +The figure below shows the interaction when the **AVPlayer** class is used to develop a music application. + +**Figure 1** Interaction with external modules for audio playback + +![Audio playback interaction diagram](figures/audio-playback-interaction-diagram.png) + +When a music application calls the **AVPlayer** APIs at the JS interface layer to implement audio playback, the player framework at the framework layer parses the media asset into audio data streams (in PCM format). The audio data streams are then decoded by software and output to the audio framework. The audio framework outputs the audio data streams to the audio HDI for rendering. A complete audio playback process requires the cooperation of the application, player framework, audio framework, and audio HDI. + +In Figure 1, the numbers indicate the process where data is transferred to external modules. + +1. The music application transfers the media asset to the **AVPlayer** instance. + +2. The player framework outputs the audio PCM data streams to the audio framework, which then outputs the data streams to the audio HDI. + +### Video Playback + +The figure below shows the interaction when the **AVPlayer** class is used to develop a video application. + +**Figure 2** Interaction with external modules for video playback + +![Video playback interaction diagram](figures/video-playback-interaction-diagram.png) + +When the video application calls the **AVPlayer** APIs at the JS interface layer to implement audio and video playback, the player framework at the framework layer parses the media asset into separate audio data streams and video data streams. The audio data streams are then decoded by software and output to the audio framework. The audio framework outputs the audio data streams to the audio HDI at the hardware interface layer to implement audio playback. The video data streams are then decoded by hardware (recommended) or software and output to the graphic framework. The graphic framework outputs the video data streams to the display HDI at the hardware interface layer to implement graphics rendering. + +A complete video playback process requires the cooperation of the application, XComponent, player framework, graphic framework, audio framework, display HDI, and audio HDI. + +In Figure 2, the numbers indicate the process where data is transferred to external modules. + +1. The application obtains a window surface ID from the XComponent. For details about how to obtain the window surface ID, see [XComponent](../reference/arkui-ts/ts-basic-components-xcomponent.md). + +2. The application transfers the media asset and surface ID to the **AVPlayer** instance. + +3. The player framework outputs the video elementary streams (ESs) to the decoding HDI to obtain video frames (NV12/NV21/RGBA). + +4. The player framework outputs the audio PCM data streams to the audio framework, which then outputs the data streams to the audio HDI. + +5. The player framework outputs the video frames (NV12/NV21/RGBA) to the graphic framework, which then outputs the video frames to the display HDI. + +### Supported Formats and Protocols + +Audio and video containers and codecs are domains specific to content creators. You are advised to use the mainstream playback formats, rather than custom ones to avoid playback failures, frame freezing, and artifacts. The system will not be affected by incompatibility issues. If such an issue occurs, you can exit playback. + +The table below lists the supported protocols. + +| Scenario| Description| +| -------- | -------- | +| Local VOD| The file descriptor is supported, but the file path is not.| +| Network VoD| HTTP, HTTPS, and HLS are supported.| + +The table below lists the supported audio playback formats. + +| Audio Container Format| Description| +| -------- | -------- | +| M4A| Audio format: AAC| +| AAC| Audio format: AAC| +| MP3| Audio format: MP3| +| OGG| Audio format: VORBIS | +| WAV| Audio format: PCM | + +> **NOTE** +> +> The supported video formats are further classified into mandatory and optional ones. All vendors must support mandatory ones and can determine whether to implement optional ones based on their service requirements. You are advised to perform compatibility processing to ensure that all the application functions are compatible on different platforms. + +| Video Format| Mandatory or Not| +| -------- | -------- | +| H.264 | Yes| +| MPEG-2 | No| +| MPEG-4 | No| +| H.263 | No| +| VP8 | No| + +The table below lists the supported playback formats and mainstream resolutions. + +| Video Container Format| Description| Resolution| +| -------- | -------- | -------- | +| MP4| Video formats: H.264, MPEG-2, MPEG-4, and H.263
Audio formats: AAC and MP3| Mainstream resolutions, such as 4K, 1080p, 720p, 480p, and 270p| +| MKV| Video formats: H.264, MPEG-2, MPEG-4, and H.263
Audio formats: AAC and MP3| Mainstream resolutions, such as 4K, 1080p, 720p, 480p, and 270p| +| TS| Video formats: H.264, MPEG-2, and MPEG-4
Audio formats: AAC and MP3| Mainstream resolutions, such as 4K, 1080p, 720p, 480p, and 270p| +| WebM| Video format: VP8
Audio format: VORBIS| Mainstream resolutions, such as 4K, 1080p, 720p, 480p, and 270p| + +## AVRecorder + +The AVRecorder captures audio signals, receives video signals, encodes the audio and video signals, and saves them to files. With the AVRecorder, you can easily implement audio and video recording, including starting, pausing, resuming, and stopping recording, and releasing resources. You can also specify parameters such as the encoding format, encapsulation format, and file path for recording. + +**Figure 3** Interaction with external modules for video recording + +![Video recording interaction diagram](figures/video-recording-interaction-diagram.png) + +- Audio recording: When an application calls the **AVRecorder** APIs at the JS interface layer to implement audio recording, the player framework at the framework layer invokes the audio framework to capture audio data through the audio HDI. The audio data is then encoded by software and saved into a file. + +- Video recording: When an application calls the **AVRecorder** APIs at the JS interface layer to implement video recording, the camera framework is first invoked to capture image data. Through the video encoding HDI, the camera framework sends the data to the player framework at the framework layer. The player framework encodes the image data through the video HDI and saves the encoded image data into a file. + +With the AVRecorder, you can implement pure audio recording, pure video recording, and audio and video recording. + +In Figure 3, the numbers indicate the process where data is transferred to external modules. + +1. The application obtains a surface ID from the player framework through the **AVRecorder** instance. + +2. The application sets the surface ID for the camera framework, which obtains the surface corresponding to the surface ID. The camera framework captures image data through the video HDI and sends the data to the player framework at the framework layer. + +3. The camera framework transfers the video data to the player framework through the surface. + +4. The player framework encodes video data through the video HDI. + +5. The player framework sets the audio parameters for the audio framework and obtains the audio data from the audio framework. + +### Supported Formats + +The table below lists the supported audio sources. + +| Type| Description| +| -------- | -------- | +| mic | The system microphone is used as the audio source input.| + +The table below lists the supported video sources. + +| Type| Description | +| -------- | -------- | +| surface_yuv | The input surface carries raw data.| +| surface_es | The input surface carries ES data.| + +The table below lists the supported audio and video encoding formats. + +| Encoding Format| Description | +| -------- | -------- | +| audio/mp4a-latm | Audio encoding format MP4A-LATM.| +| video/mp4v-es | Video encoding format MPEG-4.| +| video/avc | Video encoding format AVC.| + +The table below lists the supported output file formats. + +| Format| Description | +| -------- | -------- | +| MP4| Video container format MP4.| +| M4A| Audio container format M4A.| diff --git a/en/application-dev/media/avplayer-playback.md b/en/application-dev/media/avplayer-playback.md deleted file mode 100644 index 324dd43e6f73d46e5f0d264ae81ba36802ee6021..0000000000000000000000000000000000000000 --- a/en/application-dev/media/avplayer-playback.md +++ /dev/null @@ -1,477 +0,0 @@ -# AVPlayer Development - -## Introduction - -The AVPlayer converts audio or video resources into audible analog signals or renderable images and plays the signals or images using output devices. You can manage playback tasks on the AVPlayer. For example, you can control the playback (start/pause/stop/seek), set the volume, obtain track information, and release resources. - -## Working Principles - -The following figures show the [AVPlayer state](../reference/apis/js-apis-media.md#avplayerstate9) transition and interaction with external audio and video playback modules. - -**Figure 1** AVPlayer state transition - -![en-us_image_avplayer_state_machine](figures/en-us_image_avplayer_state_machine.png) - -**Figure 2** Interaction with external modules for audio playback - -![en-us_image_avplayer_audio](figures/en-us_image_avplayer_audio.png) - -**NOTE**: When an application calls the **AVPlayer** JS APIs at the JS interface layer to implement a feature, the framework layer parses the resources into audio data streams through the playback service of the player framework. The audio data streams are then decoded by software and output to the audio service of the audio framework. The audio framework outputs the audio data streams to the audio HDI at the hardware interface layer to implement audio playback. A complete audio playback process requires the cooperation of the application (application adaptation required), player framework, audio framework, and audio HDI (driver adaptation required). - -1. An application passes a URL into the **AVPlayer** JS API. -2. The playback service outputs the audio PCM data streams to the audio service, and the audio service outputs the data streams to the audio HDI. - - -**Figure 3** Interaction with external modules for video playback - -![en-us_image_avplayer_video](figures/en-us_image_avplayer_video.png) - -**NOTE**: When an application calls the **AVPlayer** JS APIs at the JS interface layer to implement a feature, the framework layer parses the resources into separate audio data streams and video data streams through the playback service of the player framework. The audio data streams are then decoded by software and output to the audio service of the audio framework. The audio framework outputs the audio data streams to the audio HDI at the hardware interface layer to implement audio playback. The video data streams are then decoded by hardware (recommended) or software and output to the renderer service of the graphic framework. The renderer service outputs the video data streams to the display HDI at the hardware interface layer. A complete video playback process requires the cooperation of the application (application adaptation required), XComponent, player framework, graphic framework, audio framework, display HDI (driver adaptation required), and audio HDI (driver adaptation required). - -1. An application obtains the surface ID from the XComponent. For details about the obtaining method, see [XComponent](../reference/arkui-ts/ts-basic-components-xcomponent.md). -2. The application passes a URL and the surface ID into the **AVPlayer** JS API. -3. The playback service outputs video elementary streams (ESs) to the codec HDI, which decodes the ESs to obtain video frames (NV12/NV21/RGBA). -4. The playback service outputs the audio PCM data streams to the audio service, and the audio service outputs the data streams to the audio HDI. -5. The playback service outputs video frames (NV12/NV21/RGBA) to the renderer service, and the renderer service outputs the video frames to the display HDI. - -## Compatibility - -Use the mainstream playback formats and resolutions, rather than custom ones to avoid playback failures, frame freezing, and artifacts. The system will not be affected by incompatibility issues. If such an issue occurs, you can exit stream playback. - -The table below lists the mainstream playback formats and resolutions. - -| Video Container Format| Description | Resolution | -| :----------: | :-----------------------------------------------: | :--------------------------------: | -| mp4 | Video format: H.264/MPEG-2/MPEG-4/H.263; audio format: AAC/MP3| Mainstream resolutions, such as 1080p, 720p, 480p, and 270p| -| mkv | Video format: H.264/MPEG-2/MPEG-4/H.263; audio format: AAC/MP3| Mainstream resolutions, such as 1080p, 720p, 480p, and 270p| -| ts | Video format: H.264/MPEG-2/MPEG-4; audio format: AAC/MP3 | Mainstream resolutions, such as 1080p, 720p, 480p, and 270p| -| webm | Video format: VP8; audio format: VORBIS | Mainstream resolutions, such as 1080p, 720p, 480p, and 270p| - -| Audio Container Format | Description | -| :----------: | :----------: | -| m4a | Audio format: AAC| -| aac | Audio format: AAC| -| mp3 | Audio format: MP3| -| ogg | Audio format: VORBIS | -| wav | Audio format: PCM | - -## How to Develop - -For details about the APIs, see the [AVPlayer APIs in the Media Class](../reference/apis/js-apis-media.md#avplayer9). - -### Full-Process Scenario - -The full playback process includes creating an instance, setting resources, setting a video window, preparing for playback, controlling playback, and resetting or releasing the resources. (During the preparation, you can obtain track information, volume, speed, focus mode, and zoom mode, and set bit rates. To control the playback, you can start, pause, and stop the playback, seek to a playback position, and set the volume.) - -1. Call [createAVPlayer()](../reference/apis/js-apis-media.md#mediacreateavplayer9) to create an **AVPlayer** instance. The AVPlayer is initialized to the [idle](#avplayer_state) state. - -2. Set the events to listen for, which will be used in the full-process scenario. - -3. Set the resource [URL](../reference/apis/js-apis-media.md#avplayer_attributes). When the AVPlayer enters the [initialized](#avplayer_state) state, you can set the [surface ID](../reference/apis/js-apis-media.md#avplayer_attributes) for the video window. For details about the supported specifications, see [AVPlayer Attributes](../reference/apis/js-apis-media.md#avplayer_attributes). - -4. Call [prepare()](../reference/apis/js-apis-media.md#avplayer_prepare) to switch the AVPlayer to the [prepared](#avplayer_state) state. - -5. Perform video playback control. For example, you can call [play()](../reference/apis/js-apis-media.md#avplayer_play), [pause()](../reference/apis/js-apis-media.md#avplayer_pause), [seek()](../reference/apis/js-apis-media.md#avplayer_seek), and [stop()](../reference/apis/js-apis-media.md#avplayer_stop) to control the playback. - -6. Call [reset()](../reference/apis/js-apis-media.md#avplayer_reset) to reset resources. The AVPlayer enters the [idle](#avplayer_state) state again, and you can change the resource [URL](../reference/apis/js-apis-media.md#avplayer_attributes). - -7. Call [release()](../reference/apis/js-apis-media.md#avplayer_release) to release the instance. The AVPlayer enters the [released](#avplayer_state) state and exits the playback. - -> **NOTE** -> -> When the AVPlayer is in the prepared, playing, paused, or completed state, the playback engine is working and a large amount of system running memory is occupied. If your application does not need to use the AVPlayer, call **reset()** or **release()** to release the resources. - -### Listening Events - -| Event Type | Description | -| ------------------------------------------------- | ------------------------------------------------------------ | -| stateChange | Mandatory; used to listen for player state changes. | -| error | Mandatory; used to listen for player error information. | -| durationUpdate | Used to listen for progress bar updates to refresh the resource duration. | -| timeUpdate | Used to listen for the current position of the progress bar to refresh the current time. | -| seekDone | Used to listen for the completion status of the **seek()** request. | -| speedDone | Used to listen for the completion status of the **setSpeed()** request. | -| volumeChange | Used to listen for the completion status of the **setVolume()** request. | -| bitrateDone | Used to listen for the completion status of the **setBitrate()** request, which is used for HTTP Live Streaming (HLS) streams. | -| availableBitrates | Used to listen for available bit rates of HLS resources. The available bit rates are provided for **setBitrate()**. | -| bufferingUpdate | Used to listen for network playback buffer information. | -| startRenderFrame | Used to listen for the rendering time of the first frame during video playback. | -| videoSizeChange | Used to listen for the width and height of video playback and adjust the window size and ratio.| -| audioInterrupt | Used to listen for audio interruption during video playback. This event is used together with the **audioInterruptMode** attribute.| - -### Full-Process Scenario API Example - -```js -import media from '@ohos.multimedia.media' -import audio from '@ohos.multimedia.audio'; -import fs from '@ohos.file.fs' - -const TAG = 'AVPlayerDemo:' -export class AVPlayerDemo { - private count:number = 0 - private avPlayer - private surfaceID:string // The surfaceID parameter is used for screen display. Its value is obtained through the XComponent API. - - // Set AVPlayer callback functions. - setAVPlayerCallback() { - // Callback function for state changes. - this.avPlayer.on('stateChange', async (state, reason) => { - switch (state) { - case 'idle': // This state is reported upon a successful callback of reset(). - console.info(TAG + 'state idle called') - this.avPlayer.release() // Release the AVPlayer instance. - break; - case 'initialized': // This state is reported when the AVPlayer sets the playback source. - console.info(TAG + 'state initialized called ') - this.avPlayer.surfaceId = this.surfaceID // Set the image to be displayed. This setting is not required when a pure audio resource is to be played. - this.avPlayer.prepare().then(() => { - console.info(TAG+ 'prepare success'); - }, (err) => { - console.error(TAG + 'prepare filed,error message is :' + err.message) - }) - break; - case 'prepared': // This state is reported upon a successful callback of prepare(). - console.info(TAG + 'state prepared called') - this.avPlayer.play() // Call play() to start playback. - break; - case 'playing': // This state is reported upon a successful callback of play(). - console.info(TAG + 'state playing called') - if (this.count == 0) { - this.avPlayer.pause() // Call pause() to pause the playback. - } else { - this.avPlayer.seek(10000, media.SeekMode.SEEK_PREV_SYNC) // Seek to 10 seconds. The seekDone callback is triggered. - } - break; - case 'paused': // This state is reported upon a successful callback of pause(). - console.info(TAG + 'state paused called') - if (this.count == 0) { - this.count++ - this.avPlayer.play() // Call play() to continue the playback. - } - break; - case 'completed': // This state is reported upon the completion of the playback. - console.info(TAG + 'state completed called') - this.avPlayer.stop() // Call stop() to stop the playback. - break; - case 'stopped': // This state is reported upon a successful callback of stop(). - console.info(TAG + 'state stopped called') - this.avPlayer.reset() // Call reset() to initialize the AVPlayer state. - break; - case 'released': - console.info(TAG + 'state released called') - break; - case 'error': - console.info(TAG + 'state error called') - break; - default: - console.info(TAG + 'unkown state :' + state) - break; - } - }) - // Callback function for time updates. - this.avPlayer.on('timeUpdate', (time:number) => { - console.info(TAG + 'timeUpdate success,and new time is :' + time) - }) - // Callback function for volume updates. - this.avPlayer.on('volumeChange', (vol:number) => { - console.info(TAG + 'volumeChange success,and new volume is :' + vol) - this.avPlayer.setSpeed(media.AVPlayerSpeed.SPEED_FORWARD_2_00_X) // Double the playback speed. The speedDone callback is triggered. - }) - // Callback function for the video playback completion event. - this.avPlayer.on('endOfStream', () => { - console.info(TAG + 'endOfStream success') - }) - // Callback function for the seek operation. - this.avPlayer.on('seekDone', (seekDoneTime:number) => { - console.info(TAG + 'seekDone success,and seek time is:' + seekDoneTime) - this.avPlayer.setVolume(0.5) // Set the volume to 0.5. The volumeChange callback is triggered. - }) - // Callback function for the speed setting operation. - this.avPlayer.on('speedDone', (speed:number) => { - console.info(TAG + 'speedDone success,and speed value is:' + speed) - }) - // Callback function for successful bit rate setting. - this.avPlayer.on('bitrateDone', (bitrate:number) => { - console.info(TAG + 'bitrateDone success,and bitrate value is:' + bitrate) - }) - // Callback function for buffering updates. - this.avPlayer.on('bufferingUpdate', (infoType: media.BufferingInfoType, value: number) => { - console.info(TAG + 'bufferingUpdate success,and infoType value is:' + infoType + ', value is :' + value) - }) - // Callback function invoked when frame rendering starts. - this.avPlayer.on('startRenderFrame', () => { - console.info(TAG + 'startRenderFrame success') - }) - // Callback function for video width and height changes. - this.avPlayer.on('videoSizeChange', (width: number, height: number) => { - console.info(TAG + 'videoSizeChange success,and width is:' + width + ', height is :' + height) - }) - // Callback function for the audio interruption event. - this.avPlayer.on('audioInterrupt', (info: audio.InterruptEvent) => { - console.info(TAG + 'audioInterrupt success,and InterruptEvent info is:' + info) - }) - // Callback function to report the available bit rates of HLS. - this.avPlayer.on('availableBitrates', (bitrates: Array) => { - console.info(TAG + 'availableBitrates success,and availableBitrates length is:' + bitrates.length) - }) - } - - async avPlayerDemo() { - // Create an AVPlayer instance. - this.avPlayer = await media.createAVPlayer() - let fdPath = 'fd://' - let pathDir = "/data/storage/el2/base/haps/entry/files" // The path used here is an example. Obtain the path based on project requirements. - // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\H264_AAC.mp4 /data/app/el2/100/base/ohos.acts.multimedia.media.avplayer/haps/entry/files" command. - let path = pathDir + '/H264_AAC.mp4' - let file = await fs.open(path) - fdPath = fdPath + '' + file.fd - this.avPlayer.url = fdPath - } -} -``` - -### Normal Playback Scenario - -```js -import media from '@ohos.multimedia.media' -import fs from '@ohos.file.fs' - -const TAG = 'AVPlayerDemo:' -export class AVPlayerDemo { - private avPlayer - private surfaceID:string // The surfaceID parameter is used for screen display. Its value is obtained through the XComponent API. - - // Set AVPlayer callback functions. - setAVPlayerCallback() { - // Callback function for state changes. - this.avPlayer.on('stateChange', async (state, reason) => { - switch (state) { - case 'idle': // This state is reported upon a successful callback of reset(). - console.info(TAG + 'state idle called') - break; - case 'initialized': // This state is reported when the AVPlayer sets the playback source. - console.info(TAG + 'state initialized called ') - this.avPlayer.surfaceId = this.surfaceID // Set the image to be displayed. This setting is not required when a pure audio resource is to be played. - this.avPlayer.prepare().then(() => { - console.info(TAG+ 'prepare success'); - }, (err) => { - console.error(TAG + 'prepare filed,error message is :' + err.message) - }) - break; - case 'prepared': // This state is reported upon a successful callback of prepare(). - console.info(TAG + 'state prepared called') - this.avPlayer.play() // Call play() to start playback. - break; - case 'playing': // This state is reported upon a successful callback of play(). - console.info(TAG + 'state playing called') - break; - case 'paused': // This state is reported upon a successful callback of pause(). - console.info(TAG + 'state paused called') - break; - case 'completed': // This state is reported upon the completion of the playback. - console.info(TAG + 'state completed called') - this.avPlayer.stop() // Call stop() to stop the playback. - break; - case 'stopped': // This state is reported upon a successful callback of stop(). - console.info(TAG + 'state stopped called') - this.avPlayer.release() // Call reset() to initialize the AVPlayer state. - break; - case 'released': - console.info(TAG + 'state released called') - break; - case 'error': - console.info(TAG + 'state error called') - break; - default: - console.info(TAG + 'unkown state :' + state) - break; - } - }) - } - - async avPlayerDemo() { - // Create an AVPlayer instance. - this.avPlayer = await media.createAVPlayer() - let fdPath = 'fd://' - let pathDir = "/data/storage/el2/base/haps/entry/files" // The path used here is an example. Obtain the path based on project requirements. - // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\H264_AAC.mp4 /data/app/el2/100/base/ohos.acts.multimedia.media.avplayer/haps/entry/files" command. - let path = pathDir + '/H264_AAC.mp4' - let file = await fs.open(path) - fdPath = fdPath + '' + file.fd - this.avPlayer.url = fdPath - } -} -``` - -### Looping a Song - -```js -import media from '@ohos.multimedia.media' -import fs from '@ohos.file.fs' - -const TAG = 'AVPlayerDemo:' -export class AVPlayerDemo { - private count:number = 0 - private avPlayer - private surfaceID:string // The surfaceID parameter is used for screen display. Its value is obtained through the XComponent API. - - // Set AVPlayer callback functions. - setAVPlayerCallback() { - // Callback function for state changes. - this.avPlayer.on('stateChange', async (state, reason) => { - switch (state) { - case 'idle': // This state is reported upon a successful callback of reset(). - console.info(TAG + 'state idle called') - break; - case 'initialized': // This state is reported when the AVPlayer sets the playback source. - console.info(TAG + 'state initialized called ') - this.avPlayer.surfaceId = this.surfaceID // Set the image to be displayed. This setting is not required when a pure audio resource is to be played. - this.avPlayer.prepare().then(() => { - console.info(TAG+ 'prepare success'); - }, (err) => { - console.error(TAG + 'prepare filed,error message is :' + err.message) - }) - break; - case 'prepared': // This state is reported upon a successful callback of prepare(). - console.info(TAG + 'state prepared called') - this.avPlayer.loop = true // Set the AVPlayer to loop a single item. The endOfStream callback is triggered when the previous round of the playback is complete. - this.avPlayer.play() // Call play() to start playback. - break; - case 'playing': // This state is reported upon a successful callback of play(). - console.info(TAG + 'state playing called') - break; - case 'paused': // This state is reported upon a successful callback of pause(). - console.info(TAG + 'state paused called') - break; - case 'completed': // This state is reported upon the completion of the playback. - console.info(TAG + 'state completed called') - // Cancel the loop playback when the endOfStream callback is triggered for the second time. The completed state is reported when the next round of the playback is complete. - this.avPlayer.stop() // Call stop() to stop the playback. - break; - case 'stopped': // This state is reported upon a successful callback of stop(). - console.info(TAG + 'state stopped called') - this.avPlayer.release() // Call reset() to initialize the AVPlayer state. - break; - case 'released': - console.info(TAG + 'state released called') - break; - case 'error': - console.info(TAG + 'state error called') - break; - default: - console.info(TAG + 'unkown state :' + state) - break; - } - }) - // Callback function for the video playback completion event. - this.avPlayer.on('endOfStream', () => { - console.info(TAG + 'endOfStream success') - if (this.count == 1) { - this.avPlayer.loop = false // Cancel loop playback. - } else { - this.count++ - } - }) - } - - async avPlayerDemo() { - // Create an AVPlayer instance. - this.avPlayer = await media.createAVPlayer() - let fdPath = 'fd://' - let pathDir = "/data/storage/el2/base/haps/entry/files" // The path used here is an example. Obtain the path based on project requirements. - // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\H264_AAC.mp4 /data/app/el2/100/base/ohos.acts.multimedia.media.avplayer/haps/entry/files" command. - let path = pathDir + '/H264_AAC.mp4' - let file = await fs.open(path) - fdPath = fdPath + '' + file.fd - this.avPlayer.url = fdPath - } -} -``` -### Switching to the Next Video Clip - -```js -import media from '@ohos.multimedia.media' -import fs from '@ohos.file.fs' - -const TAG = 'AVPlayerDemo:' -export class AVPlayerDemo { - private count:number = 0 - private avPlayer - private surfaceID:string // The surfaceID parameter is used for screen display. Its value is obtained through the XComponent API. - - async nextVideo() { - let fdPath = 'fd://' - let pathDir = "/data/storage/el2/base/haps/entry/files" // The path used here is an example. Obtain the path based on project requirements. - // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\H264_MP3.mp4 /data/app/el2/100/base/ohos.acts.multimedia.media.avplayer/haps/entry/files" command. - let path = pathDir + '/H264_MP3.mp4' - let file = await fs.open(path) - fdPath = fdPath + '' + file.fd - this.avPlayer.url = fdPath // The initialized state is reported again. - } - - // Set AVPlayer callback functions. - setAVPlayerCallback() { - // Callback function for state changes. - this.avPlayer.on('stateChange', async (state, reason) => { - switch (state) { - case 'idle': // This state is reported upon a successful callback of reset(). - console.info(TAG + 'state idle called') - await this.nextVideo() // Switch to the next video. - break; - case 'initialized': // This state is reported when the AVPlayer sets the playback source. - console.info(TAG + 'state initialized called ') - this.avPlayer.surfaceId = this.surfaceID // Set the image to be displayed. This setting is not required when a pure audio resource is to be played. - this.avPlayer.prepare().then(() => { - console.info(TAG+ 'prepare success'); - }, (err) => { - console.error(TAG + 'prepare filed,error message is :' + err.message) - }) - break; - case 'prepared': // This state is reported upon a successful callback of prepare(). - console.info(TAG + 'state prepared called') - this.avPlayer.play() // Call play() to start playback. - break; - case 'playing': // This state is reported upon a successful callback of play(). - console.info(TAG + 'state playing called') - break; - case 'paused': // This state is reported upon a successful callback of pause(). - console.info(TAG + 'state paused called') - break; - case 'completed': // This state is reported upon the completion of the playback. - console.info(TAG + 'state completed called') - if (this.count == 0) { - this.count++ - this.avPlayer.reset() // Call reset() to prepare for switching to the next video. - } else { - this.avPlayer.release() // Release the AVPlayer instance when the new video finishes playing. - } - break; - case 'stopped': // This state is reported upon a successful callback of stop(). - console.info(TAG + 'state stopped called') - break; - case 'released': - console.info(TAG + 'state released called') - break; - case 'error': - console.info(TAG + 'state error called') - break; - default: - console.info(TAG + 'unkown state :' + state) - break; - } - }) - } - - async avPlayerDemo() { - // Create an AVPlayer instance. - this.avPlayer = await media.createAVPlayer() - let fdPath = 'fd://' - let pathDir = "/data/storage/el2/base/haps/entry/files" // The path used here is an example. Obtain the path based on project requirements. - // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\H264_AAC.mp4 /data/app/el2/100/base/ohos.acts.multimedia.media.avplayer/haps/entry/files" command. - let path = pathDir + '/H264_AAC.mp4' - let file = await fs.open(path) - fdPath = fdPath + '' + file.fd - this.avPlayer.url = fdPath - } -} -``` diff --git a/en/application-dev/media/avrecorder.md b/en/application-dev/media/avrecorder.md deleted file mode 100644 index 9214df032d7d060cabe9900e8a0d5ab6e7aa12f9..0000000000000000000000000000000000000000 --- a/en/application-dev/media/avrecorder.md +++ /dev/null @@ -1,488 +0,0 @@ -# AVRecorder Development - -## Introduction - -The AVRecorder captures audio signals, receives video signals, encodes audio and video signals, and saves them to files. With the AVRecorder, you can easily implement audio and video recording, including starting, pausing, resuming, and stopping recording, and releasing resources. You can also specify parameters such as the encoding format, encapsulation format, and file path for recording. - -## Working Principles - -The following figures show the AVRecorder state transition and the interaction with external modules for audio and video recording. - -**Figure 1** AVRecorder state transition - -![en-us_image_video_recorder_state_machine](figures/en-us_image_avrecorder_state_machine.png) - -**Figure 2** Interaction between external modules for audio and video recording - -![en-us_image_video_recorder_zero](figures/en-us_image_avrecorder_module_interaction.png) - -**NOTE**: During audio recording, the framework layer calls the audio subsystem through the media service of the native framework to capture audio data through the audio HDI, encodes and encapsulates the data by using software, and saves the data to a file. During video recording, the camera subsystem captures image data through the video HDI. The media service encodes the image data through the video encoding HDI and encapsulates the encoded image data into a file. With the AVRecorder, you can implement pure audio recording, pure video recording, and audio and video recording. - -## Constraints - -Before developing the recording feature, configure permissions for your application. If audio recording is involved, obtain the permission **ohos.permission.MICROPHONE** by following the instructions provided in [Permission Application Guide](../security/accesstoken-guidelines.md). - -To use the camera to record videos, the camera module is required. For details about how to use the APIs and obtain permissions, see [Camera Management](../reference/apis/js-apis-camera.md). - -## How to Develop - -For details about the AVRecorder APIs, see the [AVRecorder APIs in the Media Class](../reference/apis/js-apis-media.md#avrecorder9). - -For details about the processes related to the media library, see [Media Library Management](../reference/apis/js-apis-medialibrary.md). - -For details about the camera-related process, see [Camera Management](../reference/apis/js-apis-camera.md). - -### Full-Process Scenario of Audio and Video Recording - -The full audio and video recording process includes creating an instance, setting recording parameters, obtaining the input surface, starting, pausing, resuming, and stopping recording, and releasing resources. - -The value range that can be set for the audio recording parameters is restricted by the codec performance of the device and the performance of the audio subsystem. - -The video range that can be set for the video recording parameters is restricted by the codec performance of the device and the performance of the camera subsystem. - -``` -import media from '@ohos.multimedia.media' -import camera from '@ohos.multimedia.camera' -import mediaLibrary from '@ohos.multimedia.mediaLibrary' - -export class AVRecorderDemo { - private testFdNumber; // Used to save the File Descriptor (FD) address. - - // Obtain the FD corresponding to fileName of the recorded file. The media library capability is required. To use the media library, configure the following permissions: ohos.permission.MEDIA_LOCATION, ohos.permission.WRITE_MEDIA, and ohos.permission.READ_MEDIA. - async getFd(fileName) { - // For details about the implementation mode, see the media library documentation. - this.testFdNumber = "fd://" + fdNumber.toString(); // e.g. fd://54 - } - - // Error callback triggered in the case of an error in the promise mode. - failureCallback(error) { - console.info('error happened, error message is ' + error.message); - } - - // Error callback triggered in the case of an exception in the promise mode. - catchCallback(error) { - console.info('catch error happened, error message is ' + error.message); - } - - async AVRecorderDemo() { - let AVRecorder; // Assign a value to the empty AVRecorder instance upon a successful call of createAVRecorder(). - let surfaceID; // The surface ID is obtained by calling getInputSurface and transferred to the videoOutput object of the camera. - await this.getFd('01.mp4'); - - // Configure the parameters related to audio and video recording based on those supported by the hardware device. - let avProfile = { - audioBitrate : 48000, - audioChannels : 2, - audioCodec : media.CodecMimeType.AUDIO_AAC, - audioSampleRate : 48000, - fileFormat : media.ContainerFormatType.CFT_MPEG_4, - videoBitrate : 2000000, - videoCodec : media.CodecMimeType.VIDEO_MPEG4, - videoFrameWidth : 640, - videoFrameHeight : 480, - videoFrameRate : 30 - } - let avConfig = { - audioSourceType : media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC, - videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV, - profile : avProfile, - url : 'fd://', - rotation : 0, - location : { latitude : 30, longitude : 130 } - } - - // Create an AVRecorder instance. - await media.createAVRecorder().then((recorder) => { - console.info('case createAVRecorder called'); - if (typeof (recorder) != 'undefined') { - AVRecorder = recorder; - console.info('createAVRecorder success'); - } else { - console.info('createAVRecorder failed'); - } - }, this.failureCallback).catch(this.catchCallback); - - // After the instance is created, use the on('stateChange') and on('error') callbacks to listen for state changes and errors. - AVRecorder.on('stateChange', async (state, reason) => { - console.info('case state has changed, new state is :' + state); - switch (state) { - // Your can set the desired behavior in different states as required. - case 'idle': - // This state is reported upon a successful call of rest() or create(). - break; - case 'prepared': - // This state is reported upon a successful call of prepare(). - break; - case 'started': - // This state is reported upon a successful call of start(). - break; - case 'paused': - // This state is reported upon a successful call of pause(). - break; - case 'stopped': - // This state is reported upon a successful call of stop(). - break; - case 'released': - // This state is reported upon a successful call of release(). - break; - case 'error': - // The error state indicates that an error occurs at the bottom layer. You must rectify the fault and create an AVRecorder instance again. - break; - default: - console.info('case state is unknown'); - } - }); - AVRecorder.on('error', (err) => { - // Listen for non-interface errors. - console.info('case avRecorder.on(error) called, errMessage is ' + err.message); - }); - - // Call prepare() to prepare for recording. The bottom layer determines whether to record audio, video, or audio and video based on the input parameters of prepare(). - await AVRecorder.prepare(avConfig).then(() => { - console.info('prepare success'); - }, this.failureCallback).catch(this.catchCallback); - - // If video recording is involved, call getInputSurface to obtain the input surface and pass the returned surface ID to the related camera API. - await AVRecorder.getInputSurface().then((surface) => { - console.info('getInputSurface success'); - surfaceID = surface; // The surfaceID is passed into createVideoOutput() of the camera as an input parameter. - }, this.failureCallback).catch(this.catchCallback); - - // Video recording depends on camera-related APIs. The following operations can be performed only after the video output start API is invoked. - // Start video recording. - await AVRecorder.start().then(() => { - console.info('start success'); - }, this.failureCallback).catch(this.catchCallback); - - // Pause video recording before the video output stop API of the camera is invoked. - await AVRecorder.pause().then(() => { - console.info('pause success'); - }, this.failureCallback).catch(this.catchCallback); - - // Resume video recording after the video output start API of the camera is invoked. - await AVRecorder.resume().then(() => { - console.info('resume success'); - }, this.failureCallback).catch(this.catchCallback); - - // Stop video recording after the video output stop API of the camera is invoked. - await AVRecorder.stop().then(() => { - console.info('stop success'); - }, this.failureCallback).catch(this.catchCallback); - - // Reset the recording configuration. - await AVRecorder.reset().then(() => { - console.info('reset success'); - }, this.failureCallback).catch(this.catchCallback); - - // Disable the listeners. The configured callbacks will be invalid after release() is invoked, even if you do not call off(). - AVRecorder.off('stateChange'); - AVRecorder.off('error'); - - // Release the video recording resources and camera object resources. - await AVRecorder.release().then(() => { - console.info('release success'); - }, this.failureCallback).catch(this.catchCallback); - - // Set the AVRecorder instance to null. - AVRecorder = undefined; - surfaceID = undefined; - } -} -``` - -### Full-Process Scenario of Pure Audio Recording - -The full audio recording process includes creating an instance, setting recording parameters, starting, pausing, resuming, and stopping recording, and releasing resources. - -The value range that can be set for the audio recording parameters is restricted by the codec performance of the device and the performance of the audio subsystem. - -``` -import media from '@ohos.multimedia.media' -import mediaLibrary from '@ohos.multimedia.mediaLibrary' - -export class AudioRecorderDemo { - private testFdNumber; // Used to save the FD address. - - // Obtain the FD corresponding to fileName of the recorded file. The media library capability is required. To use the media library, configure the following permissions: ohos.permission.MEDIA_LOCATION, ohos.permission.WRITE_MEDIA, and ohos.permission.READ_MEDIA. - async getFd(fileName) { - // For details about the implementation mode, see the media library documentation. - this.testFdNumber = "fd://" + fdNumber.toString(); // e.g. fd://54 - } - - // Error callback triggered in the case of an error in the promise mode. - failureCallback(error) { - console.info('error happened, error message is ' + error.message); - } - - // Error callback triggered in the case of an exception in the promise mode. - catchCallback(error) { - console.info('catch error happened, error message is ' + error.message); - } - - async audioRecorderDemo() { - let audioRecorder; // Assign a value to the empty AudioRecorder instance upon a successful call of createAVRecorder(). - await this.getFd('01.m4a'); - // Configure the parameters related to audio recording. - let audioProfile = { - audioBitrate : 48000, - audioChannels : 2, - audioCodec : media.CodecMimeType.AUDIO_AAC, - audioSampleRate : 48000, - fileFormat : media.ContainerFormatType.CFT_MPEG_4, - } - let audioConfig = { - audioSourceType : media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC, - profile : audioProfile, - url : this.testFdNumber, - rotation : 0, - location : { latitude : 30, longitude : 130 } - } - - // Create an AudioRecorder instance. - await media.createAVRecorder().then((recorder) => { - console.info('case createAVRecorder called'); - if (typeof (recorder) != 'undefined') { - audioRecorder = recorder; - console.info('createAudioRecorder success'); - } else { - console.info('createAudioRecorder failed'); - } - }, this.failureCallback).catch(this.catchCallback); - - // After the instance is created, use the on('stateChange') and on('error') callbacks to listen for state changes and errors. - audioRecorder.on('stateChange', async (state, reason) => { - console.info('case state has changed, new state is :' + state); - switch (state) { - // Your can set the desired behavior in different states as required. - case 'idle': - // This state is reported upon a successful call of rest() or create(). - break; - case 'prepared': - // This state is reported upon a successful call of prepare(). - break; - case 'started': - // This state is reported upon a successful call of start(). - break; - case 'paused': - // This state is reported upon a successful call of pause(). - break; - case 'stopped': - // This state is reported upon a successful call of stop(). - break; - case 'released': - // This state is reported upon a successful call of release(). - break; - case 'error': - // The error state indicates that an error occurs at the bottom layer. You must rectify the fault and create an AudioRecorder instance again. - break; - default: - console.info('case state is unknown'); - } - }); - audioRecorder.on('error', (err) => { - // Listen for non-interface errors. - console.info('case avRecorder.on(error) called, errMessage is ' + err.message); - }); - - // Call prepare() to prepare for recording. The bottom layer determines whether to record audio, video, or audio and video based on the input parameters of prepare(). - await audioRecorder.prepare(audioConfig).then(() => { - console.info('prepare success'); - }, this.failureCallback).catch(this.catchCallback); - - // Call start() to start audio recording. - await audioRecorder.start().then(() => { - console.info('start success'); - }, this.failureCallback).catch(this.catchCallback); - - // Call pause() to pause audio recording. - await audioRecorder.pause().then(() => { - console.info('pause success'); - }, this.failureCallback).catch(this.catchCallback); - - // Call resume() to resume audio recording. - await audioRecorder.resume().then(() => { - console.info('resume success'); - }, this.failureCallback).catch(this.catchCallback); - - // Call stop() to stop audio recording. - await audioRecorder.stop().then(() => { - console.info('stop success'); - }, this.failureCallback).catch(this.catchCallback); - - // Call reset() to reset the recording configuration. - await audioRecorder.reset().then(() => { - console.info('reset success'); - }, this.failureCallback).catch(this.catchCallback); - - // Disable the listeners. The configured callbacks will be invalid after release() is invoked, even if you do not call off(). - avRecorder.off('stateChange'); - avRecorder.off('error'); - - // Call release() to release audio recording resources. - await audioRecorder.release().then(() => { - console.info('release success'); - }, this.failureCallback).catch(this.catchCallback); - - // Set the AudioRecorder instance to null. - audioRecorder = undefined; - } -} - -``` - -### Full-Process Scenario of Pure Video Recording - -The full video recording process includes creating an instance, setting recording parameters, obtaining the input surface, starting, pausing, resuming, and stopping recording, and releasing resources. - -The video range that can be set for the video recording parameters is restricted by the codec performance of the device and the performance of the camera subsystem. - -``` -import media from '@ohos.multimedia.media' -import camera from '@ohos.multimedia.camera' -import mediaLibrary from '@ohos.multimedia.mediaLibrary' - -export class VideoRecorderDemo { - private testFdNumber; // Used to save the FD address. - - // Obtain the FD corresponding to fileName of the recorded file. The media library capability is required. To use the media library, configure the following permissions: ohos.permission.MEDIA_LOCATION, ohos.permission.WRITE_MEDIA, and ohos.permission.READ_MEDIA. - async getFd(fileName) { - // For details about the implementation mode, see the media library documentation. - this.testFdNumber = "fd://" + fdNumber.toString(); // e.g. fd://54 - } - - // Error callback triggered in the case of an error in the promise mode. - failureCallback(error) { - console.info('error happened, error message is ' + error.message); - } - - // Error callback triggered in the case of an exception in the promise mode. - catchCallback(error) { - console.info('catch error happened, error message is ' + error.message); - } - - async videoRecorderDemo() { - let videoRecorder; // Assign a value to the empty VideoRecorder instance upon a successful call of createAVRecorder(). - let surfaceID; // The surface ID is obtained by calling getInputSurface and transferred to the videoOutput object of the camera. - await this.getFd('01.mp4'); - - // Configure the parameters related to pure video recording based on those supported by the hardware device. - let videoProfile = { - fileFormat : media.ContainerFormatType.CFT_MPEG_4, - videoBitrate : 2000000, - videoCodec : media.CodecMimeType.VIDEO_MPEG4, - videoFrameWidth : 640, - videoFrameHeight : 480, - videoFrameRate : 30 - } - let videoConfig = { - videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV, - profile : videoProfile, - url : 'fd://', - rotation : 0, - location : { latitude : 30, longitude : 130 } - } - - // Create a VideoRecorder instance. - await media.createAVRecorder().then((recorder) => { - console.info('case createVideoRecorder called'); - if (typeof (recorder) != 'undefined') { - videoRecorder = recorder; - console.info('createVideoRecorder success'); - } else { - console.info('createVideoRecorder failed'); - } - }, this.failureCallback).catch(this.catchCallback); - - // After the instance is created, use the on('stateChange') and on('error') callbacks to listen for state changes and errors. - videoRecorder.on('stateChange', async (state, reason) => { - console.info('case state has changed, new state is :' + state); - switch (state) { - // Your can set the desired behavior in different states as required. - case 'idle': - // This state is reported upon a successful call of rest() or create(). - break; - case 'prepared': - // This state is reported upon a successful call of prepare(). - break; - case 'started': - // This state is reported upon a successful call of start(). - break; - case 'paused': - // This state is reported upon a successful call of pause(). - break; - case 'stopped': - // This state is reported upon a successful call of stop(). - break; - case 'released': - // This state is reported upon a successful call of release(). - break; - case 'error': - // The error state indicates that an error occurs at the bottom layer. You must rectify the fault and create a VideoRecorder instance again. - break; - default: - console.info('case state is unknown'); - } - }); - videoRecorder.on('error', (err) => { - // Listen for non-interface errors. - console.info('case avRecorder.on(error) called, errMessage is ' + err.message); - }); - - // Call prepare() to prepare for recording. The bottom layer determines whether to record audio, video, or audio and video based on the input parameters of prepare(). - await videoRecorder.prepare(videoConfig).then(() => { - console.info('prepare success'); - }, this.failureCallback).catch(this.catchCallback); - - // If video recording is involved, call getInputSurface to obtain the input surface and pass the returned surface ID to the related camera API. - await videoRecorder.getInputSurface().then((surface) => { - console.info('getInputSurface success'); - surfaceID = surface; // The surfaceID is passed into createVideoOutput() of the camera as an input parameter. - }, this.failureCallback).catch(this.catchCallback); - - // Video recording depends on camera-related APIs. The following operations can be performed only after the video output start API is invoked. - // Start video recording. - await videoRecorder.start().then(() => { - console.info('start success'); - }, this.failureCallback).catch(this.catchCallback); - - // Pause video recording before the video output stop API of the camera is invoked. - await videoRecorder.pause().then(() => { - console.info('pause success'); - }, this.failureCallback).catch(this.catchCallback); - - // Resume video recording after the video output start API of the camera is invoked. - await videoRecorder.resume().then(() => { - console.info('resume success'); - }, this.failureCallback).catch(this.catchCallback); - - // Stop video recording after the video output stop API of the camera is invoked. - await videoRecorder.stop().then(() => { - console.info('stop success'); - }, this.failureCallback).catch(this.catchCallback); - - // Reset the recording configuration. - await videoRecorder.reset().then(() => { - console.info('reset success'); - }, this.failureCallback).catch(this.catchCallback); - - // Disable the listeners. The configured callbacks will be invalid after release() is invoked, even if you do not call off(). - videoRecorder.off('stateChange'); - videoRecorder.off('error'); - - // Release the video recording resources and camera object resources. - await videoRecorder.release().then(() => { - console.info('release success'); - }, this.failureCallback).catch(this.catchCallback); - - // Set the VideoRecorder instance to null. - videoRecorder = undefined; - surfaceID = undefined; - } -} -``` - -### AVRecorder App - -The AVRecorder app provides a complete audio and video recording process, which includes creating an instance, setting recording parameters, obtaining the input surface, starting, pausing, resuming, and stopping recording, and releasing resources. - -For details about the code, see [AVRecorderDemo]([multimedia_player_framework: Implementation of media playback and recording](https://gitee.com/openharmony/multimedia_player_framework/tree/master/test/appdemo/AVRecorderDemo)). diff --git a/en/application-dev/media/avsession-guidelines.md b/en/application-dev/media/avsession-guidelines.md deleted file mode 100644 index 3d1ac479f0f358c42778e60a0d4b47edafe0a0cd..0000000000000000000000000000000000000000 --- a/en/application-dev/media/avsession-guidelines.md +++ /dev/null @@ -1,633 +0,0 @@ -# AVSession Development - -> **NOTE** -> -> All APIs of the **AVSession** module are system APIs and can be called only by system applications. - -## Development for the Session Access End - -### Basic Concepts -- **AVMetadata**: media data related attributes, including the IDs of the current media asset, previous media asset, and next media asset, title, author, album, writer, and duration. -- **AVSessionDescriptor**: descriptor about a media session, including the session ID, session type (audio/video), custom session name (**sessionTag**), and information about the corresponding application (**elementName**). -- **AVPlaybackState**: information related to the media playback state, including the playback state, position, speed, buffered time, loop mode, and whether the media asset is favorited (**isFavorite**). - -### Available APIs -The table below lists the APIs available for the development of the session access end. The APIs use either a callback or promise to return the result. The APIs listed below use a callback, which provide the same functions as their counterparts that use a promise. For details, see [AVSession Management](../reference/apis/js-apis-avsession.md). - -Table 1 Common APIs for session access end development - -| API | Description | -|----------------------------------------------------------------------------------|-------------| -| createAVSession(context: Context, tag: string, type: AVSessionType, callback: AsyncCallback\): void | Creates a session.| -| setAVMetadata(data: AVMetadata, callback: AsyncCallback\): void | Sets session metadata. | -| setAVPlaybackState(state: AVPlaybackState, callback: AsyncCallback\): void | Sets the playback state information. | -| setLaunchAbility(ability: WantAgent, callback: AsyncCallback\): void | Sets the launcher ability.| -| getController(callback: AsyncCallback\): void | Obtains the controller of this session.| -| getOutputDevice(callback: AsyncCallback\): void | Obtains the output device information. | -| activate(callback: AsyncCallback\): void | Activates this session. | -| destroy(callback: AsyncCallback\): void | Destroys this session. | - -### How to Develop -1. Import the modules. - -```js -import avSession from '@ohos.multimedia.avsession'; -import wantAgent from '@ohos.app.ability.wantAgent'; -import featureAbility from '@ohos.ability.featureAbility'; -``` - -2. Create and activate a session. -```js -// Define global variables. -let mediaFavorite = false; -let currentSession = null; -let context = featureAbility.getContext(); - -// Create an audio session. -avSession.createAVSession(context, "AudioAppSample", 'audio').then((session) => { - currentSession = session; - currentSession.activate(); // Activate the session. -}).catch((err) => { - console.info(`createAVSession : ERROR : ${err.message}`); -}); -``` - -3. Set the session information, including: -- Session metadata. In addition to the current media asset ID (mandatory), you can set the title, album, author, duration, and previous/next media asset ID. For details about the session metadata, see **AVMetadata** in the API document. -- Launcher ability, which is implemented by calling an API of [WantAgent](../reference/apis/js-apis-app-ability-wantAgent.md). Generally, **WantAgent** is used to encapsulate want information. -- Playback state information. -```js -// Set the session metadata. -let metadata = { - assetId: "121278", - title: "lose yourself", - artist: "Eminem", - author: "ST", - album: "Slim shady", - writer: "ST", - composer: "ST", - duration: 2222, - mediaImage: "https://www.example.com/example.jpg", // Set it based on your project requirements. - subtitle: "8 Mile", - description: "Rap", - lyric: "https://www.example.com/example.lrc", // Set it based on your project requirements. - previousAssetId: "121277", - nextAssetId: "121279", -}; -currentSession.setAVMetadata(metadata).then(() => { - console.info('setAVMetadata successfully'); -}).catch((err) => { - console.info(`setAVMetadata : ERROR : ${err.message}`); -}); -``` - -```js -// Set the launcher ability. -let wantAgentInfo = { - wants: [ - { - bundleName: "com.neu.setResultOnAbilityResultTest1", - abilityName: "com.example.test.EntryAbility", - } - ], - operationType: wantAgent.OperationType.START_ABILITIES, - requestCode: 0, - wantAgentFlags:[wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] -} - -wantAgent.getWantAgent(wantAgentInfo).then((agent) => { - currentSession.setLaunchAbility(agent).then(() => { - console.info('setLaunchAbility successfully'); - }).catch((err) => { - console.info(`setLaunchAbility : ERROR : ${err.message}`); - }); -}); -``` - -```js -// Set the playback state information. -let PlaybackState = { - state: avSession.PlaybackState.PLAYBACK_STATE_STOP, - speed: 1.0, - position:{elapsedTime: 0, updateTime: (new Date()).getTime()}, - bufferedTime: 1000, - loopMode: avSession.LoopMode.LOOP_MODE_SEQUENCE, - isFavorite: false, -}; -currentSession.setAVPlaybackState(PlaybackState).then(() => { - console.info('setAVPlaybackState successfully'); -}).catch((err) => { - console.info(`setAVPlaybackState : ERROR : ${err.message}`); -}); -``` - -```js -// Obtain the controller of this session. -currentSession.getController().then((selfController) => { - console.info('getController successfully'); -}).catch((err) => { - console.info(`getController : ERROR : ${err.message}`); -}); -``` - -```js -// Obtain the output device information. -currentSession.getOutputDevice().then((outputInfo) => { - console.info(`getOutputDevice successfully, deviceName : ${outputInfo.deviceName}`); -}).catch((err) => { - console.info(`getOutputDevice : ERROR : ${err.message}`); -}); -``` - -4. Subscribe to control command events. -```js -// Subscribe to the 'play' command event. -currentSession.on('play', () => { - console.log ("Call AudioPlayer.play."); - // Set the playback state information. - currentSession.setAVPlaybackState({state: avSession.PlaybackState.PLAYBACK_STATE_PLAY}).then(() => { - console.info('setAVPlaybackState successfully'); - }).catch((err) => { - console.info(`setAVPlaybackState : ERROR : ${err.message}`); - }); -}); - - -// Subscribe to the 'pause' command event. -currentSession.on('pause', () => { - console.log ("Call AudioPlayer.pause."); - // Set the playback state information. - currentSession.setAVPlaybackState({state: avSession.PlaybackState.PLAYBACK_STATE_PAUSE}).then(() => { - console.info('setAVPlaybackState successfully'); - }).catch((err) => { - console.info(`setAVPlaybackState : ERROR : ${err.message}`); - }); -}); - -// Subscribe to the 'stop' command event. -currentSession.on('stop', () => { - console.log ("Call AudioPlayer.stop."); - // Set the playback state information. - currentSession.setAVPlaybackState({state: avSession.PlaybackState.PLAYBACK_STATE_STOP}).then(() => { - console.info('setAVPlaybackState successfully'); - }).catch((err) => { - console.info(`setAVPlaybackState : ERROR : ${err.message}`); - }); -}); - -// Subscribe to the 'playNext' command event. -currentSession.on('playNext', () => { - // When the media file is not ready, download and cache the media file, and set the 'PREPARE' state. - currentSession.setAVPlaybackState({state: avSession.PlaybackState.PLAYBACK_STATE_PREPARE}).then(() => { - console.info('setAVPlaybackState successfully'); - }).catch((err) => { - console.info(`setAVPlaybackState : ERROR : ${err.message}`); - }); - // The media file is obtained. - currentSession.setAVMetadata({assetId: '58970105', title: 'See you tomorrow'}).then(() => { - console.info('setAVMetadata successfully'); - }).catch((err) => { - console.info(`setAVMetadata : ERROR : ${err.message}`); - }); - console.log ("Call AudioPlayer.play."); - // Set the playback state information. - let time = (new Date()).getTime(); - currentSession.setAVPlaybackState({state: avSession.PlaybackState.PLAYBACK_STATE_PLAY, position: {elapsedTime: 0, updateTime: time}, bufferedTime:2000}).then(() => { - console.info('setAVPlaybackState successfully'); - }).catch((err) => { - console.info(`setAVPlaybackState : ERROR : ${err.message}`); - }); -}); - -// Subscribe to the 'fastForward' command event. -currentSession.on('fastForward', () => { - console.log("Call AudioPlayer for fast forwarding."); - // Set the playback state information. - currentSession.setAVPlaybackState({speed: 2.0}).then(() => { - console.info('setAVPlaybackState successfully'); - }).catch((err) => { - console.info(`setAVPlaybackState : ERROR : ${err.message}`); - }); -}); - -// Subscribe to the 'seek' command event. -currentSession.on('seek', (time) => { - console.log("Call AudioPlayer.seek."); - // Set the playback state information. - currentSession.setAVPlaybackState({position: {elapsedTime: time, updateTime: (new Data()).getTime()}}).then(() => { - console.info('setAVPlaybackState successfully'); - }).catch((err) => { - console.info(`setAVPlaybackState : ERROR : ${err.message}`); - }); -}); - -// Subscribe to the 'setSpeed' command event. -currentSession.on('setSpeed', (speed) => { - console.log(`Call AudioPlayer to set the speed to ${speed}`); - // Set the playback state information. - currentSession.setAVPlaybackState({speed: speed}).then(() => { - console.info('setAVPlaybackState successfully'); - }).catch((err) => { - console.info(`setAVPlaybackState : ERROR : ${err.message}`); - }); -}); - -// Subscribe to the 'setLoopMode' command event. -currentSession.on('setLoopMode', (mode) => { - console.log(`The application switches to the loop mode ${mode}`); - // Set the playback state information. - currentSession.setAVPlaybackState({loopMode: mode}).then(() => { - console.info('setAVPlaybackState successfully'); - }).catch((err) => { - console.info(`setAVPlaybackState : ERROR : ${err.message}`); - }); -}); - -// Subscribe to the 'toggleFavorite' command event. -currentSession.on('toggleFavorite', (assetId) => { - console.log(`The application favorites ${assetId}.`); - // Perform the switch based on the last status. - let favorite = mediaFavorite == false ? true : false; - currentSession.setAVPlaybackState({isFavorite: favorite}).then(() => { - console.info('setAVPlaybackState successfully'); - }).catch((err) => { - console.info(`setAVPlaybackState : ERROR : ${err.message}`); - }); - mediaFavorite = favorite; -}); - -// Subscribe to the key event. -currentSession.on('handleKeyEvent', (event) => { - console.log(`User presses the key ${event.keyCode}`); -}); - -// Subscribe to output device changes. -currentSession.on('outputDeviceChange', (device) => { - console.log(`Output device changed to ${device.deviceName}`); -}); -``` - -5. Release resources. -```js -// Unsubscribe from the events. -currentSession.off('play'); -currentSession.off('pause'); -currentSession.off('stop'); -currentSession.off('playNext'); -currentSession.off('playPrevious'); -currentSession.off('fastForward'); -currentSession.off('rewind'); -currentSession.off('seek'); -currentSession.off('setSpeed'); -currentSession.off('setLoopMode'); -currentSession.off('toggleFavorite'); -currentSession.off('handleKeyEvent'); -currentSession.off('outputDeviceChange'); - -// Deactivate the session and destroy the object. -currentSession.deactivate().then(() => { - currentSession.destroy(); -}); -``` - -### Verification -Touch the play, pause, or next button on the media application. Check whether the media playback state changes accordingly. - -### FAQs - -1. Session Service Exception -- Symptoms - - The session service is abnormal, and the application cannot obtain a response from the session service. For example, the session service is not running or the communication with the session service fails. The error message "Session service exception" is displayed. - -- Possible causes - - The session service is killed during session restart. - -- Solution - - (1) The system retries the operation automatically. If the error persists for 3 seconds or more, stop the operation on the session or controller. - - (2) Destroy the current session or session controller and re-create it. If the re-creation fails, stop the operation on the session. - -2. Session Does Not Exist -- Symptoms - - Parameters are set for or commands are sent to the session that does not exist. The error message "The session does not exist" is displayed. - -- Possible causes - - The session has been destroyed, and no session record exists on the server. - -- Solution - - (1) If the error occurs on the application, re-create the session. If the error occurs on Media Controller, stop sending query or control commands to the session. - - (2) If the error occurs on the session service, query the current session record and pass the correct session ID when creating the controller. - -3. Session Not Activated -- Symptoms - - A control command or event is sent to the session when it is not activated. The error message "The session not active" is displayed. - -- Possible causes - - The session is in the inactive state. - -- Solution - - Stop sending the command or event. Subscribe to the session activation status, and resume the sending when the session is activated. - -## Development for the Session Control End (Media Controller) - -### Basic Concepts -- Remote projection: A local media session is projected to a remote device. The local controller sends commands to control media playback on the remote device. -- Sending key events: The controller controls media playback by sending key events. -- Sending control commands: The controller controls media playback by sending control commands. -- Sending system key events: A system application calls APIs to send system key events to control media playback. -- Sending system control commands: A system application calls APIs to send system control commands to control media playback. - -### Available APIs - -The table below lists the APIs available for the development of the session control end. The APIs use either a callback or promise to return the result. The APIs listed below use a callback, which provide the same functions as their counterparts that use a promise. For details, see [AVSession Management](../reference/apis/js-apis-avsession.md). - -Table 2 Common APIs for session control end development - -| API | Description | -| ------------------------------------------------------------------------------------------------ | ----------------- | -| getAllSessionDescriptors(callback: AsyncCallback\>>): void | Obtains the descriptors of all sessions. | -| createController(sessionId: string, callback: AsyncCallback\): void | Creates a controller. | -| sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback\): void | Sends a key event. | -| getLaunchAbility(callback: AsyncCallback\): void | Obtains the launcher ability. | -| sendControlCommand(command: AVControlCommand, callback: AsyncCallback\): void | Sends a control command. | -| sendSystemAVKeyEvent(event: KeyEvent, callback: AsyncCallback\): void | Send a system key event. | -| sendSystemControlCommand(command: AVControlCommand, callback: AsyncCallback\): void | Sends a system control command. | -| castAudio(session: SessionToken \| 'all', audioDevices: Array\, callback: AsyncCallback\): void | Casts the media session to a remote device.| - -### How to Develop -1. Import the modules. -```js -import avSession from '@ohos.multimedia.avsession'; -import {Action, KeyEvent} from '@ohos.multimodalInput.KeyEvent'; -import wantAgent from '@ohos.app.ability.wantAgent'; -import audio from '@ohos.multimedia.audio'; -``` - -2. Obtain the session descriptors and create a controller. -```js -// Define global variables. -let g_controller = new Array(); -let g_centerSupportCmd:Set = new Set(['play', 'pause', 'playNext', 'playPrevious', 'fastForward', 'rewind', 'seek','setSpeed', 'setLoopMode', 'toggleFavorite']); -let g_validCmd:Set; - -// Obtain the session descriptors and create a controller. -avSession.getAllSessionDescriptors().then((descriptors) => { - descriptors.forEach((descriptor) => { - avSession.createController(descriptor.sessionId).then((controller) => { - g_controller.push(controller); - }).catch((err) => { - console.error('createController error'); - }); - }); -}).catch((err) => { - console.error('getAllSessionDescriptors error'); -}); - -// Subscribe to the 'sessionCreate' event and create a controller. -avSession.on('sessionCreate', (session) => { - // After a session is added, you must create a controller. - avSession.createController(session.sessionId).then((controller) => { - g_controller.push(controller); - }).catch((err) => { - console.info(`createController : ERROR : ${err.message}`); - }); -}); -``` - -3. Subscribe to the session state and service changes. -```js -// Subscribe to the 'activeStateChange' event. -controller.on('activeStateChange', (isActive) => { - if (isActive) { - console.log ("The widget corresponding to the controller is highlighted."); - } else { - console.log("The widget corresponding to the controller is invalid."); - } -}); - -// Subscribe to the 'sessionDestroy' event to enable Media Controller to get notified when the session dies. -controller.on('sessionDestroy', () => { - console.info('on sessionDestroy : SUCCESS '); - controller.destroy().then(() => { - console.info('destroy : SUCCESS '); - }).catch((err) => { - console.info(`destroy : ERROR :${err.message}`); - }); -}); - -// Subscribe to the 'sessionDestroy' event to enable the application to get notified when the session dies. -avSession.on('sessionDestroy', (session) => { - let index = g_controller.findIndex((controller) => { - return controller.sessionId == session.sessionId; - }); - if (index != 0) { - g_controller[index].destroy(); - g_controller.splice(index, 1); - } -}); - -// Subscribe to the 'topSessionChange' event. -avSession.on('topSessionChange', (session) => { - let index = g_controller.findIndex((controller) => { - return controller.sessionId == session.sessionId; - }); - // Place the session on the top. - if (index != 0) { - g_controller.sort((a, b) => { - return a.sessionId == session.sessionId ? -1 : 0; - }); - } -}); - -// Subscribe to the 'sessionServiceDie' event. -avSession.on('sessionServiceDie', () => { - // The server is abnormal, and the application clears resources. - console.log("Server exception"); -}) -``` - -4. Subscribe to media session information changes. -```js -// Subscribe to metadata changes. -let metaFilter = ['assetId', 'title', 'description']; -controller.on('metadataChange', metaFilter, (metadata) => { - console.info(`on metadataChange assetId : ${metadata.assetId}`); -}); - -// Subscribe to playback state changes. -let playbackFilter = ['state', 'speed', 'loopMode']; -controller.on('playbackStateChange', playbackFilter, (playbackState) => { - console.info(`on playbackStateChange state : ${playbackState.state}`); -}); - -// Subscribe to supported command changes. -controller.on('validCommandChange', (cmds) => { - console.info(`validCommandChange : SUCCESS : size : ${cmds.size}`); - console.info(`validCommandChange : SUCCESS : cmds : ${cmds.values()}`); - g_validCmd.clear(); - for (let c of g_centerSupportCmd) { - if (cmds.has(c)) { - g_validCmd.add(c); - } - } -}); - -// Subscribe to output device changes. -controller.on('outputDeviceChange', (device) => { - console.info(`on outputDeviceChange device isRemote : ${device.isRemote}`); -}); -``` - -5. Control the session behavior. -```js -// When the user touches the play button, the control command 'play' is sent to the session. -if (g_validCmd.has('play')) { - controller.sendControlCommand({command:'play'}).then(() => { - console.info('sendControlCommand successfully'); - }).catch((err) => { - console.info(`sendControlCommand : ERROR : ${err.message}`); - }); -} - -// When the user selects the single loop mode, the corresponding control command is sent to the session. -if (g_validCmd.has('setLoopMode')) { - controller.sendControlCommand({command: 'setLoopMode', parameter: avSession.LoopMode.LOOP_MODE_SINGLE}).then(() => { - console.info('sendControlCommand successfully'); - }).catch((err) => { - console.info(`sendControlCommand : ERROR : ${err.message}`); - }); -} - -// Send a key event. -let keyItem = {code: 0x49, pressedTime: 123456789, deviceId: 0}; -let event = {action: 2, key: keyItem, keys: [keyItem]}; -controller.sendAVKeyEvent(event).then(() => { - console.info('sendAVKeyEvent Successfully'); -}).catch((err) => { - console.info(`sendAVKeyEvent : ERROR : ${err.message}`); -}); - -// The user touches the blank area on the widget to start the application. -controller.getLaunchAbility().then((want) => { - console.log("Starting the application in the foreground"); -}).catch((err) => { - console.info(`getLaunchAbility : ERROR : ${err.message}`); -}); - -// Send the system key event. -let keyItem = {code: 0x49, pressedTime: 123456789, deviceId: 0}; -let event = {action: 2, key: keyItem, keys: [keyItem]}; -avSession.sendSystemAVKeyEvent(event).then(() => { - console.info('sendSystemAVKeyEvent Successfully'); -}).catch((err) => { - console.info(`sendSystemAVKeyEvent : ERROR : ${err.message}`); -}); - -// Send a system control command to the top session. -let avcommand = {command: 'toggleFavorite', parameter: "false"}; -avSession.sendSystemControlCommand(avcommand).then(() => { - console.info('sendSystemControlCommand successfully'); -}).catch((err) => { - console.info(`sendSystemControlCommand : ERROR : ${err.message}`); -}); - -// Cast the session to another device. -let audioManager = audio.getAudioManager(); -let audioDevices; -await audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data) => { - audioDevices = data; - console.info('Promise returned to indicate that the device list is obtained.'); -}).catch((err) => { - console.info(`getDevices : ERROR : ${err.message}`); -}); - -avSession.castAudio('all', audioDevices).then(() => { - console.info('createController : SUCCESS'); -}).catch((err) => { - console.info(`createController : ERROR : ${err.message}`); -}); -``` - -6. Release resources. -```js -// Unsubscribe from the events. - controller.off('metadataChange'); - controller.off('playbackStateChange'); - controller.off('sessionDestroy'); - controller.off('activeStateChange'); - controller.off('validCommandChange'); - controller.off('outputDeviceChange'); - - // Destroy the controller. - controller.destroy().then(() => { - console.info('destroy : SUCCESS '); - }).catch((err) => { - console.info(`destroy : ERROR : ${err.message}`); - }); -``` - -### Verification -When you touch the play, pause, or next button in Media Controller, the playback state of the application changes accordingly. - -### FAQs -1. Controller Does Not Exist -- Symptoms - - A control command or an event is sent to the controller that does not exist. The error message "The session controller does not exist" is displayed. - -- Possible causes - - The controller has been destroyed. - -- Solution - - Query the session record and create the corresponding controller. - -2. Remote Session Connection Failure -- Symptoms - - The communication between the local session and the remote session fails. The error information "The remote session connection failed" is displayed. - -- Possible causes - - The communication between devices is interrupted. - -- Solution - - Stop sending control commands to the session. Subscribe to output device changes, and resume the sending when the output device is changed. - -3. Invalid Session Command -- Symptoms - - The control command or event sent to the session is not supported. The error message "Invalid session command" is displayed. - -- Possible causes - - The session does not support this command. - -- Solution - - Stop sending the command or event. Query the commands supported by the session, and send a command supported. - -4. Too Many Commands or Events -- Symptoms - - The session client sends too many messages or commands to the server in a period of time, causing the server to be overloaded. The error message "Command or event overload" is displayed. - -- Possible causes - - The server is overloaded with messages or events. - -- Solution - - Control the frequency of sending commands or events. diff --git a/en/application-dev/media/avsession-overview.md b/en/application-dev/media/avsession-overview.md index c46211765644330ac26c1154f181904c2db4c3d0..766e642eebc2ba861bf6aceca5f9ea702f99d74f 100644 --- a/en/application-dev/media/avsession-overview.md +++ b/en/application-dev/media/avsession-overview.md @@ -1,56 +1,50 @@ # AVSession Overview -> **NOTE** -> -> All APIs of the **AVSession** module are system APIs and can be called only by system applications. +The Audio and Video Session (AVSession) service is used to manage the playback behavior of all audio and video applications in the system in a unified manner. For example, it allows only one audio application in the playing state. -## Overview +Audio and video applications access the AVSession service and send application data (for example, a song that is being played and playback state) to it. Through a controller, the user can choose another application or device to continue the playback. If an application does not access the AVSession service, its playback will be forcibly interrupted when it switches to the background. - AVSession, short for audio and video session, is also known as media session. - - Application developers can use the APIs provided by the **AVSession** module to connect their audio and video applications to the system's Media Controller. - - System developers can use the APIs provided by the **AVSession** module to display media information of system audio and video applications and carry out unified playback control. +To implement background playback, you must request a continuous task to prevent the task from being suspended. For details, see [Continuous Task Development](../task-management/continuous-task-dev-guide.md). - You can implement the following features through the **AVSession** module: +## Basic Concepts - 1. Unified playback control entry +Be familiar with the following basic concepts before development: - If there are multiple audio and video applications on the device, users need to switch to and access different applications to control media playback. With AVSession, a unified playback control entry of the system (such as Media Controller) is used for playback control of these audio and video applications. No more switching is required. +- AVSession - 2. Better background application management + For AVSession, one end is the audio and video applications under control, and the other end is a controller (for example, Media Controller or AI Voice). AVSession provides a channel for information exchange between the application and controller. - When an application running in the background automatically starts audio playback, it is difficult for users to locate the application. With AVSession, users can quickly find the application that plays the audio clip in Media Controller. +- Provider -## Basic Concepts + An audio and video application that accesses the AVSession service. After accessing AVSession, the audio and video application must provide the media information, for example, the name of the item to play and the playback state, to AVSession. Through AVSession, the application also receives control commands from the controller and responds accordingly. -- AVSession +- Controller + + A system application that accesses AVSession to provide global control on audio and video playback behavior. Typical controllers on OpenHarmony devices are Media Controller and AI Voice. The following sections use Media Controller as an example of the controller. After accessing AVSession, the controller obtains the latest media information and sends control commands to the audio and video applications through AVSession. - A channel used for information exchange between applications and Media Controller. For AVSession, one end is the media application under control, and the other end is Media Controller. Through AVSession, an application can transfer the media playback information to Media Controller and receive control commands from Media Controller. - - AVSessionController - Object that controls media sessions and thereby controls the playback behavior of applications. Through AVSessionController, Media Controller can control the playback behavior of applications, obtain playback information, and send control commands. It can also monitor the playback state of applications to ensure synchronization of the media session information. + An object that controls the playback behavior of the provider. It obtains the playback information of the audio and video application and listens for the application playback changes to synchronize the AVSession information between the application and controller. The controller is the holder of an **AVSessionController** object. + +- AVSessionManager + + An object that provides the capability of managing sessions. It can create an **AVSession** object, create an **AVSessionController** object, send control commands, and listen for session state changes. + -- Media Controller - - Holder of AVSessionController. Through AVSessionController, Media Controller sends commands to control media playback of applications. +## AVSession Interaction Process -## Implementation Principle +AVSessions are classified into local AVSessions and distributed AVSessions. -The **AVSession** module provides two classes: **AVSession** and **AVSessionController**. +![AVSession Interaction Process](figures/avsession-interaction-process.png) -**Figure 1** AVSession interaction +- Local AVSession -![en-us_image_avsession](figures/en-us_image_avsession.png) + Local AVSession establishes a connection between the provider and controller in the local device, so as to implement unified playback control and media information display for audio and video applications in the system. -- Interaction between the application and Media Controller: First, an audio application creates an **AVSession** object and sets session information, including media metadata, launcher ability, and playback state information. Then, Media Controller creates an **AVSessionController** object to obtain session-related information and send the 'play' command to the audio application. Finally, the audio application responds to the command and updates the playback state. +- Distributed AVSession -- Distributed projection: When a connected device creates a local session, Media Controller or the audio application can select another device to be projected based on the device list, synchronize the local session to the remote device, and generate a controllable remote session. The remote session is controlled by sending control commands to the remote device's application through its AVSessionController. + Distributed AVSession establishes a connection between the provider and controller in the cross-device scenario, so as to implement cross-device playback control and media information display for audio and video applications in the system. For example, you can project the content played on device A to device B and perform playback control on device B. ## Constraints -- The playback information displayed in Media Controller is the media information proactively written by the media application to AVSession. -- Media Controller controls the playback of a media application based on the responses of the media application to control commands. -- AVSession can transmit media playback information and control commands. It does not display information or execute control commands. -- Do not develop Media Controller for common applications. For common audio and video applications running on OpenHarmony, the default control end is Media Controller, which is a system application. You do not need to carry out additional development for Media Controller. -- If you want to develop your own system running OpenHarmony, you can develop your own Media Controller. -- For better background management of audio and video applications, the **AVSession** module enforces background control for applications. Only applications that have accessed AVSession can play audio in the background. Otherwise, the system forcibly pauses the playback when an application switches to the background. +The AVSession service manages the playback behavior of all audio and video applications in the system. To continue the playback after switching to the background, the audio and video applications must access the AVSession service. diff --git a/en/application-dev/media/camera-device-input.md b/en/application-dev/media/camera-device-input.md new file mode 100644 index 0000000000000000000000000000000000000000..3702e16760c002010c50da236d4ef9c2af079e5e --- /dev/null +++ b/en/application-dev/media/camera-device-input.md @@ -0,0 +1,82 @@ +# Device Input Management + +Before developing a camera application, you must create an independent camera object. The application invokes and controls the camera object to perform basic operations such as preview, photographing, and video recording. + +## How to Develop + +Read [Camera](../reference/apis/js-apis-camera.md) for the API reference. + +1. Import the camera module, which provides camera-related attributes and methods. + + ```ts + import camera from '@ohos.multimedia.camera'; + ``` + +2. Call **getCameraManager()** to obtain a **CameraManager** object. + + ```ts + let cameraManager; + let context: any = getContext(this); + cameraManager = camera.getCameraManager(context) + ``` + + > **NOTE** + > + > If obtaining the object fails, the camera hardware may be occupied or unusable. If it is occupied, wait until it is released. + +3. Call **getSupportedCameras()** in the **CameraManager** class to obtain the list of cameras supported by the current device. The list stores the IDs of all cameras supported. If the list is not empty, each ID in the list can be used to create an independent camera object. Otherwise, no camera is available for the current device and subsequent operations cannot be performed. + + ```ts + let cameraArray = cameraManager.getSupportedCameras(); + if (cameraArray.length <= 0) { + console.error("cameraManager.getSupportedCameras error"); + return; + } + + for (let index = 0; index < cameraArray.length; index++) { + console.info('cameraId : ' + cameraArray[index].cameraId); // Obtain the camera ID. + console.info('cameraPosition : ' + cameraArray[index].cameraPosition); // Obtain the camera position. + console.info('cameraType : ' + cameraArray[index].cameraType); // Obtain the camera type. + console.info('connectionType : ' + cameraArray[index].connectionType); // Obtain the camera connection type. + } + ``` + +4. Call **getSupportedOutputCapability()** to obtain all output streams supported by the current device, such as preview streams and photo streams. The output stream is in each **profile** field under **CameraOutputCapability**. + + ```ts + // Create a camera input stream. + let cameraInput; + try { + cameraInput = cameraManager.createCameraInput(cameraArray[0]); + } catch (error) { + console.error('Failed to createCameraInput errorCode = ' + error.code); + } + // Listen for CameraInput errors. + let cameraDevice = cameraArray[0]; + cameraInput.on('error', cameraDevice, (error) => { + console.info(`Camera input error code: ${error.code}`); + }) + // Open the camera. + await cameraInput.open(); + // Obtain the output stream capabilities supported by the camera. + let cameraOutputCapability = cameraManager.getSupportedOutputCapability(cameraArray[0]); + if (!cameraOutputCapability) { + console.error("cameraManager.getSupportedOutputCapability error"); + return; + } + console.info("outputCapability: " + JSON.stringify(cameraOutputCapability)); + ``` + + +## Status Listening + +During camera application development, you can listen for the camera status, including the appearance of a new camera, removal of a camera, and availability of a camera. The camera ID and camera status are used in the callback function. When a new camera appears, the new camera can be added to the supported camera list. + +Register the 'cameraStatus' event and return the listening result through a callback, which carries the **CameraStatusInfo** parameter. For details about the parameter, see [CameraStatusInfo](../reference/apis/js-apis-camera.md#camerastatusinfo). + +```ts +cameraManager.on('cameraStatus', (cameraStatusInfo) => { + console.info(`camera: ${cameraStatusInfo.camera.cameraId}`); + console.info(`status: ${cameraStatusInfo.status}`); +}) +``` diff --git a/en/application-dev/media/camera-metadata.md b/en/application-dev/media/camera-metadata.md new file mode 100644 index 0000000000000000000000000000000000000000..8fdeff1df08f624374f2a2a5cee32b99b2c41e03 --- /dev/null +++ b/en/application-dev/media/camera-metadata.md @@ -0,0 +1,66 @@ +# Camera Metadata + +Metadata is the description and context of image information returned by the camera application. It provides detailed data for the image information, for example, coordinates of a viewfinder frame for identifying a portrait in a photo or a video. + +Metadata uses a tag (key) to find the corresponding data during the transfer of parameters and configurations, reducing memory copy operations. + +## How to Develop + +Read [Camera](../reference/apis/js-apis-camera.md) for the API reference. + +1. Obtain the metadata types supported by the current device from **supportedMetadataObjectTypes** in **CameraOutputCapability**, and then use **createMetadataOutput()** to create a metadata output stream. + + ```ts + let metadataObjectTypes = cameraOutputCapability.supportedMetadataObjectTypes; + let metadataOutput; + try { + metadataOutput = cameraManager.createMetadataOutput(metadataObjectTypes); + } catch (error) { + // If the operation fails, error.code is returned and processed. + console.info(error.code); + } + ``` + +2. Call **start()** to start outputting metadata. If the call fails, an error code is returned. For details, see [Camera Error Codes](../reference/apis/js-apis-camera.md#cameraerrorcode). + + ```ts + metadataOutput.start().then(() => { + console.info('Callback returned with metadataOutput started.'); + }).catch((err) => { + console.info('Failed to metadataOutput start '+ err.code); + }); + ``` + +3. Call **stop()** to stop outputting metadata. If the call fails, an error code is returned. For details, see [Camera Error Codes](../reference/apis/js-apis-camera.md#cameraerrorcode). + + ```ts + metadataOutput.stop().then(() => { + console.info('Callback returned with metadataOutput stopped.'); + }).catch((err) => { + console.info('Failed to metadataOutput stop '+ err.code); + }); + ``` + +## Status Listening + +During camera application development, you can listen for the status of metadata objects and output stream. + +- Register the 'metadataObjectsAvailable' event to listen for metadata objects that are available. When a valid metadata object is detected, the callback function returns the metadata. This event can be registered when a **MetadataOutput** object is created. + + ```ts + metadataOutput.on('metadataObjectsAvailable', (metadataObjectArr) => { + console.info(`metadata output metadataObjectsAvailable`); + }) + ``` + + > **NOTE** + > + > Currently, only **FACE_DETECTION** is available for the metadata type. The metadata object is the rectangle of the recognized face, including the x-axis coordinate and y-axis coordinate of the upper left corner of the rectangle as well as the width and height of the rectangle. + +- Register the 'error' event to listen for metadata stream errors. The callback function returns an error code when an API is incorrectly used. For details about the error code types, see [Camera Error Codes](../reference/apis/js-apis-camera.md#cameraerrorcode). + + ```ts + metadataOutput.on('error', (metadataOutputError) => { + console.info(`Metadata output error code: ${metadataOutputError.code}`); + }) + ``` diff --git a/en/application-dev/media/camera-overview.md b/en/application-dev/media/camera-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..03445ee6979c28fb4084a2f3c8186d77f14e5b89 --- /dev/null +++ b/en/application-dev/media/camera-overview.md @@ -0,0 +1,27 @@ +# Camera Overview + +With the APIs provided by the camera module of the multimedia subsystem, you can develop a camera application. The application accesses and operates the camera hardware to implement basic operations, such as preview, photographing, and video recording. It can also perform more operations, for example, controlling the flash and exposure time, and focusing or adjusting the focus. + +## Development Model + +The camera application invokes the camera hardware to collect and process image and video data, and output images and videos. It can be used when there are multiple lenses (such as wide-angle lens, long-focus lens, and ToF lens) in various service scenarios (such as different requirements on the resolution, format, and effect). + +The figure below illustrates the working process of the camera module. The working process can be summarized into three parts: input device management, session management, and output management. + +- During input device management, the camera application invokes the camera hardware to collect data and uses the data as an input stream. + +- During session management, you can configure an input stream to determine the camera to be used. You can also set parameters, such as the flash, exposure time, focus, and focus adjustment, to implement different shooting effects in various service scenarios. The application can switch between sessions to meet service requirements in different scenarios. + +- During output management, you can configure an output stream, which can be a preview stream, photo stream, or video stream. + +**Figure 1** Camera working process +![Camera Workflow](figures/camera-workflow.png) + +For better application development, you are also advised understanding the camera development model. + +**Figure 2** Camera development model +![Camera Development Model](figures/camera-development-model.png) + +The camera application controls the camera hardware to implement basic operations such as image display (preview), photo saving (photographing), and video recording. During the implementation, the camera service controls the camera hardware to collect and output data, and transmits the data to a specific module for processing through a BufferQueue at the bottom camera device hardware interface (HDI) layer. You can ignore the BufferQueue during application development. It is used to send the data processed by the bottom layer to the upper layer for image display. + +For example, in a video recording scenario, the recording service creates a video surface and provides it to the camera service for data transmission. The camera service controls the camera device to collect video data and generate a video stream. After processing the collected data at the HDI layer, the camera service transmits the video stream to the recording service through the surface. The recording service processes the video stream and saves it as a video file. Now video recording is complete. diff --git a/en/application-dev/media/camera-preparation.md b/en/application-dev/media/camera-preparation.md new file mode 100644 index 0000000000000000000000000000000000000000..eb504af9a69f65473f27de59a45a17891357be7f --- /dev/null +++ b/en/application-dev/media/camera-preparation.md @@ -0,0 +1,25 @@ +# Camera Development Preparations + +The main process of camera application development includes development preparations, device input management, session management, preview, photographing, and video recording. + +Before developing a camera application, you must request camera-related permissions (as described in the table below) to ensure that the application has the permission to access the camera hardware and other services. Before requesting the permission, ensure that the [basic principles for permission management](../security/accesstoken-overview.md#basic-principles-for-permission-management) are met. + + +| Permission| Description| Authorization Mode| +| -------- | -------- | -------- | +| ohos.permission.CAMERA | Allows an application to use the camera to take photos and record videos.| user_grant | +| ohos.permission.MICROPHONE | Allows an application to access the microphone.
This permission is required only if the application is used to record audio.| user_grant | +| ohos.permission.WRITE_MEDIA | Allows an application to read media files from and write media files into the user's external storage. This permission is optional.| user_grant | +| ohos.permission.READ_MEDIA | Allows an application to read media files from the user's external storage. This permission is optional.| user_grant | +| ohos.permission.MEDIA_LOCATION | Allows an application to access geographical locations in the user's media file. This permission is optional.| user_grant | + + +After configuring the permissions in the **module.json5** file, the application must call [abilityAccessCtrl.requestPermissionsFromUser](../reference/apis/js-apis-abilityAccessCtrl.md#requestpermissionsfromuser9) to check whether the required permissions are granted. If not, request the permissions from the user by displaying a dialog box. + + +For details about how to request and verify the permissions, see [Permission Application Guide](../security/accesstoken-guidelines.md). + + +> **NOTE** +> +> Even if the user has granted a permission, the application must check for the permission before calling an API protected by the permission. It should not persist the permission granted status, because the user can revoke the permission through the system application **Settings**. diff --git a/en/application-dev/media/camera-preview.md b/en/application-dev/media/camera-preview.md new file mode 100644 index 0000000000000000000000000000000000000000..e65f5dac8c96737b81b20703ce6ffa6fe7daa54b --- /dev/null +++ b/en/application-dev/media/camera-preview.md @@ -0,0 +1,87 @@ +# Camera Preview + +Preview is the image you see after you start the camera application but before you take photos or record videos. + +## How to Develop + +Read [Camera](../reference/apis/js-apis-camera.md) for the API reference. + +1. Create a surface. + + The XComponent, the capabilities of which are provided by the UI, offers the surface for preview streams. For details, see [XComponent](../reference/arkui-ts/ts-basic-components-xcomponent.md). + + ```ts + // Create an XComponentController object. + mXComponentController: XComponentController = new XComponentController; + build() { + Flex() { + // Create an XComponent. + XComponent({ + id: '', + type: 'surface', + libraryname: '', + controller: this.mXComponentController + }) + .onLoad(() => { + // Set the surface width and height (1920 x 1080). For details about how to set the preview size, see the preview resolutions supported by the current device, which are obtained from previewProfilesArray. + this.mXComponentController.setXComponentSurfaceSize({surfaceWidth:1920,surfaceHeight:1080}); + // Obtain the surface ID. + globalThis.surfaceId = this.mXComponentController.getXComponentSurfaceId(); + }) + .width('1920px') + .height('1080px') + } + } + ``` + +2. Call **previewProfiles()** in the **CameraOutputCapability** class to obtain the preview capabilities, in the format of an **previewProfilesArray** array, supported by the current device. Then call **createPreviewOutput()** to create a preview output stream, with the first parameter set to the first item in the **previewProfilesArray** array and the second parameter set to the surface ID obtained in step 1. + + ```ts + let previewProfilesArray = cameraOutputCapability.previewProfiles; + let previewOutput; + try { + previewOutput = cameraManager.createPreviewOutput(previewProfilesArray[0], surfaceId); + } + catch (error) { + console.error("Failed to create the PreviewOutput instance." + error); + } + ``` + +3. Call **start()** to start outputting the preview stream. If the call fails, an error code is returned. For details, see [Camera Error Codes](../reference/apis/js-apis-camera.md#cameraerrorcode). + + ```ts + previewOutput.start().then(() => { + console.info('Callback returned with previewOutput started.'); + }).catch((err) => { + console.info('Failed to previewOutput start '+ err.code); + }); + ``` + + +## Status Listening + +During camera application development, you can listen for the preview output stream status, including preview stream start, preview stream end, and preview stream output errors. + +- Register the 'frameStart' event to listen for preview start events This event can be registered when a **PreviewOutput** object is created and is triggered when the bottom layer starts exposure for the first time. The preview stream is started as long as a result is returned. + + ```ts + previewOutput.on('frameStart', () => { + console.info('Preview frame started'); + }) + ``` + +- Register the 'frameEnd' event to listen for preview end events. This event can be registered when a **PreviewOutput** object is created and is triggered when the last frame of preview ends. The preview stream ends as long as a result is returned. + + ```ts + previewOutput.on('frameEnd', () => { + console.info('Preview frame ended'); + }) + ``` + +- Register the 'error' event to listen for preview output errors. The callback function returns an error code when an API is incorrectly used. For details about the error code types, see [Camera Error Codes](../reference/apis/js-apis-camera.md#cameraerrorcode). + + ```ts + previewOutput.on('error', (previewOutputError) => { + console.info(`Preview output error code: ${previewOutputError.code}`); + }) + ``` diff --git a/en/application-dev/media/camera-recording-case.md b/en/application-dev/media/camera-recording-case.md new file mode 100644 index 0000000000000000000000000000000000000000..4d284f7e675fe0693240bbb678391147926652e7 --- /dev/null +++ b/en/application-dev/media/camera-recording-case.md @@ -0,0 +1,247 @@ +# Video Recording Sample + +## Development Process + +After obtaining the output stream capabilities supported by the camera, create a video stream. The development process is as follows: + +![Recording Development Process](figures/recording-development-process.png) + + +## Sample Code + +```ts +import camera from '@ohos.multimedia.camera' +import media from '@ohos.multimedia.media' + +// Create a CameraManager instance. +context: any = getContext(this) +let cameraManager = camera.getCameraManager(this.context) +if (!cameraManager) { + console.error("camera.getCameraManager error") + return; +} + +// Listen for camera status changes. +cameraManager.on('cameraStatus', (cameraStatusInfo) => { + console.log(`camera : ${cameraStatusInfo.camera.cameraId}`); + console.log(`status: ${cameraStatusInfo.status}`); +}) + +// Obtain the output stream capabilities supported by the camera. +let cameraOutputCap = cameraManager.getSupportedOutputCapability(cameraArray[0]); +if (!cameraOutputCap) { + console.error("cameraManager.getSupportedOutputCapability error") + return; +} +console.log("outputCapability: " + JSON.stringify(cameraOutputCap)); + +let previewProfilesArray = cameraOutputCap.previewProfiles; +if (!previewProfilesArray) { + console.error("createOutput previewProfilesArray == null || undefined") +} + +let photoProfilesArray = cameraOutputCap.photoProfiles; +if (!photoProfilesArray) { + console.error("createOutput photoProfilesArray == null || undefined") +} + +let videoProfilesArray = cameraOutputCap.videoProfiles; +if (!videoProfilesArray) { + console.error("createOutput videoProfilesArray == null || undefined") +} + +let metadataObjectTypesArray = cameraOutputCap.supportedMetadataObjectTypes; +if (!metadataObjectTypesArray) { + console.error("createOutput metadataObjectTypesArray == null || undefined") +} + +// Configure the parameters based on those supported by the hardware device. +let AVRecorderProfile = { + audioBitrate : 48000, + audioChannels : 2, + audioCodec : media.CodecMimeType.AUDIO_AAC, + audioSampleRate : 48000, + fileFormat : media.ContainerFormatType.CFT_MPEG_4, + videoBitrate : 2000000, + videoCodec : media.CodecMimeType.VIDEO_MPEG4, + videoFrameWidth : 640, + videoFrameHeight : 480, + videoFrameRate : 30 +} +let AVRecorderConfig = { + audioSourceType : media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC, + videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV, + profile : AVRecorderProfile, + url : 'fd://', // Before passing in a file descriptor to this parameter, the file must be created by the caller and granted with the read and write permissions. Example value: eg.fd://45--file:///data/media/01.mp4. + rotation: 0, // The value can be 0, 90, 180, or 270. If any other value is used, prepare() reports an error. + location : { latitude : 30, longitude : 130 } +} + +let avRecorder +media.createAVRecorder((error, recorder) => { + if (recorder != null) { + avRecorder = recorder; + console.log('createAVRecorder success'); + } else { + console.log(`createAVRecorder fail, error:${error}`); + } +}); + +avRecorder.prepare(AVRecorderConfig, (err) => { + if (err == null) { + console.log('prepare success'); + } else { + console.log('prepare failed and error is ' + err.message); + } +}) + +let videoSurfaceId = null; // The surfaceID is passed in to the camera API to create a VideoOutput instance. +avRecorder.getInputSurface((err, surfaceId) => { + if (err == null) { + console.log('getInputSurface success'); + videoSurfaceId = surfaceId; + } else { + console.log('getInputSurface failed and error is ' + err.message); + } +}); + +// Create a VideoOutput instance. +let videoOutput +try { + videoOutput = cameraManager.createVideoOutput(videoProfilesArray[0], videoSurfaceId) +} catch (error) { + console.error('Failed to create the videoOutput instance. errorCode = ' + error.code); +} + +// Listen for video output errors. +videoOutput.on('error', (error) => { + console.log(`Preview output error code: ${error.code}`); +}) + +// Create a session. +let captureSession +try { + captureSession = cameraManager.createCaptureSession() +} catch (error) { + console.error('Failed to create the CaptureSession instance. errorCode = ' + error.code); +} + +// Listen for session errors. +captureSession.on('error', (error) => { + console.log(`Capture session error code: ${error.code}`); +}) + +// Start configuration for the session. +try { + captureSession.beginConfig() +} catch (error) { + console.error('Failed to beginConfig. errorCode = ' + error.code); +} + +// Obtain the camera list. +let cameraArray = cameraManager.getSupportedCameras(); +if (cameraArray.length <= 0) { + console.error("cameraManager.getSupportedCameras error") + return; +} + +// Create a camera input stream. +let cameraInput +try { + cameraInput = cameraManager.createCameraInput(cameraArray[0]); +} catch (error) { + console.error('Failed to createCameraInput errorCode = ' + error.code); +} + +// Listen for camera input errors. +let cameraDevice = cameraArray[0]; +cameraInput.on('error', cameraDevice, (error) => { + console.log(`Camera input error code: ${error.code}`); +}) + +// Open the camera. +await cameraInput.open(); + +// Add the camera input stream to the session. +try { + captureSession.addInput(cameraInput) +} catch (error) { + console.error('Failed to addInput. errorCode = ' + error.code); +} + +// Create a preview output stream. For details about the surfaceId parameter, see the XComponent. The preview stream is the surface provided by the XComponent. +let previewOutput +try { + previewOutput = cameraManager.createPreviewOutput(previewProfilesArray[0], surfaceId) +} catch (error) { + console.error("Failed to create the PreviewOutput instance.") +} + +// Add the preview input stream to the session. +try { + captureSession.addOutput(previewOutput) +} catch (error) { + console.error('Failed to addOutput(previewOutput). errorCode = ' + error.code); +} + +// Add a video output stream to the session. +try { + captureSession.addOutput(videoOutput) +} catch (error) { + console.error('Failed to addOutput(videoOutput). errorCode = ' + error.code); +} + +// Commit the session configuration. +await captureSession.commitConfig() + +// Start the session. +await captureSession.start().then(() => { + console.log('Promise returned to indicate the session start success.'); +}) + +// Start the video output stream. +videoOutput.start(async (err) => { + if (err) { + console.error('Failed to start the video output ${err.message}'); + return; + } + console.log('Callback invoked to indicate the video output start success.'); +}); + +// Start video recording. +avRecorder.start().then(() => { + console.log('videoRecorder start success'); +}) + +// Stop the video output stream. +videoOutput.stop((err) => { + if (err) { + console.error('Failed to stop the video output ${err.message}'); + return; + } + console.log('Callback invoked to indicate the video output stop success.'); +}); + +// Stop video recording. +avRecorder.stop().then(() => { + console.log('stop success'); +}) + +// Stop the session. +captureSession.stop() + +// Release the camera input stream. +cameraInput.close() + +// Release the preview output stream. +previewOutput.release() + +// Release the video output stream. +videoOutput.release() + +// Release the session. +captureSession.release() + +// Set the session to null. +captureSession = null +``` diff --git a/en/application-dev/media/camera-recording.md b/en/application-dev/media/camera-recording.md new file mode 100644 index 0000000000000000000000000000000000000000..421ff990bf45b372dd39cd3346e29b636f292762 --- /dev/null +++ b/en/application-dev/media/camera-recording.md @@ -0,0 +1,155 @@ +# Video Recording + +Video recording is also an important function of the camera application. Video recording is the process of cyclic capturing of frames. To smooth videos, you can follow step 4 in [Camera Photographing](camera-shooting.md) to set the resolution, flash, focal length, photo quality, and rotation angle. + +## How to Develop + +Read [Camera](../reference/apis/js-apis-camera.md) for the API reference. + +1. Import the media module. The [APIs](../reference/apis/js-apis-media.md) provided by this module are used to obtain the surface ID and create a photo output stream. + + ```ts + import media from '@ohos.multimedia.media'; + ``` + +2. Create a surface. + + Call **createAVRecorder()** of the media module to create an **AVRecorder** instance, and call **getInputSurface()** of the instance to obtain the surface ID, which is associated with the view output stream to process the data output by the stream. + + ```ts + let AVRecorder; + media.createAVRecorder((error, recorder) => { + if (recorder != null) { + AVRecorder = recorder; + console.info('createAVRecorder success'); + } else { + console.info(`createAVRecorder fail, error:${error}`); + } + }); + // For details about AVRecorderConfig, see the next section. + AVRecorder.prepare(AVRecorderConfig, (err) => { + if (err == null) { + console.log('prepare success'); + } else { + console.log('prepare failed and error is ' + err.message); + } + }) + + let videoSurfaceId = null; + AVRecorder.getInputSurface().then((surfaceId) => { + console.info('getInputSurface success'); + videoSurfaceId = surfaceId; + }).catch((err) => { + console.info('getInputSurface failed and catch error is ' + err.message); + }); + ``` + +3. Create a video output stream. + + Obtain the video output streams supported by the current device from **videoProfiles** in the **CameraOutputCapability** class. Then, define video recording parameters and use **createVideoOutput()** to create a video output stream. + + ```ts + let videoProfilesArray = cameraOutputCapability.videoProfiles; + if (!videoProfilesArray) { + console.error("createOutput videoProfilesArray == null || undefined"); + } + + // Define video recording parameters. + let videoConfig = { + videoSourceType: media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV, + profile: { + fileFormat: media.ContainerFormatType.CFT_MPEG_4, // Video file encapsulation format. Only MP4 is supported. + videoBitrate: 100000, // Video bit rate. + videoCodec: media.CodecMimeType.VIDEO_MPEG4, // Video file encoding format. Both MPEG-4 and AVC are supported. + videoFrameWidth: 640, // Video frame width. + videoFrameHeight: 480, // Video frame height. + videoFrameRate: 30 // Video frame rate. + }, + url: 'fd://35', + rotation: 0 + } + // Create an AVRecorder instance. + let avRecorder; + media.createAVRecorder((error, recorder) => { + if (recorder != null) { + avRecorder = recorder; + console.info('createAVRecorder success'); + } else { + console.info(`createAVRecorder fail, error:${error}`); + } + }); + // Set video recording parameters. + avRecorder.prepare(videoConfig); + // Create a VideoOutput instance. + let videoOutput; + try { + videoOutput = cameraManager.createVideoOutput(videoProfilesArray[0], videoSurfaceId); + } catch (error) { + console.error('Failed to create the videoOutput instance. errorCode = ' + error.code); + } + ``` + +4. Start video recording. + + Call **start()** of the **VideoOutput** instance to start the video output stream, and then call **start()** of the **AVRecorder** instance to start recording. + + ``` + videoOutput.start(async (err) => { + if (err) { + console.error('Failed to start the video output ${err.message}'); + return; + } + console.info('Callback invoked to indicate the video output start success.'); + }); + + avRecorder.start().then(() => { + console.info('avRecorder start success'); + } + ``` + +5. Stop video recording. + + Call **stop()** of the **AVRecorder** instance to stop recording, and then call **stop()** of the **VideoOutput** instance to stop the video output stream. + + ```ts + videoRecorder.stop().then(() => { + console.info('stop success'); + } + + videoOutput.stop((err) => { + if (err) { + console.error('Failed to stop the video output ${err.message}'); + return; + } + console.info('Callback invoked to indicate the video output stop success.'); + }); + ``` + + +## Status Listening + +During camera application development, you can listen for the status of the video output stream, including recording start, recording end, and recording stream output errors. + +- Register the 'frameStart' event to listen for recording start events. This event can be registered when a **VideoOutput** object is created and is triggered when the bottom layer starts exposure for recording for the first time. Video recording is started as long as a result is returned. + + ```ts + videoOutput.on('frameStart', () => { + console.info('Video frame started'); + }) + ``` + +- Register the 'frameEnd' event to listen for recording end events. This event can be registered when a **VideoOutput** object is created and is triggered when the last frame of recording ends. Video recording ends as long as a result is returned. + + ```ts + videoOutput.on('frameEnd', () => { + console.info('Video frame ended'); + }) + ``` + +- Register the 'error' event to listen for video output errors. The callback function returns an error code when an API is incorrectly used. For details about the error code types, see [Camera Error Codes](../reference/apis/js-apis-camera.md#cameraerrorcode). + + ```ts + videoOutput.on('error', (error) => { + console.info(`Video output error code: ${error.code}`); + }) + ``` diff --git a/en/application-dev/media/camera-session-management.md b/en/application-dev/media/camera-session-management.md new file mode 100644 index 0000000000000000000000000000000000000000..1d0d2fcfe20428d33d72569cbf2212b830ad42e2 --- /dev/null +++ b/en/application-dev/media/camera-session-management.md @@ -0,0 +1,86 @@ +# Camera Session Management + +Before using the camera application for preview, photographing, video recording, and metadata, you must create a camera session. + +You can implement the following functions in the session: + +- Configure the camera input and output streams. This is mandatory for photographing. + Configuring an input stream is to add a device input, which means that the user selects a camera for photographing. Configuring an output stream is to select a data output mode. For example, to implement photographing, you must configure both the preview stream and photo stream as the output stream. The data of the preview stream is displayed on the XComponent, and that of the photo stream is saved to the Gallery application through the **ImageReceiver** API. + +- Perform more operations on the camera hardware. For example, add the flash and adjust the focal length. For details about the supported configurations and APIs, see [Camera API Reference](../reference/apis/js-apis-camera.md). + +- Control session switching. The application can switch the camera mode by removing and adding output streams. For example, to switch from photographing to video recording, the application must remove the photo output stream and add the video output stream. + +After the session configuration is complete, the application must commit the configuration and start the session before using the camera functionalities. + +## How to Develop + +1. Call **createCaptureSession()** in the **CameraManager** class to create a session. + + ```ts + let captureSession; + try { + captureSession = cameraManager.createCaptureSession(); + } catch (error) { + console.error('Failed to create the CaptureSession instance. errorCode = ' + error.code); + } + ``` + +2. Call **beginConfig()** in the **CaptureSession** class to start configuration for the session. + + ```ts + try { + captureSession.beginConfig(); + } catch (error) { + console.error('Failed to beginConfig. errorCode = ' + error.code); + } + ``` + +3. Configure the session. You can call **addInput()** and **addOutput()** in the **CaptureSession** class to add the input and output streams to the session, respectively. The code snippet below uses adding the preview stream **previewOutput** and photo stream **photoOutput** as an example to implement the photographing and preview mode. + + After the configuration, call **commitConfig()** and **start()** in the **CaptureSession** class in sequence to commit the configuration and start the session. + + ```ts + try { + captureSession.addInput(cameraInput); + } catch (error) { + console.error('Failed to addInput. errorCode = ' + error.code); + } + try { + captureSession.addOutput(previewOutput); + } catch (error) { + console.error('Failed to addOutput(previewOutput). errorCode = ' + error.code); + } + try { + captureSession.addOutput(photoOutput); + } catch (error) { + console.error('Failed to addOutput(photoOutput). errorCode = ' + error.code); + } + await captureSession.commitConfig() ; + await captureSession.start().then(() => { + console.info('Promise returned to indicate the session start success.'); + }) + ``` + +4. Control the session. You can call **stop()** in the **CaptureSession** class to stop the session, and call **removeOutput()** and **addOutput()** in this class to switch to another session. The code snippet below uses removing the photo stream **photoOutput** and adding the video stream **videoOutput** as an example to complete the switching from photographing to recording. + + ```ts + await captureSession.stop(); + try { + captureSession.beginConfig(); + } catch (error) { + console.error('Failed to beginConfig. errorCode = ' + error.code); + } + // Remove the photo output stream from the session. + try { + captureSession.removeOutput(photoOutput); + } catch (error) { + console.error('Failed to removeOutput(photoOutput). errorCode = ' + error.code); + } + // Add the video output stream to the session. + try { + captureSession.addOutput(videoOutput); + } catch (error) { + console.error('Failed to addOutput(videoOutput). errorCode = ' + error.code); + } + ``` diff --git a/en/application-dev/media/camera-shooting-case.md b/en/application-dev/media/camera-shooting-case.md new file mode 100644 index 0000000000000000000000000000000000000000..da2588b10b844fd2a9432da909d1d387b8193d9f --- /dev/null +++ b/en/application-dev/media/camera-shooting-case.md @@ -0,0 +1,239 @@ +# Camera Photographing Sample + +## Development Process + +After obtaining the output stream capabilities supported by the camera, create a photo stream. The development process is as follows: + +![Photographing Development Process](figures/photographing-development-process.png) + +## Sample Code + +```ts +import camera from '@ohos.multimedia.camera' +import image from '@ohos.multimedia.image' +import media from '@ohos.multimedia.media' + +// Create a CameraManager instance. +context: any = getContext(this) +let cameraManager = camera.getCameraManager(this.context) +if (!cameraManager) { + console.error("camera.getCameraManager error") + return; +} +// Listen for camera status changes. +cameraManager.on('cameraStatus', (cameraStatusInfo) => { + console.info(`camera : ${cameraStatusInfo.camera.cameraId}`); + console.info(`status: ${cameraStatusInfo.status}`); +}) + +// Obtain the camera list. +let cameraArray = cameraManager.getSupportedCameras(); +if (cameraArray.length <= 0) { + console.error("cameraManager.getSupportedCameras error") + return; +} + +for (let index = 0; index < cameraArray.length; index++) { + console.info('cameraId : ' + cameraArray[index].cameraId); // Obtain the camera ID. + console.info('cameraPosition : ' + cameraArray[index].cameraPosition); // Obtain the camera position. + console.info('cameraType : ' + cameraArray[index].cameraType); // Obtain the camera type. + console.info('connectionType : ' + cameraArray[index].connectionType); // Obtain the camera connection type. +} + +// Create a camera input stream. +let cameraInput +try { + cameraInput = cameraManager.createCameraInput(cameraArray[0]); +} catch (error) { + console.error('Failed to createCameraInput errorCode = ' + error.code); +} + +// Listen for camera input errors. +let cameraDevice = cameraArray[0]; +cameraInput.on('error', cameraDevice, (error) => { + console.info(`Camera input error code: ${error.code}`); +}) + +// Open the camera. +await cameraInput.open(); + +// Obtain the output stream capabilities supported by the camera. +let cameraOutputCap = cameraManager.getSupportedOutputCapability(cameraArray[0]); +if (!cameraOutputCap) { + console.error("cameraManager.getSupportedOutputCapability error") + return; +} +console.info("outputCapability: " + JSON.stringify(cameraOutputCap)); + +let previewProfilesArray = cameraOutputCap.previewProfiles; +if (!previewProfilesArray) { + console.error("createOutput previewProfilesArray == null || undefined") +} + +let photoProfilesArray = cameraOutputCap.photoProfiles; +if (!photoProfilesArray) { + console.error("createOutput photoProfilesArray == null || undefined") +} + +// Create a preview output stream. For details about the surfaceId parameter, see the XComponent. The preview stream is the surface provided by the XComponent. +let previewOutput +try { + previewOutput = cameraManager.createPreviewOutput(previewProfilesArray[0], surfaceId) +} catch (error) { + console.error("Failed to create the PreviewOutput instance.") +} + +// Listen for preview output errors. +previewOutput.on('error', (error) => { + console.info(`Preview output error code: ${error.code}`); +}) + +// Create an ImageReceiver instance and set photographing parameters. Wherein, the resolution must be one of the photographing resolutions supported by the current device, which are obtained by photoProfilesArray. +let imageReceiver = await image.createImageReceiver(1920, 1080, 4, 8) +// Obtain the surface ID for displaying the photos. +let photoSurfaceId = await imageReceiver.getReceivingSurfaceId() +// Create a photo output stream. +let photoOutput +try { + photoOutput = cameraManager.createPhotoOutput(photoProfilesArray[0], photoSurfaceId) +} catch (error) { + console.error('Failed to createPhotoOutput errorCode = ' + error.code); +} +// Create a session. +let captureSession +try { + captureSession = cameraManager.createCaptureSession() +} catch (error) { + console.error('Failed to create the CaptureSession instance. errorCode = ' + error.code); +} + +// Listen for session errors. +captureSession.on('error', (error) => { + console.info(`Capture session error code: ${error.code}`); +}) + +// Start configuration for the session. +try { + captureSession.beginConfig() +} catch (error) { + console.error('Failed to beginConfig. errorCode = ' + error.code); +} + +// Add the camera input stream to the session. +try { + captureSession.addInput(cameraInput) +} catch (error) { + console.error('Failed to addInput. errorCode = ' + error.code); +} + +// Add the preview output stream to the session. +try { + captureSession.addOutput(previewOutput) +} catch (error) { + console.error('Failed to addOutput(previewOutput). errorCode = ' + error.code); +} + +// Add the photo output stream to the session. +try { + captureSession.addOutput(photoOutput) +} catch (error) { + console.error('Failed to addOutput(photoOutput). errorCode = ' + error.code); +} + +// Commit the session configuration. +await captureSession.commitConfig() + +// Start the session. +await captureSession.start().then(() => { + console.info('Promise returned to indicate the session start success.'); +}) +// Check whether the camera has flash. +let flashStatus +try { + flashStatus = captureSession.hasFlash() +} catch (error) { + console.error('Failed to hasFlash. errorCode = ' + error.code); +} +console.info('Promise returned with the flash light support status:' + flashStatus); + +if (flashStatus) { + // Check whether the auto flash mode is supported. + let flashModeStatus + try { + let status = captureSession.isFlashModeSupported(camera.FlashMode.FLASH_MODE_AUTO) + flashModeStatus = status + } catch (error) { + console.error('Failed to check whether the flash mode is supported. errorCode = ' + error.code); + } + if(flashModeStatus) { + // Set the flash mode to auto. + try { + captureSession.setFlashMode(camera.FlashMode.FLASH_MODE_AUTO) + } catch (error) { + console.error('Failed to set the flash mode. errorCode = ' + error.code); + } + } +} + +// Check whether the continuous auto focus is supported. +let focusModeStatus +try { + let status = captureSession.isFocusModeSupported(camera.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO) + focusModeStatus = status +} catch (error) { + console.error('Failed to check whether the focus mode is supported. errorCode = ' + error.code); +} + +if (focusModeStatus) { + // Set the focus mode to continuous auto focus. + try { + captureSession.setFocusMode(camera.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO) + } catch (error) { + console.error('Failed to set the focus mode. errorCode = ' + error.code); + } +} + +// Obtain the zoom ratio range supported by the camera. +let zoomRatioRange +try { + zoomRatioRange = captureSession.getZoomRatioRange() +} catch (error) { + console.error('Failed to get the zoom ratio range. errorCode = ' + error.code); +} + +// Set a zoom ratio. +try { + captureSession.setZoomRatio(zoomRatioRange[0]) +} catch (error) { + console.error('Failed to set the zoom ratio value. errorCode = ' + error.code); +} +let settings = { + quality: camera.QualityLevel.QUALITY_LEVEL_HIGH, // Set the photo quality to high. + rotation: camera.ImageRotation.ROTATION_0 // Set the rotation angle of the photo to 0. +} +// Use the current photographing settings to take photos. +photoOutput.capture(settings, async (err) => { + if (err) { + console.error('Failed to capture the photo ${err.message}'); + return; + } + console.info('Callback invoked to indicate the photo capture request success.'); +}); +// Stop the session. +captureSession.stop() + +// Release the camera input stream. +cameraInput.close() + +// Release the preview output stream. +previewOutput.release() + +// Release the photo output stream. +photoOutput.release() + +// Release the session. +captureSession.release() + +// Set the session to null. +captureSession = null +``` diff --git a/en/application-dev/media/camera-shooting.md b/en/application-dev/media/camera-shooting.md new file mode 100644 index 0000000000000000000000000000000000000000..9026267ebc0a6950ced6b5092ce88e8ed31d2e24 --- /dev/null +++ b/en/application-dev/media/camera-shooting.md @@ -0,0 +1,159 @@ +# Camera Photographing + +Photographing is an important function of the camera application. Based on the complex logic of the camera hardware, the camera module provides APIs for you to set information such as resolution, flash, focal length, photo quality, and rotation angle. + +## How to Develop + +Read [Camera](../reference/apis/js-apis-camera.md) for the API reference. + +1. Import the image module. The APIs provided by this module are used to obtain the surface ID and create a photo output stream. + + ```ts + import image from '@ohos.multimedia.image'; + ``` + +2. Obtain the surface ID. + + Call **createImageReceiver()** of the image module to create an **ImageReceiver** instance, and use **getReceivingSurfaceId()** of the instance to obtain the surface ID, which is associated with the photo output stream to process the data output by the stream. + + ```ts + function getImageReceiverSurfaceId() { + let receiver = image.createImageReceiver(640, 480, 4, 8); + console.info('before ImageReceiver check'); + if (receiver !== undefined) { + console.info('ImageReceiver is ok'); + let photoSurfaceId = receiver.getReceivingSurfaceId(); + console.info('ImageReceived id: ' + JSON.stringify(photoSurfaceId)); + } else { + console.info('ImageReceiver is not ok'); + } + } + ``` + +3. Create a photo output stream. + + Obtain the photo output streams supported by the current device from **photoProfiles** in **CameraOutputCapability**, and then call **createPhotoOutput()** to pass in a supported output stream and the surface ID obtained in step 1 to create a photo output stream. + + ```ts + let photoProfilesArray = cameraOutputCapability.photoProfiles; + if (!photoProfilesArray) { + console.error("createOutput photoProfilesArray == null || undefined"); + } + let photoOutput; + try { + photoOutput = cameraManager.createPhotoOutput(photoProfilesArray[0], photoSurfaceId); + } catch (error) { + console.error('Failed to createPhotoOutput errorCode = ' + error.code); + } + ``` + +4. Set camera parameters. + + You can set camera parameters to adjust photographing functions, including the flash, zoom ratio, and focal length. + + ```ts + // Check whether the camera has flash. + let flashStatus; + try { + flashStatus = captureSession.hasFlash(); + } catch (error) { + console.error('Failed to hasFlash. errorCode = ' + error.code); + } + console.info('Promise returned with the flash light support status:' + flashStatus); + if (flashStatus) { + // Check whether the auto flash mode is supported. + let flashModeStatus; + try { + let status = captureSession.isFlashModeSupported(camera.FlashMode.FLASH_MODE_AUTO); + flashModeStatus = status; + } catch (error) { + console.error('Failed to check whether the flash mode is supported. errorCode = ' + error.code); + } + if(flashModeStatus) { + // Set the flash mode to auto. + try { + captureSession.setFlashMode(camera.FlashMode.FLASH_MODE_AUTO); + } catch (error) { + console.error('Failed to set the flash mode. errorCode = ' + error.code); + } + } + } + // Check whether the continuous auto focus is supported. + let focusModeStatus; + try { + let status = captureSession.isFocusModeSupported(camera.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); + focusModeStatus = status; + } catch (error) { + console.error('Failed to check whether the focus mode is supported. errorCode = ' + error.code); + } + if (focusModeStatus) { + // Set the focus mode to continuous auto focus. + try { + captureSession.setFocusMode(camera.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); + } catch (error) { + console.error('Failed to set the focus mode. errorCode = ' + error.code); + } + } + // Obtain the zoom ratio range supported by the camera. + let zoomRatioRange; + try { + zoomRatioRange = captureSession.getZoomRatioRange(); + } catch (error) { + console.error('Failed to get the zoom ratio range. errorCode = ' + error.code); + } + // Set a zoom ratio. + try { + captureSession.setZoomRatio(zoomRatioRange[0]); + } catch (error) { + console.error('Failed to set the zoom ratio value. errorCode = ' + error.code); + } + ``` + +5. Trigger photographing. + + Call **capture()** in the **PhotoOutput** class to capture a photo. In this API, the first parameter specifies the settings (for example, photo quality and rotation angle) for photographing, and the second parameter is a callback function. + + ```ts + let settings = { + quality: camera.QualityLevel.QUALITY_LEVEL_HIGH, // Set the photo quality to high. + rotation: camera.ImageRotation.ROTATION_0, // Set the rotation angle of the photo to 0. + location: captureLocation, // Set the geolocation information of the photo. + mirror: false // Disable mirroring (disabled by default). + }; + photoOutput.capture(settings, async (err) => { + if (err) { + console.error('Failed to capture the photo ${err.message}'); + return; + } + console.info('Callback invoked to indicate the photo capture request success.'); + }); + ``` + +## Status Listening + +During camera application development, you can listen for the status of the photo output stream, including the start of the photo stream, the start and end of the photo frame, and the errors of the photo output stream. + +- Register the 'captureStart' event to listen for photographing start events. This event can be registered when a **PhotoOutput** object is created and is triggered when the bottom layer starts exposure for photographing for the first time. The capture ID is returned. + + ```ts + photoOutput.on('captureStart', (captureId) => { + console.info(`photo capture stated, captureId : ${captureId}`); + }) + ``` + +- Register the 'captureEnd' event to listen for photographing end events. This event can be registered when a **PhotoOutput** object is created and is triggered when the photographing is complete. [CaptureEndInfo](../reference/apis/js-apis-camera.md#captureendinfo) is returned. + + ```ts + photoOutput.on('captureEnd', (captureEndInfo) => { + console.info(`photo capture end, captureId : ${captureEndInfo.captureId}`); + console.info(`frameCount : ${captureEndInfo.frameCount}`); + }) + ``` + +- Register the 'error' event to listen for photo output errors. The callback function returns an error code when an API is incorrectly used. For details about the error code types, see [Camera Error Codes](../reference/apis/js-apis-camera.md#cameraerrorcode). + + ```ts + photoOutput.on('error', (error) => { + console.info(`Photo output error code: ${error.code}`); + }) + ``` diff --git a/en/application-dev/media/camera.md b/en/application-dev/media/camera.md deleted file mode 100644 index 0622db9c3ce6d962001b47ca6d2e6d1bc2aaff7c..0000000000000000000000000000000000000000 --- a/en/application-dev/media/camera.md +++ /dev/null @@ -1,511 +0,0 @@ -# Camera Development - -## When to Use - -With the APIs provided by the **Camera** module, you can access and operate camera devices and develop new functions. Common operations include preview, photographing, and video recording. You can also implement flash control, exposure time control, focus mode control, zoom control, and much more. - -Before calling camera APIs, be familiar with the following concepts: - -- **Static camera capabilities**: A series of parameters used to describe inherent capabilities of a camera, such as orientation and supported resolution. -- **Physical camera**: An independent camera device. The physical camera ID is a string that uniquely identifies a physical camera. -- **Asynchronous operation**: A non-blocking operation that allows other operations to execute before it completes. To prevent the UI thread from being blocked, some **Camera** calls are asynchronous. Each asynchronous API provides the callback and promise functions. - -## How to Develop - -### Available APIs - -For details about the APIs, see [Camera Management](../reference/apis/js-apis-camera.md). - -### Full-Process Scenario - -The full process includes applying for permissions, creating an instance, setting parameters, managing sessions, taking photos, recording videos, and releasing resources. - -#### Applying for Permissions - -You must apply for the permissions for your application to access the camera device and other functions. The following table lists camera-related permissions. - -| Permission| Attribute Value | -| -------- | ------------------------------ | -| Camera| ohos.permission.CAMERA | -| Call recording| ohos.permission.MICROPHONE | -| Storage| ohos.permission.WRITE_MEDIA | -| Read| ohos.permission.READ_MEDIA | -| Location| ohos.permission.MEDIA_LOCATION | - -The code snippet is as follows: - -```typescript -const PERMISSIONS: Array = [ - 'ohos.permission.CAMERA', - 'ohos.permission.MICROPHONE', - 'ohos.permission.MEDIA_LOCATION', - 'ohos.permission.READ_MEDIA', - 'ohos.permission.WRITE_MEDIA' -] - -function applyPermission() { - console.info('[permission] get permission'); - globalThis.abilityContext.requestPermissionFromUser(PERMISSIONS) - } -``` - -#### Creating an Instance - -You must create an independent **CameraManager** instance before performing camera operations. If this operation fails, the camera may be occupied or unusable. If the camera is occupied, wait until it is released. You can call **getSupportedCameras()** to obtain the list of cameras supported by the current device. The list stores all camera IDs of the current device. Each of these IDs can be used to create an independent **CameraManager** instance. If the list is empty, no camera is available for the current device and subsequent operations cannot be performed. The camera has preview, shooting, video recording, and metadata output streams. You can use **getSupportedOutputCapability()** to obtain the output stream capabilities of the camera and configure them in the **profile** field in **CameraOutputCapability**. The procedure for creating a **CameraManager** instance is as follows: - -```typescript -import camera from '@ohos.multimedia.camera' -import image from '@ohos.multimedia.image' -import media from '@ohos.multimedia.media' - -// Create a CameraManager instance. -context: any = getContext(this) -let cameraManager = camera.getCameraManager(this.context) -if (!cameraManager) { - console.error("camera.getCameraManager error") - return; -} -// Listen for camera state changes. -cameraManager.on('cameraStatus', (cameraStatusInfo) => { - console.log(`camera : ${cameraStatusInfo.camera.cameraId}`); - console.log(`status: ${cameraStatusInfo.status}`); -}) - -// Obtain the camera list. -let cameraArray = cameraManager.getSupportedCameras(); -if (cameraArray.length <= 0) { - console.error("cameraManager.getSupportedCameras error") - return; -} - -for (let index = 0; index < cameraArray.length; index++) { - console.log('cameraId : ' + cameraArray[index].cameraId); // Obtain the camera ID. - console.log('cameraPosition : ' + cameraArray[index].cameraPosition); // Obtain the camera position. - console.log('cameraType : ' + cameraArray[index].cameraType); // Obtain the camera type. - console.log('connectionType : ' + cameraArray[index].connectionType); // Obtain the camera connection type. -} - -// Create a camera input stream. -let cameraInput -try { - cameraInput = cameraManager.createCameraInput(cameraArray[0]); -} catch () { - console.error('Failed to createCameraInput errorCode = ' + error.code); -} - -// Listen for CameraInput errors. -let cameraDevice = cameraArray[0]; -cameraInput.on('error', cameraDevice, (error) => { - console.log(`Camera input error code: ${error.code}`); -}) - -// Open the camera. -await cameraInput.open(); - -// Obtain the output stream capabilities supported by the camera. -let cameraOutputCap = cameraManager.getSupportedOutputCapability(cameraArray[0]); -if (!cameraOutputCap) { - console.error("cameraManager.getSupportedOutputCapability error") - return; -} -console.info("outputCapability: " + JSON.stringify(cameraOutputCap)); - -let previewProfilesArray = cameraOutputCap.previewProfiles; -if (!previewProfilesArray) { - console.error("createOutput previewProfilesArray == null || undefined") -} - -let photoProfilesArray = cameraOutputCap.photoProfiles; -if (!photoProfilesArray) { - console.error("createOutput photoProfilesArray == null || undefined") -} - -let videoProfilesArray = cameraOutputCap.videoProfiles; -if (!videoProfilesArray) { - console.error("createOutput videoProfilesArray == null || undefined") -} - -let metadataObjectTypesArray = cameraOutputCap.supportedMetadataObjectTypes; -if (!metadataObjectTypesArray) { - console.error("createOutput metadataObjectTypesArray == null || undefined") -} - -// Create a preview stream. For details about the surfaceId parameter, see the XComponent section. The preview stream is the surface provided by the XComponent. -let previewOutput -try { - previewOutput = cameraManager.createPreviewOutput(previewProfilesArray[0], surfaceId) -} catch (error) { - console.error("Failed to create the PreviewOutput instance.") -} - -// Listen for PreviewOutput errors. -previewOutput.on('error', (error) => { - console.log(`Preview output error code: ${error.code}`); -}) - -// Create an ImageReceiver instance and set photo parameters. Wherein, the resolution must be one of the photographing resolutions supported by the current device, which are obtained by photoProfilesArray. -let imageReceiver = await image.createImageReceiver(1920, 1080, 4, 8) -// Obtain the surface ID for displaying the photos. -let photoSurfaceId = await imageReceiver.getReceivingSurfaceId() -// Create a photographing output stream. -let photoOutput -try { - photoOutput = cameraManager.createPhotoOutput(photoProfilesArray[0], photoSurfaceId) -} catch (error) { - console.error('Failed to createPhotoOutput errorCode = ' + error.code); -} - -// Define video recording parameters. -let videoConfig = { - audioSourceType: 1, - videoSourceType: 1, - profile: { - audioBitrate: 48000, - audioChannels: 2, - audioCodec: 'audio/mp4v-es', - audioSampleRate: 48000, - durationTime: 1000, - fileFormat: 'mp4', - videoBitrate: 48000, - videoCodec: 'video/mp4v-es', - videoFrameWidth: 640, - videoFrameHeight: 480, - videoFrameRate: 30 - }, - url: 'file:///data/media/01.mp4', - orientationHint: 0, - maxSize: 100, - maxDuration: 500, - rotation: 0 -} - -// Create a video recording output stream. -let videoRecorder -media.createVideoRecorder().then((recorder) => { - console.log('createVideoRecorder called') - videoRecorder = recorder -}) -// Set video recording parameters. -videoRecorder.prepare(videoConfig) -// Obtain the surface ID for video recording. -let videoSurfaceId -videoRecorder.getInputSurface().then((id) => { - console.log('getInputSurface called') - videoSurfaceId = id -}) - -// Create a VideoOutput instance. -let videoOutput -try { - videoOutput = cameraManager.createVideoOutput(videoProfilesArray[0], videoSurfaceId) -} catch (error) { - console.error('Failed to create the videoOutput instance. errorCode = ' + error.code); -} - -// Listen for VideoOutput errors. -videoOutput.on('error', (error) => { - console.log(`Preview output error code: ${error.code}`); -}) -``` -Surfaces must be created in advance for the preview, shooting, and video recording stream. The preview stream is the surface provided by the **XComponent**, the shooting stream is the surface provided by **ImageReceiver**, and the video recording stream is the surface provided by **VideoRecorder**. - -**XComponent** - -```typescript -mXComponentController: XComponentController = new XComponentController // Create an XComponentController. - -build() { - Flex() { - XComponent({ // Create an XComponent. - id: '', - type: 'surface', - libraryname: '', - controller: this.mXComponentController - }) - .onload(() => { // Set the onload callback. - // Set the surface width and height (1920 x 1080). For details about how to set the preview size, see the preview resolutions supported by the current device, which are obtained by previewProfilesArray. - this.mXComponentController.setXComponentSurfaceSize({surfaceWidth:1920,surfaceHeight:1080}) - // Obtain the surface ID. - globalThis.surfaceId = mXComponentController.getXComponentSurfaceId() - }) - .width('1920px') // Set the width of the XComponent. - .height('1080px') // Set the height of the XComponent. - } -} -``` - -**ImageReceiver** - -```typescript -function getImageReceiverSurfaceId() { - let receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before ImageReceiver check') - if (receiver !== undefined) { - console.log('ImageReceiver is ok') - surfaceId1 = receiver.getReceivingSurfaceId() - console.log('ImageReceived id: ' + JSON.stringify(surfaceId1)) - } else { - console.log('ImageReceiver is not ok') - } - } -``` - -**VideoRecorder** - -```typescript -function getVideoRecorderSurface() { - await getFd('CameraManager.mp4'); - mVideoConfig.url = mFdPath; - media.createVideoRecorder((err, recorder) => { - console.info('Entering create video receiver') - mVideoRecorder = recorder - console.info('videoRecorder is :' + JSON.stringify(mVideoRecorder)) - console.info('videoRecorder.prepare called.') - mVideoRecorder.prepare(mVideoConfig, (err) => { - console.info('videoRecorder.prepare success.') - mVideoRecorder.getInputSurface((err, id) => { - console.info('getInputSurface called') - mVideoSurface = id - console.info('getInputSurface surfaceId: ' + JSON.stringify(mVideoSurface)) - }) - }) - }) - } -``` - -#### Managing Sessions - -##### Creating a Session - -```typescript -// Create a session. -let captureSession -try { - captureSession = cameraManager.createCaptureSession() -} catch (error) { - console.error('Failed to create the CaptureSession instance. errorCode = ' + error.code); -} - -// Listen for session errors. -captureSession.on('error', (error) => { - console.log(`Capture session error code: ${error.code}`); -}) - -// Start configuration for the session. -try { - captureSession.beginConfig() -} catch (error) { - console.error('Failed to beginConfig. errorCode = ' + error.code); -} - -// Add the camera input stream to the session. -try { - captureSession.addInput(cameraInput) -} catch (error) { - console.error('Failed to addInput. errorCode = ' + error.code); -} - -// Add the preview input stream to the session. -try { - captureSession.addOutput(previewOutput) -} catch (error) { - console.error('Failed to addOutput(previewOutput). errorCode = ' + error.code); -} - -// Add the photographing output stream to the session. -try { - captureSession.addOutput(photoOutput) -} catch (error) { - console.error('Failed to addOutput(photoOutput). errorCode = ' + error.code); -} - -// Commit the session configuration. -await captureSession.commitConfig() - -// Start the session. -await captureSession.start().then(() => { - console.log('Promise returned to indicate the session start success.'); -}) -``` - -##### Switching a Session - -```typescript -// Stop the session. -await captureSession.stop() - -// Start configuration for the session. -try { - captureSession.beginConfig() -} catch (error) { - console.error('Failed to beginConfig. errorCode = ' + error.code); -} - -// Remove the photographing output stream from the session. -try { - captureSession.removeOutput(photoOutput) -} catch (error) { - console.error('Failed to removeOutput(photoOutput). errorCode = ' + error.code); -} - -// Add a video recording output stream to the session. -try { - captureSession.addOutput(videoOutput) -} catch (error) { - console.error('Failed to addOutput(videoOutput). errorCode = ' + error.code); -} - -// Commit the session configuration. -await captureSession.commitConfig() - -// Start the session. -await captureSession.start().then(() => { - console.log('Promise returned to indicate the session start success.'); -}) -``` - -#### Setting Parameters - -```typescript -// Check whether the camera has flash. -let flashStatus -try { - flashStatus = captureSession.hasFlash() -} catch (error) { - console.error('Failed to hasFlash. errorCode = ' + error.code); -} -console.log('Promise returned with the flash light support status:' + flashStatus); - -if (flashStatus) { - // Check whether the auto flash mode is supported. - let flashModeStatus - try { - let status = captureSession.isFlashModeSupported(camera.FlashMode.FLASH_MODE_AUTO) - flashModeStatus = status - } catch (error) { - console.error('Failed to check whether the flash mode is supported. errorCode = ' + error.code); - } - if(flashModeStatus) { - // Set the flash mode to auto. - try { - captureSession.setFlashMode(camera.FlashMode.FLASH_MODE_AUTO) - } catch (error) { - console.error('Failed to set the flash mode. errorCode = ' + error.code); - } - } -} - -// Check whether the continuous auto focus is supported. -let focusModeStatus -try { - let status = captureSession.isFocusModeSupported(camera.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO) - focusModeStatus = status -} catch (error) { - console.error('Failed to check whether the focus mode is supported. errorCode = ' + error.code); -} - -if (focusModeStatus) { - // Set the focus mode to continuous auto focus. - try { - captureSession.setFocusMode(camera.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO) - } catch (error) { - console.error('Failed to set the focus mode. errorCode = ' + error.code); - } -} - -// Obtain the zoom ratio range supported by the camera. -let zoomRatioRange -try { - zoomRatioRange = captureSession.getZoomRatioRange() -} catch (error) { - console.error('Failed to get the zoom ratio range. errorCode = ' + error.code); -} - -// Set a zoom ratio. -try { - captureSession.setZoomRatio(zoomRatioRange[0]) -} catch (error) { - console.error('Failed to set the zoom ratio value. errorCode = ' + error.code); -} -``` - -#### Taking Photos - -```typescript -let settings = { - quality: camera.QualityLevel.QUALITY_LEVEL_HIGH, // Set the image quality to high. - rotation: camera.ImageRotation.ROTATION_0 // Set the image rotation angle to 0. -} -// Use the current photographing settings to take photos. -photoOutput.capture(settings, async (err) => { - if (err) { - console.error('Failed to capture the photo ${err.message}'); - return; - } - console.log('Callback invoked to indicate the photo capture request success.'); -}); -``` - -#### Recording Videos - -```typescript -// Start the video recording output stream. -videoOutput.start(async (err) => { - if (err) { - console.error('Failed to start the video output ${err.message}'); - return; - } - console.log('Callback invoked to indicate the video output start success.'); -}); - -// Start video recording. -videoRecorder.start().then(() => { - console.info('videoRecorder start success'); -} - -// Stop video recording. -videoRecorder.stop().then(() => { - console.info('stop success'); -} - -// Stop the video recording output stream. -videoOutput.stop((err) => { - if (err) { - console.error('Failed to stop the video output ${err.message}'); - return; - } - console.log('Callback invoked to indicate the video output stop success.'); -}); -``` - -For details about the APIs used for saving photos, see [Image Processing](image.md#using-imagereceiver). - -#### Releasing Resources - -```typescript -// Stop the session. -captureSession.stop() - -// Release the camera input stream. -cameraInput.close() - -// Release the preview output stream. -previewOutput.release() - -// Release the photographing output stream. -photoOutput.release() - -// Release the video recording output stream. -videoOutput.release() - -// Release the session. -captureSession.release() - -// Set the session to null. -captureSession = null -``` - -## Process Flowchart - -The following figure shows the process of using the camera. -![camera_framework process](figures/camera_framework_process.png) diff --git a/en/application-dev/media/distributed-audio-playback.md b/en/application-dev/media/distributed-audio-playback.md new file mode 100644 index 0000000000000000000000000000000000000000..c56420de740e545168d009b5c743f2790146c475 --- /dev/null +++ b/en/application-dev/media/distributed-audio-playback.md @@ -0,0 +1,101 @@ +# Distributed Audio Playback (for System Applications Only) + +Distributed audio playback enables an application to continue audio playback on another device in the same network. + +You can use distributed audio playback to transfer all audio streams or the specified audio stream being played on the current device to a remote device. + +## How to Develop + +Before continuing audio playback on another device in the same network, you must obtain the device list on the network and listen for device connection state changes. For details, see [Audio Output Device Management](audio-output-device-management.md). + +When obtaining the device list on the network, you can specify **DeviceFlag** to filter out the required devices. + +| Name| Description| +| -------- | -------- | +| NONE_DEVICES_FLAG9+ | None. This is a system API.| +| OUTPUT_DEVICES_FLAG | Local output device.| +| INPUT_DEVICES_FLAG | Local input device.| +| ALL_DEVICES_FLAG | Local input and output device.| +| DISTRIBUTED_OUTPUT_DEVICES_FLAG9+ | Remote output device. This is a system API.| +| DISTRIBUTED_INPUT_DEVICES_FLAG9+ | Remote input device. This is a system API.| +| ALL_DISTRIBUTED_DEVICES_FLAG9+ | Remote input and output device. This is a system API.| + +For details about the API reference, see [AudioRoutingManager](../reference/apis/js-apis-audio.md#audioroutingmanager9). + +### Continuing the Playing of All Audio Streams + +1. [Obtain the output device information](audio-output-device-management.md#obtaining-output-device-information). + +2. Create an **AudioDeviceDescriptor** instance to describe an audio output device. + +3. Call **selectOutputDevice** to select a remote device, on which all the audio streams will continue playing. + +```ts +let outputAudioDeviceDescriptor = [{ + deviceRole: audio.DeviceRole.OUTPUT_DEVICE, + deviceType: audio.DeviceType.SPEAKER, + id: 1, + name: "", + address: "", + sampleRates: [44100], + channelCounts: [2], + channelMasks: [0], + networkId: audio.LOCAL_NETWORK_ID, + interruptGroupId: 1, + volumeGroupId: 1, +}]; + +async function selectOutputDevice() { + audioRoutingManager.selectOutputDevice(outputAudioDeviceDescriptor, (err) => { + if (err) { + console.error(`Invoke selectOutputDevice failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info('Invoke selectOutputDevice succeeded.'); + } + }); +} +``` + +### Continuing the Playing of the Specified Audio Stream + +1. [Obtain the output device information](audio-output-device-management.md#obtaining-output-device-information). + +2. Create an **AudioRendererFilter** instance, with **uid** to specify an application and **rendererId** to specify an audio stream. + +3. Create an **AudioDeviceDescriptor** instance to describe an audio output device. + +4. Call **selectOutputDeviceByFilter** to select a remote device, on which the specified audio stream will continue playing. + +```ts +let outputAudioRendererFilter = { + uid: 20010041, + rendererInfo: { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 }, + rendererId: 0 }; + +let outputAudioDeviceDescriptor = [{ + deviceRole: audio.DeviceRole.OUTPUT_DEVICE, + deviceType: audio.DeviceType.SPEAKER, + id: 1, + name: "", + address: "", + sampleRates: [44100], + channelCounts: [2], + channelMasks: [0], + networkId: audio.LOCAL_NETWORK_ID, + interruptGroupId: 1, + volumeGroupId: 1, +}]; + +async function selectOutputDeviceByFilter() { + audioRoutingManager.selectOutputDeviceByFilter(outputAudioRendererFilter, outputAudioDeviceDescriptor, (err) => { + if (err) { + console.error(`Invoke selectOutputDeviceByFilter failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info('Invoke selectOutputDeviceByFilter succeeded.'); + } + }); +} +``` diff --git a/en/application-dev/media/distributed-avsession-overview.md b/en/application-dev/media/distributed-avsession-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..ff293ed7332d0a9c5e66632f91c943af42d28030 --- /dev/null +++ b/en/application-dev/media/distributed-avsession-overview.md @@ -0,0 +1,54 @@ +# Distributed AVSession Overview + +With distributed AVSession, OpenHarmony allows users to project locally played media to a distributed device for a better playback effect. For example, users can project audio played on a tablet to a smart speaker. + +After the user initiates a projection, the media information is synchronized to the distributed device in real time, and the user can control the playback (for example, previous, next, play, and pause) on the distributed device. From the perspective of the user, the playback control operation on the distributed device is the same as that on the local device. + + +## Interaction Process + +After the local device is paired with a distributed device, the controller on the local device projects media to the distributed device through AVSessionManager, thereby implementing a distributed AVSession. The interaction process is shown below. + +![Distributed AVSession Interaction Process](figures/distributed-avsession-interaction-process.png) + +The AVSession service on the distributed device automatically creates an **AVSession** object for information synchronization with the local device. The information to synchronize includes the session information, control commands, and events. + +## Distributed AVSession Process + +After the user triggers a projection, the remote device automatically creates an **AVSession** object to associate it with that on the local device. The detailed process is as follows: + +1. After receiving an audio device switching command, the AVSession service on the local device synchronizes the session information to the distributed device. + +2. The controller (for example, Media Controller) on the distributed device detects the new **AVSession** object and creates an **AVSessionController** object for it. + +3. Through the **AVSessionController** object, the controller on the distributed device sends a control command to the **AVSession** object on the local device. + +4. Upon the receipt of the control command, the **AVSession** object on the local device triggers a callback to the local audio application. + +5. The **AVSession** object on the local device synchronizes the new session information to the controller on the distributed device in real time. + +6. When the remote device is disconnected, the audio stream is switched back to the local device and the playback is paused. (The audio module completes the switchback, and the AVSession service instructs the application to pause the playback.) + +## Distributed AVSession Scenarios + +There are two scenarios for projection implemented using the distributed AVSession: + +- System projection: The controller (for example, Media Controller) initiates a projection. + +This type of projection takes effect for all applications. After a system projection, all audios on the local device are played from the distributed device by default. + +- Application projection: An audio and video application integrates the projection component to initiate a projection. (This scenario is not supported yet.) + + This type of projection takes effect for a single application. After an application projection, audio of the application on the local device is played from the distributed device, and audio of other applications is still played from the local device. + +Projection preemption is supported. If application A initiates a projection to a remote device and then application B initiates a projection to the same device, then audio of application B is played on the remote device. + +## Relationship Between Distributed AVSession and Distributed Audio Playback + +The internal logic for the distributed AVSession to implement projection is as follows: + +- API related to [distributed audio playback](distributed-audio-playback.md) are called to project audio streams to the distributed device. + +- The distributed capability is used to project the session metadata to the distributed device for display. + +Projection implemented by using the distributed AVSession not only enables audio to be played on the distributed device, but also enables media information to be displayed on the distributed device. It also allows the user to perform playback control on the distributed device. diff --git a/en/application-dev/media/figures/audio-capturer-state.png b/en/application-dev/media/figures/audio-capturer-state.png deleted file mode 100644 index 52b5556260dbf78c5e816b37013248a07e8dbbc6..0000000000000000000000000000000000000000 Binary files a/en/application-dev/media/figures/audio-capturer-state.png and /dev/null differ diff --git a/en/application-dev/media/figures/audio-playback-interaction-diagram.png b/en/application-dev/media/figures/audio-playback-interaction-diagram.png new file mode 100644 index 0000000000000000000000000000000000000000..b96179b6b610463bc34d2515b145a57b29e574cb Binary files /dev/null and b/en/application-dev/media/figures/audio-playback-interaction-diagram.png differ diff --git a/en/application-dev/media/figures/audio-renderer-state.png b/en/application-dev/media/figures/audio-renderer-state.png deleted file mode 100644 index 9ae30c2a9306dc85662405c36da9e11d07ed9a2a..0000000000000000000000000000000000000000 Binary files a/en/application-dev/media/figures/audio-renderer-state.png and /dev/null differ diff --git a/en/application-dev/media/figures/audio-stream-mgmt-invoking-relationship.png b/en/application-dev/media/figures/audio-stream-mgmt-invoking-relationship.png new file mode 100644 index 0000000000000000000000000000000000000000..50ad902dd8b55a91a220e2705fea5674cd855ae6 Binary files /dev/null and b/en/application-dev/media/figures/audio-stream-mgmt-invoking-relationship.png differ diff --git a/en/application-dev/media/figures/audiocapturer-status-change.png b/en/application-dev/media/figures/audiocapturer-status-change.png new file mode 100644 index 0000000000000000000000000000000000000000..aadbc4fb6470b7cdc0f399ee5954a96c01a7f7c3 Binary files /dev/null and b/en/application-dev/media/figures/audiocapturer-status-change.png differ diff --git a/en/application-dev/media/figures/audiorenderer-status-change.png b/en/application-dev/media/figures/audiorenderer-status-change.png new file mode 100644 index 0000000000000000000000000000000000000000..a721044f7aeccfed0260176963d192cac40dd8a6 Binary files /dev/null and b/en/application-dev/media/figures/audiorenderer-status-change.png differ diff --git a/en/application-dev/media/figures/avsession-interaction-process.png b/en/application-dev/media/figures/avsession-interaction-process.png new file mode 100644 index 0000000000000000000000000000000000000000..2347599b7d118c45c2d2eb58708729f91c4dc801 Binary files /dev/null and b/en/application-dev/media/figures/avsession-interaction-process.png differ diff --git a/en/application-dev/media/figures/bitmap-operation.png b/en/application-dev/media/figures/bitmap-operation.png new file mode 100644 index 0000000000000000000000000000000000000000..c5107dbabd86fdc29863d5f25947b447d9c1deeb Binary files /dev/null and b/en/application-dev/media/figures/bitmap-operation.png differ diff --git a/en/application-dev/media/figures/camera-development-model.png b/en/application-dev/media/figures/camera-development-model.png new file mode 100644 index 0000000000000000000000000000000000000000..fa97f369dda840cb474bc8fffbb7396b8a7b6508 Binary files /dev/null and b/en/application-dev/media/figures/camera-development-model.png differ diff --git a/en/application-dev/media/figures/camera-workflow.png b/en/application-dev/media/figures/camera-workflow.png new file mode 100644 index 0000000000000000000000000000000000000000..31a7e814724cf97a80a5cc8b88778334ccb352fb Binary files /dev/null and b/en/application-dev/media/figures/camera-workflow.png differ diff --git a/en/application-dev/media/figures/camera_framework_process.png b/en/application-dev/media/figures/camera_framework_process.png deleted file mode 100644 index bf4b6806fb19e087318306dbc7f9a4b0576273cd..0000000000000000000000000000000000000000 Binary files a/en/application-dev/media/figures/camera_framework_process.png and /dev/null differ diff --git a/en/application-dev/media/figures/cropping.jpeg b/en/application-dev/media/figures/cropping.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..a564818815eb3fde13a40ef02d0811bd56803fb9 Binary files /dev/null and b/en/application-dev/media/figures/cropping.jpeg differ diff --git a/en/application-dev/media/figures/distributed-avsession-interaction-process.png b/en/application-dev/media/figures/distributed-avsession-interaction-process.png new file mode 100644 index 0000000000000000000000000000000000000000..d16e362db22857b2ddba3cdbf2142c3759f73fc8 Binary files /dev/null and b/en/application-dev/media/figures/distributed-avsession-interaction-process.png differ diff --git a/en/application-dev/media/figures/en-us_image_audio_player.png b/en/application-dev/media/figures/en-us_image_audio_player.png deleted file mode 100644 index 4edcec759e7b8507d605823f157ba9c6c1108fcd..0000000000000000000000000000000000000000 Binary files a/en/application-dev/media/figures/en-us_image_audio_player.png and /dev/null differ diff --git a/en/application-dev/media/figures/en-us_image_audio_recorder_state_machine.png b/en/application-dev/media/figures/en-us_image_audio_recorder_state_machine.png deleted file mode 100644 index 8cd657cf19c48da5e52809bad387984f50d5a3c7..0000000000000000000000000000000000000000 Binary files a/en/application-dev/media/figures/en-us_image_audio_recorder_state_machine.png and /dev/null differ diff --git a/en/application-dev/media/figures/en-us_image_audio_recorder_zero.png b/en/application-dev/media/figures/en-us_image_audio_recorder_zero.png deleted file mode 100644 index 7c33fcc1723fcdcc468bd3a6004de8b03b20100b..0000000000000000000000000000000000000000 Binary files a/en/application-dev/media/figures/en-us_image_audio_recorder_zero.png and /dev/null differ diff --git a/en/application-dev/media/figures/en-us_image_audio_routing_manager.png b/en/application-dev/media/figures/en-us_image_audio_routing_manager.png deleted file mode 100644 index 710679f6cac0c30d06dffa97b0e80b3cebe80f79..0000000000000000000000000000000000000000 Binary files a/en/application-dev/media/figures/en-us_image_audio_routing_manager.png and /dev/null differ diff --git a/en/application-dev/media/figures/en-us_image_audio_state_machine.png b/en/application-dev/media/figures/en-us_image_audio_state_machine.png deleted file mode 100644 index 22b7aeaa1db5b369d3daf44854d7f7f9a00f775b..0000000000000000000000000000000000000000 Binary files a/en/application-dev/media/figures/en-us_image_audio_state_machine.png and /dev/null differ diff --git a/en/application-dev/media/figures/en-us_image_audio_stream_manager.png b/en/application-dev/media/figures/en-us_image_audio_stream_manager.png deleted file mode 100644 index 1f326d4bd0798dd5ecc0b55130904cbf87d2ea1f..0000000000000000000000000000000000000000 Binary files a/en/application-dev/media/figures/en-us_image_audio_stream_manager.png and /dev/null differ diff --git a/en/application-dev/media/figures/en-us_image_audio_volume_manager.png b/en/application-dev/media/figures/en-us_image_audio_volume_manager.png deleted file mode 100644 index 0d47fbfacce9c1ff48811e1cf5d764231bdb596b..0000000000000000000000000000000000000000 Binary files a/en/application-dev/media/figures/en-us_image_audio_volume_manager.png and /dev/null differ diff --git a/en/application-dev/media/figures/en-us_image_avplayer_audio.png b/en/application-dev/media/figures/en-us_image_avplayer_audio.png deleted file mode 100644 index b5eb9b02a977d0e4551a236c7cc8a154710f5517..0000000000000000000000000000000000000000 Binary files a/en/application-dev/media/figures/en-us_image_avplayer_audio.png and /dev/null differ diff --git a/en/application-dev/media/figures/en-us_image_avplayer_state_machine.png b/en/application-dev/media/figures/en-us_image_avplayer_state_machine.png deleted file mode 100644 index aa8afdbcbf142fd745cee03fc422caec51cfe41b..0000000000000000000000000000000000000000 Binary files a/en/application-dev/media/figures/en-us_image_avplayer_state_machine.png and /dev/null differ diff --git a/en/application-dev/media/figures/en-us_image_avplayer_video.png b/en/application-dev/media/figures/en-us_image_avplayer_video.png deleted file mode 100644 index 54525ebed1d1792f43156ffbeb1ffa37f56d8237..0000000000000000000000000000000000000000 Binary files a/en/application-dev/media/figures/en-us_image_avplayer_video.png and /dev/null differ diff --git a/en/application-dev/media/figures/en-us_image_avrecorder_module_interaction.png b/en/application-dev/media/figures/en-us_image_avrecorder_module_interaction.png deleted file mode 100644 index 7d5da3bdc91fe8fb7be9f0b4054f934ec054b8e6..0000000000000000000000000000000000000000 Binary files a/en/application-dev/media/figures/en-us_image_avrecorder_module_interaction.png and /dev/null differ diff --git a/en/application-dev/media/figures/en-us_image_avrecorder_state_machine.png b/en/application-dev/media/figures/en-us_image_avrecorder_state_machine.png deleted file mode 100644 index 7ffcb21f09365e9b072bdaf48f8b98d7d45a8aaa..0000000000000000000000000000000000000000 Binary files a/en/application-dev/media/figures/en-us_image_avrecorder_state_machine.png and /dev/null differ diff --git a/en/application-dev/media/figures/en-us_image_avsession.png b/en/application-dev/media/figures/en-us_image_avsession.png deleted file mode 100644 index 3289bc4ca3c54eb3e99c9230c821380f8f7c0c5b..0000000000000000000000000000000000000000 Binary files a/en/application-dev/media/figures/en-us_image_avsession.png and /dev/null differ diff --git a/en/application-dev/media/figures/en-us_image_video_player.png b/en/application-dev/media/figures/en-us_image_video_player.png deleted file mode 100644 index f9b4aabdc7215f22788d92c68ef353fafffda1c3..0000000000000000000000000000000000000000 Binary files a/en/application-dev/media/figures/en-us_image_video_player.png and /dev/null differ diff --git a/en/application-dev/media/figures/en-us_image_video_recorder_state_machine.png b/en/application-dev/media/figures/en-us_image_video_recorder_state_machine.png deleted file mode 100644 index 3e81dcc18d1f47b6de087a7a88fd75b308ea51a0..0000000000000000000000000000000000000000 Binary files a/en/application-dev/media/figures/en-us_image_video_recorder_state_machine.png and /dev/null differ diff --git a/en/application-dev/media/figures/en-us_image_video_recorder_zero.png b/en/application-dev/media/figures/en-us_image_video_recorder_zero.png deleted file mode 100644 index a7f7fa09392eb916132d891a84d62f31f0f27782..0000000000000000000000000000000000000000 Binary files a/en/application-dev/media/figures/en-us_image_video_recorder_zero.png and /dev/null differ diff --git a/en/application-dev/media/figures/en-us_image_video_state_machine.png b/en/application-dev/media/figures/en-us_image_video_state_machine.png deleted file mode 100644 index c0595ed5120b632142d6da8841c9e45277b10f55..0000000000000000000000000000000000000000 Binary files a/en/application-dev/media/figures/en-us_image_video_state_machine.png and /dev/null differ diff --git a/en/application-dev/media/figures/horizontal-flip.jpeg b/en/application-dev/media/figures/horizontal-flip.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..f43e4f6ab2adc68bf0f90eaf8177d36ee91f32ac Binary files /dev/null and b/en/application-dev/media/figures/horizontal-flip.jpeg differ diff --git a/en/application-dev/media/figures/image-development-process.png b/en/application-dev/media/figures/image-development-process.png new file mode 100644 index 0000000000000000000000000000000000000000..47db9d3faf7f8bffc80f63995dc73d0ad32799e5 Binary files /dev/null and b/en/application-dev/media/figures/image-development-process.png differ diff --git a/en/application-dev/media/figures/invoking-relationship-recording-stream-mgmt.png b/en/application-dev/media/figures/invoking-relationship-recording-stream-mgmt.png new file mode 100644 index 0000000000000000000000000000000000000000..a1f404f67bf18d91c2cc42ab65d8c7c5f01518a8 Binary files /dev/null and b/en/application-dev/media/figures/invoking-relationship-recording-stream-mgmt.png differ diff --git a/en/application-dev/media/figures/local-avsession-interaction-process.png b/en/application-dev/media/figures/local-avsession-interaction-process.png new file mode 100644 index 0000000000000000000000000000000000000000..dfccf9c6874f26a7e030189191f34248b7230b1a Binary files /dev/null and b/en/application-dev/media/figures/local-avsession-interaction-process.png differ diff --git a/en/application-dev/media/figures/media-system-framework.png b/en/application-dev/media/figures/media-system-framework.png new file mode 100644 index 0000000000000000000000000000000000000000..f1b92795c05db2caa6869acfba865f585a947c19 Binary files /dev/null and b/en/application-dev/media/figures/media-system-framework.png differ diff --git a/en/application-dev/media/figures/offsets.jpeg b/en/application-dev/media/figures/offsets.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..ab4c87a69bae55a62feddc0ca61a0ef1081bf199 Binary files /dev/null and b/en/application-dev/media/figures/offsets.jpeg differ diff --git a/en/application-dev/media/figures/original-drawing.jpeg b/en/application-dev/media/figures/original-drawing.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..01a0b0d7022dfc0130029154fec7321bc62dfe36 Binary files /dev/null and b/en/application-dev/media/figures/original-drawing.jpeg differ diff --git a/en/application-dev/media/figures/photographing-development-process.png b/en/application-dev/media/figures/photographing-development-process.png new file mode 100644 index 0000000000000000000000000000000000000000..b7ee61acfa63da55ef1389212e090da14a091a68 Binary files /dev/null and b/en/application-dev/media/figures/photographing-development-process.png differ diff --git a/en/application-dev/media/figures/playback-status-change.png b/en/application-dev/media/figures/playback-status-change.png new file mode 100644 index 0000000000000000000000000000000000000000..860764d3d15b93e544a6f27316584963acba2f0f Binary files /dev/null and b/en/application-dev/media/figures/playback-status-change.png differ diff --git a/en/application-dev/media/figures/recording-development-process.png b/en/application-dev/media/figures/recording-development-process.png new file mode 100644 index 0000000000000000000000000000000000000000..c29043a1f8b9255664969b4e0b0a1ca971d4e1f7 Binary files /dev/null and b/en/application-dev/media/figures/recording-development-process.png differ diff --git a/en/application-dev/media/figures/recording-status-change.png b/en/application-dev/media/figures/recording-status-change.png new file mode 100644 index 0000000000000000000000000000000000000000..9f15af9c1992e34fa7d750d08fd0245b6cb3ba67 Binary files /dev/null and b/en/application-dev/media/figures/recording-status-change.png differ diff --git a/en/application-dev/media/figures/rotate.jpeg b/en/application-dev/media/figures/rotate.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..5965abb46dc9648a3dfd9136e7cc0b5c5203e6a7 Binary files /dev/null and b/en/application-dev/media/figures/rotate.jpeg differ diff --git a/en/application-dev/media/figures/transparency.png b/en/application-dev/media/figures/transparency.png new file mode 100644 index 0000000000000000000000000000000000000000..b9b43939f0dad8ee40bf0b6b7e40ddf49d141c66 Binary files /dev/null and b/en/application-dev/media/figures/transparency.png differ diff --git a/en/application-dev/media/figures/vertical-flip.jpeg b/en/application-dev/media/figures/vertical-flip.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..8ef368d6bb914815a90c8d82352cbd6fd9ab505c Binary files /dev/null and b/en/application-dev/media/figures/vertical-flip.jpeg differ diff --git a/en/application-dev/media/figures/video-playback-interaction-diagram.png b/en/application-dev/media/figures/video-playback-interaction-diagram.png new file mode 100644 index 0000000000000000000000000000000000000000..93778e5fd397820e92b03f60a01076f251348ee6 Binary files /dev/null and b/en/application-dev/media/figures/video-playback-interaction-diagram.png differ diff --git a/en/application-dev/media/figures/video-playback-status-change.png b/en/application-dev/media/figures/video-playback-status-change.png new file mode 100644 index 0000000000000000000000000000000000000000..860764d3d15b93e544a6f27316584963acba2f0f Binary files /dev/null and b/en/application-dev/media/figures/video-playback-status-change.png differ diff --git a/en/application-dev/media/figures/video-recording-interaction-diagram.png b/en/application-dev/media/figures/video-recording-interaction-diagram.png new file mode 100644 index 0000000000000000000000000000000000000000..3fbbffe30f5ab06ba0f0a9e6487c76cecd5546c4 Binary files /dev/null and b/en/application-dev/media/figures/video-recording-interaction-diagram.png differ diff --git a/en/application-dev/media/figures/video-recording-status-change.png b/en/application-dev/media/figures/video-recording-status-change.png new file mode 100644 index 0000000000000000000000000000000000000000..9f15af9c1992e34fa7d750d08fd0245b6cb3ba67 Binary files /dev/null and b/en/application-dev/media/figures/video-recording-status-change.png differ diff --git a/en/application-dev/media/figures/zoom.jpeg b/en/application-dev/media/figures/zoom.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..977db6cfbc5b81f5396e4d81f8954a9f7d4168e4 Binary files /dev/null and b/en/application-dev/media/figures/zoom.jpeg differ diff --git a/en/application-dev/media/image-decoding.md b/en/application-dev/media/image-decoding.md new file mode 100644 index 0000000000000000000000000000000000000000..00665aa430fb0d2ab95007f29d39b8adc5c5433c --- /dev/null +++ b/en/application-dev/media/image-decoding.md @@ -0,0 +1,143 @@ +# Image Decoding + +Image decoding refers to the process of decoding an archived image in a supported format into a [pixel map](image-overview.md) for image display or [processing](image-transformation.md). Currently, the following image formats are supported: JPEG, PNG, GIF, RAW, WebP, BMP, and SVG. + +## How to Develop + +Read [Image](../reference/apis/js-apis-image.md#imagesource) for APIs related to image decoding. + +1. Import the image module. + + ```ts + import image from '@ohos.multimedia.image'; + ``` + +2. Obtain an image. + - Method 1: Obtain the sandbox path. For details about how to obtain the sandbox path, see [Obtaining the Application Development Path](../application-models/application-context-stage.md#obtaining-the-application-development-path). For details about the application sandbox and how to push files to the application sandbox, see [File Management](../file-management/app-sandbox-directory.md). + + ```ts + // Code on the stage model + const context = getContext(this); + const filePath = context.cacheDir + '/test.jpg'; + ``` + + ```ts + // Code on the FA model + import featureAbility from '@ohos.ability.featureAbility'; + + const context = featureAbility.getContext(); + const filePath = context.getCacheDir() + "/test.jpg"; + ``` + - Method 2: Obtain the file descriptor of the image through the sandbox path. For details, see [file.fs API Reference] (../reference/apis/js-apis-file-fs.md). + To use this method, you must import the \@ohos.file.fs module first. + + ```ts + import fs from '@ohos.file.fs'; + ``` + + Then call **fs.openSync()** to obtain the file descriptor. + + ```ts + // Code on the stage model + const context = getContext(this); + const filePath = context.cacheDir + '/test.jpg'; + const file = fs.openSync(filePath, fs.OpenMode.READ_WRITE); + const fd = file?.fd; + ``` + + ```ts + // Code on the FA model + import featureAbility from '@ohos.ability.featureAbility'; + + const context = featureAbility.getContext(); + const filePath = context.getCacheDir() + "/test.jpg"; + const file = fs.openSync(filePath, fs.OpenMode.READ_WRITE); + const fd = file?.fd; + ``` + - Method 3: Obtain the array buffer of the resource file through the resource manager. For details, see [ResourceManager API Reference](../reference/apis/js-apis-resource-manager.md#getrawfilecontent9-1). + + ```ts + // Code on the stage model + const context = getContext(this); + // Obtain a resource manager. + const resourceMgr = context.resourceManager; + ``` + + ```ts + // Code on the FA model + // Import the resourceManager module. + import resourceManager from '@ohos.resourceManager'; + const resourceMgr = await resourceManager.getResourceManager(); + ``` + + The method of obtaining the resource manager varies according to the application model. After obtaining the resource manager, call **resourceMgr.getRawFileContent()** to obtain the array buffer of the resource file. + + ```ts + const fileData = await resourceMgr.getRawFileContent('test.jpg'); + // Obtain the array buffer of the image. + const buffer = fileData.buffer; + ``` + +3. Create an **ImageSource** instance. + - Method 1: Create an **ImageSource** instance using the sandbox path. The sandbox path can be obtained by using method 1 in step 2. + + ```ts + // path indicates the obtained sandbox path. + const imageSource = image.createImageSource(filePath); + ``` + - Method 2: Create an **ImageSource** instance using the file descriptor. The file descriptor can be obtained by using method 2 in step 2. + + ```ts + // fd is the obtained file descriptor. + const imageSource = image.createImageSource(fd); + ``` + - Method 3: Create an **ImageSource** instance using a buffer array. The buffer array can be obtained by using method 3 in step 2. + + ```ts + const imageSource = image.createImageSource(buffer); + ``` + +4. Set **DecodingOptions** and decode the image to obtain a pixel map. + + ```ts + let decodingOptions = { + editable: true, + desiredPixelFormat: 3, + } + // Create a pixel map and perform rotation and scaling on it. + const pixelMap = await imageSource.createPixelMap(decodingOptions); + ``` + + After the decoding is complete and the pixel map is obtained, you can perform subsequent [image processing](image-transformation.md). + +## Sample Code - Decoding an Image in Resource Files + +1. Obtain a resource manager. + + ```ts + const context = getContext(this); + // Obtain a resourceManager instance. + const resourceMgr = context.resourceManager; + ``` + +2. Obtain the array buffer of the **test.jpg** file in the **rawfile** folder. + + ```ts + const fileData = await resourceMgr.getRawFileContent('test.jpg'); + // Obtain the array buffer of the image. + const buffer = fileData.buffer; + ``` + +3. Create an **ImageSource** instance. + + ```ts + const imageSource = image.createImageSource(buffer); + ``` + +4. Create a **PixelMap** instance. + + ```ts + const pixelMap = await imageSource.createPixelMap(); + ``` + + \ No newline at end of file diff --git a/en/application-dev/media/image-encoding.md b/en/application-dev/media/image-encoding.md new file mode 100644 index 0000000000000000000000000000000000000000..96e23b6ba16c63bdaf282dbaf9abc01d95dd6221 --- /dev/null +++ b/en/application-dev/media/image-encoding.md @@ -0,0 +1,48 @@ +# Image Encoding + +Image encoding refers to the process of encoding a pixel map into an archived image in different formats (only in JPEG and WebP currently) for subsequent processing, such as storage and transmission. + +## How to Develop + +Read [Image](../reference/apis/js-apis-image.md#imagepacker) for APIs related to image encoding. + +1. Create an **ImagePacker** object. + + ```ts + // Import the required module. + import image from '@ohos.multimedia.image'; + + const imagePackerApi = image.createImagePacker(); + ``` + +2. Set the encoding output stream and encoding parameters. + + **format** indicates the image encoding format, and **quality** indicates the image quality. The value ranges from 0 to 100, and the value 100 indicates the optimal quality. + + ```ts + let packOpts = { format:"image/jpeg", quality:98 }; + ``` + +3. [Create a PixelMap object or an ImageSource object](image-decoding.md). + +4. Encode the image and save the encoded image. + + Method 1: Use the **PixelMap** object for encoding. + + ```ts + imagePackerApi.packing(pixelMap, packOpts).then( data => { + // data is the file stream obtained after packing. You can write the file and save it to obtain an image. + }).catch(error => { + console.error('Failed to pack the image. And the error is: ' + error); + }) + ``` + + Method 2: Use the **ImageSource** object for encoding. + + ```ts + imagePackerApi.packing(imageSource, packOpts).then( data => { + // data is the file stream obtained after packing. You can write the file and save it to obtain an image. + }).catch(error => { + console.error('Failed to pack the image. And the error is: ' + error); + }) + ``` diff --git a/en/application-dev/media/image-overview.md b/en/application-dev/media/image-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..a88eb049166b845068a67eecec5a613435d124ab --- /dev/null +++ b/en/application-dev/media/image-overview.md @@ -0,0 +1,40 @@ +# Image Overview + +Image development is the process of parsing, processing, and constructing image pixel data to achieve the required image effect. Image development mainly involves image decoding, processing, and encoding. + +Before image development, be familiar with the following basic concepts: + +- Image decoding + + The operation of decoding an archived image in a supported format into a pixel map for image display or processing. Currently, the following image formats are supported: JPEG, PNG, GIF, RAW, WebP, BMP, and SVG. + +- Pixel map + + A bitmap that is not compressed after being decoded. It is used for image display or processing. + +- Image processing + + A series of operations on the pixel map, such as rotation, scaling, opacity setting, image information obtaining, and pixel data reading and writing. + +- Image encoding + + The operation of encoding a pixel map into an archived image in different formats (only in JPEG and WebP currently) for subsequent processing, such as storage and transmission. + +The figure below illustrates the image development process. + +**Figure 1** Image development process +![Image development process](figures/image-development-process.png) + +1. Image retrieval: Obtain a raw image through the application sandbox. + +2. Instance creation: Create an **ImageSource** instance, which is the source class of decoded images and is used to obtain or modify image information. + +3. [Image decoding](image-decoding.md): Decode the image source to generate a pixel map. + +4. [Image processing](image-transformation.md): Process the pixel map by modifying the image attributes to implement image rotation, scaling, and cropping, and then use the [Image component](../ui/arkts-graphics-display.md) to display the image. + +5. [Image encoding](image-encoding.md): Use the **ImagePacker** class to compress and encode the pixel map or image source to generate a new image. + +In addition to the preceding basic image development capabilities, OpenHarmony provides the [image tool](image-tool.md) to ease your development. + + \ No newline at end of file diff --git a/en/application-dev/media/image-pixelmap-operation.md b/en/application-dev/media/image-pixelmap-operation.md new file mode 100644 index 0000000000000000000000000000000000000000..d9b17b2c4dc5e5911e921d19a46d1b3066af5100 --- /dev/null +++ b/en/application-dev/media/image-pixelmap-operation.md @@ -0,0 +1,60 @@ +# Pixel Map Operation + +To process a certain area in an image, you can perform pixel map operations, which are usually used to beautify the image. + +As shown in the figure below, the pixel data of a rectangle in an image is read, modified, and then written back to the corresponding area of the original image. + +**Figure 1** Pixel map operation +![Pixel map operation](figures/bitmap-operation.png) + +## How to Develop + +Read [Image](../reference/apis/js-apis-image.md#pixelmap7) for APIs related to pixel map operations. + +1. Complete [image decoding](image-decoding.md#how-to-develop) and obtain a **PixelMap** object. + +2. Obtain information from the **PixelMap** object. + + ```ts + // Obtain the total number of bytes of this pixel map. + let pixelBytesNumber = pixelMap.getPixelBytesNumber(); + // Obtain the number of bytes per row of this pixel map. + let rowCount = pixelMap.getBytesNumberPerRow(); + // Obtain the pixel density of the image. Pixel density refers to the number of pixels per inch of an image. A larger value of the pixel density indicates a finer image. + let getDensity = pixelMap.getDensity(); + ``` + +3. Read and modify the pixel data of the target area, and write the modified data back to the original image. + + ```ts + // Scenario 1: Read the pixel data of the entire image and write the modified data to an array buffer. + const readBuffer = new ArrayBuffer(pixelBytesNumber); + pixelMap.readPixelsToBuffer(readBuffer).then(() => { + console.info('Succeeded in reading image pixel data.'); + }).catch(error => { + console.error('Failed to read image pixel data. And the error is: ' + error); + }) + + // Scenario 2: Read the pixel data in a specified area and write the modified data to area.pixels. + const area = { + pixels: new ArrayBuffer(8), + offset: 0, + stride: 8, + region: { size: { height: 1, width: 2 }, x: 0, y: 0 } + } + pixelMap.readPixels(area).then(() => { + console.info('Succeeded in reading the image data in the area.'); + }).catch(error => { + console.error('Failed to read the image data in the area. And the error is: ' + error); + }) + + // The read image data can be used independently (by creating a pixel map) or modified as required. + // Write area.pixels to the specified area. + pixelMap.writePixels(area).then(() => { + console.info('Succeeded to write pixelMap into the specified area.'); + }) + + // Write the image data result to a pixel map. + const writeColor = new ArrayBuffer(96); + pixelMap.writeBufferToPixels(writeColor, () => {}); + ``` diff --git a/en/application-dev/media/image-tool.md b/en/application-dev/media/image-tool.md new file mode 100644 index 0000000000000000000000000000000000000000..16748ff0b56557005793cdbe2798477995412cdf --- /dev/null +++ b/en/application-dev/media/image-tool.md @@ -0,0 +1,43 @@ +# Image Tool + +The image tool provides the capabilities of reading and editing Exchangeable Image File Format (EXIF) data of an image. + +EXIF is a file format dedicated for photos taken by digital cameras and is used to record attributes and shooting data of the photos. Currently, the image tool supports images in JPEG format only. + +Users may need to view or modify the EXIF data of photos in the Gallery application, for example, when the manual lens parameters of the camera are not automatically written as part of the EXIF data or the shooting time is incorrect due to camera power-off. + +Currently, OpenHarmony allows you to view and modify part of EXIF data. For details, see [EIXF](../reference/apis/js-apis-image.md#propertykey7). + +## How to Develop + +Read [Image](../reference/apis/js-apis-image.md#getimageproperty7) for APIs used to read and edit EXIF data. + +1. Obtain the image and create an **ImageSource** object. + + ```ts + // Import the required module. + import image from '@ohos.multimedia.image'; + + // Obtain the sandbox path and create an ImageSource object. + const fd =...; //Obtain the file descriptor of the image to be processed. + const imageSource = image.createImageSource(fd); + ``` + +2. Read and edit EXIF data. + + ```ts + // Read the EXIF data, where BitsPerSample indicates the number of bits per pixel. + imageSource.getImageProperty('BitsPerSample', (error, data) => { + if (error) { + console.error('Failed to get the value of the specified attribute key of the image.And the error is: ' + error); + } else { + console.info('Succeeded in getting the value of the specified attribute key of the image ' + data); + } + }) + + // Edit the EXIF data. + imageSource.modifyImageProperty('ImageWidth', '120').then(() => { + const width = imageSource.getImageProperty("ImageWidth"); + console.info('The new imageWidth is ' + width); + }) + ``` diff --git a/en/application-dev/media/image-transformation.md b/en/application-dev/media/image-transformation.md new file mode 100644 index 0000000000000000000000000000000000000000..8965d409dda0fa9271feebb34b3b936c4b624bc6 --- /dev/null +++ b/en/application-dev/media/image-transformation.md @@ -0,0 +1,93 @@ +# Image Transformation + +Image processing refers to a series of operations performed on the pixel map, such as obtaining image information, cropping, scaling, translating, rotating, flipping, setting opacity, and reading and writing pixel data. These operations can be classified into image transformation and [pixel map operation](image-pixelmap-operation.md). This topic describes the image transformation operations that you can perform. + +## How to Develop + +Read [Image](../reference/apis/js-apis-image.md#pixelmap7) for APIs related to image transformation. + +1. Complete [image decoding](image-decoding.md#how-to-develop) and obtain a **PixelMap** object. + +2. Obtain image information. + + ``` + // Obtain the image size. + pixelMap.getImageInfo().then( info => { + console.info('info.width = ' + info.size.width); + console.info('info.height = ' + info.size.height); + }).catch((err) => { + console.error("Failed to obtain the image pixel map information.And the error is: " + err); + }); + ``` + +3. Perform image transformation. + + Original image: + + ![Original drawing](figures/original-drawing.jpeg) + - Crop the image. + + ``` + // x: x-axis coordinate of the start point for cropping (0). + // y: y-axis coordinate of the start point for cropping (0). + // height: height after cropping (400), cropping from top to bottom. + // width: width after cropping (400), cropping from left to right. + pixelMap.crop({x: 0, y: 0, size: { height: 400, width: 400 } }); + ``` + + ![cropping](figures/cropping.jpeg) + + - Scale the image. + + ``` + // The width of the image after scaling is 0.5 of the original width. + // The height of the image after scaling is 0.5 of the original height. + pixelMap.scale(0.5, 0.5); + ``` + + ![zoom](figures/zoom.jpeg) + + - Translate the image. + + ``` + // Translate the image by 100 units downwards. + // Translate the image by 100 units to the right. + pixelMap.translate(100, 100); + ``` + + ![offsets](figures/offsets.jpeg) + + - Rotate the image. + + ``` + // Rate the image clockwise by 90°. + pixelMap.rotate(90); + ``` + + ![rotate](figures/rotate.jpeg) + + - Flip the image. + + ``` + // Flip the image vertically. + pixelMap.flip(false, true); + ``` + + ![Vertical Flip](figures/vertical-flip.jpeg) + + + ``` + // Flip the image horizontally. + pixelMap.flip(true, false); + ``` + + ![Horizontal Flip](figures/horizontal-flip.jpeg) + + - Set the opacity of the image. + + ``` + // Set the opacity to 0.5. + pixelMap.opacity(0.5); + ``` + + ![Transparency](figures/transparency.png) diff --git a/en/application-dev/media/image.md b/en/application-dev/media/image.md deleted file mode 100644 index fb4e648b56839ef76cb0e5277443605734d7ab6f..0000000000000000000000000000000000000000 --- a/en/application-dev/media/image.md +++ /dev/null @@ -1,283 +0,0 @@ -# Image Development - -## When to Use - -You can use image development APIs to decode images into pixel maps and encode the pixel maps into a supported format. - -## Available APIs - -For details about the APIs, see [Image Processing](../reference/apis/js-apis-image.md). - -## How to Develop - -### Full-Process Scenario - -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. -let opts = { alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: { height: 2, width: 3 } } // Image pixel data. - -// Create a PixelMap object. -image.createPixelMap(color, opts, (err, pixelmap) => { - console.log('Succeeded in creating pixelmap.'); - // Failed to create the PixelMap object. - if (err) { - console.info('create pixelmap failed, err' + err); - return - } - - // Read pixels. - const area = { - pixels: new ArrayBuffer(8), - offset: 0, - stride: 8, - region: { size: { height: 1, width: 2 }, x: 0, y: 0 } - } - pixelmap.readPixels(area,() => { - let bufferArr = new Uint8Array(area.pixels); - let res = true; - for (let i = 0; i < bufferArr.length; i++) { - console.info(' buffer ' + bufferArr[i]); - if(res) { - if(bufferArr[i] == 0) { - res = false; - console.log('readPixels end.'); - break; - } - } - } - }) - - // Store pixels. - const readBuffer = new ArrayBuffer(96); - pixelmap.readPixelsToBuffer(readBuffer,() => { - let bufferArr = new Uint8Array(readBuffer); - let res = true; - for (let i = 0; i < bufferArr.length; i++) { - if(res) { - if (bufferArr[i] !== 0) { - res = false; - console.log('readPixelsToBuffer end.'); - 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,() => { - let readArr = new Uint8Array(readArea.pixels); - let res = true; - for (let i = 0; i < readArr.length; i++) { - if(res) { - if (readArr[i] !== 0) { - res = false; - console.log('readPixels end.please check buffer'); - break; - } - } - } - }) - }) - - const writeColor = new ArrayBuffer(96); // Pixel data of the image. - // Write pixels to the buffer. - pixelmap.writeBufferToPixels(writeColor).then(() => { - const readBuffer = new ArrayBuffer(96); - pixelmap.readPixelsToBuffer(readBuffer).then (() => { - let bufferArr = new Uint8Array(readBuffer); - let res = true; - for (let i = 0; i < bufferArr.length; i++) { - if(res) { - if (bufferArr[i] !== i) { - res = false; - console.log('readPixels end.please check buffer'); - break; - } - } - } - }) - }) - - // Obtain image information. - pixelmap.getImageInfo((err, imageInfo) => { - // Failed to obtain the image information. - if (err || imageInfo == null) { - console.info('getImageInfo failed, err' + err); - return - } - if (imageInfo !== null) { - console.log('Succeeded in getting imageInfo'); - } - }) - - // Release the PixelMap object. - pixelmap.release(()=>{ - console.log('Succeeded in releasing pixelmap'); - }) -}) - -// Create an image source (uri). -let path = '/data/local/tmp/test.jpg'; -const imageSourceApi1 = image.createImageSource(path); - -// Create an image source (fd). -let fd = 29; -const imageSourceApi2 = image.createImageSource(fd); - -// Create an image source (data). -const data = new ArrayBuffer(96); -const imageSourceApi3 = image.createImageSource(data); - -// Release the image source. -imageSourceApi3.release(() => { - console.log('Succeeded in releasing imagesource'); -}) - -// Encode the image. -const imagePackerApi = image.createImagePacker(); -const imageSourceApi = image.createImageSource(0); -let packOpts = { format:"image/jpeg", quality:98 }; -imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { - if (err) { - console.info('packing from imagePackerApi failed, err' + err); - return - } - console.log('Succeeded in packing'); -}) - -// Release the ImagePacker object. -imagePackerApi.release(); -``` - -### Decoding Scenario - -```js -let path = '/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' - -// Set parameters. -let decodingOptions = { - sampleSize:1, // Sampling size of the thumbnail. - editable: true, // Whether the image can be edited. - desiredSize:{ width:1, height:2}, // Desired output size of the image. - rotateDegrees:10, // Rotation angle of the image. - desiredPixelFormat:2, // Decoded pixel format. - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, // Region of the image to decode. - index:0// Image sequence number. - }; - -// Create a pixel map in callback mode. -imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { - // Failed to create the PixelMap object. - if (err) { - console.info('create pixelmap failed, err' + err); - return - } - console.log('Succeeded in creating pixelmap.'); -}) - -// Create a pixel map in promise mode. -imageSourceApi.createPixelMap().then(pixelmap => { - console.log('Succeeded in creating pixelmap.'); - - // Obtain the number of bytes in each line of pixels. - let num = pixelmap.getBytesNumberPerRow(); - - // Obtain the total number of pixel bytes. - let pixelSize = pixelmap.getPixelBytesNumber(); - - // Obtain the pixel map information. - pixelmap.getImageInfo().then( imageInfo => {}); - - // Release the PixelMap object. - pixelmap.release(()=>{ - console.log('Succeeded in releasing pixelmap'); - }) -}).catch(error => { - console.log('Failed in creating pixelmap.' + error); -}) -``` - -### Encoding Scenario - -```js -let path = '/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' - -// Print the error message if the image source fails to be created. -if (imageSourceApi == null) { - console.log('Failed in creating imageSource.'); -} - -// Create an image packer if the image source is successfully created. -const imagePackerApi = image.createImagePacker(); - -// Print the error information if the image packer fails to be created. -if (imagePackerApi == null) { - console.log('Failed in creating imagePacker.'); -} - -// 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. - -// Encode the image. -imagePackerApi.packing(imageSourceApi, packOpts) -.then( data => { - console.log('Succeeded in packing'); -}) - -// Release the image packer after the encoding is complete. -imagePackerApi.release(); - -// Obtain the image source information. -imageSourceApi.getImageInfo((err, imageInfo) => { - console.log('Succeeded in getting imageInfo'); -}) - -const array = new ArrayBuffer(100); // Incremental data. -// Update incremental data. -imageSourceApi.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. - let receiver = image.createImageReceiver(8 * 1024, 8, image.ImageFormat.JPEG, 1); - - // Obtain the surface ID. - receiver.getReceivingSurfaceId((err, surfaceId) => { - // Failed to obtain the surface ID. - if (err) { - console.info('getReceivingSurfaceId failed, err' + err); - return - } - console.info("receiver getReceivingSurfaceId success"); - }); - // 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/local-avsession-overview.md b/en/application-dev/media/local-avsession-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..2ced0a180e3bed3a1adea4e4b3ff196721bc23a8 --- /dev/null +++ b/en/application-dev/media/local-avsession-overview.md @@ -0,0 +1,63 @@ +# Local AVSession Overview + +## Interaction Process + +For a local AVSession, the data sources are on the local device. The figure below illustrates the interaction process. + +![Local AVSession Interaction Process](figures/local-avsession-interaction-process.png) + +This process involves two roles: provider and controller. + +In the local AVSession, the provider exchanges information with the controller through AVSessionManager. + +1. The provider creates an **AVSession** object through AVSessionManager. + +2. Through the **AVSession** object, the provider sets session metadata (such as the asset ID, title, and duration) and playback attributes (such as the playback state, speed, and position). + +3. The controller creates an **AVSessionController** object through AVSessionManager. + +4. Through the **AVSessionController** object, the controller listens for changes of the session metadata and playback attributes. + +5. Through the **AVSessionController** object, the controller sends control commands to the **AVSession** object. + +6. Through the **AVSession** object, the provider listens for the control commands, for example, play, playNext, fastForward, and setSpeed, from the controller. + +## AVSessionManager + +AVSessionManager provides the capability of managing sessions. It can create an **AVSession** object, create an **AVSessionController** object, send control commands, and listen for session state changes. + +Unlike the **AVSession** and **AVSessionController** objects, AVSessionManager is not a specific object, but the root namespace of AVSessions. You can import AVSessionManager as follows: + +```ts +import AVSessionManager from '@ohos.multimedia.avsession'; +``` + +All the APIs in the root namespace can be used as APIs of AVSessionManager. + +The code snippet below shows how the provider creates an **AVSession** object by using AVSessionManager: + +```ts +// Create an AVSession object. +async createSession() { + let session: AVSessionManager.AVSession = await AVSessionManager.createAVSession(this.context, 'SESSION_NAME', 'audio'); + console.info(`session create done : sessionId : ${session.sessionId}`); +} +``` + +The code snippet below shows how the controller creates an **AVSessionController** object by using AVSessionManager: + +```ts +// Create an AVSessionController object. +async createController() { + // Obtain the descriptors of all live AVSession objects. + let descriptorsArray: Array> = await AVSessionManager.getAllSessionDescriptors(); + if (descriptorsArray.length > 0) { + // For demonstration, the session ID of the first descriptor is used to create the AVSessionController object. + let sessionId: string = descriptorsArray[0].sessionId; + let avSessionController: AVSessionManager.AVSessionController = await AVSessionManager.createController(sessionId); + console.info(`controller create done : sessionId : ${avSessionController.sessionId}`); + } +} +``` + +For more information about AVSessionManager APIs, see [API Reference](../reference/apis/js-apis-avsession.md). diff --git a/en/application-dev/media/media-application-overview.md b/en/application-dev/media/media-application-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..d350482e61e7bc9659054b0426c10ce07da88045 --- /dev/null +++ b/en/application-dev/media/media-application-overview.md @@ -0,0 +1,19 @@ +# Media Application Development Overview + +## Multimedia Subsystem Architecture + +The multimedia subsystem provides the capability of processing users' visual and auditory information. For example, it can be used to collect, compress, store, decompress, and play audio and video information. Based on the type of media information to process, the media system is usually divided into four modules: audio, media, camera, and image. + +As shown in the figure below, the multimedia subsystem provides APIs for developing audio/video, camera, and gallery applications, and provides adaptation and acceleration for different hardware chips. In the middle part, it provides core media functionalities and management mechanisms in the form of services. + +**Figure 1** Overall framework of the multimedia subsystem + +![Multimedia subsystem framework](figures/media-system-framework.png) + +- Audio module: provides interfaces and services for volume management, audio route management, and audio mixing management. + +- Media module: provides interfaces and services for audio and video decompression, playback, compression, and recording. + +- Camera module: provides interfaces and services for accurately controlling camera lenses and collecting visual information. + +- Image module: provides interfaces and services for image encoding, decoding, and processing. diff --git a/en/application-dev/media/mic-management.md b/en/application-dev/media/mic-management.md new file mode 100644 index 0000000000000000000000000000000000000000..952aeef3f3c607d3a2132eb6d1e0ab6bdd4490c9 --- /dev/null +++ b/en/application-dev/media/mic-management.md @@ -0,0 +1,114 @@ +# Microphone Management + +The microphone is used to record audio data. To deliver an optimal recording effect, you are advised to query the microphone state before starting recording and listen for state changes during recording. + +If the user mutes the microphone during audio recording, the recording process is normal, the size of the recorded file increases with the recording duration, but the data volume written into the file is 0. + +## How to Develop + +The **AudioVolumeGroupManager** class provides APIs for managing the microphone state. For details, see [API Reference](../reference/apis/js-apis-audio.md#audiovolumegroupmanager9). + +1. Create an **audioVolumeGroupManager** object. + + ```ts + import audio from '@ohos.multimedia.audio'; + + let audioVolumeGroupManager; + async function loadVolumeGroupManager() { // Create an audioVolumeGroupManager object. + const groupid = audio.DEFAULT_VOLUME_GROUP_ID; + audioVolumeGroupManager = await audio.getAudioManager().getVolumeManager().getVolumeGroupManager(groupid); + console.info('audioVolumeGroupManager create success.'); + } + ``` + +2. Call **on('micStateChange')** to listen for microphone state changes. When the microphone state changes, the application will be notified of the change. + + Currently, when multiple **AudioManager** instances are used in a single process, only the subscription of the last instance takes effect, and the subscription of other instances is overwritten (even if the last instance does not initiate a subscription). Therefore, you are advised to use a single **AudioManager** instance. + + + ```ts + async function on() { // Subscribe to microphone state changes. + audioVolumeGroupManager.on('micStateChange', (micStateChange) => { + console.info(`Current microphone status is: ${micStateChange.mute} `); + }); + } + ``` + +3. Call **isMicrophoneMute** to check whether the microphone is muted. If the returned value is **true**, the microphone is muted; otherwise, the microphone is not muted. + + ```ts + async function isMicrophoneMute() { // Check whether the microphone is muted. + await audioVolumeGroupManager.isMicrophoneMute().then((value) => { + console.info(`isMicrophoneMute is: ${value}.`); + }); + } + ``` + +4. Call **setMicrophoneMute** to mute or unmute the microphone. To mute the microphone, pass in **true**. To unmute the microphone, pass in **false**. + + ```ts + async function setMicrophoneMuteTrue() { // Pass in true to mute the microphone. + await audioVolumeGroupManager.setMicrophoneMute(true).then(() => { + console.info('setMicrophoneMute to mute.'); + }); + } + async function setMicrophoneMuteFalse() { // Pass in false to unmute the microphone. + await audioVolumeGroupManager.setMicrophoneMute(false).then(() => { + console.info('setMicrophoneMute to not mute.'); + }); + } + ``` + +## Sample Code + +Refer to the sample code below to complete the process of muting and unmuting the microphone. + +```ts +import audio from '@ohos.multimedia.audio'; + +@Entry +@Component +struct AudioVolumeGroup { + private audioVolumeGroupManager: audio.AudioVolumeGroupManager; + + async loadVolumeGroupManager() { + const groupid = audio.DEFAULT_VOLUME_GROUP_ID; + this.audioVolumeGroupManager = await audio.getAudioManager().getVolumeManager().getVolumeGroupManager(groupid); + console.info('audioVolumeGroupManager------create-------success.'); + } + + async on() { // Subscribe to microphone state changes. + await this.loadVolumeGroupManager(); + this.audioVolumeGroupManager.on('micStateChange', (micStateChange) => { + console.info(`Current microphone status is: ${micStateChange.mute} `); + }); + } + async isMicrophoneMute() { // Check whether the microphone is muted. + await this.audioVolumeGroupManager.isMicrophoneMute().then((value) => { + console.info(`isMicrophoneMute is: ${value}.`); + }); + } + async setMicrophoneMuteTrue() { // Mute the microphone. + await this.loadVolumeGroupManager(); + await this.audioVolumeGroupManager.setMicrophoneMute(true).then(() => { + console.info('setMicrophoneMute to mute.'); + }); + } + async setMicrophoneMuteFalse() { // Unmute the microphone. + await this.loadVolumeGroupManager(); + await this.audioVolumeGroupManager.setMicrophoneMute(false).then(() => { + console.info('setMicrophoneMute to not mute.'); + }); + } + async test(){ + await this.on(); + await this.isMicrophoneMute(); + await this.setMicrophoneMuteTrue(); + await this.isMicrophoneMute(); + await this.setMicrophoneMuteFalse(); + await this.isMicrophoneMute(); + await this.setMicrophoneMuteTrue(); + await this.isMicrophoneMute(); + } +} +``` diff --git a/en/application-dev/media/opensles-capture.md b/en/application-dev/media/opensles-capture.md deleted file mode 100644 index 4e1775e178db20e01f15ee7a9b8f685a5c47b07b..0000000000000000000000000000000000000000 --- a/en/application-dev/media/opensles-capture.md +++ /dev/null @@ -1,151 +0,0 @@ -# OpenSL ES Audio Recording Development - -## Introduction - -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 - -To use OpenSL ES to develop the audio recording function in OpenHarmony, perform the following steps: - -1. Add the header files. - - ```c++ - #include - #include - #include - ``` - -2. Use the **slCreateEngine** API to create and instantiate the **engine** instance. - - ```c++ - SLObjectItf engineObject = nullptr; - slCreateEngine(&engineObject, 0, nullptr, 0, nullptr, nullptr); - (*engineObject)->Realize(engineObject, SL_BOOLEAN_FALSE); - ``` - -3. Obtain the **engineEngine** instance of the **SL_IID_ENGINE** interface. - - ```c++ - SLEngineItf engineItf = nullptr; - 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++ - SLDataLocator_IODevice io_device = { - SL_DATALOCATOR_IODEVICE, - SL_IODEVICE_AUDIOINPUT, - SL_DEFAULTDEVICEID_AUDIOINPUT, - NULL - }; - - SLDataSource audioSource = { - &io_device, - NULL - }; - - SLDataLocator_BufferQueue buffer_queue = { - SL_DATALOCATOR_BUFFERQUEUE, - 3 - }; - - // Configure the parameters based on the audio file format. - SLDataFormat_PCM format_pcm = { - SL_DATAFORMAT_PCM, - OHOS::AudioStandard::AudioChannel::MONO, - OHOS::AudioStandard::AudioSamplingRate::SAMPLE_RATE_44100, - OHOS::AudioStandard::AudioSampleFormat::SAMPLE_S16LE, - 0, - 0, - 0 - }; - - SLDataSink audioSink = { - &buffer_queue, - &format_pcm - }; - - SLObjectItf pcmCapturerObject = nullptr; - result = (*engineItf)->CreateAudioRecorder(engineItf, &pcmCapturerObject, - &audioSource, &audioSink, 0, nullptr, nullptr); - (*pcmCapturerObject)->Realize(pcmCapturerObject, SL_BOOLEAN_FALSE); - ``` - -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++ - static void BufferQueueCallback(SLOHBufferQueueItf bufferQueueItf, void *pContext, SLuint32 size) - { - AUDIO_INFO_LOG("BufferQueueCallback"); - FILE *wavFile = (FILE *)pContext; - if (wavFile != nullptr) { - SLuint8 *buffer = nullptr; - SLuint32 pSize = 0; - (*bufferQueueItf)->GetBuffer(bufferQueueItf, &buffer, pSize); - if (buffer != nullptr) { - fwrite(buffer, 1, pSize, wavFile); - (*bufferQueueItf)->Enqueue(bufferQueueItf, buffer, size); - } - } - - return; - } - - // Set wavFile_ to the descriptor of the file to be recorded. - (*bufferQueueItf)->RegisterCallback(bufferQueueItf, BufferQueueCallback, wavFile_); - ``` - -8. Start audio recording. - - ```c++ - static void CaptureStart(SLRecordItf recordItf, SLOHBufferQueueItf bufferQueueItf, FILE *wavFile) - { - AUDIO_INFO_LOG("CaptureStart"); - (*recordItf)->SetRecordState(recordItf, SL_RECORDSTATE_RECORDING); - if (wavFile != nullptr) { - SLuint8* buffer = nullptr; - SLuint32 pSize = 0; - (*bufferQueueItf)->GetBuffer(bufferQueueItf, &buffer, pSize); - if (buffer != nullptr) { - AUDIO_INFO_LOG("CaptureStart, enqueue buffer length: %{public}lu.", pSize); - fwrite(buffer, 1, pSize, wavFile); - (*bufferQueueItf)->Enqueue(bufferQueueItf, buffer, pSize); - } else { - AUDIO_INFO_LOG("CaptureStart, buffer is null or pSize: %{public}lu.", pSize); - } - } - - return; - } - ``` - -9. Stop audio recording. - - ```c++ - static void CaptureStop(SLRecordItf recordItf) - { - AUDIO_INFO_LOG("Enter CaptureStop"); - fflush(wavFile_); - (*recordItf)->SetRecordState(recordItf, SL_RECORDSTATE_STOPPED); - (*pcmCapturerObject)->Destroy(pcmCapturerObject); - fclose(wavFile_); - wavFile_ = nullptr; - return; - } - ``` diff --git a/en/application-dev/media/opensles-playback.md b/en/application-dev/media/opensles-playback.md deleted file mode 100644 index fe89bc9553da3163e1e18ca43922ff99e13c1307..0000000000000000000000000000000000000000 --- a/en/application-dev/media/opensles-playback.md +++ /dev/null @@ -1,104 +0,0 @@ -# OpenSL ES Audio Playback Development - -## Introduction - -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: - -1. Add the header files. - - ```c++ - #include - #include - #include - ``` - -2. Use the **slCreateEngine** API to obtain an **engine** instance. - - ```c++ - SLObjectItf engineObject = nullptr; - slCreateEngine(&engineObject, 0, nullptr, 0, nullptr, nullptr); - (*engineObject)->Realize(engineObject, SL_BOOLEAN_FALSE); - ``` - -3. Obtain the **engineEngine** instance of the **SL_IID_ENGINE** interface. - - ```c++ - SLEngineItf engineEngine = nullptr; - (*engineObject)->GetInterface(engineObject, SL_IID_ENGINE, &engineEngine); - ``` - -4. Configure the player and create an **AudioPlayer** instance. - - ```c++ - SLDataLocator_BufferQueue slBufferQueue = { - SL_DATALOCATOR_BUFFERQUEUE, - 0 - }; - - // Configure the parameters based on the audio file format. - SLDataFormat_PCM pcmFormat = { - SL_DATAFORMAT_PCM, - 2, - 48000, - 16, - 0, - 0, - 0 - }; - SLDataSource slSource = {&slBufferQueue, &pcmFormat}; - - SLObjectItf pcmPlayerObject = nullptr; - (*engineEngine)->CreateAudioPlayer(engineEngine, &pcmPlayerObject, &slSource, null, 0, nullptr, nullptr); - (*pcmPlayerObject)->Realize(pcmPlayerObject, SL_BOOLEAN_FALSE); - ``` - -5. Obtain the **bufferQueueItf** instance of the **SL_IID_OH_BUFFERQUEUE** interface. - - ```c++ - SLOHBufferQueueItf bufferQueueItf; - (*pcmPlayerObject)->GetInterface(pcmPlayerObject, SL_IID_OH_BUFFERQUEUE, &bufferQueueItf); - ``` - -6. Open an audio file and register the **BufferQueueCallback** function. - - ```c++ - FILE *wavFile_ = nullptr; - - static void BufferQueueCallback (SLOHBufferQueueItf bufferQueueItf, void *pContext, SLuint32 size) - { - FILE *wavFile = (FILE *)pContext; - if (!feof(wavFile)) { - SLuint8 *buffer = nullptr; - SLuint32 pSize = 0; - (*bufferQueueItf)->GetBuffer(bufferQueueItf, &buffer, pSize); - // Read data from the file. - fread(buffer, 1, size, wavFile); - (*bufferQueueItf)->Enqueue(bufferQueueItf, buffer, size); - } - return; - } - - // Set wavFile_ to the descriptor of the file to be played. - wavFile_ = fopen(path, "rb"); - (*bufferQueueItf)->RegisterCallback(bufferQueueItf, BufferQueueCallback, wavFile_); - ``` - -7. Obtain the **playItf** instance of the **SL_PLAYSTATE_PLAYING** interface and start playback. - - ```c++ - SLPlayItf playItf = nullptr; - (*pcmPlayerObject)->GetInterface(pcmPlayerObject, SL_IID_PLAY, &playItf); - (*playItf)->SetPlayState(playItf, SL_PLAYSTATE_PLAYING); - ``` - -8. Stop audio playback. - - ```c++ - (*playItf)->SetPlayState(playItf, SL_PLAYSTATE_STOPPED); - (*pcmPlayerObject)->Destroy(pcmPlayerObject); - (*engineObject)->Destroy(engineObject); - ``` diff --git a/en/application-dev/media/remote-camera.md b/en/application-dev/media/remote-camera.md deleted file mode 100644 index d7bf710279c1504cd9703eca9af7cf5433cb3dac..0000000000000000000000000000000000000000 --- a/en/application-dev/media/remote-camera.md +++ /dev/null @@ -1,65 +0,0 @@ -# Distributed Camera Development - -## When to Use - -You can call the APIs provided by the **Camera** module to develop a distributed camera that provides the basic camera functions such as shooting and video recording. - -## How to Develop -Connect your calculator to a distributed device. Your calculator will call **getSupportedCameras()** to obtain the camera list and traverse the returned camera list to check **ConnectionType** of the **Camera** objects. If **ConnectionType** of a **Camera** object is **CAMERA_CONNECTION_REMOTE**, your calculator will use this object to create a **cameraInput** object. The subsequent call process is the same as that of the local camera development. For details about the local camera development, see [Camera Development](./camera.md). - -For details about the APIs, see [Camera Management](../reference/apis/js-apis-camera.md). - -### Connecting to a Distributed Camera - -Connect the calculator and the distributed device to the same LAN. - -Open the calculator and click the arrow icon in the upper right corner. A new window is displayed. Enter the verification code as prompted, and the calculator will be connected to the distributed device. - -### Creating an Instance - -```js -import camera from '@ohos.multimedia.camera' -import image from '@ohos.multimedia.image' -import media from '@ohos.multimedia.media' -import featureAbility from '@ohos.ability.featureAbility' - -// Create a CameraManager object. -let cameraManager = camera.getCameraManager(globalThis.Context) -if (!cameraManager) { - console.error("camera.getCameraManager error") - return; -} - -// Register a callback to listen for camera status changes and obtain the updated camera status information. -cameraManager.on('cameraStatus', (cameraStatusInfo) => { - console.log('camera : ' + cameraStatusInfo.camera.cameraId); - console.log('status: ' + cameraStatusInfo.status); -}) - -// Obtain the camera list. -let remoteCamera -let cameraArray = cameraManager.getSupportedCameras(); -if (cameraArray.length <= 0) { - console.error("cameraManager.getSupportedCameras error") - return; -} - -for(let cameraIndex = 0; cameraIndex < cameraArray.length; cameraIndex++) { - console.log('cameraId : ' + cameraArray[cameraIndex].cameraId) // Obtain the camera ID. - console.log('cameraPosition : ' + cameraArray[cameraIndex].cameraPosition) // Obtain the camera position. - console.log('cameraType : ' + cameraArray[cameraIndex].cameraType) // Obtain the camera type. - console.log('connectionType : ' + cameraArray[cameraIndex].connectionType) // Obtain the camera connection type. - if (cameraArray[cameraIndex].connectionType == CAMERA_CONNECTION_REMOTE) { - remoteCamera = cameraArray[cameraIndex] - } -} - -// Create a camera input stream. -let cameraInput -try { - cameraInput = cameraManager.createCameraInput(remoteCamera); -} catch () { - console.error('Failed to createCameraInput errorCode = ' + error.code); -} -``` -For details about the subsequent steps, see [Camera Development](./camera.md). diff --git a/en/application-dev/media/using-audiocapturer-for-recording.md b/en/application-dev/media/using-audiocapturer-for-recording.md new file mode 100644 index 0000000000000000000000000000000000000000..87d13fa3f749cb18ba1c9d61843b750a36a1bcad --- /dev/null +++ b/en/application-dev/media/using-audiocapturer-for-recording.md @@ -0,0 +1,211 @@ +# Using AudioCapturer for Audio Recording + +The AudioCapturer is used to record Pulse Code Modulation (PCM) audio data. It is suitable if you have extensive audio development experience and want to implement more flexible recording features. + +## Development Guidelines + +The full recording process involves creating an **AudioCapturer** instance, configuring audio recording parameters, starting and stopping recording, and releasing the instance. In this topic, you will learn how to use the AudioCapturer to recording audio data. Before the development, you are advised to read [AudioCapturer](../reference/apis/js-apis-audio.md#audiocapturer8) for the API reference. + +The figure below shows the state changes of the AudioCapturer. After an **AudioCapturer** instance is created, different APIs can be called to switch the AudioCapturer to different states and trigger the required behavior. If an API is called when the AudioCapturer is not in the given state, the system may throw an exception or generate other undefined behavior. Therefore, you are advised to check the AudioCapturer state before triggering state transition. + +**Figure 1** AudioCapturer state transition +![AudioCapturer state change](figures/audiocapturer-status-change.png) + +You can call **on('stateChange')** to listen for state changes. For details about each state, see [AudioState](../reference/apis/js-apis-audio.md#audiostate8). + +### How to Develop + +1. Set audio recording parameters and create an **AudioCapturer** instance. For details about the parameters, see [AudioCapturerOptions](../reference/apis/js-apis-audio.md#audiocaptureroptions8). + + ```ts + import audio from '@ohos.multimedia.audio'; + + let audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + }; + + let audioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + }; + + let audioCapturerOptions = { + streamInfo: audioStreamInfo, + capturerInfo: audioCapturerInfo + }; + + audio.createAudioCapturer(audioCapturerOptions, (err, data) => { + if (err) { + console.error(`Invoke createAudioCapturer failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info('Invoke createAudioCapturer succeeded.'); + let audioCapturer = data; + } + }); + ``` + +2. Call **start()** to switch the AudioCapturer to the **running** state and start recording. + + ```ts + audioCapturer.start((err) => { + if (err) { + console.error(`Capturer start failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info('Capturer start success.'); + } + }); + ``` + +3. Specify the recording file path and call **read()** to read the data in the buffer. + + ```ts + let file = fs.openSync(path, 0o2 | 0o100); + let bufferSize = await audioCapturer.getBufferSize(); + let buffer = await audioCapturer.read(bufferSize, true); + fs.writeSync(file.fd, buffer); + ``` + +4. Call **stop()** to stop recording. + + ```ts + audioCapturer.stop((err) => { + if (err) { + console.error(`Capturer stop failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info('Capturer stopped.'); + } + }); + ``` + +5. Call **release()** to release the instance. + + ```ts + audioCapturer.release((err) => { + if (err) { + console.error(`capturer release failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info('capturer released.'); + } + }); + ``` + + +### Sample Code + +Refer to the sample code below to record audio using AudioCapturer. + +```ts +import audio from '@ohos.multimedia.audio'; +import fs from '@ohos.file.fs'; + +const TAG = 'AudioCapturerDemo'; + +export default class AudioCapturerDemo { + private audioCapturer = undefined; + private audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + private audioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, // Audio source type. + capturerFlags: 0 // Flag indicating an AudioCapturer. + } + private audioCapturerOptions = { + streamInfo: this.audioStreamInfo, + capturerInfo: this.audioCapturerInfo + } + + // Create an AudioCapturer instance, and set the events to listen for. + init() { + audio.createAudioCapturer(this.audioCapturerOptions, (err, capturer) => { // Create an AudioCapturer instance. + if (err) { + console.error(`Invoke createAudioCapturer failed, code is ${err.code}, message is ${err.message}`); + return; + } + + console.info(`${TAG}: create AudioCapturer success`); + this.audioCapturer = capturer; + this.audioCapturer.on('markReach', 1000, (position) => { // Subscribe to the markReach event. A callback is triggered when the number of captured frames reaches 1000. + if (position === 1000) { + console.info('ON Triggered successfully'); + } + }); + this.audioCapturer.on('periodReach', 2000, (position) => { // Subscribe to the periodReach event. A callback is triggered when the number of captured frames reaches 2000. + if (position === 2000) { + console.info('ON Triggered successfully'); + } + }); + + }); + } + + // Start audio recording. + async start() { + let stateGroup = [audio.AudioState.STATE_PREPARED, audio.AudioState.STATE_PAUSED, audio.AudioState.STATE_STOPPED]; + if (stateGroup.indexOf(this.audioCapturer.state) === -1) { // Recording can be started only when the AudioCapturer is in the STATE_PREPARED, STATE_PAUSED, or STATE_STOPPED state. + console.error(`${TAG}: start failed`); + return; + } + await this.audioCapturer.start(); // Start recording. + + let context = getContext(this); + const path = context.filesDir + '/test.wav'; // Path for storing the recorded audio file. + + let file = fs.openSync(path, 0o2 | 0o100); // Create the file if it does not exist. + let fd = file.fd; + let numBuffersToCapture = 150; // Write data for 150 times. + let count = 0; + while (numBuffersToCapture) { + let bufferSize = await this.audioCapturer.getBufferSize(); + let buffer = await this.audioCapturer.read(bufferSize, true); + let options = { + offset: count * bufferSize, + length: bufferSize + }; + if (buffer === undefined) { + console.error(`${TAG}: read buffer failed`); + } else { + let number = fs.writeSync(fd, buffer, options); + console.info(`${TAG}: write date: ${number}`); + } + numBuffersToCapture--; + count++; + } + } + + // Stop recording. + async stop() { + // The AudioCapturer can be stopped only when it is in the STATE_RUNNING or STATE_PAUSED state. + if (this.audioCapturer.state !== audio.AudioState.STATE_RUNNING && this.audioCapturer.state !== audio.AudioState.STATE_PAUSED) { + console.info('Capturer is not running or paused'); + return; + } + await this.audioCapturer.stop(); // Stop recording. + if (this.audioCapturer.state === audio.AudioState.STATE_STOPPED) { + console.info('Capturer stopped'); + } else { + console.error('Capturer stop failed'); + } + } + + // Release the instance. + async release() { + // The AudioCapturer can be released only when it is not in the STATE_RELEASED or STATE_NEW state. + if (this.audioCapturer.state === audio.AudioState.STATE_RELEASED || this.audioCapturer.state === audio.AudioState.STATE_NEW) { + console.info('Capturer already released'); + return; + } + await this.audioCapturer.release(); // Release the instance. + if (this.audioCapturer.state == audio.AudioState.STATE_RELEASED) { + console.info('Capturer released'); + } else { + console.error('Capturer release failed'); + } + } +} +``` diff --git a/en/application-dev/media/using-audiorenderer-for-playback.md b/en/application-dev/media/using-audiorenderer-for-playback.md new file mode 100644 index 0000000000000000000000000000000000000000..11934e669813fa7a89ceef43bd2c3795db6bad75 --- /dev/null +++ b/en/application-dev/media/using-audiorenderer-for-playback.md @@ -0,0 +1,268 @@ +# Using AudioRenderer for Audio Playback + +The AudioRenderer is used to play Pulse Code Modulation (PCM) audio data. Unlike the AVPlayer, the AudioRenderer can perform data preprocessing before audio input. Therefore, the AudioRenderer is more suitable if you have extensive audio development experience and want to implement more flexible playback features. + +## Development Guidelines + +The full rendering process involves creating an **AudioRenderer** instance, configuring audio rendering parameters, starting and stopping rendering, and releasing the instance. In this topic, you will learn how to use the AudioRenderer to render audio data. Before the development, you are advised to read [AudioRenderer](../reference/apis/js-apis-audio.md#audiorenderer8) for the API reference. + +The figure below shows the state changes of the AudioRenderer. After an **AudioRenderer** instance is created, different APIs can be called to switch the AudioRenderer to different states and trigger the required behavior. If an API is called when the AudioRenderer is not in the given state, the system may throw an exception or generate other undefined behavior. Therefore, you are advised to check the AudioRenderer state before triggering state transition. + +To prevent the UI thread from being blocked, most **AudioRenderer** calls are asynchronous. Each API provides the callback and promise functions. The following examples use the callback functions. + +**Figure 1** AudioRenderer state transition + +![AudioRenderer state transition](figures/audiorenderer-status-change.png) + +During application development, you are advised to use **on('stateChange')** to subscribe to state changes of the AudioRenderer. This is because some operations can be performed only when the AudioRenderer is in a given state. If the application performs an operation when the AudioRenderer is not in the given state, the system may throw an exception or generate other undefined behavior. + +- **prepared**: The AudioRenderer enters this state by calling **createAudioRenderer()**. + +- **running**: The AudioRenderer enters this state by calling **start()** when it is in the **prepared**, **paused**, or **stopped** state. + +- **paused**: The AudioRenderer enters this state by calling **pause()** when it is in the **running** state. When the audio playback is paused, it can call **start()** to resume the playback. + +- **stopped**: The AudioRenderer enters this state by calling **stop()** when it is in the **paused** or **running** state + +- **released**: The AudioRenderer enters this state by calling **release()** when it is in the **prepared**, **paused**, or **stopped** state. In this state, the AudioRenderer releases all occupied hardware and software resources and will not transit to any other state. + +### How to Develop + +1. Set audio rendering parameters and create an **AudioRenderer** instance. For details about the parameters, see [AudioRendererOptions](../reference/apis/js-apis-audio.md#audiorendereroptions8). + + ```ts + import audio from '@ohos.multimedia.audio'; + + let audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + }; + + let audioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 + }; + + let audioRendererOptions = { + streamInfo: audioStreamInfo, + rendererInfo: audioRendererInfo + }; + + audio.createAudioRenderer(audioRendererOptions, (err, data) => { + if (err) { + console.error(`Invoke createAudioRenderer failed, code is ${err.code}, message is ${err.message}`); + return; + } else { + console.info('Invoke createAudioRenderer succeeded.'); + let audioRenderer = data; + } + }); + ``` + +2. Call **start()** to switch the AudioRenderer to the **running** state and start rendering. + + ```ts + audioRenderer.start((err) => { + if (err) { + console.error(`Renderer start failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info('Renderer start success.'); + } + }); + ``` + +3. Specify the address of the file to render. Open the file and call **write()** to continuously write audio data to the buffer for rendering and playing. To implement personalized playback, process the audio data before writing it. + + ```ts + const bufferSize = await audioRenderer.getBufferSize(); + let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); + let buf = new ArrayBuffer(bufferSize); + let readsize = await fs.read(file.fd, buf); + let writeSize = await new Promise((resolve, reject) => { + audioRenderer.write(buf, (err, writeSize) => { + if (err) { + reject(err); + } else { + resolve(writeSize); + } + }); + }); + ``` + +4. Call **stop()** to stop rendering. + + ```ts + audioRenderer.stop((err) => { + if (err) { + console.error(`Renderer stop failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info('Renderer stopped.'); + } + }); + ``` + +5. Call **release()** to release the instance. + + ```ts + audioRenderer.release((err) => { + if (err) { + console.error(`Renderer release failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info('Renderer released.'); + } + }); + ``` + +### Sample Code + +Refer to the sample code below to render an audio file using AudioRenderer. + +```ts +import audio from '@ohos.multimedia.audio'; +import fs from '@ohos.file.fs'; + +const TAG = 'AudioRendererDemo'; + +export default class AudioRendererDemo { + private renderModel = undefined; + private audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, // Sampling rate. + channels: audio.AudioChannel.CHANNEL_2, // Channel. + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, // Sampling format. + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW // Encoding format. + } + private audioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, // Media type. + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, // Audio stream usage type. + rendererFlags: 0 // AudioRenderer flag. + } + private audioRendererOptions = { + streamInfo: this.audioStreamInfo, + rendererInfo: this.audioRendererInfo + } + + // Create an AudioRenderer instance, and set the events to listen for. + init() { + audio.createAudioRenderer(this.audioRendererOptions, (err, renderer) => { // Create an AudioRenderer instance. + if (!err) { + console.info(`${TAG}: creating AudioRenderer success`); + this.renderModel = renderer; + this.renderModel.on('stateChange', (state) => { // Set the events to listen for. A callback is invoked when the AudioRenderer is switched to the specified state. + if (state == 1) { + console.info('audio renderer state is: STATE_PREPARED'); + } + if (state == 2) { + console.info('audio renderer state is: STATE_RUNNING'); + } + }); + this.renderModel.on('markReach', 1000, (position) => { // Subscribe to the markReach event. A callback is triggered when the number of rendered frames reaches 1000. + if (position == 1000) { + console.info('ON Triggered successfully'); + } + }); + } else { + console.info(`${TAG}: creating AudioRenderer failed, error: ${err.message}`); + } + }); + } + + // Start audio rendering. + async start() { + let stateGroup = [audio.AudioState.STATE_PREPARED, audio.AudioState.STATE_PAUSED, audio.AudioState.STATE_STOPPED]; + if (stateGroup.indexOf(this.renderModel.state) === -1) { // Rendering can be started only when the AudioRenderer is in the prepared, paused, or stopped state. + console.error(TAG + 'start failed'); + return; + } + await this.renderModel.start(); // Start rendering. + + const bufferSize = await this.renderModel.getBufferSize(); + let context = getContext(this); + let path = context.filesDir; + const filePath = path + '/test.wav'; // Use the sandbox path to obtain the file. The actual file path is /data/storage/el2/base/haps/entry/files/test.wav. + + let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); + let stat = await fs.stat(filePath); + let buf = new ArrayBuffer(bufferSize); + let len = stat.size % bufferSize === 0 ? Math.floor(stat.size / bufferSize) : Math.floor(stat.size / bufferSize + 1); + for (let i = 0; i < len; i++) { + let options = { + offset: i * bufferSize, + length: bufferSize + }; + let readsize = await fs.read(file.fd, buf, options); + + // buf indicates the audio data to be written to the buffer. Before calling AudioRenderer.write(), you can preprocess the audio data for personalized playback. The AudioRenderer reads the audio data written to the buffer for rendering. + + let writeSize = await new Promise((resolve, reject) => { + this.renderModel.write(buf, (err, writeSize) => { + if (err) { + reject(err); + } else { + resolve(writeSize); + } + }); + }); + if (this.renderModel.state === audio.AudioState.STATE_RELEASED) { // The rendering stops if the AudioRenderer is in the released state. + fs.close(file); + await this.renderModel.stop(); + } + if (this.renderModel.state === audio.AudioState.STATE_RUNNING) { + if (i === len - 1) { // The rendering stops if the file finishes reading. + fs.close(file); + await this.renderModel.stop(); + } + } + } + } + + // Pause the rendering. + async pause() { + // Rendering can be paused only when the AudioRenderer is in the running state. + if (this.renderModel.state !== audio.AudioState.STATE_RUNNING) { + console.info('Renderer is not running'); + return; + } + await this.renderModel.pause(); // Pause rendering. + if (this.renderModel.state === audio.AudioState.STATE_PAUSED) { + console.info('Renderer is paused.'); + } else { + console.error('Pausing renderer failed.'); + } + } + + // Stop rendering. + async stop() { + // Rendering can be stopped only when the AudioRenderer is in the running or paused state. + if (this.renderModel.state !== audio.AudioState.STATE_RUNNING && this.renderModel.state !== audio.AudioState.STATE_PAUSED) { + console.info('Renderer is not running or paused.'); + return; + } + await this.renderModel.stop(); // Stop rendering. + if (this.renderModel.state === audio.AudioState.STATE_STOPPED) { + console.info('Renderer stopped.'); + } else { + console.error('Stopping renderer failed.'); + } + } + + // Release the instance. + async release() { + // The AudioRenderer can be released only when it is not in the released state. + if (this.renderModel.state === audio.AudioState.STATE_RELEASED) { + console.info('Renderer already released'); + return; + } + await this.renderModel.release(); // Release the instance. + if (this.renderModel.state === audio.AudioState.STATE_RELEASED) { + console.info('Renderer released'); + } else { + console.error('Renderer release failed.'); + } + } +} +``` + +When audio streams with the same or higher priority need to use the output device, the current audio playback will be interrupted. The application can respond to and handle the interruption event. For details about how to process concurrent audio playback, see [Audio Playback Concurrency Policies](audio-playback-concurrency.md). diff --git a/en/application-dev/media/using-avplayer-for-playback.md b/en/application-dev/media/using-avplayer-for-playback.md new file mode 100644 index 0000000000000000000000000000000000000000..6cb6ab1e67ef0ae8a44e04fa915ad87bcc9ed024 --- /dev/null +++ b/en/application-dev/media/using-avplayer-for-playback.md @@ -0,0 +1,167 @@ +# Using AVPlayer for Audio Playback + +The AVPlayer is used to play raw media assets in an end-to-end manner. In this topic, you will learn how to use the AVPlayer to play a complete piece of music. + +If you want the application to continue playing the music in the background or when the screen is off, you must use the [AVSession](avsession-overview.md) and [continuous task](../task-management/continuous-task-dev-guide.md) to prevent the playback from being forcibly interrupted by the system. + + +The full playback process includes creating an **AVPlayer** instance, setting the media asset to play, setting playback parameters (volume, speed, and focus mode), controlling playback (play, pause, seek, and stop), resetting the playback configuration, and releasing the instance. + + +During application development, you can use the **state** attribute of the AVPlayer to obtain the AVPlayer state or call **on('stateChange')** to listen for state changes. If the application performs an operation when the AVPlayer is not in the given state, the system may throw an exception or generate other undefined behavior. + + +**Figure 1** Playback state transition +![Playback state change](figures/playback-status-change.png) + +For details about the state, see [AVPlayerState](../reference/apis/js-apis-media.md#avplayerstate9). When the AVPlayer is in the **prepared**, **playing**, **paused**, or **completed** state, the playback engine is working and a large amount of RAM is occupied. If your application does not need to use the AVPlayer, call **reset()** or **release()** to release the instance. + +## How to Develop + +Read [AVPlayer](../reference/apis/js-apis-media.md#avplayer9) for the API reference. + +1. Call **createAVPlayer()** to create an **AVPlayer** instance. The AVPlayer is the **idle** state. + +2. Set the events to listen for, which will be used in the full-process scenario. The table below lists the supported events. + | Event Type| Description| + | -------- | -------- | + | stateChange | Mandatory; used to listen for changes of the **state** attribute of the AVPlayer.| + | error | Mandatory; used to listen for AVPlayer errors.| + | durationUpdate | Used to listen for progress bar updates to refresh the media asset duration.| + | timeUpdate | Used to listen for the current position of the progress bar to refresh the current time.| + | seekDone | Used to listen for the completion status of the **seek()** request.
This event is reported when the AVPlayer seeks to the playback position specified in **seek()**.| + | speedDone | Used to listen for the completion status of the **setSpeed()** request.
This event is reported when the AVPlayer plays music at the speed specified in **setSpeed()**.| + | volumeChange | Used to listen for the completion status of the **setVolume()** request.
This event is reported when the AVPlayer plays music at the volume specified in **setVolume()**.| + | bufferingUpdate | Used to listen for network playback buffer information. This event reports the buffer percentage and playback progress.| + | audioInterrupt | Used to listen for audio interruption. This event is used together with the **audioInterruptMode** attribute.
This event is reported when the current audio playback is interrupted by another (for example, when a call is coming), so the application can process the event in time.| + +3. Set the media asset URL. The AVPlayer enters the **initialized** state. + > **NOTE** + > + > The URL in the code snippet below is for reference only. You need to check the media asset validity and set the URL based on service requirements. + > + > - If local files are used for playback, ensure that the files are available and the application sandbox path is used for access. For details about how to obtain the application sandbox path, see [Obtaining the Application Development Path](../application-models/application-context-stage.md#obtaining-the-application-development-path). For details about the application sandbox and how to push files to the application sandbox, see [File Management](../file-management/app-sandbox-directory.md). + > + > - If a network playback path is used, you must request the ohos.permission.INTERNET [permission](../security/accesstoken-guidelines.md). + > + > - You can also use **ResourceManager.getRawFd** to obtain the file descriptor of a file packed in the HAP file. For details, see [ResourceManager API Reference](../reference/apis/js-apis-resource-manager.md#getrawfd9). + > + > - The [playback formats and protocols](avplayer-avrecorder-overview.md#supported-formats-and-protocols) in use must be those supported by the system. + +4. Call **prepare()** to switch the AVPlayer to the **prepared** state. In this state, you can obtain the duration of the media asset to play and set the volume. + +5. Call **play()**, **pause()**, **seek()**, and **stop()** to perform audio playback control as required. + +6. (Optional) Call **reset()** to reset the AVPlayer. The AVPlayer enters the **idle** state again and you can change the media asset URL. + +7. Call **release()** to switch the AVPlayer to the **released** state. Now your application exits the playback. + +## Sample Code + +Refer to the sample code below to play a complete piece of music. + +```ts +import media from '@ohos.multimedia.media'; +import fs from '@ohos.file.fs'; +import common from '@ohos.app.ability.common'; + +export class AVPlayerDemo { + private avPlayer; + private count: number = 0; + + // Set AVPlayer callback functions. + setAVPlayerCallback() { + // Callback function for the seek operation. + this.avPlayer.on('seekDone', (seekDoneTime) => { + console.info(`AVPlayer seek succeeded, seek time is ${seekDoneTime}`); + }) + // Callback function for errors. If an error occurs during the operation on the AVPlayer, reset() is called to reset the AVPlayer. + this.avPlayer.on('error', (err) => { + console.error(`Invoke avPlayer failed, code is ${err.code}, message is ${err.message}`); + this.avPlayer.reset(); // Call reset() to reset the AVPlayer, which enters the idle state. + }) + // Callback function for state changes. + this.avPlayer.on('stateChange', async (state, reason) => { + switch (state) { + case 'idle': // This state is reported upon a successful callback of reset(). + console.info('AVPlayer state idle called.'); + this.avPlayer.release(); // Call release() to release the instance. + break; + case 'initialized': // This state is reported when the AVPlayer sets the playback source. + console.info('AVPlayerstate initialized called.'); + this.avPlayer.prepare().then(() => { + console.info('AVPlayer prepare succeeded.'); + }, (err) => { + console.error(`Invoke prepare failed, code is ${err.code}, message is ${err.message}`); + }); + break; + case 'prepared': // This state is reported upon a successful callback of prepare(). + console.info('AVPlayer state prepared called.'); + this.avPlayer.play(); // Call play() to start playback. + break; + case 'playing': // This state is reported upon a successful callback of play(). + console.info('AVPlayer state playing called.'); + if (this.count !== 0) { + console.info('AVPlayer start to seek.'); + this.avPlayer.seek (this.avPlayer.duration); // Call seek() to seek to the end of the audio clip. + } else { + this.avPlayer.pause(); // Call pause() to pause the playback. + } + this.count++; + break; + case 'paused': // This state is reported upon a successful callback of pause(). + console.info('AVPlayer state paused called.'); + this.avPlayer.play(); // Call play() again to start playback. + break; + case 'completed': // This state is reported upon the completion of the playback. + console.info('AVPlayer state completed called.'); + this.avPlayer.stop(); // Call stop() to stop the playback. + break; + case 'stopped': // This state is reported upon a successful callback of stop(). + console.info('AVPlayer state stopped called.'); + this.avPlayer.reset(); // Call reset() to reset the AVPlayer state. + break; + case 'released': + console.info('AVPlayer state released called.'); + break; + default: + console.info('AVPlayer state unknown called.'); + break; + } + }) + } + + // The following demo shows how to use the file system to open the sandbox address, obtain the media file address, and play the media file using the URL attribute. + async avPlayerUrlDemo() { + // Create an AVPlayer instance. + this.avPlayer = await media.createAVPlayer(); + // Set a callback function for state changes. + this.setAVPlayerCallback(); + let fdPath = 'fd://'; + // Obtain the sandbox address filesDir through UIAbilityContext. The stage model is used as an example. + let context = getContext(this) as common.UIAbilityContext; + let pathDir = context.filesDir; + let path = pathDir + '/01.mp3'; + // Open the corresponding file address to obtain the file descriptor and assign a value to the URL to trigger the reporting of the initialized state. + let file = await fs.open(path); + fdPath = fdPath + '' + file.fd; + this.avPlayer.url = fdPath; + } + + // The following demo shows how to use resourceManager to obtain the media file packed in the HAP file and play the media file by using the fdSrc attribute. + async avPlayerFdSrcDemo() { + // Create an AVPlayer instance. + this.avPlayer = await media.createAVPlayer(); + // Set a callback function for state changes. + this.setAVPlayerCallback(); + // Call getRawFd of the resourceManager member of UIAbilityContext to obtain the media asset URL. + // The return type is {fd,offset,length}, where fd indicates the file descriptor address of the HAP file, offset indicates the media asset offset, and length indicates the duration of the media asset to play. + let context = getContext(this) as common.UIAbilityContext; + let fileDescriptor = await context.resourceManager.getRawFd('01.mp3'); + // Assign a value to fdSrc to trigger the reporting of the initialized state. + this.avPlayer.fdSrc = fileDescriptor; + } +} +``` + + \ No newline at end of file diff --git a/en/application-dev/media/using-avrecorder-for-recording.md b/en/application-dev/media/using-avrecorder-for-recording.md new file mode 100644 index 0000000000000000000000000000000000000000..71ab8557df470671088adfaa0473a6448d935881 --- /dev/null +++ b/en/application-dev/media/using-avrecorder-for-recording.md @@ -0,0 +1,182 @@ +# Using AVRecorder for Audio Recording + +You will learn how to use the AVRecorder to develop audio recording functionalities including starting, pausing, resuming, and stopping recording. + +During application development, you can use the **state** attribute of the AVRecorder to obtain the AVRecorder state or call **on('stateChange')** to listen for state changes. Your code must meet the state machine requirements. For example, **pause()** is called only when the AVRecorder is in the **started** state, and **resume()** is called only when it is in the **paused** state. + +**Figure 1** Recording state transition + +![Recording state change](figures/recording-status-change.png) + +For details about the state, see [AVRecorderState](../reference/apis/js-apis-media.md#avrecorderstate9). + + +## How to Develop + +Read [AVRecorder](../reference/apis/js-apis-media.md#avrecorder9) for the API reference. + +1. Create an **AVRecorder** instance. The AVRecorder is the **idle** state. + + ```ts + import media from '@ohos.multimedia.media'; + + let avRecorder = undefined; + media.createAVRecorder().then((recorder) => { + avRecorder = recorder; + }, (err) => { + console.error(`Invoke createAVRecorder failed, code is ${err.code}, message is ${err.message}`); + }) + ``` + +2. Set the events to listen for. + | Event Type| Description| + | -------- | -------- | + | stateChange | Mandatory; used to listen for changes of the **state** attribute of the AVRecorder.| + | error | Mandatory; used to listen for AVRecorder errors.| + + + ```ts + // Callback function for state changes. + avRecorder.on('stateChange', (state, reason) => { + console.log(`current state is ${state}`); + // You can add the action to be performed after the state is switched. + }) + + // Callback function for errors. + avRecorder.on('error', (err) => { + console.error(`avRecorder failed, code is ${err.code}, message is ${err.message}`); + }) + ``` + +3. Set audio recording parameters and call **prepare()**. The AVRecorder enters the **prepared** state. + > **NOTE** + > + > Pay attention to the following when configuring parameters: + > + > - In pure audio recording scenarios, set only audio-related parameters in **avConfig** of **prepare()**. + > If video-related parameters are configured, an error will be reported in subsequent steps. If video recording is required, follow the instructions provided in [Video Recording Development](video-recording.md). + > + > - The [recording formats](avplayer-avrecorder-overview.md#supported-formats) in use must be those supported by the system. + > + > - The recording output URL (URL in **avConfig** in the sample code) must be in the format of fd://xx (where xx indicates a file descriptor). You must call [ohos.file.fs](../reference/apis/js-apis-file-fs.md) to implement access to the application file. For details, see [Application File Access and Management](../file-management/app-file-access.md). + + + ```ts + let avProfile = { + audioBitrate: 100000, // Audio bit rate. + audioChannels: 2, // Number of audio channels. + audioCodec: media.CodecMimeType.AUDIO_AAC, // Audio encoding format. Currently, only AAC is supported. + audioSampleRate: 48000, // Audio sampling rate. + fileFormat: media.ContainerFormatType.CFT_MPEG_4A, // Encapsulation format. Currently, only M4A is supported. + } + let avConfig = { + audioSourceType: media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC, // Audio input source. In this example, the microphone is used. + profile: avProfile, + url: 'fd://35', // Obtain the file descriptor of the created audio file by referring to the sample code in Application File Access and Management. + } + avRecorder.prepare(avConfig).then(() => { + console.log('Invoke prepare succeeded.'); + }, (err) => { + console.error(`Invoke prepare failed, code is ${err.code}, message is ${err.message}`); + }) + ``` + +4. Call **start()** to start recording. The AVRecorder enters the **started** state. + +5. Call **pause()** to pause recording. The AVRecorder enters the **paused** state. + +6. Call **resume()** to resume recording. The AVRecorder enters the **started** state again. + +7. Call **stop()** to stop recording. The AVRecorder enters the **stopped** state. + +8. Call **reset()** to reset the resources. The AVRecorder enters the **idle** state. In this case, you can reconfigure the recording parameters. + +9. Call **release()** to switch the AVRecorder to the **released** state. Now your application exits the recording. + + +## Sample Code + + Refer to the sample code below to complete the process of starting, pausing, resuming, and stopping recording. + +```ts +import media from '@ohos.multimedia.media'; + +export class AudioRecorderDemo { + private avRecorder; + private avProfile = { + audioBitrate: 100000, // Audio bit rate. + audioChannels: 2, // Number of audio channels. + audioCodec: media.CodecMimeType.AUDIO_AAC, // Audio encoding format. Currently, only AAC is supported. + audioSampleRate: 48000, // Audio sampling rate. + fileFormat: media.ContainerFormatType.CFT_MPEG_4A, // Encapsulation format. Currently, only M4A is supported. + }; + private avConfig = { + audioSourceType: media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC, // Audio input source. In this example, the microphone is used. + profile: this.avProfile, + url: 'fd://35', // Create, read, and write a file by referring to the sample code in Application File Access and Management. + }; + + // Set AVRecorder callback functions. + setAudioRecorderCallback() { + // Callback function for state changes. + this.avRecorder.on('stateChange', (state, reason) => { + console.log(`AudioRecorder current state is ${state}`); + }) + // Callback function for errors. + this.avRecorder.on('error', (err) => { + console.error(`AudioRecorder failed, code is ${err.code}, message is ${err.message}`); + }) + } + + // Process of starting recording. + async startRecordingProcess() { + // 1. Create an AVRecorder instance. + this.avRecorder = await media.createAVRecorder(); + this.setAudioRecorderCallback(); + // 2. Obtain the file descriptor of the recording file and assign it to the URL in avConfig. For details, see FilePicker. + // 3. Set recording parameters to complete the preparations. + await this.avRecorder.prepare(this.avConfig); + // 4. Start recording. + await this.avRecorder.start(); + } + + // Process of pausing recording. + async pauseRecordingProcess() { + if (this.avRecorder.state ==='started') { // pause() can be called only when the AVRecorder is in the started state . + await this.avRecorder.pause(); + } + } + + // Process of resuming recording. + async resumeRecordingProcess() { + if (this.avRecorder.state === 'paused') { // resume() can be called only when the AVRecorder is in the paused state . + await this.avRecorder.resume(); + } + } + + // Process of stopping recording. + async stopRecordingProcess() { + // 1. Stop recording. + if (this.avRecorder.state === 'started' + || this.avRecorder.state ==='paused') { // stop() can be called only when the AVRecorder is in the started or paused state. + await this.avRecorder.stop(); + } + // 2. Reset the AVRecorder. + await this.avRecorder.reset(); + // 3. Release the AVRecorder instance. + await this.avRecorder.release(); + // 4. Close the file descriptor of the recording file. + } + + // Complete sample code for starting, pausing, resuming, and stopping recording. + async audioRecorderDemo() { + await this.startRecordingProcess(); // Start recording. + // You can set the recording duration. For example, you can set the sleep mode to prevent code execution. + await this.pauseRecordingProcess(); // Pause recording. + await this.resumeRecordingProcess(); // Resume recording. + await this.stopRecordingProcess(); // Stop recording. + } +} +``` + + \ No newline at end of file diff --git a/en/application-dev/media/using-avsession-controller.md b/en/application-dev/media/using-avsession-controller.md new file mode 100644 index 0000000000000000000000000000000000000000..5e4b69d8b48f5acad64f120892062e66d67c6b12 --- /dev/null +++ b/en/application-dev/media/using-avsession-controller.md @@ -0,0 +1,244 @@ +# AVSession Controller + +Media Controller preset in OpenHarmony functions as the controller to interact with audio and video applications, for example, obtaining and displaying media information and delivering control commands. + +You can develop a system application (for example, a new playback control center or voice assistant) as the controller to interact with audio and video applications in the system. + +## Basic Concepts + +- AVSessionDescriptor: session information, including the session ID, session type (audio/video), custom session name (**sessionTag**), information about the corresponding application (**elementName**), and whether the session is pined on top (isTopSession). + +- Top session: session with the highest priority in the system, for example, a session that is being played. Generally, the controller must hold an **AVSessionController** object to communicate with a session. However, the controller can directly communicate with the top session, for example, directly sending a control command or key event, without holding an **AVSessionController** object. + +## Available APIs + +The table below lists the key APIs used by the controller. The APIs use either a callback or promise to return the result. The APIs listed below use a callback. They provide the same functions as their counterparts that use a promise. + +For details, see [AVSession Management](../reference/apis/js-apis-avsession.md). + +| API| Description| +| -------- | -------- | +| getAllSessionDescriptors(callback: AsyncCallback<Array<Readonly<AVSessionDescriptor>>>): void | Obtains the descriptors of all AVSessions in the system.| +| createController(sessionId: string, callback: AsyncCallback<AVSessionController>): void | Creates an AVSessionController.| +| getValidCommands(callback: AsyncCallback<Array<AVControlCommandType>>): void | Obtains valid commands supported by the AVSession.
Control commands listened by an audio and video application when it accesses the AVSession are considered as valid commands supported by the AVSession. For details, see [Provider of AVSession](using-avsession-developer.md).| +| getLaunchAbility(callback: AsyncCallback<WantAgent>): void | Obtains the UIAbility that is configured in the AVSession and can be started.
The UIAbility configured here is started when a user operates the UI of the controller, for example, clicking a widget in Media Controller.| +| sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback<void>): void | Sends a key event to an AVSession through the AVSessionController object.| +| sendSystemAVKeyEvent(event: KeyEvent, callback: AsyncCallback<void>): void | Sends a key event to the top session.| +| sendControlCommand(command: AVControlCommand, callback: AsyncCallback<void>): void | Sends a control command to an AVSession through the AVSessionController object.| +| sendSystemControlCommand(command: AVControlCommand, callback: AsyncCallback<void>): void | Sends a control command to the top session.| + +## How to Develop + +To enable a system application to access the AVSession service as a controller, proceed as follows: + +1. Obtain **AVSessionDescriptor** through AVSessionManager and create an **AVSessionController** object. + The controller may obtain all **AVSessionDescriptor**s in the current system, and create an **AVSessionController** object for each session, so as to perform unified playback control on all the audio and video applications. + + ```ts + // Import the AVSessionManager module. + import AVSessionManager from '@ohos.multimedia.avsession'; + + // Define global variables. + let g_controller = new Array(); + let g_centerSupportCmd:Set = new Set(['play', 'pause', 'playNext', 'playPrevious', 'fastForward', 'rewind', 'seek','setSpeed', 'setLoopMode', 'toggleFavorite']); + let g_validCmd:Set; + // Obtain the session descriptors and create an AVSessionController object. + AVSessionManager.getAllSessionDescriptors().then((descriptors) => { + descriptors.forEach((descriptor) => { + AVSessionManager.createController(descriptor.sessionId).then((controller) => { + g_controller.push(controller); + }).catch((err) => { + console.error(`createController : ERROR : ${err.message}`); + }); + }); + }).catch((err) => { + console.error(`getAllSessionDescriptors : ERROR : ${err.message}`); + }); + + ``` + +2. Listen for the session state and service state events. + + The following session state events are available: + + - **sessionCreate**: triggered when a session is created. + - **sessionDestroy**: triggered when a session is destroyed. + - **topSessionChange**: triggered when the top session is changed. + + The service state event **sessionServiceDie** is reported when the AVSession service is abnormal. + + ```ts + // Subscribe to the 'sessionCreate' event and create an AVSessionController object. + AVSessionManager.on('sessionCreate', (session) => { + // After an AVSession is added, you must create an AVSessionController object. + AVSessionManager.createController(session.sessionId).then((controller) => { + g_controller.push(controller); + }).catch((err) => { + console.info(`createController : ERROR : ${err.message}`); + }); + }); + + // Subscribe to the 'sessionDestroy' event to enable the application to get notified when the session dies. + AVSessionManager.on('sessionDestroy', (session) => { + let index = g_controller.findIndex((controller) => { + return controller.sessionId === session.sessionId; + }); + if (index !== 0) { + g_controller[index].destroy(); + g_controller.splice(index, 1); + } + }); + // Subscribe to the 'topSessionChange' event. + AVSessionManager.on('topSessionChange', (session) => { + let index = g_controller.findIndex((controller) => { + return controller.sessionId === session.sessionId; + }); + // Place the session on the top. + if (index !== 0) { + g_controller.sort((a, b) => { + return a.sessionId === session.sessionId ? -1 : 0; + }); + } + }); + // Subscribe to the 'sessionServiceDie' event. + AVSessionManager.on('sessionServiceDie', () => { + // The server is abnormal, and the application clears resources. + console.info("Server exception."); + }) + ``` + +3. Subscribe to media information changes and other session events. + + The following media information change events are available: + + - **metadataChange**: triggered when the session metadata changes. + - **playbackStateChange**: triggered when the playback state changes. + - **activeStateChange**: triggered when the activation state of the session changes. + - **validCommandChange**: triggered when the valid commands supported by the session changes. + - **outputDeviceChange**: triggered when the output device changes. + - **sessionDestroy**: triggered when a session is destroyed. + + The controller can listen for events as required. + + ```ts + // Subscribe to the 'activeStateChange' event. + controller.on('activeStateChange', (isActive) => { + if (isActive) { + console.info("The widget corresponding to the controller is highlighted."); + } else { + console.info("The widget corresponding to the controller is invalid."); + } + }); + // Subscribe to the 'sessionDestroy' event to enable the controller to get notified when the session dies. + controller.on('sessionDestroy', () => { + console.info('on sessionDestroy : SUCCESS '); + controller.destroy().then(() => { + console.info('destroy : SUCCESS '); + }).catch((err) => { + console.info(`destroy : ERROR :${err.message}`); + }); + }); + + // Subscribe to metadata changes. + let metaFilter = ['assetId', 'title', 'description']; + controller.on('metadataChange', metaFilter, (metadata) => { + console.info(`on metadataChange assetId : ${metadata.assetId}`); + }); + // Subscribe to playback state changes. + let playbackFilter = ['state', 'speed', 'loopMode']; + controller.on('playbackStateChange', playbackFilter, (playbackState) => { + console.info(`on playbackStateChange state : ${playbackState.state}`); + }); + // Subscribe to supported command changes. + controller.on('validCommandChange', (cmds) => { + console.info(`validCommandChange : SUCCESS : size : ${cmds.size}`); + console.info(`validCommandChange : SUCCESS : cmds : ${cmds.values()}`); + g_validCmd.clear(); + for (let c of g_centerSupportCmd) { + if (cmds.has(c)) { + g_validCmd.add(c); + } + } + }); + // Subscribe to output device changes. + controller.on('outputDeviceChange', (device) => { + console.info(`on outputDeviceChange device isRemote : ${device.isRemote}`); + }); + ``` + +4. Obtain the media information transferred by the provider for display on the UI, for example, displaying the track being played and the playback state in Media Controller. + + ```ts + async getInfoFromSessionByController() { + // It is assumed that an AVSessionController object corresponding to the session already exists. For details about how to create an AVSessionController object, see the code snippet above. + let controller: AVSessionManager.AVSessionController = ALLREADY_HAVE_A_CONTROLLER; + // Obtain the session ID. + let sessionId: string = controller.sessionId; + console.info(`get sessionId by controller : isActive : ${sessionId}`); + // Obtain the activation state of the session. + let isActive: boolean = await controller.isActive(); + console.info(`get activeState by controller : ${isActive}`); + // Obtain the media information of the session. + let metadata: AVSessionManager.AVMetadata = await controller.getAVMetadata(); + console.info(`get media title by controller : ${metadata.title}`); + console.info(`get media artist by controller : ${metadata.artist}`); + // Obtain the playback information of the session. + let avPlaybackState: AVSessionManager.AVPlaybackState = await controller.getAVPlaybackState(); + console.info(`get playbackState by controller : ${avPlaybackState.state}`); + console.info(`get favoriteState by controller : ${avPlaybackState.isFavorite}`); + } + ``` + +5. Control the playback behavior, for example, sending a command to operate (play/pause/previous/next) the item being played in Media Controller. + + After listening for the control command event, the audio and video application serving as the provider needs to implement the corresponding operation. + + + ```ts + async sendCommandToSessionByController() { + // It is assumed that an AVSessionController object corresponding to the session already exists. For details about how to create an AVSessionController object, see the code snippet above. + let controller: AVSessionManager.AVSessionController = ALLREADY_HAVE_A_CONTROLLER; + // Obtain the commands supported by the session. + let validCommandTypeArray: Array = await controller.getValidCommands(); + console.info(`get validCommandArray by controller : length : ${validCommandTypeArray.length}`); + // Deliver the 'play' command. + // If the 'play' command is valid, deliver it. Normal sessions should provide and implement the playback. + if (validCommandTypeArray.indexOf('play') >= 0) { + let avCommand: AVSessionManager.AVControlCommand = {command:'play'}; + controller.sendControlCommand(avCommand); + } + // Deliver the 'pause' command. + if (validCommandTypeArray.indexOf('pause') >= 0) { + let avCommand: AVSessionManager.AVControlCommand = {command:'pause'}; + controller.sendControlCommand(avCommand); + } + // Deliver the 'playPrevious' command. + if (validCommandTypeArray.indexOf('playPrevious') >= 0) { + let avCommand: AVSessionManager.AVControlCommand = {command:'playPrevious'}; + controller.sendControlCommand(avCommand); + } + // Deliver the 'playNext' command. + if (validCommandTypeArray.indexOf('playNext') >= 0) { + let avCommand: AVSessionManager.AVControlCommand = {command:'playNext'}; + controller.sendControlCommand(avCommand); + } + } + ``` + +6. When the audio and video application exits, cancel the listener and release the resources. + + ```ts + async destroyController() { + // It is assumed that an AVSessionController object corresponding to the session already exists. For details about how to create an AVSessionController object, see the code snippet above. + let controller: AVSessionManager.AVSessionController = ALLREADY_HAVE_A_CONTROLLER; + + // Destroy the AVSessionController object. After being destroyed, it is no longer available. + controller.destroy(function (err) { + if (err) { + console.info(`Destroy controller ERROR : code: ${err.code}, message: ${err.message}`); + } else { + console.info('Destroy controller SUCCESS'); + } + }); + } + ``` diff --git a/en/application-dev/media/using-avsession-developer.md b/en/application-dev/media/using-avsession-developer.md new file mode 100644 index 0000000000000000000000000000000000000000..07bd4bf1297f3afc5352d30e9acd674fe056f815 --- /dev/null +++ b/en/application-dev/media/using-avsession-developer.md @@ -0,0 +1,198 @@ +# AVSession Provider + +An audio and video application needs to access the AVSession service as a provider in order to display media information in the controller (for example, Media Controller) and respond to control commands delivered by the controller. + +## Basic Concepts + +- AVMetadata: media data related attributes, including the IDs of the current media asset (assetId), previous media asset (previousAssetId), and next media asset (nextAssetId), title, author, album, writer, and duration. + +- AVPlaybackState: playback state attributes, including the playback state, position, speed, buffered time, loop mode, and whether the media asset is favorited (**isFavorite**). + +## Available APIs + +The table below lists the key APIs used by the provider. The APIs use either a callback or promise to return the result. The APIs listed below use a callback. They provide the same functions as their counterparts that use a promise. + +For details, see [AVSession Management](../reference/apis/js-apis-avsession.md). + +| API| Description| +| -------- | -------- | +| createAVSession(context: Context, tag: string, type: AVSessionType, callback: AsyncCallback<AVSession>): void | Creates an AVSession.
Only one AVSession can be created for a UIAbility.| +| setAVMetadata(data: AVMetadata, callback: AsyncCallback<void>): void | Sets AVSession metadata.| +| setAVPlaybackState(state: AVPlaybackState, callback: AsyncCallback<void>): void | Sets the AVSession playback state.| +| setLaunchAbility(ability: WantAgent, callback: AsyncCallback<void>): void | Starts a UIAbility.| +| getController(callback: AsyncCallback<AVSessionController>): void | Obtains the controller of the AVSession.| +| activate(callback: AsyncCallback<void>): void | Activates the AVSession.| +| destroy(callback: AsyncCallback<void>): void | Destroys the AVSession.| + +## How to Develop + +To enable an audio and video application to access the AVSession service as a provider, proceed as follows: + +1. Call an API in the **AVSessionManager** class to create and activate an **AVSession** object. + + ```ts + import AVSessionManager from '@ohos.multimedia.avsession'; // Import the AVSessionManager module. + + // Create an AVSession object. + async createSession() { + let session: AVSessionManager.AVSession = await AVSessionManager.createAVSession(this.context, 'SESSION_NAME', 'audio'); + session.activate(); + console.info(`session create done : sessionId : ${session.sessionId}`); + } + ``` + +2. Set AVSession information, which includes: + - AVMetadata + - AVPlaybackState + + The controller will call an API in the **AVSessionController** class to obtain the information and display or process the information. + + ```ts + async setSessionInfo() { + // It is assumed that an AVSession object has been created. For details about how to create an AVSession object, see the node snippet above. + let session: AVSessionManager.AVSession = ALLREADY_CREATE_A_SESSION; + // The player logic that triggers changes in the session metadata and playback state is omitted here. + // Set necessary session metadata. + let metadata: AVSessionManager.AVMetadata = { + assetId: "0", + title: "TITLE", + artist: "ARTIST" + }; + session.setAVMetadata(metadata).then(() => { + console.info('SetAVMetadata successfully'); + }).catch((err) => { + console.info(`SetAVMetadata BusinessError: code: ${err.code}, message: ${err.message}`); + }); + // Set the playback state to paused and set isFavorite to false. + let playbackState: AVSessionManager.AVPlaybackState = { + state:AVSessionManager.PlaybackState.PLAYBACK_STATE_PAUSE, + isFavorite:false + }; + session.setAVPlaybackState(playbackState, function (err) { + if (err) { + console.info(`SetAVPlaybackState BusinessError: code: ${err.code}, message: ${err.message}`); + } else { + console.info('SetAVPlaybackState successfully'); + } + }); + } + ``` + +3. Set the UIAbility to be started by the controller. The UIAbility configured here is started when a user operates the UI of the controller, for example, clicking a widget in Media Controller. + The UIAbility is set through the **WantAgent** API. For details, see [WantAgent](../reference/apis/js-apis-app-ability-wantAgent.md). + + ```ts + import WantAgent from "@ohos.app.ability.wantAgent"; + ``` + + ```ts + // It is assumed that an AVSession object has been created. For details about how to create an AVSession object, see the node snippet above. + let session: AVSessionManager.AVSession = ALLREADY_CREATE_A_SESSION; + let wantAgentInfo: { + wants: [ + { + bundleName: "com.example.musicdemo", + abilityName: "com.example.musicdemo.MainAbility" + } + ], + operationType: WantAgent.OperationType.START_ABILITIES, + requestCode: 0, + wantAgentFlags: [WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] + } + WantAgent.getWantAgent(wantAgentInfo).then((agent) => { + session.setLaunchAbility(agent) + }) + ``` + +4. Listen for control commands delivered by the controller, for example, Media Controller. + > **NOTE** + > + > After the provider registers a listener for the control command event, the event will be reflected in **getValidCommands()** of the controller. In other words, the controller determines that the command is valid and triggers the corresponding event as required. To ensure that the control commands delivered by the controller can be executed normally, the provider should not use a null implementation for listening. + + ```ts + async setListenerForMesFromController() { + // It is assumed that an AVSession object has been created. For details about how to create an AVSession object, see the node snippet above. + let session: AVSessionManager.AVSession = ALLREADY_CREATE_A_SESSION; + // Generally, logic processing on the player is implemented in the listener. + // After the processing is complete, use the setter to synchronize the playback information. For details, see the code snippet above. + session.on('play', () => { + console.info('on play , do play task'); + + // do some tasks ··· + }); + session.on('pause', () => { + console.info('on pause , do pause task'); + // do some tasks ··· + }); + session.on('stop', () => { + console.info('on stop , do stop task'); + // do some tasks ··· + }); + session.on('playNext', () => { + console.info('on playNext , do playNext task'); + // do some tasks ··· + }); + session.on('playPrevious', () => { + console.info('on playPrevious , do playPrevious task'); + // do some tasks ··· + }); + } + ``` + +5. Obtain an **AVSessionController** object for this **AVSession** object for interaction. + + ```ts + async createControllerFromSession() { + // It is assumed that an AVSession object has been created. For details about how to create an AVSession object, see the node snippet above. + let session: AVSessionManager.AVSession = ALLREADY_CREATE_A_SESSION; + + // Obtain an AVSessionController object for this AVSession object. + let controller: AVSessionManager.AVSessionController = await session.getController(); + + // The AVSessionController object can interact with the AVSession object, for example, by delivering a control command. + let avCommand: AVSessionManager.AVControlCommand = {command:'play'}; + controller.sendControlCommand(avCommand); + + // Alternatively, listen for state changes. + controller.on('playbackStateChange', 'all', (state: AVSessionManager.AVPlaybackState) => { + + // do some things + }); + + // The AVSessionController object can perform many operations. For details, see the description of the controller. + } + ``` + +6. When the audio and video application exits and does not need to continue playback, cancel the listener and destroy the **AVSession** object. + The code snippet below is used for canceling the listener for control commands: + + ```ts + async unregisterSessionListener() { + // It is assumed that an AVSession object has been created. For details about how to create an AVSession object, see the node snippet above. + let session: AVSessionManager.AVSession = ALLREADY_CREATE_A_SESSION; + + // Cancel the listener of the AVSession object. + session.off('play'); + session.off('pause'); + session.off('stop'); + session.off('playNext'); + session.off('playPrevious'); + } + ``` + + The code snippet below is used for destroying the AVSession object: + + ```ts + async destroySession() { + // It is assumed that an AVSession object has been created. For details about how to create an AVSession object, see the node snippet above. + let session: AVSessionManager.AVSession = ALLREADY_CREATE_A_SESSION; + // Destroy the AVSession object. + session.destroy(function (err) { + if (err) { + console.info(`Destroy BusinessError: code: ${err.code}, message: ${err.message}`); + } else { + console.info('Destroy : SUCCESS '); + } + }); + } + ``` diff --git a/en/application-dev/media/using-distributed-avsession.md b/en/application-dev/media/using-distributed-avsession.md new file mode 100644 index 0000000000000000000000000000000000000000..c1835d661fdd2b57b7dce0f2507dbea748eaea7e --- /dev/null +++ b/en/application-dev/media/using-distributed-avsession.md @@ -0,0 +1,55 @@ +# Using Distributed AVSession + +## Basic Concepts + +- Remote AVSession: an AVSession automatically created on the remote device by the AVSession service for synchronization with an AVSession on the local device. + +- Remote AVSessionController: AVSessionController automatically created on the remote device after projection. + +## Available APIs + +The table below describes the key APIs used for remote projection with the distributed AVSession. The APIs use either a callback or promise to return the result. The APIs listed below use a callback. They provide the same functions as their counterparts that use a promise. + +For details, see [AVSession Management](../reference/apis/js-apis-avsession.md). + +| API| Description| +| -------- | -------- | +| castAudio(session: SessionToken \| 'all', audioDevices: Array<audio.AudioDeviceDescriptor>, callback: AsyncCallback<void>): void | Casts a session to a list of devices.| + +## How to Develop + +To enable a system application that accesses the AVSession service as the controller to use the distributed AVSession for projection, proceed as follows: + +1. Import the modules. Before projection, you must obtain the AudioDeviceDescriptor from the audio module. Therefore, import the audio module and AVSessionManager module. + + ```ts + import AVSessionManager from '@ohos.multimedia.avsession'; + import audio from '@ohos.multimedia.audio'; + ``` + +2. Use **castAudio** in the **AVSessionManager** class to project all sessions of the local device to another device. + + ```ts + // Cast the sessions to another device. + let audioManager = audio.getAudioManager(); + let audioRoutingManager = audioManager.getRoutingManager(); + let audioDevices; + await audioRoutingManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data) => { + audioDevices = data; + console.info('Promise returned to indicate that the device list is obtained.'); + }).catch((err) => { + console.info(`getDevices : ERROR : ${err.message}`); + }); + + AVSessionManager.castAudio('all', audioDevices).then(() => { + console.info('createController : SUCCESS'); + }).catch((err) => { + console.info(`createController : ERROR : ${err.message}`); + }); + ``` + + After the system application on the local service initiates projection to a remote device, the AVSession framework instructs the AVSession service of the remote device to create a remote AVSession. When the AVSession on the local device changes (for example, the media information or playback state changes), the AVSession framework automatically synchronizes the change to the remote device. + + The AVSession processing mechanism on the remote device is consistent with that on the local device. That is, the controller (for example, the Media Controller) on the remote device listens for the AVSession creation event, and creates a remote **AVSessionController** object to manage the remote AVSession. In addition, the control commands are automatically synchronized by the AVSession framework to the local device. + + The provider (for example, an audio and video application) on the local device listens for control command events, so as to respond to the commands from the remote device in time. diff --git a/en/application-dev/media/using-opensl-es-for-playback.md b/en/application-dev/media/using-opensl-es-for-playback.md new file mode 100644 index 0000000000000000000000000000000000000000..c5dedbba659154a1893a471e5e9a3d33d33be20a --- /dev/null +++ b/en/application-dev/media/using-opensl-es-for-playback.md @@ -0,0 +1,131 @@ +# Using OpenSL ES for Audio Playback + +OpenSL ES, short for Open Sound Library for Embedded Systems, is an embedded, cross-platform audio processing library that is free of charge. It provides high-performance and low-latency APIs for you to develop applications running on embedded mobile multimedia devices. OpenHarmony have implemented certain native APIs based on [OpenSL ES](https://www.khronos.org/opensles/) 1.0.1 API specifications developed by the [Khronos Group](https://www.khronos.org/). You can use these APIs through and . + +## OpenSL ES on OpenHarmony + +Currently, OpenHarmony implements parts of [OpenSL ES APIs](https://gitee.com/openharmony/third_party_opensles/blob/master/api/1.0.1/OpenSLES.h) to implement basic audio playback functionalities. + +If an API that has not been implemented on OpenHarmony is called, **SL_RESULT_FEATURE_UNSUPPORTED** is returned. + +The following lists the OpenSL ES APIs that have been implemented on OpenHarmony. For details, see the [OpenSL ES](https://www.khronos.org/opensles/) specifications. + +- **Engine APIs implemented on OpenHarmony** + - SLresult (\*CreateAudioPlayer) (SLEngineItf self, SLObjectItf \* pPlayer, SLDataSource \*pAudioSrc, SLDataSink \*pAudioSnk, SLuint32 numInterfaces, const SLInterfaceID \* pInterfaceIds, const SLboolean \* pInterfaceRequired) + - SLresult (\*CreateAudioRecorder) (SLEngineItf self, SLObjectItf \* pRecorder, SLDataSource \*pAudioSrc, SLDataSink \*pAudioSnk, SLuint32 numInterfaces, const SLInterfaceID \* pInterfaceIds, const SLboolean \* pInterfaceRequired) + - SLresult (\*CreateOutputMix) (SLEngineItf self, SLObjectItf \* pMix, SLuint32 numInterfaces, const SLInterfaceID \* pInterfaceIds, const SLboolean \* pInterfaceRequired) + +- **Object APIs implemented on OpenHarmony** + - SLresult (\*Realize) (SLObjectItf self, SLboolean async) + - SLresult (\*GetState) (SLObjectItf self, SLuint32 \* pState) + - SLresult (\*GetInterface) (SLObjectItf self, const SLInterfaceID iid, void \* pInterface) + - void (\*Destroy) (SLObjectItf self) + +- **Playback APIs implemented on OpenHarmony** + - SLresult (\*SetPlayState) (SLPlayItf self, SLuint32 state) + - SLresult (\*GetPlayState) (SLPlayItf self, SLuint32 \*pState) + +- **Volume control APIs implemented on OpenHarmony** + - SLresult (\*SetVolumeLevel) (SLVolumeItf self, SLmillibel level) + - SLresult (\*GetVolumeLevel) (SLVolumeItf self, SLmillibel \*pLevel) + - SLresult (\*GetMaxVolumeLevel) (SLVolumeItf self, SLmillibel \*pMaxLevel) + +- **BufferQueue APIs implemented on OpenHarmony** + + The APIs listed below can be used only after is introduced. + | API| Description| + | -------- | -------- | + | SLresult (\*Enqueue) (SLOHBufferQueueItf self, const void \*buffer, SLuint32 size) | Adds a buffer to the corresponding queue.
For an audio playback operation, this API adds the buffer with audio data to the **filledBufferQ_** queue. For an audio recording operation, this API adds the idle buffer after recording data storage to the **freeBufferQ_** queue.
The **self** parameter indicates the **BufferQueue** object that calls this API.
The **buffer** parameter indicates the pointer to the buffer with audio data or the pointer to the idle buffer after the recording data is stored.
The **size** parameter indicates the size of the buffer.| + | SLresult (\*Clear) (SLOHBufferQueueItf self) | Releases a **BufferQueue** object.
The **self** parameter indicates the **BufferQueue** object that calls this API.| + | SLresult (\*GetState) (SLOHBufferQueueItf self, SLOHBufferQueueState \*state) | Obtains the state of a **BufferQueue** object.
The **self** parameter indicates the **BufferQueue** object that calls this API.
The **state** parameter indicates the pointer to the state of the **BufferQueue** object.| + | SLresult (\*RegisterCallback) (SLOHBufferQueueItf self, SlOHBufferQueueCallback callback, void\* pContext) | Registers a callback.
The **self** parameter indicates the **BufferQueue** object that calls this API.
The **callback** parameter indicates the callback to be registered for the audio playback or recording operation.
The **pContext** parameter indicates the pointer to the audio file to be played for an audio playback operation or the pointer to the audio file to be recorded for an audio recording operation.| + | SLresult (\*GetBuffer) (SLOHBufferQueueItf self, SLuint8\*\* buffer, SLuint32\* size) | Obtains a buffer.
For an audio playback operation, this API obtains an idle buffer from the **freeBufferQ_** queue. For an audio recording operation, this API obtains the buffer that carries recording data from the **filledBufferQ_** queue.
The **self** parameter indicates the **BufferQueue** object that calls this API.
The **buffer** parameter indicates the double pointer to the idle buffer or the buffer carrying recording data.
The **size** parameter indicates the size of the buffer.| + +## Sample Code + +Refer to the sample code below to play an audio file. + +1. Add the header files. + + ```c++ + #include + #include + #include + ``` + +2. Use the **slCreateEngine** API to obtain an **engine** instance. + + ```c++ + SLObjectItf engineObject = nullptr; + slCreateEngine(&engineObject, 0, nullptr, 0, nullptr, nullptr); + (*engineObject)->Realize(engineObject, SL_BOOLEAN_FALSE); + ``` + +3. Obtain the **engineEngine** instance of the **SL_IID_ENGINE** API. + + ```c++ + SLEngineItf engineEngine = nullptr; + (*engineObject)->GetInterface(engineObject, SL_IID_ENGINE, &engineEngine); + ``` + +4. Configure the player and create an **AudioPlayer** instance. + + ```c++ + SLDataLocator_BufferQueue slBufferQueue = { + SL_DATALOCATOR_BUFFERQUEUE, + 0 + }; + + // Configure the parameters based on the audio file format. + SLDataFormat_PCM pcmFormat = { + SL_DATAFORMAT_PCM, + 2, // Number of channels. + SL_SAMPLINGRATE_48, // Sampling rate. + SL_PCMSAMPLEFORMAT_FIXED_16, // Audio sample format. + 0, + 0, + 0 + }; + SLDataSource slSource = {&slBufferQueue, &pcmFormat}; + SLObjectItf pcmPlayerObject = nullptr; + (*engineEngine)->CreateAudioPlayer(engineEngine, &pcmPlayerObject, &slSource, null, 0, nullptr, nullptr); + (*pcmPlayerObject)->Realize(pcmPlayerObject, SL_BOOLEAN_FALSE); + ``` + +5. Obtain the **bufferQueueItf** instance of the **SL_IID_OH_BUFFERQUEUE** API. + + ```c++ + SLOHBufferQueueItf bufferQueueItf; + (*pcmPlayerObject)->GetInterface(pcmPlayerObject, SL_IID_OH_BUFFERQUEUE, &bufferQueueItf); + ``` + +6. Open an audio file and register the **BufferQueueCallback** function. + + ```c++ + static void BufferQueueCallback (SLOHBufferQueueItf bufferQueueItf, void *pContext, SLuint32 size) + { + SLuint8 *buffer = nullptr; + SLuint32 pSize; + (*bufferQueueItf)->GetBuffer(bufferQueueItf, &buffer, &pSize); + // Write the audio data to be played to the buffer. + (*bufferQueueItf)->Enqueue(bufferQueueItf, buffer, size); + } + void *pContext; // This callback can be used to obtain the custom context information passed in. + (*bufferQueueItf)->RegisterCallback(bufferQueueItf, BufferQueueCallback, pContext); + ``` + +7. Obtain the **playItf** instance of the **SL_PLAYSTATE_PLAYING** API and start playing. + + ```c++ + SLPlayItf playItf = nullptr; + (*pcmPlayerObject)->GetInterface(pcmPlayerObject, SL_IID_PLAY, &playItf); + (*playItf)->SetPlayState(playItf, SL_PLAYSTATE_PLAYING); + ``` + +8. Stop playing. + + ```c++ + (*playItf)->SetPlayState(playItf, SL_PLAYSTATE_STOPPED); + (*pcmPlayerObject)->Destroy(pcmPlayerObject); + (*engineObject)->Destroy(engineObject); + ``` diff --git a/en/application-dev/media/using-opensl-es-for-recording.md b/en/application-dev/media/using-opensl-es-for-recording.md new file mode 100644 index 0000000000000000000000000000000000000000..55a18fc561c0117d5aff5aaedb22c36f1b7706bf --- /dev/null +++ b/en/application-dev/media/using-opensl-es-for-recording.md @@ -0,0 +1,148 @@ +# Using OpenSL ES for Audio Recording + +OpenSL ES, short for Open Sound Library for Embedded Systems, is an embedded, cross-platform audio processing library that is free of charge. It provides high-performance and low-latency APIs for you to develop applications running on embedded mobile multimedia devices. OpenHarmony have implemented certain native APIs based on [OpenSL ES](https://www.khronos.org/opensles/) 1.0.1 API specifications developed by the [Khronos Group](https://www.khronos.org/). You can use these APIs through and . + +## OpenSL ES on OpenHarmony + +Currently, OpenHarmony implements parts of [OpenSL ES APIs](https://gitee.com/openharmony/third_party_opensles/blob/master/api/1.0.1/OpenSLES.h) to implement basic audio recording functionalities. + +If an API that has not been implemented on OpenHarmony is called, **SL_RESULT_FEATURE_UNSUPPORTED** is returned. + +The following lists the OpenSL ES APIs that have been implemented on OpenHarmony. For details, see the [OpenSL ES](https://www.khronos.org/opensles/) specifications. + +- **Engine APIs implemented on OpenHarmony** + - SLresult (\*CreateAudioPlayer) (SLEngineItf self, SLObjectItf \* pPlayer, SLDataSource \*pAudioSrc, SLDataSink \*pAudioSnk, SLuint32 numInterfaces, const SLInterfaceID \* pInterfaceIds, const SLboolean \* pInterfaceRequired) + - SLresult (\*CreateAudioRecorder) (SLEngineItf self, SLObjectItf \* pRecorder, SLDataSource \*pAudioSrc, SLDataSink \*pAudioSnk, SLuint32 numInterfaces, const SLInterfaceID \* pInterfaceIds, const SLboolean \* pInterfaceRequired) + - SLresult (\*CreateOutputMix) (SLEngineItf self, SLObjectItf \* pMix, SLuint32 numInterfaces, const SLInterfaceID \* pInterfaceIds, const SLboolean \* pInterfaceRequired) + +- **Object APIs implemented on OpenHarmony** + - SLresult (\*Realize) (SLObjectItf self, SLboolean async) + - SLresult (\*GetState) (SLObjectItf self, SLuint32 \* pState) + - SLresult (\*GetInterface) (SLObjectItf self, const SLInterfaceID iid, void \* pInterface) + - void (\*Destroy) (SLObjectItf self) + +- **Recorder APIs implemented on OpenHarmony** + - SLresult (\*SetRecordState) (SLRecordItf self, SLuint32 state) + - SLresult (\*GetRecordState) (SLRecordItf self,SLuint32 \*pState) + +- **BufferQueue APIs implemented on OpenHarmony** + + The APIs listed below can be used only after is introduced. + | API| Description| + | -------- | -------- | + | SLresult (\*Enqueue) (SLOHBufferQueueItf self, const void \*buffer, SLuint32 size) | Adds a buffer to the corresponding queue.
For an audio playback operation, this API adds the buffer with audio data to the **filledBufferQ_** queue. For an audio recording operation, this API adds the idle buffer after recording data storage to the **freeBufferQ_** queue.
The **self** parameter indicates the **BufferQueue** object that calls this API.
The **buffer** parameter indicates the pointer to the buffer with audio data or the pointer to the idle buffer after the recording data is stored.
The **size** parameter indicates the size of the buffer.| + | SLresult (\*Clear) (SLOHBufferQueueItf self) | Releases a **BufferQueue** object.
The **self** parameter indicates the **BufferQueue** object that calls this API.| + | SLresult (\*GetState) (SLOHBufferQueueItf self, SLOHBufferQueueState \*state) | Obtains the state of a **BufferQueue** object.
The **self** parameter indicates the **BufferQueue** object that calls this API.
The **state** parameter indicates the pointer to the state of the **BufferQueue** object.| + | SLresult (\*RegisterCallback) (SLOHBufferQueueItf self, SlOHBufferQueueCallback callback, void\* pContext) | Registers a callback.
The **self** parameter indicates the **BufferQueue** object that calls this API.
The **callback** parameter indicates the callback to be registered for the audio playback or recording operation.
The **pContext** parameter indicates the pointer to the audio file to be played for an audio playback operation or the pointer to the audio file to be recorded for an audio recording operation.| + | SLresult (\*GetBuffer) (SLOHBufferQueueItf self, SLuint8\*\* buffer, SLuint32\* size) | Obtains a buffer.
For an audio playback operation, this API obtains an idle buffer from the **freeBufferQ_** queue. For an audio recording operation, this API obtains the buffer that carries recording data from the **filledBufferQ_** queue.
The **self** parameter indicates the **BufferQueue** object that calls this API.
The **buffer** parameter indicates the double pointer to the idle buffer or the buffer carrying recording data.
The **size** parameter indicates the size of the buffer.| + +## Sample Code + +Refer to the sample code below to record an audio file. + +1. Add the header files. + + ```c++ + #include + #include + #include + ``` + +2. Use the **slCreateEngine** API to create and instantiate an **engine** object. + + ```c++ + SLObjectItf engineObject = nullptr; + slCreateEngine(&engineObject, 0, nullptr, 0, nullptr, nullptr); + (*engineObject)->Realize(engineObject, SL_BOOLEAN_FALSE); + ``` + +3. Obtain the **engineEngine** instance of the **SL_IID_ENGINE** API. + + ```c++ + SLEngineItf engineItf = nullptr; + (*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++ + SLDataLocator_IODevice io_device = { + SL_DATALOCATOR_IODEVICE, + SL_IODEVICE_AUDIOINPUT, + SL_DEFAULTDEVICEID_AUDIOINPUT, + NULL + }; + SLDataSource audioSource = { + &io_device, + NULL + }; + SLDataLocator_BufferQueue buffer_queue = { + SL_DATALOCATOR_BUFFERQUEUE, + 3 + }; + // Configure the parameters based on the audio file format. + SLDataFormat_PCM format_pcm = { + SL_DATAFORMAT_PCM, // Input audio format. + 1, // Mono channel. + SL_SAMPLINGRATE_44_1, // Sampling rate, 44100 Hz. + SL_PCMSAMPLEFORMAT_FIXED_16, // Audio sampling format, a signed 16-bit integer in little-endian format. + 0, + 0, + 0 + }; + SLDataSink audioSink = { + &buffer_queue, + &format_pcm + }; + + SLObjectItf pcmCapturerObject = nullptr; + (*engineItf)->CreateAudioRecorder(engineItf, &pcmCapturerObject, + &audioSource, &audioSink, 0, nullptr, nullptr); + (*pcmCapturerObject)->Realize(pcmCapturerObject, SL_BOOLEAN_FALSE); + + ``` + +5. Obtain the **recordItf** instance of the **SL_IID_RECORD** API. + + ```c++ + SLRecordItf recordItf; + (*pcmCapturerObject)->GetInterface(pcmCapturerObject, SL_IID_RECORD, &recordItf); + ``` + +6. Obtain the **bufferQueueItf** instance of the **SL_IID_OH_BUFFERQUEUE** API. + + ```c++ + SLOHBufferQueueItf bufferQueueItf; + (*pcmCapturerObject)->GetInterface(pcmCapturerObject, SL_IID_OH_BUFFERQUEUE, &bufferQueueItf); + ``` + +7. Register the **BufferQueueCallback** function. + + ```c++ + static void BufferQueueCallback(SLOHBufferQueueItf bufferQueueItf, void *pContext, SLuint32 size) + { + // Obtain the user information passed in during the registration from pContext. + SLuint8 *buffer = nullptr; + SLuint32 pSize = 0; + (*bufferQueueItf)->GetBuffer(bufferQueueItf, &buffer, &pSize); + if (buffer != nullptr) { + // The recording data can be read from the buffer for subsequent processing. + (*bufferQueueItf)->Enqueue(bufferQueueItf, buffer, size); + } + } + void *pContext; // This callback can be used to obtain the custom context information passed in. + (*bufferQueueItf)->RegisterCallback(bufferQueueItf, BufferQueueCallback, pContext); + ``` + +8. Start audio recording. + + ```c++ + (*recordItf)->SetRecordState(recordItf, SL_RECORDSTATE_RECORDING); + ``` + +9. Stop audio recording. + + ```c++ + (*recordItf)->SetRecordState(recordItf, SL_RECORDSTATE_STOPPED); + (*pcmCapturerObject)->Destroy(pcmCapturerObject); + ``` diff --git a/en/application-dev/media/using-toneplayer-for-playback.md b/en/application-dev/media/using-toneplayer-for-playback.md new file mode 100644 index 0000000000000000000000000000000000000000..11a528786b5bae712d8c4f07b9cad4ee29af2f48 --- /dev/null +++ b/en/application-dev/media/using-toneplayer-for-playback.md @@ -0,0 +1,140 @@ +# Using TonePlayer for Audio Playback (for System Applications Only) + +TonePlayer9+ provides APIs for playing and managing Dual Tone Multi Frequency (DTMF) tones, such as dial tones, ringback tones, supervisory tones, and proprietary tones. The main task of the TonePlayer is to generate sine waves of different frequencies by using the built-in algorithm based on the [ToneType](../reference/apis/js-apis-audio.md#tonetype9)s and add the sine waves to create a sound. The sound can then be played by using the [AudioRenderer](../reference/apis/js-apis-audio.md#audiorenderer8), and the playback task can also be managed by using the [AudioRenderer](../reference/apis/js-apis-audio.md#audiorenderer8). The full process includes loading the DTMF tone configuration, starting DTMF tone playing, stopping the playback, and releasing the resources associated with the **TonePlayer** object. For details about the APIs, see the [TonePlayer API Reference](../reference/apis/js-apis-audio.md#toneplayer9). + + +## Supported Tone Types + +The table below lists the supported [ToneType](../reference/apis/js-apis-audio.md#tonetype9)s. You can call **load()** with **audio.ToneType.*type*** as a parameter to load the tone resource of the specified type. + +| Tone Type| Value| Description| +| -------- | -------- | -------- | +| TONE_TYPE_DIAL_0 | 0 | DTMF tone of key 0.| +| TONE_TYPE_DIAL_1 | 1 | DTMF tone of key 1.| +| TONE_TYPE_DIAL_2 | 2 | DTMF tone of key 2.| +| TONE_TYPE_DIAL_3 | 3 | DTMF tone of key 3.| +| TONE_TYPE_DIAL_4 | 4 | DTMF tone of key 4.| +| TONE_TYPE_DIAL_5 | 5 | DTMF tone of key 5.| +| TONE_TYPE_DIAL_6 | 6 | DTMF tone of key 6.| +| TONE_TYPE_DIAL_7 | 7 | DTMF tone of key 7.| +| TONE_TYPE_DIAL_8 | 8 | DTMF tone of key 8.| +| TONE_TYPE_DIAL_9 | 9 | DTMF tone of key 9.| +| TONE_TYPE_DIAL_S | 10 | DTMF tone of the star key (*).| +| TONE_TYPE_DIAL_P | 11 | DTMF tone of the pound key (#).| +| TONE_TYPE_DIAL_A | 12 | DTMF tone of key A.| +| TONE_TYPE_DIAL_B | 13 | DTMF tone of key B.| +| TONE_TYPE_DIAL_C | 14 | DTMF tone of key C.| +| TONE_TYPE_DIAL_D | 15 | DTMF tone of key D.| +| TONE_TYPE_COMMON_SUPERVISORY_DIAL | 100 | Supervisory tone - dial tone.| +| TONE_TYPE_COMMON_SUPERVISORY_BUSY | 101 | Supervisory tone - busy.| +| TONE_TYPE_COMMON_SUPERVISORY_CONGESTION | 102 | Supervisory tone - congestion.| +| TONE_TYPE_COMMON_SUPERVISORY_RADIO_ACK | 103 | Supervisory tone - radio path acknowledgment.| +| TONE_TYPE_COMMON_SUPERVISORY_RADIO_NOT_AVAILABLE | 104 | Supervisory tone - radio path not available.| +| TONE_TYPE_COMMON_SUPERVISORY_CALL_WAITING | 106 | Supervisory tone - call waiting tone.| +| TONE_TYPE_COMMON_SUPERVISORY_RINGTONE | 107 | Supervisory tone - ringing tone.| +| TONE_TYPE_COMMON_PROPRIETARY_BEEP | 200 | Proprietary tone - beep tone.| +| TONE_TYPE_COMMON_PROPRIETARY_ACK | 201 | Proprietary tone - ACK.| +| TONE_TYPE_COMMON_PROPRIETARY_PROMPT | 203 | Proprietary tone - PROMPT.| +| TONE_TYPE_COMMON_PROPRIETARY_DOUBLE_BEEP | 204 | Proprietary tone - double beep tone.| + + +## How to Develop + +To implement audio playback with the TonePlayer, perform the following steps: + +1. Create a **TonePlayer** instance. + + ```ts + import audio from '@ohos.multimedia.audio'; + let audioRendererInfo = { + content : audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage : audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags : 0 + }; + tonePlayerPromise = audio.createTonePlayer(audioRendererInfo); + ``` + +2. Load the DTMF tone configuration of the specified type. + + ```ts + tonePlayerPromise.load(audio.ToneType.TONE_TYPE_DIAL_0); + ``` + +3. Start DTMF tone playing. + + ```ts + tonePlayerPromise.start(); + ``` + +4. Stop the tone that is being played. + + ```ts + tonePlayerPromise.stop(); + ``` + +5. Release the resources associated with the **TonePlayer** instance. + + ```ts + tonePlayerPromise.release(); + ``` + +If the APIs are not called in the preceding sequence, the error code **6800301 NAPI_ERR_SYSTEM** is returned. + + +## Sample Code + +Refer to the following code to play the DTMF tone when the dial key on the keyboard is pressed. + +To prevent the UI thread from being blocked, most **TonePlayer** calls are asynchronous. Each API provides the callback and promise functions. The following examples use the promise functions. For more information, see [TonePlayer](../reference/apis/js-apis-audio.md#toneplayer9). + + +```ts +import audio from '@ohos.multimedia.audio'; + +export class TonelayerDemo { + private timer : number; + private timerPro : number; + // Promise mode. + async testTonePlayerPromise(type) { + console.info('testTonePlayerPromise start'); + if (this.timerPro) clearTimeout(this.timerPro); + let tonePlayerPromise; + let audioRendererInfo = { + content : audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage : audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags : 0 + }; + this.timerPro = setTimeout(async () => { + try { + console.info('testTonePlayerPromise: createTonePlayer'); + // Create a DTMF player. + tonePlayerPromise = await audio.createTonePlayer(audioRendererInfo); + console.info('testTonePlayerPromise: createTonePlayer-success'); + console.info(`testTonePlayerPromise: load type: ${type}`); + // Load the tone configuration of the specified type. + await tonePlayerPromise.load(type); + console.info('testTonePlayerPromise: load-success'); + console.info(`testTonePlayerPromise: start type: ${type}`); + // Start DTMF tone playing. + await tonePlayerPromise.start(); + console.info('testTonePlayerPromise: start-success'); + console.info(`testTonePlayerPromise: stop type: ${type}`); + setTimeout(async()=>{ + // Stop the tone that is being played. + await tonePlayerPromise.stop(); + console.info('testTonePlayerPromise: stop-success'); + console.info(`testTonePlayerPromise: release type: ${type}`); + // Release the resources associated with the TonePlayer instance. + await tonePlayerPromise.release(); + console.info('testTonePlayerPromise: release-success'); + }, 30) + } catch(err) { + console.error(`testTonePlayerPromise err : ${err}`); + } + }, 200) + }; + async testTonePlayer() { + this.testTonePlayerPromise(audio.ToneType.TONE_TYPE_DIAL_0); + } +} +``` diff --git a/en/application-dev/media/video-playback.md b/en/application-dev/media/video-playback.md index d4c895b452aa31b28690bd96bd9ef0fac64c4eb4..fff4aa830ddc45e7d20e0fd06655adfdc5243fe5 100644 --- a/en/application-dev/media/video-playback.md +++ b/en/application-dev/media/video-playback.md @@ -1,419 +1,178 @@ -# Video Playback Development +# Video Playback -## Introduction - -You can use video playback APIs to convert audio data into audible analog signals and play the signals using output devices. You can also manage playback tasks. For example, you can start, suspend, stop playback, release resources, set the volume, seek to a playback position, set the playback speed, and obtain track information. This document describes development for the following video playback scenarios: full-process, normal playback, video switching, and loop playback. - -## Working Principles - -The following figures show the video playback state transition and the interaction with external modules for video playback. - -**Figure 1** Video playback state transition - -![en-us_image_video_state_machine](figures/en-us_image_video_state_machine.png) - -**Figure 2** Interaction with external modules for video playback - -![en-us_image_video_player](figures/en-us_image_video_player.png) - -**NOTE**: When a third-party application calls a JS interface provided by the JS interface layer, the framework layer invokes the audio component through the media service of the native framework to output the audio data decoded by the software to the audio HDI. The graphics subsystem outputs the image data decoded by the codec HDI at the hardware interface layer to the display HDI. In this way, video playback is implemented. - -*Note: Video playback requires hardware capabilities such as display, audio, and codec.* - -1. A third-party application obtains a surface ID from the XComponent. -2. The third-party application transfers the surface ID to the VideoPlayer JS. -3. The media service flushes the frame data to the surface buffer. - -## Compatibility - -Use the mainstream playback formats and resolutions, rather than custom ones to avoid playback failures, frame freezing, and artifacts. The system is not affected by incompatibility issues. If such an issue occurs, you can exit stream playback mode. - -The table below lists the mainstream playback formats and resolutions. - -| Video Container Format| Description | Resolution | -| :----------: | :-----------------------------------------------: | :--------------------------------: | -| mp4 | Video format: H.264/MPEG-2/MPEG-4/H.263; audio format: AAC/MP3| Mainstream resolutions, such as 1080p, 720p, 480p, and 270p| -| mkv | Video format: H.264/MPEG-2/MPEG-4/H.263; audio format: AAC/MP3| Mainstream resolutions, such as 1080p, 720p, 480p, and 270p| -| ts | Video format: H.264/MPEG-2/MPEG-4; audio format: AAC/MP3 | Mainstream resolutions, such as 1080p, 720p, 480p, and 270p| -| webm | Video format: VP8; audio format: VORBIS | Mainstream resolutions, such as 1080p, 720p, 480p, and 270p| - -## How to Develop - -For details about the APIs, see [VideoPlayer in the Media API](../reference/apis/js-apis-media.md#videoplayer8). - -### Full-Process Scenario - -The full video playback process includes creating an instance, setting the URL, setting the surface ID, preparing for video playback, playing video, pausing playback, obtaining track information, seeking to a playback position, setting the volume, setting the playback speed, stopping playback, resetting the playback configuration, and releasing resources. - -For details about the **url** types supported by **VideoPlayer**, see the [url attribute](../reference/apis/js-apis-media.md#videoplayer_attributes). - -For details about how to create an XComponent, see [XComponent](../reference/arkui-ts/ts-basic-components-xcomponent.md). - -```js -import media from '@ohos.multimedia.media' -import fs from '@ohos.file.fs' -export class VideoPlayerDemo { - // Report an error in the case of a function invocation failure. - failureCallback(error) { - console.info(`error happened,error Name is ${error.name}`); - console.info(`error happened,error Code is ${error.code}`); - console.info(`error happened,error Message is ${error.message}`); - } - - // Report an error in the case of a function invocation exception. - catchCallback(error) { - console.info(`catch error happened,error Name is ${error.name}`); - console.info(`catch error happened,error Code is ${error.code}`); - console.info(`catch error happened,error Message is ${error.message}`); - } - - // Used to print the video track information. - printfDescription(obj) { - for (let item in obj) { - let property = obj[item]; - console.info('key is ' + item); - console.info('value is ' + property); - } - } - - async videoPlayerDemo() { - let videoPlayer = undefined; - let surfaceID = 'test' // The surfaceID parameter is used for screen display. Its value is obtained through the XComponent API. For details about the document link, see the method of creating the XComponent. - let fdPath = 'fd://' - // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\H264_AAC.mp4 /data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile" command. - let path = '/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/H264_AAC.mp4'; - let file = await fs.open(path); - fdPath = fdPath + '' + file.fd; - // Call createVideoPlayer to create a VideoPlayer instance. - await media.createVideoPlayer().then((video) => { - if (typeof (video) != 'undefined') { - console.info('createVideoPlayer success!'); - videoPlayer = video; - } else { - console.info('createVideoPlayer fail!'); +OpenHarmony provides two solutions for video playback development: + +- [AVPlayer](using-avplayer-for-playback.md) class: provides ArkTS and JS APIs to implement audio and video playback. It also supports parsing streaming media and local assets, decapsulating media assets, decoding video, and rendering video. It is applicable to end-to-end playback of media assets and can be used to play video files in MP4 and MKV formats. + +- component: encapsulates basic video playback capabilities. It can be used to play video files after the data source and basic information are set. However, its scalability is poor. This component is provided by ArkUI. For details about how to use this component for video playback development, see [Video Component](../ui/arkts-common-components-video-player.md). + +In this topic, you will learn how to use the AVPlayer to develop a video playback service that plays a complete video file. If you want the application to continue playing the video in the background or when the screen is off, you must use the [AVSession](avsession-overview.md) and [continuous task](../task-management/continuous-task-dev-guide.md) to prevent the playback from being forcibly interrupted by the system. + +## Development Guidelines + +The full playback process includes creating an **AVPlayer** instance, setting the media asset to play and the window to display the video, setting playback parameters (volume, speed, and scale type), controlling playback (play, pause, seek, and stop), resetting the playback configuration, and releasing the instance. During application development, you can use the **state** attribute of the AVPlayer to obtain the AVPlayer state or call **on('stateChange')** to listen for state changes. If the application performs an operation when the AudioPlayer is not in the given state, the system may throw an exception or generate other undefined behavior. + +**Figure 1** Playback state transition + +![Playback state change](figures/video-playback-status-change.png) + +For details about the state, see [AVPlayerState](../reference/apis/js-apis-media.md#avplayerstate9). When the AVPlayer is in the **prepared**, **playing**, **paused**, or **completed** state, the playback engine is working and a large amount of RAM is occupied. If your application does not need to use the AVPlayer, call **reset()** or **release()** to release the instance. + +### How to Develop + +Read [AVPlayer](../reference/apis/js-apis-media.md#avplayer9) for the API reference. + +1. Call **createAVPlayer()** to create an **AVPlayer** instance. The AVPlayer is the **idle** state. + +2. Set the events to listen for, which will be used in the full-process scenario. The table below lists the supported events. + | Event Type| Description| + | -------- | -------- | + | stateChange | Mandatory; used to listen for changes of the **state** attribute of the AVPlayer.| + | error | Mandatory; used to listen for AVPlayer errors.| + | durationUpdate | Used to listen for progress bar updates to refresh the media asset duration.| + | timeUpdate | Used to listen for the current position of the progress bar to refresh the current time.| + | seekDone | Used to listen for the completion status of the **seek()** request.
This event is reported when the AVPlayer seeks to the playback position specified in **seek()**.| + | speedDone | Used to listen for the completion status of the **setSpeed()** request.
This event is reported when the AVPlayer plays video at the speed specified in **setSpeed()**.| + | volumeChange | Used to listen for the completion status of the **setVolume()** request.
This event is reported when the AVPlayer plays video at the volume specified in **setVolume()**.| + | bitrateDone | Used to listen for the completion status of the **setBitrate()** request, which is used for HTTP Live Streaming (HLS) streams.
This event is reported when the AVPlayer plays video at the bit rate specified in **setBitrate()**.| + | availableBitrates | Used to listen for available bit rates of HLS resources. The available bit rates are provided for **setBitrate()**.| + | bufferingUpdate | Used to listen for network playback buffer information.| + | startRenderFrame | Used to listen for the rendering time of the first frame during video playback.| + | videoSizeChange | Used to listen for the width and height of video playback and adjust the window size and ratio.| + | audioInterrupt | Used to listen for audio interruption. This event is used together with the **audioInterruptMode** attribute.
This event is reported when the current audio playback is interrupted by another (for example, when a call is coming), so the application can process the event in time.| + +3. Set the media asset URL. The AVPlayer enters the **initialized** state. + > **NOTE** + > + > The URL in the code snippet below is for reference only. You need to check the media asset validity and set the URL based on service requirements. + > + > - If local files are used for playback, ensure that the files are available and the application sandbox path is used for access. For details about how to obtain the application sandbox path, see [Obtaining the Application Development Path](../application-models/application-context-stage.md#obtaining-the-application-development-path). For details about the application sandbox and how to push files to the application sandbox, see [File Management](../file-management/app-sandbox-directory.md). + > + > - If a network playback path is used, you must request the ohos.permission.INTERNET [permission](../security/accesstoken-guidelines.md). + > + > - You can also use **ResourceManager.getRawFd** to obtain the file descriptor of a file packed in the HAP file. For details, see [ResourceManager API Reference](../reference/apis/js-apis-resource-manager.md#getrawfd9). + > + > - The [playback formats and protocols](avplayer-avrecorder-overview.md#supported-formats-and-protocols) in use must be those supported by the system. + +4. Obtain and set the surface ID of the window to display the video. + The application obtains the surface ID from the XComponent. For details about the process, see [XComponent](../reference/arkui-ts/ts-basic-components-xcomponent.md). + +5. Call **prepare()** to switch the AVPlayer to the **prepared** state. In this state, you can obtain the duration of the media asset to play and set the scale type and volume. + +6. Call **play()**, **pause()**, **seek()**, and **stop()** to perform video playback control as required. + +7. (Optional) Call **reset()** to reset the AVPlayer. The AVPlayer enters the **idle** state again and you can change the media asset URL. + +8. Call **release()** to switch the AVPlayer to the **released** state. Now your application exits the playback. + + +### Sample Code + + +```ts +import media from '@ohos.multimedia.media'; +import fs from '@ohos.file.fs'; +import common from '@ohos.app.ability.common'; + +export class AVPlayerDemo { + private avPlayer; + private count: number = 0; + private surfaceID: string; // The surfaceID parameter specifies the window used to display the video. Its value is obtained through the XComponent. + + // Set AVPlayer callback functions. + setAVPlayerCallback() { + // Callback function for the seek operation. + this.avPlayer.on('seekDone', (seekDoneTime) => { + console.info(`AVPlayer seek succeeded, seek time is ${seekDoneTime}`); + }) + // Callback function for errors. If an error occurs during the operation on the AVPlayer, reset() is called to reset the AVPlayer. + this.avPlayer.on('error', (err) => { + console.error(`Invoke avPlayer failed, code is ${err.code}, message is ${err.message}`); + this.avPlayer.reset(); // Call reset() to reset the AVPlayer, which enters the idle state. + }) + // Callback function for state changes. + this.avPlayer.on('stateChange', async (state, reason) => { + switch (state) { + case 'idle': // This state is reported upon a successful callback of reset(). + console.info('AVPlayer state idle called.'); + this.avPlayer.release(); // Call release() to release the instance. + break; + case 'initialized': // This state is reported when the AVPlayer sets the playback source. + console.info('AVPlayerstate initialized called.'); + this.avPlayer.surfaceId = this.surfaceID // Set the window to display the video. This setting is not required when a pure audio asset is to be played. + this.avPlayer.prepare().then(() => { + console.info('AVPlayer prepare succeeded.'); + }, (err) => { + console.error(`Invoke prepare failed, code is ${err.code}, message is ${err.message}`); + }); + break; + case 'prepared': // This state is reported upon a successful callback of prepare(). + console.info('AVPlayer state prepared called.'); + this.avPlayer.play(); // Call play() to start playback. + break; + case 'playing': // This state is reported upon a successful callback of play(). + console.info('AVPlayer state playing called.'); + if (this.count !== 0) { + console.info('AVPlayer start to seek.'); + this.avPlayer.seek (this.avPlayer.duration); // Call seek() to seek to the end of the video clip. + } else { + this.avPlayer.pause(); // Call pause() to pause the playback. + } + this.count++; + break; + case 'paused': // This state is reported upon a successful callback of pause(). + console.info('AVPlayer state paused called.'); + this.avPlayer.play(); // Call play() again to start playback. + break; + case 'completed': // This state is reported upon the completion of the playback. + console.info('AVPlayer state completed called.'); + this.avPlayer.stop(); // Call stop() to stop the playback. + break; + case 'stopped': // This state is reported upon a successful callback of stop(). + console.info('AVPlayer state stopped called.'); + this.avPlayer.reset(); // Call reset() to reset the AVPlayer state. + break; + case 'released': + console.info('AVPlayer state released called.'); + break; + default: + console.info('AVPlayer state unknown called.'); + break; } - }, this.failureCallback).catch(this.catchCallback); - // Set the playback source for the player. - videoPlayer.url = fdPath; - - // Set the surface ID to display the video image. - await videoPlayer.setDisplaySurface(surfaceID).then(() => { - console.info('setDisplaySurface success'); - }, this.failureCallback).catch(this.catchCallback); - - // Call the prepare API to prepare for playback. - await videoPlayer.prepare().then(() => { - console.info('prepare success'); - }, this.failureCallback).catch(this.catchCallback); - - // Call the play API to start playback. - await videoPlayer.play().then(() => { - console.info('play success'); - }, this.failureCallback).catch(this.catchCallback); - - // Pause playback. - await videoPlayer.pause().then(() => { - console.info('pause success'); - }, this.failureCallback).catch(this.catchCallback); - - // Use a promise to obtain the video track information communication_dsoftbus. - let arrayDescription; - await videoPlayer.getTrackDescription().then((arrlist) => { - if (typeof (arrlist) != 'undefined') { - arrayDescription = arrlist; - } else { - console.log('video getTrackDescription fail'); - } - }, this.failureCallback).catch(this.catchCallback); - - for (let i = 0; i < arrayDescription.length; i++) { - this.printfDescription(arrayDescription[i]); - } - - // Seek to the 50s position. For details about the input parameters, see the API document. - let seekTime = 50000; - await videoPlayer.seek(seekTime, media.SeekMode.SEEK_NEXT_SYNC).then((seekDoneTime) => { - console.info('seek success'); - }, this.failureCallback).catch(this.catchCallback); - - // Set the volume. For details about the input parameters, see the API document. - let volume = 0.5; - await videoPlayer.setVolume(volume).then(() => { - console.info('setVolume success'); - }, this.failureCallback).catch(this.catchCallback); - - // Set the playback speed. For details about the input parameters, see the API document. - let speed = media.PlaybackSpeed.SPEED_FORWARD_2_00_X; - await videoPlayer.setSpeed(speed).then(() => { - console.info('setSpeed success'); - }, this.failureCallback).catch(this.catchCallback); - - // Stop playback. - await videoPlayer.stop().then(() => { - console.info('stop success'); - }, this.failureCallback).catch(this.catchCallback); - - // Reset the playback configuration. - await videoPlayer.reset().then(() => { - console.info('reset success'); - }, this.failureCallback).catch(this.catchCallback); - - // Release playback resources. - await videoPlayer.release().then(() => { - console.info('release success'); - }, this.failureCallback).catch(this.catchCallback); - - // Set the related instances to undefined. - videoPlayer = undefined; - surfaceID = undefined; - } -} -``` - -### Normal Playback Scenario - -```js -import media from '@ohos.multimedia.media' -import fs from '@ohos.file.fs' -export class VideoPlayerDemo { - // Report an error in the case of a function invocation failure. - failureCallback(error) { - console.info(`error happened,error Name is ${error.name}`); - console.info(`error happened,error Code is ${error.code}`); - console.info(`error happened,error Message is ${error.message}`); - } - - // Report an error in the case of a function invocation exception. - catchCallback(error) { - console.info(`catch error happened,error Name is ${error.name}`); - console.info(`catch error happened,error Code is ${error.code}`); - console.info(`catch error happened,error Message is ${error.message}`); - } - - // Used to print the video track information. - printfDescription(obj) { - for (let item in obj) { - let property = obj[item]; - console.info('key is ' + item); - console.info('value is ' + property); - } - } - - async videoPlayerDemo() { - let videoPlayer = undefined; - let surfaceID = 'test' // The surfaceID parameter is used for screen display. Its value is obtained through the XComponent API. For details about the document link, see the method of creating the XComponent. - let fdPath = 'fd://' - // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\H264_AAC.mp4 /data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile" command. - let path = '/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/H264_AAC.mp4'; + }) + } + + // The following demo shows how to use the file system to open the sandbox address, obtain the media file address, and play the media file using the URL attribute. + async avPlayerUrlDemo() { + // Create an AVPlayer instance. + this.avPlayer = await media.createAVPlayer(); + // Set a callback function for state changes. + this.setAVPlayerCallback(); + let fdPath = 'fd://'; + let context = getContext(this) as common.UIAbilityContext; + // Obtain the sandbox address filesDir through UIAbilityContext. The stage model is used as an example. + let pathDir = context.filesDir; + let path = pathDir + '/H264_AAC.mp4'; + // Open the corresponding file address to obtain the file descriptor and assign a value to the URL to trigger the reporting of the initialized state. let file = await fs.open(path); fdPath = fdPath + '' + file.fd; - // Call createVideoPlayer to create a VideoPlayer instance. - await media.createVideoPlayer().then((video) => { - if (typeof (video) != 'undefined') { - console.info('createVideoPlayer success!'); - videoPlayer = video; - } else { - console.info('createVideoPlayer fail!'); - } - }, this.failureCallback).catch(this.catchCallback); - // Set the playback source for the player. - videoPlayer.url = fdPath; - - // Set the surface ID to display the video image. - await videoPlayer.setDisplaySurface(surfaceID).then(() => { - console.info('setDisplaySurface success'); - }, this.failureCallback).catch(this.catchCallback); - - // Call the prepare API to prepare for playback. - await videoPlayer.prepare().then(() => { - console.info('prepare success'); - }, this.failureCallback).catch(this.catchCallback); - - // Call the play API to start playback. - await videoPlayer.play().then(() => { - console.info('play success'); - }, this.failureCallback).catch(this.catchCallback); - - // Stop playback. - await videoPlayer.stop().then(() => { - console.info('stop success'); - }, this.failureCallback).catch(this.catchCallback); - - // Release playback resources. - await videoPlayer.release().then(() => { - console.info('release success'); - }, this.failureCallback).catch(this.catchCallback); - - // Set the related instances to undefined. - videoPlayer = undefined; - surfaceID = undefined; + this.avPlayer.url = fdPath; + } + + // The following demo shows how to use resourceManager to obtain the media file packed in the HAP file and play the media file by using the fdSrc attribute. + async avPlayerFdSrcDemo() { + // Create an AVPlayer instance. + this.avPlayer = await media.createAVPlayer(); + // Set a callback function for state changes. + this.setAVPlayerCallback(); + // Call getRawFd of the resourceManager member of UIAbilityContext to obtain the media asset URL. + // The return type is {fd,offset,length}, where fd indicates the file descriptor address of the HAP file, offset indicates the media asset offset, and length indicates the duration of the media asset to play. + let context = getContext(this) as common.UIAbilityContext; + let fileDescriptor = await context.resourceManager.getRawFd('H264_AAC.mp4'); + // Assign a value to fdSrc to trigger the reporting of the initialized state. + this.avPlayer.fdSrc = fileDescriptor; } } ``` -### Switching to the Next Video Clip - -```js -import media from '@ohos.multimedia.media' -import fs from '@ohos.file.fs' -export class VideoPlayerDemo { - // Report an error in the case of a function invocation failure. - failureCallback(error) { - console.info(`error happened,error Name is ${error.name}`); - console.info(`error happened,error Code is ${error.code}`); - console.info(`error happened,error Message is ${error.message}`); - } - - // Report an error in the case of a function invocation exception. - catchCallback(error) { - console.info(`catch error happened,error Name is ${error.name}`); - console.info(`catch error happened,error Code is ${error.code}`); - console.info(`catch error happened,error Message is ${error.message}`); - } - - // Used to print the video track information. - printfDescription(obj) { - for (let item in obj) { - let property = obj[item]; - console.info('key is ' + item); - console.info('value is ' + property); - } - } - - async videoPlayerDemo() { - let videoPlayer = undefined; - let surfaceID = 'test' // The surfaceID parameter is used for screen display. Its value is obtained through the XComponent API. For details about the document link, see the method of creating the XComponent. - let fdPath = 'fd://' - // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\H264_AAC.mp4 /data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile" command. - let path = '/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/H264_AAC.mp4'; - let nextPath = '/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/MP4_AAC.mp4'; - let file = await fs.open(path); - fdPath = fdPath + '' + file.fd; - // Call createVideoPlayer to create a VideoPlayer instance. - await media.createVideoPlayer().then((video) => { - if (typeof (video) != 'undefined') { - console.info('createVideoPlayer success!'); - videoPlayer = video; - } else { - console.info('createVideoPlayer fail!'); - } - }, this.failureCallback).catch(this.catchCallback); - // Set the playback source for the player. - videoPlayer.url = fdPath; - - // Set the surface ID to display the video image. - await videoPlayer.setDisplaySurface(surfaceID).then(() => { - console.info('setDisplaySurface success'); - }, this.failureCallback).catch(this.catchCallback); - - // Call the prepare API to prepare for playback. - await videoPlayer.prepare().then(() => { - console.info('prepare success'); - }, this.failureCallback).catch(this.catchCallback); - - // Call the play API to start playback. - await videoPlayer.play().then(() => { - console.info('play success'); - }, this.failureCallback).catch(this.catchCallback); - - // Reset the playback configuration. - await videoPlayer.reset().then(() => { - console.info('reset success'); - }, this.failureCallback).catch(this.catchCallback); - - // Obtain the next video FD address. - fdPath = 'fd://' - let nextFile = await fs.open(nextPath); - fdPath = fdPath + '' + nextFile.fd; - // Set the second video playback source. - videoPlayer.url = fdPath; - - // Call the prepare API to prepare for playback. - await videoPlayer.prepare().then(() => { - console.info('prepare success'); - }, this.failureCallback).catch(this.catchCallback); - - // Call the play API to start playback. - await videoPlayer.play().then(() => { - console.info('play success'); - }, this.failureCallback).catch(this.catchCallback); - - // Release playback resources. - await videoPlayer.release().then(() => { - console.info('release success'); - }, this.failureCallback).catch(this.catchCallback); - - // Set the related instances to undefined. - videoPlayer = undefined; - surfaceID = undefined; - } -} -``` - -### Looping a Video Clip - -```js -import media from '@ohos.multimedia.media' -import fs from '@ohos.file.fs' -export class VideoPlayerDemo { - // Report an error in the case of a function invocation failure. - failureCallback(error) { - console.info(`error happened,error Name is ${error.name}`); - console.info(`error happened,error Code is ${error.code}`); - console.info(`error happened,error Message is ${error.message}`); - } - - // Report an error in the case of a function invocation exception. - catchCallback(error) { - console.info(`catch error happened,error Name is ${error.name}`); - console.info(`catch error happened,error Code is ${error.code}`); - console.info(`catch error happened,error Message is ${error.message}`); - } - - // Used to print the video track information. - printfDescription(obj) { - for (let item in obj) { - let property = obj[item]; - console.info('key is ' + item); - console.info('value is ' + property); - } - } - - async videoPlayerDemo() { - let videoPlayer = undefined; - let surfaceID = 'test' // The surfaceID parameter is used for screen display. Its value is obtained through the XComponent API. For details about the document link, see the method of creating the XComponent. - let fdPath = 'fd://' - // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\H264_AAC.mp4 /data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile" command. - let path = '/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/H264_AAC.mp4'; - let file = await fs.open(path); - fdPath = fdPath + '' + file.fd; - // Call createVideoPlayer to create a VideoPlayer instance. - await media.createVideoPlayer().then((video) => { - if (typeof (video) != 'undefined') { - console.info('createVideoPlayer success!'); - videoPlayer = video; - } else { - console.info('createVideoPlayer fail!'); - } - }, this.failureCallback).catch(this.catchCallback); - // Set the playback source for the player. - videoPlayer.url = fdPath; - - // Set the surface ID to display the video image. - await videoPlayer.setDisplaySurface(surfaceID).then(() => { - console.info('setDisplaySurface success'); - }, this.failureCallback).catch(this.catchCallback); - - // Call the prepare API to prepare for playback. - await videoPlayer.prepare().then(() => { - console.info('prepare success'); - }, this.failureCallback).catch(this.catchCallback); - // Set the loop playback attribute. - videoPlayer.loop = true; - // Call the play API to start loop playback. - await videoPlayer.play().then(() => { - console.info('play success, loop value is ' + videoPlayer.loop); - }, this.failureCallback).catch(this.catchCallback); - } -} -``` + \ No newline at end of file diff --git a/en/application-dev/media/video-recorder.md b/en/application-dev/media/video-recorder.md deleted file mode 100644 index fd9de91b4bae0591e2a5dc4869455bdd4055943e..0000000000000000000000000000000000000000 --- a/en/application-dev/media/video-recorder.md +++ /dev/null @@ -1,160 +0,0 @@ -# Video Recording Development - -## Introduction - -You can use video recording APIs to capture audio and video signals, encode them, and save them to files. You can start, suspend, resume, and stop recording, and release resources. You can also specify parameters such as the encoding format, encapsulation format, and file path for video recording. - -## Working Principles - -The following figures show the video recording state transition and the interaction with external modules for video recording. - -**Figure 1** Video recording state transition - -![en-us_image_video_recorder_state_machine](figures/en-us_image_video_recorder_state_machine.png) - -**Figure 2** Interaction with external modules for video recording - -![en-us_image_video_recorder_zero](figures/en-us_image_video_recorder_zero.png) - -**NOTE**: When a third-party camera application or system camera calls a JS interface provided by the JS interface layer, the framework layer uses the media service of the native framework to invoke the audio component. Through the audio HDI, the audio component captures audio data, encodes the audio data through software, and saves the encoded audio data to a file. The graphics subsystem captures image data through the video HDI, encodes the image data through the video codec HDI, and saves the encoded image data to a file. In this way, video recording is implemented. - -## Constraints - -Before developing video recording, configure the permissions **ohos.permission.MICROPHONE** and **ohos.permission.CAMERA** for your application. For details about the configuration, see [Permission Application Guide](../security/accesstoken-guidelines.md). - -## How to Develop - -For details about the APIs, see [VideoRecorder in the Media API](../reference/apis/js-apis-media.md#videorecorder9). - -### Full-Process Scenario - -The full video recording process includes creating an instance, setting recording parameters, starting, pausing, resuming, and stopping recording, and releasing resources. - -```js -import media from '@ohos.multimedia.media' -import mediaLibrary from '@ohos.multimedia.mediaLibrary' -export class VideoRecorderDemo { - private testFdNumber; // Used to save the FD address. - // pathName indicates the passed recording file name, for example, 01.mp4. The generated file address is /storage/media/100/local/files/Video/01.mp4. - // To use the media library, declare the following permissions: ohos.permission.MEDIA_LOCATION, ohos.permission.WRITE_MEDIA, and ohos.permission.READ_MEDIA. - async getFd(pathName) { - let displayName = pathName; - const mediaTest = mediaLibrary.getMediaLibrary(); - let fileKeyObj = mediaLibrary.FileKey; - let mediaType = mediaLibrary.MediaType.VIDEO; - let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); - let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath); - if (dataUri != undefined) { - let args = dataUri.id.toString(); - let fetchOp = { - selections : fileKeyObj.ID + "=?", - selectionArgs : [args], - } - let fetchFileResult = await mediaTest.getFileAssets(fetchOp); - let fileAsset = await fetchFileResult.getAllObject(); - let fdNumber = await fileAsset[0].open('Rw'); - this.testFdNumber = "fd://" + fdNumber.toString(); - } - } - - // Error callback triggered in the case of an error - failureCallback(error) { - console.info('error happened, error name is ' + error.name); - console.info('error happened, error code is ' + error.code); - console.info('error happened, error message is ' + error.message); - } - - // Error callback triggered in the case of an exception - catchCallback(error) { - console.info('catch error happened, error name is ' + error.name); - console.info('catch error happened, error code is ' + error.code); - console.info('catch error happened, error message is ' + error.message); - } - - async videoRecorderDemo() { - let videoRecorder = null; // videoRecorder is an empty object and assigned with a value after createVideoRecorder is successfully called. - let surfaceID = null; // Used to save the surface ID returned by getInputSurface. - // Obtain the FD address of the video to be recorded. - await this.getFd('01.mp4'); - // Configure the parameters related to video recording based on those supported by the hardware device. - let videoProfile = { - audioBitrate : 48000, - audioChannels : 2, - audioCodec : 'audio/mp4a-latm', - audioSampleRate : 48000, - fileFormat : 'mp4', - videoBitrate : 2000000, - videoCodec : 'video/mp4v-es', - videoFrameWidth : 640, - videoFrameHeight : 480, - videoFrameRate : 30 - } - - let videoConfig = { - audioSourceType : 1, - videoSourceType : 0, - profile : videoProfile, - url : this.testFdNumber, // testFdNumber is generated by getFd. - orientationHint : 0, - location : { latitude : 30, longitude : 130 } - } - // Create a VideoRecorder object. - await media.createVideoRecorder().then((recorder) => { - console.info('case createVideoRecorder called'); - if (typeof (recorder) != 'undefined') { - videoRecorder = recorder; - console.info('createVideoRecorder success'); - } else { - console.info('createVideoRecorder failed'); - } - }, this.failureCallback).catch(this.catchCallback); - - // Call the prepare API to prepare for video recording. - await videoRecorder.prepare(videoConfig).then(() => { - console.info('prepare success'); - }, this.failureCallback).catch(this.catchCallback); - - // Obtain the surface ID, save it, and pass it to camera-related APIs. - await videoRecorder.getInputSurface().then((surface) => { - console.info('getInputSurface success'); - surfaceID = surface; - }, this.failureCallback).catch(this.catchCallback); - - // Video recording depends on camera-related APIs. The following operations can be performed only after the video output start API is invoked. For details about how to call the camera APIs, see the samples. - // Start video recording. - await videoRecorder.start().then(() => { - console.info('start success'); - }, this.failureCallback).catch(this.catchCallback); - - // Pause video recording before the video output stop API of the camera is invoked. - await videoRecorder.pause().then(() => { - console.info('pause success'); - }, this.failureCallback).catch(this.catchCallback); - - // Resume video recording after the video output start API of the camera is invoked. - await videoRecorder.resume().then(() => { - console.info('resume success'); - }, this.failureCallback).catch(this.catchCallback); - - // Stop video recording after the video output stop API of the camera is invoked. - await videoRecorder.stop().then(() => { - console.info('stop success'); - }, this.failureCallback).catch(this.catchCallback); - - // Reset the recording configuration. - await videoRecorder.reset().then(() => { - console.info('reset success'); - }, this.failureCallback).catch(this.catchCallback); - - // Release the video recording resources and camera object resources. - await videoRecorder.release().then(() => { - console.info('release success'); - }, this.failureCallback).catch(this.catchCallback); - - // Set the related object to null. - videoRecorder = undefined; - surfaceID = undefined; - } -} -``` - diff --git a/en/application-dev/media/video-recording.md b/en/application-dev/media/video-recording.md new file mode 100644 index 0000000000000000000000000000000000000000..8eabb4e1aad61f954135832ff2e5439912acdb34 --- /dev/null +++ b/en/application-dev/media/video-recording.md @@ -0,0 +1,237 @@ +# Video Recording + +OpenHarmony provides the AVRecorder for you to develop the video recording service. The AVRecorder supports audio recording, audio encoding, video encoding, audio encapsulation, and video encapsulation. It is applicable to simple video recording scenarios and can be used to generate local video files directly. + +You will learn how to use the AVRecorder to complete the process of starting, pausing, resuming, and stopping recording. + +During application development, you can use the **state** attribute of the AVRecorder to obtain the AVRecorder state or call **on('stateChange')** to listen for state changes. Your code must meet the state machine requirements. For example, **pause()** is called only when the AVRecorder is in the **started** state, and **resume()** is called only when it is in the **paused** state. + +**Figure 1** Recording state transition + +![Recording state change](figures/video-recording-status-change.png) + +For details about the state, see [AVRecorderState](../reference/apis/js-apis-media.md#avrecorderstate9). + +## How to Develop + +> **NOTE** +> +> The AVRecorder only processes video data. To complete video recording, it must work with the video data collection module, which transfers the captured video data to the AVRecorder for data processing through the surface. A typical video data collection module is the camera module, which currently is available only to system applications. For details, see [Camera](../reference/apis/js-apis-camera.md). + +Read [AVRecorder](../reference/apis/js-apis-media.md#avrecorder9) for the API reference. + +1. Create an **AVRecorder** instance. The AVRecorder is the **idle** state. + + ```ts + import media from '@ohos.multimedia.media' + let avRecorder + media.createAVRecorder().then((recorder) => { + avRecorder = recorder + }, (error) => { + console.error('createAVRecorder failed') + }) + ``` + +2. Set the events to listen for. + | Event Type| Description| + | -------- | -------- | + | stateChange | Mandatory; used to listen for changes of the **state** attribute of the AVRecorder.| + | error | Mandatory; used to listen for AVRecorder errors.| + + ```ts + // Callback function for state changes. + avRecorder.on('stateChange', (state, reason) => { + console.info('current state is: ' + state); + }) + // Callback function for errors. + avRecorder.on('error', (err) => { + console.error('error happened, error message is ' + err); + }) + ``` + +3. Set video recording parameters and call **prepare()**. The AVRecorder enters the **prepared** state. + > **NOTE** + > + > Pay attention to the following when configuring parameters: + > + > - In pure video recording scenarios, set only video-related parameters in **avConfig** of **prepare()**. + > If audio-related parameters are configured, the system regards it as audio and video recording. + > + > - The [recording specifications](avplayer-avrecorder-overview.md#supported-formats) in use must be those supported. The video bit rate, resolution, and frame rate are subject to the ranges supported by the hardware device. + > + > - The recording output URL (URL in **avConfig** in the sample code) must be in the format of fd://xx (where xx indicates a file descriptor). You must call [ohos.file.fs](../reference/apis/js-apis-file-fs.md) to implement access to the application file. For details, see [Application File Access and Management](../file-management/app-file-access.md). + + ```ts + let avProfile = { + fileFormat: media.ContainerFormatType.CFT_MPEG_4, // Video file encapsulation format. Only MP4 is supported. + videoBitrate: 200000, // Video bit rate. + videoCodec: media.CodecMimeType.VIDEO_AVC, // Video file encoding format. Both MPEG-4 and AVC are supported. + videoFrameWidth: 640, // Video frame width. + videoFrameHeight: 480, // Video frame height. + videoFrameRate: 30 // Video frame rate. + } + let avConfig = { + videoSourceType: media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV, // Video source type. YUV and ES are supported. + profile : this.avProfile, + url: 'fd://35', // Create, read, and write a file by referring to the sample code in Application File Access and Management. + rotation: 0, // Video rotation angle. The default value is 0, indicating that the video is not rotated. The value can be 0, 90, 180, or 270. + } + avRecorder.prepare(avConfig).then(() => { + console.info('avRecorder prepare success') + }, (error) => { + console.error('avRecorder prepare failed') + }) + ``` + +4. Obtain the surface ID required for video recording. + + Call **getInputSurface()**. The returned surface ID is transferred to the video data collection module (video input source), which is the camera module in the sample code. + + The video data collection module obtains the surface based on the surface ID and transmits video data to the AVRecorder through the surface. Then the AVRecorder processes the video data. + + ```ts + avRecorder.getInputSurface().then((surfaceId) => { + console.info('avRecorder getInputSurface success') + }, (error) => { + console.error('avRecorder getInputSurface failed') + }) + ``` + +5. Initialize the video data input source. + + This step is performed in the video data collection module. For the camera module, you need to create a **Camera** instance, obtain the camera list, create a camera input stream, and create a video output stream. For details, see [Recording](camera-recording-case.md). + +6. Start recording. + + Start the input source to input video data, for example, by calling **camera.VideoOutput.start**. Then call **AVRecorder.start()** to switch the AVRecorder to the **started** state. + +7. Call **pause()** to pause recording. The AVRecorder enters the **paused** state. In addition, pause data input in the video data collection module, for example, by calling **camera.VideoOutput.stop**. + +8. Call **resume()** to resume recording. The AVRecorder enters the **started** state again. + +9. Call **stop()** to stop recording. The AVRecorder enters the **stopped** state again. In addition, stop camera recording in the video data collection module. + +10. Call **reset()** to reset the resources. The AVRecorder enters the **idle** state. In this case, you can reconfigure the recording parameters. + +11. Call **release()** to release the resources. The AVRecorder enters the **released** state. In addition, release the video data input source resources (camera resources in this example). + + +## Sample Code + +Refer to the sample code below to complete the process of starting, pausing, resuming, and stopping recording. + + +```ts +import media from '@ohos.multimedia.media' +const TAG = 'VideoRecorderDemo:' +export class VideoRecorderDemo { + private avRecorder; + private videoOutSurfaceId; + private avProfile = { + fileFormat: media.ContainerFormatType.CFT_MPEG_4, // Video file encapsulation format. Only MP4 is supported. + videoBitrate : 100000, // Video bit rate. + videoCodec: media.CodecMimeType.VIDEO_AVC, // Video file encoding format. Both MPEG-4 and AVC are supported. + videoFrameWidth: 640, // Video frame width. + videoFrameHeight: 480, // Video frame height. + videoFrameRate: 30 // Video frame rate. + } + private avConfig = { + videoSourceType: media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV, // Video source type. YUV and ES are supported. + profile : this.avProfile, + url: 'fd://35', // Create, read, and write a file by referring to the sample code in Application File Access and Management. + rotation: 0, // Video rotation angle. The default value is 0, indicating that the video is not rotated. The value can be 0, 90, 180, or 270. + } + + // Set AVRecorder callback functions. + setAvRecorderCallback() { + // Callback function for state changes. + this.avRecorder.on('stateChange', (state, reason) => { + console.info(TAG + 'current state is: ' + state); + }) + // Callback function for errors. + this.avRecorder.on('error', (err) => { + console.error(TAG + 'error ocConstantSourceNode, error message is ' + err); + }) + } + + // Complete camera-related preparations. + async prepareCamera() { + // For details on the implementation, see the camera document. + } + + // Start the camera stream output. + async startCameraOutput() { + // Call start of the VideoOutput class to start video output. + } + + // Stop the camera stream output. + async stopCameraOutput() { + // Call stop of the VideoOutput class to stop video output. + } + + // Release the camera instance. + async releaseCamera() { + // Release the instances created during camera preparation. + } + + // Process of starting recording. + async startRecordingProcess() { + // 1. Create an AVRecorder instance. + this.avRecorder = await media.createAVRecorder(); + this.setAvRecorderCallback(); + // 2. Obtain the file descriptor of the recorded file. The obtained file descriptor is passed in to the URL in avConfig. The implementation is omitted here. + // 3. Set recording parameters to complete the preparations. + await this.avRecorder.prepare(this.avConfig); + this.videoOutSurfaceId = await this.avRecorder.getInputSurface(); + // 4. Complete camera-related preparations. + await this.prepareCamera(); + // 5. Start the camera stream output. + await this.startCameraOutput(); + // 6. Start recording. + await this.videoRecorder.start(); + } + + // Process of pausing recording. + async pauseRecordingProcess() { + if (this.avRecorder.state ==='started') { // pause() can be called only when the AVRecorder is in the started state . + await this.avRecorder.pause(); + await this.stopCameraOutput(); // Stop the camera stream output. + } + } + + // Process of resuming recording. + async resumeRecordingProcess() { + if (this.avRecorder.state === 'paused') { // resume() can be called only when the AVRecorder is in the paused state . + await this.startCameraOutput(); // Start camera stream output. + await this.avRecorder.resume(); + } + } + + async stopRecordingProcess() { + // 1. Stop recording. + if (this.avRecorder.state === 'started' + || this.avRecorder.state ==='paused') { // stop() can be called only when the AVRecorder is in the started or paused state. + await this.avRecorder.stop(); + await this.stopCameraOutput(); + } + // 2. Reset the AVRecorder. + await this.avRecorder.reset(); + // 3. Release the AVRecorder instance. + await this.avRecorder.release(); + // 4. After the file is recorded, close the file descriptor. The implementation is omitted here. + // 5. Release the camera instance. + await this.releaseCamera(); + } + + // Complete sample code for starting, pausing, resuming, and stopping recording. + async videoRecorderDemo() { + await this.startRecordingProcess(); // Start recording. + // You can set the recording duration. For example, you can set the sleep mode to prevent code execution. + await this.pauseRecordingProcess(); // Pause recording. + await this.resumeRecordingProcess(); // Resume recording. + await this.stopRecordingProcess(); // Stop recording. + } +} +``` + + \ No newline at end of file diff --git a/en/application-dev/media/volume-management.md b/en/application-dev/media/volume-management.md new file mode 100644 index 0000000000000000000000000000000000000000..f6461d968856c7d865c999ab9c604e5ef718548b --- /dev/null +++ b/en/application-dev/media/volume-management.md @@ -0,0 +1,48 @@ +# Volume Management + +You can use different APIs to manage the system volume and audio stream volume. The system volume and audio stream volume refer to the volume of a OpenHarmony device and the volume of a specified audio stream, respectively. The audio stream volume is restricted by the system volume. + +## System Volume + +The API for managing the system volume is **AudioVolumeManager**. Before using this API, you must call **getVolumeManager()** to obtain an **AudioVolumeManager** instance. Currently, this API can be used to obtain volume information and listen for volume changes. It cannot be used to adjust the system volume. + +```ts +import audio from '@ohos.multimedia.audio'; +let audioManager = audio.getAudioManager(); +let audioVolumeManager = audioManager.getVolumeManager(); +``` + +### Listening for System Volume Changes + +You can set an event to listen for system volume changes. + +```ts +audioVolumeManager.on('volumeChange', (volumeEvent) => { + console.info(`VolumeType of stream: ${volumeEvent.volumeType} `); + console.info(`Volume level: ${volumeEvent.volume} `); + console.info(`Whether to updateUI: ${volumeEvent.updateUi} `); +}); +``` + +### Adjusting the System Volume (for System Applications Only) + +Currently, the system volume is mainly adjusted by using system APIs, which serve the physical volume button and the Settings application. When the user presses the volume button, a system API is called to adjust the system volume, including the volume for media, ringtone, or notification. + +## Audio Stream Volume + +The API for managing the audio stream volume is **setVolume()** in the **AVPlayer** or **AudioRenderer** class. The code snippet below is used for setting the audio stream volume by using the **AVPlayer** class: + +```ts +let volume = 1.0 // Specified volume. The value range is [0.00-1.00]. The value 1 indicates the maximum volume. +avPlayer.setVolume(volume) +``` + +The code snippet below is used for setting the audio stream volume by using the **AudioRenderer** class: + +```ts +audioRenderer.setVolume(0.5).then(data=>{ // The volume range is [0.0-1.0]. + console.info('Invoke setVolume succeeded.'); +}).catch((err) => { + console.error(`Invoke setVolume failed, code is ${err.code}, message is ${err.message}`); +}); +``` diff --git a/en/application-dev/napi/Readme-EN.md b/en/application-dev/napi/Readme-EN.md index b7e5367f1697800cafe3094c5a5a8f2cdb56677e..c6bdba99546cafb30a88b9b39c3cd552dfd4419e 100644 --- a/en/application-dev/napi/Readme-EN.md +++ b/en/application-dev/napi/Readme-EN.md @@ -1,6 +1,65 @@ # Native APIs +Native APIs are a set of native development interfaces and tools provided by the OHOS SDK. It enables the use of C or C++ code to implement key application functionalities. Native APIs provide part of basic underlying capabilities of OHOS, such as libc, graphics library, window system, multimedia, and compression library. They do not provide complete OHOS platform capabilities as JS APIs do. Native APIs are compiled into a dynamic library before being packed into the application. +## Native API Composition + +### Native API Directory Structure + +Native APIs are stored in the **$(SDK_ROOT)/native** directory of the SDK. They consist of the following parts: + +|Directory|Description| +|--|--| +|build|Used to build the toolchain.cmake script of the dynamic library in the application. The **ohos.toolchain.cmake** file in this directory defines OHOS cross compilation options.| +|build-tools|Stores build tools, such as CMake.| +|docs|Stores Native API reference documents, which is extracted from the header files using Doxgen.| +|llvm|Stores LLVM, a cross compiler that supports OHOS ABIs.| +|sysroot|Stores dependent files of build links, including header files and dynamic libraries.| + +### Native APIs + +|Category|Function|Introduced In| +|--|--|--| +|C standard library|C standard library interfaces based on musl. Currently, more than 1500 interfaces are provided.|API version 8| +|C++ standard library|C++ runtime library libc++_shared. This library must be packed or statically linked to the application during packing.|API version 8| +|Log|HiLog interfaces for printing logs to the system|API version 8| +|napi|A group of Node-APIs provided by ArkUI to facilitate access to the JS application environment during application development. Node-APIs are part of native APIs.|API version 8| +|XComponent|Provides surface and touchscreen event interfaces for developing high-performance graphics applications.|API version 8| +|libuv|Third-party asynchronous I/O library integrated by ArkUI.|API version 8| +|libz|zlib library that provides basic compression and decompression interfaces.|API version 8| +|Drawing|2D graphics library that can be used for drawing on the surface.|API version 8| +|OpenGL|OpenGL 3.0 interfaces.|API version 8| +|Rawfile|Application resource access interfaces that can be used to read various resources packed in the application.|API version 8| +|OpenSLES|Interface library used for 2D and 3D audio acceleration.|API version 8| +|Mindspore|AI model interface library.|API version 9| +|Bundle management|Bundle service interfaces that can be used to query bundle information of the application.|API version 8| + +Some native APIs use open source standards. For details, see [Native Standard Libraries Supported by OpenHarmony](https://docs.openharmony.cn/pages/v3.1/en/application-dev/reference/native-lib/third_party_libc/musl.md/) and [Node_API](https://docs.openharmony.cn/pages/v3.1/en/application-dev/reference/native-lib/third_party_napi/napi.md/). + +## Usage Guidelines + +### Scenarios Where Native APIs Are Recommended + +You can use native APIs when you want to: + +1. Develop performance-sensitive code in computing-intensive scenarios such as gaming and physical simulation. +2. Reuse the existing C or C++ library. +3. Customize libraries related to CPU features, such as neon acceleration. + +### Scenarios Where Native APIs Are Not Recommended + +You do not need to use native APIs when you want to: + +1. Write a native OHOS application. +2. Develop an application compatible on as many OHOS devices as possible. + +# Native API References + +- [Native API hello world]() + + This sample shows how to develop a hello native API library, which can display strings obtained from the hello library on the TS page. - [Using Native APIs in Application Projects](napi-guidelines.md) + + This document describes how to use native APIs to interact with modules, interfaces, and asynchronous tasks in JS. - [Drawing Development](drawing-guidelines.md) - [Raw File Development](rawfile-guidelines.md) - [Native Window Development](native-window-guidelines.md) diff --git a/en/application-dev/napi/drawing-guidelines.md b/en/application-dev/napi/drawing-guidelines.md index a48a081a3e69ea8259727efd343264f80c6cc284..22d85aec0fe405e47cd92abeafa94ba5e7b7ed5f 100644 --- a/en/application-dev/napi/drawing-guidelines.md +++ b/en/application-dev/napi/drawing-guidelines.md @@ -189,7 +189,7 @@ The following steps describe how to use the text drawing and display feature of OH_Drawing_CreateFontCollection()); OH_Drawing_TypographyHandlerPushTextStyle(handler, txtStyle); // Set the text content. - const char* text = "OpenHarmony\n"; + const char* text = "Hello World\n"; OH_Drawing_TypographyHandlerAddText(handler, text); OH_Drawing_TypographyHandlerPopTextStyle(handler); OH_Drawing_Typography* typography = OH_Drawing_CreateTypography(handler); diff --git a/en/application-dev/napi/neural-network-runtime-guidelines.md b/en/application-dev/napi/neural-network-runtime-guidelines.md index 9ae694fc12449634a75fae260050188b68e97804..0c86fd05801197bdd63a885c2071f258687a768e 100644 --- a/en/application-dev/napi/neural-network-runtime-guidelines.md +++ b/en/application-dev/napi/neural-network-runtime-guidelines.md @@ -244,7 +244,7 @@ The development process of the Neural Network Runtime consists of three phases: // Create a compilation instance to pass the model to the underlying hardware for compilation. OH_NNCompilation* compilation = OH_NNCompilation_Construct(model); if (compilation == nullptr) { - std::cout << "CreateCompilation failed, error happended when creating compilation." << std::endl; + std::cout << "CreateCompilation failed, error happened when creating compilation." << std::endl; return OH_NN_MEMORY_ERROR; } diff --git a/en/application-dev/notification/Readme-EN.md b/en/application-dev/notification/Readme-EN.md index bf85581053f30d6aa56e0218c51339ef6ee3f268..55070f9e38666be2c6cd5cf87b3d3680df0293ba 100644 --- a/en/application-dev/notification/Readme-EN.md +++ b/en/application-dev/notification/Readme-EN.md @@ -1,7 +1,7 @@ # Notification - [Notification Overview](notification-overview.md) -- [Notification Subscription (Open Only to System Applications)](notification-subscription.md) +- [Notification Subscription (for System Applications)](notification-subscription.md) - [Enabling Notification](notification-enable.md) - Publishing a Notification - [Publishing a Basic Notification](text-notification.md) diff --git a/en/application-dev/notification/notification-subscription.md b/en/application-dev/notification/notification-subscription.md index c62b65a25c4d80b37610449e6309e05ef259893f..95fe77de7feead97208082c12519523588cd6521 100644 --- a/en/application-dev/notification/notification-subscription.md +++ b/en/application-dev/notification/notification-subscription.md @@ -1,4 +1,4 @@ -# Notification Subscription (Open Only to System Applications) +# Notification Subscription (for System Applications Only) To receive notifications, an application must subscribe to notifications first. The notification subsystem provides two types of subscription APIs, allowing applications to subscribe to notifications from all applications or notifications from a specific application. diff --git a/en/application-dev/notification/progress-bar-notification.md b/en/application-dev/notification/progress-bar-notification.md index d79f09578a0dc58b0aa53e45b68264f85e67e2c2..db7cae812218c2f7b6c363d204baa04dfeeb639f 100644 --- a/en/application-dev/notification/progress-bar-notification.md +++ b/en/application-dev/notification/progress-bar-notification.md @@ -3,7 +3,7 @@ The progress notification is a commonly used notification type, mainly used to display the progress of an ongoing operation, such as file downloading. When publishing a progress notification through the notification subsystem, you can use the readily available template by specifying the related attributes, such as the template name and template data. -In the [NotificationTemplate](../reference/apis/js-apis-notificationManager.md#notificationtemplate), which can only be of the progress type, **data** indicates custom template data. +In the [NotificationTemplate](../reference/apis/js-apis-inner-notification-notificationTemplate.md), which can only be of the progress type, **data** indicates custom template data. ## Available APIs @@ -27,7 +27,7 @@ In the [NotificationTemplate](../reference/apis/js-apis-notificationManager.md#n ```ts notificationManager.isSupportTemplate('downloadTemplate').then((data) => { console.info(`[ANS] isSupportTemplate success`); - let isSupportTpl: boolean = data; // The value **true** means that the template of the **downloadTemplate** type is supported; and false means the opposite. + let isSupportTpl: boolean = data; // The value true means that the template of the downloadTemplate type is supported, and false means the opposite. // ... }).catch((err) => { console.error(`[ANS] isSupportTemplate failed, code is ${err.code}, message is ${err.message}`); diff --git a/en/application-dev/notification/text-notification.md b/en/application-dev/notification/text-notification.md index a9d9bdaaaccc731f0e7cec7e3f7a7e74a3aa41d6..7901a78a4c547ca02caae191b551d27f6cae3e3a 100644 --- a/en/application-dev/notification/text-notification.md +++ b/en/application-dev/notification/text-notification.md @@ -127,10 +127,10 @@ The following table describes the APIs for notification publishing. You specify Below is an example of the multi-line notification. ![en-us_image_0000001417062446](figures/en-us_image_0000001417062446.png) - - In addition to the parameters in the normal text notification, the picture-attached text notification provides the **picture**, **briefText**, and **expandedTitle** parameters. The value of **picture** is a pixel map that does not exceed 2 MB. + - In addition to the parameters in the normal text notification, the picture-attached text notification provides the **picture**, **briefText**, and **expandedTitle** parameters. The value of **picture** is a [PixelMap](../reference/apis/js-apis-image.md#pixelmap7) object that does not exceed 2 MB. ```ts - let notificationPicture: PixelMap = undefined; // Obtain the pixel map information. + let imagePixelMap: PixelMap = undefined; // Obtain the PixelMap information. let notificationRequest: notificationManager.NotificationRequest = { id: 1, content: { @@ -141,7 +141,7 @@ The following table describes the APIs for notification publishing. You specify additionalText: 'test_additionalText', briefText: 'test_briefText', expandedTitle: 'test_expandedTitle', - picture: notificationPicture + picture: imagePixelMap } } } diff --git a/en/application-dev/quick-start/Readme-EN.md b/en/application-dev/quick-start/Readme-EN.md index 439bbdcb9d9455a36c75ceb8ba39e728d1aecebd..91136d49f0db6aa18ecc86447894b922f9c263ff 100644 --- a/en/application-dev/quick-start/Readme-EN.md +++ b/en/application-dev/quick-start/Readme-EN.md @@ -1,4 +1,5 @@ # Quick Start + - Getting Started - [Before You Start](start-overview.md) - [Getting Started with ArkTS in Stage Model](start-with-ets-stage.md) @@ -10,7 +11,6 @@ - Application Package Structure - [Application Package Structure in Stage Model](application-package-structure-stage.md) - [Application Package Structure in FA Model](application-package-structure-fa.md) - - [HAR File Structure](har-structure.md) - Multi-HAP Mechanism - [Multi-HAP Design Objectives](multi-hap-objective.md) - [Multi-HAP Build View](multi-hap-build-view.md) @@ -18,6 +18,16 @@ - [Multi-HAP Usage Rules](multi-hap-rules.md) - [Multi-HAP Operation Mechanism and Data Communication Modes](multi-hap-principles.md) - [Application Installation and Uninstallation Process](application-package-install-uninstall.md) + - [Application Package Update Process](application-package-update.md) + - Shared Package + - [Shared Package Overview](shared-guide.md) + - [HAR](har-package.md) + - HSP + - [In-Application HSP Development](in-app-hsp.md) + - [Inter-Application HSP Development (for System Applications Only)](cross-app-hsp.md) + - Quick Fix + - [Quick Fix Overview](quickfix-principles.md) + - [CLI-based Quick Fix Development](quickfix-debug.md) - Application Configuration Files in Stage Model - [Application Configuration File Overview (Stage Model)](application-configuration-file-overview-stage.md) - [app.json5 Configuration File](app-configuration-file.md) diff --git a/en/application-dev/quick-start/app-configuration-file.md b/en/application-dev/quick-start/app-configuration-file.md index f68ec8ee66f92910e0f11c4a8b705bfd7bbfd08d..cbc97f24e80d576f747d69eeeaec89f50c264283 100644 --- a/en/application-dev/quick-start/app-configuration-file.md +++ b/en/application-dev/quick-start/app-configuration-file.md @@ -19,7 +19,9 @@ This document gives an overview of the **app.json5** configuration file. To star "debug": false, "car": { "minAPIVersion": 8, - } + }, + "targetBundleName": "com.application.test", + "targetPriority": 50 }, } ``` @@ -28,11 +30,12 @@ This document gives an overview of the **app.json5** configuration file. To star As shown above, the **app.json5** file contains several tags. -**Table 1** Tags in the app.json5 file + **Table 1** Tags in the app.json5 file | Name| Description| Data Type| Initial Value Allowed| | -------- | -------- | -------- | -------- | | bundleName | Bundle name, which uniquely identifies an application. The value must comply with the following rules:
- Consists of letters, digits, underscores (_), and periods (.).
- Starts with a letter.
- Contains 7 to 127 bytes.
You are advised to use the reverse domain name notation, for example, *com.example.demo*, where the first part is the domain suffix **com**, the second part is the vendor/individual name, and the third part is the application name, which can be of multiple levels.
If an application is built with the system source code, you are advised to name it in *com.ohos.demo* notation, where **ohos** signifies that the application is an OpenHarmony system application.| String| No| +| bundleType| Bundle type, which is used to distinguish applications and atomic services.
- **app**: The bundle is a common application.
- **atomicService**: The bundle is an atomic service.
- **shared**: The bundle is a shared object application. | String| Yes (initial value: **"app"**)| | debug | Whether the application can be debugged. This tag is generated during compilation and building in DevEco Studio.
- **true**: The application can be debugged.
- **false**: The application cannot be debugged.| Boolean| Yes (initial value: **false**)| | icon | [Icon of the application](../application-models/application-component-configuration-stage.md). The value is an icon resource index.| String| No| | label | [Name of the application](../application-models/application-component-configuration-stage.md). The value is a string resource index.| String| No| @@ -51,3 +54,5 @@ As shown above, the **app.json5** file contains several tags. | wearable | Wearable-specific configuration, which includes **minAPIVersion** and **distributedNotificationEnabled** attributes.
When running on wearables, the application applies the attribute settings under this tag and ignores the general counterparts.| Object| Yes (initial value: general settings in the **app.json5** file)| | car | Head unit–specific configuration, which includes **minAPIVersion** and **distributedNotificationEnabled** attributes.
When running on head units, the application applies the attribute settings under this tag and ignores the general counterparts.| Object| Yes (initial value: general settings in the **app.json5** file)| | default | Default device–specific configuration, which includes **minAPIVersion** and **distributedNotificationEnabled** attributes.
When running on default devices, the application applies the attribute settings under this tag and ignores the general counterparts.| Object| Yes (initial value: general settings in the **app.json5** file)| +|targetBundleName|Target application name of the bundle. The value rule and range are the same as those of **bundleName**.|String|Yes (if the initial value is used, the target application is not an application with the overlay feature)| +|targetPriority|Priority of the application. When **targetBundleName** is set, the application is an application with the overlay feature. The value ranges from 1 to 100.|Number|Yes (initial value: **1**)| diff --git a/en/application-dev/quick-start/application-package-structure-fa.md b/en/application-dev/quick-start/application-package-structure-fa.md index 6909481445ecb1219c30ed3ae425d6b475662805..a9d647385fa9b5e9a47ebcf4ea77e546d4df3108 100644 --- a/en/application-dev/quick-start/application-package-structure-fa.md +++ b/en/application-dev/quick-start/application-package-structure-fa.md @@ -11,7 +11,7 @@ The difference between the application package structures in the FA model and st - The **assets** folder is a collection of all the resource files, library files, and code files in a HAP file. It can be further organized into the **entry** folder and the **js** folder. The **entry** folder stores the **resources** folder and the **resources.index** file. -- The **resources** folder stores resource files (such as strings and images) of the application. +- The **resources** folder stores resource files (such as strings and images) of the application. For details, see [Resource Categories and Access](resource-categories-and-access.md). - The **resources.index** file provides a resource index table, which is generated by DevEco Studio invoking the specific SDK tool. diff --git a/en/application-dev/quick-start/application-package-structure-stage.md b/en/application-dev/quick-start/application-package-structure-stage.md index b9bd91d798c6a57c06c74cebb38bf558c8fa011d..0736157fd42b4b6b6a2549e9262a7d25313aa452 100644 --- a/en/application-dev/quick-start/application-package-structure-stage.md +++ b/en/application-dev/quick-start/application-package-structure-stage.md @@ -1,17 +1,17 @@ # Application Package Structure in Stage Model -To develop an application based on the [stage model](application-configuration-file-overview-stage.md), it is essential to understand the structure of the application package created after the application is built and packaged. +To develop an application based on the [stage model](application-configuration-file-overview-stage.md), it will be helpful if you have a basic understanding of the structure of the application package created after the application is built and packaged, as well as the related basic concepts. -- In development, an application contains one or more modules. You can [create modules](https://developer.harmonyos.com/en/docs/documentation/doc-guides-V3/ohos-adding-deleting-module-0000001218760594-V3) in the application project in [DevEco Studio](https://developer.harmonyos.com/en/develop/deveco-studio/). As a basic functional unit of an OpenHarmony application/service, a module contains source code, resource files, third-party libraries, and application/service configuration files, and can be built and run independently. Modules can be classified as Ability or Library. A module of the Ability type is built into a Harmony Ability Package (HAP) file in .hap format, and a module of the Library type is built into a [Harmony Ability Resources (HAR) file](har-structure.md) in .tgz format. +- In development, an application contains one or more modules. You can [create modules](https://developer.harmonyos.com/en/docs/documentation/doc-guides-V3/ohos-adding-deleting-module-0000001218760594-V3) in the application project in [DevEco Studio](https://developer.harmonyos.com/en/develop/deveco-studio/). As a basic functional unit of an OpenHarmony application/service, a module contains source code, resource files, third-party libraries, and application/service configuration files, and can be built and run independently. Modules can be classified as Ability or Library. A module of the Ability type is built into a Harmony Ability Package (HAP) file, and a module of the Library type is built into a [Harmony Archive (HAR)](har-package.md) file or a [Harmony Shared Package (HSP)](shared-guide.md). A module can contain one or more [UIAbility](../application-models/uiability-overview.md) components, as shown in the figure below. - **Figure 1** Relationship between modules and UIAbility components + **Figure 1** Relationship between modules and UIAbility components ![ability-and-module](figures/ability-and-module.png) - Unless otherwise specified, the modules described in this document refer to the modules of the Ability type. + Unless otherwise specified, the modules described in this document refer to the modules of the Ability type. - As aforementioned, you can build an application into one or more HAP files. The HAP file is the basic unit for installing an application. It provides code, resources, third-party libraries, and a configuration file. HAP files can be classified as Entry or Feature. - HAP of the entry type: main module of the application, whose **type** field is set to **"entry"** in the [module.json5](module-configuration-file.md) file. In an application, each type of device supports only one HAP of the entry type, which is typically used to implement the application's entry screen, entry icon, or headline feature. @@ -22,11 +22,11 @@ To develop an application based on the [stage model](application-configuration-f - The HAP file includes folders such as **ets**, **libs**, and **resources** and files such as **resources.index**, **module.json**, and **pack.info**. - The **ets** folder stores bytecode files generated after application code build. - The **libs** folder stores library files, which are .so binary files that contain third-party code on which the OpenHarmony application depends. - - The **resources** folder stores resource files (such as strings and images) of the application. + - The **resources** folder stores resource files (such as strings and images) of the application. For details, see [Resource Categories and Access](resource-categories-and-access.md). - The **resources.index** file provides a resource index table, which is generated when the application project is built in DevEco Studio. - The **module.json** file is the configuration file indispensable in a HAP file. It consists of **module.json5** and **app.json5** in the project configuration. While DevEco Studio provides default configuration, you must modify the configuration as needed. For details about the configuration fields, see [Application Configuration Files in Stage Model](application-configuration-file-overview-stage.md). - The **pack.info** file describes the HAP attributes in the bundle, for example, **bundleName** and **versionCode** in **app** and **name**, **type**, and **abilities** in **module**. The file is automatically generated when DevEco Studio generates the bundle. - **Figure 2** Application package structure in stage model - - ![app-pack-stage](figures/app-pack-stage.png) \ No newline at end of file + **Figure 2** Application package structure in stage model + + ![app-pack-stage](figures/app-pack-stage.png) diff --git a/en/application-dev/quick-start/application-package-update.md b/en/application-dev/quick-start/application-package-update.md new file mode 100644 index 0000000000000000000000000000000000000000..0137bc47e7ad78345da1128cf423e445d8456f97 --- /dev/null +++ b/en/application-dev/quick-start/application-package-update.md @@ -0,0 +1,5 @@ +# Application Package Update Process +The OpenHarmony bundle manager service allows application packages to be updated under the following scenarios: + +1. In the application market: The application market notifies the user of an available update, and the user can install the update by following the onscreen instructions. +2. In the application: When the application for which an update is available starts up, the application market notifies the user of the update, and the user can install the update by following the onscreen instructions. diff --git a/en/application-dev/quick-start/arkts-rendering-control.md b/en/application-dev/quick-start/arkts-rendering-control.md index 0cb38c2c123171b7ebe05df263b7275445542986..13904097ef69fc988fe3b1ed8d5a98714c38c2aa 100644 --- a/en/application-dev/quick-start/arkts-rendering-control.md +++ b/en/application-dev/quick-start/arkts-rendering-control.md @@ -42,6 +42,8 @@ ForEach( ) ``` +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name | Type | Mandatory| Description | @@ -254,7 +256,7 @@ struct MyComponent { this.data.pushData('/path/image' + this.data.totalCount() + '.png') }) }, item => item) - } + }.height('100%').width('100%') } } ``` diff --git a/en/application-dev/quick-start/arkts-restrictions-and-extensions.md b/en/application-dev/quick-start/arkts-restrictions-and-extensions.md index fa62ed392100f7ff0b60dcc6e8ee66ef465fbb3a..b2f31f9aae3188dddfb011f94d971c0db3855d99 100644 --- a/en/application-dev/quick-start/arkts-restrictions-and-extensions.md +++ b/en/application-dev/quick-start/arkts-restrictions-and-extensions.md @@ -232,3 +232,26 @@ struct Child { } } ``` + +## Restrictions on Naming Custom Components, Classes, and Functions + +The name of a custom component, class, or function cannot be the same as any system component name. + +Example: + +``` +// Rect.ets +export class Rect { + constructor(){} +} +// Index.ets +// ERROR: The module name 'Rect' can not be the same as the inner component name. +import { Rect } from './Rect'; +@Entry +@Component +struct Index { + build() { + + } +} +``` diff --git a/en/application-dev/quick-start/atomicService.md b/en/application-dev/quick-start/atomicService.md new file mode 100644 index 0000000000000000000000000000000000000000..2c2216bfc22b87411408d2753f04955b89a852f6 --- /dev/null +++ b/en/application-dev/quick-start/atomicService.md @@ -0,0 +1,218 @@ +# Atomic Service + +## Pre-loading by HAP Type + +### HAP File Implementation + +To speed up the initial startup of an atomic service, you can configure it to load on demand with the use of HAP files. HAP files of an atomic service are classified as entry-type or feature-type. The entry-type HAP file contains the page code and related resources required for starting up the atomic service. The feature-type HAP files contain the rest of the code and resources. To start the atomic service, the user only needs to download and install the entry-type HAP file, which minimizes the time for downloading the atomic service. + +#### How to Use + +You create HAP files of an atomic service by creating an atomic service project in DevEco Studio. The basic project directory structure is as follows: + +``` +├── AppScope +| ├── resources +| └── app.json5 +├── entry +| └── src/main +| ├── ets +| ├── resources +| └── module.json5 +├── feature +| └── src/main +| ├── ets +| ├── resources +| └── module.json5 +├── library +| └── src/main +| ├── ets +| ├── resources +| └── module.json5 +├── node_modules +``` + +Note that you must set the **bundleType** field to **atomicService** in the [app.json5](app-configuration-file.md) file, which is located in the **AppScope** folder. The following is an example of the file content: + +```json +{ + "app": { + "bundleName": "com.example.hmservice", + "bundleType":"atomicService", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "distributedNotificationEnabled": true, + "targetAPIVersion": 9 + } +} +``` + +For details about HAP files, see [Multi-HAP Design Objectives](multi-hap-objective.md). + +#### Restrictions + +1. The **installationFree** field must be set to **true** in each module-specific configuration file [module.json5](module-configuration-file.md) file. + +2. When packaging an atomic service, comply with the following size rules: + +- The total size of HAP files cannot exceed 10 MB. + +- The size of a HAP file itself and all its dependent [HSP](in-app-hsp.md) cannot exceed 2 MB. + + +### Pre-loading Implementation + +You can configure the system to automatically pre-download required modules when the atomic service enters a module, thereby speeding up module access. + +Currently, pre-loading can be implemented only through configuration, not by invoking APIs. + +#### How to Use + +Pre-loading is triggered after the first frame of the newly accessed module is rendered. You can configure what to pre-load for a module, by setting the **preloads** field under **atomicService** in the [module.json5](module-configuration-file.md) file of the module. The following is an example of the **module.json5** file of the **entry** module, saved in **entry/src/main**: + +```json +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntrance": "./ets/Application/MyAbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": true, + "pages": "$profile:main_pages", + "atomicService": { + "preloads": [ + { + "moduleName": "feature" + } + ] + }, + "abilities": [ + { + "name": "MainAbility", + "srcEntrance": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:white", + "visible": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} +``` + +In this example, the system automatically pre-loads the **feature** module after the first frame of the **entry** module is rendered. + +#### Restrictions + +[moduleType](../reference/apis/js-apis-bundleManager.md#moduletype) corresponding to moduleName in the **preloads** list cannot be entry. + +## Using Dynamic Shared Packages in Atomic Services + +A [Harmony Shared Package (HSP)](shared-guide.md) is a dynamic shared package for sharing code, C++ libraries, resources, and configuration files among modules. +For details about how to use the HSP within an atomic service, see [In-Application HSP Development](in-app-hsp.md). + +#### How to Use + +Assume that the project directory structure is as follows: +``` +├── AppScope +| ├── resources +| └── app.json5 +├── entry +| └── src/main +| ├── ets +| ├── entryAbility +| └── pages +| └── Index.ets +| ├── resources +| └── module.json5 +├── feature +| └── src/main +| ├── ets +| ├── resources +| └── module.json5 +├── library +| └── src/main +| ├── ets +| └── pages +| └── menu.ets +| ├── resources +| └── module.json5 +├── node_modules +``` + +If you want to add a button in the **entry** module to jump to the menu page (**library/src/main/ets/pages/menu.ets**) in the **library** module, you can write the following code in the **entry/src/main/ets/MainAbility/Index.ets** file of the **entry** module: + +```ts +import router from '@ohos.router'; + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + // Add a button to respond to user clicks. + Button() { + Text('click to menu') + .fontSize(30) + .fontWeight(FontWeight.Bold) + } + .type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('40%') + .height('5%') + // Bind click events. + .onClick(() => { + router.pushUrl({ + url: '@bundle:com.example.hmservice/library/ets/pages/menu' + }).then(() => { + console.log("push page success"); + }).catch(err => { + console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); + }) + } + .width('100%') + } + .height('100%') + } +} +``` + +The input parameter **url** of the **router.pushUrl** API is as follows: +```ets +'@bundle:com.example.hmservice/library/ets/pages/menu' +``` +The **url** content template is as follows: +```ets +'@bundle:bundle name/module name/path/page file name (without the extension .ets)' +``` diff --git a/en/application-dev/quick-start/cross-app-hsp.md b/en/application-dev/quick-start/cross-app-hsp.md new file mode 100644 index 0000000000000000000000000000000000000000..db971e348908dbc6f6ca87f5d84d162b6bac0997 --- /dev/null +++ b/en/application-dev/quick-start/cross-app-hsp.md @@ -0,0 +1,224 @@ +# Inter-Application HSP Development + +An inter-application Harmony Shared Package (HSP) is a file used for code and resource sharing between the host application and other applications. +The host application of an inter-application HSP is a special form of application, which consists of only one HSP. Instead of running independently on a device, the host application runs by being referenced by dependencies of common application modules. When a common application is running, it can invoke capabilities provided by the inter-application HSP dynamically as needed. + +## Precautions +1. The code of an inter-application HSP runs in the application process. When invoking the code, implement an exception capture and fault tolerance mechanism to avoid stability issues caused by malfunctioning of the inter-application HSP. +2. An application can depend on multiple inter-application HSP files at the same time. +3. The inter-application HSP may slow down the startup of the application that depends on it. To avoid significant increase in the startup delay, limit the number of inter-application HSP dependencies within 16. +4. Privilege verification is conducted during inter-application HSP installation. To develop an inter-application HSP, you must configure the **allowAppShareLibrary** application privilege. For details, see [Application Privilege Configuration Guide](../../device-dev/subsystems/subsys-app-privilege-config-guide.md). + +## Inter-Application HSP Usage +An inter-application HSP works by combining the following parts: + +[HAR](har-package.md): contains only objects and methods to be exported and therefore comes in a small size. By integrating the HAR into your application project, you can call the objects and methods therein to implement features. + +HSP: contains the actual implementation code, including the JS/TS code, C++ libraries, resources, and configuration files. It is either released to the application market or integrated into the system version. + +### Integrating the HAR in an Inter-Application HSP +Define the interfaces to be exported in the **index.d.ets** file in the HAR, which is the entry to the declaration file exported by the inter-application HSP. The path of the **index.d.ets** file is as follows: +``` +src +├── main +| └── module.json5 +├── index.d.ets +└── oh-package.json5 +``` +Below is an example of the **index.d.ets** file content: +```ts +@Component +export declare struct UIComponent { + build():void; +} + +export declare function hello(): string; + +export declare function foo1(): string; + +export declare function foo2(): string; + +export declare function nativeHello(): string; +``` +In the example, **UIComponent** is an ArkUI component, **hello()**, **foo1()**, and **foo2()** are TS methods, and **nativeHello()** is a native method. Specific implementation is as follows: +#### ArkUI Components +The following is an implementation example of ArkUI components in the HSP: +```ts +// lib/src/main/ets/ui/MyUIComponent.ets +@Component +export struct UIComponent { + @State message: string = 'Hello World' + build() { + Column() { + Text(this.message) + .fontSize(32) + .padding(8) + .fontColor(0xffffff) + .backgroundColor(0x0000ff) + }.padding(8).width('100%') + } +} +``` + +#### **TS Methods** +The following is an implementation example of TS methods in the HSP: +```ts +export function hello(name: string): string { + return "hello + " + name; +} + +export function foo1() { + return "foo1"; +} + +export function foo2() { + return "foo2"; +} +``` +#### **Native Methods** +The following is an implementation example of native methods in the HSP: +```C++ +#include "napi/native_api.h" +#include +#include +#include + +const std::string libname = "liba"; +const std::string version = "v10001"; + +static napi_value Hello(napi_env env, napi_callback_info info) { + napi_value ret; + std::string msg = libname + ":native hello, " + version; + napi_create_string_utf8(env, msg.c_str(), msg.length(), &ret); + return ret; +} + +EXTERN_C_START +static napi_value Init(napi_env env, napi_value exports) { + napi_property_descriptor desc[] = { + {"nativeHello", nullptr, Hello, nullptr, nullptr, nullptr, napi_default, nullptr}}; + napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc); + return exports; +} +EXTERN_C_END + +static napi_module demoModule = { + .nm_version = 1, + .nm_flags = 0, + .nm_filename = nullptr, + .nm_register_func = Init, + .nm_modname = "liba", + .nm_priv = ((void *)0), + .reserved = {0}, +}; + +extern "C" __attribute__((constructor)) void RegisterLibaModule(void) { + napi_module_register(&demoModule); +} +``` +### Using the Capabilities Exported from the HAR +To start with, [configure dependency](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-development-npm-package-0000001222578434#section89674298391) on the HAR. The dependency information will then be generated in the **module.json5** file of the corresponding module, as shown in the following: +```json +"dependencies": [ + { + "bundleName": "com.share.liba", + "moduleName": "liba", + "versionCode": 10001 + } +] +``` +In the preceding information, **bundleName**, **moduleName**, and **versionCode** indicate the bundle name, module name, and version number of the inter-application HSP, respectively. +#### Referencing ArkUI Components in the HAR +After configuring the dependency on the HAR, you can reference ArkUI components exported from the HAR by using **import**. The sample code is as follows: +``` ts +import { UIComponent } from 'liba' + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + build() { + Row() { + // Reference the ArkUI component in the HAR. + UIComponent() + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} +``` + +#### Referencing TS Classes and Methods in the HAR +To reference the TS classes and methods exported from the HAR, use **import** as follows: +``` ts +import { foo1 } from 'liba' +import { foo2 } from 'liba' + +@Component +struct Index { + build() { + Row() { + Column() { + Button('Button') + .onClick(()=>{ + // Reference the TS methods in the HAR. + foo1(); + foo2(); + }) + } + .width('100%') + } + .height('100%') + } +} +``` +#### Referencing Native Methods in the HAR +To reference the native methods exported from the HAR, use **import** as follows: +``` ts +import { nativeHello } from 'liba' + +@Component +struct Index { + build() { + Row() { + Column() { + Button('Button') + .onClick(()=>{ + // Reference the native method in the HAR. + nativeHello(); + }) + } + .width('100%') + } + .height('100%') + } +} +``` + +## Inter-Application HSP Distribution +Inter-application HSPs are not completely integrated into an application. They are distributed by being preset in the system version or installed with an application on the device. To be specific: +1. Some frequently-used inter-application HSPs are preset in the system version. +2. When a user downloads an application from the application market, if the application market detects that the application depends on one or more inter-application HSPs and any of these HSPs are not installed on the target device, it will download the application as well as the missing HSPs for the user. In this way, the application can use the features shared through the HSPs properly. + +### Inter-Application HSP Debugging Mode +You can debug an inter-application HSP after it is distributed to a device. If the aforementioned distribution methods are not applicable, you can distribute the HSP by running **bm** commands. The procedure is as follows: + +> **NOTE** +> +> Do not reverse steps 2 and 3. Otherwise, your application will fail to be installed due to a lack of the required inter-application HSP. For more information about the **bm** commands, see [Bundle Management](../../readme/bundle-management.md). + +1. Obtain the inter-application HSP installation package. +2. Run the following **bm** command to install the inter-application HSP. +``` +bm install -s sharebundle.hsp +``` +3. Run the following **bm** command to install the HAP file of your application. +``` +bm install -p feature.hap +``` +4. Start your application and start debugging. diff --git a/en/application-dev/quick-start/figures/application_details.jpg b/en/application-dev/quick-start/figures/application_details.jpg new file mode 100644 index 0000000000000000000000000000000000000000..02524b549eaf636e2a8a0f2ec869513d99f1a161 Binary files /dev/null and b/en/application-dev/quick-start/figures/application_details.jpg differ diff --git a/en/application-dev/quick-start/figures/in-app-hsp-har.png b/en/application-dev/quick-start/figures/in-app-hsp-har.png new file mode 100644 index 0000000000000000000000000000000000000000..b4473deed92ed251cff11bee403c32cdd39556d8 Binary files /dev/null and b/en/application-dev/quick-start/figures/in-app-hsp-har.png differ diff --git a/en/application-dev/quick-start/figures/quick-fix-debug.png b/en/application-dev/quick-start/figures/quick-fix-debug.png new file mode 100644 index 0000000000000000000000000000000000000000..4e7084f30e2d2b26be811c8b8a6c9ec34a005c9e Binary files /dev/null and b/en/application-dev/quick-start/figures/quick-fix-debug.png differ diff --git a/en/application-dev/quick-start/figures/quick-fix-devel_release.png b/en/application-dev/quick-start/figures/quick-fix-devel_release.png new file mode 100644 index 0000000000000000000000000000000000000000..34b701fafe5d319da6b552c5d86305151e8e28b3 Binary files /dev/null and b/en/application-dev/quick-start/figures/quick-fix-devel_release.png differ diff --git a/en/application-dev/quick-start/figures/quick_fix_bundle_struct.png b/en/application-dev/quick-start/figures/quick_fix_bundle_struct.png new file mode 100644 index 0000000000000000000000000000000000000000..730414e3ba2fccbb58a27f83ce1afc572544f366 Binary files /dev/null and b/en/application-dev/quick-start/figures/quick_fix_bundle_struct.png differ diff --git a/en/application-dev/quick-start/figures/quick_fix_gen_abc.png b/en/application-dev/quick-start/figures/quick_fix_gen_abc.png new file mode 100644 index 0000000000000000000000000000000000000000..3e549ec79cad4a76a55ccab4dbb769b756d9936a Binary files /dev/null and b/en/application-dev/quick-start/figures/quick_fix_gen_abc.png differ diff --git a/en/application-dev/quick-start/figures/quick_fix_gen_so.png b/en/application-dev/quick-start/figures/quick_fix_gen_so.png new file mode 100644 index 0000000000000000000000000000000000000000..31717ca38c7e64983b9b3c95672fe966decf6945 Binary files /dev/null and b/en/application-dev/quick-start/figures/quick_fix_gen_so.png differ diff --git a/en/application-dev/quick-start/full-sdk-compile-guide.md b/en/application-dev/quick-start/full-sdk-compile-guide.md new file mode 100644 index 0000000000000000000000000000000000000000..dc5e4747476a2799654b317c24ee92ba3f4471c2 --- /dev/null +++ b/en/application-dev/quick-start/full-sdk-compile-guide.md @@ -0,0 +1,29 @@ +# Full SDK Compilation Guide + +The full SDK provides a full set of APIs available in OpenHarmony, including system APIs required by system applications. Vendors can leverage this SDK to develop applications. + +Since OpenHarmony 3.2 Beta5, the full SDK is not provided with the version. If necessary, you can compile the SDK using the full source code. + +## Compiling the Full SDK + +**Preparation** + +1. Register an SSH public key for access to Gitee. +2. Configure the server environment. For details, see [Setting Up the Ubuntu Environment](../../device-dev/quick-start/quickstart-ide-env-ubuntu.md). + +**Procedure** + +1. Download and initialize the manifest repository: **repo init -u https://gitee.com/openharmony/manifest.git -b $manifest_branch --no-repo-verify --repo-url=https://gitee.com/oschina/repo --no-clone-bundle** + +2. Download source code based on the downloaded manifest repository: **repo sync -c -d --force-sync** + +3. Perform precompilation: **yes y | apt install libxinerama-dev libxcursor-dev libxrandr-dev libxi-dev && rm -rf prebuilts/clang/ohos/darwin-x86_64/clang-480513 && rm -rf prebuilts/clang/ohos/windows-x86_64/clang-480513 && rm -rf prebuilts/clang/ohos/linux-x86_64/clang-480513 && bash build/prebuilts_download.sh -ndk && apt-get update -qqy && apt-get install doxygen -y --force-yes** + +4. Perform compilation: **./build.sh --product-name ohos-sdk** + + +If the compilation is successful, export the files in the **out/sdk/packages/ohos-sdk/** directory. + +## Replacing the SDK + +After the full SDK is compiled, switch to it in DevEco Studio. For details, see [Guide to Switching to Full SDK](full-sdk-switch-guide.md). diff --git a/en/application-dev/quick-start/full-sdk-switch-guide.md b/en/application-dev/quick-start/full-sdk-switch-guide.md index 87289c7776cb3dc33b73abc25cb3ef2da06e6eca..c5b0788516215c4ccd7a53fd0482afa4221b9644 100644 --- a/en/application-dev/quick-start/full-sdk-switch-guide.md +++ b/en/application-dev/quick-start/full-sdk-switch-guide.md @@ -16,7 +16,7 @@ Manually download the system-specific full SDK package from the mirror. For deta ## Checking the Local SDK Location -In this example, an eTS project is used. For a JS project, replace **ets** with **js**. +In this example, an ArkTS project is used. For a JS project, replace **ets** with **js**. In DevEco Studio, choose **Tools** > **OpenHarmony SDK Manager** to check the location of the local SDK. diff --git a/en/application-dev/quick-start/har-package.md b/en/application-dev/quick-start/har-package.md new file mode 100644 index 0000000000000000000000000000000000000000..63b5fcfd10437ac2140a17bcc1daf690e780c791 --- /dev/null +++ b/en/application-dev/quick-start/har-package.md @@ -0,0 +1,172 @@ +# HAR +A Harmony Archive (HAR) is a static shared package that can contain code, C++ libraries, resources, and configuration files. It enables modules and projects to share code related to ArkUI components, resources, and more. Unlike a Harmony Ability Package (HAP), a HAR cannot be independently installed on a device. Instead, it can be referenced only as the dependency of an application module. + +## Creating a HAR Module +You can kickstart your HAR module development with the module template of the **Library** type in DevEco Studio. By default, obfuscation is disabled for the HAR module. To enable this feature, set **artifactType** in the **build-profile.json5** file of the HAR module to **obfuscation** as follows: + +```json +{ + "apiType": "stageMode", + "buildOption": { + "artifactType": "obfuscation" + } +} +``` +The value options of **artifactType** are as follows, and the default value is **original**: +- **original**: Code is not obfuscated. +- **obfuscation**: Code is obfuscated using Uglify. + +When obfuscation is enabled, DevEco Studio compiles, obfuscates, and compresses code during HAR building, thereby protecting your code assets. + +> **NOTE** +> +> If **artifactType** is set to **obfuscation**, **apiType** must be set to **stageMode**, because obfuscation is available only in the stage model. + +## Precautions for HAR Development +- The HAR does not support the declaration of **abilities** and **extensionAbilities** in its configuration file. +- The HAR does not support the declaration of pages in its configuration file. +- The HAR does not support **worker** configuration under **buildOption** in the **build-profile.json5** file. +- The HAR of the FA model and that of the stage model cannot be referenced by each other. +- The HAR of the stage model cannot reference content in the **AppScope** folder. This is because the content in the **AppScope** folder is not packaged into the HAR during compilation and building. + +## Exporting ArkUI Components, APIs, and Resources of the HAR +The **index.ets** file acts as the entry of the HAR export declaration file and is where the HAR exports APIs. This file is automatically generated by DevEco Studio by default. You can specify another file as the entry declaration file in the **main** field in the **oh-package.json5** file of the module. The code snippet is as follows: +```json +{ + "main": "index.ets" +} +``` +### Exporting ArkUI Components +Use **export** to export the ArkUI components. The code snippet is as follows: +```js +// library/src/main/ets/components/MainPage/MainPage.ets +@Component +export struct MainPage { + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} +``` +In the **index.ets** file, declare the APIs that the HAR exposes to external systems. The code snippet is as follows: +```js +// library/index.ets +export { MainPage } from './src/main/ets/components/MainPage/MainPage' +``` +### Exporting TS Classes and Methods +Use **export** to export TS classes and methods. Multiple TS classes and methods can be exported at the same time. The code snippet is as follows: +```js +// library/src/main/ts/test.ets +export class Log { + static info(msg) { + console.info(msg); + } +} + +export function func() { + return "har func"; +} + +export function func2() { + return "har func2"; +} +``` +In the **index.ets** file, declare the APIs that the HAR exposes to external systems. The code snippet is as follows: +```js +// library/index.ets +export { Log } from './src/main/ts/test' +export { func } from './src/main/ts/test' +export { func2 } from './src/main/ts/test' +``` +### Resources +Resources are packed into the HAR when it is being compiled and packaged. During compilation and building of a HAP, DevEco Studio collects resource files from the HAP module and its dependent modules. If the resource files of different modules have the same name, DevEco Studio overwrites the resource files based on the following priorities (in descending order): +- AppScope (supported only by the stage model of API version 9) +- Modules in the HAP file +- If resource conflicts occur between dependent HAR modules, they are overwritten based on the dependency sequence. (The module that is higher in the dependency sequence list has higher priority.) + +## Referencing ArkUI Components, APIs, and Resources in the HAR +To start with, [configure dependency](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-development-npm-package-0000001222578434#section89674298391) on the HAR. + +### Reference ArkUI Components in the HAR + +After configuring the dependency on the HAR, you can reference ArkUI components exported from the HAR by using **import**. The sample code is as follows: +```js +// entry/src/main/ets/pages/index.ets +import { MainPage } from "@ohos/library" + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + build() { + Row() { + // Reference the ArkUI component in the HAR. + MainPage() + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} +``` +### Referencing TS Classes and Methods in the HAR +To reference the TS classes and methods exported from the HAR, use **import** as follows: +```js +// entry/src/main/ets/pages/index.ets +import { Log } from "@ohos/library" +import { func } from "@ohos/library" + +@Entry +@Component +struct Index { + build() { + Row() { + Column() { + Button('Button') + .onClick(()=>{ + // Reference TS classes and methods in the HAR. + Log.info("har msg"); + func(); + }) + } + .width('100%') + } + .height('100%') + } +} +``` +### Referencing Resources in the HAR +Use **$r** to reference resources in the HAR. For example, add the **name: hello_har** string (defined in the **string.json** file) and **icon_har.png** image to the **src/main/resources** directory of the HAR module, and then reference the string and image in the entry module. The code snippet is as follows: +```js +// entry/src/main/ets/pages/index.ets +@Entry +@Component +struct Index { + build() { + Row() { + Column() { + // Reference the string in the HAR. + Text($r("app.string.hello_har")) + .fontSize(50) + .fontWeight(FontWeight.Bold) + // Reference the image in the HAR. + Image($r("app.media.icon_har")) + } + .width('100%') + } + .height('100%') + } +} +``` diff --git a/en/application-dev/quick-start/har-structure.md b/en/application-dev/quick-start/har-structure.md deleted file mode 100644 index 1d479b504a48752fdcb4ff033e81103efa134da2..0000000000000000000000000000000000000000 --- a/en/application-dev/quick-start/har-structure.md +++ /dev/null @@ -1,10 +0,0 @@ -# HAR File Structure - - -The OpenHarmony Archive (HAR) file enables code to be shared among multiple modules or projects. Unlike a Harmony Ability Package (HAP) file, a HAR file cannot be independently installed on a device. Instead, it can only be referenced as the dependency of an application module. - - -A HAR file is the build product of a [module](https://developer.harmonyos.com/en/docs/documentation/doc-guides-V3/ohos-adding-deleting-module-0000001218760594-V3) of the Library type in a DevEco Studio project. - - -As a static shared package in OpenHarmony, the [HAR file](https://developer.harmonyos.com/en/docs/documentation/doc-guides/ohos-development-npm-package-0000001222578434) can contain the source code, C++ libraries, resource files, and the **module.json** file (in stage model) or **config.json** file (in FA model). diff --git a/en/application-dev/quick-start/in-app-hsp.md b/en/application-dev/quick-start/in-app-hsp.md new file mode 100644 index 0000000000000000000000000000000000000000..cdd06b5dfb59a2c9609a7f327c95bae710943d3d --- /dev/null +++ b/en/application-dev/quick-start/in-app-hsp.md @@ -0,0 +1,153 @@ +# In-Application HSP Development + +An in-application Harmony Shared Package (HSP) is a file used for code and resource sharing within an application (called the host application) and can only be invoked by a HAP or HSP of the same application. +The in-application HSP is released with the Application Package (App Pack) of the host application and has the same bundle name and lifecycle as the host application. + +## Developing an In-Application HSP + +You can kickstart your HSP development with the HSP template in DevEco Studio. In this example, an HSP module named **library** is created. The basic project directory structure is as follows: +``` +library +├── src +│ └── main +│ ├── ets +│ │ ├── pages +│ │ └── index.ets +│ ├── resources +│ └── module.json5 +└── oh-package.json5 +``` +In the **module.json5** file, set **type** to **shared** for the HSP. +```json +{ + "type": "shared" +} +``` + +The HSP provides capabilities for external systems by exporting APIs in the entry file. Specify the entry file in **main** in the **oh-package.json5** file. For example: +```json +{ + "main": "./src/main/ets/index.ets" +} +``` + +### Exporting TS Classes and Methods +Use **export** to export TS classes and methods. The sample code is as follows: +```ts +// library/src/main/ets/utils/test.ts +export class Log { + static info(msg) { + console.info(msg); + } +} + +export function add(a: number, b: number) { + return a + b; +} + +export function minus(a: number, b: number) { + return a - b; +} +``` +In the entry file **index.ets**, declare the APIs to be exposed. +```ts +// library/src/main/ets/index.ets +export { Log, add, minus } from './utils/test' +``` + +### Exporting ArkUI Components +Use **export** to export ArkUI components. The sample code is as follows: +```ts +// library/src/main/ets/components/MyTitleBar.ets +@Component +export struct MyTitleBar { + build() { + Row() { + Text($r('app.string.library_title')) + .fontColor($r('app.color.white')) + .fontSize(25) + .margin({left:15}) + } + .width('100%') + .height(50) + .padding({left:15}) + .backgroundColor('#0D9FFB') + } +} +``` +In the entry file **index.ets**, declare the APIs to be exposed. +```ts +// library/src/main/ets/index.ets +export { MyTitleBar } from './components/MyTitleBar' +``` +#### About Using Resources in the HSP +To reference resources in the **resources** directory of the current HSP module, use **$r** or **$rawfile**. +If a relative path is used, the resources in the HSP caller are referenced instead. For example, +if **Image("common/example.png")** is used in the HSP module, the **\** component will reference the resource **entry/src/main/ets/common/example.png** in the HSP caller (which is **entry** in this example). + +### Exporting Native Methods +The HSP can contain .so files compiled in C++. The HSP indirectly exports the native method in the .so file. In this example, the **multi** method in the **libnative.so** file is exported. +```ts +// ibrary/src/main/ets/utils/nativeTest.ts +import native from "libnative.so" + +export function nativeMulti(a: number, b: number) { + return native.multi(a, b); +} +``` + +In the entry file **index.ets**, declare the APIs to be exposed. +```ts +// library/src/main/ets/index.ets +export { nativeMulti } from './utils/nativeTest' +``` + +## Using the In-Application HSP +To use APIs in the HSP, first configure the dependency on the HSP in the **oh-package.json5** file of the module that needs to call the APIs (called the invoking module). If the HSP and the invoking module are in the same project, the APIs can be referenced locally. The sample code is as follows: +```json +// entry/oh-package.json5 +"dependencies": { + "library": "file:../library" +} +``` +You can now call the external APIs of the HSP in the same way as calling the APIs in the HAR. +In this example, the external APIs are the following ones exported from **library**: +```ts +// library/src/main/ets/index.ets +export { Log, add, minus } from './utils/test' +export { MyTitleBar } from './components/MyTitleBar' +export { nativeMulti } from './utils/nativeTest' +``` +The APIs can be used as follows in the code of the invoking module: +```ts +// entry/src/main/ets/pages/index.ets +import { Log, add, MyTitleBar, nativeMulti } from "library" + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + build() { + Row() { + Column() { + MyTitleBar() + Text(this.message) + .fontSize(30) + .fontWeight(FontWeight.Bold) + Button('add(1, 2)') + .onClick(()=>{ + Log.info("add button click!"); + this.message = "result: " + add(1, 2); + }) + Button('nativeMulti(3, 4)') + .onClick(()=>{ + Log.info("nativeMulti button click!"); + this.message = "result: " + nativeMulti(3, 4); + }) + } + .width('100%') + } + .height('100%') + } +} +``` diff --git a/en/application-dev/quick-start/module-configuration-file.md b/en/application-dev/quick-start/module-configuration-file.md index 67361fccfd749495e2f5825d5ccac6efe1505ed9..aeb16b360e08d9d89eb3594d28b75cd21f37ca59 100644 --- a/en/application-dev/quick-start/module-configuration-file.md +++ b/en/application-dev/quick-start/module-configuration-file.md @@ -59,7 +59,9 @@ This document gives an overview of the **module.json5** configuration file. To s } } ] - } + }, + "targetModuleName": "feature", + "targetPriority": 50 } ``` @@ -72,14 +74,14 @@ As shown above, the **module.json5** file contains several tags. | Name| Description| Data Type| Initial Value Allowed| | -------- | -------- | -------- | -------- | | name | Name of the module. The value is a string with a maximum of 31 bytes and must be unique in the entire application. Chinese characters are not allowed.| String| No| -| type | Type of the module. The value can be **entry** or **feature**.
- **entry**: main module of the application.
- **feature**: dynamic feature module of the application.| String| No| +| type | Type of the module. The options are as follows:
- **entry**: main module of the application.
- **feature**: dynamic feature module of the application.
- **har**: static shared module.
- **shared**: dynamic shared module.| String| No| | srcEntry | Code path corresponding to the module. The value is a string with a maximum of 127 bytes.| String| Yes (initial value: left empty)| | description | Description of the module. The value is a string with a maximum of 255 bytes or a string resource index.| String| Yes (initial value: left empty)| | process | Process name of the current module. The value is a string with a maximum of 31 bytes. If **process** is configured under **HAP**, all UIAbility, DataShareExtensionAbility, and ServiceExtensionAbility components of the application run in the specified process.
**NOTE**
This tag applies only to system applications and does not take effect for third-party applications.| String| Yes (initial value: value of **bundleName** under **app** in the **app.json5** file)| | mainElement | Name of the entry UIAbility or ExtensionAbility of the module. The value is a string with a maximum of 255 bytes.| String| Yes (initial value: left empty)| | [deviceTypes](#devicetypes) | Type of the device on which the module can run.| String array| No (can be left empty)| | deliveryWithInstall | Whether the HAP file of the module will be installed when the user installs the application.
- **true**: The HAP file will be installed when the user installs the application.
- **false**: The HAP file will not be installed when the user installs the application.| Boolean| No| -| installationFree | Whether the module supports the installation-free feature.
- **true**: The module supports the installation-free feature and meets installation-free constraints.
- **false**: The module does not support the installation-free feature.
**NOTE**
- If this tag is set to **true** for an entry-type module, it must also be set to **true** for feature-type modules of the same application.
- If this tag is set to **false** for an entry-type module, it can be set to **true** or **false** for feature-type modules of the same application based on service requirements.| Boolean| No| +| installationFree | Whether the module supports the installation-free feature.
- **true**: The module supports the installation-free feature and meets installation-free constraints.
- **false**: The module does not support the installation-free feature.
**NOTE**
If this tag is set to **true** for an entry-type module, it must also be set to **true** for feature-type modules of the same application.
If this tag is set to **false** for an entry-type module, it can be set to **true** or **false** for feature-type modules of the same application based on service requirements.| Boolean| No| | virtualMachine | Type of the target virtual machine (VM) where the module runs. It is used for cloud distribution, such as distribution by the application market and distribution center.
If the target VM type is ArkTS engine, the value is **ark**+*version number*.| String| Yes (initial value: automatically inserted when DevEco Studio builds the HAP file)| | [pages](#pages)| Profile that represents information about each page in the current module. The value can contain a maximum of 255 bytes.| String| No in the UIAbility scenario| | [metadata](#metadata)| Custom metadata of the module. The setting is valid only for the current module, UIAbility, or ExtensionAbility.| Object array| Yes (initial value: left empty)| @@ -87,7 +89,10 @@ As shown above, the **module.json5** file contains several tags. | [extensionAbilities](#extensionabilities) | ExtensionAbility configuration of the module, which is valid only for the current ExtensionAbility component.| Object| Yes (initial value: left empty)| | [requestPermissions](#requestpermissions) | A set of permissions that the application needs to request from the system for running correctly.| Object| Yes (initial value: left empty)| | [testRunner](#testrunner) | Test runner configuration of the module.| Object| Yes (initial value: left empty)| - +| [atomicService](#atomicservice)| Atomic service configuration.| Object| Yes (initial value: left empty) | +| [dependencies](#dependencies)| List of shared libraries on which the current module depends during running.| Object array| Yes (initial value: left empty) | +| targetModuleName | Target module of the bundle. The value is a string with a maximum of 31 bytes. It must be unique in the entire application.|String|Yes (if the initial value is used, the target module is not a module with the overlay feature)| +| targetPriority | Priority of the module. When **targetModuleName** is set, the module is a module with the overlay feature. The value ranges from 1 to 100.|Number|Yes (initial value: **1**)| ## deviceTypes @@ -131,8 +136,21 @@ The **pages** tag is a profile that represents information about specified pages } ``` -Define the **main_pages.json** file under **resources/base/profile** in the development view. The base name of the file (**main_pages** in this example) can be customized, but must be consistent with the information specified by the **pages** tag. The file lists the page information of the current application. +Define the **main_pages.json** file under **resources/base/profile** in the development view. The file name (**main_pages** in this example) can be customized, but must be consistent with the information specified by the **pages** tag. The file lists the page information of the current application, including the route information and the window-related configuration. + + **Table 3** Tags in the pages configuration file + +| Name| Description| Data Type| Initial Value Allowed| +| -------- | -------- | -------- | -------- | +| src | Route information about all pages in the JavaScript module, including the page path and page name. The value is an array, each element of which represents a page and the first element represents the home page.| String array| No| +| window | Window-related configuration. | Object| Yes (initial value: left empty)| + + **Table 4** window tag in the pages configuration file +| Name| Description| Data Type| Initial Value Allowed| +| -------- | -------- | -------- | -------- | +| designWidth | Baseline width for page design. The size of an element is scaled by the actual device width.| Number| Yes (initial value: **720px**)| +| autoDesignWidth | Whether to automatically calculate the baseline width for page design. If it is set to **true**, the **designWidth** attribute becomes invalid. The baseline width is calculated based on the device width and screen density.| Boolean| Yes (initial value: **false**)| ```json { @@ -141,7 +159,11 @@ Define the **main_pages.json** file under **resources/base/profile** in the deve "pages/second/payment", "pages/third/shopping_cart", "pages/four/owner" - ] + ], + "window": { + "designWidth": 720, + "autoDesignWidth": false + } } ``` @@ -150,7 +172,7 @@ Define the **main_pages.json** file under **resources/base/profile** in the deve The **metadata** tag represents the custom metadata of the HAP file. The tag value is an array and contains three subtags: **name**, **value**, and **resource**. - **Table 3** metadata +**Table 5** metadata | Name| Description| Data Type| Initial Value Allowed| | -------- | -------- | -------- | -------- | @@ -165,7 +187,7 @@ The **metadata** tag represents the custom metadata of the HAP file. The tag val "metadata": [{ "name": "module_metadata", "value": "a test demo for module metadata", - "resource": "$profile:shortcuts_config", + "resource": "$profile:shortcuts_config" }], "abilities": [{ @@ -206,13 +228,17 @@ UIAbility configuration of the module, which is valid only for the current UIAbi The OpenHarmony system imposes a strict rule on the presence of application icons. If no icon is configured in the HAP file of an application, the system uses the icon specified in the **app.json** file as the application icon and displays it on the home screen. -Touching this icon will direct the user to the application details screen in **Settings**. +Touching this icon will direct the user to the application details screen in **Settings**, as shown in Figure 1. To hide an application icon from the home screen, you must configure the **AllowAppDesktopIconHide** privilege. For details, see [Application Privilege Configuration Guide](../../device-dev/subsystems/subsys-app-privilege-config-guide.md). +**Objectives**: + +This requirement on application icons is intended to prevent malicious applications from deliberately configuring no icon to block uninstallation attempts. + **Setting the application icon to be displayed on the home screen**: -Set **icon**, **label**, and **skills** under **abilities** in the **module.json5** file. In addition, the **skills** configuration must contain **ohos.want.action.home **and **entity.system.home**. +Set **icon**, **label**, and **skills** under **abilities** in the **module.json5** file. In addition, make sure the **skills** configuration contains **ohos.want.action.home** and **entity.system.home**. ``` { @@ -230,40 +256,42 @@ Set **icon**, **label**, and **skills** under **abilities** in the **module.json }] }], ... - + } } ``` -**Querying an application icon:** -* The HAP file contains ability configuration. - * The application icon is set under **abilities** in the **module.json5** file. +**Display rules of application icons and labels on the home screen:** +* The HAP file contains UIAbility configuration. + * The application icon on the home screen is set under **abilities** in the **module.json5** file. * The application does not have the privilege to hide its icon from the home screen. - * The returned home screen icon is the icon configured for the ability. - * The returned home screen label is the label configured for the ability. If no label is configured, the bundle name is returned. - * The returned component name is the component name of the ability. - * When the user touches the home screen icon, the home screen of the ability is displayed. + * The application icon displayed on the home screen is the icon configured for the UIAbility. + * The application label displayed on the home screen is the label configured for the UIAbility. If no label is configured, the bundle name is returned. + * The name of the UIAbility is displayed. + * When the user touches the home screen icon, the home screen of the UIAbility is displayed. * The application has the privilege to hide its icon from the home screen. * The information about the application is not returned during home screen information query, and the icon of the application is not displayed on the home screen. - * The application icon is not set under **abilities** in the **module.json5** file. + * The application icon on the home screen is not set under **abilities** in the **module.json5** file. * The application does not have the privilege to hide its icon from the home screen. - * The returned home screen icon is the icon configured under **app**. (The **icon** parameter in the **app.json** file is mandatory.) - * The returned home screen label is the label configured under **app**. (The **label** parameter in the **app.json** file is mandatory.) - * The returned component name is the component name displayed on the application details screen (this component is built in the system). - * Touching the home screen icon will direct the user to the application details screen. + * The application icon displayed on the home screen is the icon specified under **app**. (The **icon** field in the **app.json** file is mandatory.) + * The application label displayed on the home screen is the label specified under **app**. (The **label** field in the **app.json** file is mandatory.) + * Touching the application icon on the home screen will direct the user to the application details screen shown in Figure 1. * The application has the privilege to hide its icon from the home screen. * The information about the application is not returned during home screen information query, and the icon of the application is not displayed on the home screen. -* The HAP file does not contain ability configuration. +* The HAP file does not contain UIAbility configuration. * The application does not have the privilege to hide its icon from the home screen. - * The returned home screen icon is the icon configured under **app**. (The **icon** parameter in the **app.json** file is mandatory.) - * The returned home screen label is the label configured under **app**. (The **label** parameter in the **app.json** file is mandatory.) - * The returned component name is the component name displayed on the application details screen (this component is built in the system). - * Touching the home screen icon will direct the user to the application details screen. + * The application icon displayed on the home screen is the icon specified under **app**. (The **icon** field in the **app.json** file is mandatory.) + * The application label displayed on the home screen is the label specified under **app**. (The **label** field in the **app.json** file is mandatory.) + * Touching the application icon on the home screen will direct the user to the application details screen shown in Figure 1. * The application has the privilege to hide its icon from the home screen. - * The information about the application is not returned during home screen information query, and the icon of the application is not displayed on the home screen. + * The information about the application is not returned during home screen information query, and the icon of the application is not displayed on the home screen.

+ +**Figure 1** Application details screen +![Application details screen](figures/application_details.jpg) - **Table 4** abilities + + **Table 6** abilities | Name| Description| Data Type| Initial Value Allowed| | -------- | -------- | -------- | -------- | @@ -284,14 +312,14 @@ Set **icon**, **label**, and **skills** under **abilities** in the **module.json | removeMissionAfterTerminate | Whether to remove the relevant task from the task list after the UIAbility component is destroyed.
- **true**: Remove the relevant task from the task list after the UIAbility component is destroyed.
- **false**: Do not remove the relevant task from the task list after the UIAbility component is destroyed.| Boolean| Yes (initial value: **false**)| | orientation | Orientation of the UIAbility component when it is started. The options are as follows:
- **unspecified**: automatically determined by the system.
- **landscape**: landscape mode.
- **portrait**: portrait mode.
- **landscape_inverted**: inverted landscape mode.
- **portrait_inverted**: inverted portrait mode.
- **auto_rotation**: determined by the sensor.
- **auto_rotation_landscape**: determined by the sensor in the horizontal direction, including landscape and inverted landscape modes.
- **auto_rotation_portrait**: determined by the sensor in the vertical direction, including portrait and inverted portrait modes.
- **auto_rotation_restricted**: determined by the sensor when the sensor switch is enabled.
- **auto_rotation_landscape_restricted**: determined by the sensor in the horizontal direction, including landscape and inverted landscape modes, when the sensor switch is enabled.
- **auto_rotation_portrait_restricted**: determined by the sensor in the vertical direction, including portrait and inverted portrait modes, when the sensor switch is enabled.
- **locked**: auto rotation disabled.| String| Yes (initial value: **"unspecified"**)| | supportWindowMode | Window mode supported by the UIAbility component. The options are as follows:
- **fullscreen**: full-screen mode.
- **split**: split-screen mode.
- **floating**: floating window mode.| String array| Yes (initial value:
["fullscreen", "split", "floating"])| -| priority | Priority of the UIAbility component. This attribute applies only to system applications and does not take effect for third-party applications. In the case of [implicit query](../application-models/explicit-implicit-want-mappings.md), UIAbility components with a higher priority are at the higher place of the returned list. The value is an integer ranging from 0 to 10. The greater the value, the higher the priority.| Number| Yes (initial value: **0**)| +| priority | Priority of the UIAbility component. In the case of [implicit query](../application-models/explicit-implicit-want-mappings.md), UIAbility components with a higher priority are at the higher place of the returned list. The value is an integer ranging from 0 to 10. The greater the value, the higher the priority.
**NOTE**
This attribute applies only to system applications and does not take effect for third-party applications.| Number| Yes (initial value: **0**)| | maxWindowRatio | Maximum aspect ratio supported by the UIAbility component. The minimum value is 0.| Number| Yes (initial value: maximum aspect ratio supported by the platform)| | minWindowRatio | Minimum aspect ratio supported by the UIAbility component. The minimum value is 0.| Number| Yes (initial value: minimum aspect ratio supported by the platform)| | maxWindowWidth | Maximum window width supported by the UIAbility component, in vp. The minimum value is 0, and the value cannot be less than the value of **minWindowWidth** or greater than the maximum window width allowed by the platform. For details about the window size, see [Constraints](../windowmanager/window-overview.md#constraints).| Number| Yes (initial value: maximum window width supported by the platform)| | minWindowWidth | Minimum window width supported by the UIAbility component, in vp. The minimum value is 0, and the value cannot be less than the minimum window width allowed by the platform or greater than the value of **maxWindowWidth**. For details about the window size, see [Constraints](../windowmanager/window-overview.md#constraints).| Number| Yes (initial value: minimum window width supported by the platform)| | maxWindowHeight | Maximum window height supported by the UIAbility component, in vp. The minimum value is 0, and the value cannot be less than the value of **minWindowHeight** or greater than the maximum window height allowed by the platform. For details about the window size, see [Constraints](../windowmanager/window-overview.md#constraints).| Number| Yes (initial value: maximum window height supported by the platform)| | minWindowHeight | Minimum window height supported by the UIAbility component, in vp. The minimum value is 0, and the value cannot be less than the minimum window height allowed by the platform or greater than the value of **maxWindowHeight**. For details about the window size, see [Constraints](../windowmanager/window-overview.md#constraints).| Number| Yes (initial value: minimum window height supported by the platform)| -| excludeFromMissions | Whether the UIAbility component is displayed in the recent task list.
- **true**: displayed in the recent task list.
- **false**: not displayed in the recent task list.
**NOTE**
This tag applies only to system applications and does not take effect for third-party applications.| Boolean| Yes (initial value: **false**)| +| excludeFromMissions | Whether the UIAbility component is displayed in the recent task list.
- **true**: displayed in the recent task list.
- **false**: not displayed in the recent task list.
**NOTE**
This attribute applies only to system applications and does not take effect for third-party applications.| Boolean| Yes (initial value: **false**)| | recoverable | Whether the application can be recovered to its previous state in case of a detected fault.
- **true**: The application can be recovered to its previous state in case of a detected fault.
- **false**: The application cannot be recovered to its previous state in case of a detected fault.| Boolean| Yes (initial value: **false**)| Example of the **abilities** structure: @@ -347,7 +375,7 @@ Example of the **abilities** structure: The **skills** tag represents the feature set of [wants](../application-models/want-overview.md) that can be received by the UIAbility or ExtensionAbility component. - **Table 5** skills + **Table 7** skills | Name| Description| Data Type| Initial Value Allowed| | -------- | -------- | -------- | -------- | @@ -355,7 +383,7 @@ The **skills** tag represents the feature set of [wants](../application-models/w | entities | [Entities](../application-models/actions-entities.md) of wants that can be received.| String array| Yes (initial value: left empty)| |uris | URIs that match the wants.| Object array| Yes (initial value: left empty)| - **Table 6** uris + **Table 8** Internal structure of the uris tag | Name| Description| Data Type| Initial Value Allowed| | -------- | -------- | -------- | -------- | @@ -396,46 +424,11 @@ Example of the **skills** structure: } ``` -**Enhance implicit query** - -URI-level prefix matching is supported. -When only **scheme** or a combination of **scheme** and **host** or **scheme**, **host**, and **port** are configured in the configuration file, the configuration is successful if the URI prefixed with the configuration file is passed in. - - - * The query enhancement involves the following APIs: - [@ohos.bundle.bundleManager](../reference/apis/js-apis-bundleManager.md#bundlemanagerqueryabilityinfo)
- 1. function queryAbilityInfo(want: Want, abilityFlags: number, callback: AsyncCallback>): void;
- 2. function queryAbilityInfo(want: Want, abilityFlags: number, userId: number, callback: AsyncCallback>): void;
- 3. function queryAbilityInfo(want: Want, abilityFlags: number, userId?: number): Promise>; - * Configuration requirements
- abilities -> skills -> uris object
- Configuration 1: only **scheme = 'http'**
- Configuration 2: only **(scheme = 'http' ) + ( host = 'example.com')**
- Configuration 3: only **(scheme = 'http' ) + ( host = 'example.com' ) + ( port = '8080')**
- * Prefix match
- If the value of **uri** under [want](../application-models/want-overview.md) is obtained by calling the **queryAbilityInfo** API: - 1. uri = 'https://': No matches
- 2. uri = 'http://': Matches configuration 1
- 3. uri = 'https://example.com': No matches
- 4. uri = 'https://exa.com': No matches
- 5. uri = 'http://exa.com': Matches configuration 1
- 6. uri = 'http://example.com': Matches configuration 1 and configuration 2
- 7. uri = 'https://example.com:8080': No matches
- 8. uri = 'http://exampleaa.com:8080': Matches configuration 1
- 9. uri = 'http://example.com:9180': Matches configuration 1 and configuration 2
- 10. uri = 'http://example.com:8080': Matches configuration 1, configuration 2, and configuration 3
- 11. uri = 'https://example.com:9180/path': No matches
- 12. uri = 'http://exampleap.com:8080/path': Matches configuration 1
- 13. uri = 'http://example.com:9180/path': Matches configuration 1 and configuration 2
- 14. uri = 'http://example.com:8080/path': Matches configuration 1, configuration 2, and configuration 3
- - - ## extensionAbilities The **extensionAbilities** tag represents the configuration of extensionAbilities, which is valid only for the current extensionAbility. - **Table 7** extensionAbilities + **Table 9** extensionAbilities | Name| Description| Data Type| Initial Value Allowed| | -------- | -------- | -------- | -------- | @@ -444,10 +437,10 @@ The **extensionAbilities** tag represents the configuration of extensionAbilitie | description | Description of the ExtensionAbility component. The value is a string with a maximum of 255 bytes or a resource index to the description.| String| Yes (initial value: left empty)| | icon | Icon of the ExtensionAbility component. The value is an icon resource index. If **ExtensionAbility** is set to **MainElement** of the current module, this attribute is mandatory and its value must be unique in the application.| String| Yes (initial value: left empty)| | label | Name of the ExtensionAbility component displayed to users. The value is a string resource index.
**NOTE**
If **ExtensionAbility** is set to **MainElement** of the current module, this attribute is mandatory and its value must be unique in the application.| String| No| -| type | Type of the ExtensionAbility component. The options are as follows:
- **form**: ExtensionAbility of a widget.
- **workScheduler**: ExtensionAbility of a Work Scheduler task.
- **inputMethod**: ExtensionAbility of an input method.
- **service**: service component running in the background.
- **accessibility**: ExtensionAbility of an accessibility feature.
- **dataShare**: ExtensionAbility for data sharing.
- **fileShare**: ExtensionAbility for file sharing.
- **staticSubscriber**: ExtensionAbility for static broadcast.
- **wallpaper**: ExtensionAbility of the wallpaper.
- **backup**: ExtensionAbility for data backup.
- **window**: ExtensionAbility of a window. This type of ExtensionAbility creates a window during startup for which you can develop the GUI. The window is then combined with other application windows through **abilityComponent**.
- **thumbnail**: ExtensionAbility for obtaining file thumbnails. You can provide thumbnails for files of customized file types.
- **preview**: ExtensionAbility for preview. This type of ExtensionAbility can parse the file and display it in a window. You can combine the window with other application windows.
- **print**: ExtensionAbility for the print framework.
**NOTE**
The **service** and **dataShare** types apply only to system applications and do not take effect for third-party applications.| String| No| +| type | Type of the ExtensionAbility component. The options are as follows:
- **form**: ExtensionAbility of a widget.
- **workScheduler**: ExtensionAbility of a Work Scheduler task.
- **inputMethod**: ExtensionAbility of an input method.
- **service**: service component running in the background.
- **accessibility**: ExtensionAbility of an accessibility feature.
- **dataShare**: ExtensionAbility for data sharing.
- **fileShare**: ExtensionAbility for file sharing.
- **staticSubscriber**: ExtensionAbility for static broadcast.
- **wallpaper**: ExtensionAbility of the wallpaper.
- **backup**: ExtensionAbility for data backup.
- **window**: ExtensionAbility of a window. This type of ExtensionAbility creates a window during startup for which you can develop the GUI. The window is then combined with other application windows through **abilityComponent**.
- **thumbnail**: ExtensionAbility for obtaining file thumbnails. You can provide thumbnails for files of customized file types.
- **preview**: ExtensionAbility for preview. This type of ExtensionAbility can parse the file and display it in a window. You can combine the window with other application windows.
- **print**: ExtensionAbility for the print framework.
- **driver**: ExtensionAbility for the driver framework.
**NOTE**
The **service** and **dataShare** types apply only to system applications and do not take effect for third-party applications.| String| No| | permissions | Permissions required for another application to access the ExtensionAbility component.
The value is generally in the reverse domain name notation and contains a maximum of 255 bytes. It is an array of permission names predefined by the system or customized. The name of a customized permission must be the same as the **name** value of a permission defined in the **defPermissions** attribute.| String array| Yes (initial value: left empty)| -| uri | Data URI provided by the ExtensionAbility component. The value is a string with a maximum of 255 bytes, in the reverse domain name notation.
**NOTE**
This attribute is mandatory when **type** of the ExtensionAbility component is set to **dataShare**.| String| Yes (initial value: left empty)| -|skills | Feature set of [wants](../application-models/want-overview.md) that can be received by the ExtensionAbility component.
Configuration rule: In an entry package, you can configure multiple **skills** attributes with the entry capability. (A **skills** attribute with the entry capability is the one that has **ohos.want.action.home** and **entity.system.home** configured.) The **label** and **icon** in the first ExtensionAbility that has **skills** configured are used as the **label** and **icon** of the entire OpenHarmony service/application.
**NOTE**
The **skills** attribute with the entry capability can be configured for the feature-type package of an OpenHarmony application,
but not for an OpenHarmony service.| Array| Yes (initial value: left empty)| +| uri | Data URI provided by the ExtensionAbility component. The value is a string with a maximum of 255 bytes, in the reverse domain name notation.
**NOTE**
This attribute is mandatory when the type of the ExtensionAbility component is set to **dataShare**.| String| Yes (initial value: left empty)| +|skills | Feature set of [wants](../application-models/want-overview.md) that can be received by the ExtensionAbility component.
Configuration rule: In an entry package, you can configure multiple **skills** attributes with the entry capability. (A **skills** attribute with the entry capability is the one that has **ohos.want.action.home** and **entity.system.home** configured.) The **label** and **icon** in the first ExtensionAbility that has **skills** configured are used as the **label** and **icon** of the entire OpenHarmony service/application.
**NOTE**
The **skills** attribute with the entry capability can be configured for the feature package of an OpenHarmony application, but not for an OpenHarmony service. | Array| Yes (initial value: left empty)| | [metadata](#metadata)| Metadata of the ExtensionAbility component.| Object| Yes (initial value: left empty)| | exported | Whether the ExtensionAbility component can be called by other applications.
- **true**: The ExtensionAbility component can be called by other applications.
- **false**: The UIAbility component cannot be called by other applications.| Boolean| Yes (initial value: **false**)| @@ -463,7 +456,7 @@ Example of the **extensionAbilities** structure: "icon": "$media:icon", "label" : "$string:extension_name", "description": "$string:form_description", - "type": "form", + "type": "form", "permissions": ["ohos.abilitydemo.permission.PROVIDER"], "readPermission": "", "writePermission": "", @@ -477,7 +470,7 @@ Example of the **extensionAbilities** structure: "metadata": [ { "name": "ohos.extension.form", - "resource": "$profile:form_config", + "resource": "$profile:form_config", } ] } @@ -488,18 +481,19 @@ Example of the **extensionAbilities** structure: ## requestPermissions -The **requestPermissions** tage represents a set of permissions that the application needs to request from the system for running correctly. +The **requestPermissions** tag represents a set of permissions that the application needs to request from the system for running correctly. > **NOTE** > -> The permission settings configured in the **requestPermissions** tag apply to the entire application. +> - The permission settings configured in the **requestPermissions** tag apply to the entire application. +> - If your application needs to subscribe to an event published by itself and the permissions required for accessing the application are set in the **permissions** tag under **extensionAbilities**, then the application must register the related permissions in the **requestPermissions** tag to receive the event. -**Table 8** requestPermissions +**Table 10** requestPermissions | Name| Description| Data Type| Value Range| Default Value| | -------- | -------- | -------- | -------- | -------- | | name | Permission name. This attribute is mandatory.| String| Custom| –| -| reason | Reason for requesting the permission. This attribute is mandatory when the permission to request is **user_grant**.
**NOTE**
If the permission to request is **user_grant**, this attribute is required for the application to be released to the application market, and multi-language adaptation is required.| String| Resource reference of the string type in $string: \*\*\* format| A null value| +| reason | Reason for requesting the permission. This attribute is mandatory when the permission to request is **user_grant**.
**NOTE**
If the permission to request is **user_grant**, this attribute is required for the application to be released to the application market. Multi-language adaptation is required.| String| Resource reference of the string type in $string: \*\*\* format| A null value| | usedScene | Scene under which the permission is used. It consists of the **abilities** and **when** sub-attributes. Multiple abilities can be configured.
**NOTE**
This attribute is optional by default. If the permission to request is **user_grant**, the **abilities** sub-attribute is mandatory and **when** is optional.| **abilities**: string array
**when**: string| **abilities**: array of names of UIAbility or ExtensionAbility components
**when**: **inuse** or **always**| **abilities**: null
**when**: null| Example of the **requestPermissions** structure: @@ -534,17 +528,19 @@ The **shortcut** information is identified in **metadata**, where: - **name** indicates the name of the shortcut, identified by **ohos.ability.shortcuts**. - **resource** indicates where the resources of the shortcut are stored. - -| Attribute| Description| Data Type | Default Value| + +**Table 11** shortcuts + +| Name| Description| Data Type | Default Value| | -------- | -------- | -------- | -------- | | shortcutId | ID of the shortcut. The value is a string with a maximum of 63 bytes.| String| No| | label | Label of the shortcut, that is, the text description displayed for the shortcut. The value can be a string or a resource index to the label, with a maximum of 255 bytes.| String| Yes (initial value: left empty)| | icon | Icon of the shortcut. The value is an icon resource index.| String| Yes (initial value: left empty)| -| [wants](../application-models/want-overview.md) | Wants to which the shortcut points. Each want consists of the **bundleName** and **abilityName** sub-attributes.
**bundleName**: target bundle name of the shortcut. The value is a string.
**abilityName**: target component name of the shortcut. The value is a string.| Object| Yes (initial value: left empty)| +| [wants](../application-models/want-overview.md) | Wants to which the shortcut points. Each want consists of the **bundleName** and **abilityName** sub-attributes.
- **bundleName**: target bundle name of the shortcut. The value is a string.
- **abilityName**: target component name of the shortcut. The value is a string.| Object| Yes (initial value: left empty)| 1. Configure the **shortcuts_config.json** file in **/resource/base/profile/**. - + ```json { "shortcuts": [ @@ -564,7 +560,7 @@ The **shortcut** information is identified in **metadata**, where: ``` 2. In the **abilities** tag of the **module.json5** file, configure the **metadata** tag for the UIAbility component to which a shortcut needs to be added so that the shortcut configuration file takes effect for the UIAbility. - + ```json { "module": { @@ -601,7 +597,7 @@ The **shortcut** information is identified in **metadata**, where: The **distributionFilter** tag defines the rules for distributing HAP files based on different device specifications, so that precise matching can be performed when the application market distributes applications. Distribution rules cover five factors: API version, screen shape, screen size, screen resolution, and country code. During distribution, a unique HAP is determined based on the mapping between **deviceType** and these five factors. This tag must be configured in the **/resource/profile resource** directory. Its sub-tags are optional. - **Table 9** distributionFilter + **Table 12** distributionFilter | Name| Description| Data Type| Initial Value Allowed| | -------- | -------- | -------- | -------- | @@ -611,28 +607,28 @@ The **distributionFilter** tag defines the rules for distributing HAP files base | countryCode | Code of the country or region to which the application is to be distributed. The value is subject to the ISO-3166-1 standard. Enumerated definitions of multiple countries and regions are supported.| Object array| Yes (initial value: left empty)| - **Table 10** screenShape + **Table 13** Internal structure of the screenShape tag | Name| Description| Data Type| Initial Value Allowed| | -------- | -------- | -------- | -------- | | policy | Rule for the sub-attribute value. Set this attribute to **exclude** or **include**.
- **exclude**: Exclude the matches of the sub-attribute value.
- **include**: Include the matches of the sub-attribute value.| String| No| | value | Screen shapes. The value can be **circle**, **rect**, or both. Example: Different HAP files can be provided for a smart watch with a circular face and that with a rectangular face.| String array| No| - **Table 11** screenWindow + **Table 14** Internal structure of the screenWindow tag | Name| Description| Data Type| Initial Value Allowed| | -------- | -------- | -------- | -------- | | policy | Rule for the sub-attribute value. Set this attribute to **exclude** or **include**.
- **exclude**: Exclude the matches of the sub-attribute value.
- **include**: Include the matches of the sub-attribute value.| String| No| | value | Screen width and height, in pixels. The value an array of supported width and height pairs, each in the "width * height" format, for example, **"454 * 454"**.| String array| No| - **Table 12** screenDensity + **Table 15** Internal structure of the screenDensity tag | Name| Description| Data Type| Initial Value Allowed| | -------- | -------- | -------- | -------- | | policy | Rule for the sub-attribute value. Set this attribute to **exclude** or **include**.
- **exclude**: Exclude the matches of the sub-attribute value.
- **include**: Include the matches of the sub-attribute value.| String| No| | value | Pixel density of the screen, in DPI.| String array| No| - **Table 13** countryCode + **Table 16** Internal structure of the countryCode tag | Name| Description| Data Type| Initial Value Allowed| | -------- | -------- | -------- | -------- | @@ -699,14 +695,14 @@ Configure **metadata** in the **module** tag in the **module.json5** file. The **testRunner** tag represents the supported test runner. - **Table 14** testRunner +**Table 17** Internal structure of the testRunner tag | Name| Description| Data Type| Initial Value Allowed| | -------- | -------- | -------- | -------- | | name | Name of the test runner object. The value is a string with a maximum of 255 bytes.| String| No| | srcPath | Code path of the test runner. The value is a string with a maximum of 255 bytes.| String| No| -Example of the / structure: +Example of the **testRunner** structure: ```json @@ -720,3 +716,84 @@ Example of the / structure: } } ``` + +## atomicService + +The **atomicService** tag represents the atomic service configuration. It is available only when **bundleType** is set to **atomicService** in the **app.json** file. + +**Table 18** Internal structure of the atomicService tag + +| Name| Description| Data Type| Initial Value Allowed| +| -------- | -------- | -------- | -------- | +| preloads | List of modules to pre-load.| Object array| Yes (initial value: left empty)| + +Example of the **atomicService** structure: + + +```json +{ + "module": { + "atomicService": { + "preloads":[ + { + "moduleName":"feature" + } + ] + } + } +} +``` + +## preloads + +The **preloads** tag represents a list of modules to pre-load in an atomic service. + +**Table 19** Internal structure of the preloads tag + +| Name| Description| Data Type| Initial Value Allowed| +| -------- | -------- | -------- | -------- | +| moduleName | Name of the module to be preloaded when the current module is loaded in the atomic service.| String| No| + +Example of the **preloads** structure: + +```json +{ + "module": { + "atomicService": { + "preloads":[ + { + "moduleName":"feature" + } + ] + } + } +} +``` + +## dependencies + +The **dependencies** tag identifies the list of shared libraries that the module depends on when it is running. + +**Table 20** Internal structure of the dependencies tag + +| Name | Description | Data Type| Initial Value Allowed| +| ----------- | ------------------------------ | -------- | ---------- | +| bundleName | Name of the shared bundle on which the current module depends. | String | Yes| +| moduleName | Module name of the shared bundle on which the current module depends.| String | No| +| versionCode | Version number of the shared bundle. | Number | Yes| + +Example of the **dependencies** structure: + +```json +{ + "module": { + "dependencies": [ + { + "bundleName":"com.share.library", + "moduleName": "library", + "versionCode": 10001 + } + ] + } +} +``` diff --git a/en/application-dev/quick-start/module-structure.md b/en/application-dev/quick-start/module-structure.md index e4aee36db107109fcaa7e6d068cbc907009c69d4..d4593c12743cff7d6a5da9e10de69c6e4d6b71b5 100644 --- a/en/application-dev/quick-start/module-structure.md +++ b/en/application-dev/quick-start/module-structure.md @@ -21,7 +21,7 @@ The **module** tag contains the HAP configuration. | reqPermissions | Permissions that the application requests from the system when it is running.| Object array| Yes (initial value: left empty)| | colorMode | Color mode of the application. The options are as follows:
- **dark**: Resources applicable for the dark mode are used.
- **light**: Resources applicable for the light mode are used.
- **auto**: Resources are used based on the color mode of the system.| String| Yes (initial value: **auto**)| | distroFilter | Distribution rules of the application. This attribute defines the rules for distributing HAP files based on different device specifications, so that precise matching can be performed when the application market distributes applications. Distribution rules cover three factors: API version, screen shape, and screen resolution. During distribution, a unique HAP is determined based on the mapping between **deviceType** and these three factors.| Object| Yes (initial value: left empty) Set this attribute when an application has multiple entry modules.| -|commonEvents | Information about the common event static subscriber, which must contain the subscriber name, required permissions, and list of the subscribed common events. When a subscribed event is sent, the static subscriber is started. Unlike the common dynamic subscriber, the static subscriber does not need to actively call the common event subscription API in the service code, and may not be started when the common event is released. In constrast, the dynamic subscriber actively calls the common event subscription API and therefore requires the application to stay active.| Object array| Yes (initial value: left empty)| +|commonEvents | Information about the common event static subscriber, which must contain the subscriber name, required permissions, and list of the common events subscribed to. When a subscribed event is sent, the static subscriber is started. Unlike the dynamic subscriber, the static subscriber does not need to proactively call the common event subscription API in the service code, and may not be running when the common event is published.| Object array| Yes (initial value: left empty)| | entryTheme | Keyword of an OpenHarmony internal theme. Set it to the resource index of the name.| String| Yes (initial value: left empty)| |testRunner | Test runner configuration.| Object| Yes (initial value: left empty)| @@ -190,12 +190,82 @@ Example of the metadata attribute: ## Internal Structure of the abilities Attribute +**By default, application icons cannot be hidden from the home screen in OpenHarmony.** + +The OpenHarmony system imposes a strict rule on the presence of application icons. If no icon is configured in the HAP file of an application, the system creates a default icon for the application and displays it on the home screen. + +Touching this icon will direct the user to the application details screen in **Settings**, as shown in Figure 1. + +To hide an application icon from the home screen, you must configure the **AllowAppDesktopIconHide** privilege. For details, see [Application Privilege Configuration Guide](../../device-dev/subsystems/subsys-app-privilege-config-guide.md). + +**Objectives**: + +This requirement on application icons is intended to prevent malicious applications from deliberately configuring no icon to block uninstallation attempts. + +**Setting the application icon to be displayed on the home screen**: + +Set **icon**, **label**, and **skills** under **abilities** in the **config.json** file. In addition, make sure the **skills** configuration contains **ohos.want.action.home** and **entity.system.home**. + +``` +{ + "module":{ + + ... + + "abilities": [{ + "icon": "$media:icon", + "label": "Login", + "skills": [{ + "actions": ["ohos.want.action.home"], + "entities": ["entity.system.home"], + "uris": [] + }] + }], + + ... + + } +} +``` + +**Display rules of application icons and labels on the home screen:** +* The HAP file contains Page ability configuration. + * The application icon on the home screen is set under **abilities** in the **config.json** file. + * The application does not have the privilege to hide its icon from the home screen. + * The application icon displayed on the home screen is the icon configured for the Page ability. + * The application label displayed on the home screen is the label configured for the Page ability. If no label is configured, the bundle name is returned. + * The name of the Page ability is displayed. + * When the user touches the home screen icon, the home screen of the Page ability is displayed. + * The application has the privilege to hide its icon from the home screen. + * The information about the application is not returned during home screen information query, and the icon of the application is not displayed on the home screen. + * The application icon on the home screen is not set under **abilities** in the **config.json** file. + * The application does not have the privilege to hide its icon from the home screen. + * The application icon displayed on the home screen is the default icon. + * The application label displayed on the home screen is the bundle name of the application. + * Touching the application icon on the home screen will direct the user to the application details screen shown in Figure 1. + * The application has the privilege to hide its icon from the home screen. + * The information about the application is not returned during home screen information query, and the icon of the application is not displayed on the home screen. +* The HAP file does not contain Page ability configuration. + * The application does not have the privilege to hide its icon from the home screen. + * The application icon displayed on the home screen is the default icon. + * The application label displayed on the home screen is the bundle name of the application. + * Touching the application icon on the home screen will direct the user to the application details screen shown in Figure 1. + * The application has the privilege to hide its icon from the home screen. + * The information about the application is not returned during home screen information query, and the icon of the application is not displayed on the home screen. + +Note: The label displayed on the application details screen may be different from that displayed on the home screen. For non-Page abilities, it is the entry label set (if any).

+ +**Figure 1** Application details screen + +![Application details screen](figures/application_details.jpg) + + **Table 8** Internal structure of the abilities attribute | Name| Description| Data Type| Initial Value Allowed| | -------- | -------- | -------- | -------- | | process | Name of the process running the application or ability. If the **process** attribute is configured in the **deviceConfig** tag, all abilities of the application run in this process. You can set the **process** attribute for a specific ability in the **abilities** attribute, so that the ability can run in the particular process. If this attribute is set to the name of the process running other applications, all these applications can run in the same process, provided they have the same unified user ID and the same signature. The value can contain a maximum of 31 bytes.| String| Yes (initial value: left empty)| -| name | Ability name. The value can be a reverse domain name, in the format of "*bundleName*.*className*", for example, **"com.example.myapplication.EntryAbility"**. Alternatively, the value can start with a period (.) followed by the class name, for example, **".EntryAbility"**.
The ability name must be unique in an application. Note: If you use DevEco Studio to create the project, an ability named **EntryAbility** will be created by default, and its configuration will be saved to the **config.json** file. The value of this attribute can be customized if you use other IDEs. The value can contain a maximum of 127 bytes.| String| No| +| name | Ability name. The value can be a reverse domain name, in the format of "*bundleName*.*className*", for example, **"com.example.myapplication.EntryAbility"**. Alternatively, the value can start with a period (.) followed by the class name, for example, **".EntryAbility"**.
The ability name must be unique in an application. Note: If you use DevEco Studio to create the project, an ability named **EntryAbility** will be created by default, and its configuration will be saved to the **config.json** file. If you use other IDEs, the value of this attribute can be customized. The value can contain a maximum of 127 bytes.| String| No| | description | Description of the ability. The value can be a string or a resource index to descriptions in multiple languages. The value can contain a maximum of 255 bytes.| String| Yes (initial value: left empty)| | icon | Index to the ability icon file. Example value: **$media:ability_icon**. In the **skills** attribute of the ability, if the **actions** value contains **action.system.home** and the **entities** value contains **entity.system.home**, the icon of the ability is also used as the icon of the application. If multiple abilities address this condition, the icon of the first candidate ability is used as the application icon.
Note: The **icon** and **label** values of an application are visible to users. Ensure that at least one of them is different from any existing icons or labels.| String| Yes (initial value: left empty)| | label | Ability name displayed to users. The value can be a name string or a resource index to names in multiple languages. In the **skills** attribute of the ability, if the **actions** value contains **action.system.home** and the **entities** value contains **entity.system.home**, the label of the ability is also used as the label of the application. If multiple abilities address this condition, the label of the first candidate ability is used as the application label.
Note: The **icon** and **label** values of an application are visible to users. Ensure that at least one of them is different from any existing icons or labels. The value can be a reference to a string defined in a resource file or a string enclosed in brackets ({}). The value can contain a maximum of 255 characters.| String| Yes (initial value: left empty)| @@ -212,13 +282,13 @@ Example of the metadata attribute: | grantPermission | Whether permissions can be granted for any data in the ability.| Boolean| Yes (initial value: left empty)| | readPermission | Permission required for reading data in the ability. This attribute applies only to the ability using the Data template. The value is a string with a maximum of 255 bytes. This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types.| String| Yes (initial value: left empty)| | writePermission | Permission required for writing data to the ability. This attribute applies only to the ability using the Data template. The value is a string with a maximum of 255 bytes.| String| Yes (initial value: left empty)| -| configChanges | System configurations that the ability concerns. Upon any changes on the concerned configurations, the **onConfigurationUpdated** callback will be invoked to notify the ability. The options are as follows:
**mcc**: indicates that the mobile country code (MCC) of the IMSI is changed. Typical scenario: A SIM card is detected, and the MCC is updated.
**mnc**: indicates that the mobile network code (MNC) of the IMSI is changed. Typical scenario: A SIM card is detected, and the MNC is updated.
**locale**: indicates that the locale is changed. Typical scenario: The user selectes a new language for the text display of the device.
**layout**: indicates that the screen layout is changed. Typical scenario: Currently, different display forms are all in the active state.
**fontSize**: indicates that font size is changed. Typical scenario: A new global font size is set.
**orientation**: indicates that the screen orientation is changed. Typical scenario: The user rotates the device.
**density**: indicates that the display density is changed. Typical scenario: The user may specify different display ratios, or different display forms are active at the same time.
**size**: indicates that the size of the display window is changed.
**smallestSize**: indicates that the length of the shorter side of the display window is changed.
**colorMode**: indicates that the color mode is changed.| String array| Yes (initial value: left empty)| +| configChanges | System configurations that the ability concerns. Upon any changes on the concerned configurations, the **onConfigurationUpdated** callback will be invoked to notify the ability. The options are as follows:
**mcc**: indicates that the mobile country code (MCC) of the IMSI is changed. Typical scenario: A SIM card is detected, and the MCC is updated.
**mnc**: indicates that the mobile network code (MNC) of the IMSI is changed. Typical scenario: A SIM card is detected, and the MNC is updated.
**locale**: indicates that the locale is changed. Typical scenario: The user selects a new language for the text display of the device.
**layout**: indicates that the screen layout is changed. Typical scenario: Currently, different display forms are all in the active state.
**fontSize**: indicates that font size is changed. Typical scenario: A new global font size is set.
**orientation**: indicates that the screen orientation is changed. Typical scenario: The user rotates the device.
**density**: indicates that the display density is changed. Typical scenario: The user may specify different display ratios, or different display forms are active at the same time.
**size**: indicates that the size of the display window is changed.
**smallestSize**: indicates that the length of the shorter side of the display window is changed.
**colorMode**: indicates that the color mode is changed.| String array| Yes (initial value: left empty)| | mission | Task stack of the ability. This attribute applies only to the ability using the Page template. By default, all abilities in an application belong to the same task stack.| String| Yes (initial value: bundle name of the application)| | targetAbility | Target ability that this ability alias points to. This attribute applies only to the ability using the Page template. If the **targetAbility** attribute is set, only **name**, **icon**, **label**, **visible**, **permissions**, and **skills** take effect in the current ability (ability alias). Other attributes use the values of the **targetAbility** attribute. The target ability must belong to the same application as the alias and must be declared in **config.json** ahead of the alias.| String| Yes (initial value: left empty, indicating that the current ability is not an alias)| | formsEnabled | Whether the ability can provide widgets. This attribute applies only to the ability using the Page template.
**true**: This ability can provide widgets.
**false**: This ability cannot provide widgets.| Boolean| Yes (initial value: **false**)| | forms | Information about the widgets used by the ability. This attribute is valid only when **formsEnabled** is set to **true**.| Object array| Yes (initial value: left empty)| | srcLanguage | Programming language of the ability, which you can specify when creating the project.| String| Yes (initial value: **"js"**)| -| srcPath | JS code path corresponding to the ability. The value can contain maximum of 127 bytes.| String| No| +| srcPath | JS code path corresponding to the ability. The value can contain a maximum of 127 bytes.| String| No| | uriPermission | Application data that the ability can access. This attribute consists of the **mode** and **path** sub-attributes. This attribute is valid only for the capability of the type provider.| Object| Yes (initial value: left empty)| | startWindowIcon | Index to the icon file of the ability startup page. This attribute applies only to the ability using the Page template. Example: **$media:icon**.| String| Yes (initial value: left empty)| | startWindowBackground | Index to the background color resource file of the ability startup page. This attribute applies only to the ability using the Page template. Example: **$color:red**.| String| Yes (initial value: left empty)| @@ -351,9 +421,9 @@ Example of the **skills** attribute structure: ] ``` -## reqPermissions Attributes +## Internal Structure of the reqPermissions Attribute -**Table 12** reqPermissions attributes +**Table 12** Internal structure of the reqPermissions attribute | Name| Description| Data Type| Initial Value Allowed| | -------- | -------- | -------- | -------- | @@ -687,7 +757,7 @@ Example of the **commonEvents** attribute structure: | -------- | -------- | -------- | -------- | | name | Name of a permission. The value can contain a maximum of 255 bytes.| String| No| | grantMode | Permission grant mode. The options are as follows:
- **system_grant**: The permission is automatically granted by the system after the application is installed.
- **user_grant**: The permission is dynamically requested when needed and must be granted by the user.| String| Yes (initial value: **"system_grant"**)| -| availableLevel | Permission type. The options are as follows:
- **system_core**: system core permission.
- **system_basic**: basic system permission.
- **normal**: normal permission, which can be requsted by all applications.| String| Yes (initial value: **"normal"**)| +| availableLevel | Permission type. The options are as follows:
- **system_core**: system core permission.
- **system_basic**: basic system permission.
- **normal**: normal permission, which can be requested by all applications.| String| Yes (initial value: **"normal"**)| | provisionEnable | Whether the permission can be requested in provision mode, including high-level permissions. The value **true** means that the permission can be requested in provision mode.| Boolean| Yes (initial value: **true**)| | distributedSceneEnabled | Whether the permission can be used in distributed scenarios.| Boolean| Yes (initial value: **false**)| | label | Brief description of the permission. The value is a resource index to the description.| String| Yes (initial value: left empty)| diff --git a/en/application-dev/quick-start/multi-hap-objective.md b/en/application-dev/quick-start/multi-hap-objective.md index ad43c84fd7799be1e3277400c6c5dfb1926d5b7c..ae7bb791b71225cfa15741d4c99975111734709f 100644 --- a/en/application-dev/quick-start/multi-hap-objective.md +++ b/en/application-dev/quick-start/multi-hap-objective.md @@ -1,10 +1,10 @@ # Multi-HAP Design Objectives -- Modular management: A well-designed application is generally managed in a modular manner, where modules are loosely coupled. In light of this, the multi-HAP mechanism is designed, allowing you to divide services into multiple modules and store each module in an independent HAP file. For example, If you are developing a payment application and its home screen consists of multiple modules, such as the scan, pay, messaging, and finance modules, you can implement the logic of the home screen for managing other modules in the entry-type HAP file, and implement specific modules in feature-type HAP files. The feature-type HAP files are independent. You can develop and test each of them separately, and then integrate them with the entry-type HAP file. +- Modular management: A well-designed application is generally managed in a modular manner, where modules are loosely coupled. In light of this, the multi-HAP mechanism is designed, allowing you to divide services into multiple modules and store each module in an independent HAP file. For example, if you are developing a payment application whose home screen consists of multiple modules, such as the scan, pay, messaging, and finance modules, you can implement the HAP files as follows: (1) In the entry-type HAP file, implement the home screen logic for managing modules; (2) in feature-type HAP files, implement specific modules. The feature-type HAP files are independent of each other. You can develop and test each of them separately, and then integrate them with the entry-type HAP file. -- Flexible deployment: You can combine multiple HAP files and deploy them on different devices. Assume that an application contains one entry-type HAP file (**Entry.hap**) and two feature-type HAP files (**Feature1.hap** and **Feature2.hap**). The **Entry.hap** file can be deployed on device A and device B, the **Feature1.hap** file can be deployed only on device A, and the **Feature2.hap** can be deployed only on device B. In this way, you can easily combine the **Entry.hap** and **Feature1.hap** files and deploy them on device A, and combine the **Entry.hap** and **Feature2.hap** files and deploy them on device B. +- Flexible deployment: You can flexibly combine HAP files for device-specific deployment. Assume that an application contains one entry-type HAP file (**entry.hap**) and two feature-type HAP files (**Feature1.hap** and **Feature2.hap**). The **Entry.hap** file can be deployed on device A and device B, the **Feature1.hap** file can be deployed only on device A, and the **Feature2.hap** can be deployed only on device B. This means that you can combine the **Entry.hap** and **Feature1.hap** files and deploy them on device A, and combine the **Entry.hap** and **Feature2.hap** files and deploy them on device B. -- On-demand loading: You can load modules only when they are needed, reducing the package size. Specifically, you can configure some HAP files of an application to be loaded on demand. For example, if some features are not used during application startup, you can configure them to be loaded only when they are needed, rather than being loaded at startup. This can reduce the size of the application package to some extent. +- On-demand loading: You can load modules only when they are needed, reducing the package size. Specifically, you can configure some HAP files of your application to be loaded on demand. For example, if some features are not used during application startup, you can configure them to be loaded only when they are needed, rather than being loaded at startup. This can reduce the size of the application package to some extent. -- Easier resource sharing: The resources (including public resource files and public pages) and shared objects (.so library files) required by multiple HAP files can be stored in an independent HAP file. In this way, other HAP files can obtain the resources and files by accessing the HAP, which reduces the size of the application package to some extent. +- Easier resource sharing: The resources (including public resource files and public pages) and shared objects (.so library files) required by multiple HAP files can be stored in an independent HAP file. In this way, other HAP files can obtain the resources and files by accessing the HAP, which also reduces the size of the application package to some extent. diff --git a/en/application-dev/quick-start/quickfix-debug.md b/en/application-dev/quick-start/quickfix-debug.md new file mode 100644 index 0000000000000000000000000000000000000000..b7cdf872c72198e796be1f1b65e635cb52ce04e6 --- /dev/null +++ b/en/application-dev/quick-start/quickfix-debug.md @@ -0,0 +1,92 @@ +# CLI-based Quick Fix Development + +You can use the command-line tool to develop a quick fix file, an expeditious approach to resolve application bugs. In this document, an application with the bundle name of **com.ohos.quickfix** in version 1000000 is used as an example to describe how to develop a quick fix file with the command-line tool. + +## Writing the patch.json File + +Write a **patch.json** file that meets your project requirements and place it in any directory of the project. (Configuring the **patch.json** file is not supported in DevEco Studio.) Create a **patch.json** file on the local computer. Below is an example of the file content: +```json +{ + "app" : { + "bundleName" : "com.ohos.quickfix", + "versionCode": 1000000, // Application version + "versionName" : "1.0.0.1", + "patchVersionCode": 1000000, // Patch version + "patchVersionName" : "1.0.0.1" + }, + "module" : { + "name" : "entry", + "type" : "patch", + "deviceTypes" : [ + "default", + "tablet" + ], + "originalModuleHash": "11223344556677889900" // SHA-256 value of the HAP file to restore + } +} +``` + +## Generating a Quick Fix File +### Quick Fix for TS Code +* After modifying the TS code file in DevEco Studio and build it into a HAP file, you can find the corresponding .abc file in the project directory, for example, **build\default\cache\default\LegacyCompileETS\jsbundle\temporary\pages\index.abc**. + +### Quick Fix for C++ Code + +* In DevEco Studio, build the original C++ code into a .so file. Fix bugs in the code and rebuild the code into a new .so file. You can find this .so file in the project directory, for example, **build\default\intermediates\libs\default\arm64-v8a\libentry.so**. +* Locate the **diff.exe** tool in the **toolchains** folder in the local OpenHarmony SDK path. Use this tool to generate a quick fix .so file based on the old and new .so files. The command is as follows: +```shell +$ diff.exe -s Example.z.so -d Example.z.so -p Example.z.so.diff +``` +The command contains the following options: +- -**s**: path to the old .so file +- -**d**: path to the new .so file +- -**p**: path of the generated differential file + +## Generating a Quick Fix File in .hqf Format + +With the preceding **patch.json**, .abc, and .so files, run the following command to generate an .hqf file using the **app_packing_tool.jar** tool in the **toolchains** folder in the local OpenHarmony SDK path: +```shell +$ java -jar app_packing_tool.jar --mode hqf --json-path patch.json --lib-path libs --ets-patch patchs --out-path entry-default-unsigned.hqf --force true +``` + +The command contains the following options. +| Option|Description | Remarks| +| --- | --- |---| +| mode |Mode. | Mandatory| +| json-path|Path to the **patch.json** file.|Mandatory| +| lib-path|Path to the quick fix .so file. For details about the path, see [Structure of the Quick Fix Package](quickfix-principles.md#structure-of-the-quick-fix-package).|Optional| +| ets-path|Path to the quick fix .abc file.|Optional| + +## Signing the Quick Fix File + +Use the [hapsigner](../security/hapsigntool-guidelines.md) tool to sign the **entry-default-unsigned.hqf** file, in the same way you sign a HAP file. To be specific, run the following command to use **hap-sign-tool.jar** in the **toolchains** folder in the local OpenHarmony SDK path: + +```shell +$ java -jar hap-sign-tool.jar sign-app -keyAlias "OpenHarmony Application Release" -signAlg "SHA256withECDSA" -mode "localSign" -appCertFile "OpenHarmonyApplication.pem" -profileFile "ohos_provision_release.p7b" -inFile "entry-default-unsigned.hqf" -keystoreFile "OpenHarmony.p12" -outFile "entry-signed-release.hqf" -keyPwd "123456" -keystorePwd "123456" +``` + +## Installing the Quick Fix File + +Push the **entry-signed-release.hqf** file to the device. +```shell +hdc.exe file send .\entry-signed-release.hqf /data/ +``` + +Run the following command to install the quick fix file as a patch: +```shell +$ bm quickfix -a -f /data/entry-signed-release.hqf +``` + +The complete commands are as follows: +``` +$ bm quickfix -h +usage: bm quickfix +options list: +-h, --help list available commands +-q, --query indicates query quickfix, used with -b or --bundle-name +-b, --bundle-name query quickfix status and information by a specified bundle name +-a, --apply indicates apply quickfix, used with -f or --file-path +-f, --file-path apply a quickfix file by a specified path +-f, --file-path ... apply some quickfix files of one bundle +-f, --file-path apply quickfix files by direction, under which are quickfix files +``` diff --git a/en/application-dev/quick-start/quickfix-principles.md b/en/application-dev/quick-start/quickfix-principles.md new file mode 100644 index 0000000000000000000000000000000000000000..4c0a1f684cfc1ff71c5ad9a2594ae8823e178e82 --- /dev/null +++ b/en/application-dev/quick-start/quickfix-principles.md @@ -0,0 +1,105 @@ +# Quick Fix Overview + +Quick fix is a technical means provided by the OpenHarmony system for developers to fix application bugs in a manner that is far faster than application upgrades. Compared with the full application upgrade, the quick fix provides a better user experience by being smaller and faster. It allows users to fix application bugs quickly, without restarting their application. + +## Rules for Using Quick Fix + +* The quick fix only works for TypeScript (TS) and C++ code of applications, that is, .abc files (created after TS code compilation) and .so files (created after C++ code compilation). It does not work for resource files. +* No new .abc and .so files are allowed. +* Before deploying a quick fix package, make sure the corresponding application has been installed. Otherwise, the deployment will fail. +* The bundle name and application version number configured in the quick fix package must be the same as those of the installed application. Otherwise, the deployment will fail. +* Make sure the version of the quick fix package to deploy is later than that of the one previously deployed. Otherwise, the deployment will fail. +* The signature information of the quick fix package must be the same as that of the application to be fixed. Otherwise, the deployment will fail. +* Installing an application update will delete quick fix package. + +## Structure of the Quick Fix Package + +![Quick Fix Package Structure](figures/quick_fix_bundle_struct.png) +
The preceding figure shows the structure of the quick fix package released by an OpenHarmony application. +* As shown in the figure, the quick fix package comes in two formats: + * .appqf (Application Quick Fix) +
There is a one-to-one mapping between the .appqf file and App Pack of an application. For details, see [Application Package Structure in Stage Model](application-package-structure-stage). + * The .appqf file is used to release OpenHarmony applications to the application market and cannot be directly installed on devices. + * An .appqf file consists of one or more .hqf (Harmony Ability Package Quick Fix) files, which are extracted from the .appqf file by the application market and then distributed to specific devices. + * The .appqf file must contain the developer's signature information before being released to the application market. For details about how to sign the file, see [hapsigner Overview](../security/hapsigntool-overview.md). + * .hqf (Harmony Ability Package Quick Fix) +
The .hqf file is a quick fix to bugs in a HAP file. It can be installed on devices. An .hqf file contains .abc and .so files. The .abc files provide the quick fix, and the .so files provide package configuration information as well as the quick fix. + * .abc file: modified TS code in the application, which is a bytecode file created after the build. + * **libs** directory: a collection of .so.diff files, which are differential files of the .so library files, organized by system CPU architecture, such as arm and x86. + * **patch.json**: +
This file is used to describe the version information of the .hqf file and is filled in by developers. The details are as follows: + ```json + { + "app" : { + "bundleName" : "com.ohos.quickfix", + "versionCode" : 1000000, + "versionName" : "1.0.0", + "patchVersionCode" : 1000000, + "patchVersionName" : "1.0.0" + }, + "module" : { + "name" : "entry", + "type" : "patch", + "deviceTypes" : [ + "default", + "tablet" + ], + "originalModuleHash" : "11223344556677889900" + } + } + ``` + The following describes the parameters: + | Parameter|Type |Description |Initial Value Allowed| + | --- | --- | --- | --- | + |bundleName | string | Bundle name of the application. | No| + |versionCode | int |Version of the application. | No | + |versionName |string |Version name of the application.| No for the patch| + |patchVersionCode |int |Version of the patch. | No| + |patchVersionName |string |Version name of the patch.| No for the patch| + |name |string |Module name of the application, which is used to restore the module.| No| + |type | string|Type of the patch. The value can only be **patch**.| No| + |deviceTypes |array |Device types supported by the patch.| No| + |originalModuleHash| string |Hash value of the bundle corresponding to the original module name.| No| + +## Quick Fix to .abc Files Created After TS Code Compilation + +![.abc File Quick Fix](figures/quick_fix_gen_abc.png) + +The preceding figure shows the process of creating an .abc file quick fix using the TS compiler. +* An application build creates .abc and .map files. The .abc file is a bytecode file created after TS code compilation. It is used when the application is running. The .map file is an intermediate file created when the TS code is compiled using the TS compiler. It stores information such as functions and classes in the code. +* After bugs in the application are fixed, the application code is compiled again. During the compilation, the difference between the source and the target is obtained based on the preceding .map file and the current TS code, and an .abc file for quick fix is generated based on the difference. This .abc file will be placed in the .hqf file. + +## Quick Fix to .so Files Created After C++ Code Compilation + +![.so File Quickly Fix](figures/quick_fix_gen_so.png) + +The preceding figure shows the process of creating a .so file quick fix using the differential tool. +* The C++ source code of the original application is built into a .so file by using a compiler. The .so file is used when the application is running. +* After bugs in the application are fixed, the C++ code is compiled again into a .so file. With the two .so files before and after bug fixes, the differential tool generates a .so file for quick fix. This .so file will also be placed in the .hqf file. + +## Quick Fix Release and Deployment Process + +![Quick Fix File Release](figures/quick-fix-devel_release.png) + +As shown above, the modules involved in the release process are as follows: +* DevEco Studio: an integrated development environment for developing code projects. It can be used to create a quick fix file based on the original application code and the code after bug fixes, and sign the created quick repair file for release to the application market. +* Application market server: place where you release the quick fix file. It verifies the signature, scans for risks, unpacks and resigns the file, and then distributes the file to the client. +* Application market client: tool that receives the quick fix file from the application market server and triggers installation. +* Bundle manager service: system service used to manage the installation and uninstallation of application packages and quick fix files on the device. +* Quick fix engine: system service used to manage switching to quick fix code on the device. If the target application is running, the quick fix engine instructs it to switch to the quick fix file upon completion of the quick fix file deployment. +* File system: location where the application package and quick repair file are deployed on the device. + +In the end-to-end release and deployment process of the quick repair file: +1. DevEco Studio is used to create a quick fix file through building and packaging based on the original application source code and the source code after bug fixes, and sign the created quick fix file. +2. The signed quick repair file is released to the application market, which then distributes the file after verifying the signature, scanning for risks, and unpacking and resigning the file. +3. When the on-device application market client detects that a new quick fix file is available on the application market server, it downloads the file, and then installs and deploys the file through the bundle manager service in the system. +4. After the quick fix file is deployed, the quick fix engine triggers the application to switch to the quick fix file, ensuring that the user can instantly use the functions where bugs are fixed. + +## Quick Fix File Debugging Process + +![Quick Fix File Debugging](figures/quick-fix-debug.png) + +* As the quick fix capability is not yet available in DevEco Studio, for the time being, you can use the provided command-line tool to develop a quick fix file. The procedure is as follows: +1. With the original application source code and the source code after bug fixes, use the command-line tool to build and create quick fix files in .hpf format. Sign the .hpf files before installing them on the device. As aforementioned, the .appqf file cannot be installed on the device. +2. Install and deploy the .hqf files on the device using the command-line tool. +3. After the .hqf files are deployed, a callback is called to instruct the quick fix engine to trigger the application to switch to the quick fix file, ensuring that the user can instantly use the functions where bugs are fixed. diff --git a/en/application-dev/quick-start/resource-categories-and-access.md b/en/application-dev/quick-start/resource-categories-and-access.md index 56e8209a5c19e353a21b80ff8b34dd51885db310..aa5e53ae90c1794125f5b6ae8a8f7a5115128743 100644 --- a/en/application-dev/quick-start/resource-categories-and-access.md +++ b/en/application-dev/quick-start/resource-categories-and-access.md @@ -35,7 +35,7 @@ resources | Category | base Subdirectory | Qualifiers Subdirectory | rawfile Subdirectory | | ---- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | -| Structure| The **base** subdirectory is a default directory. If no qualifiers subdirectories in the **resources** directory of the application match the device status, the resource file in the **base** subdirectory will be automatically referenced.
Resource group subdirectories are located at the second level of subdirectories to store basic elements such as strings, colors, and boolean values, as well as resource files such as media, animations, and layouts. For details, see [Resource Group Subdirectories](#resource-group-subdirectories).| You need to create qualifiers subdirectories on your own. Each directory name consists of one or more qualifiers that represent the application scenarios or device characteristics. For details, see [Qualifiers Subdirectories](#qualifiers-subdirectories).
Resource group subdirectories are located at the second level of subdirectories to store basic elements such as strings, colors, and boolean values, as well as resource files such as media, animations, and layouts. For details, see [Resource Group Subdirectories](#resource-group-subdirectories). | You can create multiple levels of subdirectories with custom directory names. They can be used to store various resource files.
However, resource files in the **rawfile** subdirectory will not be matched based on the device status.| +| Structure| The **base** subdirectory is a default directory. If no qualifiers subdirectories in the **resources** directory of the application match the device status, the resource file in the **base** subdirectory will be automatically referenced.
Resource group subdirectories are located at the second level of subdirectories to store basic elements such as strings, colors, and boolean values, as well as resource files such as media, animations, and layouts. For details, see [Resource Group Subdirectories](#resource-group-subdirectories).| You need to create qualifiers subdirectories on your own. Each directory name consists of one or more qualifiers that represent the application scenarios or device characteristics. For details, see [Qualifiers Subdirectories](#qualifiers-subdirectories).
Resource group subdirectories are located at the second level of subdirectories to store basic elements such as strings, colors, and boolean values, as well as resource files such as media, animations, and layouts. For details, see [Resource Group Subdirectories](#resource-group-subdirectories).| You can create multiple levels of subdirectories with custom directory names. They can be used to store various resource files.
However, resource files in the **rawfile** subdirectory will not be matched based on the device status.| | Compilation| Resource files in the subdirectory are compiled into binary files, and each resource file is assigned an ID. | Resource files in the subdirectory are compiled into binary files, and each resource file is assigned an ID. | Resource files in the subdirectory are directly packed into the application without being compiled, and no IDs will be assigned to the resource files. | | Reference| Resource files in the subdirectory are referenced based on the resource type and resource name. | Resource files in the subdirectory are referenced based on the resource type and resource name. | Resource files in the subdirectory are referenced based on the file path and file name. | @@ -81,9 +81,9 @@ You can create resource group subdirectories (including element, media, and prof | Resource Group Subdirectory | Description | Resource File | | ------- | ---------------------------------------- | ---------------------------------------- | -| element | Indicates element resources. Each type of data is represented by a JSON file. The options are as follows:
- **boolean**: boolean data
- **color**: color data
- **float**: floating-point data
- **intarray**: array of integers
- **integer**: integer data
- **pattern**: pattern data
- **plural**: plural form data
- **strarray**: array of strings
- **string**: string data| It is recommended that files in the **element** subdirectory be named the same as the following files, each of which can contain only data of the same type:
- boolean.json
- color.json
- float.json
- intarray.json
- integer.json
- pattern.json
- plural.json
- strarray.json
- string.json | -| media | Indicates media resources, including non-text files such as images, audios, and videos. | The file name can be customized, for example, **icon.png**. | -| profile | Indicates a user-defined configuration file. You can obtain the file content by using the [getProfileByAbility](../reference/apis/js-apis-bundleManager.md#bundlemanagergetprofilebyability) API. | The file name can be customized, for example, **test_profile.json**. | +| element | Indicates element resources. Each type of data is represented by a JSON file. (Only files are supported in this directory.) The options are as follows:
- **boolean**: boolean data
- **color**: color data
- **float**: floating-point data
- **intarray**: array of integers
- **integer**: integer data
- **pattern**: pattern data
- **plural**: plural form data
- **strarray**: array of strings
- **string**: string data| It is recommended that files in the **element** subdirectory be named the same as the following files, each of which can contain only data of the same type:
- boolean.json
- color.json
- float.json
- intarray.json
- integer.json
- pattern.json
- plural.json
- strarray.json
- string.json | +| media | Indicates media resources, including non-text files such as images, audios, and videos. (Only files are supported in this directory.) | The file name can be customized, for example, **icon.png**. | +| profile | Indicates a custom configuration file. You can obtain the file content by using the [getProfileByAbility](../reference/apis/js-apis-bundleManager.md#bundlemanagergetprofilebyability) API. (Only files are supported in this directory.) | The file name can be customized, for example, **test_profile.json**. | | rawfile | Indicates other types of files, which are stored in their raw formats after the application is built as an HAP file. They will not be integrated into the **resources.index** file.| The file name can be customized. | **Media Resource Types** @@ -229,7 +229,7 @@ When referencing resources in the **rawfile** subdirectory, use the **"$rawfile( > > Resource descriptors accept only strings, such as **'app.type.name'**, and cannot be combined. > -> The return value of **$r** is a **Resource** object. You can obtain the corresponding string by using the [getStringValue](../reference/apis/js-apis-resource-manager.md) API. +> The return value of **$r** is a **Resource** object. You can obtain the corresponding string by using the [getStringValue](../reference/apis/js-apis-resource-manager.md#getstringvalue9) API. In the **.ets** file, you can use the resources defined in the **resources** directory. The following is a resource usage example based on the resource file examples in [Resource Group Sub-directories](#resource-group-subdirectories): @@ -252,7 +252,6 @@ Text($r('app.string.message_arrive', "five'o clock")) Text($r('app.plural.eat_apple', 5, 5)) .fontColor($r('app.color.color_world')) .fontSize($r('app.float.font_world')) -} Image($r('app.media.my_background_image')) // Reference media resources. diff --git a/en/application-dev/quick-start/shared-guide.md b/en/application-dev/quick-start/shared-guide.md new file mode 100644 index 0000000000000000000000000000000000000000..b73ad743a97d97b1ba9fc286c68e3b25d6f053d4 --- /dev/null +++ b/en/application-dev/quick-start/shared-guide.md @@ -0,0 +1,20 @@ +# Shared Package Overview + +OpenHarmony provides two types of shared packages: [Harmony Achive (HAR)](har-package.md) static shared package and Harmony Shared Package (HSP) dynamic shared package. + +Both the HAR and HSP are used to share code and resources and can contain code, C++ libraries, resources, and configuration files. The biggest differences between them are as follows: The code and resources in the HAR are compiled with the invoking module, and if there are multiple invoking modules, the build product contains multiple copies of the same code and resources; the code and resources in the HSP can be compiled independently, and the build product contains only one copy of the code and resources. + +**Figure 1** HAR and HSP in the App Pack + +![in-app-hsp-har](figures/in-app-hsp-har.png) + +The HSP is designed to solve the following issues with the HAR: +- When multiple HAPs reference the same HAR, the size of the App Pack swells. +- When multiple HAPs reference the same HAR, some state variables in the HAR cannot be shared. + +Restrictions on the HSP: +- The HSP and its invoking modules must be in the stage model. +- The HSP and its invoking modules must use the **esmodule **compilation mode. +- The HSP does not support the declaration of **abilities** and **extensionAbilities** in its configuration file. + +The HSP can be classified as [in-application HSP](in-app-hsp.md) or [inter-application HSP](cross-app-hsp.md), depending on the configuration files and usage methods. diff --git a/en/application-dev/quick-start/stage-structure.md b/en/application-dev/quick-start/stage-structure.md deleted file mode 100644 index ff66e3d405738a44f0c645593ffb0dbfb5beca97..0000000000000000000000000000000000000000 --- a/en/application-dev/quick-start/stage-structure.md +++ /dev/null @@ -1,25 +0,0 @@ -# Application Configuration File Overview (Stage Model) - - -Each application project must have configuration files in its code directory. These configuration files provide basic application information for build tools, operating systems, and application markets. - - -In the code directory of an application project developed in stage model, there are two types of configuration files: one **app.json5** file and one or more **module.json5** files. - - -The [app.json5](app-configuration-file.md) file contains the following contents: - - -- Application-wide configuration, including the bundle name, developer, and version number. - -- Device-specific configuration. - - -The [module.json5](module-configuration-file.md) file contains the following contents: - - -- Basic module configuration, such as the name, type, description, and supported device types of the module. - -- Information about the [application components](../application-models/stage-model-development-overview.md), including the descriptions of the UIAbility and ExtensionAbility components. - -- Information about the permissions required during application running. diff --git a/en/application-dev/quick-start/start-with-ets-fa.md b/en/application-dev/quick-start/start-with-ets-fa.md index 23709abc5c2ba7e9b14ef9f396e9731a9f94e136..c806eebac3e5f266cd0ba6859ef7eb75727af243 100644 --- a/en/application-dev/quick-start/start-with-ets-fa.md +++ b/en/application-dev/quick-start/start-with-ets-fa.md @@ -20,7 +20,7 @@ > **NOTE** > - > If you are using DevEco Studio V3.0 Beta3 or later, you can use the [low-code development](https://developer.harmonyos.com/en/docs/documentation/doc-guides/ohos-low-code-development-0000001218440652) mode apart from the traditional coding approach. + > If you are using DevEco Studio V3.0 Beta3 or later, you can use the low-code development mode apart from the traditional coding approach. > > On the low-code development pages, you can design your application UI in an efficient, intuitive manner, with a wide array of UI editing features. > @@ -34,7 +34,7 @@ ![en-us_image_0000001384652328](figures/en-us_image_0000001384652328.png) - **entry**: OpenHarmony project module, which can be built into an OpenHarmony Ability Package ([HAP](../../glossary.md#hap)). - - **src > main > ets**: a collection of eTS source code. + - **src > main > ets**: a collection of ArkTS source code. - **src > main > ets > MainAbility**: entry to your application/service. - **src > main > ets > MainAbility > pages**: pages contained in **MainAbility**. - **src > main > ets > MainAbility > pages > index.ets**: the first page in the **pages** list, also referred to as the entry to the application. diff --git a/en/application-dev/quick-start/start-with-ets-stage.md b/en/application-dev/quick-start/start-with-ets-stage.md index d9527e8fe83bf0173e688296c5cab2e8aff651b8..eece0ad295ee138ccf353345a78fc1eca7cf3715 100644 --- a/en/application-dev/quick-start/start-with-ets-stage.md +++ b/en/application-dev/quick-start/start-with-ets-stage.md @@ -20,7 +20,7 @@ > **NOTE** > - > You can use the [low-code development](https://developer.harmonyos.com/en/docs/documentation/doc-guides/ohos-low-code-development-0000001218440652) mode apart from the traditional coding approach. + > You can use the low-code development mode apart from the traditional coding approach. > > On the low-code development pages, you can design your application UI in an efficient, intuitive manner, with a wide array of UI editing features. > @@ -34,7 +34,7 @@ ![en-us_image_0000001364054489](figures/en-us_image_0000001364054489.png) - **entry**: OpenHarmony project module, which can be built into an OpenHarmony Ability Package ([HAP](../../glossary.md#hap)). - - **src > main > ets**: a collection of eTS source code. + - **src > main > ets**: a collection of ArkTS source code. - **src > main > ets > entryability**: entry to your application/service. - **src > main > ets > pages**: pages included in your application/service. - **src > main > resources**: a collection of resource files used by your application/service, such as graphics, multimedia, character strings, and layout files. For details about resource files, see [Resource Categories and Access](resource-categories-and-access.md#resource-categories). diff --git a/en/application-dev/quick-start/start-with-js-fa.md b/en/application-dev/quick-start/start-with-js-fa.md index 7e1123d97f8af188bbb97849551cd6a499042a9f..15af85cd0dfadab9573d38e3d95e3671448550de 100644 --- a/en/application-dev/quick-start/start-with-js-fa.md +++ b/en/application-dev/quick-start/start-with-js-fa.md @@ -18,7 +18,7 @@ > **NOTE** > - > If you are using DevEco Studio V2.2 Beta1 or later, you can use the [low-code development](https://developer.harmonyos.com/en/docs/documentation/doc-guides/ohos-low-code-development-0000001218440652) mode apart from the traditional coding approach. + > If you are using DevEco Studio V2.2 Beta1 or later, you can use the low-code development mode apart from the traditional coding approach. > > On the low-code development pages, you can design your application UI in an efficient, intuitive manner, with a wide array of UI editing features. > diff --git a/en/application-dev/reference/apis/Readme-EN.md b/en/application-dev/reference/apis/Readme-EN.md index 0de7d46e88f8a4d568593616b1bf73bf4c44b95e..69989d5c01c2f369c1e9adc72bc3a18105847d86 100644 --- a/en/application-dev/reference/apis/Readme-EN.md +++ b/en/application-dev/reference/apis/Readme-EN.md @@ -125,6 +125,20 @@ - [@ohos.notification (Notification) (To Be Deprecated Soon)](js-apis-notification.md) - application - [EventHub](js-apis-inner-application-eventHub.md) + - commonEvent + - [CommonEventData](js-apis-inner-commonEvent-commonEventData.md) + - [CommonEventPublishData](js-apis-inner-commonEvent-commonEventPublishData.md) + - [CommonEventSubscriber](js-apis-inner-commonEvent-commonEventSubscriber.md) + - [CommonEventSubscribeInfo](js-apis-inner-commonEvent-commonEventSubscribeInfo.md) + - notification + - [NotificationActionButton](js-apis-inner-notification-notificationActionButton.md) + - [NotificationCommonDef](js-apis-inner-notification-notificationCommonDef.md) + - [NotificationContent](js-apis-inner-notification-notificationContent.md) + - [NotificationFlags](js-apis-inner-notification-notificationFlags.md) + - [NotificationRequest](js-apis-inner-notification-notificationRequest.md) + - [NotificationSlot](js-apis-inner-notification-notificationSlot.md) + - [NotificationTemplate](js-apis-inner-notification-notificationTemplate.md) + - [NotificationUserInput](js-apis-inner-notification-notificationUserInput.md) - Bundle Management - [@ohos.bundle.appControl (appControl)](js-apis-appControl.md) - [@ohos.bundle.bundleManager (bundleManager)](js-apis-bundleManager.md) @@ -149,13 +163,18 @@ - [permissionDef](js-apis-bundleManager-permissionDef.md) - [remoteAbilityInfo](js-apis-bundleManager-remoteAbilityInfo.md) - [shortcutInfo](js-apis-bundleManager-shortcutInfo.md) + - UI Page - [@ohos.animator (Animator)](js-apis-animator.md) - [@ohos.curves (Interpolation Calculation)](js-apis-curve.md) - [@ohos.matrix4 (Matrix Transformation)](js-apis-matrix4.md) - [@ohos.mediaquery (Media Query)](js-apis-mediaquery.md) + - [@ohos.pluginComponent (PluginComponentManager)](js-apis-plugincomponent.md) - [@ohos.promptAction (Prompt)](js-apis-promptAction.md) - [@ohos.router (Page Routing)](js-apis-router.md) + - [@ohos.measure (Text Measurement)](js-apis-measure.md) + - [@ohos.uiAppearance (UI Appearance)](js-apis-uiappearance.md) + - Graphics - [@ohos.animation.windowAnimationManager (Window Animation Management)](js-apis-windowAnimationManager.md) - [@ohos.application.WindowExtensionAbility (WindowExtensionAbility)](js-apis-application-windowExtensionAbility.md) @@ -168,24 +187,29 @@ - webgl - [WebGL](js-apis-webgl.md) - [WebGL2](js-apis-webgl2.md) -- Media + +- Multimedia - [@ohos.multimedia.audio (Audio Management)](js-apis-audio.md) - [@ohos.multimedia.avsession (AVSession Management)](js-apis-avsession.md) - [@ohos.multimedia.camera (Camera Management)](js-apis-camera.md) - [@ohos.multimedia.image (Image Processing)](js-apis-image.md) - [@ohos.multimedia.media (Media)](js-apis-media.md) -- Resource Management + +- Resource Manager - [@ohos.i18n (Internationalization)](js-apis-i18n.md) - [@ohos.intl (Internationalization)](js-apis-intl.md) - [@ohos.resourceManager (Resource Manager)](js-apis-resource-manager.md) -- Background Tasks + +- Background Task - [@ohos.distributedMissionManager (Distributed Mission Management)](js-apis-distributedMissionManager.md) - [@ohos.reminderAgentManager (Reminder Agent Management)](js-apis-reminderAgentManager.md) - [@ohos.resourceschedule.backgroundTaskManager (Background Task Management)](js-apis-resourceschedule-backgroundTaskManager.md) - [@ohos.resourceschedule.workScheduler (Work Scheduler)](js-apis-resourceschedule-workScheduler.md) - [@ohos.resourceschedule.usageStatistics (Device Usage Statistics)](js-apis-resourceschedule-deviceUsageStatistics.md) - [@ohos.WorkSchedulerExtensionAbility (Work Scheduler Callbacks)](js-apis-WorkSchedulerExtensionAbility.md) - + - application + - [WorkSchedulerExtensionContext](js-apis-inner-application-WorkSchedulerExtensionContext.md) + - Security - [@ohos.abilityAccessCtrl (Ability Access Control)](js-apis-abilityAccessCtrl.md) - [@ohos.privacyManager (Privacy Management)](js-apis-privacyManager.md) @@ -194,9 +218,9 @@ - [@ohos.security.huks (HUKS)](js-apis-huks.md) - [@ohos.userIAM.faceAuth (Facial Authentication)](js-apis-useriam-faceauth.md) - [@ohos.userIAM.userAuth (User Authentication)](js-apis-useriam-userauth.md) - - [@system.cipher (Cipher Algorithm)](js-apis-system-cipher.md) - security - [PermissionRequestResult](js-apis-permissionrequestresult.md) + - Data Management - [@ohos.data.dataAbility (DataAbility Predicates)](js-apis-data-ability.md) - [@ohos.data.dataShare (DataShare)](js-apis-data-dataShare.md) @@ -204,23 +228,25 @@ - [@ohos.data.dataShareResultSet (DataShare Result Set)](js-apis-data-DataShareResultSet.md) - [@ohos.data.distributedDataObject (Distributed Data Object)](js-apis-data-distributedobject.md) - [@ohos.data.distributedKVStore (Distributed KV Store)](js-apis-distributedKVStore.md) - - [@ohos.data.preferences (Preferences)](js-apis-data-preferences.md) + - [@ohos.data.preferences (User Preferences)](js-apis-data-preferences.md) - [@ohos.data.relationalStore (RDB Store)](js-apis-data-relationalStore.md) - [@ohos.data.ValuesBucket (Value Bucket)](js-apis-data-valuesBucket.md) - - data/rdb - - [resultSet (Result Set)](js-apis-data-resultset.md) + - File Management + - [@ohos.file.cloudSyncManager (Device-Cloud Synchronization Management)](js-apis-file-cloudsyncmanager.md) - [@ohos.file.environment (Directory Environment Capability)](js-apis-file-environment.md) - [@ohos.file.fileAccess (User File Access and Management)](js-apis-fileAccess.md) - [@ohos.file.fileExtensionInfo (User File Extension Information)](js-apis-fileExtensionInfo.md) + - [@ohos.file.fileUri (File URI)](js-apis-file-fileUri.md) - [@ohos.file.fs (File Management)](js-apis-file-fs.md) - [@ohos.file.hash (File Hash Processing)](js-apis-file-hash.md) + - [@ohos.file.picker (File Picker)](js-apis-file-picker.md) - [@ohos.file.securityLabel (Data Label)](js-apis-file-securityLabel.md) - [@ohos.file.statvfs (File System Space Statistics)](js-apis-file-statvfs.md) - [@ohos.file.storageStatistics (Application Storage Statistics)](js-apis-file-storage-statistics.md) - [@ohos.file.volumeManager (Volume Management)](js-apis-file-volumemanager.md) - [@ohos.filemanagement.userFileManager (User Data Management)](js-apis-userFileManager.md) - - [@ohos.multimedia.medialibrary (Media Library Management)](js-apis-medialibrary.md) + - [@ohos.fileShare (File Sharing)](js-apis-fileShare.md) - Telephony Service - [@ohos.contact (Contacts)](js-apis-contact.md) @@ -230,16 +256,21 @@ - [@ohos.telephony.radio (Network Search)](js-apis-radio.md) - [@ohos.telephony.sim (SIM Management)](js-apis-sim.md) - [@ohos.telephony.sms (SMS)](js-apis-sms.md) + - Network Management - [@ohos.net.connection (Network Connection Management)](js-apis-net-connection.md) - [@ohos.net.ethernet (Ethernet Connection Management)](js-apis-net-ethernet.md) - [@ohos.net.http (Data Request)](js-apis-http.md) + - [@ohos.net.policy (Network Policy Management)](js-apis-net-policy.md) - [@ohos.net.sharing (Network Sharing)](js-apis-net-sharing.md) - [@ohos.net.socket (Socket Connection)](js-apis-socket.md) - [@ohos.net.webSocket (WebSocket Connection)](js-apis-webSocket.md) - [@ohos.request (Upload and Download)](js-apis-request.md) + - [@ohos.net.mdns (mDNS Management)](js-apis-net-mdns.md) + - Connectivity - - [@ohos.bluetooth (Bluetooth)](js-apis-bluetooth.md) + - [@ohos.bluetooth (Bluetooth)(To Be Deprecated Soon)](js-apis-bluetooth.md) + - [@ohos.bluetoothManager (Bluetooth)(js-apis-bluetoothManager.md) - [@ohos.connectedTag (Active Tags)](js-apis-connectedTag.md) - [@ohos.nfc.cardEmulation (Standard NFC Card Emulation)](js-apis-cardEmulation.md) - [@ohos.nfc.controller (Standard NFC)](js-apis-nfcController.md) @@ -247,11 +278,12 @@ - [@ohos.rpc (RPC)](js-apis-rpc.md) - [@ohos.wifiManager (WLAN)](js-apis-wifiManager.md) - [@ohos.wifiManagerExt (WLAN Extension)](js-apis-wifiManagerExt.md) - - [@ohos.wifi (To Be Deprecated)](js-apis-wifi.md) - - [@ohos.wifiext (To Be Deprecated)](js-apis-wifiext.md) + - [@ohos.wifi (WLAN)(To Be Deprecated Soon)](js-apis-wifi.md) + - [@ohos.wifiext (WLAN Extension)(To Be Deprecated Soon)](js-apis-wifiext.md) - tag - [nfctech (Standard NFC Technologies)](js-apis-nfctech.md) - [tagSession (Standard NFC Tag Session)](js-apis-tagSession.md) + - Basic Features - [@ohos.accessibility (Accessibility)](js-apis-accessibility.md) - [@ohos.accessibility.config (System Accessibility Configuration)](js-apis-accessibility-config.md) @@ -280,7 +312,7 @@ - [console (Log)](js-apis-logs.md) - [Timer](js-apis-timer.md) - application - - [AccessibilityExtensionContext](js-apis-inner-application-accessibilityExtensionContext.md) + - [AccessibilityExtensionContext (Accessibility Extension Context)](js-apis-inner-application-accessibilityExtensionContext.md) - imf - [InputMethodCommon](js-apis-inputmethod-InputMethodCommon.md) @@ -288,6 +320,7 @@ - [@ohos.batteryInfo (Battery Information)](js-apis-battery-info.md) - [@ohos.batteryStatistics (Battery Statistics)](js-apis-batteryStatistics.md) - [@ohos.brightness (Screen Brightness)](js-apis-brightness.md) + - [@ohos.charger (Charging Type)](js-apis-charger.md) - [@ohos.deviceInfo (Device Information)](js-apis-device-info.md) - [@ohos.distributedHardware.deviceManager (Device Management)](js-apis-device-manager.md) - [@ohos.geoLocationManager (Geolocation Manager)](js-apis-geoLocationManager.md) @@ -311,21 +344,26 @@ - [@ohos.systemParameterEnhance (System Parameter)](js-apis-system-parameterEnhance.md) - [@ohos.thermal (Thermal Management)](js-apis-thermal.md) - [@ohos.update (Update)](js-apis-update.md) - - [@ohos.usbManager (USB Management)](js-apis-usbManager.md) + - [@ohos.usbManager (USB Manager)](js-apis-usbManager.md) - [@ohos.vibrator (Vibrator)](js-apis-vibrator.md) + - Account Management - [@ohos.account.appAccount (App Account Management)](js-apis-appAccount.md) - [@ohos.account.distributedAccount (Distributed Account Management)](js-apis-distributed-account.md) - [@ohos.account.osAccount (OS Account Management)](js-apis-osAccount.md) -- Custom Management + +- Customization - [@ohos.configPolicy (Configuration Policy)](js-apis-configPolicy.md) + - [@ohos.enterprise.accountManager (Account Management)](js-apis-enterprise-accountManager.md) - [@ohos.enterprise.adminManager (Enterprise Device Management)](js-apis-enterprise-adminManager.md) - [@ohos.enterprise.dateTimeManager (System Time Management)](js-apis-enterprise-dateTimeManager.md) - [@ohos.enterprise.deviceControl (Device Control Management)](js-apis-enterprise-deviceControl.md) - [@ohos.enterprise.deviceInfo (Device Information Management)](js-apis-enterprise-deviceInfo.md) - [@ohos.enterprise.EnterpriseAdminExtensionAbility (EnterpriseAdminExtensionAbility)](js-apis-EnterpriseAdminExtensionAbility.md) + - [@ohos.enterprise.networkManager (Network Management)](js-apis-enterprise-networkManager.md) + - [@ohos.enterprise.wifiManager (Wi-Fi Management)](js-apis-enterprise-wifiManager.md) - - Language Base Class Library +- Language Base Class Library - [@ohos.buffer (Buffer)](js-apis-buffer.md) - [@ohos.convertxml (XML-to-JavaScript Conversion)](js-apis-convertxml.md) - [@ohos.process (Obtaining Process Information)](js-apis-process.md) @@ -349,9 +387,11 @@ - [@ohos.util.Vector (Linear Container Vector)](js-apis-vector.md) - [@ohos.worker (Worker Startup)](js-apis-worker.md) - [@ohos.xml (XML Parsing and Generation)](js-apis-xml.md) + - Test - [@ohos.application.testRunner (TestRunner)](js-apis-application-testRunner.md) - [@ohos.uitest (UiTest)](js-apis-uitest.md) + - APIs No Longer Maintained - [@ohos.backgroundTaskManager (Background Task Management)](js-apis-backgroundTaskManager.md) - [@ohos.bundle (Bundle)](js-apis-Bundle.md) @@ -366,17 +406,18 @@ - [@ohos.fileio (File Management)](js-apis-fileio.md) - [@ohos.geolocation (Geolocation)](js-apis-geolocation.md) - [@ohos.hiAppEvent (Application Event Logging)](js-apis-hiappevent.md) + - [@ohos.multimedia.medialibrary (Media Library Management)](js-apis-medialibrary.md) - [@ohos.prompt (Prompt)](js-apis-prompt.md) - [@ohos.reminderAgent (Reminder Agent)](js-apis-reminderAgent.md) - [@ohos.statfs (statfs)](js-apis-statfs.md) - [@ohos.systemParameter (System Parameter)](js-apis-system-parameter.md) - [@ohos.systemTime (System Time and Time Zone)](js-apis-system-time.md) - [@ohos.usb (USB Management)](js-apis-usb-deprecated.md) - - [@ohos.usbV9 (USB Management)](js-apis-usb.md) - [@system.app (Application Context)](js-apis-system-app.md) - [@system.battery (Battery Information)](js-apis-system-battery.md) - [@system.bluetooth (Bluetooth)](js-apis-system-bluetooth.md) - [@system.brightness (Screen Brightness)](js-apis-system-brightness.md) + - [@system.cipher (Cipher Algorithm)](js-apis-system-cipher.md) - [@system.configuration (Application Configuration)](js-apis-system-configuration.md) - [@system.device (Device Information)](js-apis-system-device.md) - [@system.fetch (Data Request)](js-apis-system-fetch.md) @@ -406,3 +447,5 @@ - [PermissionDef](js-apis-bundle-PermissionDef.md) - [remoteAbilityInfo](js-apis-bundle-remoteAbilityInfo.md) - [shortcutInfo](js-apis-bundle-ShortcutInfo.md) + - data/rdb + - [resultSet (Result Set)](js-apis-data-resultset.md) \ No newline at end of file diff --git a/en/application-dev/reference/apis/commonEvent-definitions.md b/en/application-dev/reference/apis/commonEvent-definitions.md index b7cfc06174bbd90c193b1e98d4aa5330597a4b8f..39aa5fa3df076dde861d8020f0066f0dadd6b800 100644 --- a/en/application-dev/reference/apis/commonEvent-definitions.md +++ b/en/application-dev/reference/apis/commonEvent-definitions.md @@ -59,7 +59,7 @@ Indicates that the device screen is on and the device is in interactive state. - Required subscriber permissions: none -## COMMON_EVENT_THERMAL_LEVEL_CHANGED8+ +## COMMON_EVENT_THERMAL_LEVEL_CHANGED8+ Indicates that the device's thermal level has changed. - Value: **usual.event.THERMAL_LEVEL_CHANGED** - Required subscriber permissions: none @@ -810,7 +810,7 @@ Indicates that a USB device has been detached from the device functioning as a U ## COMMON_EVENT_DISK_BAD_REMOVAL (Reserved, not supported yet) Indicates that an external storage device was removed without being unmounted. -- Value: usual.event.data.DISK_BAD_REMOVAL +- Value: **usual.event.data.DISK_BAD_REMOVAL** - Required subscriber permissions: ohos.permission.STORAGE_MANAGER @@ -826,33 +826,33 @@ Indicates that a USB device has been detached from the device functioning as a U - Required subscriber permissions: ohos.permission.STORAGE_MANAGER -## COMMON_EVENT_VOLUME_REMOVED9+ +## COMMON_EVENT_VOLUME_REMOVED9+ Indicates that an external storage device was removed. - Value: **usual.event.data.VOLUME_REMOVED** - Required subscriber permissions: ohos.permission.STORAGE_MANAGER -## COMMON_EVENT_VOLUME_UNMOUNTED9+ +## COMMON_EVENT_VOLUME_UNMOUNTED9+ Indicates that an external storage device was unmounted. - Value: **usual.event.data.VOLUME_UNMOUNTED** - Required subscriber permissions: ohos.permission.STORAGE_MANAGER -## COMMON_EVENT_VOLUME_MOUNTED9+ +## COMMON_EVENT_VOLUME_MOUNTED9+ Indicates that an external storage device was mounted. - Value: **usual.event.data.VOLUME_MOUNTED** - Required subscriber permissions: ohos.permission.STORAGE_MANAGER -## COMMON_EVENT_VOLUME_BAD_REMOVAL9+ +## COMMON_EVENT_VOLUME_BAD_REMOVAL9+ Indicates that an external storage device was removed without being unmounted. - Value: **usual.event.data.VOLUME_BAD_REMOVAL** - Required subscriber permissions: ohos.permission.STORAGE_MANAGER -## COMMON_EVENT_VOLUME_EJECT9+ +## COMMON_EVENT_VOLUME_EJECT9+ Indicates that an external storage device was ejected (at the software level). -- Value: usual.event.data.VOLUME_EJECT +- **Value: usual.event.data.VOLUME_EJECT** - Required subscriber permissions: ohos.permission.STORAGE_MANAGER @@ -880,25 +880,30 @@ Indicates that the airplane mode of the device has changed. - Required subscriber permissions: none -## COMMON_EVENT_SPLIT_SCREEN8+ +## COMMON_EVENT_SPLIT_SCREEN8+ Indicates that the screen has been split. - Value: **usual.event.SPLIT_SCREEN** - Required subscriber permissions: none -## COMMON_EVENT_SLOT_CHANGE9+ +## COMMON_EVENT_SLOT_CHANGE9+ Indicates that the notification slot has been updated. - Value: **usual.event.SLOT_CHANGE** - Required subscriber permissions: ohos.permission.NOTIFICATION_CONTROLLER -## COMMON_EVENT_SPN_INFO_CHANGED9+ +## COMMON_EVENT_SPN_INFO_CHANGED9+ Indicates that the SPN displayed has been updated. - Value: **usual.event.SPN_INFO_CHANGED** - Required subscriber permissions: none -## COMMON_EVENT_QUICK_FIX_APPLY_RESULT9+ +## COMMON_EVENT_QUICK_FIX_APPLY_RESULT9+ Indicates the result of applying a quick fix to the application. - Value: **usual.event.QUICK_FIX_APPLY_RESULT** - Required subscriber permissions: none + +## COMMON_EVENT_USER_INFO_UPDATED9+ +Indicates that the user information has been updated. +- Value: **usual.event.USER_INFO_UPDATED** +- Required subscriber permissions: none diff --git a/en/application-dev/reference/apis/commonEventManager-definitions.md b/en/application-dev/reference/apis/commonEventManager-definitions.md index 3701910204a1a924986d9d6ff8ae144886cc5856..4d400882bb09448ae379336329c873651601060e 100644 --- a/en/application-dev/reference/apis/commonEventManager-definitions.md +++ b/en/application-dev/reference/apis/commonEventManager-definitions.md @@ -59,17 +59,19 @@ Indicates that the device screen is on and the device is in interactive state. - Required subscriber permissions: none -## COMMON_EVENT_THERMAL_LEVEL_CHANGED8+ +## COMMON_EVENT_THERMAL_LEVEL_CHANGED8+ Indicates that the device's thermal level has changed. - Value: **usual.event.THERMAL_LEVEL_CHANGED** - Required subscriber permissions: none -## COMMON_EVENT_USER_PRESENT +## COMMON_EVENT_USER_PRESENT(deprecated) (Reserved, not supported yet) Indicates that the user unlocks the device. - Value: **usual.event.USER_PRESENT** - Required subscriber permissions: none - +> NOTE +> +> This API is deprecated since API version 10. ## COMMON_EVENT_TIME_TICK Indicates that the system time has changed as time ticks by. @@ -658,6 +660,10 @@ Indicates that the system starts charging the battery. - Value: **usual.event.CHARGING** - Required subscriber permissions: none +## COMMON_EVENT_CHARGE_TYPE_CHANGED +Indicates that the system charging type has changed. This event is available only for system applications. +- Value: **usual.event.CHARGE_TYPE_CHANGED** +- Required subscriber permissions: none ## COMMON_EVENT_DEVICE_IDLE_MODE_CHANGED (Reserved, not supported yet) Indicates that the system idle mode has changed. @@ -845,31 +851,31 @@ Indicates that a USB device has been detached from the device functioning as a U - Required subscriber permissions: ohos.permission.STORAGE_MANAGER -## COMMON_EVENT_VOLUME_REMOVED9+ +## COMMON_EVENT_VOLUME_REMOVED9+ Indicates that an external storage device was removed. - Value: **usual.event.data.VOLUME_REMOVED** - Required subscriber permissions: ohos.permission.STORAGE_MANAGER -## COMMON_EVENT_VOLUME_UNMOUNTED9+ +## COMMON_EVENT_VOLUME_UNMOUNTED9+ Indicates that an external storage device was unmounted. - Value: **usual.event.data.VOLUME_UNMOUNTED** - Required subscriber permissions: ohos.permission.STORAGE_MANAGER -## COMMON_EVENT_VOLUME_MOUNTED9+ +## COMMON_EVENT_VOLUME_MOUNTED9+ Indicates that an external storage device was mounted. - Value: **usual.event.data.VOLUME_MOUNTED** - Required subscriber permissions: ohos.permission.STORAGE_MANAGER -## COMMON_EVENT_VOLUME_BAD_REMOVAL9+ +## COMMON_EVENT_VOLUME_BAD_REMOVAL9+ Indicates that an external storage device was removed without being unmounted. - Value: **usual.event.data.VOLUME_BAD_REMOVAL** - Required subscriber permissions: ohos.permission.STORAGE_MANAGER -## COMMON_EVENT_VOLUME_EJECT9+ +## COMMON_EVENT_VOLUME_EJECT9+ Indicates that an external storage device was ejected (at the software level). - Value: usual.event.data.VOLUME_EJECT - Required subscriber permissions: ohos.permission.STORAGE_MANAGER @@ -905,23 +911,136 @@ Indicates that the screen has been split. - Required subscriber permissions: ohos.permission.RECEIVER_SPLIT_SCREEN -## COMMON_EVENT_SLOT_CHANGE9+ +## COMMON_EVENT_SLOT_CHANGE9+ Indicates that the notification slot has been updated. - Value: **usual.event.SLOT_CHANGE** - Required subscriber permissions: ohos.permission.NOTIFICATION_CONTROLLER -## COMMON_EVENT_SPN_INFO_CHANGED9+ +## COMMON_EVENT_SPN_INFO_CHANGED9+ Indicates that the SPN displayed has been updated. - Value: **usual.event.SPN_INFO_CHANGED** - Required subscriber permissions: none -## COMMON_EVENT_QUICK_FIX_APPLY_RESULT9+ +## COMMON_EVENT_QUICK_FIX_APPLY_RESULT9+ Indicates the result of applying a quick fix to the application. - Value: **usual.event.QUICK_FIX_APPLY_RESULT** - Required subscriber permissions: none -## COMMON_EVENT_HTTP_PROXY_CHANGE10+ +## COMMON_EVENT_HTTP_PROXY_CHANGE10+ Indicates that the HTTP proxy configuration has changed. - Value: **usual.event.HTTP_PROXY_CHANGE** - Required subscriber permissions: none + +## COMMON_EVENT_SIM_STATE_CHANGED10+ +Indicates that the SIM card state has changed. +- Value: **usual.event.SIM_STATE_CHANGED** +- Required subscriber permissions: none + +## COMMON_EVENT_SMS_RECEIVED_COMPLETED10+ +Indicates that the SMS message is received. +- Value: **usual.event.SMS_RECEIVED_COMPLETED** +- Required subscriber permissions: ohos.permission.RECEIVE_SMS + +## COMMON_EVENT_SMS_EMERGENCY_CB_RECEIVE_COMPLETED10+ +Indicates that an emergency cell broadcast message is received. +- Value: **usual.event.SMS_EMERGENCY_CB_RECEIVE_COMPLETED** +- Required subscriber permissions: ohos.permission.RECEIVE_SMS + +## COMMON_EVENT_SMS_CB_RECEIVE_COMPLETED10+ +Indicates that a cell broadcast message is received. +- Value: **usual.event.SMS_CB_RECEIVE_COMPLETED** +- Required subscriber permissions: ohos.permission.RECEIVE_SMS + +## COMMON_EVENT_STK_COMMAND10+ +(Reserved, not supported yet) Indicates the STK command. +- Value: **usual.event.STK_COMMAND** +- Required subscriber permissions: none + +## COMMON_EVENT_STK_SESSION_END10+ +(Reserved, not supported yet) Indicates that an STK session ends. +- Value: **usual.event.STK_SESSION_END** +- Required subscriber permissions: none + +## COMMON_EVENT_STK_CARD_STATE_CHANGED10+ +(Reserved, not supported yet) Indicates that the STK card state has changed. +- Value: **usual.event.STK_CARD_STATE_CHANGED** +- Required subscriber permissions: ohos.permission + +## COMMON_EVENT_STK_ALPHA_IDENTIFIER10+ +(Reserved, not supported yet) Indicates the STK alpha indicator. +- Value: **usual.event.STK_ALPHA_IDENTIFIER** +- Required subscriber permissions: none + +## COMMON_EVENT_SMS_WAPPUSH_RECEIVE_COMPLETED10+ +Indicates that a WAP push message is received. +- Value: **usual.event.SMS_WAPPUSH_RECEIVE_COMPLETED** +- Required subscriber permissions: ohos.permission.RECEIVE_SMS + +## COMMON_EVENT_OPERATOR_CONFIG_CHANGED10+ +Indicates that the carrier configuration has been updated. +- Value: **usual.event.OPERATOR_CONFIG_CHANGED** +- Required subscriber permissions: none + +## COMMON_EVENT_SIM_CARD_DEFAULT_SMS_SUBSCRIPTION_CHANGED10+ +Indicates that the default SIM card for the SMS service has changed. +- Value: **usual.event.DEFAULT_SMS_SUBSCRIPTION_CHANGED** +- Required subscriber permissions: none + +## COMMON_EVENT_SIM_CARD_DEFAULT_DATA_SUBSCRIPTION_CHANGED10+ +Indicates that the default SIM card for the mobile data service has changed. +- Value: **usual.event.DEFAULT_DATA_SUBSCRIPTION_CHANGED** +- Required subscriber permissions: none + +## COMMON_EVENT_SIM_CARD_DEFAULT_MAIN_SUBSCRIPTION_CHANGED10+ +Indicates that the default primary SIM card has changed. +- Value: **usual.event.SIM.DEFAULT_MAIN_SUBSCRIPTION_CHANGED** +- Required subscriber permissions: none + +## COMMON_EVENT_SIM_CARD_DEFAULT_VOICE_SUBSCRIPTION_CHANGED10+ +Indicates that the default SIM card for the voice service has changed. +- Value: **usual.event.DEFAULT_VOICE_SUBSCRIPTION_CHANGED** +- Required subscriber permissions: none + +## COMMON_EVENT_CALL_STATE_CHANGED10+ +Indicates that the call state has changed. +- Value: **usual.event.CALL_STATE_CHANGED** +- Required subscriber permissions: ohos.permission.GET_TELEPHONY_STATE + +## COMMON_EVENT_CELLULAR_DATA_STATE_CHANGED10+ +Indicates that the cellular data state has changed. +- Value: **usual.event.CELLULAR_DATA_STATE_CHANGED** +- Required subscriber permissions: none + +## COMMON_EVENT_NETWORK_STATE_CHANGED10+ +Indicates that the network state has changed. +- Value: **usual.event.NETWORK_STATE_CHANGED** +- Required subscriber permissions: none + +## COMMON_EVENT_SIGNAL_INFO_CHANGED10+ +Indicates that the signal information is updated. +- Value: **usual.event.SIGNAL_INFO_CHANGED** +- Required subscriber permissions: none + +## COMMON_EVENT_INCOMING_CALL_MISSED10+ +Indicates a missed call. +- Value: **usual.event.INCOMING_CALL_MISSED** +- Required subscriber permissions: ohos.permission.GET_TELEPHONY_STATE + +## COMMON_EVENT_RADIO_STATE_CHANGE10+ +Indicates that the power-on and power-off status of the modem has changed. +- Value: **usual.event.RADIO_STATE_CHANGE** + +## COMMON_EVENT_SCREEN_LOCKED 10+ + +Indicates that the screen is locked. + +- Value: **usual.event.SCREEN_LOCKED** +- Required subscriber permissions: none + +## COMMON_EVENT_SCREEN_UNLOCKED10+ + +Indicates that the screen is unlocked. + +- Value: **usual.event.SCREEN_UNLOCKED** +- Required subscriber permissions: none diff --git a/en/application-dev/reference/apis/development-intro.md b/en/application-dev/reference/apis/development-intro.md index 281fa66969891561b062b7cfd7185d25f7c7f474..565bb231015c61926de2c4ddc868d473527ac4c6 100644 --- a/en/application-dev/reference/apis/development-intro.md +++ b/en/application-dev/reference/apis/development-intro.md @@ -41,7 +41,7 @@ To call APIs to access these resources, you must apply for the corresponding per - 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 request a specific permission, see [Permission Application and Use](../../security/accesstoken-overview.md#permission-application-and-use). +To determine whether an application can request a specific permission, see [Permission Application and Use](../../security/accesstoken-overview.md#applying-for-and-using-a-permission). ## System Capability Description diff --git a/en/application-dev/reference/apis/figures/Colorsucker.png b/en/application-dev/reference/apis/figures/Colorsucker.png new file mode 100644 index 0000000000000000000000000000000000000000..40e19e94e129682fdeb461cceef0f0a57c64d66d Binary files /dev/null and b/en/application-dev/reference/apis/figures/Colorsucker.png differ diff --git a/en/application-dev/reference/apis/figures/Copy.png b/en/application-dev/reference/apis/figures/Copy.png new file mode 100644 index 0000000000000000000000000000000000000000..212517131bf176661ae85c7513def022dbb50559 Binary files /dev/null and b/en/application-dev/reference/apis/figures/Copy.png differ diff --git a/en/application-dev/reference/apis/figures/Cross.png b/en/application-dev/reference/apis/figures/Cross.png new file mode 100644 index 0000000000000000000000000000000000000000..58625855d1cd96ea8a29ab9c3c201d90ac717e83 Binary files /dev/null and b/en/application-dev/reference/apis/figures/Cross.png differ diff --git a/en/application-dev/reference/apis/figures/Default.png b/en/application-dev/reference/apis/figures/Default.png new file mode 100644 index 0000000000000000000000000000000000000000..6308171fe9d612050376f6a5dfdc870e51bc92db Binary files /dev/null and b/en/application-dev/reference/apis/figures/Default.png differ diff --git a/en/application-dev/reference/apis/figures/East.png b/en/application-dev/reference/apis/figures/East.png new file mode 100644 index 0000000000000000000000000000000000000000..4942bc948a17e78c68538ccc3ae886bc0a548737 Binary files /dev/null and b/en/application-dev/reference/apis/figures/East.png differ diff --git a/en/application-dev/reference/apis/figures/Forbid.png b/en/application-dev/reference/apis/figures/Forbid.png new file mode 100644 index 0000000000000000000000000000000000000000..c5c43d4b4b8aaf6d53931586e519a583d064fec7 Binary files /dev/null and b/en/application-dev/reference/apis/figures/Forbid.png differ diff --git a/en/application-dev/reference/apis/figures/Hand_Grabbing.png b/en/application-dev/reference/apis/figures/Hand_Grabbing.png new file mode 100644 index 0000000000000000000000000000000000000000..09ab3121d15e27a975fbaa228aadb2399e4492b9 Binary files /dev/null and b/en/application-dev/reference/apis/figures/Hand_Grabbing.png differ diff --git a/en/application-dev/reference/apis/figures/Hand_Open.png b/en/application-dev/reference/apis/figures/Hand_Open.png new file mode 100644 index 0000000000000000000000000000000000000000..e1cb7a972ec2d372f0d75cbe80159c4a66e74e10 Binary files /dev/null and b/en/application-dev/reference/apis/figures/Hand_Open.png differ diff --git a/en/application-dev/reference/apis/figures/Hand_Pointing.png b/en/application-dev/reference/apis/figures/Hand_Pointing.png new file mode 100644 index 0000000000000000000000000000000000000000..f0daa0dad6154a1846fb9fe4b7f441b3ab6f8b5b Binary files /dev/null and b/en/application-dev/reference/apis/figures/Hand_Pointing.png differ diff --git a/en/application-dev/reference/apis/figures/Help.png b/en/application-dev/reference/apis/figures/Help.png new file mode 100644 index 0000000000000000000000000000000000000000..ffea2f1c072f1682ca8e837ddb947352a553917e Binary files /dev/null and b/en/application-dev/reference/apis/figures/Help.png differ diff --git a/en/application-dev/reference/apis/figures/MID_Btn_East.png b/en/application-dev/reference/apis/figures/MID_Btn_East.png new file mode 100644 index 0000000000000000000000000000000000000000..921cd4ceea8d97ffb6d4c45008d6428cda998cce Binary files /dev/null and b/en/application-dev/reference/apis/figures/MID_Btn_East.png differ diff --git a/en/application-dev/reference/apis/figures/MID_Btn_North.png b/en/application-dev/reference/apis/figures/MID_Btn_North.png new file mode 100644 index 0000000000000000000000000000000000000000..5769575ddb435f5e8f5f8993d9edc13749376293 Binary files /dev/null and b/en/application-dev/reference/apis/figures/MID_Btn_North.png differ diff --git a/en/application-dev/reference/apis/figures/MID_Btn_North_East.png b/en/application-dev/reference/apis/figures/MID_Btn_North_East.png new file mode 100644 index 0000000000000000000000000000000000000000..3daf141241dec309c98ae10266bb153af163f3d9 Binary files /dev/null and b/en/application-dev/reference/apis/figures/MID_Btn_North_East.png differ diff --git a/en/application-dev/reference/apis/figures/MID_Btn_North_South.png b/en/application-dev/reference/apis/figures/MID_Btn_North_South.png new file mode 100644 index 0000000000000000000000000000000000000000..1f56c4cd8f1498293f5fc4a5ab2c321159fb07dd Binary files /dev/null and b/en/application-dev/reference/apis/figures/MID_Btn_North_South.png differ diff --git a/en/application-dev/reference/apis/figures/MID_Btn_North_South_West_East.png b/en/application-dev/reference/apis/figures/MID_Btn_North_South_West_East.png new file mode 100644 index 0000000000000000000000000000000000000000..b45dbde27e59121bdfc4e1752759176fb835027c Binary files /dev/null and b/en/application-dev/reference/apis/figures/MID_Btn_North_South_West_East.png differ diff --git a/en/application-dev/reference/apis/figures/MID_Btn_North_West.png b/en/application-dev/reference/apis/figures/MID_Btn_North_West.png new file mode 100644 index 0000000000000000000000000000000000000000..bde82d08f7a098106b4f4c31d55a84a989e25a8d Binary files /dev/null and b/en/application-dev/reference/apis/figures/MID_Btn_North_West.png differ diff --git a/en/application-dev/reference/apis/figures/MID_Btn_South.png b/en/application-dev/reference/apis/figures/MID_Btn_South.png new file mode 100644 index 0000000000000000000000000000000000000000..e7d5afb6f8f8b1b2939b9e18bdb8b8b3d9729f4d Binary files /dev/null and b/en/application-dev/reference/apis/figures/MID_Btn_South.png differ diff --git a/en/application-dev/reference/apis/figures/MID_Btn_South_East.png b/en/application-dev/reference/apis/figures/MID_Btn_South_East.png new file mode 100644 index 0000000000000000000000000000000000000000..44284a6e04a19ca8453b46ea81db099ad84cfaa2 Binary files /dev/null and b/en/application-dev/reference/apis/figures/MID_Btn_South_East.png differ diff --git a/en/application-dev/reference/apis/figures/MID_Btn_South_West.png b/en/application-dev/reference/apis/figures/MID_Btn_South_West.png new file mode 100644 index 0000000000000000000000000000000000000000..c8632f09160c51ca573d58d3ffb1370058b880ce Binary files /dev/null and b/en/application-dev/reference/apis/figures/MID_Btn_South_West.png differ diff --git a/en/application-dev/reference/apis/figures/MID_Btn_West.png b/en/application-dev/reference/apis/figures/MID_Btn_West.png new file mode 100644 index 0000000000000000000000000000000000000000..7460bc18d63e000689755b39b8ead3c3609ee4f5 Binary files /dev/null and b/en/application-dev/reference/apis/figures/MID_Btn_West.png differ diff --git a/en/application-dev/reference/apis/figures/Move.png b/en/application-dev/reference/apis/figures/Move.png new file mode 100644 index 0000000000000000000000000000000000000000..00f64e54dca0d0731b595b4ddc9e0f7294c40c72 Binary files /dev/null and b/en/application-dev/reference/apis/figures/Move.png differ diff --git a/en/application-dev/reference/apis/figures/North.png b/en/application-dev/reference/apis/figures/North.png new file mode 100644 index 0000000000000000000000000000000000000000..b022ac2e92d4cfb07efde7f3bf4b7ada8454e594 Binary files /dev/null and b/en/application-dev/reference/apis/figures/North.png differ diff --git a/en/application-dev/reference/apis/figures/North_East.png b/en/application-dev/reference/apis/figures/North_East.png new file mode 100644 index 0000000000000000000000000000000000000000..f6134237f38cd681b319c95bf1b77017bc1524b4 Binary files /dev/null and b/en/application-dev/reference/apis/figures/North_East.png differ diff --git a/en/application-dev/reference/apis/figures/North_East_South_West.png b/en/application-dev/reference/apis/figures/North_East_South_West.png new file mode 100644 index 0000000000000000000000000000000000000000..908886aeb3f8df976bb67b2261e8e52e7222e622 Binary files /dev/null and b/en/application-dev/reference/apis/figures/North_East_South_West.png differ diff --git a/en/application-dev/reference/apis/figures/North_South.png b/en/application-dev/reference/apis/figures/North_South.png new file mode 100644 index 0000000000000000000000000000000000000000..b15678a6b178ca0d9b13f7c7f58d025ab7a1ce12 Binary files /dev/null and b/en/application-dev/reference/apis/figures/North_South.png differ diff --git a/en/application-dev/reference/apis/figures/North_West.png b/en/application-dev/reference/apis/figures/North_West.png new file mode 100644 index 0000000000000000000000000000000000000000..cfbe4c8910575c12afde4b5904d79b5beda0c162 Binary files /dev/null and b/en/application-dev/reference/apis/figures/North_West.png differ diff --git a/en/application-dev/reference/apis/figures/North_West_South_East.png b/en/application-dev/reference/apis/figures/North_West_South_East.png new file mode 100644 index 0000000000000000000000000000000000000000..09fa728fbb45082a0524c284b8906b91d7b3a6f7 Binary files /dev/null and b/en/application-dev/reference/apis/figures/North_West_South_East.png differ diff --git a/en/application-dev/reference/apis/figures/Resize_Left_Right.png b/en/application-dev/reference/apis/figures/Resize_Left_Right.png new file mode 100644 index 0000000000000000000000000000000000000000..83e7671e3ffea65260bdb36d8b392fa78d55cd4e Binary files /dev/null and b/en/application-dev/reference/apis/figures/Resize_Left_Right.png differ diff --git a/en/application-dev/reference/apis/figures/Resize_Up_Down.png b/en/application-dev/reference/apis/figures/Resize_Up_Down.png new file mode 100644 index 0000000000000000000000000000000000000000..db8bccf89b6e5260db3875a22b5200fabd30c23c Binary files /dev/null and b/en/application-dev/reference/apis/figures/Resize_Up_Down.png differ diff --git a/en/application-dev/reference/apis/figures/Screenshot_Cross.png b/en/application-dev/reference/apis/figures/Screenshot_Cross.png new file mode 100644 index 0000000000000000000000000000000000000000..27460c082507e71082d11cd8a20eee2fc24da28d Binary files /dev/null and b/en/application-dev/reference/apis/figures/Screenshot_Cross.png differ diff --git a/en/application-dev/reference/apis/figures/Screenshot_Cursor.png b/en/application-dev/reference/apis/figures/Screenshot_Cursor.png new file mode 100644 index 0000000000000000000000000000000000000000..71abea4ca351988a92b8a5b2b2228321df31aecc Binary files /dev/null and b/en/application-dev/reference/apis/figures/Screenshot_Cursor.png differ diff --git a/en/application-dev/reference/apis/figures/South.png b/en/application-dev/reference/apis/figures/South.png new file mode 100644 index 0000000000000000000000000000000000000000..205f5cf5f59ce8318357e168eee0d66c119c233d Binary files /dev/null and b/en/application-dev/reference/apis/figures/South.png differ diff --git a/en/application-dev/reference/apis/figures/South_East.png b/en/application-dev/reference/apis/figures/South_East.png new file mode 100644 index 0000000000000000000000000000000000000000..f4a70d2d068271bfe10e4ce724ae27e4e5ba96d9 Binary files /dev/null and b/en/application-dev/reference/apis/figures/South_East.png differ diff --git a/en/application-dev/reference/apis/figures/South_West.png b/en/application-dev/reference/apis/figures/South_West.png new file mode 100644 index 0000000000000000000000000000000000000000..2ae8e9a9fa396bb6ed0f385b7b99b66830357a40 Binary files /dev/null and b/en/application-dev/reference/apis/figures/South_West.png differ diff --git a/en/application-dev/reference/apis/figures/Text_Cursor.png b/en/application-dev/reference/apis/figures/Text_Cursor.png new file mode 100644 index 0000000000000000000000000000000000000000..7cd8d2200bc7455e562da003069702832db4eb20 Binary files /dev/null and b/en/application-dev/reference/apis/figures/Text_Cursor.png differ diff --git a/en/application-dev/reference/apis/figures/West.png b/en/application-dev/reference/apis/figures/West.png new file mode 100644 index 0000000000000000000000000000000000000000..2cad91aca31f2e2b257c523e80e6fc2d71fa2cee Binary files /dev/null and b/en/application-dev/reference/apis/figures/West.png differ diff --git a/en/application-dev/reference/apis/figures/West_East.png b/en/application-dev/reference/apis/figures/West_East.png new file mode 100644 index 0000000000000000000000000000000000000000..6be4aa9d05f22a10cd00fa6aec36f95aee2b332d Binary files /dev/null and b/en/application-dev/reference/apis/figures/West_East.png differ diff --git a/en/application-dev/reference/apis/figures/Zoom_In.png b/en/application-dev/reference/apis/figures/Zoom_In.png new file mode 100644 index 0000000000000000000000000000000000000000..2e928ec070fcd05a44cd9b1abd041128287b0528 Binary files /dev/null and b/en/application-dev/reference/apis/figures/Zoom_In.png differ diff --git a/en/application-dev/reference/apis/figures/Zoom_Out.png b/en/application-dev/reference/apis/figures/Zoom_Out.png new file mode 100644 index 0000000000000000000000000000000000000000..d675d0e517ba436724540a39f60dfa75c256f0d0 Binary files /dev/null and b/en/application-dev/reference/apis/figures/Zoom_Out.png differ diff --git a/en/application-dev/reference/apis/figures/en-us_image_0000001219864133.PNG b/en/application-dev/reference/apis/figures/en-us_image_0000001219864133.PNG index 14f81499ff0b1b8ef46257bc35a79e94775cd2ba..54be7ed38fa40349036e18b962ee52deb579a033 100644 Binary files a/en/application-dev/reference/apis/figures/en-us_image_0000001219864133.PNG and b/en/application-dev/reference/apis/figures/en-us_image_0000001219864133.PNG differ diff --git a/en/application-dev/reference/apis/figures/en-us_image_Average_Color.png b/en/application-dev/reference/apis/figures/en-us_image_Average_Color.png new file mode 100644 index 0000000000000000000000000000000000000000..db2d6dca8a84f09b59aaa1affb5caf5deb289669 Binary files /dev/null and b/en/application-dev/reference/apis/figures/en-us_image_Average_Color.png differ diff --git a/en/application-dev/reference/apis/figures/en-us_image_Highest_Saturation_Color.png b/en/application-dev/reference/apis/figures/en-us_image_Highest_Saturation_Color.png new file mode 100644 index 0000000000000000000000000000000000000000..6bf7c7ba71bee89b092cdf9a8e6a5e786b8e389b Binary files /dev/null and b/en/application-dev/reference/apis/figures/en-us_image_Highest_Saturation_Color.png differ diff --git a/en/application-dev/reference/apis/figures/en-us_image_Largest_Proportion_Color.png b/en/application-dev/reference/apis/figures/en-us_image_Largest_Proportion_Color.png new file mode 100644 index 0000000000000000000000000000000000000000..93f347b1abf77970d9f84569423f0ea1673ecf9a Binary files /dev/null and b/en/application-dev/reference/apis/figures/en-us_image_Largest_Proportion_Color.png differ diff --git a/en/application-dev/reference/apis/js-apis-Bundle-BundleStatusCallback.md b/en/application-dev/reference/apis/js-apis-Bundle-BundleStatusCallback.md index 13fa28f551fe677055c589c11a0b4a1b581757b5..8ffa96f54d40560d0f1998e55b377a84e7e26d8b 100644 --- a/en/application-dev/reference/apis/js-apis-Bundle-BundleStatusCallback.md +++ b/en/application-dev/reference/apis/js-apis-Bundle-BundleStatusCallback.md @@ -3,14 +3,13 @@ The **BundleStatusCallback** module provides callbacks for bundle status changes. The changes can be obtained through [innerBundleManager.on](js-apis-Bundle-InnerBundleManager.md). > **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. - ## BundleStatusCallback(deprecated) > This API is deprecated since API version 9. You are advised to use [bundleMonitor](js-apis-bundleMonitor.md) instead. -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **System capability**: SystemCapability.BundleManager.BundleFramework diff --git a/en/application-dev/reference/apis/js-apis-Bundle-InnerBundleManager.md b/en/application-dev/reference/apis/js-apis-Bundle-InnerBundleManager.md index f45268cb699527ed412518bdee3b5f8b41f6520f..b689be21609a3d8a44e2f43dbd0f779e6f12ebf9 100644 --- a/en/application-dev/reference/apis/js-apis-Bundle-InnerBundleManager.md +++ b/en/application-dev/reference/apis/js-apis-Bundle-InnerBundleManager.md @@ -34,7 +34,7 @@ SystemCapability.BundleManager.BundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** @@ -62,7 +62,7 @@ SystemCapability.BundleManager.BundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** @@ -94,7 +94,7 @@ SystemCapability.BundleManager.BundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** @@ -121,7 +121,7 @@ SystemCapability.BundleManager.BundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** @@ -153,7 +153,7 @@ SystemCapability.BundleManager.BundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** @@ -179,7 +179,7 @@ SystemCapability.BundleManager.BundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** @@ -210,7 +210,7 @@ SystemCapability.BundleManager.BundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** @@ -236,7 +236,7 @@ SystemCapability.BundleManager.BundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** @@ -267,7 +267,7 @@ SystemCapability.BundleManager.BundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** @@ -293,7 +293,7 @@ SystemCapability.BundleManager.BundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** diff --git a/en/application-dev/reference/apis/js-apis-Bundle-distributedBundle.md b/en/application-dev/reference/apis/js-apis-Bundle-distributedBundle.md index eda69bbe8857d6d787753bc91247dcde124f9633..6a7a0edded1c942cb95b15be263cf5e6eda41b60 100644 --- a/en/application-dev/reference/apis/js-apis-Bundle-distributedBundle.md +++ b/en/application-dev/reference/apis/js-apis-Bundle-distributedBundle.md @@ -42,7 +42,7 @@ SystemCapability.BundleManager.DistributedBundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** @@ -71,7 +71,7 @@ SystemCapability.BundleManager.DistributedBundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** @@ -103,7 +103,7 @@ SystemCapability.BundleManager.DistributedBundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** @@ -132,7 +132,7 @@ SystemCapability.BundleManager.DistributedBundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** diff --git a/en/application-dev/reference/apis/js-apis-Bundle.md b/en/application-dev/reference/apis/js-apis-Bundle.md index f537fc5fe11a199afab4821b29b199499faa6c97..c116f901789c4a0fd1898d28bb7e8fd69a1b38fc 100644 --- a/en/application-dev/reference/apis/js-apis-Bundle.md +++ b/en/application-dev/reference/apis/js-apis-Bundle.md @@ -157,7 +157,7 @@ bundle.getApplicationInfo(bundleName, bundleFlags, (err, data) => { > This API is deprecated since API version 9. You are advised to use [bundleManager.getAllBundleInfo](js-apis-bundleManager.md#bundlemanagergetallbundleinfo) instead. -getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise> +getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise\\> Obtains the information of all bundles of the specified user. This API uses a promise to return the result. @@ -201,7 +201,7 @@ bundle.getAllBundleInfo(bundleFlag, userId) > This API is deprecated since API version 9. You are advised to use [bundleManager.getAllBundleInfo](js-apis-bundleManager.md#bundlemanagergetallbundleinfo) instead. -getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback>): void +getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback\\>): void Obtains the information of all bundles of the current user. This API uses an asynchronous callback to return the result. @@ -238,7 +238,7 @@ bundle.getAllBundleInfo(bundleFlag, (err, data) => { > This API is deprecated since API version 9. You are advised to use [bundleManager.getAllBundleInfo](js-apis-bundleManager.md#bundlemanagergetallbundleinfo) instead. -getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback>): void +getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback\\>): void Obtains the information of all bundles of the specified user. This API uses an asynchronous callback to return the result. @@ -426,7 +426,7 @@ SystemCapability.BundleManager.BundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Return value** @@ -462,7 +462,7 @@ SystemCapability.BundleManager.BundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** @@ -499,7 +499,7 @@ SystemCapability.BundleManager.BundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** @@ -540,7 +540,7 @@ SystemCapability.BundleManager.BundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** @@ -584,7 +584,7 @@ SystemCapability.BundleManager.BundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** @@ -626,7 +626,7 @@ SystemCapability.BundleManager.BundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** @@ -671,7 +671,7 @@ SystemCapability.BundleManager.BundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** @@ -699,7 +699,7 @@ SystemCapability.BundleManager.BundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** @@ -754,7 +754,7 @@ SystemCapability.BundleManager.BundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** @@ -794,7 +794,7 @@ SystemCapability.BundleManager.BundleFramework **System API** -This is a system API and cannot be called by third-party applications. +This is a system API. **Parameters** @@ -823,7 +823,7 @@ bundle.getPermissionDef(permissionName).then((data) => { > This API is deprecated since API version 9. You are advised to use [bundleManager.getAllApplicationInfo](js-apis-bundleManager.md#bundlemanagergetallapplicationinfo) instead. -getAllApplicationInfo(bundleFlags: number, userId?: number): Promise> +getAllApplicationInfo(bundleFlags: number, userId?: number): Promise\\> Obtains the information about all applications of the specified user. This API uses a promise to return the result. @@ -865,7 +865,7 @@ bundle.getAllApplicationInfo(bundleFlags, userId) > This API is deprecated since API version 9. You are advised to use [bundleManager.getAllApplicationInfo](js-apis-bundleManager.md#bundlemanagergetallapplicationinfo) instead. -getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback>): void +getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback\\>): void Obtains the information about all applications. This API uses an asynchronous callback to return the result. @@ -1320,7 +1320,7 @@ bundle.isApplicationEnabled(bundleName, (err, data) => { > This API is deprecated since API version 9. You are advised to use [bundleManager.queryAbilityInfo](js-apis-bundleManager.md#bundlemanagerqueryabilityinfo) instead. -queryAbilityByWant(want: Want, bundleFlags: number, userId?: number): Promise> +queryAbilityByWant(want: Want, bundleFlags: number, userId?: number): Promise\\> Obtains the ability information based on given Want. This API uses a promise to return the result. @@ -1371,7 +1371,7 @@ bundle.queryAbilityByWant(want, bundleFlags, userId) > This API is deprecated since API version 9. You are advised to use [bundleManager.queryAbilityInfo](js-apis-bundleManager.md#bundlemanagerqueryabilityinfo) instead. -queryAbilityByWant(want: Want, bundleFlags: number, userId: number, callback: AsyncCallback>): void +queryAbilityByWant(want: Want, bundleFlags: number, userId: number, callback: AsyncCallback\\>): void Obtains the ability information of the specified user based on given Want. This API uses an asynchronous callback to return the result. @@ -1416,7 +1416,7 @@ bundle.queryAbilityByWant(want, bundleFlags, userId, (err, data) => { > This API is deprecated since API version 9. You are advised to use [bundleManager.queryAbilityInfo](js-apis-bundleManager.md#bundlemanagerqueryabilityinfo) instead. -queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback>): void; +queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback\\>): void; Obtains the ability information based on given Want. This API uses an asynchronous callback to return the result. diff --git a/en/application-dev/reference/apis/js-apis-EnterpriseAdminExtensionAbility.md b/en/application-dev/reference/apis/js-apis-EnterpriseAdminExtensionAbility.md index a55ab990ef39072d83989526e66723eab794ca63..3b42c32bc9e19c19810017a2a7d7cab637619dc6 100644 --- a/en/application-dev/reference/apis/js-apis-EnterpriseAdminExtensionAbility.md +++ b/en/application-dev/reference/apis/js-apis-EnterpriseAdminExtensionAbility.md @@ -105,3 +105,55 @@ export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbil } }; ``` + +## EnterpriseAdminExtensionAbility.onAppStart10+ + +onAppStart(bundleName: string): void + +Called when an application is started. + +**System capability**: SystemCapability.Customization.EnterpriseDeviceManager + +**System API**: This is a system API. + +**Parameters** + +| Parameter | Type | Mandatory | Description | +| ----- | ----------------------------------- | ---- | ------- | +| bundleName | string | Yes | Bundle name of the application started.| + +**Example** + +```ts +export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility { + onAppStart(bundleName: string) { + console.log("started bundle name: " + bundleName); + } +}; +``` + +## EnterpriseAdminExtensionAbility.onAppStop10+ + +onAppStop(bundleName: string): void + +Called when an application is stopped. + +**System capability**: SystemCapability.Customization.EnterpriseDeviceManager + +**System API**: This is a system API. + +**Parameters** + +| Parameter | Type | Mandatory | Description | +| ----- | ----------------------------------- | ---- | ------- | +| bundleName | string | Yes | Bundle name of the application stopped.| + +**Example** + +```ts +export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility { + onAppStop(bundleName: string) { + console.log("stopped bundle name: " + bundleName); + } +}; +``` diff --git a/en/application-dev/reference/apis/js-apis-WorkSchedulerExtensionAbility.md b/en/application-dev/reference/apis/js-apis-WorkSchedulerExtensionAbility.md index a22f7b48a977066e085da4b9ddfcdeb24f21463f..33555ada83df3e20766793df3208f250ac612a00 100644 --- a/en/application-dev/reference/apis/js-apis-WorkSchedulerExtensionAbility.md +++ b/en/application-dev/reference/apis/js-apis-WorkSchedulerExtensionAbility.md @@ -16,6 +16,14 @@ When developing an application, you can override the APIs of this module and add import WorkSchedulerExtensionAbility from '@ohos.WorkSchedulerExtensionAbility' ``` +## Attributes + +**System capability**: SystemCapability.ResourceSchedule.WorkScheduler + +| Name| Type| Readable| Writable| Description| +| -------- | -------- | -------- | -------- | -------- | +| context | [WorkSchedulerExtensionContext](js-apis-inner-application-WorkSchedulerExtensionContext.md) | Yes| No| Context of the **WorkSchedulerExtension**. This context is inherited from **ExtensionContext**.| + ## WorkSchedulerExtensionAbility.onWorkStart onWorkStart(work: workScheduler.WorkInfo): void diff --git a/en/application-dev/reference/apis/js-apis-ability-featureAbility.md b/en/application-dev/reference/apis/js-apis-ability-featureAbility.md index 836f07ef61ee7b5801fe86b3dbbaed72c017e466..262899f64ed644007d28d1dce9b53c369a830f12 100644 --- a/en/application-dev/reference/apis/js-apis-ability-featureAbility.md +++ b/en/application-dev/reference/apis/js-apis-ability-featureAbility.md @@ -57,8 +57,12 @@ featureAbility.startAbility( uri: '' }, }, - (err, data) => { - console.info('startAbility err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); + (error, data) => { + if (error && error.code !== 0) { + console.error('startAbility fail, error: ${JSON.stringify(error)}'); + } else { + console.log('startAbility success, data: ${JSON.stringify(data)}'); + } } ); ``` @@ -99,7 +103,7 @@ featureAbility.startAbility( { want: { - action: 'action.system.home', + action: 'ohos.want.action.home', entities: ['entity.system.home'], type: 'MIMETYPE', flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, @@ -182,7 +186,7 @@ featureAbility.startAbilityForResult( { want: { - action: 'action.system.home', + action: 'ohos.want.action.home', entities: ['entity.system.home'], type: 'MIMETYPE', flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, @@ -193,8 +197,12 @@ featureAbility.startAbilityForResult( uri:'' }, }, - (err, data) => { - console.info('startAbilityForResult err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); + (error, data) => { + if (error && error.code !== 0) { + console.error('startAbilityForResult fail, error: ${JSON.stringify(error)}'); + } else { + console.log('startAbilityForResult success, data: ${JSON.stringify(data)}'); + } } ); ``` @@ -236,7 +244,7 @@ featureAbility.startAbilityForResult( { want: { - action: 'action.system.home', + action: 'ohos.want.action.home', entities: ['entity.system.home'], type: 'MIMETYPE', flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, @@ -288,7 +296,7 @@ featureAbility.terminateSelfWithResult( resultCode: 1, want: { - action: 'action.system.home', + action: 'ohos.want.action.home', entities: ['entity.system.home'], type: 'MIMETYPE', flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, @@ -309,8 +317,8 @@ featureAbility.terminateSelfWithResult( } }, }, - (err) => { - console.error('err: ${JSON.stringify(err)}'); + (error) => { + console.error('error: ${JSON.stringify(error)}'); } ); ``` @@ -345,7 +353,7 @@ featureAbility.terminateSelfWithResult( resultCode: 1, want: { - action: 'action.system.home', + action: 'ohos.want.action.home', entities: ['entity.system.home'], type: 'MIMETYPE', flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, @@ -389,8 +397,12 @@ Checks whether the main window of this ability has the focus. This API uses an a ```ts import featureAbility from '@ohos.ability.featureAbility'; -featureAbility.hasWindowFocus((err, data) => { - console.info('hasWindowFocus err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +featureAbility.hasWindowFocus((error, data) => { + if (error && error.code !== 0) { + console.error('hasWindowFocus fail, error: ${JSON.stringify(error)}'); + } else { + console.log('hasWindowFocus success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -435,8 +447,12 @@ Obtains the Want corresponding to the ability to start. This API uses an asynchr ```ts import featureAbility from '@ohos.ability.featureAbility'; -featureAbility.getWant((err, data) => { - console.info('getWant err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +featureAbility.getWant((error, data) => { + if (error && error.code !== 0) { + console.error('getWant fail, error: ${JSON.stringify(error)}'); + } else { + console.log('getWant success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -482,8 +498,12 @@ Obtains the application context. ```ts import featureAbility from '@ohos.ability.featureAbility'; let context = featureAbility.getContext(); -context.getBundleName((err, data) => { - console.info('getBundleName err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +context.getBundleName((error, data) => { + if (error && error.code !== 0) { + console.error('getBundleName fail, error: ${JSON.stringify(error)}'); + } else { + console.log('getBundleName success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -506,8 +526,8 @@ Terminates this ability. This API uses an asynchronous callback to return the re ```ts import featureAbility from '@ohos.ability.featureAbility'; featureAbility.terminateSelf( - (err) => { - console.error('err: ${JSON.stringify(err)}'); + (error) => { + console.error('error: ${JSON.stringify(error)}'); } ) ``` @@ -574,7 +594,7 @@ function onDisconnectCallback(element){ console.log('ConnectAbility onDisconnect element.deviceId : ${element.deviceId}') } function onFailedCallback(code){ - console.log('featureAbilityTest ConnectAbility onFailed errCode : ${code}') + console.error('featureAbilityTest ConnectAbility onFailed errCode : ${code}') } let connectId = featureAbility.connectAbility( { @@ -617,7 +637,7 @@ function onDisconnectCallback(element){ console.log('ConnectAbility onDisconnect element.deviceId : ${element.deviceId}'); } function onFailedCallback(code){ - console.log('featureAbilityTest ConnectAbility onFailed errCode : ${code}'); + console.error('featureAbilityTest ConnectAbility onFailed errCode : ${code}'); } let connectId = featureAbility.connectAbility( { @@ -631,8 +651,12 @@ let connectId = featureAbility.connectAbility( }, ); -featureAbility.disconnectAbility(connectId, (err) => { - console.error('featureAbilityTest disconnectAbility err: ${JSON.stringify(err)}'); +featureAbility.disconnectAbility(connectId, (error) => { + if (error && error.code !== 0) { + console.error('disconnectAbility fail, connectId: ${connectId}, error: ${JSON.stringify(error)}'); + } else { + console.log('disconnectAbility success, connectId: ${connectId}'); + } }); ``` @@ -668,7 +692,7 @@ function onDisconnectCallback(element){ console.log('ConnectAbility onDisconnect element.deviceId : ${element.deviceId}'); } function onFailedCallback(code){ - console.log('featureAbilityTest ConnectAbility onFailed errCode : ${code}'); + console.error('featureAbilityTest ConnectAbility onFailed errCode : ${code}'); } let connectId = featureAbility.connectAbility( { @@ -707,8 +731,12 @@ Obtains the window corresponding to this ability. This API uses an asynchronous **Example** ```ts -featureAbility.getWindow((err, data) => { - console.info('getWindow err: ${JSON.stringify(err)}, data: ${typeof(data)}'); +featureAbility.getWindow((error, data) => { + if (error && error.code !== 0) { + console.error('getWindow fail, error: ${JSON.stringify(error)}'); + } else { + console.log('getWindow success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -823,6 +851,6 @@ Enumerates the flags that specify how the Want will be handled. | FLAG_ABILITY_CONTINUATION_REVERSIBLE | 0x00000400 | Indicates that the migration is reversible. | | FLAG_INSTALL_ON_DEMAND | 0x00000800 | Indicates that the specific ability will be installed if it has not been installed. | | FLAG_INSTALL_WITH_BACKGROUND_MODE | 0x80000000 | Indicates that the specific ability will be installed in the background if it has not been installed. | -| FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | Clears other operation missions. This flag can be set for the **Want** object in the **startAbility** API passed to [ohos.app.Context](js-apis-ability-context.md) and must be used together with **flag_ABILITY_NEW_MISSION**.| +| FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | Clears other operation missions. This flag can be set for [Want](js-apis-application-want.md) under the [parameter](js-apis-inner-ability-startAbilityParameter.md) object passed to the [startAbility](#featureabilitystartability) API in **FeatureAbility**. It must be used together with **flag_ABILITY_NEW_MISSION**.| | FLAG_ABILITY_NEW_MISSION | 0x10000000 | Creates a mission on an existing mission stack. | | FLAG_ABILITY_MISSION_TOP | 0x20000000 | Reuses an ability instance if it is on the top of an existing mission stack; creates an ability instance otherwise.| diff --git a/en/application-dev/reference/apis/js-apis-ability-particleAbility.md b/en/application-dev/reference/apis/js-apis-ability-particleAbility.md index d4c5a739a80f7976f1581454423cc8c4d824035d..1afa116d859733011cd323f6eda58b7dea225d96 100644 --- a/en/application-dev/reference/apis/js-apis-ability-particleAbility.md +++ b/en/application-dev/reference/apis/js-apis-ability-particleAbility.md @@ -47,7 +47,7 @@ particleAbility.startAbility( { want: { - action: 'action.system.home', + action: 'ohos.want.action.home', entities: ['entity.system.home'], type: 'MIMETYPE', flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, @@ -57,8 +57,12 @@ particleAbility.startAbility( uri: '' }, }, - (error, result) => { - console.error('particleAbility startAbility errCode: ${JSON.stringify(error)}, result: ${JSON.stringify(result)}'); + (error, data) => { + if (error && error.code !== 0) { + console.error('startAbility fail, error: ${JSON.stringify(error)}'); + } else { + console.log('startAbility success, data: ${JSON.stringify(data)}'); + } }, ); ``` @@ -98,7 +102,7 @@ particleAbility.startAbility( { want: { - action: 'action.system.home', + action: 'ohos.want.action.home', entities: ['entity.system.home'], type: 'MIMETYPE', flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, @@ -133,8 +137,12 @@ Terminates this ParticleAbility. This API uses an asynchronous callback to retur import particleAbility from '@ohos.ability.particleAbility'; particleAbility.terminateSelf( - (error, result) => { - console.log('particleAbility terminateSelf errCode: ${JSON.stringify(error)}, result: ${JSON.stringify(result)}'); + (error, data) => { + if (error && error.code !== 0) { + console.error('terminateSelf fail, error: ${JSON.stringify(error)}'); + } else { + console.log('terminateSelf success, data: ${JSON.stringify(data)}'); + } } ); ``` @@ -226,11 +234,11 @@ import notification from '@ohos.notification'; import particleAbility from '@ohos.ability.particleAbility'; import wantAgent from '@ohos.app.ability.wantAgent'; -function callback(err, data) { - if (err) { - console.error('Operation failed cause: ${JSON.stringify(err)}'); +function callback(error, data) { + if (error && error.code !== 0) { + console.error('Operation failed error: ${JSON.stringify(error)}'); } else { - console.info('Operation succeeded'); + console.info('Operation succeeded, data: ${data}'); } } @@ -349,11 +357,11 @@ Requests to cancel a continuous task from the system. This API uses an asynchron ```ts import particleAbility from '@ohos.ability.particleAbility'; -function callback(err, data) { - if (err) { - console.error('Operation failed cause: ${JSON.stringify(err)}'); +function callback(error, data) { + if (error && error.code !== 0) { + console.error('Operation failed error: ${JSON.stringify(error)}'); } else { - console.info('Operation succeeded'); + console.info('Operation succeeded, data: ${data}'); } } @@ -421,11 +429,11 @@ function onConnectCallback(element, remote) { } function onDisconnectCallback(element) { - console.log('ConnectAbility onDisconnect element.deviceId : ${element.deviceId}'); + console.log('ConnectAbility onDisconnect element.deviceId: ${element.deviceId}'); } function onFailedCallback(code) { - console.log('particleAbilityTest ConnectAbility onFailed errCode : ${code}'); + console.error('particleAbilityTest ConnectAbility onFailed errCode: ${code}'); } let connId = particleAbility.connectAbility( @@ -441,9 +449,9 @@ let connId = particleAbility.connectAbility( ); particleAbility.disconnectAbility(connId).then((data) => { - console.log(' data: ${data}'); + console.log('data: ${data}'); }).catch((error) => { - console.log('particleAbilityTest result errCode : ${error.code}'); + console.error('particleAbilityTest result errCode: ${error.code}'); }); ``` @@ -472,11 +480,11 @@ function onConnectCallback(element, remote) { } function onDisconnectCallback(element) { - console.log('ConnectAbility onDisconnect element.deviceId : ${element.deviceId}'); + console.log('ConnectAbility onDisconnect element.deviceId: ${element.deviceId}'); } function onFailedCallback(code) { - console.log('particleAbilityTest ConnectAbility onFailed errCode : ${code}'); + console.error('particleAbilityTest ConnectAbility onFailed errCode: ${code}'); } let connId = particleAbility.connectAbility( @@ -492,7 +500,7 @@ let connId = particleAbility.connectAbility( ); particleAbility.disconnectAbility(connId, (err) => { - console.log('particleAbilityTest disconnectAbility err: ${JSON.stringify(err)}'); + console.error('particleAbilityTest disconnectAbility err: ${JSON.stringify(err)}'); }); ``` @@ -522,11 +530,11 @@ function onConnectCallback(element, remote) { } function onDisconnectCallback(element) { - console.log('ConnectAbility onDisconnect element.deviceId : ${element.deviceId}'); + console.log('ConnectAbility onDisconnect element.deviceId: ${element.deviceId}'); } function onFailedCallback(code) { - console.log('particleAbilityTest ConnectAbility onFailed errCode : ${code}'); + console.error('particleAbilityTest ConnectAbility onFailed errCode: ${code}'); } let connId = particleAbility.connectAbility( @@ -544,7 +552,7 @@ let connId = particleAbility.connectAbility( particleAbility.disconnectAbility(connId).then((data) => { console.log(' data: ${data}'); }).catch((error) => { - console.log('particleAbilityTest result errCode : ${error.code}'); + console.error('particleAbilityTest result errCode : ${error.code}'); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-ability-wantConstant.md b/en/application-dev/reference/apis/js-apis-ability-wantConstant.md index 776faa162b5178cec3bf003aedc018c17ab17084..55074a510f56e2580d8e57da59ca72bb3209876f 100644 --- a/en/application-dev/reference/apis/js-apis-ability-wantConstant.md +++ b/en/application-dev/reference/apis/js-apis-ability-wantConstant.md @@ -46,13 +46,6 @@ Enumerates the action constants of the **Want** object. **action** specifies the | ACTION_FILE_SELECT7+ | ohos.action.fileSelect | Action of selecting a file. | | PARAMS_STREAM7+ | ability.params.stream | URI of the data stream associated with the target when the data is sent. The value must be an array of the string type. | | ACTION_APP_ACCOUNT_OAUTH 8+ | ohos.account.appAccount.action.oauth | Action of providing the OAuth service. | -| ACTION_APP_ACCOUNT_AUTH 9+ | account.appAccount.action.auth | Action of providing the authentication service. | -| ACTION_MARKET_DOWNLOAD 9+ | ohos.want.action.marketDownload | Action of downloading an application from the application market.
**System API**: This is a system API and cannot be called by third-party applications. | -| ACTION_MARKET_CROWDTEST 9+ | ohos.want.action.marketCrowdTest | Action of crowdtesting an application from the application market.
**System API**: This is a system API and cannot be called by third-party applications. | -| DLP_PARAMS_SANDBOX9+ |ohos.dlp.params.sandbox | Action of obtaining the sandbox flag.
**System API**: This is a system API and cannot be called by third-party applications. | -| DLP_PARAMS_BUNDLE_NAME9+ |ohos.dlp.params.bundleName |Action of obtaining the DLP bundle name.
**System API**: This is a system API and cannot be called by third-party applications. | -| DLP_PARAMS_MODULE_NAME9+ |ohos.dlp.params.moduleName |Action of obtaining the DLP module name.
**System API**: This is a system API and cannot be called by third-party applications. | -| DLP_PARAMS_ABILITY_NAME9+ |ohos.dlp.params.abilityName |Action of obtaining the DLP ability name.
**System API**: This is a system API and cannot be called by third-party applications. | | DLP_PARAMS_INDEX9+ |ohos.dlp.params.index |Action of obtaining the DLP index.
**System API**: This is a system API and cannot be called by third-party applications. | ## wantConstant.Entity @@ -72,7 +65,7 @@ Enumerates the entity constants of the **Want** object. **entity** specifies add ## wantConstant.Flags -Enumerates the flags that specify how the Want will be handled. + Enumerates the flags that specify how the Want will be handled. **System capability**: SystemCapability.Ability.AbilityBase @@ -91,6 +84,6 @@ Enumerates the flags that specify how the Want will be handled. | FLAG_ABILITY_CONTINUATION_REVERSIBLE | 0x00000400 | Indicates that ability continuation is reversible.
**System API**: This is a system API and cannot be called by third-party applications. | | FLAG_INSTALL_ON_DEMAND | 0x00000800 | Indicates that the specific ability will be installed if it has not been installed. | | FLAG_INSTALL_WITH_BACKGROUND_MODE | 0x80000000 | Indicates that the specific ability will be installed in the background if it has not been installed. | -| FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | Clears other operation missions. This flag can be set for the **Want** object in the **startAbility** API passed to [ohos.app.Context](js-apis-ability-context.md) and must be used together with **flag_ABILITY_NEW_MISSION**.| +| FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | Clears other operation missions. This flag can be set for **Want** in the [startAbility](js-apis-ability-featureAbility.md#startability) API passed to the FeatureAbility module. It must be used together with **flag_ABILITY_NEW_MISSION**. | | FLAG_ABILITY_NEW_MISSION | 0x10000000 | Creates a mission on the history mission stack. | | FLAG_ABILITY_MISSION_TOP | 0x20000000 | Reuses an ability instance if it is on the top of an existing mission stack; creates an ability instance otherwise.| diff --git a/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md b/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md index ff89b62d12e370ccaa046c40576405e8cfe72c22..d4b34e125d2d723f1825aca53a801b1a729c5b9b 100644 --- a/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md +++ b/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md @@ -3,6 +3,7 @@ The **AbilityAccessCtrl** module provides APIs for application permission management, including authentication, authorization, and revocation. > **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 @@ -15,7 +16,7 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl' createAtManager(): AtManager -Creates an **AtManager** instance, which is used for ability access control. +Creates an **AtManager** instance, which is used for application access control. **System capability**: SystemCapability.Security.AccessToken @@ -34,7 +35,7 @@ let atManager = abilityAccessCtrl.createAtManager(); ## AtManager -Implements ability access control. +Provides APIs for application access control. ### checkAccessToken9+ @@ -59,11 +60,11 @@ Checks whether a permission is granted to an application. This API uses a promis **Error codes** -For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md). +For details about the error codes, see [Application Access Control Error Codes](../errorcodes/errorcode-access-token.md). | ID| Error Message| | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID is 0 | +| 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName is greater than 256 bytes. | **Example** @@ -106,11 +107,11 @@ Verifies whether a permission is granted to an application. This API returns the **Error codes** -For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md). +For details about the error codes, see [Application Access Control Error Codes](../errorcodes/errorcode-access-token.md). | ID| Error Message| | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID is 0 | +| 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName is greater than 256 bytes. | **Example** @@ -123,7 +124,7 @@ console.log(`data->${JSON.stringify(data)}`); ### grantUserGrantedPermission -grantUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlag: number): Promise<void> +grantUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlags: number): Promise<void> Grants a user_grant permission to an application. This API uses a promise to return the result. @@ -139,7 +140,7 @@ Grants a user_grant permission to an application. This API uses a promise to ret | --------- | ------------------- | ---- | ------------------------------------------------------------ | | tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundleManager-applicationInfo.md). | | permissionName | Permissions | Yes | Permission to grant. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).| -| permissionFlag | number | Yes | Permission flag. The value **1** means that the permission request dialog box will still be displayed after the user grants or denies the permission. The value **2** means that no dialog box will be displayed after the user grants or denies the permission. The value **3** means a system permission that cannot be changed. | +| permissionFlags | number | Yes | Permission flag.
- **0**: The permission is not set by the user.
- **1**: A dialog box for user authorization will be displayed the next time if the user denies authorization for the permission.
- **2**: No dialog box will be displayed the next time if the user denies authorization for the permission. The permission must be granted by the user in **Settings**.
- **4**: The permission is authorized by the system and cannot be changed.| **Return value** @@ -149,11 +150,11 @@ Grants a user_grant permission to an application. This API uses a promise to ret **Error codes** -For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md). +For details about the error codes, see [Application Access Control Error Codes](../errorcodes/errorcode-access-token.md). | ID| Error Message| | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID is 0 | +| 12100001 | The parameter is invalid. The tokenID is 0, the permissionName is greater than 256 bytes, or the flags value is invalid. | | 12100002 | The specified tokenID does not exist. | | 12100003 | The specified permission does not exist. | | 12100006 | The application specified by the tokenID is not allowed to be granted with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. | @@ -166,9 +167,9 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; let atManager = abilityAccessCtrl.createAtManager(); let tokenID = 0; // Use bundleManager.getApplicationInfo() to obtain the token ID for a system application, and use bundleManager.getBundleInfoForSelf() to obtain the token ID for a non-system application. -let permissionFlag = 1; +let permissionFlags = 1; try { - atManager.grantUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlag).then(() => { + atManager.grantUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlags).then(() => { console.log('grantUserGrantedPermission success'); }).catch((err) => { console.log(`grantUserGrantedPermission fail, err->${JSON.stringify(err)}`); @@ -180,7 +181,7 @@ try { ### grantUserGrantedPermission -grantUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlag: number, callback: AsyncCallback<void>): void +grantUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlags: number, callback: AsyncCallback<void>): void Grants a user_grant permission to an application. This API uses an asynchronous callback to return the result. @@ -196,16 +197,16 @@ Grants a user_grant permission to an application. This API uses an asynchronous | --------- | ------------------- | ---- | ------------------------------------------------------------ | | tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundleManager-applicationInfo.md).| | permissionName | Permissions | Yes | Permission to grant. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).| -| permissionFlag | number | Yes | Permission flag. The value **1** means that the permission request dialog box will still be displayed after the user grants or denies the permission. The value **2** means that no dialog box will be displayed after the user grants or denies the permission. The value **3** means a system permission that cannot be changed. | -| callback | AsyncCallback<void> | Yes| Callback used to return the result. If the permission is granted successfully, **err** is **undefined**. Otherwise, **err** is an error object.| +| permissionFlags | number | Yes | Permission flag.
- **0**: The permission is not set by the user.
- **1**: A dialog box for user authorization will be displayed the next time if the user denies authorization for the permission.
- **2**: No dialog box will be displayed the next time if the user denies authorization for the permission. The permission must be granted by the user in **Settings**.
- **4**: The permission is authorized by the system and cannot be changed.| +| callback | AsyncCallback<void> | Yes| Callback invoked to return the result. If the permission is granted, **err** is **undefined**. Otherwise, **err** is an error object.| **Error codes** -For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md). +For details about the error codes, see [Application Access Control Error Codes](../errorcodes/errorcode-access-token.md). | ID| Error Message| | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID is 0 | +| 12100001 | The parameter is invalid. The tokenID is 0, the permissionName is greater than 256 bytes, or the flags value is invalid. | | 12100002 | TokenId does not exist. | | 12100003 | Permission does not exist. | | 12100006 | The application specified by the tokenID is not allowed to be granted with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. | @@ -218,9 +219,9 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; let atManager = abilityAccessCtrl.createAtManager(); let tokenID = 0; // Use bundleManager.getApplicationInfo() to obtain the token ID for a system application, and use bundleManager.getBundleInfoForSelf() to obtain the token ID for a non-system application. -let permissionFlag = 1; +let permissionFlags = 1; try { - atManager.grantUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlag, (err, data) => { + atManager.grantUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlags, (err, data) => { if (err) { console.log(`grantUserGrantedPermission fail, err->${JSON.stringify(err)}`); } else { @@ -234,7 +235,7 @@ try { ### revokeUserGrantedPermission -revokeUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlag: number): Promise<void> +revokeUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlags: number): Promise<void> Revokes a user_grant permission from an application. This API uses a promise to return the result. @@ -250,7 +251,7 @@ Revokes a user_grant permission from an application. This API uses a promise to | --------- | ------------------- | ---- | ------------------------------------------------------------ | | tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundleManager-applicationInfo.md). | | permissionName | Permissions | Yes | Permission to revoke. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).| -| permissionFlag | number | Yes | Permission flag. The value **1** means that the permission request dialog box will still be displayed after the user grants or denies the permission. The value **2** means that no dialog box will be displayed after the user grants or denies the permission. The value **3** means a system permission that cannot be changed. | +| permissionFlags | number | Yes | Permission flag.
- **0**: The permission is not set by the user.
- **1**: A dialog box for user authorization will be displayed the next time if the user denies authorization for the permission.
- **2**: No dialog box will be displayed the next time if the user denies authorization for the permission. The permission must be granted by the user in **Settings**.
- **4**: The permission is authorized by the system and cannot be changed.| **Return value** @@ -260,11 +261,11 @@ Revokes a user_grant permission from an application. This API uses a promise to **Error codes** -For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md). +For details about the error codes, see [Application Access Control Error Codes](../errorcodes/errorcode-access-token.md). | ID| Error Message| | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID is 0 | +| 12100001 | The parameter is invalid. The tokenID is 0, the permissionName is greater than 256 bytes, or the flags value is invalid. | | 12100002 | The specified tokenID does not exist. | | 12100003 | The specified permission does not exist. | | 12100006 | The application specified by the tokenID is not allowed to be revoked with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. | @@ -277,9 +278,9 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; let atManager = abilityAccessCtrl.createAtManager(); let tokenID = 0; // Use bundleManager.getApplicationInfo() to obtain the token ID for a system application, and use bundleManager.getBundleInfoForSelf() to obtain the token ID for a non-system application. -let permissionFlag = 1; +let permissionFlags = 1; try { - atManager.revokeUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlag).then(() => { + atManager.revokeUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlags).then(() => { console.log('revokeUserGrantedPermission success'); }).catch((err) => { console.log(`revokeUserGrantedPermission fail, err->${JSON.stringify(err)}`); @@ -291,7 +292,7 @@ try { ### revokeUserGrantedPermission -revokeUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlag: number, callback: AsyncCallback<void>): void +revokeUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlags: number, callback: AsyncCallback<void>): void Revokes a user_grant permission from an application. This API uses an asynchronous callback to return the result. @@ -307,16 +308,16 @@ Revokes a user_grant permission from an application. This API uses an asynchrono | --------- | ------------------- | ---- | ------------------------------------------------------------ | | tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundleManager-applicationInfo.md). | | permissionName | Permissions | Yes | Permission to revoke. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).| -| permissionFlag | number | Yes | Permission flag. The value **1** means that the permission request dialog box will still be displayed after the user grants or denies the permission. The value **2** means that no dialog box will be displayed after the user grants or denies the permission. The value **3** means a system permission that cannot be changed. | -| callback | AsyncCallback<void> | Yes| Callback used to return the result. If the permission is revoked successfully, **err** is **undefined**. Otherwise, **err** is an error object.| +| permissionFlags | number | Yes | Permission flag.
- **0**: The permission is not set by the user.
- **1**: A dialog box for user authorization will be displayed the next time if the user denies authorization for the permission.
- **2**: No dialog box will be displayed the next time if the user denies authorization for the permission. The permission must be granted by the user in **Settings**.
- **4**: The permission is authorized by the system and cannot be changed.| +| callback | AsyncCallback<void> | Yes| Callback invoked to return the result. If the permission is revoked, **err** is **undefined**. Otherwise, **err** is an error object.| **Error codes** -For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md). +For details about the error codes, see [Application Access Control Error Codes](../errorcodes/errorcode-access-token.md). | ID| Error Message| | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID is 0 | +| 12100001 | The parameter is invalid. The tokenID is 0, the permissionName is greater than 256 bytes, or the flags value is invalid. | | 12100002 | TokenId does not exist. | | 12100003 | Permission does not exist. | | 12100006 | The application specified by the tokenID is not allowed to be revoked with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. | @@ -329,9 +330,9 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; let atManager = abilityAccessCtrl.createAtManager(); let tokenID = 0; // Use bundleManager.getApplicationInfo() to obtain the token ID for a system application, and use bundleManager.getBundleInfoForSelf() to obtain the token ID for a non-system application. -let permissionFlag = 1; +let permissionFlags = 1; try { - atManager.revokeUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlag, (err, data) => { + atManager.revokeUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS", permissionFlags, (err, data) => { if (err) { console.log(`revokeUserGrantedPermission fail, err->${JSON.stringify(err)}`); } else { @@ -347,7 +348,7 @@ try { getPermissionFlags(tokenID: number, permissionName: Permissions): Promise<number> -Obtains the flags of the specified permission of an application. This API uses a promise to return the result. +Obtains the permission flag of an application. This API uses a promise to return the result. **System API**: This is a system API. @@ -366,15 +367,15 @@ Obtains the flags of the specified permission of an application. This API uses a | Type | Description | | :------------ | :---------------------------------- | -| Promise<number> | Promise used to return the result.| +| Promise<number> | Promise used to return the permission flag obtained. | **Error codes** -For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md). +For details about the error codes, see [Application Access Control Error Codes](../errorcodes/errorcode-access-token.md). | ID| Error Message| | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID is 0 | +| 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName is greater than 256 bytes. | | 12100002 | The specified tokenID does not exist. | | 12100003 | The specified permission does not exist. | | 12100006 | The operation is not allowed. Either the application is a sandbox or the tokenID is from a remote device. | @@ -426,9 +427,9 @@ promise.then(data => { ### on9+ -on(type: 'permissionStateChange', tokenIDList: Array<number>, permissionNameList: Array<Permissions>, callback: Callback<PermissionStateChangeInfo>): void; +on(type: 'permissionStateChange', tokenIDList: Array<number>, permissionList: Array<Permissions>, callback: Callback<PermissionStateChangeInfo>): void; -Subscribes to permission grant state changes of the specified applications and permissions. +Subscribes to permission state changes of the specified applications and permissions. **System API**: This is a system API. @@ -440,18 +441,18 @@ Subscribes to permission grant state changes of the specified applications and p | Name | Type | Mandatory| Description | | ------------------ | --------------------- | ---- | ------------------------------------------------------------ | -| type | string | Yes | Event type. The value is fixed at **'permissionStateChange'**, indicating the permission grant state change event. | -| tokenIDList | Array<number> | Yes | List of token IDs. If this parameter is left empty, the permission grant state changes of all applications are subscribed to. | -| permissionNameList | Array<Permissions> | Yes | List of permission names. If this parameter is left empty, the permission grant state changes of all permissions are subscribed to. | -| callback | Callback<[PermissionStateChangeInfo](#permissionstatechangeinfo9)> | Yes| Callback used to return the permission grant state change information.| +| type | string | Yes | Event type to subscribe to. The value is **'permissionStateChange'**, which indicates the permission grant state change. | +| tokenIDList | Array<number> | Yes | Token IDs of the applications to observe. If this parameter is left empty, the permission grant state changes of all applications are observed. | +| permissionList | Array<Permissions> | Yes | Permissions to observe. If this parameter is left empty, the grant state changes of all permissions are observed. | +| callback | Callback<[PermissionStateChangeInfo](#permissionstatechangeinfo9)> | Yes| Callback invoked to return the permission grant state change.| **Error codes** -For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md). +For details about the error codes, see [Application Access Control Error Codes](../errorcodes/errorcode-access-token.md). | ID| Error Message| | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID is 0 | +| 12100001 | The parameter is invalid. The tokenID is 0, or the permissionName is greater than 256 bytes. | | 12100004 | The interface is called repeatedly with the same input. | | 12100005 | The registration time has exceeded the limitation. | | 12100007 | Service is abnormal. | @@ -461,13 +462,14 @@ For details about the error codes, see [Ability Access Control Error Codes](../e ```js import abilityAccessCtrl, {Permissions} from '@ohos.abilityAccessCtrl'; +import bundle from '@ohos.bundle.bundleManager'; let atManager = abilityAccessCtrl.createAtManager(); let appInfo = bundle.getApplicationInfoSync('com.example.myapplication', 0, 100); let tokenIDList: Array = [appInfo.accessTokenId]; -let permissionNameList: Array = ["ohos.permission.DISTRIBUTED_DATASYNC"]; +let permissionList: Array = ["ohos.permission.DISTRIBUTED_DATASYNC"]; try { - atManager.on('permissionStateChange', tokenIDList, permissionNameList, (data) => { + atManager.on('permissionStateChange', tokenIDList, permissionList, (data) => { console.debug("receive permission state change, data:" + JSON.stringify(data)); }); } catch(err) { @@ -477,9 +479,9 @@ try { ### off9+ -off(type: 'permissionStateChange', tokenIDList: Array<number>, permissionNameList: Array<Permissions>, callback?: Callback<PermissionStateChangeInfo>): void; +off(type: 'permissionStateChange', tokenIDList: Array<number>, permissionList: Array<Permissions>, callback?: Callback<PermissionStateChangeInfo>): void; -Unsubscribes from permission grant state changes of the specified applications and permissions. This API uses an asynchronous callback to return the result. +Unsubscribes from permission grant state changes of the specified applications and permissions. This API uses a callback to return the result. **System API**: This is a system API. @@ -491,19 +493,19 @@ Unsubscribes from permission grant state changes of the specified applications a | Name | Type | Mandatory| Description | | ------------------ | --------------------- | ---- | ------------------------------------------------------------ | -| type | string | Yes | Event type. The value is fixed at **'permissionStateChange'**, indicating the permission grant state change event. | -| tokenIDList | Array<number> | Yes | List of token IDs. If this parameter is left empty, the permission grant state changes of all applications are unsubscribed from. The value must be the same as that passed in **on()**.| -| permissionNameList | Array<Permissions> | Yes | List of permission names. If this parameter is left empty, the permission grant state changes of all permissions are unsubscribed from. The value must be the same as that passed in **on()**.| -| callback | Callback<[PermissionStateChangeInfo](#permissionstatechangeinfo9)> | No| Callback used to return the permission grant state change information.| +| type | string | Yes | Event type to unsubscribe from. The value is **'permissionStateChange'**, which indicates the permission grant state change. | +| tokenIDList | Array<number> | Yes | Token IDs of the applications. If this parameter is left empty, the permission grant state changes of all applications are unsubscribed from. The value must be the same as that passed in **on()**. | +| permissionList | Array<Permissions> | Yes | Permission names. If this parameter is left empty, the grant state changes of all permissions are unsubscribed from. The value must be the same as that passed in **on()**. | +| callback | Callback<[PermissionStateChangeInfo](#permissionstatechangeinfo9)> | No| Callback for the permission grant state change. | **Error codes** -For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md). +For details about the error codes, see [Application Access Control Error Codes](../errorcodes/errorcode-access-token.md). | ID| Error Message| | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID in list is all invalid | -| 12100004 | The interface is not used with | +| 12100001 | The parameter is invalid. The tokenIDs or permissionNames in the list are all invalid. | +| 12100004 | The interface is not used together with "on". | | 12100007 | Service is abnormal. | | 12100008 | Out of memory. | @@ -511,13 +513,14 @@ For details about the error codes, see [Ability Access Control Error Codes](../e ```js import abilityAccessCtrl, {Permissions} from '@ohos.abilityAccessCtrl'; +import bundle from '@ohos.bundle.bundleManager'; let atManager = abilityAccessCtrl.createAtManager(); let appInfo = bundle.getApplicationInfoSync('com.example.myapplication', 0, 100); let tokenIDList: Array = [appInfo.accessTokenId]; -let permissionNameList: Array = ["ohos.permission.DISTRIBUTED_DATASYNC"]; +let permissionList: Array = ["ohos.permission.DISTRIBUTED_DATASYNC"]; try { - atManager.off('permissionStateChange', tokenIDList, permissionNameList); + atManager.off('permissionStateChange', tokenIDList, permissionList); } catch(err) { console.log(`catch err->${JSON.stringify(err)}`); } @@ -529,7 +532,9 @@ verifyAccessToken(tokenID: number, permissionName: Permissions): Promise<Gran Verifies whether a permission is granted to an application. This API uses a promise to return the result. -> **NOTE**
You are advised to use [checkAccessToken](#checkaccesstoken9). +> **NOTE** +> +> You are advised to use [checkAccessToken](#checkaccesstoken9). **System capability**: SystemCapability.Security.AccessToken @@ -538,7 +543,7 @@ Verifies whether a permission is granted to an application. This API uses a prom | Name | Type | Mandatory| Description | | -------- | ------------------- | ---- | ------------------------------------------ | | tokenID | number | Yes | Token ID of the application. The value can be obtained from [ApplicationInfo](js-apis-bundleManager-applicationInfo.md). | -| permissionName | Permissions | Yes | Permission to verify. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).| +| permissionName | Permissions | Yes | Permission to verify. For details about the permissions, see the [Application Permission List](../../security/permission-list.md). | **Return value** @@ -561,9 +566,9 @@ promise.then(data => { ### requestPermissionsFromUser9+ -requestPermissionsFromUser(context: Context, permissions: Array<Permissions>, requestCallback: AsyncCallback<PermissionRequestResult>) : void; +requestPermissionsFromUser(context: Context, permissionList: Array<Permissions>, requestCallback: AsyncCallback<PermissionRequestResult>) : void; -Requests user authorization in a dialog box. This API uses an asynchronous callback to return the result. +Requests permissions from the user in a dialog box. This API uses an asynchronous callback to return the result. **Model restriction**: This API can be used only in the stage model. @@ -573,16 +578,17 @@ Requests user authorization in a dialog box. This API uses an asynchronous callb | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| context | Context | Yes| Ability context of the application that requests the permission.| -| permissions | Array<Permissions> | Yes| Permissions requested. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).| +| context | Context | Yes| Ability context of the application that requests the permissions. | +| permissionList | Array<Permissions> | Yes| Permissions requested. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).| | callback | AsyncCallback<[PermissionRequestResult](js-apis-permissionrequestresult.md)> | Yes| Callback invoked to return the result.| **Error codes** -For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md). +For details about the error codes, see [Application Access Control Error Codes](../errorcodes/errorcode-access-token.md). + | ID| Error Message| | -------- | -------- | -| 12100001 | Parameter invalid. | +| 12100001 | The parameter is invalid. The context is invalid when it does not belong to the application itself. | **Example** @@ -602,9 +608,9 @@ try { ### requestPermissionsFromUser9+ -requestPermissionsFromUser(context: Context, permissions: Array<Permissions>) : Promise<PermissionRequestResult>; +requestPermissionsFromUser(context: Context, permissionList: Array<Permissions>) : Promise<PermissionRequestResult>; -Requests user authorization in a dialog box. This API uses a promise to return the result. +Requests permissions from the user in a dialog box. This API uses a promise to return the result. **Model restriction**: This API can be used only in the stage model. @@ -614,8 +620,8 @@ Requests user authorization in a dialog box. This API uses a promise to return | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| context | Context | Yes| Ability context of the application that requests the permission.| -| permissions | Array<Permissions> | Yes| Permissions requested. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).| +| context | Context | Yes| Ability context of the application that requests the permissions. | +| permissionList | Array<Permissions> | Yes| Permissions requested. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).| **Return value** @@ -625,10 +631,11 @@ Requests user authorization in a dialog box. This API uses a promise to return **Error codes** -For details about the error codes, see [Ability Access Control Error Codes](../errorcodes/errorcode-access-token.md). +For details about the error codes, see [Application Access Control Error Codes](../errorcodes/errorcode-access-token.md). + | ID| Error Message| | -------- | -------- | -| 12100001 | Parameter invalid. | +| 12100001 | The parameter is invalid. The context is invalid when it does not belong to the application itself. | **Example** @@ -654,7 +661,9 @@ verifyAccessToken(tokenID: number, permissionName: string): Promise<GrantStat Verifies whether a permission is granted to an application. This API uses a promise to return the result. -> NOTE
This API is deprecated since API version 9. You are advised to use [checkAccessToken](#checkaccesstoken9). +> **NOTE** +> +> This API is no longer maintained since API version 9. You are advised to use [checkAccessToken](#checkaccesstoken9). **System capability**: SystemCapability.Security.AccessToken @@ -710,7 +719,7 @@ Enumerates the operations that trigger permission grant state changes. ### PermissionStateChangeInfo9+ -Defines the detailed permission grant state change information. +Defines detailed information about the permission grant state change. **System API**: This is a system API. @@ -719,5 +728,6 @@ Defines the detailed permission grant state change information. | Name | Type | Readable| Writable| Description | | -------------- | ------------------------- | ---- | ---- | ------------------ | | change | [PermissionStateChangeType](#permissionstatechangetype9) | Yes | No | Operation that triggers the permission grant state change. | -| tokenID | number | Yes | No | Token ID of the application whose permission grant state changes are subscribed.| -| permissionName | Permissions | Yes | No | Permission whose authorization status changes. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).| +| tokenID | number | Yes | No | Token ID of the application. | +| permissionName | Permissions | Yes | No | Permission whose grant state changes. For details about the permissions, see the [Application Permission List](../../security/permission-list.md). | + diff --git a/en/application-dev/reference/apis/js-apis-accessibility.md b/en/application-dev/reference/apis/js-apis-accessibility.md index 8121b906b88726624f649211a6e82b05bc722023..2aa842a8d45a8485cd098a0ba5d8f65550026d73 100644 --- a/en/application-dev/reference/apis/js-apis-accessibility.md +++ b/en/application-dev/reference/apis/js-apis-accessibility.md @@ -68,20 +68,20 @@ Describes the target action supported by an accessibility application. | -------- | -------- | | click | Clicking.| | longClick | Long pressing.| -| scrollForward | Scrolling forward.| -| scrollBackward | Scrolling backward.| -| focus | Obtaining focus.| -| clearFocus | Clearing focus.| -| clearSelection | Clearing selection.| -| accessibilityFocus | Obtaining the accessibility focus.| -| clearAccessibilityFocus | Clearing the accessibility focus.| -| cut | Cut.| -| copy | Copy.| -| paste | Paste.| -| select | Select.| -| setText | Setting the text.| -| delete | Delete.| -| setSelection | Setting the selection.| +| scrollForward | Scrolling forward. Not supported currently. | +| scrollBackward | Scrolling backward. Not supported currently. | +| focus | Obtaining focus. Not supported currently. | +| clearFocus | Clearing focus. Not supported currently. | +| clearSelection | Clearing selection. Not supported currently. | +| accessibilityFocus | Obtaining the accessibility focus. | +| clearAccessibilityFocus | Clearing the accessibility focus. | +| cut | Cut. Not supported currently. | +| copy | Copy. Not supported currently. | +| paste | Paste. Not supported currently. | +| select | Select. Not supported currently. | +| setText | Setting the text. Not supported currently. | +| delete | Delete. Not supported currently. | +| setSelection | Setting the selection. Not supported currently. | ## Capability @@ -94,7 +94,7 @@ Enumerates the capabilities of an accessibility application. | retrieve | Capability to retrieve the window content.| | touchGuide | Capability of touch guide mode.| | keyEventObserver | Capability to filter key events.| -| zoom | Capability to control the display zoom level.| +| zoom | Capability to control the display zoom level. Not supported currently. | | gesture | Capability to perform gesture actions.| ## CaptionsFontEdgeType8+ @@ -279,15 +279,15 @@ Describes a GUI change event. | bundleName | string | Yes| Yes| Target application name.| | componentType | string | Yes| Yes| Type of the event source component, for example, button or chart.| | pageId | number | Yes| Yes| Page ID of the event source.| -| description | string | Yes| Yes| Event description.| +| description | string | Yes| Yes| Event description. Not supported currently. | | triggerAction | [Action](#action) | Yes| Yes| Action that triggers the event.| -| textMoveUnit | [TextMoveUnit](#textmoveunit) | Yes| Yes| Text movement unit.| +| textMoveUnit | [TextMoveUnit](#textmoveunit) | Yes| Yes| Text movement unit. Not supported currently. | | contents | Array<string> | Yes| Yes| Array of contents.| | lastContent | string | Yes| Yes| Latest content.| -| beginIndex | number | Yes| Yes| Sequence number of the first item displayed on the page.| -| currentIndex | number | Yes| Yes| Sequence number of the current item.| -| endIndex | number | Yes| Yes| Sequence number of the last item displayed on the page.| -| itemCount | number | Yes| Yes| Total number of items.| +| beginIndex | number | Yes| Yes| Sequence number of the first item displayed on the page. Not supported currently. | +| currentIndex | number | Yes| Yes| Sequence number of the current item. Not supported currently. | +| endIndex | number | Yes| Yes| Sequence number of the last item displayed on the page. Not supported currently. | +| itemCount | number | Yes| Yes| Total number of items. Not supported currently. | ### constructor @@ -323,13 +323,13 @@ Enumerates accessibility event types. | -------- | -------- | | click | Event of clicking a component.| | longClick | Event of long-pressing a component.| -| select | Event of selecting a component.| -| focus | Event indicating that the component obtains the focus.| -| textUpdate | Event indicating that the component text has been updated.| -| hoverEnter | Event indicating that the hover enters a component.| -| hoverExit | Event indicating that the hover exits a component.| -| scroll | Event of the scroll view.| -| textSelectionUpdate | Event indicating that the selected text has been updated.| +| select | Event of selecting a component. Not supported currently. | +| focus | Event indicating that the component obtains the focus. Not supported currently. | +| textUpdate | Event indicating that the component text has been updated. Not supported currently. | +| hoverEnter | Event indicating that the hover enters a component. Not supported currently. | +| hoverExit | Event indicating that the hover exits a component. Not supported currently. | +| scroll | Event of the scroll view. Not supported currently. | +| textSelectionUpdate | Event indicating that the selected text has been updated. Not supported currently. | | accessibilityFocus | Event indicating that the accessibility focus has been obtained.| | accessibilityFocusClear | Event indicating that the accessibility focus has been cleared.| diff --git a/en/application-dev/reference/apis/js-apis-app-ability-abilityConstant.md b/en/application-dev/reference/apis/js-apis-app-ability-abilityConstant.md index 62d38c714940a754e566bbdebadac2e3fcbccec2..ff1bbfa2187c2a5ad868e28e11e08ae1a77ed705 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-abilityConstant.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-abilityConstant.md @@ -35,8 +35,8 @@ Enumerates the initial ability launch reasons. You can use it together with [onC | Name | Value | Description | | ----------------------------- | ---- | ------------------------------------------------------------ | | UNKNOWN | 0 | Unknown reason.| -| START_ABILITY | 1 | The ability is started by calling [startAbility](js-apis-ability-context.md#abilitycontextstartability).| -| CALL | 2 | The ability is started by calling [startAbilityByCall](js-apis-ability-context.md#abilitycontextstartabilitybycall).| +| START_ABILITY | 1 | The ability is started by calling [startAbility](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability).| +| CALL | 2 | The ability is started by calling [startAbilityByCall](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartabilitybycall).| | CONTINUATION | 3 | The ability is started by means of cross-device migration.| | APP_RECOVERY | 4 | The ability is automatically started when the application is restored from a fault.| @@ -99,7 +99,7 @@ import UIAbility from '@ohos.app.ability.UIAbility'; class MyAbility extends UIAbility { onContinue(wantParam) { - return AbilityConstant.OnConinueResult.AGREE; + return AbilityConstant.OnContinueResult.AGREE; } } ``` @@ -132,10 +132,10 @@ let option = { }; // Ensure that the context is obtained. -this.context.startAbility(want, option).then(()={ +this.context.startAbility(want, option).then(()=>{ console.log('Succeed to start ability.'); }).catch((error)=>{ - console.log('Failed to start ability with error: ${JSON.stringify(error)}'); + console.error('Failed to start ability with error: ${JSON.stringify(error)}'); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-app-ability-abilityDelegatorRegistry.md b/en/application-dev/reference/apis/js-apis-app-ability-abilityDelegatorRegistry.md index fe6bec9f550bef9bdeb6a3c61c8a1c5adc810f10..76614085293fe0065dafea4a2e3a9d0d8559be0f 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-abilityDelegatorRegistry.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-abilityDelegatorRegistry.md @@ -56,7 +56,7 @@ abilityDelegator.startAbility(want, (err) => { if (!err || err.code === 0) { console.log('Success start ability.'); } else { - console.log('Failed start ability, error: ${JSON.stringify(err)}'); + console.error('Failed start ability, error: ${JSON.stringify(err)}'); } }); ``` diff --git a/en/application-dev/reference/apis/js-apis-app-ability-abilityLifecycleCallback.md b/en/application-dev/reference/apis/js-apis-app-ability-abilityLifecycleCallback.md index df7b07b2d0303bf9310cfdd354d50b1db9239ece..28c0772d7d5718cd328f318535bb276ff32550cf 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-abilityLifecycleCallback.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-abilityLifecycleCallback.md @@ -275,9 +275,9 @@ export default class MyFirstAbility extends UIAbility { // 2. Register the listener for the ability lifecycle changes through the applicationContext object. try { globalThis.lifecycleId = applicationContext.on('abilityLifecycle', abilityLifecycleCallback); - console.log('registerAbilityLifecycleCallback number: ${JSON.stringify(lifecycleId)}'); + console.log('registerAbilityLifecycleCallback lifecycleId: ${globalThis.lifecycleId}'); } catch (paramError) { - console.log('error: ${paramError.code}, ${paramError.message}'); + console.error('error: ${paramError.code}, ${paramError.message}'); } } } @@ -285,7 +285,7 @@ export default class MyFirstAbility extends UIAbility { MySecondAbility.ts ```ts -import UIAbility from 'ohos.app.ability.UIAbility'; +import UIAbility from '@ohos.app.ability.UIAbility'; export default class MySecondAbility extends UIAbility { onDestroy() { @@ -293,7 +293,7 @@ export default class MySecondAbility extends UIAbility { // 3. Deregister the listener for the ability lifecycle changes through the applicationContext object. applicationContext.off('abilityLifecycle', globalThis.lifecycleId, (error) => { if (error && error.code !== 0) { - console.log('unregisterAbilityLifecycleCallback fail, error: ${JSON.stringify(error)}'); + console.error('unregisterAbilityLifecycleCallback fail, error: ${JSON.stringify(error)}'); } else { console.log('unregisterAbilityLifecycleCallback success.'); } diff --git a/en/application-dev/reference/apis/js-apis-app-ability-abilityManager.md b/en/application-dev/reference/apis/js-apis-app-ability-abilityManager.md index 3bfd14ef61cbd5995d4d5b8a0e93a08cfbeaaac5..3cb32c4a2cdcbf7dbe451e3a8e880bc3414cc689 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-abilityManager.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-abilityManager.md @@ -59,12 +59,13 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ```ts import abilityManager from '@ohos.app.ability.abilityManager'; +import ConfigurationConstant from '@ohos.app.ability.ConfigurationConstant'; const config = { language: 'Zh-Hans', // Simplified Chinese. - colorMode: COLOR_MODE_LIGHT, // Light theme. - direction: DIRECTION_VERTICAL, // Vertical direction. - screenDensity: SCREEN_DENSITY_SDPI, // The screen pixel density is 'sdpi'. + colorMode: ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT, // Light theme. + direction: ConfigurationConstant.Direction.DIRECTION_VERTICAL, // Vertical direction. + screenDensity: ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_SDPI, // The screen pixel density is 'sdpi'. displayId: 1, // The application is displayed on the display with ID 1. hasPointerDevice: true, // A pointer device is connected. }; @@ -78,7 +79,7 @@ try { } }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -116,12 +117,13 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ```ts import abilityManager from '@ohos.app.ability.abilityManager'; +import ConfigurationConstant from '@ohos.app.ability.ConfigurationConstant'; const config = { language: 'Zh-Hans', // Simplified Chinese. - colorMode: COLOR_MODE_LIGHT, // Light theme. - direction: DIRECTION_VERTICAL, // Vertical direction. - screenDensity: SCREEN_DENSITY_SDPI, // The screen pixel density is 'sdpi'. + colorMode: ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT, // Light theme. + direction: ConfigurationConstant.Direction.DIRECTION_VERTICAL, // Vertical direction. + screenDensity: ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_SDPI, // The screen pixel density is 'sdpi'. displayId: 1, // The application is displayed on the display with ID 1. hasPointerDevice: true, // A pointer device is connected. }; @@ -133,7 +135,7 @@ try { console.error('updateConfiguration fail, err: ${JSON.stringify(err)}'); }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -175,7 +177,7 @@ try { } }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -215,7 +217,7 @@ try { console.error('getAbilityRunningInfos fail, err: ${JSON.stringify(err)}'); }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -260,7 +262,7 @@ try { } }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -308,7 +310,7 @@ try { console.error('getExtensionRunningInfos fail, err: ${JSON.stringify(err)}'); }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` diff --git a/en/application-dev/reference/apis/js-apis-app-ability-appManager.md b/en/application-dev/reference/apis/js-apis-app-ability-appManager.md index c3d5a93c0f73f2b4e2e06caf8d1f45d9fd637f9f..f3e739c76ad25996ed767b71c0099ee7ca425abc 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-appManager.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-appManager.md @@ -459,7 +459,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ```ts import appManager from '@ohos.app.ability.appManager'; -let observeId = 0; +let observerId = 0; // 1. Register an application state observer. let applicationStateObserver = { @@ -540,7 +540,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ```ts import appManager from '@ohos.app.ability.appManager'; -let observeId = 0; +let observerId = 0; // 1. Register an application state observer. let applicationStateObserver = { diff --git a/en/application-dev/reference/apis/js-apis-app-ability-appRecovery.md b/en/application-dev/reference/apis/js-apis-app-ability-appRecovery.md index 5a07867e6f5c28213e5cc48b07ef6a0958eb9426..6931cfe50da06cdd9b7526344a47eae29c3c8ef8 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-appRecovery.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-appRecovery.md @@ -4,7 +4,7 @@ The **appRecovery** module provides APIs for recovering faulty applications. > **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. In the current version, only applications with a single ability in a single process can be recovered. +> 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. In API version 9, only applications with a single ability in a process can be recovered. In API version 10, applications with multiple abilities in a process can be recovered. ## Modules to Import ```ts @@ -51,7 +51,7 @@ Enumerates the application state saving modes. This enum is used as an input par enableAppRecovery(restart?: [RestartFlag](#apprecoveryrestartflag), saveOccasion?: [SaveOccasionFlag](#apprecoverysaveoccasionflag), saveMode?: [SaveModeFlag](#apprecoverysavemodeflag)) : void; -Enables application recovery. +Enables application recovery. After this API is called, the first ability that is displayed when the application is started from the initiator can be restored. **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -63,8 +63,8 @@ Enables application recovery. | saveOccasion | [SaveOccasionFlag](#apprecoverysaveoccasionflag) | No| Scenario for saving the application state. By default, the state is saved when a fault occurs.| | saveMode | [SaveModeFlag](#apprecoverysavemodeflag) | No| Application state saving mode. By default, the application state is written to the local file cache.| -**Example** - +**Example** + ```ts import appRecovery from '@ohos.app.ability.appRecovery'; import AbilityStage from '@ohos.app.ability.AbilityStage'; @@ -72,9 +72,9 @@ import AbilityStage from '@ohos.app.ability.AbilityStage'; export default class MyAbilityStage extends AbilityStage { onCreate() { appRecovery.enableAppRecovery( - appRecovery.RestartFlag::ALWAYS_RESTART, - appRecovery.SaveOccasionFlag::SAVE_WHEN_ERROR, - appRecovery.SaveModeFlag::SAVE_WITH_FILE + appRecovery.RestartFlag.ALWAYS_RESTART, + appRecovery.SaveOccasionFlag.SAVE_WHEN_ERROR, + appRecovery.SaveModeFlag.SAVE_WITH_FILE ); } } @@ -84,13 +84,22 @@ export default class MyAbilityStage extends AbilityStage { restartApp(): void; -Restarts the application. This API can be used together with APIs of [errorManager](js-apis-app-ability-errorManager.md). +Restarts the current process and starts the first ability that is displayed when the application is started. If the state of this ability is saved, the saved state data is passed into the **wantParam** attribute in the **want** parameter of the **OnCreate** lifecycle callback of the ability. + +In API version 10, the ability specified by [setRestartWant](#apprecoverysetrestartwant) is started. If no ability is specified, the following rules are used: + +- If the ability of the current application running in the foreground supports recovery, that ability is started. + +- If multiple abilities that support recovery is running in the foreground, only the last ability is started. + +- If no ability is running in the foreground, none of them is started. + +This API can be used together with the APIs of [errorManager](js-apis-app-ability-errorManager.md). **System capability**: SystemCapability.Ability.AbilityRuntime.Core +**Example** -**Example** - ```ts import appRecovery from '@ohos.app.ability.appRecovery'; import errorManager from '@ohos.app.ability.errorManager'; @@ -105,7 +114,7 @@ let observer = { try { errorManager.on('error', observer); } catch (paramError) { - console.log('error: ${paramError.code}, ${paramError.message}'); + console.error('error: ${paramError.code}, ${paramError.message}'); } ``` @@ -113,7 +122,7 @@ try { saveAppState(): boolean; -Saves the application state. This API can be used together with APIs of [errorManager](js-apis-app-ability-errorManager.md). +Saves the application state. This API can be used together with the APIs of [errorManager](js-apis-app-ability-errorManager.md). **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -123,8 +132,8 @@ Saves the application state. This API can be used together with APIs of [errorMa | -------- | -------- | | boolean | Whether the application state is saved. The value **true** is returned if the application state is saved, and **false** is returned otherwise.| -**Example** - +**Example** + ```ts import appRecovery from '@ohos.app.ability.appRecovery'; import errorManager from '@ohos.app.ability.errorManager'; @@ -139,6 +148,56 @@ let observer = { try { errorManager.on('error', observer); } catch (paramError) { - console.log('error: ${paramError.code}, ${paramError.message}'); + console.error('error: ${paramError.code}, ${paramError.message}'); } ``` + +## appRecovery.saveAppState10+ + +saveAppState(context?: UIAbilityContext): boolean; + +Saves the ability state, which will be used for recovery. This API can be used together with the APIs of [errorManager](js-apis-app-ability-errorManager.md). + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Return value** + +| Type| Description| +| -------- | -------- | +| boolean | Whether the application state is saved. The value **true** is returned if the application state is saved, and **false** is returned otherwise.| + +**Example** + +```ts +import appRecovery from '@ohos.app.ability.appRecovery'; +onBackground() { + hilog.info(0x0000, '[demo]', '%{public}s', 'EntryAbility onBackground'); + appRecovery.saveAppState(this.context) +} +``` + +## appRecovery.setRestartWant10+ + +setRestartWant(want: Want): void; + +Sets an ability that will be recovered. The ability must be a UIAbility in the current bundle. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Example** + +```ts +import appRecovery from '@ohos.app.ability.appRecovery'; +Button ("Start to Recover Ability") + .fontSize(40) + .fontWeight(FontWeight.Bold) + .onClick(()=> { + // set restart want + let want = { + bundleName: "ohos.samples.recovery", + abilityName: "RecoveryAbility" + }; + + appRecovery.setRestartWant(want); + }) +``` diff --git a/en/application-dev/reference/apis/js-apis-app-ability-dialogRequest.md b/en/application-dev/reference/apis/js-apis-app-ability-dialogRequest.md index 989796d48ee22b34bd28b63b74fe20270d367577..49c3191c660f1848ffca26c13f8bebb2bfb754d0 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-dialogRequest.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-dialogRequest.md @@ -127,6 +127,7 @@ Obtains the request callback from Want. ## RequestInfo Defines the request information, which is used as an input parameter for binding the modal dialog box. + **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **Example** diff --git a/en/application-dev/reference/apis/js-apis-app-ability-environmentCallback.md b/en/application-dev/reference/apis/js-apis-app-ability-environmentCallback.md index 96c67de7c5cc52b781f55add22b59859560ee9d5..53d009a28bb9be2f62a6dfee2540a7e0de184e39 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-environmentCallback.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-environmentCallback.md @@ -35,7 +35,7 @@ onMemoryLevel(level: AbilityConstant.MemoryLevel): void; Called when the system memory level changes. -**System capability**: SystemCapability.Ability.AbilityRuntime.Core +**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore **Parameters** @@ -55,7 +55,7 @@ export default class MyAbility extends UIAbility { onCreate() { console.log('MyAbility onCreate'); globalThis.applicationContext = this.context.getApplicationContext(); - let EnvironmentCallback = { + let environmentCallback = { onConfigurationUpdated(config){ console.log('onConfigurationUpdated config: ${JSON.stringify(config)}'); } @@ -67,7 +67,7 @@ export default class MyAbility extends UIAbility { // 1. Obtain an applicationContext object. let applicationContext = globalThis.applicationContext; // 2. Register a listener for the environment changes through the applicationContext object. - callbackId = applicationContext.registerEnvironmentCallback(EnvironmentCallback); + callbackId = applicationContext.registerEnvironmentCallback(environmentCallback); console.log('registerEnvironmentCallback number: ${JSON.stringify(callbackId)}'); } onDestroy() { diff --git a/en/application-dev/reference/apis/js-apis-app-ability-missionManager.md b/en/application-dev/reference/apis/js-apis-app-ability-missionManager.md index 1224636ae4c0aa4ceb8634b244cd088257b64331..eb92543feba85b2ce4abe3cb0f213fd19dccffe4 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-missionManager.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-missionManager.md @@ -290,7 +290,7 @@ Obtains the information about a given mission. This API uses an asynchronous cal | -------- | -------- | -------- | -------- | | deviceId | string | Yes| Device ID. It is a null string by default for the local device.| | missionId | number | Yes| Mission ID.| - | callback | AsyncCallback<[MissionInfo](./js-apis-inner-application-missionInfo.md))> | Yes| Callback used to return the mission information obtained.| + | callback | AsyncCallback<[MissionInfo](./js-apis-inner-application-missionInfo.md)> | Yes| Callback used to return the mission information obtained.| **Example** @@ -306,7 +306,7 @@ Obtains the information about a given mission. This API uses an asynchronous cal missionManager.getMissionInfo('', testMissionId, (error, mission) => { if (error) { - console.error('getMissionInfo failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfo failed, error.code: ${error.code}, error.message: ${error.message}'); } else { console.log('mission.missionId = ${mission.missionId}'); console.log('mission.runningState = ${mission.runningState}'); @@ -392,7 +392,7 @@ Obtains information about all missions. This API uses an asynchronous callback t try { missionManager.getMissionInfos('', 10, (error, missions) => { if (error) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); } else { console.log('size = ${missions.length}'); console.log('missions = ${JSON.stringify(missions)}'); diff --git a/en/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md b/en/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md index 74686becf7e0f2a20d5a3f8efb07071589296330..c041a599c6f9857db40e530f1e888c2a12f47f54 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md @@ -106,7 +106,7 @@ Called following **onCreate()** when a ServiceExtensionAbility is started by cal ## ServiceExtensionAbility.onConnect -onConnect(want: Want): rpc.RemoteObject; +onConnect(want: Want): rpc.RemoteObject | Promise; Called following **onCreate()** when a ServiceExtensionAbility is started by calling **connectAbility()**. A **RemoteObject** object is returned for communication between the server and client. @@ -148,7 +148,7 @@ Called following **onCreate()** when a ServiceExtensionAbility is started by cal ## ServiceExtensionAbility.onDisconnect -onDisconnect(want: Want): void; +onDisconnect(want: Want): void | Promise; Called when a client is disconnected from this ServiceExtensionAbility. diff --git a/en/application-dev/reference/apis/js-apis-app-ability-startOptions.md b/en/application-dev/reference/apis/js-apis-app-ability-startOptions.md index 54200ed3e7e27043eb2798522a3fd1c991eca5a3..d50bb380f662b1c992b10ef8f8b2b8ff7088d061 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-startOptions.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-startOptions.md @@ -33,7 +33,7 @@ import StartOptions from '@ohos.app.ability.StartOptions'; try { missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.log('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -49,6 +49,6 @@ import StartOptions from '@ohos.app.ability.StartOptions'; }); }); } catch (paramError) { - console.log('error: ${paramError.code}, ${paramError.message}'); + console.error('error: ${paramError.code}, ${paramError.message}'); } ``` diff --git a/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md b/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md index d840fd6854292aa876ecd3777e7cedc96b5e95bb..fbf50f68387385c7d69c02ce599285a5b8ad2310 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md @@ -124,7 +124,7 @@ Called when the **WindowStage** is restored during the migration of this UIAbili ## UIAbility.onDestroy -onDestroy(): void; +onDestroy(): void | Promise<void>; Called when this UIAbility is destroyed to clear resources. @@ -181,7 +181,7 @@ Called when this UIAbility is switched from the foreground to the background. ## UIAbility.onContinue -onContinue(wantParam : {[key: string]: any}): AbilityConstant.OnContinueResult; +onContinue(wantParam: { [key: string]: Object }): AbilityConstant.OnContinueResult; Called to save data during the ability migration preparation process. @@ -267,7 +267,7 @@ Dumps client information. ## UIAbility.onSaveState -onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: any}): AbilityConstant.OnSaveResult; +onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: Object}): AbilityConstant.OnSaveResult; Called when the framework automatically saves the UIAbility state in the case of an application fault. This API is used together with [appRecovery](js-apis-app-ability-appRecovery.md). If automatic state saving is enabled, **onSaveState** is called to save the state of this UIAbility. @@ -308,7 +308,7 @@ Implements sending of sequenceable data to the target ability when the CallerAbi ## Caller.call -call(method: string, data: rpc.Sequenceable): Promise<void>; +call(method: string, data: rpc.Parcelable): Promise<void>; Sends sequenceable data to the target ability. @@ -319,7 +319,7 @@ Sends sequenceable data to the target ability. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | method | string | Yes| Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data.| -| data | [rpc.Sequenceable](js-apis-rpc.md#sequenceabledeprecated) | Yes| Sequenceable data. You need to customize the data.| +| data | [rpc.Parcelable](js-apis-rpc.md#parcelable9) | Yes| Parcelable data. You need to customize the data.| **Return value** @@ -338,7 +338,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error **Example** ```ts - class MyMessageAble{ // Custom sequenceable data structure. + class MyMessageAble{ // Custom parcelable data structure. name:'' str:'' num: 1 @@ -346,15 +346,15 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error this.name = name; this.str = str; } - marshalling(messageParcel) { - messageParcel.writeInt(this.num); - messageParcel.writeString(this.str); + marshalling(messageSequence) { + messageSequence.writeInt(this.num); + messageSequence.writeString(this.str); console.log('MyMessageAble marshalling num[${this.num}] str[${this.str}]'); return true; } - unmarshalling(messageParcel) { - this.num = messageParcel.readInt(); - this.str = messageParcel.readString(); + unmarshalling(messageSequence) { + this.num = messageSequence.readInt(); + this.str = messageSequence.readString(); console.log('MyMessageAble unmarshalling num[${this.num}] str[${this.str}]'); return true; } @@ -369,16 +369,16 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error deviceId: '' }).then((obj) => { caller = obj; - let msg = new MyMessageAble('msg', 'world'); // See the definition of Sequenceable. + let msg = new MyMessageAble('msg', 'world'); // See the definition of Parcelable. caller.call(method, msg) .then(() => { console.log('Caller call() called'); }) .catch((callErr) => { - console.log('Caller.call catch error, error.code: ${JSON.stringify(callErr.code)}, error.message: ${JSON.stringify(callErr.message)}'); + console.log('Caller.call catch error, error.code: ${callErr.code}, error.message: ${callErr.message}'); }); }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -387,7 +387,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ## Caller.callWithResult -callWithResult(method: string, data: rpc.Sequenceable): Promise<rpc.MessageParcel>; +callWithResult(method: string, data: rpc.Parcelable): Promise<rpc.MessageSequence>; Sends sequenceable data to the target ability and obtains the sequenceable data returned by the target ability. @@ -398,13 +398,13 @@ Sends sequenceable data to the target ability and obtains the sequenceable data | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | method | string | Yes| Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data.| -| data | [rpc.Sequenceable](js-apis-rpc.md#sequenceabledeprecated) | Yes| Sequenceable data. You need to customize the data.| +| data | [rpc.Parcelable](js-apis-rpc.md#parcelable9) | Yes| Parcelable data. You need to customize the data.| **Return value** | Type| Description| | -------- | -------- | -| Promise<[rpc.MessageParcel](js-apis-rpc.md#sequenceabledeprecated)> | Promise used to return the sequenceable data from the target ability.| +| Promise<[rpc.MessageSequence](js-apis-rpc.md#messagesequence9)> | Promise used to return the sequenceable data from the target ability.| **Error codes** @@ -425,15 +425,15 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error this.name = name; this.str = str; } - marshalling(messageParcel) { - messageParcel.writeInt(this.num); - messageParcel.writeString(this.str); + marshalling(messageSequence) { + messageSequence.writeInt(this.num); + messageSequence.writeString(this.str); console.log('MyMessageAble marshalling num[${this.num}] str[${this.str}]'); return true; } - unmarshalling(messageParcel) { - this.num = messageParcel.readInt(); - this.str = messageParcel.readString(); + unmarshalling(messageSequence) { + this.num = messageSequence.readInt(); + this.str = messageSequence.readString(); console.log('MyMessageAble unmarshalling num[${this.num] str[${this.str}]'); return true; } @@ -453,13 +453,13 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error .then((data) => { console.log('Caller callWithResult() called'); let retmsg = new MyMessageAble(0, ''); - data.readSequenceable(retmsg); + data.readParcelable(retmsg); }) .catch((callErr) => { - console.log('Caller.callWithResult catch error, error.code: ${JSON.stringify(callErr.code)}, error.message: ${JSON.stringify(callErr.message)}'); + console.log('Caller.callWithResult catch error, error.code: ${callErr.code}, error.message: ${callErr.message}'); }); }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -498,10 +498,10 @@ Releases the caller interface of the target ability. try { caller.release(); } catch (releaseErr) { - console.log('Caller.release catch error, error.code: ${JSON.stringify(releaseErr.code)}, error.message: ${JSON.stringify(releaseErr.message)}'); + console.log('Caller.release catch error, error.code: ${releaseErr.code}, error.message: ${releaseErr.message}'); } }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -509,7 +509,7 @@ Releases the caller interface of the target ability. ## Caller.onRelease - onRelease(callback: OnReleaseCallBack): void; + onRelease(callback: OnReleaseCallback): void; Registers a callback that is invoked when the stub on the target ability is disconnected. @@ -519,7 +519,7 @@ Registers a callback that is invoked when the stub on the target ability is disc | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| callback | [OnReleaseCallBack](#onreleasecallback) | Yes| Callback used to return the result.| +| callback | [OnReleaseCallback](#onreleasecallback) | Yes| Callback used to return the result.| **Example** @@ -538,10 +538,10 @@ Registers a callback that is invoked when the stub on the target ability is disc console.log(' Caller OnRelease CallBack is called ${str}'); }); } catch (error) { - console.log('Caller.onRelease catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('Caller.onRelease catch error, error.code: ${error.code}, error.message: ${error.message}'); } }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -560,7 +560,7 @@ Registers a callback that is invoked when the stub on the target ability is disc | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | string | Yes| Event type. The value is fixed at **release**.| -| callback | [OnReleaseCallBack](#onreleasecallback) | Yes| Callback used to return the result.| +| callback | [OnReleaseCallback](#onreleasecallback) | Yes| Callback used to return the result.| **Error codes** @@ -587,10 +587,10 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error console.log(' Caller OnRelease CallBack is called ${str}'); }); } catch (error) { - console.log('Caller.on catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('Caller.on catch error, error.code: ${error.code}, error.message: ${error.message}'); } }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -609,7 +609,7 @@ Deregisters a callback that is invoked when the stub on the target ability is di | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | string | Yes| Event type. The value is fixed at **release**.| -| callback | [OnReleaseCallBack](#onreleasecallback) | Yes| Callback used to return the result.| +| callback | [OnReleaseCallback](#onreleasecallback) | Yes| Callback used to return the result.| **Error codes** @@ -637,10 +637,10 @@ For other IDs, see [Ability Error Codes](../errorcodes/errorcode-ability.md). caller.on('release', onReleaseCallBack); caller.off('release', onReleaseCallBack); } catch (error) { - console.log('Caller.on or Caller.off catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('Caller.on or Caller.off catch error, error.code: ${error.code}, error.message: ${error.message}'); } }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -686,10 +686,10 @@ For other IDs, see [Ability Error Codes](../errorcodes/errorcode-ability.md). caller.on('release', onReleaseCallBack); caller.off('release'); } catch (error) { - console.error('Caller.on or Caller.off catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('Caller.on or Caller.off catch error, error.code: ${error.code}, error.message: ${error.message}'); } }).catch((err) => { - console.error('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.error('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -712,7 +712,7 @@ Registers a caller notification callback, which is invoked when the target abili | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | method | string | Yes| Notification message string negotiated between the two abilities.| -| callback | [CalleeCallback](#calleecallback) | Yes| JS notification synchronization callback of the [rpc.MessageParcel](js-apis-rpc.md#messageparceldeprecated) type. The callback must return at least one empty [rpc.Sequenceable](js-apis-rpc.md#sequenceabledeprecated) object. Otherwise, the function execution fails.| +| callback | [CalleeCallback](#calleecallback) | Yes| JS notification synchronization callback of the [rpc.MessageSequence](js-apis-rpc.md#messagesequence9) type. The callback must return at least one empty [rpc.Parcelable](js-apis-rpc.md#parcelable9) object. Otherwise, the function execution fails.| **Error codes** @@ -733,15 +733,15 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error this.name = name; this.str = str; } - marshalling(messageParcel) { - messageParcel.writeInt(this.num); - messageParcel.writeString(this.str); + marshalling(messageSequence) { + messageSequence.writeInt(this.num); + messageSequence.writeString(this.str); console.log('MyMessageAble marshalling num[${this.num}] str[${this.str}]'); return true; } - unmarshalling(messageParcel) { - this.num = messageParcel.readInt(); - this.str = messageParcel.readString(); + unmarshalling(messageSequence) { + this.num = messageSequence.readInt(); + this.str = messageSequence.readString(); console.log('MyMessageAble unmarshalling num[${this.num}] str[${this.str}]'); return true; } @@ -750,7 +750,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error function funcCallBack(pdata) { console.log('Callee funcCallBack is called ${pdata}'); let msg = new MyMessageAble('test', ''); - pdata.readSequenceable(msg); + pdata.readParcelable(msg); return new MyMessageAble('test1', 'Callee test'); } export default class MainUIAbility extends UIAbility { @@ -759,7 +759,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error try { this.callee.on(method, funcCallBack); } catch (error) { - console.log('Callee.on catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('Callee.on catch error, error.code: ${error.code}, error.message: ${error.message}'); } } } @@ -798,7 +798,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error try { this.callee.off(method); } catch (error) { - console.log('Callee.off catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('Callee.off catch error, error.code: ${error.code}, error.message: ${error.message}'); } } } @@ -816,10 +816,10 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error ## CalleeCallback -(indata: rpc.MessageParcel): rpc.Sequenceable; +(indata: rpc.MessageSequence): rpc.Parcelable; **System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore | Name| Readable| Writable| Type| Description| | -------- | -------- | -------- | -------- | -------- | -| (indata: [rpc.MessageParcel](js-apis-rpc.md#messageparceldeprecated)) | Yes| No| [rpc.Sequenceable](js-apis-rpc.md#sequenceabledeprecated) | Prototype of the listener function registered by the callee.| +| (indata: [rpc.MessageSequence](js-apis-rpc.md#messagesequence9)) | Yes| No| [rpc.Parcelable](js-apis-rpc.md#parcelable9) | Prototype of the listener function registered by the callee.| diff --git a/en/application-dev/reference/apis/js-apis-app-ability-want.md b/en/application-dev/reference/apis/js-apis-app-ability-want.md index 0411725e055551e68d2902705f3e904592587a1d..2fe06c942fc2a329f0572395ff9cf0b8cb0c3fa9 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-want.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-want.md @@ -26,7 +26,7 @@ import Want from '@ohos.app.ability.Want'; | entities | Array\ | No| Additional category information (such as browser and video player) of the ability. It is a supplement to the **action** field for implicit Want. and is used to filter ability types.| | uri | string | No| Data carried. This field is used together with **type** to specify the data type. If **uri** is specified in a Want, the Want will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**.| | type | string | No| MIME type, that is, the type of the file to open, for example, **'text/xml'** and **'image/*'**. For details about the MIME type definition, see https://www.iana.org/assignments/media-types/media-types.xhtml?utm_source=ld246.com.| -| parameters | {[key: string]: any} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:
- **ohos.aafwk.callerPid**: PID of the caller.
- **ohos.aafwk.param.callerToken**: token of the caller.
- **ohos.aafwk.param.callerUid**: UID in [BundleInfo](js-apis-bundleManager-bundleInfo.md#bundleinfo-1), that is, the application UID in the bundle information.
- **component.startup.newRules**: whether to enable the new control rule.
- **moduleName**: module name of the caller. No matter what this field is set to, the correct module name will be sent to the peer.
- **ohos.dlp.params.sandbox**: available only for DLP files. | +| parameters | {[key: string]: any} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:
- **ohos.aafwk.callerPid**: PID of the caller.
- **ohos.aafwk.param.callerBundleName**: bundle name of the caller.
- **ohos.aafwk.param.callerToken**: token of the caller.
- **ohos.aafwk.param.callerUid**: UID in [BundleInfo](js-apis-bundleManager-bundleInfo.md#bundleinfo-1), that is, the application UID in the bundle information.
- **component.startup.newRules**: whether to enable the new control rule.
- **moduleName**: module name of the caller. No matter what this field is set to, the correct module name will be sent to the peer.
- **ohos.dlp.params.sandbox**: available only for DLP files.| | [flags](js-apis-ability-wantConstant.md#wantconstantflags) | number | No| How the **Want** object will be handled. By default, a number is passed in.
For example, **wantConstant.Flags.FLAG_ABILITY_CONTINUATION** specifies whether to start the ability in cross-device migration scenarios.| **Example** @@ -34,6 +34,7 @@ import Want from '@ohos.app.ability.Want'; - Basic usage: called in a UIAbility object, as shown in the example below. For details about how to obtain the context, see [Obtaining the Context of UIAbility](../../application-models/uiability-usage.md#obtaining-the-context-of-uiability). ```ts + let context = ...; // UIAbilityContext let want = { 'deviceId': '', // An empty deviceId indicates the local device. 'bundleName': 'com.example.myapplication', @@ -41,16 +42,17 @@ import Want from '@ohos.app.ability.Want'; 'moduleName': 'entry' // moduleName is optional. }; - this.context.startAbility(want, (err) => { + context.startAbility(want, (err) => { // Start an ability explicitly. The bundleName, abilityName, and moduleName parameters work together to uniquely identify an ability. - console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); + console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`); }); ``` -- Data is transferred through user-defined fields. The following data types are supported (called in a UIAbility object, as shown in the example below. For details about how to obtain the context, see [Obtaining the Context of UIAbility](../../application-models/uiability-usage.md#obtaining-the-context-of-uiability).) +- Currently, the following data types are supported: string, number, Boolean, object, array, and file descriptor (FD). * String ```ts + let context = ...; // UIAbilityContext let want = { bundleName: 'com.example.myapplication', abilityName: 'FuncAbility', @@ -59,12 +61,13 @@ import Want from '@ohos.app.ability.Want'; }, }; - this.context.startAbility(want, (err) => { - console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); + context.startAbility(want, (err) => { + console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`); }); ``` * Number ```ts + let context = ...; // UIAbilityContext let want = { bundleName: 'com.example.myapplication', abilityName: 'FuncAbility', @@ -74,12 +77,13 @@ import Want from '@ohos.app.ability.Want'; }, }; - this.context.startAbility(want, (err) => { - console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); + context.startAbility(want, (err) => { + console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`); }); ``` * Boolean ```ts + let context = ...; // UIAbilityContext let want = { bundleName: 'com.example.myapplication', abilityName: 'FuncAbility', @@ -88,12 +92,13 @@ import Want from '@ohos.app.ability.Want'; }, }; - this.context.startAbility(want, (err) => { - console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); + context.startAbility(want, (err) => { + console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`); }); ``` * Object ```ts + let context = ...; // UIAbilityContext let want = { bundleName: 'com.example.myapplication', abilityName: 'FuncAbility', @@ -107,12 +112,13 @@ import Want from '@ohos.app.ability.Want'; }, }; - this.context.startAbility(want, (err) => { - console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); + context.startAbility(want, (err) => { + console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`); }); ``` * Array ```ts + let context = ...; // UIAbilityContext let want = { bundleName: 'com.example.myapplication', abilityName: 'FuncAbility', @@ -124,19 +130,21 @@ import Want from '@ohos.app.ability.Want'; }, }; - this.context.startAbility(want, (err) => { - console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); + context.startAbility(want, (err) => { + console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`); }); ``` - * File descriptor (FD) + * FD ```ts - import fileio from '@ohos.fileio'; + import fs from '@ohos.file.fs'; + + let context = ...; // UIAbilityContext let fd; try { - fd = fileio.openSync('/data/storage/el2/base/haps/pic.png'); - } catch(e) { - console.log('openSync fail: ${JSON.stringify(e)}'); + fd = fs.openSync('/data/storage/el2/base/haps/pic.png').fd; + } catch(err) { + console.error(`Failed to openSync. Code: ${err.code}, message: ${err.message}`); } let want = { 'deviceId': '', // An empty deviceId indicates the local device. @@ -148,7 +156,7 @@ import Want from '@ohos.app.ability.Want'; } }; - this.context.startAbility(want, (err) => { - console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); + context.startAbility(want, (err) => { + console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-app-ability-wantAgent.md b/en/application-dev/reference/apis/js-apis-app-ability-wantAgent.md index c7fd0b0f4a3f21eec8dbf66c51f890d6436b08f0..89c8919f494252120fff49a42cc8335c29ec702b 100644 --- a/en/application-dev/reference/apis/js-apis-app-ability-wantAgent.md +++ b/en/application-dev/reference/apis/js-apis-app-ability-wantAgent.md @@ -186,10 +186,10 @@ try { WantAgent.getWantAgent(wantAgentInfo).then((data) => { wantAgent = data; }).catch((err) => { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); }); } catch (err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -280,7 +280,7 @@ function getWantAgentCallback(err, data) { // getBundleName callback function getBundleNameCallback(err, data) { if(err) { - console.error('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getBundleName failed! ${err.code} ${err.message}'); } else { console.info('getBundleName ok! ${JSON.stringify(data)}'); } @@ -288,13 +288,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.getBundleName(wantAgent, getBundleNameCallback); } catch(err) { - console.error('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getBundleName failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -391,16 +391,16 @@ function getWantAgentCallback(err, data) { WantAgent.getBundleName(wantAgent).then((data)=>{ console.info('getBundleName ok! ${JSON.stringify(data)}'); }).catch((err)=>{ - console.error('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getBundleName failed! ${err.code} ${err.message}'); }); } catch(err){ - console.error('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getBundleName failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -492,7 +492,7 @@ function getWantAgentCallback(err, data) { // getUid callback function getUidCallback(err, data) { if(err) { - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } else { console.info('getUid ok! ${JSON.stringify(data)}'); } @@ -500,13 +500,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.getUid(wantAgent, getUidCallback); } catch(err) { - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -603,16 +603,16 @@ function getWantAgentCallback(err, data) { WantAgent.getUid(wantAgent).then((data)=>{ console.info('getUid ok! ${JSON.stringify(data)}'); }).catch((err)=>{ - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); }); } catch(err){ - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -704,7 +704,7 @@ function getWantAgentCallback(err, data) { // getWant callback function getWantCallback(err, data) { if(err) { - console.error('getWant failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWant failed! ${err.code} ${err.message}'); } else { console.info('getWant ok! ${JSON.stringify(data)}'); } @@ -712,13 +712,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.getWant(wantAgent, getWantCallback); } catch(err) { - console.error('getWant failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWant failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -817,16 +817,16 @@ function getWantAgentCallback(err, data) { WantAgent.getUid(wantAgent).then((data)=>{ console.info('getUid ok! ${JSON.stringify(data)}'); }).catch((err)=>{ - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); }); } catch(err){ - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -917,7 +917,7 @@ function getWantAgentCallback(err, data) { // cancel callback function cancelCallback(err, data) { if(err) { - console.error('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('cancel failed! ${err.code} ${err.message}'); } else { console.info('cancel ok!'); } @@ -925,13 +925,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.cancel(wantAgent, cancelCallback); } catch(err) { - console.error('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('cancel failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1028,16 +1028,16 @@ function getWantAgentCallback(err, data) { WantAgent.cancel(wantAgent).then((data)=>{ console.info('cancel ok!'); }).catch((err)=>{ - console.error('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('cancel failed! ${err.code} ${err.message}'); }); } catch(err){ - console.error('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('cancel failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1131,7 +1131,7 @@ function getWantAgentCallback(err, data) { // trigger callback function triggerCallback(err, data) { if(err) { - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } else { console.info('getUid ok! ${JSON.stringify(data)}'); } @@ -1139,13 +1139,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.trigger(wantAgent, triggerInfo, triggerCallback); } catch(err) { - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1239,7 +1239,7 @@ function getWantAgentCallback(err, data) { // equal callback function equalCallback(err, data) { if(err) { - console.error('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('equal failed! ${err.code} ${err.message}'); } else { console.info('equal ok! ${JSON.stringify(data)}'); } @@ -1247,13 +1247,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.equal(wantAgent1,wantAgent2,equalCallback); } catch(err) { - console.error('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('equal failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1353,16 +1353,16 @@ function getWantAgentCallback(err, data) { WantAgent.equal(wantAgent1,wantAgent2).then((data)=>{ console.info('equal ok! ${JSON.stringify(data)}'); }).catch((err)=>{ - console.error('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('equal failed! ${err.code} ${err.message}'); }) } catch(err){ - console.error('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('equal failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1451,7 +1451,7 @@ function getWantAgentCallback(err, data) { // getOperationTypeCallback callback function getOperationTypeCallback(err, data) { if(err) { - console.error('getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getOperationType failed! ${err.code} ${err.message}'); } else { console.info('getOperationType ok! ${JSON.stringify(data)}'); } @@ -1459,13 +1459,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.getOperationTypeCallback(wantAgent, getOperationTypeCallback); } catch(err) { - console.error('getOperationTypeCallback failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getOperationTypeCallback failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1560,16 +1560,16 @@ function getWantAgentCallback(err, data) { WantAgent.getOperationType(wantAgent).then((data)=>{ console.info('getOperationType ok! ${JSON.stringify(data)}'); }).catch((err)=>{ - console.error('getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getOperationType failed! ${err.code} ${err.message}'); }); } catch(err){ - console.error('getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getOperationType failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` diff --git a/en/application-dev/reference/apis/js-apis-app-form-formBindingData.md b/en/application-dev/reference/apis/js-apis-app-form-formBindingData.md index fa8e44aa0b0e5a06d88891214baab112d0ce47b6..dbef711c25369d3eac61ca1b6516a7c43d8ecbc2 100644 --- a/en/application-dev/reference/apis/js-apis-app-form-formBindingData.md +++ b/en/application-dev/reference/apis/js-apis-app-form-formBindingData.md @@ -59,6 +59,6 @@ try { }; formBindingData.createFormBindingData(obj); } catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` diff --git a/en/application-dev/reference/apis/js-apis-app-form-formExtensionAbility.md b/en/application-dev/reference/apis/js-apis-app-form-formExtensionAbility.md index 345f889f31e3d31cb834b03e9b5ecbde12aaabfe..7ea0a7024970cffde1434f76ce911cce28dbcd2e 100644 --- a/en/application-dev/reference/apis/js-apis-app-form-formExtensionAbility.md +++ b/en/application-dev/reference/apis/js-apis-app-form-formExtensionAbility.md @@ -273,7 +273,7 @@ export default class MyFormExtensionAbility extends FormExtensionAbility { ## onShareForm -onShareForm?(formId: string): { [key: string]: any } +onShareForm?(formId: string): { [key: string]: Object } Called by the widget provider to receive shared widget data. diff --git a/en/application-dev/reference/apis/js-apis-app-form-formHost.md b/en/application-dev/reference/apis/js-apis-app-form-formHost.md index e54e2cc798f8774fcc487d94c2ad9b514c42f897..bba49ff8ca2d8c96fd89e07b59c488d5cea12054 100644 --- a/en/application-dev/reference/apis/js-apis-app-form-formHost.md +++ b/en/application-dev/reference/apis/js-apis-app-form-formHost.md @@ -46,13 +46,13 @@ try { let formId = '12400633174999288'; formHost.deleteForm(formId, (error) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); } else { console.log('formHost deleteForm success'); } }); } catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -96,10 +96,10 @@ try { formHost.deleteForm(formId).then(() => { console.log('formHost deleteForm success'); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -136,11 +136,11 @@ try { let formId = '12400633174999288'; formHost.releaseForm(formId, (error) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -178,11 +178,11 @@ try { let formId = '12400633174999288'; formHost.releaseForm(formId, true, (error) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -226,10 +226,10 @@ try { formHost.releaseForm(formId, true).then(() => { console.log('formHost releaseForm success'); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -266,11 +266,11 @@ try { let formId = '12400633174999288'; formHost.requestForm(formId, (error) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -313,10 +313,10 @@ try { formHost.requestForm(formId).then(() => { console.log('formHost requestForm success'); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -354,11 +354,11 @@ try { let formId = '12400633174999288'; formHost.castToNormalForm(formId, (error) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -401,10 +401,10 @@ try { formHost.castToNormalForm(formId).then(() => { console.log('formHost castTempForm success'); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -441,11 +441,11 @@ try { let formId = ['12400633174999288']; formHost.notifyVisibleForms(formId, (error) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -488,10 +488,10 @@ try { formHost.notifyVisibleForms(formId).then(() => { console.log('formHost notifyVisibleForms success'); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -528,11 +528,11 @@ try { let formId = ['12400633174999288']; formHost.notifyInvisibleForms(formId, (error) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -575,10 +575,10 @@ try { formHost.notifyInvisibleForms(formId).then(() => { console.log('formHost notifyInvisibleForms success'); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -615,11 +615,11 @@ try { let formId = ['12400633174999288']; formHost.enableFormsUpdate(formId, (error) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -662,10 +662,10 @@ try { formHost.enableFormsUpdate(formId).then(() => { console.log('formHost enableFormsUpdate success'); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -702,11 +702,11 @@ try { let formId = ['12400633174999288']; formHost.disableFormsUpdate(formId, (error) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -749,10 +749,10 @@ try { formHost.disableFormsUpdate(formId).then(() => { console.log('formHost disableFormsUpdate success'); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -778,11 +778,11 @@ import formHost from '@ohos.app.form.formHost'; try { formHost.isSystemReady((error, data) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -809,10 +809,10 @@ try { formHost.isSystemReady().then(() => { console.log('formHost isSystemReady success'); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -840,13 +840,13 @@ import formHost from '@ohos.app.form.formHost'; try { formHost.getAllFormsInfo((error, data) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); } else { console.log('formHost getAllFormsInfo, data: ${JSON.stringify(data)}'); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -875,10 +875,10 @@ try { formHost.getAllFormsInfo().then((data) => { console.log('formHost getAllFormsInfo data: ${JSON.stringify(data)}'); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -914,13 +914,13 @@ import formHost from '@ohos.app.form.formHost'; try { formHost.getFormsInfo('com.example.ohos.formjsdemo', (error, data) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); } else { console.log('formHost getFormsInfo, data: ${JSON.stringify(data)}'); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -957,13 +957,13 @@ import formHost from '@ohos.app.form.formHost'; try { formHost.getFormsInfo('com.example.ohos.formjsdemo', 'entry', (error, data) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); } else { console.log('formHost getFormsInfo, data: ${JSON.stringify(data)}'); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -1006,10 +1006,10 @@ try { formHost.getFormsInfo('com.example.ohos.formjsdemo', 'entry').then((data) => { console.log('formHost getFormsInfo, data: ${JSON.stringify(data)}'); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -1039,13 +1039,13 @@ try { let formIds = new Array('12400633174999288', '12400633174999289'); formHost.deleteInvalidForms(formIds, (error, data) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); } else { console.log('formHost deleteInvalidForms, data: ${JSON.stringify(data)}'); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -1081,10 +1081,10 @@ try { formHost.deleteInvalidForms(formIds).then((data) => { console.log('formHost deleteInvalidForms, data: ${JSON.stringify(data)}'); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -1130,13 +1130,13 @@ let want = { try { formHost.acquireFormState(want, (error, data) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); } else { console.log('formHost acquireFormState, data: ${JSON.stringify(data)}'); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -1188,10 +1188,10 @@ try { formHost.acquireFormState(want).then((data) => { console.log('formHost acquireFormState, data: ${JSON.stringify(data)}'); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -1281,11 +1281,11 @@ let formIds = new Array('12400633174999288', '12400633174999289'); try { formHost.notifyFormsVisible(formIds, true, (error) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -1329,10 +1329,10 @@ try { formHost.notifyFormsVisible(formIds, true).then(() => { console.log('formHost notifyFormsVisible success'); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -1370,11 +1370,11 @@ let formIds = new Array('12400633174999288', '12400633174999289'); try { formHost.notifyFormsEnableUpdate(formIds, true, (error) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -1418,10 +1418,10 @@ try { formHost.notifyFormsEnableUpdate(formIds, true).then(() => { console.log('formHost notifyFormsEnableUpdate success'); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` ## shareForm @@ -1459,11 +1459,11 @@ let deviceId = 'EFC11C0C53628D8CC2F8CB5052477E130D075917034613B9884C55CD22B3DEF2 try { formHost.shareForm(formId, deviceId, (error) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -1508,10 +1508,10 @@ try { formHost.shareForm(formId, deviceId).then(() => { console.log('formHost shareForm success'); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -1549,11 +1549,11 @@ let formIds = new Array('12400633174999288', '12400633174999289'); try { formHost.notifyFormsPrivacyProtected(formIds, true, (error) => { if (error) { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); } }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` @@ -1595,9 +1595,9 @@ try { formHost.notifyFormsPrivacyProtected(formIds, true).then(() => { console.log('formHost notifyFormsPrivacyProtected success'); }).catch((error) => { - console.log(`error, code: ${error.code}, message: ${error.message}`); + console.error(`error, code: ${error.code}, message: ${error.message}`); }); } catch(error) { - console.log(`catch error, code: ${error.code}, message: ${error.message}`); + console.error(`catch error, code: ${error.code}, message: ${error.message}`); } ``` diff --git a/en/application-dev/reference/apis/js-apis-app-form-formInfo.md b/en/application-dev/reference/apis/js-apis-app-form-formInfo.md index 09a6ae02c63c18073836925ad9b6399e48fdd67d..ab73d920af1c1b76825049c63b5560d8e82390ac 100644 --- a/en/application-dev/reference/apis/js-apis-app-form-formInfo.md +++ b/en/application-dev/reference/apis/js-apis-app-form-formInfo.md @@ -47,7 +47,7 @@ Enumerates the widget types. | Name | Value | Description | | ----------- | ---- | ------------ | | JS | 1 | JS widget. | -| eTS | 2 | eTS widget.| +| eTS | 2 | ArkTS widget.| ## ColorMode diff --git a/en/application-dev/reference/apis/js-apis-app-form-formProvider.md b/en/application-dev/reference/apis/js-apis-app-form-formProvider.md index 5815289bcf5258156932e938843bdb3d0ff4c441..908c5a428a1a5f6cccd3f5ae2bc04e01ffa29716 100644 --- a/en/application-dev/reference/apis/js-apis-app-form-formProvider.md +++ b/en/application-dev/reference/apis/js-apis-app-form-formProvider.md @@ -43,13 +43,13 @@ let formId = '12400633174999288'; try { formProvider.setFormNextRefreshTime(formId, 5, (error, data) => { if (error) { - console.log(`callback error, code: ${error.code}, message: ${error.message})`); + console.error(`callback error, code: ${error.code}, message: ${error.message})`); } else { console.log(`formProvider setFormNextRefreshTime success`); } }); } catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message})`); + console.error(`catch error, code: ${error.code}, message: ${error.message})`); } ``` @@ -91,10 +91,10 @@ try { formProvider.setFormNextRefreshTime(formId, 5).then(() => { console.log(`formProvider setFormNextRefreshTime success`); }).catch((error) => { - console.log(`promise error, code: ${error.code}, message: ${error.message})`); + console.error(`promise error, code: ${error.code}, message: ${error.message})`); }); } catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message})`); + console.error(`catch error, code: ${error.code}, message: ${error.message})`); } ``` @@ -132,13 +132,13 @@ try { let obj = formBindingData.createFormBindingData({temperature:'22c', time:'22:00'}); formProvider.updateForm(formId, obj, (error, data) => { if (error) { - console.log(`callback error, code: ${error.code}, message: ${error.message})`); + console.error(`callback error, code: ${error.code}, message: ${error.message})`); } else { console.log(`formProvider updateForm success`); } }); } catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message})`); + console.error(`catch error, code: ${error.code}, message: ${error.message})`); } ``` @@ -182,10 +182,10 @@ try { formProvider.updateForm(formId, obj).then(() => { console.log(`formProvider updateForm success`); }).catch((error) => { - console.log(`promise error, code: ${error.code}, message: ${error.message})`); + console.error(`promise error, code: ${error.code}, message: ${error.message})`); }); } catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message})`); + console.error(`catch error, code: ${error.code}, message: ${error.message})`); } ``` @@ -219,13 +219,13 @@ import formProvider from '@ohos.app.form.formProvider'; try { formProvider.getFormsInfo((error, data) => { if (error) { - console.log(`callback error, code: ${error.code}, message: ${error.message})`); + console.error(`callback error, code: ${error.code}, message: ${error.message})`); } else { console.log('formProvider getFormsInfo, data: ${JSON.stringify(data)}'); } }); } catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message})`); + console.error(`catch error, code: ${error.code}, message: ${error.message})`); } ``` ## getFormsInfo @@ -263,13 +263,13 @@ const filter: formInfo.FormInfoFilter = { try { formProvider.getFormsInfo(filter, (error, data) => { if (error) { - console.log(`callback error, code: ${error.code}, message: ${error.message})`); + console.error(`callback error, code: ${error.code}, message: ${error.message})`); } else { console.log('formProvider getFormsInfo, data: ${JSON.stringify(data)}'); } }); } catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message})`); + console.error(`catch error, code: ${error.code}, message: ${error.message})`); } ``` @@ -314,10 +314,10 @@ try { formProvider.getFormsInfo(filter).then((data) => { console.log('formProvider getFormsInfo, data: ${JSON.stringify(data)}'); }).catch((error) => { - console.log(`promise error, code: ${error.code}, message: ${error.message})`); + console.error(`promise error, code: ${error.code}, message: ${error.message})`); }); } catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message})`); + console.error(`catch error, code: ${error.code}, message: ${error.message})`); } ``` @@ -364,13 +364,13 @@ try { let obj = formBindingData.createFormBindingData({ temperature: '22c', time: '22:00' }); formProvider.requestPublishForm(want, obj, (error, data) => { if (error) { - console.log(`callback error, code: ${error.code}, message: ${error.message})`); + console.error(`callback error, code: ${error.code}, message: ${error.message})`); } else { console.log('formProvider requestPublishForm, form ID is: ${JSON.stringify(data)}'); } }); } catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message})`); + console.error(`catch error, code: ${error.code}, message: ${error.message})`); } ``` @@ -414,13 +414,13 @@ let want = { try { formProvider.requestPublishForm(want, (error, data) => { if (error) { - console.log(`callback error, code: ${error.code}, message: ${error.message})`); + console.error(`callback error, code: ${error.code}, message: ${error.message})`); } else { console.log('formProvider requestPublishForm, form ID is: ${JSON.stringify(data)}'); } }); } catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message})`); + console.error(`catch error, code: ${error.code}, message: ${error.message})`); } ``` @@ -471,10 +471,10 @@ try { formProvider.requestPublishForm(want).then((data) => { console.log('formProvider requestPublishForm success, form ID is : ${JSON.stringify(data)}'); }).catch((error) => { - console.log(`promise error, code: ${error.code}, message: ${error.message})`); + console.error(`promise error, code: ${error.code}, message: ${error.message})`); }); } catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message})`); + console.error(`catch error, code: ${error.code}, message: ${error.message})`); } ``` @@ -502,7 +502,7 @@ import formProvider from '@ohos.app.form.formProvider'; try { formProvider.isRequestPublishFormSupported((error, isSupported) => { if (error) { - console.log(`callback error, code: ${error.code}, message: ${error.message})`); + console.error(`callback error, code: ${error.code}, message: ${error.message})`); } else { if (isSupported) { var want = { @@ -516,19 +516,19 @@ try { try { formProvider.requestPublishForm(want, (error, data) => { if (error) { - console.log(`callback error, code: ${error.code}, message: ${error.message})`); + console.error(`callback error, code: ${error.code}, message: ${error.message})`); } else { console.log('formProvider requestPublishForm, form ID is: ${JSON.stringify(data)}'); } }); } catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message})`); + console.error(`catch error, code: ${error.code}, message: ${error.message})`); } } } }); } catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message})`); + console.error(`catch error, code: ${error.code}, message: ${error.message})`); } ``` @@ -568,16 +568,16 @@ try { formProvider.requestPublishForm(want).then((data) => { console.log('formProvider requestPublishForm success, form ID is : ${JSON.stringify(data)}'); }).catch((error) => { - console.log(`promise error, code: ${error.code}, message: ${error.message})`); + console.error(`promise error, code: ${error.code}, message: ${error.message})`); }); } catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message})`); + console.error(`catch error, code: ${error.code}, message: ${error.message})`); } } }).catch((error) => { - console.log(`promise error, code: ${error.code}, message: ${error.message})`); + console.error(`promise error, code: ${error.code}, message: ${error.message})`); }); } catch (error) { - console.log(`catch error, code: ${error.code}, message: ${error.message})`); + console.error(`catch error, code: ${error.code}, message: ${error.message})`); } ``` diff --git a/en/application-dev/reference/apis/js-apis-appAccount.md b/en/application-dev/reference/apis/js-apis-appAccount.md index 5b2b923deeb737e90cd173b822e65a35b00e741a..8c8b4c4c6e4bf167b513a2956e3a5df8c282fa22 100644 --- a/en/application-dev/reference/apis/js-apis-appAccount.md +++ b/en/application-dev/reference/apis/js-apis-appAccount.md @@ -148,7 +148,6 @@ Creates an app account with custom data. This API uses a promise to return the r | 12300002 | Invalid name or options. | | 12300004 | Account already exists. | | 12300007 | The number of accounts reaches the upper limit. | -| 12400003 | The number of custom data reaches the upper limit. | **Example** @@ -248,7 +247,7 @@ Creates an app account implicitly based on the specified account owner and optio | ID| Error Message| | ------- | ------- | | 12300001 | System service exception. | -| 12300002 | Invalid name or options. | +| 12300002 | Invalid owner or options. | | 12300007 | The number of accounts reaches the upper limit. | | 12300010 | Account service busy. | | 12300113 | Authenticator service not found. | @@ -481,7 +480,6 @@ Checks whether an app can access the data of an account. This API uses an asynch | 12300001 | System service exception. | | 12300002 | Invalid name or bundleName. | | 12300003 | Account not found. | -| 12400001 | Application not found. | **Example** @@ -527,7 +525,6 @@ Checks whether an app can access the data of an account. This API uses a promise | 12300001 | System service exception. | | 12300002 | Invalid name or bundleName. | | 12300003 | Account not found. | -| 12400001 | Application not found. | **Example** @@ -903,7 +900,7 @@ Sets custom data for an app account. This API uses an asynchronous callback to r | ID| Error Message| | ------- | -------| | 12300001 | System service exception. | -| 12300002 | Invalid name or key or value. | +| 12300002 | Invalid name, key, or value. | | 12300003 | Account not found. | | 12400003 | The number of custom data reaches the upper limit. | @@ -950,7 +947,7 @@ Sets custom data for an app account. This API uses a promise to return the resul | ID| Error Message| | ------- | -------| | 12300001 | System service exception. | -| 12300002 | Invalid name or key or value. | +| 12300002 | Invalid name, key, or value. | | 12300003 | Account not found. | | 12400003 | The number of custom data reaches the upper limit. | @@ -1267,7 +1264,6 @@ Subscribes to account information changes of apps. | ------- | ------- | | 12300001 | System service exception. | | 12300002 | Invalid type or owners. | -| 12300011 | Callback has been registered. | | 12400001 | Application not found. | **Example** @@ -1304,7 +1300,6 @@ Unsubscribes from account information changes. | ------- | -------| | 12300001 | System service exception. | | 12300002 | Invalid type. | -| 12300012 | Callback has not been registered. | **Example** @@ -1347,7 +1342,7 @@ Authenticates an app account. This API uses an asynchronous callback to return t | ID| Error Message| | ------- | -------| | 12300001 | System service exception. | -| 12300002 | Invalid name or owner or authType. | +| 12300002 | Invalid name, owner, or authType. | | 12300003 | Account not found. | | 12300010 | Account service busy. | | 12300113 | Authenticator service not found. | @@ -1410,8 +1405,8 @@ Authenticates an app account with customized options. This API uses an asynchron | ID| Error Message| | ------- | -------| | 12300001 | System service exception. | -| 12300002 | Invalid name or owner or authType. | -| 12300003 | Account not exist. | +| 12300002 | Invalid name, owner, authType, or options. | +| 12300003 | Account not found. | | 12300010 | Account service busy. | | 12300113 | Authenticator service not found. | | 12300114 | Authenticator service exception. | @@ -1522,7 +1517,7 @@ Obtains the authorization token of the specified authentication type for an app | ID| Error Message| | ------- | ------- | | 12300001 | System service exception. | -| 12300002 | Invalid name or owner or authType. | +| 12300002 | Invalid name, owner, or authType. | | 12300003 | Account not found. | | 12300107 | AuthType not found. | @@ -1562,7 +1557,7 @@ Sets an authorization token of the specific authentication type for an app accou | ID| Error Message| | ------- | -------| | 12300001 | System service exception. | -| 12300002 | Invalid name or authType or token. | +| 12300002 | Invalid name, authType, or token. | | 12300003 | Account not found. | | 12400004 | The number of token reaches the upper limit. | @@ -1609,7 +1604,7 @@ Sets an authorization token of the specific authentication type for an app accou | ID| Error Message| | ------- | -------| | 12300001 | System service exception. | -| 12300002 | Invalid name or authType or token. | +| 12300002 | Invalid name, authType, or token. | | 12300003 | Account not found. | | 12400004 | The number of token reaches the upper limit. | @@ -1650,7 +1645,7 @@ Deletes the authorization token of the specified authentication type for an app | ID| Error Message| | ------- | ------- | | 12300001 | System service exception. | -| 12300002 | Invalid name or owner or authType or token. | +| 12300002 | Invalid name, owner, authType, or token. | | 12300003 | Account not found. | | 12300107 | AuthType not found. | @@ -1698,7 +1693,7 @@ Deletes the authorization token of the specified authentication type for an app | ID| Error Message| | ------- | ------- | | 12300001 | System service exception. | -| 12300002 | Invalid name or owner or authType or token. | +| 12300002 | Invalid name, owner, authType, or token. | | 12300003 | Account not found. | | 12300107 | AuthType not found. | @@ -1739,7 +1734,7 @@ Sets the visibility of an authorization token to an app. This API uses an asynch | ID| Error Message| | ------- | -------| | 12300001 | System service exception. | -| 12300002 | Invalid name or authType or bundleName. | +| 12300002 | Invalid name, authType, or bundleName. | | 12300003 | Account not found. | | 12300107 | AuthType not found. | | 12400001 | Application not found. | @@ -1789,7 +1784,7 @@ Sets the visibility of an authorization token to an app. This API uses a promise | ID| Error Message| | ------- | -------| | 12300001 | System service exception. | -| 12300002 | Invalid name or authType or bundleName. | +| 12300002 | Invalid name, authType, or bundleName. | | 12300003 | Account not found. | | 12300107 | AuthType not found. | | 12400001 | Application not found. | @@ -1831,10 +1826,9 @@ Checks the visibility of an authorization token of the specified authentication | ID| Error Message| | ------- | -------| | 12300001 | System service exception. | -| 12300002 | Invalid name or authType or bundleName. | +| 12300002 | Invalid name, authType, or bundleName. | | 12300003 | Account not found. | | 12300107 | AuthType not found. | -| 12400001 | Application not found. | **Example** @@ -1879,10 +1873,9 @@ Checks the visibility of an authorization token of the specified authentication | ID| Error Message| | ------- | -------| | 12300001 | System service exception. | -| 12300002 | Invalid name or authType or bundleName. | +| 12300002 | Invalid name, authType, or bundleName. | | 12300003 | Account not found. | | 12300107 | AuthType not found. | -| 12400001 | Application not found. | **Example** @@ -2281,7 +2274,7 @@ Checks whether an app account has specific labels. This API uses an asynchronous | ID| Error Message| | ------- | ------- | | 12300001 | System service exception. | -| 12300002 | Invalid name or owner or labels. | +| 12300002 | Invalid name, owner, or labels. | | 12300003 | Account not found. | | 12300010 | Account service busy. | | 12300113 | Authenticator service not found. | @@ -2331,7 +2324,7 @@ Checks whether an app account has specific labels. This API uses a promise to re | ID| Error Message| | ------- | ------- | | 12300001 | System service exception. | -| 12300002 | Invalid name or owner or labels. | +| 12300002 | Invalid name, owner, or labels. | | 12300003 | Account not found. | | 12300010 | Account service busy. | | 12300113 | Authenticator service not found. | @@ -2594,7 +2587,7 @@ Verifies the user credential. This API uses an asynchronous callback to return t | ID| Error Message| | ------- | -------| | 12300001 | System service exception. | -| 12300002 | Invalid name or owner or options. | +| 12300002 | Invalid name, owner, or options. | | 12300003 | Account not found. | | 12300010 | Account service busy. | | 12300113 | Authenticator service not found. | diff --git a/en/application-dev/reference/apis/js-apis-appControl.md b/en/application-dev/reference/apis/js-apis-appControl.md index 597b3d8e3b9d15b6d18f4f8e57c0ac71563d3236..ffd45bb873f48f0b401ea4b2a163e50f98616f60 100644 --- a/en/application-dev/reference/apis/js-apis-appControl.md +++ b/en/application-dev/reference/apis/js-apis-appControl.md @@ -24,7 +24,7 @@ Sets the disposed status for an application. This API uses a promise to return t **System capability**: SystemCapability.BundleManager.BundleFramework.AppControl -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Parameters** @@ -75,7 +75,7 @@ Sets the disposed status for an application. This API uses an asynchronous callb **System capability**: SystemCapability.BundleManager.BundleFramework.AppControl -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Parameters** @@ -122,7 +122,7 @@ Obtains the disposed status of an application. This API uses a promise to return **System capability**: SystemCapability.BundleManager.BundleFramework.AppControl -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Parameters** @@ -171,7 +171,7 @@ Obtains the disposed status of an application. This API uses an asynchronous cal **System capability**: SystemCapability.BundleManager.BundleFramework.AppControl -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Parameters** @@ -216,7 +216,7 @@ Deletes the disposed status for an application. This API uses a promise to retur **System capability**: SystemCapability.BundleManager.BundleFramework.AppControl -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Parameters** @@ -265,7 +265,7 @@ Deletes the disposed status for an application. This API uses an asynchronous ca **System capability**: SystemCapability.BundleManager.BundleFramework.AppControl -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Parameters** diff --git a/en/application-dev/reference/apis/js-apis-application-abilityManager.md b/en/application-dev/reference/apis/js-apis-application-abilityManager.md index 5edd8883d8f9d294f6f1408821efa95289108123..23bd66e43063c5e2ea38b65d38da68272b041adb 100644 --- a/en/application-dev/reference/apis/js-apis-application-abilityManager.md +++ b/en/application-dev/reference/apis/js-apis-application-abilityManager.md @@ -90,7 +90,7 @@ let config = { abilityManager.updateConfiguration(config).then(() => { console.log('updateConfiguration success'); }).catch((err) => { - console.log('updateConfiguration fail'); + console.error('updateConfiguration fail'); }); ``` @@ -140,6 +140,6 @@ Obtains the ability running information. This API uses a promise to return the r abilityManager.getAbilityRunningInfos().then((data) => { console.log('getAbilityRunningInfos data: ${JSON.stringify(data)}'); }).catch((err) => { - console.log('getAbilityRunningInfos err: ${JSON.stringify(err)}'); + console.error('getAbilityRunningInfos err: ${JSON.stringify(err)}'); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-application-accessibilityExtensionAbility.md b/en/application-dev/reference/apis/js-apis-application-accessibilityExtensionAbility.md index e9327b99666d40cb367e54ec351048af3d384cd3..8ecd4f8bd0057abf3fd5062bae27f10c90d9b060 100644 --- a/en/application-dev/reference/apis/js-apis-application-accessibilityExtensionAbility.md +++ b/en/application-dev/reference/apis/js-apis-application-accessibilityExtensionAbility.md @@ -16,9 +16,9 @@ import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtens **System capability**: SystemCapability.BarrierFree.Accessibility.Core -| Name | Type| Readable| Writable| Description | -| --------- | -------- | ---- | ---- | ------------------------- | -| context | [AccessibilityExtensionContext](js-apis-inner-application-accessibilityExtensionContext.md) | Yes| No| Context of the accessibility extension ability.| +| Name | Type | Readable | Writable | Description | +| ------- | ---------------------------------------- | ---- | ---- | ------------ | +| context | [AccessibilityExtensionContext](js-apis-inner-application-accessibilityExtensionContext.md) | Yes | No | Context of the accessibility extension ability.| ## AccessibilityEvent @@ -28,11 +28,11 @@ Defines an accessibility event. ### Attributes -| Name | Type | Readable | Writable | Description | -| --------- | ---------------------------------------- | ---- | ---- | ---------- | -| eventType | [accessibility.EventType](js-apis-accessibility.md#EventType) \| [accessibility.WindowUpdateType](js-apis-accessibility.md#WindowUpdateType) \| [TouchGuideType](#touchguidetype) \| [GestureType](#gesturetype) \| [PageUpdateType](#pageupdatetype) | Yes | No | Event type. | -| target | [AccessibilityElement](js-apis-inner-application-accessibilityExtensionContext.md#accessibilityelement9) | Yes | No | Target component where the event occurs.| -| timeStamp | number | Yes | No | Timestamp of the event. | +| Name | Type | Readable| Writable| Description | +| --------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------------------------------------ | +| eventType | [accessibility.EventType](js-apis-accessibility.md#EventType) \| [accessibility.WindowUpdateType](js-apis-accessibility.md#WindowUpdateType)\| [TouchGuideType](#touchguidetype) \| [GestureType](#gesturetype) \| [PageUpdateType](#pageupdatetype) | Yes | No | Event type.
**EventType**: accessibility event type.
**WindowUpdateType**: Window update type.
**TouchGuideType**: touch guide event type.
**GestureType**: gesture type.
**PageUpdateType**: page update type, which is not supported currently.| +| target | [AccessibilityElement](js-apis-inner-application-accessibilityExtensionContext.md#accessibilityelement9) | Yes | No | Target component where the event occurs. | +| timeStamp | number | Yes | No | Timestamp of the event. | ## GestureType @@ -40,35 +40,35 @@ Enumerates gesture types. **System capability**: SystemCapability.BarrierFree.Accessibility.Core -| Name | Description | -| ------------- | ------------ | -| left | Left gesture. | -| leftThenRight | Left-then-right gesture.| -| leftThenUp | Left-then-up gesture.| -| leftThenDown | Left-then-down gesture.| -| right | Right gesture. | -| rightThenLeft | Right-then-left gesture.| -| rightThenUp | Right-then-up gesture.| -| rightThenDown | Right-then-down gesture.| -| up | Up gesture. | -| upThenLeft | Up-then-left gesture.| -| upThenRight | Up-then-right gesture.| -| upThenDown | Up-then-down gesture.| -| down | Down gesture. | -| downThenLeft | Down-then-left gesture.| -| downThenRight | Down-then-right gesture.| -| downThenUp | Down-then-up gesture.| +| Name | Description | +| ------------- | ------------------- | +| left | Left gesture. String type. | +| leftThenRight | Left-then-right gesture. String type.| +| leftThenUp | Left-then-up gesture. String type.| +| leftThenDown | Left-then-down gesture. String type.| +| right | Right gesture. String type. | +| rightThenLeft | Right-then-left gesture. String type.| +| rightThenUp | Right-then-up gesture. String type.| +| rightThenDown | Right-then-down gesture. String type.| +| up | Up gesture. String type. | +| upThenLeft | Up-then-left gesture. String type.| +| upThenRight | Up-then-right gesture. String type.| +| upThenDown | Up-then-down gesture. String type.| +| down | Down gesture. String type. | +| downThenLeft | Down-then-left gesture. String type.| +| downThenRight | Down-then-right gesture. String type.| +| downThenUp | Down-then-up gesture. String type.| ## PageUpdateType -Enumerates the page update types. +Enumerates the page update types. This API is not supported currently. **System capability**: SystemCapability.BarrierFree.Accessibility.Core -| Name | Description | -| ----------------- | --------- | -| pageContentUpdate | Update of the page content.| -| pageStateUpdate | Update of the page status.| +| Name | Description | +| ----------------- | ---------------- | +| pageContentUpdate | Update of the page content. String type.| +| pageStateUpdate | Update of the page status. String type.| ## TouchGuideType @@ -76,10 +76,10 @@ Enumerates the touch guide event types. **System capability**: SystemCapability.BarrierFree.Accessibility.Core -| Name | Description | -| ---------- | ------------ | -| touchBegin | Start of touch in touch guide mode.| -| touchEnd | End of touch in touch guide mode.| +| Name | Description | +| ---------- | ------------------- | +| touchBegin | Start of touch in touch guide mode. String type.| +| touchEnd | End of touch in touch guide mode. String type.| ## AccessibilityExtensionAbility.onConnect @@ -127,7 +127,7 @@ Called when an event that matches the specified bundle and event type occurs. In **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory | Description | | ----- | ---------------------------------------- | ---- | --------------- | | event | [AccessibilityEvent](#accessibilityevent) | Yes | Accessibility event. No value is returned.| @@ -154,7 +154,7 @@ Called when a physical key is pressed. In this API, you can determine whether to **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory | Description | | -------- | ---------------------------------------- | ---- | ----------------------- | | keyEvent | [KeyEvent](js-apis-keyevent.md#KeyEvent) | Yes | Key event. If **true** is returned, the key is intercepted.| diff --git a/en/application-dev/reference/apis/js-apis-application-appManager.md b/en/application-dev/reference/apis/js-apis-application-appManager.md index f32952bbbf73311db85ce014fbd4c8892f3b1d56..7b8e75b6bbc6d503f5f0d61409a77ff6d9374658 100644 --- a/en/application-dev/reference/apis/js-apis-application-appManager.md +++ b/en/application-dev/reference/apis/js-apis-application-appManager.md @@ -263,49 +263,6 @@ Registers an observer to listen for the state changes of all applications. console.log('-------- observerCode: ---------', observerCode); ``` -## appManager.registerApplicationStateObserver9+ - -registerApplicationStateObserver(observer: ApplicationStateObserver, bundleNameList: Array\): number; - -Registers an observer to listen for the state changes of a specified application. - -**Required permissions**: ohos.permission.RUNNING_STATE_OBSERVER - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**System API**: This is a system API and cannot be called by third-party applications. - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| observer | [ApplicationStateObserver](js-apis-inner-application-applicationStateObserver.md) | Yes| Numeric code of the observer.| -| bundleNameList | Array | Yes| **bundleName** array of the application. A maximum of 128 bundle names can be passed.| - -**Example** - - ```ts - let applicationStateObserver = { - onForegroundApplicationChanged(appStateData) { - console.log('------------ onForegroundApplicationChanged -----------', appStateData); - }, - onAbilityStateChanged(abilityStateData) { - console.log('------------ onAbilityStateChanged -----------', abilityStateData); - }, - onProcessCreated(processData) { - console.log('------------ onProcessCreated -----------', processData); - }, - onProcessDied(processData) { - console.log('------------ onProcessDied -----------', processData); - }, - onProcessStateChanged(processData) { - console.log('------------ onProcessStateChanged -----------', processData); - } - }; - let bundleNameList = ['bundleName1', 'bundleName2']; - const observerCode = appManager.registerApplicationStateObserver(applicationStateObserver, bundleNameList); - console.log('-------- observerCode: ---------', observerCode); - ``` ## appManager.unregisterApplicationStateObserver8+ unregisterApplicationStateObserver(observerId: number, callback: AsyncCallback\): void; diff --git a/en/application-dev/reference/apis/js-apis-application-configuration.md b/en/application-dev/reference/apis/js-apis-application-configuration.md index 624d5946bdb8988dccc8709701d44ae1c9addd96..a8831b7f3b41a316356f6d7d660594414d5d3d10 100644 --- a/en/application-dev/reference/apis/js-apis-application-configuration.md +++ b/en/application-dev/reference/apis/js-apis-application-configuration.md @@ -33,11 +33,14 @@ export default class EntryAbility extends UIAbility { console.info(`envCallback onConfigurationUpdated success: ${JSON.stringify(config)}`); let language = config.language; let colorMode = config.colorMode; + }, + onMemoryLevel(level){ + console.log('onMemoryLevel level: ${JSON.stringify(level)}'); } }; let applicationContext = this.context.getApplicationContext(); - applicationContext.registerEnvironmentCallback(envCallback); + applicationContext.on('environment',envCallback); windowStage.loadContent('pages/index', (err, data) => { if (err.code) { diff --git a/en/application-dev/reference/apis/js-apis-application-dataShareExtensionAbility.md b/en/application-dev/reference/apis/js-apis-application-dataShareExtensionAbility.md index ee7ba37cdd08795b0ea33e09dc687b7ccd4712bc..0a97689f23cdf69527c61dfc8dfba28e6869badf 100644 --- a/en/application-dev/reference/apis/js-apis-application-dataShareExtensionAbility.md +++ b/en/application-dev/reference/apis/js-apis-application-dataShareExtensionAbility.md @@ -81,7 +81,7 @@ export default class DataShareExtAbility extends DataShareExtensionAbility { console.log('getRdbStore done, data : ${data}'); rdbStore = data; rdbStore.executeSql(DDL_TBL_CREATE, [], function (err) { - console.log('executeSql done, error message : ${err}'); + console.error('executeSql done, error message : ${err}'); }); if (callback) { callback(); diff --git a/en/application-dev/reference/apis/js-apis-application-formBindingData.md b/en/application-dev/reference/apis/js-apis-application-formBindingData.md index c7c5e55ff067afe25c43e57b0ce2491090324101..539d728f614c4c56655eb390e427febf63c16841 100644 --- a/en/application-dev/reference/apis/js-apis-application-formBindingData.md +++ b/en/application-dev/reference/apis/js-apis-application-formBindingData.md @@ -59,6 +59,6 @@ try { }; formBindingData.createFormBindingData(obj); } catch (error) { - console.log('catch error, error: ${JSON.stringify(error)}'); + console.error('catch error, error: ${JSON.stringify(error)}'); } ``` diff --git a/en/application-dev/reference/apis/js-apis-application-formProvider.md b/en/application-dev/reference/apis/js-apis-application-formProvider.md index 81b1711b18d198350e0ee6f759a7587b805cc66c..80f45e11e8d85b07f240b0f036aa4c86b2329b8a 100644 --- a/en/application-dev/reference/apis/js-apis-application-formProvider.md +++ b/en/application-dev/reference/apis/js-apis-application-formProvider.md @@ -36,7 +36,7 @@ Sets the next refresh time for a widget. This API uses an asynchronous callback let formId = '12400633174999288'; formProvider.setFormNextRefreshTime(formId, 5, (error, data) => { if (error.code) { - console.log('formProvider setFormNextRefreshTime, error: ${JSON.stringify(error)}'); + console.error('formProvider setFormNextRefreshTime, error: ${JSON.stringify(error)}'); } }); ``` @@ -71,7 +71,7 @@ Sets the next refresh time for a widget. This API uses a promise to return the r formProvider.setFormNextRefreshTime(formId, 5).then(() => { console.log('formProvider setFormNextRefreshTime success'); }).catch((error) => { - console.log('formProvider setFormNextRefreshTime, error: ${JSON.stringify(error)}'); + console.error('formProvider setFormNextRefreshTime, error: ${JSON.stringify(error)}'); }); ``` @@ -101,7 +101,7 @@ Updates a widget. This API uses an asynchronous callback to return the result. let obj = formBindingData.createFormBindingData({temperature:'22c', time:'22:00'}); formProvider.updateForm(formId, obj, (error, data) => { if (error.code) { - console.log('formProvider updateForm, error: ${JSON.stringify(error)}'); + console.error('formProvider updateForm, error: ${JSON.stringify(error)}'); } }); ``` @@ -138,6 +138,6 @@ Updates a widget. This API uses a promise to return the result. formProvider.updateForm(formId, obj).then(() => { console.log('formProvider updateForm success'); }).catch((error) => { - console.log('formProvider updateForm, error: ${JSON.stringify(error)}'); + console.error('formProvider updateForm, error: ${JSON.stringify(error)}'); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-application-missionManager.md b/en/application-dev/reference/apis/js-apis-application-missionManager.md index c09b0387f8aa1bff0b9f084136ad6ed70859c71f..9cc1ecce166669fa3962ba8a32007f81c43a7af8 100644 --- a/en/application-dev/reference/apis/js-apis-application-missionManager.md +++ b/en/application-dev/reference/apis/js-apis-application-missionManager.md @@ -170,7 +170,7 @@ Obtains the information about a given mission. This API uses an asynchronous cal let allMissions=missionManager.getMissionInfos('',10).catch(function(err){console.log(err);}); missionManager.getMissionInfo('', allMissions[0].missionId, (error, mission) => { if (error.code) { - console.error('getMissionInfo failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfo failed, error.code: ${error.code}, error.message: ${error.message}'); return; } @@ -247,7 +247,7 @@ Obtains information about all missions. This API uses an asynchronous callback t missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -319,7 +319,7 @@ Obtains the snapshot of a given mission. This API uses an asynchronous callback missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -328,7 +328,7 @@ Obtains the snapshot of a given mission. This API uses an asynchronous callback missionManager.getMissionSnapShot('', id, (error, snapshot) => { if (error.code) { - console.error('getMissionSnapShot failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionSnapShot failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('bundleName = ${snapshot.ability.bundleName}'); @@ -382,97 +382,6 @@ Obtains the snapshot of a given mission. This API uses a promise to return the r }); ``` -## missionManager.getLowResolutionMissionSnapShot9+ - -getLowResolutionMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback\): void; - -Obtains the low-resolution snapshot of a given mission. This API uses an asynchronous callback to return the result. - -**Required permissions**: ohos.permission.MANAGE_MISSIONS - -**System capability**: SystemCapability.Ability.AbilityRuntime.Mission - -**System API**: This is a system API and cannot be called by third-party applications. - -**Parameters** - - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | deviceId | string | Yes| Device ID. It is a null string by default for the local device.| - | missionId | number | Yes| Mission ID.| - | callback | AsyncCallback<[MissionSnapshot](js-apis-inner-application-missionSnapshot.md)> | Yes| Callback used to return the snapshot information obtained.| - -**Example** - - ```ts - import missionManager from '@ohos.application.missionManager'; - - missionManager.getMissionInfos('', 10, (error, missions) => { - if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); - return; - } - console.log('size = ${missions.length}'); - console.log('missions = ${JSON.stringify(missions)}'); - let id = missions[0].missionId; - - missionManager.getLowResolutionMissionSnapShot('', id, (error, snapshot) => { - if (error.code) { - console.error('getLowResolutionMissionSnapShot failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); - return; - } - console.log('bundleName = ${snapshot.ability.bundleName}'); - }); - }); - ``` - - -## missionManager.getLowResolutionMissionSnapShot9+ - -getLowResolutionMissionSnapShot(deviceId: string, missionId: number): Promise\; - -Obtains the low-resolution snapshot of a given mission. This API uses a promise to return the result. - -**Required permissions**: ohos.permission.MANAGE_MISSIONS - -**System capability**: SystemCapability.Ability.AbilityRuntime.Mission - -**System API**: This is a system API and cannot be called by third-party applications. - -**Parameters** - - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | deviceId | string | Yes| Device ID. It is a null string by default for the local device.| - | missionId | number | Yes| Mission ID.| - -**Return value** - - | Type| Description| - | -------- | -------- | - | Promise<[MissionSnapshot](js-apis-inner-application-missionSnapshot.md)> | Promise used to return the snapshot information obtained.| - -**Example** - - ```ts - import missionManager from '@ohos.application.missionManager'; - - let allMissions; - missionManager.getMissionInfos('',10).then(function(res){ - allMissions=res; - }).catch(function(error) { - console.error('getMissionInfos fail, error: ${error}'); - }); - console.log('size = ${allMissions.length}'); - console.log('missions = ${JSON.stringify(allMissions)}'); - let id = allMissions[0].missionId; - - let snapshot = missionManager.getLowResolutionMissionSnapShot('', id).catch(function (error){ - console.error('getLowResolutionMissionSnapShot fail, error: ${error}'); - }); - ``` - - ## missionManager.lockMission lockMission(missionId: number, callback: AsyncCallback<void>): void; @@ -499,7 +408,7 @@ Locks a given mission. This API uses an asynchronous callback to return the resu missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -583,7 +492,7 @@ Unlocks a given mission. This API uses an asynchronous callback to return the re missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -671,7 +580,7 @@ Clears a given mission, regardless of whether it is locked. This API uses an asy missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -807,7 +716,7 @@ Switches a given mission to the foreground. This API uses an asynchronous callba missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -848,7 +757,7 @@ Switches a given mission to the foreground, with the startup parameters for the missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); diff --git a/en/application-dev/reference/apis/js-apis-application-want.md b/en/application-dev/reference/apis/js-apis-application-want.md index d5fd64638541acdb567b3d2a04d4bf5933c822f1..65f7fb03e38244ee92c9f94797fa3435072d2f60 100644 --- a/en/application-dev/reference/apis/js-apis-application-want.md +++ b/en/application-dev/reference/apis/js-apis-application-want.md @@ -23,11 +23,10 @@ import Want from '@ohos.application.Want'; | abilityName | string | No | Name of the ability. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can match a specific ability. The value of **abilityName** must be unique in an application.| | uri | string | No | URI information to match. If **uri** is specified in a **Want** object, the **Want** object will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**.| | type | string | No | MIME type, that is, the type of the file to open, for example, **'text/xml'** and **'image/*'**. For details about the MIME type definition, see https://www.iana.org/assignments/media-types/media-types.xhtml?utm_source=ld246.com. | -| flags | number | No | How the **Want** object will be handled. By default, numbers are passed in. For details, see [flags](js-apis-ability-wantConstant.md#wantConstant.Flags).| -| action | string | No | Action to take, such as viewing and sharing application details. In implicit **Want**, you can define this attribute and use it together with **uri** or **parameters** to specify the operation to be performed on the data. For details, see [action](js-apis-app-ability-wantConstant.md#wantConstant.Action). For details about the definition and matching rules of implicit Want, see [Matching Rules of Explicit Want and Implicit Want](application-models/explicit-implicit-want-mappings.md). | -| parameters | {[key: string]: any} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:
- **ohos.aafwk.callerPid**: PID of the caller.
- **ohos.aafwk.param.callerToken**: token of the caller.
- **ohos.aafwk.param.callerUid**: UID in [bundleInfo](js-apis-bundle-BundleInfo.md#bundleinfo-1), that is, the application UID in the bundle information.
- **component.startup.newRules**: whether to enable the new control rule.
- **moduleName**: module name of the caller. No matter what this field is set to, the correct module name will be sent to the peer.
- **ohos.dlp.params.sandbox**: available only for DLP files. | -| entities | Array\ | No | Additional category information (such as browser and video player) of the ability. It is a supplement to the **action** field for implicit Want. and is used to filter ability types. For details, see [entity](js-apis-app-ability-wantConstant.md#wantConstant.Entity). | -| moduleName9+ | string | No | Module to which the ability belongs.| +| flags | number | No | How the **Want** object will be handled. By default, numbers are passed in. For details, see [flags](js-apis-ability-wantConstant.md#wantconstantflags).| +| action | string | No | Action to take, such as viewing and sharing application details. In implicit **Want**, you can define this attribute and use it together with **uri** or **parameters** to specify the operation to be performed on the data. For details, see [action](js-apis-ability-wantConstant.md#wantconstantaction). For details about the definition and matching rules of implicit Want, see [Matching Rules of Explicit Want and Implicit Want](../../application-models/explicit-implicit-want-mappings.md). | +| parameters | {[key: string]: any} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:
- **ohos.aafwk.callerPid**: PID of the caller.
- **ohos.aafwk.param.callerToken**: token of the caller.
- **ohos.aafwk.param.callerUid**: UID in [bundleInfo](js-apis-bundle-BundleInfo.md#bundleinfo), that is, the application UID in the bundle information.
- **component.startup.newRules**: whether to enable the new control rule.
- **moduleName**: module name of the caller. No matter what this field is set to, the correct module name will be sent to the peer.
- **ohos.dlp.params.sandbox**: available only for DLP files. | +| entities | Array\ | No | Additional category information (such as browser and video player) of the ability. It is a supplement to the **action** field for implicit Want. and is used to filter ability types. For details, see [entity](js-apis-ability-wantConstant.md#wantconstantentity). | **Example** @@ -42,7 +41,7 @@ import Want from '@ohos.application.Want'; }; this.context.startAbility(want, (error) => { // Start an ability explicitly. The bundleName, abilityName, and moduleName parameters work together to uniquely identify an ability. - console.log('error.code = ${error.code}'); + console.error('error.code = ${error.code}'); }); ``` @@ -109,12 +108,12 @@ import Want from '@ohos.application.Want'; ``` * File descriptor (FD) ```ts - import fileio from '@ohos.fileio'; + import fs from '@ohos.file.fs'; let fd; try { - fd = fileio.openSync('/data/storage/el2/base/haps/pic.png'); + fd = fs.openSync('/data/storage/el2/base/haps/pic.png').fd; } catch(e) { - console.log('openSync fail: ${JSON.stringify(e)}'); + console.error('openSync fail: ${JSON.stringify(e)}'); } let want = { 'deviceId': '', // An empty deviceId indicates the local device. @@ -127,7 +126,7 @@ import Want from '@ohos.application.Want'; }; this.context.startAbility(want, (error) => { // Start an ability explicitly. The bundleName, abilityName, and moduleName parameters work together to uniquely identify an ability. - console.log('error.code = ${error.code}'); + console.error('error.code = ${error.code}'); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-arkui-drawableDescriptor.md b/en/application-dev/reference/apis/js-apis-arkui-drawableDescriptor.md new file mode 100644 index 0000000000000000000000000000000000000000..7f15532f653340879049904a3b95fbe17576bd71 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-arkui-drawableDescriptor.md @@ -0,0 +1,136 @@ +# @ohos.arkui.drawableDescriptor (DrawableDescriptor) + +The **DrawableDescriptor** module provides APIs for obtaining **pixelMap** objects, including the foreground, background, mask, and layered icons. + +> **NOTE** +> +> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> +> You can preview how this component looks on a real device. The preview is not yet available in the DevEco Studio Previewer. + +## Modules to Import + +```js +import { DrawableDescriptor, LayeredDrawableDescriptor } from '@ohos.arkui.drawableDescriptor'; +``` + +## DrawableDescriptor.constructor +constructor() + +Creates a **DrawableDescriptor** or **LayeredDrawableDescriptor** object. The globalization API [getDrawableDescriptor](js-apis-resource-manager.md##getdrawabledescriptor) or [getDrawableDescriptorByName](js-apis-resource-manager.md##getdrawabledescriptorbyname) is required for object construction. + +**System API**: This is a system API. + +**System capability**: SystemCapability.ArkUI.ArkUI.Full + +### DrawableDescriptor + +Creates a **DrawableDescriptor** object when the passed resource ID or name belongs to a common image. + +### LayeredDrawableDescriptor + +Creates a **LayeredDrawableDescriptor** object when the passed resource ID or name belongs to a JSON file that contains foreground and background resources. + +**Example** +```js +@Entry +@Component +struct Index { + private resManager = getContext().resourceManager + let drawable1 = resManager.getDrawableDescriptor($r('app.media.icon').id) + let drawable2 = resManager.getDrawableDescriptorByName(icon) + let layeredDrawable1 = resManager.getDrawableDescriptor($r('app.media.file').id) + let layeredDrawable1 = resManager.getDrawableDescriptor(file) + } +``` + +## DrawableDescriptor.getPixelMap +getPixelMap(): image.PixelMap; + +Obtains this **pixelMap** object. + +**System capability**: SystemCapability.ArkUI.ArkUI.Full + +**Return value** + +| Type | Description | +| --------------------------------- | ---------------- | +| [image.PixelMap](../apis/js-apis-image.md#pixelmap7) | **pixelMap** object.| + +**Example** + ```js + @State pixmap: PixelMap = drawable1.getPixelMap(); + ``` + +## LayeredDrawableDescriptor.getPixelMap +getPixelMap(): image.PixelMap; + +Obtains the **pixelMap** object where the foreground, background, and mask are blended and cropped. + +**System capability**: SystemCapability.ArkUI.ArkUI.Full + +**Return value** + +| Type | Description | +| --------------------------------- | ---------------- | +| [image.PixelMap](../apis/js-apis-image.md#pixelmap7) | **pixelMap** object.| + +**Example** + ```js + @State pixmap: PixelMap = layeredDrawable1.getPixelMap(); + ``` + +## LayeredDrawableDescriptor.getForeground +getForeground(): DrawableDescriptor; + +Obtains the **DrawableDescriptor** object of the foreground. + +**System capability**: SystemCapability.ArkUI.ArkUI.Full + +**Return value** + +| Type | Description | +| --------------------------------- | ---------------- | +| [DrawableDescriptor](#drawabledescriptor) | **DrawableDescriptor** object.| + +**Example** + ```js + @State drawable: DrawableDescriptor = layeredDrawable1.getForeground(); + ``` + +## LayeredDrawableDescriptor.getBackground +getBackground(): DrawableDescriptor; + +Obtains the **DrawableDescriptor** object of the background. + +**System capability**: SystemCapability.ArkUI.ArkUI.Full + +**Return value** + +| Type | Description | +| --------------------------------- | ---------------- | +| [DrawableDescriptor](#drawabledescriptor) | **DrawableDescriptor** object.| + +**Example** + ```js + @State drawable: DrawableDescriptor = layeredDrawable1.getBackground(); + ``` + +## LayeredDrawableDescriptor.getMask +getMask(): DrawableDescriptor; + +Obtains the **DrawableDescriptor** object of the mask. + +**System capability**: SystemCapability.ArkUI.ArkUI.Full + +**Return value** + +| Type | Description | +| --------------------------------- | ---------------- | +| [DrawableDescriptor](#drawabledescriptor) | **DrawableDescriptor** object.| + +**Example** + ```js + @State drawable: DrawableDescriptor = layeredDrawable1.getMask(); + ``` + \ No newline at end of file diff --git a/en/application-dev/reference/apis/js-apis-audio.md b/en/application-dev/reference/apis/js-apis-audio.md index 4abed77e24d5c6cf16d7fd84ce36cf806d06ce4e..1b41dfffac05d2d5af6c7d080860f89bec12d762 100644 --- a/en/application-dev/reference/apis/js-apis-audio.md +++ b/en/application-dev/reference/apis/js-apis-audio.md @@ -23,9 +23,9 @@ import audio from '@ohos.multimedia.audio'; | Name | Type | Readable | Writable| Description | | --------------------------------------- | ----------| ---- | ---- | ------------------ | -| LOCAL_NETWORK_ID9+ | string | Yes | No | Network ID of the local device.
This is a system API.
**System capability**: SystemCapability.Multimedia.Audio.Device | -| DEFAULT_VOLUME_GROUP_ID9+ | number | Yes | No | Default volume group ID.
**System capability**: SystemCapability.Multimedia.Audio.Volume | -| DEFAULT_INTERRUPT_GROUP_ID9+ | number | Yes | No | Default audio interruption group ID.
**System capability**: SystemCapability.Multimedia.Audio.Interrupt | +| LOCAL_NETWORK_ID9+ | string | Yes | No | Network ID of the local device.
This is a system API.
**System capability**: SystemCapability.Multimedia.Audio.Device | +| DEFAULT_VOLUME_GROUP_ID9+ | number | Yes | No | Default volume group ID.
**System capability**: SystemCapability.Multimedia.Audio.Volume | +| DEFAULT_INTERRUPT_GROUP_ID9+ | number | Yes | No | Default audio interruption group ID.
**System capability**: SystemCapability.Multimedia.Audio.Interrupt | **Example** @@ -690,21 +690,19 @@ Describes the interruption event received by the application when playback is in | forceType | [InterruptForceType](#interruptforcetype9) | Yes | Whether the interruption is taken by the system or to be taken by the application.| | hintType | [InterruptHint](#interrupthint) | Yes | Hint provided along the interruption. | -## VolumeEvent8+ +## VolumeEvent9+ Describes the event received by the application when the volume is changed. -**System API**: This is a system API. - **System capability**: SystemCapability.Multimedia.Audio.Volume | Name | Type | Mandatory | Description | | ---------- | ----------------------------------- | ---- | -------------------------------------------------------- | -| volumeType | [AudioVolumeType](#audiovolumetype) | Yes | Audio stream type. | -| volume | number | Yes | Volume to set. The value range can be obtained by calling **getMinVolume** and **getMaxVolume**.| -| updateUi | boolean | Yes | Whether to show the volume change in UI. | -| volumeGroupId9+ | number | Yes | Volume group ID. It can be used as an input parameter of **getGroupManager**. | -| networkId9+ | string | Yes | Network ID. | +| volumeType | [AudioVolumeType](#audiovolumetype) | Yes | Audio stream type. | +| volume | number | Yes | Volume to set. The value range can be obtained by calling **getMinVolume** and **getMaxVolume**. | +| updateUi | boolean | Yes | Whether to show the volume change in UI. | +| volumeGroupId | number | Yes | Volume group ID. It can be used as an input parameter of **getGroupManager**.
This is a system API. | +| networkId | string | Yes | Network ID.
This is a system API. | ## MicStateChangeEvent9+ @@ -1112,7 +1110,7 @@ Sets the volume for a stream. This API uses an asynchronous callback to return t > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setVolume](#setvolume9) in **AudioVolumeGroupManager**. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setVolume](#setvolume9) in **AudioVolumeGroupManager**. The substitute API is available only for system applications. **Required permissions**: ohos.permission.ACCESS_NOTIFICATION_POLICY @@ -1148,7 +1146,7 @@ Sets the volume for a stream. This API uses a promise to return the result. > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setVolume](#setvolume9) in **AudioVolumeGroupManager**. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setVolume](#setvolume9) in **AudioVolumeGroupManager**. The substitute API is available only for system applications. **Required permissions**: ohos.permission.ACCESS_NOTIFICATION_POLICY @@ -1374,7 +1372,7 @@ Mutes or unmutes a stream. This API uses an asynchronous callback to return the > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [mute](#mute9) in **AudioVolumeGroupManager**. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [mute](#mute9) in **AudioVolumeGroupManager**. The substitute API is available only for system applications. **System capability**: SystemCapability.Multimedia.Audio.Volume @@ -1406,7 +1404,7 @@ Mutes or unmutes a stream. This API uses a promise to return the result. > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [mute](#mute9) in **AudioVolumeGroupManager**. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [mute](#mute9) in **AudioVolumeGroupManager**. The substitute API is available only for system applications. **System capability**: SystemCapability.Multimedia.Audio.Volume @@ -1566,7 +1564,7 @@ Sets the ringer mode. This API uses an asynchronous callback to return the resul > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setRingerMode](#setringermode9) in **AudioVolumeGroupManager**. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setRingerMode](#setringermode9) in **AudioVolumeGroupManager**. The substitute API is available only for system applications. **Required permissions**: ohos.permission.ACCESS_NOTIFICATION_POLICY @@ -1601,7 +1599,8 @@ Sets the ringer mode. This API uses a promise to return the result. > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setRingerMode](#setringermode9) in **AudioVolumeGroupManager**. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [setRingerMode](#setringermode9) in **AudioVolumeGroupManager**. The substitute API is available only for system applications. + **Required permissions**: ohos.permission.ACCESS_NOTIFICATION_POLICY @@ -1763,7 +1762,7 @@ Sets a device to the active state. This API uses an asynchronous callback to ret | Name | Type | Mandatory| Description | | ---------- | ------------------------------------- | ---- | ------------------------ | -| deviceType | [ActiveDeviceType](#activedevicetypedeprecated) | Yes | Active audio device type. | +| deviceType | [ActiveDeviceType](#activedevicetypedeprecated) | Yes | Active audio device type. | | active | boolean | Yes | Active state to set. The value **true** means to set the device to the active state, and **false** means the opposite. | | callback | AsyncCallback<void> | Yes | Callback used to return the result.| @@ -1795,7 +1794,7 @@ Sets a device to the active state. This API uses a promise to return the result. | Name | Type | Mandatory| Description | | ---------- | ------------------------------------- | ---- | ------------------ | -| deviceType | [ActiveDeviceType](#activedevicetypedeprecated) | Yes | Active audio device type. | +| deviceType | [ActiveDeviceType](#activedevicetypedeprecated) | Yes | Active audio device type.| | active | boolean | Yes | Active state to set. The value **true** means to set the device to the active state, and **false** means the opposite. | **Return value** @@ -1829,7 +1828,7 @@ Checks whether a device is active. This API uses an asynchronous callback to ret | Name | Type | Mandatory| Description | | ---------- | ------------------------------------- | ---- | ------------------------ | -| deviceType | [ActiveDeviceType](#activedevicetypedeprecated) | Yes | Active audio device type. | +| deviceType | [ActiveDeviceType](#activedevicetypedeprecated) | Yes | Active audio device type. | | callback | AsyncCallback<boolean> | Yes | Callback used to return the active state of the device.| **Example** @@ -1860,7 +1859,7 @@ Checks whether a device is active. This API uses a promise to return the result. | Name | Type | Mandatory| Description | | ---------- | ------------------------------------- | ---- | ------------------ | -| deviceType | [ActiveDeviceType](#activedevicetypedeprecated) | Yes | Active audio device type. | +| deviceType | [ActiveDeviceType](#activedevicetypedeprecated) | Yes | Active audio device type.| **Return value** @@ -2003,13 +2002,13 @@ audioManager.isMicrophoneMute().then((value) => { }); ``` -### on('volumeChange')(deprecated) +### on('volumeChange')9+ on(type: 'volumeChange', callback: Callback\): void > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [on](#on9) in **AudioVolumeManager**. +> You are advised to use [on('volumeChange')](#onvolumechange9) in **AudioVolumeManager**. Subscribes to system volume change events. @@ -2024,7 +2023,7 @@ Currently, when multiple **AudioManager** instances are used in a single process | Name | Type | Mandatory| Description | | -------- | -------------------------------------- | ---- | ------------------------------------------------------------ | | type | string | Yes | Event type. The value **'volumeChange'** means the system volume change event, which is triggered when a system volume change is detected.| -| callback | Callback<[VolumeEvent](#volumeevent8)> | Yes | Callback used to return the system volume change event. | +| callback | Callback<[VolumeEvent](#volumeevent9)> | Yes | Callback used to return the system volume change event. | **Example** @@ -2073,7 +2072,7 @@ Subscribes to device change events. When a device is connected or disconnected, > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [on](#on9) in **AudioRoutingManager**. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [on('deviceChange')](#ondevicechange9) in **AudioRoutingManager**. **System capability**: SystemCapability.Multimedia.Audio.Device @@ -2103,7 +2102,7 @@ Unsubscribes from device change events. > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [off](#off9) in **AudioRoutingManager**. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [off('deviceChange')](#offdevicechange9) in **AudioRoutingManager**. **System capability**: SystemCapability.Multimedia.Audio.Device @@ -2122,7 +2121,7 @@ audioManager.off('deviceChange', (deviceChanged) => { }); ``` -### on('interrupt')(deprecated) +### on('interrupt') on(type: 'interrupt', interrupt: AudioInterrupt, callback: Callback\): void @@ -2130,10 +2129,6 @@ Subscribes to audio interruption events. When the application's audio is interru Same as [on('audioInterrupt')](#onaudiointerrupt9), this API is used to listen for focus changes. However, this API is used in scenarios without audio streams (no **AudioRenderer** instance is created), such as frequency modulation (FM) and voice wakeup. -> **NOTE** -> -> This API is supported since API version 7 and deprecated since API version 9. - **System capability**: SystemCapability.Multimedia.Audio.Renderer **Parameters** @@ -2164,16 +2159,12 @@ audioManager.on('interrupt', interAudioInterrupt, (InterruptAction) => { }); ``` -### off('interrupt')(deprecated) +### off('interrupt') off(type: 'interrupt', interrupt: AudioInterrupt, callback?: Callback\): void Unsubscribes from audio interruption events. -> **NOTE** -> -> This API is supported since API version 7 and deprecated since API version 9. - **System capability**: SystemCapability.Multimedia.Audio.Renderer **Parameters** @@ -2338,7 +2329,7 @@ Subscribes to system volume change events. This API uses an asynchronous callbac | Name | Type | Mandatory| Description | | -------- | -------------------------------------- | ---- | ------------------------------------------------------------ | | type | string | Yes | Event type. The value **'volumeChange'** means the system volume change event, which is triggered when the system volume changes.| -| callback | Callback<[VolumeEvent](#volumeevent8)> | Yes | Callback used to return the system volume change event. | +| callback | Callback<[VolumeEvent](#volumeevent9)> | Yes | Callback used to return the system volume change event. | **Error codes** @@ -3465,7 +3456,7 @@ audioRoutingManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data) }); ``` -### on9+ +### on('deviceChange')9+ on(type: 'deviceChange', deviceFlag: DeviceFlag, callback: Callback): void @@ -3500,7 +3491,7 @@ audioRoutingManager.on('deviceChange', audio.DeviceFlag.OUTPUT_DEVICES_FLAG, (de }); ``` -### off9+ +### off('deviceChange')9+ off(type: 'deviceChange', callback?: Callback): void @@ -3934,6 +3925,151 @@ async function selectOutputDeviceByFilter(){ } ``` +### getPreferOutputDeviceForRendererInfo10+ + +getPreferOutputDeviceForRendererInfo(rendererInfo: AudioRendererInfo, callback: AsyncCallback<AudioDeviceDescriptors>): void + +Obtains the output device with the highest priority based on the audio renderer information. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Multimedia.Audio.Device + +**Parameters** + +| Name | Type | Mandatory| Description | +| --------------------------- | ------------------------------------------------------------ | ---- | ------------------------- | +| rendererInfo | [AudioRendererInfo](#audiorendererinfo8) | Yes | Audio renderer information. | +| callback | AsyncCallback<[AudioDeviceDescriptors](#audiodevicedescriptors)> | Yes | Callback used to return the information about the output device with the highest priority.| + +**Example** +```js +let rendererInfo = { + content : audio.ContentType.CONTENT_TYPE_MUSIC, + usage : audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags : 0 } + +async function getPreferOutputDevice() { + audioRoutingManager.getPreferOutputDeviceForRendererInfo(rendererInfo, (err, desc) => { + if (err) { + console.error(`Result ERROR: ${err}`); + } else { + console.info(`device descriptor: ${desc}`); + } + }); +} +``` + +### getPreferOutputDeviceForRendererInfo10+ +getPreferOutputDeviceForRendererInfo(rendererInfo: AudioRendererInfo): Promise<AudioDeviceDescriptors> + +Obtains the output device with the highest priority based on the audio renderer information. This API uses a promise to return the result. + +**System capability**: SystemCapability.Multimedia.Audio.Device + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----------------------| ------------------------------------------------------------ | ---- | ------------------------- | +| rendererInfo | [AudioRendererInfo](#audiorendererinfo8) | Yes | Audio renderer information. | + +**Return value** + +| Type | Description | +| --------------------- | --------------------------- | +| Promise<[AudioDeviceDescriptors](#audiodevicedescriptors)> | Promise used to return the information about the output device with the highest priority.| + +**Error codes** + +For details about the error codes, see [Audio Error Codes](../errorcodes/errorcode-audio.md). + +| ID| Error Message| +| ------- | --------------------------------------------| +| 6800101 | if input parameter value error | + +**Example** + +```js +let rendererInfo = { + content : audio.ContentType.CONTENT_TYPE_MUSIC, + usage : audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags : 0 } + +async function getPreferOutputDevice() { + audioRoutingManager.getPreferOutputDeviceForRendererInfo(rendererInfo).then((desc) => { + console.info(`device descriptor: ${desc}`); + }).catch((err) => { + console.error(`Result ERROR: ${err}`); + }) +} +``` + +### on('preferOutputDeviceChangeForRendererInfo')10+ + +on(type: 'preferOutputDeviceChangeForRendererInfo', rendererInfo: AudioRendererInfo, callback: Callback): void + +Subscribes to the change of the output device with the highest priority. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Multimedia.Audio.Device + +**Parameters** + +| Name | Type | Mandatory| Description | +| :------- | :--------------------------------------------------- | :--- | :----------------------------------------- | +| type | string | Yes | Event type. The value **'preferOutputDeviceChangeForRendererInfo'** means the event triggered when the output device with the highest priority changes.| +| rendererInfo | [AudioRendererInfo](#audiorendererinfo8) | Yes | Audio renderer information. | +| callback | Callback<[AudioDeviceDescriptors](#audiodevicedescriptors)\> | Yes | Callback used to return the information about the output device with the highest priority. | + +**Error codes** + +For details about the error codes, see [Audio Error Codes](../errorcodes/errorcode-audio.md). + +| ID| Error Message| +| ------- | --------------------------------------------| +| 6800101 | if input parameter value error | + +**Example** + +```js +let rendererInfo = { + content : audio.ContentType.CONTENT_TYPE_MUSIC, + usage : audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags : 0 } + +audioRoutingManager.on('preferOutputDeviceChangeForRendererInfo', rendererInfo, (desc) => { + console.info(`device descriptor: ${desc}`); +}); +``` + +### off('preferOutputDeviceChangeForRendererInfo')10+ + +off(type: 'preferOutputDeviceChangeForRendererInfo', callback?: Callback): void + +Unsubscribes from the change of the output device with the highest priority. + +**System capability**: SystemCapability.Multimedia.Audio.Device + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------------------- | ---- | ------------------------------------------ | +| type | string | Yes | Event type. The value **'preferOutputDeviceChangeForRendererInfo'** means the event triggered when the output device with the highest priority changes.| +| callback | Callback<[AudioDeviceDescriptors](#audiodevicedescriptors)> | No | Callback used for unsubscription. | + +**Error codes** + +For details about the error codes, see [Audio Error Codes](../errorcodes/errorcode-audio.md). + +| ID| Error Message| +| ------- | --------------------------------------------| +| 6800101 | if input parameter value error | + +**Example** + +```js +audioRoutingManager.off('preferOutputDeviceChangeForRendererInfo', () => { + console.info('Should be no callback.'); +}); +``` + ## AudioRendererChangeInfoArray9+ Defines an **AudioRenderChangeInfo** array, which is read-only. @@ -3946,12 +4082,13 @@ Describes the audio renderer change event. **System capability**: SystemCapability.Multimedia.Audio.Renderer -| Name | Type | Readable | Writable | Description | -| ------------- | ---------------------------------------- | -------- | -------- | ---------------------------------------------------------- | -| streamId | number | Yes | No | Unique ID of an audio stream. | -| clientUid | number | Yes | No | UID of the audio renderer client.
This is a system API. | -| rendererInfo | [AudioRendererInfo](#audiorendererinfo8) | Yes | No | Audio renderer information. | -| rendererState | [AudioState](#audiostate) | Yes | No | Audio state.
This is a system API. | +| Name | Type | Readable | Writable | Description | +| ----------------- | ------------------------------------------------- | -------- | -------- | ---------------------------------------------------------- | +| streamId | number | Yes | No | Unique ID of an audio stream. | +| clientUid | number | Yes | No | UID of the audio renderer client.
This is a system API. | +| rendererInfo | [AudioRendererInfo](#audiorendererinfo8) | Yes | No | Audio renderer information. | +| rendererState | [AudioState](#audiostate) | Yes | No | Audio state.
This is a system API. | +| deviceDescriptors | [AudioDeviceDescriptors](#audiodevicedescriptors) | Yes | No | Audio device description. | **Example** @@ -4003,12 +4140,13 @@ Describes the audio capturer change event. **System capability**: SystemCapability.Multimedia.Audio.Capturer -| Name | Type | Readable | Writable | Description | -| ------------- | ---------------------------------------- | -------- | -------- | ---------------------------------------------------------- | -| streamId | number | Yes | No | Unique ID of an audio stream. | -| clientUid | number | Yes | No | UID of the audio capturer client.
This is a system API. | -| capturerInfo | [AudioCapturerInfo](#audiocapturerinfo8) | Yes | No | Audio capturer information. | -| capturerState | [AudioState](#audiostate) | Yes | No | Audio state.
This is a system API. | +| Name | Type | Readable | Writable | Description | +| ----------------- | ------------------------------------------------- | -------- | -------- | ---------------------------------------------------------- | +| streamId | number | Yes | No | Unique ID of an audio stream. | +| clientUid | number | Yes | No | UID of the audio capturer client.
This is a system API. | +| capturerInfo | [AudioCapturerInfo](#audiocapturerinfo8) | Yes | No | Audio capturer information. | +| capturerState | [AudioState](#audiostate) | Yes | No | Audio state.
This is a system API. | +| deviceDescriptors | [AudioDeviceDescriptors](#audiodevicedescriptors) | Yes | No | Audio device description. | **Example** @@ -4102,7 +4240,7 @@ Implements filter criteria. Before calling **selectOutputDeviceByFilter**, you m | Name | Type | Mandatory | Description | | ------------ | ---------------------------------------- | --------- | ------------------------------------------------------------ | -| uid | number | Yes | Application ID.
**System capability**: SystemCapability.Multimedia.Audio.Core | +| uid | number | No | Application ID.
**System capability**: SystemCapability.Multimedia.Audio.Core | | rendererInfo | [AudioRendererInfo](#audiorendererinfo8) | No | Audio renderer information.
**System capability**: SystemCapability.Multimedia.Audio.Renderer | | rendererId | number | No | Unique ID of an audio stream.
**System capability**: SystemCapability.Multimedia.Audio.Renderer | @@ -4586,15 +4724,15 @@ let filePath = path + '/StarWars10s-2C-48000-4SW.wav'; let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); let stat = await fs.stat(path); let buf = new ArrayBuffer(bufferSize); -let len = stat.size % this.bufferSize == 0 ? Math.floor(stat.size / this.bufferSize) : Math.floor(stat.size / this.bufferSize + 1); +let len = stat.size % bufferSize == 0 ? Math.floor(stat.size / bufferSize) : Math.floor(stat.size / bufferSize + 1); for (let i = 0;i < len; i++) { let options = { - offset: i * this.bufferSize, - length: this.bufferSize + offset: i * bufferSize, + length: bufferSize } let readsize = await fs.read(file.fd, buf, options) let writeSize = await new Promise((resolve,reject)=>{ - this.audioRenderer.write(buf,(err,writeSize)=>{ + audioRenderer.write(buf,(err,writeSize)=>{ if(err){ reject(err) }else{ @@ -4641,15 +4779,15 @@ let filePath = path + '/StarWars10s-2C-48000-4SW.wav'; let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); let stat = await fs.stat(path); let buf = new ArrayBuffer(bufferSize); -let len = stat.size % this.bufferSize == 0 ? Math.floor(stat.size / this.bufferSize) : Math.floor(stat.size / this.bufferSize + 1); +let len = stat.size % bufferSize == 0 ? Math.floor(stat.size / bufferSize) : Math.floor(stat.size / bufferSize + 1); for (let i = 0;i < len; i++) { let options = { - offset: i * this.bufferSize, - length: this.bufferSize + offset: i * bufferSize, + length: bufferSize } let readsize = await fs.read(file.fd, buf, options) try{ - let writeSize = await this.audioRenderer.write(buf); + let writeSize = await audioRenderer.write(buf); } catch(err) { console.error(`audioRenderer.write err: ${err}`); } @@ -4986,18 +5124,18 @@ audioRenderer.setVolume(0.5, (err, data)=>{ on(type: 'audioInterrupt', callback: Callback\): void -Subscribes to audio interruption events. This API uses a callback to get interrupt events. +Subscribes to audio interruption events. This API uses a callback to obtain interrupt events. -Same as [on('interrupt')](#oninterruptdeprecated), this API has obtained the focus before **start**, **pause**, or **stop** of **AudioRenderer** is called. Therefore, you do not need to request the focus. +Same as [on('interrupt')](#oninterrupt), this API is used to listen for focus changes. The **AudioRenderer** instance proactively gains the focus when the **start** event occurs and releases the focus when the **pause** or **stop** event occurs. Therefore, you do not need to request to gain or release the focus. **System capability**: SystemCapability.Multimedia.Audio.Interrupt **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------------------------------------------- | --------- | ------------------------------------------------------------ | -| type | string | Yes | Event type. The value **'audioInterrupt'** means the audio interruption event, which is triggered when audio playback is interrupted. | -| callback | Callback<[InterruptEvent](#interruptevent9)> | Yes | Callback used to return the audio interruption event. | +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------------- | --------- | ------------------------------------------------------------ | +| type | string | Yes | Event type. The value **'audioInterrupt'** means the audio interruption event, which is triggered when audio rendering is interrupted. | +| callback | Callback\<[InterruptEvent](#interruptevent9)\> | Yes | Callback used to return the audio interruption event. | **Error codes** @@ -5010,50 +5148,68 @@ For details about the error codes, see [Audio Error Codes](../errorcodes/errorco **Example** ```js -let isPlay; -let started; +let isPlaying; // An identifier specifying whether rendering is in progress. +let isDucked; // An identifier specifying whether the audio volume is reduced. onAudioInterrupt(); async function onAudioInterrupt(){ audioRenderer.on('audioInterrupt', async(interruptEvent) => { if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_FORCE) { + // The system forcibly interrupts audio rendering. The application must update the status and displayed content accordingly. switch (interruptEvent.hintType) { case audio.InterruptHint.INTERRUPT_HINT_PAUSE: - console.info('Force paused. Stop writing'); - isPlay = false; + // The audio stream has been paused and temporarily loses the focus. It will receive the interruptEvent corresponding to resume when it is able to regain the focus. + console.info('Force paused. Update playing status and stop writing'); + isPlaying = false; // A simplified processing indicating several operations for switching the application to the paused state. break; case audio.InterruptHint.INTERRUPT_HINT_STOP: - console.info('Force stopped. Stop writing'); - isPlay = false; + // The audio stream has been stopped and permanently loses the focus. The user must manually trigger the operation to resume rendering. + console.info('Force stopped. Update playing status and stop writing'); + isPlaying = false; // A simplified processing indicating several operations for switching the application to the paused state. + break; + case audio.InterruptHint.INTERRUPT_HINT_DUCK: + // The audio stream is rendered at a reduced volume. + console.info('Force ducked. Update volume status'); + isDucked = true; // A simplified processing indicating several operations for updating the volume status. + break; + case audio.InterruptHint.INTERRUPT_HINT_UNDUCK: + // The audio stream is rendered at the normal volume. + console.info('Force ducked. Update volume status'); + isDucked = false; // A simplified processing indicating several operations for updating the volume status. + break; + default: + console.info('Invalid interruptEvent'); break; } } else if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_SHARE) { + // The application can choose to take action or ignore. switch (interruptEvent.hintType) { case audio.InterruptHint.INTERRUPT_HINT_RESUME: + // It is recommended that the application continue rendering. (The audio stream has been forcibly paused and temporarily lost the focus. It can resume rendering now.) console.info('Resume force paused renderer or ignore'); - await audioRenderer.start().then(async function () { - console.info('AudioInterruptMusic: renderInstant started :SUCCESS '); - started = true; - }).catch((err) => { - console.error(`AudioInterruptMusic: renderInstant start :ERROR : ${err}`); - started = false; - }); - if (started) { - isPlay = true; - console.info(`AudioInterruptMusic Renderer started : isPlay : ${isPlay}`); - } else { - console.error('AudioInterruptMusic Renderer start failed'); - } + // To continue rendering, the application must perform the required operations. break; case audio.InterruptHint.INTERRUPT_HINT_PAUSE: + // It is recommended that the application pause rendering. console.info('Choose to pause or ignore'); - if (isPlay == true) { - isPlay == false; - console.info('AudioInterruptMusic: Media PAUSE : TRUE'); - } else { - isPlay = true; - console.info('AudioInterruptMusic: Media PLAY : TRUE'); - } + // To pause rendering, the application must perform the required operations. + break; + case audio.InterruptHint.INTERRUPT_HINT_STOP: + // It is recommended that the application stop rendering. + console.info('Choose to stop or ignore'); + // To stop rendering, the application must perform the required operations. + break; + case audio.InterruptHint.INTERRUPT_HINT_DUCK: + // It is recommended that the application reduce the volume for rendering. + console.info('Choose to duck or ignore'); + // To decrease the volume for rendering, the application must perform the required operations. + break; + case audio.InterruptHint.INTERRUPT_HINT_UNDUCK: + // It is recommended that the application resume rendering at the normal volume. + console.info('Choose to unduck or ignore'); + // To resume rendering at the normal volume, the application must perform the required operations. + break; + default: break; } } @@ -5729,6 +5885,84 @@ audioCapturer.getBufferSize().then((data) => { ``` +### on('audioInterrupt')10+ + +on(type: 'audioInterrupt', callback: Callback\): void + +Subscribes to audio interruption events. This API uses a callback to get interrupt events. + +Same as [on('interrupt')](#oninterrupt), this API is used to listen for focus changes. The **AudioCapturer** instance proactively gains the focus when the **start** event occurs and releases the focus when the **pause** or **stop** event occurs. Therefore, you do not need to request to gain or release the focus. + +**System capability**: SystemCapability.Multimedia.Audio.Interrupt + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------------- | --------- | ------------------------------------------------------------ | +| type | string | Yes | Event type. The value **'audioInterrupt'** means the audio interruption event, which is triggered when audio capturing is interrupted. | +| callback | Callback\<[InterruptEvent](#interruptevent9)\> | Yes | Callback used to return the audio interruption event. | + +**Error codes** + +For details about the error codes, see [Audio Error Codes](../errorcodes/errorcode-audio.md). + +| ID | Error Message | +| ------- | ------------------------------ | +| 6800101 | if input parameter value error | + +**Example** + +```js +let isCapturing; // An identifier specifying whether capturing is in progress. +onAudioInterrupt(); + +async function onAudioInterrupt(){ + audioCapturer.on('audioInterrupt', async(interruptEvent) => { + if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_FORCE) { + // The system forcibly interrupts audio capturing. The application must update the status and displayed content accordingly. + switch (interruptEvent.hintType) { + case audio.InterruptHint.INTERRUPT_HINT_PAUSE: + // The audio stream has been paused and temporarily loses the focus. It will receive the interruptEvent corresponding to resume when it is able to regain the focus. + console.info('Force paused. Update capturing status and stop reading'); + isCapturing = false; // A simplified processing indicating several operations for switching the application to the paused state. + break; + case audio.InterruptHint.INTERRUPT_HINT_STOP: + // The audio stream has been stopped and permanently loses the focus. The user must manually trigger the operation to resume capturing. + console.info('Force stopped. Update capturing status and stop reading'); + isCapturing = false; // A simplified processing indicating several operations for switching the application to the paused state. + break; + default: + console.info('Invalid interruptEvent'); + break; + } + } else if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_SHARE) { + // The application can choose to take action or ignore. + switch (interruptEvent.hintType) { + case audio.InterruptHint.INTERRUPT_HINT_RESUME: + // It is recommended that the application continue capturing. (The audio stream has been forcibly paused and temporarily lost the focus. It can resume capturing now.) + console.info('Resume force paused renderer or ignore'); + // To continue capturing, the application must perform the required operations. + break; + case audio.InterruptHint.INTERRUPT_HINT_PAUSE: + // It is recommended that the application pause capturing. + console.info('Choose to pause or ignore'); + // To pause capturing, the application must perform the required operations. + break; + case audio.InterruptHint.INTERRUPT_HINT_STOP: + // It is recommended that the application stop capturing. + console.info('Choose to stop or ignore'); + // To stop capturing, the application must perform the required operations. + break; + default: + break; + } + } + }); +} + +``` + + ### on('markReach')8+ on(type: "markReach", frame: number, callback: Callback<number>): void @@ -6185,7 +6419,7 @@ Describes the callback invoked for audio interruption or focus gain events. > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [InterruptEvent](#interruptevent9). **System capability**: SystemCapability.Multimedia.Audio.Renderer diff --git a/en/application-dev/reference/apis/js-apis-avsession.md b/en/application-dev/reference/apis/js-apis-avsession.md index 86fc2ceeebebd248a2e51f6454ea74dbc2f80602..b89eb42bc8793b9d28f1682ab87b1ac9f157c14d 100644 --- a/en/application-dev/reference/apis/js-apis-avsession.md +++ b/en/application-dev/reference/apis/js-apis-avsession.md @@ -2,7 +2,7 @@ The **avSession** module provides APIs for media playback control so that applications can access the system's Media Controller. -This module provides the following common features related to media sessions: +This module provides the following typical features related to media sessions: - [AVSession](#avsession): used to set session metadata, playback state information, and more. - [AVSessionController](#avsessioncontroller): used to obtain session IDs, send commands and events to sessions, and obtain the session metadata and playback state information. @@ -26,6 +26,8 @@ Creates a media session. This API uses a promise to return the result. An abilit **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name| Type | Mandatory| Description | @@ -41,8 +43,8 @@ Creates a media session. This API uses a promise to return the result. An abilit | --------------------------------- | ------------------------------------------------------------ | | Promise<[AVSession](#avsession)\> | Promise used to return the media session obtained, which can be used to obtain the session ID, set the metadata and playback state information, and send key events.| - **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -74,6 +76,8 @@ Creates a media session. This API uses an asynchronous callback to return the re **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -84,6 +88,7 @@ Creates a media session. This API uses an asynchronous callback to return the re | callback | AsyncCallback<[AVSession](#avsession)\> | Yes | Callback used to return the media session obtained, which can be used to obtain the session ID, set the metadata and playback state information, and send key events.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -128,6 +133,7 @@ Obtains the descriptors of all sessions. This API uses a promise to return the r | Promise\\>\> | Promise used to return an array of **AVSessionDescriptor** objects, each of which is read only.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -155,7 +161,7 @@ getAllSessionDescriptors(callback: AsyncCallback\\>\> | Yes | Callback used to return an array of **AVSessionDescriptor** objects, each of which is read only.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -191,6 +198,101 @@ avSession.getAllSessionDescriptors(function (err, descriptors) { }); ``` +## avSession.getHistoricalSessionDescriptors10+ + +getHistoricalSessionDescriptors(maxSize?: number): Promise\>> + +Obtains the descriptors of all sessions. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.MANAGE_MEDIA_RESOURCES + +**System capability**: SystemCapability.Multimedia.AVSession.Manager + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------ | ---- | -----------------------------------------------------------------| +| maxSize | number | No | Maximum number of descriptors to obtain. The value ranges from 0 to 10. If this parameter is left blank, the default value **3** is used.| + +**Return value** + +| Type | Description | +| --------------------------------------------------------------------------- | -------------------------------------- | +| Promise\\>\> | Promise used to return an array of **AVSessionDescriptor** objects, each of which is read only.| + +**Error codes** + +For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 6600101 | Session service exception. | + +**Example** + +```js +avSession.getHistoricalSessionDescriptors().then((descriptors) => { + console.info(`getHistoricalSessionDescriptors : SUCCESS : descriptors.length : ${descriptors.length}`); + if(descriptors.length > 0 ){ + console.info(`getHistoricalSessionDescriptors : SUCCESS : descriptors[0].isActive : ${descriptors[0].isActive}`); + console.info(`getHistoricalSessionDescriptors : SUCCESS : descriptors[0].type : ${descriptors[0].type}`); + console.info(`getHistoricalSessionDescriptors : SUCCESS : descriptors[0].sessionTag : ${descriptors[0].sessionTag}`); + console.info(`getHistoricalSessionDescriptors : SUCCESS : descriptors[0].sessionId : ${descriptors[0].sessionId}`); + console.info(`getHistoricalSessionDescriptors : SUCCESS : descriptors[0].elementName.bundleName : ${descriptors[0].elementName.bundleName}`); + } +}).catch((err) => { + console.info(`getHistoricalSessionDescriptors BusinessError: code: ${err.code}, message: ${err.message}`); +}); +``` + +## avSession.getHistoricalSessionDescriptors10+ + +getHistoricalSessionDescriptors(maxSize: number, callback: AsyncCallback\>>): void + +Obtains the descriptors of all sessions. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.MANAGE_MEDIA_RESOURCES + +**System capability**: SystemCapability.Multimedia.AVSession.Manager + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------------------------------------ | ---- | -----------------------------------------------------------------| +| maxSize | number | Yes | Maximum number of descriptors to obtain. The value ranges from 0 to 10. If this parameter is left blank, the default value **3** is used.| +| callback | AsyncCallback\>\> | Yes | Callback used to return an array of **AVSessionDescriptor** objects, each of which is read only. | + +**Error codes** + +For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 6600101 |Session service exception. | + +**Example** + +```js +avSession.getHistoricalSessionDescriptors(1, function (err, descriptors) { + if (err) { + console.info(`getHistoricalSessionDescriptors BusinessError: code: ${err.code}, message: ${err.message}`); + } else { + console.info(`getHistoricalSessionDescriptors : SUCCESS : descriptors.length : ${descriptors.length}`); + if(descriptors.length > 0 ){ + console.info(`getHistoricalSessionDescriptors : SUCCESS : descriptors[0].isActive : ${descriptors[0].isActive}`); + console.info(`getHistoricalSessionDescriptors : SUCCESS : descriptors[0].type : ${descriptors[0].type}`); + console.info(`getHistoricalSessionDescriptors : SUCCESS : descriptors[0].sessionTag : ${descriptors[0].sessionTag}`); + console.info(`getHistoricalSessionDescriptors : SUCCESS : descriptors[0].sessionId : ${descriptors[0].sessionId}`); + console.info(`getHistoricalSessionDescriptors : SUCCESS : descriptors[0].elementName.bundleName : ${descriptors[0].elementName.bundleName}`); + } + } +}); +``` + ## avSession.createController createController(sessionId: string): Promise\ @@ -216,6 +318,7 @@ Creates a session controller based on the session ID. Multiple session controlle | Promise<[AVSessionController](#avsessioncontroller)\> | Promise used to return the session controller created, which can be used to obtain the session ID,
send commands and events to sessions, and obtain metadata and playback state information.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -268,6 +371,7 @@ Creates a session controller based on the session ID. Multiple session controlle | callback | AsyncCallback<[AVSessionController](#avsessioncontroller)\> | Yes | Callback used to return the session controller created, which can be used to obtain the session ID,
send commands and events to sessions, and obtain metadata and playback state information.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -327,9 +431,10 @@ Before calling this API, import the **ohos.multimedia.audio** module to obtain t | Type | Description | | -------------- | ----------------------------- | -| Promise | Promise used to return the result. If the cast is successful, no value is returned; otherwise, an error object is returned.| +| Promise | Promise used to return the result. If the casting is successful, no value is returned; otherwise, an error object is returned.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -382,6 +487,7 @@ Before calling this API, import the **ohos.multimedia.audio** module to obtain t | callback | AsyncCallback | Yes | Callback used to return the result. If the casting is successful, **err** is **undefined**; otherwise, **err** is an error object. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -433,6 +539,7 @@ Subscribes to session creation, session destruction, and top session change even | callback | (session: [AVSessionDescriptor](#avsessiondescriptor)) => void | Yes | Callback used to report the session descriptor. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -478,9 +585,10 @@ Unsubscribes from session creation, session destruction, and top session change | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | type | string | Yes | Event type.
- **'sessionCreate'**: session creation event, which is reported when a session is created.
- **'sessionDestroy'**: session destruction event, which is reported when a session is destroyed.
- **'topSessionChange'**: top session change event, which is reported when the top session is changed.| -| callback | (session: [AVSessionDescriptor](#avsessiondescriptor)) => void | No | Callback used for unsubscription. If the unsubscription is successful, **err** is **undefined**; otherwise, **err** is an error object.
The **session** parameter in the callback describes a media session. The callback parameter is optional. If it is not specified, the specified event is no longer listened for all sessions. | +| callback | (session: [AVSessionDescriptor](#avsessiondescriptor)) => void | No | Callback used for unsubscription. If the unsubscription is successful, **err** is **undefined**; otherwise, **err** is an error object.
The **session** parameter in the callback describes a media session. The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -503,6 +611,8 @@ Subscribes to session service death events. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -511,6 +621,7 @@ Subscribes to session service death events. | callback | callback: () => void | Yes | Callback used for subscription. If the subscription is successful, **err** is **undefined**; otherwise, **err** is an error object. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -533,14 +644,17 @@ Unsubscribes from session service death events. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory | Description | | ------ | ---------------------- | ---- | ------------------------------------------------------- | | type | string | Yes | Event type. The event **'sessionServiceDie'** is reported when the session service dies.| -| callback | callback: () => void | No | Callback used for unsubscription. If the unsubscription is successful, **err** is **undefined**; otherwise, **err** is an error object.
The callback parameter is optional. If it is not specified, the specified event is no longer listened for all sessions. | +| callback | callback: () => void | No | Callback used for unsubscription. If the unsubscription is successful, **err** is **undefined**; otherwise, **err** is an error object.
The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -578,6 +692,7 @@ Sends a system key event to the top session. This API uses a promise to return t | Promise | Promise used to return the result. If the event is sent, no value is returned; otherwise, an error object is returned.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -620,6 +735,7 @@ Sends a system key event to the top session. This API uses an asynchronous callb | callback | AsyncCallback | Yes | Callback used to return the result. If the event is sent, **err** is **undefined**; otherwise, **err** is an error object.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -667,6 +783,7 @@ Sends a system control command to the top session. This API uses a promise to re | Promise | Promise used to return the result. If the command is sent, no value is returned; otherwise, an error object is returned.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -721,6 +838,7 @@ Sends a system control command to the top session. This API uses an asynchronous | callback | AsyncCallback | Yes | Callback used to return the result. If the command is sent, **err** is **undefined**; otherwise, **err** is an error object.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -765,6 +883,8 @@ An **AVSession** object is created by calling [avSession.createAVSession](#avses **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + | Name | Type | Readable| Writable| Description | | :-------- | :----- | :--- | :--- | :---------------------------- | @@ -784,6 +904,8 @@ Sets session metadata. This API uses a promise to return the result. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name| Type | Mandatory| Description | @@ -797,6 +919,7 @@ Sets session metadata. This API uses a promise to return the result. | Promise | Promise used to return the result. If the setting is successful, no value is returned; otherwise, an error object is returned.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -838,6 +961,8 @@ Sets session metadata. This API uses an asynchronous callback to return the resu **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -846,6 +971,7 @@ Sets session metadata. This API uses an asynchronous callback to return the resu | callback | AsyncCallback | Yes | Callback used to return the result. If the setting is successful, **err** is **undefined**; otherwise, **err** is an error object.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -889,6 +1015,8 @@ Sets information related to the session playback state. This API uses a promise **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name| Type | Mandatory| Description | @@ -902,6 +1030,7 @@ Sets information related to the session playback state. This API uses a promise | Promise | Promise used to return the result. If the setting is successful, no value is returned; otherwise, an error object is returned.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -935,6 +1064,8 @@ Sets information related to the session playback state. This API uses an asynchr **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -943,6 +1074,7 @@ Sets information related to the session playback state. This API uses an asynchr | callback | AsyncCallback | Yes | Callback used to return the result. If the setting is successful, **err** is **undefined**; otherwise, **err** is an error object. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -970,6 +1102,220 @@ session.setAVPlaybackState(PlaybackState, function (err) { }); ``` +### setAVQueueItems10+ + +setAVQueueItems(items: Array\): Promise + +Sets a playlist. This API uses a promise to return the result. + +**System capability**: SystemCapability.Multimedia.AVSession.Core + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------ | ------------------------------------ | ---- | ---------------------------------- | +| items | Array<[AVQueueItem](#avqueueitem10)\> | Yes | Playlist to set.| + +**Return value** + +| Type | Description | +| -------------- | ----------------------------- | +| Promise | Promise used to return the result. If the setting is successful, no value is returned; otherwise, an error object is returned.| + +**Error codes** + +For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 6600101 | Session service exception. | +| 6600102 | The session does not exist. | + +**Example** + +```js +let queueItemDescription_1 = { + mediaId: '001', + title: 'music_name', + subtitle: 'music_sub_name', + description: 'music_description', + icon: PIXELMAP_OBJECT, + iconUri: 'http://www.icon.uri.com', + extras: {'extras':'any'} +}; +let queueItem_1 = { + itemId: 1, + description: queueItemDescription_1 +}; +let queueItemDescription_2 = { + mediaId: '002', + title: 'music_name', + subtitle: 'music_sub_name', + description: 'music_description', + icon: PIXELMAP_OBJECT, + iconUri: 'http://www.icon.uri.com', + extras: {'extras':'any'} +}; +let queueItem_2 = { + itemId: 2, + description: queueItemDescription_2 +}; +let queueItemsArray = [queueItem_1, queueItem_2]; +session.setAVQueueItems(queueItemsArray).then(() => { + console.info('SetAVQueueItems successfully'); +}).catch((err) => { + console.info(`SetAVQueueItems BusinessError: code: ${err.code}, message: ${err.message}`); +}); +``` + +### setAVQueueItems10+ + +setAVQueueItems(items: Array\, callback: AsyncCallback): void + +Sets a playlist. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Multimedia.AVSession.Core + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------ | ---- | ----------------------------------------------------------- | +| items | Array<[AVQueueItem](#avqueueitem10)\> | Yes | Playlist to set. | +| callback | AsyncCallback | Yes | Callback used to return the result. If the setting is successful, **err** is **undefined**; otherwise, **err** is an error object.| + +**Error codes** + +For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 6600101 | Session service exception. | +| 6600102 | The session does not exist. | + +**Example** + +```js +let queueItemDescription_1 = { + mediaId: '001', + title: 'music_name', + subtitle: 'music_sub_name', + description: 'music_description', + icon: PIXELMAP_OBJECT, + iconUri: 'http://www.icon.uri.com', + extras: {'extras':'any'} +}; +let queueItem_1 = { + itemId: 1, + description: queueItemDescription_1 +}; +let queueItemDescription_2 = { + mediaId: '002', + title: 'music_name', + subtitle: 'music_sub_name', + description: 'music_description', + icon: PIXELMAP_OBJECT, + iconUri: 'http://www.icon.uri.com', + extras: {'extras':'any'} +}; +let queueItem_2 = { + itemId: 2, + description: queueItemDescription_2 +}; +let queueItemsArray = [queueItem_1, queueItem_2]; +session.setAVQueueItems(queueItemsArray, function (err) { + if (err) { + console.info(`SetAVQueueItems BusinessError: code: ${err.code}, message: ${err.message}`); + } else { + console.info('SetAVQueueItems successfully'); + } +}); +``` + +### setAVQueueTitle10+ + +setAVQueueTitle(title: string): Promise\ + +Sets a name for the playlist. This API uses a promise to return the result. + +**System capability**: SystemCapability.Multimedia.AVSession.Core + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------ | ------ | ---- | -------------- | +| title | string | Yes | Name of the playlist.| + +**Return value** + +| Type | Description | +| -------------- | ----------------------------- | +| Promise | Promise used to return the result. If the setting is successful, no value is returned; otherwise, an error object is returned.| + +**Error codes** + +For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 6600101 | Session service exception. | +| 6600102 | The session does not exist. | + +**Example** + +```js +let queueTitle = 'QUEUE_TITLE'; +session.setAVQueueTitle(queueTitle).then(() => { + console.info('SetAVQueueTitle successfully'); +}).catch((err) => { + console.info(`SetAVQueueTitle BusinessError: code: ${err.code}, message: ${err.message}`); +}); +``` + +### setAVQueueTitle10+ + +setAVQueueTitle(title: string, callback: AsyncCallback\): void + +Sets a name for the playlist. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Multimedia.AVSession.Core + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------- | ---- | ----------------------------------------------------------- | +| title | string | Yes | Name of the playlist. | +| callback | AsyncCallback | Yes | Callback used to return the result. If the setting is successful, **err** is **undefined**; otherwise, **err** is an error object.| + +**Error codes** + +For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 6600101 | Session service exception. | +| 6600102 | The session does not exist. | + +**Example** + +```js +let queueTitle = 'QUEUE_TITLE'; +session.setAVQueueTitle(queueTitle, function (err) { + if (err) { + console.info(`SetAVQueueTitle BusinessError: code: ${err.code}, message: ${err.message}`); + } else { + console.info('SetAVQueueTitle successfully'); + } +}); +``` + ### setLaunchAbility setLaunchAbility(ability: WantAgent): Promise\ @@ -978,6 +1324,8 @@ Sets a launcher ability. This API uses a promise to return the result. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -991,6 +1339,7 @@ Sets a launcher ability. This API uses a promise to return the result. | Promise | Promise used to return the result. If the setting is successful, no value is returned; otherwise, an error object is returned.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -1048,6 +1397,8 @@ Sets a launcher ability. This API uses an asynchronous callback to return the re **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -1056,6 +1407,7 @@ Sets a launcher ability. This API uses an asynchronous callback to return the re | callback | AsyncCallback | Yes | Callback used to return the result. If the setting is successful, **err** is **undefined**; otherwise, **err** is an error object.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -1107,21 +1459,31 @@ wantAgent.getWantAgent(wantAgentInfo).then((agent) => { }); ``` -### getController +### dispatchSessionEvent10+ -getController(): Promise\ +dispatchSessionEvent(event: string, args: {[key: string]: Object}): Promise\ -Obtains the controller corresponding to this session. This API uses a promise to return the result. +Dispatches a custom event in the session, including the event name and event content in key-value pair format. This API uses a promise to return the result. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | --------------------------------------------- | ---- | ----------------------------------------------------------- | +| event | string | Yes | Name of the session event.| +| args | {[key: string]: any} | Yes | Event content in key-value pair format.| + **Return value** -| Type | Description | -| ---------------------------------------------------- | ----------------------------- | -| Promise<[AVSessionController](#avsessioncontroller)> | Promise used to return the session controller.| +| Type | Description | +| -------------- | ----------------------------- | +| Promise | Promise used to return the result. If the setting is successful, no value is returned; otherwise, an error object is returned.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -1132,7 +1494,85 @@ For details about the error codes, see [AVSession Management Error Codes](../err **Example** ```js -let controller; +let eventName = "dynamic_lyric"; +let args = { + lyric : "This is lyric" +} +await session.dispatchSessionEvent(eventName, args).catch((err) => { + console.info(`dispatchSessionEvent BusinessError: code: ${err.code}, message: ${err.message}`); +}) +``` + +### dispatchSessionEvent10+ + +dispatchSessionEvent(event: string, args: {[key: string]: Object}, callback: AsyncCallback): void + +Dispatches a custom event in the session, including the event name and event content in key-value pair format. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Multimedia.AVSession.Core + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | --------------------------------------------- | ---- | ----------------------------------------------------------- | +| event | string | Yes | Name of the session event.| +| args | {[key: string]: any} | Yes | Event content in key-value pair format.| +| callback | AsyncCallback | Yes | Callback used to return the result. If the setting is successful, **err** is **undefined**; otherwise, **err** is an error object.| + +**Error codes** + +For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 6600101 | Session service exception. | +| 6600102 | The session does not exist. | + +**Example** + +```js +let eventName = "dynamic_lyric"; +let args = { + lyric : "This is lyric" +} +await session.dispatchSessionEvent(eventName, args, (err) => { + if(err) { + console.info(`dispatchSessionEvent BusinessError: code: ${err.code}, message: ${err.message}`); + } +}) +``` + +### getController + +getController(): Promise\ + +Obtains the controller corresponding to this session. This API uses a promise to return the result. + +**System capability**: SystemCapability.Multimedia.AVSession.Core + +**System API**: This is a system API. + +**Return value** + +| Type | Description | +| ---------------------------------------------------- | ----------------------------- | +| Promise<[AVSessionController](#avsessioncontroller)> | Promise used to return the session controller.| + +**Error codes** + +For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 6600101 | Session service exception. | +| 6600102 | The session does not exist. | + +**Example** + +```js +let controller; session.getController().then((avcontroller) => { controller = avcontroller; console.info(`GetController : SUCCESS : sessionid : ${controller.sessionId}`); @@ -1149,6 +1589,8 @@ Obtains the controller corresponding to this session. This API uses an asynchron **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -1156,6 +1598,7 @@ Obtains the controller corresponding to this session. This API uses an asynchron | callback | AsyncCallback<[AVSessionController](#avsessioncontroller)\> | Yes | Callback used to return the session controller.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -1185,6 +1628,8 @@ Obtains information about the output device for this session. This API uses a pr **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Return value** | Type | Description | @@ -1192,6 +1637,7 @@ Obtains information about the output device for this session. This API uses a pr | Promise<[OutputDeviceInfo](#outputdeviceinfo)> | Promise used to return the output device information.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -1217,6 +1663,8 @@ Obtains information about the output device for this session. This API uses an a **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -1224,6 +1672,7 @@ Obtains information about the output device for this session. This API uses an a | callback | AsyncCallback<[OutputDeviceInfo](#outputdeviceinfo)\> | Yes | Callback used to return the information obtained.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -1251,6 +1700,8 @@ Activates this session. A session can be used only after being activated. This A **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Return value** | Type | Description | @@ -1258,6 +1709,7 @@ Activates this session. A session can be used only after being activated. This A | Promise | Promise used to return the result. If the session is activated, no value is returned; otherwise, an error object is returned.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -1283,6 +1735,8 @@ Activates this session. A session can be used only after being activated. This A **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -1290,6 +1744,7 @@ Activates this session. A session can be used only after being activated. This A | callback | AsyncCallback | Yes | Callback used to return the result. If the session is activated, **err** is **undefined**; otherwise, **err** is an error object.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -1317,6 +1772,8 @@ Deactivates this session. You can use [activate](#activate) to activate the sess **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Return value** | Type | Description | @@ -1324,6 +1781,7 @@ Deactivates this session. You can use [activate](#activate) to activate the sess | Promise | Promise used to return the result. If the session is deactivated, no value is returned; otherwise, an error object is returned.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -1351,6 +1809,8 @@ Deactivates this session. You can use [activate](#activate) to activate the sess **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -1358,6 +1818,7 @@ Deactivates this session. You can use [activate](#activate) to activate the sess | callback | AsyncCallback | Yes | Callback used to return the result. If the session is deactivated, **err** is **undefined**; otherwise, **err** is an error object.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -1385,6 +1846,8 @@ Destroys this session. This API uses a promise to return the result. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Return value** | Type | Description | @@ -1392,6 +1855,7 @@ Destroys this session. This API uses a promise to return the result. | Promise | Promise used to return the result. If the session is destroyed, no value is returned; otherwise, an error object is returned.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -1415,9 +1879,10 @@ destroy(callback: AsyncCallback\): void Destroys this session. This API uses an asynchronous callback to return the result. - **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -1425,6 +1890,7 @@ Destroys this session. This API uses an asynchronous callback to return the resu | callback | AsyncCallback | Yes | Callback used to return the result. If the session is destroyed, **err** is **undefined**; otherwise, **err** is an error object.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -1452,6 +1918,8 @@ Subscribes to playback command events. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -1460,6 +1928,7 @@ Subscribes to playback command events. | callback | callback: () => void | Yes | Callback used for subscription. If the subscription is successful, **err** is **undefined**; otherwise, **err** is an error object. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -1501,6 +1970,8 @@ Subscribes to the seek event. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -1509,6 +1980,7 @@ Subscribes to the seek event. | callback | (time: number) => void | Yes | Callback used for subscription. The **time** parameter in the callback indicates the time to seek to, in milliseconds. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -1532,6 +2004,8 @@ Subscribes to the event for setting the playback speed. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -1540,6 +2014,7 @@ Subscribes to the event for setting the playback speed. | callback | (speed: number) => void | Yes | Callback used for subscription. The **speed** parameter in the callback indicates the playback speed. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -1563,6 +2038,8 @@ Subscribes to the event for setting the loop mode. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -1571,6 +2048,7 @@ Subscribes to the event for setting the loop mode. | callback | (mode: [LoopMode](#loopmode)) => void | Yes | Callback used for subscription. The **mode** parameter in the callback indicates the loop mode. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -1594,6 +2072,8 @@ Subscribes to the event for favoriting a media asset. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -1602,6 +2082,7 @@ Subscribes to the event for favoriting a media asset. | callback | (assetId: string) => void | Yes | Callback used for subscription. The **assetId** parameter in the callback indicates the media asset ID. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -1617,6 +2098,40 @@ session.on('toggleFavorite', (assetId) => { }); ``` +### on('skipToQueueItem')10+ + +on(type: 'skipToQueueItem', callback: (itemId: number) => void): void + +Subscribes to the event that indicates an item in the playlist is selected. The session can play the selected item. + +**System capability**: SystemCapability.Multimedia.AVSession.Core + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------------ | ---- | ---------------------------------------------------------------------------------------- | +| type | string | Yes | Event type. The event **'skipToQueueItem'** is reported when the command for selecting an item in the playlist is sent to the session.| +| callback | (itemId: number) => void | Yes | Callback used for subscription. The **itemId** parameter in the callback indicates the ID of the selected item. | + +**Error codes** + +For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 6600101 | Session service exception. | +| 6600102 | The session does not exist. | + +**Example** + +```js +session.on('skipToQueueItem', (itemId) => { + console.info(`on skipToQueueItem id : ${itemId}`); +}); +``` + ### on('handleKeyEvent') on(type: 'handleKeyEvent', callback: (event: KeyEvent) => void): void @@ -1625,6 +2140,8 @@ Subscribes to the key event. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -1633,6 +2150,7 @@ Subscribes to the key event. | callback | (event: [KeyEvent](js-apis-keyevent.md)) => void | Yes | Callback used for subscription. The **event** parameter in the callback indicates the key event. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -1656,6 +2174,8 @@ Subscribes to output device changes. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -1664,6 +2184,7 @@ Subscribes to output device changes. | callback | (device: [OutputDeviceInfo](#outputdeviceinfo)) => void | Yes | Callback used for subscription. The **device** parameter in the callback indicates the output device information. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -1679,6 +2200,40 @@ session.on('outputDeviceChange', (device) => { }); ``` +### on('commonCommand')10+ + +on(type: 'commonCommand', callback: (command: string, args: {[key: string]: Object}) => void): void + +Subscribes to custom control command changes. + +**System capability**: SystemCapability.Multimedia.AVSession.Core + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| type | string | Yes | Event type. The event **'commonCommand'** is reported when a custom control command changes.| +| callback | (commonCommand: string, args: {[key:string]: Object}) => void | Yes | Callback used for subscription. The **commonCommand** parameter in the callback indicates the name of the changed custom control command, and **args** indicates the parameters carried in the command. | + +**Error codes** + +For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). + +| ID| Error Message| +| -------- | ------------------------------ | +| 6600101 | Session service exception. | +| 6600103 | The session controller does not exist. | + +**Example** + +```js +session.on('commonCommand', (commonCommand, args) => { + console.info(`OnCommonCommand, the command is ${commonCommand}, args: ${JSON.stringify(args)}`); +}); +``` + ### off('play'|'pause'|'stop'|'playNext'|'playPrevious'|'fastForward'|'rewind') off(type: 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind', callback?: () => void): void @@ -1687,14 +2242,17 @@ Unsubscribes from playback command events. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | ---------------------------------------------------------------------------------------------------------------------------- | | type | string | Yes | Event type. The following events are supported: **'play'**, **'pause'**, **'stop'**, **'playNext'**, **'playPrevious'**, **'fastForward'**, and **'rewind'**.| -| callback | callback: () => void | No | Callback used for unsubscription. If the unsubscription is successful, **err** is **undefined**; otherwise, **err** is an error object.
The callback parameter is optional. If it is not specified, the specified event is no longer listened for all sessions. | +| callback | callback: () => void | No | Callback used for unsubscription. If the unsubscription is successful, **err** is **undefined**; otherwise, **err** is an error object.
The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -1722,14 +2280,17 @@ Unsubscribes from the seek event. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | | -------- | ---------------------- | ---- | ----------------------------------------- | | type | string | Yes | Event type. The value is fixed at **'seek'**. | -| callback | (time: number) => void | No | Callback used for unsubscription. The **time** parameter in the callback indicates the time to seek to, in milliseconds.
If the unsubscription is successful, **err** is **undefined**; otherwise, **err** is an error object.
The callback parameter is optional. If it is not specified, the specified event is no longer listened for all sessions. | +| callback | (time: number) => void | No | Callback used for unsubscription. The **time** parameter in the callback indicates the time to seek to, in milliseconds.
If the unsubscription is successful, **err** is **undefined**; otherwise, **err** is an error object.
The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -1751,14 +2312,17 @@ Unsubscribes from the event for setting the playback speed. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | | -------- | ----------------------- | ---- | -------------------------------------------| | type | string | Yes | Event type. The value is fixed at **'setSpeed'**. | -| callback | (speed: number) => void | No | Callback used for unsubscription. The **speed** parameter in the callback indicates the playback speed.
If the unsubscription is successful, **err** is **undefined**; otherwise, **err** is an error object.
The callback parameter is optional. If it is not specified, the specified event is no longer listened for all sessions. | +| callback | (speed: number) => void | No | Callback used for unsubscription. The **speed** parameter in the callback indicates the playback speed.
If the unsubscription is successful, **err** is **undefined**; otherwise, **err** is an error object.
The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -1780,14 +2344,17 @@ Unsubscribes from the event for setting loop mode. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | | -------- | ------------------------------------- | ---- | ----- | | type | string | Yes | Event type. The value is fixed at **'setLoopMode'**.| -| callback | (mode: [LoopMode](#loopmode)) => void | No | Callback used for unsubscription. The **mode** parameter in the callback indicates the loop mode.
If the unsubscription is successful, **err** is **undefined**; otherwise, **err** is an error object.
The callback parameter is optional. If it is not specified, the specified event is no longer listened for all sessions.| +| callback | (mode: [LoopMode](#loopmode)) => void | No | Callback used for unsubscription. The **mode** parameter in the callback indicates the loop mode.
If the unsubscription is successful, **err** is **undefined**; otherwise, **err** is an error object.
The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -1809,14 +2376,17 @@ Unsubscribes from the event for favoriting a media asset. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | -------------------------------------------------------- | | type | string | Yes | Event type. The value is fixed at **'toggleFavorite'**. | -| callback | (assetId: string) => void | No | Callback used for unsubscription. The **assetId** parameter in the callback indicates the media asset ID.
If the unsubscription is successful, **err** is **undefined**; otherwise, **err** is an error object.
The callback parameter is optional. If it is not specified, the specified event is no longer listened for all sessions. | +| callback | (assetId: string) => void | No | Callback used for unsubscription. The **assetId** parameter in the callback indicates the media asset ID.
If the unsubscription is successful, **err** is **undefined**; otherwise, **err** is an error object.
The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -1830,6 +2400,38 @@ For details about the error codes, see [AVSession Management Error Codes](../err session.off('toggleFavorite'); ``` +### off('skipToQueueItem')10+ + +off(type: 'skipToQueueItem', callback?: (itemId: number) => void): void + +Unsubscribes from the event that indicates an item in the playlist is selected. + +**System capability**: SystemCapability.Multimedia.AVSession.Core + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------------ | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | +| type | string | Yes | Event type. The value is fixed at **'skipToQueueItem'**. | +| callback | (itemId: number) => void | No | Callback used for unsubscription. The **itemId** parameter in the callback indicates the ID of the item.
If the unsubscription is successful, **err** is **undefined**; otherwise, **err** is an error object.
The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session.| + +**Error codes** + +For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 6600101 | Session service exception. | +| 6600102 | The session does not exist. | + +**Example** + +```js +session.off('skipToQueueItem'); +``` + ### off('handleKeyEvent') off(type: 'handleKeyEvent', callback?: (event: KeyEvent) => void): void @@ -1838,14 +2440,17 @@ Unsubscribes from the key event. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | type | string | Yes | Event type. The value is fixed at **'handleKeyEvent'**. | -| callback | (event: [KeyEvent](js-apis-keyevent.md)) => void | No | Callback used for unsubscription. The **event** parameter in the callback indicates the key event.
If the unsubscription is successful, **err** is **undefined**; otherwise, **err** is an error object.
The callback parameter is optional. If it is not specified, the specified event is no longer listened for all sessions. | +| callback | (event: [KeyEvent](js-apis-keyevent.md)) => void | No | Callback used for unsubscription. The **event** parameter in the callback indicates the key event.
If the unsubscription is successful, **err** is **undefined**; otherwise, **err** is an error object.
The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -1867,14 +2472,17 @@ Unsubscribes from playback device changes. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------ | | type | string | Yes | Event type. The value is fixed at **'outputDeviceChange'**. | -| callback | (device: [OutputDeviceInfo](#outputdeviceinfo)) => void | No | Callback used for unsubscription. The **device** parameter in the callback indicates the output device information.
If the unsubscription is successful, **err** is **undefined**; otherwise, **err** is an error object.
The callback parameter is optional. If it is not specified, the specified event is no longer listened for all sessions. | +| callback | (device: [OutputDeviceInfo](#outputdeviceinfo)) => void | No | Callback used for unsubscription. The **device** parameter in the callback indicates the output device information.
If the unsubscription is successful, **err** is **undefined**; otherwise, **err** is an error object.
The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -1889,6 +2497,38 @@ session.off('outputDeviceChange'); ``` +### off('commonCommand')10+ + +off(type: 'commonCommand', callback?: (commonCommand: string, args: {[key:string]: Object}) => void): void + +Unsubscribes from custom control command changes. + +**System capability**: SystemCapability.Multimedia.AVSession.Core + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------- | +| type | string | Yes | Event type. The value is fixed at **'commonCommand'**. | +| callback | (commonCommand: string, args: {[key:string]: Object}) => void | No | Callback used for unsubscription. The **commonCommand** parameter in the callback indicates the name of the changed custom control command, and **args** indicates the parameters carried in the command.
The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session. | + +**Error codes** + +For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). + +| ID| Error Message| +| -------- | ---------------- | +| 6600101 | Session service exception. | + +**Example** + +```js +session.off('commonCommand'); +``` + + ## AVSessionController @@ -1922,6 +2562,8 @@ Obtains the information related to the playback state. This API uses a promise t **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Return value** | Type | Description | @@ -1929,6 +2571,7 @@ Obtains the information related to the playback state. This API uses a promise t | Promise<[AVPlaybackState](#avplaybackstate)\> | Promise used to return the **AVPlaybackState** object.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -1954,6 +2597,8 @@ Obtains the information related to the playback state. This API uses an asynchro **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -1961,6 +2606,7 @@ Obtains the information related to the playback state. This API uses an asynchro | callback | AsyncCallback<[AVPlaybackState](#avplaybackstate)\> | Yes | Callback used to return the **AVPlaybackState** object.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -1980,21 +2626,24 @@ controller.getAVPlaybackState(function (err, playbackState) { }); ``` -### getAVMetadata +### getAVQueueItems10+ -getAVMetadata(): Promise\ +getAVQueueItems(): Promise\> -Obtains the session metadata. This API uses a promise to return the result. +Obtains the information related to the items in the queue. This API uses a promise to return the result. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Return value** -| Type | Description | -| ----------------------------------- | ----------------------------- | -| Promise<[AVMetadata](#avmetadata)\> | Promise used to return the metadata obtained.| +| Type | Description | +| --------------------------------------------- | ----------------------------- | +| Promise\> | Promise used to return the items in the queue.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -2005,21 +2654,248 @@ For details about the error codes, see [AVSession Management Error Codes](../err **Example** ```js -controller.getAVMetadata().then((metadata) => { - console.info(`GetAVMetadata : SUCCESS : assetId : ${metadata.assetId}`); +controller.getAVQueueItems().then((items) => { + console.info(`GetAVQueueItems : SUCCESS : length : ${items.length}`); }).catch((err) => { - console.info(`GetAVMetadata BusinessError: code: ${err.code}, message: ${err.message}`); + console.info(`GetAVQueueItems BusinessError: code: ${err.code}, message: ${err.message}`); }); ``` -### getAVMetadata +### getAVQueueItems10+ -getAVMetadata(callback: AsyncCallback\): void +getAVQueueItems(callback: AsyncCallback\>): void -Obtains the session metadata. This API uses an asynchronous callback to return the result. +Obtains the information related to the items in the playlist. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------------------- | ---- | ------------------------- | +| callback | AsyncCallback\> | Yes | Callback used to return the items in the playlist.| + +**Error codes** + +For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 6600101 | Session service exception. | +| 6600102 | The session does not exist. | +| 6600103 | The session controller does not exist. | + +**Example** +```js +controller.getAVQueueItems(function (err, items) { + if (err) { + console.info(`GetAVQueueItems BusinessError: code: ${err.code}, message: ${err.message}`); + } else { + console.info(`GetAVQueueItems : SUCCESS : length : ${items.length}`); + } +}); +``` + +### getAVQueueTitle10+ + +getAVQueueTitle(): Promise\ + +Obtains the name of the playlist. This API uses a promise to return the result. + +**System capability**: SystemCapability.Multimedia.AVSession.Core + +**System API**: This is a system API. + +**Return value** + +| Type | Description | +| ---------------- | ----------------------------- | +| Promise | Promise used to return the playlist name.| + +**Error codes** + +For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 6600101 | Session service exception. | +| 6600102 | The session does not exist. | +| 6600103 | The session controller does not exist. | + +**Example** +```js +controller.getAVQueueTitle().then((title) => { + console.info(`GetAVQueueTitle : SUCCESS : title : ${title}`); +}).catch((err) => { + console.info(`GetAVQueueTitle BusinessError: code: ${err.code}, message: ${err.message}`); +}); +``` + +### getAVQueueTitle10+ + +getAVQueueTitle(callback: AsyncCallback\): void + +Obtains the name of the playlist. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Multimedia.AVSession.Core + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------- | ---- | ------------------------- | +| callback | AsyncCallback | Yes | Callback used to return the playlist name.| + +**Error codes** + +For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 6600101 | Session service exception. | +| 6600102 | The session does not exist. | +| 6600103 | The session controller does not exist. | + +**Example** +```js +controller.getAVQueueTitle(function (err, title) { + if (err) { + console.info(`GetAVQueueTitle BusinessError: code: ${err.code}, message: ${err.message}`); + } else { + console.info(`GetAVQueueTitle : SUCCESS : title : ${title}`); + } +}); +``` + +### skipToQueueItem10+ + +skipToQueueItem(itemId: number): Promise\ + +Sends the ID of an item in the playlist to the session for processing. The session can play the song. This API uses a promise to return the result. + +**System capability**: SystemCapability.Multimedia.AVSession.Core + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------ | ------- | ---- | ------------------------------------------- | +| itemId | number | Yes | ID of an item in the playlist.| + +**Return value** + +| Type | Description | +| -------------- | --------------------------------------------------------------- | +| Promise | Promise used to return the result. If the item ID is sent, no value is returned; otherwise, an error object is returned.| + +**Error codes** + +For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 6600101 | Session service exception. | +| 6600102 | The session does not exist. | + +**Example** + +```js +let queueItemId = 0; +controller.skipToQueueItem(queueItemId).then(() => { + console.info('SkipToQueueItem successfully'); +}).catch((err) => { + console.info(`SkipToQueueItem BusinessError: code: ${err.code}, message: ${err.message}`); +}); +``` + +### skipToQueueItem10+ + +skipToQueueItem(itemId: number, callback: AsyncCallback\): void + +Sends the ID of an item in the playlist to the session for processing. The session can play the song. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Multimedia.AVSession.Core + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------- | ---- | ----------------------------------------------------------- | +| itemId | number | Yes | ID of an item in the playlist. | +| callback | AsyncCallback | Yes | Callback used to return the result. If the setting is successful, **err** is **undefined**; otherwise, **err** is an error object.| + +**Error codes** + +For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 6600101 | Session service exception. | +| 6600102 | The session does not exist. | + +**Example** + +```js +let queueItemId = 0; +controller.skipToQueueItem(queueItemId, function (err) { + if (err) { + console.info(`SkipToQueueItem BusinessError: code: ${err.code}, message: ${err.message}`); + } else { + console.info('SkipToQueueItem successfully'); + } +}); +``` + +### getAVMetadata + +getAVMetadata(): Promise\ + +Obtains the session metadata. This API uses a promise to return the result. + +**System capability**: SystemCapability.Multimedia.AVSession.Core + +**System API**: This is a system API. + +**Return value** + +| Type | Description | +| ----------------------------------- | ----------------------------- | +| Promise<[AVMetadata](#avmetadata)\> | Promise used to return the metadata obtained.| + +**Error codes** + +For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 6600101 | Session service exception. | +| 6600102 | The session does not exist. | +| 6600103 | The session controller does not exist. | + +**Example** +```js +controller.getAVMetadata().then((metadata) => { + console.info(`GetAVMetadata : SUCCESS : assetId : ${metadata.assetId}`); +}).catch((err) => { + console.info(`GetAVMetadata BusinessError: code: ${err.code}, message: ${err.message}`); +}); +``` + +### getAVMetadata + +getAVMetadata(callback: AsyncCallback\): void + +Obtains the session metadata. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Multimedia.AVSession.Core + +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -2027,6 +2903,7 @@ Obtains the session metadata. This API uses an asynchronous callback to return t | callback | AsyncCallback<[AVMetadata](#avmetadata)\> | Yes | Callback used to return the metadata obtained.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -2054,6 +2931,8 @@ Obtains the output device information. This API uses a promise to return the res **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Return value** | Type | Description | @@ -2061,6 +2940,7 @@ Obtains the output device information. This API uses a promise to return the res | Promise<[OutputDeviceInfo](#outputdeviceinfo)\> | Promise used to return the information obtained.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -2085,6 +2965,8 @@ Obtains the output device information. This API uses an asynchronous callback to **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -2092,6 +2974,7 @@ Obtains the output device information. This API uses an asynchronous callback to | callback | AsyncCallback<[OutputDeviceInfo](#outputdeviceinfo)\> | Yes | Callback used to return the information obtained.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -2119,6 +3002,8 @@ Sends a key event to the session corresponding to this controller. This API uses **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name| Type | Mandatory| Description | @@ -2126,6 +3011,7 @@ Sends a key event to the session corresponding to this controller. This API uses | event | [KeyEvent](js-apis-keyevent.md) | Yes | Key event.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -2163,6 +3049,8 @@ Sends a key event to the session corresponding to this controller. This API uses **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -2171,6 +3059,7 @@ Sends a key event to the session corresponding to this controller. This API uses | callback | AsyncCallback | Yes | Callback used to return the result. If the event is sent, **err** is **undefined**; otherwise, **err** is an error object.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -2204,6 +3093,8 @@ Obtains the **WantAgent** object saved by the application in the session. This A **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Return value** | Type | Description | @@ -2211,6 +3102,7 @@ Obtains the **WantAgent** object saved by the application in the session. This A | Promise<[WantAgent](js-apis-app-ability-wantAgent.md)\> | Promise used to return the object saved by calling [setLaunchAbility](#setlaunchability). The object includes the application attribute, such as the bundle name, ability name, and device ID.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -2239,6 +3131,8 @@ Obtains the **WantAgent** object saved by the application in the session. This A **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -2246,6 +3140,7 @@ Obtains the **WantAgent** object saved by the application in the session. This A | callback | AsyncCallback<[WantAgent](js-apis-app-ability-wantAgent.md)\> | Yes | Callback used to return the object saved by calling [setLaunchAbility](#setlaunchability). The object includes the application attribute, such as the bundle name, ability name, and device ID.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -2276,6 +3171,8 @@ Obtains the playback position. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Return value** | Type | Description | @@ -2283,6 +3180,7 @@ Obtains the playback position. | number | Playback position, in milliseconds.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -2304,6 +3202,8 @@ Checks whether the session is activated. This API uses a promise to return the r **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Return value** | Type | Description | @@ -2311,6 +3211,7 @@ Checks whether the session is activated. This API uses a promise to return the r | Promise | Promise used to return the activation state. If the session is activated, **true** is returned; otherwise, **false** is returned.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -2337,6 +3238,8 @@ Checks whether the session is activated. This API uses an asynchronous callback **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -2344,6 +3247,7 @@ Checks whether the session is activated. This API uses an asynchronous callback | callback | AsyncCallback | Yes | Callback used to return the activation state. If the session is activated, **true** is returned; otherwise, **false** is returned.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -2372,6 +3276,8 @@ Destroys this controller. A controller can no longer be used after being destroy **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Return value** | Type | Description | @@ -2379,6 +3285,7 @@ Destroys this controller. A controller can no longer be used after being destroy | Promise | Promise used to return the result. If the controller is destroyed, no value is returned; otherwise, an error object is returned.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -2404,6 +3311,8 @@ Destroys this controller. A controller can no longer be used after being destroy **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -2411,6 +3320,7 @@ Destroys this controller. A controller can no longer be used after being destroy | callback | AsyncCallback | Yes | Callback used to return the result. If the controller is destroyed, **err** is **undefined**; otherwise, **err** is an error object.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -2438,6 +3348,8 @@ Obtains valid commands supported by the session. This API uses a promise to retu **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Return value** | Type | Description | @@ -2445,6 +3357,7 @@ Obtains valid commands supported by the session. This API uses a promise to retu | Promise\> | Promise used to return a set of valid commands.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -2471,6 +3384,8 @@ Obtains valid commands supported by the session. This API uses an asynchronous c **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -2478,6 +3393,7 @@ Obtains valid commands supported by the session. This API uses an asynchronous c | callback | AsyncCallback\\> | Yes | Callback used to return a set of valid commands.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -2506,6 +3422,8 @@ Sends a control command to the session through the controller. This API uses a p **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -2519,6 +3437,7 @@ Sends a control command to the session through the controller. This API uses a p | Promise | Promise used to return the result. If the command is sent, no value is returned; otherwise, an error object is returned.| **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -2559,6 +3478,8 @@ Sends a control command to the session through the controller. This API uses an **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -2567,6 +3488,7 @@ Sends a control command to the session through the controller. This API uses an | callback | AsyncCallback | Yes | Callback used to return the result. If the command is sent, **err** is **undefined**; otherwise, **err** is an error object. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -2601,6 +3523,95 @@ controller.sendControlCommand(avCommand, function (err) { }); ``` +### sendCommonCommand10+ + +sendCommonCommand(command: string, args: {[key: string]: Object}): Promise\ + +Sends a custom control command to the session through the controller. This API uses a promise to return the result. + +**System capability**: SystemCapability.Multimedia.AVSession.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------------------------------------- | ---- | ------------------------------ | +| command | string | Yes | Name of the custom control command.| +| args | {[key: string]: any} | Yes | Parameters in key-value pair format carried in the custom control command.| + +**Return value** + +| Type | Description | +| -------------- | ----------------------------- | +| Promise | Promise used to return the result. If the command is sent, no value is returned; otherwise, an error object is returned.| + +**Error codes** + +For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 6600101 | Session service exception. | +| 6600102 | The session does not exist. | +| 6600103 | The session controller does not exist. | +| 6600105 | Invalid session command. | +| 6600106 | The session is not activated. | +| 6600107 | Too many commands or events. | + +**Example** + +```js +let commandName = "my_command"; +let args = { + command : "This is my command" +} +await controller.sendCommonCommand(commandName, args).catch((err) => { + console.info(`SendCommonCommand BusinessError: code: ${err.code}, message: ${err.message}`); +}) +``` + +### sendCommonCommand10+ + +sendCommonCommand(command: string, args: {[key: string]: Object}, callback: AsyncCallback\): void + +Sends a custom control command to the session through the controller. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Multimedia.AVSession.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------------------------------------- | ---- | ------------------------------ | +| command | string | Yes | Name of the custom control command.| +| args | {[key: string]: any} | Yes | Parameters in key-value pair format carried in the custom control command.| +| callback | AsyncCallback | Yes | Callback used to return the result. If the command is sent, **err** is **undefined**; otherwise, **err** is an error object. | + +**Error codes** + +For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). + +| ID| Error Message| +| -------- | ------------------------------- | +| 6600101 | Session service exception. | +| 6600102 | The session does not exist. | +| 6600103 | The session controller does not exist. | +| 6600105 | Invalid session command. | +| 6600106 | The session is not activated. | +| 6600107 | Too many commands or events. | + +**Example** + +```js +let commandName = "my_command"; +let args = { + command : "This is my command" +} +controller.sendCommonCommand(commandName, args, (err) => { + if(err) { + console.info(`SendCommonCommand BusinessError: code: ${err.code}, message: ${err.message}`); + } +}) +``` + ### on('metadataChange') on(type: 'metadataChange', filter: Array\ | 'all', callback: (data: AVMetadata) => void) @@ -2609,6 +3620,8 @@ Subscribes to the metadata change event. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -2618,6 +3631,7 @@ Subscribes to the metadata change event. | callback | (data: [AVMetadata](#avmetadata)) => void | Yes | Callback used for subscription. The **data** parameter in the callback indicates the changed metadata. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -2646,6 +3660,8 @@ Subscribes to the playback state change event. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -2655,6 +3671,7 @@ Subscribes to the playback state change event. | callback | (state: [AVPlaybackState](#avplaybackstate)) => void | Yes | Callback used for subscription. The **state** parameter in the callback indicates the changed playback state. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -2675,6 +3692,108 @@ controller.on('playbackStateChange', playbackFilter, (playbackState) => { }); ``` +### on('sessionEvent')10+ + +on(type: 'sessionEvent', callback: (sessionEvent: string, args: {[key:string]: Object}) => void): void + +Subscribes to session event changes. + +**System capability**: SystemCapability.Multimedia.AVSession.Core + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| type | string | Yes | Event type. The event **'sessionEvent'** is reported when the session event changes.| +| callback | (sessionEvent: string, args: {[key:string]: object}) => void | Yes | Callback used for subscription. **sessionEvent** in the callback indicates the name of the session event that changes, and **args** indicates the parameters carried in the event. | + +**Error codes** + +For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). + +| ID| Error Message| +| -------- | ------------------------------ | +| 6600101 | Session service exception. | +| 6600103 | The session controller does not exist. | + +**Example** + +```js +controller.on('sessionEvent', (sessionEvent, args) => { + console.info(`OnSessionEvent, sessionEvent is ${sessionEvent}, args: ${JSON.stringify(args)}`); +}); +``` + +### on('queueItemsChange')10+ + +on(type: 'queueItemsChange', callback: (items: Array<[AVQueueItem](#avqueueitem10)\>) => void): void + +Subscribes to playlist item changes. + +**System capability**: SystemCapability.Multimedia.AVSession.Core + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ----------------------------------------------------- | ---- | ---------------------------------------------------------------------------- | +| type | string | Yes | Event type. The event **'queueItemsChange'** is reported when one or more items in the playlist changes.| +| callback | (items: Array<[AVQueueItem](#avqueueitem10)\>) => void | Yes | Callback used for subscription. The **items** parameter in the callback indicates the changed items in the playlist. | + +**Error codes** + +For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). + +| ID| Error Message| +| -------- | ------------------------------ | +| 6600101 | Session service exception. | +| 6600103 | The session controller does not exist. | + +**Example** + +```js +controller.on('queueItemsChange', (items) => { + console.info(`OnQueueItemsChange, items length is ${items.length}`); +}); +``` + +### on('queueTitleChange')10+ + +on(type: 'queueTitleChange', callback: (title: string) => void): void + +Subscribes to playlist name changes. + +**System capability**: SystemCapability.Multimedia.AVSession.Core + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ----------------------- | ---- | ------------------------------------------------------------------------------- | +| type | string | Yes | Event type. The event **'queueTitleChange'** is reported when the playlist name changes.| +| callback | (title: string) => void | Yes | Callback used for subscription. The **title** parameter in the callback indicates the changed playlist name. | + +**Error codes** + +For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). + +| ID| Error Message| +| -------- | ------------------------------ | +| 6600101 | Session service exception. | +| 6600103 | The session controller does not exist. | + +**Example** + +```js +controller.on('queueTitleChange', (title) => { + console.info(`queueTitleChange, title is ${title}`); +}); +``` + ### on('sessionDestroy') on(type: 'sessionDestroy', callback: () => void) @@ -2683,6 +3802,8 @@ Subscribes to the session destruction event. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -2691,6 +3812,7 @@ Subscribes to the session destruction event. | callback | () => void | Yes | Callback used for subscription. If the subscription is successful, **err** is **undefined**; otherwise, **err** is an error object. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -2714,6 +3836,8 @@ Subscribes to the session activation state change event. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -2722,6 +3846,7 @@ Subscribes to the session activation state change event. | callback | (isActive: boolean) => void | Yes | Callback used for subscription. The **isActive** parameter in the callback specifies whether the session is activated. The value **true** means that the service is activated, and **false** means the opposite. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -2745,6 +3870,8 @@ Subscribes to valid command changes. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -2753,6 +3880,7 @@ Subscribes to valid command changes. | callback | (commands: Array<[AVControlCommandType](#avcontrolcommandtype)\>) => void | Yes | Callback used for subscription. The **commands** parameter in the callback is a set of valid commands. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -2777,6 +3905,8 @@ Subscribes to output device changes. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -2785,6 +3915,7 @@ Subscribes to output device changes. | callback | (device: [OutputDeviceInfo](#outputdeviceinfo)) => void | Yes | Callback used for subscription. The **device** parameter in the callback indicates the output device information. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -2808,14 +3939,17 @@ Unsubscribes from metadata changes. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------ | ---- | ------------------------------------------------------ | | type | string | Yes | Event type. The event **'metadataChange'** is reported when the session metadata changes. | -| callback | (data: [AVMetadata](#avmetadata)) => void | No | Callback used for subscription. The **data** parameter in the callback indicates the changed metadata.
The callback parameter is optional. If it is not specified, the specified event is no longer listened for all sessions. | +| callback | (data: [AVMetadata](#avmetadata)) => void | No | Callback used for subscription. The **data** parameter in the callback indicates the changed metadata.
The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -2836,14 +3970,17 @@ Unsubscribes from playback state changes. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------- | | type | string | Yes | Event type. The event **'playbackStateChange'** is reported when the playback state changes. | -| callback | (state: [AVPlaybackState](#avplaybackstate)) => void | No | Callback used for subscription. The **state** parameter in the callback indicates the changed playback state.
The callback parameter is optional. If it is not specified, the specified event is no longer listened for all sessions. | +| callback | (state: [AVPlaybackState](#avplaybackstate)) => void | No | Callback used for subscription. The **state** parameter in the callback indicates the changed playback state.
The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -2856,6 +3993,99 @@ For details about the error codes, see [AVSession Management Error Codes](../err controller.off('playbackStateChange'); ``` +### off('sessionEvent')10+ + +off(type: 'sessionEvent', callback?: (sessionEvent: string, args: {[key:string]: Obejct}) => void): void + +Unsubscribes from session event changes. + +**System capability**: SystemCapability.Multimedia.AVSession.Core + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------- | +| type | string | Yes | Event type. The value is fixed at **'sessionEvent'**. | +| callback | (sessionEvent: string, args: {[key:string]: object}) => void | No | Callback used for unsubscription. **sessionEvent** in the callback indicates the name of the session event that changes, and **args** indicates the parameters carried in the event.
The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session. | + +**Error codes** + +For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). + +| ID| Error Message| +| -------- | ---------------- | +| 6600101 | Session service exception. | + +**Example** + +```js +controller.off('sessionEvent'); +``` + +### off('queueItemsChange')10+ + +off(type: 'queueItemsChange', callback?: (items: Array<[AVQueueItem](#avqueueitem10)\>) => void): void + +Unsubscribes from playback item changes. + +**System capability**: SystemCapability.Multimedia.AVSession.Core + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------------------------------------- | ---- | --------------------------------------------------------------------------------------------------- | +| type | string | Yes | Event type. The value is fixed at **'queueItemsChange'**. | +| callback | (items: Array<[AVQueueItem](#avqueueitem10)\>) => void | No | Callback used for unsubscription. The **items** parameter in the callback indicates the changed items in the playback.
The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session.| + +**Error codes** + +For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). + +| ID| Error Message| +| -------- | ---------------- | +| 6600101 | Session service exception. | + +**Example** + +```js +controller.off('queueItemsChange'); +``` + +### off('queueTitleChange')10+ + +off(type: 'queueTitleChange', callback?: (title: string) => void): void + +Unsubscribes from playlist name changes. + +**System capability**: SystemCapability.Multimedia.AVSession.Core + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ----------------------- | ---- | ------------------------------------------------------------------------------------------------------- | +| type | string | Yes | Event type. The value is fixed at **'queueTitleChange'**. | +| callback | (title: string) => void | No | Callback used for unsubscription. The **items** parameter in the callback indicates the changed playlist name.
The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session.| + +**Error codes** + +For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). + +| ID| Error Message| +| -------- | ---------------- | +| 6600101 | Session service exception. | + +**Example** + +```js +controller.off('queueTitleChange'); +``` + ### off('sessionDestroy') off(type: 'sessionDestroy', callback?: () => void) @@ -2864,14 +4094,17 @@ Unsubscribes from the session destruction event. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | | -------- | ---------- | ---- | ----------------------------------------------------- | | type | string | Yes | Event type. The event **'sessionDestroy'** is reported when the session is destroyed. | -| callback | () => void | No | Callback used for unsubscription. If the unsubscription is successful, **err** is **undefined**; otherwise, **err** is an error object.
The callback parameter is optional. If it is not specified, the specified event is no longer listened for all sessions. | +| callback | () => void | No | Callback used for unsubscription. If the unsubscription is successful, **err** is **undefined**; otherwise, **err** is an error object.
The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -2892,14 +4125,17 @@ Unsubscribes from session activation state changes. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | | -------- | --------------------------- | ---- | ----------------------------------------------------- | | type | string | Yes | Event type. The event **'activeStateChange'** is reported when the session activation state changes. | -| callback | (isActive: boolean) => void | No | Callback used for unsubscription. The **isActive** parameter in the callback specifies whether the session is activated. The value **true** means that the session is activated, and **false** means the opposite.
The callback parameter is optional. If it is not specified, the specified event is no longer listened for all sessions. | +| callback | (isActive: boolean) => void | No | Callback used for unsubscription. The **isActive** parameter in the callback specifies whether the session is activated. The value **true** means that the session is activated, and **false** means the opposite.
The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message| @@ -2920,14 +4156,17 @@ Unsubscribes from valid command changes. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | -------------------------------------------------------- | | type | string | Yes | Event type. The event **'validCommandChange'** is reported when the supported commands change. | -| callback | (commands: Array<[AVControlCommandType](#avcontrolcommandtype)\>) => void | No | Callback used for unsubscription. The **commands** parameter in the command is a set of valid commands.
The callback parameter is optional. If it is not specified, the specified event is no longer listened for all sessions. | +| callback | (commands: Array<[AVControlCommandType](#avcontrolcommandtype)\>) => void | No | Callback used for unsubscription. The **commands** parameter in the callback is a set of valid commands.
The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID| Error Message | @@ -2948,14 +4187,17 @@ Unsubscribes from output device changes. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------ | | type | string | Yes | Event type. The event **'outputDeviceChange'** is reported when the output device changes. | -| callback | (device: [OutputDeviceInfo](#outputdeviceinfo)) => void | No | Callback used for unsubscription. The **device** parameter in the callback indicates the output device information.
The callback parameter is optional. If it is not specified, the specified event is no longer listened for all sessions. | +| callback | (device: [OutputDeviceInfo](#outputdeviceinfo)) => void | No | Callback used for unsubscription. The **device** parameter in the callback indicates the output device information.
The **callback** parameter is optional. If it is not specified, all the subscriptions to the specified event are canceled for this session. | **Error codes** + For details about the error codes, see [AVSession Management Error Codes](../errorcodes/errorcode-avsession.md). | ID | Error Message | @@ -2989,6 +4231,8 @@ Enumerates the session types supported by the session. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + | Name | Type | Description| | ----- | ------ | ---- | | audio | string | Audio session.| @@ -3018,6 +4262,8 @@ Enumerates the commands that can be sent to a session. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + | Name | Type | Description | | -------------- | ------ | ------------ | | play | string | Play the media. | @@ -3038,6 +4284,8 @@ Describes the command that can be sent to the session. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + | Name | Type | Mandatory| Description | | --------- | ------------------------------------------------- | ---- | -------------- | | command | [AVControlCommandType](#avcontrolcommandtype) | Yes | Command. | @@ -3049,6 +4297,8 @@ Describes the media metadata. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + | Name | Type | Mandatory| Description | | --------------- |-------------------------| ---- |---------------------------------------------------------------------| | assetId | string | Yes | Media ID. | @@ -3067,12 +4317,42 @@ Describes the media metadata. | previousAssetId | string | No | ID of the previous media asset. | | nextAssetId | string | No | ID of the next media asset. | +## AVMediaDescription10+ + +Describes the attributes related to the media metadata of the playlist. + +**System capability**: SystemCapability.Multimedia.AVSession.Core + +| Name | Type | Mandatory | Description | +| ------------ | ----------------------- | ---- | ----------------------- | +| mediaId | string | Yes | Media ID of the playlist. | +| title | string | No | Name of the playlist. | +| subtitle | string | No | Subname of the playlist. | +| description | string | No | Description of the playlist. | +| icon | image.PixelMap | No | Pixel map of the image of the playlist.| +| iconUri | string | No | Path of the image of the playlist.| +| extras | {[key: string]: any} | No | Additional fields of the playlist. | +| mediaUri | string | No | Media URI. | + +## AVQueueItem10+ + +Describes the attributes of an item in the playlist. + +**System capability**: SystemCapability.Multimedia.AVSession.Core + +| Name | Type | Mandatory| Description | +| ------------ | ------------------------------------------ | ---- | --------------------------- | +| itemId | number | Yes | ID of an item in the playlist. | +| description | [AVMediaDescription](#avmediadescription10) | Yes | Media metadata of the item in the playlist. | + ## AVPlaybackState Describes the information related to the media playback state. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + | Name | Type | Mandatory| Description | | ------------ | ------------------------------------- | ---- | ------- | | state | [PlaybackState](#playbackstate) | No | Playback state.| @@ -3088,6 +4368,8 @@ Describes the information related to the playback position. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + | Name | Type | Mandatory| Description | | ----------- | ------ | ---- | ------------------ | | elapsedTime | number | Yes | Elapsed time, in ms.| @@ -3099,6 +4381,8 @@ Describes the information related to the output device. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + | Name | Type | Mandatory| Description | | ---------- | -------------- | ---- | ---------------------- | | isRemote | boolean | Yes | Whether the device is connected. | @@ -3111,6 +4395,8 @@ Enumerates the media playback states. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + | Name | Value | Description | | --------------------------- | ---- | ----------- | | PLAYBACK_STATE_INITIAL | 0 | Initial. | @@ -3128,6 +4414,8 @@ Enumerates the loop modes of media playback. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + | Name | Value | Description | | ------------------ | ---- | -------- | | LOOP_MODE_SEQUENCE | 0 | Sequential playback.| @@ -3141,6 +4429,8 @@ Enumerates the error codes used in the media session. **System capability**: SystemCapability.Multimedia.AVSession.Core +**System API**: This is a system API. + | Name | Value | Description | | ------------------------------ | ------- | ------------------------------- | | ERR_CODE_SERVICE_EXCEPTION | 6600101 | Session service exception. | diff --git a/en/application-dev/reference/apis/js-apis-backgroundTaskManager.md b/en/application-dev/reference/apis/js-apis-backgroundTaskManager.md index 775bc6665152c9d2870e28f677022d8734a551fe..325b32ef4780b5a884cdb2f07b0eaf73c124fcc4 100644 --- a/en/application-dev/reference/apis/js-apis-backgroundTaskManager.md +++ b/en/application-dev/reference/apis/js-apis-backgroundTaskManager.md @@ -161,7 +161,7 @@ Requests a continuous task from the system. This API uses an asynchronous callba | Name | Type | Mandatory| Description | | --------- | --------------------------------------------- | ---- | ------------------------------------------------------------ | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-context.md).| | bgMode | [BackgroundMode](#backgroundmode8) | Yes | Background mode requested. | | wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes | Notification parameter, which is used to specify the target page that is redirected to when a continuous task notification is clicked. | | callback | AsyncCallback<void> | Yes | Callback used to return the result. | @@ -253,7 +253,7 @@ Requests a continuous task from the system. This API uses a promise to return th | Name | Type | Mandatory| Description | | --------- | --------------------------------------------- | ---- | ------------------------------------------------------------ | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-context.md).| | bgMode | [BackgroundMode](#backgroundmode8) | Yes | Background mode requested. | | wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes | Notification parameter, which is used to specify the target page that is redirected to when a continuous task notification is clicked. | @@ -339,7 +339,7 @@ Requests to cancel a continuous task. This API uses an asynchronous callback to | Name | Type | Mandatory | Description | | -------- | ------------------------- | ---- | ---------------------------------------- | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-context.md).| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | **Example** @@ -395,7 +395,7 @@ Requests to cancel a continuous task. This API uses a promise to return the resu | Name | Type | Mandatory | Description | | ------- | ------- | ---- | ---------------------------------------- | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-context.md).| **Return value** diff --git a/en/application-dev/reference/apis/js-apis-battery-info.md b/en/application-dev/reference/apis/js-apis-battery-info.md index 6231cab50066c32fcbed5bfaf11def7838b0329e..4e4a654f4f314d0447c3cf5bd32c6f7f550affc8 100644 --- a/en/application-dev/reference/apis/js-apis-battery-info.md +++ b/en/application-dev/reference/apis/js-apis-battery-info.md @@ -30,10 +30,10 @@ Describes battery information. | batteryTemperature | number | Yes | No | Battery temperature of the device, in unit of 0.1°C. | | isBatteryPresent7+ | boolean | Yes | No | Whether the battery is supported or present. | | batteryCapacityLevel9+ | [BatteryCapacityLevel](#batterycapacitylevel9) | Yes | No | Battery level of the device. | -| estimatedRemainingChargeTime9+ | number | Yes | No | Estimated time for fully charging the current device, in unit of milliseconds. **System API**: This is a system API. | -| totalEnergy9+ | number | Yes | No | Total battery capacity of the device, in unit of mAh. **System API**: This is a system API. | -| nowCurrent9+ | number | Yes | No | Battery current of the device, in unit of mA. **System API**: This is a system API. | -| remainingEnergy9+ | number | Yes | No | Remaining battery capacity of the device, in unit of mAh. **System API**: This is a system API.| +| estimatedRemainingChargeTime9+ | number | Yes | No | Estimated time for fully charging the current device, in unit of milliseconds. This is a system API. | +| totalEnergy9+ | number | Yes | No | Total battery capacity of the device, in unit of mAh. This is a system API. | +| nowCurrent9+ | number | Yes | No | Battery current of the device, in unit of mA. This is a system API. | +| remainingEnergy9+ | number | Yes | No | Remaining battery capacity of the device, in unit of mAh. This is a system API.| ## BatteryPluggedType diff --git a/en/application-dev/reference/apis/js-apis-batteryStatistics.md b/en/application-dev/reference/apis/js-apis-batteryStatistics.md index 89cd4ab39ee2d9a7c7e0a4f9b03a4755b55b864f..721a432caaf67116a6df882c0e8995e76b893a7e 100644 --- a/en/application-dev/reference/apis/js-apis-batteryStatistics.md +++ b/en/application-dev/reference/apis/js-apis-batteryStatistics.md @@ -18,7 +18,7 @@ import batteryStats from '@ohos.batteryStatistics'; getBatteryStats(): Promise -Obtains the power consumption information list, using a promise to return the result. +Obtains the power consumption information list. This API uses a promise to return the result. **System API**: This is a system API. @@ -34,9 +34,9 @@ Obtains the power consumption information list, using a promise to return the re For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-batteryStatistics.md). -| Code| Error Message | -| -------- | -------------- | -| 4600101 | Operation failed. Cannot connect to service.| +| Code | Error Message | +|---------|---------| +| 4600101 | Operation failed. Cannot connect to service.| **Example** @@ -64,15 +64,15 @@ Obtains the power consumption information list. This API uses an asynchronous ca | Name | Type | Mandatory| Description | | -------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ | -| callback | AsyncCallback> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined** and **data** is the array of power consumption information obtained. If the operation failed, **err** is an error object.| +| callback | AsyncCallback> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined** and **data** is the array of power consumption information obtained (that is, **Array<[BatteryStatsInfo](#batterystatsinfo)>>**). If the operation failed, **err** is an error object.| **Error codes** For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-batteryStatistics.md). -| Code| Error Message | -| -------- | -------------- | -| 4600101 | Operation failed. Cannot connect to service.| +| Code | Error Message | +|---------|---------| +| 4600101 | Operation failed. Cannot connect to service.| **Example** @@ -112,9 +112,9 @@ Obtains the power consumption of an application. For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-batteryStatistics.md). -| Code| Error Message | -| -------- | -------------- | -| 4600101 | Operation failed. Cannot connect to service.| +| Code | Error Message | +|---------|---------| +| 4600101 | Operation failed. Cannot connect to service.| **Example** @@ -153,9 +153,9 @@ Obtains the proportion of the power consumption of an application. For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-batteryStatistics.md). -| Code| Error Message | -| -------- | -------------- | -| 4600101 | Operation failed. Cannot connect to service.| +| Code | Error Message | +|---------|---------| +| 4600101 | Operation failed. Cannot connect to service.| **Example** @@ -194,16 +194,16 @@ Obtains the power consumption of a hardware unit according to the consumption ty For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-batteryStatistics.md). -| Code| Error Message | -| -------- | -------------- | -| 4600101 | Operation failed. Cannot connect to service.| +| Code | Error Message | +|---------|---------| +| 4600101 | Operation failed. Cannot connect to service.| **Example** ```js try { var value = batteryStats.getHardwareUnitPowerValue(ConsumptionType.CONSUMPTION_TYPE_SCREEN); - console.info('battery statistics percent of hardware is: ' + percent); + console.info('battery statistics value of hardware is: ' + value); } catch(err) { console.error('get battery statistics percent of hardware failed, err: ' + err); } @@ -235,15 +235,15 @@ Obtains the proportion of the power consumption of a hardware unit according to For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-batteryStatistics.md). -| Code| Error Message | -| -------- | -------------- | -| 4600101 | Operation failed. Cannot connect to service.| +| Code | Error Message | +|---------|---------| +| 4600101 | Operation failed. Cannot connect to service.| **Example** ```js try { - var value = batteryStats.getHardwareUnitPowerPercent(ConsumptionType.CONSUMPTION_TYPE_SCREEN); + var percent = batteryStats.getHardwareUnitPowerPercent(ConsumptionType.CONSUMPTION_TYPE_SCREEN); console.info('battery statistics percent of hardware is: ' + percent); } catch(err) { console.error('get battery statistics percent of hardware failed, err: ' + err); diff --git a/en/application-dev/reference/apis/js-apis-bluetooth.md b/en/application-dev/reference/apis/js-apis-bluetooth.md index b1528f9e2fa160f1616ba9a86370d4a6d721546b..f22961f16809055e3ab560afb78750e42030aec3 100644 --- a/en/application-dev/reference/apis/js-apis-bluetooth.md +++ b/en/application-dev/reference/apis/js-apis-bluetooth.md @@ -4,7 +4,8 @@ The **Bluetooth** module provides classic Bluetooth capabilities and Bluetooth L > **NOTE** > -> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> - The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> - The APIs provided by this module are no longer maintained since API version 9. You are advised to use [bluetoothManager](js-apis-bluetoothManager.md). @@ -15,12 +16,15 @@ import bluetooth from '@ohos.bluetooth'; ``` -## bluetooth.enableBluetooth8+ +## bluetooth.enableBluetooth8+(deprecated) enableBluetooth(): boolean Enables Bluetooth. +> **NOTE** +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.enableBluetooth](js-apis-bluetoothManager.md#bluetoothmanagerenablebluetooth). + **Required permissions**: ohos.permission.DISCOVER_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -38,12 +42,15 @@ let enable = bluetooth.enableBluetooth(); ``` -## bluetooth.disableBluetooth8+ +## bluetooth.disableBluetooth8+(deprecated) disableBluetooth(): boolean Disables Bluetooth. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.disableBluetooth](js-apis-bluetoothManager.md#bluetoothmanagerdisablebluetooth). + **Required permissions**: ohos.permission.DISCOVER_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -61,12 +68,15 @@ let disable = bluetooth.disableBluetooth(); ``` -## bluetooth.getLocalName8+ +## bluetooth.getLocalName8+(deprecated) getLocalName(): string Obtains the name of the local Bluetooth device. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.getLocalName](js-apis-bluetoothManager.md#bluetoothmanagergetlocalname). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -84,12 +94,15 @@ let localName = bluetooth.getLocalName(); ``` -## bluetooth.getState +## bluetooth.getState(deprecated) getState(): BluetoothState Obtains the Bluetooth state. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.getState](js-apis-bluetoothManager.md#bluetoothmanagergetstate). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -107,11 +120,14 @@ let state = bluetooth.getState(); ``` -## bluetooth.getBtConnectionState +## bluetooth.getBtConnectionState(deprecated) getBtConnectionState(): ProfileConnectionState -Obtains the profile connection state of this Bluetooth device. +Obtains the local profile connection state. + +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.getBtConnectionState](js-apis-bluetoothManager.md#bluetoothmanagergetbtconnectionstate). **Required permissions**: ohos.permission.USE_BLUETOOTH @@ -130,12 +146,15 @@ let connectionState = bluetooth.getBtConnectionState(); ``` -## bluetooth.setLocalName8+ +## bluetooth.setLocalName8+(deprecated) setLocalName(name: string): boolean Sets the name of the local Bluetooth device. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.setLocalName](js-apis-bluetoothManager.md#bluetoothmanagersetlocalname). + **Required permissions**: ohos.permission.DISCOVER_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -159,12 +178,15 @@ let ret = bluetooth.setLocalName('device_name'); ``` -## bluetooth.pairDevice +## bluetooth.pairDevice(deprecated) pairDevice(deviceId: string): boolean Initiates Bluetooth pairing. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.pairDevice](js-apis-bluetoothManager.md#bluetoothmanagerpairdevice). + **Required permissions**: ohos.permission.DISCOVER_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -189,11 +211,14 @@ let result = bluetooth.pairDevice("XX:XX:XX:XX:XX:XX"); ``` -## bluetooth.getProfileConnState8+ +## bluetooth.getProfileConnState8+(deprecated) getProfileConnState(profileId: ProfileId): ProfileConnectionState -Obtains the connection state of a profile. +Obtains the connection status of a specified profile. + +> **NOTE** +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.getProfileConnectionState](js-apis-bluetoothManager.md#bluetoothmanagergetprofileconnectionstate). **Required permissions**: ohos.permission.USE_BLUETOOTH @@ -218,12 +243,15 @@ let result = bluetooth.getProfileConnState(bluetooth.ProfileId.PROFILE_A2DP_SOUR ``` -## bluetooth.cancelPairedDevice8+ +## bluetooth.cancelPairedDevice8+(deprecated) cancelPairedDevice(deviceId: string): boolean Cancels a paired remote device. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.cancelPairedDevice](js-apis-bluetoothManager.md#bluetoothmanagercancelpaireddevice). + **System API**: This is a system API. **Required permissions**: ohos.permission.DISCOVER_BLUETOOTH @@ -249,12 +277,15 @@ let result = bluetooth.cancelPairedDevice("XX:XX:XX:XX:XX:XX"); ``` -## bluetooth.getRemoteDeviceName8+ +## bluetooth.getRemoteDeviceName8+(deprecated) getRemoteDeviceName(deviceId: string): string Obtains the name of the remote Bluetooth device. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.getRemoteDeviceName](js-apis-bluetoothManager.md#bluetoothmanagergetremotedevicename). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -278,12 +309,15 @@ let remoteDeviceName = bluetooth.getRemoteDeviceName("XX:XX:XX:XX:XX:XX"); ``` -## bluetooth.getRemoteDeviceClass8+ +## bluetooth.getRemoteDeviceClass8+(deprecated) getRemoteDeviceClass(deviceId: string): DeviceClass Obtains the class of the remote Bluetooth device. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.getRemoteDeviceClass](js-apis-bluetoothManager.md#bluetoothmanagergetremotedeviceclass). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -307,12 +341,15 @@ let remoteDeviceClass = bluetooth.getRemoteDeviceClass("XX:XX:XX:XX:XX:XX"); ``` -## bluetooth.getPairedDevices8+ +## bluetooth.getPairedDevices8+(deprecated) getPairedDevices(): Array<string> Obtains the paired devices. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.getPairedDevices](js-apis-bluetoothManager.md#bluetoothmanagergetpaireddevices). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -330,12 +367,15 @@ let devices = bluetooth.getPairedDevices(); ``` -## bluetooth.setBluetoothScanMode8+ +## bluetooth.setBluetoothScanMode8+(deprecated) setBluetoothScanMode(mode: ScanMode, duration: number): boolean Sets the Bluetooth scan mode so that the device can be discovered by a remote device. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.setBluetoothScanMode](js-apis-bluetoothManager.md#bluetoothmanagersetbluetoothscanmode). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -361,12 +401,15 @@ let result = bluetooth.setBluetoothScanMode(bluetooth.ScanMode.SCAN_MODE_CONNECT ``` -## bluetooth.getBluetoothScanMode8+ +## bluetooth.getBluetoothScanMode8+(deprecated) getBluetoothScanMode(): ScanMode Obtains the Bluetooth scan mode. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.getBluetoothScanMode](js-apis-bluetoothManager.md#bluetoothmanagergetbluetoothscanmode). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -384,12 +427,15 @@ let scanMode = bluetooth.getBluetoothScanMode(); ``` -## bluetooth.startBluetoothDiscovery8+ +## bluetooth.startBluetoothDiscovery8+(deprecated) startBluetoothDiscovery(): boolean Starts Bluetooth scan to discover remote devices. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.startBluetoothDiscovery](js-apis-bluetoothManager.md#bluetoothmanagerstartbluetoothdiscovery). + **Required permissions**: ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -412,12 +458,15 @@ let result = bluetooth.startBluetoothDiscovery(); ``` -## bluetooth.stopBluetoothDiscovery8+ +## bluetooth.stopBluetoothDiscovery8+(deprecated) stopBluetoothDiscovery(): boolean Stops Bluetooth scan. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.stopBluetoothDiscovery](js-apis-bluetoothManager.md#bluetoothmanagerstopbluetoothdiscovery). + **Required permissions**: ohos.permission.DISCOVER_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -435,12 +484,15 @@ let result = bluetooth.stopBluetoothDiscovery(); ``` -## bluetooth.setDevicePairingConfirmation8+ +## bluetooth.setDevicePairingConfirmation8+(deprecated) setDevicePairingConfirmation(device: string, accept: boolean): boolean Sets the device pairing confirmation. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.setDevicePairingConfirmation](js-apis-bluetoothManager.md#bluetoothmanagersetdevicepairingconfirmation). + **Required permissions**: ohos.permission.MANAGE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -470,12 +522,15 @@ bluetooth.on("pinRequired", onReceivePinRequiredEvent); ``` -## bluetooth.on('bluetoothDeviceFind')8+ +## bluetooth.on('bluetoothDeviceFind')8+(deprecated) on(type: "bluetoothDeviceFind", callback: Callback<Array<string>>): void Subscribes to the Bluetooth device discovery events. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.on('bluetoothDeviceFind')](js-apis-bluetoothManager.md#bluetoothmanageronbluetoothdevicefind). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -501,12 +556,15 @@ bluetooth.on('bluetoothDeviceFind', onReceiveEvent); ``` -## bluetooth.off('bluetoothDeviceFind')8+ +## bluetooth.off('bluetoothDeviceFind')8+(deprecated) off(type: "bluetoothDeviceFind", callback?: Callback<Array<string>>): void Unsubscribes from the Bluetooth device discovery events. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.off('bluetoothDeviceFind')](js-apis-bluetoothManager.md#bluetoothmanageroffbluetoothdevicefind). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -533,12 +591,15 @@ bluetooth.off('bluetoothDeviceFind', onReceiveEvent); ``` -## bluetooth.on('pinRequired')8+ +## bluetooth.on('pinRequired')8+(deprecated) on(type: "pinRequired", callback: Callback<PinRequiredParam>): void Subscribes to the pairing request events of the remote Bluetooth device. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.on('pinRequired')](js-apis-bluetoothManager.md#bluetoothmanageronpinrequired). + **Required permissions**: ohos.permission.DISCOVER_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -564,12 +625,15 @@ bluetooth.on('pinRequired', onReceiveEvent); ``` -## bluetooth.off('pinRequired')8+ +## bluetooth.off('pinRequired')8+(deprecated) off(type: "pinRequired", callback?: Callback<PinRequiredParam>): void Unsubscribes from the pairing request events of the remote Bluetooth device. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.off('pinRequired')](js-apis-bluetoothManager.md#bluetoothmanageroffpinrequired). + **Required permissions**: ohos.permission.DISCOVER_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -596,12 +660,15 @@ bluetooth.off('pinRequired', onReceiveEvent); ``` -## bluetooth.on('bondStateChange')8+ +## bluetooth.on('bondStateChange')8+(deprecated) on(type: "bondStateChange", callback: Callback<BondStateParam>): void Subscribes to the Bluetooth pairing state change events. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.on('bondStateChange')](js-apis-bluetoothManager.md#bluetoothmanageronbondstatechange). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -627,12 +694,15 @@ bluetooth.on('bondStateChange', onReceiveEvent); ``` -## bluetooth.off('bondStateChange')8+ +## bluetooth.off('bondStateChange')8+(deprecated) off(type: "bondStateChange", callback?: Callback<BondStateParam>): void Unsubscribes from the Bluetooth pairing state change events. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.off('bondStateChange')](js-apis-bluetoothManager.md#bluetoothmanageroffbondstatechange). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -659,12 +729,15 @@ bluetooth.off('bondStateChange', onReceiveEvent); ``` -## bluetooth.on('stateChange')8+ +## bluetooth.on('stateChange')8+(deprecated) on(type: "stateChange", callback: Callback<BluetoothState>): void Subscribes to the Bluetooth connection state change events. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.on('stateChange')](js-apis-bluetoothManager.md#bluetoothmanageronstatechange). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -690,12 +763,15 @@ bluetooth.on('stateChange', onReceiveEvent); ``` -## bluetooth.off('stateChange')8+ +## bluetooth.off('stateChange')8+(deprecated) off(type: "stateChange", callback?: Callback<BluetoothState>): void Unsubscribes from the Bluetooth connection state change events. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.off('stateChange')](js-apis-bluetoothManager.md#bluetoothmanageroffstatechange). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -722,12 +798,15 @@ bluetooth.off('stateChange', onReceiveEvent); ``` -## bluetooth.sppListen8+ +## bluetooth.sppListen8+(deprecated) sppListen(name: string, option: SppOption, callback: AsyncCallback<number>): void Creates a server listening socket. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.sppListen](js-apis-bluetoothManager.md#bluetoothmanagerspplisten). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -757,12 +836,15 @@ bluetooth.sppListen('server1', sppOption, serverSocket); ``` -## bluetooth.sppAccept8+ +## bluetooth.sppAccept8+(deprecated) sppAccept(serverSocket: number, callback: AsyncCallback<number>): void Listens for a connection to be made to this socket from the client and accepts it. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.sppAccept](js-apis-bluetoothManager.md#bluetoothmanagersppaccept). + **System capability**: SystemCapability.Communication.Bluetooth.Core **Parameters** @@ -796,12 +878,15 @@ bluetooth.sppAccept(serverNumber, acceptClientSocket); ``` -## bluetooth.sppConnect8+ +## bluetooth.sppConnect8+(deprecated) sppConnect(device: string, option: SppOption, callback: AsyncCallback<number>): void Initiates an SPP connection to a remote device from the client. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.sppConnect](js-apis-bluetoothManager.md#bluetoothmanagersppconnect). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -832,12 +917,15 @@ bluetooth.sppConnect('XX:XX:XX:XX:XX:XX', sppOption, clientSocket); ``` -## bluetooth.sppCloseServerSocket8+ +## bluetooth.sppCloseServerSocket8+(deprecated) sppCloseServerSocket(socket: number): void Closes the listening socket of the server. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.sppCloseServerSocket](js-apis-bluetoothManager.md#bluetoothmanagersppcloseserversocket). + **System capability**: SystemCapability.Communication.Bluetooth.Core **Parameters** @@ -861,12 +949,15 @@ bluetooth.sppCloseServerSocket(serverNumber); ``` -## bluetooth.sppCloseClientSocket8+ +## bluetooth.sppCloseClientSocket8+(deprecated) sppCloseClientSocket(socket: number): void Closes the client socket. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.sppCloseClientSocket](js-apis-bluetoothManager.md#bluetoothmanagersppcloseclientsocket). + **System capability**: SystemCapability.Communication.Bluetooth.Core **Parameters** @@ -892,12 +983,15 @@ bluetooth.sppCloseClientSocket(clientNumber); ``` -## bluetooth.sppWrite8+ +## bluetooth.sppWrite8+(deprecated) sppWrite(clientSocket: number, data: ArrayBuffer): boolean Writes data to the remote device through the socket. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.sppWrite](js-apis-bluetoothManager.md#bluetoothmanagersppwrite). + **System capability**: SystemCapability.Communication.Bluetooth.Core **Parameters** @@ -937,10 +1031,13 @@ if (ret) { ``` -## bluetooth.on('sppRead')8+ +## bluetooth.on('sppRead')8+(deprecated) on(type: "sppRead", clientSocket: number, callback: Callback<ArrayBuffer>): void +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.on('sppRead')](js-apis-bluetoothManager.md#bluetoothmanageronsppread). + Subscribes to the SPP read request events. **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -977,12 +1074,15 @@ bluetooth.on('sppRead', clientNumber, dataRead); ``` -## bluetooth.off('sppRead')8+ +## bluetooth.off('sppRead')8+(deprecated) off(type: "sppRead", clientSocket: number, callback?: Callback<ArrayBuffer>): void Unsubscribes from the SPP read request events. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.off('sppRead')](js-apis-bluetoothManager.md#bluetoothmanageroffsppread). + **System capability**: SystemCapability.Communication.Bluetooth.Core **Parameters** @@ -1013,12 +1113,15 @@ bluetooth.off('sppRead', clientNumber); ``` -## bluetooth.getProfile8+ +## bluetooth.getProfile8+(deprecated) getProfile(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfile Obtains a profile object. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.getProfileInstance](js-apis-bluetoothManager.md#bluetoothmanagergetprofileinstance). + **System capability**: SystemCapability.Communication.Bluetooth.Core **Parameters** @@ -1039,41 +1142,18 @@ Obtains a profile object. let a2dpSrc = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_A2DP_SOURCE); ``` -## bluetooth.getProfileInst9+ - -getProfileInst(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfile | HidHostProfile | PanProfile - -Obtains a profile instance. API version 9 is added with **HidHostProfile** and **PanProfile**. - -**System capability**: SystemCapability.Communication.Bluetooth.Core - -**Parameters** - -| Name | Type | Mandatory | Description | -| --------- | --------- | ---- | ------------------------------------- | -| profileId | [ProfileId](#ProfileId) | Yes | ID of the profile to obtain, for example, **PROFILE_A2DP_SOURCE**.| - -**Return value** - -| Type | Description | -| ------------------------------------------------------------ | ------------------------------------------------------------ | -| [A2dpSourceProfile](#a2dpsourceprofile), [HandsFreeAudioGatewayProfile](#handsfreeaudiogatewayprofile), [HidHostProfile](#hidhostprofile), or [PanProfile](#panprofile)| Profile instance obtained, which can be **A2dpSourceProfile**, **HandsFreeAudioGatewayProfile**, **HidHostProfile**, or **PanProfile**.| - -**Example** - -```js -let hidHost = bluetooth.getProfileInst(bluetooth.ProfileId.PROFILE_HID_HOST); -``` - ## bluetooth.BLE -### bluetooth.BLE.createGattServer +### bluetooth.BLE.createGattServer(deprecated) createGattServer(): GattServer Creates a **GattServer** instance. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.BLE.createGattServer](js-apis-bluetoothManager.md#bluetoothmanagerblecreategattserver). + **System capability**: SystemCapability.Communication.Bluetooth.Core **Return value** @@ -1089,12 +1169,15 @@ let gattServer = bluetooth.BLE.createGattServer(); ``` -### bluetooth.BLE.createGattClientDevice +### bluetooth.BLE.createGattClientDevice(deprecated) createGattClientDevice(deviceId: string): GattClientDevice Creates a **GattClientDevice** instance. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.BLE.createGattClientDevice](js-apis-bluetoothManager.md#bluetoothmanagerblecreategattclientdevice). + **System capability**: SystemCapability.Communication.Bluetooth.Core **Parameters** @@ -1116,12 +1199,15 @@ let device = bluetooth.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); ``` -### bluetooth.BLE.getConnectedBLEDevices +### bluetooth.BLE.getConnectedBLEDevices(deprecated) getConnectedBLEDevices(): Array<string> Obtains the BLE devices connected to this device. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.BLE.getConnectedBLEDevices](js-apis-bluetoothManager.md#bluetoothmanagerblegetconnectedbledevices). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -1139,12 +1225,15 @@ let result = bluetooth.BLE.getConnectedBLEDevices(); ``` -### bluetooth.BLE.startBLEScan +### bluetooth.BLE.startBLEScan(deprecated) startBLEScan(filters: Array<ScanFilter>, options?: ScanOptions): void Starts a BLE scan. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.BLE.startBLEScan](js-apis-bluetoothManager.md#bluetoothmanagerblestartblescan). + **Required permissions**: ohos.permission.DISCOVER_BLUETOOTH, ohos.permission.MANAGE_BLUETOOTH, and ohos.permission.LOCATION **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -1182,12 +1271,15 @@ bluetooth.BLE.startBLEScan( ``` -### bluetooth.BLE.stopBLEScan +### bluetooth.BLE.stopBLEScan(deprecated) stopBLEScan(): void Stops the BLE scan. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.BLE.stopBLEScan](js-apis-bluetoothManager.md#bluetoothmanagerblestopblescan). + **Required permissions**: ohos.permission.DISCOVER_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -1203,12 +1295,15 @@ bluetooth.BLE.stopBLEScan(); ``` -### bluetooth.BLE.on('BLEDeviceFind') +### bluetooth.BLE.on('BLEDeviceFind')(deprecated) on(type: "BLEDeviceFind", callback: Callback<Array<ScanResult>>): void Subscribe to the BLE device discovery events. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.BLE.on('BLEDeviceFind')](js-apis-bluetoothManager.md#bluetoothmanagerbleonbledevicefind). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -1234,12 +1329,15 @@ bluetooth.BLE.on('BLEDeviceFind', onReceiveEvent); ``` -### bluetooth.BLE.off('BLEDeviceFind') +### bluetooth.BLE.off('BLEDeviceFind')(deprecated) off(type: "BLEDeviceFind", callback?: Callback<Array<ScanResult>>): void Unsubscribes from the BLE device discovery events. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.BLE.off('BLEDeviceFind')](js-apis-bluetoothManager.md#bluetoothmanagerbleoffbledevicefind). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -1271,12 +1369,15 @@ bluetooth.BLE.off('BLEDeviceFind', onReceiveEvent); Provides the profile base class. -### getConnectionDevices8+ +### getConnectionDevices8+(deprecated) getConnectionDevices(): Array<string> Obtains the connected devices. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.BaseProfile.getConnectionDevices](js-apis-bluetoothManager.md#getconnectiondevices). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -1294,12 +1395,15 @@ let a2dpSrc = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_A2DP_SOURCE) as b let retArray = a2dpSrc.getConnectionDevices(); ``` -### getDeviceState8+ +### getDeviceState8+(deprecated) getDeviceState(device: string): ProfileConnectionState Obtains the connection state of the profile. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.BaseProfile.getDeviceState](js-apis-bluetoothManager.md#getdevicestate). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -1328,12 +1432,15 @@ let ret = a2dpSrc.getDeviceState('XX:XX:XX:XX:XX:XX'); Before using a method of **A2dpSourceProfile**, you need to create an instance of this class by using the **getProfile()** method. -### connect8+ +### connect8+(deprecated) connect(device: string): boolean Sets up an Advanced Audio Distribution Profile (A2DP) connection. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.A2dpSourceProfile.connect](js-apis-bluetoothManager.md#connect). + **Required permissions**: ohos.permission.DISCOVER_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -1358,12 +1465,15 @@ let ret = a2dpSrc.connect('XX:XX:XX:XX:XX:XX'); ``` -### disconnect8+ +### disconnect8+(deprecated) disconnect(device: string): boolean Disconnects an A2DP connection. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.A2dpSourceProfile.disconnect](js-apis-bluetoothManager.md#disconnect). + **Required permissions**: ohos.permission.DISCOVER_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -1388,12 +1498,15 @@ let ret = a2dpSrc.disconnect('XX:XX:XX:XX:XX:XX'); ``` -### on('connectionStateChange')8+ +### on('connectionStateChange')8+(deprecated) on(type: "connectionStateChange", callback: Callback<[StateChangeParam](#StateChangeParam)>): void Subscribes to the A2DP connection state change events. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.A2dpSourceProfile.on('connectionStateChange')](js-apis-bluetoothManager.md#onconnectionstatechange). + **System capability**: SystemCapability.Communication.Bluetooth.Core **Parameters** @@ -1418,12 +1531,15 @@ a2dpSrc.on('connectionStateChange', onReceiveEvent); ``` -### off('connectionStateChange')8+ +### off('connectionStateChange')8+(deprecated) off(type: "connectionStateChange", callback?: Callback<[StateChangeParam](#StateChangeParam)>): void Unsubscribes from the A2DP connection state change events. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.A2dpSourceProfile.off('connectionStateChange')](js-apis-bluetoothManager.md#offconnectionstatechange). + **System capability**: SystemCapability.Communication.Bluetooth.Core **Parameters** @@ -1431,7 +1547,7 @@ Unsubscribes from the A2DP connection state change events. | Name | Type | Mandatory | Description | | -------- | ---------------------------------------- | ---- | ---------------------------------------- | | type | string | Yes | Event type. The value **connectionStateChange** indicates an A2DP connection state change event.| -| callback | Callback<[StateChangeParam](#StateChangeParam)> | No | Callback used to return the A2DP connection state change event. | +| callback | Callback<[StateChangeParam](#StateChangeParam)> | No | Callback for the A2DP connection state change event. | **Return value** @@ -1449,12 +1565,15 @@ a2dpSrc.off('connectionStateChange', onReceiveEvent); ``` -### getPlayingState8+ +### getPlayingState8+(deprecated) getPlayingState(device: string): PlayingState Obtains the playing state of a device. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.A2dpSourceProfile.getPlayingState](js-apis-bluetoothManager.md#getplayingstate). + **System capability**: SystemCapability.Communication.Bluetooth.Core **Parameters** @@ -1482,12 +1601,15 @@ let state = a2dpSrc.getPlayingState('XX:XX:XX:XX:XX:XX'); Before using a method of **HandsFreeAudioGatewayProfile**, you need to create an instance of this class by using the **getProfile()** method. -### connect8+ +### connect8+(deprecated) connect(device: string): boolean Sets up a Hands-free Profile (HFP) connection of a device. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.HandsFreeAudioGatewayProfile.connect](js-apis-bluetoothManager.md#connect-1). + **Required permissions**: ohos.permission.DISCOVER_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -1513,12 +1635,15 @@ let ret = hfpAg.connect('XX:XX:XX:XX:XX:XX'); ``` -### disconnect8+ +### disconnect8+(deprecated) disconnect(device: string): boolean Disconnects the HFP connection of a device. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.HandsFreeAudioGatewayProfile.disconnect](js-apis-bluetoothManager.md#disconnect-1). + **Required permissions**: ohos.permission.DISCOVER_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -1544,12 +1669,15 @@ let ret = hfpAg.disconnect('XX:XX:XX:XX:XX:XX'); ``` -### on('connectionStateChange')8+ +### on('connectionStateChange')8+(deprecated) on(type: "connectionStateChange", callback: Callback<[StateChangeParam](#StateChangeParam)>): void Subscribes to the HFP connection state change events. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.HandsFreeAudioGatewayProfile.on('connectionStateChange')](js-apis-bluetoothManager.md#onconnectionstatechange-1). + **System capability**: SystemCapability.Communication.Bluetooth.Core **Parameters** @@ -1575,12 +1703,15 @@ hfpAg.on('connectionStateChange', onReceiveEvent); ``` -### off('connectionStateChange')8+ +### off('connectionStateChange')8+(deprecated) off(type: "connectionStateChange", callback?: Callback<[StateChangeParam](#StateChangeParam)>): void Unsubscribes from the HFP connection state change events. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.HandsFreeAudioGatewayProfile.off('connectionStateChange')](js-apis-bluetoothManager.md#offconnectionstatechange-1). + **System capability**: SystemCapability.Communication.Bluetooth.Core **Parameters** @@ -1607,301 +1738,20 @@ hfpAg.off('connectionStateChange', onReceiveEvent); ``` -## HidHostProfile - -Before using a method of **HidHostProfile**, you need to create an instance of this class by using the **getProfile()** method. - - -### connect9+ - -connect(device: string): boolean - -Connects to the HidHost service of a device. - -**System API**: This is a system API. - -**Required permissions**: ohos.permission.DISCOVER_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 hidHostProfile = bluetooth.getProfileInst(bluetooth.ProfileId.PROFILE_HID_HOST) as bluetooth.HidHostProfile; -let ret = hidHostProfile.connect('XX:XX:XX:XX:XX:XX'); -``` - - -### disconnect9+ - -disconnect(device: string): boolean - -Disconnects from the HidHost service of a device. - -**System API**: This is a system API. - -**Required permissions**: ohos.permission.DISCOVER_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 hidHostProfile = bluetooth.getProfileInst(bluetooth.ProfileId.PROFILE_HID_HOST) as bluetooth.HidHostProfile; -let ret = hidHostProfile.disconnect('XX:XX:XX:XX:XX:XX'); -``` - - -### on('connectionStateChange')9+ - -on(type: "connectionStateChange", callback: Callback<[StateChangeParam](#StateChangeParam)>): void - -Subscribes to the HidHost 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 HidHost connection state change event.| -| callback | Callback<[StateChangeParam](#StateChangeParam)> | Yes | Callback invoked to return the HidHost connection state change event. | - -**Return value** - -No value is returned. - -**Example** - -```js -function onReceiveEvent(data) { - console.info('hidHost state = '+ JSON.stringify(data)); -} -let hidHost = bluetooth.getProfileInst(bluetooth.ProfileId.PROFILE_HID_HOST) as bluetooth.HidHostProfile; -hidHost.on('connectionStateChange', onReceiveEvent); -``` - - -### off('connectionStateChange')9+ - -off(type: "connectionStateChange", callback?: Callback<[StateChangeParam](#StateChangeParam)>): void - -Unsubscribes from the HidHost 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 HidHost connection state change event.| -| callback | Callback<[StateChangeParam](#StateChangeParam)> | No | Callback for the HidHost connection state change event. | - -**Return value** - -No value is returned. - -**Example** - -```js -function onReceiveEvent(data) { - console.info('hidHost state = '+ JSON.stringify(data)); -} -let hidHost = bluetooth.getProfileInst(bluetooth.ProfileId.PROFILE_HID_HOST) as bluetooth.HidHostProfile; -hidHost.on('connectionStateChange', onReceiveEvent); -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. - -**System API**: 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.getProfileInst(bluetooth.ProfileId.PROFILE_PAN_NETWORK) as bluetooth.PanProfile; -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 invoked 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.getProfileInst(bluetooth.ProfileId.PROFILE_PAN_NETWORK) as bluetooth.PanProfile; -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 for 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.getProfileInst(bluetooth.ProfileId.PROFILE_PAN_NETWORK) as bluetooth.PanProfile; -panProfile.on('connectionStateChange', onReceiveEvent); -panProfile.off('connectionStateChange', onReceiveEvent); -``` - - -### setTethering9+ - -setTethering(enable: boolean): void - -Sets tethering. - -**System API**: 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.getProfileInst(bluetooth.ProfileId.PROFILE_PAN_NETWORK) as bluetooth.PanProfile; -let ret = panProfile.setTethering(true); -``` - - -### isTetheringOn9+ - -isTetheringOn(): boolean - -Obtains the tethering state. - -**System API**: This is a system API. - -**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.getProfileInst(bluetooth.ProfileId.PROFILE_PAN_NETWORK) as bluetooth.PanProfile; -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. -### startAdvertising +### startAdvertising(deprecated) startAdvertising(setting: AdvertiseSetting, advData: AdvertiseData, advResponse?: AdvertiseData): void Starts BLE advertising. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattServer.startAdvertising](js-apis-bluetoothManager.md#startadvertising). + **Required permissions**: ohos.permission.DISCOVER_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -1963,12 +1813,15 @@ gattServer.startAdvertising({ ``` -### stopAdvertising +### stopAdvertising(deprecated) stopAdvertising(): void Stops BLE advertising. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattServer.stopAdvertising](js-apis-bluetoothManager.md#stopadvertising). + **Required permissions**: ohos.permission.DISCOVER_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -1985,12 +1838,15 @@ server.stopAdvertising(); ``` -### addService +### addService(deprecated) addService(service: GattService): boolean Adds a service to this GATT server. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattServer.addService](js-apis-bluetoothManager.md#addservice). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -2044,12 +1900,15 @@ if (ret) { ``` -### removeService +### removeService(deprecated) removeService(serviceUuid: string): boolean Removes a service from this GATT server. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattServer.removeService](js-apis-bluetoothManager.md#removeservice). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -2074,12 +1933,15 @@ server.removeService('00001810-0000-1000-8000-00805F9B34FB'); ``` -### close +### close(deprecated) close(): void Closes this GATT server to unregister it from the protocol stack. After this method is called, this [GattServer](#gattserver) cannot be used. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattServer.close](js-apis-bluetoothManager.md#close). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -2092,12 +1954,15 @@ server.close(); ``` -### notifyCharacteristicChanged +### notifyCharacteristicChanged(deprecated) notifyCharacteristicChanged(deviceId: string, notifyCharacteristic: NotifyCharacteristic): boolean Notifies the connected client device when a characteristic value changes. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattServer.notifyCharacteristicChanged](js-apis-bluetoothManager.md#notifycharacteristicchanged). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -2137,12 +2002,15 @@ server.notifyCharacteristicChanged('XX:XX:XX:XX:XX:XX', notifyCharacteristic); ``` -### sendResponse +### sendResponse(deprecated) sendResponse(serverResponse: ServerResponse): boolean Sends a response to a read or write request from the GATT client. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattServer.sendResponse](js-apis-bluetoothManager.md#sendresponse). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -2184,12 +2052,15 @@ if (ret) { ``` -### on('characteristicRead') +### on('characteristicRead')(deprecated) on(type: "characteristicRead", callback: Callback<CharacteristicReadReq>): void Subscribes to the characteristic read request events. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattServer.on('characteristicRead')](js-apis-bluetoothManager.md#oncharacteristicread). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -2232,12 +2103,15 @@ gattServer.on("characteristicRead", ReadCharacteristicReq); ``` -### off('characteristicRead') +### off('characteristicRead')(deprecated) off(type: "characteristicRead", callback?: Callback<CharacteristicReadReq>): void Unsubscribes from the characteristic read request events. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattServer.off('characteristicRead')](js-apis-bluetoothManager.md#offcharacteristicread). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -2261,12 +2135,15 @@ gattServer.off("characteristicRead"); ``` -### on('characteristicWrite') +### on('characteristicWrite')(deprecated) on(type: "characteristicWrite", callback: Callback<CharacteristicWriteReq>): void Subscribes to the characteristic write request events. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattServer.on('characteristicWrite')](js-apis-bluetoothManager.md#oncharacteristicwrite). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -2312,12 +2189,15 @@ gattServer.on("characteristicWrite", WriteCharacteristicReq); ``` -### off('characteristicWrite') +### off('characteristicWrite')(deprecated) off(type: "characteristicWrite", callback?: Callback<CharacteristicWriteReq>): void Unsubscribes from the characteristic write request events. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattServer.off('characteristicWrite')](js-apis-bluetoothManager.md#offcharacteristicwrite). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -2341,12 +2221,15 @@ gattServer.off("characteristicWrite"); ``` -### on('descriptorRead') +### on('descriptorRead')(deprecated) on(type: "descriptorRead", callback: Callback<DescriptorReadReq>): void Subscribes to the descriptor read request events. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattServer.on('descriptorRead')](js-apis-bluetoothManager.md#ondescriptorread). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -2389,12 +2272,15 @@ gattServer.on("descriptorRead", ReadDescriptorReq); ``` -### off('descriptorRead') +### off('descriptorRead')(deprecated) off(type: "descriptorRead", callback?: Callback<DescriptorReadReq>): void Unsubscribes from the descriptor read request events. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattServer.off('descriptorRead')](js-apis-bluetoothManager.md#offdescriptorread). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -2418,12 +2304,15 @@ gattServer.off("descriptorRead"); ``` -### on('descriptorWrite') +### on('descriptorWrite')(deprecated) on(type: "descriptorWrite", callback: Callback<DescriptorWriteReq>): void Subscribes to the descriptor write request events. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattServer.on('descriptorWrite')](js-apis-bluetoothManager.md#ondescriptorwrite). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -2469,12 +2358,15 @@ gattServer.on("descriptorRead", WriteDescriptorReq); ``` -### off('descriptorWrite') +### off('descriptorWrite')(deprecated) off(type: "descriptorWrite", callback?: Callback<DescriptorWriteReq>): void Unsubscribes from the descriptor write request events. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattServer.off('descriptorWrite')](js-apis-bluetoothManager.md#offdescriptorwrite). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -2498,12 +2390,15 @@ gattServer.off("descriptorWrite"); ``` -### on('connectStateChange') +### on('connectStateChange')(deprecated) on(type: "connectStateChange", callback: Callback<BLEConnectChangedState>): void Subscribes to the BLE connection state change events. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattServer.on('connectStateChange')](js-apis-bluetoothManager.md#onconnectstatechange). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -2532,12 +2427,15 @@ gattServer.on("connectStateChange", Connected); ``` -### off('connectStateChange') +### off('connectStateChange')(deprecated) off(type: "connectStateChange", callback?: Callback<BLEConnectChangedState>): void Unsubscribes from the BLE connection state change events. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattServer.off('connectStateChange')](js-apis-bluetoothManager.md#offconnectstatechange). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -2566,12 +2464,15 @@ gattServer.off("connectStateChange"); Implements the GATT client. Before using a method of this class, you must create a **GattClientDevice** instance using the **createGattClientDevice(deviceId: string)** method. -### connect +### connect(deprecated) connect(): boolean Initiates a connection to the remote BLE device. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattClientDevice.connect](js-apis-bluetoothManager.md#connect-3). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -2590,12 +2491,15 @@ let ret = device.connect(); ``` -### disconnect +### disconnect(deprecated) disconnect(): boolean Disconnects from the remote BLE device. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattClientDevice.disconnect](js-apis-bluetoothManager.md#disconnect-4). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -2614,12 +2518,15 @@ let ret = device.disconnect(); ``` -### close +### close(deprecated) close(): boolean Closes this GATT client to unregister it from the protocol stack. After this method is called, this [GattClientDevice](#gattclientdevice) instance cannot be used. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattClientDevice.close](js-apis-bluetoothManager.md#close-1). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -2640,12 +2547,15 @@ let ret = device.close(); -### getServices +### getServices(deprecated) getServices(callback: AsyncCallback<Array<GattService>>): void Obtains all services of the remote BLE device. This API uses an asynchronous callback to return the result. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattClientDevice.getServices](js-apis-bluetoothManager.md#getservices). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -2682,12 +2592,15 @@ device.getServices(getServices); ``` -### getServices +### getServices(deprecated) getServices(): Promise<Array<GattService>> Obtains all services of the remote BLE device. This API uses a promise to return the result. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattClientDevice.getServices](js-apis-bluetoothManager.md#getservices-1). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -2710,12 +2623,15 @@ device.getServices().then(result => { ``` -### readCharacteristicValue +### readCharacteristicValue(deprecated) 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. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattClientDevice.readCharacteristicValue](js-apis-bluetoothManager.md#readcharacteristicvalue). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -2764,12 +2680,15 @@ device.readCharacteristicValue(characteristic, readCcc); ``` -### readCharacteristicValue +### readCharacteristicValue(deprecated) 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. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattClientDevice.readCharacteristicValue](js-apis-bluetoothManager.md#readcharacteristicvalue-1). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -2810,12 +2729,15 @@ device.readCharacteristicValue(characteristic); ``` -### readDescriptorValue +### readDescriptorValue(deprecated) 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. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattClientDevice.readDescriptorValue](js-apis-bluetoothManager.md#readdescriptorvalue). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -2854,12 +2776,15 @@ device.readDescriptorValue(descriptor, readDesc); ``` -### readDescriptorValue +### readDescriptorValue(deprecated) 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. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattClientDevice.readDescriptorValue](js-apis-bluetoothManager.md#readdescriptorvalue-1). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -2890,12 +2815,15 @@ device.readDescriptorValue(descriptor); ``` -### writeCharacteristicValue +### writeCharacteristicValue(deprecated) writeCharacteristicValue(characteristic: BLECharacteristic): boolean Writes a characteristic value to the remote BLE device. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattClientDevice.writeCharacteristicValue](js-apis-bluetoothManager.md#writecharacteristicvalue). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -2940,12 +2868,15 @@ if (retWriteCcc) { ``` -### writeDescriptorValue +### writeDescriptorValue(deprecated) writeDescriptorValue(descriptor: BLEDescriptor): boolean Writes binary data to the specific descriptor of the remote BLE device. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattClientDevice.writeDescriptorValue](js-apis-bluetoothManager.md#writedescriptorvalue). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -2981,12 +2912,15 @@ if (retWriteDesc) { ``` -### setBLEMtuSize +### setBLEMtuSize(deprecated) setBLEMtuSize(mtu: number): boolean Sets the maximum transmission unit (MTU) that can be transmitted between the GATT client and its remote BLE device. This API can be used only after a connection is set up by calling [connect](#connect). +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattClientDevice.setBLEMtuSize](js-apis-bluetoothManager.md#setblemtusize). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -3011,12 +2945,15 @@ device.setBLEMtuSize(128); ``` -### setNotifyCharacteristicChanged +### setNotifyCharacteristicChanged(deprecated) setNotifyCharacteristicChanged(characteristic: BLECharacteristic, enable: boolean): boolean Sets the function of notifying the GATT client when the characteristic value of the remote BLE device changes. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattClientDevice.setNotifyCharacteristicChanged](js-apis-bluetoothManager.md#setnotifycharacteristicchanged). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -3054,12 +2991,15 @@ device.setNotifyCharacteristicChanged(characteristic, false); ``` -### on('BLECharacteristicChange') +### on('BLECharacteristicChange')(deprecated) on(type: "BLECharacteristicChange", callback: Callback<BLECharacteristic>): void Subscribes to the BLE characteristic change events. The client can receive a notification from the server only after the **setNotifyCharacteristicChanged** method is called. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattClientDevice.on('BLECharacteristicChange')](js-apis-bluetoothManager.md#onblecharacteristicchange). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -3088,12 +3028,15 @@ device.on('BLECharacteristicChange', CharacteristicChange); ``` -### off('BLECharacteristicChange') +### off('BLECharacteristicChange')(deprecated) off(type: "BLECharacteristicChange", callback?: Callback<BLECharacteristic>): void Unsubscribes from the BLE characteristic change events. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattClientDevice.off('BLECharacteristicChange')](js-apis-bluetoothManager.md#offblecharacteristicchange). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -3117,12 +3060,15 @@ device.off('BLECharacteristicChange'); ``` -### on('BLEConnectionStateChange') +### on('BLEConnectionStateChange')(deprecated) on(type: "BLEConnectionStateChange", callback: Callback<BLEConnectChangedState>): void Subscribes to the BLE connection state change events. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattClientDevice.on('BLEConnectionStateChange')](js-apis-bluetoothManager.md#onbleconnectionstatechange). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -3150,12 +3096,15 @@ device.on('BLEConnectionStateChange', ConnectStateChanged); ``` -### off('BLEConnectionStateChange') +### off('BLEConnectionStateChange')(deprecated) off(type: "BLEConnectionStateChange", callback?: Callback<BLEConnectChangedState>): void Unsubscribes from the BLE connection state change events. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattClientDevice.off('BLEConnectionStateChange')](js-apis-bluetoothManager.md#offbleconnectionstatechange). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -3179,12 +3128,15 @@ device.off('BLEConnectionStateChange'); ``` -### getDeviceName +### getDeviceName(deprecated) getDeviceName(callback: AsyncCallback<string>): void Obtains the name of the remote BLE device. This API uses an asynchronous callback to return the result. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattClientDevice.getDeviceName](js-apis-bluetoothManager.md#getdevicename). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -3211,12 +3163,15 @@ let deviceName = gattClient.getDeviceName((err, data)=> { ``` -### getDeviceName +### getDeviceName(deprecated) getDeviceName(): Promise<string> Obtains the name of the remote BLE device. This API uses a promise to return the result. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattClientDevice.getDeviceName](js-apis-bluetoothManager.md#getdevicename-1). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -3239,12 +3194,15 @@ let deviceName = gattClient.getDeviceName().then((data) => { ``` -### getRssiValue +### getRssiValue(deprecated) getRssiValue(callback: AsyncCallback<number>): void Obtains the received signal strength indication (RSSI) of the remote BLE device. This API uses an asynchronous callback to return the result. It can be used only after a connection is set up by calling [connect](#connect). +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattClientDevice.getRssiValue](js-apis-bluetoothManager.md#getrssivalue). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -3272,12 +3230,15 @@ let rssi = gattClient.getRssiValue((err, data)=> { ``` -### getRssiValue +### getRssiValue(deprecated) getRssiValue(): Promise<number> Obtains the RSSI of the remote BLE device. This API uses a promise to return the result. It can be used only after a connection is set up by calling [connect](#connect). +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattClientDevice.getRssiValue](js-apis-bluetoothManager.md#getrssivalue-1). + **Required permissions**: ohos.permission.USE_BLUETOOTH **System capability**: SystemCapability.Communication.Bluetooth.Core @@ -3298,10 +3259,13 @@ let rssi = gattClient.getRssiValue().then((data) => { }) ``` -## ScanMode8+ +## ScanMode8+(deprecated) Enumerates the scan modes. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.ScanMode](js-apis-bluetoothManager.md#scanmode). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Value | Description | @@ -3313,10 +3277,13 @@ Enumerates the scan modes. | SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE | 4 | General connectable and discoverable mode.| | SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE | 5 | Limited connectable and discoverable mode.| -## BondState8+ +## BondState8+(deprecated) Enumerates the pairing states. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.BondState](js-apis-bluetoothManager.md#bondstate). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Value | Description | @@ -3326,10 +3293,13 @@ Enumerates the pairing states. | BOND_STATE_BONDED | 2 | Paired. | -## SppOption8+ +## SppOption8+(deprecated) Defines the SPP configuration parameters. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.SppOption](js-apis-bluetoothManager.md#sppoption). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Type | Readable | Writable | Description | @@ -3339,10 +3309,13 @@ Defines the SPP configuration parameters. | type | [SppType](#spptype) | Yes | Yes | Type of the SPP link. | -## SppType8+ +## SppType8+(deprecated) Enumerates the SPP link types. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.SppType](js-apis-bluetoothManager.md#spptype). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Value | Description | @@ -3350,10 +3323,13 @@ Enumerates the SPP link types. | SPP_RFCOMM | 0 | Radio frequency communication (RFCOMM) link type.| -## GattService +## GattService(deprecated) Defines the GATT service API parameters. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.GattService](js-apis-bluetoothManager.md#gattservice). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Type | Readable | Writable | Description | @@ -3364,10 +3340,13 @@ Defines the GATT service API parameters. | includeServices | Array<[GattService](#gattservice)> | Yes | Yes | Services on which the service depends. | -## BLECharacteristic +## BLECharacteristic(deprecated) Defines the characteristic API parameters. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.BLECharacteristic](js-apis-bluetoothManager.md#blecharacteristic). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Type | Readable | Writable | Description | @@ -3378,10 +3357,13 @@ Defines the characteristic API parameters. | descriptors | Array<[BLEDescriptor](#bledescriptor)> | Yes | Yes | List of descriptors of the characteristic. | -## BLEDescriptor +## BLEDescriptor(deprecated) Defines the descriptor API parameters. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.BLEDescriptor](js-apis-bluetoothManager.md#bledescriptor). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Type | Readable | Writable | Description | @@ -3392,10 +3374,13 @@ Defines the descriptor API parameters. | descriptorValue | ArrayBuffer | Yes | Yes | Binary value of the descriptor. | -## NotifyCharacteristic +## NotifyCharacteristic(deprecated) Defines the parameters in the notifications sent when the server characteristic value changes. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.NotifyCharacteristic](js-apis-bluetoothManager.md#notifycharacteristic). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Type | Readable | Writable | Description | @@ -3406,10 +3391,13 @@ Defines the parameters in the notifications sent when the server characteristic | confirm | boolean | Yes | Yes | Whether the notification needs to be confirmed by the remote end. For a notification, set it to **true**. In this case, the remote end must confirm the receipt of the notification. For an indication, set it to **false**. In this case, the remote end does not need to confirm the receipt of the notification.| -## CharacteristicReadReq +## CharacteristicReadReq(deprecated) Defines the parameters of the **CharacteristicReadReq** event received by the server. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.CharacteristicReadRequest](js-apis-bluetoothManager.md#characteristicreadrequest). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Type | Readable | Writable | Description | @@ -3421,10 +3409,13 @@ Defines the parameters of the **CharacteristicReadReq** event received by the se | serviceUuid | string | Yes | No | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| -## CharacteristicWriteReq +## CharacteristicWriteReq(deprecated) Defines the parameters of the **CharacteristicWriteReq** event received by the server. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.CharacteristicWriteRequest](js-apis-bluetoothManager.md#characteristicwriterequest). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Type | Readable | Writable | Description | @@ -3437,10 +3428,13 @@ Defines the parameters of the **CharacteristicWriteReq** event received by the s | serviceUuid | string | Yes | No | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| -## DescriptorReadReq +## DescriptorReadReq(deprecated) Defines the parameters of the **DescriptorReadReq** event received by the server. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.DescriptorReadRequest](js-apis-bluetoothManager.md#descriptorreadrequest). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Type | Readable | Writable | Description | @@ -3453,10 +3447,13 @@ Defines the parameters of the **DescriptorReadReq** event received by the server | serviceUuid | string | Yes | No | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| -## DescriptorWriteReq +## DescriptorWriteReq(deprecated) Defines the parameters of the **DescriptorWriteReq** event received by the server. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.DescriptorWriteRequest](js-apis-bluetoothManager.md#descriptorwriterequest). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Type | Readable | Writable | Description | @@ -3472,10 +3469,13 @@ Defines the parameters of the **DescriptorWriteReq** event received by the serve | serviceUuid | string | Yes | No | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| -## ServerResponse +## ServerResponse(deprecated) Defines the parameters of the server's response to the GATT client's read/write request. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.ServerResponse](js-apis-bluetoothManager.md#serverresponse). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Type | Readable | Writable | Description | @@ -3487,10 +3487,13 @@ Defines the parameters of the server's response to the GATT client's read/write | value | ArrayBuffer | Yes | No | Binary data in the response. | -## BLEConnectChangedState +## BLEConnectChangedState(deprecated) Defines the parameters of **BLEConnectChangedState**. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.BLEConnectChangedState](js-apis-bluetoothManager.md#bleconnectchangedstate). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Type | Readable| Writable| Description | @@ -3499,10 +3502,13 @@ Defines the parameters of **BLEConnectChangedState**. | state | [ProfileConnectionState](#profileconnectionstate) | Yes | Yes | BLE connection state. | -## ProfileConnectionState +## ProfileConnectionState(deprecated) Enumerates the profile connection states. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.ProfileConnectionState](js-apis-bluetoothManager.md#profileconnectionstate). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Value | Description | @@ -3513,10 +3519,13 @@ Enumerates the profile connection states. | STATE_DISCONNECTING | 3 | Disconnecting.| -## ScanFilter +## ScanFilter(deprecated) Defines the scan filter parameters. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.ScanFilter](js-apis-bluetoothManager.md#scanfilter). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Type | Readable| Writable| Description | @@ -3524,20 +3533,15 @@ Defines the scan filter parameters. | deviceId | string | Yes | Yes | Address of the BLE device to filter, for example, XX:XX:XX:XX:XX:XX. | | name | string | Yes | Yes | Name of the BLE device to filter. | | serviceUuid | string | Yes | Yes | Service UUID of the device to filter, for example, **00001888-0000-1000-8000-00805f9b34fb**.| -| serviceUuidMask9+ | string | Yes | Yes | Service UUID mask of the device to filter, for example, **FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF**.| -| serviceSolicitationUuid9+ | string | Yes | Yes | Service solicitation UUID of the device to filter, for example, **00001888-0000-1000-8000-00805F9B34FB**.| -| serviceSolicitationUuidMask9+ | string | Yes | Yes | Service solicitation UUID mask of the device to filter, for example, **FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF**.| -| serviceData9+ | ArrayBuffer | Yes | Yes | Service data of the device to filter, for example, **[0x90, 0x00, 0xF1, 0xF2]**.| -| serviceDataMask9+ | ArrayBuffer | Yes | Yes | Service data mask of the device to filter, for example, **[0xFF,0xFF,0xFF,0xFF]**.| -| manufactureId9+ | number | Yes | Yes | Manufacturer ID of the device to filter, for example, **0x0006**. | -| manufactureData9+ | ArrayBuffer | Yes | Yes | Manufacturer data of the device to filter, for example, **[0x1F,0x2F,0x3F]**.| -| manufactureDataMask9+ | ArrayBuffer | Yes | Yes | Manufacturer data mask of the device to filter, for example, **[0xFF, 0xFF, 0xFF]**.| -## ScanOptions +## ScanOptions(deprecated) Defines the scan configuration parameters. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.ScanOptions](js-apis-bluetoothManager.md#scanoptions). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Type | Readable | Writable | Description | @@ -3547,10 +3551,13 @@ Defines the scan configuration parameters. | matchMode | [MatchMode](#matchmode) | Yes | Yes | Hardware filtering match mode. The default value is **MATCH_MODE_AGGRESSIVE**.| -## ScanDuty +## ScanDuty(deprecated) Enumerates the scan duty options. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.ScanDuty](js-apis-bluetoothManager.md#scanduty). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Value | Description | @@ -3560,10 +3567,13 @@ Enumerates the scan duty options. | SCAN_MODE_LOW_LATENCY | 2 | Low-latency mode. | -## MatchMode +## MatchMode(deprecated) Enumerates the hardware match modes of BLE scan filters. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.MatchMode](js-apis-bluetoothManager.md#matchmode). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Value | Description | @@ -3572,10 +3582,13 @@ Enumerates the hardware match modes of BLE scan filters. | MATCH_MODE_STICKY | 2 | Hardware reports the scan result with a higher threshold of signal strength and sightings. | -## ScanResult +## ScanResult(deprecated) Defines the scan result. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.ScanResult](js-apis-bluetoothManager.md#scanresult). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Type | Readable | Writable | Description | @@ -3585,10 +3598,13 @@ Defines the scan result. | data | ArrayBuffer | Yes | No | Advertisement packets sent by the device. | -## BluetoothState +## BluetoothState(deprecated) Enumerates the Bluetooth states. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.BluetoothState](js-apis-bluetoothManager.md#bluetoothstate). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Value | Description | @@ -3602,10 +3618,13 @@ Enumerates the Bluetooth states. | STATE_BLE_TURNING_OFF | 6 | The LE-only mode is being turned off for Bluetooth.| -## AdvertiseSetting +## AdvertiseSetting(deprecated) Defines the BLE advertising parameters. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.AdvertiseSetting](js-apis-bluetoothManager.md#advertisesetting). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Type | Readable | Writable | Description | @@ -3615,10 +3634,13 @@ Defines the BLE advertising parameters. | connectable | boolean | Yes | Yes | Whether the advertisement is connectable. The default value is **true**. | -## AdvertiseData +## AdvertiseData(deprecated) Defines the content of a BLE advertisement packet. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.AdvertiseData](js-apis-bluetoothManager.md#advertisedata). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Type | Readable | Writable | Description | @@ -3628,10 +3650,13 @@ Defines the content of a BLE advertisement packet. | serviceData | Array<[ServiceData](#servicedata)> | Yes | Yes | List of service data to broadcast. | -## ManufactureData +## ManufactureData(deprecated) Defines the content of a BLE advertisement packet. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.ManufactureData](js-apis-bluetoothManager.md#manufacturedata). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Type | Readable | Writable | Description | @@ -3640,10 +3665,13 @@ Defines the content of a BLE advertisement packet. | manufactureValue | ArrayBuffer | Yes | Yes | Manufacturer data. | -## ServiceData +## ServiceData(deprecated) Defines the service data contained in an advertisement packet. +> **NOTE**
+> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [bluetoothManager.ServiceData](js-apis-bluetoothManager.md#servicedata). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Type | Readable | Writable | Description | @@ -3652,10 +3680,13 @@ Defines the service data contained in an advertisement packet. | serviceValue | ArrayBuffer | Yes | Yes | Service data. | -## PinRequiredParam8+ +## PinRequiredParam8+(deprecated) Defines the pairing request parameters. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.PinRequiredParam](js-apis-bluetoothManager.md#pinrequiredparam). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Type | Readable | Writable | Description | @@ -3664,10 +3695,13 @@ Defines the pairing request parameters. | pinCode | string | Yes | No | Key for the device pairing. | -## BondStateParam8+ +## BondStateParam8+(deprecated) Defines the pairing state parameters. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.BondStateParam](js-apis-bluetoothManager.md#bondstateparam). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Type | Readable | Writable | Description | @@ -3676,10 +3710,13 @@ Defines the pairing state parameters. | state | BondState | Yes | No | State of the device.| -## StateChangeParam8+ +## StateChangeParam8+(deprecated) Defines the profile state change parameters. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.StateChangeParam](js-apis-bluetoothManager.md#statechangeparam). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Type | Readable| Writable| Description | @@ -3688,10 +3725,13 @@ Defines the profile state change parameters. | state | [ProfileConnectionState](#profileconnectionstate) | Yes | No | Profile connection state of the device.| -## DeviceClass8+ +## DeviceClass8+(deprecated) Defines the class of a Bluetooth device. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.DeviceClass](js-apis-bluetoothManager.md#deviceclass). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Type | Readable | Writable | Description | @@ -3702,10 +3742,13 @@ Defines the class of a Bluetooth device. -## MajorClass8+ +## MajorClass8+(deprecated) Enumerates the major classes of Bluetooth devices. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.MajorClass](js-apis-bluetoothManager.md#majorclass). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Value | Description | @@ -3723,10 +3766,13 @@ Enumerates the major classes of Bluetooth devices. | MAJOR_UNCATEGORIZED | 0x1F00 | Unclassified device. | -## MajorMinorClass8+ +## MajorMinorClass8+(deprecated) Enumerates the major and minor classes of Bluetooth devices. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.MajorMinorClass](js-apis-bluetoothManager.md#majorminorclass). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Value | Description | @@ -3819,10 +3865,13 @@ Enumerates the major and minor classes of Bluetooth devices. | HEALTH_PERSONAL_MOBILITY_DEVICE | 0x093C | Personal mobility device. | -## PlayingState8+ +## PlayingState8+(deprecated) Enumerates the A2DP playing states. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.PlayingState](js-apis-bluetoothManager.md#playingstate). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Value | Description | @@ -3831,15 +3880,16 @@ Enumerates the A2DP playing states. | STATE_PLAYING | 0x0001 | Playing.| -## ProfileId8+ +## ProfileId8+(deprecated) Enumerates the Bluetooth profiles. API version 9 is added with **PROFILE_HID_HOST** and **PROFILE_PAN_NETWORK**. +> **NOTE**
+> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [bluetoothManager.ProfileId](js-apis-bluetoothManager.md#profileid). + **System capability**: SystemCapability.Communication.Bluetooth.Core | Name | Value | Description | | -------------------------------- | ------ | --------------- | | PROFILE_A2DP_SOURCE | 1 | A2DP profile.| | PROFILE_HANDS_FREE_AUDIO_GATEWAY | 4 | HFP profile. | -| PROFILE_HID_HOST9+ | 6 | Human Interface Device (HID) profile. | -| PROFILE_PAN_NETWORK9+ | 7 | PAN profile. | diff --git a/en/application-dev/reference/apis/js-apis-bluetoothManager.md b/en/application-dev/reference/apis/js-apis-bluetoothManager.md new file mode 100644 index 0000000000000000000000000000000000000000..7ec3e7b70c6671ddf6b58313e1a7c86cb98e2978 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-bluetoothManager.md @@ -0,0 +1,4607 @@ +# @ohos.bluetoothManager (Bluetooth) + +The **Bluetooth** module provides classic Bluetooth capabilities and Bluetooth Low Energy (BLE) scan and advertising. + +> **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 + +```js +import bluetoothManager from '@ohos.bluetoothManager'; +``` + + +## bluetoothManager.enableBluetooth + +enableBluetooth(): void + +Enables Bluetooth. + +**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + bluetoothManager.enableBluetooth(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.disableBluetooth + +disableBluetooth(): void + +Disables Bluetooth. + +**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + bluetoothManager.disableBluetooth(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.getLocalName + +getLocalName(): string + +Obtains the name of the local Bluetooth device. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Return value** + +| Type | Description | +| ------ | --------- | +| string | Name of the local Bluetooth device obtained.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + let localName = bluetoothManager.getLocalName(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.getState + +getState(): BluetoothState + +Obtains the Bluetooth state. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Return value** + +| Type | Description | +| --------------------------------- | --------- | +| [BluetoothState](#bluetoothstate) | Bluetooth state obtained.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + let state = bluetoothManager.getState(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.getBtConnectionState + +getBtConnectionState(): ProfileConnectionState + +Obtains the local profile connection status. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Return value** + +| Type | Description | +| ---------------------------------------- | ------------------- | +| [ProfileConnectionState](#profileconnectionstate) | Profile connection state obtained.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + let connectionState = bluetoothManager.getBtConnectionState(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.setLocalName + +setLocalName(name: string): void + +Sets the name of the local Bluetooth device. + +**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ---- | ------ | ---- | --------------------- | +| name | string | Yes | Bluetooth device name to set. It cannot exceed 248 bytes.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + bluetoothManager.setLocalName('device_name'); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.pairDevice + +pairDevice(deviceId: string): void + +Initiates Bluetooth pairing. + +**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ------ | ---- | ----------------------------------- | +| deviceId | string | Yes | Address of the remote device to pair, for example, XX:XX:XX:XX:XX:XX.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + // The address can be scanned. + bluetoothManager.pairDevice("XX:XX:XX:XX:XX:XX"); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.getProfileConnectionState + +getProfileConnectionState(profileId: ProfileId): ProfileConnectionState + +Obtains the connection status of the specified profile. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| --------- | --------- | ---- | ------------------------------------- | +| ProfileId | profileId | Yes | ID of the profile to obtain, for example, **PROFILE_A2DP_SOURCE**.| + +**Return value** + +| Type | Description | +| ------------------------------------------------- | ------------------- | +| [ProfileConnectionState](#profileconnectionstate) | Profile connection state obtained.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + let result = bluetoothManager.getProfileConnectionState(bluetoothManager.ProfileId.PROFILE_A2DP_SOURCE); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.cancelPairedDevice + +cancelPairedDevice(deviceId: string): void + +Cancels a paired remote device. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ------ | ---- | ------------------------------------- | +| deviceId | string | Yes | Address of the remote device to cancel, for example, XX:XX:XX:XX:XX:XX.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + bluetoothManager.cancelPairedDevice("XX:XX:XX:XX:XX:XX"); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.getRemoteDeviceName + +getRemoteDeviceName(deviceId: string): string + +Obtains the name of the remote Bluetooth device. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ------ | ---- | --------------------------------- | +| deviceId | string | Yes | Address of the target remote device, for example, XX:XX:XX:XX:XX:XX.| + +**Return value** + +| Type | Description | +| ------ | ------------- | +| string | Device name (a string) obtained.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + let remoteDeviceName = bluetoothManager.getRemoteDeviceName("XX:XX:XX:XX:XX:XX"); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.getRemoteDeviceClass + +getRemoteDeviceClass(deviceId: string): DeviceClass + +Obtains the class of the remote Bluetooth device. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ------ | ---- | --------------------------------- | +| deviceId | string | Yes | Address of the target remote device, for example, XX:XX:XX:XX:XX:XX.| + +**Return value** + +| Type | Description | +| --------------------------- | -------- | +| [DeviceClass](#deviceclass) | Class of the remote device obtained.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + let remoteDeviceClass = bluetoothManager.getRemoteDeviceClass("XX:XX:XX:XX:XX:XX"); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.getPairedDevices + +getPairedDevices(): Array<string> + +Obtains the paired devices. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Return value** + +| Type | Description | +| ------------------- | ------------- | +| Array<string> | Addresses of the paired Bluetooth devices.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + let devices = bluetoothManager.getPairedDevices(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.setBluetoothScanMode + +setBluetoothScanMode(mode: ScanMode, duration: number): void + +Sets the Bluetooth scan mode so that the device can be discovered by a remote device. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | --------------------- | ---- | ---------------------------- | +| mode | [ScanMode](#scanmode) | Yes | Bluetooth scan mode to set. | +| duration | number | Yes | Duration (in ms) in which the device can be discovered. The value **0** indicates unlimited time.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + // The device can be discovered and connected only when the discoverable and connectable mode is used. + bluetoothManager.setBluetoothScanMode(bluetoothManager.ScanMode.SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE, 100); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.getBluetoothScanMode + +getBluetoothScanMode(): ScanMode + +Obtains the Bluetooth scan mode. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Return value** + +| Type | Description | +| --------------------- | ------- | +| [ScanMode](#scanmode) | Bluetooth scan mode to set.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + let scanMode = bluetoothManager.getBluetoothScanMode(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.startBluetoothDiscovery + +startBluetoothDiscovery(): void + +Starts Bluetooth scan to discover remote devices. + +**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**Example** + +```js +let deviceId; +function onReceiveEvent(data) { + deviceId = data; +} +try { + bluetoothManager.on('bluetoothDeviceFind', onReceiveEvent); + bluetoothManager.startBluetoothDiscovery(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.stopBluetoothDiscovery + +stopBluetoothDiscovery(): void + +Stops Bluetooth scan. + +**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + bluetoothManager.stopBluetoothDiscovery(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.setDevicePairingConfirmation + +setDevicePairingConfirmation(device: string, accept: boolean): void + +Sets the device pairing confirmation. + +**Required permissions**: ohos.permission.MANAGE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------ | ------- | ---- | -------------------------------- | +| device | string | Yes | Address of the 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. | + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**Example** + +```js + +try { + // Subscribe to the pinRequired event and configure the pairing confirmation after receiving a pairing request from the remote device. + function onReceivePinRequiredEvent(data) { // data is the input parameter for the pairing request. + console.info('pin required = '+ JSON.stringify(data)); + bluetoothManager.setDevicePairingConfirmation(data.deviceId, true); + } + bluetoothManager.on("pinRequired", onReceivePinRequiredEvent); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.setDevicePinCode10+ + +setDevicePinCode(device: string, code: string, callback: AsyncCallback<void>): void + +Sets the PIN for the device when [PinType](#pintype10) is **PIN_TYPE_ENTER_PIN_CODE** or **PIN_TYPE_PIN_16_DIGITS**. + +**Required permissions**: ohos.permission.MANAGE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------ | ------- | ---- | -------------------------------- | +| device | string | Yes | MAC address of the remote device, for example, XX:XX:XX:XX:XX:XX.| +| code | string | Yes | PIN to set. | +| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object. | + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**Example** + +```js +//callback +try { + bluetoothManager.setDevicePinCode('11:22:33:44:55:66', '12345', (err, data) => { + console.info('setDevicePinCode,device name err:' + JSON.stringify(err) + ',device name:' + JSON.stringify(data)); + }); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.setDevicePinCode10+ + +setDevicePinCode(device: string, code: string): Promise<void> + +Sets the PIN for the device when [PinType](#pintype10) is **PIN_TYPE_ENTER_PIN_CODE** or **PIN_TYPE_PIN_16_DIGITS**. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.MANAGE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------ | ------- | ---- | -------------------------------- | +| device | string | Yes | MAC address of the remote device, for example, XX:XX:XX:XX:XX:XX.| +| code | string | Yes | PIN to set. | + +**Return value** + +| Type | Description | +| ------------------- | ------------- | +| Promise<void> | Promise used to return the result.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**Example** + +```js +//promise +try { + bluetoothManager.setDevicePinCode('11:22:33:44:55:66', '12345').then(() => { + console.info('setDevicePinCode'); + }, error => { + console.info('setDevicePinCode: errCode:' + error.code + ',errMessage' + error.message); + }) + +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.on('bluetoothDeviceFind') + +on(type: "bluetoothDeviceFind", callback: Callback<Array<string>>): void + +Subscribes to the Bluetooth device discovery events. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ----------------------------------- | ---- | -------------------------------------- | +| type | string | Yes | Event type. The value **bluetoothDeviceFind** indicates an event reported when a Bluetooth device is discovered.| +| callback | Callback<Array<string>> | Yes | Callback invoked to return the discovered devices. You need to implement this callback. | + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900099 | Operation failed. | + +**Example** + +```js +function onReceiveEvent(data) { // data is a set of Bluetooth device addresses. + console.info('bluetooth device find = '+ JSON.stringify(data)); +} +try { + bluetoothManager.on('bluetoothDeviceFind', onReceiveEvent); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.off('bluetoothDeviceFind') + +off(type: "bluetoothDeviceFind", callback?: Callback<Array<string>>): void + +Unsubscribes from the Bluetooth device discovery events. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ----------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **bluetoothDeviceFind** indicates an event reported when a Bluetooth device is discovered. | +| callback | Callback<Array<string>> | No | Callback for the **bluetoothDeviceFind** event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900099 | Operation failed. | + +**Example** + +```js +function onReceiveEvent(data) { + console.info('bluetooth device find = '+ JSON.stringify(data)); +} +try { + bluetoothManager.on('bluetoothDeviceFind', onReceiveEvent); + bluetoothManager.off('bluetoothDeviceFind', onReceiveEvent); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.on('pinRequired') + +on(type: "pinRequired", callback: Callback<PinRequiredParam>): void + +Subscribes to the pairing request events of the remote Bluetooth device. + +**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | -------------------------------- | +| type | string | Yes | Event type. The value **pinRequired** indicates a pairing request event. | +| callback | Callback<[PinRequiredParam](#pinrequiredparam)> | Yes | Callback invoked to return the pairing request. You need to implement this callback.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900099 | Operation failed. | + +**Example** + +```js +function onReceiveEvent(data) { // data is the pairing request parameter. + console.info('pin required = '+ JSON.stringify(data)); +} +try { + bluetoothManager.on('pinRequired', onReceiveEvent); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.off('pinRequired') + +off(type: "pinRequired", callback?: Callback<PinRequiredParam>): void + +Unsubscribes from the pairing request events of the remote Bluetooth device. + +**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **pinRequired** indicates a pairing request event. | +| callback | Callback<[PinRequiredParam](#pinrequiredparam)> | No | Callback for the Bluetooth pairing request event. The input parameter is the pairing request parameter. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900099 | Operation failed. | + +**Example** + +```js +function onReceiveEvent(data) { + console.info('pin required = '+ JSON.stringify(data)); +} +try { + bluetoothManager.on('pinRequired', onReceiveEvent); + bluetoothManager.off('pinRequired', onReceiveEvent); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.on('bondStateChange') + +on(type: "bondStateChange", callback: Callback<BondStateParam>): void + +Subscribes to the Bluetooth pairing state change events. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ------------------------------------ | +| type | string | Yes | Event type. The value **bondStateChange** indicates a Bluetooth pairing state change event.| +| callback | Callback<[BondStateParam](#BondStateParam)> | Yes | Callback invoked to return the pairing state. You need to implement this callback. | + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900099 | Operation failed. | + +**Example** + +```js +function onReceiveEvent(data) { // data, as the input parameter of the callback, indicates the pairing state. + console.info('pair state = '+ JSON.stringify(data)); +} +try { + bluetoothManager.on('bondStateChange', onReceiveEvent); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.off('bondStateChange') + +off(type: "bondStateChange", callback?: Callback<BondStateParam>): void + +Unsubscribes from the Bluetooth pairing state change events. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **bondStateChange** indicates a Bluetooth pairing state change event. | +| callback | Callback<[BondStateParam](#BondStateParam)> | No | Callback for the change of the Bluetooth pairing state. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900099 | Operation failed. | + +**Example** + +```js +function onReceiveEvent(data) { + console.info('bond state = '+ JSON.stringify(data)); +} +try { + bluetoothManager.on('bondStateChange', onReceiveEvent); + bluetoothManager.off('bondStateChange', onReceiveEvent); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.on('stateChange') + +on(type: "stateChange", callback: Callback<BluetoothState>): void + +Subscribes to the Bluetooth connection state change events. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | -------------------------------- | +| type | string | Yes | Event type. The value **stateChange** indicates a Bluetooth connection state change event. | +| callback | Callback<[BluetoothState](#bluetoothstate)> | Yes | Callback invoked to return the Bluetooth connection state. You need to implement this callback.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900099 | Operation failed. | + +**Example** + +```js +function onReceiveEvent(data) { + console.info('bluetooth state = '+ JSON.stringify(data)); +} +try { + bluetoothManager.on('stateChange', onReceiveEvent); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.off('stateChange') + +off(type: "stateChange", callback?: Callback<BluetoothState>): void + +Unsubscribes from the Bluetooth connection state change events. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **stateChange** indicates a Bluetooth connection state change event. | +| callback | Callback<[BluetoothState](#bluetoothstate)> | No | Callback for the Bluetooth connection state change event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900099 | Operation failed. | + +**Example** + +```js +function onReceiveEvent(data) { + console.info('bluetooth state = '+ JSON.stringify(data)); +} +try { + bluetoothManager.on('stateChange', onReceiveEvent); + bluetoothManager.off('stateChange', onReceiveEvent); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.sppListen + +sppListen(name: string, option: SppOption, callback: AsyncCallback<number>): void + +Creates a server listening socket. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | --------------------------- | ---- | ----------------------- | +| name | string | Yes | Name of the service. | +| option | [SppOption](#sppoption) | Yes | Serial port profile (SPP) listening configuration. | +| callback | AsyncCallback<number> | Yes | Callback invoked to return the server socket ID.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**Example** + +```js +let serverNumber = -1; +function serverSocket(code, number) { + console.log('bluetooth error code: ' + code.code); + if (code.code == 0) { + console.log('bluetooth serverSocket Number: ' + number); + serverNumber = number; + } +} + +let sppOption = {uuid: '00001810-0000-1000-8000-00805F9B34FB', secure: false, type: 0}; +try { + bluetoothManager.sppListen('server1', sppOption, serverSocket); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.sppAccept + +sppAccept(serverSocket: number, callback: AsyncCallback<number>): void + +Listens for a connection to be made to this socket from the client and accepts it. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------------ | --------------------------- | ---- | ----------------------- | +| serverSocket | number | Yes | Server socket ID. | +| callback | AsyncCallback<number> | Yes | Callback invoked to return the client socket ID.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**Example** + +```js +let serverNumber = -1; +function serverSocket(code, number) { + console.log('bluetooth error code: ' + code.code); + if (code.code == 0) { + console.log('bluetooth serverSocket Number: ' + number); + serverNumber = number; + } +} +let clientNumber = -1; +function acceptClientSocket(code, number) { + console.log('bluetooth error code: ' + code.code); + if (code.code == 0) { + console.log('bluetooth clientSocket Number: ' + number); + // The obtained clientNumber is used as the socket ID for subsequent read/write operations on the server. + clientNumber = number; + } +} +try { + bluetoothManager.sppAccept(serverNumber, acceptClientSocket); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.sppConnect + +sppConnect(device: string, option: SppOption, callback: AsyncCallback<number>): void + +Initiates an SPP connection to a remote device from the client. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | --------------------------- | ---- | ------------------------------ | +| device | string | Yes | Address of the remote device, for example, XX:XX:XX:XX:XX:XX.| +| option | [SppOption](#sppoption) | Yes | Configuration for connecting to the SPP client. | +| callback | AsyncCallback<number> | Yes | Callback invoked to return the client socket ID. | + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**Example** + +```js + +let clientNumber = -1; +function clientSocket(code, number) { + if (code.code != 0) { + return; + } + console.log('bluetooth serverSocket Number: ' + number); + // The obtained clientNumber is used as the socket ID for subsequent read/write operations on the client. + clientNumber = number; +} +let sppOption = {uuid: '00001810-0000-1000-8000-00805F9B34FB', secure: false, type: 0}; +try { + bluetoothManager.sppConnect('XX:XX:XX:XX:XX:XX', sppOption, clientSocket); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.sppCloseServerSocket + +sppCloseServerSocket(socket: number): void + +Closes the listening socket of the server. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------ | ------ | ---- | --------------- | +| socket | number | Yes | ID of the listening socket on the server. The ID is obtained by **sppListen**.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900099 | Operation failed. | + +**Example** + +```js +let serverNumber = -1; +function serverSocket(code, number) { + console.log('bluetooth error code: ' + code.code); + if (code.code == 0) { + console.log('bluetooth serverSocket Number: ' + number); + serverNumber = number; + } +} +try { + bluetoothManager.sppCloseServerSocket(serverNumber); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.sppCloseClientSocket + +sppCloseClientSocket(socket: number): void + +Closes the client socket. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------ | ------ | ---- | ------------- | +| Name | Type | Mandatory | Description | +| socket | number | Yes | Client socket ID, which is obtained by **sppAccept** or **sppConnect**.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900099 | Operation failed. | + +**Example** + +```js +let clientNumber = -1; +function clientSocket(code, number) { + if (code.code != 0) { + return; + } + console.log('bluetooth serverSocket Number: ' + number); + // The obtained clientNumber is used as the socket ID for subsequent read/write operations on the client. + clientNumber = number; +} +try { + bluetoothManager.sppCloseClientSocket(clientNumber); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.sppWrite + +sppWrite(clientSocket: number, data: ArrayBuffer): void + +Writes data to the remote device through the socket. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------------ | ----------- | ---- | ------------- | +| clientSocket | number | Yes | Client socket ID, which is obtained by **sppAccept** or **sppConnect**.| +| data | ArrayBuffer | Yes | Data to write. | + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2901054 | IO error. | +|2900099 | Operation failed. | + +**Example** + +```js +let clientNumber = -1; +function clientSocket(code, number) { + if (code.code != 0) { + return; + } + console.log('bluetooth serverSocket Number: ' + number); + // The obtained clientNumber is used as the socket ID for subsequent read/write operations on the client. + clientNumber = number; +} +let arrayBuffer = new ArrayBuffer(8); +let data = new Uint8Array(arrayBuffer); +data[0] = 123; +try { + bluetoothManager.sppWrite(clientNumber, arrayBuffer); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.on('sppRead') + +on(type: "sppRead", clientSocket: number, callback: Callback<ArrayBuffer>): void + +Subscribes to the SPP read request events. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------------ | --------------------------- | ---- | -------------------------- | +| type | string | Yes | Event type. The value **sppRead** indicates an SPP read request event.| +| clientSocket | number | Yes | Client socket ID, which is obtained by **sppAccept** or **sppConnect**. | +| callback | Callback<ArrayBuffer> | Yes | Callback invoked to return the data read. | + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2901054 | IO error. | +|2900099 | Operation failed. | + +**Example** + +```js +let clientNumber = -1; +function clientSocket(code, number) { + if (code.code != 0) { + return; + } + console.log('bluetooth serverSocket Number: ' + number); + // The obtained clientNumber is used as the socket ID for subsequent read/write operations on the client. + clientNumber = number; +} +function dataRead(dataBuffer) { + let data = new Uint8Array(dataBuffer); + console.log('bluetooth data is: ' + data[0]); +} +try { + bluetoothManager.on('sppRead', clientNumber, dataRead); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.off('sppRead') + +off(type: "sppRead", clientSocket: number, callback?: Callback<ArrayBuffer>): void + +Unsubscribes from the SPP read request events. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------------ | --------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **sppRead** indicates an SPP read request event. | +| clientSocket | number | Yes | Client socket ID, which is obtained by **sppAccept** or **sppConnect**. | +| callback | Callback<ArrayBuffer> | No | Callback for the SPP read request event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| + +**Example** + +```js +let clientNumber = -1; +function clientSocket(code, number) { + if (code.code != 0) { + return; + } + console.log('bluetooth serverSocket Number: ' + number); + // The obtained clientNumber is used as the socket ID for subsequent read/write operations on the client. + clientNumber = number; +} +try { + bluetoothManager.off('sppRead', clientNumber); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + +## bluetoothManager.getProfileInstance + +getProfileInstance(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfile | HidHostProfile | PanProfile + +Obtains a profile instance. API version 9 is added with **HidHostProfile** and **PanProfile**. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| --------- | --------- | ---- | ------------------------------------- | +| profileId | [ProfileId](#ProfileId) | Yes | ID of the profile to obtain, for example, **PROFILE_A2DP_SOURCE**.| + +**Return value** + +| Type | Description | +| ------------------------------------------------------------ | ------------------------------------------------------------ | +| [A2dpSourceProfile](#a2dpsourceprofile), [HandsFreeAudioGatewayProfile](#handsfreeaudiogatewayprofile), [HidHostProfile](#hidhostprofile), or [PanProfile](#panprofile)| Profile instance obtained, which can be **A2dpSourceProfile**, **HandsFreeAudioGatewayProfile**, **HidHostProfile**, or **PanProfile**.| + +**Example** + +```js +try { + let hidHost = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_HID_HOST); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.BLE + +### bluetoothManager.BLE.createGattServer + +createGattServer(): GattServer + +Creates a **GattServer** instance. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Return value** + +| Type | Description | +| ------------------------- | ------------------------------------ | +| [GattServer](#gattserver) | **GattServer** instance created. Before using an API of this class, you must create a **GattSever** instance.| + +**Example** + +```js +let gattServer = bluetoothManager.BLE.createGattServer(); +``` + + +### bluetoothManager.BLE.createGattClientDevice + +createGattClientDevice(deviceId: string): GattClientDevice + +Creates a **GattClientDevice** instance. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ------ | ---- | ------------------------------------ | +| deviceId | string | Yes | Address of the remote device, for example, XX:XX:XX:XX:XX:XX.| + +**Return value** + +| Type | Description | +| ------------------------------------- | ------------------------------------ | +| [GattClientDevice](#gattclientdevice) | **GattClientDevice** instance created. Before using an API of the client, you must create a **GattClientDevice** instance.| + +**Example** + +```js +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### bluetoothManager.BLE.getConnectedBLEDevices + +getConnectedBLEDevices(): Array<string> + +Obtains the BLE devices connected to this device. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Return value** + +| Type | Description | +| ------------------- | ------------------- | +| Array<string> | Addresses of the BLE devices connected to this device.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + let result = bluetoothManager.BLE.getConnectedBLEDevices(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### bluetoothManager.BLE.startBLEScan + +startBLEScan(filters: Array<ScanFilter>, options?: ScanOptions): void + +Starts a BLE scan. + +**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH, ohos.permission.MANAGE_BLUETOOTH, ohos.permission.LOCATION, and ohos.permission.APPROXIMATELY_LOCATION + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------- | -------------------------------------- | ---- | ----------------------------------- | +| filters | Array<[ScanFilter](#scanfilter)> | Yes | Criteria for filtering the scan result. Set this parameter to **null** if you do not want to filter the scan result.| +| options | [ScanOptions](#scanoptions) | No | Scan options. | + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**Example** + +```js +function onReceiveEvent(data) { + console.info('BLE scan device find result = '+ JSON.stringify(data)); +} +try { + bluetoothManager.BLE.on("BLEDeviceFind", onReceiveEvent); + bluetoothManager.BLE.startBLEScan( + [{ + deviceId:"XX:XX:XX:XX:XX:XX", + name:"test", + serviceUuid:"00001888-0000-1000-8000-00805f9b34fb" + }], + { + interval: 500, + dutyMode: bluetoothManager.ScanDuty.SCAN_MODE_LOW_POWER, + matchMode: bluetoothManager.MatchMode.MATCH_MODE_AGGRESSIVE, + } + ); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### bluetoothManager.BLE.stopBLEScan + +stopBLEScan(): void + +Stops the BLE scan. + +**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + bluetoothManager.BLE.stopBLEScan(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### bluetoothManager.BLE.on('BLEDeviceFind') + +on(type: "BLEDeviceFind", callback: Callback<Array<ScanResult>>): void + +Subscribe to the BLE device discovery events. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ----------------------------------- | +| type | string | Yes | Event type. The value **BLEDeviceFind** indicates an event reported when a BLE device is discovered. | +| callback | Callback<Array<[ScanResult](#scanresult)>> | Yes | Callback invoked to return the discovered devices. You need to implement this callback.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900099 | Operation failed. | + +**Example** + +```js +function onReceiveEvent(data) { + console.info('bluetooth device find = '+ JSON.stringify(data)); +} +try { + bluetoothManager.BLE.on('BLEDeviceFind', onReceiveEvent); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### bluetoothManager.BLE.off('BLEDeviceFind') + +off(type: "BLEDeviceFind", callback?: Callback<Array<ScanResult>>): void + +Unsubscribes from the BLE device discovery events. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **BLEDeviceFind** indicates an event reported when a BLE device is discovered. | +| callback | Callback<Array<[ScanResult](#scanresult)>> | No | Callback for the **BLEDeviceFind** event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900099 | Operation failed. | + +**Example** + +```js +function onReceiveEvent(data) { + console.info('bluetooth device find = '+ JSON.stringify(data)); +} +try { + bluetoothManager.BLE.on('BLEDeviceFind', onReceiveEvent); + bluetoothManager.BLE.off('BLEDeviceFind', onReceiveEvent); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## BaseProfile + +Provides the profile base class. + + +### getConnectionDevices + +getConnectionDevices(): Array<string> + +Obtains the connected devices. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Return value** + +| Type | Description | +| ------------------- | ------------- | +| Array<string> | Addresses of the connected devices.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + let a2dpSrc = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_A2DP_SOURCE) as bluetoothManager.A2dpSourceProfile; + let retArray = a2dpSrc.getConnectionDevices(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + +### getDeviceState + +getDeviceState(device: string): ProfileConnectionState + +Obtains the connection state of the profile. + +**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 | +| ------------------------------------------------- | ----------------------- | +| [ProfileConnectionState](#profileconnectionstate) | Profile connection state obtained.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + let a2dpSrc = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_A2DP_SOURCE) as bluetoothManager.A2dpSourceProfile; + let ret = a2dpSrc.getDeviceState('XX:XX:XX:XX:XX:XX'); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + +## A2dpSourceProfile + +Before using an API of **A2dpSourceProfile**, you need to create an instance of this class by using **getProfile()**. + + +### connect + +connect(device: string): void + +Sets up an Advanced Audio Distribution Profile (A2DP) connection. + +**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------ | ------ | ---- | ------- | +| device | string | Yes | Address of the target device.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + let a2dpSrc = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_A2DP_SOURCE) as bluetoothManager.A2dpSourceProfile; + a2dpSrc.connect('XX:XX:XX:XX:XX:XX'); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### disconnect + +disconnect(device: string): void + +Disconnects an A2DP connection. + +**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------ | ------ | ---- | ------- | +| device | string | Yes | Address of the target device.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + let a2dpSrc = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_A2DP_SOURCE) as bluetoothManager.A2dpSourceProfile; + a2dpSrc.disconnect('XX:XX:XX:XX:XX:XX'); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### on('connectionStateChange') + +on(type: "connectionStateChange", callback: Callback<[StateChangeParam](#StateChangeParam)>): void + +Subscribes to the A2DP connection state change events. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **connectionStateChange** indicates an A2DP connection state change event.| +| callback | Callback<[StateChangeParam](#StateChangeParam)> | Yes | Callback invoked to return the A2DP connection state change event. | + +**Return value** + +No value is returned. + +**Example** + +```js +function onReceiveEvent(data) { + console.info('a2dp state = '+ JSON.stringify(data)); +} +let a2dpSrc = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_A2DP_SOURCE) as bluetoothManager.A2dpSourceProfile; +a2dpSrc.on('connectionStateChange', onReceiveEvent); +``` + + +### off('connectionStateChange') + +off(type: "connectionStateChange", callback?: Callback<[StateChangeParam](#StateChangeParam)>): void + +Unsubscribes from the A2DP connection state change events. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **connectionStateChange** indicates an A2DP connection state change event.| +| callback | Callback<[StateChangeParam](#StateChangeParam)> | No | Callback for the A2DP connection state change event. | + +**Return value** + +No value is returned. + +**Example** + +```js +function onReceiveEvent(data) { + console.info('a2dp state = '+ JSON.stringify(data)); +} +let a2dpSrc = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_A2DP_SOURCE) as bluetoothManager.A2dpSourceProfile; +a2dpSrc.on('connectionStateChange', onReceiveEvent); +a2dpSrc.off('connectionStateChange', onReceiveEvent); +``` + + +### getPlayingState + +getPlayingState(device: string): PlayingState + +Obtains the playing state of a device. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------ | ------ | ---- | ------- | +| device | string | Yes | Address of the target device.| + +**Return value** + +| Type | Description | +| ----------------------------- | ---------- | +| [PlayingState](#PlayingState) | Playing state of the remote device obtained.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + let a2dpSrc = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_A2DP_SOURCE) as bluetoothManager.A2dpSourceProfile; + let state = a2dpSrc.getPlayingState('XX:XX:XX:XX:XX:XX'); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## HandsFreeAudioGatewayProfile + +Before using an API of **HandsFreeAudioGatewayProfile**, you need to create an instance of this class by using **getProfile()**. + + +### connect + +connect(device: string): void + +Sets up a Hands-free Profile (HFP) connection of a device. + +**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------ | ------ | ---- | ------- | +| device | string | Yes | Address of the target device.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + let hfpAg = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_HANDS_FREE_AUDIO_GATEWAY) as bluetoothManager.HandsFreeAudioGatewayProfile; + hfpAg.connect('XX:XX:XX:XX:XX:XX'); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### disconnect + +disconnect(device: string): void + +Disconnects the HFP connection of a device. + +**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------ | ------ | ---- | ------- | +| device | string | Yes | Address of the target device.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + let hfpAg = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_HANDS_FREE_AUDIO_GATEWAY) as bluetoothManager.HandsFreeAudioGatewayProfile; + hfpAg.disconnect('XX:XX:XX:XX:XX:XX'); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### on('connectionStateChange') + +on(type: "connectionStateChange", callback: Callback<[StateChangeParam](#StateChangeParam)>): void + +Subscribes to the HFP connection state change events. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **connectionStateChange** indicates an HFP connection state change event. | +| callback | Callback<[StateChangeParam](#StateChangeParam)> | Yes | Callback invoked to return the HFP connection state change event. | + +**Example** + +```js +function onReceiveEvent(data) { + console.info('hfp state = '+ JSON.stringify(data)); +} +let hfpAg = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_HANDS_FREE_AUDIO_GATEWAY) as + bluetoothManager.HandsFreeAudioGatewayProfile; +hfpAg.on('connectionStateChange', onReceiveEvent); +``` + + +### off('connectionStateChange') + +off(type: "connectionStateChange", callback?: Callback<[StateChangeParam](#StateChangeParam)>): void + +Unsubscribes from the HFP connection state change events. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **connectionStateChange** indicates an HFP connection state change event. | +| callback | Callback<[StateChangeParam](#StateChangeParam)> | No | Callback for the HFP connection state change event. | + +**Example** + +```js +function onReceiveEvent(data) { + console.info('hfp state = '+ JSON.stringify(data)); +} +let hfpAg = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_HANDS_FREE_AUDIO_GATEWAY) as + bluetoothManager.HandsFreeAudioGatewayProfile; +hfpAg.on('connectionStateChange', onReceiveEvent); +hfpAg.off('connectionStateChange', onReceiveEvent); +``` + + +## HidHostProfile + +Before using an API of **HidHostProfile**, you need to create an instance of this class by using **getProfile()**. + + +### connect + +connect(device: string): void + +Connects to the HidHost service of a device. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------ | ------ | ---- | ------- | +| device | string | Yes | Address of the target device.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + let hidHostProfile = bluetoothManager.getProfileInst(bluetoothManager.ProfileId.PROFILE_HID_HOST) as bluetoothManager.HidHostProfile; + hidHostProfile.connect('XX:XX:XX:XX:XX:XX'); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### disconnect + +disconnect(device: string): void + +Disconnects from the HidHost service of a device. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------ | ------ | ---- | ------- | +| device | string | Yes | Address of the target device.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + let hidHostProfile = bluetoothManager.getProfileInst(bluetoothManager.ProfileId.PROFILE_HID_HOST) as bluetoothManager.HidHostProfile; + hidHostProfile.disconnect('XX:XX:XX:XX:XX:XX'); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### on('connectionStateChange') + +on(type: "connectionStateChange", callback: Callback<[StateChangeParam](#StateChangeParam)>): void + +Subscribes to the HidHost 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 HidHost connection state change event. | +| callback | Callback<[StateChangeParam](#StateChangeParam)> | Yes | Callback invoked to return the HidHost connection state change event. | + +**Example** + +```js +function onReceiveEvent(data) { + console.info('hidHost state = '+ JSON.stringify(data)); +} +let hidHost = bluetoothManager.getProfileInst(bluetoothManager.ProfileId.PROFILE_HID_HOST) as bluetoothManager.HidHostProfile; +hidHost.on('connectionStateChange', onReceiveEvent); +``` + + +### off('connectionStateChange') + +off(type: "connectionStateChange", callback?: Callback<[StateChangeParam](#StateChangeParam)>): void + +Unsubscribes from the HidHost 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 HidHost connection state change event. | +| callback | Callback<[StateChangeParam](#StateChangeParam)> | No | Callback for the HidHost connection state change event. | + +**Example** + +```js +function onReceiveEvent(data) { + console.info('hidHost state = '+ JSON.stringify(data)); +} +let hidHost = bluetoothManager.getProfileInst(bluetoothManager.ProfileId.PROFILE_HID_HOST) as bluetoothManager.HidHostProfile; +hidHost.on('connectionStateChange', onReceiveEvent); +hidHost.off('connectionStateChange', onReceiveEvent); +``` + + +## PanProfile + +Before using an API of **PanProfile**, you need to create an instance of this class by using **getProfile()**. + + +### disconnect + +disconnect(device: string): void + +Disconnects from the Personal Area Network (PAN) service of a device. + +**System API**: 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.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + let panProfile = bluetoothManager.getProfileInst(bluetoothManager.ProfileId.PROFILE_PAN_NETWORK) as bluetoothManager.PanProfile; + panProfile.disconnect('XX:XX:XX:XX:XX:XX'); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### on('connectionStateChange') + +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 invoked to return the PAN connection state change event. | + +**Example** + +```js +function onReceiveEvent(data) { + console.info('pan state = '+ JSON.stringify(data)); +} +let panProfile = bluetoothManager.getProfileInst(bluetoothManager.ProfileId.PROFILE_PAN_NETWORK) as bluetoothManager.PanProfile; +panProfile.on('connectionStateChange', onReceiveEvent); +``` + + +### off('connectionStateChange') + +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 for the PAN connection state change event. | + +**Example** + +```js +function onReceiveEvent(data) { + console.info('pan state = '+ JSON.stringify(data)); +} +let panProfile = bluetoothManager.getProfileInst(bluetoothManager.ProfileId.PROFILE_PAN_NETWORK) as bluetoothManager.PanProfile; +panProfile.on('connectionStateChange', onReceiveEvent); +panProfile.off('connectionStateChange', onReceiveEvent); +``` + + +### setTethering + +setTethering(enable: boolean): void + +Sets tethering. + +**System API**: 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.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + let panProfile = bluetoothManager.getProfileInst(bluetoothManager.ProfileId.PROFILE_PAN_NETWORK) as bluetoothManager.PanProfile; + panProfile.setTethering(true); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### isTetheringOn + +isTetheringOn(): boolean + +Obtains the network sharing status. + +**System API**: This is a system API. + +**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 +try { + let panProfile = bluetoothManager.getProfileInst(bluetoothManager.ProfileId.PROFILE_PAN_NETWORK) as bluetoothManager.PanProfile; + let ret = panProfile.isTetheringOn(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## GattServer + +Implements the Generic Attribute Profile (GATT) server. Before using an API of this class, you need to create a **GattServer** instance using **createGattServer()**. + + +### startAdvertising + +startAdvertising(setting: AdvertiseSetting, advData: AdvertiseData, advResponse?: AdvertiseData): void + +Starts BLE advertising. + +**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----------- | ------------------------------------- | ---- | -------------- | +| setting | [AdvertiseSetting](#advertisesetting) | Yes | Settings related to BLE advertising. | +| advData | [AdvertiseData](#advertisedata) | Yes | Content of the BLE advertisement packet. | +| advResponse | [AdvertiseData](#advertisedata) | No | Response to the BLE scan request.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**Example** + +```js +let manufactureValueBuffer = new Uint8Array(4); +manufactureValueBuffer[0] = 1; +manufactureValueBuffer[1] = 2; +manufactureValueBuffer[2] = 3; +manufactureValueBuffer[3] = 4; + +let serviceValueBuffer = new Uint8Array(4); +serviceValueBuffer[0] = 4; +serviceValueBuffer[1] = 6; +serviceValueBuffer[2] = 7; +serviceValueBuffer[3] = 8; +console.info('manufactureValueBuffer = '+ JSON.stringify(manufactureValueBuffer)); +console.info('serviceValueBuffer = '+ JSON.stringify(serviceValueBuffer)); +let gattServer = bluetoothManager.BLE.createGattServer(); +try { + gattServer.startAdvertising({ + interval:150, + txPower:60, + connectable:true, + },{ + serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:4567, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"00001888-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + },{ + serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:1789, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"00001889-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + }); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### stopAdvertising + +stopAdvertising(): void + +Stops BLE advertising. + +**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**Example** + +```js +let server = bluetoothManager.BLE.createGattServer(); +try { + server.stopAdvertising(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### addService + +addService(service: GattService): void + +Adds a service to this GATT server. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------- | --------------------------- | ---- | ------------------------ | +| service | [GattService](#gattservice) | Yes | Service to add. Settings related to BLE advertising.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**Example** + +```js +// Create descriptors. +let descriptors = []; +let arrayBuffer = new ArrayBuffer(8); +let descV = new Uint8Array(arrayBuffer); +descV[0] = 11; +let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', + characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', + descriptorUuid: '00002902-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer}; +descriptors[0] = descriptor; + +// Create characteristics. +let characteristics = []; +let arrayBufferC = new ArrayBuffer(8); +let cccV = new Uint8Array(arrayBufferC); +cccV[0] = 1; +let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', + characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', characteristicValue: arrayBufferC, descriptors:descriptors}; +let characteristicN = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', + characteristicUuid: '00001821-0000-1000-8000-00805F9B34FB', characteristicValue: arrayBufferC, descriptors:descriptors}; +characteristics[0] = characteristic; + +// Create a gattService instance. +let gattService = {serviceUuid:'00001810-0000-1000-8000-00805F9B34FB', isPrimary: true, characteristics:characteristics, includeServices:[]}; + +let gattServer = bluetoothManager.BLE.createGattServer(); +try { + gattServer.addService(gattService); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### removeService + +removeService(serviceUuid: string): void + +Removes a service from this GATT server. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----------- | ------ | ---- | ---------------------------------------- | +| serviceUuid | string | Yes | Universally unique identifier (UUID) of the service to remove, for example, **00001810-0000-1000-8000-00805F9B34FB**.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**Example** + +```js +let server = bluetoothManager.BLE.createGattServer(); +try { + server.removeService('00001810-0000-1000-8000-00805F9B34FB'); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### close + +close(): void + +Closes this GATT server to unregister it from the protocol stack. After this method is called, this [GattServer](#gattserver) cannot be used. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**Example** + +```js +let server = bluetoothManager.BLE.createGattServer(); +try { + server.close(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### notifyCharacteristicChanged + +notifyCharacteristicChanged(deviceId: string, notifyCharacteristic: NotifyCharacteristic): void + +Notifies the connected client device when a characteristic value changes. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------------------- | ---------------------------------------- | ---- | --------------------------------------- | +| deviceId | string | Yes | Address of the client that receives notifications, for example, XX:XX:XX:XX:XX:XX.| +| notifyCharacteristic | [NotifyCharacteristic](#notifycharacteristic) | Yes | New characteristic value. | + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**Example** + +```js +// Create descriptors. +let descriptors = []; +let arrayBuffer = new ArrayBuffer(8); +let descV = new Uint8Array(arrayBuffer); +descV[0] = 11; +let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', + characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', + descriptorUuid: '00002902-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer}; +descriptors[0] = descriptor; +let arrayBufferC = new ArrayBuffer(8); +let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', + characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', characteristicValue: arrayBufferC, descriptors:descriptors}; +let notifyCharacteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', + characteristicUuid: '00001821-0000-1000-8000-00805F9B34FB', characteristicValue: characteristic.characteristicValue, confirm: false}; +let server = bluetoothManager.BLE.createGattServer(); +try { + server.notifyCharacteristicChanged('XX:XX:XX:XX:XX:XX', notifyCharacteristic); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### sendResponse + +sendResponse(serverResponse: ServerResponse): void + +Sends a response to a read or write request from the GATT client. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------------- | --------------------------------- | ---- | --------------- | +| serverResponse | [ServerResponse](#serverresponse) | Yes | Response returned by the GATT server.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**Example** + +```js +/* send response */ +let arrayBufferCCC = new ArrayBuffer(8); +let cccValue = new Uint8Array(arrayBufferCCC); +cccValue[0] = 1123; +let serverResponse = { + "deviceId": "XX:XX:XX:XX:XX:XX", + "transId": 0, + "status": 0, + "offset": 0, + "value": arrayBufferCCC, +}; + +let gattServer = bluetoothManager.BLE.createGattServer(); +try { + gattServer.sendResponse(serverResponse); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### on('characteristicRead') + +on(type: "characteristicRead", callback: Callback<CharacteristicReadRequest>): void + +Subscribes to the characteristic read request events. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ------------------------------------- | +| type | string | Yes | Event type. The value **characteristicRead** indicates a characteristic read request event.| +| callback | Callback<[CharacteristicReadRequest](#characteristicreadrequest)> | Yes | Callback invoked to return a characteristic read request event from the GATT client. | + +**Example** + +```js +let arrayBufferCCC = new ArrayBuffer(8); +let cccValue = new Uint8Array(arrayBufferCCC); +cccValue[0] = 1123; +function ReadCharacteristicReq(CharacteristicReadRequest) { + let deviceId = CharacteristicReadRequest.deviceId; + let transId = CharacteristicReadRequest.transId; + let offset = CharacteristicReadRequest.offset; + let characteristicUuid = CharacteristicReadRequest.characteristicUuid; + + let serverResponse = {deviceId: deviceId, transId: transId, status: 0, offset: offset, value:arrayBufferCCC}; + + try { + gattServer.sendResponse(serverResponse); + } catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); + } +} + +let gattServer = bluetoothManager.BLE.createGattServer(); +gattServer.on("characteristicRead", ReadCharacteristicReq); +``` + + +### off('characteristicRead') + +off(type: "characteristicRead", callback?: Callback<CharacteristicReadRequest>): void + +Unsubscribes from the characteristic read request events. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **characteristicRead** indicates a characteristic read request event. | +| callback | Callback<[CharacteristicReadRequest](#characteristicreadrequest)> | No | Callback for the characteristic read request event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| + +**Example** + +```js +let gattServer = bluetoothManager.BLE.createGattServer(); +gattServer.off("characteristicRead"); +``` + + +### on('characteristicWrite') + +on(type: "characteristicWrite", callback: Callback<CharacteristicWriteRequest>): void + +Subscribes to the characteristic write request events. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | -------------------------------------- | +| type | string | Yes | Event type. The value **characteristicWrite** indicates a characteristic write request event.| +| callback | Callback<[CharacteristicWriteRequest](#characteristicwriterequest)> | Yes | Callback invoked to return a characteristic write request from the GATT client. | + +**Example** + +```js +let arrayBufferCCC = new ArrayBuffer(8); +let cccValue = new Uint8Array(arrayBufferCCC); +function WriteCharacteristicReq(CharacteristicWriteRequest) { + let deviceId = CharacteristicWriteRequest.deviceId; + let transId = CharacteristicWriteRequest.transId; + let offset = CharacteristicWriteRequest.offset; + let isPrep = CharacteristicWriteRequest.isPrep; + let needRsp = CharacteristicWriteRequest.needRsp; + let value = new Uint8Array(CharacteristicWriteRequest.value); + let characteristicUuid = CharacteristicWriteRequest.characteristicUuid; + + cccValue[0] = value[0]; + let serverResponse = {deviceId: deviceId, transId: transId, status: 0, offset: offset, value:arrayBufferCCC}; + + try { + gattServer.sendResponse(serverResponse); + } catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); + } +} + +let gattServer = bluetoothManager.BLE.createGattServer(); +gattServer.on("characteristicWrite", WriteCharacteristicReq); +``` + + +### off('characteristicWrite') + +off(type: "characteristicWrite", callback?: Callback<CharacteristicWriteRequest>): void + +Unsubscribes from the characteristic write request events. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **characteristicWrite** indicates a characteristic write request event. | +| callback | Callback<[CharacteristicWriteRequest](#characteristicwriterequest)> | No | Callback for the characteristic write request event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| + +**Example** + +```js +let gattServer = bluetoothManager.BLE.createGattServer(); +gattServer.off("characteristicWrite"); +``` + + +### on('descriptorRead') + +on(type: "descriptorRead", callback: Callback<DescriptorReadRequest>): void + +Subscribes to the descriptor read request events. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | --------------------------------- | +| type | string | Yes | Event type. The value **descriptorRead** indicates a descriptor read request event.| +| callback | Callback<[DescriptorReadRequest](#descriptorreadrequest)> | Yes | Callback invoked to return a descriptor read request event from the GATT client. | + +**Example** + +```js +let arrayBufferDesc = new ArrayBuffer(8); +let descValue = new Uint8Array(arrayBufferDesc); +descValue[0] = 1101; +function ReadDescriptorReq(DescriptorReadRequest) { + let deviceId = DescriptorReadRequest.deviceId; + let transId = DescriptorReadRequest.transId; + let offset = DescriptorReadRequest.offset; + let descriptorUuid = DescriptorReadRequest.descriptorUuid; + + let serverResponse = {deviceId: deviceId, transId: transId, status: 0, offset: offset, value:arrayBufferDesc}; + + try { + gattServer.sendResponse(serverResponse); + } catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); + } +} + +let gattServer = bluetoothManager.BLE.createGattServer(); +gattServer.on("descriptorRead", ReadDescriptorReq); +``` + + +### off('descriptorRead') + +off(type: "descriptorRead", callback?: Callback<DescriptorReadRequest>): void + +Unsubscribes from the descriptor read request events. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **descriptorRead** indicates a descriptor read request event. | +| callback | Callback<[DescriptorReadRequest](#descriptorreadrequest)> | No | Callback for the descriptor read request event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| + +**Example** + +```js +let gattServer = bluetoothManager.BLE.createGattServer(); +gattServer.off("descriptorRead"); +``` + + +### on('descriptorWrite') + +on(type: "descriptorWrite", callback: Callback<DescriptorWriteRequest>): void + +Subscribes to the descriptor write request events. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------- | +| type | string | Yes | Event type. The value **descriptorWrite** indicates a descriptor write request event.| +| callback | Callback<[DescriptorWriteRequest](#descriptorwriterequest)> | Yes | Callback invoked to return a descriptor write request from the GATT client. | + +**Example** + +```js +let arrayBufferDesc = new ArrayBuffer(8); +let descValue = new Uint8Array(arrayBufferDesc); +function WriteDescriptorReq(DescriptorWriteRequest) { + let deviceId = DescriptorWriteRequest.deviceId; + let transId = DescriptorWriteRequest.transId; + let offset = DescriptorWriteRequest.offset; + let isPrep = DescriptorWriteRequest.isPrep; + let needRsp = DescriptorWriteRequest.needRsp; + let value = new Uint8Array(DescriptorWriteRequest.value); + let descriptorUuid = DescriptorWriteRequest.descriptorUuid; + + descValue[0] = value[0]; + let serverResponse = {deviceId: deviceId, transId: transId, status: 0, offset: offset, value:arrayBufferDesc}; + + try { + gattServer.sendResponse(serverResponse); + } catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); + } +} + +let gattServer = bluetoothManager.BLE.createGattServer(); +gattServer.on("descriptorRead", WriteDescriptorReq); +``` + + +### off('descriptorWrite') + +off(type: "descriptorWrite", callback?: Callback<DescriptorWriteRequest>): void + +Unsubscribes from the descriptor write request events. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **descriptorWrite** indicates a descriptor write request event. | +| callback | Callback<[DescriptorWriteRequest](#descriptorwriterequest)> | No | Callback for the descriptor write request event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| + +**Example** + +```js +let gattServer = bluetoothManager.BLE.createGattServer(); +gattServer.off("descriptorWrite"); +``` + + +### on('connectStateChange') + +on(type: "connectStateChange", callback: Callback<BLEConnectChangedState>): void + +Subscribes to the BLE connection state change events. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **connectStateChange** indicates a BLE connection state change event.| +| callback | Callback<[BLEConnectChangedState](#bleconnectchangedstate)> | Yes | Callback invoked to return the BLE connection state. | + +**Example** + +```js +function Connected(BLEConnectChangedState) { + let deviceId = BLEConnectChangedState.deviceId; + let status = BLEConnectChangedState.state; +} + +let gattServer = bluetoothManager.BLE.createGattServer(); +gattServer.on("connectStateChange", Connected); +``` + + +### off('connectStateChange') + +off(type: "connectStateChange", callback?: Callback<BLEConnectChangedState>): void + +Unsubscribes from the BLE connection state change events. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **connectStateChange** indicates a BLE connection state change event.| +| callback | Callback<[BLEConnectChangedState](#bleconnectchangedstate)> | No | Callback for the BLE connection state change event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| + +**Example** + +```js +let gattServer = bluetoothManager.BLE.createGattServer(); +gattServer.off("connectStateChange"); +``` + + +## GattClientDevice + +Implements the GATT client. Before using an API of this class, you must create a **GattClientDevice** instance using **createGattClientDevice(deviceId: string)**. + + +### connect + +connect(): void + +Initiates a connection to the remote BLE device. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.connect(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### disconnect + +disconnect(): void + +Disconnects from the remote BLE device. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.disconnect(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### close + +close(): void + +Closes this GATT client to unregister it from the protocol stack. After this method is called, this [GattClientDevice](#gattclientdevice) instance cannot be used. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.close(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + + + +### getServices + +getServices(callback: AsyncCallback<Array<GattService>>): void + +Obtains all services of the remote BLE device. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ------------------------ | +| callback | AsyncCallback<Array<[GattService](#gattservice)>> | Yes | Callback invoked to return the services obtained.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900099 | Operation failed. | + +**Example** + +```js +// Callback +function getServices(code, gattServices) { + if (code.code == 0) { + let services = gattServices; + console.log('bluetooth code is ' + code.code); + console.log("bluetooth services size is ", services.length); + + for (let i = 0; i < services.length; i++) { + console.log('bluetooth serviceUuid is ' + services[i].serviceUuid); + } + } +} + +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.connect(); + device.getServices(getServices); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### getServices + +getServices(): Promise<Array<GattService>> + +Obtains all services of the remote BLE device. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Return value** + +| Type | Description | +| ---------------------------------------- | --------------------------- | +| Promise<Array<[GattService](#gattservice)>> | Promise used to return the services obtained.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900099 | Operation failed. | + +**Example** + +```js +// Promise +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.connect(); + device.getServices().then(result => { + console.info("getServices successfully:" + JSON.stringify(result)); + }); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### readCharacteristicValue + +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. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------------- | ---------------------------------------- | ---- | ----------------------- | +| characteristic | [BLECharacteristic](#blecharacteristic) | Yes | Characteristic value to read. | +| callback | AsyncCallback<[BLECharacteristic](#blecharacteristic)> | Yes | Callback invoked to return the characteristic value read.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2901000 | Read forbidden. | +|2900099 | Operation failed. | + +**Example** + +```js +function readCcc(code, BLECharacteristic) { + if (code.code != 0) { + return; + } + console.log('bluetooth characteristic uuid: ' + BLECharacteristic.characteristicUuid); + let value = new Uint8Array(BLECharacteristic.characteristicValue); + console.log('bluetooth characteristic value: ' + value[0] +','+ value[1]+','+ value[2]+','+ value[3]); +} + +let descriptors = []; +let bufferDesc = new ArrayBuffer(8); +let descV = new Uint8Array(bufferDesc); +descV[0] = 11; +let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', +characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', +descriptorUuid: '00002903-0000-1000-8000-00805F9B34FB', descriptorValue: bufferDesc}; +descriptors[0] = descriptor; + +let bufferCCC = new ArrayBuffer(8); +let cccV = new Uint8Array(bufferCCC); +cccV[0] = 1; +let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', +characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', +characteristicValue: bufferCCC, descriptors:descriptors}; + +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.readCharacteristicValue(characteristic, readCcc); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### readCharacteristicValue + +readCharacteristicValue(characteristic: BLECharacteristic): Promise<BLECharacteristic> + +Reads the characteristic value of the specific service of the remote BLE device. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------------- | --------------------------------------- | ---- | -------- | +| characteristic | [BLECharacteristic](#blecharacteristic) | Yes | Characteristic value to read.| + +**Return value** + +| Type | Description | +| ---------------------------------------- | -------------------------- | +| Promise<[BLECharacteristic](#blecharacteristic)> | Promise used to return the characteristic value read.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2901000 | Read forbidden. | +|2900099 | Operation failed. | + +**Example** + +```js +let descriptors = []; +let bufferDesc = new ArrayBuffer(8); +let descV = new Uint8Array(bufferDesc); +descV[0] = 11; +let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', +characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', +descriptorUuid: '00002903-0000-1000-8000-00805F9B34FB', descriptorValue: bufferDesc}; +descriptors[0] = descriptor; + +let bufferCCC = new ArrayBuffer(8); +let cccV = new Uint8Array(bufferCCC); +cccV[0] = 1; +let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', +characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', +characteristicValue: bufferCCC, descriptors:descriptors}; + +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.readCharacteristicValue(characteristic); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### readDescriptorValue + +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. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ---------- | ---------------------------------------- | ---- | ----------------------- | +| descriptor | [BLEDescriptor](#bledescriptor) | Yes | Descriptor to read. | +| callback | AsyncCallback<[BLEDescriptor](#bledescriptor)> | Yes | Callback invoked to return the descriptor read.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2901000 | Read forbidden. | +|2900099 | Operation failed. | + +**Example** + +```js +function readDesc(code, BLEDescriptor) { + if (code.code != 0) { + return; + } + console.log('bluetooth descriptor uuid: ' + BLEDescriptor.descriptorUuid); + let value = new Uint8Array(BLEDescriptor.descriptorValue); + console.log('bluetooth descriptor value: ' + value[0] +','+ value[1]+','+ value[2]+','+ value[3]); +} + +let bufferDesc = new ArrayBuffer(8); +let descV = new Uint8Array(bufferDesc); +descV[0] = 11; +let descriptor = { + serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', + characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', + descriptorUuid: '00002903-0000-1000-8000-00805F9B34FB', + descriptorValue: bufferDesc +}; +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.readDescriptorValue(descriptor, readDesc); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### readDescriptorValue + +readDescriptorValue(descriptor: BLEDescriptor): Promise<BLEDescriptor> + +Reads the descriptor contained in the specific characteristic of the remote BLE device. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ---------- | ------------------------------- | ---- | -------- | +| descriptor | [BLEDescriptor](#bledescriptor) | Yes | Descriptor to read.| + +**Return value** + +| Type | Description | +| ---------------------------------------- | -------------------------- | +| Promise<[BLEDescriptor](#bledescriptor)> | Promise used to return the descriptor read.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2901000 | Read forbidden. | +|2900099 | Operation failed. | + +**Example** + +```js +let bufferDesc = new ArrayBuffer(8); +let descV = new Uint8Array(bufferDesc); +descV[0] = 11; +let descriptor = { + serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', + characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', + descriptorUuid: '00002903-0000-1000-8000-00805F9B34FB', + descriptorValue: bufferDesc +}; +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.readDescriptorValue(descriptor); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### writeCharacteristicValue + +writeCharacteristicValue(characteristic: BLECharacteristic): void + +Writes a characteristic value to the remote BLE device. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------------- | --------------------------------------- | ---- | ------------------- | +| characteristic | [BLECharacteristic](#blecharacteristic) | Yes | Binary value and other parameters of the BLE device characteristic.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2901001 | Write forbidden. | +|2900099 | Operation failed. | + +**Example** + +```js +let descriptors = []; +let bufferDesc = new ArrayBuffer(8); +let descV = new Uint8Array(bufferDesc); +descV[0] = 11; +let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', + characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', + descriptorUuid: '00002903-0000-1000-8000-00805F9B34FB', descriptorValue: bufferDesc}; +descriptors[0] = descriptor; + +let bufferCCC = new ArrayBuffer(8); +let cccV = new Uint8Array(bufferCCC); +cccV[0] = 1; +let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', + characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', + characteristicValue: bufferCCC, descriptors:descriptors}; +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.writeCharacteristicValue(characteristic); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### writeDescriptorValue + +writeDescriptorValue(descriptor: BLEDescriptor): void + +Writes binary data to the specific descriptor of the remote BLE device. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ---------- | ------------------------------- | ---- | ------------------ | +| descriptor | [BLEDescriptor](#bledescriptor) | Yes | Binary value and other parameters of the BLE device descriptor.| +| boolean | Returns **true** if the operation is successful; returns **false** otherwise.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2901001 | Write forbidden. | +|2900099 | Operation failed. | + +**Example** + +```js +let bufferDesc = new ArrayBuffer(8); +let descV = new Uint8Array(bufferDesc); +descV[0] = 22; +let descriptor = { + serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', + characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', + descriptorUuid: '00002903-0000-1000-8000-00805F9B34FB', + descriptorValue: bufferDesc +}; +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.writeDescriptorValue(descriptor); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### setBLEMtuSize + +setBLEMtuSize(mtu: number): void + +Sets the maximum transmission unit (MTU) that can be transmitted between the GATT client and its remote BLE device. This API can be used only after a connection is set up by calling [connect](#connect). + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ---- | ------ | ---- | -------------- | +| mtu | number | Yes | MTU to set, which ranges from 22 to 512 bytes.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900099 | Operation failed. | + +**Example** + +```js +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.setBLEMtuSize(128); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### setNotifyCharacteristicChanged + +setNotifyCharacteristicChanged(characteristic: BLECharacteristic, enable: boolean): void + +Sets the function of notifying the GATT client when the characteristic value of the remote BLE device changes. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------------- | --------------------------------------- | ---- | ----------------------------- | +| characteristic | [BLECharacteristic](#blecharacteristic) | Yes | BLE characteristic to listen for. | +| enable | boolean | Yes | Whether to enable the notify function. The value **true** means to enable the notify function, and the value **false** means the opposite.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900099 | Operation failed. | + +**Example** + +```js +// Create descriptors. +let descriptors = []; +let arrayBuffer = new ArrayBuffer(8); +let descV = new Uint8Array(arrayBuffer); +descV[0] = 11; +let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', + characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', + descriptorUuid: '00002902-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer}; +descriptors[0] = descriptor; +let arrayBufferC = new ArrayBuffer(8); +let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', + characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', characteristicValue: arrayBufferC, descriptors:descriptors}; +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.setNotifyCharacteristicChanged(characteristic, false); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} + +``` + + +### on('BLECharacteristicChange') + +on(type: "BLECharacteristicChange", callback: Callback<BLECharacteristic>): void + +Subscribes to the BLE characteristic change events. The client can receive a notification from the server only after the **setNotifyCharacteristicChanged** method is called. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **BLECharacteristicChange** indicates a characteristic value change event.| +| callback | Callback<[BLECharacteristic](#blecharacteristic)> | Yes | Callback invoked to return the characteristic value changes. | + +**Example** + +```js +function CharacteristicChange(CharacteristicChangeReq) { + let serviceUuid = CharacteristicChangeReq.serviceUuid; + let characteristicUuid = CharacteristicChangeReq.characteristicUuid; + let value = new Uint8Array(CharacteristicChangeReq.characteristicValue); +} +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.on('BLECharacteristicChange', CharacteristicChange); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### off('BLECharacteristicChange') + +off(type: "BLECharacteristicChange", callback?: Callback<BLECharacteristic>): void + +Unsubscribes from the BLE characteristic change events. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **BLECharacteristicChange** indicates a characteristic value change event.| +| callback | Callback<[BLECharacteristic](#blecharacteristic)> | No | Callback for the characteristic value change event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| + +**Example** + +```js +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.off('BLECharacteristicChange'); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### on('BLEConnectionStateChange') + +on(type: "BLEConnectionStateChange", callback: Callback<BLEConnectChangedState>): void + +Subscribes to the BLE connection state change events. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **BLEConnectionStateChange** indicates a BLE connection state change event.| +| callback | Callback<[BLEConnectChangedState](#bleconnectchangedstate)> | Yes | Callback invoked to return the BLE connection state. | + +**Example** + +```js +function ConnectStateChanged(state) { + console.log('bluetooth connect state changed'); + let connectState = state.state; +} +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.on('BLEConnectionStateChange', ConnectStateChanged); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### off('BLEConnectionStateChange') + +off(type: "BLEConnectionStateChange", callback?: Callback<BLEConnectChangedState>): void + +Unsubscribes from the BLE connection state change events. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value **BLEConnectionStateChange** indicates a BLE connection state change event.| +| callback | Callback<[BLEConnectChangedState](#bleconnectchangedstate)> | No | Callback for the BLE connection state change event. If this parameter is not set, this method unsubscribes from all callbacks corresponding to **type**.| + +**Example** + +```js +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.off('BLEConnectionStateChange'); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### getDeviceName + +getDeviceName(callback: AsyncCallback<string>): void + +Obtains the name of the remote BLE device. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | --------------------------- | ---- | ------------------------------- | +| callback | AsyncCallback<string> | Yes | Callback invoked to return the remote BLE device name obtained.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900099 | Operation failed. | + +**Example** + +```js +// callback +try { + let gattClient = bluetoothManager.BLE.createGattClientDevice("XX:XX:XX:XX:XX:XX"); + gattClient.connect(); + let deviceName = gattClient.getDeviceName((err, data)=> { + console.info('device name err ' + JSON.stringify(err)); + console.info('device name' + JSON.stringify(data)); + }) +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### getDeviceName + +getDeviceName(): Promise<string> + +Obtains the name of the remote BLE device. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Return value** + +| Type | Description | +| --------------------- | ---------------------------------- | +| Promise<string> | Promise used to return the remote BLE device name.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900099 | Operation failed. | + +**Example** + +```js +// promise +try { + let gattClient = bluetoothManager.BLE.createGattClientDevice("XX:XX:XX:XX:XX:XX"); + gattClient.connect(); + let deviceName = gattClient.getDeviceName().then((data) => { + console.info('device name' + JSON.stringify(data)); + }) +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### getRssiValue + +getRssiValue(callback: AsyncCallback<number>): void + +Obtains the received signal strength indication (RSSI) of the remote BLE device. This API uses an asynchronous callback to return the result. It can be used only after a connection is set up by calling [connect](#connect). + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | --------------------------- | ---- | ------------------------------ | +| callback | AsyncCallback<number> | Yes | Callback invoked to return the RSSI, in dBm.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900099 | Operation failed. | + +**Example** + +```js +// callback +try { + let gattClient = bluetoothManager.BLE.createGattClientDevice("XX:XX:XX:XX:XX:XX"); + gattClient.connect(); + let rssi = gattClient.getRssiValue((err, data)=> { + console.info('rssi err ' + JSON.stringify(err)); + console.info('rssi value' + JSON.stringify(data)); + }) +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### getRssiValue + +getRssiValue(): Promise<number> + +Obtains the RSSI of the remote BLE device. This API uses a promise to return the result. It can be used only after a connection is set up by calling [connect](#connect). + +**Required permissions**: ohos.permission.USE_BLUETOOTH + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +**Return value** + +| Type | Description | +| --------------------- | --------------------------------- | +| Promise<number> | Promise used to return the RSSI, in dBm.| + +**Error codes** + +For details about the error codes, see [Bluetooth Error Codes](../errorcodes/errorcode-bluetoothManager.md). + +| ID| Error Message| +| -------- | ---------------------------- | +|2900099 | Operation failed. | + +**Example** + +```js +// promise +try { + let gattClient = bluetoothManager.BLE.createGattClientDevice("XX:XX:XX:XX:XX:XX"); + let rssi = gattClient.getRssiValue().then((data) => { + console.info('rssi' + JSON.stringify(data)); + }) +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + +## ScanMode + +Enumerates the scan modes. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Value | Description | +| ---------------------------------------- | ---- | --------------- | +| SCAN_MODE_NONE | 0 | No scan mode. | +| SCAN_MODE_CONNECTABLE | 1 | Connectable mode. | +| SCAN_MODE_GENERAL_DISCOVERABLE | 2 | General discoverable mode. | +| SCAN_MODE_LIMITED_DISCOVERABLE | 3 | Limited discoverable mode. | +| SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE | 4 | General connectable and discoverable mode.| +| SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE | 5 | Limited connectable and discoverable mode.| + +## BondState + +Enumerates the pairing states. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Value | Description | +| ------------------ | ---- | ------ | +| BOND_STATE_INVALID | 0 | Invalid pairing.| +| BOND_STATE_BONDING | 1 | Pairing. | +| BOND_STATE_BONDED | 2 | Paired. | + + +## SppOption + +Defines the SPP configuration parameters. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Type | Readable | Writable | Description | +| ------ | ------------------- | ---- | ---- | ----------- | +| uuid | string | Yes | Yes | UUID of the SPP.| +| secure | boolean | Yes | Yes | Whether it is a secure channel. | +| type | [SppType](#spptype) | Yes | Yes | Type of the SPP link. | + + +## SppType + +Enumerates the SPP link types. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Value | Description | +| ---------- | ---- | ------------- | +| SPP_RFCOMM | 0 | Radio frequency communication (RFCOMM) link type.| + + +## GattService + +Defines the GATT service API parameters. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Type | Readable | Writable | Description | +| --------------- | ---------------------------------------- | ---- | ---- | ---------------------------------------- | +| serviceUuid | string | Yes | Yes | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| +| isPrimary | boolean | Yes | Yes | Whether the service is a primary service. The value **true** means a primary service. | +| characteristics | Array<[BLECharacteristic](#blecharacteristic)> | Yes | Yes | List of characteristics of the service. | +| includeServices | Array<[GattService](#gattservice)> | Yes | Yes | Services on which the service depends. | + + +## BLECharacteristic + +Defines the characteristic API parameters. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Type | Readable | Writable | Description | +| ------------------- | ---------------------------------------- | ---- | ---- | ---------------------------------------- | +| serviceUuid | string | Yes | Yes | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| +| characteristicUuid | string | Yes | Yes | UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.| +| characteristicValue | ArrayBuffer | Yes | Yes | Binary value of the characteristic. | +| descriptors | Array<[BLEDescriptor](#bledescriptor)> | Yes | Yes | List of descriptors of the characteristic. | +| properties10+ | [GattProperties](#gattproperties10) | Yes | Yes | Properties of the characteristic. | + + +## BLEDescriptor + +Defines the BLE descriptor. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Type | Readable | Writable | Description | +| ------------------ | ----------- | ---- | ---- | ---------------------------------------- | +| serviceUuid | string | Yes | Yes | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| +| characteristicUuid | string | Yes | Yes | UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.| +| descriptorUuid | string | Yes | Yes | UUID of the descriptor, for example, **00002902-0000-1000-8000-00805f9b34fb**.| +| descriptorValue | ArrayBuffer | Yes | Yes | Binary value of the descriptor. | + + +## NotifyCharacteristic + +Defines the parameters in the notifications sent when the server characteristic value changes. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Type | Readable | Writable | Description | +| ------------------- | ----------- | ---- | ---- | ---------------------------------------- | +| serviceUuid | string | Yes | Yes | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| +| characteristicUuid | string | Yes | Yes | UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.| +| characteristicValue | ArrayBuffer | Yes | Yes | Binary value of the characteristic. | +| confirm | boolean | Yes | Yes | Whether the notification needs to be confirmed by the remote end. For a notification, set it to **true**. In this case, the remote end must confirm the receipt of the notification. For an indication, set it to **false**. In this case, the remote end does not need to confirm the receipt of the notification.| + + +## CharacteristicReadRequest + +Defines the parameters of the **CharacteristicReadReq** event received by the server. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Type | Readable | Writable | Description | +| ------------------ | ------ | ---- | ---- | ---------------------------------------- | +| deviceId | string | Yes | No | Address of the remote device that sends the **CharacteristicReadReq** event, for example, XX:XX:XX:XX:XX:XX.| +| transId | number | Yes | No | Transmission ID of the read request. The response returned by the server must use the same transmission ID. | +| offset | number | Yes | No | Position from which the characteristic value is read. For example, **k** means to read from the kth byte. The response returned by the server must use the same offset.| +| characteristicUuid | string | Yes | No | UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.| +| serviceUuid | string | Yes | No | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| + + +## CharacteristicWriteRequest + +Defines the parameters of the **CharacteristicWriteReq** event received by the server. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Type | Readable | Writable | Description | +| ------------------ | ------ | ---- | ---- | ---------------------------------------- | +| deviceId | string | Yes | No | Address of the remote device that sends the **CharacteristicWriteReq** event, for example, XX:XX:XX:XX:XX:XX.| +| transId | number | Yes | No | Transmission ID of the write request. The response returned by the server must use the same transmission ID. | +| offset | number | Yes | No | Start position for writing the characteristic value. For example, **k** means to write from the kth byte. The response returned by the server must use the same offset.| +| descriptorUuid | string | Yes | No | UUID of the descriptor, for example, **00002902-0000-1000-8000-00805f9b34fb**.| +| characteristicUuid | string | Yes | No | UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.| +| serviceUuid | string | Yes | No | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| + + +## DescriptorReadRequest + +Defines the parameters of the **DescriptorReadReq** event received by the server. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Type | Readable | Writable | Description | +| ------------------ | ------ | ---- | ---- | ---------------------------------------- | +| deviceId | string | Yes | No | Address of the remote device that sends a **DescriptorReadReq** event, for example, XX:XX:XX:XX:XX:XX.| +| transId | number | Yes | No | Transmission ID of the read request. The response returned by the server must use the same transmission ID. | +| offset | number | Yes | No | Position from which the descriptor is read. For example, **k** means to read from the kth byte. The response returned by the server must use the same offset.| +| descriptorUuid | string | Yes | No | UUID of the descriptor, for example, **00002902-0000-1000-8000-00805f9b34fb**.| +| characteristicUuid | string | Yes | No | UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.| +| serviceUuid | string | Yes | No | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| + + +## DescriptorWriteRequest + +Defines the parameters of the **DescriptorWriteReq** event received by the server. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Type | Readable | Writable | Description | +| ------------------ | ----------- | ---- | ---- | ---------------------------------------- | +| deviceId | string | Yes | No | Address of the remote device that sends a **DescriptorWriteReq** event, for example, XX:XX:XX:XX:XX:XX.| +| transId | number | Yes | No | Transmission ID of the write request. The response returned by the server must use the same transmission ID. | +| offset | number | Yes | No | Start position for writing the descriptor. For example, **k** means to write from the kth byte. The response returned by the server must use the same offset.| +| isPrep | boolean | Yes | No | Whether the write request is executed immediately. | +| needRsp | boolean | Yes | No | Whether to send a response to the GATT client. | +| value | ArrayBuffer | Yes | No | Binary value of the descriptor to write. | +| descriptorUuid | string | Yes | No | UUID of the descriptor, for example, **00002902-0000-1000-8000-00805f9b34fb**.| +| characteristicUuid | string | Yes | No | UUID of the characteristic, for example, **00002a11-0000-1000-8000-00805f9b34fb**.| +| serviceUuid | string | Yes | No | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.| + + +## ServerResponse + +Defines the parameters of the server's response to the GATT client's read/write request. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Type | Readable | Writable | Description | +| -------- | ----------- | ---- | ---- | -------------------------------------- | +| deviceId | string | Yes | No | Address of the remote device, for example, XX:XX:XX:XX:XX:XX. | +| transId | number | Yes | No | Transmission ID of the request. The value must be the same as the ID carried in the read/write request received. | +| status | number | Yes | No | Response state. Set this parameter to **0**, which indicates a normal response. | +| offset | number | Yes | No | Start read/write position. The value must be the same as the offset carried in the read/write request.| +| value | ArrayBuffer | Yes | No | Binary data in the response. | + + +## BLEConnectChangedState + +Defines the parameters of **BLEConnectChangedState**. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Type | Readable| Writable| Description | +| -------- | ------------------------------------------------- | ---- | ---- | --------------------------------------------- | +| deviceId | string | Yes | No | Address of the remote device, for example, XX:XX:XX:XX:XX:XX.| +| state | [ProfileConnectionState](#profileconnectionstate) | Yes | Yes | BLE connection state. | + + +## ProfileConnectionState + +Enumerates the profile connection states. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Value | Description | +| ------------------- | ---- | -------------- | +| STATE_DISCONNECTED | 0 | Disconnected. | +| STATE_CONNECTING | 1 | Connecting.| +| STATE_CONNECTED | 2 | Connected. | +| STATE_DISCONNECTING | 3 | Disconnecting.| + + +## ScanFilter + +Defines the scan filter parameters. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Type | Readable| Writable| Description | +| ---------------------------------------- | ----------- | ---- | ---- | ------------------------------------------------------------ | +| deviceId | string | Yes | Yes | Address of the BLE device to filter, for example, XX:XX:XX:XX:XX:XX. | +| name | string | Yes | Yes | Name of the BLE device to filter. | +| serviceUuid | string | Yes | Yes | Service UUID of the device to filter, for example, **00001888-0000-1000-8000-00805f9b34fb**.| +| serviceUuidMask | string | Yes | Yes | Service UUID mask of the device to filter, for example, **FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF**.| +| serviceSolicitationUuid | string | Yes | Yes | Service solicitation UUID of the device to filter, for example, **00001888-0000-1000-8000-00805F9B34FB**.| +| serviceSolicitationUuidMask | string | Yes | Yes | Service solicitation UUID mask of the device to filter, for example, **FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF**.| +| serviceData | ArrayBuffer | Yes | Yes | Service data of the device to filter, for example, **[0x90, 0x00, 0xF1, 0xF2]**.| +| serviceDataMask | ArrayBuffer | Yes | Yes | Service data mask of the device to filter, for example, **[0xFF,0xFF,0xFF,0xFF]**.| +| manufactureId | number | Yes | Yes | Manufacturer ID of the device to filter, for example, **0x0006**. | +| manufactureData | ArrayBuffer | Yes | Yes | Manufacturer data of the device to filter, for example, **[0x1F,0x2F,0x3F]**.| +| manufactureDataMask | ArrayBuffer | Yes | Yes | Manufacturer data mask of the device to filter, for example, **[0xFF, 0xFF, 0xFF]**.| + + +## ScanOptions + +Defines the scan configuration parameters. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Type | Readable | Writable | Description | +| --------- | ----------------------- | ---- | ---- | -------------------------------------- | +| interval | number | Yes | Yes | Delay in reporting the scan result. The default value is **0**. | +| dutyMode | [ScanDuty](#scanduty) | Yes | Yes | Scan duty. The default value is SCAN_MODE_LOW_POWER. | +| matchMode | [MatchMode](#matchmode) | Yes | Yes | Hardware filtering match mode. The default value is **MATCH_MODE_AGGRESSIVE**.| + + +## ScanDuty + +Enumerates the scan duty options. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Value | Description | +| --------------------- | ---- | ------------ | +| SCAN_MODE_LOW_POWER | 0 | Low-power mode, which is the default value.| +| SCAN_MODE_BALANCED | 1 | Balanced mode. | +| SCAN_MODE_LOW_LATENCY | 2 | Low-latency mode. | + + +## MatchMode + +Enumerates the hardware match modes of BLE scan filters. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Value | Description | +| --------------------- | ---- | ---------------------------------------- | +| MATCH_MODE_AGGRESSIVE | 1 | Hardware reports the scan result with a lower threshold of signal strength and few number of matches in a duration. This is the default value.| +| MATCH_MODE_STICKY | 2 | Hardware reports the scan result with a higher threshold of signal strength and sightings. | + + +## ScanResult + +Defines the scan result. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Type | Readable | Writable | Description | +| -------- | ----------- | ---- | ---- | ---------------------------------- | +| deviceId | string | Yes | No | Address of the scanned device, for example, XX:XX:XX:XX:XX:XX.| +| rssi | number | Yes | No | RSSI of the device. | +| data | ArrayBuffer | Yes | No | Advertisement packets sent by the device. | +| deviceName10+ | string | Yes | No | Name of the device detected. | + + +## BluetoothState + +Enumerates the Bluetooth states. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Value | Description | +| --------------------- | ---- | ------------------ | +| STATE_OFF | 0 | Bluetooth is turned off. | +| STATE_TURNING_ON | 1 | Bluetooth is being turned on. | +| STATE_ON | 2 | Bluetooth is turned on. | +| STATE_TURNING_OFF | 3 | Bluetooth is being turned off. | +| STATE_BLE_TURNING_ON | 4 | The LE-only mode is being turned on for Bluetooth.| +| STATE_BLE_ON | 5 | Bluetooth is in LE-only mode. | +| STATE_BLE_TURNING_OFF | 6 | The LE-only mode is being turned off for Bluetooth.| + + +## AdvertiseSetting + +Defines the BLE advertising parameters. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Type | Readable | Writable | Description | +| ----------- | ------- | ---- | ---- | ---------------------------------------- | +| interval | number | Yes | Yes | Interval for BLE advertising. The minimum value is **32** slots (20 ms). The maximum value is **16384** slots. The default value is **1600** slots (1s).| +| txPower | number | Yes | Yes | Transmit power, in dBm. The value range is -127 to 1. The default value is **-7**. | +| connectable | boolean | Yes | Yes | Whether the advertisement is connectable. The default value is **true**. | + + +## AdvertiseData + +Defines the content of a BLE advertisement packet. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Type | Readable | Writable | Description | +| --------------- | ---------------------------------------- | ---- | ---- | --------------------------- | +| serviceUuids | Array<string> | Yes | Yes | List of service UUIDs to broadcast.| +| manufactureData | Array<[ManufactureData](#manufacturedata)> | Yes | Yes | List of manufacturers to broadcast. | +| serviceData | Array<[ServiceData](#servicedata)> | Yes | Yes | List of service data to broadcast. | + + +## ManufactureData + +Defines the content of a BLE advertisement packet. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Type | Readable | Writable | Description | +| ---------------- | ------------------- | ---- | ---- | ------------------ | +| manufactureId | number | Yes | Yes | Manufacturer ID allocated by the Bluetooth SIG.| +| manufactureValue | ArrayBuffer | Yes | Yes | Manufacturer data. | + + +## ServiceData + +Defines the service data contained in an advertisement packet. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Type | Readable | Writable | Description | +| ------------ | ----------- | ---- | ---- | ---------- | +| serviceUuid | string | Yes | Yes | Service UUID.| +| serviceValue | ArrayBuffer | Yes | Yes | Service data. | + + +## PinRequiredParam + +Defines the pairing request parameters. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Type | Readable | Writable | Description | +| -------- | ------ | ---- | ---- | ----------- | +| deviceId | string | Yes | No | ID of the device to pair.| +| pinCode | string | Yes | No | Key for the device pairing. | +| pinType10+ | [PinType](#pintype10) | Yes | No | Type of the device to pair. | + + +## BondStateParam + +Defines the pairing state parameters. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Type | Readable | Writable | Description | +| -------- | ------ | ---- | ---- | ----------- | +| deviceId | string | Yes | No | ID of the device to pair.| +| state | BondState | Yes | No | State of the device.| + + +## StateChangeParam + +Defines the profile state change parameters. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Type | Readable| Writable| Description | +| -------- | ------------------------------------------------- | ---- | ---- | ------------------------------- | +| deviceId | string | Yes | No | Address of a Bluetooth device. | +| state | [ProfileConnectionState](#profileconnectionstate) | Yes | No | Profile connection state of the device.| + + +## GattProperties10+ + +Defines the properties of a GATT characteristic. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Type | Read-only | Mandatory | Description | +| -------- | ------ | ---- | ---- | ----------- | +| write10+ | boolean | Yes | Yes | Permits writes of the characteristic value (with a response).| +| writeNoResponse10+ | boolean | Yes | Yes | Permits writes of the characteristic value (without a response).| +| read10+ | boolean | Yes | Yes | Permits reads of the characteristic value.| +| notify10+ | boolean | Yes | Yes | Permits notifications of the characteristic value.| +| indicate10+ | boolean | Yes | Yes | Permits notifications of the characteristic value without acknowledgement.| + + +## DeviceClass + +Defines the class of a Bluetooth device. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Type | Readable | Writable | Description | +| --------------- | ----------------------------------- | ---- | ---- | ---------------- | +| majorClass | [MajorClass](#majorclass) | Yes | No | Major classes of Bluetooth devices. | +| majorMinorClass | [MajorMinorClass](#majorminorclass) | Yes | No | Major and minor classes of Bluetooth devices.| +| classOfDevice | number | Yes | No | Class of the device. | + + +## MajorClass + +Enumerates the major classes of Bluetooth devices. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Value | Description | +| ------------------- | ------ | ---------- | +| MAJOR_MISC | 0x0000 | Miscellaneous device. | +| MAJOR_COMPUTER | 0x0100 | Computer. | +| MAJOR_PHONE | 0x0200 | Mobile phone. | +| MAJOR_NETWORKING | 0x0300 | Network device. | +| MAJOR_AUDIO_VIDEO | 0x0400 | Audio or video device.| +| MAJOR_PERIPHERAL | 0x0500 | Peripheral device. | +| MAJOR_IMAGING | 0x0600 | Imaging device. | +| MAJOR_WEARABLE | 0x0700 | Wearable device. | +| MAJOR_TOY | 0x0800 | Toy. | +| MAJOR_HEALTH | 0x0900 | Health device. | +| MAJOR_UNCATEGORIZED | 0x1F00 | Unclassified device. | + + +## MajorMinorClass + +Enumerates the major and minor classes of Bluetooth devices. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Value | Description | +| ---------------------------------------- | ------ | --------------- | +| COMPUTER_UNCATEGORIZED | 0x0100 | Unclassified computer. | +| COMPUTER_DESKTOP | 0x0104 | Desktop computer. | +| COMPUTER_SERVER | 0x0108 | Server. | +| COMPUTER_LAPTOP | 0x010C | Laptop. | +| COMPUTER_HANDHELD_PC_PDA | 0x0110 | Hand-held computer. | +| COMPUTER_PALM_SIZE_PC_PDA | 0x0114 | Palmtop computer. | +| COMPUTER_WEARABLE | 0x0118 | Wearable computer. | +| COMPUTER_TABLET | 0x011C | Tablet. | +| PHONE_UNCATEGORIZED | 0x0200 | Unclassified mobile phone. | +| PHONE_CELLULAR | 0x0204 | Portable phone. | +| PHONE_CORDLESS | 0x0208 | Cordless phone. | +| PHONE_SMART | 0x020C | Smartphone. | +| PHONE_MODEM_OR_GATEWAY | 0x0210 | Modem or gateway phone.| +| PHONE_ISDN | 0x0214 | ISDN phone. | +| NETWORK_FULLY_AVAILABLE | 0x0300 | Device with network fully available. | +| NETWORK_1_TO_17_UTILIZED | 0x0320 | Device used on network 1 to 17. | +| NETWORK_17_TO_33_UTILIZED | 0x0340 | Device used on network 17 to 33. | +| NETWORK_33_TO_50_UTILIZED | 0x0360 | Device used on network 33 to 50. | +| NETWORK_60_TO_67_UTILIZED | 0x0380 | Device used on network 60 to 67. | +| NETWORK_67_TO_83_UTILIZED | 0x03A0 | Device used on network 67 to 83. | +| NETWORK_83_TO_99_UTILIZED | 0x03C0 | Device used on network 83 to 99. | +| NETWORK_NO_SERVICE | 0x03E0 | Device without network service | +| AUDIO_VIDEO_UNCATEGORIZED | 0x0400 | Unclassified audio or video device. | +| AUDIO_VIDEO_WEARABLE_HEADSET | 0x0404 | Wearable audio or video headset. | +| AUDIO_VIDEO_HANDSFREE | 0x0408 | Hands-free audio or video device. | +| AUDIO_VIDEO_MICROPHONE | 0x0410 | Audio or video microphone. | +| AUDIO_VIDEO_LOUDSPEAKER | 0x0414 | Audio or video loudspeaker. | +| AUDIO_VIDEO_HEADPHONES | 0x0418 | Audio or video headphones. | +| AUDIO_VIDEO_PORTABLE_AUDIO | 0x041C | Portable audio or video device. | +| AUDIO_VIDEO_CAR_AUDIO | 0x0420 | In-vehicle audio or video device. | +| AUDIO_VIDEO_SET_TOP_BOX | 0x0424 | Audio or video STB device. | +| AUDIO_VIDEO_HIFI_AUDIO | 0x0428 | High-fidelity speaker device. | +| AUDIO_VIDEO_VCR | 0x042C | Video cassette recording (VCR) device. | +| AUDIO_VIDEO_VIDEO_CAMERA | 0x0430 | Camera. | +| AUDIO_VIDEO_CAMCORDER | 0x0434 | Camcorder | +| AUDIO_VIDEO_VIDEO_MONITOR | 0x0438 | Audio or video monitor. | +| AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER | 0x043C | Video display or loudspeaker. | +| AUDIO_VIDEO_VIDEO_CONFERENCING | 0x0440 | Video conferencing device. | +| AUDIO_VIDEO_VIDEO_GAMING_TOY | 0x0448 | Audio or video gaming toy. | +| PERIPHERAL_NON_KEYBOARD_NON_POINTING | 0x0500 | Non-keyboard or non-pointing peripheral device. | +| PERIPHERAL_KEYBOARD | 0x0540 | Keyboard device. | +| PERIPHERAL_POINTING_DEVICE | 0x0580 | Pointing peripheral device. | +| PERIPHERAL_KEYBOARD_POINTING | 0x05C0 | Keyboard pointing device. | +| PERIPHERAL_UNCATEGORIZED | 0x0500 | Unclassified peripheral device. | +| PERIPHERAL_JOYSTICK | 0x0504 | Peripheral joystick. | +| PERIPHERAL_GAMEPAD | 0x0508 | Peripheral game pad | +| PERIPHERAL_REMOTE_CONTROL | 0x05C0 | Peripheral remote control device | +| PERIPHERAL_SENSING_DEVICE | 0x0510 | Peripheral sensing device. | +| PERIPHERAL_DIGITIZER_TABLET | 0x0514 | Peripheral digitizer tablet.| +| PERIPHERAL_CARD_READER | 0x0518 | Peripheral card reader. | +| PERIPHERAL_DIGITAL_PEN | 0x051C | Peripheral digital pen. | +| PERIPHERAL_SCANNER_RFID | 0x0520 | Peripheral RFID scanner. | +| PERIPHERAL_GESTURAL_INPUT | 0x0522 | Gesture input device. | +| IMAGING_UNCATEGORIZED | 0x0600 | Unclassified imaging device. | +| IMAGING_DISPLAY | 0x0610 | Imaging display device. | +| IMAGING_CAMERA | 0x0620 | Imaging camera device. | +| IMAGING_SCANNER | 0x0640 | Imaging scanner. | +| IMAGING_PRINTER | 0x0680 | Imaging printer. | +| WEARABLE_UNCATEGORIZED | 0x0700 | Unclassified wearable device. | +| WEARABLE_WRIST_WATCH | 0x0704 | Smart watch. | +| WEARABLE_PAGER | 0x0708 | Wearable pager. | +| WEARABLE_JACKET | 0x070C | Smart jacket. | +| WEARABLE_HELMET | 0x0710 | Wearable helmet. | +| WEARABLE_GLASSES | 0x0714 | Wearable glasses. | +| TOY_UNCATEGORIZED | 0x0800 | Unclassified toy. | +| TOY_ROBOT | 0x0804 | Toy robot. | +| TOY_VEHICLE | 0x0808 | Toy vehicle. | +| TOY_DOLL_ACTION_FIGURE | 0x080C | Humanoid toy doll. | +| TOY_CONTROLLER | 0x0810 | Toy controller. | +| TOY_GAME | 0x0814 | Toy gaming device. | +| HEALTH_UNCATEGORIZED | 0x0900 | Unclassified health devices. | +| HEALTH_BLOOD_PRESSURE | 0x0904 | Blood pressure device. | +| HEALTH_THERMOMETER | 0x0908 | Thermometer | +| HEALTH_WEIGHING | 0x090C | Body scale. | +| HEALTH_GLUCOSE | 0x0910 | Blood glucose monitor. | +| HEALTH_PULSE_OXIMETER | 0x0914 | Pulse oximeter. | +| HEALTH_PULSE_RATE | 0x0918 | Heart rate monitor. | +| HEALTH_DATA_DISPLAY | 0x091C | Health data display. | +| HEALTH_STEP_COUNTER | 0x0920 | Step counter. | +| HEALTH_BODY_COMPOSITION_ANALYZER | 0x0924 | Body composition analyzer. | +| HEALTH_PEAK_FLOW_MONITOR | 0x0928 | Hygrometer. | +| HEALTH_MEDICATION_MONITOR | 0x092C | Medication monitor. | +| HEALTH_KNEE_PROSTHESIS | 0x0930 | Prosthetic knee. | +| HEALTH_ANKLE_PROSTHESIS | 0x0934 | Prosthetic ankle. | +| HEALTH_GENERIC_HEALTH_MANAGER | 0x0938 | Generic health management device. | +| HEALTH_PERSONAL_MOBILITY_DEVICE | 0x093C | Personal mobility device. | + + +## PlayingState + +Enumerates the A2DP playing states. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Value | Description | +| ----------------- | ------ | ------- | +| STATE_NOT_PLAYING | 0x0000 | Not playing. | +| STATE_PLAYING | 0x0001 | Playing.| + + +## ProfileId + +Enumerates the Bluetooth profiles. API version 9 is added with **PROFILE_HID_HOST** and **PROFILE_PAN_NETWORK**. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Value | Description | +| -------------------------------- | ------ | --------------- | +| PROFILE_A2DP_SOURCE | 1 | A2DP profile.| +| PROFILE_HANDS_FREE_AUDIO_GATEWAY | 4 | HFP profile. | +| PROFILE_HID_HOST | 6 | Human Interface Device (HID) profile. | +| PROFILE_PAN_NETWORK | 7 | PAN profile. | + + +## PinType10+ + +Enumerates the Bluetooth pairing types. + +**System capability**: SystemCapability.Communication.Bluetooth.Core + +| Name | Value | Description | +| -------------------------------- | ------ | --------------- | +| PIN_TYPE_ENTER_PIN_CODE10+ | 0 | The user needs to enter the PIN displayed on the peer device.| +| PIN_TYPE_ENTER_PASSKEY10+ | 1 | The user needs to enter the PASSKEY displayed on the peer device. | +| PIN_TYPE_CONFIRM_PASSKEY10+ | 2 | The user needs to confirm the PASSKEY displayed on the local device. | +| PIN_TYPE_NO_PASSKEY_CONSENT10+ | 3 | There is no PASSKEY, and the user needs to accept or reject the pairing request. | +| PIN_TYPE_NOTIFY_PASSKEY10+ | 4 | The user needs to enter the PASSKEY displayed on the local device on the peer device. | +| PIN_TYPE_DISPLAY_PIN_CODE10+ | 5 | The user needs to enter the PIN displayed on the peer device for Bluetooth 2.0 devices. | +| PIN_TYPE_OOB_CONSENT10+ | 6 | The user needs to accept or reject the out of band (OOB) pairing request. | +| PIN_TYPE_PIN_16_DIGITS10+ | 7 | The user needs to enter the 16-digit PIN displayed on the peer device. | diff --git a/en/application-dev/reference/apis/js-apis-bundle-BundleInstaller.md b/en/application-dev/reference/apis/js-apis-bundle-BundleInstaller.md index 7523cde56562a53a6129d810dff30ba95a718a64..7882c709a4ccdeaa80aa956576318d365e130a03 100644 --- a/en/application-dev/reference/apis/js-apis-bundle-BundleInstaller.md +++ b/en/application-dev/reference/apis/js-apis-bundle-BundleInstaller.md @@ -3,7 +3,7 @@ The **BundleInstaller** module provides APIs for you to install, uninstall, and recover bundles on devices. > **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. ## BundleInstaller.install(deprecated) @@ -22,7 +22,7 @@ ohos.permission.INSTALL_BUNDLE SystemCapability.BundleManager.BundleFramework -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Parameters** @@ -72,7 +72,7 @@ ohos.permission.INSTALL_BUNDLE SystemCapability.BundleManager.BundleFramework -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Parameters** @@ -121,7 +121,7 @@ ohos.permission.INSTALL_BUNDLE SystemCapability.BundleManager.BundleFramework -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Parameters** @@ -160,9 +160,9 @@ bundle.getBundleInstaller().then(installer => { Describes the parameters required for bundle installation, recovery, or uninstall. - **System capability**: SystemCapability.BundleManager.BundleFramework +**System capability**: SystemCapability.BundleManager.BundleFramework - **System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. | Name | Type | Readable| Writable| Description | | ----------- | ------- | ---- | ---- | ------------------ | @@ -174,17 +174,17 @@ Describes the parameters required for bundle installation, recovery, or uninstal Describes the bundle installation or uninstall status. - **System capability**: SystemCapability.BundleManager.BundleFramework +**System capability**: SystemCapability.BundleManager.BundleFramework - **System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. | Name | Type | Readable| Writable| Description | | ------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------ | -| status | bundle.[InstallErrorCode](js-apis-Bundle.md#installerrorcode) | Yes | No | Installation or uninstall error code. The value must be defined in [InstallErrorCode](js-apis-Bundle.md#installerrorcode). | -| statusMessage | string | Yes | No | Installation or uninstall status message.
**SUCCESS**: install_succeed
**STATUS_INSTALL_FAILURE**: Installation failed (no installation file exists).
**STATUS_INSTALL_FAILURE_ABORTED**: Installation aborted.
**STATUS_INSTALL_FAILURE_INVALID**: Invalid installation parameter.
**STATUS_INSTALL_FAILURE_CONFLICT**: Installation conflict. (The basic information of the application to update is inconsistent with that of the existing application.)
**STATUS_INSTALL_FAILURE_STORAGE**: Failed to store the bundle information.
**STATUS_INSTALL_FAILURE_INCOMPATIBLE**: Installation incompatibility. (A downgrade occurs or the signature information is incorrect.)
**STATUS_UNINSTALL_FAILURE**: Uninstallation failed. (The application to be uninstalled is not found.)
**STATUS_UNINSTALL_FAILURE_ABORTED**: Uninstallation aborted. (This error code is not in use.)
**STATUS_UNINSTALL_FAILURE_ABORTED**: Uninstallation conflict. (Failed to uninstall a system application or end the application process.)
**STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT**: Installation failed. (Download timed out.)
**STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED**: Installation failed. (Download failed.)
**STATUS_RECOVER_FAILURE_INVALID**: Failed to restore the pre-installed application.
**STATUS_ABILITY_NOT_FOUND**: Ability not found.
**STATUS_BMS_SERVICE_ERROR**: BMS service error.
**STATUS_FAILED_NO_SPACE_LEFT**: Insufficient device space.
**STATUS_GRANT_REQUEST_PERMISSIONS_FAILED**: Application authorization failed.
**STATUS_INSTALL_PERMISSION_DENIED**: No installation permission.
**STATUS_UNINSTALL_PERMISSION_DENIED**: No uninstallation permission. | +| status | bundle.[InstallErrorCode](js-apis-Bundle.md#installerrorcode) | Yes | No | Installation or uninstall error code. The value must be defined in [InstallErrorCode](js-apis-Bundle.md#installerrorcode)| +| statusMessage | string | Yes | No | Installation or uninstall status message.
**SUCCESS**: install_succeed
**STATUS_INSTALL_FAILURE**: Installation failed (no installation file exists).
**STATUS_INSTALL_FAILURE_ABORTED**: Installation aborted.
**STATUS_INSTALL_FAILURE_INVALID**: Invalid installation parameter.
**STATUS_INSTALL_FAILURE_CONFLICT**: Installation conflict. (The basic information of the application to update is inconsistent with that of the existing application.)
**STATUS_INSTALL_FAILURE_STORAGE**: Failed to store the bundle information.
**STATUS_INSTALL_FAILURE_INCOMPATIBLE**: Installation incompatibility. (A downgrade occurs or the signature information is incorrect.)
**STATUS_UNINSTALL_FAILURE**: Uninstallation failed. (The application to be uninstalled is not found.)
**STATUS_UNINSTALL_FAILURE_ABORTED**: Uninstallation aborted. (This error code is not in use.)
**STATUS_UNINSTALL_FAILURE_ABORTED**: Uninstallation conflict. (Failed to uninstall a system application or end the application process.)
**STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT**: Installation failed. (Download timed out.)
**STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED**: Installation failed. (Download failed.)
**STATUS_RECOVER_FAILURE_INVALID**: Failed to restore the pre-installed application.
**STATUS_ABILITY_NOT_FOUND**: Ability not found.
**STATUS_BMS_SERVICE_ERROR**: BMS service error.
**STATUS_FAILED_NO_SPACE_LEFT**: Insufficient device space.
**STATUS_GRANT_REQUEST_PERMISSIONS_FAILED**: Application authorization failed.
**STATUS_INSTALL_PERMISSION_DENIED**: No installation permission.
**STATUS_UNINSTALL_PERMISSION_DENIED**: No uninstallation permission.| ## Obtaining the Sandbox Path -For the FA model, the sandbox path of a bundle can be obtained using the APIs in [Context](js-apis-inner-app-context.md). For the stage model, the sandbox path can be obtained using the attribute in [Context](js-apis-ability-context.md#abilitycontext). The following describes how to obtain the sandbox path. +For the FA model, the sandbox path of a bundle can be obtained using the APIs in [Context](js-apis-inner-app-context.md). For the stage model, the sandbox path can be obtained using the attribute in [Context](js-apis-inner-application-uiAbilityContext.md#abilitycontext). The following describes how to obtain the sandbox path. **Example** ``` ts diff --git a/en/application-dev/reference/apis/js-apis-bundle-LauncherAbilityInfo.md b/en/application-dev/reference/apis/js-apis-bundle-LauncherAbilityInfo.md index 2ba6d913831b33b67834fa24aa1c4307259019d7..31db9e4886ecac48a49aa1439e57874514f0a6b4 100644 --- a/en/application-dev/reference/apis/js-apis-bundle-LauncherAbilityInfo.md +++ b/en/application-dev/reference/apis/js-apis-bundle-LauncherAbilityInfo.md @@ -3,7 +3,7 @@ The **LauncherAbilityInfo** module provides information about the launcher ability, which is obtained through [innerBundleManager.getLauncherAbilityInfos](js-apis-Bundle-InnerBundleManager.md). > **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. ## LauncherAbilityInfo(deprecated) @@ -12,7 +12,7 @@ The **LauncherAbilityInfo** module provides information about the launcher abili **System capability**: SystemCapability.BundleManager.BundleFramework -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. | Name | Type | Readable| Writable| Description | | --------------- | ---------------------------------------------------- | ---- | ---- | -------------------------------------- | diff --git a/en/application-dev/reference/apis/js-apis-bundle-PermissionDef.md b/en/application-dev/reference/apis/js-apis-bundle-PermissionDef.md index b99bd49d939b65315f9cc8e983e5ffe4641fe1a3..ab6d063fa08e6df842d28405fc80e01d9c90c7d1 100644 --- a/en/application-dev/reference/apis/js-apis-bundle-PermissionDef.md +++ b/en/application-dev/reference/apis/js-apis-bundle-PermissionDef.md @@ -12,11 +12,11 @@ The **PermissionDef** module provides permission details defined in the configur **System capability**: SystemCapability.BundleManager.BundleFramework -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. | Name | Type | Readable| Writable| Description | | -------------- | ------ | ---- | ---- | -------------- | | permissionName | string | Yes | No | Name of the permission. | | grantMode | number | Yes | No | Grant mode of the permission. The value **0** means that the system automatically grants the permission after the application installation, and **1** means that the application needs to dynamically request the permission from the user.| -| labelId | number | Yes | No | ID of the permission label. | -| descriptionId | number | Yes | No | ID of the permission description. | +| labelId | number | Yes | No | ID of the permission label. | +| descriptionId | number | Yes | No | ID of the permission description. | diff --git a/en/application-dev/reference/apis/js-apis-bundle-remoteAbilityInfo.md b/en/application-dev/reference/apis/js-apis-bundle-remoteAbilityInfo.md index 47646ca01faf5e6915e3d4ecc42e6596697f79bf..be12e99759edb0a9a1b94f5fda05f4c27e0064d4 100644 --- a/en/application-dev/reference/apis/js-apis-bundle-remoteAbilityInfo.md +++ b/en/application-dev/reference/apis/js-apis-bundle-remoteAbilityInfo.md @@ -12,11 +12,10 @@ The **RemoteAbilityInfo** module provides information about a remote ability. **System capability**: SystemCapability.BundleManager.DistributedBundleFramework -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. | Name | Type | Readable| Writable| Description | | ----------- | -------------------------------------------- | ---- | ---- | ----------------------- | | elementName | [ElementName](js-apis-bundle-ElementName.md) | Yes | No | Element name information of the ability. | | label | string | Yes | No | Ability name. | | icon | string | Yes | No | Icon of the ability.| - diff --git a/en/application-dev/reference/apis/js-apis-bundleManager-BundlePackInfo.md b/en/application-dev/reference/apis/js-apis-bundleManager-BundlePackInfo.md index e6fd8bd2c8cd018a0ed0fe0d5cfdb226f542b438..1724888a4d646c1f105fdb9b60ef1be7d098dc3d 100644 --- a/en/application-dev/reference/apis/js-apis-bundleManager-BundlePackInfo.md +++ b/en/application-dev/reference/apis/js-apis-bundleManager-BundlePackInfo.md @@ -5,6 +5,8 @@ The **BundlePackInfo** module provides information in the **pack.info** file. Th > **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. ## BundlePackInfo @@ -63,10 +65,10 @@ The **BundlePackInfo** module provides information in the **pack.info** file. Th | ------------------ | ------------------------------------------------- | ---- | ---- | ---------------------------------- | | mainAbility | string | Yes| No| Name of the main ability.| | apiVersion | [ApiVersion](#apiversion) | Yes | No | API version of the module. | -| deviceType | Array\ | Yes | No | Device types supported by the module. | +| deviceTypes | Array\ | Yes | No | Device types supported by the module. | | distro | [ModuleDistroInfo](#moduledistroinfo) | Yes | No | Distribution information of the module. | | abilities | Array\<[ModuleAbilityInfo](#moduleabilityinfo)> | Yes | No | Ability information of the module. | -| extensionAbilities | Array\<[ExtensionAbilities](#extensionability)> | Yes | No | ExtensionAbility information of the module.| +| extensionAbilities | Array\<[ExtensionAbility](#extensionability)> | Yes | No | ExtensionAbility information of the module.| ## ModuleDistroInfo @@ -123,7 +125,7 @@ The **BundlePackInfo** module provides information in the **pack.info** file. Th ## ApiVersion -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **System capability**: SystemCapability.BundleManager.BundleFrameWork.FreeInstall diff --git a/en/application-dev/reference/apis/js-apis-bundleManager-applicationInfo.md b/en/application-dev/reference/apis/js-apis-bundleManager-applicationInfo.md index 2537274b8d5bd50d6c47258be2770bd5d51a9733..3447ba9b6dacd6a5606902caa24269931ff0d09e 100644 --- a/en/application-dev/reference/apis/js-apis-bundleManager-applicationInfo.md +++ b/en/application-dev/reference/apis/js-apis-bundleManager-applicationInfo.md @@ -9,16 +9,15 @@ The **ApplicationInfo** module defines the application information. A system app ## ApplicationInfo **System capability**: SystemCapability.BundleManager.BundleFramework.Core - | Name | Type | Readable| Writable| Description | | -------------------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------------------------------------ | | name | string | Yes | No | Application name. | -| description | string | Yes | No | Application description. | +| description | string | Yes | No | Description of the application, for example, "description": $string: mainability_description". | | descriptionId | number | Yes | No | ID of the application description. | | enabled | boolean | Yes | No | Whether the application is enabled. The default value is **true**. | -| label | string | Yes | No | Application label. | +| label | string | Yes | No | Application name, for example, "label": "$string: mainability_description".| | labelId | number | Yes | No | ID of the application label. | -| icon | string | Yes | No | Application icon. | +| icon | string | Yes | No | Application icon, for example, "icon": "$media:icon". | | iconId | number | Yes | No | ID of the application icon. | | process | string | Yes | No | Process in which the application runs. If this parameter is not set, the bundle name is used. | | permissions | Array\ | Yes | No | Permissions required for accessing the application. The permissions can be obtained by passing in **GET_APPLICATION_INFO_WITH_PERMISSION** to the **appFlags** parameter of [bundleManager.getApplicationInfo](js-apis-bundleManager.md#bundlemanagergetapplicationinfo).| @@ -27,9 +26,10 @@ The **ApplicationInfo** module defines the application information. A system app | removable | boolean | Yes | No | Whether the application is removable. | | accessTokenId | number | Yes | No | Access token ID of the application. | | uid | number | Yes | No | UID of the application. | -| iconResource | [Resource](js-apis-resource-manager.md#resource9) | Yes| No| Icon resource of the application. | -| labelResource | [Resource](js-apis-resource-manager.md#resource9) | Yes| No| Label resource of the application. | -| descriptionResource | [Resource](js-apis-resource-manager.md#resource9) | Yes| No| Description resource of the application. | +| iconResource | [Resource](js-apis-resource-manager.md#resource9) | Yes| No| Resource information of the application icon. The resource information obtained contains the bundle name, module name, and ID of the resource. You can call **getMediaContent** in [@ohos.resourceManager.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.resourceManager.d.ts) to obtain the resource details. | +| labelResource | [Resource](js-apis-resource-manager.md#resource9) | Yes| No| Resource information of the application label. The resource information obtained contains the bundle name, module name, and ID of the resource. You can call **getMediaContent** in [@ohos.resourceManager.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.resourceManager.d.ts) to obtain the resource details. | +| descriptionResource | [Resource](js-apis-resource-manager.md#resource9) | Yes| No| Resource information of the application description. The resource information obtained contains the bundle name, module name, and ID of the resource. You can call **getMediaContent** in [@ohos.resourceManager.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.resourceManager.d.ts) to obtain the resource details.| | appDistributionType | string | Yes | No | Distribution type of the application signing certificate. The options are **app_gallery**, **enterprise**, **os_integration**, and **crowdtesting**. | | appProvisionType | string | Yes | No | Type of the application signing certificate file. The options are **debug** and **release**. | | systemApp | boolean | Yes | No | Whether the application is a system application. | +| bundleType |[BundleType](js-apis-bundleManager.md#bundletype) | Yes | No | Bundle type, which can be **APP** (common application) or **ATOMIC_SERVICE** (atomic service). | diff --git a/en/application-dev/reference/apis/js-apis-bundleManager-hapModuleInfo.md b/en/application-dev/reference/apis/js-apis-bundleManager-hapModuleInfo.md index 146e3da56069f96ce10e20a62b9d2474bc51508a..d5962d34571e7c1cafdcb520643c029812603d12 100644 --- a/en/application-dev/reference/apis/js-apis-bundleManager-hapModuleInfo.md +++ b/en/application-dev/reference/apis/js-apis-bundleManager-hapModuleInfo.md @@ -26,3 +26,28 @@ The **HapModuleInfo** module defines the HAP module information. A system applic | deviceTypes | Array\ | Yes | No | Types of devices where the module can run. | | installationFree | boolean | Yes | No | Whether installation-free is supported. | | hashValue | string | Yes | No | Hash value of the module. | +| moduleType | [ModuleType](js-apis-bundleManager.md#moduletype) | Yes | No | Type of the module. | +| preloads | Array\<[PreloadItem](#preloaditem)> | Yes | No | Preloaded modules in the atomic service.| +| dependencies | Array\<[Dependency](#dependency)> | Yes | No | Dynamic shared libraries on which the module depends. | + +## PreloadItem + +Describes the preloaded module information in the atomic service. + + **System capability**: SystemCapability.BundleManager.BundleFramework.Core + +| Name | Type | Readable| Writable| Description | +| --------- | -------------- | ---- | ---- | --------------------------- | +|moduleName | string | Yes | No | Name of the module automatically preloaded by the system.| + +## Dependency + +Describes the information about the dynamic shared library on which the module depends. + + **System capability**: SystemCapability.BundleManager.BundleFramework.Core + +| Name | Type | Readable| Writable| Description | +| ----------- | ------ | ---- | ---- | ---------------------- | +| bundleName | string | Yes | No | Name of the shared bundle on which the current module depends. | +| moduleName | string | Yes | No | Module name of the shared bundle on which the current module depends.| +| versionCode | number | Yes | No | Version number of the shared bundle. | diff --git a/en/application-dev/reference/apis/js-apis-bundleManager-launcherAbilityInfo.md b/en/application-dev/reference/apis/js-apis-bundleManager-launcherAbilityInfo.md index 95326049595c17027a48552e04fab2d5a57816bb..64353f2c4fd878ccfcd5d5ac2d84e8d41cbd9607 100644 --- a/en/application-dev/reference/apis/js-apis-bundleManager-launcherAbilityInfo.md +++ b/en/application-dev/reference/apis/js-apis-bundleManager-launcherAbilityInfo.md @@ -10,7 +10,7 @@ The **LauncherAbilityInfo** module defines the ability information of the home s **System capability**: SystemCapability.BundleManager.BundleFramework.Launcher -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. | Name | Type | Readable| Writable| Description | | --------------- | ----------------------------------------------------------- | ---- | ---- | ------------------------------------ | diff --git a/en/application-dev/reference/apis/js-apis-bundleManager-overlayModuleInfo.md b/en/application-dev/reference/apis/js-apis-bundleManager-overlayModuleInfo.md new file mode 100644 index 0000000000000000000000000000000000000000..5e16b3342c0f6a196c3da5362f950eecacf4c4a5 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-bundleManager-overlayModuleInfo.md @@ -0,0 +1,19 @@ +# OverlayModuleInfo + +> **NOTE** +> +> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version. + +The **OverlayModuleInfo** module provides information about a module with the overlay feature. A system application can obtain such information of the specified application through [overlay.getOverlayModuleInfoByBundleName](js-apis-overlay.md#overlaygetoverlaymoduleinfobybundlename), and a third-party application can obtain such information of the current application through [overlay.getOverlayModuleInfo](js-apis-overlay.md#overlaygetoverlaymoduleinfo). + +## OverlayModuleInfo + + **System capability**: SystemCapability.BundleManager.BundleFramework.Overlay + +| Name | Type | Readable| Writable| Description | +| --------------------- | ---------------------------------------------------| ---- | ---- | ---------------------------------------------- | +| bundleName | string | Yes | No | Bundle name of the application to which the module with the overlay feature belongs. | +| moduleName | string | Yes | No | HAP name of the module with the overlay feature. | +| targetModuleName | string | Yes | No | HAP name of the target module specified by the module with the overlay feature. | +| priority | number | Yes | No | Priority of the module with the overlay feature. | +| state | number | Yes | No | Whether the module with the overlay feature is disabled. The value **0** means that the module is disabled, and **1** means the opposite. | diff --git a/en/application-dev/reference/apis/js-apis-bundleManager-remoteAbilityInfo.md b/en/application-dev/reference/apis/js-apis-bundleManager-remoteAbilityInfo.md index 0281e4fc7785bd815c1b988a9f67fb74b5a514de..fe52efef12fd03e53968dd186b20ebb456be5047 100644 --- a/en/application-dev/reference/apis/js-apis-bundleManager-remoteAbilityInfo.md +++ b/en/application-dev/reference/apis/js-apis-bundleManager-remoteAbilityInfo.md @@ -1,6 +1,6 @@ # RemoteAbilityInfo -The **RemoteAbilityInfo** module provides information about a remote ability, which can be obtained through [distributedBundle.getRemoteAbilityInfo](js-apis-distributedBundle.md). +The **RemoteAbilityInfo** module provides information about a remote ability, which can be obtained through [distributedBundle.getRemoteAbilityInfo](js-apis-distributedBundleManager.md#distributedbundlegetremoteabilityinfo). > **NOTE** > diff --git a/en/application-dev/reference/apis/js-apis-bundleManager-sharedBundleInfo.md b/en/application-dev/reference/apis/js-apis-bundleManager-sharedBundleInfo.md new file mode 100644 index 0000000000000000000000000000000000000000..ad5ee9f5503d04a49060f69b40f4883a0af0773e --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-bundleManager-sharedBundleInfo.md @@ -0,0 +1,33 @@ +# SharedBundleInfo + +The **SharedBundleInfo** module provides information about the shared bundle. The information can be obtained by calling [bundleManager.getSharedBundleInfo](js-apis-bundleManager.md). + +> **NOTE** +> +> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version. + +## SharedBundleInfo + +Defines the shared bundle information. + +**System capability**: SystemCapability.BundleManager.BundleFramework.Core + +| Name | Type | Readable| Writable| Description | +| ---------------- | ------------------------------ | ---- | ---- | ---------------------- | +| name | string | Yes | No | Name of the shared bundle. | +| compatiblePolicy | bundleManager.CompatiblePolicy | Yes | No | Compatibility type of the shared bundle.| +| sharedModuleInfo | Array\ | Yes | No | Information about the shared module. | + +## SharedModuleInfo + +Defines the shared module information. + +**System capability**: SystemCapability.BundleManager.BundleFramework.Core + +| Name | Type | Readable| Writable| Description | +| ------------- | ------ | ---- | ---- | -------------------------- | +| name | string | Yes | No | Module name of the shared bundle. | +| versionCode | number | Yes | No | Version number of the shared bundle. | +| versionName | string | Yes | No | Version description of the shared bundle.| +| description | string | Yes | No | Description of the shared bundle. | +| descriptionId | number | Yes | No | Description ID of the shared bundle. | diff --git a/en/application-dev/reference/apis/js-apis-bundleManager.md b/en/application-dev/reference/apis/js-apis-bundleManager.md index a346a61081df95cc18e35898c07674db7bd3f318..d5d0ff10e38e7597fdc1bed9d6a4a2a1627c5ade 100644 --- a/en/application-dev/reference/apis/js-apis-bundleManager.md +++ b/en/application-dev/reference/apis/js-apis-bundleManager.md @@ -49,7 +49,7 @@ Enumerates the application flags, which indicate the type of application informa **System capability**: SystemCapability.BundleManager.BundleFramework.Core - **System API**: This is a system API and cannot be called by third-party applications. + **System API**: This is a system API. | Name | Value | Description | | ------------------------------------ | ---------- | ------------------------------------------------------------ | @@ -64,7 +64,7 @@ Enumerates the ability flags, which indicate the type of ability information to **System capability**: SystemCapability.BundleManager.BundleFramework.Core - **System API**: This is a system API and cannot be called by third-party applications. + **System API**: This is a system API. | Name | Value | Description | | --------------------------------- | ---------- | ------------------------------------------------------------ | @@ -81,7 +81,7 @@ Enumerates the Extension ability flags, which indicate the type of Extension abi **System capability**: SystemCapability.BundleManager.BundleFramework.Core - **System API**: This is a system API and cannot be called by third-party applications. + **System API**: This is a system API. | Name | Value | Description | | ------------------------------------------- | ---------- | ------------------------------------------------------------ | @@ -98,12 +98,12 @@ Enumerates the types of Extension abilities. | Name| Value| Description| |:----------------:|:---:|-----| -| FORM | 0 | [FormExtensionAbility](../../application-models/widget-development-stage.md): provides APIs for widget development.| +| FORM | 0 | [FormExtensionAbility](../../application-models/service-widget-overview.md): provides APIs for widget development.| | WORK_SCHEDULER | 1 | [WorkSchedulerExtensionAbility](../../task-management/work-scheduler-dev-guide.md): enables applications to execute non-real-time tasks when the system is idle.| | INPUT_METHOD | 2 | [InputMethodExtensionAbility](js-apis-inputmethod-extension-ability.md): provides APIs for developing input method applications.| | SERVICE | 3 | [ServiceExtensionAbility](../../application-models/serviceextensionability.md): enables applications to run in the background and provide services.| | ACCESSIBILITY | 4 | [AccessibilityExtensionAbility](js-apis-application-accessibilityExtensionAbility.md): provides accessibility for access to and operations on the UI.| -| DATA_SHARE | 5 | [DataShareExtensionAbility](../../database/database-datashare-guidelines.md): enables applications to read and write data.| +| DATA_SHARE | 5 | [DataShareExtensionAbility](../../database/share-data-by-datashareextensionability.md): enables applications to read and write data.| | FILE_SHARE | 6 | FileShareExtensionAbility: enables file sharing between applications. This ability is reserved.| | STATIC_SUBSCRIBER| 7 | [StaticSubscriberExtensionAbility](js-apis-application-staticSubscriberExtensionAbility.md): provides APIs for processing static events, such as the startup event.| | WALLPAPER | 8 | WallpaperExtensionAbility: provides APIs to implement the home screen wallpaper. This ability is reserved.| @@ -112,6 +112,8 @@ Enumerates the types of Extension abilities. | ENTERPRISE_ADMIN | 11 | [EnterpriseAdminExtensionAbility](js-apis-EnterpriseAdminExtensionAbility.md): provides APIs for processing enterprise management events, such as application installation events on devices and events indicating too many incorrect screen-lock password attempts.| | THUMBNAIL | 13 | ThumbnailExtensionAbility: provides thumbnails for files. This ability is reserved.| | PREVIEW | 14 | PreviewExtensionAbility: provides APIs for file preview so that other applications can be embedded and displayed in the current application. This ability is reserved.| +| PRINT10+ | 15 | PrintExtensionAbility: provides APIs for printing images. Printing documents is not supported yet.| +| DRIVER10+ | 18 | DriverExtensionAbility: provides APIs for the peripheral driver. This type of ability is not supported yet.| | UNSPECIFIED | 255 | No type is specified. It is used together with **queryExtensionAbilityInfo** to query all types of Extension abilities.| @@ -186,6 +188,39 @@ Enumerates the display orientations of the ability. This attribute applies only | AUTO_ROTATION_PORTRAIT_RESTRICTED |11|Switched-determined auto rotation in the vertical direction.| | LOCKED |12|Locked.| +### CompatiblePolicy10+ + +Defines the version compatibility type of the shared library. + + **System capability**: SystemCapability.BundleManager.BundleFramework.Core + +| Name | Value | Description | +| ---------------------- | ---- | -------------------------------- | +| BACKWARD_COMPATIBILITY | 1 | The shared library is backward compatible.| + +### ModuleType + +Enumerates the module types. + + **System capability**: SystemCapability.BundleManager.BundleFramework.Core + +| Name | Value | Description | +| ------- | ---- | -------------------- | +| ENTRY | 1 | Main module of the application. | +| FEATURE | 2 | Dynamic feature module of the application.| +| SHARED | 3 | Dynamic shared library module of the application. | + +### BundleType + +Enumerates the bundle types. + + **System capability**: SystemCapability.BundleManager.BundleFramework.Core + +| Name | Value | Description | +| -------------- | ---- | --------------- | +| APP | 0 | The bundle is a common application. | +| ATOMIC_SERVICE | 1 | The bundle is an atomic service.| + ## APIs ### bundleManager.getBundleInfoForSelf @@ -1076,7 +1111,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc | ID| Error Message | | -------- | ------------------------------------- | | 17700001 | The specified bundleName is not found. | -| 17700003 | The specified extensionAbility is not found. | +| 17700003 | The specified ability is not found. | | 17700004 | The specified userId is invalid. | | 17700026 | The specified bundle is disabled. | | 17700029 | The specified ability is disabled. | @@ -2215,7 +2250,7 @@ try { ### bundleManager.getProfileByAbility -getProfileByAbility(moduleName: string, abilityName: string, metadataName: string, callback: AsyncCallback>): void; +getProfileByAbility(moduleName: string, abilityName: string, metadataName: string, callback: AsyncCallback\\>): void; Obtains the JSON strings of the configuration file based on the given module ame, ability name, and metadata name. This API uses an asynchronous callback to return the result. @@ -2266,7 +2301,7 @@ try { ### bundleManager.getProfileByAbility -getProfileByAbility(moduleName: string, abilityName: string, metadataName?: string): Promise>; +getProfileByAbility(moduleName: string, abilityName: string, metadataName?: string): Promise\\>; Obtains the JSON strings of the configuration file based on the given module ame, ability name, and metadata name. This API uses a promise to return the result. @@ -2336,7 +2371,7 @@ try { ### bundleManager.getProfileByExtensionAbility -getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName: string, callback: AsyncCallback>): void; +getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName: string, callback: AsyncCallback\\>): void; Obtains the JSON strings of the configuration file based on the given module ame, Extension ability name, and metadata name. This API uses an asynchronous callback to return the result. @@ -2386,7 +2421,7 @@ try { ### bundleManager.getProfileByExtensionAbility -getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName?: string): Promise>; +getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName?: string): Promise\\>; Obtains the JSON strings of the configuration file based on the given module ame, Extension ability name, and metadata name. This API uses a promise to return the result. @@ -2659,7 +2694,6 @@ try { ### bundleManager.getApplicationInfoSync getApplicationInfoSync(bundleName: string, applicationFlags: number, userId: number) : [ApplicationInfo](js-apis-bundleManager-applicationInfo.md); -getApplicationInfoSync(bundleName: string, applicationFlags: number) : [ApplicationInfo](js-apis-bundleManager-applicationInfo.md); Synchronously obtains the application information based on the given bundle name, application flags, and user ID. @@ -2710,6 +2744,42 @@ try { } ``` +### bundleManager.getApplicationInfoSync + +getApplicationInfoSync(bundleName: string, applicationFlags: number) : [ApplicationInfo](js-apis-bundleManager-applicationInfo.md); + +Synchronously obtains the application information based on the given bundle name and application flags. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + +**System capability**: SystemCapability.BundleManager.BundleFramework.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------------- | -------------------------- | ---- | ----------------------------------------------------- | +| bundleName | string | Yes | Bundle name. | +| applicationFlags | [number](#applicationflag) | Yes | Type of the application information to obtain.| + +**Return value** + +| Type | Description | +| ----------------------------------------------------------- | ------------------------- | +| [ApplicationInfo](js-apis-bundleManager-applicationInfo.md) | Application information obtained.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| -------- | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700026 | The specified bundle is disabled. | + +**Example** + ```ts import bundleManager from '@ohos.bundle.bundleManager'; import hilog from '@ohos.hilog'; @@ -2727,7 +2797,6 @@ try { ### bundleManager.getBundleInfoSync getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag), userId: number): [BundleInfo](js-apis-bundleManager-bundleInfo.md); -getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag)): [BundleInfo](js-apis-bundleManager-bundleInfo.md); Synchronously obtains the bundle information based on the given bundle name, bundle flags, and user ID. @@ -2743,7 +2812,7 @@ Synchronously obtains the bundle information based on the given bundle name, bun | ----------- | ------ | ---- | -------------------------------------------------------- | | bundleName | string | Yes | Bundle name. | | bundleFlags | [number](#bundleflag) | Yes | Type of the bundle information to obtain.| -| userId | number | No | User ID. | +| userId | number | Yes | User ID. | **Return value** @@ -2778,6 +2847,42 @@ try { } ``` +### bundleManager.getBundleInfoSync + +getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag)): [BundleInfo](js-apis-bundleManager-bundleInfo.md); + +Synchronously obtains the bundle information based on the given bundle name and bundle flags. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + +**System capability**: SystemCapability.BundleManager.BundleFramework.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----------- | --------------------- | ---- | ------------------------------------------------------ | +| bundleName | string | Yes | Bundle name. | +| bundleFlags | [number](#bundleflag) | Yes | Type of the bundle information to obtain.| + +**Return value** + +| Type | Description | +| ------------------------------------------------- | -------------------- | +| [BundleInfo](js-apis-bundleManager-bundleInfo.md) | Bundle information obtained.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| -------- | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700026 | The specified bundle is disabled. | + +**Example** + ```ts import bundleManager from '@ohos.bundle.bundleManager'; import hilog from '@ohos.hilog'; @@ -2790,3 +2895,342 @@ try { hilog.error(0x0000, 'testTag', 'getBundleInfoSync failed: %{public}s', err.message); } ``` + +### bundleManager.getSharedBundleInfo10+ + +getSharedBundleInfo(bundleName: string, moduleName: string, callback: AsyncCallback\\>): void; + +Obtains the shared bundle information based on the given bundle name. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**System capability**: SystemCapability.BundleManager.BundleFramework.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| bundleName | string | Yes | Bundle name. | +| moduleName | string | Yes | Module name. | +| callback | AsyncCallback\\> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is the shared bundle information obtained.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| -------- | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700002 | The specified moduleName is not found. | + +**Example** + +```ts +import bundleManager from '@ohos.bundle.bundleManager'; +import hilog from '@ohos.hilog'; +let bundleName = 'com.example.myapplication'; +let moduleName = 'library'; + +try { + bundleManager.getSharedBundleInfo(bundleName, moduleName, (err, data) => { + if (err) { + hilog.error(0x0000, 'testTag', 'getSharedBundleInfo failed: %{public}s', err.message); + } else { + hilog.info(0x0000, 'testTag', 'getSharedBundleInfo successfully: %{public}s', JSON.stringify(data)); + } + }); +} catch (err) { + hilog.error(0x0000, 'testTag', 'getSharedBundleInfo failed: %{public}s', err.message); +} +``` + +### bundleManager.getSharedBundleInfo10+ + +function getSharedBundleInfo(bundleName: string, moduleName: string): Promise\\>; + +Obtains the shared bundle information based on the given bundle name. This API uses a promise to return the result. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**System capability**: SystemCapability.BundleManager.BundleFramework.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | ------ | ---- | -------------------------- | +| bundleName | string | Yes | Bundle name.| +| moduleName | string | Yes | Module name.| + +**Return value** + +| Type | Description | +| ------------------------------------------------------------ | ----------------------------------- | +| Promise\\> | Promise used to return the shared bundle information obtained.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| -------- | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700002 | The specified moduleName is not found. | + +**Example** + +```ts +import bundleManager from '@ohos.bundle.bundleManager'; +import hilog from '@ohos.hilog'; +let bundleName = 'com.example.myapplication'; +let moduleName = 'library'; + +try { + bundleManager.getSharedBundleInfo(bundleName, moduleName).then((data) => { + hilog.info(0x0000, 'testTag', 'getSharedBundleInfo successfully. Data: %{public}s', JSON.stringify(data)); + }).catch(err => { + hilog.error(0x0000, 'testTag', 'getSharedBundleInfo failed. Cause: %{public}s', err.message); + }); +} catch (err) { + hilog.error(0x0000, 'testTag', 'getSharedBundleInfo failed. Cause: %{public}s', err.message); +} +``` + +### bundleManager.getAllSharedBundleInfo10+ + +getAllSharedBundleInfo(callback: AsyncCallback\\>): void; + +Obtains the information about all shared bundles. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**System capability**: SystemCapability.BundleManager.BundleFramework.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| callback | AsyncCallback\\> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is an array of the shared bundle information obtained.| + +**Example** + +```ts +import bundleManager from '@ohos.bundle.bundleManager'; +import hilog from '@ohos.hilog'; + +try { + bundleManager.getAllSharedBundleInfo((err, data) => { + if (err) { + hilog.error(0x0000, 'testTag', 'getAllSharedBundleInfo failed: %{public}s', err.message); + } else { + hilog.info(0x0000, 'testTag', 'getAllSharedBundleInfo successfully: %{public}s', JSON.stringify(data)); + } + }); +} catch (err) { + hilog.error(0x0000, 'testTag', 'getAllSharedBundleInfo failed: %{public}s', err.message); +} +``` + +### bundleManager.getAllSharedBundleInfo10+ + +function getAllSharedBundleInfo(): Promise\\>; + +Obtains the information about all shared bundles. This API uses a promise to return the result. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**System capability**: SystemCapability.BundleManager.BundleFramework.Core + +**Return value** + +| Type | Description | +| ------------------------------------------------------------ | ----------------------------------- | +| Promise\\> | Promise used to return an array of the shared bundle information obtained.| + +**Example** + +```ts +import bundleManager from '@ohos.bundle.bundleManager'; +import hilog from '@ohos.hilog'; + +try { + bundleManager.getAllSharedBundleInfo().then((data) => { + hilog.info(0x0000, 'testTag', 'getAllSharedBundleInfo successfully. Data: %{public}s', JSON.stringify(data)); + }).catch(err => { + hilog.error(0x0000, 'testTag', 'getAllSharedBundleInfo failed. Cause: %{public}s', err.message); + }); +} catch (err) { + hilog.error(0x0000, 'testTag', 'getAllSharedBundleInfo failed. Cause: %{public}s', err.message); +} +``` + +### bundleManager.getAppProvisionInfo10+ + +getAppProvisionInfo(bundleName: string, callback: AsyncCallback\<[AppProvisionInfo](js-apis-bundleManager-AppProvisionInfo.md)\>): void; + +Obtains the provision configuration file information based on the given bundle name. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**System capability**: SystemCapability.BundleManager.BundleFramework.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| bundleName | string | Yes | Bundle name.| +| callback | AsyncCallback\<[AppProvisionInfo](js-apis-bundleManager-AppProvisionInfo.md)\> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is the provision configuration file information obtained.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| -------- | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | + +**Example** + +```ts +import bundleManager from '@ohos.bundle.bundleManager'; +import hilog from '@ohos.hilog'; +let bundleName = "com.ohos.myapplication"; + +try { + bundleManager.getAppProvisionInfo(bundleName, (err, data) => { + if (err) { + hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed: %{public}s', err.message); + } else { + hilog.info(0x0000, 'testTag', 'getAppProvisionInfo successfully: %{public}s', JSON.stringify(data)); + } + }); +} catch (err) { + hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed: %{public}s', err.message); +} +``` + +### bundleManager.getAppProvisionInfo10+ + +getAppProvisionInfo(bundleName: string, userId: number, callback: AsyncCallback\<[AppProvisionInfo](js-apis-bundleManager-AppProvisionInfo.md)\>): void; + +Obtains the provision configuration file information based on the given bundle name and user ID. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**System capability**: SystemCapability.BundleManager.BundleFramework.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| bundleName | string | Yes | Bundle name.| +| userId | number | Yes| User ID, which can be obtained by calling [getOsAccountLocalId](js-apis-osAccount.md#getosaccountlocalid9).| +| callback | AsyncCallback\<[AppProvisionInfo](js-apis-bundleManager-AppProvisionInfo.md)\> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is the provision configuration file information obtained.| + + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| -------- | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700004 | The specified user ID is not found. | + +**Example** + +```ts +import bundleManager from '@ohos.bundle.bundleManager'; +import hilog from '@ohos.hilog'; +let bundleName = "com.ohos.myapplication"; +let userId = 100; + +try { + bundleManager.getAppProvisionInfo(bundleName, userId, (err, data) => { + if (err) { + hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed: %{public}s', err.message); + } else { + hilog.info(0x0000, 'testTag', 'getAppProvisionInfo successfully: %{public}s', JSON.stringify(data)); + } + }); +} catch (err) { + hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed: %{public}s', err.message); +} +``` + +### bundleManager.getAppProvisionInfo10+ + +getAppProvisionInfo(bundleName: string, userId?: number): Promise\<[AppProvisionInfo](js-apis-bundleManager-AppProvisionInfo.md)\>; + +Obtains the provision configuration file information based on the given bundle name and user ID. This API uses a promise to return the result. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**System capability**: SystemCapability.BundleManager.BundleFramework.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| bundleName | string | Yes| Bundle name.| +| userId | number | No| User ID, which can be obtained by calling [getOsAccountLocalId](js-apis-osAccount.md#getosaccountlocalid9).| + + +**Return value** + +| Type | Description | +| ------------------------------------------------------------ | ----------------------------------- | +| Promise\<[AppProvisionInfo](js-apis-bundleManager-AppProvisionInfo.md)\> | Promise used to return the provision configuration file obtained.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| -------- | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700004 | The specified user ID is not found. | + +**Example** + +```ts +import bundleManager from '@ohos.bundle.bundleManager'; +import hilog from '@ohos.hilog'; +let bundleName = "com.ohos.myapplication"; +let userId = 100; + +try { + bundleManager.getAppProvisionInfo(bundleName).then((data) => { + hilog.info(0x0000, 'testTag', 'getAppProvisionInfo successfully. Data: %{public}s', JSON.stringify(data)); + }).catch(err => { + hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed. Cause: %{public}s', err.message); + }); +} catch (err) { + hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed. Cause: %{public}s', err.message); +} + +try { + bundleManager.getAppProvisionInfo(bundleName, userId).then((data) => { + hilog.info(0x0000, 'testTag', 'getAppProvisionInfo successfully. Data: %{public}s', JSON.stringify(data)); + }).catch(err => { + hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed. Cause: %{public}s', err.message); + }); +} catch (err) { + hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed. Cause: %{public}s', err.message); +} +``` + + \ No newline at end of file diff --git a/en/application-dev/reference/apis/js-apis-bundleMonitor.md b/en/application-dev/reference/apis/js-apis-bundleMonitor.md index 11f54832d6556e24f35cd1baedee0d9abfe39079..cef362d3702423395594a8ae52326b99e5aee191 100644 --- a/en/application-dev/reference/apis/js-apis-bundleMonitor.md +++ b/en/application-dev/reference/apis/js-apis-bundleMonitor.md @@ -16,7 +16,7 @@ import bundleMonitor from '@ohos.bundle.bundleMonitor'; | Permission | Permission Level | Description | | ------------------------------------ | ----------- | ------------------------------ | -| ohos.permission.LISTEN_BUNDLE_CHANGE | system_core | Permission to listen for bundle installation, uninstall, and updates.| +| ohos.permission.LISTEN_BUNDLE_CHANGE | system_basic | Permission to listen for bundle installation, uninstall, and updates.| For details, see [Permission Levels](../../security/accesstoken-overview.md). @@ -24,7 +24,7 @@ For details, see [Permission Levels](../../security/accesstoken-overview.md). **System capability**: SystemCapability.BundleManager.BundleFramework.Core -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. | Name | Template | Readable| Writable| Description | | ---------- | ------ | ---- | ---- | -------------------------- | @@ -33,13 +33,13 @@ For details, see [Permission Levels](../../security/accesstoken-overview.md). ## bundleMonitor.on -on(type: BundleChangedEvent, callback: callback\): void; +on(type: BundleChangedEvent, callback: Callback\): void; Subscribes to bundle installation, uninstall, and update events. **Required permissions**: ohos.permission.LISTEN_BUNDLE_CHANGE -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **System capability**: SystemCapability.BundleManager.BundleFramework.Core @@ -66,13 +66,13 @@ try { ## bundleMonitor.off -off(type: BundleChangedEvent, callback?: callback\): void; +off(type: BundleChangedEvent, callback?: Callback\): void; Unsubscribes from bundle installation, uninstall, and update events. **Required permissions**: ohos.permission.LISTEN_BUNDLE_CHANGE -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **System capability**: SystemCapability.BundleManager.BundleFramework.Core diff --git a/en/application-dev/reference/apis/js-apis-call.md b/en/application-dev/reference/apis/js-apis-call.md index 0ccd49a5dc2a8b8e3577b7614f8219573de7cf7d..068a12cd46efce13b68a4fcf697306c4b5d8f256 100644 --- a/en/application-dev/reference/apis/js-apis-call.md +++ b/en/application-dev/reference/apis/js-apis-call.md @@ -4,32 +4,178 @@ The **call** module provides call management functions, including making calls, To subscribe to the call status, use [`observer.on('callStateChange')`](js-apis-observer.md#observeroncallstatechange). ->**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. - ## Modules to Import ```js import call from '@ohos.telephony.call'; ``` -## call.dial +## call.dialCall9+ + +dialCall\(phoneNumber: string, callback: AsyncCallback\): void + +Initiates a call. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. + +**Required Permissions**: ohos.permission.PLACE_CALL + +**System capability**: SystemCapability.Telephony.CallManager + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----------- | ---------------------------- | ---- | -------------------------------------- | +| phoneNumber | string | Yes | Phone number. | +| callback | AsyncCallback<void> | Yes | Callback used to return the result. | + +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + +**Example** + +```js +call.dialCall("138xxxxxxxx", (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); +}); +``` + + +## call.dialCall9+ + +dialCall\(phoneNumber: string, options: DialCallOptions, callback: AsyncCallback\): void + +Initiates a call. You can set call options as needed. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. + +**Required Permissions**: ohos.permission.PLACE_CALL + +**System capability**: SystemCapability.Telephony.CallManager + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----------- | ----------------------------------- | ---- | ----------------------------------- | +| phoneNumber | string | Yes | Phone number. | +| options | [DialCallOptions](#dialcalloptions9)| Yes | Call options, which carry other configuration information of the call. | +| callback | AsyncCallback<void> | Yes | Callback used to return the result.| + +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + +**Example** + +```js +call.dialCall("138xxxxxxxx", { + accountId: 0, + videoState: 0, + dialScene: 0, + dialType: 0, +}, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); +}); +``` + + +## call.dialCall9+ + +dialCall\(phoneNumber: string, options?: DialCallOptions\): Promise + +Initiates a call. You can set call options as needed. This API uses a promise to return the result. + +**System API**: This is a system API. + +**Required Permissions**: ohos.permission.PLACE_CALL + +**System capability**: SystemCapability.Telephony.CallManager + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----------- | ----------------------------------- | ---- | -------------------------------------- | +| phoneNumber | string | Yes | Phone number. | +| options | [DialCallOptions](#dialcalloptions9)| No | Call options, which carry other configuration information of the call.| + +**Return value** + +| Type | Description | +| ---------------------- | ---------------------------- | +| Promise<void> | Promise used to return the result.| + +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + +**Example** + +```js +let promise = call.dialCall("138xxxxxxxx", { + accountId: 0, + videoState: 0, + dialScene: 0, + dialType: 0, +}); +promise.then(() => { + console.log(`dialCall success.`); +}).catch((err) => { + console.error(`dialCall fail, promise: err->${JSON.stringify(err)}`); +}); +``` + +## call.dial(deprecated) dial\(phoneNumber: string, callback: AsyncCallback\): void Initiates a call. This API uses an asynchronous callback to return the result. -**Required permission**: ohos.permission.PLACE\_CALL (a system permission) +> **NOTE** +> +> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [dialCall](#calldialcall9). The substitute API is available only for system applications. + +**Required Permissions**: ohos.permission.PLACE_CALL **System capability**: SystemCapability.Telephony.CallManager **Parameters** -| Name | Type | Mandatory | Description | -| ----------- | ---------------------------- | ---- | -------------------------------- | -| phoneNumber | string | Yes | Phone number. | -| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.
- **true**: success
- **false**: failure | +| Name | Type | Mandatory| Description | +| ----------- | ---------------------------- | ---- | --------------------------------------- | +| phoneNumber | string | Yes | Phone number. | +| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.
- **true**: success
- **false**: failure| **Example** @@ -40,23 +186,27 @@ call.dial("138xxxxxxxx", (err, data) => { ``` -## call.dial +## call.dial(deprecated) dial\(phoneNumber: string, options: DialOptions, callback: AsyncCallback\): void -Initiates a call based on the specified options. This API uses an asynchronous callback to return the result. +Initiates a call. You can set call options as needed. This API uses an asynchronous callback to return the result. + +> **NOTE** +> +> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [dialCall](#calldialcall9). The substitute API is available only for system applications. -**Required permission**: ohos.permission.PLACE\_CALL (a system permission) +**Required Permissions**: ohos.permission.PLACE_CALL **System capability**: SystemCapability.Telephony.CallManager **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | ---------------------------- | ---- | --------------------------------------- | -| phoneNumber | string | Yes | Phone number. | -| options | [DialOptions](#dialoptions) | No | Call option, which indicates whether the call is a voice call or video call. | -| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.
- **true**: success
- **false**: failure | +| phoneNumber | string | Yes | Phone number. | +| options | [DialOptions](#dialoptions) | Yes | Call option, which indicates whether the call is a voice call or video call. | +| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.
- **true**: success
- **false**: failure| **Example** @@ -68,29 +218,32 @@ call.dial("138xxxxxxxx", { }); ``` - -## call.dial +## call.dial(deprecated) dial\(phoneNumber: string, options?: DialOptions\): Promise -Initiates a call based on the specified options. This API uses a promise to return the result. +Initiates a call. You can set call options as needed. This API uses a promise to return the result. -**Required permission**: ohos.permission.PLACE\_CALL (a system permission) +> **NOTE** +> +> This API is supported since API version 6 and deprecated since API version 9. You are advised to use [dialCall](#calldialcall9). The substitute API is available only for system applications. + +**Required Permissions**: ohos.permission.PLACE_CALL **System capability**: SystemCapability.Telephony.CallManager **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | --------------------------- | ---- | -------------------------------------- | -| phoneNumber | string | Yes | Phone number. | -| options | [DialOptions](#dialoptions) | Yes | Call option, which indicates whether the call is a voice call or video call. | +| phoneNumber | string | Yes | Phone number. | +| options | [DialOptions](#dialoptions) | No | Call option, which indicates whether the call is a voice call or video call.| **Return value** -| Type | Description | -| ---------------------- | ---------------------------------------------------------------- | -| Promise<boolean> | Promise used to return the result.
- **true**: success
- **false**: failure | +| Type | Description | +| ---------------------- | ------------------------------------------------------------ | +| Promise<boolean> | Promise used to return the result.
- **true**: success
- **false**: failure| **Example** @@ -115,16 +268,28 @@ Launches the call screen and displays the dialed number. This API uses an asynch **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | ------------------------- | ---- | ------------------------------------------ | | phoneNumber | string | Yes | Phone number. | -| callback | AsyncCallback<void> | Yes | Callback used to return the result. | +| callback | AsyncCallback<void> | Yes | Callback used to return the result.| + +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** ```js -call.makeCall("138xxxxxxxx", err => { - console.log(`makeCall callback: err->${JSON.stringify(err)}`); +call.makeCall("138xxxxxxxx", err => { + console.log(`makeCall callback: err->${JSON.stringify(err)}`); }); ``` @@ -139,24 +304,36 @@ Launches the call screen and displays the dialed number. This API uses a promise **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | ------ | ---- | ---------- | -| phoneNumber | string | Yes | Phone number. | +| phoneNumber | string | Yes | Phone number.| **Return value** | Type | Description | | ------------------- | --------------------------------- | -| Promise<void> | Promise used to return the result. | +| Promise<void> | Promise used to return the result.| + +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** ```js -let promise = call.makeCall("138xxxxxxxx"); -promise.then(() => { - console.log(`makeCall success`); -}).catch(err => { - console.error(`makeCall fail, promise: err->${JSON.stringify(err)}`); +let promise = call.makeCall("138xxxxxxxx"); +promise.then(() => { + console.log(`makeCall success`); +}).catch(err => { + console.error(`makeCall fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -170,9 +347,9 @@ Checks whether a call is in progress. This API uses an asynchronous callback to **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | -------- | ---------------------------- | ---- | ------------------------------------------------------------ | -| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. Callback used to return the result.
- **true**: A call is in progress.
- **false**: No call is in progress. | +| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. Callback used to return the result.
- **true**: A call is in progress.
- **false**: No call is in progress.| **Example** @@ -195,7 +372,7 @@ Checks whether a call is in progress. This API uses a promise to return the resu | Type | Description | | ---------------------- | --------------------------------------- | -| Promise<boolean> | Promise used to return the result. | +| Promise<boolean> | Promise used to return the result.| **Example** @@ -219,9 +396,9 @@ Obtains the call status. This API uses an asynchronous callback to return the re **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | -------- | -------------------------------------------- | ---- | ------------------------------------ | -| callback | AsyncCallback<[CallState](#callstate)> | Yes | Callback used to return the result. | +| callback | AsyncCallback<[CallState](#callstate)> | Yes | Callback used to return the result.| **Example** @@ -244,7 +421,7 @@ Obtains the call status. This API uses a promise to return the result. | Type | Description | | -------------------------------------- | --------------------------------------- | -| Promise<[CallState](#callstate)> | Promise used to return the result. | +| Promise<[CallState](#callstate)> | Promise used to return the result.| **Example** @@ -269,7 +446,7 @@ Checks whether a device supports voice calls. | Type | Description | | ------- | ------------------------------------------------------------ | -| boolean | - **true**: The device supports voice calls.
- **false**: The device does not support voice calls. | +| boolean | - **true**: The device supports voice calls.
- **false**: The device does not support voice calls.| ```js let result = call.hasVoiceCapability(); @@ -286,10 +463,22 @@ Checks whether the called number is an emergency number. This API uses an asynch **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | ---------------------------- | ---- | ------------------------------------------------------------ | | phoneNumber | string | Yes | Phone number. | -| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.
- **true**: The called number is an emergency number.
- **false**: The called number is not an emergency number. | +| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. - **true**: The called number is an emergency number.
- **false**: The called number is not an emergency number.| + +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** @@ -304,17 +493,29 @@ call.isEmergencyPhoneNumber("138xxxxxxxx", (err, data) => { isEmergencyPhoneNumber\(phoneNumber: string, options: EmergencyNumberOptions, callback: AsyncCallback\): void -Checks whether the called number is an emergency number based on the specified phone number options. This API uses an asynchronous callback to return the result. +Checks whether the called number is an emergency number based on the phone number. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.CallManager **Parameters** -| Name | Type | Mandatory | Description | -| ----------- | -------------------------------------------------- | ---- | -------------------------------------------- | -| phoneNumber | string | Yes | Phone number. | -| options | [EmergencyNumberOptions](#emergencynumberoptions7) | No | Phone number options. | -| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.
- **true**: The called number is an emergency number.
- **false**: The called number is not an emergency number. | +| Name | Type | Mandatory| Description | +| ----------- | -------------------------------------------------- | ---- | ------------------------------------------------------------ | +| phoneNumber | string | Yes | Phone number. | +| options | [EmergencyNumberOptions](#emergencynumberoptions7) | Yes | Phone number. | +| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. - **true**: The called number is an emergency number.
- **false**: The called number is not an emergency number.| + +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** @@ -329,22 +530,34 @@ call.isEmergencyPhoneNumber("112", {slotId: 1}, (err, data) => { isEmergencyPhoneNumber\(phoneNumber: string, options?: EmergencyNumberOptions\): Promise -Checks whether the called number is an emergency number based on the specified phone number options. This API uses a promise to return the result. +Checks whether the called number is an emergency number based on the phone number. This API uses a promise to return the result. **System capability**: SystemCapability.Telephony.CallManager **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | -------------------------------------------------- | ---- | -------------- | | phoneNumber | string | Yes | Phone number. | -| options | [EmergencyNumberOptions](#emergencynumberoptions7) | Yes | Phone number options. | +| options | [EmergencyNumberOptions](#emergencynumberoptions7) | No | Phone number.| **Return value** | Type | Description | | ---------------------- | --------------------------------------------------- | -| Promise<boolean> | Promise used to return the result. | +| Promise<boolean> | Promise used to return the result.| + +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** @@ -369,10 +582,22 @@ A formatted phone number is a standard numeric string, for example, 555 0100. **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | --------------------------- | ---- | ------------------------------------ | | phoneNumber | string | Yes | Phone number. | -| callback | AsyncCallback<string> | Yes | Callback used to return the result. | +| callback | AsyncCallback<string> | Yes | Callback used to return the result.| + +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** @@ -386,7 +611,7 @@ call.formatPhoneNumber("138xxxxxxxx", (err, data) => { formatPhoneNumber\(phoneNumber: string, options: NumberFormatOptions, callback: AsyncCallback\): void -Formats a phone number based on the specified formatting options. This API uses an asynchronous callback to return the result. +Formats a phone number based on specified formatting options. This API uses an asynchronous callback to return the result. A formatted phone number is a standard numeric string, for example, 555 0100. @@ -394,11 +619,23 @@ A formatted phone number is a standard numeric string, for example, 555 0100. **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | -------------------------------------------- | ---- | ------------------------------------ | | phoneNumber | string | Yes | Phone number. | -| options | [NumberFormatOptions](#numberformatoptions7) | No | Number formatting options, for example, country code. | -| callback | AsyncCallback<string> | Yes | Callback used to return the result. | +| options | [NumberFormatOptions](#numberformatoptions7) | Yes | Number formatting options, for example, country code. | +| callback | AsyncCallback<string> | Yes | Callback used to return the result.| + +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** @@ -415,7 +652,7 @@ call.formatPhoneNumber("138xxxxxxxx", { formatPhoneNumber\(phoneNumber: string, options?: NumberFormatOptions\): Promise -Formats a phone number based on the specified formatting options. This API uses a promise to return the result. +Formats a phone number based on specified formatting options. This API uses a promise to return the result. A formatted phone number is a standard numeric string, for example, 555 0100. @@ -423,16 +660,28 @@ A formatted phone number is a standard numeric string, for example, 555 0100. **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | -------------------------------------------- | ---- | ---------------------- | | phoneNumber | string | Yes | Phone number. | -| options | [NumberFormatOptions](#numberformatoptions7) | Yes | Number formatting options, for example, country code. | +| options | [NumberFormatOptions](#numberformatoptions7) | No | Number formatting options, for example, country code.| **Return value** | Type | Description | | --------------------- | ------------------------------------------- | -| Promise<string> | Promise used to return the result. | +| Promise<string> | Promise used to return the result.| + +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** @@ -459,11 +708,23 @@ The phone number must match the specified country code. For example, for a China **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | --------------------------- | ---- | ----------------------------------------------------- | | phoneNumber | string | Yes | Phone number. | | countryCode | string | Yes | Country code, for example, **CN** (China). All country codes are supported. | -| callback | AsyncCallback<string> | Yes | Callback used to return the result. | +| callback | AsyncCallback<string> | Yes | Callback used to return the result.| + +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** @@ -488,16 +749,28 @@ All country codes are supported. **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | ------ | ---- | ---------------------------------------- | | phoneNumber | string | Yes | Phone number. | -| countryCode | string | Yes | Country code, for example, **CN** (China). All country codes are supported. | +| countryCode | string | Yes | Country code, for example, **CN** (China). All country codes are supported.| **Return value** | Type | Description | | --------------------- | ------------------------------------------------------------ | -| Promise<string> | Promise used to return the result. | +| Promise<string> | Promise used to return the result.| + +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** @@ -514,9 +787,9 @@ promise.then(data => { muteRinger\(callback: AsyncCallback\): void -Mutes the ringtone while it is playing. This API uses an asynchronous callback to return the result. +Mutes the ringtone while it is playing. It does not work if the ringtone has been muted. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -528,11 +801,24 @@ This is a system API. | ----------- | ------------------------- | ---- | ---------- | | callback | AsyncCallback<void> | Yes | Callback used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -call.muteRinger((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.muteRinger((err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -541,9 +827,9 @@ call.muteRinger((err, data) => { muteRinger\(\): Promise -Mutes the ringtone while it is playing. This API uses a promise to return the result. +Mutes the ringtone while it is playing. It does not work if the ringtone has been muted. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -555,24 +841,35 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -let promise = call.muteRinger(); -promise.then(data => { - console.log(`muteRinger success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.muteRinger().then(() => { + console.log(`muteRinger success.`); +}).catch((err) => { console.error(`muteRinger fail, promise: err->${JSON.stringify(err)}`); }); ``` -## call.answer7+ -answer\(callId: number, callback: AsyncCallback\): void +## call.answerCall9+ -Answers a call based on the specified call ID. This API uses an asynchronous callback to return the result. +answerCall\(callId: number, callback: AsyncCallback\): void -This is a system API. +Answers a call. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -585,22 +882,35 @@ This is a system API. | callId | number | Yes | Call ID. You can obtain the value by subscribing to **callDetailsChange** events.| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -call.answer(1, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.answerCall(1, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` -## call.answer7+ +## call.answerCall9+ -answer(callId?: number\): Promise +answerCall(callId?: number\): Promise -Answers a call based on the specified call ID. This API uses a promise to return the result. +Answers a call. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -618,24 +928,37 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```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.answerCall(1).then(() => { + console.log(`answerCall success.`); +}).catch((err) => { + console.error(`answerCall fail, promise: err->${JSON.stringify(err)}`); }); ``` -## call.hangup7+ -hangup\(callId: number, callback: AsyncCallback\): void +## call.answerCall9+ -Ends a call. This API uses an asynchronous callback to return the result. +answerCall\(callback: AsyncCallback\): void -This is a system API. +Answers a call. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -645,25 +968,37 @@ This is a system API. | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ---------- | -| callId | number | Yes | Call ID. You can obtain the value by subscribing to **callDetailsChange** events.| | callback | AsyncCallback<void> | Yes | Callback used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -call.hangup(1, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.answerCall((err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` -## call.answer9+ +## call.hangUpCall9+ -answer\(callback: AsyncCallback\): void +hangUpCall\(callId: number, callback: AsyncCallback\): void -Answers a call.This API uses an asynchronous callback to return the result. +Ends a call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -673,24 +1008,38 @@ This is a system API. | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ----------------------------------------------- | +| callId | number | Yes | Call ID. You can obtain the value by subscribing to **callDetailsChange** events.| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -call.answer((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.hangUpCall(1, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` -## call.hangup7+ +## call.hangUpCall9+ -hangup\(callId?: number\): Promise +hangUpCall\(callId?: number\): Promise -Ends a call based on the specified call ID. This API uses a promise to return the result. +Ends a call. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -708,24 +1057,37 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```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.hangUpCall(1).then(() => { + console.log(`hangUpCall success.`); +}).catch((err) => { + console.error(`hangUpCall fail, promise: err->${JSON.stringify(err)}`); }); ``` -## call.hangup9+ -hangup\(callback: AsyncCallback\): void +## call.hangUpCall9+ + +hangUpCall\(callback: AsyncCallback\): void Ends a call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -737,22 +1099,36 @@ This is a system API. | -------- | ------------------------- | ---- | ---------- | | callback | AsyncCallback<void> | Yes | Callback used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + + **Example** ```js -call.hangup((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.hangUpCall((err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` -## call.reject7+ +## call.rejectCall9+ -reject(callId: number, callback: AsyncCallback\): void +rejectCall(callId: number, callback: AsyncCallback\): void -Rejects a call based on the specified call ID. This API uses an asynchronous callback to return the result. +Rejects a call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -765,22 +1141,36 @@ This is a system API. | callId | number | Yes | Call ID. You can obtain the value by subscribing to **callDetailsChange** events.| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -call.reject(1, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.rejectCall(1, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` -## call.reject7+ -reject\(callId: number, options: RejectMessageOptions, callback: AsyncCallback\): void +## call.rejectCall9+ -Rejects a call based on the specified call ID and options. This API uses an asynchronous callback to return the result. +rejectCall\(callId: number, options: RejectMessageOptions, callback: AsyncCallback\): void -This is a system API. +Rejects a call. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -794,25 +1184,38 @@ This is a system API. | options | [RejectMessageOptions](#rejectmessageoptions7) | Yes | Options for the call rejection message. | | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js let rejectMessageOptions={ messageContent: "Unknown number blocked" } -call.reject(1, rejectMessageOptions, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.rejectCall(1, rejectMessageOptions, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` -## call.reject7+ +## call.rejectCall9+ -reject(callId?: number, options?: RejectMessageOptions\): Promise +rejectCall(callId?: number, options?: RejectMessageOptions\): Promise -Rejects a call based on the specified call ID and options. This API uses a promise to return the result. +Rejects a call. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -831,28 +1234,40 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js let rejectMessageOptions={ messageContent: "Unknown number blocked" } -let promise = call.reject(1, rejectMessageOptions); -promise.then(data => { - console.log(`reject success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.reject(1, rejectMessageOptions).then(() => { + console.log(`reject success.`); +}).catch((err) => { console.error(`reject fail, promise: err->${JSON.stringify(err)}`); }); ``` -## call.reject9+ +## call.rejectCall9+ -reject\(callback: AsyncCallback\): void +rejectCall\(callback: AsyncCallback\): void Rejects a call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -864,22 +1279,35 @@ This is a system API. | -------- | ------------------------- | ---- | ---------- | | callback | AsyncCallback<void> | Yes | Callback used to return the result.| -**Example:** +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + +**Example** ```js -call.reject((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.rejectCall((err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` -## call.reject9+ +## call.rejectCall9+ -reject\(options: RejectMessageOptions, callback: AsyncCallback\): void +rejectCall\(options: RejectMessageOptions, callback: AsyncCallback\): void Rejects a call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -892,14 +1320,27 @@ This is a system API. | options | [RejectMessageOptions](#rejectmessageoptions7) | Yes | Options for the call rejection message.| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | -**Example:** +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + +**Example** ```js let rejectMessageOptions={ messageContent: "Unknown number blocked" } -call.reject(rejectMessageOptions, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.rejectCall(rejectMessageOptions, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -910,7 +1351,7 @@ holdCall\(callId: number, callback: AsyncCallback\): void Holds a call based on the specified call ID. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -923,11 +1364,24 @@ This is a system API. | callId | number | Yes | Call ID. | | callback | AsyncCallback<void> | Yes | Callback used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -call.holdCall(1, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.holdCall(1, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -938,7 +1392,7 @@ holdCall\(callId: number\): Promise Holds a call based on the specified call ID. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -956,13 +1410,25 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -let promise = call.holdCall(1); -promise.then(data => { - console.log(`holdCall success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.holdCall(1).then(() => { + console.log(`holdCall success.`); +}).catch((err) => { console.error(`holdCall fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -973,7 +1439,7 @@ unHoldCall\(callId: number, callback: AsyncCallback\): void Unholds a call based on the specified call ID. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -986,11 +1452,24 @@ This is a system API. | callId | number | Yes | Call ID. | | callback | AsyncCallback<void> | Yes | Callback used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -call.unHoldCall(1, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.unHoldCall(1, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1001,7 +1480,7 @@ unHoldCall\(callId: number\): Promise Unholds a call based on the specified call ID. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -1019,13 +1498,25 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -let promise = call.unHoldCall(1); -promise.then(data => { - console.log(`unHoldCall success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.unHoldCall(1).then(() => { + console.log(`unHoldCall success.`); +}).catch((err) => { console.error(`unHoldCall fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1036,7 +1527,7 @@ switchCall\(callId: number, callback: AsyncCallback\): void Switches a call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -1049,11 +1540,24 @@ This is a system API. | callId | number | Yes | Call ID. | | callback | AsyncCallback<void> | Yes | Callback used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -call.switchCall(1, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.switchCall(1, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1064,7 +1568,7 @@ switchCall\(callId: number\): Promise Switches a call. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.ANSWER_CALL @@ -1082,13 +1586,25 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -let promise = call.switchCall(1); -promise.then(data => { - console.log(`switchCall success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.switchCall(1).then(() => { + console.log(`switchCall success.`); +}).catch((err) => { console.error(`switchCall fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1099,7 +1615,7 @@ combineConference\(callId: number, callback: AsyncCallback\): void Combines two calls into a conference call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1110,11 +1626,23 @@ This is a system API. | callId | number | Yes | Call ID. | | callback | AsyncCallback<void> | Yes | Callback used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -call.combineConference(1, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.combineConference(1, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1125,7 +1653,7 @@ combineConference\(callId: number\): Promise Combines two calls into a conference call. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1141,13 +1669,24 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -let promise = call.combineConference(1); -promise.then(data => { - console.log(`combineConference success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.combineConference(1).then(() => { + console.log(`combineConference success.`); +}).catch((err) => { console.error(`combineConference fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1158,7 +1697,7 @@ getMainCallId\(callId: number, callback: AsyncCallback\): void Obtains the main call ID. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1169,6 +1708,19 @@ This is a system API. | callId | number | Yes | Call ID. | | callback | AsyncCallback<number> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + + **Example** ```js @@ -1184,7 +1736,7 @@ getMainCallId\(callId: number\): Promise Obtains the main call ID. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1200,6 +1752,18 @@ This is a system API. | ------------------- | ------------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1217,7 +1781,7 @@ getSubCallIdList\(callId: number, callback: AsyncCallback\>\): vo Obtains the list of subcall IDs. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1228,6 +1792,18 @@ This is a system API. | callId | number | Yes | Call ID. | | callback | AsyncCallback\> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1243,7 +1819,7 @@ getSubCallIdList\(callId: number\): Promise\> Obtains the list of subcall IDs. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1259,6 +1835,18 @@ This is a system API. | ----------------------------- | ----------------------------------- | | Promise<Array> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1276,7 +1864,7 @@ getCallIdListForConference\(callId: number, callback: AsyncCallback> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1302,7 +1902,7 @@ getCallIdListForConference\(callId: number\): Promise\> Obtains the list of call IDs in a conference. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1318,6 +1918,18 @@ This is a system API. | ----------------------------- | --------------------------------------- | | Promise<Array> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1335,7 +1947,7 @@ getCallWaitingStatus\(slotId: number, callback: AsyncCallback- **0**: card slot 1
- **1**: card slot 2 | -| callback | AsyncCallback<[CallWaitingStatus](#callwaitingstatus7)\> | Yes | Callback used to return the result.
- **0**: Call waiting is disabled.
- **1**: Call waiting is enabled.| +| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | +| callback | AsyncCallback<[CallWaitingStatus](#callwaitingstatus7)\> | Yes | Callback used to return the result.

- **0**: Call waiting is disabled.
- **1**: Call waiting is enabled.| + +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** @@ -1363,7 +1988,7 @@ getCallWaitingStatus\(slotId: number\): Promise Obtains the call waiting status. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.GET_TELEPHONY_STATE @@ -1381,6 +2006,19 @@ This is a system API. | ------------------------------------------------------- | ------------------------------------------------------------ | | Promise<[CallWaitingStatus](#callwaitingstatus7)> | Promise used to return the result.
- **0**: Call waiting is disabled.
- **1**: Call waiting is enabled.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1398,7 +2036,7 @@ setCallWaiting\(slotId: number, activate: boolean, callback: AsyncCallback- **false**: Disable call waiting.
- **true**: Enable call waiting.| | callback | AsyncCallback | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -call.setCallWaiting(0, true, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.setCallWaiting(0, true, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1427,7 +2078,7 @@ setCallWaiting\(slotId: number, activate: boolean\): Promise Sets the call waiting switch. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1446,13 +2097,25 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -let promise = call.setCallWaiting(0, true); -promise.then(data => { - console.log(`setCallWaiting success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.setCallWaiting(0, true).then(() => { + console.log(`setCallWaiting success.`); +}).catch((err) => { console.error(`setCallWaiting fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1461,9 +2124,9 @@ promise.then(data => { startDTMF\(callId: number, character: string, callback: AsyncCallback\): void -Enables dual-tone multifrequency (DTMF). This API uses an asynchronous callback to return the result. +Enables DTMF. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1475,11 +2138,23 @@ This is a system API. | character | string | Yes | DTMF code. | | callback | AsyncCallback | Yes | Callback used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -call.startDTMF(1, "0", (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.startDTMF(1, "0", (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1490,7 +2165,7 @@ startDTMF\(callId: number, character: string\): Promise Enables DTMF. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1507,13 +2182,24 @@ This is a system API. | ------------------- | ----------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -let promise = call.startDTMF(1, "0"); -promise.then(data => { - console.log(`startDTMF success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.startDTMF(1, "0").then(() => { + console.log(`startDTMF success.`); +}).catch((err) => { console.error(`startDTMF fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1524,7 +2210,7 @@ stopDTMF\(callId: number, callback: AsyncCallback\): void Stops DTMF. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1535,11 +2221,23 @@ This is a system API. | callId | number | Yes | Call ID. | | callback | AsyncCallback<void> | Yes | Callback used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -call.stopDTMF(1, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.stopDTMF(1, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1550,7 +2248,7 @@ stopDTMF\(callId: number\): Promise Stops DTMF. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1566,13 +2264,24 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -let promise = call.stopDTMF(1); -promise.then(data => { - console.log(`stopDTMF success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.stopDTMF(1).then(() => { + console.log(`stopDTMF success.`); +}).catch((err) => { console.error(`stopDTMF fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1583,7 +2292,7 @@ isInEmergencyCall\(callback: AsyncCallback\): void Checks whether a call is an emergency call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1595,6 +2304,19 @@ This is a system API. | -------- | ---------------------------- | ---- | ---------- | | callback | AsyncCallback<boolean> | Yes | Callback used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1610,7 +2332,7 @@ isInEmergencyCall\(\): Promise Checks whether a call is an emergency call. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1622,6 +2344,19 @@ This is a system API. | ---------------------- | --------------------------- | | Promise<boolean> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1639,7 +2374,7 @@ on\(type: 'callDetailsChange', callback: Callback\): void Subscribes to **callDetailsChange** events. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1649,8 +2384,21 @@ This is a system API. | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------- | ---- | -------------------------- | -| type | string | Yes | Call details change during a call.| -| callback | Callback<[CallAttributeOptions](#callattributeoptions7)> | Yes | Callback used to return the result. | +| type | string | Yes | Call event change. This field has a fixed value of **callDetailsChange**.| +| callback | Callback<[CallAttributeOptions](#callattributeoptions7)> | Yes | Callback used to return the result. | + +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** @@ -1666,7 +2414,7 @@ on\(type: 'callEventChange', callback: Callback\): void Subscribes to **callEventChange** events. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1676,9 +2424,22 @@ This is a system API. | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------ | ---- | -------------------------- | -| type | string | Yes | Call event change during a call.| +| type | string | Yes | Call event change. This field has a fixed value of **callEventChange**.| | callback | Callback<[CallEventOptions](#calleventoptions8)> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1693,7 +2454,7 @@ on\(type: 'callDisconnectedCause', callback: Callback): vo Subscribes to **callDisconnectedCause** events. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1703,9 +2464,22 @@ This is a system API. | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------ | ---- | -------------------------- | -| type | string | Yes | Cause of the call disconnection.| +| type | string | Yes | Call disconnection cause. This field has a fixed value of **callDisconnectedCause**.| | callback | Callback<[DisconnectedDetails](#disconnecteddetails9)> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1720,7 +2494,7 @@ on\(type: 'mmiCodeResult', callback: Callback\): void Subscribes to **mmiCodeResult** events. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1730,9 +2504,22 @@ This is a system API. | Name | Type | Mandatory| Description | | -------- | -------------------------------------------- | ---- | --------------------- | -| type | string | Yes | Man-machine interface (MMI) code result.| +| type | string | Yes | MMI code result. This field has a fixed value of **mmiCodeResult**.| | callback | Callback<[MmiCodeResults](#mmicoderesults9)> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1747,7 +2534,7 @@ off\(type: 'callDetailsChange', callback?: Callback\): vo Unsubscribes from **callDetailsChange** events. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1757,9 +2544,22 @@ This is a system API. | Name | Type | Mandatory| Description | | -------- | -------------------------------------------------------- | ---- | ---------------------------------- | -| type | string | Yes | Unsubscription from call details changes when a call ends.| +| type | string | Yes | Call details change. This field has a fixed value of **callDetailsChange**.| | callback | Callback<[CallAttributeOptions](#callattributeoptions7)> | No | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1774,7 +2574,7 @@ off\(type: 'callEventChange', callback?: Callback\): void Unsubscribes from **callEventChange** events. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1784,9 +2584,22 @@ This is a system API. | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------ | ---- | ---------------------------------- | -| type | string | Yes | Unsubscription from call event changes when a call ends.| +| type | string | Yes | Call event change. This field has a fixed value of **callEventChange**.| | callback | Callback<[CallEventOptions](#calleventoptions8)> | No | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1801,7 +2614,7 @@ off\(type: 'callDisconnectedCause', callback?: Callback\): Unsubscribes from **callDisconnectedCause** events. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1810,9 +2623,22 @@ This is a system API. **Parameters** | Name | Type | Mandatory| Description | -| -------- | ---------------------------------------------------------- | ---- | -------------------- | -| type | 'callDisconnectedCause' | Yes | Unsubscription from the call disconnection cause when a call ends.| -| callback | Callback**<**[DisconnectedDetails](#disconnecteddetails9)> | No | Callback used to return the result. | +| -------- | ---------------------------------------------------------- | ---- | ------------------- | +| type | string | Yes | Call disconnection cause. This field has a fixed value of **callDisconnectedCause**.| +| callback | Callback<[DisconnectedDetails](#disconnecteddetails9)> | No | Callback used to return the result. | + +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** @@ -1828,7 +2654,7 @@ off\(type: 'mmiCodeResult', callback?: Callback\): void Unsubscribes from **mmiCodeResult** events. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -1836,10 +2662,23 @@ This is a system API. **Parameters** -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | -------- | ------------------------------------------------ | ---- | ----------- | -| type | 'mmiCodeResult' | Yes | MMI code result.| -| callback | Callback<[MmiCodeResults](#mmicoderesults9)> | No | Callback used to return the result. | +| type | string | Yes | MMI code result. This field has a fixed value of **mmiCodeResult**.| +| callback | Callback<[MmiCodeResults](#mmicoderesults9)> | No | Callback used to return the result. | + +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** @@ -1855,7 +2694,7 @@ isNewCallAllowed\(callback: AsyncCallback\): void Checks whether a new call is allowed. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1865,6 +2704,18 @@ This is a system API. | -------- | ---------------------------- | ---- | ---------- | | callback | AsyncCallback<boolean> | Yes | Callback used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1880,7 +2731,7 @@ isNewCallAllowed\(\): Promise Checks whether a new call is allowed. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1890,6 +2741,18 @@ This is a system API. | ---------------------- | --------------------------- | | Promise<boolean> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1905,9 +2768,9 @@ promise.then(data => { separateConference\(callId: number, callback: AsyncCallback\): void -Separates a conference call. This API uses an asynchronous callback to return the result. +Separates calls from a conference call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1918,11 +2781,23 @@ This is a system API. | callId | number | Yes | Call ID. | | callback | AsyncCallback<void> | Yes | Callback used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -call.separateConference(1, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.separateConference(1, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1931,9 +2806,9 @@ call.separateConference(1, (err, data) => { separateConference\(callId: number\): Promise -Separates a conference call. This API uses a promise to return the result. +Separates calls from a conference call. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -1949,13 +2824,24 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -let promise = call.separateConference(1); -promise.then(data => { - console.log(`separateConference success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.separateConference(1).then(() => { + console.log(`separateConference success.`); +}).catch((err) => { console.error(`separateConference fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1966,7 +2852,7 @@ getCallRestrictionStatus\(slotId: number, type: CallRestrictionType, callback: A Obtains the call restriction status. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.GET_TELEPHONY_STATE @@ -1980,6 +2866,19 @@ This is a system API. | type | [CallRestrictionType](#callrestrictiontype8) | Yes | Call restriction type. | | callback | AsyncCallback<[RestrictionStatus](#restrictionstatus8)> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1995,7 +2894,7 @@ getCallRestrictionStatus\(slotId: number, type: CallRestrictionType\): Promise { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.setCallRestriction(0, callRestrictionInfo, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2065,7 +2990,7 @@ setCallRestriction\(slotId: number, info: CallRestrictionInfo\): Promise Sets the call restriction status. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -2084,6 +3009,19 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2092,10 +3030,9 @@ let callRestrictionInfo={ password: "123456", mode: 1 } -let promise = call.setCallRestriction(0, callRestrictionInfo); -promise.then(data => { - console.log(`setCallRestriction success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.setCallRestriction(0, callRestrictionInfo).then(() => { + console.log(`setCallRestriction success.`); +}).catch((err) => { console.error(`setCallRestriction fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -2106,7 +3043,7 @@ getCallTransferInfo\(slotId: number, type: CallTransferType, callback: AsyncCall Obtains call transfer information. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.GET_TELEPHONY_STATE @@ -2120,10 +3057,23 @@ This is a system API. | type | [CallTransferType](#calltransfertype8) | Yes | Call transfer type. | | callback | AsyncCallback<[CallTransferResult](#calltransferresult8)> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -call.getCallTransferInfo(0, callTransferTyp, (err, data) => { +call.getCallTransferInfo(0, call.CallTransferType.TRANSFER_TYPE_BUSY, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -2135,7 +3085,7 @@ getCallTransferInfo\(slotId: number, type: CallTransferType): Promise { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.setCallTransfer(0, callTransferInfo, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2205,7 +3181,7 @@ setCallTransfer\(slotId: number, info: CallTransferInfo): Promise Sets call transfer information. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -2224,6 +3200,19 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2232,10 +3221,9 @@ let callTransferInfo={ type: 1, settingType: 1 } -let promise = call.setCallTransfer(0, callTransferInfo); -promise.then(data => { - console.log(`setCallTransfer success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.setCallTransfer(0, callTransferInfo).then(() => { + console.log(`setCallTransfer success.`); +}).catch((err) => { console.error(`setCallTransfer fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -2246,7 +3234,7 @@ isRinging\(callback: AsyncCallback\): void Checks whether the ringtone is playing. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -2258,6 +3246,19 @@ This is a system API. | -------- | ---------------------------- | ---- | ---------- | | callback | AsyncCallback<boolean> | Yes | Callback used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2273,7 +3274,7 @@ isRinging\(\): Promise Checks whether the ringtone is playing. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -2285,6 +3286,19 @@ This is a system API. | ---------------------- | --------------------------- | | Promise<boolean> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2302,7 +3316,7 @@ setMuted\(callback: AsyncCallback\): void Sets call muting. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2312,11 +3326,23 @@ This is a system API. | -------- | ------------------------- | ---- | ---------- | | callback | AsyncCallback<void> | Yes | Callback used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -call.setMuted((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.setMuted((err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2327,7 +3353,7 @@ setMuted\(\): Promise Sets call muting. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2337,13 +3363,24 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -let promise = call.setMuted(); -promise.then(data => { - console.log(`setMuted success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.setMuted().then(() => { + console.log(`setMuted success.`); +}).catch((err) => { console.error(`setMuted fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -2354,7 +3391,7 @@ cancelMuted(callback: AsyncCallback): void Cancels call muting. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2364,11 +3401,23 @@ This is a system API. | -------- | ------------------------- | ---- | ---------- | | callback | AsyncCallback<void> | Yes | Callback used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -call.cancelMuted((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.cancelMuted((err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2379,7 +3428,7 @@ cancelMuted(): Promise Cancels call muting. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2389,24 +3438,35 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -let promise = call.cancelMuted(); -promise.then(data => { - console.log(`cancelMuted success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.cancelMuted().then(() => { + console.log(`cancelMuted success.`); +}).catch((err) => { console.error(`cancelMuted fail, promise: err->${JSON.stringify(err)}`); }); ``` -## call.setAudioDevice9+ +## call.setAudioDevice8+ setAudioDevice\(device: AudioDevice, callback: AsyncCallback\): void Sets the audio device for a call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2417,11 +3477,23 @@ This is a system API. | device | [AudioDevice](#audiodevice8) | Yes | Audio device.| | callback | AsyncCallback<void> | Yes | Callback used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -call.setAudioDevice(1, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.setAudioDevice(1, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2432,7 +3504,7 @@ setAudioDevice\(device: AudioDevice, options: AudioDeviceOptions, callback: Asyn Sets the audio device for a call based on the specified options. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2444,25 +3516,37 @@ This is a system API. | options | [AudioDeviceOptions](#audiodeviceoptions9) | Yes | Audio device parameters.| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js let audioDeviceOptions={ bluetoothAddress: "IEEE 802-2014" } -call.setAudioDevice(1, audioDeviceOptions, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.setAudioDevice(1, audioDeviceOptions, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` -## call.setAudioDevice8+ +## call.setAudioDevice9+ setAudioDevice(device: AudioDevice, options?: AudioDeviceOptions): Promise Sets the audio device for a call based on the specified options. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2479,16 +3563,27 @@ This is a system API. | ------------------- | ------------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```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 => { +call.setAudioDevice(1, audioDeviceOptions).then(() => { + console.log(`setAudioDevice success.`); +}).catch((err) => { console.error(`setAudioDevice fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -2499,7 +3594,7 @@ joinConference(mainCallId: number, callNumberList: Array, callback: Asy Joins a conference call. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2511,14 +3606,26 @@ This is a system API. | callNumberList | Array | Yes | List of call numbers.| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js let callNumberList: Array = [ "138XXXXXXXX" ]; -call.joinConference(1, callNumberList, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.joinConference(1, callNumberList, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2528,7 +3635,7 @@ joinConference(mainCallId: number, callNumberList: Array): Promise = [ "138XXXXXXXX" ]; -let promise = call.joinConference(1, callNumberList); -promise.then(data => { - console.log(`joinConference success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.joinConference(1, callNumberList).then(() => { + console.log(`joinConference success.`); +}).catch((err) => { console.error(`joinConference fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -2565,7 +3683,7 @@ updateImsCallMode(callId: number, mode: ImsCallMode, callback: AsyncCallback { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.updateImsCallMode(1, 1, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2591,7 +3721,7 @@ updateImsCallMode(callId: number, mode: ImsCallMode): Promise Updates the IMS call mode. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2608,13 +3738,24 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -let promise = call.updateImsCallMode(1, 1); -promise.then(data => { - console.log(`updateImsCallMode success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.updateImsCallMode(1, 1).then(() => { + console.log(`updateImsCallMode success.`); +}).catch((err) => { console.error(`updateImsCallMode fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -2625,7 +3766,7 @@ enableImsSwitch(slotId: number, callback: AsyncCallback): void Enables the IMS switch. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -2638,11 +3779,24 @@ This is a system API. | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -call.enableImsSwitch(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.enableImsSwitch(0, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2652,7 +3806,7 @@ enableImsSwitch(slotId: number): Promise Enables the IMS switch. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -2670,13 +3824,25 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -let promise = call.enableImsSwitch(0); -promise.then(data => { - console.log(`enableImsSwitch success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.enableImsSwitch(0).then(() => { + console.log(`enableImsSwitch success.`); +}).catch((err) => { console.error(`enableImsSwitch fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -2687,7 +3853,7 @@ disableImsSwitch(slotId: number, callback: AsyncCallback): void Disables the IMS switch. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -2700,11 +3866,24 @@ This is a system API. | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -call.disableImsSwitch(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.disableImsSwitch(0, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2714,7 +3893,7 @@ disableImsSwitch(slotId: number): Promise Disables the IMS switch. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **Required permission**: ohos.permission.SET_TELEPHONY_STATE @@ -2722,23 +3901,35 @@ This is a system API. **Parameters** -| Name| Type | Mandatory| Description | +| Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------------------- | -| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| +| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | **Return value** -| Type | Description | +| Type | Description | | ------------------- | --------------------------- | -| Promise<void> | Promise used to return the result.| +| Promise<void> | Promise used to return the result. | + +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** ```js -let promise = call.disableImsSwitch(0); -promise.then(data => { - console.log(`disableImsSwitch success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.disableImsSwitch(0).then(() => { + console.log(`disableImsSwitch success.`); +}).catch((err) => { console.error(`disableImsSwitch fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -2749,7 +3940,7 @@ isImsSwitchEnabled(slotId: number, callback: AsyncCallback): void Checks whether the IMS switch is enabled. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2760,6 +3951,18 @@ This is a system API. | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback<boolean> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2774,7 +3977,7 @@ isImsSwitchEnabled(slotId: number): Promise Checks whether the IMS switch is enabled. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2790,6 +3993,18 @@ This is a system API. | ------------------- | --------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2801,20 +4016,32 @@ promise.then(data => { }); ``` - ## DialOptions -Defines the dialup options. +Provides an option for determining whether a call is a video call. **System capability**: SystemCapability.Telephony.CallManager -| Name | Type | Mandatory| Description | -| ------------------------ | ---------------------------------- | ---- | ------------------------------------------------------------ | +| Name | Type | Mandatory| Description | +| ------------------------ | ---------------------------------- | ---- | ----------------------------------------------------------------------------------------------- | | extras | boolean | No | Indication of a video call.
- **true**: video call
- **false** (default): voice call| -| accountId 8+ | number | No | Account ID.
- **0**: card slot 1
- **1**: card slot 2
This is a system API. | -| videoState 8+ | [VideoStateType](#videostatetype7) | No | Video state type. This is a system API. | -| dialScene 8+ | [DialScene](#dialscene8) | No | Dialup scenario. This is a system API. | -| dialType 8+ | [DialType](#dialtype8) | No | Dialup type. This is a system API. | +| accountId 8+ | number | No | Account ID.
- **0**: card slot 1
- **1**: card slot 2
This is a system API. | +| videoState 8+ | [VideoStateType](#videostatetype7) | No | Video state type. This is a system API. | +| dialScene 8+ | [DialScene](#dialscene8) | No | Dialup scenario. This is a system API. | +| dialType 8+ | [DialType](#dialtype8) | No | Dialup type. This is a system API. | + +## DialCallOptions9+ + +Defines options for initiating a call. + +**System capability**: SystemCapability.Telephony.CallManager + +| Name | Type | Mandatory| Description | +| ------------------------ | ---------------------------------- | ---- | ------------------------------------------------------------ | +| accountId 9+ | number | No | Account ID.
- **0**: card slot 1
- **1**: card slot 2
This is a system API.| +| videoState 9+ | [VideoStateType](#videostatetype7) | No | Video state type. This is a system API. | +| dialScene 9+ | [DialScene](#dialscene8) | No | Dialup scenario. This is a system API. | +| dialType 9+ | [DialType](#dialtype8) | No | Dialup type. This is a system API. | ## CallState @@ -2827,33 +4054,33 @@ Enumerates call states. | CALL_STATE_UNKNOWN | -1 | The call status fails to be obtained and is unknown. | | CALL_STATE_IDLE | 0 | No call is in progress. | | CALL_STATE_RINGING | 1 | The call is in the ringing or waiting state. | -| CALL_STATE_OFFHOOK | 2 | At least one call is in dialing, active, or on hold, and no new incoming call is ringing or waiting. | +| CALL_STATE_OFFHOOK | 2 | At least one call is in dialing, active, or on hold, and no new incoming call is ringing or waiting.| ## EmergencyNumberOptions7+ -Defines options for determining whether a number is an emergency number. +Provides an option for determining whether a number is an emergency number for the SIM card in the specified slot. **System capability**: SystemCapability.Telephony.CallManager -| Name| Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ------ | ------ | ---- | ---------------------------------------------- | | slotId | number | No | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| ## NumberFormatOptions7+ -Defines the number formatting options. +Provides an option for number formatting. **System capability**: SystemCapability.Telephony.CallManager -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory| Description | | ----------- | ------ | ---- | ---------------------------------------------------------- | -| countryCode | string | No | Country code, for example, **CN** (China). All country codes are supported. The default value is **CN**. | +| countryCode | string | No | Country code, for example, **CN** (China). All country codes are supported. The default value is **CN**.| ## ImsCallMode8+ Enumerates IMS call modes. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2869,23 +4096,23 @@ This is a system API. Enumerates audio devices. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager | Name | Value | Description | | -------------------- | ---- | ------------ | -| DEVICE_EARPIECE | 0 | Earpiece. | -| DEVICE_SPEAKER | 1 | Speaker.| -| DEVICE_WIRED_HEADSET | 2 | Wired headset.| +| DEVICE_EARPIECE | 0 | Headset device. | +| DEVICE_SPEAKER | 1 | Speaker device.| +| DEVICE_WIRED_HEADSET | 2 | Wired headset device.| | DEVICE_BLUETOOTH_SCO | 3 | Bluetooth SCO device. | -| DEVICE_MIC | 4 | Microphone. | +| DEVICE_MIC | 4 | Microphone device| ## CallRestrictionType8+ Enumerates call restriction types. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2904,7 +4131,7 @@ This is a system API. Defines the call transfer information. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2915,14 +4142,14 @@ This is a system API. | settingType | [CallTransferSettingType](#calltransfersettingtype8) | Yes | Call transfer setting type.| | startHour9+ | number | No | Hour in the start time.| | startMinute9+ | number | No | Minute in the start time.| -| endHour9+ | number | No | Hour in the end time.| +| endHour9+ | number | No | Minute in the end time.| | endMinute9+ | number | No | Minute in the end time.| ## CallTransferType8+ Enumerates call transfer types. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2937,7 +4164,7 @@ This is a system API. Enumerates call transfer setting types. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2952,11 +4179,11 @@ This is a system API. Defines the call attribute options. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | --------------- | ---------------------------------------- | ---- | -------------- | | accountNumber | string | Yes | Account number. | | speakerphoneOn | boolean | Yes | Speakerphone on.| @@ -2973,7 +4200,7 @@ This is a system API. Enumerates conference states. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -2988,7 +4215,7 @@ This is a system API. Enumerates call types. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3001,9 +4228,9 @@ This is a system API. ## VideoStateType7+ -Enumerates video state types. +Video state type. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3016,7 +4243,7 @@ This is a system API. Enumerates detailed call states. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3036,11 +4263,11 @@ This is a system API. Defines the call restriction information. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | -------- | -------------------------------------------- | ---- | ------------ | | type | [CallRestrictionType](#callrestrictiontype8) | Yes | Call restriction type.| | password | string | Yes | Password. | @@ -3050,7 +4277,7 @@ This is a system API. Enumerates call restriction modes. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3063,11 +4290,11 @@ This is a system API. Defines the call event options. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ------- | ------------------------------------------ | ---- | -------------- | | eventId | [CallAbilityEventId](#callabilityeventid8) | Yes | Call ability event ID.| @@ -3075,7 +4302,7 @@ This is a system API. Enumerates call ability event IDs. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3088,7 +4315,7 @@ This is a system API. Enumerates dialup scenarios. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3102,7 +4329,7 @@ This is a system API. Enumerates dialup types. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3116,11 +4343,11 @@ This is a system API. Defines options for the call rejection message. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | -------------- | ------ | ---- | -------- | | messageContent | string | Yes | Message content.| @@ -3128,7 +4355,7 @@ This is a system API. Defines the call transfer result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3138,14 +4365,14 @@ This is a system API. | number | string | Yes | Call transfer number. | | startHour9+ | number | Yes | Hour in the start time.| | startMinute9+ | number | Yes | Minute in the start time.| -| endHour9+ | number | Yes | Hour in the end time.| +| endHour9+ | number | Yes | Minute in the end time.| | endMinute9+ | number | Yes | Minute in the end time.| ## CallWaitingStatus7+ Enumerates call waiting states. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3158,7 +4385,7 @@ This is a system API. Enumerates call restriction states. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3171,7 +4398,7 @@ This is a system API. Enumerates call transfer states. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3184,7 +4411,7 @@ This is a system API. Defines the cause of a call disconnection. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3197,7 +4424,7 @@ This is a system API. Enumerates causes of call disconnection. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3287,7 +4514,7 @@ This is a system API. Defines the MMI code result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3298,9 +4525,9 @@ This is a system API. ## MmiCodeResult9+ -Enumerates MMI code results. +Defines the MMI code result. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager @@ -3313,7 +4540,7 @@ This is a system API. Defines audio device options. -This is a system API. +**System API**: This is a system API. **System capability**: SystemCapability.Telephony.CallManager diff --git a/en/application-dev/reference/apis/js-apis-camera.md b/en/application-dev/reference/apis/js-apis-camera.md index b30722bd2fddd6ef83914ffe6b8a3421831935ce..106aa2ecdcea58b97966a46e1f4ea38bcb2432eb 100644 --- a/en/application-dev/reference/apis/js-apis-camera.md +++ b/en/application-dev/reference/apis/js-apis-camera.md @@ -2,7 +2,8 @@ > **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 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. ## Modules to Import @@ -30,6 +31,15 @@ Obtains a **CameraManager** instance. This API returns the result synchronously. | ----------------------------------------------- | ---------------------------- | | [CameraManager](#cameramanager) | **CameraManager** instance obtained. | +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | +| 7400201 | Camera service fatal error. | + **Example** ```js @@ -89,10 +99,10 @@ Defines the camera output capability. | Name | Type | Mandatory| Description | | ----------------------------- | -------------------------------------------------- | --- |------------------- | -| previewProfiles | Array<[Profile](#profile)\> | Yes | Supported preview profiles. | -| photoProfiles | Array<[Profile](#profile)\> | Yes | Supported shooting profiles. | -| videoProfiles | Array<[VideoProfile](#videoprofile)\> | Yes | Supported video recording profiles. | -| supportedMetadataObjectTypes | Array<[MetadataObjectType](#metadataobjecttype)\> | Yes | Supported metadata object types.| +| previewProfiles | Array\<[Profile](#profile)\> | Yes | Supported preview profiles. | +| photoProfiles | Array\<[Profile](#profile)\> | Yes | Supported shooting profiles. | +| videoProfiles | Array\<[VideoProfile](#videoprofile)\> | Yes | Supported video recording profiles. | +| supportedMetadataObjectTypes | Array\<[MetadataObjectType](#metadataobjecttype)\> | Yes | Supported metadata object types.| ## CameraErrorCode @@ -118,7 +128,7 @@ Implements camera management. Before calling any API in **CameraManager**, you m ### getSupportedCameras -getSupportedCameras(): Array +getSupportedCameras(): Array\ Obtains supported cameras. This API returns the result synchronously. @@ -128,7 +138,7 @@ Obtains supported cameras. This API returns the result synchronously. | Type | Description | | ----------------------------------------------- | ---------------------------- | -| Array<[CameraDevice](#cameradevice)> | An array of supported cameras. | +| Array\<[CameraDevice](#cameradevice)> | An array of supported cameras. | **Example** @@ -139,7 +149,7 @@ let cameras = cameraManager.getSupportedCameras(); ### getSupportedOutputCapability -getSupportedOutputCapability(cameraDevice:CameraDevice): CameraOutputCapability +getSupportedOutputCapability(camera:CameraDevice): CameraOutputCapability Obtains the output capability supported by a camera. This API returns the result synchronously. @@ -254,6 +264,14 @@ Creates a **CameraInput** instance with the specified **CameraDevice** object. T | ---------- | ----------------------------- | | [CameraInput](#camerainput) | **CameraInput** instance created. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | + **Example** ```js @@ -290,6 +308,14 @@ Creates a **CameraInput** instance with the specified camera position and type. | ---------- | ----------------------------- | | [CameraInput](#camerainput) | **CameraInput** instance created. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | + **Example** ```js @@ -326,6 +352,14 @@ Creates a **PreviewOutput** instance. This API returns the result synchronously. | ---------- | ----------------------------- | | [PreviewOutput](#previewoutput) | **PreviewOutput** instance created. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | + **Example** ```js @@ -360,6 +394,14 @@ Creates a **PhotoOutput** instance. This API returns the result synchronously. | ---------- | ----------------------------- | | [PhotoOutput](#photooutput) | **PhotoOutput** instance created. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | + **Example** ```js @@ -394,6 +436,14 @@ Creates a **VideoOutput** instance. This API returns the result synchronously. | ---------- | ----------------------------- | | [VideoOutput](#videooutput) | **VideoOutput** instance created. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | + **Example** ```js @@ -409,7 +459,7 @@ try { ### createMetadataOutput -createMetadataOutput(metadataObjectTypes:Array): MetadataOutput +createMetadataOutput(metadataObjectTypes:Array\): MetadataOutput Creates a **MetadataOutput** instance. This API returns the result synchronously. @@ -419,7 +469,7 @@ Creates a **MetadataOutput** instance. This API returns the result synchronously | Name | Type | Mandatory| Description | | -------------------- | -------------------------------------------------- | --- | ---------------------------- | -| metadataObjectTypes | Array<[MetadataObjectType](#metadataobjecttype)\> | Yes | Metadata object types, which are obtained through **getSupportedOutputCapability**.| +| metadataObjectTypes | Array\<[MetadataObjectType](#metadataobjecttype)\> | Yes | Metadata object types, which are obtained through **getSupportedOutputCapability**.| **Return value** @@ -427,6 +477,14 @@ Creates a **MetadataOutput** instance. This API returns the result synchronously | ---------- | ----------------------------- | | [MetadataOutput](#metadataoutput) | **MetadataOutput** instance created. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | + **Example** ```js @@ -454,6 +512,14 @@ Creates a **CaptureSession** instance. This API returns the result synchronously | ---------- | ----------------------------- | | [CaptureSession](#capturesession) | **CaptureSession** instance created. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | + **Example** ```js @@ -468,7 +534,7 @@ try { ### on('cameraStatus') -on(type: 'cameraStatus', callback: AsyncCallback): void +on(type: 'cameraStatus', callback: AsyncCallback\): void Listens for camera status changes. This API uses an asynchronous callback to return the result. @@ -476,10 +542,10 @@ Listens for camera status changes. This API uses an asynchronous callback to ret **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ----------------------------------------------------- | ---- | --------- | -| type | string | Yes | Event type. The value is fixed at **'cameraStatus'**. The callback function returns the camera information, including the device and device status (available or unavailable). The event can be listened for only when a **CameraManager** instance is obtained.| -| callback | AsyncCallback<[CameraStatusInfo](#camerastatusinfo)\> | Yes | Callback used to return the camera status change. | +| Name | Type | Mandatory| Description | +| -------- | -----------------| ---- | --------- | +| type | string | Yes | Event type. The value is fixed at **'cameraStatus'**. The event can be listened for when a **CameraManager** instance is obtained. This event is triggered and the corresponding information is returned only when the device is enabled or disabled.| +| callback | AsyncCallback\<[CameraStatusInfo](#camerastatusinfo)\> | Yes | Callback used to return the camera status change.| | **Example** @@ -492,7 +558,7 @@ cameraManager.on('cameraStatus', (cameraStatusInfo) => { ### on('cameraMute') -on(type: 'cameraMute', callback: AsyncCallback): void +on(type: 'cameraMute', callback: AsyncCallback\): void Listens for camera mute status changes. This API uses an asynchronous callback to return the result. @@ -504,8 +570,8 @@ This is a system API. | Name | Type | Mandatory| Description | | -------- | --------------- | ---- | --------- | -| type | string | Yes | Event type. The value is fixed at **'cameraMute'**. The callback function returns the mute status changes. The event can be listened for only when a **CameraManager** instance is obtained.| -| callback | AsyncCallback\ | Yes | Callback used to return the camera mute status. | +| type | string | Yes | Event type. The value is fixed at **'cameraMute'**, indicating the camera mute status. The event can be listened for when a **CameraManager** instance is obtained. This event is triggered and the status is returned when the camera is enabled or disabled.| +| callback | AsyncCallback\ | Yes | Callback used to return the mute status. The value **true** means that the camera is enabled, and **false** means that the camera is disabled. | **Example** @@ -617,7 +683,7 @@ Provides camera information used in **[CaptureSession](#capturesession)**. ### open -open\(callback: AsyncCallback\): void +open\(callback: AsyncCallback\\): void Opens this camera. This API uses an asynchronous callback to return the result. @@ -627,7 +693,17 @@ Opens this camera. This API uses an asynchronous callback to return the result. | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | ------------------- | -| callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| + +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400107 | Can not use camera cause of conflict. | +| 7400108 | Camera disabled cause of security reason. | +| 7400201 | Camera service fatal error. | **Example** @@ -643,7 +719,7 @@ cameraInput.open((err) => { ### open -open(): Promise +open(): Promise\ Opens this camera. This API uses a promise to return the result. @@ -653,7 +729,17 @@ Opens this camera. This API uses a promise to return the result. | Type | Description | | -------------- | ----------------------- | -| Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +| Promise\ | Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| + +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400107 | Can not use camera cause of conflict. | +| 7400108 | Camera disabled cause of security reason. | +| 7400201 | Camera service fatal error. | **Example** @@ -667,7 +753,7 @@ cameraInput.open().then(() => { ### close -close\(callback: AsyncCallback\): void +close\(callback: AsyncCallback\\): void Closes this camera. This API uses an asynchronous callback to return the result. @@ -677,7 +763,15 @@ Closes this camera. This API uses an asynchronous callback to return the result. | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | -------------------- | -| callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| + +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | **Example** @@ -693,7 +787,7 @@ cameraInput.close((err) => { ### close -close(): Promise +close(): Promise\ Closes this camera. This API uses a promise to return the result. @@ -703,7 +797,15 @@ Closes this camera. This API uses a promise to return the result. | Type | Description | | -------------- | ----------------------- | -| Promise| Promise used to return the result.| +| Promise\ | Promise used to return the result.| + +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | **Example** @@ -717,7 +819,7 @@ cameraInput.close().then(() => { ### on('error') -on(type: 'error', cameraDevice:CameraDevice, callback: ErrorCallback): void +on(type: 'error', camera:CameraDevice, callback: ErrorCallback\): void Listens for **CameraInput** errors. This API uses a callback to return the result. @@ -727,9 +829,9 @@ Listens for **CameraInput** errors. This API uses a callback to return the resul | Name | Type | Mandatory| Description | | -------- | -------------------------------- | --- | ------------------------------------------- | -| type | string | Yes | Event type. The value is fixed at **'error'**. The callback function returns an error code, for example, an error code indicating that the device is unavailable or a conflict occurs. The event can be listened for only when a **CameraInput** instance is obtained.| +| type | string | Yes | Event type. The value is fixed at **'error'**. The event can be listened for when a **CameraInput** instance is created. This event is triggered and the result is returned when an error occurs on the camera. For example, if the device is unavailable or a conflict occurs, the error information is returned.| | cameraDevice | [CameraDevice](#cameradevice) | Yes | **CameraDevice** object.| -| callback | ErrorCallback | Yes | Callback used to return an error code defined in [CameraErrorCode](#cameraerrorcode). | +| callback | ErrorCallback\ | Yes | Callback used to return an error code defined in [CameraErrorCode](#cameraerrorcode). | **Example** @@ -761,9 +863,9 @@ Enumerates the exposure modes. | Name | Value | Description | | ----------------------------- | ---- | ----------- | -| EXPOSURE_MODE_LOCKED | 0 | Exposure locked.| -| EXPOSURE_MODE_AUTO | 1 | Auto exposure.| -| EXPOSURE_MODE_CONTINUOUS_AUTO | 2 | Continuous auto exposure.| +| EXPOSURE_MODE_LOCKED | 0 | Exposure locked. The metering point cannot be set.| +| EXPOSURE_MODE_AUTO | 1 | Auto exposure. The metering point can be set by calling [setMeteringPoint](#setmeteringpoint).| +| EXPOSURE_MODE_CONTINUOUS_AUTO | 2 | Continuous auto exposure. The metering point cannot be set.| ## FocusMode @@ -773,10 +875,10 @@ Enumerates the focus modes. | Name | Value | Description | | -------------------------- | ---- | ------------ | -| FOCUS_MODE_MANUAL | 0 | Manual focus. | -| FOCUS_MODE_CONTINUOUS_AUTO | 1 | Continuous auto focus.| -| FOCUS_MODE_AUTO | 2 | Auto focus. | -| FOCUS_MODE_LOCKED | 3 | Focus locked. | +| FOCUS_MODE_MANUAL | 0 | Manual focus. The focal length of the camera can be manually set to change the focus position. However, the focal point cannot be set. | +| FOCUS_MODE_CONTINUOUS_AUTO | 1 | Continuous auto focus. The focal point cannot be set.| +| FOCUS_MODE_AUTO | 2 | Auto focus. The focal point can be set by calling [setFocusPoint](#setfocuspoint), and auto focus is performed once based on the focal point. After the auto focus operation is complete (regardless of whether the focus is successful or fails), the focus mode is locked. To enable the camera to initiate another auto focus, the application must call **CONTINUOUS_AUTO** again. | +| FOCUS_MODE_LOCKED | 3 | Focus locked. The focal point cannot be set. | ## FocusState @@ -822,6 +924,14 @@ Starts configuration for the session. | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400105 | Session config locked. | + **Example** ```js @@ -835,7 +945,7 @@ try { ### commitConfig -commitConfig(callback: AsyncCallback): void +commitConfig(callback: AsyncCallback\): void Commits the configuration for this **CaptureSession** instance. This API uses an asynchronous callback to return the result. @@ -845,7 +955,16 @@ Commits the configuration for this **CaptureSession** instance. This API uses an | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | -------------------- | -| callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| + +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400102 | Operation not allow. | +| 7400201 | Camera service fatal error. | **Example** @@ -861,7 +980,7 @@ captureSession.commitConfig((err) => { ### commitConfig -commitConfig(): Promise +commitConfig(): Promise\ Commits the configuration for this **CaptureSession** instance. This API uses a promise to return the result. @@ -871,7 +990,16 @@ Commits the configuration for this **CaptureSession** instance. This API uses a | Type | Description | | -------------- | ------------------------ | -| Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +| Promise\ | Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| + +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400102 | Operation not allow. | +| 7400201 | Camera service fatal error. | **Example** @@ -904,6 +1032,15 @@ Adds a [CameraInput](#camerainput) instance to the session. | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | +| 7400102 | Operation not allow. | + **Example** ```js @@ -935,6 +1072,15 @@ Removes a [CameraInput](#camerainput) instance from the session. | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | +| 7400102 | Operation not allow. | + **Example** ```js @@ -948,7 +1094,7 @@ try { ### addOutput -addOutput(previewOutput: CameraOutput): void +addOutput(cameraOutput: CameraOutput): void Adds a [CameraOutput](#cameraoutput) instance to the session. @@ -958,7 +1104,7 @@ Adds a [CameraOutput](#cameraoutput) instance to the session. | Name | Type | Mandatory| Description | | ------------- | ------------------------------- | ---- | ------------------------ | -| previewOutput | [PreviewOutput](#previewoutput) | Yes | **PreviewOutput** instance to add.| +| cameraOutput | [CameraOutput](#cameraoutput) | Yes | **CameraOutput** instance to add.| **Return value** @@ -966,11 +1112,20 @@ Adds a [CameraOutput](#cameraoutput) instance to the session. | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | +| 7400102 | Operation not allow. | + **Example** ```js try { - captureSession.addOutput(previewOutput); + captureSession.addOutput(cameraOutput); } catch (error) { // If the operation fails, error.code is returned and processed. console.log(error.code); @@ -979,7 +1134,7 @@ try { ### removeOutput -removeOutput(previewOutput: CameraOutput): void +removeOutput(cameraOutput: CameraOutput): void Removes a [CameraOutput](#cameraoutput) instance from the session. @@ -989,7 +1144,7 @@ Removes a [CameraOutput](#cameraoutput) instance from the session. | Name | Type | Mandatory| Description | | ------------- | ------------------------------- | ---- | ------------------------ | -| previewOutput | [PreviewOutput](#previewoutput) | Yes | **PreviewOutput** instance to remove.| +| cameraOutput | [CameraOutput](#cameraoutput) | Yes | **CameraOutput** instance to remove.| **Return value** @@ -997,6 +1152,15 @@ Removes a [CameraOutput](#cameraoutput) instance from the session. | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | +| 7400102 | Operation not allow. | + **Example** ```js @@ -1010,7 +1174,7 @@ try { ### start -start\(callback: AsyncCallback\): void +start\(callback: AsyncCallback\\): void Starts this **CaptureSession**. This API uses an asynchronous callback to return the result. @@ -1020,7 +1184,16 @@ Starts this **CaptureSession**. This API uses an asynchronous callback to return | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | -------------------- | -| callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| + +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | +| 7400201 | Camera service fatal error. | **Example** @@ -1036,7 +1209,7 @@ captureSession.start((err) => { ### start -start\(\): Promise +start\(\): Promise\ Starts this **CaptureSession**. This API uses a promise to return the result. @@ -1046,7 +1219,16 @@ Starts this **CaptureSession**. This API uses a promise to return the result. | Type | Description | | -------------- | ------------------------ | -| Promise| Promise used to return the result.| +| Promise\ | Promise used to return the result.| + +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | +| 7400201 | Camera service fatal error. | **Example** @@ -1060,7 +1242,7 @@ captureSession.start().then(() => { ### stop -stop\(callback: AsyncCallback\): void +stop\(callback: AsyncCallback\\): void Stops this **CaptureSession**. This API uses an asynchronous callback to return the result. @@ -1070,7 +1252,15 @@ Stops this **CaptureSession**. This API uses an asynchronous callback to return | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | ------------------- | -| callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| + +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | **Example** @@ -1086,7 +1276,7 @@ captureSession.stop((err) => { ### stop -stop(): Promise +stop(): Promise\ Stops this **CaptureSession**. This API uses a promise to return the result. @@ -1096,7 +1286,15 @@ Stops this **CaptureSession**. This API uses a promise to return the result. | Type | Description | | -------------- | ----------------------- | -| Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +| Promise\ | Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| + +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | **Example** @@ -1110,7 +1308,7 @@ captureSession.stop().then(() => { ### release -release\(callback: AsyncCallback\): void +release\(callback: AsyncCallback\\): void Releases this **CaptureSession**. This API uses an asynchronous callback to return the result. @@ -1120,7 +1318,15 @@ Releases this **CaptureSession**. This API uses an asynchronous callback to retu | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | -------------------- | -| callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| + +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | **Example** @@ -1136,7 +1342,7 @@ captureSession.release((err) => { ### release -release(): Promise +release(): Promise\ Releases this **CaptureSession**. This API uses a promise to return the result. @@ -1146,7 +1352,15 @@ Releases this **CaptureSession**. This API uses a promise to return the result. | Type | Description | | -------------- | ------------------------ | -| Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +| Promise\ | Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| + +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | **Example** @@ -1172,6 +1386,14 @@ Checks whether the device has flash. This API uses an asynchronous callback to r | ---------- | ----------------------------- | | boolean | Returns **true** if the device has flash; returns **false** otherwise. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1203,6 +1425,14 @@ Checks whether a flash mode is supported. | ---------- | ----------------------------- | | boolean | Returns **true** if the flash mode is supported; returns **false** otherwise. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1239,6 +1469,14 @@ Before the setting, do the following checks: | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1264,6 +1502,14 @@ Obtains the flash mode in use. | ---------- | ----------------------------- | | [FlashMode](#flashmode) | Flash mode obtained. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1295,6 +1541,14 @@ Checks whether an exposure mode is supported. | ---------- | ----------------------------- | | boolean | Returns **true** if the exposure mode is supported; returns **false** otherwise. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1320,6 +1574,14 @@ Obtains the exposure mode in use. | ---------- | ----------------------------- | | [ExposureMode](#exposuremode) | Exposure mode obtained. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1351,6 +1613,14 @@ Sets an exposure mode for the device. | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1376,6 +1646,14 @@ Obtains the metering point of the device. | ---------- | ----------------------------- | | [Point](#point) | Metering point obtained. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1391,7 +1669,9 @@ try { setMeteringPoint(point: Point): void -Sets the metering point for the device. +Sets the metering point, which is the center point of the metering rectangle. The metering point must be in the coordinate system (0-1), where the upper left corner is {0, 0} and the lower right corner is {1, 1}. + +The coordinate system is based on the horizontal device direction with the device's charging port on the right. If the layout of the preview screen of an application is based on the vertical direction with the charging port on the lower side, the layout width and height are {w, h}, and the touch point is {x, y}, then the coordinate point after conversion is {y/h, 1-x/w}. **System capability**: SystemCapability.Multimedia.Camera.Core @@ -1407,6 +1687,14 @@ Sets the metering point for the device. | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1421,7 +1709,7 @@ try { ### getExposureBiasRange -getExposureBiasRange(): Array +getExposureBiasRange(): Array\ Obtains the exposure compensation values of the device. @@ -1431,7 +1719,15 @@ Obtains the exposure compensation values of the device. | Type | Description | | ---------- | ----------------------------- | -| Array | An array of compensation values. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +| Array\ | An array of compensation values. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| + +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | **Example** @@ -1448,7 +1744,7 @@ try { setExposureBias(exposureBias: number): void -Sets an exposure compensation value for the device. +Sets an exposure compensation value (EV). Before the setting, you are advised to use **[getExposureBiasRange](#getexposurebiasrange)** to obtain the supported values. @@ -1460,6 +1756,14 @@ Before the setting, you are advised to use **[getExposureBiasRange](#getexposure | -------- | -------------------------------| ---- | ------------------- | | exposureBias | number | Yes | Exposure bias to set, which must be within the range obtained by running **getExposureBiasRange** interface. If the API call fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1486,6 +1790,14 @@ Obtains the exposure value in use. | ---------- | ----------------------------- | | number | Exposure value obtained. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1517,6 +1829,14 @@ Checks whether a focus mode is supported. | ---------- | ----------------------------- | | boolean | Returns **true** if the focus mode is supported; returns **false** otherwise. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1550,6 +1870,14 @@ Before the setting, use **[isFocusModeSupported](#isfocusmodesupported)** to che | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1575,6 +1903,14 @@ Obtains the focus mode in use. | ---------- | ----------------------------- | | [FocusMode](#focusmode) | Focus mode obtained. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1590,7 +1926,9 @@ try { setFocusPoint(point: Point): void -Sets a focal point for the device. +Sets the focal point. The focal point must be in the coordinate system (0-1), where the upper left corner is {0, 0} and the lower right corner is {1, 1}. + +The coordinate system is based on the horizontal device direction with the device's charging port on the right. If the layout of the preview screen of an application is based on the vertical direction with the charging port on the lower side, the layout width and height are {w, h}, and the touch point is {x, y}, then the coordinate point after conversion is {y/h, 1-x/w}. **System capability**: SystemCapability.Multimedia.Camera.Core @@ -1606,6 +1944,14 @@ Sets a focal point for the device. | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1632,6 +1978,14 @@ Obtains the focal point of the device. | ---------- | ----------------------------- | | [Point](#point) | Focal point obtained. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1657,6 +2011,14 @@ Obtains the focal length of the device. | ---------- | ----------------------------- | | number | Focal length obtained. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1670,7 +2032,7 @@ try { ### getZoomRatioRange -getZoomRatioRange(): Array +getZoomRatioRange(): Array\ Obtains the supported zoom ratio range. @@ -1680,7 +2042,15 @@ Obtains the supported zoom ratio range. | Type | Description | | ---------- | ----------------------------- | -| Array | Callback used to return an array containing the minimum and maximum zoom ratios. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +| Array\ | Callback used to return an array containing the minimum and maximum zoom ratios. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| + +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | **Example** @@ -1697,7 +2067,7 @@ try { setZoomRatio(zoomRatio: number): void -Sets a zoom ratio for the device. +Sets a zoom ratio, with a maximum precision of two decimal places. **System capability**: SystemCapability.Multimedia.Camera.Core @@ -1713,6 +2083,14 @@ Sets a zoom ratio for the device. | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1739,6 +2117,14 @@ Obtains the zoom ratio in use. | ---------- | ----------------------------- | | number | Zoom ratio obtained. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1770,6 +2156,14 @@ Checks whether the specified video stabilization mode is supported. | ---------- | ----------------------------- | | boolean | Returns **true** if the video stabilization mode is supported; returns **false** otherwise. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1795,6 +2189,14 @@ Obtains the video stabilization mode in use. | ---------- | ----------------------------- | | VideoStabilizationMode | Video stabilization mode obtained. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1826,6 +2228,14 @@ Sets a video stabilization mode for the device. | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | + **Example** ```js @@ -1839,7 +2249,7 @@ try { ### on('focusStateChange') -on(type: 'focusStateChange', callback: AsyncCallback): void +on(type: 'focusStateChange', callback: AsyncCallback\): void Listens for focus state changes. This API uses an asynchronous callback to return the result. @@ -1849,8 +2259,8 @@ Listens for focus state changes. This API uses an asynchronous callback to retur | Name | Type | Mandatory| Description | | -------- | ----------------------------------------- | ---- | ------------------------ | -| type | string | Yes | Event type. The value is fixed at **'focusStateChange'**. The callback function returns the focus state change. The event can be listened for only when the session is created.| -| callback | AsyncCallback<[FocusState](#focusstate)\> | Yes | Callback used to return the focus state change. | +| type | string | Yes | Event type. The value is fixed at **'focusStateChange'**. The event can be listened for when a session is created. This event is triggered only when the camera focus state changes in auto focus mode.| +| callback | AsyncCallback\<[FocusState](#focusstate)\> | Yes | Callback used to return the focus state change. | **Example** @@ -1862,7 +2272,7 @@ captureSession.on('focusStateChange', (focusState) => { ### on('error') -on(type: 'error', callback: ErrorCallback): void +on(type: 'error', callback: ErrorCallback\): void Listens for **CaptureSession** errors. This API uses a callback to return the errors. @@ -1872,8 +2282,8 @@ Listens for **CaptureSession** errors. This API uses a callback to return the er | Name | Type | Mandatory| Description | | -------- | ----------------------------------------------------------- | ---- | ------------------------------ | -| type | string | Yes | Event type. The value is fixed at **'error'**. The callback function returns the error code corresponding to an error that occurs during the call of a **CaptureSession** API, for example, **beginConfig()**, **commitConfig()**, or **addInput()**.| -| callback | ErrorCallback | Yes | Callback used to return an error code defined in [CameraErrorCode](#cameraerrorcode). | +| type | string | Yes | Event type. The value is fixed at **'error'**. The event can be listened for when a session is created. This event is triggered and the error message is returned when an error occurs during the calling of a session-related API such as **beginConfig()**, **commitConfig()**, and **addInput**.| +| callback | ErrorCallback\ | Yes | Callback used to return an error code defined in [CameraErrorCode](#cameraerrorcode). | **Example** @@ -1893,7 +2303,7 @@ Implements preview output. It inherits **[CameraOutput](#cameraoutput)**. ### start -start(callback: AsyncCallback): void +start(callback: AsyncCallback\): void Starts to output preview streams. This API uses an asynchronous callback to return the result. @@ -1903,7 +2313,15 @@ Starts to output preview streams. This API uses an asynchronous callback to retu | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | -------------------- | -| callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| + +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | **Example** @@ -1919,7 +2337,7 @@ previewOutput.start((err) => { ### start -start(): Promise +start(): Promise\ Starts to output preview streams. This API uses a promise to return the result. @@ -1929,7 +2347,15 @@ Starts to output preview streams. This API uses a promise to return the result. | Type | Description | | -------------- | ----------------------- | -| Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +| Promise\ | Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| + +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | **Example** @@ -1943,7 +2369,7 @@ previewOutput.start().then(() => { ### stop -stop(callback: AsyncCallback): void +stop(callback: AsyncCallback\): void Stops outputting preview streams. This API uses an asynchronous callback to return the result. @@ -1953,7 +2379,7 @@ Stops outputting preview streams. This API uses an asynchronous callback to retu | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | -------------------- | -| callback | AsyncCallback | Yes | Callback used to return the result.| +| callback | AsyncCallback\ | Yes | Callback used to return the result.| **Example** @@ -1969,7 +2395,7 @@ previewOutput.stop((err) => { ### stop -stop(): Promise +stop(): Promise\ Stops outputting preview streams. This API uses a promise to return the result. @@ -1979,7 +2405,7 @@ Stops outputting preview streams. This API uses a promise to return the result. | Type | Description | | -------------- | ------------------------ | -| Promise| Promise used to return the result.| +| Promise\ | Promise used to return the result.| **Example** @@ -1993,7 +2419,7 @@ previewOutput.stop().then(() => { ### release -release(callback: AsyncCallback): void +release(callback: AsyncCallback\): void Releases output resources. This API uses an asynchronous callback to return the result. @@ -2003,7 +2429,15 @@ Releases output resources. This API uses an asynchronous callback to return the | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | ------------------- | -| callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| + +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | **Example** @@ -2019,7 +2453,7 @@ previewOutput.release((err) => { ### release -release(): Promise +release(): Promise\ Releases output resources. This API uses a promise to return the result. @@ -2029,7 +2463,15 @@ Releases output resources. This API uses a promise to return the result. | Type | Description | | -------------- | ----------------------- | -| Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +| Promise\ | Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| + +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | **Example** @@ -2043,7 +2485,7 @@ previewOutput.release().then(() => { ### on('frameStart') -on(type: 'frameStart', callback: AsyncCallback): void +on(type: 'frameStart', callback: AsyncCallback\): void Listens for preview frame start events. This API uses an asynchronous callback to return the result. @@ -2053,8 +2495,8 @@ Listens for preview frame start events. This API uses an asynchronous callback t | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | --------------------------------------- | -| type | string | Yes | Event type. The value is fixed at **'frameStart'**. The callback is invoked when the preview on the first frame starts. This event can be listened for only when a **previewOutput** instance is created.| -| callback | AsyncCallback | Yes | Callback used to return the result. | +| type | string | Yes | Event type. The value is fixed at **'frameStart'**. The event can be listened for when a **previewOutput** instance is created. This event is triggered and returned when the bottom layer starts exposure for the first time.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. The preview starts as long as this event is returned. | **Example** @@ -2066,7 +2508,7 @@ previewOutput.on('frameStart', () => { ### on('frameEnd') -on(type: 'frameEnd', callback: AsyncCallback): void +on(type: 'frameEnd', callback: AsyncCallback\): void Listens for preview frame end events. This API uses an asynchronous callback to return the result. @@ -2076,8 +2518,8 @@ Listens for preview frame end events. This API uses an asynchronous callback to | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | ------------------------------------- | -| type | string | Yes | Event type. The value is fixed at **'frameEnd'**. The callback is invoked when the preview on the last frame ends. This event can be listened for only when a **previewOutput** instance is created.| -| callback | AsyncCallback | Yes | Callback used to return the result. | +| type | string | Yes | Event type. The value is fixed at **'frameEnd'**. The event can be listened for when a **previewOutput** instance is created. This event is triggered and returned when the last frame of preview ends.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. The preview ends as long as this event is returned. | **Example** @@ -2089,7 +2531,7 @@ previewOutput.on('frameEnd', () => { ### on('error') -on(type: 'error', callback: ErrorCallback): void +on(type: 'error', callback: ErrorCallback\): void Listens for **PreviewOutput** errors. This API uses a callback to return the errors. @@ -2097,10 +2539,10 @@ Listens for **PreviewOutput** errors. This API uses a callback to return the err **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ----------------------------------------------------------------- | ---- | ------------------------ | -| type | string | Yes | Event type. The value is fixed at **'error'**. The callback function returns the error code corresponding to an error that occurs during the call of a **PreviewOutput** API, for example, **start()** or **release()**.| -| callback | ErrorCallback | Yes | Callback used to return an error code defined in [CameraErrorCode](#cameraerrorcode). | +| Name | Type | Mandatory| Description | +| -------- | --------------| ---- | ------------------------ | +| type | string | Yes | Event type. The value is fixed at **'error'**. The event can be listened for when a **previewOutput** instance is created. This event is triggered and the corresponding error message is returned when an error occurs during the use of a preview-related API such as **start()** or **release()**.| +| callback | ErrorCallback\ | Yes | Callback used to return an error code defined in [CameraErrorCode](#cameraerrorcode). | **Example** @@ -2167,7 +2609,7 @@ Implements output information used in a shooting session. This class inherits fr ### capture -capture(callback: AsyncCallback): void +capture(callback: AsyncCallback\): void Captures a photo with the default shooting parameters. This API uses an asynchronous callback to return the result. @@ -2177,7 +2619,16 @@ Captures a photo with the default shooting parameters. This API uses an asynchro | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | ------------------- | -| callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| + +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400104 | Session not running. | +| 7400201 | Camera service fatal error. | **Example** @@ -2193,7 +2644,7 @@ photoOutput.capture((err) => { ### capture -capture(): Promise +capture(): Promise\ Captures a photo with the default shooting parameters. This API uses a promise to return the result. @@ -2203,7 +2654,16 @@ Captures a photo with the default shooting parameters. This API uses a promise t | Type | Description | | -------------- | ------------------------ | -| Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +| Promise\ | Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| + +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400104 | Session not running. | +| 7400201 | Camera service fatal error. | **Example** @@ -2217,7 +2677,7 @@ photoOutput.capture().then(() => { ### capture -capture(setting: PhotoCaptureSetting, callback: AsyncCallback): void +capture(setting: PhotoCaptureSetting, callback: AsyncCallback\): void Captures a photo with the specified shooting parameters. This API uses an asynchronous callback to return the result. @@ -2228,7 +2688,17 @@ Captures a photo with the specified shooting parameters. This API uses an asynch | Name | Type | Mandatory| Description | | -------- | ------------------------------------------- | ---- | -------------------- | | setting | [PhotoCaptureSetting](#photocapturesetting) | Yes | Shooting settings. | -| callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned. | +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned. | + +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | +| 7400104 | Session not running. | +| 7400201 | Camera service fatal error. | **Example** @@ -2255,7 +2725,7 @@ photoOutput.capture(settings, (err) => { ### capture -capture(setting?: PhotoCaptureSetting): Promise +capture(setting?: PhotoCaptureSetting): Promise\ Captures a photo with the specified shooting parameters. This API uses a promise to return the result. @@ -2271,8 +2741,17 @@ Captures a photo with the specified shooting parameters. This API uses a promise | Type | Description | | -------------- | ------------------------ | -| Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +| Promise\ | Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | +| 7400104 | Session not running. | +| 7400201 | Camera service fatal error. | **Example** @@ -2306,7 +2785,7 @@ let isSupported = photoOutput.isMirrorSupported(); ### release -release(callback: AsyncCallback): void +release(callback: AsyncCallback\): void Releases output resources. This API uses an asynchronous callback to return the result. @@ -2316,7 +2795,15 @@ Releases output resources. This API uses an asynchronous callback to return the | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | ------------------- | -| callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| + +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | **Example** @@ -2332,7 +2819,7 @@ photoOutput.release((err) => { ### release -release(): Promise +release(): Promise\ Releases output resources. This API uses a promise to return the result. @@ -2342,7 +2829,15 @@ Releases output resources. This API uses a promise to return the result. | Type | Description | | -------------- | ----------------------- | -| Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +| Promise\ | Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| + +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | **Example** @@ -2356,7 +2851,7 @@ photoOutput.release().then(() => { ### on('captureStart') -on(type: 'captureStart', callback: AsyncCallback): void +on(type: 'captureStart', callback: AsyncCallback\): void Listens for shooting start events. This API uses an asynchronous callback to return the capture ID. @@ -2366,8 +2861,8 @@ Listens for shooting start events. This API uses an asynchronous callback to ret | Name | Type | Mandatory| Description | | -------- | ---------------------- | ---- | ------------------------------------------ | -| type | string | Yes | Event type. The value is fixed at **'captureStart'**. The callback function returns the shooting start event.| -| callback | AsyncCallback | Yes | Callback used to return the capture ID. | +| type | string | Yes | Event type. The value is fixed at **'captureStart'**. The event can be listened for when a **photoOutput** instance is created. This event is triggered and returned when the bottom layer starts exposure each time a photo is taken.| +| callback | AsyncCallback\ | Yes | Callback used to return the capture ID. | **Example** @@ -2379,7 +2874,7 @@ photoOutput.on('captureStart', (captureId) => { ### on('frameShutter') -on(type: 'frameShutter', callback: AsyncCallback): void +on(type: 'frameShutter', callback: AsyncCallback\): void Listens for frame shutter events. This API uses an asynchronous callback to return the event information. @@ -2387,10 +2882,10 @@ Listens for frame shutter events. This API uses an asynchronous callback to retu **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ----------------------------------------------------- | --- | ------------------------------------ | -| type | string | Yes | Event type. The value is fixed at **'frameShutter'**. The callback function returns the captured frame information (captureId and time).| -| callback | AsyncCallback<[FrameShutterInfo](#frameshutterinfo)\> | Yes | Callback used to return the result. | +| Name | Type | Mandatory| Description | +| -------- | ---------- | --- | ------------------------------------ | +| type | string | Yes | Event type. The value is fixed at **'frameShutter'**. The event can be listened for when a **photoOutput** instance is created.| +| callback | AsyncCallback\<[FrameShutterInfo](#frameshutterinfo)\> | Yes | Callback used to return the result. A new photographing request can be delivered as long as this event is returned. | **Example** @@ -2403,7 +2898,7 @@ photoOutput.on('frameShutter', (frameShutterInfo) => { ### on('captureEnd') -on(type: 'captureEnd', callback: AsyncCallback): void +on(type: 'captureEnd', callback: AsyncCallback\): void Listens for shooting end events. This API uses an asynchronous callback to return the event information. @@ -2411,10 +2906,10 @@ Listens for shooting end events. This API uses an asynchronous callback to retur **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ------------------------------------------------- | ---- | ---------------------------------------- | -| type | string | Yes | Event type. The value is fixed at **'captureEnd'**. The callback function returns the shooting end event.| -| callback | AsyncCallback<[CaptureEndInfo](#captureendinfo)\> | Yes | Callback used to return the result. | +| Name | Type | Mandatory| Description | +| -------- | --------------- | ---- | ---------------------------------------- | +| type | string | Yes | Event type. The value is fixed at **'captureEnd'**. The event can be listened for when a **photoOutput** instance is created. This event is triggered and the corresponding information is returned when the photographing is complete.| +| callback | AsyncCallback\<[CaptureEndInfo](#captureendinfo)\> | Yes | Callback used to return the result. | **Example** @@ -2427,7 +2922,7 @@ photoOutput.on('captureEnd', (captureEndInfo) => { ### on('error') -on(type: 'error', callback: ErrorCallback): void +on(type: 'error', callback: ErrorCallback\): void Listens for **PhotoOutput** errors. This API uses a callback to return the errors. @@ -2435,10 +2930,10 @@ Listens for **PhotoOutput** errors. This API uses a callback to return the error **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ----------------------------------------------------- | ---- | ----------------------------------- | -| type | string | Yes | Event type. The value is fixed at **'error'**. The callback function returns an error code when an API call fails.| -| callback | ErrorCallback | Yes | Callback used to return an error code defined in [CameraErrorCode](#cameraerrorcode). | +| Name | Type | Mandatory| Description | +| -------- | ------------- | ---- | ----------------------------------- | +| type | string | Yes | Event type. The value is fixed at **'error'**. The event can be listened for when a **photoOutput** instance is created. This event is triggered and the corresponding error message is returned when an error occurs during the calling of a photographing-related API.| +| callback | ErrorCallback\ | Yes | Callback used to return an error code defined in [CameraErrorCode](#cameraerrorcode). | **Example** @@ -2476,7 +2971,7 @@ Implements output information used in a video recording session. This class inhe ### start -start(callback: AsyncCallback): void +start(callback: AsyncCallback\): void Starts video recording. This API uses an asynchronous callback to return the result. @@ -2486,7 +2981,16 @@ Starts video recording. This API uses an asynchronous callback to return the res | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | -------------------- | -| callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| + +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | +| 7400201 | Camera service fatal error. | **Example** @@ -2502,7 +3006,7 @@ videoOutput.start((err) => { ### start -start(): Promise +start(): Promise\ Starts video recording. This API uses a promise to return the result. @@ -2512,8 +3016,16 @@ Starts video recording. This API uses a promise to return the result. | Type | Description | | -------------- | ----------------------- | -| Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +| Promise\ | Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| + +**Error codes** +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | +| 7400201 | Camera service fatal error. | **Example** @@ -2527,7 +3039,7 @@ videoOutput.start().then(() => { ### stop -stop(callback: AsyncCallback): void +stop(callback: AsyncCallback\): void Stops video recording. This API uses an asynchronous callback to return the result. @@ -2537,7 +3049,7 @@ Stops video recording. This API uses an asynchronous callback to return the resu | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | ------------------------ | -| callback | AsyncCallback | Yes | Callback used to return the result.| +| callback | AsyncCallback\ | Yes | Callback used to return the result.| **Example** @@ -2553,7 +3065,7 @@ videoOutput.stop((err) => { ### stop -stop(): Promise +stop(): Promise\ Stops video recording. This API uses a promise to return the result. @@ -2563,7 +3075,7 @@ Stops video recording. This API uses a promise to return the result. | Type | Description | | -------------- | ----------------------- | -| Promise| Promise used to return the result.| +| Promise\ | Promise used to return the result.| **Example** @@ -2577,7 +3089,7 @@ videoOutput.stop().then(() => { ### release -release(callback: AsyncCallback): void +release(callback: AsyncCallback\): void Releases output resources. This API uses an asynchronous callback to return the result. @@ -2587,7 +3099,15 @@ Releases output resources. This API uses an asynchronous callback to return the | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | ------------------- | -| callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| + +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | **Example** @@ -2603,7 +3123,7 @@ videoOutput.release((err) => { ### release -release(): Promise +release(): Promise\ Releases output resources. This API uses a promise to return the result. @@ -2613,7 +3133,15 @@ Releases output resources. This API uses a promise to return the result. | Type | Description | | -------------- | ----------------------- | -| Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +| Promise\ | Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| + +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | **Example** @@ -2627,7 +3155,7 @@ videoOutput.release().then(() => { ### on('frameStart') -on(type: 'frameStart', callback: AsyncCallback): void +on(type: 'frameStart', callback: AsyncCallback\): void Listens for video recording start events. This API uses an asynchronous callback to return the result. @@ -2637,8 +3165,8 @@ Listens for video recording start events. This API uses an asynchronous callback | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | ----------------------------------------- | -| type | string | Yes | Event type. The value is fixed at **'frameStart'**. The callback is invoked when the recording on the first frame of an image starts.| -| callback | AsyncCallback | Yes | Callback used to return the result. | +| type | string | Yes | Event type. The value is fixed at **'frameStart'**. The event can be listened for when a **videoOutput** instance is created. The event is triggered and the corresponding information is returned when the bottom layer starts exposure for the first time.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. The recording starts as long as this event is returned. | **Example** @@ -2650,7 +3178,7 @@ videoOutput.on('frameStart', () => { ### on('frameEnd') -on(type: 'frameEnd', callback: AsyncCallback): void +on(type: 'frameEnd', callback: AsyncCallback\): void Listens for video recording stop events. This API uses an asynchronous callback to return the result. @@ -2660,8 +3188,8 @@ Listens for video recording stop events. This API uses an asynchronous callback | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | ------------------------------------------ | -| type | string | Yes | Event type. The value is fixed at **'frameEnd'**. The callback is invoked when the recording on the last frame of an image stops.| -| callback | AsyncCallback | Yes | Callback used to return the result. | +| type | string | Yes | Event type. The value is fixed at **'frameEnd'**. The event can be listened for when a **videoOutput** instance is created. This event is triggered and returned when the last frame of recording is complete.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. The recording ends as long as this event is returned. | **Example** @@ -2673,7 +3201,7 @@ videoOutput.on('frameEnd', () => { ### on('error') -on(type: 'error', callback: ErrorCallback): void +on(type: 'error', callback: ErrorCallback\): void Listens for errors that occur during video recording. This API uses a callback to return the result. @@ -2681,10 +3209,10 @@ Listens for errors that occur during video recording. This API uses a callback t **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ------------------------------------------------ | ---- | -------------------------------------- | -| type | string | Yes | Event type. The value is fixed at **'error'**. The callback function returns the error code corresponding to an error that occurs during the call of a **VideoOutput** API, for example, **start()** or **release()**.| -| callback | Callback | Yes | Callback used to return an error code defined in [CameraErrorCode](#cameraerrorcode). | +| Name | Type | Mandatory| Description | +| -------- | ----------- | ---- | -------------------------------------- | +| type | string | Yes | Event type. The value is fixed at **'error'**. The event can be listened for when a **videoOutput** instance is created. This event is triggered and the corresponding error message is returned when an error occurs during the calling of a recording-related API such as **start()** and **release()**.| +| callback | Callback\ | Yes | Callback used to return an error code defined in [CameraErrorCode](#cameraerrorcode). | **Example** @@ -2700,7 +3228,7 @@ Implements metadata streams. It inherits **[CameraOutput](#cameraoutput)**. ### start -start(callback: AsyncCallback): void +start(callback: AsyncCallback\): void Starts to output metadata. This API uses an asynchronous callback to return the result. @@ -2710,7 +3238,16 @@ Starts to output metadata. This API uses an asynchronous callback to return the | Name | Type | Mandatory| Description | | -------- | -------------------------- | ---- | ------------------- | -| callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| + +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | +| 7400201 | Camera service fatal error. | **Example** @@ -2726,7 +3263,7 @@ metadataOutput.start((err) => { ### start -start(): Promise +start(): Promise\ Starts to output metadata. This API uses a promise to return the result. @@ -2736,7 +3273,16 @@ Starts to output metadata. This API uses a promise to return the result. | Type | Description | | ---------------------- | ------------------------ | -| Promise | Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| +| Promise\ | Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.| + +**Error codes** + +For details about the error codes, see [CameraErrorCode](#cameraerrorcode). + +| ID | Error Message | +| --------------- | --------------- | +| 7400103 | Session not config. | +| 7400201 | Camera service fatal error. | **Example** @@ -2750,7 +3296,7 @@ metadataOutput.start().then(() => { ### stop -stop(callback: AsyncCallback): void +stop(callback: AsyncCallback\): void Stops outputting metadata. This API uses an asynchronous callback to return the result. @@ -2760,7 +3306,7 @@ Stops outputting metadata. This API uses an asynchronous callback to return the | Name | Type | Mandatory| Description | | -------- | -------------------------- | ---- | ------------------- | -| callback | AsyncCallback | Yes | Callback used to return the result.| +| callback | AsyncCallback\ | Yes | Callback used to return the result.| **Example** @@ -2776,7 +3322,7 @@ metadataOutput.stop((err) => { ### stop -stop(): Promise +stop(): Promise\ Stops outputting metadata. This API uses a promise to return the result. @@ -2786,7 +3332,7 @@ Stops outputting metadata. This API uses a promise to return the result. | Type | Description | | ---------------------- | --------------------------- | -| Promise | Promise used to return the result.| +| Promise\ | Promise used to return the result.| **Example** @@ -2800,7 +3346,7 @@ metadataOutput.stop().then(() => { ### on('metadataObjectsAvailable') -on(type: 'metadataObjectsAvailable', callback: AsyncCallback\>): void +on(type: 'metadataObjectsAvailable', callback: AsyncCallback\\>): void Listens for metadata objects. This API uses an asynchronous callback to return the result. @@ -2808,10 +3354,10 @@ Listens for metadata objects. This API uses an asynchronous callback to return t **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ------------------------------------------------ | ---- | ------------------------------------ | -| type | string | Yes | Event type. The value is fixed at **'metadataObjectsAvailable'**. The callback function returns the valid metadata. This event can be listened for only when a **MetadataOutput** instance is created.| -| callback | Callback\> | Yes | Callback used to return the metadata.| +| Name | Type | Mandatory| Description | +| -------- | -------------- | ---- | ------------------------------------ | +| type | string | Yes | Event type. The value is fixed at **'metadataObjectsAvailable'**. The event can be listened for when a **metadataOutput** instance is created. This event is triggered and the corresponding metadata is returned when valid metadata is detected.| +| callback | Callback\\> | Yes | Callback used to return the metadata.| **Example** @@ -2823,7 +3369,7 @@ metadataOutput.on('metadataObjectsAvailable', (metadataObjectArr) => { ### on('error') -on(type: 'error', callback: ErrorCallback): void +on(type: 'error', callback: ErrorCallback\): void Listens for metadata errors. This API uses an asynchronous callback to return the result. @@ -2831,10 +3377,10 @@ Listens for metadata errors. This API uses an asynchronous callback to return th **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ------------------------------------------------ | ---- | --------------------------------------- | -| type | string | Yes | Event type. The value is fixed at **'error'**. The callback function returns the error code corresponding to an error that occurs during the call of a **MetadataOutput** instance API, for example, **start()** or **release()**.| -| callback | Callback | Yes | Callback used to return an error code defined in [CameraErrorCode](#cameraerrorcode). | +| Name | Type | Mandatory| Description | +| -------- | ------------- | ---- | --------------------------------------- | +| type | string | Yes | Event type. The value is fixed at **'error'**. The event can be listened for when a **metadataOutput** instance is created. This event is triggered and the corresponding error message is returned when an error occurs during the calling of a metadata-related API such as **start()** and **release()**.| +| callback | Callback\ | Yes | Callback used to return an error code defined in [CameraErrorCode](#cameraerrorcode). | **Example** @@ -2852,7 +3398,7 @@ Enumerates the metadata object types. | Name | Value | Description | | ------------------------- | ---- | ----------------- | -| FACE_DETECTION | 0 | Face detection.| +| FACE_DETECTION | 0 | Face detection. The detection point must be in the coordinate system (0-1), where the upper left corner is {0, 0} and the lower right corner is {1, 1}.
The coordinate system is based on the horizontal device direction with the device's charging port on the right.
If the layout of a preview screen of an application is based on the vertical direction with the charging port on the lower side,
the layout width and height are {w, h} and the return point is {x, y}, then the coordinate point after conversion is {1-y, x}.| ## Rect @@ -2871,6 +3417,8 @@ Defines a rectangle. Implements camera metadata, which is the data source of [CameraInput](#camerainput). The metadata is obtained through metadataOutput.on('metadataObjectsAvailable'). +**System capability**: SystemCapability.Multimedia.Camera.Core + | Name | Type | Mandatory | Description | | -------- | ------------------------------- | ---- | -----------------| | type | [MetadataObjectType](#metadataobjecttype) | No | Metadata data type. Only face recognition is supported.| diff --git a/en/application-dev/reference/apis/js-apis-cert.md b/en/application-dev/reference/apis/js-apis-cert.md index cf334f6fd36fd654c2c9558865b0c9f06b68d9ef..9b4aac5ba2690b202ed83cf6386fff3394017ca3 100644 --- a/en/application-dev/reference/apis/js-apis-cert.md +++ b/en/application-dev/reference/apis/js-apis-cert.md @@ -104,6 +104,11 @@ Creates an **X509Cert** instance. This API uses an asynchronous callback to retu | inStream | [EncodingBlob](#encodingblob) | Yes | X.509 certificate serialization data. | | callback | AsyncCallback\ | Yes | Callback invoked to return the result. **X509Cert** instance created.| +**Error codes** + +| ID| Error Message | +| -------- | ------------- | +| 19020001 | Memory error. | **Example** @@ -146,6 +151,12 @@ Creates an **X509Cert** instance. This API uses a promise to return the result. | ------- | ---------------- | | Promise\ | **X509Cert** instance created.| +**Error codes** + +| ID| Error Message | +| -------- | ------------- | +| 19020001 | Memory error. | + **Example** ```js @@ -184,6 +195,11 @@ Verifies the certificate signature. This API uses an asynchronous callback to re | key | cryptoFramework.PubKey | Yes | Public key used for signature verification. | | callback | AsyncCallback\ | Yes | Callback invoked to return the result. If **error** is **null**, the signature verification is successful. If **error** is not **null**, the signature verification fails.| +**Error codes** + +| ID| Error Message | +| -------- | ------------------ | +| 19030001 | Crypto operation error. | **Example** @@ -235,6 +251,12 @@ Verifies the certificate signature. This API uses a promise to return the result | -------------- | ----------- | | Promise\ | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | ------------------ | +| 19030001 | Crypto operation error. | + **Example** ```js @@ -275,6 +297,13 @@ Obtains the serialized X.509 certificate data. This API uses an asynchronous cal | -------- | --------------------------------------------- | ---- | -------------------------------- | | callback | AsyncCallback\<[EncodingBlob](#encodingblob)> | Yes | Callback invoked to return the result. Promise used to return the serialized X.509 certificate data obtained.| +**Error codes** + +| ID| Error Message | +| -------- | ------------------------------------------------- | +| 19020001 | Memory error. | +| 19020002 | Runtime error. | +| 19030001 | Crypto operation error.| **Example** @@ -318,6 +347,14 @@ Obtains the serialized X.509 certificate data. This API uses a promise to return | --------------------------------------- | ---------------------- | | Promise\<[EncodingBlob](#encodingblob)> | Promise used to return the serialized X.509 certificate data obtained.| +**Error codes** + +| ID| Error Message | +| -------- | ------------------------------------------------- | +| 19020001 | Memory error. | +| 19020002 | Runtime error. | +| 19030001 | Crypto operation error.| + **Example** ```js @@ -356,6 +393,13 @@ Obtains the public key of this X.509 certificate. This API uses an asynchronous | ------ | ---------------- | | cryptoFramework.PubKey | Public key of the X509 certificate obtained. This object is used only for **verify()** of **X509Cert**.| +**Error codes** + +| ID| Error Message | +| -------- | ------------------------------------------------- | +| 19020001 | Memory error. | +| 19030001 | Crypto operation error.| + **Example** ```js @@ -398,6 +442,15 @@ Checks the validity period of this X.509 certificate. This API uses an asynchron | -------- | -------------- | ---- | ---------- | | date | string | Yes | Date in the YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ format. The date must end with **Z**, which indicates the UTC.| +**Error codes** + +| ID| Error Message | +| -------- | ------------------------------------------------- | +| 19020001 | Memory error. | +| 19030001 | Crypto operation error.| +| 19030003 | The certificate has not taken effect. | +| 19030004 | The certificate has expired.| + **Example** ```js @@ -513,6 +566,14 @@ Obtains the X.509 certificate issuer. | --------------------- | ---------------------- | | [DataBlob](#datablob) | X.509 certificate issuer obtained.| +**Error codes** + +| ID| Error Message | +| -------- | ------------------------------------------------- | +| 19020001 | Memory error. | +| 19020002 | Runtime error. | +| 19030001 | Crypto operation error.| + **Example** ```js @@ -549,6 +610,14 @@ Obtains the subject of this X.509 certificate. | --------------------- | -------------------- | | [DataBlob](#datablob) | Subject name obtained.| +**Error codes** + +| ID| Error Message | +| -------- | ------------------------------------------------- | +| 19020001 | Memory error. | +| 19020002 | Runtime error. | +| 19030001 | Crypto operation error.| + **Example** ```js @@ -585,6 +654,14 @@ Obtains the start time of this X.509 certificate. | ------ | ------------------------------------------------------------ | | string | Start time of the X509 certificate validity period, in the YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ format. The value must end with **Z**, which indicates the UTC.| +**Error codes** + +| ID| Error Message | +| -------- | ------------------------------------------------- | +| 19020001 | Memory error. | +| 19020002 | Runtime error. | +| 19030001 | Crypto operation error.| + **Example** ```js @@ -621,6 +698,14 @@ Obtains the expiration time of this X.509 certificate. | ------ | ------------------------------------------------------------ | | string | Expiration time of the X509 certificate validity period, in the YYMMDDHHMMSSZ or YYYYMMDDHHMMSSZ format. The value must end with **Z**, which indicates the UTC.| +**Error codes** + +| ID| Error Message | +| -------- | ------------------------------------------------- | +| 19020001 | Memory error. | +| 19020002 | Runtime error. | +| 19030001 | Crypto operation error.| + **Example** ```js @@ -657,6 +742,14 @@ Obtains the signature data of this X.509 certificate. | --------------------- | -------------------- | | [DataBlob](#datablob) | Signature data obtained.| +**Error codes** + +| ID| Error Message | +| -------- | ------------------------------------------------- | +| 19020001 | Memory error. | +| 19020002 | Runtime error. | +| 19030001 | Crypto operation error.| + **Example** ```js @@ -693,6 +786,14 @@ Obtains the signing algorithm of this X.509 certificate. | ------ | ------------------------ | | string | X.509 certificate signing algorithm obtained.| +**Error codes** + +| ID| Error Message | +| -------- | ------------------------------------------------- | +| 19020001 | Memory error. | +| 19020002 | Runtime error. | +| 19030001 | Crypto operation error.| + **Example** ```js @@ -729,6 +830,14 @@ Obtains the object identifier (OID) of the X.509 certificate signing algorithm. | ------ | --------------------------------- | | string | OID obtained.| +**Error codes** + +| ID| Error Message | +| -------- | ------------------------------------------------- | +| 19020001 | Memory error. | +| 19020002 | Runtime error. | +| 19030001 | Crypto operation error.| + **Example** ```js @@ -765,6 +874,14 @@ Obtains the signing algorithm parameters of this X.509 certificate. | --------------------- | ------------------------ | | [DataBlob](#datablob) | X.509 certificate signing algorithm parameters obtained.| +**Error codes** + +| ID| Error Message | +| -------- | ------------------------------------------------- | +| 19020001 | Memory error. | +| 19020002 | Runtime error. | +| 19030001 | Crypto operation error.| + **Example** ```js @@ -801,6 +918,13 @@ Obtains the key usage of this X.509 certificate. | --------------------- | -------------------- | | [DataBlob](#datablob) | Key usage of the X.509 certificate obtained.| +**Error codes** + +| ID| Error Message | +| -------- | ------------------------------------------------- | +| 19020001 | Memory error. | +| 19030001 | Crypto operation error.| + **Example** ```js @@ -837,6 +961,14 @@ Obtains the usage of the extended key of this X.509 certificate. | ----------------------- | ------------------------ | | [DataArray](#dataarray) | Usage of the extended key obtained.| +**Error codes** + +| ID| Error Message | +| -------- | ------------------------------------------------- | +| 19020001 | Memory error. | +| 19020002 | Runtime error. | +| 19030001 | Crypto operation error.| + **Example** ```js @@ -909,6 +1041,14 @@ Obtains the Subject Alternative Names (SANs) of this X.509 certificate. | ----------------------- | ------------------------ | | [DataArray](#dataarray) | SANs obtained.| +**Error codes** + +| ID| Error Message | +| -------- | ------------------------------------------------- | +| 19020001 | Memory error. | +| 19020002 | Runtime error. | +| 19030001 | Crypto operation error.| + **Example** ```js @@ -945,6 +1085,14 @@ Obtains the Issuer Alternative Names (IANs) of this X.509 certificate. | ----------------------- | -------------------------- | | [DataArray](#dataarray) | IANs obtained.| +**Error codes** + +| ID| Error Message | +| -------- | ------------------------------------------------- | +| 19020001 | Memory error. | +| 19020002 | Runtime error. | +| 19030001 | Crypto operation error.| + **Example** ```js @@ -982,6 +1130,11 @@ Creates an **X509Crl** instance. This API uses an asynchronous callback to retur | inStream | [EncodingBlob](#encodingblob) | Yes | Serialized certificate revocation list (CRL) data. | | callback | AsyncCallback\ | Yes | Callback invoked to return the result. Promise used to return the **X509Crl** instance created.| +**Error codes** + +| ID| Error Message | +| -------- | ------------- | +| 19020001 | Memory error. | **Example** @@ -1024,6 +1177,12 @@ Creates an **X509Crl** instance. This API uses a promise to return the result. | ----------------- | -------------------- | | Promise\ | Promise used to return the **X509Crl** instance created.| +**Error codes** + +| ID| Error Message | +| -------- | ------------- | +| 19020001 | Memory error. | + **Example** ```js @@ -1145,6 +1304,13 @@ Obtains the serialized X.509 CRL data. This API uses an asynchronous callback to | -------- | ---------------------------- | ---- | ------------------------------------------ | | callback | AsyncCallback\ | Yes | Callback invoked to return the serialized X.509 CRL data obtained.| +**Error codes** + +| ID| Error Message | +| -------- | ----------------------- | +| 19020001 | Memory error. | +| 19020002 | Runtime error. | +| 19030001 | Crypto operation error. | **Example** @@ -1188,6 +1354,14 @@ Obtains the serialized X.509 CRL data. This API uses a promise to return the res | ---------------------- | -------------------------------- | | Promise\ | Promise used to return the serialized X.509 CRL data obtained.| +**Error codes** + +| ID| Error Message | +| -------- | ----------------------- | +| 19020001 | Memory error. | +| 19020002 | Runtime error. | +| 19030001 | Crypto operation error. | + **Example** ```js @@ -1227,6 +1401,11 @@ Verifies the signature of the X.509 CRL. This API uses an asynchronous callback | key | cryptoFramework.PubKey | Yes | Public key used for signature verification. | | callback | AsyncCallback\ | Yes | Callback invoked to return the result. If **error** is **null**, the signature verification is successful. If **error** is not **null**, the signature verification fails.| +**Error codes** + +| ID| Error Message | +| -------- | ----------------------- | +| 19030001 | Crypto operation error. | **Example** @@ -1279,6 +1458,12 @@ Verifies the signature of the X.509 CRL. This API uses a promise to return the r | ---- | ------------------------------------------------------------ | | Promise\ | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | ----------------------- | +| 19030001 | Crypto operation error. | + **Example** ```js @@ -1356,6 +1541,14 @@ Obtains the issuer of the X.509 CRL. | --------------------- | ------------------------------ | | [DataBlob](#datablob) | Issuer of the X.509 CRL obtained.| +**Error codes** + +| ID| Error Message | +| -------- | ----------------------- | +| 19020001 | Memory error. | +| 19020002 | Runtime error. | +| 19030001 | Crypto operation error. | + **Example** ```js @@ -1392,6 +1585,14 @@ Obtains the date when the X.509 CRL was last updated. | ------ | ------------------------------------ | | string | Last update date of the X.509 CRL.| +**Error codes** + +| ID| Error Message | +| -------- | ----------------------- | +| 19020001 | Memory error. | +| 19020002 | Runtime error. | +| 19030001 | Crypto operation error. | + **Example** ```js @@ -1428,6 +1629,14 @@ Obtains the date when the CRL will be updated the next time. | ------ | ------------------------------------ | | string | Next update date obtained.| +**Error codes** + +| ID| Error Message | +| -------- | ----------------------- | +| 19020001 | Memory error. | +| 19020002 | Runtime error. | +| 19030001 | Crypto operation error. | + **Example** ```js @@ -1470,6 +1679,13 @@ Obtains the revoked X.509 certificate based on the specified serial number of th | ---------------------- | --------------------- | | X509CrlEntry | Promise used to return the revoked X.509 certificate obtained.| +**Error codes** + +| ID| Error Message | +| -------- | ----------------------- | +| 19020001 | Memory error. | +| 19030001 | Crypto operation error. | + **Example** ```js @@ -1518,6 +1734,13 @@ Obtains the revoked X.509 certificate based on the specified certificate. This A | ------------ | -------------------- | | X509CrlEntry | Promise used to return the revoked X.509 certificate obtained.| +**Error codes** + +| ID| Error Message | +| -------- | ----------------------- | +| 19020001 | Memory error. | +| 19030001 | Crypto operation error. | + **Example** ```js @@ -1560,6 +1783,12 @@ Obtains all the revoked X.509 certificates. This API uses an asynchronous callba | -------- | ----------------------------------- | ---- | -------------------------------- | | callback | AsyncCallback> | Yes | Callback invoked to return the result. Promise used to return a list of revoked X.509 certificates.| +**Error codes** + +| ID| Error Message | +| -------- | ----------------------- | +| 19020001 | Memory error. | +| 19030001 | Crypto operation error. | **Example** @@ -1603,6 +1832,13 @@ Obtains all the revoked X.509 certificates. This API uses a promise to return th | ----------------------------- | ---------------------- | | Promise> | Promise used to return a list of revoked X.509 certificates.| +**Error codes** + +| ID| Error Message | +| -------- | ----------------------- | +| 19020001 | Memory error. | +| 19030001 | Crypto operation error. | + **Example** ```js @@ -1641,6 +1877,14 @@ Obtains the DER-encoded CRL information, the **tbsCertList** from this CRL. This | --------------------- | ------------------------------- | | [DataBlob](#datablob) | Promise used to return the **tbsCertList** information obtained.| +**Error codes** + +| ID| Error Message | +| -------- | ----------------------- | +| 19020001 | Memory error. | +| 19020002 | Runtime error. | +| 19030001 | Crypto operation error. | + **Example** ```js @@ -1681,6 +1925,14 @@ Obtains the signature data of the X.509 CRL. | --------------------- | ------------------------------ | | [DataBlob](#datablob) | Signature data of the X.509 CRL obtained.| +**Error codes** + +| ID| Error Message | +| -------- | ----------------------- | +| 19020001 | Memory error. | +| 19020002 | Runtime error. | +| 19030001 | Crypto operation error. | + **Example** ```js @@ -1717,6 +1969,14 @@ Obtains the signing algorithm of the X.509 CRL. | ------ | -------------------------------- | | string | Signing algorithm obtained.| +**Error codes** + +| ID| Error Message | +| -------- | ----------------------- | +| 19020001 | Memory error. | +| 19020002 | Runtime error. | +| 19030001 | Crypto operation error. | + **Example** ```js @@ -1753,6 +2013,14 @@ Obtains the OID of the X.509 CRL signing algorithm. OIDs are allocated by the In | ------ | --------------------------------------------- | | string | OID of the X.509 CRL signing algorithm obtained.| +**Error codes** + +| ID| Error Message | +| -------- | ----------------------- | +| 19020001 | Memory error. | +| 19020002 | Runtime error. | +| 19030001 | Crypto operation error. | + **Example** ```js @@ -1789,6 +2057,14 @@ Obtains the parameters of the X.509 CRL signing algorithm. | --------------------- | ---------------------------------- | | [DataBlob](#datablob) | Algorithm parameters obtained.| +**Error codes** + +| ID| Error Message | +| -------- | ----------------------- | +| 19020001 | Memory error. | +| 19020002 | Runtime error. | +| 19030001 | Crypto operation error. | + **Example** ```js @@ -1831,6 +2107,14 @@ Creates a **CertChainValidator** object. | ------------------ | -------------------- | | CertChainValidator | **CertChainValidator** object created.| +**Error codes** + +| ID| Error Message | +| -------- | ----------------------- | +| 19020001 | Memory error. | +| 19020002 | Runtime error. | +| 19030001 | Crypto operation error. | + **Example** ```js @@ -1846,7 +2130,7 @@ Provides APIs for certificate chain validator operations. ### Attributes -**System capability**: SystemCapability.Security.CryptoFramework +**System capability**: SystemCapability.Security.Cert | Name | Type | Readable| Writable| Description | | ------- | ------ | ---- | ---- | -------------------------- | @@ -1869,6 +2153,19 @@ The certificate chain validator does not verify the certificate validity period | certChain | [CertChainData](#certchaindata) | Yes | Serialized X.509 certificate chain data. | | callback | AsyncCallback\ | Yes | Callback invoked to return the result. If **error** is **null**, the X.509 certificate chain is valid. If **error** is not **null**, the X.509 certificate chain is not valid.| +**Error codes** + +| ID| Error Message | +| -------- | ------------------------------------------------- | +| 19020001 | Memory error. | +| 19020002 | Runtime error. | +| 19030001 | Crypto operation error. | +| 19030002 | The certificate signature verification failed. | +| 19030003 | The certificate has not taken effect. | +| 19030004 | The certificate has expired. | +| 19030005 | Failed to obtain the certificate issuer. | +| 19030006 | The key cannot be used for signing a certificate. | +| 19030007 | The key cannot be used for digital signature. | **Example** @@ -1916,6 +2213,20 @@ The certificate chain validator does not verify the certificate validity period | -------------- | ----------- | | Promise\ | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| -------- | ------------------------------------------------- | +| 19020001 | Memory error. | +| 19020002 | Runtime error. | +| 19030001 | Crypto operation error. | +| 19030002 | The certificate signature verification failed. | +| 19030003 | The certificate has not taken effect. | +| 19030004 | The certificate has expired. | +| 19030005 | Failed to obtain the certificate issuer. | +| 19030006 | The key cannot be used for signing a certificate. | +| 19030007 | The key cannot be used for digital signature. | + **Example** ```js @@ -1980,6 +2291,13 @@ Obtains the serialized data of this revoked certificate. This API uses an asynch | -------- | --------------------------------------------- | ---- | ------------------------------------ | | callback | AsyncCallback\<[EncodingBlob](#encodingblob)> | Yes | Callback invoked to return the result. Promise used to return the serialized data of the revoked certificate obtained.| +**Error codes** + +| ID| Error Message | +| -------- | ----------------------- | +| 19020001 | Memory error. | +| 19020002 | Runtime error. | +| 19030001 | Crypto operation error. | **Example** @@ -2011,6 +2329,14 @@ Obtains the serialized data of this revoked certificate. This API uses a promise | --------------------------------------- | -------------------------- | | Promise\<[EncodingBlob](#encodingblob)> | Promise used to return the serialized data of the revoked certificate obtained.| +**Error codes** + +| ID| Error Message | +| -------- | ----------------------- | +| 19020001 | Memory error. | +| 19020002 | Runtime error. | +| 19030001 | Crypto operation error. | + **Example** ```js @@ -2063,6 +2389,13 @@ Obtains the issuer of this revoked certificate. This API uses an asynchronous ca | --------------------- | ----------------------- | | [DataBlob](#datablob) | Promise used to return the issuer of the revoked certificate obtained.| +**Error codes** + +| ID| Error Message | +| -------- | -------------- | +| 19020001 | Memory error. | +| 19020002 | Runtime error. | + **Example** ```js @@ -2091,6 +2424,14 @@ Obtains the date when the certificate was revoked. This API uses an asynchronous | ------ | ------------------ | | string | Promise used to return the certificate revocation date obtained.| +**Error codes** + +| ID| Error Message | +| -------- | ----------------------- | +| 19020001 | Memory error. | +| 19020002 | Runtime error. | +| 19030001 | Crypto operation error. | + **Example** ```js diff --git a/en/application-dev/reference/apis/js-apis-charger.md b/en/application-dev/reference/apis/js-apis-charger.md new file mode 100644 index 0000000000000000000000000000000000000000..0b4f5dba51054c51fd2c74cc1867413340b9a687 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-charger.md @@ -0,0 +1,30 @@ +# @ohos.charger (Charging Type) + +The **charger** module enumerates charging types. + +> **NOTE** +> +> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version. + + +## Modules to Import + +```js +import charger from '@ohos.charger'; +``` + +## ChargeType + +Enumerates charging types. + +**System capability**: SystemCapability.PowerManager.BatteryManager.Core + +| Name | Value | Description | +| -------- | ---- | ----------------- | +| NONE | 0 | Unknown charging type. | +| WIRED_NORMAL | 1 | Wired normal charging.| +| WIRED_QUICK | 2 | Wired fast charging. | +| WIRED_SUPER_QUICK | 3 | Wired super fast charging.| +| WIRELESS_NORMAL | 4 | Wireless normal charging.| +| WIRELESS_QUICK | 5 | Wireless fast charging.| +| WIRELESS_SUPER_QUICK | 6 | Wireless super fast charging.| diff --git a/en/application-dev/reference/apis/js-apis-commonEvent.md b/en/application-dev/reference/apis/js-apis-commonEvent.md index 613913c3635b0f4d4c235e02428faf9a18b9f4b0..1496c18abf062e412dcc36368d046992b7f95c69 100644 --- a/en/application-dev/reference/apis/js-apis-commonEvent.md +++ b/en/application-dev/reference/apis/js-apis-commonEvent.md @@ -67,7 +67,7 @@ Publishes a common event with given attributes. This API uses an asynchronous ca | Name | Type | Mandatory| Description | | -------- | ---------------------- | ---- | ---------------------- | | event | string | Yes | Name of the common event to publish. | -| options | [CommonEventPublishData](#commoneventpublishdata) | Yes | Attributes of the common event to publish.| +| options | [CommonEventPublishData](./js-apis-inner-commonEvent-commonEventPublishData.md) | Yes | Attributes of the common event to publish.| | callback | syncCallback\ | Yes | Callback used to return the result. | **Example** @@ -76,8 +76,8 @@ Publishes a common event with given attributes. This API uses an asynchronous ca ```ts // Attributes of a common event. let options = { - code: 0, // Initial code of the common event. - data: "initial data";// Initial data of the common event. + code: 0, // Result code of the common event. + data: "initial data";// Result data of the common event. isOrdered: true // The common event is an ordered one. } @@ -151,7 +151,7 @@ Publishes a common event with given attributes to a specific user. This API uses | -------- | ---------------------- | ---- | ---------------------- | | event | string | Yes | Name of the common event to publish. | | userId | number | Yes| User ID.| -| options | [CommonEventPublishData](#commoneventpublishdata) | Yes | Attributes of the common event to publish.| +| options | [CommonEventPublishData](./js-apis-inner-commonEvent-commonEventPublishData.md) | Yes | Attributes of the common event to publish.| | callback | AsyncCallback\ | Yes | Callback used to return the result. | **Example** @@ -194,8 +194,8 @@ Creates a subscriber. This API uses an asynchronous callback to return the resul | Name | Type | Mandatory| Description | | ------------- | ------------------------------------------------------------ | ---- | -------------------------- | -| subscribeInfo | [CommonEventSubscribeInfo](#commoneventsubscribeinfo) | Yes | Subscriber information. | -| callback | AsyncCallback\<[CommonEventSubscriber](#commoneventsubscriber)> | Yes | Callback used to return the result.| +| subscribeInfo | [CommonEventSubscribeInfo](./js-apis-inner-commonEvent-commonEventSubscribeInfo.md) | Yes | Subscriber information. | +| callback | AsyncCallback\<[CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md)> | Yes | Callback used to return the result.| **Example** @@ -236,12 +236,12 @@ Creates a subscriber. This API uses a promise to return the result. | Name | Type | Mandatory| Description | | ------------- | ----------------------------------------------------- | ---- | -------------- | -| subscribeInfo | [CommonEventSubscribeInfo](#commoneventsubscribeinfo) | Yes | Subscriber information.| +| subscribeInfo | [CommonEventSubscribeInfo](./js-apis-inner-commonEvent-commonEventSubscribeInfo.md) | Yes | Subscriber information.| **Return value** | Type | Description | | --------------------------------------------------------- | ---------------- | -| Promise\<[CommonEventSubscriber](#commoneventsubscriber)> | Promise used to return the subscriber object.| +| Promise\<[CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md)> | Promise used to return the subscriber object.| **Example** @@ -276,8 +276,8 @@ Subscribes to common events. This API uses an asynchronous callback to return th | Name | Type | Mandatory| Description | | ---------- | ---------------------------------------------------- | ---- | -------------------------------- | -| subscriber | [CommonEventSubscriber](#commoneventsubscriber) | Yes | Subscriber object. | -| callback | AsyncCallback\<[CommonEventData](#commoneventdata)> | Yes | Callback used to return the result.| +| subscriber | [CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md) | Yes | Subscriber object. | +| callback | AsyncCallback\<[CommonEventData](./js-apis-inner-commonEvent-commonEventData.md)> | Yes | Callback used to return the result.| **Example** @@ -299,11 +299,12 @@ function subscribeCB(err, data) { } // Callback for subscriber creation. -function createCB(err, subscriber) { +function createCB(err, commonEventSubscriber) { if (err.code) { console.error(`createSubscriber failed, code is ${err.code}`); } else { console.info("createSubscriber"); + subscriber = commonEventSubscriber; // Subscribe to a common event. CommonEvent.subscribe(subscriber, subscribeCB); } @@ -327,7 +328,7 @@ Unsubscribes from common events. This API uses an asynchronous callback to retur | Name | Type | Mandatory| Description | | ---------- | ----------------------------------------------- | ---- | ------------------------ | -| subscriber | [CommonEventSubscriber](#commoneventsubscriber) | Yes | Subscriber object. | +| subscriber | [CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md) | Yes | Subscriber object. | | callback | AsyncCallback\ | No | Callback used to return the result.| **Example** @@ -376,800 +377,3 @@ CommonEvent.createSubscriber(subscribeInfo, createCB); // Unsubscribe from the common event. CommonEvent.unsubscribe(subscriber, unsubscribeCB); ``` - -## CommonEventSubscriber - -### getCode - -```ts -getCode(callback: AsyncCallback): void -``` - -Obtains the code of this common event. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ---------------------- | ---- | ------------------ | -| callback | AsyncCallback\ | Yes | Common event code.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -// Callback for result code obtaining of an ordered common event. -function getCodeCB(err, Code) { - if (err.code) { - console.error(`getCode failed, code is ${err.code}`); - } else { - console.info("getCode " + JSON.stringify(Code)); - } -} -subscriber.getCode(getCodeCB); -``` - -### getCode - -```ts -getCode(): Promise -``` - -Obtains the code of this common event. This API uses a promise to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Return value** - -| Type | Description | -| ---------------- | -------------------- | -| Promise\ | Common event code.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -subscriber.getCode().then((code) => { - console.info("getCode " + JSON.stringify(code)); -}).catch((err) => { - console.error(`getCode failed, code is ${err.code}`); -}); -``` - -### setCode - -```ts -setCode(code: number, callback: AsyncCallback): void -``` - -Sets the code for this common event. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | -------------------- | ---- | ---------------------- | -| code | number | Yes | Common event code. | -| callback | AsyncCallback\ | Yes | Callback used to return the result.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -// Callback for result code setting of an ordered common event. -function setCodeCB(err) { - if (err.code) { - console.error(`setCode failed, code is ${err.code}`); - } else { - console.info("setCode"); - } -} -subscriber.setCode(1, setCodeCB); -``` - -### setCode - -```ts -setCode(code: number): Promise -``` - -Sets the code for this common event. This API uses a promise to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------ | -| code | number | Yes | Common event code.| - -**Return value** - -| Type | Description | -| ---------------- | -------------------- | -| Promise\ | Promise used to return the result.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -subscriber.setCode(1).then(() => { - console.info("setCode"); -}).catch((err) => { - console.error(`setCode failed, code is ${err.code}`); -}); -``` - -### getData - -```ts -getData(callback: AsyncCallback): void -``` - -Obtains the data of this common event. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ---------------------- | ---- | -------------------- | -| callback | AsyncCallback\ | Yes | Common event data.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -// Callback for result data obtaining of an ordered common event. -function getDataCB(err, data) { - if (err.code) { - console.error(`getData failed, code is ${err.code}`); - } else { - console.info("getData " + JSON.stringify(data)); - } -} - -subscriber.getData(getDataCB); -``` - -### getData - -```ts -getData(): Promise -``` - -Obtains the data of this common event. This API uses a promise to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Return value** - -| Type | Description | -| ---------------- | ------------------ | -| Promise\ | Common event data.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -subscriber.getData().then((data) => { - console.info("getData " + JSON.stringify(data)); -}).catch((err) => { - console.error(`getData failed, code is ${err.code}`); -}); -``` - -### setData - -```ts -setData(data: string, callback: AsyncCallback): void -``` - -Sets the data for this common event. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | -------------------- | ---- | -------------------- | -| data | string | Yes | Common event data. | -| callback | AsyncCallback\ | Yes | Callback used to return the result.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -// Callback for result data setting of an ordered common event -function setDataCB(err) { - if (err.code) { - console.error(`sendData failed, code is ${err.code}`); - } else { - console.info("setData"); - } -} -subscriber.setData("publish_data_changed", setDataCB); -``` - -### setData - -```ts -setData(data: string): Promise -``` - -Sets the data for this common event. This API uses a promise to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | -------------------- | -| data | string | Yes | Common event data.| - -**Return value** - -| Type | Description | -| ---------------- | -------------------- | -| Promise\ | Promise used to return the result.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -subscriber.setData("publish_data_changed").then(() => { - console.info("setData"); -}).catch((err) => { - console.error(`setData failed, code is ${err.code}`); -}); -``` - -### setCodeAndData - -```ts -setCodeAndData(code: number, data: string, callback:AsyncCallback): void -``` - -Sets the code and data for this common event. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | -------------------- | ---- | ---------------------- | -| code | number | Yes | Common event code. | -| data | string | Yes | Common event data. | -| callback | AsyncCallback\ | Yes | Callback used to return the result.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -// Callback for result code and result data setting of an ordered common event. -function setCodeDataCB(err) { - if (err.code) { - console.error(`setCodeAndData failed, code is ${err.code}`); - } else { - console.info("setCodeDataCallback"); - } -} - -subscriber.setCodeAndData(1, "publish_data_changed", setCodeDataCB); -``` - -### setCodeAndData - -```ts -setCodeAndData(code: number, data: string): Promise -``` - -Sets the code and data for this common event. This API uses a promise to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | -------------------- | -| code | number | Yes | Common event code.| -| data | string | Yes | Common event data.| - -**Return value** - -| Type | Description | -| ---------------- | -------------------- | -| Promise\ | Promise used to return the result.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -subscriber.setCodeAndData(1, "publish_data_changed").then(() => { - console.info("setCodeAndData"); -}).catch((err) => { - console.error(`setCodeAndData failed, code is ${err.code}`); -}); -``` - -### isOrderedCommonEvent - -```ts -isOrderedCommonEvent(callback: AsyncCallback): void -``` - -Checks whether this common event is an ordered one. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ----------------------- | ---- | ---------------------------------- | -| callback | AsyncCallback\ | Yes | Returns **true** if the common event is an ordered one; returns **false** otherwise.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -// Callback for checking whether the current common event is an ordered one. -function isOrderedCB(err, isOrdered) { - if (err.code) { - console.error(`isOrderedCommonEvent failed, code is ${err.code}`); - } else { - console.info("isOrdered " + JSON.stringify(isOrdered)); - } -} -subscriber.isOrderedCommonEvent(isOrderedCB); -``` - -### isOrderedCommonEvent - -```ts -isOrderedCommonEvent(): Promise -``` - -Checks whether this common event is an ordered one. This API uses a promise to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Return value** - -| Type | Description | -| ----------------- | -------------------------------- | -| Promise\ | Returns **true** if the common event is an ordered one; returns **false** otherwise.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -subscriber.isOrderedCommonEvent().then((isOrdered) => { - console.info("isOrdered " + JSON.stringify(isOrdered)); -}).catch((err) => { - console.error(`isOrderedCommonEvent failed, code is ${err.code}`); -}); -``` - -### isStickyCommonEvent - -```ts -isStickyCommonEvent(callback: AsyncCallback): void -``` - -Checks whether this common event is a sticky one. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ----------------------- | ---- | ---------------------------------- | -| callback | AsyncCallback\ | Yes | Returns **true** if the common event is a sticky one; returns **false** otherwise.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -// Callback for checking whether the current common event is a sticky one. -function isStickyCB(err, isSticky) { - if (err.code) { - console.error(`isStickyCommonEvent failed, code is ${err.code}`); - } else { - console.info("isSticky " + JSON.stringify(isSticky)); - } -} -subscriber.isStickyCommonEvent(isStickyCB); -``` - -### isStickyCommonEvent - -```ts -isStickyCommonEvent(): Promise -``` - -Checks whether this common event is a sticky one. This API uses a promise to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Return value** - -| Type | Description | -| ----------------- | -------------------------------- | -| Promise\ | Returns **true** if the common event is a sticky one; returns **false** otherwise.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -subscriber.isStickyCommonEvent().then((isSticky) => { - console.info("isSticky " + JSON.stringify(isSticky)); -}).catch((err) => { - console.error(`isSticky failed, code is ${err.code}`); -}); -``` - -### abortCommonEvent - -```ts -abortCommonEvent(callback: AsyncCallback): void -``` - -Aborts this common event. After the abort, the common event is not sent to the next subscriber. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | -------------------- | ---- | -------------------- | -| callback | AsyncCallback\ | Yes | Callback used to return the result.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -// Callback for common event aborting. -function abortCB(err) { - if (err.code) { - console.error(`abortCommonEvent failed, code is ${err.code}`); - } else { - console.info("abortCommonEvent"); - } -} - -subscriber.abortCommonEvent(abortCB); -``` - -### abortCommonEvent - -```ts -abortCommonEvent(): Promise -``` - -Aborts this common event. After the abort, the common event is not sent to the next subscriber. This API takes effect only for ordered common events. It uses a promise to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Return value** - -| Type | Description | -| ---------------- | -------------------- | -| Promise\ | Promise used to return the result.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -subscriber.abortCommonEvent().then(() => { - console.info("abortCommonEvent"); -}).catch((err) => { - console.error(`abortCommonEvent failed, code is ${err.code}`); -}); -``` - -### clearAbortCommonEvent - -```ts -clearAbortCommonEvent(callback: AsyncCallback): void -``` - -Clears the aborted state of this common event. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | -------------------- | ---- | -------------------- | -| callback | AsyncCallback\ | Yes | Callback used to return the result.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -// Callback for clearing the aborted state of the current common event. -function clearAbortCB(err) { - if (err.code) { - console.error(`clearAbortCommonEvent failed, code is ${err.code}`); - } else { - console.info("clearAbortCommonEvent"); - } -} - -subscriber.clearAbortCommonEvent(clearAbortCB); -``` - -### clearAbortCommonEvent - -```ts -clearAbortCommonEvent(): Promise -``` - -Clears the aborted state of this common event. This API takes effect only for ordered common events. It uses a promise to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Return value** - -| Type | Description | -| ---------------- | -------------------- | -| Promise\ | Promise used to return the result.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -subscriber.clearAbortCommonEvent().then(() => { - console.info("clearAbortCommonEvent"); -}).catch((err) => { - console.error(`clearAbortCommonEvent failed, code is ${err.code}`); -}); -``` - -### getAbortCommonEvent - -```ts -getAbortCommonEvent(callback: AsyncCallback): void -``` - -Checks whether this common event is in the aborted state. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ----------------------- | ---- | ---------------------------------- | -| callback | AsyncCallback\ | Yes | Returns **true** if the ordered common event is in the aborted state; returns **false** otherwise.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -// Callback for checking whether the current common event is in the aborted state. -function getAbortCB(err, abortEvent) { - if (err.code) { - console.error(`getAbortCommonEvent failed, code is ${err.code}`); - } else { - console.info("abortEvent " + abortEvent) - } -} - -subscriber.getAbortCommonEvent(getAbortCB); -``` - -### getAbortCommonEvent - -```ts -getAbortCommonEvent(): Promise -``` - -Checks whether this common event is in the aborted state. This API takes effect only for ordered common events. It uses a promise to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Return value** - -| Type | Description | -| ----------------- | ---------------------------------- | -| Promise\ | Returns **true** if the ordered common event is in the aborted state; returns **false** otherwise.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -subscriber.getAbortCommonEvent().then((abortCommonEvent) => { - console.info("abortCommonEvent " + JSON.stringify(abortCommonEvent)); -}).catch((err) => { - console.error(`getAbortCommonEvent failed, code is ${err.code}`); -}); -``` - -### getSubscribeInfo - -```ts -getSubscribeInfo(callback: AsyncCallback): void -``` - -Obtains the subscriber information. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ------------------------------------------------------------ | ---- | ---------------------- | -| callback | AsyncCallback\<[CommonEventSubscribeInfo](#commoneventsubscribeinfo)> | Yes | Promise used to return the subscriber information.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -// Callback for subscriber information obtaining. -function getCB(err, subscribeInfo) { - if (err.code) { - console.error(`getSubscribeInfo failed, code is ${err.code}`); - } else { - console.info("SubscribeInfo " + JSON.stringify(subscribeInfo)); - } -} - -subscriber.getSubscribeInfo(getCB); -``` - -### getSubscribeInfo - -```ts -getSubscribeInfo(): Promise -``` - -Obtains the subscriber information. This API uses a promise to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Return value** - -| Type | Description | -| ------------------------------------------------------------ | ---------------------- | -| Promise\<[CommonEventSubscribeInfo](#commoneventsubscribeinfo)> | Promise used to return the subscriber information.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -subscriber.getSubscribeInfo().then((subscribeInfo) => { - console.info("subscribeInfo " + JSON.stringify(subscribeInfo)); -}).catch((err) => { - console.error(`getSubscribeInfo failed, code is ${err.code}`); -}); -``` - -### finishCommonEvent9+ - -```ts -finishCommonEvent(callback: AsyncCallback): void -``` - -Finishes this common event. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | -------------------- | ---- | -------------------------------- | -| callback | AsyncCallback\ | Yes | Callback returned after the ordered common event is finished.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -// Callback for ordered common event finishing. -function finishCB(err) { - if (err.code) { - console.error(`finishCommonEvent failed, code is ${err.code}`); - } else { - console.info("FinishCommonEvent"); - } -} - -subscriber.finishCommonEvent(finishCB); -``` - -### finishCommonEvent9+ - -```ts -finishCommonEvent(): Promise -``` - -Finishes this common event. This API takes effect only for ordered common events. It uses a promise to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Return value** - -| Type | Description | -| ---------------- | -------------------- | -| Promise\ | Promise used to return the result.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -subscriber.finishCommonEvent().then(() => { - console.info("FinishCommonEvent"); -}).catch((err) => { - console.error(`finishCommonEvent failed, code is ${err.code}`); -}); -``` - -## CommonEventData - -Describes the common event data body. - -**System capability**: SystemCapability.Notification.CommonEvent - -| Name | Type | Readable| Writable| Description | -| ---------- |-------------------- | ---- | ---- | ------------------------------------------------------- | -| event | string | Yes | No | Name of the common event that is being received. | -| bundleName | string | Yes | No | Bundle name. | -| code | number | Yes | No | Result code of the common event, which is used to transfer data of the int type. | -| data | string | Yes | No | Custom result data of the common event, which is used to transfer data of the string type.| -| parameters | {[key: string]: any} | Yes | No | Additional information about the common event. | - - -## CommonEventPublishData - -Describes the data body published by a common event, including the common event content and attributes. - -**System capability**: SystemCapability.Notification.CommonEvent - -| Name | Type | Readable| Writable| Description | -| --------------------- | -------------------- | ---- | ---- | ---------------------------- | -| bundleName | string | Yes | No | Bundle name. | -| code | number | Yes | No | Result code of the common event. | -| data | string | Yes | No | Custom result data of the common event.| -| subscriberPermissions | Array\ | Yes | No | Permissions required for subscribers to receive the common event. | -| isOrdered | boolean | Yes | No | Whether the common event is an ordered one. | -| isSticky | boolean | Yes | No | Whether the common event is a sticky one. Only system applications and system services are allowed to send sticky events.| -| parameters | {[key: string]: any} | Yes | No | Additional information about the common event. | - -## CommonEventSubscribeInfo - -Provides the subscriber information. - -**System capability**: SystemCapability.Notification.CommonEvent - -| Name | Type | Readable| Writable| Description | -| ------------------- | -------------- | ---- | ---- | ------------------------------------------------------------ | -| events | Array\ | Yes | No | Name of the common event to publish. | -| publisherPermission | string | Yes | No | Permissions required for publishers to publish the common event. | -| publisherDeviceId | string | Yes | No | Device ID. The value must be the ID of an existing device on the same network. | -| userId | number | Yes | No | User ID. The default value is the ID of the current user. If this parameter is specified, the value must be an existing user ID in the system.| -| priority | number | Yes | No | Subscriber priority. The value ranges from -100 to +1000. | diff --git a/en/application-dev/reference/apis/js-apis-commonEventManager.md b/en/application-dev/reference/apis/js-apis-commonEventManager.md index bdcc1af2a479d300303a8d9f851f07c81c3e7d5a..c94524533f8795ee22ebb328ce7ecd1f2ce1ad2c 100644 --- a/en/application-dev/reference/apis/js-apis-commonEventManager.md +++ b/en/application-dev/reference/apis/js-apis-commonEventManager.md @@ -74,7 +74,7 @@ Publishes a common event with given attributes. This API uses an asynchronous ca | Name | Type | Mandatory| Description | | -------- | ---------------------- | ---- | ---------------------- | | event | string | Yes | Name of the common event to publish. | -| options | [CommonEventPublishData](#commoneventpublishdata) | Yes | Attributes of the common event to publish.| +| options | [CommonEventPublishData](./js-apis-inner-commonEvent-commonEventPublishData.md) | Yes | Attributes of the common event to publish.| | callback | syncCallback\ | Yes | Callback used to return the result. | **Error codes** @@ -86,8 +86,8 @@ For details about the error codes, see [Event Error Codes](../errorcodes/errorco ```ts // Attributes of a common event. let options = { - code: 0, // Initial code of the common event. - data: "initial data";// Initial data of the common event. + code: 0, // Result code of the common event. + data: "initial data",// Result data of the common event. isOrdered: true // The common event is an ordered one. } @@ -173,7 +173,7 @@ Publishes a common event with given attributes to a specific user. This API uses | -------- | ---------------------- | ---- | ---------------------- | | event | string | Yes | Name of the common event to publish. | | userId | number | Yes| User ID.| -| options | [CommonEventPublishData](#commoneventpublishdata) | Yes | Attributes of the common event to publish.| +| options | [CommonEventPublishData](./js-apis-inner-commonEvent-commonEventPublishData.md) | Yes | Attributes of the common event to publish.| | callback | AsyncCallback\ | Yes | Callback used to return the result. | **Error codes** @@ -186,8 +186,8 @@ For details about the error codes, see [Event Error Codes](../errorcodes/errorco ```ts // Attributes of a common event. let options = { - code: 0, // Initial code of the common event. - data: "initial data";// Initial data of the common event. + code: 0, // Result code of the common event. + data: "initial data",// Result data of the common event. } // Callback for common event publication. @@ -224,8 +224,8 @@ Creates a subscriber. This API uses an asynchronous callback to return the resul | Name | Type | Mandatory| Description | | ------------- | ------------------------------------------------------------ | ---- | -------------------------- | -| subscribeInfo | [CommonEventSubscribeInfo](#commoneventsubscribeinfo) | Yes | Subscriber information. | -| callback | AsyncCallback\<[CommonEventSubscriber](#commoneventsubscriber)> | Yes | Callback used to return the result.| +| subscribeInfo | [CommonEventSubscribeInfo](./js-apis-inner-commonEvent-commonEventSubscribeInfo.md) | Yes | Subscriber information. | +| callback | AsyncCallback\<[CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md)> | Yes | Callback used to return the result.| **Example** @@ -270,12 +270,12 @@ Creates a subscriber. This API uses a promise to return the result. | Name | Type | Mandatory| Description | | ------------- | ----------------------------------------------------- | ---- | -------------- | -| subscribeInfo | [CommonEventSubscribeInfo](#commoneventsubscribeinfo) | Yes | Subscriber information.| +| subscribeInfo | [CommonEventSubscribeInfo](./js-apis-inner-commonEvent-commonEventSubscribeInfo.md) | Yes | Subscriber information.| **Return value** | Type | Description | | --------------------------------------------------------- | ---------------- | -| Promise\<[CommonEventSubscriber](#commoneventsubscriber)> | Promise used to return the subscriber object.| +| Promise\<[CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md)> | Promise used to return the subscriber object.| **Example** @@ -311,8 +311,8 @@ Subscribes to common events. This API uses an asynchronous callback to return th | Name | Type | Mandatory| Description | | ---------- | ---------------------------------------------------- | ---- | -------------------------------- | -| subscriber | [CommonEventSubscriber](#commoneventsubscriber) | Yes | Subscriber object. | -| callback | AsyncCallback\<[CommonEventData](#commoneventdata)> | Yes | Callback used to return the result.| +| subscriber | [CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md) | Yes | Subscriber object. | +| callback | AsyncCallback\<[CommonEventData](./js-apis-inner-commonEvent-commonEventData.md)> | Yes | Callback used to return the result.| **Example** @@ -327,7 +327,7 @@ let subscribeInfo = { // Callback for common event subscription. function SubscribeCB(err, data) { - if (err.code) { + if (err) { console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`); } else { console.info("subscribe "); @@ -335,9 +335,10 @@ function SubscribeCB(err, data) { } // Callback for subscriber creation. -function createCB(err, subscriber) { +function createCB(err, commonEventSubscriber) { if(!err) { console.info("createSubscriber"); + subscriber = commonEventSubscriber; // Subscribe to a common event. try { CommonEventManager.subscribe(subscriber, SubscribeCB); @@ -371,7 +372,7 @@ Unsubscribes from common events. This API uses an asynchronous callback to retur | Name | Type | Mandatory| Description | | ---------- | ----------------------------------------------- | ---- | ------------------------ | -| subscriber | [CommonEventSubscriber](#commoneventsubscriber) | Yes | Subscriber object. | +| subscriber | [CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md) | Yes | Subscriber object. | | callback | AsyncCallback\ | No | Callback used to return the result.| **Example** @@ -391,11 +392,12 @@ function subscribeCB(err, data) { } } // Callback for subscriber creation. -function createCB(err, subscriber) { +function createCB(err, commonEventSubscriber) { if (err) { console.error(`createSubscriber failed, code is ${err.code}, message is ${err.message}`); } else { console.info("createSubscriber"); + subscriber = commonEventSubscriber; // Subscribe to a common event. try { CommonEventManager.subscribe(subscriber, subscribeCB); @@ -426,785 +428,3 @@ try { console.error(`unsubscribe failed, code is ${err.code}, message is ${err.message}`); } ``` - -## CommonEventSubscriber - -### getCode - -```ts -getCode(callback: AsyncCallback): void -``` - -Obtains the code of this common event. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ---------------------- | ---- | ------------------ | -| callback | AsyncCallback\ | Yes | Common event code.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -// Callback for code obtaining of an ordered common event. -function getCodeCB(err, code) { - if (err.code) { - console.error(`getCode failed, code is ${err.code}, message is ${err.message}`); - } else { - console.info("getCode " + JSON.stringify(code)); - } -} -subscriber.getCode(getCodeCB); -``` - -### getCode - -```ts -getCode(): Promise -``` - -Obtains the code of this common event. This API uses a promise to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Return value** - -| Type | Description | -| ---------------- | -------------------- | -| Promise\ | Common event code.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -subscriber.getCode().then((code) => { - console.info("getCode " + JSON.stringify(code)); -}).catch((err) => { - console.error(`getCode failed, code is ${err.code}, message is ${err.message}`); -}); -``` - -### setCode - -```ts -setCode(code: number, callback: AsyncCallback): void -``` - -Sets the code for this common event. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | -------------------- | ---- | ---------------------- | -| code | number | Yes | Common event code. | -| callback | AsyncCallback\ | Yes | Callback used to return the result.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -// Callback for code setting of an ordered common event. -function setCodeCB(err) { - if (err.code) { - console.error(`setCode failed, code is ${err.code}, message is ${err.message}`); - } else { - console.info("setCode"); - } -} -subscriber.setCode(1, setCodeCB); -``` - -### setCode - -```ts -setCode(code: number): Promise -``` - -Sets the code for this common event. This API uses a promise to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------ | -| code | number | Yes | Common event code.| - -**Return value** - -| Type | Description | -| ---------------- | -------------------- | -| Promise\ | Promise used to return the result.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -subscriber.setCode(1).then(() => { - console.info("setCode"); -}).catch((err) => { - console.error(`setCode failed, code is ${err.code}, message is ${err.message}`); -}); -``` - -### getData - -```ts -getData(callback: AsyncCallback): void -``` - -Obtains the data of this common event. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ---------------------- | ---- | -------------------- | -| callback | AsyncCallback\ | Yes | Common event data.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -// Callback for data obtaining of an ordered common event. -function getDataCB(err, data) { - if (err.code) { - console.error(`getData failed, code is ${err.code}, message is ${err.message}`); - } else { - console.info("getData " + JSON.stringify(data)); - } -} -subscriber.getData(getDataCB); -``` - -### getData - -```ts -getData(): Promise -``` - -Obtains the data of this common event. This API uses a promise to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Return value** - -| Type | Description | -| ---------------- | ------------------ | -| Promise\ | Common event data.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -subscriber.getData().then((data) => { - console.info("getData " + JSON.stringify(data)); -}).catch((err) => { - console.error(`getData failed, code is ${err.code}, message is ${err.message}`); -}); -``` - -### setData - -setData(data: string, callback: AsyncCallback\): void - -Sets the data for this common event. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | -------------------- | ---- | -------------------- | -| data | string | Yes | Common event data. | -| callback | AsyncCallback\ | Yes | Callback used to return the result.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -// Callback for result data setting of an ordered common event -function setDataCB(err) { - if (err.code) { - console.error(`setCode failed, code is ${err.code}, message is ${err.message}`); - } else { - console.info("setData"); - } -} -subscriber.setData("publish_data_changed", setDataCB); -``` - -### setData - -```ts -setData(data: string): Promise -``` - -Sets the data for this common event. This API uses a promise to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | -------------------- | -| data | string | Yes | Common event data.| - -**Return value** - -| Type | Description | -| ---------------- | -------------------- | -| Promise\ | Promise used to return the result.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -subscriber.setData("publish_data_changed").then(() => { - console.info("setData"); -}).catch((err) => { - console.error(`setCode failed, code is ${err.code}, message is ${err.message}`); -}); -``` - -### setCodeAndData - -```ts -setCodeAndData(code: number, data: string, callback:AsyncCallback): void -``` - -Sets the code and data for this common event. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | -------------------- | ---- | ---------------------- | -| code | number | Yes | Common event code. | -| data | string | Yes | Common event data. | -| callback | AsyncCallback\ | Yes | Callback used to return the result.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -// Callback for code and data setting of an ordered common event. -function setCodeDataCB(err) { - if (err.code) { - console.error(`setCodeAndData failed, code is ${err.code}, message is ${err.message}`); - } else { - console.info("setCodeDataCallback"); - } -} -subscriber.setCodeAndData(1, "publish_data_changed", setCodeDataCB); -``` - -### setCodeAndData - -```ts -setCodeAndData(code: number, data: string): Promise -``` - -Sets the code and data for this common event. This API uses a promise to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | -------------------- | -| code | number | Yes | Common event code.| -| data | string | Yes | Common event data.| - -**Return value** - -| Type | Description | -| ---------------- | -------------------- | -| Promise\ | Promise used to return the result.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -subscriber.setCodeAndData(1, "publish_data_changed").then(() => { - console.info("setCodeAndData"); -}).catch((err) => { - console.error(`setCodeAndData failed, code is ${err.code}, message is ${err.message}`); -}); -``` - -### isOrderedCommonEvent - -```ts -isOrderedCommonEvent(callback: AsyncCallback): void -``` - -Checks whether this common event is an ordered one. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ----------------------- | ---- | ---------------------------------- | -| callback | AsyncCallback\ | Yes | Callback used to return the result. The value **true** means that the common event is an ordered one; and **false** means the opposite.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -// Callback for checking whether the current common event is an ordered one. -function isOrderedCB(err, isOrdered) { - if (err.code) { - console.error(`isOrderedCommonEvent failed, code is ${err.code}, message is ${err.message}`); - } else { - console.info("isOrdered " + JSON.stringify(isOrdered)); - } -} -subscriber.isOrderedCommonEvent(isOrderedCB); -``` - -### isOrderedCommonEvent - -```ts -isOrderedCommonEvent(): Promise -``` - -Checks whether this common event is an ordered one. This API uses a promise to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Return value** - -| Type | Description | -| ----------------- | -------------------------------- | -| Promise\ | Promise used to return the result. The value **true** means that the common event is an ordered one; and **false** means the opposite.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -subscriber.isOrderedCommonEvent().then((isOrdered) => { - console.info("isOrdered " + JSON.stringify(isOrdered)); -}).catch((err) => { - console.error(`isOrdered failed, code is ${err.code}, message is ${err.message}`); -}); -``` - -### isStickyCommonEvent - -```ts -isStickyCommonEvent(callback: AsyncCallback): void -``` - -Checks whether this common event is a sticky one. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ----------------------- | ---- | ---------------------------------- | -| callback | AsyncCallback\ | Yes | Callback used to return the result. The value **true** means that the common event is a sticky one; and **false** means the opposite.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -// Callback for checking whether the current common event is a sticky one. -function isStickyCB(err, isSticky) { - if (err.code) { - console.error(`isStickyCommonEvent failed, code is ${err.code}, message is ${err.message}`); - } else { - console.info("isSticky " + JSON.stringify(isSticky)); - } -} -subscriber.isStickyCommonEvent(isStickyCB); -``` - -### isStickyCommonEvent - -```ts -isStickyCommonEvent(): Promise -``` - -Checks whether this common event is a sticky one. This API uses a promise to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Return value** - -| Type | Description | -| ----------------- | -------------------------------- | -| Promise\ | Promise used to return the result. The value **true** means that the common event is a sticky one; and **false** means the opposite.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -subscriber.isStickyCommonEvent().then((isSticky) => { - console.info("isSticky " + JSON.stringify(isSticky)); -}).catch((err) => { - console.error(`isSticky failed, code is ${err.code}, message is ${err.message}`); -}); -``` - -### abortCommonEvent - -```ts -abortCommonEvent(callback: AsyncCallback): void -``` - -Aborts this common event. After the abort, the common event is not sent to the next subscriber. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | -------------------- | ---- | -------------------- | -| callback | AsyncCallback\ | Yes | Callback used to return the result.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -// Callback for common event aborting. -function abortCB(err) { - if (err.code) { - console.error(`abortCommonEvent failed, code is ${err.code}, message is ${err.message}`); - } else { - console.info("abortCommonEvent"); - } -} -subscriber.abortCommonEvent(abortCB); -``` - -### abortCommonEvent - -```ts -abortCommonEvent(): Promise -``` - -Aborts this common event. After the abort, the common event is not sent to the next subscriber. This API takes effect only for ordered common events. It uses a promise to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Return value** - -| Type | Description | -| ---------------- | -------------------- | -| Promise\ | Promise used to return the result.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -subscriber.abortCommonEvent().then(() => { - console.info("abortCommonEvent"); -}).catch((err) => { - console.error(`abortCommonEvent failed, code is ${err.code}, message is ${err.message}`); -}); -``` - -### clearAbortCommonEvent - -```ts -clearAbortCommonEvent(callback: AsyncCallback): void -``` - -Clears the aborted state of this common event. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | -------------------- | ---- | -------------------- | -| callback | AsyncCallback\ | Yes | Callback used to return the result.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -// Callback for clearing the aborted state of the current common event. -function clearAbortCB(err) { - if (err.code) { - console.error(`clearAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`); - } else { - console.info("clearAbortCommonEvent"); - } -} -subscriber.clearAbortCommonEvent(clearAbortCB); -``` - -### clearAbortCommonEvent - -```ts -clearAbortCommonEvent(): Promise -``` - -Clears the aborted state of this common event. This API takes effect only for ordered common events. It uses a promise to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Return value** - -| Type | Description | -| ---------------- | -------------------- | -| Promise\ | Promise used to return the result.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -subscriber.clearAbortCommonEvent().then(() => { - console.info("clearAbortCommonEvent"); -}).catch((err) => { - console.error(`clearAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`); -}); -``` - -### getAbortCommonEvent - -```ts -getAbortCommonEvent(callback: AsyncCallback): void -``` - -Checks whether this common event is in the aborted state. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ----------------------- | ---- | ---------------------------------- | -| callback | AsyncCallback\ | Yes | Callback used to return the result. The value **true** means that the ordered common event is in the aborted state; and **false** means the opposite.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -// Callback for checking whether the current common event is in the aborted state. -function getAbortCB(err, abortEvent) { - if (err.code) { - console.error(`getAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`); - } else { - console.info("abortCommonEvent " + abortEvent) - } -} -subscriber.getAbortCommonEvent(getAbortCB); -``` - -### getAbortCommonEvent - -```ts -getAbortCommonEvent(): Promise -``` - -Checks whether this common event is in the aborted state. This API takes effect only for ordered common events. It uses a promise to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Return value** - -| Type | Description | -| ----------------- | ---------------------------------- | -| Promise\ | Promise used to return the result. The value **true** means that the ordered common event is in the aborted state; and **false** means the opposite.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -subscriber.getAbortCommonEvent().then((abortEvent) => { - console.info("abortCommonEvent " + JSON.stringify(abortEvent)); -}).catch((err) => { - console.error(`getAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`); -}); -``` - -### getSubscribeInfo - -```ts -getSubscribeInfo(callback: AsyncCallback): void -``` - -Obtains the subscriber information. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ------------------------------------------------------------ | ---- | ---------------------- | -| callback | AsyncCallback\<[CommonEventSubscribeInfo](#commoneventsubscribeinfo)> | Yes | Callback used to return the subscriber information.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -// Callback for subscriber information obtaining. -function getCB(err, subscribeInfo) { - if (err.code) { - console.error(`getSubscribeInfo failed, code is ${err.code}, message is ${err.message}`); - } else { - console.info("subscribeInfo " + JSON.stringify(subscribeInfo)); - } -} -subscriber.getSubscribeInfo(getCB); -``` - -### getSubscribeInfo - -```ts -getSubscribeInfo(): Promise -``` - -Obtains the subscriber information. This API uses a promise to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Return value** - -| Type | Description | -| ------------------------------------------------------------ | ---------------------- | -| Promise\<[CommonEventSubscribeInfo](#commoneventsubscribeinfo)> | Promise used to return the subscriber information.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -subscriber.getSubscribeInfo().then((subscribeInfo) => { - console.info("subscribeInfo " + JSON.stringify(subscribeInfo)); -}).catch((err) => { - console.error(`getSubscribeInfo failed, code is ${err.code}, message is ${err.message}`); -}); -``` - -### finishCommonEvent9+ - -```ts -finishCommonEvent(callback: AsyncCallback): void -``` - -Finishes this common event. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | -------------------- | ---- | -------------------------------- | -| callback | AsyncCallback\ | Yes | Callback returned after the ordered common event is finished.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -// Callback for ordered common event finishing. -function finishCB(err) { - if (err.code) { - console.error(`finishCommonEvent failed, code is ${err.code}, message is ${err.message}`); -} else { - console.info("FinishCommonEvent"); -} - -subscriber.finishCommonEvent(finishCB); -``` - -### finishCommonEvent9+ - -```ts -finishCommonEvent(): Promise -``` - -Finishes this common event. This API takes effect only for ordered common events. It uses a promise to return the result. - -**System capability**: SystemCapability.Notification.CommonEvent - -**Return value** - -| Type | Description | -| ---------------- | -------------------- | -| Promise\ | Promise used to return the result.| - -**Example** - -```ts -let subscriber; // Subscriber object successfully created. - -subscriber.finishCommonEvent().then(() => { - console.info("FinishCommonEvent"); -}).catch((err) => { - console.error(`finishCommonEvent failed, code is ${err.code}, message is ${err.message}`); -}); -``` - -## CommonEventData - -**System capability**: SystemCapability.Notification.CommonEvent - -| Name | Type | Readable| Writable| Description | -| ---------- |-------------------- | ---- | ---- | ------------------------------------------------------- | -| event | string | Yes | No | Name of the common event that is being received. | -| bundleName | string | Yes | No | Bundle name. | -| code | number | Yes | No | Code of the common event, which is used to transfer data of the int type. | -| data | string | Yes | No | Custom data of the common event, which is used to transfer data of the string type.| -| parameters | {[key: string]: any} | Yes | No | Additional information about the common event. | - - -## CommonEventPublishData - -**System capability**: SystemCapability.Notification.CommonEvent - -| Name | Type | Readable| Writable| Description | -| --------------------- | -------------------- | ---- | ---- | ---------------------------- | -| bundleName | string | Yes | No | Bundle name. | -| code | number | Yes | No | Code of the common event. | -| data | string | Yes | No | Custom data of the common event.| -| subscriberPermissions | Array\ | Yes | No | Permissions required for subscribers to receive the common event. | -| isOrdered | boolean | Yes | No | Whether the common event is an ordered one. | -| isSticky | boolean | Yes | No | Whether the common event is a sticky one. Only system applications and system services are allowed to send sticky events.| -| parameters | {[key: string]: any} | Yes | No | Additional information about the common event. | - -## CommonEventSubscribeInfo - -**System capability**: SystemCapability.Notification.CommonEvent - -| Name | Type | Readable| Writable| Description | -| ------------------- | -------------- | ---- | ---- | ------------------------------------------------------------ | -| events | Array\ | Yes | No | Name of the common event to publish. | -| publisherPermission | string | Yes | No | Permissions required for publishers to publish the common event. | -| publisherDeviceId | string | Yes | No | Device ID. The value must be the ID of an existing device on the same network. | -| userId | number | Yes | No | User ID. The default value is the ID of the current user. If this parameter is specified, the value must be an existing user ID in the system.| -| priority | number | Yes | No | Subscriber priority. The value ranges from -100 to +1000. | diff --git a/en/application-dev/reference/apis/js-apis-contact.md b/en/application-dev/reference/apis/js-apis-contact.md index 2778a143c65125eca650324e67a220ab60f64ead..358d4e95387c3b20401e55ebbbf8e7fa157cfe0f 100644 --- a/en/application-dev/reference/apis/js-apis-contact.md +++ b/en/application-dev/reference/apis/js-apis-contact.md @@ -1,5 +1,7 @@ # @ohos.contact (Contacts) +The **contact** module provides contact management functions, such as adding, deleting, and updating contacts. + >**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. @@ -7,7 +9,7 @@ ## Modules to Import -```js +``` import contact from '@ohos.contact'; ``` @@ -166,6 +168,7 @@ Updates a contact based on the specified contact information. This API uses an a ```js contact.updateContact({ + id: 1, name: {fullName: 'xxx'}, phoneNumbers: [{phoneNumber: '138xxxxxxxx'}] }, (err) => { @@ -182,7 +185,7 @@ Updates a contact based on the specified contact information. This API uses an a updateContact(contact: Contact, attrs: ContactAttributes, callback: AsyncCallback<void>): void -Updates a contact based on the specified contact information and attributes. This API uses an asynchronous callback to return the result. +Updates a contact based on the specified contact information. This API uses an asynchronous callback to return the result. **Permission required**: ohos.permission.WRITE_CONTACTS @@ -200,6 +203,7 @@ Updates a contact based on the specified contact information and attributes. Thi ```js contact.updateContact({ + id: 1, name: {fullName: 'xxx'}, phoneNumbers: [{phoneNumber: '138xxxxxxxx'}] }, { @@ -232,7 +236,6 @@ Updates a contact based on the specified contact information and attributes. Thi | attrs | [ContactAttributes](#contactattributes) | No | List of contact attributes.| **Return Value** - | Type | Description | | ------------------- | ------------------------------------------------- | | Promise<void> | Promise used to return the result.| @@ -241,6 +244,7 @@ Updates a contact based on the specified contact information and attributes. Thi ```js let promise = contact.updateContact({ + id: 1, name: {fullName: 'xxx'}, phoneNumbers: [{phoneNumber: '138xxxxxxxx'}] }, { @@ -415,7 +419,7 @@ Queries my card. This API uses an asynchronous callback to return the result. queryMyCard(attrs: ContactAttributes, callback: AsyncCallback<Contact>): void -Queries my card based on the specified contact attributes. This API uses an asynchronous callback to return the result. +Queries my card. This API uses an asynchronous callback to return the result. **Permission required**: ohos.permission.READ_CONTACTS @@ -460,7 +464,6 @@ Queries my card based on the specified contact attributes. This API uses a promi | attrs | [ContactAttributes](#contactattributes) | No | List of contact attributes.| **Return Value** - | Type | Description | | ---------------------------------- | ------------------------------------------- | | Promise<[Contact](#contact)> | Promise used to return the result.| @@ -485,8 +488,6 @@ selectContact(callback: AsyncCallback<Array<Contact>>): void Selects a contact. This API uses an asynchronous callback to return the result. -**Permission required**: ohos.permission.READ_CONTACTS - **System capability**: SystemCapability.Applications.Contacts **Parameters** @@ -514,8 +515,6 @@ selectContact(): Promise<Array<Contact>> Selects a contact. This API uses a promise to return the result. -**Permission required**: ohos.permission.READ_CONTACTS - **System capability**: SystemCapability.Applications.Contacts **Return Value** @@ -570,7 +569,7 @@ Queries a contact based on the specified key. This API uses an asynchronous call queryContact(key: string, holder: Holder, callback: AsyncCallback<Contact>): void -Queries contacts based on the specified key and application. This API uses an asynchronous callback to return the result. +Queries a contact based on the specified key. This API uses an asynchronous callback to return the result. **Permission required**: ohos.permission.READ_CONTACTS @@ -605,7 +604,7 @@ Queries contacts based on the specified key and application. This API uses an as queryContact(key: string, attrs: ContactAttributes, callback: AsyncCallback<Contact>): void -Queries contacts based on the specified key and attributes. This API uses an asynchronous callback to return the result. +Queries a contact based on the specified key. This API uses an asynchronous callback to return the result. **Permission required**: ohos.permission.READ_CONTACTS @@ -638,7 +637,7 @@ Queries contacts based on the specified key and attributes. This API uses an asy queryContact(key: string, holder: Holder, attrs: ContactAttributes, callback: AsyncCallback<Contact>): void -Queries contacts based on the specified key, application, and attributes. This API uses an asynchronous callback to return the result. +Queries a contact based on the specified key. This API uses an asynchronous callback to return the result. **Permission required**: ohos.permission.READ_CONTACTS @@ -657,7 +656,6 @@ Queries contacts based on the specified key, application, and attributes. This A ```js contact.queryContact('xxx', { - holderId: 0 holderId: 0, bundleName: "", displayName: "" @@ -692,7 +690,6 @@ Queries contacts based on the specified key, application, and attributes. This A | attrs | [ContactAttributes](#contactattributes) | No | List of contact attributes. | **Return Value** - | Type | Description | | ---------------------------------- | ----------------------------------------------- | | Promise<[Contact](#contact)> | Promise used to return the result.| @@ -701,7 +698,6 @@ Queries contacts based on the specified key, application, and attributes. This A ```js let promise = contact.queryContact('xxx', { - holderId: 0 holderId: 0, bundleName: "", displayName: "" @@ -749,7 +745,7 @@ Queries all contacts. This API uses an asynchronous callback to return the resul queryContacts(holder: Holder, callback: AsyncCallback<Array<Contact>>): void -Queries all contacts based on the specified application. This API uses an asynchronous callback to return the result. +Queries all contacts. This API uses an asynchronous callback to return the result. **Permission required**: ohos.permission.READ_CONTACTS @@ -783,7 +779,7 @@ Queries all contacts based on the specified application. This API uses an asynch queryContacts(attrs: ContactAttributes, callback: AsyncCallback<Array<Contact>>): void -Queries all contacts based on the specified attributes. This API uses an asynchronous callback to return the result. +Queries all contacts. This API uses an asynchronous callback to return the result. **Permission required**: ohos.permission.READ_CONTACTS @@ -815,7 +811,7 @@ Queries all contacts based on the specified attributes. This API uses an asynchr queryContacts(holder: Holder, attrs: ContactAttributes, callback: AsyncCallback<Array<Contact>>): void -Queries all contacts based on the specified application and attributes. This API uses an asynchronous callback to return the result. +Queries all contacts. This API uses an asynchronous callback to return the result. **Permission required**: ohos.permission.READ_CONTACTS @@ -866,7 +862,6 @@ Queries all contacts based on the specified application and attributes. This API | attrs | [ContactAttributes](#contactattributes) | No | List of contact attributes. | **Return Value** - | Type | Description | | ----------------------------------------------- | --------------------------------------------------- | | Promise<Array<[Contact](#contact)>> | Promise used to return the result.| @@ -923,7 +918,7 @@ Queries contacts based on the specified phone number. This API uses an asynchron queryContactsByPhoneNumber(phoneNumber: string, holder: Holder, callback: AsyncCallback<Array<Contact>>): void -Queries contacts based on the specified phone number and application. This API uses an asynchronous callback to return the result. +Queries contacts based on the specified phone number. This API uses an asynchronous callback to return the result. **Permission required**: ohos.permission.READ_CONTACTS @@ -958,7 +953,7 @@ Queries contacts based on the specified phone number and application. This API u queryContactsByPhoneNumber(phoneNumber: string, attrs: ContactAttributes, callback: AsyncCallback<Array<Contact>>): void -Queries contacts based on the specified phone number and attributes. This API uses an asynchronous callback to return the result. +Queries contacts based on the specified phone number. This API uses an asynchronous callback to return the result. **Permission required**: ohos.permission.READ_CONTACTS @@ -991,7 +986,7 @@ Queries contacts based on the specified phone number and attributes. This API us queryContactsByPhoneNumber(phoneNumber: string, holder: Holder, attrs: ContactAttributes, callback: AsyncCallback<Array<Contact>>): void -Queries contacts based on the specified phone number, application, and attributes. This API uses an asynchronous callback to return the result. +Queries contacts based on the specified phone number. This API uses an asynchronous callback to return the result. **Permission required**: ohos.permission.READ_CONTACTS @@ -1101,7 +1096,7 @@ Queries contacts based on the specified email address. This API uses an asynchro queryContactsByEmail(email: string, holder: Holder, callback: AsyncCallback<Array<Contact>>): void -Queries contacts based on the specified email address and application. This API uses an asynchronous callback to return the result. +Queries contacts based on the specified email address. This API uses an asynchronous callback to return the result. **Permission required**: ohos.permission.READ_CONTACTS @@ -1119,7 +1114,7 @@ Queries contacts based on the specified email address and application. This API ```js contact.queryContactsByEmail('xxx@email.com', { - holderId: 0, + holderId: 0, bundleName: "", displayName: "" }, (err, data) => { @@ -1136,7 +1131,7 @@ Queries contacts based on the specified email address and application. This API queryContactsByEmail(email: string, attrs: ContactAttributes, callback: AsyncCallback<Array<Contact>>): void -Queries contacts based on the specified email address and attributes. This API uses an asynchronous callback to return the result. +Queries contacts based on the specified email address. This API uses an asynchronous callback to return the result. **Permission required**: ohos.permission.READ_CONTACTS @@ -1169,7 +1164,7 @@ Queries contacts based on the specified email address and attributes. This API u queryContactsByEmail(email: string, holder: Holder, attrs: ContactAttributes, callback: AsyncCallback<Array<Contact>>): void -Queries contacts based on the specified email address, application, and attributes. This API uses an asynchronous callback to return the result. +Queries contacts based on the specified email address. This API uses an asynchronous callback to return the result. **Permission required**: ohos.permission.READ_CONTACTS @@ -1278,7 +1273,7 @@ Queries all groups of this contact. This API uses an asynchronous callback to re queryGroups(holder: Holder, callback: AsyncCallback<Array<Group>>): void -Queries all groups of this contact based on the specified application. This API uses an asynchronous callback to return the result. +Queries all groups of this contact. This API uses an asynchronous callback to return the result. **Permission required**: ohos.permission.READ_CONTACTS @@ -1437,7 +1432,7 @@ Queries the key of a contact based on the specified contact ID. This API uses an queryKey(id: number, holder: Holder, callback: AsyncCallback<string>): void -Queries the key of a contact based on the specified contact ID and application. This API uses an asynchronous callback to return the result. +Queries the key of a contact based on the specified contact ID. This API uses an asynchronous callback to return the result. **Permission required**: ohos.permission.READ_CONTACTS @@ -1522,7 +1517,7 @@ Defines a contact. ### Attributes -| Name | Type | Readable| Writable| Description | +| Name | Type | Readable| Writable| Description | | ----------------- | --------------------------------------- | ---- | ---- | -------------------------------------- | | id | number | Yes | No | Contact ID. | | key | string | Yes | No | Contact key. | @@ -1584,7 +1579,7 @@ If **null** is passed, all attributes are queried by default. **System capability**: SystemCapability.Applications.ContactsData -| Name | Type | Readable| Writable| Description | +| Name | Type | Readable| Writable| Description | | ---------- | ------------------------- | ---- | ---- | ---------------- | | attributes | [Attribute](#attribute)[] | Yes | Yes | List of contact attributes.| @@ -1665,7 +1660,7 @@ Defines a contact's email. ### Attributes -| Name | Type| Readable| Writable| Description | +| Name | Type | Readable| Writable| Description | | ----------- | -------- | ---- | ---- | ---------------- | | email | string | Yes | Yes | Email addresses | | labelName | string | Yes | Yes | Name of the mailbox type.| @@ -1699,11 +1694,11 @@ Defines an application that creates the contact. **System capability**: SystemCapability.Applications.ContactsData -| Name | Type| Readable| Writable| Description | -| ----------- | -------- | ---- | ---- | ---------- | -| bundleName | string | Yes | No | Bundle name. | -| displayName | string | Yes | No | Application name.| -| holderId | number | Yes | Yes | Application ID. | +| Name | Type | Readable| Writable| Description | +| ----------- | ------ | ---- | ---- | ------------ | +| bundleName | string | Yes | No | Bundle name.| +| displayName | string | Yes | No | Application name. | +| holderId | number | Yes | Yes | Application ID. | **Example** @@ -1743,7 +1738,7 @@ Defines a contact's event. ### Attributes -| Name | Type| Readable| Writable| Description | +| Name | Type | Readable| Writable| Description | | --------- | -------- | ---- | ---- | -------------- | | eventDate | string | Yes | Yes | Event date. | | labelName | string | Yes | Yes | Event type.| @@ -1774,7 +1769,7 @@ Defines a contact group. **System capability**: SystemCapability.Applications.ContactsData -| Name | Type| Readable| Writable| Description | +| Name | Type | Readable| Writable| Description | | ------- | -------- | ---- | ---- | ------------------ | | groupId | number | Yes | Yes | ID of a contact group. | | title | string | Yes | Yes | Name of a contact group.| @@ -1822,7 +1817,7 @@ Enumerates IM addresses. ### Attributes -| Name | Type| Readable| Writable| Description | +| Name | Type | Readable| Writable| Description | | --------- | -------- | ---- | ---- | ------------------ | | imAddress | string | Yes | Yes | IM address. | | labelName | string | Yes | Yes | IM name.| @@ -1855,7 +1850,7 @@ Defines a contact's name. **System capability**: SystemCapability.Applications.ContactsData -| Name | Type| Readable| Writable| Description | +| Name | Type | Readable| Writable| Description | | ------------------ | -------- | ---- | ---- | --------------------------- | | familyName | string | Yes | Yes | Family name. | | familyNamePhonetic | string | Yes | Yes | Family name in pinyin. | @@ -1894,7 +1889,7 @@ Defines a contact's nickname. **System capability**: SystemCapability.Applications.ContactsData -| Name | Type| Readable| Writable| Description | +| Name | Type | Readable| Writable| Description | | -------- | -------- | ---- | ---- | -------------- | | nickName | string | Yes | Yes | Contact nickname.| @@ -1923,7 +1918,7 @@ Defines a contact's note. **System capability**: SystemCapability.Applications.ContactsData -| Name | Type| Readable| Writable| Description | +| Name | Type | Readable| Writable| Description | | ----------- | -------- | ---- | ---- | ------------------ | | noteContent | string | Yes | Yes | Notes of the contact.| @@ -1952,7 +1947,7 @@ Defines a contact's organization. **System capability**: SystemCapability.Applications.ContactsData -| Name | Type| Readable| Writable| Description | +| Name | Type | Readable| Writable| Description | | ----- | -------- | ---- | ---- | ---------- | | name | string | Yes | Yes | Organization name.| | title | string | Yes | Yes | Organization title.| @@ -2014,7 +2009,7 @@ Defines a contact's phone number. ### Attributes -| Name | Type| Readable| Writable| Description | +| Name | Type | Readable| Writable| Description | | ----------- | -------- | ---- | ---- | ------------------ | | labelName | string | Yes | Yes | Phone number type.| | phoneNumber | string | Yes | Yes | Phone number. | @@ -2046,7 +2041,7 @@ Defines a contact's portrait. **System capability**: SystemCapability.Applications.ContactsData -| Name| Type| Readable| Writable| Description | +| Name| Type | Readable| Writable| Description | | ---- | -------- | ---- | ---- | -------------- | | uri | string | Yes | Yes | Contact portrait.| @@ -2088,7 +2083,7 @@ Defines a contact's postal address. ### Attributes -| Name | Type| Readable| Writable| Description | +| Name | Type | Readable| Writable| Description | | ------------- | -------- | ---- | ---- | -------------------------- | | city | string | Yes | Yes | City where the contact is located. | | country | string | Yes | Yes | Country/Region where the contact is located. | @@ -2150,7 +2145,7 @@ Defines a contact's relationship. ### Attributes -| Name | Type| Readable| Writable| Description | +| Name | Type | Readable| Writable| Description | | ------------ | -------- | ---- | ---- | -------------- | | labelName | string | Yes | Yes | Relationship type.| | relationName | string | Yes | Yes | Relationship name. | @@ -2196,13 +2191,12 @@ Defines a contact's SIP address. ### Attributes -| Name | Type| Readable| Writable| Description | +| Name | Type | Readable| Writable| Description | | ---------- | -------- | ---- | ---- | --------------------------------- | | labelName | string | Yes | Yes | SIP address type.| | sipAddress | string | Yes | Yes | SIP address. | | labelId | number | Yes | Yes | SIP address ID. | - **Example** Create contact data in JSON format: @@ -2227,7 +2221,7 @@ Defines a contact's website. **System capability**: SystemCapability.Applications.ContactsData -| Name | Type| Readable| Writable| Description | +| Name | Type | Readable| Writable| Description | | ------- | -------- | ---- | ---- | ------------------ | | website | string | Yes | Yes | Website of the contact.| @@ -2247,4 +2241,4 @@ let website = { ```js let website = new contact.Website(); website.website = "website"; -``` \ No newline at end of file +``` diff --git a/en/application-dev/reference/apis/js-apis-convertxml.md b/en/application-dev/reference/apis/js-apis-convertxml.md index 70d35b6cb168e6f10b847a42bdefa8fd53eb3d40..4c66c928fb7ee6c5482d39db7b39acaa6793691e 100644 --- a/en/application-dev/reference/apis/js-apis-convertxml.md +++ b/en/application-dev/reference/apis/js-apis-convertxml.md @@ -47,21 +47,27 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -let xml = - '' + - '' + - ' Happy' + - ' Work' + - ' Play' + - ''; -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"} -let result = JSON.stringify(conv.convertToJSObject(xml, options)); -console.log(result); +try { + let xml = + '' + + '' + + ' Happy' + + ' Work' + + ' Play' + + ''; + 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" + } + let result = JSON.stringify(conv.convertToJSObject(xml, options)); + console.log(result); +} catch (e) { + console.log(e.toString()); +} // Output (non-compact) // {"_declaration":{"_attributes":{"version":"1.0","encoding":"utf-8"}},"_elements":[{"_type":"element","_name":"note","_attributes":{"importance":"high","logged":"true"},"_elements":[{"_type":"element","_name":"title","_elements":[{"_type":"text","_text":"Happy"}]},{"_type":"element","_name":"todo","_elements":[{"_type":"text","_text":"Work"}]},{"_type":"element","_name":"todo","_elements":[{"_type":"text","_text":"Play"}]}]}]} ``` diff --git a/en/application-dev/reference/apis/js-apis-cryptoFramework.md b/en/application-dev/reference/apis/js-apis-cryptoFramework.md index a92fdd87e5e31b2f7b38345acacbb640ff27212f..afb1bd3f8d80a74415c359af492492286364008c 100644 --- a/en/application-dev/reference/apis/js-apis-cryptoFramework.md +++ b/en/application-dev/reference/apis/js-apis-cryptoFramework.md @@ -51,7 +51,7 @@ For details about the supported specifications, see [HMAC Algorithm Specificatio | Name | Type | Mandatory| Description | | ------- | ------ | ---- | ------------------------------------------------------------ | -| algName | string | Yes | Digest algorithm. For details about the supported algorithms, see [HMAC Algorithm Specifications](../../security/cryptoFramework-overview.md#hmac-algorithm-specifications). | +| algName | string | Yes | Digest algorithm. For details about the supported algorithms, see [HMAC Algorithm Specifications](../../security/cryptoFramework-overview.md#hmac-algorithm-specifications).| **Return value** @@ -483,7 +483,7 @@ For details about the supported specifications, see [MD Algorithm Specifications | Name | Type | Mandatory| Description | | ------- | ------ | ---- | ------------------------------------------------------------ | -| algName | string | Yes | Digest algorithm. For details about the supported algorithms, see [MD Algorithm Specifications](../../security/cryptoFramework-overview.md#md-algorithm-specifications). | +| algName | string | Yes | Digest algorithm. For details about the supported algorithms, see [MD Algorithm Specifications](../../security/cryptoFramework-overview.md#md-algorithm-specifications).| **Return value** @@ -1852,7 +1852,7 @@ Updates the data to encrypt or decrypt by segment. This API uses a promise to re | Type | Description | | ------------------------------- | ------------------------------------------------ | -| Promise\<[DataBlob](#datablob)> | Promise used to return the **DataBlob** (containing the encrypted or decrypted data). | +| Promise\<[DataBlob](#datablob)> | Promise used to return the **DataBlob** (containing the encrypted or decrypted data).| **Error codes** @@ -2174,7 +2174,7 @@ update(data : DataBlob, callback : AsyncCallback\) : void Updates the data to be signed. This API uses an asynchronous callback to return the result. > **NOTE**
-> For details about the sample code for calling **update()** multiple times, see [Signing Data and Verifying Signatures](../../security/cryptoFramework-guidelines.md#signing-data-and-verifying-signatures). +> For details about the sample code for calling **update()** multiple times, see [Generating and Verifying a Signature](../../security/cryptoFramework-guidelines.md#generating-and-verifying-a-signature). **System capability**: SystemCapability.Security.CryptoFramework @@ -2200,7 +2200,7 @@ update(data : DataBlob) : Promise\; Updates the data to be signed. This API uses a promise to return the result. > **NOTE**
-> For details about the sample code for calling **update()** multiple times, see [Signing Data and Verifying Signatures](../../security/cryptoFramework-guidelines.md#signing-data-and-verifying-signatures). +> For details about the sample code for calling **update()** multiple times, see [Generating and Verifying a Signature](../../security/cryptoFramework-guidelines.md#generating-and-verifying-a-signature). **System capability**: SystemCapability.Security.CryptoFramework @@ -2267,6 +2267,8 @@ Signs the data. This API uses a promise to return the result. | -------------- | ----------- | | Promise\ | Promise used to return the result.| +**Error codes** + | ID| Error Message | | -------- | ---------------------- | | 17620001 | memory error. | @@ -2465,7 +2467,7 @@ update(data : DataBlob, callback : AsyncCallback\) : void Updates the data for signature verification. This API uses an asynchronous callback to return the result. > **NOTE** -> For details about the sample code for calling **update()** multiple times, see [Signing Data and Verifying Signatures](../../security/cryptoFramework-guidelines.md#signing-data-and-verifying-signatures). +> For details about the sample code for calling **update()** multiple times, see [Generating and Verifying a Signature](../../security/cryptoFramework-guidelines.md#generating-and-verifying-a-signature). **System capability**: SystemCapability.Security.CryptoFramework @@ -2491,7 +2493,7 @@ update(data : DataBlob) : Promise\; Updates the data for signature verification. This API uses a promise to return the result. > **NOTE** -> For details about the sample code for calling **update()** multiple times, see [Signing Data and Verifying Signatures](../../security/cryptoFramework-guidelines.md#signing-data-and-verifying-signatures). +> For details about the sample code for calling **update()** multiple times, see [Generating and Verifying a Signature](../../security/cryptoFramework-guidelines.md#generating-and-verifying-a-signature). **System capability**: SystemCapability.Security.CryptoFramework diff --git a/en/application-dev/reference/apis/js-apis-curve.md b/en/application-dev/reference/apis/js-apis-curve.md index cf3067e37fd78e9c9d0f3d701b1fdf30cb79c88f..d113624577ba5569bf036a6cd0de1664b06f0ab9 100644 --- a/en/application-dev/reference/apis/js-apis-curve.md +++ b/en/application-dev/reference/apis/js-apis-curve.md @@ -35,7 +35,6 @@ Implements initialization for the interpolation curve, which is used to create a | ---------------------------------- | ---------------- | | [ICurve](#icurve) | Interpolation curve.| - **Example** ```ts @@ -57,7 +56,7 @@ Creates a step curve. | Name| Type | Mandatory| Description | | ------ | ------- | ----| ------------------------------------------------------------ | -| count | number | Yes | Number of steps. The value must be a positive integer. | +| count | number | Yes | Number of steps. The value must be a positive integer.
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the value **0**.| | end | boolean | Yes | Whether jumping occurs when the interpolation ends.
- **true**: Jumping occurs when the interpolation ends.
- **false**: Jumping occurs when the interpolation starts.| **Return value** @@ -66,7 +65,6 @@ Creates a step curve. | ---------------------------------- | ---------------- | | [ICurve](#icurve) | Interpolation curve.| - **Example** ```ts @@ -85,12 +83,13 @@ Creates a cubic Bezier curve. The curve values must be between 0 and 1. **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | -------------- | -| x1 | number | Yes | X coordinate of the first point on the Bezier curve.| -| y1 | number | Yes | Y coordinate of the first point on the Bezier curve.| -| x2 | number | Yes | X coordinate of the second point on the Bezier curve.| -| y2 | number | Yes | Y coordinate of the second point on the Bezier curve.| + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ------------------------------------------------------------ | +| x1 | number | Yes | X coordinate of the first point on the Bezier curve.
Value range: [0, 1]
**NOTE**
A value less than 0 evaluates to the value **0**. A value greater than 1 evaluates to the value **1**.| +| y1 | number | Yes | Y coordinate of the first point on the Bezier curve.
Value range: (-∞, +∞) | +| x2 | number | Yes | X coordinate of the second point on the Bezier curve.
Value range: [0, 1]
**NOTE**
A value less than 0 evaluates to the value **0**. A value greater than 1 evaluates to the value **1**.| +| y2 | number | Yes | Y coordinate of the second point on the Bezier curve.
Value range: (-∞, +∞) | **Return value** @@ -112,17 +111,17 @@ Curves.cubicBezierCurve(0.1, 0.0, 0.1, 1.0) // Create a cubic Bezier curve. springCurve(velocity: number, mass: number, stiffness: number, damping: number): ICurve -Creates a spring curve. +Creates a spring curve. The curve shape is subject to the spring parameters, and the animation duration is subject to the **duration** parameter in **animation** and **animateTo**. **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** -| Name | Type | Mandatory | Description | -| --------- | ------ | ---- | ----- | -| velocity | number | Yes | Initial velocity. It is applied by external factors to the elastic animation. It aims to help ensure the smooth transition from the previous motion state to the elastic animation.| -| mass | number | Yes | Mass, which influences the inertia in the spring system. The greater the mass, the greater the amplitude of the oscillation, and the slower the speed of restoring to the equilibrium position.| -| stiffness | number | Yes | Stiffness. It is the degree to which an object deforms by resisting the force applied. In an elastic system, the greater the stiffness, the stronger the ability to resist deformation, and the faster the speed of restoring to the equilibrium position.| -| damping | number | Yes | Damping. It is a pure number and has no real physical meaning. It is used to describe the oscillation and attenuation of the system after being disturbed. The larger the damping, the smaller the number of oscillations of elastic motion, and the smaller the oscillation amplitude.| +| Name | Type | Mandatory| Description | +| --------- | ------ | ---- | ------------------------------------------------------------ | +| velocity | number | Yes | Initial velocity. It is applied by external factors to the spring animation, designed to help ensure the smooth transition from the previous motion state.
Value range: (-∞, +∞)| +| mass | number | Yes | Mass, which influences the inertia in the spring system. The greater the mass, the greater the amplitude of the oscillation, and the slower the speed of restoring to the equilibrium position.
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the value **1**.| +| stiffness | number | Yes | Stiffness. It is the degree to which an object deforms by resisting the force applied. In an elastic system, the greater the stiffness, the stronger the ability to resist deformation, and the faster the speed of restoring to the equilibrium position.
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the value **1**.| +| damping | number | Yes | Damping. It is a pure number and has no real physical meaning. It is used to describe the oscillation and attenuation of the system after being disturbed. The larger the damping, the smaller the number of oscillations of elastic motion, and the smaller the oscillation amplitude.
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the value **1**.| **Return value** @@ -149,18 +148,19 @@ Creates a spring animation curve. If multiple spring animations are applied to t **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** + | Name | Type | Mandatory | Description | | --------- | ------ | ---- | ----- | -| response | number | No | Duration of one complete oscillation, in seconds.
Default value: **0.55**| -| dampingFraction | number | No | Damping coefficient.
**0**: undamped. In this case, the spring oscillates forever.
> 0 and < 1: underdamped. In this case, the spring overshoots the equilibrium position.
**1**: critically damped.
> 1: overdamped. In this case, the spring approaches equilibrium gradually.
Default value: **0.825**| -| overlapDuration | number | No | Duration for animations to overlap, in seconds. When animations overlap, if the **response** values of the two animations are different, they will transit smoothly over this duration.
Default value: **0**| +| response | number | No | Duration of one complete oscillation,
Default value: **0.55**
Unit: second
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the default value **0.55**.| +| dampingFraction | number | No | Damping coefficient.
**0**: undamped. In this case, the spring oscillates forever.
> 0 and < 1: underdamped. In this case, the spring overshoots the equilibrium position.
**1**: critically damped.
> 1: overdamped. In this case, the spring approaches equilibrium gradually.
Default value: **0.825**
Unit: second
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the default value **0.55**.| +| overlapDuration | number | No | Duration for animations to overlap, in seconds. When animations overlap, if the **response** values of the two animations are different, they will transit smoothly over this duration.

Default value: **0**
Unit: second
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the default value **0**.
The spring animation curve is physics-based. Its duration depends on the **springMotion** parameters and the previous velocity, rather than the **duration** parameter in **[animation](../arkui-ts/ts-animatorproperty.md)** or **[animateTo](../arkui-ts/ts-explicit-animation.md)**. The time cannot be normalized. Therefore, the interpolation cannot be obtained by using the **[interpolate](#interpolate)** function of the curve.| **Return value** | Type | Description | | ---------------------------------- | ---------------- | -| [ICurve](#icurve)| Curve.
Note: The spring animation curve is physics-based. Its duration depends on the **springMotion** parameters and the previous velocity, rather than the **duration** parameter in **animation** or **animateTo**. The time cannot be normalized. Therefore, the interpolation cannot be obtained by using the [interpolate](#interpolate) function of the curve.| +| [ICurve](#icurve)| Curve.
**NOTE**
The spring animation curve is physics-based. Its duration depends on the **springMotion** parameters and the previous velocity, rather than the **duration** parameter in **animation** or **animateTo**. The time cannot be normalized. Therefore, the interpolation cannot be obtained by using the **[interpolate](#interpolate)** function of the curve.| **Example** @@ -182,17 +182,18 @@ Creates a responsive spring animation curve. It is a special case of [springMoti **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** + | Name | Type | Mandatory | Description | | --------- | ------ | ---- | ----- | -| response | number | No | See **response** in **springMotion**. Default value: **0.15**| -| dampingFraction | number | No | See **dampingFraction** in **springMotion**. Default value: **0.86**| -| overlapDuration | number | No | See **overlapDuration** in **springMotion**. Default value: **0.25**| +| response | number | No | See **response** in **springMotion**.
Default value: **0.15**
Unit: second
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the default value **0.15**.| +| dampingFraction | number | No | See **dampingFraction** in **springMotion**.
Default value: **0.86**
Unit: second
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the default value **0.86**.| +| overlapDuration | number | No | See **overlapDuration** in **springMotion**.
Default value: **0.25**
Unit: second
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the default value **0.25**.
To apply custom settings for a spring animation, you are advised to use **springMotion**. When using **responsiveSpringMotion**, you are advised to retain the default settings.
The duration of the responsive spring animation depends on the **responsiveSpringMotion** parameters and the previous velocity, rather than the **duration** parameter in **[animation](../arkui-ts/ts-animatorproperty.md)** or **[animateTo](../arkui-ts/ts-explicit-animation.md)**. In addition, the interpolation cannot be obtained by using the **[interpolate](#interpolate)** function of the curve.| **Return value** | Type | Description | | ---------------------------------- | ---------------- | -| [ICurve](#icurve)| Curve.
**NOTE**
1. To apply custom settings for a spring animation, you are advised to use **springMotion**. When using **responsiveSpringMotion**, you are advised to retain the default settings.
2. The duration of the responsive spring animation depends on the **responsiveSpringMotion** parameters and the previous velocity, rather than the **duration** parameter in **animation** or **animateTo**. In addition, the interpolation cannot be obtained by using the [interpolate](#interpolate) function of the curve.| +| [ICurve](#icurve)| Curve.
**NOTE**
1. To apply custom settings for a spring animation, you are advised to use **springMotion**. When using **responsiveSpringMotion**, you are advised to retain the default settings.
2. The duration of the responsive spring animation depends on the **responsiveSpringMotion** parameters and the previous velocity, rather than the **duration** parameter in **animation** or **animateTo**. In addition, the interpolation cannot be obtained by using the **interpolate** function of the curve.| **Example** @@ -202,6 +203,39 @@ Curves.responsiveSpringMotion() // Create a responsive spring animation curve wi ``` +## Curves.interpolatingSpringCurve10+ + +interpolatingSpring(velocity: number, mass: number, stiffness: number, damping: number): ICurve + + +Creates an interpolating spring curve animated from 0 to 1. The actual animation value is calculated based on the curve. The animation duration is subject to the curve parameters, rather than the **duration** parameter in **animation** or **animateTo**. + +**System capability**: SystemCapability.ArkUI.ArkUI.Full + +**Parameters** +| Name | Type | Mandatory | Description | +| --------- | ------ | ---- | ----- | +| velocity | number | Yes | Initial velocity. It is applied by external factors to the spring animation, designed to help ensure the smooth transition from the previous motion state. The velocity is the normalized velocity, and its value is equal to the actual velocity at the beginning of the animation divided by the animation attribute change value.| +| mass | number | Yes | Mass, which influences the inertia in the spring system. The greater the mass, the greater the amplitude of the oscillation, and the slower the speed of restoring to the equilibrium position.| +| stiffness | number | Yes | Stiffness. It is the degree to which an object deforms by resisting the force applied. In an elastic system, the greater the stiffness, the stronger the ability to resist deformation, and the faster the speed of restoring to the equilibrium position.| +| damping | number | Yes | Damping. It is a pure number and has no real physical meaning. It is used to describe the oscillation and attenuation of the system after being disturbed. The larger the damping, the smaller the number of oscillations of elastic motion, and the smaller the oscillation amplitude.| + + +**Return value** + +| Type | Description | +| ---------------------------------- | ---------------- | +| [ICurve](#icurve)| Interpolation curve.| + + +**Example** + +```ts +import Curves from '@ohos.curves' +Curves.interpolatingSpring(100, 1, 228, 30) // Create an interpolating spring curve whose duration is subject to spring parameters. +``` + + ## ICurve @@ -209,16 +243,17 @@ Curves.responsiveSpringMotion() // Create a responsive spring animation curve wi interpolate(fraction: number): number - Implements calculation. +Since API version 9, this API is supported in ArkTS widgets. + **System capability**: SystemCapability.ArkUI.ArkUI.Full **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ------ | ---- | -------------------------------------------- | -| fraction | number | Yes | Current normalized time. The value ranges from 0 to 1.| +| Name | Type | Mandatory| Description | +| -------- | ------ | ---- | ------------------------------------------------------------ | +| fraction | number | Yes | Current normalized time.
Value range: [0, 1]
**NOTE**
A value less than 0 evaluates to the value **0**. A value greater than 1 evaluates to the value **1**.| **Return value** @@ -299,7 +334,7 @@ Creates a spring curve. This API is deprecated since API version 9. You are advi | Name | Type | Mandatory | Description | | --------- | ------ | ---- | ----- | -| velocity | number | Yes | Initial velocity. It is applied by external factors to the elastic animation. It aims to help ensure the smooth transition from the previous motion state to the elastic animation.| +| velocity | number | Yes | Initial velocity. It is applied by external factors to the spring animation, designed to help ensure the smooth transition from the previous motion state.| | mass | number | Yes | Mass, which influences the inertia in the spring system. The greater the mass, the greater the amplitude of the oscillation, and the slower the speed of restoring to the equilibrium position.| | stiffness | number | Yes | Stiffness. It is the degree to which an object deforms by resisting the force applied. In an elastic system, the greater the stiffness, the stronger the ability to resist deformation, and the faster the speed of restoring to the equilibrium position.| | damping | number | Yes | Damping. It is a pure number and has no real physical meaning. It is used to describe the oscillation and attenuation of the system after being disturbed. The larger the damping, the smaller the number of oscillations of elastic motion, and the smaller the oscillation amplitude.| diff --git a/en/application-dev/reference/apis/js-apis-data-dataShare.md b/en/application-dev/reference/apis/js-apis-data-dataShare.md index 82a333b14b2ea90e92540ee31142ea884c7f2593..b79161a08e5916eecca479c99f6fd852f8e6fd4a 100644 --- a/en/application-dev/reference/apis/js-apis-data-dataShare.md +++ b/en/application-dev/reference/apis/js-apis-data-dataShare.md @@ -1,14 +1,15 @@ -# @ohos.data.dataShare (DataShare) +# @ohos.data.dataShare (Data Sharing) The **DataShare** module allows an application to manage its own data and share data with other 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. +> - 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. +> - 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 @@ -55,7 +56,7 @@ Observe the following when using this API: | Name | Type | Mandatory| Description | | -------- | -------------------------------------------------------- | ---- | ------------------------------------------------------------ | -| context | [Context](js-apis-application-context.md#context) | Yes | Context of an application. | +| context | [Context](js-apis-inner-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.| @@ -105,7 +106,7 @@ Observe the following when using this API: | Name | Type | Mandatory| Description | | ------- | ------------------------------------------------- | ---- | ------------------------------ | -| context | [Context](js-apis-application-context.md#context) | Yes | Context of an application. | +| context | [Context](js-apis-inner-application-context.md#context) | Yes | Context of an application. | | uri | string | Yes | URI of the server application to connect.| **Return value** @@ -187,18 +188,19 @@ Unsubscribes from the changes of the specified data. This API uses an asynchrono | -------- | -------------------- | ---- | ------------------------ | | 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.| +| callback | AsyncCallback<void> | No | Callback for the data change event. If this parameter is left empty, all notification events of the URI are unsubscribed from.| **Example** ```ts import UIAbility from '@ohos.app.ability.UIAbility'; -function offCallback() { - console.info("**** Observer off callback ****"); +function callback() { + console.info("**** Observer callback ****"); } let uri = ("datashare:///com.samples.datasharetest.DataShare"); -dataShareHelper.off("dataChange", uri, offCallback); +dataShareHelper.on("dataChange", uri, callback); +dataShareHelper.off("dataChange", uri, callback); ``` ### insert 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 5c27d183e38680ec392471f55e374a5127714e82..978cbffcf74444d9c902a91d72017d316f5ae5e8 100644 --- a/en/application-dev/reference/apis/js-apis-data-distributedobject.md +++ b/en/application-dev/reference/apis/js-apis-data-distributedobject.md @@ -131,7 +131,7 @@ Sets a session ID for synchronization. Automatic synchronization is performed fo **Error codes** -For details about the error codes, see [Distributed Data Object Error Codes](../errorcodes/errorcode-distributed-dataObject.md). + For details about the error codes, see [Distributed Data Object Error Codes](../errorcodes/errorcode-distributed-dataObject.md). | ID| Error Message| | -------- | -------- | @@ -288,7 +288,7 @@ g_object.off("change"); on(type: 'status', callback: Callback<{ sessionId: string, networkId: string, status: 'online' | 'offline' }>): void -Subscribes to statue changes of this distributed data object. +Subscribes to status changes of this distributed data object. **System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject @@ -363,7 +363,12 @@ The saved data will be released in the following cases: ```ts g_object.setSessionId("123456"); -g_object.save("local", (result) => { +g_object.save("local", (err, result) => { + if (err) { + console.info("save failed, error code = " + err.code); + console.info("save failed, error message: " + err.message); + return; + } console.info("save callback"); console.info("save sessionId: " + result.sessionId); console.info("save version: " + result.version); @@ -408,8 +413,9 @@ g_object.save("local").then((result) => { console.info("save sessionId " + result.sessionId); console.info("save version " + result.version); console.info("save deviceId " + result.deviceId); -}, () => { - console.error("save failed"); +}).catch((err) => { + console.info("save failed, error code = " + err.code); + console.info("save failed, error message: " + err.message); }); ``` @@ -435,16 +441,26 @@ If the object is stored on another device, the data on the local device will be ```js g_object.setSessionId("123456"); // Save data for persistence. -g_object.save("local", (result) => { +g_object.save("local", (err, result) => { + if (err) { + console.info("save failed, error code = " + err.code); + console.info("save failed, error message: " + err.message); + return; + } console.info("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); }); // Delete the persistence data. -g_object.revokeSave((result) => { - console.info("revokeSave callback"); - console.info("revokeSave sessionId " + result.sessionId); +g_object.revokeSave((err, result) => { + if (err) { + console.info("revokeSave failed, error code = " + err.code); + console.info("revokeSave failed, error message: " + err.message); + return; + } + console.info("revokeSave callback"); + console.info("revokeSave sessionId " + result.sessionId); }); ``` @@ -475,15 +491,17 @@ g_object.save("local").then((result) => { console.info("save sessionId " + result.sessionId); console.info("save version " + result.version); console.info("save deviceId " + result.deviceId); -}, () => { - console.error("save failed"); +}).catch((err) => { + console.info("save failed, error code = " + err.code); + console.info("save failed, error message: " + err.message); }); // Delete the persistence data. g_object.revokeSave().then((result) => { console.info("revokeSave callback"); console.info("sessionId" + result.sessionId); -}, () => { - console.error("revokeSave failed"); +}).catch((err)=> { + console.info("revokeSave failed, error code = " + err.code); + console.info("revokeSave failed, error message = " + err.message); }); ``` @@ -583,7 +601,7 @@ Subscribes to data changes of this distributed data object. **Example** ```js -import distributedObject from '@ohos.data.distributedDataObject'; +import distributedObject from '@ohos.data.distributedDataObject'; let 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); @@ -612,14 +630,14 @@ Unsubscribes from the data changes of this distributed data object. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| type | string | Yes| Event type to unsubscribe from. The value is **change**, which indicates data changes. | +| 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 for data changes. If this parameter is not specified, all data change callbacks of this distributed data 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'; +import distributedObject from '@ohos.data.distributedDataObject'; let 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); @@ -673,14 +691,14 @@ Unsubscribes from the status change of this distributed data object. | 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. | +| 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 for status changes. If this parameter is not specified, all status change callbacks of this distributed data object will be unregistered.
**sessionId** indicates the session ID of the distributed data object.
**deviceId** indicates the device ID of the distributed data object.
**status** indicates the object status, which can be online or offline.| **Example** ```js -import distributedObject from '@ohos.data.distributedDataObject'; +import distributedObject from '@ohos.data.distributedDataObject'; let 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; 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 de22c34d2a99d3e7391061cc9233089409944599..156078c63ad8f33a7747e493948f59d511a1c791 100644 --- a/en/application-dev/reference/apis/js-apis-data-preferences.md +++ b/en/application-dev/reference/apis/js-apis-data-preferences.md @@ -1,11 +1,11 @@ -# @ohos.data.preferences (Preferences) +# @ohos.data.preferences (User Preferences) -The **Preferences** module provides APIs for processing data in the form of key-value (KV) pairs and supports persistence of the KV pairs when required. +The **user preferences** module provides APIs for processing data in the form of key-value (KV) pairs and supports persistence of the KV pairs when required. The key is of the string type, and the value can be a number, a string, a Boolean value, or an array of numbers, strings, or Boolean values. -> **NOTE**
+> **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. @@ -22,8 +22,8 @@ import data_preferences from '@ohos.data.preferences'; | Name | Type| Readable| Writable| Description | | ---------------- | -------- | ---- | ---- | --------------------------------------- | -| MAX_KEY_LENGTH | number | Yes | No | Maximum length of a key. The key must be less than 80 bytes. | -| MAX_VALUE_LENGTH | number | Yes | No | Maximum length of a value. The value must be less than 8192 bytes.| +| MAX_KEY_LENGTH | number | Yes | No | Maximum length of a key, which is 80 bytes. | +| MAX_VALUE_LENGTH | number | Yes | No | Maximum length of a value, which is 8192 bytes.| ## data_preferences.getPreferences @@ -38,8 +38,8 @@ Obtains a **Preferences** instance. This API uses an asynchronous callback to re | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------ | ---- | ------------------------------------------------------------ | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md). | -| name | string | Yes | Name of the **Preferences** instance.| +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md). | +| name | string | Yes | Name of the **Preferences** instance. | | callback | AsyncCallback<[Preferences](#preferences)> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **object** is the **Preferences** instance obtained. Otherwise, **err** is an error code.| **Example** @@ -176,12 +176,12 @@ The deleted **Preferences** instance cannot be used for data operations. Otherwi | Name | Type | Mandatory| Description | | -------- | ------------------------------------- | ---- | ---------------------------------------------------- | | context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md). | -| name | string | Yes | Name of the **Preferences** instance to delete. | +| name | string | Yes | Name of the **Preferences** instance to delete. | | callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error code.| **Error codes** -For details about the following error codes, see [Preference Error Codes](../errorcodes/errorcode-preferences.md). +For details about the error codes, see [User Preference Error Codes](../errorcodes/errorcode-preferences.md). | ID| Error Message | | -------- | ------------------------------| @@ -258,7 +258,7 @@ The deleted **Preferences** instance cannot be used for data operations. Otherwi **Error codes** -For details about the following error codes, see [Preference Error Codes](../errorcodes/errorcode-preferences.md). +For details about the error codes, see [User Preference Error Codes](../errorcodes/errorcode-preferences.md). | ID| Error Message | | -------- | ------------------------------| @@ -503,7 +503,7 @@ try { promise.then((data) => { console.info("Got the value of 'startup'. Data: " + data); }).catch((err) => { - console.info("Failed to get value of 'startup'. code =" + err.code + ", message =" + err.message); + console.info("Failed to obtain the value of 'startup'. code =" + err.code + ", message =" + err.message); }) } catch(err) { console.info("Failed to obtain the value of 'startup'. code =" + err.code + ", message =" + err.message); @@ -973,7 +973,7 @@ Unsubscribes from data changes. | Name | Type | Mandatory| Description | | -------- | -------------------------------- | ---- | ------------------------------------------ | | type | string | Yes | Event type to unsubscribe from. The value **change** indicates data change events. | -| callback | Callback<{ key : string }> | No | Callback to unregister. If this parameter is left blank, the callbacks used to subscribing to all data changes will be unregistered.| +| callback | Callback<{ key : string }> | No | Callback to unregister. If this parameter is left blank, the callbacks for all data changes will be unregistered.| **Example** 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 bcebd097f34c1337e5826e866302af9626696a32..2924cc05735a40236985ba921d39839ee796afad 100644 --- a/en/application-dev/reference/apis/js-apis-data-rdb.md +++ b/en/application-dev/reference/apis/js-apis-data-rdb.md @@ -1,13 +1,13 @@ # @ohos.data.rdb (RDB) -The relational database (RDB) manages data based on relational models. With the underlying SQLite database, the RDB provides a complete mechanism for managing local databases. To satisfy different needs in complicated scenarios, the RDB offers a series of methods for performing operations such as adding, deleting, modifying, and querying data, and supports direct execution of SQL statements. +The relational database (RDB) manages data based on relational models. With the underlying SQLite database, the RDB provides a complete mechanism for managing local databases. To satisfy different needs in complicated scenarios, the RDB offers a series of methods for performing operations such as adding, deleting, modifying, and querying data, and supports direct execution of SQL statements. The worker threads are not supported. This module provides the following RDB-related functions: - [RdbPredicates](#rdbpredicates): provides predicates indicating the nature, feature, or relationship of a data entity in an RDB store. It is used to define the operation conditions for an RDB store. - [RdbStore](#rdbstore): provides APIs for managing an RDB store. -> **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. > @@ -31,7 +31,7 @@ Obtains an RDB store. This API uses an asynchronous callback to return the resul | Name | Type | Mandatory| Description | | -------- | ------------------------------------------ | ---- | ------------------------------------------------------------ | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-app-context.md).| | config | [StoreConfig](#storeconfig) | Yes | Configuration of the RDB store. | | version | number | Yes | RDB store version.
Currently, automatic RDB upgrades and downgrades performed based on **version** is not supported. | | callback | AsyncCallback<[RdbStore](#rdbstore)> | Yes | Callback invoked to return the RDB store obtained. | @@ -92,7 +92,7 @@ Obtains an RDB store. This API uses a promise to return the result. You can set | Name | Type | Mandatory| Description | | ------- | --------------------------- | ---- | ------------------------------------------------------------ | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-app-context.md).| | config | [StoreConfig](#storeconfig) | Yes | Configuration of the RDB store. | | version | number | Yes | RDB store version.
Currently, automatic RDB upgrades and downgrades performed based on **version** is not supported. | @@ -156,7 +156,7 @@ Deletes an RDB store. This API uses an asynchronous callback to return the resul | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ------------------------------------------------------------ | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-app-context.md).| | name | string | Yes | Name of the RDB store to delete. | | callback | AsyncCallback<void> | Yes | Callback invoked to return the result. | @@ -214,7 +214,7 @@ Deletes an RDB store. This API uses a promise to return the result. | Name | Type | Mandatory| Description | | ------- | ------- | ---- | ------------------------------------------------------------ | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-app-context.md).| | name | string | Yes | Name of the RDB store to delete. | **Return value** @@ -349,6 +349,10 @@ inDevices(devices: Array<string>): RdbPredicates Sets an **RdbPredicates** to specify the remote devices to connect on the network during distributed database synchronization. +> **NOTE** +> +> The value of **devices** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications. + **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **Parameters** @@ -366,8 +370,24 @@ Sets an **RdbPredicates** to specify the remote devices to connect on the networ **Example** ```js -let predicates = new data_rdb.RdbPredicates("EMPLOYEE") -predicates.inDevices(['12345678abcde']) +import deviceManager from '@ohos.distributedHardware.deviceManager'; +let dmInstance = null; +let deviceIds = []; + +deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => { + if (err) { + console.log("create device manager failed, err=" + err); + return; + } + dmInstance = manager; + let devices = dmInstance.getTrustedDeviceListSync(); + for (var i = 0; i < devices.length; i++) { + deviceIds[i] = devices[i].deviceId; + } +}) + +let predicates = new data_rdb.RdbPredicates("EMPLOYEE"); +predicates.inDevices(deviceIds); ``` ### inAllDevices8+ @@ -1154,7 +1174,7 @@ predicates.notIn("NAME", ["Lisa", "Rose"]) Provides methods to manage an RDB store. -Before using the following APIs, use [executeSql](#executesql8) to initialize the database table structure and related data. For details, see [RDB Development](../../database/database-relational-guidelines.md). +Before using the APIs of this class, use [executeSql](#executesql) to initialize the database table structure and related data. ### insert @@ -1269,10 +1289,10 @@ const valueBucket3 = { let valueBuckets = new Array(valueBucket1, valueBucket2, valueBucket3); rdbStore.batchInsert("EMPLOYEE", valueBuckets, function(status, insertNum) { if (status) { - console.log("Failed to batch insert data, status = " + status); + console.log("batchInsert is failed, status = " + status); return; } - console.log("Batch inserted data successfully. The number of values that were inserted = " + insertNum); + console.log("batchInsert is successful, the number of values that were inserted = " + insertNum); }) ``` @@ -1322,9 +1342,9 @@ const valueBucket3 = { let valueBuckets = new Array(valueBucket1, valueBucket2, valueBucket3); let promise = rdbStore.batchInsert("EMPLOYEE", valueBuckets); promise.then((insertNum) => { - console.log("Batch inserted data successfully. The number of values that were inserted = " + insertNum); + console.log("batchInsert is successful, the number of values that were inserted = " + insertNum); }).catch((status) => { - console.log("Failed to batch insert data, status = " + status); + console.log("batchInsert is failed, status = " + status); }) ``` @@ -1340,7 +1360,7 @@ Updates data in the RDB store based on the specified **RdbPredicates** object. T | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| values | [ValuesBucket](#valuesbucket) | Yes| Data to update in the RDB store. 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 invoked to return the number of rows updated.| @@ -1376,7 +1396,7 @@ Updates data based on the specified **RdbPredicates** object. This API uses a pr | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| values | [ValuesBucket](#valuesbucket) | Yes| Data to update in the RDB store. 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** @@ -1545,7 +1565,7 @@ Queries data in the RDB store using the specified SQL statement. This API uses a | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | sql | string | Yes| SQL statement to run.| -| bindArgs | Array<[ValueType](#valuetype)> | Yes| Arguments in the SQL statement.| +| bindArgs | Array<[ValueType](#valuetype)> | Yes| Arguments in the SQL statement. The value corresponds to the placeholders in the SQL parameter statement. If the SQL parameter statement is complete, the value of this parameter must be an empty array.| | callback | AsyncCallback<[ResultSet](js-apis-data-resultset.md)> | Yes| Callback invoked to return the result. If the operation is successful, a **ResultSet** object will be returned.| **Example** @@ -1565,7 +1585,7 @@ rdbStore.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = ?", 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. +Queries data using the specified SQL statement. This API uses a promise to return the result. **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core @@ -1574,7 +1594,7 @@ Queries data in the RDB store using the specified SQL statement. This API uses a | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | sql | string | Yes| SQL statement to run.| -| bindArgs | Array<[ValueType](#valuetype)> | No| Arguments in the SQL statement.| +| bindArgs | Array<[ValueType](#valuetype)> | No| Arguments in the SQL statement. The value corresponds to the placeholders in the SQL parameter statement. If the SQL parameter statement is complete, leave this parameter blank.| **Return value** @@ -1585,7 +1605,7 @@ Queries data in the RDB store using the specified SQL statement. This API uses a **Example** ```js -let promise = rdbStore.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = ?", ['sanguo']) +let promise = rdbStore.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = 'sanguo'") promise.then((resultSet) => { console.log("ResultSet column names: " + resultSet.columnNames) console.log("ResultSet column count: " + resultSet.columnCount) @@ -1607,19 +1627,19 @@ Executes an SQL statement that contains specified arguments but returns no value | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | sql | string | Yes| SQL statement to run.| -| bindArgs | Array<[ValueType](#valuetype)> | Yes| Arguments in the SQL statement.| +| bindArgs | Array<[ValueType](#valuetype)> | Yes| Arguments in the SQL statement. The value corresponds to the placeholders in the SQL parameter statement. If the SQL parameter statement is complete, the value of this parameter must be an empty array.| | callback | AsyncCallback<void> | Yes| Callback invoked to return the result.| **Example** ```js -const SQL_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS EMPLOYEE (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL, AGE INTEGER, SALARY REAL, CODES BLOB)" -rdbStore.executeSql(SQL_CREATE_TABLE, null, function(err) { +const SQL_DELETE_TABLE = "DELETE FROM test WHERE name = ?" +rdbStore.executeSql(SQL_CREATE_TABLE, ['zhangsan'], function(err) { if (err) { console.info("Failed to execute SQL, err: " + err) return } - console.info('Created table successfully.') + console.info('Delete table done.') }) ``` @@ -1636,7 +1656,7 @@ Executes an SQL statement that contains specified arguments but returns no value | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | sql | string | Yes| SQL statement to run.| -| bindArgs | Array<[ValueType](#valuetype)> | No| Arguments in the SQL statement.| +| bindArgs | Array<[ValueType](#valuetype)> | No| Arguments in the SQL statement. The value corresponds to the placeholders in the SQL parameter statement. If the SQL parameter statement is complete, leave this parameter blank.| **Return value** @@ -1647,10 +1667,10 @@ Executes an SQL statement that contains specified arguments but returns no value **Example** ```js -const SQL_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS EMPLOYEE (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL, AGE INTEGER, SALARY REAL, CODES BLOB)" -let promise = rdbStore.executeSql(SQL_CREATE_TABLE) +const SQL_DELETE_TABLE = "DELETE FROM test WHERE name = 'zhangsan'" +let promise = rdbStore.executeSql(SQL_DELETE_TABLE) promise.then(() => { - console.info('Created table successfully.') + console.info('Delete table done.') }).catch((err) => { console.info("Failed to execute SQL, err: " + err) }) @@ -1808,7 +1828,11 @@ promise.then(() => { obtainDistributedTableName(device: string, table: string, callback: AsyncCallback<string>): void -Obtains the distributed table name for a remote device based on the local table name. This API uses an asynchronous callback to return the result. The distributed table name is required when the RDB store of a remote device is queried. +Obtains the distributed table name of a remote device based on the local table name of the device. The distributed table name is required when the RDB store of a remote device is queried. + +> **NOTE** +> +> The value of **device** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications. **Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC @@ -1818,14 +1842,29 @@ Obtains the distributed table name for a remote device based on the local table | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| device | string | Yes| Remote device.| -| table | string | Yes| Local table name.| +| device | string | Yes| ID of the remote device.| +| table | string | Yes| Local table name of the remote device.| | callback | AsyncCallback<string> | Yes| Callback invoked to return the result. If the operation succeeds, the distributed table name of the remote device is returned.| **Example** ```js -rdbStore.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err, tableName) { +import deviceManager from '@ohos.distributedHardware.deviceManager'; +let dmInstance = null; +let deviceId = null; + +deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => { + if (err) { + console.log("create device manager failed, err=" + err); + return; + } + dmInstance = manager; + let devices = dmInstance.getTrustedDeviceListSync(); + deviceId = devices[0].deviceId; +}) + + +rdbStore.obtainDistributedTableName(deviceId, "EMPLOYEE", function (err, tableName) { if (err) { console.info('Failed to obtain DistributedTableName, err: ' + err) return @@ -1838,7 +1877,11 @@ rdbStore.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err, obtainDistributedTableName(device: string, table: string): Promise<string> -Obtains the distributed table name for a remote device based on the local table name. This API uses a promise to return the result. The distributed table name is required when the RDB store of a remote device is queried. +Obtains the distributed table name of a remote device based on the local table name of the device. The distributed table name is required when the RDB store of a remote device is queried. + +> **NOTE** +> +> The value of **device** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications. **Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC @@ -1848,8 +1891,8 @@ Obtains the distributed table name for a remote device based on the local table | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| device | string | Yes| Remote device.| -| table | string | Yes| Local table name.| +| device | string | Yes| ID of the remote device.| +| table | string | Yes| Local table name of the remote device.| **Return value** @@ -1860,7 +1903,21 @@ Obtains the distributed table name for a remote device based on the local table **Example** ```js -let promise = rdbStore.obtainDistributedTableName("12345678abcde", "EMPLOYEE") +import deviceManager from '@ohos.distributedHardware.deviceManager'; +let dmInstance = null; +let deviceId = null; + +deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => { + if (err) { + console.log("create device manager failed, err=" + err); + return; + } + dmInstance = manager; + let devices = dmInstance.getTrustedDeviceListSync(); + deviceId = devices[0].deviceId; +}) + +let promise = rdbStore.obtainDistributedTableName(deviceId, "EMPLOYEE") promise.then((tableName) => { console.info('Obtained distributed table name successfully, tableName= ' + tableName) }).catch((err) => { @@ -1889,8 +1946,24 @@ Synchronizes data between devices. This API uses an asynchronous callback to ret **Example** ```js +import deviceManager from '@ohos.distributedHardware.deviceManager'; +let dmInstance = null; +let deviceIds = []; + +deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => { + if (err) { + console.log("create device manager failed, err=" + err); + return; + } + dmInstance = manager; + let devices = dmInstance.getTrustedDeviceListSync(); + for (var i = 0; i < devices.length; i++) { + deviceIds[i] = devices[i].deviceId; + } +}) + let predicates = new data_rdb.RdbPredicates('EMPLOYEE') -predicates.inDevices(['12345678abcde']) +predicates.inDevices(deviceIds) rdbStore.sync(data_rdb.SyncMode.SYNC_MODE_PUSH, predicates, function (err, result) { if (err) { console.log('Sync failed, err: ' + err) @@ -1924,13 +1997,29 @@ Synchronizes data between devices. This API uses a promise to return the result. | Type| Description| | -------- | -------- | -| Promise<Array<[string, number]>> | Promise used to return the synchronization result to the caller.
**string** indicates the device ID.
**number** indicates the synchronization status of that device. The value **0** indicates a successful synchronization. Other values indicate a synchronization failure. | +| Promise<Array<[string, number]>> | Promise used to send the synchronization result.
**string** indicates the device ID.
**number** indicates the synchronization status of that device. The value **0** indicates a successful synchronization. Other values indicate a synchronization failure. | **Example** ```js +import deviceManager from '@ohos.distributedHardware.deviceManager'; +let dmInstance = null; +let deviceIds = []; + +deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => { + if (err) { + console.log("create device manager failed, err=" + err); + return; + } + dmInstance = manager; + let devices = dmInstance.getTrustedDeviceListSync(); + for (var i = 0; i < devices.length; i++) { + deviceIds[i] = devices[i].deviceId; + } +}) + let predicates = new data_rdb.RdbPredicates('EMPLOYEE') -predicates.inDevices(['12345678abcde']) +predicates.inDevices(deviceIds) let promise = rdbStore.sync(data_rdb.SyncMode.SYNC_MODE_PUSH, predicates) promise.then((result) =>{ console.log('Sync done.') diff --git a/en/application-dev/reference/apis/js-apis-data-relationalStore.md b/en/application-dev/reference/apis/js-apis-data-relationalStore.md index 1b9948db2d3decf6b7d21d17cb74b53450ae3865..3e7e078f595f8468bf78cc953f5267c5515360a2 100644 --- a/en/application-dev/reference/apis/js-apis-data-relationalStore.md +++ b/en/application-dev/reference/apis/js-apis-data-relationalStore.md @@ -1,6 +1,6 @@ # @ohos.data.relationalStore (RDB Store) -The relational database (RDB) store manages data based on relational models. With the underlying SQLite database, the RDB store provides a complete mechanism for managing local databases. To satisfy different needs in complicated scenarios, the RDB store offers a series of APIs for performing operations such as adding, deleting, modifying, and querying data, and supports direct execution of SQL statements. +The relational database (RDB) store manages data based on relational models. With the underlying SQLite database, the RDB store provides a complete mechanism for managing local databases. To satisfy different needs in complicated scenarios, the RDB store offers a series of APIs for performing operations such as adding, deleting, modifying, and querying data, and supports direct execution of SQL statements. The worker threads are not supported. The **relationalStore** module provides the following functions: @@ -8,7 +8,7 @@ The **relationalStore** module provides the following functions: - [RdbStore](#rdbstore): provides APIs for managing data in an RDB store. - [Resultset](#resultset): provides APIs for accessing the result set obtained from the RDB store. -> **NOTE**
+> **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. @@ -30,7 +30,7 @@ Obtains an RDB store. This API uses an asynchronous callback to return the resul | Name | Type | Mandatory| Description | | -------- | ---------------------------------------------- | ---- | ------------------------------------------------------------ | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md).| | config | [StoreConfig](#storeconfig) | Yes | Configuration of the RDB store. | | callback | AsyncCallback<[RdbStore](#rdbstore)> | Yes | Callback invoked to return the RDB store obtained. | @@ -108,14 +108,14 @@ Obtains an RDB store. This API uses a promise to return the result. You can set | Name | Type | Mandatory| Description | | ------- | -------------------------------- | ---- | ------------------------------------------------------------ | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md).| | config | [StoreConfig](#storeconfig) | Yes | Configuration of the RDB store. | **Return value** | Type | Description | | ----------------------------------------- | --------------------------------- | -| Promise<[RdbStore](#rdbstore)> | Promise used to return the RDB store obtained.| +| Promise<[RdbStore](#rdbstore)> | Promise used to return the **RdbStore** object.| **Error codes** @@ -188,7 +188,7 @@ Deletes an RDB store. This API uses an asynchronous callback to return the resul | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ------------------------------------------------------------ | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md).| | name | string | Yes | Name of the RDB store to delete. | | callback | AsyncCallback<void> | Yes | Callback invoked to return the result. | @@ -249,7 +249,7 @@ Deletes an RDB store. This API uses a promise to return the result. | Name | Type | Mandatory| Description | | ------- | ------- | ---- | ------------------------------------------------------------ | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md).| | name | string | Yes | Name of the RDB store to delete. | **Return value** @@ -317,6 +317,10 @@ Defines the RDB store configuration. Enumerates the RDB store security levels. +> **NOTE** +> +> To perform data synchronization operations, the RDB store security level must be lower than or equal to that of the peer device. For details, see the [Cross-Device Data Synchronization Mechanism](../../database/sync-app-data-across-devices-overview.md#cross-device-data-synchronization-mechanism). + **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core | Name| Value | Description | @@ -414,9 +418,12 @@ let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); inDevices(devices: Array<string>): RdbPredicates - Sets an **RdbPredicates** to specify the remote devices to connect on the network during distributed database synchronization. +> **NOTE** +> +> The value of **devices** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications. + **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **Parameters** @@ -434,8 +441,24 @@ Sets an **RdbPredicates** to specify the remote devices to connect on the networ **Example** ```js +import deviceManager from '@ohos.distributedHardware.deviceManager'; +let dmInstance = null; +let deviceIds = []; + +deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => { + if (err) { + console.log("create device manager failed, err=" + err); + return; + } + dmInstance = manager; + let devices = dmInstance.getTrustedDeviceListSync(); + for (var i = 0; i < devices.length; i++) { + deviceIds[i] = devices[i].deviceId; + } +}) + let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); -predicates.inDevices(['12345678abcde']); +predicates.inDevices(deviceIds); ``` ### inAllDevices @@ -1225,9 +1248,9 @@ predicates.notIn("NAME", ["Lisa", "Rose"]); ## RdbStore -Provides methods to manage an RDB store. +Provides APIs to manage an RDB store. -Before using the following APIs, use [executeSql](#executesql) to initialize the database table structure and related data. For details, see [RDB Development](../../database/database-relational-guidelines.md). +Before using the APIs of this class, use [executeSql](#executesql) to initialize the database table structure and related data. ### Attributes10+ @@ -1262,6 +1285,14 @@ Inserts a row of data into a table. This API uses an asynchronous callback to re | values | [ValuesBucket](#valuesbucket) | Yes | Row of data to insert. | | callback | AsyncCallback<number> | Yes | Callback invoked to return the result. If the operation is successful, the row ID will be returned. Otherwise, **-1** will be returned.| +**Error codes** + +For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). + +| **ID**| **Error Message** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **Example** ```js @@ -1297,6 +1328,14 @@ Inserts a row of data into a table. This API uses an asynchronous callback to re | conflict | [ConflictResolution](#conflictresolution10) | Yes | Resolution used to resolve the conflict. | | callback | AsyncCallback<number> | Yes | Callback invoked to return the result. If the operation is successful, the row ID will be returned. Otherwise, **-1** will be returned.| +**Error codes** + +For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). + +| **ID**| **Error Message** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **Example** ```js @@ -1336,6 +1375,14 @@ Inserts a row of data into a table. This API uses a promise to return the result | --------------------- | ------------------------------------------------- | | Promise<number> | Promise used to return the result. If the operation is successful, the row ID will be returned. Otherwise, **-1** will be returned.| +**Error codes** + +For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). + +| **ID**| **Error Message** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **Example** ```js @@ -1375,6 +1422,14 @@ Inserts a row of data into a table. This API uses a promise to return the result | --------------------- | ------------------------------------------------- | | Promise<number> | Promise used to return the result. If the operation is successful, the row ID will be returned. Otherwise, **-1** will be returned.| +**Error codes** + +For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). + +| **ID**| **Error Message** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **Example** ```js @@ -1408,6 +1463,14 @@ Batch inserts data into a table. This API uses an asynchronous callback to retur | values | Array<[ValuesBucket](#valuesbucket)> | Yes | An array of data to insert. | | callback | AsyncCallback<number> | Yes | Callback invoked to return the result. If the operation is successful, the number of inserted data records is returned. Otherwise, **-1** is returned.| +**Error codes** + +For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). + +| **ID**| **Error Message** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **Example** ```js @@ -1461,6 +1524,14 @@ Batch inserts data into a table. This API uses a promise to return the result. | --------------------- | ----------------------------------------------------------- | | Promise<number> | Promise used to return the result. If the operation is successful, the number of inserted data records is returned. Otherwise, **-1** is returned.| +**Error codes** + +For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). + +| **ID**| **Error Message** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **Example** ```js @@ -1508,6 +1579,14 @@ Updates data in the RDB store based on the specified **RdbPredicates** object. T | predicates | [RdbPredicates](#rdbpredicates) | Yes | Update conditions specified by the **RdbPredicates** object. | | callback | AsyncCallback<number> | Yes | Callback invoked to return the number of rows updated. | +**Error codes** + +For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). + +| **ID**| **Error Message** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **Example** ```js @@ -1545,6 +1624,14 @@ Updates data in the RDB store based on the specified **RdbPredicates** object. T | conflict | [ConflictResolution](#conflictresolution10) | Yes | Resolution used to resolve the conflict. | | callback | AsyncCallback<number> | Yes | Callback invoked to return the number of rows updated. | +**Error codes** + +For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). + +| **ID**| **Error Message** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **Example** ```js @@ -1586,6 +1673,14 @@ Updates data based on the specified **RdbPredicates** object. This API uses a pr | --------------------- | ----------------------------------------- | | Promise<number> | Promise used to return the number of rows updated.| +**Error codes** + +For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). + +| **ID**| **Error Message** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **Example** ```js @@ -1627,6 +1722,14 @@ Updates data based on the specified **RdbPredicates** object. This API uses a pr | --------------------- | ----------------------------------------- | | Promise<number> | Promise used to return the number of rows updated.| +**Error codes** + +For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). + +| **ID**| **Error Message** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **Example** ```js @@ -1665,6 +1768,14 @@ Updates data based on the specified **DataSharePredicates** object. This API use | predicates | [dataSharePredicates.DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes | Update conditions specified by the **DataSharePredicates** object. | | callback | AsyncCallback<number> | Yes | Callback invoked to return the number of rows updated. | +**Error codes** + +For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). + +| **ID**| **Error Message** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **Example** ```js @@ -1710,6 +1821,14 @@ Updates data based on the specified **DataSharePredicates** object. This API use | --------------------- | ----------------------------------------- | | Promise<number> | Promise used to return the number of rows updated.| +**Error codes** + +For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). + +| **ID**| **Error Message** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **Example** ```js @@ -1745,6 +1864,14 @@ Deletes data from the RDB store based on the specified **RdbPredicates** object. | predicates | [RdbPredicates](#rdbpredicates) | Yes | Conditions specified by the **RdbPredicates** object for deleting data.| | callback | AsyncCallback<number> | Yes | Callback invoked to return the number of rows deleted. | +**Error codes** + +For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). + +| **ID**| **Error Message** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **Example** ```js @@ -1779,6 +1906,14 @@ Deletes data from the RDB store based on the specified **RdbPredicates** object. | --------------------- | ------------------------------- | | Promise<number> | Promise used to return the number of rows deleted.| +**Error codes** + +For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). + +| **ID**| **Error Message** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **Example** ```js @@ -1810,6 +1945,14 @@ Deletes data from the RDB store based on the specified **DataSharePredicates** o | predicates | [dataSharePredicates.DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes | Conditions specified by the **DataSharePredicates** object for deleting data.| | callback | AsyncCallback<number> | Yes | Callback invoked to return the number of rows deleted. | +**Error codes** + +For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). + +| **ID**| **Error Message** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **Example** ```js @@ -1848,6 +1991,14 @@ Deletes data from the RDB store based on the specified **DataSharePredicates** o | --------------------- | ------------------------------- | | Promise<number> | Promise used to return the number of rows deleted.| +**Error codes** + +For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). + +| **ID**| **Error Message** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **Example** ```js @@ -2008,24 +2159,42 @@ remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: A Queries data from the RDB store of a remote device based on specified conditions. This API uses an asynchronous callback to return the result. +> **NOTE** +> +> The value of **device** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications. + **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **Parameters** -| Name | Type | Mandatory| Description | -| ---------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | -| device | string | Yes | Network ID of the remote device. | -| table | string | Yes | Name of the target table. | -| predicates | [RdbPredicates](#rdbpredicates) | Yes | Query conditions specified by the **RdbPredicates** object. | -| columns | Array<string> | Yes | Columns to query. If this parameter is not specified, the query applies to all columns. | +| Name | Type | Mandatory| Description | +| ---------- | -------------------------------------------- | ---- | --------------------------------------------------------- | +| device | string | Yes | ID of the remote device. | +| table | string | Yes | Name of the target table. | +| predicates | [RdbPredicates](#rdbpredicates) | Yes | Query conditions specified by the **RdbPredicates** object. | +| columns | Array<string> | Yes | Columns to query. If this parameter is not specified, the query applies to all columns. | | callback | AsyncCallback<[ResultSet](#resultset)> | Yes | Callback invoked to return the result. If the operation is successful, a **ResultSet** object will be returned.| **Example** ```js +import deviceManager from '@ohos.distributedHardware.deviceManager'; +let dmInstance = null; +let deviceId = null; + +deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => { + if (err) { + console.log("create device manager failed, err=" + err); + return; + } + dmInstance = manager; + let devices = dmInstance.getTrustedDeviceListSync(); + deviceId = devices[0].deviceId; +}) + let predicates = new relationalStore.RdbPredicates('EMPLOYEE'); predicates.greaterThan("id", 0); -store.remoteQuery("deviceId", "EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], +store.remoteQuery(deviceId, "EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], function(err, resultSet) { if (err) { console.error(`Failed to remoteQuery, err: ${err}`); @@ -2043,13 +2212,17 @@ remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: A Queries data from the RDB store of a remote device based on specified conditions. This API uses a promise to return the result. +> **NOTE** +> +> The value of **device** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications. + **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core **Parameters** | Name | Type | Mandatory| Description | | ---------- | ------------------------------------ | ---- | ------------------------------------------------ | -| device | string | Yes | Network ID of the remote device. | +| device | string | Yes | ID of the remote device. | | table | string | Yes | Name of the target table. | | predicates | [RdbPredicates](#rdbpredicates) | Yes | Query conditions specified by the **RdbPredicates** object. | | columns | Array<string> | Yes | Columns to query. If this parameter is not specified, the query applies to all columns.| @@ -2063,9 +2236,23 @@ Queries data from the RDB store of a remote device based on specified conditions **Example** ```js +import deviceManager from '@ohos.distributedHardware.deviceManager'; +let dmInstance = null; +let deviceId = null; + +deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => { + if (err) { + console.log("create device manager failed, err=" + err); + return; + } + dmInstance = manager; + let devices = dmInstance.getTrustedDeviceListSync(); + deviceId = devices[0].deviceId; +}) + let predicates = new relationalStore.RdbPredicates('EMPLOYEE'); predicates.greaterThan("id", 0); -let promise = store.remoteQuery("deviceId", "EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]); +let promise = store.remoteQuery(deviceId, "EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]); promise.then((resultSet) => { console.info(`ResultSet column names: ${resultSet.columnNames}`); console.info(`ResultSet column count: ${resultSet.columnCount}`); @@ -2084,11 +2271,11 @@ Queries data using the specified SQL statement. This API uses an asynchronous ca **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | -| sql | string | Yes | SQL statement to run. | -| bindArgs | Array<[ValueType](#valuetype)> | Yes | Arguments in the SQL statement. | -| callback | AsyncCallback<[ResultSet](#resultset)> | Yes | Callback invoked to return the result. If the operation is successful, a **ResultSet** object will be returned.| +| Name | Type | Mandatory| Description | +| -------- | -------------------------------------------- | ---- | ------------------------------------------------------------ | +| sql | string | Yes | SQL statement to run. | +| bindArgs | Array<[ValueType](#valuetype)> | Yes | Arguments in the SQL statement. The value corresponds to the placeholders in the SQL parameter statement. If the SQL parameter statement is complete, the value of this parameter must be an empty array.| +| callback | AsyncCallback<[ResultSet](#resultset)> | Yes | Callback invoked to return the result. If the operation is successful, a **ResultSet** object will be returned. | **Example** @@ -2113,10 +2300,10 @@ Queries data using the specified SQL statement. This API uses a promise to retur **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ------------------------------------ | ---- | --------------------- | -| sql | string | Yes | SQL statement to run.| -| bindArgs | Array<[ValueType](#valuetype)> | No | Arguments in the SQL statement. | +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------ | ---- | ------------------------------------------------------------ | +| sql | string | Yes | SQL statement to run. | +| bindArgs | Array<[ValueType](#valuetype)> | No | Arguments in the SQL statement. The value corresponds to the placeholders in the SQL parameter statement. If the SQL parameter statement is complete, leave this parameter blank.| **Return value** @@ -2127,7 +2314,7 @@ Queries data using the specified SQL statement. This API uses a promise to retur **Example** ```js -let promise = store.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = ?", ['sanguo']); +let promise = store.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = 'sanguo'"); promise.then((resultSet) => { console.info(`ResultSet column names: ${resultSet.columnNames}`); console.info(`ResultSet column count: ${resultSet.columnCount}`); @@ -2146,22 +2333,30 @@ Executes an SQL statement that contains specified arguments but returns no value **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ------------------------------------ | ---- | ---------------------- | -| sql | string | Yes | SQL statement to run. | -| bindArgs | Array<[ValueType](#valuetype)> | Yes | Arguments in the SQL statement. | -| callback | AsyncCallback<void> | Yes | Callback invoked to return the result.| +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------ | ---- | ------------------------------------------------------------ | +| sql | string | Yes | SQL statement to run. | +| bindArgs | Array<[ValueType](#valuetype)> | Yes | Arguments in the SQL statement. The value corresponds to the placeholders in the SQL parameter statement. If the SQL parameter statement is complete, the value of this parameter must be an empty array.| +| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. | + +**Error codes** + +For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). + +| **ID**| **Error Message** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| **Example** ```js -const SQL_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS EMPLOYEE (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL, AGE INTEGER, SALARY REAL, CODES BLOB)" -store.executeSql(SQL_CREATE_TABLE, null, function(err) { +const SQL_DELETE_TABLE = "DELETE FROM test WHERE name = ?" +store.executeSql(SQL_DELETE_TABLE, ['zhangsan'], function(err) { if (err) { console.error(`ExecuteSql failed, err: ${err}`); return; } - console.info(`Create table done.`); + console.info(`Delete table done.`); }) ``` @@ -2175,10 +2370,10 @@ Executes an SQL statement that contains specified arguments but returns no value **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ------------------------------------ | ---- | --------------------- | -| sql | string | Yes | SQL statement to run.| -| bindArgs | Array<[ValueType](#valuetype)> | No | Arguments in the SQL statement. | +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------ | ---- | ------------------------------------------------------------ | +| sql | string | Yes | SQL statement to run. | +| bindArgs | Array<[ValueType](#valuetype)> | No | Arguments in the SQL statement. The value corresponds to the placeholders in the SQL parameter statement. If the SQL parameter statement is complete, leave this parameter blank.| **Return value** @@ -2186,13 +2381,21 @@ Executes an SQL statement that contains specified arguments but returns no value | ------------------- | ------------------------- | | Promise<void> | Promise that returns no value.| +**Error codes** + +For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). + +| **ID**| **Error Message** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **Example** ```js -const SQL_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS EMPLOYEE (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL, AGE INTEGER, SALARY REAL, CODES BLOB)" -let promise = store.executeSql(SQL_CREATE_TABLE); +const SQL_DELETE_TABLE = "DELETE FROM test WHERE name = 'zhangsan'" +let promise = store.executeSql(SQL_DELETE_TABLE); promise.then(() => { - console.info(`Create table done.`); + console.info(`Delete table done.`); }).catch((err) => { console.error(`ExecuteSql failed, err: ${err}`); }) @@ -2206,6 +2409,14 @@ Starts the transaction before executing an SQL statement. **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core +**Error codes** + +For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode-data-rdb.md). + +| **ID**| **Error Message** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **Example** ```js @@ -2488,7 +2699,11 @@ promise.then(() => { obtainDistributedTableName(device: string, table: string, callback: AsyncCallback<string>): void -Obtains the distributed table name for a remote device based on the local table name. This API uses an asynchronous callback to return the result. The distributed table name is required when the RDB store of a remote device is queried. +Obtains the distributed table name of a remote device based on the local table name of the device. The distributed table name is required when the RDB store of a remote device is queried. + +> **NOTE** +> +> The value of **device** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications. **Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC @@ -2498,14 +2713,28 @@ Obtains the distributed table name for a remote device based on the local table | Name | Type | Mandatory| Description | | -------- | --------------------------- | ---- | ------------------------------------------------------------ | -| device | string | Yes | Remote device. | -| table | string | Yes | Local table name. | +| device | string | Yes | ID of the remote device. | +| table | string | Yes | Local table name of the remote device. | | callback | AsyncCallback<string> | Yes | Callback invoked to return the result. If the operation succeeds, the distributed table name of the remote device is returned.| **Example** ```js -store.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err, tableName) { +import deviceManager from '@ohos.distributedHardware.deviceManager'; +let dmInstance = null; +let deviceId = null; + +deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => { + if (err) { + console.log("create device manager failed, err=" + err); + return; + } + dmInstance = manager; + let devices = dmInstance.getTrustedDeviceListSync(); + deviceId = devices[0].deviceId; +}) + +store.obtainDistributedTableName(deviceId, "EMPLOYEE", function (err, tableName) { if (err) { console.error(`ObtainDistributedTableName failed, err: ${err}`); return; @@ -2518,7 +2747,11 @@ store.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err, tab obtainDistributedTableName(device: string, table: string): Promise<string> -Obtains the distributed table name for a remote device based on the local table name. This API uses a promise to return the result. The distributed table name is required when the RDB store of a remote device is queried. +Obtains the distributed table name of a remote device based on the local table name of the device. The distributed table name is required when the RDB store of a remote device is queried. + +> **NOTE** +> +> The value of **device** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications. **Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC @@ -2526,10 +2759,10 @@ Obtains the distributed table name for a remote device based on the local table **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ---------- | -| device | string | Yes | Remote device.| -| table | string | Yes | Local table name.| +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | -------------------- | +| device | string | Yes | ID of the remote device. | +| table | string | Yes | Local table name of the remote device.| **Return value** @@ -2540,7 +2773,21 @@ Obtains the distributed table name for a remote device based on the local table **Example** ```js -let promise = store.obtainDistributedTableName("12345678abcde", "EMPLOYEE"); +import deviceManager from '@ohos.distributedHardware.deviceManager'; +let dmInstance = null; +let deviceId = null; + +deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => { + if (err) { + console.log("create device manager failed, err=" + err); + return; + } + dmInstance = manager; + let devices = dmInstance.getTrustedDeviceListSync(); + deviceId = devices[0].deviceId; +}) + +let promise = store.obtainDistributedTableName(deviceId, "EMPLOYEE"); promise.then((tableName) => { console.info(`ObtainDistributedTableName successfully, tableName= ${tableName}`); }).catch((err) => { @@ -2569,8 +2816,24 @@ Synchronizes data between devices. This API uses an asynchronous callback to ret **Example** ```js +import deviceManager from '@ohos.distributedHardware.deviceManager'; +let dmInstance = null; +let deviceIds = []; + +deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => { + if (err) { + console.log("create device manager failed, err=" + err); + return; + } + dmInstance = manager; + let devices = dmInstance.getTrustedDeviceListSync(); + for (var i = 0; i < devices.length; i++) { + deviceIds[i] = devices[i].deviceId; + } +}) + let predicates = new relationalStore.RdbPredicates('EMPLOYEE'); -predicates.inDevices(['12345678abcde']); +predicates.inDevices(deviceIds); store.sync(relationalStore.SyncMode.SYNC_MODE_PUSH, predicates, function (err, result) { if (err) { console.error(`Sync failed, err: ${err}`); @@ -2609,12 +2872,28 @@ Synchronizes data between devices. This API uses a promise to return the result. **Example** ```js +import deviceManager from '@ohos.distributedHardware.deviceManager'; +let dmInstance = null; +let deviceIds = []; + +deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => { + if (err) { + console.log("create device manager failed, err=" + err); + return; + } + dmInstance = manager; + let devices = dmInstance.getTrustedDeviceListSync(); + for (var i = 0; i < devices.length; i++) { + deviceIds[i] = devices[i].deviceId; + } +}) + let predicates = new relationalStore.RdbPredicates('EMPLOYEE'); -predicates.inDevices(['12345678abcde']); +predicates.inDevices(deviceIds); let promise = store.sync(relationalStore.SyncMode.SYNC_MODE_PUSH, predicates); -promise.then((resultSet) =>{ +promise.then((result) =>{ console.info(`Sync done.`); - for (let i = 0; i < resultSet.length; i++) { + for (let i = 0; i < result.length; i++) { console.info(`device= ${result[i][0]}, status= ${result[i][1]}`); } }).catch((err) => { @@ -2634,9 +2913,9 @@ Registers an observer for this RDB store. When the data in the RDB store changes | Name | Type | Mandatory| Description | | -------- | ----------------------------------- | ---- | ------------------------------------------- | -| event | string | Yes | Event to observe. The value is **dataChange**, which indicates a data change event. | +| event | string | Yes | Event to observe. The value is **dataChange**, which indicates a data change event. | | type | [SubscribeType](#subscribetype) | Yes | Subscription type to register.| -| observer | Callback<Array<string>> | Yes | Callback invoked to return the data change event. | +| observer | Callback<Array<string>> | Yes | Callback invoked to return the data change event. | **Example** @@ -2657,7 +2936,7 @@ try { off(event:'dataChange', type: SubscribeType, observer: Callback<Array<string>>): void -Unregisters the observer of the specified type from the RDB store. This API uses an asynchronous callback to return the result. +Unregisters the observer of the specified type from the RDB store. This API uses a callback to return the result. **System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core @@ -2667,7 +2946,7 @@ Unregisters the observer of the specified type from the RDB store. This API uses | -------- | ---------------------------------- | ---- | ------------------------------------------ | | event | string | Yes | Event type. The value is **dataChange**, which indicates a data change event. | | type | [SubscribeType](#subscribetype) | Yes | Subscription type to unregister. | -| observer | Callback<Array<string>> | Yes | Callback for the data change event. | +| observer | Callback<Array<string>> | Yes | Callback for the data change event. | **Example** @@ -2693,10 +2972,12 @@ Provides APIs to access the result set obtained by querying the RDB store. A res Obtain the **resultSet** object first. ```js +let resultSet = null; let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.equalTo("AGE", 18); let promise = store.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]); -promise.then((resultSet) => { +promise.then((result) => { + resultSet = result; console.info(`resultSet columnNames: ${resultSet.columnNames}`); console.info(`resultSet columnCount: ${resultSet.columnCount}`); }); @@ -2867,7 +3148,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); let promise = store.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]); promise.then((resultSet) => { - resultSet.(5); + resultSet.goToRow(5); resultSet.close(); }).catch((err) => { console.error(`query failed, err: ${err}`); @@ -3180,3 +3461,5 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode | **ID**| **Error Message** | | ------------ | ------------------------------------------------------------ | | 14800012 | The result set is empty or the specified location is invalid. | + + 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 75e9293eadcd0a25fc923146b92246a885829df6..dbb9244fbe3f973baf0b307a80b7a0ed23482f71 100644 --- a/en/application-dev/reference/apis/js-apis-data-storage.md +++ b/en/application-dev/reference/apis/js-apis-data-storage.md @@ -7,8 +7,8 @@ The **DataStorage** module provides applications with data processing capability > > - 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. > -> - The APIs of this module are no longer maintained since API version 9. You are advised to use [`@ohos.data.preferences`](js-apis-data-preferences.md). -> +> - The APIs of this module are no longer maintained since API version 9. You are advised to use [@ohos.data.preferences](js-apis-data-preferences.md). +> > - The APIs of this module can be used only in the FA model. @@ -24,8 +24,8 @@ import data_storage from '@ohos.data.storage'; | Name | Type| Readable| Writable| Description | | ---------------- | -------- | ---- | ---- | ------------------------------------- | -| MAX_KEY_LENGTH | number | Yes | No | Maximum length of a key. It must be less than 80 bytes. | -| MAX_VALUE_LENGTH | number | Yes | No | Maximum length of a value. It must be less than 8192 bytes.| +| MAX_KEY_LENGTH | number | Yes | No | Maximum length of a key, which is 80 bytes. | +| MAX_VALUE_LENGTH | number | Yes | No | Maximum length of a value, which is 8192 bytes.| ## data_storage.getStorageSync @@ -79,7 +79,7 @@ Reads the specified file and loads its data to the **Storage** instance for data | Name | Type | Mandatory| Description | | -------- | ---------------------------------------- | ---- | -------------------------- | | path | string | Yes | Path of the target file.| -| callback | AsyncCallback<[Storage](#storage)> | Yes | Callback used to return the execution result. | +| callback | AsyncCallback<[Storage](#storage)> | Yes | Callback invoked to return the result. | **Example** @@ -172,7 +172,7 @@ context.getFilesDir().then((filePath) => { console.info("======================>getFilesDirPromise====================>"); data_storage.deleteStorageSync(path + '/mystore'); -}); +}); ``` ## data_storage.deleteStorage @@ -276,9 +276,9 @@ let context = featureAbility.getContext(); context.getFilesDir().then((filePath) => { path = filePath; console.info("======================>getFilesDirPromise====================>"); - + data_storage.removeStorageFromCacheSync(path + '/mystore'); -}); +}); ``` @@ -406,7 +406,7 @@ Obtains the value corresponding to a key. If the value is null or not of the def | -------- | ------------------------------ | ---- | ----------------------------------------- | | key | string | Yes | Key of the data. It cannot be empty. | | defValue | [ValueType](#valuetype) | Yes | Default value to be returned. It can be a number, string, or Boolean value.| -| callback | AsyncCallback<ValueType> | Yes | Callback used to return the execution result. | +| callback | AsyncCallback<ValueType> | Yes | Callback invoked to return the result. | **Example** @@ -581,7 +581,7 @@ Checks whether the storage object contains data with a given key. This API uses | Name | Type | Mandatory| Description | | -------- | ---------------------------- | ---- | ------------------------------- | | key | string | Yes | Key of the data. It cannot be empty.| -| callback | AsyncCallback<boolean> | Yes | Callback used to return the execution result. | +| callback | AsyncCallback<boolean> | Yes | Callback invoked to return the result. | **Return value** @@ -867,7 +867,7 @@ Subscribes to data changes. The **StorageObserver** needs to be implemented. Whe | Name | Type | Mandatory| Description | | -------- | --------------------------------------------------- | ------ |---------------------------------------- | | type | string |Yes| Event type. The value **change** indicates data change events.| -| callback | Callback<[StorageObserver](#storageobserver)> | Yes|Callback used to return data changes. | +| callback | Callback<[StorageObserver](#storageobserver)> | Yes|Callback invoked to return the data change. | **Example** @@ -894,7 +894,7 @@ Unsubscribes from data changes. | Name | Type | Mandatory| Description | | -------- | --------------------------------------------------- | ------ |---------------------------------------- | | type | string |Yes| Event type. The value **change** indicates data change events.| -| callback | Callback<[StorageObserver](#storageobserver)> | Yes|Callback used to return data changes. | +| callback | Callback<[StorageObserver](#storageobserver)> | Yes|Callback for the data change. | **Example** diff --git a/en/application-dev/reference/apis/js-apis-defaultAppManager.md b/en/application-dev/reference/apis/js-apis-defaultAppManager.md index ad8ab9f54dfd43754e6e00cdfbe5ba5c9e1d39c4..4b6512f5a040108714c782387e81393a9dab4df7 100644 --- a/en/application-dev/reference/apis/js-apis-defaultAppManager.md +++ b/en/application-dev/reference/apis/js-apis-defaultAppManager.md @@ -109,7 +109,7 @@ Obtains the default application based on a system-defined application type or a **System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Parameters** @@ -165,7 +165,7 @@ Obtains the default application of a user based on a system-defined application **System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Parameters** @@ -217,7 +217,7 @@ Obtains the default application based on a system-defined application type or a **System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Parameters** @@ -266,7 +266,7 @@ Sets the default application based on a system-defined application type or a fil **System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Parameters** @@ -338,7 +338,7 @@ Sets the default application for a user based on a system-defined application ty **System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Parameters** @@ -399,7 +399,7 @@ Sets the default application based on a system-defined application type or a fil **System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Parameters** @@ -458,7 +458,7 @@ Resets the default application based on a system-defined application type or a f **System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Parameters** @@ -508,7 +508,7 @@ Resets the default application for a user based on a system-defined application **System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Parameters** @@ -559,7 +559,7 @@ Resets the default application based on a system-defined application type or a f **System capability**: SystemCapability.BundleManager.BundleFramework.DefaultApp -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Parameters** diff --git a/en/application-dev/reference/apis/js-apis-device-manager.md b/en/application-dev/reference/apis/js-apis-device-manager.md index 60e97b69134e1b1b962fc1f5e67e790a00daea4a..5d6b71b99b23044250b231f34630a973f0705515 100644 --- a/en/application-dev/reference/apis/js-apis-device-manager.md +++ b/en/application-dev/reference/apis/js-apis-device-manager.md @@ -96,7 +96,7 @@ Enumerates the device types. | CAR | 0x83 | Car. | | UNKNOWN_TYPE | 0 | Unknown device type.| -## AuthForm +## AuthForm10+ Enumerates the device authentication types. @@ -131,12 +131,12 @@ Defines subscription information. | Name | Type | Mandatory | Description | | ------------- | --------------------------------- | ---- | ----------------- | | subscribeId | number | Yes | Subscription ID, used to identify a device discovery period.| -| mode | [DiscoverMode ](#discovermode) | No | Device discovery mode. | -| medium | [ExchangeMedium](#exchangemedium) | No | Medium used for device discovery. | -| freq | [ExchangeFreq](#exchangefreq) | No | Frequency of device discovery. | -| isSameAccount | boolean | No | Whether the same account is used on the discovered device. | -| isWakeRemote | boolean | No | Whether to wake up the discovered device. | -| capability | [SubscribeCap](#subscribecap) | No | Discovery capability. | +| mode | [DiscoverMode ](#discovermode) | Yes | Device discovery mode. | +| medium | [ExchangeMedium](#exchangemedium) | Yes | Medium used for device discovery. | +| freq | [ExchangeFreq](#exchangefreq) | Yes | Frequency of device discovery. | +| isSameAccount | boolean | Yes | Whether the same account is used on the discovered device. | +| isWakeRemote | boolean | Yes | Whether to wake up the discovered device. | +| capability | [SubscribeCap](#subscribecap) | Yes | Discovery capability. | ## DiscoverMode @@ -262,8 +262,6 @@ getTrustedDeviceListSync(): Array<DeviceInfo> Obtains all trusted devices synchronously. -**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications) - **System capability**: SystemCapability.DistributedHardware.DeviceManager **Return value** @@ -296,8 +294,6 @@ getTrustedDeviceList(callback:AsyncCallback<Array<DeviceInfo>>): voi Obtains all trusted devices. This API uses an asynchronous callback to return the result. -**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications) - **System capability**: SystemCapability.DistributedHardware.DeviceManager **Parameters** @@ -336,8 +332,6 @@ getTrustedDeviceList(): Promise<Array<DeviceInfo>> Obtains all trusted devices. This API uses a promise to return the result. -**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications) - **System capability**: SystemCapability.DistributedHardware.DeviceManager **Return value** @@ -370,8 +364,6 @@ getLocalDeviceInfoSync(): [DeviceInfo](#deviceinfo) Obtains local device information synchronously. -**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications) - **System capability**: SystemCapability.DistributedHardware.DeviceManager **Return value** @@ -404,8 +396,6 @@ getLocalDeviceInfo(callback:AsyncCallback<DeviceInfo>): void Obtains local device information. This API uses an asynchronous callback to return the result. -**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications) - **System capability**: SystemCapability.DistributedHardware.DeviceManager **Parameters** @@ -444,8 +434,6 @@ getLocalDeviceInfo(): Promise<DeviceInfo> Obtains local device information. This API uses a promise to return the result. -**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications) - **System capability**: SystemCapability.DistributedHardware.DeviceManager **Return value** @@ -478,8 +466,6 @@ startDeviceDiscovery(subscribeInfo: SubscribeInfo): void Starts to discover peripheral devices. -**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications) - **System capability**: SystemCapability.DistributedHardware.DeviceManager **Parameters** @@ -524,8 +510,6 @@ startDeviceDiscovery(subscribeInfo: SubscribeInfo, filterOptions?: string): void Starts to discover peripheral devices and filters discovered devices. -**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications) - **System capability**: SystemCapability.DistributedHardware.DeviceManager **Parameters** @@ -580,8 +564,6 @@ stopDeviceDiscovery(subscribeId: number): void Stops device discovery. -**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications) - **System capability**: SystemCapability.DistributedHardware.DeviceManager **Parameters** @@ -616,8 +598,6 @@ publishDeviceDiscovery(publishInfo: PublishInfo): void Publishes device information for discovery purposes. -**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications) - **System capability**: SystemCapability.DistributedHardware.DeviceManager **Parameters** @@ -659,8 +639,6 @@ unPublishDeviceDiscovery(publishId: number): void Stops publishing device information. -**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications) - **System capability**: SystemCapability.DistributedHardware.DeviceManager **Parameters** @@ -695,8 +673,6 @@ authenticateDevice(deviceInfo: DeviceInfo, authParam: AuthParam, callback: Async Authenticates a device. -**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications) - **System capability**: SystemCapability.DistributedHardware.DeviceManager **Parameters** @@ -757,8 +733,6 @@ unAuthenticateDevice(deviceInfo: DeviceInfo): void Deauthenticates a device. -**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications) - **System capability**: SystemCapability.DistributedHardware.DeviceManager **Parameters** @@ -798,8 +772,6 @@ verifyAuthInfo(authInfo: AuthInfo, callback: AsyncCallback<{deviceId: string, Verifies authentication information. -**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications) - **System capability**: SystemCapability.DistributedHardware.DeviceManager **Parameters** @@ -844,8 +816,6 @@ setUserOperation(operateAction: number, params: string): void; Sets a user operation. -**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications) - **System capability**: SystemCapability.DistributedHardware.DeviceManager **Parameters** @@ -874,14 +844,134 @@ Sets a user operation. } ``` +### requestCredentialRegisterInfo10+ + +requestCredentialRegisterInfo(requestInfo: string, callback: AsyncCallback<{registerInfo: string}>): void; + +Obtains the registration information of the credential. + +**System capability**: SystemCapability.DistributedHardware.DeviceManager + +**Parameters** + + | Name | Type | Mandatory | Description | + | ------------- | --------------- | ---- | ------------------- | + | requestInfo | string | Yes | Request credential information. | + | callback | AsyncCallback<{registerInfo: string}> | Yes | Callback used to return the credential registration information.| + +**Example** + + ```js + let credentialInfo = { + "version" : "1.2.3", + "userId" : "123" + } + try { + dmClass.requestCredentialRegisterInfo(credentialInfo, (data) => { + if (data) { + console.info("requestCredentialRegisterInfo result:" + JSON.stringify(data)); + } else { + console.info.push("requestCredentialRegisterInfo result: data is null"); + } + }); + } catch (err) { + console.error("requestCredentialRegisterInfo err:" + err.code + "," + err.message); + } + ``` + +### importCredential10+ + +importCredential(credentialInfo: string, callback: AsyncCallback<{resultInfo: string}>): void; + +Imports credential information. + +**System capability**: SystemCapability.DistributedHardware.DeviceManager + +**Parameters** + + | Name | Type | Mandatory | Description | + | ------------- | --------------- | ---- | ------------------- | + | credentialInfo| string | Yes | Credential information to import. | + | callback | AsyncCallback<{resultInfo: string}> | Yes | Callback used to return the result.| + +**Example** + + ```js + let credentialInfo = { + "processType" : 1, + "authType" : 1, + "userId" : "123", + "deviceId" : "aaa", + "version" : "1.2.3", + "devicePk" : "0000", + "credentialData" : + [ + { + "credentialType" : 2, + "credentialId" : "102", + "serverPk" : "3059301306072A8648CE3D020106082A8648CE3D03", + "pkInfoSignature" : "30440220490BCB4F822004C9A76AB8D97F80041FC0E", + "pkInfo" : "", + "authCode" : "", + "peerDeviceId" : "" + } + ] + } + try { + dmClass.importCredential(credentialInfo, (data) => { + if (data) { + console.info("importCredential result:" + JSON.stringify(data)); + } else { + console.info.push("importCredential result: data is null"); + } + }); + } catch (err) { + console.error("importCredential err:" + err.code + "," + err.message); + } + ``` + +### deleteCredential10+ + +deleteCredential(queryInfo: string, callback: AsyncCallback<{resultInfo: string}>): void; + +Deletes credential information. + +**System capability**: SystemCapability.DistributedHardware.DeviceManager + +**Parameters** + + | Name | Type | Mandatory | Description | + | ------------- | --------------- | ---- | ------------------- | + | queryInfo | string | Yes | Credential information to delete. | + | callback | AsyncCallback<{resultInfo: string}> | Yes | Callback used to return the result.| + +**Example** + + ```js + let queryInfo = { + "processType" : 1, + "authType" : 1, + "userId" : "123" + } + try { + dmClass.deleteCredential(queryInfo, (data) => { + if (data) { + console.info("deleteCredential result:" + JSON.stringify(data)); + } else { + console.info.push("deleteCredential result: data is null"); + } + }); + } catch (err) { + console.error("deleteCredential err:" + err.code + "," + err.message); + } + ``` + ### on('uiStateChange')9+ on(type: 'uiStateChange', callback: Callback<{ param: string}>): void; Subscribes to UI status changes. -**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications) - **System capability**: SystemCapability.DistributedHardware.DeviceManager **Parameters** @@ -912,8 +1002,6 @@ off(type: 'uiStateChange', callback?: Callback<{ param: string}>): void; Unsubscribes from UI status changes. -**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications) - **System capability**: SystemCapability.DistributedHardware.DeviceManager **Parameters** @@ -939,8 +1027,6 @@ on(type: 'deviceStateChange', callback: Callback<{ action: DeviceStateChange Subscribes to changes in the device state. -**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications) - **System capability**: SystemCapability.DistributedHardware.DeviceManager **Parameters** @@ -968,8 +1054,6 @@ off(type: 'deviceStateChange', callback?: Callback<{ action: DeviceStateChang Unsubscribes from changes in the device state. -**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications) - **System capability**: SystemCapability.DistributedHardware.DeviceManager **Parameters** @@ -997,8 +1081,6 @@ on(type: 'deviceFound', callback: Callback<{ subscribeId: number, device: Dev Subscribes to device discovery events. -**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications) - **System capability**: SystemCapability.DistributedHardware.DeviceManager **Parameters** @@ -1026,8 +1108,6 @@ off(type: 'deviceFound', callback?: Callback<{ subscribeId: number, device: D Unsubscribes from device discovery events. -**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications) - **System capability**: SystemCapability.DistributedHardware.DeviceManager **Parameters** @@ -1055,8 +1135,6 @@ on(type: 'discoverFail', callback: Callback<{ subscribeId: number, reason: nu Subscribes to device discovery failures. -**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications) - **System capability**: SystemCapability.DistributedHardware.DeviceManager **Parameters** @@ -1084,8 +1162,6 @@ off(type: 'discoverFail', callback?: Callback<{ subscribeId: number, reason: Unsubscribes from device discovery failures. -**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications) - **System capability**: SystemCapability.DistributedHardware.DeviceManager **Parameters** @@ -1113,8 +1189,6 @@ on(type: 'publishSuccess', callback: Callback<{ publishId: number }>): voi Subscribes to device information publication success events. -**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications) - **System capability**: SystemCapability.DistributedHardware.DeviceManager **Parameters** @@ -1143,8 +1217,6 @@ off(type: 'publishSuccess', callback?: Callback<{ publishId: number }>): v Unsubscribes from device information publication success events. -**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications) - **System capability**: SystemCapability.DistributedHardware.DeviceManager **Parameters** @@ -1172,8 +1244,6 @@ on(type: 'publishFail', callback: Callback<{ publishId: number, reason: numbe Subscribes to device information publication failures. -**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications) - **System capability**: SystemCapability.DistributedHardware.DeviceManager **Parameters** @@ -1201,8 +1271,6 @@ off(type: 'publishFail', callback?: Callback<{ publishId: number, reason: num Unsubscribes from device information publication failures. -**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications) - **System capability**: SystemCapability.DistributedHardware.DeviceManager **Parameters** @@ -1230,8 +1298,6 @@ on(type: 'serviceDie', callback: () => void): void Subscribes to dead events of the **DeviceManager** service. -**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications) - **System capability**: SystemCapability.DistributedHardware.DeviceManager **Parameters** @@ -1259,8 +1325,6 @@ off(type: 'serviceDie', callback?: () => void): void Unsubscribes from dead events of the **DeviceManager** service. -**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications) - **System capability**: SystemCapability.DistributedHardware.DeviceManager **Parameters** diff --git a/en/application-dev/reference/apis/js-apis-display.md b/en/application-dev/reference/apis/js-apis-display.md index 634231b14e689d9a2dbdb5e8cc74b3f0117889b8..62bfa800173c03c08c1402d79a9174b3778375ca 100644 --- a/en/application-dev/reference/apis/js-apis-display.md +++ b/en/application-dev/reference/apis/js-apis-display.md @@ -291,6 +291,63 @@ try { } ``` +## display.on('privateModeChange')10+ + +on(type: 'privateModeChange', callback: Callback<boolean>): void + +Subscribes to privacy mode changes of this display. When there is a privacy window in the foreground of the display, the display is in privacy mode, and the content in the privacy window cannot be captured or recorded. + +**System API**: This is a system API. + +**System capability**: SystemCapability.WindowManager.WindowManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- |------------------------------------------| ---- | ------------------------------------------------------- | +| type | string | Yes | Event type. The value is fixed at 'privateModeChange', indicating the event of display privacy mode changes.| +| callback | Callback<boolean> | Yes | Callback used to return whether the privacy mode of the display is changed. The value **true** means that the display changes to the privacy mode, and **false** means the opposite.| + +**Example** + +```js +let callback = (data) => { + console.info('Listening enabled. Data: ' + JSON.stringify(data)); +}; +try { + display.on("privateModeChange", callback); +} catch (exception) { + console.error('Failed to register callback. Code: ' + JSON.stringify(exception)); +} +``` + +## display.off('privateModeChange')10+ + +off(type: 'privateModeChange', callback?: Callback<boolean>): void + +Unsubscribes from privacy mode changes of this display. When there is a privacy window in the foreground of the display, the display is in privacy mode, and the content in the privacy window cannot be captured or recorded. + +**System API**: This is a system API. + +**System capability**: SystemCapability.WindowManager.WindowManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- |------------------------------------------| ---- | ------------------------------------------------------- | +| type | string | Yes | Event type. The value is fixed at **'privateModeChange'**, indicating the event of display private mode changes.| +| callback | Callback<boolean> | No | Callback used to return whether the privacy mode of the display is changed. The value **true** means that the display changes to the privacy mode, and **false** means the opposite.| + +**Example** + +```js +try { + display.off("privateModeChange"); +} catch (exception) { + console.error('Failed to unregister callback. Code: ' + JSON.stringify(exception)); +} +``` + ## display.getDefaultDisplay(deprecated) getDefaultDisplay(callback: AsyncCallback<Display>): void 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 b1a3996627f88c46e0657102ad33bd6ed27855a6..0ec67bc229c124cdf36a289e7321acaa9c2fcd43 100644 --- a/en/application-dev/reference/apis/js-apis-distributed-account.md +++ b/en/application-dev/reference/apis/js-apis-distributed-account.md @@ -232,7 +232,8 @@ Sets the distributed account information. This API uses a promise to return the | ID| Error Message| | -------- | ------------------- | | 12300001 | System service exception. | -| 12300002 | invalid accountInfo. | +| 12300002 | Invalid accountInfo. | +| 12300003 | Account not found. | **Example** ```js @@ -325,4 +326,4 @@ Defines distributed OS account information. | event | string | Yes| Login state of the distributed account. The state can be login, logout, token invalid, or logoff, which correspond to the following strings respectively:
- Ohos.account.event.LOGIN
- Ohos.account.event.LOGOUT
- Ohos.account.event.TOKEN_INVALID
- Ohos.account.event.LOGOFF | | nickname9+ | string | No| Nickname of the distributed account. It must be a non-null string.| | avatar9+ | string | No| Avatar of the distributed account. It must be a non-null string.| -| scalableData | object | No| Extended information about the distributed account, passed in key-value (KV) pairs.
**NOTE**
This parameter is reserved and not used in the setters and getters.| +| scalableData8+ | object | No| Extended information about the distributed account, passed in key-value (KV) pairs.
**NOTE**
This parameter is reserved and not used in the setters and getters.| 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 23ee9ed06ec230543ed4ee8594954bc3d72871cf..736a41901b6c74fc06bca36eeb1cee01456e1f49 100644 --- a/en/application-dev/reference/apis/js-apis-distributed-data.md +++ b/en/application-dev/reference/apis/js-apis-distributed-data.md @@ -11,9 +11,9 @@ This module provides the following functions: - [SingleKVStore](#singlekvstore): provides methods to query and synchronize data in a single KV store. This class inherits from [KVStore](#kvstore), and data is not distinguished by device. - [DeviceKVStore8+ ](#devicekvstore8): provides methods to query and synchronize data in a device KV store. This class inherits from [KVStore](#kvstore), and data is distinguished by device. ->**NOTE**
+>**NOTE** > ->- The APIs provided by this module are no longer maintained since API version 9. You are advised to use `@ohos.data.distributedKVStore`](js-apis-distributedKVStore.md). +>- The APIs provided by this module are no longer maintained since API version 9. You are advised to use [@ohos.data.distributedKVStore](js-apis-distributedKVStore.md). > >- 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. @@ -162,7 +162,7 @@ Creates and obtains a KV store. This API uses an asynchronous callback to return | ----- | ------ | ------ | ------ | | storeId | string | Yes | Unique identifier of the KV store. The length cannot exceed [MAX_STORE_ID_LENGTH](#constants).| | options | [Options](#options) | Yes | Configuration of the KV store.| -| callback | AsyncCallback<T> | Yes | Callback invoked to return the KV store created.| +| callback | AsyncCallback<T> | Yes | Callback invoked to return the KV store instance created.| **Example** @@ -212,7 +212,7 @@ Creates and obtains a KV store. This API uses a promise to return the result. | Type | Description | | -------------------------------------- | ------------------------ | -| Promise<T>, <T extends [KVStore](#kvstore)> | Promise used to return the KV store created.| +| Promise<T>, <T extends [KVStore](#kvstore)> | Promise used to return the KV store instance created. | **Example** @@ -449,7 +449,7 @@ Obtains the IDs of all KV stores that are created by [getKVStore()](#getkvstore) | Name | Type| Mandatory | Description | | ----- | ------ | ---- | ----------------------- | | appId | string | Yes | Bundle name of the app that invokes the KV store. | -| callback | AsyncCallback<string[]> | Yes |Callback invoked to return the KV store IDs obtained.| +| callback | AsyncCallback<string[]> | Yes |Callback invoked to return the IDs of all created KV stores.| **Example** @@ -485,7 +485,7 @@ Obtains the IDs of all KV stores that are created by [getKVStore()](#getkvstore) | Type | Description | | ------------- | -------------- | -| Promise<string[]>| Promise used to return the KV store IDs obtained.| +| Promise<string[]>| Promise used to return the IDs of all created KV stores. | **Example** @@ -578,7 +578,7 @@ Provides KV store configuration. | 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 | +| autoSync | boolean | No|Whether to automatically synchronize database files. The value **false** (default) means to manually synchronize database files; the value **true** means to automatically synchronize database files.
**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| @@ -3074,7 +3074,7 @@ Obtains all KV pairs that match the specified key prefix. This API uses an async | Name | Type| Mandatory | Description | | ----- | ------ | ---- | ----------------------- | | keyPrefix |string | Yes |Key prefix to match. | -| callback |AsyncCallback<[Entry](#entry)[]> | Yes |Callback invoked to return the KV pairs obtained. | +| callback |AsyncCallback<[Entry](#entry)[]> | Yes |Callback invoked to return the KV pairs that match the specified prefix. | **Example** @@ -3125,7 +3125,7 @@ Obtains all KV pairs that match the specified key prefix. This API uses a promis | Type | Description | | ------ | ------- | -|Promise<[Entry](#entry)[]> |Promise used to return the KV pairs obtained.| +|Promise<[Entry](#entry)[]> |Promise used to return the KV pairs that match the specified prefix.| **Example** @@ -3178,7 +3178,7 @@ Obtains the KV pairs that match the specified **Query** object. This API uses an | Name | Type| Mandatory | Description | | ----- | ------ | ---- | ----------------------- | | query |[Query](#query8) | Yes |Key prefix to match. | -| callback |AsyncCallback<[Entry](#entry)[]> | Yes |Callback invoked to return the KV pairs obtained. | +| callback |AsyncCallback<[Entry](#entry)[]> | Yes |Callback invoked to return the KV pairs that match the specified **Query** object. | **Example** @@ -3234,7 +3234,7 @@ Obtains the KV pairs that match the specified **Query** object. This API uses a | Type | Description | | ------ | ------- | -|Promise<[Entry](#entry)[]> |Promise used to return the KV pairs obtained.| +|Promise<[Entry](#entry)[]> |Promise used to return the KV pairs that match the specified **Query** object.| **Example** @@ -3287,7 +3287,7 @@ Obtains the result set with the specified prefix. This API uses an asynchronous | Name | Type| Mandatory | Description | | ----- | ------ | ---- | ----------------------- | | keyPrefix |string | Yes |Key prefix to match.| -| callback |AsyncCallback<[KvStoreResultSet](#kvstoreresultset8)> | Yes |Callback invoked to return the result set obtained.| +| callback |AsyncCallback<[KvStoreResultSet](#kvstoreresultset8)> | Yes |Callback invoked to return the result set with the specified prefix.| **Example** @@ -3341,7 +3341,7 @@ Obtains the result set with the specified prefix. This API uses a promise to ret | Type | Description | | ------ | ------- | -|Promise<[KvStoreResultSet](#kvstoreresultset8)> |Promise used to return the result set obtained.| +|Promise<[KvStoreResultSet](#kvstoreresultset8)> |Promise used to return the result set with the specified prefix.| **Example** @@ -3571,7 +3571,7 @@ Obtains the number of results that matches the specified **Query** object. This | Name | Type| Mandatory | Description | | ----- | ------ | ---- | ----------------------- | | query |[Query](#query8) | Yes |**Query** object to match. | -| callback |AsyncCallback<number> | Yes |Callback invoked to return the number of results obtained. | +| callback |AsyncCallback<number> | Yes |Callback invoked to return the number of results that match the specified **Query** object. | **Example** @@ -3755,6 +3755,9 @@ try { sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void Synchronizes the KV store manually. For details about the synchronization modes of the distributed data service, see [Distributed Data Service Overview](../../database/database-mdds-overview.md). +> **NOTE**
+> +> The value of **deviceIds** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications. **Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC @@ -3771,8 +3774,41 @@ Synchronizes the KV store manually. For details about the synchronization modes **Example** ```js +import deviceManager from '@ohos.distributedHardware.deviceManager'; + +let devManager; let kvStore; -kvStore.sync(['deviceIds'], distributedData.SyncMode.PULL_ONLY, 1000); +const KEY_TEST_SYNC_ELEMENT = 'key_test_sync'; +const VALUE_TEST_SYNC_ELEMENT = 'value-string-001'; +// create deviceManager +deviceManager.createDeviceManager('bundleName', (err, value) => { + if (!err) { + devManager = value; + let deviceIds = []; + if (devManager != null) { + var devices = devManager.getTrustedDeviceListSync(); + for (var i = 0; i < devices.length; i++) { + deviceIds[i] = devices[i].deviceId; + } + } + try { + kvStore.on('syncComplete', function (data) { + console.log('Sync dataChange'); + }); + kvStore.put(KEY_TEST_SYNC_ELEMENT + 'testSync101', VALUE_TEST_SYNC_ELEMENT, function (err, data) { + if (err != undefined) { + console.log("put err: " + JSON.stringify(err)); + return; + } + console.log('Succeeded in putting data'); + const mode = distributedData.SyncMode.PULL_ONLY; + kvStore.sync(deviceIds, mode, 1000); + }); + } catch (e) { + console.log('Sync e' + e); + } + } +}); ``` ### on('dataChange')8+ @@ -3884,7 +3920,7 @@ Unsubscribes from synchronization complete events. | Name | Type | Mandatory| Description | | ------------ | --------------------------------------------- | ---- | ---------------------------------------------------------- | | event | string | Yes | Event to unsubscribe from. The value is **syncComplete**, which indicates a synchronization complete event.| -| syncCallback | Callback<Array<[string, number]>> | No | Callback for a synchronization complete event. | +| syncCallback | Callback<Array<[string, number]>> | No | Callback for the synchronization complete event. | **Example** @@ -3987,7 +4023,7 @@ Obtains the security level of this KV store. This API uses an asynchronous callb | Name | Type| Mandatory | Description | | ----- | ------ | ---- | ----------------------- | -| callback |AsyncCallback<[SecurityLevel](#securitylevel)> | Yes |Callback invoked to return the security level obtained. | +| callback |AsyncCallback<[SecurityLevel](#securitylevel)> | Yes |Callback invoked to return the security level of the KV store. | **Example** @@ -4015,7 +4051,7 @@ Obtains the security level of this KV store. This API uses a promise to return t | Type | Description | | ------ | ------- | -|Promise<[SecurityLevel](#securitylevel)> |Promise used to return the security level obtained.| +|Promise<[SecurityLevel](#securitylevel)> |Promise used to return the security level of the KV store.| **Example** @@ -4097,7 +4133,7 @@ Obtains a string value that matches the specified device ID and key. This API us | Type | Description | | ------ | ------- | -|Promise<boolean\|string\|number\|Uint8Array> |Promise used to return the string value obtained.| +|Promise<boolean\|string\|number\|Uint8Array> |Promise used to return the string value that matches the given condition.| **Example** @@ -4189,7 +4225,7 @@ Obtains all KV pairs that match the specified device ID and key prefix. This API | Type | Description | | ------ | ------- | -|Promise<[Entry](#entry)[]> |Promise used to return the KV pairs obtained.| +|Promise<[Entry](#entry)[]> |Promise used to return all the KV pairs that match the given condition.| **Example** @@ -4299,7 +4335,7 @@ Obtains the KV pairs that match the specified **Query** object. This API uses a | Type | Description | | ------ | ------- | -|Promise<[Entry](#entry)[]> |Promise used to return the KV pairs obtained.| +|Promise<[Entry](#entry)[]> |Promise used to return the KV pairs that match the specified **Query** object.| **Example** @@ -4353,7 +4389,7 @@ Obtains the KV pairs that match the specified device ID and **Query** object. Th | ----- | ------ | ---- | ----------------------- | | deviceId |string | Yes |ID of the target device. | | query |[Query](#query8) | Yes |**Query** object to match. | -| callback |AsyncCallback<[Entry](#entry)[]> | Yes |Callback invoked to return the KV pairs obtained. | +| callback |AsyncCallback<[Entry](#entry)[]> | Yes |Callback invoked to return the KV pairs that match the specified device ID and **Query** object. | **Example** @@ -4411,7 +4447,7 @@ Obtains the KV pairs that match the specified device ID and **Query** object. Th | Type | Description | | ------ | ------- | -|Promise<[Entry](#entry)[]> |Promise used to return the KV pairs obtained.| +|Promise<[Entry](#entry)[]> |Promise used to return the KV pairs that match the specified device ID and **Query** object.| **Example** @@ -4466,7 +4502,7 @@ Obtains a **KvStoreResultSet** object that matches the specified device ID and k | ----- | ------ | ---- | ----------------------- | | deviceId |string | Yes |ID of the target device. | | keyPrefix |string | Yes |Key prefix to match. | -| callback |AsyncCallback<[KvStoreResultSet](#kvstoreresultset8)> | Yes |Callback invoked to return the **KvStoreResultSet** object obtained. | +| callback |AsyncCallback<[KvStoreResultSet](#kvstoreresultset8)> | Yes |Callback invoked to return the **KvStoreResultSet** object that matches the specified device ID and key prefix. | **Example** @@ -4506,7 +4542,7 @@ Obtains a **KvStoreResultSet** object that matches the specified device ID and k | Type | Description | | ------ | ------- | -|Promise<[KvStoreResultSet](#kvstoreresultset8)> |Promise used to return the **KvStoreResultSet** object obtained.| +|Promise<[KvStoreResultSet](#kvstoreresultset8)> |Promise used to return the **KvStoreResultSet** object that matches the specified device ID and key prefix.| **Example** @@ -4601,7 +4637,7 @@ Obtains a **KvStoreResultSet** object that matches the specified **Query** objec | Type | Description | | ------ | ------- | -|Promise<[KvStoreResultSet](#kvstoreresultset8)> |Promise used to return the **KvStoreResultSet** object obtained.| +|Promise<[KvStoreResultSet](#kvstoreresultset8)> |Promise used to return the **KvStoreResultSet** object that matches the specified **Query** object.| **Example** @@ -4661,7 +4697,7 @@ Obtains a **KvStoreResultSet** object that matches the specified device ID and * | ----- | ------ | ---- | ----------------------- | | deviceId |string | Yes |ID of the target device. | | query |[Query](#query8) | Yes |**Query** object to match. | -| callback |AsyncCallback<[KvStoreResultSet](#kvstoreresultset8)> | Yes |Callback invoked to return the **KvStoreResultSet** object obtained. | +| callback |AsyncCallback<[KvStoreResultSet](#kvstoreresultset8)> | Yes |Callback invoked to return the **KvStoreResultSet** object that matches the specified device ID and **Query** object. | **Example** @@ -4718,7 +4754,7 @@ Obtains a **KvStoreResultSet** object that matches the specified device ID and * | Type | Description | | ------ | ------- | -|Promise<[KvStoreResultSet](#kvstoreresultset8)> |Promise used to return the **KvStoreResultSet** object obtained.| +|Promise<[KvStoreResultSet](#kvstoreresultset8)> |Promise used to return the **KvStoreResultSet** object that matches the specified device ID and **Query** object.| **Example** @@ -5141,6 +5177,10 @@ sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void Synchronizes the KV store manually. For details about the synchronization modes of the distributed data service, see [Distributed Data Service Overview](../../database/database-mdds-overview.md). +> **NOTE**
+> +> The value of **deviceIds** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications. + **Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC **System capability**: SystemCapability.DistributedDataManager.KVStore.Core @@ -5156,22 +5196,41 @@ Synchronizes the KV store manually. For details about the synchronization modes **Example** ```js +import deviceManager from '@ohos.distributedHardware.deviceManager'; + +let devManager; let kvStore; const KEY_TEST_SYNC_ELEMENT = 'key_test_sync'; const VALUE_TEST_SYNC_ELEMENT = 'value-string-001'; -try { - kvStore.on('syncComplete', function (data) { +// create deviceManager +deviceManager.createDeviceManager('bundleName', (err, value) => { + if (!err) { + devManager = value; + let deviceIds = []; + if (devManager != null) { + var devices = devManager.getTrustedDeviceListSync(); + for (var i = 0; i < devices.length; i++) { + deviceIds[i] = devices[i].deviceId; + } + } + try { + kvStore.on('syncComplete', function (data) { console.log('Sync dataChange'); - }); - kvStore.put(KEY_TEST_SYNC_ELEMENT + 'testSync101', VALUE_TEST_SYNC_ELEMENT, function (err,data) { - console.log('Sync put success'); - const devices = ['deviceList']; + }); + kvStore.put(KEY_TEST_SYNC_ELEMENT + 'testSync101', VALUE_TEST_SYNC_ELEMENT, function (err, data) { + if (err != undefined) { + console.log("put err: " + JSON.stringify(err)); + return; + } + console.log('Succeeded in putting data'); const mode = distributedData.SyncMode.PULL_ONLY; - kvStore.sync(devices, mode); - }); -}catch(e) { - console.log('Sync e' + e); -} + kvStore.sync(deviceIds, mode, 1000); + }); + } catch (e) { + console.log('Sync e' + e); + } + } +}); ``` ### on('dataChange')8+ @@ -5283,7 +5342,7 @@ Unsubscribes from synchronization complete events. | Name | Type | Mandatory| Description | | ------------ | --------------------------------------------- | ---- | ---------------------------------------------------------- | | event | string | Yes | Event to unsubscribe from. The value is **syncComplete**, which indicates a synchronization complete event.| -| syncCallback | Callback<Array<[string, number]>> | No | Callback for a synchronization complete event. | +| syncCallback | Callback<Array<[string, number]>> | No | Callback for the synchronization complete event. | **Example** diff --git a/en/application-dev/reference/apis/js-apis-distributedKVStore.md b/en/application-dev/reference/apis/js-apis-distributedKVStore.md index 7b9ca74c921ecb8590b09df41bd37aa309794257..a283f9b58dc2719bd9169504ef1aeeb04c586924 100644 --- a/en/application-dev/reference/apis/js-apis-distributedKVStore.md +++ b/en/application-dev/reference/apis/js-apis-distributedKVStore.md @@ -28,7 +28,7 @@ Provides the **KVManager** instance configuration, including the bundle name of | Name | Type | Mandatory| Description | | ---------- | --------------------- | ---- | ------------------------------------------------------------ | -| context | Context | Yes |Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For the application context of the stage model, see [Context](js-apis-ability-context.md).| +| context | Context | Yes |Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md).| | bundleName | string | Yes | Bundle name. | ## Constants @@ -151,7 +151,7 @@ Provides KV store configuration. | 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| +| autoSync | boolean | No | Whether to automatically synchronize database files. The value **false** (default) means to manually synchronize database files; the value **true** means to automatically synchronize database files.
**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) | Yes |Security level of the KV store.
**System capability**: SystemCapability.DistributedDataManager.KVStore.Core| | schema | [Schema](#schema) | No | Schema used to define the values stored in the KV store. By default, **schema** is not used.
**System capability**: SystemCapability.DistributedDataManager.KVStore.DistributedKVStore| @@ -328,7 +328,7 @@ Creates and obtains a distributed KV store. This API uses an asynchronous callba | -------- | ---------------------- | ---- | ------------------------------------------------------------ | | storeId | string | Yes | Unique identifier of the KV store. The length cannot exceed [MAX_STORE_ID_LENGTH](#constants).| | options | [Options](#options) | Yes | Configuration of the KV store to create. | -| callback | AsyncCallback<T> | Yes | Callback invoked to return the distributed KV store (**SingleKVStore** or **DeviceKVStore**) instance created.| +| callback | AsyncCallback<T> | Yes | Callback invoked to return the **SingleKVStore** or **DeviceKVStore** instance created.| **Error codes** @@ -358,7 +358,7 @@ try { console.error(`Fail to get KVStore.code is ${err.code},message is ${err.message}`); return; } - console.log("Obtained the KVStore successfully."); + console.log("Succeeded in getting KVStore"); kvStore = store; }); } catch (e) { @@ -385,7 +385,7 @@ Creates and obtains a distributed KV store. This API uses a promise to return th | Type | Description | | ---------------- | ------------------------------------------------------------ | -| Promise<T> | Promise used to return the distributed KV store (**SingleKVStore** or **DeviceKVStore**) instance created.| +| Promise<T> | Promise used to return the **SingleKVStore** or **DeviceKVStore** instance created.| **Error codes** @@ -411,7 +411,7 @@ try { securityLevel: distributedKVStore.SecurityLevel.S2, }; kvManager.getKVStore('storeId', options).then((store) => { - console.log("Obtained the KVStore successfully."); + console.log("Succeeded in getting KVStore"); kvStore = store; }).catch((err) => { console.error(`Fail to get KVStore.code is ${err.code},message is ${err.message}`); @@ -453,14 +453,14 @@ const options = { } try { kvManager.getKVStore('storeId', options, async function (err, store) { - console.log('Obtained the KVStore successfully.'); + console.log('Succeeded in getting KVStore'); kvStore = store; kvManager.closeKVStore('appId', 'storeId', function (err, data) { if (err != undefined) { console.error(`Fail to close KVStore.code is ${err.code},message is ${err.message}`); return; } - console.log('Closed the KVStore successfully.'); + console.log('Succeeded in closing KVStore'); }); }); } catch (e) { @@ -505,10 +505,10 @@ const options = { } try { kvManager.getKVStore('storeId', options).then(async (store) => { - console.log('Obtained the KVStore successfully.'); + console.log('Succeeded in getting KVStore'); kvStore = store; kvManager.closeKVStore('appId', 'storeId').then(() => { - console.log('Closed the KVStore successfully.'); + console.log('Succeeded in closing KVStore'); }).catch((err) => { console.error(`Fail to close KVStore.code is ${err.code},message is ${err.message}`); }); @@ -564,14 +564,14 @@ try { console.error(`Fail to get KVStore.code is ${err.code},message is ${err.message}`); return; } - console.log('Obtained the KVStore successfully.'); + console.log('Succeeded in getting KVStore'); kvStore = store; kvManager.deleteKVStore('appId', 'storeId', function (err, data) { if (err != undefined) { console.error(`Fail to delete KVStore.code is ${err.code},message is ${err.message}`); return; } - console.log(`Deleted the KVStore successfully.`); + console.log(`Succeeded in deleting KVStore`); }); }); } catch (e) { @@ -624,10 +624,10 @@ const options = { } try { kvManager.getKVStore('storeId', options).then(async (store) => { - console.log('Obtained the KVStore successfully.'); + console.log('Succeeded in getting KVStore'); kvStore = store; kvManager.deleteKVStore('appId', 'storeId').then(() => { - console.log('Deleted the KVStore successfully.'); + console.log('Succeeded in deleting KVStore'); }).catch((err) => { console.error(`Fail to delete KVStore.code is ${err.code},message is ${err.message}`); }); @@ -652,7 +652,7 @@ Obtains the IDs of all distributed KV stores that are created by [getKVStore](#g | Name | Type | Mandatory| Description | | -------- | ----------------------------- | ---- | --------------------------------------------------- | | appId | string | Yes | Bundle name of the app that invokes the KV store. | -| callback | AsyncCallback<string[]> | Yes | Callback invoked to return the IDs of the distributed KV stores obtained.| +| callback | AsyncCallback<string[]> | Yes | Callback invoked to return the IDs of all the distributed KV stores created.| **Example** @@ -664,7 +664,7 @@ try { console.error(`Fail to get AllKVStoreId.code is ${err.code},message is ${err.message}`); return; } - console.log('Obtained all KV store IDs successfully.'); + console.log('Succeeded in getting AllKVStoreId'); console.log(`GetAllKVStoreId size = ${data.length}`); }); } catch (e) { @@ -690,7 +690,7 @@ Obtains the IDs of all distributed KV stores that are created by [getKVStore](#g | Type | Description | | ----------------------- | ------------------------------------------------------ | -| Promise<string[]> | Promise used to return the IDs of the distributed KV stores obtained.| +| Promise<string[]> | Promise used to return the IDs of all the distributed KV stores created. | **Example** @@ -699,7 +699,7 @@ let kvManager; try { console.log('GetAllKVStoreId'); kvManager.getAllKVStoreId('appId').then((data) => { - console.log('Obtained all KV store IDs successfully.'); + console.log('Succeeded in getting AllKVStoreId'); console.log(`GetAllKVStoreId size = ${data.length}`); }).catch((err) => { console.error(`Fail to get AllKVStoreId.code is ${err.code},message is ${err.message}`); @@ -829,7 +829,7 @@ let kvStore; try { let resultSet; kvStore.getResultSet('batch_test_string_key').then((result) => { - console.log('Obtained the result set successfully.'); + console.log('getResultSet succeeded.'); resultSet = result; }).catch((err) => { console.log('getResultSet failed: ' + err); @@ -1000,7 +1000,7 @@ let kvStore; try { let resultSet; kvStore.getResultSet('batch_test_string_key').then((result) => { - console.log('Obtained the result set successfully.'); + console.log('Succeeded in getting resultSet'); resultSet = result; }).catch((err) => { console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`); @@ -1039,7 +1039,7 @@ let kvStore; try { let resultSet; kvStore.getResultSet('batch_test_string_key').then((result) => { - console.log('Obtained the result set successfully.'); + console.log('Succeeded in getting resultSet'); resultSet = result; }).catch((err) => { console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`); @@ -1242,7 +1242,7 @@ Resets the **Query** object. | Type | Description | | -------------- | --------------------- | -| [Query](query) | **Query** object reset.| +| [Query](#query) | **Query** object reset.| **Example** @@ -1278,7 +1278,7 @@ Creates a **Query** object to match the specified field whose value is equal to | Type | Description | | -------------- | --------------- | -| [Query](query) | **Query** object created.| +| [Query](#query) | **Query** object created.| **Example** @@ -1312,7 +1312,7 @@ Creates a **Query** object to match the specified field whose value is not equal | Type | Description | | -------------- | --------------- | -| [Query](query) | **Query** object created.| +| [Query](#query) | **Query** object created.| **Example** @@ -1345,7 +1345,7 @@ Creates a **Query** object to match the specified field whose value is greater t | Type | Description | | -------------- | --------------- | -| [Query](query) | **Query** object created.| +| [Query](#query) | **Query** object created.| **Example** @@ -1380,7 +1380,7 @@ Creates a **Query** object to match the specified field whose value is less than | Type | Description | | -------------- | --------------- | -| [Query](query) | **Query** object created.| +| [Query](#query) | **Query** object created.| **Example** @@ -1415,7 +1415,7 @@ Creates a **Query** object to match the specified field whose value is greater t | Type | Description | | -------------- | --------------- | -| [Query](query) | **Query** object created.| +| [Query](#query) | **Query** object created.| **Example** @@ -1450,7 +1450,7 @@ Creates a **Query** object to match the specified field whose value is less than | Type | Description | | -------------- | --------------- | -| [Query](query) | **Query** object created.| +| [Query](#query) | **Query** object created.| **Example** @@ -1483,7 +1483,7 @@ Creates a **Query** object to match the specified field whose value is **null**. | Type | Description | | -------------- | --------------- | -| [Query](query) | **Query** object created.| +| [Query](#query) | **Query** object created.| **Example** @@ -1517,7 +1517,7 @@ Creates a **Query** object to match the specified field whose value is within th | Type | Description | | -------------- | --------------- | -| [Query](query) | **Query** object created.| +| [Query](#query) | **Query** object created.| **Example** @@ -1551,7 +1551,7 @@ Creates a **Query** object to match the specified field whose value is within th | Type | Description | | -------------- | --------------- | -| [Query](query) | **Query** object created.| +| [Query](#query) | **Query** object created.| **Example** @@ -1585,7 +1585,7 @@ Creates a **Query** object to match the specified field whose value is not withi | Type | Description | | -------------- | --------------- | -| [Query](query) | **Query** object created.| +| [Query](#query) | **Query** object created.| **Example** @@ -1619,7 +1619,7 @@ Creates a **Query** object to match the specified field whose value is not withi | Type | Description | | -------------- | --------------- | -| [Query](query) | **Query** object created.| +| [Query](#query) | **Query** object created.| **Example** @@ -1653,7 +1653,7 @@ Creates a **Query** object to match the specified field whose value is similar t | Type | Description | | -------------- | --------------- | -| [Query](query) | **Query** object created.| +| [Query](#query) | **Query** object created.| **Example** @@ -1687,7 +1687,7 @@ Creates a **Query** object to match the specified field whose value is not simil | Type | Description | | -------------- | --------------- | -| [Query](query) | **Query** object created.| +| [Query](#query) | **Query** object created.| **Example** @@ -1714,7 +1714,7 @@ Creates a **Query** object with the AND condition. | Type | Description | | -------------- | -------------- | -| [Query](query) | **Query** object created.| +| [Query](#query) | **Query** object created.| **Example** @@ -1743,7 +1743,7 @@ Creates a **Query** object with the OR condition. | Type | Description | | -------------- | -------------- | -| [Query](query) | **Query** object created.| +| [Query](#query) | **Query** object created.| **Example** @@ -1778,7 +1778,7 @@ Creates a **Query** object to sort the query results in ascending order. | Type | Description | | -------------- | --------------- | -| [Query](query) | **Query** object created.| +| [Query](#query) | **Query** object created.| **Example** @@ -1812,7 +1812,7 @@ Creates a **Query** object to sort the query results in descending order. | Type | Description | | -------------- | --------------- | -| [Query](query) | **Query** object created.| +| [Query](#query) | **Query** object created.| **Example** @@ -1847,7 +1847,7 @@ Creates a **Query** object to specify the number of results and where to start. | Type | Description | | -------------- | --------------- | -| [Query](query) | **Query** object created.| +| [Query](#query) | **Query** object created.| **Example** @@ -1883,7 +1883,7 @@ Creates a **Query** object to match the specified field whose value is not **nul | Type | Description | | -------------- | --------------- | -| [Query](query) | **Query** object created.| +| [Query](#query) | **Query** object created.| **Example** @@ -1910,7 +1910,7 @@ Creates a **Query** object for a query condition group with a left parenthesis. | Type | Description | | -------------- | --------------- | -| [Query](query) | **Query** object created.| +| [Query](#query) | **Query** object created.| **Example** @@ -1939,7 +1939,7 @@ Creates a **Query** object for a query condition group with a right parenthesis. | Type | Description | | -------------- | --------------- | -| [Query](query) | **Query** object created.| +| [Query](#query) | **Query** object created.| **Example** @@ -1974,7 +1974,7 @@ Creates a **Query** object with a specified key prefix. | Type | Description | | -------------- | --------------- | -| [Query](query) | **Query** object created.| +| [Query](#query) | **Query** object created.| **Example** @@ -2008,7 +2008,7 @@ Creates a **Query** object with an index preferentially used for query. | Type | Description | | -------------- | --------------- | -| [Query](query) | **Query** object created.| +| [Query](#query) | **Query** object created.| **Example** @@ -2042,7 +2042,7 @@ Creates a **Query** object with the device ID as the key prefix. | Type | Description | | -------------- | --------------- | -| [Query](query) | **Query** object created.| +| [Query](#query) | **Query** object created.| **Example** @@ -2125,7 +2125,7 @@ try { console.error(`Fail to put.code is ${err.code},message is ${err.message}`); return; } - console.log("Put data successfully."); + console.log("Succeeded in putting"); }); } catch (e) { console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); @@ -2170,7 +2170,7 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; try { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then((data) => { - console.log(`Put data successfully. data=${data}`); + console.log(`Succeeded in putting.data=${data}`); }).catch((err) => { console.error(`Fail to put.code is ${err.code},message is ${err.message}`); }); @@ -2226,12 +2226,12 @@ try { console.error(`Fail to put Batch.code is ${err.code},message is ${err.message}`); return; } - console.log('Batch put data successfully.'); + console.log('Succeeded in putting Batch'); kvStore.getEntries('batch_test_string_key', function (err, entries) { if (err != undefined) { console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); } - console.log('Obtained the entries successfully.'); + console.log('Succeeded in getting Entries'); console.log(`entries.length: ${entries.length}`); console.log(`entries[0]: ${entries[0]}`); }); @@ -2289,9 +2289,9 @@ try { } console.log(`entries: ${entries}`); kvStore.putBatch(entries).then(async (entries) => { - console.log('Batch put data successfully.'); + console.log('Succeeded in putting Batch'); kvStore.getEntries('batch_test_string_key').then((entries) => { - console.log('Obtained the entries successfully.'); + console.log('Succeeded in getting Entries'); console.log(`PutBatch ${entries}`); }).catch((err) => { console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); @@ -2349,7 +2349,7 @@ try { console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); return; } - console.log('Batch put data successfully.'); + console.log('Succeeded in putting batch'); }) } catch (e) { console.error(`Fail to put batch.code is ${e.code},message is ${e.message}`); @@ -2402,7 +2402,7 @@ try { v8Arr.push(vb2); v8Arr.push(vb3); kvStore.putBatch(v8Arr).then(async (data) => { - console.log(`Batch put data successfully.`); + console.log(`Succeeded in putting patch`); }).catch((err) => { console.error(`putBatch fail.code is ${err.code},message is ${err.message}`); }); @@ -2447,13 +2447,13 @@ try { console.error(`Fail to put.code is ${err.code},message is ${err.message}`); return; } - console.log('Put data successfully.'); + console.log('Succeeded in putting'); kvStore.delete(KEY_TEST_STRING_ELEMENT, function (err, data) { if (err != undefined) { console.error(`Fail to delete.code is ${err.code},message is ${err.message}`); return; } - console.log('Deleted data successfully.'); + console.log('Succeeded in deleting'); }); }); } catch (e) { @@ -2498,9 +2498,9 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; try { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then((data) => { - console.log(`Put data successfully: ${data}`); + console.log(`Succeeded in putting: ${data}`); kvStore.delete(KEY_TEST_STRING_ELEMENT).then((data) => { - console.log('Deleted data successfully.'); + console.log('Succeeded in deleting'); }).catch((err) => { console.error(`Fail to delete.code is ${err.code},message is ${err.message}`); }); @@ -2547,7 +2547,7 @@ try { let predicates = new dataSharePredicates.DataSharePredicates(); kvStore.delete(predicates, function (err, data) { if (err == undefined) { - console.log('Deleted data successfully.'); + console.log('Succeeded in deleting'); } else { console.error(`Fail to delete.code is ${err.code},message is ${err.message}`); } @@ -2599,9 +2599,9 @@ try { let arr = ["name"]; predicates.inKeys(arr); kvStore.put("name", "bob").then((data) => { - console.log(`Put data successfully: ${data}`); + console.log(`Succeeded in putting: ${data}`); kvStore.delete(predicates).then((data) => { - console.log('Deleted data successfully.'); + console.log('Succeeded in deleting'); }).catch((err) => { console.error(`Fail to delete.code is ${err.code},message is ${err.message}`); }); @@ -2662,13 +2662,13 @@ try { console.error(`Fail to put Batch.code is ${err.code},message is ${err.message}`); return; } - console.log('Batch put data successfully.'); + console.log('Succeeded in putting Batch'); kvStore.deleteBatch(keys, async function (err, data) { if (err != undefined) { console.error(`Fail to delete Batch.code is ${err.code},message is ${err.message}`); return; } - console.log('Batch deleted data successfully.'); + console.log('Succeeded in deleting Batch'); }); }); } catch (e) { @@ -2726,9 +2726,9 @@ try { } console.log(`entries: ${entries}`); kvStore.putBatch(entries).then(async (data) => { - console.log('Batch put data successfully.'); + console.log('Succeeded in putting Batch'); kvStore.deleteBatch(keys).then((err) => { - console.log('Batch deleted data successfully.'); + console.log('Succeeded in deleting Batch'); }).catch((err) => { console.error(`Fail to delete Batch.code is ${err.code},message is ${err.message}`); }); @@ -2736,7 +2736,7 @@ try { console.error(`Fail to put Batch.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -2771,21 +2771,21 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string_2'; const VALUE_TEST_STRING_ELEMENT = 'value-string-002'; try { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT, async function (err, data) { - console.log('Put data successfully.'); + console.log('Succeeded in putting data'); const deviceid = 'no_exist_device_id'; kvStore.removeDeviceData(deviceid, async function (err, data) { if (err == undefined) { - console.log('Removed device data successfully.'); + console.log('succeeded in removing device data'); } else { console.error(`Fail to remove device data.code is ${err.code},message is ${err.message} `); kvStore.get(KEY_TEST_STRING_ELEMENT, async function (err, data) { - console.log('Obtained data successfully.'); + console.log('Succeeded in getting data'); }); } }); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`) + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`) } ``` @@ -2825,23 +2825,23 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string_2'; const VALUE_TEST_STRING_ELEMENT = 'value-string-001'; try { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then((err) => { - console.log('Put data successfully.'); + console.log('Succeeded in putting data'); }).catch((err) => { console.error(`Fail to put data.code is ${err.code},message is ${err.message} `); }); const deviceid = 'no_exist_device_id'; kvStore.removeDeviceData(deviceid).then((err) => { - console.log('Removed device data successfully.'); + console.log('succeeded in removing device data'); }).catch((err) => { console.error(`Fail to remove device data.code is ${err.code},message is ${err.message} `); }); kvStore.get(KEY_TEST_STRING_ELEMENT).then((data) => { - console.log('Obtained data successfully.'); + console.log('Succeeded in getting data'); }).catch((err) => { console.error(`Fail to get data.code is ${err.code},message is ${err.message} `); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`) + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`) } ``` @@ -2882,13 +2882,13 @@ try { console.error(`Fail to put.code is ${err.code},message is ${err.message}`); return; } - console.log("Put data successfully."); + console.log("Succeeded in putting"); kvStore.get(KEY_TEST_STRING_ELEMENT, function (err, data) { if (err != undefined) { console.error(`Fail to get.code is ${err.code},message is ${err.message}`); return; } - console.log(`Obtained data successfully. data=${data}`); + console.log(`Succeeded in getting data.data=${data}`); }); }); } catch (e) { @@ -2934,9 +2934,9 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; try { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then((data) => { - console.log(`Put data successfully. data=${data}`); + console.log(`Succeeded in putting data.data=${data}`); kvStore.get(KEY_TEST_STRING_ELEMENT).then((data) => { - console.log(`Obtained data successfully. data=${data}`); + console.log(`Succeeded in getting data.data=${data}`); }).catch((err) => { console.error(`Fail to get.code is ${err.code},message is ${err.message}`); }); @@ -2961,7 +2961,7 @@ Obtains all KV pairs that match the specified key prefix. This API uses an async | Name | Type | Mandatory| Description | | --------- | -------------------------------------- | ---- | ---------------------------------------- | | keyPrefix | string | Yes | Key prefix to match. | -| callback | AsyncCallback<[Entry](#entry)[]> | Yes | Callback invoked to return the KV pairs obtained.| +| callback | AsyncCallback<[Entry](#entry)[]> | Yes | Callback invoked to return the KV pairs that match the specified prefix.| **Error codes** @@ -2995,13 +2995,13 @@ try { console.error(`Fail to put Batch.code is ${err.code},message is ${err.message}`); return; } - console.log('Batch put data successfully.'); + console.log('Succeeded in putting Batch'); kvStore.getEntries('batch_test_string_key', function (err, entries) { if (err != undefined) { console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); return; } - console.log('Obtained the entries successfully.'); + console.log('Succeeded in getting Entries'); console.log(`entries.length: ${entries.length}`); console.log(`entries[0]: ${entries[0]}`); }); @@ -3029,7 +3029,7 @@ Obtains all KV pairs that match the specified key prefix. This API uses a promis | Type | Description | | -------------------------------- | ------------------------------------------- | -| Promise<[Entry](#entry)[]> | Promise used to return the KV pairs obtained.| +| Promise<[Entry](#entry)[]> | Promise used to return the KV pairs that match the specified prefix.| **Error codes** @@ -3059,9 +3059,9 @@ try { } console.log(`entries: ${entries}`); kvStore.putBatch(entries).then(async (entries) => { - console.log('Batch put data successfully.'); + console.log('Succeeded in putting Batch'); kvStore.getEntries('batch_test_string_key').then((entries) => { - console.log('Obtained the entries successfully.'); + console.log('Succeeded in getting Entries'); console.log(`PutBatch ${entries}`); }).catch((err) => { console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); @@ -3086,8 +3086,8 @@ Obtains the KV pairs that match the specified **Query** object. This API uses an | Name | Type | Mandatory| Description | | -------- | -------------------------------------- | ---- | ----------------------------------------------- | -| query | [Query](query) | Yes | Key prefix to match. | -| callback | AsyncCallback<[Entry](#entry)[]> | Yes | Callback invoked to return the KV pairs obtained.| +| query | [Query](#query) | Yes | Key prefix to match. | +| callback | AsyncCallback<[Entry](#entry)[]> | Yes | Callback invoked to return the KV pairs that match the specified **Query** object.| **Error codes** @@ -3118,7 +3118,7 @@ try { } console.log(`entries: {entries}`); kvStore.putBatch(entries, async function (err, data) { - console.log('Batch put data successfully.'); + console.log('Succeeded in putting Batch'); const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getEntries(query, function (err, entries) { @@ -3126,7 +3126,7 @@ try { console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); return; } - console.log('Obtained the entries successfully.'); + console.log('Succeeded in getting Entries'); console.log(`entries.length: ${entries.length}`); console.log(`entries[0]: ${entries[0]}`); }); @@ -3148,13 +3148,13 @@ Obtains the KV pairs that match the specified **Query** object. This API uses a | Name| Type | Mandatory| Description | | ------ | -------------- | ---- | -------------- | -| query | [Query](query) | Yes | **Query** object to match.| +| query | [Query](#query) | Yes | **Query** object to match.| **Return value** | Type | Description | | -------------------------------- | -------------------------------------------------- | -| Promise<[Entry](#entry)[]> | Promise used to return the KV pairs obtained.| +| Promise<[Entry](#entry)[]> | Promise used to return the KV pairs that match the specified **Query** object.| **Error codes** @@ -3185,18 +3185,18 @@ try { } console.log(`entries: {entries}`); kvStore.putBatch(entries).then(async (err) => { - console.log('Batch put data successfully.'); + console.log('Succeeded in putting Batch'); const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getEntries(query).then((entries) => { - console.log('Obtained the entries successfully.'); + console.log('Succeeded in getting Entries'); }).catch((err) => { console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); }); }).catch((err) => { console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`) }); - console.log('Obtained the entries successfully.'); + console.log('Succeeded in getting Entries'); } catch (e) { console.error(`Fail to get Entries.code is ${e.code},message is ${e.message}`); } @@ -3215,7 +3215,7 @@ Obtains a result set with the specified prefix from this single KV store. This A | Name | Type | Mandatory| Description | | --------- | ---------------------------------------------------------- | ---- | ------------------------------------ | | keyPrefix | string | Yes | Key prefix to match. | -| callback | AsyncCallback<[KVStoreResultSet](#kvstoreresultset)> | Yes | Callback invoked to return the result set obtained.| +| callback | AsyncCallback<[KVStoreResultSet](#kvstoreresultset)> | Yes | Callback invoked to return the result set with the specified prefix.| **Error codes** @@ -3249,25 +3249,25 @@ try { console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); return; } - console.log('Batch put data successfully.'); + console.log('Succeeded in putting batch'); kvStore.getResultSet('batch_test_string_key', async function (err, result) { if (err != undefined) { console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); return; } - console.log('Obtained the result set successfully'); + console.log('Succeeded in getting result set'); resultSet = result; kvStore.closeResultSet(resultSet, function (err, data) { if (err != undefined) { console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); return; } - console.log('Closed the result set successfully'); + console.log('Succeeded in closing result set'); }) }); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -3289,7 +3289,7 @@ Obtains a result set with the specified prefix from this single KV store. This A | Type | Description | | ---------------------------------------------------- | --------------------------------------- | -| Promise<[KVStoreResultSet](#kvstoreresultset)> | Promise used to return the result set obtained.| +| Promise<[KVStoreResultSet](#kvstoreresultset)> | Promise used to return the result set with the specified prefix.| **Error codes** @@ -3319,23 +3319,23 @@ try { entries.push(entry); } kvStore.putBatch(entries).then(async (err) => { - console.log('Batch put data successfully.'); + console.log('Succeeded in putting batch'); }).catch((err) => { console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); }); kvStore.getResultSet('batch_test_string_key').then((result) => { - console.log('Obtained the result set successfully'); + console.log('Succeeded in getting result set'); resultSet = result; }).catch((err) => { console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); }); kvStore.closeResultSet(resultSet).then((err) => { - console.log('Closed the result set successfully'); + console.log('Succeeded in closing result set'); }).catch((err) => { console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -3386,7 +3386,7 @@ try { console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); return; } - console.log('Batch put data successfully.'); + console.log('Succeeded in putting batch'); const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getResultSet(query, async function (err, result) { @@ -3394,11 +3394,11 @@ try { console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); return; } - console.log('Obtained the result set successfully'); + console.log('Succeeded in getting result set'); }); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -3414,7 +3414,7 @@ Obtains a **KVStoreResultSet** object that matches the specified **Query** objec | Name| Type | Mandatory| Description | | ------ | -------------- | ---- | -------------- | -| query | [Query](query) | Yes | **Query** object to match.| +| query | [Query](#query) | Yes | **Query** object to match.| **Return value** @@ -3450,20 +3450,20 @@ try { entries.push(entry); } kvStore.putBatch(entries).then(async (err) => { - console.log('Batch put data successfully.'); + console.log('Succeeded in putting batch'); }).catch((err) => { console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); }); const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getResultSet(query).then((result) => { - console.log('Obtained the result set successfully'); + console.log('Succeeded in getting result set'); resultSet = result; }).catch((err) => { console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -3508,18 +3508,18 @@ try { console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); return; } - console.log('Obtained the result set successfully'); + console.log('Succeeded in getting result set'); resultSet = result; kvStore.closeResultSet(resultSet, function (err, data) { if (err != undefined) { console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); return; } - console.log('Closed the result set successfully'); + console.log('Succeeded in closing result set'); }) }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -3565,18 +3565,18 @@ try { let predicates = new dataSharePredicates.DataSharePredicates(); predicates.prefixKey("batch_test_string_key"); kvStore.getResultSet(predicates).then((result) => { - console.log('Obtained the result set successfully'); + console.log('Succeeded in getting result set'); resultSet = result; }).catch((err) => { console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); }); kvStore.closeResultSet(resultSet).then((err) => { - console.log('Closed the result set successfully'); + console.log('Succeeded in closing result set'); }).catch((err) => { console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -3603,13 +3603,13 @@ try { let resultSet = null; kvStore.closeResultSet(resultSet, function (err, data) { if (err == undefined) { - console.log('Closed the result set successfully'); + console.log('Succeeded in closing result set'); } else { console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); } }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -3640,12 +3640,12 @@ let kvStore; try { let resultSet = null; kvStore.closeResultSet(resultSet).then(() => { - console.log('Closed the result set successfully'); + console.log('Succeeded in closing result set'); }).catch((err) => { console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -3661,7 +3661,7 @@ Obtains the number of results that matches the specified **Query** object. This | Name | Type | Mandatory| Description | | -------- | --------------------------- | ---- | ------------------------------------------- | -| query | [Query](query) | Yes | **Query** object to match. | +| query | [Query](#query) | Yes | **Query** object to match. | | callback | AsyncCallback<number> | Yes | Callback invoked to return the number of results obtained.| **Error codes** @@ -3691,7 +3691,7 @@ try { entries.push(entry); } kvStore.putBatch(entries, async function (err, data) { - console.log('Batch put data successfully.'); + console.log('Succeeded in putting batch'); const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getResultSize(query, async function (err, resultSize) { @@ -3699,11 +3699,11 @@ try { console.error(`Fail to get result size.code is ${err.code},message is ${err.message}`); return; } - console.log('Obtained the result set size successfully'); + console.log('Succeeded in getting result set size'); }); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -3719,7 +3719,7 @@ Obtains the number of results that matches the specified **Query** object. This | Name| Type | Mandatory| Description | | ------ | -------------- | ---- | -------------- | -| query | [Query](query) | Yes | **Query** object to match.| +| query | [Query](#query) | Yes | **Query** object to match.| **Return value** @@ -3754,19 +3754,19 @@ try { entries.push(entry); } kvStore.putBatch(entries).then(async (err) => { - console.log('Batch put data successfully.'); + console.log('Succeeded in putting batch'); }).catch((err) => { console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); }); const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getResultSize(query).then((resultSize) => { - console.log('Obtained the result set size successfully'); + console.log('Succeeded in getting result set size'); }).catch((err) => { console.error(`Fail to get result size.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -3803,7 +3803,7 @@ try { if (err) { console.error(`Fail to backup.code is ${err.code},message is ${err.message} `); } else { - console.info(`Backed up data successfully. data=${data}`); + console.info(`Succeeded in backupping data.data=${data}`); } }); } catch (e) { @@ -3846,7 +3846,7 @@ let kvStore; let file = "BK001"; try { kvStore.backup(file).then((data) => { - console.info(`Backed up data successfully. data=${data}`); + console.info(`Succeeded in backupping data.data=${data}`); }).catch((err) => { console.error(`Fail to backup.code is ${err.code},message is ${err.message}`); }); @@ -3888,7 +3888,7 @@ try { if (err) { console.error(`Fail to restore.code is ${err.code},message is ${err.message}`); } else { - console.info(`Restored data successfully. data=${data}`); + console.info(`Succeeded in restoring data.data=${data}`); } }); } catch (e) { @@ -3931,7 +3931,7 @@ let kvStore; let file = "BK001"; try { kvStore.restore(file).then((data) => { - console.info(`Restored data successfully. data=${data}`); + console.info(`Succeeded in restoring data.data=${data}`); }).catch((err) => { console.error(`Fail to restore.code is ${err.code},message is ${err.message}`); }); @@ -3965,7 +3965,7 @@ try { if (err) { console.error(`Fail to delete Backup.code is ${err.code},message is ${err.message}`); } else { - console.info(`Deleted the backup file successfully. data=${data}`); + console.info(`Succeed in deleting Backup.data=${data}`); } }); } catch (e) { @@ -4000,7 +4000,7 @@ let kvStore; let files = ["BK001", "BK002"]; try { kvStore.deleteBackup(files).then((data) => { - console.info(`Deleted the backup file successfully. data=${data}`); + console.info(`Succeed in deleting Backup.data=${data}`); }).catch((err) => { console.error(`Fail to delete Backup.code is ${err.code},message is ${err.message}`); }) @@ -4061,7 +4061,7 @@ try { console.error(`Fail to start Transaction.code is ${err.code},message is ${err.message}`); return; } - console.log('Started the transaction successfully.'); + console.log('Succeeded in starting Transaction'); let entries = putBatchString(10, 'batch_test_string_key'); console.log(`entries: ${entries}`); kvStore.putBatch(entries, async function (err, data) { @@ -4069,7 +4069,7 @@ try { console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); return; } - console.log('Batch put data successfully.'); + console.log('Succeeded in putting Batch'); }); }); } catch (e) { @@ -4110,7 +4110,7 @@ try { count++; }); kvStore.startTransaction().then(async (err) => { - console.log('Started the transaction successfully.'); + console.log('Succeeded in starting Transaction'); }).catch((err) => { console.error(`Fail to start Transaction.code is ${err.code},message is ${err.message}`); }); @@ -4148,13 +4148,13 @@ let kvStore; try { kvStore.commit(function (err, data) { if (err == undefined) { - console.log('Committed the transaction successfully.'); + console.log('Succeeded in committing'); } else { console.error(`Fail to commit.code is ${err.code},message is ${err.message}`); } }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -4186,12 +4186,12 @@ For details about the error codes, see [Distributed KV Store Error Codes](../err let kvStore; try { kvStore.commit().then(async (err) => { - console.log('Committed the transaction successfully.'); + console.log('Succeeded in committing'); }).catch((err) => { console.error(`Fail to commit.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.ode is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.ode is ${e.code},message is ${e.message}`); } ``` @@ -4224,13 +4224,13 @@ let kvStore; try { kvStore.rollback(function (err,data) { if (err == undefined) { - console.log('Rolled back the transaction successfully'); + console.log('Succeeded in rolling back'); } else { console.error(`Fail to rollback.code is ${err.code},message is ${err.message}`); } }); }catch(e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -4262,12 +4262,12 @@ For details about the error codes, see [Distributed KV Store Error Codes](../err let kvStore; try { kvStore.rollback().then(async (err) => { - console.log('Rolled back the transaction successfully'); + console.log('Succeeded in rolling back'); }).catch((err) => { console.error(`Fail to rollback.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -4293,13 +4293,13 @@ let kvStore; try { kvStore.enableSync(true, function (err, data) { if (err == undefined) { - console.log('Enabled sync successfully.'); + console.log('Succeeded in enabling sync'); } else { console.error(`Fail to enable sync.code is ${err.code},message is ${err.message}`); } }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -4329,12 +4329,12 @@ Sets data synchronization, which can be enabled or disabled. This API uses a pro let kvStore; try { kvStore.enableSync(true).then((err) => { - console.log('Enabled sync successfully.'); + console.log('Succeeded in enabling sync'); }).catch((err) => { console.error(`Fail to enable sync.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -4366,10 +4366,10 @@ try { console.error(`Fail to set syncRange.code is ${err.code},message is ${err.message}`); return; } - console.log('Set syncRange successfully.'); + console.log('Succeeded in setting syncRange'); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -4402,12 +4402,12 @@ try { const localLabels = ['A', 'B']; const remoteSupportLabels = ['C', 'D']; kvStore.setSyncRange(localLabels, remoteSupportLabels).then((err) => { - console.log('Set syncRange successfully.'); + console.log('Succeeded in setting syncRange'); }).catch((err) => { console.error(`Fail to set syncRange.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -4437,10 +4437,10 @@ try { console.error(`Fail to set syncParam.code is ${err.code},message is ${err.message}`); return; } - console.log('Set syncParam successfully'); + console.log('Succeeded in setting syncParam'); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -4471,12 +4471,12 @@ let kvStore; try { const defaultAllowedDelayMs = 500; kvStore.setSyncParam(defaultAllowedDelayMs).then((err) => { - console.log('Set syncParam successfully'); + console.log('Succeeded in setting syncParam'); }).catch((err) => { console.error(`Fail to set syncParam.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -4485,6 +4485,9 @@ try { sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void Synchronizes the KV store manually. For details about the synchronization modes of the distributed data service, see [Distributed Data Service Overview](../../database/database-mdds-overview.md). +> **NOTE** +> +> The value of **deviceIds** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications. **Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC @@ -4510,26 +4513,41 @@ For details about the error codes, see [Distributed KV Store Error Codes](../err **Example** ```js +import deviceManager from '@ohos.distributedHardware.deviceManager'; + +let devManager; let kvStore; const KEY_TEST_SYNC_ELEMENT = 'key_test_sync'; const VALUE_TEST_SYNC_ELEMENT = 'value-string-001'; -try { - kvStore.on('syncComplete', function (data) { +// create deviceManager +deviceManager.createDeviceManager('bundleName', (err, value) => { + if (!err) { + devManager = value; + let deviceIds = []; + if (devManager != null) { + var devices = devManager.getTrustedDeviceListSync(); + for (var i = 0; i < devices.length; i++) { + deviceIds[i] = devices[i].deviceId; + } + } + try { + kvStore.on('syncComplete', function (data) { console.log('Sync dataChange'); - }); - kvStore.put(KEY_TEST_SYNC_ELEMENT + 'testSync101', VALUE_TEST_SYNC_ELEMENT, function (err, data) { + }); + kvStore.put(KEY_TEST_SYNC_ELEMENT + 'testSync101', VALUE_TEST_SYNC_ELEMENT, function (err, data) { if (err != undefined) { - console.error(`Fail to sync.code is ${err.code},message is ${err.message}`); - return; + console.error(`Fail to sync.code is ${err.code},message is ${err.message}`); + return; } - console.log('Put data successfully.'); - const devices = ['deviceList']; + console.log('Succeeded in putting data'); const mode = distributedKVStore.SyncMode.PULL_ONLY; - kvStore.sync(devices, mode, 1000); - }); -} catch (e) { - console.error(`Fail to sync.code is ${e.code},message is ${e.message}`); -} + kvStore.sync(deviceIds, mode, 1000); + }); + } catch (e) { + console.error(`Fail to sync.code is ${e.code},message is ${e.message}`); + } + } +}); ``` ### sync @@ -4537,6 +4555,9 @@ try { sync(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void Synchronizes the KV store manually. This API returns the result synchronously. For details about the synchronization modes of the distributed data service, see [Distributed Data Service Overview](../../database/database-mdds-overview.md). +> **NOTE**
+> +> The value of **deviceIds** is obtained by [deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync). The APIs of the **deviceManager** module are system interfaces and available only to system applications. **Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC @@ -4548,7 +4569,7 @@ Synchronizes the KV store manually. This API returns the result synchronously. F | --------- | --------------------- | ---- | ---------------------------------------------- | | 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](query) | Yes | **Query** object to match. | +| query | [Query](#query) | Yes | **Query** object to match. | | delayMs | number | No | Allowed synchronization delay time, in ms. | **Error codes** @@ -4563,29 +4584,44 @@ For details about the error codes, see [Distributed KV Store Error Codes](../err **Example** ```js +import deviceManager from '@ohos.distributedHardware.deviceManager'; + +let devManager; let kvStore; const KEY_TEST_SYNC_ELEMENT = 'key_test_sync'; const VALUE_TEST_SYNC_ELEMENT = 'value-string-001'; -try { - kvStore.on('syncComplete', function (data) { +// create deviceManager +deviceManager.createDeviceManager('bundleName', (err, value) => { + if (!err) { + devManager = value; + let deviceIds = []; + if (devManager != null) { + var devices = devManager.getTrustedDeviceListSync(); + for (var i = 0; i < devices.length; i++) { + deviceIds[i] = devices[i].deviceId; + } + } + try { + kvStore.on('syncComplete', function (data) { console.log('Sync dataChange'); - }); - kvStore.put(KEY_TEST_SYNC_ELEMENT + 'testSync101', VALUE_TEST_SYNC_ELEMENT, function (err, data) { + }); + kvStore.put(KEY_TEST_SYNC_ELEMENT + 'testSync101', VALUE_TEST_SYNC_ELEMENT, function (err, data) { if (err != undefined) { - console.error(`Fail to sync.code is ${err.code},message is ${err.message}`); - return; + console.error(`Fail to sync.code is ${err.code},message is ${err.message}`); + return; } - console.log('Put data successfully.'); - const devices = ['deviceList']; + console.log('Succeeded in putting data'); const mode = distributedKVStore.SyncMode.PULL_ONLY; const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); query.deviceId('localDeviceId'); - kvStore.sync(devices, query, mode, 1000); - }); -} catch (e) { - console.error(`Fail to sync.code is ${e.code},message is ${e.message}`); -} + kvStore.sync(deviceIds, query, mode, 1000); + }); + } catch (e) { + console.error(`Fail to sync.code is ${e.code},message is ${e.message}`); + } + } +}); ``` ### on('dataChange') @@ -4622,7 +4658,7 @@ try { console.log(`dataChange callback call data: ${data}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -4652,7 +4688,7 @@ try { console.log(`syncComplete ${data}`); }); kvStore.put(KEY_TEST_FLOAT_ELEMENT, VALUE_TEST_FLOAT_ELEMENT).then((data) => { - console.log('Put data successfully.'); + console.log('succeeded in putting'); }).catch((err) => { console.error(`Fail to put.code is ${err.code},message is ${err.message}`); }); @@ -4793,10 +4829,10 @@ try { console.error(`Fail to get SecurityLevel.code is ${err.code},message is ${err.message}`); return; } - console.log('Obtained securityLevel successfully'); + console.log('Succeeded in getting securityLevel'); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -4828,12 +4864,12 @@ For details about the error codes, see [Distributed KV Store Error Codes](../err let kvStore; try { kvStore.getSecurityLevel().then((data) => { - console.log('Obtained securityLevel successfully'); + console.log('Succeeded in getting securityLevel'); }).catch((err) => { console.error(`Fail to get SecurityLevel.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -4884,13 +4920,13 @@ try { console.error(`Fail to put.code is ${err.code},message is ${err.message}`); return; } - console.log("Put data successfully."); + console.log("Succeeded in putting"); kvStore.get(KEY_TEST_STRING_ELEMENT, function (err, data) { if (err != undefined) { console.error(`Fail to get.code is ${err.code},message is ${err.message}`); return; } - console.log(`Obtained data successfully. data=${data}`); + console.log(`Succeeded in getting data.data=${data}`); }); }); } catch (e) { @@ -4936,9 +4972,9 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; try { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then((data) => { - console.log(`Put data successfully. data=${data}`); + console.log(`Succeeded in putting data.data=${data}`); kvStore.get(KEY_TEST_STRING_ELEMENT).then((data) => { - console.log(`Obtained data successfully. data=${data}`); + console.log(`Succeeded in getting data.data=${data}`); }).catch((err) => { console.error(`Fail to get.code is ${err.code},message is ${err.message}`); }); @@ -4988,13 +5024,13 @@ try { console.error(`Fail to put.code is ${err.code},message is ${err.message}`); return; } - console.log('Put data successfully.'); + console.log('Succeeded in putting'); kvStore.get('localDeviceId', KEY_TEST_STRING_ELEMENT, function (err, data) { if (err != undefined) { console.error(`Fail to get.code is ${err.code},message is ${err.message}`); return; } - console.log('Obtained data successfully'); + console.log('Succeeded in getting'); }); }) } catch (e) { @@ -5021,7 +5057,7 @@ Obtains a string value that matches the specified device ID and key. This API us | Type | Description | | ------ | ------- | -|Promise<boolean\|string\|number\|Uint8Array> |Promise used to return the string value obtained.| +|Promise<boolean\|string\|number\|Uint8Array> |Promise used to return the string value that matches the given condition.| **Error codes** @@ -5041,9 +5077,9 @@ const KEY_TEST_STRING_ELEMENT = 'key_test_string_2'; const VALUE_TEST_STRING_ELEMENT = 'value-string-002'; try { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then(async (data) => { - console.log('Put data successfully.'); + console.log('Succeeded in putting'); kvStore.get('localDeviceId', KEY_TEST_STRING_ELEMENT).then((data) => { - console.log('Obtained data successfully'); + console.log('Succeeded in getting'); }).catch((err) => { console.error(`Fail to get.code is ${err.code},message is ${err.message}`); }); @@ -5068,7 +5104,7 @@ Obtains all KV pairs that match the specified key prefix for this device. This A | Name | Type | Mandatory| Description | | --------- | -------------------------------------- | ---- | ---------------------------------------- | | keyPrefix | string | Yes | Key prefix to match. | -| callback | AsyncCallback<[Entry](#entry)[]> | Yes | Callback invoked to return the KV pairs obtained.| +| callback | AsyncCallback<[Entry](#entry)[]> | Yes | Callback invoked to return the KV pairs that match the specified prefix.| **Error codes** @@ -5102,13 +5138,13 @@ try { console.error(`Fail to put Batch.code is ${err.code},message is ${err.message}`); return; } - console.log('Batch put data successfully.'); + console.log('Succeeded in putting Batch'); kvStore.getEntries('batch_test_string_key', function (err, entries) { if (err != undefined) { console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); return; } - console.log('Obtained the entries successfully.'); + console.log('Succeeded in getting Entries'); console.log(`entries.length: ${entries.length}`); console.log(`entries[0]: ${entries[0]}`); }); @@ -5136,7 +5172,7 @@ Obtains all KV pairs that match the specified key prefix for this device. This A | Type | Description | | -------------------------------- | ------------------------------------------- | -| Promise<[Entry](#entry)[]> | Promise used to return the KV pairs obtained.| +| Promise<[Entry](#entry)[]> | Promise used to return the KV pairs that match the specified prefix.| **Error codes** @@ -5166,9 +5202,9 @@ try { } console.log(`entries: ${entries}`); kvStore.putBatch(entries).then(async (entries) => { - console.log('Batch put data successfully.'); + console.log('Succeeded in putting Batch'); kvStore.getEntries('batch_test_string_key').then((entries) => { - console.log('Obtained the entries successfully.'); + console.log('Succeeded in getting Entries'); console.log(`PutBatch ${entries}`); }).catch((err) => { console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); @@ -5229,13 +5265,13 @@ try { console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); return; } - console.log('Batch put data successfully.'); + console.log('Succeeded in putting batch'); kvStore.getEntries('localDeviceId', 'batch_test_string_key', function (err, entries) { if (err != undefined) { console.error(`Fail to get entries.code is ${err.code},message is ${err.message}`); return; } - console.log('Obtained the entries successfully.'); + console.log('Succeeded in getting entries'); console.log(`entries.length: ${entries.length}`); console.log(`entries[0]: ${entries[0]}`); }); @@ -5264,7 +5300,7 @@ Obtains all KV pairs that match the specified device ID and key prefix. This API | Type | Description | | -------------------------------- | ------------------------------------------------- | -| Promise<[Entry](#entry)[]> | Promise used to return the KV pairs obtained.| +| Promise<[Entry](#entry)[]> | Promise used to return all the KV pairs that match the given condition.| **Error codes** @@ -5294,9 +5330,9 @@ try { } console.log(`entries: ${entries}`); kvStore.putBatch(entries).then(async (err) => { - console.log('Batch put data successfully.'); + console.log('Succeeded in putting batch'); kvStore.getEntries('localDeviceId', 'batch_test_string_key').then((entries) => { - console.log('Obtained the entries successfully.'); + console.log('Succeeded in getting entries'); console.log(`entries.length: ${entries.length}`); console.log(`entries[0]: ${entries[0]}`); console.log(`entries[0].value: ${entries[0].value}`); @@ -5324,8 +5360,8 @@ Obtains all KV pairs that match the specified **Query** object for this device. | Name | Type | Mandatory| Description | | -------- | -------------------------------------- | ---- | ----------------------------------------------------- | -| query | [Query](query) | Yes | Key prefix to match. | -| callback | AsyncCallback<[Entry](#entry)[]> | Yes | Callback invoked to return the KV pairs obtained.| +| query | [Query](#query) | Yes | Key prefix to match. | +| callback | AsyncCallback<[Entry](#entry)[]> | Yes | Callback invoked to return the KV pairs that match the specified **Query** object on the local device.| **Error codes** @@ -5356,7 +5392,7 @@ try { } console.log(`entries: {entries}`); kvStore.putBatch(entries, async function (err, data) { - console.log('Batch put data successfully.'); + console.log('Succeeded in putting Batch'); const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getEntries(query, function (err, entries) { @@ -5364,7 +5400,7 @@ try { console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); return; } - console.log('Obtained the entries successfully.'); + console.log('Succeeded in getting Entries'); console.log(`entries.length: ${entries.length}`); console.log(`entries[0]: ${entries[0]}`); }); @@ -5386,13 +5422,13 @@ Obtains all KV pairs that match the specified **Query** object for this device. | Name| Type | Mandatory| Description | | ------ | -------------- | ---- | -------------- | -| query | [Query](query) | Yes | **Query** object to match.| +| query | [Query](#query) | Yes | **Query** object to match.| **Return value** | Type | Description | | -------------------------------- | -------------------------------------------------------- | -| Promise<[Entry](#entry)[]> | Promise used to return the KV pairs obtained.| +| Promise<[Entry](#entry)[]> | Promise used to return the KV pairs that match the specified **Query** object on the local device.| **Error codes** @@ -5423,18 +5459,18 @@ try { } console.log(`entries: {entries}`); kvStore.putBatch(entries).then(async (err) => { - console.log('Batch put data successfully.'); + console.log('Succeeded in putting Batch'); const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getEntries(query).then((entries) => { - console.log('Obtained the entries successfully.'); + console.log('Succeeded in getting Entries'); }).catch((err) => { console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); }); }).catch((err) => { console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`) }); - console.log('Obtained the entries successfully.'); + console.log('Succeeded in getting Entries'); } catch (e) { console.error(`Fail to get Entries.code is ${e.code},message is ${e.message}`); } @@ -5453,8 +5489,8 @@ Obtains the KV pairs that match the specified device ID and **Query** object. Th | Name | Type | Mandatory| Description | | -------- | -------------------------------------- | ---- | ------------------------------------------------------- | | deviceId | string | Yes | ID of the target device. | -| query | [Query](query) | Yes | **Query** object to match. | -| callback | AsyncCallback<[Entry](#entry)[]> | Yes | Callback invoked to return the KV pairs obtained.| +| query | [Query](#query) | Yes | **Query** object to match. | +| callback | AsyncCallback<[Entry](#entry)[]> | Yes | Callback invoked to return the KV pairs that match the specified device ID and **Query** object.| **Error codes** @@ -5489,7 +5525,7 @@ try { console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); return; } - console.log('Batch put data successfully.'); + console.log('Succeeded in putting batch'); var query = new distributedKVStore.Query(); query.deviceId('localDeviceId'); query.prefixKey("batch_test"); @@ -5498,12 +5534,12 @@ try { console.error(`Fail to get entries.code is ${err.code},message is ${err.message}`); return; } - console.log('Obtained the entries successfully.'); + console.log('Succeeded in getting entries'); console.log(`entries.length: ${entries.length}`); console.log(`entries[0]: ${entries[0]}`); }) }); - console.log('Obtained the entries successfully.'); + console.log('Succeeded in getting entries'); } catch (e) { console.error(`Fail to get entries.code is ${e.code},message is ${e.message}`); } @@ -5522,13 +5558,13 @@ Obtains the KV pairs that match the specified device ID and **Query** object. Th | Name | Type | Mandatory| Description | | -------- | -------------- | ---- | -------------------- | | deviceId | string | Yes | ID of the target device.| -| query | [Query](query) | Yes | **Query** object to match. | +| query | [Query](#query) | Yes | **Query** object to match. | **Return value** | Type | Description | | -------------------------------- | ---------------------------------------------------------- | -| Promise<[Entry](#entry)[]> | Promise used to return the KV pairs obtained.| +| Promise<[Entry](#entry)[]> | Promise used to return the KV pairs that match the specified device ID and **Query** object.| **Error codes** @@ -5559,19 +5595,19 @@ try { } console.log(`entries: ${entries}`); kvStore.putBatch(entries).then(async (err) => { - console.log('Batch put data successfully.'); + console.log('Succeeded in putting batch'); var query = new distributedKVStore.Query(); query.deviceId('localDeviceId'); query.prefixKey("batch_test"); kvStore.getEntries('localDeviceId', query).then((entries) => { - console.log('Obtained the entries successfully.'); + console.log('Succeeded in getting entries'); }).catch((err) => { console.error(`Fail to get entries.code is ${err.code},message is ${err.message}`); }); }).catch((err) => { console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); }); - console.log('Obtained the entries successfully.'); + console.log('Succeeded in getting entries'); } catch (e) { console.error(`Fail to get entries.code is ${e.code},message is ${e.message}`); } @@ -5590,7 +5626,7 @@ Obtains a result set with the specified prefix for this device. This API uses an | Name | Type | Mandatory| Description | | --------- | ---------------------------------------------------------- | ---- | ------------------------------------ | | keyPrefix | string | Yes | Key prefix to match. | -| callback | AsyncCallback<[KVStoreResultSet](#kvstoreresultset)> | Yes | Callback invoked to return the result set obtained.| +| callback | AsyncCallback<[KVStoreResultSet](#kvstoreresultset)> | Yes | Callback invoked to return the result set with the specified prefix.| **Error codes** @@ -5624,25 +5660,25 @@ try { console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); return; } - console.log('Batch put data successfully.'); + console.log('Succeeded in putting batch'); kvStore.getResultSet('batch_test_string_key', async function (err, result) { if (err != undefined) { console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); return; } - console.log('Obtained the result set successfully'); + console.log('Succeeded in getting result set'); resultSet = result; kvStore.closeResultSet(resultSet, function (err, data) { if (err != undefined) { console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); return; } - console.log('Closed the result set successfully'); + console.log('Succeeded in closing result set'); }) }); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -5664,7 +5700,7 @@ Obtains a result set with the specified prefix for this device. This API uses a | Type | Description | | ---------------------------------------------------- | --------------------------------------- | -| Promise<[KVStoreResultSet](#kvstoreresultset)> | Promise used to return the result set obtained.| +| Promise<[KVStoreResultSet](#kvstoreresultset)> | Promise used to return the result set with the specified prefix.| **Error codes** @@ -5694,23 +5730,23 @@ try { entries.push(entry); } kvStore.putBatch(entries).then(async (err) => { - console.log('Batch put data successfully.'); + console.log('Succeeded in putting batch'); }).catch((err) => { console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); }); kvStore.getResultSet('batch_test_string_key').then((result) => { - console.log('Obtained the result set successfully'); + console.log('Succeeded in getting result set'); resultSet = result; }).catch((err) => { console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); }); kvStore.closeResultSet(resultSet).then((err) => { - console.log('Closed the result set successfully'); + console.log('Succeeded in closing result set'); }).catch((err) => { console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -5728,7 +5764,7 @@ Obtains a **KVStoreResultSet** object that matches the specified device ID and k | --------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | deviceId | string | Yes | ID of the target device. | | keyPrefix | string | Yes | Key prefix to match. | -| callback | AsyncCallback<[KVStoreResultSet](#kvstoreresultset)> | Yes | Callback invoked to return the **KVStoreResultSet** object obtained.| +| callback | AsyncCallback<[KVStoreResultSet](#kvstoreresultset)> | Yes | Callback invoked to return the **KVStoreResultSet** object that matches the specified device ID and key prefix.| **Error codes** @@ -5750,14 +5786,14 @@ try { console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`); return; } - console.log('Obtained the result set successfully.'); + console.log('Succeeded in getting resultSet'); resultSet = result; kvStore.closeResultSet(resultSet, function (err, data) { if (err != undefined) { console.error(`Fail to close resultSet.code is ${err.code},message is ${err.message}`); return; } - console.log('Closed the result set successfully.'); + console.log('Succeeded in closing resultSet'); }) }); } catch (e) { @@ -5784,7 +5820,7 @@ Obtains a **KVStoreResultSet** object that matches the specified device ID and k | Type | Description | | ------------------------------------------------------ | ------------------------------------------------------------ | -| Promise<[KVStoreResultSet](#kvstoreresultset)> | Promise used to return the **KVStoreResultSet** object obtained.| +| Promise<[KVStoreResultSet](#kvstoreresultset)> | Promise used to return the **KVStoreResultSet** object that matches the specified device ID and key prefix.| **Error codes** @@ -5802,13 +5838,13 @@ let kvStore; try { let resultSet; kvStore.getResultSet('localDeviceId', 'batch_test_string_key').then((result) => { - console.log('Obtained the result set successfully.'); + console.log('Succeeded in getting resultSet'); resultSet = result; }).catch((err) => { console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`); }); kvStore.closeResultSet(resultSet).then((err) => { - console.log('Closed the result set successfully.'); + console.log('Succeeded in closing resultSet'); }).catch((err) => { console.error(`Fail to close resultSet.code is ${err.code},message is ${err.message}`); }); @@ -5830,8 +5866,8 @@ Obtains a **KVStoreResultSet** object that matches the specified device ID and * | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | deviceId | string | Yes | ID of the device to which the **KVStoreResultSet** object belongs. | -| query | [Query](query) | Yes | **Query** object to match. | -| callback | AsyncCallback<[KVStoreResultSet](#kvstoreresultset)> | Yes | Callback invoked to return the **KVStoreResultSet** object obtained.| +| query | [Query](#query) | Yes | **Query** object to match. | +| callback | AsyncCallback<[KVStoreResultSet](#kvstoreresultset)> | Yes | Callback invoked to return the **KVStoreResultSet** object that matches the specified device ID and **Query** object.| **Error codes** @@ -5865,7 +5901,7 @@ try { console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); return; } - console.log('Batch put data successfully.'); + console.log('Succeeded in putting batch'); const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getResultSet('localDeviceId', query, async function (err, result) { @@ -5873,14 +5909,14 @@ try { console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`); return; } - console.log('Obtained the result set successfully.'); + console.log('Succeeded in getting resultSet'); resultSet = result; kvStore.closeResultSet(resultSet, function (err, data) { if (err != undefined) { console.error(`Fail to close resultSet.code is ${err.code},message is ${err.message}`); return; } - console.log('Closed the result set successfully.'); + console.log('Succeeded in closing resultSet'); }) }); }); @@ -5902,13 +5938,13 @@ Obtains a **KVStoreResultSet** object that matches the specified device ID and * | Name | Type | Mandatory| Description | | -------- | -------------- | ---- | ---------------------------------- | | deviceId | string | Yes | ID of the device to which the **KVStoreResultSet** object belongs.| -| query | [Query](query) | Yes | **Query** object to match. | +| query | [Query](#query) | Yes | **Query** object to match. | **Return value** | Type | Description | | ------------------------------------------------------ | ------------------------------------------------------------ | -| Promise<[KVStoreResultSet](#kvstoreresultset)> | Promise used to return the **KVStoreResultSet** object obtained.| +| Promise<[KVStoreResultSet](#kvstoreresultset)> | Promise used to return the **KVStoreResultSet** object that matches the specified device ID and **Query** object.| **Error codes** @@ -5938,14 +5974,14 @@ try { entries.push(entry); } kvStore.putBatch(entries).then(async (err) => { - console.log('Batch put data successfully.'); + console.log('Succeeded in putting batch'); }).catch((err) => { console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); }); const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getResultSet('localDeviceId', query).then((result) => { - console.log('Obtained the result set successfully.'); + console.log('Succeeded in getting resultSet'); resultSet = result; }).catch((err) => { console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`); @@ -5953,7 +5989,7 @@ try { query.deviceId('localDeviceId'); console.log("GetResultSet " + query.getSqlLike()); kvStore.closeResultSet(resultSet).then((err) => { - console.log('Closed the result set successfully.'); + console.log('Succeeded in closing resultSet'); }).catch((err) => { console.error(`Fail to close resultSet.code is ${err.code},message is ${err.message}`); }); @@ -5975,13 +6011,13 @@ Obtains a **KVStoreResultSet** object that matches the specified **Query** objec | Name| Type | Mandatory| Description | | ------ | -------------- | ---- | -------------- | -| query | [Query](query) | Yes | **Query** object to match.| +| query | [Query](#query) | Yes | **Query** object to match.| **Return value** | Type | Description | | ---------------------------------------------------- | ------------------------------------------------------------ | -| Promise<[KVStoreResultSet](#kvstoreresultset)> | Promise used to return Obtains a **KVStoreResultSet** object that matches the specified **Query** object for this device.| +| Promise<[KVStoreResultSet](#kvstoreresultset)> | Promise used to return the **KVStoreResultSet** object obtained.| **Error codes** @@ -6011,20 +6047,20 @@ try { entries.push(entry); } kvStore.putBatch(entries).then(async (err) => { - console.log('Batch put data successfully.'); + console.log('Succeeded in putting batch'); }).catch((err) => { console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); }); const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getResultSet(query).then((result) => { - console.log('Obtained the result set successfully'); + console.log('Succeeded in getting result set'); resultSet = result; }).catch((err) => { console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -6041,7 +6077,7 @@ Obtains a **KVStoreResultSet** object that matches the specified device ID and * | Name | Type | Mandatory| Description | | -------- | -------------- | ---- | ---------------------------------- | | deviceId | string | Yes | ID of the device to which the **KVStoreResultSet** object belongs.| -| query | [Query](query) | Yes | **Query** object to match. | +| query | [Query](#query) | Yes | **Query** object to match. | **Return value** @@ -6077,14 +6113,14 @@ try { entries.push(entry); } kvStore.putBatch(entries).then(async (err) => { - console.log('Batch put data successfully.'); + console.log('Succeeded in putting batch'); }).catch((err) => { console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); }); const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getResultSet('localDeviceId', query).then((result) => { - console.log('Obtained the result set successfully.'); + console.log('Succeeded in getting resultSet'); resultSet = result; }).catch((err) => { console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`); @@ -6092,7 +6128,7 @@ try { query.deviceId('localDeviceId'); console.log("GetResultSet " + query.getSqlLike()); kvStore.closeResultSet(resultSet).then((err) => { - console.log('Closed the result set successfully.'); + console.log('Succeeded in closing resultSet'); }).catch((err) => { console.error(`Fail to close resultSet.code is ${err.code},message is ${err.message}`); }); @@ -6143,18 +6179,18 @@ try { console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); return; } - console.log('Obtained the result set successfully'); + console.log('Succeeded in getting result set'); resultSet = result; kvStore.closeResultSet(resultSet, function (err, data) { if (err != undefined) { console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); return; } - console.log('Closed the result set successfully'); + console.log('Succeeded in closing result set'); }) }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -6200,18 +6236,18 @@ try { let predicates = new dataSharePredicates.DataSharePredicates(); predicates.prefixKey("batch_test_string_key"); kvStore.getResultSet(predicates).then((result) => { - console.log('Obtained the result set successfully'); + console.log('Succeeded in getting result set'); resultSet = result; }).catch((err) => { console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); }); kvStore.closeResultSet(resultSet).then((err) => { - console.log('Closed the result set successfully'); + console.log('Succeeded in closing result set'); }).catch((err) => { console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -6257,18 +6293,18 @@ try { console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); return; } - console.log('Obtained the result set successfully'); + console.log('Succeeded in getting result set'); resultSet = result; kvStore.closeResultSet(resultSet, function (err, data) { if (err != undefined) { console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); return; } - console.log('Closed the result set successfully'); + console.log('Succeeded in closing result set'); }) }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -6314,18 +6350,18 @@ try { let predicates = new dataSharePredicates.DataSharePredicates(); predicates.prefixKey("batch_test_string_key"); kvStore.getResultSet('localDeviceId', predicates).then((result) => { - console.log('Obtained the result set successfully'); + console.log('Succeeded in getting result set'); resultSet = result; }).catch((err) => { console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); }); kvStore.closeResultSet(resultSet).then((err) => { - console.log('Closed the result set successfully'); + console.log('Succeeded in closing result set'); }).catch((err) => { console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -6341,8 +6377,8 @@ Obtains the number of results that match the specified **Query** object for this | Name | Type | Mandatory| Description | | -------- | --------------------------- | ---- | ------------------------------------------------- | -| query | [Query](query) | Yes | **Query** object to match. | -| callback | AsyncCallback<number> | Yes | Callback invoked to return the number of results that match the specified **Query** object.| +| query | [Query](#query) | Yes | **Query** object to match. | +| callback | AsyncCallback<number> | Yes | Callback invoked to return the number of results obtained.| **Error codes** @@ -6371,7 +6407,7 @@ try { entries.push(entry); } kvStore.putBatch(entries, async function (err, data) { - console.log('Batch put data successfully.'); + console.log('Succeeded in putting batch'); const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getResultSize(query, async function (err, resultSize) { @@ -6379,11 +6415,11 @@ try { console.error(`Fail to get result size.code is ${err.code},message is ${err.message}`); return; } - console.log('Obtained the result set size successfully'); + console.log('Succeeded in getting result set size'); }); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -6399,13 +6435,13 @@ Obtains the number of results that match the specified **Query** object for this | Name| Type | Mandatory| Description | | ------ | -------------- | ---- | -------------- | -| query | [Query](query) | Yes | **Query** object to match.| +| query | [Query](#query) | Yes | **Query** object to match.| **Return value** | Type | Description | | --------------------- | ---------------------------------------------------- | -| Promise<number> | Promise used to return the number of results that match the specified **Query** object.| +| Promise<number> | Promise used to return the number of results obtained.| **Error codes** @@ -6434,19 +6470,19 @@ try { entries.push(entry); } kvStore.putBatch(entries).then(async (err) => { - console.log('Batch put data successfully.'); + console.log('Succeeded in putting batch'); }).catch((err) => { console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); }); const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getResultSize(query).then((resultSize) => { - console.log('Obtained the result set size successfully'); + console.log('Succeeded in getting result set size'); }).catch((err) => { console.error(`Fail to get result size.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -6463,8 +6499,8 @@ Obtains the number of results that matches the specified device ID and **Query** | Name | Type | Mandatory| Description | | -------- | --------------------------- | ---- | --------------------------------------------------- | | deviceId | string | Yes | ID of the device to which the **KVStoreResultSet** object belongs. | -| query | [Query](query) | Yes | **Query** object to match. | -| callback | AsyncCallback<number> | Yes | Callback invoked to return the number of results obtained.| +| query | [Query](#query) | Yes | **Query** object to match. | +| callback | AsyncCallback<number> | Yes | Callback invoked to return the number of results obtained. | **Error codes** @@ -6497,7 +6533,7 @@ try { console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); return; } - console.log('Batch put data successfully.'); + console.log('Succeeded in putting batch'); const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getResultSize('localDeviceId', query, async function (err, resultSize) { @@ -6505,7 +6541,7 @@ try { console.error(`Fail to get resultSize.code is ${err.code},message is ${err.message}`); return; } - console.log('Obtained resultSize successfully'); + console.log('Succeeded in getting resultSize'); ; }); }); @@ -6527,13 +6563,13 @@ Obtains the number of results that matches the specified device ID and **Query** | Name | Type | Mandatory| Description | | -------- | -------------- | ---- | ---------------------------------- | | deviceId | string | Yes | ID of the device to which the **KVStoreResultSet** object belongs.| -| query | [Query](query) | Yes | **Query** object to match. | +| query | [Query](#query) | Yes | **Query** object to match. | **Return value** | Type | Description | | --------------------- | ------------------------------------------------------ | -| Promise<number> | Promise used to return the number of results obtained.| +| Promise<number> | Promise used to return the number of results obtained. | **Error codes** @@ -6562,14 +6598,14 @@ try { entries.push(entry); } kvStore.putBatch(entries).then(async (err) => { - console.log('Batch put data successfully.'); + console.log('Succeeded in putting batch'); }).catch((err) => { console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); }); var query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getResultSize('localDeviceId', query).then((resultSize) => { - console.log('Obtained resultSize successfully'); + console.log('Succeeded in getting resultSize'); ; }).catch((err) => { console.error(`Fail to get resultSize.code is ${err.code},message is ${err.message}`); diff --git a/en/application-dev/reference/apis/js-apis-distributedMissionManager.md b/en/application-dev/reference/apis/js-apis-distributedMissionManager.md index 770689ba93a6a375f7d48a46d49cbe2334bd9bc3..506b940eae2f206b9a1bb5a10a39350abcd99753 100644 --- a/en/application-dev/reference/apis/js-apis-distributedMissionManager.md +++ b/en/application-dev/reference/apis/js-apis-distributedMissionManager.md @@ -368,8 +368,8 @@ Continues a mission on a remote device. This API uses an asynchronous callback t | Name | Type | Mandatory | Description | | --------- | --------------------------------------- | ---- | ----- | -| parameter | [ContinueDeviceInfo](#continuedeviceinfo) | Yes | Parameters required for mission continuation.| -| options | [ContinueCallback](#continuecallback) | Yes | Callback invoked when the mission continuation is complete.| +| parameter | [ContinueDeviceInfo](#js-apis-inner-application-continueDeviceInfo.md) | Yes | Parameters required for mission continuation.| +| options | [ContinueCallback](#js-apis-inner-application-continueCallback.md) | Yes | Callback invoked when the mission continuation is complete.| | callback | AsyncCallback<void> | Yes | Callback used to return the result.| **Error codes** @@ -426,8 +426,8 @@ Continues a mission on a remote device. This API uses a promise to return the re | Name | Type | Mandatory | Description | | --------- | --------------------------------------- | ---- | ----- | -| parameter | [ContinueDeviceInfo](#continuedeviceinfo) | Yes | Parameters required for mission continuation.| -| options | [ContinueCallback](#continuecallback) | Yes | Callback invoked when the mission continuation is complete.| +| parameter | [ContinueDeviceInfo](#js-apis-inner-application-continueDeviceInfo.md) | Yes | Parameters required for mission continuation.| +| options | [ContinueCallback](#js-apis-inner-application-continueCallback.md) | Yes | Callback invoked when the mission continuation is complete.| **Return value** @@ -514,30 +514,3 @@ Defines the parameters required for registering a listener. | Name | Type | Readable | Writable | Description | | -------- | ------ | ---- | ---- | ------- | | deviceId | string | Yes | Yes | Device ID.| - -## ContinueDeviceInfo - -Defines the parameters required for mission continuation. - -**Required permissions**: ohos.permission.MANAGE_MISSIONS - -**System capability**: SystemCapability.Ability.AbilityRuntime.Mission - -| Name | Type | Readable | Writable | Description | -| -------- | ------ | ---- | ---- | ------- | -| srcDeviceId | string | Yes | Yes | ID of the source device.| -| dstDeviceId | string | Yes | Yes | ID of the target device.| -| missionId | number | Yes | Yes | Mission ID.| -| wantParam | {[key: string]: any} | Yes | Yes | Extended parameters.| - -## ContinueCallback - -Defines the callback invoked when the mission continuation is complete. - -**Required permissions**: ohos.permission.MANAGE_MISSIONS - -**System capability**: SystemCapability.Ability.AbilityRuntime.Mission - -| Name | Type | Readable | Writable | Description | -| --------------------- | -------- | ---- | ---- | ------------------ | -| onContinueDone | function | Yes | No | Callback used to notify the user that the mission continuation is complete and return the continuation result. | diff --git a/en/application-dev/reference/apis/js-apis-effectKit.md b/en/application-dev/reference/apis/js-apis-effectKit.md index 7826d164b3c3f9cfbcde07dd9989b1fce3021e4b..4bd7c4e7f9ae45e5eef12715f6c54442ff708445 100644 --- a/en/application-dev/reference/apis/js-apis-effectKit.md +++ b/en/application-dev/reference/apis/js-apis-effectKit.md @@ -131,13 +131,13 @@ A class that stores the color picked. ## ColorPicker -A class used to obtain the main color of an image from its data. Before calling any method of **ColorPicker**, use [createColorPicker](#effectkitcreatecolorpicker) to create a **ColorPicker** instance. +A class used to obtain the color from an image. Before calling any method of **ColorPicker**, use [createColorPicker](#effectkitcreatecolorpicker) to create a **ColorPicker** instance. ### getMainColor getMainColor(): Promise\ -Obtains the main color of the image and writes the result to a **[Color](#color)** instance. This API uses a promise to return the result. +Obtains the main color from the image and writes the result to a [Color](#color) instance. This API uses a promise to return the result. **System capability**: SystemCapability.Multimedia.Image.Core @@ -162,7 +162,7 @@ colorPicker.getMainColor().then(color => { getMainColorSync(): Color -Obtains the main color of the image and writes the result to a **[Color](#color)** instance. This API returns the result in synchronous mode. +Obtains the main color from the image and writes the result to a [Color](#color) instance. This API returns the result in synchronous mode. **System capability**: SystemCapability.Multimedia.Image.Core @@ -180,6 +180,93 @@ console.log('get main color =' + color); ``` ![en-us_image_Main_Color.png](figures/en-us_image_Main_Color.png) +### getLargestProportionColor10+ + +getLargestProportionColor(): Color + +Obtains the color with the largest proportion from the image and writes the result to a [Color](#color) instance. This API returns the result in synchronous mode. + +**System capability**: SystemCapability.Multimedia.Image.Core + +**Return value** + +| Type | Description | +| :------------- | :---------------------------------------------- | +| [Color](#color) | Color value of the color with the largest proportion. If the operation fails, **null** is returned.| + +**Example** + +```js +let color = colorPicker.getLargestProportionColor(); +console.log('get largest proportion color =' + color); +``` +![en-us_image_Largest_Proportion_Color.png](figures/en-us_image_Largest_Proportion_Color.png) + +### getHighestSaturationColor10+ + +getHighestSaturationColor(): Color + +Obtains the color with the highest saturation from the image and writes the result to a [Color](#color) instance. This API returns the result in synchronous mode. + +**System capability**: SystemCapability.Multimedia.Image.Core + +**Return value** + +| Type | Description | +| :------------- | :---------------------------------------------- | +| [Color](#color) | Color value of the color with the highest saturation. If the operation fails, **null** is returned.| + +**Example** + +```js +let color = colorPicker.getHighestSaturationColor(); +console.log('get highest saturation color =' + color); +``` +![en-us_image_Highest_Saturation_Color.png](figures/en-us_image_Highest_Saturation_Color.png) + +### getAverageColor10+ + +getAverageColor(): Color + +Obtains the average color from the image and writes the result to a [Color](#color) instance. This API returns the result in synchronous mode. + +**System capability**: SystemCapability.Multimedia.Image.Core + +**Return value** + +| Type | Description | +| :------------- | :---------------------------------------------- | +| [Color](#color) | Average color value. If the operation fails, **null** is returned.| + +**Example** + +```js +let color = colorPicker.getAverageColor(); +console.log('get average color =' + color); +``` +![en-us_image_Average_Color.png](figures/en-us_image_Average_Color.png) + +### isBlackOrWhiteOrGrayColor10+ + +isBlackOrWhiteOrGrayColor(color: number): boolean + +Checks whether this image is black, white, and gray. + +**System capability**: SystemCapability.Multimedia.Image.Core + +**Return value** + +| Type | Description | +| :------------- | :---------------------------------------------- | +| boolean | Returns **true** if the image is black, white, and gray; returns **false** otherwise.| + +**Example** + +```js +let bJudge = colorPicker.isBlackOrWhiteOrGrayColor(0xFFFFFFFF); +console.log('is black or white or gray color[bool](white) =' + bJudge); +``` + ## Filter A class used to add a specified effect to an image. Before calling any method of **Filter**, use [createEffect](#effectkitcreateeffect) to create a **Filter** instance. diff --git a/en/application-dev/reference/apis/js-apis-emitter.md b/en/application-dev/reference/apis/js-apis-emitter.md index 95b8eb45f0dc91295274ba2ff26087d3268dbce4..9c5499f62e4abf1bbeb14d53f823adc356103641 100644 --- a/en/application-dev/reference/apis/js-apis-emitter.md +++ b/en/application-dev/reference/apis/js-apis-emitter.md @@ -161,4 +161,4 @@ Describes the data passed in the event. | Name| Type | Readable| Writable| Description | | ---- | ------------------ | ---- | ---- | -------------- | -| data | [key: string]: any | Yes | Yes | Data carried by the event. The data type can be String, Integer, or Boolean.| +| data | [key: string]: any | Yes | Yes | Data carried by the event. The value can be a string, integer, or Boolean, wherein a string contains a maximum of 10240 bytes. | diff --git a/en/application-dev/reference/apis/js-apis-enterprise-accountManager.md b/en/application-dev/reference/apis/js-apis-enterprise-accountManager.md new file mode 100644 index 0000000000000000000000000000000000000000..6910779cd902d3368ad743ef1f6e4e179f2caf19 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-enterprise-accountManager.md @@ -0,0 +1,104 @@ +# @ohos.enterprise.accountManager (Account Management) + +The **accountManager** module provides account management capabilities for enterprise devices. Only the enterprise device administrator applications can call the APIs provided by this module. + +> **NOTE** +> +> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version. + +## Modules to Import + +```js +import accountManager from '@ohos.enterprise.accountManager'; +``` + +## accountManager.disallowAddLocalAccount + +disallowAddLocalAccount(admin: Want, disallow: boolean, callback: AsyncCallback<void>): void + +Disallows local accounts. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.ENTERPRISE_SET_ACCOUNT_POLICY + +**System capability**: SystemCapability.Customization.EnterpriseDeviceManager + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ------------------------------- | +| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. | +| disallow | boolean | Yes | Whether to disallow local accounts. The value **true** means disallow local accounts; the value **false** means the opposite. | +| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null**. Otherwise, **err** is an error object. | + +**Error codes** + +For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md). + +| ID| Error Message | +| ------- | ---------------------------------------------------------------------------- | +| 9200001 | The application is not an administrator application of the device. | +| 9200002 | The administrator application does not have permission to manage the device.| + +**Example** + +```js +let wantTemp = { + bundleName: "com.example.myapplication", + abilityName: "EntryAbility", +}; +accountManager.disallowAddLocalAccount(admin, true, (error) => { + if (error != null) { + console.log("error code:" + error.code + " error message:" + error.message); + } +}); +``` + +## accountManager.disallowAddLocalAccount + +disallowAddLocalAccount(admin: Want, disallow: boolean): Promise<void> + +Disallows local accounts. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.ENTERPRISE_SET_ACCOUNT_POLICY + +**System capability**: SystemCapability.Customization.EnterpriseDeviceManager + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----- | ----------------------------------- | ---- | ------- | +| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.| +| disallow | boolean | Yes | Whether to disallow local accounts. The value **true** means disallow local accounts; the value **false** means the opposite. | + +**Return value** + +| Type | Description | +| --------------------- | ------------------------- | +| Promise<void> | Promise that returns no value. | + +**Error codes** + +For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md). + +| ID| Error Message | +| ------- | ---------------------------------------------------------------------------- | +| 9200001 | the application is not an administrator of the device. | +| 9200002 | the administrator application does not have permission to manage the device. | + +**Example** + +```js +let wantTemp = { + bundleName: "com.example.myapplication", + abilityName: "EntryAbility", +}; +accountManager.disallowAddLocalAccount(wantTemp, true).then(() => { + console.log("success"); +}).catch(error => { + console.log("error code:" + error.code + " error message:" + error.message); +}); +``` diff --git a/en/application-dev/reference/apis/js-apis-enterprise-adminManager.md b/en/application-dev/reference/apis/js-apis-enterprise-adminManager.md index 05b3f1f716f675a5eb876acec6e321b9b0dc762d..a29988585ec509bbd1948e101324dbf253991873 100644 --- a/en/application-dev/reference/apis/js-apis-enterprise-adminManager.md +++ b/en/application-dev/reference/apis/js-apis-enterprise-adminManager.md @@ -953,5 +953,7 @@ Enumerates the system management events that can be subscribed to. | Name | Value | Description | | -------------------------- | ---- | ------------- | -| MANAGED_EVENT_BUNDLE_ADDED | 0 | Application installation event.| -| MANAGED_EVENT_BUNDLE_REMOVED | 1 | Application uninstallation event.| +| MANAGED_EVENT_BUNDLE_ADDED | 0 | Bundle added.| +| MANAGED_EVENT_BUNDLE_REMOVED | 1 | Bundle removed.| +| MANAGED_EVENT_APP_START | 2 | Application started.| +| MANAGED_EVENT_APP_STOP | 3 | Application stopped.| diff --git a/en/application-dev/reference/apis/js-apis-enterprise-networkManager.md b/en/application-dev/reference/apis/js-apis-enterprise-networkManager.md new file mode 100644 index 0000000000000000000000000000000000000000..8e527defb2e34a3269b08f19c6bbd049569cff2e --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-enterprise-networkManager.md @@ -0,0 +1,290 @@ +# @ohos.enterprise.networkManager (Network Management) + +The **networkManager** module provides network management capabilities for enterprise devices, including obtaining the device IP address and MAC address. Only the enterprise device administrator applications can call the APIs provided by this module. + +> **NOTE** +> +> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version. + +## Modules to Import + +```js +import networkManager from '@ohos.enterprise.networkManager'; +``` + +## networkManager.getAllNetworkInterfaces + +getAllNetworkInterfaces(admin: Want, callback: AsyncCallback<Array<string>>): void + +Obtains all active network interfaces. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.GET_NETWORK_INFO + +**System capability**: SystemCapability.Customization.EnterpriseDeviceManager + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ------------------------------- | +| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. | +| callback | AsyncCallback<Array<string>> | Yes | Callback invoked to return the active network interfaces obtained. | + +**Error codes** + +For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md). + +| ID| Error Message | +| ------- | ---------------------------------------------------------------------------- | +| 9200001 | The application is not an administrator application of the device. | +| 9200002 | The administrator application does not have permission to manage the device.| + +**Example** + +```js +let wantTemp = { + bundleName: "com.example.myapplication", + abilityName: "EntryAbility", +}; +networkManager.getAllNetworkInterfaces(admin, (error, result) => { + if (error != null) { + console.log("error code:" + error.code + " error message:" + error.message); + return; + } + console.log(JSON.stringify(result)); +}); +``` + +## networkManager.getAllNetworkInterfaces + +getAllNetworkInterfaces(admin: Want): Promise<Array<string>> + +Obtains all active network interfaces. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.ENTERPRISE_GET_NETWORK_INFO + +**System capability**: SystemCapability.Customization.EnterpriseDeviceManager + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----- | ----------------------------------- | ---- | ------- | +| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.| + +**Return value** + +| Type | Description | +| --------------------- | ------------------------- | +| Promise<Array<string>> | Promise used to return the active network interfaces obtained. | + +**Error codes** + +For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md). + +| ID| Error Message | +| ------- | ---------------------------------------------------------------------------- | +| 9200001 | The application is not an administrator application of the device. | +| 9200002 | The administrator application does not have permission to manage the device.| + +**Example** + +```js +let wantTemp = { + bundleName: "com.example.myapplication", + abilityName: "EntryAbility", +}; +networkManager.getAllNetworkInterfaces(wantTemp).then((result) => { + console.log(JSON.stringify(result)); +}).catch(error => { + console.log("error code:" + error.code + " error message:" + error.message); +}); +``` + +## networkManager.getIpAddress + +getIpAddress(admin: Want, networkInterface: string, callback: AsyncCallback<string>): void + +Obtains the IP address of a device. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.GET_NETWORK_INFO + +**System capability**: SystemCapability.Customization.EnterpriseDeviceManager + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ------------------------------- | +| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. | +| networkInterface | string | Yes | Network interface. | +| callback | AsyncCallback<string> | Yes | Callback invoked to return the device IP address obtained. | + +**Error codes** + +For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md). + +| ID| Error Message | +| ------- | ---------------------------------------------------------------------------- | +| 9200001 | The application is not an administrator application of the device. | +| 9200002 | The administrator application does not have permission to manage the device.| + +**Example** + +```js +let wantTemp = { + bundleName: "com.example.myapplication", + abilityName: "EntryAbility", +}; +networkManager.getIpAddress(wantTemp, "eth0", (error, result) => { + if (error != null) { + console.log("error code:" + error.code + " error message:" + error.message); + return; + } + console.log(result); +}); +``` + +## networkManager.getIpAddress + +getIpAddress(admin: Want, networkInterface: string): Promise<string> + +Obtains the IP address of a device. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.ENTERPRISE_GET_NETWORK_INFO + +**System capability**: SystemCapability.Customization.EnterpriseDeviceManager + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----- | ----------------------------------- | ---- | ------- | +| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.| +| networkInterface | string | Yes | Network interface. | + +**Return value** + +| Type | Description | +| --------------------- | ------------------------- | +| Promise<string> | Promise used to return the device IP address obtained. | + +**Error codes** + +For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md). + +| ID| Error Message | +| ------- | ---------------------------------------------------------------------------- | +| 9200001 | The application is not an administrator application of the device. | +| 9200002 | The administrator application does not have permission to manage the device.| + +**Example** + +```js +let wantTemp = { + bundleName: "com.example.myapplication", + abilityName: "EntryAbility", +}; +networkManager.getIpAddress(wantTemp, "eth0").then((result) => { + console.log(result); +}).catch(error => { + console.log("error code:" + error.code + " error message:" + error.message); +}); +``` + +## networkManager.getMac + +getMac(admin: Want, networkInterface: string, callback: AsyncCallback<string>): void + +Obtains the MAC address of a device. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.ENTERPRISE_GET_NETWORK_INFO + +**System capability**: SystemCapability.Customization.EnterpriseDeviceManager + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ------------------------------- | +| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. | +| networkInterface | string | Yes | Network interface. | +| callback | AsyncCallback<string> | Yes | Callback invoked to return the device MAC address obtained. | + +**Error codes** + +For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md). + +| ID| Error Message | +| ------- | ---------------------------------------------------------------------------- | +| 9200001 | The application is not an administrator application of the device. | +| 9200002 | The administrator application does not have permission to manage the device.| + +**Example** + +```js +let wantTemp = { + bundleName: "com.example.myapplication", + abilityName: "EntryAbility", +}; +networkManager.getMac(wantTemp, "eth0", (error, result) => { + if (error != null) { + console.log("error code:" + error.code + " error message:" + error.message); + return; + } + console.log(result); +}); +``` + +## networkManager.getMac + +getIpAddress(admin: Want, networkInterface: string): Promise<string> + +Obtains the MAC address of a device. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.ENTERPRISE_GET_NETWORK_INFO + +**System capability**: SystemCapability.Customization.EnterpriseDeviceManager + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----- | ----------------------------------- | ---- | ------- | +| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.| +| networkInterface | string | Yes | Network interface. | + +**Return value** + +| Type | Description | +| --------------------- | ------------------------- | +| Promise<string> | Promise used to return the device MAC address obtained. | + +**Error codes** + +For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md). + +| ID| Error Message | +| ------- | ---------------------------------------------------------------------------- | +| 9200001 | The application is not an administrator application of the device. | +| 9200002 | The administrator application does not have permission to manage the device.| + +**Example** + +```js +let wantTemp = { + bundleName: "com.example.myapplication", + abilityName: "EntryAbility", +}; +networkManager.getMac(wantTemp, "eth0").then((result) => { + console.log(result); +}).catch(error => { + console.log("error code:" + error.code + " error message:" + error.message); +}); +``` diff --git a/en/application-dev/reference/apis/js-apis-enterprise-wifiManager.md b/en/application-dev/reference/apis/js-apis-enterprise-wifiManager.md new file mode 100644 index 0000000000000000000000000000000000000000..4e19154377bb2b91e8f47af1b92a126f5c429cbd --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-enterprise-wifiManager.md @@ -0,0 +1,104 @@ +# @ohos.enterprise.wifiManager (Wi-Fi Management) + +The **wifiManager** module provides Wi-Fi management capabilities for enterprise devices. Only the enterprise device administrator applications can call the APIs provided by this module. + +> **NOTE** +> +> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version. + +## Modules to Import + +```js +import wifiManager from '@ohos.enterprise.wifiManager'; +``` + +## wifiManager.isWifiActive + +isWifiActive(admin: Want, callback: AsyncCallback<boolean>): void + +Checks whether Wi-Fi is enabled. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.ENTERPRISE_SET_WIFI + +**System capability**: SystemCapability.Customization.EnterpriseDeviceManager + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ------------------------------- | +| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application. | +| callback | AsyncCallback<boolean> | Yes | Callback invoked to return whether Wi-Fi is enabled. | + +**Error codes** + +For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md). + +| ID| Error Message | +| ------- | ---------------------------------------------------------------------------- | +| 9200001 | The application is not an administrator application of the device. | +| 9200002 | The administrator application does not have permission to manage the device. | + +**Example** + +```js +let wantTemp = { + bundleName: "com.example.myapplication", + abilityName: "EntryAbility", +}; +wifiManager.isWifiActive(wantTemp, (error, result) => { + if (error != null) { + console.log("error code:" + error.code + " error message:" + error.message); + return; + } + console.log(result); +}); +``` + +## wifiManager.isWifiActive + +isWifiActive(admin: Want): Promise<boolean> + +Checks whether Wi-Fi is active. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.ENTERPRISE_SET_WIFI + +**System capability**: SystemCapability.Customization.EnterpriseDeviceManager + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----- | ----------------------------------- | ---- | ------- | +| admin | [Want](js-apis-app-ability-want.md) | Yes | Device administrator application.| + +**Return value** + +| Type | Description | +| --------------------- | ------------------------- | +| Promise<boolean> | Promise used to return whether Wi-Fi is active. | + +**Error codes** + +For details about the error codes, see [Enterprise Device Management Error Codes](../errorcodes/errorcode-enterpriseDeviceManager.md). + +| ID| Error Message | +| ------- | ---------------------------------------------------------------------------- | +| 9200001 | The application is not an administrator application of the device. | +| 9200002 | The administrator application does not have permission to manage the device. | + +**Example** + +```js +let wantTemp = { + bundleName: "com.example.myapplication", + abilityName: "EntryAbility", +}; +wifiManager.isWifiActive(wantTemp).then((result) => { + console.log(result); +}).catch(error => { + console.log("error code:" + error.code + " error message:" + error.message); +}); +``` diff --git a/en/application-dev/reference/apis/js-apis-faultLogger.md b/en/application-dev/reference/apis/js-apis-faultLogger.md index dba3fb3f36ce7a0043738ff1c7bce26f22ae4973..98ddcfd6e20d64d4ef664fec43637b29e207bca5 100644 --- a/en/application-dev/reference/apis/js-apis-faultLogger.md +++ b/en/application-dev/reference/apis/js-apis-faultLogger.md @@ -40,11 +40,9 @@ Defines the data structure of the fault log information. | summary | string | Yes| Summary of the fault.| | fullLog | string | Yes| Full log text.| -## faultLogger.querySelfFaultLog(deprecated) - -querySelfFaultLog(faultType: FaultType, callback: AsyncCallback<Array<FaultLogInfo>>) : void +## faultLogger.query9+ -> **NOTE**
This API is deprecated since API version 9. You are advised to use [faultLogger.query](#faultloggerquery9) instead. +query(faultType: FaultType, callback: AsyncCallback<Array<FaultLogInfo>>) : void Obtains the fault information about the current process. This API uses an asynchronous callback to return the fault information array obtained, which contains a maximum of 10 pieces of fault information. @@ -57,6 +55,14 @@ Obtains the fault information about the current process. This API uses an asynch | faultType | [FaultType](#faulttype) | Yes| Fault type.| | callback | AsyncCallback<Array<[FaultLogInfo](#faultloginfo)>> | Yes| Callback used to return the fault information array.
The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval. In this case, an error string will be returned. +**Error codes** + +For details about the error codes, see [FaultLogger Error Codes](../errorcodes/errorcode-faultlogger.md). + +| ID| Error Message| +| --- | --- | +| 10600001 | The service is not started or is faulty | + **Example** ```js @@ -79,14 +85,16 @@ function queryFaultLogCallback(error, value) { } } } -faultLogger.querySelfFaultLog(faultLogger.FaultType.JS_CRASH, queryFaultLogCallback); +try { + faultLogger.query(faultLogger.FaultType.JS_CRASH, queryFaultLogCallback); +} catch (err) { + console.error(`code: ${err.code}, message: ${err.message}`); +} ``` -## faultLogger.querySelfFaultLog(deprecated) - -querySelfFaultLog(faultType: FaultType) : Promise<Array<FaultLogInfo>> +## faultLogger.query9+ -> **NOTE**
This API is deprecated since API version 9. You are advised to use [faultLogger.query](#faultloggerquery9-1) instead. +query(faultType: FaultType) : Promise<Array<FaultLogInfo>> Obtains the fault information about the current process. This API uses a promise to return the fault information array obtained, which contains a maximum of 10 pieces of fault information. @@ -104,32 +112,48 @@ Obtains the fault information about the current process. This API uses a promise | -------- | -------- | | Promise<Array<[FaultLogInfo](#faultloginfo)>> | Promise used to return the fault information array. You can obtain the fault information instance in its **then()** method or use **await**.
The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval.| +**Error codes** + +For details about the error codes, see [FaultLogger Error Codes](../errorcodes/errorcode-faultlogger.md). + +| ID| Error Message| +| --- | --- | +| 10600001 | The service is not started or is faulty | + **Example** ```js async function getLog() { - let value = await faultLogger.querySelfFaultLog(faultLogger.FaultType.JS_CRASH); - if (value) { - console.info("value length is " + value.length); - let len = value.length; - for (let i = 0; i < len; i++) { - console.info("log: " + i); - console.info("Log pid: " + value[i].pid); - console.info("Log uid: " + value[i].uid); - console.info("Log type: " + value[i].type); - console.info("Log timestamp: " + value[i].timestamp); - console.info("Log reason: " + value[i].reason); - console.info("Log module: " + value[i].module); - console.info("Log summary: " + value[i].summary); - console.info("Log text: " + value[i].fullLog); + try { + let value = await faultLogger.query(faultLogger.FaultType.JS_CRASH); + if (value) { + console.info("value length is " + value.length); + let len = value.length; + for (let i = 0; i < len; i++) { + console.info("log: " + i); + console.info("Log pid: " + value[i].pid); + console.info("Log uid: " + value[i].uid); + console.info("Log type: " + value[i].type); + console.info("Log timestamp: " + value[i].timestamp); + console.info("Log reason: " + value[i].reason); + console.info("Log module: " + value[i].module); + console.info("Log summary: " + value[i].summary); + console.info("Log text: " + value[i].fullLog); + } } + } catch (err) { + console.error(`code: ${err.code}, message: ${err.message}`); } } ``` -## faultLogger.query9+ +## faultLogger.querySelfFaultLog(deprecated) -query(faultType: FaultType, callback: AsyncCallback<Array<FaultLogInfo>>) : void +querySelfFaultLog(faultType: FaultType, callback: AsyncCallback<Array<FaultLogInfo>>) : void + +> **NOTE** +> +> This API is deprecated since API version 9. You are advised to use [faultLogger.query](#faultloggerquery9) instead. Obtains the fault information about the current process. This API uses an asynchronous callback to return the fault information array obtained, which contains a maximum of 10 pieces of fault information. @@ -142,14 +166,6 @@ Obtains the fault information about the current process. This API uses an asynch | faultType | [FaultType](#faulttype) | Yes| Fault type.| | callback | AsyncCallback<Array<[FaultLogInfo](#faultloginfo)>> | Yes| Callback used to return the fault information array.
The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval. In this case, an error string will be returned. -**Error codes** - -For details about the error codes, see [FaultLogger Error Codes](../errorcodes/errorcode-faultlogger.md). - -| ID| Error Message| -| --- | --- | -| 10600001 | The service is not running or broken | - **Example** ```js @@ -172,16 +188,16 @@ function queryFaultLogCallback(error, value) { } } } -try { - faultLogger.query(faultLogger.FaultType.JS_CRASH, queryFaultLogCallback); -} catch (err) { - console.error(`code: ${err.code}, message: ${err.message}`); -} +faultLogger.querySelfFaultLog(faultLogger.FaultType.JS_CRASH, queryFaultLogCallback); ``` -## faultLogger.query9+ +## faultLogger.querySelfFaultLog(deprecated) -query(faultType: FaultType) : Promise<Array<FaultLogInfo>> +querySelfFaultLog(faultType: FaultType) : Promise<Array<FaultLogInfo>> + +> **NOTE** +> +> This API is deprecated since API version 9. You are advised to use [faultLogger.query](#faultloggerquery9-1) instead. Obtains the fault information about the current process. This API uses a promise to return the fault information array obtained, which contains a maximum of 10 pieces of fault information. @@ -199,37 +215,25 @@ Obtains the fault information about the current process. This API uses a promise | -------- | -------- | | Promise<Array<[FaultLogInfo](#faultloginfo)>> | Promise used to return the fault information array. You can obtain the fault information instance in its **then()** method or use **await**.
The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval.| -**Error codes** - -For details about the error codes, see [FaultLogger Error Codes](../errorcodes/errorcode-faultlogger.md). - -| ID| Error Message| -| --- | --- | -| 10600001 | The service is not running or broken | - **Example** ```js async function getLog() { - try { - let value = await faultLogger.query(faultLogger.FaultType.JS_CRASH); - if (value) { - console.info("value length is " + value.length); - let len = value.length; - for (let i = 0; i < len; i++) { - console.info("log: " + i); - console.info("Log pid: " + value[i].pid); - console.info("Log uid: " + value[i].uid); - console.info("Log type: " + value[i].type); - console.info("Log timestamp: " + value[i].timestamp); - console.info("Log reason: " + value[i].reason); - console.info("Log module: " + value[i].module); - console.info("Log summary: " + value[i].summary); - console.info("Log text: " + value[i].fullLog); - } + let value = await faultLogger.querySelfFaultLog(faultLogger.FaultType.JS_CRASH); + if (value) { + console.info("value length is " + value.length); + let len = value.length; + for (let i = 0; i < len; i++) { + console.info("log: " + i); + console.info("Log pid: " + value[i].pid); + console.info("Log uid: " + value[i].uid); + console.info("Log type: " + value[i].type); + console.info("Log timestamp: " + value[i].timestamp); + console.info("Log reason: " + value[i].reason); + console.info("Log module: " + value[i].module); + console.info("Log summary: " + value[i].summary); + console.info("Log text: " + value[i].fullLog); } - } catch (err) { - console.error(`code: ${err.code}, message: ${err.message}`); } } ``` diff --git a/en/application-dev/reference/apis/js-apis-file-cloudsyncmanager.md b/en/application-dev/reference/apis/js-apis-file-cloudsyncmanager.md new file mode 100644 index 0000000000000000000000000000000000000000..3fa93ccd105819ea71a709d861a71287ae1312cc --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-file-cloudsyncmanager.md @@ -0,0 +1,142 @@ +# @ohos.file.cloudSyncManager (Device-Cloud Synchronization Management) + +The **cloudSyncManager** module provides APIs for changing the cloud and device service status and notifying the data changes. + +> **NOTE** +> +> - The initial APIs of this module are supported since API version 10. 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 APIs of this module support processing of error codes. For details, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md). + +## Modules to Import + +```js +import cloudSyncManager from '@ohos.file.cloudSyncManager'; +``` + +## cloudSyncManager.changeAppCloudSwitch + +changeAppCloudSwitch(accountId: string, bundleName: string, status: boolean): Promise<void>; + +Changes the device-cloud file synchronization switch for an application. This API uses a promise to return the result. + +**System capability**: SystemCapability.FileManagement.DistributedFileService.CloudSyncManager + +**Parameters** + +| Name | Type | Mandatory| Description| +| ---------- | ------ | ---- | ---- | +| accountId | string | Yes | Account ID.| +| bundleName | string | Yes | Bundle name of the application.| +| status | boolean | Yes | State of the cloud-device file synchronization switch to set. The value **true** means to enable this function; the value **false** means the opposite.| + +**Return value** + +| Type | Description | +| --------------------- | ---------------- | +| Promise<void> | Promise used to return the result.| + +**Example** + + ```js + let accountId = "testAccount"; + let bundleName = "com.example.bundle"; + cloudSyncManager.changeAppCloudSwitch(accountId, bundleName, true).then(function() { + console.info("changeAppCloudSwitch successfully"); + }).catch(function(err) { + console.info("changeAppCloudSwitch failed with error message: " + err.message + ", error code: " + err.code); + }); + ``` + +## cloudSyncManager.changeAppCloudSwitch + +changeAppCloudSwitch(accountId: string, bundleName: string, status: boolean, callback: AsyncCallback<void>): void; + +Changes the device-cloud file synchronization switch for an application. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.FileManagement.DistributedFileService.CloudSyncManager + +**Parameters** + +| Name | Type | Mandatory| Description| +| ---------- | ------ | ---- | ---- | +| accountId | string | Yes | Account ID.| +| bundleName | string | Yes | Bundle name of the application.| +| status | boolean | Yes | State of the cloud-device file synchronization switch to set. The value **true** means to enable this function; the value **false** means the opposite.| +| callback | AsyncCallback<void> | Yes | Callback invoked to return the result.| + +**Example** + + ```js + let accountId = "testAccount"; + let bundleName = "com.example.bundle"; + cloudSyncManager.changeAppCloudSwitch(accountId, bundleName, true, (err) => { + if (err) { + console.info("changeAppCloudSwitch failed with error message: " + err.message + ", error code: " + err.code); + } else { + console.info("changeAppCloudSwitch successfully"); + } + }); + ``` +## cloudSyncManager.notifyDataChange + +notifyDataChange(accountId: string, bundleName: string): Promise<void>; + +Notifies the cloud and device services of the application data change in the cloud. This API uses a promise to return the result. + +**System capability**: SystemCapability.FileManagement.DistributedFileService.CloudSyncManager + +**Parameters** + +| Name | Type | Mandatory| Description| +| ---------- | ------ | ---- | ---- | +| accountId | string | Yes | Account ID.| +| bundleName | string | Yes | Bundle name of the application.| + +**Return value** + +| Type | Description | +| --------------------- | ---------------- | +| Promise<void> | Promise used to return the application data change in the cloud.| + +**Example** + + ```js + let accountId = "testAccount"; + let bundleName = "com.example.bundle"; + cloudSyncManager.notifyDataChange(accountId, bundleName).then(function() { + console.info("notifyDataChange successfully"); + }).catch(function(err) { + console.info("notifyDataChange failed with error message: " + err.message + ", error code: " + err.code); + }); + ``` + +## cloudSyncManager.notifyDataChange + +notifyDataChange(accountId: string, bundleName: string, callback: AsyncCallback<void>): void; + +Notifies the cloud and device services of the application data change in the cloud. This API uses a promise to return the result. + +**System capability**: SystemCapability.FileManagement.DistributedFileService.CloudSyncManager + +**Parameters** + +| Name | Type | Mandatory| Description| +| ---------- | ------ | ---- | ---- | +| accountId | string | Yes | Account ID.| +| bundleName | string | Yes | Bundle name of the application.| +| callback | AsyncCallback<void> | Yes | Callback invoked to return the application data change in the cloud.| + +**Example** + + ```js + let accountId = "testAccount"; + let bundleName = "com.example.bundle"; + cloudSyncManager.notifyDataChange(accountId, bundleName, (err) => { + if (err) { + console.info("notifyDataChange failed with error message: " + err.message + ", error code: " + err.code); + } else { + console.info("notifyDataChange successfully"); + } + }); + ``` diff --git a/en/application-dev/reference/apis/js-apis-file-environment.md b/en/application-dev/reference/apis/js-apis-file-environment.md index 9c340eef3974ed2875f417c71cb8a5f7dd4b10d8..c87c8465d7909f495baf6babad02e8e5b118424c 100644 --- a/en/application-dev/reference/apis/js-apis-file-environment.md +++ b/en/application-dev/reference/apis/js-apis-file-environment.md @@ -4,7 +4,7 @@ The **Environment** module provides APIs for obtaining the root directories of t > **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 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. > - The APIs of this module support processing of error codes. For details, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md). @@ -26,7 +26,7 @@ Obtains the root directory of the storage. This API uses a promise to return the | Type | Description | | --------------------- | ---------------- | -| Promise<string> | Promise returned with the root directory of the storage.| +| Promise<string> | Promise used to return the root directory of the storage.| **Example** @@ -50,7 +50,7 @@ Obtains the root directory of the storage. This API uses an asynchronous callbac | Name | Type | Mandatory| Description | | -------- | --------------------------- | ---- | -------------------------------- | -| callback | AsyncCallback<string> | Yes | Asynchronous callback used to return the root directory of the storage.| +| callback | AsyncCallback<string> | Yes | Asynchronous callback invoked to return the root directory of the storage.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-file-fileUri.md b/en/application-dev/reference/apis/js-apis-file-fileUri.md new file mode 100644 index 0000000000000000000000000000000000000000..f8c6717fab58f9ca5eacac6ebc3963a6faae63fa --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-file-fileUri.md @@ -0,0 +1,61 @@ +# @ohos.file.fileuri (File URI) + +The **fileUri** module allows the uniform resource identifier (URI) of a file to be obtained based on the file path. With the file URI, you can use the APIs provided by [@ohos.file.fs](js-apis-file-fs.md) to operate the file. + +> **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 + +```js +import fileuri from "@ohos.file.fileuri"; +``` + +Before using this module, you need to obtain the path of the file in the application sandbox. The following is an example: + + ```js +import UIAbility from '@ohos.app.ability.UIAbility'; + +export default class EntryAbility extends UIAbility { + onWindowStageCreate(windowStage) { + let context = this.context; + let pathDir = context.filesDir; + } +} + ``` + +## fileUri.getUriFromPath + +getUriFromPath(path: string): string + +Obtains the URI of a file in synchronous mode. + +**System capability**: SystemCapability.FileManagement.AppFileService + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | -------------------------- | +| path | string | Yes | Path of the file in the application sandbox.| + +**Return value** + +| Type | Description | +| ---------------------------- | ---------- | +| string | File URI obtained.| + +**Error codes** + +For details about the error codes, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md). +| ID | Error Message | +| ---------------------------- | ---------- | +| 401 | The input parameter is invalid | + + +**Example** + + ```js +let filePath = pathDir + "test.txt"; +let uri = fileuri.getUriFromPath(filePath); + ``` diff --git a/en/application-dev/reference/apis/js-apis-file-fs.md b/en/application-dev/reference/apis/js-apis-file-fs.md index 19ab5a4812762f0c812a843ad0db452801497dbe..d210887e3e92e5baea3dd6c7c45ad709e7244587 100644 --- a/en/application-dev/reference/apis/js-apis-file-fs.md +++ b/en/application-dev/reference/apis/js-apis-file-fs.md @@ -1,12 +1,9 @@ # @ohos.file.fs (File Management) -The **fs** module provides APIs for file operations, including basic file management, directory management, file information statistics, and stream read and write. +The **fs** module provides APIs for file operations, including basic file management, directory management, file information statistics, and data read and write using a stream. -> **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 support processing of error codes. For details, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md). +> **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 @@ -14,9 +11,13 @@ The **fs** module provides APIs for file operations, including basic file manage import fs from '@ohos.file.fs'; ``` +## Error Code Description + +The APIs of this module supports processing of error codes. For details about the error codes, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md). + ## Guidelines -Before using the APIs provided by this module to perform operations on files or directories, obtain the path of the file or directory in the application sandbox as follows: +Before using the APIs provided by this module to perform operations on a file or folder, obtain the application sandbox path of the file or folder as follows: **Stage Model** @@ -56,18 +57,18 @@ Obtains detailed file information. This API uses a promise to return the result. | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------- | -| file | string\|number | Yes | Path of the file in the application sandbox or file descriptor (FD) of the file.| +| file | string\|number | Yes | Application sandbox path or file descriptor (FD) of the file.| **Return value** -| Type | Description | -| ---------------------------- | ---------- | -| Promise<[Stat](#stat)> | Promise used to return the file information obtained.| + | Type | Description | + | ---------------------------- | ---------- | + | Promise<[Stat](#stat)> | Promise used to return the file information obtained.| **Example** ```js - let filePath = pathDir + "test.txt"; + let filePath = pathDir + "/test.txt"; fs.stat(filePath).then((stat) => { console.info("get file info succeed, the size of file is " + stat.size); }).catch((err) => { @@ -87,7 +88,7 @@ Obtains detailed file information. This API uses an asynchronous callback to ret | Name | Type | Mandatory| Description | | -------- | ---------------------------------- | ---- | ------------------------------ | -| file | string\|number | Yes | Path of the file in the application sandbox or file descriptor (FD) of the file. | +| file | string\|number | Yes | Application sandbox path or FD of the file. | | callback | AsyncCallback<[Stat](#stat)> | Yes | Callback invoked to return the file information obtained.| **Example** @@ -114,14 +115,14 @@ Obtains detailed file information synchronously. | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------- | -| file | string\|number | Yes | Path of the file in the application sandbox or file descriptor (FD) of the file.| +| file | string\|number | Yes | Application sandbox path or FD of the file.| **Return value** -| Type | Description | -| ------------- | ---------- | -| [Stat](#stat) | File information obtained.| + | Type | Description | + | ------------- | ---------- | + | [Stat](#stat) | File information obtained.| **Example** @@ -142,13 +143,13 @@ Checks whether a file exists. This API uses a promise to return the result. | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | -| path | string | Yes | Path of the file in the application sandbox. | +| path | string | Yes | Application sandbox path of the file. | **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<boolean> | Promise used to return a Boolean value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<boolean> | Promise used to return the result. The value **true** means the file exists; the value **false** means the opposite.| **Example** @@ -176,7 +177,7 @@ Checks whether a file exists. This API uses an asynchronous callback to return t | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ------------------------------------------------------------ | -| path | string | Yes | Path of the file in the application sandbox. | +| path | string | Yes | Application sandbox path of the file. | | callback | AsyncCallback<boolean> | Yes | Callback invoked to return the result. | **Example** @@ -206,7 +207,13 @@ Synchronously checks whether a file exists. | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | -| path | string | Yes | Path of the file in the application sandbox. | +| path | string | Yes | Application sandbox path of the file. | + +**Return value** + + | Type | Description | + | ------------------- | ---------------------------- | + | boolean | Returns **true** if the file exists; returns **false** otherwise.| **Example** @@ -233,15 +240,15 @@ Closes a file. This API uses a promise to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ------------ | -| file | [File](#file)\|number | Yes | File object or FD of the file to close.| + | Name | Type | Mandatory | Description | + | ---- | ------ | ---- | ------------ | + | file | [File](#file)\|number | Yes | File object or FD of the file to close.| **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** @@ -266,10 +273,10 @@ Closes a file. This API uses an asynchronous callback to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ------------------------- | ---- | ------------ | -| file | [File](#file)\|number | Yes | File object or FD of the file to close.| -| callback | AsyncCallback<void> | Yes | Callback invoked when the file is closed asynchronously.| + | Name | Type | Mandatory | Description | + | -------- | ------------------------- | ---- | ------------ | + | file | [File](#file)\|number | Yes | File object or FD of the file to close.| + | callback | AsyncCallback<void> | Yes | Callback invoked when the file is closed asynchronously.| **Example** @@ -295,9 +302,9 @@ Synchronously closes a file. **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ------------ | -| file | [File](#file)\|number | Yes | File object or FD of the file to close.| + | Name | Type | Mandatory | Description | + | ---- | ------ | ---- | ------------ | + | file | [File](#file)\|number | Yes | File object or FD of the file to close.| **Example** @@ -317,23 +324,23 @@ Copies a file. This API uses a promise to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| ---- | -------------------------- | ---- | ---------------------------------------- | -| src | string\|number | Yes | Path or FD of the file to copy. | -| dest | string\|number | Yes | Destination path of the file or FD of the file created. | -| mode | number | No | Whether to overwrite the file of the same name in the destination path. The default value is **0**, which is the only value supported.
**0**: overwrite the file of the same name.| + | Name | Type | Mandatory | Description | + | ---- | -------------------------- | ---- | ---------------------------------------- | + | src | string\|number | Yes | Path or FD of the file to copy. | + | dest | string\|number | Yes | Destination path of the file or FD of the file created. | + | mode | number | No | Whether to overwrite the file of the same name in the destination path. The default value is **0**, which is the only value supported.
**0**: overwrite the file of the same name.| **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** ```js - let srcPath = pathDir + "srcDir/test.txt"; - let dstPath = pathDir + "dstDir/test.txt"; + let srcPath = pathDir + "/srcDir/test.txt"; + let dstPath = pathDir + "/dstDir/test.txt"; fs.copyFile(srcPath, dstPath).then(() => { console.info("copy file succeed"); }).catch((err) => { @@ -351,18 +358,18 @@ Copies a file. This API uses an asynchronous callback to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------------------------- | ---- | ---------------------------------------- | -| src | string\|number | Yes | Path or FD of the file to copy. | -| dest | string\|number | Yes | Destination path of the file or FD of the file created. | -| mode | number | No | Whether to overwrite the file of the same name in the destination path. The default value is **0**, which is the only value supported.
**0**: overwrite the file with the same name and truncate the part that is not overwritten.| -| callback | AsyncCallback<void> | Yes | Callback invoked when the file is copied asynchronously. | + | Name | Type | Mandatory | Description | + | -------- | -------------------------- | ---- | ---------------------------------------- | + | src | string\|number | Yes | Path or FD of the file to copy. | + | dest | string\|number | Yes | Destination path of the file or FD of the file created. | + | mode | number | No | Whether to overwrite the file of the same name in the destination path. The default value is **0**, which is the only value supported.
**0**: overwrite the file with the same name and truncate the part that is not overwritten.| + | callback | AsyncCallback<void> | Yes | Callback invoked when the file is copied asynchronously. | **Example** ```js - let srcPath = pathDir + "srcDir/test.txt"; - let dstPath = pathDir + "dstDir/test.txt"; + let srcPath = pathDir + "/srcDir/test.txt"; + let dstPath = pathDir + "/dstDir/test.txt"; fs.copyFile(srcPath, dstPath, (err) => { if (err) { console.info("copy file failed with error message: " + err.message + ", error code: " + err.code); @@ -383,17 +390,17 @@ Synchronously copies a file. **Parameters** -| Name | Type | Mandatory | Description | -| ---- | -------------------------- | ---- | ---------------------------------------- | -| src | string\|number | Yes | Path or FD of the file to copy. | -| dest | string\|number | Yes | Destination path of the file or FD of the file created. | -| mode | number | No | Whether to overwrite the file of the same name in the destination path. The default value is **0**, which is the only value supported.
**0**: overwrite the file with the same name and truncate the part that is not overwritten.| + | Name | Type | Mandatory | Description | + | ---- | -------------------------- | ---- | ---------------------------------------- | + | src | string\|number | Yes | Path or FD of the file to copy. | + | dest | string\|number | Yes | Destination path of the file or FD of the file created. | + | mode | number | No | Whether to overwrite the file of the same name in the destination path. The default value is **0**, which is the only value supported.
**0**: overwrite the file with the same name and truncate the part that is not overwritten.| **Example** ```js - let srcPath = pathDir + "srcDir/test.txt"; - let dstPath = pathDir + "dstDir/test.txt"; + let srcPath = pathDir + "/srcDir/test.txt"; + let dstPath = pathDir + "/dstDir/test.txt"; fs.copyFileSync(srcPath, dstPath); ``` @@ -410,18 +417,18 @@ Creates a directory. This API uses a promise to return the result. | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | -| path | string | Yes | Path of the directory in the application sandbox. | +| path | string | Yes | Application sandbox path of the directory. | **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** ```js - let dirPath = pathDir + '/testDir'; + let dirPath = pathDir + "/testDir"; fs.mkdir(dirPath).then(() => { console.info("Directory created"); }).catch((err) => { @@ -442,13 +449,13 @@ Creates a directory. This API uses an asynchronous callback to return the result | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ------------------------------------------------------------ | -| path | string | Yes | Path of the directory in the application sandbox. | +| path | string | Yes | Application sandbox path of the directory. | | callback | AsyncCallback<void> | Yes | Callback invoked when the directory is created asynchronously. | **Example** ```js - let dirPath = pathDir + '/testDir'; + let dirPath = pathDir + "/testDir"; fs.mkdir(dirPath, (err) => { if (err) { console.info("mkdir failed with error message: " + err.message + ", error code: " + err.code); @@ -471,12 +478,12 @@ Synchronously creates a directory. | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | -| path | string | Yes | Path of the directory in the application sandbox. | +| path | string | Yes | Application sandbox path of the directory. | **Example** ```js - let dirPath = path + '/testDir'; + let dirPath = pathDir + "/testDir"; fs.mkdirSync(dirPath); ``` @@ -493,14 +500,14 @@ Opens a file. This API uses a promise to return the result. File uniform resourc | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | -| path | string | Yes | Path of the file in the application sandbox or URI of the file. | +| path | string | Yes | Application sandbox path or URI of the file. | | mode | number | No | [Mode](#openmode) for opening the file. You must specify one of the following options. By default, the file is open in read-only mode.
- **OpenMode.READ_ONLY(0o0)**: Open the file in read-only mode.
- **OpenMode.WRITE_ONLY(0o1)**: Open the file in write-only mode.
- **OpenMode.READ_WRITE(0o2)**: Open the file in read/write mode.
You can also specify the following options, separated by a bitwise OR operator (|). By default, no additional options are given.
- **OpenMode.CREATE(0o100)**: If the file does not exist, create it.
- **OpenMode.TRUNC(0o1000)**: If the file exists and is open in write-only or read/write mode, truncate the file length to 0.
- **OpenMode.APPEND(0o2000)**: Open the file in append mode. New data will be added to the end of the file.
- **OpenMode.NONBLOCK(0o4000)**: If **path** points to a named pipe (also known as a FIFO), block special file, or character special file, perform non-blocking operations on the open file and in subsequent I/Os.
- **OpenMode.DIR(0o200000)**: If **path** does not point to a directory, throw an exception.
- **OpenMode.NOFOLLOW(0o400000)**: If **path** points to a symbolic link, throw an exception.
- **OpenMode.SYNC(0o4010000)**: Open the file in synchronous I/O mode.| **Return value** -| Type | Description | -| --------------------- | ----------- | -| Promise<[File](#file)> | Promise used to return the file object.| + | Type | Description | + | --------------------- | ----------- | + | Promise<[File](#file)> | Promise used to return the file object.| **Example** @@ -526,7 +533,7 @@ Opens a file. This API uses an asynchronous callback to return the result. File | Name | Type | Mandatory| Description | | -------- | ------------------------------- | ---- | ------------------------------------------------------------ | -| path | string | Yes | Path of the file in the application sandbox or URI of the file. | +| path | string | Yes | Application sandbox path or URI of the file. | | mode | number | No | [Mode](#openmode) for opening the file. You must specify one of the following options. By default, the file is open in read-only mode.
- **OpenMode.READ_ONLY(0o0)**: Open the file in read-only mode.
- **OpenMode.WRITE_ONLY(0o1)**: Open the file in write-only mode.
- **OpenMode.READ_WRITE(0o2)**: Open the file in read/write mode.
You can also specify the following options, separated by a bitwise OR operator (|). By default, no additional options are given.
- **OpenMode.CREATE(0o100)**: If the file does not exist, create it.
- **OpenMode.TRUNC(0o1000)**: If the file exists and is open in write-only or read/write mode, truncate the file length to 0.
- **OpenMode.APPEND(0o2000)**: Open the file in append mode. New data will be added to the end of the file.
- **OpenMode.NONBLOCK(0o4000)**: If **path** points to a named pipe (also known as a FIFO), block special file, or character special file, perform non-blocking operations on the open file and in subsequent I/Os.
- **OpenMode.DIR(0o200000)**: If **path** does not point to a directory, throw an exception.
- **OpenMode.NOFOLLOW(0o400000)**: If **path** points to a symbolic link, throw an exception.
- **OpenMode.SYNC(0o4010000)**: Open the file in synchronous I/O mode.| **Example** @@ -554,14 +561,14 @@ Synchronously opens a file. File URIs are supported. | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | -| path | string | Yes | Path of the file in the application sandbox or URI of the file. | +| path | string | Yes | Application sandbox path or URI of the file. | | mode | number | No | [Mode](#openmode) for opening the file. You must specify one of the following options. By default, the file is open in read-only mode.
- **OpenMode.READ_ONLY(0o0)**: Open the file in read-only mode.
- **OpenMode.WRITE_ONLY(0o1)**: Open the file in write-only mode.
- **OpenMode.READ_WRITE(0o2)**: Open the file in read/write mode.
You can also specify the following options, separated by a bitwise OR operator (|). By default, no additional options are given.
- **OpenMode.CREATE(0o100)**: If the file does not exist, create it.
- **OpenMode.TRUNC(0o1000)**: If the file exists and is open in write-only or read/write mode, truncate the file length to 0.
- **OpenMode.APPEND(0o2000)**: Open the file in append mode. New data will be added to the end of the file.
- **OpenMode.NONBLOCK(0o4000)**: If **path** points to a named pipe (also known as a FIFO), block special file, or character special file, perform non-blocking operations on the open file and in subsequent I/Os.
- **OpenMode.DIR(0o200000)**: If **path** does not point to a directory, throw an exception.
- **OpenMode.NOFOLLOW(0o400000)**: If **path** points to a symbolic link, throw an exception.
- **OpenMode.SYNC(0o4010000)**: Open the file in synchronous I/O mode.| **Return value** -| Type | Description | -| ------ | ----------- | -| [File](#file) | File object opened.| + | Type | Description | + | ------ | ----------- | + | [File](#file) | File object opened.| **Example** @@ -590,9 +597,9 @@ Reads data from a file. This API uses a promise to return the result. **Return value** -| Type | Description | -| ---------------------------------- | ------ | -| Promise<number> | Promise used to return the data read.| + | Type | Description | + | ---------------------------------- | ------ | + | Promise<number> | Promise used to return the data read.| **Example** @@ -602,7 +609,7 @@ Reads data from a file. This API uses a promise to return the result. let buf = new ArrayBuffer(4096); fs.read(file.fd, buf).then((readLen) => { console.info("Read file data successfully"); - console.info(String.fromCharCode.apply(null, new Uint8Array(readLen))); + console.info(String.fromCharCode.apply(null, new Uint8Array(buf.slice(0, readLen)))); fs.closeSync(file); }).catch((err) => { console.info("read file data failed with error message: " + err.message + ", error code: " + err.code); @@ -619,12 +626,12 @@ Reads data from a file. This API uses an asynchronous callback to return the res **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | ---------------------------------------- | -| fd | number | Yes | FD of the file. | -| buffer | ArrayBuffer | Yes | Buffer used to store the file data read. | -| options | Object | No | The options are as follows:
- **offset** (number): position of the data to read in the file. This parameter is optional. By default, data is read from the current position.
- **length** (number): length of the data to read. This parameter is optional. The default value is the buffer length.| -| callback | AsyncCallback<number> | Yes | Callback invoked when the data is read asynchronously. | + | Name | Type | Mandatory | Description | + | -------- | ---------------------------------------- | ---- | ---------------------------------------- | + | fd | number | Yes | FD of the file. | + | buffer | ArrayBuffer | Yes | Buffer used to store the file data read. | + | options | Object | No | The options are as follows:
- **offset** (number): position of the data to read in the file. This parameter is optional. By default, data is read from the current position.
- **length** (number): length of the data to read. This parameter is optional. The default value is the buffer length.| + | callback | AsyncCallback<number> | Yes | Callback invoked when the data is read asynchronously. | **Example** @@ -637,7 +644,7 @@ Reads data from a file. This API uses an asynchronous callback to return the res console.info("mkdir failed with error message: " + err.message + ", error code: " + err.code); } else { console.info("Read file data successfully"); - console.info(String.fromCharCode.apply(null, new Uint8Array(readLen))); + console.info(String.fromCharCode.apply(null, new Uint8Array(buf.slice(0, readLen)))); fs.closeSync(file); } }); @@ -654,17 +661,17 @@ Synchronously reads data from a file. **Parameters** -| Name | Type | Mandatory | Description | -| ------- | ----------- | ---- | ---------------------------------------- | -| fd | number | Yes | FD of the file. | -| buffer | ArrayBuffer | Yes | Buffer used to store the file data read. | -| options | Object | No | The options are as follows:
- **offset** (number): position of the data to read in the file. This parameter is optional. By default, data is read from the current position.
- **length** (number): length of the data to read. This parameter is optional. The default value is the buffer length.| + | Name | Type | Mandatory | Description | + | ------- | ----------- | ---- | ---------------------------------------- | + | fd | number | Yes | FD of the file. | + | buffer | ArrayBuffer | Yes | Buffer used to store the file data read. | + | options | Object | No | The options are as follows:
- **offset** (number): position of the data to read in the file. This parameter is optional. By default, data is read from the current position.
- **length** (number): length of the data to read. This parameter is optional. The default value is the buffer length.| **Return value** -| Type | Description | -| ------ | -------- | -| number | Length of the data read.| + | Type | Description | + | ------ | -------- | + | number | Length of the data read.| **Example** @@ -689,18 +696,18 @@ Deletes a directory. This API uses a promise to return the result. | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------- | -| path | string | Yes | Path of the directory in the application sandbox.| +| path | string | Yes | Application sandbox path of the directory.| **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** ```js - let dirPath = pathDir + '/testDir'; + let dirPath = pathDir + "/testDir"; fs.rmdir(dirPath).then(() => { console.info("Directory deleted"); }).catch((err) => { @@ -721,13 +728,13 @@ Deletes a directory. This API uses an asynchronous callback to return the result | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | -------------------------- | -| path | string | Yes | Path of the directory in the application sandbox.| +| path | string | Yes | Application sandbox path of the directory.| | callback | AsyncCallback<void> | Yes | Callback invoked when the directory is deleted asynchronously. | **Example** ```js - let dirPath = pathDir + '/testDir'; + let dirPath = pathDir + "/testDir"; fs.rmdir(dirPath, (err) => { if (err) { console.info("rmdir failed with error message: " + err.message + ", error code: " + err.code); @@ -750,12 +757,12 @@ Synchronously deletes a directory. | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------- | -| path | string | Yes | Path of the directory in the application sandbox.| +| path | string | Yes | Application sandbox path of the directory.| **Example** ```js - let dirPath = pathDir + '/testDir'; + let dirPath = pathDir + "/testDir"; fs.rmdirSync(dirPath); ``` @@ -772,13 +779,13 @@ Deletes a file. This API uses a promise to return the result. | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------- | -| path | string | Yes | Path of the file in the application sandbox.| +| path | string | Yes | Application sandbox path of the file.| **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** @@ -804,7 +811,7 @@ Deletes a file. This API uses an asynchronous callback to return the result. | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | -------------------------- | -| path | string | Yes | Path of the file in the application sandbox.| +| path | string | Yes | Application sandbox path of the file.| | callback | AsyncCallback<void> | Yes | Callback invoked when the file is deleted asynchronously. | **Example** @@ -833,7 +840,7 @@ Synchronously deletes a file. | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------- | -| path | string | Yes | Path of the file in the application sandbox.| +| path | string | Yes | Application sandbox path of the file.| **Example** @@ -853,17 +860,17 @@ Writes data into a file. This API uses a promise to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| ------- | ------------------------------- | ---- | ---------------------------------------- | -| fd | number | Yes | FD of the file. | -| 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): start position to write the data in the file. This parameter is optional. By default, data is written from the current position.
- **length** (number): length of the data to write. This parameter is optional. The default value is the buffer length.
- **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.| + | Name | Type | Mandatory | Description | + | ------- | ------------------------------- | ---- | ---------------------------------------- | + | fd | number | Yes | FD of the file. | + | 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): start position to write the data in the file. This parameter is optional. By default, data is written from the current position.
- **length** (number): length of the data to write. This parameter is optional. The default value is the buffer length.
- **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.| **Return value** -| Type | Description | -| --------------------- | -------- | -| Promise<number> | Promise used to return the length of the data written.| + | Type | Description | + | --------------------- | -------- | + | Promise<number> | Promise used to return the length of the data written.| **Example** @@ -889,12 +896,12 @@ Writes data into a file. This API uses an asynchronous callback to return the re **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ------------------------------- | ---- | ---------------------------------------- | -| fd | number | Yes | FD of the file. | -| 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): start position to write the data in the file. This parameter is optional. By default, data is written from the current position.
- **length** (number): length of the data to write. This parameter is optional. The default value is the buffer length.
- **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.| -| callback | AsyncCallback<number> | Yes | Callback invoked when the data is written asynchronously. | + | Name | Type | Mandatory | Description | + | -------- | ------------------------------- | ---- | ---------------------------------------- | + | fd | number | Yes | FD of the file. | + | 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): start position to write the data in the file. This parameter is optional. By default, data is written from the current position.
- **length** (number): length of the data to write. This parameter is optional. The default value is the buffer length.
- **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.| + | callback | AsyncCallback<number> | Yes | Callback invoked when the data is written asynchronously. | **Example** @@ -922,17 +929,17 @@ Synchronously writes data into a file. **Parameters** -| Name | Type | Mandatory | Description | -| ------- | ------------------------------- | ---- | ---------------------------------------- | -| fd | number | Yes | FD of the file. | -| 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): start position to write the data in the file. This parameter is optional. By default, data is written from the current position.
- **length** (number): length of the data to write. This parameter is optional. The default value is the buffer length.
- **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.| + | Name | Type | Mandatory | Description | + | ------- | ------------------------------- | ---- | ---------------------------------------- | + | fd | number | Yes | FD of the file. | + | 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): start position to write the data in the file. This parameter is optional. By default, data is written from the current position.
- **length** (number): length of the data to write. This parameter is optional. The default value is the buffer length.
- **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.| **Return value** -| Type | Description | -| ------ | -------- | -| number | Length of the data written in the file.| + | Type | Description | + | ------ | -------- | + | number | Length of the data written in the file.| **Example** @@ -956,14 +963,14 @@ Truncates a file. This API uses a promise to return the result. | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------------- | -| file | string\|number | Yes | Path of the file in the application sandbox or file descriptor (FD) of the file. | -| len | number | No | File length, in bytes, after truncation.| +| file | string\|number | Yes | Application sandbox path or FD of the file. | +| len | number | No | File length, in bytes, after truncation. The default value is **0**.| **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** @@ -990,8 +997,8 @@ Truncates a file. This API uses an asynchronous callback to return the result. | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | -------------------------------- | -| file | string\|number | Yes | Path of the file in the application sandbox or file descriptor (FD) of the file. | -| len | number | No | File length, in bytes, after truncation.| +| file | string\|number | Yes | Application sandbox path or FD of the file. | +| len | number | No | File length, in bytes, after truncation. The default value is **0**.| | callback | AsyncCallback<void> | Yes | Callback that returns no value. | **Example** @@ -1021,8 +1028,8 @@ Synchronously truncates a file. | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------------- | -| file | string\|number | Yes | Path of the file in the application sandbox or file descriptor (FD) of the file. | -| len | number | No | File length, in bytes, after truncation.| +| file | string\|number | Yes | Application sandbox path or FD of the file. | +| len | number | No | File length, in bytes, after truncation. The default value is **0**.| **Example** @@ -1045,14 +1052,14 @@ Reads the text content of a file. This API uses a promise to return the result. | Name | Type | Mandatory| Description | | -------- | ------ | ---- | ------------------------------------------------------------ | -| filePath | string | Yes | Path of the file in the application sandbox. | +| filePath | string | Yes | Application sandbox path of the file. | | options | Object | No | The options are as follows:
- **offset** (number): position of the data to read in the file. This parameter is optional. By default, data is read from the current position.
- **length** (number): length of the data to read. This parameter is optional. The default value is the file length.
- **encoding** (string): format of the 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.| + | Type | Description | + | --------------------- | ---------- | + | Promise<string> | Promise used to return the content read.| **Example** @@ -1078,7 +1085,7 @@ Reads the text content of a file. This API uses an asynchronous callback to retu | Name | Type | Mandatory| Description | | -------- | --------------------------- | ---- | ------------------------------------------------------------ | -| filePath | string | Yes | Path of the file in the application sandbox. | +| filePath | string | Yes | Application sandbox path of the file. | | options | Object | No | The options are as follows:
- **offset** (number): position of the data to read in the file. This parameter is optional. By default, data is read from the current position.
- **length** (number): length of the data to read. This parameter is optional. The default value is the file length.
- **encoding** (string): format of the string to be encoded. The default value is **'utf-8'**, which is the only value supported.| | callback | AsyncCallback<string> | Yes | Callback invoked to return the content read. | @@ -1108,14 +1115,14 @@ Synchronously reads the text of a file. | Name | Type | Mandatory| Description | | -------- | ------ | ---- | ------------------------------------------------------------ | -| filePath | string | Yes | Path of the file in the application sandbox. | +| filePath | string | Yes | Application sandbox path of the file. | | options | Object | No | The options are as follows:
- **offset** (number): position of the data to read in the file. This parameter is optional. By default, data is read from the current position.
- **length** (number): length of the data to read. This parameter is optional. The default value is the file length.
- **encoding** (string): format of the 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.| + | Type | Description | + | ------ | -------------------- | + | string | Promise used to return the content of the file read.| **Example** @@ -1137,13 +1144,13 @@ Obtains information about a symbolic link. This API uses a promise to return the | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------------------- | -| path | string | Yes | Path of the symbolic link in the application sandbox.| +| path | string | Yes | Application sandbox path of the file.| **Return value** -| Type | Description | -| ---------------------------- | ---------- | -| Promise<[Stat](#stat)> | Promise used to return the symbolic link information obtained. For details, see **stat**.| + | Type | Description | + | ---------------------------- | ---------- | + | Promise<[Stat](#stat)> | Promise used to return the symbolic link information obtained. For details, see **stat**.| **Example** @@ -1169,7 +1176,7 @@ Obtains information about a symbolic link. This API uses an asynchronous callbac | Name | Type | Mandatory| Description | | -------- | ---------------------------------- | ---- | -------------------------------------- | -| path | string | Yes | Path of the symbolic link in the application sandbox.| +| path | string | Yes | Application sandbox path of the file.| | callback | AsyncCallback<[Stat](#stat)> | Yes | Callback invoked to return the symbolic link information obtained. | **Example** @@ -1197,13 +1204,13 @@ Obtains information about a symbolic link synchronously. | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------------------- | -| path | string | Yes | Path of the file in the application sandbox.| +| path | string | Yes | Application sandbox path of the file.| **Return value** -| Type | Description | -| ------------- | ---------- | -| [Stat](#stat) | File information obtained.| + | Type | Description | + | ------------- | ---------- | + | [Stat](#stat) | File information obtained.| **Example** @@ -1216,7 +1223,7 @@ Obtains information about a symbolic link synchronously. rename(oldPath: string, newPath: string): Promise<void> -Renames a file or directory. This API uses a promise to return the result. +Renames a file or folder. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO @@ -1224,20 +1231,20 @@ Renames a file or directory. This API uses a promise to return the result. | Name | Type | Mandatory| Description | | ------- | ------ | ---- | ---------------------------- | -| oldPath | string | Yes | Path of the file to rename in the application sandbox.| -| newPath | string | Yes | Path of the renamed file in the application sandbox. | +| oldPath | string | Yes | Application sandbox path of the file to rename.| +| newPath | string | Yes | Application sandbox path of the renamed file. | **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** ```js let srcFile = pathDir + "/test.txt"; - let dstFile = pathDir + '/new.txt'; + let dstFile = pathDir + "/new.txt"; fs.rename(srcFile, dstFile).then(() => { console.info("File renamed"); }).catch((err) => { @@ -1249,7 +1256,7 @@ Renames a file or directory. This API uses a promise to return the result. rename(oldPath: string, newPath: string, callback: AsyncCallback<void>): void -Renames a file or directory. This API uses an asynchronous callback to return the result. +Renames a file or folder. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO @@ -1257,15 +1264,15 @@ Renames a file or directory. This API uses an asynchronous callback to return th | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ---------------------------- | -| oldPath | string | Yes | Path of the file to rename in the application sandbox.| -| newPath | string | Yes | Path of the renamed file in the application sandbox. | +| oldPath | string | Yes | Application sandbox path of the file to rename.| +| newPath | string | Yes | Application sandbox path of the renamed file. | | callback | AsyncCallback<void> | Yes | Callback invoked when the file is asynchronously renamed. | **Example** ```js let srcFile = pathDir + "/test.txt"; - let dstFile = pathDir + '/new.txt'; + let dstFile = pathDir + "/new.txt"; fs.rename(srcFile, dstFile, (err) => { if (err) { console.info("rename failed with error message: " + err.message + ", error code: " + err.code); @@ -1279,7 +1286,7 @@ Renames a file or directory. This API uses an asynchronous callback to return th renameSync(oldPath: string, newPath: string): void -Renames a file or directory synchronously. +Renames a file or folder synchronously. **System capability**: SystemCapability.FileManagement.File.FileIO @@ -1287,14 +1294,14 @@ Renames a file or directory synchronously. | Name | Type | Mandatory| Description | | ------- | ------ | ---- | ---------------------------- | -| oldPath | string | Yes | Path of the file to rename in the application sandbox.| -| newPath | string | Yes | Path of the renamed file in the application sandbox. | +| oldPath | string | Yes | Application sandbox path of the file to rename.| +| newPath | string | Yes | Application sandbox path of the renamed file. | **Example** ```js let srcFile = pathDir + "/test.txt"; - let dstFile = pathDir + '/new.txt'; + let dstFile = pathDir + "/new.txt"; fs.renameSync(srcFile, dstFile); ``` @@ -1309,15 +1316,15 @@ Flushes data of a file to disk. This API uses a promise to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ------------ | -| fd | number | Yes | FD of the file.| + | Name | Type | Mandatory | Description | + | ---- | ------ | ---- | ------------ | + | fd | number | Yes | FD of the file.| **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** @@ -1342,10 +1349,10 @@ Flushes data of a file to disk. This API uses an asynchronous callback to return **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ------------------------- | ---- | --------------- | -| fd | number | Yes | FD of the file. | -| Callback | AsyncCallback<void> | Yes | Callback invoked when the file data is synchronized in asynchronous mode.| + | Name | Type | Mandatory | Description | + | -------- | ------------------------- | ---- | --------------- | + | fd | number | Yes | FD of the file. | + | Callback | AsyncCallback<void> | Yes | Callback invoked when the file data is synchronized in asynchronous mode.| **Example** @@ -1373,9 +1380,9 @@ Flushes data of a file to disk synchronously. **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ------------ | -| fd | number | Yes | FD of the file.| + | Name | Type | Mandatory | Description | + | ---- | ------ | ---- | ------------ | + | fd | number | Yes | FD of the file.| **Example** @@ -1397,15 +1404,15 @@ Flushes data of a file to disk. This API uses a promise to return the result. ** **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ------------ | -| fd | number | Yes | FD of the file.| + | Name | Type | Mandatory | Description | + | ---- | ------ | ---- | ------------ | + | fd | number | Yes | FD of the file.| **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** @@ -1431,10 +1438,10 @@ Flushes data of a file to disk. This API uses an asynchronous callback to return **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ------------------------------- | ---- | ----------------- | -| fd | number | Yes | FD of the file. | -| callback | AsyncCallback<void> | Yes | Callback invoked when the file data is synchronized in asynchronous mode.| + | Name | Type | Mandatory | Description | + | -------- | ------------------------------- | ---- | ----------------- | + | fd | number | Yes | FD of the file. | + | callback | AsyncCallback<void> | Yes | Callback invoked when the file data is synchronized in asynchronous mode.| **Example** @@ -1461,9 +1468,9 @@ Synchronizes data in a file synchronously. **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ------------ | -| fd | number | Yes | FD of the file.| + | Name | Type | Mandatory | Description | + | ---- | ------ | ---- | ------------ | + | fd | number | Yes | FD of the file.| **Example** @@ -1487,20 +1494,20 @@ Creates a symbolic link based on a file path. This API uses a promise to return | Name | Type | Mandatory| Description | | ------- | ------ | ---- | ---------------------------- | -| target | string | Yes | Path of the source file in the application sandbox. | -| srcPath | string | Yes | Path of the symbolic link in the application sandbox.| +| target | string | Yes | Application sandbox path of the source file. | +| srcPath | string | Yes | Application sandbox path of the symbolic link.| **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** ```js let srcFile = pathDir + "/test.txt"; - let dstFile = pathDir + '/test'; + let dstFile = pathDir + "/test"; fs.symlink(srcFile, dstFile).then(() => { console.info("Symbolic link created"); }).catch((err) => { @@ -1520,15 +1527,15 @@ Creates a symbolic link based on a file path. This API uses an asynchronous call | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | -------------------------------- | -| target | string | Yes | Path of the source file in the application sandbox. | -| srcPath | string | Yes | Path of the symbolic link in the application sandbox. | +| target | string | Yes | Application sandbox path of the source file. | +| srcPath | string | Yes | Application sandbox path of the symbolic link. | | callback | AsyncCallback<void> | Yes | Callback invoked when the symbolic link is created asynchronously.| **Example** ```js let srcFile = pathDir + "/test.txt"; - let dstFile = pathDir + '/test'; + let dstFile = pathDir + "/test"; fs.symlink(srcFile, dstFile, (err) => { if (err) { console.info("symlink failed with error message: " + err.message + ", error code: " + err.code); @@ -1550,14 +1557,14 @@ Synchronously creates a symbolic link based on a file path. | Name | Type | Mandatory| Description | | ------- | ------ | ---- | ---------------------------- | -| target | string | Yes | Path of the source file in the application sandbox. | -| srcPath | string | Yes | Path of the symbolic link in the application sandbox.| +| target | string | Yes | Application sandbox path of the source file. | +| srcPath | string | Yes | Application sandbox path of the symbolic link.| **Example** ```js let srcFile = pathDir + "/test.txt"; - let dstFile = pathDir + '/test'; + let dstFile = pathDir + "/test"; fs.symlinkSync(srcFile, dstFile); ``` @@ -1566,7 +1573,7 @@ listFile(path: string, options?: { recursion?: boolean; listNum?: number; filter?: Filter; -}): Promise; +}): Promise Lists all files in a directory. This API uses a promise to return the result.
This API supports recursive listing of all files (including files in subdirectories) and file filtering. @@ -1574,24 +1581,24 @@ Lists all files in a directory. This API uses a promise to return the result.
{ console.info("listFile succeed"); - for (let i = 0; i < filenames.size; i++) { + for (let i = 0; i < filenames.length; i++) { console.info("fileName: %s", filenames[i]); } }).catch((err) => { @@ -1621,25 +1628,25 @@ listFile(path: string, options?: { recursion?: boolean; listNum?: number; filter?: Filter; -}, callback: AsyncCallback): void; +}, callback: AsyncCallback): void Lists all files in a directory. This API uses an asynchronous callback to return the result.
This API supports recursive listing of all files (including files in subdirectories) and file filtering. **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | --------------------------- | -| path | string | Yes | Path of the directory in the application sandbox.| -| options | Object | No | File filtering options.| -| callback | AsyncCallback<string[]> | Yes | Callback invoked to return the file names listed. | + | Name | Type | Mandatory | Description | + | ------ | ------ | ---- | --------------------------- | + | path | string | Yes | Application sandbox path of the folder.| + | options | Object | No | File filtering options. The files are not filtered by default.| + | callback | AsyncCallback<string[]> | Yes | Callback invoked to return the file names listed. | **options parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | --------------------------- | -| recursion | boolean | No | Whether to list all files in subdirectories recursively. The default value is **false**.| -| listNum | number | No | Number of file names to list. The default value **0** means to list all files.| -| filter | [Filter](#filter) | No | File filtering options. Currently, only the match by file name extension, fuzzy search by file name, and filter by file size or latest modification time are supported.| + | Name | Type | Mandatory | Description | + | ------ | ------ | ---- | --------------------------- | + | recursion | boolean | No | Whether to list all files in subdirectories recursively. The default value is **false**.| + | listNum | number | No | Number of file names to list. The default value **0** means to list all files.| + | filter | [Filter](#filter) | No | File filtering options. Currently, only the match by file name extension, fuzzy search by file name, and filter by file size or latest modification time are supported.| **Example** @@ -1659,43 +1666,43 @@ Lists all files in a directory. This API uses an asynchronous callback to return console.info("list file failed with error message: " + err.message + ", error code: " + err.code); } else { console.info("listFile succeed"); - for (let i = 0; i < filenames.size; i++) { + for (let i = 0; i < filenames.length; i++) { console.info("filename: %s", filenames[i]); } } }); ``` -## listFileSync +## fs.listFileSync listFileSync(path: string, options?: { recursion?: boolean; listNum?: number; filter?: Filter; -}): string[]; +}): string[] Lists all files in a directory synchronously. This API supports recursive listing of all files (including files in subdirectories) and file filtering. **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | --------------------------- | -| path | string | Yes | Path of the directory in the application sandbox.| -| options | Object | No | File filtering options.| + | Name | Type | Mandatory | Description | + | ------ | ------ | ---- | --------------------------- | + | path | string | Yes | Application sandbox path of the folder.| + | options | Object | No | File filtering options. The files are not filtered by default.| **options parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | --------------------------- | -| recursion | boolean | No | Whether to list all files in subdirectories recursively. The default value is **false**.| -| listNum | number | No | Number of file names to list. The default value **0** means to list all files.| -| filter | [Filter](#filter) | No | File filtering options. Currently, only the match by file name extension, fuzzy search by file name, and filter by file size or latest modification time are supported.| + | Name | Type | Mandatory | Description | + | ------ | ------ | ---- | --------------------------- | + | recursion | boolean | No | Whether to list all files in subdirectories recursively. The default value is **false**.| + | listNum | number | No | Number of file names to list. The default value **0** means to list all files.| + | filter | [Filter](#filter) | No | File filtering options. Currently, only the match by file name extension, fuzzy search by file name, and filter by file size or latest modification time are supported.| **Return value** -| Type | Description | -| --------------------- | ---------- | -| string[] | File names listed.| + | Type | Description | + | --------------------- | ---------- | + | string[] | File names listed.| **Example** @@ -1712,13 +1719,93 @@ Lists all files in a directory synchronously. This API supports recursive listin }; let filenames = fs.listFileSync(pathDir, options); console.info("listFile succeed"); - for (let i = 0; i < filenames.size; i++) { + for (let i = 0; i < filenames.length; i++) { console.info("filename: %s", filenames[i]); } ``` -## moveFile -moveFile(src: string, dest: string, mode?: number): Promise; +## fs.moveDir10+ + +moveDir(src: string, dest: string, mode?: number): Promise\ + +Moves a folder. This API uses a promise to return the result. + +**System capability**: SystemCapability.FileManagement.File.FileIO + +**Parameters** + + | Name | Type | Mandatory | Description | + | ------ | ------ | ---- | --------------------------- | + | src | string | Yes | Application sandbox path of the source folder.| + | dest | string | Yes | Application sandbox path of the destination folder.| + | mode | number | No | Mode for moving the folder. The default value is **0**.
- **0**: Throw an exception if the destination directory has folders of the same names with the source folder.
- **1**: Throw an exception if the destination directory has files of the same names with the source folder. All files without conflicts in the source folder are moved to the destination folder, and all files without conflicts in the destination folder are retained. The **data** in the error thrown provides information about the conflict files.
- **2**: Forcibly overwrite the files with the same names in the destination folder. The files with the the same names in the destination folder are overwritten forcibly; the files without conflicts in the destination folder are retained.
- **3**: Forcibly overwrite the destination folder. Move the source folder to the destination directory and make the destination folder completely the same as the source folder. All the original files in the destination folder are not retained.| + +**Return value** + + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| + +**Example** + + ```js + // move directory from srcPath to destPath/srcPath + let srcPath = pathDir + "/srcDir/"; + let destPath = pathDir + "/destDir/"; + fs.moveDir(srcPath, destPath, 1).then(() => { + console.info("move directory succeed"); + }).catch((err) => { + if (err.code == 13900015) { + for (let i = 0; i < err.data.length; i++) { + console.info("move directory failed with conflicting files: " + err.data[i].srcFile + + " " + err.data[i].destFile); + } + } else { + console.info("move directory failed with error message: " + err.message + ", error code: " + err.code); + } + }); + ``` + +## fs.moveDir10+ + +moveDir(src: string, dest: string, mode?: number, callback: AsyncCallback\): void + +Moves a folder. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.FileManagement.File.FileIO + +**Parameters** + + | Name | Type | Mandatory | Description | + | ------ | ------ | ---- | --------------------------- | + | src | string | Yes | Application sandbox path of the source folder.| + | dest | string | Yes | Application sandbox path of the destination folder.| + | mode | number | No | Whether to overwrite the file of the same name in the destination directory. The default value is **0**.
- **0**: Throw an exception if the destination directory has folders of the same names with the source folder.
- **1**: Throw an exception if the destination directory has files of the same names with the source folder. All files without conflicts in the source folder are moved to the destination folder, and all files without conflicts in the destination folder are retained. The **data** in the error thrown provides information about the conflict files.
- **2**: Forcibly overwrite the files with the same names in the destination folder. The files with the the same names in the destination folder are overwritten forcibly; the files without conflicts in the destination folder are retained.
- **3**: Forcibly overwrite the destination folder. Move the source folder to the destination directory and make the destination folder completely the same as the source folder. All the original files in the destination folder are not retained.| + | callback | AsyncCallback<void> | Yes | Callback invoked when the folder is moved. | + +**Example** + + ```js + // move directory from srcPath to destPath/srcPath + let srcPath = pathDir + "/srcDir/"; + let destPath = pathDir + "/destDir/"; + fs.moveDir(srcPath, destPath, 1, (err) => { + if (err && err.code == 13900015) { + for (let i = 0; i < err.data.length; i++) { + console.info("move directory failed with conflicting files: " + err.data[i].srcFile + + " " + err.data[i].destFile); + } + } else if (err) { + console.info("move directory failed with error message: " + err.message + ", error code: " + err.code); + } else { + console.info("move directory succeed"); + } + }); + ``` + +## fs.moveFile + +moveFile(src: string, dest: string, mode?: number): Promise\ Moves a file. This API uses a promise to return the result. @@ -1726,15 +1813,23 @@ Moves a file. This API uses a promise to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | --------------------------- | -| src | string | Yes | Path of the file to move in the application sandbox.| -| dest | string | Yes | Destination path of the file in the application sandbox.| -| mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.| + | Name | Type | Mandatory | Description | + | ------ | ------ | ---- | --------------------------- | + | src | string | Yes | Application sandbox path of the source file.| + | dest | string | Yes | Application sandbox path of the destination file.| + | mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.| + +**Return value** + + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** ```js + let srcPath = pathDir + "/source.txt"; + let destPath = pathDir + "/dest.txt"; fs.moveFile(srcPath, destPath, 0).then(() => { console.info("move file succeed"); }).catch((err) => { @@ -1742,9 +1837,9 @@ Moves a file. This API uses a promise to return the result. }); ``` -## moveFile +## fs.moveFile -moveFile(src: string, dest: string, mode?: number, callback: AsyncCallback): void; +moveFile(src: string, dest: string, mode?: number, callback: AsyncCallback\): void Moves a file. This API uses an asynchronous callback to return the result. @@ -1752,16 +1847,18 @@ Moves a file. This API uses an asynchronous callback to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | --------------------------- | -| src | string | Yes | Path of the file to move in the application sandbox.| -| dest | string | Yes | Destination path of the file in the application sandbox.| -| mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.| -| callback | AsyncCallback<void> | Yes | Callback invoked when the file is moved. | + | Name | Type | Mandatory | Description | + | ------ | ------ | ---- | --------------------------- | + | src | string | Yes | Application sandbox path of the source file.| + | dest | string | Yes | Application sandbox path of the destination file.| + | mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.| + | callback | AsyncCallback<void> | Yes | Callback invoked when the file is moved. | **Example** ```js + let srcPath = pathDir + "/source.txt"; + let destPath = pathDir + "/dest.txt"; fs.moveFile(srcPath, destPath, 0, (err) => { if (err) { console.info("move file failed with error message: " + err.message + ", error code: " + err.code); @@ -1771,9 +1868,9 @@ Moves a file. This API uses an asynchronous callback to return the result. }); ``` -## moveFileSync +## fs.moveFileSync -moveFile(src: string, dest: string, mode?: number): void; +moveFile(src: string, dest: string, mode?: number): void Moves a file synchronously. @@ -1781,15 +1878,17 @@ Moves a file synchronously. **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | --------------------------- | -| src | string | Yes | Path of the file to move in the application sandbox.| -| dest | string | Yes | Destination path of the file in the application sandbox.| -| mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.| + | Name | Type | Mandatory | Description | + | ------ | ------ | ---- | --------------------------- | + | src | string | Yes | Application sandbox path of the source file.| + | dest | string | Yes | Application sandbox path of the destination file.| + | mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.| **Example** ```js + let srcPath = pathDir + "/source.txt"; + let destPath = pathDir + "/dest.txt"; fs.moveFileSync(srcPath, destPath, 0); console.info("move file succeed"); ``` @@ -1804,15 +1903,15 @@ Creates a temporary directory. This API uses a promise to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | --------------------------- | -| prefix | string | Yes | A randomly generated string used to replace "XXXXXX" in a directory.| + | 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.| + | Type | Description | + | --------------------- | ---------- | + | Promise<string> | Promise used to return the unique directory generated.| **Example** @@ -1835,10 +1934,10 @@ Creates a temporary directory. This API uses an asynchronous callback to return **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. | + | 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** @@ -1862,27 +1961,27 @@ Synchronously creates a temporary directory. **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | --------------------------- | -| prefix | string | Yes | A randomly generated string used to replace "XXXXXX" in a directory.| + | 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.| + | Type | Description | + | ------ | ---------- | + | string | Unique path generated.| **Example** ```js let res = fs.mkdtempSync(pathDir + "/XXXXXX"); - ``` + ``` ## fs.createStream createStream(path: string, mode: string): Promise<Stream> -Opens a file stream based on the file path. This API uses a promise to return the result. +Creates a stream based on the file path. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO @@ -1890,14 +1989,14 @@ Opens a file stream based on the file path. This API uses a promise to return th | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | -| path | string | Yes | Path of the file in the application sandbox. | +| 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](#stream)> | Promise used to return the result.| + | Type | Description | + | --------------------------------- | --------- | + | Promise<[Stream](#stream)> | Promise used to return the result.| **Example** @@ -1915,7 +2014,7 @@ Opens a file stream based on the file path. This API uses a promise to return th createStream(path: string, mode: string, callback: AsyncCallback<Stream>): void -Opens a file stream based on the file path. This API uses an asynchronous callback to return the result. +Creates a stream based on the file path. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO @@ -1923,9 +2022,9 @@ Opens a file stream based on the file path. This API uses an asynchronous callba | Name | Type | Mandatory| Description | | -------- | --------------------------------------- | ---- | ------------------------------------------------------------ | -| path | string | Yes | Path of the file in the application sandbox. | +| 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).| -| callback | AsyncCallback<[Stream](#stream)> | Yes | Callback invoked when the stream is open asynchronously. | +| callback | AsyncCallback<[Stream](#stream)> | Yes | Callback invoked when the stream is created asynchronously. | **Example** @@ -1944,7 +2043,7 @@ Opens a file stream based on the file path. This API uses an asynchronous callba createStreamSync(path: string, mode: string): Stream -Synchronously opens a stream based on the file path. +Synchronously creates a stream based on the file path. **System capability**: SystemCapability.FileManagement.File.FileIO @@ -1952,14 +2051,14 @@ Synchronously opens a stream based on the file path. | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | -| path | string | Yes | Path of the file in the application sandbox. | +| 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](#stream) | Stream opened.| + | Type | Description | + | ------------------ | --------- | + | [Stream](#stream) | Stream opened.| **Example** @@ -1973,22 +2072,22 @@ Synchronously opens a stream based on the file path. fdopenStream(fd: number, mode: string): Promise<Stream> -Opens a file stream based on the file descriptor. This API uses a promise to return the result. +Opens a stream based on the file descriptor. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ---------------------------------------- | -| fd | number | Yes | FD 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).| + | Name | Type | Mandatory | Description | + | ---- | ------ | ---- | ---------------------------------------- | + | fd | number | Yes | FD 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](#stream)> | Promise used to return the result.| + | Type | Description | + | --------------------------------- | --------- | + | Promise<[Stream](#stream)> | Promise used to return the result.| **Example** @@ -2008,17 +2107,17 @@ Opens a file stream based on the file descriptor. This API uses a promise to ret fdopenStream(fd: number, mode: string, callback: AsyncCallback<Stream>): void -Opens a file stream based on the file descriptor. This API uses an asynchronous callback to return the result. +Opens a stream based on the file descriptor. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.FileManagement.File.FileIO **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | ---------------------------------------- | -| fd | number | Yes | FD 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).| -| callback | AsyncCallback<[Stream](#stream)> | Yes | Callback invoked when the stream is open asynchronously. | + | Name | Type | Mandatory | Description | + | -------- | ---------------------------------------- | ---- | ---------------------------------------- | + | fd | number | Yes | FD 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).| + | callback | AsyncCallback<[Stream](#stream)> | Yes | Callback invoked when the stream is open asynchronously. | **Example** @@ -2045,16 +2144,16 @@ Synchronously opens a stream based on the file descriptor. **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ---------------------------------------- | -| fd | number | Yes | FD 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).| + | Name | Type | Mandatory | Description | + | ---- | ------ | ---- | ---------------------------------------- | + | fd | number | Yes | FD 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](#stream) | Stream opened.| + | Type | Description | + | ------------------ | --------- | + | [Stream](#stream) | Stream opened.| **Example** @@ -2065,6 +2164,78 @@ Synchronously opens a stream based on the file descriptor. fs.closeSync(file); ``` +## fs.createWatcher10+ + +createWatcher(path: string, events: number, listener: WatchEventListener): Watcher + +Creates a **Watcher** object to observe file or directory changes. + +**System API**: This is a system API. + +**System capability**: SystemCapability.FileManagement.File.FileIO + +**Parameters** + + | Name | Type | Mandatory | Description | + | ---- | ------ | ---- | ---------------------------------------- | + | path | string | Yes | Application sandbox path of the file or directory to observe. | + | events | number | Yes | Events to observe. Multiple events can be separated by a bitwise OR operator (|)|.
- **0x1: IN_ACCESS**: A file is accessed.
- **0x2: IN_MODIFY**: The file content is modified.
- **0x4: IN_ATTRIB**: Metadata is changed.
- **0x8: IN_CLOSE_WRITE**: The file opened for writing is closed.
- **0x10: IN_CLOSE_NOWRITE**: The file or directory not opened for writing is closed.
- **0x20: IN_OPEN**: A file or directory is opened.
- **0x40: IN_MOVED_FROM**: A file in the observed directory is moved.
- **0x80: IN_MOVED_TO**: A file is moved to the observed directory.
- **0x100: IN_CREATE**: A file or directory is created in the observed directory.
- **0x200: IN_DELETE**: A file or directory is deleted from the observed directory.
- **0x400: IN_DELETE_SELF**: The observed directory is deleted. After the directory is deleted, the listening stops.
- **0x800: IN_MOVE_SELF**: The observed file or directory is moved. After the file or directory is moved, the listening continues.
- **0xfff: IN_ALL_EVENTS**: All events.| + | listener | WatchEventListener | Yes | Callback invoked when an observed event occurs. The callback will be invoked each time an observed event occurs. | + +**Return value** + + | Type | Description | + | ------------------ | --------- | + | [Watcher](#watcher10) | **Watcher** object created.| + +**Example** + + ```js + let filePath = pathDir + "/test.txt"; + let file = fs.openSync(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); + let watcher = fs.createWatcher(filePath, 0x2 | 0x10, (watchEvent) => { + if (watchEvent.event == 0x2) { + console.info(watchEvent.fileName + 'was modified'); + } else if (watchEvent.event == 0x10) { + console.info(watchEvent.fileName + 'was closed'); + } + }); + watcher.start(); + fs.writeSync(file.fd, 'test'); + fs.closeSync(file); + watcher.stop(); + ``` + +## WatchEventListener10+ + +(event: WatchEvent): void + +Called when an observed event occurs. + +**System API**: This is a system API. + +**System capability**: SystemCapability.FileManagement.File.FileIO + +**Parameters** + + | Name | Type | Mandatory | Description | + | ---- | ------ | ---- | ---------------------------------------- | + | event | WatchEvent | Yes | Event for the callback to invoke. | + +## WatchEvent10+ + +Defines the event to observe. + +**System API**: This is a system API. + +**System capability**: SystemCapability.FileManagement.File.FileIO + +| Name | Type | Readable | Writable | Description | +| ---- | ------ | ---- | ---- | ------- | +| fileName | string | Yes | No | Name of the file for which the event occurs.| +| event | number | Yes | No | Events to observe. For details, see **events** in [createWatcher](#fscreatewatcher10).| +| cookie | number | Yes | No | Cookie bound with the event. Currently, only the **IN_MOVED_FROM** and **IN_MOVED_TO** events are supported. The **IN_MOVED_FROM** and **IN_MOVED_TO** events of the same file have the same **cookie** value.| + ## Stat Represents detailed file information. Before calling any API of the **Stat()** class, use [stat()](#fsstat) to create a **Stat** instance synchronously or asynchronously. @@ -2074,7 +2245,7 @@ Represents detailed file information. Before calling any API of the **Stat()** c ### Attributes | Name | Type | Readable | Writable | Description | -| ------ | ------ | ---- | ---- | ---------------------------------------- | +| ------ | ------ | ---- | ---- | ---------------------------------------- | | ino | number | Yes | No | File ID. Different files on the same device have different **ino**s.| | | mode | number | Yes | No | File permissions. The meaning of each bit is as follows:
- **0o400**: The owner has the read permission on a regular file or a directory entry.
- **0o200**: The owner has the permission to write a regular file or create and delete a directory entry.
- **0o100**: The owner has the permission to execute a regular file or search for the specified path in a directory.
- **0o040**: The user group has the read permission on a regular file or a directory entry.
- **0o020**: The user group has the permission to write a regular file or create and delete a directory entry.
- **0o010**: The user group has the permission to execute a regular file or search for the specified path in a directory.
- **0o004**: Other users have the permission to read a regular file or read a directory entry.
- **0o002**: Other users have the permission to write a regular file or create and delete a directory entry.
- **0o001**: Other users have the permission to execute a regular file or search for the specified path in a directory.| | uid | number | Yes | No | ID of the file owner.| @@ -2095,9 +2266,9 @@ Checks whether this file is a block special file. A block special file supports **Return value** -| Type | Description | -| ------- | ---------------- | -| boolean | Whether the file is a block special file.| + | Type | Description | + | ------- | ---------------- | + | boolean | Whether the file is a block special file.| **Example** @@ -2116,9 +2287,9 @@ Checks whether this file is a character special file. A character special file s **Return value** -| Type | Description | -| ------- | ----------------- | -| boolean | Whether the file is a character special file.| + | Type | Description | + | ------- | ----------------- | + | boolean | Whether the file is a character special file.| **Example** @@ -2138,9 +2309,9 @@ Checks whether this file is a directory. **Return value** -| Type | Description | -| ------- | ------------- | -| boolean | Whether the file is a directory.| + | Type | Description | + | ------- | ------------- | + | boolean | Whether the file is a directory.| **Example** @@ -2160,9 +2331,9 @@ Checks whether this file is a named pipe (or FIFO). Named pipes are used for int **Return value** -| Type | Description | -| ------- | --------------------- | -| boolean | Whether the file is a FIFO.| + | Type | Description | + | ------- | --------------------- | + | boolean | Whether the file is a FIFO.| **Example** @@ -2182,9 +2353,9 @@ Checks whether this file is a regular file. **Return value** -| Type | Description | -| ------- | --------------- | -| boolean | Whether the file is a regular file.| + | Type | Description | + | ------- | --------------- | + | boolean | Whether the file is a regular file.| **Example** @@ -2204,9 +2375,9 @@ Checks whether this file is a socket. **Return value** -| Type | Description | -| ------- | -------------- | -| boolean | Whether the file is a socket.| + | Type | Description | + | ------- | -------------- | + | boolean | Whether the file is a socket.| **Example** @@ -2226,9 +2397,9 @@ Checks whether this file is a symbolic link. **Return value** -| Type | Description | -| ------- | --------------- | -| boolean | Whether the file is a symbolic link.| + | Type | Description | + | ------- | --------------- | + | boolean | Whether the file is a symbolic link.| **Example** @@ -2239,7 +2410,7 @@ Checks whether this file is a symbolic link. ## Stream -Provides file stream management. Before calling any API of the **Stream** class, use **createStream()** to create a **Stream** instance synchronously or asynchronously. +Provides a stream for file operations. Before calling any API of the **Stream** class, use **createStream()** to create a **Stream** instance synchronously or asynchronously. ### close @@ -2252,9 +2423,9 @@ Closes the stream. This API uses a promise to return the result. **Return value** -| Type | Description | -| ------------------- | ------------- | -| Promise<void> | Promise used to return the stream close result.| + | Type | Description | + | ------------------- | ------------- | + | Promise<void> | Promise used to return the stream close result.| **Example** @@ -2279,9 +2450,9 @@ Closes the stream. This API uses an asynchronous callback to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ------------------------- | ---- | ------------- | -| callback | AsyncCallback<void> | Yes | Callback invoked when the stream is closed asynchronously.| + | Name | Type | Mandatory | Description | + | -------- | ------------------------- | ---- | ------------- | + | callback | AsyncCallback<void> | Yes | Callback invoked when the stream is closed asynchronously.| **Example** @@ -2323,9 +2494,9 @@ Flushes the stream. This API uses a promise to return the result. **Return value** -| Type | Description | -| ------------------- | ------------- | -| Promise<void> | Promise used to return the stream flushing result.| + | Type | Description | + | ------------------- | ------------- | + | Promise<void> | Promise used to return the stream flushing result.| **Example** @@ -2350,9 +2521,9 @@ Flushes the stream. This API uses an asynchronous callback to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ------------------------- | ---- | -------------- | -| callback | AsyncCallback<void> | Yes | Callback invoked when the stream is asynchronously flushed.| + | Name | Type | Mandatory | Description | + | -------- | ------------------------- | ---- | -------------- | + | callback | AsyncCallback<void> | Yes | Callback invoked when the stream is asynchronously flushed.| **Example** @@ -2394,16 +2565,16 @@ Writes data into the stream. This API uses a promise to return the result. **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:
- **length** (number): length of the data to write. The default value is the buffer length.
- **offset** (number): start position to write the data in the file. This parameter is optional. By default, data is written from the current position.
- **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.| + | 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:
- **length** (number): length of the data to write. The default value is the buffer length.
- **offset** (number): start position to write the data in the file. This parameter is optional. By default, data is written from the current position.
- **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.| **Return value** -| Type | Description | -| --------------------- | -------- | -| Promise<number> | Promise used to return the length of the data written.| + | Type | Description | + | --------------------- | -------- | + | Promise<number> | Promise used to return the length of the data written.| **Example** @@ -2428,11 +2599,11 @@ Writes data into the stream. This API uses an asynchronous callback to return th **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:
- **length** (number): length of the data to write. This parameter is optional. The default value is the buffer length.
- **offset** (number): start position to write the data in the file. This parameter is optional. By default, data is written from the current position.
- **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.| -| callback | AsyncCallback<number> | Yes | Callback invoked when the data is written asynchronously. | + | 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:
- **length** (number): length of the data to write. This parameter is optional. The default value is the buffer length.
- **offset** (number): start position to write the data in the file. This parameter is optional. By default, data is written from the current position.
- **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.| + | callback | AsyncCallback<number> | Yes | Callback invoked when the data is written asynchronously. | **Example** @@ -2460,16 +2631,16 @@ Synchronously writes data into the stream. **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:
- **length** (number): length of the data to write. This parameter is optional. The default value is the buffer length.
- **offset** (number): start position to write the data in the file. This parameter is optional. By default, data is written from the current position.
- **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.| + | 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:
- **length** (number): length of the data to write. This parameter is optional. The default value is the buffer length.
- **offset** (number): start position to write the data in the file. This parameter is optional. By default, data is written from the current position.
- **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.| **Return value** -| Type | Description | -| ------ | -------- | -| number | Length of the data written in the file.| + | Type | Description | + | ------ | -------- | + | number | Length of the data written in the file.| **Example** @@ -2489,16 +2660,16 @@ Reads data from the stream. This API uses a promise to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| ------- | ----------- | ---- | ---------------------------------------- | -| buffer | ArrayBuffer | Yes | Buffer used to store the file read. | -| options | Object | No | The options are as follows:
- **length** (number): length of the data to read. This parameter is optional. The default value is the buffer length.
- **offset** (number): position of the data to read in the file. By default, data is read from the current position.| + | Name | Type | Mandatory | Description | + | ------- | ----------- | ---- | ---------------------------------------- | + | buffer | ArrayBuffer | Yes | Buffer used to store the file read. | + | options | Object | No | The options are as follows:
- **length** (number): length of the data to read. This parameter is optional. The default value is the buffer length.
- **offset** (number): position of the data to read in the file. By default, data is read from the current position.| **Return value** -| Type | Description | -| ---------------------------------- | ------ | -| Promise<number> | Promise used to return the data read.| + | Type | Description | + | ---------------------------------- | ------ | + | Promise<number> | Promise used to return the data read.| **Example** @@ -2508,7 +2679,7 @@ Reads data from the stream. This API uses a promise to return the result. let buf = new ArrayBuffer(4096); ss.read(buf, {offset: 5, length: 5}).then((readLen) => { console.info("Read data successfully"); - console.log(String.fromCharCode.apply(null, new Uint8Array(buf))); + console.log(String.fromCharCode.apply(null, new Uint8Array(buf.slice(0, readLen)))); }).catch((err) => { console.info("read data failed with error message: " + err.message + ", error code: " + err.code); }); @@ -2525,11 +2696,11 @@ Reads data from the stream. This API uses an asynchronous callback to return the **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | ---------------------------------------- | -| buffer | ArrayBuffer | Yes | Buffer used to store the file read. | -| options | Object | No | The options are as follows:
- **length** (number): length of the data to read. This parameter is optional. The default value is the buffer length.
- **offset** (number): position of the data to read in the file. This parameter is optional. By default, data is read from the current position.| -| callback | AsyncCallback<number> | Yes | Callback invoked when data is read asynchronously from the stream. | + | Name | Type | Mandatory | Description | + | -------- | ---------------------------------------- | ---- | ---------------------------------------- | + | buffer | ArrayBuffer | Yes | Buffer used to store the file read. | + | options | Object | No | The options are as follows:
- **length** (number): length of the data to read. This parameter is optional. The default value is the buffer length.
- **offset** (number): position of the data to read in the file. This parameter is optional. By default, data is read from the current position.| + | callback | AsyncCallback<number> | Yes | Callback invoked when data is read asynchronously from the stream. | **Example** @@ -2542,7 +2713,7 @@ Reads data from the stream. This API uses an asynchronous callback to return the console.info("read stream failed with error message: " + err.message + ", error code: " + err.code); } else { console.info("Read data successfully"); - console.log(String.fromCharCode.apply(null, new Uint8Array(buf))); + console.log(String.fromCharCode.apply(null, new Uint8Array(buf.slice(0, readLen)))); } }); ``` @@ -2557,16 +2728,16 @@ Synchronously reads data from the stream. **Parameters** -| Name | Type | Mandatory | Description | -| ------- | ----------- | ---- | ---------------------------------------- | -| buffer | ArrayBuffer | Yes | Buffer used to store the file read. | -| options | Object | No | The options are as follows:
- **length** (number): length of the data to read. This parameter is optional. The default value is the buffer length.
- **offset** (number): position of the data to read in the file. This parameter is optional. By default, data is read from the current position.
| + | Name | Type | Mandatory | Description | + | ------- | ----------- | ---- | ---------------------------------------- | + | buffer | ArrayBuffer | Yes | Buffer used to store the file read. | + | options | Object | No | The options are as follows:
- **length** (number): length of the data to read. This parameter is optional. The default value is the buffer length.
- **offset** (number): position of the data to read in the file. By default, data is read from the current position.
| **Return value** -| Type | Description | -| ------ | -------- | -| number | Length of the data read.| + | Type | Description | + | ------ | -------- | + | number | Length of the data read.| **Example** @@ -2590,7 +2761,7 @@ Represents a **File** object opened by **open()**. ### lock -lock(exclusive?: boolean): Promise; +lock(exclusive?: boolean): Promise\ Applies an exclusive lock or a shared lock on this file in blocking mode. This API uses a promise to return the result. @@ -2598,15 +2769,15 @@ Applies an exclusive lock or a shared lock on this file in blocking mode. This A **Parameters** -| Name | Type | Mandatory | Description | -| ------- | ----------- | ---- | ---------------------------------------- | -| exclusive | boolean | No | Lock to apply. The value **true** means an exclusive lock, and the value **false** (default) means a shared lock. | + | Name | Type | Mandatory | Description | + | ------- | ----------- | ---- | ---------------------------------------- | + | exclusive | boolean | No | Lock to apply. The value **true** means an exclusive lock, and the value **false** (default) means a shared lock. | **Return value** -| Type | Description | -| ---------------------------------- | ------ | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ---------------------------------- | ------ | + | Promise<void> | Promise that returns no value.| **Example** @@ -2621,7 +2792,7 @@ Applies an exclusive lock or a shared lock on this file in blocking mode. This A ### lock -lock(exclusive?: boolean, callback: AsyncCallback): void; +lock(exclusive?: boolean, callback: AsyncCallback\): void Applies an exclusive lock or a shared lock on this file in blocking mode. This API uses a promise to return the result. @@ -2629,10 +2800,10 @@ Applies an exclusive lock or a shared lock on this file in blocking mode. This A **Parameters** -| Name | Type | Mandatory | Description | -| ------- | ----------- | ---- | ---------------------------------------- | -| exclusive | boolean | No | Lock to apply. The value **true** means an exclusive lock, and the value **false** (default) means a shared lock. | -| callback | AsyncCallback<void> | Yes | Callback invoked when the file is locked. | + | Name | Type | Mandatory | Description | + | ------- | ----------- | ---- | ---------------------------------------- | + | exclusive | boolean | No | Lock to apply. The value **true** means an exclusive lock, and the value **false** (default) means a shared lock. | + | callback | AsyncCallback<void> | Yes | Callback invoked when the file is locked. | **Example** @@ -2649,7 +2820,7 @@ Applies an exclusive lock or a shared lock on this file in blocking mode. This A ### tryLock -tryLock(exclusive?: boolean): void; +tryLock(exclusive?: boolean): void Applies an exclusive lock or a shared lock on this file in non-blocking mode. @@ -2657,9 +2828,9 @@ Applies an exclusive lock or a shared lock on this file in non-blocking mode. **Parameters** -| Name | Type | Mandatory | Description | -| ------- | ----------- | ---- | ---------------------------------------- | -| exclusive | boolean | No | Lock to apply. The value **true** means an exclusive lock, and the value **false** (default) means a shared lock. | + | Name | Type | Mandatory | Description | + | ------- | ----------- | ---- | ---------------------------------------- | + | exclusive | boolean | No | Lock to apply. The value **true** means an exclusive lock, and the value **false** (default) means a shared lock. | **Example** @@ -2671,7 +2842,7 @@ Applies an exclusive lock or a shared lock on this file in non-blocking mode. ### unlock -unlock(): void; +unlock(): void Unlocks this file synchronously. @@ -2686,9 +2857,51 @@ Unlocks this file synchronously. console.log("unlock file successful"); ``` +## Watcher10+ + +Provides APIs for observing the changes of files or folders. Before using the APIs of **Watcher** , call **createWatcher()** to create a **Watcher** object. + +### start10+ + +start(): void + +Starts listening. + +**System API**: This is a system API. + +**System capability**: SystemCapability.FileManagement.File.FileIO + +**Example** + + ```js + let filePath = pathDir + "/test.txt"; + let watcher = fs.createWatcher(filePath, 0xfff, () => {}); + watcher.start(); + watcher.stop(); + ``` + +### stop10+ + +stop(): void + +Stops listening. + +**System API**: This is a system API. + +**System capability**: SystemCapability.FileManagement.File.FileIO + +**Example** + + ```js + let filePath = pathDir + "/test.txt"; + let watcher = fs.createWatcher(filePath, 0xfff, () => {}); + watcher.start(); + watcher.stop(); + ``` + ## OpenMode -Defines the constants of the **mode** parameter used in **open()**. It species the mode for opening a file. +Defines the constants of the **mode** parameter used in **open()**. It specifies the mode for opening a file. **System capability**: SystemCapability.FileManagement.File.FileIO diff --git a/en/application-dev/reference/apis/js-apis-file-picker.md b/en/application-dev/reference/apis/js-apis-file-picker.md new file mode 100644 index 0000000000000000000000000000000000000000..08a1e1bca160c10d9aa96c08c80082d6d78916ab --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-file-picker.md @@ -0,0 +1,772 @@ +# @ohos.file.picker (File Picker) + +The File Picker encapsulates system applications, such as **PhotoViewPicker**, **DocumentViewPicker**, and **AudioViewPicker**, and provides capabilities of selecting and saving photos, documents, and audio clips. The application can select the picker as required. + +> **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 +```js +import picker from '@ohos.file.picker'; +``` + +## PhotoViewPicker + +Provides APIs for selecting and saving images and videos. Before using the APIs of **PhotoViewPicker**, you need to create a **PhotoViewPicker** instance. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Example** + +```ts +let photoPicker = new picker.PhotoViewPicker(); +``` + +### select + +select(option?: PhotoSelectOptions) : Promise<PhotoSelectResult> + +Selects one or more images or videos in a **photoPicker** page. This API uses a promise to return the result. You can pass in **PhotoSelectOptions** to specify the media type and the maximum number of files to select. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------- | ---- | -------------------------- | +| option | [PhotoSelectOptions](#photoselectoptions) | No | Options for selecting images or videos.| + +**Return value** + +| Type | Description | +| ----------------------------- | :---- | +| Promise<[PhotoSelectResult](#photoselectresult)> | Promise used to return information about the images or videos selected.| + +**Example** + +```ts +async function example() { + try { + let PhotoSelectOptions = new picker.PhotoSelectOptions(); + PhotoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE; + PhotoSelectOptions.maxSelectNumber = 5; + let photoPicker = new picker.PhotoViewPicker(); + photoPicker.select(PhotoSelectOptions).then((PhotoSelectResult) => { + console.info('PhotoViewPicker.select successfully, PhotoSelectResult uri: ' + JSON.stringify(PhotoSelectResult)); + }).catch((err) => { + console.error('PhotoViewPicker.select failed with err: ' + err); + }); + } catch (err) { + console.error('PhotoViewPicker failed with err: ' + err); + } +} +``` + +### select + +select(option: PhotoSelectOptions, callback: AsyncCallback<PhotoSelectResult>) : void + +Selects one or more images or videos in a **photoPicker** page. This API uses an asynchronous callback to return the result. You can pass in **PhotoSelectOptions** to specify the media type and the maximum number of files to select. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------- | ---- | -------------------------- | +| option | [PhotoSelectOptions](#photoselectoptions) | Yes | Options for selecting images or videos.| +| callback | AsyncCallback<[PhotoSelectResult](#photoselectresult)> | Yes | Callback invoked to return information about the images or videos selected.| + +**Example** + +```ts +async function example() { + try { + let PhotoSelectOptions = new picker.PhotoSelectOptions(); + PhotoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE; + PhotoSelectOptions.maxSelectNumber = 5; + let photoPicker = new picker.PhotoViewPicker(); + photoPicker.select(PhotoSelectOptions, (err, PhotoSelectResult) => { + if (err) { + console.error('PhotoViewPicker.select failed with err: ' + err); + return; + } + console.info('PhotoViewPicker.select successfully, PhotoSelectResult uri: ' + JSON.stringify(PhotoSelectResult)); + }); + } catch (err) { + console.error('PhotoViewPicker failed with err: ' + err); + } +} +``` + +### select + +select(callback: AsyncCallback<PhotoSelectResult>) : void + +Selects one or more images or videos in a **photoPicker** page. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------- | ---- | -------------------------- | +| callback | AsyncCallback<[PhotoSelectResult](#photoselectresult)> | Yes | Callback invoked to return information about the images or videos selected.| + +**Example** + +```ts +async function example() { + try { + let photoPicker = new picker.PhotoViewPicker(); + photoPicker.select((err, PhotoSelectResult) => { + if (err) { + console.error('PhotoViewPicker.select failed with err: ' + err); + return; + } + console.info('PhotoViewPicker.select successfully, PhotoSelectResult uri: ' + JSON.stringify(PhotoSelectResult)); + }); + } catch (err) { + console.error('PhotoViewPicker failed with err: ' + err); + } +} +``` + +### save + +save(option?: PhotoSaveOptions) : Promise<Array<string>> + +Saves one or more images or videos in a **photoPicker** page. This API uses a promise to return the result. You can pass in **PhotoSaveOptions** to specify the file names of the images or videos to save. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------- | ---- | -------------------------- | +| option | [PhotoSaveOptions](#photosaveoptions) | No | Options for saving images or videos.| + +**Return value** + +| Type | Description | +| ----------------------------- | :---- | +| Promise<Array<string>> | Promise used to return the URIs of the files saved.| + +**Example** + +```ts +async function example() { + try { + let PhotoSaveOptions = new picker.PhotoSaveOptions(); + PhotoSaveOptions.newFileNames = ['PhotoViewPicker01.jpg', 'PhotoViewPicker01.mp4']; + let photoPicker = new picker.PhotoViewPicker(); + photoPicker.save(PhotoSaveOptions).then((PhotoSaveResult) => { + console.info('PhotoViewPicker.save successfully, PhotoSaveResult uri: ' + JSON.stringify(PhotoSaveResult)); + }).catch((err) => { + console.error('PhotoViewPicker.save failed with err: ' + err); + }); + } catch (err) { + console.error('PhotoViewPicker failed with err: ' + err); + } +} +``` + +### save + +save(option: PhotoSaveOptions, callback: AsyncCallback<Array<string>>) : void + +Saves one or more images or videos in a **photoPicker** page. This API uses an asynchronous callback to return the result. You can pass in **PhotoSaveOptions** to specify the file names of the images or videos to save. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------- | ---- | -------------------------- | +| option | [PhotoSaveOptions](#photosaveoptions) | Yes | Options for saving images or videos.| +| callback | AsyncCallback<Array<string>> | Yes | Callback invoked to return the URIs of the files saved.| + +**Example** + +```ts +async function example() { + try { + let PhotoSaveOptions = new picker.PhotoSaveOptions(); + PhotoSaveOptions.newFileNames = ['PhotoViewPicker02.jpg','PhotoViewPicker02.mp4']; + let photoPicker = new picker.PhotoViewPicker(); + photoPicker.save(PhotoSaveOptions, (err, PhotoSaveResult) => { + if (err) { + console.error('PhotoViewPicker.save failed with err: ' + err); + return; + } + console.info('PhotoViewPicker.save successfully, PhotoSaveResult uri: ' + JSON.stringify(PhotoSaveResult)); + }); + } catch (err) { + console.error('PhotoViewPicker failed with err: ' + err); + } +} +``` + +### save + +save(callback: AsyncCallback<Array<string>>) : void + +Saves one or more images or videos in a **photoPicker** page. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------- | ---- | -------------------------- | +| callback | AsyncCallback<Array<string>> | Yes | Callback invoked to return the URIs of the files saved.| + +**Example** + +```ts +async function example() { + try { + let photoPicker = new picker.PhotoViewPicker(); + photoPicker.save((err, PhotoSaveResult) => { + if (err) { + console.error('PhotoViewPicker.save failed with err: ' + err); + return; + } + console.info('PhotoViewPicker.save successfully, PhotoSaveResult uri: ' + JSON.stringify(PhotoSaveResult)); + }); + } catch (err) { + console.error('PhotoViewPicker failed with err: ' + err); + } +} +``` + +## DocumentViewPicker + +Provides APIs for selecting and saving non-media files, for example, documents in a variety of formats. Before using the APIs of **DocumentViewPicker**, you need to create a **DocumentViewPicker** instance. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Example** + +```ts +let documentPicker = new picker.DocumentViewPicker(); +``` + +### select + +select(option?: DocumentSelectOptions) : Promise<Array<string>> + +Selects one or more documents in a **documentPicker** page. This API uses a promise to return the result. You can pass in **DocumentSelectOptions**. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------- | ---- | -------------------------- | +| option | [DocumentSelectOptions](#documentselectoptions) | No | Options for selecting documents.| + +**Return value** + +| Type | Description | +| ----------------------------- | :---- | +| Promise<Array<string>> | Promise used to return the URIs of the documents selected.| + +**Example** + +```ts +async function example() { + try { + let DocumentSelectOptions = new picker.DocumentSelectOptions(); + let documentPicker = new picker.DocumentViewPicker(); + documentPicker.select(DocumentSelectOptions).then((DocumentSelectResult) => { + console.info('DocumentViewPicker.select successfully, DocumentSelectResult uri: ' + JSON.stringify(DocumentSelectResult)); + }).catch((err) => { + console.error('DocumentViewPicker.select failed with err: ' + err); + }); + } catch (err) { + console.error('DocumentViewPicker failed with err: ' + err); + } +} +``` + +### select + +select(option: DocumentSelectOptions, callback: AsyncCallback<Array<string>>) : void + +Selects one or more documents in a **documentPicker** page. This API uses an asynchronous callback to return the result. You can pass in **DocumentSelectOptions**. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------- | ---- | -------------------------- | +| option | [DocumentSelectOptions](#documentselectoptions) | Yes | Options for selecting documents.| +| callback | AsyncCallback<Array<string>> | Yes | Callback invoked to return the URIs of the documents selected.| + +**Example** + +```ts +async function example() { + try { + let DocumentSelectOptions = new picker.DocumentSelectOptions(); + let documentPicker = new picker.DocumentViewPicker(); + documentPicker.select(DocumentSelectOptions, (err, DocumentSelectResult) => { + if (err) { + console.error('DocumentViewPicker.select failed with err: ' + err); + return; + } + console.info('DocumentViewPicker.select successfully, DocumentSelectResult uri: ' + JSON.stringify(DocumentSelectResult)); + }); + } catch (err) { + console.error('DocumentViewPicker failed with err: ' + err); + } +} +``` + +### select + +select(callback: AsyncCallback<Array<string>>) : void + +Selects one or more documents in a **documentPicker** page. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------- | ---- | -------------------------- | +| callback | AsyncCallback<Array<string>> | Yes | Callback invoked to return the URIs of the documents selected.| + +**Example** + +```ts +async function example() { + try { + let documentPicker = new picker.DocumentViewPicker(); + documentPicker.select((err, DocumentSelectResult) => { + if (err) { + console.error('DocumentViewPicker.select failed with err: ' + err); + return; + } + console.info('DocumentViewPicker.select successfully, DocumentSelectResult uri: ' + JSON.stringify(DocumentSelectResult)); + }); + } catch (err) { + console.error('DocumentViewPicker failed with err: ' + err); + } +} +``` + + +### save + +save(option?: DocumentSaveOptions) : Promise<Array<string>> + +Saves one or more documents in a **documentPicker** page. This API uses a promise to return the result. You can pass in **DocumentSaveOptions** to specify the file names to save. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------- | ---- | -------------------------- | +| option | [DocumentSaveOptions](#documentsaveoptions) | No | Options for saving the documents.| + +**Return value** + +| Type | Description | +| ----------------------------- | :---- | +| Promise<Array<string>> | Promise used to return the URIs of the documents saved.| + +**Example** + +```ts +async function example() { + try { + let DocumentSaveOptions = new picker.DocumentSaveOptions(); + DocumentSaveOptions.newFileNames = ['DocumentViewPicker01.txt']; + let documentPicker = new picker.DocumentViewPicker(); + documentPicker.save(DocumentSaveOptions).then((DocumentSaveResult) => { + console.info('DocumentViewPicker.save successfully, DocumentSaveResult uri: ' + JSON.stringify(DocumentSaveResult)); + }).catch((err) => { + console.error('DocumentViewPicker.save failed with err: ' + err); + }); + } catch (err) { + console.error('DocumentViewPicker failed with err: ' + err); + } +} +``` + +### save + +save(option: DocumentSaveOptions, callback: AsyncCallback<Array<string>>) : void + +Saves one or more documents in a **documentPicker** page. This API uses an asynchronous callback to return the result. You can pass in **DocumentSaveOptions** to specify the file names to save. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------- | ---- | -------------------------- | +| option | [DocumentSaveOptions](#documentsaveoptions) | Yes | Options for saving the documents.| +| callback | AsyncCallback<Array<string>> | Yes | Callback invoked to return the URIs of the documents saved.| + +**Example** + +```ts +async function example() { + try { + let DocumentSaveOptions = new picker.DocumentSaveOptions(); + DocumentSaveOptions.newFileNames = ['DocumentViewPicker02.txt']; + let documentPicker = new picker.DocumentViewPicker(); + documentPicker.save(DocumentSaveOptions, (err, DocumentSaveResult) => { + if (err) { + console.error('DocumentViewPicker.save failed with err: ' + err); + return; + } + console.info('DocumentViewPicker.save successfully, DocumentSaveResult uri: ' + JSON.stringify(DocumentSaveResult)); + }); + } catch (err) { + console.error('DocumentViewPicker failed with err: ' + err); + } +} +``` + +### save + +save(callback: AsyncCallback<Array<string>>) : void + +Saves one or more documents in a **documentPicker** page. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------- | ---- | -------------------------- | +| callback | AsyncCallback<Array<string>> | Yes | Callback invoked to return the URIs of the documents saved.| + +**Example** + +```ts +async function example() { + try { + let documentPicker = new picker.DocumentViewPicker(); + documentPicker.save((err, DocumentSaveResult) => { + if (err) { + console.error('DocumentViewPicker.save failed with err: ' + err); + return; + } + console.info('DocumentViewPicker.save successfully, DocumentSaveResult uri: ' + JSON.stringify(DocumentSaveResult)); + }); + } catch (err) { + console.error('DocumentViewPicker failed with err: ' + err); + } +} +``` + +## AudioViewPicker + +Provides APIs for selecting and saving audio files. Before using the APIs of **AudioViewPicker**, you need to create an **AudioViewPicker** instance. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Example** + +```ts +let audioPicker = new picker.AudioViewPicker(); +``` + +### select + +select(option?: AudioSelectOptions) : Promise<Array<string>> + +Selects one or more audio files in an **audioPicker** page (currently, a **documentPicker** page is displayed). This API uses a promise to return the result. You can pass in **AudioSelectOptions**. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------- | ---- | -------------------------- | +| option | [AudioSelectOptions](#audioselectoptions) | No | Options for selecting audio files.| + +**Return value** + +| Type | Description | +| ----------------------------- | :---- | +| Promise<Array<string>> | Promise used to return the URIs of the audio files selected.| + +**Example** + +```ts +async function example() { + try { + let AudioSelectOptions = new picker.AudioSelectOptions(); + let audioPicker = new picker.AudioViewPicker(); + audioPicker.select(AudioSelectOptions).then((AudioSelectResult) => { + console.info('AudioViewPicker.select successfully, AudioSelectResult uri: ' + JSON.stringify(AudioSelectResult)); + }).catch((err) => { + console.error('AudioViewPicker.select failed with err: ' + err); + }); + } catch (err) { + console.error('AudioViewPicker failed with err: ' + err); + } +} +``` + +### select + +select(option: AudioSelectOptions, callback: AsyncCallback<Array<string>>) : void + +Selects one or more audio files in an **audioPicker** page (currently, a **documentPicker** page is displayed). This API uses an asynchronous callback to return the result. You can pass in **AudioSelectOptions**. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------- | ---- | -------------------------- | +| option | [AudioSelectOptions](#audioselectoptions) | Yes | Options for selecting audio files.| +| callback | AsyncCallback<Array<string>> | Yes | Callback invoked to return the URIs of the audio files selected.| + +**Example** + +```ts +async function example() { + try { + let AudioSelectOptions = new picker.AudioSelectOptions(); + let audioPicker = new picker.AudioViewPicker(); + audioPicker.select(AudioSelectOptions, (err, AudioSelectResult) => { + if (err) { + console.error('AudioViewPicker.select failed with err: ' + err); + return; + } + console.info('AudioViewPicker.select successfully, AudioSelectResult uri: ' + JSON.stringify(AudioSelectResult)); + }); + } catch (err) { + console.error('AudioViewPicker failed with err: ' + err); + } +} +``` + +### select + +select(callback: AsyncCallback<Array<string>>) : void + +Selects one or more audio files in an **audioPicker** page (currently, a **documentPicker** page is displayed). This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------- | ---- | -------------------------- | +| callback | AsyncCallback<Array<string>> | Yes | Callback invoked to return the URIs of the audio files selected.| + +**Example** + +```ts +async function example() { + try { + let audioPicker = new picker.AudioViewPicker(); + audioPicker.select((err, AudioSelectResult) => { + if (err) { + console.error('AudioViewPicker.select failed with err: ' + err); + return; + } + console.info('AudioViewPicker.select successfully, AudioSelectResult uri: ' + JSON.stringify(AudioSelectResult)); + }); + } catch (err) { + console.error('AudioViewPicker failed with err: ' + err); + } +} +``` + +### save + +save(option?: AudioSaveOptions) : Promise<Array<string>> + +Saves one or more audio files in an **audioPicker** page (currently, a **documentPicker** page is displayed). This API uses a promise to return the result. You can pass in **AudioSaveOptions** to specify the file names of the audio clips to save. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------- | ---- | -------------------------- | +| option | [AudioSaveOptions](#audiosaveoptions) | No | Options for saving audio files.| + +**Return value** + +| Type | Description | +| ----------------------------- | ---- | +| Promise<Array<string>> | Promise used to return the URIs of the audio files saved.| + +**Example** + +```ts +async function example() { + try { + let AudioSaveOptions = new picker.AudioSaveOptions(); + AudioSaveOptions.newFileNames = ['AudioViewPicker01.mp3']; + let audioPicker = new picker.AudioViewPicker(); + audioPicker.save(AudioSaveOptions).then((AudioSaveResult) => { + console.info('AudioViewPicker.save successfully, AudioSaveResult uri: ' + JSON.stringify(AudioSaveResult)) + }).catch((err) => { + console.error('AudioViewPicker.save failed with err: ' + err); + }); + } catch (err) { + console.error('AudioViewPicker failed with err: ' + err); + } +} +``` + +### save + +save(option: AudioSaveOptions, callback: AsyncCallback<Array<string>>) : void + +Saves one or more audio files in an **audioPicker** page (currently, a **documentPicker** page is displayed). This API uses an asynchronous callback to return the result. You can pass in **AudioSaveOptions** to specify the file names of the audio clips to save. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------- | ---- | -------------------------- | +| option | [AudioSaveOptions](#audiosaveoptions) | Yes | Options for saving audio files.| +| callback | AsyncCallback<Array<string>> | Yes | Callback invoked to return the URIs of the audio files saved.| + +**Example** + +```ts +async function example() { + try { + let AudioSaveOptions = new picker.AudioSaveOptions(); + AudioSaveOptions.newFileNames = ['AudioViewPicker02.mp3']; + let audioPicker = new picker.AudioViewPicker(); + audioPicker.save(AudioSaveOptions, (err, AudioSaveResult) => { + if (err) { + console.error('AudioViewPicker.save failed with err: ' + err); + return; + } + console.info('AudioViewPicker.save successfully, AudioSaveResult uri: ' + JSON.stringify(AudioSaveResult)); + }); + } catch (err) { + console.error('AudioViewPicker failed with err: ' + err); + } +} +``` + +### save + +save(callback: AsyncCallback<Array<string>>) : void + +Saves one or more audio files in an **audioPicker** page (currently, a **documentPicker** page is displayed). This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------- | ---- | -------------------------- | +| callback | AsyncCallback<Array<string>> | Yes | Callback invoked to return the URIs of the audio files saved.| + +**Example** + +```ts +async function example() { + try { + let audioPicker = new picker.AudioViewPicker(); + audioPicker.save((err, AudioSaveResult) => { + if (err) { + console.error('AudioViewPicker.save failed with err: ' + err); + return; + } + console.info('AudioViewPicker.save successfully, AudioSaveResult uri: ' + JSON.stringify(AudioSaveResult)); + }); + } catch (err) { + console.error('AudioViewPicker failed with err: ' + err); + } +} +``` + +## PhotoViewMIMETypes + +Enumerates the media file types that can be selected. + +**System capability**: SystemCapability.FileManagement.UserFileService + +| Name | Value| Description| +| ----- | ---- | ---- | +| IMAGE_TYPE | 'image/*' | Image.| +| VIDEO_TYPE | 'video/*' | Video.| +| IMAGE_VIDEO_TYPE | '\*/*' | Image and video.| + +## PhotoSelectOptions + +Defines the options for selecting images or videos. + +**System capability**: SystemCapability.FileManagement.UserFileService + +| Name | Type | Mandatory| Description | +| ----------------------- | ------------------- | ---- | -------------------------------- | +| MIMEType? | [PhotoViewMIMETypes](#photoviewmimetypes) | No | Media file types to select.| +| maxSelectNumber? | number | No | Maximum number of media files to select. The default value is **50**, and the maximum value is **500**. | + +## PhotoSelectResult + +Defines information about the images or videos selected. + +**System capability**: SystemCapability.FileManagement.UserFileService + +| Name | Type | Readable| Writable| Description | +| ----------------------- | ------------------- | ---- | ---- | ------------------------------ | +| photoUris | Array<string> | Yes | Yes | URIs of the media files selected.| +| isOriginalPhoto | boolean | Yes | Yes | Whether the selected media file is the original image.| + +## PhotoSaveOptions + +Defines the options for saving images or videos. + +**System capability**: SystemCapability.FileManagement.UserFileService + +| Name | Type | Mandatory| Description | +| ----------------------- | ------------------- | ---- | ---------------------------- | +| newFileNames? | Array<string> | No | Files names of the images or videos to save.| + +## DocumentSelectOptions + +Defines the options for selecting documents. Currently, this parameter cannot be configured. + +**System capability**: SystemCapability.FileManagement.UserFileService + +## DocumentSaveOptions + +Defines the options for saving documents. + +**System capability**: SystemCapability.FileManagement.UserFileService + +| Name | Type | Mandatory| Description | +| ----------------------- | ------------------- | ---- | ---------------------------- | +| newFileNames? | Array<string> | No | File names of the documents to save.| + +## AudioSelectOptions + +Defines the options for selecting audio clips. Currently, this parameter cannot be configured. + +**System capability**: SystemCapability.FileManagement.UserFileService + +## AudioSaveOptions + +Defines the options for saving audio files. + +**System capability**: SystemCapability.FileManagement.UserFileService + +| Name | Type | Mandatory| Description | +| ----------------------- | ------------------- | ---- | ---------------------------- | +| newFileNames? | Array<string> | No | File names of the audio clips to save.| diff --git a/en/application-dev/reference/apis/js-apis-file-securityLabel.md b/en/application-dev/reference/apis/js-apis-file-securityLabel.md index b9071ecc64025491ed21e55490f4753b83440eb1..c564516e66c0119dbec070c4a9eab744350d130f 100644 --- a/en/application-dev/reference/apis/js-apis-file-securityLabel.md +++ b/en/application-dev/reference/apis/js-apis-file-securityLabel.md @@ -5,7 +5,7 @@ The **securityLabel** module provides APIs for managing data security levels of > **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 support processing of error codes. For details, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md). +> - The APIs of this module support processing of error codes. For details, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md). ## Modules to Import @@ -45,7 +45,7 @@ For details about how to obtain the FA model context, see [Context](js-apis-inne ## securityLabel.setSecurityLabel -setSecurityLabel(path:string, type:dataLevel):Promise<void> +setSecurityLabel(path:string, type:DataLevel):Promise<void> Sets a security label for a file in asynchronous mode. This API uses a promise to return the result. @@ -56,7 +56,7 @@ Sets a security label for a file in asynchronous mode. This API uses a promise t | Name | Type | Mandatory| Description | | --------- | ------ | ---- | -------------------------------------------- | | path | string | Yes | Path of the target file. | -| type | dataLevel | Yes | File security level to set, which can be **s0**, **s1**, **s2**, **s3**, or **s4**.| +| type | DataLevel | Yes | File security level to set, which can be **s0**, **s1**, **s2**, **s3**, or **s4**.| **Return value** @@ -67,7 +67,8 @@ Sets a security label for a file in asynchronous mode. This API uses a promise t **Example** ```js - securityLabel.setSecurityLabel(path, "s0").then(() => { + let filePath = pathDir + '/test.txt'; + securityLabel.setSecurityLabel(filePath, "s0").then(() => { console.info("setSecurityLabel successfully"); }).catch((err) => { console.info("setSecurityLabel failed with error message: " + err.message + ", error code: " + err.code); @@ -76,7 +77,7 @@ Sets a security label for a file in asynchronous mode. This API uses a promise t ## securityLabel.setSecurityLabel -setSecurityLabel(path:string, type:dataLevel, callback: AsyncCallback<void>):void +setSecurityLabel(path:string, type:DataLevel, callback: AsyncCallback<void>):void Sets a security label for a file in asynchronous mode. This API uses an asynchronous callback to return the result. @@ -87,13 +88,14 @@ Sets a security label for a file in asynchronous mode. This API uses an asynchro | Name | Type | Mandatory| Description | | --------- | ------------------------- | ---- | -------------------------------------------- | | path | string | Yes | Path of the target file. | -| type | dataLevel | Yes | File security level to set, which can be **s0**, **s1**, **s2**, **s3**, or **s4**.| +| type | DataLevel | Yes | File security level to set, which can be **s0**, **s1**, **s2**, **s3**, or **s4**.| | callback | AsyncCallback<void> | Yes | Callback invoked to return the result. | **Example** ```js - securityLabel.setSecurityLabel(path, "s0", (err) => { + let filePath = pathDir + '/test.txt'; + securityLabel.setSecurityLabel(filePath, "s0", (err) => { if (err) { console.info("setSecurityLabel failed with error message: " + err.message + ", error code: " + err.code); } else { @@ -104,7 +106,7 @@ Sets a security label for a file in asynchronous mode. This API uses an asynchro ## securityLabel.setSecurityLabelSync -setSecurityLabelSync(path:string, type:dataLevel):void +setSecurityLabelSync(path:string, type:DataLevel):void Sets a security label for a file in synchronous mode. @@ -115,12 +117,13 @@ Sets a security label for a file in synchronous mode. | Name | Type | Mandatory| Description | | --------- | ------ | ---- | -------------------------------------------- | | path | string | Yes | Path of the target file. | -| type | dataLevel | Yes | File security level to set, which can be **s0**, **s1**, **s2**, **s3**, or **s4**.| +| type | DataLevel | Yes | File security level to set, which can be **s0**, **s1**, **s2**, **s3**, or **s4**.| **Example** ```js -securityLabel.setSecurityLabelSync(path, "s0"); +let filePath = pathDir + '/test.txt'; +securityLabel.setSecurityLabelSync(filePath, "s0"); ``` ## securityLabel.getSecurityLabel @@ -146,7 +149,8 @@ Obtains the security label of a file in asynchronous mode. This API uses a promi **Example** ```js - securityLabel.getSecurityLabel(path).then((type) => { + let filePath = pathDir + '/test.txt'; + securityLabel.getSecurityLabel(filePath).then((type) => { console.log("getSecurityLabel successfully, Label: " + type); }).catch((err) => { console.log("getSecurityLabel failed with error message: " + err.message + ", error code: " + err.code); @@ -171,7 +175,8 @@ Obtains the security label of a file in asynchronous mode. This API uses a callb **Example** ```js - securityLabel.getSecurityLabel(path, (err, type) => { + let filePath = pathDir + '/test.txt'; + securityLabel.getSecurityLabel(filePath, (err, type) => { if (err) { console.log("getSecurityLabel failed with error message: " + err.message + ", error code: " + err.code); } else { @@ -202,6 +207,7 @@ Obtains the security label of a file in synchronous mode. **Example** ```js -let type = securityLabel.getSecurityLabelSync(path); +let filePath = pathDir + '/test.txt'; +let type = securityLabel.getSecurityLabelSync(filePath); console.log("getSecurityLabel successfully, Label: " + type); ``` diff --git a/en/application-dev/reference/apis/js-apis-file-statvfs.md b/en/application-dev/reference/apis/js-apis-file-statvfs.md index f431f3cb17d8d82a88a0b9bde7e2a3e3d8e66c86..b7809c5f9f10fa9904ec0f64367ff025e7aafc94 100644 --- a/en/application-dev/reference/apis/js-apis-file-statvfs.md +++ b/en/application-dev/reference/apis/js-apis-file-statvfs.md @@ -22,15 +22,15 @@ Obtains the number of free bytes of the specified file system in asynchronous mo **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ---------------------------- | -| path | string | Yes | File path of the file system.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ---------------------------- | + | path | string | Yes | File path of the file system.| **Return value** -| Type | Description | -| --------------------- | -------------- | -| Promise<number> | Promise used to return the number of free bytes obtained.| + | Type | Description | + | --------------------- | -------------- | + | Promise<number> | Promise used to return the number of free bytes obtained.| **Example** @@ -53,10 +53,10 @@ Obtains the number of free bytes of the specified file system in asynchronous mo **Parameters** -| Name | Type | Mandatory| Description | -| -------- | --------------------------- | ---- | ---------------------------- | -| path | string | Yes | File path of the file system.| -| callback | AsyncCallback<number> | Yes | Callback invoked to return the number of free bytes obtained.| + | Name | Type | Mandatory| Description | + | -------- | --------------------------- | ---- | ---------------------------- | + | path | string | Yes | File path of the file system.| + | callback | AsyncCallback<number> | Yes | Callback invoked to return the number of free bytes obtained.| **Example** @@ -81,15 +81,15 @@ Obtains the total number of bytes of the specified file system in asynchronous m **Parameters** -| Name| Type | Mandatory| Description | -| ---- | ------ | ---- | ---------------------------- | -| path | string | Yes | File path of the file system.| + | Name| Type | Mandatory| Description | + | ---- | ------ | ---- | ---------------------------- | + | path | string | Yes | File path of the file system.| **Return value** -| Type | Description | -| --------------------- | ------------ | -| Promise<number> | Promise used to return the total number of bytes obtained.| + | Type | Description | + | --------------------- | ------------ | + | Promise<number> | Promise used to return the total number of bytes obtained.| **Example** @@ -112,10 +112,10 @@ Obtains the total number of bytes of the specified file system in asynchronous m **Parameters** -| Name | Type | Mandatory| Description | -| -------- | --------------------------- | ---- | ---------------------------- | -| path | string | Yes | File path of the file system.| -| callback | AsyncCallback<number> | Yes | Callback invoked to return the total number of bytes obtained. | + | Name | Type | Mandatory| Description | + | -------- | --------------------------- | ---- | ---------------------------- | + | path | string | Yes | File path of the file system.| + | callback | AsyncCallback<number> | Yes | Callback invoked to return the total number of bytes obtained. | **Example** diff --git a/en/application-dev/reference/apis/js-apis-file-storage-statistics.md b/en/application-dev/reference/apis/js-apis-file-storage-statistics.md index 834bf7bcbdd703786d9bb43db8fe0b61956fdd52..716e0da462bf4e59d0cd969deb561e0adc23a351 100644 --- a/en/application-dev/reference/apis/js-apis-file-storage-statistics.md +++ b/en/application-dev/reference/apis/js-apis-file-storage-statistics.md @@ -22,8 +22,7 @@ Obtains the total size (in bytes) of the specified volume in an external storage **System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics - -This is a system API. +**System API**: This is a system API. **Parameters** @@ -59,8 +58,7 @@ Obtains the total size (in bytes) of the specified volume in an external storage **System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics - -This is a system API. +**System API**: This is a system API. **Parameters** @@ -90,8 +88,7 @@ Obtains the available space (in bytes) of the specified volume in an external st **System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics - -This is a system API. +**System API**: This is a system API. **Parameters** @@ -128,8 +125,7 @@ Obtains the available space (in bytes) of the specified volume in an external st **System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics - -This is a system API. +**System API**: This is a system API. **Parameters** @@ -159,8 +155,7 @@ Obtains the space (in bytes) of an application. This API uses a promise to retur **System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics - -This is a system API. +**System API**: This is a system API. **Parameters** @@ -196,8 +191,7 @@ Obtains the space (in bytes) of an application. This API uses an asynchronous ca **System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics - -This is a system API. +**System API**: This is a system API. **Parameters** @@ -263,12 +257,8 @@ Obtains the space (in bytes) of this third-party application. This API uses an a ## BundleStats9+ -### Attributes - **System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics - - | Name | Type | Readable| Writable| Description | | --------- | ------ | --- | ---- | -------------- | | appSize | number | Yes| No| Size of the application, in bytes. | @@ -286,9 +276,7 @@ Obtains the total size (in bytes) of the built-in storage. This API uses a promi **System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics - -This is a system API. - +**System API**: This is a system API. **Return value** @@ -313,9 +301,7 @@ Obtains the total size (in bytes) of the built-in storage. This API uses an asyn **System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics - -This is a system API. - +**System API**: This is a system API. **Parameters** @@ -343,9 +329,7 @@ Obtains the available space (in bytes) of the built-in storage. This API uses a **System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics - -This is a system API. - +**System API**: This is a system API. **Return value** @@ -371,9 +355,7 @@ Obtains the available space (in bytes) of the built-in storage. This API uses an **System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics - -This is a system API. - +**System API**: This is a system API. **Parameters** @@ -400,8 +382,7 @@ Obtains the system data space, in bytes. This API uses a promise to return the r **System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics - -This is a system API. +**System API**: This is a system API. **Return value** @@ -430,9 +411,7 @@ Obtains the system data space, in bytes. This API uses an asynchronous callback **System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics - -This is a system API. - +**System API**: This is a system API. **Parameters** @@ -459,9 +438,7 @@ Obtains the storage statistics (in bytes) of this user. This API uses a promise **System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics - -This is a system API. - +**System API**: This is a system API. **Return value** @@ -489,9 +466,7 @@ Obtains the storage statistics (in bytes) of this user. This API uses an asynchr **System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics - -This is a system API. - +**System API**: This is a system API. **Parameters** @@ -515,9 +490,7 @@ Obtains the storage statistics (in bytes) of the specified user. This API uses a **System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics - -This is a system API. - +**System API**: This is a system API. **Parameters** @@ -552,9 +525,7 @@ Obtains the storage statistics (in bytes) of the specified user. This API uses a **System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics - -This is a system API. - +**System API**: This is a system API. **Parameters** @@ -576,12 +547,9 @@ This is a system API. ## StorageStats9+ -### Attributes - **System capability**: SystemCapability.FileManagement.StorageService.SpatialStatistics - -This is a system API. +**System API**: This is a system API. | Name | Type | Readable | Writable | Description | | --------- | ------ | ---- | ----- | -------------- | diff --git a/en/application-dev/reference/apis/js-apis-file-volumemanager.md b/en/application-dev/reference/apis/js-apis-file-volumemanager.md index bf1e5c9c417ecc5940e75d4876def5ffd7b4b210..c2628ce063d93233af5ee6f6641a422e1a163c37 100644 --- a/en/application-dev/reference/apis/js-apis-file-volumemanager.md +++ b/en/application-dev/reference/apis/js-apis-file-volumemanager.md @@ -1,6 +1,6 @@ -# @ohos.file.volumeManager (Volument Management) +# @ohos.file.volumeManager (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. +The **volumeManager** module provides APIs for volume and disk management, including obtaining volume information, mounting or unmounting a volume, partitioning a disk, and formatting a volume. > **NOTE** > @@ -18,7 +18,7 @@ import volumemanager from "@ohos.file.volumeManager"; getAllVolumes(): Promise<Array<Volume>> -Asynchronously obtains information about all available volumes. This API uses a promise to return the result. +Obtains information about all volumes of this external storage device. This API uses a promise to return the result. **Required permissions**: ohos.permission.STORAGE_MANAGER @@ -26,15 +26,17 @@ Asynchronously obtains information about all available volumes. This API uses a **Return value** - | Type | Description | - | ---------------------------------- | -------------------------- | - | Promise<[Volume](#volume)[]> | Promise used to return the execution result.| +| Type | Description | +| ---------------------------------- | -------------------------- | +| Promise<[Volume](#volume)[]> | Promise used to return information about all available volumes.| **Example** ```js volumemanager.getAllVolumes().then(function(volumes){ // Do something. + }).catch(function(error){ + console.info("getAllVolumes failed"); }); ``` @@ -42,7 +44,7 @@ Asynchronously obtains information about all available volumes. This API uses a getAllVolumes(callback: AsyncCallback<Array<Volume>>): void -Asynchronously obtains information about all available volumes. This API uses a callback to return the result. +Obtains information about all volumes of this external storage device. This API uses an asynchronous callback to return the result. **Required permissions**: ohos.permission.STORAGE_MANAGER @@ -50,9 +52,9 @@ Asynchronously obtains information about all available volumes. This API uses a **Parameters** - | Name | Type | Mandatory| Description | - | -------- | ------------------------------------------------- | ---- | ------------------------------------ | - | callback | AsyncCallback<[Volume](#volume)[]> | Yes | Callback invoked to return the volume information obtained.| +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------- | ---- | ------------------------------------ | +| callback | AsyncCallback<[Volume](#volume)[]> | Yes | Callback invoked to return information about all available volumes.| **Example** @@ -68,7 +70,7 @@ Asynchronously obtains information about all available volumes. This API uses a mount(volumeId: string): Promise<void> -Asynchronously mounts a volume. This API uses a promise to return the result. +Asynchronously mounts a volume. This API uses a promise to return the result. Currently, only the File Allocation Table (FAT), Extensible FAT (exFAT), and New Technology File System (NTFS) file systems are supported. **Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER @@ -76,22 +78,24 @@ Asynchronously mounts a volume. This API uses a promise to return the result. **Parameters** - | Name | Type | Mandatory| Description| - | -------- | ------ | ---- | ---- | - | volumeId | string | Yes | Volume ID.| +| Name | Type | Mandatory| Description| +| -------- | ------ | ---- | ---- | +| volumeId | string | Yes | Volume ID.| **Return value** - | Type | Description | - | ---------------------- | ---------- | - | Promise<void> | Promise used to return the result.| +| Type | Description | +| ---------------------- | ---------- | +| Promise<void> | Promise that returns no value.| **Example** ```js let volumeId = ""; - volumemanager.mount(volumeId).then(function(flag){ - // Do something + volumemanager.mount(volumeId).then(function(){ + // Do something. + }).catch(function(error){ + console.info("mount failed"); }); ``` @@ -99,7 +103,7 @@ Asynchronously mounts a volume. This API uses a promise to return the result. mount(volumeId: string, callback:AsyncCallback<void>):void -Asynchronously obtains the available space of the specified volume. This API uses a callback to return the result. +Asynchronously mounts a volume. This API uses an asynchronous callback to return the result. Currently, only the FAT, exFAT, and NTFS file systems are supported. **Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER @@ -107,17 +111,17 @@ Asynchronously obtains the available space of the specified volume. This API use **Parameters** - | Name | Type | Mandatory| Description | - | -------- | ------------------------------------- | ---- | -------------------- | - | volumeId | string | Yes | Volume ID. | - | callback | AsyncCallback<void> | Yes | Callback invoked to return the result.| +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------- | ---- | -------------------- | +| volumeId | string | Yes | Volume ID. | +| callback | AsyncCallback<void> | Yes | Callback that returns no value.| **Example** ```js let volumeId = ""; - volumemanager.mount(volumeId, function(error, flag){ - // Do something + volumemanager.mount(volumeId, function(error){ + // Do something. }); ``` @@ -133,22 +137,24 @@ Asynchronously unmounts a volume. This API uses a promise to return the result. **Parameters** - | Name | Type | Mandatory| Description| - | -------- | ------ | ---- | ---- | - | volumeId | string | Yes | Volume ID.| +| Name | Type | Mandatory| Description| +| -------- | ------ | ---- | ---- | +| volumeId | string | Yes | Volume ID.| **Return value** - | Type | Description | - | ---------------------- | ---------- | - | Promise<void> | Promise used to return the result.| +| Type | Description | +| ---------------------- | ---------- | +| Promise<void> | Promise that returns no value.| **Example** ```js let volumeId = ""; - volumemanager.unmount(volumeId).then(function(flag){ - // Do something + volumemanager.unmount(volumeId).then(function(){ + // Do something. + }).catch(function(error){ + console.info("mount failed"); }); ``` @@ -156,7 +162,7 @@ Asynchronously unmounts a volume. This API uses a promise to return the result. unmount(volumeId: string, callback: AsyncCallback<void>): void -Asynchronously unmounts a volume. This API uses a callback to return the result. +Asynchronously unmounts a volume. This API uses an asynchronous callback to return the result. **Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER @@ -164,17 +170,17 @@ Asynchronously unmounts a volume. This API uses a callback to return the result. **Parameters** - | Name | Type | Mandatory| Description | - | -------- | ------------------------------------- | ---- | -------------------- | - | volumeId | string | Yes | Volume ID. | - | callback | AsyncCallback<void> | Yes | Callback invoked to return the result.| +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------- | ---- | -------------------- | +| volumeId | string | Yes | Volume ID. | +| callback | AsyncCallback<void> | Yes | Callback that returns no value.| **Example** ```js let volumeId = ""; - volumemanager.unmount(volumeId, function(error, flag){ - // Do something + volumemanager.unmount(volumeId, function(error){ + // Do something. }); ``` @@ -182,7 +188,7 @@ Asynchronously unmounts a volume. This API uses a callback to return the result. 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. +Obtains information about a volume based on the universally unique identifier (UUID). This API uses a promise to return the result. **Required permissions**: ohos.permission.STORAGE_MANAGER @@ -190,15 +196,15 @@ Asynchronously obtains volume information based on the universally unique identi **Parameters** - | Name | Type | Mandatory| Description| - | -------- | ------ | ---- | ---- | - | uuid | string | Yes | UUID of the volume.| +| 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.| +| Type | Description | +| ---------------------------------- | -------------------------- | +| Promise<[Volume](#volume)> | Promise used to return the volume information obtained.| **Example** @@ -215,7 +221,7 @@ Asynchronously obtains volume information based on the universally unique identi getVolumeByUuid(uuid: string, callback: AsyncCallback<Volume>): void -Asynchronously obtains volume information based on the UUID. This API uses a callback to return the result. +Obtains information about a volume based on the UUID. This API uses an asynchronous callback to return the result. **Required permissions**: ohos.permission.STORAGE_MANAGER @@ -223,10 +229,10 @@ Asynchronously obtains volume information based on the UUID. This API uses a cal **Parameters** - | Name | Type | Mandatory| Description | - | -------- | ------------------------------------------------ | ---- | -------------------- | - | uuid | string | Yes | UUID of the volume. | - | callback | AsyncCallback<[Volume](#volume)> | Yes | Callback invoked to return the volume information obtained.| +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------ | ---- | -------------------- | +| uuid | string | Yes | UUID of the volume. | +| callback | AsyncCallback<[Volume](#volume)> | Yes | Callback invoked to return the volume information obtained.| **Example** @@ -241,7 +247,7 @@ Asynchronously obtains volume information based on the UUID. This API uses a cal getVolumeById(volumeId: string): Promise<Volume> -Asynchronously obtains volume information based on the volume ID. This API uses a promise to return the result. +Obtains information about a volume based on the volume ID. This API uses a promise to return the result. **Required permissions**: ohos.permission.STORAGE_MANAGER @@ -249,15 +255,15 @@ Asynchronously obtains volume information based on the volume ID. This API uses **Parameters** - | Name | Type | Mandatory | Description| - | -------- | ------ | ---- | ---- | - | volumeId | string | Yes | Volume ID.| +| Name | Type | Mandatory | Description| +| -------- | ------ | ---- | ---- | +| volumeId | string | Yes | Volume ID.| **Return value** - | Type | Description | - | ---------------------------------- | -------------------------- | - | Promise<[Volume](#volume)> | Promise used to return the volume information obtained.| +| Type | Description | +| ---------------------------------- | -------------------------- | +| Promise<[Volume](#volume)> | Promise used to return the volume information obtained.| **Example** @@ -274,7 +280,7 @@ Asynchronously obtains volume information based on the volume ID. This API uses getVolumeById(volumeId: string, callback: AsyncCallback<Volume>): void -Asynchronously obtains volume information based on the volume ID. This API uses a callback to return the result. +Obtains information about a volume based on the volume ID. This API uses an asynchronous callback to return the result. **Required permissions**: ohos.permission.STORAGE_MANAGER @@ -282,10 +288,10 @@ Asynchronously obtains volume information based on the volume ID. This API uses **Parameters** - | Name | Type | Mandatory| Description | - | -------- | ------------------------- | ---- | ----------------------------- | - | volumeId | string | Yes | Volume ID. | - | callback | AsyncCallback<[Volume](#volume)> | Yes | Callback invoked to return the volume information obtained. | +| Name | Type | Mandatory| Description | +| -------- | ------------------------- | ---- | ----------------------------- | +| volumeId | string | Yes | Volume ID. | +| callback | AsyncCallback<[Volume](#volume)> | Yes | Callback invoked to return the volume information obtained. | **Example** @@ -300,7 +306,7 @@ Asynchronously obtains volume information based on the volume ID. This API uses 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. +Sets volume description. This API uses a promise to return the result. **Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER @@ -308,16 +314,16 @@ Asynchronously sets the volume description based on the UUID. This API uses a pr **Parameters** - | Name | Type | Mandatory| Description| - | --------- | ------ | ---- | ---- | - | uuid | string | Yes | UUID of the volume.| - | description | string | Yes | Volume description.| +| Name | Type | Mandatory| Description| +| --------- | ------ | ---- | ---- | +| uuid | string | Yes | UUID of the volume.| +| description | string | Yes | Volume description to set.| **Return value** - | Type | Description | - | ---------------------- | -------------------------- | - | Promise<void> | Promise used to return the result. | +| Type | Description | +| ---------------------- | -------------------------- | +| Promise<void> | Promise that returns no value. | **Example** @@ -335,7 +341,7 @@ Asynchronously sets the volume description based on the UUID. This API uses a pr 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. +Sets volume description. This API uses an asynchronous callback to return the result. **Required permissions**: ohos.permission.MOUNT_UNMOUNT_MANAGER @@ -343,18 +349,18 @@ Asynchronously sets the volume description based on the UUID. This API uses a ca **Parameters** - | Name | Type | Mandatory| Description | - | ---------- | --------------------------------------- | ---- | ---------------- | - | uuid | string | Yes | UUID of the volume. | - | description | string | Yes | Volume description. | - | callback | AsyncCallback<void> | Yes | Callback invoked to return the result.| +| Name | Type | Mandatory| Description | +| ---------- | --------------------------------------- | ---- | ---------------- | +| uuid | string | Yes | UUID of the volume. | +| description | string | Yes | Volume description to set. | +| callback | AsyncCallback<void> | Yes | Callback that returns no value.| **Example** ```js let uuid = ""; let description = ""; - volumemanager.setVolumeDescription(uuid, description, (error, bool) => { + volumemanager.setVolumeDescription(uuid, description, (error) => { // Do something. }); ``` @@ -363,7 +369,7 @@ Asynchronously sets the volume description based on the UUID. This API uses a ca format(volumeId: string, fsType: string): Promise<void> -Asynchronously formats a volume. This API uses a promise to return the result. +Formats a volume. This API uses a promise to return the result. Currently, only the virtual file allocation table (VFAT) and exFAT file systems are supported. Only unmounted volumes can be formatted. After a volume is formatted, the UUID, mounting path, and description of the volume change. **Required permissions**: ohos.permission.MOUNT_FORMAT_MANAGER @@ -371,16 +377,16 @@ Asynchronously formats a volume. This API uses a promise to return the result. **Parameters** - | Name | Type | Mandatory| Description| - | ----------- | ------ | ---- | ---- | - | volumeId | string | Yes | Volume ID.| - | fsType | string | Yes | File system type.| +| Name | Type | Mandatory| Description| +| ----------- | ------ | ---- | ---- | +| volumeId | string | Yes | Volume ID.| +| fsType | string | Yes | File system type, which can be VFAT or exFAT.| **Return value** - | Type | Description | - | ---------------------- | ---------- | - | Promise<void> | Promise used to return the result.| +| Type | Description | +| ---------------------- | ---------- | +| Promise<void> | Promise that returns no value.| **Example** @@ -398,7 +404,7 @@ Asynchronously formats a volume. This API uses a promise to return the result. format(volumeId: string, fsType: string, callback: AsyncCallback<void>): void -Asynchronously formats a volume. This API uses a callback to return the result. +Formats a volume. This API uses an asynchronous callback to return the result. Currently, only the VFAT and exFAT file systems are supported. Only unmounted volumes can be formatted. After a volume is formatted, the UUID, mounting path, and description of the volume change. **Required permissions**: ohos.permission.MOUNT_FORMAT_MANAGER @@ -406,18 +412,18 @@ Asynchronously formats a volume. This API uses a callback to return the result. **Parameters** - | Name | Type | Mandatory| Description | - | -------- | ------------------------- | ---- | ----------------------------- | - | volumeId | string | Yes | Volume ID. | - | fsType | string | Yes | File system type.| - | callback | AsyncCallback<void> | Yes | Called after the volume is formatted. | +| Name | Type | Mandatory| Description | +| -------- | ------------------------- | ---- | ----------------------------- | +| volumeId | string | Yes | Volume ID. | +| fsType | string | Yes | File system type, which can be VFAT or exFAT.| +| callback | AsyncCallback<void> | Yes | Callback that returns no value. | **Example** ```js let volumeId = ""; let fsType = ""; - volumemanager.format(volumeId, fsType, (error, bool) => { + volumemanager.format(volumeId, fsType, (error) => { // Do something. }); ``` @@ -426,7 +432,7 @@ Asynchronously formats a volume. This API uses a callback to return the result. partition(diskId: string, type: number): Promise<void> -Asynchronously partitions a disk. This API uses a promise to return the result. +Partitions a disk. This API uses a promise to return the result. The system supports access to multi-partition disks. Currently, this API can partition a disk into only one partition. **Required permissions**: ohos.permission.MOUNT_FORMAT_MANAGER @@ -434,16 +440,16 @@ Asynchronously partitions a disk. This API uses a promise to return the result. **Parameters** - | Name | Type | Mandatory| Description| - | ----------- | ------ | ---- | ---- | - | diskId | string | Yes | ID of the disk to which the volume belongs.| - | type | number | Yes | Partition type. | +| Name | Type | Mandatory| Description| +| ----------- | ------ | ---- | ---- | +| diskId | string | Yes | ID of the disk to partition.| +| type | number | Yes | Partition type. | **Return value** - | Type | Description | - | --------------------- | ----------------------- | - | Promise<void> | Promise used to return the result. | +| Type | Description | +| --------------------- | ----------------------- | +| Promise<void> | Promise used to return the result. | **Example** @@ -461,7 +467,7 @@ Asynchronously partitions a disk. This API uses a promise to return the result. partition(diskId: string, type: number, callback: AsyncCallback<void>): void -Asynchronously partitions a disk. This API uses a callback to return the result. +Asynchronously partitions a disk. This API uses a callback to return the result. The system supports access to multi-partition disks. Currently, this API can partition a disk into only one partition. **Required permissions**: ohos.permission.MOUNT_FORMAT_MANAGER @@ -469,18 +475,18 @@ Asynchronously partitions a disk. This API uses a callback to return the result. **Parameters** - | Name | Type | Mandatory| Description | - | -------- | --------------------------------------- | ---- | ---------------- | - | diskId | string | Yes | ID of the disk to which the volume belongs. | - | type | number | Yes | Partition type. | - | callback | AsyncCallback<void> | Yes | Callback invoked to return the result. | +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------------- | +| diskId | string | Yes | ID of the disk to partition. | +| type | number | Yes | Partition type. | +| callback | AsyncCallback<void> | Yes | Callback that returns no value. | **Example** ```js let diskId = ""; let type = 0; - volumemanager.partition(diskId, type, (error, bool) => { + volumemanager.partition(diskId, type, (error) => { // Do something. }); ``` @@ -493,10 +499,10 @@ Asynchronously partitions a disk. This API uses a callback to return the result. | Name | Type | Readable | Writable | Description | | ----------- | ------- | ------- | ----- | -------------------- | -| id | string | Yes| No| Volume ID. | -| uuid | string | Yes| No| UUID of the volume. | -| diskId | string | Yes| No| ID of the disk to which the volume belongs. | +| id | string | Yes| No| Volume ID, in the vol-{Primary device ID}-{Secondary device ID} format. The primary device IDs identify devices of different types. The secondary device IDs identify different devices of the same type. The volume IDs vary depending on the card insertion sequence. | +| uuid | string | Yes| No| Volume UUID, which uniquely identifies a volume irrespective of the card insertion sequence. However, the UUID of a volume will change after the volume is formatted. | +| diskId | string | Yes| No| ID of the disk to which the volume belongs. A disk can have one or more volumes. The disk ID is in the disk-{Primary device ID}-{Secondary device ID} format, which is similar to the volume ID. | | description | string | Yes| No| Description of the volume. | -| removable | boolean | Yes| No| Whether the volume is a removable storage device.| -| state | number | Yes| No| Volume state. | -| path | string | Yes| No| Mount address of the volume. | +| removable | boolean | Yes| No| Whether the volume can be removed. Currently, only removable storage devices are supported.| +| state | number | Yes| No| Volume status.
**0**: The volume is unmounted.
**1**: The volume is being checked.
**2**: The volume is mounted.
**3**: The volume is being ejected. | +| path | string | Yes| No| Path of the volume mounted. Generally, the path is **/mnt/external/{uuid}**. | diff --git a/en/application-dev/reference/apis/js-apis-fileAccess.md b/en/application-dev/reference/apis/js-apis-fileAccess.md index 6238db4bd28dd10cb7ac75014778827eda399f4f..41c76565f967a2ea057f9c81ca3328a1cc047a07 100644 --- a/en/application-dev/reference/apis/js-apis-fileAccess.md +++ b/en/application-dev/reference/apis/js-apis-fileAccess.md @@ -1,11 +1,12 @@ # @ohos.file.fileAccess (User File Access and Management) -The **fileAccess** module is a framework for accessing and operating user files based on the Extension ability mechanism. This module interacts with diverse file management services, such as the media library and external storage management service, and provides a set of file access and management APIs for system applications. The media library service allows access to user files on local devices and distributed devices. The external storage management service allows access to the user files stored on devices such as shared disks, USB flash drives, and SD cards. +The **fileAccess** module is a framework for accessing and operating user files based on the ExtensionAbility mechanism. This module interacts with diverse file management services, such as the media library and external storage management service, and provides a set of file access and management APIs for system applications. The media library service allows access to user files on local devices and distributed devices. The external storage management service allows access to the user files stored on devices such as shared disks, USB flash drives, and SD cards. >**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 and cannot be called by third-party applications. Currently, the APIs can be called only by **FilePicker** and **Files**. +>- The APIs provided by this module are system APIs and cannot be called by third-party applications. Currently, the APIs can be called only by **picker** and **fs**. +>- The APIs of this module support processing of error codes. For details, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md). ## Modules to Import @@ -25,9 +26,9 @@ Obtains information about all wants with **extension** set to **fileAccess** in **Return value** - | Type| Description| - | --- | -- | - | Promise<Array<Want>> | Promise used to return the **want** information obtained.| +| Type| Description| +| --- | -- | +| Promise<Array<Want>> | Promise used to return the **want** information obtained.| **Example** @@ -55,9 +56,9 @@ Obtains information about all wants with **extension** set to **fileAccess** in **Parameters** - | Name| Type| Mandatory| Description| - | --- | --- | --- | -- | - | callback | AsyncCallback<Array<Want>> | Yes| Promise used to return the **want** information obtained.| +| Name| Type| Mandatory| Description| +| --- | --- | --- | -- | +| callback | AsyncCallback<Array<Want>> | Yes| Promise used to return the **want** information obtained.| **Example** @@ -89,23 +90,23 @@ Synchronously creates a **Helper** object to connect to the specified wants. The **Parameters** - | Name| Type| Mandatory| Description| - | --- | --- | --- | -- | - | context | Context | Yes| Context of the ability.| - | wants | Array<Want> | Yes| Wants to connect.| +| Name| Type| Mandatory| Description| +| --- | --- | --- | -- | +| context | Context | Yes| Context of the ability.| +| wants | Array<Want> | Yes| Wants to connect.| **Return value** - | Type| Description| - | --- | -- | - | FileAccessHelper | **Helper** object created.| +| Type| Description| +| --- | -- | +| FileAccessHelper | **Helper** object created.| **Example** ```js createFileAccessHelper() { let fileAccessHelper = null; - / / Obtain wantInfos by using getFileAccessAbilityInfo(). + // Obtain wantInfos by using getFileAccessAbilityInfo(). // Create a helper object to interact with the media library service only. let wantInfos = [ { @@ -136,15 +137,15 @@ Synchronously creates a **Helper** object to connect to all file management serv **Parameters** - | Name| Type| Mandatory| Description| - | --- | --- | --- | -- | - | context | Context | Yes| Context of the ability.| +| Name| Type| Mandatory| Description| +| --- | --- | --- | -- | +| context | Context | Yes| Context of the ability.| **Return value** - | Type| Description| - | --- | -- | - | FileAccessHelper | **Helper** object created.| +| Type| Description| +| --- | -- | +| FileAccessHelper | **Helper** object created.| **Example** @@ -175,9 +176,9 @@ Obtains information about the device root nodes of the file management service t **Return value** - | Type| Description| - | --- | -- | - | Promise<RootIterator> | Promise used to return the **RootIterator** object obtained.| +| Type| Description| +| --- | -- | +| Promise<RootIterator> | Promise used to return the **RootIterator** object obtained.| **Example** @@ -219,9 +220,9 @@ The callback has a **RootIterator** object, which returns [RootInfo](#rootinfo) **Parameters** - | Name| Type| Mandatory| Description| - | --- | --- | --- | -- | - | callback | AsyncCallback<RootIterator> | Yes| Promise used to return the **RootIterator** object obtained.| +| Name| Type| Mandatory| Description| +| --- | --- | --- | -- | +| callback | AsyncCallback<RootIterator> | Yes| Promise used to return the **RootIterator** object obtained.| **Example** @@ -262,16 +263,16 @@ Synchronously obtains the **FileIterator** object of the first-level files (dire **Parameters** - | Name| Type| Mandatory| Description| - | --- | --- | -- | -- | - | filter | Filter | No| **Filter** object. | +| Name| Type| Mandatory| Description| +| --- | --- | -- | -- | +| filter | Filter | No| **Filter** object. | **Return value** - | Type| Description| - | --- | -- | - | FileIterator | **FileIterator** object obtained.| +| Type| Description| +| --- | -- | +| FileIterator | **FileIterator** object obtained.| **Example** @@ -313,15 +314,15 @@ Recursively obtains the **FileIterator** object of the files matching the condit **Parameters** - | Name| Type| Mandatory| Description| - | --- | --- | -- | -- | - | filter | Filter | No| **Filter** object. | +| Name| Type| Mandatory| Description| +| --- | --- | -- | -- | +| filter | Filter | No| **Filter** object. | **Return value** - | Type| Description| - | --- | -- | - | FileIterator | **FileIterator** object obtained.| +| Type| Description| +| --- | -- | +| FileIterator | **FileIterator** object obtained.| **Example** @@ -363,15 +364,15 @@ Synchronously obtains the **FileIterator** object of the next-level files (direc **Parameters** - | Name| Type| Mandatory| Description| - | --- | --- | -- | -- | - | filter | Filter | No| **Filter** object. | +| Name| Type| Mandatory| Description| +| --- | --- | -- | -- | +| filter | Filter | No| **Filter** object. | **Return value** - | Type| Description| - | --- | -- | - | FileIterator | **FileIterator** object obtained.| +| Type| Description| +| --- | -- | +| FileIterator | **FileIterator** object obtained.| **Example** @@ -413,16 +414,16 @@ Recursively obtains the **FileIterator** object of the files matching the condit **Parameters** - | Name| Type| Mandatory| Description| - | --- | --- | -- | -- | - | filter | Filter | No| **Filter** object. | +| Name| Type| Mandatory| Description| +| --- | --- | -- | -- | +| filter | Filter | No| **Filter** object. | **Return value** - | Type| Description| - | --- | -- | - | FileIterator | **FileIterator** object obtained.| +| Type| Description| +| --- | -- | +| FileIterator | **FileIterator** object obtained.| **Example** @@ -464,10 +465,10 @@ Creates a file in a directory. This API uses a promise to return the result. **Parameters** - | Name| Type| Mandatory| Description| - | --- | --- | --- | -- | - | uri | string | Yes| URI of the parent directory for the file to create.| - | displayName | string | Yes| Name of the file to create. By default, the name of a local file must contain the file name extension.| +| Name| Type| Mandatory| Description| +| --- | --- | --- | -- | +| uri | string | Yes| URI of the parent directory for the file to create.| +| displayName | string | Yes| Name of the file to create. By default, the name of a local file must contain the file name extension.| **Return value** @@ -509,11 +510,11 @@ Creates a file in a directory. This API uses an asynchronous callback to return **Parameters** - | Name| Type| Mandatory| Description| - | --- | --- | --- | -- | - | uri | string | Yes| URI of the parent directory for the file to create.| - | displayName | string | Yes| Name of the file to create. By default, the name of a local file must contain the file name extension.| - | callback | AsyncCallback<string> | Yes| Promise used to return the URI of the file created.| +| Name| Type| Mandatory| Description| +| --- | --- | --- | -- | +| uri | string | Yes| URI of the parent directory for the file to create.| +| displayName | string | Yes| Name of the file to create. By default, the name of a local file must contain the file name extension.| +| callback | AsyncCallback<string> | Yes| Promise used to return the URI of the file created.| **Example** @@ -541,7 +542,7 @@ Creates a file in a directory. This API uses an asynchronous callback to return mkDir(parentUri: string, displayName: string) : Promise<string> -Creates a directory in a directory. This API uses a promise to return the result. +Creates a directory. This API uses a promise to return the result. **System capability**: SystemCapability.FileManagement.UserFileService @@ -549,10 +550,10 @@ Creates a directory in a directory. This API uses a promise to return the result **Parameters** - | Name| Type| Mandatory| Description| - | --- | --- | --- | -- | - | parentUri | string | Yes| URI of the parent directory for the directory to create.| - | displayName | string | Yes| Name of the directory to create.| +| Name| Type| Mandatory| Description| +| --- | --- | --- | -- | +| parentUri | string | Yes| URI of the parent directory for the directory to create.| +| displayName | string | Yes| Name of the directory to create.| **Return value** @@ -586,7 +587,7 @@ Creates a directory in a directory. This API uses a promise to return the result mkDir(parentUri: string, displayName: string, callback: AsyncCallback<string>) : void; -Creates a directory in a directory. This API uses an asynchronous callback to return the result. +Creates a directory. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.FileManagement.UserFileService @@ -594,11 +595,11 @@ Creates a directory in a directory. This API uses an asynchronous callback to re **Parameters** - | Name| Type| Mandatory| Description| - | --- | --- | --- | -- | - | parentUri | string | Yes| URI of the parent directory for the directory to create.| - | displayName | string | Yes| Name of the directory to create.| - | callback | AsyncCallback<string> | Yes| Promise used to return the URI of the directory created.| +| Name| Type| Mandatory| Description| +| --- | --- | --- | -- | +| parentUri | string | Yes| URI of the parent directory for the directory to create.| +| displayName | string | Yes| Name of the directory to create.| +| callback | AsyncCallback<string> | Yes| Promise used to return the URI of the directory created.| **Example** @@ -634,10 +635,10 @@ 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.| - | flags | [OPENFLAGS](#openflags) | Yes| File open mode.| +| Name| Type| Mandatory| Description| +| --- | --- | --- | -- | +| uri | string | Yes| URI of the file to open.| +| flags | [OPENFLAGS](#openflags) | Yes| File open mode.| **Return value** @@ -672,11 +673,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.| - | flags | [OPENFLAGS](#openflags) | Yes| File open mode.| - | callback | AsyncCallback<number> | Yes| Callback invoked to return the file descriptor of the file opened.| +| Name| Type| Mandatory| Description| +| --- | --- | --- | -- | +| uri | string | Yes| URI of the file to open.| +| flags | [OPENFLAGS](#openflags) | Yes| File open mode.| +| callback | AsyncCallback<number> | Yes| Callback invoked to return the file descriptor of the file opened.| **Example** @@ -711,9 +712,9 @@ Deletes a file or directory. This API uses a promise to return the result. **Parameters** - | Name| Type| Mandatory| Description| - | --- | --- | --- | -- | - | uri | string | Yes| URI of the file or directory to delete.| +| Name| Type| Mandatory| Description| +| --- | --- | --- | -- | +| uri | string | Yes| URI of the file or directory to delete.| **Return value** @@ -750,10 +751,10 @@ Deletes a file or directory. This API uses an asynchronous callback to return th **Parameters** - | Name| Type| Mandatory| Description| - | --- | --- | --- | -- | - | uri | string | Yes| URI of the file or directory to delete.| - | callback | AsyncCallback<number> | Yes| Promise used to return the result.| +| Name| Type| Mandatory| Description| +| --- | --- | --- | -- | +| uri | string | Yes| URI of the file or directory to delete.| +| callback | AsyncCallback<number> | Yes| Promise used to return the result.| **Example** @@ -788,10 +789,10 @@ Moves a file or directory. This API uses a promise to return the result. **Parameters** - | Name| Type| Mandatory| Description| - | --- | --- | --- | -- | - | sourceFile | string | Yes| URI of the file or directory to move.| - | destFile | string | Yes| URI of the directory, to which the file or directory will be moved.| +| Name| Type| Mandatory| Description| +| --- | --- | --- | -- | +| sourceFile | string | Yes| URI of the file or directory to move.| +| destFile | string | Yes| URI of the directory, to which the file or directory will be moved.| **Return value** @@ -828,11 +829,11 @@ Moves a file or directory. This API uses an asynchronous callback to return the **Parameters** - | Name| Type| Mandatory| Description| - | --- | --- | --- | -- | - | sourceFile | string | Yes| URI of the file or directory to move.| - | destFile | string | Yes| URI of the directory, to which the file or directory will be moved.| - | callback | AsyncCallback<string> | Yes| Promise used to return the URI of the file or directory in the destination directory.| +| Name| Type| Mandatory| Description| +| --- | --- | --- | -- | +| sourceFile | string | Yes| URI of the file or directory to move.| +| destFile | string | Yes| URI of the directory, to which the file or directory will be moved.| +| callback | AsyncCallback<string> | Yes| Promise used to return the URI of the file or directory in the destination directory.| **Example** @@ -868,10 +869,10 @@ Renames a file or directory. This API uses a promise to return the result. **Parameters** - | Name| Type| Mandatory| Description| - | --- | --- | --- | -- | - | uri | string | Yes| URI of the file or directory to rename.| - | displayName | string | Yes| New name of the file or directory, which can contain the file name extension.| +| Name| Type| Mandatory| Description| +| --- | --- | --- | -- | +| uri | string | Yes| URI of the file or directory to rename.| +| displayName | string | Yes| New name of the file or directory, which can contain the file name extension.| **Return value** @@ -907,11 +908,11 @@ Renames a file or directory. This API uses an asynchronous callback to return th **Parameters** - | Name| Type| Mandatory| Description| - | --- | --- | --- | -- | - | uri | string | Yes| URI of the file or directory to rename.| - | displayName | string | Yes| New name of the file or directory, which can contain the file name extension.| - | callback | AsyncCallback<string> | Yes| Promise used to return the URI of the renamed file or directory.| +| Name| Type| Mandatory| Description| +| --- | --- | --- | -- | +| uri | string | Yes| URI of the file or directory to rename.| +| displayName | string | Yes| New name of the file or directory, which can contain the file name extension.| +| callback | AsyncCallback<string> | Yes| Promise used to return the URI of the renamed file or directory.| **Example** @@ -946,9 +947,9 @@ Checks whether a file or directory exists. This API uses a promise to return the **Parameters** - | Name| Type| Mandatory| Description| - | --- | --- | --- | -- | - | sourceFileUri | string | Yes| URI of the file or directory.| +| Name| Type| Mandatory| Description| +| --- | --- | --- | -- | +| sourceFileUri | string | Yes| URI of the file or directory.| **Return value** @@ -987,10 +988,10 @@ Checks whether a file or directory exists. This API uses an asynchronous callbac **Parameters** - | Name| Type| Mandatory| Description| - | --- | --- | --- | -- | - | sourceFileUri | string | Yes| URI of the file or directory.| - | callback | AsyncCallback<boolean> | Yes| Promise used to return the result.| +| Name| Type| Mandatory| Description| +| --- | --- | --- | -- | +| sourceFileUri | string | Yes| URI of the file or directory.| +| callback | AsyncCallback<boolean> | Yes| Promise used to return the result.| **Example** @@ -1016,6 +1017,241 @@ Checks whether a file or directory exists. This API uses an asynchronous callbac }; ``` +## FileAccessHelper.getFileInfoFromUri10+ + +getFileInfoFromUri(uri: string) : Promise; + +Obtains a [FileInfo](#fileinfo) object based on the specified URI. This API uses a promise to return the result. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Required permissions**: ohos.permission.FILE_ACCESS_MANAGER + +**Parameters** + +| Name| Type| Mandatory| Description| +| --- | --- | --- | -- | +| uri | string | Yes| URI of the file or directory.| + +**Return value** + +| Type| Description| +| --- | -- | +| [FileInfo](#fileinfo) | Promise used to return the **FileInfo** object obtained.| + +**Example** + + ```js + // The media library URI is used as an example. + // In the sample code, sourceUri indicates the Download directory. The URI is the URI in fileInfo. + // You can use the URI obtained. + let sourceUri = "datashare:///media/file/6"; + try { + // Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper. + let fileInfo = await fileAccessHelper.getFileInfoFromUri(sourceUri); + } catch (error) { + console.error("getFileInfoFromUri failed, errCode:" + error.code + ", errMessage:" + error.message); + }; + ``` + +## FileAccessHelper.getFileInfoFromUri10+ + +getFileInfoFromUri(uri: string, callback: AsyncCallback) : void; + +Obtains a [FileInfo](#fileinfo) object based on the specified URI. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Required permissions**: ohos.permission.FILE_ACCESS_MANAGER + +**Parameters** + +| Name| Type| Mandatory| Description| +| --- | --- | --- | -- | +| uri | string | Yes| URI of a file or directory.| +| callback | AsyncCallback<string> | Yes| Callback invoked to return the **FileInfo** object obtained.| + +**Example** + + ```js + // The media library URI is used as an example. + // In the sample code, sourceUri indicates the Download directory. The URI is the URI in fileInfo. + // You can use the URI obtained. + let sourceUri = "datashare:///media/file/6"; + try { + // Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper. + fileAccessHelper.getFileInfoFromUri(sourceUri, function (err, fileInfo) { + if (err) { + console.error("Failed to getFileInfoFromUri in async, errCode:" + err.code + ", errMessage:" + err.message); + return; + } + console.log("getFileInfoFromUri success, fileInfo: " + JSON.stringify(fileInfo)); + }); + } catch (error) { + console.error("getFileInfoFromUri failed, errCode:" + error.code + ", errMessage:" + error.message); + }; + ``` + + +## FileAccessHelper.getFileInfoFromRelativePath10+ + +getFileInfoFromRelativePath(relativePath: string) : Promise; + +Obtains a [FileInfo](#fileinfo) object based on the specified relative path. This API uses a promise to return the result. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Required permissions**: ohos.permission.FILE_ACCESS_MANAGER + +**Parameters** + +| Name| Type| Mandatory| Description| +| --- | --- | --- | -- | +| relativePath | string | Yes| Relative path of a file or directory.| + +**Return value** + +| Type| Description| +| --- | -- | +| [FileInfo](#fileinfo) | Promise used to return the **FileInfo** object obtained.| + +**Example** + + ```js + // The relative path of the media library is used as an example. + // In the sample code, relativePath indicates the download directory, which is the relativePath in fileInfo. + // You can use the relativePath obtained. + let relativePath = "Download/"; + try { + // Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper. + let fileInfo = await fileAccessHelper.getFileInfoFromRelativePath(relativePath); + } catch (error) { + console.error("getFileInfoFromRelativePath failed, errCode:" + error.code + ", errMessage:" + error.message); + }; + ``` + +## FileAccessHelper.getFileInfoFromRelativePath10+ + +getFileInfoFromRelativePath(relativePath: string, callback: AsyncCallback) : void; + +Obtains a [FileInfo](#fileinfo) object based on the specified relative path. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Required permissions**: ohos.permission.FILE_ACCESS_MANAGER + +**Parameters** + +| Name| Type| Mandatory| Description| +| --- | --- | --- | -- | +| relativePath | string | Yes| Relative path of a file or directory.| +| callback | AsyncCallback<string> | Yes| Callback invoked to return the **FileInfo** object obtained.| + +**Example** + + ```js + // The relative path of the media library is used as an example. + // In the sample code, relativePath indicates the download directory, which is the relativePath in fileInfo. + // You can use the relativePath obtained. + let relativePath = "Download/"; + try { + // Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper. + fileAccessHelper.getFileInfoFromRelativePath(relativePath, function (err, fileInfo) { + if (err) { + console.error("Failed to getFileInfoFromRelativePath in async, errCode:" + err.code + ", errMessage:" + err.message); + return; + } + console.log("getFileInfoFromRelativePath success, fileInfo: " + JSON.stringify(fileInfo)); + }); + } catch (error) { + console.error("getFileInfoFromRelativePath failed, errCode:" + error.code + ", errMessage:" + error.message); + }; + ``` + +## FileAccessHelper.getThumbnail10+ + +getThumbnail(uri: string, size: image.Size) : Promise<image.PixelMap> + +Obtains the **Pixelmap** object of a media file based on the specified URI and size. This API uses a promise to return the result. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Required permissions**: ohos.permission.FILE_ACCESS_MANAGER + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ----------------------------------- | ---- | ----------- | +| uri | string | Yes | URI of the media file.| +| size | [image.Size](js-apis-image.md#size) | Yes | Size of the thumbnail. | + +**Return value** + +| Type | Description | +| :---------------------------- | :----------------- | +| Promise<image.PixelMap> | Promise used to return the **Pixelmap** object obtained.| + +**Example** + +```js +// The media library URI is used as an example. +// In the sample code, targetUri indicates a media file (image, audio, or video) in the Download directory. The URI is the URI in fileInfo. +// You can use the URI obtained. +let targetUri = "datashare:///media/image/100"; +let size = { width: 128, height: 128 }; +try { + // Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper. + let pixelMap = await fileAccessHelper.getThumbnail(targetUri, size); + let imageInfo = await pixelMap.getImageInfo(); + console.log("getThumbnail sucess, pixelMap.width: " + imageInfo.size.width); + console.log("getThumbnail sucess, pixelMap.height: " + imageInfo.size.height); +} catch (error) { + console.error("getThumbnail failed, errCode:" + error.code + ", errMessage:" + error.message); +}; +``` + +## FileAccessHelper.getThumbnail10+ + + getThumbnail(uri: string, size: image.Size, callback: AsyncCallback<image.PixelMap>) : void + +Obtains the **Pixelmap** object of a media file based on the specified URI and size. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.FileManagement.UserFileService + +**Required permissions**: ohos.permission.FILE_ACCESS_MANAGER + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ----------------------------------- | ---- | ------------------ | +| uri | string | Yes | URI of the media file. | +| size | [image.Size](js-apis-image.md#size) | Yes | Size of the thumbnail. | +| callback | AsyncCallback<image.PixelMap> | Yes | Callback invoked to return the **Pixelmap** object obtained.| + +**Example** + +```js +// The media library URI is used as an example. +// In the sample code, targetUri indicates a media file (image, audio, or video) in the Download directory. The URI is the URI in fileInfo. +// You can use the URI obtained. +let targetUri = "datashare:///media/image/100"; +let size = { width: 128, height: 128 }; +try { + // Obtain fileAccessHelper by referring to the sample code of fileAccess.createFileAccessHelper. + fileAccessHelper.getThumbnail(targetUri, size, async(err, pixelMap) => { + if (err) { + console.error("Failed to getThumbnail in async, errCode:" + err.code + ", errMessage:" + err.message); + return; + } + let imageInfo = await pixelMap.getImageInfo(); + console.log("getThumbnail sucess, pixelMap.width: " + imageInfo.size.width); + console.log("getThumbnail sucess, pixelMap.height: " + imageInfo.size.height); + }); +} catch (error) { + console.error("getThumbnail failed, errCode:" + error.code + ", errMessage:" + error.message); +}; +``` + ## RootIterator.next next( ) : { value: RootInfo, done: boolean } @@ -1062,6 +1298,7 @@ Represents the root attribute information and interface capabilities of a device | ------ | ------ | -------- | ------ | -------- | | deviceType | number | Yes| No|Device type.| | uri | string | Yes| No| Root directory URI of the device.| +| relativePath10+ | string | Yes| No| Relative path of the root directory.| | displayName | string | Yes| No| Device name.| | deviceFlags | number | Yes| No| Capabilities supported by the device.| @@ -1078,6 +1315,7 @@ Represents the file or directory attribute information and interface capabilitie | Name| Type | Readable| Writable| Description | | ------ | ------ | -------- | ------ | -------- | | uri | string | Yes| No| URI of the file or directory.| +| relativePath10+ | string | Yes| No| Relative path of a file or directory.| | fileName | string | Yes| No| Name of a file or directory.| | mode | number | Yes| No| Permissions on the file or directory.| | size | number | Yes| No| Size of the file or directory.| diff --git a/en/application-dev/reference/apis/js-apis-fileShare.md b/en/application-dev/reference/apis/js-apis-fileShare.md new file mode 100644 index 0000000000000000000000000000000000000000..b9d9fb65f7c532d3ffd43ffdb195615b4c07b1aa --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-fileShare.md @@ -0,0 +1,126 @@ +# @ohos.fileShare (File Sharing) + +The **fileShare** module provides APIs for granting the access permissions on a user file to another application by the Uniform Resource Identifier (URI). Then, the authorized application can access the file by using the APIs provided by [@ohos.file.fs](js-apis-file-fs.md). + +> **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 + +```js +import fileShare from '@ohos.fileShare'; +``` + +## fileShare.grantUriPermission + +grantUriPermission(uri: string, bundleName: string, mode: number, callback: AsyncCallback<void>): void + +Grants permissions on a user file by the URI to an application. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.WRITE_MEDIA + +**System API**: This is a system API. + +**System capability**: SystemCapability.FileManagement.AppFileService + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | -------------------------- | +| uri | string | Yes | URI of a user file.| +| bundleName | string | Yes | Bundle name of the application to be grated with the permissions.| +| mode | number | Yes | Permissions to grant. For details, see [wantConstant.Flags](js-apis-app-ability-wantConstant.md#wantconstantflags).
**wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION**: permission to read the file.
**wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION**: permission to write the file.| +| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. | + +**Error codes** + +For details about the error codes, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md). + +| ID | Error Message | +| ---------------------------- | ---------- | +| 201 | Permission verification failed | +| 202 | The caller is not a system application | +| 401 | The input parameter is invalid | +| 143000001 | IPC error | + + +**Example** + + ```js +import wantConstant from '@ohos.app.ability.wantConstant'; + + +let uri = 'datashare:///media/image/8'; +let bundleName = 'com.demo.test'; +try { + fileShare.grantUriPermission(uri, bundleName, wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION | wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION, (err) => { + if (err) { + console.error("grantUriPermission failed with error: " + err); + return; + } + console.info("grantUriPermission success!"); + }); +} catch (error) { + console.error("grantUriPermission failed with error:" + error); +} + ``` + + +## fileShare.grantUriPermission + +grantUriPermission(uri: string, bundleName: string, mode: number): Promise<void> + +Grants permissions on a user file by the URI to an application. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.WRITE_MEDIA + +**System API**: This is a system API. + +**System capability**: SystemCapability.FileManagement.AppFileService + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | -------------------------- | +| uri | string | Yes | URI of a user file.| +| bundleName | string | Yes | Bundle name of the application to be grated with the permissions.| +| mode | number | Yes | Permissions to grant. For details, see [wantConstant.Flags](js-apis-app-ability-wantConstant.md#wantconstantflags).
**wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION**: permission to read the file.
**wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION**: permission to write the file.| + +**Return value** + +| Type | Description | +| ---------------------------- | ---------- | +| Promise<void> | Promise that returns no value.| + + +**Error codes** + +For details about the error codes, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md). + +| ID | Error Message | +| ---------------------------- | ---------- | +| 201 | Permission verification failed | +| 202 | The caller is not a system application | +| 401 | The input parameter is invalid | +| 143000001 | IPC error | + + +**Example** + + ```js +import wantConstant from '@ohos.app.ability.wantConstant'; + +let uri = 'datashare:///media/image/8'; +let bundleName = 'com.demo.test'; +try { + fileShare.grantUriPermission(uri, bundleName, wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION | + wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION).then(function () { + console.info("grantUriPermission success!"); + }).catch(function (error) { + console.error("grantUriPermission failed with error:" + error); + }); +} catch (error) { + console.error("grantUriPermission failed with error:" + error); +} + ``` diff --git a/en/application-dev/reference/apis/js-apis-fileio.md b/en/application-dev/reference/apis/js-apis-fileio.md index 181a68d508ac6a52903f2fa33c13bc24a94cee88..4d69af5ec5184989ae3a79c45693297fae5b1c66 100644 --- a/en/application-dev/reference/apis/js-apis-fileio.md +++ b/en/application-dev/reference/apis/js-apis-fileio.md @@ -3,9 +3,9 @@ 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. -> - The APIs provided by this module are deprecated since API version 9. You are advised to use [@ohos.file.fs](./js-apis-file-fs.md). +> - The APIs provided by this module are deprecated since API version 9. You are advised to use [@ohos.file.fs](js-apis-file-fs.md). ## Modules to Import @@ -18,7 +18,7 @@ import fileio from '@ohos.fileio'; Before using the APIs provided by this module to perform operations on files or directories, obtain the path of the application sandbox as follows: -Stage Model +**Stage Model** ```js import UIAbility from '@ohos.app.ability.UIAbility'; @@ -31,9 +31,9 @@ export default class EntryAbility extends UIAbility { } ``` - For details about how to obtain the stage model context, see [AbilityContext](js-apis-ability-context.md#abilitycontext). + For details about how to obtain the stage model context, see [UIAbilityContext](js-apis-inner-application-uiAbilityContext.md). -FA Model +**FA Model** ```js import featureAbility from '@ohos.ability.featureAbility'; @@ -62,9 +62,9 @@ Obtains file information. This API uses a promise to return the result. **Return value** -| Type | Description | -| ---------------------------- | ---------- | -| Promise<[Stat](#stat)> | Promise used to return the file information obtained.| + | Type | Description | + | ---------------------------- | ---------- | + | Promise<[Stat](#stat)> | Promise used to return the file information obtained.| **Example** @@ -119,9 +119,9 @@ Synchronously obtains file information. **Return value** -| Type | Description | -| ------------- | ---------- | -| [Stat](#stat) | File information obtained.| + | Type | Description | + | ------------- | ---------- | + | [Stat](#stat) | File information obtained.| **Example** @@ -147,9 +147,9 @@ Opens a file directory. This API uses a promise to return the result. **Return value** -| Type | Description | -| -------------------------- | -------- | -| Promise<[Dir](#dir)> | Promise used to return the **Dir** object.| + | Type | Description | + | -------------------------- | -------- | + | Promise<[Dir](#dir)> | Promise used to return the **Dir** object.| **Example** @@ -205,9 +205,9 @@ Synchronously opens a directory. **Return value** -| Type | Description | -| ----------- | -------- | -| [Dir](#dir) | A **Dir** instance corresponding to the directory.| + | Type | Description | + | ----------- | -------- | + | [Dir](#dir) | A **Dir** instance corresponding to the directory.| **Example** @@ -231,13 +231,13 @@ Checks whether the current process can access a file. This API uses a promise to | 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.| +| 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 process has the execute permission on the file.
- **2**: Check whether the process has the write permission on the file.
- **4**: Check whether the process has the read permission on the file. | **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** @@ -264,7 +264,7 @@ Checks whether the current process can access a file. This API uses an asynchron | 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.| +| 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 process has the execute permission on the file.
- **2**: Check whether the process has the write permission on the file.
- **4**: Check whether the process has the read permission on the file. | | callback | AsyncCallback<void> | Yes | Callback invoked when the file is asynchronously checked. | **Example** @@ -290,7 +290,7 @@ Synchronously checks whether the current process can access the specified file. | 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.| +| 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 process has the execute permission on the file.
- **2**: Check whether the process has the write permission on the file.
- **4**: Check whether the process has the read permission on the file. | **Example** @@ -314,15 +314,15 @@ Closes a file. This API uses a promise to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ------------ | -| fd | number | Yes | File descriptor of the file to close.| + | 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.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** @@ -347,10 +347,10 @@ Closes a file. This API uses an asynchronous callback to return the result. **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.| + | 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** @@ -373,9 +373,9 @@ Synchronously closes a file. **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ------------ | -| fd | number | Yes | File descriptor of the file to close.| + | Name | Type | Mandatory | Description | + | ---- | ------ | ---- | ------------ | + | fd | number | Yes | File descriptor of the file to close.| **Example** @@ -396,17 +396,17 @@ Copies a file. This API uses a promise to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| ---- | -------------------------- | ---- | ---------------------------------------- | -| src | string\|number | Yes | Path or file descriptor of the file to copy. | -| dest | string\|number | Yes | Path or file descriptor of the new 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.| + | Name | Type | Mandatory | Description | + | ---- | -------------------------- | ---- | ---------------------------------------- | + | src | string\|number | Yes | Path or file descriptor of the file to copy. | + | dest | string\|number | Yes | Path or file descriptor of the new 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.| **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** @@ -431,12 +431,12 @@ Copies a file. This API uses an asynchronous callback to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------------------------- | ---- | ---------------------------------------- | -| src | string\|number | Yes | Path or file descriptor of the file to copy. | -| dest | string\|number | Yes | Path or file descriptor of the new 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.| -| callback | AsyncCallback<void> | Yes | Callback invoked when the file is copied asynchronously. | + | Name | Type | Mandatory | Description | + | -------- | -------------------------- | ---- | ---------------------------------------- | + | src | string\|number | Yes | Path or file descriptor of the file to copy. | + | dest | string\|number | Yes | Path or file descriptor of the new 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.| + | callback | AsyncCallback<void> | Yes | Callback invoked when the file is copied asynchronously. | **Example** @@ -459,11 +459,11 @@ Synchronously copies a file. **Parameters** -| Name | Type | Mandatory | Description | -| ---- | -------------------------- | ---- | ---------------------------------------- | -| src | string\|number | Yes | Path or file descriptor of the file to copy. | -| dest | string\|number | Yes | Path or file descriptor of the new 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.| + | Name | Type | Mandatory | Description | + | ---- | -------------------------- | ---- | ---------------------------------------- | + | src | string\|number | Yes | Path or file descriptor of the file to copy. | + | dest | string\|number | Yes | Path or file descriptor of the new 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** @@ -487,13 +487,13 @@ Creates a directory. This API uses a promise to return the result. | 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.| +| 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.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** @@ -520,7 +520,7 @@ Creates a directory. This API uses an asynchronous callback to return the result | 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.| +| 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. | | callback | AsyncCallback<void> | Yes | Callback invoked when the directory is created asynchronously. | **Example** @@ -546,7 +546,7 @@ Synchronously creates a directory. | 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.| +| 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** @@ -569,14 +569,14 @@ Opens a file. This API uses a promise to return the result. | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | | path | string | Yes | Application sandbox path of the file. | -| flags | number | No | Option for opening the file. You must specify one of the following options. By default, the file is open in read-only mode.
- **0o0**: Open the file in read-only mode.
- **0o1**: Open the file in write-only mode.
- **0o2**: Open the file in read/write mode.
In addition, you can specify the following options, separated using a bitwise OR operator (|). By default, no additional option is specified.
- **0o100**: If the file does not exist, create it. If you use this option, you must also specify **mode**.
- **0o200**: If **0o100** is added and the file already exists, throw an exception.
- **0o1000**: If the file exists and is open in write-only or read/write mode, truncate the file length to 0.
- **0o2000**: Open the file in append mode. New data will be appended to the file (added to the end of the file).
- **0o4000**: If **path** points to a named pipe (also known as a FIFO), block special file, or character special file, perform non-blocking operations on the open file and in subsequent I/Os.
- **0o200000**: If **path** does not point to a directory, throw an exception.

- **0o400000**: If **path** points to a symbolic link, throw an exception.
- **0o4010000**: Open the file in synchronous I/O mode.| -| 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.| +| flags | number | No | Option for opening the file. You must specify one of the following options. By default, the file is open in read-only mode.
- **0o0**: Open the file in read-only mode.
- **0o1**: Open the file in write-only mode.
- **0o2**: Open the file in read/write mode.
In addition, you can specify the following options, separated using a bitwise OR operator (|). By default, no additional option is specified.
- **0o100**: If the file does not exist, create a file. The third parameter **mode** must also be specified.
- **0o200**: If **0o100** is added and the file already exists, throw an exception.
- **0o1000**: If the file exists and is open in write-only or read/write mode, truncate the file length to 0.
- **0o2000**: Open the file in append mode. New data will be appended to the file (written to the end of the file).
- **0o4000**: If **path** points to a named pipe (also known as a FIFO), block special file, or character special file, perform non-blocking operations on the open file and in subsequent I/Os.
- **0o200000**: If **path** does not point to a directory, throw an exception.
- **0o400000**: If **path** points to a symbolic link, throw an exception.
- **0o4010000**: Open the file in synchronous I/O mode.| +| 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.
- **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.| + | Type | Description | + | --------------------- | ----------- | + | Promise<number> | Promise used to return the file descriptor of the file opened.| **Example** @@ -603,8 +603,8 @@ Opens a file. This API uses an asynchronous callback to return the result. | Name | Type | Mandatory| Description | | -------- | ------------------------------- | ---- | ------------------------------------------------------------ | | path | string | Yes | Application sandbox path of the file. | -| flags | number | No | Option for opening the file. You must specify one of the following options. By default, the file is open in read-only mode.
- **0o0**: Open the file in read-only mode.
- **0o1**: Open the file in write-only mode.
- **0o2**: Open the file in read/write mode.
In addition, you can specify the following options, separated using a bitwise OR operator (|). By default, no additional option is specified.
- **0o100**: If the file does not exist, create it. If you use this option, you must also specify **mode**.
- **0o200**: If **0o100** is added and the file already exists, throw an exception.
- **0o1000**: If the file exists and is open in write-only or read/write mode, truncate the file length to 0.
- **0o2000**: Open the file in append mode. New data will be appended to the file (added to the end of the file).
- **0o4000**: If **path** points to a named pipe (also known as a FIFO), block special file, or character special file, perform non-blocking operations on the open file and in subsequent I/Os.
- **0o200000**: If **path** does not point to a directory, throw an exception.

- **0o400000**: If **path** points to a symbolic link, throw an exception.
- **0o4010000**: Open the file in synchronous I/O mode.| -| 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.| +| flags | number | No | Option for opening the file. You must specify one of the following options. By default, the file is open in read-only mode.
- **0o0**: Open the file in read-only mode.
- **0o1**: Open the file in write-only mode.
- **0o2**: Open the file in read/write mode.
In addition, you can specify the following options, separated using a bitwise OR operator (|). By default, no additional option is specified.
- **0o100**: If the file does not exist, create a file. The third parameter **mode** must also be specified.
- **0o200**: If **0o100** is added and the file already exists, throw an exception.
- **0o1000**: If the file exists and is open in write-only or read/write mode, truncate the file length to 0.
- **0o2000**: Open the file in append mode. New data will be appended to the file (written to the end of the file).
- **0o4000**: If **path** points to a named pipe (also known as a FIFO), block special file, or character special file, perform non-blocking operations on the open file and in subsequent I/Os.
- **0o200000**: If **path** does not point to a directory, throw an exception.
- **0o400000**: If **path** points to a symbolic link, throw an exception.
- **0o4010000**: Open the file in synchronous I/O mode.| +| 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.
- **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. | | callback | AsyncCallback<number> | Yes | Callback invoked when the file is open asynchronously. | **Example** @@ -630,14 +630,14 @@ Synchronously opens a file. | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | | path | string | Yes | Application sandbox path of the file. | -| flags | number | No | Option for opening the file. You must specify one of the following options. By default, the file is open in read-only mode.
- **0o0**: Open the file in read-only mode.
- **0o1**: Open the file in write-only mode.
- **0o2**: Open the file in read/write mode.
In addition, you can specify the following options, separated using a bitwise OR operator (|). By default, no additional option is specified.
- **0o100**: If the file does not exist, create it. If you use this option, you must also specify **mode**.
- **0o200**: If **0o100** is added and the file already exists, throw an exception.
- **0o1000**: If the file exists and is open in write-only or read/write mode, truncate the file length to 0.
- **0o2000**: Open the file in append mode. New data will be appended to the file (added to the end of the file).
- **0o4000**: If **path** points to a named pipe (also known as a FIFO), block special file, or character special file, perform non-blocking operations on the open file and in subsequent I/Os.
- **0o200000**: If **path** does not point to a directory, throw an exception.

- **0o400000**: If **path** points to a symbolic link, throw an exception.
- **0o4010000**: Open the file in synchronous I/O mode.| -| 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.| +| flags | number | No | Option for opening the file. You must specify one of the following options. By default, the file is open in read-only mode.
- **0o0**: Open the file in read-only mode.
- **0o1**: Open the file in write-only mode.
- **0o2**: Open the file in read/write mode.
In addition, you can specify the following options, separated using a bitwise OR operator (|). By default, no additional option is specified.
- **0o100**: If the file does not exist, create a file. The third parameter **mode** must also be specified.
- **0o200**: If **0o100** is added and the file already exists, throw an exception.
- **0o1000**: If the file exists and is open in write-only or read/write mode, truncate the file length to 0.
- **0o2000**: Open the file in append mode. New data will be appended to the file (written to the end of the file).
- **0o4000**: If **path** points to a named pipe (also known as a FIFO), block special file, or character special file, perform non-blocking operations on the open file and in subsequent I/Os.
- **0o200000**: If **path** does not point to a directory, throw an exception.
- **0o400000**: If **path** points to a symbolic link, throw an exception.
- **0o4010000**: Open the file in synchronous I/O mode.| +| 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.
- **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.| + | Type | Description | + | ------ | ----------- | + | number | File descriptor of the file opened.| **Example** @@ -670,13 +670,13 @@ Reads data from a file. This API uses a promise to return the result. | ------- | ----------- | ---- | ------------------------------------------------------------ | | fd | number | Yes | File descriptor of the file to read. | | 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.
- **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| +| 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.| + | Type | Description | + | ---------------------------------- | ------ | + | Promise<[ReadOut](#readout)> | Promise used to return the data read.| **Example** @@ -703,12 +703,12 @@ Reads data from a file. This API uses an asynchronous callback to return the res **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | ---------------------------------------- | -| fd | number | Yes | File descriptor of the file to read. | -| 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.
- **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 | -| callback | AsyncCallback<[ReadOut](#readout)> | Yes | Callback invoked when the data is read asynchronously. | + | Name | Type | Mandatory | Description | + | -------- | ---------------------------------------- | ---- | ---------------------------------------- | + | fd | number | Yes | File descriptor of the file to read. | + | 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.
- **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 | + | callback | AsyncCallback<[ReadOut](#readout)> | Yes | Callback invoked when the data is read asynchronously. | **Example** @@ -735,17 +735,17 @@ Synchronously reads data from a file. **Parameters** -| Name | Type | Mandatory | Description | -| ------- | ----------- | ---- | ---------------------------------------- | -| fd | number | Yes | File descriptor of the file to read. | -| 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.
- **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 | + | Name | Type | Mandatory | Description | + | ------- | ----------- | ---- | ---------------------------------------- | + | fd | number | Yes | File descriptor of the file to read. | + | 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.
- **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.| + | Type | Description | + | ------ | -------- | + | number | Length of the data read.| **Example** @@ -773,9 +773,9 @@ Deletes a directory. This API uses a promise to return the result. **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** @@ -853,9 +853,9 @@ Deletes a file. This API uses a promise to return the result. **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** @@ -926,17 +926,17 @@ Writes data into a file. This API uses a promise to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| ------- | ------------------------------- | ---- | ---------------------------------------- | -| fd | number | Yes | File descriptor of the file to write. | -| 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| + | Name | Type | Mandatory | Description | + | ------- | ------------------------------- | ---- | ---------------------------------------- | + | fd | number | Yes | File descriptor of the file to write. | + | 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 data to be encoded when the data is a string. 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.| + | Type | Description | + | --------------------- | -------- | + | Promise<number> | Promise used to return the length of the data written.| **Example** @@ -961,12 +961,12 @@ Writes data into a file. This API uses an asynchronous callback to return the re **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ------------------------------- | ---- | ---------------------------------------- | -| fd | number | Yes | File descriptor of the file to write. | -| 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| -| callback | AsyncCallback<number> | Yes | Callback invoked when the data is written asynchronously. | + | Name | Type | Mandatory | Description | + | -------- | ------------------------------- | ---- | ---------------------------------------- | + | fd | number | Yes | File descriptor of the file to write. | + | 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 data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.
Constraints: offset + length <= Buffer size| + | callback | AsyncCallback<number> | Yes | Callback invoked when the data is written asynchronously. | **Example** @@ -991,17 +991,17 @@ Synchronously writes data into a file. **Parameters** -| Name | Type | Mandatory | Description | -| ------- | ------------------------------- | ---- | ---------------------------------------- | -| fd | number | Yes | File descriptor of the file to write. | -| 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| + | Name | Type | Mandatory | Description | + | ------- | ------------------------------- | ---- | ---------------------------------------- | + | fd | number | Yes | File descriptor of the file to write. | + | 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 data to be encoded when the data is a string. 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.| + | Type | Description | + | ------ | -------- | + | number | Length of the data written in the file.| **Example** @@ -1029,9 +1029,9 @@ Calculates the hash value of a file. This API uses a promise to return the resul **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.| + | 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** @@ -1086,13 +1086,13 @@ Changes file permissions. This API uses a promise to return the result. | 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.| +| 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.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** @@ -1119,7 +1119,7 @@ Changes file permissions. This API uses an asynchronous callback to return the r | 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.| +| 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. | | callback | AsyncCallback<void> | Yes | Callback invoked when the file permissions are changed asynchronously. | **Example** @@ -1145,7 +1145,7 @@ Synchronously changes file permissions. | 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.| +| 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** @@ -1165,15 +1165,15 @@ Obtains file information based on the file descriptor. This API uses a promise t **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ------------ | -| fd | number | Yes | Descriptor of the target file.| + | Name | Type | Mandatory | Description | + | ---- | ------ | ---- | ------------ | + | fd | number | Yes | Descriptor of the target file.| **Return value** -| Type | Description | -| ---------------------------- | ---------- | -| Promise<[Stat](#stat)> | Promise used to return the file information.| + | Type | Description | + | ---------------------------- | ---------- | + | Promise<[Stat](#stat)> | Promise used to return the file information obtained.| **Example** @@ -1198,10 +1198,10 @@ Obtains file information based on the file descriptor. This API uses an asynchro **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.| + | 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** @@ -1224,15 +1224,15 @@ Synchronously obtains file information based on the file descriptor. **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ------------ | -| fd | number | Yes | File descriptor of the target file.| + | Name | Type | Mandatory | Description | + | ---- | ------ | ---- | ------------ | + | fd | number | Yes | File descriptor of the target file.| **Return value** -| Type | Description | -| ------------- | ---------- | -| [Stat](#stat) | File information obtained.| + | Type | Description | + | ------------- | ---------- | + | [Stat](#stat) | File information obtained.| **Example** @@ -1253,16 +1253,16 @@ Truncates a file based on the file descriptor. This API uses a promise to return **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ---------------- | -| fd | number | Yes | File descriptor of the file to truncate. | -| len | number | No | File length, in bytes, after truncation.| + | 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.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** @@ -1287,11 +1287,11 @@ Truncates a file based on the file descriptor. This API uses an asynchronous cal **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ------------------------- | ---- | ---------------- | -| fd | number | Yes | File descriptor of the file to truncate. | -| len | number | No | File length, in bytes, after truncation.| -| callback | AsyncCallback<void> | Yes | Callback that returns no value. | + | Name | Type | Mandatory | Description | + | -------- | ------------------------- | ---- | ---------------- | + | fd | number | Yes | File descriptor of the file to truncate. | + | len | number | No | File length, in bytes, after truncation.| + | callback | AsyncCallback<void> | Yes | Callback that returns no value. | **Example** @@ -1315,10 +1315,10 @@ Synchronously truncates a file based on the file descriptor. **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ---------------- | -| fd | number | Yes | File descriptor of the file to truncate. | -| len | number | No | File length, in bytes, after truncation.| + | Name | Type | Mandatory | Description | + | ---- | ------ | ---- | ---------------- | + | fd | number | Yes | File descriptor of the file to truncate. | + | len | number | No | File length, in bytes, after truncation.| **Example** @@ -1347,9 +1347,9 @@ Truncates a file based on the file path. This API uses a promise to return the r **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** @@ -1376,7 +1376,7 @@ Truncates a file based on the file path. This API uses an asynchronous callback | 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.| | callback | AsyncCallback<void> | Yes | Callback that returns no value. | @@ -1403,7 +1403,7 @@ Synchronously truncates a file based on the file path. | 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.| **Example** @@ -1428,13 +1428,13 @@ Reads the text content of a file. This API uses a promise to return the result. | 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.| +| 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 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.| + | Type | Description | + | --------------------- | ---------- | + | Promise<string> | Promise used to return the content read.| **Example** @@ -1461,7 +1461,7 @@ Reads the text content of a file. This API uses an asynchronous callback to retu | 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 | 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 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** @@ -1487,13 +1487,13 @@ Synchronously reads the text of a file. | 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.| +| 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 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.| + | Type | Description | + | ------ | -------------------- | + | string | Promise used to return the content of the file read.| **Example** @@ -1519,9 +1519,9 @@ Obtains link information. This API uses a promise to return the result. **Return value** -| Type | Description | -| ---------------------------- | ---------- | -| Promise<[Stat](#stat)> | Promise used to return the link information obtained. For details, see [Stat](#stat).| + | Type | Description | + | ---------------------------- | ---------- | + | Promise<[Stat](#stat)> | Promise used to return the link information obtained. For details, see [Stat](#stat).| **Example** @@ -1576,9 +1576,9 @@ Synchronously obtains the link information. **Return value** -| Type | Description | -| ------------- | ---------- | -| [Stat](#stat) | Link information obtained.| + | Type | Description | + | ------------- | ---------- | + | [Stat](#stat) | Link information obtained.| **Example** @@ -1605,9 +1605,9 @@ Renames a file. This API uses a promise to return the result. **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** @@ -1682,15 +1682,15 @@ Flushes data of a file to disk. This API uses a promise to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ------------ | -| fd | number | Yes | File descriptor of the file to flush.| + | 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.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** @@ -1715,10 +1715,10 @@ Flushes data of a file to disk. This API uses an asynchronous callback to return **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.| + | 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** @@ -1741,9 +1741,9 @@ Flushes data of a file to disk in synchronous mode. **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ------------ | -| fd | number | Yes | File descriptor of the file to flush.| + | Name | Type | Mandatory | Description | + | ---- | ------ | ---- | ------------ | + | fd | number | Yes | File descriptor of the file to flush.| **Example** @@ -1764,15 +1764,15 @@ Flushes data of a file to disk. This API uses a promise to return the result. ** **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ------------ | -| fd | number | Yes | File descriptor of the file to flush.| + | 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.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** @@ -1797,10 +1797,10 @@ Flushes data of a file to disk. This API uses an asynchronous callback to return **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.| + | 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** @@ -1823,9 +1823,9 @@ Synchronizes data in a file in synchronous mode. **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ------------ | -| fd | number | Yes | File descriptor of the file to flush.| + | Name | Type | Mandatory | Description | + | ---- | ------ | ---- | ------------ | + | fd | number | Yes | File descriptor of the file to flush.| **Example** @@ -1853,9 +1853,9 @@ Creates a symbolic link based on the file path. This API uses a promise to retur **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** @@ -1939,9 +1939,9 @@ Changes the file owner based on the file path. This API uses a promise to return **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** @@ -2019,15 +2019,15 @@ Creates a temporary directory. This API uses a promise to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | --------------------------- | -| prefix | string | Yes | A randomly generated string used to replace "XXXXXX" in a directory.| + | 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.| + | Type | Description | + | --------------------- | ---------- | + | Promise<string> | Promise used to return the unique directory generated.| **Example** @@ -2050,10 +2050,10 @@ Creates a temporary directory. This API uses an asynchronous callback to return **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. | + | 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** @@ -2074,15 +2074,15 @@ Synchronously creates a temporary directory. **Parameters** -| Name | Type | Mandatory | Description | -| ------ | ------ | ---- | --------------------------- | -| prefix | string | Yes | A randomly generated string used to replace "XXXXXX" in a directory.| + | 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.| + | Type | Description | + | ------ | ---------- | + | string | Unique path generated.| **Example** @@ -2101,16 +2101,16 @@ Changes file permissions based on the file descriptor. This API uses a promise t **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.| + | 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.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** @@ -2136,11 +2136,11 @@ Changes file permissions based on the file descriptor. This API uses an asynchro **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.| -| callback | AsyncCallback<void> | Yes | Callback invoked when the file permissions are changed asynchronously. | + | 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. | + | callback | AsyncCallback<void> | Yes | Callback invoked when the file permissions are changed asynchronously. | **Example** @@ -2164,10 +2164,10 @@ Synchronously changes the file permissions based on the file descriptor. **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.| + | 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** @@ -2192,13 +2192,13 @@ Opens a file stream based on the file path. This API uses a promise to return th | 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).| +| 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](#stream)> | Promise used to return the result.| + | Type | Description | + | --------------------------------- | --------- | + | Promise<[Stream](#stream)> | Promise used to return the result.| **Example** @@ -2225,7 +2225,7 @@ Opens a file stream based on the file path. This API uses an asynchronous callba | 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).| +| 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).| | callback | AsyncCallback<[Stream](#stream)> | Yes | Callback invoked when the stream is open asynchronously. | **Example** @@ -2251,13 +2251,13 @@ Synchronously opens a stream based on the file path. | 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).| +| 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](#stream) | Stream opened.| + | Type | Description | + | ------------------ | --------- | + | [Stream](#stream) | Stream opened.| **Example** @@ -2277,16 +2277,16 @@ Opens a file stream based on the file descriptor. This API uses a promise to ret **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).| + | 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](#stream)> | Promise used to return the result.| + | Type | Description | + | --------------------------------- | --------- | + | Promise<[Stream](#stream)> | Promise used to return the result.| **Example** @@ -2311,11 +2311,11 @@ Opens a file stream based on the file descriptor. This API uses an asynchronous **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).| -| callback | AsyncCallback<[Stream](#stream)> | Yes | Callback invoked when the stream is open asynchronously. | + | 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).| + | callback | AsyncCallback<[Stream](#stream)> | Yes | Callback invoked when the stream is open asynchronously. | **Example** @@ -2338,16 +2338,16 @@ Synchronously opens a stream based on the file descriptor. **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).| + | 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](#stream) | Stream opened.| + | Type | Description | + | ------------------ | --------- | + | [Stream](#stream) | Stream opened.| **Example** @@ -2368,17 +2368,17 @@ Changes the file owner based on the file descriptor. This API uses a promise to **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ------------ | -| fd | number | Yes | File descriptor of the target file.| -| uid | number | Yes | New UID. | -| gid | number | Yes | New GID. | + | Name | Type | Mandatory | Description | + | ---- | ------ | ---- | ------------ | + | fd | number | Yes | File descriptor of the target file.| + | uid | number | Yes | New UID. | + | gid | number | Yes | New GID. | **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** @@ -2404,12 +2404,12 @@ Changes the file owner based on the file descriptor. This API uses an asynchrono **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ------------------------- | ---- | --------------- | -| fd | number | Yes | File descriptor of the target file. | -| uid | number | Yes | New UID. | -| gid | number | Yes | New GID. | -| callback | AsyncCallback<void> | Yes | Callback invoked when the file owner is changed asynchronously.| + | Name | Type | Mandatory | Description | + | -------- | ------------------------- | ---- | --------------- | + | fd | number | Yes | File descriptor of the target file. | + | uid | number | Yes | New UID. | + | gid | number | Yes | New GID. | + | callback | AsyncCallback<void> | Yes | Callback invoked when the file owner is changed asynchronously.| **Example** @@ -2433,11 +2433,11 @@ Synchronously changes the file owner based on the file descriptor. **Parameters** -| Name | Type | Mandatory | Description | -| ---- | ------ | ---- | ------------ | -| fd | number | Yes | File descriptor of the target file.| -| uid | number | Yes | New UID. | -| gid | number | Yes | New GID. | + | Name | Type | Mandatory | Description | + | ---- | ------ | ---- | ------------ | + | fd | number | Yes | File descriptor of the target file.| + | uid | number | Yes | New UID. | + | gid | number | Yes | New GID. | **Example** @@ -2467,9 +2467,9 @@ Changes the file owner (owner of the symbolic link, not the file referred to by **Return value** -| Type | Description | -| ------------------- | ---------------------------- | -| Promise<void> | Promise that returns no value.| + | Type | Description | + | ------------------- | ---------------------------- | + | Promise<void> | Promise that returns no value.| **Example** @@ -2550,14 +2550,14 @@ Listens for file or directory changes. This API uses an asynchronous callback to | Name | Type | Mandatory| Description | | -------- | --------------------------------- | ---- | ------------------------------------------------------------ | | filePath | string | Yes | Application sandbox path of the file. | -| events | number | Yes | - **1**: The file or directory is renamed.
- **2**: The file or directory is modified.
- **3**: The file or directory is modified and renamed.| +| events | number | Yes | -**1**: The file or directory is renamed.
- **2**: The file or directory is modified.
- **3**: The file or directory is modified and renamed.| | callback | AsyncCallback<number> | Yes | Called each time a change is detected. | **Return value** -| Type | Description | -| -------------------- | ---------- | -| [Watcher](#watcher7) | Promise used to return the **Watcher** instance.| + | Type | Description | + | -------------------- | ---------- | + | [Watcher](#watcher7) | Promise used to return the **Watcher** instance.| **Example** @@ -2595,7 +2595,7 @@ Provides detailed file information. Before calling a method of the **Stat** clas | ------ | ------ | ---- | ---- | ---------------------------------------- | | dev | number | Yes | No | Major device number. | | ino | number | Yes | No | File ID. Different files on the same device have different **ino**s. | -| mode | number | Yes | No | File type and permissions. The first four bits indicate the file type, and the last 12 bits indicate the permissions. The bit fields are described as follows:
- **0o170000**: mask used to obtain the file type.
- **0o140000**: The file is a socket.
- **0o120000**: The file is a symbolic link.
- **0o100000**: The file is a regular file.
- **0o060000**: The file is a block device.
- **0o040000**: The file is a directory.
- **0o020000**: The file is a character device.
- **0o010000**: The file is a named pipe (FIFO).
- **0o0700**: mask used to obtain the owner permissions.
- **0o0400**: The owner has the permission to read a regular file or a directory entry.
- **0o0200**: The owner has the permission to write a regular file or create and delete a directory entry.
- **0o0100**: The owner has the permission to execute a regular file or search for the specified path in a directory.
- **0o0070**: mask used to obtain the user group permissions.
- **0o0040**: The user group has the permission to read a regular file or a directory entry.
- **0o0020**: The user group has the permission to write a regular file or create and delete a directory entry.
- **0o0010**: The user group has the permission to execute a regular file or search for the specified path in a directory.
- **0o0007**: mask used to obtain the permissions of other users.
- **0o0004**: Other users have the permission to read a regular file or a directory entry.
- **0o0002**: Other users have the permission to write a regular file or create and delete a directory entry.
- **0o0001**: Other users have the permission to execute a regular file or search for the specified path in a directory.| +| mode | number | Yes | No | File type and permissions. The first four bits indicate the file type, and the last 12 bits indicate the permissions. The bit fields are described as follows:
- **0o170000**: mask used to obtain the file type.
- **0o140000**: The file is a socket.
- **0o120000**: The file is a symbolic link.
- **0o100000**: The file is a regular file.
- **0o060000**: The file is a block device.
- **0o040000**: The file is a directory.
- **0o020000**: The file is a character device.
- **0o010000**: The file is a named pipe, that is, FIFO.
- **0o0700**: mask used to obtain owner permissions.
- **0o0400**: The owner has the read permission on a regular file or a directory entry.
- **0o0200**: The owner has the permission to write a regular file or create and delete a directory entry.
- **0o0100**: The owner has the permission to execute a regular file or has the permission to search for the specified path in a directory.
- **0o0070**: mask used to obtain user group permissions.
- **0o0040**: The user group has the read permission on a regular file or a directory entry.
- **0o0020**: The user group has the permission to write a regular file or has the permission to create and delete a directory entry.
- **0o0010**: The user group has the permission to execute a regular file or has the permission to search for the specified path in a directory.
- **0o0007**: mask used to obtain permissions of other users.
- **0o0004**: Other user groups have the read permission on a regular file or a directory entry.
- **0o0002**: Other user groups have the permission to write a regular file or have the permission to create and delete a directory entry.
- **0o0001**: Other users have the permission to execute a regular file or search for the specified path in a directory.| | nlink | number | Yes | No | Number of hard links in the file. | | uid | number | Yes | No | User ID, that is ID of the file owner. | | gid | number | Yes | No | Group ID, that is, ID of the user group of the file. | @@ -2617,9 +2617,9 @@ Checks whether this file is a block special file. A block special file supports **Return value** -| Type | Description | -| ------- | ---------------- | -| boolean | Whether the file is a block special file.| + | Type | Description | + | ------- | ---------------- | + | boolean | Whether the file is a block special file.| **Example** @@ -2639,9 +2639,9 @@ Checks whether this file is a character special file. A character special file s **Return value** -| Type | Description | -| ------- | ----------------- | -| boolean | Whether the file is a character special file.| + | Type | Description | + | ------- | ----------------- | + | boolean | Whether the file is a character special file.| **Example** @@ -2661,9 +2661,9 @@ Checks whether this file is a directory. **Return value** -| Type | Description | -| ------- | ------------- | -| boolean | Whether the file is a directory.| + | Type | Description | + | ------- | ------------- | + | boolean | Whether the file is a directory.| **Example** @@ -2683,9 +2683,9 @@ Checks whether this file is a named pipe (or FIFO). Named pipes are used for int **Return value** -| Type | Description | -| ------- | --------------------- | -| boolean | Whether the file is an FIFO.| + | Type | Description | + | ------- | --------------------- | + | boolean | Whether the file is an FIFO.| **Example** @@ -2705,9 +2705,9 @@ Checks whether this file is a regular file. **Return value** -| Type | Description | -| ------- | --------------- | -| boolean | Whether the file is a regular file.| + | Type | Description | + | ------- | --------------- | + | boolean | Whether the file is a regular file.| **Example** @@ -2727,9 +2727,9 @@ Checks whether this file is a socket. **Return value** -| Type | Description | -| ------- | -------------- | -| boolean | Whether the file is a socket.| + | Type | Description | + | ------- | -------------- | + | boolean | Whether the file is a socket.| **Example** @@ -2749,9 +2749,9 @@ Checks whether this file is a symbolic link. **Return value** -| Type | Description | -| ------- | --------------- | -| boolean | Whether the file is a symbolic link.| + | Type | Description | + | ------- | --------------- | + | boolean | Whether the file is a symbolic link.| **Example** @@ -2797,9 +2797,9 @@ Stops the **watcher** instance. This API uses an asynchronous callback to return **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ------------------------- | ---- | ---------------------- | -| callback | AsyncCallback<void> | Yes | Callback invoked when **watcher** is stopped asynchronously.| + | Name | Type | Mandatory | Description | + | -------- | ------------------------- | ---- | ---------------------- | + | callback | AsyncCallback<void> | Yes | Callback invoked when **watcher** is stopped asynchronously.| **Example** @@ -2829,9 +2829,9 @@ Closes the stream. This API uses a promise to return the result. **Return value** -| Type | Description | -| ------------------- | ------------- | -| Promise<void> | Promise used to return the stream close result.| + | Type | Description | + | ------------------- | ------------- | + | Promise<void> | Promise used to return the stream close result.| **Example** @@ -2856,9 +2856,9 @@ Closes the stream. This API uses an asynchronous callback to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ------------------------- | ---- | ------------- | -| callback | AsyncCallback<void> | Yes | Callback invoked when the stream is closed asynchronously.| + | Name | Type | Mandatory | Description | + | -------- | ------------------------- | ---- | ------------- | + | callback | AsyncCallback<void> | Yes | Callback invoked when the stream is closed asynchronously.| **Example** @@ -2898,9 +2898,9 @@ Flushes the stream. This API uses a promise to return the result. **Return value** -| Type | Description | -| ------------------- | ------------- | -| Promise<void> | Promise used to return the stream flushing result.| + | Type | Description | + | ------------------- | ------------- | + | Promise<void> | Promise used to return the stream flushing result.| **Example** @@ -2925,9 +2925,9 @@ Flushes the stream. This API uses an asynchronous callback to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| -------- | ------------------------- | ---- | -------------- | -| callback | AsyncCallback<void> | Yes | Callback invoked when the stream is asynchronously flushed.| + | Name | Type | Mandatory | Description | + | -------- | ------------------------- | ---- | -------------- | + | callback | AsyncCallback<void> | Yes | Callback invoked when the stream is asynchronously flushed.| **Example** @@ -2967,16 +2967,16 @@ Writes data into the stream. This API uses a promise to return the result. **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 | + | 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 data to be encoded when the data is a string. 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.| + | Type | Description | + | --------------------- | -------- | + | Promise<number> | Promise used to return the length of the data written.| **Example** @@ -3001,11 +3001,11 @@ Writes data into the stream. This API uses an asynchronous callback to return th **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| -| callback | AsyncCallback<number> | Yes | Callback invoked when the data is written asynchronously. | + | 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 data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.
Constraints: offset + length <= Buffer size| + | callback | AsyncCallback<number> | Yes | Callback invoked when the data is written asynchronously. | **Example** @@ -3031,16 +3031,16 @@ Synchronously writes data into the stream. **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 | + | 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 data to be encoded when the data is a string. 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.| + | Type | Description | + | ------ | -------- | + | number | Length of the data written in the file.| **Example** @@ -3061,16 +3061,16 @@ Reads data from the stream. This API uses a promise to return the result. **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 | + | 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.| + | Type | Description | + | ---------------------------------- | ------ | + | Promise<[ReadOut](#readout)> | Promise used to return the data read.| **Example** @@ -3096,11 +3096,11 @@ Reads data from the stream. This API uses an asynchronous callback to return the **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 | -| callback | AsyncCallback<[ReadOut](#readout)> | Yes | Callback invoked when data is read asynchronously from the stream. | + | 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 | + | callback | AsyncCallback<[ReadOut](#readout)> | Yes | Callback invoked when data is read asynchronously from the stream. | **Example** @@ -3126,16 +3126,16 @@ Synchronously reads data from the stream. **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 | + | 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 | -| ------ | -------- | -| number | Length of the data read.| + | Type | Description | + | ------ | -------- | + | number | Length of the data read.| **Example** @@ -3161,9 +3161,9 @@ Reads the next directory entry. This API uses a promise to return the result. **Return value** -| Type | Description | -| -------------------------------- | ------------- | -| Promise<[Dirent](#dirent)> | Promise used to return the directory entry read.| + | Type | Description | + | -------------------------------- | ------------- | + | Promise<[Dirent](#dirent)> | Promise used to return the directory entry read.| **Example** @@ -3186,9 +3186,9 @@ Reads the next directory entry. This API uses an asynchronous callback to return **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------------------------------------- | ---- | ---------------- | -| callback | AsyncCallback<[Dirent](#dirent)> | Yes | Callback invoked when the next directory entry is asynchronously read.| + | Name | Type | Mandatory | Description | + | -------- | -------------------------------------- | ---- | ---------------- | + | callback | AsyncCallback<[Dirent](#dirent)> | Yes | Callback invoked when the next directory entry is asynchronously read.| **Example** @@ -3212,9 +3212,9 @@ Synchronously reads the next directory entry. **Return value** -| Type | Description | -| ----------------- | -------- | -| [Dirent](#dirent) | Directory entry read.| + | Type | Description | + | ----------------- | -------- | + | [Dirent](#dirent) | Directory entry read.| **Example** @@ -3295,9 +3295,9 @@ Checks whether this directory entry is a block special file. A block special fil **Return value** -| Type | Description | -| ------- | ---------------- | -| boolean | Whether the directory entry is a block special file.| + | Type | Description | + | ------- | ---------------- | + | boolean | Whether the directory entry is a block special file.| **Example** @@ -3317,9 +3317,9 @@ Checks whether a directory entry is a character special file. A character specia **Return value** -| Type | Description | -| ------- | ----------------- | -| boolean | Whether the directory entry is a character special file.| + | Type | Description | + | ------- | ----------------- | + | boolean | Whether the directory entry is a character special file.| **Example** @@ -3339,9 +3339,9 @@ Checks whether a directory entry is a directory. **Return value** -| Type | Description | -| ------- | ------------- | -| boolean | Whether the directory entry is a directory.| + | Type | Description | + | ------- | ------------- | + | boolean | Whether the directory entry is a directory.| **Example** @@ -3361,9 +3361,9 @@ Checks whether this directory entry is a named pipe (or FIFO). Named pipes are u **Return value** -| Type | Description | -| ------- | --------------- | -| boolean | Whether the directory entry is a FIFO.| + | Type | Description | + | ------- | --------------- | + | boolean | Whether the directory entry is a FIFO.| **Example** @@ -3383,9 +3383,9 @@ Checks whether a directory entry is a regular file. **Return value** -| Type | Description | -| ------- | --------------- | -| boolean | Whether the directory entry is a regular file.| + | Type | Description | + | ------- | --------------- | + | boolean | Whether the directory entry is a regular file.| **Example** @@ -3405,9 +3405,9 @@ Checks whether a directory entry is a socket. **Return value** -| Type | Description | -| ------- | -------------- | -| boolean | Whether the directory entry is a socket.| + | Type | Description | + | ------- | -------------- | + | boolean | Whether the directory entry is a socket.| **Example** @@ -3427,9 +3427,9 @@ Checks whether a directory entry is a symbolic link. **Return value** -| Type | Description | -| ------- | --------------- | -| boolean | Whether the directory entry is a symbolic link.| + | Type | Description | + | ------- | --------------- | + | boolean | Whether the directory entry is a symbolic link.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-freeInstall.md b/en/application-dev/reference/apis/js-apis-freeInstall.md index 937cc8437c21d80b54b241d746803e0aae9d4f18..160d0ebbcef331046e6bb52fb84971aba1cbe5b2 100644 --- a/en/application-dev/reference/apis/js-apis-freeInstall.md +++ b/en/application-dev/reference/apis/js-apis-freeInstall.md @@ -299,7 +299,7 @@ try { getBundlePackInfo(bundleName: string, bundlePackFlag : BundlePackFlag): Promise\; -Obtains **bundlePackInfo** based on **bundleName** and **bundleFlag**. This API uses a promise to return the result. +Obtains **bundlePackInfo** based on **bundleName** and **BundlePackFlag**. This API uses a promise to return the result. **System API**: This is a system API. diff --git a/en/application-dev/reference/apis/js-apis-geoLocationManager.md b/en/application-dev/reference/apis/js-apis-geoLocationManager.md index f9d6d9087b803775363799700cedc2f8dc31a2d1..263a1a525e0fa1dffcbd9e79703d2d359ac49dcc 100644 --- a/en/application-dev/reference/apis/js-apis-geoLocationManager.md +++ b/en/application-dev/reference/apis/js-apis-geoLocationManager.md @@ -1,6 +1,6 @@ # @ohos.geoLocationManager (Geolocation Manager) -The **geoLocationManager** module provides a wide array of location services, including GNSS positioning, network positioning, geocoding, reverse geocoding, and geofencing. +The **geoLocationManager** module provides location services such as Global Navigation Satellite System (GNSS)-based positioning, network positioning, geofencing, as well as geocoding and reverse geocoding. > **NOTE** > @@ -21,14 +21,14 @@ If your application needs to access the device location information, it must fir API versions earlier than 9: Apply for **ohos.permission.LOCATION**. -API version 9 and later: Apply for **ohos.permission.APPROXIMATELY_LOCATION**, or apply for **ohos.permission.APPROXIMATELY_LOCATION** and **ohos.permission.LOCATION**. Note that **ohos.permission.LOCATION** cannot be applied for separately. +API version 9 and later: Apply for **ohos.permission.APPROXIMATELY\_LOCATION**, or apply for **ohos.permission.APPROXIMATELY\_LOCATION** and **ohos.permission.LOCATION**. Note that **ohos.permission.LOCATION** cannot be applied for separately. | API Version| Location Permission| Permission Application Result| Location Accuracy| | -------- | -------- | -------- | -------- | -| Earlier than 9| ohos.permission.LOCATION | Successful| Location accurate to meters.| -| 9 and later| ohos.permission.LOCATION | Failed| No location obtained.| -| 9 and later| ohos.permission.APPROXIMATELY_LOCATION | Successful| Location accurate to 5 kilometers.| -| 9 and later| ohos.permission.APPROXIMATELY_LOCATION and ohos.permission.LOCATION| Successful| Location accurate to meters.| +| Earlier than 9| ohos.permission.LOCATION | Success| Location accurate to meters| +| 9 and later| ohos.permission.LOCATION | Failure| No location obtained| +| 9 and later| ohos.permission.APPROXIMATELY_LOCATION | Success| Location accurate to 5 kilometers| +| 9 and later| ohos.permission.APPROXIMATELY_LOCATION and ohos.permission.LOCATION| Success| Location accurate to meters| If your application needs to access the device location information when running in the background, it must be configured to be able to run in the background and be granted the **ohos.permission.LOCATION_IN_BACKGROUND** permission. In this way, the system continues to report device location information after your application moves to the background. @@ -99,7 +99,7 @@ Defines a geographic location. | addressUrl | string | Yes| No| Website URL.| | descriptions | Array<string> | Yes| No| Additional descriptions.| | descriptionsSize | number | Yes| No| Total number of additional descriptions. The value must be greater than or equal to **0**. A value smaller than **10** is recommended.| -| isFromMock | Boolean | Yes| No| Whether the geographic address is obtained from the mock reverse geocoding function.
**System API**: This is a system API.| +| isFromMock | Boolean | Yes| No| Whether the geographical name is from the mock reverse geocoding function.
**System API**: This is a system API.| ## LocationRequest @@ -229,12 +229,12 @@ Represents information of the mock reverse geocoding function. | Name| Type| Readable|Writable| Description| | -------- | -------- | -------- | -------- | -------- | | location | [ReverseGeoCodeRequest](#reversegeocoderequest) | Yes| Yes| Latitude and longitude information.| -| geoAddress | [GeoAddress](#geoaddress) | Yes| Yes|Geographic address.| +| geoAddress | [GeoAddress](#geoaddress) | Yes| Yes|Geographical name.| ## LocationMockConfig -Represents the mock location configuration. +Represents the information of the mock location function. **System capability**: SystemCapability.Location.Location.Core @@ -267,25 +267,25 @@ Sets the priority of the location request. | Name| Value| Description| | -------- | -------- | -------- | | UNSET | 0x200 | Priority unspecified.
If this option is used, [LocationRequestPriority](#locationrequestpriority) is invalid.| -| ACCURACY | 0x201 | Location accuracy preferred.
This policy mainly uses the GNSS positioning technology. In an open area, the technology can achieve the meter-level location accuracy, depending on the hardware performance of the device. However, in a shielded environment, the location accuracy may significantly decrease.| -| LOW_POWER | 0x202 | Power efficiency preferred.
This policy mainly uses the base station positioning, WLAN positioning, and Bluetooth positioning technologies to obtain device location in both indoor and outdoor scenarios. The location accuracy depends on the distribution of surrounding base stations, visible WLANs, and Bluetooth devices and therefore may fluctuate greatly. This policy is recommended and can reduce power consumption when your application does not require high location accuracy or when base stations, visible WLANs, and Bluetooth devices are densely distributed.| +| ACCURACY | 0x201 | Location accuracy.
This policy mainly uses the GNSS positioning technology. In an open area, the technology can achieve the meter-level location accuracy, depending on the hardware performance of the device. However, in a shielded environment, the location accuracy may significantly decrease.| +| LOW_POWER | 0x202 | Power efficiency.
This policy mainly uses the base station positioning, WLAN positioning, and Bluetooth positioning technologies to obtain device location in both indoor and outdoor scenarios. The location accuracy depends on the distribution of surrounding base stations, visible WLANs, and Bluetooth devices and therefore may fluctuate greatly. This policy is recommended and can reduce power consumption when your application does not require high location accuracy or when base stations, visible WLANs, and Bluetooth devices are densely distributed.| | FIRST_FIX | 0x203 | Fast location preferred. Use this option if you want to obtain a location as fast as possible.
This policy uses the GNSS positioning, base station positioning, WLAN positioning, and Bluetooth positioning technologies simultaneously to obtain the device location in both the indoor and outdoor scenarios. When all positioning technologies provide a location result, the system provides the most accurate location result for your application. It can lead to significant hardware resource consumption and power consumption.| ## LocationRequestScenario -Sets the scenario of the location request. + Sets the scenario of the location request. **System capability**: SystemCapability.Location.Location.Core | Name| Value| Description| | -------- | -------- | -------- | | UNSET | 0x300 | Scenario unspecified.
If this option is used, [LocationRequestScenario](#locationrequestscenario) is invalid.| -| NAVIGATION | 0x301 | Navigation scenario.
This option is applicable when your application needs to obtain the real-time location of a mobile device outdoors, such as navigation for driving or walking.
In this scenario, GNSS positioning is used to provide location services to ensure the optimal location accuracy of the system.
The location result is reported at a minimum interval of 1 second by default.| -| TRAJECTORY_TRACKING | 0x302 | Trajectory tracking scenario.
This option is applicable when your application needs to record user trajectories, for example, the track recording function of sports applications. In this scenario, the GNSS positioning technology is mainly used to ensure the location accuracy.
The location result is reported at a minimum interval of 1 second by default.| -| CAR_HAILING | 0x303 | Ride hailing scenario.
This option is applicable when your application needs to obtain the current location of a user who is hailing a taxi.
The location result is reported at a minimum interval of 1 second by default.| -| DAILY_LIFE_SERVICE | 0x304 | Daily life service scenario.
This option is applicable when your application only needs the approximate user location for recommendations and push notifications in scenarios such as when the user is browsing news, shopping online, and ordering food.
The location result is reported at a minimum interval of 1 second by default.| -| NO_POWER | 0x305 | Power efficiency scenario.
This option is applicable when your application does not proactively start the location service. When responding to another application requesting the same location service, the system marks a copy of the location result to your application. In this way, your application will not consume extra power for obtaining the user location.| +| NAVIGATION | 0x301 | Navigation.
This option is applicable when your application needs to obtain the real-time location of a mobile device outdoors, such as navigation for driving or walking.
In this scenario, GNSS positioning is used to provide location services to ensure the optimal location accuracy of the system.
The location result is reported at a minimum interval of 1 second by default.| +| TRAJECTORY_TRACKING | 0x302 | Trajectory tracking.
This option is applicable when your application needs to record user trajectories, for example, the track recording function of sports applications. In this scenario, the GNSS positioning technology is mainly used to ensure the location accuracy.
The location result is reported at a minimum interval of 1 second by default.| +| CAR_HAILING | 0x303 | Ride hailing.
This option is applicable when your application needs to obtain the current location of a user who is hailing a taxi.
The location result is reported at a minimum interval of 1 second by default.| +| DAILY_LIFE_SERVICE | 0x304 | Daily life services.
This option is applicable when your application only needs the approximate user location for recommendations and push notifications in scenarios such as when the user is browsing news, shopping online, and ordering food.
The location result is reported at a minimum interval of 1 second by default.| +| NO_POWER | 0x305 | Power efficiency. Your application does not proactively start the location service. When responding to another application requesting the same location service, the system marks a copy of the location result to your application. In this way, your application will not consume extra power for obtaining the user location.| ## LocationPrivacyType @@ -299,7 +299,7 @@ Defines the privacy statement type. | Name| Value| Description| | -------- | -------- | -------- | | OTHERS | 0 | Other scenarios. Reserved field.| -| STARTUP | 1 | Privacy statement displayed in the startup wizard. | +| STARTUP | 1 | Privacy statement displayed in the startup wizard. The user needs to choose whether to agree with the statement.| | CORE_LOCATION | 2 | Privacy statement displayed when enabling the location service.| @@ -323,7 +323,7 @@ on(type: 'locationChange', request: LocationRequest, callback: Callback<Locat Registers a listener for location changes with a location request initiated. -**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION +**Permission required**: ohos.permission.APPROXIMATELY_LOCATION **System capability**: SystemCapability.Location.Location.Core @@ -368,7 +368,7 @@ off(type: 'locationChange', callback?: Callback<Location>): void Unregisters the listener for location changes with the corresponding location request deleted. -**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION +**Permission required**: ohos.permission.APPROXIMATELY_LOCATION **System capability**: SystemCapability.Location.Location.Core @@ -489,7 +489,7 @@ on(type: 'cachedGnssLocationsChange', request: CachedGnssLocationsRequest, callb Registers a listener for cached GNSS location reports. -**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION +**Permission required**: ohos.permission.APPROXIMATELY_LOCATION **System capability**: SystemCapability.Location.Location.Gnss @@ -533,7 +533,7 @@ off(type: 'cachedGnssLocationsChange', callback?: Callback<Array<Location& Unregisters the listener for cached GNSS location reports. -**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION +**Permission required**: ohos.permission.APPROXIMATELY_LOCATION **System capability**: SystemCapability.Location.Location.Gnss @@ -577,7 +577,7 @@ on(type: 'satelliteStatusChange', callback: Callback<SatelliteStatusInfo>) Registers a listener for GNSS satellite status change events. -**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION +**Permission required**: ohos.permission.APPROXIMATELY_LOCATION **System capability**: SystemCapability.Location.Location.Gnss @@ -619,7 +619,7 @@ off(type: 'satelliteStatusChange', callback?: Callback<SatelliteStatusInfo> Unregisters the listener for GNSS satellite status change events. -**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION +**Permission required**: ohos.permission.APPROXIMATELY_LOCATION **System capability**: SystemCapability.Location.Location.Gnss @@ -662,7 +662,7 @@ on(type: 'nmeaMessage', callback: Callback<string>): void; Registers a listener for GNSS NMEA message change events. -**Permission required**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION +**Required permissions**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION **System capability**: SystemCapability.Location.Location.Gnss @@ -705,7 +705,7 @@ off(type: 'nmeaMessage', callback?: Callback<string>): void; Unregisters the listener for GNSS NMEA message change events. -**Permission required**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION +**Required permissions**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION **System capability**: SystemCapability.Location.Location.Gnss @@ -749,7 +749,7 @@ on(type: 'gnssFenceStatusChange', request: GeofenceRequest, want: WantAgent): vo Registers a listener for status change events of the specified geofence. -**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION +**Permission required**: ohos.permission.APPROXIMATELY_LOCATION **System capability**: SystemCapability.Location.Location.Geofence @@ -782,12 +782,12 @@ For details about the following error codes, see [Location Error Codes](../error { bundleName: "com.example.myapplication", abilityName: "EntryAbility", - action: "action1", + action: "action1" } ], operationType: wantAgent.OperationType.START_ABILITY, requestCode: 0, - wantAgentFlags: [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG], + wantAgentFlags: [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] }; wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => { @@ -807,7 +807,7 @@ off(type: 'gnssFenceStatusChange', request: GeofenceRequest, want: WantAgent): v Unregisters the listener for status change events of the specified geofence. -**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION +**Permission required**: ohos.permission.APPROXIMATELY_LOCATION **System capability**: SystemCapability.Location.Location.Geofence @@ -882,7 +882,6 @@ For details about the following error codes, see [Location Error Codes](../error | ID| Error Message| | -------- | ---------------------------------------- | |3301000 | Location service is unavailable. | -|3301100 | The location switch is off. | |3301500 | Failed to query the area information. | @@ -924,7 +923,6 @@ For details about the following error codes, see [Location Error Codes](../error | ID| Error Message| | -------- | ---------------------------------------- | |3301000 | Location service is unavailable. | -|3301100 | The location switch is off. | |3301500 | Failed to query the area information. | **Example** @@ -951,7 +949,7 @@ getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback<L Obtains the current location. This API uses an asynchronous callback to return the result. -**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION +**Permission required**: ohos.permission.APPROXIMATELY_LOCATION **System capability**: SystemCapability.Location.Location.Core @@ -999,7 +997,7 @@ getCurrentLocation(callback: AsyncCallback<Location>): void; Obtains the current location. This API uses an asynchronous callback to return the result. -**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION +**Permission required**: ohos.permission.APPROXIMATELY_LOCATION **System capability**: SystemCapability.Location.Location.Core @@ -1045,7 +1043,7 @@ getCurrentLocation(request?: CurrentLocationRequest): Promise<Location> Obtains the current location. This API uses a promise to return the result. -**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION +**Permission required**: ohos.permission.APPROXIMATELY_LOCATION **System capability**: SystemCapability.Location.Location.Core @@ -1095,7 +1093,7 @@ getLastLocation(): Location Obtains the last location. -**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION +**Permission required**: ohos.permission.APPROXIMATELY_LOCATION **System capability**: SystemCapability.Location.Location.Core @@ -1282,7 +1280,7 @@ For details about the following error codes, see [Location Error Codes](../error getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>): void -Converts coordinates into geographic descriptions through reverse geocoding. This API uses an asynchronous callback to return the result. +Converts coordinates into geographic description through reverse geocoding. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Location.Location.Geocoder @@ -1326,7 +1324,7 @@ For details about the following error codes, see [Location Error Codes](../error getAddressesFromLocation(request: ReverseGeoCodeRequest): Promise<Array<GeoAddress>>; -Converts coordinates into geographic descriptions through reverse geocoding. This API uses a promise to return the result. +Converts coordinates into geographic description through reverse geocoding. This API uses a promise to return the result. **System capability**: SystemCapability.Location.Location.Geocoder @@ -1373,7 +1371,7 @@ For details about the following error codes, see [Location Error Codes](../error getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>): void -Converts geographic descriptions into coordinates through geocoding. This API uses an asynchronous callback to return the result. +Converts geographic description into coordinates through geocoding. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Location.Location.Geocoder @@ -1417,7 +1415,7 @@ For details about the following error codes, see [Location Error Codes](../error getAddressesFromLocationName(request: GeoCodeRequest): Promise<Array<GeoAddress>> -Converts geographic descriptions into coordinates through geocoding. This API uses a promise to return the result. +Converts geographic description into coordinates through geocoding. This API uses a promise to return the result. **System capability**: SystemCapability.Location.Location.Geocoder @@ -1499,7 +1497,7 @@ getCachedGnssLocationsSize(callback: AsyncCallback<number>): void; Obtains the number of cached GNSS locations. -**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION +**Permission required**: ohos.permission.APPROXIMATELY_LOCATION **System capability**: SystemCapability.Location.Location.Gnss @@ -1543,7 +1541,7 @@ getCachedGnssLocationsSize(): Promise<number>; Obtains the number of cached GNSS locations. -**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION +**Permission required**: ohos.permission.APPROXIMATELY_LOCATION **System capability**: SystemCapability.Location.Location.Gnss @@ -1585,7 +1583,7 @@ flushCachedGnssLocations(callback: AsyncCallback<void>): void; Obtains all cached GNSS locations and clears the GNSS cache queue. -**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION +**Permission required**: ohos.permission.APPROXIMATELY_LOCATION **System capability**: SystemCapability.Location.Location.Gnss @@ -1627,7 +1625,7 @@ flushCachedGnssLocations(): Promise<void>; Obtains all cached GNSS locations and clears the GNSS cache queue. -**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION +**Permission required**: ohos.permission.APPROXIMATELY_LOCATION **System capability**: SystemCapability.Location.Location.Gnss @@ -2007,7 +2005,7 @@ For details about the following error codes, see [Location Error Codes](../error setReverseGeocodingMockInfo(mockInfos: Array<ReverseGeocodingMockInfo>): void; -Sets information of the mock reverse geocoding function, including the mapping between a location and geographic name. If the location is contained in the configurations during reverse geocoding query, the corresponding geographic name will be returned. +Sets information of the mock reverse geocoding function, including the mapping between a location and geographical name. If the location is contained in the configurations during reverse geocoding query, the corresponding geographical name will be returned. This API can be invoked only after [geoLocationManager.enableReverseGeocodingMock](#geolocationmanagerenablereversegeocodingmock) is called. @@ -2019,7 +2017,7 @@ This API can be invoked only after [geoLocationManager.enableReverseGeocodingMoc | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | mockInfos | Array<[ReverseGeocodingMockInfo](#reversegeocodingmockinfo)> | Yes| Array of information of the mock reverse geocoding function, including a location and a geographic address.| + | mockInfos | Array<[ReverseGeocodingMockInfo](#reversegeocodingmockinfo)> | Yes| Array of information of the mock reverse geocoding function, including a location and a geographical name.| **Error codes** @@ -2069,7 +2067,7 @@ Checks whether a user agrees with the privacy statement of the location service. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | - | boolean | boolean | NA | Whether the user agrees with the privacy statement.| + | boolean | boolean | NA | Callback used to return the result, which indicates whether the user agrees with the privacy statement.| **Error codes** @@ -2108,7 +2106,7 @@ Sets the user confirmation status for the privacy statement of the location serv | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | [LocationPrivacyType](#locationprivacytype) | Yes| Privacy statement type, for example, privacy statement displayed in the startup wizard or privacy statement displayed when the location service is enabled.| - | isConfirmed | boolean | Yes| Whether the user agrees with the privacy statement.| + | isConfirmed | boolean | Yes| Callback used to return the result, which indicates whether the user agrees with the privacy statement.| **Error codes** diff --git a/en/application-dev/reference/apis/js-apis-geolocation.md b/en/application-dev/reference/apis/js-apis-geolocation.md index 3cd5b2408e9f527194bcd78eb8a4d9a1ea579907..de7d46dc6b83bb64d24cb5a0e6c5c1857616c329 100644 --- a/en/application-dev/reference/apis/js-apis-geolocation.md +++ b/en/application-dev/reference/apis/js-apis-geolocation.md @@ -4,7 +4,7 @@ The **geolocation** module provides a wide array of location services, including > **NOTE** > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. -> The APIs provided by this module are no longer maintained since API version 9. You are advised to use [geoLocationManager](js-apis-geoLocationManager.md) instead. +> The APIs provided by this module are no longer maintained since API version 9. You are advised to use [geoLocationManager](js-apis-geoLocationManager.md). ## Applying for Permissions @@ -411,7 +411,7 @@ Registers a listener for status change events of the specified geofence. { bundleName: "com.example.myapplication", abilityName: "EntryAbility", - action: "action1", + action: "action1" } ], operationType: wantAgent.OperationType.START_ABILITY, @@ -1486,7 +1486,7 @@ Sets the priority of the location request. Enumerates error codes of the location service. > **NOTE**
-> This API is deprecated since API version 9. +> This API is deprecated since API version 9. You are advised to use [geoLocationManager](../errorcodes/errorcode-geoLocationManager.md). **Required permissions**: ohos.permission.LOCATION diff --git a/en/application-dev/reference/apis/js-apis-hiappevent.md b/en/application-dev/reference/apis/js-apis-hiappevent.md index 260c8c541809f723cee63a3cf7f7ce9374ff886d..e2ff3f6fa98d46577475cdaa86222b0eb3522b1f 100644 --- a/en/application-dev/reference/apis/js-apis-hiappevent.md +++ b/en/application-dev/reference/apis/js-apis-hiappevent.md @@ -1,8 +1,9 @@ # @ohos.hiAppEvent (Application Event Logging) -The HiAppEvent module provides the application event logging functions, such as writing application events to the event file and managing the event logging configuration. +The **hiAppEvent** module provides the application event logging functions, such as writing application events to the event file and managing the event logging configuration. > **NOTE** +> > - The APIs provided by this module are deprecated since API version 9. You are advised to use [`@ohos.hiviewdfx.hiAppEvent`](js-apis-hiviewdfx-hiappevent.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. @@ -19,7 +20,7 @@ Before using application event logging, you need to understand the requirements **Event Name** -An event name is a string that contains a maximum of 48 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a lowercase letter and cannot end with an underscore (_). +An event name is a string that contains a maximum of 48 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a lowercase letter and cannot end with an underscore (\_). **Event Type** @@ -30,9 +31,10 @@ An event type is an enumerated value of [EventType](#eventtype). An event parameter is an object in key-value pair format, where the key is the parameter name and the value is the parameter value. The requirements are as follows: - A parameter name is a string that contains a maximum of 16 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a lowercase letter and cannot end with an underscore (\_). -- The parameter value is a string, number, boolean, or array. -- When the parameter value is a string, its maximum length is 8*1024 characters. If this limit is exceeded, excess characters will be truncated. -- When the parameter value is an array, the elements in the array must be of the same type, which can only be string, number, or boolean. In addition, the number of elements must be less than 100. If this limit is exceeded, excess elements will be discarded. +- The parameter value can be of the string, number, boolean, or array type. +- If the parameter value is a string, its maximum length is 8*1024 characters. If this limit is exceeded, excess characters will be discarded. +- If the parameter value is a number, the value must be within the range of **Number.MIN_SAFE_INTEGER** to **Number.MAX_SAFE_INTEGER**. Otherwise, uncertain values may be generated. +- If the parameter value is an array, the elements in the array must be of the same type, which can only be string, number, or boolean. In addition, the number of elements must be less than 100. If this limit is exceeded, excess elements will be discarded. - The maximum number of parameters is 32. If this limit is exceeded, excess parameters will be discarded. **Event Callback** diff --git a/en/application-dev/reference/apis/js-apis-hichecker.md b/en/application-dev/reference/apis/js-apis-hichecker.md index 1a6339e406c98eb2dfd81239da3e852bcb4afe47..35c86ccd1c0143dea06b5f1a24634b6cc09a2187 100644 --- a/en/application-dev/reference/apis/js-apis-hichecker.md +++ b/en/application-dev/reference/apis/js-apis-hichecker.md @@ -46,11 +46,11 @@ Adds one or more rules. HiChecker detects unexpected operations or gives feedbac ```js try { // Add a rule. - hichecker.addCheckRule(hichecker.RULE_CAUTION_PRINT_LOG);} + hichecker.addCheckRule(hichecker.RULE_CAUTION_PRINT_LOG); // Add multiple rules. - hichecker.addCheckRule( - hichecker.RULE_CAUTION_PRINT_LOG | hichecker.RULE_CAUTION_TRIGGER_CRASH); -catch (err) { + // hichecker.addCheckRule( + // hichecker.RULE_CAUTION_PRINT_LOG | hichecker.RULE_CAUTION_TRIGGER_CRASH); +} catch (err) { console.error(`code: ${err.code}, message: ${err.message}`); } ``` @@ -76,9 +76,9 @@ try { // Remove a rule. hichecker.removeCheckRule(hichecker.RULE_CAUTION_PRINT_LOG); // Remove multiple rules. - hichecker.removeCheckRule( - hichecker.RULE_CAUTION_PRINT_LOG | hichecker.RULE_CAUTION_TRIGGER_CRASH); -catch (err) { + // hichecker.removeCheckRule( + // hichecker.RULE_CAUTION_PRINT_LOG | hichecker.RULE_CAUTION_TRIGGER_CRASH); +} catch (err) { console.error(`code: ${err.code}, message: ${err.message}`); } ``` @@ -113,7 +113,7 @@ try { // Check whether the added rule exists in the collection of added rules. hichecker.containsCheckRule(hichecker.RULE_THREAD_CHECK_SLOW_PROCESS); // return true; hichecker.containsCheckRule(hichecker.RULE_CAUTION_PRINT_LOG); // return false; -catch (err) { +} catch (err) { console.error(`code: ${err.code}, message: ${err.message}`); } ``` @@ -122,7 +122,9 @@ catch (err) { addRule(rule: bigint): void -> **NOTE**
This API is deprecated since API version 9. You are advised to use [hichecker.addCheckRule](#hicheckeraddcheckrule9) instead. +> **NOTE** +> +> This API is deprecated since API version 9. You are advised to use [hichecker.addCheckRule](#hicheckeraddcheckrule9). Adds one or more rules. HiChecker detects unexpected operations or gives feedback based on the added rules. @@ -149,7 +151,9 @@ hichecker.addRule( removeRule(rule: bigint): void -> **NOTE**
This API is deprecated since API version 9. You are advised to use [hichecker.removeCheckRule](#hicheckerremovecheckrule9) instead. +> **NOTE** +> +> This API is deprecated since API version 9. You are advised to use [hichecker.removeCheckRule](#hicheckerremovecheckrule9). Removes one or more rules. The removed rules will become ineffective. @@ -200,7 +204,9 @@ hichecker.getRule(); // return 1n; contains(rule: bigint): boolean -> **NOTE**
This API is deprecated since API version 9. You are advised to use [hichecker.containsCheckRule](#hicheckercontainscheckrule9) instead. +> **NOTE** +> +> This API is deprecated since API version 9. You are advised to use [hichecker.containsCheckRule](#hicheckercontainscheckrule9). Checks whether the specified rule exists in the collection of added rules. If the rule is of the thread level, this operation is performed only on the current thread. diff --git a/en/application-dev/reference/apis/js-apis-hidebug.md b/en/application-dev/reference/apis/js-apis-hidebug.md index 189d855e894451790976eee2c3816cf17ae950b9..186b2dc92d8bf4fd2693f06b5b6e062bb9a7fc29 100644 --- a/en/application-dev/reference/apis/js-apis-hidebug.md +++ b/en/application-dev/reference/apis/js-apis-hidebug.md @@ -1,10 +1,10 @@ # @ohos.hidebug (HiDebug) -The **hidebug** module provides APIs for you to obtain the memory usage of an application, including the static heap memory (native heap) and proportional set size (PSS) occupied by the application process. You can also export VM memory slices and collect VM CPU profiling data. - -> **NOTE**
+> **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 **hidebug** module provides APIs for you to obtain the memory usage of an application, including the static heap memory (native heap) and proportional set size (PSS) occupied by the application process. You can also export VM memory slices and collect VM CPU profiling data. ## Modules to Import @@ -19,31 +19,25 @@ getNativeHeapSize(): bigint Obtains the total heap memory size of this application. -This API is defined but not implemented in OpenHarmony 3.1 Release. - **System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug **Return value** -| Type | Description | +| Type | Description | | ------ | --------------------------- | | bigint | Total heap memory size of the application, in KB.| - **Example** ```js let nativeHeapSize = hidebug.getNativeHeapSize(); ``` - ## hidebug.getNativeHeapAllocatedSize getNativeHeapAllocatedSize(): bigint Obtains the allocated heap memory size of this application. -This API is defined but not implemented in OpenHarmony 3.1 Release. - **System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug **Return value** @@ -58,15 +52,12 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. let nativeHeapAllocatedSize = hidebug.getNativeHeapAllocatedSize(); ``` - ## hidebug.getNativeHeapFreeSize getNativeHeapFreeSize(): bigint Obtains the free heap memory size of this application. -This API is defined but not implemented in OpenHarmony 3.1 Release. - **System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug **Return value** @@ -80,7 +71,6 @@ This API is defined but not implemented in OpenHarmony 3.1 Release. let nativeHeapFreeSize = hidebug.getNativeHeapFreeSize(); ``` - ## hidebug.getPss getPss(): bigint @@ -100,7 +90,6 @@ Obtains the size of the physical memory actually used by the application process let pss = hidebug.getPss(); ``` - ## hidebug.getSharedDirty getSharedDirty(): bigint @@ -135,7 +124,6 @@ Obtains the size of the private dirty memory of a process. | ------ | -------------------------- | | bigint | Size of the private dirty memory of the process, in KB.| - **Example** ```js let privateDirty = hidebug.getPrivateDirty(); @@ -163,76 +151,6 @@ For example, if the CPU usage is **50%**, **0.5** is returned. let cpuUsage = hidebug.getCpuUsage(); ``` -## hidebug.startProfiling(deprecated) - -startProfiling(filename : string) : void - -> **NOTE**
This API is deprecated since API version 9. You are advised to use [hidebug.startJsCpuProfiling](#hidebugstartjscpuprofiling9) instead. - -Starts the profiling method. `startProfiling()` and `stopProfiling()` are called in pairs. `startProfiling()` always occurs before `stopProfiling()`; that is, calling the functions in the sequence similar to the following is prohibited: `start->start->stop`, `start->stop->stop`, and `start->start->stop->stop`. - -**System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ------ | ---- | ------------------------------------------------------------ | -| filename | string | Yes | User-defined profile name. The `filename.json` file is generated in the `files` directory of the application based on the specified `filename`.| - -**Example** - -```js -hidebug.startProfiling("cpuprofiler-20220216"); -// code block -// ... -// code block -hidebug.stopProfiling(); -``` - - - -## hidebug.stopProfiling(deprecated) - -stopProfiling() : void - -> **NOTE**
This API is deprecated since API version 9. You are advised to use [hidebug.stopJsCpuProfiling](#hidebugstopjscpuprofiling9) instead. - -Stops the profiling method. `startProfiling()` and `stopProfiling()` are called in pairs. `startProfiling()` always occurs before `stopProfiling()`; that is, calling the functions in the sequence similar to the following is prohibited: `start->start->stop`, `start->stop->stop`, and `start->start->stop->stop`. - -**System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug - -**Example** - -```js -hidebug.startProfiling("cpuprofiler-20220216"); -// code block -// ... -// code block -hidebug.stopProfiling(); -``` - -## hidebug.dumpHeapData(deprecated) - -dumpHeapData(filename : string) : void - -> **NOTE**
This API is deprecated since API version 9. You are advised to use [hidebug.dumpJsHeapData](#hidebugdumpjsheapdata9) instead. - -Exports the heap data. - -**System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | ------ | ---- | ------------------------------------------------------------ | -| filename | string | Yes | User-defined heap file name. The `filename.heapsnapshot` file is generated in the `files` directory of the application based on the specified `filename`.| - -**Example** - -```js -hidebug.dumpHeapData("heap-20220216"); -``` - ## hidebug.getServiceDump9+ getServiceDump(serviceid : number, fd : number, args : Array\) : void @@ -297,7 +215,7 @@ import hidebug from '@ohos.hidebug' try { hidebug.startJsCpuProfiling("cpu_profiling"); - ... + // ... hidebug.stopJsCpuProfiling(); } catch (error) { console.info(error.code) @@ -326,7 +244,7 @@ import hidebug from '@ohos.hidebug' try { hidebug.startJsCpuProfiling("cpu_profiling"); - ... + // ... hidebug.stopJsCpuProfiling(); } catch (error) { console.info(error.code) @@ -360,3 +278,71 @@ try { console.info(error.message) } ``` + +## hidebug.startProfiling(deprecated) + +startProfiling(filename : string) : void + +> **NOTE**
This API is deprecated since API version 9. You are advised to use [hidebug.startJsCpuProfiling](#hidebugstartjscpuprofiling9) instead. + +Starts the profiling method. `startProfiling()` and `stopProfiling()` are called in pairs. `startProfiling()` always occurs before `stopProfiling()`; that is, calling the functions in the sequence similar to the following is prohibited: `start->start->stop`, `start->stop->stop`, and `start->start->stop->stop`. + +**System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------ | ---- | ------------------------------------------------------------ | +| filename | string | Yes | User-defined profile name. The `filename.json` file is generated in the `files` directory of the application based on the specified `filename`.| + +**Example** + +```js +hidebug.startProfiling("cpuprofiler-20220216"); +// code block +// ... +// code block +hidebug.stopProfiling(); +``` + +## hidebug.stopProfiling(deprecated) + +stopProfiling() : void + +> **NOTE**
This API is deprecated since API version 9. You are advised to use [hidebug.stopJsCpuProfiling](#hidebugstopjscpuprofiling9) instead. + +Stops the profiling method. `startProfiling()` and `stopProfiling()` are called in pairs. `startProfiling()` always occurs before `stopProfiling()`; that is, calling the functions in the sequence similar to the following is prohibited: `start->start->stop`, `start->stop->stop`, and `start->start->stop->stop`. + +**System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug + +**Example** + +```js +hidebug.startProfiling("cpuprofiler-20220216"); +// code block +// ... +// code block +hidebug.stopProfiling(); +``` + +## hidebug.dumpHeapData(deprecated) + +dumpHeapData(filename : string) : void + +> **NOTE**
This API is deprecated since API version 9. You are advised to use [hidebug.dumpJsHeapData](#hidebugdumpjsheapdata9) instead. + +Exports the heap data. + +**System capability**: SystemCapability.HiviewDFX.HiProfiler.HiDebug + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------ | ---- | ------------------------------------------------------------ | +| filename | string | Yes | User-defined heap file name. The `filename.heapsnapshot` file is generated in the `files` directory of the application based on the specified `filename`.| + +**Example** + +```js +hidebug.dumpHeapData("heap-20220216"); +``` diff --git a/en/application-dev/reference/apis/js-apis-hiviewdfx-hiappevent.md b/en/application-dev/reference/apis/js-apis-hiviewdfx-hiappevent.md index 86e09db17bda0e6efa68bbeeb973a26f4a4ff467..03cad26cfecb5295b611d48fbc9f69862895ddb0 100644 --- a/en/application-dev/reference/apis/js-apis-hiviewdfx-hiappevent.md +++ b/en/application-dev/reference/apis/js-apis-hiviewdfx-hiappevent.md @@ -2,7 +2,8 @@ The **hiAppEvent** module provides application event-related functions, including flushing application events to a disk, querying and clearing application events, and customizing application event logging configuration. -> **NOTE**
+> **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. @@ -119,12 +120,12 @@ Defines parameters for an **AppEventInfo** object. **System capability**: SystemCapability.HiviewDFX.HiAppEvent -| Name | Type | Mandatory| Description | -| --------- | ----------------------- | ---- | ---------- | -| domain | string | Yes | Event domain.| -| name | string | Yes | Event name.| -| eventType | [EventType](#eventtype) | Yes | Event type.| -| params | object | Yes | Event parameters.| +| Name | Type | Mandatory| Description | +| --------- | ----------------------- | ---- | ------------------------------------------------------------ | +| domain | string | Yes | Event domain. Event domain name, which is a string of up to 32 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a lowercase letter and cannot end with an underscore (_).| +| name | string | Yes | Event name. Event name, which is a string of up to 48 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a lowercase letter and cannot end with an underscore (_).| +| eventType | [EventType](#eventtype) | Yes | Event type. | +| params | object | Yes | Event parameter object, which consists of a parameter name and a parameter value. The specifications are as follows:
- The parameter name is a string of up to 16 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a lowercase letter and cannot end with an underscore (_).
- The parameter value can be a string, number, boolean, or array. If the parameter value is a string, its maximum length is 8*1024 characters. If this limit is exceeded, excess characters will be discarded. If the parameter value is a number, the value must be within the range of **Number.MIN_SAFE_INTEGER** to **Number.MAX_SAFE_INTEGER**. Otherwise, uncertain values may be generated. If the parameter value is an array, the elements in the array must be of the same type, which can only be string, number, or boolean. In addition, the number of elements must be less than 100. If this limit is exceeded, excess elements will be discarded.
- The maximum number of parameters is 32. If this limit is exceeded, excess parameters will be discarded.| ## hiAppEvent.configure @@ -447,27 +448,27 @@ Enumerates event types. | BEHAVIOR | 4 | Behavior event.| -## Event +## event Provides constants that define the names of all predefined events. **System capability**: SystemCapability.HiviewDFX.HiAppEvent -| Name | Type | Readable| Writable| Description | -| ------------------------- | ------ | ---- | ---- | -------------------- | -| USER_LOGIN | string | Yes | No | User login event. | -| USER_LOGOUT | string | Yes | No | User logout event. | -| DISTRIBUTED_SERVICE_START | string | Yes | No | Distributed service startup event.| +| Name | Type | Description | +| ------------------------- | ------ | -------------------- | +| USER_LOGIN | string | User login event. | +| USER_LOGOUT | string | User logout event. | +| DISTRIBUTED_SERVICE_START | string | Distributed service startup event.| -## Param +## param Provides constants that define the names of all predefined event parameters. **System capability**: SystemCapability.HiviewDFX.HiAppEvent -| Name | Type | Readable| Writable| Description | -| ------------------------------- | ------ | ---- | ---- | ------------------ | -| USER_ID | string | Yes | No | Custom user ID. | -| DISTRIBUTED_SERVICE_NAME | string | Yes | No | Distributed service name. | -| DISTRIBUTED_SERVICE_INSTANCE_ID | string | Yes | No | Distributed service instance ID.| +| Name | Type | Description | +| ------------------------------- | ------ | ------------------ | +| USER_ID | string | Custom user ID. | +| DISTRIBUTED_SERVICE_NAME | string | Distributed service name. | +| DISTRIBUTED_SERVICE_INSTANCE_ID | string | Distributed service instance ID.| diff --git a/en/application-dev/reference/apis/js-apis-http.md b/en/application-dev/reference/apis/js-apis-http.md index 3735792dd3f5ce66569fbebf3a1036019e7457ed..1d0ef9bbc8c424b0e6538a55993cc5f993f7af20 100644 --- a/en/application-dev/reference/apis/js-apis-http.md +++ b/en/application-dev/reference/apis/js-apis-http.md @@ -2,8 +2,10 @@ The **http** module provides the HTTP data request capability. An application can initiate a data request over HTTP. Common HTTP methods include **GET**, **POST**, **OPTIONS**, **HEAD**, **PUT**, **DELETE**, **TRACE**, and **CONNECT**. -> **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 @@ -11,9 +13,10 @@ The **http** module provides the HTTP data request capability. An application ca import http from '@ohos.net.http'; ``` -## Example +## Examples ```js +// Import the http namespace. import http from '@ohos.net.http'; // Each httpRequest corresponds to an HTTP request task and cannot be reused. @@ -24,7 +27,7 @@ httpRequest.on('headersReceive', (header) => { console.info('header: ' + JSON.stringify(header)); }); httpRequest.request( - // Customize EXAMPLE_URL on your own. It is up to you whether to add parameters to the URL. + // Customize EXAMPLE_URL in extraData on your own. It is up to you whether to add parameters to the URL. "EXAMPLE_URL", { method: http.RequestMethod.POST, // Optional. The default value is http.RequestMethod.GET. @@ -42,16 +45,19 @@ httpRequest.request( connectTimeout: 60000 // Optional. The default value is 60000, in ms. readTimeout: 60000, // Optional. The default value is 60000, in ms. usingProtocol: http.HttpProtocol.HTTP1_1, // Optional. The default protocol type is automatically specified by the system. + usingProxy: false, // Optional. By default, network proxy is not used. This field is supported since API 10. }, (err, data) => { if (!err) { // data.result carries the HTTP response. Parse the response based on service requirements. - console.info('Result:' + data.result); - console.info('code:' + data.responseCode); + console.info('Result:' + JSON.stringify(data.result)); + console.info('code:' + JSON.stringify(data.responseCode)); // data.header carries the HTTP response header. Parse the content based on service requirements. console.info('header:' + JSON.stringify(data.header)); - console.info('cookies:' + data.cookies); // 8+ + console.info('cookies:' + JSON.stringify(data.cookies)); // 8+ } else { console.info('error:' + JSON.stringify(err)); + // Unsubscribe from HTTP Response Header events. + httpRequest.off('headersReceive'); // Call the destroy() method to release resources after HttpRequest is complete. httpRequest.destroy(); } @@ -61,17 +67,17 @@ httpRequest.request( ## http.createHttp -createHttp\(\): HttpRequest +createHttp(): HttpRequest -Creates an HTTP request. You can use this API to initiate or destroy an HTTP request, or enable or disable listening for HTTP Response Header events. An HttpRequest object corresponds to an HTTP request. To initiate multiple HTTP requests, you must create an **HttpRequest** object for each HTTP request. +Creates an HTTP request. You can use this API to initiate or destroy an HTTP request, or enable or disable listening for HTTP Response Header events. An **HttpRequest** object corresponds to an HTTP request. To initiate multiple HTTP requests, you must create an **HttpRequest** object for each HTTP request. **System capability**: SystemCapability.Communication.NetStack **Return value** | Type | Description | -| ---------- | ----------------------------------------------------------- | -| HttpRequest | An **HttpRequest** object, which contains the **request**, **destroy**, **on**, or **off** method.| +| :---------- | :----------------------------------------------------------- | +| HttpRequest | An **HttpRequest** object, which contains the **request**, **request2**, **destroy**, **on**, or **off** method.| **Example** @@ -82,14 +88,17 @@ let httpRequest = http.createHttp(); ## HttpRequest -Defines an HTTP request task. Before invoking APIs provided by **HttpRequest**, you must call [createHttp\(\)](#httpcreatehttp) to create an **HttpRequestTask** object. +Defines an HTTP request task. Before invoking APIs provided by **HttpRequest**, you must call [createHttp()](#httpcreatehttp) to create an **HttpRequestTask** object. ### request -request\(url: string, callback: AsyncCallback\\):void +request(url: string, callback: AsyncCallback\):void Initiates an HTTP request to a given URL. This API uses an asynchronous callback to return the result. +>**NOTE** +>This API supports only transfer of data not greater than 5 MB. + **Required permissions**: ohos.permission.INTERNET **System capability**: SystemCapability.Communication.NetStack @@ -101,6 +110,22 @@ Initiates an HTTP request to a given URL. This API uses an asynchronous callback | url | string | Yes | URL for initiating an HTTP request.| | callback | AsyncCallback\<[HttpResponse](#httpresponse)\> | Yes | Callback used to return the result. | +**Error codes** + +| Code | Error Message | +|---------|-------------------------------------------------------| +| 401 | Parameter error. | +| 201 | Permission denied. | +| 2300003 | URL using bad/illegal format or missing URL. | +| 2300007 | Couldn't connect to server. | +| 2300028 | Timeout was reached. | +| 2300052 | Server returned nothing (no headers, no data). | +| 2300999 | Unknown Other Error. | + +>**NOTE** +> For details about the error codes, see [HTTP Error Codes](../errorcodes/errorcode-net-http.md). +> The HTTP error code mapping is in the format of 2300000 + Curl error code. For more common error codes, see [Curl Error Codes](https://curl.se/libcurl/c/libcurl-errors.html). + **Example** ```js @@ -118,10 +143,13 @@ httpRequest.request("EXAMPLE_URL", (err, data) => { ### request -request\(url: string, options: HttpRequestOptions, callback: AsyncCallback\):void +request(url: string, options: HttpRequestOptions, callback: AsyncCallback\):void Initiates an HTTP request containing specified options to a given URL. This API uses an asynchronous callback to return the result. +>**NOTE** +>This API supports only transfer of data not greater than 5 MB. + **Required permissions**: ohos.permission.INTERNET **System capability**: SystemCapability.Communication.NetStack @@ -134,6 +162,46 @@ Initiates an HTTP request containing specified options to a given URL. This API | options | HttpRequestOptions | Yes | Request options. For details, see [HttpRequestOptions](#httprequestoptions).| | callback | AsyncCallback\<[HttpResponse](#httpresponse)\> | Yes | Callback used to return the result. | +**Error codes** + +| Code | Error Message | +|---------|-------------------------------------------------------| +| 401 | Parameter error. | +| 201 | Permission denied. | +| 2300001 | Unsupported protocol. | +| 2300003 | URL using bad/illegal format or missing URL. | +| 2300005 | Couldn't resolve proxy name. | +| 2300006 | Couldn't resolve host name. | +| 2300007 | Couldn't connect to server. | +| 2300008 | Weird server reply. | +| 2300009 | Access denied to remote resource. | +| 2300016 | Error in the HTTP2 framing layer. | +| 2300018 | Transferred a partial file. | +| 2300023 | Failed writing received data to disk/application. | +| 2300025 | Upload failed. | +| 2300026 | Failed to open/read local data from file/application. | +| 2300027 | Out of memory. | +| 2300028 | Timeout was reached. | +| 2300047 | Number of redirects hit maximum amount. | +| 2300052 | Server returned nothing (no headers, no data). | +| 2300055 | Failed sending data to the peer. | +| 2300056 | Failure when receiving data from the peer. | +| 2300058 | Problem with the local SSL certificate. | +| 2300059 | Couldn't use specified SSL cipher. | +| 2300060 | SSL peer certificate or SSH remote key was not OK. | +| 2300061 | Unrecognized or bad HTTP Content or Transfer-Encoding.| +| 2300063 | Maximum file size exceeded. | +| 2300070 | Disk full or allocation exceeded. | +| 2300073 | Remote file already exists. | +| 2300077 | Problem with the SSL CA cert (path? access rights?). | +| 2300078 | Remote file not found. | +| 2300094 | An authentication function returned an error. | +| 2300999 | Unknown Other Error. | + +>**NOTE** +> For details about the error codes, see [HTTP Error Codes](../errorcodes/errorcode-net-http.md). +> The HTTP error code mapping is in the format of 2300000 + Curl error code. For more common error codes, see [Curl Error Codes](https://curl.se/libcurl/c/libcurl-errors.html). + **Example** ```js @@ -161,9 +229,12 @@ httpRequest.request("EXAMPLE_URL", ### request -request\(url: string, options? : HttpRequestOptions\): Promise +request(url: string, options? : HttpRequestOptions): Promise\ -Initiates an HTTP request to a given URL. This API uses a promise to return the result. +Initiates an HTTP request containing specified options to a given URL. This API uses a promise to return the result. + +>**NOTE** +>This API supports only transfer of data not greater than 5 MB. **Required permissions**: ohos.permission.INTERNET @@ -179,9 +250,48 @@ Initiates an HTTP request to a given URL. This API uses a promise to return the **Return value** | Type | Description | -| ------------------------------------- | -------------------------------- | +| :------------------------------------- | :-------------------------------- | | Promise<[HttpResponse](#httpresponse)> | Promise used to return the result.| +**Error codes** + +| Code | Error Message | +|---------|-------------------------------------------------------| +| 401 | Parameter error. | +| 201 | Permission denied. | +| 2300001 | Unsupported protocol. | +| 2300003 | URL using bad/illegal format or missing URL. | +| 2300005 | Couldn't resolve proxy name. | +| 2300006 | Couldn't resolve host name. | +| 2300007 | Couldn't connect to server. | +| 2300008 | Weird server reply. | +| 2300009 | Access denied to remote resource. | +| 2300016 | Error in the HTTP2 framing layer. | +| 2300018 | Transferred a partial file. | +| 2300023 | Failed writing received data to disk/application. | +| 2300025 | Upload failed. | +| 2300026 | Failed to open/read local data from file/application. | +| 2300027 | Out of memory. | +| 2300028 | Timeout was reached. | +| 2300047 | Number of redirects hit maximum amount. | +| 2300052 | Server returned nothing (no headers, no data). | +| 2300055 | Failed sending data to the peer. | +| 2300056 | Failure when receiving data from the peer. | +| 2300058 | Problem with the local SSL certificate. | +| 2300059 | Couldn't use specified SSL cipher. | +| 2300060 | SSL peer certificate or SSH remote key was not OK. | +| 2300061 | Unrecognized or bad HTTP Content or Transfer-Encoding.| +| 2300063 | Maximum file size exceeded. | +| 2300070 | Disk full or allocation exceeded. | +| 2300073 | Remote file already exists. | +| 2300077 | Problem with the SSL CA cert (path? access rights?). | +| 2300078 | Remote file not found. | +| 2300094 | An authentication function returned an error. | +| 2300999 | Unknown Other Error. | + +>**NOTE** +> For details about the error codes, see [HTTP Error Codes](../errorcodes/errorcode-net-http.md). +> The HTTP error code mapping is in the format of 2300000 + Curl error code. For more common error codes, see [Curl Error Codes](https://curl.se/libcurl/c/libcurl-errors.html). **Example** @@ -208,7 +318,7 @@ promise.then((data) => { ### destroy -destroy\(\): void +destroy(): void Destroys an HTTP request. @@ -220,14 +330,217 @@ Destroys an HTTP request. httpRequest.destroy(); ``` -### on\('headerReceive'\) +### request210+ + +request2(url: string, callback: AsyncCallback\): void + +Initiates an HTTP request to a given URL. This API uses an asynchronous callback to return the result, which is a streaming response. + +**Required permissions**: ohos.permission.INTERNET + +**System capability**: SystemCapability.Communication.NetStack + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------------------------------- | ---- | ----------------------------------------------- | +| url | string | Yes | URL for initiating an HTTP request. | +| callback | AsyncCallback\<[number](#responsecode)\> | Yes | Callback used to return the result. | + +**Error codes** + +| Code | Error Message | +|---------|-------------------------------------------------------| +| 401 | Parameter error. | +| 201 | Permission denied. | +| 2300003 | URL using bad/illegal format or missing URL. | +| 2300007 | Couldn't connect to server. | +| 2300028 | Timeout was reached. | +| 2300052 | Server returned nothing (no headers, no data). | +| 2300999 | Unknown Other Error. | + +>**NOTE** +> For details about the error codes, see [HTTP Error Codes](../errorcodes/errorcode-net-http.md). +> The HTTP error code mapping is in the format of 2300000 + Curl error code. For more common error codes, see [Curl Error Codes](https://curl.se/libcurl/c/libcurl-errors.html). + +**Example** + +```js +httpRequest.request2("EXAMPLE_URL", (err, data) => { + if (!err) { + console.info("request2 OK! ResponseCode is " + JSON.stringify(data)); + } else { + console.info("request2 ERROR : err = " + JSON.stringify(err)); + } +}) +``` + +### request210+ + +request2(url: string, options: HttpRequestOptions, callback: AsyncCallback\): void + +Initiates an HTTP request to a given URL. This API uses an asynchronous callback to return the result, which is a streaming response. + +**Required permissions**: ohos.permission.INTERNET + +**System capability**: SystemCapability.Communication.NetStack + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------------------------------- | ---- | ----------------------------------------------- | +| url | string | Yes | URL for initiating an HTTP request. | +| options | HttpRequestOptions | Yes | Request options. For details, see [HttpRequestOptions](#httprequestoptions).| +| callback | AsyncCallback\<[number](#responsecode)\> | Yes | Callback used to return the result. | + +**Error codes** + +| Code | Error Message | +|---------|-------------------------------------------------------| +| 401 | Parameter error. | +| 201 | Permission denied. | +| 2300001 | Unsupported protocol. | +| 2300003 | URL using bad/illegal format or missing URL. | +| 2300005 | Couldn't resolve proxy name. | +| 2300006 | Couldn't resolve host name. | +| 2300007 | Couldn't connect to server. | +| 2300008 | Weird server reply. | +| 2300009 | Access denied to remote resource. | +| 2300016 | Error in the HTTP2 framing layer. | +| 2300018 | Transferred a partial file. | +| 2300023 | Failed writing received data to disk/application. | +| 2300025 | Upload failed. | +| 2300026 | Failed to open/read local data from file/application. | +| 2300027 | Out of memory. | +| 2300028 | Timeout was reached. | +| 2300047 | Number of redirects hit maximum amount. | +| 2300052 | Server returned nothing (no headers, no data). | +| 2300055 | Failed sending data to the peer. | +| 2300056 | Failure when receiving data from the peer. | +| 2300058 | Problem with the local SSL certificate. | +| 2300059 | Couldn't use specified SSL cipher. | +| 2300060 | SSL peer certificate or SSH remote key was not OK. | +| 2300061 | Unrecognized or bad HTTP Content or Transfer-Encoding.| +| 2300063 | Maximum file size exceeded. | +| 2300070 | Disk full or allocation exceeded. | +| 2300073 | Remote file already exists. | +| 2300077 | Problem with the SSL CA cert (path? access rights?). | +| 2300078 | Remote file not found. | +| 2300094 | An authentication function returned an error. | +| 2300999 | Unknown Other Error. | + +>**NOTE** +> For details about the error codes, see [HTTP Error Codes](../errorcodes/errorcode-net-http.md). +> The HTTP error code mapping is in the format of 2300000 + Curl error code. For more common error codes, see [Curl Error Codes](https://curl.se/libcurl/c/libcurl-errors.html). + +**Example** + +```js +httpRequest.request2("EXAMPLE_URL", +{ + method: http.RequestMethod.GET, + header: { + 'Content-Type': 'application/json' + }, + readTimeout: 60000, + connectTimeout: 60000 +}, (err, data) => { + if (!err) { + console.info("request2 OK! ResponseCode is " + JSON.stringify(data)); + } else { + console.info("request2 ERROR : err = " + JSON.stringify(err)); + } +}) +``` +### request210+ + +request2(url: string, options? : HttpRequestOptions): Promise\ + +Initiates an HTTP request containing specified options to a given URL. This API uses a promise to return the result, which is a streaming response. + +**Required permissions**: ohos.permission.INTERNET + +**System capability**: SystemCapability.Communication.NetStack + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------------------ | ---- | ----------------------------------------------- | +| url | string | Yes | URL for initiating an HTTP request. | +| options | HttpRequestOptions | No | Request options. For details, see [HttpRequestOptions](#httprequestoptions).| + +**Return value** + +| Type | Description | +| :------------------------------------- | :-------------------------------- | +| Promise\<[number](#responsecode)\> | Promise used to return the result.| + +**Error codes** + +| Code | Error Message | +|---------|-------------------------------------------------------| +| 401 | Parameter error. | +| 201 | Permission denied. | +| 2300001 | Unsupported protocol. | +| 2300003 | URL using bad/illegal format or missing URL. | +| 2300005 | Couldn't resolve proxy name. | +| 2300006 | Couldn't resolve host name. | +| 2300007 | Couldn't connect to server. | +| 2300008 | Weird server reply. | +| 2300009 | Access denied to remote resource. | +| 2300016 | Error in the HTTP2 framing layer. | +| 2300018 | Transferred a partial file. | +| 2300023 | Failed writing received data to disk/application. | +| 2300025 | Upload failed. | +| 2300026 | Failed to open/read local data from file/application. | +| 2300027 | Out of memory. | +| 2300028 | Timeout was reached. | +| 2300047 | Number of redirects hit maximum amount. | +| 2300052 | Server returned nothing (no headers, no data). | +| 2300055 | Failed sending data to the peer. | +| 2300056 | Failure when receiving data from the peer. | +| 2300058 | Problem with the local SSL certificate. | +| 2300059 | Couldn't use specified SSL cipher. | +| 2300060 | SSL peer certificate or SSH remote key was not OK. | +| 2300061 | Unrecognized or bad HTTP Content or Transfer-Encoding.| +| 2300063 | Maximum file size exceeded. | +| 2300070 | Disk full or allocation exceeded. | +| 2300073 | Remote file already exists. | +| 2300077 | Problem with the SSL CA cert (path? access rights?). | +| 2300078 | Remote file not found. | +| 2300094 | An authentication function returned an error. | +| 2300999 | Unknown Other Error. | + +>**NOTE** +> For details about the error codes, see [HTTP Error Codes](../errorcodes/errorcode-net-http.md). +> The HTTP error code mapping is in the format of 2300000 + Curl error code. For more common error codes, see [Curl Error Codes](https://curl.se/libcurl/c/libcurl-errors.html). + +**Example** + +```js +let promise = httpRequest.request("EXAMPLE_URL", { + method: http.RequestMethod.GET, + connectTimeout: 60000, + readTimeout: 60000, + header: { + 'Content-Type': 'application/json' + } +}); +promise.then((data) => { + console.info("request2 OK!" + JSON.stringify(data)); +}).catch((err) => { + console.info("request2 ERROR : err = " + JSON.stringify(err)); +}); +``` + +### on('headerReceive') -on\(type: 'headerReceive', callback: AsyncCallback\): void +on(type: 'headerReceive', callback: AsyncCallback\): void Registers an observer for HTTP Response Header events. >**NOTE** ->This API has been deprecated. You are advised to use [on\('headersReceive'\)8+](#onheadersreceive8) instead. +>This API has been deprecated. You are advised to use [on('headersReceive')8+](#onheadersreceive8). **System capability**: SystemCapability.Communication.NetStack @@ -241,24 +554,20 @@ Registers an observer for HTTP Response Header events. **Example** ```js -httpRequest.on('headerReceive', (err, data) => { - if (!err) { - console.info('header: ' + JSON.stringify(data)); - } else { - console.info('error:' + JSON.stringify(err)); - } +httpRequest.on('headerReceive', (data) => { + console.info('error:' + JSON.stringify(data)); }); ``` -### off\('headerReceive'\) +### off('headerReceive') -off\(type: 'headerReceive', callback?: AsyncCallback\): void +off(type: 'headerReceive', callback?: AsyncCallback\): void Unregisters the observer for HTTP Response Header events. >**NOTE** > ->1. This API has been deprecated. You are advised to use [off\('headersReceive'\)8+](#offheadersreceive8) instead. +>1. This API has been deprecated. You are advised to use [off('headersReceive')8+](#offheadersreceive8). > >2. You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events. @@ -277,9 +586,9 @@ Unregisters the observer for HTTP Response Header events. httpRequest.off('headerReceive'); ``` -### on\('headersReceive'\)8+ +### on('headersReceive')8+ -on\(type: 'headersReceive', callback: Callback\): void +on(type: 'headersReceive', callback: Callback\): void Registers an observer for HTTP Response Header events. @@ -300,9 +609,9 @@ httpRequest.on('headersReceive', (header) => { }); ``` -### off\('headersReceive'\)8+ +### off('headersReceive')8+ -off\(type: 'headersReceive', callback?: Callback\): void +off(type: 'headersReceive', callback?: Callback\): void Unregisters the observer for HTTP Response Header events. @@ -324,9 +633,9 @@ Unregisters the observer for HTTP Response Header events. httpRequest.off('headersReceive'); ``` -### once\('headersReceive'\)8+ +### once('headersReceive')8+ -once\(type: 'headersReceive', callback: Callback\): void +once(type: 'headersReceive', callback: Callback\): void Registers a one-time observer for HTTP Response Header events. Once triggered, the observer will be removed. This API uses an asynchronous callback to return the result. @@ -346,7 +655,146 @@ httpRequest.once('headersReceive', (header) => { console.info('header: ' + JSON.stringify(header)); }); ``` +### on('dataReceive')10+ + +on(type: 'dataReceive', callback: Callback\): void + +Registers an observer for events indicating receiving of HTTP streaming responses. + +**System capability**: SystemCapability.Communication.NetStack + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ----------------------- | ---- | --------------------------------- | +| type | string | Yes | Event type. The value is **dataReceive**.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. | + +**Example** + +```js +httpRequest.on('dataReceive', (data) => { + console.info('dataReceive length: ' + JSON.stringify(data.byteLength)); +}); +``` + +### off('dataReceive')10+ + +off(type: 'dataReceive', callback?: Callback\): void + +Unregisters the observer for events indicating receiving of HTTP streaming responses. + +>**NOTE** +>You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events. + +**System capability**: SystemCapability.Communication.NetStack + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------ | ---- | -------------------------------------- | +| type | string | Yes | Event type. The value is **dataReceive**.| +| callback | Callback\ | No | Callback used to return the result. | + +**Example** + +```js +httpRequest.off('dataReceive'); +``` + +### on('dataEnd')10+ + +on(type: 'dataEnd', callback: Callback\): void + +Registers an observer for events indicating completion of receiving HTTP streaming responses. + +**System capability**: SystemCapability.Communication.NetStack + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ----------------------- | ---- | --------------------------------- | +| type | string | Yes | Event type. The value is **dataEnd**.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. | + +**Example** + +```js +httpRequest.on('dataReceive', () => { + console.info('Receive dataEnd! '); +}); +``` + +### off('dataEnd')10+ + +off(type: 'dataEnd', callback?: Callback\): void + +Unregisters the observer for events indicating completion of receiving HTTP streaming responses. + +>**NOTE** +>You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events. + +**System capability**: SystemCapability.Communication.NetStack + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------ | ---- | -------------------------------------- | +| type | string | Yes | Event type. The value is **dataEnd**.| +| callback | Callback\ | No | Callback used to return the result. | + +**Example** + +```js +httpRequest.off('dataEnd'); +``` + +### on('dataProgress')10+ + + on(type: 'dataProgress', callback: Callback\<{ receiveSize: number, totalSize: number }\>): void + +Registers an observer for events indicating progress of receiving HTTP streaming responses. + +**System capability**: SystemCapability.Communication.NetStack + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ----------------------- | ---- | --------------------------------- | +| type | string | Yes | Event type. The value is **dataProgress**.| +| callback | AsyncCallback\<{ receiveSize: number, totalSize: number }\> | Yes | Callback used to return the result.
**receiveSize**: number of received bytes.
**totalSize**: total number of bytes to be received.| + +**Example** + +```js +httpRequest.on('dataProgress', (data) => { + console.info('dataProgress:' + JSON.stringify(data)); +}); +``` + +### off('dataProgress')10+ + +off(type: 'dataProgress', callback?: Callback\<{ receiveSize: number, totalSize: number }\>): void + +Unregisters the observer for events indicating progress of receiving HTTP streaming responses. + +>**NOTE** +>You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events. +**System capability**: SystemCapability.Communication.NetStack + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------ | ---- | -------------------------------------- | +| type | string | Yes | Event type. The value is **dataProgress**.| +| callback | Callback\<{ receiveSize: number, totalSize: number }\> | No | Callback used to return the result. | + +**Example** + +```js +httpRequest.off('dataProgress'); +``` ## HttpRequestOptions Specifies the type and value range of the optional parameters in the HTTP request. @@ -357,13 +805,14 @@ Specifies the type and value range of the optional parameters in the HTTP reques | -------------- | --------------------------------------------- | ---- | ------------------------------------------------------------ | | method | [RequestMethod](#requestmethod) | No | Request method. | | extraData | string \| Object \| ArrayBuffer6+ | No | Additional data of the request.
- If the HTTP request uses a POST or PUT method, this parameter serves as the content of the HTTP request.
- If the HTTP request uses a GET, OPTIONS, DELETE, TRACE, or CONNECT method, this parameter is a supplement to the HTTP request parameters and will be added to the URL when the request is sent.6+
- To pass in a string object, you first need to encode the object on your own.6+ | -| expectDataType9+ | [HttpDataType](#httpdatatype9) | No | Type of the return data. If this parameter is set, the system returns the specified type of data preferentially.| +| expectDataType9+ | [HttpDataType](#httpdatatype9) | No | Type of the return data. If this parameter is set, the system returns the specified type of data preferentially.| | usingCache9+ | boolean | No | Whether to use the cache. The default value is **true**. | | priority9+ | number | No | Priority. The value range is \[1,1000]. The default value is **1**. | -| header | Object | No | HTTP request header. The default value is **{'Content-Type': 'application/json'}**. | -| readTimeout | number | No | Read timeout duration. The default value is **60000**, in ms. | -| connectTimeout | number | No | Connection timeout interval. The default value is **60000**, in ms. | -| usingProtocol9+ | [HttpProtocol](#httpprotocol9) | No | Protocol. The default value is automatically specified by the system. | +| header | Object | No | HTTP request header. The default value is **{'Content-Type': 'application/json'}**. | +| readTimeout | number | No | Read timeout duration. The default value is **60000**, in ms. | +| connectTimeout | number | No | Connection timeout interval. The default value is **60000**, in ms. | +| usingProtocol9+ | [HttpProtocol](#httpprotocol9) | No | Protocol. The default value is automatically specified by the system. | +| usingProxy10+ | boolean \| Object | No | Whether to use HTTP proxy. The default value is **false**, which means not to use HTTP proxy.
- If **usingProxy** is of the **Boolean** type and the value is **true**, network proxy is used by default.
- If **usingProxy** is of the **object** type, the specified network proxy is used. | ## RequestMethod @@ -372,7 +821,7 @@ Defines an HTTP request method. **System capability**: SystemCapability.Communication.NetStack | Name | Value | Description | -| ------ | ------- | ------------------ | +| :------ | ------- | :------------------ | | OPTIONS | "OPTIONS" | OPTIONS method.| | GET | "GET" | GET method. | | HEAD | "HEAD" | HEAD method. | @@ -436,9 +885,9 @@ Defines the response to an HTTP request. | -------------------- | -------------------------------------------- | ---- | ------------------------------------------------------------ | | result | string \| Object \| ArrayBuffer6+ | Yes | Response content returned based on **Content-type** in the response header:
- application/json: a string in JSON format. If you want to use specific content in the response, you need to implement parsing of that content.
- application/octet-stream: ArrayBuffer
- Others: string| | resultType9+ | [HttpDataType](#httpdatatype9) | Yes | Type of the return value. | -| responseCode | [ResponseCode](#responsecode) \| number | Yes | Result code for an HTTP request. If the callback function is successfully executed, a result code defined in [ResponseCode](#responsecode) will be returned. Otherwise, an error code will be returned in the **err** field in **AsyncCallback**. For details, see [Error Codes](#error-codes).| +| responseCode | [ResponseCode](#responsecode) \| number | Yes | Result code for an HTTP request. If the callback function is successfully executed, a result code defined in [ResponseCode](#responsecode) will be returned. Otherwise, an error code will be returned in the **err** field in **AsyncCallback**.| | header | Object | Yes | Response header. The return value is a string in JSON format. If you want to use specific content in the response, you need to implement parsing of that content. Common fields and parsing methods are as follows:
- Content-Type: header['Content-Type'];
- Status-Line: header['Status-Line'];
- Date: header.Date/header['Date'];
- Server: header.Server/header['Server'];| -| cookies8+ | Array\ | Yes | Cookies returned by the server. | +| cookies8+ | string | Yes | Cookies returned by the server. | ## http.createHttpResponseCache9+ @@ -457,7 +906,7 @@ Creates a default object to store responses to HTTP access requests. **Return value** | Type | Description | -| ---------- | ----------------------------------------------------------- | +| :---------- | :----------------------------------------------------------- | | [HttpResponseCache](#httpresponsecache9) | Object that stores the response to the HTTP request.| **Example** @@ -469,11 +918,11 @@ let httpResponseCache = http.createHttpResponseCache(); ## HttpResponseCache9+ -Defines an object that stores the response to an HTTP request. +Defines an object that stores the response to an HTTP request. Before invoking APIs provided by **HttpResponseCache**, you must call [createHttpResponseCache()](#httpcreatehttpresponsecache9) to create an **HttpRequestTask** object. ### flush9+ -flush(callback: AsyncCallback\): void +flush(callback: AsyncCallback\): void Flushes data in the cache to the file system so that the cached data can be accessed in the next HTTP request. This API uses an asynchronous callback to return the result. @@ -483,23 +932,23 @@ Flushes data in the cache to the file system so that the cached data can be acce | Name | Type | Mandatory| Description | | -------- | --------------------------------------- | ---- | ---------- | -| callback | AsyncCallback\ | Yes | Callback used to return the result.| +| callback | AsyncCallback\ | Yes | Callback used to return the result.| **Example** ```js httpResponseCache.flush(err => { if (err) { - console.log('flush fail'); + console.info('flush fail'); return; } - console.log('flush success'); + console.info('flush success'); }); ``` ### flush9+ -flush(): Promise\ +flush(): Promise\ Flushes data in the cache to the file system so that the cached data can be accessed in the next HTTP request. This API uses a promise to return the result. @@ -509,21 +958,21 @@ Flushes data in the cache to the file system so that the cached data can be acce | Type | Description | | --------------------------------- | ------------------------------------- | -| Promise\> | Promise used to return the result.| +| Promise\ | Promise used to return the result.| **Example** ```js httpResponseCache.flush().then(() => { - console.log('flush success'); + console.info('flush success'); }).catch(err => { - console.log('flush fail'); + console.info('flush fail'); }); ``` ### delete9+ -delete(callback: AsyncCallback\): void +delete(callback: AsyncCallback\): void Disables the cache and deletes the data in it. This API uses an asynchronous callback to return the result. @@ -533,22 +982,22 @@ Disables the cache and deletes the data in it. This API uses an asynchronous cal | Name | Type | Mandatory| Description | | -------- | --------------------------------------- | ---- | ---------- | -| callback | AsyncCallback\ | Yes | Callback used to return the result.| +| callback | AsyncCallback\ | Yes | Callback used to return the result.| **Example** ```js httpResponseCache.delete(err => { if (err) { - console.log('delete fail'); + console.info('delete fail'); return; } - console.log('delete success'); + console.info('delete success'); }); ``` ### delete9+ -delete(): Promise\ +delete(): Promise\ Disables the cache and deletes the data in it. This API uses a promise to return the result. @@ -558,29 +1007,18 @@ Disables the cache and deletes the data in it. This API uses a promise to return | Type | Description | | --------------------------------- | ------------------------------------- | -| Promise\ | Promise used to return the result.| +| Promise\ | Promise used to return the result.| **Example** ```js httpResponseCache.delete().then(() => { - console.log('delete success'); + console.info('delete success'); }).catch(err => { - console.log('delete fail'); + console.info('delete fail'); }); ``` -## Error Codes - -| Error Code| Description | -| ------ | ------------------------------------------------------------ | -| -1 | Incorrect parameter. Check whether the number and type of parameters are correct. | -| 3 | Incorrect URL format. Check whether the format and syntax of the URL are correct. | -| 4 | Built-in request function, protocol, or option not found during build. If a function or option is not enabled or explicitly disabled, you need to rebuild a libcurl in order to access its functions. | -| 5 | Unable to resolve the proxy because of a failure to resolve the specified proxy server. You are advised perform the following: 1. Check whether the URL is correct. 2. Check whether the network connection is normal and whether the network can communicate with external networks. 3. Check whether the network access permission is available. | -| 6 | Unable to resolve the host because of a failure to resolve the specified remote host. You are advised perform the following: 1. Check whether the URL is correct. 2. Check whether the network connection is normal and whether the network can communicate with external networks. 3. Check whether the network access permission is available. | -| 7 | Unable to connect to the proxy or host. You are advised perform the following: 1. Check whether the port number is correct. 2. Check whether the HTTP proxy is enabled on the local host. | - ## HttpDataType9+ Enumerates HTTP data types. @@ -588,7 +1026,7 @@ Enumerates HTTP data types. **System capability**: SystemCapability.Communication.NetStack | Name| Value| Description | -| ------------------ | -- | ----------- | +| ------------------ | -- | ----------- | | STRING | 0 | String type.| | OBJECT | 1 | Object type. | | ARRAY_BUFFER | 2 | Binary array type.| @@ -600,6 +1038,6 @@ Enumerates HTTP protocol versions. **System capability**: SystemCapability.Communication.NetStack | Name | Description | -| -------- | ----------- | +| :-------- | :----------- | | HTTP1_1 | HTTP1.1 | | HTTP2 | HTTP2 | diff --git a/en/application-dev/reference/apis/js-apis-huks.md b/en/application-dev/reference/apis/js-apis-huks.md index cad81d4e80c3303859274b2b79c3258bf8d2556c..f297c8c29bbcd4822d2f34030b1c6e9bec2b124d 100644 --- a/en/application-dev/reference/apis/js-apis-huks.md +++ b/en/application-dev/reference/apis/js-apis-huks.md @@ -3,7 +3,7 @@ The **HUKS** module provides KeyStore (KS) capabilities for applications, including key management and key cryptography operations. The keys managed by OpenHarmony Universal KeyStore (HUKS) can be imported by applications or generated by calling the HUKS APIs. -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
+> **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. @@ -75,7 +75,7 @@ Generates a key. This API uses an asynchronous callback to return the result. | -------- | --------------------------- | ---- | --------------------------------------------- | | keyAlias | string | Yes | Alias of the key. | | options | [HuksOptions](#huksoptions) | Yes | Tags required for generating the key. The algorithm, key purpose, and key length are mandatory.| -| callback | AsyncCallback\ | Yes | Callback invoked to return the result. If the operation fails, **err** is returned.| +| callback | AsyncCallback\ | Yes | Callback invoked to return the result. If the operation is successful, no **err** value is returned; otherwise, an error code is returned.| **Example** @@ -186,7 +186,7 @@ Deletes a key. This API uses an asynchronous callback to return the result. | -------- | --------------------------- | ---- | --------------------------------------------- | | keyAlias | string | Yes | Key alias passed in when the key was generated. | | options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty). | -| callback | AsyncCallback\ | Yes | Callback invoked to return the result. If the operation fails, **err** is returned.| +| callback | AsyncCallback\ | Yes | Callback invoked to return the result. If the operation is successful, no **err** value is returned; otherwise, an error code is returned.| **Example** @@ -289,7 +289,7 @@ Imports a key in plaintext. This API uses an asynchronous callback to return the | -------- | --------------------------- | ---- | --------------------------------------------- | | keyAlias | string | Yes | Alias of the key. | | options | [HuksOptions](#huksoptions) | Yes | Tags required for the import and key to import. The algorithm, key purpose, and key length are mandatory.| -| callback | AsyncCallback\ | Yes | Callback invoked to return the result. If the operation fails, **err** is returned.| +| callback | AsyncCallback\ | Yes | Callback invoked to return the result. If the operation is successful, no **err** value is returned; otherwise, an error code is returned.| **Example** @@ -426,7 +426,7 @@ Obtains the certificate used to verify a key. This API uses an asynchronous call | -------- | ---------------------------------------------------- | ---- | --------------------------------------------- | | keyAlias | string | Yes | Alias of the key. The certificate to be obtained stores the key. | | options | [HuksOptions](#huksoptions) | Yes | Parameters and data required for obtaining the certificate. | -| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the result. If the operation fails, **err** is returned.| +| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the result. If the operation is successful, no **err** value is returned; otherwise, an error code is returned.| **Example** @@ -553,7 +553,7 @@ Obtains the certificate used to verify a key. This API uses a promise to return | Type | Description | | ---------------------------------------------- | --------------------------------------------- | -| Promise<[HuksReturnResult](#huksreturnresult9)> | Promise used to return the result. If the operation fails, **err** is returned.| +| Promise<[HuksReturnResult](#huksreturnresult9)> | Promise used to return the result. If the operation is successful, no **err** value is returned; otherwise, an error code is returned.| **Example** @@ -676,7 +676,7 @@ Imports a wrapped key. This API uses an asynchronous callback to return the resu | keyAlias | string | Yes | Alias of the wrapped key to import. | | wrappingKeyAlias | string | Yes | Alias of the data used to unwrap the key imported. | | options | [HuksOptions](#huksoptions) | Yes | Tags required for the import and the wrapped key to import. The algorithm, key purpose, and key length are mandatory.| -| callback | AsyncCallback\ | Yes | Callback invoked to return the result. If the operation fails, **err** is returned.| +| callback | AsyncCallback\ | Yes | Callback invoked to return the result. If the operation is successful, no **err** value is returned; otherwise, an error code is returned.| **Example** @@ -926,7 +926,7 @@ Exports a key. This API uses an asynchronous callback to return the result. | -------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ | | keyAlias | string | Yes | Key alias, which must be the same as the alias used when the key was generated. | | options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty). | -| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the result. If the operation is successful, **HUKS_SUCCESS** is returned and **outData** contains the public key exported. If the operation fails, an error code is returned.| +| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the result. If the operation is successful, no **err** value is returned; otherwise, an error code is returned. **outData** contains the public key exported.| **Example** @@ -1005,7 +1005,7 @@ Obtains key properties. This API uses an asynchronous callback to return the res | -------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ | | keyAlias | string | Yes | Key alias, which must be the same as the alias used when the key was generated. | | options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty). | -| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the result. If the operation is successful, **errorCode** is **HUKS_SUCCESS**; otherwise, an error code is returned.| +| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the result. If the operation is successful, no **err** value is returned and **properties** contains the parameters required for generating the key. If the operation fails, an error code is returned. | **Example** @@ -1084,7 +1084,7 @@ Checks whether a key exists. This API uses an asynchronous callback to return th | -------- | --------------------------- | ---- | --------------------------------------- | | keyAlias | string | Yes | Alias of the key to check. | | options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty). | -| callback | AsyncCallback\ | Yes | Callback invoked to return the result. **TRUE** means that the key exists; **FALSE** means the opposite.| +| callback | AsyncCallback\ | Yes | Callback invoked to return the result. The value **TRUE** means that the key exists; **FALSE** means the opposite.| **Example** @@ -1161,9 +1161,9 @@ Initializes the data for a key operation. This API uses an asynchronous callback | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------- | ---- | ---------------------------------------------------- | -| keyAlias | string | Yes | Alias of the target key. | -| options | [HuksOptions](#huksoptions) | Yes | Parameters used for initialization. | -| callback | AsyncCallback\<[HuksSessionHandle](#hukssessionhandle9)> | Yes | Callback invoked to return the handle obtained through the initialization operation.| +| keyAlias | string | Yes | Alias of the key involved in the **initSession** operation. | +| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **initSession** operation. | +| callback | AsyncCallback\<[HuksSessionHandle](#hukssessionhandle9)> | Yes | Callback invoked to return a session handle for subsequent operations.| ## huks.initSession9+ @@ -1177,14 +1177,14 @@ Initializes the data for a key operation. This API uses a promise to return the | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------- | ---- | ------------------------------------------------ | -| keyAlias | string | Yes | Alias of the target key. | -| options | [HuksOptions](#huksoptions) | Yes | Parameters used for initialization. | +| keyAlias | string | Yes | Alias of the key involved in the **initSession** operation. | +| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **initSession** operation. | **Return value** | Type | Description | | ----------------------------------- | -------------------------------------------------- | -| Promise\<[HuksSessionHandle](#hukssessionhandle9)> | Promise used to return the handle obtained through the initialization operation.| +| Promise\<[HuksSessionHandle](#hukssessionhandle9)> | Promise used to return a session handle for subsequent operations.| ## huks.updateSession9+ @@ -1198,9 +1198,9 @@ Updates the key operation by segment. This API uses an asynchronous callback to | Name | Type | Mandatory| Description | | -------- | ---------------------------------------------------- | ---- | -------------------------------------------- | -| handle | number | Yes | Handle of the **Update** operation. | -| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Update** operation. | -| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the result.| +| handle | number | Yes | Handle for the **updateSession** operation. | +| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **updateSession** operation. | +| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the **updateSession** operation result.| ## huks.updateSession9+ @@ -1215,16 +1215,16 @@ Updates the key operation by segment. This API uses an asynchronous callback to | Name | Type | Mandatory| Description | | -------- | ---------------------------------------------------- | ---- | -------------------------------------------- | -| handle | number | Yes | Handle of the **Update** operation. | -| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Update** operation. | -| token | Uint8Array | Yes | Token of the **Update** operation. | -| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the result.| +| handle | number | Yes | Handle for the **updateSession** operation. | +| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **updateSession** operation. | +| token | Uint8Array | Yes | Token of the **updateSession** operation. | +| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the **updateSession** operation result.| ## huks.updateSession9+ updateSession(handle: number, options: HuksOptions, token?: Uint8Array) : Promise\ -Updates the key operation data by segment. This API uses a promise to return the result. **huks.initSession**, **huks.updateSession**, and **huks.finishSession** must be used together. +Updates the key operation by segment. This API uses a promise to return the result. **huks.initSession**, **huks.updateSession**, and **huks.finishSession** must be used together. **System capability**: SystemCapability.Security.Huks @@ -1232,15 +1232,15 @@ Updates the key operation data by segment. This API uses a promise to return the | Name | Type | Mandatory| Description | | ------- | ---------------------------------------------- | ---- | -------------------------------------------- | -| handle | number | Yes | Handle of the **Update** operation. | -| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Update** operation. | -| token | Uint8Array | No | Token of the **Update** operation. | +| handle | number | Yes | Handle for the **updateSession** operation. | +| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **updateSession** operation. | +| token | Uint8Array | No | Token of the **updateSession** operation. | **Return value** | Type | Description | | ----------------------------------- | -------------------------------------------------- | -| Promise<[HuksReturnResult](#huksreturnresult9)> | Promise used to return the result.| +| Promise<[HuksReturnResult](#huksreturnresult9)> | Promise used to return the **updateSession** operation result.| ## huks.finishSession9+ @@ -1254,10 +1254,10 @@ Completes the key operation and releases resources. This API uses an asynchronou | Name | Type | Mandatory| Description | | -------- | ---------------------------------------------------- | ---- | -------------------------------------------- | -| handle | number | Yes | Handle of the **Finish** operation. | -| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Finish** operation. | -| token | Uint8Array | Yes | Token for the **Finish** operation. | -| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the result.| +| handle | number | Yes | Handle for the **finishSession** operation. | +| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **finishSession** operation. | +| token | Uint8Array | Yes | Token of the **finishSession** operation. | +| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the **finishSession** operation result. | ## huks.finishSession9+ @@ -1271,10 +1271,10 @@ Completes the key operation and releases resources. This API uses an asynchronou | Name | Type | Mandatory| Description | | -------- | ----------------------------------------------------- | ---- | -------------------------------------------- | -| handle | number | Yes | Handle of the **Finish** operation. | -| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Finish** operation. | -| token | Uint8Array | Yes | Token for the **Finish** operation. | -| callback | AsyncCallback\<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the result.| +| handle | number | Yes | Handle for the **finishSession** operation. | +| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **finishSession** operation. | +| token | Uint8Array | Yes | Token of the **finishSession** operation. | +| callback | AsyncCallback\<[HuksReturnResult](#huksreturnresult9)> | Yes | Callback invoked to return the **finishSession** operation result. | ## huks.finishSession9+ @@ -1288,9 +1288,9 @@ Completes the key operation and releases resources. This API uses a promise to r | Name | Type | Mandatory| Description | | ------- | ----------------------------------------------- | ---- | ----------------------------------- | -| handle | number | Yes | Handle of the **Finish** operation. | -| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Finish** operation. | -| token | Uint8Array | No | Token for the **Finish** operation. | +| handle | number | Yes | Handle for the **finishSession** operation. | +| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **finishSession** operation. | +| token | Uint8Array | No | Token of the **finishSession** operation. | **Return value** @@ -1302,7 +1302,7 @@ Completes the key operation and releases resources. This API uses a promise to r abortSession(handle: number, options: HuksOptions, callback: AsyncCallback\) : void -Aborts the use of the key. This API uses an asynchronous callback to return the result. +Aborts a key operation. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Security.Huks @@ -1310,16 +1310,16 @@ Aborts the use of the key. This API uses an asynchronous callback to return the | Name | Type | Mandatory| Description | | -------- | --------------------------- | ---- | ------------------------------------------- | -| handle | number | Yes | Handle of the **Abort** operation. | -| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Abort** operation. | -| callback | AsyncCallback\ | Yes | Callback invoked to return the result. If the operation fails, **err** is returned.| +| handle | number | Yes | Handle for the **abortSession** operation. | +| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **abortSession** operation. | +| callback | AsyncCallback\ | Yes | Callback that returns no value. | **Example** ```js /* huks.initSession, huks.updateSession, and huks.finishSession must be used together. * If an error occurs in any of huks.initSession, huks.updateSession, - * and huks.finishSession operation, + * and huks.finishSession operations, * huks.abortSession must be called to terminate the use of the key. * * The following uses the callback of an RSA1024 key as an example. @@ -1447,7 +1447,7 @@ async function huksAbort() { abortSession(handle: number, options: HuksOptions) : Promise\; -Aborts the use of the key. This API uses a promise to return the result. +Aborts a key operation. This API uses a promise to return the result. **System capability**: SystemCapability.Security.Huks @@ -1455,21 +1455,21 @@ Aborts the use of the key. This API uses a promise to return the result. | Name | Type | Mandatory| Description | | ------- | --------------------------- | ---- | ------------------------------------------- | -| handle | number | Yes | Handle of the **Abort** operation. | -| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Abort** operation. | +| handle | number | Yes | Handle for the **abortSession** operation. | +| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **abortSession** operation. | **Return value** | Type | Description | | ----------------------------------- | -------------------------------------------------- | -| Promise\ | Promise that returns no value.| +| Promise\ | Promise used to return the **abortSession** operation result.| **Example** ```js /* huks.initSession, huks.updateSession, and huks.finishSession must be used together. * If an error occurs in any of huks.initSession, huks.updateSession, - * and huks.finishSession operation, + * and huks.finishSession operations, * huks.abortSession must be called to terminate the use of the key. * * The following uses the callback of an RSA1024 key as an example. @@ -1818,9 +1818,9 @@ Enumerates the user authentication types. | Name | Value | Description | | ------------------------------- | ---- | ------------------------- | -| HUKS_USER_AUTH_TYPE_FINGERPRINT | 1 | Fingerprint authentication. | -| HUKS_USER_AUTH_TYPE_FACE | 2 | Facial authentication.| -| HUKS_USER_AUTH_TYPE_PIN | 4 | PIN authentication.| +| HUKS_USER_AUTH_TYPE_FINGERPRINT | 1 << 0 | Fingerprint authentication. | +| HUKS_USER_AUTH_TYPE_FACE | 1 << 1 | Facial authentication.| +| HUKS_USER_AUTH_TYPE_PIN | 1 << 2 | PIN authentication.| ## HuksAuthAccessType9+ @@ -1830,8 +1830,8 @@ Enumerates the access control types. | Name | Value | Description | | --------------------------------------- | ---- | ------------------------------------------------ | -| HUKS_AUTH_ACCESS_INVALID_CLEAR_PASSWORD | 1 | The key becomes invalid after the password is cleared. | -| HUKS_AUTH_ACCESS_INVALID_NEW_BIO_ENROLL | 2 | The key becomes invalid after a new biometric feature is added.| +| HUKS_AUTH_ACCESS_INVALID_CLEAR_PASSWORD | 1 << 0 | The key becomes invalid after the password is cleared. | +| HUKS_AUTH_ACCESS_INVALID_NEW_BIO_ENROLL | 1 << 1 | The key becomes invalid after a new biometric feature is added.| ## HuksChallengeType9+ @@ -1889,90 +1889,90 @@ Enumerates the tags used to invoke parameters. **System capability**: SystemCapability.Security.Huks -| Name | Value | Description | -| -------------------------------------------- | ---------------------------------------- | -------------------------------------- | -| HUKS_TAG_INVALID | HuksTagType.HUKS_TAG_TYPE_INVALID \| 0 | Invalid tag. | -| HUKS_TAG_ALGORITHM | HUKS_TAG_TYPE_UINT \| 1 | Algorithm. | -| HUKS_TAG_PURPOSE | HuksTagType.HUKS_TAG_TYPE_UINT \| 2 | Purpose of the key. | -| HUKS_TAG_KEY_SIZE | HuksTagType.HUKS_TAG_TYPE_UINT \| 3 | Key size. | -| HUKS_TAG_DIGEST | HuksTagType.HUKS_TAG_TYPE_UINT \| 4 | Digest algorithm. | -| HUKS_TAG_PADDING | HuksTagType.HUKS_TAG_TYPE_UINT \| 5 | Padding algorithm. | -| HUKS_TAG_BLOCK_MODE | HuksTagType.HUKS_TAG_TYPE_UINT \| 6 | Cipher mode. | -| HUKS_TAG_KEY_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 7 | Key type. | -| HUKS_TAG_ASSOCIATED_DATA | HuksTagType.HUKS_TAG_TYPE_BYTES \| 8 | Associated authentication data. | -| HUKS_TAG_NONCE | HuksTagType.HUKS_TAG_TYPE_BYTES \| 9 | Field for key encryption and decryption. | -| HUKS_TAG_IV | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10 | IV. | -| HUKS_TAG_INFO | HuksTagType.HUKS_TAG_TYPE_BYTES \| 11 | Information generated during key derivation. | -| HUKS_TAG_SALT | HuksTagType.HUKS_TAG_TYPE_BYTES \| 12 | Salt value used for key derivation. | -| HUKS_TAG_PWD | HuksTagType.HUKS_TAG_TYPE_BYTES \| 13 | Password used for key derivation. | -| HUKS_TAG_ITERATION | HuksTagType.HUKS_TAG_TYPE_UINT \| 14 | Number of iterations for key derivation. | -| HUKS_TAG_KEY_GENERATE_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 15 | Key generation type. | -| 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 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. | -| HUKS_TAG_DERIVE_KEY_SIZE | HuksTagType.HUKS_TAG_TYPE_UINT \| 24 | Size of the derived key. | -| HUKS_TAG_IMPORT_KEY_TYPE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 25 | Type of the imported key. | -| HUKS_TAG_UNWRAP_ALGORITHM_SUITE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 26 | Algorithm suite required for encrypted imports. | -| HUKS_TAG_ACTIVE_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 201 | Reserved. | -| HUKS_TAG_ORIGINATION_EXPIRE_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 202 | Reserved. | -| HUKS_TAG_USAGE_EXPIRE_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 203 | Reserved. | -| HUKS_TAG_CREATION_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 204 | Reserved. | -| HUKS_TAG_ALL_USERS | ksTagType.HUKS_TAG_TYPE_BOOL \| 301 | Reserved. | -| HUKS_TAG_USER_ID | HuksTagType.HUKS_TAG_TYPE_UINT \| 302 | Reserved. | -| HUKS_TAG_NO_AUTH_REQUIRED | HuksTagType.HUKS_TAG_TYPE_BOOL \| 303 | Reserved. | -| HUKS_TAG_USER_AUTH_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 304 | User authentication type. For details, see [HuksUserAuthType](#huksuserauthtype9). This parameter must be set together with [HuksAuthAccessType](#huksauthaccesstype9). You can set a maximum of two user authentication types at a time. For example, if **HuksAuthAccessType** is **HKS_SECURE_ACCESS_INVALID_NEW_BIO_ENROLL**, you can set two of **HKS_USER_AUTH_TYPE_FACE**, **HKS_USER_AUTH_TYPE_FINGERPRINT**, and **HKS_USER_AUTH_TYPE_FACE\**.| HKS_USER_AUTH_TYPE_FINGERPRINT | -| HUKS_TAG_AUTH_TIMEOUT | HuksTagType.HUKS_TAG_TYPE_UINT \| 305 | Reserved. | -| HUKS_TAG_AUTH_TOKEN | HuksTagType.HUKS_TAG_TYPE_BYTES \| 306 | Reserved. | -| HUKS_TAG_KEY_AUTH_ACCESS_TYPE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 307 | Access control type. For details, see [HuksAuthAccessType](#huksauthaccesstype9). This parameter must be set together with [HuksUserAuthType](#huksuserauthtype9).| -| HUKS_TAG_KEY_SECURE_SIGN_TYPE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 308 | Signature type of the key generated or imported.| -| HUKS_TAG_CHALLENGE_TYPE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 309 | Type of the challenge generated for a key. For details, see [HuksChallengeType](#hukschallengetype9).| -| HUKS_TAG_CHALLENGE_POS9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 310 | Position of the 8-byte valid value in a custom challenge. For details, see [HuksChallengePosition](#hukschallengeposition9).| -| 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 | Brand of the device. | -| HUKS_TAG_ATTESTATION_ID_DEVICE | HuksTagType.HUKS_TAG_TYPE_BYTES \| 504 | ID of the device. | -| 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 | SN of the device. | -| HUKS_TAG_ATTESTATION_ID_IMEI | HuksTagType.HUKS_TAG_TYPE_BYTES \| 507 | International mobile equipment identity (IMEI) of the device. | -| HUKS_TAG_ATTESTATION_ID_MEID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 508 | Mobile equipment identity (MEID) of the device. | -| HUKS_TAG_ATTESTATION_ID_MANUFACTURER | HuksTagType.HUKS_TAG_TYPE_BYTES \| 509 | Manufacturer of the device. | -| HUKS_TAG_ATTESTATION_ID_MODEL | HuksTagType.HUKS_TAG_TYPE_BYTES \| 510 | Device model. | -| 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 | System-on-a-chip (SoCID) of the device. | -| HUKS_TAG_ATTESTATION_ID_UDID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 513 | Unique device identifier (UDID) of the device. | -| HUKS_TAG_ATTESTATION_ID_SEC_LEVEL_INFO | HuksTagType.HUKS_TAG_TYPE_BYTES \| 514 | Security level 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. | -| HUKS_TAG_IS_ALLOWED_WRAP | HuksTagType.HUKS_TAG_TYPE_BOOL \| 1003 | Reserved. | -| HUKS_TAG_KEY_WRAP_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 1004 | Reserved. | -| HUKS_TAG_KEY_AUTH_ID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 1005 | Reserved. | -| HUKS_TAG_KEY_ROLE | HuksTagType.HUKS_TAG_TYPE_UINT \| 1006 | Reserved. | -| HUKS_TAG_KEY_FLAG | HuksTagType.HUKS_TAG_TYPE_UINT \| 1007 | Flag of the key. | -| HUKS_TAG_IS_ASYNCHRONIZED | HuksTagType.HUKS_TAG_TYPE_UINT \| 1008 | Reserved. | -| HUKS_TAG_SECURE_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 1009 | Reserved. | -| HUKS_TAG_SECURE_KEY_UUID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 1010 | Reserved. | -| HUKS_TAG_KEY_DOMAIN | HuksTagType.HUKS_TAG_TYPE_UINT \| 1011 | Reserved. | -| HUKS_TAG_PROCESS_NAME | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10001 | Process name. | -| HUKS_TAG_PACKAGE_NAME | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10002 | Reserved. | -| HUKS_TAG_ACCESS_TIME | HuksTagType.HUKS_TAG_TYPE_UINT \| 10003 | Reserved. | -| HUKS_TAG_USES_TIME | HuksTagType.HUKS_TAG_TYPE_UINT \| 10004 | Reserved. | -| HUKS_TAG_CRYPTO_CTX | HuksTagType.HUKS_TAG_TYPE_ULONG \| 10005 | Reserved. | -| HUKS_TAG_KEY | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10006 | Reserved. | -| HUKS_TAG_KEY_VERSION | HuksTagType.HUKS_TAG_TYPE_UINT \| 10007 | Key version. | -| HUKS_TAG_PAYLOAD_LEN | HuksTagType.HUKS_TAG_TYPE_UINT \| 10008 | Reserved. | -| HUKS_TAG_AE_TAG | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10009 | Reserved. | -| HUKS_TAG_IS_KEY_HANDLE | HuksTagType.HUKS_TAG_TYPE_ULONG \| 10010 | Reserved. | -| HUKS_TAG_OS_VERSION | HuksTagType.HUKS_TAG_TYPE_UINT \| 10101 | OS version. | -| HUKS_TAG_OS_PATCHLEVEL | HuksTagType.HUKS_TAG_TYPE_UINT \| 10102 | OS patch level. | -| HUKS_TAG_SYMMETRIC_KEY_DATA | HuksTagType.HUKS_TAG_TYPE_BYTES \| 20001 | Reserved. | -| HUKS_TAG_ASYMMETRIC_PUBLIC_KEY_DATA | HuksTagType.HUKS_TAG_TYPE_BYTES \| 20002 | Reserved. | -| HUKS_TAG_ASYMMETRIC_PRIVATE_KEY_DATA | HuksTagType.HUKS_TAG_TYPE_BYTES \| 20003 | Reserved. | +| Name | Value | Description | +| -------------------------------------------- | ---------------------------------------- | ------------------------------------------------------------ | +| HUKS_TAG_INVALID | HuksTagType.HUKS_TAG_TYPE_INVALID \| 0 | Invalid tag. | +| HUKS_TAG_ALGORITHM | HuksTagType.HUKS_TAG_TYPE_UINT \| 1 | Algorithm. | +| HUKS_TAG_PURPOSE | HuksTagType.HUKS_TAG_TYPE_UINT \| 2 | Purpose of the key. | +| HUKS_TAG_KEY_SIZE | HuksTagType.HUKS_TAG_TYPE_UINT \| 3 | Key size. | +| HUKS_TAG_DIGEST | HuksTagType.HUKS_TAG_TYPE_UINT \| 4 | Digest algorithm. | +| HUKS_TAG_PADDING | HuksTagType.HUKS_TAG_TYPE_UINT \| 5 | Padding algorithm. | +| HUKS_TAG_BLOCK_MODE | HuksTagType.HUKS_TAG_TYPE_UINT \| 6 | Cipher mode. | +| HUKS_TAG_KEY_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 7 | Key type. | +| HUKS_TAG_ASSOCIATED_DATA | HuksTagType.HUKS_TAG_TYPE_BYTES \| 8 | Associated authentication data. | +| HUKS_TAG_NONCE | HuksTagType.HUKS_TAG_TYPE_BYTES \| 9 | Field for key encryption and decryption. | +| HUKS_TAG_IV | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10 | IV. | +| HUKS_TAG_INFO | HuksTagType.HUKS_TAG_TYPE_BYTES \| 11 | Information generated during key derivation. | +| HUKS_TAG_SALT | HuksTagType.HUKS_TAG_TYPE_BYTES \| 12 | Salt value used for key derivation. | +| HUKS_TAG_PWD | HuksTagType.HUKS_TAG_TYPE_BYTES \| 13 | Password used for key derivation. | +| HUKS_TAG_ITERATION | HuksTagType.HUKS_TAG_TYPE_UINT \| 14 | Number of iterations for key derivation. | +| HUKS_TAG_KEY_GENERATE_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 15 | Key generation type. | +| 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 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. | +| HUKS_TAG_DERIVE_KEY_SIZE | HuksTagType.HUKS_TAG_TYPE_UINT \| 24 | Size of the derived key. | +| HUKS_TAG_IMPORT_KEY_TYPE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 25 | Type of the imported key. | +| HUKS_TAG_UNWRAP_ALGORITHM_SUITE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 26 | Algorithm suite required for encrypted imports. | +| HUKS_TAG_ACTIVE_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 201 | Reserved. | +| HUKS_TAG_ORIGINATION_EXPIRE_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 202 | Reserved. | +| HUKS_TAG_USAGE_EXPIRE_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 203 | Reserved. | +| HUKS_TAG_CREATION_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 204 | Reserved. | +| HUKS_TAG_ALL_USERS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 301 | Reserved. | +| HUKS_TAG_USER_ID | HuksTagType.HUKS_TAG_TYPE_UINT \| 302 | Reserved. | +| HUKS_TAG_NO_AUTH_REQUIRED | HuksTagType.HUKS_TAG_TYPE_BOOL \| 303 | Reserved. | +| HUKS_TAG_USER_AUTH_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 304 | User authentication type. For details, see [HuksUserAuthType](#huksuserauthtype9). This parameter must be set together with [HuksAuthAccessType](#huksauthaccesstype9). You can set a maximum of two user authentication types at a time. For example, if **HuksAuthAccessType** is **HKS_SECURE_ACCESS_INVALID_NEW_BIO_ENROLL**, you can set two of **HKS_USER_AUTH_TYPE_FACE**, **HKS_USER_AUTH_TYPE_FINGERPRINT**, and **HKS_USER_AUTH_TYPE_FACE**. | +| HUKS_TAG_AUTH_TIMEOUT | HuksTagType.HUKS_TAG_TYPE_UINT \| 305 | Reserved. | +| HUKS_TAG_AUTH_TOKEN | HuksTagType.HUKS_TAG_TYPE_BYTES \| 306 | Reserved. | +| HUKS_TAG_KEY_AUTH_ACCESS_TYPE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 307 | Access control type. For details, see [HuksAuthAccessType](#huksauthaccesstype9). This parameter must be set together with [HuksUserAuthType](#huksuserauthtype9). | +| HUKS_TAG_KEY_SECURE_SIGN_TYPE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 308 | Signature type of the key generated or imported. | +| HUKS_TAG_CHALLENGE_TYPE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 309 | Type of the challenge generated for a key. For details, see [HuksChallengeType](#hukschallengetype9). | +| HUKS_TAG_CHALLENGE_POS9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 310 | Position of the 8-byte valid value in a custom challenge. For details, see [HuksChallengePosition](#hukschallengeposition9). | +| 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 | Brand of the device. | +| HUKS_TAG_ATTESTATION_ID_DEVICE | HuksTagType.HUKS_TAG_TYPE_BYTES \| 504 | ID of the device. | +| 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 | SN of the device. | +| HUKS_TAG_ATTESTATION_ID_IMEI | HuksTagType.HUKS_TAG_TYPE_BYTES \| 507 | International mobile equipment identity (IMEI) of the device. | +| HUKS_TAG_ATTESTATION_ID_MEID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 508 | Mobile equipment identity (MEID) of the device. | +| HUKS_TAG_ATTESTATION_ID_MANUFACTURER | HuksTagType.HUKS_TAG_TYPE_BYTES \| 509 | Manufacturer of the device. | +| HUKS_TAG_ATTESTATION_ID_MODEL | HuksTagType.HUKS_TAG_TYPE_BYTES \| 510 | Device model. | +| 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 | System-on-a-chip (SoCID) of the device. | +| HUKS_TAG_ATTESTATION_ID_UDID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 513 | Unique device identifier (UDID) of the device. | +| HUKS_TAG_ATTESTATION_ID_SEC_LEVEL_INFO | HuksTagType.HUKS_TAG_TYPE_BYTES \| 514 | Security level 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. | +| HUKS_TAG_IS_ALLOWED_WRAP | HuksTagType.HUKS_TAG_TYPE_BOOL \| 1003 | Reserved. | +| HUKS_TAG_KEY_WRAP_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 1004 | Reserved. | +| HUKS_TAG_KEY_AUTH_ID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 1005 | Reserved. | +| HUKS_TAG_KEY_ROLE | HuksTagType.HUKS_TAG_TYPE_UINT \| 1006 | Reserved. | +| HUKS_TAG_KEY_FLAG | HuksTagType.HUKS_TAG_TYPE_UINT \| 1007 | Flag of the key. | +| HUKS_TAG_IS_ASYNCHRONIZED | HuksTagType.HUKS_TAG_TYPE_UINT \| 1008 | Reserved. | +| HUKS_TAG_SECURE_KEY_ALIAS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 1009 | Reserved. | +| HUKS_TAG_SECURE_KEY_UUID | HuksTagType.HUKS_TAG_TYPE_BYTES \| 1010 | Reserved. | +| HUKS_TAG_KEY_DOMAIN | HuksTagType.HUKS_TAG_TYPE_UINT \| 1011 | Reserved. | +| HUKS_TAG_PROCESS_NAME | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10001 | Process name. | +| HUKS_TAG_PACKAGE_NAME | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10002 | Reserved. | +| HUKS_TAG_ACCESS_TIME | HuksTagType.HUKS_TAG_TYPE_UINT \| 10003 | Reserved. | +| HUKS_TAG_USES_TIME | HuksTagType.HUKS_TAG_TYPE_UINT \| 10004 | Reserved. | +| HUKS_TAG_CRYPTO_CTX | HuksTagType.HUKS_TAG_TYPE_ULONG \| 10005 | Reserved. | +| HUKS_TAG_KEY | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10006 | Reserved. | +| HUKS_TAG_KEY_VERSION | HuksTagType.HUKS_TAG_TYPE_UINT \| 10007 | Key version. | +| HUKS_TAG_PAYLOAD_LEN | HuksTagType.HUKS_TAG_TYPE_UINT \| 10008 | Reserved. | +| HUKS_TAG_AE_TAG | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10009 | Reserved. | +| HUKS_TAG_IS_KEY_HANDLE | HuksTagType.HUKS_TAG_TYPE_ULONG \| 10010 | Reserved. | +| HUKS_TAG_OS_VERSION | HuksTagType.HUKS_TAG_TYPE_UINT \| 10101 | OS version. | +| HUKS_TAG_OS_PATCHLEVEL | HuksTagType.HUKS_TAG_TYPE_UINT \| 10102 | OS patch level. | +| HUKS_TAG_SYMMETRIC_KEY_DATA | HuksTagType.HUKS_TAG_TYPE_BYTES \| 20001 | Reserved. | +| HUKS_TAG_ASYMMETRIC_PUBLIC_KEY_DATA | HuksTagType.HUKS_TAG_TYPE_BYTES \| 20002 | Reserved. | +| HUKS_TAG_ASYMMETRIC_PRIVATE_KEY_DATA | HuksTagType.HUKS_TAG_TYPE_BYTES \| 20003 | Reserved. | ## huks.generateKey(deprecated) @@ -2285,7 +2285,7 @@ Exports a key. This API uses an asynchronous callback to return the result. | -------- | ----------------------------------------- | ---- | ------------------------------------------------------------ | | keyAlias | string | Yes | Key alias, which must be the same as the alias used when the key was generated. | | options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty). | -| callback | AsyncCallback\<[HuksResult](#huksresultdeprecated)> | Yes | Callback invoked to return the result. If the operation is successful, **HUKS_SUCCESS** is returned and **outData** contains the public key exported. If the operation fails, an error code is returned.| +| callback | AsyncCallback\<[HuksResult](#huksresultdeprecated)> | Yes | Callback invoked to return the result. If the operation is successful, **HUKS_SUCCESS** is returned and **outData** contains the public key exported. If the operation fails, an error code is returned. | **Example** @@ -2411,7 +2411,7 @@ Checks whether a key exists. This API uses an asynchronous callback to return th | -------- | ---------------------- | ---- | ------------------------------------- | | keyAlias | string | Yes | Alias of the key to check.| | options | [HuksOptions](#huksoptions) | Yes | Empty object (leave this parameter empty).| -| callback | AsyncCallback\ | Yes | Callback invoked to return the result. **TRUE** means that the key exists; **FALSE** means the opposite.| +| callback | AsyncCallback\ | Yes | Callback invoked to return the result. The value **TRUE** means that the key exists; **FALSE** means the opposite.| **Example** @@ -2473,8 +2473,8 @@ Initializes the data for a key operation. This API uses an asynchronous callback | Name | Type | Mandatory| Description | | -------- | ---------------------- | ---- | ------------------------------------- | | keyAlias | string | Yes | Alias of the target key.| -| options | [HuksOptions](#huksoptions) | Yes | Parameters used for initialization.| -| callback | AsyncCallback\<[HuksHandle](#hukshandledeprecated)> | Yes | Callback invoked to return the handle obtained through the initialization operation.| +| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **init** operation.| +| callback | AsyncCallback\<[HuksHandle](#hukshandledeprecated)> | Yes | Callback invoked to return a session handle for subsequent operations.| ## huks.init(deprecated) @@ -2491,13 +2491,13 @@ Initializes the data for a key operation. This API uses a promise to return the | Name | Type | Mandatory| Description | | -------- | ---------------------- | ---- | ------------------------------------- | | keyAlias | string | Yes | Alias of the target key.| -| options | [HuksOptions](#huksoptions) | Yes | Parameters used for initialization.| +| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **init** operation.| **Return value** | Type | Description | | ----------------------------------- | -------------------------------------------------- | -| Promise\<[HuksHandle](#hukshandledeprecated)> | Promise used to return the handle obtained through the initialization operation.| +| Promise\<[HuksHandle](#hukshandledeprecated)> | Promise used to return a session handle for subsequent operations.| ## huks.update(deprecated) @@ -2513,10 +2513,10 @@ Updates the key operation by segment. This API uses an asynchronous callback to | Name | Type | Mandatory| Description | | -------- | ----------------------------------------- | ---- | -------------------------------------------- | -| handle | number | Yes | Handle of the **Update** operation. | -| token | Uint8Array | No | Token of the **Update** operation. | -| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Update** operation. | -| callback | AsyncCallback\<[HuksResult](#huksresultdeprecated)> | Yes | Callback invoked to return the result.| +| handle | number | Yes | Handle for the **update** operation. | +| token | Uint8Array | No | Token of the **update** operation. | +| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **update** operation. | +| callback | AsyncCallback\<[HuksResult](#huksresultdeprecated)> | Yes | Callback invoked to return the **update** operation result. | ## huks.update(deprecated) @@ -2532,15 +2532,15 @@ Updates the key operation by segment. This API uses a promise to return the resu | Name | Type | Mandatory| Description | | ------- | ----------------------------------- | ---- | -------------------------------------------- | -| handle | number | Yes | Handle of the **Update** operation. | -| token | Uint8Array | No | Token of the **Update** operation. | -| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Update** operation. | +| handle | number | Yes | Handle for the **update** operation. | +| token | Uint8Array | No | Token of the **update** operation. | +| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **update** operation. | **Return value** | Type | Description | | ----------------------------------- | -------------------------------------------------- | -| Promise\<[HuksResult](#huksresultdeprecated)> | Promise used to return the result.| +| Promise\<[HuksResult](#huksresultdeprecated)> | Promise used to return the **update** operation result. | ## huks.finish(deprecated) @@ -2556,9 +2556,9 @@ Completes the key operation and releases resources. This API uses an asynchronou | Name | Type | Mandatory| Description | | -------- | ---------------------- | ---- | ------------------------------------- | -| handle | number | Yes | Handle of the **Finish** operation.| -| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Finish** operation.| -| callback | AsyncCallback\<[HuksResult](#huksresultdeprecated)> | Yes| Callback invoked to return the result.| +| handle | number | Yes | Handle for the **finish** operation.| +| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **finish** operation.| +| callback | AsyncCallback\<[HuksResult](#huksresultdeprecated)> | Yes| Callback invoked to return the **finish** operation result.| ## huks.finish(deprecated) @@ -2574,8 +2574,8 @@ Completes the key operation and releases resources. This API uses a promise to r | Name | Type | Mandatory| Description | | -------- | ---------------------- | ---- | ------------------------------------- | -| handle | number | Yes | Handle of the **Finish** operation.| -| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Finish** operation.| +| handle | number | Yes | Handle for the **finish** operation.| +| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **finish** operation.| **Return value** @@ -2597,9 +2597,9 @@ Aborts the use of the key. This API uses an asynchronous callback to return the | Name | Type | Mandatory| Description | | -------- | ---------------------- | ---- | ------------------------------------- | -| handle | number | Yes | Handle of the **Abort** operation.| -| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Abort** operation.| -| callback | AsyncCallback\<[HuksResult](#huksresultdeprecated)> | Yes| Callback invoked to return the result.| +| handle | number | Yes | Handle for the **abort** operation.| +| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **abort** operation.| +| callback | AsyncCallback\<[HuksResult](#huksresultdeprecated)> | Yes| Callback invoked to return the **abort** operation result. | **Example** @@ -2607,7 +2607,7 @@ Aborts the use of the key. This API uses an asynchronous callback to return the /* huks.init, huks.update, and huks.finish must be used together. * If an error occurs in any of them, huks.abort must be called to terminate the use of the key. * - * The following uses the callback of an RSA 1024-bit key as an example. + * The following uses the callback of an RSA 1024 key as an example. */ let keyalias = "HuksDemoRSA"; let properties = new Array(); @@ -2708,14 +2708,14 @@ Aborts the use of the key. This API uses a promise to return the result. | Name | Type | Mandatory| Description | | -------- | ---------------------- | ---- | ------------------------------------- | -| handle | number | Yes | Handle of the **Abort** operation.| -| options | [HuksOptions](#huksoptions) | Yes | Parameters of the **Abort** operation.| +| handle | number | Yes | Handle for the **abort** operation.| +| options | [HuksOptions](#huksoptions) | Yes | Parameter set used for the **abort** operation.| **Return value** | Type | Description | | ----------------------------------- | -------------------------------------------------- | -| Promise\<[HuksResult](#huksresultdeprecated)> | Promise used to return the result.| +| Promise\<[HuksResult](#huksresultdeprecated)> | Promise used to return the **abort** operation result.| **Example** @@ -2889,11 +2889,6 @@ Enumerates the error codes. | HUKS_ERROR_NEW_ROOT_KEY_MATERIAL_EXIST | -36 |New root key material exists.| | HUKS_ERROR_UPDATE_ROOT_KEY_MATERIAL_FAIL | -37 |Failed to update the root key material.| | HUKS_ERROR_VERIFICATION_FAILED | -38 |Failed to verify the certificate chain.| -| HUKS_ERROR_GET_USERIAM_SECINFO_FAILED9+ | -40 |Failed to obtain the security attribute information of the user.| -| HUKS_ERROR_GET_USERIAM_AUTHINFO_FAILED9+ | -41 |Failed to obtain the authentication information of the user.| -| HUKS_ERROR_USER_AUTH_TYPE_NOT_SUPPORT9+ | -42 |The access control of the current authentication type is not supported.| -| HUKS_ERROR_KEY_AUTH_FAILED9+ | -43 |The access control authentication has failed.| -| HUKS_ERROR_DEVICE_NO_CREDENTIAL9+ | -44 |No credential has been enrolled for the device.| | HUKS_ERROR_CHECK_GET_ALG_FAIL | -100 |Failed to obtain the ALG. | | HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL | -101 |Failed to obtain the key size.| | HUKS_ERROR_CHECK_GET_PADDING_FAIL | -102 |Failed to obtain the padding algorithm.| @@ -2920,7 +2915,5 @@ Enumerates the error codes. | HUKS_ERROR_INVALID_SALT | -123 |Invalid salt value.| | HUKS_ERROR_INVALID_ITERATION | -124 |Invalid iteration count.| | HUKS_ERROR_INVALID_OPERATION | -125 |Invalid operation.| -| HUKS_ERROR_INVALID_WRAPPED_FORMAT9+ | -126 |Incorrect format of the wrapped key being imported.| -| HUKS_ERROR_INVALID_USAGE_OF_KEY9+ | -127 |Incorrect purpose of the wrapped key being imported.| | HUKS_ERROR_INTERNAL_ERROR | -999 |Internal error.| | HUKS_ERROR_UNKNOWN_ERROR | -1000 |Unknown error.| diff --git a/en/application-dev/reference/apis/js-apis-i18n.md b/en/application-dev/reference/apis/js-apis-i18n.md index cda33f5434360fe5ca3f21f9f2c0a04ad5b50474..db85444d68f958ed8af462815a2865ddc02adc0f 100644 --- a/en/application-dev/reference/apis/js-apis-i18n.md +++ b/en/application-dev/reference/apis/js-apis-i18n.md @@ -1,12 +1,12 @@ # @ohos.i18n (Internationalization) -The **i18n** module provides system-related or enhanced i18n capabilities, such as locale management, phone number formatting, and calendar, through supplementary i18n APIs that are not defined in ECMA 402. -The [intl](js-apis-intl.md) module provides basic i18n capabilities through the standard i18n APIs defined in ECMA 402. It works with the i18n module to provide a complete suite of i18n capabilities. + This module provides system-related or enhanced I18N capabilities, such as locale management, phone number formatting, and calendar, through supplementary I18N APIs that are not defined in ECMA 402. +The [Intl](js-apis-intl.md) module provides basic I18N capabilities through the standard I18N APIs defined in ECMA 402. It works with the I18N module to provide a complete suite of I18N capabilities. > **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. > -> - This module provides system-related or enhanced i18n capabilities, such as locale management, phone number formatting, and calendar, through supplementary i18n APIs that are not defined in ECMA 402. For details about the basic i18n capabilities, see [intl](js-apis-intl.md). +> - This module provides system-related or enhanced I18N capabilities, such as locale management, phone number formatting, and calendar, through supplementary I18N APIs that are not defined in ECMA 402. For details about the basic I18N capabilities, see [Intl](js-apis-intl.md). ## Modules to Import @@ -42,7 +42,7 @@ Obtains the localized script for the specified country. **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -53,7 +53,7 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod try { let displayCountry = I18n.System.getDisplayCountry("zh-CN", "en-GB"); // displayCountry = "China" } catch(error) { - console.error(`call System.getDisplayCountry failed, error code: ${error.code}, message: ${error.message}.`) + console.error(`call System.getDisplayCountry failed, error code: ${error.code}, message: ${error.message}.`); } ``` @@ -81,7 +81,7 @@ Obtains the localized script for the specified language. **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -92,7 +92,7 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod try { let displayLanguage = I18n.System.getDisplayLanguage("zh", "en-GB"); // displayLanguage = Chinese } catch(error) { - console.error(`call System.getDisplayLanguage failed, error code: ${error.code}, message: ${error.message}.`) + console.error(`call System.getDisplayLanguage failed, error code: ${error.code}, message: ${error.message}.`); } ``` @@ -100,7 +100,7 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod static getSystemLanguages(): Array<string> -Obtains the list of system languages. +Obtains the list of system languages. For details about languages, see [Instantiating the Locale Object](../../internationalization/intl-guidelines.md#how-to-develop). **System capability**: SystemCapability.Global.I18n @@ -112,7 +112,7 @@ Obtains the list of system languages. **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -123,7 +123,7 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod try { let systemLanguages = I18n.System.getSystemLanguages(); // [ "en-Latn-US", "zh-Hans" ] } catch(error) { - console.error(`call System.getSystemLanguages failed, error code: ${error.code}, message: ${error.message}.`) + console.error(`call System.getSystemLanguages failed, error code: ${error.code}, message: ${error.message}.`); } ``` @@ -131,7 +131,7 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod static getSystemCountries(language: string): Array<string> -Obtains the list of countries and regions supported for the specified language. +Obtains the list of countries and regions supported for the specified language. For details about countries or regions, see [Instantiating the Locale Object](../../internationalization/intl-guidelines.md#how-to-develop). **System capability**: SystemCapability.Global.I18n @@ -149,7 +149,7 @@ Obtains the list of countries and regions supported for the specified language. **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -160,7 +160,7 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod try { let systemCountries = I18n.System.getSystemCountries('zh'); // systemCountries = [ "ZW", "YT", "YE", ..., "ER", "CN", "DE" ], 240 countries or regions in total } catch(error) { - console.error(`call System.getSystemCountries failed, error code: ${error.code}, message: ${error.message}.`) + console.error(`call System.getSystemCountries failed, error code: ${error.code}, message: ${error.message}.`); } ``` @@ -187,7 +187,7 @@ Checks whether the system language matches the specified region. **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -198,7 +198,7 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod try { let res = I18n.System.isSuggested('zh', 'CN'); // res = true } catch(error) { - console.error(`call System.isSuggested failed, error code: ${error.code}, message: ${error.message}.`) + console.error(`call System.isSuggested failed, error code: ${error.code}, message: ${error.message}.`); } ``` @@ -206,7 +206,7 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod static getSystemLanguage(): string -Obtains the system language. +Obtains the system language. For details about languages, see [Instantiating the Locale Object](../../internationalization/intl-guidelines.md#how-to-develop). **System capability**: SystemCapability.Global.I18n @@ -218,7 +218,7 @@ Obtains the system language. **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -229,7 +229,7 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod try { let systemLanguage = I18n.System.getSystemLanguage(); // systemLanguage indicates the current system language. } catch(error) { - console.error(`call System.getSystemLanguage failed, error code: ${error.code}, message: ${error.message}.`) + console.error(`call System.getSystemLanguage failed, error code: ${error.code}, message: ${error.message}.`); } ``` @@ -239,7 +239,7 @@ static setSystemLanguage(language: string): void Sets the system language. Currently, this API does not support real-time updating of the system language. -**System API**: This is a system API. +This is a system API. **Permission required**: ohos.permission.UPDATE_CONFIGURATION @@ -253,7 +253,7 @@ Sets the system language. Currently, this API does not support real-time updatin **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -264,7 +264,7 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod try { I18n.System.setSystemLanguage('zh'); // Set the current system language to zh. } catch(error) { - console.error(`call System.setSystemLanguage failed, error code: ${error.code}, message: ${error.message}.`) + console.error(`call System.setSystemLanguage failed, error code: ${error.code}, message: ${error.message}.`); } ``` @@ -272,7 +272,7 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod static getSystemRegion(): string -Obtains the system region. +Obtains the system region. For details about system regions, see [Instantiating the Locale Object](../../internationalization/intl-guidelines.md#how-to-develop). **System capability**: SystemCapability.Global.I18n @@ -284,7 +284,7 @@ Obtains the system region. **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -295,7 +295,7 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod try { let systemRegion = I18n.System.getSystemRegion(); // Obtain the current system region. } catch(error) { - console.error(`call System.getSystemRegion failed, error code: ${error.code}, message: ${error.message}.`) + console.error(`call System.getSystemRegion failed, error code: ${error.code}, message: ${error.message}.`); } ``` @@ -305,7 +305,7 @@ static setSystemRegion(region: string): void Sets the system region. -**System API**: This is a system API. +This is a system API. **Permission required**: ohos.permission.UPDATE_CONFIGURATION @@ -319,7 +319,7 @@ Sets the system region. **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -330,7 +330,7 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod try { I18n.System.setSystemRegion('CN'); // Set the current system region to CN. } catch(error) { - console.error(`call System.setSystemRegion failed, error code: ${error.code}, message: ${error.message}.`) + console.error(`call System.setSystemRegion failed, error code: ${error.code}, message: ${error.message}.`); } ``` @@ -338,7 +338,7 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod static getSystemLocale(): string -Obtains the system locale. +Obtains the system locale. For details about system locales, see [Instantiating the Locale Object](../../internationalization/intl-guidelines.md#how-to-develop). **System capability**: SystemCapability.Global.I18n @@ -350,7 +350,7 @@ Obtains the system locale. **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -361,7 +361,7 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod try { let systemLocale = I18n.System.getSystemLocale(); // Obtain the current system locale. } catch(error) { - console.error(`call System.getSystemLocale failed, error code: ${error.code}, message: ${error.message}.`) + console.error(`call System.getSystemLocale failed, error code: ${error.code}, message: ${error.message}.`); } ``` @@ -371,7 +371,7 @@ static setSystemLocale(locale: string): void Sets the system locale. -**System API**: This is a system API. +This is a system API. **Permission required**: ohos.permission.UPDATE_CONFIGURATION @@ -385,7 +385,7 @@ Sets the system locale. **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -396,7 +396,7 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod try { I18n.System.setSystemLocale('zh-CN'); // Set the current system locale to zh-CN. } catch(error) { - console.error(`call System.setSystemLocale failed, error code: ${error.code}, message: ${error.message}.`) + console.error(`call System.setSystemLocale failed, error code: ${error.code}, message: ${error.message}.`); } ``` @@ -416,7 +416,7 @@ Checks whether the 24-hour clock is used. **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -427,7 +427,7 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod try { let is24HourClock = I18n.System.is24HourClock(); // Check whether the 24-hour clock is enabled. } catch(error) { - console.error(`call System.is24HourClock failed, error code: ${error.code}, message: ${error.message}.`) + console.error(`call System.is24HourClock failed, error code: ${error.code}, message: ${error.message}.`); } ``` @@ -437,7 +437,7 @@ static set24HourClock(option: boolean): void Sets the 24-hour clock. -**System API**: This is a system API. +This is a system API. **Permission required**: ohos.permission.UPDATE_CONFIGURATION @@ -451,7 +451,7 @@ Sets the 24-hour clock. **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -463,7 +463,7 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod try { I18n.System.set24HourClock(true); } catch(error) { - console.error(`call System.set24HourClock failed, error code: ${error.code}, message: ${error.message}.`) + console.error(`call System.set24HourClock failed, error code: ${error.code}, message: ${error.message}.`); } ``` @@ -473,7 +473,7 @@ static addPreferredLanguage(language: string, index?: number): void Adds a preferred language to the specified position on the preferred language list. -**System API**: This is a system API. +This is a system API. **Permission required**: ohos.permission.UPDATE_CONFIGURATION @@ -488,7 +488,7 @@ Adds a preferred language to the specified position on the preferred language li **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -502,7 +502,7 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod try { I18n.System.addPreferredLanguage(language, index); // Add zh-CN to the first place in the preferred language list. } catch(error) { - console.error(`call System.addPreferredLanguage failed, error code: ${error.code}, message: ${error.message}.`) + console.error(`call System.addPreferredLanguage failed, error code: ${error.code}, message: ${error.message}.`); } ``` @@ -512,7 +512,7 @@ static removePreferredLanguage(index: number): void Deletes a preferred language from the specified position on the preferred language list. -**System API**: This is a system API. +This is a system API. **Permission required**: ohos.permission.UPDATE_CONFIGURATION @@ -526,7 +526,7 @@ Deletes a preferred language from the specified position on the preferred langua **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -539,7 +539,7 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod try { I18n.System.removePreferredLanguage(index); } catch(error) { - console.error(`call System.removePreferredLanguage failed, error code: ${error.code}, message: ${error.message}.`) + console.error(`call System.removePreferredLanguage failed, error code: ${error.code}, message: ${error.message}.`); } ``` @@ -547,7 +547,7 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod static getPreferredLanguageList(): Array<string> -Obtains the preferred language list. +Obtains the list of preferred languages. **System capability**: SystemCapability.Global.I18n @@ -555,11 +555,11 @@ Obtains the preferred language list. | Type | Description | | ------------------- | --------- | -| Array<string> | Preferred language list.| +| Array<string> | List of preferred languages.| **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -570,7 +570,7 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod try { let preferredLanguageList = I18n.System.getPreferredLanguageList(); // Obtain the current preferred language list. } catch(error) { - console.error(`call System.getPreferredLanguageList failed, error code: ${error.code}, message: ${error.message}.`) + console.error(`call System.getPreferredLanguageList failed, error code: ${error.code}, message: ${error.message}.`); } ``` @@ -590,7 +590,7 @@ Obtains the first language in the preferred language list. **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -601,7 +601,7 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod try { let firstPreferredLanguage = I18n.System.getFirstPreferredLanguage(); // Obtain the first language in the preferred language list. } catch(error) { - console.error(`call System.getFirstPreferredLanguage failed, error code: ${error.code}, message: ${error.message}.`) + console.error(`call System.getFirstPreferredLanguage failed, error code: ${error.code}, message: ${error.message}.`); } ``` @@ -621,7 +621,7 @@ Obtains the preferred language of an application. **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -632,7 +632,7 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod try { let appPreferredLanguage = I18n.System.getAppPreferredLanguage(); // Obtain the preferred language of an application. } catch(error) { - console.error(`call System.getAppPreferredLanguage failed, error code: ${error.code}, message: ${error.message}.`) + console.error(`call System.getAppPreferredLanguage failed, error code: ${error.code}, message: ${error.message}.`); } ``` @@ -640,9 +640,9 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod static setUsingLocalDigit(flag: boolean): void -Sets whether to enable the local digit switch. +Specifies whether to enable use of local digits. -**System API**: This is a system API. +This is a system API. **Permission required**: ohos.permission.UPDATE_CONFIGURATION @@ -652,11 +652,11 @@ Sets whether to enable the local digit switch. | Name | Type | Mandatory | Description | | ---- | ------- | ---- | ------------------------------- | -| flag | boolean | Yes | Whether to enable the local digit switch. The value **true** means to enable the local digit switch, and the value **false** indicates the opposite.| +| flag | boolean | Yes | Whether to turn on the local digit switch. The value **true** means to turn on the local digit switch, and the value **false** indicates the opposite.| **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -667,7 +667,7 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod try { I18n.System.setUsingLocalDigit(true); // Enable the local digit switch. } catch(error) { - console.error(`call System.setUsingLocalDigit failed, error code: ${error.code}, message: ${error.message}.`) + console.error(`call System.setUsingLocalDigit failed, error code: ${error.code}, message: ${error.message}.`); } ``` @@ -675,7 +675,7 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod static getUsingLocalDigit(): boolean -Checks whether the local digit switch is turned on. +Checks whether use of local digits is enabled. **System capability**: SystemCapability.Global.I18n @@ -687,7 +687,7 @@ Checks whether the local digit switch is turned on. **Error codes** -For details about the error codes, see [i18n Error Codes](../errorcodes/errorcode-i18n.md). +For details about the error codes, see [I18N Error Codes](../errorcodes/errorcode-i18n.md). | ID | Error Message | | ------ | ---------------------- | @@ -698,7 +698,7 @@ For details about the error codes, see [i18n Error Codes](../errorcodes/errorcod try { let status = I18n.System.getUsingLocalDigit(); // Check whether the local digit switch is enabled. } catch(error) { - console.error(`call System.getUsingLocalDigit failed, error code: ${error.code}, message: ${error.message}.`) + console.error(`call System.getUsingLocalDigit failed, error code: ${error.code}, message: ${error.message}.`); } ``` @@ -1025,7 +1025,7 @@ Checks whether the specified date in this **Calendar** object is a weekend. | Name | Type | Mandatory | Description | | ---- | ---- | ---- | ---------------------------------------- | -| date | Date | No | Specified date in this **Calendar** object. If this parameter is left unspecified, the system checks whether the current date in the **Calendar** object is a weekend.| +| date | Date | No | Specified date in this **Calendar** object. If the **date** parameter is not specified, the system checks whether the current date is a weekend.| **Return value** @@ -1059,7 +1059,7 @@ Creates a **PhoneNumberFormat** object. | Name | Type | Mandatory | Description | | ------- | ---------------------------------------- | ---- | ---------------- | | country | string | Yes | Country or region to which the phone number to be formatted belongs.| -| options | [PhoneNumberFormatOptions](#phonenumberformatoptions8) | No | Options of the **PhoneNumberFormat** object. | +| options | [PhoneNumberFormatOptions](#phonenumberformatoptions9) | No | Options of the **PhoneNumberFormat** object. | **Example** ```js @@ -1149,7 +1149,7 @@ Obtains the home location of a phone number. ``` -## PhoneNumberFormatOptions8+ +## PhoneNumberFormatOptions9+ Defines the options for this PhoneNumberFormat object. @@ -1194,7 +1194,7 @@ Creates an **IndexUtil** object. **Example** ```js - let indexUtil= I18n.getInstance("zh-CN"); + let indexUtil = I18n.getInstance("zh-CN"); ``` @@ -1267,7 +1267,7 @@ Obtains the index of a text object. **Example** ```js - let indexUtil= I18n.getInstance("zh-CN"); + let indexUtil = I18n.getInstance("zh-CN"); let index = indexUtil.getIndex("hi"); // index = "H" ``` @@ -1382,7 +1382,7 @@ Puts the [BreakIterator](#breakiterator8) object to the first text boundary, whi **Example** ```js - let iterator = i18n.getLineInstance("en"); + let iterator = I18n.getLineInstance("en"); iterator.setLineBreakText("Apple is my favorite fruit."); let firstPos = iterator.first(); // firstPos = 0 ``` @@ -1689,7 +1689,7 @@ Obtains the list of time zone city IDs supported by the system. static getCityDisplayName(cityID: string, locale: string): string -Obtains the localized representation of a time zone city in the specified locale. +Obtains the localized display of a time zone city in the specified locale. **System capability**: SystemCapability.Global.I18n @@ -2112,6 +2112,75 @@ Obtains the sequence of the year, month, and day in the specified locale. ``` +## Normalizer10+ + +### getInstance10+ + +static getInstance(mode: NormalizerMode): Normalizer + +Obtains a **Normalizer** object for text normalization. + +**System capability**: SystemCapability.Global.I18n + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------ | ------ | ---- | ------------------------- | +| mode | [NormalizerMode](#normalizermode10) | Yes | Text normalization mode.| + +**Return value** + +| Type | Description | +| ------ | ------------------- | +| [Normalizer](#normalizer10) | **Normalizer** object for text normalization.| + +**Example** + ```js + let normalizer = I18n.Normalizer.getInstance(I18n.NormalizerMode.NFC); + ``` + + +### normalize10+ + +normalize(text: string): string + +Normalizes text strings. + +**System capability**: SystemCapability.Global.I18n + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------ | ------ | ---- | ------------------------- | +| text | string | Yes | Text strings to be normalized.| + +**Return value** + +| Type | Description | +| ------ | ------------------- | +| string | Normalized text strings.| + +**Example** + ```js + let normalizer = I18n.Normalizer.getInstance(I18n.NormalizerMode.NFC); + let normalizedText = normalizer.normalize('\u1E9B\u0323'); // normalizedText = \u1E9B\u0323 + ``` + + +## NormalizerMode10+ + +Enumerates text normalization modes. + +**System capability**: SystemCapability.Global.I18n + +| Name| Value| Description| +| -------- | -------- | -------- | +| NFC | 1 | NFC.| +| NFD | 2 | NFD.| +| NFKC | 3 | NFKC.| +| NFKD | 4 | NFKD.| + + ## I18n.getDisplayCountry(deprecated) getDisplayCountry(country: string, locale: string, sentenceCase?: boolean): string @@ -2363,7 +2432,7 @@ This API is supported since API version 8 and is deprecated since API version 9. getPreferredLanguageList(): Array<string> -Obtains the preferred language list. +Obtains the list of preferred languages. This API is supported since API version 8 and is deprecated since API version 9. You are advised to use [System.getPreferredLanguageList](#getpreferredlanguagelist9) instead. @@ -2373,7 +2442,7 @@ This API is supported since API version 8 and is deprecated since API version 9. | Type | Description | | ------------------- | --------- | -| Array<string> | Preferred language list.| +| Array<string> | List of preferred languages.| **Example** ```js diff --git a/en/application-dev/reference/apis/js-apis-image.md b/en/application-dev/reference/apis/js-apis-image.md index c675e395d694b58c2d79bbc152344f98b2505e75..9c6037df7f907354d71a6eacb211855b579945a5 100644 --- a/en/application-dev/reference/apis/js-apis-image.md +++ b/en/application-dev/reference/apis/js-apis-image.md @@ -80,9 +80,9 @@ image.createPixelMap(color, opts, (error, pixelmap) => { ## PixelMap7+ -Provides APIs to read or write image pixel map data and obtain image pixel map information. Before calling any API in **PixelMap**, you must use **createPixelMap** to create a **PixelMap** object. +Provides APIs to read or write image pixel map data and obtain image pixel map information. Before calling any API in **PixelMap**, you must use **createPixelMap** to create a **PixelMap** object. Currently, the maximum size of a serialized pixel map is 128 MB. A larger size will cause a display failure. The size is calculated as follows: Width * Height * Number of bytes occupied by each pixel. - ### Attributes +### Attributes **System capability**: SystemCapability.Multimedia.Image.Core @@ -948,8 +948,18 @@ Creates an **ImageSource** instance based on the URI. **Example** ```js -let context = featureAbility.getContext(); -let path = context.getCacheDir() + "test.jpg"; +// Stage model +const context = getContext(this); +const path = context.cacheDir() + "/test.jpg"; +const imageSourceApi = image.createImageSource(path); +``` + +```js +// FA model +import featureAbility from '@ohos.ability.featureAbility'; + +const context = featureAbility.getContext(); +const path = context.getCacheDir() + "/test.jpg"; const imageSourceApi = image.createImageSource(path); ``` @@ -1479,8 +1489,8 @@ Creates a **PixelMap** object based on the default parameters. This API uses an ```js imageSourceApi.createPixelMap((err, pixelmap) => { - console.info('Succeeded in creating pixelmap object.'); - }) + console.info('Succeeded in creating pixelmap object.'); +}) ``` ### createPixelMap7+ @@ -1515,6 +1525,177 @@ imageSourceApi.createPixelMap(decodingOptions, pixelmap => { }) ``` +### createPixelMapList10+ + +createPixelMapList(options?: DecodingOptions): Promise>; + +Creates an array of **PixelMap** objects based on image decoding parameters. This API uses a promise to return the result. + +**System capability**: SystemCapability.Multimedia.Image.ImageSource + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------- | ---- | -------------------------- | +| options | [DecodingOptions](#decodingoptions7) | No | Image decoding parameters. | + +**Return value** + +| Type | Description | +| -------------------------------- | --------------------- | +| Promise> | Promise used to return an array of **PixeMap** objects.| + +**Example** + +```js +let decodeOpts = { + sampleSize: 1, + editable: true, + desiredSize: { width: 198, height: 202 }, + rotate: 0, + desiredPixelFormat: RGBA_8888, + index: 0, +}; +let pixelmaplist = await imageSourceApi.createPixelMapList(decodeOpts); +``` + +### createPixelMapList10+ + +createPixelMapList(callback: AsyncCallback>): void + +Creates an array of **PixelMap** objects based on the default parameters. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Multimedia.Image.ImageSource + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------- | ---- | -------------------------- | +| callback | AsyncCallback> | Yes | Callback used to return an array of **PixeMap** objects.| + +**Example** + +```js +imageSourceApi.createPixelMap( pixelmaplist => { + console.info('Succeeded in creating pixelmaplist object.'); +}) +``` + +### createPixelMapList10+ + +createPixelMapList(options: DecodingOptions, callback: AsyncCallback>): void; + +Creates an array of **PixelMap** objects based on image decoding parameters. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Multimedia.Image.ImageSource + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | -------------------- | ---- | ---------------------------------- | +| options | [DecodingOptions](#decodingoptions7) | Yes| Image decoding parameters.| +| callback | AsyncCallback> | Yes | Callback used to return an array of **PixeMap** objects.| + +**Example** + +```js +let decodeOpts = { + sampleSize: 1, + editable: true, + desiredSize: { width: 198, height: 202 }, + rotate: 0, + desiredPixelFormat: RGBA_8888, + index: 0, +}; +imageSourceApi.createPixelMap(decodeOpts, pixelmaplist => { + console.log('Succeeded in creating pixelmaplist object.'); +}) +``` + +### getDelayTime10+ + +getDelayTime(callback: AsyncCallback>): void; + +Obtains an array of delay times. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Multimedia.Image.ImageSource + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | -------------------- | ---- | ---------------------------------- | +| callback | AsyncCallback> | Yes | Callback used to return an array of delay times.| + +**Example** + +```js +imageSourceApi.getDelayTime( delayTimes => { + console.log('Succeeded in getting delay time.'); +}); +``` + +### getDelayTime10+ + +getDelayTime(): Promise>; + +Obtains an array of delay times. This API uses a promise to return the result. + +**System capability**: SystemCapability.Multimedia.Image.ImageSource + +**Return value** + +| Type | Description | +| -------------- | --------------------------- | +| Promise> | Promise used to return an array of delay times.| + +**Example** + +```js +let delayTimes = await imageSourceApi.getDelayTime(); +``` + +### getFrameCount10+ + +getFrameCount(callback: AsyncCallback): void; + +Obtains the number of frames. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Multimedia.Image.ImageSource + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | -------------------- | ---- | ---------------------------------- | +| callback | AsyncCallback\ | Yes | Callback used to return the number of frames.| + +**Example** + +```js +imageSourceApi.getFrameCount( frameCount => { + console.log('Succeeded in getting frame count.'); +}); +``` + +### getFrameCount10+ + +getFrameCount(): Promise\; + +Obtains the number of frames. This API uses a promise to return the result. + +**System capability**: SystemCapability.Multimedia.Image.ImageSource + +**Return value** + +| Type | Description | +| -------------- | --------------------------- | +| Promise\ | Promise used to return the number of frames.| + +**Example** + +```js +let frameCount = await imageSourceApi.getFrameCount(); +``` + ### release release(callback: AsyncCallback\): void @@ -2046,7 +2227,7 @@ Creates an **ImageCreator** instance by specifying the image width, height, form | Type | Description | | ------------------------------ | --------------------------------------- | -| [ImageCreator](#imagecreator9) | Returns an **ImageCreator** instance if the operation is successful.| +| [ImageCreator](#imagecreator9) | Returns an **ImageCreator** instance if the operation is successful.| **Example** @@ -2548,7 +2729,7 @@ Describes image properties. ## PropertyKey7+ -Describes the exchangeable image file format (EXIF) information of an image. +Describes the exchangeable image file format (EXIF) data of an image. **System capability**: SystemCapability.Multimedia.Image.Core diff --git a/en/application-dev/reference/apis/js-apis-inner-ability-abilityResult.md b/en/application-dev/reference/apis/js-apis-inner-ability-abilityResult.md index 54c8f0400be1f1e8b9f9b836098a94ace0c4f637..13573de144bf718175bf6690408f7f52c388a8fc 100644 --- a/en/application-dev/reference/apis/js-apis-inner-ability-abilityResult.md +++ b/en/application-dev/reference/apis/js-apis-inner-ability-abilityResult.md @@ -1,6 +1,6 @@ # AbilityResult -The **AbilityResult** module defines the result code and data returned when an ability is terminated after being started. You can use [startAbilityForResult](js-apis-ability-context.md#abilitycontextstartabilityforresult) to obtain the **AbilityResult** object returned after the started ability is terminated. The startedability returns the **AbilityResult** object by calling [terminateSelfWithResult](js-apis-ability-context.md#abilitycontextterminateselfwithresult). +The **AbilityResult** module defines the result code and data returned when an ability is terminated after being started. You can use [startAbilityForResult](js-apis-ability-featureAbility.md#featureabilitystartabilityforresult7) to obtain the **AbilityResult** object returned after the started ability is terminated. The startedability returns the **AbilityResult** object by calling [terminateSelfWithResult](js-apis-ability-featureAbility.md#featureabilityterminateselfwithresult7). > **NOTE** > diff --git a/en/application-dev/reference/apis/js-apis-inner-ability-dataAbilityHelper.md b/en/application-dev/reference/apis/js-apis-inner-ability-dataAbilityHelper.md index 818b1e8e324ba1ffa5aa5301dbe3843c8d4e4ba0..6001a514c8b5f07874460271d0ebce3cf96c0987 100644 --- a/en/application-dev/reference/apis/js-apis-inner-ability-dataAbilityHelper.md +++ b/en/application-dev/reference/apis/js-apis-inner-ability-dataAbilityHelper.md @@ -39,8 +39,12 @@ let DAHelper = featureAbility.acquireDataAbilityHelper( 'dataability:///com.example.DataAbility' ); let mode = 'rw'; -DAHelper.openFile('dataability:///com.example.DataAbility', mode, (err, data) => { - console.info('openFile err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +DAHelper.openFile('dataability:///com.example.DataAbility', mode, (error, data) => { + if (error && error.code !== 0) { + console.error('openFile fail, error: ${JSON.stringify(error)}'); + } else { + console.log('openFile success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -170,8 +174,12 @@ import featureAbility from '@ohos.ability.featureAbility'; let DAHelper = featureAbility.acquireDataAbilityHelper( 'dataability:///com.example.DataAbility' ); -DAHelper.getType('dataability:///com.example.DataAbility', (err, data) => { - console.info('getType err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +DAHelper.getType('dataability:///com.example.DataAbility', (error, data) => { + if (error && error.code !== 0) { + console.error('getType fail, error: ${JSON.stringify(error)}'); + } else { + console.log('getType success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -230,8 +238,12 @@ import featureAbility from '@ohos.ability.featureAbility'; let DAHelper = featureAbility.acquireDataAbilityHelper( 'dataability:///com.example.DataAbility' ); -DAHelper.getFileTypes( 'dataability:///com.example.DataAbility', 'image/*', (err, data) => { - console.info('getFileTypes err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +DAHelper.getFileTypes( 'dataability:///com.example.DataAbility', 'image/*', (error, data) => { + if (error && error.code !== 0) { + console.error('getFileTypes fail, error: ${JSON.stringify(error)}'); + } else { + console.log('getFileTypes success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -290,8 +302,12 @@ import featureAbility from '@ohos.ability.featureAbility'; let DAHelper = featureAbility.acquireDataAbilityHelper( 'dataability:///com.example.DataAbility' ); -DAHelper.normalizeUri('dataability:///com.example.DataAbility', (err, data) => { - console.info('normalizeUri err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +DAHelper.normalizeUri('dataability:///com.example.DataAbility', (error, data) => { + if (error && error.code !== 0) { + console.error('normalizeUri fail, error: ${JSON.stringify(error)}'); + } else { + console.log('normalizeUri success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -349,8 +365,12 @@ import featureAbility from '@ohos.ability.featureAbility'; let DAHelper = featureAbility.acquireDataAbilityHelper( 'dataability:///com.example.DataAbility' ); -DAHelper.denormalizeUri('dataability:///com.example.DataAbility', (err, data) => { - console.info('denormalizeUri err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +DAHelper.denormalizeUri('dataability:///com.example.DataAbility', (error, data) => { + if (error && error.code !== 0) { + console.error('denormalizeUri fail, error: ${JSON.stringify(error)}'); + } else { + console.log('denormalizeUri success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -408,8 +428,12 @@ import featureAbility from '@ohos.ability.featureAbility'; let DAHelper = featureAbility.acquireDataAbilityHelper( 'dataability:///com.example.DataAbility' ); -DAHelper.notifyChange('dataability:///com.example.DataAbility', (err) => { - console.info('==========================>Called=======================>'); +DAHelper.notifyChange('dataability:///com.example.DataAbility', (error) => { + if (error && error.code !== 0) { + console.error('notifyChange fail, error: ${JSON.stringify(error)}'); + } else { + console.log('notifyChange success'); + } }); ``` @@ -474,8 +498,12 @@ const valueBucket = { 'salary': 200.5, 'blobType': 'u8', }; -DAHelper.insert('dataability:///com.example.DataAbility', valueBucket, (err, data) => { - console.info('insert err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +DAHelper.insert('dataability:///com.example.DataAbility', valueBucket, (error, data) => { + if (error && error.code !== 0) { + console.error('insert fail, error: ${JSON.stringify(error)}'); + } else { + console.log('insert success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -544,8 +572,12 @@ let DAHelper = featureAbility.acquireDataAbilityHelper( let cars = new Array({'name': 'roe11', 'age': 21, 'salary': 20.5, 'blobType': 'u8',}, {'name': 'roe12', 'age': 21, 'salary': 20.5, 'blobType': 'u8',}, {'name': 'roe13', 'age': 21, 'salary': 20.5, 'blobType': 'u8',}); -DAHelper.batchInsert('dataability:///com.example.DataAbility', cars, (err, data) => { - console.info('batchInsert err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +DAHelper.batchInsert('dataability:///com.example.DataAbility', cars, (error, data) => { + if (error && error.code !== 0) { + console.error('batchInsert fail, error: ${JSON.stringify(error)}'); + } else { + console.log('batchInsert success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -610,8 +642,12 @@ let DAHelper = featureAbility.acquireDataAbilityHelper( 'dataability:///com.example.DataAbility' ); let da = new ohos_data_ability.DataAbilityPredicates(); -DAHelper.delete('dataability:///com.example.DataAbility', da, (err, data) => { - console.info('delete err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +DAHelper.delete('dataability:///com.example.DataAbility', da, (error, data) => { + if (error && error.code !== 0) { + console.error('delete fail, error: ${JSON.stringify(error)}'); + } else { + console.log('delete success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -682,8 +718,12 @@ const va = { 'blobType': 'u8', }; let da = new ohos_data_ability.DataAbilityPredicates(); -DAHelper.update('dataability:///com.example.DataAbility', va, da, (err, data) => { - console.info('update err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +DAHelper.update('dataability:///com.example.DataAbility', va, da, (error, data) => { + if (error && error.code !== 0) { + console.error('update fail, error: ${JSON.stringify(error)}'); + } else { + console.log('update success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -756,8 +796,12 @@ let DAHelper = featureAbility.acquireDataAbilityHelper( ); let cars=new Array('value1', 'value2', 'value3', 'value4'); let da = new ohos_data_ability.DataAbilityPredicates(); -DAHelper.query('dataability:///com.example.DataAbility', cars, da, (err, data) => { - console.info('query err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +DAHelper.query('dataability:///com.example.DataAbility', cars, da, (error, data) => { + if (error && error.code !== 0) { + console.error('query fail, error: ${JSON.stringify(error)}'); + } else { + console.log('query success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -827,12 +871,12 @@ let dataAbilityHelper = featureAbility.acquireDataAbilityHelper( 'dataability:///com.example.jsapidemo.UserDataAbility' ); dataAbilityHelper.call('dataability:///com.example.jsapidemo.UserDataAbility', - 'method', 'arg', {'key1':'value1'}, (err, data) => { - if (err) { - console.error('Operation failed. Cause: ${err}'); - return; + 'method', 'arg', {'key1':'value1'}, (error, data) => { + if (error && error.code !== 0) { + console.error('call fail, error: ${JSON.stringify(error)}'); + } else { + console.log('call success, data: ${JSON.stringify(data)}'); } - console.info('Operation succeeded: ${data}'); }); ``` @@ -869,9 +913,9 @@ let dataAbilityHelper = featureAbility.acquireDataAbilityHelper( ); dataAbilityHelper.call('dataability:///com.example.jsapidemo.UserDataAbility', 'method', 'arg', {'key1':'value1'}).then((data) => { - console.info('Operation succeeded: ${data}'); + console.info('call success, data: ${data}'); }).catch((error) => { - console.error('Operation failed. Cause: ${error}'); + console.error('call failed, error: ${error}'); }); ``` @@ -901,12 +945,12 @@ 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; +dataAbilityHelper.executeBatch('dataability:///com.example.jsapidemo.UserDataAbility', op, (error, data) => { + if (error && error.code !== 0) { + console.error('executeBatch fail, error: ${JSON.stringify(error)}'); + } else { + console.log('executeBatch success, data: ${JSON.stringify(data)}'); } - console.info('Operation succeeded: ${data}'); }); ``` @@ -942,9 +986,9 @@ let dataAbilityHelper = featureAbility.acquireDataAbilityHelper( 'dataability:///com.example.jsapidemo.UserDataAbility' ); dataAbilityHelper.executeBatch('dataability:///com.example.jsapidemo.UserDataAbility', op).then((data) => { - console.info('Operation succeeded: ${data}'); + console.info('executeBatch success, data: ${data}'); }).catch((error) => { - console.error('Operation failed. Cause: ${error}'); + console.error('executeBatch failed, error: ${error}'); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-ability-dataAbilityResult.md b/en/application-dev/reference/apis/js-apis-inner-ability-dataAbilityResult.md index 2b90cd54ed08d8a8c954c0598049019d5673b2fa..6dffdaefc00b58a14fce5820b969866b3c564a0b 100644 --- a/en/application-dev/reference/apis/js-apis-inner-ability-dataAbilityResult.md +++ b/en/application-dev/reference/apis/js-apis-inner-ability-dataAbilityResult.md @@ -27,11 +27,9 @@ function executeBatchOperation() { DAHelper = featureAbility.acquireDataAbilityHelper(dataAbilityUri); if (DAHelper === null) { console.error('DAHelper is null'); - return; } } catch (err) { console.error('acquireDataAbilityHelper fail, error: ${JSON.stringify(err)}'); - return; } let valueBucket = { diff --git a/en/application-dev/reference/apis/js-apis-inner-ability-startAbilityParameter.md b/en/application-dev/reference/apis/js-apis-inner-ability-startAbilityParameter.md index c7462af45a51405c58e90e7811ba2e1078d1d177..80fcf902d83b94b26cd7f667d971855d4be959b9 100644 --- a/en/application-dev/reference/apis/js-apis-inner-ability-startAbilityParameter.md +++ b/en/application-dev/reference/apis/js-apis-inner-ability-startAbilityParameter.md @@ -36,11 +36,14 @@ let startAbilityParameter = { }; try { - featureAbility.startAbility(startAbilityParameter, (err, data) => { - console.log('errCode : ${JSON.stringify(err)}'); - console.log('data : ${JSON.stringify(data)}'); + featureAbility.startAbility(startAbilityParameter, (error, data) => { + if (error && error.code !== 0) { + console.error('startAbility fail, error: ${JSON.stringify(error)}'); + } else { + console.log('startAbility success, data: ${JSON.stringify(data)}'); + } }); } catch(error) { - console.log('startAbility error: ${JSON.stringify(error)}'); + console.error('startAbility error: ${JSON.stringify(error)}'); } ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-ability-want.md b/en/application-dev/reference/apis/js-apis-inner-ability-want.md index c71633638b2339f0457234c4d49a28330969a483..0eebe1059e031d66c7353b26ea8812b0c48e04a6 100644 --- a/en/application-dev/reference/apis/js-apis-inner-ability-want.md +++ b/en/application-dev/reference/apis/js-apis-inner-ability-want.md @@ -15,10 +15,10 @@ Want is a carrier for information transfer between objects (application componen | abilityName | string | No | Name of the ability. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can match a specific ability. The value of **abilityName** must be unique in an application.| | uri | string | No | URI. If **uri** is specified in a **Want** object, the **Want** object will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**.| | type | string | No | MIME type, that is, the type of the file to open, for example, **'text/xml'** and **'image/*'**. For details about the MIME type definition, see https://www.iana.org/assignments/media-types/media-types.xhtml?utm_source=ld246.com. | -| flags | number | No | How the **Want** object will be handled. By default, numbers are passed in. For details, see [flags](js-apis-ability-wantConstant.md#wantConstant.Flags).| -| action | string | No | Action to take, such as viewing and sharing application details. In implicit Want, you can define this field and use it together with **uri** or **parameters** to specify the operation to be performed on the data. For details, see [action](js-apis-app-ability-wantConstant.md#wantConstant.Action). For details about the definition and matching rules of implicit Want, see [Matching Rules of Explicit Want and Implicit Want](application-models/explicit-implicit-want-mappings.md). | -| parameters | {[key: string]: any} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:
**ohos.aafwk.callerPid**: PID of the caller.
**ohos.aafwk.param.callerToken**: token of the caller.
**ohos.aafwk.param.callerUid**: UID in [bundleInfo](js-apis-bundle-BundleInfo.md#bundleinfo-1), that is, the application UID in the bundle information.
- **component.startup.newRules**: whether to enable the new control rule.
- **moduleName**: module name of the caller. No matter what this field is set to, the correct module name will be sent to the peer.
- **ohos.dlp.params.sandbox**: available only for DLP files. | -| entities | Array\ | No | Additional category information (such as browser and video player) of the target ability. It is a supplement to **action** in implicit Want and is used to filter ability types. For details, see [entity](js-apis-app-ability-wantConstant.md#wantConstant.Entity). | +| flags | number | No | How the **Want** object will be handled. By default, numbers are passed in. For details, see [flags](js-apis-ability-wantConstant.md#wantconstantflags).| +| action | string | No | Action to take, such as viewing and sharing application details. In implicit Want, you can define this field and use it together with **uri** or **parameters** to specify the operation to be performed on the data. For details, see [action](js-apis-ability-wantConstant.md#wantconstantaction). For details about the definition and matching rules of implicit Want, see [Matching Rules of Explicit Want and Implicit Want](../../application-models/explicit-implicit-want-mappings.md). | +| parameters | {[key: string]: Object} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:
- **ohos.aafwk.callerPid**: PID of the caller.
- **ohos.aafwk.param.callerToken**: token of the caller.
**ohos.aafwk.param.callerUid**: UID in [bundleInfo](js-apis-bundle-BundleInfo.md#bundleinfo), that is, the application UID in the bundle information.
- **component.startup.newRules**: whether to enable the new control rule.
- **moduleName**: module name of the caller. No matter what this field is set to, the correct module name will be sent to the peer.
- **ohos.dlp.params.sandbox**: available only for DLP files. | +| entities | Array\ | No | Additional category information (such as browser and video player) of the target ability. It is a supplement to **action** in implicit Want and is used to filter ability types. For details, see [entity](js-apis-app-ability-wantConstant.md#wantconstantentity). | | moduleName9+ | string | No | Module to which the ability belongs.| **Example** @@ -41,12 +41,12 @@ Want is a carrier for information transfer between objects (application componen - Passing a file descriptor (FD) (called in the UIAbility object, where context in the example is the context object of the UIAbility): ```ts - import fileio from '@ohos.fileio'; + import fs from '@ohos.file.fs'; // ... let fd; try { - fd = fileio.openSync('/data/storage/el2/base/haps/pic.png'); + fd = fs.openSync('/data/storage/el2/base/haps/pic.png').fd; } catch(e) { console.error('openSync fail: ${JSON.stringify(e)}'); } @@ -68,4 +68,5 @@ Want is a carrier for information transfer between objects (application componen - For more details and examples, see [Want](../../application-models/want-overview.md). - + + diff --git a/en/application-dev/reference/apis/js-apis-inner-app-context.md b/en/application-dev/reference/apis/js-apis-inner-app-context.md index 4b22df32e51f014e4697c88dab634fa234407760..79fcf1af73e773ca24167bef9f2aa4052d5293a2 100644 --- a/en/application-dev/reference/apis/js-apis-inner-app-context.md +++ b/en/application-dev/reference/apis/js-apis-inner-app-context.md @@ -41,8 +41,12 @@ If this API is called for the first time, a root directory will be created. ```ts import featureAbility from '@ohos.ability.featureAbility'; let context = featureAbility.getContext(); -context.getOrCreateLocalDir((err, data)=>{ - console.info('getOrCreateLocalDir err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +context.getOrCreateLocalDir((error, data)=>{ + if (error && error.code !== 0) { + console.error('getOrCreateLocalDir fail, error: ${JSON.stringify(error)}'); + } else { + console.log('getOrCreateLocalDir success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -97,8 +101,12 @@ import featureAbility from '@ohos.ability.featureAbility'; import bundle from '@ohos.bundle.bundleManager'; let context = featureAbility.getContext(); bundle.getBundleInfo('com.context.test', 1, (err, datainfo) =>{ - context.verifyPermission('com.example.permission', {uid:datainfo.appInfo.uid}, (err, data) =>{ - console.info('verifyPermission err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); + context.verifyPermission('com.example.permission', {uid:datainfo.appInfo.uid}, (error, data) =>{ + if (error && error.code !== 0) { + console.error('verifyPermission fail, error: ${JSON.stringify(error)}'); + } else { + console.log('verifyPermission success, data: ${JSON.stringify(data)}'); + } }); }); ``` @@ -126,8 +134,12 @@ Verifies whether the current PID and UID have the given permission. This API use ```ts import featureAbility from '@ohos.ability.featureAbility'; let context = featureAbility.getContext(); -context.verifyPermission('com.example.permission', (err, data) =>{ - console.info('verifyPermission err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +context.verifyPermission('com.example.permission', (error, data) =>{ + if (error && error.code !== 0) { + console.error('verifyPermission fail, error: ${JSON.stringify(error)}'); + } else { + console.log('verifyPermission success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -193,8 +205,12 @@ context.requestPermissionsFromUser( 'com.example.permission4', 'com.example.permission5'], 1, - (err, data) => { - console.info('requestPermissionsFromUser err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); + (error, data) => { + if (error && error.code !== 0) { + console.error('requestPermissionsFromUser fail, error: ${JSON.stringify(error)}'); + } else { + console.log('requestPermissionsFromUser success, data: ${JSON.stringify(data)}'); + } } ); ``` @@ -259,8 +275,12 @@ Obtains information about the current application. This API uses an asynchronous ```ts import featureAbility from '@ohos.ability.featureAbility'; let context = featureAbility.getContext(); -context.getApplicationInfo((err, data) => { - console.info('getApplicationInfo err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +context.getApplicationInfo((error, data) => { + if (error && error.code !== 0) { + console.error('getApplicationInfo fail, error: ${JSON.stringify(error)}'); + } else { + console.log('getApplicationInfo success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -311,8 +331,12 @@ Obtains the bundle name of this ability. This API uses an asynchronous callback ```ts import featureAbility from '@ohos.ability.featureAbility'; let context = featureAbility.getContext(); -context.getBundleName((err, data) => { - console.info('getBundleName err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +context.getBundleName((error, data) => { + if (error && error.code !== 0) { + console.error('getBundleName fail, error: ${JSON.stringify(error)}'); + } else { + console.log('getBundleName success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -361,8 +385,12 @@ Obtains the display orientation of this ability. This API uses an asynchronous c ```ts import featureAbility from '@ohos.ability.featureAbility'; let context = featureAbility.getContext(); -context.getDisplayOrientation((err, data) => { - console.info('getDisplayOrientation err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +context.getDisplayOrientation((error, data) => { + if (error && error.code !== 0) { + console.error('getDisplayOrientation fail, error: ${JSON.stringify(error)}'); + } else { + console.log('getDisplayOrientation success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -409,8 +437,12 @@ Obtains the external cache directory of the application. This API uses an asynch ```ts import featureAbility from '@ohos.ability.featureAbility'; let context = featureAbility.getContext(); -context.getExternalCacheDir((err, data) => { - console.info('getExternalCacheDir err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +context.getExternalCacheDir((error, data) => { + if (error && error.code !== 0) { + console.error('getExternalCacheDir fail, error: ${JSON.stringify(error)}'); + } else { + console.log('getExternalCacheDir success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -460,8 +492,8 @@ import featureAbility from '@ohos.ability.featureAbility'; import bundle from '@ohos.bundle'; let context = featureAbility.getContext(); let orientation = bundle.DisplayOrientation.UNSPECIFIED; -context.setDisplayOrientation(orientation, (err) => { - console.info('setDisplayOrientation err: ${JSON.stringify(err)}'); +context.setDisplayOrientation(orientation, (error) => { + console.error('setDisplayOrientation fail, error: ${JSON.stringify(error)}'); }); ``` @@ -513,8 +545,8 @@ Sets whether to show this feature at the top of the lock screen so that the feat import featureAbility from '@ohos.ability.featureAbility'; let context = featureAbility.getContext(); let show = true; -context.setShowOnLockScreen(show, (err) => { - console.info('setShowOnLockScreen err: ${JSON.stringify(err)}'); +context.setShowOnLockScreen(show, (error) => { + console.error('setShowOnLockScreen fail, error: ${JSON.stringify(error)}'); }); ``` @@ -570,8 +602,8 @@ Sets whether to wake up the screen when this feature is restored. This API uses import featureAbility from '@ohos.ability.featureAbility'; let context = featureAbility.getContext(); let wakeUp = true; -context.setWakeUpScreen(wakeUp, (err) => { - console.info('setWakeUpScreen err: ${JSON.stringify(err)}'); +context.setWakeUpScreen(wakeUp, (error) => { + console.error('setWakeUpScreen fail, error: ${JSON.stringify(error)}'); }); ``` @@ -628,8 +660,12 @@ Obtains information about the current process, including the PID and process nam ```ts import featureAbility from '@ohos.ability.featureAbility'; let context = featureAbility.getContext(); -context.getProcessInfo((err, data) => { - console.info('getProcessInfo err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +context.getProcessInfo((error, data) => { + if (error && error.code !== 0) { + console.error('getProcessInfo fail, error: ${JSON.stringify(error)}'); + } else { + console.log('getProcessInfo success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -682,8 +718,12 @@ This API is available only to Page abilities. ```ts import featureAbility from '@ohos.ability.featureAbility'; let context = featureAbility.getContext(); -context.getElementName((err, data) => { - console.info('getElementName err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +context.getElementName((error, data) => { + if (error && error.code !== 0) { + console.error('getElementName fail, error: ${JSON.stringify(error)}'); + } else { + console.log('getElementName success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -734,8 +774,12 @@ Obtains the name of the current process. This API uses an asynchronous callback ```ts import featureAbility from '@ohos.ability.featureAbility'; let context = featureAbility.getContext(); -context.getProcessName((err, data) => { - console.info('getProcessName err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +context.getProcessName((error, data) => { + if (error && error.code !== 0) { + console.error('getProcessName fail, error: ${JSON.stringify(error)}'); + } else { + console.log('getProcessName success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -786,8 +830,12 @@ Obtains the bundle name of the caller ability. This API uses an asynchronous cal ```ts import featureAbility from '@ohos.ability.featureAbility'; let context = featureAbility.getContext(); -context.getCallingBundle((err, data) => { - console.info('getCallingBundle err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +context.getCallingBundle((error, data) => { + if (error && error.code !== 0) { + console.error('getCallingBundle fail, error: ${JSON.stringify(error)}'); + } else { + console.log('getCallingBundle success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -836,8 +884,12 @@ Obtains the cache directory of the application in the internal storage. This API ```ts import featureAbility from '@ohos.ability.featureAbility'; let context = featureAbility.getContext(); -context.getCacheDir((err, data) => { - console.info('getCacheDir err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +context.getCacheDir((error, data) => { + if (error && error.code !== 0) { + console.error('getCacheDir fail, error: ${JSON.stringify(error)}'); + } else { + console.log('getCacheDir success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -884,8 +936,12 @@ Obtains the file directory of the application in the internal storage. This API ```ts import featureAbility from '@ohos.ability.featureAbility'; let context = featureAbility.getContext(); -context.getFilesDir((err, data) => { - console.info('getFilesDir err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +context.getFilesDir((error, data) => { + if (error && error.code !== 0) { + console.error('getFilesDir fail, error: ${JSON.stringify(error)}'); + } else { + console.log('getFilesDir success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -934,8 +990,12 @@ If the distributed file path does not exist, the system will create one and retu ```ts import featureAbility from '@ohos.ability.featureAbility'; let context = featureAbility.getContext(); -context.getOrCreateDistributedDir((err, data) => { - console.info('getOrCreateDistributedDir err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +context.getOrCreateDistributedDir((error, data) => { + if (error && error.code !== 0) { + console.error('getOrCreateDistributedDir fail, error: ${JSON.stringify(error)}'); + } else { + console.log('getOrCreateDistributedDir success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -984,8 +1044,12 @@ Obtains the application type. This API uses an asynchronous callback to return t ```ts import featureAbility from '@ohos.ability.featureAbility'; let context = featureAbility.getContext(); -context.getAppType((err, data) => { - console.info('getAppType err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +context.getAppType((error, data) => { + if (error && error.code !== 0) { + console.error('getAppType fail, error: ${JSON.stringify(error)}'); + } else { + console.log('getAppType success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -1032,8 +1096,12 @@ Obtains the **ModuleInfo** object of the application. This API uses an asynchron ```ts import featureAbility from '@ohos.ability.featureAbility'; let context = featureAbility.getContext(); -context.getHapModuleInfo((err, data) => { - console.info('getHapModuleInfo err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +context.getHapModuleInfo((error, data) => { + if (error && error.code !== 0) { + console.error('getHapModuleInfo fail, error: ${JSON.stringify(error)}'); + } else { + console.log('getHapModuleInfo success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -1080,8 +1148,12 @@ Obtains the version information of the application. This API uses an asynchronou ```ts import featureAbility from '@ohos.ability.featureAbility'; let context = featureAbility.getContext(); -context.getAppVersionInfo((err, data) => { - console.info('getAppVersionInfo err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +context.getAppVersionInfo((error, data) => { + if (error && error.code !== 0) { + console.error('getAppVersionInfo fail, error: ${JSON.stringify(error)}'); + } else { + console.log('getAppVersionInfo success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -1128,8 +1200,12 @@ Obtains information about this ability. This API uses an asynchronous callback t ```ts import featureAbility from '@ohos.ability.featureAbility'; let context = featureAbility.getContext(); -context.getAbilityInfo((err, data) => { - console.info('getAbilityInfo err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +context.getAbilityInfo((error, data) => { + if (error && error.code !== 0) { + console.error('getAbilityInfo fail, error: ${JSON.stringify(error)}'); + } else { + console.log('getAbilityInfo success, data: ${JSON.stringify(data)}'); + } }); ``` @@ -1197,8 +1273,12 @@ Checks whether the configuration of this ability is being updated. This API uses ```ts import featureAbility from '@ohos.ability.featureAbility'; let context = featureAbility.getContext(); -context.isUpdatingConfigurations((err, data) => { - console.info('isUpdatingConfigurations err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +context.isUpdatingConfigurations((error, data) => { + if (error && error.code !== 0) { + console.error('isUpdatingConfigurations fail, error: ${JSON.stringify(error)}'); + } else { + console.log('isUpdatingConfigurations success, data: ${JSON.stringify(data)}'); + } }); ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-app-processInfo.md b/en/application-dev/reference/apis/js-apis-inner-app-processInfo.md index d210666803caa4e6d7e2571badacca9072f725a6..886cc755ef0939723d9c23bc612fe37ce0f7bc55 100644 --- a/en/application-dev/reference/apis/js-apis-inner-app-processInfo.md +++ b/en/application-dev/reference/apis/js-apis-inner-app-processInfo.md @@ -18,9 +18,11 @@ The **ProcessInfo** module defines process information. You can use [getProcessI import featureAbility from '@ohos.ability.featureAbility'; let context = featureAbility.getContext(); -context.getProcessInfo((err, data) => { - if (err.code !== 0) { - console.info('getProcessInfo err: ${JSON.stringify(err)}, data: ${JSON.stringify(data)}'); +context.getProcessInfo((error, data) => { + if (error && error.code !== 0) { + console.error('getProcessInfo fail, error: ${JSON.stringify(error)}'); + } else { + console.log('getProcessInfo success, data: ${JSON.stringify(data)}'); let pid = data.pid; let processName = data.processName; } diff --git a/en/application-dev/reference/apis/js-apis-inner-application-WorkSchedulerExtensionContext.md b/en/application-dev/reference/apis/js-apis-inner-application-WorkSchedulerExtensionContext.md new file mode 100644 index 0000000000000000000000000000000000000000..ff2ca7a3df236c2bf50ab883de28cae0b0599259 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-inner-application-WorkSchedulerExtensionContext.md @@ -0,0 +1,24 @@ +# WorkSchedulerExtensionContext + +The **WorkSchedulerExtensionContext** module, inherited from [ExtensionContext](js-apis-inner-application-extensionContext.md), is the context environment of the WorkSchedulerExtensionAbility. + +This module provides APIs for accessing the resources of a WorkSchedulerExtensionAbility. + +> **NOTE** +> +> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> The APIs of this module can be used only in the stage model. + +## Usage + +The context is obtained through a WorkSchedulerExtensionAbility child class instance. + +```ts +import WorkSchedulerExtensionAbility from '@ohos.WorkSchedulerExtensionAbility'; + +class MyWorkSchedulerExtensionAbility extends WorkSchedulerExtensionAbility { + onWorkStart(workInfo) { + let WorkSchedulerExtensionContext = this.context; // Obtain the WorkSchedulerExtensionContext. + } +} +``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-abilityDelegator.md b/en/application-dev/reference/apis/js-apis-inner-application-abilityDelegator.md index 051aa07c40253bc6805c57fcdf65aad84f401713..550e888888a944644c79cefec596c0f5df28ca64 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-abilityDelegator.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-abilityDelegator.md @@ -11,8 +11,6 @@ The **AbilityDelegator** module provides APIs for managing **AbilityMonitor** in An **AbilityDelegator** object is obtained by calling [getAbilityDelegator](js-apis-app-ability-abilityDelegatorRegistry.md#abilitydelegatorregistrygetabilitydelegator) in **AbilityDelegatorRegistry**. ```ts import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; - -let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); ``` ## AbilityDelegator @@ -492,8 +490,8 @@ abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.getCurrentTopAbility((err : any, data : any) => { console.info('getCurrentTopAbility callback'); ability = data; - abilityDelegator.doAbilityForeground(ability, (err : any, data : any) => { - console.info('doAbilityForeground callback'); + abilityDelegator.doAbilityForeground(ability, (err : any) => { + console.info("doAbilityForeground callback"); }); }); ``` @@ -528,8 +526,8 @@ abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.getCurrentTopAbility((err : any, data : any) => { console.info('getCurrentTopAbility callback'); ability = data; - abilityDelegator.doAbilityForeground(ability).then((data : any) => { - console.info('doAbilityForeground promise'); + abilityDelegator.doAbilityForeground(ability).then(() => { + console.info("doAbilityForeground promise"); }); }); ``` @@ -559,8 +557,8 @@ abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.getCurrentTopAbility((err : any, data : any) => { console.info('getCurrentTopAbility callback'); ability = data; - abilityDelegator.doAbilityBackground(ability, (err : any, data : any) => { - console.info('doAbilityBackground callback'); + abilityDelegator.doAbilityBackground(ability, (err : any) => { + console.info("doAbilityBackground callback"); }); }); ``` @@ -595,8 +593,8 @@ abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.getCurrentTopAbility((err : any, data : any) => { console.info('getCurrentTopAbility callback'); ability = data; - abilityDelegator.doAbilityBackground(ability).then((data : any) => { - console.info('doAbilityBackground promise'); + abilityDelegator.doAbilityBackground(ability).then(() => { + console.info("doAbilityBackground promise"); }); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-abilityMonitor.md b/en/application-dev/reference/apis/js-apis-inner-application-abilityMonitor.md index 1069fcf2d43c9675ff70efd2c0e2756475db312e..e64c3175c7934190d70af04156c149741c87697c 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-abilityMonitor.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-abilityMonitor.md @@ -34,7 +34,7 @@ Describes an ability monitor. import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; function onAbilityCreateCallback(data) { - console.info('onAbilityCreateCallback'); + console.info('onAbilityCreateCallback, data: ${JSON.stringify(data)}'); } let monitor = { @@ -44,7 +44,9 @@ let monitor = { }; let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); -abilityDelegator.addAbilityMonitor(monitor, (err : any) => { - console.info('addAbilityMonitor callback'); +abilityDelegator.addAbilityMonitor(monitor, (error : any) => { + if (error && error.code !== 0) { + console.error('addAbilityMonitor fail, error: ${JSON.stringify(error)}'); + } }); ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-abilityRunningInfo.md b/en/application-dev/reference/apis/js-apis-inner-application-abilityRunningInfo.md index 8340c33dbaa77848d90200e37b5ee309efe53697..f041998eb633cf8d00b45613b666ca563189dd77 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-abilityRunningInfo.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-abilityRunningInfo.md @@ -30,16 +30,20 @@ The ability running information is obtained by calling [getAbilityRunningInfos]( ```ts import abilitymanager from '@ohos.app.ability.abilityManager'; -abilitymanager.getAbilityRunningInfos((err,data) => { - console.log('getAbilityRunningInfos err: ${err}, data: ${JSON.stringify(data)}'); - for (let i = 0; i < data.length; i++) { - let abilityinfo = data[i]; - console.log('abilityinfo.ability: ${JSON.stringify(abilityinfo.ability)}'); - console.log('abilityinfo.pid: ${JSON.stringify(abilityinfo.pid)}'); - console.log('abilityinfo.uid: ${JSON.stringify(abilityinfo.uid)}'); - console.log('abilityinfo.processName: ${JSON.stringify(abilityinfo.processName)}'); - console.log('abilityinfo.startTime: ${JSON.stringify(abilityinfo.startTime)}'); - console.log('abilityinfo.abilityState: ${JSON.stringify(abilityinfo.abilityState)}'); +abilitymanager.getAbilityRunningInfos((error, data) => { + if (error && error.code !== 0) { + console.error('getAbilityRunningInfos fail, error: ${JSON.stringify(error)}'); + } else { + console.log('getAbilityRunningInfos success, data: ${JSON.stringify(data)}'); + for (let i = 0; i < data.length; i++) { + let abilityinfo = data[i]; + console.log('abilityinfo.ability: ${JSON.stringify(abilityinfo.ability)}'); + console.log('abilityinfo.pid: ${JSON.stringify(abilityinfo.pid)}'); + console.log('abilityinfo.uid: ${JSON.stringify(abilityinfo.uid)}'); + console.log('abilityinfo.processName: ${JSON.stringify(abilityinfo.processName)}'); + console.log('abilityinfo.startTime: ${JSON.stringify(abilityinfo.startTime)}'); + console.log('abilityinfo.abilityState: ${JSON.stringify(abilityinfo.abilityState)}'); + } } }); ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-abilityStageMonitor.md b/en/application-dev/reference/apis/js-apis-inner-application-abilityStageMonitor.md index 896b619f524ccc98b1150949b44fba3878bd268a..90fa9dc102e3f38498451bcf23a117321be08be9 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-abilityStageMonitor.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-abilityStageMonitor.md @@ -20,6 +20,10 @@ let monitor = { let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.waitAbilityStageMonitor(monitor, (error, data) => { - console.info('stageMonitor waitAbilityStageMonitor, abilityStage = ${JSON.stringify(data)}'); + if (error && error.code !== 0) { + console.error('waitAbilityStageMonitor fail, error: ${JSON.stringify(error)}'); + } else { + console.log('waitAbilityStageMonitor success, data: ${JSON.stringify(data)}'); + } }); ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-accessibilityExtensionContext.md b/en/application-dev/reference/apis/js-apis-inner-application-accessibilityExtensionContext.md index 1263f44e2db490c648decd54b93ba831a9a57e72..a3e98a1cebd86dc45ac0e09f17ca505543d52935 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-accessibilityExtensionContext.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-accessibilityExtensionContext.md @@ -1,6 +1,6 @@ -# AccessibilityExtensionContext +# AccessibilityExtensionContext (Accessibility Extension Context) -The **AccessibilityExtensionContext** module, inherited from **ExtensionContext**, provides context for **Accessibility Extension** abilities. +The **AccessibilityExtensionContext** module, inherited from **ExtensionContext**, provides context for **AccessibilityExtensionAbility**. You can use the APIs of this module to configure the concerned information, obtain root information, and inject gestures. @@ -57,7 +57,7 @@ Defines a rectangle. **System capability**: SystemCapability.BarrierFree.Accessibility.Core -| Name | Type | Readable | Writable | Description | +| Name | Type | Readable | Writable | Description | | ------ | ------ | ---- | ---- | --------- | | left | number | Yes | No | Left boundary of the rectangle.| | top | number | Yes | No | Top boundary of the rectangle.| @@ -85,14 +85,14 @@ Sets the concerned target bundle. This API uses a promise to return the result. **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory | Description | | ----------- | ------------------- | ---- | -------- | | targetNames | Array<string> | Yes | Name of the target bundle.| **Return value** -| Type | Description | -| ---------------------- | --------------------- | +| Type | Description | +| ------------------- | ---------------- | | Promise<void> | Promise that returns no value.| **Example** @@ -120,9 +120,9 @@ Sets the concerned target bundle. This API uses an asynchronous callback to retu **Parameters** -| Name | Type | Mandatory | Description | -| ----------- | ------------------- | ---- | -------- | -| targetNames | Array<string> | Yes | Name of the target bundle.| +| Name | Type | Mandatory | Description | +| ----------- | ------------------------- | ---- | ---------------------------------------- | +| targetNames | Array<string> | Yes | Name of the target bundle. | | callback | AsyncCallback<void> | Yes | Callback used to return the result. If the operation fails, **error** that contains data is returned.| **Example** @@ -131,7 +131,7 @@ Sets the concerned target bundle. This API uses an asynchronous callback to retu let targetNames = ['com.ohos.xyz']; try { axContext.setTargetBundleName(targetNames, (err, data) => { - if (err) { + if (err && err.code) { console.error('failed to set target bundle names, because ${JSON.stringify(err)}'); return; } @@ -152,7 +152,7 @@ Obtains the focus element. This API uses a promise to return the result. **Parameters** -| Name | Type | Mandatory | Description | +| Name | Type | Mandatory | Description | | -------------------- | ------- | ---- | ------------------- | | isAccessibilityFocus | boolean | No | Whether the obtained focus element is an accessibility focus. The default value is **false**.| @@ -166,8 +166,8 @@ Obtains the focus element. This API uses a promise to return the result. For details about the error codes, see [Accessibility Error Codes](../errorcodes/errorcode-accessibility.md). -| ID| Error Message| -| ------- | -------------------------------- | +| ID | Error Message | +| ------- | ---------------------------------------- | | 9300003 | Do not have accessibility right for this operation. | **Example** @@ -196,16 +196,16 @@ Obtains the focus element. This API uses an asynchronous callback to return the **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<AccessibilityElement> | Yes | Callback used to return the current focus element.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ----------------- | +| callback | AsyncCallback<AccessibilityElement> | Yes | Callback used to return the current focus element.| **Error codes** For details about the error codes, see [Accessibility Error Codes](../errorcodes/errorcode-accessibility.md). -| ID| Error Message| -| ------- | -------------------------------- | +| ID | Error Message | +| ------- | ---------------------------------------- | | 9300003 | Do not have accessibility right for this operation. | **Example** @@ -214,7 +214,7 @@ For details about the error codes, see [Accessibility Error Codes](../errorcodes let focusElement; try { axContext.getFocusElement((err, data) => { - if (err) { + if (err && err.code) { console.error('failed to get focus element, because ${JSON.stringify(err)}'); return; } @@ -236,10 +236,10 @@ Obtains the focus element. This API uses an asynchronous callback to return the **Parameters** -| Name | Type | Mandatory | Description | -| -------------------- | ------- | ---- | ------------------- | -| isAccessibilityFocus | boolean | Yes | Whether the obtained focus element is an accessibility focus.| -| callback | AsyncCallback<AccessibilityElement> | Yes | Callback used to return the current focus element.| +| Name | Type | Mandatory | Description | +| -------------------- | ---------------------------------------- | ---- | ----------------- | +| isAccessibilityFocus | boolean | Yes | Whether the obtained focus element is an accessibility focus. | +| callback | AsyncCallback<AccessibilityElement> | Yes | Callback used to return the current focus element.| **Example** @@ -248,7 +248,7 @@ let focusElement; let isAccessibilityFocus = true; try { axContext.getFocusElement(isAccessibilityFocus, (err, data) => { - if (err) { + if (err && err.code) { console.error('failed to get focus element, because ${JSON.stringify(err)}'); return; } @@ -269,8 +269,8 @@ Obtains the root element of a window. This API uses a promise to return the resu **Parameters** -| Name | Type | Mandatory | Description | -| -------------------- | ------- | ---- | ------------------- | +| Name | Type | Mandatory | Description | +| -------- | ------ | ---- | ---------------------- | | windowId | number | No | Window for which you want to obtain the root element. If this parameter is not specified, it indicates the current active window.| **Return value** @@ -283,8 +283,8 @@ Obtains the root element of a window. This API uses a promise to return the resu For details about the error codes, see [Accessibility Error Codes](../errorcodes/errorcode-accessibility.md). -| ID| Error Message| -| ------- | -------------------------------- | +| ID | Error Message | +| ------- | ---------------------------------------- | | 9300003 | Do not have accessibility right for this operation. | **Example** @@ -313,16 +313,16 @@ Obtains the root element of a window. This API uses an asynchronous callback to **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<AccessibilityElement> | Yes | Callback used to return the root element.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ------------------ | +| callback | AsyncCallback<AccessibilityElement> | Yes | Callback used to return the root element.| **Error codes** For details about the error codes, see [Accessibility Error Codes](../errorcodes/errorcode-accessibility.md). -| ID| Error Message| -| ------- | -------------------------------- | +| ID | Error Message | +| ------- | ---------------------------------------- | | 9300003 | Do not have accessibility right for this operation. | **Example** @@ -331,7 +331,7 @@ For details about the error codes, see [Accessibility Error Codes](../errorcodes let rootElement; try { axContext.getWindowRootElement((err, data) => { - if (err) { + if (err && err.code) { console.error('failed to get root element of the window, because ${JSON.stringify(err)}'); return; } @@ -353,17 +353,17 @@ Obtains the root element of a window. This API uses an asynchronous callback to **Parameters** -| Name | Type | Mandatory | Description | -| -------------------- | ------- | ---- | ------------------- | -| windowId | number | Yes | Window for which you want to obtain the root element. If this parameter is not specified, it indicates the current active window.| -| callback | AsyncCallback<AccessibilityElement> | Yes | Callback used to return the root element.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ---------------------- | +| windowId | number | Yes | Window for which you want to obtain the root element. If this parameter is not specified, it indicates the current active window.| +| callback | AsyncCallback<AccessibilityElement> | Yes | Callback used to return the root element. | **Error codes** For details about the error codes, see [Accessibility Error Codes](../errorcodes/errorcode-accessibility.md). -| ID| Error Message| -| ------- | -------------------------------- | +| ID | Error Message | +| ------- | ---------------------------------------- | | 9300003 | Do not have accessibility right for this operation. | **Example** @@ -373,7 +373,7 @@ let rootElement; let windowId = 10; try { axContext.getWindowRootElement(windowId, (err, data) => { - if (err) { + if (err && err.code) { console.error('failed to get root element of the window, because ${JSON.stringify(err)}'); return; } @@ -395,22 +395,22 @@ Obtains the list of windows on a display. This API uses a promise to return the **Parameters** -| Name | Type | Mandatory | Description | -| -------------------- | ------- | ---- | ------------------- | +| Name | Type | Mandatory | Description | +| --------- | ------ | ---- | --------------------- | | displayId | number | No | ID of the display from which the window information is obtained. If this parameter is not specified, it indicates the default main display.| **Return value** -| Type | Description | -| ----------------------------------- | ---------------------- | +| Type | Description | +| ---------------------------------------- | ---------------------- | | Promise<Array<AccessibilityElement>> | Promise used to return the window list.| **Error codes** For details about the error codes, see [Accessibility Error Codes](../errorcodes/errorcode-accessibility.md). -| ID| Error Message| -| ------- | -------------------------------- | +| ID | Error Message | +| ------- | ---------------------------------------- | | 9300003 | Do not have accessibility right for this operation. | **Example** @@ -439,16 +439,16 @@ Obtains the list of windows on a display. This API uses an asynchronous callback **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<Array<AccessibilityElement>> | Yes | Callback used to return the window list.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | ----------------- | +| callback | AsyncCallback<Array<AccessibilityElement>> | Yes | Callback used to return the window list.| **Error codes** For details about the error codes, see [Accessibility Error Codes](../errorcodes/errorcode-accessibility.md). -| ID| Error Message| -| ------- | -------------------------------- | +| ID | Error Message | +| ------- | ---------------------------------------- | | 9300003 | Do not have accessibility right for this operation. | **Example** @@ -457,7 +457,7 @@ For details about the error codes, see [Accessibility Error Codes](../errorcodes let windows; try { axContext.getWindows((err, data) => { - if (err) { + if (err && err.code) { console.error('failed to get windows, because ${JSON.stringify(err)}'); return; } @@ -479,17 +479,17 @@ Obtains the list of windows on a display. This API uses an asynchronous callback **Parameters** -| Name | Type | Mandatory | Description | -| -------------------- | ------- | ---- | ------------------- | -| displayId | number | Yes | ID of the display from which the window information is obtained. If this parameter is not specified, it indicates the default main display.| -| callback | AsyncCallback<Array<AccessibilityElement>> | Yes | Callback used to return the window list.| +| Name | Type | Mandatory | Description | +| --------- | ---------------------------------------- | ---- | --------------------- | +| displayId | number | Yes | ID of the display from which the window information is obtained. If this parameter is not specified, it indicates the default main display.| +| callback | AsyncCallback<Array<AccessibilityElement>> | Yes | Callback used to return the window list. | **Error codes** For details about the error codes, see [Accessibility Error Codes](../errorcodes/errorcode-accessibility.md). -| ID| Error Message| -| ------- | -------------------------------- | +| ID | Error Message | +| ------- | ---------------------------------------- | | 9300003 | Do not have accessibility right for this operation. | **Example** @@ -499,7 +499,7 @@ let windows; let displayId = 10; try { axContext.getWindows(displayId, (err, data) => { - if (err) { + if (err && err.code) { console.error('failed to get windows, because ${JSON.stringify(err)}'); return; } @@ -521,22 +521,22 @@ Inject a gesture. This API uses a promise to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| ----------- | ---------------------------------------- | ---- | -------------- | -| gesturePath | [GesturePath](js-apis-accessibility-GesturePath.md#gesturepath) | Yes | Path of the gesture to inject. | +| Name | Type | Mandatory | Description | +| ----------- | ---------------------------------------- | ---- | ---------- | +| gesturePath | [GesturePath](js-apis-accessibility-GesturePath.md#gesturepath) | Yes | Path of the gesture to inject.| **Return value** -| Type | Description | -| ----------------------------------- | ---------------------- | +| Type | Description | +| ------------------- | ---------------- | | Promise<void> | Promise that returns no value.| **Error codes** For details about the error codes, see [Accessibility Error Codes](../errorcodes/errorcode-accessibility.md). -| ID| Error Message| -| ------- | -------------------------------- | +| ID | Error Message | +| ------- | ---------------------------------------- | | 9300003 | Do not have accessibility right for this operation. | **Example** @@ -569,17 +569,17 @@ Inject a gesture. This API uses an asynchronous callback to return the result. **Parameters** -| Name | Type | Mandatory | Description | -| ----------- | ---------------------------------------- | ---- | -------------- | -| gesturePath | [GesturePath](js-apis-accessibility-GesturePath.md#gesturepath) | Yes | Path of the gesture to inject. | -| callback | AsyncCallback<void> | Yes | Callback used to return the result.| +| Name | Type | Mandatory | Description | +| ----------- | ---------------------------------------- | ---- | ------------------- | +| gesturePath | [GesturePath](js-apis-accessibility-GesturePath.md#gesturepath) | Yes | Path of the gesture to inject. | +| callback | AsyncCallback<void> | Yes | Callback used to return the result.| **Error codes** For details about the error codes, see [Accessibility Error Codes](../errorcodes/errorcode-accessibility.md). -| ID| Error Message| -| ------- | -------------------------------- | +| ID | Error Message | +| ------- | ---------------------------------------- | | 9300003 | Do not have accessibility right for this operation. | **Example** @@ -594,7 +594,7 @@ try { gesturePath.points.push(gesturePoint); } axContext.injectGesture(gesturePath, (err, data) => { - if (err) { + if (err && err.code) { console.error('failed to inject gesture, because ${JSON.stringify(err)}'); return; } @@ -620,8 +620,8 @@ Obtains all attribute names of this element. This API uses a promise to return t **Return value** -| Type | Description | -| ---------------------------------------- | ------------------------ | +| Type | Description | +| ----------------------------- | ------------------------ | | Promise<Array<T>> | Promise used to return all attribute names of the element.| **Example** @@ -646,9 +646,9 @@ Obtains all attribute names of this element. This API uses an asynchronous callb **Parameters** -| Name | Type | Mandatory | Description | -| ----------- | ---------------------------------------- | ---- | -------------- | -| callback | AsyncCallback<Array<T>> | Yes | Callback used to return all attribute names of the element.| +| Name | Type | Mandatory | Description | +| -------- | ----------------------------------- | ---- | ------------------- | +| callback | AsyncCallback<Array<T>> | Yes | Callback used to return all attribute names of the element.| **Example** @@ -674,22 +674,22 @@ Obtains the attribute value based on an attribute name. This API uses a promise **Parameters** -| Name | Type | Mandatory | Description | -| ----------- | ---------------------------------------- | ---- | -------------- | -| attributeName | T | Yes | Attribute name. | +| Name | Type | Mandatory | Description | +| ------------- | ---- | ---- | -------- | +| attributeName | T | Yes | Attribute name.| **Return value** -| Type | Description | -| ---------------------------------------- | ------------------------ | +| Type | Description | +| ---------------------------------------- | --------------------------- | | Promise<ElementAttributeValues[T]> | Promise used to return the attribute value.| **Error codes** For details about the error codes, see [Accessibility Error Codes](../errorcodes/errorcode-accessibility.md). -| ID| Error Message| -| ------- | -------------------------------- | +| ID | Error Message | +| ------- | ----------------------------- | | 9300004 | This property does not exist. | **Example** @@ -703,10 +703,10 @@ try { console.log('get attribute value by name success'); attributeValue = data; }).catch((err) => { - console.log('failed to get attribute value, because ${JSON.stringify(err)}'); + console.error('failed to get attribute value, because ${JSON.stringify(err)}'); }); } catch (exception) { - console.log('failed to get attribute value, because ${JSON.stringify(exception)}'); + console.error('failed to get attribute value, because ${JSON.stringify(exception)}'); } ``` ## AccessibilityElement.attributeValue @@ -720,17 +720,17 @@ Obtains the attribute value based on an attribute name. This API uses an asynchr **Parameters** -| Name | Type | Mandatory | Description | -| ----------- | ---------------------------------------- | ---- | -------------- | -| attributeName | T | Yes | Attribute name. | -| callback | AsyncCallback<ElementAttributeValues[T]> | Yes | Callback used to return the attribute value.| +| Name | Type | Mandatory | Description | +| ------------- | ---------------------------------------- | ---- | ---------------------- | +| attributeName | T | Yes | Attribute name. | +| callback | AsyncCallback<ElementAttributeValues[T]> | Yes | Callback used to return the attribute value.| **Error codes** For details about the error codes, see [Accessibility Error Codes](../errorcodes/errorcode-accessibility.md). -| ID| Error Message| -| ------- | -------------------------------- | +| ID | Error Message | +| ------- | ----------------------------- | | 9300004 | This property does not exist. | **Example** @@ -749,7 +749,7 @@ try { console.info('get attribute value success'); }); } catch (exception) { - console.log('failed to get attribute value, because ${JSON.stringify(exception)}'); + console.error('failed to get attribute value, because ${JSON.stringify(exception)}'); } ``` ## actionNames @@ -762,8 +762,8 @@ Obtains the names of all actions supported by this element. This API uses a prom **Return value** -| Type | Description | -| ---------------------------------------- | ------------------------ | +| Type | Description | +| ---------------------------------- | -------------------------- | | Promise<Array<string>> | Promise used to return the names of all actions supported by the element.| **Example** @@ -775,7 +775,7 @@ rootElement.actionNames().then((data) => { console.log('get action names success'); actionNames = data; }).catch((err) => { - console.log('failed to get action names because ${JSON.stringify(err)}'); + console.error('failed to get action names because ${JSON.stringify(err)}'); }); ``` ## actionNames @@ -788,9 +788,9 @@ Obtains the names of all actions supported by this element. This API uses an asy **Parameters** -| Name | Type | Mandatory | Description | -| ----------- | ---------------------------------------- | ---- | -------------- | -| callback | AsyncCallback<Array<string>> | Yes | Callback used to return the names of all actions supported by the element.| +| Name | Type | Mandatory | Description | +| -------- | ---------------------------------------- | ---- | --------------------- | +| callback | AsyncCallback<Array<string>> | Yes | Callback used to return the names of all actions supported by the element.| **Example** @@ -818,21 +818,21 @@ Performs an action based on the specified action name. This API uses a promise t | Name | Type | Mandatory | Description | | ----------- | ---------------------------------------- | ---- | -------------- | -| actionName | string | Yes | Action name. | -| parameters | object | No | Parameter required for performing the target action. | +| actionName | string | Yes | Action name. For details, see [Action](./js-apis-accessibility.md#action). | +| parameters | object | No | Parameters required for performing the target action. Not supported currently. | **Return value** -| Type | Description | -| ---------------------------------------- | ------------------------ | +| Type | Description | +| ------------------- | ---------------- | | Promise<void> | Promise that returns no value.| **Error codes** For details about the error codes, see [Accessibility Error Codes](../errorcodes/errorcode-accessibility.md). -| ID| Error Message| -| ------- | -------------------------------- | +| ID | Error Message | +| ------- | ----------------------------- | | 9300005 | This action is not supported. | **Example** @@ -843,10 +843,10 @@ try { rootElement.performAction('action').then((data) => { console.info('perform action success'); }).catch((err) => { - console.log('failed to perform action, because ${JSON.stringify(err)}'); + console.error('failed to perform action, because ${JSON.stringify(err)}'); }); } catch (exception) { - console.log('failed to perform action, because ${JSON.stringify(exception)}'); + console.error('failed to perform action, because ${JSON.stringify(exception)}'); } ``` ## performAction @@ -861,15 +861,15 @@ Performs an action based on the specified action name. This API uses an asynchro | Name | Type | Mandatory | Description | | ----------- | ---------------------------------------- | ---- | -------------- | -| actionName | string | Yes | Attribute name. | +| actionName | string | Yes | Action name. For details, see [Action](./js-apis-accessibility.md#action). | | callback | AsyncCallback<void> | Yes | Callback used to return the result.| **Error codes** For details about the error codes, see [Accessibility Error Codes](../errorcodes/errorcode-accessibility.md). -| ID| Error Message| -| ------- | -------------------------------- | +| ID | Error Message | +| ------- | ----------------------------- | | 9300005 | This action is not supported. | **Example** @@ -885,7 +885,7 @@ try { console.info('perform action success'); }); } catch (exception) { - console.log('failed to perform action, because ${JSON.stringify(exception)}'); + console.error('failed to perform action, because ${JSON.stringify(exception)}'); } ``` ## performAction @@ -898,18 +898,18 @@ Performs an action based on the specified action name. This API uses an asynchro **Parameters** -| Name | Type | Mandatory | Description | -| ----------- | ---------------------------------------- | ---- | -------------- | -| actionName | string | Yes | Action name. | -| parameters | object | Yes | Parameter required for performing the target action. | -| callback | AsyncCallback<void> | Yes | Callback used to return the result.| +| Name | Type | Mandatory | Description | +| ---------- | ------------------------- | ---- | ---------------------------------------- | +| actionName | string | Yes | Action name. For details, see [Action](./js-apis-accessibility.md#action).| +| parameters | object | Yes | Parameters required for performing the target action. Not supported currently. | +| callback | AsyncCallback<void> | Yes | Callback used to return the result. | **Error codes** For details about the error codes, see [Accessibility Error Codes](../errorcodes/errorcode-accessibility.md). -| ID| Error Message| -| ------- | -------------------------------- | +| ID | Error Message | +| ------- | ----------------------------- | | 9300005 | This action is not supported. | **Example** @@ -929,7 +929,7 @@ try { console.info('perform action success'); }); } catch (exception) { - console.log('failed to perform action, because ${JSON.stringify(exception)}'); + console.error('failed to perform action, because ${JSON.stringify(exception)}'); } ``` ## findElement('content') @@ -942,15 +942,15 @@ Queries the element information of the **content** type. This API uses a promise **Parameters** -| Name | Type | Mandatory | Description | -| ----------- | ---------------------------------------- | ---- | -------------- | -| type | string | Yes | Information type. The value is fixed at **'content'**. | -| condition | string | Yes | Search criteria. | +| Name | Type | Mandatory | Description | +| --------- | ------ | ---- | ----------------------------- | +| type | string | Yes | Information type. The value is fixed at **'content'**.| +| condition | string | Yes | Search criteria. | **Return value** -| Type | Description | -| ---------------------------------------- | ------------------------ | +| Type | Description | +| ---------------------------------------- | ----------------------------- | | Promise<Array<AccessibilityElement>> | Promise used to return the result.| **Example** @@ -965,10 +965,10 @@ try { elements = data; console.log('find element success'); }).catch((err) => { - console.log('failed to find element, because ${JSON.stringify(err)}'); + console.error('failed to find element, because ${JSON.stringify(err)}'); }); } catch (exception) { - console.log('failed to find element, because ${JSON.stringify(exception)}'); + console.error('failed to find element, because ${JSON.stringify(exception)}'); } ``` ## findElement('content') @@ -981,11 +981,11 @@ Queries the element information of the **content** type. This API uses an asynch **Parameters** -| Name | Type | Mandatory | Description | -| ----------- | ---------------------------------------- | ---- | -------------- | -| type | string | Yes | Information type. The value is fixed at **'content'**. | -| condition | string | Yes | Search criteria. | -| callback | AsyncCallback<Array<AccessibilityElement>> | Yes | Callback used to return the result.| +| Name | Type | Mandatory | Description | +| --------- | ---------------------------------------- | ---- | ---------------------------- | +| type | string | Yes | Information type. The value is fixed at **'content'**.| +| condition | string | Yes | Search criteria. | +| callback | AsyncCallback<Array<AccessibilityElement>> | Yes | Callback used to return the result. | **Example** @@ -1004,7 +1004,7 @@ try { console.info('find element success'); }); } catch (exception) { - console.log('failed to find element, because ${JSON.stringify(exception)}'); + console.error('failed to find element, because ${JSON.stringify(exception)}'); } ``` ## findElement('focusType') @@ -1017,15 +1017,15 @@ Queries the element information of the **focusType** type. This API uses a promi **Parameters** -| Name | Type | Mandatory | Description | -| ----------- | ---------------------------------------- | ---- | -------------- | -| type | string | Yes | Information type. The value is fixed at **'focusType'**. | -| condition | [FocusType](#focustype) | Yes | Enumerates the focus types. | +| Name | Type | Mandatory | Description | +| --------- | ----------------------- | ---- | ---------------------------------- | +| type | string | Yes | Information type. The value is fixed at **'focusType'**.| +| condition | [FocusType](#focustype) | Yes | Enumerates the focus types. | **Return value** -| Type | Description | -| ---------------------------------------- | ------------------------ | +| Type | Description | +| ----------------------------------- | ------------------------------ | | Promise<AccessibilityElement> | Promise used to return the result.| **Example** @@ -1040,10 +1040,10 @@ try { element = data; console.log('find element success'); }).catch((err) => { - console.log('failed to find element, because ${JSON.stringify(err)}'); + console.error('failed to find element, because ${JSON.stringify(err)}'); }); } catch (exception) { - console.log('failed to find element, because ${JSON.stringify(exception)}'); + console.error('failed to find element, because ${JSON.stringify(exception)}'); } ``` ## findElement('focusType') @@ -1056,11 +1056,11 @@ Queries the element information of the **focusType** type. This API uses an asyn **Parameters** -| Name | Type | Mandatory | Description | -| ----------- | ---------------------------------------- | ---- | -------------- | -| type | string | Yes | Information type. The value is fixed at **'focusType'**. | -| condition | [FocusType](#focustype) | Yes | Enumerates the focus types. | -| callback | AsyncCallback<AccessibilityElement> | Yes | Callback used to return the result.| +| Name | Type | Mandatory | Description | +| --------- | ---------------------------------------- | ---- | ---------------------------------- | +| type | string | Yes | Information type. The value is fixed at **'focusType'**.| +| condition | [FocusType](#focustype) | Yes | Enumerates the focus types. | +| callback | AsyncCallback<AccessibilityElement> | Yes | Callback used to return the result. | **Example** @@ -1079,7 +1079,7 @@ try { console.info('find element success'); }); } catch (exception) { - console.log('failed to find element, because ${JSON.stringify(exception)}'); + console.error('failed to find element, because ${JSON.stringify(exception)}'); } ``` ## findElement('focusDirection') @@ -1092,15 +1092,15 @@ Queries the element information of the **focusDirection** type. This API uses a **Parameters** -| Name | Type | Mandatory | Description | -| ----------- | ---------------------------------------- | ---- | -------------- | -| type | string | Yes | Information type. The value is fixed at **'focusDirection'**. | -| condition | [FocusDirection](#focusdirection) | Yes | Enumerates the focus directions. | +| Name | Type | Mandatory | Description | +| --------- | --------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Information type. The value is fixed at **'focusDirection'**.| +| condition | [FocusDirection](#focusdirection) | Yes | Enumerates the focus directions. | **Return value** -| Type | Description | -| ---------------------------------------- | ------------------------ | +| Type | Description | +| ----------------------------------- | -------------------------------- | | Promise<AccessibilityElement> | Promise used to return the result.| **Example** @@ -1115,10 +1115,10 @@ try { element = data; console.log('find element success'); }).catch((err) => { - console.log('failed to find element, because ${JSON.stringify(err)}'); + console.error('failed to find element, because ${JSON.stringify(err)}'); }); } catch (exception) { - console.log('failed to find element, because ${JSON.stringify(exception)}'); + console.error('failed to find element, because ${JSON.stringify(exception)}'); } ``` ## findElement('focusDirection') @@ -1131,11 +1131,11 @@ Queries the element information of the **focusDirection** type. This API uses an **Parameters** -| Name | Type | Mandatory | Description | -| ----------- | ---------------------------------------- | ---- | -------------- | -| type | string | Yes | Information type. The value is fixed at **'focusDirection'**. | -| condition | [FocusDirection](#focusdirection) | Yes | Direction of the next focus element. | -| callback | AsyncCallback<AccessibilityElement> | Yes | Callback used to return the result.| +| Name | Type | Mandatory | Description | +| --------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | Yes | Information type. The value is fixed at **'focusDirection'**.| +| condition | [FocusDirection](#focusdirection) | Yes | Direction of the next focus element. | +| callback | AsyncCallback<AccessibilityElement> | Yes | Callback used to return the result. | **Example** @@ -1154,6 +1154,6 @@ try { console.info('find element success'); }); } catch (exception) { - console.log('failed to find element, because ${JSON.stringify(exception)}'); + console.error('failed to find element, because ${JSON.stringify(exception)}'); } ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-appStateData.md b/en/application-dev/reference/apis/js-apis-inner-application-appStateData.md index 23328be8945eb8c1aa55ba993077ff64f99b8fcc..ca06c2e4c8fb37d3a3c2d8987a13c5cb716aa327 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-appStateData.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-appStateData.md @@ -20,7 +20,7 @@ import appManager from '@ohos.app.ability.appManager'; function getForegroundAppInfos() { appManager.getForegroundApplications((error, data) => { if (error && error.code) { - console.log('getForegroundApplications failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('getForegroundApplications failed, error.code: ${error.code}, error.message: ${error.message}'); return; } for (let i = 0; i < data.length; i++) { diff --git a/en/application-dev/reference/apis/js-apis-inner-application-applicationContext.md b/en/application-dev/reference/apis/js-apis-inner-application-applicationContext.md index c19d499f4a28f1d68817ef517ebeb0dc5ff0e807..3687950d91688181565b8f8cb01f8538e9e77489 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-applicationContext.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-applicationContext.md @@ -83,7 +83,7 @@ export default class EntryAbility extends UIAbility { let applicationContext = this.context.getApplicationContext(); // 2. Use applicationContext to register a listener for the ability lifecycle in the application. lifecycleId = applicationContext.on('abilityLifecycle', AbilityLifecycleCallback); - console.log('registerAbilityLifecycleCallback number: ' + JSON.stringify(lifecycleId)); + console.log('registerAbilityLifecycleCallback lifecycleId: ${lifecycleId)}'); } } ``` @@ -114,9 +114,13 @@ let lifecycleId; export default class EntryAbility extends UIAbility { onDestroy() { let applicationContext = this.context.getApplicationContext(); - console.log('stage applicationContext: ' + applicationContext); - applicationContext.off(type: 'abilityLifecycle', lifecycleId, (error, data) => { - console.log('unregisterAbilityLifecycleCallback success, err: ' + JSON.stringify(error)); + console.log('stage applicationContext: ${applicationContext}'); + applicationContext.off('abilityLifecycle', lifecycleId, (error, data) => { + if (error && error.code !== 0) { + console.error('unregisterAbilityLifecycleCallback fail, err: ${JSON.stringify(error)}'); + } else { + console.log('unregisterAbilityLifecycleCallback success, data: ${JSON.stringify(data)}'); + } }); } } @@ -147,8 +151,8 @@ let lifecycleId; export default class MyAbility extends Ability { onDestroy() { let applicationContext = this.context.getApplicationContext(); - console.log('stage applicationContext: ' + applicationContext); - applicationContext.off(type: 'abilityLifecycle', lifecycleId); + console.log('stage applicationContext: ${applicationContext}'); + applicationContext.off('abilityLifecycle', lifecycleId); } } ``` @@ -185,19 +189,19 @@ export default class EntryAbility extends UIAbility { onCreate() { console.log('MyAbility onCreate') globalThis.applicationContext = this.context.getApplicationContext(); - let EnvironmentCallback = { + let environmentCallback = { onConfigurationUpdated(config){ - console.log('onConfigurationUpdated config:' + JSON.stringify(config)); + console.log('onConfigurationUpdated config: ${JSON.stringify(config)}'); }, onMemoryLevel(level){ - console.log('onMemoryLevel level:' + level); + console.log('onMemoryLevel level: ${level}'); } - } + }; // 1. Obtain an applicationContext object. let applicationContext = globalThis.applicationContext; - // 2. Use applicationContext to register a listener for the ability lifecycle in the application. - callbackId = applicationContext.on('environment', EnvironmentCallback); - console.log('registerEnvironmentCallback number: ' + JSON.stringify(callbackId)); + // 2. Use applicationContext to register a listener for system environment changes. + callbackId = applicationContext.on('environment', environmentCallback); + console.log('registerEnvironmentCallback callbackId: ${callbackId}'); } } ``` @@ -229,7 +233,11 @@ export default class EntryAbility extends UIAbility { onDestroy() { let applicationContext = this.context.getApplicationContext(); applicationContext.off('environment', callbackId, (error, data) => { - console.log('unregisterEnvironmentCallback success, err: ' + JSON.stringify(error)); + if (error && error.code !== 0) { + console.error('unregisterEnvironmentCallback fail, err: ${JSON.stringify(error)}'); + } else { + console.log('unregisterEnvironmentCallback success, data: ${JSON.stringify(data)}'); + } }); } } @@ -290,7 +298,7 @@ let applicationContext = this.context.getApplicationContext(); applicationContext.getRunningProcessInformation().then((data) => { console.log('The process running information is: ${JSON.stringify(data)}'); }).catch((error) => { - console.log('error: ${JSON.stringify(error)}'); + console.error('error: ${JSON.stringify(error)}'); }); ``` @@ -364,7 +372,9 @@ Kills all the processes where the application is located. This API uses an async ```ts let applicationContext = this.context.getApplicationContext(); -applicationContext.killAllProcesses(err => { - console.error('killAllProcesses result: ${JSON.stringify(err)}'); +applicationContext.killAllProcesses(error => { + if (error && error.code !== 0) { + console.error('killAllProcesses fail, error: ${JSON.stringify(error)}'); + } }); ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-context.md b/en/application-dev/reference/apis/js-apis-inner-application-context.md index eb9ed63890d99338a57c18613eb37c59f753be0e..25e82e90dbf0137f11cdb092497b967515ad8166 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-context.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-context.md @@ -62,7 +62,7 @@ let bundleContext; try { bundleContext = this.context.createBundleContext('com.example.test'); } catch (error) { - console.log('createBundleContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('createBundleContext failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` @@ -101,7 +101,7 @@ let moduleContext; try { moduleContext = this.context.createModuleContext('entry'); } catch (error) { - console.log('createModuleContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('createModuleContext failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` @@ -141,7 +141,7 @@ let moduleContext; try { moduleContext = this.context.createModuleContext('com.example.test', 'entry'); } catch (error) { - console.log('createModuleContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('createModuleContext failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` @@ -166,6 +166,6 @@ let applicationContext; try { applicationContext = this.context.getApplicationContext(); } catch (error) { - console.log('getApplicationContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getApplicationContext failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-continueCallback.md b/en/application-dev/reference/apis/js-apis-inner-application-continueCallback.md index 448212035ad08f63371b001ab305cadf0153c807..10b65b8ce5a815a9d4f4355bbf3f6abbc17d3dd9 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-continueCallback.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-continueCallback.md @@ -38,7 +38,7 @@ Called when the mission continuation is complete. distributedMissionManager.continueMission(continueDeviceInfo, continueCallback, (error) => { if (error && error.code) { - console.log('continueMission failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('continueMission failed, error.code: ${error.code}, error.message: ${error.message}'); } console.log('continueMission finished'); }); diff --git a/en/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md b/en/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md index 424456ba9bf4d52f0e9696b4268fe743b8a0fd8e..ce50489a861c8ef4d519266bbaa50500ada2d18e 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md @@ -33,7 +33,7 @@ The **ContinueDeviceInfo** module defines the parameters required for initiating distributedMissionManager.continueMission(continueDeviceInfo, continueCallback, (error) => { if (error && error.code) { - console.log('continueMission failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('continueMission failed, error.code: ${error.code}, error.message: ${error.message}'); } console.log('continueMission finished'); }); diff --git a/en/application-dev/reference/apis/js-apis-inner-application-errorObserver.md b/en/application-dev/reference/apis/js-apis-inner-application-errorObserver.md index 85b9503b48dc15a49c19cd74be00f071e93e3969..43771f06405de4d48c6b3831a5bf853b12bd9bca 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-errorObserver.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-errorObserver.md @@ -23,13 +23,13 @@ import errorManager from '@ohos.app.ability.errorManager'; let observer = { onUnhandledException(errorMsg) { - console.log('onUnhandledException, errorMsg: ', errorMsg); + console.error('onUnhandledException, errorMsg: ', errorMsg); } }; try { errorManager.on('error', observer); } catch (error) { - console.log('registerErrorObserver failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('registerErrorObserver failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md b/en/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md index 1e3003c9410c1bea9f0e8ef4f930966e9a6e5f4e..4480583a2c123786c71d75356c7773bbcb08d75a 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md @@ -33,7 +33,7 @@ let upperLimit = 1; function getExtensionInfos() { abilityManager.getExtensionRunningInfos(upperLimit, (error, data) => { if (error && error.code) { - console.log('getForegroundApplications failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getForegroundApplications failed, error.code: ${error.code}, error.message: ${error.message}'); return; } diff --git a/en/application-dev/reference/apis/js-apis-inner-application-formExtensionContext.md b/en/application-dev/reference/apis/js-apis-inner-application-formExtensionContext.md index 71d91c1fab2864341105c2ae3a636133c8a33208..c679a6fe5c87954f27b76531a3d21a3c3726e410 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-formExtensionContext.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-formExtensionContext.md @@ -67,7 +67,7 @@ export default class MyFormExtensionAbility extends FormExtensionAbility { }; this.context.startAbility(want, (error, data) => { if (error) { - console.log('FormExtensionContext startAbility, error:${JSON.stringify(error)}'); + console.error('FormExtensionContext startAbility, error:${JSON.stringify(error)}'); } else { console.log('FormExtensionContext startAbility success'); } @@ -118,7 +118,7 @@ export default class MyFormExtensionAbility extends FormExtensionAbility { this.context.startAbility(want).then(() => { console.info('StartAbility Success'); }).catch((error) => { - console.info('StartAbility failed'); + console.error('StartAbility failed'); }); } }; diff --git a/en/application-dev/reference/apis/js-apis-inner-application-missionInfo.md b/en/application-dev/reference/apis/js-apis-inner-application-missionInfo.md index ff8c880a0db0f67a8fc184bb9986245bfd9ad7af..43d1896b408f7296781a4e5b8b96b3748b44b8b1 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-missionInfo.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-missionInfo.md @@ -25,7 +25,7 @@ try { missionManager.getMissionInfo('', 1, (error, data) => { if (error.code) { // Process service logic errors. - console.log('getMissionInfo failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfo failed, error.code: ${error.code}, error.message: ${error.message}'); return; } @@ -39,6 +39,6 @@ try { console.log('getMissionInfo continuable is: ${JSON.stringify(data.continuable)}'); }); } catch (paramError) { - console.log('error: ${paramError.code}, ${paramError.message}'); + console.error('error: ${paramError.code}, ${paramError.message}'); } ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-missionListener.md b/en/application-dev/reference/apis/js-apis-inner-application-missionListener.md index 84aa5294ce48be5388103945bfb417284cfa297e..9386b6f5b9b84129d6db9e86f944f01cf679d538 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-missionListener.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-missionListener.md @@ -31,9 +31,13 @@ let listener = { onMissionMovedToFront: function (mission) { console.log('onMissionMovedToFront mission: ${JSON.stringify(mission)}'); }, - onMissionIconUpdated: function (mission, icon) { - console.log('onMissionIconUpdated mission: ${JSON.stringify(mission)}'); + onMissionLabelUpdated: function (mission) { + console.log('onMissionLabelUpdated mission: ' + JSON.stringify(mission)); }, + onMissionIconUpdated: function (mission, icon) { + console.log('onMissionIconUpdated mission: ' + JSON.stringify(mission)); + console.log('onMissionIconUpdated icon: ' + JSON.stringify(icon)); + }, onMissionClosed: function (mission) { console.log('onMissionClosed mission: ${JSON.stringify(mission)}'); } @@ -42,6 +46,6 @@ let listener = { try { let listenerId = missionManager.on('mission', listener); } catch (paramError) { - console.log('error: ${paramError.code}, ${paramError.message}'); + console.error('error: ${paramError.code}, ${paramError.message}'); } ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-missionParameter.md b/en/application-dev/reference/apis/js-apis-inner-application-missionParameter.md index 40e8cc3f92791f09b505912b3a391080aa6465bc..143c640c90657ef42cc45e4dc3a83e378f45507d 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-missionParameter.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-missionParameter.md @@ -21,8 +21,12 @@ let missionParameter = { }; try { distributedMissionManager.startSyncRemoteMissions(missionParameter, - (err, data) => { - console.log('startSyncRemoteMissions, data: ${JSON.stringify(data)}'); + (error, data) => { + if (error && error.code !== 0) { + console.error('startSyncRemoteMissions fail, error: ${JSON.stringify(error)}'); + } else { + console.log('startSyncRemoteMissions success, data: ${JSON.stringify(data)}'); + } } ); } catch (err) { diff --git a/en/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md b/en/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md index cafe6d2675bfd9fe1deae8d548f4d07dc78f2e9b..744c2d363f20b94ee8a839062416e805f5e12734 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md @@ -27,7 +27,7 @@ The mission snapshot information can be obtained by using **getMissionSnapShot** try { missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -36,7 +36,7 @@ The mission snapshot information can be obtained by using **getMissionSnapShot** missionManager.getMissionSnapShot('', id, (err, snapshot) => { if (err.code) { - console.error('getMissionInfos failed, err.code: ${JSON.stringify(err.code)}, err.message: ${JSON.stringify(err.message)}'); + console.error('getMissionInfos failed, err.code: ${err.code}, err.message: ${err.message}'); return; } diff --git a/en/application-dev/reference/apis/js-apis-inner-application-processInformation.md b/en/application-dev/reference/apis/js-apis-inner-application-processInformation.md index 19c8f42e7de0b8c354c14d44300a65ce7f0ac208..d2ee664b5fade510aabf9a0113e4ce406e2f6af4 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-processInformation.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-processInformation.md @@ -14,7 +14,11 @@ The process information is obtained by calling [getRunningProcessInformation](js import appManager from '@ohos.app.ability.appManager'; appManager.getRunningProcessInformation((error, data) => { - console.log('error: ${error.code}, data: ${JSON.stringify(data)}'); + if (error && error.code !== 0) { + console.error('getRunningProcessInformation fail, error: ${JSON.stringify(error)}'); + } else { + console.log('getRunningProcessInformation success, data: ${JSON.stringify(data)}'); + } }); ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-processRunningInfo.md b/en/application-dev/reference/apis/js-apis-inner-application-processRunningInfo.md index f0025296af4ced3c2c7c344e395478df608366a5..b1441077dc9b63aafab110388ad11114aa62796a 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-processRunningInfo.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-processRunningInfo.md @@ -28,6 +28,6 @@ import appManager from '@ohos.app.ability.appManager'; appManager.getProcessRunningInfos().then((data) => { console.log('success: ${JSON.stringify(data)}'); }).catch((error) => { - console.log('failed: ${JSON.stringify(error)}'); + console.error('failed: ${JSON.stringify(error)}'); }); ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md b/en/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md index 6203c272773910aeab2b6f29041ec4aa21168872..476d143241154b165388a743950ed0d8f5afa48d 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md @@ -17,6 +17,7 @@ Before using the **ServiceExtensionContext** module, you must define a child cla import ServiceExtensionAbility from '@ohos.app.ability.ServiceExtensionAbility'; let context; + let commRemote; // Release the instance when the connection is disconnected. class EntryAbility extends ServiceExtensionAbility { onCreate() { context = this.context; // Obtain a ServiceExtensionContext instance. @@ -45,25 +46,21 @@ Starts an ability. This API uses an asynchronous callback to return the result. | ID| Error Message| | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000004 | Visibility verification failed. | -| 16000005 | Static permission denied. The specified process does not have the permission. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000008 | Crowdtest App Expiration. | -| 16000009 | Can not start ability in wukong mode. | -| 16000010 | Can not operation with continue flag. | -| 16000011 | Context does not exist. | -| 16000051 | Network error. The network is abnormal. | -| 16000052 | Free install not support. The application does not support freeinstall | -| 16000053 | Not top ability. The application is not top ability. | -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry. | -| 16000055 | Free install timeout. | -| 16000056 | Can not free install other ability. | -| 16000057 | Not support cross device free install. | -| 16200001 | Caller released. The caller has been released. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000004 | Can not start invisible component. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000008 | The crowdtesting application expires. | +| 16000009 | An ability cannot be started or stopped in Wukong mode. | +| 16000010 | The call with the continuation flag is forbidden. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16000053 | The ability is not on the top of the UI. | +| 16000055 | Installation-free timed out. | +| 16200001 | The caller has been released. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). **Example** @@ -77,7 +74,7 @@ Starts an ability. This API uses an asynchronous callback to return the result. this.context.startAbility(want, (error) => { if (error.code) { // Process service logic errors. - console.log('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -85,7 +82,7 @@ Starts an ability. This API uses an asynchronous callback to return the result. }); } catch (paramError) { // Process input parameter errors. - console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -116,25 +113,21 @@ Starts an ability. This API uses a promise to return the result. | ID| Error Message| | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000004 | Visibility verification failed. | -| 16000005 | Static permission denied. The specified process does not have the permission. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000008 | Crowdtest App Expiration. | -| 16000009 | Can not start ability in wukong mode. | -| 16000010 | Can not operation with continue flag. | -| 16000011 | Context does not exist. | -| 16000051 | Network error. The network is abnormal. | -| 16000052 | Free install not support. The application does not support freeinstall | -| 16000053 | Not top ability. The application is not top ability. | -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry. | -| 16000055 | Free install timeout. | -| 16000056 | Can not free install other ability. | -| 16000057 | Not support cross device free install. | -| 16200001 | Caller released. The caller has been released. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000004 | Can not start invisible component. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000008 | The crowdtesting application expires. | +| 16000009 | An ability cannot be started or stopped in Wukong mode. | +| 16000010 | The call with the continuation flag is forbidden. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16000053 | The ability is not on the top of the UI. | +| 16000055 | Installation-free timed out. | +| 16200001 | The caller has been released. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). **Example** @@ -155,11 +148,11 @@ Starts an ability. This API uses a promise to return the result. }) .catch((error) => { // Process service logic errors. - console.log('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbility failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // Process input parameter errors. - console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -185,25 +178,21 @@ Starts an ability with the start options specified. This API uses an asynchronou | ID| Error Message| | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000004 | Visibility verification failed. | -| 16000005 | Static permission denied. The specified process does not have the permission. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000008 | Crowdtest App Expiration. | -| 16000009 | Can not start ability in wukong mode. | -| 16000010 | Can not operation with continue flag. | -| 16000011 | Context does not exist. | -| 16000051 | Network error. The network is abnormal. | -| 16000052 | Free install not support. The application does not support freeinstall | -| 16000053 | Not top ability. The application is not top ability. | -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry. | -| 16000055 | Free install timeout. | -| 16000056 | Can not free install other ability. | -| 16000057 | Not support cross device free install. | -| 16200001 | Caller released. The caller has been released. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000004 | Can not start invisible component. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000008 | The crowdtesting application expires. | +| 16000009 | An ability cannot be started or stopped in Wukong mode. | +| 16000010 | The call with the continuation flag is forbidden. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16000053 | The ability is not on the top of the UI. | +| 16000055 | Installation-free timed out. | +| 16200001 | The caller has been released. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). **Example** @@ -221,7 +210,7 @@ Starts an ability with the start options specified. This API uses an asynchronou this.context.startAbility(want, options, (error) => { if (error.code) { // Process service logic errors. - console.log('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -229,7 +218,7 @@ Starts an ability with the start options specified. This API uses an asynchronou }); } catch (paramError) { // Process input parameter errors. - console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -241,7 +230,7 @@ Starts an ability with the account ID specified. This API uses an asynchronous c Observe the following when using this API: - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. + - If **exported** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -260,26 +249,21 @@ Observe the following when using this API: | ID| Error Message| | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000004 | Visibility verification failed. | -| 16000005 | Static permission denied. The specified process does not have the permission. | -| 16000006 | Can not cross user operations. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000008 | Crowdtest App Expiration. | -| 16000009 | Can not start ability in wukong mode. | -| 16000010 | Can not operation with continue flag. | -| 16000011 | Context does not exist. | -| 16000051 | Network error. The network is abnormal. | -| 16000052 | Free install not support. The application does not support freeinstall | -| 16000053 | Not top ability. The application is not top ability. | -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry. | -| 16000055 | Free install timeout. | -| 16000056 | Can not free install other ability. | -| 16000057 | Not support cross device free install. | -| 16200001 | Caller released. The caller has been released. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000004 | Can not start invisible component. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000008 | The crowdtesting application expires. | +| 16000009 | An ability cannot be started or stopped in Wukong mode. | +| 16000010 | The call with the continuation flag is forbidden. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16000053 | The ability is not on the top of the UI. | +| 16000055 | Installation-free timed out. | +| 16200001 | The caller has been released. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). **Example** @@ -295,7 +279,7 @@ Observe the following when using this API: this.context.startAbilityWithAccount(want, accountId, (error) => { if (error.code) { // Process service logic errors. - console.log('startAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -303,7 +287,7 @@ Observe the following when using this API: }); } catch (paramError) { // Process input parameter errors. - console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -315,7 +299,7 @@ Starts an ability with the account ID and start options specified. This API uses Observe the following when using this API: - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. + - If **exported** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -335,26 +319,21 @@ Observe the following when using this API: | ID| Error Message| | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000004 | Visibility verification failed. | -| 16000005 | Static permission denied. The specified process does not have the permission. | -| 16000006 | Can not cross user operations. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000008 | Crowdtest App Expiration. | -| 16000009 | Can not start ability in wukong mode. | -| 16000010 | Can not operation with continue flag. | -| 16000011 | Context does not exist. | -| 16000051 | Network error. The network is abnormal. | -| 16000052 | Free install not support. The application does not support freeinstall | -| 16000053 | Not top ability. The application is not top ability. | -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry. | -| 16000055 | Free install timeout. | -| 16000056 | Can not free install other ability. | -| 16000057 | Not support cross device free install. | -| 16200001 | Caller released. The caller has been released. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000004 | Can not start invisible component. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000008 | The crowdtesting application expires. | +| 16000009 | An ability cannot be started or stopped in Wukong mode. | +| 16000010 | The call with the continuation flag is forbidden. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16000053 | The ability is not on the top of the UI. | +| 16000055 | Installation-free timed out. | +| 16200001 | The caller has been released. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). **Example** @@ -373,7 +352,7 @@ Observe the following when using this API: this.context.startAbilityWithAccount(want, accountId, options, (error) => { if (error.code) { // Process service logic errors. - console.log('startAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -381,7 +360,7 @@ Observe the following when using this API: }); } catch (paramError) { // Process input parameter errors. - console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -394,7 +373,7 @@ Starts an ability with the account ID specified. This API uses a promise to retu Observe the following when using this API: - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. + - If **exported** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -419,26 +398,21 @@ Observe the following when using this API: | ID| Error Message| | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000004 | Visibility verification failed. | -| 16000005 | Static permission denied. The specified process does not have the permission. | -| 16000006 | Can not cross user operations. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000008 | Crowdtest App Expiration. | -| 16000009 | Can not start ability in wukong mode. | -| 16000010 | Can not operation with continue flag. | -| 16000011 | Context does not exist. | -| 16000051 | Network error. The network is abnormal. | -| 16000052 | Free install not support. The application does not support freeinstall | -| 16000053 | Not top ability. The application is not top ability. | -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry. | -| 16000055 | Free install timeout. | -| 16000056 | Can not free install other ability. | -| 16000057 | Not support cross device free install. | -| 16200001 | Caller released. The caller has been released. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000004 | Can not start invisible component. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000008 | The crowdtesting application expires. | +| 16000009 | An ability cannot be started or stopped in Wukong mode. | +| 16000010 | The call with the continuation flag is forbidden. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16000053 | The ability is not on the top of the UI. | +| 16000055 | Installation-free timed out. | +| 16200001 | The caller has been released. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). **Example** @@ -461,11 +435,11 @@ Observe the following when using this API: }) .catch((error) => { // Process service logic errors. - console.log('startAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // Process input parameter errors. - console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -490,18 +464,16 @@ Starts a new ServiceExtensionAbility. This API uses an asynchronous callback to | ID| Error Message| | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong. | -| 16000004 | Visibility verification failed. | -| 16000005 | Static permission denied. The specified process does not have the permission. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000008 | Crowdtest App Expiration. | -| 16000009 | Can not start ability in wukong mode. | -| 16000011 | Context does not exist. | -| 16200001 | Caller released. The caller has been released. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000008 | The crowdtesting application expires. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16200001 | The caller has been released. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). **Example** @@ -516,7 +488,7 @@ Starts a new ServiceExtensionAbility. This API uses an asynchronous callback to this.context.startServiceExtensionAbility(want, (error) => { if (error.code) { // Process service logic errors. - console.log('startServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -524,7 +496,7 @@ Starts a new ServiceExtensionAbility. This API uses an asynchronous callback to }); } catch (paramError) { // Process input parameter errors. - console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -554,18 +526,16 @@ Starts a new ServiceExtensionAbility. This API uses a promise to return the resu | ID| Error Message| | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong. | -| 16000004 | Visibility verification failed. | -| 16000005 | Static permission denied. The specified process does not have the permission. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000008 | Crowdtest App Expiration. | -| 16000009 | Can not start ability in wukong mode. | -| 16000011 | Context does not exist. | -| 16200001 | Caller released. The caller has been released. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000008 | The crowdtesting application expires. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16200001 | The caller has been released. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). **Example** @@ -584,11 +554,11 @@ Starts a new ServiceExtensionAbility. This API uses a promise to return the resu }) .catch((error) => { // Process service logic errors. - console.log('startServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // Process input parameter errors. - console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -616,19 +586,16 @@ Starts a new ServiceExtensionAbility with the account ID specified. This API use | ID| Error Message| | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong. | -| 16000004 | Visibility verification failed. | -| 16000005 | Static permission denied. The specified process does not have the permission. | -| 16000006 | Can not cross user operations. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000008 | Crowdtest App Expiration. | -| 16000009 | Can not start ability in wukong mode. | -| 16000011 | Context does not exist. | -| 16200001 | Caller released. The caller has been released. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000008 | The crowdtesting application expires. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16200001 | The caller has been released. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). **Example** @@ -645,7 +612,7 @@ Starts a new ServiceExtensionAbility with the account ID specified. This API use this.context.startServiceExtensionAbilityWithAccount(want, accountId, (error) => { if (error.code) { // Process service logic errors. - console.log('startServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startServiceExtensionAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -653,7 +620,7 @@ Starts a new ServiceExtensionAbility with the account ID specified. This API use }); } catch (paramError) { // Process input parameter errors. - console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -686,19 +653,16 @@ Starts a new ServiceExtensionAbility with the account ID specified. This API use | ID| Error Message| | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong. | -| 16000004 | Visibility verification failed. | -| 16000005 | Static permission denied. The specified process does not have the permission. | -| 16000006 | Can not cross user operations. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000008 | Crowdtest App Expiration. | -| 16000009 | Can not start ability in wukong mode. | -| 16000011 | Context does not exist. | -| 16200001 | Caller released. The caller has been released. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000008 | The crowdtesting application expires. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16200001 | The caller has been released. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). **Example** @@ -718,11 +682,11 @@ Starts a new ServiceExtensionAbility with the account ID specified. This API use }) .catch((error) => { // Process service logic errors. - console.log('startServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startServiceExtensionAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // Process input parameter errors. - console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -747,15 +711,15 @@ Stops a ServiceExtensionAbility in the same application. This API uses an asynch | ID| Error Message| | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong. | -| 16000004 | Visibility verification failed. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000011 | Context does not exist. | -| 16200001 | Caller released. The caller has been released. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16200001 | The caller has been released. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). **Example** @@ -770,7 +734,7 @@ Stops a ServiceExtensionAbility in the same application. This API uses an asynch this.context.stopServiceExtensionAbility(want, (error) => { if (error.code) { // Process service logic errors. - console.log('stopServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('stopServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -778,7 +742,7 @@ Stops a ServiceExtensionAbility in the same application. This API uses an asynch }); } catch (paramError) { // Process input parameter errors. - console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -808,15 +772,15 @@ Stops a ServiceExtensionAbility in the same application. This API uses a promise | ID| Error Message| | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong. | -| 16000004 | Visibility verification failed. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000011 | Context does not exist. | -| 16200001 | Caller released. The caller has been released. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16200001 | The caller has been released. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). **Example** @@ -835,11 +799,11 @@ Stops a ServiceExtensionAbility in the same application. This API uses a promise }) .catch((error) => { // Process service logic errors. - console.log('stopServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('stopServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // Process input parameter errors. - console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -867,16 +831,15 @@ Stops a ServiceExtensionAbility in the same application with the account ID spec | ID| Error Message| | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong. | -| 16000004 | Visibility verification failed. | -| 16000006 | Can not cross user operations. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000011 | Context does not exist. | -| 16200001 | Caller released. The caller has been released. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16200001 | The caller has been released. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). **Example** @@ -892,7 +855,7 @@ Stops a ServiceExtensionAbility in the same application with the account ID spec this.context.stopServiceExtensionAbilityWithAccount(want, accountId, (error) => { if (error.code) { // Process service logic errors. - console.log('stopServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code), error.message: ${JSON.stringify(error.message)}'); + console.error('stopServiceExtensionAbilityWithAccount failed, error.code: ${error.code, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -900,7 +863,7 @@ Stops a ServiceExtensionAbility in the same application with the account ID spec }); } catch (paramError) { // Process input parameter errors. - console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -933,16 +896,15 @@ Stops a ServiceExtensionAbility in the same application with the account ID spec | ID| Error Message| | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong. | -| 16000004 | Visibility verification failed. | -| 16000006 | Can not cross user operations. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000011 | Context does not exist. | -| 16200001 | Caller released. The caller has been released. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16200001 | The caller has been released. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). **Example** @@ -962,11 +924,11 @@ Stops a ServiceExtensionAbility in the same application with the account ID spec }) .catch((error) => { // Process service logic errors. - console.log('stopServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('stopServiceExtensionAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // Process input parameter errors. - console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -990,12 +952,14 @@ Terminates this ability. This API uses an asynchronous callback to return the re | ID| Error Message| | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000011 | Context does not exist. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000004 | Can not start invisible component. | +| 16000005 | The specified process does not have the permission. | +| 16000009 | An ability cannot be started or stopped in Wukong mode. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). **Example** @@ -1003,7 +967,7 @@ Terminates this ability. This API uses an asynchronous callback to return the re this.context.terminateSelf((error) => { if (error.code) { // Process service logic errors. - console.log('terminateSelf failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('terminateSelf failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -1031,12 +995,14 @@ Terminates this ability. This API uses a promise to return the result. | ID| Error Message| | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000011 | Context does not exist. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000004 | Can not start invisible component. | +| 16000005 | The specified process does not have the permission. | +| 16000009 | An ability cannot be started or stopped in Wukong mode. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). **Example** @@ -1046,7 +1012,7 @@ Terminates this ability. This API uses a promise to return the result. console.log('terminateSelf succeed'); }).catch((error) => { // Process service logic errors. - console.log('terminateSelf failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('terminateSelf failed, error.code: ${error.code}, error.message: ${error.message}'); }); ``` @@ -1054,7 +1020,7 @@ Terminates this ability. This API uses a promise to return the result. connectServiceExtensionAbility(want: Want, options: ConnectOptions): number; -Connects this ability to a ServiceAbility. +Connects this ability to a ServiceExtensionAbility. **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -1077,14 +1043,13 @@ Connects this ability to a ServiceAbility. | ID| Error Message| | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | | 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong. | -| 16000004 | Visibility verification failed. | -| 16000011 | Context does not exist. | +| 16000005 | The specified process does not have the permission. | +| 16000011 | The context does not exist. | | 16000050 | Internal Error. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -1093,9 +1058,12 @@ Connects this ability to a ServiceAbility. abilityName: 'MyAbility' }; let options = { - onConnect(elementName, remote) { console.log('----------- onConnect -----------') }, + onConnect(elementName, remote) { + commRemote = remote; + console.log('----------- onConnect -----------'); + }, onDisconnect(elementName) { console.log('----------- onDisconnect -----------') }, - onFailed(code) { console.log('----------- onFailed -----------') } + onFailed(code) { console.error('----------- onFailed -----------') } }; let connection = null; @@ -1103,7 +1071,7 @@ Connects this ability to a ServiceAbility. connection = this.context.connectServiceExtensionAbility(want, options); } catch (paramError) { // Process input parameter errors. - console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1135,15 +1103,13 @@ Uses the **AbilityInfo.AbilityType.SERVICE** template and account ID to connect | ID| Error Message| | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | | 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong. | -| 16000004 | Visibility verification failed. | -| 16000006 | Can not cross user operations. | -| 16000011 | Context does not exist. | +| 16000005 | The specified process does not have the permission. | +| 16000011 | The context does not exist. | | 16000050 | Internal Error. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -1154,7 +1120,10 @@ Uses the **AbilityInfo.AbilityType.SERVICE** template and account ID to connect }; let accountId = 100; let options = { - onConnect(elementName, remote) { console.log('----------- onConnect -----------'); }, + onConnect(elementName, remote) { + commRemote = remote; + console.log('----------- onConnect -----------'); + }, onDisconnect(elementName) { console.log('----------- onDisconnect -----------'); }, onFailed(code) { console.log('----------- onFailed -----------'); } }; @@ -1164,7 +1133,7 @@ Uses the **AbilityInfo.AbilityType.SERVICE** template and account ID to connect connection = this.context.connectServiceExtensionAbilityWithAccount(want, accountId, options); } catch (paramError) { // Process input parameter errors. - console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1172,7 +1141,7 @@ Uses the **AbilityInfo.AbilityType.SERVICE** template and account ID to connect disconnectServiceExtensionAbility(connection: number, callback:AsyncCallback<void>): void; -Disconnects this ability from the ServiceAbility. This API uses an asynchronous callback to return the result. +Disconnects this ability from a ServiceExtensionAbility and after the successful disconnection, sets the remote object returned upon the connection to void. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -1189,13 +1158,11 @@ Disconnects this ability from the ServiceAbility. This API uses an asynchronous | ID| Error Message| | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000003 | Input error. The specified id does not exist. | -| 16000011 | Context does not exist. | +| 16000011 | The context does not exist. | | 16000050 | Internal Error. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -1204,17 +1171,19 @@ Disconnects this ability from the ServiceAbility. This API uses an asynchronous try { this.context.disconnectServiceExtensionAbility(connection, (error) => { + commRemote = null; if (error.code) { // Process service logic errors. - console.log('disconnectServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('disconnectServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // Carry out normal service processing. console.log('disconnectServiceExtensionAbility succeed'); }); } catch (paramError) { + commRemote = null; // Process input parameter errors. - console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1222,7 +1191,7 @@ Disconnects this ability from the ServiceAbility. This API uses an asynchronous disconnectServiceExtensionAbility(connection: number): Promise<void>; -Disconnects this ability from the ServiceAbility. This API uses a promise to return the result. +Disconnects this ability from a ServiceExtensionAbility and after the successful disconnection, sets the remote object returned upon the connection to void. This API uses a promise to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -1244,13 +1213,11 @@ Disconnects this ability from the ServiceAbility. This API uses a promise to ret | ID| Error Message| | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000003 | Input error. The specified id does not exist. | -| 16000011 | Context does not exist. | +| 16000011 | The context does not exist. | | 16000050 | Internal Error. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -1260,16 +1227,19 @@ Disconnects this ability from the ServiceAbility. This API uses a promise to ret try { this.context.disconnectServiceExtensionAbility(connection) .then((data) => { + commRemote = null; // Carry out normal service processing. console.log('disconnectServiceExtensionAbility succeed'); }) .catch((error) => { + commRemote = null; // Process service logic errors. - console.log('disconnectServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('disconnectServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { + commRemote = null; // Process input parameter errors. - console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1281,7 +1251,7 @@ Starts an ability in the foreground or background and obtains the caller object Observe the following when using this API: - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. + - If **exported** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - The rules for using this API in the same-device and cross-device scenarios are different. For details, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -1304,15 +1274,17 @@ Observe the following when using this API: | ID| Error Message| | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | | 16000001 | Input error. The specified ability name does not exist. | +| 16000002 | Incorrect ability type. | | 16000004 | Visibility verification failed. | | 16000005 | Static permission denied. The specified process does not have the permission. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | +| 16000006 | Cross-user operations are not allowed. | | 16000008 | Crowdtest App Expiration. | -| 16000009 | Can not start ability in wukong mode. | +| 16000011 | The context does not exist. | | 16000050 | Internal Error. | +| 16200001 | The caller has been released. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). **Example** @@ -1337,11 +1309,11 @@ Observe the following when using this API: console.log('startAbilityByCall succeed'); }).catch((error) => { // Process service logic errors. - console.log('startAbilityByCall failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbilityByCall failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // Process input parameter errors. - console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1369,10 +1341,10 @@ Observe the following when using this API: console.log('startAbilityByCall succeed'); }).catch((error) => { // Process service logic errors. - console.log('startAbilityByCall failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbilityByCall failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // Process input parameter errors. - console.log('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-shellCmdResult.md b/en/application-dev/reference/apis/js-apis-inner-application-shellCmdResult.md index 435d799676e7924e7366fdbec93373f55313a86d..ca376d9776ffc064b82468e7c3af596a86faba53 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-shellCmdResult.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-shellCmdResult.md @@ -24,8 +24,11 @@ let abilityDelegator; let cmd = 'cmd'; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); -abilityDelegator.executeShellCommand(cmd, (err: any, data: any) => { - console.info('executeShellCommand callback, result: ', err); - console.info('executeShellCommand callback, data: ', data); +abilityDelegator.executeShellCommand(cmd, (error: any, data: any) => { + if (error && error.code !== 0) { + console.error('executeShellCommand fail, error: ${JSON.stringify(error)}'); + } else { + console.log('executeShellCommand success, data: ${JSON.stringify(data)}'); + } }); ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md b/en/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md index f735fb4b0f84720e1150f219b04ff0b79e63b3ed..59edfc898f6c32815b3926c9775913351dc476e9 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md @@ -29,7 +29,7 @@ Starts an ability. This API uses an asynchronous callback to return the result. Observe the following when using this API: - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. + - If **exported** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -59,6 +59,8 @@ Observe the following when using this API: | 16000055 | Installation-free timed out. | | 16200001 | The caller has been released. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -91,7 +93,7 @@ Starts an ability with the start options specified. This API uses an asynchronou Observe the following when using this API: - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. + - If **exported** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -122,6 +124,8 @@ Observe the following when using this API: | 16000055 | Installation-free timed out. | | 16200001 | The caller has been released. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -158,7 +162,7 @@ Starts an ability. This API uses a promise to return the result. Observe the following when using this API: - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. + - If **exported** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -194,6 +198,8 @@ Observe the following when using this API: | 16000055 | Installation-free timed out. | | 16200001 | The caller has been released. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -232,7 +238,7 @@ Starts an ability. This API uses an asynchronous callback to return the result w Observe the following when using this API: - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. + - If **exported** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -262,6 +268,8 @@ Observe the following when using this API: | 16000055 | Installation-free timed out. | | 16200001 | The caller has been released. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -298,7 +306,7 @@ Starts an ability with the start options specified. This API uses an asynchronou Observe the following when using this API: - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. + - If **exported** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -329,6 +337,8 @@ Observe the following when using this API: | 16000055 | Installation-free timed out. | | 16200001 | The caller has been released. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -369,7 +379,7 @@ Starts an ability. This API uses a promise to return the result when the ability Observe the following when using this API: - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. + - If **exported** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -406,6 +416,8 @@ Observe the following when using this API: | 16000055 | Installation-free timed out. | | 16200001 | The caller has been released. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -441,7 +453,7 @@ Starts an ability with the account ID specified. This API uses an asynchronous c Observe the following when using this API: - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. + - If **exported** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). **Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) @@ -476,6 +488,8 @@ Observe the following when using this API: | 16000055 | Installation-free timed out. | | 16200001 | The caller has been released. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -511,7 +525,7 @@ Starts an ability with the start options and account ID specified. This API uses Observe the following when using this API: - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. + - If **exported** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). **Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) @@ -547,6 +561,8 @@ Observe the following when using this API: | 16000055 | Installation-free timed out. | | 16200001 | The caller has been released. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -585,7 +601,7 @@ Starts an ability with the account ID specified. This API uses a promise to retu Observe the following when using this API: - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. + - If **exported** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). **Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) @@ -626,6 +642,8 @@ Observe the following when using this API: | 16000055 | Installation-free timed out. | | 16200001 | The caller has been released. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -684,6 +702,8 @@ Starts a ServiceExtensionAbility. This API uses an asynchronous callback to retu | 16000050 | Internal error. | | 16200001 | The caller has been released. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -738,6 +758,8 @@ Starts a ServiceExtensionAbility. This API uses a promise to return the result. | 16000050 | Internal error. | | 16200001 | The caller has been released. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -796,6 +818,8 @@ Starts a ServiceExtensionAbility with the account ID specified. This API uses an | 16000050 | Internal error. | | 16200001 | The caller has been released. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -854,6 +878,8 @@ Starts a ServiceExtensionAbility with the account ID specified. This API uses a | 16000050 | Internal error. | | 16200001 | The caller has been released. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -908,6 +934,8 @@ Stops a ServiceExtensionAbility in the same application. This API uses an asynch | 16000050 | Internal error. | | 16200001 | The caller has been released. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -961,6 +989,8 @@ Stops a ServiceExtensionAbility in the same application. This API uses a promise | 16000050 | Internal error. | | 16200001 | The caller has been released. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -1018,6 +1048,8 @@ Stops a ServiceExtensionAbility with the account ID specified in the same applic | 16000050 | Internal error. | | 16200001 | The caller has been released. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -1075,6 +1107,8 @@ Stops a ServiceExtensionAbility with the account ID specified in the same applic | 16000050 | Internal error. | | 16200001 | The caller has been released. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -1126,6 +1160,8 @@ Terminates this ability. This API uses an asynchronous callback to return the re | 16000011 | The context does not exist. | | 16000050 | Internal error. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -1171,6 +1207,8 @@ Terminates this ability. This API uses a promise to return the result. | 16000011 | The context does not exist. | | 16000050 | Internal error. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -1217,6 +1255,8 @@ Terminates this ability. If the ability is started by calling [startAbilityForRe | 16000011 | The context does not exist. | | 16000050 | Internal error. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -1279,6 +1319,8 @@ Terminates this ability. If the ability is started by calling [startAbilityForRe | 16000011 | The context does not exist. | | 16000050 | Internal error. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -1339,6 +1381,8 @@ Connects this ability to an ability that uses the **AbilityInfo.AbilityType.SERV | 16000011 | The context does not exist. | | 16000050 | Internal error. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -1349,6 +1393,7 @@ let want = { }; let options = { onConnect(elementName, remote) { + commRemote = remote; console.info('onConnect...') }, onDisconnect(elementName) { @@ -1404,6 +1449,8 @@ Connects this ability to an ability that uses the **AbilityInfo.AbilityType.SERV | 16000011 | The context does not exist. | | 16000050 | Internal error. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -1415,6 +1462,7 @@ let want = { let accountId = 100; let options = { onConnect(elementName, remote) { + commRemote = remote; console.info('onConnect...') }, onDisconnect(elementName) { @@ -1438,7 +1486,7 @@ try { disconnectServiceExtensionAbility(connection: number): Promise\; -Disconnects from a ServiceExtensionAbility. This API uses a promise to return the result. +Disconnects this ability from a ServiceExtensionAbility and after the successful disconnection, sets the remote object returned upon the connection to void. This API uses a promise to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -1458,11 +1506,11 @@ Disconnects from a ServiceExtensionAbility. This API uses a promise to return th | ID| Error Message| | ------- | -------------------------------- | -| 16000001 | The specified ability does not exist. | -| 16000005 | The specified process does not have the permission. | | 16000011 | The context does not exist. | | 16000050 | Internal error. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -1471,6 +1519,7 @@ let connection = 1; try { this.context.disconnectServiceExtensionAbility(connection, (err) => { + commRemote = null; if (err.code) { // Process service logic errors. console.error(`disconnectServiceExtensionAbility failed, code is ${err.code}, message is ${err.message}`); @@ -1480,6 +1529,7 @@ try { console.info('disconnectServiceExtensionAbility succeed'); }); } catch (err) { + commRemote = null; // Process input parameter errors. console.error(`disconnectServiceExtensionAbility failed, code is ${err.code}, message is ${err.message}`); } @@ -1489,7 +1539,7 @@ try { disconnectServiceExtensionAbility(connection: number, callback:AsyncCallback\): void; -Disconnects from a ServiceExtensionAbility. This API uses an asynchronous callback to return the result. +Disconnects this ability from a ServiceExtensionAbility and after the successful disconnection, sets the remote object returned upon the connection to void. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -1504,11 +1554,11 @@ Disconnects from a ServiceExtensionAbility. This API uses an asynchronous callba | ID| Error Message| | ------- | -------------------------------- | -| 16000001 | The specified ability does not exist. | -| 16000005 | The specified process does not have the permission. | | 16000011 | The context does not exist. | | 16000050 | Internal error. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -1517,6 +1567,7 @@ let connection = 1; try { this.context.disconnectServiceExtensionAbility(connection, (err) => { + commRemote = null; if (err.code) { // Process service logic errors. console.error(`disconnectServiceExtensionAbility failed, code is ${err.code}, message is ${err.message}`); @@ -1526,6 +1577,7 @@ try { console.info('disconnectServiceExtensionAbility succeed'); }); } catch (err) { + commRemote = null; // Process input parameter errors. console.error(`disconnectServiceExtensionAbility failed, code is ${err.code}, message is ${err.message}`); } @@ -1539,7 +1591,7 @@ Starts an ability in the foreground or background and obtains the caller object Observe the following when using this API: - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. + - If **exported** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - The rules for using this API in the same-device and cross-device scenarios are different. For details, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -1566,14 +1618,12 @@ Observe the following when using this API: | 16000005 | The specified process does not have the permission. | | 16000006 | Cross-user operations are not allowed. | | 16000008 | The crowdtesting application expires. | -| 16000009 | An ability cannot be started or stopped in Wukong mode. | -| 16000010 | The call with the continuation flag is forbidden. | | 16000011 | The context does not exist. | | 16000050 | Internal error. | -| 16000053 | The ability is not on the top of the UI. | -| 16000055 | Installation-free timed out. | | 16200001 | The caller has been released. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** Start an ability in the background. @@ -1645,7 +1695,7 @@ Starts an ability with the account ID specified. This API uses an asynchronous c Observe the following when using this API: - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. + - If **exported** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). **Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) @@ -1680,6 +1730,8 @@ Observe the following when using this API: | 16000055 | Installation-free timed out. | | 16200001 | The caller has been released. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -1715,7 +1767,7 @@ Starts an ability with the account ID and start options specified. This API uses Observe the following when using this API: - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. + - If **exported** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). **Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) @@ -1751,6 +1803,8 @@ Observe the following when using this API: | 16000055 | Installation-free timed out. | | 16200001 | The caller has been released. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -1789,7 +1843,7 @@ Starts an ability with the account ID specified. This API uses a promise to retu Observe the following when using this API: - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. + - If **exported** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). **Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS (required only when the account ID is not the current user) @@ -1824,6 +1878,8 @@ Observe the following when using this API: | 16000055 | Installation-free timed out. | | 16200001 | The caller has been released. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -1868,6 +1924,15 @@ Sets a label for this UIAbility in the mission. This API uses an asynchronous ca | label | string | Yes| Label of the ability to set.| | callback | AsyncCallback<void> | Yes| Callback used to return the result.| +**Error codes** + +| ID| Error Message| +| ------- | -------------------------------- | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -1903,6 +1968,8 @@ Sets a label for this UIAbility in the mission. This API uses a promise to retur | 16000011 | The context does not exist. | | 16000050 | Internal error. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -1916,7 +1983,7 @@ Sets a label for this UIAbility in the mission. This API uses a promise to retur setMissionIcon(icon: image.PixelMap, callback:AsyncCallback\): void; -Sets an icon for this ability in the mission. This API uses an asynchronous callback to return the result. +Sets an icon for this ability in the mission. This API uses an asynchronous callback to return the result. The maximum size of the icon is 600 MB. **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -1936,6 +2003,8 @@ Sets an icon for this ability in the mission. This API uses an asynchronous call | 16000011 | The context does not exist. | | 16000050 | Internal error. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -1966,7 +2035,7 @@ Sets an icon for this ability in the mission. This API uses an asynchronous call setMissionIcon(icon: image.PixelMap): Promise\; -Sets an icon for this ability in the mission. This API uses a promise to return the result. +Sets an icon for this ability in the mission. This API uses a promise to return the result. The maximum size of the icon is 600 MB. **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -1991,6 +2060,8 @@ Sets an icon for this ability in the mission. This API uses a promise to return | 16000011 | The context does not exist. | | 16000050 | Internal error. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -2038,6 +2109,8 @@ Restores the WindowStage data in the UIAbility. | 16000011 | The context does not exist. | | 16000050 | Internal error. | +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -2064,7 +2137,8 @@ Checks whether this UIAbility is in the terminating state. | ID| Error Message| | ------- | -------------------------------- | | 16000011 | The context does not exist. | -| 16000050 | Internal error. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). **Example** @@ -2081,7 +2155,7 @@ Starts a ServiceExtensionAbility that supports modal dialog boxes. After the Ser Observe the following when using this API: - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. + - If **exported** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -2093,6 +2167,26 @@ Observe the following when using this API: | want |[Want](js-apis-application-want.md) | Yes| Want information about the target ServiceExtensionAbility.| | result | AsyncCallback<[dialogRequest.RequestResult](js-apis-app-ability-dialogRequest.md)> | Yes| Callback used to return the result.| +**Error codes** + +| ID| Error Message| +| ------- | -------------------------------- | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000004 | Can not start invisible component. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000008 | The crowdtesting application expires. | +| 16000009 | An ability cannot be started or stopped in Wukong mode. | +| 16000010 | The call with the continuation flag is forbidden. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16000053 | The ability is not on the top of the UI. | +| 16000055 | Installation-free timed out. | +| 16200001 | The caller has been released. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -2112,7 +2206,7 @@ try { return; } // Carry out normal service processing. - console.info('requestDialogService succeed, result = ' + JSON.stringify(result)); + console.info('requestDialogService succeed, result = ${JSON.stringify(result)}'); }); } catch (err) { // Process input parameter errors. @@ -2128,7 +2222,7 @@ Starts a ServiceExtensionAbility that supports modal dialog boxes. After the Ser Observe the following when using this API: - If an application running in the background needs to call this API to start an ability, it must have the **ohos.permission.START_ABILITIES_FROM_BACKGROUND** permission. - - If **visible** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. + - If **exported** of the target ability is **false** in cross-application scenarios, the caller must have the **ohos.permission.START_INVISIBLE_ABILITY** permission. - For details about the startup rules for the components in the stage model, see [Component Startup Rules (Stage Model)](../../application-models/component-startup-rules.md). **System capability**: SystemCapability.Ability.AbilityRuntime.Core @@ -2146,6 +2240,26 @@ Observe the following when using this API: | -------- | -------- | | Promise<[dialogRequest.RequestResult](js-apis-app-ability-dialogRequest.md)> | Promise used to return the result. +**Error codes** + +| ID| Error Message| +| ------- | -------------------------------- | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000004 | Can not start invisible component. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000008 | The crowdtesting application expires. | +| 16000009 | An ability cannot be started or stopped in Wukong mode. | +| 16000010 | The call with the continuation flag is forbidden. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16000053 | The ability is not on the top of the UI. | +| 16000055 | Installation-free timed out. | +| 16200001 | The caller has been released. | + +For details about the error codes, see [Ability Error Codes](../errorcodes/errorcode-ability.md). + **Example** ```ts @@ -2160,7 +2274,7 @@ try { this.context.requestDialogService(want) .then((result) => { // Carry out normal service processing. - console.info('requestDialogService succeed, result = ' + JSON.stringify(result)); + console.info('requestDialogService succeed, result = ${JSON.stringify(result)}'); }) .catch((err) => { // Process service logic errors. diff --git a/en/application-dev/reference/apis/js-apis-inner-application-windowExtensionContext.md b/en/application-dev/reference/apis/js-apis-inner-application-windowExtensionContext.md index 602766048157ebee6dfaee6192a7120f051c00dc..c2dd40beaed0071db3277e86e86aacfb032f98b5 100644 --- a/en/application-dev/reference/apis/js-apis-inner-application-windowExtensionContext.md +++ b/en/application-dev/reference/apis/js-apis-inner-application-windowExtensionContext.md @@ -58,7 +58,7 @@ Starts an ability. This API uses an asynchronous callback to return the result. this.context.startAbility(want, options, (error) => { if (error.code) { // Process service logic errors. - console.log('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // Carry out normal service processing. @@ -66,7 +66,7 @@ Starts an ability. This API uses an asynchronous callback to return the result. }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -110,10 +110,10 @@ Starts an ability. This API uses a promise to return the result. }) .catch((error) => { // Process service logic errors. - console.log('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbility failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // Process input parameter errors. - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` diff --git a/en/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventData.md b/en/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventData.md new file mode 100644 index 0000000000000000000000000000000000000000..a73c80d7c5fa09e19f901b3c947f445eb61989e1 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventData.md @@ -0,0 +1,11 @@ +# CommonEventData + +**System capability**: SystemCapability.Notification.CommonEvent + +| Name | Type | Readable| Writable| Description | +| ---------- |-------------------- | ---- | ---- | ------------------------------------------------------- | +| event | string | Yes | No | Name of the common event that is being received. | +| bundleName | string | Yes | No | Bundle name. | +| code | number | Yes | No | Result code of the common event, which is used to transfer data of the int type. | +| data | string | Yes | No | Custom result data of the common event, which is used to transfer data of the string type.| +| parameters | {[key: string]: any} | Yes | No | Additional information about the common event. | diff --git a/en/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventPublishData.md b/en/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventPublishData.md new file mode 100644 index 0000000000000000000000000000000000000000..94963860fe1b57a6abfd6fff6fdba38816a63294 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventPublishData.md @@ -0,0 +1,13 @@ +# CommonEventPublishData + +**System capability**: SystemCapability.Notification.CommonEvent + +| Name | Type | Readable| Writable| Description | +| --------------------- | -------------------- | ---- | ---- | ---------------------------- | +| bundleName | string | Yes | No | Bundle name. | +| code | number | Yes | No | Result code of the common event. | +| data | string | Yes | No | Custom result data of the common event.| +| subscriberPermissions | Array\ | Yes | No | Permissions required for subscribers to receive the common event. | +| isOrdered | boolean | Yes | No | Whether the common event is an ordered one. | +| isSticky | boolean | Yes | No | Whether the common event is a sticky one. Only system applications and system services are allowed to send sticky events.| +| parameters | {[key: string]: any} | Yes | No | Additional information about the common event. | diff --git a/en/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscribeInfo.md b/en/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscribeInfo.md new file mode 100644 index 0000000000000000000000000000000000000000..2b9db9ec46f479d5d0607c33f07601b1ef721446 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscribeInfo.md @@ -0,0 +1,11 @@ +# CommonEventSubscribeInfo + +**System capability**: SystemCapability.Notification.CommonEvent + +| Name | Type | Readable| Writable| Description | +| ------------------- | -------------- | ---- | ---- | ------------------------------------------------------------ | +| events | Array\ | Yes | No | Name of the common event to publish. | +| publisherPermission | string | Yes | No | Permissions required for publishers to publish the common event. | +| publisherDeviceId | string | Yes | No | Device ID. The value must be the ID of a device on the same network. | +| userId | number | Yes | No | User ID. The value must be an existing user ID in the system. If this parameter is not specified, the default value, which is the ID of the current user, will be used. | +| priority | number | Yes | No | Subscriber priority. The value ranges from –100 to +1000. | diff --git a/en/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscriber.md b/en/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscriber.md new file mode 100644 index 0000000000000000000000000000000000000000..18eeac506b75dc96b27b56b9369070215ff8892a --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscriber.md @@ -0,0 +1,742 @@ +# CommonEventSubscriber + +## getCode + +```ts +getCode(callback: AsyncCallback): void +``` + +Obtains the code of this common event. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Notification.CommonEvent + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------- | ---- | ------------------ | +| callback | AsyncCallback\ | Yes | Common event code.| + +**Example** + +```ts +let subscriber; // Subscriber object successfully created. + +// Callback for result code obtaining of an ordered common event. +function getCodeCB(err, code) { + if (err.code) { + console.error(`getCode failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("getCode " + JSON.stringify(code)); + } +} +subscriber.getCode(getCodeCB); +``` + +## getCode + +```ts +getCode(): Promise +``` + +Obtains the code of this common event. This API uses a promise to return the result. + +**System capability**: SystemCapability.Notification.CommonEvent + +**Return value** + +| Type | Description | +| ---------------- | -------------------- | +| Promise\ | Common event code.| + +**Example** + +```ts +let subscriber; // Subscriber object successfully created. + +subscriber.getCode().then((code) => { + console.info("getCode " + JSON.stringify(code)); +}).catch((err) => { + console.error(`getCode failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## setCode + +```ts +setCode(code: number, callback: AsyncCallback): void +``` + +Sets the code for this common event. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Notification.CommonEvent + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | -------------------- | ---- | ---------------------- | +| code | number | Yes | Common event code. | +| callback | AsyncCallback\ | Yes | Callback used to return the result.| + +**Example** + +```ts +let subscriber; // Subscriber object successfully created. + +// Callback for result code setting of an ordered common event. +function setCodeCB(err) { + if (err.code) { + console.error(`setCode failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("setCode"); + } +} +subscriber.setCode(1, setCodeCB); +``` + +## setCode + +```ts +setCode(code: number): Promise +``` + +Sets the code for this common event. This API uses a promise to return the result. + +**System capability**: SystemCapability.Notification.CommonEvent + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ------------------ | +| code | number | Yes | Common event code.| + +**Return value** + +| Type | Description | +| ---------------- | -------------------- | +| Promise\ | Promise used to return the result.| + +**Example** + +```ts +let subscriber; // Subscriber object successfully created. + +subscriber.setCode(1).then(() => { + console.info("setCode"); +}).catch((err) => { + console.error(`setCode failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## getData + +```ts +getData(callback: AsyncCallback): void +``` + +Obtains the data of this common event. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Notification.CommonEvent + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------- | ---- | -------------------- | +| callback | AsyncCallback\ | Yes | Common event data.| + +**Example** + +```ts +let subscriber; // Subscriber object successfully created. + +// Callback for result data obtaining of an ordered common event. +function getDataCB(err, data) { + if (err.code) { + console.error(`getData failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("getData " + JSON.stringify(data)); + } +} +subscriber.getData(getDataCB); +``` + +## getData + +```ts +getData(): Promise +``` + +Obtains the data of this common event. This API uses a promise to return the result. + +**System capability**: SystemCapability.Notification.CommonEvent + +**Return value** + +| Type | Description | +| ---------------- | ------------------ | +| Promise\ | Common event data.| + +**Example** + +```ts +let subscriber; // Subscriber object successfully created. + +subscriber.getData().then((data) => { + console.info("getData " + JSON.stringify(data)); +}).catch((err) => { + console.error(`getData failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## setData + +setData(data: string, callback: AsyncCallback\): void + +Sets the data for this common event. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Notification.CommonEvent + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | -------------------- | ---- | -------------------- | +| data | string | Yes | Common event data. | +| callback | AsyncCallback\ | Yes | Callback used to return the result.| + +**Example** + +```ts +let subscriber; // Subscriber object successfully created. + +// Callback for result data setting of an ordered common event +function setDataCB(err) { + if (err.code) { + console.error(`setCode failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("setData"); + } +} +subscriber.setData("publish_data_changed", setDataCB); +``` + +## setData + +```ts +setData(data: string): Promise +``` + +Sets the data for this common event. This API uses a promise to return the result. + +**System capability**: SystemCapability.Notification.CommonEvent + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | -------------------- | +| data | string | Yes | Common event data.| + +**Return value** + +| Type | Description | +| ---------------- | -------------------- | +| Promise\ | Promise used to return the result.| + +**Example** + +```ts +let subscriber; // Subscriber object successfully created. + +subscriber.setData("publish_data_changed").then(() => { + console.info("setData"); +}).catch((err) => { + console.error(`setCode failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## setCodeAndData + +```ts +setCodeAndData(code: number, data: string, callback:AsyncCallback): void +``` + +Sets the code and data for this common event. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Notification.CommonEvent + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | -------------------- | ---- | ---------------------- | +| code | number | Yes | Common event code. | +| data | string | Yes | Common event data. | +| callback | AsyncCallback\ | Yes | Callback used to return the result.| + +**Example** + +```ts +let subscriber; // Subscriber object successfully created. + +// Callback for code and data setting of an ordered common event. +function setCodeDataCB(err) { + if (err.code) { + console.error(`setCodeAndData failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("setCodeDataCallback"); + } +} +subscriber.setCodeAndData(1, "publish_data_changed", setCodeDataCB); +``` + +## setCodeAndData + +```ts +setCodeAndData(code: number, data: string): Promise +``` + +Sets the code and data for this common event. This API uses a promise to return the result. + +**System capability**: SystemCapability.Notification.CommonEvent + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | -------------------- | +| code | number | Yes | Common event code.| +| data | string | Yes | Common event data.| + +**Return value** + +| Type | Description | +| ---------------- | -------------------- | +| Promise\ | Promise used to return the result.| + +**Example** + +```ts +let subscriber; // Subscriber object successfully created. + +subscriber.setCodeAndData(1, "publish_data_changed").then(() => { + console.info("setCodeAndData"); +}).catch((err) => { + console.error(`setCodeAndData failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## isOrderedCommonEvent + +```ts +isOrderedCommonEvent(callback: AsyncCallback): void +``` + +Checks whether this common event is an ordered one. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Notification.CommonEvent + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ----------------------- | ---- | ---------------------------------- | +| callback | AsyncCallback\ | Yes | Returns **true** if the common event is an ordered one; returns **false** otherwise.| + +**Example** + +```ts +let subscriber; // Subscriber object successfully created. + +// Callback for checking whether the current common event is an ordered one. +function isOrderedCB(err, isOrdered) { + if (err.code) { + console.error(`isOrderedCommonEvent failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("isOrdered " + JSON.stringify(isOrdered)); + } +} +subscriber.isOrderedCommonEvent(isOrderedCB); +``` + +## isOrderedCommonEvent + +```ts +isOrderedCommonEvent(): Promise +``` + +Checks whether this common event is an ordered one. This API uses a promise to return the result. + +**System capability**: SystemCapability.Notification.CommonEvent + +**Return value** + +| Type | Description | +| ----------------- | -------------------------------- | +| Promise\ | Returns **true** if the common event is an ordered one; returns **false** otherwise.| + +**Example** + +```ts +let subscriber; // Subscriber object successfully created. + +subscriber.isOrderedCommonEvent().then((isOrdered) => { + console.info("isOrdered " + JSON.stringify(isOrdered)); +}).catch((err) => { + console.error(`isOrdered failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## isStickyCommonEvent + +```ts +isStickyCommonEvent(callback: AsyncCallback): void +``` + +Checks whether this common event is a sticky one. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Notification.CommonEvent + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ----------------------- | ---- | ---------------------------------- | +| callback | AsyncCallback\ | Yes | Returns **true** if the common event is a sticky one; returns **false** otherwise.| + +**Example** + +```ts +let subscriber; // Subscriber object successfully created. + +// Callback for checking whether the current common event is a sticky one. +function isStickyCB(err, isSticky) { + if (err.code) { + console.error(`isStickyCommonEvent failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("isSticky " + JSON.stringify(isSticky)); + } +} +subscriber.isStickyCommonEvent(isStickyCB); +``` + +## isStickyCommonEvent + +```ts +isStickyCommonEvent(): Promise +``` + +Checks whether this common event is a sticky one. This API uses a promise to return the result. + +**System capability**: SystemCapability.Notification.CommonEvent + +**Return value** + +| Type | Description | +| ----------------- | -------------------------------- | +| Promise\ | Returns **true** if the common event is a sticky one; returns **false** otherwise.| + +**Example** + +```ts +let subscriber; // Subscriber object successfully created. + +subscriber.isStickyCommonEvent().then((isSticky) => { + console.info("isSticky " + JSON.stringify(isSticky)); +}).catch((err) => { + console.error(`isSticky failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## abortCommonEvent + +```ts +abortCommonEvent(callback: AsyncCallback): void +``` + +Aborts this common event. After the abort, the common event is not sent to the next subscriber. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Notification.CommonEvent + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | -------------------- | ---- | -------------------- | +| callback | AsyncCallback\ | Yes | Callback used to return the result.| + +**Example** + +```ts +let subscriber; // Subscriber object successfully created. + +// Callback for common event aborting. +function abortCB(err) { + if (err.code) { + console.error(`abortCommonEvent failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("abortCommonEvent"); + } +} +subscriber.abortCommonEvent(abortCB); +``` + +## abortCommonEvent + +```ts +abortCommonEvent(): Promise +``` + +Aborts this common event. After the abort, the common event is not sent to the next subscriber. This API takes effect only for ordered common events. It uses a promise to return the result. + +**System capability**: SystemCapability.Notification.CommonEvent + +**Return value** + +| Type | Description | +| ---------------- | -------------------- | +| Promise\ | Promise used to return the result.| + +**Example** + +```ts +let subscriber; // Subscriber object successfully created. + +subscriber.abortCommonEvent().then(() => { + console.info("abortCommonEvent"); +}).catch((err) => { + console.error(`abortCommonEvent failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## clearAbortCommonEvent + +```ts +clearAbortCommonEvent(callback: AsyncCallback): void +``` + +Clears the aborted state of this common event. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Notification.CommonEvent + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | -------------------- | ---- | -------------------- | +| callback | AsyncCallback\ | Yes | Callback used to return the result.| + +**Example** + +```ts +let subscriber; // Subscriber object successfully created. + +// Callback for clearing the aborted state of the current common event. +function clearAbortCB(err) { + if (err.code) { + console.error(`clearAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("clearAbortCommonEvent"); + } +} +subscriber.clearAbortCommonEvent(clearAbortCB); +``` + +## clearAbortCommonEvent + +```ts +clearAbortCommonEvent(): Promise +``` + +Clears the aborted state of this common event. This API takes effect only for ordered common events. It uses a promise to return the result. + +**System capability**: SystemCapability.Notification.CommonEvent + +**Return value** + +| Type | Description | +| ---------------- | -------------------- | +| Promise\ | Promise used to return the result.| + +**Example** + +```ts +let subscriber; // Subscriber object successfully created. + +subscriber.clearAbortCommonEvent().then(() => { + console.info("clearAbortCommonEvent"); +}).catch((err) => { + console.error(`clearAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## getAbortCommonEvent + +```ts +getAbortCommonEvent(callback: AsyncCallback): void +``` + +Checks whether this common event is in the aborted state. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Notification.CommonEvent + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ----------------------- | ---- | ---------------------------------- | +| callback | AsyncCallback\ | Yes | Returns **true** if the ordered common event is in the aborted state; returns **false** otherwise.| + +**Example** + +```ts +let subscriber; // Subscriber object successfully created. + +// Callback for checking whether the current common event is in the aborted state. +function getAbortCB(err, abortEvent) { + if (err.code) { + console.error(`getAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("abortCommonEvent " + abortEvent) + } +} +subscriber.getAbortCommonEvent(getAbortCB); +``` + +## getAbortCommonEvent + +```ts +getAbortCommonEvent(): Promise +``` + +Checks whether this common event is in the aborted state. This API takes effect only for ordered common events. It uses a promise to return the result. + +**System capability**: SystemCapability.Notification.CommonEvent + +**Return value** + +| Type | Description | +| ----------------- | ---------------------------------- | +| Promise\ | Returns **true** if the ordered common event is in the aborted state; returns **false** otherwise.| + +**Example** + +```ts +let subscriber; // Subscriber object successfully created. + +subscriber.getAbortCommonEvent().then((abortEvent) => { + console.info("abortCommonEvent " + JSON.stringify(abortEvent)); +}).catch((err) => { + console.error(`getAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## getSubscribeInfo + +```ts +getSubscribeInfo(callback: AsyncCallback): void +``` + +Obtains the subscriber information. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Notification.CommonEvent + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------------------ | ---- | ---------------------- | +| callback | AsyncCallback\<[CommonEventSubscribeInfo](./js-apis-inner-commonEvent-commonEventSubscribeInfo.md)> | Yes | Callback used to return the subscriber information.| + +**Example** + +```ts +let subscriber; // Subscriber object successfully created. + +// Callback for subscriber information obtaining. +function getCB(err, subscribeInfo) { + if (err.code) { + console.error(`getSubscribeInfo failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("subscribeInfo " + JSON.stringify(subscribeInfo)); + } +} +subscriber.getSubscribeInfo(getCB); +``` + +## getSubscribeInfo + +```ts +getSubscribeInfo(): Promise +``` + +Obtains the subscriber information. This API uses a promise to return the result. + +**System capability**: SystemCapability.Notification.CommonEvent + +**Return value** + +| Type | Description | +| ------------------------------------------------------------ | ---------------------- | +| Promise\<[CommonEventSubscribeInfo](./js-apis-inner-commonEvent-commonEventSubscribeInfo.md)> | Promise used to return the subscriber information.| + +**Example** + +```ts +let subscriber; // Subscriber object successfully created. + +subscriber.getSubscribeInfo().then((subscribeInfo) => { + console.info("subscribeInfo " + JSON.stringify(subscribeInfo)); +}).catch((err) => { + console.error(`getSubscribeInfo failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## finishCommonEvent9+ + +```ts +finishCommonEvent(callback: AsyncCallback): void +``` + +Finishes this common event. This API takes effect only for ordered common events. It uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Notification.CommonEvent + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | -------------------- | ---- | -------------------------------- | +| callback | AsyncCallback\ | Yes | Callback returned after the ordered common event is finished.| + +**Example** + +```ts +let subscriber; // Subscriber object successfully created. + +// Callback for ordered common event finishing. +function finishCB(err) { + if (err.code) { + console.error(`finishCommonEvent failed, code is ${err.code}, message is ${err.message}`); +} else { + console.info("FinishCommonEvent"); +} + +subscriber.finishCommonEvent(finishCB); +``` + +## finishCommonEvent9+ + +```ts +finishCommonEvent(): Promise +``` + +Finishes this common event. This API takes effect only for ordered common events. It uses a promise to return the result. + +**System capability**: SystemCapability.Notification.CommonEvent + +**Return value** + +| Type | Description | +| ---------------- | -------------------- | +| Promise\ | Promise used to return the result.| + +**Example** + +```ts +let subscriber; // Subscriber object successfully created. + +subscriber.finishCommonEvent().then(() => { + console.info("FinishCommonEvent"); +}).catch((err) => { + console.error(`finishCommonEvent failed, code is ${err.code}, message is ${err.message}`); +}); +``` diff --git a/en/application-dev/reference/apis/js-apis-inner-notification-notificationActionButton.md b/en/application-dev/reference/apis/js-apis-inner-notification-notificationActionButton.md new file mode 100644 index 0000000000000000000000000000000000000000..88e58e4bea766398e24ae1870c061e0dc385953a --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-inner-notification-notificationActionButton.md @@ -0,0 +1,16 @@ +# NotificationActionButton + +The **NotificationActionButton** module describes the button displayed in the notification. + +> **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. + +**System capability**: SystemCapability.Notification.Notification + +| Name | Type | Readable| Writable| Description | +| --------- | ----------------------------------------------- | --- | ---- | ------------------------- | +| title | string | Yes | Yes | Button title. | +| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes | Yes | **WantAgent** of the button.| +| extras | { [key: string]: any } | Yes | Yes | Extra information of the button. | +| userInput8+ | [NotificationUserInput](js-apis-inner-notification-notificationUserInput.md) | Yes | Yes | User input object. | diff --git a/en/application-dev/reference/apis/js-apis-inner-notification-notificationCommonDef.md b/en/application-dev/reference/apis/js-apis-inner-notification-notificationCommonDef.md new file mode 100644 index 0000000000000000000000000000000000000000..dcd2a4ce8de27431ea343b27bb933d829fcad74c --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-inner-notification-notificationCommonDef.md @@ -0,0 +1,16 @@ +# NotificationCommonDef + +> **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. + +## BundleOption + +Provides the bundle information of an application. + +**System capability**: SystemCapability.Notification.Notification + +| Name | Type | Mandatory| Description | +| ------ | ------ |---- | ------ | +| bundle | string | Yes| Bundle information of the application.| +| uid | number | No| User ID.| diff --git a/en/application-dev/reference/apis/js-apis-inner-notification-notificationContent.md b/en/application-dev/reference/apis/js-apis-inner-notification-notificationContent.md new file mode 100644 index 0000000000000000000000000000000000000000..7c2b3a78da9b2c22c7ae9967552655f6e70a6c8c --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-inner-notification-notificationContent.md @@ -0,0 +1,77 @@ +# NotificationContent + +The **NotificationContent** module describes the notification content. + +> **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. + +**System capability**: SystemCapability.Notification.Notification + +| Name | Type | Readable| Writable| Description | +| ----------- | ------------------------------------------------------------ | ---- | --- | ------------------ | +| contentType | [ContentType](./js-apis-notificationManager.md#contenttype) | Yes | Yes | Notification content type. | +| normal | [NotificationBasicContent](#notificationbasiccontent) | Yes | Yes | Normal text. | +| longText | [NotificationLongTextContent](#notificationlongtextcontent) | Yes | Yes | Long text.| +| multiLine | [NotificationMultiLineContent](#notificationmultilinecontent) | Yes | Yes | Multi-line text. | +| picture | [NotificationPictureContent](#notificationpicturecontent) | Yes | Yes | Picture-attached. | + +## NotificationBasicContent + +Describes the normal text notification. + +**System capability**: SystemCapability.Notification.Notification + +| Name | Type | Readable| Writable| Description | +| -------------- | ------ | ---- | ---- | ---------------------------------- | +| title | string | Yes | Yes | Notification title. | +| text | string | Yes | Yes | Notification content. | +| additionalText | string | Yes | Yes | Additional information of the notification.| + + +## NotificationLongTextContent + +Describes the long text notification. + +**System capability**: SystemCapability.Notification.Notification + +| Name | Type | Readable| Writable| Description | +| -------------- | ------ | ---- | --- | -------------------------------- | +| title | string | Yes | Yes | Notification title. | +| text | string | Yes | Yes | Notification content. | +| additionalText | string | Yes | Yes | Additional information of the notification.| +| longText | string | Yes | Yes | Long text of the notification. | +| briefText | string | Yes | Yes | Brief text of the notification.| +| expandedTitle | string | Yes | Yes | Title of the notification in the expanded state. | + + +## NotificationMultiLineContent + +Describes the multi-line text notification. + +**System capability**: SystemCapability.Notification.Notification + +| Name | Type | Readable| Writable| Description | +| -------------- | --------------- | --- | --- | -------------------------------- | +| title | string | Yes | Yes | Notification title. | +| text | string | Yes | Yes | Notification content. | +| additionalText | string | Yes | Yes | Additional information of the notification.| +| briefText | string | Yes | Yes | Brief text of the notification.| +| longTitle | string | Yes | Yes | Title of the notification in the expanded state. | +| lines | Array\ | Yes | Yes | Multi-line text of the notification. | + + +## NotificationPictureContent + +Describes the picture-attached notification. + +**System capability**: SystemCapability.Notification.Notification + +| Name | Type | Readable| Writable| Description | +| -------------- | -------------- | ---- | --- | -------------------------------- | +| title | string | Yes | Yes | Notification title. | +| text | string | Yes | Yes | Notification content. | +| additionalText | string | Yes | Yes | Additional information of the notification.| +| briefText | string | Yes | Yes | Brief text of the notification.| +| expandedTitle | string | Yes | Yes | Title of the notification in the expanded state. | +| picture | [image.PixelMap](js-apis-image.md#pixelmap7) | Yes | Yes | Picture attached to the notification. | diff --git a/en/application-dev/reference/apis/js-apis-inner-notification-notificationFlags.md b/en/application-dev/reference/apis/js-apis-inner-notification-notificationFlags.md new file mode 100644 index 0000000000000000000000000000000000000000..f7e1a995b51bcc193e2cd21115eb8e934233eec5 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-inner-notification-notificationFlags.md @@ -0,0 +1,29 @@ +# NotificationFlags + +The **NotificationFlags** module implements a **NotificationFlags** instance. + +> **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. + +**System capability**: SystemCapability.Notification.Notification + +| Name | Type | Readable| Writable| Description | +| ---------------- | ---------------------- | ---- | ---- | --------------------------------- | +| soundEnabled | [NotificationFlagStatus](#notificationflagstatus) | Yes | No | Whether to enable the sound alert for the notification. | +| vibrationEnabled | [NotificationFlagStatus](#notificationflagstatus) | Yes | No | Whether to enable vibration for the notification. | + + +## NotificationFlagStatus + +Describes the notification flag status. + +**System capability**: SystemCapability.Notification.Notification + +**System API**: This is a system API and cannot be called by third-party applications. + +| Name | Value | Description | +| -------------- | --- | --------------------------------- | +| TYPE_NONE | 0 | The default flag is used. | +| TYPE_OPEN | 1 | The notification flag is enabled. | +| TYPE_CLOSE | 2 | The notification flag is disabled. | diff --git a/en/application-dev/reference/apis/js-apis-inner-notification-notificationRequest.md b/en/application-dev/reference/apis/js-apis-inner-notification-notificationRequest.md new file mode 100644 index 0000000000000000000000000000000000000000..205a6c04bdf7fff97c80e44b882fb487712e2c01 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-inner-notification-notificationRequest.md @@ -0,0 +1,63 @@ +# NotificationRequest + +The **NotificationRequest** module describes the notification request. + +> **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. + +**System capability**: SystemCapability.Notification.Notification + +| Name | Type | Readable| Writable| Description | +| --------------------- | --------------------------------------------- | ---- | --- | -------------------------- | +| content | [NotificationContent](js-apis-inner-notification-notificationContent.md#notificationcontent) | Yes | Yes | Notification content. | +| id | number | Yes | Yes | Notification ID. | +| slotType | [SlotType](js-apis-notificationManager.md#slottype) | Yes | Yes | Notification slot type. | +| isOngoing | boolean | Yes | Yes | Whether the notification is an ongoing notification. | +| isUnremovable | boolean | Yes | Yes | Whether the notification can be removed. | +| deliveryTime | number | Yes | Yes | Time when the notification is sent. | +| tapDismissed | boolean | Yes | Yes | Whether the notification is automatically cleared. | +| autoDeletedTime | number | Yes | Yes | Time when the notification is automatically cleared. | +| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes | Yes | **WantAgent** instance to which the notification will be redirected after being clicked.| +| extraInfo | {[key: string]: any} | Yes | Yes | Extended parameters. | +| color | number | Yes | Yes | Background color of the notification. Not supported currently.| +| colorEnabled | boolean | Yes | Yes | Whether the notification background color can be enabled. Not supported currently.| +| isAlertOnce | boolean | Yes | Yes | Whether the notification triggers an alert only once.| +| isStopwatch | boolean | Yes | Yes | Whether to display the stopwatch. | +| isCountDown | boolean | Yes | Yes | Whether to display the countdown time. | +| isFloatingIcon | boolean | Yes | Yes | Whether the notification is displayed as a floating icon in the status bar. | +| label | string | Yes | Yes | Notification label. | +| badgeIconStyle | number | Yes | Yes | Notification badge type. | +| showDeliveryTime | boolean | Yes | Yes | Whether to display the time when the notification is delivered. | +| actionButtons | Array\<[NotificationActionButton](js-apis-inner-notification-notificationActionButton.md)\> | Yes | Yes | Buttons in the notification. Up to three buttons are allowed. | +| smallIcon | [image.PixelMap](js-apis-image.md#pixelmap7) | Yes | Yes | Small notification icon. This field is optional, and the icon size cannot exceed 30 KB.| +| largeIcon | [image.PixelMap](js-apis-image.md#pixelmap7) | Yes | Yes | Large notification icon. This field is optional, and the icon size cannot exceed 30 KB.| +| creatorBundleName | string | Yes | No | Name of the bundle that creates the notification. | +| creatorUid8+ | number | Yes | No | UID used for creating the notification. | +| creatorPid | number | Yes | No | PID used for creating the notification. | +| creatorUserId| number | Yes | No | ID of the user who creates the notification. | +| hashCode | string | Yes | No | Unique ID of the notification. | +| classification | string | Yes | Yes | Notification category.
**System API**: This is a system API and cannot be called by third-party applications. | +| groupName8+ | string | Yes | Yes | Notification group name. | +| template8+ | [NotificationTemplate](./js-apis-inner-notification-notificationTemplate.md) | Yes | Yes | Notification template. | +| isRemoveAllowed8+ | boolean | Yes | No | Whether the notification can be removed.
**System API**: This is a system API and cannot be called by third-party applications. | +| source8+ | number | Yes | No | Notification source.
**System API**: This is a system API and cannot be called by third-party applications. | +| distributedOption8+ | [DistributedOptions](#distributedoptions) | Yes | Yes | Distributed notification options. | +| deviceId8+ | string | Yes | No | Device ID of the notification source.
**System API**: This is a system API and cannot be called by third-party applications. | +| notificationFlags8+ | [NotificationFlags](js-apis-inner-notification-notificationflags#notificationFlags) | Yes | No | Notification flags. | +| removalWantAgent9+ | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes | Yes | **WantAgent** instance to which the notification will be redirected when it is removed. | +| badgeNumber9+ | number | Yes | Yes | Number of notifications displayed on the application icon. | + + +## DistributedOptions + +Describes distributed notification options. + +**System capability**: SystemCapability.Notification.Notification + +| Name | Type | Readable| Writable| Description | +| ---------------------- | -------------- | ---- | ---- | ---------------------------------- | +| isDistributed8+ | boolean | Yes | Yes | Whether the notification is a distributed notification. | +| supportDisplayDevices8+ | Array\ | Yes | Yes | List of the devices to which the notification can be synchronized. | +| supportOperateDevices8+ | Array\ | Yes | Yes | List of the devices on which the notification can be opened. | +| remindType8+ | number | Yes | No | Notification reminder type.
**System API**: This is a system API and cannot be called by third-party applications. | diff --git a/en/application-dev/reference/apis/js-apis-inner-notification-notificationSlot.md b/en/application-dev/reference/apis/js-apis-inner-notification-notificationSlot.md new file mode 100644 index 0000000000000000000000000000000000000000..8bf9e286d59504be03ff8454d59ce60c31a9a597 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-inner-notification-notificationSlot.md @@ -0,0 +1,24 @@ +# NotificationSlot + +The **NotificationSlot** module describes the notification slot. + +> **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. + +**System capability**: SystemCapability.Notification.Notification + +| Name | Type | Readable| Writable| Description | +| -------------------- | --------------------- | ---- | --- | ------------------------------------------ | +| type | [SlotType](js-apis-notificationManager.md#slottype) | Yes | Yes | Notification slot type. | +| level | number | Yes | Yes | Notification level. If this parameter is not set, the default value that corresponds to the notification slot type is used.| +| desc | string | Yes | Yes | Notification slot description. | +| badgeFlag | boolean | Yes | Yes | Whether to display the badge. | +| bypassDnd | boolean | Yes | Yes | Whether to bypass DND mode in the system. | +| lockscreenVisibility | number | Yes | Yes | Mode for displaying the notification on the lock screen. | +| vibrationEnabled | boolean | Yes | Yes | Whether to enable vibration for the notification. | +| sound | string | Yes | Yes | Notification alert tone. | +| lightEnabled | boolean | Yes | Yes | Whether the indicator blinks for the notification. | +| lightColor | number | Yes | Yes | Indicator color of the notification. | +| vibrationValues | Array\ | Yes | Yes | Vibration mode of the notification. | +| enabled9+ | boolean | Yes | No | Whether the notification slot is enabled. | diff --git a/en/application-dev/reference/apis/js-apis-inner-notification-notificationTemplate.md b/en/application-dev/reference/apis/js-apis-inner-notification-notificationTemplate.md new file mode 100644 index 0000000000000000000000000000000000000000..557fad664de00eb37567cb2d055c0c0ec2f8d484 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-inner-notification-notificationTemplate.md @@ -0,0 +1,14 @@ +# NotificationTemplate + +The **NotificationTemplate** module describes the notification template. + +> **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. + +**System capability**: SystemCapability.Notification.Notification + +| Name| Type | Readable| Writable| Description | +| ---- | ---------------------- | ---- | ---- | ---------- | +| name | string | Yes | Yes | Template name.| +| data | {[key:string]: Object} | Yes | Yes | Template data.| diff --git a/en/application-dev/reference/apis/js-apis-inner-notification-notificationUserInput.md b/en/application-dev/reference/apis/js-apis-inner-notification-notificationUserInput.md new file mode 100644 index 0000000000000000000000000000000000000000..76e673c886d4208354b680501c6ddbb0000e6438 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-inner-notification-notificationUserInput.md @@ -0,0 +1,13 @@ +# NotificationUserInput + +The **NotificationUserInput** module provides the notification user input. + +> **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. + +**System capability**: SystemCapability.Notification.Notification + +| Name | Type | Readable| Writable| Description | +| -------- | ------ | --- | ---- | ----------------------------- | +| inputKey | string | Yes | Yes | Key to identify the user input.| diff --git a/en/application-dev/reference/apis/js-apis-inputdevice.md b/en/application-dev/reference/apis/js-apis-inputdevice.md index c131d9bbd3e50790624d4eca0ea41c94d7022dd2..c0d5352efa43ffe6e98a4bd911a5e89d4beba3ca 100644 --- a/en/application-dev/reference/apis/js-apis-inputdevice.md +++ b/en/application-dev/reference/apis/js-apis-inputdevice.md @@ -31,7 +31,7 @@ try { inputDevice.getDeviceIds((error, ids) => { if (error) { console.log(`Failed to get device list. - error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`); + error code=${err.code} msg=${err.message}`); return; } this.data = ids; @@ -91,7 +91,7 @@ try { inputDevice.getDeviceInfo(1, (error, inputDevice) => { if (error) { console.log(`Failed to get device information. - error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`); + error code=${err.code} msg=${err.message}`); return; } console.log("The device name is: " + inputDevice.name); @@ -421,7 +421,7 @@ try { inputDevice.getKeyboardType(1, (error, number) => { if (error) { console.log(`Failed to get keyboardtype. - error code=${JSON.stringify(err.code)} msg=${JSON.stringify(err.message)}`); + error code=${err.code} msg=${err.message}`); return; } console.log("The keyboard type of the device is: " + number); diff --git a/en/application-dev/reference/apis/js-apis-inputmethod-extension-context.md b/en/application-dev/reference/apis/js-apis-inputmethod-extension-context.md index 37dadd8e2ce6cd3e7c2f33ab05154f20b52cf844..d9d1bb857067e3f9482f564968e8107dc13db010 100644 --- a/en/application-dev/reference/apis/js-apis-inputmethod-extension-context.md +++ b/en/application-dev/reference/apis/js-apis-inputmethod-extension-context.md @@ -51,7 +51,7 @@ this.context.destroy((err) => { ## InputMethodExtensionContext.destroy -destroy(): Promise; Terminates this ability. This API uses a promise to return the result. @@ -61,13 +61,13 @@ Terminates this ability. This API uses a promise to return the result. | Type| Description| | -------- | -------- | -| Promise; | Promise that returns no value.| **Example** ```js this.context.destroy().then(() => { - console.log('Succeed in destroying context.'); + console.log('Succeeded in destroying context.'); }).catch((error) => { console.log('Failed to destroy context: ' + JSON.stringify(error)); }); diff --git a/en/application-dev/reference/apis/js-apis-inputmethod-subtype.md b/en/application-dev/reference/apis/js-apis-inputmethod-subtype.md index 8f1a3fddc9344bcf5d04a526b5c70a77837e29d0..14a5ed2b9a6fee26af15baabfeb07470e9a0f658 100644 --- a/en/application-dev/reference/apis/js-apis-inputmethod-subtype.md +++ b/en/application-dev/reference/apis/js-apis-inputmethod-subtype.md @@ -14,16 +14,19 @@ import InputMethodSubtype from '@ohos.InputMethodSubtype'; ## Attributes - **System capability**: SystemCapability.MiscServices.InputMethodFramework + + +**System capability**: SystemCapability.MiscServices.InputMethodFramework | Name| Type| Readable| Writable| Mandatory| Description| | -------- | -------- | -------- | -------- | -------- | -------- | | label | string | Yes| No| No| Label of the input method subtype.| -| name | string | Yes| No| Yes| Name of the input method subtype.| +| labelId10+ | string | Yes| No| No| Label ID of the input method subtype.| +| name | string | Yes| No| Yes| Bundle name of the input method.| | id | string | Yes| No| Yes| ID of the input method subtype.| | mode | string | Yes| No| No| Mode of the input method subtype, including **upper** (uppercase) and **lower** (lowercase).| | locale | string | Yes| No| Yes| Locale of the input method subtype.| | language | string | Yes| No| Yes| Language of the input method subtype.| | icon | string | Yes| No| No| Icon of the input method subtype.| | iconId | number | Yes| No| No| Icon ID of the input method subtype.| -| extra | object | Yes| Yes| Yes| Extra information of the input method subtype.| +| extra | object | Yes| Yes| No| Extra information of the input method subtype.
**NOTE**
This parameter is optional since API version 10.| diff --git a/en/application-dev/reference/apis/js-apis-inputmethod.md b/en/application-dev/reference/apis/js-apis-inputmethod.md index be7f5edb92e6b7345a69551ce269fa197c524f24..f6f1cf9ca6cf7a77d9e55c7ce329d81cbef1dc7f 100644 --- a/en/application-dev/reference/apis/js-apis-inputmethod.md +++ b/en/application-dev/reference/apis/js-apis-inputmethod.md @@ -1,6 +1,6 @@ # @ohos.inputMethod (Input Method Framework) -The **inputMethod** module provides an input method framework, which can be used to hide the keyboard, obtain the list of installed input methods, display the dialog box for input method selection, and more. +The **inputMethod** module is oriented to common foreground applications (third-party applications and system applications such as Notes, Messaging, and Settings). It provides input method control and management capabilities, including displaying or hiding the soft keyboard, switching between input methods, and obtaining the list of all input methods. > **NOTE** > @@ -33,10 +33,11 @@ Describes the input method application attributes. | -------- | -------- | -------- | -------- | -------- | | name9+ | string | Yes| No| Internal name of the input method. Mandatory.| | id9+ | string | Yes| No| Unique ID of the input method. Mandatory.| -| label9+ | string | Yes| No| External display name of the input method. Optional.| +| label9+ | string | Yes| No| External name of the input method. Optional.| +| labelId10+ | string | Yes| No| External ID of the input method. Optional.| | icon9+ | string | Yes| No| Icon of the input method. Optional.| | iconId9+ | number | Yes| No| Icon ID of the input method. Optional.| -| extra9+ | object | Yes| Yes| Extra information about the input method. Mandatory.| +| extra9+ | object | Yes| Yes| Extra information about the input method. Optional.
**NOTE**
This parameter is optional since API version 10.| | packageName(deprecated) | string | Yes| No| Name of the input method package. Mandatory.
**NOTE**
This API is supported since API version 8 and deprecated since API version 9. You are advised to use **name**.| | methodId(deprecated) | string | Yes| No| Unique ID of the input method. Mandatory.
**NOTE**
This API is supported since API version 8 and deprecated since API version 9. You are advised to use **id**.| @@ -231,7 +232,7 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallb Switches to another subtype of the current input method. This API uses an asynchronous callback to return the result. -**Required permissions**: ohos.permission.CONNECT_IME_ABILITY (available only to system applications) +**Required permissions**: ohos.permission.CONNECT_IME_ABILITY (available only to system applications)
**NOTE**
Since API version 10, this permission is not required if the caller is the current input method. **System capability**: SystemCapability.MiscServices.InputMethodFramework @@ -239,7 +240,7 @@ Switches to another subtype of the current input method. This API uses an asynch | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| target | [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)| Yes| Input method subtype to switch to.| +| target | [InputMethodSubtype](./js-apis-inputmethod-subtype.md)| Yes| Input method subtype to switch to.| | callback | AsyncCallback<boolean> | Yes| Callback used to return the result. If the operation is successful, **err** is **undefined** and **data** is **true**. Otherwise, **err** is an error object.| **Error codes** @@ -256,9 +257,9 @@ For details about the error codes, see [Input Method Framework Error Codes](../e ```js try { inputMethod.switchCurrentInputMethodSubtype({ - id: "com.example.kikakeyboard", - label: "ServiceExtAbility", - name: "", + id: "ServiceExtAbility", + label: "", + name: "com.example.kikakeyboard", mode: "upper", locale: "", language: "", @@ -287,7 +288,7 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise<boolean& Switches to another subtype of the current input method. This API uses a promise to return the result. -**Required permissions**: ohos.permission.CONNECT_IME_ABILITY (available only to system applications) +**Required permissions**: ohos.permission.CONNECT_IME_ABILITY (available only to system applications)
**NOTE**
Since API version 10, this permission is not required if the caller is the current input method. **System capability**: SystemCapability.MiscServices.InputMethodFramework @@ -295,7 +296,7 @@ Switches to another subtype of the current input method. This API uses a promise | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -|target | [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)| Yes| Input method subtype to switch to.| +|target | [InputMethodSubtype](./js-apis-inputmethod-subtype.md)| Yes| Input method subtype to switch to.| **Return value** @@ -317,9 +318,9 @@ For details about the error codes, see [Input Method Framework Error Codes](../e ```js try { inputMethod.switchCurrentInputMethodSubtype({ - id: "com.example.kikakeyboard", - label: "ServiceExtAbility", - name: "", + id: "ServiceExtAbility", + label: "", + name: "com.example.kikakeyboard", mode: "upper", locale: "", language: "", @@ -352,7 +353,7 @@ Obtains the current input method subtype. | Type | Description | | -------------------------------------------- | ------------------------ | -| [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype) | Current input method subtype.| +| [InputMethodSubtype](./js-apis-inputmethod-subtype.md) | Current input method subtype.| **Example** @@ -375,7 +376,7 @@ Switches to a specified subtype of a specified input method. This API uses an as | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | |inputMethodProperty | [InputMethodProperty](#inputmethodproperty8)| Yes| Input method to switch to.| -|inputMethodSubtype | [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)| Yes| Input method subtype to switch to.| +|inputMethodSubtype | [InputMethodSubtype](./js-apis-inputmethod-subtype.md)| Yes| Input method subtype to switch to.| | callback | AsyncCallback<boolean> | Yes| Callback used to return the result. If the operation is successful, **err** is **undefined** and **data** is **true**. Otherwise, **err** is an error object.| **Error codes** @@ -391,25 +392,9 @@ For details about the error codes, see [Input Method Framework Error Codes](../e ```js let im = inputMethod.getCurrentInputMethod(); -let inputMethodProperty = { - packageName: im.packageName, - methodId: im.methodId, - name: im.packageName, - id: im.methodId, - extra: {} -} +let imSubType = inputMethod.getCurrentInputMethodSubtype(); try { - inputMethod.switchCurrentInputMethodAndSubtype(inputMethodProperty, { - id: "com.example.kikakeyboard", - label: "ServiceExtAbility", - name: "", - mode: "upper", - locale: "", - language: "", - icon: "", - iconId: 0, - extra: {} - }, (err,result) => { + inputMethod.switchCurrentInputMethodAndSubtype(im, imSubType, (err,result) => { if (err !== undefined) { console.error('Failed to switchCurrentInputMethodAndSubtype: ' + JSON.stringify(err)); return; @@ -440,7 +425,7 @@ Switches to a specified subtype of a specified input method. This API uses a pro | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | |inputMethodProperty | [InputMethodProperty](#inputmethodproperty8)| Yes| Input method to switch to.| -|inputMethodSubtype | [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)| Yes| Input method subtype to switch to.| +|inputMethodSubtype | [InputMethodSubtype](./js-apis-inputmethod-subtype.md)| Yes| Input method subtype to switch to.| **Return value** @@ -461,25 +446,9 @@ For details about the error codes, see [Input Method Framework Error Codes](../e ```js let im = inputMethod.getCurrentInputMethod(); -let inputMethodProperty = { - packageName: im.packageName, - methodId: im.methodId, - name: im.packageName, - id: im.methodId, - extra: {} -} +let imSubType = inputMethod.getCurrentInputMethodSubtype(); try { - inputMethod.switchCurrentInputMethodAndSubtype(inputMethodProperty, { - id: im.packageName, - label: im.methodId, - name: "", - mode: "upper", - locale: "", - language: "", - icon: "", - iconId: 0, - extra: {} - }).then((result) => { + inputMethod.switchCurrentInputMethodAndSubtype(im, imSubType).then((result) => { if (result) { console.info('Succeeded in switching currentInputMethodAndSubtype.'); } else { @@ -884,9 +853,9 @@ inputMethodController.off('selectByRange'); ### on('selectByMovement')10+ -on(type: 'selectByMovement', callback: Callback<Range>): void +on(type: 'selectByMovement', callback: Callback<Movement>): void -Enables listening for the selection-by-cursor-movement event. This API uses an asynchronous callback to return the result. +Enables listening for the select-by-cursor-movement event. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.MiscServices.InputMethodFramework @@ -894,7 +863,7 @@ Enables listening for the selection-by-cursor-movement event. This API uses an a | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Listening type.
The value **selectByMovement** indicates the selection-by-cursor-movement event.| +| type | string | Yes | Listening type.
The value **selectByMovement** indicates the select-by-cursor-movement event.| | callback | Callback<[Movement](./js-apis-inputmethod-InputMethodCommon.md#movement)> | Yes | Callback used to return the range of the text to be selected.
Your application needs to select the text in the returned range in the text box.| **Example** @@ -909,7 +878,7 @@ inputMethodController.on('selectByMovement', (movement) => { off(type: 'selectByMovement'): void -Disables listening for the selection-by-cursor-movement event. +Disables listening for the select-by-cursor-movement event. **System capability**: SystemCapability.MiscServices.InputMethodFramework @@ -917,7 +886,7 @@ Disables listening for the selection-by-cursor-movement event. | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Listening type.
The value **selectByMovement** indicates the selection-by-cursor-movement event.| +| type | string | Yes | Listening type.
The value **selectByMovement** indicates the select-by-cursor-movement event.| **Example** @@ -942,7 +911,7 @@ Enables listening for the input method and subtype change event. This API uses a | Name | Type | Mandatory| Description | | -------- | ------------------------------- | ---- | ------------------------------------------------------------ | | type | string | Yes | Listening type.
The value **'imeChange'** indicates the input method and subtype change event.| -| callback | (inputMethodProperty: [InputMethodProperty](#inputmethodproperty8), inputMethodSubtype: [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)) => void | Yes| Callback used to return the input method attributes and subtype.| +| callback | (inputMethodProperty: [InputMethodProperty](#inputmethodproperty8), inputMethodSubtype: [InputMethodSubtype](./js-apis-inputmethod-subtype.md)) => void | Yes| Callback used to return the input method attributes and subtype.| **Example** @@ -965,7 +934,7 @@ Disables listening for the input method and subtype change event. This API uses | Name | Type | Mandatory| Description | | -------- | ------------------------------- | ---- | ------------------------------------------------------------ | | type | string | Yes | Listening type.
The value **'imeChange'** indicates the input method and subtype change event.| -| callback | (inputMethodProperty: [InputMethodProperty](#inputmethodproperty8), inputMethodSubtype: [InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)) => void | No| Callback used to return the input method attributes and subtype.| +| callback | (inputMethodProperty: [InputMethodProperty](#inputmethodproperty8), inputMethodSubtype: [InputMethodSubtype](./js-apis-inputmethod-subtype.md)) => void | No| Callback used to return the input method attributes and subtype.| **Example** @@ -986,7 +955,7 @@ Obtains all subtypes of a specified input method. This API uses an asynchronous | Name | Type | Mandatory| Description | | -------- | -------------------------------------------------- | ---- | ---------------------- | | inputMethodProperty | InputMethodProperty| Yes| Input method to which the subtypes belong.| -| callback | AsyncCallback<Array<[InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)>> | Yes| Callback used to return all subtypes of the specified input method.| +| callback | AsyncCallback<Array<[InputMethodSubtype](./js-apis-inputmethod-subtype.md)>> | Yes| Callback used to return all subtypes of the specified input method.| **Error codes** @@ -1038,7 +1007,7 @@ Obtains all subtypes of a specified input method. This API uses a promise to ret | Type | Description | | ----------------------------------------------------------- | ---------------------- | -| Promise> | Promise used to return all subtypes of the specified input method.| +| Promise> | Promise used to return all subtypes of the specified input method.| **Error codes** @@ -1082,7 +1051,7 @@ Obtains all subtypes of this input method. This API uses an asynchronous callbac | Name | Type | Mandatory| Description | | -------- | -------------------------------------------------- | ---- | ---------------------- | -| callback | AsyncCallback<Array<[InputMethodSubtype](./js-apis-inputmethod-subtype.md#inputmethodsubtype)>> | Yes | Callback used to return all subtypes of the current input method.| +| callback | AsyncCallback<Array<[InputMethodSubtype](./js-apis-inputmethod-subtype.md)>> | Yes | Callback used to return all subtypes of the current input method.| **Error codes** @@ -1121,7 +1090,7 @@ Obtains all subtypes of this input method. This API uses a promise to return the | Type | Description | | ----------------------------------------------------------- | ---------------------- | -| Promise> | Promise used to return all subtypes of the current input method.| +| Promise> | Promise used to return all subtypes of the current input method.| **Error codes** @@ -1235,8 +1204,6 @@ showOptionalInputMethods(callback: AsyncCallback<boolean>): void Displays a dialog box for selecting an input method. This API uses an asynchronous callback to return the result. -**Required permissions**: ohos.permission.CONNECT_IME_ABILITY (available only to system applications) - **System capability**: SystemCapability.MiscServices.InputMethodFramework **Parameters** @@ -1275,8 +1242,6 @@ showOptionalInputMethods(): Promise<boolean> Displays a dialog box for selecting an input method. This API uses a promise to return the result. -**Required permissions**: ohos.permission.CONNECT_IME_ABILITY (available only to system applications) - **System capability**: SystemCapability.MiscServices.InputMethodFramework **Return value** diff --git a/en/application-dev/reference/apis/js-apis-inputmethodengine.md b/en/application-dev/reference/apis/js-apis-inputmethodengine.md index fd98e98d1f748ef094d7dd096033fc0459e8ac8b..a2e087795857ff8a788b72826bf64f7ec1961f82 100644 --- a/en/application-dev/reference/apis/js-apis-inputmethodengine.md +++ b/en/application-dev/reference/apis/js-apis-inputmethodengine.md @@ -1,6 +1,6 @@ # @ohos.inputMethodEngine (Input Method Service) -The **inputMethodEngine** module streamlines the interactions between input methods and applications. By calling APIs of this module, applications can be bound to input method services to accept text input, request the keyboard to display or hide, listen for the input method status, and much more. +The **inputMethodEngine** module is oriented to input method applications (including system and third-party input method applications). With the APIs of this module, input method applications are able to create soft keyboard windows, insert or delete characters, select text, and listen for physical keyboard events. > **NOTE** > @@ -56,15 +56,15 @@ Provides the constant values of function keys, edit boxes, and the cursor. getInputMethodAbility(): InputMethodAbility -Obtains an **InputMethodEngine** instance. +Obtains an [InputMethodAbility](#inputmethodability) instance for the input method. The input method can use the obtained instance to subscribe to a soft keyboard display/hide request event, create/destroy an input method panel, and the like. **System capability**: SystemCapability.MiscServices.InputMethodFramework **Return value** -| Type | Description | -| --------------------------------------- | ------------ | -| [InputMethodAbility](#inputmethodability) | **InputMethodEngine** instance obtained.| +| Type | Description | +| ----------------------------------------- | ------------------ | +| [InputMethodAbility](#inputmethodability) | **InputMethodAbility** instance.| **Example** @@ -76,15 +76,15 @@ let InputMethodAbility = inputMethodEngine.getInputMethodAbility(); getKeyboardDelegate(): KeyboardDelegate -Obtains a **KeyboardDelegate** instance. +Obtains a [KeyboardDelegate](#keyboarddelegate) instance for the input method. The input method can use the obtained instance to subscribe to a physical keyboard event, text selection change event, and more. **System capability**: SystemCapability.MiscServices.InputMethodFramework **Return value** -| Type | Description | -| ------------------------------------- | ---------------- | -| [KeyboardDelegate](#keyboarddelegate) | **KeyboardDelegate** instance obtained.| +| Type | Description | +| ------------------------------------- | ------------------------ | +| [KeyboardDelegate](#keyboarddelegate) | **KeyboardDelegate** instance.| **Example** @@ -96,7 +96,7 @@ let KeyboardDelegate = inputMethodEngine.getKeyboardDelegate(); getInputMethodEngine(): InputMethodEngine -Obtains an **InputMethodEngine** instance. +Obtains an [InputMethodEngine](#inputmethodengine-1) instance for the input method. The input method can use the obtained instance to subscribe to a soft keyboard display/hide request event. > **NOTE** > @@ -106,9 +106,9 @@ Obtains an **InputMethodEngine** instance. **Return value** -| Type | Description | -| --------------------------------------- | ------------ | -| [InputMethodEngine](#inputmethodengine-1) | **InputMethodEngine** instance obtained.| +| Type | Description | +| ----------------------------------------- | ------------------ | +| [InputMethodEngine](#inputmethodengine-1) | **InputMethodAbility** instance.| **Example** @@ -120,7 +120,7 @@ let InputMethodEngine = inputMethodEngine.getInputMethodEngine(); createKeyboardDelegate(): KeyboardDelegate -Obtains a **KeyboardDelegate** instance. +Obtains a [KeyboardDelegate](#keyboarddelegate) instance for the input method. The input method can use the obtained instance to subscribe to a physical keyboard event, text selection change event, and more. > **NOTE** > @@ -130,9 +130,9 @@ Obtains a **KeyboardDelegate** instance. **Return value** -| Type | Description | -| ------------------------------------- | ---------------- | -| [KeyboardDelegate](#keyboarddelegate) | **KeyboardDelegate** instance obtained.| +| Type | Description | +| ------------------------------------- | ------------------------ | +| [KeyboardDelegate](#keyboarddelegate) | **KeyboardDelegate** instance.| **Example** @@ -157,7 +157,7 @@ Enables listening for the input method binding event. This API uses an asynchron | Name | Type | Mandatory| Description | | -------- | ------------------------------- | ---- | ------------------------------------------------------------ | | type | string | Yes | Listening type.
The value **'inputStart'** indicates the input method binding event.| -| callback | (kbController: [KeyboardController](#keyboardcontroller), textInputClient: [TextInputClient](#textinputclient)) => void | Yes| Callback used to return the **KeyboardController** and **TextInputClient** instances.| +| callback | (kbController: [KeyboardController](#keyboardcontroller), textInputClient: [TextInputClient](#textinputclientdeprecated)) => void | Yes| Callback used to return the **KeyboardController** and **TextInputClient** instances.| **Example** @@ -181,7 +181,7 @@ Cancels listening for the input method binding event. | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | ------------------------ | | type | string | Yes | Listening type.
The value **'inputStart'** indicates the input method binding event.| -| callback | (kbController: [KeyboardController](#keyboardcontroller), textInputClient: [TextInputClient](#textinputclient)) => void | No| Callback used to return the **KeyboardController** and **TextInputClient** instances.| +| callback | (kbController: [KeyboardController](#keyboardcontroller), textInputClient: [TextInputClient](#textinputclientdeprecated)) => void | No| Callback used to return the **KeyboardController** and **TextInputClient** instances.| **Example** @@ -195,7 +195,7 @@ inputMethodEngine.getInputMethodEngine().off('inputStart', (kbController, textIn on(type: 'keyboardShow'|'keyboardHide', callback: () => void): void -Enables listening for a keyboard event. This API uses an asynchronous callback to return the result. +Enables listening for a keyboard visibility event. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.MiscServices.InputMethodFramework @@ -221,7 +221,7 @@ inputMethodEngine.getInputMethodEngine().on('keyboardHide', () => { off(type: 'keyboardShow'|'keyboardHide', callback?: () => void): void -Disables listening for a keyboard event. This API uses an asynchronous callback to return the result. +Disables listening for a keyboard visibility event. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.MiscServices.InputMethodFramework @@ -478,6 +478,186 @@ inputMethodEngine.getInputMethodAbility().off('setSubtype', () => { }); ``` +### createPanel10+ + +createPanel(ctx: BaseContext, info: PanelInfo, callback: AsyncCallback\): void + +Creates an input method panel. This API can be called only by input method applications and system applications with the system_core permission. Only one SOFT_KEYBOARD panel and one STATUS_BAR panel can be created for a single input method application. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.MiscServices.InputMethodFramework + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ----------- | ---- | ------------------------ | +| ctx | [BaseContext](./js-apis-inner-application-baseContext.md) | Yes | Context of the current input method.| +| info | [PanelInfo](#panelinfo10) | Yes | Information about the input method panel.| +| callback | AsyncCallback\<[Panel](#panel10)> | Yes | Callback used to return the result. If the operation is successful, the created input method panel is returned. | + +**Error codes** + +| Error Code ID | Error Message | +| ---------- | ----------------------------- | +| 12800004 | not an input method extension | + +**Example** + +```js +let panelInfo: inputMethodEngine.PanelInfo = { + panelType: SOFT_KEYBOARD, + panelFlag: FLG_FIXED +} +try { + inputMethodEngine.getInputMethodAbility().createPanel(this.context, panelInfo, (err, panel) => { + if (err !== undefined) { + console.log('Failed to create panel, err: ' + JSON.stringify(err)); + return; + } + console.log('Succeed in creating panel.'); + }) +} catch(err) { + console.log('Failed to create panel, err: ' + JSON.stringify(err)); +} +``` + +### createPanel10+ + +createPanel(ctx: BaseContext, info: PanelInfo): Promise\ + +Creates an input method panel. This API can be called only by input method applications and system applications with the system_core permission. Only one SOFT_KEYBOARD panel and one STATUS_BAR panel can be created for a single input method application. This API uses a promise to return the result. + +**System capability**: SystemCapability.MiscServices.InputMethodFramework + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ----------- | ---- | ------------------------ | +| ctx | [BaseContext](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-inner-application-baseContext.md) | Yes | Context of the current input method.| +| info | [PanelInfo](#panelinfo10) | Yes | Information about the input method panel.| + +**Return value** +| Type | Description | +| ------- | ------------------------------------------------------------------ | +| Promise\<[Panel](#panel10)> | Promise used to return the result. If the operation is successful, the created input method panel is returned. | + +**Error codes** + +| Error Code ID | Error Message | +| ---------- | ----------------------------- | +| 12800004 | not an input method extension | + +**Example** + +```js +let panelInfo: inputMethodEngine.PanelInfo = { + panelType: SOFT_KEYBOARD, + panelFlag: FLG_FIXED +} +inputMethodEngine.getInputMethodAbility().createPanel(this.context, panelInfo).then((panel) => { + console.log('Succeed in creating panel.'); +}).catch((err) => { + console.log('Failed to create panel, err: ' + JSON.stringify(err)); +}) +``` + +### destroyPanel10+ + +destroyPanel(panel: Panel, callback: AsyncCallback\): void; + +Destroys an input method panel. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.MiscServices.InputMethodFramework + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ----------- | ---- | ------------------------ | +| panel | [Panel](#panel10) | Yes | Input method panel to destroy.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object. | + +**Example** + +```js +let panelInfo: inputMethodEngine.PanelInfo = { + panelType: SOFT_KEYBOARD, + panelFlag: FLG_FIXED +} +try { + inputMethodEngine.getInputMethodAbility().createPanel(this.context, panelInfo, (err, panel) => { + if (err !== undefined) { + console.log('Failed to create panel, err: ' + JSON.stringify(err)); + return; + } + globalThis.inputMethodPanel = panel; + console.log('Succeed in creating panel.'); + }) +} catch(err) { + console.log('Failed to create panel, err: ' + JSON.stringify(err)); +} + +try { + inputMethodEngine.getInputMethodAbility().destroyPanel(globalThis.inputMethodPanel, (err) => { + if(err !== undefined) { + console.log('Failed to destroy panel, err: ' + JSON.stringify(err)); + return; + } + console.log('Succeed in destroying panel.'); + }) +} catch(err) { + console.log('Failed to destroy panel, err: ' + JSON.stringify(err)); +} +``` + +### destroyPanel10+ + +destroyPanel(panel: Panel): Promise\; + +Destroys an input method panel. This API uses a promise to return the result. + +**System capability**: SystemCapability.MiscServices.InputMethodFramework + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------| ----------- | ---- | ------------------------ | +| panel | [Panel](#panel10) | Yes | Input method panel to destroy. | + +**Return value** +| Type | Description | +| ------- | -------------------------------------------------------------------- | +| Promise\ | Promise that returns no value.| + +**Example** + +```js +let panelInfo: inputMethodEngine.PanelInfo = { + panelType: SOFT_KEYBOARD, + panelFlag: FLG_FIXED +} +try { + inputMethodEngine.getInputMethodAbility().createPanel(this.context, panelInfo, (err, panel) => { + if (err !== undefined) { + console.log('Failed to create panel, err: ' + JSON.stringify(err)); + return; + } + globalThis.inputMethodPanel = panel; + console.log('Succeed in creating panel.'); + }) +} catch(err) { + console.log('Failed to create panel, err: ' + JSON.stringify(err)); +} + +try { + inputMethodEngine.getInputMethodAbility().destroyPanel(globalThis.inputMethodPanel).then(() => { + console.log('Succeed in destroying panel.'); + }).catch((err) => { + console.log('Failed to destroy panel, err: ' + JSON.stringify(err)); + }); +} catch (err) { + console.log('Failed to destroy panel, err: ' + JSON.stringify(err)); +} +``` + ## KeyboardDelegate In the following API examples, you must first use **[getKeyboardDelegate](#inputmethodenginegetkeyboarddelegate9)** to obtain a **KeyboardDelegate** instance, and then call the APIs using the obtained instance. @@ -684,6 +864,455 @@ inputMethodEngine.getKeyboardDelegate().off('textChange', (text) => { }); ``` +## Panel10+ + +In the following API examples, you must first use **[createPanel](#createpanel10)** to obtain a **Panel** instance, and then call the APIs using the obtained instance. + +### setUiContent10+ + +setUiContent(path: string, callback: AsyncCallback\): void + +Loads content from a page to this panel. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.MiscServices.InputMethodFramework + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------- | ---- | -------- | +| path | string | Yes | Path of the page from which the content will be loaded.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.| + +**Example** + +```js +try { + panel.setUiContent('pages/page2/page2', (err) => { + if (err) { + console.error('Failed to set the content. err:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in setting the content.'); + }); +} catch (exception) { + console.error('Failed to set the content. err:' + JSON.stringify(exception)); +} +``` + +### setUiContent10+ + +setUiContent(path: string): Promise\ + +Loads content from a page to this panel. This API uses a promise to return the result. + +**System capability**: SystemCapability.MiscServices.InputMethodFramework + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------- | ---- | -------- | +| path | string | Yes | Path of the page from which the content will be loaded.| + +**Return value** + +| Type | Description | +| ------- | ------------------------------ | +| Promise\ | Promise that returns no value. | + +**Example** + +```js +try { + let promise = panel.setUiContent('pages/page2/page2'); + promise.then(() => { + console.info('Succeeded in setting the content.'); + }).catch((err) =>{ + console.error('Failed to set the content. err: ' + JSON.stringify(err)); + }); +} catch (exception) { + console.error('Failed to set the content. err: ' + JSON.stringify(exception)); +} +``` + +### setUiContent10+ + +setUiContent(path: string, storage: LocalStorage, callback: AsyncCallback\): void + +Loads content from a page linked to LocalStorage to this panel. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.MiscServices.InputMethodFramework + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------- | ---- | -------- | +| path | string | Yes | Path of the page from which the content will be loaded.| +| storage | [LocalStorage](../../quick-start/arkts-state-mgmt-application-level.md#localstorage) | Yes | Storage unit that provides storage for mutable and immutable state variables in the application.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.| + +**Example** + +```js +let storage = new LocalStorage(); +storage.setOrCreate('storageSimpleProp',121); +try { + panel.setUiContent('pages/page2/page2', storage, (err) => { + if (err) { + console.error('Failed to set the content. err:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in setting the content.'); + }); +} catch (exception) { + console.error('Failed to set the content. err:' + JSON.stringify(exception)); +} +``` + +### setUiContent10+ + +setUiContent(path: string, storage: LocalStorage): Promise\ + +Loads content from a page linked to LocalStorage to this panel. This API uses a promise to return the result. + +**System capability**: SystemCapability.MiscServices.InputMethodFramework + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------- | ---- | -------- | +| path | string | Yes | Path of the page from which the content will be loaded.| +| storage | [LocalStorage](../../quick-start/arkts-state-mgmt-application-level.md#localstorage) | Yes | Storage unit that provides storage for mutable and immutable state variables in the application.| + +**Return value** + +| Type | Description | +| ------- | ------------------------------ | +| Promise\ | Promise that returns no value. | + +**Example** + +```js +let storage = new LocalStorage(); +storage.setOrCreate('storageSimpleProp',121); +try { + let promise = panel.setUiContent('pages/page2/page2'); + promise.then(() => { + console.info('Succeeded in setting the content.'); + }).catch((err) =>{ + console.error('Failed to set the content. err: ' + JSON.stringify(err)); + }); +} catch (exception) { + console.error('Failed to set the content. err: ' + JSON.stringify(exception)); +} +``` + +### resize10+ + +resize(width: number, height: number, callback: AsyncCallback\): void + +Resizes this panel. This API uses an asynchronous callback to return the result. +The panel width cannot exceed the screen width, and the panel height cannot be higher than half of the screen height. + +**System capability**: SystemCapability.MiscServices.InputMethodFramework + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------- | ---- | -------- | +| width | number | Yes | Target width of the panel, in pixels.| +| height | number | Yes | Target height of the panel, in pixels.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.| + +**Example** + +```js +try { + panel.resize(500, 1000, (err) => { + if (err) { + console.error('Failed to change the panel size. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in changing the panel size.'); + }); +} catch (exception) { + console.error('Failed to change the panel size. Cause:' + JSON.stringify(exception)); +} +``` + +### resize10+ + +resize(width: number, height: number): Promise\; + +Resizes this panel. This API uses a promise to return the result. +The panel width cannot exceed the screen width, and the panel height cannot be higher than half of the screen height. + +**System capability**: SystemCapability.MiscServices.InputMethodFramework + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------- | ---- | -------- | +| width | number | Yes | Target width of the panel, in pixels.| +| height | number | Yes | Target height of the panel, in pixels.| + +**Return value** + +| Type | Description | +| ------- | ------------------------------ | +| Promise | Promise that returns no value. | + +**Example** + +```js +try { + let promise = panel.resize(500, 1000); + promise.then(() => { + console.info('Succeeded in changing the panel size.'); + }).catch((err) =>{ + console.error('Failed to change the panel size. err: ' + JSON.stringify(err)); + }); +} catch (exception) { + console.error('Failed to change the panel size. err: ' + JSON.stringify(exception)); +} +``` + +### moveTo10+ + +moveTo(x: number, y: number, callback: AsyncCallback\): void + +Moves this panel to the specified position. This API uses an asynchronous callback to return the result. +This API does not work on panels in the FLG_FIXED state. + +**System capability**: SystemCapability.MiscServices.InputMethodFramework + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------- | ---- | -------- | +| x | number | Yes | Distance to move along the x-axis, in px. A positive value indicates moving rightwards.| +| y | number | Yes | Distance to move along the y-axis, in pixels. A positive value indicates moving downwards.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.| + +**Example** + +```js +try { + panel.moveTo(300, 300, (err) =>{ + if (err) { + console.error('Failed to move the panel. err:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in moving the panel.'); + }); +} catch (exception) { + console.error('Failed to move the panel. err:' + JSON.stringify(exception)); +} +``` + +### moveTo10+ + +moveTo(x: number, y: number): Promise\ + +Moves this panel to the specified position. This API uses a promise to return the result. +This API does not work on panels in the FLG_FIXED state. + +**System capability**: SystemCapability.MiscServices.InputMethodFramework + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------- | ---- | -------- | +| x | number | Yes | Distance to move along the x-axis, in pixels. A positive value indicates moving rightwards.| +| y | number | Yes | Distance to move along the y-axis, in pixels. A positive value indicates moving downwards.| + +**Return value** + +| Type | Description | +| ------- | ------------------------------ | +| Promise | Promise that returns no value. | + +**Example** + +```js +try { + let promise = windowClass.moveTo(300, 300); + promise.then(() => { + console.info('Succeeded in moving the panel.'); + }).catch((err) =>{ + console.error('Failed to move the panel. Cause: ' + JSON.stringify(err)); + }); +} catch (exception) { + console.error('Failed to move the panel. Cause:' + JSON.stringify(exception)); +} +``` + +### show10+ + +show(callback: AsyncCallback\): void + +Displays this panel. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.MiscServices.InputMethodFramework + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------- | ---- | -------- | +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.| + +**Example** + +```js +panel.show((err) => { + if (err) { + console.error('Failed to show the panel. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Succeeded in showing the panel.'); +}); +``` + +### show10+ + +show(): Promise\ + +Displays this panel. This API uses a promise to return the result. + +**System capability**: SystemCapability.MiscServices.InputMethodFramework + +**Return value** + +| Type | Description | +| ------- | ------------------------------ | +| Promise\ | Promise that returns no value. | + +**Example** + +```js +let promise = panel.show(); +promise.then(() => { + console.info('Succeeded in showing the panel.'); +}).catch((err) =>{ + console.error('Failed to show the panel. err: ' + JSON.stringify(err)); +}); +``` + +### hide10+ + +hide(callback: AsyncCallback\): void + +Hides this panel. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.MiscServices.InputMethodFramework + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------- | ---- | -------- | +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.| + +**Example** + +```js +panel.hide((err) => { + if (err) { + console.error('Failed to hide the panel. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Succeeded in hiding the panel.'); +}); +``` + +### hide10+ + +hide(): Promise\ + +Hides this panel. This API uses a promise to return the result. + +**System capability**: SystemCapability.MiscServices.InputMethodFramework + +**Return value** + +| Type | Description | +| ------- | ------------------------------ | +| Promise\ | Promise that returns no value. | + +**Example** + +```js +let promise = panel.hide(); +promise.then(() => { + console.info('Succeeded in hiding the panel.'); +}).catch((err) =>{ + console.error('Failed to hide the panel. err: ' + JSON.stringify(err)); +}); +``` + +### on10+ + +on(type: 'show' | 'hide', callback: () => void): void + +Enables listening for a panel visibility event. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.MiscServices.InputMethodFramework + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------- | ---- | -------- | +| type | 'show'\|'hide' | Yes| Listening type.
- The value **'show'** indicates the panel display event.
- The value **'hide'** indicates the panel hiding event.| +| callback | () => void | Yes | Callback used to return the result.| + +**Example** + +```js +panel.on('show', () => { + console.info('Panel is showing.'); +}); +``` + +### off10+ + +off(type: 'show' | 'hide', callback?: () => void): void + +Disables listening for a panel visibility event. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.MiscServices.InputMethodFramework + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------- | ---- | -------- | +| type | 'show'/'hide' | Yes| Listening type.
- The value **'show'** indicates the panel display event.
- The value **'hide'** indicates the panel hiding event.| +| callback | () => void | No | Callback used to return the result.| + +**Example** + +```js +panel.off('show'); +``` + +### changeFlag10+ + +changeFlag(flag: PanelFlag): void + +Changes the panel state type. This API only works for SOFT_KEYBOARD panels. + +**System capability**: SystemCapability.MiscServices.InputMethodFramework + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------- | ---- | -------- | +| flag | [PanelFlag](#panelflag10) | Yes| State type of the panel to switch to.| + +**Example** + +```js +let panelFlag = inputMethodEngine.getInputMethodAbility().PanelFlag.FLG_FIXED; +panel.changeFlag(panelFlag); +``` + ## KeyboardController In the following API examples, you must first use **[on('inputStart')](#oninputstart9)** to obtain a **KeyboardController** instance, and then call the APIs using the obtained instance. @@ -708,7 +1337,7 @@ For details about the error codes, see [Input Method Framework Error Codes](../e | Error Code ID| Error Message | | -------- | -------------------------- | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **Example** @@ -742,7 +1371,7 @@ For details about the error codes, see [Input Method Framework Error Codes](../e | Error Code ID| Error Message | | -------- | -------------------------- | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **Example** @@ -837,7 +1466,7 @@ For details about the error codes, see [Input Method Framework Error Codes](../e | Error Code ID| Error Message | | -------- | -------------------------- | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **Example** @@ -886,7 +1515,7 @@ For details about the error codes, see [Input Method Framework Error Codes](../e | Error Code ID| Error Message | | -------- | -------------------------- | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **Example** @@ -928,7 +1557,7 @@ For details about the error codes, see [Input Method Framework Error Codes](../e | Error Code ID| Error Message | | -------- | ------------------------------ | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | | 12800006 | Input method controller error. | **Example** @@ -974,7 +1603,7 @@ For details about the error codes, see [Input Method Framework Error Codes](../e | Error Code ID| Error Message | | -------- | ------------------------------ | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | | 12800006 | Input method controller error. | **Example** @@ -1013,7 +1642,7 @@ For details about the error codes, see [Input Method Framework Error Codes](../e | Error Code ID| Error Message | | -------- | ------------------------------ | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | | 12800006 | Input method controller error. | **Example** @@ -1059,7 +1688,7 @@ For details about the error codes, see [Input Method Framework Error Codes](../e | Error Code ID| Error Message | | -------- | ------------------------------ | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | | 12800006 | Input method controller error. | **Example** @@ -1099,7 +1728,7 @@ For details about the error codes, see [Input Method Framework Error Codes](../e | Error Code ID| Error Message | | -------- | -------------------------- | | 12800002 | Input method engine error. | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **Example** @@ -1149,7 +1778,7 @@ For details about the error codes, see [Input Method Framework Error Codes](../e | Error Code ID| Error Message | | -------- | -------------------------- | | 12800002 | Input method engine error. | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **Example** @@ -1192,7 +1821,7 @@ For details about the error codes, see [Input Method Framework Error Codes](../e | Error Code ID| Error Message | | -------- | -------------------------- | | 12800002 | Input method engine error. | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **Example** @@ -1242,7 +1871,7 @@ For details about the error codes, see [Input Method Framework Error Codes](../e | Error Code ID| Error Message | | -------- | -------------------------- | | 12800002 | Input method engine error. | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **Example** @@ -1281,7 +1910,7 @@ For details about the error codes, see [Input Method Framework Error Codes](../e | Error Code ID| Error Message | | -------- | -------------------------- | | 12800002 | Input method engine error. | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **Example** @@ -1326,7 +1955,7 @@ For details about the error codes, see [Input Method Framework Error Codes](../e | Error Code ID| Error Message | | -------- | -------------------------- | | 12800002 | Input method engine error. | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **Example** @@ -1366,7 +1995,7 @@ For details about the error codes, see [Input Method Framework Error Codes](../e | Error Code ID| Error Message | | -------- | -------------------------- | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **Example** @@ -1401,7 +2030,7 @@ For details about the error codes, see [Input Method Framework Error Codes](../e | Error Code ID| Error Message | | -------- | -------------------------- | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **Example** @@ -1435,7 +2064,7 @@ For details about the error codes, see [Input Method Framework Error Codes](../e | Error Code ID| Error Message | | -------- | -------------------------- | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **Example** @@ -1479,7 +2108,7 @@ For details about the error codes, see [Input Method Framework Error Codes](../e | Error Code ID| Error Message | | -------- | -------------------------- | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **Example** @@ -1517,7 +2146,7 @@ For details about the error codes, see [Input Method Framework Error Codes](../e | Error Code ID| Error Message | | -------- | -------------------------- | | 401 | parameter error. | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **Example** @@ -1562,7 +2191,7 @@ For details about the error codes, see [Input Method Framework Error Codes](../e | Error Code ID| Error Message | | -------- | -------------------------- | | 401 | parameter error. | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **Example** @@ -1600,7 +2229,7 @@ For details about the error codes, see [Input Method Framework Error Codes](../e | Error Code ID| Error Message | | -------- | -------------------------- | | 401 | parameter error. | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **Example** @@ -1620,7 +2249,7 @@ try { ### selectByMovement10+ -selectByMovement(range: Range): Promise<void> +selectByMovement(movement: Movement): Promise<void> Selects text based on the specified range. This API uses a promise to return the result. @@ -1645,7 +2274,7 @@ For details about the error codes, see [Input Method Framework Error Codes](../e | Error Code ID| Error Message | | -------- | -------------------------- | | 401 | parameter error. | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **Example** @@ -1682,7 +2311,7 @@ For details about the error codes, see [Input Method Framework Error Codes](../e | Error Code ID| Error Message | | -------- | ------------------------------ | | 401 | parameter error. | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | | 12800006 | Input method controller error. | **Example** @@ -1717,7 +2346,7 @@ For details about the error codes, see [Input Method Framework Error Codes](../e | Error Code ID| Error Message | | -------- | ------------------------------ | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | | 12800006 | Input method controller error. | **Example** @@ -1752,6 +2381,39 @@ Describes the attribute of a key. | keyCode | number | Yes | No | Key value.| | keyAction | number | Yes | No | Key status.| +## PanelFlag10+ + +Enumerates the state types of the input method panel. + +**System capability**: SystemCapability.MiscServices.InputMethodFramework + +| Name | Value| Description | +| ------------ | -- | ------------------ | +| FLG_FIXED | 0 | Fixed state type.| +| FLG_FLOATING | 1 | Floating state type.| + +## PanelType10+ + +Enumerates the types of the input method panel. + +**System capability**: SystemCapability.MiscServices.InputMethodFramework + +| Name | Value| Description | +| ------------ | -- | ------------------ | +| SOFT_KEYBOARD | 0 | Soft keyboard type.| +| STATUS_BAR | 1 | Status bar type.| + +## PanelInfo10+ + +**System capability**: SystemCapability.MiscServices.InputMethodFramework + +Describes the attributes of the input method panel. + +| Name | Type| Readable| Writable| Description | +| --------- | -------- | ---- | ---- | ------------ | +| type | number | Yes | Yes | Type of the panel.| +| flag | number | Yes | Yes | State type of the panel.| + ## TextInputClient(deprecated) > **NOTE** @@ -2250,3 +2912,4 @@ textInputClient.getEditorAttribute().then((editorAttribute) => { console.error('Failed to getEditorAttribute: ' + JSON.stringify(err)); }); ``` + diff --git a/en/application-dev/reference/apis/js-apis-installer.md b/en/application-dev/reference/apis/js-apis-installer.md index 5081673fb64f13171a596fd2ed163d4bd8d3c7c9..fc1fe9ef77b77ef0eaae619f5c0f630b39a6bb40 100644 --- a/en/application-dev/reference/apis/js-apis-installer.md +++ b/en/application-dev/reference/apis/js-apis-installer.md @@ -3,6 +3,7 @@ The **bundle.installer** module provides APIs for you to install, uninstall, and recover bundles on devices. > **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 @@ -25,7 +26,7 @@ getBundleInstaller(callback: AsyncCallback\): void; Obtains a **BundleInstaller** object. This API uses an asynchronous callback to return the result. -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **System capability**: SystemCapability.BundleManager.BundleFramework.Core @@ -59,7 +60,7 @@ getBundleInstaller(): Promise\; Obtains a **BundleInstaller** object. This API uses an asynchronous callback to return the result. -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **System capability**: SystemCapability.BundleManager.BundleFramework.Core @@ -89,7 +90,7 @@ install(hapFilePaths: Array<string>, installParam: InstallParam, callback: Installs a bundle. This API uses an asynchronous callback to return the result. -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Required permissions**: ohos.permission.INSTALL_BUNDLE @@ -118,6 +119,9 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc | 17700017 | Failed to install the HAP since the version of the HAP to install is too early. | | 17700018 | Failed to install because the dependent module does not exist. | | 17700031 | Failed to install the HAP because the overlay check of the HAP is failed. | +| 17700036 | Failed to install the HSP because lacks appropriate permissions. | +| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. | +| 17700041 | Failed to install because enterprise device management disallow install. | **Example** @@ -146,6 +150,135 @@ try { console.error('getBundleInstaller failed. Cause: ' + error.message); } ``` +## BundleInstaller.install +install(hapFilePaths: Array<string>, callback: AsyncCallback<void>): void; + +Installs a bundle. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.INSTALL_BUNDLE + +**System capability**: SystemCapability.BundleManager.BundleFramework.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| --------------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ | +| hapFilePaths | Array<string> | Yes | Paths where the HAP files of the bundle are stored, which are the data directories. If only one directory is passed, the HAP files in the directory must belong to the same bundle and have the same signature.| +| callback | AsyncCallback<void> | Yes| Callback used to return the result. If the operation is successful, **err** is undefined; otherwise, **err** is an error object.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| 17700010 | Failed to install the HAP because the HAP fails to be parsed. | +| 17700011 | Failed to install the HAP because the HAP signature fails to be verified. | +| 17700012 | Failed to install the HAP because the HAP path is invalid or the HAP is too large. | +| 17700015 | Failed to install the HAPs because they have different configuration information. | +| 17700016 | Failed to install the HAP because of insufficient system disk space. | +| 17700017 | Failed to install the HAP since the version of the HAP to install is too early. | +| 17700018 | Failed to install because the dependent module does not exist. | +| 17700031 | Failed to install the HAP because the overlay check of the HAP is failed. | +| 17700036 | Failed to install the HSP because lacks appropriate permissions. | +| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. | +| 17700041 | Failed to install because enterprise device management disallow install. | + +**Example** + +```ts +import installer from '@ohos.bundle.installer'; +let hapFilePaths = ['/data/storage/el2/base/haps/entry/files/']; + +try { + installer.getBundleInstaller().then(data => { + data.install(hapFilePaths, err => { + if (err) { + console.error('install failed:' + err.message); + } else { + console.info('install successfully.'); + } + }); + }).catch(error => { + console.error('getBundleInstaller failed. Cause: ' + error.message); + }); +} catch (error) { + console.error('getBundleInstaller failed. Cause: ' + error.message); +} +``` + +## BundleInstaller.install + +install(hapFilePaths: Array\, installParam?: InstallParam) : Promise\; + +Installs a bundle. This API uses a promise to return the result. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.INSTALL_BUNDLE + +**System capability**: SystemCapability.BundleManager.BundleFramework.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ | +| hapFilePaths | Array\ | Yes | Paths where the HAP files of the bundle are stored, which are the data directories. If only one directory is passed, the HAP files in the directory must belong to the same bundle and have the same signature.| +| installParam | [InstallParam](#installparam) | No | Parameters required for the installation. | + +**Return value** + +| Type | Description | +| --------------- | -------------------------------------- | +| Promise\ | Promise that returns no value.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| 17700004 | The specified user ID is not found. | +| 17700010 | Failed to install the HAP because the HAP fails to be parsed. | +| 17700011 | Failed to install the HAP because the HAP signature fails to be verified. | +| 17700012 | Failed to install the HAP because the HAP path is invalid or the HAP is too large. | +| 17700015 | Failed to install the HAPs because they have different configuration information. | +| 17700016 | Failed to install the HAP because of insufficient system disk space. | +| 17700017 | Failed to install the HAP since the version of the HAP to install is too early. | +| 17700018 | Failed to install because the dependent module does not exist. | +| 17700031 | Failed to install the HAP because the overlay check of the HAP is failed. | +| 17700036 | Failed to install the HSP because lacks appropriate permissions. | +| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. | +| 17700041 | Failed to install because enterprise device management disallow install. | + +**Example** + +```ts +import installer from '@ohos.bundle.installer'; +let hapFilePaths = ['/data/storage/el2/base/haps/entry/files/']; +let installParam = { + userId: 100, + isKeepData: false, + installFlag: 1, +}; + +try { + installer.getBundleInstaller().then(data => { + data.install(hapFilePaths, installParam) + .then((data) => { + console.info('install successfully: ' + JSON.stringify(data)); + }).catch((error) => { + console.error('install failed:' + error.message); + }); + }).catch(error => { + console.error('getBundleInstaller failed. Cause: ' + error.message); + }); +} catch (error) { + console.error('getBundleInstaller failed. Cause: ' + error.message); +} +``` ## BundleInstaller.uninstall @@ -153,7 +286,7 @@ uninstall(bundleName: string, installParam: InstallParam, callback: AsyncCallbac Uninstalls a bundle. This API uses an asynchronous callback to return the result. -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Required permissions**: ohos.permission.INSTALL_BUNDLE @@ -164,7 +297,7 @@ Uninstalls a bundle. This API uses an asynchronous callback to return the result | Name | Type | Mandatory| Description | | ---------- | ---------------------------------------------------- | ---- | ---------------------------------------------- | | bundleName | string | Yes | Name of the target bundle. | -| installParam | [InstallParam](#installparam) | Yes | Parameters required for the installation. | +| installParam | [InstallParam](#installparam) | Yes | Parameters required for the uninstall. | | callback | AsyncCallback<void> | Yes| Callback used to return the result. If the operation is successful, **err** is undefined; otherwise, **err** is an error object.| **Error codes** @@ -173,9 +306,10 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc | ID| Error Message | | -------- | ------------------------------------------------------------ | -| 17700004 | The specified user ID is not found. | +| 17700001 | The specified bundle name is not found. | +| 17700004 | The specified user ID is not found. | | 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. | -| 17700101 | The system service is excepted. | +| 17700040 | The specified bundle is a shared bundle which cannot be uninstalled. | **Example** @@ -205,13 +339,126 @@ try { } ``` +## BundleInstaller.uninstall + +uninstall(bundleName: string, callback: AsyncCallback<void>): void; + +Uninstalls a bundle. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.INSTALL_BUNDLE + +**System capability**: SystemCapability.BundleManager.BundleFramework.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | ---------------------------------------------------- | ---- | ---------------------------------------------- | +| bundleName | string | Yes | Name of the target bundle. | +| callback | AsyncCallback<void> | Yes| Callback used to return the result. If the operation is successful, **err** is undefined; otherwise, **err** is an error object.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| 17700001 | The specified bundle name is not found. | +| 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. | +| 17700040 | The specified bundle is a shared bundle which cannot be uninstalled. | + +**Example** + +```ts +import installer from '@ohos.bundle.installer'; +let bundleName = 'com.ohos.demo'; + +try { + installer.getBundleInstaller().then(data => { + data.uninstall(bundleName, err => { + if (err) { + console.error('uninstall failed:' + err.message); + } else { + console.info('uninstall successfully.'); + } + }); + }).catch(error => { + console.error('getBundleInstaller failed. Cause: ' + error.message); + }); +} catch (error) { + console.error('getBundleInstaller failed. Cause: ' + error.message); +} +``` +## BundleInstaller.uninstall + +uninstall(bundleName: string, installParam?: InstallParam) : Promise\; + +Uninstalls a bundle. This API uses a promise to return the result. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.INSTALL_BUNDLE + +**System capability**: SystemCapability.BundleManager.BundleFramework.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ | +| bundleName | string | Yes | Name of the target bundle. | +| installParam | [InstallParam](#installparam) | No | Parameters required for the uninstall. | + +**Return value** + +| Type | Description | +| --------------- | -------------------------------------- | +| Promise\ | Promise that returns no value.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| 17700001 | The specified bundle name is not found. | +| 17700004 | The specified userId is not existed. | +| 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. | +| 17700040 | The specified bundle is a shared bundle which cannot be uninstalled. | + +**Example** +```ts +import installer from '@ohos.bundle.installer'; +let bundleName = 'com.ohos.demo'; +let installParam = { + userId: 100, + isKeepData: false, + installFlag: 1, +}; + +try { + installer.getBundleInstaller().then(data => { + data.uninstall(bundleName, installParam) + .then((data) => { + console.info('uninstall successfully: ' + JSON.stringify(data)); + }).catch((error) => { + console.error('uninstall failed:' + error.message); + }); + }).catch(error => { + console.error('getBundleInstaller failed. Cause: ' + error.message); + }); +} catch (error) { + console.error('getBundleInstaller failed. Cause: ' + error.message); +} +``` + ## BundleInstaller.recover recover(bundleName: string, installParam: InstallParam, callback: AsyncCallback<void>): void; -Recovers a bundle. This API uses an asynchronous callback to return the result. +Rolls back a bundle to the initial installation state. This API uses an asynchronous callback to return the result. -**System API**: This is a system API and cannot be called by third-party applications. +**System API**: This is a system API. **Required permissions**: ohos.permission.INSTALL_BUNDLE @@ -222,7 +469,7 @@ Recovers a bundle. This API uses an asynchronous callback to return the result. | Name | Type | Mandatory| Description | | ---------- | ---------------------------------------------------- | ---- | ---------------------------------------------- | | bundleName | string | Yes | Name of the target bundle. | -| installParam | [InstallParam](#installparam) | Yes | Parameters required for the installation. | +| installParam | [InstallParam](#installparam) | Yes | Parameters required for the recovery. | | callback | AsyncCallback<void> | Yes| Callback used to return the result. If the operation is successful, **err** is undefined; otherwise, **err** is an error object.| **Error codes** @@ -231,6 +478,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc | ID| Error Message | | -------- | ----------------------------------- | +| 17700001 | The specified bundle name is not found. | | 17700004 | The specified user ID is not found. | **Example** @@ -261,13 +509,236 @@ try { } ``` + +## BundleInstaller.recover + +recover(bundleName: string, callback: AsyncCallback<void>): void; + +Rolls back a bundle to the initial installation state. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.INSTALL_BUNDLE + +**System capability**: SystemCapability.BundleManager.BundleFramework.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | ---------------------------------------------------- | ---- | ---------------------------------------------- | +| bundleName | string | Yes | Name of the target bundle. | +| callback | AsyncCallback<void> | Yes| Callback used to return the result. If the operation is successful, **err** is undefined; otherwise, **err** is an error object.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| -------- | ----------------------------------- | +| 17700001 | The specified bundle name is not found. | + +**Example** + +```ts +import installer from '@ohos.bundle.installer'; +let bundleName = 'com.ohos.demo'; + +try { + installer.getBundleInstaller().then(data => { + data.recover(bundleName, err => { + if (err) { + console.error('recover failed:' + err.message); + } else { + console.info('recover successfully.'); + } + }); + }).catch(error => { + console.error('getBundleInstaller failed. Cause: ' + error.message); + }); +} catch (error) { + console.error('getBundleInstaller failed. Cause: ' + error.message); +} +``` + +## BundleInstaller.recover + +recover(bundleName: string, installParam?: InstallParam) : Promise\; + +Rolls back a bundle to the initial installation state. This API uses a promise to return the result. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.INSTALL_BUNDLE + +**System capability**: SystemCapability.BundleManager.BundleFramework.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ | +| bundleName | string | Yes | Name of the target bundle. | +| installParam | [InstallParam](#installparam) | No | Parameters required for the recovery. | + +**Return value** + +| Type | Description | +| --------------- | -------------------------------------- | +| Promise\ | Promise that returns no value.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| -------- | ----------------------------------- | +| 17700001 | The specified bundle name is not found. | +| 17700004 | The specified user ID is not found. | + +**Example** +```ts +import installer from '@ohos.bundle.installer'; +let bundleName = 'com.ohos.demo'; +let installParam = { + userId: 100, + isKeepData: false, + installFlag: 1, +}; + +try { + installer.getBundleInstaller().then(data => { + data.recover(bundleName, installParam) + .then((data) => { + console.info('recover successfully: ' + JSON.stringify(data)); + }).catch((error) => { + console.error('recover failed:' + error.message); + }); + }).catch(error => { + console.error('getBundleInstaller failed. Cause: ' + error.message); + }); +} catch (error) { + console.error('getBundleInstaller failed. Cause: ' + error.message); +} +``` + +## BundleInstaller.uninstall10+ + +uninstall(uninstallParam: UninstallParam, callback : AsyncCallback\) : void ; + +Uninstalls a shared bundle. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.INSTALL_BUNDLE + +**System capability**: SystemCapability.BundleManager.BundleFramework.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------------- | ----------------------------------- | ---- | -------------------------------------------------------- | +| uninstallParam | [UninstallParam](#uninstallparam10) | Yes | Parameters required for the uninstall. | +| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the operation is successful, **err** is undefined; otherwise, **err** is an error object.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. | +| 17700037 | The version of shared bundle is dependent on other applications. | +| 17700038 | The specified shared bundle does not exist. | + +**Example** + +```ts +import installer from '@ohos.bundle.installer'; +let uninstallParam = { + bundleName : "com.ohos.demo", +}; + +try { + installer.getBundleInstaller().then(data => { + data.uninstall(uninstallParam, err => { + if (err) { + console.error('uninstall failed:' + err.message); + } else { + console.info('uninstall successfully.'); + } + }); + }).catch(error => { + console.error('getBundleInstaller failed. Cause: ' + error.message); + }); +} catch (error) { + console.error('getBundleInstaller failed. Cause: ' + error.message); +} +``` + +## BundleInstaller.uninstall10+ + +uninstall(uninstallParam: UninstallParam) : Promise\; + +Uninstalls a shared bundle. This API uses a promise to return the result. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.INSTALL_BUNDLE + +**System capability**: SystemCapability.BundleManager.BundleFramework.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------------- | ----------------------------------- | ---- | ---------------------------- | +| uninstallParam | [UninstallParam](#uninstallparam10) | Yes | Parameters required for the uninstall.| + +**Return value** + +| Type | Description | +| ------------- | -------------------------------------- | +| Promise\ | Promise that returns no value.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. | +| 17700037 | The version of shared bundle is dependent on other applications. | +| 17700038 | The specified shared bundle does not exist. | + +**Example** + +```ts +import installer from '@ohos.bundle.installer'; +let uninstallParam = { + bundleName : "com.ohos.demo", +}; + +try { + installer.getBundleInstaller().then(data => { + data.uninstall(uninstallParam, err => { + if (err) { + console.error('uninstall failed:' + err.message); + } else { + console.info('uninstall successfully.'); + } + }); + }).catch(error => { + console.error('getBundleInstaller failed. Cause: ' + error.message); + }); +} catch (error) { + console.error('getBundleInstaller failed. Cause: ' + error.message); +} +``` ## HashParam Defines the hash parameters for bundle installation and uninstall. **System capability**: SystemCapability.BundleManager.BundleFramework.Core - **System API**: This is a system API and cannot be called by third-party applications. + **System API**: This is a system API. | Name | Type | Mandatory| Description | | ---------- | ------ | ---------------- | ---------------- | @@ -280,12 +751,26 @@ Defines the parameters that need to be specified for bundle installation, uninst **System capability**: SystemCapability.BundleManager.BundleFramework.Core - **System API**: This is a system API and cannot be called by third-party applications. + **System API**: This is a system API. | Name | Type | Mandatory | Description | | ------------------------------ | ------------------------------ | ------------------ | ------------------ | -| userId | number | Yes | User ID. You can use [queryOsAccountLocalIdFromProcess](js-apis-osAccount.md#queryosaccountlocalidfromprocess9) to obtain the user of the current process.| -| installFlag | number | Yes | Installation flag. The value **0** means initial installation and **1** means overwrite installation.| -| isKeepData | boolean | Yes | Whether to retain the data directory during bundle uninstall.| -| hashParams | Array<[HashParam](#hashparam)> | Yes| Hash parameters. | -| crowdtestDeadline| number | Yes |End date of crowdtesting.| +| userId | number | No | User ID. You can use [queryOsAccountLocalIdFromProcess](js-apis-osAccount.md#getOsAccountLocalId) to obtain the user of the current process.| +| installFlag | number | No | Installation flag. The value **0** means initial installation and **1** means overwrite installation.| +| isKeepData | boolean | No | Whether to retain the data directory during bundle uninstall.| +| hashParams | Array<[HashParam](#hashparam)> | No| Hash parameters. | +| crowdtestDeadline| number | No |End date of crowdtesting.| +| sharedBundleDirPaths10+ | Array\ | No|Paths of the shared bundle files.| + +## UninstallParam10+ + +Defines the parameters required for the uninstallation of a shared bundle. + + **System capability**: SystemCapability.BundleManager.BundleFramework.Core + + **System API**: This is a system API. + +| Name | Type | Mandatory| Description | +| ----------- | ------ | ---- | ------------------------------------------------------------ | +| bundleName | string | Yes | Name of the shared bundle. | +| versionCode | number | No | Version number of the shared bundle. If this parameter is not set, all shared bundles of the specified name are uninstalled.| diff --git a/en/application-dev/reference/apis/js-apis-intl.md b/en/application-dev/reference/apis/js-apis-intl.md index d4f3449adae43eed9b19236aec0d0308feed89e8..cec10d9eef5fbd50d9d81ca6a5358d57d78fdbf0 100644 --- a/en/application-dev/reference/apis/js-apis-intl.md +++ b/en/application-dev/reference/apis/js-apis-intl.md @@ -1,6 +1,7 @@ # @ohos.intl (Internationalization) The **intl** module provides basic i18n capabilities, such as time and date formatting, number formatting, and string sorting, through the standard i18n APIs defined in ECMA 402. + The [i18n](js-apis-i18n.md) module provides enhanced i18n capabilities through supplementary interfaces that are not defined in ECMA 402. It works with the intl module to provide a complete suite of i18n capabilities. > **NOTE** @@ -48,9 +49,9 @@ Creates a **Locale** object. **Example** ```js // The default constructor uses the current system locale to create a Locale object. - let locale = new Intl.Locale() + let locale = new Intl.Locale(); // Return the current system locale. - let localeID = locale.toString() + let localeID = locale.toString(); ``` @@ -67,13 +68,13 @@ Creates a **Locale** object. | Name | Type | Mandatory | Description | | -------------------- | -------------------------------- | ---- | ---------------------------- | | locale | string | Yes | A string containing locale information, including the language, optional script, and region. For details about the international standards and combination modes for the language, script, and country or region, see [intl Development](../../internationalization/intl-guidelines.md#setting-locale-information).| -| options9+ | [LocaleOptions](#localeoptions6) | No | Options for creating the **Locale** object. | +| options9+ | [LocaleOptions](#localeoptions9) | No | Options for creating the **Locale** object. | **Example** ```js // Create a Locale object named zh-CN. - let locale = new Intl.Locale("zh-CN") - let localeID = locale.toString() // localeID = "zh-CN" + let locale = new Intl.Locale("zh-CN"); + let localeID = locale.toString(); // localeID = "zh-CN" ``` @@ -159,7 +160,7 @@ Minimizes information of the **Locale** object. If the script and locale informa ``` -## LocaleOptions6+ +## LocaleOptions9+ Represents the locale options. @@ -206,7 +207,7 @@ Creates a **DateTimeOptions** object for the specified locale. | Name | Type | Mandatory | Description | | -------------------- | ------------------------------------ | ---- | ---------------------------- | | locale | string \| Array<string> | Yes | A string containing locale information, including the language, optional script, and region.| -| options9+ | [DateTimeOptions](#datetimeoptions6) | No | Options for creating a **DateTimeFormat** object. | +| options9+ | [DateTimeOptions](#datetimeoptions9) | No | Options for creating a **DateTimeFormat** object. | **Example** ```js @@ -298,7 +299,7 @@ Obtains the formatting options for **DateTimeFormat** object. | Type | Description | | ------------------------------------ | ----------------------------- | -| [DateTimeOptions](#datetimeoptions6) | Formatting options for **DateTimeFormat** objects.| +| [DateTimeOptions](#datetimeoptions9) | Formatting options for **DateTimeFormat** objects.| **Example** ```js @@ -310,7 +311,7 @@ Obtains the formatting options for **DateTimeFormat** object. ``` -## DateTimeOptions6+ +## DateTimeOptions9+ Provides the options for the **DateTimeFormat** object. @@ -370,7 +371,7 @@ Creates a **NumberFormat** object for the specified locale. | Name | Type | Mandatory | Description | | -------------------- | -------------------------------- | ---- | ---------------------------- | | locale | string \| Array<string> | Yes | A string containing locale information, including the language, optional script, and region.| -| options9+ | [NumberOptions](#numberoptions6) | No | Options for creating a **NumberFormat** object. | +| options9+ | [NumberOptions](#numberoptions9) | No | Options for creating a **NumberFormat** object. | **Example** ```js @@ -420,7 +421,7 @@ Obtains the options of the **NumberFormat** object. | Type | Description | | -------------------------------- | --------------------------- | -| [NumberOptions](#numberoptions6) | Formatting options for **NumberFormat** objects.| +| [NumberOptions](#numberoptions9) | Formatting options for **NumberFormat** objects.| **Example** @@ -429,11 +430,11 @@ Obtains the options of the **NumberFormat** object. // Obtain the options of the NumberFormat object. let options = numfmt.resolvedOptions(); let style = options.style; // style = decimal - let notation = options.notation // notation = scientific + let notation = options.notation; // notation = scientific ``` -## NumberOptions6+ +## NumberOptions9+ Defines the device capability. @@ -493,7 +494,7 @@ Creates a **Collator** object. | Name | Type | Mandatory | Description | | -------------------- | ------------------------------------ | ---- | ---------------------------- | | locale | string \| Array<string> | Yes | A string containing locale information, including the language, optional script, and region.| -| options9+ | [CollatorOptions](#collatoroptions8) | No | Options for creating a **Collator** object. | +| options9+ | [CollatorOptions](#collatoroptions9) | No | Options for creating a **Collator** object. | **Example** ```js @@ -544,7 +545,7 @@ Returns properties reflecting the locale and collation options of a **Collator** | Type | Description | | ------------------------------------ | ----------------- | -| [CollatorOptions](#collatoroptions8) | Properties of the **Collator** object.| +| [CollatorOptions](#collatoroptions9) | Properties of the **Collator** object.| **Example** ```js @@ -552,11 +553,11 @@ Returns properties reflecting the locale and collation options of a **Collator** // Obtain the options of the Collator object. let options = collator.resolvedOptions(); let usage = options.usage; // usage = "sort" - let ignorePunctuation = options.ignorePunctuation // ignorePunctuation = true + let ignorePunctuation = options.ignorePunctuation; // ignorePunctuation = true ``` -## CollatorOptions8+ +## CollatorOptions9+ Represents the properties of a **Collator** object. @@ -604,7 +605,7 @@ Creates a **PluralRules** object to obtain the singular-plural type of numbers. | Name | Type | Mandatory | Description | | -------------------- | ---------------------------------------- | ---- | ---------------------------- | | locale | string \| Array<string> | Yes | A string containing locale information, including the language, optional script, and region.| -| options9+ | [PluralRulesOptions](#pluralrulesoptions8) | No | Options for creating a **PluralRules** object. | +| options9+ | [PluralRulesOptions](#pluralrulesoptions9) | No | Options for creating a **PluralRules** object. | **Example** ```js @@ -631,7 +632,7 @@ Obtains a string that represents the singular-plural type of the specified numbe | Type | Description | | ------ | ---------------------------------------- | -| string | Singular-plural type. The value can be any of the following: **one**, **two**, **few**, **many**, **others**.| +| string | Singular-plural type. The value can be any of the following: **zero**, **one**, **two**, **few**, **many**, **others**.| **Example** ```js @@ -647,7 +648,7 @@ Obtains a string that represents the singular-plural type of the specified numbe ``` -## PluralRulesOptions8+ +## PluralRulesOptions9+ Represents the properties of a **PluralRules** object. @@ -695,7 +696,7 @@ Creates a **RelativeTimeFormat** object. | Name | Type | Mandatory | Description | | -------------------- | ---------------------------------------- | ---- | ---------------------------- | | locale | string \| Array<string> | Yes | A string containing locale information, including the language, optional script, and region.| -| options9+ | [RelativeTimeFormatInputOptions](#relativetimeformatinputoptions8) | No | Options for creating a **RelativeTimeFormat** object. | +| options9+ | [RelativeTimeFormatInputOptions](#relativetimeformatinputoptions9) | No | Options for creating a **RelativeTimeFormat** object. | **Example** ```js @@ -787,7 +788,7 @@ Obtains the formatting options for **RelativeTimeFormat** objects. ``` -## RelativeTimeFormatInputOptions8+ +## RelativeTimeFormatInputOptions9+ Represents the properties of a **RelativeTimeFormat** object. diff --git a/en/application-dev/reference/apis/js-apis-launcherBundleManager.md b/en/application-dev/reference/apis/js-apis-launcherBundleManager.md index 3180bf582281372886331d6d37ff059cad79e1db..74b5cf879abb768bf4abc5f07d0bdb4c4cbc571b 100644 --- a/en/application-dev/reference/apis/js-apis-launcherBundleManager.md +++ b/en/application-dev/reference/apis/js-apis-launcherBundleManager.md @@ -29,7 +29,7 @@ Obtains the launcher ability information based on the given bundle name and user | Name | Type | Mandatory| Description | | ---------- | ------ | ---- | -------------- | -| bundleName | string | Yes | Bundle name of the application.| +| bundleName | string | Yes | Bundle name.| | userId | number | Yes | User ID.| **Return value** @@ -45,7 +45,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc | ID| Error Message | | -------- | ---------------------------------------- | | 17700001 | The specified bundle name is not found. | -| 17700004 | The specified userId is not found. | +| 17700004 | The specified user ID is not found. | **Example** @@ -55,12 +55,13 @@ import launcherBundleManager from '@ohos.bundle.launcherBundleManager'; try { launcherBundleManager.getLauncherAbilityInfo('com.example.demo', 100, (errData, data) => { if (errData !== null) { - console.log(`errData is errCode:${errData.code} message:${errData.message}`); + console.error(`errData is errCode:${errData.code} message:${errData.message}`); + } else { + console.log("data is " + JSON.stringify(data)); } - console.log("data is " + JSON.stringify(data)); }) } catch (errData) { - console.log(`errData is errCode:${errData.code} message:${errData.message}`); + console.error(`errData is errCode:${errData.code} message:${errData.message}`); } ``` @@ -80,7 +81,7 @@ Obtains the launcher ability information based on the given bundle name and user | Name | Type | Mandatory| Description | | ---------- | ------ | ---- | -------------- | -| bundleName | string | Yes | Bundle name of the application.| +| bundleName | string | Yes | Bundle name.| | userId | number | Yes | User ID.| **Return value** @@ -96,7 +97,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc | ID| Error Message | | -------- | ---------------------------------------- | | 17700001 | The specified bundle name is not found. | -| 17700004 | The specified userId is not found. | +| 17700004 | The specified user ID is not found. | **Example** @@ -107,10 +108,10 @@ try { launcherBundleManager.getLauncherAbilityInfo("com.example.demo", 100).then(data => { console.log("data is " + JSON.stringify(data)); }).catch (errData => { - console.log(`errData is errCode:${errData.code} message:${errData.message}`); + console.error(`errData is errCode:${errData.code} message:${errData.message}`); }) } catch (errData) { - console.log(`errData is errCode:${errData.code} message:${errData.message}`); + console.error(`errData is errCode:${errData.code} message:${errData.message}`); } ``` @@ -144,7 +145,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc | ID| Error Message | | -------- | ---------------------------------------- | -| 17700004 | The specified userId is not found. | +| 17700004 | The specified user ID is not found. | Example @@ -154,12 +155,13 @@ import launcherBundleManager from '@ohos.bundle.launcherBundleManager'; try { launcherBundleManager.getAllLauncherAbilityInfo(100, (errData, data) => { if (errData !== null) { - console.log(`errData is errCode:${errData.code} message:${errData.message}`); + console.error(`errData is errCode:${errData.code} message:${errData.message}`); + } else { + console.log("data is " + JSON.stringify(data)); } - console.log("data is " + JSON.stringify(data)); }); } catch (errData) { - console.log(`errData is errCode:${errData.code} message:${errData.message}`); + console.error(`errData is errCode:${errData.code} message:${errData.message}`); } ``` ## launcherBundlemanager.getAllLauncherAbilityInfo9+ @@ -192,7 +194,7 @@ For details about the error codes, see [Bundle Error Codes](../errorcodes/errorc | ID| Error Message | | -------- | ---------------------------------------- | -| 17700004 | The specified userId is not found. | +| 17700004 | The specified user ID is not found. | **Example** @@ -203,10 +205,10 @@ try { launcherBundleManager.getAllLauncherAbilityInfo(100).then(data => { console.log("data is " + JSON.stringify(data)); }).catch (errData => { - console.log(`errData is errCode:${errData.code} message:${errData.message}`); + console.error(`errData is errCode:${errData.code} message:${errData.message}`); }); } catch (errData) { - console.log(`errData is errCode:${errData.code} message:${errData.message}`); + console.error(`errData is errCode:${errData.code} message:${errData.message}`); } ``` @@ -224,7 +226,7 @@ Obtains the shortcut information of the current user based on the given bundle n | Name | Type | Mandatory| Description | | ---------- | ------ | ---- | -------------- | -| bundleName | string | Yes | Bundle name of the application.| +| bundleName | string | Yes | Bundle name.| **Return value** @@ -248,12 +250,13 @@ import launcherBundleManager from '@ohos.bundle.launcherBundleManager'; try { launcherBundleManager.getShortcutInfo("com.example.demo", (errData, data) => { if (errData !== null) { - console.log(`errData is errCode:${errData.code} message:${errData.message}`); + console.error(`errData is errCode:${errData.code} message:${errData.message}`); + } else { + console.log("data is " + JSON.stringify(data)); } - console.log("data is " + JSON.stringify(data)); }); } catch (errData) { - console.log(`errData is errCode:${errData.code} message:${errData.message}`); + console.error(`errData is errCode:${errData.code} message:${errData.message}`); } ``` @@ -271,7 +274,7 @@ Obtains the shortcut information of the current user based on the given bundle n | Name | Type | Mandatory| Description | | ---------- | ------ | ---- | -------------- | -| bundleName | string | Yes | Bundle name of the application.| +| bundleName | string | Yes | Bundle name.| **Return value** @@ -296,9 +299,9 @@ try { launcherBundleManager.getShortcutInfo("com.example.demo").then(data => { console.log("data is " + JSON.stringify(data)); }).catch (errData => { - console.log(`errData is errCode:${errData.code} message:${errData.message}`); + console.error(`errData is errCode:${errData.code} message:${errData.message}`); }); } catch (errData) { - console.log(`errData is errCode:${errData.code} message:${errData.message}`); + console.error(`errData is errCode:${errData.code} message:${errData.message}`); } ``` diff --git a/en/application-dev/reference/apis/js-apis-matrix4.md b/en/application-dev/reference/apis/js-apis-matrix4.md index 057e05ac3fd59f22e9bcea5b0fd6064142e95602..b707f54df167497056052a8524ec00d7bbe11188 100644 --- a/en/application-dev/reference/apis/js-apis-matrix4.md +++ b/en/application-dev/reference/apis/js-apis-matrix4.md @@ -19,7 +19,7 @@ import matrix4 from '@ohos.matrix4' init(array: Array<number>): Matrix4Transit -Matrix constructor, which is used to create a 4x4 matrix by using the input parameter. Column-major order is used. +Matrix constructor, which is used to create a 4 x 4 matrix by using the input parameter. Column-major order is used. **System capability**: SystemCapability.ArkUI.ArkUI.Full @@ -33,7 +33,7 @@ Matrix constructor, which is used to create a 4x4 matrix by using the input para | Type | Description | | -------------- | ---------------------------- | -| Matrix4Transit | 4x4 matrix object created based on the input parameter.| +| Matrix4Transit | 4 x 4 matrix object created based on the input parameter.| **array** parameters @@ -281,11 +281,11 @@ Translates this matrix object along the x, y, and z axes. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------------------------- | -| x | number | No | Translation distance along the x-axis, in px.
Default value: **0**| -| y | number | No | Translation distance along the y-axis, in px.
Default value: **0**| -| z | number | No | Translation distance along the z-axis, in px.
Default value: **0**| +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ----------------------------------------------------------- | +| x | number | No | Translation distance along the x-axis, in px.
Default value: **0**
Value range: (-∞, +∞)| +| y | number | No | Translation distance along the y-axis, in px.
Default value: **0**
Value range: (-∞, +∞)| +| z | number | No | Translation distance along the z-axis, in px.
Default value: **0**
Value range: (-∞, +∞)| **Return value** @@ -328,13 +328,13 @@ Scales this matrix object along the x, y, and z axes. **Parameters** -| Name | Type | Mandatory| Description | -| ------- | ------ | ---- | --------------------------------- | -| x | number | No | Scaling multiple along the x-axis.
Default value: **1** | -| y | number | No | Scaling multiple along the y-axis.
Default value: **1** | -| z | number | No | Scaling multiple along the z-axis.
Default value: **1** | -| centerX | number | No | X coordinate of the center point.
Default value: **0**| -| centerY | number | No | Y coordinate of the center point.
Default value: **0**| +| Name | Type | Mandatory| Description | +| ------- | ------ | ---- | ------------------------------------------------------------ | +| x | number | No | Scaling multiple along the x-axis. If the value is greater than 1, the image is scaled up along the x-axis. If the value is less than 1, the image is scaled down along the x-axis.
Default value: **1**
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the default value.| +| y | number | No | Scaling multiple along the y-axis. If the value is greater than 1, the image is scaled up along the y-axis. If the value is less than 1, the image is scaled down along the y-axis.
Default value: **1**
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the default value.| +| z | number | No | Scaling multiple along the z-axis. If the value is greater than 1, the image is scaled up along the z-axis. If the value is less than 1, the image is scaled down along the z-axis.
Default value: **1**
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the default value.| +| centerX | number | No | X coordinate of the center point.
Default value: **0**
Value range: (-∞, +∞) | +| centerY | number | No | Y coordinate of the center point.
Default value: **0**
Value range: (-∞, +∞) | **Return value** @@ -376,14 +376,14 @@ Rotates this matrix object along the x, y, and z axes. **Parameters** -| Name | Type | Mandatory| Description | -| ------- | ------ | ---- | --------------------------------- | -| x | number | No | X coordinate of the rotation axis vector.
Default value: **1** | -| y | number | No | Y coordinate of the rotation axis vector.
Default value: **1** | -| z | number | No | Z coordinate of the rotation axis vector.
Default value: **1** | -| angle | number | No | Rotation angle.
Default value: **0** | -| centerX | number | No | X coordinate of the center point.
Default value: **0**| -| centerY | number | No | Y coordinate of the center point.
Default value: **0**| +| Name | Type | Mandatory| Description | +| ------- | ------ | ---- | ------------------------------------------------------- | +| x | number | No | X coordinate of the rotation axis vector.
Default value: **1**
Value range: (-∞, +∞)| +| y | number | No | Y coordinate of the rotation axis vector.
Default value: **1**
Value range: (-∞, +∞)| +| z | number | No | Z coordinate of the rotation axis vector.
Default value: **1**
Value range: (-∞, +∞)| +| angle | number | No | Rotation angle.
Default value: **0** | +| centerX | number | No | X coordinate of the center point.
Default value: **0** | +| centerY | number | No | Y coordinate of the center point.
Default value: **0** | **Return value** @@ -458,7 +458,7 @@ struct Test { .width('600px') .height('300px') .margin({ top: 50 }) - Text(`Coordinates before matrix transformation: [${this.transformPoint}]`) + Text(`Coordinates after matrix transformation: [${this.transformPoint}]`) .fontSize(16) .margin({ top: 100 }) Image($r("app.media.image")) diff --git a/en/application-dev/reference/apis/js-apis-measure.md b/en/application-dev/reference/apis/js-apis-measure.md new file mode 100644 index 0000000000000000000000000000000000000000..3e608c26158d219fc76ace69899da778ad6ea576 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-measure.md @@ -0,0 +1,127 @@ +# @ohos.measure (Text Measurement) + +The **measure** module provides APIs for measuring text metrics, such as text height and width. + +> **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 measure from '@ohos.measure' +``` + +## measure.measureText + +measureText(options: MeasureOptions): double + +Measures the width of the given single-line text. + +**System capability**: SystemCapability.ArkUI.ArkUI.Full + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------- | ------------------------------- | ---- | --------- | +| options | [MeasureOptions](#measureoptions) | Yes | Information about the measured text.| + +**Return value** + +| Type | Description | +| ------------ | --------- | +| double | Text width.
The unit is px.| + + +**Example** + +```ts +import measure from '@ohos.measure' +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + @State textWidth : number = measure.measureText({ + textContent: "Hello word", + fontSize: '50px' + }) + build() { + Row() { + Column() { + Text("The width of 'Hello World': " + this.textWidth) + } + .width('100%') + } + .height('100%') + } +} +``` + +## measure.measureTextSize10+ + +measureTextSize(options: MeasureOptions): SizeOptions + +Measures the width of the given single-line text. + +**System capability**: SystemCapability.ArkUI.ArkUI.Full + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------- | ------------------------------- | ---- | --------- | +| options | [MeasureOptions](#measureoptions) | Yes | Information about the measured text.| + +**Return value** + +| Type | Description | +| ------------ | --------- | +| SizeOptions | Layout width and height occupied by the text.
The unit is px.| + + +**Example** + +```ts +import measure from '@ohos.measure' +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + textSize : SizeOptions = measure.measureTextSize({ + textContent: "Hello word", + fontSize: '50px' + }) + build() { + Row() { + Column() { + Text("The width of 'Hello World': " + this.textSize.width) + Text("The height of 'Hello World': " + this.textSize.height) + } + .width('100%') + } + .height('100%') + } +} +``` + +## MeasureOptions + +Provides attributes of the measured text. + +**System capability**: SystemCapability.ArkUI.ArkUI.Full + +| Name | Type | Mandatory| Description | +| -------------- | -------------------------------------------------------------------------------------------------- | ---- | ----------------------------------------------- | +| textContent | string | Yes | Content of the measured text. | +| constraintWidth10+ | number \| string \| [Resource](../arkui-ts/ts-types.md#resource) | No | Layout width of the measured text.
The default unit is vp. | +| fontSize | number \| string \| [Resource](../arkui-ts/ts-types.md#resource) | No | Font size of the measured text. If the value is of the number type, the unit fp is used.
Default value: **16fp**
**NOTE**
The value cannot be a percent string. | +| fontStyle | number \| [FontStyle](../arkui-ts/ts-appendix-enums.md#fontstyle) | No | Font style of the measured text.
Default value: **FontStyle.Normal** | +| fontWeight | number \| string \| [FontWeight](../arkui-ts/ts-appendix-enums.md#fontweight) | No | Font width of the measured text. For the number type, the value ranges from 100 to 900, at an interval of 100. The default value is **400**. A larger value indicates a heavier font weight. The string type supports only the string of the number type, for example, **400**, **"bold"**, **"bolder"**, **"lighter"**, **"regular"**, and **"medium"**, which correspond to the enumerated values in **FontWeight**.
Default value: **FontWeight.Normal**| +| fontFamily | string \| [Resource](../arkui-ts/ts-types.md#resource) | No | Font family of the measured text. Default value: **'HarmonyOS Sans'**
Only the default font is supported.| +| letterSpacing | number \| string | No | Letter spacing of the measured text.| +| textAlign10+ | number \| [TextAlign](../arkui-ts/ts-appendix-enums.md#textalign) | No | Horizontal alignment mode of the measured text.
Default value: **TextAlign.Start**| +| overflow10+ | number \| [TextOverflow](../arkui-ts/ts-appendix-enums.md#textoverflow) | No | Display mode when the measured text is too long.| +| maxLines10+ | number | No | Maximum number of lines in the measured text.| +| lineHeight10+ | number \| string \| [Resource](../arkui-ts/ts-types.md#resource) | No | Line height of the measured text.| +| baselineOffset10+ | number \| string | No | Baseline offset of the measured text.
Default value: **0**| +| textCase10+ | number \| [TextCase](../arkui-ts/ts-appendix-enums.md#textcase) | No | Case of the measured text.
Default value: **TextCase.Normal**| diff --git a/en/application-dev/reference/apis/js-apis-media.md b/en/application-dev/reference/apis/js-apis-media.md index 3d29422be8cb7f4c363d3272fa1d00dae4019bc9..a0d85f43ee33d674268067dedf450ac5c300419a 100644 --- a/en/application-dev/reference/apis/js-apis-media.md +++ b/en/application-dev/reference/apis/js-apis-media.md @@ -357,20 +357,25 @@ For details about the AVPlayer demo, see [AVPlayer Development](../../media/avpl **System capability**: SystemCapability.Multimedia.Media.AVPlayer -| Name | Type | Readable| Writable| Description | -| --------------------------------------------------- | ------------------------------------------------------ | ---- | ---- | ------------------------------------------------------------ | -| url9+ | string | Yes | Yes | URL of the media asset. It is a static attribute and can be set only when the AVPlayer is in the idle state.
The video formats MP4, MPEG-TS, WebM, and MKV are supported.
The audio formats M4A, AAC, MP3, OGG, and WAV are supported.
**Examples of supported URLs**:
1. FD: fd://xx
![](figures/en-us_image_url.png)
2. HTTP: http://xx
3. HTTPS: https://xx
4. HLS: http://xx or https://xx| -| fdSrc9+ | [AVFileDescriptor](#avfiledescriptor9) | Yes | Yes | FD of the media asset. It is a static attribute and can be set only when the AVPlayer is in the idle state.
This attribute is required when media assets of an application are continuously stored in a file.
**Example:**
Assume that a media file that stores continuous assets consists of the following:
Video 1 (address offset: 0, byte length: 100)
Video 2 (address offset: 101; byte length: 50)
Video 3 (address offset: 151, byte length: 150)
1. To play video 1: AVFileDescriptor {fd = resource handle; offset = 0; length = 100; }
2. To play video 2: AVFileDescriptor {fd = resource handle; offset = 101; length = 50; }
3. To play video 3: AVFileDescriptor {fd = resource handle; offset = 151; length = 150; }
To play an independent media file, use **src=fd://xx**.| -| surfaceId9+ | string | Yes | Yes | Video window ID. By default, there is no video window. It is a static attribute and can be set only when the AVPlayer is in the initialized state.
It is used to render the window for video playback and therefore is not required in audio-only playback scenarios.
**Example:**
[Create a surface ID through XComponent](../arkui-ts/ts-basic-components-xcomponent.md#getxcomponentsurfaceid).| -| loop9+ | boolean | Yes | Yes | Whether to loop playback. The value **true** means to loop playback, and **false** (default) means the opposite. It is a dynamic attribute
and can be set only when the AVPlayer is in the prepared, playing, paused, or completed state.| -| videoScaleType9+ | [VideoScaleType](#videoscaletype9) | Yes | Yes | Video scaling type. The default value is **VIDEO_SCALE_TYPE_FIT_CROP**. It is a dynamic attribute
and can be set only when the AVPlayer is in the prepared, playing, paused, or completed state.| -| audioInterruptMode9+ | [audio.InterruptMode](js-apis-audio.md#interruptmode9) | Yes | Yes | Audio interruption mode. The default value is **SHARE_MODE**. It is a dynamic attribute
and can be set only when the AVPlayer is in the prepared, playing, paused, or completed state.| +| Name | Type | Readable| Writable| Description | +| --------------------------------------------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------------------------------------ | +| url9+ | string | Yes | Yes | URL of the media asset. It is a static attribute and can be set only when the AVPlayer is in the idle state.
The video formats MP4, MPEG-TS, WebM, and MKV are supported.
The audio formats M4A, AAC, MP3, OGG, and WAV are supported.
**Examples of supported URLs**:
1. FD: fd://xx
![](figures/en-us_image_url.png)
2. HTTP: http://xx
3. HTTPS: https://xx
4. HLS: http://xx or https://xx| +| fdSrc9+ | [AVFileDescriptor](#avfiledescriptor9) | Yes | Yes | FD of the media asset. It is a static attribute and can be set only when the AVPlayer is in the idle state.
This attribute is required when media assets of an application are continuously stored in a file.
**Example:**
Assume that a media file that stores continuous assets consists of the following:
Video 1 (address offset: 0, byte length: 100)
Video 2 (address offset: 101; byte length: 50)
Video 3 (address offset: 151, byte length: 150)
1. To play video 1: AVFileDescriptor {fd = resource handle; offset = 0; length = 100; }
2. To play video 2: AVFileDescriptor {fd = resource handle; offset = 101; length = 50; }
3. To play video 3: AVFileDescriptor {fd = resource handle; offset = 151; length = 150; }
To play an independent media file, use **src=fd://xx**.| +| dataSrc10+ | [AVDataSrcDescriptor](#avdatasrcdescriptor10) | Yes | Yes | Descriptor of a streaming media asset. It is a static attribute and can be set only when the AVPlayer is in the idle state.
Use scenario: An application starts playing a media file while the file is still being downloaded from the remote to the local host.
**Example:**
A user is obtaining an audio and video file from a remote server and wants to play the downloaded file content. To implement this scenario, do as follows:
1. Obtain the total file size, in bytes. If the total size cannot be obtained or the live mode is expected, set **fileSize** to **-1**.
2. Implement the **func** callback to fill in data. If **fileSize** is **-1**, the format of **func** is **func(buffer: ArrayBuffer, length: number)**; otherwise, the format is **func(buffer: ArrayBuffer, length: number, pos: number)**.
3. Set **AVDataSrcDescriptor {fileSize = size, callback = func}**.| +| surfaceId9+ | string | Yes | Yes | Video window ID. By default, there is no video window. It is a static attribute and can be set only when the AVPlayer is in the initialized state.
It is used to render the window for video playback and therefore is not required in audio-only playback scenarios.
**Example:**
[Create a surface ID through XComponent](../arkui-ts/ts-basic-components-xcomponent.md#getxcomponentsurfaceid).| +| loop9+ | boolean | Yes | Yes | Whether to loop playback. The value **true** means to loop playback, and **false** (default) means the opposite. It is a dynamic attribute
and can be set only when the AVPlayer is in the prepared, playing, paused, or completed state.| +| videoScaleType9+ | [VideoScaleType](#videoscaletype9) | Yes | Yes | Video scaling type. The default value is **VIDEO_SCALE_TYPE_FIT_CROP**. It is a dynamic attribute
and can be set only when the AVPlayer is in the prepared, playing, paused, or completed state.| +| audioInterruptMode9+ | [audio.InterruptMode](js-apis-audio.md#interruptmode9) | Yes | Yes | Audio interruption mode. The default value is **SHARE_MODE**. It is a dynamic attribute
and can be set only when the AVPlayer is in the prepared, playing, paused, or completed state.| | audioRendererInfo10+ | [audio.AudioRendererInfo](js-apis-audio.md#audiorendererinfo8) | Yes | Yes | Audio renderer information. The default value of **contentType** is **CONTENT_TYPE_MUSIC**, and the default value of **streamUsage** is **STREAM_USAGE_MEDIA**.
It can be set only when the AVPlayer is in the initialized state.| -| state9+ | [AVPlayerState](#avplayerstate9) | Yes | No | AVPlayer state. It can be used as a query parameter when the AVPlayer is in any state. | -| currentTime9+ | number | Yes | No | Current video playback position, in ms. It can be used as a query parameter when the AVPlayer is in the prepared, playing, paused, or completed state.
The value **-1** indicates an invalid value.| -| duration9+ | number | Yes | No | Video duration, in ms. It can be used as a query parameter when the AVPlayer is in the prepared, playing, paused, or completed state.
The value **-1** indicates an invalid value.
In live streaming scenarios, **-1** is returned by default.| -| width9+ | number | Yes | No | Video width, in pixels. It can be used as a query parameter when the AVPlayer is in the prepared, playing, paused, or completed state.
The value **0** indicates an invalid value.| -| height9+ | number | Yes | No | Video height, in pixels. It can be used as a query parameter when the AVPlayer is in the prepared, playing, paused, or completed state.
The value **0** indicates an invalid value.| +| state9+ | [AVPlayerState](#avplayerstate9) | Yes | No | AVPlayer state. It can be used as a query parameter when the AVPlayer is in any state. | +| currentTime9+ | number | Yes | No | Current video playback position, in ms. It can be used as a query parameter when the AVPlayer is in the prepared, playing, paused, or completed state.
The value **-1** indicates an invalid value.| +| duration9+ | number | Yes | No | Video duration, in ms. It can be used as a query parameter when the AVPlayer is in the prepared, playing, paused, or completed state.
The value **-1** indicates an invalid value.
In live streaming scenarios, **-1** is returned by default.| +| width9+ | number | Yes | No | Video width, in pixels. It can be used as a query parameter when the AVPlayer is in the prepared, playing, paused, or completed state.
The value **0** indicates an invalid value.| +| height9+ | number | Yes | No | Video height, in pixels. It can be used as a query parameter when the AVPlayer is in the prepared, playing, paused, or completed state.
The value **0** indicates an invalid value.| + +**NOTE** + +After the resource handle (FD) is transferred to the AVPlayer, do not use the resource handle to perform read and write operations, including but not limited to transferring it to multiple AVPlayers. Competition occurs when multiple AVPlayers use the same resource handle to read and write files at the same time, resulting in playback errors. ### on('stateChange')9+ @@ -927,6 +932,14 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js +printfDescription(obj) { + for (let item in obj) { + let property = obj[item]; + console.info('audio key is ' + item); + console.info('audio value is ' + property); + } +} + avPlayer.getTrackDescription((error, arrList) => { if ((arrList) != null) { for (let i = 0; i < arrList.length; i++) { @@ -964,6 +977,14 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco ```js let arrayDescription; + +printfDescription(obj) { + for (let item in obj) { + let property = obj[item]; + console.info('audio key is ' + item); + console.info('audio value is ' + property); + } +} avPlayer.getTrackDescription().then((arrList) => { if (arrList != null) { arrayDescription = arrList; @@ -1060,7 +1081,7 @@ Sets the playback speed. This API can be called only when the AVPlayer is in the **Example** ```js -avPlayer.setSpeed(media.AVPlayerSpeed.SPEED_FORWARD_2_00_X) +avPlayer.setSpeed(media.PlaybackSpeed.SPEED_FORWARD_2_00_X) ``` ### on('speedDone')9+ @@ -1553,6 +1574,8 @@ Subscribes to the audio interruption event. When multiple audio and video assets **Example** ```js +import audio from '@ohos.multimedia.audio'; + avPlayer.on('audioInterrupt', (info: audio.InterruptEvent) => { console.info('audioInterrupt success,and InterruptEvent info is:' + info) }) @@ -1586,7 +1609,7 @@ Enumerates the states of the [AVPlayer](#avplayer9). Your application can proact | Name | Type | Description | | :-----------------------------: | :----: | :----------------------------------------------------------- | -| idle | string | The AVPlayer enters this state after [createAVPlayer()](#mediacreateavplayer9) or **reset()** is called.
In case **createAVPlayer()** is used, all attributes are set to their default values.
In case **reset()** is invoked, the **url9+** or **fdSrc9+** attribute is reset, and other attributes set by the application are retained.| +| idle | string | The AVPlayer enters this state after [createAVPlayer()](#mediacreateavplayer9) or **reset()** is called.
In case **createAVPlayer()** is used, all attributes are set to their default values.
In case **reset()** is called, the **url9+**, **fdSrc9+**, or **dataSrc10+** attribute and the **loop** attribute are reset, and other attributes are retained.| | initialized | string | The AVPlayer enters this state after **url9+** or **fdSrc9+** attribute is set in the idle state. In this case, you can configure static attributes such as the window and audio.| | prepared | string | The AVPlayer enters this state when **prepare()** is called in the initialized state. In this case, the playback engine has prepared the resources.| | playing | string | The AVPlayer enters this state when **play()** is called in the prepared, paused, or completed state.| @@ -1608,6 +1631,18 @@ Describes an audio and video file asset. It is used to specify a particular asse | offset | number | Yes | Resource offset, which needs to be entered based on the preset asset information. An invalid value causes a failure to parse audio and video assets.| | length | number | Yes | Resource length, which needs to be entered based on the preset asset information. An invalid value causes a failure to parse audio and video assets.| +## AVDataSrcDescriptor10+ + +Defines the descriptor of an audio and video file, which is used in DataSource playback mode.
Use scenario: An application can create a playback instance and start playback before it finishes downloading the audio and video resources. + +**System capability**: SystemCapability.Multimedia.Media.AVPlayer + +| Name | Type | Mandatory| Description | +| ------ | ------ | ---- | ------------------------------------------------------------ | +| fileSize | number | Yes | Size of the file to play, in bytes. The value **-1** indicates that the size is unknown. If **fileSize** is set to **-1**, the playback mode is similar to the live mode. In this mode, the **seek** and **setSpeed** operations cannot be performed, and the **loop** attribute cannot be set, indicating that loop playback is unavailable.| +| callback | function | Yes | Callback used to fill in data.
- **buffer**: memory to be filled. The value is of the ArrayBuffer type. This parameter is mandatory.
- **length**: maximum length of the memory to be filled. The value is of the number type. This parameter is mandatory.
- **pos**: position of the data to be filled in the file. The value is of the number type. This parameter is optional. When **fileSize** is set to **-1**, this parameter cannot be used.| + + ## SeekMode8+ Enumerates the video playback seek modes, which can be passed in the **seek** API. @@ -1742,7 +1777,7 @@ let AVRecorderConfig = { location : { latitude : 30, longitude : 130 } } -AVRecorder.prepare(AVRecorderConfig, (err) => { +avRecorder.prepare(AVRecorderConfig, (err) => { if (err == null) { console.info('prepare success'); } else { @@ -1813,7 +1848,7 @@ let AVRecorderConfig = { location : { latitude : 30, longitude : 130 } } -AVRecorder.prepare(AVRecorderConfig).then(() => { +avRecorder.prepare(AVRecorderConfig).then(() => { console.info('prepare success'); }).catch((err) => { console.info('prepare failed and catch error is ' + err.message); @@ -1854,7 +1889,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco ```js let surfaceID = null; // The surfaceID is transferred to the camera API to create a videoOutput instance. -AVRecorder.getInputSurface((err, surfaceId) => { +avRecorder.getInputSurface((err, surfaceId) => { if (err == null) { console.info('getInputSurface success'); surfaceID = surfaceId; @@ -1863,8 +1898,6 @@ AVRecorder.getInputSurface((err, surfaceId) => { } }); -// videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID); - ``` ### getInputSurface9+ @@ -1900,14 +1933,12 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco ```js let surfaceID = null; // The surfaceID is transferred to the camera API to create a videoOutput instance. -AVRecorder.getInputSurface().then((surfaceId) => { +avRecorder.getInputSurface().then((surfaceId) => { console.info('getInputSurface success'); surfaceID = surfaceId; }).catch((err) => { console.info('getInputSurface failed and catch error is ' + err.message); }); - -// videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID); ``` ### start9+ @@ -1939,7 +1970,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js -AVRecorder.start((err) => { +avRecorder.start((err) => { if (err == null) { console.info('start AVRecorder success'); } else { @@ -1977,7 +2008,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js -AVRecorder.start().then(() => { +avRecorder.start().then(() => { console.info('start AVRecorder success'); }).catch((err) => { console.info('start AVRecorder failed and catch error is ' + err.message); @@ -2013,7 +2044,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js -AVRecorder.pause((err) => { +avRecorder.pause((err) => { if (err == null) { console.info('pause AVRecorder success'); } else { @@ -2051,7 +2082,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js -AVRecorder.pause().then(() => { +avRecorder.pause().then(() => { console.info('pause AVRecorder success'); }).catch((err) => { console.info('pause AVRecorder failed and catch error is ' + err.message); @@ -2087,7 +2118,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js -AVRecorder.resume((err) => { +avRecorder.resume((err) => { if (err == null) { console.info('resume AVRecorder success'); } else { @@ -2125,7 +2156,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js -AVRecorder.resume().then(() => { +avRecorder.resume().then(() => { console.info('resume AVRecorder success'); }).catch((err) => { console.info('resume AVRecorder failed and catch error is ' + err.message); @@ -2163,7 +2194,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js -AVRecorder.stop((err) => { +avRecorder.stop((err) => { if (err == null) { console.info('stop AVRecorder success'); } else { @@ -2203,7 +2234,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js -AVRecorder.stop().then(() => { +avRecorder.stop().then(() => { console.info('stop AVRecorder success'); }).catch((err) => { console.info('stop AVRecorder failed and catch error is ' + err.message); @@ -2238,7 +2269,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js -AVRecorder.reset((err) => { +avRecorder.reset((err) => { if (err == null) { console.info('reset AVRecorder success'); } else { @@ -2275,7 +2306,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js -AVRecorder.reset().then(() => { +avRecorder.reset().then(() => { console.info('reset AVRecorder success'); }).catch((err) => { console.info('reset AVRecorder failed and catch error is ' + err.message); @@ -2309,7 +2340,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js -AVRecorder.release((err) => { +avRecorder.release((err) => { if (err == null) { console.info('release AVRecorder success'); } else { @@ -2345,7 +2376,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js -AVRecorder.release().then(() => { +avRecorder.release().then(() => { console.info('release AVRecorder success'); }).catch((err) => { console.info('release AVRecorder failed and catch error is ' + err.message); @@ -2370,9 +2401,8 @@ Subscribes to AVRecorder state changes. An application can subscribe to only one **Example** ```js -AVRecorder.on('stateChange', async (state, reason) => { +avRecorder.on('stateChange', async (state, reason) => { console.info('case state has changed, new state is :' + state + ',and new reason is : ' + reason); - } }); ``` @@ -2393,7 +2423,7 @@ Unsubscribes from AVRecorder state changes. **Example** ```js -AVRecorder.off('stateChange'); +avRecorder.off('stateChange'); ``` ### on('error')9+ @@ -2425,7 +2455,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js -AVRecorder.on('error', (err) => { +avRecorder.on('error', (err) => { console.info('case avRecorder.on(error) called, errMessage is ' + err.message); }); ``` @@ -2456,7 +2486,7 @@ For details about the error codes, see [Media Error Codes](../errorcodes/errorco **Example** ```js -AVRecorder.off('error'); +avRecorder.off('error'); ``` ## AVRecorderState9+ @@ -2486,7 +2516,7 @@ Describes the audio and video recording parameters. | audioSourceType | [AudioSourceType](#audiosourcetype9) | No | Type of the audio source to record. This parameter is mandatory for audio recording. | | videoSourceType | [VideoSourceType](#videosourcetype9) | No | Type of the video source to record. This parameter is mandatory for video recording. | | profile | [AVRecorderProfile](#avrecorderprofile9) | Yes | Recording profile. This parameter is mandatory. | -| url | string | Yes | Recording output URL: fd://xx (fd number).
![img](figures/en-us_image_url.png)
This parameter is mandatory. | +| url | string | Yes | Recording output URL: fd://xx (fd number).
![img](figures/en-us_image_url.png)
This parameter is mandatory.| | rotation | number | No | Rotation angle of the recorded video. The value can only be 0, 90, 180, or 270. | | location | [Location](#location) | No | Geographical location of the recorded video. | @@ -3759,7 +3789,7 @@ Subscribes to the audio playback events. | Name | Type | Mandatory| Description | | -------- | ---------- | ---- | ------------------------------------------------------------ | -| 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. | +| 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** @@ -4874,7 +4904,7 @@ Subscribes to the audio recording events. | Name | Type | Mandatory| Description | | -------- | -------- | ---- | ------------------------------------------------------------ | -| type | string | Yes | Event type. The following events are supported:
- 'prepare': triggered when the [prepare](#audiorecorder_prepare) API is called and the audio recording parameters are set.
- 'start': triggered when the [start](#audiorecorder_start) API is called and audio recording starts.
- 'pause': triggered when the [pause](#audiorecorder_pause) API is called and audio recording is paused.
- 'resume': triggered when the [resume](#audiorecorder_resume) API is called and audio recording is resumed.
- 'stop': triggered when the [stop](#audiorecorder_stop) API is called and audio recording stops.
- 'release': triggered when the [release](#audiorecorder_release) API is called and the recording resources are released.
- 'reset': 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': triggered when the [prepare](#audiorecorder_prepare) API is called and the audio recording parameters are set.
- 'start': triggered when the [start](#audiorecorder_start) API is called and audio recording starts.
- 'pause': triggered when the [pause](#audiorecorder_pause) API is called and audio recording is paused.
- 'resume': triggered when the [resume](#audiorecorder_resume) API is called and audio recording is resumed.
- 'stop': triggered when the [stop](#audiorecorder_stop) API is called and audio recording stops.
- 'release': triggered when the [release](#audiorecorder_release) API is called and the recording resources are released.
- 'reset': 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** diff --git a/en/application-dev/reference/apis/js-apis-medialibrary.md b/en/application-dev/reference/apis/js-apis-medialibrary.md index 0ee9b746e29fd8bb0473b664a1acabd0f2f157ae..240108ae1849dfb2fd04d927728c653cdb4627f7 100644 --- a/en/application-dev/reference/apis/js-apis-medialibrary.md +++ b/en/application-dev/reference/apis/js-apis-medialibrary.md @@ -2,7 +2,10 @@ > **NOTE** > -> The APIs of this module are supported since API version 6. Updates will be marked with a superscript to indicate their earliest API version. +> - The APIs of this module are supported since API version 6. Updates will be marked with a superscript to indicate their earliest API version. +> - This API is deprecated since API version 9 and will be retained until API version 13. +> - Certain functionalities are changed as system APIs and can be used only by system applications. To use these functionalities, call [@ohos.filemanagement.userFileManager](js-apis-userFileManager.md). +> - The functionalities for selecting and storing media assets are still open to common applications. To use these functionalities, call [@ohos.file.picker](js-apis-file-picker.md). ## Modules to Import ```js @@ -34,6 +37,7 @@ This API can be used only in the stage model. **Example (from API version 9)** ```ts +// Obtain a MediaLibrary instance. The instance obtained here is used in later. const context = getContext(this); let media = mediaLibrary.getMediaLibrary(context); ``` @@ -92,46 +96,54 @@ Obtains file assets (also called files). This API uses an asynchronous callback **Example** ```js -let fileKeyObj = mediaLibrary.FileKey; -let imageType = mediaLibrary.MediaType.IMAGE; -let imagesFetchOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], -}; -media.getFileAssets(imagesFetchOp, (error, fetchFileResult) => { - if (fetchFileResult == undefined) { - console.error('Failed to get fetchFileResult: ' + error); - return; - } - const count = fetchFileResult.getCount(); - if (count < 0) { - console.error('Failed to get count from fetchFileResult: count: ' + count); - return; - } - if (count == 0) { - console.info('The count of fetchFileResult is zero'); - return; - } - - console.info('Get fetchFileResult success, count: ' + count); - fetchFileResult.getFirstObject((err, fileAsset) => { - if (fileAsset == undefined) { - console.error('Failed to get first object: ' + err); +async function example() { + let fileKeyObj = mediaLibrary.FileKey; + let imageType = mediaLibrary.MediaType.IMAGE; + // Create options for fetching the files. The options are used to obtain files of the image type. + let imagesFetchOp = { + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + }; + // Obtain the files in asynchronous callback mode. + media.getFileAssets(imagesFetchOp, (error, fetchFileResult) => { + // Check whether the result set of the obtained files is undefined. If yes, the API call fails. + if (fetchFileResult == undefined) { + console.error('get fetchFileResult failed with error: ' + error); return; } - console.info('fileAsset.displayName ' + ': ' + fileAsset.displayName); - for (let i = 1; i < count; i++) { - fetchFileResult.getNextObject((err, fileAsset) => { - if (fileAsset == undefined) { - console.error('Failed to get next object: ' + err); - return; - } - console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); - }) + // Obtain the total number of files in the result set. + const count = fetchFileResult.getCount(); + // Check whether the number is less than 0. If yes, the API call fails. + if (count < 0) { + console.error('get count from fetchFileResult failed, count: ' + count); + return; } + // Check whether the number is 0. If yes, the API call is successful, but the result set is empty. Check whether the options for fetching the files are correctly set and whether the corresponding files exist on the device. + if (count == 0) { + console.info('The count of fetchFileResult is zero'); + return; + } + console.info('Get fetchFileResult successfully, count: ' + count); + // Obtain the first file in the result set in asynchronous callback mode. + fetchFileResult.getFirstObject((error, fileAsset) => { + // Check whether the first file is undefined. If yes, the API call fails. + if (fileAsset == undefined) { + console.error('get first object failed with error: ' + error); + return; + } + console.info('fileAsset.displayName ' + '0 : ' + fileAsset.displayName); + // Call getNextObject to obtain the next file until the last one. + for (let i = 1; i < count; i++) { + let fileAsset = await fetchFileResult.getNextObject(); + console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); + } + // Release the FetchFileResult instance and invalidate it. Other APIs can no longer be called. + fetchFileResult.close(); + }); }); -}); +} ``` + ### getFileAssets7+ getFileAssets(options: MediaFetchOptions): Promise<FetchFileResult> @@ -157,38 +169,48 @@ Obtains file assets. This API uses a promise to return the result. **Example** ```js -let fileKeyObj = mediaLibrary.FileKey; -let imageType = mediaLibrary.MediaType.IMAGE; -let imagesFetchOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], -}; -media.getFileAssets(imagesFetchOp).then(function(fetchFileResult) { - const count = fetchFileResult.getCount(); - if (count < 0) { - console.error('Failed to get count from fetchFileResult: count: ' + count); - return; - } - if (count == 0) { - console.info('The count of fetchFileResult is zero'); - return; - } - console.info('Get fetchFileResult success, count: ' + count); - fetchFileResult.getFirstObject().then(function(fileAsset) { - console.info('fileAsset.displayName ' + ': ' + fileAsset.displayName); - for (let i = 1; i < count; i++) { - fetchFileResult.getNextObject().then(function(fileAsset) { - console.info('fileAsset.displayName ' + ': ' + fileAsset.displayName); - }).catch(function(err) { - console.error('Failed to get next object: ' + err); - }) +async function example() { + let fileKeyObj = mediaLibrary.FileKey; + let imageType = mediaLibrary.MediaType.IMAGE; + // Create options for fetching the files. The options are used to obtain files of the image type. + let imagesFetchOp = { + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + }; + // Obtain the files in promise mode. + media.getFileAssets(imagesFetchOp).then((fetchFileResult) => { + // Obtain the total number of files in the result set. + const count = fetchFileResult.getCount(); + // Check whether the number is less than 0. If yes, the API call fails. + if (count < 0) { + console.error('get count from fetchFileResult failed, count: ' + count); + return; + } + // Check whether the number is 0. If yes, the API call is successful, but the result set is empty. Check whether the options for fetching the files are correctly set and whether the corresponding files exist on the device. + if (count == 0) { + console.info('The count of fetchFileResult is zero'); + return; } - }).catch(function(err) { - console.error('Failed to get first object: ' + err); + console.info('Get fetchFileResult successfully, count: ' + count); + // Obtain the first file in the result set in promise mode. + fetchFileResult.getFirstObject().then((fileAsset) => { + console.info('fileAsset.displayName ' + '0 : ' + fileAsset.displayName); + // Call getNextObject to obtain the next file until the last one. + for (let i = 1; i < count; i++) { + let fileAsset = await fetchFileResult.getNextObject(); + console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); + } + // Release the FetchFileResult instance and invalidate it. Other APIs can no longer be called. + fetchFileResult.close(); + }).catch((error) => { + // Calling getFirstObject fails. + console.error('get first object failed with error: ' + error); + }); + }).catch((error) => { + // Calling getFileAssets fails. + console.error('get file assets failed with error: ' + error); }); -}).catch(function(err){ - console.error("Failed to get file assets: " + err); -}); +} ``` ### on8+ @@ -232,7 +254,7 @@ Unsubscribes from the media library changes. This API uses an asynchronous callb ```js media.off('imageChange', () => { - // stop listening success + // Stop listening successfully. }) ``` @@ -263,11 +285,11 @@ async function example() { let mediaType = mediaLibrary.MediaType.IMAGE; let DIR_IMAGE = mediaLibrary.DirectoryType.DIR_IMAGE; const path = await media.getPublicDirectory(DIR_IMAGE); - media.createAsset(mediaType, 'imageCallBack.jpg', path + 'myPicture/', (err, fileAsset) => { + media.createAsset(mediaType, 'imageCallBack.jpg', path + 'myPicture/', (error, fileAsset) => { if (fileAsset != undefined) { console.info('createAsset successfully, message'); } else { - console.error('createAsset failed, message = ' + err); + console.error('createAsset failed with error: ' + error); } }); } @@ -307,8 +329,8 @@ async function example() { const path = await media.getPublicDirectory(DIR_IMAGE); media.createAsset(mediaType, 'imagePromise.jpg', path + 'myPicture/').then((fileAsset) => { console.info('createAsset successfully, message = ' + JSON.stringify(fileAsset)); - }).catch((err) => { - console.error('createAsset failed, message = ' + err); + }).catch((error) => { + console.error('createAsset failed with error: ' + error); }); } ``` @@ -349,14 +371,15 @@ async function example() { const fetchFileResult = await media.getFileAssets(option); let asset = await fetchFileResult.getFirstObject(); if (asset == undefined) { - console.error('asset not exist') - return + console.error('asset not exist'); + return; } media.deleteAsset(asset.uri).then(() => { - console.info("deleteAsset successfully"); - }).catch((err) => { - console.error("deleteAsset failed with error:"+ err); + console.info('deleteAsset successfully'); + }).catch((error) => { + console.error('deleteAsset failed with error: ' + error); }); + fetchFileResult.close(); } ``` @@ -391,16 +414,17 @@ async function example() { const fetchFileResult = await media.getFileAssets(option); let asset = await fetchFileResult.getFirstObject(); if (asset == undefined) { - console.error('asset not exist') - return + console.error('asset not exist'); + return; } - media.deleteAsset(asset.uri, (err) => { - if (err != undefined) { - console.info("deleteAsset successfully"); + media.deleteAsset(asset.uri, (error) => { + if (error != undefined) { + console.error('deleteAsset failed with error: ' + error); } else { - console.error("deleteAsset failed with error:"+ err); + console.info('deleteAsset successfully'); } }); + fetchFileResult.close(); } ``` @@ -423,11 +447,11 @@ Obtains a public directory. This API uses an asynchronous callback to return the ```js let DIR_CAMERA = mediaLibrary.DirectoryType.DIR_CAMERA; -media.getPublicDirectory(DIR_CAMERA, (err, dicResult) => { +media.getPublicDirectory(DIR_CAMERA, (error, dicResult) => { if (dicResult == 'Camera/') { - console.info('mediaLibraryTest : getPublicDirectory passed'); + console.info('getPublicDirectory DIR_CAMERA successfully'); } else { - console.error('mediaLibraryTest : getPublicDirectory failed'); + console.error('getPublicDirectory DIR_CAMERA failed with error: ' + error); } }); ``` @@ -457,18 +481,21 @@ Obtains a public directory. This API uses a promise to return the result. ```js async function example() { let DIR_CAMERA = mediaLibrary.DirectoryType.DIR_CAMERA; - const dicResult = await media.getPublicDirectory(DIR_CAMERA); - if (dicResult == 'Camera/') { - console.info('MediaLibraryTest : getPublicDirectory'); - } else { - console.error('MediaLibraryTest : getPublicDirectory failed'); - } + media.getPublicDirectory(DIR_CAMERA).then((dicResult) => { + if (dicResult == 'Camera/') { + console.info('getPublicDirectory DIR_CAMERA successfully'); + } else { + console.error('getPublicDirectory DIR_CAMERA failed'); + } + }).catch((error) => { + console.error('getPublicDirectory failed with error: ' + error); + }); } ``` ### getAlbums7+ -getAlbums(options: MediaFetchOptions, callback: AsyncCallback): void +getAlbums(options: MediaFetchOptions, callback: AsyncCallback<Array<Album>>): void Obtains the albums. This API uses an asynchronous callback to return the result. @@ -486,24 +513,24 @@ Obtains the albums. This API uses an asynchronous callback to return the result. **Example** ```js -let AlbumNoArgsfetchOp = { - selections: '', - selectionArgs: [], -}; -media.getAlbums(AlbumNoArgsfetchOp, (err, albumList) => { - if (albumList != undefined) { - const album = albumList[0]; - console.info('album.albumName = ' + album.albumName); - console.info('album.count = ' + album.count); - } else { - console.error('getAlbum fail, message = ' + err); - } -}) +async function example() { + let AlbumNoArgsfetchOp = { + selections: '', + selectionArgs: [], + }; + media.getAlbums(AlbumNoArgsfetchOp, (error, albumList) => { + if (albumList != undefined) { + console.info('getAlbums successfully: ' + JSON.stringify(albumList)); + } else { + console.error('getAlbums failed with error: ' + error); + } + }) +} ``` ### getAlbums7+ -getAlbums(options: MediaFetchOptions): Promise +getAlbums(options: MediaFetchOptions): Promise<Array<Album>> Obtains the albums. This API uses a promise to return the result. @@ -526,15 +553,17 @@ Obtains the albums. This API uses a promise to return the result. **Example** ```js -let AlbumNoArgsfetchOp = { - selections: '', - selectionArgs: [], -}; -media.getAlbums(AlbumNoArgsfetchOp).then(function(albumList){ - console.info("getAlbums successfully:"+ JSON.stringify(albumList)); -}).catch(function(err){ - console.error("getAlbums failed with error: " + err); -}); +async function example() { + let AlbumNoArgsfetchOp = { + selections: '', + selectionArgs: [], + }; + media.getAlbums(AlbumNoArgsfetchOp).then((albumList) => { + console.info('getAlbums successfully: ' + JSON.stringify(albumList)); + }).catch((error) => { + console.error('getAlbums failed with error: ' + error); + }); +} ``` ### release8+ @@ -550,12 +579,12 @@ Call this API when you no longer need to use the APIs in the **MediaLibrary** in | 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 -media.release((err) => { +media.release(() => { // do something }); ``` @@ -581,7 +610,7 @@ Call this API when you no longer need to use the APIs in the **MediaLibrary** in media.release() ``` -### storeMediaAsset(deprecated) +### storeMediaAsset storeMediaAsset(option: MediaAssetOption, callback: AsyncCallback<string>): void @@ -589,7 +618,7 @@ Stores a media asset. This API uses an asynchronous callback to return the URI t > **NOTE** > -> This API is deprecated since API version 9. +> This API is supported since API version 6 and can be used only by the FA model. **System capability**: SystemCapability.Multimedia.MediaLibrary.Core @@ -604,22 +633,22 @@ Stores a media asset. This API uses an asynchronous callback to return the URI t ```js let option = { - src : "/data/storage/el2/base/haps/entry/image.png", - mimeType : "image/*", - relativePath : "Pictures/" + src : '/data/storage/el2/base/haps/entry/image.png', + mimeType : 'image/*', + relativePath : 'Pictures/' }; -mediaLibrary.getMediaLibrary().storeMediaAsset(option, (err, value) => { - if (err) { - console.error("An error occurred when storing media resources."); +mediaLibrary.getMediaLibrary().storeMediaAsset(option, (error, value) => { + if (error) { + console.error('storeMediaAsset failed with error: ' + error); return; } - console.info("Media resources stored. "); + console.info('Media resources stored. '); // Obtain the URI that stores the media asset. }); ``` -### storeMediaAsset(deprecated) +### storeMediaAsset storeMediaAsset(option: MediaAssetOption): Promise<string> @@ -627,7 +656,7 @@ Stores a media asset. This API uses a promise to return the URI that stores the > **NOTE** > -> This API is deprecated since API version 9. +> This API is supported since API version 6 and can be used only by the FA model. **System capability**: SystemCapability.Multimedia.MediaLibrary.Core @@ -647,28 +676,28 @@ Stores a media asset. This API uses a promise to return the URI that stores the ```js let option = { - src : "/data/storage/el2/base/haps/entry/image.png", - mimeType : "image/*", - relativePath : "Pictures/" + src : '/data/storage/el2/base/haps/entry/image.png', + mimeType : 'image/*', + relativePath : 'Pictures/' }; mediaLibrary.getMediaLibrary().storeMediaAsset(option).then((value) => { - console.info("Media resources stored."); + console.info('Media resources stored.'); // Obtain the URI that stores the media asset. -}).catch((err) => { - console.error("An error occurred when storing media resources."); +}).catch((error) => { + console.error('storeMediaAsset failed with error: ' + error); }); ``` -### startImagePreview(deprecated) +### startImagePreview startImagePreview(images: Array<string>, index: number, callback: AsyncCallback<void>): void Starts image preview, with the first image to preview specified. This API can be used to preview local images whose URIs start with **datashare://** or online images whose URIs start with **https://**. It uses an asynchronous callback to return the execution result. > **NOTE** -> -> This API is deprecated since API version 9. You are advised to use the **\<[Image](../arkui-ts/ts-basic-components-image.md)>** component instead. The **\** component can be used to render and display local and online images. +> This API is supported since API version 6 and can be used only by the FA model. +> You are advised to use the **\<[Image](../arkui-ts/ts-basic-components-image.md)>** component instead. The **\** component can be used to render and display local and online images. **System capability**: SystemCapability.Multimedia.MediaLibrary.Core @@ -676,7 +705,7 @@ Starts image preview, with the first image to preview specified. This API can be | Name | Type | Mandatory | Description | | -------- | ------------------------- | ---- | ---------------------------------------- | -| images | Array<string> | Yes | URIs of the images to preview. The value can start with either **https://** or **datashare://**.| +| images | Array<string> | Yes | URIs of the images to preview. The value can start with either **'https://'** or **'datashare://'**.| | index | number | Yes | Index of the first image to preview. | | callback | AsyncCallback<void> | Yes | Callback used to return the image preview result. If the preview fails, an error message is returned. | @@ -684,35 +713,35 @@ Starts image preview, with the first image to preview specified. This API can be ```js let images = [ - "datashare:///media/xxxx/2", - "datashare:///media/xxxx/3" + 'datashare:///media/xxxx/2', + 'datashare:///media/xxxx/3' ]; /* Preview online images. let images = [ - "https://media.xxxx.com/image1.jpg", - "https://media.xxxx.com/image2.jpg" + 'https://media.xxxx.com/image1.jpg', + 'https://media.xxxx.com/image2.jpg' ]; */ let index = 1; -mediaLibrary.getMediaLibrary().startImagePreview(images, index, (err) => { - if (err) { - console.error("An error occurred when previewing the images."); +mediaLibrary.getMediaLibrary().startImagePreview(images, index, (error) => { + if (error) { + console.error('startImagePreview failed with error: ' + error); return; } - console.info("Succeeded in previewing the images."); + console.info('Succeeded in previewing the images.'); }); ``` -### startImagePreview(deprecated) +### startImagePreview startImagePreview(images: Array<string>, callback: AsyncCallback<void>): void Starts image preview. This API can be used to preview local images whose URIs start with **datashare://** or online images whose URIs start with **https://**. It uses an asynchronous callback to return the execution result. > **NOTE** -> -> This API is deprecated since API version 9. You are advised to use the **\<[Image](../arkui-ts/ts-basic-components-image.md)>** component instead. The **\** component can be used to render and display local and online images. +> This API is supported since API version 6 and can be used only by the FA model. +> You are advised to use the **\<[Image](../arkui-ts/ts-basic-components-image.md)>** component instead. The **\** component can be used to render and display local and online images. **System capability**: SystemCapability.Multimedia.MediaLibrary.Core @@ -720,41 +749,41 @@ Starts image preview. This API can be used to preview local images whose URIs st | Name | Type | Mandatory | Description | | -------- | ------------------------- | ---- | ---------------------------------------- | -| images | Array<string> | Yes | URIs of the images to preview. The value can start with either **https://** or **datashare://**.| +| images | Array<string> | Yes | URIs of the images to preview. The value can start with either **'https://'** or **'datashare://'**.| | callback | AsyncCallback<void> | Yes | Callback used to return the image preview result. If the preview fails, an error message is returned. | **Example** ```js let images = [ - "datashare:///media/xxxx/2", - "datashare:///media/xxxx/3" + 'datashare:///media/xxxx/2', + 'datashare:///media/xxxx/3' ]; /* Preview online images. let images = [ - "https://media.xxxx.com/image1.jpg", - "https://media.xxxx.com/image2.jpg" + 'https://media.xxxx.com/image1.jpg', + 'https://media.xxxx.com/image2.jpg' ]; */ -mediaLibrary.getMediaLibrary().startImagePreview(images, (err) => { - if (err) { - console.error("An error occurred when previewing the images."); +mediaLibrary.getMediaLibrary().startImagePreview(images, (error) => { + if (error) { + console.error('startImagePreview failed with error: ' + error); return; } - console.info("Succeeded in previewing the images."); + console.info('Succeeded in previewing the images.'); }); ``` -### startImagePreview(deprecated) +### startImagePreview startImagePreview(images: Array<string>, index?: number): Promise<void> Starts image preview, with the first image to preview specified. This API can be used to preview local images whose URIs start with **datashare://** or online images whose URIs start with **https://**. It uses a promise to return the execution result. > **NOTE** -> -> This API is deprecated since API version 9. You are advised to use the **\<[Image](../arkui-ts/ts-basic-components-image.md)>** component instead. The **\** component can be used to render and display local and online images. +> This API is supported since API version 6 and can be used only by the FA model. +> You are advised to use the **\<[Image](../arkui-ts/ts-basic-components-image.md)>** component instead. The **\** component can be used to render and display local and online images. **System capability**: SystemCapability.Multimedia.MediaLibrary.Core @@ -762,7 +791,7 @@ Starts image preview, with the first image to preview specified. This API can be | Name | Type | Mandatory | Description | | ------ | ------------------- | ---- | ---------------------------------------- | -| images | Array<string> | Yes | URIs of the images to preview. The value can start with either **https://** or **datashare://**.| +| images | Array<string> | Yes | URIs of the images to preview. The value can start with either **'https://'** or **'datashare://'**.| | index | number | No | Index of the first image to preview. If this parameter is not specified, the default value **0** is used. | **Return value** @@ -775,33 +804,33 @@ Starts image preview, with the first image to preview specified. This API can be ```js let images = [ - "datashare:///media/xxxx/2", - "datashare:///media/xxxx/3" + 'datashare:///media/xxxx/2', + 'datashare:///media/xxxx/3' ]; /* Preview online images. let images = [ - "https://media.xxxx.com/image1.jpg", - "https://media.xxxx.com/image2.jpg" + 'https://media.xxxx.com/image1.jpg', + 'https://media.xxxx.com/image2.jpg' ]; */ let index = 1; mediaLibrary.getMediaLibrary().startImagePreview(images, index).then(() => { - console.info("Succeeded in previewing the images."); -}).catch((err) => { - console.error("An error occurred when previewing the images."); + console.info('Succeeded in previewing the images.'); +}).catch((error) => { + console.error('startImagePreview failed with error: ' + error); }); ``` -### startMediaSelect(deprecated) +### startMediaSelect startMediaSelect(option: MediaSelectOption, callback: AsyncCallback<Array<string>>): void Starts media selection. This API uses an asynchronous callback to return the list of URIs that store the selected media assets. > **NOTE** -> -> This API is deprecated since API version 9. You are advised to use the system app Gallery instead. Gallery is a built-in visual resource access application that provides features such as image and video management and browsing. For details about how to use Gallery, visit [OpenHarmony/applications_photos](https://gitee.com/openharmony/applications_photos). +> This API is supported since API version 6 and can be used only by the FA model. +> You are advised to use the system app Gallery instead. Gallery is a built-in visual resource access application that provides features such as image and video management and browsing. For details about how to use Gallery, visit [OpenHarmony/applications_photos](https://gitee.com/openharmony/applications_photos). **System capability**: SystemCapability.Multimedia.MediaLibrary.Core @@ -809,36 +838,36 @@ Starts media selection. This API uses an asynchronous callback to return the lis | Name | Type | Mandatory | Description | | -------- | ---------------------------------------- | ---- | ------------------------------------ | -| option | [MediaSelectOption](#mediaselectoptiondeprecated) | Yes | Media selection option. | +| option | [MediaSelectOption](#mediaselectoption) | Yes | Media selection option. | | callback | AsyncCallback<Array<string>> | Yes | Callback used to return the list of URIs (starting with **datashare://**) that store the selected media assets.| **Example** ```js let option : mediaLibrary.MediaSelectOption = { - type : "media", + type : 'media', count : 2 }; -mediaLibrary.getMediaLibrary().startMediaSelect(option, (err, value) => { - if (err) { - console.error("An error occurred when selecting media resources."); +mediaLibrary.getMediaLibrary().startMediaSelect(option, (error, value) => { + if (error) { + console.error('startMediaSelect failed with error: ' + error); return; } - console.info("Media resources selected."); + console.info('Media resources selected.'); // Obtain the media selection value. }); ``` -### startMediaSelect(deprecated) +### startMediaSelect startMediaSelect(option: MediaSelectOption): Promise<Array<string>> Starts media selection. This API uses a promise to return the list of URIs that store the selected media assets. > **NOTE** -> -> This API is deprecated since API version 9. You are advised to use the system app Gallery instead. Gallery is a built-in visual resource access application that provides features such as image and video management and browsing. For details about how to use Gallery, visit [OpenHarmony/applications_photos](https://gitee.com/openharmony/applications_photos). +> This API is supported since API version 6 and can be used only by the FA model. +> You are advised to use the system app Gallery instead. Gallery is a built-in visual resource access application that provides features such as image and video management and browsing. For details about how to use Gallery, visit [OpenHarmony/applications_photos](https://gitee.com/openharmony/applications_photos). **System capability**: SystemCapability.Multimedia.MediaLibrary.Core @@ -846,7 +875,7 @@ Starts media selection. This API uses a promise to return the list of URIs that | Name | Type | Mandatory | Description | | ------ | --------------------------------------- | ---- | ------- | -| option | [MediaSelectOption](#mediaselectoptiondeprecated) | Yes | Media selection option.| +| option | [MediaSelectOption](#mediaselectoption) | Yes | Media selection option.| **Return value** @@ -858,14 +887,14 @@ Starts media selection. This API uses a promise to return the list of URIs that ```js let option : mediaLibrary.MediaSelectOption = { - type : "media", + type : 'media', count : 2 }; mediaLibrary.getMediaLibrary().startMediaSelect(option).then((value) => { - console.info("Media resources selected."); + console.info('Media resources selected.'); // Obtain the media selection value. -}).catch((err) => { - console.error("An error occurred when selecting media resources."); +}).catch((error) => { + console.error('startMediaSelect failed with error: ' + error); }); ``` @@ -893,14 +922,12 @@ Obtains information about online peer devices. This API uses a promise to return async function example() { media.getActivePeers().then((devicesInfo) => { if (devicesInfo != undefined) { - for (let i = 0; i < devicesInfo.length; i++) { - console.info('get distributed info ' + devicesInfo[i].deviceName + devicesInfo[i].networkId); - } + console.info('get distributed info ' + JSON.stringify(devicesInfo)); } else { - console.info('get distributed info is undefined!') + console.info('get distributed info is undefined!'); } - }).catch((err) => { - console.error("get distributed info failed with error:" + err); + }).catch((error) => { + console.error('get distributed info failed with error: ' + error); }); } ``` @@ -927,15 +954,13 @@ Obtains information about online peer devices. This API uses an asynchronous cal ```js async function example() { - media.getActivePeers((err, devicesInfo) => { + media.getActivePeers((error, devicesInfo) => { if (devicesInfo != undefined) { - for (let i = 0; i < devicesInfo.length; i++) { - console.info('get distributed info ' + devicesInfo[i].deviceName + devicesInfo[i].networkId); - } + console.info('get distributed info ' + JSON.stringify(devicesInfo)); } else { - console.error('get distributed fail, message = ' + err) + console.error('get distributed failed with error: ' + error); } - }) + }); } ``` @@ -964,14 +989,12 @@ Obtains information about all peer devices. This API uses a promise to return th async function example() { media.getAllPeers().then((devicesInfo) => { if (devicesInfo != undefined) { - for (let i = 0; i < devicesInfo.length; i++) { - console.info('get distributed info ' + devicesInfo[i].deviceName + devicesInfo[i].networkId); - } + console.info('get distributed info ' + JSON.stringify(devicesInfo)); } else { - console.info('get distributed info is undefined!') + console.info('get distributed info is undefined!'); } - }).catch((err) => { - console.error("get distributed info failed with error: " + err); + }).catch((error) => { + console.error('get distributed info failed with error: ' + error); }); } ``` @@ -998,15 +1021,13 @@ Obtains information about online peer devices. This API uses an asynchronous cal ```js async function example() { - media.getAllPeers((err, devicesInfo) => { + media.getAllPeers((error, devicesInfo) => { if (devicesInfo != undefined) { - for (let i = 0; i < devicesInfo.length; i++) { - console.info('get distributed info ' + devicesInfo[i].deviceName + devicesInfo[i].networkId); - } + console.info('get distributed info ' + JSON.stringify(devicesInfo)); } else { - console.error('get distributed fail, message = ' + err) + console.error('get distributed failed with error: ' + error); } - }) + }); } ``` @@ -1015,7 +1036,6 @@ async function example() { Provides APIs for encapsulating file asset attributes. > **NOTE** -> > 1. The system attempts to parse the file content if the file is an audio or video file. The actual field values will be restored from the passed values during scanning on some devices. > 2. Some devices may not support the modification of **orientation**. You are advised to use [ModifyImageProperty](js-apis-image.md#modifyimageproperty9) of the **image** module. @@ -1068,19 +1088,23 @@ Checks whether this file asset is a directory. This API uses an asynchronous cal ```js async function example() { - let fileKeyObj = mediaLibrary.FileKey + let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); - asset.isDirectory((err, isDirectory) => { - // do something + asset.isDirectory((error, isDirectory) => { + if (error) { + console.error('isDirectory failed with error: ' + error); + } else { + console.info('isDirectory result:' + isDirectory); + } }); + fetchFileResult.close(); } ``` @@ -1104,21 +1128,21 @@ Checks whether this file asset is a directory. This API uses a promise to return ```js async function example() { - let fileKeyObj = mediaLibrary.FileKey + let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); - asset.isDirectory().then(function(isDirectory){ - console.info("isDirectory result:"+ isDirectory); - }).catch(function(err){ - console.error("isDirectory failed with error: " + err); + asset.isDirectory().then((isDirectory) => { + console.info('isDirectory result:' + isDirectory); + }).catch((error) => { + console.error('isDirectory failed with error: ' + error); }); + fetchFileResult.close(); } ``` @@ -1142,20 +1166,20 @@ Commits the modification in this file asset to the database. This API uses an as ```js async function example() { - let fileKeyObj = mediaLibrary.FileKey + let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); asset.title = 'newtitle'; asset.commitModify(() => { - console.info('commitModify success'); + console.info('commitModify successfully'); }); + fetchFileResult.close(); } ``` @@ -1179,18 +1203,18 @@ Commits the modification in this file asset to the database. This API uses a pro ```js async function example() { - let fileKeyObj = mediaLibrary.FileKey + let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); asset.title = 'newtitle'; - asset.commitModify(); + await asset.commitModify(); + fetchFileResult.close(); } ``` @@ -1200,9 +1224,7 @@ open(mode: string, callback: AsyncCallback<number>): void Opens this file asset. This API uses an asynchronous callback to return the result. -> **NOTE** -> -> Currently, the write operations are mutually exclusive. After the write operation is complete, you must call **close** to release the resource. +**NOTE**: When a file is opened in 'w' mode, the returned FD cannot be read. However, due to the implementation differences of file systems, some user-mode files opened in 'w' mode can be read by using FD. To perform the read or write operation on a file by using FD, you are advised to open the file in 'rw' mode. The write operations are mutually exclusive. After a write operation is complete, you must call **close** to release the resource. **Required permissions**: ohos.permission.READ_MEDIA or ohos.permission.WRITE_MEDIA @@ -1222,13 +1244,13 @@ async function example() { let mediaType = mediaLibrary.MediaType.IMAGE; let DIR_IMAGE = mediaLibrary.DirectoryType.DIR_IMAGE; const path = await media.getPublicDirectory(DIR_IMAGE); - const asset = await media.createAsset(mediaType, "image00003.jpg", path); - asset.open('rw', (openError, fd) => { - if(fd > 0){ - asset.close(fd); - }else{ - console.error('File Open Failed!' + openError); - } + const asset = await media.createAsset(mediaType, 'image00003.jpg', path); + asset.open('rw', (error, fd) => { + if (fd > 0) { + asset.close(fd); + } else { + console.error('File Open failed with error: ' + error); + } }); } ``` @@ -1239,9 +1261,7 @@ open(mode: string): Promise<number> Opens this file asset. This API uses a promise to return the result. -> **NOTE** -> -> Currently, the write operations are mutually exclusive. After the write operation is complete, you must call **close** to release the resource. +**NOTE**: When a file is opened in 'w' mode, the returned FD cannot be read. However, due to the implementation differences of file systems, some user-mode files opened in 'w' mode can be read by using FD. To perform the read or write operation on a file by using FD, you are advised to open the file in 'rw' mode. The write operations are mutually exclusive. After a write operation is complete, you must call **close** to release the resource. **Required permissions**: ohos.permission.READ_MEDIA or ohos.permission.WRITE_MEDIA @@ -1266,14 +1286,12 @@ async function example() { let mediaType = mediaLibrary.MediaType.IMAGE; let DIR_IMAGE = mediaLibrary.DirectoryType.DIR_IMAGE; const path = await media.getPublicDirectory(DIR_IMAGE); - const asset = await media.createAsset(mediaType, "image00003.jpg", path); - asset.open('rw') - .then((fd) => { - console.info('File fd!' + fd); - }) - .catch((err) => { - console.error('File err!' + err); - }); + const asset = await media.createAsset(mediaType, 'image00003.jpg', path); + asset.open('rw').then((fd) => { + console.info('File open fd: ' + fd); + }).catch((error) => { + console.error('File open failed with error: ' + error); + }); } ``` @@ -1298,30 +1316,28 @@ Closes this file asset. This API uses an asynchronous callback to return the res ```js async function example() { - let fileKeyObj = mediaLibrary.FileKey + let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); asset.open('rw').then((fd) => { - console.info('File fd!' + fd); - asset.close(fd, (closeErr) => { - if (closeErr != undefined) { - console.error('mediaLibraryTest : close : FAIL ' + closeErr); - console.error('mediaLibraryTest : ASSET_CALLBACK : FAIL'); + console.info('File open fd: ' + fd); + asset.close(fd, (error) => { + if (error) { + console.error('asset.close failed with error: ' + error); } else { - console.info("=======asset.close success====>"); + console.info('asset.close successfully'); } }); - }) - .catch((err) => { - console.error('File err!' + err); + }).catch((error) => { + console.error('File open failed with error: ' + error); }); + fetchFileResult.close(); } ``` @@ -1351,31 +1367,26 @@ Closes this file asset. This API uses a promise to return the result. ```js async function example() { - let fileKeyObj = mediaLibrary.FileKey + let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); asset.open('rw').then((fd) => { console.info('File fd!' + fd); - asset.close(fd).then((closeErr) => { - if (closeErr != undefined) { - console.error('mediaLibraryTest : close : FAIL ' + closeErr); - console.error('mediaLibraryTest : ASSET_CALLBACK : FAIL'); - - } else { - console.info("=======asset.close success====>"); - } + asset.close(fd).then(() => { + console.info('asset.close successfully'); + }).catch((closeErr) => { + console.error('asset.close fail, closeErr: ' + closeErr); }); - }) - .catch((err) => { - console.error('File err!' + err); + }).catch((error) => { + console.error('open File failed with error: ' + error); }); + fetchFileResult.close(); } ``` @@ -1399,19 +1410,23 @@ Obtains the thumbnail of this file asset. This API uses an asynchronous callback ```js async function example() { - let fileKeyObj = mediaLibrary.FileKey + let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); - asset.getThumbnail((err, pixelmap) => { - console.info('mediaLibraryTest : getThumbnail Successful '+ pixelmap); + asset.getThumbnail((error, pixelmap) => { + if (error) { + console.error('mediaLibrary getThumbnail failed with error: ' + error); + } else { + console.info('mediaLibrary getThumbnail Successful, pixelmap ' + JSON.stringify(pixelmap)); + } }); + fetchFileResult.close(); } ``` @@ -1439,17 +1454,21 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; let size = { width: 720, height: 720 }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); - asset.getThumbnail(size, (err, pixelmap) => { - console.info('mediaLibraryTest : getThumbnail Successful '+ pixelmap); + asset.getThumbnail(size, (error, pixelmap) => { + if (error) { + console.error('mediaLibrary getThumbnail failed with error: ' + error); + } else { + console.info('mediaLibrary getThumbnail Successful, pixelmap ' + JSON.stringify(pixelmap)); + } }); + fetchFileResult.close(); } ``` @@ -1484,19 +1503,17 @@ async function example() { let getImageOp = { selections: fileKeyObj.MEDIA_TYPE + '= ?', selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + order: fileKeyObj.DATE_ADDED + ' DESC', }; let size = { width: 720, height: 720 }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); - asset.getThumbnail(size) - .then((pixelmap) => { - console.info('mediaLibraryTest : getThumbnail Successful '+ pixelmap); - }) - .catch((err) => { - console.error('mediaLibraryTest : getThumbnail fail, err: ' + err); + asset.getThumbnail(size).then((pixelmap) => { + console.info('mediaLibrary getThumbnail Successful, pixelmap ' + JSON.stringify(pixelmap)); + }).catch((error) => { + console.error('mediaLibrary getThumbnail failed with error: ' + error); }); + fetchFileResult.close(); } ``` @@ -1524,16 +1541,20 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); - asset.favorite(true,function(err){ - // do something + asset.favorite(true,(error) => { + if (error) { + console.error('mediaLibrary favorite failed with error: ' + error); + } else { + console.info('mediaLibrary favorite Successful'); + } }); + fetchFileResult.close(); } ``` @@ -1566,18 +1587,18 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); - asset.favorite(true).then(function() { - console.info("favorite successfully"); - }).catch(function(err){ - console.error("favorite failed with error: " + err); + asset.favorite(true).then(() => { + console.info('mediaLibrary favorite Successful'); + }).catch((error) => { + console.error('mediaLibrary favorite failed with error: ' + error); }); + fetchFileResult.close(); } ``` @@ -1604,20 +1625,20 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); - asset.isFavorite((err, isFavorite) => { - if (isFavorite) { - console.info('FileAsset is favorite'); - }else{ - console.info('FileAsset is not favorite'); + asset.isFavorite((error, isFavorite) => { + if (error) { + console.error('mediaLibrary favoriisFavoritete failed with error: ' + error); + } else { + console.info('mediaLibrary isFavorite Successful, isFavorite result: ' + isFavorite); } }); + fetchFileResult.close(); } ``` @@ -1644,18 +1665,18 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); - asset.isFavorite().then(function(isFavorite){ - console.info("isFavorite result:"+ isFavorite); - }).catch(function(err){ - console.error("isFavorite failed with error: " + err); + asset.isFavorite().then((isFavorite) => { + console.info('mediaLibrary isFavorite Successful, isFavorite result: ' + isFavorite); + }).catch((error) => { + console.error('mediaLibrary favoriisFavoritete failed with error: ' + error); }); + fetchFileResult.close(); } ``` @@ -1685,17 +1706,20 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); - asset.trash(true, trashCallBack); - function trashCallBack(err, trash) { - console.info('mediaLibraryTest : ASSET_CALLBACK ASSET_CALLBACK trash'); - } + asset.trash(true, (error) => { + if (error) { + console.error('mediaLibrary trash failed with error: ' + error); + } else { + console.info('mediaLibrary trash Successful'); + } + }); + fetchFileResult.close(); } ``` @@ -1730,18 +1754,18 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); - asset.trash(true).then(function() { - console.info("trash successfully"); - }).catch(function(err){ - console.error("trash failed with error: " + err); + asset.trash(true).then(() => { + console.info('trash successfully'); + }).catch((error) => { + console.error('trash failed with error: ' + error); }); + fetchFileResult.close(); } ``` @@ -1768,20 +1792,20 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); - asset.isTrash((err, isTrash) => { - if (isTrash == undefined) { - console.error('Failed to get trash state: ' + err); - return; - } - console.info('Get trash state success: ' + isTrash); + asset.isTrash((error, isTrash) => { + if (error) { + console.error('Failed to get trash state failed with error: ' + error); + return; + } + console.info('Get trash state successfully, isTrash result: ' + isTrash); }); + fetchFileResult.close(); } ``` @@ -1808,17 +1832,18 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; const fetchFileResult = await media.getFileAssets(getImageOp); const asset = await fetchFileResult.getFirstObject(); - asset.isTrash().then(function(isTrash){ - console.info("isTrash result: " + isTrash); - }).catch(function(err){ - console.error("isTrash failed with error: " + err); + asset.isTrash().then((isTrash) => { + console.info('isTrash result: ' + isTrash); + }).catch((error) => { + console.error('isTrash failed with error: ' + error); }); + fetchFileResult.close(); } ``` @@ -1849,11 +1874,12 @@ async function example() { let getFileCountOneOp = { selections: fileKeyObj.MEDIA_TYPE + '= ?', selectionArgs: [fileType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + order: fileKeyObj.DATE_ADDED + ' DESC', }; let fetchFileResult = await media.getFileAssets(getFileCountOneOp); const fetchCount = fetchFileResult.getCount(); + console.info('fetchCount result: ' + fetchCount); + fetchFileResult.close(); } ``` @@ -1878,24 +1904,21 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; let fetchFileResult = await media.getFileAssets(getImageOp); const fetchCount = fetchFileResult.getCount(); - console.info('mediaLibraryTest : count:' + fetchCount); + console.info('mediaLibrary fetchFileResult.getCount, count:' + fetchCount); let fileAsset = await fetchFileResult.getFirstObject(); for (var i = 1; i < fetchCount; i++) { - fileAsset = await fetchFileResult.getNextObject(); - if(i == fetchCount - 1) { - console.info('mediaLibraryTest : isLast'); - var result = fetchFileResult.isAfterLast(); - console.info('mediaLibraryTest : isAfterLast:' + result); - console.info('mediaLibraryTest : isAfterLast end'); - fetchFileResult.close(); - } + fileAsset = await fetchFileResult.getNextObject(); + if(i == fetchCount - 1) { + var result = fetchFileResult.isAfterLast(); + console.info('mediaLibrary fileAsset isAfterLast result: ' + result); + fetchFileResult.close(); + } } } ``` @@ -1915,10 +1938,9 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; let fetchFileResult = await media.getFileAssets(getImageOp); fetchFileResult.close(); @@ -1946,18 +1968,18 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; let fetchFileResult = await media.getFileAssets(getImageOp); - fetchFileResult.getFirstObject((err, fileAsset) => { - if (err) { - console.error('Failed '); - return; - } - console.info('fileAsset.displayName : ' + fileAsset.displayName); + fetchFileResult.getFirstObject((error, fileAsset) => { + if (error) { + console.error('fetchFileResult getFirstObject failed with error: ' + error); + return; + } + console.info('getFirstObject successfully, displayName : ' + fileAsset.displayName); + fetchFileResult.close(); }) } ``` @@ -1983,16 +2005,16 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; let fetchFileResult = await media.getFileAssets(getImageOp); - fetchFileResult.getFirstObject().then(function(fileAsset){ - console.info("getFirstObject successfully:"+ JSON.stringify(fileAsset)); - }).catch(function(err){ - console.error("getFirstObject failed with error: " + err); + fetchFileResult.getFirstObject().then((fileAsset) => { + console.info('getFirstObject successfully, displayName: ' + fileAsset.displayName); + fetchFileResult.close(); + }).catch((error) => { + console.error('getFirstObject failed with error: ' + error); }); } ``` @@ -2002,6 +2024,9 @@ async function example() { getNextObject(callback: AsyncCallback<FileAsset>): void Obtains the next file asset in the result set. This API uses an asynchronous callback to return the result. +> **NOTE** +> +> Before using this API, you must use [getFirstObject](#getfirstobject7) to obtain the first file asset and then use [isAfterLast](#isafterlast7) to ensure that the cursor does not point to the last file asset in the result set. **System capability**: SystemCapability.Multimedia.MediaLibrary.Core @@ -2018,20 +2043,24 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; let fetchFileResult = await media.getFileAssets(getImageOp); - fetchFileResult.getNextObject((err, fileAsset) => { - if (err) { - console.error('Failed '); - return; - } - console.log('fileAsset.displayName : ' + fileAsset.displayName); - }) + let fileAsset = await fetchFileResult.getFirstObject(); + if (!fileAsset.isAfterLast) { + fetchFileResult.getNextObject((error, fileAsset) => { + if (error) { + console.error('fetchFileResult getNextObject failed with error: ' + error); + return; + } + console.log('fetchFileResult getNextObject successfully, displayName: ' + fileAsset.displayName); + fetchFileResult.close(); + }) + } } + ``` ### getNextObject7+ @@ -2039,6 +2068,9 @@ async function example() { getNextObject(): Promise<FileAsset> Obtains the next file asset in the result set. This API uses a promise to return the result. +> **NOTE** +> +> Before using this API, you must use [getFirstObject](#getfirstobject7) to obtain the first file asset and then use [isAfterLast](#isafterlast7) to ensure that the cursor does not point to the last file asset in the result set. **System capability**: SystemCapability.Multimedia.MediaLibrary.Core @@ -2055,15 +2087,20 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; let fetchFileResult = await media.getFileAssets(getImageOp); - const fetchCount = fetchFileResult.getCount(); - console.info('mediaLibraryTest : count:' + fetchCount); - let fileAsset = await fetchFileResult.getNextObject(); + let fileAsset = await fetchFileResult.getFirstObject(); + if (!fileAsset.isAfterLast) { + fetchFileResult.getNextObject().then((fileAsset) => { + console.info('fetchFileResult getNextObject successfully, displayName: ' + fileAsset.displayName); + fetchFileResult.close(); + }).catch((error) => { + console.error('fetchFileResult getNextObject failed with error: ' + error); + }) + } } ``` @@ -2088,18 +2125,18 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; let fetchFileResult = await media.getFileAssets(getImageOp); - fetchFileResult.getLastObject((err, fileAsset) => { - if (err) { - console.error('Failed '); - return; - } - console.info('fileAsset.displayName : ' + fileAsset.displayName); + fetchFileResult.getLastObject((error, fileAsset) => { + if (error) { + console.error('getLastObject failed with error: ' + error); + return; + } + console.info('getLastObject successfully, displayName: ' + fileAsset.displayName); + fetchFileResult.close(); }) } ``` @@ -2125,13 +2162,17 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; let fetchFileResult = await media.getFileAssets(getImageOp); - let lastObject = await fetchFileResult.getLastObject(); + fetchFileResult.getLastObject().then((fileAsset) => { + console.info('getLastObject successfully, displayName: ' + fileAsset.displayName); + fetchFileResult.close(); + }).catch((error) => { + console.error('getLastObject failed with error: ' + error); + }); } ``` @@ -2147,7 +2188,7 @@ Obtains a file asset with the specified index in the result set. This API uses a | Name | Type | Mandatory | Description | | -------- | ---------------------------------------- | ---- | ------------------ | -| index | number | Yes | Index of the file asset to obtain. The value starts from **0**. | +| index | number | Yes | Index of the file to obtain. The value starts from 0 and must be smaller than the **count** value of the result set. | | callback | AsyncCallback<[FileAsset](#fileasset7)> | Yes | Callback used to return the last file asset.| **Example** @@ -2157,18 +2198,18 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; let fetchFileResult = await media.getFileAssets(getImageOp); - fetchFileResult.getPositionObject(0, (err, fileAsset) => { - if (err) { - console.error('Failed '); - return; - } - console.info('fileAsset.displayName : ' + fileAsset.displayName); + fetchFileResult.getPositionObject(0, (error, fileAsset) => { + if (error) { + console.error('getPositionObject failed with error: ' + error); + return; + } + console.info('getPositionObject successfully, displayName: ' + fileAsset.displayName); + fetchFileResult.close(); }) } ``` @@ -2185,7 +2226,7 @@ Obtains a file asset with the specified index in the result set. This API uses a | Name | Type | Mandatory | Description | | ----- | ------ | ---- | -------------- | -| index | number | Yes | Index of the file asset to obtain. The value starts from **0**.| +| index | number | Yes | Index of the file to obtain. The value starts from 0 and must be smaller than the **count** value of the result set.| **Return value** @@ -2200,16 +2241,16 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; let fetchFileResult = await media.getFileAssets(getImageOp); - fetchFileResult.getPositionObject(1) .then(function (fileAsset){ - console.info('fileAsset.displayName : ' + fileAsset.displayName); - }).catch(function (err) { - console.error("getFileAssets failed with error: " + err); + fetchFileResult.getPositionObject(0).then((fileAsset) => { + console.info('getPositionObject successfully, displayName: ' + fileAsset.displayName); + fetchFileResult.close(); + }).catch((error) => { + console.error('getPositionObject failed with error: ' + error); }); } ``` @@ -2226,7 +2267,7 @@ Obtains all the file assets in the result set. This API uses an asynchronous cal | Name | Type | Mandatory | Description | | -------- | ---------------------------------------- | ---- | -------------------- | -| callback | AsyncCallback> | Yes | Callback used to return the file assets.| +| callback | AsyncCallback<Array<[FileAsset](#fileasset7)>> | Yes | Callback used to return the file assets.| **Example** @@ -2235,20 +2276,20 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; let fetchFileResult = await media.getFileAssets(getImageOp); - fetchFileResult.getAllObject((err, fileAsset) => { - if (err) { - console.error('Failed '); + fetchFileResult.getAllObject((error, fileAssetList) => { + if (error) { + console.error('getAllObject failed with error: ' + error); return; } for (let i = 0; i < fetchFileResult.getCount(); i++) { - console.info('fileAsset.displayName : ' + fileAsset[i].displayName); - } + console.info('getAllObject fileAssetList ' + i + ' displayName: ' + fileAssetList[i].displayName); + } + fetchFileResult.close(); }) } ``` @@ -2265,7 +2306,7 @@ Obtains all the file assets in the result set. This API uses a promise to return | Type | Description | | ---------------------------------------- | --------------------- | -| Promise> | Promise used to return the file assets.| +| Promise<Array<[FileAsset](#fileasset7)>> | Promise used to return the file assets.| **Example** @@ -2274,13 +2315,19 @@ async function example() { let fileKeyObj = mediaLibrary.FileKey; let imageType = mediaLibrary.MediaType.IMAGE; let getImageOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - extendArgs: "", + selections: fileKeyObj.MEDIA_TYPE + '= ?', + selectionArgs: [imageType.toString()], + order: fileKeyObj.DATE_ADDED + ' DESC', }; let fetchFileResult = await media.getFileAssets(getImageOp); - var data = fetchFileResult.getAllObject(); + fetchFileResult.getAllObject().then((fileAssetList) => { + for (let i = 0; i < fetchFileResult.getCount(); i++) { + console.info('getAllObject fileAssetList ' + i + ' displayName: ' + fileAssetList[i].displayName); + } + fetchFileResult.close(); + }).catch((error) => { + console.error('getAllObject failed with error: ' + error); + }); } ``` @@ -2329,12 +2376,12 @@ async function example() { const albumList = await media.getAlbums(AlbumNoArgsfetchOp); const album = albumList[0]; album.albumName = 'hello'; - album.commitModify((err) => { - if (err) { - console.error('Failed '); - return; - } - console.info('Modify successful.'); + album.commitModify((error) => { + if (error) { + console.error('commitModify failed with error: ' + error); + return; + } + console.info('commitModify successful.'); }) } ``` @@ -2366,10 +2413,10 @@ async function example() { const albumList = await media.getAlbums(AlbumNoArgsfetchOp); const album = albumList[0]; album.albumName = 'hello'; - album.commitModify().then(function() { - console.info("commitModify successfully"); - }).catch(function(err){ - console.error("commitModify failed with error: " + err); + album.commitModify().then(() => { + console.info('commitModify successfully'); + }).catch((error) => { + console.error('commitModify failed with error: ' + error); }); } ``` @@ -2400,15 +2447,22 @@ async function example() { selectionArgs: [], }; let fileNoArgsfetchOp = { - selections: '', - selectionArgs: [], + selections: '', + selectionArgs: [], } + // Obtain the albums that meet the retrieval options and return the album list. const albumList = await media.getAlbums(AlbumNoArgsfetchOp); const album = albumList[0]; - album.getFileAssets(fileNoArgsfetchOp, getFileAssetsCallBack); - function getFileAssetsCallBack(err, fetchFileResult) { - // do something - } + // Obtain an album from the album list and obtain all media assets that meet the retrieval options in the album. + album.getFileAssets(fileNoArgsfetchOp, (error, fetchFileResult) => { + if (error) { + console.error('album getFileAssets failed with error: ' + error); + return; + } + let count = fetchFileResult.getCount(); + console.info('album getFileAssets successfully, count: ' + count); + fetchFileResult.close(); + }); } ``` @@ -2443,15 +2497,19 @@ async function example() { selectionArgs: [], }; let fileNoArgsfetchOp = { - selections: '', - selectionArgs: [], + selections: '', + selectionArgs: [], }; + // Obtain the albums that meet the retrieval options and return the album list. const albumList = await media.getAlbums(AlbumNoArgsfetchOp); const album = albumList[0]; - album.getFileAssets(fileNoArgsfetchOp).then(function(albumFetchFileResult){ - console.info("getFileAssets successfully: " + JSON.stringify(albumFetchFileResult)); - }).catch(function(err){ - console.error("getFileAssets failed with error: " + err); + // Obtain an album from the album list and obtain all media assets that meet the retrieval options in the album. + album.getFileAssets(fileNoArgsfetchOp).then((fetchFileResult) => { + let count = fetchFileResult.getCount(); + console.info('album getFileAssets successfully, count: ' + count); + fetchFileResult.close(); + }).catch((error) => { + console.error('album getFileAssets failed with error: ' + error); }); } ``` @@ -2491,32 +2549,31 @@ Enumerates media types. Enumerates key file information. > **NOTE** -> > The **bucket_id** field may change after file rename or movement. Therefore, you must obtain the field again before using it. **System capability**: SystemCapability.Multimedia.MediaLibrary.Core | Name | Value | Description | | ------------- | ------------------- | ---------------------------------------------------------- | -| ID | "file_id" | File ID. | -| RELATIVE_PATH | "relative_path" | Relative public directory of the file. | -| DISPLAY_NAME | "display_name" | Display file name. | -| PARENT | "parent" | Parent directory ID. | -| MIME_TYPE | "mime_type" | Extended file attributes. | -| MEDIA_TYPE | "media_type" | Media type. | -| SIZE | "size" | File size, in bytes. | -| DATE_ADDED | "date_added" | Date when the file was added. The value is the number of seconds elapsed since the Epoch time. | -| DATE_MODIFIED | "date_modified" | Date when the file content (not the file name) was last modified. The value is the number of seconds elapsed since the Epoch time.| -| DATE_TAKEN | "date_taken" | Date when the file (photo) was taken. The value is the number of seconds elapsed since the Epoch time. | -| TITLE | "title" | Title in the file. | -| ARTIST | "artist" | Artist of the file. | -| AUDIOALBUM | "audio_album" | Audio album. | -| DURATION | "duration" | Duration, in ms. | -| WIDTH | "width" | Image width, in pixels. | -| HEIGHT | "height" | Image height, in pixels. | -| ORIENTATION | "orientation" | Image display direction (clockwise rotation angle, for example, 0, 90, and 180, in degrees).| -| ALBUM_ID | "bucket_id" | ID of the album to which the file belongs. | -| ALBUM_NAME | "bucket_display_name" | Name of the album to which the file belongs. | +| ID | 'file_id' | File ID. | +| RELATIVE_PATH | 'relative_path' | Relative public directory of the file. | +| DISPLAY_NAME | 'display_name' | Display file name. | +| PARENT | 'parent' | Parent directory ID. | +| MIME_TYPE | 'mime_type' | Extended file attributes, such as image/, video/, and file/*. | +| MEDIA_TYPE | 'media_type' | Media type. | +| SIZE | 'size' | File size, in bytes. | +| DATE_ADDED | 'date_added' | Date when the file was added. The value is the number of seconds elapsed since the Epoch time. | +| DATE_MODIFIED | 'date_modified' | Date when the file content (not the file name) was last modified. The value is the number of seconds elapsed since the Epoch time.| +| DATE_TAKEN | 'date_taken' | Date when the file (photo) was taken. The value is the number of seconds elapsed since the Epoch time. | +| TITLE | 'title' | Title in the file. | +| ARTIST | 'artist' | Artist of the file. | +| AUDIOALBUM | 'audio_album' | Audio album. | +| DURATION | 'duration' | Duration, in ms. | +| WIDTH | 'width' | Image width, in pixels. | +| HEIGHT | 'height' | Image height, in pixels. | +| ORIENTATION | 'orientation' | Image display direction (clockwise rotation angle, for example, 0, 90, and 180, in degrees).| +| ALBUM_ID | 'bucket_id' | ID of the album to which the file belongs. | +| ALBUM_NAME | 'bucket_display_name' | Name of the album to which the file belongs. | ## DirectoryType8+ @@ -2559,9 +2616,9 @@ Describes options for fetching media files. | Name | Type | Readable| Writable| Description | | ----------------------- | ------------------- | ---- | ---- | ------------------------------------------------------------ | -| selections | string | Yes | Yes | Conditions for fetching files. The enumerated values in [FileKey](#filekey8) are used as the column names of the conditions. Example:
selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? OR ' +mediaLibrary.FileKey.MEDIA_TYPE + '= ?', | +| selections | string | Yes | Yes | Conditions for fetching files. The enumerated values in [FileKey](#filekey8) are used as the column names of the conditions. Example:
selections: mediaLibrary.FileKey.MEDIA_TYPE + '= ? OR ' + mediaLibrary.FileKey.MEDIA_TYPE + '= ?', | | selectionArgs | Array<string> | Yes | Yes | Value of the condition, which corresponds to the value of the condition column in **selections**.
Example:
selectionArgs: [mediaLibrary.MediaType.IMAGE.toString(), mediaLibrary.MediaType.VIDEO.toString()], | -| order | string | Yes | Yes | Sorting mode of the search results, which can be ascending or descending. The enumerated values in [FileKey](#filekey8) are used as the columns for sorting the search results. Example:
Ascending: order: mediaLibrary.FileKey.DATE_ADDED + " ASC"
Descending: order: mediaLibrary.FileKey.DATE_ADDED + " DESC"| +| order | string | Yes | Yes | Sorting mode of the search results, which can be ascending or descending. The enumerated values in [FileKey](#filekey8) are used as the columns for sorting the search results. Example:
Ascending: order: mediaLibrary.FileKey.DATE_ADDED + ' ASC'
Descending: order: mediaLibrary.FileKey.DATE_ADDED + ' DESC'| | uri8+ | string | Yes | Yes | File URI. | | networkId8+ | string | Yes | Yes | Network ID of the registered device. | | extendArgs8+ | string | Yes | Yes | Extended parameters for fetching the files. Currently, no extended parameters are available. | @@ -2577,14 +2634,10 @@ Describes the image size. | width | number | Yes | Yes | Image width, in pixels.| | height | number | Yes | Yes | Image height, in pixels.| -## MediaAssetOption(deprecated) +## MediaAssetOption Implements the media asset option. -> **NOTE** -> -> This API is deprecated since API version 9. - **System capability**: SystemCapability.Multimedia.MediaLibrary.Core @@ -2594,17 +2647,13 @@ Implements the media asset option. | mimeType | string | Yes | Yes | Multipurpose Internet Mail Extensions (MIME) type of the media.
The value can be 'image/\*', 'video/\*', 'audio/\*' or 'file\*'.| | relativePath | string | Yes | Yes | Custom path for storing media assets, for example, 'Pictures/'. If this parameter is unspecified, media assets are stored in the default path.
Default path of images: 'Pictures/'
Default path of videos: 'Videos/'
Default path of audios: 'Audios/'
Default path of files: 'Documents/'| -## MediaSelectOption(deprecated) +## MediaSelectOption Describes media selection option. -> **NOTE** -> -> This API is deprecated since API version 9. - **System capability**: SystemCapability.Multimedia.MediaLibrary.Core | Name | Type | Readable| Writable| Description | | ----- | ------ | ---- | ---- | -------------------- | | type | 'image' | 'video' | 'media' | Yes | Yes | Media type, which can be **image**, **media**, or **video**. Currently, only **media** is supported.| -| count | number | Yes | Yes | Number of media assets selected. The value starts from 1, which indicates that one media asset can be selected. | +| count | number | Yes | Yes | Maximum number of media assets that can be selected. The value starts from 1, which indicates that one media asset can be selected. | 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 d5a5f1585a5ae153694833b611861cc49325c4e7..f5c48ddd07342118d752a82a00972aec398685ea 100644 --- a/en/application-dev/reference/apis/js-apis-net-connection.md +++ b/en/application-dev/reference/apis/js-apis-net-connection.md @@ -1,8 +1,8 @@ # @ohos.net.connection (Network Connection Management) -The **connection** 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. +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**
+> **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 @@ -10,6 +10,40 @@ The **connection** module provides basic network management capabilities. You ca ```js import connection from '@ohos.net.connection' ``` +## connection.createNetConnection + +createNetConnection(netSpecifier?: NetSpecifier, timeout?: number): NetConnection + +Creates a **NetConnection** object. **netSpecifier** specifies the network, and **timeout** specifies the timeout interval in ms. **timeout** is configurable only when **netSpecifier** is specified. If neither of them is present, the default network is used. + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ | +| netSpecifier | [NetSpecifier](#netspecifier) | No | Network specifier. If this parameter is not set, the default network is used. | +| timeout | number | No | Timeout interval for obtaining the network specified by **netSpecifier**. This parameter is valid only when **netSpecifier** is set.| + +**Return value** + +| Type | Description | +| ------------------------------- | -------------------- | +| [NetConnection](#netconnection) | Handle of the network specified by **netSpecifier**.| + +**Example** + +```js +// Default network +let netConnection = connection.createNetConnection() + +// Cellular network +let netConnectionCellular = connection.createNetConnection({ + netCapabilities: { + bearerTypes: [connection.NetBearType.BEARER_CELLULAR] + } +}) +``` ## connection.getDefaultNet @@ -25,14 +59,22 @@ Obtains the default active data network. This API uses an asynchronous callback | Name | Type | Mandatory| Description | | -------- | --------------------------------------- | ---- | ---------- | -| callback | AsyncCallback\<[NetHandle](#nethandle)> | Yes | Callback used to return the result.| +| callback | AsyncCallback\<[NetHandle](#nethandle)> | Yes | Callback used to return the result. If the default activated data network is obtained successfully, err is undefined and data is the default activated data network. Otherwise, err is an error object.| + +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | **Example** ```js -connection.getDefaultNet(function (error, netHandle) { +connection.getDefaultNet(function (error, data) { console.log(JSON.stringify(error)) - console.log(JSON.stringify(netHandle)) + console.log(JSON.stringify(data)) }) ``` @@ -52,17 +94,25 @@ Obtains the default active data network. This API uses a promise to return the r | --------------------------------- | ------------------------------------- | | Promise\<[NetHandle](#nethandle)> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + **Example** ```js -connection.getDefaultNet().then(function (netHandle) { - console.log(JSON.stringify(netHandle)) +connection.getDefaultNet().then(function (data) { + console.log(JSON.stringify(data)) }) ``` ## connection.getDefaultNetSync9+ -getDefaultNetSync(): NetHandle; +getDefaultNetSync(): NetHandle Obtains the default active data network in synchronous mode. You can use [getNetCapabilities](#connectiongetnetcapabilities) to obtain information such as the network type and capabilities. @@ -76,59 +126,321 @@ Obtains the default active data network in synchronous mode. You can use [getNet | --------- | ---------------------------------- | | NetHandle | Handle of the default active data network.| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + **Example** ```js let netHandle = connection.getDefaultNetSync(); ``` +## connection.getGlobalHttpProxy10+ -## connection.hasDefaultNet +getGlobalHttpProxy(callback: AsyncCallback\): void -hasDefaultNet(callback: AsyncCallback\): void +Obtains the global HTTP proxy configuration of the network. This API uses an asynchronous callback to return the result. -Checks whether the default data network is activated. This API uses an asynchronous callback to return the result. You can use [getDefaultNet](#connectiongetdefaultnet) to obtain the default data network, if any. +**System API**: This is a system API. -**Required permission**: ohos.permission.GET_NETWORK_INFO +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| --------- | ------------------------------------------------------------ | ---- | ---------------- | +| callback | AsyncCallback\<[HttpProxy](#httpproxy)> | Yes | Callback used to return the result. If the global HTTP proxy configuration of the network is obtained successfully, **err** is **undefined** and **data** is the global HTTP proxy configuration. Otherwise, **err** is an error object.| + +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +connection.getGlobalHttpProxy((error,data) => { + console.info(JSON.stringify(error)); + console.info(JSON.stringify(data)); +}) +``` + +## connection.getGlobalHttpProxy10+ + +getGlobalHttpProxy(): Promise\; + +Obtains the global HTTP proxy configuration of the network. This API uses a promise to return the result. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Return value** + +| Type | Description | +| --------------------------------- | ------------------------------------- | +| Promise\<[HttpProxy](#httpproxy)> | Promise used to return the result.| + +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +connection.getGlobalHttpProxy().then((data) => { + console.info(JSON.stringify(data)); +}).catch(error => { + console.info(JSON.stringify(error)); +}) +``` + +## connection.setGlobalHttpProxy10+ + +setGlobalHttpProxy(httpProxy: HttpProxy, callback: AsyncCallback\): void + +Sets the global HTTP proxy configuration of the network. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL **System capability**: SystemCapability.Communication.NetManager.Core **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ----------------------- | ---- | -------------------------------------- | -| callback | AsyncCallback\ | Yes | Callback used to return the result. The value **true** indicates that the default data network is activated.| +| Name | Type | Mandatory| Description | +| --------- | ------------------------------------------------------------ | ---- | ---------------- | +| httpProxy | [HttpProxy](#httpproxy) | Yes | Global HTTP proxy configuration of the network.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the global HTTP proxy configuration of the network is set successfully, **err** is **undefined**. Otherwise, **err** is an error object.| + +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | **Example** ```js -connection.hasDefaultNet(function (error, has) { - console.log(JSON.stringify(error)) - console.log('has: ' + has) +let exclusionStr="192.168,baidu.com" +let exclusionArray = exclusionStr.split(','); +let httpProxy = { + host: "192.168.xx.xxx", + port: 8080, + exclusionList: exclusionArray +} +connection.setGlobalHttpProxy(httpProxy, (error, data) => { + console.info(JSON.stringify(error)); + console.info(JSON.stringify(data)); +}); +``` + +## connection.setGlobalHttpProxy10+ + +setGlobalHttpProxy(httpProxy: HttpProxy): Promise\; + +Sets the global HTTP proxy configuration of the network. This API uses a promise to return the result. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| --------- | ------------------------------------------------------------ | ---- | ---------------- | +| httpProxy | [HttpProxy](#httpproxy) | Yes | Global HTTP proxy configuration of the network.| + +**Return value** + +| Type | Description | +| ------------------------------------------- | ----------------------------- | +| Promise\ | Promise that returns no value.| + +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +let exclusionStr="192.168,baidu.com" +let exclusionArray = exclusionStr.split(','); +let httpProxy = { + host: "192.168.xx.xxx", + port: 8080, + exclusionList: exclusionArray +} +connection.setGlobalHttpProxy(httpProxy).then(() => { + console.info("success"); +}).catch(error=>{ + console.info(JSON.stringify(error)); }) ``` -## connection.hasDefaultNet +## connection.getAppNet9+ -hasDefaultNet(): Promise\ +getAppNet(callback: AsyncCallback\): void -Checks whether the default data network is activated. This API uses a promise to return the result. You can use [getDefaultNet](#connectiongetdefaultnet) to obtain the default data network, if any. +Obtains information about the network bound to an application. This API uses an asynchronous callback to return the result. -**Required permission**: ohos.permission.GET_NETWORK_INFO +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| --------- | ------------------------------------------------------------ | ---- | ---------------- | +| callback | AsyncCallback\<[NetHandle](#nethandle)> | Yes | Callback used to return the result. If information about the network bound to the application is successfully obtained, **err** is **undefined** and **data** is the obtained network information. Otherwise, **err** is an error object.| + +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +connection.getAppNet(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) +``` + +## connection.getAppNet9+ + +getAppNet(): Promise\; + +Obtains information about the network bound to an application. This API uses a promise to return the result. **System capability**: SystemCapability.Communication.NetManager.Core **Return value** -| Type | Description | -| ----------------- | ----------------------------------------------- | -| Promise\ | Promise used to return the result. The value **true** indicates that the default data network is activated.| +| Type | Description | +| --------------------------------- | ------------------------------------- | +| Promise\<[NetHandle](#nethandle)> | Promise used to return the result.| + +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +connection.getAppNet().then((data) => { + console.info(JSON.stringify(data)); +}).catch(error => { + console.info(JSON.stringify(error)); +}) +``` + +## connection.SetAppNet9+ + +setAppNet(netHandle: NetHandle, callback: AsyncCallback\): void + +Binds an application to the specified network, so that the application can access the external network only through this network. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.INTERNET + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| --------- | ------------------------------------------------------------ | ---- | ---------------- | +| netHandle | [NetHandle](#nethandle) | Yes | Handle of the data network.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the application is successfully bound to the specified network, **err** is **undefined**. Otherwise, **err** is an error object.| + +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | **Example** ```js -connection.hasDefaultNet().then(function (has) { - console.log('has: ' + has) +connection.getDefaultNet(function (error, netHandle) { + connection.setAppNet(netHandle, (error, data) => { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) + }); +}) +``` + +## connection.SetAppNet9+ + +setAppNet(netHandle: NetHandle): Promise\; + +Binds an application to the specified network, so that the application can access the external network only through this network. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.INTERNET + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| --------- | ------------------------------------------------------------ | ---- | ---------------- | +| netHandle | [NetHandle](#nethandle) | Yes | Handle of the data network.| + +**Return value** + +| Type | Description | +| ------------------------------------------- | ----------------------------- | +| Promise\ | Promise that returns no value.| + +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +connection.getDefaultNet().then(function (netHandle) { + connection.setAppNet(netHandle).then(() => { + console.log("success") + }).catch(error => { + console.log(JSON.stringify(error)) + }) }) ``` @@ -136,7 +448,7 @@ connection.hasDefaultNet().then(function (has) { getAllNets(callback: AsyncCallback<Array<NetHandle>>): void -Obtains the list of all active data networks. This API uses an asynchronous callback to return the result. +Obtains the list of all connected networks. This API uses an asynchronous callback to return the result. **Required permission**: ohos.permission.GET_NETWORK_INFO @@ -146,23 +458,30 @@ Obtains the list of all active data networks. This API uses an asynchronous call | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| callback | AsyncCallback<Array<[NetHandle](#nethandle)>> | Yes| Callback used to return the result.| +| callback | AsyncCallback<Array<[NetHandle](#nethandle)>> | Yes| Callback used to return the result. If the list of all connected networks is obtained successfully, **err** is **undefined** and **data** is the list of activated data networks. Otherwise, **err** is an error object.| + +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | **Example** ```js -connection.getAllNets(function (error, nets) { +connection.getAllNets(function (error, data) { console.log(JSON.stringify(error)) - console.log(JSON.stringify(nets)) + console.log(JSON.stringify(data)) }); ``` - ## connection.getAllNets getAllNets(): Promise<Array<NetHandle>> -Obtains the list of all active data networks. This API uses a promise to return the result. +Obtains the list of all connected networks. This API uses a promise to return the result. **Required permission**: ohos.permission.GET_NETWORK_INFO @@ -174,11 +493,19 @@ Obtains the list of all active data networks. This API uses a promise to return | -------- | -------- | | Promise<Array<[NetHandle](#nethandle)>> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + **Example** ```js -connection.getAllNets().then(function (nets) { - console.log(JSON.stringify(nets)) +connection.getAllNets().then(function (data) { + console.log(JSON.stringify(data)) }); ``` @@ -186,7 +513,7 @@ connection.getAllNets().then(function (nets) { getConnectionProperties(netHandle: NetHandle, callback: AsyncCallback\): void -Obtains connection properties of the network corresponding to the given network handle. This API uses an asynchronous callback to return the result. +Obtains connection properties of the network corresponding to the **netHandle**. This API uses an asynchronous callback to return the result. **Required permission**: ohos.permission.GET_NETWORK_INFO @@ -197,15 +524,25 @@ Obtains connection properties of the network corresponding to the given network | Name | Type | Mandatory| Description | | --------- | ------------------------------------------------------------ | ---- | ---------------- | | netHandle | [NetHandle](#nethandle) | Yes | Handle of the data network.| -| callback | AsyncCallback\<[ConnectionProperties](#connectionproperties)> | Yes | Callback used to return the result. | +| callback | AsyncCallback\<[ConnectionProperties](#connectionproperties)> | Yes | Callback used to return the result. If the connection properties of the network corresponding to the **netHandle** is obtained successfully, **err** is **undefined** and **data** is the obtained network connection information. Otherwise, **err** is an error object.| + +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | **Example** ```js connection.getDefaultNet().then(function (netHandle) { - connection.getConnectionProperties(netHandle, function (error, info) { + connection.getConnectionProperties(netHandle, function (error, data) { console.log(JSON.stringify(error)) - console.log(JSON.stringify(info)) + console.log(JSON.stringify(data)) }) }) ``` @@ -214,7 +551,7 @@ connection.getDefaultNet().then(function (netHandle) { getConnectionProperties(netHandle: NetHandle): Promise\ -Obtains connection properties of the network corresponding to **netHandle**. This API uses a promise to return the result. +Obtains connection properties of the network corresponding to the **netHandle**. This API uses a promise to return the result. **Required permission**: ohos.permission.GET_NETWORK_INFO @@ -232,12 +569,22 @@ Obtains connection properties of the network corresponding to **netHandle**. Thi | ------------------------------------------------------- | --------------------------------- | | Promise\<[ConnectionProperties](#connectionproperties)> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + **Example** ```js connection.getDefaultNet().then(function (netHandle) { - connection.getConnectionProperties(netHandle).then(function (info) { - console.log(JSON.stringify(info)) + connection.getConnectionProperties(netHandle).then(function (data) { + console.log(JSON.stringify(data)) }) }) ``` @@ -246,7 +593,7 @@ connection.getDefaultNet().then(function (netHandle) { getNetCapabilities(netHandle: NetHandle, callback: AsyncCallback\): void -Obtains capability information of the network corresponding to **netHandle**. This API uses an asynchronous callback to return the result. +Obtains capability information of the network corresponding to the **netHandle**. This API uses an asynchronous callback to return the result. **Required permission**: ohos.permission.GET_NETWORK_INFO @@ -257,15 +604,25 @@ Obtains capability information of the network corresponding to **netHandle**. Th | Name | Type | Mandatory| Description | | --------- | --------------------------------------------------- | ---- | ---------------- | | netHandle | [NetHandle](#nethandle) | Yes | Handle of the data network.| -| callback | AsyncCallback\<[NetCapabilities](#netcapabilities)> | Yes | Callback used to return the result. | +| callback | AsyncCallback\<[NetCapabilities](#netcapabilities)> | Yes | Callback used to return the result. If the capability information of the network corresponding to the **netHandle** is obtained successfully, **err** is **undefined** and **data** is the obtained network capability information. Otherwise, **err** is an error object. | + +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | **Example** ```js connection.getDefaultNet().then(function (netHandle) { - connection.getNetCapabilities(netHandle, function (error, info) { + connection.getNetCapabilities(netHandle, function (error, data) { console.log(JSON.stringify(error)) - console.log(JSON.stringify(info)) + console.log(JSON.stringify(data)) }) }) ``` @@ -274,7 +631,7 @@ connection.getDefaultNet().then(function (netHandle) { getNetCapabilities(netHandle: NetHandle): Promise\ -Obtains capability information of the network corresponding to **netHandle**. This API uses a promise to return the result. +Obtains capability information of the network corresponding to the **netHandle**. This API uses a promise to return the result. **Required permission**: ohos.permission.GET_NETWORK_INFO @@ -292,12 +649,22 @@ Obtains capability information of the network corresponding to **netHandle**. Th | --------------------------------------------- | --------------------------------- | | Promise\<[NetCapabilities](#netcapabilities)> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + **Example** ```js connection.getDefaultNet().then(function (netHandle) { - connection.getNetCapabilities(netHandle).then(function (info) { - console.log(JSON.stringify(info)) + connection.getNetCapabilities(netHandle).then(function (data) { + console.log(JSON.stringify(data)) }) }) ``` @@ -318,12 +685,20 @@ Checks whether the data traffic usage on the current network is metered. This AP | -------- | ----------------------- | ---- | -------------------------------------- | | callback | AsyncCallback\ | Yes | Callback used to return the result. The value **true** indicates the data traffic usage is metered.| -**Example**: +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** ```js -connection.isDefaultNetMetered(function (error, has) { +connection.isDefaultNetMetered(function (error, data) { console.log(JSON.stringify(error)) - console.log('has: ' + has) + console.log('data: ' + data) }) ``` @@ -343,11 +718,216 @@ Checks whether the data traffic usage on the current network is metered. This AP | ----------------- | ----------------------------------------------- | | Promise\ | Promise used to return the result. The value **true** indicates the data traffic usage is metered.| -**Example**: +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +connection.isDefaultNetMetered().then(function (data) { + console.log('data: ' + data) +}) +``` + +## connection.hasDefaultNet + +hasDefaultNet(callback: AsyncCallback\): void + +Checks whether the default data network is activated. This API uses an asynchronous callback to return the result. You can use [getDefaultNet](#connectiongetdefaultnet) to obtain the default data network, if any. + +**Required permission**: ohos.permission.GET_NETWORK_INFO + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ----------------------- | ---- | -------------------------------------- | +| callback | AsyncCallback\ | Yes | Callback used to return the result. The value **true** indicates the default data network is activated.| + +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +connection.hasDefaultNet(function (error, data) { + console.log(JSON.stringify(error)) + console.log('data: ' + data) +}) +``` + +## connection.hasDefaultNet + +hasDefaultNet(): Promise\ + +Checks whether the default data network is activated. This API uses a promise to return the result. You can use [getDefaultNet](#connectiongetdefaultnet) to obtain the default data network, if any. + +**Required permission**: ohos.permission.GET_NETWORK_INFO + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Return value** + +| Type | Description | +| ----------------- | ----------------------------------------------- | +| Promise\ | Promise used to return the result. The value **true** indicates that the default data network is activated.| + +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** ```js -connection.isDefaultNetMetered().then(function (has) { - console.log('has: ' + has) +connection.hasDefaultNet().then(function (data) { + console.log('data: ' + data) +}) +``` + +## connection.enableAirplaneMode + +enableAirplaneMode(callback: AsyncCallback\): void + +Enables the airplane mode. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------- | ---- | ------------------ | +| callback | AsyncCallback\ | Yes | Callback used to return the result. | + +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**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. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Return value** + +| Type | Description | +| ------------------------------------------- | ----------------------------- | +| Promise\ | Promise that returns no value.| + +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**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. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------- | ---- | ------------------ | +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the airplane mode is disabled successfully, **err** is **undefined**. Otherwise, **err** is an error object.| + +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**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. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Return value** + +| Type | Description | +| ------------------------------------------- | ----------------------------- | +| Promise\ | Promise that returns no value.| + +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +connection.disableAirplaneMode().then(function (error) { + console.log(JSON.stringify(error)) }) ``` @@ -355,9 +935,8 @@ connection.isDefaultNetMetered().then(function (has) { reportNetConnected(netHandle: NetHandle, callback: AsyncCallback<void>): void -Reports connection of the data network. This API uses an asynchronous callback to return the result. - -If this API is called, the application considers that the network connection state (**ohos.net.connection.NetCap.NET_CAPABILITY_VAILDATED**) is inconsistent with that in the network management module. +Reports a **netAavailable** event to NetManager. If this API is called, the application considers that its network status (ohos.net.connection.NetCap.NET_CAPABILITY_VAILDATED) is inconsistent with that of NetManager. +This API uses an asynchronous callback to return the result. **Permission required**: ohos.permission.GET_NETWORK_INFO and ohos.permission.INTERNET @@ -368,7 +947,17 @@ If this API is called, the application considers that the network connection sta | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | netHandle | [NetHandle](#nethandle) | Yes| Handle of the data network. For details, see [NetHandle](#nethandle).| -| callback | AsyncCallback<void> | Yes| Callback used to return the result.| +| callback | AsyncCallback<void> | Yes| Callback used to return the result. If the network status is reported successfully, **err** is **undefined**. Otherwise, **err** is an error object.| + +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | **Example** @@ -384,9 +973,8 @@ connection.getDefaultNet().then(function (netHandle) { reportNetConnected(netHandle: NetHandle): Promise<void> -Reports connection of the data network. This API uses a promise to return the result. - -If this API is called, the application considers that the network connection state (**ohos.net.connection.NetCap.NET_CAPABILITY_VAILDATED**) is inconsistent with that in the network management module. +Reports a **netAavailable** event to NetManager. If this API is called, the application considers that its network status (ohos.net.connection.NetCap.NET_CAPABILITY_VAILDATED) is inconsistent with that of NetManager. +This API uses a promise to return the result. **Permission required**: ohos.permission.GET_NETWORK_INFO and ohos.permission.INTERNET @@ -399,11 +987,20 @@ If this API is called, the application considers that the network connection sta | netHandle | [NetHandle](#nethandle) | Yes| Handle of the data network. For details, see [NetHandle](#nethandle).| **Return value** - | Type| Description| | -------- | -------- | | Promise<void> | Promise that returns no value.| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + **Example** ```js @@ -414,14 +1011,12 @@ connection.getDefaultNet().then(function (netHandle) { }); ``` - ## connection.reportNetDisconnected reportNetDisconnected(netHandle: NetHandle, callback: AsyncCallback<void>): void -Reports disconnection of the data network. This API uses an asynchronous callback to return the result. - -If this API is called, the application considers that the network connection state (**ohos.net.connection.NetCap.NET_CAPABILITY_VAILDATED**) is inconsistent with that in the network management module. +Reports a **netAavailable** event to NetManager. If this API is called, the application considers that its network status (ohos.net.connection.NetCap.NET_CAPABILITY_VAILDATED) is inconsistent with that of NetManager. +This API uses an asynchronous callback to return the result. **Permission required**: ohos.permission.GET_NETWORK_INFO and ohos.permission.INTERNET @@ -432,7 +1027,17 @@ If this API is called, the application considers that the network connection sta | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | netHandle | [NetHandle](#nethandle) | Yes| Handle of the data network. For details, see [NetHandle](#nethandle).| -| callback | AsyncCallback<void> | Yes| Callback used to return the result.| +| callback | AsyncCallback<void> | Yes| Callback used to return the result. If the network status is reported successfully, **err** is **undefined**. Otherwise, **err** is an error object.| + +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | **Example** @@ -444,14 +1049,12 @@ connection.getDefaultNet().then(function (netHandle) { }); ``` - ## connection.reportNetDisconnected reportNetDisconnected(netHandle: NetHandle): Promise<void> -Reports disconnection of the data network. This API uses a promise to return the result. - -If this API is called, the application considers that the network connection state (**ohos.net.connection.NetCap.NET_CAPABILITY_VAILDATED**) is inconsistent with that in the network management module. +Reports a **netAavailable** event to NetManager. If this API is called, the application considers that its network status (ohos.net.connection.NetCap.NET_CAPABILITY_VAILDATED) is inconsistent with that of NetManager. +This API uses a promise to return the result. **Permission required**: ohos.permission.GET_NETWORK_INFO and ohos.permission.INTERNET @@ -464,11 +1067,20 @@ If this API is called, the application considers that the network connection sta | netHandle | [NetHandle](#nethandle) | Yes| Handle of the data network. For details, see [NetHandle](#nethandle).| **Return value** - | Type| Description| | -------- | -------- | | Promise<void> | Promise that returns no value.| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + **Example** ```js @@ -485,7 +1097,7 @@ getAddressesByName(host: string, callback: AsyncCallback\>): Resolves the host name by using the default network to obtain all IP addresses. This API uses an asynchronous callback to return the result. -**Required permission**: ohos.permission.GET_NETWORK_INFO +**Required permissions**: ohos.permission.INTERNET **System capability**: SystemCapability.Communication.NetManager.Core @@ -493,213 +1105,185 @@ Resolves the host name by using the default network to obtain all IP addresses. | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------- | ---- | ------------------ | -| host | string | Yes | Host name to be resolved.| -| callback | AsyncCallback\> | Yes | Callback used to return the result. | - -**Example** - -```js -let host = "xxxx"; -connection.getAddressesByName(host, function (error, addresses) { - console.log(JSON.stringify(error)) - console.log(JSON.stringify(addresses)) -}) -``` +| host | string | Yes | Host name to resolve.| +| callback | AsyncCallback\> | Yes | Callback used to return the result. If all IP addresses are successfully obtained, **err** is **undefined**, and **data** is the list of all obtained IP addresses. Otherwise, **err** is an error object.| -## connection.getAddressesByName - -getAddressesByName(host: string): Promise\> - -Resolves the host name by using the default network to obtain all IP addresses. This API uses a promise to return the result. - -**Required permission**: ohos.permission.GET_NETWORK_INFO - -**System capability**: SystemCapability.Communication.NetManager.Core - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------ | -| host | string | Yes | Host name to be resolved.| +**Error codes** -**Return value** - -| Type | Description | -| ------------------------------------------- | ----------------------------- | -| Promise\> | Promise used to return the result.| - -**Example** - -```js -let host = "xxxx"; -connection.getAddressesByName(host).then(function (addresses) { - console.log(JSON.stringify(addresses)) -}) -``` - -## connection.enableAirplaneMode - -enableAirplaneMode(callback: AsyncCallback\): void - -Enables the airplane mode. This API uses an asynchronous callback to return the result. - -**System API**: 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. | +| ID| Error Message | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | **Example** ```js -connection.enableAirplaneMode(function (error) { +let host = "xxxx"; +connection.getAddressesByName(host, function (error, data) { console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) }) ``` -## connection.enableAirplaneMode +## connection.getAddressesByName -enableAirplaneMode(): Promise\ +getAddressesByName(host: string): Promise\> -Enables the airplane mode. This API uses a promise to return the result. +Resolves the host name by using the default network to obtain all IP addresses. This API uses a promise to return the result. -**System API**: This is a system API. +**Required permissions**: ohos.permission.INTERNET + +**System capability**: SystemCapability.Communication.NetManager.Core -**System capability**: SystemCapability.Communication.NetManager.Core +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ------------------ | +| host | string | Yes | Host name to resolve.| **Return value** | Type | Description | | ------------------------------------------- | ----------------------------- | -| Promise\ | Promise that returns no value.| +| Promise\> | Promise used to return the result.| + +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | **Example** ```js -connection.enableAirplaneMode().then(function (error) { - console.log(JSON.stringify(error)) +let host = "xxxx"; +connection.getAddressesByName(host).then(function (data) { + console.log(JSON.stringify(data)) }) ``` -## connection.disableAirplaneMode - -disableAirplaneMode(callback: AsyncCallback\): void - -Disables the airplane mode. This API uses an asynchronous callback to return the result. - -**System API**: This is a system API. - -**System capability**: SystemCapability.Communication.NetManager.Core +## NetConnection -**Parameters** +Represents the network connection handle. -| Name | Type | Mandatory| Description | -| -------- | ------------------------------------------------- | ---- | ------------------ | -| callback | AsyncCallback\ | Yes | Callback used to return the result. | +### register -**Example** +register(callback: AsyncCallback\): void -```js -connection.disableAirplaneMode(function (error) { - console.log(JSON.stringify(error)) -}) -``` +Registers a listener for network status changes. -## connection.disableAirplaneMode +**Required permission**: ohos.permission.GET_NETWORK_INFO -disableAirplaneMode(): Promise\ +**System capability**: SystemCapability.Communication.NetManager.Core -Disables the airplane mode. This API uses a promise to return the result. +**Parameters** -**System API**: This is a system API. +| Name | Type | Mandatory| Description | +| -------- | -------------------- | ---- | ---------- | +| callback | AsyncCallback\ | Yes | Callback used to return the result. If a listener for network status changes is registered successfully, **err** is **undefined**. Otherwise, **err** is an error object.| -**System capability**: SystemCapability.Communication.NetManager.Core +**Error codes** -**Return value** +| ID| Error Message | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | +| 2101008 | The callback is not exists. | +| 2101022 | The number of requests exceeded the maximum. | -| Type | Description | -| ------------------------------------------- | ----------------------------- | -| Promise\ | Promise that returns no value.| **Example** ```js -connection.disableAirplaneMode().then(function (error) { +netConnection.register(function (error) { console.log(JSON.stringify(error)) }) ``` -## connection.createNetConnection +### unregister -createNetConnection(netSpecifier?: NetSpecifier, timeout?: number): NetConnection +unregister(callback: AsyncCallback\): void -Obtains the handle of the network specified by **netSpecifier**. +Unregisters the listener for network status changes. **System capability**: SystemCapability.Communication.NetManager.Core **Parameters** -| Name | Type | Mandatory| Description | -| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ | -| netSpecifier | [NetSpecifier](#netspecifier) | No | Network specifier. If this parameter is not set, the default network is used. | -| timeout | number | No | Timeout interval for obtaining the network specified by **netSpecifier**. This parameter is valid only when **netSpecifier** is set.| +| Name | Type | Mandatory| Description | +| -------- | -------------------- | ---- | ---------- | +| callback | AsyncCallback\ | Yes | Callback used to return the result. If a listener for network status changes is unregistered successfully, **err** is **undefined**. Otherwise, **err** is an error object.| -**Return value** +**Error codes** -| Type | Description | -| ------------------------------- | -------------------- | -| [NetConnection](#netconnection) | Handle of the network specified by **netSpecifier**.| +| ID| Error Message | +| ------- | ----------------------------- | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | +| 2101007 | The same callback exists. | **Example** ```js -// Default network -let netConnection = connection.createNetConnection() - -// Cellular network -let netConnectionCellular = connection.createNetConnection({ - netCapabilities: { - bearerTypes: [connection.NetBearType.BEARER_CELLULAR] - } +netConnection.unregister(function (error) { + console.log(JSON.stringify(error)) }) ``` -## NetConnection - -Represents the network connection handle. - ### on('netAvailable') on(type: 'netAvailable', callback: Callback\): void Registers a listener for **netAvailable** events. +**Model restriction**: Before you call this API, make sure that you have called **register** to add a listener and called **unregister** API to unsubscribe from status changes of the default network. + **System capability**: SystemCapability.Communication.NetManager.Core **Parameters** | Name | Type | Mandatory| Description | | -------- | ---------------------------------- | ---- | ------------------------------------------------------------ | -| 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. | +| type | string | Yes | Event type. The value is fixed to **netAvailable**.
**netAvailable**: event indicating that the data network is available.| +| callback | Callback\<[NetHandle](#nethandle)> | Yes | Callback used to return the network handle.| **Example** ```js -netConnection.on('netAvailable', function (data) { +// Create a NetConnection object. +let netCon = connection.createNetConnection() + +// Call register to register a listener. +netCon.register(function (error) { + console.log(JSON.stringify(error)) +}) + +// Subscribe to netAvailable events. Event notifications can be received only after register is called. +netCon.on('netAvailable', function (data) { console.log(JSON.stringify(data)) }) + +// Call unregister to unregister the listener. +netCon.unregister(function (error) { + console.log(JSON.stringify(error)) +}) ``` -### on('netCapabilitiesChange') +### on('netBlockStatusChange') -on(type: 'netCapabilitiesChange', callback: Callback<{ netHandle: NetHandle, netCap: NetCapabilities }>): void +on(type: 'netBlockStatusChange', callback: Callback<{ netHandle: NetHandle, blocked: boolean }>): void -Registers a listener for **netCapabilitiesChange** events. +Registers a listener for **netBlockStatusChange** events. + +**Model restriction**: Before you call this API, make sure tat you have called **register** to add a listener and called **unregister** API to unsubscribe from status changes of the default network. **System capability**: SystemCapability.Communication.NetManager.Core @@ -707,22 +1291,38 @@ Registers a listener for **netCapabilitiesChange** events. | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| 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. | +| type | string | Yes | Event type. The value is fixed to **netBlockStatusChange**.
**netBlockStatusChange**: event indicating a change in the network blocking status.| +| callback | Callback<{ netHandle: [NetHandle](#nethandle), blocked: boolean }> | Yes | Callback used to return the network handle (**netHandle**) and network status (**blocked**).| **Example** ```js -netConnection.on('netCapabilitiesChange', function (data) { +// Create a NetConnection object. +let netCon = connection.createNetConnection() + +// Call register to register a listener. +netCon.register(function (error) { + console.log(JSON.stringify(error)) +}) + +// Subscribe to netBlockStatusChange events. Event notifications can be received only after register is called. +netCon.on('netBlockStatusChange', function (data) { console.log(JSON.stringify(data)) }) + +// Call unregister to unregister the listener. +netCon.unregister(function (error) { + console.log(JSON.stringify(error)) +}) ``` -### on('netConnectionPropertiesChange') +### on('netCapabilitiesChange') -on(type: 'netConnectionPropertiesChange', callback: Callback<{ netHandle: NetHandle, connectionProperties: ConnectionProperties }>): void +on(type: 'netCapabilitiesChange', callback: Callback<{ netHandle: NetHandle, netCap: NetCapabilities }>): void -Registers a listener for **netConnectionPropertiesChange** events. +Registers a listener for **netCapabilitiesChange** events. + +**Model restriction**: Before you call this API, make sure tat you have called **register** to add a listener and called **unregister** API to unsubscribe from status changes of the default network. **System capability**: SystemCapability.Communication.NetManager.Core @@ -730,22 +1330,38 @@ Registers a listener for **netConnectionPropertiesChange** events. | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| 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. | +| type | string | Yes | Event type. The value is fixed to **netCapabilitiesChange**.
**netCapabilitiesChange**: event indicating that the network capabilities have changed.| +| callback | Callback<{ netHandle: [NetHandle](#nethandle), netCap: [NetCapabilities](#netcapabilities) }> | Yes | Callback used to return the network handle (**netHandle**) and capability information (**netCap**).| **Example** ```js -netConnection.on('netConnectionPropertiesChange', function (data) { +// Create a NetConnection object. +let netCon = connection.createNetConnection() + +// Call register to register a listener. +netCon.register(function (error) { + console.log(JSON.stringify(error)) +}) + +// Subscribe to netCapabilitiesChange events. Event notifications can be received only after register is called. +netCon.on('netCapabilitiesChange', function (data) { console.log(JSON.stringify(data)) }) + +// Call unregister to unregister the listener. +netCon.unregister(function (error) { + console.log(JSON.stringify(error)) +}) ``` -### on('netBlockStatusChange') +### on('netConnectionPropertiesChange') -on(type: 'netBlockStatusChange', callback: Callback<{ netHandle: NetHandle, blocked: boolean }>): void +on(type: 'netConnectionPropertiesChange', callback: Callback<{ netHandle: NetHandle, connectionProperties: ConnectionProperties }>): void -Registers a listener for **netBlockStatusChange** events. +Registers a listener for **netConnectionPropertiesChange** events. + +**Model restriction**: Before you call this API, make sure tat you have called **register** to add a listener and called **unregister** API to unsubscribe from status changes of the default network. **System capability**: SystemCapability.Communication.NetManager.Core @@ -753,15 +1369,29 @@ Registers a listener for **netBlockStatusChange** events. | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| 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. | +| type | string | Yes | Event type. The value is fixed to **netConnectionPropertiesChange**.
**netConnectionPropertiesChange**: event indicating that network connection properties have changed.| +| callback | Callback<{ netHandle: [NetHandle](#nethandle), connectionProperties: [ConnectionProperties](#connectionproperties) }> | Yes | Callback used to return the network handle (**netHandle**) and capability information (**netCap**).| **Example** ```js -netConnection.on('netBlockStatusChange', function (data) { +// Create a NetConnection object. +let netCon = connection.createNetConnection() + +// Call register to register a listener. +netCon.register(function (error) { + console.log(JSON.stringify(error)) +}) + +// Subscribe to netConnectionPropertiesChange events. Event notifications can be received only after register is called. +netCon.on('netConnectionPropertiesChange', function (data) { console.log(JSON.stringify(data)) }) + +// Call unregister to unregister the listener. +netCon.unregister(function (error) { + console.log(JSON.stringify(error)) +}) ``` ### on('netLost') @@ -770,22 +1400,37 @@ on(type: 'netLost', callback: Callback\): void Registers a listener for **netLost** events. +**Model restriction**: Before you call this API, make sure tat you have called **register** to add a listener and called **unregister** API to unsubscribe from status changes of the default network. + **System capability**: SystemCapability.Communication.NetManager.Core **Parameters** | Name | Type | Mandatory| Description | | -------- | ---------------------------------- | ---- | ------------------------------------------------------------ | -| 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. | +| type | string | Yes | Event type. The value is fixed to **netLost**.
netLost: event indicating that the network is interrupted or normally disconnected.| +| callback | Callback\<[NetHandle](#nethandle)> | Yes | Callback used to return the network handle (**netHandle**).| **Example** ```js -let netConnection1 = connection.createNetConnection() -netConnection1.on('netLost', function (data) { +// Create a NetConnection object. +let netCon = connection.createNetConnection() + +// Call register to register a listener. +netCon.register(function (error) { + console.log(JSON.stringify(error)) +}) + +// Subscribe to netLost events. Event notifications can be received only after register is called. +netCon.on('netLost', function (data) { console.log(JSON.stringify(data)) }) + +// Call unregister to unregister the listener. +netCon.unregister(function (error) { + console.log(JSON.stringify(error)) +}) ``` ### on('netUnavailable') @@ -794,65 +1439,35 @@ on(type: 'netUnavailable', callback: Callback\): void Registers a listener for **netUnavailable** events. +**Model restriction**: Before you call this API, make sure tat you have called **register** to add a listener and called **unregister** API to unsubscribe from status changes of the default network. + **System capability**: SystemCapability.Communication.NetManager.Core **Parameters** | Name | Type | Mandatory| Description | | -------- | --------------- | ---- | ------------------------------------------------------------ | -| 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. | +| type | string | Yes | Event type. The value is fixed to **netUnavailable**.
**netUnavailable**: event indicating that the network is unavailable.| +| callback | Callback\ | Yes | Callback used to return the result, which is empty.| **Example** ```js -netConnection.on('netUnavailable', function (data) { - console.log(JSON.stringify(data)) -}) -``` - -### register - -register(callback: AsyncCallback\): void - -Registers a listener for network status changes. - -**Required permission**: ohos.permission.GET_NETWORK_INFO - -**System capability**: SystemCapability.Communication.NetManager.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | -------------------- | ---- | ---------- | -| callback | AsyncCallback\ | Yes | Callback used to return the result.| +// Create a NetConnection object. +let netCon = connection.createNetConnection() -**Example** - -```js -netConnection.register(function (error) { +// Call register to register a listener. +netCon.register(function (error) { console.log(JSON.stringify(error)) }) -``` - -### unregister - -unregister(callback: AsyncCallback\): void - -Unregisters the listener for network status changes. - -**System capability**: SystemCapability.Communication.NetManager.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| -------- | -------------------- | ---- | ---------- | -| callback | AsyncCallback\ | Yes | Callback used to return the result.| -**Example** +// Subscribe to netUnavailable events. Event notifications can be received only after register is called. +netCon.on('netUnavailable', function (data) { + console.log(JSON.stringify(data)) +}) -```js -netConnection.unregister(function (error) { +// Call unregister to unregister the listener. +netCon.unregister(function (error) { console.log(JSON.stringify(error)) }) ``` @@ -861,24 +1476,22 @@ netConnection.unregister(function (error) { Defines the handle of the data network. -Before invoking NetHandle APIs, call **getNetHandle** to obtain a **NetHandle** object. +Before invoking **NetHandle** APIs, call **getNetHandle** to obtain a **NetHandle** object. **System capability**: SystemCapability.Communication.NetManager.Core -### Parameters +### Attributes -| Name| Type | Description | -| ------ | ------ | ------------------------- | -| netId | number | Network ID. The value **0** indicates no default network. Any other value must be greater than or equal to 100.| +| Name | Type | Mandatory| Description | +| ------ | ------ | --- |------------------------- | +| netId | number | Yes | Network ID. The value **0** indicates no default network. Any other value must be greater than or equal to 100.| ### bindSocket9+ -bindSocket(socketParam: TCPSocket \| UDPSocket, callback: AsyncCallback\): void; +bindSocket(socketParam: TCPSocket \| UDPSocket, callback: AsyncCallback\): void Binds a **TCPSocket** or **UDPSocket** object to the data network. This API uses an asynchronous callback to return the result. -**Required permission**: ohos.permission.GET_NETWORK_INFO - **System capability**: SystemCapability.Communication.NetManager.Core **Parameters** @@ -886,24 +1499,33 @@ Binds a **TCPSocket** or **UDPSocket** object to the data network. This API uses | Name | Type | Mandatory| Description | | ----------- | ------------------------ | ---- | -------------------------------| | socketParam | [TCPSocket](js-apis-socket.md#tcpsocket) \| [UDPSocket](js-apis-socket.md#udpsocket) | Yes| **TCPSocket** or **UDPSocket** object.| -| callback | AsyncCallback\ | Yes | Callback used to return the result. | +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the **TCPSocket** or **UDPSocket** object is successfully bound to the current network, **err** is **undefined**. Otherwise, **err** is an error object.| + +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | **Example** ```js import socket from "@ohos.net.socket"; -connection.getDefaultNet().then((netHandle)=>{ +connection.getDefaultNet().then((netHandle) => { var tcp = socket.constructTCPSocketInstance(); var udp = socket.constructUDPSocketInstance(); let socketType = "TCPSocket"; if (socketType == "TCPSocket") { tcp.bind({ - address: '192.168.xx.xxx', port: xxxx, family: 1 - }, err => { - if (err) { + address: '192.168.xx.xxx', port: 8080, family: 1 + }, error => { + if (error) { console.log('bind fail'); } - netHandle.bindSocket(tcp, (error, data)=>{ + netHandle.bindSocket(tcp, (error, data) => { if (error) { console.log(JSON.stringify(error)); } else { @@ -913,19 +1535,19 @@ connection.getDefaultNet().then((netHandle)=>{ }) } else { let callback = value => { - console.log(TAG + "on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo); + console.log("on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo); } udp.on('message', callback); udp.bind({ - address: '192.168.xx.xxx', port: xxxx, family: 1 - }, err => { - if (err) { + address: '192.168.xx.xxx', port: 8080, family: 1 + }, error => { + if (error) { console.log('bind fail'); } udp.on('message', (data) => { console.log(JSON.stringify(data)) }); - netHandle.bindSocket(udp,(error, data)=>{ + netHandle.bindSocket(udp, (error, data) => { if (error) { console.log(JSON.stringify(error)); } else { @@ -937,14 +1559,12 @@ connection.getDefaultNet().then((netHandle)=>{ }) ``` -### bindSocket +### bindSocket9+ bindSocket(socketParam: TCPSocket \| UDPSocket): Promise\; Binds a **TCPSocket** or **UDPSocket** object to the data network. This API uses a promise to return the result. -**Required permission**: ohos.permission.GET_NETWORK_INFO - **System capability**: SystemCapability.Communication.NetManager.Core **Parameters** @@ -959,63 +1579,67 @@ Binds a **TCPSocket** or **UDPSocket** object to the data network. This API uses | -------------- | ---------------------- | | Promise\ | Promise that returns no value.| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + **Example** ```js import socket from "@ohos.net.socket"; -connection.getDefaultNet().then((netHandle)=>{ +connection.getDefaultNet().then((netHandle) => { var tcp = socket.constructTCPSocketInstance(); var udp = socket.constructUDPSocketInstance(); let socketType = "TCPSocket"; if (socketType == "TCPSocket") { tcp.bind({ - address: '192.168.xx.xxx', port: xxxx, family: 1 - }, err => { - if (err) { + address: '192.168.xx.xxx', port: 8080, family: 1 + }, error => { + if (error) { console.log('bind fail'); } - netHandle.bindSocket(tcp).then((err, data) => { - if (err) { - console.log(JSON.stringify(err)); - } else { - console.log(JSON.stringify(data)); - } + netHandle.bindSocket(tcp).then((data) => { + console.log(JSON.stringify(data)); + }).catch(error => { + console.log(JSON.stringify(error)); }) }) } else { let callback = value => { - console.log(TAG + "on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo); + console.log("on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo); } udp.on('message', callback); udp.bind({ - address: '192.168.xx.xxx', port: xxxx, family: 1 - }, err => { - if (err) { + address: '192.168.xx.xxx', port: 8080, family: 1 + }, error => { + if (error) { console.log('bind fail'); } udp.on('message', (data) => { console.log(JSON.stringify(data)); }) - netHandle.bindSocket(udp).then((err, data) => { - if (err) { - console.log(JSON.stringify(err)); - } else { - console.log(JSON.stringify(data)); - } + netHandle.bindSocket(udp).then((data) => { + console.log(JSON.stringify(data)); + }).catch(error => { + console.log(JSON.stringify(error)); }) }) } }) ``` - ### getAddressesByName getAddressesByName(host: string, callback: AsyncCallback\>): void Resolves the host name by using the corresponding network to obtain all IP addresses. This API uses an asynchronous callback to return the result. -**Required permission**: ohos.permission.GET_NETWORK_INFO +**Required permissions**: ohos.permission.INTERNET **System capability**: SystemCapability.Communication.NetManager.Core @@ -1023,17 +1647,27 @@ Resolves the host name by using the corresponding network to obtain all IP addre | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------- | ---- | ------------------ | -| host | string | Yes | Host name to be resolved.| -| callback | AsyncCallback\> | Yes | Callback used to return the result. | +| host | string | Yes | Host name to resolve.| +| callback | AsyncCallback\> | Yes | Callback used to return the result. If all IP addresses are successfully obtained, **err** is **undefined**, and **data** is the list of all obtained IP addresses. Otherwise, **err** is an error object.| + +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | **Example** ```js connection.getDefaultNet().then(function (netHandle) { let host = "xxxx"; - netHandle.getAddressesByName(host, function (error, addresses) { + netHandle.getAddressesByName(host, function (error, data) { console.log(JSON.stringify(error)) - console.log(JSON.stringify(addresses)) + console.log(JSON.stringify(data)) }) }) ``` @@ -1044,7 +1678,7 @@ getAddressesByName(host: string): Promise\> Resolves the host name by using the corresponding network to obtain all IP addresses. This API uses a promise to return the result. -**Required permission**: ohos.permission.GET_NETWORK_INFO +**Required permissions**: ohos.permission.INTERNET **System capability**: SystemCapability.Communication.NetManager.Core @@ -1052,7 +1686,7 @@ Resolves the host name by using the corresponding network to obtain all IP addre | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------ | -| host | string | Yes | Host name to be resolved.| +| host | string | Yes | Host name to resolve.| **Return value** @@ -1060,13 +1694,23 @@ Resolves the host name by using the corresponding network to obtain all IP addre | ------------------------------------------- | ----------------------------- | | Promise\> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + **Example** ```js connection.getDefaultNet().then(function (netHandle) { let host = "xxxx"; - netHandle.getAddressesByName(host).then(function (addresses) { - console.log(JSON.stringify(addresses)) + netHandle.getAddressesByName(host).then(function (data) { + console.log(JSON.stringify(data)) }) }) ``` @@ -1077,7 +1721,7 @@ getAddressByName(host: string, callback: AsyncCallback\): void Resolves the host name by using the corresponding network to obtain the first IP address. This API uses an asynchronous callback to return the result. -**Required permission**: ohos.permission.GET_NETWORK_INFO +**Required permissions**: ohos.permission.INTERNET **System capability**: SystemCapability.Communication.NetManager.Core @@ -1085,17 +1729,27 @@ Resolves the host name by using the corresponding network to obtain the first IP | Name | Type | Mandatory| Description | | -------- | ----------------------------------------- | ---- | ------------------ | -| host | string | Yes | Host name to be resolved.| -| callback | AsyncCallback\<[NetAddress](#netaddress)> | Yes | Callback used to return the result. | +| host | string | Yes | Host name to resolve.| +| callback | AsyncCallback\<[NetAddress](#netaddress)> | Yes | Callback used to return the result. If the first IP address is obtained successfully, **err** is **undefined**, and **data** is the first obtained IP address. Otherwise, **err** is an error object. | + +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | **Example** ```js connection.getDefaultNet().then(function (netHandle) { let host = "xxxx"; - netHandle.getAddressByName(host, function (error, address) { + netHandle.getAddressByName(host, function (error, data) { console.log(JSON.stringify(error)) - console.log(JSON.stringify(address)) + console.log(JSON.stringify(data)) }) }) ``` @@ -1106,7 +1760,7 @@ getAddressByName(host: string): Promise\ Resolves the host name by using the corresponding network to obtain the first IP address. This API uses a promise to return the result. -**Required permission**: ohos.permission.GET_NETWORK_INFO +**Required permissions**: ohos.permission.INTERNET **System capability**: SystemCapability.Communication.NetManager.Core @@ -1114,7 +1768,7 @@ Resolves the host name by using the corresponding network to obtain the first IP | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------ | -| host | string | Yes | Host name to be resolved.| +| host | string | Yes | Host name to resolve.| **Return value** @@ -1122,66 +1776,88 @@ Resolves the host name by using the corresponding network to obtain the first IP | ----------------------------------- | ------------------------------- | | Promise\<[NetAddress](#netaddress)> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + **Example** ```js connection.getDefaultNet().then(function (netHandle) { let host = "xxxx"; - netHandle.getAddressByName(host).then(function (address) { - console.log(JSON.stringify(address)) + netHandle.getAddressByName(host).then(function (data) { + console.log(JSON.stringify(data)) }) }) ``` -## NetSpecifier +## NetCap -Provides an instance that bears data network capabilities. +Defines the network capability. **System capability**: SystemCapability.Communication.NetManager.Core -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| netCapabilities | [NetCapabilities](#netcapabilities) | Yes | Network transmission capabilities and bearer types of the data network. | -| bearerPrivateIdentifier | string | No | Network identifier. The identifier of a Wi-Fi network is **wifi**, and that of a cellular network is **slot0** (corresponding to SIM card 1).| +| Name | Value | Description | +| ------------------------ | ---- | ---------------------- | +| NET_CAPABILITY_MMS | 0 | The network can connect to the carrier's Multimedia Messaging Service Center (MMSC) to send and receive multimedia messages.| +| NET_CAPABILITY_NOT_METERED | 11 | The network traffic is not metered.| +| NET_CAPABILITY_INTERNET | 12 | The network has the Internet access capability, which is set by the network provider.| +| NET_CAPABILITY_NOT_VPN | 15 | The network does not use a virtual private network (VPN).| +| NET_CAPABILITY_VALIDATED | 16 | The Internet access capability of the network is successfully verified by the connection management module.| -## NetCapabilities +## NetBearType -Defines the network capability set. +Enumerates network types. **System capability**: SystemCapability.Communication.NetManager.Core -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| linkUpBandwidthKbps | number | No | Uplink (from the device to the network) bandwidth.| -| linkDownBandwidthKbps | number | No | Downlink (from the network to the device) bandwidth.| -| networkCap | Array<[NetCap](#netcap)> | No | Network capability. | -| bearerTypes | Array<[NetBearType](#netbeartype)> | Yes | Network type. | +| Name | Value | Description | +| --------------- | ---- | ----------- | +| BEARER_CELLULAR | 0 | Cellular network. | +| BEARER_WIFI | 1 | Wi-Fi network.| +| BEARER_ETHERNET | 3 | Ethernet network.| -## NetCap +## HttpProxy10+ -Defines the network capability. +Defines the global HTTP proxy configuration of the network. **System capability**: SystemCapability.Communication.NetManager.Core -| Name | Value | Description | -| ------------------------ | ---- | ---------------------- | -| NET_CAPABILITY_MMS | 0 | The network can connect to the carrier's Multimedia Messaging Service Center (MMSC) to send and receive multimedia messages.| -| NET_CAPABILITY_NOT_METERED | 11 | The network traffic is not metered.| -| NET_CAPABILITY_INTERNET | 12 | The network can connect to the Internet.| -| NET_CAPABILITY_NOT_VPN | 15 | The network does not use a Virtual Private Network (VPN).| -| NET_CAPABILITY_VALIDATED | 16 | The network is available. | +| Name | Type | Mandatory| Description | +| ------ | ------ | --- |------------------------- | +| host | string | No | Host name of the proxy server.| +| port | number | No | Host port.| +| exclusionList | Array | No | List of hosts that do not use the proxy server.| -## NetBearType +## NetSpecifier -Defines the network type. +Provides an instance that bears data network capabilities. **System capability**: SystemCapability.Communication.NetManager.Core -| Name | Value | Description | -| --------------- | ---- | ----------- | -| BEARER_CELLULAR | 0 | Cellular network | -| BEARER_WIFI | 1 | Wi-Fi network| -| BEARER_ETHERNET | 3 | Ethernet network| +| Name | Type | Mandatory | Description | +| ----------------------- | ----------------------------------- | ---- | ------------------------------------------------------------ | +| netCapabilities | [NetCapabilities](#netcapabilities) | Yes | Network transmission capabilities and bearer types of the data network. | +| bearerPrivateIdentifier | string | No | Network identifier. The identifier of a Wi-Fi network is **wifi**, and that of a cellular network is **slot0** (corresponding to SIM card 1).| + +## NetCapabilities + +Defines the network capability set. + +**System capability**: SystemCapability.Communication.NetManager.Core + +| Name | Type | Mandatory| Description | +| --------------------- | ---------------------------------- | --- | ------------------------ | +| linkUpBandwidthKbps | number | No| Uplink (from the device to the network) bandwidth. | +| linkDownBandwidthKbps | number | No| Downlink (from the network to the device) bandwidth. | +| networkCap | Array\<[NetCap](#netcap)> | No| Network capability. | +| bearerTypes | Array\<[NetBearType](#netbeartype)> | Yes| Network type. | ## ConnectionProperties @@ -1189,48 +1865,48 @@ Defines the network connection properties. **System capability**: SystemCapability.Communication.NetManager.Core -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| interfaceName | string | Yes | NIC card name. | -| domains | string | Yes | Domain. The default value is **""**.| -| linkAddresses | Array\<[LinkAddress](#linkaddress)> | Yes | Link information. | -| routes | Array\<[RouteInfo](#routeinfo)> | Yes | Route information. | -| dnses | Array\<[NetAddress](#netaddress)>; | Yes | Network address. For details, see [NetAddress](#netaddress).| -| mtu | number | Yes | Maximum transmission unit (MTU). | +| Name | Type | Mandatory| Description | +| ------------- | ---------------------------------- | ----|---------------- | +| interfaceName | string | Yes|Network interface card (NIC) name. | +| domains | string | Yes|Domain. The default value is **""**.| +| linkAddresses | Array\<[LinkAddress](#linkaddress)> | Yes|Link information. | +| routes | Array\<[RouteInfo](#routeinfo)> | Yes|Route information. | +| dnses | Array\<[NetAddress](#netaddress)> | Yes|Network address. For details, see [NetAddress](#netaddress).| +| mtu | number | Yes|Maximum transmission unit (MTU). | -## LinkAddress +## RouteInfo -Network link information. +Defines network route information. **System capability**: SystemCapability.Communication.NetManager.Core -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| address | [NetAddress](#netaddress) | Yes | Link address. | -| prefixLength | number | Yes | Length of the link address prefix.| +| Name | Type | Mandatory|Description | +| -------------- | --------------------------- | --- |---------------- | +| interface | string | Yes|NIC name. | +| destination | [LinkAddress](#linkaddress) | Yes|Destination address. | +| gateway | [NetAddress](#netaddress) | Yes|Gateway address. | +| hasGateway | boolean | Yes|Whether a gateway is present. | +| isDefaultRoute | boolean | Yes|Whether the route is the default route.| -## RouteInfo +## LinkAddress -Network route information. +Defines network link information. **System capability**: SystemCapability.Communication.NetManager.Core -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| interface | string | Yes | NIC card name. | -| destination | [LinkAddress](#linkaddress) | Yes | Destination IP address. | -| gateway | [NetAddress](#netaddress) | Yes | Gateway address. | -| hasGateway | boolean | Yes | Whether a gateway is present. | -| isDefaultRoute | boolean | Yes | Whether the route is the default route.| +| Name | Type | Mandatory|Description | +| ------------ | ----------------------- |---- |-------------------- | +| address | [NetAddress](#netaddress) | Yes| Link address. | +| prefixLength | number | Yes|Length of the link address prefix.| ## NetAddress -Defines the network address. +Defines a network address. **System capability**: SystemCapability.Communication.NetManager.Core -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| address | string | Yes | Network address. | -| family | number | Yes | Address family identifier. The value is **1** for IPv4 and **2** for IPv6. The default value is **1**.| -| port | number | No | Port number. The value ranges from **0** to **65535**. | +| Name | Type | Mandatory| Description | +| ------- | ------ | -- |------------------------------ | +| address | string | Yes|Network address. | +| family | number | No|Address family identifier. The value is **1** for IPv4 and **2** for IPv6. The default value is **1**.| +| port | number | No|Port number. The value ranges from **0** to **65535**. | diff --git a/en/application-dev/reference/apis/js-apis-net-ethernet.md b/en/application-dev/reference/apis/js-apis-net-ethernet.md index d41845ec1859507bb96a071dff2a57e16f4cf12b..d86e3904ec9c8789a645fde87492da5f5cd0c250 100644 --- a/en/application-dev/reference/apis/js-apis-net-ethernet.md +++ b/en/application-dev/reference/apis/js-apis-net-ethernet.md @@ -1,8 +1,8 @@ -# @ohos.net.ethernet (Ethernet Connection Management) +# # @ohos.net.ethernet (Ethernet Connection Management) The **ethernet** module provides wired network capabilities, which allow users to set the IP address, subnet mask, gateway, and Domain Name System (DNS) server of a wired network. -> **NOTE**
+> **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 @@ -17,30 +17,51 @@ setIfaceConfig(iface: string, ic: InterfaceConfiguration, callback: AsyncCallbac Sets the network interface configuration. This API uses an asynchronous callback to return the result. +**System API**: This is a system API. + **Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL -**System capability**: SystemCapability.Communication.NetManager.Core +**System capability**: SystemCapability.Communication.NetManager.Ethernet **Parameters** | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------- | ---- | ------------------------------------------ | -| iface | string | Yes | Name of the network interface. | +| iface | string | Yes | Interface name. | | ic | [InterfaceConfiguration](#interfaceconfiguration) | Yes | Network interface configuration to set. | | callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, the return result is empty. If the operation fails, an error code is returned.| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------------------| +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service.| +| 2200003 | System internal error. | +| 2201005 | The device information does not exist. | +| 2201006 | Device disconnected. | +| 2201007 | Failed to write the user configuration. | + **Example** ```js -ethernet.setIfaceConfig("eth0", {mode:ethernet.STATIC,ipAddr:"192.168.1.123", routeAddr:"192.168.1.1", - gateAddr:"192.168.1.1", maskAddr:"255.255.255.0", dnsAddr0:"1.1.1.1", dnsAddr1:"2.2.2.2"}, - (error) => { - if (error) { - console.log("setIfaceConfig callback error = " + error); - } else { - console.log("setIfaceConfig callback ok "); - } - }); +ethernet.setIfaceConfig("eth0", { + mode: 0, + ipAddr: "192.168.xx.xxx", + route: "192.168.xx.xxx", + gateway: "192.168.xx.xxx", + netMask: "255.255.255.0", + dnsServers: "1.1.1.1", + domain: "2.2.2.2" +}, (error) => { + if (error) { + console.log("setIfaceConfig callback error = " + JSON.stringify(error)); + } else { + console.log("setIfaceConfig callback ok "); + } +}); ``` ## ethernet.setIfaceConfig @@ -49,31 +70,53 @@ setIfaceConfig(iface: string, ic: InterfaceConfiguration): Promise\ Sets the network interface configuration. This API uses a promise to return the result. +**System API**: This is a system API. + **Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL -**System capability**: SystemCapability.Communication.NetManager.Core +**System capability**: SystemCapability.Communication.NetManager.Ethernet **Parameters** | Name| Type | Mandatory| Description | | ------ | ------------------------------------------------- | ---- | ------------------------ | -| iface | string | Yes | Name of the network interface. | +| iface | string | Yes | Interface name. | | ic | [InterfaceConfiguration](#interfaceconfiguration) | Yes | Network interface configuration to set.| **Return value** | Type | Description | | ------------------- | ----------------------------------------------------------- | -| Promise\ | Promise that returns no value.| +| Promise\ | Promise used to return the result. If the operation is successful, the return result is empty. If the operation fails, an error code is returned.| + +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------------------| +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service.| +| 2200003 | System internal error. | +| 2201005 | The device information does not exist. | +| 2201006 | Device disconnected. | +| 2201007 | Failed to write the user configuration. | **Example** ```js -ethernet.setIfaceConfig("eth0", {mode:ethernet.STATIC,ipAddr:"192.168.1.123", routeAddr:"192.168.1.1", - gateAddr:"192.168.1.1", maskAddr:"255.255.255.0", dnsAddr0:"1.1.1.1", dnsAddr1:"2.2.2.2"}).then(() => { - console.log("setIfaceConfig promiss ok "); -}).catch((error) => { - console.log("setIfaceConfig promiss error = " + error); +ethernet.setIfaceConfig("eth0", { + mode: 0, + ipAddr: "192.168.xx.xxx", + route: "192.168.xx.xxx", + gateway: "192.168.xx.xxx", + netMask: "255.255.255.0", + dnsServers: "1.1.1.1", + domain: "2.2.2.2" +}).then(() => { + console.log("setIfaceConfig promise ok "); +}).catch(error => { + console.log("setIfaceConfig promise error = " + JSON.stringify(error)); }); ``` @@ -83,31 +126,44 @@ getIfaceConfig(iface: string, callback: AsyncCallback\): Obtains the configuration of a network interface. This API uses an asynchronous callback to return the result. +**System API**: This is a system API. + **Required permission**: ohos.permission.GET_NETWORK_INFO -**System capability**: SystemCapability.Communication.NetManager.Core +**System capability**: SystemCapability.Communication.NetManager.Ethernet **Parameters** | Name | Type | Mandatory | Description | | -------- | ----------------------------------------------- | ----- | ------------ | -| iface | string | Yes | Name of the network interface.| -| callback | AsyncCallback\<[InterfaceConfiguration](#interfaceconfiguration)> | Yes | Callback used to return the configuration. | +| iface | string | Yes | Interface name.| +| callback | AsyncCallback\<[InterfaceConfiguration](#interfaceconfiguration)> | Yes | Callback used to return the result. | + +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------------------| +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service.| +| 2200003 | System internal error. | +| 2201005 | The device information does not exist. | **Example** ```js ethernet.getIfaceConfig("eth0", (error, value) => { if (error) { - console.log("getIfaceConfig callback error = " + error); + console.log("getIfaceConfig callback error = " + JSON.stringify(error)); } else { - console.log("getIfaceConfig callback mode = " + value.mode); - console.log("getIfaceConfig callback ipAddr = " + value.ipAddr); - console.log("getIfaceConfig callback routeAddr = " + value.routeAddr); - console.log("getIfaceConfig callback gateAddr = " + value.gateAddr); - console.log("getIfaceConfig callback maskAddr = " + value.maskAddr); - console.log("getIfaceConfig callback dns0Addr = " + value.dns0Addr); - console.log("getIfaceConfig callback dns1Addr = " + value.dns1Addr); + console.log("getIfaceConfig callback mode = " + JSON.stringify(value.mode)); + console.log("getIfaceConfig callback ipAddr = " + JSON.stringify(value.ipAddr)); + console.log("getIfaceConfig callback route = " + JSON.stringify(value.route)); + console.log("getIfaceConfig callback gateway = " + JSON.stringify(value.gateway)); + console.log("getIfaceConfig callback netMask = " + JSON.stringify(value.netMask)); + console.log("getIfaceConfig callback dnsServers = " + JSON.stringify(value.dnsServers)); + console.log("getIfaceConfig callback domain = " + JSON.stringify(value.domain)); } }); ``` @@ -118,64 +174,90 @@ getIfaceConfig(iface: string): Promise\ Obtains the configuration of a network interface. This API uses a promise to return the result. +**System API**: This is a system API. + **Required permission**: ohos.permission.GET_NETWORK_INFO -**System capability**: SystemCapability.Communication.NetManager.Core +**System capability**: SystemCapability.Communication.NetManager.Ethernet **Parameters** | Name | Type | Mandatory| Description | | -------- | --------------------------------------- | ---- | ------------ | -| iface | string | Yes | Name of the network interface.| +| iface | string | Yes | Interface name.| **Return value** | Type | Description | | --------------------------------- | ---------------------------------- | -| Promise\<[InterfaceConfiguration](#interfaceconfiguration)> | Promise used to return the configuration. | +| Promise\<[InterfaceConfiguration](#interfaceconfiguration)> | Promise used to return the result. | + +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------------------| +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service.| +| 2200003 | System internal error. | +| 2201005 | The device information does not exist. | **Example** ```js ethernet.getIfaceConfig("eth0").then((data) => { - console.log("getIfaceConfig promiss mode = " + data.mode); - console.log("getIfaceConfig promiss ipAddr = " + data.ipAddr); - console.log("getIfaceConfig promiss routeAddr = " + data.routeAddr); - console.log("getIfaceConfig promiss gateAddr = " + data.gateAddr); - console.log("getIfaceConfig promiss maskAddr = " + data.maskAddr); - console.log("getIfaceConfig promiss dns0Addr = " + data.dns0Addr); - console.log("getIfaceConfig promiss dns1Addr = " + data.dns1Addr); -}).catch((error) => { - console.log("getIfaceConfig promiss error = " + error); + console.log("getIfaceConfig promise mode = " + JSON.stringify(data.mode)); + console.log("getIfaceConfig promise ipAddr = " + JSON.stringify(data.ipAddr)); + console.log("getIfaceConfig promise route = " + JSON.stringify(data.route)); + console.log("getIfaceConfig promise gateway = " + JSON.stringify(data.gateway)); + console.log("getIfaceConfig promise netMask = " + JSON.stringify(data.netMask)); + console.log("getIfaceConfig promise dnsServers = " + JSON.stringify(data.dnsServers)); + console.log("getIfaceConfig promise domain = " + JSON.stringify(data.domain)); +}).catch(error => { + console.log("getIfaceConfig promise error = " + JSON.stringify(error)); }); ``` ## ethernet.isIfaceActive -isIfaceActive(iface?: string, callback: AsyncCallback\): void +isIfaceActive(iface: string, callback: AsyncCallback\): void Checks whether a network interface is active. This API uses an asynchronous callback to return the result. +**System API**: This is a system API. + **Required permission**: ohos.permission.GET_NETWORK_INFO -**System capability**: SystemCapability.Communication.NetManager.Core +**System capability**: SystemCapability.Communication.NetManager.Ethernet **Parameters** | Name | Type | Mandatory| Description | | -------- | --------------------------- | ---- | -------------------------------------------------- | -| iface | string | Yes | Name of the network interface. If this parameter is left empty, the API checks for any active network interface. | +| iface | string | Yes | Interface name. If this parameter is left empty, the API checks for any active network interface. | | callback | AsyncCallback\ | Yes | Callback used to return the result. The value **1** means that the network interface is active, **0** means that the network interface is inactive, and any other value means that an error has occurred.| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------------------| +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service.| +| 2200003 | System internal error. | +| 2201005 | The device information does not exist. | + **Example** ```js ethernet.isIfaceActive("eth0", (error, value) => { - if (error) { - console.log("whether2Activate callback error = " + error); - } else { - console.log("whether2Activate callback = " + value); - } + if (error) { + console.log("whether2Activate callback error = " + JSON.stringify(error)); + } else { + console.log("whether2Activate callback = " + JSON.stringify(value)); + } }); ``` @@ -185,15 +267,17 @@ isIfaceActive(iface: string): Promise\ Checks whether a network interface is active. This API uses a promise to return the result. +**System API**: This is a system API. + **Required permission**: ohos.permission.GET_NETWORK_INFO -**System capability**: SystemCapability.Communication.NetManager.Core +**System capability**: SystemCapability.Communication.NetManager.Ethernet **Parameters** | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------------------- | -| iface | string | Yes | Name of the network interface. If this parameter is left empty, the API checks for any active network interface.| +| iface | string | Yes | Interface name. If this parameter is left empty, the API checks for any active network interface.| **Return value** @@ -201,13 +285,24 @@ Checks whether a network interface is active. This API uses a promise to return | ----------------| ------------------------------------------------------------------ | | Promise\ | Promise used to return the result. The value **1** means that the network interface is active, **0** means that the network interface is inactive, and any other value means that an error has occurred.| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------------------| +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service.| +| 2200003 | System internal error. | +| 2201005 | The device information does not exist. | + **Example** ```js ethernet.isIfaceActive("eth0").then((data) => { - console.log("isIfaceActive promiss = " + data); -}).catch((error) => { - console.log("isIfaceActive promiss error = " + error); + console.log("isIfaceActive promise = " + JSON.stringify(data)); +}).catch(error => { + console.log("isIfaceActive promise error = " + JSON.stringify(error)); }); ``` @@ -215,30 +310,40 @@ ethernet.isIfaceActive("eth0").then((data) => { getAllActiveIfaces(callback: AsyncCallback\>): void -Obtains all active network interfaces. This API uses an asynchronous callback to return the result. +Obtains the list of all active network interfaces. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. **Required permission**: ohos.permission.GET_NETWORK_INFO -**System capability**: SystemCapability.Communication.NetManager.Core +**System capability**: SystemCapability.Communication.NetManager.Ethernet **Parameters** | Name | Type | Mandatory| Description | | -------- | ------------------------------------ | ---- | ------------------------------ | -| callback | AsyncCallback\> | Yes | Callback used to return all the active network interface names obtained.| +| callback | AsyncCallback\> | Yes | Callback used to return the result.| + +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------------------| +| 201 | Permission denied. | +| 2200002 | Operation failed. Cannot connect to service.| +| 2200003 | System internal error. | **Example** ```js ethernet.getAllActiveIfaces((error, value) => { - if (error) { - console.log("getAllActiveIfaces callback error = " + error); - } else { - console.log("getAllActiveIfaces callback value.length = " + value.length); - for (let i = 0; i < value.length; i++) { - console.log("getAllActiveIfaces callback = " + value[i]); + if (error) { + console.log("getAllActiveIfaces callback error = " + JSON.stringify(error)); + } else { + console.log("getAllActiveIfaces callback value.length = " + JSON.stringify(value.length)); + for (let i = 0; i < value.length; i++) { + console.log("getAllActiveIfaces callback = " + JSON.stringify(value[i])); + } } - } }); ``` @@ -246,30 +351,38 @@ ethernet.getAllActiveIfaces((error, value) => { getAllActiveIfaces(): Promise\> -Obtains all active network interfaces. This API uses a promise to return the result. +Obtains the list of all active network interfaces. This API uses a promise to return the result. -**Required permission**: ohos.permission.GET_NETWORK_INFO +**System API**: This is a system API. -**System capability**: SystemCapability.Communication.NetManager.Core +**Required permission**: ohos.permission.GET_NETWORK_INFO -**Parameters** +**System capability**: SystemCapability.Communication.NetManager.Ethernet **Return value** | Type | Description | | ------------------------------ | ----------------------------------------------- | -| Promise\> | Promise used to return all the active network interface names obtained.| +| Promise\> | Promise used to return the result. | + +**Error codes** + +| ID| Error Message | +| ------- | ----------------------------------------| +| 201 | Permission denied. | +| 2200002 | Operation failed. Cannot connect to service.| +| 2200003 | System internal error. | **Example** ```js ethernet.getAllActiveIfaces().then((data) => { - console.log("getAllActiveIfaces promiss data.length = " + data.length); - for (let i = 0; i < data.length; i++) { - console.log("getAllActiveIfaces promiss = " + data[i]); - } -}).catch((error) => { - console.log("getAllActiveIfaces promiss error = " + error); + console.log("getAllActiveIfaces promise data.length = " + JSON.stringify(data.length)); + for (let i = 0; i < data.length; i++) { + console.log("getAllActiveIfaces promise = " + JSON.stringify(data[i])); + } +}).catch(error => { + console.log("getAllActiveIfaces promise error = " + JSON.stringify(error)); }); ``` @@ -277,22 +390,26 @@ ethernet.getAllActiveIfaces().then((data) => { Defines the network configuration for the Ethernet connection. -**System capability**: SystemCapability.Communication.NetManager.Core +**System API**: This is a system API. -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| mode | [IPSetMode](#ipsetmode) | Yes | Configuration mode of the Ethernet connection.| -| ipAddr | string | Yes | Static IP address of the Ethernet connection. The value must be an IPv4 address, which is a 32-bit number displayed in dotted decimal notation and each 8-bit field ranges from 0 to 255. This parameter does not need to be configured in Dynamic Host Configuration Protocol (DHCP) mode.| -| route | string | Yes | Route of the Ethernet connection. The value must be an IPv4 address. This parameter does not need to be configured in DHCP mode.| -| gateway | string | Yes | Gateway of the Ethernet connection. The value must be an IPv4 address. This parameter does not need to be configured in DHCP mode.| -| netMask | string | Yes | Subnet mask of the Ethernet connection. The value must be an IPv4 address. This parameter does not need to be configured in DHCP mode.| -| dnsServers | string | Yes | DNS server addresses of the Ethernet connection. The value must be an IPv4 address. This parameter does not need to be configured in DHCP mode. Multiple addresses are separated by commas (,).| +**System capability**: SystemCapability.Communication.NetManager.Ethernet + +| Name | Type | Mandatory| Description | +| ------------ | ----------------------- | ---|------------------------------------------------------------ | +| mode | [IPSetMode](#ipsetmode) | Yes| Configuration mode of the Ethernet connection.| +| ipAddr | string | Yes| Static IP address of the Ethernet connection. The value must be an IPv4 address, which is a 32-bit number displayed in dotted decimal notation and each 8-bit field ranges from 0 to 255. This parameter does not need to be configured in Dynamic Host Configuration Protocol (DHCP) mode.| +| route | string | Yes| Route of the Ethernet connection. The value must be an IPv4 address, which is a 32-bit number displayed in dotted decimal notation and each 8-bit field ranges from 0 to 255. This parameter does not need to be configured in DHCP mode.| +| gateway | string | Yes| Gateway of the Ethernet connection. The value must be an IPv4 address, which is a 32-bit number displayed in dotted decimal notation and each 8-bit field ranges from 0 to 255. This parameter does not need to be configured in DHCP mode.| +| netMask | string | Yes| Subnet mask of the Ethernet connection. The value must be an IPv4 address, which is a 32-bit number displayed in dotted decimal notation and each 8-bit field ranges from 0 to 255. This parameter does not need to be configured in DHCP mode.| +| dnsServers | string | Yes| DNS server addresses of the Ethernet connection. The value must be an IPv4 address. This parameter does not need to be configured in DHCP mode. Multiple addresses are separated by commas (,).| ## IPSetMode Defines the configuration mode of the Ethernet connection. -**System capability**: SystemCapability.Communication.NetManager.Core +**System API**: This is a system API. + +**System capability**: SystemCapability.Communication.NetManager.Ethernet | Name | Value | Description | | ------------------------ | ---- | ---------------------- | diff --git a/en/application-dev/reference/apis/js-apis-net-mdns.md b/en/application-dev/reference/apis/js-apis-net-mdns.md new file mode 100644 index 0000000000000000000000000000000000000000..2f32a68fea2b56a3acd4458f09ebff0102bcbc16 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-net-mdns.md @@ -0,0 +1,551 @@ +# @ohos.net.mdns (mDNS Management) + +Multicast DNS (mDNS) provides functions such as adding, removing, discovering, and resolving local services on a LAN. + +> **NOTE** +> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version. + +## Modules to Import + +```js +import mdns from '@ohos.net.mdns' +``` +## mdns.addLocalService + +addLocalService(context: Context, serviceInfo: LocalServiceInfo, callback: AsyncCallback\): void + +Adds an mDNS service. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Communication.NetManager.MDNS + +**Parameters** + +| Name | Type | Mandatory| Description | +|-------------|----------------------------------|-----------|-------------------------------------------------| +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md).| +| serviceInfo | [LocalServiceInfo](#localserviceinfo) | Yes | mDNS service information. | +| callback | AsyncCallback\<[LocalServiceInfo](#localserviceinfo)> | Yes | Callback used to return the result. If the operation is successful, **error** is **undefined** and **data** is the mDNS service information. | + +**Error codes** + +| ID | Error Message| +|---------|---| +| 401 | Parameter error. | +| 2100002 | Operation failed. Cannot connect to service. | +| 2100003 | System internal error. | +| 2204003 | Callback duplicated. | +| 2204008 | Service instance duplicated. | +| 2204010 | Send packet failed. | + +>**NOTE** +> For details about the error codes, see [mDNS Error Codes](../errorcodes/errorcode-net-mdns.md). + +**Example** + +```js +let localServiceInfo = { + serviceType: "_print._tcp", + serviceName: "servicename", + port: 5555, + host: { + address: "10.14.**.***", + }, + serviceAttribute: [{ + key: "111", + value: [1] + }] +} + +mdns.addLocalService(context, localServiceInfo, function (error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}); +``` + +## mdns.addLocalService + +addLocalService(context: Context, serviceInfo: LocalServiceInfo): Promise\ + +Adds an mDNS service. This API uses a promise to return the result. + +**System capability**: SystemCapability.Communication.NetManager.MDNS + +**Parameters** + +| Name | Type | Mandatory| Description | +|-------------|----------------------------------|-----------|-------------------------------------------------| +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md).| +| serviceInfo | [LocalServiceInfo](#localserviceinfo) | Yes | mDNS service information. | + +**Return value** + +| Type | Description | +| --------------------------------- | ------------------------------------- | +| Promise\<[LocalServiceInfo](#localserviceinfo)> | Promise used to return the result.| + +**Error codes** + +| ID | Error Message| +|---------|---| +| 401 | Parameter error. | +| 2100002 | Operation failed. Cannot connect to service. | +| 2100003 | System internal error. | +| 2204003 | Callback duplicated. | +| 2204008 | Service instance duplicated. | +| 2204010 | Send packet failed. | + +>**NOTE** +> For details about the error codes, see [mDNS Error Codes](../errorcodes/errorcode-net-mdns.md). + +**Example** + +```js +let localServiceInfo = { + serviceType: "_print._tcp", + serviceName: "servicename", + port: 5555, + host: { + address: "10.14.**.***", + }, + serviceAttribute: [{ + key: "111", + value: [1] + }] +} + +mdns.addLocalService(context, localServiceInfo).then(function (data) { + console.log(JSON.stringify(data)) +}); +``` + +## mdns.removeLocalService + +removeLocalService(context: Context, serviceInfo: LocalServiceInfo, callback: AsyncCallback\): void + +Removes an mDNS service. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Communication.NetManager.MDNS + +**Parameters** + +| Name | Type | Mandatory| Description | +|-------------|----------------------------------|-----------|-------------------------------------------------| +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md).| +| serviceInfo | [LocalServiceInfo](#localserviceinfo) | Yes | mDNS service information. | +| callback | AsyncCallback\<[LocalServiceInfo](#localserviceinfo)> | Yes | Callback used to return the result. If the operation is successful, **error** is **undefined** and **data** is the mDNS service information. | + +**Error codes** + +| ID | Error Message| +|---------|---| +| 401 | Parameter error. | +| 2100002 | Operation failed. Cannot connect to service. | +| 2100003 | System internal error. | +| 2204002 | Callback not found. | +| 2204008 | Service instance duplicated. | +| 2204010 | Send packet failed. | + +>**NOTE** +> For details about the error codes, see [mDNS Error Codes](../errorcodes/errorcode-net-mdns.md). + +**Example** + +```js +let localServiceInfo = { + serviceType: "_print._tcp", + serviceName: "servicename", + port: 5555, + host: { + address: "10.14.**.***", + }, + serviceAttribute: [{ + key: "111", + value: [1] + }] +} + +mdns.removeLocalService(context, localServiceInfo, function (error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}); +``` + +## mdns.removeLocalService + +removeLocalService(context: Context, serviceInfo: LocalServiceInfo): Promise\ + +Removes an mDNS service. This API uses a promise to return the result. + +**System capability**: SystemCapability.Communication.NetManager.MDNS + +**Parameters** + +| Name | Type | Mandatory| Description | +|-------------|----------------------------------|-----------|-------------------------------------------------| +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md).| +| serviceInfo | [LocalServiceInfo](#localserviceinfo) | Yes | mDNS service information. | + +**Return value** + +| Type | Description | +| --------------------------------- | ------------------------------------- | +| Promise\<[LocalServiceInfo](#localserviceinfo)> | Promise used to return the result.| + +**Error codes** + +| ID | Error Message| +|---------|---| +| 401 | Parameter error. | +| 2100002 | Operation failed. Cannot connect to service. | +| 2100003 | System internal error. | +| 2204002 | Callback not found. | +| 2204008 | Service instance duplicated. | +| 2204010 | Send packet failed. | + +>**NOTE** +> For details about the error codes, see [mDNS Error Codes](../errorcodes/errorcode-net-mdns.md). + +**Example** + +```js +let localServiceInfo = { + serviceType: "_print._tcp", + serviceName: "servicename", + port: 5555, + host: { + address: "10.14.**.***", + }, + serviceAttribute: [{ + key: "111", + value: [1] + }] +} + +mdns.removeLocalService(context, localServiceInfo).then(function (data) { + console.log(JSON.stringify(data)) +}); +``` + +## mdns.createDiscoveryService + +createDiscoveryService(context: Context, serviceType: string): DiscoveryService + +Creates a **DiscoveryService** object, which is used to discover mDNS services of the specified type. + +**System capability**: SystemCapability.Communication.NetManager.MDNS + +**Parameters** + +| Name | Type | Mandatory| Description | +|-------------|---------|-----------| ------------------------------------------------------------ | +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md).| +| serviceType | string | Yes | Type of the mDNS services to be discovered.| + +**Return value** + +| Type | Description | +| ----------------------------- |---------------------------------| +| DiscoveryService | **DiscoveryService** object used to discover mDNS services of the specified type.| + +**Example** + +```js +let serviceType = "_print._tcp"; + +let discoveryService = mdns.createDiscoveryService(context, serviceType); +``` + +## mdns.resolveLocalService + +resolveLocalService(context: Context, serviceInfo: LocalServiceInfo, callback: AsyncCallback\): void + +Resolves an mDNS service. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Communication.NetManager.MDNS + +**Parameters** + +| Name | Type | Mandatory| Description | +|-------------|----------------------------------|-----------|-------------------------------------------------------------| +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md).| +| serviceInfo | [LocalServiceInfo](#localserviceinfo) | Yes | mDNS service information. | +| callback | AsyncCallback\<[LocalServiceInfo](#localserviceinfo)> | Yes | Callback used to return the result. If the operation is successful, **error** is **undefined** and **data** is the mDNS service information. | + +**Error codes** + +| ID | Error Message| +|---------|----------------------------------------------| +| 401 | Parameter error. | +| 2100002 | Operation failed. Cannot connect to service. | +| 2100003 | System internal error. | +| 2204003 | Callback duplicated. | +| 2204006 | Request timeout. | +| 2204010 | Send packet failed. | + +>**NOTE** +> For details about the error codes, see [mDNS Error Codes](../errorcodes/errorcode-net-mdns.md). + +**Example** + +```js +let localServiceInfo = { + serviceType: "_print._tcp", + serviceName: "servicename", + port: 5555, + host: { + address: "10.14.**.***", + }, + serviceAttribute: [{ + key: "111", + value: [1] + }] +} + +mdns.resolveLocalService(context, localServiceInfo, function (error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}); +``` + +## mdns.resolveLocalService + +resolveLocalService(context: Context, serviceInfo: LocalServiceInfo): Promise\ + +Resolves an mDNS service. This API uses a promise to return the result. + +**System capability**: SystemCapability.Communication.NetManager.MDNS + +**Parameters** + +| Name | Type | Mandatory| Description | +|-------------|--------------|-----------|-----------------------------------------------------| +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md).| +| serviceInfo | [LocalServiceInfo](#localserviceinfo) | Yes | mDNS service information. | + +**Return value** + +| Type | Description | +|----------------------------| ------------------------------------- | +| Promise\<[LocalServiceInfo](#localserviceinfo)> | Promise used to return the result.| + +**Error codes** + +| ID | Error Message| +|---------|----------------------------------------------| +| 401 | Parameter error. | +| 2100002 | Operation failed. Cannot connect to service. | +| 2100003 | System internal error. | +| 2204003 | Callback duplicated. | +| 2204006 | Request timeout. | +| 2204010 | Send packet failed. | + +>**NOTE** +> For details about the error codes, see [mDNS Error Codes](../errorcodes/errorcode-net-mdns.md). + +**Example** + +```js +let localServiceInfo = { + serviceType: "_print._tcp", + serviceName: "servicename", + port: 5555, + host: { + address: "10.14.**.***", + }, + serviceAttribute: [{ + key: "111", + value: [1] + }] +} + +mdns.resolveLocalService(context, localServiceInfo).then(function (data){ + console.log(JSON.stringify(data)); +}) +``` + +## DiscoveryService + +Defines a **DiscoveryService** object for discovering mDNS services of the specified type. + +### startSearchingMDNS + +startSearchingMDNS(): void + +Searches for mDNS services on the LAN. + +**System capability**: SystemCapability.Communication.NetManager.MDNS + +**Example** + +```js +let discoveryService = mdns.createDiscoveryService(context, serviceType); +discoveryService.startSearchingMDNS(); +``` + +### stopSearchingMDNS + +stopSearchingMDNS(): void + +Stops searching for mDNS services on the LAN. + +**System capability**: SystemCapability.Communication.NetManager.MDNS + +**Example** + +```js +let discoveryService = mdns.createDiscoveryService(context, serviceType); +discoveryService.stopSearchingMDNS(); +``` + +### on('discoveryStart') + +on(type: 'discoveryStart', callback: Callback<{serviceInfo: LocalServiceInfo, errorCode?: MdnsError}>): void + +Enables listening for **discoveryStart** events. + +**System capability**: SystemCapability.Communication.NetManager.MDNS + +**Parameters** + +| Name | Type | Mandatory| Description | +|-------------|--------------|-----------|-----------------------------------------------------| +| type | string | Yes |Event type. This field has a fixed value of **discoveryStart**.
**discoveryStart**: event of starting discovery of mDNS services on the LAN.| +| callback | Callback<{serviceInfo: [LocalServiceInfo](#localserviceinfo), errorCode?: [MdnsError](#mdnserror)}> | Yes | Callback used to return the mDNS service and error information. | + +**Example** + +```js +// See mdns.createDiscoveryService. +let discoveryService = mdns.createDiscoveryService(context, serviceType); +discoveryService.startSearchingMDNS(); + +discoveryService.on('discoveryStart', (data) => { + console.log(JSON.stringify(data)); +}); + +discoveryService.stopSearchingMDNS(); +``` + +### on('discoveryStop') + +on(type: 'discoveryStop', callback: Callback<{serviceInfo: LocalServiceInfo, errorCode?: MdnsError}>): void + +Enables listening for **discoveryStop** events. + +**System capability**: SystemCapability.Communication.NetManager.MDNS + +**Parameters** + +| Name | Type | Mandatory| Description | +|-------------|--------------|-----------|-----------------------------------------------------| +| type | string | Yes |Event type. This field has a fixed value of **discoveryStop**.
**discoveryStop**: event of stopping discovery of mDNS services on the LAN.| +| callback | Callback<{serviceInfo: [LocalServiceInfo](#localserviceinfo), errorCode?: [MdnsError](#mdnserror)}> | Yes | Callback used to return the mDNS service and error information. | + +**Example** + +```js +// See mdns.createDiscoveryService. +let discoveryService = mdns.createDiscoveryService(context, serviceType); +discoveryService.startSearchingMDNS(); + +discoveryService.on('discoveryStop', (data) => { + console.log(JSON.stringify(data)); +}); + +discoveryService.stopSearchingMDNS(); +``` + +### on('serviceFound') + +on(type: 'serviceFound', callback: Callback<[LocalServiceInfo](#localserviceinfo)>): void + +Enables listening for **serviceFound** events. + +**System capability**: SystemCapability.Communication.NetManager.MDNS + +**Parameters** + +| Name | Type | Mandatory| Description | +|-------------|--------------|-----------|-----------------------------------------------------| +| type | string | Yes |Event type. This field has a fixed value of **serviceFound**.
**serviceFound**: event indicating an mDNS service is found.| +| callback | Callback<[LocalServiceInfo](#localserviceinfo)> | Yes | mDNS service information. | + +**Example** + +```js +// See mdns.createDiscoveryService. +let discoveryService = mdns.createDiscoveryService(context, serviceType); +discoveryService.startSearchingMDNS(); + +discoveryService.on('serviceFound', (data) => { + console.log(JSON.stringify(data)); +}); + +discoveryService.stopSearchingMDNS(); +``` + +### on('serviceLost') + +on(type: 'serviceLost', callback: Callback<[LocalServiceInfo](#localserviceinfo)>): void + +Enables listening for **serviceLost** events. + +**System capability**: SystemCapability.Communication.NetManager.MDNS + +**Parameters** + +| Name | Type | Mandatory| Description | +|-------------|--------------|-----------|-----------------------------------------------------| +| type | string | Yes |Event type. This field has a fixed value of **serviceLost**.
serviceLost: event indicating that an mDNS service is removed.| +| callback | Callback<[LocalServiceInfo](#localserviceinfo)> | Yes | mDNS service information. | + +**Example** + +```js +// See mdns.createDiscoveryService. +let discoveryService = mdns.createDiscoveryService(context, serviceType); +discoveryService.startSearchingMDNS(); + +discoveryService.on('serviceLost', (data) => { + console.log(JSON.stringify(data)); +}); + +discoveryService.stopSearchingMDNS(); +``` + +## LocalServiceInfo + +Defines the mDNS service information. + +**System capability**: SystemCapability.Communication.NetManager.MDNS + +| Name | Type | Mandatory| Description | +| --------------------- | ---------------------------------- | --- | ------------------------ | +| serviceType | string | Yes| Type of the mDNS service. The value is in the format of **\_\.\**, where **name** contains a maximum of 63 characters excluding periods (.). | +| serviceName | string | Yes| Name of the mDNS service. | +| port | number | No| Port number of the mDNS server. | +| host | [NetAddress](js-apis-net-connection.md#netaddress) | No| IP address of the device that provides the mDNS service. The IP address is not effective when an mDNS service is added or removed. | +| serviceAttribute | serviceAttribute\<[ServiceAttribute](#serviceattribute)> | No| mDNS service attribute information. | + +## ServiceAttribute + +Defines the mDNS service attribute information. + +**System capability**: SystemCapability.Communication.NetManager.MDNS + +| Name | Type | Mandatory| Description | +| --------------------- | ---------------------------------- | --- | ------------------------ | +| key | string | Yes| mDNS service attribute key. The value contains a maximum of 9 characters. | +| value | Array\ | Yes| mDNS service attribute value. | + +## MdnsError + +Defines the mDNS error information. + +**System capability**: SystemCapability.Communication.NetManager.MDNS + +| Name | Value | Description | +| --------------- | ---- | ----------- | +| INTERNAL_ERROR | 0 | Operation failed because of an internal error. | +| ALREADY_ACTIVE | 1 | Operation failed because the service already exists.| +| MAX_LIMIT | 2 | Operation failed because the number of requests exceeds the maximum value. (not supported currently)| diff --git a/en/application-dev/reference/apis/js-apis-net-policy.md b/en/application-dev/reference/apis/js-apis-net-policy.md new file mode 100644 index 0000000000000000000000000000000000000000..375ee31e24b9a24d14aae0217f12b8cd78eb57b1 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-net-policy.md @@ -0,0 +1,1558 @@ +# @ohos.net.policy (Network Policy Management) + +The **policy** module provides APIs for managing network policies, through which you can control and manage the data volume used. + +> **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 + +```js +import policy from '@ohos.net.policy' +``` + +## policy.setBackgroundPolicy + +setBackgroundPolicy(isAllowed: boolean, callback: AsyncCallback\): void + +Sets a background network policy. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------- | +| isAllowed | boolean | Yes | Whether applications running in the background are allowed to use mobile data.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, the operation result is returned. If the operation fails, an error message is returned.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +policy.setBackgroundPolicy(Boolean(Number.parseInt(this.isBoolean))), (error, data) => { + this.callBack(error, data); + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}); +``` + +## policy.setBackgroundPolicy + +setBackgroundPolicy(isAllowed: boolean): Promise\ + +Sets a background network policy. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------- | +| isAllowed | boolean | Yes | Whether applications running in the background are allowed to use mobile data.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Return value** + +| Type | Description | +| --------------------------------- | ------------------------------------- | +| Promise\ | Promise used to return the result. If the operation is successful, the operation result is returned. If the operation fails, an error message is returned.| + +**Example** + +```js +policy.setBackgroundPolicy(Boolean(Number.parseInt(this.isBoolean))).then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) +``` + +## policy.isBackgroundAllowed + +isBackgroundAllowed(callback: AsyncCallback\): void + +Obtains the background network policy. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------- | +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, **true** is returned, which means that applications running in the background are allowed to use mobile data. If the operation fails, an error message is returned.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +policy.isBackgroundAllowed((error, data) => { + this.callBack(error, data); + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}); +``` + +## policy.isBackgroundAllowed + +isBackgroundAllowed(): Promise\; + +Obtains the background network policy. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Return value** + +| Type | Description | +| --------------------------------- | ------------------------------------- | +| Promise\ | Promise used to return the result. If the operation is successful, **true** is returned, which means that applications running in the background are allowed to use mobile data. If the operation fails, an error message is returned.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +policy.isBackgroundAllowed().then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) + +``` + +## policy.setPolicyByUid + +setPolicyByUid(uid: number, policy: NetUidPolicy, callback: AsyncCallback\): void + +Sets an application-specific network policy. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------- | +| uid | number | Yes | Unique ID of the application.| +| policy | [NetUidPolicy](#netuidpolicy) | Yes| Application-specific network policy to set.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, the operation result is returned. If the operation fails, an error message is returned.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +let param = { + uid: Number.parseInt(this.firstParam), policy: Number.parseInt(this.currentNetUidPolicy) +} +policy.setPolicyByUid(Number.parseInt(this.firstParam), Number.parseInt(this.currentNetUidPolicy), (error, data) => { + this.callBack(error, data); +}); +``` + +## policy.setPolicyByUid + +setPolicyByUid(uid: number, policy: NetUidPolicy): Promise\; + +Sets an application-specific network policy. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------- | +| uid | number | Yes | Unique ID of the application.| +| policy | [NetUidPolicy](#netuidpolicy) | Yes| Application-specific network policy to set.| + +**Return value** + +| Type | Description | +| --------------------------------- | ------------------------------------- | +| Promise\ | Promise used to return the result. If the operation is successful, the operation result is returned. If the operation fails, an error message is returned.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +let param = { + uid: Number.parseInt(this.firstParam), policy: Number.parseInt(this.currentNetUidPolicy) +} +policy.setPolicyByUid(Number.parseInt(this.firstParam), Number.parseInt(this.currentNetUidPolicy)).then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) + +``` + +## policy.getPolicyByUid + +getPolicyByUid(uid: number, callback: AsyncCallback\): void + +Obtains an application-specific network policy by **uid**. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------- | +| uid | number | Yes| Unique ID of the application.| +| callback | AsyncCallback\<[NetUidPolicy](#netuidpolicy)> | Yes | Callback used to return the result. If the operation is successful, the operation result is returned. If the operation fails, an error message is returned.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +policy.getPolicyByUid(Number.parseInt(this.firstParam), (error, data) => { + this.callBack(error, data); +}); +``` + +## policy.getPolicyByUid + +getPolicyByUid(uid: number): Promise\; + +Obtains an application-specific network policy by **uid**. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------- | +| uid | number | Yes| Unique ID of the application.| + +**Return value** + +| Type | Description | +| --------------------------------- | ------------------------------------- | +| Promise\<[NetUidPolicy](#netuidpolicy)> | Promise used to return the result. If the operation is successful, the operation result is returned. If the operation fails, an error message is returned.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +policy.getPolicyByUid(Number.parseInt(this.firstParam)).then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) + +``` + +## policy.getUidsByPolicy + +getUidsByPolicy(policy: NetUidPolicy, callback: AsyncCallback\>): void + +Obtains the UID array of applications configured with a certain application-specific network policy. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------- | +| policy | [NetUidPolicy](#netuidpolicy) | Yes| Target application-specific network policy.| +| callback | AsyncCallback\> | Yes | Callback used to return the result. If the operation is successful, the operation result is returned. If the operation fails, an error message is returned.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +policy.getUidsByPolicy(Number.parseInt(this.currentNetUidPolicy), (error, data) => { + this.callBack(error, data); +}); +``` + +## policy.getUidsByPolicy + +function getUidsByPolicy(policy: NetUidPolicy): Promise\>; + +Obtains the UID array of applications configured with a certain application-specific network policy. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------- | +| policy | [NetUidPolicy](#netuidpolicy) | Yes| Target application-specific network policy.| + +**Return value** + +| Type | Description | +| --------------------------------- | ------------------------------------- | +| Promise\> | Promise used to return the result. If the operation is successful, the operation result is returned. If the operation fails, an error message is returned.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +policy.getUidsByPolicy(Number.parseInt(this.firstParam)).then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) + +``` + +## policy.getNetQuotaPolicies + +getNetQuotaPolicies(callback: AsyncCallback\>): void + +Obtains the network quota policies. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------- | +| callback | AsyncCallback\> | Yes | Callback used to return the result.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +policy.getNetQuotaPolicies((error, data) => { + this.callBack(error, data); +}); +``` + +## policy.getNetQuotaPolicies + +getNetQuotaPolicies(): Promise\>; + +Obtains the network quota policies. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Return value** + +| Type | Description | +| --------------------------------- | ------------------------------------- | +| Promise\> | Promise used to return the result.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +policy.getNetQuotaPolicies().then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) + +``` + +## policy.setNetQuotaPolicies + +setNetQuotaPolicies(quotaPolicies: Array\, callback: AsyncCallback\): void + +Sets an array of network quota policies. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------- | +| quotaPolicies | Array\<[NetQuotaPolicy](#netquotapolicy)> | Yes| An array of network quota policies to set.| +| callback | AsyncCallback\ | Yes | Callback used to return the result.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +let param = {netType:Number.parseInt(this.netType), iccid:this.iccid, ident:this.ident, periodDuration:this.periodDuration, warningBytes:Number.parseInt(this.warningBytes), + limitBytes:Number.parseInt(this.limitBytes), lastWarningRemind:this.lastWarningRemind, lastLimitRemind:this.lastLimitRemind, metered:Boolean(Number.parseInt(this.metered)), limitAction:this.limitAction}; +this.netQuotaPolicyList.push(param); + +policy.setNetQuotaPolicies(this.netQuotaPolicyList, (error, data) => { + this.callBack(error, data); +}); +``` + +## policy.setNetQuotaPolicies + +setNetQuotaPolicies(quotaPolicies: Array\): Promise\; + +Sets an array of network quota policies. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------- | +| quotaPolicies | Array\<[NetQuotaPolicy](#netquotapolicy)> | Yes| An array of network quota policies to set.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Return value** + +| Type | Description | +| --------------------------------- | ------------------------------------- | +| Promise\ | Promise used to return the result.| + +**Example** + +```js +let param = {netType:Number.parseInt(this.netType), iccid:this.iccid, ident:this.ident, periodDuration:this.periodDuration, warningBytes:Number.parseInt(this.warningBytes), + limitBytes:Number.parseInt(this.limitBytes), lastWarningRemind:this.lastWarningRemind, lastLimitRemind:this.lastLimitRemind, metered:Boolean(Number.parseInt(this.metered)), limitAction:this.limitAction}; +this.netQuotaPolicyList.push(param); + +policy.setNetQuotaPolicies(this.netQuotaPolicyList).then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) +``` + +## policy.restoreAllPolicies + +restoreAllPolicies(iccid: string, callback: AsyncCallback\): void + +Restores all the policies (cellular network, background network, firewall, and application-specific network policies) for the given SIM card. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------- | +| iccid | string | Yes| SIM card ID.| +| callback | AsyncCallback\ | Yes | Callback used to return the result.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +this.firstParam = iccid; +policy.restoreAllPolicies(this.firstParam, (error, data) => { + this.callBack(error, data); +}); +``` + +## policy.restoreAllPolicies + +restoreAllPolicies(iccid: string): Promise\; + +Restores all the policies (cellular network, background network, firewall, and application-specific network policies) for the given SIM card. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------- | +| iccid | string | Yes| SIM card ID.| + +**Return value** + +| Type | Description | +| --------------------------------- | ------------------------------------- | +| Promise\ | Promise used to return the result.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +this.firstParam = iccid; +policy.restoreAllPolicies(this.firstParam).then(function(error, data){ + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) + +``` + +## policy.isUidNetAllowed + +isUidNetAllowed(uid: number, isMetered: boolean, callback: AsyncCallback\): void + +Checks whether an application is allowed to access metered networks. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------- | +| uid | number | Yes| Unique ID of the application.| +| isMetered | boolean | Yes| Whether the network is a metered network.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. The value **true** means that the application is allowed to access metered networks, and **false** means the opposite.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js + +let param = { + uid: Number.parseInt(this.firstParam), isMetered: Boolean(Number.parseInt(this.isBoolean)) +} +policy.isUidNetAllowed(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean)), (error, data) => { + this.callBack(error, data); +}); +``` + +## policy.isUidNetAllowed + +isUidNetAllowed(uid: number, isMetered: boolean): Promise\; + +Checks whether an application is allowed to access metered networks. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------- | +| uid | number | Yes| Unique ID of the application.| +| isMetered | boolean | Yes| Whether the network is a metered network.| + +**Return value** + +| Type | Description | +| --------------------------------- | ------------------------------------- | +| Promise\ | Promise used to return the result.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js + +let param = { + uid: Number.parseInt(this.firstParam), isMetered: Boolean(Number.parseInt(this.isBoolean)) +} +policy.isUidNetAllowed(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean))).then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) + +``` + +## policy.isUidNetAllowed + +isUidNetAllowed(uid: number, iface: string, callback: AsyncCallback\): void + +Checks whether an application is allowed to access the given network. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------- | +| uid | number | Yes| Unique ID of the application.| +| iface | string | Yes| Name of the target network.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. The value **true** means that the application is allowed to access the given network, and **false** means the opposite.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js + +let param = { + uid: Number.parseInt(this.firstParam), iface: this.secondParam +} +policy.isUidNetAllowed(Number.parseInt(this.firstParam), this.secondParam, (error, data) => { + this.callBack(error, data); +}); +``` + +## policy.isUidNetAllowed + +isUidNetAllowed(uid: number, iface: string): Promise\; + +Checks whether an application is allowed to access the given network. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------- | +| uid | number | Yes| Unique ID of the application.| +| iface | string | Yes| Name of the target network.| + +**Return value** + +| Type | Description | +| --------------------------------- | ------------------------------------- | +| Promise\ | Promise used to return the result.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +let param = { + uid: Number.parseInt(this.firstParam), iface: this.secondParam +} +policy.isUidNetAllowed(Number.parseInt(this.firstParam), this.secondParam).then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) + +``` + +## policy.setDeviceIdleAllowList + +setDeviceIdleAllowList(uid: number, isAllowed: boolean, callback: AsyncCallback\): void + +Sets whether to add an application to the device idle allowlist. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------- | +| uid | number | Yes| Unique ID of the application.| +| isAllowed | boolean | Yes| Whether to add the application to the allowlist.| +| callback | callback: AsyncCallback\ | Yes | Callback used to return the result.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +let param = { + uid: Number.parseInt(this.firstParam), isAllowed: Boolean(Number.parseInt(this.isBoolean)) +} +policy.setDeviceIdleAllowList(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean)), (error, data) => { + this.callBack(error, data); +}); +``` + +## policy.setDeviceIdleAllowList + +setDeviceIdleAllowList(uid: number, isAllowed: boolean): Promise\; + +Sets whether to add an application to the device idle allowlist. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------- | +| uid | number | Yes| Unique ID of the application.| +| isAllowed | boolean | Yes| Whether to add the application to the allowlist.| + +**Return value** + +| Type | Description | +| --------------------------------- | ------------------------------------- | +| Promise\ | Promise used to return the result.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +let param = { + uid: Number.parseInt(this.firstParam), isAllowed: Boolean(Number.parseInt(this.isBoolean)) +} +policy.setDeviceIdleAllowList(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean))).then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) + +``` + +## policy.getDeviceIdleAllowList + +getDeviceIdleAllowList(callback: AsyncCallback\>): void + +Obtains the UID array of applications that are on the device idle allowlist. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------- | +| callback | AsyncCallback\> | Yes | Callback used to return the result.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +policy.getDeviceIdleAllowList((error, data) => { + this.callBack(error, data); +}); +``` + +## policy.getDeviceIdleAllowList + +getDeviceIdleAllowList(): Promise\>; + +Obtains the UID array of applications that are on the device idle allowlist. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Return value** + +| Type | Description | +| --------------------------------- | ------------------------------------- | +| Promise\> | Promise used to return the result.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +policy.getDeviceIdleAllowList().then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) +``` + +## policy.getBackgroundPolicyByUid + +getBackgroundPolicyByUid(uid: number, callback: AsyncCallback\): void + +Obtains the background network policies configured for the given application. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------- | +| uid | number | Yes| Unique ID of the application.| +| callback | AsyncCallback\<[NetBackgroundPolicy](#netbackgroundpolicy)> | Yes | Callback used to return the result.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +this.firstParam = uid +policy.getBackgroundPolicyByUid(Number.parseInt(this.firstParam), (error, data) => { + this.callBack(error, data); +}); +``` + +## policy.getBackgroundPolicyByUid + +getBackgroundPolicyByUid(uid: number): Promise\; + +Obtains the background network policies configured for the given application. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------- | +| uid | number | Yes| Unique ID of the application.| + +**Return value** + +| Type | Description | +| --------------------------------- | ------------------------------------- | +| Promise\<[NetBackgroundPolicy](#netbackgroundpolicy)> | Promise used to return the result.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +this.firstParam = uid +policy.getBackgroundPolicyByUid(Number.parseInt(this.firstParam)).then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) +``` + +## policy.resetPolicies + +resetPolicies(iccid: string, callback: AsyncCallback\): void + +Restores all the policies (cellular network, background network, firewall, and application-specific network policies) for the given SIM card. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------- | +| iccid | string | Yes| SIM card ID.| +| callback | AsyncCallback\ | Yes | Callback used to return the result.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +this.firstParam = iccid +policy.resetPolicies(this.firstParam, (error, data) => { + this.callBack(error, data); +}); +``` + +## policy.resetPolicies + +resetPolicies(iccid: string): Promise\; + +Restores all the policies (cellular network, background network, firewall, and application-specific network policies) for the given SIM card. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------- | +| iccid | string | Yes| SIM card ID.| + +**Return value** + +| Type | Description | +| --------------------------------- | ------------------------------------- | +| Promise\ | Promise used to return the result.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +policy.getUidsByPolicy(Number.parseInt(this.firstParam)).then(function(error, data) { + +}) +this.firstParam = iccid +policy.resetPolicies(this.firstParam).then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) + +``` + +## policy.updateRemindPolicy + +updateRemindPolicy(netType: NetBearType, iccid: string, remindType: RemindType, callback: AsyncCallback\): void + +Updates a reminder policy. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------- | +| netType | [NetBearType](js-apis-net-connection.md#netbeartype) | Yes| Network type.| +| iccid | string | Yes| SIM card ID.| +| remindType | [RemindType](#remindtype) | Yes| Reminder type.| +| callback | AsyncCallback\ | Yes | Callback used to return the result.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +let param = { + netType: Number.parseInt(this.netType), iccid: this.firstParam, remindType: this.currentRemindType +} +policy.updateRemindPolicy(Number.parseInt(this.netType), this.firstParam, Number.parseInt(this.currentRemindType), (error, data) => { + this.callBack(error, data); +}); +``` + +## policy.updateRemindPolicy + +updateRemindPolicy(netType: NetBearType, iccid: string, remindType: RemindType): Promise\; + +Updates a reminder policy. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------- | +| netType | [NetBearType](js-apis-net-connection.md#netbeartype) | Yes| Network type.| +| iccid | string | Yes| SIM card ID.| +| remindType | [RemindType](#remindtype) | Yes| Reminder type.| + +**Return value** + +| Type | Description | +| --------------------------------- | ------------------------------------- | +| Promise\ | Promise used to return the result.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +let param = { + netType: Number.parseInt(this.netType), iccid: this.firstParam, remindType: this.currentRemindType +} +policy.updateRemindPolicy(Number.parseInt(this.netType), this.firstParam, Number.parseInt(this.currentRemindType)).then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) + +``` + +## policy.setPowerSaveAllowList + +setPowerSaveAllowList(uid: number, isAllowed: boolean, callback: AsyncCallback\): void + +Sets whether to add an application to the power-saving allowlist. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------- | +| uid | number | Yes| Unique ID of the application.| +| isAllowed | boolean | Yes| Whether to add the application to the allowlist.| +| callback | callback: AsyncCallback\ | Yes | Callback used to return the result.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +let param = { + uid: Number.parseInt(this.firstParam), isAllowed: Boolean(Number.parseInt(this.isBoolean)) +} +policy.setPowerSaveAllowList(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean)), (error, data) => { + this.callBack(error, data); +}); +``` + +## policy.setPowerSaveAllowList + +setPowerSaveAllowList(uid: number, isAllowed: boolean): Promise\; + +Sets whether to add an application to the power-saving allowlist. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------- | +| uid | number | Yes| Unique ID of the application.| +| isAllowed | boolean | Yes| Whether to add the application to the allowlist.| + +**Return value** + +| Type | Description | +| --------------------------------- | ------------------------------------- | +| Promise\ | Promise used to return the result.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2100001 | Invalid parameter value. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +let param = { + uid: Number.parseInt(this.firstParam), isAllowed: Boolean(Number.parseInt(this.isBoolean)) +} +policy.setPowerSaveAllowList(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean))).then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) + +``` + +## policy.getPowerSaveAllowList + +getPowerSaveAllowList(callback: AsyncCallback\>): void + +Obtains the UID array of applications that are on the power-saving allowlist. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ---------- | +| callback | AsyncCallback\> | Yes | Callback used to return the result.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +policy.getPowerSaveAllowList((error, data) => { + this.callBack(error, data); +}); +``` + +## policy.getPowerSaveAllowList + +getPowerSaveAllowList(): Promise\>; + +Obtains the UID array of applications that are on the device idle allowlist. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Return value** + +| Type | Description | +| --------------------------------- | ------------------------------------- | +| Promise\> | Promise used to return the result.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2100002 | Operation failed. Cannot connect to service.| +| 2100003 | System internal error. | + +**Example** + +```js +policy.getPowerSaveAllowList().then(function(error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +}) +``` + +## policy.on + +Functions as the handle to a network policy. + +### on('netUidPolicyChange') + +on(type: "netUidPolicyChange", callback: Callback\<{ uid: number, policy: NetUidPolicy }>): void + +Subscribes to policy changes. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------------------- | ---- | ------------------------------------------------------------ | +| type | netUidPolicyChange | Yes| Event type. The value **netUidPolicyChange** indicates a policy change event.| +| callback | Callback\<{ uid: number, policy: [NetUidPolicy](#netuidpolicy) }> | Yes | Callback used to return the result. It is called when the registered network policy changes.| + +**Example** + +```js +policy.on('netUidPolicyChange', (data) => { + this.log('on netUidPolicyChange: ' + JSON.stringify(data)); +}) +``` + +### on('netUidRuleChange') + +on(type: "netUidRuleChange", callback: Callback\<{ uid: number, rule: NetUidRule }>): void + +Subscribes to rule changes. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------------------- | ---- | ------------------------------------------------------------ | +| type | netUidRuleChange | Yes| Event type. The value **netUidRuleChange** indicates a rule change event.| +| callback | Callback\<{ uid: number, rule: [NetUidRule](#netuidrule) }> | Yes | Callback used to return the result. It is called when the registered rule changes.| + +**Example** + +```js +policy.on('netUidRuleChange', (data) => { + this.log('on netUidRuleChange: ' + JSON.stringify(data)); +}) +``` + +### on('netMeteredIfacesChange') + +on(type: "netMeteredIfacesChange", callback: Callback\>): void + +Subscribes to metered **iface** changes. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------------------- | ---- | ------------------------------------------------------------ | +| type | netMeteredIfacesChange | Yes| Event type. The value **netMeteredIfacesChange** indicates a metered **iface** change event.| +| callback | Callback\> | Yes | Callback used to return the result. It is called when the registered metered **iface** changes.| + +**Example** + +```js +policy.on('netMeteredIfacesChange', (data) => { + this.log('on netMeteredIfacesChange: ' + JSON.stringify(data)); +}) +``` + +### on('netQuotaPolicyChange') + +on(type: "netQuotaPolicyChange", callback: Callback\>): void + +Subscribes to network quota policy changes. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------------------- | ---- | ------------------------------------------------------------ | +| type | netQuotaPolicyChange | Yes| Event type. The value **netQuotaPolicyChange** indicates a network quota policy change event.| +| callback | Callback\> | Yes | Callback used to return the result. It is called when the registered network quota policy changes.| + +**Example** + +```js +policy.on('netQuotaPolicyChange', (data) => { + this.log('on netQuotaPolicyChange: ' + JSON.stringify(data)); +}) +``` + +### on('netBackgroundPolicyChange') + +on(type: "netBackgroundPolicyChange", callback: Callback\): void + +Subscribes to background network policy changes. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + +**System capability**: SystemCapability.Communication.NetManager.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------------------- | ---- | ------------------------------------------------------------ | +| type | netBackgroundPolicyChange | Yes| Event type. The value **netBackgroundPolicyChange** indicates a background network policy change event.| +| callback | Callback\ | Yes | Callback used to return the result. It is called when the registered background network policy changes.| + +**Example** + +```js +policy.on('netBackgroundPolicyChange', (data) => { + this.log('on netBackgroundPolicyChange: ' + JSON.stringify(data)); +}) +``` + +## NetBackgroundPolicy + +Enumerates the background network policies. + +**System capability**: SystemCapability.Communication.NetManager.Core + +| Name | Value | Description | +| ------------------------ | ---- | ---------------------- | +| NET_BACKGROUND_POLICY_NONE | 0 | Default policy.| +| NET_BACKGROUND_POLICY_ENABLE | 1 | Applications running in the background are allowed to access metered networks.| +| NET_BACKGROUND_POLICY_DISABLE | 2 | Applications running in the background are not allowed to access metered networks.| +| NET_BACKGROUND_POLICY_ALLOW_LIST | 3 | Only applications on the allowlist are allowed to access metered networks when they are running in the background.| + +## NetQuotaPolicy + +Defines a network quota policy. + +**System capability**: SystemCapability.Communication.NetManager.Core + +| Name | Type | Description | +| ----------------------- | ----------------------------------- | ------------------------------------------------------------ | +| netType | [NetBearType](js-apis-net-connection.md#netbeartype) | Network type.| +| iccid | string | Identifier of the SIM card on the metered cellular network. It is not used for Wi-Fi networks.| +| ident | string | Identifier of the SIM card on the metered cellular network. It is used for Wi-Fi networks. It is used together with **iccid**.| +| periodDuration | string | Start time of metering.| +| warningBytes | number | Data volume threshold for generating an alarm.| +| limitBytes | number | Data volume quota.| +| lastWarningRemind | string | Last time when an alarm was generated.| +| lastLimitRemind | string | Last time when the quota was exhausted.| +| metered | string | Whether the network is a metered network.| +| limitAction | [LimitAction](#limitaction) | Action to take when the data volume quota is reached.| + +## LimitAction + +Enumerates the actions that can be taken when the data volume quota is reached. + +**System capability**: SystemCapability.Communication.NetManager.Core + +| Name | Value| Description | +| ---------------------- | ----- | ------------ | +| LIMIT_ACTION_NONE | -1 | Default policy.| +| LIMIT_ACTION_DISABLE | 0 | Internet access is disabled.| +| LIMIT_ACTION_AUTO_BILL| 1 | Users will be automatically charged for the data volume they use.| + +## NetUidRule + +Enumerates the metered network rules. + +**System capability**: SystemCapability.Communication.NetManager.Core + +| Name | Value| Description | +| ---------------------- | ----- | ------------ | +| NET_RULE_NONE | 0 | Default rule.| +| NET_RULE_ALLOW_METERED_FOREGROUND | 1 | Applications running in the foreground are allowed to access metered networks.| +| NET_RULE_ALLOW_METERED | 2 | Applications are allowed to access metered networks.| +| NET_RULE_REJECT_METERED | 4 | Applications are not allowed to access metered networks.| +| NET_RULE_ALLOW_ALL | 32 | Applications are allowed to access all networks (metered or non-metered).| +| NET_RULE_REJECT_ALL | 64 | Applications are not allowed to access any networks (metered or non-metered).| + +## RemindType + +Enumerates the reminder types. + +**System capability**: SystemCapability.Communication.NetManager.Core + +| Name | Value| Description | +| ---------------------- | - | ------- | +| REMIND_TYPE_WARNING | 1 | Warning.| +| REMIND_TYPE_LIMIT | 2 | Limit.| + +## NetUidPolicy + +Enumerates the application-specific network policies. + +**System capability**: SystemCapability.Communication.NetManager.Core + +| Name | Value| Description | +| ---------------------- | ----- | ------------ | +| NET_POLICY_NONE | 0 | Default network policy.| +| NET_POLICY_ALLOW_METERED_BACKGROUND | 1 | Applications running in the background are allowed to access metered networks.| +| NET_POLICY_REJECT_METERED_BACKGROUND | 2 | Applications running in the background are not allowed to access metered networks.| diff --git a/en/application-dev/reference/apis/js-apis-net-sharing.md b/en/application-dev/reference/apis/js-apis-net-sharing.md index 144ffa9c6e2d405c83e7cf14fdb7278c616759d3..f4682131182b59d9b54c26978ec780cd738172ef 100644 --- a/en/application-dev/reference/apis/js-apis-net-sharing.md +++ b/en/application-dev/reference/apis/js-apis-net-sharing.md @@ -1,8 +1,9 @@ -# @ohos.net.sharing (Network Sharing) +# # @ohos.net.sharing (Network Sharing) The **sharing** module allows you to share your device's Internet connection with other connected devices by means of Wi-Fi hotspot, Bluetooth, and USB sharing. It also allows you to query the network sharing state and shared mobile data volume. -> **NOTE**
+> **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 @@ -29,6 +30,15 @@ Checks whether network sharing is supported. This API uses an asynchronous callb | -------- | --------------------------------------- | ---- | ---------- | | callback | AsyncCallback\ | Yes | Callback used to return the result. The value **true** means that network sharing is supported, and **false** means the opposite.| +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | +| 2202011 | Cannot get network sharing configuration. | + **Example** ```js @@ -56,6 +66,15 @@ Checks whether network sharing is supported. This API uses a promise to return t | --------------------------------- | ------------------------------------- | | Promise\ | Promise used to return the result. The value **true** means that network sharing is supported, and **false** means the opposite.| +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | +| 2202011 | Cannot get network sharing configuration. | + **Example** ```js @@ -84,6 +103,14 @@ Checks whether network sharing is in progress. This API uses an asynchronous cal | -------- | --------------------------------------- | ---- | ---------- | | callback | AsyncCallback\ | Yes | Callback used to return the result. The value **true** means that network sharing is in progress, and **false** means the opposite.| +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | + **Example** ```js @@ -99,10 +126,10 @@ isSharing(): Promise\ Checks whether network sharing is in progress. This API uses a promise to return the result. -**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL - **System API**: This is a system API. +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + **System capability**: SystemCapability.Communication.NetManager.NetSharing **Return value** @@ -111,6 +138,14 @@ Checks whether network sharing is in progress. This API uses a promise to return | --------------------------------- | ------------------------------------- | | Promise\ | Promise used to return the result. The value **true** means that network sharing is in progress, and **false** means the opposite.| +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | + **Example** ```js @@ -127,10 +162,10 @@ startSharing(type: SharingIfaceType, callback: AsyncCallback\): void Starts network sharing of a specified type. This API uses an asynchronous callback to return the result. -**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL - **System API**: This is a system API. +**Required permissions**: ohos.permission.CONNECTIVITY_INTERNAL + **System capability**: SystemCapability.Communication.NetManager.NetSharing **Parameters** @@ -140,11 +175,27 @@ Starts network sharing of a specified type. This API uses an asynchronous callba | type | [SharingIfaceType](#sharingifacetype) | Yes | Sharing type. The value **0** means Wi-Fi hotspot sharing, **1** means USB sharing, and **2** means Bluetooth sharing.| | callback | AsyncCallback\ | Yes | Callback used to return the result.| +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | +| 2202004 | Try to share an unavailable iface. | +| 2202005 | WiFi sharing failed. | +| 2202006 | Bluetooth sharing failed. | +| 2202009 | Network share enable forwarding error. | +| 2202011 | Cannot get network sharing configuration. | + **Example** ```js import SharingIfaceType from '@ohos.net.sharing' -sharing.startSharing(SharingIfaceType.SHARING_WIFI, (error) => { +let SHARING_WIFI=0; +sharing.startSharing(SHARING_WIFI, (error) => { console.log(JSON.stringify(error)); }); ``` @@ -173,11 +224,27 @@ Starts network sharing of a specified type. This API uses a promise to return th | --------------------------------- | ------------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | +| 2202004 | Try to share an unavailable iface. | +| 2202005 | WiFi sharing failed. | +| 2202006 | Bluetooth sharing failed. | +| 2202009 | Network share enable forwarding error. | +| 2202011 | Cannot get network sharing configuration. | + **Example** ```js import SharingIfaceType from '@ohos.net.sharing' -sharing.startSharing(SharingIfaceType.SHARING_WIFI).then(() => { +let SHARING_WIFI=0; +sharing.startSharing(SHARING_WIFI).then(() => { console.log("start wifi sharing successful"); }).catch(error => { console.log("start wifi sharing failed"); @@ -203,11 +270,25 @@ Stops network sharing of a specified type. This API uses an asynchronous callbac | type | [SharingIfaceType](#sharingifacetype) | Yes | Sharing type. The value **0** means Wi-Fi hotspot sharing, **1** means USB sharing, and **2** means Bluetooth sharing.| | callback | AsyncCallback\ | Yes | Callback used to return the result.| +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | +| 2202005 | WiFi sharing failed. | +| 2202006 | Bluetooth sharing failed. | +| 2202011 | Cannot get network sharing configuration. | + **Example** ```js import SharingIfaceType from '@ohos.net.sharing' -sharing.stopSharing(SharingIfaceType.SHARING_WIFI, (error) => { +let SHARING_WIFI=0; +sharing.stopSharing(SHARING_WIFI, (error) => { console.log(JSON.stringify(error)); }); ``` @@ -236,11 +317,25 @@ Stops network sharing of a specified type. This API uses a promise to return the | --------------------------------- | ------------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | +| 2202005 | WiFi sharing failed. | +| 2202006 | Bluetooth sharing failed. | +| 2202011 | Cannot get network sharing configuration. | + **Example** ```js import SharingIfaceType from '@ohos.net.sharing' -sharing.stopSharing(SharingIfaceType.SHARING_WIFI).then(() => { +let SHARING_WIFI=0; +sharing.stopSharing(SHARING_WIFI).then(() => { console.log("stop wifi sharing successful"); }).catch(error => { console.log("stop wifi sharing failed"); @@ -265,6 +360,14 @@ Obtains the volume of mobile data traffic received via network sharing. This API | -------- | --------------------------------------- | ---- | ---------- | | callback | AsyncCallback\ | Yes | Callback used to return the data volume, in KB.| +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | + **Example** ```js @@ -292,6 +395,14 @@ Obtains the volume of mobile data traffic received via network sharing. This API | --------------------------------- | ------------------------------------- | | Promise\ | Promise used to return the data volume, in KB.| +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | + **Example** ```js @@ -320,6 +431,14 @@ Obtains the volume of mobile data traffic sent via network sharing. This API use | -------- | --------------------------------------- | ---- | ---------- | | callback | AsyncCallback\ | Yes | Callback used to return the data volume, in KB.| +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | + **Example** ```js @@ -347,6 +466,14 @@ Obtains the volume of mobile data traffic sent via network sharing. This API use | --------------------------------- | ------------------------------------- | | Promise\ | Promise used to return the data volume, in KB.| +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | + **Example** ```js @@ -375,6 +502,14 @@ Obtains the volume of mobile data traffic sent and received via network sharing. | -------- | --------------------------------------- | ---- | ---------- | | callback | AsyncCallback\ | Yes | Callback used to return the data volume, in KB.| +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | + **Example** ```js @@ -402,6 +537,14 @@ Obtains the volume of mobile data traffic sent and received via network sharing. | --------------------------------- | ------------------------------------- | | Promise\ | Promise used to return the data volume, in KB.| +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | + **Example** ```js @@ -428,14 +571,25 @@ Obtains the names of NICs in the specified network sharing state. This API uses | Name | Type | Mandatory| Description | | -------- | --------------------------------------- | ---- | ---------- | -| state | [SharingIfaceState](#sharingifacestate) | Yes | Network sharing state.| +| state | [SharingIfaceState](#sharingifacestate) | Yes | Network sharing state.| | callback | AsyncCallback\> | Yes | Callback used to return an array of NIC names.| +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | + **Example** ```js -import SharingIfaceType from '@ohos.net.sharing' -sharing.getSharingIfaces(SharingIfaceState.SHARING_NIC_CAN_SERVER, (error, data) => { +import SharingIfaceState from '@ohos.net.sharing' +let SHARING_BLUETOOTH=2; +sharing.getSharingIfaces(SHARING_BLUETOOTH, (error, data) => { console.log(JSON.stringify(error)); console.log(JSON.stringify(data)); }); @@ -457,7 +611,7 @@ Obtains the names of NICs in the specified network sharing state. This API uses | Name | Type | Mandatory| Description | | -------- | --------------------------------------- | ---- | ---------- | -| state | [SharingIfaceState](#sharingifacestate) | Yes | Network sharing state.| +| state | [SharingIfaceState](#sharingifacestate) | Yes | Network sharing state.| **Return value** @@ -465,11 +619,22 @@ Obtains the names of NICs in the specified network sharing state. This API uses | --------------------------------- | ------------------------------------- | | Promise\> | Promise used to return an array of NIC names.| +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | + **Example** ```js import SharingIfaceState from '@ohos.net.sharing' -sharing.getSharingIfaces(SharingIfaceState.SHARING_NIC_CAN_SERVER).then(data => { +let SHARING_BLUETOOTH=2; +sharing.getSharingIfaces(SHARING_BLUETOOTH).then(data => { console.log(JSON.stringify(data)); }).catch(error => { console.log(JSON.stringify(error)); @@ -495,11 +660,22 @@ Obtains the network sharing state of the specified type. This API uses an asynch | type | [SharingIfaceType](#sharingifacetype) | Yes | Sharing type. The value **0** means Wi-Fi hotspot sharing, **1** means USB sharing, and **2** means Bluetooth sharing.| | callback | AsyncCallback\<[SharingIfaceState](#sharingifacestate)> | Yes | Callback used to return the network sharing state.| +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | + **Example** ```js -import SharingIfaceState from '@ohos.net.sharing' -sharing.getSharingState(SharingIfaceType.SHARING_WIFI, (error, data) => { +import SharingIfaceType from '@ohos.net.sharing' +let SHARING_WIFI=0; +sharing.getSharingState(SHARING_WIFI, (error, data) => { console.log(JSON.stringify(error)); console.log(JSON.stringify(data)); }); @@ -523,6 +699,16 @@ Obtains the network sharing state of the specified type. This API uses a promise | -------- | --------------------------------------- | ---- | ---------- | | type | [SharingIfaceType](#sharingifacetype) | Yes | Sharing type. The value **0** means Wi-Fi hotspot sharing, **1** means USB sharing, and **2** means Bluetooth sharing.| +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | + **Return value** | Type | Description | @@ -533,7 +719,8 @@ Obtains the network sharing state of the specified type. This API uses a promise ```js import SharingIfaceType from '@ohos.net.sharing' -sharing.getSharingState(SharingIfaceType.SHARING_WIFI).then(data => { +let SHARING_WIFI=0; +sharing.getSharingState(SHARING_WIFI).then(data => { console.log(JSON.stringify(data)); }).catch(error => { console.log(JSON.stringify(error)); @@ -559,11 +746,22 @@ Obtains regular expressions of NICs of a specified type. This API uses an asynch | type | [SharingIfaceType](#sharingifacetype) | Yes | Sharing type. The value **0** means Wi-Fi hotspot sharing, **1** means USB sharing, and **2** means Bluetooth sharing.| | callback | AsyncCallback\> | Yes | Callback used to return an array of regular expressions.| +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | + **Example** ```js import SharingIfaceType from '@ohos.net.sharing' -sharing.getSharableRegexes(SharingIfaceType.SHARING_WIFI, (error, data) => { +let SHARING_WIFI=0; +sharing.getSharableRegexes(SHARING_WIFI, (error, data) => { console.log(JSON.stringify(error)); console.log(JSON.stringify(data)); }); @@ -593,11 +791,22 @@ Obtains regular expressions of NICs of a specified type. This API uses a promise | --------------------------------- | ------------------------------------- | | Promise\> | Promise used to return an array of regular expressions.| +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 2200001 | Invalid parameter value. | +| 2200002 | Operation failed. Cannot connect to service. | +| 2200003 | System internal error. | + **Example** ```js import SharingIfaceType from '@ohos.net.sharing' -sharing.getSharableRegexes(SharingIfaceType.SHARING_WIFI).then(data => { +let SHARING_WIFI=0; +sharing.getSharableRegexes(SHARING_WIFI).then(data => { console.log(JSON.stringify(data)); }).catch(error => { console.log(JSON.stringify(error)); @@ -621,14 +830,20 @@ Subscribes to network sharing state changes. This API uses an asynchronous callb | Name | Type | Mandatory| Description | | -------- | --------------------------------------- | ---- | ---------- | | type | string | Yes | Event name.| -| callback | AsyncCallback\ | Yes | Callback used to return the network sharing state.| +| callback | AsyncCallback\ | Yes | Callback invoked when the network sharing state changes.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | **Example** ```js -sharing.on('sharingStateChange', (error, data) => { - console.log(JSON.stringify(error)); - console.log(JSON.stringify(data)); + sharing.on('sharingStateChange', (data) => { + console.log('on sharingStateChange: ' + JSON.stringify(data)); }); ``` @@ -649,13 +864,19 @@ Unsubscribes from network sharing state changes. This API uses an asynchronous c | Name | Type | Mandatory| Description | | -------- | --------------------------------------- | ---- | ---------- | | type | string | Yes | Event name.| -| callback | AsyncCallback\ | No | Callback used for unsubscription.| +| callback | AsyncCallback\ | No | Callback invoked when the network sharing state changes.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | **Example** ```js -sharing.off('sharingStateChange', (error, data) => { - console.log(JSON.stringify(error)); +sharing.off('sharingStateChange', (data) => { console.log(JSON.stringify(data)); }); ``` @@ -679,12 +900,18 @@ Subscribes to network sharing state changes of a specified NIC. This API uses an | type | string | Yes | Event name.| | callback | AsyncCallback\<{ type: [SharingIfaceType](#sharingifacetype), iface: string, state: SharingIfaceState(#sharingifacestate) }> | Yes | Callback invoked when the network sharing state of the specified NIC changes.| +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | + **Example** ```js -sharing.on('interfaceSharingStateChange', (error, data) => { - console.log(JSON.stringify(error)); - console.log(JSON.stringify(data)); + sharing.on('interfaceSharingStateChange', (data) => { + console.log('on interfaceSharingStateChange: ' + JSON.stringify(data)); }); ``` @@ -705,13 +932,19 @@ Unsubscribes from network sharing status changes of a specified NIC. This API us | Name | Type | Mandatory| Description | | -------- | --------------------------------------- | ---- | ---------- | | type | string | Yes | Event name.| -| callback | AsyncCallback\<{ type: [SharingIfaceType](#sharingifacetype), iface: string, state: SharingIfaceState(#sharingifacestate) }> | No | Callback used for unsubscription.| +| callback | AsyncCallback\<{ type: [SharingIfaceType](#sharingifacetype), iface: string, state: SharingIfaceState(#sharingifacestate) }> | No | Callback used to return the result.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | **Example** ```js -sharing.off('interfaceSharingStateChange', (error, data) => { - console.log(JSON.stringify(error)); +sharing.off('interfaceSharingStateChange', (data) => { console.log(JSON.stringify(data)); }); ``` @@ -735,12 +968,18 @@ Subscribes to upstream network changes. This API uses an asynchronous callback t | type | string | Yes | Event name.| | callback | AsyncCallback\ | Yes | Callback invoked when the upstream network changes.| +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | + **Example** ```js -sharing.on('sharingUpstreamChange', (error, data) => { - console.log(JSON.stringify(error)); - console.log(JSON.stringify(data)); + sharing.on('sharingUpstreamChange', (data) => { + console.log('on sharingUpstreamChange: ' + JSON.stringify(data)); }); ``` @@ -761,13 +1000,19 @@ Unsubscribes from upstream network changes. This API uses an asynchronous callba | Name | Type | Mandatory| Description | | -------- | --------------------------------------- | ---- | ---------- | | type | string | Yes | Event name.| -| callback | AsyncCallback\ | No | Callback used for unsubscription.| +| callback | AsyncCallback\ | No | Callback used for unsubscription from upstream network changes.| + +**Error codes** + +| ID| Error Message | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | **Example** ```js -sharing.off('sharingUpstreamChange', (error, data) => { - console.log(JSON.stringify(error)); +sharing.off('sharingUpstreamChange', (data) => { console.log(JSON.stringify(data)); }); ``` @@ -788,7 +1033,7 @@ Enumerates the network sharing states of an NIC. ## SharingIfaceType -Enumerates the network sharing types of an NIC. +Enumerates the network sharing types of an NIC. **System API**: This is a system API. @@ -797,5 +1042,5 @@ Enumerates the network sharing types of an NIC. | Name | Value | Description | | ------------------------ | ---- | ---------------------- | | SHARING_WIFI | 0 | Wi-Fi hotspot sharing.| -| SHARING_USB | 1 | USB sharing (not supported currently).| +| SHARING_USB | 1 | USB sharing.| | SHARING_BLUETOOTH | 2 | Bluetooth sharing.| diff --git a/en/application-dev/reference/apis/js-apis-nfcController.md b/en/application-dev/reference/apis/js-apis-nfcController.md index 9fede96b4b9bce626e63d715b34113ab8451bf61..4c55691b61cd60cb59543ae0881a719d5bb8fc1b 100644 --- a/en/application-dev/reference/apis/js-apis-nfcController.md +++ b/en/application-dev/reference/apis/js-apis-nfcController.md @@ -66,7 +66,7 @@ Opens NFC. ## controller.enableNfc9+ -enableNfc(): boolean +enableNfc(): void Enables NFC. @@ -104,7 +104,7 @@ Closes NFC. ## controller.disableNfc9+ -disableNfc(): boolean +disableNfc(): void Disables NFC. diff --git a/en/application-dev/reference/apis/js-apis-notification.md b/en/application-dev/reference/apis/js-apis-notification.md index 2ad181cfd753f7ba9c2a3c42328f3d318e0af1e2..b0ad704b1848025f7b049f9c0cda6d12f2175554 100644 --- a/en/application-dev/reference/apis/js-apis-notification.md +++ b/en/application-dev/reference/apis/js-apis-notification.md @@ -853,8 +853,8 @@ function unsubscribeCallback(err) { console.info("unsubscribe success"); } } -function onDisconnectCallback(data) { - console.info("Cancel callback: " + JSON.stringify(data)); +function onDisconnectCallback() { + console.info("subscribe disconnect"); } let subscriber = { onDisconnect: onDisconnectCallback @@ -883,8 +883,8 @@ Unsubscribes from a notification. This API uses a promise to return the result. **Example** ```js -function onDisconnectCallback(data) { - console.info("Cancel callback: " + JSON.stringify(data)); +function onDisconnectCallback() { + console.info("subscribe disconnect"); } let subscriber = { onDisconnect: onDisconnectCallback diff --git a/en/application-dev/reference/apis/js-apis-notificationManager.md b/en/application-dev/reference/apis/js-apis-notificationManager.md index 27962f40126ecdc7f533e17516378bb490797c4d..04ebebd0e2a3d3de98f8ce537eaa0cd3f9243013 100644 --- a/en/application-dev/reference/apis/js-apis-notificationManager.md +++ b/en/application-dev/reference/apis/js-apis-notificationManager.md @@ -24,7 +24,7 @@ Publishes a notification. This API uses an asynchronous callback to return the r | Name | Type | Mandatory| Description | | -------- | ------------------------------------------- | ---- | ------------------------------------------- | -| request | [NotificationRequest](#notificationrequest) | Yes | Content and related configuration of the notification to publish.| +| request | [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) | Yes | Content and related configuration of the notification to publish.| | callback | AsyncCallback\ | Yes | Callback used to return the result. | **Error codes** @@ -78,7 +78,7 @@ Publishes a notification. This API uses a promise to return the result. | Name | Type | Mandatory| Description | | -------- | ------------------------------------------- | ---- | ------------------------------------------- | -| request | [NotificationRequest](#notificationrequest) | Yes | Content and related configuration of the notification to publish.| +| request | [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) | Yes | Content and related configuration of the notification to publish.| **Error codes** @@ -130,7 +130,7 @@ Publishes a notification to a specified user. This API uses an asynchronous call | Name | Type | Mandatory| Description | | -------- | ----------------------------------------- | ---- | ------------------------------------------- | -| request | [NotificationRequest](#notificationrequest) | Yes | Content and related configuration of the notification to publish.| +| request | [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) | Yes | Content and related configuration of the notification to publish.| | userId | number | Yes | User ID. | | callback | AsyncCallback\ | Yes | Callback used to return the result. | @@ -192,7 +192,7 @@ Publishes a notification to a specified user. This API uses a promise to return | Name | Type | Mandatory| Description | | -------- | ----------------------------------------- | ---- | ------------------------------------------- | -| request | [NotificationRequest](#notificationrequest) | Yes | Content and related configuration of the notification to publish.| +| request | [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) | Yes | Content and related configuration of the notification to publish.| | userId | number | Yes | User ID. | **Error codes** @@ -427,7 +427,7 @@ Adds a notification slot. This API uses an asynchronous callback to return the r | Name | Type | Mandatory| Description | | -------- | --------------------- | ---- | -------------------- | -| slot | [NotificationSlot](#notificationslot) | Yes | Notification slot to add.| +| slot | [NotificationSlot](js-apis-inner-notification-notificationSlot.md) | Yes | Notification slot to add.| | callback | AsyncCallback\ | Yes | Callback used to return the result.| **Error codes** @@ -474,7 +474,7 @@ Adds a notification slot. This API uses a promise to return the result. | Name| Type | Mandatory| Description | | ---- | ---------------- | ---- | -------------------- | -| slot | [NotificationSlot](#notificationslot) | Yes | Notification slot to add.| +| slot | [NotificationSlot](js-apis-inner-notification-notificationSlot.md) | Yes | Notification slot to add.| **Error codes** @@ -585,7 +585,7 @@ Adds an array of notification slots. This API uses an asynchronous callback to r | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ------------------------ | -| slots | Array\<[NotificationSlot](#notificationslot)\> | Yes | Notification slots to add.| +| slots | Array\<[NotificationSlot](js-apis-inner-notification-notificationSlot.md)\> | Yes | Notification slots to add.| | callback | AsyncCallback\ | Yes | Callback used to return the result. | **Error codes** @@ -636,7 +636,7 @@ Adds an array of notification slots. This API uses a promise to return the resul | Name | Type | Mandatory| Description | | ----- | ------------------------- | ---- | ------------------------ | -| slots | Array\<[NotificationSlot](#notificationslot)\> | Yes | Notification slots to add.| +| slots | Array\<[NotificationSlot](js-apis-inner-notification-notificationSlot.md)\> | Yes | Notification slots to add.| **Error codes** @@ -677,7 +677,7 @@ Obtains a notification slot of a specified type. This API uses an asynchronous c | Name | Type | Mandatory| Description | | -------- | --------------------------------- | ---- | ----------------------------------------------------------- | | slotType | [SlotType](#slottype) | Yes | Type of the notification slot, which can be used for social communication, service information, content consultation, and other purposes.| -| callback | AsyncCallback\<[NotificationSlot](#notificationslot)\> | Yes | Callback used to return the result. | +| callback | AsyncCallback\<[NotificationSlot](js-apis-inner-notification-notificationSlot.md)\> | Yes | Callback used to return the result. | **Error codes** @@ -757,7 +757,7 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/ | Name | Type | Mandatory| Description | | -------- | --------------------------------- | ---- | -------------------- | -| callback | AsyncCallback\\> | Yes | Callback used to return all notification slots of the current application.| +| callback | AsyncCallback\\> | Yes | Callback used to return all notification slots of the current application.| **Error codes** @@ -793,7 +793,7 @@ Obtains all notification slots of this application. This API uses a promise to r | Type | Description | | ----------------------------------------------------------- | ------------------------------------------------------------ | -| Promise\\> | Promise used to return all notification slots of the current application.| +| Promise\\> | Promise used to return all notification slots of the current application.| **Error codes** @@ -965,7 +965,7 @@ Sets whether to enable notification for a specified application. This API uses a | Name | Type | Mandatory| Description | | -------- | --------------------- | ---- | -------------------- | -| bundle | [BundleOption](#bundleoption) | Yes | Bundle of the application. | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle of the application. | | enable | boolean | Yes | Whether to enable notification. | | callback | AsyncCallback\ | Yes | Callback used to return the result.| @@ -1012,7 +1012,7 @@ Sets whether to enable notification for a specified application. This API uses a | Name | Type | Mandatory| Description | | ------ | ------------ | ---- | ---------- | -| bundle | [BundleOption](#bundleoption) | Yes | Bundle of the application.| +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle of the application.| | enable | boolean | Yes | Whether to enable notification. | **Error codes** @@ -1053,7 +1053,7 @@ Checks whether notification is enabled for a specified application. This API use | Name | Type | Mandatory| Description | | -------- | --------------------- | ---- | ------------------------ | -| bundle | [BundleOption](#bundleoption) | Yes | Bundle of the application. | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle of the application. | | callback | AsyncCallback\ | Yes | Callback used to return the result.| **Error codes** @@ -1099,7 +1099,7 @@ Checks whether notification is enabled for a specified application. This API use | Name | Type | Mandatory| Description | | ------ | ------------ | ---- | ---------- | -| bundle | [BundleOption](#bundleoption) | Yes | Bundle of the application.| +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle of the application.| **Return value** @@ -1187,7 +1187,7 @@ Checks whether notification is enabled for the current application. This API use | Name | Type | Mandatory| Description | | ------ | ------------ | ---- | ---------- | -| bundle | [BundleOption](#bundleoption) | Yes | Bundle of the application.| +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle of the application.| **Return value** @@ -1230,7 +1230,7 @@ Sets whether to enable the notification badge for a specified application. This | Name | Type | Mandatory| Description | | -------- | --------------------- | ---- | -------------------- | -| bundle | [BundleOption](#bundleoption) | Yes | Bundle of the application. | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle of the application. | | enable | boolean | Yes | Whether to enable notification. | | callback | AsyncCallback\ | Yes | Callback used to return the result.| @@ -1277,7 +1277,7 @@ Sets whether to enable the notification badge for a specified application. This | Name | Type | Mandatory| Description | | ------ | ------------ | ---- | ---------- | -| bundle | [BundleOption](#bundleoption) | Yes | Bundle of the application.| +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle of the application.| | enable | boolean | Yes | Whether to enable notification. | **Error codes** @@ -1318,7 +1318,7 @@ Checks whether the notification badge is enabled for a specified application. Th | Name | Type | Mandatory| Description | | -------- | --------------------- | ---- | ------------------------ | -| bundle | [BundleOption](#bundleoption) | Yes | Bundle of the application. | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle of the application. | | callback | AsyncCallback\ | Yes | Callback used to return the result.| **Error codes** @@ -1364,7 +1364,7 @@ Checks whether the notification badge is enabled for a specified application. Th | Name | Type | Mandatory| Description | | ------ | ------------ | ---- | ---------- | -| bundle | [BundleOption](#bundleoption) | Yes | Bundle of the application.| +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle of the application.| **Return value** @@ -1483,8 +1483,8 @@ Sets the notification slot for a specified application. This API uses an asynchr | Name | Type | Mandatory| Description | | -------- | --------------------- | ---- | -------------------- | -| bundle | [BundleOption](#bundleoption) | Yes | Bundle of the application. | -| slot | [NotificationSlot](#notificationslot) | Yes | Notification slot. | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle of the application. | +| slot | [NotificationSlot](js-apis-inner-notification-notificationSlot.md) | Yes | Notification slot. | | callback | AsyncCallback\ | Yes | Callback used to return the result.| **Error codes** @@ -1533,8 +1533,8 @@ Sets the notification slot for a specified application. This API uses a promise | Name | Type | Mandatory| Description | | ------ | ------------ | ---- | ---------- | -| bundle | [BundleOption](#bundleoption) | Yes | Bundle of the application.| -| slot | [NotificationSlot](#notificationslot) | Yes | Notification slot.| +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle of the application.| +| slot | [NotificationSlot](js-apis-inner-notification-notificationSlot.md) | Yes | Notification slot.| **Error codes** @@ -1577,8 +1577,8 @@ Obtains the notification slots of a specified application. This API uses an asyn | Name | Type | Mandatory| Description | | -------- | ---------------------------------------- | ---- | -------------------- | -| bundle | [BundleOption](#bundleoption) | Yes | Bundle of the application. | -| callback | AsyncCallback> | Yes | Callback used to return the result.| +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle of the application. | +| callback | AsyncCallback> | Yes | Callback used to return the result.| **Error codes** @@ -1623,13 +1623,13 @@ Obtains the notification slots of a specified application. This API uses a promi | Name | Type | Mandatory| Description | | ------ | ------------ | ---- | ---------- | -| bundle | [BundleOption](#bundleoption) | Yes | Bundle of the application.| +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle of the application.| **Return value** | Type | Description | | ----------------------------------------------------------- | ------------------------------------------------------------ | -| Promise> | Promise used to return the result.| +| Promise> | Promise used to return the result.| **Error codes** @@ -1669,7 +1669,7 @@ Obtains the number of notification slots of a specified application. This API us | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ---------------------- | -| bundle | [BundleOption](#bundleoption) | Yes | Bundle of the application. | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle of the application. | | callback | AsyncCallback\ | Yes | Callback used to return the result.| **Error codes** @@ -1715,7 +1715,7 @@ Obtains the number of notification slots of a specified application. This API us | Name | Type | Mandatory| Description | | ------ | ------------ | ---- | ---------- | -| bundle | [BundleOption](#bundleoption) | Yes | Bundle of the application.| +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle of the application.| **Return value** @@ -1762,7 +1762,7 @@ Obtains all active notifications. This API uses an asynchronous callback to retu | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | -------------------- | -| callback | AsyncCallback> | Yes | Callback used to return the result.| +| callback | AsyncCallback> | Yes | Callback used to return the result.| **Error codes** @@ -1788,7 +1788,7 @@ notificationManager.getAllActiveNotifications(getAllActiveNotificationsCallback) ## notificationManager.getAllActiveNotifications -getAllActiveNotifications(): Promise\\> +getAllActiveNotifications(): Promise\\> Obtains all active notifications. This API uses a promise to return the result. @@ -1802,7 +1802,7 @@ Obtains all active notifications. This API uses a promise to return the result. | Type | Description | | ----------------------------------------------------------- | ------------------------------------------------------------ | -| Promise\\> | Promise used to return the result.| +| Promise\\> | Promise used to return the result.| **Error codes** @@ -1904,7 +1904,7 @@ Obtains active notifications of this application. This API uses an asynchronous | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------ | -| callback | AsyncCallback> | Yes | Callback used to return the result.| +| callback | AsyncCallback> | Yes | Callback used to return the result.| **Error codes** @@ -1932,7 +1932,7 @@ notificationManager.getActiveNotifications(getActiveNotificationsCallback); ## notificationManager.getActiveNotifications -getActiveNotifications(): Promise\\> +getActiveNotifications(): Promise\\> Obtains active notifications of this application. This API uses a promise to return the result. @@ -1942,7 +1942,7 @@ Obtains active notifications of this application. This API uses a promise to ret | Type | Description | | ------------------------------------------------------------ | --------------------------------------- | -| Promise\\> | Promise used to return the result.| +| Promise\\> | Promise used to return the result.| **Error codes** @@ -1974,7 +1974,7 @@ Cancels notifications under a notification group of this application. This API u | Name | Type | Mandatory| Description | | --------- | --------------------- | ---- | ---------------------------- | -| groupName | string | Yes | Name of the notification group, which is specified through [NotificationRequest](#notificationrequest) when the notification is published.| +| groupName | string | Yes | Name of the notification group, which is specified through [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) when the notification is published.| | callback | AsyncCallback\ | Yes | Callback used to return the result.| **Error codes** @@ -2052,7 +2052,7 @@ Removes notifications under a notification group of a specified application. Thi | Name | Type | Mandatory| Description | | --------- | --------------------- | ---- | ---------------------------- | -| bundle | [BundleOption](#bundleoption) | Yes | Bundle information of the application. | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle information of the application. | | groupName | string | Yes | Name of the notification group. | | callback | AsyncCallback\ | Yes | Callback used to return the result.| @@ -2100,7 +2100,7 @@ Removes notifications under a notification group of a specified application. Thi | Name | Type | Mandatory| Description | | --------- | ------------ | ---- | -------------- | -| bundle | [BundleOption](#bundleoption) | Yes | Bundle information of the application. | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle information of the application. | | groupName | string | Yes | Name of the notification group.| **Error codes** @@ -2743,7 +2743,7 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/ **Example** ```javascript -function setDistributedEnableCallback() { +function setDistributedEnableCallback(err) { if (err) { console.error(`setDistributedEnable failed, code is ${err.code}, message is ${err.message}`); } else { @@ -2888,7 +2888,7 @@ Sets whether a specified application supports distributed notifications. This AP | Name | Type | Mandatory| Description | | -------- | ------------------------ | ---- | -------------------------- | -| bundle | [BundleOption](#bundleoption) | Yes | Bundle information of the application. | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle information of the application. | | enable | boolean | Yes | Whether the device supports distributed notifications. | | callback | AsyncCallback\ | Yes | Callback used to return the result.| @@ -2942,7 +2942,7 @@ Sets whether a specified application supports distributed notifications. This AP | Name | Type | Mandatory| Description | | -------- | ------------------------ | ---- | -------------------------- | -| bundle | [BundleOption](#bundleoption) | Yes | Bundle information of the application. | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle information of the application. | | enable | boolean | Yes | Whether the device supports distributed notifications. | **Error codes** @@ -2987,7 +2987,7 @@ Checks whether a specified application supports distributed notifications. This | Name | Type | Mandatory| Description | | -------- | ------------------------ | ---- | -------------------------- | -| bundle | [BundleOption](#bundleoption) | Yes | Bundle information of the application. | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle information of the application. | | callback | AsyncCallback\ | Yes | Callback used to return the result.| **Error codes** @@ -3005,7 +3005,7 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/ **Example** ```javascript -function isDistributedEnabledByBundleCallback(data) { +function isDistributedEnabledByBundleCallback(err, data) { if (err) { console.error(`isDistributedEnabledByBundle failed, code is ${err.code}, message is ${err.message}`); } else { @@ -3036,7 +3036,7 @@ Checks whether a specified application supports distributed notifications. This | Name | Type | Mandatory| Description | | -------- | ------------------------ | ---- | -------------------------- | -| bundle | [BundleOption](#bundleoption) | Yes | Bundle information of the application. | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle information of the application. | **Return value** @@ -3164,7 +3164,7 @@ Publishes a notification through the reminder agent. This API uses an asynchrono | Name | Type | Mandatory| Description | | -------------------- | ------------------------------------------- | ---- | ---------------------------------------- | -| request | [NotificationRequest](#notificationrequest) | Yes | Content and related configuration of the notification to publish.| +| request | [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) | Yes | Content and related configuration of the notification to publish.| | representativeBundle | string | Yes | Bundle name of the application whose notification function is taken over by the reminder agent. | | userId | number | Yes | User ID. | | callback | AsyncCallback | Yes | Callback used to return the result. | @@ -3231,7 +3231,7 @@ Publishes a notification through the reminder agent. This API uses a promise to | Name | Type | Mandatory| Description | | -------------------- | ------------------------------------------- | ---- | --------------------------------------------- | -| request | [NotificationRequest](#notificationrequest) | Yes | Content and related configuration of the notification to publish.| +| request | [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) | Yes | Content and related configuration of the notification to publish.| | representativeBundle | string | Yes | Bundle name of the application whose notification function is taken over by the reminder agent. | | userId | number | Yes | User ID. | @@ -3391,9 +3391,9 @@ Sets whether to enable a specified notification slot type for a specified applic | Name | Type | Mandatory| Description | | -------- | ----------------------------- | ---- | ---------------------- | -| bundle | [BundleOption](#bundleoption) | Yes | Bundle information of the application. | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle information of the application. | | type | [SlotType](#slottype) | Yes | Notification slot type. | -| enable | boolean | Yes | Whether to enable notification. | +| enable | boolean | Yes | Whether to enable the notification slot type. | | callback | AsyncCallback\ | Yes | Callback used to return the result.| **Error codes** @@ -3442,7 +3442,7 @@ Sets whether to enable a specified notification slot type for a specified applic | Name| Type | Mandatory| Description | | ------ | ----------------------------- | ---- | -------------- | -| bundle | [BundleOption](#bundleoption) | Yes | Bundle information of the application. | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle information of the application. | | type | [SlotType](#slottype) | Yes | Notification slot type.| | enable | boolean | Yes | Whether to enable notification. | @@ -3485,7 +3485,7 @@ Checks whether a specified notification slot type is enabled for a specified app | Name | Type | Mandatory| Description | | -------- | ----------------------------- | ---- | ---------------------- | -| bundle | [BundleOption](#bundleoption) | Yes | Bundle information of the application. | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle information of the application. | | type | [SlotType](#slottype) | Yes | Notification slot type. | | callback | AsyncCallback\ | Yes | Callback used to return the result.| @@ -3534,7 +3534,7 @@ Checks whether a specified notification slot type is enabled for a specified app | Name| Type | Mandatory| Description | | ------ | ----------------------------- | ---- | -------------- | -| bundle | [BundleOption](#bundleoption) | Yes | Bundle information of the application. | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle information of the application. | | type | [SlotType](#slottype) | Yes | Notification slot type.| **Return value** @@ -3809,16 +3809,6 @@ notificationManager.getSyncNotificationEnabledWithoutApp(userId).then((data) => | LEVEL_HIGH | 4 | Notification is enabled, and the notification icon is displayed in the status bar, with an alert tone and banner.| -## BundleOption - -**System capability**: SystemCapability.Notification.Notification - -| Name | Type | Readable| Writable| Description | -| ------ | ------ |---- | --- | ------ | -| bundle | string | Yes | Yes | Bundle information of the application.| -| uid | number | Yes | Yes | User ID.| - - ## SlotType **System capability**: SystemCapability.Notification.Notification @@ -3832,227 +3822,6 @@ notificationManager.getSyncNotificationEnabledWithoutApp(userId).then((data) => | OTHER_TYPES | 0xFFFF | Notification slot for other purposes.| -## NotificationActionButton - -Describes the button displayed in the notification. - -**System capability**: SystemCapability.Notification.Notification - -| Name | Type | Readable| Writable| Description | -| --------- | ----------------------------------------------- | --- | ---- | ------------------------- | -| title | string | Yes | Yes | Button title. | -| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes | Yes | **WantAgent** of the button.| -| extras | { [key: string]: any } | Yes | Yes | Extra information of the button. | -| userInput | [NotificationUserInput](#notificationuserinput) | Yes | Yes | User input object. | - - -## NotificationBasicContent - -Describes the normal text notification. - -**System capability**: SystemCapability.Notification.Notification - -| Name | Type | Readable| Writable| Description | -| -------------- | ------ | ---- | ---- | ---------------------------------- | -| title | string | Yes | Yes | Notification title. | -| text | string | Yes | Yes | Notification content. | -| additionalText | string | Yes | Yes | Additional information of the notification.| - - -## NotificationLongTextContent - -Describes the long text notification. - -**System capability**: SystemCapability.Notification.Notification - -| Name | Type | Readable| Writable| Description | -| -------------- | ------ | ---- | --- | -------------------------------- | -| title | string | Yes | Yes | Notification title. | -| text | string | Yes | Yes | Notification content. | -| additionalText | string | Yes | Yes | Additional information of the notification.| -| longText | string | Yes | Yes | Long text of the notification. | -| briefText | string | Yes | Yes | Brief text of the notification.| -| expandedTitle | string | Yes | Yes | Title of the notification in the expanded state. | - - -## NotificationMultiLineContent - -Describes the multi-line text notification. - -**System capability**: SystemCapability.Notification.Notification - -| Name | Type | Readable| Writable| Description | -| -------------- | --------------- | --- | --- | -------------------------------- | -| title | string | Yes | Yes | Notification title. | -| text | string | Yes | Yes | Notification content. | -| additionalText | string | Yes | Yes | Additional information of the notification.| -| briefText | string | Yes | Yes | Brief text of the notification.| -| longTitle | string | Yes | Yes | Title of the notification in the expanded state. | -| lines | Array\ | Yes | Yes | Multi-line text of the notification. | - - -## NotificationPictureContent - -Describe the picture-attached notification. - -**System capability**: SystemCapability.Notification.Notification - -| Name | Type | Readable| Writable| Description | -| -------------- | -------------- | ---- | --- | -------------------------------- | -| title | string | Yes | Yes | Notification title. | -| text | string | Yes | Yes | Notification content. | -| additionalText | string | Yes | Yes | Additional information of the notification.| -| briefText | string | Yes | Yes | Brief text of the notification.| -| expandedTitle | string | Yes | Yes | Title of the notification in the expanded state. | -| picture | [image.PixelMap](js-apis-image.md#pixelmap7) | Yes | Yes | Picture attached to the notification. | - - -## NotificationContent - -Describes the notification content. - -**System capability**: SystemCapability.Notification.Notification - -| Name | Type | Readable| Writable| Description | -| ----------- | ------------------------------------------------------------ | ---- | --- | ------------------ | -| contentType | [ContentType](#contenttype) | Yes | Yes | Notification content type. | -| normal | [NotificationBasicContent](#notificationbasiccontent) | Yes | Yes | Normal text. | -| longText | [NotificationLongTextContent](#notificationlongtextcontent) | Yes | Yes | Long text.| -| multiLine | [NotificationMultiLineContent](#notificationmultilinecontent) | Yes | Yes | Multi-line text. | -| picture | [NotificationPictureContent](#notificationpicturecontent) | Yes | Yes | Picture-attached. | - - -## NotificationFlagStatus - -Describes the notification flag status. - -**System capability**: SystemCapability.Notification.Notification - -**System API**: This is a system API and cannot be called by third-party applications. - -| Name | Value | Description | -| -------------- | --- | --------------------------------- | -| TYPE_NONE | 0 | The default flag is used. | -| TYPE_OPEN | 1 | The notification flag is enabled. | -| TYPE_CLOSE | 2 | The notification flag is disabled. | - - -## NotificationFlags - -Enumerates notification flags. - -**System capability**: SystemCapability.Notification.Notification - -| Name | Type | Readable| Writable| Description | -| ---------------- | ---------------------- | ---- | ---- | --------------------------------- | -| soundEnabled | [NotificationFlagStatus](#notificationflagstatus) | Yes | No | Whether to enable the sound alert for the notification. | -| vibrationEnabled | [NotificationFlagStatus](#notificationflagstatus) | Yes | No | Whether to enable vibration for the notification. | - - -## NotificationRequest - -Describes the notification request. - -**System capability**: SystemCapability.Notification.Notification - -| Name | Type | Readable| Writable| Description | -| --------------------- | --------------------------------------------- | ---- | --- | -------------------------- | -| content | [NotificationContent](#notificationcontent) | Yes | Yes | Notification content. | -| id | number | Yes | Yes | Notification ID. | -| slotType | [SlotType](#slottype) | Yes | Yes | Notification slot type. | -| isOngoing | boolean | Yes | Yes | Whether the notification is an ongoing notification. | -| isUnremovable | boolean | Yes | Yes | Whether the notification can be removed. | -| deliveryTime | number | Yes | Yes | Time when the notification is sent. | -| tapDismissed | boolean | Yes | Yes | Whether the notification is automatically cleared. | -| autoDeletedTime | number | Yes | Yes | Time when the notification is automatically cleared. | -| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes | Yes | **WantAgent** instance to which the notification will be redirected after being clicked.| -| extraInfo | {[key: string]: any} | Yes | Yes | Extended parameters. | -| color | number | Yes | Yes | Background color of the notification. Not supported currently.| -| colorEnabled | boolean | Yes | Yes | Whether the notification background color can be enabled. Not supported currently.| -| isAlertOnce | boolean | Yes | Yes | Whether the notification triggers an alert only once.| -| isStopwatch | boolean | Yes | Yes | Whether to display the stopwatch. | -| isCountDown | boolean | Yes | Yes | Whether to display the countdown time. | -| isFloatingIcon | boolean | Yes | Yes | Whether the notification is displayed as a floating icon in the status bar. | -| label | string | Yes | Yes | Notification label. | -| badgeIconStyle | number | Yes | Yes | Notification badge type. | -| showDeliveryTime | boolean | Yes | Yes | Whether to display the time when the notification is delivered. | -| actionButtons | Array\<[NotificationActionButton](#notificationactionbutton)\> | Yes | Yes | Buttons in the notification. Up to three buttons are allowed. | -| smallIcon | [image.PixelMap](js-apis-image.md#pixelmap7) | Yes | Yes | Small notification icon. This field is optional, and the icon size cannot exceed 30 KB.| -| largeIcon | [image.PixelMap](js-apis-image.md#pixelmap7) | Yes | Yes | Large notification icon. This field is optional, and the icon size cannot exceed 30 KB.| -| creatorBundleName | string | Yes | No | Name of the bundle that creates the notification. | -| creatorUid | number | Yes | No | UID used for creating the notification. | -| creatorPid | number | Yes | No | PID used for creating the notification. | -| creatorUserId| number | Yes | No | ID of the user who creates the notification. | -| hashCode | string | Yes | No | Unique ID of the notification. | -| classification | string | Yes | Yes | Notification category.
**System API**: This is a system API and cannot be called by third-party applications. | -| groupName| string | Yes | Yes | Notification group name. | -| template | [NotificationTemplate](#notificationtemplate) | Yes | Yes | Notification template. | -| isRemoveAllowed | boolean | Yes | No | Whether the notification can be removed.
**System API**: This is a system API and cannot be called by third-party applications. | -| source | number | Yes | No | Notification source.
**System API**: This is a system API and cannot be called by third-party applications. | -| distributedOption | [DistributedOptions](#distributedoptions) | Yes | Yes | Distributed notification options. | -| deviceId | string | Yes | No | Device ID of the notification source.
**System API**: This is a system API and cannot be called by third-party applications. | -| notificationFlags | [NotificationFlags](#notificationflags) | Yes | No | Notification flags. | -| removalWantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes | Yes | **WantAgent** instance to which the notification will be redirected when it is removed. | -| badgeNumber | number | Yes | Yes | Number of notifications displayed on the application icon. | - - -## DistributedOptions - -Describes distributed options. - -**System capability**: SystemCapability.Notification.Notification - -| Name | Type | Readable| Writable| Description | -| ---------------------- | -------------- | ---- | ---- | ---------------------------------- | -| isDistributed | boolean | Yes | Yes | Whether the notification is a distributed notification. | -| supportDisplayDevices | Array\ | Yes | Yes | List of the devices to which the notification can be synchronized. | -| supportOperateDevices | Array\ | Yes | Yes | List of the devices on which the notification can be opened. | -| remindType | number | Yes | No | Notification reminder type.
**System API**: This is a system API and cannot be called by third-party applications. | - - -## NotificationSlot - -Describes the notification slot. - -**System capability**: SystemCapability.Notification.Notification - -| Name | Type | Readable| Writable| Description | -| -------------------- | --------------------- | ---- | --- | ------------------------------------------ | -| type | [SlotType](#slottype) | Yes | Yes | Notification slot type. | -| level | number | Yes | Yes | Notification level. If this parameter is not set, the default value is used based on the notification slot type.| -| desc | string | Yes | Yes | Notification slot description. | -| badgeFlag | boolean | Yes | Yes | Whether to display the badge. | -| bypassDnd | boolean | Yes | Yes | Whether to bypass DND mode in the system. | -| lockscreenVisibility | number | Yes | Yes | Mode for displaying the notification on the lock screen. | -| vibrationEnabled | boolean | Yes | Yes | Whether vibration is enabled for the notification. | -| sound | string | Yes | Yes | Notification alert tone. | -| lightEnabled | boolean | Yes | Yes | Whether the indicator blinks for the notification. | -| lightColor | number | Yes | Yes | Indicator color of the notification. | -| vibrationValues | Array\ | Yes | Yes | Vibration mode of the notification. | -| enabled9+ | boolean | Yes | No | Whether the notification slot is enabled. | - - -## NotificationTemplate - -Describes the notification template. - -**System capability**: SystemCapability.Notification.Notification - -| Name| Type | Readable| Writable| Description | -| ---- | ---------------------- | ---- | ---- | ---------- | -| name | string | Yes | Yes | Template name.| -| data | {[key:string]: Object} | Yes | Yes | Template data.| - - -## NotificationUserInput - -Provides the notification user input. - -**System capability**: SystemCapability.Notification.Notification - -| Name | Type | Readable| Writable| Description | -| -------- | ------ | --- | ---- | ----------------------------- | -| inputKey | string | Yes | Yes | Key to identify the user input.| ## DeviceRemindType diff --git a/en/application-dev/reference/apis/js-apis-notificationSubscribe.md b/en/application-dev/reference/apis/js-apis-notificationSubscribe.md index 0cefd840d31e7471f1976042d8ba3f322de74882..da9e5c8cceb2c106516dfc82e28a77a432a1edea 100644 --- a/en/application-dev/reference/apis/js-apis-notificationSubscribe.md +++ b/en/application-dev/reference/apis/js-apis-notificationSubscribe.md @@ -30,8 +30,8 @@ Subscribes to a notification with the subscription information specified. This A | Name | Type | Mandatory| Description | | ---------- | ------------------------- | ---- | ---------------- | -| subscriber | [NotificationSubscriber](#notificationsubscriber) | Yes | Notification subscriber. | -| info | [NotificationSubscribeInfo](#notificationsubscribeinfo) | Yes | Notification subscription information.| +| subscriber | [NotificationSubscriber](js-apis-notification.md#notificationsubscriber) | Yes | Notification subscriber. | +| info | [NotificationSubscribeInfo](js-apis-notification.md#notificationsubscribeinfo) | Yes | Notification subscription information.| | callback | AsyncCallback\ | Yes | Callback used to return the result.| **Error codes** @@ -83,7 +83,7 @@ Subscribes to notifications of all applications under this user. This API uses a | Name | Type | Mandatory| Description | | ---------- | ---------------------- | ---- | ---------------- | -| subscriber | [NotificationSubscriber](#notificationsubscriber) | Yes | Notification subscriber. | +| subscriber | [NotificationSubscriber](js-apis-notification.md#notificationsubscriber) | Yes | Notification subscriber. | | callback | AsyncCallback\ | Yes | Callback used to return the result.| **Error codes** @@ -133,8 +133,8 @@ Subscribes to a notification with the subscription information specified. This A | Name | Type | Mandatory| Description | | ---------- | ------------------------- | ---- | ------------ | -| subscriber | [NotificationSubscriber](#notificationsubscriber) | Yes | Notification subscriber.| -| info | [NotificationSubscribeInfo](#notificationsubscribeinfo) | No | Notification subscription information. | +| subscriber | [NotificationSubscriber](js-apis-notification.md#notificationsubscriber) | Yes | Notification subscriber.| +| info | [NotificationSubscribeInfo](js-apis-notification.md#notificationsubscribeinfo) | No | Notification subscription information. | **Error codes** @@ -178,7 +178,7 @@ Unsubscribes from a notification. This API uses an asynchronous callback to retu | Name | Type | Mandatory| Description | | ---------- | ---------------------- | ---- | -------------------- | -| subscriber | [NotificationSubscriber](#notificationsubscriber) | Yes | Notification subscriber. | +| subscriber | [NotificationSubscriber](js-apis-notification.md#notificationsubscriber) | Yes | Notification subscriber. | | callback | AsyncCallback\ | Yes | Callback used to return the result.| **Error codes** @@ -201,8 +201,8 @@ function unsubscribeCallback(err) { console.info("unsubscribe success"); } } -function onDisconnectCallback(data) { - console.info("Cancel callback: " + JSON.stringify(data)); +function onDisconnectCallback() { + console.info("subscribe disconnect"); } let subscriber = { onDisconnect: onDisconnectCallback @@ -226,7 +226,7 @@ Unsubscribes from a notification. This API uses a promise to return the result. | Name | Type | Mandatory| Description | | ---------- | ---------------------- | ---- | ------------ | -| subscriber | [NotificationSubscriber](#notificationsubscriber) | Yes | Notification subscriber.| +| subscriber | [NotificationSubscriber](js-apis-notification.md#notificationsubscriber) | Yes | Notification subscriber.| **Error codes** @@ -241,8 +241,8 @@ For details about the error codes, see [Notification Error Codes](../errorcodes/ **Example** ```js -function onDisconnectCallback(data) { - console.info("Cancel callback: " + JSON.stringify(data)); +function onDisconnectCallback() { + console.info("subscribe disconnect"); } let subscriber = { onDisconnect: onDisconnectCallback @@ -268,8 +268,8 @@ Removes a notification for a specified application. This API uses an asynchronou | Name | Type | Mandatory| Description | | --------------- | ----------------------------------| ---- | -------------------- | -| bundle | [BundleOption](#bundleoption) | Yes | Bundle information of the application. | -| notificationKey | [NotificationKey](#notificationkey) | Yes | Notification key. | +| bundle | [BundleOption](js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle information of the application. | +| notificationKey | [NotificationKey](js-apis-notification.md#notificationkey) | Yes | Notification key. | | reason | [RemoveReason](#removereason) | Yes | Reason for removing the notification. | | callback | AsyncCallback\ | Yes | Callback used to return the result.| @@ -324,8 +324,8 @@ Removes a notification for a specified application. This API uses a promise to r | Name | Type | Mandatory| Description | | --------------- | --------------- | ---- | ---------- | -| bundle | [BundleOption](#bundleoption) | Yes | Bundle information of the application.| -| notificationKey | [NotificationKey](#notificationkey) | Yes | Notification key. | +| bundle | [BundleOption](js-apis-inner-notification-notificationCommonDef.md#bundleoption) | Yes | Bundle information of the application.| +| notificationKey | [NotificationKey]((js-apis-notification.md#notificationkey)) | Yes | Notification key. | | reason | [RemoveReason](#removereason) | Yes | Reason for removing the notification. | **Error codes** @@ -372,7 +372,7 @@ Removes a specified notification. This API uses an asynchronous callback to retu | Name | Type | Mandatory| Description | | -------- | --------------------- | ---- | -------------------- | -| hashCode | string | Yes | Unique notification ID. It is the **hashCode** in the [NotificationRequest](#notificationrequest) object of [SubscribeCallbackData](#subscribecallbackdata) of the [onConsume](#onconsume) callback.| +| hashCode | string | Yes | Unique notification ID. It is the value of **hashCode** in the [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) object of [SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata) in the [onConsume](#onconsume) callback. | | reason | [RemoveReason](#removereason) | Yes | Reason for removing the notification. | | callback | AsyncCallback\ | Yes | Callback used to return the result.| @@ -459,7 +459,7 @@ Removes all notifications for a specified application. This API uses an asynchro | Name | Type | Mandatory| Description | | -------- | --------------------- | ---- | ---------------------------- | -| bundle | [BundleOption](#bundleoption) | Yes | Bundle information of the application. | +| bundle | [BundleOption]((js-apis-inner-notification-notificationCommonDef.md#bundleoption)) | Yes | Bundle information of the application. | | callback | AsyncCallback\ | Yes | Callback used to return the result.| **Error codes** @@ -547,7 +547,7 @@ Removes all notifications for a specified application. This API uses a promise t | Name | Type | Mandatory| Description | | ------ | ------------ | ---- | ---------- | -| bundle | [BundleOption](#bundleoption) | No | Bundle information of the application.| +| bundle | [BundleOption]((js-apis-inner-notification-notificationCommonDef.md#bundleoption)) | No | Bundle information of the application.| **Error codes** @@ -668,7 +668,7 @@ Provides callbacks for receiving or removing notifications and serves as the inp ### onConsume -onConsume?: (data: [SubscribeCallbackData](#subscribecallbackdata)) => void +onConsume?: (data: [SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata)) => void Callback for receiving notifications. @@ -680,7 +680,7 @@ Callback for receiving notifications. | Name| Type| Mandatory| Description| | ------------ | ------------------------ | ---- | -------------------------- | -| data | [SubscribeCallbackData](#subscribecallbackdata) | Yes| Information about the notification received.| +| data | [SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata) | Yes| Information about the notification received.| **Example** @@ -708,7 +708,7 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback); ### onCancel -onCancel?:(data: [SubscribeCallbackData](#subscribecallbackdata)) => void +onCancel?:(data: [SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata)) => void Callback for canceling notifications. @@ -720,7 +720,7 @@ Callback for canceling notifications. | Name| Type| Mandatory| Description| | ------------ | ------------------------ | ---- | -------------------------- | -| data | [SubscribeCallbackData](#subscribecallbackdata) | Yes| Information about the notification to cancel.| +| data | [SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata) | Yes| Information about the notification to cancel.| **Example** @@ -748,7 +748,7 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback); ### onUpdate -onUpdate?:(data: [NotificationSortingMap](#notificationsortingmap)) => void +onUpdate?:(data: [NotificationSortingMap](js-apis-notification.md#notificationsortingmap)) => void Callback for notification sorting updates. @@ -760,7 +760,7 @@ Callback for notification sorting updates. | Name| Type| Mandatory| Description| | ------------ | ------------------------ | ---- | -------------------------- | -| data | [NotificationSortingMap](#notificationsortingmap) | Yes| Latest notification sorting list.| +| data | [NotificationSortingMap](js-apis-notification.md#notificationsortingmap)) | Yes| Latest notification sorting list.| **Example** @@ -935,7 +935,7 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback); ### onEnabledNotificationChanged -onEnabledNotificationChanged?:(callbackData: [EnabledNotificationCallbackData](#enablednotificationcallbackdata)) => void +onEnabledNotificationChanged?:(callbackData: [EnabledNotificationCallbackData](js-apis-notification.md#enablednotificationcallbackdata)) => void Listens for the notification enabled status changes. This API uses an asynchronous callback to return the result. @@ -947,7 +947,7 @@ Listens for the notification enabled status changes. This API uses an asynchrono | Name| Type| Mandatory| Description| | ------------ | ------------------------ | ---- | -------------------------- | -| callback | AsyncCallback\<[EnabledNotificationCallbackData](#enablednotificationcallbackdata)\> | Yes| Callback used to return the result.| +| callback | AsyncCallback\<[EnabledNotificationCallbackData](js-apis-notification.md#enablednotificationcallbackdata)\> | Yes| Callback used to return the result.| **Example** @@ -1013,104 +1013,6 @@ let subscriber = { notificationSubscribe.subscribe(subscriber, subscribeCallback); ``` -## BundleOption - -**System capability**: SystemCapability.Notification.Notification - -| Name | Type | Readable| Writable| Description | -| ------ | ------ |---- | --- | ------ | -| bundle | string | Yes | Yes | Bundle information of the application.| -| uid | number | Yes | Yes | User ID.| - -## NotificationKey - -**System capability**: SystemCapability.Notification.Notification - -| Name | Type | Readable| Writable| Description | -| ----- | ------ | ---- | --- | -------- | -| id | number | Yes | Yes | Notification ID. | -| label | string | Yes | Yes | Notification label.| - -## SubscribeCallbackData - -**System capability**: SystemCapability.Notification.Notification - -**System API**: This is a system API and cannot be called by third-party applications. - -| Name | Type | Readable | Writable | Description | -| --------------- | ------------------------------------------------- | -------- | -------- | -------- | -| request | [NotificationRequest](js-apis-notificationManager.md#notificationrequest) | Yes| No| Notification content.| -| sortingMap | [NotificationSortingMap](#notificationsortingmap) | Yes| No| Notification sorting information.| -| reason | number | Yes | No | Reason for deletion.| -| sound | string | Yes | No | Sound used for notification.| -| vibrationValues | Array\ | Yes | No | Vibration used for notification.| - - -## EnabledNotificationCallbackData - -**System capability**: SystemCapability.Notification.Notification - -**System API**: This is a system API and cannot be called by third-party applications. - -| Name | Type | Readable | Writable | Description | -| ------ | ------- | ---------------- | ---------------- | ---------------- | -| bundle | string | Yes| No| Bundle name of the application. | -| uid | number | Yes| No| UID of the application. | -| enable | boolean | Yes| No| Notification enabled status of the application.| - - -## NotificationSorting - -Provides sorting information of active notifications. - -**System capability**: SystemCapability.Notification.Notification - -**System API**: This is a system API and cannot be called by third-party applications. - -| Name | Type | Readable| Writable| Description | -| -------- | ------------------------------------- | ---- | --- | ------------ | -| slot | [NotificationSlot](js-apis-notificationManager.md#notificationslot) | Yes | No | Notification slot.| -| hashCode | string | Yes | No | Unique ID of the notification.| -| ranking | number | Yes | No | Notification sequence number.| - - -## NotificationSortingMap - -Provides sorting information of active notifications in all subscribed notifications. - -**System capability**: SystemCapability.Notification.Notification - -**System API**: This is a system API and cannot be called by third-party applications. - -| Name | Type | Readable| Writable| Description | -| -------------- | ------------------------------------------------------------ | ---- | --- | ---------------- | -| sortings | {[key: string]: [NotificationSorting](#notificationsorting)} | Yes | No | Array of notification sorting information.| -| sortedHashCode | Array\ | Yes | No | Array of unique notification IDs.| - - -## NotificationSubscribeInfo - -Provides the information about the publisher for notification subscription. - -**System capability**: SystemCapability.Notification.Notification - -**System API**: This is a system API and cannot be called by third-party applications. - -| Name | Type | Readable| Writable| Description | -| ----------- | --------------- | --- | ---- | ------------------------------- | -| bundleNames | Array\ | Yes | Yes | Bundle names of the applications whose notifications are to be subscribed to.| -| userId | number | Yes | Yes | User whose notifications are to be subscribed to. | - - -## NotificationUserInput - -Provides the notification user input. - -**System capability**: SystemCapability.Notification.Notification - -| Name | Type | Readable| Writable| Description | -| -------- | ------ | --- | ---- | ----------------------------- | -| inputKey | string | Yes | Yes | Key to identify the user input.| ## RemoveReason diff --git a/en/application-dev/reference/apis/js-apis-observer.md b/en/application-dev/reference/apis/js-apis-observer.md index ae5b7999bd7e579179920a73fcaea6116890ff70..b0e30e22190f5242d16e4be0b815bcf4c4109f30 100644 --- a/en/application-dev/reference/apis/js-apis-observer.md +++ b/en/application-dev/reference/apis/js-apis-observer.md @@ -9,15 +9,15 @@ The **observer** module provides event subscription management functions. You ca ## Modules to Import -```js -import observer from '@ohos.telephony.observer' +``` +import observer from '@ohos.telephony.observer'; ``` ## observer.on('networkStateChange') on\(type: \'networkStateChange\', callback: Callback\): void; -Registers an observer for network status change events. This API uses an asynchronous callback to return the result. +Registers an observer for network status change events. This API uses an asynchronous callback to return the execution result. **Required permission**: ohos.permission.GET_NETWORK_INFO @@ -25,15 +25,28 @@ Registers an observer for network status change events. This API uses an asynchr **Parameters** -| Name | Type | Mandatory| Description | -| -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ | -| type | string | Yes | Network status change event. | +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------------------------- | ---- | ---------------------------------------------------------------- | +| type | string | Yes | Network status change event. This field has a fixed value of **networkStateChange**. | | callback | Callback\<[NetworkState](js-apis-radio.md#networkstate)\> | Yes | Callback used to return the result. For details, see [NetworkState](js-apis-radio.md#networkstate).| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -observer.on('networkStateChange', data =>{ +observer.on('networkStateChange', data => { console.log("on networkStateChange, data:" + JSON.stringify(data)); }); ``` @@ -43,7 +56,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 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 execution result. **Required permission**: ohos.permission.GET_NETWORK_INFO @@ -51,16 +64,29 @@ Registers an observer for network status change events of the SIM card in the sp **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | -------------------------------------- | -| type | string | Yes | Network status change event. | -| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------------------------- | ---- | ---------------------------------------------------------------- | +| type | string | Yes | Network status change event. This field has a fixed value of **networkStateChange**. | +| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | | callback | Callback\<[NetworkState](js-apis-radio.md#networkstate)\> | Yes | Callback used to return the result. For details, see [NetworkState](js-apis-radio.md#networkstate).| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -observer.on('networkStateChange', {slotId: 0}, data =>{ +observer.on('networkStateChange', {slotId: 0}, data => { console.log("on networkStateChange, data:" + JSON.stringify(data)); }); ``` @@ -70,7 +96,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 result. +Unregisters the observer for network status change events. This API uses an asynchronous callback to return the execution result. >**NOTE** > @@ -82,9 +108,17 @@ Unregisters the observer for network status change events. This API uses an asyn | Name | Type | Mandatory| Description | | -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ | -| type | string | Yes | Network status change event. | +| type | string | Yes | Network status change event. This field has a fixed value of **networkStateChange**. | | callback | Callback\<[NetworkState](js-apis-radio.md#networkstate)\> | No | Callback used to return the result. For details, see [NetworkState](js-apis-radio.md#networkstate).| +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -101,21 +135,34 @@ 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 result. +Registers an observer for signal status change events. This API uses an asynchronous callback to return the execution result. **System capability**: SystemCapability.Telephony.StateRegistry **Parameters** | Name | Type | Mandatory| Description | -| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Signal status change event. | +| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | +| type | string | Yes | Signal status change event. This field has a fixed value of **signalInfoChange**. | | callback | Callback\> | Yes | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -observer.on('signalInfoChange', data =>{ +observer.on('signalInfoChange', data => { console.log("on signalInfoChange, data:" + JSON.stringify(data)); }); ``` @@ -125,22 +172,35 @@ 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 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 execution result. **System capability**: SystemCapability.Telephony.StateRegistry **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | -------------------------------------- | -| type | string | Yes | Signal status change event. | -| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | +| type | string | Yes | Signal status change event. This field has a fixed value of **signalInfoChange**. | +| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | | callback | Callback\> | Yes | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -observer.on('signalInfoChange', {slotId: 0}, data =>{ +observer.on('signalInfoChange', {slotId: 0}, data => { console.log("on signalInfoChange, data:" + JSON.stringify(data)); }); ``` @@ -150,7 +210,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 result. +Unregisters the observer for signal status change events. This API uses an asynchronous callback to return the execution result. >**NOTE** > @@ -162,9 +222,21 @@ Unregisters the observer for signal status change events. This API uses an async | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Signal status change event. | +| type | string | Yes | Signal status change event. This field has a fixed value of **signalInfoChange**. | | callback | Callback\> | No | Callback used to return the result. For details, see [SignalInformation](js-apis-radio.md#signalinformation).| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -177,26 +249,157 @@ observer.off('signalInfoChange', callback); observer.off('signalInfoChange'); ``` +## observer.on('cellInfoChange')8+ + +on\(type: \'cellInfoChange\', callback: Callback\): void; + +Registers an observer for cell information change events. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION + +**System capability**: SystemCapability.Telephony.StateRegistry + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------------------------- | ---- |------------------------------------------------------------| +| type | string | Yes | Cell information change event. This field has a fixed value of **cellInfoChange**. | +| callback | Callback\<[CellInformation](js-apis-radio.md#cellinformation8)\> | Yes | Callback used to return the result.| + +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + +**Example** + +```js +observer.on('cellInfoChange', data => { + console.log("on cellInfoChange, data:" + JSON.stringify(data)); +}); +``` + + +## observer.on('cellInfoChange')8+ + +on\(type: \'cellInfoChange\', 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. + +**System API**: This is a system API. + +**Required permissions**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION + +**System capability**: SystemCapability.Telephony.StateRegistry + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ |--------------------------------------------------| ---- |------------------------------------------------------------| +| type | string | Yes | Cell information change event. This field has a fixed value of **cellInfoChange**. | +| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | +| callback | Callback\<[CellInformation](js-apis-radio.md#cellinformation8)\> | Yes | Callback used to return the result.| + +**Error codes** + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + +**Example** + +```js +observer.on('cellInfoChange', {slotId: 0}, data => { + console.log("on cellInfoChange, data:" + JSON.stringify(data)); +}); +``` + + +## observer.off('cellInfoChange')8+ + +off\(type: \'cellInfoChange\', callback?: Callback\): void; + +Unregisters the observer for cell information change events. This API uses an asynchronous callback to return the result. + +>**NOTE** +> +>You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Telephony.StateRegistry + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ | +| type | string | Yes | Cell information change event. This field has a fixed value of **cellInfoChange**. | +| callback | Callback\<[CellInformation](js-apis-radio.md#cellinformation8)\> | No | Callback used to return the result.| + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + +**Example** + +```js +let callback = data => { + console.log("on cellInfoChange, data:" + JSON.stringify(data)); +} +observer.on('cellInfoChange', callback); +// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks. +observer.off('cellInfoChange', callback); +observer.off('cellInfoChange'); +``` ## observer.on('callStateChange') 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 result. +Registers an observer for call status change events. This API uses an asynchronous callback to return the execution result. **System capability**: SystemCapability.Telephony.StateRegistry **Parameters** | Name | Type | Mandatory| Description | -| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Call status change event. | +| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | +| type | string | Yes | Call status change event. This field has a fixed value of **callStateChange**. | | callback | Callback\<{ state: [CallState](js-apis-call.md#callstate), number: string }\> | Yes | Callback function. For details, see [CallState](js-apis-call.md#callstate) in call.
**number**: phone number.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -observer.on('callStateChange', value =>{ +observer.on('callStateChange', value => { console.log("on callStateChange, state:" + value.state + ", number:" + value.number); }); ``` @@ -206,22 +409,34 @@ 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 result. +Registers an observer for call status change events. This API uses an asynchronous callback to return the execution result. **System capability**: SystemCapability.Telephony.StateRegistry **Parameters** | Name | Type | Mandatory| Description | -| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Call status change event. | -| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | +| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | +| type | string | Yes | Call status change event. This field has a fixed value of **callStateChange**. | +| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | | callback | Callback\<{ state: [CallState](js-apis-call.md#callstate), number: string }\> | Yes | Callback function. For details, see [CallState](js-apis-call.md#callstate) in call.
**number**: phone number.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -observer.on('callStateChange', {slotId: 0}, value =>{ +observer.on('callStateChange', {slotId: 0}, value => { console.log("on callStateChange, state:" + value.state + ", number:" + value.number); }); ``` @@ -231,7 +446,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 result. +Unregisters the observer for call status change events. This API uses an asynchronous callback to return the execution result. >**NOTE** > @@ -242,10 +457,22 @@ Unregisters the observer for call status change events. This API uses an asynchr **Parameters** | Name | Type | Mandatory| Description | -| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Call status change event. | +| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | +| type | string | Yes | Call status change event. This field has a fixed value of **callStateChange**. | | callback | Callback\<{ state: [CallState](js-apis-call.md#callstate), number: string }\> | No | Callback function. For details, see [CallState](js-apis-call.md#callstate) in call.
**number**: phone number.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -263,7 +490,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 connection.This API uses an asynchronous callback to return the result. +Registers an observer for connection status change events of the cellular data link. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.StateRegistry @@ -271,13 +498,25 @@ Registers an observer for connection status change events of the cellular data c | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Connection status change event of the cellular data connection. | +| type | string | Yes | Cellular data connection status event. This field has a fixed value of **cellularDataConnectionStateChange**.| | 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).| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -observer.on('cellularDataConnectionStateChange', value =>{ +observer.on('cellularDataConnectionStateChange', value => { console.log("on cellularDataConnectionStateChange, state:" + value.state + ", network:" + value.network); }); ``` @@ -287,7 +526,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 connection 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 link over the SIM card in the specified slot. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.StateRegistry @@ -295,14 +534,26 @@ Registers an observer for connection status change events of the cellular data c | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| 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 | +| type | string | Yes | Cellular data connection status event. This field has a fixed value of **cellularDataConnectionStateChange**.| +| 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).| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -observer.on('cellularDataConnectionStateChange', {slotId: 0}, value =>{ +observer.on('cellularDataConnectionStateChange', {slotId: 0}, value => { console.log("on cellularDataConnectionStateChange, state:" + value.state + ", network:" + value.network); }); ``` @@ -312,7 +563,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 connection.This API uses an asynchronous callback to return the result. +Unregisters the observer for connection status change events of the cellular data link. This API uses an asynchronous callback to return the result. >**NOTE** > @@ -324,9 +575,21 @@ 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 connection. | +| type | string | Yes | Cellular data connection status event. This field has a fixed value of **cellularDataConnectionStateChange**.| | 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).| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -352,13 +615,25 @@ Registers an observer for the uplink and downlink data flow status change events | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Uplink and downlink data flow status change event of the cellular data service. | +| type | string | Yes | Cellular data flow change event. This field has a fixed value of **cellularDataFlowChange**. | | callback | Callback\<[DataFlowType](js-apis-telephony-data.md#dataflowtype)\> | Yes | Callback used to return the result. For details, see [DataFlowType](js-apis-telephony-data.md#dataflowtype).| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -observer.on('cellularDataFlowChange', data =>{ +observer.on('cellularDataFlowChange', data => { console.log("on networkStateChange, data:" + JSON.stringify(data)); }); ``` @@ -376,14 +651,26 @@ Registers an observer for the uplink and downlink data flow status change events | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Uplink and downlink data flow status change event of the cellular data service. | -| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | +| type | string | Yes | Cellular data flow change event. This field has a fixed value of **cellularDataFlowChange**. | +| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | | callback | Callback\<[DataFlowType](js-apis-telephony-data.md#dataflowtype)\> | Yes | Callback used to return the result. For details, see [DataFlowType](js-apis-telephony-data.md#dataflowtype).| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -observer.on('cellularDataFlowChange', {slotId: 0}, data =>{ +observer.on('cellularDataFlowChange', {slotId: 0}, data => { console.log("on cellularDataFlowChange, data:" + JSON.stringify(data)); }); ``` @@ -403,11 +690,23 @@ Unregisters the observer for the uplink and downlink data flow status change eve **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | Uplink and downlink data flow status change event of the cellular data service. | +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| type | string | Yes | Cellular data flow change event. This field has a fixed value of **cellularDataFlowChange**. | | callback | Callback\<[DataFlowType](js-apis-telephony-data.md#dataflowtype)\> | No | Callback used to return the result. For details, see [DataFlowType](js-apis-telephony-data.md#dataflowtype).| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -432,14 +731,26 @@ Registers an observer for SIM card status change events. This API uses an asynch **Parameters** | Name | Type | Mandatory| Description | -| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | SIM card status change event. | +| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | +| type | string | Yes | SIM status change event. This field has a fixed value of **simStateChange**. | | callback | Callback\<[SimStateData](#simstatedata7)\> | Yes | Callback used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -observer.on('simStateChange', data =>{ +observer.on('simStateChange', data => { console.log("on simStateChange, data:" + JSON.stringify(data)); }); ``` @@ -457,14 +768,26 @@ Registers an observer for status change events of the SIM card in the specified | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | SIM card status change event. | -| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | +| type | string | Yes | SIM status change event. This field has a fixed value of **simStateChange**. | +| slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | | callback | Callback\<[SimStateData](#simstatedata7)\> | Yes | Callback used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -observer.on('simStateChange', {slotId: 0}, data =>{ +observer.on('simStateChange', {slotId: 0}, data => { console.log("on simStateChange, data:" + JSON.stringify(data)); }); ``` @@ -486,9 +809,21 @@ Unregisters the observer for SIM card status change events. This API uses an asy | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | Yes | SIM card status change event. | +| type | string | Yes | SIM status change event. This field has a fixed value of **simStateChange**. | | callback | Callback\<[SimStateData](#simstatedata7)\> | No | Callback used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -531,8 +866,8 @@ Enumerates SIM card types and states. **System capability**: SystemCapability.Telephony.StateRegistry -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| type | [CardType](js-apis-sim.md#cardtype) | Yes| SIM card type. For details, see [CardType](js-apis-sim.md#cardtype).| -| state | [SimState](js-apis-sim.md#simstate) | Yes| SIM card status. For details, see [SimState](js-apis-sim.md#simstate).| -| reason8+ | [LockReason](#lockreason8) | Yes| SIM card lock type.| +| Name | Type | Mandatory| Description | +| ------------------- | ----------------------------------- | ---- | -------------------------------------------------------- | +| type | [CardType](js-apis-sim.md#cardtype7) | Yes | SIM card type.| +| state | [SimState](js-apis-sim.md#simstate) | Yes | SIM card state.| +| reason8+ | [LockReason](#lockreason8) | Yes | SIM card lock type. | diff --git a/en/application-dev/reference/apis/js-apis-osAccount.md b/en/application-dev/reference/apis/js-apis-osAccount.md index c7b8ecb87cca8ffe72417ca65c07086c8421fae1..750977a24244be831048e8055b39fc1daf0219c7 100644 --- a/en/application-dev/reference/apis/js-apis-osAccount.md +++ b/en/application-dev/reference/apis/js-apis-osAccount.md @@ -304,13 +304,13 @@ Checks whether an OS account is activated. This API uses a promise to return the } ``` -### checkConstraintEnabled9+ +### checkOsAccountConstraintEnabled9+ -checkConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback<boolean>): void +checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback<boolean>): void Checks whether the specified constraint is enabled for an OS account. This API uses an asynchronous callback to return the result. -**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS +**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS **System capability**: SystemCapability.Account.OsAccount @@ -327,7 +327,7 @@ Checks whether the specified constraint is enabled for an OS account. This API u | ID| Error Message | | -------- | ------------------- | | 12300001 | System service exception. | -| 12300002 | Invalid localId. | +| 12300002 | Invalid localId or constraint. | | 12300003 | Account not found. | **Example**: Check whether OS account 100 is forbidden to use Wi-Fi. @@ -337,25 +337,25 @@ Checks whether the specified constraint is enabled for an OS account. This API u let localId = 100; let constraint = "constraint.wifi"; try { - accountManager.checkConstraintEnabled(localId, constraint, (err, isEnabled)=>{ + accountManager.checkOsAccountConstraintEnabled(localId, constraint, (err, isEnabled)=>{ if (err) { - console.log("checkConstraintEnabled failed, error: " + JSON.stringify(err)); + console.log("checkOsAccountConstraintEnabled failed, error: " + JSON.stringify(err)); } else { - console.log("checkConstraintEnabled successfully, isEnabled: " + isEnabled); + console.log("checkOsAccountConstraintEnabled successfully, isEnabled: " + isEnabled); } }); } catch (err) { - console.log("checkConstraintEnabled exception: " + JSON.stringify(err)); + console.log("checkOsAccountConstraintEnabled exception: " + JSON.stringify(err)); } ``` -### checkConstraintEnabled9+ +### checkOsAccountConstraintEnabled9+ -checkConstraintEnabled(localId: number, constraint: string): Promise<boolean> +checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise<boolean> Checks whether the specified constraint is enabled for an OS account. This API uses a promise to return the result. -**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS +**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS **System capability**: SystemCapability.Account.OsAccount @@ -377,7 +377,7 @@ Checks whether the specified constraint is enabled for an OS account. This API u | ID| Error Message | | -------- | ------------------- | | 12300001 | System service exception. | -| 12300002 | Invalid localId. | +| 12300002 | Invalid localId or constraint. | | 12300003 | Account not found. | **Example**: Check whether OS account 100 is forbidden to use Wi-Fi. @@ -387,13 +387,13 @@ Checks whether the specified constraint is enabled for an OS account. This API u let localId = 100; let constraint = "constraint.wifi"; try { - accountManager.checkConstraintEnabled(localId, constraint).then((isEnabled) => { - console.log("checkConstraintEnabled successfully, isEnabled: " + isEnabled); + accountManager.checkOsAccountConstraintEnabled(localId, constraint).then((isEnabled) => { + console.log("checkOsAccountConstraintEnabled successfully, isEnabled: " + isEnabled); }).catch((err) => { - console.log("checkConstraintEnabled failed, error: " + JSON.stringify(err)); + console.log("checkOsAccountConstraintEnabled failed, error: " + JSON.stringify(err)); }); } catch (err) { - console.log("checkConstraintEnabled exception: " + JSON.stringify(err)); + console.log("checkOsAccountConstraintEnabled exception: " + JSON.stringify(err)); } ``` @@ -475,23 +475,19 @@ checkOsAccountVerified(callback: AsyncCallback<boolean>): void Checks whether this OS account has been verified. This API uses an asynchronous callback to return the result. -**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS - **System capability**: SystemCapability.Account.OsAccount **Parameters** | Name | Type | Mandatory| Description | | -------- | ---------------------------- | ---- | ------------------------------------------------------------- | -| callback | AsyncCallback<boolean> | Yes | Callback invoked to return the result. The value **true** means the OS account has been verified; the value **false** means the opposite.| +| callback | AsyncCallback<boolean> | Yes | Callback invoked to return the result. If true is returned, the current account has been verified. If false is returned, the current account has not been verified.| **Error codes** | ID| Error Message | | -------- | ------------------- | | 12300001 | System service exception. | -| 12300002 | Invalid localId. | -| 12300003 | Account not found. | **Example** @@ -555,7 +551,7 @@ Checks whether an OS account has been verified. This API uses an asynchronous ca ### checkOsAccountVerified9+ -checkOsAccountVerified(localId?: number): Promise<boolean> +checkOsAccountVerified(localId: number): Promise<boolean> Checks whether an OS account has been verified. This API uses a promise to return the result. @@ -567,7 +563,7 @@ Checks whether an OS account has been verified. This API uses a promise to retur | Name | Type | Mandatory| Description | | ------- | ------ | ---- | --------------------------------------------------------------- | -| localId | number | No | ID of the target OS account. If this parameter is not specified, this API checks whether the current OS account has been verified.| +| localId | number | Yes | ID of the target OS account. If this parameter is not specified, this API checks whether the current OS account has been verified.| **Return value** @@ -724,7 +720,7 @@ Sets or removes constraints for an OS account. This API uses an asynchronous cal | ID| Error Message | | -------- | ------------------- | | 12300001 | System service exception. | -| 12300002 | Invalid localId. | +| 12300002 | Invalid localId or constraints. | | 12300003 | Account not found. | | 12300008 | Restricted Account. | @@ -778,7 +774,7 @@ Sets or removes constraints for an OS account. This API uses a promise to return | ID| Error Message | | -------- | ------------------- | | 12300001 | System service exception. | -| 12300002 | Invalid localId. | +| 12300002 | Invalid localId or constraints. | | 12300003 | Account not found. | | 12300008 | Restricted Account. | @@ -973,9 +969,9 @@ Obtains the number of OS accounts created. This API uses a promise to return the } ``` -### queryOsAccountLocalIdFromProcess9+ +### getOsAccountLocalId9+ -queryOsAccountLocalIdFromProcess(callback: AsyncCallback<number>): void +getOsAccountLocalId(callback: AsyncCallback<number>): void Obtains the ID of the OS account to which the current process belongs. This API uses an asynchronous callback to return the result. @@ -998,21 +994,21 @@ Obtains the ID of the OS account to which the current process belongs. This API ```js let accountManager = account_osAccount.getAccountManager(); try { - accountManager.queryOsAccountLocalIdFromProcess((err, localId) => { + accountManager.getOsAccountLocalId((err, localId) => { if (err) { - console.log("queryOsAccountLocalIdFromProcess failed, error: " + JSON.stringify(err)); + console.log("getOsAccountLocalId failed, error: " + JSON.stringify(err)); } else { - console.log("queryOsAccountLocalIdFromProcess successfully, localId: " + localId); + console.log("getOsAccountLocalId successfully, localId: " + localId); } }); } catch (err) { - console.log("queryOsAccountLocalIdFromProcess exception: " + JSON.stringify(err)); + console.log("getOsAccountLocalId exception: " + JSON.stringify(err)); } ``` -### queryOsAccountLocalIdFromProcess9+ +### getOsAccountLocalId9+ -queryOsAccountLocalIdFromProcess(): Promise<number> +getOsAccountLocalId(): Promise<number> Obtains the ID of the OS account to which the current process belongs. This API uses a promise to return the result. @@ -1035,19 +1031,19 @@ Obtains the ID of the OS account to which the current process belongs. This API ```js let accountManager = account_osAccount.getAccountManager(); try { - accountManager.queryOsAccountLocalIdFromProcess().then((localId) => { - console.log("queryOsAccountLocalIdFromProcess successfully, localId: " + localId); + accountManager.getOsAccountLocalId().then((localId) => { + console.log("getOsAccountLocalId successfully, localId: " + localId); }).catch((err) => { - console.log("queryOsAccountLocalIdFromProcess failed, error: " + JSON.stringify(err)); + console.log("getOsAccountLocalId failed, error: " + JSON.stringify(err)); }); } catch (err) { - console.log('queryOsAccountLocalIdFromProcess exception: ' + JSON.stringify(err)); + console.log('getOsAccountLocalId exception: ' + JSON.stringify(err)); } ``` -### queryOsAccountLocalIdFromUid9+ +### getOsAccountLocalIdForUid9+ -queryOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback<number>): void +getOsAccountLocalIdForUid(uid: number, callback: AsyncCallback<number>): void Obtains the OS account ID based on the process UID. This API uses an asynchronous callback to return the result. @@ -1073,20 +1069,20 @@ Obtains the OS account ID based on the process UID. This API uses an asynchronou let accountManager = account_osAccount.getAccountManager(); let uid = 12345678; try { - accountManager.queryOsAccountLocalIdFromUid(uid, (err, localId) => { + accountManager.getOsAccountLocalIdForUid(uid, (err, localId) => { if (err) { - console.log("queryOsAccountLocalIdFromUid failed, error: " + JSON.stringify(err)); + console.log("getOsAccountLocalIdForUid failed, error: " + JSON.stringify(err)); } - console.log("queryOsAccountLocalIdFromUid successfully, localId: " + localId); + console.log("getOsAccountLocalIdForUid successfully, localId: " + localId); }); } catch (err) { - console.log("queryOsAccountLocalIdFromUid exception: " + JSON.stringify(err)); + console.log("getOsAccountLocalIdForUid exception: " + JSON.stringify(err)); } ``` -### queryOsAccountLocalIdFromUid9+ +### getOsAccountLocalIdForUid9+ -queryOsAccountLocalIdFromUid(uid: number): Promise<number> +getOsAccountLocalIdForUid(uid: number): Promise<number> Obtains the OS account ID based on the process UID. This API uses a promise to return the result. @@ -1117,19 +1113,19 @@ Obtains the OS account ID based on the process UID. This API uses a promise to r let accountManager = account_osAccount.getAccountManager(); let uid = 12345678; try { - accountManager.queryOsAccountLocalIdFromUid(uid).then((localId) => { - console.log("queryOsAccountLocalIdFromUid successfully, localId: " + localId); + accountManager.getOsAccountLocalIdForUid(uid).then((localId) => { + console.log("getOsAccountLocalIdForUid successfully, localId: " + localId); }).catch((err) => { - console.log("queryOsAccountLocalIdFromUid failed, error: " + JSON.stringify(err)); + console.log("getOsAccountLocalIdForUid failed, error: " + JSON.stringify(err)); }); } catch (err) { - console.log('queryOsAccountLocalIdFromUid exception: ' + JSON.stringify(err)); + console.log('getOsAccountLocalIdForUid exception: ' + JSON.stringify(err)); } ``` -### queryOsAccountLocalIdFromDomain9+ +### getOsAccountLocalIdForDomain9+ -queryOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback<number>): void +getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback<number>): void Obtains the OS account ID based on the domain account information. This API uses an asynchronous callback to return the result. @@ -1157,21 +1153,21 @@ Obtains the OS account ID based on the domain account information. This API uses let domainInfo = {domain: 'testDomain', accountName: 'testAccountName'}; let accountManager = account_osAccount.getAccountManager(); try { - accountManager.queryOsAccountLocalIdFromDomain(domainInfo, (err, localId) => { + accountManager.getOsAccountLocalIdForDomain(domainInfo, (err, localId) => { if (err) { - console.log("queryOsAccountLocalIdFromDomain failed, error: " + JSON.stringify(err)); + console.log("getOsAccountLocalIdForDomain failed, error: " + JSON.stringify(err)); } else { - console.log("queryOsAccountLocalIdFromDomain successfully, localId: " + localId); + console.log("getOsAccountLocalIdForDomain successfully, localId: " + localId); } }); } catch (err) { - console.log('queryOsAccountLocalIdFromDomain exception: ' + JSON.stringify(err)); + console.log('getOsAccountLocalIdForDomain exception: ' + JSON.stringify(err)); } ``` -### queryOsAccountLocalIdFromDomain9+ +### getOsAccountLocalIdForDomain9+ -queryOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise<number> +getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo): Promise<number> Obtains the OS account ID based on the domain account information. This API uses a promise to return the result. @@ -1204,13 +1200,13 @@ Obtains the OS account ID based on the domain account information. This API uses let accountManager = account_osAccount.getAccountManager(); let domainInfo = {domain: 'testDomain', accountName: 'testAccountName'}; try { - accountManager.queryOsAccountLocalIdFromDomain(domainInfo).then((localId) => { - console.log("queryOsAccountLocalIdFromDomain successfully, localId: " + localId); + accountManager.getOsAccountLocalIdForDomain(domainInfo).then((localId) => { + console.log("getOsAccountLocalIdForDomain successfully, localId: " + localId); }).catch((err) => { - console.log("queryOsAccountLocalIdFromDomain failed, error: " + JSON.stringify(err)); + console.log("getOsAccountLocalIdForDomain failed, error: " + JSON.stringify(err)); }); } catch (err) { - console.log("queryOsAccountLocalIdFromDomain exception: " + JSON.stringify(err)); + console.log("getOsAccountLocalIdForDomain exception: " + JSON.stringify(err)); } ``` @@ -1456,9 +1452,9 @@ Obtains information about all the OS accounts created. This API uses a promise t } ``` -### getActivatedOsAccountIds9+ +### getActivatedOsAccountLocalIds9+ -getActivatedOsAccountIds(callback: AsyncCallback<Array<number>>): void +getActivatedOsAccountLocalIds(callback: AsyncCallback<Array<number>>): void Obtains information about all activated OS accounts. This API uses an asynchronous callback to return the result. @@ -1481,21 +1477,21 @@ Obtains information about all activated OS accounts. This API uses an asynchrono ```js let accountManager = account_osAccount.getAccountManager(); try { - accountManager.getActivatedOsAccountIds((err, idArray)=>{ - console.log('getActivatedOsAccountIds err:' + JSON.stringify(err)); - console.log('getActivatedOsAccountIds idArray length:' + idArray.length); + accountManager.getActivatedOsAccountLocalIds((err, idArray)=>{ + console.log('getActivatedOsAccountLocalIds err:' + JSON.stringify(err)); + console.log('getActivatedOsAccountLocalIds idArray length:' + idArray.length); for(let i=0;i9+
+### getActivatedOsAccountLocalIds9+ -getActivatedOsAccountIds(): Promise<Array<number>> +getActivatedOsAccountLocalIds(): Promise<Array<number>> Obtains information about all activated OS accounts. This API uses a promise to return the result. @@ -1518,13 +1514,13 @@ Obtains information about all activated OS accounts. This API uses a promise to ```js let accountManager = account_osAccount.getAccountManager(); try { - accountManager.getActivatedOsAccountIds().then((idArray) => { - console.log('getActivatedOsAccountIds, idArray: ' + idArray); + accountManager.getActivatedOsAccountLocalIds().then((idArray) => { + console.log('getActivatedOsAccountLocalIds, idArray: ' + idArray); }).catch((err) => { - console.log('getActivatedOsAccountIds err: ' + JSON.stringify(err)); + console.log('getActivatedOsAccountLocalIds err: ' + JSON.stringify(err)); }); } catch (e) { - console.log('getActivatedOsAccountIds exception:' + JSON.stringify(e)); + console.log('getActivatedOsAccountLocalIds exception:' + JSON.stringify(e)); } ``` @@ -1862,7 +1858,7 @@ Obtains information about the OS account of the given ID. This API uses a promis | ID| Error Message | | -------- | ------------------- | | 12300001 | System service exception. | -| 12300002 | Invalid localId. | +| 12300002 | Invalid localId. | | 12300003 | Account not found. | **Example**: Query information about OS account 100. @@ -2214,9 +2210,9 @@ Sets a profile photo for an OS account. This API uses a promise to return the re } ``` -### queryOsAccountLocalIdBySerialNumber9+ +### getOsAccountLocalIdForSerialNumber9+ -queryOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback<number>): void +getOsAccountLocalIdForSerialNumber(serialNumber: number, callback: AsyncCallback<number>): void Obtains the OS account ID based on the serial number (SN). This API uses an asynchronous callback to return the result. @@ -2235,7 +2231,7 @@ Obtains the OS account ID based on the serial number (SN). This API uses an asyn | -------- | ------------------- | | 12300001 | System service exception. | | 12300002 | Invalid serialNumber. | -| 12300003 | Account not found. | +| 12300003 | The account indicated by serialNumber dose not exist. | **Example**: Obtain the ID of the OS account whose SN is 12345. @@ -2243,7 +2239,7 @@ Obtains the OS account ID based on the serial number (SN). This API uses an asyn let accountManager = account_osAccount.getAccountManager(); let serialNumber = 12345; try { - accountManager.queryOsAccountLocalIdBySerialNumber(serialNumber, (err, localId)=>{ + accountManager.getOsAccountLocalIdForSerialNumber(serialNumber, (err, localId)=>{ console.log('ger localId err:' + JSON.stringify(err)); console.log('get localId:' + localId + ' by serialNumber: ' + serialNumber); }); @@ -2252,9 +2248,9 @@ Obtains the OS account ID based on the serial number (SN). This API uses an asyn } ``` -### queryOsAccountLocalIdBySerialNumber9+ +### getOsAccountLocalIdForSerialNumber9+ -queryOsAccountLocalIdBySerialNumber(serialNumber: number): Promise<number> +getOsAccountLocalIdForSerialNumber(serialNumber: number): Promise<number> Obtains the OS account ID based on the SN. This API uses a promise to return the result. @@ -2278,7 +2274,7 @@ Obtains the OS account ID based on the SN. This API uses a promise to return the | -------- | ------------------- | | 12300001 | System service exception. | | 12300002 | Invalid serialNumber. | -| 12300003 | Account not found. | +| 12300003 | The account indicated by serialNumber dose not exist. | **Example**: Obtain the ID of the OS account whose SN is 12345. @@ -2286,19 +2282,19 @@ Obtains the OS account ID based on the SN. This API uses a promise to return the let accountManager = account_osAccount.getAccountManager(); let serialNumber = 12345; try { - accountManager.queryOsAccountLocalIdBySerialNumber(serialNumber).then((localId) => { - console.log('queryOsAccountLocalIdBySerialNumber localId: ' + localId); + accountManager.getOsAccountLocalIdForSerialNumber(serialNumber).then((localId) => { + console.log('getOsAccountLocalIdForSerialNumber localId: ' + localId); }).catch((err) => { - console.log('queryOsAccountLocalIdBySerialNumber err: ' + JSON.stringify(err)); + console.log('getOsAccountLocalIdForSerialNumber err: ' + JSON.stringify(err)); }); } catch (e) { - console.log('queryOsAccountLocalIdBySerialNumber exception: ' + JSON.stringify(e)); + console.log('getOsAccountLocalIdForSerialNumber exception: ' + JSON.stringify(e)); } ``` -### querySerialNumberByOsAccountLocalId9+ +### getSerialNumberForOsAccountLocalId9+ -querySerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback<number>): void +getSerialNumberForOsAccountLocalId(localId: number, callback: AsyncCallback<number>): void Obtains the SN of an OS account based on the account ID. This API uses an asynchronous callback to return the result. @@ -2325,7 +2321,7 @@ Obtains the SN of an OS account based on the account ID. This API uses an asynch let accountManager = account_osAccount.getAccountManager(); let localId = 100; try { - accountManager.querySerialNumberByOsAccountLocalId(localId, (err, serialNumber)=>{ + accountManager.getSerialNumberForOsAccountLocalId(localId, (err, serialNumber)=>{ console.log('ger serialNumber err:' + JSON.stringify(err)); console.log('get serialNumber:' + serialNumber + ' by localId: ' + localId); }); @@ -2334,9 +2330,9 @@ Obtains the SN of an OS account based on the account ID. This API uses an asynch } ``` -### querySerialNumberByOsAccountLocalId9+ +### getSerialNumberForOsAccountLocalId9+ -querySerialNumberByOsAccountLocalId(localId: number): Promise<number> +getSerialNumberForOsAccountLocalId(localId: number): Promise<number> Obtains the SN of an OS account based on the account ID. This API uses a promise to return the result. @@ -2368,13 +2364,13 @@ Obtains the SN of an OS account based on the account ID. This API uses a promise let accountManager = account_osAccount.getAccountManager(); let localId = 100; try { - accountManager.querySerialNumberByOsAccountLocalId(localId).then((serialNumber) => { - console.log('querySerialNumberByOsAccountLocalId serialNumber: ' + serialNumber); + accountManager.getSerialNumberForOsAccountLocalId(localId).then((serialNumber) => { + console.log('getSerialNumberForOsAccountLocalId serialNumber: ' + serialNumber); }).catch((err) => { - console.log('querySerialNumberByOsAccountLocalId err: ' + JSON.stringify(err)); + console.log('getSerialNumberForOsAccountLocalId err: ' + JSON.stringify(err)); }); } catch (e) { - console.log('querySerialNumberByOsAccountLocalId exception:' + JSON.stringify(e)); + console.log('getSerialNumberForOsAccountLocalId exception:' + JSON.stringify(e)); } ``` @@ -2404,7 +2400,6 @@ Subscribes to the OS account activation states, including the states of the acco | -------- | ------------- | | 12300001 | System service exception. | | 12300002 | Invalid type or name. | -| 12300011 | Callback has been registered. | **Example** @@ -2446,7 +2441,6 @@ Unsubscribes from the OS account activation states, including the states of the | -------- | ------------- | | 12300001 | System service exception. | | 12300002 | Invalid type or name. | -| 12300012 | Callback has not been registered. | **Example** @@ -2462,9 +2456,9 @@ Unsubscribes from the OS account activation states, including the states of the } ``` -### getBundleIdFromUid9+ +### getBundleIdForUid9+ -getBundleIdFromUid(uid: number, callback: AsyncCallback<number>): void; +getBundleIdForUid(uid: number, callback: AsyncCallback<number>): void; Obtains the bundle ID based on the UID. This API uses an asynchronous callback to return the result. @@ -2492,17 +2486,17 @@ Obtains the bundle ID based on the UID. This API uses an asynchronous callback t let accountManager = account_osAccount.getAccountManager(); let testUid = 1000000; try { - accountManager.getBundleIdFromUid(testUid, (err, bundleId) => { - console.info('getBundleIdFromUid errInfo:' + JSON.stringify(err)); - console.info('getBundleIdFromUid bundleId:' + JSON.stringify(bundleId)); + accountManager.getBundleIdForUid(testUid, (err, bundleId) => { + console.info('getBundleIdForUid errInfo:' + JSON.stringify(err)); + console.info('getBundleIdForUid bundleId:' + JSON.stringify(bundleId)); }); } catch (e) { - console.info('getBundleIdFromUid exception:' + JSON.stringify(e)); + console.info('getBundleIdForUid exception:' + JSON.stringify(e)); } ``` -### getBundleIdFromUid9+ +### getBundleIdForUid9+ -getBundleIdFromUid(uid: number): Promise<number>; +getBundleIdForUid(uid: number): Promise<number>; Obtains the bundle ID based on the UID. This API uses a promise to return the result. @@ -2535,13 +2529,13 @@ Obtains the bundle ID based on the UID. This API uses a promise to return the re let accountManager = account_osAccount.getAccountManager(); let testUid = 1000000; try { - accountManager.getBundleIdFromUid(testUid).then((result) => { - console.info('getBundleIdFromUid bundleId:' + JSON.stringify(result)); + accountManager.getBundleIdForUid(testUid).then((result) => { + console.info('getBundleIdForUid bundleId:' + JSON.stringify(result)); }).catch((err)=>{ - console.info('getBundleIdFromUid errInfo:' + JSON.stringify(err)); + console.info('getBundleIdForUid errInfo:' + JSON.stringify(err)); }); } catch (e) { - console.info('getBundleIdFromUid exception:' + JSON.stringify(e)); + console.info('getBundleIdForUid exception:' + JSON.stringify(e)); } ``` @@ -2620,9 +2614,9 @@ Checks whether the current process belongs to the main OS account. This API uses console.info('isMainOsAccount exception:' + JSON.stringify(e)); } ``` -### queryOsAccountConstraintSourceTypes9+ +### getOsAccountConstraintSourceTypes9+ -queryOsAccountConstraintSourceTypes(localId: number, constraint: string, callback: AsyncCallback<Array<ConstraintSourceTypeInfo>>): void; +getOsAccountConstraintSourceTypes(localId: number, constraint: string, callback: AsyncCallback<Array<ConstraintSourceTypeInfo>>): void; Obtains the constraint source information of an OS account. This API uses an asynchronous callback to return the result. @@ -2645,7 +2639,7 @@ Obtains the constraint source information of an OS account. This API uses an asy | ID| Error Message | | -------- | ------------- | | 12300001 | System service exception. | -| 12300002 | Invalid localId or constraint. | +| 12300002 | Invalid name or constraint. | | 12300003 | Account not found. | **Example** @@ -2653,18 +2647,18 @@ Obtains the constraint source information of an OS account. This API uses an asy ```js let accountManager = account_osAccount.getAccountManager(); try { - accountManager.queryOsAccountConstraintSourceTypes(100, 'constraint.wifi',(err,sourceTypeInfos)=>{ - console.info('queryOsAccountConstraintSourceType errInfo:' + JSON.stringify(err)); - console.info('queryOsAccountConstraintSourceType sourceTypeInfos:' + JSON.stringify(sourceTypeInfos)); + accountManager.getOsAccountConstraintSourceTypes(100, 'constraint.wifi',(err,sourceTypeInfos)=>{ + console.info('getOsAccountConstraintSourceTypes errInfo:' + JSON.stringify(err)); + console.info('getOsAccountConstraintSourceTypes sourceTypeInfos:' + JSON.stringify(sourceTypeInfos)); }); } catch (e) { - console.info('queryOsAccountConstraintSourceType exception:' + JSON.stringify(e)); + console.info('getOsAccountConstraintSourceTypes exception:' + JSON.stringify(e)); } ``` -### queryOsAccountConstraintSourceTypes9+ +### getOsAccountConstraintSourceTypes9+ -queryOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise<Array<ConstraintSourceTypeInfo>>; +getOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise<Array<ConstraintSourceTypeInfo>>; Obtains the constraint source information of an OS account. This API uses a promise to return the result. @@ -2692,7 +2686,7 @@ Obtains the constraint source information of an OS account. This API uses a prom | ID| Error Message | | -------- | ------------- | | 12300001 | System service exception. | -| 12300002 | Invalid localId or constraint. | +| 12300002 | Invalid name or constraint. | | 12300003 | Account not found. | **Example** @@ -2700,13 +2694,13 @@ Obtains the constraint source information of an OS account. This API uses a prom ```js let accountManager = account_osAccount.getAccountManager(); try { - accountManager.queryOsAccountConstraintSourceTypes(100, 'constraint.wifi').then((result) => { - console.info('queryOsAccountConstraintSourceType sourceTypeInfos:' + JSON.stringify(result)); + accountManager.getOsAccountConstraintSourceTypes(100, 'constraint.wifi').then((result) => { + console.info('getOsAccountConstraintSourceTypes sourceTypeInfos:' + JSON.stringify(result)); }).catch((err)=>{ - console.info('queryOsAccountConstraintSourceType errInfo:' + JSON.stringify(err)); + console.info('getOsAccountConstraintSourceTypes errInfo:' + JSON.stringify(err)); }); } catch (e) { - console.info('queryOsAccountConstraintSourceType exception:' + JSON.stringify(e)); + console.info('getOsAccountConstraintSourceTypes exception:' + JSON.stringify(e)); } ``` @@ -2852,7 +2846,7 @@ Checks whether the specified constraint is enabled for an OS account. This API u > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [checkConstraintEnabled](#checkconstraintenabled9). +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [checkOsAccountConstraintEnabled](#checkosaccountconstraintenabled9). **Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS @@ -2889,7 +2883,7 @@ Checks whether the specified constraint is enabled for an OS account. This API u > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [checkConstraintEnabled](#checkconstraintenabled9-1). +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [checkOsAccountConstraintEnabled](#checkosaccountconstraintenabled9-1). **Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS @@ -3158,7 +3152,7 @@ Obtains the ID of the OS account to which the current process belongs. This API > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [queryOsAccountLocalIdFromProcess](#queryosaccountlocalidfromprocess9). +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [getOsAccountLocalId](#getosaccountlocalid9). **System capability**: SystemCapability.Account.OsAccount @@ -3189,7 +3183,7 @@ Obtains the ID of the OS account to which the current process belongs. This API > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [queryOsAccountLocalIdFromProcess](#queryosaccountlocalidfromprocess9-1). +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [getOsAccountLocalId](#getosaccountlocalid9-1). **System capability**: SystemCapability.Account.OsAccount @@ -3218,7 +3212,7 @@ Obtains the OS account ID based on the process UID. This API uses an asynchronou > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [queryOsAccountLocalIdFromUid](#queryosaccountlocalidfromuid9). +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [getOsAccountLocalIdForUid](#getosaccountlocalidforuid9). **System capability**: SystemCapability.Account.OsAccount @@ -3251,7 +3245,7 @@ Obtains the OS account ID based on the process UID. This API uses a promise to r > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [queryOsAccountLocalIdFromUid](#queryosaccountlocalidfromuid9-1). +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [getOsAccountLocalIdForUid](#getosaccountlocalidforuid9-1). **System capability**: SystemCapability.Account.OsAccount @@ -3287,7 +3281,7 @@ Obtains the OS account ID based on the domain account information. This API uses > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [queryOsAccountLocalIdFromDomain](#queryosaccountlocalidfromdomain9). +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getOsAccountLocalIdForDomain](#getosaccountlocalidfordomain9). **Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS @@ -3322,7 +3316,7 @@ Obtains the OS account ID based on the domain account information. This API uses > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [queryOsAccountLocalIdFromDomain](#queryosaccountlocalidfromdomain9-1). +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getOsAccountLocalIdForDomain](#getosaccountlocalidfordomain9-1). **Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS @@ -3430,7 +3424,7 @@ Obtains information about all activated OS accounts. This API uses an asynchrono > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getActivatedOsAccountIds](#getactivatedosaccountids9). +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getActivatedOsAccountLocalIds](#getactivatedosaccountlocalids9). **System capability**: SystemCapability.Account.OsAccount @@ -3459,7 +3453,7 @@ queryActivatedOsAccountIds(): Promise<Array<number>> > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getActivatedOsAccountIds](#getactivatedosaccountids9-1). +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getActivatedOsAccountLocalIds](#getactivatedosaccountlocalids9-1). Obtains information about all activated OS accounts. This API uses a promise to return the result. @@ -3669,7 +3663,7 @@ Obtains the OS account ID based on the SN. This API uses an asynchronous callbac > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [queryOsAccountLocalIdBySerialNumber](#queryosaccountlocalidbyserialnumber9). +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getOsAccountLocalIdForSerialNumber](#getosaccountlocalidforserialnumber9). **System capability**: SystemCapability.Account.OsAccount @@ -3695,11 +3689,11 @@ Obtains the OS account ID based on the SN. This API uses an asynchronous callbac getOsAccountLocalIdBySerialNumber(serialNumber: number): Promise<number> -Obtains the OS account ID based on the serial number. This API uses a promise to return the result. +Obtains the OS account ID based on the SN. This API uses a promise to return the result. > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [queryOsAccountLocalIdBySerialNumber](#queryosaccountlocalidbyserialnumber9-1). +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getOsAccountLocalIdForSerialNumber](#getosaccountlocalidforserialnumber9-1). **System capability**: SystemCapability.Account.OsAccount @@ -3735,7 +3729,7 @@ Obtains the SN of an OS account based on the account ID. This API uses an asynch > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [querySerialNumberByOsAccountLocalId](#queryserialnumberbyosaccountlocalid9). +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getSerialNumberForOsAccountLocalId](#getserialnumberforosaccountlocalid9). **System capability**: SystemCapability.Account.OsAccount @@ -3765,7 +3759,7 @@ Obtains the SN of an OS account based on the account ID. This API uses a promise > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [querySerialNumberByOsAccountLocalId](#queryserialnumberbyosaccountlocalid9-1). +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getSerialNumberForOsAccountLocalId](#getserialnumberforosaccountlocalid9-1). **System capability**: SystemCapability.Account.OsAccount @@ -4117,9 +4111,9 @@ Performs authentication of the current user. This API uses an asynchronous callb | 12300101 | Credential is incorrect. | | 12300105 | Unsupported authTrustLevel. | | 12300106 | Unsupported authType. | -| 12300110 | Authentication locked. | +| 12300110 | Authentication is locked. | | 12300111 | Authentication timeout. | -| 12300112 | Authentication service busy. | +| 12300112 | Authentication service is busy. | **Example** ```js @@ -4176,9 +4170,9 @@ Performs authentication of the specified user. This API uses an asynchronous cal | 12300101 | Credential is incorrect. | | 12300105 | Unsupported authTrustLevel. | | 12300106 | Unsupported authType. | -| 12300110 | Authentication locked. | +| 12300110 | Authentication is locked. | | 12300111 | Authentication timeout. | -| 12300112 | Authentication service busy. | +| 12300112 | Authentication service is busy. | **Example** ```js @@ -4286,7 +4280,7 @@ Register a PIN inputer. | ID| Error Message | | -------- | --------------------------- | | 12300001 | System service exception. | -| 12300102 | Invalid inputer. | +| 12300002 | Invalid inputer. | | 12300103 | Inputer already registered. | **Example** @@ -4351,7 +4345,7 @@ Register a credential inputer. | ID| Error Message | | -------- | --------------------------- | | 12300001 | System service exception. | -| 12300102 | Invalid authType or inputer. | +| 12300002 | Invalid authType or inputer. | | 12300103 | The credential inputer has been registered. | | 12300106 | Unsupported authType. | @@ -4433,15 +4427,26 @@ Authenticates a domain account. **Example** ```js let plugin = { - auth: (domainInfo, credential, callback) => { + auth: (domainAccountInfo, credential, callback) => { // mock authentication - callback.onResult(0, {}); - } + // notify authentication result + callback.onResult(0, { + token: new Uint8Array([0]), + remainTimes: 5, + freezingTime: 0 + }); + }, + authWithPopup: (domainAccountInfo, callback) => {}, + authWithToken: (domainAccountInfo, callback) => {}, + getAccountInfo: (domain, accountName, callback) => {}, + getAuthStatusInfo: (domainAccountInfo, callback) => {}, + bindAccount: (domainAccountInfo, localId, callback) => {}, + unbindAccount: (domainAccountInfo, callback) => {} } account_osAccount.DomainAccountManager.registerPlugin(plugin); let userAuth = new account_osAccount.UserAuth(); let challenge = new Uint8Array([0]); - let authType = account_osAccount.AuthType.PIN; + let authType = account_osAccount.AuthType.DOMAIN; let authTrustLevel = account_osAccount.AuthTrustLevel.ATL1; try { userAuth.auth(challenge, authType, authTrustLevel, { @@ -4455,6 +4460,235 @@ Authenticates a domain account. } ``` +### authWithPopup10+ + +authWithPopup(domainAccountInfo: DomainAccountInfo, callback: IUserAuthCallback): void + +Authenticates a domain account in a pop-up window. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Account.OsAccount + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | --------------------------------------- | ---- | --------------- | +| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | Yes | Domain account information.| +| callback | [IUserAuthCallback](#iuserauthcallback8) | Yes | Callback invoked to return the authentication result.| + +**Example** + ```js + let plugin = { + auth: (domainAccountInfo, credential, callback) => {}, + authWithPopup: (domainAccountInfo, callback) => { + // mock authentication + // notify authentication result + callback.onResult(0, { + token: new Uint8Array([0]), + remainTimes: 5, + freezingTime: 0 + }); + }, + authWithToken: (domainAccountInfo, callback) => {}, + getAccountInfo: (domain, accountName, callback) => {}, + getAuthStatusInfo: (domainAccountInfo, callback) => {}, + bindAccount: (domainAccountInfo, localId, callback) => {}, + unbindAccount: (domainAccountInfo, callback) => {} + } + account_osAccount.DomainAccountManager.registerPlugin(plugin) + ``` + +### authWithToken10+ + +authWithToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array, callback: IUserAuthCallback): void + +Authenticates a domain account by the authorization token. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Account.OsAccount + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | --------------------------------------- | ---- | --------------- | +| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | Yes | Domain account information.| +| token | Uint8Array | Yes | Authorization token generated when the PIN or biometric authentication is successful.| +| callback | [IUserAuthCallback](#iuserauthcallback8) | Yes | Callback invoked to return the authentication result.| + +**Example** + ```js + let plugin = { + auth: (domainAccountInfo, credential, callback) => {}, + authWithPopup: (domainAccountInfo, callback) => {}, + authWithToken: (domainAccountInfo, callback) => { + // mock authentication + // notify authentication result + callback.onResult(0, { + token: new Uint8Array([0]), + remainTimes: 5, + freezingTime: 0 + }); + }, + getAccountInfo: (domain, accountName, callback) => {}, + getAuthStatusInfo: (domainAccountInfo, callback) => {}, + bindAccount: (domainAccountInfo, localId, callback) => {}, + unbindAccount: (domainAccountInfo, callback) => {} + } + account_osAccount.DomainAccountManager.registerPlugin(plugin) + ``` + +### getAccountInfo10+ + +getAccountInfo(domain: string, accountName: string, callback: AsyncCallback<DomainAccountInfo>): void + +Obtains information about a domain account. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Account.OsAccount + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | --------------------------------------- | ---- | --------------- | +| domain | string | Yes | Domain to which the account belongs.| +| accountName | string | Yes | Name of the account.| +| callback | AsyncCallback<[DomainAccountInfo](#domainaccountinfo8)> | Yes | Callback invoked to return the result.| + +**Example** + ```js + let plugin = { + auth: (domainAccountInfo, credential, callback) => {}, + authWithPopup: (domainAccountInfo, callback) => {}, + authWithToken: (domainAccountInfo, callback) => {}, + getAccountInfo: (domain, accountName, callback) => { + // mock getting account information + // notify result + callback({ + code: 0 + }, { + domain: domain, + accountName: accountName, + accountId: "xxxx" + }) + }, + getAuthStatusInfo: (domainAccountInfo, callback) => {}, + bindAccount: (domainAccountInfo, localId, callback) => {}, + unbindAccount: (domainAccountInfo, callback) => {} + } + account_osAccount.DomainAccountManager.registerPlugin(plugin) + ``` + +### getAuthStatusInfo10+ + +getAuthStatusInfo(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback<AuthStatusInfo>): void + +Obtains the authentication status of a domain account. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Account.OsAccount + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | --------------------------------------- | ---- | --------------- | +| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | Yes | Domain account information.| +| callback | AsyncCallback<[AuthStatusInfo](#authstatusinfo10)> | Yes | Callback invoked to return the result.| + +**Example** + ```js + let plugin = { + auth: (domainAccountInfo, credential, callback) => {}, + authWithPopup: (domainAccountInfo, callback) => {}, + authWithToken: (domainAccountInfo, callback) => {}, + getAccountInfo: (domain, accountName, callback) => {}, + getAuthStatusInfo: (domainAccountInfo, callback) => { + callback({ + code: 0 + }, { + remainTimes: 5, + freezingTime: 0 + }) + }, + bindAccount: (domainAccountInfo, localId, callback) => {}, + unbindAccount: (domainAccountInfo, callback) => {} + } + account_osAccount.DomainAccountManager.registerPlugin(plugin) + ``` + +### bindAccount10+ + +bindAccount(domainAccountInfo: DomainAccountInfo, localId: number, callback: AsyncCallback<void>): void + +Binds a domain account. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Account.OsAccount + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | --------------------------------------- | ---- | --------------- | +| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | Yes | Domain account information.| +| callback | AsyncCallback<void> | Yes | Callback invoked to return the result.| + +**Example** + ```js + let plugin = { + auth: (domainAccountInfo, credential, callback) => {}, + authWithPopup: (domainAccountInfo, callback) => {}, + authWithToken: (domainAccountInfo, callback) => {}, + getAccountInfo: (domain, accountName, callback) => {}, + getAuthStatusInfo: (domainAccountInfo, callback) => {}, + bindAccount: (domainAccountInfo, localId, callback) => { + // mock unbinding operation + // notify binding result + callback({code: 0}) + }, + unbindAccount: (domainAccountInfo, callback) => {} + } + account_osAccount.DomainAccountManager.registerPlugin(plugin) + ``` + +### unbindAccount10+ + +unbindAccount(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback<void>): void + +Unbinds a domain account. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Account.OsAccount + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | --------------------------------------- | ---- | --------------- | +| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | Yes | Domain account information.| +| callback | AsyncCallback<void> | Yes | Callback invoked to return the result.| + +**Example** + ```js + let plugin = { + auth: (domainAccountInfo, credential, callback) => {}, + authWithPopup: (domainAccountInfo, callback) => {}, + authWithToken: (domainAccountInfo, callback) => {}, + getAccountInfo: (domain, accountName, callback) => {}, + getAuthStatusInfo: (domainAccountInfo, callback) => {}, + bindAccount: (domainAccountInfo, localId, callback) => {}, + unbindAccount: (domainAccountInfo, callback) => { + // mock unbinding operation + // notify unbinding result + callback({code: 0}) + } + } + account_osAccount.DomainAccountManager.registerPlugin(plugin) + ``` + ## DomainAccountManager 9+ Provides APIs for domain account management. @@ -4485,10 +4719,13 @@ Registers a domain plug-in. **Example** ```js let plugin = { - auth: (domainInfo, credential, callback) => { - // mock authentication - callback.onResult(0, {}); - } + auth: (domainAccountInfo, credential, callback) => {}, + authWithPopup: (domainAccountInfo, callback) => {}, + authWithToken: (domainAccountInfo, callback) => {}, + getAccountInfo: (domain, accountName, callback) => {}, + getAuthStatusInfo: (domainAccountInfo, callback) => {}, + bindAccount: (domainAccountInfo, localId, callback) => {}, + unbindAccount: (domainAccountInfo, callback) => {} } try { account_osAccount.DomainAccountManager.registerPlugin(plugin); @@ -4520,6 +4757,252 @@ Unregisters this domain plug-in. } ``` +### auth10+ + +auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUserAuthCallback): void + +Authenticates a domain account. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Account.OsAccount + +**Required permissions**: ohos.permission.ACCESS_USER_AUTH_INTERNAL + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | --------------------------------------- | ---- | --------------- | +| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | Yes | Domain account information.| +| credential | Uint8Array | Yes | Credentials of the domain account.| +| callback | [IUserAuthCallback](#iuserauthcallback8) | Yes | Callback invoked to return the authentication result.| + +**Error codes** + +| ID| Error Message | +| -------- | --------------------------- | +| 12300001 | System service exception. | +| 12300002 | Invalid domainAccountInfo or credential. | +| 12300003 | Domain account does not exist. | +| 12300013 | Network exception. | +| 12300101 | Authentication failed. | +| 12300109 | Authentication is canceled. | +| 12300110 | Authentication is locked. | +| 12300111 | Authentication timeout. | +| 12300112 | Authentication service is busy. | +| 12300113 | Authentication service does not exist. | +| 12300114 | Authentication service exception. | + +**Example** + ```js + let domainAccountInfo = { + domain: "CHINA", + accountName: "zhangsan" + } + let credential = new Uint8Array([0]) + try { + account_osAccount.DomainAccountManager.auth(domainAccountInfo, credential, { + onResult: (resultCode, authResult) => { + console.log('auth resultCode = ' + resultCode); + console.log('auth authResult = ' + JSON.stringify(authResult)); + } + }); + } catch (err) { + console.log('auth exception = ' + JSON.stringify(err)); + } + ``` + +### authWithPopup10+ + +authWithPopup(callback: IUserAuthCallback): void + +Authenticates this domain account in a pop-up window. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Account.OsAccount + +**Required permissions**: ohos.permission.ACCESS_USER_AUTH_INTERNAL + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | --------------------------------------- | ---- | --------------- | +| callback | [IUserAuthCallback](#iuserauthcallback8) | Yes | Callback invoked to return the authentication result.| + +**Error codes** + +| ID| Error Message | +| -------- | --------------------------- | +| 12300001 | System service exception. | +| 12300003 | No domain account is bound. | +| 12300013 | Network exception. | +| 12300101 | Authentication failed. | +| 12300109 | Authentication is canceled. | +| 12300110 | Authentication is locked. | +| 12300111 | Authentication timeout. | +| 12300112 | Authentication service is busy. | +| 12300113 | Authentication service does not exist. | +| 12300114 | Authentication service exception. | + +**Example** + ```js + try { + account_osAccount.DomainAccountManager.authWithPopup({ + onResult: (resultCode, authResult) => { + console.log('auth resultCode = ' + resultCode); + console.log('auth authResult = ' + JSON.stringify(authResult)); + } + }) + } catch (err) { + console.log('auth exception = ' + JSON.stringify(err)); + } + ``` + +### authWithPopup10+ + +authWithPopup(localId: number, callback: IUserAuthCallback): void + +Authenticates a domain account in a pop-up window. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Account.OsAccount + +**Required permissions**: ohos.permission.ACCESS_USER_AUTH_INTERNAL + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | --------------------------------------- | ---- | --------------- | +| localId | number | Yes | Local ID of the OS account bound to the domain account.| +| callback | [IUserAuthCallback](#iuserauthcallback8) | Yes | Callback invoked to return the authentication result.| + +**Error codes** + +| ID| Error Message | +| -------- | --------------------------- | +| 12300001 | System service exception. | +| 12300002 | Invalid localId. | +| 12300003 | No domain account is bound. | +| 12300013 | Network exception. | +| 12300101 | Authentication failed. | +| 12300109 | Authentication is canceled. | +| 12300110 | Authentication is locked. | +| 12300111 | Authentication timeout. | +| 12300112 | Authentication service is busy. | +| 12300113 | Authentication service does not exist. | +| 12300114 | Authentication service exception. | + +**Example** + ```js + try { + account_osAccount.DomainAccountManager.authWithPopup(100, { + onResult: (resultCode, authResult) => { + console.log('authWithPopup resultCode = ' + resultCode); + console.log('authWithPopup authResult = ' + JSON.stringify(authResult)); + } + }) + } catch (err) { + console.log('authWithPopup exception = ' + JSON.stringify(err)); + } + ``` + +### hasAccount10+ + +hasAccount(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback<boolean>): void + +Checks whether a domain account exists. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Account.OsAccount + +**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | --------------------------------------- | ---- | --------------- | +| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | Yes | Domain account information.| +| callback | AsyncCallback<boolean> | Yes | Callback invoked to return the result.| + +**Error codes** + +| ID| Error Message | +| -------- | --------------------------- | +| 12300001 | System service exception. | +| 12300002 | Invalid domainAccountInfo. | +| 12300013 | Network exception. | + +**Example** + ```js + let domainAccountInfo = { + domain: "CHINA", + accountName: "zhangsan" + } + try { + account_osAccount.DomainAccountManager.hasAccount(domainAccountInfo, (err, result) => { + if (err) { + console.log("call hasAccount failed, error: " + JSON.stringify(err)); + } else { + console.log("hasAccount result: " + result); + } + }); + } catch (err) { + console.log('hasAccount exception = ' + JSON.stringify(err)); + } + ``` + +### hasAccount10+ + +hasAccount(domainAccountInfo: DomainAccountInfo): Promise<boolean> + +Checks whether a domain account exists. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Account.OsAccount + +**Required permissions**: ohos.permission.MANAGE_LOCAL_ACCOUNTS + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | --------------------------------------- | ---- | --------------- | +| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | Yes | Domain account information.| + +**Return value** + +| Type | Description | +| :------------------------ | ----------------------- | +| Promise<boolean> | Promise used to return the result.| + +**Error codes** + +| ID| Error Message | +| -------- | --------------------------- | +| 12300001 | System service exception. | +| 12300002 | Invalid domainAccountInfo. | +| 12300013 | Network exception. | + +**Example** + ```js + let domainAccountInfo = { + domain: "CHINA", + accountName: "zhangsan" + } + try { + account_osAccount.DomainAccountManager.hasAccount(domainAccountInfo).then((result) => { + console.log("hasAccount result: " + result); + }).catch((err) => { + console.log("call hasAccount failed, error: " + JSON.stringify(err)); + }); + } catch (err) { + console.log('hasAccount exception = ' + JSON.stringify(err)); + } + ``` + ## UserIdentityManager8+ Provides APIs for user identity management (IDM). @@ -4904,7 +5387,6 @@ Obtains authentication information. This API uses an asynchronous callback to re | ID| Error Message | | -------- | --------------------- | | 12300001 | System service exception. | -| 12300102 | Credential not found. | **Example** ```js @@ -4944,7 +5426,6 @@ Obtains authentication information of the specified type. This API uses an async | -------- | ------------------- | | 12300001 | System service exception. | | 12300002 | Invalid authType. | -| 12300102 | Credential not found. | **Example** ```js @@ -4989,7 +5470,6 @@ Obtains authentication information of the specified type. This API uses a promis | -------- | ------------------- | | 12300001 | System service exception. | | 12300002 | Invalid authType. | -| 12300102 | Credential not found. | **Example** ```js @@ -5028,6 +5508,12 @@ Called to set data in a PIN operation. | authSubType | [AuthSubType](#authsubtype8) | Yes | Credential subtype. | | data | Uint8Array | Yes | Data (credential) to set. The data is used for authentication and operations for adding and modifying credentials.| +**Error codes** + +| ID| Error Message | +| -------- | ------------------- | +| 12300002 | Invalid pinSubType. | + **Example** ```js let password = new Uint8Array([0, 0, 0, 0, 0, 0]); @@ -5254,7 +5740,7 @@ Defines the executor property. | ------------ | ---------------------------------------- | ----- | ----------------- | | result | number | Yes | Result. | | authSubType | [AuthSubType](#authsubtype8) | Yes | Authentication credential subtype.| -| remainTimes | number | No | Remaining time. | +| remainTimes | number | No | Number of remaining authentication times. | | freezingTime | number | No | Freezing time. | ## AuthResult8+ @@ -5268,7 +5754,7 @@ Defines the authentication result information. | Name | Type | Mandatory | Description | | ------------ | ----------- | ----- | ----------------- | | token | Uint8Array | No | Authentication token. | -| remainTimes | number | No | Remaining time. | +| remainTimes | number | No | Number of remaining authentication times. | | freezingTime | number | No | Freezing time. | ## CredentialInfo8+ @@ -5351,7 +5837,7 @@ Enumerates the authentication credential types. | PIN | 1 | PIN authentication.| | FACE | 2 | Facial authentication.| | FINGERPRINT10+ | 4 | Fingerprint authentication.| -| DOMAIN10+ | 1024 | Domain authentication.| +| DOMAIN9+ | 1024 | Domain authentication.| ## AuthSubType8+ @@ -5368,7 +5854,7 @@ Enumerates the authentication credential subtypes. | PIN_MIXED | 10002 | Custom mixed credentials.| | FACE_2D | 20000 | 2D face credential. | | FACE_3D | 20001 | 3D face credential. | -| DOMAIN_MIXED10+ | 10240001 | Mixed domain authentication credentials. | +| DOMAIN_MIXED9+ | 10240001 | Mixed domain authentication credentials. | ## AuthTrustLevel8+ @@ -5490,6 +5976,7 @@ Defines the domain account information. | ----------- | ------ | ---- | ---------- | | domain | string | Yes | Domain name. | | accountName | string | Yes | Domain account name.| +| accountId10+ | string | No | Domain account ID.
**System API**: This is a system API.| ## Constraints @@ -5586,3 +6073,16 @@ Enumerates the constraint sources. | CONSTRAINT_TYPE_BASE | 1 | Constraint from system settings. | | CONSTRAINT_TYPE_DEVICE_OWNER | 2 | Constraint from the device owners' settings. | | CONSTRAINT_TYPE_PROFILE_OWNER | 3 | Constraint from the profile owners' settings. | + +## AuthStatusInfo10+ + +Presents the authentication status information. + +**System API**: This is a system API. + +**System capability**: SystemCapability.Account.OsAccount + +| Name | Type | Mandatory| Description | +| ----------- | ------ | ---- | ---------- | +| remainTimes | number | Yes | Number of remaining authentication times. | +| freezingTime | number | Yes | Freezing time.| diff --git a/en/application-dev/reference/apis/js-apis-overlay.md b/en/application-dev/reference/apis/js-apis-overlay.md new file mode 100644 index 0000000000000000000000000000000000000000..30c46bad02c997e7915e5595a6308446a2f5d722 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-overlay.md @@ -0,0 +1,693 @@ +# @ohos.bundle.overlay (overlay) + +The **overlay** module provides APIs for installing a [module with the overlay feature](#module-with-the-overlay-feature), querying the [module information](js-apis-bundleManager-overlayModuleInfo.md), and disabling and enabling the module. + +> **NOTE** +> +> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version. + +## Modules to Import + +``` ts +import overlay from '@ohos.bundle.overlay' +``` + +## overlay.setOverlayEnabled + +setOverlayEnabled(moduleName:string, isEnabled: boolean): Promise\; + +Enables or disables a module with the overlay feature in the current application. This API uses a promise to return the result. If the operation is successful, **null** is returned; otherwise, an error message is returned. + +**System capability**: SystemCapability.BundleManager.BundleFramework.Overlay + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----------- | ------ | ---- | --------------------------------------- | +| moduleName | string | Yes | HAP name of the module with the overlay feature. | +| isEnabled | boolean | Yes | Whether to enable the module with the overlay feature. The value **true** means to enable the module, and **false** means to disable the module.| + +**Return value** + +| Type | Description | +| ------------------------- | ------------------ | +| Promise\ | Promise that returns no value.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| ------ | -------------------------------------- | +| 17700002 | The specified module name is not found. | +| 17700033 | The specified module is not an overlay module. | + +**Example** + +```ts +var moduleName = "feature"; +var isEnabled = false; + +try { + overlay.setOverlayEnabled(moduleName, isEnabled) + .then(() => { + console.info('setOverlayEnabled success'); + }).catch((error) => { + console.info('setOverlayEnabled failed due to error code: ' + err.code + ' ' + 'message:' + err.message); + }); +} catch (error) { + console.info('setOverlayEnabled failed due to error code: ' + err.code + ' ' + 'message:' + err.message); +} +``` + +## overlay.setOverlayEnabled + +setOverlayEnabled(moduleName:string, isEnabled: boolean, callback: AsyncCallback\): void; + +Enables or disables a module with the overlay feature in the current application. This API uses an asynchronous callback to return the result. If the operation is successful, **null** is returned; otherwise, an error message is returned. + +**System capability**: SystemCapability.BundleManager.BundleFramework.Overlay + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----------- | ------ | ---- | --------------------------------------- | +| moduleName | string | Yes | HAP name of the module with the overlay feature. | +| isEnabled | boolean | Yes | Whether to enable the module with the overlay feature. The value **true** means to enable the module, and **false** means to disable the module.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**; otherwise, **err** is an error object.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| ------ | -------------------------------------- | +| 17700002 | The specified module name is not found. | +| 17700033 | The specified module is not an overlay module. | + +**Example** + +```ts +var moduleName = "feature"; +var isEnabled = false; + +try { + overlay.setOverlayEnabled(moduleName, isEnabled, (error, data) => { + if (error) { + console.info('setOverlayEnabled failed due to error code: ' + err.code + ' ' + 'message:' + err.message); + return; + } + console.info('setOverlayEnabled success'); + }); +} catch (error) { + console.info('setOverlayEnabled failed due to error code: ' + err.code + ' ' + 'message:' + err.message); +} +``` + +## overlay.setOverlayEnabledByBundleName + +setOverlayEnabledByBundleName(bundleName:string, moduleName:string, isEnabled: boolean): Promise\; + +Enables or disables a module with the overlay feature in another application. This API uses a promise to return the result. If the operation is successful, the processing result is returned; otherwise, an error message is returned. + +**Required permissions**: ohos.permission.CHANGE_OVERLAY_ENABLED_STATE + +**System capability**: SystemCapability.BundleManager.BundleFramework.Overlay + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----------- | ------ | ---- | --------------------------------------- | +| bundleName | string | Yes | Bundle name of the application. | +| moduleName | string | Yes | HAP name of the module with the overlay feature. | +| isEnabled | boolean | Yes | Whether to enable the module with the overlay feature. The value **true** means to enable the module, and **false** means to disable the module.| + +**Return value** + +| Type | Description | +| ------------------------- | ------------------ | +| Promise\ | Promise that returns no value.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| ------ | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700002 | The specified module name is not found. | +| 17700032 | The specified bundle does not contain any overlay module. | +| 17700033 | The specified module is not an overlay module. | + +**Example** + +```ts +var bundleName = "com.example.myapplication_xxxxx"; +var moduleName = "feature" +var isEnabled = false; + +try { + overlay.setOverlayEnabledByBundleName(bundleName, moduleName, isEnabled) + .then((data) => { + console.info('setOverlayEnabledByBundleName successfully'); + }).catch((error) => { + console.info('setOverlayEnabledByBundleName failed due to error code: ' + err.code + ' ' + 'message:' + err.message); + }); +} catch (error) { + console.info('setOverlayEnabledByBundleName failed due to error code: ' + err.code + ' ' + 'message:' + err.message); +} +``` + +## overlay.setOverlayEnabledByBundleName + +setOverlayEnabledByBundleName(bundleName:string, moduleName:string, isEnabled: boolean, callback: AsyncCallback\): void; + +Enables or disables a module with the overlay feature in another application. This API uses an asynchronous callback to return the result. If the operation is successful, the processing result is returned; otherwise, an error message is returned. + +**Required permissions**: ohos.permission.CHANGE_OVERLAY_ENABLED_STATE + +**System capability**: SystemCapability.BundleManager.BundleFramework.Overlay + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----------- | ------ | ---- | --------------------------------------- | +| bundleName | string | Yes | Bundle name of the application. | +| moduleName | string | Yes | HAP name of the module with the overlay feature. | +| isEnabled | boolean | Yes | Whether to enable the module with the overlay feature. The value **true** means to enable the module, and **false** means to disable the module.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined** and data is the processing result obtained; otherwise, **err** is an error object. | + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| ------ | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700002 | The specified module name is not found. | +| 17700032 | The specified bundle does not contain any overlay module. | +| 17700033 | The specified module is not an overlay module. | + +**Example** + +```ts +var bundleName = "com.example.myapplication_xxxxx"; +var moduleName = "feature" +var isEnabled = false; + +try { + overlay.setOverlayEnabledByBundleName(bundleName, moduleName, isEnabled, (error, data) => { + if (error) { + console.info('setOverlayEnabledByBundleName failed due to error code: ' + err.code + ' ' + 'message:' + err.message); + return; + } + console.info('setOverlayEnabledByBundleName successfully'); + }); +} catch (error) { + console.info('setOverlayEnabledByBundleName failed due to error code: ' + err.code + ' ' + 'message:' + err.message); +} +``` + +## overlay.getOverlayModuleInfo + +getOverlayModuleInfo(moduleName: string): Promise\; + +Obtains the information about a module with the overlay feature in the current application. This API uses a promise to return the result. If the operation is successful, **null** is returned; otherwise, an error message is returned. + +**System capability**: SystemCapability.BundleManager.BundleFramework.Overlay + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----------- | ------ | ---- | ------------------------------------------ | +| moduleName | string | Yes | HAP name of the module with the overlay feature. | + +**Return value** + +| Type | Description | +| ------------------------- | ------------------ | +| Promise\ | Promise used to return the result, which is an **OverlayModuleInfo** object.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| ------ | -------------------------------------- | +| 17700002 | The specified module name is not found. | +| 17700032 | The specified bundle does not contain any overlay module. | +| 17700033 | The specified module is not an overlay module. | + +**Example** + +```ts +var moduleName = "feature" + +(async() => { + try { + let overlayModuleInfo = await overlay.getOverlayModuleInfo(moduleName); + console.log('overlayModuleInfo is ' + JSON.stringify(overlayModuleInfo)); + } catch(err) { + console.log('getOverlayModuleInfo failed due to error code : ' + err.code + ' ' + 'message :' + err.message); + } +})(); +``` + +## overlay.getOverlayModuleInfo + +getOverlayModuleInfo(moduleName: string, callback: AsyncCallback\): void; + +Obtains the information about a module with the overlay feature in the current application. This API uses an asynchronous callback to return the result. If the operation is successful, **null** is returned; otherwise, an error message is returned. + +**System capability**: SystemCapability.BundleManager.BundleFramework.Overlay + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----------- | ------ | ---- | --------------------------------------- | +| moduleName | string | Yes | HAP name of the module with the overlay feature. | +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**; otherwise, **err** is an error object. | + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| ------ | -------------------------------------- | +| 17700002 | The specified module name is not found. | +| 17700032 | he specified bundle does not contain any overlay module. | +| 17700033 | The specified module is not an overlay module. | + +**Example** + +```ts +var moduleName = "feature" +try { + overlay.getOverlayModuleInfo(moduleName, (error, data) => { + if (error) { + console.log('getOverlayModuleInfo failed due to error code : ' + err.code + ' ' + 'message :' + err.message); + return; + } + console.log('overlayModuleInfo is ' + JSON.stringify(data)); + }); +} catch (error) { + console.log('getOverlayModuleInfo failed due to error code : ' + err.code + ' ' + 'message :' + err.message); +} +``` + +## overlay.getTargetOverlayModuleInfos + +getTargetOverlayModuleInfos(targetModuleName: string): Promise\>; + +Obtains the information about modules with the overlay feature in the current application based on the target module name. This API uses a promise to return the result. If the operation is successful, **null** is returned; otherwise, an error message is returned. + +**System capability**: SystemCapability.BundleManager.BundleFramework.Overlay + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----------- | ------ | ---- | --------------------------------------- | +| targetModuleName | string | Yes | HAP name of the target module, which is **targetModuleName** specified by modules with the overlay feature. | + +**Return value** + +| Type | Description | +| ------------------------- | ------------------ | +| Promise\> | Promise used to return the result, which is an array of **OverlayModuleInfo** objects.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| ------ | -------------------------------------- | +| 17700002 | The specified module name is not found. | +| 17700034 | The specified module is an overlay module. | + +**Example** + +```ts +var targetModuleName = "feature" + +(async() => { + try { + let overlayModuleInfos = await overlay.getTargetOverlayModuleInfos(targetModuleName); + console.log('overlayModuleInfos are ' + JSON.stringify(overlayModuleInfos)); + } catch(err) { + console.log('getTargetOverlayModuleInfos failed due to error code : ' + err.code + ' ' + 'message :' + err.message); + } +})(); +``` + +## overlay.getTargetOverlayModuleInfos + +getTargetOverlayModuleInfos(targetModuleName: string, callback: AsyncCallback\>): void; + +Obtains the information about modules with the overlay feature in the current application based on the target module name. This API uses an asynchronous callback to return the result. If the operation is successful, **null** is returned; otherwise, an error message is returned. + +**System capability**: SystemCapability.BundleManager.BundleFramework.Overlay + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----------- | ------ | ---- | --------------------------------------- | +| targetModuleName | string | Yes | HAP name of the target module specified by modules with the overlay feature. | +| callback | AsyncCallback\> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**; otherwise, **err** is an error object. | + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| ------ | -------------------------------------- | +| 17700002 | The specified module name is not found. | +| 17700034 | The specified module is an overlay module. | + +**Example** + +```ts +var targetModuleName = "feature" +try { + overlay.getTargetOverlayModuleInfos(targetModuleName, (error, data) => { + if (error) { + console.log('getTargetOverlayModuleInfos failed due to error code : ' + err.code + ' ' + 'message :' + err.message); + return; + } + console.log('overlayModuleInfo is ' + JSON.stringify(data)); + }); +} catch (error) { + console.log('getTargetOverlayModuleInfos failed due to error code : ' + err.code + ' ' + 'message :' + err.message); +} +``` + +## overlay.getOverlayModuleInfoByBundleName + +getOverlayModuleInfoByBundleName(bundleName: string, moduleName?: string): Promise\>; + +Obtains the information about a module with the overlay feature in another application. This API uses a promise to return the result. If the operation is successful, **null** is returned; otherwise, an error message is returned. + +**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**System capability**: SystemCapability.BundleManager.BundleFramework.Overlay + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----------- | ------ | ---- | --------------------------------------- | +| bundleName | string | Yes | Bundle name of the application. | +| moduleName | string | No | HAP name of the module with the overlay feature. If this parameter is not specified, the API obtains the information of all modules with the overlay feature in that application. | + +**Return value** + +| Type | Description | +| ------------------------- | ------------------ | +| Promise\> | Promise used to return the result, which is an array of **OverlayModuleInfo** objects.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| ------ | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700002 | The specified module name is not found. | +| 17700032 | The specified bundle does not contain any overlay module. | +| 17700033 | The specified module is not an overlay module. | + +**Example** + +```ts +var bundleName = "com.example.myapplication_xxxxx"; +var moduleName = "feature" + +(async() => { + try { + let overlayModuleInfos = await overlay.getOverlayModuleInfoByBundleName(bundleName, moduleName); + console.log('overlayModuleInfos are ' + JSON.stringify(overlayModuleInfos)); + } catch(err) { + console.log('getTargetOverlayModuleInfos failed due to error code : ' + err.code + ' ' + 'message :' + err.message); + } +})(); +``` + +## overlay.getOverlayModuleInfoByBundleName + +getOverlayModuleInfoByBundleName(bundleName: string, moduleName: string, callback: AsyncCallback\>): void; + +Obtains the information about a module with the overlay feature in another application. This API uses an asynchronous callback to return the result. If the operation is successful, **null** is returned; otherwise, an error message is returned. + +**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**System capability**: SystemCapability.BundleManager.BundleFramework.Overlay + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----------- | ------ | ---- | --------------------------------------- | +| bundleName | string | Yes | Bundle name of the application. | +| moduleName | string | Yes | HAP name of the module with the overlay feature. If this parameter is not specified, the API obtains the information of all modules with the overlay feature in that application. | +| callback | AsyncCallback\> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**; otherwise, **err** is an error object. | + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| ------ | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700002 | The specified module name is not found. | +| 17700032 | The specified bundle does not contain any overlay module. | +| 17700033 | The specified module is not an overlay module. | + +**Example** + +```ts +var bundleName = "com.example.myapplication_xxxxx"; +var moduleName = "feature" + +try { + overlay.getOverlayModuleInfoByBundleName(bundleName, moduleName, (error, data) => { + if (error) { + console.log('getOverlayModuleInfoByBundleName failed due to error code : ' + err.code + ' ' + 'message :' + err.message); + return; + } + console.log('overlayModuleInfo is ' + JSON.stringify(data)); + }); +} catch (error) { + console.log('getOverlayModuleInfoByBundleName failed due to error code : ' + err.code + ' ' + 'message :' + err.message); +} +``` + +## overlay.getOverlayModuleInfoByBundleName + +getOverlayModuleInfoByBundleName(bundleName: string, callback: AsyncCallback\>): void; + +Obtains the information about all modules with the overlay feature in another application. This API uses an asynchronous callback to return the result. If the operation is successful, **null** is returned; otherwise, an error message is returned. + +**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**System capability**: SystemCapability.BundleManager.BundleFramework.Overlay + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----------- | ------ | ---- | --------------------------------------- | +| bundleName | string | Yes | Bundle name of the application. | +| callback | AsyncCallback\> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**; otherwise, **err** is an error object. | + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| ------ | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700002 | The specified module name is not found. | +| 17700032 | The specified bundle does not contain any overlay module. | +| 17700033 | The specified module is not an overlay module. | + +**Example** + +```ts +var bundleName = "com.example.myapplication_xxxxx"; + +try { + overlay.getOverlayModuleInfoByBundleName(bundleName, (error, data) => { + if (error) { + console.log('getOverlayModuleInfoByBundleName failed due to error code : ' + err.code + ' ' + 'message :' + err.message); + return; + } + console.log('overlayModuleInfo is ' + JSON.stringify(data)); + }); +} catch (error) { + console.log('getOverlayModuleInfoByBundleName failed due to error code : ' + err.code + ' ' + 'message :' + err.message); +} +``` + +## overlay.getTargetOverlayModuleInfosByBundleName + +getTargetOverlayModuleInfosByBundleName(targetBundleName: string, moduleName?: string): Promise\>; + +Obtains the information about modules with the overlay feature in another application based on the target module name. This API uses a promise to return the result. If the operation is successful, **null** is returned; otherwise, an error message is returned. + +**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**System capability**: SystemCapability.BundleManager.BundleFramework.Overlay + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----------- | ------ | ---- | --------------------------------------- | +| targetBundleName | string | Yes | Bundle name of the application. | +| moduleName | string | No | HAP name of the target module, which is **targetModuleName** specified by modules with the overlay feature. If this parameter is not specified, the API obtains the information associated with all modules in that application. | + +**Return value** + +| Type | Description | +| ------------------------- | ------------------ | +| Promise\> | Promise used to return the result, which is an array of **OverlayModuleInfo** objects.| + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| ------ | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700002 | The specified module name is not found. | +| 17700034 | The specified module is an overlay module. | +| 17700035 | The specified bundle is an overlay bundle. | + +**Example** + +```ts +var targetBundleName = "com.example.myapplication_xxxxx"; +var moduleName = "feature" + +(async() => { + try { + let overlayModuleInfos = await overlay.getTargetOverlayModuleInfosByBundleName(targetBundleName, moduleName); + console.log('overlayModuleInfos are ' + JSON.stringify(overlayModuleInfos)); + } catch(err) { + console.log('getTargetOverlayModuleInfosByBundleName failed due to error code : ' + err.code + ' ' + 'message :' + err.message); + } +})(); +``` + +## overlay.getTargetOverlayModuleInfosByBundleName + +getTargetOverlayModuleInfosByBundleName(targetBundleName: string, moduleName: string, callback: AsyncCallback\>): void; + +Obtains the information about modules with the overlay feature in another application based on the target module name. This API uses an asynchronous callback to return the result. If the operation is successful, **null** is returned; otherwise, an error message is returned. + +**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**System capability**: SystemCapability.BundleManager.BundleFramework.Overlay + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----------- | ------ | ---- | --------------------------------------- | +| targetBundleName | string | Yes | Bundle name of the application. | +| moduleName | string | Yes | HAP name of the target module, which is **targetModuleName** specified by modules with the overlay feature. If this parameter is not specified, the API obtains the information associated with all modules in that application. | +| callback | AsyncCallback\> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**; otherwise, **err** is an error object. | + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| ------ | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700002 | The specified module name is not found. | +| 17700034 | The specified module is an overlay module. | +| 17700035 | The specified bundle is an overlay bundle. | + +**Example** + +```ts +var targetBundleName = "com.example.myapplication_xxxxx"; +var moduleName = "feature" + +try { + overlay.getTargetOverlayModuleInfosByBundleName(targetBundleName, moduleName, (error, data) => { + if (error) { + console.log('getTargetOverlayModuleInfosByBundleName failed due to error code : ' + err.code + ' ' + 'message :' + err.message); + return; + } + console.log('overlayModuleInfo is ' + JSON.stringify(data)); + }); +} catch (error) { + console.log('getTargetOverlayModuleInfosByBundleName failed due to error code : ' + err.code + ' ' + 'message :' + err.message); +} +``` + +## overlay.getTargetOverlayModuleInfosByBundleName + +getTargetOverlayModuleInfosByBundleName(targetBundleName: string, callback: AsyncCallback\>): void; + +Obtains the information about all modules with the overlay feature in another application. This API uses an asynchronous callback to return the result. If the operation is successful, **null** is returned; otherwise, an error message is returned. + +**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**System capability**: SystemCapability.BundleManager.BundleFramework.Overlay + +**System API**: This is a system API. + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----------- | ------ | ---- | --------------------------------------- | +| targetBundleName | string | Yes | Bundle name of the application. | +| callback | AsyncCallback\> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined**; otherwise, **err** is an error object. | + +**Error codes** + +For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md). + +| ID| Error Message | +| ------ | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700002 | The specified module name is not found. | +| 17700034 | The specified module is an overlay module. | +| 17700035 | The specified bundle is an overlay bundle. | + +**Example** + +```ts +var targetBundleName = "com.example.myapplication_xxxxx"; + +try { + overlay.getTargetOverlayModuleInfosByBundleName(targetBundleName, (error, data) => { + if (error) { + console.log('getTargetOverlayModuleInfosByBundleName failed due to error code : ' + err.code + ' ' + 'message :' + err.message); + return; + } + console.log('overlayModuleInfo is ' + JSON.stringify(data)); + }); +} catch (error) { + console.log('getTargetOverlayModuleInfosByBundleName failed due to error code : ' + err.code + ' ' + 'message :' + err.message); +} +``` + +## Module with the Overlay Feature + +**Concept** +A module with the overlay feature generally provides additional resource files for modules without the overlay feature on the device, so that the target modules can use these resource files at runtime to display different colors, labels, themes, and the like. The overlay feature applies only to the stage model. + +**How do I identify a module with the overlay feature?** +If the **module.json5** file of a module contains the **targetModuleName** and **targetPriority fields** during project creation on DevEco Studio, the module is identified as a module with the overlay feature in the installation phase. diff --git a/en/application-dev/reference/apis/js-apis-pasteboard.md b/en/application-dev/reference/apis/js-apis-pasteboard.md index d1d554f677aca7fcb21d1e74cd6fb502f6e90032..600b027b296840203ff028c08d73a9e221a4c193 100644 --- a/en/application-dev/reference/apis/js-apis-pasteboard.md +++ b/en/application-dev/reference/apis/js-apis-pasteboard.md @@ -3,7 +3,7 @@ The **pasteboard** module provides the copy and paste support for the system pasteboard. You can use the APIs of this module to operate pasteboard content of the plain text, HTML, URI, Want, pixel map, and other types. > **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 @@ -63,7 +63,7 @@ Creates a **PasteData** object of a custom type. ```js let dataXml = new ArrayBuffer(256); - let pasteData = pasteboard.createData('app/xml', dataXml); +let pasteData = pasteboard.createData('app/xml', dataXml); ``` ## pasteboard.createRecord9+ @@ -90,8 +90,8 @@ Creates a **PasteDataRecord** object of the custom type. **Example** ```js - let dataXml = new ArrayBuffer(256); - let pasteDataRecord = pasteboard.createRecord('app/xml', dataXml); +let dataXml = new ArrayBuffer(256); +let pasteDataRecord = pasteboard.createRecord('app/xml', dataXml); ``` ## pasteboard.getSystemPasteboard @@ -120,11 +120,11 @@ Enumerates the paste options of data. **System capability**: SystemCapability.MiscServices.Pasteboard -| Name| Value| Description | -| ---- |---|-------------------| -| InApp | 0 | Only intra-application pasting is allowed. | -| LocalDevice | 1 | Paste is allowed in any application on the local device.| -| CrossDevice | 2 | Paste is allowed in any application across devices. | +| Name | Value| Description | +|-------------|---|-------------------| +| INAPP | 0 | Only intra-application pasting is allowed. | +| LOCALDEVICE | 1 | Paste is allowed in any application on the local device.| +| CROSSDEVICE | 2 | Paste is allowed in any application across devices. | ## pasteboard.createHtmlData(deprecated) @@ -374,14 +374,14 @@ Defines the properties of all data records on the pasteboard, including the time **System capability**: SystemCapability.MiscServices.Pasteboard -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| additions7+ | {[key:string]:object} | Yes| Yes| Additional data.| -| mimeTypes7+ | Array<string> | Yes| No| Non-repeating data types of the data records on the pasteboard.| -| tag7+ | string | Yes| Yes| Custom tag.| -| timestamp7+ | number | Yes| No| Timestamp when data is written to the pasteboard (unit: ms).| -| localOnly7+ | boolean | Yes| Yes| Whether the pasteboard content is set for local access only. The default value is **true**.
- **true**: The pasteboard content is set for local access only.
- **false**: The pasteboard content can be shared between devices.| -| shareOption9+ | [ShareOption](#shareoption9) | Yes| Yes| Where the pasteboard content can be pasted. If this attribute is set incorrectly or not set, the default value **CrossDevice** is used.| +| Name| Type| Readable| Writable| Description | +| -------- | -------- | -------- | -------- |--------------------------------------------------------------------------------------------| +| additions7+ | {[key:string]:object} | Yes| Yes| Additional data. | +| mimeTypes7+ | Array<string> | Yes| No| Non-repeating data types of the data records on the pasteboard. | +| tag7+ | string | Yes| Yes| Custom tag. | +| timestamp7+ | number | Yes| No| Timestamp when data is written to the pasteboard (unit: ms). | +| localOnly7+ | boolean | Yes| Yes| Whether the pasteboard content is for local access only. The default value is **false**. This attribute is not supported currently. You are advised to use **shareOption** instead.
- **true**: The pasteboard content is set for local access only.
- **false**: The pasteboard content can be shared between devices.| +| shareOption9+ | [ShareOption](#shareoption9) | Yes| Yes| Where the pasteboard content can be pasted. If this attribute is set incorrectly or not set, the default value **CROSSDEVICE** is used. | ## PasteDataRecord7+ @@ -401,38 +401,11 @@ Provides **PasteDataRecord** APIs. A **PasteDataRecord** is an abstract definiti | pixelMap9+ | [image.PixelMap](js-apis-image.md#pixelmap7) | Yes| No| Pixel map.| | data9+ | {[mimeType: string]: ArrayBuffer} | Yes| No| Content of custom data.| -### convertToTextV99+ - -convertToTextV9(callback: AsyncCallback<string>): void - -Forcibly converts the content in a **PasteData** object to text. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.MiscServices.Pasteboard - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<string> | Yes| Callback used to return the result. If the operation is successful, **err** is **undefined** and **data** is the text obtained from the conversion. Otherwise, **err** is error information.| - -**Example** - -```js -let record = pasteboard.createRecord(pasteboard.MIMETYPE_TEXT_URI, 'dataability:///com.example.myapplication1/user.txt'); -record.convertToTextV9((err, data) => { - if (err) { - console.error(`Failed to convert to text. Cause: ${err.message}`); - return; - } - console.info(`Succeeded in converting to text. Data: ${data}`); -}); -``` - -### convertToTextV99+ +### toPlainText9+ -convertToTextV9(): Promise<string> +toPlainText(): string -Forcibly converts the content in a **PasteData** object to text. This API uses a promise to return the result. +Forcibly converts the content in a **PasteData** object to text. **System capability**: SystemCapability.MiscServices.Pasteboard @@ -440,17 +413,14 @@ Forcibly converts the content in a **PasteData** object to text. This API uses a | Type| Description| | -------- | -------- | -| Promise<string> | Promise used to return the text obtained from the conversion.| +| string | Plain text.| **Example** ```js let record = pasteboard.createRecord(pasteboard.MIMETYPE_TEXT_URI, 'dataability:///com.example.myapplication1/user.txt'); -record.convertToTextV9().then((data) => { - console.info(`Succeeded in converting to text. Data: ${data}`); -}).catch((err) => { - console.error(`Failed to convert to text. Cause: ${err.message}`); -}); +let data = record.toPlainText(); +console.info(`Succeeded in converting to text. Data: ${data}`); ``` ### convertToText(deprecated) @@ -460,7 +430,7 @@ convertToText(callback: AsyncCallback<string>): void Forcibly converts the content in a **PasteData** object to text. This API uses an asynchronous callback to return the result. > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [convertToTextV9](#converttotextv99). +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [toPlainText](#toplaintext9). **System capability**: SystemCapability.MiscServices.Pasteboard @@ -474,8 +444,8 @@ Forcibly converts the content in a **PasteData** object to text. This API uses a ```js let record = pasteboard.createUriRecord('dataability:///com.example.myapplication1/user.txt'); -record.convertToText((err, data) => { - if (err) { +record.convertToText((err, data) => { + if (err) { console.error(`Failed to convert to text. Cause: ${err.message}`); return; } @@ -490,7 +460,7 @@ convertToText(): Promise<string> Forcibly converts the content in a **PasteData** object to text. This API uses a promise to return the result. > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [convertToTextV9](#converttotextv99-1). +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [toPlainText](#toplaintext9). **System capability**: SystemCapability.MiscServices.Pasteboard @@ -636,7 +606,7 @@ let opt = { scaleMode: 1 }; image.createPixelMap(buffer, opt).then((pixelMap) => { - let pasteData = pasteboard.createData(MIMETYPE_PIXELMAP, pixelMap); + let pasteData = pasteboard.createData(pasteboard.MIMETYPE_PIXELMAP, pixelMap); let PixelMap = pasteData.getPrimaryPixelMap(); }); ``` @@ -782,7 +752,7 @@ Sets the property (attributes) for the pasteboard data. Currently, only the **sh ```js let pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_HTML, 'application/xml'); let prop = pasteData.getProperty(); -prop.shareOption = pasteboard.ShareOption.InApp; +prop.shareOption = pasteboard.ShareOption.INAPP; pasteData.setProperty(prop); ``` @@ -812,7 +782,7 @@ For details about the error codes, see [Pasteboard Error Codes](../errorcodes/er | Error Code ID| Error Message| | -------- | -------- | -| 12900001 | The index is out of range. | +| 12900001 | The index is out of the record. | **Example** @@ -910,7 +880,7 @@ For details about the error codes, see [Pasteboard Error Codes](../errorcodes/er | Error Code ID| Error Message| | -------- | -------- | -| 12900001 | The index is out of range. | +| 12900001 | The index is out of the record. | **Example** @@ -940,7 +910,7 @@ For details about the error codes, see [Pasteboard Error Codes](../errorcodes/er | Error Code ID| Error Message| | -------- | -------- | -| 12900001 | The index is out of range. | +| 12900001 | The index is out of the record. | **Example** @@ -999,8 +969,8 @@ The pasteboard supports a maximum number of 512 data records. ```js let pasteData = pasteboard.createPlainTextData('hello'); -let object = { - bundleName: "com.example.aafwk.test", +let object = { + bundleName: "com.example.aafwk.test", abilityName: "com.example.aafwk.test.TwoAbility" }; pasteData.addWantRecord(object); @@ -1222,10 +1192,10 @@ Unsubscribes from the system pasteboard content change event. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Event type. The value **'update'** indicates changes in the pasteboard content.| -| callback | function | No| Callback invoked when the pasteboard content changes.| +| Name| Type| Mandatory| Description | +| -------- | -------- | -------- |---------------------------------------------------------| +| type | string | Yes| Event type. The value **'update'** indicates changes in the pasteboard content. | +| callback | function | No| Callback invoked when the pasteboard content changes. If this parameter is not specified, listening will be disabled for all callbacks registered by the current application.| **Example** @@ -1255,7 +1225,7 @@ Clears the system pasteboard. This API uses an asynchronous callback to return t ```js let systemPasteboard = pasteboard.getSystemPasteboard(); -systemPasteboard.clearData((err, data) => { +systemPasteboard.clearData((err, data) => { if (err) { console.error(`Failed to clear the pasteboard. Cause: ${err.message}`); return; @@ -1282,7 +1252,7 @@ Clears the system pasteboard. This API uses a promise to return the result. ```js let systemPasteboard = pasteboard.getSystemPasteboard(); -systemPasteboard.clearData().then((data) => { +systemPasteboard.clearData().then((data) => { console.info('Succeeded in clearing the pasteboard.'); }).catch((err) => { console.error(`Failed to clear the pasteboard. Cause: ${err.message}`); @@ -1318,7 +1288,7 @@ For details about the error codes, see [Pasteboard Error Codes](../errorcodes/er ```js let pasteData = pasteboard.createPlainTextData('content'); let systemPasteboard = pasteboard.getSystemPasteboard(); -systemPasteboard.setData(pasteData, (err, data) => { +systemPasteboard.setData(pasteData, (err, data) => { if (err) { console.error('Failed to set PasteData. Cause: ' + err.message); return; @@ -1394,7 +1364,7 @@ For details about the error codes, see [Pasteboard Error Codes](../errorcodes/er ```js let systemPasteboard = pasteboard.getSystemPasteboard(); -systemPasteboard.getData((err, pasteData) => { +systemPasteboard.getData((err, pasteData) => { if (err) { console.error('Failed to get PasteData. Cause: ' + err.message); return; @@ -1429,7 +1399,7 @@ For details about the error codes, see [Pasteboard Error Codes](../errorcodes/er ```js let systemPasteboard = pasteboard.getSystemPasteboard(); -systemPasteboard.getData().then((pasteData) => { +systemPasteboard.getData().then((pasteData) => { let text = pasteData.getPrimaryText(); }).catch((err) => { console.error('Failed to get PasteData. Cause: ' + err.message); @@ -1481,7 +1451,7 @@ Checks whether the system pasteboard contains data. This API uses a promise to r ```js let systemPasteboard = pasteboard.getSystemPasteboard(); -systemPasteboard.hasData().then((data) => { +systemPasteboard.hasData().then((data) => { console.info(`Succeeded in checking the PasteData. Data: ${data}`); }).catch((err) => { console.error(`Failed to check the PasteData. Cause: ${err.message}`); @@ -1508,8 +1478,8 @@ Clears the system pasteboard. This API uses an asynchronous callback to return t **Example** ```js -systemPasteboard.clear((err, data) => { - if (err) { +systemPasteboard.clear((err, data) => { + if (err) { console.error(`Failed to clear the PasteData. Cause: ${err.message}`); return; } @@ -1537,9 +1507,9 @@ Clears the system pasteboard. This API uses a promise to return the result. **Example** ```js -systemPasteboard.clear().then((data) => { +systemPasteboard.clear().then((data) => { console.info('Succeeded in clearing the PasteData.'); -}).catch((err) => { +}).catch((err) => { console.error(`Failed to clear the PasteData. Cause: ${err.message}`); }); ``` @@ -1595,7 +1565,7 @@ Obtains a **PasteData** object from the pasteboard. This API uses a promise to r ```js let systemPasteboard = pasteboard.getSystemPasteboard(); -systemPasteboard.getPasteData().then((pasteData) => { +systemPasteboard.getPasteData().then((pasteData) => { let text = pasteData.getPrimaryText(); }).catch((err) => { console.error('Failed to get PasteData. Cause: ' + err.message); @@ -1651,7 +1621,7 @@ Checks whether the system pasteboard contains data. This API uses a promise to r **Example** ```js -systemPasteboard.hasPasteData().then((data) => { +systemPasteboard.hasPasteData().then((data) => { console.info(`Succeeded in checking the PasteData. Data: ${data}`); }).catch((err) => { console.error(`Failed to check the PasteData. Cause: ${err.message}`); @@ -1681,7 +1651,7 @@ Writes a **PasteData** object to the pasteboard. This API uses an asynchronous c ```js let pasteData = pasteboard.createPlainTextData('content'); let systemPasteboard = pasteboard.getSystemPasteboard(); -systemPasteboard.setPasteData(pasteData, (err, data) => { +systemPasteboard.setPasteData(pasteData, (err, data) => { if (err) { console.error('Failed to set PasteData. Cause: ' + err.message); return; diff --git a/en/application-dev/reference/apis/js-apis-permissionrequestresult.md b/en/application-dev/reference/apis/js-apis-permissionrequestresult.md index 0a0a8ec3833247e78fe5ea513ab7d9383ebe92ac..eae4b4a3970507756fab9b96ff76b93b77154ca2 100644 --- a/en/application-dev/reference/apis/js-apis-permissionrequestresult.md +++ b/en/application-dev/reference/apis/js-apis-permissionrequestresult.md @@ -4,8 +4,8 @@ The **PermissionRequestResult** module defines the result of a permission reques > **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 can be used only in the stage model. +> - 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 can be used only in the stage model. ## Attributes @@ -14,7 +14,7 @@ The **PermissionRequestResult** module defines the result of a permission reques | Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | | permissions | Array<string> | Yes| No| Permissions requested.| -| authResults | Array<number> | Yes| No|Result of the permission Request.
**-1**: The permission has been set and no dialog box will be displayed. Users can modify the permission in **Settings**.
**0**: No operation is required.
**1**: Dynamic user authorization is required via a dialog window .
**2**: The request is invalid. Possible causes are as follows:
- The permission is not declared in the configuration file.
- The permission name is invalid.
- Special conditions for applying for the permission do not satisfied. See [ohos.permission.LOCATION](../../security/permission-list.md#ohospermissionlocation) and [ohos.permission.APPROXIMATELY_LOCATION](../../security/permission-list.md#ohospermissionapproximately_location).| +| authResults | Array<number> | Yes| No| Result of the permission request.
- **-1**: The permission is not authorized and must be set in **Settings** without displaying a dialog box.
- **0**: The permission is authorized.
- **2**: The permission is not authorized due to an invalid request. The possible causes are as follows:
- The permission is not declared in the configuration file.
- The permission name is invalid.
- Special conditions for applying for the permission are not satisfied. See [ohos.permission.LOCATION](../../security/permission-list.md#ohospermissionlocation) and [ohos.permission.APPROXIMATELY_LOCATION](../../security/permission-list.md#ohospermissionapproximately_location).| ## Usage diff --git a/en/application-dev/reference/apis/js-apis-plugincomponent.md b/en/application-dev/reference/apis/js-apis-plugincomponent.md new file mode 100644 index 0000000000000000000000000000000000000000..740fd72e50247da5bdae3b573c1e115c8cdcd0e5 --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-plugincomponent.md @@ -0,0 +1,400 @@ +# @ohos.pluginComponent (PluginComponentManager) + +The **PluginComponentManager** module provides APIs for the **PluginComponent** user to request components and data and send component templates and data. For details about how to display the **PluginComponent** template, see [PluginComponent](../arkui-ts/ts-basic-components-plugincomponent.md). + +> **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 pluginComponentManager from '@ohos.pluginComponent' +``` + +## PluginComponentTemplate + +Describes the **PluginComponent** template parameters. + +**System capability**: SystemCapability.ArkUI.ArkUI.Full + +| Name | Type | Mandatory| Description | +| ---------- | ------ | ---- | --------------------------- | +| source | string | Yes | Component template name. | +| bundleName | string | Yes | Bundle name of the provider ability.| + + +## PluginComponentManager + +### KVObject + +Stores information in key-value pairs in JSON format. + +**System capability**: SystemCapability.ArkUI.ArkUI.Full + + +| Value Range | Description | +| --------------------- | ---------------------------------------- | +| [key: string] | Keyword. The value is a string and can be an empty string.| +| number | Key value of the number type. | +| string | Key value of the string type. The value can be an empty string.| +| boolean | Key value of the Boolean type. | +| [] | Key value. The value can be []. | +| [KVObject](#kvobject) | Key value of the KVObject type. | + + +### PushParameters + +Sets the parameters to be passed in the **PluginManager.Push** API in the FA model. + +**Model restriction**: This API can be used only in the FA model. + +**System capability**: SystemCapability.ArkUI.ArkUI.Full + +| Name | Type | Mandatory| Description | +| --------- | ----------------------------------- | ---- | -------------------------------------------------------------- | +| want | [Want](js-apis-application-want.md) | Yes | Ability information of the component user. | +| name | string | Yes | Component name. | +| data | [KVObject](#kvobject) | No | Component data value. | +| extraData | [KVObject](#kvobject) | No | Additional data value. | +| jsonPath | string | No | Path to the [external.json](#about-the-externaljson-file) file that stores the template path.| + +### PushParameterForStage + +Sets the parameters to be passed in the **PluginManager.Push** API in the stage model. + +**Model restriction**: This API can be used only in the stage model. + +**System API**: This is a system API. + +**System capability**: SystemCapability.ArkUI.ArkUI.Full + +| Name | Type | Mandatory| Description | +| --------- | ----------------------------------- | ---- | ---------------------------------------------------------------- | +| owner | [Want](js-apis-application-want.md) | Yes | Ability information of the component provider. | +| target | [Want](js-apis-application-want.md) | Yes | Ability information of the component user. | +| name | string | Yes | Component name. | +| data | [KVObject](#kvobject) | No | Component data value. | +| extraData | [KVObject](#kvobject) | No | Additional data value. | +| jsonPath | string | No | Path to the [external.json](#about-the-externaljson-file) file that stores the template path.| + +### RequestParameters + +Sets the parameters to be passed in the **PluginManager.Request** API in the FA model. + +**Model restriction**: This API can be used only in the FA model. + +**System capability**: SystemCapability.ArkUI.ArkUI.Full + +| Name | Type | Mandatory| Description | +| -------- | ----------------------------------- | ---- | --------------------------------------------------------------------------------------------------------------------- | +| want | [Want](js-apis-application-want.md) | Yes | Ability information of the component provider. | +| name | string | Yes | Name of the requested component. | +| data | [KVObject](#kvobject) | Yes | Additional data. | +| jsonPath | string | No | Path to the [external.json](#about-the-externaljson-file) file that stores the template path. Request communication is not triggered when **jsonPath** is not empty or not set.| + +### RequestParameterForStage + +Sets the parameters to be passed in the **PluginManager.Request** API in the stage model. + +**System API**: This is a system API. + +**Model restriction**: This API can be used only in the stage model. + +**System capability**: SystemCapability.ArkUI.ArkUI.Full + +| Name | Type | Mandatory| Description | +| -------- | ----------------------------------- | ---- | --------------------------------------------------------------------------------------------------------------------- | +| owner | [Want](js-apis-application-want.md) | Yes | Ability information of the component user. | +| target | [Want](js-apis-application-want.md) | Yes | Ability information of the component provider. | +| name | string | Yes | Name of the requested component. | +| data | [KVObject](#kvobject) | Yes | Additional data. | +| jsonPath | string | No | Path to the [external.json](#about-the-externaljson-file) file that stores the template path. Request communication is not triggered when **jsonPath** is not empty or not set.| + +### RequestCallbackParameters + +Provides the result returned after the **PluginManager.Request** API is called. + +**System capability**: SystemCapability.ArkUI.ArkUI.Full + +| Name | Type | Mandatory| Description | +| ----------------- | ---------------------------------------------------- | ---- | ---------- | +| componentTemplate | [PluginComponentTemplate](#plugincomponenttemplate)] | Yes | Component template.| +| data | [KVObject](#kvobject) | Yes | Component data.| +| extraData | [KVObject](#kvobject) | Yes | Additional data.| + +### RequestEventResult + +Provides the result returned after the request listener is registered and the requested event is received. + +**System capability**: SystemCapability.ArkUI.ArkUI.Full + +| Name | Type | Mandatory| Description | +| --------- | --------------------- | ---- | ---------- | +| template | string | No | Component template.| +| data | [KVObject](#kvobject) | No | Component data.| +| extraData | [KVObject](#kvobject) | No | Additional data.| + +### OnPushEventCallback + +OnPushEventCallback = (source: Want, template: PluginComponentTemplate, data: KVObject, + extraData: KVObject) => void + +Registers the listener for the push event. + +**Parameters** + +| Name | Type | Mandatory| Description | +| --------- | --------------------------------------------------- | ---- | ---------------------------------------- | +| source | [Want](js-apis-application-want.md) | Yes | Information about the push request sender. | +| template | [PluginComponentTemplate](#plugincomponenttemplate) | Yes | Name of the request component template for the push request sender.| +| data | [KVObject](#kvobject) | Yes | Data. | +| extraData | [KVObject](#kvobject) | Yes | Additional data. | + +**Example** + +```js +function onPushListener(source, template, data, extraData) { + console.log("onPushListener template.source=" + template.source) + console.log("onPushListener source=" + JSON.stringify(source)) + console.log("onPushListener template=" + JSON.stringify(template)) + console.log("onPushListener data=" + JSON.stringify(data)) + console.log("onPushListener extraData=" + JSON.stringify(extraData)) +} +``` + + +### OnRequestEventCallback + +OnRequestEventCallback = (source: Want, name: string, data: KVObject) => RequestEventResult + +Registers the listener for the request event. + +**Parameters** + +| Name | Type | Mandatory| Description | +| --------- | ----------------------------------- | ---- | --------------------------- | +| source | [Want](js-apis-application-want.md) | Yes | Information about the request sender.| +| data | [KVObject](#kvobject) | Yes | Data. | +| extraData | [KVObject](#kvobject) | Yes | Additional data. | + +**Example** + +```js +function onRequestListener(source, name, data) +{ + console.error("onRequestListener"); + console.log("onRequestListener source=" + JSON.stringify(source)); + console.log("onRequestListener name=" + name); + console.log("onRequestListener data=" + JSON.stringify(data)); + + return {template:"ets/pages/plugin.js", data:data}; +} +``` + +### push + +push(param: PushParameters , callback: AsyncCallback<void>): void + +Pushes the component and data to the component user. + +**Model restriction**: This API can be used only in the FA model. + +**Parameters** +| Name | Type | Mandatory| Description | +| -------- | --------------------------------- | ---- | ------------------------ | +| param | [PushParameters](#pushparameters) | Yes | Information about the component user. | +| callback | AsyncCallback<void> | Yes | Asynchronous callback used to return the result.| + +**Example** + +```js +pluginComponentManager.push( +{ + want: { + bundleName: "com.example.provider", + abilityName: "com.example.provider.MainAbility", + }, + name: "plugintemplate", + data: { + "key_1": "plugin component test", + "key_2": 34234 + }, + extraData: { + "extra_str": "this is push event" + }, + jsonPath: "", + }, + (err, data) => { + console.log("push_callback: push ok!"); + } +) +``` + +### push + +push(param: PushParameterForStage, callback: AsyncCallback<void>): void + +Pushes the component and data to the component user. + +**System API**: This is a system API. + +**Model restriction**: This API can be used only in the stage model. + +**Parameters** +| Name | Type | Mandatory| Description | +| -------- | ----------------------------------------------- | ---- | ------------------------ | +| param | [PushParameterForStage](#pushparameterforstage) | Yes | Information about the component user. | +| callback | AsyncCallback<void> | Yes | Asynchronous callback used to return the result.| + +**Example** + +```js +pluginComponentManager.push( + { + owner:{ + bundleName:"com.example.provider", + abilityName:"com.example.provider.MainAbility" + }, + target: { + bundleName: "com.example.provider", + abilityName: "com.example.provider.MainAbility", + }, + name: "ets/pages/plugin2.js", + data: { + "js": "ets/pages/plugin.js", + "key_1": 1111, , + }, + extraData: { + "extra_str": "this is push event" + }, + jsonPath: "", + }, + (err, data) => { + console.log("push_callback:err: " ,JSON.stringify(err)); + console.log("push_callback:data: " , JSON.stringify(data)); + console.log("push_callback: push ok!"); + } +) +``` + + +### request + +request(param: RequestParameters, callback: AsyncCallback<RequestCallbackParameters>): void + +Requests the component from the component provider. + +**Model restriction**: This API can be used only in the FA model. + + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------------------------------------------------------------------------------- | ---- | ---------------------------------------------------------------- | +| param | [RequestParameters](#requestparameters) | Yes | Information about the component request. | +| callback | AsyncCallback<[RequestCallbackParameters](#requestcallbackparameters) \| void> | Yes | Asynchronous callback used to return the requested data.| + +**Example** + +```js +pluginComponentManager.request( + { + want: { + bundleName: "com.example.provider", + abilityName: "com.example.provider.MainAbility", + }, + name: "plugintemplate", + data: { + "key_1": "plugin component test", + "key_2": 1111111 + }, + jsonPath: "", + }, + (err, data) => { + console.log("request_callback: componentTemplate.ability=" + data.componentTemplate.ability) + console.log("request_callback: componentTemplate.source=" + data.componentTemplate.source) + console.log("request_callback: data=" + JSON.stringify(data.data)) + console.log("request_callback: extraData=" + JSON.stringify(data.extraData)) + } +) +``` + + +### request + +request(param: RequestParameterForStage, callback: AsyncCallback<RequestCallbackParameters>): void + +Requests the component from the component provider. + +**System API**: This is a system API. + +**Model restriction**: This API can be used only in the stage model. + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------------------------------------------------------------------------------- | ---- | ---------------------------------------------------------------- | +| param | [RequestParameterForStage](#requestparameterforstage) | Yes | Information about the component request. | +| callback | AsyncCallback<[RequestCallbackParameters](#requestcallbackparameters) \| void> | Yes | Asynchronous callback used to return the requested data.| + +**Example** + +```js +pluginComponentManager.request( + { + owner:{ + bundleName:"com.example.provider", + abilityName:"com.example.provider.MainAbility" + }, + target: { + bundleName: "com.example.provider", + abilityName: "ets/pages/plugin2.js", + }, + name: "plugintemplate", + data: { + "key_1": " myapplication plugin component test", + }, + jsonPath: "", + }, + (err, data) => { + console.log("request_callback: componentTemplate.ability=" + data.componentTemplate.ability) + console.log("request_callback: componentTemplate.source=" + data.componentTemplate.source) + } +) +``` + +### on + +on(eventType: string, callback: OnPushEventCallback | OnRequestEventCallback ): void + +Listens for events of the request type and returns the requested data, or listens for events of the push type and receives the data pushed by the provider. + +**Parameters** + +| Name | Type | Mandatory| Description | +| --------- | ---------------------------------------------------------------------------------------------------------- | ---- | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| eventType | string | Yes | Type of the event to listen for. The options are as follows:
**"push"**: The component provider pushes data to the component consumer.
**"request"**: The component consumer proactively requests data from the component provider. | +| callback | [OnPushEventCallback](#onpusheventcallback) \| [OnRequestEventCallback](#onrequesteventcallback) | Yes | Callback used to return the result. The type is [OnPushEventCallback](#onpusheventcallback) for the push event and [OnRequestEventCallback](#onrequesteventcallback) for the request event.| + + +**Example** + +```js + pluginComponentManager.on("push", onPushListener) + pluginComponentManager.on("request", onRequestListener) +``` + +## About the external.json File + +The **external.json** file is created by developers. It stores component names and template paths in key-value pairs. The component name is used as the keyword, and the corresponding template path is used as the value. + +**Example** + +```json +{ + "PluginProviderExample": "ets/pages/PluginProviderExample.js", + "plugintemplate2": "ets/pages/plugintemplate2.js" +} + +``` \ No newline at end of file diff --git a/en/application-dev/reference/apis/js-apis-pointer.md b/en/application-dev/reference/apis/js-apis-pointer.md index 8ed463d9a5bbbeb6ca8e12212e256e6a4ae3fbec..49ed81e115de6345453c93441b68cda2a132021b 100644 --- a/en/application-dev/reference/apis/js-apis-pointer.md +++ b/en/application-dev/reference/apis/js-apis-pointer.md @@ -2,7 +2,8 @@ The **pointer** module provides APIs related to pointer attribute management. -> **NOTE**
+> **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 @@ -237,6 +238,8 @@ Obtains the mouse movement speed. This API uses a promise to return the result. **System capability**: SystemCapability.MultimodalInput.Input.Pointer +**System API**: This is a system API. + **Return value** | Name | Description | @@ -263,8 +266,6 @@ Obtains the mouse pointer style. This API uses an asynchronous callback to retur **System capability**: SystemCapability.MultimodalInput.Input.Pointer -**System API**: This is a system API. - **Parameters** | Name | Type | Mandatory | Description | @@ -277,21 +278,23 @@ Obtains the mouse pointer style. This API uses an asynchronous callback to retur ```js import window from '@ohos.window'; -window.getTopWindow((error, win) => { - win.getWindowProperties((error, properties) => { - let windowId = properties.id; - if (windowId < 0) { - console.log(`Invalid windowId`); - return; - } - try { - pointer.getPointerStyle(windowId, (error, style) => { - console.log(`Get pointer style success, style: ${JSON.stringify(style)}`); - }); - } catch (error) { - console.log(`Get pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`); - } - }); +window.getLastWindow(this.context, (error, win) => { + if (error.code) { + console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error)); + return; + } + let windowId = win.getWindowProperties().id; + if (windowId < 0) { + console.log(`Invalid windowId`); + return; + } + try { + pointer.getPointerStyle(windowId, (error, style) => { + console.log(`Get pointer style success, style: ${JSON.stringify(style)}`); + }); + } catch (error) { + console.log(`Get pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } }); ``` @@ -320,21 +323,23 @@ Obtains the mouse pointer style. This API uses a promise to return the result. ```js import window from '@ohos.window'; -window.getTopWindow((error, win) => { - win.getWindowProperties((error, properties) => { - let windowId = properties.id; - if (windowId < 0) { - console.log(`Invalid windowId`); - return; - } - try { - pointer.getPointerStyle(windowId).then((style) => { - console.log(`Get pointer style success, style: ${JSON.stringify(style)}`); - }); - } catch (error) { - console.log(`Get pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`); - } - }); +window.getLastWindow(this.context, (error, win) => { + if (error.code) { + console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error)); + return; + } + let windowId = win.getWindowProperties().id; + if (windowId < 0) { + console.log(`Invalid windowId`); + return; + } + try { + pointer.getPointerStyle(windowId).then((style) => { + console.log(`Get pointer style success, style: ${JSON.stringify(style)}`); + }); + } catch (error) { + console.log(`Get pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } }); ``` @@ -359,21 +364,23 @@ Sets the mouse pointer style. This API uses an asynchronous callback to return t ```js import window from '@ohos.window'; -window.getTopWindow((error, win) => { - win.getWindowProperties((error, properties) => { - let windowId = properties.id; - if (windowId < 0) { - console.log(`Invalid windowId`); - return; - } - try { - pointer.setPointerStyle(windowId, pointer.PointerStyle.CROSS, error => { - console.log(`Set pointer style success`); - }); - } catch (error) { - console.log(`Set pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`); - } - }); +window.getLastWindow(this.context, (error, win) => { + if (error.code) { + console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error)); + return; + } + let windowId = win.getWindowProperties().id; + if (windowId < 0) { + console.log(`Invalid windowId`); + return; + } + try { + pointer.setPointerStyle(windowId, pointer.PointerStyle.CROSS, error => { + console.log(`Set pointer style success`); + }); + } catch (error) { + console.log(`Set pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } }); ``` ## pointer.setPointerStyle9+ @@ -397,21 +404,23 @@ Sets the mouse pointer style. This API uses a promise to return the result. ```js import window from '@ohos.window'; -window.getTopWindow((error, win) => { - win.getWindowProperties((error, properties) => { - let windowId = properties.id; - if (windowId < 0) { - console.log(`Invalid windowId`); - return; - } - try { - pointer.setPointerStyle(windowId, pointer.PointerStyle.CROSS).then(() => { - console.log(`Set pointer style success`); - }); - } catch (error) { - console.log(`Set pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`); - } - }); +window.getLastWindow(this.context, (error, win) => { + if (error.code) { + console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error)); + return; + } + let windowId = win.getWindowProperties().id; + if (windowId < 0) { + console.log(`Invalid windowId`); + return; + } + try { + pointer.setPointerStyle(windowId, pointer.PointerStyle.CROSS).then(() => { + console.log(`Set pointer style success`); + }); + } catch (error) { + console.log(`Set pointer style failed, error: ${JSON.stringify(error, [`code`, `message`])}`); + } }); ``` ## PointerStyle9+ @@ -420,44 +429,44 @@ Enumerates mouse pointer styles. **System capability**: SystemCapability.MultimodalInput.Input.Pointer -| Name | Value | Description | -| -------------------------------- | ---- | ------ | -| DEFAULT | 0 | Default | -| EAST | 1 | East arrow | -| WEST | 2 | West arrow | -| SOUTH | 3 | South arrow | -| NORTH | 4 | North arrow | -| WEST_EAST | 5 | West-east arrow | -| NORTH_SOUTH | 6 | North-south arrow | -| NORTH_EAST | 7 | North-east arrow | -| NORTH_WEST | 8 | North-west arrow | -| SOUTH_EAST | 9 | South-east arrow | -| SOUTH_WEST | 10 | South-west arrow | -| NORTH_EAST_SOUTH_WEST | 11 | North-east and south-west adjustment| -| NORTH_WEST_SOUTH_EAST | 12 | North-west and south-east adjustment| -| CROSS | 13 | Cross (accurate selection) | -| CURSOR_COPY | 14 | Copy cursor | -| CURSOR_FORBID | 15 | Forbid cursor | -| COLOR_SUCKER | 16 | Sucker | -| HAND_GRABBING | 17 | Grabbing hand | -| HAND_OPEN | 18 | Opening hand | -| HAND_POINTING | 19 | Hand-shaped pointer | -| HELP | 20 | Help | -| MOVE | 21 | Move | -| RESIZE_LEFT_RIGHT | 22 | Left and right resizing| -| RESIZE_UP_DOWN | 23 | Up and down resizing| -| SCREENSHOT_CHOOSE | 24 | Screenshot crosshair| -| SCREENSHOT_CURSOR | 25 | Screenshot cursor | -| TEXT_CURSOR | 26 | Text cursor | -| ZOOM_IN | 27 | Zoom in | -| ZOOM_OUT | 28 | Zoom out | -| MIDDLE_BTN_EAST | 29 | Scrolling east | -| MIDDLE_BTN_WEST | 30 | Scrolling west | -| MIDDLE_BTN_SOUTH | 31 | Scrolling south | -| MIDDLE_BTN_NORTH | 32 | Scrolling north | -| MIDDLE_BTN_NORTH_SOUTH | 33 | Scrolling north-south | -| MIDDLE_BTN_NORTH_EAST | 34 | Scrolling north-east | -| MIDDLE_BTN_NORTH_WEST | 35 | Scrolling north-west | -| MIDDLE_BTN_SOUTH_EAST | 36 | Scrolling south-east | -| MIDDLE_BTN_SOUTH_WEST | 37 | Scrolling south-west | -| MIDDLE_BTN_NORTH_SOUTH_WEST_EAST | 38 | Moving as a cone in four directions| +| Name | Value | Description |Legend| +| -------------------------------- | ---- | ------ |------ | +| DEFAULT | 0 | Default |![Default.png](./figures/Default.png)| +| EAST | 1 | East arrow |![East.png](./figures/East.png)| +| WEST | 2 | West arrow |![West.png](./figures/West.png)| +| SOUTH | 3 | South arrow |![South.png](./figures/South.png)| +| NORTH | 4 | North arrow |![North.png](./figures/North.png)| +| WEST_EAST | 5 | West-east arrow |![West_East.png](./figures/West_East.png)| +| NORTH_SOUTH | 6 | North-south arrow |![North_South.png](./figures/North_South.png)| +| NORTH_EAST | 7 | North-east arrow |![North_East.png](./figures/North_East.png)| +| NORTH_WEST | 8 | North-west arrow |![North_West.png](./figures/North_West.png)| +| SOUTH_EAST | 9 | South-east arrow |![South_East.png](./figures/South_East.png)| +| SOUTH_WEST | 10 | South-west arrow |![South_West.png](./figures/South_West.png)| +| NORTH_EAST_SOUTH_WEST | 11 | North-east and south-west adjustment|![North_East_South_West.png](./figures/North_East_South_West.png)| +| NORTH_WEST_SOUTH_EAST | 12 | North-west and south-east adjustment|![North_West_South_East.png](./figures/North_West_South_East.png)| +| CROSS | 13 | Cross (accurate selection) |![Cross.png](./figures/Cross.png)| +| CURSOR_COPY | 14 | Copy cursor |![Copy.png](./figures/Copy.png)| +| CURSOR_FORBID | 15 | Forbid cursor |![Forbid.png](./figures/Forbid.png)| +| COLOR_SUCKER | 16 | Sucker |![Colorsucker.png](./figures/Colorsucker.png)| +| HAND_GRABBING | 17 | Grabbing hand |![Hand_Grabbing.png](./figures/Hand_Grabbing.png)| +| HAND_OPEN | 18 | Opening hand |![Hand_Open.png](./figures/Hand_Open.png)| +| HAND_POINTING | 19 | Hand-shaped pointer |![Hand_Poniting.png](./figures/Hand_Pointing.png)| +| HELP | 20 | Help |![Help.png](./figures/Help.png)| +| MOVE | 21 | Move |![Move.png](./figures/Move.png)| +| RESIZE_LEFT_RIGHT | 22 | Left and right resizing|![Resize_Left_Right.png](./figures/Resize_Left_Right.png)| +| RESIZE_UP_DOWN | 23 | Up and down resizing|![Resize_Up_Down.png](./figures/Resize_Up_Down.png)| +| SCREENSHOT_CHOOSE | 24 | Screenshot crosshair|![Screenshot_Cross.png](./figures/Screenshot_Cross.png)| +| SCREENSHOT_CURSOR | 25 | Screenshot cursor |![Screenshot_Cursor.png](./figures/Screenshot_Cursor.png)| +| TEXT_CURSOR | 26 | Text cursor |![Text_Cursor.png](./figures/Text_Cursor.png)| +| ZOOM_IN | 27 | Zoom in |![Zoom_In.png](./figures/Zoom_In.png)| +| ZOOM_OUT | 28 | Zoom out |![Zoom_Out.png](./figures/Zoom_Out.png)| +| MIDDLE_BTN_EAST | 29 | Scrolling east |![MID_Btn_East.png](./figures/MID_Btn_East.png)| +| MIDDLE_BTN_WEST | 30 | Scrolling west |![MID_Btn_West.png](./figures/MID_Btn_West.png)| +| MIDDLE_BTN_SOUTH | 31 | Scrolling south | ![MID_Btn_South.png](./figures/MID_Btn_South.png) | +| MIDDLE_BTN_NORTH | 32 | Scrolling north |![MID_Btn_North.png](./figures/MID_Btn_North.png)| +| MIDDLE_BTN_NORTH_SOUTH | 33 | Scrolling north-south |![MID_Btn_North_South.png](./figures/MID_Btn_North_South.png)| +| MIDDLE_BTN_NORTH_EAST | 34 | Scrolling north-east |![MID_Btn_North_East.png](./figures/MID_Btn_North_East.png)| +| MIDDLE_BTN_NORTH_WEST | 35 | Scrolling north-west |![MID_Btn_North_West.png](./figures/MID_Btn_North_West.png)| +| MIDDLE_BTN_SOUTH_EAST | 36 | Scrolling south-east |![MID_Btn_South_East.png](./figures/MID_Btn_South_East.png)| +| MIDDLE_BTN_SOUTH_WEST | 37 | Scrolling south-west |![MID_Btn_South_West.png](./figures/MID_Btn_South_West.png)| +| MIDDLE_BTN_NORTH_SOUTH_WEST_EAST | 38 | Moving as a cone in four directions|![MID_Btn_North_South_West_East.png](./figures/MID_Btn_North_South_West_East.png)| diff --git a/en/application-dev/reference/apis/js-apis-power.md b/en/application-dev/reference/apis/js-apis-power.md index e8215f250a75223b6bb16024dea6a153adf71fd5..f98e56905a7671f4b0a0cb616d6ab64c198116f7 100644 --- a/en/application-dev/reference/apis/js-apis-power.md +++ b/en/application-dev/reference/apis/js-apis-power.md @@ -1,8 +1,9 @@ -# @ohos.power (System Power Management) +# @ohos.power (Power Manager) The **power** module provides APIs for rebooting and shutting down the system, as well as querying the screen status. -> **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. ## Modules to Import @@ -33,7 +34,7 @@ Shuts down the system. For details about the error codes, see [Power Manager Error Codes](../errorcodes/errorcode-power.md). -| Code | Error Message | +| ID | Error Message | |---------|---------| | 4900101 | Operation failed. Cannot connect to service.| @@ -69,7 +70,7 @@ Reboots the system. For details about the error codes, see [Power Manager Error Codes](../errorcodes/errorcode-power.md). -| Code | Error Message | +| ID | Error Message | |---------|---------| | 4900101 | Operation failed. Cannot connect to service.| @@ -95,7 +96,7 @@ Checks whether the current device is active. In the active state, the screen is For details about the error codes, see [Power Manager Error Codes](../errorcodes/errorcode-power.md). -| Code | Error Message | +| ID | Error Message | |---------|---------| | 4900101 | Operation failed. Cannot connect to service.| @@ -130,7 +131,7 @@ Wakes up a device. For details about the error codes, see [Power Manager Error Codes](../errorcodes/errorcode-power.md). -| Code | Error Message | +| ID | Error Message | |---------|---------| | 4900101 | Operation failed. Cannot connect to service.| @@ -158,7 +159,7 @@ Hibernates a device. For details about the error codes, see [Power Manager Error Codes](../errorcodes/errorcode-power.md). -| Code | Error Message | +| ID | Error Message | |---------|---------| | 4900101 | Operation failed. Cannot connect to service.| @@ -190,7 +191,7 @@ Obtains the power mode of this device. For details about the error codes, see [Power Manager Error Codes](../errorcodes/errorcode-power.md). -| Code | Error Message | +| ID | Error Message | |---------|---------| | 4900101 | Operation failed. Cannot connect to service.| @@ -228,7 +229,7 @@ Sets the power mode of this device. This API uses an asynchronous callback to re For details about the error codes, see [Power Manager Error Codes](../errorcodes/errorcode-power.md). -| Code | Error Message | +| ID | Error Message | |---------|---------| | 4900101 | Operation failed. Cannot connect to service.| @@ -272,7 +273,7 @@ Sets the power mode of this device. This API uses a promise to return the result For details about the error codes, see [Power Manager Error Codes](../errorcodes/errorcode-power.md). -| Code | Error Message | +| ID | Error Message | |---------|---------| | 4900101 | Operation failed. Cannot connect to service.| @@ -292,8 +293,7 @@ power.setPowerMode(power.DevicePowerMode.MODE_PERFORMANCE) rebootDevice(reason: string): void -> NOTE
-> This API is deprecated since API version 9. You are advised to use [power.reboot](#powerreboot9) instead. +> **NOTE**
This API is supported since API version 7 and is deprecated since API version 9. You are advised to use [power.reboot](#powerreboot9). The substitute API is available only for system applications. Reboots the system. @@ -317,8 +317,7 @@ power.rebootDevice('reboot_test'); isScreenOn(callback: AsyncCallback<boolean>): void -> NOTE
-> This API is deprecated since API version 9. You are advised to use [power.isActive](#powerisactive9) instead. +> **NOTE**
This API is deprecated since API version 9. You are advised to use [power.isActive](#powerisactive9). Checks the screen status of the current device. This API uses an asynchronous callback to return the result. @@ -328,7 +327,7 @@ Checks the screen status of the current device. This API uses an asynchronous ca | Name | Type | Mandatory| Description | | -------- | ---------------------------- | ---- | ------------------------------------------------------------ | -| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined** and **data** is the screen status obtained, where the value **true** indicates on and the value **false** indicates the opposite. Otherwise, **err** is an error object.| +| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined** and **data** is the screen status obtained, where the value **true** indicates on and the value **false** indicates off. Otherwise, **err** is an error object.| **Example** @@ -346,8 +345,7 @@ power.isScreenOn((err, data) => { isScreenOn(): Promise<boolean> -> NOTE
-> This API is deprecated since API version 9. You are advised to use [power.isActive](#powerisactive9) instead. +> **NOTE**
This API is deprecated since API version 9. You are advised to use [power.isActive](#powerisactive9). Checks the screen status of the current device. This API uses a promise to return the result. diff --git a/en/application-dev/reference/apis/js-apis-privacyManager.md b/en/application-dev/reference/apis/js-apis-privacyManager.md index 7880d8a09af980bbc51635e7220738722142829b..403d9a6db944073b19a80d1b086e4adc98d8f4dd 100644 --- a/en/application-dev/reference/apis/js-apis-privacyManager.md +++ b/en/application-dev/reference/apis/js-apis-privacyManager.md @@ -3,8 +3,9 @@ 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 provided by this module are system APIs. +> +> - 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. ## Modules to Import @@ -45,9 +46,9 @@ For details about the error codes, see [Ability Access Control Error Codes](../e | ID| Error Message| | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID is 0 | -| 12100002 | The specified tokenID does not exist or it does not refer to an application process. | -| 12100003 | The specified permission does not exist or it is not an user_grant permission. | +| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256, or the count value is invalid. | +| 12100002 | The specified tokenID does not exist or refer to an application process. | +| 12100003 | The specified permission does not exist or is not an user_grant permission. | | 12100007 | Service is abnormal. | | 12100008 | Out of memory. | @@ -95,9 +96,9 @@ For details about the error codes, see [Ability Access Control Error Codes](../e | ID| Error Message| | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID is 0 | -| 12100002 | The specified tokenID does not exist or it does not refer to an application process. | -| 12100003 | The specified permission does not exist or it is not an user_grant permission. | +| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256, or the count value is invalid. | +| 12100002 | The specified tokenID does not exist or refer to an application process. | +| 12100003 | The specified permission does not exist or is not an user_grant permission. | | 12100007 | Service is abnormal. | | 12100008 | Out of memory. | @@ -149,8 +150,8 @@ For details about the error codes, see [Ability Access Control Error Codes](../e | ID| Error Message| | -------- | -------- | | 12100001 | The parameter is invalid. the value of flag in request is invalid. | -| 12100002 | The specified tokenID does not exist or it does not refer to an application process. | -| 12100003 | The specified permission does not exist or it is not an user_grant permission. | +| 12100002 | The specified tokenID does not exist or refer to an application process. | +| 12100003 | The specified permission does not exist or is not an user_grant permission. | | 12100007 | Service is abnormal. | | 12100008 | Out of memory. | @@ -204,8 +205,8 @@ For details about the error codes, see [Ability Access Control Error Codes](../e | ID| Error Message| | -------- | -------- | | 12100001 | The parameter is invalid. the value of flag in request is invalid. | -| 12100002 | The specified tokenID does not exist or it does not refer to an application process. | -| 12100003 | The specified permission does not exist or it is not an user_grant permission. | +| 12100002 | The specified tokenID does not exist or refer to an application process. | +| 12100003 | The specified permission does not exist or is not an user_grant permission. | | 12100007 | Service is abnormal. | | 12100008 | Out of memory. | @@ -266,9 +267,9 @@ For details about the error codes, see [Ability Access Control Error Codes](../e | ID| Error Message| | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID is 0 | -| 12100002 | The specified tokenID does not exist or it does not refer to an application process. | -| 12100003 | The specified permission does not exist or it is not an user_grant permission. | +| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256. | +| 12100002 | The specified tokenID does not exist or refer to an application process. | +| 12100003 | The specified permission does not exist or is not an user_grant permission. | | 12100004 | The interface is called repeatedly with the same input. It means the application specified by the tokenID has been using the specified permission. | | 12100007 | Service is abnormal. | | 12100008 | Out of memory. | @@ -314,9 +315,9 @@ For details about the error codes, see [Ability Access Control Error Codes](../e | ID| Error Message| | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID is 0 | -| 12100002 | The specified tokenID does not exist or it does not refer to an application process. | -| 12100003 | The specified permission does not exist or it is not an user_grant permission. | +| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256. | +| 12100002 | The specified tokenID does not exist or refer to an application process. | +| 12100003 | The specified permission does not exist or is not an user_grant permission. | | 12100004 | The interface is called repeatedly with the same input. It means the application specified by the tokenID has been using the specified permission. | | 12100007 | Service is abnormal. | | 12100008 | Out of memory. | @@ -369,9 +370,9 @@ For details about the error codes, see [Ability Access Control Error Codes](../e | ID| Error Message| | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID is 0 | -| 12100002 | The specified tokenID does not exist or it does not refer to an application process. | -| 12100003 | The specified permission does not exist or it is not an user_grant permission. | +| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256. | +| 12100002 | The specified tokenID does not exist or refer to an application process. | +| 12100003 | The specified permission does not exist or is not an user_grant permission. | | 12100004 | The interface is not used with | | 12100007 | Service is abnormal. | | 12100008 | Out of memory. | @@ -417,9 +418,9 @@ For details about the error codes, see [Ability Access Control Error Codes](../e | ID| Error Message| | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID is 0 | -| 12100002 | The specified tokenID does not exist or it does not refer to an application process. | -| 12100003 | The specified permission does not exist or it is not an user_grant permission. | +| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256. | +| 12100002 | The specified tokenID does not exist or refer to an application process. | +| 12100003 | The specified permission does not exist or is not an user_grant permission. | | 12100004 | The interface is not used with | | 12100007 | Service is abnormal. | | 12100008 | Out of memory. | @@ -445,7 +446,7 @@ try { ## privacyManager.on -on(type: 'activeStateChange', permissionNameList: Array<Permissions>, callback: Callback<ActiveChangeResponse>): void +on(type: 'activeStateChange', permissionList: Array<Permissions>, callback: Callback<ActiveChangeResponse>): void Subscribes to the permission usage status changes of the specified permissions. @@ -458,7 +459,7 @@ Subscribes to the permission usage status changes of the specified permissions. | Name | Type | Mandatory| Description | | ------------------ | --------------------- | ---- | ------------------------------------------------------------ | | type | string | Yes | Event type to subscribe to. The value is **'activeStateChange'**, which indicates the permission usage change event. | -| permissionNameList | Array<Permissions> | Yes | List of permissions to be observed. If this parameter is left empty, the usage changes of all permissions are observed. | +| permissionList | Array<Permissions> | Yes | List of permissions to be observed. If this parameter is left empty, the usage changes of all permissions are observed. | | callback | Callback<[ActiveChangeResponse](#activechangeresponse)> | Yes| Callback invoked to return a change in the permission usage.| **Error codes** @@ -467,7 +468,7 @@ For details about the error codes, see [Ability Access Control Error Codes](../e | ID| Error Message| | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID is 0 | +| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256. | | 12100004 | The interface is called repeatedly with the same input. | | 12100005 | The registration time has exceeded the limitation. | | 12100007 | Service is abnormal. | @@ -478,9 +479,9 @@ For details about the error codes, see [Ability Access Control Error Codes](../e ```js import privacyManager from '@ohos.privacyManager'; -let permissionNameList = []; +let permissionList = []; try { - privacyManager.on('activeStateChange', permissionNameList, (data) => { + privacyManager.on('activeStateChange', permissionList, (data) => { console.debug("receive permission state change, data:" + JSON.stringify(data)); }); } catch(err) { @@ -490,7 +491,7 @@ try { ## privacyManager.off -off(type: 'activeStateChange', permissionNameList: Array<Permissions>, callback?: Callback<ActiveChangeResponse>): void; +off(type: 'activeStateChange', permissionList: Array<Permissions>, callback?: Callback<ActiveChangeResponse>): void; Unsubscribes from the permission usage status changes of the specified permissions. @@ -503,7 +504,7 @@ Unsubscribes from the permission usage status changes of the specified permissio | Name | Type | Mandatory| Description | | ------------------ | --------------------- | ---- | ------------------------------------------------------------ | | type | string | Yes | Event type to subscribe to. The value is **'activeStateChange'**, which indicates the permission usage change event. | -| permissionNameList | Array<Permissions> | Yes | List of permissions to be observed. If this parameter is left blank, the usage changes of all permissions are unsubscribed from. The value must be the same as that specified in **on()**.| +| permissionList | Array<Permissions> | Yes | List of permissions to be observed. If this parameter is left blank, the usage changes of all permissions are unsubscribed from. The value must be the same as that specified in **on()**.| | callback | Callback<[ActiveChangeResponse](#activechangeresponse)> | No| Callback for the permission usage change event.| **Error codes** @@ -512,8 +513,8 @@ For details about the error codes, see [Ability Access Control Error Codes](../e | ID| Error Message| | -------- | -------- | -| 12100001 | The parameter is invalid. The permissionName in list is all invalid or the list size is larger than 1024. | -| 12100004 | The interface is not used with | +| 12100001 | The permissionNames in the list are all invalid, or the list size exceeds 1024 bytes. | +| 12100004 | The interface is not used together with "on()".| | 12100007 | Service is abnormal. | | 12100008 | Out of memory. | @@ -522,9 +523,9 @@ For details about the error codes, see [Ability Access Control Error Codes](../e ```js import privacyManager from '@ohos.privacyManager'; -let permissionNameList = []; +let permissionList = []; try { - privacyManager.off('activeStateChange', permissionNameList); + privacyManager.off('activeStateChange', permissionList); }catch(err) { console.log(`catch err->${JSON.stringify(err)}`); } diff --git a/en/application-dev/reference/apis/js-apis-process.md b/en/application-dev/reference/apis/js-apis-process.md index 318ba307995a44950461ae3b9a43e92743c37364..e50764d1b1ff3f948ec123294bb2a013d64329e2 100755 --- a/en/application-dev/reference/apis/js-apis-process.md +++ b/en/application-dev/reference/apis/js-apis-process.md @@ -18,241 +18,87 @@ import process from '@ohos.process'; | Name| Type| Readable| Writable| Description| | -------- | -------- | -------- | -------- | -------- | -| egid | number | Yes| No| Effective group identifier (EGID) of a process.
**System API**: This is a system API.
It is used only to test applications.| -| euid | number | Yes| No| Effective user identifier (EUID) of a process.
**System API**: This is a system API.
It is used only to test applications.| -| gid | number | Yes| No| Group identifier (GID) of a process.
**System API**: This is a system API.
It is used only to test applications.| -| uid | number | Yes| No| User identifier (UID) of a process.| -| groups | number[] | Yes| No| Array with supplementary group IDs.
**System API**: This is a system API.
It is used only to test applications.| -| pid | number | Yes| No| Process ID (PID) of a process.| -| ppid | number | Yes| No| Parent process ID (PPID) of a process.
**System API**: This is a system API.
It is used only to test applications.| -| tid8+ | number | Yes| No| Thread ID (TID) of a process.| +| uid | number | Yes| No| User identifier (UID) of the process.| +| pid | number | Yes| No| Process ID (PID) of the process.| +| tid8+ | number | Yes| No| Thread ID (TID) of the thread.| -## ProcessManager9+ - -Provides APIs for throwing exceptions during the addition of a process. - -### isAppUid9+ - -isAppUid(v: number): boolean - -Checks whether a UID belongs to this application. - -**System capability**: SystemCapability.Utils.Lang - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| v | number | Yes| UID.| - -**Return value** - -| Type| Description| -| -------- | -------- | -| boolean | Returns **true** if the UID is the application's UID; returns **false** otherwise.| - -**Example** - -```js -let pro = new process.ProcessManager(); -let result = pro.isAppUid(688); -``` - - -### getUidForName9+ - -getUidForName(v: string): number - -Obtains the process UID based on the process name. +## EventListener **System capability**: SystemCapability.Utils.Lang -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| v | string | Yes| Name of a process.| - -**Return value** - -| Type| Description| +| Name| Description| | -------- | -------- | -| number | Process UID.| - -**Example** - -```js -let pro = new process.ProcessManager(); -let pres = pro .getUidForName("tool"); -``` +| EventListener = (evt:  Object) => void | Event to store.| -### getThreadPriority9+ +## process.isIsolatedProcess8+ -getThreadPriority(v: number): number +isIsolatedProcess(): boolean -Obtains the thread priority based on the specified TID. +Checks whether this process is isolated. **System capability**: SystemCapability.Utils.Lang -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| v | number | Yes| TID.| - **Return value** | Type| Description| | -------- | -------- | -| number | Priority of the thread.| +| boolean | Returns **true** if the process is isolated; returns **false** otherwise.| **Example** ```js -let pro = new process.ProcessManager(); -let tid = process.tid; -let pres = pro.getThreadPriority(tid); +let result = process.isIsolatedProcess(); ``` -### getSystemConfig9+ +## process.is64Bit8+ -getSystemConfig(name: number): number +is64Bit(): boolean -Obtains the system configuration. +Checks whether this process is running in a 64-bit environment. **System capability**: SystemCapability.Utils.Lang -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| name | number | Yes| System configuration parameter name.| - **Return value** | Type| Description| | -------- | -------- | -| number | System configuration obtained.| - -**Example** - -```js -let pro = new process.ProcessManager(); -let _SC_ARG_MAX = 0; -let pres = pro.getSystemConfig(_SC_ARG_MAX); -``` - - -### getEnvironmentVar9+ - -getEnvironmentVar(name: string): string - -Obtains the value of an environment variable. - -**System capability**: SystemCapability.Utils.Lang - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| name | string | Yes| Environment variable name.| - -**Return value** - -| Type| Description| -| -------- | -------- | -| string | Value of the environment variable.| - -**Example** - -```js -let pro = new process.ProcessManager(); -let pres = pro.getEnvironmentVar("PATH"); -``` - - -### exit9+ - -exit(code: number): void - -Terminates this process. - -Exercise caution when using this API. - -**System capability**: SystemCapability.Utils.Lang - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| code | number | Yes| Exit code of the process.| +| boolean | Returns **true** if the process is running in a 64-bit environment; returns **false** otherwise.| **Example** ```js -let pro = new process.ProcessManager(); -pro.exit(0); +let result = process.is64Bit(); ``` -### kill9+ +## process.getStartRealtime8+ -kill(signal: number, pid: number): boolean +getStartRealtime(): number -Sends a signal to the specified process to terminate it. +Obtains the duration, in milliseconds, from the time the system starts to the time the process starts. **System capability**: SystemCapability.Utils.Lang -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| pid | number | Yes| PID of the process, to which the signal will be sent.| -| signal | number | Yes| Signal to send.| - **Return value** | Type| Description| | -------- | -------- | -| boolean | Returns **true** if the signal is sent successfully; returns **false** otherwise.| +| number | Duration obtained, in millisecond.| **Example** ```js -let pro = new process.ProcessManager(); -let pres = process.pid; -let result = pro.kill(28, pres); +let realtime = process.getStartRealtime(); ``` +## process.getPastCpuTime8+ -## ChildProcess - -Allows a process to obtain the standard input and output of its child processes, send signals, and close its child processes. - -### Attributes - -**System capability**: SystemCapability.Utils.Lang - -| Name| Type| Readable| Writable| Description| -| -------- | -------- | -------- | -------- | -------- | -| pid | number | Yes| No| PID of the child process.
**System API**: This is a system API.
It is used only to test applications.| -| ppid | number | Yes| No| PPID of the child process.
**System API**: This is a system API.
It is used only to test applications.| -| exitCode | number | Yes| No| Exit code of the child process.
**System API**: This is a system API.
It is used only to test applications.| -| killed | boolean | Yes| No| Whether the parent process successfully sends a signal to the child process to terminate it.
**System API**: This is a system API.
It is used only to test applications.| - - -### wait - -wait(): Promise<number> - -Waits until the child process ends. This method uses a promise to return the exit code of the child process. - -**System API**: This is a system API. +getPastCpuTime(): number -It is used only to test applications. +Obtains the CPU time (in milliseconds) from the time the process starts to the current time. **System capability**: SystemCapability.Utils.Lang @@ -260,57 +106,35 @@ It is used only to test applications. | Type| Description| | -------- | -------- | -| Promise<number> | Promise used to return the exit code of the child process.| +| number | CPU time obtained, in millisecond.| **Example** ```js -let child = process.runCmd('ls'); -let result = child.wait(); -result.then(val=>{ - console.log("result = " + val); -}) +let result = process.getPastCpuTime() ; ``` -### getOutput - -getOutput(): Promise<Uint8Array> - -Obtains the standard output of the child process. +## process.abort -**System API**: This is a system API. +abort(): void -It is used only to test applications. +Aborts a process and generates a core file. This method will cause a process to exit immediately. Exercise caution when using this method. **System capability**: SystemCapability.Utils.Lang -**Return value** - -| Type| Description| -| -------- | -------- | -| Promise<Uint8Array> | Promise used to return the standard output in a Uint8Array.| - **Example** ```js -let child = process.runCmd('ls'); -let result = child.wait(); -child.getOutput().then(val=>{ - console.log("child.getOutput = " + val); -}) +process.abort(); ``` -### getErrorOutput - -getErrorOutput(): Promise<Uint8Array> - -Obtains the standard error output of the child process. +## process.uptime -**System API**: This is a system API. +uptime(): number -It is used only to test applications. +Obtains the running time of this process. **System capability**: SystemCapability.Utils.Lang @@ -318,48 +142,24 @@ It is used only to test applications. | Type| Description| | -------- | -------- | -| Promise<Uint8Array> | Promise used to return the standard error output in a Uint8Array.| - -**Example** - -```js -let child = process.runCmd('madir test.text'); -let result = child.wait(); -child.getErrorOutput().then(val=>{ - console.log("child.getErrorOutput= " + val); -}) -``` - - -### close - -close(): void - -Closes the child process in running. - -**System API**: This is a system API. - -It is used only to test applications. - -**System capability**: SystemCapability.Utils.Lang +| number | Running time of the process, in seconds.| **Example** ```js -let child = process.runCmd('sleep 5; ls'); -child.close(); +let time = process.uptime(); ``` -### kill - -kill(signal: number | string): void +## process.kill(deprecated) -Sends a signal to the specified child process to terminate it. +kill(signal: number, pid: number): boolean -**System API**: This is a system API. +Sends a signal to the specified process to terminate it. -It is used only to test applications. +> **NOTE** +> +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [kill9+](#kill9) instead. **System capability**: SystemCapability.Utils.Lang @@ -367,42 +167,34 @@ It is used only to test applications. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| signal | number \| string | Yes| Number or string to send.| - -**Example** - -```js -let child = process.runCmd('sleep 5; ls'); -child.kill(9); -``` - - -## process.isIsolatedProcess8+ - -isIsolatedProcess(): boolean - -Checks whether this process is isolated. - -**System capability**: SystemCapability.Utils.Lang +| pid | number | Yes| PID of the process, to which the signal will be sent.| +| signal | number | Yes| Signal to send.| **Return value** | Type| Description| | -------- | -------- | -| boolean | Returns **true** if the process is isolated; returns **false** otherwise.| +| boolean | Returns **true** if the signal is sent successfully; returns **false** otherwise.| **Example** ```js -let result = process.isIsolatedProcess(); +let pres = process.pid +let result = process.kill(28, pres) ``` -## process.isAppUid8+ +## process.exit(deprecated) -isAppUid(v: number): boolean +exit(code: number): void -Checks whether a UID belongs to this application. +Terminates this process. + +Exercise caution when using this API. After this API is called, the application exits. If the input parameter is not 0, data loss or exceptions may occur. + +> **NOTE** +> +> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [exit9+](#exit9) instead. **System capability**: SystemCapability.Utils.Lang @@ -410,48 +202,25 @@ Checks whether a UID belongs to this application. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| v | number | Yes| UID.| - -**Return value** - -| Type| Description| -| -------- | -------- | -| boolean | Returns **true** if the UID is the application's UID; returns **false** otherwise.| - -**Example** - -```js -let result = process.isAppUid(688); -``` - - -## process.is64Bit8+ - -is64Bit(): boolean - -Checks whether this process is running in a 64-bit environment. - -**System capability**: SystemCapability.Utils.Lang - -**Return value** - -| Type| Description| -| -------- | -------- | -| boolean | Returns **true** if the process is running in a 64-bit environment; returns **false** otherwise.| +| code | number | Yes| Exit code of the process.| **Example** ```js -let result = process.is64Bit(); +process.exit(0); ``` -## process.getUidForName8+ +## process.getUidForName(deprecated) getUidForName(v: string): number Obtains the process UID based on the process name. +> **NOTE** +> +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getUidForName9+](#getuidforname9) instead. + **System capability**: SystemCapability.Utils.Lang **Parameters** @@ -473,12 +242,16 @@ let pres = process.getUidForName("tool") ``` -## process.getThreadPriority8+ +## process.getThreadPriority(deprecated) getThreadPriority(v: number): number Obtains the thread priority based on the specified TID. +> **NOTE** +> +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getThreadPriority9+](#getthreadpriority9) instead. + **System capability**: SystemCapability.Utils.Lang **Parameters** @@ -501,53 +274,47 @@ let pres = process.getThreadPriority(tid); ``` -## process.getStartRealtime8+ - -getStartRealtime(): number +## process.isAppUid(deprecated) -Obtains the duration, in milliseconds, from the time the system starts to the time the process starts. - -**System capability**: SystemCapability.Utils.Lang - -**Return value** - -| Type| Description| -| -------- | -------- | -| number | Duration obtained.| - -**Example** +isAppUid(v: number): boolean -```js -let realtime = process.getStartRealtime(); -``` +Checks whether a UID belongs to this application. -## process.getPastCpuTime8+ +> **NOTE** +> +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [isAppUid9+](#isappuid9) instead. -getPastCpuTime(): number +**System capability**: SystemCapability.Utils.Lang -Obtains the CPU time (in milliseconds) from the time the process starts to the current time. +**Parameters** -**System capability**: SystemCapability.Utils.Lang +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| v | number | Yes| UID.| **Return value** | Type| Description| | -------- | -------- | -| number | CPU time obtained.| +| boolean | Returns **true** if the UID belongs to the application; returns **false** otherwise.| **Example** ```js -let result = process.getPastCpuTime() ; +let result = process.isAppUid(688); ``` -## process.getSystemConfig8+ +## process.getSystemConfig(deprecated) getSystemConfig(name: number): number Obtains the system configuration. +> **NOTE** +> +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getSystemConfig9+](#getsystemconfig9) instead. + **System capability**: SystemCapability.Utils.Lang **Parameters** @@ -570,12 +337,16 @@ let pres = process.getSystemConfig(_SC_ARG_MAX) ``` -## process.getEnvironmentVar8+ +## process.getEnvironmentVar(deprecated) getEnvironmentVar(name: string): string Obtains the value of an environment variable. +> **NOTE** +> +> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getEnvironmentVar9+](#getenvironmentvar9) instead. + **System capability**: SystemCapability.Utils.Lang **Parameters** @@ -597,15 +368,17 @@ let pres = process.getEnvironmentVar("PATH") ``` -## process.runCmd +## ProcessManager9+ -runCmd(command: string, options?: { timeout?: number, killSignal?: number | string, maxBuffer?: number }): ChildProcess +Provides APIs for throwing exceptions during the addition of a process. -Forks a new process to run a shell command and returns the **ChildProcess** object. +A **ProcessManager** object is obtained through its own constructor. -**System API**: This is a system API. +### isAppUid9+ -It is used only to test applications. +isAppUid(v: number): boolean + +Checks whether a UID belongs to this application. **System capability**: SystemCapability.Utils.Lang @@ -613,58 +386,27 @@ It is used only to test applications. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| command | string | Yes| Shell command to run.| -| options | Object | No| Related parameters.| - -**Table 1** options - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| timeout | number | No| Maximum running time (in ms) of the child process. When the running time of the child process exceeds the value of this parameter, the parent process sends a **killSignal** to the child process to terminate it. The default value is **0**.| -| killSignal | number \| string | No| Signal sent to the child process when the running time of a child process exceeds the timeout period. The default value is **SIGTERM**.| -| maxBuffer | number | No| Maximum buffer size for the standard input and output of the child process. When the size is exceeded, the child process will be terminated. The default value is **1024 \* 1024**.| +| v | number | Yes| UID.| **Return value** | Type| Description| | -------- | -------- | -| [ChildProcess](#childprocess) | **ChildProcess** object.| +| boolean | Returns **true** if the UID belongs to the application; returns **false** otherwise.| **Example** ```js -let child = process.runCmd('ls', { maxBuffer : 2 }); -let result = child.wait(); -child.getOutput.then(val=>{ - console.log("child.getOutput = " + val); -}) -``` - - -## process.abort - -abort(): void - -Aborts a process and generates a core file. This method will cause a process to exit immediately. Exercise caution when using this method. - -**System capability**: SystemCapability.Utils.Lang - -**Example** - -```js -process.abort(); +let pro = new process.ProcessManager(); +let result = pro.isAppUid(688); ``` -## process.on - -on(type: string, listener: EventListener): void - -Stores the events triggered by the user. +### getUidForName9+ -**System API**: This is a system API. +getUidForName(v: string): number -It is used only to test applications. +Obtains the process UID based on the process name. **System capability**: SystemCapability.Utils.Lang @@ -672,33 +414,27 @@ It is used only to test applications. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| type | string | Yes| Type of the events to store. | -| listener | EventListener | Yes| Callback invoked to return the event.| +| v | string | Yes| Name of a process.| -**Table 2** EventListener +**Return value** -| Name| Description| +| Type| Description| | -------- | -------- | -| EventListener = (evt:  Object) => void | Event to store.| +| number | Process UID.| **Example** ```js -process.on("data", (e)=>{ - console.log("data callback"); -}) +let pro = new process.ProcessManager(); +let pres = pro .getUidForName("tool"); ``` -## process.off - -off(type: string): boolean - -Deletes the event stored by the user. +### getThreadPriority9+ -**System API**: This is a system API. +getThreadPriority(v: number): number -It is used only to test applications. +Obtains the thread priority based on the specified TID. **System capability**: SystemCapability.Utils.Lang @@ -706,31 +442,28 @@ It is used only to test applications. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| type | string | Yes| Type of the event to delete.| +| v | number | Yes| TID.| **Return value** | Type| Description| | -------- | -------- | -| boolean | Returns **true** if the event is deleted; returns **false** otherwise.| +| number | Priority of the thread.| **Example** ```js -process.on("data", (e)=>{ - console.log("data callback"); -}) -let result = process.off("data"); +let pro = new process.ProcessManager(); +let tid = process.tid; +let pres = pro.getThreadPriority(tid); ``` -## process.exit - -exit(code: number): void +### getSystemConfig9+ -Terminates this process. +getSystemConfig(name: number): number -Exercise caution when using this API. +Obtains the system configuration. **System capability**: SystemCapability.Utils.Lang @@ -738,43 +471,28 @@ Exercise caution when using this API. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| code | number | Yes| Exit code of the process.| - -**Example** - -```js -process.exit(0); -``` - - -## process.cwd - -cwd(): string - -Obtains the working directory of this process. - -**System API**: This is a system API. +| name | number | Yes| System configuration parameter name.| -It is used only to test applications. +**Return value** -**System capability**: SystemCapability.Utils.Lang +| Type| Description| +| -------- | -------- | +| number | System configuration obtained.| **Example** ```js -let path = process.cwd(); +let pro = new process.ProcessManager(); +let _SC_ARG_MAX = 0; +let pres = pro.getSystemConfig(_SC_ARG_MAX); ``` -## process.chdir - -chdir(dir: string): void - -Changes the working directory of this process. +### getEnvironmentVar9+ -**System API**: This is a system API. +getEnvironmentVar(name: string): string -It is used only to test applications. +Obtains the value of an environment variable. **System capability**: SystemCapability.Utils.Lang @@ -782,37 +500,47 @@ It is used only to test applications. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| dir | string | Yes| Path| +| name | string | Yes| Environment variable name.| + +**Return value** + +| Type| Description| +| -------- | -------- | +| string | Value of the environment variable.| **Example** ```js -process.chdir('/system'); +let pro = new process.ProcessManager(); +let pres = pro.getEnvironmentVar("PATH"); ``` -## process.uptime +### exit9+ -uptime(): number +exit(code: number): void -Obtains the running time of this process. +Terminates this process. + +Exercise caution when using this API. After this API is called, the application exits. If the input parameter is not 0, data loss or exceptions may occur. **System capability**: SystemCapability.Utils.Lang -**Return value** +**Parameters** -| Type| Description| -| -------- | -------- | -| number | Running time of the process, in seconds.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| code | number | Yes| Exit code of the process.| **Example** ```js -let time = process.uptime(); +let pro = new process.ProcessManager(); +pro.exit(0); ``` -## process.kill +### kill9+ kill(signal: number, pid: number): boolean @@ -836,6 +564,7 @@ Sends a signal to the specified process to terminate it. **Example** ```js -let pres = process.pid -let result = process.kill(28, pres) +let pro = new process.ProcessManager(); +let pres = process.pid; +let result = pro.kill(28, pres); ``` diff --git a/en/application-dev/reference/apis/js-apis-prompt.md b/en/application-dev/reference/apis/js-apis-prompt.md index 24d70e98a4d97f58acbf6f4089b36d2b628d304b..e7b196f4a330be1c694a46c04669a307f83769da 100644 --- a/en/application-dev/reference/apis/js-apis-prompt.md +++ b/en/application-dev/reference/apis/js-apis-prompt.md @@ -45,11 +45,11 @@ Describes the options for showing the toast. **System capability**: SystemCapability.ArkUI.ArkUI.Full -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | ---------------------------------------- | -| message | string \| [Resource](../arkui-ts/ts-types.md#resource)9+ | Yes | Text to display. | -| duration | number | No | Duration that the toast will remain on the screen. The default value is 1500 ms. The value range is 1500 ms to 10000 ms. If a value less than 1500 ms is set, the default value is used. If the value greater than 10000 ms is set, the upper limit 10000 ms is used.| -| bottom | string\| number | No | Distance between the toast border and the bottom of the screen. It does not have an upper limit. The default unit is vp. | +| Name | Type | Mandatory| Description | +| -------- | --------------- | ---- | ------------------------------------------------------------ | +| message | string | Yes | Text to display. | +| duration | number | No | Duration that the toast will remain on the screen. The default value is 1500 ms. The value range is 1500 ms to 10000 ms. If a value less than 1500 ms is set, the default value is used. If the value greater than 10000 ms is set, the upper limit 10000 ms is used.| +| bottom | string\| number | No | Distance between the toast border and the bottom of the screen. It does not have an upper limit. The default unit is vp. | ## prompt.showDialog @@ -146,11 +146,11 @@ Describes the options for showing the dialog box. **System capability**: SystemCapability.ArkUI.ArkUI.Full -| Name | Type | Mandatory| Description | -| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| title | string \| [Resource](../arkui-ts/ts-types.md#resource)9+ | No | Title of the dialog box. | -| message | string \| [Resource](../arkui-ts/ts-types.md#resource)9+ | No | Text body. | -| buttons | [[Button](#button),[Button](#button)?,[Button](#button)?] | No | Array of buttons in the dialog box. The array structure is **{text:'button', color: '\#666666'}**. Up to three buttons are supported. The first button is of the **positiveButton** type, the second is of the **negativeButton** type, and the third is of the **neutralButton** type.| +| Name | Type | Mandatory| Description | +| ------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ | +| title | string | No | Title of the dialog box. | +| message | string | No | Text body. | +| buttons | [[Button](#button),[Button](#button)?,[Button](#button)?] | No | Array of buttons in the dialog box. The array structure is **{text:'button', color: '\#666666'}**. Up to three buttons are supported. The first button is of the **positiveButton** type, the second is of the **negativeButton** type, and the third is of the **neutralButton** type.| ## ShowDialogSuccessResponse @@ -257,7 +257,7 @@ Describes the options for showing the action menu. | Name | Type | Mandatory| Description | | ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| title | string \| [Resource](../arkui-ts/ts-types.md#resource)9+ | No | Title of the text to display. | +| title | string | No | Title of the text to display. | | buttons | [[Button](#button),[Button](#button)?,[Button](#button)?,[Button](#button)?,[Button](#button)?,[Button](#button)?] | Yes | Array of menu item buttons. The array structure is **{text:'button', color: '\#666666'}**. Up to six buttons are supported. If there are more than six buttons, extra buttons will not be displayed.| ## ActionMenuSuccessResponse @@ -276,7 +276,7 @@ Describes the menu item button in the action menu. **System capability**: SystemCapability.ArkUI.ArkUI.Full -| Name | Type | Mandatory | Description | -| ----- | ---------------------------------------- | ---- | ------- | -| text | string \| [Resource](../arkui-ts/ts-types.md#resource)9+ | Yes | Button text.| -| color | string \| [Resource](../arkui-ts/ts-types.md#resource)9+ | Yes | Text color of the button.| +| Name | Type | Mandatory| Description | +| ----- | ------ | ---- | -------------- | +| text | string | Yes | Button text.| +| color | string | Yes | Text color of the button.| diff --git a/en/application-dev/reference/apis/js-apis-radio.md b/en/application-dev/reference/apis/js-apis-radio.md index e004b48719c7204e420ba9acb40580907c09b6ec..15c1fc484dd8987dd26c9229beeb200ba8a711e9 100644 --- a/en/application-dev/reference/apis/js-apis-radio.md +++ b/en/application-dev/reference/apis/js-apis-radio.md @@ -10,7 +10,7 @@ The **radio** module provides basic network search management functions. You can ## Modules to Import ``` -import radio from '@ohos.telephony.radio' +import radio from '@ohos.telephony.radio'; ``` ## radio.getRadioTech @@ -32,6 +32,8 @@ Obtains the RAT used in the CS and PS domains for the SIM card in the specified **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -45,7 +47,7 @@ Obtains the RAT used in the CS and PS domains for the SIM card in the specified ```js let slotId = 0; -radio.getRadioTech(slotId, (err, data) =>{ +radio.getRadioTech(slotId, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -75,6 +77,8 @@ Obtains the RAT used in the CS and PS domains for the SIM card in the specified **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -115,6 +119,8 @@ Obtains the network status. This API uses an asynchronous callback to return the **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -127,7 +133,7 @@ Obtains the network status. This API uses an asynchronous callback to return the **Example** ```js -radio.getNetworkState((err, data) =>{ +radio.getNetworkState((err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -152,6 +158,8 @@ Obtains the network status. This API uses an asynchronous callback to return the **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -195,6 +203,8 @@ Obtains the network status. This API uses a promise to return the result. **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -234,6 +244,8 @@ Obtains the network selection mode of the SIM card in the specified slot. This A **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -274,6 +286,8 @@ Obtains the network selection mode of the SIM card in the specified slot. This A **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -312,6 +326,8 @@ Obtains the ISO country code of the network with which the SIM card in the speci **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -352,6 +368,8 @@ Obtains the ISO country code of the network with which the SIM card in the speci **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -389,12 +407,13 @@ Obtains the ID of the slot in which the primary card is located. This API uses a **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | -| 8300004 | Do not have sim card. | | 8300999 | Unknown error code. | **Example** @@ -422,12 +441,13 @@ Obtains the ID of the slot in which the primary card is located. This API uses a **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | -| 8300004 | Do not have sim card. | | 8300999 | Unknown error code. | **Example** @@ -459,6 +479,8 @@ Obtains a list of signal strengths of the network with which the SIM card in the **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -499,6 +521,8 @@ Obtains a list of signal strengths of the network with which the SIM card in the **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -646,6 +670,8 @@ Checks whether the radio service is enabled on the primary SIM card. This API us **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -683,6 +709,8 @@ Checks whether the radio service is enabled on the SIM card in the specified slo **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -726,6 +754,8 @@ Checks whether the radio service is enabled on the SIM card in the specified slo **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -765,6 +795,8 @@ Obtains the carrier name for the SIM card in the specified slot. This API uses a **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -805,6 +837,8 @@ Obtains the carrier name for the SIM card in the specified slot. This API uses a **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -846,6 +880,8 @@ Sets the ID of the slot in which the primary card is located. This API uses an a **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -860,8 +896,8 @@ Sets the ID of the slot in which the primary card is located. This API uses an a ```js let slotId = 0; -radio.setPrimarySlotId(slotId, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +radio.setPrimarySlotId(slotId, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -892,6 +928,8 @@ Sets the ID of the slot in which the primary card is located. This API uses a pr **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -907,9 +945,9 @@ Sets the ID of the slot in which the primary card is located. This API uses a pr ```js let slotId = 0; let promise = radio.setPrimarySlotId(slotId); -promise.then(data => { - console.log(`setPrimarySlotId success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`setPrimarySlotId success.`); +}).catch((err) => { console.log(`setPrimarySlotId failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -934,6 +972,8 @@ Obtains the IMEI of the SIM card in a card slot. This API uses an asynchronous c **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -973,6 +1013,8 @@ Obtains the IMEI of the SIM card in the specified card slot. This API uses an as **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1018,6 +1060,8 @@ Obtains the IMEI of the SIM card in the specified card slot. This API uses a pro **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1059,6 +1103,8 @@ Obtains the MEID of the SIM card in a card slot. This API uses an asynchronous c **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1098,6 +1144,8 @@ Obtains the MEID of the SIM card in the specified card slot. This API uses an as **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1143,6 +1191,8 @@ Obtains the MEID of the SIM card in the specified card slot. This API uses a pro **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1184,6 +1234,8 @@ Obtains the unique device ID of the SIM card in a card slot. This API uses an as **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1223,6 +1275,8 @@ Obtains the unique device ID of the SIM card in the specified card slot. This AP **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1268,6 +1322,8 @@ Obtains the unique device ID of the SIM card in the specified card slot. This AP **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1309,6 +1365,8 @@ Sends a cell location update request. This API uses an asynchronous callback to **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1321,8 +1379,8 @@ Sends a cell location update request. This API uses an asynchronous callback to **Example** ```js -radio.sendUpdateCellLocationRequest((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +radio.sendUpdateCellLocationRequest((err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1347,6 +1405,8 @@ Sends a cell location update request for the SIM card in the specified slot. Thi **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1360,8 +1420,8 @@ Sends a cell location update request for the SIM card in the specified slot. Thi ```js let slotId = 0; -radio.sendUpdateCellLocationRequest(slotId, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +radio.sendUpdateCellLocationRequest(slotId, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1391,6 +1451,8 @@ Sends a cell location update request for the SIM card in the specified slot. Thi **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1404,10 +1466,9 @@ Sends a cell location update request for the SIM card in the specified slot. Thi ```js let slotId = 0; -let promise = radio.sendUpdateCellLocationRequest(slotId); -promise.then(data => { - console.log(`sendUpdateCellLocationRequest success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +radio.sendUpdateCellLocationRequest(slotId).then(() => { + console.log(`sendUpdateCellLocationRequest success.`); +}).catch((err) => { console.log(`sendUpdateCellLocationRequest failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1432,6 +1493,8 @@ Obtains cell information. This API uses an asynchronous callback to return the r **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1471,6 +1534,8 @@ Obtains cell information for the SIM card in the specified slot. This API uses a **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1516,6 +1581,8 @@ Obtains cell information for the SIM card in the specified slot. This API uses a **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1558,6 +1625,8 @@ Sets the network selection mode. This API uses an asynchronous callback to retur **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1582,8 +1651,8 @@ let networkSelectionModeOptions={ networkInformation: networkInformation, resumeSelection: true } -radio.setNetworkSelectionMode(networkSelectionModeOptions, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +radio.setNetworkSelectionMode(networkSelectionModeOptions, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1613,6 +1682,8 @@ Sets the network selection mode. This API uses a promise to return the result. **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1638,9 +1709,9 @@ let networkSelectionModeOptions={ resumeSelection: true } let promise = radio.setNetworkSelectionMode(networkSelectionModeOptions); -promise.then(data => { - console.log(`setNetworkSelectionMode success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`setNetworkSelectionMode success.`); +}).catch((err) => { console.log(`setNetworkSelectionMode failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1666,6 +1737,8 @@ Obtains network search information for the SIM card in the specified slot. This **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1709,6 +1782,8 @@ Obtains network search information for the SIM card in the specified slot. This **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1747,6 +1822,8 @@ Obtains the NR option mode. This API uses an asynchronous callback to return the **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -1783,6 +1860,8 @@ Obtains the NR option mode for the SIM card in the specified slot. This API uses **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -1825,6 +1904,8 @@ Obtains the NR option mode for the SIM card in the specified slot. This API uses **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -1865,6 +1946,8 @@ Turns on the radio function. This API uses an asynchronous callback to return th **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1877,8 +1960,8 @@ Turns on the radio function. This API uses an asynchronous callback to return th **Example** ```js -radio.turnOnRadio((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +radio.turnOnRadio((err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1904,6 +1987,8 @@ Turns on the radio function for the SIM card in the specified slot. This API use **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1917,8 +2002,8 @@ Turns on the radio function for the SIM card in the specified slot. This API use ```js let slotId = 0; -radio.turnOnRadio(slotId, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +radio.turnOnRadio(slotId, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1949,6 +2034,8 @@ Turns on the radio function for the SIM card in the specified slot. This API use **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1962,10 +2049,9 @@ Turns on the radio function for the SIM card in the specified slot. This API use ```js let slotId = 0; -let promise = radio.turnOnRadio(slotId); -promise.then(data => { - console.log(`turnOnRadio success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +radio.turnOnRadio(slotId).then(() => { + console.log(`turnOnRadio success.`); +}).catch((err) => { console.error(`turnOnRadio failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1990,6 +2076,8 @@ Turns off the radio function. This API uses an asynchronous callback to return t **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2002,8 +2090,8 @@ Turns off the radio function. This API uses an asynchronous callback to return t **Example** ```js -radio.turnOffRadio((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +radio.turnOffRadio((err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2029,6 +2117,8 @@ Turns off the radio function for the SIM card in the specified slot. This API us **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2042,8 +2132,8 @@ Turns off the radio function for the SIM card in the specified slot. This API us ```js let slotId = 0; -radio.turnOffRadio(slotId, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +radio.turnOffRadio(slotId, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2074,6 +2164,8 @@ Turns off the radio function for the SIM card in the specified slot. This API us **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2087,10 +2179,9 @@ Turns off the radio function for the SIM card in the specified slot. This API us ```js let slotId = 0; -let promise = radio.turnOffRadio(slotId); -promise.then(data => { - console.log(`turnOffRadio success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +radio.turnOffRadio(slotId).then(() => { + console.log(`turnOffRadio success.`); +}).catch((err) => { console.error(`turnOffRadio failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -2117,6 +2208,8 @@ Sets the preferred network for the SIM card in the specified slot. This API uses **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2129,8 +2222,9 @@ Sets the preferred network for the SIM card in the specified slot. This API uses **Example** ```js -radio.setPreferredNetwork(0, 1, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +let slotId = 0; +radio.setPreferredNetwork(slotId, radio.PreferredNetworkMode.PREFERRED_NETWORK_MODE_GSM, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2161,7 +2255,9 @@ Sets the preferred network for the SIM card in the specified slot. This API uses **Error codes** -| ID| Error Message | +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | | 401 | Parameter error. | @@ -2173,10 +2269,10 @@ Sets the preferred network for the SIM card in the specified slot. This API uses **Example** ```js -let promise = radio.setPreferredNetwork(0, 1); -promise.then(data => { - console.log(`setPreferredNetwork success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +let slotId = 0; +radio.setPreferredNetwork(slotId, radio.PreferredNetworkMode.PREFERRED_NETWORK_MODE_GSM).then(() => { + console.log(`setPreferredNetwork success.`); +}).catch((err) => { console.log(`setPreferredNetwork failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -2202,6 +2298,8 @@ Obtains the preferred network for the SIM card in the specified slot. This API u **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2245,6 +2343,8 @@ Obtains the preferred network for the SIM card in the specified slot. This API u **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2287,6 +2387,8 @@ Obtains the IMS registration status of the specified IMS service type for the SI **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2331,6 +2433,8 @@ Obtains the IMS registration status of the specified IMS service type for the SI **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2374,6 +2478,8 @@ Enables listening for **imsRegStateChange** events. This API uses an asynchronou **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2414,6 +2520,8 @@ Disables listening for **imsRegStateChange** events. This API uses an asynchrono **Error codes** +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + | ID| Error Message | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2464,7 +2572,7 @@ Defines the signal strength. | --------------- | --------------------------- | ---- | ------------------ | | signalType | [NetworkType](#networktype) | Yes | Signal strength type.| | signalLevel | number | Yes | Signal strength level.| -| dBm9+| number | Yes | Network signal strength. | +| dBm9+| number | Yes | Signal strength, in dBm. | ## NetworkType diff --git a/en/application-dev/reference/apis/js-apis-reminderAgentManager.md b/en/application-dev/reference/apis/js-apis-reminderAgentManager.md index f443c028e40072e8b402f93b54be1e9ecfdc0842..7d56973be54adf176ce6c22519cb125079f19df3 100644 --- a/en/application-dev/reference/apis/js-apis-reminderAgentManager.md +++ b/en/application-dev/reference/apis/js-apis-reminderAgentManager.md @@ -1,4 +1,4 @@ -# @ohos.reminderAgentManager (Reminder Agent Management) +# @ohos.reminderAgentManager (reminderAgentManager) The **reminderAgentManager** module provides APIs for publishing scheduled reminders through the reminder agent. @@ -696,8 +696,8 @@ Sets the time information for a calendar reminder. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | year | number | Yes| Year.| -| month | number | Yes| Month.| -| day | number | Yes| Date.| -| hour | number | Yes| Hour.| -| minute | number | Yes| Minute.| -| second | number | No| Second.| +| month | number | Yes| Month. The value ranges from 1 to 12.| +| day | number | Yes| Day. The value ranges from 1 to 31.| +| hour | number | Yes| Hour. The value ranges from 0 to 23.| +| minute | number | Yes| Minute. The value ranges from 0 to 59.| +| second | number | No| Second. The value ranges from 0 to 59.| diff --git a/en/application-dev/reference/apis/js-apis-request.md b/en/application-dev/reference/apis/js-apis-request.md index ec609543eb2287801cf7fc0d51a0bce4ede8b837..1108ca63710590b35d05af8129f9ff278e9d6cc9 100644 --- a/en/application-dev/reference/apis/js-apis-request.md +++ b/en/application-dev/reference/apis/js-apis-request.md @@ -16,24 +16,6 @@ import request from '@ohos.request'; ## Constraints - -HTTPS is supported by default in the FA model. To support HTTP, add **network** to the **config.json** file and set the **cleartextTraffic** attribute to **true**. - -```js -var config = { - "deviceConfig": { - "default": { - "network": { - "cleartextTraffic": true - } - //... - } - } -} -``` - -The **cleartextTraffic** attribute is not involved during application development in the stage model. - The download server must support the HTTP HEAD method so that the size of the data to download can be obtained through **Content-length**. Otherwise, the download task fails. If this is the case, you can check the failure cause through [on('fail')7+](#onfail7). Only HTTP requests are supported. HTTPS requests are not supported. @@ -105,24 +87,24 @@ Uploads files. This API uses a promise to return the result. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| context | [BaseContext](js-apis-inner-application-baseContext.md) | Yes| Application-based context.| -| config | [UploadConfig](#uploadconfig) | Yes| Upload configurations.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | context | [BaseContext](js-apis-inner-application-baseContext.md) | Yes| Application-based context.| + | config | [UploadConfig](#uploadconfig) | Yes| Upload configurations.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<[UploadTask](#uploadtask)> | Promise used to return the **UploadTask** object.| + | Type| Description| + | -------- | -------- | + | Promise<[UploadTask](#uploadtask)> | Promise used to return the **UploadTask** object.| **Error codes** For details about the error codes, see [Upload and Download Error Codes](../errorcodes/errorcode-request.md). -| ID| Error Message| -| -------- | -------- | -| 13400002 | Bad file path. | + | ID| Error Message| + | -------- | -------- | + | 13400002 | Bad file path. | **Example** @@ -159,18 +141,18 @@ Uploads files. This API uses an asynchronous callback to return the result. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| context | [BaseContext](js-apis-inner-application-baseContext.md) | Yes| Application-based context.| -| config | [UploadConfig](#uploadconfig) | Yes| Upload configurations.| -| callback | AsyncCallback<[UploadTask](#uploadtask)> | Yes| Callback used to return the **UploadTask** object.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | context | [BaseContext](js-apis-inner-application-baseContext.md) | Yes| Application-based context.| + | config | [UploadConfig](#uploadconfig) | Yes| Upload configurations.| + | callback | AsyncCallback<[UploadTask](#uploadtask)> | Yes| Callback used to return the **UploadTask** object.| **Error codes** For details about the error codes, see [Upload and Download Error Codes](../errorcodes/errorcode-request.md). -| ID| Error Message| -| -------- | -------- | -| 13400002 | Bad file path. | + | ID| Error Message| + | -------- | -------- | + | 13400002 | Bad file path. | **Example** @@ -214,15 +196,15 @@ Uploads files. This API uses a promise to return the result. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| config | [UploadConfig](#uploadconfig) | Yes| Upload configurations.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | config | [UploadConfig](#uploadconfig) | Yes| Upload configurations.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<[UploadTask](#uploadtask)> | Promise used to return the **UploadTask** object.| + | Type| Description| + | -------- | -------- | + | Promise<[UploadTask](#uploadtask)> | Promise used to return the **UploadTask** object.| **Example** @@ -261,10 +243,10 @@ Uploads files. This API uses an asynchronous callback to return the result. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| config | [UploadConfig](#uploadconfig) | Yes| Upload configurations.| -| callback | AsyncCallback<[UploadTask](#uploadtask)> | Yes| Callback used to return the **UploadTask** object.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | config | [UploadConfig](#uploadconfig) | Yes| Upload configurations.| + | callback | AsyncCallback<[UploadTask](#uploadtask)> | Yes| Callback used to return the **UploadTask** object.| **Example** @@ -304,10 +286,10 @@ Subscribes to an upload event. This API uses an asynchronous callback to return **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| 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.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | 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 @@ -338,10 +320,10 @@ Subscribes to an upload event. This API uses an asynchronous callback to return **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| 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.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | 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 @@ -371,10 +353,10 @@ Subscribes to an upload event. This API uses an asynchronous callback to return **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Type of the event to subscribe to. The value **'complete'** means the upload completion event, and **'fail'** means the upload failure event.| -| callback | Callback<Array<TaskState>> | Yes| Callback used to return the result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | type | string | Yes| Type of the event to subscribe to. The value **'complete'** means the upload completion event, and **'fail'** means the upload failure event.| + | callback | Callback<Array<TaskState>> | Yes| Callback used to return the result.| Parameters of the callback function @@ -413,10 +395,10 @@ Unsubscribes from an upload event. This API uses an asynchronous callback to ret **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| 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.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | 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 @@ -447,10 +429,10 @@ Unsubscribes from an upload event. This API uses an asynchronous callback to ret **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| 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.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | 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 @@ -479,10 +461,10 @@ Unsubscribes from an upload event. This API uses an asynchronous callback to ret **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Type of the event to subscribe to. The value **'complete'** means the upload completion event, and **'fail'** means the upload failure event.| -| callback | Callback<Array<TaskState>> | No| Callback used to return the result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | type | string | Yes| Type of the event to subscribe to. The value **'complete'** means the upload completion event, and **'fail'** means the upload failure event.| + | callback | Callback<Array<TaskState>> | No| Callback used to return the result.| Parameters of the callback function @@ -519,9 +501,9 @@ Deletes this upload task. This API uses a promise to return the result. **Return value** -| Type| Description| -| -------- | -------- | -| Promise<boolean> | Promise used to return the task removal result. It returns **true** if the operation is successful and returns **false** otherwise.| + | Type| Description| + | -------- | -------- | + | Promise<boolean> | Promise used to return the task removal result. It returns **true** if the operation is successful and returns **false** otherwise.| **Example** @@ -550,9 +532,9 @@ Deletes this upload task. This API uses an asynchronous callback to return the r **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<boolean> | Yes| Callback used to return the result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<boolean> | Yes| Callback used to return the result.| **Example** @@ -587,9 +569,9 @@ Removes this upload task. This API uses a promise to return the result. **Return value** -| Type| Description| -| -------- | -------- | -| Promise<boolean> | Promise used to return the task removal result. It returns **true** if the operation is successful and returns **false** otherwise.| + | Type| Description| + | -------- | -------- | + | Promise<boolean> | Promise used to return the task removal result. It returns **true** if the operation is successful and returns **false** otherwise.| **Example** @@ -622,9 +604,9 @@ Removes this upload task. This API uses an asynchronous callback to return the r **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<boolean> | Yes| Callback used to return the result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<boolean> | Yes| Callback used to return the result.| **Example** @@ -705,25 +687,25 @@ Downloads files. This API uses a promise to return the result. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| context | [BaseContext](js-apis-inner-application-baseContext.md) | Yes| Application-based context.| -| config | [DownloadConfig](#downloadconfig) | Yes| Download configurations.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | context | [BaseContext](js-apis-inner-application-baseContext.md) | Yes| Application-based context.| + | config | [DownloadConfig](#downloadconfig) | Yes| Download configurations.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<[DownloadTask](#downloadtask)> | Promise used to return the result.| + | Type| Description| + | -------- | -------- | + | Promise<[DownloadTask](#downloadtask)> | Promise used to return the result.| **Error codes** For details about the error codes, see [Upload and Download Error Codes](../errorcodes/errorcode-request.md). -| ID| Error Message| -| -------- | -------- | -| 13400001 | File operation error. | -| 13400002 | Bad file path. | -| 13400003 | Task manager service error. | + | ID| Error Message| + | -------- | -------- | + | 13400001 | File operation error. | + | 13400002 | Bad file path. | + | 13400003 | Task manager service error. | **Example** @@ -753,20 +735,20 @@ Downloads files. This API uses an asynchronous callback to return the result. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| context | [BaseContext](js-apis-inner-application-baseContext.md) | Yes| Application-based context.| -| config | [DownloadConfig](#downloadconfig) | Yes| Download configurations.| -| callback | AsyncCallback<[DownloadTask](#downloadtask)> | Yes| Callback used to return the result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | context | [BaseContext](js-apis-inner-application-baseContext.md) | Yes| Application-based context.| + | config | [DownloadConfig](#downloadconfig) | Yes| Download configurations.| + | callback | AsyncCallback<[DownloadTask](#downloadtask)> | Yes| Callback used to return the result.| **Error codes** For details about the error codes, see [Upload and Download Error Codes](../errorcodes/errorcode-request.md). -| ID| Error Message| -| -------- | -------- | -| 13400001 | File operation error. | -| 13400002 | Bad file path. | -| 13400003 | Task manager service error. | + | ID| Error Message| + | -------- | -------- | + | 13400001 | File operation error. | + | 13400002 | Bad file path. | + | 13400003 | Task manager service error. | **Example** @@ -804,15 +786,15 @@ Downloads files. This API uses a promise to return the result. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| config | [DownloadConfig](#downloadconfig) | Yes| Download configurations.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | config | [DownloadConfig](#downloadconfig) | Yes| Download configurations.| **Return value** -| Type| Description| -| -------- | -------- | -| Promise<[DownloadTask](#downloadtask)> | Promise used to return the result.| + | Type| Description| + | -------- | -------- | + | Promise<[DownloadTask](#downloadtask)> | Promise used to return the result.| **Example** @@ -844,10 +826,10 @@ Downloads files. This API uses an asynchronous callback to return the result. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| config | [DownloadConfig](#downloadconfig) | Yes| Download configurations.| -| callback | AsyncCallback<[DownloadTask](#downloadtask)> | Yes| Callback used to return the result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | config | [DownloadConfig](#downloadconfig) | Yes| Download configurations.| + | callback | AsyncCallback<[DownloadTask](#downloadtask)> | Yes| Callback used to return the result.| **Example** @@ -880,10 +862,10 @@ Subscribes to a download event. This API uses an asynchronous callback to return **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| 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.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | 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 @@ -914,10 +896,10 @@ Unsubscribes from a download event. This API uses an asynchronous callback to re **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| 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.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | 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 @@ -948,10 +930,10 @@ Subscribes to a download event. This API uses an asynchronous callback to return **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Type of the event to subscribe to.
- **'complete'**: download task completion event.
- **'pause'**: download task pause event.
- **'remove'**: download task removal event.| -| callback | function | Yes| Callback used to return the result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | type | string | Yes| Type of the event to subscribe to.
- **'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** @@ -975,10 +957,10 @@ Unsubscribes from a download event. This API uses an asynchronous callback to re **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Type of the event to unsubscribe from.
- **'complete'**: download task completion event.
- **'pause'**: download task pause event.
- **'remove'**: download task removal event.| -| callback | function | No| Callback used to return the result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | type | string | Yes| Type of the event to unsubscribe from.
- **'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** @@ -1002,10 +984,10 @@ Subscribes to the download task failure event. This API uses an asynchronous cal **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| type | string | Yes| Type of the event to subscribe to. The value is **'fail'** (download failure).| -| callback | function | Yes| Callback for the download task failure event.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | type | string | Yes| Type of the event to subscribe to. The value is **'fail'** (download failure).| + | callback | function | Yes| Callback for the download task failure event.| Parameters of the callback function @@ -1035,10 +1017,10 @@ Unsubscribes from the download task failure event. This API uses an asynchronous **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| 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.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | 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 @@ -1067,9 +1049,9 @@ Removes this download task. This API uses a promise to return the result. **Return value** -| Type| Description| -| -------- | -------- | -| Promise<boolean> | Promise used to return the task removal result.| + | Type| Description| + | -------- | -------- | + | Promise<boolean> | Promise used to return the task removal result.| **Example** @@ -1098,9 +1080,9 @@ Deletes this download task. This API uses an asynchronous callback to return the **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<boolean> | Yes| Callback used to return the task deletion result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<boolean> | Yes| Callback used to return the task deletion result.| **Example** @@ -1131,9 +1113,9 @@ Obtains the information about this download task. This API uses a promise to ret **Return value** -| Type| Description| -| -------- | -------- | -| Promise<[DownloadInfo](#downloadinfo7)> | Promise used to return the download task information.| + | Type| Description| + | -------- | -------- | + | Promise<[DownloadInfo](#downloadinfo7)> | Promise used to return the download task information.| **Example** @@ -1158,9 +1140,9 @@ Obtains the information about this download task. This API uses an asynchronous **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<[DownloadInfo](#downloadinfo7)> | Yes| Callback used to return the download task information.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<[DownloadInfo](#downloadinfo7)> | Yes| Callback used to return the download task information.| **Example** @@ -1187,9 +1169,9 @@ Obtains the **MimeType** of this download task. This API uses a promise to retur **Return value** -| Type| Description| -| -------- | -------- | -| Promise<string> | Promise used to return the **MimeType** of the download task.| + | Type| Description| + | -------- | -------- | + | Promise<string> | Promise used to return the **MimeType** of the download task.| **Example** @@ -1214,9 +1196,9 @@ Obtains the **MimeType** of this download task. This API uses an asynchronous ca **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<string> | Yes| Callback used to return the **MimeType** of the download task.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<string> | Yes| Callback used to return the **MimeType** of the download task.| **Example** @@ -1243,9 +1225,9 @@ Pauses this download task. This API uses a promise to return the result. **Return value** -| Type| Description| -| -------- | -------- | -| Promise<boolean> | Promise used to return the download task pause result.| + | Type| Description| + | -------- | -------- | + | Promise<boolean> | Promise used to return the download task pause result.| **Example** @@ -1274,9 +1256,9 @@ Pauses this download task. This API uses an asynchronous callback to return the **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<boolean> | Yes| Callback used to return the result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<boolean> | Yes| Callback used to return the result.| **Example** @@ -1307,9 +1289,9 @@ Resumes this download task. This API uses a promise to return the result. **Return value** -| Type| Description| -| -------- | -------- | -| Promise<boolean> | Promise used to return the result.| + | Type| Description| + | -------- | -------- | + | Promise<boolean> | Promise used to return the result.| **Example** @@ -1339,9 +1321,9 @@ Resumes this download task. This API uses an asynchronous callback to return the **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<boolean> | Yes| Callback used to return the result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<boolean> | Yes| Callback used to return the result.| **Example** @@ -1377,9 +1359,9 @@ Removes this download task. This API uses a promise to return the result. **Return value** -| Type| Description| -| -------- | -------- | -| Promise<boolean> | Promise used to return the task removal result.| + | Type| Description| + | -------- | -------- | + | Promise<boolean> | Promise used to return the task removal result.| **Example** @@ -1412,9 +1394,9 @@ Removes this download task. This API uses an asynchronous callback to return the **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<boolean> | Yes| Callback used to return the task removal result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<boolean> | Yes| Callback used to return the task removal result.| **Example** @@ -1449,9 +1431,9 @@ Queries this download task. This API uses a promise to return the result. **Return value** -| Type| Description| -| -------- | -------- | -| Promise<[DownloadInfo](#downloadinfo7)> | Promise used to return the download task information.| + | Type| Description| + | -------- | -------- | + | Promise<[DownloadInfo](#downloadinfo7)> | Promise used to return the download task information.| **Example** @@ -1480,9 +1462,9 @@ Queries this download task. This API uses an asynchronous callback to return the **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<[DownloadInfo](#downloadinfo7)> | Yes| Callback used to return the download task information.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<[DownloadInfo](#downloadinfo7)> | Yes| Callback used to return the download task information.| **Example** @@ -1513,9 +1495,9 @@ Queries the **MimeType** of this download task. This API uses a promise to retur **Return value** -| Type| Description| -| -------- | -------- | -| Promise<string> | Promise used to return the **MimeType** of the download task.| + | Type| Description| + | -------- | -------- | + | Promise<string> | Promise used to return the **MimeType** of the download task.| **Example** @@ -1544,9 +1526,9 @@ Queries the **MimeType** of this download task. This API uses an asynchronous ca **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<string> | Yes| Callback used to return the **MimeType** of the download task.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<string> | Yes| Callback used to return the **MimeType** of the download task.| **Example** @@ -1577,9 +1559,9 @@ Pauses this download task. This API uses a promise to return the result. **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the download task pause result.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the download task pause result.| **Example** @@ -1612,9 +1594,9 @@ Pauses this download task. This API uses an asynchronous callback to return the **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<void> | Yes| Callback used to return the result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<void> | Yes| Callback used to return the result.| **Example** @@ -1649,9 +1631,9 @@ Resumes this download task. This API uses a promise to return the result. **Return value** -| Type| Description| -| -------- | -------- | -| Promise<void> | Promise used to return the result.| + | Type| Description| + | -------- | -------- | + | Promise<void> | Promise used to return the result.| **Example** @@ -1685,9 +1667,9 @@ Resumes this download task. This API uses an asynchronous callback to return the **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<void> | Yes| Callback used to return the result.| + | Name| Type| Mandatory| Description| + | -------- | -------- | -------- | -------- | + | callback | AsyncCallback<void> | Yes| Callback used to return the result.| **Example** 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 7dc343709c19421175b4f99e6308c1c0ad90e5dd..0cd8b2df9f10074df34a7405be624953b7feb233 100644 --- a/en/application-dev/reference/apis/js-apis-resource-manager.md +++ b/en/application-dev/reference/apis/js-apis-resource-manager.md @@ -13,14 +13,15 @@ The Resource Manager module provides APIs to obtain information about applicatio import resourceManager from '@ohos.resourceManager'; ``` -## Instruction +## How to Use -Since API version 9, the stage model allows an application to obtain a **ResourceManager** object based on **context** and call its resource management APIs without first importing the required bundle. This approach, however, is not applicable to the FA model. -For details about how to reference **context** in the stage model, see [Context in the Stage Model](../../application-models/application-context-stage.md). +Since API version 9, the stage model allows an application to obtain a **ResourceManager** object based on **context** and call its resource management APIs without first importing the required bundle. This approach, however, is not applicable to the FA model. For the FA model, you need to import the required bundle and then call the [getResourceManager](#resourcemanagergetresourcemanager) API to obtain a **ResourceManager** object. +For details about how to reference context in the stage model, see [Context in the Stage Model](../../application-models/application-context-stage.md). ```ts -import Ability from '@ohos.application.Ability'; -class MainAbility extends Ability { +import UIAbility from '@ohos.app.ability.UIAbility'; + +export default class EntryAbility extends UIAbility { onWindowStageCreate(windowStage) { let context = this.context; let resourceManager = context.resourceManager; @@ -60,6 +61,7 @@ Obtains the **ResourceManager** object of this application. This API uses an asy }); }); ``` +> **NOTE**
In the sample code, **0x1000000** indicates the resource ID, which can be found in the compiled **ResourceTable.txt** file. ## resourceManager.getResourceManager @@ -76,7 +78,7 @@ Obtains the **ResourceManager** object of an application based on the specified | Name | Type | Mandatory | Description | | ---------- | ---------------------------------------- | ---- | ----------------------------- | -| bundleName | string | Yes | Bundle name of the application. | +| bundleName | string | Yes | Bundle name of the target application. | | callback | AsyncCallback<[ResourceManager](#resourcemanager)> | Yes | Callback used to return the result.| **Example** @@ -116,6 +118,7 @@ Obtains the **ResourceManager** object of this application. This API uses a prom console.log("error is " + error); }); ``` +> **NOTE**
In the sample code, **0x1000000** indicates the resource ID, which can be found in the compiled **ResourceTable.txt** file. ## resourceManager.getResourceManager @@ -132,7 +135,7 @@ Obtains the **ResourceManager** object of an application based on the specified | Name | Type | Mandatory | Description | | ---------- | ------ | ---- | ------------- | -| bundleName | string | Yes | Bundle name of the application.| +| bundleName | string | Yes | Bundle name of the target application.| **Return value** @@ -168,12 +171,12 @@ Enumerates the device types. | Name | Value | Description | | -------------------- | ---- | ---- | -| DEVICE_TYPE_PHONE | 0x00 | Phone | -| DEVICE_TYPE_TABLET | 0x01 | Tablet | -| DEVICE_TYPE_CAR | 0x02 | Head unit | -| DEVICE_TYPE_PC | 0x03 | PC | -| DEVICE_TYPE_TV | 0x04 | TV | -| DEVICE_TYPE_WEARABLE | 0x06 | Wearable | +| DEVICE_TYPE_PHONE | 0x00 | Phone. | +| DEVICE_TYPE_TABLET | 0x01 | Tablet. | +| DEVICE_TYPE_CAR | 0x02 | Head unit. | +| DEVICE_TYPE_PC | 0x03 | PC. | +| DEVICE_TYPE_TV | 0x04 | TV. | +| DEVICE_TYPE_WEARABLE | 0x06 | Wearable. | ## ScreenDensity @@ -275,7 +278,7 @@ Defines the capability of accessing application resources. > **NOTE** > -> - The APIs involved in **ResourceManager** are applicable only to the TypeScript-based declarative development paradigm. +> - The methods involved in **ResourceManager** are applicable only to the TypeScript-based declarative development paradigm. > > - Resource files are defined in the **resources** directory of the project. You can obtain the resource ID using **$r(resource address).id**, for example, **$r('app.string.test').id**. @@ -642,7 +645,7 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco getMediaContent(resId: number, callback: AsyncCallback<Uint8Array>): void -Obtains the content of the media file corresponding to the specified resource ID. This API uses an asynchronous callback to return the result. +Obtains the content of the media file corresponding to the specified resource name. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Global.ResourceManager @@ -1540,7 +1543,7 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco ``` -### closeRawFd8+ +### closeRawFd9+ closeRawFd(path: string): Promise<void> @@ -1655,7 +1658,7 @@ Obtains the string corresponding to the specified resource name. This API uses a | Type | Description | | --------------------- | ---------- | -| Promise<string> | String corresponding to the resource name.| +| Promise<string> | Promise used to return the result.| For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). @@ -2033,7 +2036,7 @@ Obtains the string corresponding to the specified resource ID. This API returns | Type | Description | | ------ | ----------- | -| string | Promise used to return the result.| +| string | String corresponding to the specified resource ID.| For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). @@ -2054,6 +2057,47 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco } ``` +### getStringSync10+ + +getStringSync(resId: number, ...args: Array): string + +Obtains the string corresponding to the specified resource ID and formats the string based on **args**. This API returns the result synchronously. + +**System capability**: SystemCapability.Global.ResourceManager + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----- | ------ | ---- | ----- | +| resId | number | Yes | Resource ID.| +| args | Array | No | Arguments for formatting strings.
Supported arguments:
-%d, %f, %s, and %%
Note: %% is used to translate %.
Example: %%d is translated into the %d string.| + +**Return value** + +| Type | Description | +| ------ | ---------------------------- | +| string | Formatted string.| + +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + +**Error codes** + +| ID| Error Message| +| -------- | ----------------------------------------------- | +| 9001001 | If the resId invalid. | +| 9001002 | If the resource not found by resId. | +| 9001006 | If the resource re-ref too much. | +| 9001007 | If the resource obtained by resId formatting error. | + +**Example** + ```ts + try { + this.context.resourceManager.getStringSync($r('app.string.test').id, "format string", 10, 98.78); + } catch (error) { + console.error(`getStringSync failed, error code: ${error.code}, message: ${error.message}.`) + } + ``` + ### getStringSync9+ getStringSync(resource: Resource): string @@ -2072,7 +2116,7 @@ Obtains the string corresponding to the specified resource object. This API retu | Type | Description | | ------ | ---------------- | -| string | Promise used to return the result.| +| string | String corresponding to the resource object.| For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). @@ -2098,6 +2142,52 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco } ``` +### getStringSync10+ + +getStringSync(resource: Resource, ...args: Array): string + +Obtains the string corresponding to the specified resource object and formats the string based on **args**. This API returns the result synchronously. + +**System capability**: SystemCapability.Global.ResourceManager + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------- | ---- | ---- | +| resource | [Resource](#resource9) | Yes | Resource object.| +| args | Array | No | Arguments for formatting strings.
Supported arguments:
-%d, %f, %s, and %%
Note: %% is used to translate %.
Example: %%d is translated into the %d string.| + +**Return value** + +| Type | Description | +| ------ | ---------------------------- | +| string | Formatted string.| + +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + +**Error codes** + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 9001001 | If the resId invalid. | +| 9001002 | If the resource not found by resId. | +| 9001006 | If the resource re-ref too much. | +| 9001007 | If the resource obtained by resId formatting error. | + +**Example** + ```ts + let resource = { + bundleName: "com.example.myapplication", + moduleName: "entry", + id: $r('app.string.test').id + }; + try { + this.context.resourceManager.getStringSync(resource, "format string", 10, 98.78); + } catch (error) { + console.error(`getStringSync failed, error code: ${error.code}, message: ${error.message}.`) + } + ``` + ### getStringByNameSync9+ getStringByNameSync(resName: string): string @@ -2116,7 +2206,7 @@ Obtains the string corresponding to the specified resource name. This API return | Type | Description | | ------ | ---------- | -| string | String corresponding to the specified resource name.| +| string | String corresponding to the resource name.| For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). @@ -2137,6 +2227,47 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco } ``` +### getStringByNameSync10+ + +getStringByNameSync(resName: string, ...args: Array): string + +Obtains the string corresponding to the specified resource name and formats the string based on **args**. This API returns the result synchronously. + +**System capability**: SystemCapability.Global.ResourceManager + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------- | ------ | ---- | ---- | +| resName | string | Yes | Resource name.| +| args | Array | No | Arguments for formatting strings.
Supported arguments:
-%d, %f, %s, and %%
Note: %% is used to translate %.
Example: %%d is translated into the %d string.| + +**Return value** + +| Type | Description | +| ------ | ---------------------------- | +| string | Formatted string.| + +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + +**Error codes** + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 9001003 | If the resName invalid. | +| 9001004 | If the resource not found by resName. | +| 9001006 | If the resource re-ref too much. | +| 9001008 | If the resource obtained by resName formatting error. | + +**Example** + ```ts + try { + this.context.resourceManager.getStringByNameSync("test", "format string", 10, 98.78); + } catch (error) { + console.error(`getStringByNameSync failed, error code: ${error.code}, message: ${error.message}.`) + } + ``` + ### getBoolean9+ getBoolean(resId: number): boolean @@ -2392,6 +2523,142 @@ For details about the error codes, see [Resource Manager Error Codes](../errorco } ``` +### getDrawableDescriptor10+ + +getDrawableDescriptor(resId: number, density?: number): DrawableDescriptor; + +Obtains the **DrawableDescriptor** object corresponding to the specified resource ID. This API returns the result synchronously. + +**System capability**: SystemCapability.Global.ResourceManager + +**Parameters** + +| Name | Type | Mandatory | Description | +| ----- | ------ | ---- | ----- | +| resId | number | Yes | Resource ID.| +| [density](#screendensity) | number | No | Screen density. The default value is **0**.| + +**Return value** + +| Type | Description | +| ------ | ---------- | +| DrawableDescriptor | **DrawableDescriptor** object corresponding to the resource ID.| + +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + +**Error codes** + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 9001001 | If the resId invalid. | +| 9001002 | If the resource not found by resId. | + +**Example** + ```ts + try { + this.context.resourceManager.getDrawableDescriptor($r('app.media.icon').id); + } catch (error) { + console.error(`getDrawableDescriptor failed, error code: ${error.code}, message: ${error.message}.`) + } + try { + this.context.resourceManager.getDrawableDescriptor($r('app.media.icon').id, 120); + } catch (error) { + console.error(`getDrawableDescriptor failed, error code: ${error.code}, message: ${error.message}.`) + } + ``` + +### getDrawableDescriptor10+ + +getDrawableDescriptor(resource: Resource, density?: number): DrawableDescriptor; + +Obtains the **DrawableDescriptor** object corresponding to the specified resource. This API returns the result synchronously. + +**System capability**: SystemCapability.Global.ResourceManager + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ---------------------- | ---- | ---- | +| resource | [Resource](#resource9) | Yes | Resource object.| +| [density](#screendensity) | number | No | Screen density. The default value is **0**.| + +**Return value** + +| Type | Description | +| ------- | ----------------- | +| DrawableDescriptor | **DrawableDescriptor** object corresponding to the resource ID.| + +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + +**Error codes** + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 9001001 | If the resId invalid. | +| 9001002 | If the resource not found by resId. | + +**Example** + ```ts + let resource = { + bundleName: "com.example.myapplication", + moduleName: "entry", + id: $r('app.media.icon').id + }; + try { + this.context.resourceManager.getDrawableDescriptor(resource); + } catch (error) { + console.error(`getDrawableDescriptor failed, error code: ${error.code}, message: ${error.message}.`) + } + try { + this.context.resourceManager.getDrawableDescriptor(resource, 120); + } catch (error) { + console.error(`getDrawableDescriptor failed, error code: ${error.code}, message: ${error.message}.`) + } + ``` + +### getDrawableDescriptorByName10+ + +getDrawableDescriptorByName(resName: string, density?: number): DrawableDescriptor; + +Obtains the **DrawableDescriptor** object corresponding to the specified resource name. This API returns the result synchronously. + +**System capability**: SystemCapability.Global.ResourceManager + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------- | ------ | ---- | ---- | +| resName | string | Yes | Resource name.| +| [density](#screendensity) | number | No | Screen density. The default value is **0**.| + +**Return value** + +| Type | Description | +| ------ | --------- | +| DrawableDescriptor | **DrawableDescriptor** object corresponding to the resource ID.| + +For details about the error codes, see [Resource Manager Error Codes](../errorcodes/errorcode-resource-manager.md). + +**Error codes** + +| ID| Error Message| +| -------- | ---------------------------------------- | +| 9001003 | If the resName invalid. | +| 9001004 | If the resource not found by resName. | + +**Example** + ```ts + try { + this.context.resourceManager.getDrawableDescriptorByName('icon'); + } catch (error) { + console.error(`getDrawableDescriptor failed, error code: ${error.code}, message: ${error.message}.`) + } + try { + this.context.resourceManager.getDrawableDescriptorByName('icon', 120); + } catch (error) { + console.error(`getDrawableDescriptor failed, error code: ${error.code}, message: ${error.message}.`) + } + ``` ### getString(deprecated) @@ -2527,7 +2794,7 @@ This API is deprecated since API version 9. You are advised to use [getStringArr getMedia(resId: number, callback: AsyncCallback<Uint8Array>): void -Obtains the content of the media file corresponding to the specified resource ID. This API uses an asynchronous callback to return the result. +Obtains the content of the media file corresponding to the specified resource name. This API uses an asynchronous callback to return the result. This API is deprecated since API version 9. You are advised to use [getMediaContent](#getmediacontent9) instead. diff --git a/en/application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md b/en/application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md index bec171f5b45400827b3e76e79226b1b4210569d2..cf918a571c7121bdb5b9c5f51cb7a93ce782968d 100644 --- a/en/application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md +++ b/en/application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md @@ -233,7 +233,7 @@ Requests a continuous task from the system. This API uses an asynchronous callba | Name | Type | Mandatory | Description | | --------- | ---------------------------------- | ---- | ---------------------------------------- | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-context.md).| | bgMode | [BackgroundMode](#backgroundmode) | Yes | Background mode requested. | | wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes | Notification parameter, which is used to specify the target page that is redirected to when a continuous task notification is clicked. | | callback | AsyncCallback<void> | Yes | Callback used to return the result. | @@ -311,7 +311,7 @@ Requests a continuous task from the system. This API uses a promise to return th | Name | Type | Mandatory | Description | | --------- | ---------------------------------- | ---- | ---------------------------------------- | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-context.md).| | bgMode | [BackgroundMode](#backgroundmode) | Yes | Background mode requested. | | wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes | Notification parameter, which is used to specify the target page that is redirected to when a continuous task notification is clicked. | @@ -388,7 +388,7 @@ Requests to cancel a continuous task. This API uses an asynchronous callback to | Name | Type | Mandatory | Description | | -------- | ------------------------- | ---- | ---------------------------------------- | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-context.md).| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | **Error codes** @@ -444,7 +444,7 @@ Requests to cancel a continuous task. This API uses a promise to return the resu | Name | Type | Mandatory | Description | | ------- | ------- | ---- | ---------------------------------------- | -| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-ability-context.md).| +| context | Context | Yes | Application context.
For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md).
For details about the application context of the stage model, see [Context](js-apis-inner-application-context.md).| **Return value** diff --git a/en/application-dev/reference/apis/js-apis-resourceschedule-deviceUsageStatistics.md b/en/application-dev/reference/apis/js-apis-resourceschedule-deviceUsageStatistics.md index ce6daa95dc50c55f328eec71d8911f5024a2e6b7..01fa04dc18f59bf47d49248681d5f46fba32d187 100644 --- a/en/application-dev/reference/apis/js-apis-resourceschedule-deviceUsageStatistics.md +++ b/en/application-dev/reference/apis/js-apis-resourceschedule-deviceUsageStatistics.md @@ -54,9 +54,9 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | ID | Error Message | | ---------- | ---------------------------- | -| 10000001 | Memory operation failed. | -| 10000002 | Parcel operation failed. | -| 10000003 | System service operation failed. | +| 10000001 | Memory operation failed. | +| 10000002 | Parcel operation failed. | +| 10000003 | System service operation failed. | | 10000004 | IPC failed. | | 10000006 | Failed to get the application information. | @@ -105,9 +105,9 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | ID | Error Message | | ---------- | ---------------------------- | -| 10000001 | Memory operation failed. | -| 10000002 | Parcel operation failed. | -| 10000003 | System service operation failed. | +| 10000001 | Memory operation failed. | +| 10000002 | Parcel operation failed. | +| 10000003 | System service operation failed. | | 10000004 | IPC failed. | | 10000006 | Failed to get the application information. | @@ -133,6 +133,8 @@ Queries the group of this application. This API uses a promise to return the res **System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup +**System API**: This is a system API. + **Return value** | Type | Description | @@ -145,9 +147,9 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | ID | Error Message | | ---------- | ---------------------------- | -| 10000001 | Memory operation failed. | -| 10000002 | Parcel operation failed. | -| 10000003 | System service operation failed. | +| 10000001 | Memory operation failed. | +| 10000002 | Parcel operation failed. | +| 10000003 | System service operation failed. | | 10000004 | IPC failed. | | 10000005 | Application is not installed. | | 10000006 | Failed to get the application information. | @@ -175,6 +177,8 @@ Queries the group of this application. This API uses an asynchronous callback to **System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory | Description | @@ -186,10 +190,10 @@ Queries the group of this application. This API uses an asynchronous callback to For details about the error codes, see [DeviceUsageStatistics Error Codes](../errorcodes/errorcode-DeviceUsageStatistics.md). | ID | Error Message | -| ---------- | ---------------------------- | -| 10000001 | Memory operation failed. | -| 10000002 | Parcel operation failed. | -| 10000003 | System service operation failed. | +| ---------- | ---------------------------- | +| 10000001 | Memory operation failed. | +| 10000002 | Parcel operation failed. | +| 10000003 | System service operation failed. | | 10000004 | IPC failed. | | 10000005 | Application is not installed. | | 10000006 | Failed to get the application information. | @@ -236,10 +240,10 @@ Queries the application usage duration statistics based on the specified start t For details about the error codes, see [DeviceUsageStatistics Error Codes](../errorcodes/errorcode-DeviceUsageStatistics.md). | ID | Error Message | -| ---------- | ---------------------------- | -| 10000001 | Memory operation failed. | -| 10000002 | Parcel operation failed. | -| 10000003 | System service operation failed. | +| ---------- | ---------------------------- | +| 10000001 | Memory operation failed. | +| 10000002 | Parcel operation failed. | +| 10000003 | System service operation failed. | | 10000004 | IPC failed. | | 10000006 | Failed to get the application information. | | 10000007 | Failed to get the system time. | @@ -296,10 +300,10 @@ Queries the application usage duration statistics based on the specified start t For details about the error codes, see [DeviceUsageStatistics Error Codes](../errorcodes/errorcode-DeviceUsageStatistics.md). | ID | Error Message | -| ---------- | ---------------------------- | -| 10000001 | Memory operation failed. | -| 10000002 | Parcel operation failed. | -| 10000003 | System service operation failed. | +| ---------- | ---------------------------- | +| 10000001 | Memory operation failed. | +| 10000002 | Parcel operation failed. | +| 10000003 | System service operation failed. | | 10000004 | IPC failed. | | 10000006 | Failed to get the application information. | | 10000007 | Failed to get the system time. | @@ -350,10 +354,10 @@ Queries the application usage duration statistics in the specified time frame at For details about the error codes, see [DeviceUsageStatistics Error Codes](../errorcodes/errorcode-DeviceUsageStatistics.md). | ID | Error Message | -| ---------- | ---------------------------- | -| 10000001 | Memory operation failed. | -| 10000002 | Parcel operation failed. | -| 10000003 | System service operation failed. | +| ---------- | ---------------------------- | +| 10000001 | Memory operation failed. | +| 10000002 | Parcel operation failed. | +| 10000003 | System service operation failed. | | 10000004 | IPC failed. | | 10000006 | Failed to get the application information. | | 10000007 | Failed to get the system time. | @@ -409,10 +413,10 @@ Queries the application usage duration statistics in the specified time frame at For details about the error codes, see [DeviceUsageStatistics Error Codes](../errorcodes/errorcode-DeviceUsageStatistics.md). | ID | Error Message | -| ---------- | ---------------------------- | -| 10000001 | Memory operation failed. | -| 10000002 | Parcel operation failed. | -| 10000003 | System service operation failed. | +| ---------- | ---------------------------- | +| 10000001 | Memory operation failed. | +| 10000002 | Parcel operation failed. | +| 10000003 | System service operation failed. | | 10000004 | IPC failed. | | 10000006 | Failed to get the application information. | | 10000007 | Failed to get the system time. | @@ -461,9 +465,9 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | ID | Error Message | | ---------- | ---------------------------- | -| 10000001 | Memory operation failed. | -| 10000002 | Parcel operation failed. | -| 10000003 | System service operation failed. | +| 10000001 | Memory operation failed. | +| 10000002 | Parcel operation failed. | +| 10000003 | System service operation failed. | | 10000004 | IPC failed. | | 10000006 | Failed to get the application information. | | 10000007 | Failed to get the system time. | @@ -519,9 +523,9 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | ID | Error Message | | ---------- | ---------------------------- | -| 10000001 | Memory operation failed. | -| 10000002 | Parcel operation failed. | -| 10000003 | System service operation failed. | +| 10000001 | Memory operation failed. | +| 10000002 | Parcel operation failed. | +| 10000003 | System service operation failed. | | 10000004 | IPC failed. | | 10000006 | Failed to get the application information. | | 10000007 | Failed to get the system time. | @@ -552,6 +556,8 @@ Queries events of this application based on the specified start time and end tim **System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory | Description | @@ -565,10 +571,10 @@ Queries events of this application based on the specified start time and end tim For details about the error codes, see [DeviceUsageStatistics Error Codes](../errorcodes/errorcode-DeviceUsageStatistics.md). | ID | Error Message | -| ---------- | ---------------------------- | -| 10000001 | Memory operation failed. | -| 10000002 | Parcel operation failed. | -| 10000003 | System service operation failed. | +| ---------- | ---------------------------- | +| 10000001 | Memory operation failed. | +| 10000002 | Parcel operation failed. | +| 10000003 | System service operation failed. | | 10000004 | IPC failed. | | 10000006 | Failed to get the application information. | | 10000007 | Failed to get the system time. | @@ -601,6 +607,8 @@ Queries events of this application based on the specified start time and end tim **System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory | Description | @@ -619,10 +627,10 @@ Queries events of this application based on the specified start time and end tim For details about the error codes, see [DeviceUsageStatistics Error Codes](../errorcodes/errorcode-DeviceUsageStatistics.md). | ID | Error Message | -| ---------- | ---------------------------- | -| 10000001 | Memory operation failed. | -| 10000002 | Parcel operation failed. | -| 10000003 | System service operation failed. | +| ---------- | ---------------------------- | +| 10000001 | Memory operation failed. | +| 10000002 | Parcel operation failed. | +| 10000003 | System service operation failed. | | 10000004 | IPC failed. | | 10000006 | Failed to get the application information. | | 10000007 | Failed to get the system time. | @@ -668,10 +676,10 @@ Queries FA usage records. This API uses a promise to return a maximum of 1000 FA For details about the error codes, see [DeviceUsageStatistics Error Codes](../errorcodes/errorcode-DeviceUsageStatistics.md). | ID | Error Message | -| ---------- | ---------------------------- | -| 10000001 | Memory operation failed. | -| 10000002 | Parcel operation failed. | -| 10000003 | System service operation failed. | +| ---------- | ---------------------------- | +| 10000001 | Memory operation failed. | +| 10000002 | Parcel operation failed. | +| 10000003 | System service operation failed. | | 10000004 | IPC failed. | | 10000006 | Failed to get the application information. | | 10000007 | Failed to get the system time. | @@ -718,10 +726,10 @@ Queries FA usage records. This API uses an asynchronous callback to return a max For details about the error codes, see [DeviceUsageStatistics Error Codes](../errorcodes/errorcode-DeviceUsageStatistics.md). | ID | Error Message | -| ---------- | ---------------------------- | -| 10000001 | Memory operation failed. | -| 10000002 | Parcel operation failed. | -| 10000003 | System service operation failed. | +| ---------- | ---------------------------- | +| 10000001 | Memory operation failed. | +| 10000002 | Parcel operation failed. | +| 10000003 | System service operation failed. | | 10000004 | IPC failed. | | 10000006 | Failed to get the application information. | | 10000007 | Failed to get the system time. | @@ -776,9 +784,9 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | ID | Error Message | | ---------- | ---------------------------- | -| 10000001 | Memory operation failed. | -| 10000002 | Parcel operation failed. | -| 10000003 | System service operation failed. | +| 10000001 | Memory operation failed. | +| 10000002 | Parcel operation failed. | +| 10000003 | System service operation failed. | | 10000004 | IPC failed. | | 10000006 | Failed to get the application information. | | 10000007 | Failed to get the system time. | @@ -826,9 +834,9 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | ID | Error Message | | ---------- | ---------------------------- | -| 10000001 | Memory operation failed. | -| 10000002 | Parcel operation failed. | -| 10000003 | System service operation failed. | +| 10000001 | Memory operation failed. | +| 10000002 | Parcel operation failed. | +| 10000003 | System service operation failed. | | 10000004 | IPC failed. | | 10000006 | Failed to get the application information. | | 10000007 | Failed to get the system time. | @@ -883,11 +891,11 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | ID | Error Message | | ---------- | ---------------------------- | -| 10000001 | Memory operation failed. | -| 10000002 | Parcel operation failed. | -| 10000003 | System service operation failed. | +| 10000001 | Memory operation failed. | +| 10000002 | Parcel operation failed. | +| 10000003 | System service operation failed. | | 10000004 | IPC failed. | -| 10000005 | Application is not installed. | +| 10000005 | Application is not installed. | | 10000006 | Failed to get the application information. | | 10100002 | Failed to get the application group information. | @@ -932,11 +940,11 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | ID | Error Message | | ---------- | ---------------------------- | -| 10000001 | Memory operation failed. | -| 10000002 | Parcel operation failed. | -| 10000003 | System service operation failed. | +| 10000001 | Memory operation failed. | +| 10000002 | Parcel operation failed. | +| 10000003 | System service operation failed. | | 10000004 | IPC failed. | -| 10000005 | Application is not installed. | +| 10000005 | Application is not installed. | | 10000006 | Failed to get the application information. | | 10100002 | Failed to get the application group information. | @@ -982,9 +990,9 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | ID | Error Message | | ---------- | ---------------------------- | -| 10000001 | Memory operation failed. | -| 10000002 | Parcel operation failed. | -| 10000003 | System service operation failed. | +| 10000001 | Memory operation failed. | +| 10000002 | Parcel operation failed. | +| 10000003 | System service operation failed. | | 10000004 | IPC failed. | | 10000006 | Failed to get the application information. | | 10100001 | Repeated operation on the application group. | @@ -1037,10 +1045,10 @@ Sets a group for the application specified by **bundleName**. This API uses an a For details about the error codes, see [DeviceUsageStatistics Error Codes](../errorcodes/errorcode-DeviceUsageStatistics.md). | ID | Error Message | -| ---------- | ---------------------------- | -| 10000001 | Memory operation failed. | -| 10000002 | Parcel operation failed. | -| 10000003 | System service operation failed. | +| ---------- | ---------------------------- | +| 10000001 | Memory operation failed. | +| 10000002 | Parcel operation failed. | +| 10000003 | System service operation failed. | | 10000004 | IPC failed. | | 10000006 | Failed to get the application information. | | 10100001 | Repeated operation on the application group. | @@ -1088,9 +1096,9 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | ID | Error Message | | ---------- | ---------------------------- | -| 10000001 | Memory operation failed. | -| 10000002 | Parcel operation failed. | -| 10000003 | System service operation failed. | +| 10000001 | Memory operation failed. | +| 10000002 | Parcel operation failed. | +| 10000003 | System service operation failed. | | 10000004 | IPC failed. | | 10100001 | Repeated operation on the application group. | @@ -1147,9 +1155,9 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | ID | Error Message | | ---------- | ---------------------------- | -| 10000001 | Memory operation failed. | -| 10000002 | Parcel operation failed. | -| 10000003 | System service operation failed. | +| 10000001 | Memory operation failed. | +| 10000002 | Parcel operation failed. | +| 10000003 | System service operation failed. | | 10000004 | IPC failed. | | 10100001 | Repeated operation on the application group. | @@ -1202,10 +1210,10 @@ Deregisters the callback for application group changes. This API uses a promise For details about the error codes, see [DeviceUsageStatistics Error Codes](../errorcodes/errorcode-DeviceUsageStatistics.md). | ID | Error Message | -| ---------- | ---------------------------- | -| 10000001 | Memory operation failed. | -| 10000002 | Parcel operation failed. | -| 10000003 | System service operation failed. | +| ---------- | ---------------------------- | +| 10000001 | Memory operation failed. | +| 10000002 | Parcel operation failed. | +| 10000003 | System service operation failed. | | 10000004 | IPC failed. | | 10100001 | Repeated operation on the application group. | @@ -1246,10 +1254,10 @@ Deregisters the callback for application group changes. This API uses an asynchr For details about the error codes, see [DeviceUsageStatistics Error Codes](../errorcodes/errorcode-DeviceUsageStatistics.md). | ID | Error Message | -| ---------- | ---------------------------- | -| 10000001 | Memory operation failed. | -| 10000002 | Parcel operation failed. | -| 10000003 | System service operation failed. | +| ---------- | ---------------------------- | +| 10000001 | Memory operation failed. | +| 10000002 | Parcel operation failed. | +| 10000003 | System service operation failed. | | 10000004 | IPC failed. | | 10100001 | Repeated operation on the application group. | @@ -1299,10 +1307,10 @@ Queries statistics about system events (hibernation, wakeup, unlocking, and scre For details about the error codes, see [DeviceUsageStatistics Error Codes](../errorcodes/errorcode-DeviceUsageStatistics.md). | ID | Error Message | -| ---------- | ---------------------------- | -| 10000001 | Memory operation failed. | -| 10000002 | Parcel operation failed. | -| 10000003 | System service operation failed. | +| ---------- | ---------------------------- | +| 10000001 | Memory operation failed. | +| 10000002 | Parcel operation failed. | +| 10000003 | System service operation failed. | | 10000004 | IPC failed. | | 10000006 | Failed to get the application information. | | 10000007 | Failed to get the system time. | @@ -1348,9 +1356,9 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | ID | Error Message | | ---------- | ---------------------------- | -| 10000001 | Memory operation failed. | -| 10000002 | Parcel operation failed. | -| 10000003 | System service operation failed. | +| 10000001 | Memory operation failed. | +| 10000002 | Parcel operation failed. | +| 10000003 | System service operation failed. | | 10000004 | IPC failed. | | 10000006 | Failed to get the application information. | | 10000007 | Failed to get the system time. | @@ -1403,9 +1411,9 @@ For details about the error codes, see [DeviceUsageStatistics Error Codes](../er | ID | Error Message | | ---------- | ---------------------------- | -| 10000001 | Memory operation failed. | -| 10000002 | Parcel operation failed. | -| 10000003 | System service operation failed. | +| 10000001 | Memory operation failed. | +| 10000002 | Parcel operation failed. | +| 10000003 | System service operation failed. | | 10000004 | IPC failed. | | 10000006 | Failed to get the application information. | | 10000007 | Failed to get the system time. | @@ -1450,10 +1458,10 @@ Queries the number of notifications from all applications based on the specified For details about the error codes, see [DeviceUsageStatistics Error Codes](../errorcodes/errorcode-DeviceUsageStatistics.md). | ID | Error Message | -| ---------- | ---------------------------- | -| 10000001 | Memory operation failed. | -| 10000002 | Parcel operation failed. | -| 10000003 | System service operation failed. | +| ---------- | ---------------------------- | +| 10000001 | Memory operation failed. | +| 10000002 | Parcel operation failed. | +| 10000003 | System service operation failed. | | 10000004 | IPC failed. | | 10000006 | Failed to get the application information. | | 10000007 | Failed to get the system time. | @@ -1558,6 +1566,8 @@ Provides information about an application event. **System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App +**System API**: This is a system API. + | Name | Type | Mandatory | Description | | --------------------- | ------ | ---- | ---------------------------------------- | | bundleName | string | Yes | Bundle name of the application. | diff --git a/en/application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md b/en/application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md index 0e7ad7e7c38f32e85af6ab3504252da38afb32eb..5ba1e47b2f1d702e226ec3359044309b44a7dacb 100644 --- a/en/application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md +++ b/en/application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md @@ -346,6 +346,7 @@ For details about the error codes, see [workScheduler Error Codes](../errorcodes | 9700001 | Memory operation failed. | | 9700002 | Parcel operation failed. | | 9700003 | System service operation failed. | +| 9700004 | Checking workInfo failed. | **Example** @@ -391,6 +392,7 @@ For details about the error codes, see [workScheduler Error Codes](../errorcodes | 9700001 | Memory operation failed. | | 9700002 | Parcel operation failed. | | 9700003 | System service operation failed. | +| 9700004 | Checking workInfo failed. | **Example** @@ -430,7 +432,7 @@ Provides detailed information about the task. For details about the constraints | isPersisted | boolean | No | Whether to enable persistent storage for the task. | | isDeepIdle | boolean | No | Whether the device needs to enter the idle state. | | idleWaitTime | number | No | Time to wait in the idle state. | -| parameters | {[key: string]: any} | No | Carried parameters. | +| parameters | {[key: string]: number | string | boolean} | No | Carried parameters. | ## NetworkType Enumerates the network types that can trigger the task. diff --git a/en/application-dev/reference/apis/js-apis-router.md b/en/application-dev/reference/apis/js-apis-router.md index b5cbbd52e0c0bc4cc2f9cd364b679bc02f989f85..9f7933724c12285f56ac130c9c49c51f7e3549e4 100644 --- a/en/application-dev/reference/apis/js-apis-router.md +++ b/en/application-dev/reference/apis/js-apis-router.md @@ -362,7 +362,7 @@ For details about the error codes, see [Router Error Codes](../errorcodes/errorc | ID | Error Message| | --------- | ------- | -| 100001 | if UI execution context not found, only throw in standard system. | +| 100001 | if can not get the delegate, only throw in standard system. | | 200002 | if the uri is not exist. | **Example** @@ -598,7 +598,7 @@ export default { // detail page export default { onInit() { - console.info('showData1:' + router.getParams()[data1]); + console.info('showData1:' + router.getParams()['data1']); } } ``` diff --git a/en/application-dev/reference/apis/js-apis-rpc.md b/en/application-dev/reference/apis/js-apis-rpc.md index c806d10c6963add3231f68a1a790d68c31d4b3a5..3b12ce374b7adcebeb45323fe3eda08efb0c9245 100644 --- a/en/application-dev/reference/apis/js-apis-rpc.md +++ b/en/application-dev/reference/apis/js-apis-rpc.md @@ -20,22 +20,22 @@ The APIs of this module return exceptions since API version 9. The following tab **System capability**: SystemCapability.Communication.IPC.Core -| Name | Value | Description | -| ------------------------------------- | ------- | --------------------------------------------- | -| CHECK_PARAM_ERROR | 401 | Parameter check failed. | -| OS_MMAP_ERROR | 1900001 | Failed to call mmap. | -| OS_IOCTL_ERROR | 1900002 | Failed to call **ioctl** with the shared memory file descriptor.| -| WRITE_TO_ASHMEM_ERROR | 1900003 | Failed to write data to the shared memory. | -| READ_FROM_ASHMEM_ERROR | 1900004 | Failed to read data from the shared memory. | -| ONLY_PROXY_OBJECT_PERMITTED_ERROR | 1900005 | This operation is allowed only on the proxy object. | -| ONLY_REMOTE_OBJECT_PERMITTED_ERROR | 1900006 | This operation is allowed only on the remote object. | -| COMMUNICATION_ERROR | 1900007 | Failed to communicate with the remote object over IPC. | -| PROXY_OR_REMOTE_OBJECT_INVALID_ERROR | 1900008 | Invalid proxy or remote object. | -| WRITE_DATA_TO_MESSAGE_SEQUENCE_ERROR | 1900009 | Failed to write data to MessageSequence. | -| READ_DATA_FROM_MESSAGE_SEQUENCE_ERROR | 1900010 | Failed to read data from MessageSequence. | -| PARCEL_MEMORY_ALLOC_ERROR | 1900011 | Failed to allocate memory during serialization. | -| CALL_JS_METHOD_ERROR | 1900012 | Failed to invoke the JS callback. | -| OS_DUP_ERROR | 1900013 | Failed to call dup. | + | Name | Value | Description | + | ------------------------------------- | ------- | --------------------------------------------- | + | CHECK_PARAM_ERROR | 401 | Parameter check failed. | + | OS_MMAP_ERROR | 1900001 | Failed to call mmap. | + | OS_IOCTL_ERROR | 1900002 | Failed to call **ioctl** with the shared memory file descriptor.| + | WRITE_TO_ASHMEM_ERROR | 1900003 | Failed to write data to the shared memory. | + | READ_FROM_ASHMEM_ERROR | 1900004 | Failed to read data from the shared memory. | + | ONLY_PROXY_OBJECT_PERMITTED_ERROR | 1900005 | This operation is allowed only on the proxy object. | + | ONLY_REMOTE_OBJECT_PERMITTED_ERROR | 1900006 | This operation is allowed only on the remote object. | + | COMMUNICATION_ERROR | 1900007 | Failed to communicate with the remote object over IPC. | + | PROXY_OR_REMOTE_OBJECT_INVALID_ERROR | 1900008 | Invalid proxy or remote object. | + | WRITE_DATA_TO_MESSAGE_SEQUENCE_ERROR | 1900009 | Failed to write data to MessageSequence. | + | READ_DATA_FROM_MESSAGE_SEQUENCE_ERROR | 1900010 | Failed to read data from MessageSequence. | + | PARCEL_MEMORY_ALLOC_ERROR | 1900011 | Failed to allocate memory during serialization. | + | CALL_JS_METHOD_ERROR | 1900012 | Failed to invoke the JS callback. | + | OS_DUP_ERROR | 1900013 | Failed to call dup. | ## MessageSequence9+ @@ -54,9 +54,9 @@ During RPC or IPC, the sender can use the **write()** method provided by **Messa **Return value** -| Type | Description | -| --------------- | ------------------------------- | -| MessageSequence | **MessageSequence** object created.| + | Type | Description | + | --------------- | ------------------------------- | + | MessageSequence | **MessageSequence** object created.| **Example** @@ -90,18 +90,18 @@ Serializes a remote object and writes it to this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------------------------------- | ---- | ----------------------------------------- | -| object | [IRemoteObject](#iremoteobject) | Yes | Remote object to serialize and write to the **MessageSequence** object.| + | Name| Type | Mandatory| Description | + | ------ | ------------------------------- | ---- | ----------------------------------------- | + | object | [IRemoteObject](#iremoteobject) | Yes | Remote object to serialize and write to the **MessageSequence** object.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| -------- | ------- | -| 1900008 | proxy or remote object is invalid | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | -------- | ------- | + | 1900008 | proxy or remote object is invalid | + | 1900009 | write data to message sequence failed | **Example** @@ -131,18 +131,18 @@ Reads the remote object from **MessageSequence**. You can use this API to deseri **Return value** -| Type | Description | -| ------------------------------- | ------------------ | -| [IRemoteObject](#iremoteobject) | Remote object obtained.| + | Type | Description | + | ------------------------------- | ------------------ | + | [IRemoteObject](#iremoteobject) | Remote object obtained.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900008 | proxy or remote object is invalid | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900008 | proxy or remote object is invalid | + | 1900010 | read data from message sequence failed | **Example** @@ -173,17 +173,17 @@ Writes an interface token to this **MessageSequence** object. The remote object **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------ | -| token | string | Yes | Interface token to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------------ | + | token | string | Yes | Interface token to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900009 | write data to message sequence failed | **Example** @@ -207,17 +207,17 @@ Reads the interface token from this **MessageSequence** object. The interface to **Return value** -| Type | Description | -| ------ | ------------------------ | -| string | Interface token obtained.| + | Type | Description | + | ------ | ------------------------ | + | string | Interface token obtained.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | ----- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | ----- | + | 1900010 | read data from message sequence failed | **Example** @@ -246,9 +246,9 @@ Obtains the data size of this **MessageSequence** object. **Return value** -| Type | Description | -| ------ | ----------------------------------------------- | -| number | Size of the **MessageSequence** object obtained, in bytes.| + | Type | Description | + | ------ | ----------------------------------------------- | + | number | Size of the **MessageSequence** object obtained, in bytes.| **Example** @@ -268,9 +268,9 @@ Obtains the capacity of this **MessageSequence** object. **Return value** -| Type | Description| -| ------ | ----- | -| number | **MessageSequence** capacity obtained, in bytes.| + | Type | Description| + | ------ | ----- | + | number | **MessageSequence** capacity obtained, in bytes.| **Example** @@ -290,9 +290,9 @@ Sets the size of the data contained in this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description| -| ------ | ------ | ---- | ------ | -| size | number | Yes | Data size to set, in bytes.| + | Name| Type | Mandatory| Description| + | ------ | ------ | ---- | ------ | + | size | number | Yes | Data size to set, in bytes.| **Example** @@ -317,17 +317,17 @@ Sets the storage capacity of this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | --------------------------------------------- | -| size | number | Yes | Storage capacity of the **MessageSequence** object to set, in bytes.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | --------------------------------------------- | + | size | number | Yes | Storage capacity of the **MessageSequence** object to set, in bytes.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| -------- | ------ | -| 1900011 | parcel memory alloc failed | + | ID| Error Message| + | -------- | ------ | + | 1900011 | parcel memory alloc failed | **Example** @@ -352,9 +352,9 @@ Obtains the writable capacity (in bytes) of this **MessageSequence** object. **Return value** -| Type| Description| -| ------ | ------ | -| number | Writable capacity of the **MessageSequence** instance, in bytes.| + | Type| Description| + | ------ | ------ | + | number | Writable capacity of the **MessageSequence** instance, in bytes.| **Example** @@ -378,9 +378,9 @@ Obtains the readable capacity of this **MessageSequence** object. **Return value** -| Type| Description| -| ------ | ------- | -| number | Readable capacity of the **MessageSequence** instance, in bytes.| + | Type| Description| + | ------ | ------- | + | number | Readable capacity of the **MessageSequence** instance, in bytes.| **Example** @@ -404,9 +404,9 @@ Obtains the read position of this **MessageSequence** object. **Return value** -| Type| Description| -| ------ | ------ | -| number | Read position obtained.| + | Type| Description| + | ------ | ------ | + | number | Read position obtained.| **Example** @@ -426,9 +426,9 @@ Obtains the write position of this **MessageSequence** object. **Return value** -| Type| Description| -| ------ | ----- | -| number | Write position obtained.| + | Type| Description| + | ------ | ----- | + | number | Write position obtained.| **Example** @@ -449,9 +449,9 @@ Moves the read pointer to the specified position. **Parameters** -| Name| Type| Mandatory| Description| -| ------ | ------ | ---- | ------- | -| pos | number | Yes | Position from which data is to read.| + | Name| Type| Mandatory| Description| + | ------ | ------ | ---- | ------- | + | pos | number | Yes | Position from which data is to read.| **Example** @@ -481,9 +481,9 @@ Moves the write pointer to the specified position. **Parameters** -| Name| Type| Mandatory| Description| -| ------ | ------ | ---- | ----- | -| pos | number | Yes | Position from which data is to write.| + | Name| Type| Mandatory| Description| + | ------ | ------ | ---- | ----- | + | pos | number | Yes | Position from which data is to write.| **Example** @@ -511,17 +511,17 @@ Writes a byte value to this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description| -| ----- | ------ | ---- | ----- | -| val | number | Yes| Byte value to write.| + | Name| Type | Mandatory| Description| + | ----- | ------ | ---- | ----- | + | val | number | Yes| Byte value to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| -------- | ------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | -------- | ------- | + | 1900009 | write data to message sequence failed | **Example** @@ -545,17 +545,17 @@ Reads the byte value from this **MessageSequence** object. **Return value** -| Type | Description| -| ------ | ----- | -| number | Byte value read.| + | Type | Description| + | ------ | ----- | + | number | Byte value read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -586,17 +586,17 @@ Writes a short integer to this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description| -| ------ | ------ | --- | --- | -| val | number | Yes| Short integer to write.| + | Name| Type | Mandatory| Description| + | ------ | ------ | --- | --- | + | val | number | Yes| Short integer to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | ------ | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | ------ | + | 1900009 | write data to message sequence failed | **Example** @@ -620,17 +620,17 @@ Reads the short integer from this **MessageSequence** object. **Return value** -| Type | Description | -| ------ | -------------- | -| number | Short integer read.| + | Type | Description | + | ------ | -------------- | + | number | Short integer read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -661,17 +661,17 @@ Writes an integer to this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ---------------- | -| val | number | Yes | Integer to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ---------------- | + | val | number | Yes | Integer to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| -------- | ------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | -------- | ------- | + | 1900009 | write data to message sequence failed | **Example** @@ -695,17 +695,17 @@ Reads the integer from this **MessageSequence** object. **Return value** -| Type | Description | -| ------ | ------------ | -| number | Integer read.| + | Type | Description | + | ------ | ------------ | + | number | Integer read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | ------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | ------- | + | 1900010 | read data from message sequence failed | **Example** @@ -736,17 +736,17 @@ Writes a long integer to this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ---------------- | -| val | number | Yes | Long integer to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ---------------- | + | val | number | Yes | Long integer to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | ------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | ------- | + | 1900009 | write data to message sequence failed | **Example** @@ -770,17 +770,17 @@ Reads the long integer from this **MessageSequence** object. **Return value** -| Type | Description | -| ------ | -------------- | -| number | Long integer read.| + | Type | Description | + | ------ | -------------- | + | number | Long integer read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -811,17 +811,17 @@ Writes a floating-point number to this **MessageSequence** object. **Parameters** -| Name| Type| Mandatory| Description| -| ----- | ---- | ---- | ----- | -| val | number | Yes| Floating-point number to write.| + | Name| Type| Mandatory| Description| + | ----- | ---- | ---- | ----- | + | val | number | Yes| Floating-point number to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | ------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | ------- | + | 1900009 | write data to message sequence failed | **Example** @@ -845,17 +845,17 @@ Reads the floating-pointer number from this **MessageSequence** object. **Return value** -| Type | Description | -| ------ | ------------ | -| number | Floating-point number read.| + | Type | Description | + | ------ | ------------ | + | number | Floating-point number read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -886,17 +886,17 @@ Writes a double-precision floating-point number to this **MessageSequence** obje **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ---------------------- | -| val | number | Yes | Double-precision floating-point number to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ---------------------- | + | val | number | Yes | Double-precision floating-point number to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900009 | write data to message sequence failed | **Example** @@ -920,17 +920,17 @@ Reads the double-precision floating-point number from this **MessageSequence** o **Return value** -| Type | Description | -| ------ | ------------------ | -| number | Double-precision floating-point number read.| + | Type | Description | + | ------ | ------------------ | + | number | Double-precision floating-point number read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -961,17 +961,17 @@ Writes a Boolean value to this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------- | ---- | ---------------- | -| val | boolean | Yes | Boolean value to write.| + | Name| Type | Mandatory| Description | + | ------ | ------- | ---- | ---------------- | + | val | boolean | Yes | Boolean value to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | ------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | ------- | + | 1900009 | write data to message sequence failed | **Example** @@ -995,17 +995,17 @@ Reads the Boolean value from this **MessageSequence** object. **Return value** -| Type | Description | -| ------- | -------------------- | -| boolean | Boolean value read.| + | Type | Description | + | ------- | -------------------- | + | boolean | Boolean value read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| -------- | ------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | -------- | ------- | + | 1900010 | read data from message sequence failed | **Example** @@ -1036,17 +1036,17 @@ Writes a character to this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | -------------------- | -| val | number | Yes | Single character to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | -------------------- | + | val | number | Yes | Single character to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900009 | write data to message sequence failed | **Example** @@ -1070,17 +1070,17 @@ Reads the character from this **MessageSequence** object. **Return value** -| Type | Description| -| ------ | ---- | -| number | Character read.| + | Type | Description| + | ------ | ---- | + | number | Character read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------ | --------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------ | --------- | + | 1900010 | read data from message sequence failed | **Example** @@ -1111,17 +1111,17 @@ Writes a string to this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ----------------------------------------- | -| val | string | Yes | String to write. The length of the string must be less than 40960 bytes.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ----------------------------------------- | + | val | string | Yes | String to write. The length of the string must be less than 40960 bytes.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900009 | write data to message sequence failed | **Example** @@ -1145,17 +1145,17 @@ Reads the string from this **MessageSequence** object. **Return value** -| Type | Description | -| ------ | -------------- | -| string | String read.| + | Type | Description | + | ------ | -------------- | + | string | String read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -1186,17 +1186,17 @@ Writes a **Parcelable** object to this **MessageSequence** object. **Parameters** -| Name| Type| Mandatory| Description| -| ------ | --------- | ---- | ------ | -| val | Parcelable | Yes | **Parcelable** object to write.| + | Name| Type| Mandatory| Description| + | ------ | --------- | ---- | ------ | + | val | Parcelable | Yes | **Parcelable** object to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900009 | write data to message sequence failed | **Example** @@ -1239,18 +1239,18 @@ Reads a **Parcelable** object from this **MessageSequence** object to the specif **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------------------------- | ---- | ----------------------------------------- | -| dataIn | Parcelable | Yes | **Parcelable** object to read.| + | Name| Type | Mandatory| Description | + | ------ | ------------------------- | ---- | ----------------------------------------- | + | dataIn | Parcelable | Yes | **Parcelable** object to read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| -------- | ------- | -| 1900010 | read data from message sequence failed | -| 1900012 | call js callback function failed | + | ID| Error Message| + | -------- | ------- | + | 1900010 | read data from message sequence failed | + | 1900012 | call js callback function failed | **Example** @@ -1295,17 +1295,17 @@ Writes a byte array to this **MessageSequence** object. **Parameters** -| Name | Type | Mandatory| Description | -| --------- | -------- | ---- | ------------------ | -| byteArray | number[] | Yes | Byte array to write.| + | Name | Type | Mandatory| Description | + | --------- | -------- | ---- | ------------------ | + | byteArray | number[] | Yes | Byte array to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900009 | write data to message sequence failed | **Example** @@ -1330,17 +1330,17 @@ Reads a byte array from this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | ------------------ | -| dataIn | number[] | Yes | Byte array to read.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | ------------------ | + | dataIn | number[] | Yes | Byte array to read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -1372,17 +1372,17 @@ Reads the byte array from this **MessageSequence** object. **Return value** -| Type | Description | -| -------- | -------------- | -| number[] | Byte array read.| + | Type | Description | + | -------- | -------------- | + | number[] | Byte array read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| -------- | ------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | -------- | ------- | + | 1900010 | read data from message sequence failed | **Example** @@ -1414,17 +1414,17 @@ Writes a short array to this **MessageSequence** object. **Parameters** -| Name | Type | Mandatory| Description | -| ---------- | -------- | ---- | -------------------- | -| shortArray | number[] | Yes | Short array to write.| + | Name | Type | Mandatory| Description | + | ---------- | -------- | ---- | -------------------- | + | shortArray | number[] | Yes | Short array to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ----- | ----- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ----- | ----- | + | 1900009 | write data to message sequence failed | **Example** @@ -1448,17 +1448,17 @@ Reads a short array from this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | -------------------- | -| dataIn | number[] | Yes | Short array to read.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | -------------------- | + | dataIn | number[] | Yes | Short array to read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------ | ------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------ | ------- | + | 1900010 | read data from message sequence failed | **Example** @@ -1489,17 +1489,17 @@ Reads the short array from this **MessageSequence** object. **Return value** -| Type | Description | -| -------- | ---------------- | -| number[] | Short array read.| + | Type | Description | + | -------- | ---------------- | + | number[] | Short array read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| -------- | ------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | -------- | ------- | + | 1900010 | read data from message sequence failed | **Example** @@ -1530,17 +1530,17 @@ Writes an integer array to this **MessageSequence** object. **Parameters** -| Name | Type | Mandatory| Description | -| -------- | -------- | ---- | ------------------ | -| intArray | number[] | Yes | Integer array to write.| + | Name | Type | Mandatory| Description | + | -------- | -------- | ---- | ------------------ | + | intArray | number[] | Yes | Integer array to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ----- | --------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ----- | --------- | + | 1900009 | write data to message sequence failed | **Example** @@ -1564,17 +1564,17 @@ Reads an integer array from this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | ------------------ | -| dataIn | number[] | Yes | Integer array to read.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | ------------------ | + | dataIn | number[] | Yes | Integer array to read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -1605,17 +1605,17 @@ Reads the integer array from this **MessageSequence** object. **Return value** -| Type | Description | -| -------- | -------------- | -| number[] | Integer array read.| + | Type | Description | + | -------- | -------------- | + | number[] | Integer array read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ----- | ------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ----- | ------- | + | 1900010 | read data from message sequence failed | **Example** @@ -1646,17 +1646,17 @@ Writes a long array to this **MessageSequence** object. **Parameters** -| Name | Type | Mandatory| Description | -| --------- | -------- | ---- | -------------------- | -| longArray | number[] | Yes | Long array to write.| + | Name | Type | Mandatory| Description | + | --------- | -------- | ---- | -------------------- | + | longArray | number[] | Yes | Long array to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | ----- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | ----- | + | 1900009 | write data to message sequence failed | **Example** @@ -1680,17 +1680,17 @@ Reads a long array from this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | -------------------- | -| dataIn | number[] | Yes | Long array to read.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | -------------------- | + | dataIn | number[] | Yes | Long array to read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | ------ | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | ------ | + | 1900010 | read data from message sequence failed | **Example** @@ -1721,17 +1721,17 @@ Reads the long array from this **MessageSequence** object. **Return value** -| Type | Description | -| -------- | ---------------- | -| number[] | Long array read.| + | Type | Description | + | -------- | ---------------- | + | number[] | Long array read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -1762,17 +1762,17 @@ Writes a floating-point array to this **MessageSequence** object. **Parameters** -| Name | Type | Mandatory| Description | -| ---------- | -------- | ---- | ----------------------------------------------------------------------------------------------------------------------- | -| floatArray | number[] | Yes | Floating-point array to write. The system processes Float data as that of the Double type. Therefore, the total number of bytes occupied by a FloatArray must be calculated as the Double type.| + | Name | Type | Mandatory| Description | + | ---------- | -------- | ---- | ----------------------------------------------------------------------------------------------------------------------- | + | floatArray | number[] | Yes | Floating-point array to write. The system processes Float data as that of the Double type. Therefore, the total number of bytes occupied by a FloatArray must be calculated as the Double type.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900009 | write data to message sequence failed | **Example** @@ -1796,17 +1796,17 @@ Reads a floating-point array from this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | ----------------------------------------------------------------------------------------------------------------------- | -| dataIn | number[] | Yes | Floating-point array to read. The system processes Float data as that of the Double type. Therefore, the total number of bytes occupied by a FloatArray must be calculated as the Double type.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | ----------------------------------------------------------------------------------------------------------------------- | + | dataIn | number[] | Yes | Floating-point array to read. The system processes Float data as that of the Double type. Therefore, the total number of bytes occupied by a FloatArray must be calculated as the Double type.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -1837,17 +1837,17 @@ Reads the floating-point array from this **MessageSequence** object. **Return value** -| Type | Description | -| -------- | -------------- | -| number[] | Floating-point array read.| + | Type | Description | + | -------- | -------------- | + | number[] | Floating-point array read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -1878,17 +1878,17 @@ Writes a double-precision floating-point array to this **MessageSequence** objec **Parameters** -| Name | Type | Mandatory| Description | -| ----------- | -------- | ---- | ------------------------ | -| doubleArray | number[] | Yes | Double-precision floating-point array to write.| + | Name | Type | Mandatory| Description | + | ----------- | -------- | ---- | ------------------------ | + | doubleArray | number[] | Yes | Double-precision floating-point array to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900009 | write data to message sequence failed | **Example** @@ -1912,17 +1912,17 @@ Reads a double-precision floating-point array from this **MessageSequence** obje **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | ------------------------ | -| dataIn | number[] | Yes | Double-precision floating-point array to read.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | ------------------------ | + | dataIn | number[] | Yes | Double-precision floating-point array to read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -1953,17 +1953,17 @@ Reads the double-precision floating-point array from this **MessageSequence** ob **Return value** -| Type | Description | -| -------- | -------------------- | -| number[] | Double-precision floating-point array read.| + | Type | Description | + | -------- | -------------------- | + | number[] | Double-precision floating-point array read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -1994,17 +1994,17 @@ Writes a Boolean array to this **MessageSequence** object. **Parameters** -| Name | Type | Mandatory| Description | -| ------------ | --------- | ---- | ------------------ | -| booleanArray | boolean[] | Yes | Boolean array to write.| + | Name | Type | Mandatory| Description | + | ------------ | --------- | ---- | ------------------ | + | booleanArray | boolean[] | Yes | Boolean array to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900009 | write data to message sequence failed | **Example** @@ -2028,17 +2028,17 @@ Reads a Boolean array from this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | --------- | ---- | ------------------ | -| dataIn | boolean[] | Yes | Boolean array to read.| + | Name| Type | Mandatory| Description | + | ------ | --------- | ---- | ------------------ | + | dataIn | boolean[] | Yes | Boolean array to read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -2069,17 +2069,17 @@ Reads the Boolean array from this **MessageSequence** object. **Return value** -| Type | Description | -| --------- | -------------- | -| boolean[] | Boolean array read.| + | Type | Description | + | --------- | -------------- | + | boolean[] | Boolean array read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -2110,17 +2110,17 @@ Writes a character array to this **MessageSequence** object. **Parameters** -| Name | Type | Mandatory| Description | -| --------- | -------- | ---- | ---------------------- | -| charArray | number[] | Yes | Character array to write.| + | Name | Type | Mandatory| Description | + | --------- | -------- | ---- | ---------------------- | + | charArray | number[] | Yes | Character array to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| -------- | ------ | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | -------- | ------ | + | 1900009 | write data to message sequence failed | **Example** @@ -2144,17 +2144,17 @@ Reads a character array from this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | ---------------------- | -| dataIn | number[] | Yes | Character array to read.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | ---------------------- | + | dataIn | number[] | Yes | Character array to read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -2185,17 +2185,17 @@ Reads the character array from this **MessageSequence** object. **Return value** -| Type | Description | -| -------- | ------------------ | -| number[] | Character array read.| + | Type | Description | + | -------- | ------------------ | + | number[] | Character array read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -2227,17 +2227,17 @@ Writes a string array to this **MessageSequence** object. **Parameters** -| Name | Type | Mandatory| Description | -| ----------- | -------- | ---- | ------------------------------------------------------- | -| stringArray | string[] | Yes | String array to write. The length of a single element in the array must be less than 40960 bytes.| + | Name | Type | Mandatory| Description | + | ----------- | -------- | ---- | ------------------------------------------------------- | + | stringArray | string[] | Yes | String array to write. The length of a single element in the array must be less than 40960 bytes.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900009 | write data to message sequence failed | **Example** @@ -2261,17 +2261,17 @@ Reads a string array from this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | -------------------- | -| dataIn | string[] | Yes | String array to read.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | -------------------- | + | dataIn | string[] | Yes | String array to read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -2302,17 +2302,17 @@ Reads the string array from this **MessageSequence** object. **Return value** -| Type | Description | -| -------- | ---------------- | -| string[] | String array read.| + | Type | Description | + | -------- | ---------------- | + | string[] | String array read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -2345,9 +2345,9 @@ Writes information to this **MessageSequence** object indicating that no excepti For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900009 | write data to message sequence failed | **Example** @@ -2387,9 +2387,9 @@ Reads the exception information from this **MessageSequence** object. For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -2417,7 +2417,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode FA.connectAbility(want, connect); ``` -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. ```ts let option = new rpc.MessageOption(); @@ -2459,17 +2459,17 @@ Writes a **Parcelable** array to this **MessageSequence** object. **Parameters** -| Name | Type | Mandatory| Description | -| --------------- | ------------ | ---- | -------------------------- | -| parcelableArray | Parcelable[] | Yes | **Parcelable** array to write.| + | Name | Type | Mandatory| Description | + | --------------- | ------------ | ---- | -------------------------- | + | parcelableArray | Parcelable[] | Yes | **Parcelable** array to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900009 | write data to message sequence failed | **Example** @@ -2515,18 +2515,18 @@ Reads a **Parcelable** array from this **MessageSequence** object. **Parameters** -| Name | Type | Mandatory| Description | -| --------------- | ------------ | ---- | -------------------------- | -| parcelableArray | Parcelable[] | Yes | **Parcelable** array to read.| + | Name | Type | Mandatory| Description | + | --------------- | ------------ | ---- | -------------------------- | + | parcelableArray | Parcelable[] | Yes | **Parcelable** array to read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | -| 1900012 | call js callback function failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | + | 1900012 | call js callback function failed | **Example** @@ -2576,17 +2576,17 @@ Writes an array of **IRemoteObject** objects to this **MessageSequence** object. **Parameters** -| Name | Type | Mandatory| Description | -| ----------- | --------------- | ---- | ---------------------------------------------- | -| objectArray | IRemoteObject[] | Yes | Array of **IRemoteObject** objects to write.| + | Name | Type | Mandatory| Description | + | ----------- | --------------- | ---- | ---------------------------------------------- | + | objectArray | IRemoteObject[] | Yes | Array of **IRemoteObject** objects to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | ------- | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | ------- | + | 1900009 | write data to message sequence failed | **Example** @@ -2623,17 +2623,17 @@ Reads an array of **IRemoteObject** objects from this **MessageSequence** object **Parameters** -| Name | Type | Mandatory| Description | -| ------- | --------------- | ---- | ---------------------------------------------- | -| objects | IRemoteObject[] | Yes | **IRemoteObject** array to read.| + | Name | Type | Mandatory| Description | + | ------- | --------------- | ---- | ---------------------------------------------- | + | objects | IRemoteObject[] | Yes | **IRemoteObject** array to read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -2676,17 +2676,17 @@ Reads the **IRemoteObject** object array from this **MessageSequence** object. **Return value** -| Type | Description | -| --------------- | --------------------------- | -| IRemoteObject[] | **IRemoteObject** object array read.| + | Type | Description | + | --------------- | --------------------------- | + | IRemoteObject[] | **IRemoteObject** object array read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -2724,9 +2724,9 @@ Closes a file descriptor. This API is a static method. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | -------------------- | -| fd | number | Yes | File descriptor to close.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | -------------------- | + | fd | number | Yes | File descriptor to close.| **Example** @@ -2752,23 +2752,23 @@ Duplicates a file descriptor. This API is a static method. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------------ | -| fd | number | Yes | File descriptor to duplicate.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------------------ | + | fd | number | Yes | File descriptor to duplicate.| **Return value** -| Type | Description | -| ------ | -------------------- | -| number | New file descriptor.| + | Type | Description | + | ------ | -------------------- | + | number | New file descriptor.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | ------- | -| 1900013 | call os dup function failed | + | ID| Error Message| + | ------- | ------- | + | 1900013 | call os dup function failed | **Example** @@ -2794,9 +2794,9 @@ Checks whether this **MessageSequence** object contains file descriptors. **Return value** -| Type | Description | -| ------- | -------------------------------------------------------------------- | -| boolean | Returns **true** if the **MessageSequence** object contains file descriptors; returns **false** otherwise.| + | Type | Description | + | ------- | -------------------------------------------------------------------- | + | boolean | Returns **true** if the **MessageSequence** object contains file descriptors; returns **false** otherwise.| **Example** @@ -2832,17 +2832,17 @@ Writes a file descriptor to this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------ | -| fd | number | Yes | File descriptor to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------ | + | fd | number | Yes | File descriptor to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| -------- | ------ | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | -------- | ------ | + | 1900009 | write data to message sequence failed | **Example** @@ -2869,17 +2869,17 @@ Reads the file descriptor from this **MessageSequence** object. **Return value** -| Type | Description | -| ------ | ---------------- | -| number | File descriptor read.| + | Type | Description | + | ------ | ---------------- | + | number | File descriptor read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -2912,17 +2912,17 @@ Writes an anonymous shared object to this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------------------------- | -| ashmem | Ashmem | Yes | Anonymous shared object to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------------------------------- | + | ashmem | Ashmem | Yes | Anonymous shared object to write.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | ------- | -| 1900003 | write to ashmem failed | + | ID| Error Message| + | ------- | ------- | + | 1900003 | write to ashmem failed | **Example** @@ -2954,17 +2954,17 @@ Reads the anonymous shared object from this **MessageSequence** object. **Return value** -| Type | Description | -| ------ | ------------------ | -| Ashmem | Anonymous share object read.| + | Type | Description | + | ------ | ------------------ | + | Ashmem | Anonymous share object read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900004 | read from ashmem failed | + | ID| Error Message| + | ------- | -------- | + | 1900004 | read from ashmem failed | **Example** @@ -3002,9 +3002,9 @@ Obtains the maximum amount of raw data that can be held by this **MessageSequenc **Return value** -| Type | Description | -| ------ | ------------------------------------------------------------ | -| number | 128 MB, which is the maximum amount of raw data that can be held by this **MessageSequence** object.| + | Type | Description | + | ------ | ------------------------------------------------------------ | + | number | 128 MB, which is the maximum amount of raw data that can be held by this **MessageSequence** object.| **Example** @@ -3024,18 +3024,18 @@ Writes raw data to this **MessageSequence** object. **Parameters** -| Name | Type | Mandatory| Description | -| ------- | -------- | ---- | ---------------------------------- | -| rawData | number[] | Yes | Raw data to write. | -| size | number | Yes | Size of the raw data, in bytes.| + | Name | Type | Mandatory| Description | + | ------- | -------- | ---- | ---------------------------------- | + | rawData | number[] | Yes | Raw data to write. | + | size | number | Yes | Size of the raw data, in bytes.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | ------ | -| 1900009 | write data to message sequence failed | + | ID| Error Message| + | ------- | ------ | + | 1900009 | write data to message sequence failed | **Example** @@ -3060,23 +3060,23 @@ Reads raw data from this **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------------ | -| size | number | Yes | Size of the raw data to read.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------------------ | + | size | number | Yes | Size of the raw data to read.| **Return value** -| Type | Description | -| -------- | ------------------------------ | -| number[] | Raw data read, in bytes.| + | Type | Description | + | -------- | ------------------------------ | + | number[] | Raw data read, in bytes.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900010 | read data from message sequence failed | + | ID| Error Message| + | ------- | -------- | + | 1900010 | read data from message sequence failed | **Example** @@ -3116,9 +3116,9 @@ Creates a **MessageParcel** object. This method is a static method. **Return value** -| Type | Description | -| ------------- | ----------------------------- | -| MessageParcel | **MessageParcel** object created.| + | Type | Description | + | ------------- | ----------------------------- | + | MessageParcel | **MessageParcel** object created.| **Example** @@ -3152,15 +3152,15 @@ Serializes a remote object and writes it to this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------------------------------- | ---- | --------------------------------------- | -| object | [IRemoteObject](#iremoteobject) | Yes | Remote object to serialize and write to the **MessageParcel** object.| + | Name| Type | Mandatory| Description | + | ------ | ------------------------------- | ---- | --------------------------------------- | + | object | [IRemoteObject](#iremoteobject) | Yes | Remote object to serialize and write to the **MessageParcel** object.| **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** @@ -3199,9 +3199,9 @@ Reads the remote object from this **MessageParcel** object. You can use this met **Return value** -| Type | Description | -| ------------------------------- | ------------------ | -| [IRemoteObject](#iremoteobject) | Remote object obtained.| + | Type | Description | + | ------------------------------- | ------------------ | + | [IRemoteObject](#iremoteobject) | Remote object obtained.| **Example** @@ -3241,15 +3241,15 @@ Writes an interface token to this **MessageParcel** object. The remote object ca **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------ | -| token | string | Yes | Interface token to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------------ | + | token | string | Yes | Interface token to write.| **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** @@ -3270,9 +3270,9 @@ Reads the interface token from this **MessageParcel** object. The interface toke **Return value** -| Type | Description | -| ------ | ------------------------ | -| string | Interface token obtained.| + | Type | Description | + | ------ | ------------------------ | + | string | Interface token obtained.| **Example** @@ -3296,9 +3296,9 @@ Obtains the data size of this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | --------------------------------------------- | -| number | Size of the **MessageParcel** object obtained, in bytes.| + | Type | Description | + | ------ | --------------------------------------------- | + | number | Size of the **MessageParcel** object obtained, in bytes.| **Example** @@ -3318,9 +3318,9 @@ Obtains the capacity of this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | --------------------------------------------- | -| number | **MessageParcel** capacity obtained, in bytes.| + | Type | Description | + | ------ | --------------------------------------------- | + | number | **MessageParcel** capacity obtained, in bytes.| **Example** @@ -3340,15 +3340,15 @@ Sets the size of data contained in this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------------------------------- | -| size | number | Yes | Data size to set, in bytes.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------------------------------------- | + | size | number | Yes | Data size to set, in bytes.| **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** @@ -3368,15 +3368,15 @@ Sets the storage capacity of this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------------------------------- | -| size | number | Yes | Storage capacity to set, in bytes.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------------------------------------- | + | size | number | Yes | Storage capacity to set, in bytes.| **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** @@ -3396,9 +3396,9 @@ Obtains the writable capacity of this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | --------------------------------------------------- | -| number | **MessageParcel** writable capacity obtained, in bytes.| + | Type | Description | + | ------ | --------------------------------------------------- | + | number | **MessageParcel** writable capacity obtained, in bytes.| **Example** @@ -3422,9 +3422,9 @@ Obtains the readable capacity of this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | --------------------------------------------------- | -| number | **MessageParcel** object readable capacity, in bytes.| + | Type | Description | + | ------ | --------------------------------------------------- | + | number | **MessageParcel** object readable capacity, in bytes.| **Example** @@ -3448,9 +3448,9 @@ Obtains the read position of this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | --------------------------------------- | -| number | Current read position of the **MessageParcel** object.| + | Type | Description | + | ------ | --------------------------------------- | + | number | Current read position of the **MessageParcel** object.| **Example** @@ -3470,9 +3470,9 @@ Obtains the write position of this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | --------------------------------------- | -| number | Current write position of the **MessageParcel** object.| + | Type | Description | + | ------ | --------------------------------------- | + | number | Current write position of the **MessageParcel** object.| **Example** @@ -3493,15 +3493,15 @@ Moves the read pointer to the specified position. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------------ | -| pos | number | Yes | Position from which data is to read.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------------------ | + | pos | number | Yes | Position from which data is to read.| **Return value** -| Type | Description | -| ------- | ------------------------------------------------- | -| boolean | Returns **true** if the read position changes; returns **false** otherwise.| + | Type | Description | + | ------- | ------------------------------------------------- | + | boolean | Returns **true** if the read position changes; returns **false** otherwise.| **Example** @@ -3526,15 +3526,15 @@ Moves the write pointer to the specified position. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------------ | -| pos | number | Yes | Position from which data is to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------------------ | + | pos | number | Yes | Position from which data is to write.| **Return value** -| Type | Description | -| ------- | --------------------------------------------- | -| boolean | Returns **true** if the write position changes; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------------------- | + | boolean | Returns **true** if the write position changes; returns **false** otherwise.| **Example** @@ -3557,15 +3557,15 @@ Writes a Byte value to this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ---------------- | -| val | number | Yes | Byte value to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ---------------- | + | val | number | Yes | Byte value to write.| **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** @@ -3585,9 +3585,9 @@ Reads the Byte value from this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | ------------ | -| number | Byte value read.| + | Type | Description | + | ------ | ------------ | + | number | Byte value read.| **Example** @@ -3609,15 +3609,15 @@ Writes a Short int value to this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------ | -| val | number | Yes | Short int value to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------------ | + | val | number | Yes | Short int value to write.| **Return value** -| Type | Description | -| ------- | ----------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -3637,9 +3637,9 @@ Reads the Short int value from this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | -------------- | -| number | Short int value read.| + | Type | Description | + | ------ | -------------- | + | number | Short int value read.| **Example** @@ -3661,15 +3661,15 @@ Writes an Int value to this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ---------------- | -| val | number | Yes | Int value to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ---------------- | + | val | number | Yes | Int value to write.| **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** @@ -3689,9 +3689,9 @@ Reads the Int value from this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | ------------ | -| number | Int value read.| + | Type | Description | + | ------ | ------------ | + | number | Int value read.| **Example** @@ -3713,15 +3713,15 @@ Writes a Long int value to this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ---------------- | -| val | number | Yes | Long int value to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ---------------- | + | val | number | Yes | Long int value to write.| **Return value** -| Type | Description | -| ------- | --------------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -3741,9 +3741,9 @@ Reads the Long int value from this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | -------------- | -| number | Long int value read.| + | Type | Description | + | ------ | -------------- | + | number | Long int value read.| **Example** @@ -3765,15 +3765,15 @@ Writes a Float value to this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ---------------- | -| val | number | Yes | Float value to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ---------------- | + | val | number | Yes | Float value to write.| **Return value** -| Type | Description | -| ------- | --------------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -3793,9 +3793,9 @@ Reads the Float value from this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | ------------ | -| number | Float value read.| + | Type | Description | + | ------ | ------------ | + | number | Float value read.| **Example** @@ -3817,15 +3817,15 @@ Writes a Double value to this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ---------------------- | -| val | number | Yes | Double value to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ---------------------- | + | val | number | Yes | Double value to write.| **Return value** -| Type | Description | -| ------- | --------------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -3845,9 +3845,9 @@ Reads the Double value from this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | ------------------ | -| number | Double value read.| + | Type | Description | + | ------ | ------------------ | + | number | Double value read.| **Example** @@ -3869,15 +3869,15 @@ Writes a Boolean value to this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------- | ---- | ---------------- | -| val | boolean | Yes | Boolean value to write.| + | Name| Type | Mandatory| Description | + | ------ | ------- | ---- | ---------------- | + | val | boolean | Yes | Boolean value to write.| **Return value** -| Type | Description | -| ------- | --------------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -3897,9 +3897,9 @@ Reads the Boolean value from this **MessageParcel** object. **Return value** -| Type | Description | -| ------- | -------------------- | -| boolean | Boolean value read.| + | Type | Description | + | ------- | -------------------- | + | boolean | Boolean value read.| **Example** @@ -3921,15 +3921,15 @@ Writes a Char value to this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | -------------------- | -| val | number | Yes | Char value to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | -------------------- | + | val | number | Yes | Char value to write.| **Return value** -| Type | Description | -| ------- | ----------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -3949,9 +3949,9 @@ Reads the Char value from this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | ---------------- | -| number | Char value read.| + | Type | Description | + | ------ | ---------------- | + | number | Char value read.| **Example** @@ -3973,15 +3973,15 @@ Writes a string to this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ----------------------------------------- | -| val | string | Yes | String to write. The length of the string must be less than 40960 bytes.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ----------------------------------------- | + | val | string | Yes | String to write. The length of the string must be less than 40960 bytes.| **Return value** -| Type | Description | -| ------- | --------------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -4001,9 +4001,9 @@ Reads the string from this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | -------------- | -| string | String read.| + | Type | Description | + | ------ | -------------- | + | string | String read.| **Example** @@ -4025,15 +4025,15 @@ Writes a sequenceable object to this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ----------------------------- | ---- | -------------------- | -| val | [Sequenceable](#sequenceable) | Yes | Sequenceable object to write.| + | Name| Type | Mandatory| Description | + | ------ | ----------------------------- | ---- | -------------------- | + | val | [Sequenceable](#sequenceable) | Yes | Sequenceable object to write.| **Return value** -| Type | Description | -| ------- | --------------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -4072,15 +4072,15 @@ Reads member variables from this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ----------------------------- | ---- | --------------------------------------- | -| dataIn | [Sequenceable](#sequenceabledeprecated) | Yes | Object that reads member variables from the **MessageParcel** object.| + | Name| Type | Mandatory| Description | + | ------ | ----------------------------- | ---- | --------------------------------------- | + | dataIn | [Sequenceable](#sequenceabledeprecated) | Yes | Object that reads member variables from the **MessageParcel** object.| **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** @@ -4122,15 +4122,15 @@ Writes a byte array to this **MessageParcel** object. **Parameters** -| Name | Type | Mandatory| Description | -| --------- | -------- | ---- | ------------------ | -| byteArray | number[] | Yes | Byte array to write.| + | Name | Type | Mandatory| Description | + | --------- | -------- | ---- | ------------------ | + | byteArray | number[] | Yes | Byte array to write.| **Return value** -| Type | Description | -| ------- | --------------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -4151,9 +4151,9 @@ Reads a byte array from this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | ------------------ | -| dataIn | number[] | Yes | Byte array to read.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | ------------------ | + | dataIn | number[] | Yes | Byte array to read.| **Example** @@ -4176,9 +4176,9 @@ Reads the byte array from this **MessageParcel** object. **Return value** -| Type | Description | -| -------- | -------------- | -| number[] | Byte array read.| + | Type | Description | + | -------- | -------------- | + | number[] | Byte array read.| **Example** @@ -4201,15 +4201,15 @@ Writes a short array to this **MessageParcel** object. **Parameters** -| Name | Type | Mandatory| Description | -| ---------- | -------- | ---- | -------------------- | -| shortArray | number[] | Yes | Short array to write.| + | Name | Type | Mandatory| Description | + | ---------- | -------- | ---- | -------------------- | + | shortArray | number[] | Yes | Short array to write.| **Return value** -| Type | Description | -| ------- | ----------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -4229,9 +4229,9 @@ Reads a short array from this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | -------------------- | -| dataIn | number[] | Yes | Short array to read.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | -------------------- | + | dataIn | number[] | Yes | Short array to read.| **Example** @@ -4253,9 +4253,9 @@ Reads the short array from this **MessageParcel** object. **Return value** -| Type | Description | -| -------- | ---------------- | -| number[] | Short array read.| + | Type | Description | + | -------- | ---------------- | + | number[] | Short array read.| **Example** @@ -4277,15 +4277,15 @@ Writes an integer array to this **MessageParcel** object. **Parameters** -| Name | Type | Mandatory| Description | -| -------- | -------- | ---- | ------------------ | -| intArray | number[] | Yes | Integer array to write.| + | Name | Type | Mandatory| Description | + | -------- | -------- | ---- | ------------------ | + | intArray | number[] | Yes | Integer array to write.| **Return value** -| Type | Description | -| ------- | ----------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -4305,9 +4305,9 @@ Reads an integer array from this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | ------------------ | -| dataIn | number[] | Yes | Integer array to read.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | ------------------ | + | dataIn | number[] | Yes | Integer array to read.| **Example** @@ -4329,9 +4329,9 @@ Reads the integer array from this **MessageParcel** object. **Return value** -| Type | Description | -| -------- | -------------- | -| number[] | Integer array read.| + | Type | Description | + | -------- | -------------- | + | number[] | Integer array read.| **Example** @@ -4353,15 +4353,15 @@ Writes a long array to this **MessageParcel** object. **Parameters** -| Name | Type | Mandatory| Description | -| --------- | -------- | ---- | -------------------- | -| longArray | number[] | Yes | Long array to write.| + | Name | Type | Mandatory| Description | + | --------- | -------- | ---- | -------------------- | + | longArray | number[] | Yes | Long array to write.| **Return value** -| Type | Description | -| ------- | ----------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -4381,9 +4381,9 @@ Reads a long array from this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | -------------------- | -| dataIn | number[] | Yes | Long array to read.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | -------------------- | + | dataIn | number[] | Yes | Long array to read.| **Example** @@ -4405,9 +4405,9 @@ Reads the long array from this **MessageParcel** object. **Return value** -| Type | Description | -| -------- | ---------------- | -| number[] | Long array read.| + | Type | Description | + | -------- | ---------------- | + | number[] | Long array read.| **Example** @@ -4429,15 +4429,15 @@ Writes a FloatArray to this **MessageParcel** object. **Parameters** -| Name| Type| Mandatory| Description| -| ---------- | -------- | ---- | --- | -| floatArray | number[] | Yes | Floating-point array to write. The system processes Float data as that of the Double type. Therefore, the total number of bytes occupied by a FloatArray must be calculated as the Double type.| + | Name| Type| Mandatory| Description| + | ---------- | -------- | ---- | --- | + | floatArray | number[] | Yes | Floating-point array to write. The system processes Float data as that of the Double type. Therefore, the total number of bytes occupied by a FloatArray must be calculated as the Double type.| **Return value** -| Type | Description | -| ------- | ----------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -4457,9 +4457,9 @@ Reads a FloatArray from this **MessageParcel** object. **Parameters** -| Name| Type| Mandatory| Description| -| ------ | -------- | ---- | ------ | -| dataIn | number[] | Yes | Floating-point array to read. The system processes Float data as that of the Double type. Therefore, the total number of bytes occupied by a FloatArray must be calculated as the Double type.| + | Name| Type| Mandatory| Description| + | ------ | -------- | ---- | ------ | + | dataIn | number[] | Yes | Floating-point array to read. The system processes Float data as that of the Double type. Therefore, the total number of bytes occupied by a FloatArray must be calculated as the Double type.| **Example** @@ -4481,9 +4481,9 @@ Reads the FloatArray from this **MessageParcel** object. **Return value** -| Type | Description | -| -------- | -------------- | -| number[] | FloatArray read.| + | Type | Description | + | -------- | -------------- | + | number[] | FloatArray read.| **Example** @@ -4505,15 +4505,15 @@ Writes a DoubleArray to this **MessageParcel** object. **Parameters** -| Name | Type | Mandatory| Description | -| ----------- | -------- | ---- | ------------------------ | -| doubleArray | number[] | Yes | DoubleArray to write.| + | Name | Type | Mandatory| Description | + | ----------- | -------- | ---- | ------------------------ | + | doubleArray | number[] | Yes | DoubleArray to write.| **Return value** -| Type | Description | -| ------- | ----------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -4533,9 +4533,9 @@ Reads a DoubleArray from this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | ------------------------ | -| dataIn | number[] | Yes | DoubleArray to read.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | ------------------------ | + | dataIn | number[] | Yes | DoubleArray to read.| **Example** @@ -4557,9 +4557,9 @@ Reads the DoubleArray from this **MessageParcel** object. **Return value** -| Type | Description | -| -------- | -------------------- | -| number[] | DoubleArray read.| + | Type | Description | + | -------- | -------------------- | + | number[] | DoubleArray read.| **Example** @@ -4581,15 +4581,15 @@ Writes a Boolean array to this **MessageParcel** object. **Parameters** -| Name | Type | Mandatory| Description | -| ------------ | --------- | ---- | ------------------ | -| booleanArray | boolean[] | Yes | Boolean array to write.| + | Name | Type | Mandatory| Description | + | ------------ | --------- | ---- | ------------------ | + | booleanArray | boolean[] | Yes | Boolean array to write.| **Return value** -| Type | Description | -| ------- | --------------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -4609,9 +4609,9 @@ Reads a Boolean array from this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | --------- | ---- | ------------------ | -| dataIn | boolean[] | Yes | Boolean array to read.| + | Name| Type | Mandatory| Description | + | ------ | --------- | ---- | ------------------ | + | dataIn | boolean[] | Yes | Boolean array to read.| **Example** @@ -4633,9 +4633,9 @@ Reads the Boolean array from this **MessageParcel** object. **Return value** -| Type | Description | -| --------- | -------------- | -| boolean[] | Boolean array read.| + | Type | Description | + | --------- | -------------- | + | boolean[] | Boolean array read.| **Example** @@ -4657,15 +4657,15 @@ Writes a character array to this **MessageParcel** object. **Parameters** -| Name | Type | Mandatory| Description | -| --------- | -------- | ---- | ---------------------- | -| charArray | number[] | Yes | Character array to write.| + | Name | Type | Mandatory| Description | + | --------- | -------- | ---- | ---------------------- | + | charArray | number[] | Yes | Character array to write.| **Return value** -| Type | Description | -| ------- | --------------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -4685,9 +4685,9 @@ Reads a character array from this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | ---------------------- | -| dataIn | number[] | Yes | Character array to read.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | ---------------------- | + | dataIn | number[] | Yes | Character array to read.| **Example** @@ -4709,9 +4709,9 @@ Reads the character array from this **MessageParcel** object. **Return value** -| Type | Description | -| -------- | ------------------ | -| number[] | Character array read.| + | Type | Description | + | -------- | ------------------ | + | number[] | Character array read.| **Example** @@ -4733,15 +4733,15 @@ Writes a string array to this **MessageParcel** object. **Parameters** -| Name | Type | Mandatory| Description| -| ----------- | -------- | ---- | ---------------- | -| stringArray | string[] | Yes | String array to write. The length of a single element in the array must be less than 40960 bytes.| + | Name | Type | Mandatory| Description| + | ----------- | -------- | ---- | ---------------- | + | stringArray | string[] | Yes | String array to write. The length of a single element in the array must be less than 40960 bytes.| **Return value** -| Type | Description| -| ------- | --------------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description| + | ------- | --------------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -4761,9 +4761,9 @@ Reads a string array from this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | -------------------- | -| dataIn | string[] | Yes | String array to read.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | -------------------- | + | dataIn | string[] | Yes | String array to read.| **Example** @@ -4785,9 +4785,9 @@ Reads the string array from this **MessageParcel** object. **Return value** -| Type | Description | -| -------- | ---------------- | -| string[] | String array read.| + | Type | Description | + | -------- | ---------------- | + | string[] | String array read.| **Example** @@ -4850,7 +4850,7 @@ Reads the exception information from this **MessageParcel** object. **System capability**: SystemCapability.Communication.IPC.Core **Example** - + Obtain the service. ```ts @@ -4875,7 +4875,7 @@ Reads the exception information from this **MessageParcel** object. FA.connectAbility(want, connect); ``` -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. ```ts let option = new rpc.MessageOption(); @@ -4912,15 +4912,15 @@ Writes a sequenceable array to this **MessageParcel** object. **Parameters** -| Name | Type | Mandatory| Description | -| ----------------- | -------------- | ---- | -------------------------- | -| sequenceableArray | Sequenceable[] | Yes | Sequenceable array to write.| + | Name | Type | Mandatory| Description | + | ----------------- | -------------- | ---- | -------------------------- | + | sequenceableArray | Sequenceable[] | Yes | Sequenceable array to write.| **Return value** -| Type | Description | -| ------- | --------------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -4962,9 +4962,9 @@ Reads a sequenceable array from this **MessageParcel** object. **Parameters** -| Name | Type | Mandatory| Description | -| ----------------- | -------------- | ---- | -------------------------- | -| sequenceableArray | Sequenceable[] | Yes | Sequenceable array to read.| + | Name | Type | Mandatory| Description | + | ----------------- | -------------- | ---- | -------------------------- | + | sequenceableArray | Sequenceable[] | Yes | Sequenceable array to read.| **Example** @@ -5008,15 +5008,15 @@ Writes an array of **IRemoteObject** objects to this **MessageParcel** object. **Parameters** -| Name | Type | Mandatory| Description| -| ----------- | --------------- | ---- | ----- | -| objectArray | IRemoteObject[] | Yes | Array of **IRemoteObject** objects to write.| + | Name | Type | Mandatory| Description| + | ----------- | --------------- | ---- | ----- | + | objectArray | IRemoteObject[] | Yes | Array of **IRemoteObject** objects to write.| **Return value** -| Type | Description | -| ------- | -------------------------------------------------------------------------------------------------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | -------------------------------------------------------------------------------------------------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -5060,9 +5060,9 @@ Reads an **IRemoteObject** array from this **MessageParcel** object. **Parameters** -| Name | Type | Mandatory| Description| -| ------- | --------------- | ---- | --------- | -| objects | IRemoteObject[] | Yes | **IRemoteObject** array to read.| + | Name | Type | Mandatory| Description| + | ------- | --------------- | ---- | --------- | + | objects | IRemoteObject[] | Yes | **IRemoteObject** array to read.| **Example** @@ -5107,9 +5107,9 @@ Reads the **IRemoteObject** array from this **MessageParcel** object. **Return value** -| Type| Description| -| --------------- | -------- | -| IRemoteObject[] | **IRemoteObject** object array obtained.| + | Type| Description| + | --------------- | -------- | + | IRemoteObject[] | **IRemoteObject** object array obtained.| **Example** @@ -5155,9 +5155,9 @@ Closes a file descriptor. This API is a static method. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | -------------------- | -| fd | number | Yes | File descriptor to close.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | -------------------- | + | fd | number | Yes | File descriptor to close.| **Example** @@ -5178,15 +5178,15 @@ Duplicates a file descriptor. This API is a static method. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------------ | -| fd | number | Yes | File descriptor to duplicate.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------------------ | + | fd | number | Yes | File descriptor to duplicate.| **Return value** -| Type | Description | -| ------ | -------------------- | -| number | New file descriptor.| + | Type | Description | + | ------ | -------------------- | + | number | New file descriptor.| **Example** @@ -5207,9 +5207,9 @@ Checks whether this **MessageParcel** object contains file descriptors. **Return value** -| Type | Description | -| ------- | ------------------------------------------------------------------ | -| boolean |Returns **true** if the **MessageParcel** object contains file descriptors; returns **false** otherwise.| + | Type | Description | + | ------- | ------------------------------------------------------------------ | + | boolean |Returns **true** if the **MessageParcel** object contains file descriptors; returns **false** otherwise.| **Example** @@ -5235,15 +5235,15 @@ Writes a file descriptor to this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------ | -| fd | number | Yes | File descriptor to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------ | + | fd | number | Yes | File descriptor to write.| **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** @@ -5266,9 +5266,9 @@ Reads the file descriptor from this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | ---------------- | -| number | File descriptor read.| + | Type | Description | + | ------ | ---------------- | + | number | File descriptor read.| **Example** @@ -5292,15 +5292,15 @@ Writes an anonymous shared object to this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ----------------------------------- | -| ashmem | Ashmem | Yes | Anonymous shared object to write.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ----------------------------------- | + | ashmem | Ashmem | Yes | Anonymous shared object to write.| **Return value** -| Type | Description | -| ------- | -------------------------------------------------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | -------------------------------------------------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -5321,9 +5321,9 @@ Reads the anonymous shared object from this **MessageParcel** object. **Return value** -| Type | Description | -| ------ | ------------------ | -| Ashmem | Anonymous share object obtained.| + | Type | Description | + | ------ | ------------------ | + | Ashmem | Anonymous share object obtained.| **Example** @@ -5346,9 +5346,9 @@ Obtains the maximum amount of raw data that can be held by this **MessageParcel* **Return value** -| Type | Description | -| ------ | ---------------------------------------------------------- | -| number | 128 MB, which is the maximum amount of raw data that can be held by this **MessageParcel** object.| + | Type | Description | + | ------ | ---------------------------------------------------------- | + | number | 128 MB, which is the maximum amount of raw data that can be held by this **MessageParcel** object.| **Example** @@ -5368,16 +5368,16 @@ Writes raw data to this **MessageParcel** object. **Parameters** -| Name | Type | Mandatory| Description | -| ------- | -------- | ---- | ---------------------------------- | -| rawData | number[] | Yes | Raw data to write. | -| size | number | Yes | Size of the raw data, in bytes.| + | Name | Type | Mandatory| Description | + | ------- | -------- | ---- | ---------------------------------- | + | rawData | number[] | Yes | Raw data to write. | + | size | number | Yes | Size of the raw data, in bytes.| **Return value** -| Type | Description | -| ------- | ----------------------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -5398,15 +5398,15 @@ Reads raw data from this **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------------ | -| size | number | Yes | Size of the raw data to read.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------------------ | + | size | number | Yes | Size of the raw data to read.| **Return value** -| Type | Description | -| -------- | ------------------------------ | -| number[] | Raw data obtained, in bytes.| + | Type | Description | + | -------- | ------------------------------ | + | number[] | Raw data obtained, in bytes.| **Example** @@ -5433,15 +5433,15 @@ Marshals this **Parcelable** object into a **MessageSequence** object. **Parameters** -| Name | Type | Mandatory| Description | -| ------- | --------------- | ---- | ------------------------------------------- | -| dataOut | MessageSequence | Yes | **MessageSequence** object to which the **Parcelable** object is to be marshaled.| + | Name | Type | Mandatory| Description | + | ------- | --------------- | ---- | ------------------------------------------- | + | dataOut | MessageSequence | Yes | **MessageSequence** object to which the **Parcelable** object is to be marshaled.| **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** ```ts @@ -5482,15 +5482,15 @@ Unmarshals this **Parcelable** object from a **MessageSequence** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | --------------- | ---- | ----------------------------------------------- | -| dataIn | MessageSequence | Yes | **MessageSequence** object from which the **Parcelable** object is to be unmarshaled.| + | Name| Type | Mandatory| Description | + | ------ | --------------- | ---- | ----------------------------------------------- | + | dataIn | MessageSequence | Yes | **MessageSequence** object from which the **Parcelable** object is to be unmarshaled.| **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** @@ -5538,15 +5538,15 @@ Marshals the sequenceable object into a **MessageParcel** object. **Parameters** -| Name | Type | Mandatory| Description | -| ------- | ------------------------------- | ---- | ----------------------------------------- | -| dataOut | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object to which the sequenceable object is to be marshaled.| + | Name | Type | Mandatory| Description | + | ------- | ------------------------------- | ---- | ----------------------------------------- | + | dataOut | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object to which the sequenceable object is to be marshaled.| **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** ```ts @@ -5587,15 +5587,15 @@ Unmarshals this sequenceable object from a **MessageParcel** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------------------------------- | ---- | --------------------------------------------- | -| dataIn | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object in which the sequenceable object is to be unmarshaled.| + | Name| Type | Mandatory| Description | + | ------ | ------------------------------- | ---- | --------------------------------------------- | + | dataIn | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object in which the sequenceable object is to be unmarshaled.| **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** @@ -5641,9 +5641,9 @@ Obtains a proxy or remote object. This API must be implemented by its derived cl **Return value** -| Type | Description| -| ---- | ----- | -| [IRemoteObject](#iremoteobject) | Returns the **RemoteObject** if it is the caller; returns the [IRemoteObject](#iremoteobject), the holder of this **RemoteProxy** object, if the caller is a [RemoteProxy](#remoteproxy) object.| + | Type | Description| + | ---- | ----- | + | [IRemoteObject](#iremoteobject) | Returns the **RemoteObject** if it is the caller; returns the [IRemoteObject](#iremoteobject), the holder of this **RemoteProxy** object, if the caller is a [RemoteProxy](#remoteproxy) object.| **Example** @@ -5653,7 +5653,7 @@ Obtains a proxy or remote object. This API must be implemented by its derived cl return this; } } - let remoteObject = new TestAbility().asObject(); + let remoteObject = new TestAbility("testObject").asObject(); ``` **Example** @@ -5681,9 +5681,9 @@ Obtains a proxy or remote object. This API must be implemented by its derived cl }; FA.connectAbility(want, connect); ``` - -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **asObject()** of the proxy object is called to obtain the proxy or remote object. - + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **asObject()** of the proxy object is called to obtain the proxy or remote object. + ```ts class TestProxy { remote: rpc.RemoteObject; @@ -5726,12 +5726,12 @@ Defines the response to the request. **System capability**: SystemCapability.Communication.IPC.Core -| Name | Type | Readable| Writable| Description | -| ------- | --------------- | ---- | ---- |-------------------------------------- | -| errCode | number | Yes | No | Error Code | -| code | number | Yes | No | Message code. | -| data | MessageSequence | Yes | No | **MessageSequence** object sent to the remote process.| -| reply | MessageSequence | Yes | No | **MessageSequence** object returned by the remote process. | + | Name | Type | Readable| Writable| Description | + | ------- | --------------- | ---- | ---- |-------------------------------------- | + | errCode | number | Yes | No | Error code. | + | code | number | Yes | No | Message code. | + | data | MessageSequence | Yes | No | **MessageSequence** object sent to the remote process.| + | reply | MessageSequence | Yes | No | **MessageSequence** object returned by the remote process. | ## SendRequestResult8+(deprecated) @@ -5741,12 +5741,12 @@ Defines the response to the request. **System capability**: SystemCapability.Communication.IPC.Core -| Name | Type | Readable| Writable| Description | -| ------- | ------------- | ---- | ---- | ----------------------------------- | -| errCode | number | Yes | No | Error Code | -| code | number | Yes | No | Message code. | -| data | MessageParcel | Yes | No | **MessageParcel** object sent to the remote process.| -| reply | MessageParcel | Yes | No | **MessageParcel** object returned by the remote process. | + | Name | Type | Readable| Writable| Description | + | ------- | ------------- | ---- | ---- | ----------------------------------- | + | errCode | number | Yes | No | Error code. | + | code | number | Yes | No | Message code. | + | data | MessageParcel | Yes | No | **MessageParcel** object sent to the remote process.| + | reply | MessageParcel | Yes | No | **MessageParcel** object returned by the remote process. | ## IRemoteObject @@ -5762,15 +5762,15 @@ Obtains the interface descriptor. **Parameters** -| Name | Type | Mandatory| Description | -| ---------- | ------ | ---- | -------------------- | -| descriptor | string | Yes | Interface descriptor.| + | Name | Type | Mandatory| Description | + | ---------- | ------ | ---- | -------------------- | + | descriptor | string | Yes | Interface descriptor.| **Return value** -| Type | Description | -| ------------- | --------------------------------------------- | -| IRemoteBroker | **IRemoteBroker** object bound to the specified interface token.| + | Type | Description | + | ------------- | --------------------------------------------- | + | IRemoteBroker | **IRemoteBroker** object bound to the specified interface token.| ### queryLocalInterface(deprecated) @@ -5784,15 +5784,15 @@ Queries the interface descriptor. **Parameters** -| Name | Type | Mandatory| Description | -| ---------- | ------ | ---- | -------------------- | -| descriptor | string | Yes | Interface descriptor.| + | Name | Type | Mandatory| Description | + | ---------- | ------ | ---- | -------------------- | + | descriptor | string | Yes | Interface descriptor.| **Return value** -| Type | Description | -| ------------- | --------------------------------------------- | -| IRemoteBroker | **IRemoteBroker** object bound to the specified interface token.| + | Type | Description | + | ------------- | --------------------------------------------- | + | IRemoteBroker | **IRemoteBroker** object bound to the specified interface token.| ### sendRequest(deprecated) @@ -5806,18 +5806,18 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch **Parameters** -| Name | Type| Mandatory| Description | -| ------- | ------------------------------- | ---- | ---- | -| code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| -| data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | -| reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | -| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | + | Name | Type| Mandatory| Description | + | ------- | ------------------------------- | ---- | ---- | + | code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| + | data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | + | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | + | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | **Return value** -| Type | Description | -| ------- | --------------------------------------------- | -| boolean | Returns **true** if the message is sent successfully; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------------------- | + | boolean | Returns **true** if the message is sent successfully; returns **false** otherwise.| ### sendRequest8+(deprecated) @@ -5832,18 +5832,18 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch **Parameters** -| Name | Type | Mandatory| Description | -| ------- | ------------------------------- | ---- | -------------------------------------------------------------------------------------- | -| code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| -| data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | -| reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | -| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | + | Name | Type | Mandatory| Description | + | ------- | ------------------------------- | ---- | -------------------------------------------------------------------------------------- | + | code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| + | data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | + | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | + | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | **Return value** -| Type | Description | -| -------------------------------- | --------------------------------------------- | -| Promise<SendRequestResult> | Promise used to return the **sendRequestResult** object.| + | Type | Description | + | -------------------------------- | --------------------------------------------- | + | Promise<SendRequestResult> | Promise used to return the **sendRequestResult** object.| ### sendMessageRequest9+ @@ -5856,18 +5856,18 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn **Parameters** -| Name | Type | Mandatory| Description | -| ------- | ------------------------------- | ---- | -------------------------------------------------------------------------------------- | -| code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| -| data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. | -| reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | -| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | + | Name | Type | Mandatory| Description | + | ------- | ------------------------------- | ---- | -------------------------------------------------------------------------------------- | + | code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| + | data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. | + | reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | + | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | **Return value** -| Type | Description | -| ---------------------------- | ----------------------------------------- | -| Promise<RequestResult> | Promise used to return the **requestResult** object.| + | Type | Description | + | ---------------------------- | ----------------------------------------- | + | Promise<RequestResult> | Promise used to return the **requestResult** object.| ### sendMessageRequest9+ @@ -5880,13 +5880,13 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ---------------------------------- | ---- | -------------------------------------------------------------------------------------- | -| code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| -| data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. | -| reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | -| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | -| callback | AsyncCallback<RequestResult> | Yes | Callback for receiving the sending result. | + | Name | Type | Mandatory| Description | + | -------- | ---------------------------------- | ---- | -------------------------------------------------------------------------------------- | + | code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| + | data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. | + | reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | + | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | + | callback | AsyncCallback<RequestResult> | Yes | Callback for receiving the sending result. | ### sendRequest8+(deprecated) @@ -5900,13 +5900,13 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch **Parameters** -| Name | Type | Mandatory| Description | -| -------- | -------------------------------------- | ---- | -------------------------------------------------------------------------------------- | -| code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| -| data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | -| reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | -| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | -| callback | AsyncCallback<SendRequestResult> | Yes | Callback for receiving the sending result. | + | Name | Type | Mandatory| Description | + | -------- | -------------------------------------- | ---- | -------------------------------------------------------------------------------------- | + | code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| + | data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | + | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | + | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | + | callback | AsyncCallback<SendRequestResult> | Yes | Callback for receiving the sending result. | ### registerDeathRecipient9+ @@ -5918,18 +5918,18 @@ Registers a callback for receiving death notifications of the remote object. The **Parameters** -| Name | Type | Mandatory| Description | -| --------- | --------------------------------- | ---- | -------------- | -| recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to register.| -| flags | number | Yes | Flag of the death notification.| + | Name | Type | Mandatory| Description | + | --------- | --------------------------------- | ---- | -------------- | + | recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to register.| + | flags | number | Yes | Flag of the death notification.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900008 | proxy or remote object is invalid | + | ID| Error Message| + | ------- | -------- | + | 1900008 | proxy or remote object is invalid | ### addDeathrecipient(deprecated) @@ -5943,16 +5943,16 @@ Adds a callback for receiving death notifications of the remote object. This met **Parameters** -| Name | Type | Mandatory| Description | -| --------- | --------------------------------- | ---- | -------------- | -| recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to add.| -| flags | number | Yes | Flag of the death notification.| + | Name | Type | Mandatory| Description | + | --------- | --------------------------------- | ---- | -------------- | + | recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to add.| + | flags | number | Yes | Flag of the death notification.| **Return value** -| Type | Description | -| ------- | --------------------------------------------- | -| boolean | Returns **true** if the callback is added successfully; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------------------- | + | boolean | Returns **true** if the callback is added successfully; returns **false** otherwise.| ### unregisterDeathRecipient9+ @@ -5965,18 +5965,18 @@ Unregisters the callback used to receive death notifications of the remote objec **Parameters** -| Name | Type | Mandatory| Description | -| --------- | --------------------------------- | ---- | -------------- | -| recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to unregister.| -| flags | number | Yes | Flag of the death notification.| + | Name | Type | Mandatory| Description | + | --------- | --------------------------------- | ---- | -------------- | + | recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to unregister.| + | flags | number | Yes | Flag of the death notification.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900008 | proxy or remote object is invalid | + | ID| Error Message| + | ------- | -------- | + | 1900008 | proxy or remote object is invalid | ### removeDeathRecipient(deprecated) @@ -5990,16 +5990,16 @@ Removes the callback used to receive death notifications of the remote object. **Parameters** -| Name | Type | Mandatory| Description | -| --------- | --------------------------------- | ---- | -------------- | -| recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to remove.| -| flags | number | Yes | Flag of the death notification.| + | Name | Type | Mandatory| Description | + | --------- | --------------------------------- | ---- | -------------- | + | recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to remove.| + | flags | number | Yes | Flag of the death notification.| **Return value** -| Type | Description | -| ------- | --------------------------------------------- | -| boolean | Returns **true** if the callback is removed; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------------------- | + | boolean | Returns **true** if the callback is removed; returns **false** otherwise.| ### getDescriptor9+ @@ -6011,17 +6011,17 @@ Obtains the interface descriptor (which is a string) of this object. **Return value** -| Type | Description | -| ------ | ---------------- | -| string | Interface descriptor obtained.| + | Type | Description | + | ------ | ---------------- | + | string | Interface descriptor obtained.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900008 | proxy or remote object is invalid | + | ID| Error Message| + | ------- | -------- | + | 1900008 | proxy or remote object is invalid | ### getInterfaceDescriptor(deprecated) @@ -6036,9 +6036,9 @@ Obtains the interface descriptor (which is a string) of this object. **Return value** -| Type | Description | -| ------ | ---------------- | -| string | Interface descriptor obtained.| + | Type | Description | + | ------ | ---------------- | + | string | Interface descriptor obtained.| ### isObjectDead @@ -6051,9 +6051,9 @@ Checks whether this object is dead. **Return value** -| Type | Description | -| ------- | ------------------------------------------- | -| boolean | Returns **true** if the object is dead; returns **false** otherwise.| + | Type | Description | + | ------- | ------------------------------------------- | + | boolean | Returns **true** if the object is dead; returns **false** otherwise.| ## RemoteProxy @@ -6082,18 +6082,18 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch **Parameters** -| Name | Type | Mandatory| Description | -| ------- | ------------------------------- | ---- | -------------------------------------------------------------------------------------- | -| code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| -| data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | -| reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | -| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | + | Name | Type | Mandatory| Description | + | ------- | ------------------------------- | ---- | -------------------------------------------------------------------------------------- | + | code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| + | data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | + | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | + | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | **Return value** -| Type | Description | -| ------- | --------------------------------------------- | -| boolean | Returns **true** if the message is sent successfully; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------------------- | + | boolean | Returns **true** if the message is sent successfully; returns **false** otherwise.| **Example** @@ -6120,9 +6120,9 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch }; FA.connectAbility(want, connect); ``` - -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. - + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. + ```ts let option = new rpc.MessageOption(); let data = rpc.MessageParcel.create(); @@ -6152,18 +6152,18 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn **Parameters** -| Name | Type | Mandatory| Description | -| ------- | ------------------------------- | ---- | -------------------------------------------------------------------------------------- | -| code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| -| data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. | -| reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | -| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | + | Name | Type | Mandatory| Description | + | ------- | ------------------------------- | ---- | -------------------------------------------------------------------------------------- | + | code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| + | data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. | + | reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | + | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | **Return value** -| Type | Description | -| ---------------------------- | ----------------------------------------- | -| Promise<RequestResult> | Promise used to return the **requestResult** object.| + | Type | Description | + | ---------------------------- | ----------------------------------------- | + | Promise<RequestResult> | Promise used to return the **requestResult** object.| **Example** @@ -6190,8 +6190,8 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn }; FA.connectAbility(want, connect); ``` - -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. ```ts let option = new rpc.MessageOption(); @@ -6230,18 +6230,18 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch **Parameters** -| Name | Type | Mandatory| Description | -| ------- | ------------------------------- | ---- | -------------------------------------------------------------------------------------- | -| code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| -| data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | -| reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | -| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | + | Name | Type | Mandatory| Description | + | ------- | ------------------------------- | ---- | -------------------------------------------------------------------------------------- | + | code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| + | data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | + | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | + | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | **Return value** -| Type | Description | -| -------------------------------- | --------------------------------------------- | -| Promise<SendRequestResult> | Promise used to return the **sendRequestResult** object.| + | Type | Description | + | -------------------------------- | --------------------------------------------- | + | Promise<SendRequestResult> | Promise used to return the **sendRequestResult** object.| **Example** @@ -6269,7 +6269,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch FA.connectAbility(want, connect); ``` -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. ```ts let option = new rpc.MessageOption(); @@ -6300,22 +6300,22 @@ The proxy object in the **onConnect** callback can be assigned a value only afte sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption, callback: AsyncCallback<RequestResult>): void -Sends a **MessageSequence** message to the remote process in synchronous or asynchronous mode. If asynchronous mode is set in **options**, a callback will be called immediately, and the reply message is empty. The specific reply needs to be obtained from the callback on the service side. If **options** is the synchronous mode, a callback will be invoked at certain time after the response to **sendMessageRequest** is returned, and the reply contains the returned information. +Sends a **MessageSequence** message to the remote process in synchronous or asynchronous mode. If asynchronous mode is set in **options**, a callback will be called immediately, and the reply message is empty. The specific reply needs to be obtained from the callback on the service side. If synchronous mode is set in **options**, a callback will be invoked at certain time after the response to **sendMessageRequest** is returned, and the reply contains the returned information. **System capability**: SystemCapability.Communication.IPC.Core **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ---------------------------------- | ---- | -------------------------------------------------------------------------------------- | -| code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| -| data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. | -| reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | -| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | -| callback | AsyncCallback<RequestResult> | Yes | Callback for receiving the sending result. | + | Name | Type | Mandatory| Description | + | -------- | ---------------------------------- | ---- | -------------------------------------------------------------------------------------- | + | code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| + | data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. | + | reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | + | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | + | callback | AsyncCallback<RequestResult> | Yes | Callback for receiving the sending result. | **Example** - + Obtain the service. ```ts @@ -6353,7 +6353,7 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn FA.connectAbility(want, connect); ``` -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. ```ts let option = new rpc.MessageOption(); @@ -6381,13 +6381,13 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch **Parameters** -| Name | Type | Mandatory| Description | -| -------- | -------------------------------------- | ---- | -------------------------------------------------------------------------------------- | -| code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| -| data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | -| reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | -| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | -| callback | AsyncCallback<SendRequestResult> | Yes | Callback for receiving the sending result. | + | Name | Type | Mandatory| Description | + | -------- | -------------------------------------- | ---- | -------------------------------------------------------------------------------------- | + | code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| + | data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | + | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | + | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | + | callback | AsyncCallback<SendRequestResult> | Yes | Callback for receiving the sending result. | **Example** @@ -6428,7 +6428,7 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch FA.connectAbility(want, connect); ``` -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **sendMessageRequest()** of the proxy object is called to send a message. ```ts let option = new rpc.MessageOption(); @@ -6449,23 +6449,23 @@ Obtains the **LocalInterface** object of an interface token. **Parameters** -| Name | Type | Mandatory| Description | -| --------- | ------ | ---- | ---------------------- | -| interface | string | Yes | Interface descriptor.| + | Name | Type | Mandatory| Description | + | --------- | ------ | ---- | ---------------------- | + | interface | string | Yes | Interface descriptor.| **Return value** -| Type | Description | -| ------------- | ------------------------------------------ | -| IRemoteBroker | Returns **Null** by default, which indicates a proxy interface.| + | Type | Description | + | ------------- | ------------------------------------------ | + | IRemoteBroker | Returns **Null** by default, which indicates a proxy interface.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900006 | only remote object permitted | + | ID| Error Message| + | ------- | -------- | + | 1900006 | only remote object permitted | **Example** @@ -6493,7 +6493,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode FA.connectAbility(want, connect); ``` -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **getLocalInterface()** of the proxy object is called to obtain the interface descriptor. + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **getLocalInterface()** of the proxy object is called to obtain the interface descriptor. ```ts try { @@ -6517,15 +6517,15 @@ Obtains the **LocalInterface** object of an interface token. **Parameters** -| Name | Type | Mandatory| Description | -| --------- | ------ | ---- | ---------------------- | -| interface | string | Yes | Interface descriptor.| + | Name | Type | Mandatory| Description | + | --------- | ------ | ---- | ---------------------- | + | interface | string | Yes | Interface descriptor.| **Return value** -| Type | Description | -| ------------- | ------------------------------------------ | -| IRemoteBroker | Returns **Null** by default, which indicates a proxy interface.| + | Type | Description | + | ------------- | ------------------------------------------ | + | IRemoteBroker | Returns **Null** by default, which indicates a proxy interface.| **Example** @@ -6552,8 +6552,8 @@ Obtains the **LocalInterface** object of an interface token. }; FA.connectAbility(want, connect); ``` - -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **queryLocalInterface()** of the proxy object is called to obtain the interface descriptor. + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **queryLocalInterface()** of the proxy object is called to obtain the interface descriptor. ```ts let broker = proxy.queryLocalInterface("testObject"); @@ -6570,18 +6570,18 @@ Registers a callback for receiving death notifications of the remote object. The **Parameters** -| Name | Type | Mandatory| Description | -| --------- | --------------------------------- | ---- | -------------- | -| recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to register.| -| flags | number | Yes | Flag of the death notification.| + | Name | Type | Mandatory| Description | + | --------- | --------------------------------- | ---- | -------------- | + | recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to register.| + | flags | number | Yes | Flag of the death notification.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900008 | proxy or remote object is invalid | + | ID| Error Message| + | ------- | -------- | + | 1900008 | proxy or remote object is invalid | **Example** @@ -6609,8 +6609,8 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode FA.connectAbility(want, connect); ``` -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **registerDeathRecipient()** of the proxy object is called to register a callback for receiving the death notification of the remote object. - + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **registerDeathRecipient()** of the proxy object is called to register a callback for receiving the death notification of the remote object. + ```ts class MyDeathRecipient { onRemoteDied() { @@ -6638,16 +6638,16 @@ Adds a callback for receiving the death notifications of the remote object, incl **Parameters** -| Name | Type | Mandatory| Description | -| --------- | --------------------------------- | ---- | --------------------------------- | -| recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to add. | -| flags | number | Yes | Flag of the death notification. This parameter is reserved. It is set to **0**.| + | Name | Type | Mandatory| Description | + | --------- | --------------------------------- | ---- | --------------------------------- | + | recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to add. | + | flags | number | Yes | Flag of the death notification. This parameter is reserved. It is set to **0**.| **Return value** -| Type | Description | -| ------- | --------------------------------------------- | -| boolean | Returns **true** if the callback is added successfully; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------------------- | + | boolean | Returns **true** if the callback is added successfully; returns **false** otherwise.| **Example** @@ -6674,8 +6674,8 @@ Adds a callback for receiving the death notifications of the remote object, incl }; FA.connectAbility(want, connect); ``` - -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **addDeathRecippient()** of the proxy object is called to add a callback for receiving the death notification of the remove object. + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **addDeathRecippient()** of the proxy object is called to add a callback for receiving the death notification of the remove object. ```ts class MyDeathRecipient { @@ -6697,18 +6697,18 @@ Unregisters the callback used to receive death notifications of the remote objec **Parameters** -| Name | Type | Mandatory| Description | -| --------- | --------------------------------- | ---- | -------------- | -| recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to unregister.| -| flags | number | Yes | Flag of the death notification.| + | Name | Type | Mandatory| Description | + | --------- | --------------------------------- | ---- | -------------- | + | recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to unregister.| + | flags | number | Yes | Flag of the death notification.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900008 | proxy or remote object is invalid | + | ID| Error Message| + | ------- | -------- | + | 1900008 | proxy or remote object is invalid | **Example** @@ -6735,8 +6735,8 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode }; FA.connectAbility(want, connect); ``` - -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **unregisterDeathRecipient()** of the proxy object is called to unregister the callback for receiving the death notification of the remote object. + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **unregisterDeathRecipient()** of the proxy object is called to unregister the callback for receiving the death notification of the remote object. ```ts class MyDeathRecipient { @@ -6766,16 +6766,16 @@ Removes the callback used to receive death notifications of the remote object. **Parameters** -| Name | Type | Mandatory| Description | -| --------- | --------------------------------- | ---- | --------------------------------- | -| recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to remove. | -| flags | number | Yes | Flag of the death notification. This parameter is reserved. It is set to **0**.| + | Name | Type | Mandatory| Description | + | --------- | --------------------------------- | ---- | --------------------------------- | + | recipient | [DeathRecipient](#deathrecipient) | Yes | Callback to remove. | + | flags | number | Yes | Flag of the death notification. This parameter is reserved. It is set to **0**.| **Return value** -| Type | Description | -| ------- | --------------------------------------------- | -| boolean | Returns **true** if the callback is removed; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------------------- | + | boolean | Returns **true** if the callback is removed; returns **false** otherwise.| **Example** @@ -6802,8 +6802,8 @@ Removes the callback used to receive death notifications of the remote object. }; FA.connectAbility(want, connect); ``` - -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **removeDeathRecipient()** of the proxy object is called to remove the callback used to receive the death notification of the remote object. + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **removeDeathRecipient()** of the proxy object is called to remove the callback used to receive the death notification of the remote object. ```ts class MyDeathRecipient { @@ -6826,18 +6826,18 @@ Obtains the interface descriptor (which is a string) of this proxy object. **Return value** -| Type | Description | -| ------ | ---------------- | -| string | Interface descriptor obtained.| + | Type | Description | + | ------ | ---------------- | + | string | Interface descriptor obtained.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| -------- | ------- | -| 1900008 | proxy or remote object is invalid | -| 1900007 | communication failed | + | ID| Error Message| + | -------- | ------- | + | 1900008 | proxy or remote object is invalid | + | 1900007 | communication failed | **Example** @@ -6864,7 +6864,7 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode }; FA.connectAbility(want, connect); ``` -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **getDescriptor()** of the proxy object is called to obtain the interface descriptor of the object. + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **getDescriptor()** of the proxy object is called to obtain the interface descriptor of the object. ```ts try { @@ -6888,9 +6888,9 @@ Obtains the interface descriptor of this proxy object. **Return value** -| Type | Description | -| ------ | ------------------ | -| string | Interface descriptor obtained.| + | Type | Description | + | ------ | ------------------ | + | string | Interface descriptor obtained.| **Example** @@ -6917,8 +6917,8 @@ Obtains the interface descriptor of this proxy object. }; FA.connectAbility(want, connect); ``` - -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **getInterfaceDescriptor()** of the proxy object is called to obtain the interface descriptor of the current proxy object. + + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **getInterfaceDescriptor()** of the proxy object is called to obtain the interface descriptor of the current proxy object. ```ts let descriptor = proxy.getInterfaceDescriptor(); @@ -6935,9 +6935,9 @@ Checks whether the **RemoteObject** is dead. **Return value** -| Type | Description | -| ------- | --------------------------------------------------------- | -| boolean | Returns **true** if the **RemoteObject** is dead; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------------------------------- | + | boolean | Returns **true** if the **RemoteObject** is dead; returns **false** otherwise.| **Example** @@ -6965,7 +6965,7 @@ Checks whether the **RemoteObject** is dead. FA.connectAbility(want, connect); ``` -The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **isObjectDead()** of the proxy object is called to check whether this object is dead. + The proxy object in the **onConnect** callback can be assigned a value only after the ability is connected asynchronously. Then, **isObjectDead()** of the proxy object is called to check whether this object is dead. ```ts let isDead = proxy.isObjectDead(); @@ -6978,12 +6978,12 @@ Provides common message options (flag and wait time). Use the specified flag to **System capability**: SystemCapability.Communication.IPC.Core -| Name | Value | Description | -| ------------- | ---- | ----------------------------------------------------------- | -| TF_SYNC | 0 | Synchronous call. | -| TF_ASYNC | 1 | Asynchronous call. | -| TF_ACCEPT_FDS | 0x10 | Indication to **sendMessageRequest9+** for returning the file descriptor.| -| TF_WAIT_TIME | 8 | Default waiting time, in seconds. | + | Name | Value | Description | + | ------------- | ---- | ----------------------------------------------------------- | + | TF_SYNC | 0 | Synchronous call. | + | TF_ASYNC | 1 | Asynchronous call. | + | TF_ACCEPT_FDS | 0x10 | Indication to **sendMessageRequest9+** for returning the file descriptor.| + | TF_WAIT_TIME | 8 | Default waiting time, in seconds. | ### constructor9+ @@ -6996,9 +6996,9 @@ A constructor used to create a **MessageOption** object. **Parameters** -| Name | Type | Mandatory| Description | -| --------- | ------ | ---- | -------------------------------------- | -| syncFlags | number | No | Call flag, which can be synchronous or asynchronous. The default value is **synchronous**.| + | Name | Type | Mandatory| Description | + | --------- | ------ | ---- | -------------------------------------- | + | syncFlags | number | No | Call flag, which can be synchronous or asynchronous. The default value is **synchronous**.| **Example** @@ -7021,10 +7021,10 @@ A constructor used to create a **MessageOption** object. **Parameters** -| Name | Type | Mandatory| Description | -| --------- | ------ | ---- | --------------------------------------------- | -| syncFlags | number | No | Call flag, which can be synchronous or asynchronous. The default value is **synchronous**. | -| waitTime | number | No | Maximum wait time for an RPC call. The default value is **TF_WAIT_TIME**.| + | Name | Type | Mandatory| Description | + | --------- | ------ | ---- | --------------------------------------------- | + | syncFlags | number | No | Call flag, which can be synchronous or asynchronous. The default value is **synchronous**. | + | waitTime | number | No | Maximum wait time for an RPC call. The default value is **TF_WAIT_TIME**.| **Example** @@ -7045,9 +7045,9 @@ Checks whether **SendMessageRequest** is called synchronously or asynchronously. **Return value** -| Type | Description | -| ------- | ------------------------------------ | -| boolean | Returns **true** if **SendMessageRequest** is called synchronously; returns **false** if **SendMessageRequest** is called asynchronously.| + | Type | Description | + | ------- | ------------------------------------ | + | boolean | Returns **true** if **SendMessageRequest** is called synchronously; returns **false** if **SendMessageRequest** is called asynchronously.| **Example** @@ -7082,9 +7082,9 @@ Obtains the call flag, which can be synchronous or asynchronous. **Return value** -| Type | Description | -| ------ | ------------------------------------ | -| number | Call mode obtained.| + | Type | Description | + | ------ | ------------------------------------ | + | number | Call mode obtained.| **Example** @@ -7113,9 +7113,9 @@ Sets the call flag, which can be synchronous or asynchronous. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------------------ | -| flags | number | Yes | Call flag to set.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ------------------------ | + | flags | number | Yes | Call flag to set.| **Example** @@ -7141,9 +7141,9 @@ Obtains the maximum wait time for this RPC call. **Return value** -| Type | Description | -| ------ | ----------------- | -| number | Maximum wait time obtained.| + | Type | Description | + | ------ | ----------------- | + | number | Maximum wait time obtained.| **Example** @@ -7170,9 +7170,9 @@ Sets the maximum wait time for this RPC call. **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ------ | ---- | --------------------- | -| waitTime | number | Yes | Maximum wait time to set.| + | Name | Type | Mandatory| Description | + | -------- | ------ | ---- | --------------------- | + | waitTime | number | Yes | Maximum wait time to set.| **Example** @@ -7201,9 +7201,9 @@ Obtains the system capability manager. This API is a static method. **Return value** -| Type | Description | -| ------------------------------- | -------------------- | -| [IRemoteObject](#iremoteobject) | System capability manager obtained.| + | Type | Description | + | ------------------------------- | -------------------- | + | [IRemoteObject](#iremoteobject) | System capability manager obtained.| **Example** @@ -7222,9 +7222,9 @@ Obtains the PID of the caller. This API is a static method, which is invoked by **Return value** -| Type | Description | -| ------ | ----------------- | -| number | PID of the caller.| + | Type | Description | + | ------ | ----------------- | + | number | PID of the caller.| **Example** @@ -7248,9 +7248,9 @@ Obtains the UID of the caller. This API is a static method, which is invoked by **Return value** -| Type | Description | -| ------ | ----------------- | -| number | UID of the caller.| + | Type | Description | + | ------ | ----------------- | + | number | UID of the caller.| **Example** @@ -7274,9 +7274,9 @@ Obtains the caller's token ID, which is used to verify the caller identity. **Return value** -| Type | Description | -| ------ | --------------------- | -| number | Token ID of the caller obtained.| + | Type | Description | + | ------ | --------------------- | + | number | Token ID of the caller obtained.| **Example** @@ -7301,9 +7301,9 @@ Obtains the ID of the device hosting the caller's process. This API is a static **Return value** -| Type | Description | -| ------ | ---------------------------- | -| string | Device ID obtained.| + | Type | Description | + | ------ | ---------------------------- | + | string | Device ID obtained.| **Example** @@ -7327,9 +7327,9 @@ Obtains the local device ID. This API is a static method. **Return value** -| Type | Description | -| ------ | ------------------ | -| string | Local device ID obtained.| + | Type | Description | + | ------ | ------------------ | + | string | Local device ID obtained.| **Example** @@ -7353,9 +7353,9 @@ Checks whether the remote process is a process of the local device. This API is **Return value** -| Type | Description | -| ------- | --------------------------------------------------------- | -| boolean | Returns **true** if the local and remote processes are on the same device; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------------------------------- | + | boolean | Returns **true** if the local and remote processes are on the same device; returns **false** otherwise.| **Example** @@ -7379,9 +7379,9 @@ Flushes all suspended commands from the specified **RemoteProxy** to the corresp **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------------------------------- | ---- | ------------------- | -| object | [IRemoteObject](#iremoteobject) | Yes | **RemoteProxy** specified. | + | Name| Type | Mandatory| Description | + | ------ | ------------------------------- | ---- | ------------------- | + | object | [IRemoteObject](#iremoteobject) | Yes | **RemoteProxy** specified. | **Example** @@ -7413,15 +7413,15 @@ Flushes all suspended commands from the specified **RemoteProxy** to the corresp **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------------------------------- | ---- | ------------------- | -| object | [IRemoteObject](#iremoteobject) | Yes | **RemoteProxy** specified. | + | Name| Type | Mandatory| Description | + | ------ | ------------------------------- | ---- | ------------------- | + | object | [IRemoteObject](#iremoteobject) | Yes | **RemoteProxy** specified. | **Return value** -| Type | Description | -| ------ | --------------------------------------------------------------------------------- | -| number | Returns **0** if the operation is successful; returns an error code if the input object is null or a **RemoteObject**, or if the operation fails.| + | Type | Description | + | ------ | --------------------------------------------------------------------------------- | + | number | Returns **0** if the operation is successful; returns an error code if the input object is null or a **RemoteObject**, or if the operation fails.| **Example** @@ -7460,9 +7460,9 @@ Changes the UID and PID of the remote user to the UID and PID of the local user. **Return value** -| Type | Description | -| ------ | ------------------------------------ | -| string | String containing the UID and PID of the remote user.| + | Type | Description | + | ------ | ------------------------------------ | + | string | String containing the UID and PID of the remote user.| **Example** @@ -7487,9 +7487,9 @@ Changes the UID and PID of the remote user to the UID and PID of the local user. **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ------ | ---- | ------------------------------------------------------------------ | -| identity | string | Yes | String containing the remote user UID and PID, which are returned by **resetCallingIdentity**.| + | Name | Type | Mandatory| Description | + | -------- | ------ | ---- | ------------------------------------------------------------------ | + | identity | string | Yes | String containing the remote user UID and PID, which are returned by **resetCallingIdentity**.| **Example** @@ -7520,15 +7520,15 @@ Sets the UID and PID of the remote user. This API is a static method. It is usua **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ------ | ---- | ------------------------------------------------------------------ | -| identity | string | Yes | String containing the remote user UID and PID, which are returned by **resetCallingIdentity**.| + | Name | Type | Mandatory| Description | + | -------- | ------ | ---- | ------------------------------------------------------------------ | + | identity | string | Yes | String containing the remote user UID and PID, which are returned by **resetCallingIdentity**.| **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** @@ -7562,9 +7562,9 @@ A constructor used to create a **RemoteObject** object. **Parameters** -| Name | Type | Mandatory| Description | -| ---------- | ------ | ---- | ------------ | -| descriptor | string | Yes | Interface descriptor.| + | Name | Type | Mandatory| Description | + | ---------- | ------ | ---- | ------------ | + | descriptor | string | Yes | Interface descriptor.| ### sendRequest(deprecated) @@ -7579,18 +7579,18 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch **Parameters** -| Name | Type | Mandatory| Description | -| ------- | ------------------------------- | ---- | -------------------------------------------------------------------------------------- | -| code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| -| data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | -| reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | -| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | + | Name | Type | Mandatory| Description | + | ------- | ------------------------------- | ---- | -------------------------------------------------------------------------------------- | + | code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| + | data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | + | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | + | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | **Return value** -| Type | Description | -| ------- | --------------------------------------------- | -| boolean | Returns **true** if the message is sent successfully; returns **false** otherwise.| + | Type | Description | + | ------- | --------------------------------------------- | + | boolean | Returns **true** if the message is sent successfully; returns **false** otherwise.| **Example** @@ -7645,18 +7645,18 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch **Parameters** -| Name | Type | Mandatory| Description | -| ------- | ------------------------------- | ---- | -------------------------------------------------------------------------------------- | -| code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| -| data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | -| reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | -| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | + | Name | Type | Mandatory| Description | + | ------- | ------------------------------- | ---- | -------------------------------------------------------------------------------------- | + | code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| + | data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | + | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | + | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | **Return value** -| Type | Description | -| -------------------------------- | --------------------------------------------- | -| Promise<SendRequestResult> | Promise used to return the **sendRequestResult** object.| + | Type | Description | + | -------------------------------- | --------------------------------------------- | + | Promise<SendRequestResult> | Promise used to return the **sendRequestResult** object.| **Example** @@ -7715,18 +7715,18 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn **Parameters** -| Name | Type | Mandatory| Description | -| ------- | ------------------------------- | ---- | -------------------------------------------------------------------------------------- | -| code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| -| data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. | -| reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | -| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | + | Name | Type | Mandatory| Description | + | ------- | ------------------------------- | ---- | -------------------------------------------------------------------------------------- | + | code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| + | data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. | + | reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | + | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | **Return value** -| Type | Description | -| ---------------------------- | --------------------------------------------- | -| Promise<RequestResult> | Promise used to return the **sendRequestResult** object.| + | Type | Description | + | ---------------------------- | --------------------------------------------- | + | Promise<RequestResult> | Promise used to return the **sendRequestResult** object.| **Example** @@ -7771,13 +7771,13 @@ Sends a **MessageSequence** message to the remote process in synchronous or asyn **Parameters** -| Name | Type | Mandatory| Description | -| ------------- | ---------------------------------- | ---- | -------------------------------------------------------------------------------------- | -| code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| -| data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. | -| reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | -| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | -| AsyncCallback | AsyncCallback<RequestResult> | Yes | Callback for receiving the sending result. | + | Name | Type | Mandatory| Description | + | ------------- | ---------------------------------- | ---- | -------------------------------------------------------------------------------------- | + | code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| + | data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object holding the data to send. | + | reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that receives the response. | + | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | + | AsyncCallback | AsyncCallback<RequestResult> | Yes | Callback for receiving the sending result. | **Example** @@ -7821,13 +7821,13 @@ Sends a **MessageParcel** message to the remote process in synchronous or asynch **Parameters** -| Name | Type | Mandatory| Description | -| ------------- | -------------------------------------- | ---- | -------------------------------------------------------------------------------------- | -| code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| -| data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | -| reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | -| options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | -| AsyncCallback | AsyncCallback<SendRequestResult> | Yes | Callback for receiving the sending result. | + | Name | Type | Mandatory| Description | + | ------------- | -------------------------------------- | ---- | -------------------------------------------------------------------------------------- | + | code | number | Yes | Message code called by the request, which is determined by the client and server. If the method is generated by an IDL tool, the message code is automatically generated by the IDL tool.| + | data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object holding the data to send. | + | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that receives the response. | + | options | [MessageOption](#messageoption) | Yes | Request sending mode, which can be synchronous (default) or asynchronous. | + | AsyncCallback | AsyncCallback<SendRequestResult> | Yes | Callback for receiving the sending result. | **Example** @@ -7885,18 +7885,18 @@ Provides a response to **sendMessageRequest()**. The server processes the reques **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------------------------------- | ---- | --------------------------------------- | -| code | number | Yes | Service request code sent by the remote end. | -| data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that holds the parameters called by the client.| -| reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object carrying the result. | -| option | [MessageOption](#messageoption) | Yes | Whether the operation is synchronous or asynchronous. | + | Name| Type | Mandatory| Description | + | ------ | ------------------------------- | ---- | --------------------------------------- | + | code | number | Yes | Service request code sent by the remote end. | + | data | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object that holds the parameters called by the client.| + | reply | [MessageParcel](#messageparceldeprecated) | Yes | **MessageParcel** object carrying the result. | + | option | [MessageOption](#messageoption) | Yes | Whether the operation is synchronous or asynchronous. | **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** @@ -7946,19 +7946,19 @@ Provides a response to **sendMessageRequest()**. The server processes the reques **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------------------------------- | ---- | ----------------------------------------- | -| code | number | Yes | Service request code sent by the remote end. | -| data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that holds the parameters called by the client.| -| reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object to which the result is written. | -| option | [MessageOption](#messageoption) | Yes | Whether the operation is synchronous or asynchronous. | + | Name| Type | Mandatory| Description | + | ------ | ------------------------------- | ---- | ----------------------------------------- | + | code | number | Yes | Service request code sent by the remote end. | + | data | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object that holds the parameters called by the client.| + | reply | [MessageSequence](#messagesequence9) | Yes | **MessageSequence** object to which the result is written. | + | option | [MessageOption](#messageoption) | Yes | Whether the operation is synchronous or asynchronous. | **Return value** -| Type | Description | -| ----------------- | ---------------------------------------------------------------------------------------------- | -| boolean | Returns a Boolean value if the request is processed synchronously in **onRemoteMessageRequest**. The value **true** means the operation is successful; the value **false** means the opposite.| -| Promise\ | Returns a promise object if the request is processed asynchronously in **onRemoteMessageRequest**. | + | Type | Description | + | ----------------- | ---------------------------------------------------------------------------------------------- | + | boolean | Returns a Boolean value if the request is processed synchronously in **onRemoteMessageRequest**. The value **true** means the operation is successful; the value **false** means the opposite.| + | Promise\ | Returns a promise object if the request is processed asynchronously in **onRemoteMessageRequest**. | **Example**: Overload **onRemoteMessageRequest** to process requests synchronously. @@ -8076,9 +8076,9 @@ Obtains the UID of the remote process. **System capability**: SystemCapability.Communication.IPC.Core **Return value** -| Type | Description | -| ------ | ----------------------- | -| number | UID of the remote process obtained.| + | Type | Description | + | ------ | ----------------------- | + | number | UID of the remote process obtained.| **Example** @@ -8102,9 +8102,9 @@ Obtains the PID of the remote process. **Return value** -| Type | Description | -| ------ | ----------------------- | -| number | PID of the remote process obtained.| + | Type | Description | + | ------ | ----------------------- | + | number | PID of the remote process obtained.| **Example** @@ -8128,15 +8128,15 @@ Obtains the interface descriptor. **Parameters** -| Name | Type | Mandatory| Description | -| ---------- | ------ | ---- | -------------------- | -| descriptor | string | Yes | Interface descriptor.| + | Name | Type | Mandatory| Description | + | ---------- | ------ | ---- | -------------------- | + | descriptor | string | Yes | Interface descriptor.| **Return value** -| Type | Description | -| ------------- | --------------------------------------------- | -| IRemoteBroker | **IRemoteBroker** object bound to the specified interface token.| + | Type | Description | + | ------------- | --------------------------------------------- | + | IRemoteBroker | **IRemoteBroker** object bound to the specified interface token.| **Example** @@ -8182,15 +8182,15 @@ Checks whether the remote object corresponding to the specified interface token **Parameters** -| Name | Type | Mandatory| Description | -| ---------- | ------ | ---- | ---------------------- | -| descriptor | string | Yes | Interface descriptor.| + | Name | Type | Mandatory| Description | + | ---------- | ------ | ---- | ---------------------- | + | descriptor | string | Yes | Interface descriptor.| **Return value** -| Type | Description | -| ------------- | ------------------------------------------------------------------ | -| IRemoteBroker | Returns the remote object if a match is found; returns **Null** otherwise.| + | Type | Description | + | ------------- | ------------------------------------------------------------------ | + | IRemoteBroker | Returns the remote object if a match is found; returns **Null** otherwise.| **Example** @@ -8228,17 +8228,17 @@ Obtains the interface descriptor of this object. The interface descriptor is a s **Return value** -| Type | Description | -| ------ | ---------------- | -| string | Interface descriptor obtained.| + | Type | Description | + | ------ | ---------------- | + | string | Interface descriptor obtained.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900008 | proxy or remote object is invalid | + | ID| Error Message| + | ------- | -------- | + | 1900008 | proxy or remote object is invalid | **Example** @@ -8263,13 +8263,13 @@ For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode } } let testRemoteObject = new TestRemoteObject("testObject"); + console.log("RpcServer: descriptor is: " + descriptor); try { let descriptor = testRemoteObject.getDescriptor(); } catch(error) { console.info("rpc get local interface fail, errorCode " + error.code); console.info("rpc get local interface fail, errorMessage " + error.message); } - console.log("RpcServer: descriptor is: " + descriptor); ``` ### getInterfaceDescriptor(deprecated) @@ -8284,9 +8284,9 @@ Obtains the interface descriptor. **Return value** -| Type | Description | -| ------ | ---------------- | -| string | Interface descriptor obtained.| + | Type | Description | + | ------ | ---------------- | + | string | Interface descriptor obtained.| **Example** @@ -8325,10 +8325,10 @@ Binds an interface descriptor to an **IRemoteBroker** object. **Parameters** -| Name | Type | Mandatory| Description | -| -------------- | ------------- | ---- | ------------------------------------- | -| localInterface | IRemoteBroker | Yes | **IRemoteBroker** object. | -| descriptor | string | Yes | Interface descriptor.| + | Name | Type | Mandatory| Description | + | -------------- | ------------- | ---- | ------------------------------------- | + | localInterface | IRemoteBroker | Yes | **IRemoteBroker** object. | + | descriptor | string | Yes | Interface descriptor.| **Example** @@ -8344,8 +8344,8 @@ Binds an interface descriptor to an **IRemoteBroker** object. try { this.modifyLocalInterface(this, descriptor); } catch(error) { - console.info(rpc attach local interface fail, errorCode " + error.code); - console.info(rpc attach local interface fail, errorMessage " + error.message); + console.info(" rpc attach local interface fail, errorCode " + error.code); + console.info(" rpc attach local interface fail, errorMessage " + error.message); } } registerDeathRecipient(recipient: MyDeathRecipient, flags: number) { @@ -8376,10 +8376,10 @@ Binds an interface descriptor to an **IRemoteBroker** object. **Parameters** -| Name | Type | Mandatory| Description | -| -------------- | ------------- | ---- | ------------------------------------- | -| localInterface | IRemoteBroker | Yes | **IRemoteBroker** object. | -| descriptor | string | Yes | Interface descriptor.| + | Name | Type | Mandatory| Description | + | -------------- | ------------- | ---- | ------------------------------------- | + | localInterface | IRemoteBroker | Yes | **IRemoteBroker** object. | + | descriptor | string | Yes | Interface descriptor.| **Example** @@ -8418,12 +8418,12 @@ Provides methods related to anonymous shared memory objects, including creating, The table below describes the protection types of the mapped memory. -| Name | Value | Description | -| ---------- | --- | ------------------ | -| PROT_EXEC | 4 | The mapped memory is executable. | -| PROT_NONE | 0 | The mapped memory is inaccessible.| -| PROT_READ | 1 | The mapped memory is readable. | -| PROT_WRITE | 2 | The mapped memory is writeable. | + | Name | Value | Description | + | ---------- | --- | ------------------ | + | PROT_EXEC | 4 | The mapped memory is executable. | + | PROT_NONE | 0 | The mapped memory is inaccessible.| + | PROT_READ | 1 | The mapped memory is readable. | + | PROT_WRITE | 2 | The mapped memory is writeable. | ### create9+ @@ -8435,16 +8435,16 @@ Creates an **Ashmem** object with the specified name and size. This API is a sta **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ---------------------------- | -| name | string | Yes | Name of the **Ashmem** object to create. | -| size | number | Yes | Size (in bytes) of the **Ashmem** object to create.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ---------------------------- | + | name | string | Yes | Name of the **Ashmem** object to create. | + | size | number | Yes | Size (in bytes) of the **Ashmem** object to create.| **Return value** -| Type | Description | -| ------ | ---------------------------------------------- | -| Ashmem | Returns the **Ashmem** object if it is created successfully; returns null otherwise.| + | Type | Description | + | ------ | ---------------------------------------------- | + | Ashmem | Returns the **Ashmem** object if it is created successfully; returns null otherwise.| **Example** @@ -8472,16 +8472,16 @@ Creates an **Ashmem** object with the specified name and size. This API is a sta **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ---------------------------- | -| name | string | Yes | Name of the **Ashmem** object to create. | -| size | number | Yes | Size (in bytes) of the **Ashmem** object to create.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | ---------------------------- | + | name | string | Yes | Name of the **Ashmem** object to create. | + | size | number | Yes | Size (in bytes) of the **Ashmem** object to create.| **Return value** -| Type | Description | -| ------ | ---------------------------------------------- | -| Ashmem | Returns the **Ashmem** object if it is created successfully; returns null otherwise.| + | Type | Description | + | ------ | ---------------------------------------------- | + | Ashmem | Returns the **Ashmem** object if it is created successfully; returns null otherwise.| **Example** @@ -8501,15 +8501,15 @@ Creates an **Ashmem** object by copying the file descriptor of an existing **Ash **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | -------------------- | -| ashmem | Ashmem | Yes | Existing **Ashmem** object.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | -------------------- | + | ashmem | Ashmem | Yes | Existing **Ashmem** object.| **Return value** -| Type | Description | -| ------ | ---------------------- | -| Ashmem | **Ashmem** object created.| + | Type | Description | + | ------ | ---------------------- | + | Ashmem | **Ashmem** object created.| **Example** @@ -8539,15 +8539,15 @@ Creates an **Ashmem** object by copying the file descriptor of an existing **Ash **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | -------------------- | -| ashmem | Ashmem | Yes | Existing **Ashmem** object.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | -------------------- | + | ashmem | Ashmem | Yes | Existing **Ashmem** object.| **Return value** -| Type | Description | -| ------ | ---------------------- | -| Ashmem | **Ashmem** object created.| + | Type | Description | + | ------ | ---------------------- | + | Ashmem | **Ashmem** object created.| **Example** @@ -8598,9 +8598,9 @@ Obtains the memory size of this **Ashmem** object. **Return value** -| Type | Description | -| ------ | -------------------------- | -| number | **Ashmem** size obtained.| + | Type | Description | + | ------ | -------------------------- | + | number | **Ashmem** size obtained.| **Example** @@ -8620,17 +8620,17 @@ Creates the shared file mapping on the virtual address space of this process. Th **Parameters** -| Name | Type | Mandatory| Description | -| ------- | ------ | ---- | ------------------------------ | -| mapType | number | Yes | Protection level of the memory region to which the shared file is mapped.| + | Name | Type | Mandatory| Description | + | ------- | ------ | ---- | ------------------------------ | + | mapType | number | Yes | Protection level of the memory region to which the shared file is mapped.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | ------ | -| 1900001 | call mmap function failed | + | ID| Error Message| + | ------- | ------ | + | 1900001 | call mmap function failed | **Example** @@ -8656,15 +8656,15 @@ Creates the shared file mapping on the virtual address space of this process. Th **Parameters** -| Name | Type | Mandatory| Description | -| ------- | ------ | ---- | ------------------------------ | -| mapType | number | Yes | Protection level of the memory region to which the shared file is mapped.| + | Name | Type | Mandatory| Description | + | ------- | ------ | ---- | ------------------------------ | + | mapType | number | Yes | Protection level of the memory region to which the shared file is mapped.| **Return value** -| Type | Description | -| ------- | ----------------------------------------- | -| boolean | Returns **true** if the mapping is created; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------------------- | + | boolean | Returns **true** if the mapping is created; returns **false** otherwise.| **Example** @@ -8686,9 +8686,9 @@ Maps the shared file to the readable and writable virtual address space of the p For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900001 | call mmap function failed | + | ID| Error Message| + | ------- | -------- | + | 1900001 | call mmap function failed | **Example** @@ -8714,9 +8714,9 @@ Maps the shared file to the readable and writable virtual address space of the p **Return value** -| Type | Description | -| ------- | ----------------------------------------- | -| boolean | Returns **true** if the mapping is created; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------------------- | + | boolean | Returns **true** if the mapping is created; returns **false** otherwise.| **Example** @@ -8738,9 +8738,9 @@ Maps the shared file to the read-only virtual address space of the process. For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900001 | call mmap function failed | + | ID| Error Message| + | ------- | -------- | + | 1900001 | call mmap function failed | **Example** @@ -8766,9 +8766,9 @@ Maps the shared file to the read-only virtual address space of the process. **Return value** -| Type | Description | -| ------- | ----------------------------------------- | -| boolean | Returns **true** if the mapping is created; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------------------- | + | boolean | Returns **true** if the mapping is created; returns **false** otherwise.| **Example** @@ -8788,17 +8788,17 @@ Sets the protection level of the memory region to which the shared file is mappe **Parameters** -| Name | Type | Mandatory| Description | -| -------------- | ------ | ---- | ------------------ | -| protectionType | number | Yes | Protection type to set.| + | Name | Type | Mandatory| Description | + | -------------- | ------ | ---- | ------------------ | + | protectionType | number | Yes | Protection type to set.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| -------- | ------- | -| 1900002 | call os ioctl function failed | + | ID| Error Message| + | -------- | ------- | + | 1900002 | call os ioctl function failed | **Example** @@ -8824,15 +8824,15 @@ Sets the protection level of the memory region to which the shared file is mappe **Parameters** -| Name | Type | Mandatory| Description | -| -------------- | ------ | ---- | ------------------ | -| protectionType | number | Yes | Protection type to set.| + | Name | Type | Mandatory| Description | + | -------------- | ------ | ---- | ------------------ | + | protectionType | number | Yes | Protection type to set.| **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** @@ -8852,19 +8852,19 @@ Writes data to the shared file associated with this **Ashmem** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | -------------------------------------------------- | -| buf | number[] | Yes | Data to write. | -| size | number | Yes | Size of the data to write. | -| offset | number | Yes | Start position of the data to write in the memory region associated with this **Ashmem** object.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | -------------------------------------------------- | + | buf | number[] | Yes | Data to write. | + | size | number | Yes | Size of the data to write. | + | offset | number | Yes | Start position of the data to write in the memory region associated with this **Ashmem** object.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID| Error Message| -| ------- | -------- | -| 1900003 | write to ashmem failed | + | ID| Error Message| + | ------- | -------- | + | 1900003 | write to ashmem failed | **Example** @@ -8892,17 +8892,17 @@ Writes data to the shared file associated with this **Ashmem** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | -------- | ---- | -------------------------------------------------- | -| buf | number[] | Yes | Data to write. | -| size | number | Yes | Size of the data to write. | -| offset | number | Yes | Start position of the data to write in the memory region associated with this **Ashmem** object.| + | Name| Type | Mandatory| Description | + | ------ | -------- | ---- | -------------------------------------------------- | + | buf | number[] | Yes | Data to write. | + | size | number | Yes | Size of the data to write. | + | offset | number | Yes | Start position of the data to write in the memory region associated with this **Ashmem** object.| **Return value** -| Type | Description | -| ------- | ----------------------------------------------------------------------------------------- | -| boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| + | Type | Description | + | ------- | ----------------------------------------------------------------------------------------- | + | boolean | Returns **true** if the data is written successfully; returns **false** otherwise.| **Example** @@ -8925,24 +8925,24 @@ Reads data from the shared file associated with this **Ashmem** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | -------------------------------------------------- | -| size | number | Yes | Size of the data to read. | -| offset | number | Yes | Start position of the data to read in the memory region associated with this **Ashmem** object.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | -------------------------------------------------- | + | size | number | Yes | Size of the data to read. | + | offset | number | Yes | Start position of the data to read in the memory region associated with this **Ashmem** object.| **Return value** -| Type | Description | -| -------- | ---------------- | -| number[] | Data read.| + | Type | Description | + | -------- | ---------------- | + | number[] | Data read.| **Error codes** For details about the error codes, see [RPC Error Codes](../errorcodes/errorcode-rpc.md). -| ID | Error Message| -| -------- | -------- | -| 1900004 | read from ashmem failed | + | ID | Error Message| + | -------- | -------- | + | 1900004 | read from ashmem failed | **Example** @@ -8972,16 +8972,16 @@ Reads data from the shared file associated with this **Ashmem** object. **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | -------------------------------------------------- | -| size | number | Yes | Size of the data to read. | -| offset | number | Yes | Start position of the data to read in the memory region associated with this **Ashmem** object.| + | Name| Type | Mandatory| Description | + | ------ | ------ | ---- | -------------------------------------------------- | + | size | number | Yes | Size of the data to read. | + | offset | number | Yes | Start position of the data to read in the memory region associated with this **Ashmem** object.| **Return value** -| Type | Description | -| -------- | ---------------- | -| number[] | Data read.| + | Type | Description | + | -------- | ---------------- | + | number[] | Data read.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-runninglock.md b/en/application-dev/reference/apis/js-apis-runninglock.md index bddad259f782ca6ece549da06ab6ae4e69bbc441..e25ca6bcb1381a41f8491fcb8c50b2e65e5929e1 100644 --- a/en/application-dev/reference/apis/js-apis-runninglock.md +++ b/en/application-dev/reference/apis/js-apis-runninglock.md @@ -482,7 +482,7 @@ Enumerates the types of **RunningLock** objects. **System capability:** SystemCapability.PowerManager.PowerManager.Core -| Name | Value | Description | -| ------------------------ | ---- | -------------------------------------- | -| BACKGROUND | 1 | A lock that prevents the system from hibernating when the screen is off. | -| PROXIMITY_SCREEN_CONTROL | 2 | A lock that determines whether to turn on or off the screen based on the distance away from the screen.| +| Name | Value | Description | +| --------------------------------- | ---- | ------------------------------------------------------------ | +| BACKGROUND(deprecated) | 1 | A lock that prevents the system from hibernating when the screen is off.
**NOTE**
This parameter is supported since API version 7 and deprecated since API version 10.| +| PROXIMITY_SCREEN_CONTROL | 2 | A lock that determines whether to turn on or off the screen based on the distance away from the screen. | diff --git a/en/application-dev/reference/apis/js-apis-screen-lock.md b/en/application-dev/reference/apis/js-apis-screen-lock.md index f7f2a551648df0db4ad96733ef1a169f8fb42e14..e399c34b8d29b71e3e1697dcd0778c648e744bb7 100644 --- a/en/application-dev/reference/apis/js-apis-screen-lock.md +++ b/en/application-dev/reference/apis/js-apis-screen-lock.md @@ -1,4 +1,4 @@ -# @ohos.screenLock (Screenlock) +# @ohos.screenLock (Screen Lock) The **screenlock** module is a system module in OpenHarmony. It provides APIs for screen lock applications to subscribe to screen lock status changes as well as callbacks for them to receive the results. It also provides APIs for third-party applications to unlock the screen, obtain the screen locked status, and check whether a lock screen password has been set. @@ -12,12 +12,14 @@ The **screenlock** module is a system module in OpenHarmony. It provides APIs fo import screenlock from '@ohos.screenLock'; ``` -## EventType +## EventType9+ Defines the system event type. **System capability**: SystemCapability.MiscServices.ScreenLock +**System API**: This is a system API. + | Event Type | Description | | ------------------ | ------------------------ | | beginWakeUp | Wakeup starts.| @@ -35,15 +37,17 @@ Defines the system event type. | screenlockEnabled | Screen lock is enabled. | | serviceRestart | The screen lock service is restarted. | -## SystemEvent +## SystemEvent9+ Defines the structure of the system event callback. **System capability**: SystemCapability.MiscServices.ScreenLock +**System API**: This is a system API. + | Name | Type | Mandatory| Description | | --------- | ------ | ---- | ------------- | -| eventType | [EventType](#eventtype) | Yes | System event type.| +| eventType | [EventType](#eventtype9) | Yes | System event type.| | params | string | Yes | System event parameters.| ## screenlock.isLocked9+ @@ -54,6 +58,8 @@ Checks whether the screen is locked. **System capability**: SystemCapability.MiscServices.ScreenLock +**System API**: This is a system API. + **Return value** | Type | Description | @@ -66,26 +72,6 @@ Checks whether the screen is locked. let isLocked = screenlock.isLocked(); ``` -## screenlock.isSecure9+ - -isSecure(): boolean - -Checks whether the device is in secure mode. When the device is in secure mode, its screen requires a password, unlock pattern, or other user credentials to unlock. - -**System capability**: SystemCapability.MiscServices.ScreenLock - -**Return value** - -| Type | Description | -| ------- | ------------------------------------------------------------ | -| boolean | Returns **true** if the device is in secure mode; returns **false** otherwise.| - -**Example** - -```js -let isSecure = screenlock.isSecure(); -``` - ## screenlock.unlock9+ unlock(callback: AsyncCallback<boolean>): void @@ -94,6 +80,8 @@ Unlocks the screen. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.MiscServices.ScreenLock +**System API**: This is a system API. + **Parameters** | Name | Type | Mandatory| Description | @@ -128,6 +116,8 @@ Unlocks the screen. This API uses a promise to return the result. **System capability**: SystemCapability.MiscServices.ScreenLock +**System API**: This is a system API. + **Return value** | Type | Description | @@ -160,6 +150,8 @@ Locks the screen. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.MiscServices.ScreenLock +**Required permissions**: ohos.permission.ACCESS_SCREEN_LOCK_INNER + **System API**: This is a system API. **Parameters** @@ -196,6 +188,8 @@ Locks the screen. This API uses a promise to return the result. **System capability**: SystemCapability.MiscServices.ScreenLock +**Required permissions**: ohos.permission.ACCESS_SCREEN_LOCK_INNER + **System API**: This is a system API. **Return value** @@ -230,13 +224,15 @@ Registers a callback for system events related to screen locking. This API can b **System capability**: SystemCapability.MiscServices.ScreenLock +**Required permissions**: ohos.permission.ACCESS_SCREEN_LOCK_INNER + **System API**: This is a system API. **Parameters** | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ----------------- | -| callback | Callback\<[SystemEvent](#systemevent)> | Yes | Callback for system events related to screen locking.| +| callback | Callback\<[SystemEvent](#systemevent9)> | Yes | Callback for system events related to screen locking.| **Return value** @@ -266,19 +262,21 @@ try { ## screenlock.sendScreenLockEvent9+ -sendScreenLockEvent(event: string, parameter: number, callback: AsyncCallback<boolean>): void +sendScreenLockEvent(event: String, parameter: number, callback: AsyncCallback<boolean>): void Sends an event to the screen lock service. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.MiscServices.ScreenLock +**Required permissions**: ohos.permission.ACCESS_SCREEN_LOCK_INNER + **System API**: This is a system API. **Parameters** | Name | Type | Mandatory| Description | | --------- | ------------------------ | ---- | -------------------- | -| event | string | Yes | Event type.
- **"unlockScreenResult"**: Screen unlock result.
- **"lockScreenResult"**: Screen lock result.
- **"screenDrawDone"**: Screen drawing is complete.| +| event | String | Yes | Event type.
- **"unlockScreenResult"**: Screen unlock result.
- **"lockScreenResult"**: Screen lock result.
- **"screenDrawDone"**: Screen drawing is complete.| | parameter | number | Yes | Result.
- **0**: The operation is successful. For example, the screen is locked or unlocked successfully.
- **1**, the operation fails. For example, screen locking or unlocking fails.
- **2**: The operation is canceled. For example, screen locking or unlocking is canceled.| | callback | AsyncCallback\ | Yes | Callback used to return the result. The **value** true means that the event is sent successfully, and **false** means the opposite. | @@ -304,19 +302,21 @@ screenlock.sendScreenLockEvent('unlockScreenResult', 0, (err, result) => { ## screenlock.sendScreenLockEvent9+ -sendScreenLockEvent(event: string, parameter: number): Promise<boolean> +sendScreenLockEvent(event: String, parameter: number): Promise<boolean> Sends an event to the screen lock service. This API uses a promise to return the result. **System capability**: SystemCapability.MiscServices.ScreenLock +**Required permissions**: ohos.permission.ACCESS_SCREEN_LOCK_INNER + **System API**: This is a system API. **Parameters** | Name | Type | Mandatory| Description | | --------- | ------ | ---- | --------------------------------------- | -| event | string | Yes | Event type.
- **"unlockScreenResult"**: Screen unlock result.
- **"lockScreenResult"**: Screen lock result.
- **"screenDrawDone"**: Screen drawing is complete.| +| event | String | Yes | Event type.
- **"unlockScreenResult"**: Screen unlock result.
- **"lockScreenResult"**: Screen lock result.
- **"screenDrawDone"**: Screen drawing is complete.| | parameter | number | Yes | Result.
- **0**: The operation is successful. For example, the screen is locked or unlocked successfully.
- **1**, the operation fails. For example, screen locking or unlocking fails.
- **2**: The operation is canceled. For example, screen locking or unlocking is canceled.| **Return value** @@ -343,7 +343,7 @@ Checks whether the screen is locked. This API uses an asynchronous callback to r > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [screenlock.isLocked9+](#screenlockislocked9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.ScreenLock @@ -373,7 +373,7 @@ Checks whether the screen is locked. This API uses a promise to return the resul > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [screenlock.isLocked9+](#screenlockislocked9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.ScreenLock @@ -401,7 +401,7 @@ Checks whether the device is in secure mode. When the device is in secure mode, > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [screenlock.isSecure9+](#screenlockissecure9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.ScreenLock @@ -431,7 +431,7 @@ Checks whether the device is in secure mode. When the device is in secure mode, > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [screenlock.isSecure9+](#screenlockissecure9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.ScreenLock @@ -458,7 +458,7 @@ Unlocks the screen. This API uses an asynchronous callback to return the result. > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [screenlock.unlock9+](#screenlockunlock9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.ScreenLock @@ -488,7 +488,7 @@ Unlocks the screen. This API uses a promise to return the result. > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [screenlock.unlock9+](#screenlockunlock9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.ScreenLock diff --git a/en/application-dev/reference/apis/js-apis-screenshot.md b/en/application-dev/reference/apis/js-apis-screenshot.md index 309a1bc64491497bf61aaf6f2695a9d5c4fbd9d4..8b760e7cb48b3031e728ec80cc2c178501abb677 100644 --- a/en/application-dev/reference/apis/js-apis-screenshot.md +++ b/en/application-dev/reference/apis/js-apis-screenshot.md @@ -37,10 +37,10 @@ Describes the region of the screen to capture. | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | -| left | number | Yes | Left boundary of the screen region to capture.| -| top | number | Yes | Top boundary of the screen region to capture.| -| width | number | Yes | Width of the screen region to capture.| -| height | number | Yes | Height of the screen region to capture.| +| left | number | Yes | Left boundary of the screen region to capture, in pixels.| +| top | number | Yes | Top boundary of the screen region to capture, in pixels.| +| width | number | Yes | Width of the screen region to capture, in pixels.| +| height | number | Yes | Height of the screen region to capture, in pixels.| ## Size @@ -51,8 +51,8 @@ Describes the size of the screen region to capture. | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | -| width | number | Yes | Width of the screen region to capture.| -| height | number | Yes | Height of the screen region to capture.| +| width | number | Yes | Width of the screen region to capture, in pixels.| +| height | number | Yes | Height of the screen region to capture, in pixels.| ## screenshot.save diff --git a/en/application-dev/reference/apis/js-apis-sensor.md b/en/application-dev/reference/apis/js-apis-sensor.md index 987da3a5c044ee43e963df6a1ef731d8a0d07915..5d99ee002e6645ab65f503cac73f49d68dc2f8d5 100644 --- a/en/application-dev/reference/apis/js-apis-sensor.md +++ b/en/application-dev/reference/apis/js-apis-sensor.md @@ -2661,7 +2661,7 @@ try { ## sensor.getAngleVariation9+ getAngleVariation(currentRotationMatrix: Array<number>, preRotationMatrix: Array<number>, - callback: AsyncCallback): void + callback: AsyncCallback<Array<number>>): void Obtains the angle change between two rotation matrices. This API uses an asynchronous callback to return the result. @@ -2717,7 +2717,7 @@ try { ## sensor.getAngleVariation9+ -getAngleVariation(currentRotationMatrix: Array<number>, preRotationMatrix: Array<number>): Promise +getAngleVariation(currentRotationMatrix: Array<number>, preRotationMatrix: Array<number>): Promise<Array<number>> Obtains the angle change between two rotation matrices. This API uses a promise to return the result. @@ -2777,7 +2777,7 @@ try { ## sensor.getRotationMatrix9+ -getRotationMatrix(rotationVector: Array<number>, callback: AsyncCallback): void +getRotationMatrix(rotationVector: Array<number>, callback: AsyncCallback<Array<number>>): void Obtains the rotation matrix from a rotation vector. This API uses an asynchronous callback to return the result. @@ -2819,7 +2819,7 @@ try { ## sensor.getRotationMatrix9+ -getRotationMatrix(rotationVector: Array<number>): Promise +getRotationMatrix(rotationVector: Array<number>): Promise<Array<number>> Obtains the rotation matrix from a rotation vector. This API uses a promise to return the result. @@ -2866,7 +2866,7 @@ try { ## sensor.transformRotationMatrix9+ transformRotationMatrix(inRotationVector: Array<number>, coordinates: CoordinatesOptions, - callback: AsyncCallback): void + callback: AsyncCallback<Array<number>>): void Transforms a rotation vector based on the coordinate system. This API uses an asynchronous callback to return the result. @@ -2913,7 +2913,7 @@ try { ## sensor.transformRotationMatrix9+ -transformRotationMatrix(inRotationVector: Array<number>, coordinates: CoordinatesOptions): Promise +transformRotationMatrix(inRotationVector: Array<number>, coordinates: CoordinatesOptions): Promise<Array<number>> Transforms a rotation vector based on the coordinate system. This API uses a promise to return the result. @@ -2964,7 +2964,7 @@ try { ## sensor.getQuaternion9+ -getQuaternion(rotationVector: Array<number>, callback: AsyncCallback): void +getQuaternion(rotationVector: Array<number>, callback: AsyncCallback<Array<number>>): void Obtains the quaternion from a rotation vector. This API uses an asynchronous callback to return the result. @@ -3006,7 +3006,7 @@ try { ## sensor.getQuaternion9+ -getQuaternion(rotationVector: Array<number>): Promise +getQuaternion(rotationVector: Array<number>): Promise<Array<number>> Obtains the quaternion from a rotation vector. This API uses a promise to return the result. @@ -3052,7 +3052,7 @@ try { ## sensor.getOrientation9+ -getOrientation(rotationMatrix: Array<number>, callback: AsyncCallback): void +getOrientation(rotationMatrix: Array<number>, callback: AsyncCallback<Array<number>>): void Obtains the device direction based on the rotation matrix. This API uses an asynchronous callback to return the result. @@ -3101,7 +3101,7 @@ try { ## sensor.getOrientation9+ -getOrientation(rotationMatrix: Array<number>): Promise +getOrientation(rotationMatrix: Array<number>): Promise<Array<number>> Obtains the device direction based on the rotation matrix. This API uses a promise to return the result. @@ -3193,7 +3193,7 @@ try { ## sensor.getRotationMatrix9+ -getRotationMatrix(gravity: Array<number>, geomagnetic: Array<number>,): Promise<RotationMatrixResponse> +getRotationMatrix(gravity: Array<number>, geomagnetic: Array<number>): Promise<RotationMatrixResponse> Obtains the rotation matrix based on a gravity vector and geomagnetic vector. This API uses a promise to return the result. @@ -3239,7 +3239,7 @@ try { ## sensor.getSensorList9+ -getSensorList(callback: AsyncCallback): void +getSensorList(callback: AsyncCallback<Array<Sensor>>): void Obtains information about all sensors on the device. This API uses an asynchronous callback to return the result. @@ -3249,7 +3249,7 @@ Obtains information about all sensors on the device. This API uses an asynchrono | Name | Type | Mandatory| Description | | -------- | ---------------------------------------------- | ---- | ---------------- | -| callback | AsyncCallback | Yes | Callback used to return the sensor list.| +| callback | AsyncCallback<Array<[Sensor](#sensor9)>> | Yes | Callback used to return the sensor list.| **Error code** @@ -3279,7 +3279,7 @@ try { ## sensor.getSensorList9+ - getSensorList(): Promise< Array<Sensor>> + getSensorList(): Promise<Array<Sensor>> Obtains information about all sensors on the device. This API uses a promise to return the result. @@ -3289,7 +3289,7 @@ Obtains information about all sensors on the device. This API uses a promise to | Name | Type | Mandatory| Description | | ------- | ---------------------------------------- | ---- | ---------------- | -| promise | Promise | Yes | Promise used to return the sensor list.| +| promise | Promise<Array<[Sensor](#sensor9)>> | Yes | Promise used to return the sensor list.| **Error code** @@ -3831,18 +3831,6 @@ Describes the geographical location. | longitude | number | Yes | Yes | Longitude. | | altitude | number | Yes | Yes | Altitude.| -## LocationOptions - -Describes the geographical location. - -**System capability**: SystemCapability.Sensors.Sensor - -| Name | Type | Readable | Writable | Description | -| --------- | ------ | -------- | -------- | ----------- | -| latitude | number | Yes | Yes | Latitude. | -| longitude | number | Yes | Yes | Longitude. | -| altitude | number | Yes | Yes | Altitude. | - ## sensor.on(deprecated) ### ACCELEROMETER(deprecated) @@ -5676,7 +5664,7 @@ sensor.transformCoordinateSystem([1, 0, 0, 0, 1, 0, 0, 0, 1], {x:2, y:3}, functi console.error("Operation failed. Error code: " + err.code + ", message: " + err.message); return; } - console.info("Operation successed. Data obtained: " + data); + console.info("Operation succeeded. Data obtained: " + data); for (var i=0; i < data.length; i++) { console.info("transformCoordinateSystem data[ " + i + "] = " + data[i]); } @@ -5712,7 +5700,7 @@ This API is deprecated since API version 9. You are advised to use [sensor.trans ```js const promise = sensor.transformCoordinateSystem([1, 0, 0, 0, 1, 0, 0, 0, 1], {x:2, y:3}); promise.then((data) => { - console.info("Operation successed."); + console.info("Operation succeeded."); for (var i=0; i < data.length; i++) { console.info("transformCoordinateSystem data[ " + i + "] = " + data[i]); } @@ -5819,7 +5807,7 @@ This API is deprecated since API version 9. You are advised to use [sensor.getDe "Operation failed. Error code: " + err.code + ", message: " + err.message); return; } - console.info("Successed to get getAltitude interface get data: " + data); + console.info("Succeeded to get getAltitude interface get data: " + data); }); ``` @@ -5886,7 +5874,7 @@ This API is deprecated since API version 9. You are advised to use [sensor.getIn err.message); return; } - console.info("Successed to get getGeomagneticDip interface get data: " + data); + console.info("Succeeded to get getGeomagneticDip interface get data: " + data); }) ``` @@ -5918,7 +5906,7 @@ This API is deprecated since API version 9. You are advised to use [sensor.getIn ```js const promise = sensor.getGeomagneticDip([1, 0, 0, 0, 1, 0, 0, 0, 1]); promise.then((data) => { - console.info('getGeomagneticDip_promise successed', data); + console.info('getGeomagneticDip_promise succeeded', data); }).catch((err) => { console.error("Operation failed"); }) @@ -5988,7 +5976,7 @@ This API is deprecated since API version 9. You are advised to use [sensor.getAn ```js const promise = sensor.getAngleModify([1,0,0,0,1,0,0,0,1], [1,0,0,0,0.87,-0.50,0,0.50,0.87]); promise.then((data) => { - console.info('getAngleModifiy_promise success'); + console.info('getAngleModify_promise success'); for (var i=0; i < data.length; i++) { console.info("data[" + i + "]: " + data[i]); } @@ -6132,7 +6120,7 @@ This API is deprecated since API version 9. You are advised to use [sensor.getQu ```js const promise = sensor.createQuaternion([0.20046076, 0.21907, 0.73978853, 0.60376877]); promise.then((data) => { - console.info('createQuaternion_promise successed'); + console.info('createQuaternion_promise succeeded'); for (var i=0; i < data.length; i++) { console.info("data[" + i + "]: " + data[i]); } @@ -6169,7 +6157,7 @@ This API is deprecated since API version 9. You are advised to use [sensor.getOr err.message); return; } - console.info("SensorJsAPI--->Successed to get getDirection interface get data: " + data); + console.info("SensorJsAPI--->Succeeded to get getDirection interface get data: " + data); for (var i = 1; i < data.length; i++) { console.info("sensor_getDirection_callback" + data[i]); } diff --git a/en/application-dev/reference/apis/js-apis-sim.md b/en/application-dev/reference/apis/js-apis-sim.md index 0c0243c3dbe85939b1da5623baac1b3137926e15..6736cc90eca295e17310c295409a781f679db7d4 100644 --- a/en/application-dev/reference/apis/js-apis-sim.md +++ b/en/application-dev/reference/apis/js-apis-sim.md @@ -1,6 +1,6 @@ -# @ohos.telephony.sim (SIM Management) +# @ohos.telephony.sim (SIM) -The **sim** 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. +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** > @@ -121,7 +121,7 @@ promise.then(data => { hasOperatorPrivileges(slotId: number, callback: AsyncCallback\): void -Checks whether the application (caller) has been granted the operator permission. This API uses an asynchronous callback to return the result. +Checks whether the application (caller) has been granted the operator permission. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.CoreService @@ -132,6 +132,18 @@ Checks whether the application (caller) has been granted the operator permission | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -144,7 +156,7 @@ sim.hasOperatorPrivileges(0, (err, data) => { hasOperatorPrivileges(slotId: number): Promise -Checks whether the application (caller) has been granted the carrier permission. This API uses a promise to return the result. +Checks whether the application (caller) has been granted the operator permission. This API uses a promise to return the result. **System capability**: SystemCapability.Telephony.CoreService @@ -160,6 +172,18 @@ Checks whether the application (caller) has been granted the carrier permission. | :----------------- | :---------------------------------------------------------- | | Promise\ | Promise used to return the result. The value **true** indicates that the application (caller) has been granted the carrier permission, and the value **false** indicates the opposite.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -184,7 +208,20 @@ Obtains the ISO country code of the SIM card in the specified slot. This API use | 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. which is an ISO country code, for example, **CN** (China).| +| callback | AsyncCallback\ | Yes | Callback used to return the result, which is an ISO country code, for example, **CN** (China).| + +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | **Example** @@ -215,6 +252,19 @@ Obtains the ISO country code of the SIM card in the specified slot. This API use | ----------------- | ------------------------------------------------------------ | | Promise\ | Promise used to return the result, which is an ISO country code, for example, **CN** (China).| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -231,7 +281,7 @@ promise.then(data => { getSimOperatorNumeric\(slotId: number, callback: AsyncCallback\): void -Obtains the public land mobile network (PLMN) ID of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Obtains the public land mobile network \(PLMN\) ID of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.CoreService @@ -242,6 +292,19 @@ Obtains the public land mobile network (PLMN) ID of the SIM card in the specifie | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -271,6 +334,19 @@ Obtains the PLMN ID of the SIM card in the specified slot. This API uses a promi | ----------------- | ------------------------------------------------ | | Promise\ | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -287,7 +363,7 @@ promise.then(data => { getSimSpn\(slotId: number, callback: AsyncCallback\): void -Obtains the service provider name (SPN) of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Obtains the service provider name (SPN) of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.CoreService @@ -298,6 +374,19 @@ Obtains the service provider name (SPN) of the SIM card in the specified slot. T | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -311,7 +400,7 @@ sim.getSimSpn(0, (err, data) => { getSimSpn\(slotId: number\): Promise -Obtains the SPN of the SIM card in the specified slot. This API uses a promise to return the result. +Obtains the SPN of the SIM card in the specified slot. This API uses a promise to return the result. **System capability**: SystemCapability.Telephony.CoreService @@ -327,6 +416,19 @@ Obtains the SPN of the SIM card in the specified slot. This API uses a promise t | ----------------- | ----------------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -343,7 +445,7 @@ promise.then(data => { getSimState\(slotId: number, callback: AsyncCallback\): void -Obtains the status of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Obtains the state of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.CoreService @@ -354,6 +456,18 @@ Obtains the status of the SIM card in the specified slot. This API uses an async | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\<[SimState](#simstate)\> | Yes | Callback used to return the result. For details, see [SimState](#simstate). | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -367,7 +481,7 @@ sim.getSimState(0, (err, data) => { getSimState\(slotId: number\): Promise -Obtains the status of the SIM card in the specified slot. This API uses a promise to return the result. +Obtains the state of the SIM card in the specified slot. This API uses a promise to return the result. **System capability**: SystemCapability.Telephony.CoreService @@ -383,6 +497,18 @@ Obtains the status of the SIM card in the specified slot. This API uses a promis | -------------------------------- | ------------------------------------------ | | Promise\<[SimState](#simstate)\> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -409,6 +535,19 @@ Obtains the type of the SIM card in the specified slot. This API uses an asynchr | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\<[CardType](#cardtype7)\> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -438,6 +577,19 @@ Obtains the type of the SIM card in the specified slot. This API uses a promise | ----------------- | ------------------------------------------------------------ | | Promise\<[CardType](#cardtype7)\> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -465,6 +617,18 @@ Checks whether the SIM card in the specified slot is installed. This API uses an | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback<boolean> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -494,6 +658,18 @@ Checks whether the SIM card in the specified slot is installed. This API uses a | --------------------- | ---------------------------------- | | Promise<boolean> | Promise used to return the result. The value **true** indicates that the SIM card in the specified slot is installed, and the value **false** indicates the opposite.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -509,7 +685,7 @@ promise.then(data => { getSimAccountInfo(slotId: number, callback: AsyncCallback): void -Obtains account information of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Obtains SIM card account information. This API uses an asynchronous callback to return the result. **System API**: This is a system API. @@ -524,6 +700,21 @@ Obtains account information of the SIM card in the specified slot. This API uses | 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. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -537,7 +728,7 @@ sim.getSimAccountInfo(0, (err, data) => { getSimAccountInfo(slotId: number): Promise -Obtains account information of the SIM card in the specified slot. This API uses a promise to return the result. +Obtains SIM card account information. This API uses a promise to return the result. **System API**: This is a system API. @@ -557,6 +748,21 @@ Obtains account information of the SIM card in the specified slot. This API uses | -------------------------------------------- | ------------------------------------------ | | Promise<[IccAccountInfo](#iccaccountinfo7)\> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -586,6 +792,20 @@ Obtains the account information list of the active SIM card. This API uses an as | -------- | ----------------------------------------------------------- | ---- | ---------- | | callback | AsyncCallback\\> | Yes | Callback used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -613,6 +833,20 @@ Obtains the account information list of the active SIM card. This API uses a pro | ---------------------------------------------------- | ---------------------------------------------- | | Promise\> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -643,11 +877,26 @@ Sets the default slot ID of the SIM card that provides voice services. This API | slotId | number | Yes | SIM card slot ID.
- **0**: card slot 1
- **1**: card slot 2
- **-1**: Clears the default configuration.| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301001 | SIM card is not activated. | + **Example** ```js -sim.setDefaultVoiceSlotId(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.setDefaultVoiceSlotId(0, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -676,13 +925,28 @@ Sets the default slot ID of the SIM card that provides voice services. This API | --------------- | ------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301001 | SIM card is not activated. | + **Example** ```js let promise = sim.setDefaultVoiceSlotId(0); -promise.then(data => { - console.log(`setDefaultVoiceSlotId success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`setDefaultVoiceSlotId success.`); +}).catch((err) => { console.log(`setDefaultVoiceSlotId failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -707,12 +971,26 @@ Sets a display name for the SIM card in the specified slot. This API uses an asy | name | string | Yes | SIM card name. | | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js let name = "ShowName"; -sim.setShowName(0, name, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.setShowName(0, name, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -741,14 +1019,28 @@ Sets a display name for the SIM card in the specified slot. This API uses a prom | --------------- | ------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js let name = "ShowName"; let promise = sim.setShowName(0, name); -promise.then(data => { - console.log(`setShowName success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`setShowName success.`); +}).catch((err) => { console.log(`setShowName failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -772,6 +1064,20 @@ Obtains the name of the SIM card in the specified slot. This API uses an asynchr | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback<string> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -805,6 +1111,20 @@ Obtains the name of the SIM card in the specified slot. This API uses a promise | --------------------- | -------------------------------------- | | Promise<string> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -836,12 +1156,26 @@ Sets a display number for the SIM card in the specified slot. This API uses an a | number | string | Yes | SIM card number. | | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js let number = '+861xxxxxxxxxx'; -sim.setShowNumber(0, number, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.setShowNumber(0, number, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -871,14 +1205,28 @@ Sets a display number for the SIM card in the specified slot. This API uses a pr | -------------- | ------------------------------- | | Promise | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js let number = '+861xxxxxxxxxx'; let promise = sim.setShowNumber(0, number); -promise.then(data => { - console.log(`setShowNumber success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`setShowNumber success.`); +}).catch((err) => { console.log(`setShowNumber failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -902,6 +1250,20 @@ Obtains the display number of the SIM card in the specified slot. This API uses | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback<string> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -935,6 +1297,20 @@ Obtains the display number of the SIM card in the specified slot. This API uses | --------------------- | --------------------------------- | | Promise<string> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -950,7 +1326,7 @@ promise.then(data => { activateSim(slotId: number, callback: AsyncCallback): void -Activates the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Activates a SIM card in a specified card slot. This API uses an asynchronous callback to return the result. **System API**: This is a system API. @@ -965,11 +1341,25 @@ Activates the SIM card in the specified slot. This API uses an asynchronous call | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js -sim.activateSim(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.activateSim(0, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -998,13 +1388,27 @@ Activates the SIM card in the specified slot. This API uses a promise to return | --------------- | ------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js let promise = sim.activateSim(0); -promise.then(data => { - console.log(`activateSim success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`activateSim success.`); +}).catch((err) => { console.log(`activateSim failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1013,7 +1417,7 @@ promise.then(data => { deactivateSim(slotId: number, callback: AsyncCallback): void -Deactivates the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Disables the SIM card in the specified slot. This API uses an asynchronous callback to return the result. **System API**: This is a system API. @@ -1028,11 +1432,25 @@ Deactivates the SIM card in the specified slot. This API uses an asynchronous ca | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js -sim.deactivateSim(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.deactivateSim(0, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1041,7 +1459,7 @@ sim.deactivateSim(0, (err, data) => { deactivateSim(slotId: number): Promise\ -Deactivates the SIM card in the specified slot. This API uses a promise to return the result. +Disables the SIM card in the specified slot. This API uses a promise to return the result. **System API**: This is a system API. @@ -1061,13 +1479,27 @@ Deactivates the SIM card in the specified slot. This API uses a promise to retur | --------------- | ------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js let promise = sim.deactivateSim(0); -promise.then(data => { - console.log(`deactivateSim success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`deactivateSim success.`); +}).catch((err) => { console.log(`deactivateSim failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1090,7 +1522,22 @@ Sets the lock status of the SIM card in the specified slot. This API uses an asy | -------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | | callback | AsyncCallback\<[LockStatusResponse](#lockstatusresponse7)\> | Yes | Callback used to return the result. | -| options | [LockInfo](#lockinfo8) | Yes | Lock information.
- **lockType**: [LockType](#locktype8)
- **password**: string
- **state**: [LockState](#lockstate8) | +| options | [LockInfo](#lockinfo8) | Yes | Lock information.
- lockType: [LockType](#locktype8)
- password: string
- state: [LockState](#lockstate8) | + +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | **Example** @@ -1123,7 +1570,7 @@ Sets the lock status of the SIM card in the specified slot. This API uses a prom | Name | Type | Mandatory| Description | | ------- | ---------------------- | ---- | ------------------------------------------------------------ | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | -| options | [LockInfo](#lockinfo8) | Yes | Lock information.
- **lockType**: [LockType](#locktype8)
- **password**: string
- **state**: [LockState](#lockstate8) | +| options | [LockInfo](#lockinfo8) | Yes | Lock information.
- lockType: [LockType](#locktype8)
- password: string
- state: [LockState](#lockstate8) | **Return value** @@ -1131,6 +1578,21 @@ Sets the lock status of the SIM card in the specified slot. This API uses a prom | ---------------------------------------------------- | -------------------------------------------- | | Promise<[LockStatusResponse](#lockstatusresponse7)\> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1167,6 +1629,21 @@ Obtains the lock status of the SIM card in the specified slot. This API uses an | callback | AsyncCallback\<[LockState](#lockstate8)\> | Yes | Callback used to return the result. | | options | [LockType](#locktype8) | Yes | Lock type.
- **1**: PIN lock
- **2**: PIN 2 lock| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1201,6 +1678,21 @@ Obtains the lock status of the SIM card in the specified slot. This API uses a p | ---------------------------------- | -------------------------------------------- | | Promise<[LockState](#lockstate8)\> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1233,6 +1725,21 @@ Changes the PIN of the SIM card in the specified slot. This API uses an asynchro | newPin | string | Yes | New PIN. | | oldPin | string | Yes | Old PIN. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1268,6 +1775,21 @@ Changes the PIN of the SIM card in the specified slot. This API uses a promise t | ---------------------------------------------------- | --------------------------------------------- | | Promise<[LockStatusResponse](#lockstatusresponse7)\> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1300,6 +1822,21 @@ Changes PIN 2 of the SIM card in the specified slot. This API uses an asynchrono | newPin2 | string | Yes | New PIN. | | oldPin2 | string | Yes | Old PIN. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1335,6 +1872,21 @@ Changes PIN 2 of the SIM card in the specified slot. This API uses a promise to | ---------------------------------------------------- | --------------------------------------------- | | Promise<[LockStatusResponse](#lockstatusresponse7)\> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1350,7 +1902,7 @@ promise.then(data => { unlockPin(slotId: number, pin: string, callback: AsyncCallback): void -Unlocks PIN of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Unlocks the PIN of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. **System API**: This is a system API. @@ -1366,6 +1918,21 @@ Unlocks PIN of the SIM card in the specified slot. This API uses an asynchronous | pin | string | Yes | PIN of the SIM card. | | callback | AsyncCallback<[LockStatusResponse](#lockstatusresponse7)> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1401,6 +1968,21 @@ Unlocks the PIN of the SIM card in the specified slot. This API uses a promise t | ---------------------------------------------------- | -------------------------------------------------- | | Promise\<[LockStatusResponse](#lockstatusresponse7)\> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1415,7 +1997,7 @@ promise.then(data => { ## sim.unlockPuk7+ -unlockPuk(slotId: number, newPin: string, puk: string ,callback: AsyncCallback): void +unlockPuk(slotId: number, newPin: string, puk: string, callback: AsyncCallback): void Unlocks the PUK of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. @@ -1434,6 +2016,21 @@ Unlocks the PUK of the SIM card in the specified slot. This API uses an asynchro | puk | string | Yes | PUK of the SIM card. | | callback | AsyncCallback<[LockStatusResponse](#lockstatusresponse7)> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1471,6 +2068,21 @@ Unlocks the PUK of the SIM card in the specified slot. This API uses a promise t | ---------------------------------------------------- | -------------------------------------------------- | | Promise\<[LockStatusResponse](#lockstatusresponse7)\> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1501,9 +2113,24 @@ Unlocks PIN 2 of the SIM card in the specified slot. This API uses an asynchrono | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| -| pin2 | string | Yes | PIN 2 of the SIM card. | +| pin2 | string | Yes | PIN of the SIM card. | | callback | AsyncCallback<[LockStatusResponse](#lockstatusresponse7)> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1531,7 +2158,7 @@ Unlocks PIN 2 of the SIM card in the specified slot. This API uses a promise to | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| -| pin2 | string | Yes | PIN 2 of the SIM card. | +| pin2 | string | Yes | PIN of the SIM card. | **Return value** @@ -1539,6 +2166,21 @@ Unlocks PIN 2 of the SIM card in the specified slot. This API uses a promise to | ----------------------------------------------------- | -------------------------------------------------- | | Promise\<[LockStatusResponse](#lockstatusresponse7)\> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1569,9 +2211,24 @@ Unlocks PUK 2 of the SIM card in the specified slot. This API uses an asynchrono | -------- | ------------------------------------------------------------ | ---- | -------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | newPin2 | string | Yes | New PIN 2. | -| puk2 | string | Yes | PUK 2 of the SIM card. | +| puk2 | string | Yes | PUK of the SIM card. | | callback | AsyncCallback<[LockStatusResponse](#lockstatusresponse7)> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1601,7 +2258,7 @@ Unlocks PUK 2 of the SIM card in the specified slot. This API uses a promise to | ------- | ------ | ---- | -------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | newPin2 | string | Yes | New PIN 2. | -| puk2 | string | Yes | PUK 2 of the SIM card. | +| puk2 | string | Yes | PUK of the SIM card. | **Return value** @@ -1609,6 +2266,21 @@ Unlocks PUK 2 of the SIM card in the specified slot. This API uses a promise to | ---------------------------------------------------- | -------------------------------------------------- | | Promise\<[LockStatusResponse](#lockstatusresponse7)\> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -1646,7 +2318,7 @@ console.log("Result: "+ sim.getMaxSimCount()) getSimIccId(slotId: number, callback: AsyncCallback): void -Obtains the IC card identity (ICCID) of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Obtains the ICCID of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. **System API**: This is a system API. @@ -1661,6 +2333,20 @@ Obtains the IC card identity (ICCID) of the SIM card in the specified slot. This | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1694,6 +2380,20 @@ Obtains the ICCID of the SIM card in the specified slot. This API uses a promise | ---------------- | ------------------------------------------- | | Promise | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1724,6 +2424,20 @@ Obtains the voice mailbox alpha identifier of the SIM card in the specified slot | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1757,6 +2471,20 @@ Obtains the voice mailbox alpha identifier of the SIM card in the specified slot | ---------------- | ------------------------------------------------- | | Promise | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1787,6 +2515,20 @@ Obtains the voice mailbox number of the SIM card in the specified slot. This API | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1820,6 +2562,20 @@ Obtains the voice mailbox number of the SIM card in the specified slot. This API | ---------------- | ------------------------------------------------ | | Promise | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1831,6 +2587,7 @@ promise.then(data => { }); ``` + ## sim.setVoiceMailInfo8+ setVoiceMailInfo(slotId: number, mailName: string, mailNumber: string, callback: AsyncCallback): void @@ -1852,11 +2609,26 @@ Sets voice mailbox information for the SIM card in the specified slot. This API | mailNumber | string | Yes | Voice mailbox number. | | callback | AsyncCallback | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js -sim.setVoiceMailInfo(0, "mail", "xxx@xxx.com", (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.setVoiceMailInfo(0, "mail", "xxx@xxx.com", (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1887,13 +2659,28 @@ Sets voice mailbox information for the SIM card in the specified slot. This API | -------------- | ----------------------- | | Promise | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js let promise = sim.setVoiceMailInfo(0, "mail", "xxx@xxx.com"); -promise.then(data => { - console.log(`setVoiceMailInfo success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`setVoiceMailInfo success.`); +}).catch((err) => { console.log(`setVoiceMailInfo failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1902,7 +2689,7 @@ promise.then(data => { getSimTelephoneNumber(slotId: number, callback: AsyncCallback): void -Obtains the mobile subscriber ISDN number (MSISDN) of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Obtains the MSISDN of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. **System API**: This is a system API. @@ -1917,6 +2704,20 @@ Obtains the mobile subscriber ISDN number (MSISDN) of the SIM card in the specif | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1950,6 +2751,20 @@ Obtains the MSISDN of the SIM card in the specified slot. This API uses a promis | ---------------- | -------------------------------------------- | | Promise | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1980,6 +2795,20 @@ Obtains the group identifier level 1 (GID1) of the SIM card in the specified slo | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2013,6 +2842,20 @@ Obtains the GID1 of the SIM card in the specified slot. This API uses a promise | ---------------- | ------------------------------------------------- | | Promise | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2043,6 +2886,20 @@ Obtains the international mobile subscriber identity (IMSI) of the SIM card in t | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2076,6 +2933,20 @@ Obtains the IMSI of the SIM card in the specified slot. This API uses a promise | ---------------- | ------------------------------------------- | | Promise | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2106,6 +2977,19 @@ Obtains the carrier configuration of the SIM card in the specified slot. This AP | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2139,6 +3023,19 @@ Obtains the carrier configuration of the SIM card in the specified slot. This AP | --------------------------------------------------- | ----------------------------- | | Promise> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -2167,8 +3064,23 @@ Queries contact numbers of the SIM card in the specified slot. This API uses an | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ---------------------------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | -| type | [ContactType](#contacttype8) | Yes | Contact type.
- **1**: GENERAL_CONTACT
- **2**: FIXED_DIALING | -| callback | AsyncCallback> | Yes | Callback used to return the result. | +| type | [ContactType](#contacttype8) | Yes | Contact type.
- **1**: GENERAL_CONTACT
- **2**: FIXED_DIALING| +| callback | AsyncCallback> | Yes | Callback used to return the result. | + +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | **Example** @@ -2196,13 +3108,28 @@ Queries contact numbers of the SIM card in the specified slot. This API uses a p | Name| Type | Mandatory| Description | | ------ | ----------- | ---- | ---------------------------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2 | -| type | [ContactType](#contacttype8) | Yes | Contact type.
- **1**: GENERAL_CONTACT
- **2**: FIXED_DIALING | +| type | [ContactType](#contacttype8) | Yes | Contact type.
- **1**: GENERAL_CONTACT
- **2**: FIXED_DIALING| **Return value** | Type | Description | | ------------------------------------------------------------ | ------------------------------ | -| Promise> | Promise used to return the result.| +| Promise> | Promise used to return the result.| + +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | **Example** @@ -2236,6 +3163,21 @@ Adds contact numbers for the SIM card in the specified slot. This API uses an as | diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | Yes | Contact number information. | | callback | AsyncCallback | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -2244,8 +3186,8 @@ let diallingNumbersInof = { number: "138xxxxxxxx", pin2: "1234" }; -sim.addIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.addIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2274,7 +3216,22 @@ Adds contact numbers for the SIM card in the specified slot. This API uses a pro | Type | Description | | -------------- | --------------------------- | -| Promise | Promise used to return the result.| +| Promise | Promise used to return the result.| + +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | **Example** @@ -2284,9 +3241,9 @@ let diallingNumbersInof = { number: "138xxxxxxxx" }; let promise = sim.addIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof); -promise.then(data => { - console.log(`addIccDiallingNumbers success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`addIccDiallingNumbers success.`); +}).catch((err) => { console.log(`addIccDiallingNumbers failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -2312,15 +3269,32 @@ Deletes contact numbers from the SIM card in the specified slot. This API uses a | diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | Yes | Contact number information. | | callback | AsyncCallback | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js let diallingNumbersInof = { alphaTag: "alpha", - number: "138xxxxxxxx" + number: "138xxxxxxxx", + recordNumber: 123, + pin2: "1234" }; -sim.delIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.delIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2349,7 +3323,22 @@ Deletes contact numbers from the SIM card in the specified slot. This API uses a | Type | Description | | -------------- | --------------------------- | -| Promise | Promise used to return the result.| +| Promise | Promise used to return the result.| + +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | **Example** @@ -2359,9 +3348,9 @@ let diallingNumbersInof = { number: "138xxxxxxxx" }; let promise = sim.delIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof); -promise.then(data => { - console.log(`delIccDiallingNumbers success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`delIccDiallingNumbers success.`); +}).catch((err) => { console.log(`delIccDiallingNumbers failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -2387,15 +3376,32 @@ Updates contact numbers for the SIM card in the specified slot. This API uses an | diallingNumbers | [DiallingNumbersInfo](#diallingnumbersinfo8) | Yes | Contact number information. | | callback | AsyncCallback | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js let diallingNumbersInof = { alphaTag: "alpha", - number: "138xxxxxxxx" + number: "138xxxxxxxx", + recordNumber: 123, + pin2: "1234" }; -sim.updateIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.updateIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2426,19 +3432,33 @@ Updates contact numbers for the SIM card in the specified slot. This API uses a | -------------- | ----------------------------- | | Promise | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js let diallingNumbersInof = { alphaTag: "alpha", number: "138xxxxxxxx", - recordNumber: 123, - pin2: "1234" + recordNumber: 123 }; let promise = sim.updateIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof); -promise.then(data => { - console.log(`updateIccDiallingNumbers success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`updateIccDiallingNumbers success.`); +}).catch((err) => { console.log(`updateIccDiallingNumbers failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -2461,13 +3481,27 @@ Sends an envelope command to the SIM card in the specified slot. This API uses a | -------- | -------------------- | ---- | -------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | cmd | string | Yes | Envelope command. | -| callback | AsyncCallback | Yes | Yes | +| callback | AsyncCallback | Yes | Callback used to return the result. | + +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | **Example** ```js -sim.sendEnvelopeCmd(0, "ls", (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.sendEnvelopeCmd(0, "ls", (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2497,13 +3531,27 @@ Sends an envelope command to the SIM card in the specified slot. This API uses a | -------------- | --------------------------- | | Promise | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js let promise = sim.sendEnvelopeCmd(0, "ls"); -promise.then(data => { - console.log(`sendEnvelopeCmd success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`sendEnvelopeCmd success.`); +}).catch((err) => { console.log(`sendEnvelopeCmd failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -2525,14 +3573,28 @@ Sends a terminal response command to the SIM card in the specified slot. This AP | Name | Type | Mandatory| Description | | -------- | -------------------- | ---- | -------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| -| cmd | string | Yes | Command | +| cmd | string | Yes | Envelope command. | | callback | AsyncCallback | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js -sim.sendTerminalResponseCmd(0, "ls", (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.sendTerminalResponseCmd(0, "ls", (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2554,7 +3616,7 @@ Sends a terminal response command to the SIM card in the specified slot. This AP | Name| Type | Mandatory| Description | | ------ | ------ | ---- | -------------------------------------- | | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| -| cmd | string | Yes | Command | +| cmd | string | Yes | Envelope command. | **Return value** @@ -2562,22 +3624,37 @@ Sends a terminal response command to the SIM card in the specified slot. This AP | -------------- | --------------------------- | | Promise | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js let promise = sim.sendTerminalResponseCmd(0, "ls"); -promise.then(data => { - console.log(`sendTerminalResponseCmd success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`sendTerminalResponseCmd success.`); +}).catch((err) => { console.log(`sendTerminalResponseCmd failed, promise: err->${JSON.stringify(err)}`); }); ``` + ## sim.unlockSimLock8+ unlockSimLock(slotId: number, lockInfo: PersoLockInfo, callback: AsyncCallback): void -Unlocks the SIM card in the specified slot. This API uses an asynchronous callback to return the result. +Unlocks the SIM card in the specified slot. This API uses an asynchronous callback to return the result. **System API**: This is a system API. @@ -2593,6 +3670,21 @@ Unlocks the SIM card in the specified slot. This API uses an asynchronous callba | lockInfo | [PersoLockInfo](#persolockinfo8) | Yes | Personalized lock information. | | callback | AsyncCallback<[LockStatusResponse](#lockstatusresponse7)\> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -2610,7 +3702,7 @@ sim.unlockSimLock(0, persoLockInfo, (err, data) => { unlockSimLock(slotId: number, lockInfo: PersoLockInfo): Promise -Unlocks the SIM card in the specified slot. This API uses a promise to return the result. +Unlocks the SIM card in the specified slot. This API uses a promise to return the result. **System API**: This is a system API. @@ -2631,6 +3723,21 @@ Unlocks the SIM card in the specified slot. This API uses a promise to return th | ---------------------------------------------------- | ------------------------- | | Promise<[LockStatusResponse](#lockstatusresponse7)\> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301002 | SIM card operation error. | + **Example** ```js @@ -2652,8 +3759,6 @@ getOpKey(slotId: number, callback: AsyncCallback): void Obtains the opkey of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. -**System API**: This is a system API. - **System capability**: SystemCapability.Telephony.CoreService **Parameters** @@ -2661,14 +3766,35 @@ Obtains the opkey of the SIM card in the specified slot. This API uses an asynch | 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. | +| callback | AsyncCallback | Yes | Callback used to return the result. | + +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 801 | Capability not supported. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** ```js -sim.getOpKey(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); -}); +try { + sim.getOpKey(0, (err, data) => { + if (err) { + console.log("getOpKey failed, err: " + JSON.stringify(err)); + } else { + console.log('getOpKey successfully, data: ' + JSON.stringify(data)); + } + }); +} catch (err) { + console.log("getOpKey err: " + JSON.stringify(err)); +} ``` @@ -2692,15 +3818,28 @@ Obtains the opkey of the SIM card in the specified slot. This API uses a promise | ---------------- | ----------------------------------------- | | Promise | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 801 | Capability not supported. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -let promise = sim.getOpKey(0); -promise.then(data => { +try { + let data = sim.getOpKey(0); console.log(`getOpKey success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { - console.log(`getOpKey failed, promise: err->${JSON.stringify(err)}`); -}); +} catch (error) { + console.log(`getOpKey failed, promise: err->${JSON.stringify(error)}`); +} ``` ## sim.getOpName9+ @@ -2718,12 +3857,33 @@ Obtains the OpName of the SIM card in the specified slot. This API uses an async | slotId | number | Yes | Card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 801 | Capability not supported. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -sim.getOpName(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); -}); +try { + sim.getOpName(0, (err, data) => { + if (err) { + console.log("getOpName failed, err: " + JSON.stringify(err)); + } else { + console.log('getOpName successfully, data: ' + JSON.stringify(data)); + } + }); +} catch (err) { + console.log("getOpName err: " + JSON.stringify(err)); +} ``` @@ -2747,15 +3907,28 @@ Obtains the OpName of the SIM card in the specified slot. This API uses a promis | ---------------- | ------------------------------------------ | | Promise | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 801 | Capability not supported. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -let promise = sim.getOpName(0); -promise.then(data => { +try { + let data = sim.getOpName(0); console.log(`getOpName success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { - console.log(`getOpName failed, promise: err->${JSON.stringify(err)}`); -}); +} catch (error) { + console.log(`getOpName failed, promise: err->${JSON.stringify(error)}`); +} ``` ## SimState @@ -2781,16 +3954,16 @@ Enumerates SIM card types. | Name| Value| Description| | ----- | ----- | ----- | -|UNKNOWN_CARD | -1 | Unknown| -|SINGLE_MODE_SIM_CARD | 10 | Single-card (SIM)| -|SINGLE_MODE_USIM_CARD | 20 | Single-card (USIM)| -|SINGLE_MODE_RUIM_CARD | 30 | Single-card (RUIM)| -|DUAL_MODE_CG_CARD | 40 | Dual-card (CDMA+GSM)| -|CT_NATIONAL_ROAMING_CARD | 41 | China Telecom internal roaming card| -|CU_DUAL_MODE_CARD | 42 | China Unicom dual-mode card| -|DUAL_MODE_TELECOM_LTE_CARD | 43 | China Telecom dual-mode LTE card| -|DUAL_MODE_UG_CARD | 50 | Dual-mode card (UMTS+GSM)| -|SINGLE_MODE_ISIM_CARD8+ | 60 | Single-card (ISIM)| +|UNKNOWN_CARD | -1 | Unknown type.| +|SINGLE_MODE_SIM_CARD | 10 | Single-card (SIM).| +|SINGLE_MODE_USIM_CARD | 20 | Single-card (USIM).| +|SINGLE_MODE_RUIM_CARD | 30 | Single-card (RUIM).| +|DUAL_MODE_CG_CARD | 40 | Dual-card (CDMA+GSM).| +|CT_NATIONAL_ROAMING_CARD | 41 | China Telecom internal roaming card.| +|CU_DUAL_MODE_CARD | 42 | China Unicom dual-mode card.| +|DUAL_MODE_TELECOM_LTE_CARD | 43 | China Telecom dual-mode LTE card.| +|DUAL_MODE_UG_CARD | 50 | Dual-mode card (UMTS+GSM).| +|SINGLE_MODE_ISIM_CARD8+ | 60 | Single-card (ISIM).| ## LockType8+ @@ -2826,45 +3999,45 @@ Enumerates personalized lock types. **System capability**: SystemCapability.Telephony.CoreService -| Name | Value | Description | -| ------------ | ---- | ----------------------------------------------- | -| PN_PIN_LOCK | 0 | Personalized network PIN lock. For details, see *3GPP TS 22.022 [33]*. | +| Name | Value | Description | +| ------------ | ---- | ------------------------------------------------ | +| PN_PIN_LOCK | 0 | Personalized network PIN lock. For details, see *3GPP TS 22.022 [33]*. | | PN_PUK_LOCK | 1 | Personalized network PUK lock. | -| PU_PIN_LOCK | 2 | Personalized network subset PIN lock. For details, see *3GPP TS 22.022 [33]*. | +| PU_PIN_LOCK | 2 | Personalized network subset PIN lock. For details, see *3GPP TS 22.022 [33]*. | | PU_PUK_LOCK | 3 | Personalized network subset PUK lock. | -| PP_PIN_LOCK | 4 | Personalized service provider PIN lock. For details, see *3GPP TS 22.022 [33]*.| +| PP_PIN_LOCK | 4 | Personalized service provider PIN lock. For details, see *3GPP TS 22.022 [33]*. | | PP_PUK_LOCK | 5 | Personalized service provider PUK lock. | -| PC_PIN_LOCK | 6 | Personalized corporate PIN lock. For details, see *3GPP TS 22.022 [33]*. | +| PC_PIN_LOCK | 6 | Personalized corporate PIN lock. For details, see *3GPP TS 22.022 [33]*. | | PC_PUK_LOCK | 7 | Personalized corporate PUK lock. | -| SIM_PIN_LOCK | 8 | Personalized SIM card PIN lock. For details, see *3GPP TS 22.022 [33]*. | +| SIM_PIN_LOCK | 8 | Personalized SIM card PIN lock. For details, see *3GPP TS 22.022 [33]*. | | SIM_PUK_LOCK | 9 | Personalized SIM card PUK lock. | ## LockStatusResponse7+ -Defines the lock status response. +Defines the personalized lock information. **System API**: This is a system API. **System capability**: SystemCapability.Telephony.CoreService -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| result | number | Yes | Operation result. | -| remain?: number | number | Yes | Remaining attempts (can be null).| +| Name | Type | Mandatory| Description | +| --------------- | ------ | ---- | --------------------- | +| result | number | Yes | Operation result. | +| remain?: number | number | No | Remaining attempts (can be null).| ## LockInfo8+ -Defines the lock information. +Defines the personalized lock information. **System API**: This is a system API. **System capability**: SystemCapability.Telephony.CoreService -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| lockType | [LockType](#locktype8) | Yes | Lock type.| -| password | string | Yes | Password. | -| state | [LockState](#lockstate8) | Yes | Lock state.| +| Name | Type | Mandatory| Description | +| -------- | ------------------------ | ---- | -------- | +| lockType | [LockType](#locktype8) | Yes | Lock type.| +| password | string | Yes | Password. | +| state | [LockState](#lockstate8) | Yes | Lock state.| ## PersoLockInfo8+ @@ -2874,10 +4047,10 @@ Defines the personalized lock information. **System capability**: SystemCapability.Telephony.CoreService -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| lockType | [PersoLockType](#persolocktype8) | Yes | Personalized lock type.| -| password | string | Yes | Password. | +| Name | Type | Mandatory| Description | +| -------- | -------------------------------- | ---- | ------------- | +| lockType | [PersoLockType](#persolocktype8) | Yes | Personalized lock type.| +| password | string | Yes | Password. | ## IccAccountInfo7+ @@ -2887,15 +4060,15 @@ Defines the ICC account information. **System capability**: SystemCapability.Telephony.CoreService -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| simId | number | Yes | SIM card ID. | -| slotIndex | number | Yes | Card slot ID. | -| isEsim | boolean | Yes | Whether the SIM card is an eSim card.| -| isActive | boolean | Yes | Whether the card is activated. | -| iccId | string | Yes | ICCID number. | -| showName | string | Yes | SIM card display name. | -| showNumber | string | Yes | SIM card display number. | +| Name | Type | Mandatory| Description | +| ---------- | ------- | ---- | ---------------- | +| simId | number | Yes | SIM card ID. | +| slotIndex | number | Yes | Card slot ID. | +| isEsim | boolean | Yes | Whether the SIM card is an eSim card.| +| isActive | boolean | Yes | Whether the card is activated. | +| iccId | string | Yes | ICCID number. | +| showName | string | Yes | SIM card display name. | +| showNumber | string | Yes | SIM card display number. | ## OperatorConfig8+ @@ -2905,10 +4078,10 @@ Defines the carrier configuration. **System capability**: SystemCapability.Telephony.CoreService -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| field | string | Yes | Field. | -| value | string | Yes | Value. | +| Name | Type | Mandatory| Description| +| ----- | ------ | ---- | ---- | +| field | string | Yes | Field.| +| value | string | Yes | Value. | ## DiallingNumbersInfo8+ @@ -2918,12 +4091,12 @@ Defines the contact number information. **System capability**: SystemCapability.Telephony.CoreService -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| alphaTag | string | Yes | Alpha tag. | -| number | string | Yes | Contact number. | -| recordNumber | number | Yes | Record number.| -| pin2 | string | Yes | PIN 2.| +| Name | Type | Mandatory| Description | +| ------------ | ------ | ---- | ---------- | +| alphaTag | string | Yes | Tag. | +| number | string | Yes | Call transfer number. | +| recordNumber | number | Yes | Record number.| +| pin2 | string | Yes | PIN 2.| ## ContactType8+ @@ -2934,7 +4107,7 @@ Enumerates contact types. **System capability**: SystemCapability.Telephony.CoreService | Name | Value | Description | -| -------------- | ---- | ---------- | +| --------------- | ---- | ---------- | | GENERAL_CONTACT | 1 | Common contact number.| | FIXED_DIALING | 2 | Fixed dialing number. | @@ -2946,8 +4119,8 @@ Enumerates carrier configuration keys. **System capability**: SystemCapability.Telephony.CoreService -| Name | Value | Description | -| ------------------------------------------------------- | ---------------------------------------------------- | -------------------- | +| Name | Value | Description | +| ------------------------------------------------------- | ------------------------------------------------------ | -------------------- | | KEY_VOICE_MAIL_NUMBER_STRING | "voice_mail_number_string" | Voice mailbox number. | | KEY_IMS_SWITCH_ON_BY_DEFAULT_BOOL | "ims_switch_on_by_default_bool" | Fixed dialing number. | | KEY_HIDE_IMS_SWITCH_BOOL | "hide_ims_switch_bool" | Whether to hide the IMS switch. | @@ -2960,7 +4133,7 @@ Enumerates carrier configuration keys. | KEY_IMS_PREFER_FOR_EMERGENCY_BOOL | "ims_prefer_for_emergency_bool" | IMS preferences for emergency. | | KEY_CALL_WAITING_SERVICE_CLASS_INT | "call_waiting_service_class_int" | Call waiting service. | | KEY_CALL_TRANSFER_VISIBILITY_BOOL | "call_transfer_visibility_bool" | Call transfer visibility. | -| KEY_IMS_CALL_DISCONNECT_REASONINFO_MAPPING_STRING_ARRAY | "ims_call_disconnect_reasoninfo_mapping_string_array" | List of IMS call disconnection reasons.| +| KEY_IMS_CALL_DISCONNECT_REASON_INFO_MAPPING_STRING_ARRAY| "ims_call_disconnect_reason_info_mapping_string_array" | List of IMS call disconnection reasons.| | KEY_FORCE_VOLTE_SWITCH_ON_BOOL | "force_volte_switch_on_bool" | Whether to forcibly turn on VoLTE. | | KEY_ENABLE_OPERATOR_NAME_CUST_BOOL | "enable_operator_name_cust_bool" | Whether to display the carrier name.| | KEY_OPERATOR_NAME_CUST_STRING | "operator_name_cust_string" | Carrier name. | diff --git a/en/application-dev/reference/apis/js-apis-sms.md b/en/application-dev/reference/apis/js-apis-sms.md index 901e3b258b7aa73530935baa81a6366f7aa50e65..464f34595cc67c5051524d2f7f6ef0753bede543 100644 --- a/en/application-dev/reference/apis/js-apis-sms.md +++ b/en/application-dev/reference/apis/js-apis-sms.md @@ -16,7 +16,7 @@ import sms from '@ohos.telephony.sms'; createMessage\(pdu: Array<number>, specification: string, callback: AsyncCallback\): void -Creates an SMS message instance based on the protocol data unit (PDU) and the specified SMS protocol. This API uses an asynchronous callback to return the result. +Creates an SMS instance based on the protocol data unit (PDU) and specified SMS protocol. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.SmsMms @@ -44,7 +44,7 @@ sms.createMessage(pdu, specification, (err, data) => { createMessage\(pdu: Array<number>, specification: string\): Promise -Creates an SMS message instance based on the PDU and the specified SMS protocol. This API uses a promise to return the result. +Creates an SMS instance based on the PDU and specified SMS protocol. This API uses a promise to return the result. **System capability**: SystemCapability.Telephony.SmsMms @@ -81,7 +81,7 @@ sendMessage(options: SendMessageOptions): void Sends an SMS message. -**Required permission**: ohos.permission.SEND_MESSAGES +**Required permissions**: ohos.permission.SEND_MESSAGES **System capability**: SystemCapability.Telephony.SmsMms @@ -91,6 +91,19 @@ Sends an SMS message. | ------- | ----------------------------------------- | ---- | ------------------------------------------------------------ | | options | [SendMessageOptions](#sendmessageoptions) | Yes | Options (including the callback) for sending an SMS message.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -114,7 +127,7 @@ sms.sendMessage(options); getDefaultSmsSlotId\(callback: AsyncCallback<number>\): void -Obtains the default slot of the SIM card used to send SMS messages. This API uses an asynchronous callback to return the result. +Obtains the default slot ID of the SIM card used to send SMS messages. This API uses an asynchronous callback to return the result. **System capability**: SystemCapability.Telephony.SmsMms @@ -122,7 +135,7 @@ Obtains the default slot of the SIM card used to send SMS messages. This API use | Name | Type | Mandatory| Description | | -------- | --------------------------- | ---- | ---------------------------------------- | -| callback | AsyncCallback<number> | Yes | Callback used to return the result.
- **0**: card slot 1
- **1**: card slot 2| +| callback | AsyncCallback<number> | Yes | Callback used to return the result.
- **0**: card slot 1
- **1**: card slot 2| **Example** @@ -137,7 +150,7 @@ sms.getDefaultSmsSlotId((err, data) => { getDefaultSmsSlotId\(\): Promise<number> -Obtains the default slot of the SIM card used to send SMS messages. This API uses a promise to return the result. +Obtains the default slot ID of the SIM card used to send SMS messages. This API uses a promise to return the result. **System capability**: SystemCapability.Telephony.SmsMms @@ -162,11 +175,11 @@ promise.then(data => { setDefaultSmsSlotId\(slotId: number, callback: AsyncCallback<void>\): void -Sets the default slot of the SIM card used to send SMS messages. This API uses an asynchronous callback to return the result. +Sets the default slot ID of the SIM card used to send SMS messages. This API uses an asynchronous callback to return the result. **System API**: This is a system API. -**Required permission**: ohos.permission.SET_TELEPHONY_STATE +**Required permissions**: ohos.permission.SET_TELEPHONY_STATE **System capability**: SystemCapability.Telephony.SmsMms @@ -174,14 +187,28 @@ Sets the default slot of the SIM card used to send SMS messages. This API uses a | Name | Type | Mandatory| Description | | -------- | ------------------------- | ---- | ------------------------------------------------------------ | -| slotId | number | Yes | SIM card slot ID.
- **0**: card slot 1
- **1**: card slot 2
- **-1**: clearing the default configuration| +| slotId | number | Yes | SIM card slot ID.
- **0**: card slot 1
- **1**: card slot 2
- **-1**: Clears the default configuration.| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | + **Example** ```js -sms.setDefaultSmsSlotId(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sms.setDefaultSmsSlotId(0, (err) => { + console.log(`callback: err->${JSON.stringify(err)}.`); }); ``` @@ -190,11 +217,11 @@ sms.setDefaultSmsSlotId(0, (err, data) => { setDefaultSmsSlotId\(slotId: number\): Promise<void> -Sets the default slot of the SIM card used to send SMS messages. This API uses a promise to return the result. +Sets the default slot ID of the SIM card used to send SMS messages. This API uses a promise to return the result. **System API**: This is a system API. -**Required permission**: ohos.permission.SET_TELEPHONY_STATE +**Required permissions**: ohos.permission.SET_TELEPHONY_STATE **System capability**: SystemCapability.Telephony.SmsMms @@ -202,21 +229,35 @@ Sets the default slot of the SIM card used to send SMS messages. This API uses a | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------------------------------------------------------ | -| slotId | number | Yes | SIM card slot ID.
- **0**: card slot 1
- **1**: card slot 2
- **-1**: clearing the default configuration| +| slotId | number | Yes | SIM card slot ID.
- **0**: card slot 1
- **1**: card slot 2
- **-1**: Clears the default configuration.| **Return value** -| Type | Description | -| -------------- | ------------------------------- | -| Promise\ | Promise used to return the result. | +| Type | Description | +| --------------- | ------------------------------- | +| Promise\ | Promise used to return the result.| + +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | **Example** ```js let promise = sms.setDefaultSmsSlotId(0); -promise.then(data => { - console.log(`setDefaultSmsSlotId success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`setDefaultSmsSlotId success.`); +}).catch((err) => { console.error(`setDefaultSmsSlotId failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -229,7 +270,7 @@ Sets the short message service center (SMSC) address. This API uses an asynchron **System API**: This is a system API. -**Required permission**: ohos.permission.SET_TELEPHONY_STATE (a system permission) +**Required permissions**: ohos.permission.SET_TELEPHONY_STATE (a system permission) **System capability**: SystemCapability.Telephony.SmsMms @@ -241,13 +282,26 @@ Sets the short message service center (SMSC) address. This API uses an asynchron | smscAddr | string | Yes | SMSC address. | | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js let slotId = 0; let smscAddr = '+861xxxxxxxxxx'; -sms.setSmscAddr(slotId, smscAddr, (err,data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sms.setSmscAddr(slotId, smscAddr, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -260,7 +314,7 @@ Sets the SMSC address. This API uses a promise to return the result. **System API**: This is a system API. -**Required permission**: ohos.permission.SET_TELEPHONY_STATE (a system permission) +**Required permissions**: ohos.permission.SET_TELEPHONY_STATE (a system permission) **System capability**: SystemCapability.Telephony.SmsMms @@ -277,15 +331,28 @@ Sets the SMSC address. This API uses a promise to return the result. | ------------------- | ------------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js let slotId = 0; let smscAddr = '+861xxxxxxxxxx'; let promise = sms.setSmscAddr(slotId, smscAddr); -promise.then(data => { - console.log(`setSmscAddr success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`setSmscAddr success.`); +}).catch((err) => { console.error(`setSmscAddr failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -299,7 +366,7 @@ Obtains the SMSC address. This API uses an asynchronous callback to return the r **System API**: This is a system API. -**Required permission**: ohos.permission.GET_TELEPHONY_STATE (a system permission) +**Required permissions**: ohos.permission.GET_TELEPHONY_STATE (a system permission) **System capability**: SystemCapability.Telephony.SmsMms @@ -310,6 +377,19 @@ Obtains the SMSC address. This API uses an asynchronous callback to return the r | slotId | number | Yes | SIM card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback<string> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -328,7 +408,7 @@ Obtains the SMSC address. This API uses a promise to return the result. **System API**: This is a system API. -**Required permission**: ohos.permission.GET_TELEPHONY_STATE (a system permission) +**Required permissions**: ohos.permission.GET_TELEPHONY_STATE (a system permission) **System capability**: SystemCapability.Telephony.SmsMms @@ -344,6 +424,19 @@ Obtains the SMSC address. This API uses a promise to return the result. | --------------------- | --------------------------------------------- | | Promise<string> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -360,7 +453,7 @@ promise.then(data => { hasSmsCapability(): boolean -Checks whether the current device can send and receive SMS messages. This API returns the result synchronously. +Checks whether the current device can send and receive SMS messages. This API works in synchronous mode. **System capability**: SystemCapability.Telephony.SmsMms @@ -383,7 +476,7 @@ Splits an SMS message into multiple segments. This API uses an asynchronous call **System API**: This is a system API. -**Required permission**: ohos.permission.SEND_MESSAGES +**Required permissions**: ohos.permission.SEND_MESSAGES **System capability**: SystemCapability.Telephony.SmsMms @@ -394,6 +487,19 @@ Splits an SMS message into multiple segments. This API uses an asynchronous call | content | string | Yes | SMS message content. The value cannot be null.| | callback | AsyncCallback> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -412,7 +518,7 @@ Splits an SMS message into multiple segments. This API uses a promise to return **System API**: This is a system API. -**Required permission**: ohos.permission.SEND_MESSAGES +**Required permissions**: ohos.permission.SEND_MESSAGES **System capability**: SystemCapability.Telephony.SmsMms @@ -428,6 +534,19 @@ Splits an SMS message into multiple segments. This API uses a promise to return | ----------------------- | ----------------------------------- | | Promise> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -448,7 +567,7 @@ Adds a SIM message. This API uses an asynchronous callback to return the result. **System API**: This is a system API. -**Required permission**: ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES +**Required permissions**: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES **System capability**: SystemCapability.Telephony.SmsMms @@ -459,6 +578,19 @@ Adds a SIM message. This API uses an asynchronous callback to return the result. | options | [SimMessageOptions](#simmessageoptions7) | Yes | SIM message options.| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -468,8 +600,8 @@ let simMessageOptions = { pdu: "xxxxxx", status: sms.SimMessageStatus.SIM_MESSAGE_STATUS_READ }; -sms.addSimMessage(simMessageOptions, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sms.addSimMessage(simMessageOptions, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -482,7 +614,7 @@ Adds a SIM message. This API uses a promise to return the result. **System API**: This is a system API. -**Required permission**: ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES +**Required permissions**: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES **System capability**: SystemCapability.Telephony.SmsMms @@ -498,6 +630,19 @@ Adds a SIM message. This API uses a promise to return the result. | ------------------- | ----------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -508,9 +653,9 @@ let simMessageOptions = { status: sms.SimMessageStatus.SIM_MESSAGE_STATUS_READ }; let promise = sms.addSimMessage(simMessageOptions); -promise.then(data => { - console.log(`addSimMessage success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`addSimMessage success.`); +}).catch((err) => { console.error(`addSimMessage failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -523,7 +668,7 @@ Deletes a SIM message. This API uses an asynchronous callback to return the resu **System API**: This is a system API. -**Required permission**: ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES +**Required permissions**: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES **System capability**: SystemCapability.Telephony.SmsMms @@ -535,13 +680,26 @@ Deletes a SIM message. This API uses an asynchronous callback to return the resu | msgIndex | number | Yes | Message index. | | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```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.delSimMessage(slotId, msgIndex, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -554,7 +712,7 @@ Deletes a SIM message. This API uses a promise to return the result. **System API**: This is a system API. -**Required permission**: ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES +**Required permissions**: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES **System capability**: SystemCapability.Telephony.SmsMms @@ -571,15 +729,28 @@ Deletes a SIM message. This API uses a promise to return the result. | ------------------- | ----------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```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 => { +promise.then(() => { + console.log(`delSimMessage success.`); +}).catch((err) => { console.error(`delSimMessage failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -592,7 +763,7 @@ Updates a SIM message. This API uses an asynchronous callback to return the resu **System API**: This is a system API. -**Required permission**: ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES +**Required permissions**: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES **System capability**: SystemCapability.Telephony.SmsMms @@ -603,6 +774,19 @@ Updates a SIM message. This API uses an asynchronous callback to return the resu | options | [UpdateSimMessageOptions](#updatesimmessageoptions7) | Yes | SIM message updating options.| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -613,8 +797,8 @@ let updateSimMessageOptions = { pdu: "xxxxxxx", smsc: "test" }; -sms.updateSimMessage(updateSimMessageOptions, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sms.updateSimMessage(updateSimMessageOptions, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -627,7 +811,7 @@ Updates a SIM message. This API uses a promise to return the result. **System API**: This is a system API. -**Required permission**: ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES +**Required permissions**: ohos.permission.RECEIVE_SMS and ohos.permission.SEND_MESSAGES **System capability**: SystemCapability.Telephony.SmsMms @@ -643,6 +827,19 @@ Updates a SIM message. This API uses a promise to return the result. | ------------------- | ----------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -654,9 +851,9 @@ let updateSimMessageOptions = { smsc: "test" }; let promise = sms.updateSimMessage(updateSimMessageOptions); -promise.then(data => { - console.log(`updateSimMessage success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`updateSimMessage success.`); +}).catch((err) => { console.error(`updateSimMessage failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -669,7 +866,7 @@ Obtains all SIM card messages. This API uses an asynchronous callback to return **System API**: This is a system API. -**Required permission**: ohos.permission.RECEIVE_SMS +**Required permissions**: ohos.permission.RECEIVE_SMS **System capability**: SystemCapability.Telephony.SmsMms @@ -680,6 +877,19 @@ Obtains all SIM card messages. This API uses an asynchronous callback to return | slotId | number | Yes | SIM card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -698,7 +908,7 @@ Obtains all SIM card messages. This API uses a promise to return the result. **System API**: This is a system API. -**Required permission**: ohos.permission.RECEIVE_SMS +**Required permissions**: ohos.permission.RECEIVE_SMS **System capability**: SystemCapability.Telephony.SmsMms @@ -714,6 +924,19 @@ Obtains all SIM card messages. This API uses a promise to return the result. | ------------------------------------------------------- | ---------------------------------- | | PromiseArray<[SimShortMessage](#simshortmessage7)\>> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -734,7 +957,7 @@ Sets the cell broadcast configuration. This API uses an asynchronous callback to **System API**: This is a system API. -**Required permission**: ohos.permission.RECEIVE_SMS +**Required permissions**: ohos.permission.RECEIVE_SMS **System capability**: SystemCapability.Telephony.SmsMms @@ -745,6 +968,19 @@ Sets the cell broadcast configuration. This API uses an asynchronous callback to | options | [CBConfigOptions](#cbconfigoptions7) | Yes | Cell broadcast configuration options.| | callback | AsyncCallback<void> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -755,8 +991,8 @@ let cbConfigOptions = { endMessageId: 200, ranType: sms.RanType.TYPE_GSM }; -sms.setCBConfig(cbConfigOptions, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sms.setCBConfig(cbConfigOptions, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -769,7 +1005,7 @@ Sets the cell broadcast configuration. This API uses a promise to return the res **System API**: This is a system API. -**Required permission**: ohos.permission.RECEIVE_SMS +**Required permissions**: ohos.permission.RECEIVE_SMS **System capability**: SystemCapability.Telephony.SmsMms @@ -785,6 +1021,19 @@ Sets the cell broadcast configuration. This API uses a promise to return the res | ------------------- | ----------------------------- | | Promise<void> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -796,9 +1045,9 @@ let cbConfigOptions = { ranType: sms.RanType.TYPE_GSM }; let promise = sms.setCBConfig(cbConfigOptions); -promise.then(data => { - console.log(`setCBConfig success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`setCBConfig success.`); +}).catch((err) => { console.error(`setCBConfig failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -820,7 +1069,19 @@ Obtains SMS message segment information. This API uses an asynchronous callback | slotId | number | Yes | SIM card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | message | string | Yes | SMS message. | | force7bit | boolean | Yes | Whether to use 7-bit coding. | -| callback | | Yes | Callback used to return the result. | +| callback | AsyncCallback<[SmsSegmentsInfo](#smssegmentsinfo8)> | Yes | Callback used to return the result. | + +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** @@ -847,14 +1108,26 @@ Obtains SMS message segment information. This API uses a promise to return the r | Name | Type | Mandatory| Description | | --------- | ------- | ---- | ----------------------------------------- | | slotId | number | Yes | SIM card slot ID.
- **0**: card slot 1
- **1**: card slot 2| -| message | string | Yes | Message | +| message | string | Yes | SMS message. | | force7bit | boolean | Yes | Whether to use 7-bit coding. | **Return value** | Type | Description | | ------------------------------------------------------- | ----------------------------- | -| | Promise used to return the result.| +| Promise<[SmsSegmentsInfo](#smssegmentsinfo8)> | Promise used to return the result.| + +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **Example** @@ -885,6 +1158,18 @@ Checks whether SMS is supported on IMS. This API uses an asynchronous callback t | slotId | number | Yes | SIM card slot ID.
- **0**: card slot 1
- **1**: card slot 2| | callback | AsyncCallback<boolean> | Yes | Callback used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -899,7 +1184,7 @@ sms.isImsSmsSupported(slotId, (err, data) => { isImsSmsSupported(slotId: number): Promise -Checks whether SMS is supported on IMS. This API uses a promise to return the result. +This API uses an asynchronous callback to return the result. This API uses a promise to return the result. **System API**: This is a system API. @@ -917,6 +1202,18 @@ Checks whether SMS is supported on IMS. This API uses a promise to return the re | ---------------------- | ----------------------- | | Promise<boolean> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -945,6 +1242,18 @@ Obtains the SMS format supported by the IMS. This API uses an asynchronous callb | -------- | --------------------------- | ---- | ---------- | | callback | AsyncCallback<string> | Yes | Callback used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -970,6 +1279,18 @@ Obtains the SMS format supported by the IMS. This API uses a promise to return t | --------------------- | -------------------------- | | Promise<string> | Promise used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -998,6 +1319,18 @@ Decodes MMS messages. This API uses an asynchronous callback to return the resul | mmsFilePathName | string \|Array | Yes | MMS message file path.| | callback | AsyncCallback<[MmsInformation](#mmsinformation8)> | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1030,6 +1363,18 @@ Decodes MMS messages. This API uses a promise to return the result. | --------------------------------------------------------- | --------------------------- | | Promise<<[MmsInformation](#mmsinformation8)>> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1046,7 +1391,7 @@ promise.then(data => { encodeMms(mms: MmsInformation, callback: AsyncCallback>): void -Encodes MMS messages. This API uses an asynchronous callback to return the result. +MMS message code. This API uses an asynchronous callback to return the result. **System API**: This is a system API. @@ -1059,6 +1404,18 @@ Encodes MMS messages. This API uses an asynchronous callback to return the resul | mms | [MmsInformation](#mmsinformation8) | Yes | MMS message information.| | callback | AsyncCallback<Array> | Yes | Callback used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1081,7 +1438,7 @@ sms.encodeMms(mmsInformation, (err, data) => { encodeMms(mms: MmsInformation): Promise> -Encodes MMS messages. This API uses a promise to return the result. +MMS message code. This API uses a promise to return the result. **System API**: This is a system API. @@ -1099,6 +1456,18 @@ Encodes MMS messages. This API uses a promise to return the result. | ----------------------------- | ----------------------------------- | | Promise<Array> | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -1125,19 +1494,19 @@ Defines an SMS message instance. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| hasReplyPath | boolean | Yes |Whether the received SMS contains **TP-Reply-Path**. The default value is **false**.
**TP-Reply-Path**: The device returns a response based on the SMSC that sends the SMS message.| -| isReplaceMessage | boolean | Yes |Whether the received SMS message is a **replace short message**. The default value is **false**.
For details, see section 9.2.3.9 in **3GPP TS 23.040**.| -| isSmsStatusReportMessage | boolean | Yes |Whether the received SMS message is an SMS delivery status report. The default value is **false**.
**SMS-Status-Report**: a message sent from the SMSC to the mobile station to show the SMS message delivery status.| -| messageClass | [ShortMessageClass](#shortmessageclass) | Yes | SMS message type. | -| pdu | Array<number> | Yes | PDU in the SMS message. | -| protocolId | number | Yes | Protocol identifier used for delivering the SMS message. | -| scAddress | string | Yes | SMSC address. | -| scTimestamp | number | Yes | SMSC timestamp. | -| status | number | Yes | SMS message status sent by the SMSC in the **SMS-STATUS-REPORT** message.| -| visibleMessageBody | string | Yes | SMS message body. | -| visibleRawAddress | string | Yes | Sender address. | +| Name | Type | Mandatory| Description | +| ------------------------ | --------------------------------------- | ---- | ------------------------------------------------------------ | +| hasReplyPath | boolean | Yes | Whether the received SMS contains **TP-Reply-Path**. The default value is **false**.
TP-Reply-Path: The device returns a response based on the SMSC that sends the SMS message. | +| isReplaceMessage | boolean | Yes | Whether the received SMS message is a **replace short message**. The default value is **false**.
For details, see section 9.2.3.9 in **3GPP TS 23.040**.| +| isSmsStatusReportMessage | boolean | Yes | Whether the received SMS message is an SMS delivery report. The default value is **false**.
SMS delivery report: a message sent from the SMSC to show the current status of the SMS message you delivered.| +| messageClass | [ShortMessageClass](#shortmessageclass) | Yes | Enumerates SMS message types. | +| pdu | Array<number> | Yes | PDU in the SMS message. | +| protocolId | number | Yes | Protocol identifier used for delivering the SMS message. | +| scAddress | string | Yes | SMSC address. | +| scTimestamp | number | Yes | SMSC timestamp. | +| status | number | Yes | SMS message status sent by the SMSC in the **SMS-STATUS-REPORT** message.| +| visibleMessageBody | string | Yes | SMS message body. | +| visibleRawAddress | string | Yes | Sender address. | ## ShortMessageClass @@ -1161,7 +1530,7 @@ Provides the options (including callbacks) for sending an SMS message. For examp **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ---------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | slotId | number | Yes | Slot ID of the SIM card used for sending SMS messages.
- **0**: card slot 1
- **1**: card slot 2 | | destinationHost | string | Yes | Destination address of the SMS message. | @@ -1178,22 +1547,22 @@ Provides the callback for the SMS message sending result. It consists of three p **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | -| ---------- | ------------------------------- | ---- | ------------------------------------------------------------ | +| Name | Type | Mandatory| Description | +| ---------- | ------------------------------- | ---- | ----------------------------------------------------------------------------------------- | | isLastPart | boolean | No | Whether this SMS message is the last part of a long SMS message. The value **true** indicates that this SMS message is the last part of a long SMS message, and value **false** indicates the opposite. The default value is **false**.| -| result | [SendSmsResult](#sendsmsresult) | Yes | SMS message sending result. | -| url | string | Yes | URI for storing the sent SMS message. | +| result | [SendSmsResult](#sendsmsresult) | Yes | SMS message sending result. | +| url | string | Yes | URI for storing the sent SMS message. | ## IDeliveryShortMessageCallback -Provides the callback for the SMS message delivery report. +Provides the callback for the SMS message delivery report. **System capability**: SystemCapability.Telephony.SmsMms | Name| Type | Mandatory| Description | -| ------ | ------------------- | ---- | -------------- | -| pdu | Array<number> | Yes | SMS message delivery report.| +| ---- | ------------------- | ---- | -------------- | +| pdu | Array<number> | Yes | SMS message delivery report.| ## SendSmsResult @@ -1209,7 +1578,6 @@ Enumerates SMS message sending results. | SEND_SMS_FAILURE_RADIO_OFF | 2 | Failed to send the SMS message because the modem is shut down. | | SEND_SMS_FAILURE_SERVICE_UNAVAILABLE | 3 | Failed to send the SMS message because the network is unavailable or SMS message sending or receiving is not supported.| - ## MmsInformation8+ Defines the MMS message information. @@ -1218,10 +1586,10 @@ Defines the MMS message information. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | -| ----------- | ------------------------------------------------------------ | ---- | --------- | -| messageType | [MessageType](#messagetype8) | Yes | Message type. | -| mmsType | [MmsSendReq](#mmssendreq8) \|[MmsSendConf](#mmssendconf8) \|[MmsNotificationInd](#mmsnotificationind8) \|[MmsRespInd](#mmsrespind8) \|[MmsRetrieveConf](#mmsretrieveconf8)\|[MmsAcknowledgeInd](#mmsacknowledgeind8)\|[MmsDeliveryInd](#mmsdeliveryind8)\|[MmsReadOrigInd](#mmsreadorigind8)\|[MmsReadRecInd](#mmsreadrecind8)| Yes | PDU header type.| +| Name | Type | Mandatory| Description | +| ----------- | ------------------------------------------------------------ | ---- | ---------- | +| messageType | [MessageType](#messagetype8) | Yes | Message type.| +| mmsType | [MmsSendReq](#mmssendreq8) \|[MmsSendConf](#mmssendconf8) \|[MmsNotificationInd](#mmsnotificationind8) \|[MmsRespInd](#mmsrespind8) \|[MmsRetrieveConf](#mmsretrieveconf8)\|[MmsAcknowledgeInd](#mmsacknowledgeind8)\|[MmsDeliveryInd](#mmsdeliveryind8)\|[MmsReadOrigInd](#mmsreadorigind8)\|[MmsReadRecInd](#mmsreadrecind8) | Yes | PDU header type.| | attachment | Array<[MmsAttachment](#mmsattachment8)\> | No | Attachment. | ## MmsSendReq8+ @@ -1232,13 +1600,13 @@ Defines an MMS message sending request. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ---------------- | ------------------------------------ | ---- | ------------ | | from | [MmsAddress](#mmsaddress8) | Yes | MMS message source. | | transactionId | string | Yes | Transaction ID. | | contentType | string | Yes | Content type. | | version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | -| to | Array<[MmsAddress](#mmsaddress8)\> | No | Address to which the message is sent. | +| to | Array<[MmsAddress](#mmsaddress8)\> | No | Destination address. | | date | number | No | Date. | | cc | Array<[MmsAddress](#mmsaddress8)\> | No | Carbon copy. | | bcc | Array<[MmsAddress](#mmsaddress8)\> | No | Blind carbon copy. | @@ -1258,7 +1626,7 @@ Defines the MMS message sending configuration. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ------------- | ---------------------------------- | ---- | -------- | | responseState | number | Yes | Response status.| | transactionId | string | Yes | Transaction ID. | @@ -1273,7 +1641,7 @@ Defines an MMS notification index. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | --------------- | ---------------------------------- | ---- | -------- | | transactionId | string | Yes | Transaction ID. | | messageClass | number | Yes | Message class. | @@ -1281,7 +1649,7 @@ Defines an MMS notification index. | expiry | number | Yes | Expiration. | | contentLocation | string | Yes | Content location.| | version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | -| from | [MmsAddress](#mmsaddress8) | No | Source. | +| from | [MmsAddress](#mmsaddress8) | No | Source address. | | subject | string | No | Subject. | | deliveryReport | number | No | Status report.| | contentClass | number | No | Content class. | @@ -1294,7 +1662,7 @@ Defines an MMS confirmation index. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ------------- | ---------------------------------- | ---- | -------- | | transactionId | string | Yes | Transaction ID. | | version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | @@ -1308,15 +1676,15 @@ Defines the MMS message retrieval configuration. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | -------------- | ------------------------------------ | ---- | -------- | | transactionId | string | Yes | Transaction ID. | | messageId | string | Yes | Message ID. | | date | number | Yes | Date. | | contentType | string | Yes | Content type.| -| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Address to which the message is sent. | -| version | [MmsVersionType](#mmsversiontype8) | Yes | Version | -| from | [MmsAddress](#mmsaddress8) | No | Source. | +| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Destination address. | +| version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | +| from | [MmsAddress](#mmsaddress8) | No | Source address. | | cc | Array<[MmsAddress](#mmsaddress8)\> | No | Carbon copy. | | subject | string | No | Subject. | | priority | [MmsPriorityType](#mmsprioritytype8) | No | Priority. | @@ -1333,16 +1701,15 @@ Defines the original MMS message reading index. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ---------- | ---------------------------------- | ---- | -------- | | version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | | messageId | string | Yes | Message ID. | -| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Address to which the message is sent. | -| from | [MmsAddress](#mmsaddress8) | Yes | Source. | +| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Destination address. | +| from | [MmsAddress](#mmsaddress8) | Yes | Source address. | | date | number | Yes | Date. | | readStatus | number | Yes | Read status.| - ## MmsReadRecInd8+ Defines the MMS message reading index. @@ -1351,16 +1718,15 @@ Defines the MMS message reading index. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ---------- | ---------------------------------- | ---- | -------- | -| version | [MmsVersionType](#mmsversiontype8) | Yes | Version | +| version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | | messageId | string | Yes | Message ID. | -| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Destination. | -| from | [MmsAddress](#mmsaddress8) | Yes | Source. | -| readStatus | number | Yes | Read state.| +| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Destination address. | +| from | [MmsAddress](#mmsaddress8) | Yes | Source address. | +| readStatus | number | Yes | Read status.| | date | number | No | Date. | - ## MmsAttachment8+ Defines the attachment of an MMS message. @@ -1369,7 +1735,7 @@ Defines the attachment of an MMS message. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ----------------------- | ------------------------------------ | ---- | ------------------ | | contentId | string | Yes | Content ID. | | contentLocation | string | Yes | Content location. | @@ -1378,7 +1744,7 @@ Defines the attachment of an MMS message. | contentType | string | Yes | Content type. | | isSmil | boolean | Yes | Whether the synchronized multimedia integration language is used.| | path | string | No | Path. | -| inBuff | Array | No | In the buffer | +| inBuff | Array | No | Whether the message is in the buffer. | | fileName | string | No | File name. | | charset | [MmsCharSets](#mmscharsets8) | No | Character set. | @@ -1390,20 +1756,20 @@ Defines an MMSC address. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ------- | ---------------------------- | ---- | ------ | -| address | string | Yes | MMSC address. | +| address | string | Yes | Network address. | | charset | [MmsCharSets](#mmscharsets8) | Yes | Character set.| ## MessageType8+ -Enumerates message types. +Message type. **System API**: This is a system API. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Value | Description | +| Name | Value | Description | | ------------------------- | ---- | -------------------- | | TYPE_MMS_SEND_REQ | 128 | MMS message sending request. | | TYPE_MMS_SEND_CONF | 129 | MMS message sending configuration. | @@ -1423,7 +1789,7 @@ Enumerates MMS message priorities. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Value | Description | +| Name | Value | Description | | ---------- | ---- | -------------- | | MMS_LOW | 128 | Low priority. | | MMS_NORMAL | 129 | Normal priority.| @@ -1437,7 +1803,7 @@ Enumerates MMS versions. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Value | Description | +| Name | Value | Description | | --------------- | ---- | ----------- | | MMS_VERSION_1_0 | 0x10 | MMS version 1_0.| | MMS_VERSION_1_1 | 0x11 | MMS version 1_1.| @@ -1452,7 +1818,7 @@ Enumerates MMS character sets. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Value | Description | +| Name | Value | Description | | --------------- | ------ | ------------------- | | BIG5 | 0X07EA | BIG5 format. | | ISO_10646_UCS_2 | 0X03E8 | ISO_10646_UCS_2 format.| @@ -1477,7 +1843,7 @@ Enumerates disposition types. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Value | Description | +| Name | Value | Description | | ---------- | ---- | -------- | | FROM_DATA | 0 | Data source.| | ATTACHMENT | 1 | Attachment. | @@ -1491,7 +1857,7 @@ Enumerates report types. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Value | Description| +| Name | Value | Description| | ------- | ---- | ---- | | MMS_YES | 128 | YES | | MMS_NO | 129 | NO | @@ -1504,7 +1870,7 @@ Defines the cell broadcast configuration options. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | -------------- | -------------------- | ---- | ------------ | | slotId | number | Yes | Card slot ID. | | enable | boolean | Yes | Whether to enable cell broadcast. | @@ -1520,7 +1886,7 @@ Defines the SIM message status. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Value | Description | +| Name | Value | Description | | ------------------------- | ---- | --------------------------- | | SIM_MESSAGE_STATUS_FREE | 0 | Free state. | | SIM_MESSAGE_STATUS_READ | 1 | Read state. | @@ -1530,13 +1896,13 @@ Defines the SIM message status. ## RanType7+ -Enumerates RAN types. +RAN type. **System API**: This is a system API. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Value | Description| +| Name | Value | Description| | --------- | ---- | ---- | | TYPE_GSM | 1 | GSM | | TYPE_CDMA | 2 | CMDA | @@ -1549,7 +1915,7 @@ Enumerates SMS encoding schemes. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Value | Description | +| Name | Value | Description | | -------------------- | ---- | ------------ | | SMS_ENCODING_UNKNOWN | 0 | Unknown code.| | SMS_ENCODING_7BIT | 1 | 7-digit code. | @@ -1564,12 +1930,12 @@ Defines the SIM message options. **System capability**: SystemCapability.Telephony.SmsMms -| Name| Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ------ | -------------------------------------- | ---- | -------------- | | slotId | number | Yes | Card slot ID. | | smsc | string | Yes | Short message service center.| | pdu | string | Yes | Protocol data unit. | -| status | [SimMessageStatus](#simmessagestatus7) | Yes | Message status. | +| status | [SimMessageStatus](#simmessagestatus7) | Yes | Status. | ## UpdateSimMessageOptions7+ @@ -1579,7 +1945,7 @@ Defines the updating SIM message options. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | --------- | -------------------------------------- | ---- | -------------- | | slotId | number | Yes | Card slot ID. | | msgIndex | number | Yes | Message index. | @@ -1595,7 +1961,7 @@ Defines a SIM message. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ---------------- | -------------------------------------- | ---- | ------------- | | shortMessage | [ShortMessage](#shortmessage) | Yes | SMS message. | | simMessageStatus | [SimMessageStatus](#simmessagestatus7) | Yes | SIM message status.| @@ -1609,12 +1975,12 @@ Defines an MMS message delivery index. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | --------- | ---------------------------------- | ---- | ------ | | messageId | string | Yes | Message ID.| | date | number | Yes | Date. | -| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Address to which the message is sent.| -| status | number | Yes | Status. | +| to | Array<[MmsAddress](#mmsaddress8)\> | Yes | Destination address.| +| status | number | Yes | Status | | version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | ## MmsRespInd8+ @@ -1625,10 +1991,10 @@ Defines an MMS response index. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | ------------- | ---------------------------------- | ---- | -------- | | transactionId | string | Yes | Event ID. | -| status | number | Yes | Status. | +| status | number | Yes | Status | | version | [MmsVersionType](#mmsversiontype8) | Yes | Version. | | reportAllowed | [ReportType](#reporttype8) | No | Report allowed.| @@ -1640,7 +2006,7 @@ Defines the SMS message segment information. **System capability**: SystemCapability.Telephony.SmsMms -| Name | Type | Mandatory| Description | +| Name | Type | Mandatory| Description | | -------------------- | ---------------------------------------- | ---- | ------------ | | splitCount | number | Yes | Split count. | | encodeCount | number | Yes | Encoding count. | diff --git a/en/application-dev/reference/apis/js-apis-socket.md b/en/application-dev/reference/apis/js-apis-socket.md index bd14137464ce195f5c61b9d6a53ce6ef79cd3f10..d60b3e4eaf6245634140ba6c217bb3d97eb2ac25 100644 --- a/en/application-dev/reference/apis/js-apis-socket.md +++ b/en/application-dev/reference/apis/js-apis-socket.md @@ -1,8 +1,9 @@ -# @ohos.net.socket (Socket Connection) +# # @ohos.net.socket (Socket Connection) -The **socket** module implements socket connection management and operation. +The **socket** module implements data transfer over TCPSocket, UDPSocket, WebSocket, and TLSSocket connections. -> **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. ## Modules to Import @@ -13,7 +14,7 @@ import socket from '@ohos.net.socket'; ## socket.constructUDPSocketInstance -constructUDPSocketInstance\(\): UDPSocket +constructUDPSocketInstance(): UDPSocket Creates a **UDPSocket** object. @@ -22,7 +23,7 @@ Creates a **UDPSocket** object. **Return value** | Type | Description | -| --------------------------------- | ---------------------- | +| :--------------------------------- | :---------------------- | | [UDPSocket](#udpsocket) | **UDPSocket** object.| @@ -39,7 +40,7 @@ Defines a **UDPSocket** connection. Before invoking UDPSocket APIs, you need to ### bind -bind\(address: NetAddress, callback: AsyncCallback\): void +bind(address: NetAddress, callback: AsyncCallback\): void Binds the IP address and port number. The port number can be specified or randomly allocated by the system. This API uses an asynchronous callback to return the result. @@ -54,6 +55,13 @@ Binds the IP address and port number. The port number can be specified or random | address | [NetAddress](#netaddress) | Yes | Destination address. For details, see [NetAddress](#netaddress).| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **Example** ```js @@ -70,7 +78,7 @@ udp.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}, err => { ### bind -bind\(address: NetAddress\): Promise +bind(address: NetAddress): Promise\ Binds the IP address and port number. The port number can be specified or randomly allocated by the system. This API uses a promise to return the result. @@ -84,11 +92,17 @@ Binds the IP address and port number. The port number can be specified or random | ------- | ---------------------------------- | ---- | ------------------------------------------------------ | | address | [NetAddress](#netaddress) | Yes | Destination address. For details, see [NetAddress](#netaddress).| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | **Return value** | Type | Description | -| -------------- | ----------------------------------------- | +| :-------------- | :----------------------------------------- | | Promise\ | Promise used to return the result.| **Example** @@ -106,7 +120,7 @@ promise .then(() => { ### send -send\(options: UDPSendOptions, callback: AsyncCallback\): void +send(options: UDPSendOptions, callback: AsyncCallback\): void Sends data over a UDPSocket connection. This API uses an asynchronous callback to return the result. @@ -123,6 +137,13 @@ Before sending data, call [UDPSocket.bind()](#bind) to bind the IP address and p | options | [UDPSendOptions](#udpsendoptions) | Yes | Parameters for sending data over the UDPSocket connection. For details, see [UDPSendOptions](#udpsendoptions).| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **Example** ```js @@ -146,7 +167,7 @@ udp.send({ ### send -send\(options: UDPSendOptions\): Promise +send(options: UDPSendOptions): Promise\ Sends data over a UDPSocket connection. This API uses a promise to return the result. @@ -162,10 +183,17 @@ Before sending data, call [UDPSocket.bind()](#bind) to bind the IP address and p | ------- | ---------------------------------------- | ---- | ------------------------------------------------------------ | | options | [UDPSendOptions](#udpsendoptions) | Yes | Parameters for sending data over the UDPSocket connection. For details, see [UDPSendOptions](#udpsendoptions).| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **Return value** | Type | Description | -| -------------- | --------------------------------------------- | +| :-------------- | :--------------------------------------------- | | Promise\ | Promise used to return the result.| **Example** @@ -190,7 +218,7 @@ promise.then(() => { ### close -close\(callback: AsyncCallback\): void +close(callback: AsyncCallback\): void Closes a UDPSocket connection. This API uses an asynchronous callback to return the result. @@ -220,7 +248,7 @@ udp.close(err => { ### close -close\(\): Promise +close(): Promise\ Closes a UDPSocket connection. This API uses a promise to return the result. @@ -231,7 +259,7 @@ Closes a UDPSocket connection. This API uses a promise to return the result. **Return value** | Type | Description | -| -------------- | ----------------------------------------- | +| :-------------- | :----------------------------------------- | | Promise\ | Promise used to return the result.| **Example** @@ -249,12 +277,12 @@ promise.then(() => { ### getState -getState\(callback: AsyncCallback\): void +getState(callback: AsyncCallback\): void Obtains the status of the UDPSocket connection. This API uses an asynchronous callback to return the result. ->**NOTE**
->This API can be called only after [bind](#bind) is successfully called. +>**NOTE** +>This API can be called only after **bind** is successfully called. **Required permissions**: ohos.permission.INTERNET @@ -266,6 +294,12 @@ Obtains the status of the UDPSocket connection. This API uses an asynchronous ca | -------- | ------------------------------------------------------ | ---- | ---------- | | callback | AsyncCallback<[SocketStateBase](#socketstatebase)> | Yes | Callback used to return the result.| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------- | +| 201 | Permission denied. | + **Example** ```js @@ -289,12 +323,12 @@ udp.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}, err => { ### getState -getState\(\): Promise +getState(): Promise\ Obtains the status of the UDPSocket connection. This API uses a promise to return the result. ->**NOTE**
->This API can be called only after [bind](#bind) is successfully called. +>**NOTE** +>This API can be called only after **bind** is successfully called. **Required permissions**: ohos.permission.INTERNET @@ -303,8 +337,8 @@ Obtains the status of the UDPSocket connection. This API uses a promise to retur **Return value** | Type | Description | -| ----------------------------------------------- | ----------------------------------------- | -| Promise<[SocketStateBase](#socketstatebase)> | Promise used to return the result.| +| :----------------------------------------------- | :----------------------------------------- | +| Promise\<[SocketStateBase](#socketstatebase)\> | Promise used to return the result.| **Example** @@ -328,12 +362,12 @@ udp.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}, err => { ### setExtraOptions -setExtraOptions\(options: UDPExtraOptions, callback: AsyncCallback\): void +setExtraOptions(options: UDPExtraOptions, callback: AsyncCallback\): void -Sets other properties of the UDPSocket connection. This API uses an asynchronous callback to return the result. +Sets other attributes of the UDPSocket connection. This API uses an asynchronous callback to return the result. ->**NOTE**
->This API can be called only after [bind](#bind) is successfully called. +>**NOTE** +>This API can be called only after **bind** is successfully called. **Required permissions**: ohos.permission.INTERNET @@ -346,6 +380,12 @@ Sets other properties of the UDPSocket connection. This API uses an asynchronous | options | [UDPExtraOptions](#udpextraoptions) | Yes | Other properties of the UDPSocket connection. For details, see [UDPExtraOptions](#udpextraoptions).| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | **Example** @@ -376,12 +416,12 @@ udp.bind({address:'192.168.xx.xxx', port:xxxx, family:1}, err=> { ### setExtraOptions -setExtraOptions\(options: UDPExtraOptions\): Promise +setExtraOptions(options: UDPExtraOptions): Promise\ -Sets other properties of the UDPSocket connection. This API uses a promise to return the result. +Sets other attributes of the UDPSocket connection. This API uses a promise to return the result. ->**NOTE**
->This API can be called only after [bind](#bind) is successfully called. +>**NOTE** +>This API can be called only after **bind** is successfully called. **Required permissions**: ohos.permission.INTERNET @@ -396,9 +436,16 @@ Sets other properties of the UDPSocket connection. This API uses a promise to re **Return value** | Type | Description | -| -------------- | --------------------------------------------------- | +| :-------------- | :--------------------------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **Example** ```js @@ -424,9 +471,9 @@ promise.then(() => { ``` -### on\('message'\) +### on('message') -on\(type: 'message', callback: Callback<\{message: ArrayBuffer, remoteInfo: SocketRemoteInfo\}\>\): void +on(type: 'message', callback: Callback\<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}\>): void Enables listening for message receiving events of the UDPSocket connection. This API uses an asynchronous callback to return the result. @@ -437,7 +484,7 @@ Enables listening for message receiving events of the UDPSocket connection. This | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ----------------------------------------- | | type | string | Yes | Type of the event to subscribe to.
**message**: message receiving event| -| callback | Callback<{message: ArrayBuffer, remoteInfo: [SocketRemoteInfo](#socketremoteinfo)}> | Yes | Callback used to return the result. | +| callback | Callback\<{message: ArrayBuffer, remoteInfo: [SocketRemoteInfo](#socketremoteinfo)}\> | Yes | Callback used to return the result. | **Example** @@ -449,13 +496,13 @@ udp.on('message', value => { ``` -### off\('message'\) +### off('message') -off\(type: 'message', callback?: Callback<\{message: ArrayBuffer, remoteInfo: SocketRemoteInfo\}\>\): void +off(type: 'message', callback?: Callback\<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}\>): void Disables listening for message receiving events of the UDPSocket connection. This API uses an asynchronous callback to return the result. ->**NOTE**
+>**NOTE** >You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events. **System capability**: SystemCapability.Communication.NetStack @@ -475,15 +522,15 @@ let callback = value =>{ console.log("on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo); } udp.on('message', callback); -// You can pass the **callback** of the **on** method to cancel listening for a certain type of callback. If you do not pass the **callback**, you will cancel listening for all callbacks. +// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks. udp.off('message', callback); udp.off('message'); ``` -### on\('listening' | 'close'\) +### on('listening' | 'close') -on\(type: 'listening' | 'close', callback: Callback\): void +on(type: 'listening' | 'close', callback: Callback\): void Enables listening for data packet message events or close events of the UDPSocket connection. This API uses an asynchronous callback to return the result. @@ -509,13 +556,13 @@ udp.on('close', () => { ``` -### off\('listening' | 'close'\) +### off('listening' | 'close') -off\(type: 'listening' | 'close', callback?: Callback\): void +off(type: 'listening' | 'close', callback?: Callback\): void Disables listening for data packet message events or close events of the UDPSocket connection. This API uses an asynchronous callback to return the result. ->**NOTE**
+>**NOTE** >You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events. **System capability**: SystemCapability.Communication.NetStack @@ -535,22 +582,22 @@ let callback1 = () =>{ console.log("on listening, success"); } udp.on('listening', callback1); -// You can pass the **callback** of the **on** method to cancel listening for a certain type of callback. If you do not pass the **callback**, you will cancel listening for all callbacks. +// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks. udp.off('listening', callback1); udp.off('listening'); let callback2 = () =>{ console.log("on close, success"); } udp.on('close', callback2); -// You can pass the **callback** of the **on** method to cancel listening for a certain type of callback. If you do not pass the **callback**, you will cancel listening for all callbacks. +// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks. udp.off('close', callback2); udp.off('close'); ``` -### on\('error'\) +### on('error') -on\(type: 'error', callback: ErrorCallback\): void +on(type: 'error', callback: ErrorCallback): void Enables listening for error events of the UDPSocket connection. This API uses an asynchronous callback to return the result. @@ -563,7 +610,6 @@ Enables listening for error events of the UDPSocket connection. This API uses an | type | string | Yes | Type of the event to subscribe to.
**error**: error event| | callback | ErrorCallback | Yes | Callback used to return the result. | - **Example** ```js @@ -574,13 +620,13 @@ udp.on('error', err => { ``` -### off\('error'\) +### off('error') -off\(type: 'error', callback?: ErrorCallback\): void +off(type: 'error', callback?: ErrorCallback): void Disables listening for error events of the UDPSocket connection. This API uses an asynchronous callback to return the result. ->**NOTE**
+>**NOTE** >You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events. **System capability**: SystemCapability.Communication.NetStack @@ -600,7 +646,7 @@ let callback = err =>{ console.log("on error, err:" + JSON.stringify(err)); } udp.on('error', callback); -// You can pass the **callback** of the **on** method to cancel listening for a certain type of callback. If you do not pass the **callback**, you will cancel listening for all callbacks. +// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks. udp.off('error', callback); udp.off('error'); ``` @@ -668,9 +714,15 @@ Defines information about the socket connection. | port | number | Yes | Port number. The value ranges from **0** to **65535**. | | size | number | Yes | Length of the server response message, in bytes. | +## Description of UDP Error Codes + +The UDP error code mapping is in the format of 2301000 + Linux kernel error code. + +For details about error codes, see [Socket Error Codes](../errorcodes/errorcode-net-socket.md). + ## socket.constructTCPSocketInstance -constructTCPSocketInstance\(\): TCPSocket +constructTCPSocketInstance(): TCPSocket Creates a **TCPSocket** object. @@ -679,7 +731,7 @@ Creates a **TCPSocket** object. **Return value** | Type | Description | - | --------------------------------- | ---------------------- | + | :--------------------------------- | :---------------------- | | [TCPSocket](#tcpsocket) | **TCPSocket** object.| **Example** @@ -695,7 +747,7 @@ Defines a TCPSocket connection. Before invoking TCPSocket APIs, you need to call ### bind -bind\(address: NetAddress, callback: AsyncCallback\): void +bind(address: NetAddress, callback: AsyncCallback\): void Binds the IP address and port number. The port number can be specified or randomly allocated by the system. This API uses an asynchronous callback to return the result. @@ -710,6 +762,12 @@ Binds the IP address and port number. The port number can be specified or random | address | [NetAddress](#netaddress) | Yes | Destination address. For details, see [NetAddress](#netaddress).| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | **Example** @@ -727,7 +785,7 @@ tcp.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}, err => { ### bind -bind\(address: NetAddress\): Promise +bind(address: NetAddress): Promise\ Binds the IP address and port number. The port number can be specified or randomly allocated by the system. This API uses a promise to return the result. @@ -744,9 +802,16 @@ Binds the IP address and port number. The port number can be specified or random **Return value** | Type | Description | -| -------------- | ------------------------------------------------------- | +| :-------------- | :------------------------------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **Example** ```js @@ -762,10 +827,13 @@ promise.then(() => { ### connect -connect\(options: TCPConnectOptions, callback: AsyncCallback\): void +connect(options: TCPConnectOptions, callback: AsyncCallback\): void Sets up a connection to the specified IP address and port number. This API uses an asynchronous callback to return the result. +>**NOTE** +>This API can be called only after **bind** is successfully called. + **Required permissions**: ohos.permission.INTERNET **System capability**: SystemCapability.Communication.NetStack @@ -777,6 +845,13 @@ Sets up a connection to the specified IP address and port number. This API uses | options | [TCPConnectOptions](#tcpconnectoptions) | Yes | TCPSocket connection parameters. For details, see [TCPConnectOptions](#tcpconnectoptions).| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **Example** ```js @@ -793,7 +868,7 @@ tcp.connect({ address: {address: '192.168.xx.xxx', port: xxxx, family: 1} , time ### connect -connect\(options: TCPConnectOptions\): Promise +connect(options: TCPConnectOptions): Promise\ Sets up a connection to the specified IP address and port number. This API uses a promise to return the result. @@ -810,9 +885,16 @@ Sets up a connection to the specified IP address and port number. This API uses **Return value** | Type | Description | -| -------------- | --------------------------------------------------------- | +| :-------------- | :--------------------------------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **Example** ```js @@ -828,12 +910,12 @@ promise.then(() => { ### send -send\(options: TCPSendOptions, callback: AsyncCallback\): void +send(options: TCPSendOptions, callback: AsyncCallback\): void Sends data over a TCPSocket connection. This API uses an asynchronous callback to return the result. ->**NOTE**
->This API can be called only after [connect](#connect) is successfully called. +>**NOTE** +>This API can be called only after **connect** is successfully called. **Required permissions**: ohos.permission.INTERNET @@ -846,6 +928,13 @@ Sends data over a TCPSocket connection. This API uses an asynchronous callback t | options | [TCPSendOptions](#tcpsendoptions) | Yes | Parameters for sending data over the TCPSocket connection. For details, see [TCPSendOptions](#tcpsendoptions).| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **Example** ```js @@ -870,12 +959,12 @@ promise.then(() => { ### send -send\(options: TCPSendOptions\): Promise +send(options: TCPSendOptions): Promise\ Sends data over a TCPSocket connection. This API uses a promise to return the result. ->**NOTE**
->This API can be called only after [connect](#connect) is successfully called. +>**NOTE** +>This API can be called only after **connect** is successfully called. **Required permissions**: ohos.permission.INTERNET @@ -890,9 +979,16 @@ Sends data over a TCPSocket connection. This API uses a promise to return the re **Return value** | Type | Description | -| -------------- | ------------------------------------------------- | +| :-------------- | :------------------------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **Example** ```js @@ -916,7 +1012,7 @@ promise1.then(() => { ### close -close\(callback: AsyncCallback\): void +close(callback: AsyncCallback\): void Closes a TCPSocket connection. This API uses an asynchronous callback to return the result. @@ -930,6 +1026,11 @@ Closes a TCPSocket connection. This API uses an asynchronous callback to return | -------- | --------------------- | ---- | ---------- | | callback | AsyncCallback\ | Yes | Callback used to return the result.| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------- | +| 201 | Permission denied. | **Example** @@ -947,7 +1048,7 @@ tcp.close(err => { ### close -close\(\): Promise +close(): Promise\ Closes a TCPSocket connection. This API uses a promise to return the result. @@ -958,9 +1059,15 @@ Closes a TCPSocket connection. This API uses a promise to return the result. **Return value** | Type | Description | -| -------------- | ----------------------------------------- | +| :-------------- | :----------------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------- | +| 201 | Permission denied. | + **Example** ```js @@ -976,12 +1083,12 @@ promise.then(() => { ### getRemoteAddress -getRemoteAddress\(callback: AsyncCallback\): void +getRemoteAddress(callback: AsyncCallback\): void Obtains the remote address of a socket connection. This API uses an asynchronous callback to return the result. ->**NOTE**
->This API can be called only after [connect](#connect) is successfully called. +>**NOTE** +>This API can be called only after **connect** is successfully called. **Required permissions**: ohos.permission.INTERNET @@ -993,6 +1100,12 @@ Obtains the remote address of a socket connection. This API uses an asynchronous | -------- | ------------------------------------------------- | ---- | ---------- | | callback | AsyncCallback<[NetAddress](#netaddress)> | Yes | Callback used to return the result.| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------- | +| 201 | Permission denied. | + **Example** ```js @@ -1015,12 +1128,12 @@ promise.then(() => { ### getRemoteAddress -getRemoteAddress\(\): Promise +getRemoteAddress(): Promise\ Obtains the remote address of a socket connection. This API uses a promise to return the result. ->**NOTE**
->This API can be called only after [connect](#connect) is successfully called. +>**NOTE** +>This API can be called only after **connect** is successfully called. **Required permissions**: ohos.permission.INTERNET @@ -1029,9 +1142,15 @@ Obtains the remote address of a socket connection. This API uses a promise to re **Return value** | Type | Description | -| ------------------------------------------ | ------------------------------------------ | +| :------------------------------------------ | :------------------------------------------ | | Promise<[NetAddress](#netaddress)> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------- | +| 201 | Permission denied. | + **Example** ```js @@ -1053,12 +1172,12 @@ promise1.then(() => { ### getState -getState\(callback: AsyncCallback\): void +getState(callback: AsyncCallback\): void Obtains the status of the TCPSocket connection. This API uses an asynchronous callback to return the result. ->**NOTE**
->This API can be called only after [bind](#bind) or [connect](#connect) is successfully called. +>**NOTE** +>This API can be called only after **bind** or **connect** is successfully called. **Required permissions**: ohos.permission.INTERNET @@ -1070,6 +1189,11 @@ Obtains the status of the TCPSocket connection. This API uses an asynchronous ca | -------- | ------------------------------------------------------ | ---- | ---------- | | callback | AsyncCallback<[SocketStateBase](#socketstatebase)> | Yes | Callback used to return the result.| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------- | +| 201 | Permission denied. | **Example** @@ -1093,12 +1217,12 @@ promise.then(() => { ### getState -getState\(\): Promise +getState(): Promise\ Obtains the status of the TCPSocket connection. This API uses a promise to return the result. ->**NOTE**
->This API can be called only after [bind](#bind) or [connect](#connect) is successfully called. +>**NOTE** +>This API can be called only after **bind** or **connect** is successfully called. **Required permissions**: ohos.permission.INTERNET @@ -1107,9 +1231,14 @@ Obtains the status of the TCPSocket connection. This API uses a promise to retur **Return value** | Type | Description | -| ----------------------------------------------- | ----------------------------------------- | +| :----------------------------------------------- | :----------------------------------------- | | Promise<[SocketStateBase](#socketstatebase)> | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------- | +| 201 | Permission denied. | **Example** @@ -1132,12 +1261,12 @@ promise.then(() => { ### setExtraOptions -setExtraOptions\(options: TCPExtraOptions, callback: AsyncCallback\): void +setExtraOptions(options: TCPExtraOptions, callback: AsyncCallback\): void Sets other properties of the TCPSocket connection. This API uses an asynchronous callback to return the result. ->**NOTE**
->This API can be called only after [bind](#bind) or [connect](#connect) is successfully called. +>**NOTE** +>This API can be called only after **bind** or **connect** is successfully called. **Required permissions**: ohos.permission.INTERNET @@ -1150,6 +1279,13 @@ Sets other properties of the TCPSocket connection. This API uses an asynchronous | options | [TCPExtraOptions](#tcpextraoptions) | Yes | Other properties of the TCPSocket connection. For details, see [TCPExtraOptions](#tcpextraoptions).| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **Example** ```js @@ -1181,12 +1317,12 @@ promise.then(() => { ### setExtraOptions -setExtraOptions\(options: TCPExtraOptions\): Promise +setExtraOptions(options: TCPExtraOptions): Promise\ Sets other properties of the TCPSocket connection. This API uses a promise to return the result. ->**NOTE**
->This API can be called only after [bind](#bind) or [connect](#connect) is successfully called. +>**NOTE** +>This API can be called only after **bind** or **connect** is successfully called. **Required permissions**: ohos.permission.INTERNET @@ -1201,9 +1337,15 @@ Sets other properties of the TCPSocket connection. This API uses a promise to re **Return value** | Type | Description | -| -------------- | --------------------------------------------------- | +| :-------------- | :--------------------------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | **Example** @@ -1233,9 +1375,9 @@ promise.then(() => { ``` -### on\('message'\) +### on('message') -on\(type: 'message', callback: Callback<\{message: ArrayBuffer, remoteInfo: SocketRemoteInfo\}\>\): void +on(type: 'message', callback: Callback<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}\>): void Enables listening for message receiving events of the TCPSocket connection. This API uses an asynchronous callback to return the result. @@ -1258,13 +1400,13 @@ tcp.on('message', value => { ``` -### off\('message'\) +### off('message') -off\(type: 'message', callback?: Callback<\{message: ArrayBuffer, remoteInfo: SocketRemoteInfo\}\>\): void +off(type: 'message', callback?: Callback<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}\>): void Disables listening for message receiving events of the TCPSocket connection. This API uses an asynchronous callback to return the result. ->**NOTE**
+>**NOTE** >You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events. **System capability**: SystemCapability.Communication.NetStack @@ -1284,15 +1426,15 @@ let callback = value =>{ console.log("on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo); } tcp.on('message', callback); -// You can pass the **callback** of the **on** method to cancel listening for a certain type of callback. If you do not pass the **callback**, you will cancel listening for all callbacks. +// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks. tcp.off('message', callback); tcp.off('message'); ``` -### on\('connect' | 'close'\) +### on('connect' | 'close') -on\(type: 'connect' | 'close', callback: Callback\): void +on(type: 'connect' | 'close', callback: Callback\): void Enables listening for connection or close events of the TCPSocket connection. This API uses an asynchronous callback to return the result. @@ -1305,7 +1447,6 @@ Enables listening for connection or close events of the TCPSocket connection. Th | type | string | Yes | Type of the event to subscribe to.

- **connect**: connection event
- **close**: close event| | callback | Callback\ | Yes | Callback used to return the result. | - **Example** ```js @@ -1319,13 +1460,13 @@ tcp.on('close', data => { ``` -### off\('connect' | 'close'\) +### off('connect' | 'close') -off\(type: 'connect' | 'close', callback?: Callback\): void +off(type: 'connect' | 'close', callback?: Callback\): void Disables listening for connection or close events of the TCPSocket connection. This API uses an asynchronous callback to return the result. ->**NOTE**
+>**NOTE** >You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events. **System capability**: SystemCapability.Communication.NetStack @@ -1345,22 +1486,22 @@ let callback1 = () =>{ console.log("on connect success"); } tcp.on('connect', callback1); -// You can pass the **callback** of the **on** method to cancel listening for a certain type of callback. If you do not pass the **callback**, you will cancel listening for all callbacks. +// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks. tcp.off('connect', callback1); tcp.off('connect'); let callback2 = () =>{ console.log("on close success"); } tcp.on('close', callback2); -// You can pass the **callback** of the **on** method to cancel listening for a certain type of callback. If you do not pass the **callback**, you will cancel listening for all callbacks. +// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks. tcp.off('close', callback2); tcp.off('close'); ``` -### on\('error'\) +### on('error') -on\(type: 'error', callback: ErrorCallback\): void +on(type: 'error', callback: ErrorCallback): void Enables listening for error events of the TCPSocket connection. This API uses an asynchronous callback to return the result. @@ -1383,13 +1524,13 @@ tcp.on('error', err => { ``` -### off\('error'\) +### off('error') -off\(type: 'error', callback?: ErrorCallback\): void +off(type: 'error', callback?: ErrorCallback): void Disables listening for error events of the TCPSocket connection. This API uses an asynchronous callback to return the result. ->**NOTE**
+>**NOTE** >You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events. **System capability**: SystemCapability.Communication.NetStack @@ -1409,7 +1550,7 @@ let callback = err =>{ console.log("on error, err:" + JSON.stringify(err)); } tcp.on('error', callback); -// You can pass the **callback** of the **on** method to cancel listening for a certain type of callback. If you do not pass the **callback**, you will cancel listening for all callbacks. +// You can pass the callback of the on method to cancel listening for a certain type of callback. If you do not pass the callback, you will cancel listening for all callbacks. tcp.off('error', callback); tcp.off('error'); ``` @@ -1452,7 +1593,13 @@ Defines other properties of the TCPSocket connection. | receiveBufferSize | number | No | Size of the receive buffer, in bytes. | | sendBufferSize | number | No | Size of the send buffer, in bytes. | | reuseAddress | boolean | No | Whether to reuse addresses. The default value is **false**. | -| socketTimeout | number | No | Timeout duration of the TCPSocket connection, in ms. | +| socketTimeout | number | No | Timeout duration of the UDPSocket connection, in ms. | + +## Description of TCP Error Codes + +The TCP error code mapping is in the format of 2301000 + Linux kernel error code. + +For details about error codes, see [Socket Error Codes](../errorcodes/errorcode-net-socket.md). ## socket.constructTLSSocketInstance9+ @@ -1465,7 +1612,7 @@ Creates a **TLSSocket** object. **Return value** | Type | Description | -| --------------------------------- | ---------------------- | +| :--------------------------------- | :---------------------- | | [TLSSocket](#tlssocket9) | **TLSSocket** object.| **Example** @@ -1480,7 +1627,7 @@ Defines a TLSSocket connection. Before invoking TLSSocket APIs, you need to call ### bind9+ -bind\(address: NetAddress, callback: AsyncCallback\): void +bind(address: NetAddress, callback: AsyncCallback\): void Binds the IP address and port number. This API uses an asynchronous callback to return the result. @@ -1518,7 +1665,7 @@ tls.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}, err => { ### bind9+ -bind\(address: NetAddress\): Promise +bind(address: NetAddress): Promise\ Binds the IP address and port number. This API uses a promise to return the result. @@ -1535,7 +1682,7 @@ Binds the IP address and port number. This API uses a promise to return the resu **Return value** | Type | Description | -| -------------- | ------------------------------------------------------- | +| :-------------- | :------------------------------------------------------- | | Promise\ | Promise used to return the result. If the operation fails, an error message is returned.| **Error codes** @@ -1560,7 +1707,7 @@ promise.then(() => { ### getState9+ -getState\(callback: AsyncCallback\): void +getState(callback: AsyncCallback\): void Obtains the status of the TLSSocket connection. This API uses an asynchronous callback to return the result. @@ -1600,7 +1747,7 @@ tls.getState((err, data) => { ### getState9+ -getState\(\): Promise +getState(): Promise\ Obtains the status of the TLSSocket connection. This API uses a promise to return the result. @@ -1609,7 +1756,7 @@ Obtains the status of the TLSSocket connection. This API uses a promise to retur **Return value** | Type | Description | -| ----------------------------------------------- | ----------------------------------------- | +| :----------------------------------------------- | :----------------------------------------- | | Promise\<[SocketStateBase](#socketstatebase)> | Promise used to return the result. If the operation fails, an error message is returned.| **Error codes** @@ -1639,7 +1786,7 @@ promise.then(() => { ### setExtraOptions9+ -setExtraOptions\(options: TCPExtraOptions, callback: AsyncCallback\): void +setExtraOptions(options: TCPExtraOptions, callback: AsyncCallback\): void Sets other properties of the TCPSocket connection after successful binding of the local IP address and port number of the TLSSocket connection. This API uses an asynchronous callback to return the result. @@ -1691,7 +1838,7 @@ tls.setExtraOptions({ ### setExtraOptions9+ -setExtraOptions\(options: TCPExtraOptions\): Promise +setExtraOptions(options: TCPExtraOptions): Promise\ Sets other properties of the TCPSocket connection after successful binding of the local IP address and port number of the TLSSocket connection. This API uses a promise to return the result. @@ -1706,7 +1853,7 @@ Sets other properties of the TCPSocket connection after successful binding of th **Return value** | Type | Description | -| -------------- | --------------------------------------------------- | +| :-------------- | :--------------------------------------------------- | | Promise\ | Promise used to return the result. If the operation fails, an error message is returned.| **Error codes** @@ -1746,7 +1893,7 @@ promise.then(() => { ### connect9+ -connect(options: TLSConnectOptions, callback: AsyncCallback\): void +connect(options: TLSConnectOptions, callback: AsyncCallback\): void Sets up a TLSSocket connection, and creates and initializes a TLS session after successful binding of the local IP address and port number of the TLSSocket connection. During this process, a TLS/SSL handshake is performed between the application and the server to implement data transmission. This API uses an asynchronous callback to return the result. @@ -1767,7 +1914,6 @@ Sets up a TLSSocket connection, and creates and initializes a TLS session after | 2303104 | Interrupted system call. | | 2303109 | Bad file number. | | 2303111 | Resource temporarily unavailable try again. | -| 2303113 | System permission denied. | | 2303188 | Socket operation on non-socket. | | 2303191 | Protocol wrong type for socket. | | 2303198 | Address already in use. | @@ -1784,7 +1930,7 @@ Sets up a TLSSocket connection, and creates and initializes a TLS session after ```js let tlsTwoWay = socket.constructTLSSocketInstance(); // Two way authentication -tlsTwoWay.bind({address: '192.168.xxx.xxx', port: xxxx, family: 1}, err => { +tlsTwoWay.bind({address: '192.168.xxx.xxx', port: 8080, family: 1}, err => { if (err) { console.log('bind fail'); return; @@ -1795,14 +1941,14 @@ let options = { ALPNProtocols: ["spdy/1", "http/1.1"], address: { address: "192.168.xx.xxx", - port: xxxx, + port: 8080, family: 1, }, secureOptions: { key: "xxxx", cert: "xxxx", ca: ["xxxx"], - passwd: "xxxx", + password: "xxxx", protocols: [socket.Protocol.TLSv12], useRemoteCipherPrefer: true, signatureAlgorithms: "rsa_pss_rsae_sha256:ECDSA+SHA256", @@ -1810,12 +1956,12 @@ let options = { }, }; tlsTwoWay.connect(options, (err, data) => { - console.error(err); - console.log(data); + console.error("connect callback error"+err); + console.log(JSON.stringify(data)); }); let tlsOneWay = socket.constructTLSSocketInstance(); // One way authentication -tlsOneWay.bind({address: '192.168.xxx.xxx', port: xxxx, family: 1}, err => { + tlsOneWay.bind({address: '192.168.xxx.xxx', port: 8080, family: 1}, err => { if (err) { console.log('bind fail'); return; @@ -1825,7 +1971,7 @@ tlsOneWay.bind({address: '192.168.xxx.xxx', port: xxxx, family: 1}, err => { let oneWayOptions = { address: { address: "192.168.xxx.xxx", - port: xxxx, + port: 8080, family: 1, }, secureOptions: { @@ -1834,14 +1980,14 @@ let oneWayOptions = { }, }; tlsOneWay.connect(oneWayOptions, (err, data) => { - console.error(err); - console.log(data); + console.error("connect callback error"+err); + console.log(JSON.stringify(data)); }); ``` ### connect9+ -connect(options: TLSConnectOptions): Promise\ +connect(options: TLSConnectOptions): Promise\ Sets up a TLSSocket connection, and creates and initializes a TLS session after successful binding of the local IP address and port number of the TLSSocket connection. During this process, a TLS/SSL handshake is performed between the application and the server to implement data transmission. Both two-way and one-way authentication modes are supported. This API uses a promise to return the result. @@ -1857,7 +2003,7 @@ Sets up a TLSSocket connection, and creates and initializes a TLS session after | Type | Description | | ------------------------------------------- | ----------------------------- | -| Promise\ | Promise used to return the result. If the operation is successful, no value is returned. If the operation fails, an error message is returned.| +| Promise\ | Promise used to return the result. If the operation is successful, no value is returned. If the operation fails, an error message is returned.| **Error codes** @@ -1867,7 +2013,6 @@ Sets up a TLSSocket connection, and creates and initializes a TLS session after | 2303104 | Interrupted system call. | | 2303109 | Bad file number. | | 2303111 | Resource temporarily unavailable try again. | -| 2303113 | System permission denied. | | 2303188 | Socket operation on non-socket. | | 2303191 | Protocol wrong type for socket. | | 2303198 | Address already in use. | @@ -1884,7 +2029,7 @@ Sets up a TLSSocket connection, and creates and initializes a TLS session after ```js let tlsTwoWay = socket.constructTLSSocketInstance(); // Two way authentication -tlsTwoWay.bind({address: '192.168.xxx.xxx', port: xxxx, family: 1}, err => { +tlsTwoWay.bind({address: '192.168.xxx.xxx', port: 8080, family: 1}, err => { if (err) { console.log('bind fail'); return; @@ -1895,14 +2040,14 @@ let options = { ALPNProtocols: ["spdy/1", "http/1.1"], address: { address: "xxxx", - port: xxxx, + port: 8080, family: 1, }, secureOptions: { key: "xxxx", cert: "xxxx", ca: ["xxxx"], - passwd: "xxxx", + password: "xxxx", protocols: [socket.Protocol.TLSv12], useRemoteCipherPrefer: true, signatureAlgorithms: "rsa_pss_rsae_sha256:ECDSA+SHA256", @@ -1910,13 +2055,13 @@ let options = { }, }; tlsTwoWay.connect(options).then(data => { - console.log(data); + console.log(JSON.stringify(data)); }).catch(err => { console.error(err); }); let tlsOneWay = socket.constructTLSSocketInstance(); // One way authentication -tlsOneWay.bind({address: '192.168.xxx.xxx', port: xxxx, family: 1}, err => { +tlsOneWay.bind({address: '192.168.xxx.xxx', port: 8080, family: 1}, err => { if (err) { console.log('bind fail'); return; @@ -1926,7 +2071,7 @@ tlsOneWay.bind({address: '192.168.xxx.xxx', port: xxxx, family: 1}, err => { let oneWayOptions = { address: { address: "192.168.xxx.xxx", - port: xxxx, + port: 8080, family: 1, }, secureOptions: { @@ -1935,7 +2080,7 @@ let oneWayOptions = { }, }; tlsOneWay.connect(oneWayOptions).then(data => { - console.log(data); + console.log(JSON.stringify(data)); }).catch(err => { console.error(err); }); @@ -1943,7 +2088,7 @@ tlsOneWay.connect(oneWayOptions).then(data => { ### getRemoteAddress9+ -getRemoteAddress\(callback: AsyncCallback\): void +getRemoteAddress(callback: AsyncCallback\): void Obtains the remote address of a TLSSocket connection. This API uses an asynchronous callback to return the result. @@ -1953,7 +2098,7 @@ Obtains the remote address of a TLSSocket connection. This API uses an asynchron | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------- | ---- | ---------- | -| callback | AsyncCallback\<[NetAddress](#netaddress)> | Yes | Callback used to return the result. If the operation is successful, the remote address is returned. If the operation fails, an error message is returned.| +| callback | AsyncCallback\<[NetAddress](#netaddress)\> | Yes | Callback used to return the result. If the operation is successful, the remote address is returned. If the operation fails, an error message is returned.| **Error codes** @@ -1976,7 +2121,7 @@ tls.getRemoteAddress((err, data) => { ### getRemoteAddress9+ -getRemoteAddress\(\): Promise\ +getRemoteAddress(): Promise\ Obtains the remote address of a TLSSocket connection. This API uses a promise to return the result. @@ -1985,7 +2130,7 @@ Obtains the remote address of a TLSSocket connection. This API uses a promise to **Return value** | Type | Description | -| ------------------------------------------ | ------------------------------------------ | +| :------------------------------------------ | :------------------------------------------ | | Promise\<[NetAddress](#netaddress)> | Promise used to return the result. If the operation fails, an error message is returned.| **Error codes** @@ -2008,7 +2153,7 @@ promise.then(() => { ### getCertificate9+ -getCertificate(callback: AsyncCallback\<[X509CertRawData](#x509certrawdata9)>): void +getCertificate(callback: AsyncCallback\<[X509CertRawData](#x509certrawdata9)\>): void Obtains the local digital certificate after a TLSSocket connection is established. This API is applicable to two-way authentication. It uses an asynchronous callback to return the result. @@ -2018,7 +2163,7 @@ Obtains the local digital certificate after a TLSSocket connection is establishe | Name | Type | Mandatory| Description| | -------- | ----------------------------------------| ---- | ---------------| -| callback | AsyncCallback\<[X509CertRawData](#x509certrawdata9)> | Yes | Callback used to return the result. If the operation is successful, the local certificate is returned. If the operation fails, an error message is returned.| +| callback | AsyncCallback\<[X509CertRawData](#x509certrawdata9)\> | Yes | Callback used to return the result. If the operation is successful, the local certificate is returned. If the operation fails, an error message is returned.| **Error codes** @@ -2042,7 +2187,7 @@ tls.getCertificate((err, data) => { ### getCertificate9+ -getCertificate():Promise\<[X509CertRawData](#x509certrawdata9)> +getCertificate():Promise\<[X509CertRawData](#x509certrawdata9)\> Obtains the local digital certificate after a TLSSocket connection is established. This API is applicable to two-way authentication. It uses a promise to return the result. @@ -2050,9 +2195,9 @@ Obtains the local digital certificate after a TLSSocket connection is establishe **Return value** -| Type | Description | +| Type | Description | | -------------- | -------------------- | -| Promise\<[X509CertRawData](#x509certrawdata9)> | Promise used to return the result. If the operation fails, an error message is returned.| +| Promise\<[X509CertRawData](#x509certrawdata9)\> | Promise used to return the result. If the operation fails, an error message is returned.| **Error codes** @@ -2074,7 +2219,7 @@ tls.getCertificate().then(data => { ### getRemoteCertificate9+ -getRemoteCertificate(callback: AsyncCallback\<[X509CertRawData](#x509certrawdata9)>): void +getRemoteCertificate(callback: AsyncCallback\<[X509CertRawData](#x509certrawdata9)\>): void Obtains the digital certificate of the server after a TLSSocket connection is established. This API uses an asynchronous callback to return the result. @@ -2084,7 +2229,7 @@ Obtains the digital certificate of the server after a TLSSocket connection is es | Name | Type | Mandatory | Description | | -------- | ----------------------------------------| ---- | ---------------| -| callback | AsyncCallback\<[X509CertRawData](#x509certrawdata9)> | Yes | Callback used to return the result. If the operation fails, an error message is returned.| +| callback | AsyncCallback\<[X509CertRawData](#x509certrawdata9)\> | Yes | Callback used to return the result. If the operation fails, an error message is returned.| **Error codes** @@ -2107,7 +2252,7 @@ tls.getRemoteCertificate((err, data) => { ### getRemoteCertificate9+ -getRemoteCertificate():Promise\<[X509CertRawData](#x509certrawdata9)> +getRemoteCertificate():Promise\<[X509CertRawData](#x509certrawdata9)\> Obtains the digital certificate of the server after a TLSSocket connection is established. This API uses a promise to return the result. @@ -2117,7 +2262,7 @@ Obtains the digital certificate of the server after a TLSSocket connection is es | Type | Description | | -------------- | -------------------- | -| Promise\<[X509CertRawData](#x509certrawdata9)> | Promise used to return the result. If the operation fails, an error message is returned.| +| Promise\<[X509CertRawData](#x509certrawdata9)\> | Promise used to return the result. If the operation fails, an error message is returned.| **Error codes** @@ -2138,7 +2283,7 @@ tls.getRemoteCertificate().then(data => { ### getProtocol9+ -getProtocol(callback: AsyncCallback\): void +getProtocol(callback: AsyncCallback\): void Obtains the communication protocol version after a TLSSocket connection is established. This API uses an asynchronous callback to return the result. @@ -2148,7 +2293,7 @@ Obtains the communication protocol version after a TLSSocket connection is estab | Name | Type | Mandatory| Description | | -------- | ----------------------------------------| ---- | ---------------| -| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation fails, an error message is returned.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation fails, an error message is returned.| **Error codes** @@ -2172,7 +2317,7 @@ tls.getProtocol((err, data) => { ### getProtocol9+ -getProtocol():Promise\ +getProtocol():Promise\ Obtains the communication protocol version after a TLSSocket connection is established. This API uses a promise to return the result. @@ -2182,7 +2327,7 @@ Obtains the communication protocol version after a TLSSocket connection is estab | Type | Description | | -------------- | -------------------- | -| Promise\ | Promise used to return the result. If the operation fails, an error message is returned.| +| Promise\ | Promise used to return the result. If the operation fails, an error message is returned.| **Error codes** @@ -2204,7 +2349,7 @@ tls.getProtocol().then(data => { ### getCipherSuite9+ -getCipherSuite(callback: AsyncCallback\>): void +getCipherSuite(callback: AsyncCallback\\>): void Obtains the cipher suite negotiated by both communication parties after a TLSSocket connection is established. This API uses an asynchronous callback to return the result. @@ -2214,7 +2359,7 @@ Obtains the cipher suite negotiated by both communication parties after a TLSSoc | Name | Type | Mandatory| Description| | -------- | ----------------------------------------| ---- | ---------------| -| callback | AsyncCallback\> | Yes | Callback used to return the result. If the operation fails, an error message is returned.| +| callback | AsyncCallback\\> | Yes | Callback used to return the result. If the operation fails, an error message is returned.| **Error codes** @@ -2239,7 +2384,7 @@ tls.getCipherSuite((err, data) => { ### getCipherSuite9+ -getCipherSuite(): Promise\> +getCipherSuite(): Promise\\> Obtains the cipher suite negotiated by both communication parties after a TLSSocket connection is established. This API uses a promise to return the result. @@ -2249,7 +2394,7 @@ Obtains the cipher suite negotiated by both communication parties after a TLSSoc | Type | Description | | ---------------------- | --------------------- | -| Promise\> | Promise used to return the result. If the operation fails, an error message is returned.| +| Promise\\> | Promise used to return the result. If the operation fails, an error message is returned.| **Error codes** @@ -2264,7 +2409,7 @@ Obtains the cipher suite negotiated by both communication parties after a TLSSoc ```js tls.getCipherSuite().then(data => { - console.log(data); + console.log('getCipherSuite success:' + JSON.stringify(data)); }).catch(err => { console.error(err); }); @@ -2272,7 +2417,7 @@ tls.getCipherSuite().then(data => { ### getSignatureAlgorithms9+ -getSignatureAlgorithms(callback: AsyncCallback\>): void +getSignatureAlgorithms(callback: AsyncCallback\\>): void Obtains the signing algorithm negotiated by both communication parties after a TLSSocket connection is established. This API is applicable to two-way authentication. It uses an asynchronous callback to return the result. @@ -2282,7 +2427,7 @@ Obtains the signing algorithm negotiated by both communication parties after a T | Name | Type | Mandatory| Description | | -------- | -------------------------------------| ---- | ---------------| -| callback | AsyncCallback\> | Yes | Callback used to return the result. | +| callback | AsyncCallback\\> | Yes | Callback used to return the result. | **Error codes** @@ -2305,7 +2450,7 @@ tls.getSignatureAlgorithms((err, data) => { ### getSignatureAlgorithms9+ -getSignatureAlgorithms(): Promise\> +getSignatureAlgorithms(): Promise\\> Obtains the signing algorithm negotiated by both communication parties after a TLSSocket connection is established. This API is applicable to two-way authentication. It uses a promise to return the result. @@ -2315,7 +2460,7 @@ Obtains the signing algorithm negotiated by both communication parties after a T | Type | Description | | ---------------------- | -------------------- | -| Promise\> | Promise used to return the result.| +| Promise\\> | Promise used to return the result.| **Error codes** @@ -2328,7 +2473,7 @@ Obtains the signing algorithm negotiated by both communication parties after a T ```js tls.getSignatureAlgorithms().then(data => { - console.log(data); + console.log("getSignatureAlgorithms success" + data); }).catch(err => { console.error(err); }); @@ -2336,7 +2481,7 @@ tls.getSignatureAlgorithms().then(data => { ### send9+ -send(data: string, callback: AsyncCallback\): void +send(data: string, callback: AsyncCallback\): void Sends a message to the server after a TLSSocket connection is established. This API uses an asynchronous callback to return the result. @@ -2347,7 +2492,7 @@ Sends a message to the server after a TLSSocket connection is established. This | Name | Type | Mandatory| Description | | -------- | -----------------------------| ---- | ---------------| | data | string | Yes | Data content of the message to send. | -| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation fails, an error message is returned.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation fails, an error message is returned.| **Error codes** @@ -2374,7 +2519,7 @@ tls.send("xxxx", (err) => { ### send9+ -send(data: string): Promise\ +send(data: string): Promise\ Sends a message to the server after a TLSSocket connection is established. This API uses a promise to return the result. @@ -2401,7 +2546,7 @@ Sends a message to the server after a TLSSocket connection is established. This | Type | Description | | -------------- | -------------------- | -| Promise\ | Promise used to return the result. If the operation fails, an error message is returned.| +| Promise\ | Promise used to return the result. If the operation fails, an error message is returned.| **Example** @@ -2415,7 +2560,7 @@ tls.send("xxxx").then(() =>{ ### close9+ -close(callback: AsyncCallback\): void +close(callback: AsyncCallback\): void Closes a TLSSocket connection. This API uses an asynchronous callback to return the result. @@ -2425,7 +2570,7 @@ Closes a TLSSocket connection. This API uses an asynchronous callback to return | Name | Type | Mandatory| Description | | -------- | -----------------------------| ---- | ---------------| -| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation fails, an error message is returned.| +| callback | AsyncCallback\ | Yes | Callback used to return the result. If the operation fails, an error message is returned.| **Error codes** @@ -2450,7 +2595,7 @@ tls.close((err) => { ### close9+ -close(): Promise\ +close(): Promise\ Closes a TLSSocket connection. This API uses a promise to return the result. @@ -2460,7 +2605,7 @@ Closes a TLSSocket connection. This API uses a promise to return the result. | Type | Description | | -------------- | -------------------- | -| Promise\ | Promise used to return the result. If the operation fails, an error message is returned.| +| Promise\ | Promise used to return the result. If the operation fails, an error message is returned.| **Error codes** @@ -2491,7 +2636,7 @@ Defines TLS connection options. | -------------- | ------------------------------------- | --- |-------------- | | address | [NetAddress](#netaddress) | Yes | Gateway address. | | secureOptions | [TLSSecureOptions](#tlssecureoptions9) | Yes| TLS security options.| -| ALPNProtocols | Array\ | Yes| Application Layer Protocol Negotiation (ALPN) protocols. | +| ALPNProtocols | Array\ | No| Application Layer Protocol Negotiation (ALPN) protocols. | ## TLSSecureOptions9+ @@ -2501,11 +2646,11 @@ Defines TLS security options. The CA certificate is mandatory, and other paramet | Name | Type | Mandatory| Description | | --------------------- | ------------------------------------------------------ | --- |----------------------------------- | -| ca | string \| Array\ | Yes| CA certificate of the server, which is used to authenticate the digital certificate of the server.| +| ca | string \| Array\ | Yes| CA certificate of the server, which is used to authenticate the digital certificate of the server.| | cert | string | No| Digital certificate of the local client. | | key | string | No| Private key of the local digital certificate. | -| passwd | string | No| Password for reading the private key. | -| protocols | [Protocol](#protocol9) \|Array\<[Protocol](#protocol9)> | No| TLS protocol version. | +| password | string | No| Password for reading the private key. | +| protocols | [Protocol](#protocol9) \|Array\<[Protocol](#protocol9)\> | No| TLS protocol version. | | useRemoteCipherPrefer | boolean | No| Whether to use the remote cipher suite preferentially. | | signatureAlgorithms | string | No| Signing algorithm used during communication. | | cipherSuite | string | No| Cipher suite used during communication. | @@ -2529,4 +2674,4 @@ Defines the certificate raw data. | Type | Description | | --------------------------------------------------------------------- | --------------------- | -|[cryptoFramework.EncodingBlob](js-apis-cryptoFramework.md#datablob) | Data and encoding format of the certificate.| +|[cert.EncodingBlob](js-apis-cert.md#datablob) | Data and encoding format of the certificate.| diff --git a/en/application-dev/reference/apis/js-apis-system-app.md b/en/application-dev/reference/apis/js-apis-system-app.md index 2896c163a408b3ca5625aee1ccc13379ba89e95d..e0acf1c2ba47df2555dd9812d655e1fb15f777e7 100644 --- a/en/application-dev/reference/apis/js-apis-system-app.md +++ b/en/application-dev/reference/apis/js-apis-system-app.md @@ -199,7 +199,7 @@ Defines the application response information. ## ScreenOnVisible(deprecated) -screenOnVisible(options?: ScreenOnVisibleOptions) +screenOnVisible(options?: ScreenOnVisibleOptions): void Defines whether to keep the application visible when the screen is woken up. diff --git a/en/application-dev/reference/apis/js-apis-system-battery.md b/en/application-dev/reference/apis/js-apis-system-battery.md index d673a500027654075ff330c916cd22add25abaf6..efeb9caec59a04362b80c6f3502dc5a34b8e7f34 100644 --- a/en/application-dev/reference/apis/js-apis-system-battery.md +++ b/en/application-dev/reference/apis/js-apis-system-battery.md @@ -46,6 +46,8 @@ battery.getStatus({ Object that contains the API calling result. +**System capability**: SystemCapability.PowerManager.BatteryManager.Core + | Name | Type | Mandatory| Description | | -------- | --------------------------------------------------- | ---- | ------------------------------------------------------------ | | success | (data: [BatteryResponse](#batteryresponse)) => void | No | Called when API call is successful. **data** is a return value of the [BatteryResponse](#batteryresponse) type.| @@ -56,7 +58,9 @@ Object that contains the API calling result. Defines a response that returns the charging status and remaining power of the device. -| Name| Type| Description| -| -------- | -------- | -------- | -| charging | boolean | Whether the battery is being charged.| -| level | number | Current battery level, which ranges from **0.00** to **1.00**.| +**System capability**: SystemCapability.PowerManager.BatteryManager.Core + +| Name| Type| Readable| Writable| Description| +| -------- | -------- | -------- | -------- | -------- | +| charging | boolean | Yes| No| Whether the battery is being charged.| +| level | number | Yes| No| Current battery level, which ranges from **0.00** to **1.00**.| diff --git a/en/application-dev/reference/apis/js-apis-system-bluetooth.md b/en/application-dev/reference/apis/js-apis-system-bluetooth.md index c65aef6079cb393917d7f8a44ef9d62de5e49478..497e0817fcfcd1ca12c43948a8907b96871a1287 100644 --- a/en/application-dev/reference/apis/js-apis-system-bluetooth.md +++ b/en/application-dev/reference/apis/js-apis-system-bluetooth.md @@ -1,7 +1,7 @@ # @system.bluetooth (Bluetooth) -> **NOTE**
+> **NOTE** > > - The APIs of this module are no longer maintained since API version 7. You are advised to use [`@ohos.bluetooth`](js-apis-bluetooth.md). > @@ -19,8 +19,6 @@ import bluetooth from '@system.bluetooth'; Scans for Bluetooth Low Energy (BLE) devices nearby. This operation consumes system resources. Call [bluetooth.stopBLEScan](#bluetoothstopblescanobject) to stop the scan after a BLE device is detected and connected. -**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION - **System capability**: SystemCapability.Communication.Bluetooth.Lite **Parameters** @@ -42,7 +40,7 @@ Scans for Bluetooth Low Energy (BLE) devices nearby. This operation consumes sys console.log('call bluetooth.startBLEScan success.'); }, fail(code, data) { - console.log('call bluetooth.startBLEScan failed, code: ${code}, data: ${data}.'); + console.log('call bluetooth.startBLEScan failed, code:' + code + ', data:' + data); }, complete() { console.log('call bluetooth.startBLEScan complete.'); @@ -55,8 +53,6 @@ Scans for Bluetooth Low Energy (BLE) devices nearby. This operation consumes sys Stops scanning for BLE devices nearby. This API is used with [bluetooth.startBLEScan(OBJECT)](#bluetoothstartblescanobject) in pairs. -**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION - **System capability**: SystemCapability.Communication.Bluetooth.Lite **Parameters** @@ -76,7 +72,7 @@ Stops scanning for BLE devices nearby. This API is used with [bluetooth.startBLE console.log('call bluetooth.stopBLEScan success.'); }, fail(data, code) { - console.log('call bluethooth.stopBLEScan fail, code: ${code}, data: ${data}.'); + console.log('call bluethooth.stopBLEScan fail, code:' + code + ', data:' + data); }, complete() { console.log('call bluethooth.stopBLEScan complete.'); @@ -89,8 +85,6 @@ Stops scanning for BLE devices nearby. This API is used with [bluetooth.startBLE Subscribes to the newly detected BLE device. If this API is called multiple times, the last call takes effect. -**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION - **System capability**: SystemCapability.Communication.Bluetooth.Lite **Parameters** @@ -122,10 +116,10 @@ Subscribes to the newly detected BLE device. If this API is called multiple time ``` bluetooth.subscribeBLEFound({ success(data) { - console.log('Called bluetooth.subscribeBLEFound successsully, data: ${data}.'); + console.log('call bluetooth.subscribeBLEFound success, data: ${data}.'); }, fail(data, code) { - console.log('Failed to call bluetooth.startBLEScan, data: ${data}, code: ${code}.'); + console.log('call bluetooth.startBLEScan failed, code:' + code + ', data:' + data); } }); ``` @@ -135,8 +129,6 @@ Subscribes to the newly detected BLE device. If this API is called multiple time Unsubscribes from the newly detected devices. -**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION - **System capability**: SystemCapability.Communication.Bluetooth.Lite **Example** diff --git a/en/application-dev/reference/apis/js-apis-system-brightness.md b/en/application-dev/reference/apis/js-apis-system-brightness.md index 939e7d7021bc8f93ad7359004de58f525feeee05..8053c8f0c73d190d33e547ff9f0227df5c6db06a 100644 --- a/en/application-dev/reference/apis/js-apis-system-brightness.md +++ b/en/application-dev/reference/apis/js-apis-system-brightness.md @@ -3,7 +3,8 @@ The **brightness** module provides APIs for querying and adjusting the screen brightness and mode. > **NOTE** -> - The APIs of this module are no longer maintained since API version 7. It is recommended that you use [`@ohos.brightness`](js-apis-brightness.md) instead. +> +> - The APIs of this module are no longer maintained since API version 7. You are advised to use APIs of [`@ohos.brightness`](js-apis-brightness.md). The substitute APIs are available only for system applications. > - 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. @@ -45,7 +46,7 @@ Obtains the current screen brightness. ## brightness.setValue -etValue(options?: SetBrightnessOptions): void +setValue(options?: SetBrightnessOptions): void Sets the screen brightness. @@ -74,7 +75,7 @@ Sets the screen brightness. ## brightness.getMode -getMode(options?: GetBrightnessModeOptions: void +getMode(options?: GetBrightnessModeOptions): void Obtains the screen brightness adjustment mode. @@ -161,67 +162,81 @@ Sets whether to always keep the screen on. Call this API in **onShow()**. Defines the options for obtaining the screen brightness. +**System capability**: SystemCapability.PowerManager.DisplayPowerManager + | Name | Type | Mandatory| Description | | -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ | | success | (data: [BrightnessResponse](#brightnessresponse)) => void | No | Called when API call is successful. **data** is a return value of the [BrightnessResponse](#brightnessresponse) type.| | fail | (data: string, code: number) => void | No | Called when API call has failed. **data** indicates the error information, and **code** indicates the error code. | -| complete | () => void | No | Called when API call is complete. | +| complete | () => void | No | Called when the API call is complete. | ## SetBrightnessOptions Defines the options for setting the screen brightness. +**System capability**: SystemCapability.PowerManager.DisplayPowerManager + | Name | Type | Mandatory| Description | | -------- | ------------------------------------ | ---- | ------------------------------------------------------------ | | value | number | Yes | Screen brightness. The value is an integer ranging from **1** to **255**.
- If the value is less than or equal to **0**, value **1** will be used.
- If the value is greater than **255**, value **255** will be used.
- If the value contains decimals, the integral part of the value will be used. For example, if value **8.1** is set, value **8** will be used.| -| success | () => void | No | Called when API call is successful. | +| success | () => void | No | Callback upon a successful API call. | | fail | (data: string, code: number) => void | No | Called when API call has failed. **data** indicates the error information, and **code** indicates the error code. | -| complete | () => void | No | Called when API call is complete. | +| complete | () => void | No | Called when the API call is complete. | ## BrightnessResponse Defines a response that returns the screen brightness. -| Parameter| Type | Description| -| -------- | -------- | -------- | -| value | number | Screen brightness. The value ranges from 1 to 255.| +**System capability**: SystemCapability.PowerManager.DisplayPowerManager + +| Name| Type| Readable| Writable| Description| +| -------- | -------- | -------- | -------- | -------- | +| value | number | Yes| No| Screen brightness. The value ranges from **1** to **255**.| ## GetBrightnessModeOptions Defines the options for obtaining the screen brightness mode. +**System capability**: SystemCapability.PowerManager.DisplayPowerManager + | Name | Type | Mandatory| Description | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | success | (data: [BrightnessModeResponse](#brightnessmoderesponse)) => void | No | Called when API call is successful. **data** is a return value of the [BrightnessModeResponse](#brightnessmoderesponse) type.| | fail | (data: string, code: number) => void | No | Called when API call has failed. **data** indicates the error information, and **code** indicates the error code. | -| complete | () => void | No | Called when API call is complete. | +| complete | () => void | No | Called when the API call is complete. | ## SetBrightnessModeOptions Defines the options for setting the screen brightness mode. +**System capability**: SystemCapability.PowerManager.DisplayPowerManager + | Name | Type | Mandatory| Description | | -------- | ------------------------------------ | ---- | ------------------------------------------------------ | | mode | number | Yes | The value **0** indicates the manual adjustment mode, and the value **1** indicates the automatic adjustment mode.| -| success | () => void | No | Called when API call is successful. | +| success | () => void | No | Callback upon a successful API call. | | fail | (data: string, code: number) => void | No | Called when API call has failed. **data** indicates the error information, and **code** indicates the error code.| -| complete | () => void | No | Called when API call is complete. | +| complete | () => void | No | Called when the API call is complete. | ## BrightnessModeResponse Defines a response that returns the screen brightness mode. -| Name| Type | Description| -| -------- | -------- | -------- | -| mode | number | The value **0** indicates the manual adjustment mode, and the value **1** indicates the automatic adjustment mode.| +**System capability**: SystemCapability.PowerManager.DisplayPowerManager + +| Name| Type| Readable| Writable| Description| +| -------- | -------- | -------- | -------- | -------- | +| mode | number | Yes| No| The value **0** indicates the manual adjustment mode, and the value **1** indicates the automatic adjustment mode.| ## SetKeepScreenOnOptions Defines the options for setting the screen to be steady on. +**System capability**: SystemCapability.PowerManager.DisplayPowerManager + | Name | Type | Mandatory| Description | | ------------ | ------------------------------------ | ---- | ------------------------------------------------------ | | keepScreenOn | boolean | Yes | The value **true** means to keep the screen steady on, and the value **false** indicates the opposite. | -| success | () => void | No | Called when API call is successful. | +| success | () => void | No | Callback upon a successful API call. | | fail | (data: string, code: number) => void | No | Called when API call has failed. **data** indicates the error information, and **code** indicates the error code.| -| complete | () => void | No | Called when API call is complete. | +| complete | () => void | No | Called when the API call is complete. | diff --git a/en/application-dev/reference/apis/js-apis-system-capability.md b/en/application-dev/reference/apis/js-apis-system-capability.md index 7949bae9880af5a8e428e62440595a4a6e990da7..e32c909193a5090737c37c70864c32573ec127b5 100644 --- a/en/application-dev/reference/apis/js-apis-system-capability.md +++ b/en/application-dev/reference/apis/js-apis-system-capability.md @@ -16,7 +16,7 @@ import systemcapability from '@ohos.systemCapability' ## systemcapability.querySystemCapabilities -querySystemCapabilities(callback: AsyncCallback): void; +querySystemCapabilities(callback: AsyncCallback<string>): void; Queries system capabilities. This API uses an asynchronous callback to return the result. @@ -51,7 +51,7 @@ querySystemCapabilities(): Promise<string> Queries system capabilities. This API uses a promise to return the result. -**System capability**: SystemCapability.Startup.SystemInfo +**System capability**: SystemCapability.Developtools.Syscap **Return value** @@ -76,4 +76,5 @@ try { > **NOTE** -> - The system capabilities returned by the preceding APIs are in the form of an encoded numeric string. +> +> The system capabilities returned by the preceding APIs are in the form of an encoded numeric string. diff --git a/en/application-dev/reference/apis/js-apis-system-cipher.md b/en/application-dev/reference/apis/js-apis-system-cipher.md index dddb6a685f00a8a5a1829e489d43af4a198bdffa..30ac917b4c2ff2867cbbe4c54385500316494520 100644 --- a/en/application-dev/reference/apis/js-apis-system-cipher.md +++ b/en/application-dev/reference/apis/js-apis-system-cipher.md @@ -1,9 +1,9 @@ -# @system.cipher (Cipher Algorithm) +# @system.cipher (Cipher Algorithm) > **NOTE** > -> 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. - +> - 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. +>- The APIs provided by this module are deprecated since API version 9. You are advised to use [@ohos.security.cryptoFramework Cipher](js-apis-cryptoFramework.md#cipher). ## Modules to Import @@ -18,9 +18,10 @@ Defines the response to the cipher interface called. **System capability**: SystemCapability.Security.Cipher -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ------------ | -| text | string | Yes | Response content.| +| Name| Type | Readable| Writable|Description | +| ------ | ------ | ---- | ---- | ------------ | +| text | string | Yes | No | Response content.| + ## CipherRsaOptions @@ -74,39 +75,39 @@ Encrypts or decrypts data using RSA. **Example** ```js -export default { - rsa() { - cipher.rsa({ - // Encrypt data. - action: 'encrypt', - // Text to be encrypted. - text: 'hello', - // Base64-encoded public key used for encryption. - key: - 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCx414QSP3RsYWYzf9mkBMiBAXo\n' + - '6S7Lpva1fKlcuVxjoFC1iMnzD4mC0uiL4k5MNi43J64c7dbqi3qAJjdAtuwQ6NZJ\n' + +export default { + rsa() { + cipher.rsa({ + // Encrypt data. + action: 'encrypt', + // Text to be encrypted. + text: 'hello', + // Base64-encoded public key used for encryption. + key: + 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCx414QSP3RsYWYzf9mkBMiBAXo\n' + + '6S7Lpva1fKlcuVxjoFC1iMnzD4mC0uiL4k5MNi43J64c7dbqi3qAJjdAtuwQ6NZJ\n' + '+Enz0RzmVFh/4yk6lmqRzuEFQqhQqSZzaLq6sq2N2G0Sv2Xl3sLvqAfe2HNm2oBw\n' + - 'jBpApTJ3TeneOo6Z5QIDAQAB', - success: function(data) { - console.log(`Handling successful:${data.text}`); - }, - fail: function(data, code) { - console.log(`### cipher.rsa encryption failed ### ${code}:${data}`); + 'jBpApTJ3TeneOo6Z5QIDAQAB', + success: function(data) { + console.log(`handling success:${data.text}`); + }, + fail: function(data, code) { + console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`); }, complete: function() { console.log(`operation complete!`); } - }); - cipher.rsa({ - // Decrypt data. - action: 'decrypt', - // Text to be decrypted, which is binary text encoded in Base64. The decrypted text is "hello". - text: + }); + cipher.rsa({ + // Decrypt data. + action: 'decrypt', + // Text to be decrypted, which is binary text encoded in Base64. The decrypted text is "hello". + text: 'EPeCFPib6ayKbA0M6oSywARvFZ8dFYfjQv3nY8ikZGtS9UHq2sLPvAfpeIzggSiCxqbWeCftP1XQ\n' + 'Sa+jEpzFlT1qoSTunBbrYzugPTajIJDTg6R1IRsF/J+mmakn0POVPvi4jCo9wqavB324Bx0Wipnc\n' + - 'EU5WO0oBHo5l4x6dTpU=', - // Base64-encoded private key used for decryption. - key: + 'EU5WO0oBHo5l4x6dTpU=', + // Base64-encoded private key used for decryption. + key: 'MIICXgIBAAKBgQCx414QSP3RsYWYzf9mkBMiBAXo6S7Lpva1fKlcuVxjoFC1iMnz\n' + 'D4mC0uiL4k5MNi43J64c7dbqi3qAJjdAtuwQ6NZJ+Enz0RzmVFh/4yk6lmqRzuEF\n' + 'QqhQqSZzaLq6sq2N2G0Sv2Xl3sLvqAfe2HNm2oBwjBpApTJ3TeneOo6Z5QIDAQAB\n' + @@ -118,18 +119,18 @@ export default { 'PKoljdXmJeS6rGgzGibstuHLrP3tcIho4+0CQD3ZFWzF/xq0jxKlrpWhnJuNCRfE\n' + 'oO6e9yNvVA8J/5oEDSOcmqSNIp4+RhbUx8InUxnCG6Ryv5aSFu71pYcKrPkCQQCL\n' + 'RUGcm3ZGTnslduB0knNF+V2ndwzDUQ7P74UXT+PjurTPhujFYiuxCEd6ORVnEOzG\n' + - 'M9TORIgdH8MjIbWsGnndAkEAw9yURDaorE8IYPLF2IEn09g1uzvWPs3phDb6smVx\n' + + 'M9TORIgdH8MjIbWsGnndAkEAw9yURDaorE8IYPLF2IEn09g1uzvWPs3phDb6smVx\n' + '8GfqIdUNf+aCG5TZK/kXBF1sqcsi7jXMAf4jBlejVbSVZg==', - success: function(data) { - console.log(`Handling successful:${data.text}`); - }, - fail: function(data, code) { - console.log(`### cipher.rsa encryption failed ### ${code}:${data}`); + success: function(data) { + console.log(`handling success:${data.text}`); + }, + fail: function(data, code) { + console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`); }, complete: function() { console.log(`operation complete!`); - } - }); + } + }); } } ``` @@ -152,48 +153,48 @@ Encrypts or decrypts data using AES. **Example** ```js -export default { - aes() { - cipher.aes({ - // Encrypt data. - action: 'encrypt', - // Text to be encrypted. - text: 'hello', +export default { + aes() { + cipher.aes({ + // Encrypt data. + action: 'encrypt', + // Text to be encrypted. + text: 'hello', // Base64-encoded key. - key: 'NDM5Qjk2UjAzMEE0NzVCRjlFMkQwQkVGOFc1NkM1QkQ=', - transformation: 'AES/CBC/PKCS5Padding', - ivOffset: '0', - ivLen: '16', - success: function(data) { - console.log(`Handling successful:${data.text}`); - }, - fail: function(data, code) { - console.log(`### cipher.rsa encryption failed ### ${code}:${data}`); + key: 'NDM5Qjk2UjAzMEE0NzVCRjlFMkQwQkVGOFc1NkM1QkQ=', + transformation: 'AES/CBC/PKCS5Padding', + ivOffset: '0', + ivLen: '16', + success: function(data) { + console.log(`handling success:${data.text}`); + }, + fail: function(data, code) { + console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`); }, complete: function() { console.log(`operation complete!`); } - }); - cipher.aes({ - // Decrypt data. - action: 'decrypt', - // Text to be decrypted, which is binary text encoded in Base64. - text: '1o0kf2HXwLxHkSh5W5NhzA==', + }); + cipher.aes({ + // Decrypt data. + action: 'decrypt', + // Text to be decrypted, which is binary text encoded in Base64. + text: '1o0kf2HXwLxHkSh5W5NhzA==', // Base64-encoded key. - key: 'NDM5Qjk2UjAzMEE0NzVCRjlFMkQwQkVGOFc1NkM1QkQ=', - transformation: 'AES/CBC/PKCS5Padding', - ivOffset: '0', - ivLen: '16', - success: function(data) { - console.log(`Handling successful:${data.text}`); - }, - fail: function(data, code) { - console.log(`### cipher.aes encryption failed ### ${code}:${data}`); + key: 'NDM5Qjk2UjAzMEE0NzVCRjlFMkQwQkVGOFc1NkM1QkQ=', + transformation: 'AES/CBC/PKCS5Padding', + ivOffset: '0', + ivLen: '16', + success: function(data) { + console.log(`handling success:${data.text}`); + }, + fail: function(data, code) { + console.log(`### cipher.aes encrypt fail ### ${code}:${data}`); }, complete: function() { console.log(`operation complete!`); } - }); + }); } } diff --git a/en/application-dev/reference/apis/js-apis-system-configuration.md b/en/application-dev/reference/apis/js-apis-system-configuration.md index 934ceb020412a18c64499de1cb0ef1593ace2e50..ddc277722b452b8dca63eb50972d9d1f4448726d 100644 --- a/en/application-dev/reference/apis/js-apis-system-configuration.md +++ b/en/application-dev/reference/apis/js-apis-system-configuration.md @@ -50,4 +50,3 @@ Defines attributes of the current locale. | language | string | Yes | No | Language, for example, **zh**.| | countryOrRegion | string | Yes | No | Country or region, for example, **CN** or **US**.| | dir | string | Yes | No | Text layout direction. The value can be:
- **ltr**: from left to right
- **rtl**: from right to left| -| unicodeSetting5+ | string | Yes | No | Unicode language key set determined by the locale. If current locale does not have a specific key set, an empty set is returned.
For example, **{"nu":"arab"}** indicates that current locale uses Arabic numerals.| diff --git a/en/application-dev/reference/apis/js-apis-system-device.md b/en/application-dev/reference/apis/js-apis-system-device.md index 18c6c703d5e033c216fb47594fa8116fc581dfc6..ea1eadb9ab116dc938190e3356e1c4c73d5ce821 100644 --- a/en/application-dev/reference/apis/js-apis-system-device.md +++ b/en/application-dev/reference/apis/js-apis-system-device.md @@ -16,7 +16,7 @@ import device from '@system.device'; ## device.getInfo -getInfo(Object): void +getInfo(options?: GetDeviceOptions): void Obtains the device information. @@ -30,11 +30,25 @@ Obtains the device information. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| success | Function | No| Called when API call is successful.| -| fail | Function | No| Called when API call has failed.| -| complete | Function | No| Called when API call is complete.| +| options | [GetDeviceOptions](#getdeviceoptions) | No| Parameters for obtaining the device information.| -**Return value of success()** +## GetDeviceOptions + +Defines the parameters for obtaining the device information. + +**System capability**: SystemCapability.Startup.SystemInfo + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| success | (data: DeviceResponse)=> void| No| Called when API call is successful. **data** indicates the returned device information. For details, see [DeviceResponse](#deviceresponse).| +| fail | (data: any,code:number)=> void| No| Called when API call has failed. **code** indicates the error code returned upon a failure.
**code:200**: Certain information could not be obtained.| +| complete | () => void| No| Called when API call is complete.| + +## DeviceResponse + +Provides the device information. + +**System capability**: SystemCapability.Startup.SystemInfo | Name| Type| Description| | -------- | -------- | -------- | @@ -49,14 +63,9 @@ Obtains the device information. | screenDensity4+ | number | Screen density.| | screenShape4+ | string | Screen shape. The options are as follows:
- **rect**: rectangular screen
- **circle**: round screen| | apiVersion4+ | number | API version.| -| releaseType4+ | string | Release type. The value includes both the release type and the API version, for example, Beta1.
Available release types are as follows:
- **Canary**: For the same API version, different canary releases are compatible with each other, but not compatible with those of the **beta** and **release** type.
- **Beta**: For the same API version, different beta releases are compatible with each other, but not compatible with those of the **release** type.
- **Release**: Releases of this type are compatible with the latest five API versions.| +| releaseType4+ | string | Release type. The value includes both the release type and the API version, for example, Beta1.
Available release types are as follows:
- **Canary**: Releases of this type are compatible with each other under the same API version, but not with those of the **beta** and **release** type.
- **Beta**: Releases of this type are compatible with each other under the same API version, but not with those of the **release** type.
- **Release**: Releases of this type are compatible with the latest five API versions.| | deviceType4+ | string | Device type.| -**Return value of fail()** - -| Error Code| Description| -| -------- | -------- | -| 200 | Certain information cannot be obtained.| **Example** diff --git a/en/application-dev/reference/apis/js-apis-system-fetch.md b/en/application-dev/reference/apis/js-apis-system-fetch.md index 6829c569a3471855c403a6bfad5e80bdd18afecc..6144d903c19116e693841e5f4a55840aac43e68b 100644 --- a/en/application-dev/reference/apis/js-apis-system-fetch.md +++ b/en/application-dev/reference/apis/js-apis-system-fetch.md @@ -1,9 +1,8 @@ # @system.fetch (Data Request) > **NOTE** -> > - The APIs of this module are no longer maintained since API version 6. You are advised to use [`@ohos.net.http`](js-apis-http.md) instead. -> +> > - 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. @@ -15,7 +14,7 @@ import fetch from '@system.fetch'; ``` -## fetch.fetch +## fetch.fetch3+ fetch(Object): void @@ -31,9 +30,9 @@ Obtains data through a network. | header | Object | No| Request header.| | method | string | No| Request method. The default value is **GET**. The value can be **OPTIONS**, **GET**, **HEAD**, **POST**, **PUT**, **DELETE **or **TRACE**.| | responseType | string | No| Response type. The return type can be text or JSON. By default, the return type is determined based on **Content-Type** in the header returned by the server. For details, see return values in the **success** callback.| -| success | Function | No| Called when data is obtained successfully. The return value is [FetchResponse](#fetchresponse). | -| fail | Function | No| Called when data failed to be obtained.| -| complete | Function | No| Called when the execution is complete.| +| success | Function | No| Called when the API call is successful. The return value is defined by [FetchResponse](#fetchresponse).| +| fail | Function | No| Called when API call has failed.| +| complete | Function | No| Called when the API call is complete.| **Table 1** Mapping between data and Content-Type @@ -46,11 +45,11 @@ Obtains data through a network. ## FetchResponse -| Name| Type| Description| -| -------- | -------- | -------- | -| code | number | Server status code.| -| data | string \| Object | The type of the returned data is determined by **responseType**. For details, see the mapping between **responseType** and **data** in **success** callback.| -| headers | Object | All headers in the response from the server.| +| Name| Type| Readable| Writable| Description| +| -------- | -------- | -------- | -------- | -------- | +| code | number | Yes| No| Server status code.| +| data | string \| Object | Yes| No| The type of the returned data is determined by **responseType**. For details, see the mapping between **responseType** and **data** in **success** callback.| +| headers | Object | Yes| No| All headers in the response from the server.| **Table 2** Mapping between responseType and data in success callback @@ -85,7 +84,7 @@ export default { ``` -> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
+> **NOTE** > HTTPS is supported by default. To support HTTP, you need to add **"network"** to the **config.json** file, and set the attribute **"cleartextTraffic"** to **true**. That is: > > ``` diff --git a/en/application-dev/reference/apis/js-apis-system-location.md b/en/application-dev/reference/apis/js-apis-system-location.md index 140e3bd3d317eefd941515144c1439f8f43bf8d6..4e141ca023493913251eb87e4007df06af3db283 100644 --- a/en/application-dev/reference/apis/js-apis-system-location.md +++ b/en/application-dev/reference/apis/js-apis-system-location.md @@ -21,44 +21,22 @@ ohos.permission.LOCATION ## geolocation.getLocation(deprecated) -getLocation(Object): void +getLocation(options?: GetLocationOption): void Obtains the geographic location. > **NOTE** > This API is deprecated since API version 9. You are advised to use [geoLocationManager.getCurrentLocation](js-apis-geoLocationManager.md#geolocationmanagergetcurrentlocation). +**Required permissions**: ohos.permission.LOCATION + **System capability**: SystemCapability.Location.Location.Lite **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| timeout | number | No| Timeout duration, in ms. The default value is **30000**.
The timeout duration is necessary in case the request to obtain the geographic location is rejected for the lack of the required permission, weak positioning signal, or incorrect location settings. After the timeout duration expires, the fail function will be called.
The value is a 32-digit positive integer. If the specified value is less than or equal to **0**, the default value will be used.| -| coordType | string | No| Coordinate system type. Available types can be obtained by **getSupportedCoordTypes**. The default type is **wgs84**.| -| success | Function | No| Called when API call is successful.| -| fail | Function | No| Called when API call has failed.| -| complete | Function | No| Called when API call is complete.| - -**Return value of success()** - -| Name| Type| Description| -| -------- | -------- | -------- | -| longitude | number | Longitude.| -| latitude | number | Latitude.| -| altitude | number | Altitude.| -| accuracy | number | Location accuracy.| -| time | number | Time when the location is obtained.| - -**Return value of fail()** - -| Error Code| Description| -| -------- | -------- | -| 601 | Failed to obtain the required permission because the user rejected the request.| -| 602 | Permission not declared.| -| 800 | Operation times out due to a poor network condition or GNSS unavailability.| -| 801 | System location disabled.| -| 802 | API called again while the previous execution result is not returned yet.| +| options | [GetLocationOption](#getlocationoptiondeprecated) | No| Options of a single location request.| **Example** @@ -71,21 +49,21 @@ export default { }, fail: function(data, code) { console.log('fail to get location. code:' + code + ', data:' + data); - }, + } }); - }, + } } ``` ## geolocation.getLocationType(deprecated) -getLocationType(Object): void +getLocationType(options?: GetLocationTypeOption): void Obtains the supported location types. > **NOTE** -> This API is deprecated since API version 9. The location subsystem supports only two location types: GPS positioning and network positioning. No APIs will be provided to query the supported location types. +> This API is deprecated since API version 9. The location subsystem supports only two location types: GNSS positioning and network positioning. No APIs will be provided to query the supported location types. **System capability**: SystemCapability.Location.Location.Lite @@ -93,15 +71,7 @@ Obtains the supported location types. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| success | Function | No| Called when API call is successful.| -| fail | Function | No| Called when API call has failed.| -| complete | Function | No| Called when API call is complete.| - -**Return value of success()** - -| Name| Type| Description| -| -------- | -------- | -------- | -| types | Array<string> | Available location types, ['gps', 'network']| +| options | [GetLocationTypeOption](#getlocationtypeoptiondeprecated) | No| Callback used to return the result.| **Example** @@ -123,40 +93,22 @@ export default { ## geolocation.subscribe(deprecated) -subscribe(Object): void +subscribe(options: SubscribeLocationOption): void Listens to the geographic location. If this method is called multiple times, the last call takes effect. > **NOTE** > This API is deprecated since API version 9. You are advised to use [geoLocationManager.on('locationChange')](js-apis-geoLocationManager.md#geolocationmanageronlocationchange). +**Required permissions**: ohos.permission.LOCATION + **System capability**: SystemCapability.Location.Location.Lite **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| coordType | string | No| Coordinate system type. Available types can be obtained by **getSupportedCoordTypes**. The default type is **wgs84**.| -| success | Function | Yes| Called when the geographic location changes.| -| fail | Function | No| Called when API call has failed.| - -**Return value of success()** - -| Name| Type| Description| -| -------- | -------- | -------- | -| longitude | number | Longitude.| -| latitude | number | Latitude.| -| altitude | number | Altitude.| -| accuracy | number | Location accuracy.| -| time | number | Time when the location is obtained.| - -**Return value of fail()** - -| Error Code| Description| -| -------- | -------- | -| 601 | Failed to obtain the required permission because the user rejected the request.| -| 602 | Permission not declared.| -| 801 | System location disabled.| +| options | [SubscribeLocationOption](#subscribelocationoptiondeprecated) | Yes| Options for continuous location.| **Example** @@ -185,6 +137,8 @@ Cancels listening to the geographic location. > **NOTE** > This API is deprecated since API version 9. You are advised to use [geoLocationManager.off('locationChange')](js-apis-geoLocationManager.md#geolocationmanagerofflocationchange). +**Required permissions**: ohos.permission.LOCATION + **System capability**: SystemCapability.Location.Location.Lite **Example** @@ -193,7 +147,7 @@ Cancels listening to the geographic location. export default { unsubscribe() { geolocation.unsubscribe(); - }, + } } ``` @@ -224,3 +178,102 @@ export default { }, } ``` + +## GetLocationOption(deprecated) + +Defines the options of a single location request. + +> **NOTE** +> This API is deprecated since API version 9. You are advised to use [geoLocationManager.CurrentLocationRequest](js-apis-geoLocationManager.md#CurrentLocationRequest). + +**Required permissions**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Lite + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| timeout | number | No| Timeout duration, in ms. The default value is **30000**.
The timeout duration is necessary in case the request to obtain the geographic location is rejected for the lack of the required permission, weak positioning signal, or incorrect location settings. After the timeout duration expires, the fail function will be called.
The value is a 32-digit positive integer. If the specified value is less than or equal to **0**, the default value will be used.| +| coordType | string | No| Coordinate system type. Available types can be obtained by **getSupportedCoordTypes**. The default type is **wgs84**.| +| success | (data: [GeolocationResponse](#geolocationresponsedeprecated)) => void | No| Called when API call is successful.| +| fail | (data: string, code: number) => void | No| Called when API call has failed. **data** indicates the error information, and **code** indicates the error code.| +| complete | () => void | No| Called when API call is complete.| + +**Return value of fail()** + +| Error Code| Description| +| -------- | -------- | +| 601 | Failed to obtain the required permission because the user rejected the request.| +| 602 | Permission not declared.| +| 800 | Operation times out due to a poor network condition or GNSS unavailability.| +| 801 | System location disabled.| +| 802 | API called again while the previous execution result is not returned yet.| + +## GeolocationResponse(deprecated) + +Defines the location information, including the longitude, latitude, and location precision. + +> **NOTE** +> This API is deprecated since API version 9. You are advised to use [geoLocationManager.Location](js-apis-geoLocationManager.md#location). + +**System capability**: SystemCapability.Location.Location.Lite + +| Name| Type| Readable| Writable| Description| +| -------- | -------- | -------- | -------- | -------- | +| longitude | number | Yes| No| Longitude.| +| latitude | number | Yes| No| Latitude.| +| altitude | number | Yes| No| Altitude.| +| accuracy | number | Yes| No| Location accuracy.| +| time | number | Yes| No| Time when the location is obtained.| + +## GetLocationTypeOption(deprecated) + +Defines the location type option, which holds the callback function used to return the query result. + +> **NOTE** +> This API is deprecated since API version 9. + +**System capability**: SystemCapability.Location.Location.Lite + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| success | (data: [GetLocationTypeResponse](#getlocationtyperesponsedeprecated)) => void | No| Called when API call is successful.| +| fail | (data: string, code: number) => void | No| Called when API call has failed.| +| complete | () => void | No| Called when API call is complete.| + +## GetLocationTypeResponse(deprecated) + +Defines the list of location types supported by the current device + +> **NOTE** +> This API is deprecated since API version 9. + +**System capability**: SystemCapability.Location.Location.Lite + +| Name| Type| Readable| Writable| Description| +| -------- | -------- | -------- | -------- | -------- | +| types | Array<string> | Yes| No| Available location types, ['gps', 'network']| + +## SubscribeLocationOption(deprecated) + +Defines the options for continuous location. + +> **NOTE** +> This API is deprecated since API version 9. You are advised to use [geoLocationManager.CurrentLocationRequest](js-apis-geoLocationManager.md#locationrequest). + +**Required permissions**: ohos.permission.LOCATION + +**System capability**: SystemCapability.Location.Location.Lite + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| coordType | string | No| Coordinate system type. Available types can be obtained by **getSupportedCoordTypes**. The default type is **wgs84**.| +| success | (data: [GeolocationResponse](#geolocationresponsedeprecated)) => void | Yes| Called when the geographic location changes.| +| fail | (data: string, code: number) => void | No| Called when API call has failed.| + +**Return value of fail()** + +| Error Code| Description| +| -------- | -------- | +| 601 | Failed to obtain the required permission because the user rejected the request.| +| 602 | Permission not declared.| +| 801 | System location disabled.| diff --git a/en/application-dev/reference/apis/js-apis-system-network.md b/en/application-dev/reference/apis/js-apis-system-network.md index e012487feefe73e79738c570e4e2ebda9ad23919..5fe6e782edc352c4d49377b4e8d9a4343d8435a6 100644 --- a/en/application-dev/reference/apis/js-apis-system-network.md +++ b/en/application-dev/reference/apis/js-apis-system-network.md @@ -1,8 +1,8 @@ # @system.network (Network State) > **NOTE** -> -> - The APIs of this module are no longer maintained since API version 7. It is recommended that you use [`@ohos.telephony.observer`](js-apis-observer.md) instead. +> - The APIs of this module are no longer maintained since API version 7. You are advised to use [`@ohos.telephony.observer`](js-apis-observer.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. @@ -31,17 +31,17 @@ Obtains the network type. **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| success | Function | No | Called when the execution is successful. The return value is [NetworkResponse](#networkresponse). | -| fail | Function | No | Called when the operation fails. | -| complete | Function | No | Called when the execution is complete | +| success | Function | No| Called when the API call is successful. The return value is defined by [NetworkResponse](#networkresponse).| +| fail | Function | No| Called when API call has failed.| +| complete | Function | No| Called when the API call is complete.| -Return value of the **fail** callback: +One of the following error codes will be returned if the API call has failed. -| Error Code | Description | +| Error Code| Description| | -------- | -------- | -| 602 | The current permission is not declared. | +| 602 | The current permission is not declared.| **Example** @@ -71,17 +71,17 @@ Listens to the network connection state. If this method is called multiple times **Parameters** -| Name | Type | Mandatory | Description | +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| success | Function | No | Called when the network connection state changes | -| fail | Function | No | Called when the multimedia volume fails to be obtained. | +| success | Function | No| Called when the network state changes. The return value is defined by [NetworkResponse](#networkresponse).| +| fail | Function | No| Called when API call has failed.| -Return value of the **fail** callback: +One of the following error codes will be returned if the API call has failed. -| Error Code | Description | +| Error Code| Description| | -------- | -------- | -| 602 | The current permission is not declared. | -| 200 | The subscription fails. | +| 602 | The current permission is not declared.| +| 200 | Subscription failed.| **Example** @@ -119,9 +119,12 @@ export default { } ``` + ## NetworkResponse -| Parameter | Type | Description | -| -------- | -------- | -------- | -| metered | boolean | Whether the billing is based on the data volume. | -| type | string | Network type. The value can be **2G**, **3G**, **4G**, **5G**, **WiFi**, or **none**. | \ No newline at end of file +**System capability**: SystemCapability.Communication.NetManager.Core + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| metered | boolean | No|Whether to charge by traffic.| +| type | string | Yes|Network type. The value can be **2G**, **3G**, **4G**, **5G**, **WiFi**, or **none**.| diff --git a/en/application-dev/reference/apis/js-apis-system-notification.md b/en/application-dev/reference/apis/js-apis-system-notification.md index 91b35f9b29ce4a18b32e19741b14337322ab00bf..0f014e6822dc9b257a7b0eaa6e802b6f7f758110 100644 --- a/en/application-dev/reference/apis/js-apis-system-notification.md +++ b/en/application-dev/reference/apis/js-apis-system-notification.md @@ -1,7 +1,7 @@ # @system.notification (Notification) > **NOTE** -> - The APIs of this module are no longer maintained since API version 7. You are advised to use [`@ohos.notification`](js-apis-notification.md). +> - The APIs of this module are no longer maintained since API version 7. You are advised to use [@ohos.notification](js-apis-notification.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. @@ -17,22 +17,22 @@ import notification from '@system.notification'; **System capability**: SystemCapability.Notification.Notification -| Name | Type | Readable | Writable | Mandatory| Description | -| ----------- | ---------------------------------------------- | ---- | ------------------------- | ------------------------- | ------------------------- | -| bundleName | string | Yes | Yes | Yes | Name of the application bundle to which the notification will be redirected after being clicked. | -| abilityName | string | Yes | Yes | Yes | Name of the application ability to which the notification will be redirected after being clicked.| -| uri | string | Yes | Yes | No | URI of the page to be redirected to. | +| Name | Type | Mandatory| Description | +| ----------- | ---------------------------------------------- | ---- | ------------------------- | +| bundleName | string | Yes | Name of the application bundle to which the notification will be redirected after being clicked. | +| abilityName | string | Yes | Name of the application ability to which the notification will be redirected after being clicked.| +| uri | string | No | URI of the page to be redirected to. | ## ShowNotificationOptions **System capability**: SystemCapability.Notification.Notification -| Name | Type | Readable | Writable | Mandatory| Description | -| ------------- | ---------------------------------------------- | ---- | ------------------------- | ------------------------- | ------------------------- | -| contentTitle | string | Yes | Yes | No | Notification title. | -| contentText | string | Yes | Yes | No | Notification content. | -| clickAction | ActionResult | Yes | Yes | No | Action triggered when the notification is clicked. | +| Name | Type | Mandatory| Description | +| ------------- | ---------------------------------------------- | ---- | ------------------------- | +| contentTitle | string | No | Notification title. | +| contentText | string | No | Notification content. | +| clickAction | ActionResult | No | Action triggered when the notification is clicked. | ## notification.show diff --git a/en/application-dev/reference/apis/js-apis-system-package.md b/en/application-dev/reference/apis/js-apis-system-package.md index 5c562892d8f5d5a99423cb79a19478609612aed6..9644d0fa26cda69a6b035c0ba1e2bcbbc9f933dc 100644 --- a/en/application-dev/reference/apis/js-apis-system-package.md +++ b/en/application-dev/reference/apis/js-apis-system-package.md @@ -23,8 +23,6 @@ hasInstalled(options: CheckPackageHasInstalledOptions): void Checks whether an application exists, or whether a native application has been installed. -**Required permissions**: none - **System capability**: SystemCapability.BundleManager.BundleFramework **Parameters** diff --git a/en/application-dev/reference/apis/js-apis-system-parameter.md b/en/application-dev/reference/apis/js-apis-system-parameter.md index db74b6b6c4e725c68f47419997bbecb1362da435..0dc490855181cedbe2199810dd45a28384c75c71 100644 --- a/en/application-dev/reference/apis/js-apis-system-parameter.md +++ b/en/application-dev/reference/apis/js-apis-system-parameter.md @@ -5,7 +5,7 @@ For details about the system parameter design principles and definitions, see [Service Management](../../../device-dev/subsystems/subsys-boot-init-sysparam.md). > **NOTE** -> - The APIs of this module are no longer maintained since API version 9. It is recommended that you use [@ohos.systemParameterV9](js-apis-system-parameterV9.md) instead. +> - The APIs of this module are no longer maintained since API version 9. It is recommended that you use [@ohos.systemParameterEnhance](js-apis-system-parameterEnhance.md) instead. > - 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. > - The APIs provided by this module are system APIs. > - Third-party applications cannot use the APIs provided by this module, because system parameters each require specific discretionary access control (DAC) and MAC permissions. diff --git a/en/application-dev/reference/apis/js-apis-system-sensor.md b/en/application-dev/reference/apis/js-apis-system-sensor.md index 30bfc60e3339b8102fbe6f4a6c5fc1202015da11..ccf4be2ce7e5a660ef1622e90bce2c204634906e 100644 --- a/en/application-dev/reference/apis/js-apis-system-sensor.md +++ b/en/application-dev/reference/apis/js-apis-system-sensor.md @@ -8,7 +8,7 @@ The sensors are classified into the following categories based on their function > **NOTE** > > - The APIs of this module are no longer maintained since API version 8. You are advised to use [`@ohos.sensor`](js-apis-sensor.md) instead. -> - The initial APIs of this module are supported since API version 4. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version. > - This module requires hardware support and can only be debugged on real devices. @@ -19,15 +19,9 @@ The sensors are classified into the following categories based on their function import sensor from '@system.sensor'; ``` -## Error Codes - -| Error Code | Description | -| ---- | -------------- | -| 900 | The current device does not support the corresponding sensor.| - ## sensor.subscribeAccelerometer -subscribeAccelerometer(Object): void + subscribeAccelerometer(options: subscribeAccelerometerOptions): void Subscribes to data changes of the acceleration sensor. If this API is called multiple times for the same application, the last call takes effect. @@ -37,23 +31,13 @@ Subscribes to data changes of the acceleration sensor. If this API is called mul **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------- | ---- | ---------------------------------------- | -| interval | string | Yes | Execution frequency of the callback for returning the acceleration sensor data.
The default value is **normal**. The options are as follows:
- **game**: called at an interval of 20 ms, which is applicable to gaming scenarios.
- **ui**: called at an interval of 60 ms, which is applicable to UI updating scenarios.
- **normal**: called at an interval of 200 ms, which is applicable to power-saving scenarios.| -| success | Function | Yes | Called when the acceleration sensor data changes. | -| fail | Function | No | Callback upon failure. | - -Return values of the success callback - -| Name | Type | Description | -| ---- | ------ | ------- | -| x | number | Acceleration on the x-axis.| -| y | number | Acceleration on the y-axis.| -| z | number | Acceleration on the z-axis.| +| Name | Type | Mandatory| Description | +| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------ | +| options | [subscribeAccelerometerOptions](#subscribeaccelerometeroptions) | Yes | Type of data to return.| **Example** -``` +```js sensor.subscribeAccelerometer({ interval: 'normal', success: function(ret) { @@ -82,13 +66,13 @@ Unsubscribes from data changes of the acceleration sensor. **Example** -``` +```js sensor.unsubscribeAccelerometer(); ``` ## sensor.subscribeCompass -subscribeCompass(Object): void + subscribeCompass(options: SubscribeCompassOptions): void Subscribes to data changes of the compass sensor. If this API is called multiple times for the same application, the last call takes effect. @@ -96,20 +80,13 @@ Subscribes to data changes of the compass sensor. If this API is called multiple **Parameters** -| Name | Type | Mandatory | Description | -| ------- | -------- | ---- | --------------- | -| success | Function | Yes | Called when the compass sensor data changes.| -| fail | Function | No | Callback upon failure. | - -Return values of the success callback - -| Name | Type | Description | -| --------- | ------ | ---------- | -| direction | number | Direction of the device, in degrees.| +| Name | Type | Mandatory| Description | +| ------- | --------------------------------------------------- | ---- | -------------------------------- | +| options | [SubscribeCompassOptions](#subscribecompassoptions) | Yes | Type of data to return.| **Example** -``` +```js sensor.subscribeCompass({ success: function(ret) { console.log('get data direction:' + ret.direction); @@ -133,13 +110,13 @@ Unsubscribes from data changes of the compass sensor. **Example** -``` +```js sensor.unsubscribeCompass(); ``` ## sensor.subscribeProximity -subscribeProximity(Object): void + subscribeProximity(options: SubscribeProximityOptions): void Subscribes to data changes of the proximity sensor. If this API is called multiple times for the same application, the last call takes effect. @@ -147,20 +124,13 @@ Subscribes to data changes of the proximity sensor. If this API is called multip **Parameters** -| Name | Type | Mandatory | Description | -| ------- | -------- | ---- | ----------------- | -| success | Function | Yes | Called when the proximity sensor data changes.| -| fail | Function | No | Callback upon failure. | - -Return values of the success callback - -| Name | Type | Description | -| -------- | ------ | --------------------- | -| distance | number | Distance between a visible object and the device screen.| +| Name | Type | Mandatory| Description | +| ------- | ------------------------------------------------------- | ---- | -------------------------------- | +| options | [SubscribeProximityOptions](#subscribeproximityoptions) | Yes | Type of data to return.| **Example** -``` +```js sensor.subscribeProximity({ success: function(ret) { console.log('get data distance:' + ret.distance); @@ -184,13 +154,13 @@ Unsubscribes from data changes of the proximity sensor. **Example** -``` +```js sensor.unsubscribeProximity(); ``` ## sensor.subscribeLight -sensor.subscribeLight(Object): void + subscribeLight(options: SubscribeLightOptions): void Subscribes to data changes of the ambient light sensor. If this API is called multiple times, the last call takes effect. @@ -198,20 +168,13 @@ Subscribes to data changes of the ambient light sensor. If this API is called mu **Parameters** -| Name | Type | Mandatory | Description | -| ------- | -------- | ---- | --------------- | -| success | Function | Yes | Called when the ambient light sensor data changes| -| fail | Function | No | Callback upon failure. | - -Return values of the success callback - -| Name | Type | Description | -| --------- | ------ | ------------ | -| intensity | number | Light intensity, in lux.| +| Name | Type | Mandatory| Description | +| ------- | ----------------------------------------------- | ---- | ---------------------------------- | +| options | [SubscribeLightOptions](#subscribelightoptions) | Yes | Type of data to return.| **Example** -``` +```js sensor.subscribeLight({ success: function(ret) { console.log('get data intensity:' + ret.intensity); @@ -235,13 +198,13 @@ Unsubscribes from data changes of the ambient light sensor. **Example** -``` +```js sensor.unsubscribeLight(); ``` ## sensor.subscribeStepCounter -subscribeStepCounter(Object): void + subscribeStepCounter(options: SubscribeStepCounterOptions): void Subscribes to data changes of the step counter sensor. If this API is called multiple times for the same application, the last call takes effect. @@ -251,20 +214,13 @@ Subscribes to data changes of the step counter sensor. If this API is called mul **Parameters** -| Name | Type | Mandatory | Description | -| ------- | -------- | ---- | ---------------- | -| success | Function | Yes | Called when the step counter sensor data changes.| -| fail | Function | No | Callback upon failure. | - -Return values of the success callback - -| Name | Type | Description | -| ----- | ------ | --------------------- | -| steps | number | Number of counted steps after the sensor is restarted.
| +| Name | Type | Mandatory| Description | +| ------- | ----------------------------------------------------------- | ---- | -------------------------------------- | +| options | [SubscribeStepCounterOptions](#subscribestepcounteroptions) | Yes | Type of data to return.| **Example** -``` +```js sensor.subscribeStepCounter({ success: function(ret) { console.log('get step value:' + ret.steps); @@ -290,14 +246,14 @@ Unsubscribes from data changes of the step counter sensor. **Example** -``` +```js sensor.unsubscribeStepCounter(); ``` ## sensor.subscribeBarometer -subscribeBarometer(Object): void +subscribeBarometer(options: SubscribeBarometerOptions): void Subscribes to data changes of the barometer sensor. If this API is called multiple times for the same application, the last call takes effect. @@ -305,20 +261,13 @@ Subscribes to data changes of the barometer sensor. If this API is called multip **Parameters** -| Name | Type | Mandatory | Description | -| ------- | -------- | ---- | ---------------- | -| success | Function | Yes | Called when the barometer sensor data changes.| -| fail | Function | No | Callback upon failure. | - -Return values of the success callback - -| Name | Type | Description | -| -------- | ------ | ----------- | -| pressure | number | Pressure, in pascal.| +| Name | Type | Mandatory| Description | +| ------- | ------------------------------------------------------- | ---- | ---------------------------------- | +| options | [SubscribeBarometerOptions](#subscribebarometeroptions) | Yes | Type of data to return.| **Example** -``` +```js sensor.subscribeBarometer({ success: function(ret) { console.log('get data value:' + ret.pressure); @@ -343,14 +292,14 @@ Unsubscribes from data changes of the barometer sensor. **Example** -``` +```js sensor.unsubscribeBarometer(); ``` ## sensor.subscribeHeartRate -subscribeHeartRate(Object): void + subscribeHeartRate(options: SubscribeHeartRateOptions): void Subscribes to data changes of the heart rate sensor. If this API is called multiple times for the same application, the last call takes effect. @@ -360,20 +309,13 @@ Subscribes to data changes of the heart rate sensor. If this API is called multi **Parameters** -| Name | Type | Mandatory | Description | -| ------- | -------- | ---- | ------------------------- | -| success | Function | Yes | Called when the heart rate sensor data changes. This callback is invoked every five seconds.| -| fail | Function | No | Callback upon failure. | - -Return values of the success callback - -| Name | Type | Description | -| --------- | ------ | ---- | -| heartRate | number | Heart rate.| +| Name | Type | Mandatory| Description | +| ------- | ------------------------------------------------------- | ---- | -------------------------------- | +| options | [SubscribeHeartRateOptions](#subscribeheartrateoptions) | Yes | Type of data to return.| **Example** -``` +```js sensor.subscribeHeartRate({ success: function(ret) { console.log('get heartrate value:' + ret.heartRate); @@ -400,13 +342,13 @@ Unsubscribes from data changes of the heart rate sensor. **Example** -``` +```js sensor.unsubscribeHeartRate(); ``` ## sensor.subscribeOnBodyState -subscribeOnBodyState(Object): void + subscribeOnBodyState(options: SubscribeOnBodyStateOptions): void Subscribes to changes of the wearing state of a wearable device. If this API is called multiple times for the same application, the last call takes effect. @@ -414,20 +356,13 @@ Subscribes to changes of the wearing state of a wearable device. If this API is **Parameters** -| Name | Type | Mandatory | Description | -| ------- | -------- | ---- | ------------- | -| success | Function | Yes | Called when the wearing state changes.| -| fail | Function | No | Callback upon failure. | - -Return values of the success callback - -| Name | Type | Description | -| ----- | ------- | ------ | -| value | boolean | Whether the wearable device is worn.| +| Name | Type | Mandatory| Description | +| ------- | ----------------------------------------------------------- | ---- | ---------------------- | +| options | [SubscribeOnBodyStateOptions](#subscribeonbodystateoptions) | Yes | Type of data to return.| **Example** -``` +```js sensor.subscribeOnBodyState({ success: function(ret) { console.log('get on-body state value:' + ret.value); @@ -451,13 +386,13 @@ Unsubscribes from changes of the wearing state of a wearable device. **Example** -``` +```js sensor.unsubscribeOnBodyState(); ``` ## sensor.getOnBodyState -getOnBodyState(Object): void + getOnBodyState(options: GetOnBodyStateOptions): void Obtains the wearing state of a wearable device. @@ -465,21 +400,13 @@ Obtains the wearing state of a wearable device. **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------- | ---- | ------------ | -| success | Function | No | Callback upon success.| -| fail | Function | No | Callback upon failure.| -| complete | Function | No | Called when the execution is complete.| - -Return values of the success callback - -| Name | Type | Description | -| ----- | ------- | ------ | -| value | boolean | Whether the wearable device is worn.| +| Name | Type | Mandatory| Description | +| ------- | ----------------------------------------------- | ---- | -------------------------- | +| options | [GetOnBodyStateOptions](#getonbodystateoptions) | Yes | Type of data to return.| **Example** -``` +```js sensor.getOnBodyState({ success: function(ret) { console.log('on body state: ' + ret.value); @@ -492,7 +419,7 @@ sensor.getOnBodyState({ ## sensor.subscribeDeviceOrientation6+ -subscribeDeviceOrientation(interval: string, success: (data: DeviceOrientationResponse), fail?: (data: string, code: number)): void + subscribeDeviceOrientation(options: SubscribeDeviceOrientationOptions): void Subscribes to data changes of the device orientation sensor. @@ -502,22 +429,13 @@ If this API is called multiple times for the same application, the last call tak **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------- | ---- | ---------------------------------------- | -| interval | string | Yes | Interval at which the callback is invoked to return the device orientation sensor data.
The default value is **normal**. The options are as follows:
- **game**: called at an interval of 20 ms, which is applicable to gaming scenarios.
- **ui**: called at an interval of 60 ms, which is applicable to UI updating scenarios.
- **normal**: called at an interval of 200 ms, which is applicable to power-saving scenarios.| -| success | Function | Yes | Called when the device orientation sensor data changes. | -| fail | Function | No | Callback upon failure. | - - Return values of the success callback -| Name | Type | Description | -| ----- | ------ | ---------------------------------------- | -| alpha | number | Rotation angle around the Z axis when the X/Y axis of the device coincides with the X/Y axis of the earth.| -| beta | number | Rotation angle around the X axis when the Y/Z axis of the device coincides with the Y/Z axis of the earth.| -| gamma | number | Rotation angle around the Y axis when the X/Z axis of the device coincides with the X/Z axis of the earth.| +| Name | Type | Mandatory| Description | +| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------ | +| options | [SubscribeDeviceOrientationOptions](#subscribedeviceorientationoptions) | Yes | Type of data to return.| **Example** -``` +```js sensor.subscribeDeviceOrientation({ interval: 'normal', success: function(ret) { @@ -544,13 +462,13 @@ Unsubscribes from data changes of the device orientation sensor. **Example** -``` +```js sensor.unsubscribeDeviceOrientation(); ``` ## sensor.subscribeGyroscope6+ -subscribeGyroscope(interval: string, success: (data: GyroscopeResponse), fail?: (data: string, code: number)): void + subscribeGyroscope(options: SubscribeGyroscopeOptions): void Subscribes to data changes of the gyroscope sensor. @@ -562,23 +480,13 @@ If this API is called multiple times for the same application, the last call tak **Parameters** -| Name | Type | Mandatory | Description | -| -------- | -------- | ---- | ---------------------------------------- | -| interval | string | Yes | Interval at which the callback is invoked to return the gyroscope sensor data.
The default value is **normal**. The options are as follows:
- **game**: called at an interval of 20 ms, which is applicable to gaming scenarios.
- **ui**: called at an interval of 60 ms, which is applicable to UI updating scenarios.
- **normal**: called at an interval of 200 ms, which is applicable to power-saving scenarios.| -| success | Function | Yes | Called when the gyroscope sensor data changes. | -| fail | Function | No | Callback upon failure. | - -Return values of the success callback - -| Name | Type | Description | -| ---- | ------ | --------- | -| x | number | Rotation angular velocity of the X axis.| -| y | number | Rotation angular velocity of the Y axis.| -| z | number | Rotation angular velocity of the Z axis.| +| Name | Type | Mandatory| Description | +| ------- | ------------------------------------------------------- | ---- | ---------------------------------------------- | +| options | [SubscribeGyroscopeOptions](#subscribegyroscopeoptions) | Yes | Type of data to return.| **Example** -``` +```js sensor.subscribeGyroscope({ interval: 'normal', success: function(ret) { @@ -607,6 +515,253 @@ Unsubscribes from data changes of the gyroscope sensor. **Example** -``` +```js sensor.unsubscribeGyroscope(); ``` + +## subscribeAccelerometerOptions + +Defines the type of data to return for a subscription to the acceleration sensor data. + +**Required permissions**: ohos.permission.ACCELEROMETER + +**System capability**: SystemCapability.Sensors.Sensor + +| Name | Type | Mandatory| Description | +| -------- | ----------------------------------------------- | ---- | ------------------------------------------------------------ | +| interval | string | Yes | Execution frequency of the callback for returning the acceleration sensor data. The default value is **normal**. The options are as follows: - **game**: called at an interval of 20 ms, which is applicable to gaming scenarios. - **ui**: called at an interval of 60 ms, which is applicable to UI updating scenarios. - **normal**: called at an interval of 200 ms, which is applicable to power-saving scenarios.| +| success | [AccelerometerResponse](#accelerometerresponse) | Yes | Called when the acceleration sensor data changes. | +| fail | Function | No | Callback upon an API call failure. | + +## AccelerometerResponse + +Defines the type of data to include in an **AccelerometerResponse** object. + +**Required permissions**: ohos.permission.ACCELEROMETER + +**System capability**: SystemCapability.Sensors.Sensor + +| Name| Type | Mandatory| Description | +| ---- | ------ | ---- | ------------- | +| x | number | Yes | Acceleration on the x-axis.| +| y | number | Yes | Acceleration on the y-axis.| +| z | number | Yes | Acceleration on the z-axis.| + +## SubscribeCompassOptions + +Defines the type of data to return for a subscription to the compass sensor data. + +**System capability**: SystemCapability.Sensors.Sensor + +| Name | Type | Mandatory| Description | +| ------- | ----------------------------------- | ---- | ------------------------------ | +| success | [CompassResponse](#compassresponse) | Yes | Called when the compass sensor data changes.| +| fail | Function | No | Callback upon an API call failure. | + +## CompassResponse + +Defines the type of data to include in a **CompassResponse** object. + +**System capability**: SystemCapability.Sensors.Sensor + +| Name | Type | Mandatory| Description | +| --------- | ------ | ---- | -------------------- | +| direction | number | Yes | Direction of the device, in degrees.| + +## SubscribeProximityOptions + +Defines the type of data to return for a subscription to the proximity sensor data. + +**System capability**: SystemCapability.Sensors.Sensor + +| Name | Type | Mandatory| Description | +| ------- | --------------------------------------- | ---- | ---------------------------------- | +| success | [ProximityResponse](#proximityresponse) | Yes | Called when the proximity sensor data changes.| +| fail | Function | No | Callback upon an API call failure. | + +## ProximityResponse + +Defines the type of data to include in a **ProximityResponse** object. + +**System capability**: SystemCapability.Sensors.Sensor + +| Name | Type | Mandatory| Description | +| -------- | ------ | ---- | ------------------------------------------ | +| distance | number | Yes | Distance between a visible object and the device screen.| + +## SubscribeLightOptions + +Defines the type of data to return for a subscription to the ambient light sensor data. + +**System capability**: SystemCapability.Sensors.Sensor + +| Name | Type | Mandatory| Description | +| ------- | ------------------------------- | ---- | ------------------------------ | +| success | [LightResponse](#lightresponse) | Yes | Called when the ambient light sensor data changes| +| fail | Function | No | Callback upon an API call failure. | + +## LightResponse + +Defines the type of data to include in a **LightResponse** object. + +**System capability**: SystemCapability.Sensors.Sensor + +| Name | Type | Mandatory| Description | +| --------- | ------ | ---- | --------------------- | +| intensity | number | Yes | Light intensity, in lux.| + +## SubscribeStepCounterOptions + +Defines the type of data to return for a subscription to the step counter sensor data. + +**Required permissions**: ohos.permission.ACTIVITY_MOTION + +**System capability**: SystemCapability.Sensors.Sensor + +| Name | Type | Mandatory| Description | +| ------- | ------------------------------------------- | ---- | -------------------------------- | +| success | [StepCounterResponse](#stepcounterresponse) | Yes | Called when the step counter sensor data changes.| +| fail | Function | No | Callback upon an API call failure. | + +## StepCounterResponse + +Defines the type of data to include in a **StepCounterResponse** object. + +**Required permissions**: ohos.permission.ACTIVITY_MOTION + +**System capability**: SystemCapability.Sensors.Sensor + +| Name | Type | Mandatory| Description | +| ----- | ------ | ---- | -------------------------------- | +| steps | number | Yes | Number of counted steps after the sensor is restarted.| + +## SubscribeBarometerOptions + +Defines the type of data to return for a subscription to the barometer sensor data. + +**System capability**: SystemCapability.Sensors.Sensor + +| Name | Type | Mandatory| Description | +| ------- | --------------------------------------- | ---- | -------------------------------- | +| success | [BarometerResponse](#barometerresponse) | Yes | Called when the barometer sensor data changes.| +| fail | Function | No | Callback upon an API call failure. | + +## BarometerResponse + +Defines the type of data to include in a **BarometerResponse** object. + +**System capability**: SystemCapability.Sensors.Sensor + +| Name | Type | Mandatory| Description | +| -------- | ------ | ---- | ---------------------- | +| pressure | number | Yes | Pressure, in pascal.| + +## SubscribeHeartRateOptions + +Defines the type of data to return for a subscription to the heart rate sensor data. + +**Required permissions**: ohos.permission.READ_HEALTH_DATA + +**System capability**: SystemCapability.Sensors.Sensor + +| Name | Type | Mandatory| Description | +| ------- | --------------------------------------- | ---- | ----------------------------------------------- | +| success | [HeartRateResponse](#heartrateresponse) | Yes | Called when the heart rate sensor data changes. This callback is invoked every five seconds.| +| fail | Function | No | Callback upon an API call failure. | + +## HeartRateResponse + +Defines the type of data to include in a **HeartRateResponse** object. + +**Required permissions**: ohos.permission.READ_HEALTH_DATA + +**System capability**: SystemCapability.Sensors.Sensor + +| Name | Type | Mandatory| Description | +| --------- | ------ | ---- | -------- | +| heartRate | number | Yes | Heart rate.| + +## SubscribeOnBodyStateOptions + +Defines the type of data to return for a subscription to the wearing state changes. + +**System capability**: SystemCapability.Sensors.Sensor + +| Name | Type | Mandatory| Description | +| ------- | ------------------------------------------- | ---- | -------------------------- | +| success | [OnBodyStateResponse](#onbodystateresponse) | Yes | Called when the wearing state changes.| +| fail | Function | No | Callback upon an API call failure. | + +## OnBodyStateResponse + +Defines the wearing state. + +**System capability**: SystemCapability.Sensors.Sensor + +| Name | Type | Mandatory| Description | +| ----- | ------- | ---- | ------------ | +| value | boolean | Yes | Whether the wearable device is worn.| + +## GetOnBodyStateOptions + + Defines the type of data to return for obtaining the wearing state. + +**System capability**: SystemCapability.Sensors.Sensor + +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------- | ---- | ------------------------ | +| success | [OnBodyStateResponse](#onbodystateresponse) | No | Callback upon a successful API call.| +| fail | Function | No | Callback upon an API call failure.| +| complete | Function | No | Called when the API call is complete.| + +## SubscribeDeviceOrientationOptions6+ + +Defines the type of data to return for a subscription to the device orientation sensor data. + +**System capability**: SystemCapability.Sensors.Sensor + +| Name | Type | Mandatory| Description | +| -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------------ | +| interval | string | Yes | Interval at which the callback is invoked to return the device orientation sensor data.
The default value is **normal**. The options are as follows:
- **game**: called at an interval of 20 ms, which is applicable to gaming scenarios.
- **ui**: called at an interval of 60 ms, which is applicable to UI updating scenarios.
- **normal**: called at an interval of 200 ms, which is applicable to power-saving scenarios.| +| success | [DeviceOrientationResponse](#deviceorientationresponse) | Yes | Called when the device orientation sensor data changes. | +| fail | Function | No | Callback upon an API call failure. | + +## DeviceOrientationResponse6+ + +Defines the type of data to include in a **DeviceOrientationResponse** object. + +**System capability**: SystemCapability.Sensors.Sensor + +| Name | Type | Mandatory| Description | +| ----- | ------ | ---- | ------------------------------------------------------------ | +| alpha | number | Yes | Rotation angle around the Z axis when the X/Y axis of the device coincides with the X/Y axis of the earth.| +| beta | number | Yes | Rotation angle around the X axis when the Y/Z axis of the device coincides with the Y/Z axis of the earth.| +| gamma | number | Yes | Rotation angle around the Y axis when the X/Z axis of the device coincides with the X/Z axis of the earth.| + +## SubscribeGyroscopeOptions6+ + +Defines the type of data to return for a subscription to the gyroscope sensor data. + +**Required permissions**: ohos.permission.GYROSCOPE + +**System capability**: SystemCapability.Sensors.Sensor + +| Name | Type | Mandatory| Description | +| -------- | --------------------------------------- | ---- | ------------------------------------------------------------ | +| interval | string | Yes | Interval at which the callback is invoked to return the gyroscope sensor data.
The default value is **normal**. The options are as follows:
- **game**: called at an interval of 20 ms, which is applicable to gaming scenarios.
- **ui**: called at an interval of 60 ms, which is applicable to UI updating scenarios.
- **normal**: called at an interval of 200 ms, which is applicable to power-saving scenarios.| +| success | [GyroscopeResponse](#gyroscoperesponse) | Yes | Called when the gyroscope sensor data changes. | +| fail | Function | No | Callback upon an API call failure. | + +## GyroscopeResponse6+ + +Defines the type of data to include in a **GyroscopeResponse** object. + +**Required permissions**: ohos.permission.GYROSCOPE + +**System capability**: SystemCapability.Sensors.Sensor + +| Name| Type | Mandatory| Description | +| ---- | ------ | ---- | ----------------- | +| x | number | Yes | Rotation angular velocity of the X axis.| +| y | number | Yes | Rotation angular velocity of the Y axis.| +| z | number | Yes | Rotation angular velocity of the Z axis.| diff --git a/en/application-dev/reference/apis/js-apis-system-vibrate.md b/en/application-dev/reference/apis/js-apis-system-vibrate.md index 90dc19e2ffb0c8817f7cc2096dc792d252f8996f..a48f2f453f5c1de2d55e23f7005ea5a28b941684 100644 --- a/en/application-dev/reference/apis/js-apis-system-vibrate.md +++ b/en/application-dev/reference/apis/js-apis-system-vibrate.md @@ -1,13 +1,12 @@ # @system.vibrator (Vibrator) - The **Vibrator** module provides APIs for controlling LED lights and vibrators. You can use the APIs to query the LED light list, turn on and off the LED light, query the vibrator list, query the vibrator effect, and trigger and turn off the vibrator. Misc devices refer to LED lights and vibrators on devices. LED lights are mainly used for indication (for example, indicating the charging state) and blinking (such as tri-colored lights). Vibrators are mainly used in scenarios such as the alarm clock, power-on/off, and incoming call vibration. > **NOTE** -> - The initial APIs of this module are supported since API version 4. Newly added APIs will be marked with a superscript to indicate their earliest API version. +> - The initial APIs of this module are supported since API version 3. Newly added APIs will be marked with a superscript to indicate their earliest API version. > - The APIs of this module are no longer maintained since API version 8. You are advised to use [`@ohos.vibrator`](js-apis-vibrator.md) instead. > - This module requires hardware support and can only be debugged on real devices. @@ -21,26 +20,23 @@ import vibrator from '@system.vibrator'; ## vibrator.vibrate -vibrate(Object): void + vibrate(options?: VibrateOptions): void Triggers device vibration. -**System capability**: SystemCapability.Sensors.MiscDevice +**Required permissions**: ohos.permission.VIBRATE -**Required permissions**: ohos.permission.VIBRATE (a system permission) +**System capability**: SystemCapability.Sensors.MiscDevice **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| mode | string | No| Vibration mode. The value **long** indicates long vibration, and **short** indicates short vibration. The default value is **long**.| -| success | Function | Yes| Called when the vibrator data changes.| -| fail | Function | No| Called when the API call fails.| -| complete | Function | No| Called when the API call is complete.| +| Name | Type | Mandatory| Description | +| ------- | --------------------------------- | ---- | ---------- | +| options | [VibrateOptions](#vibrateoptions) | No | Vibration options.| **Example** -``` +```js vibrator.vibrate({ mode: 'short', success: function() { @@ -54,3 +50,18 @@ vibrator.vibrate({ } }); ``` + +## VibrateOptions + +Defines the vibration options. + +**Required permissions**: ohos.permission.VIBRATE + +**System capability**: SystemCapability.Sensors.MiscDevice + +| Name | Type | Mandatory| Description | +| -------- | -------- | ---- | ------------------------------------------------------------ | +| mode | string | No | Vibration mode. The value **long** indicates long vibration, and **short** indicates short vibration. The default value is **long**.| +| success | Function | No | Called when the vibrator data changes. | +| fail | Function | No | Called when the API call fails. | +| complete | Function | No | Called when the API call is complete. | diff --git a/en/application-dev/reference/apis/js-apis-tagSession.md b/en/application-dev/reference/apis/js-apis-tagSession.md index 9235dace79f11592adb3d84fbde631c33ec21780..e8a2ba6886ea9f74252e56a62136e1b6b909c72b 100644 --- a/en/application-dev/reference/apis/js-apis-tagSession.md +++ b/en/application-dev/reference/apis/js-apis-tagSession.md @@ -183,8 +183,6 @@ Checks whether the tag is connected. > **NOTE** > This API is supported since API version 7 and deprecated since API version 9. You are advised to use [tagSession.isConnected](#tagsessionisconnected9). -**Required permissions**: ohos.permission.NFC_TAG - **System capability**: SystemCapability.Communication.NFC.Tag **Return value** @@ -211,8 +209,6 @@ isConnected(): boolean Checks whether the tag is connected. -**Required permissions**: ohos.permission.NFC_TAG - **System capability**: SystemCapability.Communication.NFC.Tag **Return value** diff --git a/en/application-dev/reference/apis/js-apis-taskpool.md b/en/application-dev/reference/apis/js-apis-taskpool.md index a441a39e8bb232fd589a0b03e473890ef6bbbc5f..c1741b242f4b98d76df8ad4868dfc75d8089b36a 100644 --- a/en/application-dev/reference/apis/js-apis-taskpool.md +++ b/en/application-dev/reference/apis/js-apis-taskpool.md @@ -13,7 +13,7 @@ The **TaskPool** APIs return error codes in numeric format. For details about th ## Modules to Import -```js +```ts import taskpool from '@ohos.taskpool'; ``` @@ -58,12 +58,13 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** -```js +```ts +@Concurrent function func(args) { - "use concurrent" console.log("func: " + args); return args; } + let task = new taskpool.Task(func, "this is my first Task"); ``` @@ -109,14 +110,19 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** -```js +```ts +@Concurrent function func(args) { - "use concurrent" console.log("func: " + args); return args; } -let value = taskpool.execute(func, 100); +async function taskpoolTest() { + let value = await taskpool.execute(func, 100); + console.log("taskpool result: " + value); +} + +taskpoolTest(); ``` ## taskpool.execute @@ -152,14 +158,20 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** -```js +```ts +@Concurrent function func(args) { - "use concurrent" console.log("func: " + args); return args; } -let task = new taskpool.Task(func, "this is my first Task"); -let value = taskpool.execute(task); + +async function taskpoolTest() { + let task = new taskpool.Task(func, 100); + let value = await taskpool.execute(task); + console.log("taskpool result: " + value); +} + +taskpoolTest(); ``` ## taskpool.cancel @@ -187,15 +199,24 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** -```js +```ts +@Concurrent function func(args) { - "use concurrent" console.log("func: " + args); return args; } -let task = new taskpool.Task(func, "this is first Task"); -let value = taskpool.execute(task); -taskpool.cancel(task); + +async function taskpoolTest() { + let task = new taskpool.Task(func, 100); + let value = await taskpool.execute(task); + try { + taskpool.cancel(task); + } catch (e) { + console.log("taskpool.cancel occur error:" + e); + } +} + +taskpoolTest(); ``` ## Additional Information @@ -204,40 +225,125 @@ taskpool.cancel(task); The following sequenceable data types are supported: All Primitive Type (excluding symbol), Date, String, RegExp, Array, Map, Set, Object, ArrayBuffer, and TypedArray. ### Precautions -A task in the task pool can reference only variables passed in by input parameters or imported variables. It does not support closure variables. +- The task pool APIs can be used only in the module with **compileMode** set to **esmodule** in the stage model. To check the **compileMode** setting of a module, open the **build-profile.json5** file of the module and check for **"compileMode": "esmodule"** under **buildOption**. +- A task in the task pool can reference only variables passed in by input parameters or imported variables, rather than closure variables. The decorator **@Concurrent** is used to intercept unsupported variables. +- A task in the task pool supports only common functions or async functions, rather than class member functions or anonymous functions. The decorator **@Concurrent** is used to intercept unsupported functions. +- The decorator **@Concurrent** can be used only in the .ets file. To create a task in the task pool in the .ts file, use the statement **use concurrent**. -```js -// 1. Reference a variable passed in by the input parameter. +### Using the Task Pool in Simple Mode + +**Example 1** + +```ts +// Common functions are supported, and variables passed in by input parameters are also supported. +@Concurrent function func(args) { - "use concurrent" console.log("func: " + args); return args; } -let task = new taskpool.Task(func, "create task, then execute"); -let val1 = taskpool.execute(task); +async function taskpoolTest() { + // taskpool.execute(task) + let task = new taskpool.Task(func, "create task, then execute"); + let val1 = await taskpool.execute(task); + console.log("taskpool.execute(task) result: " + val1); -let val2 = taskpool.execute(func, "execute task by func"); + // taskpool.execute(function) + let val2 = await taskpool.execute(func, "execute task by func"); + console.log("taskpool.execute(function) result: " + val2); +} + +taskpoolTest(); ``` -```js -// 2. Reference an imported variable. +**Example 2** -// b.ts +```ts +// b.ets export var c = 2000; +``` +```ts +// Reference an imported variable. +// a.ets (in the same directory as b.ets) +import { c } from "./b"; -// a.ts -import { c } from './b' - +@Concurrent function test(a) { - "use concurrent" console.log(a); console.log(c); return a; } -let task = new taskpool.Task(test, "create task, then execute"); -let val1 = taskpool.execute(task); +async function taskpoolTest() { + // taskpool.execute(task) + let task = new taskpool.Task(test, "create task, then execute"); + let val1 = await taskpool.execute(task); + console.log("taskpool.execute(task) result: " + val1); + + // taskpool.execute(function) + let val2 = await taskpool.execute(test, "execute task by func"); + console.log("taskpool.execute(function) result: " + val2); +} + +taskpoolTest(); +``` + +**Example 3** + +```ts +// The async functions are supported. +@Concurrent +async function task() { + let ret = await Promise.all([ + new Promise(resolve => setTimeout(resolve, 1000, "resolved")) + ]); + return ret; +} + +async function taskpoolTest() { + taskpool.execute(task).then((result) => { + console.log("TaskPoolTest task result: " + result); + }); +} + +taskpoolTest(); +``` + +**Example 4** + +```ts +// Use use concurrent to create a task in the task pool in the .ts file. +// c.ts +function test1(n) { + "use concurrent" + return n; +} +export async function taskpoolTest1() { + console.log("taskpoolTest1 start"); + var task = new taskpool.Task(test1, 100); + var result = await taskpool.execute(task); + console.log("taskpoolTest1 result:" + result); +} + +async function test2() { + "use concurrent" + var ret = await Promise.all([ + new Promise(resolve => setTimeout(resolve, 1000, "resolved")) + ]); + return ret; +} +export async function taskpoolTest2() { + console.log("taskpoolTest2 start"); + taskpool.execute(test2).then((result) => { + console.log("TaskPoolTest2 result: " + result); + }); +} +``` + +```ts +/ / a.ets (in the same directory as c.ts) +import { taskpoolTest1, taskpoolTest2 } from "./c"; -let val2 = taskpool.execute(test, "execute task by func"); +taskpoolTest1(); +taskpoolTest2(); ``` 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 f1c9ad362175bd709d27bc4c7aec0059b413221e..a7a1338277a9b05840122488abb6553fd9b86e84 100644 --- a/en/application-dev/reference/apis/js-apis-telephony-data.md +++ b/en/application-dev/reference/apis/js-apis-telephony-data.md @@ -24,7 +24,7 @@ Obtains the default slot of the SIM card used for mobile data. This API uses an | Name | Type | Mandatory| Description | | -------- | ----------------------- | ---- | ------------------------------------------ | -| callback | AsyncCallback\ | Yes | Callback used to return the result.
**0**: card slot 1
**1**: card slot 2| +| callback | AsyncCallback\ | Yes | Callback used to return the result.
**0**: card slot 1.
**1**: card slot 2.| **Example** @@ -46,7 +46,7 @@ Obtains the default slot of the SIM card used for mobile data. This API uses a p | Type | Description | | ----------------- | ------------------------------------------------------------ | -| Promise\ | Promise used to return the result.
**0**: card slot 1
**1**: card slot 2| +| Promise\ | Promise used to return the result.
**0**: card slot 1.
**1**: card slot 2.| **Example** @@ -71,7 +71,7 @@ Obtains the default SIM card used for mobile data synchronously. | Type | Description | | ------ | -------------------------------------------------- | -| number | Card slot ID.
**0**: card slot 1
**1**: card slot 2| +| number | Card slot ID.
**0**: card slot 1.
**1**: card slot 2.| **Example** @@ -85,9 +85,9 @@ setDefaultCellularDataSlotId(slotId: number, callback: AsyncCallback\): v Sets the default slot of the SIM card used for mobile data. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. -**Required permission**: ohos.permission.SET_TELEPHONY_STATE +**Required permissions**: ohos.permission.SET_TELEPHONY_STATE **System capability**: SystemCapability.Telephony.CellularData @@ -95,14 +95,29 @@ 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.| +| 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. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301001 | SIM card is not activated. | + **Example** ```js -data.setDefaultCellularDataSlotId(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +data.setDefaultCellularDataSlotId(0, (err) => { + console.log(`callback: err->${JSON.stringify(err)}.`); }); ``` @@ -112,9 +127,9 @@ setDefaultCellularDataSlotId(slotId: number): Promise\ Sets the default slot of the SIM card used for mobile data. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. -**Required permission**: ohos.permission.SET_TELEPHONY_STATE +**Required permissions**: ohos.permission.SET_TELEPHONY_STATE **System capability**: SystemCapability.Telephony.CellularData @@ -122,7 +137,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.| +| slotId | number | Yes | SIM card slot ID.
**0**: card slot 1.
**1**: card slot 2.
**-1**: Clears the default configuration.| **Return value** @@ -130,12 +145,27 @@ This is a system API. | --------------- | ------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300004 | Do not have sim card. | +| 8300999 | Unknown error code. | +| 8301001 | SIM card is not activated. | + **Example** ```js let promise = data.setDefaultCellularDataSlotId(0); -promise.then((data) => { - console.log(`setDefaultCellularDataSlotId success, promise: data->${JSON.stringify(data)}`); +promise.then(() => { + console.log(`setDefaultCellularDataSlotId success.`); }).catch((err) => { console.error(`setDefaultCellularDataSlotId fail, promise: err->${JSON.stringify(err)}`); }); @@ -251,6 +281,19 @@ Checks whether the cellular data service is enabled. This API uses an asynchrono | -------- | ------------------------ | ---- | ------------------------------------------------------------ | | callback | AsyncCallback\ | Yes | Callback used to return the result.
**true**: The cellular data service is enabled.
**false**: The cellular data service is disabled.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -275,6 +318,19 @@ Checks whether the cellular data service is enabled. This API uses a promise to | ------------------ | ------------------------------------------------------------ | | Promise\ | Promise used to return the result.
**true**: The cellular data service is enabled.
**false**: The cellular data service is disabled.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -300,9 +356,22 @@ Checks whether roaming is enabled for the cellular data service. This API uses a | Name | Type | Mandatory| Description | | -------- | ------------------------ | ---- | ------------------------------------------------------------ | -| slotId | number | Yes | Card slot ID.
**0**: card slot 1
**1**: card slot 2 | +| slotId | number | Yes | Card slot ID.
**0**: card slot 1.
**1**: card slot 2. | | callback | AsyncCallback\ | Yes | Callback used to return the result.
**true**: Roaming is enabled for the cellular data service.
**false**: Roaming is disabled for the cellular data service.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -325,7 +394,7 @@ Checks whether roaming is enabled for the cellular data service. This API uses a | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ---------------------------------------- | -| slotId | number | Yes | Card slot ID.
**0**: card slot 1
**1**: card slot 2| +| slotId | number | Yes | Card slot ID.
**0**: card slot 1.
**1**: card slot 2.| **Return value** @@ -333,6 +402,19 @@ Checks whether roaming is enabled for the cellular data service. This API uses a | ------------------ | ------------------------------------------------------------ | | Promise\ | Promise used to return the result.
**true**: Roaming is enabled for the cellular data service.
**false**: Roaming is disabled for the cellular data service.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js @@ -350,9 +432,9 @@ enableCellularData(callback: AsyncCallback): void Enables the cellular data service. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. -**Required permission**: ohos.permission.SET_TELEPHONY_STATE +**Required permissions**: ohos.permission.SET_TELEPHONY_STATE **System capability**: SystemCapability.Telephony.CellularData @@ -362,11 +444,24 @@ This is a system API. | -------- | --------------------- | ---- | ---------- | | callback | AsyncCallback\ | Yes | Callback used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -data.enableCellularData((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +data.enableCellularData((err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -376,9 +471,9 @@ enableCellularData(): Promise Enables the cellular data service. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. -**Required permission**: ohos.permission.SET_TELEPHONY_STATE +**Required permissions**: ohos.permission.SET_TELEPHONY_STATE **System capability**: SystemCapability.Telephony.CellularData @@ -388,12 +483,25 @@ This is a system API. | --------------- | ----------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js let promise = data.enableCellularData(); -promise.then((data) => { - console.log(`enableCellularData success, promise: data->${JSON.stringify(data)}`); +promise.then(() => { + console.log(`enableCellularData success.`); }).catch((err) => { console.error(`enableCellularData fail, promise: err->${JSON.stringify(err)}`); }); @@ -405,9 +513,9 @@ disableCellularData(callback: AsyncCallback): void Disables the cellular data service. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. -**Required permission**: ohos.permission.SET_TELEPHONY_STATE +**Required permissions**: ohos.permission.SET_TELEPHONY_STATE **System capability**: SystemCapability.Telephony.CellularData @@ -417,11 +525,24 @@ This is a system API. | -------- | --------------------- | ---- | ---------- | | callback | AsyncCallback\ | Yes | Callback used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -data.disableCellularData((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +data.disableCellularData((err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -431,9 +552,9 @@ disableCellularData(): Promise Disables the cellular data service. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. -**Required permission**: ohos.permission.SET_TELEPHONY_STATE +**Required permissions**: ohos.permission.SET_TELEPHONY_STATE **System capability**: SystemCapability.Telephony.CellularData @@ -443,12 +564,25 @@ This is a system API. | --------------- | --------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js let promise = data.disableCellularData(); -promise.then((data) => { - console.log(`disableCellularData success, promise: data->${JSON.stringify(data)}`); +promise.then(() => { + console.log(`disableCellularData success.`); }).catch((err) => { console.error(`disableCellularData fail, promise: err->${JSON.stringify(err)}`); }); @@ -460,9 +594,9 @@ enableCellularDataRoaming(slotId: number, callback: AsyncCallback): void Enables the cellular data roaming service. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. -**Required permission**: ohos.permission.SET_TELEPHONY_STATE +**Required permissions**: ohos.permission.SET_TELEPHONY_STATE **System capability**: SystemCapability.Telephony.CellularData @@ -470,14 +604,27 @@ This is a system API. | Name | Type | Mandatory| Description | | -------- | --------------------- | ---- | ---------------------------------------- | -| slotId | number | Yes | Card slot ID.
**0**: card slot 1
**1**: card slot 2| +| slotId | number | Yes | Card slot ID.
**0**: card slot 1.
**1**: card slot 2.| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -data.enableCellularDataRoaming(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +data.enableCellularDataRoaming(0, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -487,9 +634,9 @@ enableCellularDataRoaming(slotId: number): Promise Enables the cellular data roaming service. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. -**Required permission**: ohos.permission.SET_TELEPHONY_STATE +**Required permissions**: ohos.permission.SET_TELEPHONY_STATE **System capability**: SystemCapability.Telephony.CellularData @@ -497,7 +644,7 @@ This is a system API. | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ---------------------------------------- | -| slotId | number | Yes | Card slot ID.
**0**: card slot 1
**1**: card slot 2| +| slotId | number | Yes | Card slot ID.
**0**: card slot 1.
**1**: card slot 2.| **Return value** @@ -505,12 +652,25 @@ This is a system API. | --------------- | ------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js let promise = data.enableCellularDataRoaming(0); -promise.then((data) => { - console.log(`enableCellularDataRoaming success, promise: data->${JSON.stringify(data)}`); +promise.then(() => { + console.log(`enableCellularDataRoaming success.`); }).catch((err) => { console.error(`enableCellularDataRoaming fail, promise: err->${JSON.stringify(err)}`); }); @@ -522,9 +682,9 @@ disableCellularDataRoaming(slotId: number, callback: AsyncCallback): void Disables the cellular data roaming service. This API uses an asynchronous callback to return the result. -This is a system API. +**System API**: This is a system API. -**Required permission**: ohos.permission.SET_TELEPHONY_STATE +**Required permissions**: ohos.permission.SET_TELEPHONY_STATE **System capability**: SystemCapability.Telephony.CellularData @@ -532,14 +692,27 @@ This is a system API. | Name | Type | Mandatory| Description | | -------- | --------------------- | ---- | ---------------------------------------- | -| slotId | number | Yes | Card slot ID.
**0**: card slot 1
**1**: card slot 2| +| slotId | number | Yes | Card slot ID.
**0**: card slot 1.
**1**: card slot 2.| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js -data.disableCellularDataRoaming(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +data.disableCellularDataRoaming(0, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -549,9 +722,9 @@ disableCellularDataRoaming(slotId: number): Promise Disables the cellular data roaming service. This API uses a promise to return the result. -This is a system API. +**System API**: This is a system API. -**Required permission**: ohos.permission.SET_TELEPHONY_STATE +**Required permissions**: ohos.permission.SET_TELEPHONY_STATE **System capability**: SystemCapability.Telephony.CellularData @@ -559,7 +732,7 @@ This is a system API. | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ---------------------------------------- | -| slotId | number | Yes | Card slot ID.
**0**: card slot 1
**1**: card slot 2| +| slotId | number | Yes | Card slot ID.
**0**: card slot 1.
**1**: card slot 2.| **Return value** @@ -567,12 +740,25 @@ This is a system API. | --------------- | ------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md). + +| ID| Error Message | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **Example** ```js let promise = data.disableCellularDataRoaming(0); -promise.then((data) => { - console.log(`disableCellularDataRoaming success, promise: data->${JSON.stringify(data)}`); +promise.then(() => { + console.log(`disableCellularDataRoaming success.`); }).catch((err) => { console.error(`disableCellularDataRoaming fail, promise: err->${JSON.stringify(err)}`); }); diff --git a/en/application-dev/reference/apis/js-apis-uiappearance.md b/en/application-dev/reference/apis/js-apis-uiappearance.md new file mode 100644 index 0000000000000000000000000000000000000000..3bac964627675b3475e273551d06b146636b410d --- /dev/null +++ b/en/application-dev/reference/apis/js-apis-uiappearance.md @@ -0,0 +1,106 @@ +# UI Appearance + +The **uiAppearance** module provides basic capabilities for managing the system appearance. It allows for color mode configuration currently, and will introduce more features over time. + +> **NOTE** +> +> The APIs of this module are supported since API version 9. Updates will be marked with a superscript to indicate their earliest API version. +> +> The APIs provided by this module are system APIs. + + +## Modules to Import + +```ts +import uiAppearance from '@ohos.uiAppearance' +``` + + +## DarkMode + +Enumerates the color modes. + + +**System capability**: SystemCapability.ArkUI.UiAppearance + +| Name| Value| Description| +| -- | -- | -- | +| ALWAYS_DARK | 0 | The system is always in dark mode. | +| ALWAYS_LIGHT | 1 | The system is always in light mode.| + + +## uiAppearance.setDarkMode + +setDarkMode(mode: DarkMode, callback: AsyncCallback\): void + +Sets the system color mode. This API uses an asynchronous callback to return the result. + +**Permission required**: ohos.permission.UPDATE_CONFIGURATION + +**System capability**: SystemCapability.ArkUI.UiAppearance + +**Parameters** +| Name| Type| Mandatory| Description| +| -- | -- | -- | -- | +| mode | [DarkMode](#darkmode) | Yes| Color mode to set.| +| callback | AsyncCallback\| Yes| Callback used to return the result.| + +**Example** + ```ts +uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK, (err) => { + console.info(`${err}`); +}) + ``` + + +## uiAppearance.setDarkMode + +setDarkMode(mode: DarkMode): Promise\; + +Sets the system color mode. This API uses a promise to return the result. + +**Permission required**: ohos.permission.UPDATE_CONFIGURATION + +**System capability**: SystemCapability.ArkUI.UiAppearance + +**Parameters** +| Name| Type| Mandatory| Description| +| -- | -- | -- | -- | +| mode | [DarkMode](#darkmode) | Yes| Color mode to set.| + +**Return value** + +| Type | Description | +| ------ | ------------------------------ | +| Promise\ | Promise that returns no value.| + +**Example** + ```ts +uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.log('Set dark-mode successfully.'); +}).catch((err) => { + console.log(`Set dark-mode failed, ${err}`); +}); + ``` + + +## uiAppearance.getDarkMode + +getDarkMode(): DarkMode; + +Obtains the system color mode. + +**Permission required**: ohos.permission.UPDATE_CONFIGURATION + +**System capability**: SystemCapability.ArkUI.UiAppearance + +**Return value** +| Type| Description| +| -- | -- | +|[DarkMode](#darkmode) | Color mode obtained.| + +**Example** + ```ts +let darkMode = uiAppearance.getDarkMode(); +console.log(`Get dark-mode ${darkMode}`); + ``` diff --git a/en/application-dev/reference/apis/js-apis-uitest.md b/en/application-dev/reference/apis/js-apis-uitest.md index d738e7b69170bc84f17286594cfd98b3ff908249..d1f1ba4db59b314b345b3f0efc9ec58d6a5fb913 100644 --- a/en/application-dev/reference/apis/js-apis-uitest.md +++ b/en/application-dev/reference/apis/js-apis-uitest.md @@ -1,4 +1,4 @@ -# @ohos.uitest (UiTest) +# @ohos.UiTest The **UiTest** module provides APIs that you can use to simulate UI actions during testing, such as clicks, double-clicks, long-clicks, and swipes. @@ -20,7 +20,7 @@ This module provides the following functions: ## Modules to Import ```js -import {UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix} from '@ohos.uitest'; +import {UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix, UiDirection, MouseButton} from '@ohos.UiTest'; ``` ## MatchPattern @@ -61,8 +61,8 @@ Provides the coordinates of a point. | Name| Type | Readable| Writable| Description | | ---- | ------ | ---- | ---- | ---------------- | -| X | number | Yes | No | X-coordinate of a point.| -| Y | number | Yes | No | Y-coordinate of a point.| +| x | number | Yes | No | X-coordinate of a point.| +| y | number | Yes | No | Y-coordinate of a point.| ## Rect9+ @@ -79,10 +79,10 @@ Provides bounds information of a component. ## WindowMode9+ -**System capability**: SystemCapability.Test.UiTest - Enumerates the window modes. +**System capability**: SystemCapability.Test.UiTest + | Name | Value | Description | | ---------- | ---- | ---------- | | FULLSCREEN | 0 | Full-screen mode.| @@ -92,10 +92,10 @@ Enumerates the window modes. ## DisplayRotation9+ -**System capability**: SystemCapability.Test.UiTest - Describes the display rotation of the device. +**System capability**: SystemCapability.Test.UiTest + | Name | Value | Description | | ------------ | ---- | ---------------------------------------- | | ROTATION_0 | 0 | The device display is not rotated and is in its original vertical orientation. | @@ -116,6 +116,31 @@ Provides the flag attributes of this window. | focused | boolean | Yes | No | Whether the window is in focused state. | | actived | boolean | Yes | No | Whether the window is interacting with the user.| +## UiDirection10+ + +Describes the direction of a UI operation such as fling. + +**System capability**: SystemCapability.Test.UiTest + +| Name | Value | Description | +| ----- | ---- | ------ | +| LEFT | 0 | Leftward.| +| RIGHT | 1 | Rightward.| +| UP | 2 | Upward.| +| DOWN | 3 | Downward.| + +## MouseButton10+ + +Describes the injected simulated mouse button. + +**System capability**: SystemCapability.Test.UiTest + +| Name | Value | Description | +| ------------------- | ---- | ------------ | +| MOUSE_BUTTON_LEFT | 0 | Left button on the mouse. | +| MOUSE_BUTTON_RIGHT | 1 | Right button on the mouse. | +| MOUSE_BUTTON_MIDDLE | 2 | Middle button on the mouse.| + ## On9+ Since API version 9, the UiTest framework provides a wide range of UI component feature description APIs in the **On** class to filter and match components. @@ -420,7 +445,7 @@ let on = ON.checkable(true); // Use the static constructor ON to create an On ob isBefore(on: On): On -Specifies the attributes of the component before which the target component is located. +Specifies that the target component is located before the given attribute component. **System capability**: SystemCapability.Test.UiTest @@ -428,7 +453,7 @@ Specifies the attributes of the component before which the target component is l | Name| Type | Mandatory| Description | | ------ | ---------- | ---- | -------------------- | -| on | [On](#on9) | Yes | Attributes of the component before which the target component is located.| +| on | [On](#on9) | Yes | Information about the attribute component.| **Return value** @@ -439,14 +464,14 @@ Specifies the attributes of the component before which the target component is l **Example** ```js -let on = ON.isBefore(ON.text('123')); // Use the static constructor ON to create an On object and specify the attributes of the component before which the target component is located. +let on = ON.isBefore(ON.text('123')); // Create an On object using the static constructor ON, specifying that the target component is located before the given attribute component. ``` ### isAfter9+ isAfter(on: On): On -Specifies the attributes of the component after which the target component is located. +Specifies that the target component is located after the given attribute component. **System capability**: SystemCapability.Test.UiTest @@ -454,7 +479,7 @@ Specifies the attributes of the component after which the target component is lo | Name| Type | Mandatory| Description | | ------ | ---------- | ---- | -------------------- | -| on | [On](#on9) | Yes | Attributes of the component after which the target component is located.| +| on | [On](#on9) | Yes | Information about the attribute component.| **Return value** @@ -465,7 +490,59 @@ Specifies the attributes of the component after which the target component is lo **Example** ```js -let on = ON.isAfter(ON.text('123')); // Use the static constructor ON to create an On object and specify the attributes of the component after which the target component is located. +let on = ON.isAfter(ON.text('123')); // Create an On object using the static constructor ON, specifying that the target component is located after the given attribute component. +``` + +### within10+ + +within(on: On): On + +Specifies that the target component is located within the given attribute component. + +**System capability**: SystemCapability.Test.UiTest + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ---------- | ---- | -------------------- | +| on | [On](#on9) | Yes | Information about the attribute component.| + +**Return value** + +| Type | Description | +| ---------- | -------------------------------------------------- | +| [On](#on9) | **On** object.| + +**Example** + +```js +let on = ON.within(ON.type('List')); // Create an On object using the static constructor ON, specifying that the target component is located within the given attribute component. +``` + +### inWindow10+ + +inWindow(bundleName: string): On; + +Specifies that the target component is within the given application window. + +**System capability**: SystemCapability.Test.UiTest + +**Parameters** + +| Name | Type | Mandatory| Description | +| ---------- | ------ | ---- | ---------------- | +| bundleName | string | Yes | Bundle name of the application window.| + +**Return value** + +| Type | Description | +| ---------- | ---------------------------------------------- | +| [On](#on9) | **On** object.| + +**Example** + +```js +let on = ON.inWindow(ON.inWindow('com.uitestScene.acts')); // Create an On object using the static constructor ON, specifying that the target component is within the given application window. ``` ## Component9+ @@ -1816,7 +1893,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc ```js async function demo() { let driver = Driver.create(); - await driver.screenCap('/local/tmp/1.png'); + await driver.screenCap('/data/storage/el2/base/cache/1.png'); } ``` @@ -2078,7 +2155,7 @@ Simulates a fling operation on the screen. | from | [Point](#point9) | Yes | Coordinates of the point where the finger touches the screen. | | to | [Point](#point9) | Yes | Coordinates of the point where the finger leaves the screen. | | stepLen | number | Yes | Fling step length, in pixels. | -| speed | number | Yes | Scroll speed, in pixel/s. The value ranges from 200 to 15000. If the set value is not in the range, the default value 600 is used.| +| speed | number | Yes | Fling speed, in pixel/s. The value ranges from 200 to 40000. If the set value is not in the range, the default value 600 is used.| **Error codes** @@ -2093,7 +2170,7 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc ```js async function demo() { let driver = Driver.create(); - await driver.fling({X: 500, Y: 480},{X: 450, Y: 480},5,600); + await driver.fling({x: 500, y: 480},{x: 450, y: 480},5,600); } ``` @@ -2132,16 +2209,186 @@ For details about the error codes, see [UiTest Error Codes](../errorcodes/errorc async function demo() { let driver = Driver.create(); let pointers = PointerMatrix.create(2,3); - pointers.setPoint(0,0,{X:230,Y:480}); - pointers.setPoint(0,1,{X:250,Y:380}); - pointers.setPoint(0,2,{X:270,Y:280}); - pointers.setPoint(1,0,{X:230,Y:680}); - pointers.setPoint(1,1,{X:240,Y:580}); - pointers.setPoint(1,2,{X:250,Y:480}); + pointers.setPoint(0,0,{x:230,y:480}); + pointers.setPoint(0,1,{x:250,y:380}); + pointers.setPoint(0,2,{x:270,y:280}); + pointers.setPoint(1,0,{x:230,y:680}); + pointers.setPoint(1,1,{x:240,y:580}); + pointers.setPoint(1,2,{x:250,y:480}); await driver.injectMultiPointerAction(pointers); } ``` +### fling10+ + +fling(direction: UiDirection, speed: number): Promise; + +Simulates a fling operation on the screen, in the specified direction and speed. + +**System capability**: SystemCapability.Test.UiTest + +**Parameters** + +| Name | Type | Mandatory| Description | +| --------- | ----------------------------- | ---- | ------------------------------------------------------------ | +| direction | [UiDirection](#uidirection10) | Yes | Direction of the fling operation. | +| speed | number | Yes | Fling speed, in pixel/s. The value ranges from 200 to 40000. If the set value is not in the range, the default value 600 is used.| + +**Error codes** + +For details about the error codes, see [UiTest Error Codes](../errorcodes/errorcode-uitest.md). + +| ID| Error Message | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**Example** + +```js +async function demo() { + let driver = Driver.create(); + await driver.fling(UiDirection.DOWN, 10000); +} +``` + +### screenCapture10+ + +screenCapture(savePath: string, rect?: Rect): Promise; + +Captures the specified area of the current screen and saves the captured screenshot as a PNG image to the specified path. + +**System capability**: SystemCapability.Test.UiTest + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | -------------- | ---- | ---------------------- | +| savePath | string | Yes | File save path. | +| rect | [Rect](#rect9) | No | Area of the screen to capture. The default value is the entire screen.| + +**Return value** + +| Type | Description | +| ----------------- | -------------------------------------- | +| Promise\ | Promise used to return the operation result. The value **true** means that the operation is successful.| + +**Error codes** + +For details about the error codes, see [UiTest Error Codes](../errorcodes/errorcode-uitest.md). + +| ID| Error Message | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**Example** + +```js +async function demo() { + let driver = Driver.create(); + await driver.screenCapture('/data/storage/el2/base/cache/1.png', {left: 0, top: 0, right: 100, bottom: 100}); +} +``` + +### mouseClick10+ + +mouseClick(p: Point, btnId: MouseButton, key1?: number, key2?: number): Promise; + +Injects a mouse click at the specified coordinates, with the optional key or key combination. For example, if the value of **key1** is **2072**, the **Ctrl** button is pressed with the mouse click. + +**System capability**: SystemCapability.Test.UiTest + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ----------------------------- | ---- | ------------------- | +| p | [Point](#point9) | Yes | Coordinates of the mouse click. | +| btnId | [MouseButton](#mousebutton10) | Yes | Mouse button pressesd. | +| key1 | number | Yes | The first key value.| +| key2 | number | No | The second key value.| + +**Error codes** + +For details about the error codes, see [UiTest Error Codes](../errorcodes/errorcode-uitest.md). + +| ID| Error Message | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**Example** + +```js +async function demo() { + let driver = Driver.create(); + await driver.mouseClick({x:248, y:194}, MouseButton.MOUSE_BUTTON_LEFT, 2072); +} +``` + +### mouseScroll10+ + +mouseScroll(p: Point, down: boolean, d: number, key1?: number, key2?: number): Promise; + +Injects a mouse scroll action at the specified coordinates, with the optional key or key combination. For example, if the value of **key1** is **2072**, the **Ctrl** button is pressed with mouse scrolling. + +**System capability**: SystemCapability.Test.UiTest + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ---------------- | ---- | --------------------------------------------------- | +| p | [Point](#point9) | Yes | Coordinates of the mouse click. | +| down | boolean | Yes | Whether the scroll wheel slides downward. | +| d | number | Yes | Number of grids by which the scroll wheel slides. Sliding by one grid means a 120-pixel offset of the target point.| +| key1 | number | Yes | The first key value. | +| key2 | number | No | The second key value. | + +**Error codes** + +For details about the error codes, see [UiTest Error Codes](../errorcodes/errorcode-uitest.md). + +| ID| Error Message | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**Example** + +```js +async function demo() { + let driver = Driver.create(); + await driver.mouseScroll({x:360, y:640}, true, 30, 2072) +} +``` + +### mouseMoveTo10+ + +mouseMoveTo(p: Point): Promise; + +Moves the cursor to the target point. + +**System capability**: SystemCapability.Test.UiTest + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ---------------- | ---- | -------------- | +| p | [Point](#point9) | Yes | Coordinates of the target point.| + +**Error codes** + +For details about the error codes, see [UiTest Error Codes](../errorcodes/errorcode-uitest.md). + +| ID| Error Message | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**Example** + +```js +async function demo() { + let driver = Driver.create(); + await driver.mouseMoveTo({x:100, y:100}) +} +``` + ## PointerMatrix9+ Implements a **PointerMatrix** object that stores coordinates and behaviors of each action of each finger in a multi-touch operation. @@ -2196,12 +2443,12 @@ Sets the coordinates for the action corresponding to the specified finger and st ```js async function demo() { let pointers = PointerMatrix.create(2,3); - pointers.setPoint(0,0,{X:230,Y:480}); - pointers.setPoint(0,1,{X:250,Y:380}); - pointers.setPoint(0,2,{X:270,Y:280}); - pointers.setPoint(1,0,{X:230,Y:680}); - pointers.setPoint(1,1,{X:240,Y:580}); - pointers.setPoint(1,2,{X:250,Y:480}); + pointers.setPoint(0,0,{x:230,y:480}); + pointers.setPoint(0,1,{x:250,y:380}); + pointers.setPoint(0,2,{x:270,y:280}); + pointers.setPoint(1,0,{x:230,y:680}); + pointers.setPoint(1,1,{x:240,y:580}); + pointers.setPoint(1,2,{x:250,y:480}); } ``` @@ -2919,7 +3166,7 @@ let by = BY.selected(true); // Use the static constructor BY to create a By obje isBefore(by: By): By -Specifies the attributes of the component before which the target component is located. +Specifies that the target component is located before the given attribute component. This API is deprecated since API version 9. You are advised to use [isBefore9+](#isbefore9). @@ -2929,7 +3176,7 @@ This API is deprecated since API version 9. You are advised to use [isBefore(deprecated) isAfter(by: By): By -Specifies the attributes of the component after which the target component is located. +Specifies the target component is located after the given attribute component. This API is deprecated since API version 9. You are advised to use [isAfter9+](#isafter9). @@ -2957,7 +3204,7 @@ This API is deprecated since API version 9. You are advised to use [isAfter | Name| Type | Mandatory| Description | | ------ | ------------------- | ---- | ---------------- | -| by | [By](#bydeprecated) | Yes | Attributes of the component before which the target component is located.| +| by | [By](#bydeprecated) | Yes | Information about the attribute component.| **Return value** @@ -2968,7 +3215,7 @@ This API is deprecated since API version 9. You are advised to use [isAfter **Example** ```js -let by = BY.isAfter(BY.text('123')); // Use the static constructor BY to create a By object and specify the attributes of the component after which the target component is located. +let by = BY.isAfter(BY.text('123')); // Use the static constructor BY to create a By object, specifying that the target component is located after the given attribute component. ``` ## UiComponent(deprecated) @@ -3673,6 +3920,6 @@ This API is deprecated since API version 9. You are advised to use [screenCap **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 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. ## Modules to Import @@ -2034,7 +2036,7 @@ Enumerates update states. | WAITING_INSTALL | 30 | Waiting for installation. | | UPDATING | 31 | Updating. | | WAITING_APPLY | 40 | Waiting for applying the update. | -| APPLYING | 21 | Applying the update. | +| APPLYING | 41 | Applying the update. | | UPGRADE_SUCCESS | 50 | Update succeeded.| | UPGRADE_FAIL | 51 | Update failed.| @@ -2056,7 +2058,7 @@ Enumerates event IDs. | Name | Value | Description | | ---------------------- | ---------- | ------ | -| EVENT_TASK_BASE | 0x01000000 | Task event. | +| EVENT_TASK_BASE | EventClassify.TASK | Task event. | | EVENT_TASK_RECEIVE | 0x01000001 | Task received. | | EVENT_TASK_CANCEL | 0x01000010 | Task cancelled. | | EVENT_DOWNLOAD_WAIT | 0x01000011 | Waiting for download. | diff --git a/en/application-dev/reference/apis/js-apis-usb-deprecated.md b/en/application-dev/reference/apis/js-apis-usb-deprecated.md index 9e7fe19db49c7863967ba386f63dfdeeef4b12cc..f5c4bc2d05b1ac5e085f573c1730882afc38a03c 100644 --- a/en/application-dev/reference/apis/js-apis-usb-deprecated.md +++ b/en/application-dev/reference/apis/js-apis-usb-deprecated.md @@ -1,11 +1,12 @@ -# @ohos.usb (USB Management) +# @ohos.usb (USB) The **usb** module provides USB device management functions, including USB device list query, bulk data transfer, control transfer, and permission control. -> **NOTE** +> **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. -> This module is deprecated since API version 9. You are advised to use [`@ohos.usbManager`](js-apis-usbManager.md) instead. +> +> The APIs provided by this module are no longer maintained since API version 9. You are advised to use [`@ohos.usbManager`](js-apis-usbManager.md). ## Modules to Import @@ -25,13 +26,13 @@ Obtains the USB device list. | Type | Description | | ---------------------------------------------------- | ------- | -| Array<Readonly<[USBDevice](#usbdevice)>> | Device information list.| +| Array<Readonly<[USBDevice](#usbdevice)>> | USB device list.| **Example** ```js let devicesList = usb.getDevices(); -console.log(`devicesList = ${JSON.stringify(devicesList)}`); +console.log(`devicesList = ${devicesList}`); // devicesList is a list of USB devices. // A simple example of devicesList is provided as follows: [ @@ -110,7 +111,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi ```js let devicepipe= usb.connectDevice(device); -console.log(`devicepipe = ${JSON.stringify(devicepipe)}`); +console.log(`devicepipe = ${devicepipe}`); ``` ## usb.hasRight @@ -131,7 +132,7 @@ Checks whether the application has the permission to access the device. | Type| Description| | -------- | -------- | -| boolean | The value **true** indicates that the application has the permission to access the device, and the value **false** indicates the opposite.| +| boolean | Returns **true** if the application has the permission to access the device; returns **false** otherwise.| **Example** @@ -145,7 +146,7 @@ console.log(bool); requestRight(deviceName: string): Promise<boolean> -Requests the temporary permission for the application to access the USB device. This API uses a promise to return the result. +Requests the temporary permission for the application to access a USB device. This API uses a promise to return the result. **System capability**: SystemCapability.USB.USBManager @@ -159,14 +160,14 @@ Requests the temporary permission for the application to access the USB device. | Type| Description| | -------- | -------- | -| Promise<boolean> | Promise used to return the result. The value **true** indicates that the temporary device access permissions are granted, and the value **false** indicates the opposite.| +| Promise<boolean> | Promise used to return the result. The value **true** indicates that the temporary device access permissions are granted; and the value **false** indicates the opposite.| **Example** ```js let devicesName="1-1"; usb.requestRight(devicesName).then((ret) => { - console.log(`requestRight = ${JSON.stringify(ret)}`); + console.log(`requestRight = ${ret}`); }); ``` @@ -192,7 +193,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi | Type| Description| | -------- | -------- | -| number | The value **0** indicates that the USB interface is successfully claimed, and an error code indicates the opposite.| +| number | Returns **0** if the USB interface is successfully claimed; returns an error code otherwise.| **Example** @@ -222,7 +223,7 @@ Before you do this, ensure that you have claimed the interface by calling [usb.c | Type| Description| | -------- | -------- | -| number | The value **0** indicates that the USB interface is successfully released, and an error code indicates the opposite.| +| number | Returns **0** if the USB interface is successfully released; returns an error code otherwise.| **Example** @@ -252,7 +253,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi | Type| Description| | -------- | -------- | -| number | The value **0** indicates that the USB configuration is successfully set, and an error code indicates the opposite.| +| number | Returns **0** if the USB configuration is successfully set; returns an error code otherwise.| **Example** @@ -282,7 +283,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi | Type| Description| | -------- | -------- | -| number | The value **0** indicates that the USB interface is successfully set, and an error code indicates the opposite.| +| number | Returns **0** if the USB interface is successfully set; returns an error code otherwise.| **Example** @@ -311,7 +312,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi | Type| Description| | -------- | -------- | -| Uint8Array | The return value is the raw USB descriptor if the operation is successful, or **undefined** if the operation has failed.| +| Uint8Array | Returns the raw USB descriptor if the operation is successful; returns **undefined** otherwise.| **Example** @@ -339,7 +340,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi | Type | Description | | ------ | -------------------- | -| number | The return value is the file descriptor of the USB device if the operation is successful, or **-1** if the operation has failed.| +| number | Returns the file descriptor of the USB device if the operation is successful; returns **-1** otherwise.| **Example** @@ -374,8 +375,9 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi **Example** ```js -usb.controlTransfer(devicepipe, USBControlParams).then((ret) => { - console.log(`controlTransfer = ${JSON.stringify(ret)}`); +let param = new usb.USBControlParams(); +usb.controlTransfer(devicepipe, param).then((ret) => { + console.log(`controlTransfer = ${ret}`); }) ``` @@ -411,7 +413,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi // Pass the obtained USB device as a parameter to usb.connectDevice. Then, call usb.connectDevice to connect the USB device. // Call usb.claimInterface to claim the USB interface. After that, call usb.bulkTransfer to start bulk transfer. usb.bulkTransfer(devicepipe, endpoint, buffer).then((ret) => { - console.log(`bulkTransfer = ${JSON.stringify(ret)}`); + console.log(`bulkTransfer = ${ret}`); }); ``` @@ -435,7 +437,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi | Type| Description| | -------- | -------- | -| number | The value **0** indicates that the USB device pipe is closed successfully, and an error code indicates the opposite.| +| number | Returns **0** if the USB device pipe is closed successfully; returns an error code otherwise.| **Example** @@ -498,7 +500,7 @@ Converts the USB function list in the numeric mask format to a string in Device **Example** ```js -let funcs = ACM | ECM; +let funcs = usb.ACM | usb.ECM; let ret = usb.usbFunctionsToString(funcs); ``` @@ -527,7 +529,7 @@ Sets the current USB function list in Device mode. **Example** ```js -let funcs = HDC; +let funcs = usb.HDC; let ret = usb.setCurrentFunctions(funcs); ``` @@ -630,7 +632,12 @@ Sets the role types supported by a specified port, which can be **powerRole** (f **Example** ```js -let ret = usb.getSupportedModes(0); +let portId = 1; +usb.setPortRoles(portId, usb.PowerRoleType.SOURCE, usb.DataRoleType.HOST).then(() => { + console.info('usb setPortRoles successfully.'); +}).catch(err => { + console.error('usb setPortRoles failed: ' + err.code + ' message: ' + err.message); +}); ``` ## USBEndpoint @@ -639,16 +646,16 @@ Represents the USB endpoint from which data is sent or received. You can obtain **System capability**: SystemCapability.USB.USBManager -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| address | number | Yes | Endpoint address. | -| attributes | number | Yes | Endpoint attributes. | -| interval | number | Yes | Endpoint interval. | -| maxPacketSize | number | Yes | Maximum size of data packets on the endpoint. | -| direction | [USBRequestDirection](#usbrequestdirection) | Yes | Endpoint direction. | -| number | number | Yes | Endpoint number. | -| type | number | Yes | Endpoint type. | -| interfaceId | number | Yes | Unique ID of the interface to which the endpoint belongs.| +| Name | Type | Mandatory | Description | +| ------------- | ------------------------------------------- | ------------- |------------ | +| address | number | Yes |Endpoint address. | +| attributes | number | Yes |Endpoint attributes. | +| interval | number | Yes |Endpoint interval. | +| maxPacketSize | number | Yes |Maximum size of data packets on the endpoint. | +| direction | [USBRequestDirection](#usbrequestdirection) | Yes |Endpoint direction. | +| number | number | Yes |Endpoint number. | +| type | number | Yes |Endpoint type. | +| interfaceId | number | Yes |Unique ID of the interface to which the endpoint belongs.| ## USBInterface @@ -656,15 +663,15 @@ Represents a USB interface. One [USBConfig](#usbconfig) can contain multiple **U **System capability**: SystemCapability.USB.USBManager -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| id | number | Yes | Unique ID of the USB interface. | -| protocol | number | Yes | Interface protocol. | -| clazz | number | Yes | Device type. | -| subClass | number | Yes | Device subclass. | -| alternateSetting | number | Yes | Settings for alternating between descriptors of the same USB interface.| -| name | string | Yes | Interface name. | -| endpoints | Array<[USBEndpoint](#usbendpoint)> | Yes | Endpoints that belong to the USB interface. | +| Name | Type | Mandatory |Description | +| ---------------- | ---------------------------------------- | ------------- |--------------------- | +| id | number | Yes |Unique ID of the USB interface. | +| protocol | number | Yes |Interface protocol. | +| clazz | number | Yes |Device type. | +| subClass | number | Yes |Device subclass. | +| alternateSetting | number | Yes |Settings for alternating between descriptors of the same USB interface.| +| name | string | Yes |Interface name. | +| endpoints | Array<[USBEndpoint](#usbendpoint)> | Yes |Endpoints that belong to the USB interface. | ## USBConfig @@ -672,15 +679,15 @@ Represents the USB configuration. One [USBDevice](#usbdevice) can contain multip **System capability**: SystemCapability.USB.USBManager -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| id | number | Yes | Unique ID of the USB configuration. | -| attributes | number | Yes | Configuration attributes. | -| maxPower | number | Yes | Maximum power consumption, in mA. | -| name | string | Yes | Configuration name, which can be left empty. | -| isRemoteWakeup | boolean | Yes | Support for remote wakeup.| -| isSelfPowered | boolean | Yes | Support for independent power supplies.| -| interfaces | Array <[USBInterface](#usbinterface)> | Yes | Supported interface attributes. | +| Name | Type | Mandatory |Description | +| -------------- | ------------------------------------------------ | --------------- |----------- | +| id | number | Yes |Unique ID of the USB configuration. | +| attributes | number | Yes |Configuration attributes. | +| maxPower | number | Yes |Maximum power consumption, in mA. | +| name | string | Yes |Configuration name, which can be left empty. | +| isRemoteWakeup | boolean | Yes |Support for remote wakeup.| +| isSelfPowered | boolean | Yes |Support for independent power supplies.| +| interfaces | Array <[USBInterface](#usbinterface)> | Yes |Supported interface attributes. | ## USBDevice @@ -688,21 +695,21 @@ Represents the USB device information. **System capability**: SystemCapability.USB.USBManager -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| busNum | number | Yes | Bus address. | -| devAddress | number | Yes | Device address. | -| serial | string | Yes | Sequence number. | -| name | string | Yes | Device name. | -| manufacturerName | string | Yes | Device manufacturer. | -| productName | string | Yes | Product name. | -| version | string | Yes | Version number. | -| vendorId | number | Yes | Vendor ID. | -| productId | number | Yes | Product ID. | -| clazz | number | Yes | Device class. | -| subClass | number | Yes | Device subclass. | -| protocol | number | Yes | Device protocol code. | -| configs | Array<[USBConfig](#usbconfig)> | Yes | Device configuration descriptor information.| +| Name | Type | Mandatory |Description | +| ---------------- | ------------------------------------ | ---------- |---------- | +| busNum | number | Yes |Bus address. | +| devAddress | number | Yes |Device address. | +| serial | string | Yes |Sequence number. | +| name | string | Yes |Device name. | +| manufacturerName | string | Yes |Device manufacturer. | +| productName | string | Yes |Product name. | +| version | string | Yes |Version. | +| vendorId | number | Yes |Vendor ID. | +| productId | number | Yes |Product ID. | +| clazz | number | Yes |Device class. | +| subClass | number | Yes |Device subclass. | +| protocol | number | Yes |Device protocol code. | +| configs | Array<[USBConfig](#usbconfig)> | Yes |Device configuration descriptor information.| ## USBDevicePipe @@ -710,10 +717,10 @@ Represents a USB device pipe, which is used to determine a USB device. **System capability**: SystemCapability.USB.USBManager -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| busNum | number | Yes | Bus address.| -| devAddress | number | Yes | Device address.| +| Name | Type | Mandatory |Description | +| ---------- | ------ | ----- |----- | +| busNum | number | Yes |Bus address.| +| devAddress | number | Yes |Device address.| ## USBControlParams @@ -721,14 +728,14 @@ Represents control transfer parameters. **System capability**: SystemCapability.USB.USBManager -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| request | number | Yes | Request type. | -| target | [USBRequestTargetType](#usbrequesttargettype) | Yes | Request target type. | -| reqType | [USBControlRequestType](#usbcontrolrequesttype) | Yes | Control request type. | -| value | number | Yes | Request parameter value. | -| index | number | Yes | Index of the request parameter value.| -| data | Uint8Array | Yes | Buffer for writing or reading data. | +| Name | Type | Mandatory|Description | +| ------- | ----------------------------------------------- | ---------------- |---------------- | +| request | number | Yes |Request type. | +| target | [USBRequestTargetType](#usbrequesttargettype) | Yes |Request target type. | +| reqType | [USBControlRequestType](#usbcontrolrequesttype) | Yes |Control request type. | +| value | number | Yes |Request parameter value. | +| index | number | Yes |Index of the request parameter value.| +| data | Uint8Array | Yes |Buffer for writing or reading data. | ## USBPort9+ @@ -738,11 +745,11 @@ Represents a USB port. **System capability**: SystemCapability.USB.USBManager -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| id | number | Yes | Unique identifier of a USB port. | -| supportedModes | [PortModeType](#portmodetype9) | Yes | Numeric mask combination for the supported mode list.| -| status | [USBPortStatus](#usbportstatus9) | Yes | USB port role. | +| Name | Type | Mandatory|Description | +| -------------- | -------------------------------- | -------------- |----------------------------------- | +| id | number | Yes |Unique identifier of a USB port. | +| supportedModes | [PortModeType](#portmodetype9) | Yes |Numeric mask combination for the supported mode list.| +| status | [USBPortStatus](#usbportstatus9) | Yes |USB port role. | ## USBPortStatus9+ @@ -752,11 +759,11 @@ Enumerates USB port roles. **System capability**: SystemCapability.USB.USBManager -| Name | Type | Mandatory | Description | -| -------- | ------- | --------- | ----------- | -| currentMode | number | Yes | Current USB mode. | -| currentPowerRole | number | Yes | Current power role. | -| currentDataRole | number | Yes | Current data role. | +| Name | Type| Mandatory|Description | +| ---------------- | -------- | ----------- |---------------------- | +| currentMode | number | Yes |Current USB mode. | +| currentPowerRole | number | Yes |Current power role. | +| currentDataRole | number | Yes |Current data role.| ## USBRequestTargetType @@ -841,7 +848,7 @@ Enumerates power role types. | Name | Value | Description | | ------ | ---- | ---------- | -| NONE | 0 | None. | +| NONE | 0 | None | | SOURCE | 1 | External power supply.| | SINK | 2 | Internal power supply.| @@ -855,6 +862,6 @@ Enumerates data role types. | Name | Value | Description | | ------ | ---- | ------------ | -| NONE | 0 | None. | +| NONE | 0 | None | | HOST | 1 | USB host.| | DEVICE | 2 | USB device.| diff --git a/en/application-dev/reference/apis/js-apis-usb.md b/en/application-dev/reference/apis/js-apis-usb.md deleted file mode 100644 index 521fef517823a160e22a17b752fdc62443eeba7a..0000000000000000000000000000000000000000 --- a/en/application-dev/reference/apis/js-apis-usb.md +++ /dev/null @@ -1,949 +0,0 @@ -# @ohos.usbV9 (USB Management) - -The **usb** module provides USB device management functions, including USB device list query, bulk data transfer, control transfer, and permission control on the host side as well as port management, and function switch and query on the device side. - -> **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 - -```js -import usb from "@ohos.usbV9"; -``` - -## usb.getDevices - -getDevices(): Array<Readonly<USBDevice>> - -Obtains the list of USB devices connected to the host. If no device is connected, an empty list is returned. - -**System capability**: SystemCapability.USB.USBManager - -**Return value** - -| Type | Description | -| ---------------------------------------------------- | ------- | -| Array<Readonly<[USBDevice](#usbdevice)>> | USB device list.| - -**Example** - -```js -let devicesList = usb.getDevices(); -console.log(`devicesList = ${JSON.stringify(devicesList)}`); -// devicesList is a list of USB devices. -// A simple example of devicesList is provided as follows: -[ - { - 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 - -connectDevice(device: USBDevice): Readonly<USBDevicePipe> - -Connects to a USB device based on the device list obtained by using **getDevices()**. - -Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list and device information, and then call [usb.requestRight](#usbrequestright) to request the device access permission. - -**System capability**: SystemCapability.USB.USBManager - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| device | [USBDevice](#usbdevice) | Yes| USB device information.| - -**Return value** - -| Type| Description| -| -------- | -------- | -| Readonly<[USBDevicePipe](#usbdevicepipe)> | USB device pipe for data transfer.| - -**Error codes** - -For details about the error codes, see [USB Error Codes](../errorcodes/errorcode-usb.md). - -| ID| Error Message| -| -------- | -------- | -| 14400001 |Permission denied. Need call requestRight to get permission. | - -**Example** - -```js -let devicesList = usb.getDevices(); -if (devicesList.length == 0) { - console.log(`device list is empty`); - return; -} - -let device = devicesList[0]; -usb.requestRight(device.name); -let devicepipe = usb.connectDevice(device); -console.log(`devicepipe = ${JSON.stringify(devicepipe)}`); -``` - -## usb.hasRight - -hasRight(deviceName: string): boolean - -Checks whether the application has the permission to access the device. - -The value **true** is returned if the device access permission is available; the value **false** is returned otherwise. - -**System capability**: SystemCapability.USB.USBManager - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| deviceName | string | Yes| Device name.| - -**Return value** - -| Type| Description| -| -------- | -------- | -| boolean | Returns **true** if the application has the permission to access the device; returns **false** otherwise.| - -**Example** - -```js -let devicesName="1-1"; -let bool = usb.hasRight(devicesName); -console.log(bool); -``` - -## usb.requestRight - -requestRight(deviceName: string): Promise<boolean> - -Requests the temporary permission for the application to access a USB device. This API uses a promise to return the result. - -**System capability**: SystemCapability.USB.USBManager - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| deviceName | string | Yes| Device name.| - -**Return value** - -| Type| Description| -| -------- | -------- | -| Promise<boolean> | Promise used to return the result. The value **true** indicates that the temporary device access permissions are granted; and the value **false** indicates the opposite.| - -**Example** - -```js -let devicesName="1-1"; -usb.requestRight(devicesName).then((ret) => { - console.log(`requestRight = ${JSON.stringify(ret)}`); -}); -``` - -## usb.removeRight - -removeRight(deviceName: string): boolean - -Removes the permission for the application to access a USB device. - -**System capability**: SystemCapability.USB.USBManager - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| deviceName | string | Yes| Device name.| - -**Return value** - -| Type| Description| -| -------- | -------- | -| boolean | Permission removal result. The value **true** indicates that the access permission is removed successfully; and the value **false** indicates the opposite.| - -**Example** - -```js -let devicesName="1-1"; -if (usb.removeRight(devicesName) { - console.log(`Succeed in removing right`); -} -``` - -## usb.addRight - -addRight(bundleName: string, deviceName: string): boolean - -Adds the permission for the application to access a USB device. - -[requestRight](#usbrequestright) triggers a dialog box to request for user authorization, whereas **addRight** adds the access permission directly without displaying a dialog box. - -**System API**: This is a system API. - -**System capability**: SystemCapability.USB.USBManager - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| deviceName | string | Yes| Device name.| -| bundleName | string | Yes| Bundle name of the application.| - -**Return value** - -| Type| Description| -| -------- | -------- | -| boolean | Permission addition result. The value **true** indicates that the access permission is added successfully; and the value **false** indicates the opposite.| - -**Example** - -```js -let devicesName = "1-1"; -let bundleName = "com.example.hello"; -if (usb.addRight(bundleName, devicesName) { - console.log(`Succeed in adding right`); -} -``` - -## usb.claimInterface - -claimInterface(pipe: USBDevicePipe, iface: USBInterface, force ?: boolean): number - -Claims a USB interface. - -Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list and USB interfaces, call [usb.requestRight](#usbrequestright) to request the device access permission, and call [usb.connectDevice](#usbconnectdevice) to obtain **devicepipe** as an input parameter. - -**System capability**: SystemCapability.USB.USBManager - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.| -| iface | [USBInterface](#usbinterface) | Yes| USB interface, which is used to determine the index of the interface to claim.| -| force | boolean | No| Whether to forcibly claim the USB interface. The default value is **false**, indicating not to forcibly claim the USB interface.| - -**Return value** - -| Type| Description| -| -------- | -------- | -| number | Returns **0** if the USB interface is successfully claimed; returns an error code otherwise.| - -**Example** - -```js -let ret = usb.claimInterface(devicepipe, interfaces); -console.log(`claimInterface = ${ret}`); -``` - -## usb.releaseInterface - -releaseInterface(pipe: USBDevicePipe, iface: USBInterface): number - -Releases a USB interface. - -Before you do this, ensure that you have claimed the interface by calling [usb.claimInterface](#usbclaiminterface). - -**System capability**: SystemCapability.USB.USBManager - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.| -| iface | [USBInterface](#usbinterface) | Yes| USB interface, which is used to determine the index of the interface to release.| - -**Return value** - -| Type| Description| -| -------- | -------- | -| number | Returns **0** if the USB interface is successfully released; returns an error code otherwise.| - -**Example** - -```js -let ret = usb.releaseInterface(devicepipe, interfaces); -console.log(`releaseInterface = ${ret}`); -``` - -## usb.setConfiguration - -setConfiguration(pipe: USBDevicePipe, config: USBConfig): number - -Sets the device configuration. - -Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list and device configuration, call [usb.requestRight](#usbrequestright) to request the device access permission, and call [usb.connectDevice](#usbconnectdevice) to obtain **devicepipe** as an input parameter. - -**System capability**: SystemCapability.USB.USBManager - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.| -| config | [USBConfig](#usbconfig) | Yes| USB configuration to set.| - -**Return value** - -| Type| Description| -| -------- | -------- | -| number | Returns **0** if the USB configuration is successfully set; returns an error code otherwise.| - -**Example** - -```js -let ret = usb.setConfiguration(devicepipe, config); -console.log(`setConfiguration = ${ret}`); -``` - -## usb.setInterface - -setInterface(pipe: USBDevicePipe, iface: USBInterface): number - -Sets a USB interface. - -Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list and interfaces, call [usb.requestRight](#usbrequestright) to request the device access permission, call [usb.connectDevice](#usbconnectdevice) to obtain **devicepipe** as an input parameter, and call [usb.claimInterface](#usbclaiminterface) to claim the USB interface. - -**System capability**: SystemCapability.USB.USBManager - -**Parameters** - -| Name | Type | Mandatory | Description | -| ----- | ------------------------------- | --- | ------------- | -| pipe | [USBDevicePipe](#usbdevicepipe) | Yes | Device pipe, which is used to determine the bus number and device address.| -| iface | [USBInterface](#usbinterface) | Yes | USB interface to set. | - -**Return value** - -| Type| Description| -| -------- | -------- | -| number | Returns **0** if the USB interface is successfully set; returns an error code otherwise.| - -**Example** - -```js -let ret = usb.setInterface(devicepipe, interfaces); -console.log(`setInterface = ${ret}`); -``` - -## usb.getRawDescriptor - -getRawDescriptor(pipe: USBDevicePipe): Uint8Array - -Obtains the raw USB descriptor. - -Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list, call [usb.requestRight](#usbrequestright) to request the device access permission, and call [usb.connectDevice](#usbconnectdevice) to obtain **devicepipe** as an input parameter. - -**System capability**: SystemCapability.USB.USBManager - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.| - -**Return value** - -| Type| Description| -| -------- | -------- | -| Uint8Array | Returns the raw USB descriptor if the operation is successful; returns **undefined** otherwise.| - -**Example** - -```js -let ret = usb.getRawDescriptor(devicepipe); -``` - -## usb.getFileDescriptor - -getFileDescriptor(pipe: USBDevicePipe): number - -Obtains the file descriptor. - -Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list, call [usb.requestRight](#usbrequestright) to request the device access permission, and call [usb.connectDevice](#usbconnectdevice) to obtain **devicepipe** as an input parameter. - -**System capability**: SystemCapability.USB.USBManager - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| Device pipe, which is used to determine the bus number and device address.| - -**Return value** - -| Type | Description | -| ------ | -------------------- | -| number | Returns the file descriptor of the USB device if the operation is successful; returns **-1** otherwise.| - -**Example** - -```js -let ret = usb.getFileDescriptor(devicepipe); -``` - -## usb.controlTransfer - -controlTransfer(pipe: USBDevicePipe, controlparam: USBControlParams, timeout ?: number): Promise<number> - -Performs control transfer. - -Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list, call [usb.requestRight](#usbrequestright) to request the device access permission, and call [usb.connectDevice](#usbconnectdevice) to obtain **devicepipe** as an input parameter. - -**System capability**: SystemCapability.USB.USBManager - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe, which is used to determine the USB device.| -| controlparam | [USBControlParams](#usbcontrolparams) | Yes| Control transfer parameters.| -| timeout | number | No| Timeout duration in ms. This parameter is optional. The default value is **0**, indicating no timeout.| - -**Return value** - -| Type| Description| -| -------- | -------- | -| Promise<number> | Promise used to return the result, which is the size of the transmitted or received data block if the transfer is successful, or **-1** if an exception has occurred.| - -**Example** - -```js -usb.controlTransfer(devicepipe, USBControlParams).then((ret) => { - console.log(`controlTransfer = ${JSON.stringify(ret)}`); -}) -``` - -## usb.bulkTransfer - -bulkTransfer(pipe: USBDevicePipe, endpoint: USBEndpoint, buffer: Uint8Array, timeout ?: number): Promise<number> - -Performs bulk transfer. - -Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list and endpoints, call [usb.requestRight](#usbrequestright) to request the device access permission, call [usb.connectDevice](#usbconnectdevice) to obtain **devicepipe** as an input parameter, and call [usb.claimInterface](#usbclaiminterface) to claim the USB interface. - -**System capability**: SystemCapability.USB.USBManager - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe, which is used to determine the USB device.| -| endpoint | [USBEndpoint](#usbendpoint) | Yes| USB endpoint, which is used to determine the USB port for data transfer.| -| buffer | Uint8Array | Yes| Buffer for writing or reading data.| -| timeout | number | No| Timeout duration in ms. This parameter is optional. The default value is **0**, indicating no timeout.| - -**Return value** - -| Type| Description| -| -------- | -------- | -| Promise<number> | Promise used to return the result, which is the size of the transmitted or received data block if the transfer is successful, or **-1** if an exception has occurred.| - -**Example** - -```js -// Call usb.getDevices to obtain a data set. Then, obtain a USB device and its access permission. -// Pass the obtained USB device as a parameter to usb.connectDevice. Then, call usb.connectDevice to connect the USB device. -// Call usb.claimInterface to claim the USB interface. After that, call usb.bulkTransfer to start bulk transfer. -usb.bulkTransfer(devicepipe, endpoint, buffer).then((ret) => { - console.log(`bulkTransfer = ${JSON.stringify(ret)}`); -}); -``` - -## usb.closePipe - -closePipe(pipe: USBDevicePipe): number - -Closes a USB device pipe. - -Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB device list, call [usb.requestRight](#usbrequestright) to request the device access permission, and call [usb.connectDevice](#usbconnectdevice) to obtain **devicepipe** as an input parameter. - -**System capability**: SystemCapability.USB.USBManager - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| pipe | [USBDevicePipe](#usbdevicepipe) | Yes| USB device pipe.| - -**Return value** - -| Type| Description| -| -------- | -------- | -| number | Returns **0** if the USB device pipe is closed successfully; returns an error code otherwise.| - -**Example** - -```js -let ret = usb.closePipe(devicepipe); -console.log(`closePipe = ${ret}`); -``` - -## usb.usbFunctionsFromString - -usbFunctionsFromString(funcs: string): number - -Converts the USB function list in the string format to a numeric mask in Device mode. - -**System API**: This is a system API. - -**System capability**: SystemCapability.USB.USBManager - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | ---------------------- | -| funcs | string | Yes | Function list in string format.| - -**Return value** - -| Type | Description | -| ------ | ------------------ | -| number | Function list in numeric mask format.| - -**Example** - -```js -let funcs = "acm"; -let ret = usb.usbFunctionsFromString(funcs); -``` - -## usb.usbFunctionsToString - -usbFunctionsToString(funcs: FunctionType): string - -Converts the USB function list in the numeric mask format to a string in Device mode. - -**System API**: This is a system API. - -**System capability**: SystemCapability.USB.USBManager - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------------------------------ | ---- | ----------------- | -| funcs | [FunctionType](#functiontype) | Yes | USB function list in numeric mask format.| - -**Return value** - -| Type | Description | -| ------ | ------------------------------ | -| string | Function list in string format.| - -**Example** - -```js -let funcs = ACM | ECM; -let ret = usb.usbFunctionsToString(funcs); -``` - -## usb.setCurrentFunctions - -setCurrentFunctions(funcs: FunctionType): Promise\ - -Sets the current USB function list in Device mode. - -**System API**: This is a system API. - -**System capability**: SystemCapability.USB.USBManager - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------------------------------ | ---- | ----------------- | -| funcs | [FunctionType](#functiontype) | Yes | USB function list in numeric mask format.| - -**Return value** - -| Type | Description | -| ------------------ | ------------------------------------------------------------ | -| Promise\ | Promise used to return the result.| - -**Example** - -```js -let funcs = HDC; -usb.setCurrentFunctions(funcs).then(() => { - console.info('usb setCurrentFunctions successfully.'); -}).catch(err => { - console.error('usb setCurrentFunctions failed: ' + err.code + ' message: ' + err.message); -}); -``` - -## usb.getCurrentFunctions - -getCurrentFunctions(): FunctionType - -Obtains the numeric mask combination for the USB function list in Device mode. - -**System API**: This is a system API. - -**System capability**: SystemCapability.USB.USBManager - -**Return value** - -| Type | Description | -| ------------------------------ | --------------------------------- | -| [FunctionType](#functiontype) | Numeric mask combination for the USB function list.| - -**Example** - -```js -let ret = usb.getCurrentFunctions(); -``` - -## usb.getPorts - -getPorts(): Array\ - -Obtains the list of all physical USB ports. - -**System API**: This is a system API. - -**System capability**: SystemCapability.USB.USBManager - -**Return value** - -| Type | Description | -| ----------------------------- | --------------------- | -| [Array\](#usbport) | List of physical USB ports.| - -**Example** - -```js -let ret = usb.getPorts(); -``` - -## usb.getSupportedModes - -getSupportedModes(portId: number): PortModeType - -Obtains the mask combination for the supported mode list of a given USB port. - -**System API**: This is a system API. - -**System capability**: SystemCapability.USB.USBManager - -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | -------- | -| portId | number | Yes | Port number.| - -**Return value** - -| Type | Description | -| ------------------------------ | -------------------------- | -| [PortModeType](#portmodetype) | Mask combination for the supported mode list.| - -**Example** - -```js -let ret = usb.getSupportedModes(0); -``` - -## usb.setPortRoles - -setPortRoles(portId: number, powerRole: PowerRoleType, dataRole: DataRoleType): Promise\ - -Sets the role types supported by a specified port, which can be **powerRole** (for charging) and **dataRole** (for data transfer). - -**System API**: This is a system API. - -**System capability**: SystemCapability.USB.USBManager - -**Parameters** - -| Name | Type | Mandatory| Description | -| --------- | -------------------------------- | ---- | ---------------- | -| portId | number | Yes | Port number. | -| powerRole | [PowerRoleType](#powerroletype) | Yes | Role for charging. | -| dataRole | [DataRoleType](#dataroletype) | Yes | Role for data transfer.| - -**Return value** - -| Type | Description | -| ------------------ | ------------------------------------------------------------ | -| Promise\ | Promise used to return the result. | - -**Example** - -```js -let portId = 1; -usb.usb.setPortRoles(portId, usb.PowerRoleType.SOURCE, usb.DataRoleType.HOST).then(() => { - console.info('usb setPortRoles successfully.'); -}).catch(err => { - console.error('usb setPortRoles failed: ' + err.code + ' message: ' + err.message); -}); -``` - -## USBEndpoint - -Represents the USB endpoint from which data is sent or received. You can obtain the USB endpoint through [USBInterface](#usbinterface). - -**System capability**: SystemCapability.USB.USBManager - -| Name | Type | Mandatory |Description | -| ------------- | ------------------------------------------- | ------------- |------------- | -| address | number | Yes | Endpoint address. | -| attributes | number | Yes | Endpoint attributes. | -| interval | number | Yes | Endpoint interval. | -| maxPacketSize | number | Yes | Maximum size of data packets on the endpoint. | -| direction | [USBRequestDirection](#usbrequestdirection) | Yes | Endpoint direction. | -| number | number | Yes | Endpoint number. | -| type | number | Yes | Endpoint type. | -| interfaceId | number | Yes | Unique ID of the interface to which the endpoint belongs.| - -## USBInterface - -Represents a USB interface. One [USBConfig](#usbconfig) can contain multiple **USBInterface** instances, each providing a specific function. - -**System capability**: SystemCapability.USB.USBManager - -| Name | Type | Mandatory |Description | -| ---------------- | ---------------------------------------- | ------------- |--------------------- | -| id | number | Yes | Unique ID of the USB interface. | -| protocol | number | Yes | Interface protocol. | -| clazz | number | Yes | Device type. | -| subClass | number | Yes | Device subclass. | -| alternateSetting | number | Yes | Settings for alternating between descriptors of the same USB interface.| -| name | string | Yes | Interface name. | -| endpoints | Array<[USBEndpoint](#usbendpoint)> | Yes | Endpoints that belong to the USB interface. | - -## USBConfig - -Represents the USB configuration. One [USBDevice](#usbdevice) can contain multiple **USBConfig** instances. - -**System capability**: SystemCapability.USB.USBManager - -| Name | Type | Mandatory |Description | -| -------------- | ------------------------------------------------ | --------------- |--------------- | -| id | number | Yes | Unique ID of the USB configuration. | -| attributes | number | Yes | Configuration attributes. | -| maxPower | number | Yes | Maximum power consumption, in mA. | -| name | string | Yes | Configuration name, which can be left empty. | -| isRemoteWakeup | boolean | Yes | Support for remote wakeup.| -| isSelfPowered | boolean | Yes | Support for independent power supplies.| -| interfaces | Array <[USBInterface](#usbinterface)> | Yes | Supported interface attributes. | - -## USBDevice - -Represents the USB device information. - -**System capability**: SystemCapability.USB.USBManager - -| Name | Type | Mandatory |Description | -| ---------------- | ------------------------------------ | ---------- |---------- | -| busNum | number | Yes | Bus address. | -| devAddress | number | Yes | Device address. | -| serial | string | Yes | Sequence number. | -| name | string | Yes | Device name. | -| manufacturerName | string | Yes | Device manufacturer. | -| productName | string | Yes | Product name. | -| version | string | Yes | Version number. | -| vendorId | number | Yes | Vendor ID. | -| productId | number | Yes | Product ID. | -| clazz | number | Yes | Device class. | -| subClass | number | Yes | Device subclass. | -| protocol | number | Yes | Device protocol code. | -| configs | Array<[USBConfig](#usbconfig)> | Yes | Device configuration descriptor information.| - -## USBDevicePipe - -Represents a USB device pipe, which is used to determine a USB device. - -**System capability**: SystemCapability.USB.USBManager - -| Name | Type | Mandatory |Description | -| ---------- | ------ | ----- |----- | -| busNum | number |Yes| Bus address.| -| devAddress | number |Yes| Device address.| - -## USBControlParams - -Represents control transfer parameters. - -**System capability**: SystemCapability.USB.USBManager - -| Name | Type | Mandatory |Description | -| ------- | ----------------------------------------------- | ---------------- |---------------- | -| request | number | Yes | Request type. | -| target | [USBRequestTargetType](#usbrequesttargettype) | Yes | Request target type. | -| reqType | [USBControlRequestType](#usbcontrolrequesttype) | Yes | Control request type. | -| value | number | Yes | Request parameter value. | -| index | number | Yes | Index of the request parameter value.| -| data | Uint8Array | Yes | Buffer for writing or reading data. | - -## USBPort - -Represents a USB port. - -**System API**: This is a system API. - -**System capability**: SystemCapability.USB.USBManager - -| Name | Type | Mandatory |Description | -| -------------- | ------------------------------- | ------------------- |------------------------ | -| id | number | Yes | Unique identifier of a USB port. | -| supportedModes | [PortModeType](#portmodetype) | Yes | Numeric mask combination for the supported mode list.| -| status | [USBPortStatus](#usbportstatus) | Yes | USB port role. | - -## USBPortStatus - -Enumerates USB port roles. - -**System API**: This is a system API. - -**System capability**: SystemCapability.USB.USBManager - -| Name | Type| Mandatory |Description | -| ---------------- | -------- | ---------------- |---------------------- | -| currentMode | number | Yes | Current USB mode. | -| currentPowerRole | number | Yes | Current power role. | -| currentDataRole | number | Yes | Current data role.| - -## USBRequestTargetType - -Enumerates request target types. - -**System capability**: SystemCapability.USB.USBManager - -| Name | Value | Description | -| ---------------------------- | ----- | ----------- | -| USB_REQUEST_TARGET_DEVICE | 0 | Device | -| USB_REQUEST_TARGET_INTERFACE | 1 | Interface | -| USB_REQUEST_TARGET_ENDPOINT | 2 | Endpoint | -| USB_REQUEST_TARGET_OTHER | 3 | Other | - -## USBControlRequestType - -Enumerates control request types. - -**System capability**: SystemCapability.USB.USBManager - -| Name | Value | Description | -| ------------------------- | ---- | ------ | -| USB_REQUEST_TYPE_STANDARD | 0 | Standard| -| USB_REQUEST_TYPE_CLASS | 1 | Class | -| USB_REQUEST_TYPE_VENDOR | 2 | Vendor| - -## USBRequestDirection - -Enumerates request directions. - -**System capability**: SystemCapability.USB.USBManager - -| Name | Value | Description | -| --------------------------- | ---- | ------------------------ | -| USB_REQUEST_DIR_TO_DEVICE | 0 | Request for writing data from the host to the device.| -| USB_REQUEST_DIR_FROM_DEVICE | 0x80 | Request for reading data from the device to the host.| - -## FunctionType - -Enumerates USB device function types. - -**System API**: This is a system API. - -**System capability**: SystemCapability.USB.USBManager - -| Name | Value | Description | -| ------------ | ---- | ---------- | -| NONE | 0 | No function.| -| ACM | 1 | ACM function. | -| ECM | 2 | ECM function. | -| HDC | 4 | HDC function. | -| MTP | 8 | Not supported currently.| -| PTP | 16 | Not supported currently.| -| RNDIS | 32 | Not supported currently.| -| MIDI | 64 | Not supported currently.| -| AUDIO_SOURCE | 128 | Not supported currently.| -| NCM | 256 | Not supported currently.| - -## PortModeType - -Enumerates USB port mode types. - -**System API**: This is a system API. - -**System capability**: SystemCapability.USB.USBManager - -| Name | Value | Description | -| --------- | ---- | ---------------------------------------------------- | -| NONE | 0 | None. | -| UFP | 1 | Upstream facing port, which functions as the sink of power supply. | -| DFP | 2 | Downstream facing port, which functions as the source of power supply. | -| DRP | 3 | Dynamic reconfiguration port (DRP), which can function as the DFP (host) or UFP (device). It is not supported currently.| -| NUM_MODES | 4 | Not supported currently. | - -## PowerRoleType - -Enumerates power role types. - -**System API**: This is a system API. - -**System capability**: SystemCapability.USB.USBManager - -| Name | Value | Description | -| ------ | ---- | ---------- | -| NONE | 0 | None. | -| SOURCE | 1 | External power supply.| -| SINK | 2 | Internal power supply.| - -## DataRoleType - -Enumerates data role types. - -**System API**: This is a system API. - -**System capability**: SystemCapability.USB.USBManager - -| Name | Value | Description | -| ------ | ---- | ------------ | -| NONE | 0 | None. | -| HOST | 1 | USB host.| -| DEVICE | 2 | USB device.| diff --git a/en/application-dev/reference/apis/js-apis-usbManager.md b/en/application-dev/reference/apis/js-apis-usbManager.md index c75ebdeb327ca53b0d355515937046ab897a22fc..211a623cce941537d2d24f8ee3764608721bf6fe 100644 --- a/en/application-dev/reference/apis/js-apis-usbManager.md +++ b/en/application-dev/reference/apis/js-apis-usbManager.md @@ -1,4 +1,4 @@ -# @ohos.usbManager (USB Management) +# @ohos.usbManager (USB Manager) The **usbManager** module provides USB device management functions, including USB device list query, bulk data transfer, control transfer, and permission control on the host side as well as port management, and function switch and query on the device side. @@ -30,7 +30,7 @@ Obtains the list of USB devices connected to the host. If no device is connected ```js let devicesList = usb.getDevices(); -console.log(`devicesList = ${JSON.stringify(devicesList)}`); +console.log(`devicesList = ${devicesList}`); // devicesList is a list of USB devices. // A simple example of devicesList is provided as follows: [ @@ -119,13 +119,12 @@ For details about the error codes, see [USB Error Codes](../errorcodes/errorcode let devicesList = usb.getDevices(); if (devicesList.length == 0) { console.log(`device list is empty`); - return; } let device = devicesList[0]; usb.requestRight(device.name); let devicepipe = usb.connectDevice(device); -console.log(`devicepipe = ${JSON.stringify(devicepipe)}`); +console.log(`devicepipe = ${devicepipe}`); ``` ## usb.hasRight @@ -155,7 +154,7 @@ Checks whether the user, for example, the application or system, has the device ```js let devicesName="1-1"; let bool = usb.hasRight(devicesName); -console.log(bool); +console.log(`${bool}`); ``` ## usb.requestRight @@ -183,7 +182,7 @@ Requests the temporary permission for the application to access a USB device. Th ```js let devicesName="1-1"; usb.requestRight(devicesName).then((ret) => { - console.log(`requestRight = ${JSON.stringify(ret)}`); + console.log(`requestRight = ${ret}`); }); ``` @@ -211,7 +210,7 @@ Removes the permission for the application to access a USB device. ```js let devicesName="1-1"; -if (usb.removeRight(devicesName) { +if usb.removeRight(devicesName) { console.log(`Succeed in removing right`); } ``` @@ -246,7 +245,7 @@ Adds the permission for the application to access a USB device. ```js let devicesName = "1-1"; let bundleName = "com.example.hello"; -if (usb.addRight(bundleName, devicesName) { +if usb.addRight(bundleName, devicesName) { console.log(`Succeed in adding right`); } ``` @@ -455,8 +454,9 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi **Example** ```js -usb.controlTransfer(devicepipe, USBControlParams).then((ret) => { - console.log(`controlTransfer = ${JSON.stringify(ret)}`); +let param = new usb.USBControlParams(); +usb.controlTransfer(devicepipe, param).then((ret) => { + console.log(`controlTransfer = ${ret}`); }) ``` @@ -492,7 +492,7 @@ Before you do this, call [usb.getDevices](#usbgetdevices) to obtain the USB devi // Pass the obtained USB device as a parameter to usb.connectDevice. Then, call usb.connectDevice to connect the USB device. // Call usb.claimInterface to claim the USB interface. After that, call usb.bulkTransfer to start bulk transfer. usb.bulkTransfer(devicepipe, endpoint, buffer).then((ret) => { - console.log(`bulkTransfer = ${JSON.stringify(ret)}`); + console.log(`bulkTransfer = ${ret}`); }); ``` @@ -579,7 +579,7 @@ Converts the USB function list in the numeric mask format to a string in Device **Example** ```js -let funcs = ACM | ECM; +let funcs = usb.ACM | usb.ECM; let ret = usb.usbFunctionsToString(funcs); ``` @@ -608,7 +608,7 @@ Sets the current USB function list in Device mode. **Example** ```js -let funcs = HDC; +let funcs = usb.HDC; usb.setCurrentFunctions(funcs).then(() => { console.info('usb setCurrentFunctions successfully.'); }).catch(err => { @@ -716,7 +716,7 @@ Sets the role types supported by a specified port, which can be **powerRole** (f ```js let portId = 1; -usb.usb.setPortRoles(portId, usb.PowerRoleType.SOURCE, usb.DataRoleType.HOST).then(() => { +usb.setPortRoles(portId, usb.PowerRoleType.SOURCE, usb.DataRoleType.HOST).then(() => { console.info('usb setPortRoles successfully.'); }).catch(err => { console.error('usb setPortRoles failed: ' + err.code + ' message: ' + err.message); diff --git a/en/application-dev/reference/apis/js-apis-useriam-userauth.md b/en/application-dev/reference/apis/js-apis-useriam-userauth.md index f555df967ddc3a5f11d498bae739be54d1ad53ad..188eeedc48db29468c8abaadf088b9c991305bed 100644 --- a/en/application-dev/reference/apis/js-apis-useriam-userauth.md +++ b/en/application-dev/reference/apis/js-apis-useriam-userauth.md @@ -2,7 +2,8 @@ The **userIAM.userAuth** module provides user authentication capabilities in identity authentication scenarios, such as device unlocking, payment, and app login. -> **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,8 +23,8 @@ Defines the authentication result. | ------------ | ---------- | ---- | -------------------- | | result | number | Yes | Authentication result. | | token | Uint8Array | No | Token that has passed the user identity authentication.| -| remainAttempts | number | No | Number of remaining authentication times allowed.| -| lockoutDuration | number | No | Time for which the authentication operation is frozen.| +| remainAttempts | number | No | Number of remaining authentication attempts.| +| lockoutDuration | number | No | Lock duration of the authentication operation, in milliseconds.| ## TipInfo9+ @@ -399,44 +400,6 @@ try { } ``` -## userIAM_userAuth.getVersion9+ - -getVersion(): number - -Obtains the version of this authenticator. - -**Required permissions**: ohos.permission.ACCESS_BIOMETRIC - -**System capability**: SystemCapability.UserIAM.UserAuth.Core - -**Return value** - -| Type | Description | -| ------ | ---------------------- | -| number | Authenticator version obtained.| - -For details about the error codes, see [User Authentication Error Codes](../errorcodes/errorcode-useriam.md). - -**Error codes** - -| ID| Error Message| -| -------- | ------- | -| 201 | Permission verification failed. | -| 12500002 | General operation error. | - -**Example** - -```js -import userIAM_userAuth from '@ohos.userIAM.userAuth'; - -try { - let version = userIAM_userAuth.getVersion(); - console.info("auth version = " + version); -} catch (error) { - console.info("get version failed, error = " + error); -} -``` - ## userIAM_userAuth.getAvailableStatus9+ getAvailableStatus(authType : UserAuthType, authTrustLevel : AuthTrustLevel): void @@ -535,7 +498,7 @@ getVersion() : number Obtains the version of this authenticator. > **NOTE**
-> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [getVersion](#useriam_userauthgetversion9). +> This API is supported since API version 8 and deprecated since API version 9. **Required permissions**: ohos.permission.ACCESS_BIOMETRIC diff --git a/en/application-dev/reference/apis/js-apis-util.md b/en/application-dev/reference/apis/js-apis-util.md index 21ac9df11df7cabdf260edf97fc5fe17f83871b8..16a80bd27e4c9b89397afcaaa83d098fe91eaa10 100755 --- a/en/application-dev/reference/apis/js-apis-util.md +++ b/en/application-dev/reference/apis/js-apis-util.md @@ -26,7 +26,7 @@ Formats the specified values and inserts them into the string by replacing the w | Name | Type | Mandatory| Description | | ------- | -------- | ---- | -------------- | | format | string | Yes | String.| -| ...args | Object[] | No | Values to format. The formatted values will be replaced the wildcard in the string. | +| ...args | Object[] | No | Values to format. The formatted values will replace the wildcard in the string. If this parameter is not set, the first parameter is returned by default.| **Return value** @@ -69,6 +69,20 @@ let result = util.errnoToString(errnum); console.log("result = " + result); ``` +**Some error code and message examples** + +| Error Code| Message | +| ------ | -------------------------------- | +| -1 | operation not permitted | +| -2 | no such file or directory | +| -3 | no such process | +| -4 | interrupted system call | +| -5 | i/o error | +| -11 | resource temporarily unavailable | +| -12 | not enough memory | +| -13 | permission denied | +| -100 | network is down | + ## util.callbackWrapper callbackWrapper(original: Function): (err: Object, value: Object )=>void @@ -92,15 +106,14 @@ Calls back an asynchronous function. In the callback, the first parameter indica **Example** ```js - async function promiseFn() { - return Promise.reject('value'); - } - let err = "type err"; - let cb = util.callbackWrapper(promiseFn); - cb((err, ret) => { - console.log(err); - console.log(ret); - }, err) +async function fn() { + return 'hello world'; +} +let cb = util.callbackWrapper(fn); +cb(1, (err, ret) => { + if (err) throw err; + console.log(ret); +}); ``` ## util.promisify9+ @@ -126,24 +139,30 @@ Processes an asynchronous function and returns a promise. **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); - }) +function fun(num, callback) { + if (typeof num === 'number') { + callback(null, num + 3); + } else { + callback("type err"); + } +} + +const addCall = util.promisify(fun); +(async () => { + try { + let res = await addCall(2); + console.log(res); + } catch (err) { + console.log(err); + } +})(); ``` -## util.randomUUID9+ +## util.generateRandomUUID9+ -randomUUID(entropyCache?: boolean): string +generateRandomUUID(entropyCache?: boolean): string -Uses a secure random number generator to generate a random universally unique identifier (UUID) of RFC 4122 version 4. +Uses a secure random number generator to generate a random universally unique identifier (UUID) of the string type in RFC 4122 version 4. **System capability**: SystemCapability.Utils.Lang @@ -162,17 +181,17 @@ Uses a secure random number generator to generate a random universally unique id **Example** ```js - let uuid = util.randomUUID(true); + let uuid = util.generateRandomUUID(true); console.log("RFC 4122 Version 4 UUID:" + uuid); // Output: // RFC 4122 Version 4 UUID:88368f2a-d5db-47d8-a05f-534fab0a0045 ``` -## util.randomBinaryUUID9+ +## util.generateRandomBinaryUUID9+ -randomBinaryUUID(entropyCache?: boolean): Uint8Array +generateRandomBinaryUUID(entropyCache?: boolean): Uint8Array -Uses a secure random number generator to generate a random binary UUID of RFC 4122 version 4. +Uses a secure random number generator to generate a random UUID of the Uint8Array type in RFC 4122 version 4. **System capability**: SystemCapability.Utils.Lang @@ -191,7 +210,7 @@ Uses a secure random number generator to generate a random binary UUID of RFC 41 **Example** ```js - let uuid = util.randomBinaryUUID(true); + let uuid = util.generateRandomBinaryUUID(true); console.log(JSON.stringify(uuid)); // Output: // 138,188,43,243,62,254,70,119,130,20,235,222,199,164,140,150 @@ -201,7 +220,7 @@ Uses a secure random number generator to generate a random binary UUID of RFC 41 parseUUID(uuid: string): Uint8Array -Parses a UUID from a string, as described in RFC 4122 version 4. +Converts the UUID of the string type generated by **generateRandomUUID** to the UUID of the **Uint8Array** type generated by **generateRandomBinaryUUID**, as described in RFC 4122 version 4. **System capability**: SystemCapability.Utils.Lang @@ -243,7 +262,7 @@ Formats the specified values and inserts them into the string by replacing the w | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | format | string | Yes| String.| -| ...args | Object[] | No| Values to format. The formatted values will be replaced the wildcard in the string.| +| ...args | Object[] | No| Values to format. The formatted values will replace the wildcard in the string. If this parameter is not set, the first parameter is returned by default.| **Return value** @@ -361,8 +380,8 @@ Creates a **TextDecoder** object. It provides the same function as the deprecate **Example** ```js -let textDecoder = new util.TextDecoder() -textDecoder.create('utf-8', { ignoreBOM : true }); +let result = util.TextDecoder.create('utf-8', { ignoreBOM : true }) +let retStr = result.encoding ``` ### decodeWithStream9+ diff --git a/en/application-dev/reference/apis/js-apis-vibrator.md b/en/application-dev/reference/apis/js-apis-vibrator.md index f99f74149b06752ec0d1edf51ba5c46e40e3e43e..383bc980e60cbf460db627124b77facff8555751 100644 --- a/en/application-dev/reference/apis/js-apis-vibrator.md +++ b/en/application-dev/reference/apis/js-apis-vibrator.md @@ -42,6 +42,7 @@ For details about the error codes, see [Vibrator Error Codes](../errorcodes/erro **Example** ```js +import vibrator from '@ohos.vibrator'; try { vibrator.startVibration({ type: 'time', @@ -95,6 +96,7 @@ For details about the error codes, see [Vibrator Error Codes](../errorcodes/erro **Example** ```js +import vibrator from '@ohos.vibrator'; try { vibrator.startVibration({ type: 'time', @@ -132,6 +134,7 @@ Stops vibration in the specified mode. This API uses an asynchronous callback to **Example** ```js +import vibrator from '@ohos.vibrator'; try { // Start vibration at a fixed duration. vibrator.startVibration({ @@ -190,6 +193,7 @@ Stops vibration in the specified mode. This API uses a promise to return the res **Example** ```js +import vibrator from '@ohos.vibrator'; try { // Start vibration at a fixed duration. vibrator.startVibration({ @@ -219,6 +223,213 @@ try { } ``` +## vibrator.stopVibration10+ + +stopVibration(callback: AsyncCallback<void>): void + +Stops vibration in all modes. This API uses an asynchronous callback to return the result. + +**Required permissions**: ohos.permission.VIBRATE + +**System capability**: SystemCapability.Sensors.MiscDevice + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------------------------- | ---- | ------------------------------------------------------------ | +| callback | AsyncCallback<void> | Yes | Callback used to return the result. If the vibration stops, **err** is **undefined**; otherwise, **err** is an error object.| + +**Example** + + ```js +import vibrator from '@ohos.vibrator'; +try { + // Start vibration at a fixed duration. + vibrator.startVibration({ + type: 'time', + duration: 1000, + }, { + id: 0, + usage: 'alarm' + }, (error) => { + if (error) { + console.error('vibrate fail, error.code: ' + error.code + 'error.message: ', + error.message); + return; + } + console.log('Callback returned to indicate a successful vibration.'); + }); +} catch (error) { + console.error('errCode: ' + error.code + ' ,msg: ' + error.message); +} + +try { + // Stop vibration in all modes. + vibrator.stopVibration(function (error) { + if (error) { + console.log('error.code' + error.code + 'error.message' + error.message); + return; + } + console.log('Callback returned to indicate successful.'); + }) +} catch (error) { + console.info('errCode: ' + error.code + ' ,msg: ' + error.message); +} + ``` + +## vibrator.stopVibration10+ + +stopVibration(): Promise<void> + +Stops vibration in all modes. This API uses a promise to return the result. + +**Required permissions**: ohos.permission.VIBRATE + +**System capability**: SystemCapability.Sensors.MiscDevice + +**Return value** + +| Type | Description | +| ------------------- | ------------- | +| Promise<void> | Promise that returns no value.| + +**Example** + + ```js +import vibrator from '@ohos.vibrator'; +try { + // Start vibration at a fixed duration. + vibrator.startVibration({ + type: 'time', + duration: 1000 + }, { + id: 0, + usage: 'alarm' + }).then(() => { + console.log('Promise returned to indicate a successful vibration'); + }, (error) => { + console.error('error.code' + error.code + 'error.message' + error.message); + }); +} catch (error) { + console.error('errCode: ' + error.code + ' ,msg: ' + error.message); +} + +try { + // Stop vibration in all modes. + vibrator.stopVibration().then(() => { + console.log('Promise returned to indicate a successful vibration.'); + }, (error) => { + console.log('error.code' + error.code + 'error.message' + error.message); + }); +} catch (error) { + console.info('errCode: ' + error.code + ' ,msg: ' + error.message); +} + ``` + +## vibrator.isSupportEffect10+ + +isSupportEffect(effectId: string, callback: AsyncCallback<boolean>): void + +Checks whether the passed effect ID is supported. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Sensors.MiscDevice + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------------- | ---- | ------------------------------------------------------ | +| effectId | string | Yes | Vibration effect ID. | +| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. The value **true** means that the passed effect ID is supported, and **false** means the opposite. | + +**Example** + + ```js +import vibrator from '@ohos.vibrator'; +try { + // Check whether 'haptic.clock.timer' is supported. + vibrator.isSupportEffect('haptic.clock.timer', function (err, state) { + if (err) { + console.error('isSupportEffect failed, error:' + JSON.stringify(err)); + return; + } + console.log('The effectId is ' + (state ? 'supported' : 'unsupported')); + if (state) { + try { + vibrator.startVibration({ // To use startVibration, you must configure the ohos.permission.VIBRATE permission. + type: 'preset', + effectId: 'haptic.clock.timer', + count: 1, + }, { + usage: 'unknown' + }, (error) => { + if(error) { + console.error('haptic.clock.timer vibrator error:' + JSON.stringify(error)); + } else { + console.log('haptic.clock.timer vibrator success'); + } + }); + } catch (error) { + console.error('Exception in, error:' + JSON.stringify(error)); + } + } + }) +} catch (error) { + console.error('Exception in, error:' + JSON.stringify(error)); +} + ``` + +## vibrator.isSupportEffect10+ + +isSupportEffect(effectId: string): Promise<boolean> + +Checks whether the passed effect ID is supported. This API uses a promise to return the result. + +**System capability**: SystemCapability.Sensors.MiscDevice + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ------ | ---- | ------------ | +| effectId | string | Yes | Vibration effect ID.| + +**Return value** + +| Type | Description | +| ---------------------- | --------------------------------------------------------- | +| Promise<boolean> | Promise that returns the result. The value **true** means that the passed effect ID is supported, and **false** means the opposite. | + +**Example** + + ```js +import vibrator from '@ohos.vibrator'; +try { + // Check whether 'haptic.clock.timer' is supported. + vibrator.isSupportEffect('haptic.clock.timer').then((state) => { + console.log('The effectId is ' + (state ? 'supported' : 'unsupported')); + if (state) { + try { + vibrator.startVibration({ + type: 'preset', + effectId: 'haptic.clock.timer', + count: 1, + }, { + usage: 'unknown' + }).then(()=>{ + console.log('Promise returned to indicate a successful vibration'); + }).catch((error)=>{ + console.error('Promise returned to indicate a failed vibration:' + JSON.stringify(error)); + }); + } catch (error) { + console.error('exception in, error:' + JSON.stringify(error)); + } + } + }, (error) => { + console.error('isSupportEffect failed, error:' + JSON.stringify(error)); + }) +} catch (error) { + console.error('Exception in, error:' + JSON.stringify(error)); +} + ``` + ## EffectId Describes the preset vibration effect ID. diff --git a/en/application-dev/reference/apis/js-apis-wallpaper.md b/en/application-dev/reference/apis/js-apis-wallpaper.md index e8d51f5b1c24b57ecabb1de9341abdac99200e82..0563c2741b5b71a86cabfb61fee8370bf45e8871 100644 --- a/en/application-dev/reference/apis/js-apis-wallpaper.md +++ b/en/application-dev/reference/apis/js-apis-wallpaper.md @@ -14,7 +14,7 @@ The **wallpaper** module is a system service module in OpenHarmony that provides import wallpaper from '@ohos.wallpaper'; ``` -## WallpaperType +## WallpaperType7+ Enumerates the wallpaper types. @@ -26,10 +26,14 @@ Enumerates the wallpaper types. | WALLPAPER_LOCKSCREEN | 1 |Lock screen wallpaper.| -## RgbaColor +## RgbaColor(deprecated) Defines the RGBA color space for the wallpaper. +> **NOTE** +> +> This API is supported since API version 7 and deprecated since API version 9. + **System capability**: SystemCapability.MiscServices.Wallpaper | Name| Type| Readable| Writable| Description| @@ -48,17 +52,19 @@ Obtains the main color information of the wallpaper of the specified type. **System capability**: SystemCapability.MiscServices.Wallpaper +**System API**: This is a system API. + **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| +| wallpaperType | [WallpaperType](#wallpapertype7) | Yes| Wallpaper type.| **Return value** | Type| Description| | -------- | -------- | -| Array<[RgbaColor](#rgbacolor)> | Promise used to return the main color information of the wallpaper.| +| Array<[RgbaColor](#rgbacolordeprecated)> | Promise used to return the main color information of the wallpaper.| **Example** @@ -71,37 +77,6 @@ try { } ``` -## wallpaper.getIdSync9+ - -getIdSync(wallpaperType: WallpaperType): number - -Obtains the ID of the wallpaper of the specified type. - -**System capability**: SystemCapability.MiscServices.Wallpaper - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| - -**Return value** - -| Type| Description| -| -------- | -------- | -| number | ID of the wallpaper. If this type of wallpaper is configured, a number greater than or equal to **0** is returned. Otherwise, **-1** is returned. The value ranges from -1 to (2^31-1).| - -**Example** - -```js -try { - let id = wallpaper.getIdSync(wallpaper.WallpaperType.WALLPAPER_SYSTEM); - console.log(`success to getIdSync: ${JSON.stringify(id)}`); -} catch (error) { - console.error(`failed to getIdSync because: ${JSON.stringify(error)}`); -} -``` - ## wallpaper.getMinHeightSync9+ getMinHeightSync(): number @@ -110,6 +85,8 @@ Obtains the minimum height of this wallpaper. **System capability**: SystemCapability.MiscServices.Wallpaper +**System API**: This is a system API. + **Return value** | Type| Description| @@ -130,6 +107,8 @@ Obtains the minimum width of this wallpaper. **System capability**: SystemCapability.MiscServices.Wallpaper +**System API**: This is a system API. + **Return value** | Type| Description| @@ -142,46 +121,6 @@ Obtains the minimum width of this wallpaper. let minWidth = wallpaper.getMinWidthSync(); ``` -## wallpaper.isChangeAllowed9+ - -isChangeAllowed(): boolean - -Checks whether to allow the application to change the wallpaper for the current user. - -**System capability**: SystemCapability.MiscServices.Wallpaper - -**Return value** - -| Type| Description| -| -------- | -------- | -| boolean | Whether to allow the application to change the wallpaper for the current user. The value **true** means that the operation is allowed, and **false** means the opposite.| - -**Example** - -```js -let isChangeAllowed = wallpaper.isChangeAllowed(); -``` - -## wallpaper.isUserChangeAllowed9+ - -isUserChangeAllowed(): boolean - -Checks whether the user is allowed to set wallpapers. - -**System capability**: SystemCapability.MiscServices.Wallpaper - -**Return value** - -| Type| Description| -| -------- | -------- | -| boolean | Whether the user is allowed to set wallpapers. The value **true** means that the operation is allowed, and **false** means the opposite.| - -**Example** - -```js -let isUserChangeAllowed = wallpaper.isUserChangeAllowed(); -``` - ## wallpaper.restore9+ restore(wallpaperType: WallpaperType, callback: AsyncCallback<void>): void @@ -192,11 +131,13 @@ Resets the wallpaper of the specified type to the default wallpaper. This API us **System capability**: SystemCapability.MiscServices.Wallpaper +**System API**: This is a system API. + **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| +| wallpaperType | [WallpaperType](#wallpapertype7) | Yes| Wallpaper type.| | callback | AsyncCallback<void> | Yes| Callback used to return the result. If the wallpaper is reset, **err** is **undefined**. Otherwise, **err** is an error object.| **Example** @@ -221,11 +162,13 @@ Resets the wallpaper of the specified type to the default wallpaper. This API us **System capability**: SystemCapability.MiscServices.Wallpaper +**System API**: This is a system API. + **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| +| wallpaperType | [WallpaperType](#wallpapertype7) | Yes| Wallpaper type.| **Return value** @@ -253,12 +196,14 @@ Sets a specified source as the wallpaper of a specified type. This API uses an a **System capability**: SystemCapability.MiscServices.Wallpaper +**System API**: This is a system API. + **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | source | string \| [image.PixelMap](js-apis-image.md#pixelmap7) | Yes| URI of a JPEG or PNG file, or pixel map of a PNG file.| -| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| +| wallpaperType | [WallpaperType](#wallpapertype7) | Yes| Wallpaper type.| | callback | AsyncCallback<void> | Yes| Callback used to return the result. If the wallpaper is set, **err** is **undefined**. Otherwise, **err** is an error object.| **Example** @@ -306,12 +251,14 @@ Sets a specified source as the wallpaper of a specified type. This API uses a pr **System capability**: SystemCapability.MiscServices.Wallpaper +**System API**: This is a system API. + **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | source | string \| [image.PixelMap](js-apis-image.md#pixelmap7) | Yes| URI of a JPEG or PNG file, or pixel map of a PNG file.| -| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| +| wallpaperType | [WallpaperType](#wallpapertype7) | Yes| Wallpaper type.| **Return value** @@ -350,39 +297,6 @@ imageSource.createPixelMap(opts).then((pixelMap) => { }); ``` -## wallpaper.getFileSync9+ - -getFileSync(wallpaperType: WallpaperType): number; - -Obtains the wallpaper of the specified type. - -**Required permissions**: ohos.permission.GET_WALLPAPER - -**System capability**: SystemCapability.MiscServices.Wallpaper - -**Parameters** - -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| - -**Return value** - -| Type| Description| -| -------- | -------- | -| number | Promise used to return the result. If the operation is successful, the file descriptor ID to the wallpaper is returned. Otherwise, error information is returned.| - -**Example** - -```js -try { - let file = wallpaper.getFileSync(wallpaper.WallpaperType.WALLPAPER_SYSTEM); - console.log(`success to getFileSync: ${JSON.stringify(file)}`); -} catch (error) { - console.error(`failed to getFileSync because: ${JSON.stringify(error)}`); -} -``` - ## wallpaper.getImage9+ getImage(wallpaperType: WallpaperType, callback: AsyncCallback<image.PixelMap>): void; @@ -399,7 +313,7 @@ Obtains the pixel map for the wallpaper of the specified type. This API uses an | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| +| wallpaperType | [WallpaperType](#wallpapertype7) | Yes| Wallpaper type.| | callback | AsyncCallback<[image.PixelMap](js-apis-image.md#pixelmap7)> | Yes| Callback used to return the result. If the operation is successful, the pixel map of the wallpaper is returned. Otherwise, error information is returned.| **Example** @@ -431,7 +345,7 @@ Obtains the pixel map for the wallpaper of the specified type. This API uses a p | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| +| wallpaperType | [WallpaperType](#wallpapertype7) | Yes| Wallpaper type.| **Return value** @@ -449,12 +363,16 @@ wallpaper.getImage(wallpaper.WallpaperType.WALLPAPER_SYSTEM).then((data) => { }); ``` -## wallpaper.on('colorChange')9+ +## wallpaper.on('colorChange')(deprecated) on(type: 'colorChange', callback: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void Subscribes to the wallpaper color change event. +> **NOTE** +> +> This API is supported since API version 7 and deprecated since API version 9. + **System capability**: SystemCapability.MiscServices.Wallpaper **Parameters** @@ -462,7 +380,7 @@ Subscribes to the wallpaper color change event. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | string | Yes| Type of the event to subscribe to. The value **'colorChange'** indicates subscribing to the wallpaper color change event.| -| callback | function | Yes| Callback triggered when the wallpaper color changes. The wallpaper type and main colors are returned.
- colors
Main color information of the wallpaper. For details, see [RgbaColor](#rgbacolor).
- wallpaperType
Wallpaper type.| +| callback | function | Yes| Callback triggered when the wallpaper color changes. The wallpaper type and main colors are returned.
- colors
Main color information of the wallpaper. For details, see [RgbaColor](#rgbacolordeprecated).
- wallpaperType
Wallpaper type.| **Example** @@ -477,12 +395,16 @@ try { } ``` -## wallpaper.off('colorChange')9+ +## wallpaper.off('colorChange')(deprecated) off(type: 'colorChange', callback?: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void Unsubscribes from the wallpaper color change event. +> **NOTE** +> +> This API is supported since API version 7 and deprecated since API version 9. + **System capability**: SystemCapability.MiscServices.Wallpaper **Parameters** @@ -490,7 +412,7 @@ Unsubscribes from the wallpaper color change event. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | type | string | Yes| Type of the event to unsubscribe from. The value **'colorChange'** indicates unsubscribing from the wallpaper color change event.| -| callback | function | No| Callback for the wallpaper color change event. If this parameter is not set, this API unsubscribes from all callbacks corresponding to **type**.
- colors
Main color information of the wallpaper. For details, see [RgbaColor](#rgbacolor).
- wallpaperType
Wallpaper type.| +| callback | function | No| Callback for the wallpaper color change event. If this parameter is not set, this API unsubscribes from all callbacks corresponding to **type**.
- colors
Main color information of the wallpaper. For details, see [RgbaColor](#rgbacolordeprecated).
- wallpaperType
Wallpaper type.| **Example** @@ -527,7 +449,7 @@ Obtains the main color information of the wallpaper of the specified type. This > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.getColorsSync9+](#wallpapergetcolorssync9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.Wallpaper @@ -535,8 +457,8 @@ Obtains the main color information of the wallpaper of the specified type. This | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| -| callback | AsyncCallback<Array<[RgbaColor](#rgbacolor)>> | Yes| Callback used to return the main color information of the wallpaper.| +| wallpaperType | [WallpaperType](#wallpapertype7) | Yes| Wallpaper type.| +| callback | AsyncCallback<Array<[RgbaColor](#rgbacolordeprecated)>> | Yes| Callback used to return the main color information of the wallpaper.| **Example** @@ -558,7 +480,7 @@ Obtains the main color information of the wallpaper of the specified type. This > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.getColorsSync9+](#wallpapergetcolorssync9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.Wallpaper @@ -566,13 +488,13 @@ Obtains the main color information of the wallpaper of the specified type. This | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| +| wallpaperType | [WallpaperType](#wallpapertype7) | Yes| Wallpaper type.| **Return value** | Type| Description| | -------- | -------- | -| Promise<Array<[RgbaColor](#rgbacolor)>> | Promise used to return the main color information of the wallpaper.| +| Promise<Array<[RgbaColor](#rgbacolordeprecated)>> | Promise used to return the main color information of the wallpaper.| **Example** @@ -592,7 +514,7 @@ Obtains the ID of the wallpaper of the specified type. This API uses an asynchro > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.getIdSync9+](#wallpapergetidsync9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.Wallpaper @@ -600,7 +522,7 @@ Obtains the ID of the wallpaper of the specified type. This API uses an asynchro | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| +| wallpaperType | [WallpaperType](#wallpapertype7) | Yes| Wallpaper type.| | callback | AsyncCallback<number> | Yes| Callback used to return the wallpaper ID. If the wallpaper of the specified type is configured, a number greater than or equal to **0** is returned. Otherwise, **-1** is returned. The value ranges from -1 to (2^31-1).| **Example** @@ -623,7 +545,7 @@ Obtains the ID of the wallpaper of the specified type. This API uses a promise t > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.getIdSync9+](#wallpapergetidsync9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.Wallpaper @@ -631,7 +553,7 @@ Obtains the ID of the wallpaper of the specified type. This API uses a promise t | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| +| wallpaperType | [WallpaperType](#wallpapertype7) | Yes| Wallpaper type.| **Return value** @@ -657,7 +579,7 @@ Obtains the minimum height of this wallpaper. This API uses an asynchronous call > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.getMinHeightSync9+](#wallpapergetminheightsync9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.Wallpaper @@ -687,7 +609,7 @@ Obtains the minimum height of this wallpaper. This API uses a promise to return > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.getMinHeightSync9+](#wallpapergetminheightsync9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.Wallpaper @@ -715,7 +637,7 @@ Obtains the minimum width of this wallpaper. This API uses an asynchronous callb > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.getMinWidthSync9+](#wallpapergetminwidthsync9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.Wallpaper @@ -745,7 +667,7 @@ Obtains the minimum width of this wallpaper. This API uses a promise to return t > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.getMinWidthSync9+](#wallpapergetminwidthsync9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.Wallpaper @@ -773,7 +695,7 @@ Checks whether to allow the application to change the wallpaper for the current > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.isChangeAllowed9+](#wallpaperischangeallowed9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.Wallpaper @@ -803,7 +725,7 @@ Checks whether to allow the application to change the wallpaper for the current > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.isChangeAllowed9+](#wallpaperischangeallowed9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.Wallpaper @@ -831,7 +753,7 @@ Checks whether the user is allowed to set wallpapers. This API uses an asynchron > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.isUserChangeAllowed9+](#wallpaperisuserchangeallowed9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.Wallpaper @@ -861,7 +783,7 @@ Checks whether the user is allowed to set wallpapers. This API uses a promise to > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.isUserChangeAllowed9+](#wallpaperisuserchangeallowed9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **System capability**: SystemCapability.MiscServices.Wallpaper @@ -889,7 +811,7 @@ Resets the wallpaper of the specified type to the default wallpaper. This API us > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.restore9+](#wallpaperrestore9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **Required permissions**: ohos.permission.SET_WALLPAPER @@ -899,7 +821,7 @@ Resets the wallpaper of the specified type to the default wallpaper. This API us | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| +| wallpaperType | [WallpaperType](#wallpapertype7) | Yes| Wallpaper type.| | callback | AsyncCallback<void> | Yes| Callback used to return the result. If the wallpaper is reset, **err** is **undefined**. Otherwise, **err** is an error object.| **Example** @@ -922,7 +844,7 @@ Resets the wallpaper of the specified type to the default wallpaper. This API us > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.restore9+](#wallpaperrestore9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **Required permissions**: ohos.permission.SET_WALLPAPER @@ -932,7 +854,7 @@ Resets the wallpaper of the specified type to the default wallpaper. This API us | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| +| wallpaperType | [WallpaperType](#wallpapertype7) | Yes| Wallpaper type.| **Return value** @@ -958,7 +880,7 @@ Sets a specified source as the wallpaper of a specified type. This API uses an a > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.setImage9+](#wallpapersetimage9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **Required permissions**: ohos.permission.SET_WALLPAPER @@ -969,7 +891,7 @@ Sets a specified source as the wallpaper of a specified type. This API uses an a | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | source | string \| [image.PixelMap](js-apis-image.md#pixelmap7) | Yes| URI of a JPEG or PNG file, or pixel map of a PNG file.| -| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| +| wallpaperType | [WallpaperType](#wallpapertype7) | Yes| Wallpaper type.| | callback | AsyncCallback<void> | Yes| Callback used to return the result. If the wallpaper is set, **err** is **undefined**. Otherwise, **err** is an error object.| **Example** @@ -1015,7 +937,7 @@ Sets a specified source as the wallpaper of a specified type. This API uses a pr > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.setImage9+](#wallpapersetimage9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **Required permissions**: ohos.permission.SET_WALLPAPER @@ -1026,7 +948,7 @@ Sets a specified source as the wallpaper of a specified type. This API uses a pr | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | source | string \| [image.PixelMap](js-apis-image.md#pixelmap7) | Yes| URI of a JPEG or PNG file, or pixel map of a PNG file.| -| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| +| wallpaperType | [WallpaperType](#wallpapertype7) | Yes| Wallpaper type.| **Return value** @@ -1074,7 +996,7 @@ Obtains the wallpaper of the specified type. This API uses an asynchronous callb > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [wallpaper.getFileSync9+](#wallpapergetfilesync9) instead. +> This API is supported since API version 8 and deprecated since API version 9. **Required permissions**: ohos.permission.GET_WALLPAPER @@ -1084,7 +1006,7 @@ Obtains the wallpaper of the specified type. This API uses an asynchronous callb | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| +| wallpaperType | [WallpaperType](#wallpapertype7) | Yes| Wallpaper type.| | callback | AsyncCallback<number> | Yes| Callback used to return the result. If the operation is successful, the file descriptor ID to the wallpaper is returned. Otherwise, error information is returned.| **Example** @@ -1107,7 +1029,7 @@ Obtains the wallpaper of the specified type. This API uses a promise to return t > **NOTE** > -> This API is supported since API version 8 and deprecated since API version 9. You are advised to use [wallpaper.getFileSync9+](#wallpapergetfilesync9) instead. +> This API is supported since API version 8 and deprecated since API version 9. **Required permissions**: ohos.permission.GET_WALLPAPER @@ -1117,7 +1039,7 @@ Obtains the wallpaper of the specified type. This API uses a promise to return t | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| +| wallpaperType | [WallpaperType](#wallpapertype7) | Yes| Wallpaper type.| **Return value** @@ -1143,7 +1065,7 @@ Obtains the pixel map for the wallpaper of the specified type. This API uses an > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.getImage9+](#wallpapergetimage9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **Required permissions**: ohos.permission.GET_WALLPAPER @@ -1155,7 +1077,7 @@ Obtains the pixel map for the wallpaper of the specified type. This API uses an | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| +| wallpaperType | [WallpaperType](#wallpapertype7) | Yes| Wallpaper type.| | callback | AsyncCallback<image.PixelMap> | Yes| Callback used to return the result. If the operation is successful, the pixel map of the wallpaper is returned. Otherwise, error information is returned.| **Example** @@ -1178,7 +1100,7 @@ Obtains the pixel map for the wallpaper of the specified type. This API uses a p > **NOTE** > -> This API is supported since API version 7 and deprecated since API version 9. You are advised to use [wallpaper.getImage9+](#wallpapergetimage9) instead. +> This API is supported since API version 7 and deprecated since API version 9. **Required permissions**: ohos.permission.GET_WALLPAPER @@ -1190,7 +1112,7 @@ Obtains the pixel map for the wallpaper of the specified type. This API uses a p | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| wallpaperType | [WallpaperType](#wallpapertype) | Yes| Wallpaper type.| +| wallpaperType | [WallpaperType](#wallpapertype7) | Yes| Wallpaper type.| **Return value** diff --git a/en/application-dev/reference/apis/js-apis-wantAgent.md b/en/application-dev/reference/apis/js-apis-wantAgent.md index dca4d71f55fded097f6d9521b97540bf5eefd433..e0dfa6e3448d5e723fc92feaaf47bf09837d9777 100644 --- a/en/application-dev/reference/apis/js-apis-wantAgent.md +++ b/en/application-dev/reference/apis/js-apis-wantAgent.md @@ -12,6 +12,145 @@ The **WantAgent** module provides APIs for creating and comparing **WantAgent** import WantAgent from '@ohos.wantAgent'; ``` +## WantAgent.getWant + +getWant(agent: WantAgent, callback: AsyncCallback\): void + +Obtains the Want in a **WantAgent** object. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | -------------------------- | ---- | ----------------------- | +| agent | [WantAgent](js-apis-wantAgent.md) | Yes | **WantAgent** object. | +| callback | AsyncCallback\ | Yes | Callback used to return the Want.| + +**Example** + +```ts +import WantAgent from '@ohos.wantAgent'; + + +// WantAgent object +let wantAgent; + +// getWantAgent callback +function getWantAgentCallback(err, data) { + console.info('==========================>getWantAgentCallback=======================>'); + if (err.code == 0) { + wantAgent = data; + } else { + console.error('getWantAgent failed, error: ' + JSON.stringify(err)); + return; + } + + // getWant callback + function getWantCallback(err, data) { + console.info('==========================>getWantCallback=======================>'); + } + WantAgent.getWant(wantAgent, getWantCallback); +} +// WantAgentInfo object +let wantAgentInfo = { + wants: [ + { + deviceId: 'deviceId', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.EntryAbility', + action: 'action1', + entities: ['entity1'], + type: 'MIMETYPE', + uri: 'key={true,true,false}', + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: '[1, 2, 3]', + mykey3: 'ssssssssssssssssssssssssss', + mykey4: [false, true, false], + mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], + mykey6: true, + } + } + ], + operationType: WantAgent.OperationType.START_ABILITIES, + requestCode: 0, + wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] +}; + +WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); +``` + +## WantAgent.getWant + +getWant(agent: WantAgent): Promise\ + +Obtains the Want in a **WantAgent** object. This API uses a promise to return the result. + +**System capability**: SystemCapability.Ability.AbilityRuntime.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ---- | ------------- | ---- | ------------- | +| agent | [WantAgent](js-apis-wantAgent.md) | Yes | **WantAgent** object.| + +**Return value** + +| Type | Description | +| ----------------------------------------------------------- | ------------------------------------------------------------ | +| Promise\ | Promise used to return the Want.| + +**Example** + +```ts +import WantAgent from '@ohos.wantAgent'; + + +// WantAgent object +let wantAgent; + +// WantAgentInfo object +let wantAgentInfo = { + wants: [ + { + deviceId: 'deviceId', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.EntryAbility', + action: 'action1', + entities: ['entity1'], + type: 'MIMETYPE', + uri: 'key={true,true,false}', + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: '[1, 2, 3]', + mykey3: 'ssssssssssssssssssssssssss', + mykey4: [false, true, false], + mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], + mykey6: true, + } + } + ], + operationType: WantAgent.OperationType.START_ABILITIES, + requestCode: 0, + wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] +} + +WantAgent.getWantAgent(wantAgentInfo).then((data) => { + console.info('==========================>getWantAgentCallback=======================>'); + wantAgent = data; + if (wantAgent) { + WantAgent.getWant(wantAgent).then((data) => { + console.info('==========================>getWantCallback=======================>'); + }); + } +}); +``` + ## WantAgent.getWantAgent getWantAgent(info: WantAgentInfo, callback: AsyncCallback\): void @@ -786,135 +925,6 @@ WantAgent.equal(wantAgent1, wantAgent2).then((data) => { }); ``` -## WantAgent.getOperationType9+ - -getOperationType(agent: WantAgent, callback: AsyncCallback\): void; - -Obtains the operation type of a **WantAgent** object. This API uses an asynchronous callback to return the result. - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| ---------- | ------------------------ | ---- | --------------------------------------- | -| agent | WantAgent | Yes | Target **WantAgent** object. | -| callback | AsyncCallback\ | Yes | Callback used to return the operation type.| - -**Example** - -```ts -import WantAgent from '@ohos.wantAgent'; - -// WantAgent object -let wantAgent; - -// WantAgentInfo object -let wantAgentInfo = { - wants: [ - { - deviceId: 'deviceId', - bundleName: 'com.neu.setResultOnAbilityResultTest1', - abilityName: 'com.example.test.EntryAbility', - action: 'action1', - entities: ['entity1'], - type: 'MIMETYPE', - uri: 'key={true,true,false}', - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: '[1, 2, 3]', - mykey3: 'ssssssssssssssssssssssssss', - mykey4: [false, true, false], - mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], - mykey6: true, - } - } - ], - operationType: WantAgent.OperationType.START_ABILITIES, - requestCode: 0, - wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] -} - -WantAgent.getWantAgent(wantAgentInfo).then((data) => { - console.info('==========================>getWantAgentCallback=======================>'); - wantAgent = data; - if (data) { - WantAgent.getOperationType(wantAgent, (OperationType) => { - console.log('----------- getOperationType ----------, OperationType: ' + OperationType); - }) - } -}); -``` - -## WantAgent.getOperationType9+ - -getOperationType(agent: WantAgent): Promise\; - -Obtains the operation type of a **WantAgent** object. This API uses a promise to return the result. - -**System capability**: SystemCapability.Ability.AbilityRuntime.Core - -**Parameters** - -| Name | Type | Mandatory| Description | -| ---------- | --------- | ---- | ------------- | -| agent | WantAgent | Yes | Target **WantAgent** object.| - -**Return value** - -| Type | Description | -| ----------------------------------------------------------- | ------------------------------------------------------------ | -| Promise\ | Promise used to return the operation type.| - -**Example** - -```ts -import WantAgent from '@ohos.wantAgent'; - -// WantAgent object -let wantAgent; - -// WantAgentInfo object -let wantAgentInfo = { - wants: [ - { - deviceId: 'deviceId', - bundleName: 'com.neu.setResultOnAbilityResultTest1', - abilityName: 'com.example.test.EntryAbility', - action: 'action1', - entities: ['entity1'], - type: 'MIMETYPE', - uri: 'key={true,true,false}', - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: '[1, 2, 3]', - mykey3: 'ssssssssssssssssssssssssss', - mykey4: [false, true, false], - mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], - mykey6: true, - } - } - ], - operationType: WantAgent.OperationType.START_ABILITIES, - requestCode: 0, - wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] -} - -WantAgent.getWantAgent(wantAgentInfo).then((data) => { - console.info('==========================>getWantAgentCallback=======================>'); - wantAgent = data; - WantAgent.getOperationType(wantAgent).then((OperationType) => { - console.log('getOperationType success, OperationType: ' + OperationType); - }).catch((err) => { - console.log('getOperationType fail, err: ' + err); - }) -}); -``` - ## WantAgentFlags **System capability**: SystemCapability.Ability.AbilityRuntime.Core diff --git a/en/application-dev/reference/apis/js-apis-webSocket.md b/en/application-dev/reference/apis/js-apis-webSocket.md index 2b2fa3af70da2fd1725ef0221b8fd7cf5654f531..bd7a55c09324684d80e787174483fcc8aefd884e 100644 --- a/en/application-dev/reference/apis/js-apis-webSocket.md +++ b/en/application-dev/reference/apis/js-apis-webSocket.md @@ -1,10 +1,9 @@ -# @ohos.net.webSocket (WebSocket Connection) +# # @ohos.net.webSocket (WebSocket Connection) -The **webSocket** module implements WebSocket connection management and operation. - -> **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. + You can use WebSocket to establish a bidirectional connection between a server and a client. Before doing this, you need to use the [createWebSocket](#websocketcreatewebsocket) API to create a [WebSocket](#websocket) object and then use the [connect](#connect) API to connect to the server. If the connection is successful, the client will receive a callback of the [open](#onopen) event. Then, the client can communicate with the server using the [send](#send) API. When the server sends a message to the client, the client will receive a callback of the [message](#onmessage) event. If the client no longer needs this connection, it can call the [close](#close) API to disconnect from the server. Then, the client will receive a callback of the [close](#onclose) event. @@ -17,7 +16,7 @@ If an error occurs in any of the preceding processes, the client will receive a import webSocket from '@ohos.net.webSocket'; ``` -## Complete Example +## Examples ```js import webSocket from '@ohos.net.webSocket'; @@ -37,7 +36,7 @@ ws.on('open', (err, value) => { }); ws.on('message', (err, value) => { console.log("on message, message:" + value); - // When receiving the bye message (the actual message name may differ) from the server, the client proactively disconnects from the server. + // When receiving the `bye` message (the actual message name may differ) from the server, the client proactively disconnects from the server. if (value === 'bye') { ws.close((err, value) => { if (!err) { @@ -49,7 +48,7 @@ ws.on('message', (err, value) => { } }); ws.on('close', (err, value) => { - console.log("on close, code is " + value['code'] + ", reason is " + value['reason']); + console.log("on close, code is " + value.code + ", reason is " + value.reason); }); ws.on('error', (err) => { console.log("on error, error:" + JSON.stringify(err)); @@ -65,13 +64,13 @@ ws.connect(defaultIpAddress, (err, value) => { ## webSocket.createWebSocket -createWebSocket\(\): WebSocket +createWebSocket(): WebSocket Creates a WebSocket connection. You can use this API to create or close a WebSocket connection, send data over it, or enable or disable listening for the **open**, **close**, **message**, and **error** events. **System capability**: SystemCapability.Communication.NetStack -**Return Value** +**Return value** | Type | Description | | :---------------------------------- | :----------------------------------------------------------- | @@ -90,11 +89,11 @@ Defines a **WebSocket** object. Before invoking WebSocket APIs, you need to call ### connect -connect\(url: string, callback: AsyncCallback\): void +connect(url: string, callback: AsyncCallback\): void Initiates a WebSocket request to establish a WebSocket connection to a given URL. This API uses an asynchronous callback to return the result. -**Required permission**: ohos.permission.INTERNET +**Required permissions**: ohos.permission.INTERNET **System capability**: SystemCapability.Communication.NetStack @@ -105,6 +104,12 @@ Initiates a WebSocket request to establish a WebSocket connection to a given URL | url | string | Yes | URL for establishing a WebSocket connection.| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | **Example** @@ -123,11 +128,11 @@ ws.connect(url, (err, value) => { ### connect -connect\(url: string, options: WebSocketRequestOptions, callback: AsyncCallback\): void +connect(url: string, options: WebSocketRequestOptions, callback: AsyncCallback\): void Initiates a WebSocket request carrying specified options to establish a WebSocket connection to a given URL. This API uses an asynchronous callback to return the result. -**Required permission**: ohos.permission.INTERNET +**Required permissions**: ohos.permission.INTERNET **System capability**: SystemCapability.Communication.NetStack @@ -139,6 +144,12 @@ Initiates a WebSocket request carrying specified options to establish a WebSocke | options | WebSocketRequestOptions | Yes | Request options. For details, see [WebSocketRequestOptions](#websocketrequestoptions).| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | **Example** @@ -162,11 +173,11 @@ ws.connect(url, { ### connect -connect\(url: string, options?: WebSocketRequestOptions\): Promise +connect(url: string, options?: WebSocketRequestOptions): Promise\ Initiates a WebSocket request carrying specified options to establish a WebSocket connection to a given URL. This API uses a promise to return the result. -**Required permission**: ohos.permission.INTERNET +**Required permissions**: ohos.permission.INTERNET **System capability**: SystemCapability.Communication.NetStack @@ -177,12 +188,19 @@ Initiates a WebSocket request carrying specified options to establish a WebSocke | url | string | Yes | URL for establishing a WebSocket connection. | | options | WebSocketRequestOptions | No | Request options. For details, see [WebSocketRequestOptions](#websocketrequestoptions).| -**Return Value** +**Return value** | Type | Description | | :----------------- | :-------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **Example** ```js @@ -199,11 +217,11 @@ promise.then((value) => { ### send -send\(data: string | ArrayBuffer, callback: AsyncCallback\): void +send(data: string | ArrayBuffer, callback: AsyncCallback\): void Sends data through a WebSocket connection. This API uses an asynchronous callback to return the result. -**Required permission**: ohos.permission.INTERNET +**Required permissions**: ohos.permission.INTERNET **System capability**: SystemCapability.Communication.NetStack @@ -211,9 +229,16 @@ Sends data through a WebSocket connection. This API uses an asynchronous callbac | Name | Type | Mandatory| Description | | -------- | ------------------------ | ---- | ------------ | -| data | string \| ArrayBuffer 8+ | Yes | Data to send.| +| data | string \| ArrayBuffer | Yes | Data to send.
Only the string type is supported for API version 6 or earlier. Both the string and ArrayBuffer types are supported for API version 8 or later.| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **Example** ```js @@ -233,11 +258,11 @@ ws.connect(url, (err, value) => { ### send -send\(data: string | ArrayBuffer\): Promise +send(data: string | ArrayBuffer): Promise\ Sends data through a WebSocket connection. This API uses a promise to return the result. -**Required permission**: ohos.permission.INTERNET +**Required permissions**: ohos.permission.INTERNET **System capability**: SystemCapability.Communication.NetStack @@ -245,14 +270,21 @@ Sends data through a WebSocket connection. This API uses a promise to return the | Name| Type | Mandatory| Description | | ------ | ------ | ---- | ------------ | -| data | string \| ArrayBuffer 8+ | Yes | Data to send.| +| data | string \| ArrayBuffer | Yes | Data to send.
Only the string type is supported for API version 6 or earlier. Both the string and ArrayBuffer types are supported for API version 8 or later.| -**Return Value** +**Return value** | Type | Description | | :----------------- | :-------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **Example** ```js @@ -271,11 +303,11 @@ ws.connect(url, (err, value) => { ### close -close\(callback: AsyncCallback\): void +close(callback: AsyncCallback\): void Closes a WebSocket connection. This API uses an asynchronous callback to return the result. -**Required permission**: ohos.permission.INTERNET +**Required permissions**: ohos.permission.INTERNET **System capability**: SystemCapability.Communication.NetStack @@ -285,6 +317,13 @@ Closes a WebSocket connection. This API uses an asynchronous callback to return | -------- | ------------------------ | ---- | ---------- | | callback | AsyncCallback\ | Yes | Callback used to return the result.| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **Example** ```js @@ -302,11 +341,11 @@ ws.close((err, value) => { ### close -close\(options: WebSocketCloseOptions, callback: AsyncCallback\): void +close(options: WebSocketCloseOptions, callback: AsyncCallback\): void Closes a WebSocket connection carrying specified options such as **code** and **reason**. This API uses an asynchronous callback to return the result. -**Required permission**: ohos.permission.INTERNET +**Required permissions**: ohos.permission.INTERNET **System capability**: SystemCapability.Communication.NetStack @@ -317,6 +356,13 @@ Closes a WebSocket connection carrying specified options such as **code** and ** | options | WebSocketCloseOptions | Yes | Request options. For details, see [WebSocketCloseOptions](#websocketcloseoptions).| | callback | AsyncCallback\ | Yes | Callback used to return the result. | +**Error codes** + +| ID| Error Message | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **Example** ```js @@ -337,11 +383,11 @@ ws.close({ ### close -close\(options?: WebSocketCloseOptions\): Promise +close(options?: WebSocketCloseOptions): Promise\ Closes a WebSocket connection carrying specified options such as **code** and **reason**. This API uses a promise to return the result. -**Required permission**: ohos.permission.INTERNET +**Required permissions**: ohos.permission.INTERNET **System capability**: SystemCapability.Communication.NetStack @@ -351,12 +397,19 @@ Closes a WebSocket connection carrying specified options such as **code** and ** | ------- | --------------------- | ---- | ----------------------------------------------------- | | options | WebSocketCloseOptions | No | Request options. For details, see [WebSocketCloseOptions](#websocketcloseoptions).| -**Return Value** +**Return value** | Type | Description | | :----------------- | :-------------------------------- | | Promise\ | Promise used to return the result.| +**Error codes** + +| ID| Error Message | +| ------- | ----------------------- | +| 401 | Parameter error. | +| 201 | Permission denied. | + **Example** ```js @@ -374,9 +427,9 @@ promise.then((value) => { ``` -### on\('open'\) +### on('open') -on\(type: 'open', callback: AsyncCallback\): void +on(type: 'open', callback: AsyncCallback\): void Enables listening for the **open** events of a WebSocket connection. This API uses an asynchronous callback to return the result. @@ -400,13 +453,13 @@ ws.on('open', (err, value) => { ``` -### off\('open'\) +### off('open') -off\(type: 'open', callback?: AsyncCallback\): void +off(type: 'open', callback?: AsyncCallback\): void Disables listening for the **open** events of a WebSocket connection. This API uses an asynchronous callback to return the result. ->![](public_sys-resources/icon-note.gif) **NOTE:** +>**NOTE** >You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events. **System capability**: SystemCapability.Communication.NetStack @@ -431,14 +484,14 @@ ws.off('open', callback1); ``` -### on\('message'\) +### on('message') -on\(type: 'message', callback: AsyncCallback\): void +on(type: 'message', callback: AsyncCallback\): void Enables listening for the **message** events of a WebSocket connection. This API uses an asynchronous callback to return the result. The maximum length of each message is 4 KB. If the length exceeds 4 KB, the message is automatically fragmented. ->![](public_sys-resources/icon-note.gif) **NOTE:** ->The data in **AsyncCallback** can be in the format of string\(API 6\) or ArrayBuffer\(API 8\). +>**NOTE** +>The data in **AsyncCallback** can be in the format of string (API version 6) or ArrayBuffer (API version 8). **System capability**: SystemCapability.Communication.NetStack @@ -449,7 +502,6 @@ Enables listening for the **message** events of a WebSocket connection. This API | type | string | Yes | Event type.
**message**: event indicating that a message has been received from the server.| | callback | AsyncCallback\8+
\> | Yes | Callback used to return the result. | - **Example** ```js @@ -460,14 +512,14 @@ ws.on('message', (err, value) => { ``` -### off\('message'\) +### off('message') -off\(type: 'message', callback?: AsyncCallback\): void +off(type: 'message', callback?: AsyncCallback\): void Disables listening for the **message** events of a WebSocket connection. This API uses an asynchronous callback to return the result. The maximum length of each message is 4 KB. If the length exceeds 4 KB, the message is automatically fragmented. ->![](public_sys-resources/icon-note.gif) **NOTE:** ->The data in **AsyncCallback** can be in the format of string\(API 6\) or ArrayBuffer\(API 8\). +>**NOTE** +>The data in **AsyncCallback** can be in the format of string (API version 6) or ArrayBuffer (API version 8). >You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events. **System capability**: SystemCapability.Communication.NetStack @@ -487,9 +539,9 @@ ws.off('message'); ``` -### on\('close'\) +### on('close') -on\(type: 'close', callback: AsyncCallback<\{ code: number, reason: string \}\>\): void +on(type: 'close', callback: AsyncCallback\<{ code: number, reason: string }\>): void Enables listening for the **close** events of a WebSocket connection. This API uses an asynchronous callback to return the result. @@ -500,25 +552,25 @@ Enables listening for the **close** events of a WebSocket connection. This API u | Name | Type | Mandatory| Description | | -------- | ----------------------------------------------- | ---- | ------------------------------ | | type | string | Yes | Event type.
**close**: event indicating that a WebSocket connection has been closed.| -| callback | AsyncCallback<{ code: number, reason: string }> | Yes | Callback used to return the result. | +| callback | AsyncCallback\<{ code: number, reason: string }\> | Yes | Callback used to return the result.
**close** indicates the close error code and **reason** indicates the error code description.| **Example** ```js let ws = webSocket.createWebSocket(); ws.on('close', (err, value) => { - console.log("on close, code is " + value['code'] + ", reason is " + value['reason']); + console.log("on close, code is " + value.code + ", reason is " + value.reason); }); ``` -### off\('close'\) +### off('close') -off\(type: 'close', callback?: AsyncCallback<\{ code: number, reason: string \}\>\): void +off(type: 'close', callback?: AsyncCallback\<{ code: number, reason: string }\>): void Disables listening for the **close** events of a WebSocket connection. This API uses an asynchronous callback to return the result. ->![](public_sys-resources/icon-note.gif) **NOTE:** +>**NOTE** >You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events. **System capability**: SystemCapability.Communication.NetStack @@ -528,8 +580,7 @@ Disables listening for the **close** events of a WebSocket connection. This API | Name | Type | Mandatory| Description | | -------- | ----------------------------------------------- | ---- | ------------------------------ | | type | string | Yes | Event type.
**close**: event indicating that a WebSocket connection has been closed.| -| callback | AsyncCallback<{ code: number, reason: string }> | No | Callback used to return the result. | - +| callback | AsyncCallback\<{ code: number, reason: string }\> | No | Callback used to return the result.
**close** indicates the close error code and **reason** indicates the error code description.| **Example** @@ -539,9 +590,9 @@ ws.off('close'); ``` -### on\('error'\) +### on('error') -on\(type: 'error', callback: ErrorCallback\): void +on(type: 'error', callback: ErrorCallback): void Enables listening for the **error** events of a WebSocket connection. This API uses an asynchronous callback to return the result. @@ -554,7 +605,6 @@ Enables listening for the **error** events of a WebSocket connection. This API u | type | string | Yes | Event type.
**error**: event indicating the WebSocket connection has encountered an error.| | callback | ErrorCallback | Yes | Callback used to return the result. | - **Example** ```js @@ -565,13 +615,13 @@ ws.on('error', (err) => { ``` -### off\('error'\) +### off('error') -off\(type: 'error', callback?: ErrorCallback\): void +off(type: 'error', callback?: ErrorCallback): void Disables listening for the **error** events of a WebSocket connection. This API uses an asynchronous callback to return the result. ->![](public_sys-resources/icon-note.gif) **NOTE:** +>**NOTE** >You can pass the callback of the **on** function if you want to cancel listening for a certain type of event. If you do not pass the callback, you will cancel listening for all events. **System capability**: SystemCapability.Communication.NetStack @@ -621,8 +671,8 @@ You can customize the result codes sent to the server. The result codes in the f | Value | Description | | :-------- | :----------------- | -| 1000 | Normally closed | -| 1001 | Connection closed by the server | -| 1002 | Incorrect protocol | -| 1003 | Data unable to be processed| -| 1004~1015 | Reserved | +| 1000 | Normally closed. | +| 1001 | Connection closed by the server. | +| 1002 | Incorrect protocol. | +| 1003 | Data unable to be processed.| +| 1004~1015 | Reserved. | diff --git a/en/application-dev/reference/apis/js-apis-webview.md b/en/application-dev/reference/apis/js-apis-webview.md index 13e7a03a329495c89a64b8f21f08891aa23f4858..503e6c262bfb56825687d109ce670321ab4d015a 100644 --- a/en/application-dev/reference/apis/js-apis-webview.md +++ b/en/application-dev/reference/apis/js-apis-webview.md @@ -2,7 +2,7 @@ # @ohos.web.webview (Webview) -The **Webview** module provides APIs for web control. +The **Webview** module provides APIs for web control. It can be used with the **[](../arkui-ts/ts-basic-components-web.md)** component, which can be used to display web pages. > **NOTE** > @@ -20,7 +20,7 @@ The **Webview** module provides APIs for web control. import web_webview from '@ohos.web.webview'; ``` -### once +## once once(type: string, callback: Callback\): void @@ -43,7 +43,7 @@ import web_webview from '@ohos.web.webview' web_webview.once("webInited", () => { console.log("setCookie") - web_webview.WebCookieManager.setCookie("www.example.com", "a=b") + web_webview.WebCookieManager.setCookie("https://www.example.com", "a=b") }) @Entry @@ -81,7 +81,7 @@ import web_webview from '@ohos.web.webview' @Component struct WebComponent { controller: web_webview.WebviewController = new web_webview.WebviewController(); - msgPort: WebMessagePort[] = null; + msgPort: web_webview.WebMessagePort[] = null; build() { Column() { @@ -214,6 +214,240 @@ struct WebComponent { } ``` +### isExtentionType10+ + +**System capability**: SystemCapability.Web.Webview.Core + +| Name | Type | Readable| Writable| Description | +| ------------ | ------ | ---- | ---- | ------------------------------------------------| +| isExtentionType | boolean | Yes | No| Whether to use the extended interface when creating a **WebMessagePort** instance. | + +### postMessageEventExt10+ + +postMessageEventExt(message: WebMessageExt): void + +Sends a message. For the complete sample code, see [onMessageEventExt](#onmessageeventext10). + +**System capability**: SystemCapability.Web.Webview.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------ | ---- | :------------- | +| message | [WebMessageExt](#webmessageext) | Yes | Message to send.| + +**Error codes** + +For details about the error codes, see [Webview Error Codes](../errorcodes/errorcode-webview.md). + +| ID| Error Message | +| -------- | ------------------------------------- | +| 17100010 | Can not post message using this port. | + + +### onMessageEventExt10+ + +onMessageEventExt(callback: (result: WebMessageExt) => void): void + +Registers a callback to receive messages from the HTML5 side. + +**System capability**: SystemCapability.Web.Webview.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | -------- | ---- | :------------------- | +| result | [WebMessageExt](#webmessageext10) | Yes | Message received.| + +**Error codes** + +For details about the error codes, see [Webview Error Codes](../errorcodes/errorcode-webview.md). + +| ID| Error Message | +| -------- | ----------------------------------------------- | +| 17100006 | Can not register message event using this port. | + +**Example** + +```ts +// xxx.ets +import web_webview from '@ohos.web.webview' + +// Example of sending messages between an application and a web page: Use the init_web_messageport channel to receive messages from the web page on the application side through port 0 and receive messages from the application on the web page side through port 1. +@Entry +@Component +struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController(); + ports: web_webview.WebMessagePort[] = null; + nativePort: web_webview.WebMessagePort = null; + @State msg1:string = ""; + @State msg2:string = ""; + message: web_webview.WebMessageExt = new web_webview.WebMessageExt(); + build() { + Column() { + Text(this.msg1).fontSize(16) + Text(this.msg2).fontSize(16) + Button('SendToH5') + .onClick(() => { + // Use the local port to send messages to HTML5. + try { + console.log("In eTS side send true start"); + if (this.nativePort) { + this.message.setString("helloFromEts"); + this.nativePort.postMessageEventExt(this.message); + } + } + catch (error) { + console.log("In eTS side send message catch error:" + error.code + ", msg:" + error.message); + } + }) + + Web({ src: $rawfile('index.html'), controller: this.controller }) + .onPageEnd((e)=>{ + console.log("In eTS side message onPageEnd init mesaage channel"); + // 1. Create a message port. + this.ports = this.controller.createWebMessagePorts(true); + // 2. Send port 1 to HTML5. + this.controller.postMessage("init_web_messageport", [this.ports[1]], "*"); + // 3. Save port 0 to the local host. + this.nativePort = this.ports[0]; + // 4. Set the callback. + this.nativePort.onMessageEventExt((result) => { + console.log("In eTS side got message"); + try { + var type = result.getType(); + console.log("In eTS side getType:" + type); + switch (type) { + case web_webview.WebMessageType.STRING: { + this.msg1 = "result type:" + typeof (result.getString()); + this.msg2 = "result getString:" + ((result.getString())); + break; + } + case web_webview.WebMessageType.NUMBER: { + this.msg1 = "result type:" + typeof (result.getNumber()); + this.msg2 = "result getNumber:" + ((result.getNumber())); + break; + } + case web_webview.WebMessageType.BOOLEAN: { + this.msg1 = "result type:" + typeof (result.getBoolean()); + this.msg2 = "result getBoolean:" + ((result.getBoolean())); + break; + } + case web_webview.WebMessageType.ARRAY_BUFFER: { + this.msg1 = "result type:" + typeof (result.getArrayBuffer()); + this.msg2 = "result getArrayBuffer byteLength:" + ((result.getArrayBuffer().byteLength)); + break; + } + case web_webview.WebMessageType.ARRAY: { + this.msg1 = "result type:" + typeof (result.getArray()); + this.msg2 = "result getArray:" + result.getArray(); + break; + } + case web_webview.WebMessageType.ERROR: { + this.msg1 = "result type:" + typeof (result.getError()); + this.msg2 = "result getError:" + result.getError(); + break; + } + default: { + this.msg1 = "default break, type:" + type; + break; + } + } + } + catch (resError) { + console.log(`log error code: ${resError.code}, Message: ${resError.message}`); + } + }); + }) + } + } +} +``` + +```html + + + + + WebView MessagePort Demo + + + +

Html5 Send and Receive Message

+

Receive string:

+

Receive arraybuffer:

+
+
+
+ + + +``` + +```js +//index.js +var h5Port; +window.addEventListener('message', function(event) { + if (event.data == 'init_web_messageport') { + if(event.ports[0] != null) { + h5Port = event.ports[0]; // 1. Save the port number sent from the eTS side. + h5Port.onmessage = function(event) { + console.log("hwd In html got message"); + // 2. Receive the message sent from the ArkTS side. + var result = event.data; + console.log("In html got message, typeof: ", typeof(result)); + console.log("In html got message, result: ", (result)); + if (typeof(result) == "string") { + console.log("In html got message, String: ", result); + document.getElementById("msg").innerHTML = "String:" + result; + } else if (typeof(result) == "number") { + console.log("In html side got message, number: ", result); + document.getElementById("msg").innerHTML = "Number:" + result; + } else if (typeof(result) == "boolean") { + console.log("In html side got message, boolean: ", result); + document.getElementById("msg").innerHTML = "Boolean:" + result; + } else if (typeof(result) == "object") { + if (result instanceof ArrayBuffer) { + document.getElementById("msg2").innerHTML = "ArrayBuffer:" + result.byteLength; + console.log("In html got message, byteLength: ", result.byteLength); + } else if (result instanceof Error) { + console.log("In html error message, err:" + (result)); + console.log("In html error message, typeof err:" + typeof(result)); + document.getElementById("msg2").innerHTML = "Error:" + result.name + ", msg:" + result.message; + } else if (result instanceof Array) { + console.log("In html got message, Array"); + console.log("In html got message, Array length:" + result.length); + console.log("In html got message, Array[0]:" + (result[0])); + console.log("In html got message, typeof Array[0]:" + typeof(result[0])); + document.getElementById("msg2").innerHTML = "Array len:" + result.length + ", value:" + result; + } else { + console.log("In html got message, not any instance of support type"); + document.getElementById("msg").innerHTML = "not any instance of support type"; + } + } else { + console.log("In html got message, not support type"); + document.getElementById("msg").innerHTML = "not support type"; + } + } + h5Port.onmessageerror = (event) => { + console.error(`hwd In html Error receiving message: ${event}`); + }; + } + } +}) + +// Use h5Port to send a message of the string type to the ArkTS side. +function postStringToApp() { + if (h5Port) { + console.log("In html send string message"); + h5Port.postMessage("hello"); + console.log("In html send string message end"); + } else { + console.error("In html h5port is null, please init first"); + } +} +``` + ## WebviewController Implements a **WebviewController** to control the behavior of the **\** component. A **WebviewController** can control only one **\** component, and the APIs (except static APIs) in the **WebviewController** can be invoked only after it has been bound to the target **\** component. @@ -245,6 +479,44 @@ export default class EntryAbility extends UIAbility { } ``` +### setHttpDns10+ + +static setHttpDns(secureDnsMode:SecureDnsMode, secureDnsConfig:string): void + +Sets how the \ component uses HTTPDNS for DNS resolution. + +**System capability**: SystemCapability.Web.Webview.Core + +**Parameters** + +| Name | Type | Mandatory | Description| +| ------------------ | ------- | ---- | ------------- | +| secureDnsMode | [SecureDnsMode](#securednsmode) | Yes | Mode in which HTTPDNS is used.| +| secureDnsConfig | string | Yes| Information about the HTTPDNS server to use, which must use HTTPS. Only one HTTPDNS server can be configured.| + +**Example** + +```ts +// xxx.ts +import UIAbility from '@ohos.app.ability.UIAbility'; +import web_webview from '@ohos.web.webview'; + +export default class EntryAbility extends UIAbility { + onCreate(want, launchParam) { + console.log("EntryAbility onCreate") + web_webview.WebviewController.initializeWebEngine() + try { + web_webview.WebviewController.setHttpDns(web_webview.SecureDnsMode.Auto, "https://example1.test") + } catch(error) { + console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); + } + + globalThis.abilityWant = want + console.log("EntryAbility onCreate done") + } +} +``` + ### Creating an Object ```ts @@ -379,12 +651,13 @@ struct WebComponent { } }) Web({ src: 'www.example.com', controller: this.controller }) - .webDebuggingAccess(true) } } } ``` +There are three methods for loading local resource files: +1. Using $rawfile ```ts // xxx.ets import web_webview from '@ohos.web.webview' @@ -399,7 +672,7 @@ struct WebComponent { Button('loadUrl') .onClick(() => { try { - // The URL to be loaded is of the Resource type. + // Load a local resource file through $rawfile. this.controller.loadUrl($rawfile('xxx.html')); } catch (error) { console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); @@ -410,6 +683,34 @@ struct WebComponent { } } ``` +2. Using the resources protocol +```ts +// xxx.ets +import web_webview from '@ohos.web.webview' + +@Entry +@Component +struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController(); + + build() { + Column() { + Button('loadUrl') + .onClick(() => { + try { + // Load a local resource file through the resource protocol. + this.controller.loadUrl("resource://rawfile/xxx.html"); + } catch (error) { + console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); + } + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } +} +``` + +3. Using a sandbox path. For details, see the example of loading local resource files in the sandbox in [Web](../arkui-ts/ts-basic-components-web.md#web). ```html @@ -479,7 +780,34 @@ struct WebComponent { } ``` -### accessforward +Example of loading local resource: +```ts +// xxx.ets +import web_webview from '@ohos.web.webview' + +@Entry +@Component +struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController(); + updataContent: string = '
image -- end
' + + build() { + Column() { + Button('loadData') + .onClick(() => { + try { + this.controller.loadData(this.updataContent, "text/html", "UTF-8", " ", " "); + } catch (error) { + console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); + } + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } +} +``` + +### accessForward accessForward(): boolean @@ -1138,19 +1466,21 @@ struct WebComponent { } ``` -### deleteJavaScriptRegister -deleteJavaScriptRegister(name: string): void +### runJavaScriptExt10+ -Deletes a specific application JavaScript object that is registered with the window through **registerJavaScriptProxy**. The deletion takes effect immediately without invoking the [refresh](#refresh) API. +runJavaScriptExt(script: string, callback : AsyncCallback\): void + +Executes a JavaScript script. This API uses an asynchronous callback to return the script execution result. **runJavaScriptExt** can be invoked only after **loadUrl** is executed. For example, it can be invoked in **onPageEnd**. **System capability**: SystemCapability.Web.Webview.Core **Parameters** -| Name| Type| Mandatory| Description | -| ------ | -------- | ---- | ---- | -| name | string | Yes | Name of the registered JavaScript object, which can be used to invoke the corresponding object on the application side from the web side.| +| Name | Type | Mandatory| Description | +| -------- | -------------------- | ---- | ---------------------------- | +| script | string | Yes | JavaScript script. | +| callback | AsyncCallback\<[JsMessageExt](#jsmessageext10)\> | Yes | Callback used to return the result.| **Error codes** @@ -1159,49 +1489,116 @@ For details about the error codes, see [Webview Error Codes](../errorcodes/error | ID| Error Message | | -------- | ------------------------------------------------------------ | | 17100001 | Init error. The WebviewController must be associated with a Web compoent. | -| 17100008 | Cannot delete JavaScriptProxy. | **Example** ```ts -// xxx.ets import web_webview from '@ohos.web.webview' @Entry @Component struct WebComponent { controller: web_webview.WebviewController = new web_webview.WebviewController(); - @State name: string = 'Object'; + @State msg1: string = '' + @State msg2: string = '' build() { Column() { - Button('deleteJavaScriptRegister') - .onClick(() => { + Text(this.msg1).fontSize(20) + Text(this.msg2).fontSize(20) + Web({ src: $rawfile('index.html'), controller: this.controller }) + .javaScriptAccess(true) + .onPageEnd(e => { try { - this.controller.deleteJavaScriptRegister(this.name); + this.controller.runJavaScriptExt( + 'test()', + (error, result) => { + if (error) { + console.info(`run JavaScript error: ` + JSON.stringify(error)) + return; + } + if (result) { + try { + var type = result.getType(); + switch (type) { + case web_webview.JsMessageType.STRING: { + this.msg1 = "result type:" + typeof (result.getString()); + this.msg2 = "result getString:" + ((result.getString())); + break; + } + case web_webview.JsMessageType.NUMBER: { + this.msg1 = "result type:" + typeof (result.getNumber()); + this.msg2 = "result getNumber:" + ((result.getNumber())); + break; + } + case web_webview.JsMessageType.BOOLEAN: { + this.msg1 = "result type:" + typeof (result.getBoolean()); + this.msg2 = "result getBoolean:" + ((result.getBoolean())); + break; + } + case web_webview.JsMessageType.ARRAY_BUFFER: { + this.msg1 = "result type:" + typeof (result.getArrayBuffer()); + this.msg2 = "result getArrayBuffer byteLength:" + ((result.getArrayBuffer().byteLength)); + break; + } + case web_webview.JsMessageType.ARRAY: { + this.msg1 = "result type:" + typeof (result.getArray()); + this.msg2 = "result getArray:" + result.getArray(); + break; + } + default: { + this.msg1 = "default break, type:" + type; + break; + } + } + } + catch (resError) { + console.log(`log error code: ${resError.code}, Message: ${resError.message}`); + } + } + }); + console.info('url: ', e.url); } catch (error) { - console.error(`Errorcode: ${error.code}, Message: ${error.message}`); + console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); } }) - Web({ src: 'www.example.com', controller: this.controller }) } } } + +//index.html + + + +

run JavaScript Ext demo

+ + + ``` -### zoom +### runJavaScriptExt10+ -zoom(factor: number): void +runJavaScriptExt(script: string): Promise\ -Zooms in or out of this web page. +Executes a JavaScript script. This API uses a promise to return the script execution result. **runJavaScriptExt** can be invoked only after **loadUrl** is executed. For example, it can be invoked in **onPageEnd**. **System capability**: SystemCapability.Web.Webview.Core **Parameters** -| Name| Type| Mandatory| Description| -| ------ | -------- | ---- | ------------------------------------------------------------ | -| factor | number | Yes | Relative zoom ratio. A positive value indicates zoom-in, and a negative value indicates zoom-out.| +| Name| Type| Mandatory| Description | +| ------ | -------- | ---- | ---------------- | +| script | string | Yes | JavaScript script.| + +**Return value** + +| Type | Description | +| --------------- | --------------------------------------------------- | +| Promise\<[JsMessageExt](#jsmessageext10)> | Promise used to return the script execution result.| **Error codes** @@ -1210,7 +1607,6 @@ For details about the error codes, see [Webview Error Codes](../errorcodes/error | ID| Error Message | | -------- | ------------------------------------------------------------ | | 17100001 | Init error. The WebviewController must be associated with a Web compoent. | -| 17100004 | Function not enable. | **Example** @@ -1222,27 +1618,185 @@ import web_webview from '@ohos.web.webview' @Component struct WebComponent { controller: web_webview.WebviewController = new web_webview.WebviewController(); - @State factor: number = 1; + @State webResult: string = ''; + @State msg1: string = '' + @State msg2: string = '' build() { Column() { - Button('zoom') - .onClick(() => { - try { - this.controller.zoom(this.factor); - } catch (error) { - console.error(`Errorcode: ${error.code}, Message: ${error.message}`); - } + Text(this.webResult).fontSize(20) + Text(this.msg1).fontSize(20) + Text(this.msg2).fontSize(20) + Web({ src: $rawfile('index.html'), controller: this.controller }) + .javaScriptAccess(true) + .onPageEnd(e => { + this.controller.runJavaScriptExt('test()') + .then((result) => { + try { + var type = result.getType(); + switch (type) { + case web_webview.JsMessageType.STRING: { + this.msg1 = "result type:" + typeof (result.getString()); + this.msg2 = "result getString:" + ((result.getString())); + break; + } + case web_webview.JsMessageType.NUMBER: { + this.msg1 = "result type:" + typeof (result.getNumber()); + this.msg2 = "result getNumber:" + ((result.getNumber())); + break; + } + case web_webview.JsMessageType.BOOLEAN: { + this.msg1 = "result type:" + typeof (result.getBoolean()); + this.msg2 = "result getBoolean:" + ((result.getBoolean())); + break; + } + case web_webview.JsMessageType.ARRAY_BUFFER: { + this.msg1 = "result type:" + typeof (result.getArrayBuffer()); + this.msg2 = "result getArrayBuffer byteLength:" + ((result.getArrayBuffer().byteLength)); + break; + } + case web_webview.JsMessageType.ARRAY: { + this.msg1 = "result type:" + typeof (result.getArray()); + this.msg2 = "result getArray:" + result.getArray(); + break; + } + default: { + this.msg1 = "default break, type:" + type; + break; + } + } + } + catch (resError) { + console.log(`log error code: ${resError.code}, Message: ${resError.message}`); + } + }) + .catch(function (error) { + console.error("error: " + error); + }) }) - Web({ src: 'www.example.com', controller: this.controller }) } } } -``` - -### searchAllAsync - -searchAllAsync(searchString: string): void + +//index.html + + + +

run JavaScript Ext demo

+ + + +``` + +### deleteJavaScriptRegister + +deleteJavaScriptRegister(name: string): void + +Deletes a specific application JavaScript object that is registered with the window through **registerJavaScriptProxy**. The deletion takes effect immediately without invoking the [refresh](#refresh) API. + +**System capability**: SystemCapability.Web.Webview.Core + +**Parameters** + +| Name| Type| Mandatory| Description | +| ------ | -------- | ---- | ---- | +| name | string | Yes | Name of the registered JavaScript object, which can be used to invoke the corresponding object on the application side from the web side.| + +**Error codes** + +For details about the error codes, see [Webview Error Codes](../errorcodes/errorcode-webview.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| 17100001 | Init error. The WebviewController must be associated with a Web compoent. | +| 17100008 | Cannot delete JavaScriptProxy. | + +**Example** + +```ts +// xxx.ets +import web_webview from '@ohos.web.webview' + +@Entry +@Component +struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController(); + @State name: string = 'Object'; + + build() { + Column() { + Button('deleteJavaScriptRegister') + .onClick(() => { + try { + this.controller.deleteJavaScriptRegister(this.name); + } catch (error) { + console.error(`Errorcode: ${error.code}, Message: ${error.message}`); + } + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } +} +``` + +### zoom + +zoom(factor: number): void + +Zooms in or out of this web page. + +**System capability**: SystemCapability.Web.Webview.Core + +**Parameters** + +| Name| Type| Mandatory| Description| +| ------ | -------- | ---- | ------------------------------------------------------------ | +| factor | number | Yes | Relative zoom ratio. A positive value indicates zoom-in, and a negative value indicates zoom-out.| + +**Error codes** + +For details about the error codes, see [Webview Error Codes](../errorcodes/errorcode-webview.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| 17100001 | Init error. The WebviewController must be associated with a Web compoent. | +| 17100004 | Function not enable. | + +**Example** + +```ts +// xxx.ets +import web_webview from '@ohos.web.webview' + +@Entry +@Component +struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController(); + @State factor: number = 1; + + build() { + Column() { + Button('zoom') + .onClick(() => { + try { + this.controller.zoom(this.factor); + } catch (error) { + console.error(`Errorcode: ${error.code}, Message: ${error.message}`); + } + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } +} +``` + +### searchAllAsync + +searchAllAsync(searchString: string): void Searches the web page for content that matches the keyword specified by **'searchString'** and highlights the matches on the page. This API returns the result asynchronously through [onSearchResultReceive](../arkui-ts/ts-basic-components-web.md#onsearchresultreceive9). @@ -1474,12 +2028,18 @@ struct WebComponent { ### createWebMessagePorts - createWebMessagePorts(): Array\ +createWebMessagePorts(isExtentionType?: boolean): Array\ -Creates web message ports. +Creates web message ports. For the complete sample code, see [onMessageEventExt](#onmessageeventext10). **System capability**: SystemCapability.Web.Webview.Core +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ---------------------- | ---- | :------------------------------| +| isExtentionType10+ | boolean | No | Whether to use the extended interface. The default value is **false**, indicating that the extended interface is not used.| + **Return value** | Type | Description | @@ -1535,8 +2095,8 @@ Sends a web message to an HTML5 window. | Name| Type | Mandatory| Description | | ------ | ---------------------- | ---- | :------------------------------- | -| name | string | Yes | Message to send, including the data and message port.| -| ports | Array\ | Yes | Ports for receiving the message. | +| name | string | Yes | Name of the message to send. | +| ports | Array\ | Yes | Message ports for sending the message. | | uri | string | Yes | URI for receiving the message. | **Error codes** @@ -1606,7 +2166,7 @@ struct WebComponent { .onClick(() => { try { if (this.ports && this.ports[1]) { - this.ports[1].postMessageEvent("this.sendFromEts"); + this.ports[1].postMessageEvent(this.sendFromEts); } else { console.error(`ports is null, Please initialize first`); } @@ -1648,7 +2208,7 @@ var output = document.querySelector('.output'); window.addEventListener('message', function (event) { if (event.data == '__init_port__') { if (event.ports[0] != null) { - The h5Port = event.ports[0]; // 1. Save the port number sent from the eTS side. + h5Port = event.ports[0]; // 1. Save the port number sent from the eTS side. h5Port.onmessage = function (event) { // 2. Receive the message sent from the eTS side. var msg = 'Got message from ets:'; @@ -3167,131 +3727,341 @@ struct WebComponent { } ``` -## WebCookieManager - -Implements a **WebCookieManager** instance to manage behavior of cookies in **\** components. All **\** components in an application share a **WebCookieManager** instance. - -### getCookie +### getCertificate10+ -static getCookie(url: string): string +getCertificate(): Promise> -Obtains the cookie value corresponding to the specified URL. +Obtains the certificate information of the current website. When the \ component is used to load an HTTPS website, SSL certificate verification is performed. This API uses a promise to return the [X.509 certificate](./js-apis-cert.md) of the current website. **System capability**: SystemCapability.Web.Webview.Core -**Parameters** - -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | :------------------------ | -| url | string | Yes | URL of the cookie value to obtain.| - **Return value** -| Type | Description | -| ------ | ------------------------- | -| string | Cookie value corresponding to the specified URL.| +| Type | Description | +| ---------- | --------------------------------------------- | +| Promise> | Promise used to obtain the X.509 certificate array of the current HTTPS website.| **Error codes** For details about the error codes, see [Webview Error Codes](../errorcodes/errorcode-webview.md). -| ID| Error Message | -| -------- | ------------------------------------------------------ | -| 17100002 | Invalid url. | +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| 17100001 | Init error. The WebviewController must be associated with a Web component. | **Example** ```ts // xxx.ets -import web_webview from '@ohos.web.webview' +import web_webview from '@ohos.web.webview'; + +function Uint8ArrayToString(dataArray) { + var dataString = '' + for (var i = 0; i < dataArray.length; i++) { + dataString += String.fromCharCode(dataArray[i]) + } + return dataString +} + +function ParseX509CertInfo(x509CertArray) { + let res: string = 'getCertificate success: len = ' + x509CertArray.length; + for (let i = 0; i < x509CertArray.length; i++) { + res += ', index = ' + i + ', issuer name = ' + + Uint8ArrayToString(x509CertArray[i].getIssuerName().data) + ', subject name = ' + + Uint8ArrayToString(x509CertArray[i].getSubjectName().data) + ', valid start = ' + + x509CertArray[i].getNotBeforeTime() + + ', valid end = ' + x509CertArray[i].getNotAfterTime() + } + return res +} @Entry @Component -struct WebComponent { - controller: web_webview.WebviewController = new web_webview.WebviewController(); +struct Index { + // outputStr displays debug information on the UI. + @State outputStr: string = '' + webviewCtl: web_webview.WebviewController = new web_webview.WebviewController(); build() { - Column() { - Button('getCookie') - .onClick(() => { - try { - let value = web_webview.WebCookieManager.getCookie('www.example.com'); - console.log("value: " + value); - } catch (error) { - console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); + Row() { + Column() { + List({space: 20, initialIndex: 0}) { + ListItem() { + Button() { + Text('load bad ssl') + .fontSize(10) + .fontWeight(FontWeight.Bold) + } + .type(ButtonType.Capsule) + .onClick(() => { + // Load an expired certificate website and view the obtained certificate information. + this.webviewCtl.loadUrl('https://expired.badssl.com') + }) + .height(50) } - }) - Web({ src: 'www.example.com', controller: this.controller }) + + ListItem() { + Button() { + Text('load example') + .fontSize(10) + .fontWeight(FontWeight.Bold) + } + .type(ButtonType.Capsule) + .onClick(() => { + //Load an HTTPS website and view the certificate information of the website. + this.webviewCtl.loadUrl('https://www.example.com') + }) + .height(50) + } + + ListItem() { + Button() { + Text('getCertificate Promise') + .fontSize(10) + .fontWeight(FontWeight.Bold) + } + .type(ButtonType.Capsule) + .onClick(() => { + try { + this.webviewCtl.getCertificate().then(x509CertArray => { + this.outputStr = ParseX509CertInfo(x509CertArray); + }) + } catch (error) { + this.outputStr = 'getCertificate failed: ' + error.code + ", errMsg: " + error.message; + } + }) + .height(50) + } + + ListItem() { + Button() { + Text('getCertificate AsyncCallback') + .fontSize(10) + .fontWeight(FontWeight.Bold) + } + .type(ButtonType.Capsule) + .onClick(() => { + try { + this.webviewCtl.getCertificate((error, x509CertArray) => { + if (error) { + this.outputStr = 'getCertificate failed: ' + error.code + ", errMsg: " + error.message; + } else { + this.outputStr = ParseX509CertInfo(x509CertArray); + } + }) + } catch (error) { + this.outputStr = 'getCertificate failed: ' + error.code + ", errMsg: " + error.message; + } + }) + .height(50) + } + } + .listDirection(Axis.Horizontal) + .height('10%') + + Text(this.outputStr) + .width('100%') + .fontSize(10) + + Web({ src: 'https://www.example.com', controller: this.webviewCtl }) + .fileAccess(true) + .javaScriptAccess(true) + .domStorageAccess(true) + .onlineImageAccess(true) + .onPageEnd((e) => { + this.outputStr = 'onPageEnd : url = ' + e.url + }) + .onSslErrorEventReceive((e) => { + // Ignore SSL certificate errors to test websites whose certificates have expired, for example, https://expired.badssl.com. + e.handler.handleConfirm() + }) + .width('100%') + .height('70%') + } + .height('100%') } } } ``` -### setCookie +### getCertificate10+ -static setCookie(url: string, value: string): void +getCertificate(callback: AsyncCallback>): void -Sets a cookie value for the specified URL. +Obtains the certificate information of the current website. When the \ component is used to load an HTTPS website, SSL certificate verification is performed. This API uses an asynchronous callback to return the [X.509 certificate](./js-apis-cert.md) of the current website. **System capability**: SystemCapability.Web.Webview.Core **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------ | ---- | :------------------------ | -| url | string | Yes | URL of the cookie to set.| -| value | string | Yes | Cookie value to set. | +| Name | Type | Mandatory| Description | +| -------- | ---------------------------- | ---- | ---------------------------------------- | +| callback | AsyncCallback> | Yes | Callback used to obtain the X.509 certificate array of the current HTTPS website.| **Error codes** For details about the error codes, see [Webview Error Codes](../errorcodes/errorcode-webview.md). -| ID| Error Message | -| -------- | ------------------------------------------------------ | -| 17100002 | Invalid url. | -| 17100005 | Invalid cookie value. | +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| 17100001 | Init error. The WebviewController must be associated with a Web compoent. | **Example** ```ts // xxx.ets -import web_webview from '@ohos.web.webview' +import web_webview from '@ohos.web.webview'; + +function Uint8ArrayToString(dataArray) { + var dataString = '' + for (var i = 0; i < dataArray.length; i++) { + dataString += String.fromCharCode(dataArray[i]) + } + return dataString +} + +function ParseX509CertInfo(x509CertArray) { + let res: string = 'getCertificate success: len = ' + x509CertArray.length; + for (let i = 0; i < x509CertArray.length; i++) { + res += ', index = ' + i + ', issuer name = ' + + Uint8ArrayToString(x509CertArray[i].getIssuerName().data) + ', subject name = ' + + Uint8ArrayToString(x509CertArray[i].getSubjectName().data) + ', valid start = ' + + x509CertArray[i].getNotBeforeTime() + + ', valid end = ' + x509CertArray[i].getNotAfterTime() + } + return res +} @Entry @Component -struct WebComponent { - controller: web_webview.WebviewController = new web_webview.WebviewController(); +struct Index { + // outputStr displays debug information on the UI. + @State outputStr: string = '' + webviewCtl: web_webview.WebviewController = new web_webview.WebviewController(); build() { - Column() { - Button('setCookie') - .onClick(() => { - try { - web_webview.WebCookieManager.setCookie('www.example.com', 'a=b'); - } catch (error) { - console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); + Row() { + Column() { + List({space: 20, initialIndex: 0}) { + ListItem() { + Button() { + Text('load bad ssl') + .fontSize(10) + .fontWeight(FontWeight.Bold) + } + .type(ButtonType.Capsule) + .onClick(() => { + // Load an expired certificate website and view the obtained certificate information. + this.webviewCtl.loadUrl('https://expired.badssl.com') + }) + .height(50) } - }) - Web({ src: 'www.example.com', controller: this.controller }) + + ListItem() { + Button() { + Text('load example') + .fontSize(10) + .fontWeight(FontWeight.Bold) + } + .type(ButtonType.Capsule) + .onClick(() => { + //Load an HTTPS website and view the certificate information of the website. + this.webviewCtl.loadUrl('https://www.example.com') + }) + .height(50) + } + + ListItem() { + Button() { + Text('getCertificate Promise') + .fontSize(10) + .fontWeight(FontWeight.Bold) + } + .type(ButtonType.Capsule) + .onClick(() => { + try { + this.webviewCtl.getCertificate().then(x509CertArray => { + this.outputStr = ParseX509CertInfo(x509CertArray); + }) + } catch (error) { + this.outputStr = 'getCertificate failed: ' + error.code + ", errMsg: " + error.message; + } + }) + .height(50) + } + + ListItem() { + Button() { + Text('getCertificate AsyncCallback') + .fontSize(10) + .fontWeight(FontWeight.Bold) + } + .type(ButtonType.Capsule) + .onClick(() => { + try { + this.webviewCtl.getCertificate((error, x509CertArray) => { + if (error) { + this.outputStr = 'getCertificate failed: ' + error.code + ", errMsg: " + error.message; + } else { + this.outputStr = ParseX509CertInfo(x509CertArray); + } + }) + } catch (error) { + this.outputStr = 'getCertificate failed: ' + error.code + ", errMsg: " + error.message; + } + }) + .height(50) + } + } + .listDirection(Axis.Horizontal) + .height('10%') + + Text(this.outputStr) + .width('100%') + .fontSize(10) + + Web({ src: 'https://www.example.com', controller: this.webviewCtl }) + .fileAccess(true) + .javaScriptAccess(true) + .domStorageAccess(true) + .onlineImageAccess(true) + .onPageEnd((e) => { + this.outputStr = 'onPageEnd : url = ' + e.url + }) + .onSslErrorEventReceive((e) => { + // Ignore SSL certificate errors to test websites whose certificates have expired, for example, https://expired.badssl.com. + e.handler.handleConfirm() + }) + .width('100%') + .height('70%') + } + .height('100%') } } } ``` -### saveCookieAsync +### setAudioMuted10+ -static saveCookieAsync(callback: AsyncCallback\): void +setAudioMuted(mute: boolean): void -Saves the cookies in the memory to the drive. This API uses an asynchronous callback to return the result. +Mutes this web page. **System capability**: SystemCapability.Web.Webview.Core **Parameters** -| Name | Type | Mandatory| Description | -| -------- | ---------------------- | ---- | :------------------------------------------------- | -| callback | AsyncCallback\ | Yes | Callback used to return the operation result.| +| Name | Type | Mandatory| Description | +| -------- | ------- | ---- | -------------------------------------- | +| mute | boolean | Yes | Whether to mute the web page. The value **true** means to mute the web page, and **false** means the opposite.| + +**Error codes** +For details about the error codes, see [Webview Error Codes](../errorcodes/errorcode-webview.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------------ | +| 17100001 | Init error. The WebviewController must be associated with a Web component. | **Example** @@ -3302,19 +4072,169 @@ import web_webview from '@ohos.web.webview' @Entry @Component struct WebComponent { - controller: web_webview.WebviewController = new web_webview.WebviewController(); - + controller: web_webview.WebviewController = new web_webview.WebviewController() + @State muted: boolean = false build() { Column() { - Button('saveCookieAsync') - .onClick(() => { - try { - web_webview.WebCookieManager.saveCookieAsync((error) => { - if (error) { - console.log("error: " + error); - } - }) - } catch (error) { + Button("Toggle Mute") + .onClick(event => { + this.muted = !this.muted + this.controller.setAudioMuted(this.muted) + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } +} +``` + +## WebCookieManager + +Implements a **WebCookieManager** instance to manage behavior of cookies in **\** components. All **\** components in an application share a **WebCookieManager** instance. + +### getCookie + +static getCookie(url: string): string + +Obtains the cookie corresponding to the specified URL. + +**System capability**: SystemCapability.Web.Webview.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | :------------------------ | +| url | string | Yes | URL of the cookie to obtain. A complete URL is recommended.| + +**Return value** + +| Type | Description | +| ------ | ------------------------- | +| string | Cookie value corresponding to the specified URL.| + +**Error codes** + +For details about the error codes, see [Webview Error Codes](../errorcodes/errorcode-webview.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------ | +| 17100002 | Invalid url. | + +**Example** + +```ts +// xxx.ets +import web_webview from '@ohos.web.webview' + +@Entry +@Component +struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController(); + + build() { + Column() { + Button('getCookie') + .onClick(() => { + try { + let value = web_webview.WebCookieManager.getCookie('https://www.example.com'); + console.log("value: " + value); + } catch (error) { + console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); + } + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } +} +``` + +### setCookie + +static setCookie(url: string, value: string): void + +Sets a cookie for the specified URL. + +**System capability**: SystemCapability.Web.Webview.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | :------------------------ | +| url | string | Yes | URL of the cookie to set. A complete URL is recommended.| +| value | string | Yes | Cookie value to set. | + +**Error codes** + +For details about the error codes, see [Webview Error Codes](../errorcodes/errorcode-webview.md). + +| ID| Error Message | +| -------- | ------------------------------------------------------ | +| 17100002 | Invalid url. | +| 17100005 | Invalid cookie value. | + +**Example** + +```ts +// xxx.ets +import web_webview from '@ohos.web.webview' + +@Entry +@Component +struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController(); + + build() { + Column() { + Button('setCookie') + .onClick(() => { + try { + web_webview.WebCookieManager.setCookie('https://www.example.com', 'a=b'); + } catch (error) { + console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); + } + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } +} +``` + +### saveCookieAsync + +static saveCookieAsync(callback: AsyncCallback\): void + +Saves the cookies in the memory to the drive. This API uses an asynchronous callback to return the result. + +**System capability**: SystemCapability.Web.Webview.Core + +**Parameters** + +| Name | Type | Mandatory| Description | +| -------- | ---------------------- | ---- | :------------------------------------------------- | +| callback | AsyncCallback\ | Yes | Callback used to return the operation result.| + + +**Example** + +```ts +// xxx.ets +import web_webview from '@ohos.web.webview' + +@Entry +@Component +struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController(); + + build() { + Column() { + Button('saveCookieAsync') + .onClick(() => { + try { + web_webview.WebCookieManager.saveCookieAsync((error) => { + if (error) { + console.log("error: " + error); + } + }) + } catch (error) { console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); } }) @@ -3424,7 +4344,7 @@ Checks whether the **WebCookieManager** instance has the permission to send and | Type | Description | | ------- | -------------------------------- | -| boolean | Whether the **WebCookieManager** instance has the permission to send and receive cookies.| +| boolean | Whether the **WebCookieManager** instance has the permission to send and receive cookies. The default value is **true**.| **Example** @@ -3503,7 +4423,7 @@ Checks whether the **WebCookieManager** instance has the permission to send and | Type | Description | | ------- | -------------------------------------- | -| boolean | Whether the **WebCookieManager** instance has the permission to send and receive third-party cookies.| +| boolean | Whether the **WebCookieManager** instance has the permission to send and receive third-party cookies. The default value is **false**.| **Example** @@ -4135,9 +5055,6 @@ struct WebComponent { try { this.username_password = web_webview.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) } catch (error) { console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); } @@ -4206,7 +5123,7 @@ Checks whether any saved HTTP authentication credentials exist. This API returns | Type | Description | | ------- | ------------------------------------------------------------ | -| boolean | Whether any saved HTTP authentication credentials exist. Returns **true** if any saved HTTP authentication credentials exist; returns **false** otherwise. | +| boolean | Whether any saved HTTP authentication credentials exist. Returns **true** if any saved HTTP authentication credentials exist; returns **false** otherwise.| **Example** @@ -4672,6 +5589,463 @@ Describes the data types supported for [WebMessagePort](#webmessageport). | string | String type.| | ArrayBuffer | Binary type.| +## JsMessageType10+ + +Describes the type of the returned result of script execution using [runJavaScirptExt](#runjavascriptext10). + +**System capability**: SystemCapability.Web.Webview.Core + +| Name | Value| Description | +| ------------ | -- |--------------------------------- | +| NOT_SUPPORT | 0 |Unsupported data type.| +| STRING | 1 |String type.| +| NUMBER | 2 |Number type.| +| BOOLEAN | 3 |Boolean type.| +| ARRAY_BUFFER | 4 |Raw binary data buffer.| +| ARRAY | 5 |Array type.| + + +## WebMessageType10+ + +Describes the data type supported by the [webMessagePort](#webmessageport) API. + +**System capability**: SystemCapability.Web.Webview.Core + +| Name | Value| Description | +| ------------ | -- |------------------------------- | +| NOT_SUPPORT | 0 |Unsupported data type.| +| STRING | 1 |String type.| +| NUMBER | 2 |Number type.| +| BOOLEAN | 3 |Boolean type.| +| ARRAY_BUFFER | 4 |Raw binary data buffer.| +| ARRAY | 5 |Array type.| +| ERROR | 6 |Error object type.| + +## JsMessageExt10+ + +Implements the **JsMessageExt** data object that is returned after script execution using the [runJavaScirptExt](#runjavascriptext10) API. + +### getType10+ + +getType(): JsMessageType + +Obtains the type of the data object. + +**System capability**: SystemCapability.Web.Webview.Core + +**Return value** + +| Type | Description | +| --------------| --------------------------------------------------------- | +| [JsMessageType](#jsmessagetype10) | Type of the data object that is returned after script execution using the [runJavaScirptExt](#runjavascriptext10) API.| + +### getString10+ + +getString(): string + +Obtains string-type data of the data object. For the complete sample code, see [runJavaScriptExt](#runjavascriptext10). + +**System capability**: SystemCapability.Web.Webview.Core + +**Return value** + +| Type | Description | +| --------------| ------------- | +| string | Data of the string type.| + +**Error codes** + +For details about the error codes, see [Webview Error Codes](../errorcodes/errorcode-webview.md). + +| ID| Error Message | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the result. | + + +### getNumber10+ + +getNumber(): number + +Obtains number-type data of the data object. For the complete sample code, see [runJavaScriptExt](#runjavascriptext10). + +**System capability**: SystemCapability.Web.Webview.Core + +**Return value** + +| Type | Description | +| --------------| ------------- | +| number | Data of the number type.| + +**Error codes** + +For details about the error codes, see [Webview Error Codes](../errorcodes/errorcode-webview.md). + +| ID| Error Message | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the result. | + +### getBoolean10+ + +getBoolean(): boolean + +Obtains Boolean-type data of the data object. For the complete sample code, see [runJavaScriptExt](#runjavascriptext10). + +**System capability**: SystemCapability.Web.Webview.Core + +**Return value** + +| Type | Description | +| --------------| ------------- | +| boolean | Data of the Boolean type.| + +**Error codes** + +For details about the error codes, see [Webview Error Codes](../errorcodes/errorcode-webview.md). + +| ID| Error Message | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the result. | + + +### getArrayBuffer10+ + +getArrayBuffer(): ArrayBuffer + +Obtains raw binary data of the data object. For the complete sample code, see [runJavaScriptExt](#runjavascriptext10). +**System capability**: SystemCapability.Web.Webview.Core + +**Return value** + +| Type | Description | +| --------------| ------------- | +| ArrayBuffer | Raw binary data.| + +**Error codes** + +For details about the error codes, see [Webview Error Codes](../errorcodes/errorcode-webview.md). + +| ID| Error Message | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the result. | + +### getArray10+ + +getArray(): Array\ + +Obtains array-type data of the data object. For the complete sample code, see [runJavaScriptExt](#runjavascriptext10). + +**System capability**: SystemCapability.Web.Webview.Core + +**Return value** + +| Type | Description | +| --------------| ------------- | +| Array\ | Data of the array type.| + +**Error codes** + +For details about the error codes, see [Webview Error Codes](../errorcodes/errorcode-webview.md). + +| ID| Error Message | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the result. | + + +## WebMessageExt10+ + +Data object received and sent by the [webMessagePort](#webmessageport) interface. + +### getType10+ + +getType(): WebMessageType + +Obtains the type of the data object. + +**System capability**: SystemCapability.Web.Webview.Core + +**Return value** + +| Type | Description | +| --------------| --------------------------------------------------------- | +| [WebMessageType](#webmessagetype10) | Data type supported by the [webMessagePort](#webmessageport) API.| + + +### getString10+ + +getString(): string + +Obtains string-type data of the data object. For the complete sample code, see [onMessageEventExt](#onmessageeventext10). + +**System capability**: SystemCapability.Web.Webview.Core + +**Return value** + +| Type | Description | +| --------------| ------------- | +| string | Data of the string type.| + +**Error codes** + +For details about the error codes, see [Webview Error Codes](../errorcodes/errorcode-webview.md). + +| ID| Error Message | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the web message. | + + +### getNumber10+ + +getNumber(): number + +Obtains number-type data of the data object. For the complete sample code, see [onMessageEventExt](#onmessageeventext10). + +**System capability**: SystemCapability.Web.Webview.Core + +**Return value** + +| Type | Description | +| --------------| ------------- | +| number | Data of the number type.| + +**Error codes** + +For details about the error codes, see [Webview Error Codes](../errorcodes/errorcode-webview.md). + +| ID| Error Message | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the web message. | + + +### getBoolean10+ + +getBoolean(): boolean + +Obtains Boolean-type data of the data object. For the complete sample code, see [onMessageEventExt](#onmessageeventext10). + +**System capability**: SystemCapability.Web.Webview.Core + +**Return value** + +| Type | Description | +| --------------| ------------- | +| boolean | Data of the Boolean type.| + +**Error codes** + +For details about the error codes, see [Webview Error Codes](../errorcodes/errorcode-webview.md). + +| ID| Error Message | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the web message. | + + +### getArrayBuffer10+ + +getArrayBuffer(): ArrayBuffer + +Obtains raw binary data of the data object. For the complete sample code, see [onMessageEventExt](#onmessageeventext10). +**System capability**: SystemCapability.Web.Webview.Core + +**Return value** + +| Type | Description | +| --------------| ------------- | +| ArrayBuffer | Raw binary data.| + +**Error codes** + +For details about the error codes, see [Webview Error Codes](../errorcodes/errorcode-webview.md). + +| ID| Error Message | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the web message. | + +### getArray10+ + +getArray(): Array\ + +Obtains array-type data of the data object. For the complete sample code, see [onMessageEventExt](#onmessageeventext10). + +**System capability**: SystemCapability.Web.Webview.Core + +**Return value** + +| Type | Description | +| --------------| ------------- | +| Array\ | Data of the array type.| + +**Error codes** + +For details about the error codes, see [Webview Error Codes](../errorcodes/errorcode-webview.md). + +| ID| Error Message | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the web message. | + +### getError10+ + +getError(): Error + +Obtains the error-object-type data of the data object. For the complete sample code, see [onMessageEventExt](#onmessageeventext10). + +**System capability**: SystemCapability.Web.Webview.Core + +**Return value** + +| Type | Description | +| --------------| ------------- | +| Error | Data of the error object type.| + +**Error codes** + +For details about the error codes, see [Webview Error Codes](../errorcodes/errorcode-webview.md). + +| ID| Error Message | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the web message. | + + +### setType10+ + +setType(type: WebMessageType): void + +Sets the type for the data object. + +**System capability**: SystemCapability.Web.Webview.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | ---------------------- | +| type | [WebMessageType](#webmessagetype10) | Yes | Data type supported by the [webMessagePort](#webmessageport) API.| + +**Error codes** + +| ID| Error Message | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the web message. | + +### setString10+ + +setString(message: string): void + +Sets the string-type data of the data object. For the complete sample code, see [onMessageEventExt](#onmessageeventext10). + +**System capability**: SystemCapability.Web.Webview.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | -------------------- | +| message | string | Yes | String type.| + +**Error codes** + +| ID| Error Message | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the web message. | + +### setNumber10+ + +setNumber(message: number): void + +Sets the number-type data of the data object. For the complete sample code, see [onMessageEventExt](#onmessageeventext10). + +**System capability**: SystemCapability.Web.Webview.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | -------------------- | +| message | number | Yes | Data of the number type.| + +**Error codes** + +| ID| Error Message | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the web message. | + +### setBoolean10+ + +setBoolean(message: boolean): void + +Sets the Boolean-type data for the data object. For the complete sample code, see [onMessageEventExt](#onmessageeventext10). + +**System capability**: SystemCapability.Web.Webview.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | -------------------- | +| message | boolean | Yes | Data of the Boolean type.| + +**Error codes** + +| ID| Error Message | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the web message. | + +### setArrayBuffer10+ + +setArrayBuffer(message: ArrayBuffer): void + +Sets the raw binary data for the data object. For the complete sample code, see [onMessageEventExt](#onmessageeventext10). + +**System capability**: SystemCapability.Web.Webview.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | -------------------- | +| message | ArrayBuffer | Yes | Raw binary data.| + +**Error codes** + +| ID| Error Message | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the web message. | + +### setArray10+ + +setArray(message: Array\): void + +Sets the array-type data for the data object. For the complete sample code, see [onMessageEventExt](#onmessageeventext10). + +**System capability**: SystemCapability.Web.Webview.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | -------------------- | +| message | Array\ | Yes | Data of the array type.| + +**Error codes** + +| ID| Error Message | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the web message. | + +### setError10+ + +setError(message: Error): void + +Sets the error-object-type data for the data object. For the complete sample code, see [onMessageEventExt](#onmessageeventext10). + +**System capability**: SystemCapability.Web.Webview.Core + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------ | ---- | -------------------- | +| message | Error | Yes | Data of the error object type.| + +**Error codes** + +| ID| Error Message | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the web message. | + + ## WebStorageOrigin Provides usage information of the Web SQL Database. @@ -4771,3 +6145,15 @@ Defines a custom URL scheme. | schemeName | string | Yes | Yes | Name of the custom URL scheme. The value can contain a maximum of 32 characters and include only lowercase letters, digits, periods (.), plus signs (+), and hyphens (-). | | isSupportCORS | boolean | Yes | Yes | Whether to support cross-origin resource sharing (CORS). | | isSupportFetch | boolean | Yes | Yes | Whether to support fetch requests. | + +## SecureDnsMode10+ + +Describes the mode in which the **\** component uses HTTPDNS. + +**System capability**: SystemCapability.Web.Webview.Core + +| Name | Value| Description | +| ------------- | -- |----------------------------------------- | +| Off | 0 |HTTPDNS is not used. This value can be used to revoke the previously used HTTPDNS configuration.| +| Auto | 1 |HTTPDNS is used in automatic mode. When the specified HTTPDNS server is unavailable for resolution, the component will fall back to the system DNS server.| +| SecureOnly | 2 |The specified HTTPDNS server is forcibly used for DNS resolution.| diff --git a/en/application-dev/reference/apis/js-apis-wifiManager.md b/en/application-dev/reference/apis/js-apis-wifiManager.md index c4b50a6993017a534e846fc2edb761ae0f74e12d..dc9beb94d7fcc13d6c82e805bf8855d537e907bd 100644 --- a/en/application-dev/reference/apis/js-apis-wifiManager.md +++ b/en/application-dev/reference/apis/js-apis-wifiManager.md @@ -127,7 +127,7 @@ Obtains the scan result. This API uses a promise to return the result. | **Type**| **Description**| | -------- | -------- | - | Promise< Array<[WifiScanInfo](#wifiscaninfo)> > | Promise used to return the detected hotspots.| + | Promise< Array<[WifiScanInfo](#wifiscaninfo)> > | Promise used to return the hotspots detected.| **Error codes** @@ -409,6 +409,8 @@ Represents EAP configuration information. | caCertAliases | string | Yes| No| CA certificate alias.| | caPath | string | Yes| No| CA certificate path.| | clientCertAliases | string | Yes| No| Client certificate alias.| +| certEntry | Uint8Array | Yes| Yes| CA certificate content.| +| certPassword | string | Yes| Yes| CA certificate password.| | altSubjectMatch | string | Yes| No| A string to match the alternate subject.| | domainSuffixMatch | string | Yes| No| A string to match the domain suffix.| | realm | string | Yes| No| Realm for the passpoint credential.| diff --git a/en/application-dev/reference/apis/js-apis-wifiManagerExt.md b/en/application-dev/reference/apis/js-apis-wifiManagerExt.md index 852b58547ddaf7b5c6eac648016d400ed13f35f9..4d9f1c83dd5fb5739f63520ce52c132c514d0fa7 100644 --- a/en/application-dev/reference/apis/js-apis-wifiManagerExt.md +++ b/en/application-dev/reference/apis/js-apis-wifiManagerExt.md @@ -2,8 +2,9 @@ This **wifiext** module provides WLAN extension interfaces for non-universal products. > **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 described in this document are used only for non-universal products, such as routers. +> +> - 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 described in this document are used only for non-universal products, such as routers. ## Modules to Import @@ -12,9 +13,9 @@ The APIs described in this document are used only for non-universal products, su import wifiManagerExt from '@ohos.wifiManagerExt'; ``` -## wifiext.enableHotspot +## wifiext.enableHotspot9+ -enableHotspot(): boolean; +enableHotspot(): void; Enables the WLAN hotspot. @@ -27,12 +28,12 @@ Enables the WLAN hotspot. For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). | **Type**| **Description**| - | -------- | -------- | +| -------- | -------- | | 2701000 | Operation failed.| -## wifiext.disableHotspot +## wifiext.disableHotspot9+ -disableHotspot(): boolean; +disableHotspot(): void; Disables the WLAN hotspot. @@ -45,14 +46,14 @@ Disables the WLAN hotspot. For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). | **Type**| **Description**| - | -------- | -------- | +| -------- | -------- | | 2701000 | Operation failed.| -## wifiext.getSupportedPowerModel +## wifiext.getSupportedPowerMode9+ -getSupportedPowerModel(): Promise<Array<PowerModel>> +getSupportedPowerMode(): Promise<Array<PowerMode>> -Obtains the supported power models. This API uses a promise to return the result. +Obtains the supported power modes. This API uses a promise to return the result. **Required permissions**: ohos.permission.GET_WIFI_INFO @@ -60,21 +61,21 @@ Obtains the supported power models. This API uses a promise to return the result **Return value** - | Type| Description| - | -------- | -------- | - | Promise<Array<[PowerModel](#powermodel)>> | Promise used to return the power models obtained.| +| Type| Description| +| -------- | -------- | +| Promise<Array<[PowerMode](#powermode)>> | Promise used to return the power modes obtained.| **Error codes** For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). | **Type**| **Description**| - | -------- | -------- | +| -------- | -------- | | 2701000 | Operation failed.| -## PowerModel +## PowerMode -Enumerates the power models. +Enumerates the power modes. **System capability**: SystemCapability.Communication.WiFi.AP.Extension @@ -85,11 +86,11 @@ Enumerates the power models. | THROUGH_WALL | 2 | Through_wall| -## wifiext.getSupportedPowerModel +## wifiext.getSupportedPowerMode9+ -getSupportedPowerModel(callback: AsyncCallback<Array<PowerModel>>): void +getSupportedPowerMode(callback: AsyncCallback<Array<PowerMode>>): void -Obtains the supported power models. This API uses an asynchronous callback to return the result. +Obtains the supported power modes. This API uses an asynchronous callback to return the result. **Required permissions**: ohos.permission.GET_WIFI_INFO @@ -97,23 +98,23 @@ Obtains the supported power models. This API uses an asynchronous callback to re **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<Array<[PowerModel](#powermodel)>> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the power models obtained. If **err** is not **0**, an error has occurred.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| callback | AsyncCallback<Array<[PowerMode](#powermode)>> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the power modes obtained. If **err** is not **0**, an error has occurred.| **Error codes** For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). | **Type**| **Description**| - | -------- | -------- | +| -------- | -------- | | 2701000 | Operation failed.| -## wifiext.getPowerModel +## wifiext.getPowerMode9+ -getPowerModel(): Promise<PowerModel> +getPowerMode(): Promise<PowerMode> -Obtains the power model. This API uses a promise to return the result. +Obtains the power mode. This API uses a promise to return the result. **Required permissions**: ohos.permission.GET_WIFI_INFO @@ -121,23 +122,23 @@ Obtains the power model. This API uses a promise to return the result. **Return value** - | Type| Description| - | -------- | -------- | - | Promise<[PowerModel](#powermodel)> | Promise used to return the power models obtained.| +| Type| Description| +| -------- | -------- | +| Promise<[PowerMode](#powermode)> | Promise used to return the power modes obtained.| **Error codes** For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). | **Type**| **Description**| - | -------- | -------- | +| -------- | -------- | | 2701000 | Operation failed.| -## wifiext.getPowerModel +## wifiext.getPowerMode9+ -getPowerModel(callback: AsyncCallback<PowerModel>): void +getPowerMode(callback: AsyncCallback<PowerMode>): void -Obtains the power model. This API uses an asynchronous callback to return the result. +Obtains the power mode. This API uses an asynchronous callback to return the result. **Required permissions**: ohos.permission.GET_WIFI_INFO @@ -145,23 +146,23 @@ Obtains the power model. This API uses an asynchronous callback to return the re **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<[PowerModel](#powermodel)> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the power model obtained. If **err** is not **0**, an error has occurred.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| callback | AsyncCallback<[PowerMode](#powermode)> | Yes| Callback invoked to return the result. If the operation is successful, **err** is **0** and **data** is the power mode obtained. If **err** is not **0**, an error has occurred.| **Error codes** For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). | **Type**| **Description**| - | -------- | -------- | +| -------- | -------- | | 2701000 | Operation failed.| -## wifiext.setPowerModel +## wifiext.setPowerMode9+ -setPowerModel(model: PowerModel) : boolean; +setPowerMode(model: PowerMode) : boolean; - Sets the power model. + Sets the power mode. **Required permissions**: ohos.permission.MANAGE_WIFI_HOTSPOT_EXT @@ -169,14 +170,14 @@ setPowerModel(model: PowerModel) : boolean; **Parameters** - | Name| Type| Mandatory| Description| - | -------- | -------- | -------- | -------- | - | model | [PowerModel](#powermodel) | Yes| Power model to set.| +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| model | [PowerMode](#powermode) | Yes| Power mode to set.| **Error codes** For details about the error codes, see [Wi-Fi Error Codes](../errorcodes/errorcode-wifi.md). | **Type**| **Description**| - | -------- | -------- | +| -------- | -------- | | 2701000 | Operation failed.| diff --git a/en/application-dev/reference/apis/js-apis-window.md b/en/application-dev/reference/apis/js-apis-window.md index f8a8d90d0e6eea8ad7a95cb49fe873c7a82d41a5..26fd78b642da4a588bec3a06e12a1b591681da62 100644 --- a/en/application-dev/reference/apis/js-apis-window.md +++ b/en/application-dev/reference/apis/js-apis-window.md @@ -40,7 +40,7 @@ Enumerates the window types. | TYPE_LAUNCHER_DOCK9+ | 12 | Dock bar on the home screen.
**Model restriction**: This API can be used only in the stage model.
**System API**: This is a system API.| | TYPE_VOICE_INTERACTION9+ | 13 | Voice assistant.
**Model restriction**: This API can be used only in the stage model.
**System API**: This is a system API.| | TYPE_POINTER9+ | 14 | Mouse.
**Model restriction**: This API can be used only in the stage model.
**System API**: This is a system API.| -| TYPE_FLOAT_CAMERA9+ | 15 | Floating camera window.
**Model restriction**: This API can be used only in the stage model.
**Required permissions**: ohos.permission.SYSTEM_FLOAT_WINDOW| +| TYPE_FLOAT_CAMERA9+ | 15 | Floating camera window.
**Model restriction**: This API can be used only in the stage model.
**System API**: This is a system API.| | TYPE_DIALOG9+ | 16 | Modal window.
**Model restriction**: This API can be used only in the stage model.
**System API**: This is a system API.| | TYPE_SCREENSHOT9+ | 17 | Screenshot window.
**Model restriction**: This API can be used only in the stage model.
**System API**: This is a system API.| @@ -4671,6 +4671,100 @@ try { ``` +### setWaterMarkFlag10+ + +setWaterMarkFlag(enable: boolean): Promise<void> + +Adds or deletes the watermark flag for this window. This API uses a promise to return the result. + +**System API**: This is a system API. + +**System capability**: SystemCapability.WindowManager.WindowManager.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------ | ------- | --------- | ------------------------------------------------------------ | +| enable | boolean | Yes | Whether to add or delete the watermark flag to the window. The value **true** means to add the watermark flag and **false** means to delete the watermark flag. | + +**Return value** + +| Type | Description | +| ------------------- | ------------------------------ | +| Promise<void> | Promise that returns no value. | + +**Error codes** + +For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md). + +| ID | Error Message | +| ------- | --------------------------------------------- | +| 1300002 | This window state is abnormal. | +| 1300003 | This window manager service works abnormally. | +| 1300008 | The operation is on invalid display. | + +**Example** + +```js +try { + let enable = true; + let promise = windowClass.setWaterMarkFlag(enable); + promise.then(()=> { + console.info('Succeeded in setting water mark flag of window.'); + }).catch((err)=>{ + console.error('Failed to set water mark flag of window. Cause:' + JSON.stringify(err)); + }); +} catch (exception) { + console.error('Failed to set water mark flag of window. Cause: ' + JSON.stringify(exception)); +} + +``` + +### setWaterMarkFlag10+ + +setWaterMarkFlag(enable: boolean, callback: AsyncCallback<void>): void + +Adds or deletes the watermark flag for this window. This API uses an asynchronous callback to return the result. + +**System API**: This is a system API. + +**System capability**: SystemCapability.WindowManager.WindowManager.Core + +**Parameters** + +| Name | Type | Mandatory | Description | +| -------- | ------------------------- | --------- | ------------------------------------------------------------ | +| enable | boolean | Yes | Whether to add or delete the watermark flag to the window. The value **true** means to add the watermark flag and **false** means to delete the watermark flag. | +| callback | AsyncCallback<void> | Yes | Callback used to return the result. | + +**Error codes** + +For details about the error codes, see [Window Error Codes](../errorcodes/errorcode-window.md). + +| ID | Error Message | +| ------- | --------------------------------------------- | +| 1300002 | This window state is abnormal. | +| 1300003 | This window manager service works abnormally. | +| 1300008 | The operation is on invalid display. | + +**Example** + +```js +try { + let enable = true; + windowClass.setWaterMarkFlag(enable, (err) => { + if (err.code) { + console.error('Failed to set water mark flag of window. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in setting water mark flag of window.'); + }); +} catch (exception) { + console.error('Failed to set water mark flag of window. Cause: ' + JSON.stringify(exception)); +} + +``` + ### show(deprecated) show(callback: AsyncCallback<void>): void @@ -7212,6 +7306,7 @@ controller.animationForShown = (context : window.TransitionContext) => { ); console.info('complete transition end'); }; + ``` ### animationForHidden9+ diff --git a/en/application-dev/reference/apis/js-apis-worker.md b/en/application-dev/reference/apis/js-apis-worker.md index db8a73c0ff0b29ca6c753073f8ea0d297b19ccb8..88371d4cf32bcbb1686b66f0eaf18e2a4819f3e4 100644 --- a/en/application-dev/reference/apis/js-apis-worker.md +++ b/en/application-dev/reference/apis/js-apis-worker.md @@ -82,24 +82,32 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco import worker from '@ohos.worker'; // Create a Worker instance. -// In the FA model, the worker script directory and pages directory are at the same level. +// In the FA model, the workers directory is at the same level as the pages directory in the entry module. const workerFAModel01 = new worker.ThreadWorker("workers/worker.js", {name:"first worker in FA model"}); -// In the FA model, the worker script directory and pages directory are at different levels. +// In the FA model, the workers directory is at the same level as the parent directory of the pages directory in the entry module. const workerFAModel02 = new worker.ThreadWorker("../workers/worker.js"); -// In the stage model, the worker script directory and pages directory are at the same level. +// In the stage model, the workers directory is at the same level as the pages directory in the entry module. const workerStageModel01 = new worker.ThreadWorker('entry/ets/workers/worker.ts', {name:"first worker in Stage model"}); -// In the stage model, the worker script directory and pages directory are at different levels. +// In the stage model, the workers directory is at the same level as the parent directory of the pages directory in the entry module. const workerStageModel02 = new worker.ThreadWorker('entry/ets/pages/workers/worker.ts'); // For the script URL "entry/ets/workers/worker.ts" in the stage model: -// entry is the value of the name attribute under module in the module.json5 file. -// ets indicates the programming language in use. +// entry is the value of the name attribute under module in the module.json5 file, and ets indicates the programming language in use. +// The script URL is related to the level of the workers directory where the worker file is located and is irrelevant to the file where the new worker is located. + +// In the esmodule build scenario of the stage model, the script URL specification @bundle:bundlename/entryname/ets/workerdir/workerfile is added. +// @bundle is a fixed label, bundlename indicates the bundle name, entryname indicates the module name, and ets indicates the programming language in use. +// workerdir indicates the directory where the worker file is located, and workerfile indicates the worker file name. +// In the stage model, the workers directory is at the same level as the pages directory in the entry module, and bundlename is com.example.workerdemo. +const workerStageModel03 = new worker.ThreadWorker('@bundle:com.example.workerdemo/entry/ets/workers/worker'); +// In the stage model, the workers directory is at the same level as the parent directory of the pages directory in the entry module, and bundlename is com.example.workerdemo. +const workerStageModel04 = new worker.ThreadWorker('@bundle:com.example.workerdemo/entry/ets/pages/workers/worker'); ``` -Depending on whether the worker script directory and **pages** directory are at the same level, you may need to configure the **buildOption** attribute in the **build-profile.json5** file. +Depending on whether the **workers** directory and **pages** directory are at the same level, you may need to configure the **buildOption** attribute in the **build-profile.json5** file. -(1) The worker script directory and **pages** directory are at the same level. +(1) The **workers** directory and **pages** directory are at the same level. In the FA model: @@ -125,7 +133,7 @@ In the stage model: } ``` -(2) The worker script directory and **pages** directory are at different levels. +(2) The **workers** directory and **pages** directory are at different levels. In the FA model: @@ -178,7 +186,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.postMessage("hello world"); @@ -213,7 +221,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.postMessage("hello world"); @@ -248,7 +256,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.on("alert", (e)=>{ console.log("alert listener callback"); }) @@ -282,7 +290,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.once("alert", (e)=>{ console.log("alert listener callback"); }) @@ -316,7 +324,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); // Use on, once, or addEventListener to add a listener for the "alert" event, and use off to remove the listener. workerInstance.off("alert"); ``` @@ -341,7 +349,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.terminate(); ``` @@ -372,7 +380,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.onexit = function(e) { console.log("onexit"); } @@ -412,7 +420,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.onerror = function(e) { console.log("onerror"); } @@ -445,7 +453,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.onmessage = function(e) { // e: MessageEvents. The usage is as follows: // let data = e.data; @@ -480,7 +488,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.onmessageerror= function(e) { console.log("onmessageerror"); } @@ -513,7 +521,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.addEventListener("alert", (e)=>{ console.log("alert listener callback"); }) @@ -546,7 +554,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.addEventListener("alert", (e)=>{ console.log("alert listener callback"); }) @@ -585,7 +593,16 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); + +workerInstance.dispatchEvent({type:"eventType", timeStamp:0}); // timeStamp is not supported yet. +``` + +The **dispatchEvent** API can be used together with the **on**, **once**, and **addEventListener** APIs. The sample code is as follows: + +```js +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); + // Usage 1: workerInstance.on("alert_on", (e)=>{ console.log("alert listener callback"); @@ -643,7 +660,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.addEventListener("alert", (e)=>{ console.log("alert listener callback"); }) @@ -679,7 +696,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.addEventListener("alert", (e)=>{ console.log("alert listener callback"); }) @@ -699,7 +716,7 @@ Removes an event listener for the worker thread. This API provides the same func | Name | Type | Mandatory| Description | | -------- | -------------------------------------------- | ---- | ---------------------------- | | type | string | Yes | Type of the event for which the event listener is to be removed. | -| callback | [WorkerEventListener](#workereventlistener9) | No| Callback to invoke when an event of the specified type occurs. | +| callback | [WorkerEventListener](#workereventlistener9) | No| Callback to invoke when an event of the specified type occurs. Callback of the event listener to remove.| **Error codes** @@ -712,7 +729,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.addEventListener("alert", (e)=>{ console.log("alert listener callback"); }) @@ -751,7 +768,16 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); + +workerInstance.dispatchEvent({type:"eventType", timeStamp:0}); // timeStamp is not supported yet. +``` + +The **dispatchEvent** API can be used together with the **on**, **once**, and **addEventListener** APIs. The sample code is as follows: + +```js +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); + // Usage 1: workerInstance.on("alert_on", (e)=>{ console.log("alert listener callback"); @@ -768,7 +794,7 @@ workerInstance.dispatchEvent({type:"alert_once", timeStamp:0});// timeStamp is n // The event listener created by on will not be proactively deleted. workerInstance.dispatchEvent({type:"alert_on", timeStamp:0}); workerInstance.dispatchEvent({type:"alert_on", timeStamp:0}); -// The event listener created by addEventListener will not be proactively deleted. +// The event listener created by addEventListener will be always valid and will not be proactively deleted. workerInstance.dispatchEvent({type:"alert_add", timeStamp:0}); workerInstance.dispatchEvent({type:"alert_add", timeStamp:0}); @@ -809,7 +835,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.addEventListener("alert", (e)=>{ console.log("alert listener callback"); }) @@ -850,7 +876,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco ```js // main.js import worker from '@ohos.worker'; -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.postMessage("hello world"); workerInstance.onmessage = function(e) { // let data = e.data; @@ -859,7 +885,7 @@ workerInstance.onmessage = function(e) { ``` ```js -// worker.js +// worker.ts import worker from '@ohos.worker'; const workerPort = worker.workerPort; workerPort.onmessage = function(e){ @@ -898,7 +924,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco ```js // main.js import worker from '@ohos.worker'; -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.postMessage("hello world"); workerInstance.onmessage = function(e) { // let data = e.data; @@ -907,7 +933,7 @@ workerInstance.onmessage = function(e) { ``` ```js -// worker.js +// worker.ts import worker from '@ohos.worker'; const workerPort = worker.workerPort; workerPort.onmessage = function(e){ @@ -938,11 +964,11 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco ```js // main.js import worker from '@ohos.worker'; -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); ``` ```js -// worker.js +// worker.ts import worker from '@ohos.worker'; const workerPort = worker.workerPort; workerPort.onmessage = function(e) { @@ -980,12 +1006,12 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco ```js // main.js import worker from '@ohos.worker'; -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.postMessage("hello world"); ``` ```js -// worker.js +// worker.ts import worker from '@ohos.worker'; const workerPort = worker.workerPort; workerPort.onmessage = function(e) { @@ -1023,11 +1049,11 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco ```js // main.js import worker from '@ohos.worker'; -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); ``` ```js -// worker.js +// worker.ts import worker from '@ohos.worker'; const parentPort = worker.workerPort; parentPort.onmessageerror = function(e) { @@ -1068,7 +1094,7 @@ For details about the error codes, see [Utils Error Codes](../errorcodes/errorco **Example** ```js -const workerInstance = new worker.ThreadWorker("workers/worker.js"); +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts"); workerInstance.addEventListener("alert", (e)=>{ console.log("alert listener callback"); }) @@ -1108,11 +1134,11 @@ Defines the event handler to be called when an exception occurs during worker ex ```js // main.js import worker from '@ohos.worker'; -const workerInstance = new worker.ThreadWorker("workers/worker.js") +const workerInstance = new worker.ThreadWorker("entry/ets/workers/worker.ts") ``` ```js -// worker.js +// worker.ts import worker from '@ohos.worker'; const workerPort = worker.workerPort workerPort.onerror = function(e){ @@ -1168,23 +1194,23 @@ A constructor used to create a **Worker** instance. import worker from '@ohos.worker'; // Create a Worker instance. -// In the FA model, the worker script directory and pages directory are at the same level. +// In the FA model, the workers directory is at the same level as the pages directory. const workerFAModel01 = new worker.Worker("workers/worker.js", {name:"first worker in FA model"}); -// In the FA model, the worker script directory and pages directory are at different levels. +// In the FA model, the workers directory is at the same level as the parent directory of the pages directory. const workerFAModel02 = new worker.Worker("../workers/worker.js"); -// In the stage model, the worker script directory and pages directory are at the same level. +// In the stage model, the workers directory is at the same level as the pages directory. const workerStageModel01 = new worker.Worker('entry/ets/workers/worker.ts', {name:"first worker in Stage model"}); -// In the stage model, the worker script directory and pages directory are at different levels. +// In the stage model, the workers directory is at the same level as the child directory of the pages directory. const workerStageModel02 = new worker.Worker('entry/ets/pages/workers/worker.ts'); // For the script URL "entry/ets/workers/worker.ts" in the stage model: // entry is the value of the name attribute under module in the module.json5 file. // ets indicates the programming language in use. ``` -Depending on whether the worker script directory and **pages** directory are at the same level, you may need to configure the **buildOption** attribute in the **build-profile.json5** file. +Depending on whether the **workers** directory and **pages** directory are at the same level, you may need to configure the **buildOption** attribute in the **build-profile.json5** file. -(1) The worker script directory and **pages** directory are at the same level. +(1) The **workers** directory and **pages** directory are at the same level. In the FA model: @@ -1207,7 +1233,7 @@ In the stage model: } } ``` -(2) The worker script directory and **pages** directory are at different levels. +(2) The **workers** directory and **pages** directory are at different levels. In the FA model: ```json @@ -1594,6 +1620,14 @@ Dispatches the event defined for the worker thread. ```js const workerInstance = new worker.Worker("workers/worker.js"); +workerInstance.dispatchEvent({type:"eventType", timeStamp:0}); // timeStamp is not supported yet. +``` + +The **dispatchEvent** API can be used together with the **on**, **once**, and **addEventListener** APIs. The sample code is as follows: + +```js +const workerInstance = new worker.Worker("workers/worker.js"); + // Usage 1: workerInstance.on("alert_on", (e)=>{ console.log("alert listener callback"); @@ -2056,7 +2090,7 @@ Each actor concurrently processes tasks of the main thread. For each actor, ther ### FA Model ```js -// main.js (The following assumes that the worker script directory and pages directory are at the same level.) +// main.js (The following assumes that the workers directory and pages directory are at the same level.) import worker from '@ohos.worker'; // Create a Worker instance in the main thread. const workerInstance = new worker.ThreadWorker("workers/worker.ts"); @@ -2121,7 +2155,7 @@ Configuration of the **build-profile.json5** file: ``` ### Stage Model ```js -// main.js (The following assumes that the worker script directory and pages directory are at different levels.) +// main.js (The following assumes that the workers directory and pages directory are at different levels.) import worker from '@ohos.worker'; // Create a Worker instance in the main thread. diff --git a/en/application-dev/reference/apis/js-apis-xml.md b/en/application-dev/reference/apis/js-apis-xml.md index 2f793c39a2234eb16b30d634d53279d1b1c70de3..5259aede120c7b89b0ade477f8fb1bb27490cc1a 100644 --- a/en/application-dev/reference/apis/js-apis-xml.md +++ b/en/application-dev/reference/apis/js-apis-xml.md @@ -457,7 +457,7 @@ function func(key, value){ arrTag[i] = 'key:'+key+' value:'+ value.getDepth(); str += arrTag[i]; i++; - return true; // Determines whether to continuely parse, which is used to continue or terminate parsing. + return true; // Determines whether to continually parse, which is used to continue or terminate parsing. } let options = {supportDoctype:true, ignoreNameSpace:true, tokenValueCallbackFunction:func} that.parse(options); @@ -528,7 +528,7 @@ function func(key, value){ arrTag[i] = 'key:'+key+' value:'+ value.getColumnNumber(); str += arrTag[i]; i++; - return true; // Determines whether to continuely parse, which is used to continue or terminate parsing. + return true; // Determines whether to continually parse, which is used to continue or terminate parsing. } let options = {supportDoctype:true, ignoreNameSpace:true, tokenValueCallbackFunction:func} that.parse(options); @@ -575,7 +575,7 @@ function func(key, value){ arrTag[i] = 'key:'+key+' value:'+ value.getDepth(); str += arrTag[i]; i++; - return true; // Determines whether to continuely parse, which is used to continue or terminate parsing. + return true; // Determines whether to continually parse, which is used to continue or terminate parsing. } let options = {supportDoctype:true, ignoreNameSpace:true, tokenValueCallbackFunction:func} that.parse(options); @@ -625,7 +625,7 @@ function func(key, value){ arrTag[i] = 'key:'+key+' value:'+ value.getLineNumber(); str += arrTag[i]; i++; - return true; // Determines whether to continuely parse, which is used to continue or terminate parsing. + return true; // Determines whether to continually parse, which is used to continue or terminate parsing. } let options = {supportDoctype:true, ignoreNameSpace:true, tokenValueCallbackFunction:func} that.parse(options); @@ -672,7 +672,7 @@ function func(key, value){ arrTag[i] = 'key:'+key+' value:'+ value.getName(); str += arrTag[i]; i++; - return true; // Determines whether to continuely parse, which is used to continue or terminate parsing. + return true; // Determines whether to continually parse, which is used to continue or terminate parsing. } let options = {supportDoctype:true, ignoreNameSpace:true, tokenValueCallbackFunction:func} that.parse(options); @@ -718,7 +718,7 @@ function func(key, value){ arrTag[i] = 'key:'+key+' value:'+ value.getNamespace(); str += arrTag[i]; i++; - return true; // Determines whether to continuely parse, which is used to continue or terminate parsing. + return true; // Determines whether to continually parse, which is used to continue or terminate parsing. } let options = {supportDoctype:true, ignoreNameSpace:true, tokenValueCallbackFunction:func} that.parse(options); @@ -764,7 +764,7 @@ function func(key, value){ arrTag[i] = 'key:'+key+' value:'+ value.getPrefix(); str += arrTag[i]; i++; - return true; // Determines whether to continuely parse, which is used to continue or terminate parsing. + return true; // Determines whether to continually parse, which is used to continue or terminate parsing. } let options = {supportDoctype:true, ignoreNameSpace:true, tokenValueCallbackFunction:func} that.parse(options); @@ -811,7 +811,7 @@ function func(key, value){ arrTag[i] = 'key:'+key+' value:'+ value.getText(); str += arrTag[i]; i++; - return true; // Determines whether to continuely parse, which is used to continue or terminate parsing. + return true; // Determines whether to continually parse, which is used to continue or terminate parsing. } let options = {supportDoctype:true, ignoreNameSpace:true, tokenValueCallbackFunction:func} that.parse(options); @@ -857,7 +857,7 @@ function func(key, value){ arrTag[i] = 'key:'+key+' value:'+ value.isEmptyElementTag(); str += arrTag[i]; i++; - return true; // Determines whether to continuely parse, which is used to continue or terminate parsing. + return true; // Determines whether to continually parse, which is used to continue or terminate parsing. } let options = {supportDoctype:true, ignoreNameSpace:true, tokenValueCallbackFunction:func} that.parse(options); @@ -903,7 +903,7 @@ function func(key, value){ arrTag[i] = 'key:'+key+' value:'+ value.isWhitespace(); str += arrTag[i]; i++; - return true; // Determines whether to continuely parse, which is used to continue or terminate parsing. + return true; // Determines whether to continually parse, which is used to continue or terminate parsing. } let options = {supportDoctype:true, ignoreNameSpace:true, tokenValueCallbackFunction:func} that.parse(options); @@ -948,7 +948,7 @@ function func(key, value){ arrTag[i] = 'key:'+key+' value:'+ value.getAttributeCount(); str += arrTag[i]; i++; - return true; // Determines whether to continuely parse, which is used to continue or terminate parsing. + return true; // Determines whether to continually parse, which is used to continue or terminate parsing. } let options = {supportDoctype:true, ignoreNameSpace:true, tokenValueCallbackFunction:func} that.parse(options); diff --git a/en/application-dev/reference/arkui-js-lite/Readme-EN.md b/en/application-dev/reference/arkui-js-lite/Readme-EN.md new file mode 100644 index 0000000000000000000000000000000000000000..4dbc7b08dbed8356f7cb907c3dbebff5c5b09bf5 --- /dev/null +++ b/en/application-dev/reference/arkui-js-lite/Readme-EN.md @@ -0,0 +1,37 @@ +# JavaScript-compatible Web-like Development Paradigm (ArkUI.Lite) + +- Framework Overview + - [File Organization](js-framework-file.md) + - ["js" Tag](js-framework-js-tag.md) + - [app.js](js-framework-js-file.md) + - Syntax + - [HML](js-framework-syntax-hml.md) + - [CSS](js-framework-syntax-css.md) + - [JavaScript](js-framework-syntax-js.md) +- Universal Component Information + - [Universal Events](js-common-events.md) + - [Universal Attributes](js-common-attributes.md) + - [Universal Styles](js-common-styles.md) + - [Animation Styles](js-components-common-animation.md) + - [Media Query](js-components-common-mediaquery.md) +- Container Components + - [div](js-components-container-div.md) + - [list](js-components-container-list.md) + - [list-item](js-components-container-list-item.md) + - [stack](js-components-container-stack.md) + - [swiper](js-components-container-swiper.md) +- Basic Components + - [chart](js-components-basic-chart.md) + - [image](js-components-basic-image.md) + - [image-animator](js-components-basic-image-animator.md) + - [input](js-components-basic-input.md) + - [marquee](js-components-basic-marquee.md) + - [picker-view](js-components-basic-picker-view.md) + - [progress](js-components-basic-progress.md) + - [qrcode](js-components-basic-qrcode.md) + - [slider](js-components-basic-slider.md) + - [switch](js-components-basic-switch.md) + - [text](js-components-basic-text.md) +- Canvas Components + - [canvas](js-components-canvas-canvas.md) + - [CanvasRenderingContext2D](js-components-canvas-canvasrenderingcontext2d.md) diff --git a/en/application-dev/reference/arkui-js-lite/figures/#000000.png b/en/application-dev/reference/arkui-js-lite/figures/#000000.png new file mode 100644 index 0000000000000000000000000000000000000000..58293d5e874f2aa36ecaf7282ca9e4736318092f Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/#000000.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/GIF.gif b/en/application-dev/reference/arkui-js-lite/figures/GIF.gif new file mode 100644 index 0000000000000000000000000000000000000000..fa77bb91654623c2de68a19e7f9f95bbd1d029bc Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/GIF.gif differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/aliceblue.png b/en/application-dev/reference/arkui-js-lite/figures/aliceblue.png new file mode 100644 index 0000000000000000000000000000000000000000..378000d344e90ab4db41869a4612daf6b60d66ab Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/aliceblue.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/animation-demo1.gif b/en/application-dev/reference/arkui-js-lite/figures/animation-demo1.gif new file mode 100644 index 0000000000000000000000000000000000000000..fc1eadbb05520daa6d79779683db96d0afe7cbdd Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/animation-demo1.gif differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/animation-demo2.gif b/en/application-dev/reference/arkui-js-lite/figures/animation-demo2.gif new file mode 100644 index 0000000000000000000000000000000000000000..c3d337edf8e35352dcc9d9b9919019e1f7ec4d96 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/animation-demo2.gif differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/antiquewhite.png b/en/application-dev/reference/arkui-js-lite/figures/antiquewhite.png new file mode 100644 index 0000000000000000000000000000000000000000..8e195633945b3387c46a7d295862351d4ff1fc64 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/antiquewhite.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/aqua.png b/en/application-dev/reference/arkui-js-lite/figures/aqua.png new file mode 100644 index 0000000000000000000000000000000000000000..3e6aaacfe1c26157294e6dedfeaa1488aeed12a3 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/aqua.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/aquamarine.png b/en/application-dev/reference/arkui-js-lite/figures/aquamarine.png new file mode 100644 index 0000000000000000000000000000000000000000..c25a692065d473ccf9f5b6d36254787e2497fad6 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/aquamarine.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/azure.png b/en/application-dev/reference/arkui-js-lite/figures/azure.png new file mode 100644 index 0000000000000000000000000000000000000000..2e7cec00f9d186d76ff5cb12d47811084217cc1c Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/azure.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/barchart.PNG b/en/application-dev/reference/arkui-js-lite/figures/barchart.PNG new file mode 100644 index 0000000000000000000000000000000000000000..aa4ba3f9fa64250b1b86bd6d39b6a8071d3de1c3 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/barchart.PNG differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/beige.png b/en/application-dev/reference/arkui-js-lite/figures/beige.png new file mode 100644 index 0000000000000000000000000000000000000000..21f20a4220aabf9449c707291633e7b3723fe378 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/beige.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/bisque.png b/en/application-dev/reference/arkui-js-lite/figures/bisque.png new file mode 100644 index 0000000000000000000000000000000000000000..7983d590a2c617c6cad68c90af6b12aa17518810 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/bisque.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/blanchedalmond.png b/en/application-dev/reference/arkui-js-lite/figures/blanchedalmond.png new file mode 100644 index 0000000000000000000000000000000000000000..04bcf099edface801be6074a33ff33a980c9b606 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/blanchedalmond.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/blue.png b/en/application-dev/reference/arkui-js-lite/figures/blue.png new file mode 100644 index 0000000000000000000000000000000000000000..e370a44cf043fc34bd8891f57faad2cd2ca05707 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/blue.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/blueviolet.png b/en/application-dev/reference/arkui-js-lite/figures/blueviolet.png new file mode 100644 index 0000000000000000000000000000000000000000..ca1edf2219980ab9c8533b9fda3219521c50533d Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/blueviolet.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/brown.png b/en/application-dev/reference/arkui-js-lite/figures/brown.png new file mode 100644 index 0000000000000000000000000000000000000000..0d22570503febc7a7dcba0d1e870f49f32fe489a Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/brown.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/burlywood.png b/en/application-dev/reference/arkui-js-lite/figures/burlywood.png new file mode 100644 index 0000000000000000000000000000000000000000..0d53a47b7eace81d5c7da88c59fee61e30c89681 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/burlywood.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/cadetblue.png b/en/application-dev/reference/arkui-js-lite/figures/cadetblue.png new file mode 100644 index 0000000000000000000000000000000000000000..a59bc9cdb0f75ad79e4714d3593216021369c862 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/cadetblue.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/chartreuse.png b/en/application-dev/reference/arkui-js-lite/figures/chartreuse.png new file mode 100644 index 0000000000000000000000000000000000000000..3026d3c195598159232b4b1f08e9f198f4b4fa2c Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/chartreuse.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/chocolate.png b/en/application-dev/reference/arkui-js-lite/figures/chocolate.png new file mode 100644 index 0000000000000000000000000000000000000000..02d5f4e31b020ea9f64e36a7b7cd50299cf3d7f2 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/chocolate.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/coral.png b/en/application-dev/reference/arkui-js-lite/figures/coral.png new file mode 100644 index 0000000000000000000000000000000000000000..8442c9b2258c79ee6b6a3d5963df5b792bbb1a16 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/coral.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/cornflowerblue.png b/en/application-dev/reference/arkui-js-lite/figures/cornflowerblue.png new file mode 100644 index 0000000000000000000000000000000000000000..3621ef6876dbd1103487aed8ff190e6a0204ffde Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/cornflowerblue.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/cornsilk.png b/en/application-dev/reference/arkui-js-lite/figures/cornsilk.png new file mode 100644 index 0000000000000000000000000000000000000000..bf38fe45eaf254939b88b9d2a66635408060acf7 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/cornsilk.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/crimson.png b/en/application-dev/reference/arkui-js-lite/figures/crimson.png new file mode 100644 index 0000000000000000000000000000000000000000..bca655617699ef8dc1265bf692a3170c7effe15b Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/crimson.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/cyan.png b/en/application-dev/reference/arkui-js-lite/figures/cyan.png new file mode 100644 index 0000000000000000000000000000000000000000..3e6aaacfe1c26157294e6dedfeaa1488aeed12a3 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/cyan.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/darkblue.png b/en/application-dev/reference/arkui-js-lite/figures/darkblue.png new file mode 100644 index 0000000000000000000000000000000000000000..b234a769d1a9f1f30c4d2127160cf067e9f71ad6 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/darkblue.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/darkcyan.png b/en/application-dev/reference/arkui-js-lite/figures/darkcyan.png new file mode 100644 index 0000000000000000000000000000000000000000..b780eb08852e8916ec6ff1a401ea6946c8d727cf Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/darkcyan.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/darkgoldenrod.png b/en/application-dev/reference/arkui-js-lite/figures/darkgoldenrod.png new file mode 100644 index 0000000000000000000000000000000000000000..26f2f228b47b8acb8adcddc3abf9156d6c29364e Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/darkgoldenrod.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/darkgray.png b/en/application-dev/reference/arkui-js-lite/figures/darkgray.png new file mode 100644 index 0000000000000000000000000000000000000000..f1abe2afcb7902557ac3c4f58abfdf333af03121 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/darkgray.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/darkgreen.png b/en/application-dev/reference/arkui-js-lite/figures/darkgreen.png new file mode 100644 index 0000000000000000000000000000000000000000..4c4c304b67c398f32c5fff516cdde377ca39c73d Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/darkgreen.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/darkgrey.png b/en/application-dev/reference/arkui-js-lite/figures/darkgrey.png new file mode 100644 index 0000000000000000000000000000000000000000..f1abe2afcb7902557ac3c4f58abfdf333af03121 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/darkgrey.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/darkkhaki.png b/en/application-dev/reference/arkui-js-lite/figures/darkkhaki.png new file mode 100644 index 0000000000000000000000000000000000000000..12085848c0f6472d53f7e6504c1924ea6f5a44c1 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/darkkhaki.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/darkmagenta.png b/en/application-dev/reference/arkui-js-lite/figures/darkmagenta.png new file mode 100644 index 0000000000000000000000000000000000000000..9ed54c6c5c5186fb43f24dab24f7689ae0d14a12 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/darkmagenta.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/darkolivegreen.png b/en/application-dev/reference/arkui-js-lite/figures/darkolivegreen.png new file mode 100644 index 0000000000000000000000000000000000000000..53081e06f458cfc1772de30f669180333b8d783d Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/darkolivegreen.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/darkorange.png b/en/application-dev/reference/arkui-js-lite/figures/darkorange.png new file mode 100644 index 0000000000000000000000000000000000000000..6064f64867e3aca621244e1e6fdb16d3ab2ed748 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/darkorange.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/darkorchid.png b/en/application-dev/reference/arkui-js-lite/figures/darkorchid.png new file mode 100644 index 0000000000000000000000000000000000000000..6315d4654d04dd6b9b295fa1f8b37e8c550b17cf Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/darkorchid.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/darkred.png b/en/application-dev/reference/arkui-js-lite/figures/darkred.png new file mode 100644 index 0000000000000000000000000000000000000000..c33d763d18f5108bf0eedba19c662d05af397ee9 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/darkred.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/darksalmon.png b/en/application-dev/reference/arkui-js-lite/figures/darksalmon.png new file mode 100644 index 0000000000000000000000000000000000000000..57594c6855d4cdf1b37cc3e5354374c9dae0823b Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/darksalmon.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/darkseagreen.png b/en/application-dev/reference/arkui-js-lite/figures/darkseagreen.png new file mode 100644 index 0000000000000000000000000000000000000000..454b1796715794d51e2a1a4649bfafa1bfde80f0 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/darkseagreen.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/darkslateblue.png b/en/application-dev/reference/arkui-js-lite/figures/darkslateblue.png new file mode 100644 index 0000000000000000000000000000000000000000..7dfc7ee8793298d19c939369ba980abd547982ff Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/darkslateblue.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/darkslategray.png b/en/application-dev/reference/arkui-js-lite/figures/darkslategray.png new file mode 100644 index 0000000000000000000000000000000000000000..5e23c304c4911dc0ef487dfeb8d7820aea5fb44b Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/darkslategray.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/darkslategrey.png b/en/application-dev/reference/arkui-js-lite/figures/darkslategrey.png new file mode 100644 index 0000000000000000000000000000000000000000..5e23c304c4911dc0ef487dfeb8d7820aea5fb44b Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/darkslategrey.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/darkturquoise.png b/en/application-dev/reference/arkui-js-lite/figures/darkturquoise.png new file mode 100644 index 0000000000000000000000000000000000000000..4e41450db5d70f6d10d6d7bf59daba33085c177e Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/darkturquoise.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/darkviolet.png b/en/application-dev/reference/arkui-js-lite/figures/darkviolet.png new file mode 100644 index 0000000000000000000000000000000000000000..6f085565bd8c64d44bf58ce0969557515ec7ab97 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/darkviolet.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/deeppink.png b/en/application-dev/reference/arkui-js-lite/figures/deeppink.png new file mode 100644 index 0000000000000000000000000000000000000000..6348bb2b6ee281976f7d58159e4c33db29f542ad Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/deeppink.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/deepskyblue.png b/en/application-dev/reference/arkui-js-lite/figures/deepskyblue.png new file mode 100644 index 0000000000000000000000000000000000000000..0ac129028e67b43fcae8e3d5c1a539cc45ba6d21 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/deepskyblue.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/default.PNG b/en/application-dev/reference/arkui-js-lite/figures/default.PNG new file mode 100644 index 0000000000000000000000000000000000000000..5e4322d20ad887573ad85958bc181a1be0f85f1c Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/default.PNG differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/dimgray.png b/en/application-dev/reference/arkui-js-lite/figures/dimgray.png new file mode 100644 index 0000000000000000000000000000000000000000..1072a50f468dda3c90c889c31424b7c290eb1a13 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/dimgray.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/dimgrey.png b/en/application-dev/reference/arkui-js-lite/figures/dimgrey.png new file mode 100644 index 0000000000000000000000000000000000000000..1072a50f468dda3c90c889c31424b7c290eb1a13 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/dimgrey.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/dodgerblue.png b/en/application-dev/reference/arkui-js-lite/figures/dodgerblue.png new file mode 100644 index 0000000000000000000000000000000000000000..fe422eecde9ec9f1fcac762bd81a23b3fa3abde7 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/dodgerblue.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/ellipse.PNG b/en/application-dev/reference/arkui-js-lite/figures/ellipse.PNG new file mode 100644 index 0000000000000000000000000000000000000000..d0379dfc66b4d2151dae49beeb8af38c774381aa Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/ellipse.PNG differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380789168.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380789168.png new file mode 100644 index 0000000000000000000000000000000000000000..4481b08ab897619b408425f9bfe0fd5b1fcb6ef0 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380789168.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380789172.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380789172.png new file mode 100644 index 0000000000000000000000000000000000000000..9a73bd33782f06a704ed9b288226dfa381d1d57c Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380789172.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380789180.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380789180.png new file mode 100644 index 0000000000000000000000000000000000000000..6e58c669a2976297f71d35c304e988c2884e7dc0 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380789180.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380789184.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380789184.png new file mode 100644 index 0000000000000000000000000000000000000000..5113bc6bad4f88bc2558aae304394e00e107ce88 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380789184.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380789188.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380789188.png new file mode 100644 index 0000000000000000000000000000000000000000..4d0696a9ade017acbbdfb8812dafdec5d715cac5 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380789188.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380789296.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380789296.png new file mode 100644 index 0000000000000000000000000000000000000000..f627659cef03f443e01fb28b44ceb9363369b8d8 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380789296.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380948700.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380948700.png new file mode 100644 index 0000000000000000000000000000000000000000..8f6b4abcc27039c624bd21aad775db7c47a22dea Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380948700.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380948704.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380948704.png new file mode 100644 index 0000000000000000000000000000000000000000..151ef990edbb33e1f54632609990f6c540149a5e Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380948704.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380948708.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380948708.png new file mode 100644 index 0000000000000000000000000000000000000000..e061801d6eeb27d7fee0b287414e512559a87ea9 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380948708.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380948712.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380948712.png new file mode 100644 index 0000000000000000000000000000000000000000..56c65edbcd66a2ebe9d8ef35c55eba90652bca0f Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380948712.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380948716.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380948716.png new file mode 100644 index 0000000000000000000000000000000000000000..db54e678d8c42daca3e56dd85567c9978a9657c8 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380948716.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380948720.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380948720.png new file mode 100644 index 0000000000000000000000000000000000000000..f59a10b44b9e9793bc3a9134f6c4633c8cfb49ce Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380948720.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380948828.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380948828.png new file mode 100644 index 0000000000000000000000000000000000000000..f304daf1f80c86ca6f415e4f7a49b17ca20dae04 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001380948828.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381108312.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381108312.png new file mode 100644 index 0000000000000000000000000000000000000000..3917378fdcb47448e7daf8ae197e6d033fd345e9 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381108312.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381108316.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381108316.png new file mode 100644 index 0000000000000000000000000000000000000000..4c8300af3bdf43e4d2192699b5ed4065fef451c0 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381108316.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381108320.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381108320.png new file mode 100644 index 0000000000000000000000000000000000000000..3404b29dff12b910ae1be71ebf762252895468a8 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381108320.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381108324.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381108324.png new file mode 100644 index 0000000000000000000000000000000000000000..dfee4f8cddcddd2ada89cb6d7e812fd0739d9cb8 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381108324.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381108328.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381108328.png new file mode 100644 index 0000000000000000000000000000000000000000..33787429dd3205f9faac254950e95c097bd63b21 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381108328.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381108332.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381108332.png new file mode 100644 index 0000000000000000000000000000000000000000..67959174e9b810b9278a7940bc097ac0c0738c7e Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381108332.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381108420.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381108420.png new file mode 100644 index 0000000000000000000000000000000000000000..3ecdf0c714fa633f03db339626f51e62318cbf82 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381108420.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381108436.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381108436.png new file mode 100644 index 0000000000000000000000000000000000000000..f6288a0361793fbbce554fd293831fae4bcefc9d Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381108436.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381268264.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381268264.png new file mode 100644 index 0000000000000000000000000000000000000000..0c8973bcb7d55910c6702fe6b9b54506ad3b3727 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381268264.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381268268.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381268268.png new file mode 100644 index 0000000000000000000000000000000000000000..3cc02a6196604a6a3d64b9961c04aaaa51dc829e Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381268268.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381268272.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381268272.png new file mode 100644 index 0000000000000000000000000000000000000000..658dca4b52032016c15f77a94b3ef76c093b1d2c Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381268272.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381268276.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381268276.png new file mode 100644 index 0000000000000000000000000000000000000000..8192453ec25d486b3923da4a25b0a6fe5034d869 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381268276.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381268280.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381268280.png new file mode 100644 index 0000000000000000000000000000000000000000..2f786e33181995c2b5bf5f835df4557ff3f7e9b4 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381268280.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381268284.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381268284.png new file mode 100644 index 0000000000000000000000000000000000000000..9ac4a39e925322831752617b71a77d040626d251 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381268284.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381268388.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381268388.png new file mode 100644 index 0000000000000000000000000000000000000000..366ab30f3e3f9f4b7e8b579b06cd84a76b2bfabc Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001381268388.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431148353.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431148353.png new file mode 100644 index 0000000000000000000000000000000000000000..e89a1b24da145cf480cceb28ed7249b717e614bf Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431148353.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431148357.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431148357.png new file mode 100644 index 0000000000000000000000000000000000000000..68562c1006ec7c61c49c24aec99ecfd173ca055a Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431148357.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431148361.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431148361.png new file mode 100644 index 0000000000000000000000000000000000000000..bd4f47314f89fa4bbbd2d14527dd250b5e3e141b Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431148361.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431148365.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431148365.png new file mode 100644 index 0000000000000000000000000000000000000000..42efd9018bc05408596a768cbbe309f1e46273d7 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431148365.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431148369.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431148369.png new file mode 100644 index 0000000000000000000000000000000000000000..3108e0436219c1c3a7335679cdfea962c49f454d Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431148369.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431148457.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431148457.png new file mode 100644 index 0000000000000000000000000000000000000000..91c55d3677922b76ac78c4e56c87ef90b5b31fc2 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431148457.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431308057.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431308057.png new file mode 100644 index 0000000000000000000000000000000000000000..cc1dc87c79f827c8bb5be3f3771c37f4cb8b214e Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431308057.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431308061.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431308061.png new file mode 100644 index 0000000000000000000000000000000000000000..1362b8a3d98f4edf36420d3799f01476817e43d4 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431308061.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431308065.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431308065.png new file mode 100644 index 0000000000000000000000000000000000000000..2f9a8bacc0f78cb141820e8188d4ae5ef03dc7c1 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431308065.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431308073.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431308073.png new file mode 100644 index 0000000000000000000000000000000000000000..44ae627d6e40dd4b297eccdcf1c5dceef5a08d82 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431308073.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431308077.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431308077.png new file mode 100644 index 0000000000000000000000000000000000000000..f4e18dbe51e815ccdfc6f594e3424850c3b93a12 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431308077.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431308169.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431308169.png new file mode 100644 index 0000000000000000000000000000000000000000..612bc55f4aa5e832133801edf61cef01ffd1bc64 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431308169.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431308185.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431308185.png new file mode 100644 index 0000000000000000000000000000000000000000..3dccd46b21e76a7bbbaabc1ab77a29bd72ae850d Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431308185.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431388505.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431388505.png new file mode 100644 index 0000000000000000000000000000000000000000..47f90714bcb37e4df1b698503db6893d6c2a98c4 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431388505.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431388513.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431388513.png new file mode 100644 index 0000000000000000000000000000000000000000..072d846a3cd629316cd0dcf25d5e9e1e1d3e0dc4 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431388513.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431388517.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431388517.png new file mode 100644 index 0000000000000000000000000000000000000000..5b526bdf7cd539297715bbcddbbd505b7c683695 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431388517.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431388521.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431388521.png new file mode 100644 index 0000000000000000000000000000000000000000..1d5aedb22cb51d00b176f44c5ac5f3ad29d843f2 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431388521.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431388525.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431388525.png new file mode 100644 index 0000000000000000000000000000000000000000..1d71cee4618f1f2822cea1031c9b0e5d602e0a9b Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431388525.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431388529.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431388529.png new file mode 100644 index 0000000000000000000000000000000000000000..8253c65764c8d74e0a25404aa62fdd69d43f3c26 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431388529.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431388581.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431388581.png new file mode 100644 index 0000000000000000000000000000000000000000..bf5ef1c99e764de0e3a0fb0d5e68dc7722f1c0aa Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431388581.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431388637.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431388637.png new file mode 100644 index 0000000000000000000000000000000000000000..f9db5c31c8eae66244cd3f6e11336f72284bb2a6 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431388637.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431548105.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431548105.png new file mode 100644 index 0000000000000000000000000000000000000000..5da42e3e14d601745274cb62d914c6600620bb25 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431548105.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431548109.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431548109.png new file mode 100644 index 0000000000000000000000000000000000000000..63b480df9e9700601da85abef015c8326095851f Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431548109.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431548113.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431548113.png new file mode 100644 index 0000000000000000000000000000000000000000..63f343e89f62b15c117e0148c87ac049308c3117 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431548113.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431548117.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431548117.png new file mode 100644 index 0000000000000000000000000000000000000000..6afdd1b39e4bcb3664c7664a55b47b8537f4aeaa Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431548117.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431548121.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431548121.png new file mode 100644 index 0000000000000000000000000000000000000000..d6bbab16659f4b34b38a714510665ea7fd309055 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431548121.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431548125.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431548125.png new file mode 100644 index 0000000000000000000000000000000000000000..fea0122d3ef81899a02199c6cb265a099ad6c44f Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431548125.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431548233.png b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431548233.png new file mode 100644 index 0000000000000000000000000000000000000000..4cef59797fd8b9650c398562ac0b473485a9274b Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/en-us_image_0000001431548233.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/firebrick.png b/en/application-dev/reference/arkui-js-lite/figures/firebrick.png new file mode 100644 index 0000000000000000000000000000000000000000..af32ecea68c1cef693bcfa379af5ac28f66c1e14 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/firebrick.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/floralwhite.png b/en/application-dev/reference/arkui-js-lite/figures/floralwhite.png new file mode 100644 index 0000000000000000000000000000000000000000..5ee9f7e893611dce988b8aa7ccfe3fab4b9d912f Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/floralwhite.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/forestgreen.png b/en/application-dev/reference/arkui-js-lite/figures/forestgreen.png new file mode 100644 index 0000000000000000000000000000000000000000..7cfd4846ca697424582edbfed23ed93ef9e98138 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/forestgreen.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/fuchsia.png b/en/application-dev/reference/arkui-js-lite/figures/fuchsia.png new file mode 100644 index 0000000000000000000000000000000000000000..6823cbc9203b07abae455b4ee5c7692878c4be72 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/fuchsia.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/gainsboro.png b/en/application-dev/reference/arkui-js-lite/figures/gainsboro.png new file mode 100644 index 0000000000000000000000000000000000000000..d1d37504e15eb6fccd6b1c8e985d37fcc8ba9875 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/gainsboro.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/gauge.PNG b/en/application-dev/reference/arkui-js-lite/figures/gauge.PNG new file mode 100644 index 0000000000000000000000000000000000000000..31c0141d716059519377e1f39b9b8305370f239a Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/gauge.PNG differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/ghostwhite.png b/en/application-dev/reference/arkui-js-lite/figures/ghostwhite.png new file mode 100644 index 0000000000000000000000000000000000000000..45467f3e6fc0866b6da0521911bdb5e7d740df29 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/ghostwhite.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/gold.png b/en/application-dev/reference/arkui-js-lite/figures/gold.png new file mode 100644 index 0000000000000000000000000000000000000000..91a276a7dffb4d98c507e9af6afa1912cca1fed2 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/gold.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/goldenrod.png b/en/application-dev/reference/arkui-js-lite/figures/goldenrod.png new file mode 100644 index 0000000000000000000000000000000000000000..04ab7decab16cb7341665c2a67e8d5655a7eed6a Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/goldenrod.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/gray.png b/en/application-dev/reference/arkui-js-lite/figures/gray.png new file mode 100644 index 0000000000000000000000000000000000000000..dfcb0c5e259b3f8d7375c21712249c1e847edd67 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/gray.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/green.png b/en/application-dev/reference/arkui-js-lite/figures/green.png new file mode 100644 index 0000000000000000000000000000000000000000..bc28f5056c679e189543c8ad6fba67fb56db7655 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/green.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/greenyellow.png b/en/application-dev/reference/arkui-js-lite/figures/greenyellow.png new file mode 100644 index 0000000000000000000000000000000000000000..c89f746719790333bce2bde8c5b8d86102fdfc33 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/greenyellow.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/grey.png b/en/application-dev/reference/arkui-js-lite/figures/grey.png new file mode 100644 index 0000000000000000000000000000000000000000..dfcb0c5e259b3f8d7375c21712249c1e847edd67 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/grey.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/honeydew.png b/en/application-dev/reference/arkui-js-lite/figures/honeydew.png new file mode 100644 index 0000000000000000000000000000000000000000..51fb00e10bb5c167506ddfae1689b58e368df340 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/honeydew.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/hotpink.png b/en/application-dev/reference/arkui-js-lite/figures/hotpink.png new file mode 100644 index 0000000000000000000000000000000000000000..cbc1d312680f479e8c443476ea39eaf1e8a16e55 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/hotpink.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/image-animator.gif b/en/application-dev/reference/arkui-js-lite/figures/image-animator.gif new file mode 100644 index 0000000000000000000000000000000000000000..8321366bdb79b9e6530d53b0f45a6465ae7b967d Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/image-animator.gif differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/image.png b/en/application-dev/reference/arkui-js-lite/figures/image.png new file mode 100644 index 0000000000000000000000000000000000000000..79db22cd94523a8854562e4c8b45ee22d8b45e90 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/image.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/indianred.png b/en/application-dev/reference/arkui-js-lite/figures/indianred.png new file mode 100644 index 0000000000000000000000000000000000000000..069f570291be858a1768b75719a4a6adbd1bdef8 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/indianred.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/indigo.png b/en/application-dev/reference/arkui-js-lite/figures/indigo.png new file mode 100644 index 0000000000000000000000000000000000000000..db83d39f98583ee653ee39b0237eb55961e539c7 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/indigo.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/input-type-button.png b/en/application-dev/reference/arkui-js-lite/figures/input-type-button.png new file mode 100644 index 0000000000000000000000000000000000000000..247fed609d862aa73184f3428486ab62e82bf897 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/input-type-button.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/input-type-checkbox.gif b/en/application-dev/reference/arkui-js-lite/figures/input-type-checkbox.gif new file mode 100644 index 0000000000000000000000000000000000000000..2215e5cfa56f533c6b4d1318b2fa1fb07093dfaa Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/input-type-checkbox.gif differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/input-type-radio.gif b/en/application-dev/reference/arkui-js-lite/figures/input-type-radio.gif new file mode 100644 index 0000000000000000000000000000000000000000..bd5fea51c64deb1268793f3a3f70a2c379aebfda Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/input-type-radio.gif differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/ivory.png b/en/application-dev/reference/arkui-js-lite/figures/ivory.png new file mode 100644 index 0000000000000000000000000000000000000000..ff0aa71de78cb461a6602398ee915c677efdf3d4 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/ivory.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/khaki.png b/en/application-dev/reference/arkui-js-lite/figures/khaki.png new file mode 100644 index 0000000000000000000000000000000000000000..3fca22c329e9dc9ef73eee20757eac4ce7386842 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/khaki.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/lavender.png b/en/application-dev/reference/arkui-js-lite/figures/lavender.png new file mode 100644 index 0000000000000000000000000000000000000000..44e4d991524bd0ef88a0dd10f204e022dd9d0621 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/lavender.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/lavenderblush.png b/en/application-dev/reference/arkui-js-lite/figures/lavenderblush.png new file mode 100644 index 0000000000000000000000000000000000000000..5b22707e37ec772dc08a961e557a937862210167 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/lavenderblush.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/lawngreen.png b/en/application-dev/reference/arkui-js-lite/figures/lawngreen.png new file mode 100644 index 0000000000000000000000000000000000000000..41be1a646e14511b5d177d11a7bce10deaee5bc9 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/lawngreen.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/lemonchiffon.png b/en/application-dev/reference/arkui-js-lite/figures/lemonchiffon.png new file mode 100644 index 0000000000000000000000000000000000000000..d77ed21418dc3035feb9f9c8e15815e577d71a90 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/lemonchiffon.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/lightblue.png b/en/application-dev/reference/arkui-js-lite/figures/lightblue.png new file mode 100644 index 0000000000000000000000000000000000000000..7cc96f8f6364b93923f0a88b895fe6b151080932 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/lightblue.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/lightcoral.png b/en/application-dev/reference/arkui-js-lite/figures/lightcoral.png new file mode 100644 index 0000000000000000000000000000000000000000..515185ab1b3cf9aaba1204760dae19ab3c112b42 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/lightcoral.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/lightcyan.png b/en/application-dev/reference/arkui-js-lite/figures/lightcyan.png new file mode 100644 index 0000000000000000000000000000000000000000..6f929d8ab35b708978d8053047cb56bec4fa83bc Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/lightcyan.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/lightgoldenrodyellow.png b/en/application-dev/reference/arkui-js-lite/figures/lightgoldenrodyellow.png new file mode 100644 index 0000000000000000000000000000000000000000..1b0ed50716d897398c1e9a741e08ff5f1b9fd9de Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/lightgoldenrodyellow.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/lightgray.png b/en/application-dev/reference/arkui-js-lite/figures/lightgray.png new file mode 100644 index 0000000000000000000000000000000000000000..0a5eb251a8d731dc6a9d8b1f31f904c42fd372c3 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/lightgray.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/lightgreen.png b/en/application-dev/reference/arkui-js-lite/figures/lightgreen.png new file mode 100644 index 0000000000000000000000000000000000000000..f89943fc98661a6d2b78b5659c41483308a0c54b Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/lightgreen.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/lightpink.png b/en/application-dev/reference/arkui-js-lite/figures/lightpink.png new file mode 100644 index 0000000000000000000000000000000000000000..6eb2d41877c85cccfb918b042bc13c81c58ec191 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/lightpink.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/lightsalmon.png b/en/application-dev/reference/arkui-js-lite/figures/lightsalmon.png new file mode 100644 index 0000000000000000000000000000000000000000..d87462d1cdc9410e91ee050a53d58e71d1c5f312 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/lightsalmon.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/lightseagreen.png b/en/application-dev/reference/arkui-js-lite/figures/lightseagreen.png new file mode 100644 index 0000000000000000000000000000000000000000..e863d7a1c3b9c1ca08bd182dce43c55a4866d59b Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/lightseagreen.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/lightskyblue.png b/en/application-dev/reference/arkui-js-lite/figures/lightskyblue.png new file mode 100644 index 0000000000000000000000000000000000000000..daa035cea33b810571c18de67e4ac887eeb11850 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/lightskyblue.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/lightslategray.png b/en/application-dev/reference/arkui-js-lite/figures/lightslategray.png new file mode 100644 index 0000000000000000000000000000000000000000..2dadb92ce56793e2dd693bfa7d99b0c1168130dc Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/lightslategray.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/lightslategrey.png b/en/application-dev/reference/arkui-js-lite/figures/lightslategrey.png new file mode 100644 index 0000000000000000000000000000000000000000..2dadb92ce56793e2dd693bfa7d99b0c1168130dc Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/lightslategrey.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/lightsteelblue.png b/en/application-dev/reference/arkui-js-lite/figures/lightsteelblue.png new file mode 100644 index 0000000000000000000000000000000000000000..ac0521001d2513fd69e48ce61e1d1128b9d3a6dd Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/lightsteelblue.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/lightyellow.png b/en/application-dev/reference/arkui-js-lite/figures/lightyellow.png new file mode 100644 index 0000000000000000000000000000000000000000..d1ca7dd07fe7812ec1f87bf748595174569a5672 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/lightyellow.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/lime.png b/en/application-dev/reference/arkui-js-lite/figures/lime.png new file mode 100644 index 0000000000000000000000000000000000000000..481c833482d38c5f564127c8f412fe3c0275fd24 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/lime.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/limegreen.png b/en/application-dev/reference/arkui-js-lite/figures/limegreen.png new file mode 100644 index 0000000000000000000000000000000000000000..63a8c6adc29d340634ed06a1006a0fb56c991a9d Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/limegreen.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/linen.png b/en/application-dev/reference/arkui-js-lite/figures/linen.png new file mode 100644 index 0000000000000000000000000000000000000000..486baf6be50982404fd1c68a5bc51db45c62046a Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/linen.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/list.png b/en/application-dev/reference/arkui-js-lite/figures/list.png new file mode 100644 index 0000000000000000000000000000000000000000..969473b2307ce6b0528459d5e2b71b0baef4f733 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/list.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/lite_bar.PNG b/en/application-dev/reference/arkui-js-lite/figures/lite_bar.PNG new file mode 100644 index 0000000000000000000000000000000000000000..a180cd74fb6455adb495cf0d8471b34c93a9415e Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/lite_bar.PNG differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/lite_line.PNG b/en/application-dev/reference/arkui-js-lite/figures/lite_line.PNG new file mode 100644 index 0000000000000000000000000000000000000000..664ade98b38a3b6ac2b3e96dc4af8b75b6749a72 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/lite_line.PNG differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/magenta.png b/en/application-dev/reference/arkui-js-lite/figures/magenta.png new file mode 100644 index 0000000000000000000000000000000000000000..6823cbc9203b07abae455b4ee5c7692878c4be72 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/magenta.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/maroon.png b/en/application-dev/reference/arkui-js-lite/figures/maroon.png new file mode 100644 index 0000000000000000000000000000000000000000..1324b43b3f5b8dd0548cf2069c4c532c5284c445 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/maroon.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/marquee.gif b/en/application-dev/reference/arkui-js-lite/figures/marquee.gif new file mode 100644 index 0000000000000000000000000000000000000000..3b6df4b26274fdf5c3e6e1fab2423400455b7050 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/marquee.gif differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/mediumaquamarine.png b/en/application-dev/reference/arkui-js-lite/figures/mediumaquamarine.png new file mode 100644 index 0000000000000000000000000000000000000000..800bf296338fd01962f16a8863c37bfe515ce3be Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/mediumaquamarine.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/mediumblue.png b/en/application-dev/reference/arkui-js-lite/figures/mediumblue.png new file mode 100644 index 0000000000000000000000000000000000000000..c0df3f4f7d99f0b8c39995133c71d944bc07ea4b Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/mediumblue.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/mediumorchid.png b/en/application-dev/reference/arkui-js-lite/figures/mediumorchid.png new file mode 100644 index 0000000000000000000000000000000000000000..664d13c38389361e61a45870899e2a6f0bfc835f Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/mediumorchid.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/mediumpurple.png b/en/application-dev/reference/arkui-js-lite/figures/mediumpurple.png new file mode 100644 index 0000000000000000000000000000000000000000..848454297b67eb73ab641424badc438433e24479 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/mediumpurple.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/mediumseagreen.png b/en/application-dev/reference/arkui-js-lite/figures/mediumseagreen.png new file mode 100644 index 0000000000000000000000000000000000000000..984e7a561e661ecefca8b60d5ac239b67f96c98c Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/mediumseagreen.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/mediumslateblue.png b/en/application-dev/reference/arkui-js-lite/figures/mediumslateblue.png new file mode 100644 index 0000000000000000000000000000000000000000..39cf9d01563cf63bee003a47cd88258e860a0757 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/mediumslateblue.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/mediumspringgreen.png b/en/application-dev/reference/arkui-js-lite/figures/mediumspringgreen.png new file mode 100644 index 0000000000000000000000000000000000000000..56db1024a714f821528656c64e12520311bae8f5 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/mediumspringgreen.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/mediumturquoise.png b/en/application-dev/reference/arkui-js-lite/figures/mediumturquoise.png new file mode 100644 index 0000000000000000000000000000000000000000..b3c353b6a872d3597b767f4c216b2d16bfc2139b Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/mediumturquoise.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/mediumvioletred.png b/en/application-dev/reference/arkui-js-lite/figures/mediumvioletred.png new file mode 100644 index 0000000000000000000000000000000000000000..00767e63c899eec52c2c732e834bca8d26d348ce Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/mediumvioletred.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/midnightblue.png b/en/application-dev/reference/arkui-js-lite/figures/midnightblue.png new file mode 100644 index 0000000000000000000000000000000000000000..ac66614c0f277cd722b3d090cb10efb973152b0f Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/midnightblue.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/mintcream.png b/en/application-dev/reference/arkui-js-lite/figures/mintcream.png new file mode 100644 index 0000000000000000000000000000000000000000..64fdda07447707816e8a6238939169f58a4ce58f Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/mintcream.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/mistyrose.png b/en/application-dev/reference/arkui-js-lite/figures/mistyrose.png new file mode 100644 index 0000000000000000000000000000000000000000..6f5fe69b5a5a62b2d2b719b2be0a17a501363918 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/mistyrose.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/moccasin.png b/en/application-dev/reference/arkui-js-lite/figures/moccasin.png new file mode 100644 index 0000000000000000000000000000000000000000..115cb4c96382681743381aeba099549dc24c2ae5 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/moccasin.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/navajowhite.png b/en/application-dev/reference/arkui-js-lite/figures/navajowhite.png new file mode 100644 index 0000000000000000000000000000000000000000..a68e61ab120651294310c5e3632ce22d71917a52 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/navajowhite.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/navy.png b/en/application-dev/reference/arkui-js-lite/figures/navy.png new file mode 100644 index 0000000000000000000000000000000000000000..4e41c2cd90ba17798448d70b493ccceb3ac960f0 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/navy.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/oldlace.png b/en/application-dev/reference/arkui-js-lite/figures/oldlace.png new file mode 100644 index 0000000000000000000000000000000000000000..ecf361e4c749446160da1e8a07169b21d99f362a Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/oldlace.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/olive.png b/en/application-dev/reference/arkui-js-lite/figures/olive.png new file mode 100644 index 0000000000000000000000000000000000000000..0d386fef5c4fa9faf1b29c7667c7392db250f2eb Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/olive.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/olivedrab.png b/en/application-dev/reference/arkui-js-lite/figures/olivedrab.png new file mode 100644 index 0000000000000000000000000000000000000000..639f16f8aaf261176b3bc760c2eb616ad2f4aa28 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/olivedrab.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/orange.png b/en/application-dev/reference/arkui-js-lite/figures/orange.png new file mode 100644 index 0000000000000000000000000000000000000000..9c43caf5fdfd466eafc37b793f509a6bde2b885d Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/orange.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/orangered.png b/en/application-dev/reference/arkui-js-lite/figures/orangered.png new file mode 100644 index 0000000000000000000000000000000000000000..e72165fdf1b24d80f0abde742ad3d848497c6ea7 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/orangered.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/orchid.png b/en/application-dev/reference/arkui-js-lite/figures/orchid.png new file mode 100644 index 0000000000000000000000000000000000000000..9114031e04fc28be59e8c9567c0fcfe81a9cc5cb Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/orchid.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/palegoldenrod.png b/en/application-dev/reference/arkui-js-lite/figures/palegoldenrod.png new file mode 100644 index 0000000000000000000000000000000000000000..131584c72c082f40e2b466e2706c86a05df375e0 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/palegoldenrod.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/palegreen.png b/en/application-dev/reference/arkui-js-lite/figures/palegreen.png new file mode 100644 index 0000000000000000000000000000000000000000..891d52276622fd51893634ce26e08bd56f62b782 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/palegreen.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/paleturquoise.png b/en/application-dev/reference/arkui-js-lite/figures/paleturquoise.png new file mode 100644 index 0000000000000000000000000000000000000000..a618da21cf6c6d32066286e594921c0fc75b5dba Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/paleturquoise.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/palevioletred.png b/en/application-dev/reference/arkui-js-lite/figures/palevioletred.png new file mode 100644 index 0000000000000000000000000000000000000000..c88212b6818d6d18c77ee497cfcafaf661a70d52 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/palevioletred.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/papayawhip.png b/en/application-dev/reference/arkui-js-lite/figures/papayawhip.png new file mode 100644 index 0000000000000000000000000000000000000000..4b1948de8581602c6c5879c03d68c14f06eccd00 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/papayawhip.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/peachpuff.png b/en/application-dev/reference/arkui-js-lite/figures/peachpuff.png new file mode 100644 index 0000000000000000000000000000000000000000..1821f9c40ad9d24dc10dc662ecbe7936c9e10633 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/peachpuff.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/peru.png b/en/application-dev/reference/arkui-js-lite/figures/peru.png new file mode 100644 index 0000000000000000000000000000000000000000..3ca3e045717379bb09fa8d13ea0d42019bf546f2 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/peru.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/picker-view.png b/en/application-dev/reference/arkui-js-lite/figures/picker-view.png new file mode 100644 index 0000000000000000000000000000000000000000..3e5375876c6c7403b254df56c75d08031ad9801d Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/picker-view.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/pink.png b/en/application-dev/reference/arkui-js-lite/figures/pink.png new file mode 100644 index 0000000000000000000000000000000000000000..5c5e360f249a2002ba68ad9b94bd7f66f5d6aab1 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/pink.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/plum.png b/en/application-dev/reference/arkui-js-lite/figures/plum.png new file mode 100644 index 0000000000000000000000000000000000000000..1e0bad2b2bfed2559e53a8bc21162e6163ec8434 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/plum.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/powderblue.png b/en/application-dev/reference/arkui-js-lite/figures/powderblue.png new file mode 100644 index 0000000000000000000000000000000000000000..8b3eec4e46f6a29dc47694940ceaef1cfa1314af Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/powderblue.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/progress.png b/en/application-dev/reference/arkui-js-lite/figures/progress.png new file mode 100644 index 0000000000000000000000000000000000000000..fb9170121d950b8d8b5a4a5a209c25b452791d25 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/progress.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/purple.png b/en/application-dev/reference/arkui-js-lite/figures/purple.png new file mode 100644 index 0000000000000000000000000000000000000000..8bc3583f82d21c8bec0c70b2da36ed05723fd9a7 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/purple.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/qrcode.gif b/en/application-dev/reference/arkui-js-lite/figures/qrcode.gif new file mode 100644 index 0000000000000000000000000000000000000000..53e718c2879554c82d4a3d9800507a00e37613dc Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/qrcode.gif differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/rebeccapurple.png b/en/application-dev/reference/arkui-js-lite/figures/rebeccapurple.png new file mode 100644 index 0000000000000000000000000000000000000000..6a64534a0a867d44cf81c8a34c9981b5fbaf5faf Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/rebeccapurple.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/red.png b/en/application-dev/reference/arkui-js-lite/figures/red.png new file mode 100644 index 0000000000000000000000000000000000000000..309d1c46f8bc396df5eaed381a5ffa2f0389d602 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/red.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/rosybrown.png b/en/application-dev/reference/arkui-js-lite/figures/rosybrown.png new file mode 100644 index 0000000000000000000000000000000000000000..adca00e684afb79ff4f21313d0586025576a8be1 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/rosybrown.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/royalblue.png b/en/application-dev/reference/arkui-js-lite/figures/royalblue.png new file mode 100644 index 0000000000000000000000000000000000000000..69cb300d4bc8decee06c7fb64b03a24287865a8f Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/royalblue.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/saddlebrown.png b/en/application-dev/reference/arkui-js-lite/figures/saddlebrown.png new file mode 100644 index 0000000000000000000000000000000000000000..5d0ae86ad14ff863511a10ecc1a85b273e826dfc Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/saddlebrown.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/salmon.png b/en/application-dev/reference/arkui-js-lite/figures/salmon.png new file mode 100644 index 0000000000000000000000000000000000000000..b80a6c31cdb287c35965c7841aa97711d79b371c Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/salmon.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/sample1.gif b/en/application-dev/reference/arkui-js-lite/figures/sample1.gif new file mode 100644 index 0000000000000000000000000000000000000000..6168a14aa67c866abf6185ba3a3c2ae9f595153c Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/sample1.gif differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/sandybrown.png b/en/application-dev/reference/arkui-js-lite/figures/sandybrown.png new file mode 100644 index 0000000000000000000000000000000000000000..c952585d8032733700b57ce1a919d71ce9a4b58b Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/sandybrown.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/seagreen.png b/en/application-dev/reference/arkui-js-lite/figures/seagreen.png new file mode 100644 index 0000000000000000000000000000000000000000..858c4187d3a2874f651adc09dcae9a32f8407d86 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/seagreen.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/seashell.png b/en/application-dev/reference/arkui-js-lite/figures/seashell.png new file mode 100644 index 0000000000000000000000000000000000000000..c0b21ed6b44c2f756458137f931873f540c16e5f Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/seashell.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/sienna.png b/en/application-dev/reference/arkui-js-lite/figures/sienna.png new file mode 100644 index 0000000000000000000000000000000000000000..bdb02fdda28a155e2f622eeea2ff820144780e50 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/sienna.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/silver.png b/en/application-dev/reference/arkui-js-lite/figures/silver.png new file mode 100644 index 0000000000000000000000000000000000000000..0491d350277cd67d7774e3761164b9dd7038a117 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/silver.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/skyblue.png b/en/application-dev/reference/arkui-js-lite/figures/skyblue.png new file mode 100644 index 0000000000000000000000000000000000000000..1c4f9ae52153198f8690a1066fe66ba8c7bd1ee1 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/skyblue.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/slateblue.png b/en/application-dev/reference/arkui-js-lite/figures/slateblue.png new file mode 100644 index 0000000000000000000000000000000000000000..87915df37741dacfe9448bfebccf5a88d3ca2a76 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/slateblue.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/slategray.png b/en/application-dev/reference/arkui-js-lite/figures/slategray.png new file mode 100644 index 0000000000000000000000000000000000000000..6e4476c4791e37d4681f8e12313ae1cad0887c1b Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/slategray.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/slider.png b/en/application-dev/reference/arkui-js-lite/figures/slider.png new file mode 100644 index 0000000000000000000000000000000000000000..b72ed8404c613ec9283d7be1f56071d70fcbbc1f Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/slider.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/smoothOff.PNG b/en/application-dev/reference/arkui-js-lite/figures/smoothOff.PNG new file mode 100644 index 0000000000000000000000000000000000000000..c699e78774fadbd8da8c0cc290e88294d445aa6f Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/smoothOff.PNG differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/smoothOn.PNG b/en/application-dev/reference/arkui-js-lite/figures/smoothOn.PNG new file mode 100644 index 0000000000000000000000000000000000000000..b7a5a2a819eeafeb000c00bd7009a02e5fe1bbe5 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/smoothOn.PNG differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/snow.png b/en/application-dev/reference/arkui-js-lite/figures/snow.png new file mode 100644 index 0000000000000000000000000000000000000000..283cf90b3828b36af6fb3a746e806f6715053310 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/snow.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/springgreen.png b/en/application-dev/reference/arkui-js-lite/figures/springgreen.png new file mode 100644 index 0000000000000000000000000000000000000000..93825b7fe53a0794751ee4aa3ca46300c404835e Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/springgreen.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/steelblue.png b/en/application-dev/reference/arkui-js-lite/figures/steelblue.png new file mode 100644 index 0000000000000000000000000000000000000000..a9aba5f67b94427168fade014542532431e28a2e Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/steelblue.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/swiper.gif b/en/application-dev/reference/arkui-js-lite/figures/swiper.gif new file mode 100644 index 0000000000000000000000000000000000000000..2ec52b162dcfdd39c2d2f5a7be4106321935b010 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/swiper.gif differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/switch.gif b/en/application-dev/reference/arkui-js-lite/figures/switch.gif new file mode 100644 index 0000000000000000000000000000000000000000..64f8c8eb0c1ecf13e8b91f291782d825ce9f0076 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/switch.gif differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/tan.png b/en/application-dev/reference/arkui-js-lite/figures/tan.png new file mode 100644 index 0000000000000000000000000000000000000000..b162dbf0a6c890a03ea1aa0b28bdb454651b697c Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/tan.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/teal.png b/en/application-dev/reference/arkui-js-lite/figures/teal.png new file mode 100644 index 0000000000000000000000000000000000000000..93299fc38d761e5251673210c364f6825e319153 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/teal.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/text.png b/en/application-dev/reference/arkui-js-lite/figures/text.png new file mode 100644 index 0000000000000000000000000000000000000000..d3a79bc7ae959d16d1eb4b915fa9040f00996b16 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/text.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/thistle.png b/en/application-dev/reference/arkui-js-lite/figures/thistle.png new file mode 100644 index 0000000000000000000000000000000000000000..d62fc7767f7b2e0e8d0d7fed57e30bdf6a6a332f Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/thistle.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/tomato.png b/en/application-dev/reference/arkui-js-lite/figures/tomato.png new file mode 100644 index 0000000000000000000000000000000000000000..6d795f1618b1546c94266548069eccf9e9af2e01 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/tomato.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/turquoise.png b/en/application-dev/reference/arkui-js-lite/figures/turquoise.png new file mode 100644 index 0000000000000000000000000000000000000000..a33c4fce8448e2127b21e277437195ce0002766b Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/turquoise.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/violet.png b/en/application-dev/reference/arkui-js-lite/figures/violet.png new file mode 100644 index 0000000000000000000000000000000000000000..e9a0799a203fdd7bd41fa5175585dc170a20156e Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/violet.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/wheat.png b/en/application-dev/reference/arkui-js-lite/figures/wheat.png new file mode 100644 index 0000000000000000000000000000000000000000..8a5c7039b580128e75299672dc5438151dcf3572 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/wheat.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/white.png b/en/application-dev/reference/arkui-js-lite/figures/white.png new file mode 100644 index 0000000000000000000000000000000000000000..56d32d4cd371c5374b133cb81c9c077aaf7b110d Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/white.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/whitesmoke.png b/en/application-dev/reference/arkui-js-lite/figures/whitesmoke.png new file mode 100644 index 0000000000000000000000000000000000000000..6dc88e656c293c2e65939e4a793684488dfc81be Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/whitesmoke.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/yellow.png b/en/application-dev/reference/arkui-js-lite/figures/yellow.png new file mode 100644 index 0000000000000000000000000000000000000000..b54dbc2391d1a8f16312dd02dc3d65a35ea2626f Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/yellow.png differ diff --git a/en/application-dev/reference/arkui-js-lite/figures/yellowgreen.png b/en/application-dev/reference/arkui-js-lite/figures/yellowgreen.png new file mode 100644 index 0000000000000000000000000000000000000000..f89e20a55ba1e81f2cbda2bd0241edefadbe7149 Binary files /dev/null and b/en/application-dev/reference/arkui-js-lite/figures/yellowgreen.png differ diff --git a/en/application-dev/reference/arkui-js-lite/js-common-attributes.md b/en/application-dev/reference/arkui-js-lite/js-common-attributes.md new file mode 100644 index 0000000000000000000000000000000000000000..d91f720d4e8d718abae2a45f4d99d245d46f4815 --- /dev/null +++ b/en/application-dev/reference/arkui-js-lite/js-common-attributes.md @@ -0,0 +1,28 @@ +# Universal Attributes + + +## Common Attributes + +Common attributes are used to set component identities and appearance. + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| id | string | No| Unique ID of the component.| +| style | string | No| Style declaration of the component.| +| class | string | No| Style class of the component, which is used to refer to a style table.| +| ref | string | No| Reference information of child elements, which is registered with the parent component on **$refs**.| + + +## Rendering Attributes + +Rendering attributes are used to set whether a component is rendered. + +| Name| Type| Description| +| -------- | -------- | -------- | +| for | Array | Expands the current element based on the configured data list.| +| if | boolean | Whether the element is added or removed.| +| show | boolean | Whether the element is displayed or hidden.| + +> **NOTE** +> +> Do not set styles in attribute fields. diff --git a/en/application-dev/reference/arkui-js-lite/js-common-events.md b/en/application-dev/reference/arkui-js-lite/js-common-events.md new file mode 100644 index 0000000000000000000000000000000000000000..93022870c037ef7424eb4a752d4b0e8ee87cda41 --- /dev/null +++ b/en/application-dev/reference/arkui-js-lite/js-common-events.md @@ -0,0 +1,19 @@ +# Universal Events + + +Different from private events, universal events can be bound to most components. + + +| Name| Parameter| Description| +| -------- | -------- | -------- | +| click | - | Triggered when the component is clicked. | +| longpress | - | Triggered when the component is long pressed. | +| swipe5+ | SwipeEvent | Triggered when a user quickly swipes on the component. | + + + **Table 1** SwipeEvent (inherited from BaseEvent) + +| Attribute| Type| Description | +| -------- | -------- | -------- | +| direction | string | Swiping direction. The value can be one of the following:
- **left**: Swipe left.
- **right**: Swipe right.
- **up**: Swipe up.
- **down**: Swipe down. | + diff --git a/en/application-dev/reference/arkui-js-lite/js-common-styles.md b/en/application-dev/reference/arkui-js-lite/js-common-styles.md new file mode 100644 index 0000000000000000000000000000000000000000..15d76dc7b93a04aa82644b52f3a69f834d9aa1c8 --- /dev/null +++ b/en/application-dev/reference/arkui-js-lite/js-common-styles.md @@ -0,0 +1,188 @@ +# Universal Styles + + +You can set universal styles for components in the **style** attribute or **.css** files. + + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| width | <length> \| <percentage>5+ | - | No| Component width.

If this attribute is not set, the default value **0** is used.| +| height | <length> \| <percentage>5+ | - | No| Component height.

If this attribute is not set, the default value **0** is used.| +| padding | <length> | 0 | No| Shorthand attribute to set the padding for all sides in a declaration.
The attribute can have one to four values:
- If you set only one value, it specifies the padding for all the four sides.
- If you set two values, the first value specifies the top and bottom padding, and the second value specifies the left and right padding.
- If you set three values, the first value specifies the top padding, the second value specifies the left and right padding, and the third value specifies the bottom padding.
- If you set four values, they respectively specify the padding for top, right, bottom, and left sides (in clockwise order).| +| padding-[left\|top\|right\|bottom] | <length> | 0 | No| Left, top, right, and bottom padding.| +| margin | <length> \| <percentage>5+ | 0 | No| Shorthand attribute to set the margin for all sides in a declaration. The attribute can have one to four values:
- If you set only one value, it specifies the margin for all the four sides.
- If you set two values, the first value specifies the top and bottom margins, and the second value specifies the left and right margins.
- If you set three values, the first value specifies the top margin, the second value specifies the left and right margins, and the third value specifies the bottom margin.
- If you set four values, they respectively specify the margin for top, right, bottom, and left sides (in clockwise order).| +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | No| Left, top, right, and bottom margins.| +| border-width | <length> | 0 | No| Shorthand attribute to set the margin for all sides.| +| border-color | <color> | black | No| Shorthand attribute to set the color for all borders.| +| border-radius | <length> | - | No| Radius of round-corner borders. | +| background-color | <color> | - | No| Background color.| +| opacity5+ | number | 1 | No| Opacity of an element. The value ranges from **0** to **1**. The value **1** means opaque, and **0** means completely transparent.| +| display | string | flex | No| Type of the box containing an element. Available values are as follows:
- **flex**: flexible layout
- **none**: not rendered| +| [left\|top] | <length> \| <percentage>6+ | - | No| Edge of the element.
- **left**: left edge position of the element. This attribute defines the offset between the left edge of the margin area of a positioned element and left edge of its containing block.
- **top**: top edge position of the element. This attribute defines the offset between the top edge of a positioned element and that of a block included in the element. | + + +> **NOTE** +> +> The aforementioned universal styles are not mandatory. +> +> Currently, the following color formats are supported: +> - rgb(255, 255, 255) +> +> - rgba(255, 255, 255, 1.0) +> +> - HEX formats: \#rrggbb and \#aarrggbb +> +> - Enumeration format: as listed in Table 1. The enumeration format is not supported in the script. + + + **Table 1** Color enums + +| Name| Hexadecimal Code| Color| +| -------- | -------- | -------- | +| aliceblue | \#f0f8ff | ![aliceblue](figures/aliceblue.png) | +| antiquewhite | \#faebd7 | ![antiquewhite](figures/antiquewhite.png) | +| aqua | \#00ffff | ![aqua](figures/aqua.png) | +| aquamarine | \#7fffd4 | ![aquamarine](figures/aquamarine.png) | +| azure | \#f0ffff | ![azure](figures/azure.png) | +| beige | \#f5f5dc | ![beige](figures/beige.png) | +| bisque | \#ffe4c4 | ![bisque](figures/bisque.png) | +| black | \#000000 | ![#000000](figures/#000000.png) | +| blanchedalmond | \#ffebcd | ![blanchedalmond](figures/blanchedalmond.png) | +| blue | \#0000ff | ![blue](figures/blue.png) | +| blueviolet | \#8a2be2 | ![blueviolet](figures/blueviolet.png) | +| brown | \#a52a2a | ![brown](figures/brown.png) | +| burlywood | \#deB887 | ![burlywood](figures/burlywood.png) | +| cadetblue | \#5f9ea0 | ![cadetblue](figures/cadetblue.png) | +| chartreuse | \#7fff00 | ![chartreuse](figures/chartreuse.png) | +| chocolate | \#d2691e | ![chocolate](figures/chocolate.png) | +| coral | \#ff7f50 | ![coral](figures/coral.png) | +| cornflowerblue | \#6495ed | ![cornflowerblue](figures/cornflowerblue.png) | +| cornsilk | \#fff8dc | ![cornsilk](figures/cornsilk.png) | +| crimson | \#dc143c | ![crimson](figures/crimson.png) | +| cyan | \#00ffff | ![cyan](figures/cyan.png) | +| darkblue | \#00008b | ![darkblue](figures/darkblue.png) | +| darkcyan | \#008b8b | ![darkcyan](figures/darkcyan.png) | +| darkgoldenrod | \#b8860b | ![darkgoldenrod](figures/darkgoldenrod.png) | +| darkgray | \#a9a9a9 | ![darkgray](figures/darkgray.png) | +| darkgreen | \#006400 | ![darkgreen](figures/darkgreen.png) | +| darkgrey | \#a9a9a9 | ![darkgrey](figures/darkgrey.png) | +| darkkhaki | \#bdb76b | ![darkkhaki](figures/darkkhaki.png) | +| darkmagenta | \#8b008b | ![darkmagenta](figures/darkmagenta.png) | +| darkolivegreen | \#556b2f | ![darkolivegreen](figures/darkolivegreen.png) | +| darkorange | \#ff8c00 | ![darkorange](figures/darkorange.png) | +| darkorchid | \#9932cc | ![darkorchid](figures/darkorchid.png) | +| darkred | \#8b0000 | ![darkred](figures/darkred.png) | +| darksalmon | \#e9967a | ![darksalmon](figures/darksalmon.png) | +| darkseagreen | \#8fbc8f | ![darkseagreen](figures/darkseagreen.png) | +| darkslateblue | \#483d8b | ![darkslateblue](figures/darkslateblue.png) | +| darkslategray | \#2f4f4f | ![darkslategray](figures/darkslategray.png) | +| darkslategrey | \#2f4f4f | ![darkslategrey](figures/darkslategrey.png) | +| darkturquoise | \#00ced1 | ![darkturquoise](figures/darkturquoise.png) | +| darkviolet | \#9400d3 | ![darkviolet](figures/darkviolet.png) | +| deeppink | \#ff1493 | ![deeppink](figures/deeppink.png) | +| deepskyblue | \#00bfff | ![deepskyblue](figures/deepskyblue.png) | +| dimgray | \#696969 | ![dimgray](figures/dimgray.png) | +| dimgrey | \#696969 | ![dimgrey](figures/dimgrey.png) | +| dodgerblue | \#1e90ff | ![dodgerblue](figures/dodgerblue.png) | +| firebrick | \#b22222 | ![firebrick](figures/firebrick.png) | +| floralwhite | \#fffaf0 | ![floralwhite](figures/floralwhite.png) | +| forestgreen | \#228b22 | ![forestgreen](figures/forestgreen.png) | +| fuchsia | \#ff00ff | ![fuchsia](figures/fuchsia.png) | +| gainsboro | \#dcdcdc | ![gainsboro](figures/gainsboro.png) | +| ghostwhite | \#f8f8ff | ![ghostwhite](figures/ghostwhite.png) | +| gold | \#ffd700 | ![gold](figures/gold.png) | +| goldenrod | \#daa520 | ![goldenrod](figures/goldenrod.png) | +| gray | \#808080 | ![gray](figures/gray.png) | +| green | \#008000 | ![green](figures/green.png) | +| greenyellow | \#adff2f | ![greenyellow](figures/greenyellow.png) | +| grey | \#808080 | ![grey](figures/grey.png) | +| honeydew | \#f0fff0 | ![honeydew](figures/honeydew.png) | +| hotpink | \#ff69b4 | ![hotpink](figures/hotpink.png) | +| indianred | \#cd5c5c | ![indianred](figures/indianred.png) | +| indigo | \#4b0082 | ![indigo](figures/indigo.png) | +| ivory | \#fffff0 | ![ivory](figures/ivory.png) | +| khaki | \#f0e68c | ![khaki](figures/khaki.png) | +| lavender | \#e6e6fa | ![lavender](figures/lavender.png) | +| lavenderblush | \#fff0f5 | ![lavenderblush](figures/lavenderblush.png) | +| lawngreen | \#7cfc00 | ![lawngreen](figures/lawngreen.png) | +| lemonchiffon | \#fffacd | ![lemonchiffon](figures/lemonchiffon.png) | +| lightblue | \#add8e6 | ![lightblue](figures/lightblue.png) | +| lightcoral | \#f08080 | ![lightcoral](figures/lightcoral.png) | +| lightcyan | \#e0ffff | ![lightcyan](figures/lightcyan.png) | +| lightgoldenrodyellow | \#fafad2 | ![lightgoldenrodyellow](figures/lightgoldenrodyellow.png) | +| lightgray | \#d3d3d3 | ![lightgray](figures/lightgray.png) | +| lightgreen | \#90ee90 | ![lightgreen](figures/lightgreen.png) | +| lightpink | \#ffb6c1 | ![lightpink](figures/lightpink.png) | +| lightsalmon | \#ffa07a | ![lightsalmon](figures/lightsalmon.png) | +| lightseagreen | \#20b2aa | ![lightseagreen](figures/lightseagreen.png) | +| lightskyblue | \#87cefa | ![lightskyblue](figures/lightskyblue.png) | +| lightslategray | \#778899 | ![lightslategray](figures/lightslategray.png) | +| lightslategrey | \#778899 | ![lightslategrey](figures/lightslategrey.png) | +| lightsteelblue | \#b0c4de | ![lightsteelblue](figures/lightsteelblue.png) | +| lightyellow | \#ffffe0 | ![lightyellow](figures/lightyellow.png) | +| lime | \#00ff00 | ![lime](figures/lime.png) | +| limegreen | \#32cd32 | ![limegreen](figures/limegreen.png) | +| linen | \#faf0e6 | ![linen](figures/linen.png) | +| magenta | \#ff00ff | ![magenta](figures/magenta.png) | +| maroon | \#800000 | ![maroon](figures/maroon.png) | +| mediumaquamarine | \#66cdaa | ![mediumaquamarine](figures/mediumaquamarine.png) | +| mediumblue | \#0000cd | ![mediumblue](figures/mediumblue.png) | +| mediumorchid | \#ba55d3 | ![mediumorchid](figures/mediumorchid.png) | +| mediumpurple | \#9370db | ![mediumpurple](figures/mediumpurple.png) | +| mediumseagreen | \#3cb371 | ![mediumseagreen](figures/mediumseagreen.png) | +| mediumslateblue | \#7b68ee | ![mediumslateblue](figures/mediumslateblue.png) | +| mediumspringgreen | \#00fa9a | ![mediumspringgreen](figures/mediumspringgreen.png) | +| mediumturquoise | \#48d1cc | ![mediumturquoise](figures/mediumturquoise.png) | +| mediumvioletred | \#c71585 | ![mediumvioletred](figures/mediumvioletred.png) | +| midnightblue | \#191970 | ![midnightblue](figures/midnightblue.png) | +| mintcream | \#f5fffa | ![mintcream](figures/mintcream.png) | +| mistyrose | \#ffe4e1 | ![mistyrose](figures/mistyrose.png) | +| moccasin | \#ffe4b5 | ![moccasin](figures/moccasin.png) | +| navajowhite | \#ffdead | ![navajowhite](figures/navajowhite.png) | +| navy | \#000080 | ![navy](figures/navy.png) | +| oldlace | \#fdf5e6 | ![oldlace](figures/oldlace.png) | +| olive | \#808000 | ![olive](figures/olive.png) | +| olivedrab | \#6b8e23 | ![olivedrab](figures/olivedrab.png) | +| orange | \#ffa500 | ![orange](figures/orange.png) | +| orangered | \#ff4500 | ![orangered](figures/orangered.png) | +| orchid | \#da70d6 | ![orchid](figures/orchid.png) | +| palegoldenrod | \#eee8aa | ![palegoldenrod](figures/palegoldenrod.png) | +| palegreen | \#98fb98 | ![palegreen](figures/palegreen.png) | +| paleturquoise | \#afeeee | ![paleturquoise](figures/paleturquoise.png) | +| palevioletred | \#db7093 | ![palevioletred](figures/palevioletred.png) | +| papayawhip | \#ffefd5 | ![papayawhip](figures/papayawhip.png) | +| peachpuff | \#ffdab9 | ![peachpuff](figures/peachpuff.png) | +| peru | \#cd853f | ![peru](figures/peru.png) | +| pink | \#ffc0cb | ![pink](figures/pink.png) | +| plum | \#dda0dd | ![plum](figures/plum.png) | +| powderblue | \#b0e0e6 | ![powderblue](figures/powderblue.png) | +| purple | \#800080 | ![purple](figures/purple.png) | +| rebeccapurple | \#663399 | ![rebeccapurple](figures/rebeccapurple.png) | +| red | \#ff0000 | ![red](figures/red.png) | +| rosybrown | \#bc8f8f | ![rosybrown](figures/rosybrown.png) | +| royalblue | \#4169e1 | ![royalblue](figures/royalblue.png) | +| saddlebrown | \#8b4513 | ![saddlebrown](figures/saddlebrown.png) | +| salmon | \#fa8072 | ![salmon](figures/salmon.png) | +| sandybrown | \#f4a460 | ![sandybrown](figures/sandybrown.png) | +| seagreen | \#2e8b57 | ![seagreen](figures/seagreen.png) | +| seashell | \#fff5ee | ![seashell](figures/seashell.png) | +| sienna | \#a0522d | ![sienna](figures/sienna.png) | +| silver | \#c0c0c0 | ![silver](figures/silver.png) | +| skyblue | \#87ceeb | ![skyblue](figures/skyblue.png) | +| slateblue | \#6a5acd | ![slateblue](figures/slateblue.png) | +| slategray | \#708090 | ![slategray](figures/slategray.png) | +| slategrey | \#708090 | ![slategray](figures/slategray.png) | +| snow | \#fffafa | ![snow](figures/snow.png) | +| springgreen | \#00ff7f | ![springgreen](figures/springgreen.png) | +| steelblue | \#4682b4 | ![steelblue](figures/steelblue.png) | +| tan | \#d2b48c | ![tan](figures/tan.png) | +| teal | \#008080 | ![teal](figures/teal.png) | +| thistle | \#d8Bfd8 | ![thistle](figures/thistle.png) | +| tomato | \#ff6347 | ![tomato](figures/tomato.png) | +| turquoise | \#40e0d0 | ![turquoise](figures/turquoise.png) | +| violet | \#ee82ee | ![violet](figures/violet.png) | +| wheat | \#f5deb3 | ![wheat](figures/wheat.png) | +| white | \#ffffff | ![white](figures/white.png) | +| whitesmoke | \#f5f5f5 | ![whitesmoke](figures/whitesmoke.png) | +| yellow | \#ffff00 | ![yellow](figures/yellow.png) | +| yellowgreen | \#9acd32 | ![yellowgreen](figures/yellowgreen.png) | diff --git a/en/application-dev/reference/arkui-js-lite/js-components-basic-chart.md b/en/application-dev/reference/arkui-js-lite/js-components-basic-chart.md new file mode 100644 index 0000000000000000000000000000000000000000..7a0a07fe1bee64329c6fe292f881856b941e6ee1 --- /dev/null +++ b/en/application-dev/reference/arkui-js-lite/js-components-basic-chart.md @@ -0,0 +1,275 @@ +# chart + +The **\** component displays line charts and bar charts. + +> **NOTE** +> +> This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version. + + +## Child Components + +Not supported + + +## Attributes + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| type | string | No| Chart type. Dynamic modification is not supported. Available values include:
- **bar**: bar chart
- **line**: line chart
Default value: **line**| +| options | ChartOptions | Yes| Chart parameters. You can set the minimum value, maximum value, scale, and line width of the x-axis or y-axis, whether to display the x-axis and y-axis, and whether the line is smooth. Dynamic modification is not supported.| +| datasets | Array<ChartDataset> | Yes| Data sets. You can set multiple datasets and their background colors.| +| id | string | No| Unique ID of the component.| +| style | string | No| Style declaration of the component.| +| class | string | No| Style class of the component, which is used to refer to a style table.| +| ref | string | No| Reference information of child elements, which is registered with the parent component on **$refs**.| + + **Table 1** ChartOptions + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| xAxis | ChartAxis | Yes| X-axis parameters. You can set the minimum value, maximum value, and scale of the x-axis, and whether to display the x-axis.| +| yAxis | ChartAxis | Yes| Y-axis parameters. You can set the minimum value, maximum value, and scale of the y-axis, and whether to display the y-axis.| +| series | ChartSeries | No| Data series parameters which cover the following:
- Line style, such as the line width and whether the line is smooth.
- Style and size of the white point at the start of the line.
**NOTE**
Only line charts support this attribute. | + + **Table 2** ChartDataset + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| backgroundColor(deprecated) | <color> | \#ff6384 | No| Color of a line or bar. This attribute is not recommended.| +| strokeColor | <color> | \#ff6384 | No| Line color. Only line charts support this attribute.| +| fillColor | <color> | \#ff6384 | No| Fill color. For line charts, the value indicates the gradient color to fill.| +| data | Array<number> | - | Yes| Data of the drawn line or bar.| +| gradient | boolean | false | No| Whether to display the gradient color. Only line charts support this attribute.| + + **Table 3** ChartAxis + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| min | number | 0 | No| Minimum value of the axis.
Negative numbers are not supported. Only line charts support this attribute.| +| max | number | 100 | No| Maximum value of the axis.
Negative numbers are not supported. Only line charts support this attribute.| +| axisTick | number | 10 | No| Number of scales displayed on the axis.
**NOTE**
The value ranges from 1 to 20. The display effect depends on the calculation result of Number of pixels occupied by the image width/(**max**-**min**).
Lite wearables support integer calculation, and an error may occur in the case of inexhaustible division. Specifically, a segment of space may be left at the end of the x-axis.
In the bar chart, the number of bars in each group of data is the same as the number of scales, and the bars are displayed at the scales.| +| display | boolean | false | No| Whether to display the axis.| +| color | <color> | \#c0c0c0 | No| Axis color.| + + **Table 4** ChartSeries + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| lineStyle | ChartLineStyle | No| Line style, such as the line width and whether the line is smooth.| +| headPoint | PointStyle | No| Style and size of the white point at the start of the line.| +| topPoint | PointStyle | No| Style and size of the top point.| +| bottomPoint | PointStyle | No| Style and size of the bottom point.| +| loop | ChartLoop | No| Whether to start drawing again when the screen is looped.| + + **Table 5** ChartLineStyle + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| width | <length> | 1px | No| Line width.| +| smooth | boolean | false | No| Whether the line is smooth.| + + **Table 6** PointStyle + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| shape | string | circle | No| Shape of the highlight point. Available values are as follows:
- circle| +| size | <length> | 5px | No| Size of the highlight point.| +| strokeWidth | <length> | 1px | No| Stroke width.| +| strokeColor | <color> | \#ff0000 | No| Stroke color.| +| fillColor | <color> | \#ff0000 | No| Fill color.| +| display | boolean | true | No| Whether to display the highlight spot.| + + **Table 7** ChartLoop + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| margin | <length> | 1 | No| Number of erased points (horizontal distance between the latest drawn point and the earliest point). You are not advised to use **margin** together with **topPoint**, **bottomPoint**, or **headPoint** for mini-, small- and standard-system devices. If you do so, there is a possibility that the point is in the erase area and invisible.| + + + + +## Methods + +| Methods| Parameter| Description| +| -------- | -------- | -------- | +| append | {
serial: number, // Set the data subscript of the line chart to be updated.
data: Array<number>, // Set the new data.
} | Dynamically add data to an existing data series. The target series is specified based on **serial**, which is the subscript of the datasets array and starts from 0. **datasets[index].data** is not updated. Only line charts support this attribute. The value is incremented by 1 based on the horizontal coordinate and is related to the **xAxis min/max** setting.| + + +## Events + +| Name| Parameter| Description| +| -------- | -------- | -------- | +| click | - | Triggered when the component is clicked. | +| longpress | - | Triggered when the component is long pressed. | +| swipe5+ | [SwipeEvent](js-common-events.md) | Triggered when a user quickly swipes on the component. | + + +## Styles + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| width | <length> \| <percentage>5+ | - | No| Component width.
If this attribute is not set, the default value **0** is used. | +| height | <length> \| <percentage>5+ | - | No| Component height.
If this attribute is not set, the default value **0** is used. | +| padding | <length> | 0 | No| Shorthand attribute to set the padding for all sides.
The attribute can have one to four values:
- If you set only one value, it specifies the padding for all the four sides.
- If you set two values, the first value specifies the top and bottom padding, and the second value specifies the left and right padding.
- If you set three values, the first value specifies the top padding, the second value specifies the left and right padding, and the third value specifies the bottom padding.
- If you set four values, they respectively specify the padding for top, right, bottom, and left sides (in clockwise order).| +| padding-[left\|top\|right\|bottom] | <length> | 0 | No| Left, top, right, and bottom padding.| +| margin | <length> \| <percentage>5+ | 0 | No| Shorthand attribute to set the margin for all sides. The attribute can have one to four values:
- If you set only one value, it specifies the margin for all the four sides.
- If you set two values, the first value specifies the top and bottom margins, and the second value specifies the left and right margins.
- If you set three values, the first value specifies the top margin, the second value specifies the left and right margins, and the third value specifies the bottom margin.
- If you set four values, they respectively specify the margin for top, right, bottom, and left sides (in clockwise order).| +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | No| Left, top, right, and bottom margins.| +| border-width | <length> | 0 | No| Shorthand attribute to set the margin for all sides.| +| border-color | <color> | black | No| Shorthand attribute to set the color for all borders.| +| border-radius | <length> | - | No| Radius of round-corner borders. | +| background-color | <color> | - | No| Background color.| +| display | string | flex | No| How and whether to display the box containing an element. Available values are as follows:
- **flex**: flexible layout
- **none**: not rendered| +| [left\|top] | <length> \| <percentage>6+ | - | No| Edge of the element.
- **left**: left edge position of the element. This attribute defines the offset between the left edge of the margin area of a positioned element and left edge of its containing block.
- **top**: top edge position of the element. This attribute defines the offset between the top edge of a positioned element and that of a block included in the element. | + +## Example + +1. Line chart + + ```html + +
+ + +
+ ``` + + + ```css + /* xxx.css */ + .container { + flex-direction: column; + justify-content: center; + align-items: center; + width: 454px; + height: 454px; + background-color: white; + } + .chart { + width: 300px; + height: 300px; + } + .button { + width: 280px; + border-radius: 0px; + } + ``` + + + ```js + // xxx.js + export default { + data: { + lineData: [ + { + strokeColor: '#0081ff', + fillColor: '#cce5ff', + data: [763, 550, 551, 554, 731, 654, 525, 696, 595, 628, 791, 505, 613, 575, 475, 553, 491, 680, 657, 716], + gradient: true, + } + ], + lineOps: { + xAxis: { + min: 0, + max: 20, + display: false, + }, + yAxis: { + min: 0, + max: 1000, + display: false, + }, + series: { + lineStyle: { + width: "5px", + smooth: true, + }, + headPoint: { + shape: "circle", + size: 10, + strokeWidth: 5, + fillColor: '#ffffff', + strokeColor: '#007aff', + display: true, + }, + loop: { + margin: 2, + gradient: true, + } + } + }, + }, + addData() { + this.$refs.linechart.append({ + serial: 0, + data: [Math.floor(Math.random() * 400) + 400] + }) + } + } + ``` + + ![lite_line](figures/lite_line.PNG) + +2. Bar chart + + ```html + +
+ +
+ ``` + + + ```css + /* xxx.css */ + .container { + flex-direction: column; + justify-content: center; + align-items: center; + width: 454px; + height: 454px; + background-color: white; + } + .chart { + width: 300px; + height: 300px; + } + ``` + + + ```js + // xxx.js + export default { + data: { + barData: [ + { + fillColor: '#f07826', + data: [763, 550, 551, 554, 731, 654, 525, 696, 595, 628], + }, + { + fillColor: '#cce5ff', + data: [535, 776, 615, 444, 694, 785, 677, 609, 562, 410], + }, + { + fillColor: '#ff88bb', + data: [673, 500, 574, 483, 702, 583, 437, 506, 693, 657], + }, + ], + barOps: { + xAxis: { + min: 0, + max: 20, + display: false, + axisTick: 10 + }, + yAxis: { + min: 0, + max: 1000, + display: false, + }, + }, + } + } + ``` + + ![lite_bar](figures/lite_bar.PNG) diff --git a/en/application-dev/reference/arkui-js-lite/js-components-basic-image-animator.md b/en/application-dev/reference/arkui-js-lite/js-components-basic-image-animator.md new file mode 100644 index 0000000000000000000000000000000000000000..97383611f9b1228304aa47ebe97a5d0610f18ee8 --- /dev/null +++ b/en/application-dev/reference/arkui-js-lite/js-components-basic-image-animator.md @@ -0,0 +1,207 @@ +# image-animator + +The **\** component is used to provide an image frame animator. + +> **NOTE** +> +> This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version. + + +## Child Components + +Not supported + + +## Attributes + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| images | Array<ImageFrame> | - | Yes| Image frame information. The frame information includes the image path, size, and location. The supported image formats include PNG, JPG, and BMP. For details about **ImageFrame**, see Table 1.
**NOTE**
Use data binding, for example, **images = {{images}}**, to specify the image. Declare the corresponding variable in the JavaScript: **images: [{src: "/common/heart-rate01.png"}, {src: "/common/heart-rate02.png"}]**. | +| iteration | number \| string | infinite | No| Number of times that the frame animation is played. **number** indicates a fixed number of playback operations, and **infinite** indicates an unlimited number of playback operations.| +| reverse | boolean | false | No| Playback sequence.
- **true**: Images are played from the last one to the first one.
- **false**: Images are played from the first one to the last one. | +| fixedsize | boolean | true | No| Whether the image size is the same as the component size.
- **true**: The image size is the same as the component size. In this case, the width, height, top, and left attributes of the image are invalid.
- **false**: The image size is different from the component size. In this case, the width, height, top, and left attributes of each image must be set separately. | +| duration | string | - | Yes| Single video playback duration, in seconds (s) or milliseconds (ms). The default unit is ms. If the value is **0**, no image is played. The value change takes effect only at the start of the next cycle. | +| fillmode5+ | string | forwards | No| Status of the frame animation after its playback is complete. Available values are as follows:
- **none**: restores to the initial status.
- **forwards**: retains the ending status defined for the last key frame.| +| id | string | - | No| Unique ID of the component.| +| style | string | - | No| Style declaration of the component.| +| class | string | - | No| Style class of the component, which is used to refer to a style table.| +| ref | string | - | No| Reference information of child elements, which is registered with the parent component on **$refs**.| + + **Table 1** ImageFrame + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| src | <uri> | - | Yes| Image path.| +| width | <length> | 0 | No| Image width.| +| height | <length> | 0 | No| Image height.| +| top | <length> | 0 | No| Vertical coordinate of the image relative to the upper left corner of the component.| +| left | <length> | 0 | No| Horizontal coordinate of the image relative to the upper left corner of the component.| + + +## Events + +| Name| Parameter| Description| +| -------- | -------- | -------- | +| stop | - | Triggered when the frame animation stops| +| click | - | Triggered when the component is clicked. | +| longpress | - | Triggered when the component is long pressed. | +| swipe5+ | [SwipeEvent](js-common-events.md) | Triggered when a user quickly swipes on the component. | + + +## Styles + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| width | <length> \| <percentage>5+ | - | No| Component width.

If this attribute is not set, the default value **0** is used.| +| height | <length> \| <percentage>5+ | - | No| Component height.

If this attribute is not set, the default value **0** is used.| +| padding | <length> | 0 | No| Shorthand attribute to set the padding for all sides.
The attribute can have one to four values:
- If you set only one value, it specifies the padding for all the four sides.
- If you set two values, the first value specifies the top and bottom padding, and the second value specifies the left and right padding.
- If you set three values, the first value specifies the top padding, the second value specifies the left and right padding, and the third value specifies the bottom padding.
- If you set four values, they respectively specify the padding for top, right, bottom, and left sides (in clockwise order).| +| padding-[left\|top\|right\|bottom] | <length> | 0 | No| Left, top, right, and bottom padding.| +| margin | <length> \| <percentage>5+ | 0 | No| Shorthand attribute to set the margin for all sides. The attribute can have one to four values:
- If you set only one value, it specifies the margin for all the four sides.
- If you set two values, the first value specifies the top and bottom margins, and the second value specifies the left and right margins.
- If you set three values, the first value specifies the top margin, the second value specifies the left and right margins, and the third value specifies the bottom margin.
- If you set four values, they respectively specify the margin for top, right, bottom, and left sides (in clockwise order).| +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | No| Left, top, right, and bottom margins.| +| border-width | <length> | 0 | No| Shorthand attribute to set the margin for all sides.| +| border-color | <color> | black | No| Shorthand attribute to set the color for all borders.| +| border-radius | <length> | - | No| Radius of round-corner borders.| +| background-color | <color> | - | No| Background color.| +| opacity5+ | number | 1 | No| Opacity of an element. The value ranges from **0** to **1**. The value **1** means opaque, and **0** means completely transparent.| +| display | string | flex | No| How and whether to display the box containing an element. Available values are as follows:
- **flex**: flexible layout
- **none**: not rendered| +| [left\|top] | <length> \| <percentage>6+ | - | No| left\|Edge of the element.
- **left**: left edge position of the element. This attribute defines the offset between the left edge of the margin area of a positioned element and left edge of its containing block.
- **top**: top edge position of the element. This attribute defines the offset between the top edge of a positioned element and that of a block included in the element.| + + +## Methods + +| Name| Parameter| Description| +| -------- | -------- | -------- | +| start | - | Starts to play the frame animation of an image. If this method is called again, the playback starts from the first frame.| +| pause | - | Pauses the frame animation playback of an image.| +| stop | - | Stops the frame animation playback of an image.| +| resume | - | Resumes the frame animation playback of an image.| +| getState | - | Obtains the playback state. Available values are as follows:
- playing
- paused
- stopped| + + +## Example + + +```html + +
+ +
+ + + + +
+
+``` + + +```css +/* xxx.css */ +.container { + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 454px; + height: 454px; +} +.animator { + width: 70px; + height: 70px; +} +.btn-box { + width: 264px; + height: 120px; + flex-wrap: wrap; + justify-content: space-around; + align-items: center; +} +.btn { + border-radius: 8px; + width: 120px; + margin-top: 8px; +} +``` + + +```js +//xxx.js +export default { + data: { + frames: [ + { + src: "/common/asserts/heart78.png", + }, + { + src: "/common/asserts/heart79.png", + }, + { + src: "/common/asserts/heart80.png", + }, + { + src: "/common/asserts/heart81.png", + }, + { + src: "/common/asserts/heart82.png", + }, + { + src: "/common/asserts/heart83.png", + }, + { + src: "/common/asserts/heart84.png", + }, + { + src: "/common/asserts/heart85.png", + }, + { + src: "/common/asserts/heart86.png", + }, + { + src: "/common/asserts/heart87.png", + }, + { + src: "/common/asserts/heart88.png", + }, + { + src: "/common/asserts/heart89.png", + }, + { + src: "/common/asserts/heart90.png", + }, + { + src: "/common/asserts/heart91.png", + }, + { + src: "/common/asserts/heart92.png", + }, + { + src: "/common/asserts/heart93.png", + }, + { + src: "/common/asserts/heart94.png", + }, + { + src: "/common/asserts/heart95.png", + }, + { + src: "/common/asserts/heart96.png", + }, + ], + }, + handleStart() { + this.$refs.animator.start(); + }, + handlePause() { + this.$refs.animator.pause(); + }, + handleResume() { + this.$refs.animator.resume(); + }, + handleStop() { + this.$refs.animator.stop(); + }, +}; +``` + +![image-animator](figures/image-animator.gif) diff --git a/en/application-dev/reference/arkui-js-lite/js-components-basic-image.md b/en/application-dev/reference/arkui-js-lite/js-components-basic-image.md new file mode 100644 index 0000000000000000000000000000000000000000..9dd520dcdeed71f6de216e8d5337d54aec33668d --- /dev/null +++ b/en/application-dev/reference/arkui-js-lite/js-components-basic-image.md @@ -0,0 +1,74 @@ +# image + +The **\** component is used to render and display images. + +> **NOTE** +> +> This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version. + + +## Child Components + +Not supported + + +## Attributes + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| src | string | No|
Image path. The supported image formats include PNG and JPG.| +| id | string | No| Unique ID of the component.| +| style | string | No| Style declaration of the component.| +| class | string | No| Style class of the component, which is used to refer to a style table.| +| ref | string | No| Reference information of child elements, which is registered with the parent component on **$refs**.| + + +## Events + +| Name| Parameter| Description| +| -------- | -------- | -------- | +| click | - | Triggered when the component is clicked. | +| longpress | - | Triggered when the component is long pressed. | +| swipe5+ | [SwipeEvent](js-common-events.md) | Triggered when a user quickly swipes on the component. | + + +## Styles + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| width | <length> \| <percentage>5+ | - | No| Component width.

If this attribute is not set, the default value **0** is used.| +| height | <length> \| <percentage>5+ | - | No| Component height.

If this attribute is not set, the default value **0** is used.| +| padding | <length> | 0 | No| Shorthand attribute to set the padding for all sides.
The attribute can have one to four values:
- If you set only one value, it specifies the padding for all the four sides.
- If you set two values, the first value specifies the top and bottom padding, and the second value specifies the left and right padding.
- If you set three values, the first value specifies the top padding, the second value specifies the left and right padding, and the third value specifies the bottom padding.
- If you set four values, they respectively specify the padding for top, right, bottom, and left sides (in clockwise order).| +| padding-[left\|top\|right\|bottom] | <length> | 0 | No| Left, top, right, and bottom padding.| +| margin | <length> \| <percentage>5+ | 0 | No| Shorthand attribute to set the margin for all sides. The attribute can have one to four values:
- If you set only one value, it specifies the margin for all the four sides.
- If you set two values, the first value specifies the top and bottom margins, and the second value specifies the left and right margins.
- If you set three values, the first value specifies the top margin, the second value specifies the left and right margins, and the third value specifies the bottom margin.
- If you set four values, they respectively specify the margin for top, right, bottom, and left sides (in clockwise order).| +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | No| Left, top, right, and bottom margins.| +| border-width | <length> | 0 | No| Shorthand attribute to set the margin for all sides.| +| border-color | <color> | black | No| Shorthand attribute to set the color for all borders.| +| border-radius | <length> | - | No| Radius of round-corner borders. | +| background-color | <color> | - | No| Background color.| +| opacity | number | 1 | No| Opacity of an element. The value ranges from **0** to **1**. The value **1** means opaque, and **0** means completely transparent.| +| display | string | flex | No| How and whether to display the box containing an element. Available values are as follows:
- **flex**: flexible layout
- **none**: not rendered| +| [left\|top] | <length> \| <percentage>6+ | - | No| left\|Edge of the element.
- **left**: left edge position of the element. This attribute defines the offset between the left edge of the margin area of a positioned element and left edge of its containing block.
- **top**: top edge position of the element. This attribute defines the offset between the top edge of a positioned element and that of a block included in the element.| + +## Example + +```html + +
+ + +
+``` + +```css +/* xxx.css */ +.container { + justify-content: center; + align-items: center; + flex-direction: column; + width: 100%; + height: 100%; +} +``` + +![image](figures/image.png) diff --git a/en/application-dev/reference/arkui-js-lite/js-components-basic-input.md b/en/application-dev/reference/arkui-js-lite/js-components-basic-input.md new file mode 100644 index 0000000000000000000000000000000000000000..a5770bcd59af1727f250b53ac6f1fe1570b4ff14 --- /dev/null +++ b/en/application-dev/reference/arkui-js-lite/js-components-basic-input.md @@ -0,0 +1,181 @@ +# input + +The **\** component provides an interactive interface to receive user input. It can be a radio button, check box, or button. + +> **NOTE** +> +> This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version. + + +## Child Components + +Not supported + + +## Attributes + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| type | string |
button | No| Type of the component, which cannot be dynamically modified. The options are as follows:
- **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. | +| 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.| +| 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.| +| id | string | - | No| Unique ID of the component.| +| style | string | - | No| Style declaration of the component.| +| class | string | - | No| Style class of the component, which is used to refer to a style table.| +| ref | string | - | No| Reference information of child elements, which is registered with the parent component on **$refs**.| + + +## Events + +- 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.| + | click | - | Triggered when the component is clicked. | + | longpress | - | Triggered when the component is long pressed. | + | swipe5+ | [SwipeEvent](js-common-events.md) | Triggered when a user quickly swipes on the component. | + +- When **type** is set to **button**, the following events are supported. + | Name| Parameter| Description| + | -------- | -------- | -------- | + | click | - | Triggered when the component is clicked. | + | longpress | - | Triggered when the component is long pressed. | + | swipe5+ | [SwipeEvent](js-common-events.md) | Triggered when a user quickly swipes on the component. | + + +## Styles + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| color | <color> | \#ffffff | No| Text color of the component.| +| font-size | <length> | 30px | No| Font size of the component.| +| width | <length> | - | No| Width of the component. The default value for a button is **100px**.| +| height | <length> | - | No| Height of the component. The default value for a button is **50px**.| +| font-family | string | SourceHanSansSC-Regular | No| Font. Only the **SourceHanSansSC-Regular** font is supported.| +| padding | <length> | 0 | No| Shorthand attribute to set the padding for all sides.
The attribute can have one to four values:
- If you set only one value, it specifies the padding for all the four sides.
- If you set two values, the first value specifies the top and bottom padding, and the second value specifies the left and right padding.
- If you set three values, the first value specifies the top padding, the second value specifies the left and right padding, and the third value specifies the bottom padding.
- If you set four values, they respectively specify the padding for top, right, bottom, and left sides (in clockwise order).| +| padding-[left\|top\|right\|bottom] | <length> | 0 | No| Left, top, right, and bottom padding.| +| margin | <length> \| <percentage>5+ | 0 | No| Shorthand attribute to set the margin for all sides. The attribute can have one to four values:
- If you set only one value, it specifies the margin for all the four sides.
- If you set two values, the first value specifies the top and bottom margins, and the second value specifies the left and right margins.
- If you set three values, the first value specifies the top margin, the second value specifies the left and right margins, and the third value specifies the bottom margin.
- If you set four values, they respectively specify the margin for top, right, bottom, and left sides (in clockwise order).| +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | No| Left, top, right, and bottom margins.| +| border-width | <length> | 0 | No| Shorthand attribute to set the margin for all sides.| +| border-color | <color> | black | No| Shorthand attribute to set the color for all borders.| +| border-radius | <length> | - | No| Radius of round-corner borders. | +| background-color | <color> | - | No| Background color.| +| display | string | flex | No| How and whether to display the box containing an element. Available values are as follows:
- **flex**: flexible layout
- **none**: not rendered| +| [left\|top] | <length> \| <percentage>6+ | - | No| Edge of the element.
- **left**: left edge position of the element. This attribute defines the offset between the left edge of the margin area of a positioned element and left edge of its containing block.
- **top**: top edge position of the element. This attribute defines the offset between the top edge of a positioned element and that of a block included in the element. | + +## Example + +1. Common button + + ```html + +
+ +
+ ``` + + ```css + /* xxx.css */ + .div-button { + flex-direction: column; + align-items: center; + width: 100%; + height: 100%; + } + .button { + margin-top: 30px; + width: 280px; + } + ``` + + ![input-type-button](figures/input-type-button.png) + + + +2. Check box + + ```html + +
+ + {{text}} +
+ ``` + + ```css + /* xxx.css */ + .content{ + width: 100%; + height: 100%; + flex-direction: column; + align-items: center; + justify-content: center; + } + .text{ + font-size: 30px; + text-align: center; + width: 200px; + margin-top: 20px; + height: 100px; + } + ``` + + ```javascript + // xxx.js + export default { + data: { + text: "text" + }, + checkboxOnChange(e) { + this.text = e.checked; + } + } + ``` + + ![input-type-checkbox](figures/input-type-checkbox.gif) + +3. Radio button + + ```html + +
+
+ + radio1 +
+
+ + radio2 +
+
+ + radio3 +
+
+ ``` + + ```css + /* xxx.css */ + .container { + width: 100%; + height: 100%; + justify-content: center; + align-items: center; + flex-direction: column; + } + .item { + width: 50%; + height: 30%; + justify-content: center; + } + .text { + margin-top: 25%; + font-size: 30px; + text-align: center; + width: 200px; + height: 100px; + } + ``` + + ![input-type-radio](figures/input-type-radio.gif) diff --git a/en/application-dev/reference/arkui-js-lite/js-components-basic-marquee.md b/en/application-dev/reference/arkui-js-lite/js-components-basic-marquee.md new file mode 100644 index 0000000000000000000000000000000000000000..8ecc7a2e41d301f03540320244425beacc39a884 --- /dev/null +++ b/en/application-dev/reference/arkui-js-lite/js-components-basic-marquee.md @@ -0,0 +1,118 @@ +# marquee + +The **\** component is used to display a scrolling piece of text. + +> **NOTE** +> +> This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version. + + +## Child Components + +Not supported + + +## Attributes + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| scrollamount | number | 6 | No| Maximum length of each scroll.| +| id | string | - | No| Unique ID of the component.| +| style | string | - | No| Style declaration of the component.| +| class | string | - | No| Style class of the component, which is used to refer to a style table.| +| ref | string | - | No| Reference information of child elements, which is registered with the parent component on **$refs**.| + + +## Events + +| Name| Parameter| Description| +| -------- | -------- | -------- | +| click | - | Triggered when the component is clicked. | +| longpress | - | Triggered when the component is long pressed. | +| swipe5+ | [SwipeEvent](js-common-events.md) | Triggered when a user quickly swipes on the component. | + + +## Styles + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| color | <color> | \#ffffff


| No| Font color of the scrolling text.| +| font-size | <length> |
30 | No| Font size of the scrolling text.| +| font-family | string |

SourceHanSansSC-Regular | No|

Font. Only the **SourceHanSansSC-Regular** font is supported.| +| width | <length> \| <percentage>5+ | - | No| Component width.

If this attribute is not set, the default value **0** is used.| +| height | <length> \| <percentage>5+ | - | No| Component height.

If this attribute is not set, the default value **0** is used.| +| padding | <length> | 0 | No| Shorthand attribute to set the padding for all sides.
The attribute can have one to four values:
- If you set only one value, it specifies the padding for all the four sides.
- If you set two values, the first value specifies the top and bottom padding, and the second value specifies the left and right padding.
- If you set three values, the first value specifies the top padding, the second value specifies the left and right padding, and the third value specifies the bottom padding.
- If you set four values, they respectively specify the padding for top, right, bottom, and left sides (in clockwise order).| +| padding-[left\|top\|right\|bottom] | <length> | 0 | No| Left, top, right, and bottom padding.| +| margin | <length> \| <percentage>5+ | 0 | No| Shorthand attribute to set the margin for all sides. The attribute can have one to four values:
- If you set only one value, it specifies the margin for all the four sides.
- If you set two values, the first value specifies the top and bottom margins, and the second value specifies the left and right margins.
- If you set three values, the first value specifies the top margin, the second value specifies the left and right margins, and the third value specifies the bottom margin.
- If you set four values, they respectively specify the margin for top, right, bottom, and left sides (in clockwise order).| +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | No| Left, top, right, and bottom margins.| +| border-width | <length> | 0 | No| Shorthand attribute to set the margin for all sides.| +| border-color | <color> | black | No| Shorthand attribute to set the color for all borders.| +| border-radius | <length> | - | No| Radius of round-corner borders.| +| background-color | <color> | - | No| Background color.| +| opacity5+ | number | 1 | No| Opacity of an element. The value ranges from **0** to **1**. The value **1** means opaque, and **0** means completely transparent.| +| display | string | flex | No| How and whether to display the box containing an element. Available values are as follows:
- **flex**: flexible layout
- **none**: not rendered| +| [left\|top] | <length> \| <percentage>6+ | - | No| left\|Edge of the element.
- **left**: left edge position of the element. This attribute defines the offset between the left edge of the margin area of a positioned element and left edge of its containing block.
- **top**: top edge position of the element. This attribute defines the offset between the top edge of a positioned element and that of a block included in the element.| + +## Example + +```html + +
+ {{marqueeCustomData}} + speed+ + speed- + changeData +
+``` + +```css +/* xxx.css */ +.container { + flex-direction: column; + width: 100%; + height: 100%; + flex-direction: column; + align-items: center; +} +.customMarquee { + width: 50%; + height: 80px; + padding: 10px; + margin: 20px; + border-width: 4px; + border-color: #ffffff; + border-radius: 20px; + font-size: 38px; +} +.text { + font-size: 30px; + text-align: center; + width: 30%; + height: 10%; + margin-top: 5%; + background-color: #f2f2f2; + border-radius: 40px; + color: #0d81f2; +} +``` + +```javascript +// xxx.js +export default { + data: { + scrollAmount: 30, + marqueeCustomData: 'Custom marquee Custom marquee Custom marquee' + }, + addSpeed() { + this.scrollAmount++; + }, + downSpeed() { + this.scrollAmount--; + }, + changeData() { + this.marqueeCustomData = 'Change Data Change Data Change Data'; + } +} +``` + +![marquee](figures/marquee.gif) diff --git a/en/application-dev/reference/arkui-js-lite/js-components-basic-picker-view.md b/en/application-dev/reference/arkui-js-lite/js-components-basic-picker-view.md new file mode 100644 index 0000000000000000000000000000000000000000..e9dacebc6c419bfaeca6c8aac9c1001e0725bd1f --- /dev/null +++ b/en/application-dev/reference/arkui-js-lite/js-components-basic-picker-view.md @@ -0,0 +1,145 @@ +# 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 + +Not supported + + +## Attributes + +| 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.| +| id | string | - | No| Unique ID of the component.| +| style | string | - | No| Style declaration of the component.| +| class | string | - | No| Style class of the component, which is used to refer to a style table.| +| ref | string | - | No| Reference information of child elements, which is registered with the parent component on **$refs**.| + +Text selector (**type** is **text**) + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| range | Array | - | No| Value range of the text selector.
Use data binding, for example, **range = {{data}}**, to specify the range. Declare the corresponding variable in the JavaScript: **data: ["15", "20", "25"]**.| +| selected | string | 0 | No| Default value of the text selector. The value is the index of **range**.| + +Time selector (**type** is **time**) + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| selected | string | 00:00 | No| Default value of the time selector, in the format of HH:mm.
| + + +## Events + +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} | Triggered when a value is specified for the time selector. | + + +## Styles + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| color | <color> | \#808080 | No| Font color of a candidate item.| +| font-size | <length> | 30px | No| Font size of a candidate item. The value is of the length type, in pixels.| +| selected-color | <color> | \#ffffff | No| Font color of the selected item.| +| selected-font-size | <length> | 38px | No| Font size of the selected item. The value is of the length type, in pixels.| +| selected-font-family | string | HYQiHei-65S | No| Font type of the selected item.| +| font-family | string | HYQiHei-65S | No| Font type of an item.| +| width | <length> \| <percentage>5+ | - | No| Component width.
If this attribute is not set, the default value **0** is used. | +| height | <length> \| <percentage>5+ | - | No| Component height.
If this attribute is not set, the default value **0** is used. | +| padding | <length> | 0 | No| Shorthand attribute to set the padding for all sides.
The attribute can have one to four values:
- If you set only one value, it specifies the padding for all the four sides.
- If you set two values, the first value specifies the top and bottom padding, and the second value specifies the left and right padding.
- If you set three values, the first value specifies the top padding, the second value specifies the left and right padding, and the third value specifies the bottom padding.
- If you set four values, they respectively specify the padding for top, right, bottom, and left sides (in clockwise order).| +| padding-[left\|top\|right\|bottom] | <length> | 0 | No| Left, top, right, and bottom padding.| +| margin | <length> \| <percentage>5+ | 0 | No| Shorthand attribute to set the margin for all sides. The attribute can have one to four values:
- If you set only one value, it specifies the margin for all the four sides.
- If you set two values, the first value specifies the top and bottom margins, and the second value specifies the left and right margins.
- If you set three values, the first value specifies the top margin, the second value specifies the left and right margins, and the third value specifies the bottom margin.
- If you set four values, they respectively specify the margin for top, right, bottom, and left sides (in clockwise order).| +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | No| Left, top, right, and bottom margins.| +| border-width | <length> | 0 | No| Shorthand attribute to set the margin for all sides.| +| border-color | <color> | black | No| Shorthand attribute to set the color for all borders.| +| border-radius | <length> | - | No| Radius of round-corner borders.| +| background-color | <color> | - | No| Background color.| +| display | string | flex | No| How and whether to display the box containing an element. Available values are as follows:
- **flex**: flexible layout
- **none**: not rendered| +| [left\|top] | <length> \| <percentage>6+ | - | No| Edge of the element.
- **left**: left edge position of the element. This attribute defines the offset between the left edge of the margin area of a positioned element and left edge of its containing block.
- **top**: top edge position of the element. This attribute defines the offset between the top edge of a positioned element and that of a block included in the element. | + + +## Example + + +```html + +
+ + Selected: {{time}} + + +
+``` + + +```css +/* xxx.css */ +.container { + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 454px; + height: 454px; +} +.title { + font-size: 30px; + text-align: center; +} +.time-picker { + width: 500px; + height: 400px; + margin-top: 20px; +} +``` + + +```js +/* xxx.js */ +export default { + data: { + defaultTime: "", + time: "", + }, + onInit() { + this.defaultTime = this.now(); + }, + handleChange(data) { + this.time = this.concat(data.hour, data.minute); + }, + now() { + const date = new Date(); + const hours = date.getHours(); + const minutes = date.getMinutes(); + return this.concat(hours, minutes); + }, + + fill(value) { + return (value > 9 ? "" : "0") + value; + }, + + concat(hours, minutes) { + return `${this.fill(hours)}:${this.fill(minutes)}`; + }, +} +``` + +![picker-view](figures/picker-view.png) diff --git a/en/application-dev/reference/arkui-js-lite/js-components-basic-progress.md b/en/application-dev/reference/arkui-js-lite/js-components-basic-progress.md new file mode 100644 index 0000000000000000000000000000000000000000..740bc136bc0a506cc6f28f883424fb2a62b15504 --- /dev/null +++ b/en/application-dev/reference/arkui-js-lite/js-components-basic-progress.md @@ -0,0 +1,125 @@ +# progress + +The **\** component is used to provide a progress bar that displays the progress of content loading or an operation. + +> **NOTE** +> +> This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version. + + +## Child Components + +Not supported + + +## Attributes + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| type | string | horizontal | No| Type of the progress bar, which cannot be changed dynamically. Available values are as follows:
- **horizontal**: linear progress bar.
- **arc**: arc progress bar.| +| id | string | - | No| Unique ID of the component.| +| style | string | - | No| Style declaration of the component.| +| class | string | - | No| Style class of the component, which is used to refer to a style table.| +| ref | string | - | No| Reference information of child elements, which is registered with the parent component on **$refs**.| + +Different types of progress bars support different attributes. + +- When **type** is set to **horizontal**, the following attributes are supported. + | Name| Type| Default Value| Mandatory| Description| + | -------- | -------- | -------- | -------- | -------- | + | percent | number | 0 | No| Current progress. The value ranges from 0 to 100.| + +- When **type** is set to **arc**, the following attributes are supported. + | Name| Type| Default Value| Mandatory| Description| + | -------- | -------- | -------- | -------- | -------- | + | percent | number | 0 | No| Current progress. The value ranges from 0 to 100.| + + +## Events + +| Name| Parameter| Description| +| -------- | -------- | -------- | +| click | - | Triggered when the component is clicked. | +| longpress | - | Triggered when the component is long pressed. | +| swipe5+ | [SwipeEvent](js-common-events.md) | Triggered when a user quickly swipes on the component. | + + +## Styles + +- When **type** is set to **horizontal**, the following styles are supported. + + | Name | Type | Default Value | Mandatory| Description | + | ------------ | -------------- | ---------------------------------------------- | ---- | ------------------ | + | color | <color> | \#6b9ac7 | No | Color of the progress bar.| + | stroke-width | <length> | 321-4 \| 45+px | No | Stroke width of the progress bar.| + +- When **type** is set to **arc**, the following styles are supported. + + | Name | Type | Default Value| Mandatory| Description | + | ---------------- | -------------- | ------ | ---- | ------------------------------------------------------------ | + | color | <color> | - | No | Color of the arc progress bar. | + | background-color | <color> | - | No | Background color of the arc progress bar. | + | stroke-width | <length> | - | No | Width of the arc progress bar.
A larger width value means that the progress bar is closer to the center of the circle. The width is always within the radius range.| + | start-angle | <deg> | 240 | No | Start angle of the arc progress bar, which starts from the direction of zero o'clock. The value ranges from 0 to 360 degrees (clockwise).| + | total-angle | <deg> | 240 | No | Total length of the arc progress bar. The value ranges from –360 to 360. A negative number indicates anticlockwise.| + | center-x | <length> | - | No | Center of the arc progress bar (with the upper left corner of this widget as the coordinate origin). This style must be used together with **center-y** and **radius**.| + | center-y | <length> | - | No | Center of the arc progress bar (with the upper left corner of this widget as the coordinate origin). This style must be used together with **center-x** and **radius**.| + | radius | <length> | - | No | Radius of the arc progress bar. This style must be used together with **center-x** and **center-y**. | + +In addition to the preceding styles, the following styles are supported. + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| width | <length> \| <percentage>5+ | - | No| Component width.
If this attribute is not set, the default value **0** is used.| +| height | <length> \| <percentage>5+ | - | No| Component height.
If this attribute is not set, the default value **0** is used.| +| padding | <length> | 0 | No| Shorthand attribute to set the padding for all sides.
The attribute can have one to four values:
- If you set only one value, it specifies the padding for all the four sides.
- If you set two values, the first value specifies the top and bottom padding, and the second value specifies the left and right padding.
- If you set three values, the first value specifies the top padding, the second value specifies the left and right padding, and the third value specifies the bottom padding.
- If you set four values, they respectively specify the padding for top, right, bottom, and left sides (in clockwise order).| +| padding-[left\|top\|right\|bottom] | <length> | 0 | No| Left, top, right, and bottom padding.| +| margin | <length> \| <percentage>5+ | 0 | No| Shorthand attribute to set the margin for all sides. The attribute can have one to four values:
- If you set only one value, it specifies the margin for all the four sides.
- If you set two values, the first value specifies the top and bottom margins, and the second value specifies the left and right margins.
- If you set three values, the first value specifies the top margin, the second value specifies the left and right margins, and the third value specifies the bottom margin.
- If you set four values, they respectively specify the margin for top, right, bottom, and left sides (in clockwise order).| +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | No| Left, top, right, and bottom margins.| +| border-width | <length> | 0 | No| Shorthand attribute to set the margin for all sides.| +| border-color | <color> | black | No| Shorthand attribute to set the color for all borders.| +| border-radius | <length> | - | No| Radius of round-corner borders.| +| display | string | flex | No| How and whether to display the box containing an element. Available values are as follows:
- **flex**: flexible layout
- **none**: not rendered| +| [left\|top] | <length> \| <percentage>6+ | - | No| Edge of the element.
- **left**: left edge position of the element. This attribute defines the offset between the left edge of the margin area of a positioned element and left edge of its containing block.
- **top**: top edge position of the element. This attribute defines the offset between the top edge of a positioned element and that of a block included in the element. | + +## Example + +```html + +
+ + +
+``` + +```css +/* xxx.css */ +.container { + flex-direction: column; + height: 100%; + width: 100%; + align-items: center; +} +.min-progress { + width: 300px; + height: 300px; +} +``` + +```javascript +// xxx.js +export default { + data: { + arcVal: 0, + horizontalVal: 0 + }, + changeArc() { + this.arcVal+= 10; + }, + changeHorizontal() { + this.horizontalVal+= 10; + } +} +``` + +![progress](figures/progress.png) diff --git a/en/application-dev/reference/arkui-js-lite/js-components-basic-qrcode.md b/en/application-dev/reference/arkui-js-lite/js-components-basic-qrcode.md new file mode 100644 index 0000000000000000000000000000000000000000..16ef26d1b4263b0217c9fedfc8f04016fe7175db --- /dev/null +++ b/en/application-dev/reference/arkui-js-lite/js-components-basic-qrcode.md @@ -0,0 +1,125 @@ +# qrcode + + +The **\** component is used to generate and display a QR code. + +> **NOTE** +> +> This component is supported since API version 5. Updates will be marked with a superscript to indicate their earliest API version. + + +## Child Components + +Not supported + + +## Attributes + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| value | string | - | Yes| Content used to generate the QR code. The maximum length is 256.| +| id | string | - | No| Unique ID of the component.| +| style | string | - | No| Style declaration of the component.| +| class | string | - | No| Style class of the component, which is used to refer to a style table.| +| ref | string | - | No| Reference information of child elements, which is registered with the parent component on **$refs**.| + + +## Events + +| Name| Parameter| Description| +| -------- | -------- | -------- | +| click | - | Triggered when the component is clicked. | +| longpress | - | Triggered when the component is long pressed. | +| swipe5+ | [SwipeEvent](js-common-events.md) | Triggered when a user quickly swipes on the component. | + + +## Styles + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| color | <color> | \#000000 | No| Color of the QR code.| +| background-color | <color> | \#ffffff | No| Background color of the QR code.| +| width | <length> \| <percentage>5+ | - | No| Component width.
If this attribute is not set, the default value **0** is used. | +| height | <length> \| <percentage>5+ | - | No| Component height.
If this attribute is not set, the default value **0** is used. | +| padding | <length> | 0 | No| Shorthand attribute to set the padding for all sides.
The attribute can have one to four values:
- If you set only one value, it specifies the padding for all the four sides.
- If you set two values, the first value specifies the top and bottom padding, and the second value specifies the left and right padding.
- If you set three values, the first value specifies the top padding, the second value specifies the left and right padding, and the third value specifies the bottom padding.
- If you set four values, they respectively specify the padding for top, right, bottom, and left sides (in clockwise order).| +| padding-[left\|top\|right\|bottom] | <length> | 0 | No| Left, top, right, and bottom padding.| +| margin | <length> \| <percentage>5+ | 0 | No| Shorthand attribute to set the margin for all sides. The attribute can have one to four values:
- If you set only one value, it specifies the margin for all the four sides.
- If you set two values, the first value specifies the top and bottom margins, and the second value specifies the left and right margins.
- If you set three values, the first value specifies the top margin, the second value specifies the left and right margins, and the third value specifies the bottom margin.
- If you set four values, they respectively specify the margin for top, right, bottom, and left sides (in clockwise order).| +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | No| Left, top, right, and bottom margins.| +| border-width | <length> | 0 | No| Shorthand attribute to set the margin for all sides.| +| border-color | <color> | black | No| Shorthand attribute to set the color for all borders.| +| border-radius | <length> | - | No| Radius of round-corner borders.| +| display | string | flex | No| How and whether to display the box containing an element. Available values are as follows:
- **flex**: flexible layout
- **none**: not rendered| +| [left\|top] | <length> \| <percentage>6+ | - | No| Edge of the element.
- **left**: left edge position of the element. This attribute defines the offset between the left edge of the margin area of a positioned element and left edge of its containing block.
- **top**: top edge position of the element. This attribute defines the offset between the top edge of a positioned element and that of a block included in the element. | + +> **NOTE** +> - If the values of **width** and **height** are different, the smaller value is used as the length of the QR code. The generated QR code is center displayed. +> +>- The minimum values of **width** and **height** are 200 px. + + +## Example + + +```html + +
+ + Color + BackgroundColor + Value +
+``` + +```css +/* xxx.css */ +.container { + width: 100%; + height: 100%; + flex-direction: column; + justify-content: center; + align-items: center; +} +.qrCode { + width: 200px; + height: 200px; +} +.button { + width: 30%; + height: 10%; + margin-top: 5%; +} +``` + +```javascript +// xxx.js +export default { + data: { + qr_col: '#87ceeb', + qr_bcol: '#f0ffff', + qr_value: 'value' + }, + changeColor() { + if (this.qr_col == '#87ceeb') { + this.qr_col = '#fa8072'; + } else { + this.qr_col = '#87ceeb'; + } + }, + changeBackgroundColor() { + if (this.qr_bcol == '#f0ffff') { + this.qr_bcol = '#ffffe0'; + } else { + this.qr_bcol = '#f0ffff'; + } + }, + changeValue() { + if (this.qr_value == 'value') { + this.qr_value = 'change'; + } else { + this.qr_value = 'value'; + } + } +} +``` + +![qrcode](figures/qrcode.gif) diff --git a/en/application-dev/reference/arkui-js-lite/js-components-basic-slider.md b/en/application-dev/reference/arkui-js-lite/js-components-basic-slider.md new file mode 100644 index 0000000000000000000000000000000000000000..8e69b18afe816c1691743976bf7ab72c2b124a36 --- /dev/null +++ b/en/application-dev/reference/arkui-js-lite/js-components-basic-slider.md @@ -0,0 +1,102 @@ +# slider + +The **\** component is used to quickly adjust settings, such as the volume and brightness. + +> **NOTE** +> +> This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version. + + +## Child Components + +Not supported + + +## Attributes + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| min | number | 0 | No| Minimum value of the slider.| +| max | number | 100 | No| Maximum value of the slider.| +| value | number | 0 | No| Initial value of the slider.| +| id | string | - | No| Unique ID of the component.| +| style | string | - | No| Style declaration of the component.| +| class | string | - | No| Style class of the component, which is used to refer to a style table.| +| ref | string | - | No| Reference information of child elements, which is registered with the parent component on **$refs**.| + + +## Events + +| Name| Parameter| Description| +| -------- | -------- | -------- | +| change | ChangeEvent | Triggered when the value changes.| +| click | - | Triggered when the component is clicked. | +| longpress | - | Triggered when the component is long pressed. | +| swipe5+ | [SwipeEvent](js-common-events.md) | Triggered when a user quickly swipes on the component. | + + **Table 2** ChangeEvent + +| Attribute| Type| Description| +| -------- | -------- | -------- | +| progress(deprecated5+) | string | Current value of the slider.| +| value5+ | number | Current value of the slider.| + + +## Styles + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| color | <color> | \#000000 | No| Background color of the slider.| +| selected-color | <color> | \#ffffff | No| Selected color of the slider.| +| width | <length> \| <percentage>5+ | - | No| Component width.
If this attribute is not set, the default value **0** is used. | +| height | <length> \| <percentage>5+ | - | No| Component height.
If this attribute is not set, the default value **0** is used. | +| padding | <length> | 0 | No| Shorthand attribute to set the padding for all sides.
The attribute can have one to four values:
- If you set only one value, it specifies the padding for all the four sides.
- If you set two values, the first value specifies the top and bottom padding, and the second value specifies the left and right padding.
- If you set three values, the first value specifies the top padding, the second value specifies the left and right padding, and the third value specifies the bottom padding.
- If you set four values, they respectively specify the padding for top, right, bottom, and left sides (in clockwise order).| +| padding-[left\|top\|right\|bottom] | <length> | 0 | No| Left, top, right, and bottom padding.| +| margin | <length> \| <percentage>5+ | 0 | No| Shorthand attribute to set the margin for all sides. The attribute can have one to four values:
- If you set only one value, it specifies the margin for all the four sides.
- If you set two values, the first value specifies the top and bottom margins, and the second value specifies the left and right margins.
- If you set three values, the first value specifies the top margin, the second value specifies the left and right margins, and the third value specifies the bottom margin.
- If you set four values, they respectively specify the margin for top, right, bottom, and left sides (in clockwise order).| +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | No| Left, top, right, and bottom margins.| +| border-width | <length> | 0 | No| Shorthand attribute to set the margin for all sides.| +| border-color | <color> | black | No| Shorthand attribute to set the color for all borders.| +| border-radius | <length> | - | No| Radius of round-corner borders.| +| background-color | <color> | - | No| Background color.| +| display | string | flex | No| How and whether to display the box containing an element. Available values are as follows:
- **flex**: flexible layout
- **none**: not rendered| +| [left\|top] | <length> \| <percentage>6+ | - | No| Edge of the element.
- **left**: left edge position of the element. This attribute defines the offset between the left edge of the margin area of a positioned element and left edge of its containing block.
- **top**: top edge position of the element. This attribute defines the offset between the top edge of a positioned element and that of a block included in the element. | + +## Example + +```html + +
+ slider start value is {{startValue}} + slider current value is {{currentValue}} + slider end value is {{endValue}} + +
+``` + +```css +/* xxx.css */ +.container { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + height: 100%; +} +``` + +```javascript +// xxx.js +export default { + data: { + value: 0, + startValue: 0, + currentValue: 0, + endValue: 100, + }, + setvalue(e) { + this.currentValue = e.value; + } +} +``` + +![slider](figures/slider.png) diff --git a/en/application-dev/reference/arkui-js-lite/js-components-basic-switch.md b/en/application-dev/reference/arkui-js-lite/js-components-basic-switch.md new file mode 100644 index 0000000000000000000000000000000000000000..42b4bddc549dcda654c2925d164e2eada3190910 --- /dev/null +++ b/en/application-dev/reference/arkui-js-lite/js-components-basic-switch.md @@ -0,0 +1,99 @@ +# switch + +The **\** component is used to enable or disable a function. + +> **NOTE** +> +> This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version. + + +## Child Components + +Not supported + + +## Attributes + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| checked | boolean | false | No| Whether the component is checked or not.| +| id | string | - | No| Unique ID of the component.| +| style | string | - | No| Style declaration of the component.| +| class | string | - | No| Style class of the component, which is used to refer to a style table.| +| ref | string | - | No| Reference information of child elements, which is registered with the parent component on **$refs**.| + + +## Events + +| Name| Parameter| Description| +| -------- | -------- | -------- | +| change | { checked: checkedValue } | Triggered when the **checked** state changes.| +| click | - | Triggered when the component is clicked. | +| longpress | - | Triggered when the component is long pressed. | +| swipe5+ | [SwipeEvent](js-common-events.md) | Triggered when a user quickly swipes on the component. | + + +## Styles + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| width | <length> \| <percentage>5+ | - | No| Component width.

If this attribute is not set, the default value **0** is used.| +| height | <length> \| <percentage>5+ | - | No| Component height.

If this attribute is not set, the default value **0** is used.| +| padding | <length> | 0 | No| Shorthand attribute to set the padding for all sides.
The attribute can have one to four values:
- If you set only one value, it specifies the padding for all the four sides.
- If you set two values, the first value specifies the top and bottom padding, and the second value specifies the left and right padding.
- If you set three values, the first value specifies the top padding, the second value specifies the left and right padding, and the third value specifies the bottom padding.
- If you set four values, they respectively specify the padding for top, right, bottom, and left sides (in clockwise order).| +| padding-[left\|top\|right\|bottom] | <length> | 0 | No| Left, top, right, and bottom padding.| +| margin | <length> \| <percentage>5+ | 0 | No| Shorthand attribute to set the margin for all sides. The attribute can have one to four values:
- If you set only one value, it specifies the margin for all the four sides.
- If you set two values, the first value specifies the top and bottom margins, and the second value specifies the left and right margins.
- If you set three values, the first value specifies the top margin, the second value specifies the left and right margins, and the third value specifies the bottom margin.
- If you set four values, they respectively specify the margin for top, right, bottom, and left sides (in clockwise order).| +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | No| Left, top, right, and bottom margins.| +| border-width | <length> | 0 | No| Shorthand attribute to set the margin for all sides.| +| border-color | <color> | black | No| Shorthand attribute to set the color for all borders.| +| border-radius | <length> | - | No| Radius of round-corner borders.| +| background-color | <color> | - | No| Background color.| +| display | string | flex | No| How and whether to display the box containing an element. Available values are as follows:
- **flex**: flexible layout
- **none**: not rendered| +| [left\|top] | <length> \| <percentage>6+ | - | No| left\|Edge of the element.
- **left**: left edge position of the element. This attribute defines the offset between the left edge of the margin area of a positioned element and left edge of its containing block.
- **top**: top edge position of the element. This attribute defines the offset between the top edge of a positioned element and that of a block included in the element.| + +## Example + +```html + +
+
+ + {{title}} +
+
+``` + +```css +/* xxx.css */ +.container { + width: 100%; + height: 100%; + justify-content: center; + align-items: center; +} +.box{ + width: 18%; + height: 25%; + flex-direction:column; + justify-content: center; + align-items: center; +} +``` + +```javascript +// xxx.js +export default { + data: { + title: 'on' + }, + switchChange(e){ + console.log(e.checked); + if(e.checked){ + this.title="on" + }else{ + this.title="off" + } + } +} +``` + +![switch](figures/switch.gif) diff --git a/en/application-dev/reference/arkui-js-lite/js-components-basic-text.md b/en/application-dev/reference/arkui-js-lite/js-components-basic-text.md new file mode 100644 index 0000000000000000000000000000000000000000..e5eab00c2eb0434932a0400d87f87f413d47c8ce --- /dev/null +++ b/en/application-dev/reference/arkui-js-lite/js-components-basic-text.md @@ -0,0 +1,99 @@ +# text + +The **\** component is used to display a piece of textual information. + +> **NOTE** +> +> This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version. + + +## Child Components + +Not supported + + +## Attributes + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| id | string | - | No| Unique ID of the component.| +| style | string | - | No| Style declaration of the component.| +| class | string | - | No| Style class of the component, which is used to refer to a style table.| +| ref | string | - | No| Reference information of child elements, which is registered with the parent component on **$refs**.| + + +## Events + +| Name| Parameter| Description| +| -------- | -------- | -------- | +| click | - | Triggered when the component is clicked.| +| longpress | - | Triggered when the component is long pressed.| +| swipe5+ | [SwipeEvent](js-common-events.md) | Triggered when a user quickly swipes on the component.| + + +## Styles + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| color | <color> | \#ffffff | No| Font color.| +| font-size | <length> | 30px | No| Font size. | +| letter-spacing | <length> | 2px | No| Character spacing (px).| +| text-align | string | left | No| Text alignment mode. Available values are as follows:
- **left**: The text is left-aligned.
- **center**: The text is center-aligned.
- **right**: The text is right-aligned.| +| text-overflow | string | clip | No| Available values are as follows:
- **clip**: The text is clipped and displayed based on the size of the parent container.
- **ellipsis**: The text is displayed based on the size of the parent container. The text that cannot be displayed is replaced with ellipsis.| +| font-family | string | SourceHanSansSC-Regular | No| Font. Only the **SourceHanSansSC-Regular** font is supported.| +| width | <length> \| <percentage>5+ | 0px | No| Component width.
Unit: pixel
If this attribute is not set, the default value **0** is used.| +| height | <length> \| <percentage>5+ | 0px | No| Component height.
Unit: pixel
If this attribute is not set, the default value **0** is used.| +| padding | <length> | 0 | No| Shorthand attribute to set the padding for all sides.
The attribute can have one to four values:
- If you set only one value, it specifies the padding for all the four sides.
- If you set two values, the first value specifies the top and bottom padding, and the second value specifies the left and right padding.
- If you set three values, the first value specifies the top padding, the second value specifies the left and right padding, and the third value specifies the bottom padding.
- If you set four values, they respectively specify the padding for top, right, bottom, and left sides (in clockwise order).| +| padding-[left\|top\|right\|bottom] | <length> | 0 | No| Left, top, right, and bottom padding.| +| margin | <length> \| <percentage>5+ | 0 | No| Shorthand attribute to set the margin for all sides. The attribute can have one to four values:
- If you set only one value, it specifies the margin for all the four sides.
- If you set two values, the first value specifies the top and bottom margins, and the second value specifies the left and right margins.
- If you set three values, the first value specifies the top margin, the second value specifies the left and right margins, and the third value specifies the bottom margin.
- If you set four values, they respectively specify the margin for top, right, bottom, and left sides (in clockwise order).| +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | No| Left, top, right, and bottom margins.| +| border-width | <length> | 0 | No| Shorthand attribute to set the margin for all sides.| +| border-color | <color> | black | No| Shorthand attribute to set the color for all borders.| +| border-radius | <length> | - | No| Radius of round-corner borders.| +| background-color | <color> | - | No| Background color.| +| opacity5+ | number | 1 | No| Opacity of an element. The value ranges from **0** to **1**. The value **1** means opaque, and **0** means completely transparent.| +| display | string | flex | No| How and whether to display the box containing an element. Available values are as follows:
- **flex**: flexible layout
- **none**: not rendered| +| [left\|top] | <length> \| <percentage>6+ | - | No| Edge of the element.
- **left**: left edge position of the element. This attribute defines the offset between the left edge of the margin area of a positioned element and left edge of its containing block.
- **top**: top edge position of the element. This attribute defines the offset between the top edge of a positioned element and that of a block included in the element. | +| line-height10+ | number | 0px | No| Text line height.
Unit: pixel
If this attribute is not set, the text line height is adaptive.| + +## Example + +```html + +
+ + Hello {{ title }} + +
+``` + +```CSS +/* xxx.css */ +.container { + width: 100%; + height: 100%; + justify-content: center; + align-items: center; +} + +.title { + width: 100px; + font-size: 30px; + text-align: center; + color: red; +} +``` + +```javascript +// xxx.js +export default { + data: { + title: "" + }, + onInit() { + this.title = "World"; + } +} +``` + +![text](figures/text.png) diff --git a/en/application-dev/reference/arkui-js-lite/js-components-canvas-canvas.md b/en/application-dev/reference/arkui-js-lite/js-components-canvas-canvas.md new file mode 100644 index 0000000000000000000000000000000000000000..58b8642f8acb1adafb2a10242c8eee6ef850523b --- /dev/null +++ b/en/application-dev/reference/arkui-js-lite/js-components-canvas-canvas.md @@ -0,0 +1,55 @@ +# canvas + +The **\** component is used for customizing drawings. + +> **NOTE** +> +> This component is supported since API version 5. Updates will be marked with a superscript to indicate their earliest API version. + + +## Child Components + +Not supported + + +## Attributes + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| id | string | - | No| Unique ID of the component.| +| style | string | - | No| Style declaration of the component.| +| class | string | - | No| Style class of the component, which is used to refer to a style table.| +| ref | string | - | No| Reference information of child elements, which is registered with the parent component on **$refs**.| + + +## Events + +| Name| Parameter| Description| +| -------- | -------- | -------- | +| click | - | Triggered when the component is clicked.| +| longpress | - | Triggered when the component is long pressed.| +| swipe5+ | [SwipeEvent](js-common-events.md) | Triggered when a user quickly swipes on the component.| + + +## Styles + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| width | <length> \| <percentage>5+ | - | No| Component width.
If this attribute is not set, the default value **0** is used. | +| height | <length> \| <percentage>5+ | - | No| Component height.
If this attribute is not set, the default value **0** is used. | +| padding | <length> | 0 | No| Shorthand attribute to set the padding for all sides.
The attribute can have one to four values:
- If you set only one value, it specifies the padding for all the four sides.
- If you set two values, the first value specifies the top and bottom padding, and the second value specifies the left and right padding.
- If you set three values, the first value specifies the top padding, the second value specifies the left and right padding, and the third value specifies the bottom padding.
- If you set four values, they respectively specify the padding for top, right, bottom, and left sides (in clockwise order).| +| margin | <length> \| <percentage>5+ | 0 | No| Shorthand attribute to set the margin for all sides. The attribute can have one to four values:
- If you set only one value, it specifies the margin for all the four sides.
- If you set two values, the first value specifies the top and bottom margins, and the second value specifies the left and right margins.
- If you set three values, the first value specifies the top margin, the second value specifies the left and right margins, and the third value specifies the bottom margin.
- If you set four values, they respectively specify the margin for top, right, bottom, and left sides (in clockwise order).| +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | No| Left, top, right, and bottom margins.| +| border-width | <length> | 0 | No| Shorthand attribute to set the margin for all sides.| +| border-color | <color> | black | No| Shorthand attribute to set the color for all borders.| +| border-radius | <length> | - | No| Radius of round-corner borders.| +| background-color | <color> | - | No| Background color.| +| display | string | flex | No| How and whether to display the box containing an element. Available values are as follows:
- **flex**: flexible layout
- **none**: not rendered| +| [left\|top] | <length> \| <percentage>6+ | - | No| Edge of the element.
- **left**: left edge position of the element. This attribute defines the offset between the left edge of the margin area of a positioned element and left edge of its containing block.
- **top**: top edge position of the element. This attribute defines the offset between the top edge of a positioned element and that of a block included in the element. | + + +## Methods + +| Name| Parameter| Description| +| -------- | -------- | -------- | +| getContext | string | Obtains the context of the drawing on a canvas. The parameter can be set only to **2d**. The return value is a 2D drawing object that provides specific 2D drawing operations. For details, see [CanvasRenderingContext2D](js-components-canvas-canvasrenderingcontext2d.md).| diff --git a/en/application-dev/reference/arkui-js-lite/js-components-canvas-canvasrenderingcontext2d.md b/en/application-dev/reference/arkui-js-lite/js-components-canvas-canvasrenderingcontext2d.md new file mode 100644 index 0000000000000000000000000000000000000000..1e5a349bff3f2fa7bf97fcefd67601a36bb3bb8a --- /dev/null +++ b/en/application-dev/reference/arkui-js-lite/js-components-canvas-canvasrenderingcontext2d.md @@ -0,0 +1,365 @@ +# CanvasRenderingContext2D + + +**CanvasRenderingContext2D** allows you to draw rectangles and text on a canvas. + +**Example** + +```html + + + + +``` + + +```javascript +// xxx.js +export default { + handleClick() { + const el = this.$refs.canvas1; + const ctx = el.getContext('2d'); + ctx.beginPath(); + ctx.arc(100, 75, 50, 0, 6.28); + ctx.stroke(); + }, +} +``` + + ![en-us_image_0000001431548113](figures/en-us_image_0000001431548113.png) + + +## fillRect() + +Fills a rectangle on the canvas. + +**Parameters** + +| Parameter| Type| Description| +| -------- | -------- | -------- | +| x | number | X-coordinate of the upper left corner of the rectangle.| +| y | number | Y-coordinate of the upper left corner of the rectangle.| +| width | number | Width of the rectangle.| +| height | number | Height of the rectangle.| + +**Example** + + ![en-us_image_0000001431388525](figures/en-us_image_0000001431388525.png) + + + ```javascript + ctx.fillRect(20, 20, 200, 150); + ``` + + +## fillStyle + +Sets the style to fill an area. + +**Parameters** + +| Parameter| Type| Description| +| -------- | -------- | -------- | +| color | <color> | Color used to fill the area| + +**Example** + + ![en-us_image_0000001431388505](figures/en-us_image_0000001431388505.png) + + + ```javascript + ctx.fillStyle = '#0000ff'; + ctx.fillRect(20, 20, 150, 100); + ``` + + +## strokeRect() + +Draws a rectangle stroke on the canvas. + +**Parameters** + +| Parameter| Type| Description| +| -------- | -------- | -------- | +| x | number | X-coordinate of the upper left corner of the rectangle.| +| y | number | Y-coordinate of the upper left corner of the rectangle.| +| width | number | Width of the rectangle.| +| height | number | Height of the rectangle.| + +**Example** + + ![en-us_image_0000001381268264](figures/en-us_image_0000001381268264.png) + + + ```javascript + ctx.strokeRect(30, 30, 200, 150); + ``` + + +## fillText() + +Draws filled text on the canvas. + +**Parameters** + +| Parameter| Type| Description| +| -------- | -------- | -------- | +| text | string | Text to draw.| +| x | number | X-coordinate of the lower left corner of the text.| +| y | number | Y-coordinate of the lower left corner of the text.| + +**Example** + + ![en-us_image_0000001431548109](figures/en-us_image_0000001431548109.png) + + + ```javascript + ctx.font = '35px sans-serif'; + ctx.fillText("Hello World!", 20, 60); + ``` + + +## lineWidth + +Sets the width of a line. + +**Parameters** + +| Parameter| Type| Description| +| -------- | -------- | -------- | +| lineWidth | number | Line width.| + +**Example** + + ![en-us_image_0000001431548121](figures/en-us_image_0000001431548121.png) + + + ```javascript + ctx.lineWidth = 5; + ctx.strokeRect(25, 25, 85, 105); + ``` + + +## strokeStyle + +Sets the stroke style. + +**Parameters** + +| Parameter| Type| Description| +| -------- | -------- | -------- | +| color | <color> | Color of the stroke.| + +**Example** + + ![en-us_image_0000001380789172](figures/en-us_image_0000001380789172.png) + + + ```javascript + ctx.lineWidth = 10; + ctx.strokeStyle = '#0000ff'; + ctx.strokeRect(25, 25, 155, 105); + ``` + + +### stroke()5+ + +Draws a stroke. + +**Example** + +![en-us_image_0000001431388513](figures/en-us_image_0000001431388513.png) + + ```javascript + ctx.moveTo(25, 25); + ctx.lineTo(25, 105); + ctx.strokeStyle = 'rgb(0,0,255)'; + ctx.stroke(); + ``` + + +### beginPath()5+ + +Creates a drawing path. + +**Example** + + ![en-us_image_0000001431548125](figures/en-us_image_0000001431548125.png) + + + ```javascript + ctx.beginPath(); + ctx.lineWidth = '6'; + ctx.strokeStyle = '#0000ff'; + ctx.moveTo(15, 80); + ctx.lineTo(280, 160); + ctx.stroke(); + ``` + + +### moveTo()5+ + +Moves a drawing path to a target position on the canvas. + +**Parameters** + +| Parameter| Type| Description| +| -------- | -------- | -------- | +| x | number | X-coordinate of the target position.| +| y | number | Y-coordinate of the target position.| + +**Example** + + ![en-us_image_0000001431388529](figures/en-us_image_0000001431388529.png) + + ```javascript + ctx.beginPath(); + ctx.moveTo(10, 10); + ctx.lineTo(280, 160); + ctx.stroke(); + ``` + + +### lineTo()5+ + +Connects the current point to a target position using a straight line. + +**Parameters** + +| Parameter| Type| Description| +| -------- | -------- | -------- | +| x | number | X-coordinate of the target position.| +| y | number | Y-coordinate of the target position.| + +**Example** + +![en-us_image_0000001431148365](figures/en-us_image_0000001431148365.png) + + ```javascript + ctx.beginPath(); + ctx.moveTo(10, 10); + ctx.lineTo(280, 160); + ctx.stroke(); + ``` + + +### closePath()5+ + +Draws a closed path. + +**Example** + + ![en-us_image_0000001381268284](figures/en-us_image_0000001381268284.png) + + + ```javascript + ctx.beginPath(); + ctx.moveTo(30, 30); + ctx.lineTo(110, 30); + ctx.lineTo(70, 90); + ctx.closePath(); + ctx.stroke(); + ``` + + +## font + +Sets the font style. + +**Parameters** + +| Parameter| Type| Description| +| -------- | -------- | -------- | +| value | string | Font style. **sans-serif**, **serif**, and **monospace** are supported. The default value is **30px HYQiHei-65S**.| + +**Example** + + ![en-us_image_0000001381108328](figures/en-us_image_0000001381108328.png) + + + ```javascript + ctx.font = '30px sans-serif'; + ctx.fillText("Hello World", 20, 60); + ``` + + +## textAlign + +Sets the text alignment mode. + +**Parameters** + +| Parameter| Type| Description| +| -------- | -------- | -------- | +| align | string | Available values are as follows:
- **left** (default): The text is left-aligned.
- **right**: The text is right-aligned.
- **center**: The text is center-aligned.| + +**Example** + + ![en-us_image_0000001431388517](figures/en-us_image_0000001431388517.png) + + + ```javascript + ctx.strokeStyle = '#0000ff'; + ctx.moveTo(140, 10); + ctx.lineTo(140, 160); + ctx.stroke(); + + ctx.font = '18px sans-serif'; + + // Show the different textAlign values + ctx.textAlign = 'left'; + ctx.fillText('textAlign=left', 140, 100); + ctx.textAlign = 'center'; + ctx.fillText('textAlign=center',140, 120); + ctx.textAlign = 'right'; + ctx.fillText('textAlign=right',140, 140); + ``` + + +## arc()5+ + +Draws an arc on the canvas. + +**Parameters** + +| Parameter| Type| Description| +| -------- | -------- | -------- | +| x | number | X-coordinate of the center point of the arc.| +| y | number | Y-coordinate of the center point of the arc.| +| radius | number | Radius of the arc.| +| startAngle | number | Start radian of the arc.| +| endAngle | number | End radian of the arc.| +| anticlockwise | boolean | Whether to draw the arc counterclockwise.| + +**Example** + +![en-us_image_0000001381108320](figures/en-us_image_0000001381108320.png) + + ```javascript + ctx.beginPath(); + ctx.arc(100, 75, 50, 0, 6.28); + ctx.stroke(); + ``` + + +### rect()5+ + +Creates a rectangle on the canvas. + +**Parameters** + +| Parameter| Type| Description| +| -------- | -------- | -------- | +| x | number | X-coordinate of the upper left corner of the rectangle.| +| y | number | Y-coordinate of the upper left corner of the rectangle.| +| width | number | Width of the rectangle.| +| height | number | Height of the rectangle.| + +**Example** + +![en-us_image_0000001381108312](figures/en-us_image_0000001381108312.png) + + ```javascript + ctx.rect(20, 20, 100, 100); // Create a 100*100 rectangle at (20, 20) + ctx.stroke(); // Draw it + ``` diff --git a/en/application-dev/reference/arkui-js-lite/js-components-common-animation.md b/en/application-dev/reference/arkui-js-lite/js-components-common-animation.md new file mode 100644 index 0000000000000000000000000000000000000000..8533e8dd7830abc31d5bd362ed115b083161fb69 --- /dev/null +++ b/en/application-dev/reference/arkui-js-lite/js-components-common-animation.md @@ -0,0 +1,65 @@ +# Animation Styles + + +Components support dynamic rotation, translation, and scaling effects. These effects can be set in the **style** attribute or **.css** files. + + +| Name| Type| Default Value| Description| +| -------- | -------- | -------- | -------- | +| transform | string | - | Translation, rotation, and scaling attributes. For details, see Table 1. | +| animation-name | string | - | @keyframes rule. For details, see Table 2. | +| animation-delay | <time> | 0 | Delay for playing the animation, in ms or s, for example, **1000 ms** or **1s**. The default unit is ms. | +| animation-duration | <time> | 0 | Animation duration, in ms or s, for example, **1000 ms** or **1s**. The default unit is ms.
**NOTE**
**animation-duration** must be specified. Otherwise, the duration is **0**, which means the animation will not be played. | +| animation-iteration-count | number \| infinite | 1 | Number of times that an animation is played. The animation is played once by default. You can set the value to **infinite** to play the animation infinitely.| +| animation-timing-function | string |
linear | Speed curve of an animation, which makes the animation more fluent.
- **linear**: The animation speed keeps unchanged.
- **ease-in**: The animation starts at a low speed. The cubic-bezier curve (0.42, 0.0, 1.0, 1.0) is used
- **ease-out**: The animation ends at a low speed. The cubic-bezier curve (0.0, 0.0, 0.58, 1.0) is used.
- **ease-in-out**: The animation starts and ends at a low speed. The cubic-bezier curve (0.42, 0.0, 0.58, 1.0) is used. | +| animation-fill-mode | string | none | Start and end styles of the animation.
- **none**: No style is applied to the target before or after the animation is executed.
- **forwards**: The target keeps the state at the end of the animation (defined in the last key frame) after the animation is executed.| + + + **Table 1** transform + +| Name| Type| Description| +| -------- | -------- | -------- | +| translateX | <length> | Moves an element along the x-axis.| +| translateY | <length> | Moves an element along the y-axis.| +| rotate | <deg> \| <rad> | Rotates an element.| + +> **NOTE** +> +> Only images of the original size can be rotated on lite wearables. + + + **Table 2** @keyframes + +| Name| Type| Default Value| Description| +| -------- | -------- | -------- | -------- | +| background-color | <color> | - | Background color applied to the component after the animation is played.| +| width | <length> | - | Width value applied to the component after the animation is played.| +| height | <length> | - | Height value applied to the component after the animation is played.| +| transform | string | - | Transformation type applied to a component. For details, see Table 1.| + + +If there is no default value for when an animation will start or end, use **from** and **to** to specify the start and end of the display. The following is an example: + + +``` +@keyframes Go +{ + from { + background-color: #f76160; + } + to { + background-color: #09ba07; + } +} +``` + + +![animation-demo1](figures/animation-demo1.gif) + + + + + +> **NOTE** +> +> The \@keyframes rule with **from** and **to** defined cannot be dynamically bound to an element. diff --git a/en/application-dev/reference/arkui-js-lite/js-components-common-mediaquery.md b/en/application-dev/reference/arkui-js-lite/js-components-common-mediaquery.md new file mode 100644 index 0000000000000000000000000000000000000000..c01a9c145991b2cf4eabc971d718cb8132c9ee97 --- /dev/null +++ b/en/application-dev/reference/arkui-js-lite/js-components-common-mediaquery.md @@ -0,0 +1,110 @@ +# Media Query + +> **NOTE** +> +> - This API is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. +> +> - The **media** attribute uses the actual size, physical pixel, and screen resolution of the device by default. + + +Media queries are widely used. You can use them to modify the application style based on the device type or specific features and device parameters (such as the screen resolution). Specifically, media queries allow you to design a layout style based on the device and application attributes. + + +## CSS Syntax Rules + +Use **@media** to import query statements. The rule is as follows: + +``` +@media [media-type] [and|or] [(media-feature)] { + CSS-Code; +} +``` + +**@media screen and (round-screen: true) { … }**: The condition is met when the device screen is round. + +**@media (max-height: 454) { … }**: Range query. CSS level 3 is used. + +> **NOTE** +> +> - The following operators are not supported: <=, >=, <, and >. +> - Nested parentheses are supported since API version 9. +> - A media query statement can contain a maximum of 512 characters. +> - A media query condition can contain a maximum of 32 characters. + + +## Media Type + +| Type | Description | +| ------ | -------------- | +| screen | Media query based on screen-related parameters.| + + +## Media Logical Operation + +You can use media logical operators to implement complex media query. The following table describes the available operators. + +**Table 1** Media logical operators + +| Type | Description | +| --------------- | ------------------------------------------------------------ | +| and | The **and** operator is used to combine multiple media features into one media query, in a logical AND operation. The query is valid only when all media features are true. It can also combine media types and media functions.
For example, **screen and (device-type: liteWearable) and (max-height: 454)** evaluates to **true** when the device type is wearable and the maximum height of the application is 454 pixel units.| +| or9+ | The **or** operator is used to combine multiple media features into one media query, in a logical OR operation. The query is valid if a media feature is true.
For example, **screen and (max-height: 454) or (round-screen: true)** evaluates to **true** when the maximum height of the application is 454 pixel units or the device screen is round.| + + + + +## Media Features + +| Type | Description | +| ---------------- | ------------------------------------------------------------ | +| height | Height of the display area on the application page. | +| min-height | Minimum height of the display area on the application page. | +| max-height | Maximum height of the display area on the application page. | +| width | Width of the display area on the application page. | +| min-width | Minimum width of the display area on the application page. | +| max-width | Maximum width of the display area on the application page. | +| aspect-ratio | Ratio of the width to the height of the display area on the application page.
Example: **aspect-ratio: 1/2**| +| min-aspect-ratio | Minimum ratio of the width to the height of the display area on the application page. | +| max-aspect-ratio | Maximum ratio of the width to the height of the display area on the application page. | +| round-screen | Screen type. The value **true** means that the screen is round, and **false** means the opposite. | + + +## Sample Code for the Common Media Feature + +The number and type of attributes must be the same among **.container** blocks. Otherwise, display errors will occur. + +```html + +
+
+ Hello World +
+
+``` + +```css +/* xxx.css */ +.container { + width: 300px; + height: 600px; + background-color: #008000; +} +.title { + font-size: 30px; + text-align: center; +} +@media (device-type: samrtVision) { + .container { + width: 500px; + height: 500px; + background-color: #fa8072; + } +} +@media (device-type: liteWearable) { + .container { + width: 300px; + height: 300px; + background-color: #008b8b; + } +} +``` diff --git a/en/application-dev/reference/arkui-js-lite/js-components-container-div.md b/en/application-dev/reference/arkui-js-lite/js-components-container-div.md new file mode 100644 index 0000000000000000000000000000000000000000..7f9321e0194dd7a6fbc81d476be45188d12cafbb --- /dev/null +++ b/en/application-dev/reference/arkui-js-lite/js-components-container-div.md @@ -0,0 +1,154 @@ +# div + +The **\
** component is a basic container that is used as the root node of the page structure or is used to group the content. + +> **NOTE** +> +> This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version. + + +## Child Components + +Supported + + +## Attributes + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| id | string | - | No| Unique ID of the component.| +| style | string | - | No| Style declaration of the component.| +| class | string | - | No| Style class of the component, which is used to refer to a style table.| +| ref | string | - | No| Reference information of child elements, which is registered with the parent component on **$refs**.| + + +## Events + +| Name| Parameter| Description| +| -------- | -------- | -------- | +| click | - | Triggered when the component is clicked.| +| longpress | - | Triggered when the component is long pressed.| +| swipe5+ | [SwipeEvent](js-common-events.md) | Triggered when a user quickly swipes on the component.| + + +## Styles + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| flex-direction | string | row | No| Main axis direction of the flex container, which defines how items are placed in the container. Available values are as follows:
- **column**: Items are placed vertically from top to bottom.
- **row**: Items are placed horizontally from left to right.| +| flex-wrap | string | nowrap | No| Whether items in the flex container are displayed in a single line or multiple lines. The value cannot be dynamically updated. Available values are as follows:
- **nowrap**: Flex items are displayed in a single line.
- **wrap**: Flex items are displayed in multiple lines.| +| justify-content | string | flex-start | No| How items are aligned along the main axis of the flex container. Available values are as follows:
- **flex-start**: Items are packed toward the start edge of the container along the main axis.
- **flex-end**: Items are packed toward the end edge of the container along the main axis.
- **center**: Items are packed toward the center of the container along the main axis.
- **space-between**: Items are positioned with space between the rows.
- **space-around**: Items are positioned with space before, between, and after the rows.| +| align-items | string | stretch5+
flex-start1-4 | No| How items are aligned along the cross axis in a flex container. Available values are as follows:
- **stretch**: Items are stretched to the same height or width as the container along the cross axis.5+
- **flex-start**: Items are packed toward the start edge of the cross axis.
- **flex-end**: Items are packed toward the end edge of the cross axis.
- **center**: Items are packed toward the center of the cross axis.| +| display | string | flex | No| Type of the view box of the item. The value cannot be dynamically updated. Available values are as follows:
- **flex**: flexible layout
- **none**: not rendered| +| width | <length> \| <percentage>5+ | - | No| Component width.

If this attribute is not set, the default value **0** is used.| +| height | <length> \| <percentage>5+ | - | No| Component height.
If this attribute is not set, the default value **0** is used. | +| padding | <length> | 0 | No| Shorthand attribute to set the padding for all sides.
The attribute can have one to four values:
- If you set only one value, it specifies the padding for all the four sides.
- If you set two values, the first value specifies the top and bottom padding, and the second value specifies the left and right padding.
- If you set three values, the first value specifies the top padding, the second value specifies the left and right padding, and the third value specifies the bottom padding.
- If you set four values, they respectively specify the padding for top, right, bottom, and left sides (in clockwise order).| +| padding-[left\|top\|right\|bottom] | <length> | 0 | No| Left, top, right, and bottom padding.| +| margin | <length> \| <percentage>5+ | 0 | No| Shorthand attribute to set the margin for all sides. The attribute can have one to four values:
- If you set only one value, it specifies the margin for all the four sides.
- If you set two values, the first value specifies the top and bottom margins, and the second value specifies the left and right margins.
- If you set three values, the first value specifies the top margin, the second value specifies the left and right margins, and the third value specifies the bottom margin.
- If you set four values, they respectively specify the margin for top, right, bottom, and left sides (in clockwise order).| +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | No| Left, top, right, and bottom margins.| +| border-width | <length> | 0 | No| Shorthand attribute to set the margin for all sides.| +| border-color | <color> | black | No| Shorthand attribute to set the color for all borders.| +| border-radius | <length> | - | No| Radius of round-corner borders.| +| background-color | <color> | - | No| Background color.| +| opacity5+ | number | 1 | No| Opacity of an element. The value ranges from **0** to **1**. The value **1** means opaque, and **0** means completely transparent.| +| [left\|top] | <length> \| <percentage>6+ | - | No| Edge of the element.
- **left**: left edge position of the element. This attribute defines the offset between the left edge of the margin area of a positioned element and left edge of its containing block.
- **top**: top edge position of the element. This attribute defines the offset between the top edge of a positioned element and that of a block included in the element. | + + +## Example + +1. Flex style + + ```html + +
+
+
+
+
+
+
+ ``` + + + ```css + /* xxx.css */ + .container { + flex-direction: column; + justify-content: center; + align-items: center; + width: 454px; + height: 454px; + } + .flex-box { + justify-content: space-around; + align-items: center; + width: 400px; + height: 140px; + background-color: #ffffff; + } + .flex-item { + width: 120px; + height: 120px; + border-radius: 16px; + } + .color-primary { + background-color: #007dff; + } + .color-warning { + background-color: #ff7500; + } + .color-success { + background-color: #41ba41; + } + ``` + + ![en-us_image_0000001381108420](figures/en-us_image_0000001381108420.png) + +2. Flex wrap style + + ```html + +
+
+
+
+
+
+
+ ``` + + + ```css + /* xxx.css */ + .container { + flex-direction: column; + justify-content: center; + align-items: center; + width: 454px; + height: 454px; + } + .flex-box { + justify-content: space-around; + align-items: center; + flex-wrap: wrap; + width: 300px; + height: 250px; + background-color: #ffffff; + } + .flex-item { + width: 120px; + height: 120px; + border-radius: 16px; + } + .color-primary { + background-color: #007dff; + } + .color-warning { + background-color: #ff7500; + } + .color-success { + background-color: #41ba41; + } + ``` + + ![en-us_image_0000001431148457](figures/en-us_image_0000001431148457.png) diff --git a/en/application-dev/reference/arkui-js-lite/js-components-container-list-item.md b/en/application-dev/reference/arkui-js-lite/js-components-container-list-item.md new file mode 100644 index 0000000000000000000000000000000000000000..32855f3c9a0b62169e81fd2643c97afce58c5d3f --- /dev/null +++ b/en/application-dev/reference/arkui-js-lite/js-components-container-list-item.md @@ -0,0 +1,53 @@ +# list-item + +**\** is a child component of the **[\](js-components-container-list.md)** component and is used to display items in a list. + +> **NOTE** +> +> This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version. + + +## Child Components + +Supported + + +## Attributes + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| id | string | - | No| Unique ID of the component.| +| style | string | - | No| Style declaration of the component.| +| class | string | - | No| Style class of the component, which is used to refer to a style table.| +| ref | string | - | No| Reference information of child elements, which is registered with the parent component on **$refs**.| + + +## Events + +| Name| Parameter| Description| +| -------- | -------- | -------- | +| click | - | Triggered when the component is clicked.| +| longpress | - | Triggered when the component is long pressed.| +| swipe5+ | [SwipeEvent](js-common-events.md) | Triggered when a user quickly swipes on the component.| + + +## Styles + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| width | <length> \| <percentage>5+ | - | No| Component width.
If this attribute is not set, the default value **0** is used.| +| height | <length> \| <percentage>5+ | - | No| Component height.
If this attribute is not set, the default value **0** is used.| +| padding | <length> | 0 | No| Shorthand attribute to set the padding for all sides.
The attribute can have one to four values:
- If you set only one value, it specifies the padding for all the four sides.
- If you set two values, the first value specifies the top and bottom padding, and the second value specifies the left and right padding. - If you set three values, the first value specifies the top padding, the second value specifies the left and right padding, and the third value specifies the bottom padding. - If you set four values, they respectively specify the padding for top, right, bottom, and left sides (in clockwise order).| +| padding-[left\|top\|right\|bottom] | <length> | 0 | No| Left, top, right, and bottom padding.| +| border-width | <length> | 0 | No| Shorthand attribute to set the margin for all sides.| +| border-color | <color> | black | No| Shorthand attribute to set the color for all borders.| +| border-radius | <length> | - | No| Radius of round-corner borders.| +| background-color | <color> | - | No| Background color.| +| opacity5+ | number | 1 | No| Opacity of an element. The value ranges from **0** to **1**. The value **1** means opaque, and **0** means completely transparent.| +| display | string | flex | No| How and whether to display the box containing an element. Available values are as follows:
- **flex**: flexible layout
- **none**: not rendered| + + + +## Example + +See **Example** in [list](js-components-container-list.md). diff --git a/en/application-dev/reference/arkui-js-lite/js-components-container-list.md b/en/application-dev/reference/arkui-js-lite/js-components-container-list.md new file mode 100644 index 0000000000000000000000000000000000000000..6c256285ccf9894184218e179efd96089289d61d --- /dev/null +++ b/en/application-dev/reference/arkui-js-lite/js-components-container-list.md @@ -0,0 +1,123 @@ +# list + +The **\** component provides a list container that presents a series of list items arranged in a column with the same width. It supports presentations of the same type of data in a multiple and coherent row style, for example, images or text. + +> **NOTE** +> +> This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version. + + +## Child Components + +Only [\](js-components-container-list-item.md) is supported. + + +## Attributes + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| id | string | - | No| Unique ID of the component.| +| style | string | - | No| Style declaration of the component.| +| class | string | - | No| Style class of the component, which is used to refer to a style table.| +| ref | string | - | No| Reference information of child elements, which is registered with the parent component on **$refs**.| + + +## Events + +| Name| Parameter| Description| +| -------- | -------- | -------- | +| scrollend | - | Triggered when the list stops scrolling.| +| click | - | Triggered when the list is clicked. | +| longpress | - | Triggered when the list is long pressed. | +| swipe5+ | [SwipeEvent](js-common-events.md) | Triggered when a user quickly swipes on the list. | +| scrolltop8+ | - | Triggered when the list is scrolled to the top.| +| scrollbottom8+ | - | Triggered when the list is scrolled to the bottom.| + + +## Styles + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| flex-direction | string | column | No| Main axis direction of the flex container. It specifies how items are placed in the flex container.
- **column**: Items are placed vertically from top to bottom.
- **row**: Items are placed horizontally from left to right.
For the **\** component, the default value is **column**. For other components, the default value is **row**. Dynamic modification is not supported.| +| width | <length> \| <percentage>5+ | - | No| Component width.
If this attribute is not set, the default value **0** is used. | +| height | <length> \| <percentage>5+ | - | No| Component height.
If this attribute is not set, the default value **0** is used. | +| padding | <length> | 0 | No| Shorthand attribute to set the padding for all sides.
The attribute can have one to four values:
- If you set only one value, it specifies the padding for all the four sides.
- If you set two values, the first value specifies the top and bottom padding, and the second value specifies the left and right padding.
- If you set three values, the first value specifies the top padding, the second value specifies the left and right padding, and the third value specifies the bottom padding.
- If you set four values, they respectively specify the padding for top, right, bottom, and left sides (in clockwise order).| +| padding-[left\|top\|right\|bottom] | <length> | 0 | No| Left, top, right, and bottom padding.| +| margin | <length> \| <percentage>5+ | 0 | No| Shorthand attribute to set the margin for all sides. The attribute can have one to four values:
- If you set only one value, it specifies the margin for all the four sides.
- If you set two values, the first value specifies the top and bottom margins, and the second value specifies the left and right margins.
- If you set three values, the first value specifies the top margin, the second value specifies the left and right margins, and the third value specifies the bottom margin.
- If you set four values, they respectively specify the margin for top, right, bottom, and left sides (in clockwise order).| +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | No| Left, top, right, and bottom margins.| +| border-width | <length> | 0 | No| Shorthand attribute to set the margin for all sides.| +| border-color | <color> | black | No| Shorthand attribute to set the color for all borders.| +| border-radius | <length> | - | No| Radius of round-corner borders.| +| background-color | <color> | - | No| Background color.| +| opacity5+ | number | 1 | No| Opacity of an element. The value ranges from **0** to **1**. The value **1** means opaque, and **0** means completely transparent.| +| display | string | flex | No| How and whether to display the box containing an element. Available values are as follows:
- **flex**: flexible layout
- **none**: not rendered| +| [left\|top] | <length> \| <percentage>6+ | - | No| Edge of the element.
- **left**: left edge position of the element. This attribute defines the offset between the left edge of the margin area of a positioned element and left edge of its containing block.
- **top**: top edge position of the element. This attribute defines the offset between the top edge of a positioned element and that of a block included in the element. | + + +## Methods + +| Name| Parameter| Description| +| -------- | -------- | -------- | +| scrollTo | { index: number(position) } | Scrolls the list to the position of the item at the specified index.| + + +## Example + + +```html + +
+ + + {{$item.title}} + {{$item.date}} + + +
+``` + + +```js +// index.js +export default { + data: { + todolist: [{ + title: 'Prepare for the interview', + date: '2021-12-31 10:00:00', + }, { + title: 'Watch the movie', + date: '2021-12-31 20:00:00', + }], + }, +} +``` + + +```css +/* index.css */ +.container { + display: flex; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 454px; + height: 454px; +} +.todo-wraper { + width: 454px; + height: 300px; +} +.todo-item { + width: 454px; + height: 80px; + flex-direction: column; +} +.todo-title { + width: 454px; + height: 40px; + text-align: center; +} +``` + +![list](figures/list.png) diff --git a/en/application-dev/reference/arkui-js-lite/js-components-container-stack.md b/en/application-dev/reference/arkui-js-lite/js-components-container-stack.md new file mode 100644 index 0000000000000000000000000000000000000000..2ce76b90cf9ad62ad1b95c0e08af46ee79d7d096 --- /dev/null +++ b/en/application-dev/reference/arkui-js-lite/js-components-container-stack.md @@ -0,0 +1,101 @@ +# stack + +The **\** component provides a stack container where child components are successively stacked and the latter one overwrites the previous one. + +> **NOTE** +> +> This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version. + + +## Child Components + +Supported + + +## Attributes + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| id | string | - | No| Unique ID of the component.| +| style | string | - | No| Style declaration of the component.| +| class | string | - | No| Style class of the component, which is used to refer to a style table.| +| ref | string | - | No| Reference information of child elements, which is registered with the parent component on **$refs**.| + + +## Events + +| Name| Parameter| Description| +| -------- | -------- | -------- | +| click | - | Triggered when the component is clicked.| +| longpress | - | Triggered when the component is long pressed.| +| swipe5+ | [SwipeEvent](js-common-events.md) | Triggered when a user quickly swipes on the component.| + + +## Styles + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| width | <length> \| <percentage>5+ | - | No| Component width.
If this attribute is not set, the default value **0** is used. | +| height | <length> \| <percentage>5+ | - | No| Component height.
If this attribute is not set, the default value **0** is used. | +| padding | <length> | 0 | No| Shorthand attribute to set the padding for all sides.
The attribute can have one to four values:
- If you set only one value, it specifies the padding for all the four sides.
- If you set two values, the first value specifies the top and bottom padding, and the second value specifies the left and right padding.
- If you set three values, the first value specifies the top padding, the second value specifies the left and right padding, and the third value specifies the bottom padding.
- If you set four values, they respectively specify the padding for top, right, bottom, and left sides (in clockwise order).| +| padding-[left\|top\|right\|bottom] | <length> | 0 | No| Left, top, right, and bottom padding.| +| margin | <length> \| <percentage>5+ | 0 | No| Shorthand attribute to set the margin for all sides. The attribute can have one to four values:
- If you set only one value, it specifies the margin for all the four sides.
- If you set two values, the first value specifies the top and bottom margins, and the second value specifies the left and right margins.
- If you set three values, the first value specifies the top margin, the second value specifies the left and right margins, and the third value specifies the bottom margin.
- If you set four values, they respectively specify the margin for top, right, bottom, and left sides (in clockwise order).| +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | No| Left, top, right, and bottom margins.| +| border-width | <length> | 0 | No| Shorthand attribute to set the margin for all sides.| +| border-color | <color> | black | No| Shorthand attribute to set the color for all borders.| +| border-radius | <length> | - | No| Radius of round-corner borders.| +| background-color | <color> | - | No| Background color.| +| opacity5+ | number | 1 | No| Opacity of an element. The value ranges from **0** to **1**. The value **1** means opaque, and **0** means completely transparent.| +| display | string | flex | No| How and whether to display the box containing an element. Available values are as follows:
- **flex**: flexible layout
- **none**: not rendered| +| [left\|top] | <length> \| <percentage>6+ | - | No| Edge of the element.
- **left**: left edge position of the element. This attribute defines the offset between the left edge of the margin area of a positioned element and left edge of its containing block.
- **top**: top edge position of the element. This attribute defines the offset between the top edge of a positioned element and that of a block included in the element. | + +> **NOTE** +> +> The absolute positioning does not support a percentage. Therefore, **margin** cannot be set for the child components of the **\** component. + + +## Example + + +```html + + +
+
+
+
+``` + + +```css +/* xxx.css */ +.stack-parent { + width: 400px; + height: 400px; + background-color: #ffffff; + border-width: 1px; + border-style: solid; +} +.back-child { + width: 300px; + height: 300px; + background-color: #3f56ea; +} +.front-child { + width: 100px; + height: 100px; + background-color: #00bfc9; +} +.positioned-child { + width: 100px; + height: 100px; + left: 50px; + top: 50px; + background-color: #47cc47; +} +.bd-radius { + border-radius: 16px; +} +``` + +![en-us_image_0000001380789188](figures/en-us_image_0000001380789188.png) diff --git a/en/application-dev/reference/arkui-js-lite/js-components-container-swiper.md b/en/application-dev/reference/arkui-js-lite/js-components-container-swiper.md new file mode 100644 index 0000000000000000000000000000000000000000..34ad83a37b8d907b886427b183e99f4666e28327 --- /dev/null +++ b/en/application-dev/reference/arkui-js-lite/js-components-container-swiper.md @@ -0,0 +1,112 @@ +# swiper + +The **\** component provides a container that allows users to switch among child components using swipe gestures. + +> **NOTE** +> +> This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version. + + +## Child Components + +All child components except **\** are supported. + + +## Attributes + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| index | number | 0 | No| Index of the child component currently displayed in the container.| +| loop | boolean | true | No| Whether to enable looping. | +| duration | number | - | No| Duration of the autoplay for child component switching.| +| vertical | boolean | false | No| Whether the swipe gesture is performed vertically. A vertical swipe uses the vertical indicator.
The value cannot be dynamically updated.| +| id | string | - | No| Unique ID of the component.| +| style | string | - | No| Style declaration of the component.| +| class | string | - | No| Style class of the component, which is used to refer to a style table.| +| ref | string | - | No| Reference information of child elements, which is registered with the parent component on **$refs**.| + + +## Events + +| Name| Parameter| Description| +| -------- | -------- | -------- | +| change | { index: currentIndex } | Triggered when the index of the currently displayed component changes.| +| click | - | Triggered when the component is clicked.| +| longpress | - | Triggered when the component is long pressed.| +| swipe5+ | [SwipeEvent](js-common-events.md) | Triggered when a user quickly swipes on the component.| + + +## Styles + +| Name| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| width | <length> \| <percentage>5+ | - | No| Component width.
If this attribute is not set, the default value **0** is used. | +| height | <length> \| <percentage>5+ | - | No| Component height.
If this attribute is not set, the default value **0** is used. | +| padding | <length> | 0 | No| Shorthand attribute to set the padding for all sides.
The attribute can have one to four values:
- If you set only one value, it specifies the padding for all the four sides.
- If you set two values, the first value specifies the top and bottom padding, and the second value specifies the left and right padding.
- If you set three values, the first value specifies the top padding, the second value specifies the left and right padding, and the third value specifies the bottom padding.
- If you set four values, they respectively specify the padding for top, right, bottom, and left sides (in clockwise order).| +| padding-[left\|top\|right\|bottom] | <length> | 0 | No| Left, top, right, and bottom padding.| +| margin | <length> \| <percentage>5+ | 0 | No| Shorthand attribute to set the margin for all sides. The attribute can have one to four values:
- If you set only one value, it specifies the margin for all the four sides.
- If you set two values, the first value specifies the top and bottom margins, and the second value specifies the left and right margins.
- If you set three values, the first value specifies the top margin, the second value specifies the left and right margins, and the third value specifies the bottom margin.
- If you set four values, they respectively specify the margin for top, right, bottom, and left sides (in clockwise order).| +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | No| Left, top, right, and bottom margins.| +| border-width | <length> | 0 | No| Shorthand attribute to set the margin for all sides.| +| border-color | <color> | black | No| Shorthand attribute to set the color for all borders.| +| border-radius | <length> | - | No| Radius of round-corner borders.| +| background-color | <color> | - | No| Background color.| +| opacity5+ | number | 1 | No| Opacity of an element. The value ranges from **0** to **1**. The value **1** means opaque, and **0** means completely transparent.| +| display | string | flex | No| How and whether to display the box containing an element. Available values are as follows:
- **flex**: flexible layout
- **none**: not rendered| +| [left\|top] | <length> \| <percentage>6+ | - | No| Edge of the element.
- **left**: left edge position of the element. This attribute defines the offset between the left edge of the margin area of a positioned element and left edge of its containing block.
- **top**: top edge position of the element. This attribute defines the offset between the top edge of a positioned element and that of a block included in the element. | + + +## Example + + +```html + + +
+ 1 +
+
+ 2 +
+
+ 3 +
+
+``` + + +```css +/* xxx.css */ +.container { + left: 0px; + top: 0px; + width: 454px; + height: 454px; +} +.swiper-item { + width: 454px; + height: 454px; + justify-content: center; + align-items: center; +} +.primary-item { + background-color: #007dff; +} +.warning-item { + background-color: #ff7500; +} +.success-item { + background-color: #41ba41; +} +``` + + +```js +/* xxx.js */ +export default { + data: { + index: 1 + } +} +``` + +![swiper](figures/swiper.gif) diff --git a/en/application-dev/reference/arkui-js-lite/js-framework-file.md b/en/application-dev/reference/arkui-js-lite/js-framework-file.md new file mode 100644 index 0000000000000000000000000000000000000000..2ea4d52d1334d3c9cbca4f836e8d4d0a4087f8f5 --- /dev/null +++ b/en/application-dev/reference/arkui-js-lite/js-framework-file.md @@ -0,0 +1,67 @@ +# File Organization + + +## Directory structure + +The following figure shows the typical directory structure of the JavaScript module (**entry/src/main/js/module**) for an application with feature abilities (FA) using JavaScript APIs. + + **Figure 1** Directory structure + +![en-us_image_0000001431388581](figures/en-us_image_0000001431388581.png) + +Functions of the files are as follows: + +- **.hml** files describe the page layout. + +- **.css** files describe the page style. + +- **.js** files process the interactions between pages and users. + +Functions of the folders are as follows: + +- The **app.js** file manages global JS logics and application lifecycle. + +- The **pages** directory stores all component pages. + +- The **common** directory stores public resource files, such as media resources and JavaScript files. + +> **NOTE** +> - The following reserved folders cannot be renamed: +> +> +> +> +> - The folders marked as optional in the directory structure can be created as needed after you create the project in DevEco Studio. + + +## File Access Rules + +Application resources can be accessed via an absolute or relative path. In this development framework, an absolute path starts with a slash (/), and a relative path starts with **./** or **../**. The rules are as follows: + +- To reference a code file, use a relative path, for example, **../common/utils.js**. + +- To reference a resource file, use an absolute path, for example: **/common/xxx.png**. + +- Store code files and resource files in the **common** directory and access the files in a required fashion. + +- In a **.css** file, use the **url()** function to create a URL, for example, **url(/common/xxx.png)**. + +> **NOTE** +> +> When code file A needs to reference code file B: +> +> - If code files A and B are in the same directory, you can use either a relative or absolute path in code file B to reference resource files. +> +> - If code files A and B are in different directories, you must use an absolute path in code file B to reference resource files. The reason is that the directory of code file B changes during Webpack packaging. +> + + +## Media File Formats + + **Table 1** Supported image formats + +| Format| Supported Version| File Name Extension| +| -------- | -------- | -------- | +| BMP | API Version 3+ | .bmp | +| JPEG | API Version 3+ | .jpg | +| PNG | API Version 3+ | .png | diff --git a/en/application-dev/reference/arkui-js-lite/js-framework-js-file.md b/en/application-dev/reference/arkui-js-lite/js-framework-js-file.md new file mode 100644 index 0000000000000000000000000000000000000000..d22c607252dafd01ef58ddec221372e254ed79a4 --- /dev/null +++ b/en/application-dev/reference/arkui-js-lite/js-framework-js-file.md @@ -0,0 +1,24 @@ +# app.js + + +You can implement lifecycle logic specific to your application in the **app.js** file. Available application lifecycle functions are as follows: + + +- **onCreate()**: called when an application is created + +- **onDestory()**: called when an application is destroyed + + +In the following example, logs are printed only in the lifecycle functions. + +``` +// app.js +export default { + onCreate() { + console.info('Application onCreate'); + }, + onDestroy() { + console.info('Application onDestroy'); + }, +} +``` diff --git a/en/application-dev/reference/arkui-js-lite/js-framework-js-tag.md b/en/application-dev/reference/arkui-js-lite/js-framework-js-tag.md new file mode 100644 index 0000000000000000000000000000000000000000..37d08081341fb43d1228d2cd9b211b14cf39f35a --- /dev/null +++ b/en/application-dev/reference/arkui-js-lite/js-framework-js-tag.md @@ -0,0 +1,74 @@ +# "js" Tag + + +The "js" tag contains the instance name and page route information. + + +| Tag| Type| Default Value| Mandatory| Description| +| -------- | -------- | -------- | -------- | -------- | +| name | string | default | Yes| Name of the JavaScript instance.| +| pages | Array | - | Yes| Route information. For details, see ["pages"](#pages).| + + +> **NOTE** +> +> The "name" and "pages" tags are configured in the "js" tag of the **config.json** file. + + +## pages + +The **"pages"** defines the route information of each page. Each page consists of the page path and page name. The following is an example: + + +``` +{ + ... + "pages": [ + "pages/index/index", + "pages/detail/detail" + ] + ... +} +``` + + +> **NOTE** +> +> +> - The application home page is fixed to **pages/index/index**. +> +> - The page name should not be a component name, for example, **text.hml** or **button.hml**. + + +## Example + + +``` +{ + "app": { + "bundleName": "com.huawei.player", + "version": { + "code": 1, + "name": "1.0" + }, + "vendor": "example" + } + "module": { + ... + "js": [ + { + "name": "default", + "pages": [ + "pages/index/index", + "pages/detail/detail" + ] + } + ], + "abilities": [ + { + ... + } + ] + } +} +``` diff --git a/en/application-dev/reference/arkui-js-lite/js-framework-syntax-css.md b/en/application-dev/reference/arkui-js-lite/js-framework-syntax-css.md new file mode 100644 index 0000000000000000000000000000000000000000..79b1d9938cac9f7f804a85407a74d6bd08931628 --- /dev/null +++ b/en/application-dev/reference/arkui-js-lite/js-framework-syntax-css.md @@ -0,0 +1,160 @@ +# CSS + + +Cascading Style Sheets (CSS) is a language used to describe the HML page structure. All HML components have default styles. You can customize styles for these components using CSS to design various pages. + + +## Style Import + +CSS files can be imported using the **\@import** statement. This facilitates module management and code reuse. + + +## Style Declaration + +The **.css** file with the same name as the **.hml** file in each page directory describes the styles of components on the HML page, determining how the components will be displayed. + +1. Internal style: The **style** and **class** attributes can be used to specify the component style. Sample code: + + ``` + +
+ Hello World +
+ ``` + + + ``` + /* index.css */ + .container { + justify-content: center; + } + ``` + +2. External style files: You need to import the files. For example, create a **style.css** file in the **common** directory and import the file at the beginning of **index.css**. + + ``` + /* style.css */ + .title { + font-size: 50px; + } + ``` + + + ``` + /* index.css */ + @import '../../common/style.css'; + .container { + justify-content: center; + } + ``` + + +## Selectors + +A CSS selector is used to select elements for which styles need to be added to. The following table lists the supported selectors. + +| Selector| Example| Description| +| -------- | -------- | -------- | +| .class | .container | Selects all components whose **class** is **container**.| +| \#id | \#titleId | Selects all components whose **id** is **titleId**.| +| , | .title, .content | Selects all components whose **class** is **title** or **content**.| + +Example: + + +``` + +
+ Title +
+ Content +
+
+``` + + +``` +/* Page style xxx.css */ +/* Set the style for the components whose class is title. */ +.title { + font-size: 30px; +} +/* Set the style for the components whose id is contentId. */ +#contentId { + font-size: 20px; +} +/* Set padding for all components of the title or content class to 5 px. */ +.title, .content { + padding: 5px; +} + +``` + + +## Pseudo-classes + +A CSS pseudo-class is a keyword added to a selector that specifies a special state of the selected elements. + +| Name| Available Components| Description| +| -------- | -------- | -------- | +| :active |
input[type="button"] | Selects the element activated by a user, for example, a pressed button. Only the **background-color** and **background-image** attributes can be set for the pseudo-class selector on lite wearables.| +| :checked | input[type="checkbox", type="radio"]| Selects the element whose **checked** attribute is **true**. Only the **background-color** and **background-image** attributes can be set for the pseudo-class selector on lite wearables.| + +The following is an example for you to use the **:active** pseudo-class to control the style when a user presses the button. + + +``` + +
+ +
+``` + + +``` +/* index.css */ +.button:active { + background-color: #888888;/* After the button is activated, the background color is changed to #888888. */ +} +``` + + +## Precompiled Styles + +Precompilation is a program that uses specific syntax to generate CSS files. It provides variables and calculation, helping you define component styles more conveniently. Currently, Less, Sass, and Scss are supported. To use precompiled styles, change the suffix of the original **.css** file. For example, change **index.css** to **index.less**, **index.sass**, or **index.scss**. + +- The following **index.less** file is changed from **index.css**. + + ``` + /* index.less */ + /* Define a variable. */ + @colorBackground: #000000; + .container { + background-color: @colorBackground; /* Use the variable defined in the .less file. */ + } + ``` + +- Reference a precompiled style file. For example, if the **style.scss** file is located in the **common** directory, change the original **index.css** file to **index.scss** and import **style.scss**. + + ``` + /* style.scss */ + /* Define a variable. */ + $colorBackground: #000000; + ``` + + Reference the precompiled style file in **index.scss**: + + + ``` + /* index.scss */ + /* Import style.scss. */ + @import '../../common/style.scss'; + .container { + background-color: $colorBackground; /* Use the variable defined in style.scss. */ + } + ``` + + + > **NOTE** + > + > Place precompiled style files in the **common** directory. diff --git a/en/application-dev/reference/arkui-js-lite/js-framework-syntax-hml.md b/en/application-dev/reference/arkui-js-lite/js-framework-syntax-hml.md new file mode 100644 index 0000000000000000000000000000000000000000..b9f5bec1e13aaf9bc2112fdee9e43cdcc322641d --- /dev/null +++ b/en/application-dev/reference/arkui-js-lite/js-framework-syntax-hml.md @@ -0,0 +1,308 @@ +# HML + + +The OpenHarmony Markup Language (HML) is an HTML-like language that allows you to build pages based on components and events. Pages built using HML have advanced capabilities such as data binding, event binding, loop rendering, and conditional rendering. + + +## HML Page Structure + + +``` + +
+ Image Show +
+ +
+
+``` + + +## Data Binding + + +``` + +
+ {{content[1]}} +
+``` + + +``` +// xxx.js +export default { + data: { + content: ['Hello World!', 'Welcome to my world!'] + }, + changeText: function() { + this.content.splice(1, 1, this.content[0]); + } +} +``` + +> **NOTE** +> - To make the array data modification take effect, use the **splice** method to change array items. +> +> - ECMAScript 6.0 syntax is not supported in HML. + + +## Event Binding + +The callback bound to an event receives an event object parameter, which can be used to obtain the event information. + + +``` + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+``` + + +``` +// xxx.js +export default { + data: { + obj: '', + }, + clickfunc: function(e) { + this.obj = 'Hello World'; + console.log(e); + }, +} +``` + +> **NOTE** +> +> Event bubbling is supported since API version 5. After you upgrade the SDK and run an existing JavaScript application, events bound using a traditional statement (such as **onclick**) will not bubble. However, if you use the new SDK to repack the JavaScript application, such events will bubble. To avoid service logic errors, replace the traditional statement with one supported by the new SDK. For example, replace **onclick** with **grab:click**. + +**Example:** + +``` + +
+ {{count}} +
+ + + + + + +
+
+``` + + +``` +/* xxx.js */ +export default { + data: { + count: 0 + }, + increase() { + this.count++; + }, + decrease() { + this.count--; + }, + multiply(multiplier) { + this.count = multiplier * this.count; + } +}; +``` + + +``` +/* xxx.css */ +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 454px; + height: 454px; +} +.title { + font-size: 30px; + text-align: center; + width: 200px; + height: 100px; +} +.box { + width: 454px; + height: 200px; + justify-content: center; + align-items: center; + flex-wrap: wrap; +} +.btn { + width: 200px; + border-radius: 0; + margin-top: 10px; + margin-left: 10px; +} +``` + + +## Loop Rendering + + +``` + +
+ + +
+ {{$idx}}.{{$item.name}} +
+ +
+ {{$idx}}.{{value.name}} +
+ +
+ {{index}}.{{value.name}} +
+
+``` + + +``` +// xxx.js +export default { + data: { + array: [ + {id: 1, name: 'jack', age: 18}, + {id: 2, name: 'tony', age: 18}, + ], + }, + changeText: function() { + if (this.array[1].name === "tony"){ + this.array.splice(1, 1, {id:2, name: 'Isabella', age: 18}); + } else { + this.array.splice(2, 1, {id:3, name: 'Bary', age: 18}); + } + }, +} +``` + +The **tid** attribute accelerates the **for** loop and improves the re-rendering efficiency when data in a loop changes. The **tid** attribute specifies the unique ID of each element in the array. If it is not specified, the index of each element in the array is used as the ID. For example, **tid="id"** indicates that the **id** attribute of each element is its unique ID. The **for** loop supports the following statements: + +- for="array": **array** is an array object, whose element variable is **$item** by default. + +- for="v in array": **v** is a custom element variable, whose index is **$idx** by default. + +- for="(i, v) in array": **i** indicates the element index, and **v** indicates the element variable. All elements of the array object will be looped through. + +> **NOTE** +> - Each element in the array must have the data attribute specified by **tid**. Otherwise, an exception may occur. +> +> - The attribute specified by **tid** in the array must be unique. Otherwise, performance loss occurs. In the above example, only **id** and **name** can be used as **tid** because they are unique fields. +> +> - The **tid** field does not support expressions. + + +## Conditional Rendering + +There are two ways to implement conditional rendering: **if-elif-else** or **show**. In **if-elif-else**, when the **if** statement evaluates to **false**, the component is not built in the VDOM and is not rendered. For **show**, when show is **false**, the component is not rendered but is built in the VDOM. In addition, the **if-elif-else** statements must be used in sibling nodes. Otherwise, the compilation fails. The following example uses both ways to implement conditional rendering: + + +``` + +
+ + + Hello-One + Hello-Two + Hello-World +
+``` + + +``` +// xxx.css +.container{ + flex-direction: column; + align-items: center; +} +.btn{ + width: 280px; + font-size: 26px; + margin: 10px 0; +} +``` + + +``` +// xxx.js +export default { + data: { + show: false, + display: true, + }, + toggleShow: function() { + this.show = !this.show; + }, + toggleDisplay: function() { + this.display = !this.display; + } +} +``` + +In the optimized rendering (**show**), if **show** is **true**, the node is rendered properly; if it is **false**, the display style will be **none**. + + +``` + +
+ + Hello World +
+``` + + +``` +// xxx.css +.container{ + flex-direction: column; + align-items: center; +} +.btn{ + width: 280px; + font-size: 26px; + margin: 10px 0; +} +``` + + +``` +// xxx.js +export default { + data: { + visible: false, + }, + toggle: function() { + this.visible = !this.visible; + }, +} +``` + +> **NOTE** +> Do not use **for** and **if** attributes at the same time in an element. diff --git a/en/application-dev/reference/arkui-js-lite/js-framework-syntax-js.md b/en/application-dev/reference/arkui-js-lite/js-framework-syntax-js.md new file mode 100644 index 0000000000000000000000000000000000000000..3ce76d4463643c979cf619749b2a8a5c80dae1c1 --- /dev/null +++ b/en/application-dev/reference/arkui-js-lite/js-framework-syntax-js.md @@ -0,0 +1,122 @@ +# JavaScript + + +You can use a **.js** file in the ECMAScript compliant JavaScript language to define the service logic of an HML page. With dynamic typing, JavaScript can make your application more expressive with a flexible design. The following describes the JavaScript compilation and running. + + +## Syntax + +The ECMAScript 6.0 syntax is supported. Lite wearables only support the following ECMAScript 6.0 syntax: + +1. let/const + +2. arrow functions + +3. class + +4. default value + +5. destructuring assignment + +6. destructuring binding pattern + +7. enhanced object initializer + +8. for-of + +9. rest parameter + +10. template strings + +- Module declaration + Import functionality modules. + + + ``` + import router from '@system.router'; + ``` + +- Code reference + Import JavaScript code. + + + ``` + import utils from '../../common/utils.js'; + ``` + + +## Objects + +- Page objects + | Attribute| Type| Description| + | -------- | -------- | -------- | + | data | Object/Function | Data model of the page. If the attribute is of the function type, the return value must be of the object type. The name cannot start with a dollar sign ($) or underscore (_). Do not use reserved words (**for**, **if**, **show**, and **tid**). | + | $refs | Object | DOM elements or child component instances that have registered the **ref** attribute. For an example, see [Obtaining a DOM Element](#obtaining-a-dom-element).| + + +## Obtaining a DOM Element + +Use **$refs** to obtain a DOM element. + +``` + +
+ +
+``` + + +``` +// index.js +export default { + data: { + images: [ + { src: '/common/frame1.png' }, + { src: '/common/frame2.png' }, + { src: '/common/frame3.png' }, + ], + }, + handleClick() { + const animator = this.$refs.animator; // Obtain the DOM element whose $refs attribute is animator. + const state = animator.getState(); + if (state === 'paused') { + animator.resume(); + } else if (state === 'stopped') { + animator.start(); + } else { + animator.pause(); + } + }, +}; +``` + + +## Lifecycle APIs + +- Page lifecycle APIs + | Name | Type| Parameter| Return Value| Description| Triggered When| + | -------- | -------- | -------- | -------- | -------- | -------- | + | onInit | Function | N/A| N/A| Listens for page initialization.| Page initialization is complete. This API is called only once in the page lifecycle.| + | onReady | Function | N/A| N/A| Listens for page creation.| A page is created. This API is called only once in the page lifecycle.| + | onShow | Function | N/A| N/A| Listens for page display. | The page is displayed.| + | onHide | Function | N/A| N/A| Listens for page disappearance.| The page disappears.| + | onDestroy | Function | N/A| N/A| Listens for page destruction.| The page is destroyed.| + + The lifecycle APIs of page A are called in the following sequence: + - Open page A: onInit() -> onReady() -> onShow() + + - Open page B on page A: onHide() -> onDestroy() + + - Go back to page A from page B: onInit() -> onReady() -> onShow() + + - Exit page A: onHide() -> onDestroy() + + - Hide page A: onHide() + + - Show background page A on the foreground: onShow() + +- Application lifecycle APIs + | Name | Type| Parameter| Return Value| Description| Triggered When| + | -------- | -------- | -------- | -------- | -------- | -------- | + | onCreate | Function | N/A| N/A| Listens for application creation.| The application is created.| + | onDestroy | Function | N/A| N/A| Listens for application exit.| The application exits.| diff --git a/zh-cn/application-dev/database/public_sys-resources/icon-caution.gif b/en/application-dev/reference/arkui-js-lite/public_sys-resources/icon-caution.gif similarity index 100% rename from zh-cn/application-dev/database/public_sys-resources/icon-caution.gif rename to en/application-dev/reference/arkui-js-lite/public_sys-resources/icon-caution.gif diff --git a/zh-cn/application-dev/database/public_sys-resources/icon-danger.gif b/en/application-dev/reference/arkui-js-lite/public_sys-resources/icon-danger.gif similarity index 100% rename from zh-cn/application-dev/database/public_sys-resources/icon-danger.gif rename to en/application-dev/reference/arkui-js-lite/public_sys-resources/icon-danger.gif diff --git a/zh-cn/application-dev/database/public_sys-resources/icon-note.gif b/en/application-dev/reference/arkui-js-lite/public_sys-resources/icon-note.gif similarity index 100% rename from zh-cn/application-dev/database/public_sys-resources/icon-note.gif rename to en/application-dev/reference/arkui-js-lite/public_sys-resources/icon-note.gif diff --git a/zh-cn/application-dev/database/public_sys-resources/icon-notice.gif b/en/application-dev/reference/arkui-js-lite/public_sys-resources/icon-notice.gif similarity index 100% rename from zh-cn/application-dev/database/public_sys-resources/icon-notice.gif rename to en/application-dev/reference/arkui-js-lite/public_sys-resources/icon-notice.gif diff --git a/zh-cn/application-dev/database/public_sys-resources/icon-tip.gif b/en/application-dev/reference/arkui-js-lite/public_sys-resources/icon-tip.gif similarity index 100% rename from zh-cn/application-dev/database/public_sys-resources/icon-tip.gif rename to en/application-dev/reference/arkui-js-lite/public_sys-resources/icon-tip.gif diff --git a/zh-cn/application-dev/database/public_sys-resources/icon-warning.gif b/en/application-dev/reference/arkui-js-lite/public_sys-resources/icon-warning.gif similarity index 100% rename from zh-cn/application-dev/database/public_sys-resources/icon-warning.gif rename to en/application-dev/reference/arkui-js-lite/public_sys-resources/icon-warning.gif diff --git a/en/application-dev/reference/arkui-js/Readme-EN.md b/en/application-dev/reference/arkui-js/Readme-EN.md index c46abd3bd91d1acbf99bb15152d3f55f636483eb..16bd3fa15567cd54cb38f7f8835c53c5133b168b 100644 --- a/en/application-dev/reference/arkui-js/Readme-EN.md +++ b/en/application-dev/reference/arkui-js/Readme-EN.md @@ -1,104 +1,102 @@ # JavaScript-compatible Web-like Development Paradigm -- Universal Component Information - - [Universal Attributes](js-components-common-attributes.md) - - [Universal Styles](js-components-common-styles.md) - - [Universal Events](js-components-common-events.md) - - [Universal Methods](js-components-common-methods.md) - - [Animation Styles](js-components-common-animation.md) - - [Gradient Styles](js-components-common-gradient.md) - - [Transition Styles](js-components-common-transition.md) - - [Media Query](js-components-common-mediaquery.md) - - [Custom Font Styles](js-components-common-customizing-font.md) - - [Atomic Layout](js-components-common-atomic-layout.md) -- Container Components - - [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) -- Basic Components - - [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) -- Media Components - - [video](js-components-media-video.md) -- Canvas Components - - [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) -- Grid Components - - [Basic Concepts](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 Components - - [Universal Attributes](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) - - -- Custom Components - - [Basic Usage](js-components-custom-basic-usage.md) - - [props](js-components-custom-props.md) - - [Style Inheritance](js-components-custom-style.md) - - [slot](js-components-custom-slot.md) - - [Lifecycle Definition](js-components-custom-lifecycle.md) +- Universal Component Information + - [Universal Attributes](js-components-common-attributes.md) + - [Universal Styles](js-components-common-styles.md) + - [Universal Events](js-components-common-events.md) + - [Universal Methods](js-components-common-methods.md) + - [Animation Styles](js-components-common-animation.md) + - [Gradient Styles](js-components-common-gradient.md) + - [Transition Styles](js-components-common-transition.md) + - [Media Query](js-components-common-mediaquery.md) + - [Custom Font Styles](js-components-common-customizing-font.md) + - [Atomic Layout](js-components-common-atomic-layout.md) +- Container Components + - [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) +- Basic Components + - [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) +- Media Components + - [video](js-components-media-video.md) +- Canvas Components + - [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) +- Grid Components + - [Basic Concepts](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 Components + - [Universal Attributes](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) +- Custom Components + - [Basic Usage](js-components-custom-basic-usage.md) + - [props](js-components-custom-props.md) + - [Style Inheritance](js-components-custom-style.md) + - [slot](js-components-custom-slot.md) + - [Lifecycle Definition](js-components-custom-lifecycle.md) - [Dynamic Component Creation](js-components-create-elements.md) - [Data Type Attributes](js-appendix-types.md) diff --git a/en/application-dev/reference/arkui-js/figures/4-0.gif b/en/application-dev/reference/arkui-js/figures/4-0.gif deleted file mode 100644 index 1589d8650fa225626fb8dadf085732f92170e40f..0000000000000000000000000000000000000000 Binary files a/en/application-dev/reference/arkui-js/figures/4-0.gif and /dev/null differ diff --git a/en/application-dev/reference/arkui-js/figures/animate-transform.gif b/en/application-dev/reference/arkui-js/figures/animate-transform.gif deleted file mode 100644 index e83e2ce11234a97242e1f57204b96568ad248d3d..0000000000000000000000000000000000000000 Binary files a/en/application-dev/reference/arkui-js/figures/animate-transform.gif and /dev/null differ diff --git a/en/application-dev/reference/arkui-js/figures/animate-transform2.gif b/en/application-dev/reference/arkui-js/figures/animate-transform2.gif deleted file mode 100644 index 3c65871bb208133129e46956ecee119276a390a5..0000000000000000000000000000000000000000 Binary files a/en/application-dev/reference/arkui-js/figures/animate-transform2.gif and /dev/null differ diff --git a/en/application-dev/reference/arkui-js/figures/animationapi-4.gif b/en/application-dev/reference/arkui-js/figures/animationapi-4.gif deleted file mode 100644 index 294687cdfb0cf7f2ea34f91c87d0a6394b32bff0..0000000000000000000000000000000000000000 Binary files a/en/application-dev/reference/arkui-js/figures/animationapi-4.gif and /dev/null differ diff --git a/en/application-dev/reference/arkui-js/figures/en-us_image_0000001127125192.gif b/en/application-dev/reference/arkui-js/figures/en-us_image_0000001127125192.gif new file mode 100644 index 0000000000000000000000000000000000000000..3c5b1fa0343c2e6ec1ebf8592ed769e25fc5b2c4 Binary files /dev/null and b/en/application-dev/reference/arkui-js/figures/en-us_image_0000001127125192.gif differ diff --git a/en/application-dev/reference/arkui-js/figures/en-us_image_0000001127285004.gif b/en/application-dev/reference/arkui-js/figures/en-us_image_0000001127285004.gif new file mode 100644 index 0000000000000000000000000000000000000000..dcb1ff67a62b1053d3e1c392bbe0535e81771c54 Binary files /dev/null and b/en/application-dev/reference/arkui-js/figures/en-us_image_0000001127285004.gif differ diff --git a/en/application-dev/reference/arkui-js/figures/en-us_image_0000001167823326.gif b/en/application-dev/reference/arkui-js/figures/en-us_image_0000001167823326.gif new file mode 100644 index 0000000000000000000000000000000000000000..78a6830c434d54aab7beba2f171edfb2f8b4e7d9 Binary files /dev/null and b/en/application-dev/reference/arkui-js/figures/en-us_image_0000001167823326.gif differ diff --git a/en/application-dev/reference/arkui-js/figures/en-us_image_0000001229677045.gif b/en/application-dev/reference/arkui-js/figures/en-us_image_0000001229677045.gif new file mode 100644 index 0000000000000000000000000000000000000000..eaf9944676873d49c6ca1ac7110a48413583821c Binary files /dev/null and b/en/application-dev/reference/arkui-js/figures/en-us_image_0000001229677045.gif differ 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 a1072111daa65e9eab0e528e086b8955efa66e09..baf4fcc12c7ab5edb07b6d41cf6c9740e7fcfda6 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 @@ -136,4 +136,4 @@ export default { } ``` -![zh-cn_image_0000001176075554](figures/zh-cn_image_0000001176075554.gif) +![en-us_image_0000001176075554](figures/en-us_image_0000001176075554.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 e5b7dbf697f485fe49ab8a83eb849457d5c66ea1..ee7d77b8d909a85c416073c74551511de4f5a11c 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,6 +1,7 @@ # picker-view > **NOTE** +> > This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version. The **\** component provides the view that shows an embedded scrollable selector on the screen. diff --git a/en/application-dev/reference/arkui-js/js-components-basic-search.md b/en/application-dev/reference/arkui-js/js-components-basic-search.md index adf32950c2889e99e88d67e28da1b6bfb110f4ee..085a50ad4662a61c7aa4e247e6acffa0be30983b 100644 --- a/en/application-dev/reference/arkui-js/js-components-basic-search.md +++ b/en/application-dev/reference/arkui-js/js-components-basic-search.md @@ -1,6 +1,7 @@ # search > **NOTE** +> > This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version. The **\** component provides an input area for users to search. diff --git a/en/application-dev/reference/arkui-js/js-components-basic-select.md b/en/application-dev/reference/arkui-js/js-components-basic-select.md index e6721685c78744ca4453b50562b59fab220dd767..488a8d1b02e0c4a5a41ca1504fac248b248a7bc4 100644 --- a/en/application-dev/reference/arkui-js/js-components-basic-select.md +++ b/en/application-dev/reference/arkui-js/js-components-basic-select.md @@ -1,11 +1,10 @@ # select -The **** component provides a drop-down list that allows users to select among multiple options. - > **NOTE** > > This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version. +The **** component provides a drop-down list that allows users to select among multiple options. ## Child Components diff --git a/en/application-dev/reference/arkui-js/js-components-basic-web.md b/en/application-dev/reference/arkui-js/js-components-basic-web.md index 0342d75b5b9183f396ab4fec35c212de5ea9617d..5ce69b6b9762e1afdd3a28fe8895c082f474311c 100644 --- a/en/application-dev/reference/arkui-js/js-components-basic-web.md +++ b/en/application-dev/reference/arkui-js/js-components-basic-web.md @@ -1,9 +1,11 @@ # web -The **\** component displays web page content. + >**NOTE** > >This component is supported since API version 6. Updates will be marked with a superscript to indicate their earliest API version. +The **\** component displays web page content. + ## Required Permissions ohos.permission.INTERNET, required only for accessing online web pages. diff --git a/en/application-dev/reference/arkui-js/js-components-common-animation.md b/en/application-dev/reference/arkui-js/js-components-common-animation.md index 72969d608a86f4ce8fdf8ad2eb95431e18b93528..572ff5f9aa30d9eb25d8eca25af56511e71b084b 100644 --- a/en/application-dev/reference/arkui-js/js-components-common-animation.md +++ b/en/application-dev/reference/arkui-js/js-components-common-animation.md @@ -1,11 +1,11 @@ # Animation Styles -Components support dynamic rotation, translation, and scaling effects. These effects can be set in the **style** attribute or CSS files. - > **NOTE** > > The initial APIs of this component are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. +Components support dynamic rotation, translation, and scaling effects. These effects can be set in the **style** attribute or CSS files. + | Name | Type | Description | | ------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | | transform-origin | string6+ \| \ \| \ string6+ \| \ \| \ | Origin position of the transformed element. The unit can be px or a percentage (relative to the animation target component). If only one value is specified, the other one is **50%**. The available values for the first string are **left**, **center**, and **right**. The available values for the second string are **top**, **center**, and **bottom**.
Example:
transform-origin: 200px 30%
transform-origin: 100px topt
ransform-origin: center center
Default value: **center center** | diff --git a/en/application-dev/reference/arkui-js/js-components-common-atomic-layout.md b/en/application-dev/reference/arkui-js/js-components-common-atomic-layout.md index ab5c6fb8454469cffb018585cd5f8577bc7f1031..97a704e70013bf65de41999d371c03153761aef3 100644 --- a/en/application-dev/reference/arkui-js/js-components-common-atomic-layout.md +++ b/en/application-dev/reference/arkui-js/js-components-common-atomic-layout.md @@ -1,11 +1,10 @@ # Atomic Layout -The atomic layout implements adaptive layout for screens of different sizes and types. Designers can use the atomic layout to define adaptive rules for elements on UIs of different forms. Developers can use the atomic layout to implement the adaptive UI features matching the design effect for a variety of screens. - > **NOTE** > > This component is supported since API version 5. Updates will be marked with a superscript to indicate their earliest API version. +The atomic layout implements adaptive layout for screens of different sizes and types. Designers can use the atomic layout to define adaptive rules for elements on UIs of different forms. Developers can use the atomic layout to implement the adaptive UI features matching the design effect for a variety of screens. ## Hiding Components diff --git a/en/application-dev/reference/arkui-js/js-components-common-mediaquery.md b/en/application-dev/reference/arkui-js/js-components-common-mediaquery.md index 30d94245e6e41d153dbe15f04e5f650a1f813a2e..3b6b1898bb78591d6c4b1944d31295c046e11618 100644 --- a/en/application-dev/reference/arkui-js/js-components-common-mediaquery.md +++ b/en/application-dev/reference/arkui-js/js-components-common-mediaquery.md @@ -64,11 +64,11 @@ Media logical operators (and, or, not, and only) are used to implement complex m | Type | Description | | -------- | ---------------------------------------- | -| and | The **and** operator is used to combine multiple media features into one media query, in a logical AND operation. The query is valid only when all media features are true. It can also combine media types and media functions.
For example, **screen and (device-type: wearable) and (max-height: 600) ** evaluates to true when the device type is wearable and the maximum height of the application is 600 pixel units.| -| not | The **not** operator is used to perform a logical negation for a media query. **true** is returned if the query condition is not met. Otherwise, **false** is returned. In a media query list, logical negation is performed only for the media query using the **not** operator.
For example, **not screen and (min-height: 50) and (max-height: 600) ** evaluates to true when the height of the application is less than 50 pixel units or greater than 600 pixel units.
You must specify the media type when using the **not** operator.| +| and | The **and** operator is used to combine multiple media features into one media query, in a logical AND operation. The query is valid only when all media features are true. It can also combine media types and media functions.
For example, **screen and (device-type: wearable) and (max-height: 600)** evaluates to **true** when the device type is wearable and the maximum height of the application is 600 pixel units.| +| not | The **not** operator is used to perform a logical negation for a media query. **true** is returned if the query condition is not met. Otherwise, **false** is returned. In a media query list, logical negation is performed only for the media query using the **not** operator.
For example, **not screen and (min-height: 50) and (max-height: 600)** evaluates to **true** when the height of the application is less than 50 pixel units or greater than 600 pixel units.
You must specify the media type when using the **not** operator.| | only | The **only** operator applies the selected style only when the entire expression is matched. It can be used to prevent ambiguity on browsers of earlier versions. The statements that contain both media types and media features produce ambiguity when they are received by some browsers of earlier versions. For example:
screen and (min-height: 50)
The browsers of earlier versions would mislead this sentence into **screen**, causing the fact that the specified style is applied when only the media type is matched. In this case, the **only** operator can be used to avoid this problem.
You must specify the media type when using the **only** operator.| -| ,(comma) | The **or** operator is used to combine multiple media features into one media query, in a logical OR operation. The query is valid if a media feature is true. The effect of a comma operator is equivalent to that of the **or** operator.
For example, **screen and (min-height: 1000), (round-screen: true) ** evaluates to true when the minimum height of the application is 1000 pixel units or the device screen is round.| -| or | The **or** operator is used to combine multiple media features into one media query, in a logical OR operation. The query is valid if a media feature is true.
For example, **screen and (max-height: 1000) or (round-screen: true)** evaluates to true when the maximum height of the application is 1000 pixel units or the device screen is round.| +| ,(comma) | The **or** operator is used to combine multiple media features into one media query, in a logical OR operation. The query is valid if a media feature is true. The effect of a comma operator is equivalent to that of the **or** operator.
For example, **screen and (min-height: 1000), (round-screen: true)** evaluates to **true** when the minimum height of the application is 1000 pixel units or the device screen is round.| +| or | The **or** operator is used to combine multiple media features into one media query, in a logical OR operation. The query is valid if a media feature is true.
For example, **screen and (max-height: 1000) or (round-screen: true)** evaluates to **true** when the maximum height of the application is 1000 pixel units or the device screen is round.| At MediaQuery Level 4, range query is imported so that you can use the operators including <=, >=, <, and > besides the max- and min-operators. diff --git a/en/application-dev/reference/arkui-js/js-components-common-methods.md b/en/application-dev/reference/arkui-js/js-components-common-methods.md index 3a7d61034f5e8eece95d71ebe9ca2c82556401f7..5945c299f720fa34829fe2eb6cd32b32c9f3278a 100644 --- a/en/application-dev/reference/arkui-js/js-components-common-methods.md +++ b/en/application-dev/reference/arkui-js/js-components-common-methods.md @@ -139,56 +139,46 @@ button{ ```js // xxx.js -import promptAction from '@ohos.promptAction'; -export default{ - data:{ - animation:'', - }, - onInit(){ - }, - onShow(){ - var options = { - duration: 1500, - easing: 'friction', - delay: 500, - fill: 'forwards', - iterations: 2, - direction: 'normal', - }; - var frames = [ - {transform: {translate: '-120px -0px'}, opacity: 0.1, offset: 0.0}, - {transform: {translate: '120px 0px'}, opacity: 1.0, offset: 1.0} - ]; - this.animation = this.$element('idName').animate(frames, options); - // handle finish event - this.animation.onfinish = function(){ - promptAction.showToast({ - message: "The animation is finished." - }); - }; - // handle cancel event - this.animation.oncancel = function(){ - promptAction.showToast({ - message: "The animation is canceled." - }); - }; - // handle repeat event - this.animation.onrepeat = function(){ - promptAction.showToast({ - message: "The animation is repeated." - }); - }; - }, - start(){ - this.animation.play(); - }, - cancel(){ - this.animation.cancel(); - } +export default { + data: { + animation: '', + options: {}, + frames: {} + }, + onInit() { + this.options = { + duration: 1500, + easing: 'friction', + delay: 500, + fill: 'forwards', + iterations: 2, + direction: 'normal', + }; + this.frames = [ + { + transform: { + translate: '-120px -0px' + }, opacity: 0.1, offset: 0.0 + }, + { + transform: { + translate: '120px 0px' + }, opacity: 1.0, offset: 1.0 + } + ]; + }, + + start() { + this.animation = this.$element('idName').animate(this.frames, this.options); + this.animation.play(); + }, + cancel() { + this.animation.cancel(); + } } ``` -![animationapi-4](figures/animationapi-4.gif) +![en-us_image_0000001229677045](figures/en-us_image_0000001229677045.gif) ## getBoundingClientRect diff --git a/en/application-dev/reference/arkui-js/js-components-container-stepper-item.md b/en/application-dev/reference/arkui-js/js-components-container-stepper-item.md index c667c410dc89e77f6ec2e1f0a3bcf9ece2597dc6..c67150bc473949b57c052f6b7e74bb20d3a9e2cc 100644 --- a/en/application-dev/reference/arkui-js/js-components-container-stepper-item.md +++ b/en/application-dev/reference/arkui-js/js-components-container-stepper-item.md @@ -1,10 +1,11 @@ # stepper-item -The **\** component displays a step in the step navigator. This component is the child component of **\**. - > **NOTE** > This component is supported since API version 5. Updates will be marked with a superscript to indicate their earliest API version. +The **\** component displays a step in the step navigator. This component is the child component of **\**. + + ## Required Permissions None diff --git a/en/application-dev/reference/arkui-js/js-components-container-stepper.md b/en/application-dev/reference/arkui-js/js-components-container-stepper.md index 09bd2f3fce15f326b1d8f06832d3ea0c4319e234..ffcab80f20581fcb3e6ef36586416faeec50f922 100644 --- a/en/application-dev/reference/arkui-js/js-components-container-stepper.md +++ b/en/application-dev/reference/arkui-js/js-components-container-stepper.md @@ -48,7 +48,7 @@ In addition to the [universal events](../arkui-js/js-components-common-events.md | finish | - | Triggered when the last step on the navigator is complete. | | skip | - | Triggered when users click the skip button to skip steps.| | change | { prevIndex: prevIndex, index: index} | Triggered when users click the left or right (text) button of the step navigator to switch between steps. **prevIndex** indicates the index of the previous step, and **index** indicates that of the current step.| -| next | { index: index, pendingIndex: pendingIndex } | Triggered when users click the next (text) button. **index** indicates the index of the current step, and **pendingIndex** indicates that of the step to go. The return value is in **{pendingIndex:*** pendingIndex***}** format. You can use **pendingIndex** to specify a **** child component as the next step to go.| +| next | { index: index, pendingIndex: pendingIndex } | Triggered when users click the next (text) button. **index** indicates the index of the current step, and **pendingIndex** indicates that of the step to go. The return value is in **{pendingIndex:*** pendingIndex***}** format. You can use **pendingIndex** to specify a **\** child component as the next step to go. | | back | { index: index, pendingIndex: pendingIndex } | Triggered when users click the previous (text) button. **index** indicates the index of the current step, and **pendingIndex** indicates that of the step to go. The return value is in Object:{ **{pendingIndex:*** pendingIndex***}** format. You can use **pendingIndex** to specify a **** child component as the previous step.| diff --git a/en/application-dev/reference/arkui-js/js-components-container-swiper.md b/en/application-dev/reference/arkui-js/js-components-container-swiper.md index f607139653a52a1e1edbca359ca60d7224ebcc30..6a16be9d774b42edb9a7fc1ffe57d5d1867ee813 100644 --- a/en/application-dev/reference/arkui-js/js-components-container-swiper.md +++ b/en/application-dev/reference/arkui-js/js-components-container-swiper.md @@ -118,16 +118,19 @@ In addition to the [universal methods](../arkui-js/js-components-common-methods. } .swiperContent1{ height: 100%; + width: 100%; justify-content: center; background-color: #007dff; } .swiperContent2{ height: 100%; + width: 100%; justify-content: center; background-color: #ff7500; } .swiperContent3{ height: 100%; + width: 100%; justify-content: center; background-color: #41ba41; } @@ -155,4 +158,4 @@ export default { } ``` -![4-0](figures/4-0.gif) +![en-us_image_0000001167823326](figures/en-us_image_0000001167823326.gif) diff --git a/en/application-dev/reference/arkui-js/js-components-container-tab-content.md b/en/application-dev/reference/arkui-js/js-components-container-tab-content.md index 09dd135cffdeba9254544bc14f662637aef3c847..aed456e555fc8206ebecf81600a48dc0857c6d16 100644 --- a/en/application-dev/reference/arkui-js/js-components-container-tab-content.md +++ b/en/application-dev/reference/arkui-js/js-components-container-tab-content.md @@ -1,11 +1,10 @@ # tab-content -**** is a child component of **[](js-components-container-tabs.md)** and is used to provide the area for displaying the tab content. By default, its height is such that all the remaining space of the **** component is filled. The child components are arranged horizontally. When **** is used as a child element in a container, its length along the main axis must be specified. Otherwise, it cannot be displayed. - > **NOTE** > > This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version. +**** is a child component of **[](js-components-container-tabs.md)** and is used to provide the area for displaying the tab content. By default, its height is such that all the remaining space of the **** component is filled. The child components are arranged horizontally. When **** is used as a child element in a container, its length along the main axis must be specified. Otherwise, it cannot be displayed. **\** does not support page scrolling. If page scrolling is required, consider nesting a list. ## Required Permissions @@ -21,7 +20,7 @@ Supported In addition to the [universal attributes](../arkui-js/js-components-common-attributes.md), the following attributes are supported. -| Name | Type| Mandatory| Description| +| Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | scrollable | boolean | No| Whether the tabs can be switched by swiping left or right. The default value is **true**. If this attribute is set to **false**, tab switching is implemented only through the association with **tab-bar**.| diff --git a/en/application-dev/reference/arkui-js/js-components-custom-basic-usage.md b/en/application-dev/reference/arkui-js/js-components-custom-basic-usage.md index b6f659f069b4e7c5f6dc6347664552a8c6a82e4d..4759de401d3e60ec49a8434ab27abc0c92e65d34 100644 --- a/en/application-dev/reference/arkui-js/js-components-custom-basic-usage.md +++ b/en/application-dev/reference/arkui-js/js-components-custom-basic-usage.md @@ -3,7 +3,7 @@ Custom components are existing components encapsulated based on service requirements. A custom component can be invoked multiple times in a project to improve the code readability. You can import a custom component to the host page through **element** as shown in the following code snippet: ```html - +
@@ -12,8 +12,8 @@ Custom components are existing components encapsulated based on service requirem The following is an example of using a custom component with **if-else**, which displays **comp1** when **showComp1** is set to **true** and displays **comp2** otherwise. ```html - - + +
@@ -76,7 +76,7 @@ The following example describes how to import **comp** to the parent component: ```html - +
@@ -125,7 +125,7 @@ In the following example, the child component passes the **text** parameter to t ```html - +
Parent component: {{text}} diff --git a/en/application-dev/reference/arkui-js/js-components-custom-props.md b/en/application-dev/reference/arkui-js/js-components-custom-props.md index c9c496b57842c628eabb96377c8096c6a9cc1f9c..c2c0c64961108bcb9f0e2d965b86883593a20dce 100644 --- a/en/application-dev/reference/arkui-js/js-components-custom-props.md +++ b/en/application-dev/reference/arkui-js/js-components-custom-props.md @@ -21,7 +21,7 @@ export default { ```html - +
@@ -57,7 +57,7 @@ In this example, a **\** component is added to display the title. The titl ```html - +
diff --git a/en/application-dev/reference/arkui-js/js-components-custom-slot.md b/en/application-dev/reference/arkui-js/js-components-custom-slot.md index 50c5b9ed0d1ad181567945134be95e0f9c229fed..894a56e8cbe2aa4a9675e9787f8218ad220393bd 100644 --- a/en/application-dev/reference/arkui-js/js-components-custom-slot.md +++ b/en/application-dev/reference/arkui-js/js-components-custom-slot.md @@ -20,7 +20,7 @@ You can use the **\** tag to create a slot inside a custom component to fi The following references the custom component: ```html - +
Content defined in the parent component @@ -31,7 +31,7 @@ The following references the custom component: ## Named Slot -When multiple slots are need inside a custom component, you can name them, so that you can specify the slot in which you want to fill content by setting the **** attribute. +When multiple slots are need inside a custom component, you can name them, so that you can specify the slot in which you want to fill content by setting the **\** attribute. ```html @@ -45,7 +45,7 @@ When multiple slots are need inside a custom component, you can name them, so th The following references the custom component: ```html - +
Fill in the second slot. diff --git a/en/application-dev/reference/arkui-js/js-components-custom-style.md b/en/application-dev/reference/arkui-js/js-components-custom-style.md index ba8644e3e347e700b523ea0c7f2ab02159faeca7..635c07cc1abe37bf7aa99888cf4efbe77429e02a 100644 --- a/en/application-dev/reference/arkui-js/js-components-custom-style.md +++ b/en/application-dev/reference/arkui-js/js-components-custom-style.md @@ -1,6 +1,6 @@ # Style Inheritance -> **NOTE**
+> **NOTE** > > The APIs of this module are supported since API version 9. Updates will be marked with a superscript to indicate their earliest API version. diff --git a/en/application-dev/reference/arkui-js/js-components-svg-animate.md b/en/application-dev/reference/arkui-js/js-components-svg-animate.md index e90d520cb36057ac385917e4df3d532c8669e97d..46a636aa4043e95c4c1de83b39e09371396fa0cd 100644 --- a/en/application-dev/reference/arkui-js/js-components-svg-animate.md +++ b/en/application-dev/reference/arkui-js/js-components-svg-animate.md @@ -28,9 +28,9 @@ Not supported | end | <time> | 0 | No| Duration after which the animation ends. The value can be ms (ms), s (second), or m (minute). The default value is s (second). Other formats are not supported.| | repeatCount | <number \| indefinite> | 1 | No| Number of times the animation is played. The default value is indefinite. You can set the value to **1** to play the animation only once.| | fill | <freeze \| remove> | remove | No| State when the animation ends.| -| calcMode | <discrete \| linear \| paced \| spline> | linear | No| Interpolation mode of the animation.
**discrete**: The value of **from** directly jumps to the value of **to**.
**linear**: linear.
**paced**: linear. After this value is set, the values of **keyTimes** and **keyPoints** are invalid.
**spline**: user-defined Bessel curve. The spline point is defined in the **keyTimes** attribute, and the control point of each interval is defined by **keySplines**.| -| keyTimes | string | - | No| Start time of the key frame animation. The value ranges from 0 to 1, separated by semicolons (;), for example, **0;0.3;0.8;1**. **keyTimes**, **keySplines**, and **values** are combined to set the key frame animation. The number of **keyTimes** is the same as that of **values**. The number of **keySplines** is the number of **keyTimes** minus 1.| -| keySplines | string | - | No| A set of Bessel control points associated with **keyTimes**. You can define the Bessel curves for each key frame. The curves are separated by semicolons (;). The format of the two controls in the curve is x1 y1 x2 y2. For example, **0.5 0 0.5 1; 0.5 0 0.5 1;0.5 0 0.5 1**.| +| calcMode | <discrete \| linear \| paced \| spline> | linear | No| Interpolation mode of the animation.
**discrete**: The animation directly jumps from the value specified by **from** to the value specified by **to**.
**linear**: Linear interpolation between values is used.
**paced**: Interpolation that produces an even paced change is used. If this value is set, the values of **keyTimes** and **keyPoints** will not take effect.
**spline**: Interpolation is implemented based on a custom Bezier spline. The spline points are defined in the **keyTimes** attribute, and the control points of each interval are defined in the **keySplines** attribute.| +| keyTimes | string | - | No| Start time of the key frame animation. The value is a semicolon-separated list of values ranging from 0 to 1, for example, **0;0.3;0.8;1**. **keyTimes**, **keySplines**, and **values** are combined to set the key frame animation. The number of values defined for **keyTimes** is the same as that for **values**. The number of values defined for **keySplines** is the number of values defined for **keyTimes** minus 1.| +| keySplines | string | - | No| A set of Bezier control points associated with **keyTimes**. You can define the Bezier curves for each key frame, separating them with semicolons (;). The format of the two control points in the curve is x1 y1 x2 y2, for example, **0.5 0 0.5 1; 0.5 0 0.5 1;0.5 0 0.5 1**.| | by | number | - | No| Relative offset value to add to a specified attribute in the animation. The default value of **from** is the original attribute value.| | from | string | - | No| Start value of the attribute to which the animation is applied.
If the **values** attribute has been set, the **from** attribute is invalid.| | to | string | - | No| End value of the attribute to which the animation is applied.
If the **values** attribute has been set, the **to** attribute is invalid.| @@ -76,7 +76,7 @@ Not supported
- +
diff --git a/en/application-dev/reference/arkui-js/js-components-svg-animatetransform.md b/en/application-dev/reference/arkui-js/js-components-svg-animatetransform.md index d9242543a6fda9398032b299d00cf4cf755edfc9..20d19b53d05cc201c4a258b49ff27552701b5669 100644 --- a/en/application-dev/reference/arkui-js/js-components-svg-animatetransform.md +++ b/en/application-dev/reference/arkui-js/js-components-svg-animatetransform.md @@ -91,7 +91,7 @@ The **animate** attributes and the attributes in the following table are support ``` -![animate-transform](figures/animate-transform.gif) +![en-us_image_0000001127285004](figures/en-us_image_0000001127285004.gif) Animation overlay @@ -150,7 +150,7 @@ Animation overlay ``` -![animate-transform2](figures/animate-transform2.gif) +![en-us_image_0000001127125192](figures/en-us_image_0000001127125192.gif) Example of involved components diff --git a/en/application-dev/reference/arkui-js/js-components-svg-circle.md b/en/application-dev/reference/arkui-js/js-components-svg-circle.md index 66e793fe790ccc471f91e271b8ae92163d507ac3..3b486978b5123f47660cc130a5d63d39184b1359 100644 --- a/en/application-dev/reference/arkui-js/js-components-svg-circle.md +++ b/en/application-dev/reference/arkui-js/js-components-svg-circle.md @@ -1,11 +1,11 @@ # circle -The **\** component is used to draw circles. > **NOTE** > > This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. +The **\** component is used to draw circles. ## Required Permissions diff --git a/en/application-dev/reference/arkui-js/js-components-svg-ellipse.md b/en/application-dev/reference/arkui-js/js-components-svg-ellipse.md index 1d790bb7cf468e75dc8cd070e01fd42beddf1574..f678409ea72539da10ed2d3a44b80a269d516846 100644 --- a/en/application-dev/reference/arkui-js/js-components-svg-ellipse.md +++ b/en/application-dev/reference/arkui-js/js-components-svg-ellipse.md @@ -1,11 +1,11 @@ # ellipse -The **\** component is used to draw oval shapes. > **NOTE** > > This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. +The **\** component is used to draw oval shapes. ## Required Permissions diff --git a/en/application-dev/reference/arkui-js/js-components-svg-line.md b/en/application-dev/reference/arkui-js/js-components-svg-line.md index f181199036a0d71e2e26e8a66cc3b9d05527ec04..9215e1dc367fa488d45e1e78d62fc4530c70c882 100644 --- a/en/application-dev/reference/arkui-js/js-components-svg-line.md +++ b/en/application-dev/reference/arkui-js/js-components-svg-line.md @@ -1,11 +1,11 @@ # line -The **\** component is used to draw a line. > **NOTE** > > This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. +The **\** component is used to draw a line. ## Required Permissions diff --git a/en/application-dev/reference/arkui-js/js-components-svg-path.md b/en/application-dev/reference/arkui-js/js-components-svg-path.md index a1e114c49db8f8d608a4137b91fcd50fba9c5453..0cec8074e4892ec1ebc84ff6e90e1dcfcb732f44 100644 --- a/en/application-dev/reference/arkui-js/js-components-svg-path.md +++ b/en/application-dev/reference/arkui-js/js-components-svg-path.md @@ -1,10 +1,11 @@ # path -The **\** component is used to draw a path. > **NOTE** -> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. +> +> This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. +The **\** component is used to draw a path. ## Required Permissions diff --git a/en/application-dev/reference/arkui-js/js-components-svg-polygon.md b/en/application-dev/reference/arkui-js/js-components-svg-polygon.md index d747dc84673e72fa6e262509ee77469a3ee6515a..8395e4d4d2cc8462b61231be3f64f9e708787f09 100644 --- a/en/application-dev/reference/arkui-js/js-components-svg-polygon.md +++ b/en/application-dev/reference/arkui-js/js-components-svg-polygon.md @@ -1,12 +1,13 @@ # polygon -The **\** component is used to draw a polygon. - > **NOTE** > > This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. +The **\** component is used to draw a polygon. + + ## Required Permissions None @@ -19,7 +20,7 @@ The following are supported: [\](js-components-svg-animate.md), [\** component is used to draw a polyline. > **NOTE** > > This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. +The **\** component is used to draw a polyline. ## Required Permissions @@ -19,7 +19,7 @@ The following are supported: [\](js-components-svg-animate.md), [\** component is used to draw rectangles and rounded rectangles. > **NOTE** > > This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. +The **\** component is used to draw rectangles and rounded rectangles. ## Required Permissions @@ -19,7 +19,7 @@ The following are supported: [\](js-components-svg-animate.md), [\** component is used to display a piece of textual information. - > **NOTE** > @@ -13,6 +11,8 @@ The **\** component is used to display a piece of textual information. > > - Only the default font **sans-serif** is supported. +The **\** component is used to display a piece of textual information. + ## Required Permissions None diff --git a/en/application-dev/reference/arkui-ts/Readme-EN.md b/en/application-dev/reference/arkui-ts/Readme-EN.md index 25736a22dced9dd795af1edd130de06ab02248cf..7d723dc4082fd6f1aa65fe7ff181fc3fcd268621 100644 --- a/en/application-dev/reference/arkui-ts/Readme-EN.md +++ b/en/application-dev/reference/arkui-ts/Readme-EN.md @@ -28,7 +28,6 @@ - [Transformation](ts-universal-attributes-transformation.md) - [Image Effect Configuration](ts-universal-attributes-image-effect.md) - [Shape Clipping](ts-universal-attributes-sharp-clipping.md) - - [Text Style](ts-universal-attributes-text-style.md) - [Grid](ts-universal-attributes-grid.md) - [Gradient Color](ts-universal-attributes-gradient-color.md) - [Popup Control](ts-universal-attributes-popup.md) @@ -42,7 +41,9 @@ - [Hit Test Control](ts-universal-attributes-hit-test-behavior.md) - [Background Blur](ts-universal-attributes-backgroundBlurStyle.md) - [restoreId](ts-universal-attributes-restoreId.md) - - Gesture Processing + - [Foreground Color](ts-universal-attributes-foreground-color.md) + - [Universal Text Attributes](ts-universal-attributes-text-style.md) + - Gesture Handling - [Gesture Binding Methods](ts-gesture-settings.md) - Basic Gestures - [TapGesture](ts-basic-gestures-tapgesture.md) @@ -53,6 +54,7 @@ - [SwipeGesture](ts-basic-gestures-swipegesture.md) - [Combined Gestures](ts-combined-gestures.md) - Basic Components + - [AlphabetIndexer](ts-container-alphabet-indexer.md) - [Blank](ts-basic-components-blank.md) - [Button](ts-basic-components-button.md) - [Checkbox](ts-basic-components-checkbox.md) @@ -60,11 +62,15 @@ - [DataPanel](ts-basic-components-datapanel.md) - [DatePicker](ts-basic-components-datepicker.md) - [Divider](ts-basic-components-divider.md) + - [Formcomponent](ts-basic-components-formcomponent.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) + - [Menu](ts-basic-components-menu.md) + - [MenuItem](ts-basic-components-menuitem.md) + - [MenuItemGroup](ts-basic-components-menuitemgroup.md) - [Navigation](ts-basic-components-navigation.md) - [NavRouter](ts-basic-components-navrouter.md) - [NavDestination](ts-basic-components-navdestination.md) @@ -95,7 +101,6 @@ - [XComponent](ts-basic-components-xcomponent.md) - Container Components - [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) diff --git a/en/application-dev/reference/arkui-ts/figures/ColoringStrategy_circle.png b/en/application-dev/reference/arkui-ts/figures/ColoringStrategy_circle.png new file mode 100644 index 0000000000000000000000000000000000000000..1ea0edb63c1effab0ff368714baeece62b0cf49f Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/ColoringStrategy_circle.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/align.png b/en/application-dev/reference/arkui-ts/figures/align.png index ffabc26d3ee59984dda6cb375f8b18bb319b4fc7..5cdeb7cfd622b90a6fe52ef8cc94f187847d05b7 100644 Binary files a/en/application-dev/reference/arkui-ts/figures/align.png and b/en/application-dev/reference/arkui-ts/figures/align.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/animation.PNG b/en/application-dev/reference/arkui-ts/figures/animation.PNG deleted file mode 100644 index 92f92e0001a90840d03ebd00e0b0ef736c2a94c8..0000000000000000000000000000000000000000 Binary files a/en/application-dev/reference/arkui-ts/figures/animation.PNG and /dev/null differ diff --git a/en/application-dev/reference/arkui-ts/figures/animation.gif b/en/application-dev/reference/arkui-ts/figures/animation.gif index 6cfbc07fc5122be3ecd69e6b33b6f00c0f676a0f..e1f1e9d8eedba5f4d7e9895fe10c1028cb8e19bd 100644 Binary files a/en/application-dev/reference/arkui-ts/figures/animation.gif and b/en/application-dev/reference/arkui-ts/figures/animation.gif differ diff --git a/en/application-dev/reference/arkui-ts/figures/animation1.PNG b/en/application-dev/reference/arkui-ts/figures/animation1.PNG deleted file mode 100644 index 98cc1fa8c0537071549fa8185fa14f7ad103e7f8..0000000000000000000000000000000000000000 Binary files a/en/application-dev/reference/arkui-ts/figures/animation1.PNG and /dev/null differ diff --git a/en/application-dev/reference/arkui-ts/figures/animation1.gif b/en/application-dev/reference/arkui-ts/figures/animation1.gif new file mode 100644 index 0000000000000000000000000000000000000000..d4fae00973755cc243e1d48f10acf9ef4b24682e Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/animation1.gif differ diff --git a/en/application-dev/reference/arkui-ts/figures/borderImageGradient.png b/en/application-dev/reference/arkui-ts/figures/borderImageGradient.png index edf91d4844deeee4f997f65d2d88b45bf7ff7f1d..0cf19ef4273d18c84b86582543129906e8720142 100644 Binary files a/en/application-dev/reference/arkui-ts/figures/borderImageGradient.png and b/en/application-dev/reference/arkui-ts/figures/borderImageGradient.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/coordinates.png b/en/application-dev/reference/arkui-ts/figures/coordinates.png new file mode 100644 index 0000000000000000000000000000000000000000..839f765b9f62dd9efcf1d2ee891a191c9a5ba053 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/coordinates.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001174104400.gif b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001174104400.gif new file mode 100644 index 0000000000000000000000000000000000000000..da442c6a4f02d281bafff3f9fde8a51c6ebbf932 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001174104400.gif differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001212378420.gif b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001212378420.gif deleted file mode 100644 index ec293bafaf6cd7204ebb231c4eee7daa504b78c3..0000000000000000000000000000000000000000 Binary files a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001212378420.gif and /dev/null differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001212378422.gif b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001212378422.gif deleted file mode 100644 index ac096bd0f149b02d46013420a9c323fe8aa5805a..0000000000000000000000000000000000000000 Binary files a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001212378422.gif and /dev/null differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001219982708.gif b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001219982708.gif new file mode 100644 index 0000000000000000000000000000000000000000..738e50b17cf1c20514f17034ec08bba1cadf2893 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001219982708.gif differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001256858415.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001256858415.png deleted file mode 100644 index 6b2c6040690cebf054da6dbc70c87d14c82be9d6..0000000000000000000000000000000000000000 Binary files a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001256858415.png and /dev/null differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001257138363.gif b/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001257138363.gif deleted file mode 100644 index 3a2f5de773fed90a3c0c058d0b27bc0edd1f1904..0000000000000000000000000000000000000000 Binary files a/en/application-dev/reference/arkui-ts/figures/en-us_image_0000001257138363.gif and /dev/null differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777774.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777774.png index 60f430b646b45a3e3b16a9bb024e4a14e48bf4d3..24edbed60b52947c5effbba951a6523582603f30 100644 Binary files a/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777774.png and b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777774.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777775.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777775.png index 60f430b646b45a3e3b16a9bb024e4a14e48bf4d3..24edbed60b52947c5effbba951a6523582603f30 100644 Binary files a/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777775.png and b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777775.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777779.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777779.png index 4558b332925757d97d70ee57182c260804629346..24edbed60b52947c5effbba951a6523582603f30 100644 Binary files a/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777779.png and b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777779.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_background_blur_style.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_background_blur_style.png index e9a7b0e3baa6d48739c2a3cfbc7b5b46600f9c70..9bec842e6d41af8a815ab24ce0897a0b75c8b8c4 100644 Binary files a/en/application-dev/reference/arkui-ts/figures/en-us_image_background_blur_style.png and b/en/application-dev/reference/arkui-ts/figures/en-us_image_background_blur_style.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/foregroundColorInherit.jpg b/en/application-dev/reference/arkui-ts/figures/foregroundColorInherit.jpg new file mode 100644 index 0000000000000000000000000000000000000000..576b20baebaafe45b8e360b2cc1d2aba1a0a9ba1 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/foregroundColorInherit.jpg differ diff --git a/en/application-dev/reference/arkui-ts/figures/foregroundColor_circle.png b/en/application-dev/reference/arkui-ts/figures/foregroundColor_circle.png new file mode 100644 index 0000000000000000000000000000000000000000..1d769ec260258ac57833600a8e3cbda3e985166b Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/foregroundColor_circle.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/list1.gif b/en/application-dev/reference/arkui-ts/figures/list1.gif new file mode 100644 index 0000000000000000000000000000000000000000..3e09842f3905ddf22e145b044238340b07b480ca Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/list1.gif differ diff --git a/en/application-dev/reference/arkui-ts/figures/menu1.png b/en/application-dev/reference/arkui-ts/figures/menu1.png new file mode 100644 index 0000000000000000000000000000000000000000..c431b6e9dd911b7f93b778eb6fb290063bb0338a Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/menu1.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/progressMask.PNG b/en/application-dev/reference/arkui-ts/figures/progressMask.PNG new file mode 100644 index 0000000000000000000000000000000000000000..fac3dda28c11979572ff69ed3005be5d40e62b3b Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/progressMask.PNG differ diff --git a/en/application-dev/reference/arkui-ts/figures/qrcode.png b/en/application-dev/reference/arkui-ts/figures/qrcode.png new file mode 100644 index 0000000000000000000000000000000000000000..762c952314fc6e52bbbc0ae55565422c40d05ff0 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/qrcode.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/richText.png b/en/application-dev/reference/arkui-ts/figures/richText.png index 65826de750d037a394178b66805a9d1ffdad374e..d7ae9f6dfaa45c77143700a24addf29371c7cc38 100644 Binary files a/en/application-dev/reference/arkui-ts/figures/richText.png and b/en/application-dev/reference/arkui-ts/figures/richText.png differ diff --git a/en/application-dev/reference/arkui-ts/figures/span.png b/en/application-dev/reference/arkui-ts/figures/span.png new file mode 100644 index 0000000000000000000000000000000000000000..881f4945dac79e31cb9f11216a682110de4efec7 Binary files /dev/null and b/en/application-dev/reference/arkui-ts/figures/span.png differ diff --git a/en/application-dev/reference/arkui-ts/ts-animatorproperty.md b/en/application-dev/reference/arkui-ts/ts-animatorproperty.md index 36d37c6d5fe1e091128d60ee0ff9f337bd13c818..11ce9d0312a22f1e9c432d99716319589b551d43 100644 --- a/en/application-dev/reference/arkui-ts/ts-animatorproperty.md +++ b/en/application-dev/reference/arkui-ts/ts-animatorproperty.md @@ -6,20 +6,21 @@ You can create a property animator to animate certain universal attributes of a > > This event is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. - animation(value: {duration?: number, tempo?: number, curve?: string | Curve | ICurve, delay?:number, iterations: number, playMode?: PlayMode, onFinish?: () => void}) +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name | Type | Mandatory | Description | | ---------- | ------------------------------------------| ---- | ------------------------------------------------------------ | -| duration | number | No | Animation duration, in ms.
Default value: **1000**| -| tempo | number | No | Animation playback speed. A greater value indicates a higher animation playback speed.
The value **0** indicates that no animation is applied.
Default value: **1**| -| curve | string \| [Curve](ts-appendix-enums.md#curve) \| ICurve9+ | No | Animation curve.
Default value: **Curve.Linear** | -| delay | number | No | Delay of animation playback, in ms. The value **0** indicates that the playback is not delayed.
Default value: **0** | -| iterations | number | No | Number of times that the animation is played. The value **-1** indicates that the animation is played for an unlimited number of times.
Default value: **1**| -| playMode | [PlayMode](ts-appendix-enums.md#playmode) | No | Animation playback mode. By default, the animation is played from the beginning after the playback is complete.
Default value: **PlayMode.Normal**| -| onFinish | () => void | No | Callback invoked when the animation playback is complete. | +| duration | number | No | Animation duration, in ms.
Default value: **1000**
Unit: ms
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
- The maximum animation duration on an ArkTS widget is 1000 ms.
- A value less than 1 evaluates to the value **0**.
- If the value is of the floating point type, the value is rounded down. If the value is 1.2, the value **1** is used.| +| tempo | number | No | Animation playback speed. A larger value indicates a higher animation playback speed.
The value **0** indicates that no animation is applied.
Default value: **1**
**NOTE**
A value less than 1 evaluates to the value **1**.| +| curve | string \| [Curve](ts-appendix-enums.md#curve) \| ICurve9+ | No | Animation curve. The default curve is linear.
Default value: **Curve.Linear**
Since API version 9, this API is supported in ArkTS widgets.| +| delay | number | No | Delay of animation playback, in ms. The value **0** indicates that the playback is not delayed.
Default value: **0**
Value range: [0, +∞)
**NOTE**
A value less than 1 evaluates to the value **0**. If the value is of the floating point type, the value is rounded down. If the value is 1.2, the value **1** is used.| +| iterations | number | No | Number of times that the animation is played.
Default value: **1**
Value range: [-1, +∞)
**NOTE**
The value **-1** indicates that the animation is played for an unlimited number of times. The value **0** indicates that no animation is applied.| +| playMode | [PlayMode](ts-appendix-enums.md#playmode) | No | Animation playback mode. By default, the animation is played from the beginning after the playback is complete.
Default value: **PlayMode.Normal**
Since API version 9, this API is supported in ArkTS widgets.| +| onFinish | () => void | No | Callback invoked when the animation playback is complete.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
This callback is not invoked when **iterations** is set to **-1**.| ## Example @@ -36,11 +37,11 @@ struct AttrAnimationExample { build() { Column() { - Button('change width and height') + Button('change size') .onClick(() => { if (this.flag) { - this.widthSize = 100 - this.heightSize = 50 + this.widthSize = 150 + this.heightSize = 60 } else { this.widthSize = 250 this.heightSize = 100 @@ -66,8 +67,8 @@ struct AttrAnimationExample { duration: 1200, curve: Curve.Friction, delay: 500, - iterations: -1, // The value -1 indicates that the animation is played for an unlimited number of times. - playMode: PlayMode.AlternateReverse + iterations: -1, // The value -1 indicates that the animation is played for an unlimited number of times. + playMode: PlayMode.Alternate }) }.width('100%').margin({ top: 20 }) } diff --git a/en/application-dev/reference/arkui-ts/ts-appendix-enums.md b/en/application-dev/reference/arkui-ts/ts-appendix-enums.md index ecc026e3fd2d4613e5b3fb0e48533e29d6f1a941..dbc249b03b068a777ce4977e940f52860720d037 100644 --- a/en/application-dev/reference/arkui-ts/ts-appendix-enums.md +++ b/en/application-dev/reference/arkui-ts/ts-appendix-enums.md @@ -2,6 +2,8 @@ ## Color +Since API version 9, this API is supported in ArkTS widgets. + | Color | Value | Illustration | | ------------------------ | -------- | ------------------------------------------------------------ | | Black | 0x000000 | ![en-us_image_0000001219864153](figures/en-us_image_0000001219864153.png) | @@ -19,6 +21,8 @@ ## ImageFit +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | --------- | ------------------------------------------------------------ | | Contain | The image is scaled with its aspect ratio retained for the content to be completely displayed within the display boundaries. | @@ -30,6 +34,8 @@ ## BorderStyle +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ------ | ----------------------------------------------- | | Dotted | Dotted border. The radius of a dot is half of **borderWidth**.| @@ -38,6 +44,8 @@ ## LineJoinStyle +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ----- | -------------------- | | Bevel | Bevel is used to connect paths.| @@ -46,6 +54,8 @@ ## TouchType +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ------ | ------------------------------ | | Down | A finger is pressed. | @@ -55,6 +65,8 @@ ## MouseButton +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ------- | ---------------- | | Left | Left button on the mouse. | @@ -66,6 +78,8 @@ ## MouseAction +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ------- | -------------- | | Press | The mouse button is pressed.| @@ -75,6 +89,8 @@ ## Curve +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ------------------- | ------------------------------------------------------------ | | Linear | The animation speed keeps unchanged. | @@ -93,6 +109,8 @@ ## AnimationStatus +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ------- | ------------------ | | Initial | The animation is in the initial state. | @@ -102,6 +120,8 @@ ## FillMode +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | --------- | ------------------------------------------------------------ | | None | Before execution, the animation does not apply any styles to the target component. After execution, the animation restores the target component to its default state.| @@ -111,6 +131,8 @@ ## PlayMode +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ---------------- | ------------------------------------------------------------ | | Normal | The animation is played forwards. | @@ -120,6 +142,8 @@ ## KeyType +Since API version 9, this API is supported in ArkTS widgets. + | Name| Description | | ---- | ---------- | | Down | The key is pressed.| @@ -127,6 +151,8 @@ ## KeySource +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | -------- | -------------------- | | Unknown | Unknown input device. | @@ -136,16 +162,18 @@ | Name | Description | | -------- | ---------------------- | -| Top | Top edge in the vertical direction. | -| Center(deprecated) | Center position in the vertical direction.
This API is deprecated since API version 9. | -| Bottom | Bottom edge in the vertical direction. | +| Top | Top edge in the vertical direction.
Since API version 9, this API is supported in ArkTS widgets.| +| Center(deprecated) | Center position in the vertical direction.
This API is deprecated since API version 9.| +| Bottom | Bottom edge in the vertical direction.
Since API version 9, this API is supported in ArkTS widgets.| | Baseline(deprecated) | Text baseline position in the cross axis direction.
This API is deprecated since API version 9.| -| Start | Start position in the horizontal direction. | -| Middle(deprecated) | Center position in the horizontal direction.
This API is deprecated since API version 9. | -| End | End position in the horizontal direction. | +| Start | Start position in the horizontal direction.
Since API version 9, this API is supported in ArkTS widgets.| +| Middle(deprecated) | Center position in the horizontal direction.
This API is deprecated since API version 9.| +| End | End position in the horizontal direction.
Since API version 9, this API is supported in ArkTS widgets.| ## Week +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | -------- | ---------------------- | | Mon | Monday. | @@ -158,6 +186,8 @@ ## Direction +Since API version 9, this API is supported in ArkTS widgets. + | Name| Description | | ---- | ---------------------- | | Ltr | Components are arranged from left to right. | @@ -166,6 +196,8 @@ ## BarState +Since API version 9, this API is supported in ArkTS widgets. + | Name| Description | | ---- | -------------------------------- | | Off | Not displayed. | @@ -174,6 +206,8 @@ ## EdgeEffect +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ------ | ------------------------------------------------------------ | | Spring | Spring effect. When at one of the edges, the component can move beyond the bounds through touches, and produces a bounce effect when the user releases their finger.| @@ -182,6 +216,8 @@ ## Alignment +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ----------- | ---------------- | | TopStart | Top start. | @@ -196,14 +232,18 @@ ## TransitionType +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ------ | -------------------------------------------------- | | All | The transition takes effect in all scenarios.| -| Insert | The transition takes effect when a component is inserted. | -| Delete | The transition takes effect when a component is deleted. | +| Insert | The transition takes effect when a component is inserted or displayed.| +| Delete | The transition takes effect when a component is deleted or hidden.| ## RelateType +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ------ | ------------------------------- | | FILL | The current child component is scaled to fill the parent component. | @@ -211,6 +251,8 @@ ## Visibility +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ------- | -------------------------------- | | Hidden | The component is hidden, and a placeholder is used for it in the layout. | @@ -219,6 +261,8 @@ ## LineCapStyle +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ------ | -------------------- | | Butt | The ends of the line are squared off, and the line does not extend beyond its two endpoints.| @@ -227,6 +271,8 @@ ## Axis +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ---------- | ------------ | | Vertical | Vertical direction.| @@ -234,6 +280,8 @@ ## HorizontalAlign +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ------ | ------------------------ | | Start | Aligned with the start edge in the same direction as the language in use.| @@ -242,6 +290,8 @@ ## FlexAlign +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ------------ | ------------------------------------------------------------ | | Start | The child components are aligned with the start edge of the main axis. The first component is aligned with the main-start, and subsequent components are aligned with the previous one.| @@ -253,17 +303,21 @@ ## ItemAlign +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | -------- | ------------------------------------------------------------ | -| Auto | The default configuration in the flex container is used. | -| Start | The elements are in the flex container, top-aligned in the cross-axis direction. | -| Center | The elements are in the flex container, centered in the cross-axis direction. | -| End | The elements are in the flex container, bottom-aligned in the cross-axis direction. | -| Stretch | The elements are in the flex container, stretched and padded in the cross-axis direction. If the size is not set, the elements are stretched to the container size.| -| Baseline | The elements are in the flex container, text baseline aligned in the cross-axis direction. | +| Auto | The default configuration of the flex container is used. | +| Start | The items in the flex container are aligned with the cross-start edge. | +| Center | The items in the flex container are centered along the cross axis. | +| End | The items in the flex container are aligned with the cross-end edge. | +| Stretch | The items in the flex container are stretched and padded along the cross axis. If the flex container has the **Wrap** attribute set to **FlexWrap.Wrap** or **FlexWrap.WrapReverse**, the items are stretched to the cross size of the widest element on the current row or column. In other cases, the items with no size set are stretched to the container size.| +| Baseline | The items in the flex container are aligned in such a manner that their text baselines are aligned along the cross axis. | ## FlexDirection +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ------------- | ------------------------------ | | Row | The child components are arranged in the same direction as the main axis runs along the rows.| @@ -273,6 +327,8 @@ ## FlexWrap +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ----------- | ------------------------------------------------- | | NoWrap | The child components in the flex container are arranged in a single line, and they cannot overflow. | @@ -281,6 +337,8 @@ ## VerticalAlign +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ------ | ------------------------ | | Top | Top aligned. | @@ -289,6 +347,8 @@ ## ImageRepeat +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | -------- | -------------------------- | | X | The image is repeatedly drawn only along the horizontal axis.| @@ -298,6 +358,8 @@ ## ImageSize +Since API version 9, this API is supported in ArkTS widgets. + | Type | Description | | ------- | ------------------------------------------------------------ | | Cover | Default value. The image is scaled with its aspect ratio retained for both sides to be greater than or equal to the display boundaries.| @@ -306,6 +368,8 @@ ## GradientDirection +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ----------- | ---------- | | Left | The gradient direction is from right to left.| @@ -320,6 +384,8 @@ ## SharedTransitionEffectType +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ----------- | ---------- | | Static | The element position remains unchanged on the target page, and transition opacity can be configured. Currently, this effect is only valid in redirecting to the target page.| @@ -327,6 +393,8 @@ ## FontStyle +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ------ | ---------------- | | Normal | Standard font style.| @@ -334,6 +402,8 @@ ## FontWeight +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ------- | -------------- | | Lighter | The font weight is lighter. | @@ -345,22 +415,30 @@ ## TextAlign -| Name | Description | -| ------ | -------------- | -| Start | Aligned with the start.| -| Center | Horizontally centered.| -| End | Aligned with the end.| +Since API version 9, this API is supported in ArkTS widgets. + +| Name | Description | +| --------------------- | -------------- | +| Start | Aligned with the start.| +| Center | Horizontally centered.| +| End | Aligned with the end.| +| Justify10+ | Aligned with both margins. | ## TextOverflow -| Name | Description | -| -------- | -------------------------------------- | -| Clip | Extra-long text is clipped. | -| Ellipsis | An ellipsis (...) is used to represent clipped text.| -| None | No clipping or ellipsis is used for extra-long text. | +Since API version 9, this API is supported in ArkTS widgets. + +| Name | Description | +| --------------------- | -------------------------------------- | +| None | No clipping or ellipsis is used for text overflow. | +| Clip | Extra-long text is clipped. | +| Ellipsis | An ellipsis (...) is used to represent text overflow.| +| Marquee10+ | Text continuously scrolls when text overflow occurs. | ## TextDecorationType +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ----------- | ------------------ | | Underline | Line under the text. | @@ -370,6 +448,8 @@ ## TextCase +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | --------- | -------------------- | | Normal | The original case of the text is retained.| @@ -378,6 +458,8 @@ ## ResponseType8+ +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ---------- | -------------------------- | | LongPress | The menu is displayed when the component is long-pressed. | @@ -385,6 +467,8 @@ ## HoverEffect8+ +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | --------- | ---------------------------- | | Auto | Default hover effect.| @@ -394,6 +478,8 @@ ## Placement8+ +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ------------- | ------------------------------------------------------------ | | Left | The popup is on the left of the component, vertically aligned with the component on the left. | @@ -411,6 +497,8 @@ ## CopyOptions9+ +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ----------- | -------------------- | | None | Copy is not allowed. | @@ -419,9 +507,48 @@ ## HitTestMode9+ +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ----------- | -------------------- | | Default | Both the node and its child node respond to the hit test of a touch event, but its sibling node is blocked from the hit test. | | Block | The node responds to the hit test of a touch event, but its child node and sibling node are blocked from the hit test. | | Transparent | Both the node and its child node respond to the hit test of a touch event, and its sibling node is also considered during the hit test.| | None | The node does not respond to the hit test of a touch event, but its child node and sibling node are considered during the hit test.| + +## BlurStyle9+ + +This API is supported in ArkTS widgets. + +| Name| Description| +| ------- | ---------- | +| Thin | Thin material. | +| Regular | Regular material. | +| Thick | Thick material. | +| BackgroundThin | Material that creates the minimum depth of field effect.| +| BackgroundRegular | Material that creates a medium shallow depth of field effect.| +| BackgroundThick | Material that creates a high shallow depth of field effect.| +| BackgroundUltraThick | Material that creates the maximum depth of field effect.| + +## ThemeColorMode10+ + +| Name | Description | +| ------- | ---------- | +| System | Following the system color mode.| +| Light | Light color mode.| +| Dark | Dark color mode.| + +## AdaptiveColor10+ + +| Name | Description | +| ------- | ----------- | +| Default | Adaptive color mode is not used. The default color is used as the mask color.| +| Average | Adaptive color mode is used. The average color value of the color picking area is used as the mask color.| + +## TextHeightAdaptivePolicy10+ + +| Name | Description | +| ----------------------- | ------------------------------------------------ | +| MAX_LINES_FIRST | Prioritize the **maxLines** settings. | +| MIN_FONT_SIZE_FIRST | Prioritize the **minFontSize** settings. | +| LAYOUT_CONSTRAINT_FIRST | Prioritize the layout constraint settings in terms of height.| diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-blank.md b/en/application-dev/reference/arkui-ts/ts-basic-components-blank.md index c624d6b2c04cf07d34927f0e7c02ed9668136bbb..7a046d68f40f64d8dbb085c3c51d6451c3550290 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-blank.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-blank.md @@ -16,6 +16,8 @@ Not supported Blank(min?: number | string) +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name| Type| Mandatory| Description| @@ -28,7 +30,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name| Type| Description| | -------- | -------- | -------- | -| color | [ResourceColor](ts-types.md#resourcecolor) | Color to fill the empty spaces.| +| color | [ResourceColor](ts-types.md#resourcecolor) | Color to fill the empty spaces.
Since API version 9, this API is supported in ArkTS widgets.| ## Example @@ -88,6 +90,6 @@ struct BlankExample { } } ``` -If the width of the parent container is not set, set **min** to specify the minimum width of the **\** component. +If the width of the parent container is not set, set **min** to specify the minimum width of the **\** component. ![blankmin](figures/blankmin.png) diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-button.md b/en/application-dev/reference/arkui-ts/ts-basic-components-button.md index c135dc560cff44bde103d3f7808705124938520d..7339314e264130287248efd6e5e5a2e696a726e7 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-button.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-button.md @@ -16,6 +16,8 @@ This component can contain only one child component. **API 1:** Button(options?: {type?: ButtonType, stateEffect?: boolean}) +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name | Type | Mandatory | Description | @@ -23,10 +25,11 @@ This component can contain only one child component. | type | ButtonType | No | Button type.
Default value: **ButtonType.Capsule** | | stateEffect | boolean | No | Whether to enable the pressed effect on the click of the button. The value **false** means to disable the pressed effect.
Default value: **true**| - **API 2:** Button(label?: ResourceStr, options?: { type?: ButtonType, stateEffect?: boolean }) - Creates a button component based on text content. In this case, the component cannot contain child components. +Creates a button component based on text content. In this case, the component cannot contain child components. + +Since API version 9, this API is supported in ArkTS widgets. **Parameters** @@ -40,10 +43,14 @@ This component can contain only one child component. | Name | Type | Description | | ----------- | ----------- | --------------------------------- | -| type | ButtonType | Button type.
Default value: **ButtonType.Capsule** | -| stateEffect | boolean | Whether to enable the pressed effect on the click of the button. The value **false** means to disable the pressed effect.
Default value: **true**| +| type | ButtonType | Button type.
Default value: **ButtonType.Capsule**
Since API version 9, this API is supported in ArkTS widgets.| +| stateEffect | boolean | Whether to enable the pressed effect on the click of the button. The value **false** means to disable the pressed effect.
Default value: **true**
Since API version 9, this API is supported in ArkTS widgets.| +| labelStyle10+ | [LabelStyle](#labelstyle10) | Label style of the button.| + +## ButtonType + +Since API version 9, this API is supported in ArkTS widgets. -## ButtonType enums | Name | Description | | ------- | ------------------ | | Capsule | Capsule-type button (the round corner is half of the height by default).| @@ -51,11 +58,22 @@ This component can contain only one child component. | Normal | Normal button (without rounded corners by default). | > **NOTE** -> - The rounded corner of a button is set by using [borderRadius](ts-universal-attributes-border.md), rather than by using the **border** API. Only a button-wide rounded corner setting is supported. -> - For a button of the **Capsule** type, the **borderRadius** settings do not take effect, and its rounded corner is always half of the button height. +> - The rounded corner of a button is set by using [borderRadius](ts-universal-attributes-border.md), rather than by using the **border** API. Only a rounded corner whose parameter is [Length](ts-types.md#length) is supported. +> - For a button of the **Capsule** type, the **borderRadius** settings do not take effect, and the radius of its rounded corner is always half of the button height or width, whichever is smaller. > - For a button of the **Circle** type, its radius is the value of **borderRadius** (if set) or the width or height (whichever is smaller). > - The button text is set using the [text style attributes](ts-universal-attributes-text-style.md). - +> - Before setting the [gradient color](ts-universal-attributes-gradient-color.md), you need to set [backgroundColor](ts-universal-attributes-background.md) to transparent. + +## LabelStyle10+ + +| Name | Type | Mandatory| Description | +| -------------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| overflow | [TextOverflow](ts-appendix-enums.md#textoverflow) | No | Display mode when the label text is too long. Text is clipped at the transition between words. To clip text in the middle of a word, add **\u200B** between characters.| +| maxLines | number | No | Maximum number of lines in the label text. By default, text is automatically folded. If this attribute is specified, the text will not exceed the specified number of lines. If there is extra text, you can use **textOverflow** to specify how it is displayed.| +| minFontSize | number \| [ResourceStr](ts-types.md#resourcestr) | No | Minimum font size of the label text. For the setting to take effect, this attribute must be used together with **maxFontSize**, **maxLines**, or layout constraint settings.| +| maxFontSize | number \| [ResourceStr](ts-types.md#resourcestr) | No | Maximum font size of the label text. For the setting to take effect, this attribute must be used together with **minFontSize**, **maxLines**, or layout constraint settings.| +| heightAdaptivePolicy | [TextHeightAdaptivePolicy](ts-appendix-enums.md#textheightadaptivepolicy10) | No | How the adaptive height is determined for the label text. | +| font | [Font](ts-types.md#Font) | No | Font of the label text. | ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-checkbox.md b/en/application-dev/reference/arkui-ts/ts-basic-components-checkbox.md index 95fa03d4b2f7f94a02c450e37fca071a8db47d11..b2ab19b168a0415f8ddd82cee4a41faa3282848d 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-checkbox.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-checkbox.md @@ -14,12 +14,14 @@ Not supported Checkbox(options?: {name?: string, group?: string }) +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name | Type| Mandatory | Description| | --------| --------| ------ | -------- | | name | string | No| Name of the check box.| -| group | string | No| Group name of the check box.| +| group | string | No| Group name of the check box.
**NOTE**
If not used with the **\** component, this parameter is invalid.| ## Attributes @@ -28,16 +30,26 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name | Type| Description| | ------------- | ------- | -------- | -| select | boolean | Whether the check box is selected.
Default value: **false**| -| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the check box when it is selected.| +| select | boolean | Whether the check box is selected.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.| +| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the check box when it is selected.
Since API version 9, this API is supported in ArkTS widgets.| +| unselectedColor10+ | [ResourceColor](ts-types.md#resourcecolor) | Border color of the check box when it is not selected.| +| mark10+ | [MarkStyle](#markstyle10) | Internal icon style of the check box.| ## Events In addition to the [universal events](ts-universal-events-click.md), the following attributes are supported. -| Name | Description| -| ----------| -------- | -|onChange(callback: (value: boolean) => void) | Triggered when the selected status of the check box changes due to a manual operation.
- The value **true** means that the check box is selected.
- The value **false** means that the check box is not selected. | +| Name | Description | +| -------------------------------------------- | ------------------------------------------------------------ | +| onChange(callback: (value: boolean) => void) | Triggered when the selected status of the check box changes due to a manual operation.
- The value **true** means that the check box is selected.
- The value **false** means that the check box is not selected.
Since API version 9, this API is supported in ArkTS widgets.| + +## MarkStyle10+ + +| Name | Type | Mandatory| Default Value | Description | +| ----------- | ------------------------------------------ | ---- | ----------- | ------------------------------------------------------------ | +| strokeColor | [ResourceColor](ts-types.md#resourcecolor) | No | Color.White | Color of the internal mark. | +| size | number \| string | No | - | Size of the internal mark, in vp. The default size is the same as the width of the check box.
This parameter cannot be set in percentage. If it is set to an invalid value, the default value is used.| +| strokeWidth | number \| string | No | 2 | Stroke width of the internal mark, in vp. This parameter cannot be set in percentage. If it is set to an invalid value, the default value is used.| ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-checkboxgroup.md b/en/application-dev/reference/arkui-ts/ts-basic-components-checkboxgroup.md index 64b116778047e73a49f79c4b4d859cab089fb6b4..d6beb514c6590f6b4f977b37052d78f180ff8f51 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-checkboxgroup.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-checkboxgroup.md @@ -14,11 +14,11 @@ Not supported CheckboxGroup(options?: { group?: string }) -Creates a check box group so that you can select or deselect all check boxes in the group at the same time. Check boxes and the check box group that share the group name belong to the same group. - -**Parameters** +Creates a check box group so that you can select or deselect all check boxes in the group at the same time. Check boxes and the check box group that share a group name belong to the same group. +Since API version 9, this API is supported in ArkTS widgets. +**Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | @@ -30,8 +30,10 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name| Type| Description| | -------- | -------- | -------- | -| selectAll | boolean | Whether to select all.
Default value: **false**
If **select** is explicitly set for check boxes in the group, the check box settings are prioritized.| -| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the selected check box.| +| selectAll | boolean | Whether to select all.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
If the **select** attribute is set for a [\](ts-basic-components-checkbox.md) component in the same group, the setting of the **\** has a higher priority.| +| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the selected check box.
Since API version 9, this API is supported in ArkTS widgets.| +| unselectedColor10+ | [ResourceColor](ts-types.md#resourcecolor) | Border color of the check box when it is not selected.| +| mark10+ | [MarkStyle](#markstyle10) | Internal icon style of the check box.| ## Events @@ -39,9 +41,12 @@ In addition to the [universal events](ts-universal-events-click.md), the followi | Name| Description| | -------- | -------- | -| onChange (callback: (event: [CheckboxGroupResult](#checkboxgroupresult)) => void ) |Triggered when the selected status of the check box group or any check box wherein changes due to a manual operation.| +| onChange (callback: (event: [CheckboxGroupResult](#checkboxgroupresult)) => void ) |Triggered when the selected status of the check box group or any check box wherein changes due to a manual operation.
Since API version 9, this API is supported in ArkTS widgets.| ## CheckboxGroupResult + +Since API version 9, this API is supported in ArkTS widgets. + | Name | Type | Description | | ------ | ------ | ------- | | name | Array<string> | Names of all the selected check boxes in the group.| @@ -49,12 +54,21 @@ In addition to the [universal events](ts-universal-events-click.md), the followi ## SelectStatus +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description| | ----- | -------------------- | | All | All check boxes in the group are selected.| | Part | Some check boxes in the group are selected.| | None | None of the check boxes in the group are selected.| +## MarkStyle10+ + +| Name | Type | Mandatory| Default Value | Description | +| ----------- | ------------------------------------------ | ---- | ----------- | ------------------------------------------------------------ | +| strokeColor | [ResourceColor](ts-types.md#resourcecolor) | No | Color.White | Color of the internal mark. | +| size | number \| string | No | - | Size of the internal mark, in vp. The default size is the same as the width of the check box group component.
This parameter cannot be set in percentage. If it is set to an invalid value, the default value is used.| +| strokeWidth | number \| string | No | 2 | Stroke width of the internal mark, in vp. This parameter cannot be set in percentage. If it is set to an invalid value, the default value is used.| ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md b/en/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md index a661b6abc36a1820fbcd634178d5cf2654911336..41db34a3c7167bc08af84c54586af4981a265efc 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md @@ -18,22 +18,71 @@ Not supported DataPanel(options:{values: number[], max?: number, type?: DataPanelType}) +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name | Type | Mandatory | Description| | ----------------- | -------- | ----- | -------- | -| values | number[] | Yes | Data value list. A maximum of nine values are supported. If more than nine values are set, only the first nine ones are used. If the value is less than 0, the value 0 is used.| +| values | number[] | Yes | Data value list. A maximum of nine values are supported. If more than nine values are set, only the first nine ones are used. A value less than 0 evaluates to the value **0**. | | max | number | No | - When set to a value greater than 0, this parameter indicates the maximum value in the **values** list.
- When set to a value equal to or smaller than 0, this parameter indicates the sum of values in the **values** list. The values are displayed in proportion.
Default value: **100**| | type8+ | [DataPanelType](#datapaneltype) | No| Type of the data panel (dynamic modification is not supported).
Default value: **DataPanelType.Circle**| ## DataPanelType + +Since API version 9, this API is supported in ArkTS widgets. + | Name| Description| | -------| ------------ | | Line | Line data panel.| | Circle | Circle data panel.| +## Attributes + +In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported. + + +| Name | Type| Mandatory| Description| +| ------------- | ------- | ---- | -------- | +| closeEffect | boolean | Yes| Whether to disable the rotation effect for the component.
Default value: **false**.| +| valueColors10+ | Array<[ResourceColor](ts-types.md#resourcecolor) \| [LinearGradient](#lineargradient10)> | Yes| Array of data segment colors. A value of the **ResourceColor** type indicates a solid color, and A value of the **LinearGradient** type indicates a color gradient.| +| trackBackgroundColor10+ | [ResourceColor](ts-types.md#resourcecolor) | Yes| Background color.| +| strokeWidth10+ | [Length](ts-types.md#Length) | Yes| Stroke width of the border.| +| trackShadow10+ | [DataPanelShadowOption](#datapanelshadowoption10) | Yes| Shadow style. If this attribute is not set, the shadow effect is disabled.| + + +## DataPanelShadowOption10+ +| Name | Type| Mandatory| Description| +| ------------- | ------- | ---- | -------- | +| radius | number \| [Resource](ts-types.md#resource)| No| Shadow blur radius.
Default value: **5vp**| +| colors | Array<[ResourceColor](ts-types.md#resourcecolor) \| [LinearGradient](#lineargradient10)> | No| Array of shadow colors for data segments.
Default value: same as the value of **valueColors**.| +| offsetX | number \| [Resource](ts-types.md#resource)| No| Offset on the x-axis.
Default value: **5vp**| +| offsetY | number \| [Resource](ts-types.md#resource)| No| Offset on the y-axis.
Default value: **5vp**| + +## LinearGradient10+ + +Describes the linear gradient. + +LinearGradient(colorStops: ColorStop[]) + +| Name | Type| Mandatory| Description| +| ------------- | ------- | ---- | -------- | +| colorStops | [ColorStop](#colorstop10)[] | Yes| Gradient colors and color stops.| + + +## ColorStop10+ + +Describes the gradient color stop. + +| Name | Type| Mandatory| Description| +| ------------- | ------- | ---- | -------- | +| color | [ResourceColor](ts-types.md#resourcecolor) | Yes| Color value.| +| offset | [Length](ts-types.md#Length) | Yes| Gradient color stop (proportion value between 0 and 1).| + + + ## Example ```ts diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-datepicker.md b/en/application-dev/reference/arkui-ts/ts-basic-components-datepicker.md index 5ba70754a095b5cc00d3f317e62b9a9b7cb6471d..1b4f2c165ed231af18e4ad15a9588247fd60d161 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-datepicker.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-datepicker.md @@ -4,7 +4,7 @@ The **\** component allows users to select a date from the given ran > **NOTE** > -> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. +> This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. ## Child Components @@ -20,33 +20,45 @@ Creates a date picker in the given date range. **Parameters** -| Name| Type| Mandatory | Description| -| -------- | -------- | ------------- | -------- | -| start | Date | No | Start date of the picker.
Default value: **Date('1970-1-1')**| -| end | Date | No | End date of the picker.
Default value: **Date('2100-12-31')**| -| selected | Date | No | Date of the selected item.
Default value: current system date | - +| Name | Type| Mandatory | Description | +| -------- | ---- | ---- | -------------------------------------- | +| start | Date | No | Start date of the picker.
Default value: **Date('1970-1-1')** | +| end | Date | No | End date of the picker.
Default value: **Date('2100-12-31')**| +| selected | Date | No | Date of the selected item.
Default value: current system date | ## Attributes -| Name | Type | Description | -| ------| -------------- | -------- | -| lunar | boolean | Whether to display the lunar calendar.
- **true**: Display the lunar calendar.
- **false**: Do not display the lunar calendar.
Default value: **false**| +In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported. + +| Name | Type | Description | +| -------------------------------- | ---------------------------------------- | ---------------------------------------- | +| lunar | boolean | Whether to display the lunar calendar.
- **true**: Display the lunar calendar.
- **false**: Do not display the lunar calendar.
Default value: **false**| +| disappearTextStyle10+ | [PickerTextStyle](#pickertextstyle10) | Font color, font size, and font width for the top and bottom items. | +| textStyle10+ | [PickerTextStyle](#pickertextstyle10) | Font color, font size, and font width of all items except the top, bottom, and selected items. | +| selectedTextStyle10+ | [PickerTextStyle](#pickertextstyle10) | Font color, font size, and font width of the selected item. | +## PickerTextStyle10+ + +| Name | Type | Mandatory | Description | +| ----- | ---------------------------------------- | ---- | ------------------------- | +| color | [ResourceColor](ts-types.md#resourcecolor) | No | Font color. | +| font | [Font](ts-types.md#font) | No | Text style. Only the font size and font width are supported.| ## Events -| Name| Description| -| -------- | -------- | +In addition to the [universal events](ts-universal-events-click.md), the following events are supported. + +| Name | Description | +| ---------------------------------------- | ----------- | | onChange(callback: (value: DatePickerResult) => void) | Triggered when a date is selected.| ## DatePickerResult -| Name| Type| Description| -| -------- | -------- | -------- | -| year | number | Year of the selected date.| +| Name | Type | Description | +| ----- | ------ | --------------------------- | +| year | number | Year of the selected date. | | month | number | Month of the selected date. The value ranges from 0 to 11. The value **0** indicates January, and **11** indicates December.| -| day | number | Day of the selected date.| +| day | number | Day of the selected date. | ## Example @@ -63,7 +75,7 @@ struct DatePickerExample { build() { Column() { Button('Switch Calendar') - .margin({ top: 30 }) + .margin({ top: 30, bottom: 30 }) .onClick(() => { this.isLunar = !this.isLunar }) diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-divider.md b/en/application-dev/reference/arkui-ts/ts-basic-components-divider.md index e49501637b426dddbc21258651ba5ae556544d3d..3555f55586004554735bbf5cf4c4aa582e25e925 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-divider.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-divider.md @@ -16,21 +16,18 @@ Not supported Divider() +Since API version 9, this API is supported in ArkTS widgets. + ## Attributes In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported. | Name | Type | Description | | ----------- | ---------- | ------------------ | -| vertical | boolean | Whether a vertical divider is used. **false**: A horizontal divider is used.
**true**: A vertical divider is used.
Default value: **false**| -| color | [ResourceColor](ts-types.md#resourcecolor) | Color of the divider.| -| strokeWidth | number \| string | Width of the divider.
Default value: **1**| -| lineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | Cap style of the divider.
Default value: **LineCapStyle.Butt**| - - -## Events - -The universal events are not supported. +| vertical | boolean | Whether a vertical divider is used. **false**: A horizontal divider is used.
**true**: A vertical divider is used.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.| +| color | [ResourceColor](ts-types.md#resourcecolor) | Color of the divider.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeWidth | number \| string | Width of the divider.
Default value: **1**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
This attribute cannot be set to a percentage.| +| lineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | Cap style of the divider.
Default value: **LineCapStyle.Butt**
Since API version 9, this API is supported in ArkTS widgets.| ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-formcomponent.md b/en/application-dev/reference/arkui-ts/ts-basic-components-formcomponent.md index e641340a69dad32e2db89c55ba2d44911d3258b7..85870111712e90def229a040901f9ba0d41bbcf2 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-formcomponent.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-formcomponent.md @@ -6,7 +6,7 @@ The **FormComponent** is used to display widgets. > > - This component is supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. > -> - This component is intended for the widget host. For details about the widget provider, see [JS Service Widget UI Components](../js-service-widget-ui/Readme-EN.md). +> - This component is intended for the widget host. For details about the widget provider, see [JS Service Widget UI Components](../js-service-widget-ui/js-service-widget-file.md). > > - To use this component, you must have the system signature. @@ -42,7 +42,7 @@ Creates a **FormComponent** instance to display the provided widget. | Name | Type | Mandatory| Description | | --------- | ------------------------------- | ---- | ----------------------------------------------------------------------- | -| id | number | Yes | Widget ID. Set this parameter to **0** for a new widget. | +| id | number | Yes | Widget ID. Set this parameter to **0** for a new widget. | | name | string | Yes | Widget name. | | bundle | string | Yes | Bundle name of the widget. | | ability | string | Yes | Ability name of the widget. | @@ -63,7 +63,7 @@ Creates a **FormComponent** instance to display the provided widget. ## Attributes | Name | Type | Mandatory| Description | | ----------- | ----------------------------------------------------------------------------------------------------- | ---- | ----------------------------------------------------------------------- | -| size | {
width?: [Length](ts-types.md#length),
height?: [Length](ts-types.md#length)
} | Yes | Size of the widget. | +| size | {
width?: [Length](ts-types.md#length),
height?: [Length](ts-types.md#length)
} | Yes | Size of the widget. | | moduleName | string | Yes | Module name of the widget. | | dimension | [FormDimension](#formdimension) | No | Dimensions of the widget. The widgets in the 2 x 2, 4 x 4, and 4 x 2 dimensions are supported.
Default value: **Dimension_2_2**| | allowUpdate | boolean | No | Whether to allow the widget to update.
Default value: **true** | @@ -75,10 +75,10 @@ Creates a **FormComponent** instance to display the provided widget. | Name | Description | | ------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------- | -| onAcquired(callback: (info: { id: number }) => void) | Triggered when a widget is obtained. This API returns the ID of the obtained widget. | -| onError(callback: (info: { errcode: number, msg: string }) => void) | Triggered when an error occurs during component loading.
**errcode**: error code.
**msg**: error information. | -| onRouter(callback: (info: any) => void) | Triggered when routing occurs for the widget. This API returns information in [routerEvent](../js-service-widget-ui/js-service-widget-syntax-hml.md#event-binding).| -| onUninstall(callback: (info: { id: number }) => void) | Triggered when a widget is uninstalled. This API returns the ID of the uninstalled widget. | +| onAcquired(callback: (info: { id: number }) => void) | Triggered when a widget is obtained. This API returns the ID of the obtained widget. | +| onError(callback: (info: { errcode: number, msg: string }) => void) | Triggered when an error occurs during component loading.
**errcode**: error code.
**msg**: error information. | +| onRouter(callback: (info: any) => void) | Triggered when routing occurs for the widget. This API returns information in [routerEvent](../js-service-widget-ui/js-service-widget-syntax-hml.md#event-binding).| +| onUninstall(callback: (info: { id: number }) => void) | Triggered when a widget is uninstalled. This API returns the ID of the uninstalled widget. | ## Example @@ -108,7 +108,7 @@ struct CardExample { .visibility(Visibility.Visible) .onAcquired((form)=>{ console.log(`form info : ${JSON.stringify(form)}`); - this.fomId = form.id; + this.formId = form.id; }) .onError((err)=>{ console.log(`fail to add form, err: ${JSON.stringify(err)}`); diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-gauge.md b/en/application-dev/reference/arkui-ts/ts-basic-components-gauge.md index 5b4387a8c137fd14e9866238aef6785300f93918..2fe773177813164169dc35eddeba176a95fa4f89 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-gauge.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-gauge.md @@ -17,6 +17,8 @@ Not supported Gauge(options:{value: number, min?: number, max?: number}) +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name| Type| Mandatory| Description| @@ -31,16 +33,18 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name| Type| Description| | -------- | -------- | -------- | -| value | number | Value of the chart. It can be dynamically changed.
Default value: **0**| -| startAngle | number | Start angle of the chart. The value **0** indicates 0 degrees, and a positive value indicates the clockwise direction.
Default value: **0**| -| endAngle | number | End angle of the chart. The value **0** indicates 0 degrees, and a positive value indicates the clockwise direction.
Default value: **360**| -| colors | Array<[ColorStop](#colorstop)> | Colors of the chart. Colors can be set for individual segments.| -| strokeWidth | Length | Stroke width of the chart.| +| value | number | Value of the chart. It can be dynamically changed.
Default value: **0**
Since API version 9, this API is supported in ArkTS widgets.| +| startAngle | number | Start angle of the chart. The value **0** indicates 0 degrees, and a positive value indicates the clockwise direction.
Default value: **0**
Since API version 9, this API is supported in ArkTS widgets.| +| endAngle | number | End angle of the chart. The value **0** indicates 0 degrees, and a positive value indicates the clockwise direction.
Default value: **360**
Since API version 9, this API is supported in ArkTS widgets.| +| colors | Array<[ColorStop](#colorstop)> | Colors of the chart. Colors can be set for individual segments.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeWidth | Length | Stroke width of the chart.
Since API version 9, this API is supported in ArkTS widgets.| ## ColorStop Describes a gradient stop. +Since API version 9, this API is supported in ArkTS widgets. + | Name | Type | Description | | --------- | -------------------- | ------------------------------------------------------------ | | ColorStop | [[ResourceColor](ts-types.md#resourcecolor), number] | Type of the gradient stop. The first parameter indicates the color value. If it is set to a non-color value, the black color is used. The second parameter indicates the color weight. If it is set to a negative number or a non-numeric value, the color weight is 0, which means that the color is not displayed.| 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 e3fb8a003e68f5e54f3a48d4b9b8b15db5de3358..c14914b75ae50d9a2c78ee01514261e60aecfcef 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 @@ -19,44 +19,49 @@ Not supported ## APIs -Image(src: string | PixelMap | Resource) +Image(src: PixelMap | ResourceStr | DrawableDescriptor) Obtains an image from the specified source for subsequent rendering and display. +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| src | string \| [PixelMap](../apis/js-apis-image.md#pixelmap7) \| [Resource](ts-types.md#resource) | Yes | Image source. Both local and online images are supported.
When using an image 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.
\- Strings with the **datashare://path** prefix are supported, which are used to access the image path provided by a data ability. Before loading images, the application must [request the required permissions](../../file-management/medialibrary-overview.md#requesting-permissions).
\- Strings with the **file:///data/storage** prefix are supported, which are used to read image resources in the **files** folder in the installation directory of the application. Ensure that the files in the directory package path have the read permission.| +| Name | Type | Mandatory | Description | +| ---- | ---------------------------------------- | ---- | ---------------------------------------- | +| src | [PixelMap](../apis/js-apis-image.md#pixelmap7) \|ResourceStr\| [DrawableDescriptor](../apis/js-apis-arkui-drawableDescriptor.md#drawabledescriptor) | Yes | Image source. Both local and online images are supported.
When using an image 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.
\- Strings with the **datashare://** path prefix are supported, which are used to access the image path provided by a Data ability.
\- Strings with the **file:///data/storage** prefix are supported, which are used to read image resources in the **files** folder in the installation directory of the application. Ensure that the application has the read permission to the files in the specified path.
\- [DrawableDescriptor](../apis/js-apis-arkui-drawableDescriptor.md#drawabledescriptor) objects are supported.
**NOTE**
- ArkTS widgets support GIF images, but the images are played only once when they are displayed.
- ArkTS widgets do not support the **http://**, **datashare://**, or **file://data/storage** path prefixes.
- ArkTS widgets do not support the [PixelMap](../apis/js-apis-image.md#pixelmap7) type.| ## Attributes In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported. -| Name | Type | Description | -| --------------------- | ------------------------------------------------------- | ------------------------------------------------------------ | -| alt | string \| [Resource](ts-types.md#resource)| Placeholder image displayed during loading. Local images are supported. | -| objectFit | [ImageFit](ts-appendix-enums.md#imagefit) | Image scale mode.
Default value: **ImageFit.Cover** | -| objectRepeat | [ImageRepeat](ts-appendix-enums.md#imagerepeat) | Whether the image is repeated.
Default value: **ImageRepeat.NoRepeat**
**NOTE**
This attribute is not applicable to SVG images.| -| interpolation | [ImageInterpolation](#imageinterpolation) | Interpolation effect of the image. This attribute is intended to alleviate aliasing that occurs when a low-definition image is zoomed in.
Default value: **ImageInterpolation.None**
**NOTE**
This attribute is not applicable to SVG images.
This attribute is not applicable to **PixelMap** objects.| -| renderMode | [ImageRenderMode](#imagerendermode) | Rendering mode of the image.
Default value: **ImageRenderMode.Original**
**NOTE**
This attribute is not applicable to SVG images.| -| sourceSize | {
width: number,
height: number
} | Size of the decoded image. The original image is decoded into a **pixelMap** of the specified size, in px.
**NOTE**
This attribute is not applicable to **PixelMap** objects.| -| matchTextDirection | boolean | Whether to display the image in the system language direction. When this parameter is set to true, the image is horizontally flipped in the right-to-left (RTL) language context.
Default value: **false** | -| fitOriginalSize | boolean | Whether to fit the component to the original size of the image source when the component size is not set.
Default value: **false** | -| fillColor | [ResourceColor](ts-types.md#resourcecolor) | Fill color. This attribute only applies to an SVG image. Once set, the fill color will replace that of the SVG image.| -| autoResize | boolean | Whether to resize the image source used for drawing based on the size of the display area during image decoding. This resizing can help reduce the memory usage.
Default value: **true**| -| syncLoad8+ | boolean | Whether to load the image synchronously. By default, the image is loaded asynchronously. During synchronous loading, the UI thread is blocked and the placeholder diagram is not displayed.
Default value: **false**| -| copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether the image can be copied. (SVG images cannot be copied.)
When **copyOption** is set to a value other than **CopyOptions.None**, the image can be copied in various manners, such as long pressing, right-clicking, or pressing Ctrl+C.
Default value: **CopyOptions.None**| -| colorFilter9+ | [ColorFilter](ts-types.md#colorfilter9) | Color filter of the image.| -| draggable9+ | boolean | Whether the image is draggable. This attribute cannot be used together with the [onDragStart](ts-universal-events-drag-drop.md) event.
Default value: **false**| +| Name | Type | Description | +| ------------------------ | ---------------------------------------- | ---------------------------------------- | +| alt | string \| [Resource](ts-types.md#resource)| Placeholder image displayed during loading. Local images are supported.
Since API version 9, this API is supported in ArkTS widgets.| +| objectFit | [ImageFit](ts-appendix-enums.md#imagefit) | Image scale mode.
Default value: **ImageFit.Cover**
Since API version 9, this API is supported in ArkTS widgets.| +| objectRepeat | [ImageRepeat](ts-appendix-enums.md#imagerepeat) | Whether the image is repeated.
Default value: **ImageRepeat.NoRepeat**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
This attribute is not applicable to SVG images.| +| interpolation | [ImageInterpolation](#imageinterpolation) | Interpolation effect of the image. This attribute is intended to alleviate aliasing that occurs when a low-definition image is zoomed in.
Default value: **ImageInterpolation.None**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
This attribute is not applicable to SVG images.
This attribute is not applicable to **PixelMap** objects.| +| renderMode | [ImageRenderMode](#imagerendermode) | Rendering mode of the image.
Default value: **ImageRenderMode.Original**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
This attribute is not applicable to SVG images.| +| sourceSize | {
width: number,
height: number
} | Size of the decoded image. The original image is decoded into a **pixelMap** of the specified size, in px.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
This attribute is not applicable to **PixelMap** objects or SVG images.| +| matchTextDirection | boolean | Whether to display the image in the system language direction. When this parameter is set to true, the image is horizontally flipped in the right-to-left (RTL) language context.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.| +| fitOriginalSize | boolean | Whether to fit the component to the original size of the image source when the component size is not set.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.| +| fillColor | [ResourceColor](ts-types.md#resourcecolor) | Fill color. This attribute only applies to an SVG image. Once set, the fill color will replace that of the SVG image.
Since API version 9, this API is supported in ArkTS widgets.| +| autoResize | boolean | Whether to resize the image source used for drawing based on the size of the display area during image decoding. This resizing can help reduce the memory usage.
Default value: **true**
Since API version 9, this API is supported in ArkTS widgets.| +| syncLoad8+ | boolean | Whether to load the image synchronously. By default, the image is loaded asynchronously. During synchronous loading, the UI thread is blocked and the placeholder diagram is not displayed.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.| +| copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether the image can be copied. (SVG images cannot be copied.)
When **copyOption** is set to a value other than **CopyOptions.None**, the image can be copied in various manners, such as long pressing, right-clicking, or pressing Ctrl+C.
Default value: **CopyOptions.None**
This API is supported in ArkTS widgets.| +| colorFilter9+ | [ColorFilter](ts-types.md#colorfilter9) | Color filter of the image.
This API is supported in ArkTS widgets. | +| draggable9+ | boolean | Whether the image is draggable. This attribute cannot be used together with the [onDragStart](ts-universal-events-drag-drop.md) event.
Default value: **false**
This API is supported in ArkTS widgets.| > **NOTE** > > To use shortcut keys to copy the image, the image must be in focus. To enable the image to gain focus, set both the **focusable** and **focusOnTouch** attributes to **true**. -> For SVG images, only the following tags are included in the supported list: **svg**, **rect**, **circle**, **ellipse**, **path**, **line**, **polyline**, **polygon**, **animate**, **animateMotion**, and **animateTransform**. +> +> For SVG images, only the following tags are included in the supported list: **svg**, **rect**, **circle**, **ellipse**, **path**, **line**, **polyline**, **polygon**, and **animate**. ### ImageInterpolation +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ------ | ------------------------- | | None | Interpolation image data is not used. | @@ -66,6 +71,8 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ### ImageRenderMode +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | -------- | --------------------- | | Original | The image is rendered based on the original image, including the color. | @@ -75,11 +82,11 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the 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 , message9+: string }) => 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(event: () => 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.| +| 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.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
The value **1** means that the image is successfully loaded, and **0** means the opposite.| +| onError(callback: (event?: { componentWidth: number, componentHeight: number , message9+: string }) => 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.
Since API version 9, this API is supported in ArkTS widgets.| +| onFinish(event: () => 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.
Since API version 9, this API is supported in ArkTS widgets.| ## Example @@ -100,21 +107,21 @@ struct ImageExample1 { Text('default').fontSize(16).fontColor(0xcccccc).height(30) Row({ space: 5 }) { Image($r('app.media.ic_png')) - .width(110).height(110).border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .width(110).height(110).border({ width: 1 }) .overlay('png', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) Image($r('app.media.ic_gif')) - .width(110).height(110).border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .width(110).height(110).border({ width: 1 }) .overlay('gif', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) Image($r('app.media.ic_svg')) - .width(110).height(110).border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .width(110).height(110).border({ width: 1 }) .overlay('svg', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) } Row({ space: 5 }) { Image($r('app.media.img_example')) - .width(110).height(110).border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .width(110).height(110).border({ width: 1 }) .overlay('jpg', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) Image(this.src) - .width(110).height(110).border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .width(110).height(110).border({ width: 1 }) .overlay('network', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) }.margin({ top: 25, bottom: 10 }) } @@ -123,25 +130,25 @@ struct ImageExample1 { Text('objectFit').fontSize(16).fontColor(0xcccccc).height(30) Row({ space: 5 }) { Image($r('app.media.img_example')) - .border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .border({ width: 1 }) .objectFit(ImageFit.None).width(110).height(110) .overlay('None', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) Image($r('app.media.img_example')) - .border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .border({ width: 1 }) .objectFit(ImageFit.Fill).width(110).height(110) .overlay('Fill', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) Image($r('app.media.img_example')) - .border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .border({ width: 1 }) .objectFit(ImageFit.Cover).width(110).height(110) .overlay('Cover', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) } Row({ space: 5 }) { Image($r('app.media.img_example_w250')) - .border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .border({ width: 1 }) .objectFit(ImageFit.Contain).width(110).height(110) .overlay('Contain', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) Image($r('app.media.img_example_w250')) - .border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .border({ width: 1 }) .objectFit(ImageFit.ScaleDown).width(110).height(110) .overlay('ScaleDown', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) }.margin({ top: 25 }) @@ -157,7 +164,7 @@ struct ImageExample1 { ### Loading Online Images -The default network timeout period is 5 minutes for loading online images. When using an online image, you are advised to use **alt** to configure the placeholder image displayed during loading. If more flexible network configuration is required, use the [HTTP](../../connectivity/http-request.md) module in the SDK to send a network request, and then decode the returned data into a `PixelMap` in the **\** component. For details about image development, see [Image Development](../../media/image.md). The code snippet is as follows: +The default network timeout period is 5 minutes for loading online images. When using an online image, you are advised to use **alt** to configure the placeholder image displayed during loading. If more flexible network configuration is required, you can use the [HTTP](../../connectivity/http-request.md) tool provided in the SDK to send a network request, and then decode the returned data into **PixelMap** objects in the **\** component. For details about image development, see [Image Processing](../../media/image-overview.md). The code snippet is as follows: ```tsx // @ts-nocheck @@ -234,18 +241,18 @@ struct ImageExample2 { Row({ space: 50 }) { Image($r('app.media.img_example')) .renderMode(ImageRenderMode.Original).width(100).height(100) - .border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .border({ width: 1 }) .overlay('Original', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) Image($r('app.media.img_example')) .renderMode(ImageRenderMode.Template).width(100).height(100) - .border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .border({ width: 1 }) .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) + .width(100).height(100).border({ width: 1 }) Text('sourceSize').fontSize(12).fontColor(0xcccccc).width('96%') Row({ space: 50 }) { @@ -255,7 +262,7 @@ struct ImageExample2 { height: 150 }) .objectFit(ImageFit.ScaleDown).width('25%').aspectRatio(1) - .border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .border({ width: 1 }) .overlay('w:150 h:150', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) Image($r('app.media.img_example')) .sourceSize({ @@ -263,22 +270,22 @@ struct ImageExample2 { height: 200 }) .objectFit(ImageFit.ScaleDown).width('25%').aspectRatio(1) - .border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .border({ width: 1 }) .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')) - .width(120).height(125).border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .width(120).height(125).border({ width: 1 }) .objectRepeat(ImageRepeat.XY).objectFit(ImageFit.ScaleDown) .overlay('ImageRepeat.XY', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) Image($r('app.media.ic_health_heart')) - .width(110).height(125).border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .width(110).height(125).border({ width: 1 }) .objectRepeat(ImageRepeat.Y).objectFit(ImageFit.ScaleDown) .overlay('ImageRepeat.Y', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) Image($r('app.media.ic_health_heart')) - .width(110).height(125).border({ width: 1 }).borderStyle(BorderStyle.Dashed) + .width(110).height(125).border({ width: 1 }) .objectRepeat(ImageRepeat.X).objectFit(ImageFit.ScaleDown) .overlay('ImageRepeat.X', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) } @@ -358,18 +365,14 @@ struct ImageExample3 { ```ts import fileio from '@ohos.fileio'; import fs from '@ohos.file.fs'; -import context from '@ohos.app.ability.context'; +import context from '@ohos.app.ability.common'; @Entry @Component struct LoadImageExample { @State resourcesPath: string = '' @State sandboxPath: string = '' - context: context.AbilityContext - - aboutToAppear() { - this.context = getContext(this) as context.AbilityContext - } + context: context.UIAbilityContext = getContext(this) as context.UIAbilityContext build() { Column() { @@ -396,6 +399,12 @@ struct LoadImageExample { Image(this.resourcesPath) .width(100) .height(100) + .colorFilter([ + 0.30, 0.59, 0.11, 0, 0, + 0.30, 0.59, 0.11, 0, 0, + 0.30, 0.59, 0.11, 0, 0, + 0, 0, 0, 1.0, 0 + ]) Text(`Sandbox image path: ${this.sandboxPath}`) .fontSize(20) .margin({ bottom: 10 }) @@ -407,3 +416,4 @@ struct LoadImageExample { } } ``` + \ No newline at end of file diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-loadingprogress.md b/en/application-dev/reference/arkui-ts/ts-basic-components-loadingprogress.md index 6a39e1c9f17f7a7150728509cdc5fdc32658189a..4381ad3257af51b69cb968af826f2359e3f30398 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-loadingprogress.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-loadingprogress.md @@ -18,11 +18,13 @@ LoadingProgress() Creates a **\** component. +Since API version 9, this API is supported in ArkTS widgets. + ## Attributes | Name| Type| Description| | -------- | -------- | -------- | -| color | [ResourceColor](ts-types.md#resourcecolor) | Foreground color of the **\** component.| +| color | [ResourceColor](ts-types.md#resourcecolor) | Foreground color of the **\** component.
Since API version 9, this API is supported in ArkTS widgets.| ## Example 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 9d905a65b1736315055c4b4582a5fa7cf5e8d00e..a6c0b032ca3d1234898704a15d87358800f737e7 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 @@ -17,29 +17,31 @@ Not supported Marquee(value: { start: boolean, step?: number, loop?: number, fromStart?: boolean, src: string }) +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | start | boolean | Yes| Whether to start scrolling.| | step | number | No| Scrolling step.
Default value: **6**, in vp| -| loop | number | No| Number of times the marquee will scroll. If the value is less than or equal to **0**, the marquee will scroll continuously.
Default value: **-1**| +| loop | number | No| Number of times the marquee will scroll. If the value is less than or equal to **0**, the marquee will scroll continuously.
Default value: **-1**
**NOTE**
Regardless of the value, the marquee scrolls only once on an ArkTS widget.| | fromStart | boolean | No| Whether the text scrolls from the start.
Default value: **true**| | src | string | Yes| Text to scroll.| ## Attributes -| Name | Type| Description | -| ---------- | -------- | ------------------------------------ | -| allowScale | boolean | Whether to allow text to scale.
Default value: **false**| +| Name | Type| Description | +| ---------- | -------- | ------------------------------------------------------------ | +| allowScale | boolean | Whether to allow text to scale.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.| ## Events | Name| Description| | -------- | -------- | -| onStart(event: () => void) | Triggered when the marquee starts scrolling.| -| onBounce(event: () => void) | Triggered when the marquee has reached the end. This event will be triggered for multiple times if the **loop** attribute is not set to **1**.| -| onFinish(event: () => void) | Triggered when the marquee has finished the number of scrolling times set by the **loop** attribute.| +| onStart(event: () => void) | Triggered when the marquee starts scrolling.
Since API version 9, this API is supported in ArkTS widgets.| +| onBounce(event: () => void) | Triggered when the marquee has reached the end. This event will be triggered for multiple times if the **loop** attribute is not set to **1**.
Since API version 9, this API is supported in ArkTS widgets.| +| onFinish(event: () => void) | Triggered when the marquee has finished the number of scrolling times set by the **loop** attribute.
Since API version 9, this API is supported in ArkTS widgets.| ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-menu.md b/en/application-dev/reference/arkui-ts/ts-basic-components-menu.md new file mode 100644 index 0000000000000000000000000000000000000000..594bf9fe6a1e8107e29a4dffc3b4b8c444ff92af --- /dev/null +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-menu.md @@ -0,0 +1,97 @@ +# Menu + +The **\** component is a vertical list of items presented to the user. + +> **NOTE** +> +> This component is supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. + +## Child Components + +This component contains the [MenuItem](ts-basic-components-menuitem.md) and [MenuItemGroup](ts-basic-components-menuitemgroup.md) child components. + +## APIs + +Menu() + +Creates a fixed container for a menu. This API does not have any parameters. + +## Attributes + +In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported. + +| Name | Type | Description | +| -------- | ------------------------- | ---------------------------------------------------------------- | +| fontSizedeprecated | [Length](ts-types.md#length) | Font size of the menu text. When **Length** is of the number type, the unit is fp.
This API is deprecated since API version 10. You are advised to use **font** instead.| +| font10+ | [Font](ts-types.md#font) | Font style of the menu text.| +| fontColor10+ | [ResourceColor](ts-types.md#resourcecolor) | Font color of the menu text.| + +## Example + +```ts +@Entry +@Component +struct Index { + @State select: boolean = true + private iconStr: ResourceStr = $r("app.media.view_list_filled") + private iconStr2: ResourceStr = $r("app.media.view_list_filled") + + @Builder + SubMenu() { + Menu() { + MenuItem({ content: "Copy", labelInfo: "Ctrl+C" }) + MenuItem({ content: "Paste", labelInfo: "Ctrl+V" }) + } + } + + @Builder + MyMenu(){ + Menu() { + MenuItem({ startIcon: $r("app.media.icon"), content: "Menu option" }) + MenuItem({ startIcon: $r("app.media.icon"), content: "Menu option" }) + .enabled(false) + MenuItem({ + startIcon: this.iconStr, + content: "Menu option", + endIcon: $r("app.media.arrow_right_filled"), + builder: this.SubMenu.bind(this) + }) + MenuItemGroup({ header: 'Subtitle' }) { + MenuItem ({ content: "Menu option" }) + .selectIcon(true) + .selected(this.select) + .onChange((selected) => { + console.info("menuItem select" + selected); + this.iconStr2 = $r("app.media.icon"); + }) + MenuItem({ + startIcon: $r("app.media.view_list_filled"), + content: "Menu option", + endIcon: $r("app.media.arrow_right_filled"), + builder: this.SubMenu.bind(this) + }) + } + MenuItem({ + startIcon: this.iconStr2, + content: "Menu option", + endIcon: $r("app.media.arrow_right_filled") + }) + } + } + + build() { + Row() { + Column() { + Text('click to show menu') + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .bindMenu(this.MyMenu) + .width('100%') + } + .height('100%') + } +} +``` + +![menu1](figures/menu1.png) diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-menuitem.md b/en/application-dev/reference/arkui-ts/ts-basic-components-menuitem.md new file mode 100644 index 0000000000000000000000000000000000000000..a4616a22ad0712d5fe1d419f5d3a981c1fb6876f --- /dev/null +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-menuitem.md @@ -0,0 +1,54 @@ +# MenuItem + +The **\** component represents an item in a menu. + +> **NOTE** +> +> This component is supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. + +## Child Components + +Not supported + +## APIs + +MenuItem(value?: MenuItemOptions| CustomBuilder) + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----- | ----------------------------------------------------------------------------------------------------------------------------- | ---- | ---------------------------- | +| value | [MenuItemOptions](ts-basic-components-menuitem.md#menuitemoptions) \| [CustomBuilder](ts-types.md#custombuilder8) | No | Information about the menu item.| + +## MenuItemOptions + +| Name | Type | Mandatory| Description | +| --------- | ------------------------------------------- | ---- | -------------------------------------- | +| startIcon | [ResourceStr](ts-types.md#resourcestr) | No | Path to the icon displayed on the left of the menu item. | +| content | [ResourceStr](ts-types.md#resourcestr) | No | Content of the menu item. | +| endIcon | [ResourceStr](ts-types.md#resourcestr) | No | Path to the icon displayed on the right of the menu item. | +| labelInfo | [ResourceStr](ts-types.md#resourcestr) | No | Information about the ending label, for example, shortcut **Ctrl+C**.| +| builder | [CustomBuilder](ts-types.md#custombuilder8) | No | Builder for a level-2 menu. | + +## Attributes + +In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported. + +| Name | Type | Description | +| ------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| selected | boolean | Whether the menu item is selected.
Default value: **false** | +| selectIcon | boolean \| [ResourceStr](ts-types.md#resourcestr)10+ | Whether to display the selected icon for a menu item is selected.
Default value: **false**
**true**: When a menu item is selected, the default tick icon is displayed.
**false**: When a menu item is selected, no icon is displayed.
**ResourceStr**: When a menu item is selected, the specified icon is displayed.| +| contentFont10+ | [Font](ts-types.md#font) | Font style of the menu item content. | +| contentFontColor10+ | [ResourceColor](ts-types.md#resourcecolor) | Font color of the menu item content. | +| labelFont10+ | [Font](ts-types.md#font) | Font style of the menu item label. | +| labelFontColor10+ | [ResourceColor](ts-types.md#resourcecolor) | Font color of the menu item label. | + +## Events + +| Name | Type | Description | +| -------- | --------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| onChange | (selected: boolean) => void | Triggered when the selection status of the menu item is changed manually.
The value **true** means that the menu item is selected, and **false** means the opposite. | + +## Example + +For details, see [Example in Menu](ts-basic-components-menu.md#example). diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-menuitemgroup.md b/en/application-dev/reference/arkui-ts/ts-basic-components-menuitemgroup.md new file mode 100644 index 0000000000000000000000000000000000000000..1c1b19c668d4a95ef6ab10bb2d5549b643374e40 --- /dev/null +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-menuitemgroup.md @@ -0,0 +1,32 @@ +# MenuItemGroup + +The **\** component represents a group of menu items. + +> **NOTE** +> +> This component is supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. + +## Child Components + +This component contains the [MenuItem](ts-basic-components-menuitem.md) child component. + +## APIs + +MenuItemGroup(value?: MenuItemGroupOptions) + +**Parameters** + +| Name | Type | Mandatory| Description | +| ----- | -------------------------------------------------------------------------------------- | ---- | ------------------------------------------- | +| value | [MenuItemGroupOptions](ts-basic-components-menuitemgroup.md#menuitemgroupoptions) | No | Header and footer of the menu item group.| + +## MenuItemGroupOptions + +| Name | Type | Mandatory| Description | +| ------ | ----------------------------------------------------------------------------------------- | ---- | ----------------------------- | +| header | [ResourceStr](ts-types.md#resourcestr) \| [CustomBuilder](ts-types.md#custombuilder8) | No | Header of the menu item group.| +| footer | [ResourceStr](ts-types.md#resourcestr) \| [CustomBuilder](ts-types.md#custombuilder8) | No | Footer of the menu item group.| + +## Sample + +For details, see [Example in Menu](ts-basic-components-menu.md#example). diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-navigation.md b/en/application-dev/reference/arkui-ts/ts-basic-components-navigation.md index 0365224d576125c9af95fc0cf2531e963c5ff6b7..17787ccda78c576429fe1db1b81b3b5c879cba79 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-navigation.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-navigation.md @@ -25,18 +25,18 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name | Type | Description | | -------------- | ---------------------------------------- | ---------------------------------------- | -| title | string \| [CustomBuilder](ts-types.md#custombuilder8)8+ \| [NavigationCommonTitle](#navigationcommontitle)9+ \| [NavigationCustomTitle](#navigationcustomtitle)9+ | Page title. | +| title | [ResourceStr](ts-types.md#resourcestr)10+ \| [CustomBuilder](ts-types.md#custombuilder8)8+ \| [NavigationCommonTitle](#navigationcommontitle)9+ \| [NavigationCustomTitle](#navigationcustomtitle)9+ | Page title. | | subTitledeprecated | string | Subtitle of the page. This attribute is deprecated since API version 9. You are advised to use **title** instead. | | menus | Array<[NavigationMenuItem](#navigationmenuitem)> \| [CustomBuilder](ts-types.md#custombuilder8)8+ | Menu items in the upper right corner of the page. When the value type is Array\<[NavigationMenuItem](#navigationmenuitem)>, the menu shows a maximum of three icons in portrait mode and a maximum of five icons in landscape mode, plus excess icons (if any) under the automatically generated **More** icon. | | titleMode | [NavigationTitleMode](#navigationtitlemode) | Display mode of the page title bar.
Default value: **NavigationTitleMode.Free**| | toolBar | [object](#object) \| [CustomBuilder](ts-types.md#custombuilder8)8+ | Content of the toolbar.
**items**: items on the toolbar. | | hideToolBar | boolean | Whether to hide the toolbar.
Default value: **false**
**true**: Hide the toolbar.
**false**: Display the toolbar.| | hideTitleBar | boolean | Whether to hide the title bar.
Default value: **false**
**true**: Hide the title bar.
**false**: Display the title bar.| -| hideBackButton | boolean | Whether to hide the Back key.
Default value: **false**
**true**: Hide the Back key.
**false**: Display the Back key.| +| hideBackButton | boolean | Whether to hide the Back button.
Default value: **false**
**true**: Hide the Back button.
**false**: Display the Back button.|The Back button in the title bar of the **\** component cannot be hidden.| | navBarWidth9+ | [Length](ts-types.md#length) | Width of the navigation bar.
Default value: **200vp**| | navBarPosition9+ | [NavBarPosition](#navbarposition) | Position of the navigation bar.
Default value: **NavBarPosition.Start**| | mode9+ | [NavigationMode](#navigationmode) | Display mode of the navigation bar.
Default value: **NavigationMode.Auto**| -| backButtonIcon9+ | string \| [PixelMap](../apis/js-apis-image.md#pixelmap7) \| [Resource](ts-types.md#resource) | Back icon on the navigation bar.| +| backButtonIcon9+ | string \| [PixelMap](../apis/js-apis-image.md#pixelmap7) \| [Resource](ts-types.md#resource) | Back button icon on the navigation bar. The Back button in the title bar of the **\** component cannot be hidden.| | hideNavBar9+ | boolean | Whether to hide the navigation bar. This attribute is valid only when **mode** is set to **NavigationMode.Split**.| @@ -91,7 +91,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | ---- | ---------------------------------------- | | Stack | The navigation bar and content area are displayed independently of each other, which are equivalent to two pages.| | Split | The navigation bar and content area are displayed in different columns.| -| Auto | When the window width is greater than or equal to 520 vp, Split mode is used. Otherwise, Stack mode is used.| +| Auto | When the window width is greater than or equal to 520 vp, Split mode is used. Otherwise, the Stack mode is used.| ## TitleHeight @@ -103,7 +103,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the > **NOTE** > -> The scrollable component can only be **\**. +> Among the scrollable components, only **\** is supported. ## Events diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-plugincomponent.md b/en/application-dev/reference/arkui-ts/ts-basic-components-plugincomponent.md index cee680621ce514b190bbddd8248647bbef0394bc..041045dc6986adfcc82696f3df7d314aaabccbe7 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-plugincomponent.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-plugincomponent.md @@ -1,14 +1,11 @@ # PluginComponent -The **\** allows the UI provided by an external application to be displayed in the application. +The **\** allows the UI provided by an external application to be displayed in the application. To implement the update through inter-process communication (IPC), see [@ohos.pluginComponent](../apis/js-apis-plugincomponent.md). > **NOTE** > > - This component is supported since API version 9. Updates will be marked with a superscript to indicate their earliest API version. -> -> - The APIs provided by this component are system APIs. - ## Child Components @@ -23,166 +20,41 @@ Creates a **PluginComponent** to display the UI provided by an external applicat **Parameters** -| Name| Type | Mandatory| Description | -| ------ | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| value | {
template: PluginComponentTemplate,
data: KVObject
} | Yes | **template**: template of the **PluginComponent**, which is bound to the component defined by the provider.
**data**: data passed to the **PluginComponent** provider.| +| Name| Type | Mandatory| Description | +| ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---- | --------------------------------------------------------------------------------------------------------- | +| value | {
template: [PluginComponentTemplate](#plugincomponenttemplate),
data: [KVObject](../apis/js-apis-plugincomponent.md#kvobject)
} | Yes | **template**: template of the **PluginComponent**, which is bound to the component defined by the provider.
**data**: data passed to the **PluginComponent** provider.| ## PluginComponentTemplate -| Name | Type | Description | -| ------- | ------ | ----------------------- | -| source | string | Component template name. | -| ability | string | Name of the provider ability.| +| Name | Type | Description | +| ---------- | ------ | --------------------------- | +| source | string | Component template name. | +| bundleName | string | Bundle name of the provider ability.| ## Events -| Name | Description | -| ---------------------------------------- | ---------------------------------------- | -| onComplete(callback: () => void) | Triggered when the component loading is complete. | +| Name | Description | +| ------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | +| onComplete(callback: () => void) | Triggered when the component loading is complete. | | onError(callback: (info: { errcode: number, msg: string }) => void) | Triggered when an error occurs during component loading.
**errcode**: error code.
**msg**: error information.| - -## PluginComponentManager - -Provides APIs for the **PluginComponent**. You can use these APIs to request components and data and send component templates and data. - - -## Modules to Import - - -``` -import pluginComponentManager from '@ohos.plugincomponent' -``` - - -## push - -push(param: PushParameters, callback: AsyncCallback<void>): void - -Pushes the component and data to the component user. - -**Parameters** - -| Name | Type | Mandatory | Description | -| -------- | ------------------------- | ---- | -------------------------------- | -| param | PushParameters | Yes | Information about the component user. For details, see **PushParameters**.| -| callback | AsyncCallback<void> | Yes | Asynchronous callback used to return the result. | - -**PushParameters** - -| Name | Type | Mandatory | Description | -| --------- | -------- | ---- | --------------- | -| want | Want | Yes | Ability information of the component user.| -| name | string | Yes | Component name. | -| data | KVObject | No | Component data value. | -| extraData | KVObject | No | Additional data value. | -| jsonPath | string | No | Path of the **external.json** file that stores template paths. | - -**Example** - -For details, see [PluginComponent Provider](#plugincomponent-provider). - - -## request - -request(param: RequestParameters, callback: AsyncCallback<RequestCallbackParameters>): void - -Requests the component from the component provider. - -**Parameters** - -| Name | Type | Mandatory | Description | -| -------- | ---------------------------------------- | ---- | ------------------------------------ | -| param | RequestParameters | Yes | Information about the component request. For details, see **RequestParameters**.| -| callback | AsyncCallback**"push"**: The component provider pushes data to the component user.
**"request"**: The component user proactively requests data from the component provider.| -| callback | OnPushEventCallback \| OnRequestEventCallback | Yes | Callback used to return the result. For details, see **callback**. | - -**callback** - -| Name | Type | Description | -| ---------------------- | ---------------------------------------- | ---------------------------------------- | -| OnRequestEventCallback | (source: Want,
name: string,
data: KVObject ) =>RequestEventResult | Callback for the data request event.
**source**: ability information of the component requester.
**name**: name of the requested component.
**data**: additional data.
Return value: request data and result.| -| OnPushEventCallback | (source: Want,
template: PluginComponentTemplate,
data: KVObject,
extraData: KVObject
) => void | Callback used to receive the data pushed by the component provider.
**source**: ability information of the component provider.
**template**: component template.
**data**: component update data.
**extraData**: additional data.| - -**RequestEventResult** - -| Name | Type | Description | -| --------- | -------- | ---------- | -| template | string | Component name.| -| data | KVObject | Component data.| -| extraData | KVObject | Additional data.| - -**Example** - -For details, see [PluginComponent Tools](#plugincomponent-tools). - -**KVObject** - -| Name | Type | Description | -| ---- | ---------------------------------------- | ---------------------------------------- | -| key | number \| string \| boolean \| Array \| KVObject | Key of the **KVObject**. **KVObject** uses **key** and **value** to store data. If **key** is of the string type, **value** can be of the number, string, boolean, array type or another **KVObject**.| - - -**Description of the external.json file** - -The **external.json** file is created by developers. This file stores component names and template paths in key-value pairs. The component name is the key, and the corresponding template path is the value. - -**Example** - -For details, see [external.json](#externaljson). - ## Example ### PluginComponent User - ```ts //PluginUserExample.ets -import plugin from "plugin_component.js" +import plugin from "./plugin_component.js" @Entry @Component struct PluginUserExample { @StorageLink("plugincount") plugincount: Object[] = [ - { source: 'plugincomponent1', ability: 'com.example.plugin' }, - { source: 'plugintemplate', ability: 'com.example.myapplication' }, - { source: 'plugintemplate', ability: 'com.example.myapplication' }] + { source: 'plugincomponent1', bundleName: 'com.example.plugin' }, + { source: 'plugintemplate', bundleName: 'com.example.myapplication' }, + { source: 'plugintemplate', bundleName: 'com.example.myapplication' }] build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { @@ -209,7 +81,7 @@ struct PluginUserExample { }) ForEach(this.plugincount, item => { PluginComponent({ - template: { source: 'plugincomponent1', ability: 'com.example.plugin' }, + template: { source: 'PluginProviderExample', bundleName: 'com.example.plugin' }, data: { 'countDownStartValue': 'new countDownStartValue' } }).size({ width: 500, height: 100 }) .onComplete(() => { @@ -230,7 +102,7 @@ struct PluginUserExample { ```ts //PluginProviderExample.ets -import plugin from "plugin_component.js" +import plugin from "./plugin_component.js" @Entry @Component @@ -270,7 +142,7 @@ struct PluginProviderExample { ### PluginComponent Tools - +#### FA Model ```js //plugin_component.js import pluginComponentManager from '@ohos.pluginComponent' @@ -308,10 +180,10 @@ export default { pluginComponentManager.push( { want: { - bundleName: "com.example.myapplication", - abilityName: "com.example.myapplication.MainAbility", + bundleName: "com.example.plugin", + abilityName: "com.example.myapplication.PluginProviderExample", }, - name: "plugintemplate", + name: "PluginProviderExample", data: { "key_1": "plugin component test", "key_2": 34234 @@ -330,10 +202,10 @@ export default { // The component user proactively sends data. pluginComponentManager.request({ want: { - bundleName: "com.example.myapplication", - abilityName: "com.example.myapplication.MainAbility", + bundleName: "com.example.plugin", + abilityName: "com.example.myapplication.PluginProviderExample", }, - name: "plugintemplate", + name: "PluginProviderExample", data: { "key_1": "plugin component test", "key_2": 34234 @@ -358,10 +230,98 @@ export default { } ``` +#### Stage Model +```js +//plugin_component.js +import pluginComponentManager from '@ohos.pluginComponent' + +function onPushListener(source, template, data, extraData) { + console.log("onPushListener template.source=" + template.source) + var jsonObject = JSON.parse(data.componentTemplate.source) + console.log("request_callback1:source json object" + jsonObject) + var jsonArry = jsonObject.ExternalComponent + for (var i in jsonArry) { + console.log(jsonArry[i]) + } + console.log("onPushListener:source json object" + jsonObject) + console.log("onPushListener:source json string" + JSON.stringify(jsonObject)) + console.log("onPushListener template.ability=" + template.ability) + console.log("onPushListener data=" + JSON.stringify(data)) + console.log("onPushListener extraData=" + JSON.stringify(extraData)) +} -### external.json -```json +function onRequestListener(source, name, data) { - "plugintemplate": "ets/pages/plugintemplate.js", - "plugintemplate2": "ets/pages/plugintemplate2.js" + console.log("onRequestListener name=" + name); + console.log("onRequestListener data=" + JSON.stringify(data)); + return {template:"plugintemplate", data:data}; } + +export default { + //register listener + onListener() { + pluginComponentManager.on("push", onPushListener) + pluginComponentManager.on("request", onRequestListener) + }, + Push() { + // The component provider proactively sends data. + pluginComponentManager.push( + { + owner: { + bundleName: "com.example.myapplication", + abilityName: "com.example.myapplication.MainAbility", + }, + target: { + bundleName: "com.example.plugin", + abilityName: "com.example.myapplication.PluginProviderExample", + }, + name: "PluginProviderExample", + data: { + "key_1": "plugin component test", + "key_2": 34234 + }, + extraData: { + "extra_str": "this is push event" + }, + jsonPath: "", + }, + (err, data) => { + console.log("push_callback: push ok!"); + } + ) + }, + Request() { + // The component user proactively sends data. + pluginComponentManager.request({ + owner: { + bundleName: "com.example.myapplication", + abilityName: "com.example.myapplication.MainAbility", + }, + target: { + bundleName: "com.example.plugin", + abilityName: "com.example.myapplication.PluginProviderExample", + }, + name: "PluginProviderExample", + data: { + "key_1": "plugin component test", + "key_2": 34234 + }, + jsonPath: "", + }, + (err, data) => { + console.log("request_callback: componentTemplate.ability=" + data.componentTemplate.ability) + console.log("request_callback: componentTemplate.source=" + data.componentTemplate.source) + var jsonObject = JSON.parse(data.componentTemplate.source) + console.log("request_callback:source json object" + jsonObject) + var jsonArry = jsonObject.ExternalComponent + for (var i in jsonArry) { + console.log(jsonArry[i]) + } + console.log("request_callback:source json string" + JSON.stringify(jsonObject)) + console.log("request_callback: data=" + JSON.stringify(data.data)) + console.log("request_callback: extraData=" + JSON.stringify(data.extraData)) + } + ) + } +} +``` diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-progress.md b/en/application-dev/reference/arkui-ts/ts-basic-components-progress.md index 98d9d6e2b1a2d0839071d2f72689d2cae6cb15ea..695d7f0cdff2c7381818f975e9eb31bf18a1d881 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-progress.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-progress.md @@ -18,17 +18,21 @@ Progress(options: {value: number, total?: number, type?: ProgressType}) Creates a progress indicator. +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| value | number | Yes| Current progress. If the value is less than 0, the value **0** is used. If the value is greater than that of **total**, the value of **total** is used.| -| total | number | No| Total progress.
Default value: **100**| -| type8+ | [ProgressType](#progresstype) | No| Style the progress indicator.
Default value: **ProgressType.Linear**| +| value | number | Yes| Current progress. If the value is less than 0, the value **0** is used. If the value is greater than that of **total**, the value of **total** is used.
Since API version 9, this API is supported in ArkTS widgets.| +| total | number | No| Total progress.
Default value: **100**
Since API version 9, this API is supported in ArkTS widgets.| +| type8+ | [ProgressType](#progresstype) | No| Style the progress indicator.
Default value: **ProgressType.Linear**
Since API version 9, this API is supported in ArkTS widgets.| | styledeprecated | [ProgressStyle](#progressstyle) | No| Type of the progress indicator.
This parameter is deprecated since API version 8. You are advised to use **type** instead.
Default value: **ProgressStyle.Linear**| ## ProgressType +Since API version 9, this API is supported in ArkTS widgets. + | Name| Description| | -------- | -------- | | Linear | Linear type. Since API version 9, the progress indicator adaptively switches to vertical layout if the height is greater than the width.| @@ -39,6 +43,8 @@ Creates a progress indicator. ## ProgressStyle +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | --------- | ------------------------------------------------------------ | | Linear | Linear type.| @@ -51,10 +57,10 @@ Creates a progress indicator. | Name| Type| Description| | -------- | -------- | -------- | -| value | number | Current progress. If the value is less than 0, the value **0** is used. If the value is greater than that of **total**, the value of **total** is used. Invalid values do not take effect.| -| color | [ResourceColor](ts-types.md#resourcecolor) | Background color of the progress indicator.| -| backgroundColor | [ResourceColor](ts-types.md#resourcecolor) | Background color of the progress indicator.| -| style8+ | {
strokeWidth?: [Length](ts-types.md#length),
scaleCount?: number,
scaleWidth?: [Length](ts-types.md#length)
} | Component style.
- **strokeWidth**: stroke width of the progress indicator. It cannot be set in percentage. Since API version 9, if the stroke width of the ring progress bar is greater than or equal to the radius, the width is changed to half of the radius.
Default value: **4.0Vp**
- **scaleCount**: number of divisions on the determinate ring-type process indicator.
Default value: **120**
- **scaleWidth**: scale width of the ring progress bar. It cannot be set in percentage. If it is greater than the value of **strokeWidth**, the default scale width is used.
Default value: **2.0Vp**| +| value | number | Current progress. If the value is less than 0, the value **0** is used. If the value is greater than that of **total**, the value of **total** is used. Invalid values do not take effect.
Since API version 9, this API is supported in ArkTS widgets.| +| color | [ResourceColor](ts-types.md#resourcecolor) | Background color of the progress indicator.
Since API version 9, this API is supported in ArkTS widgets.| +| backgroundColor | [ResourceColor](ts-types.md#resourcecolor) | Background color of the progress indicator.
Since API version 9, this API is supported in ArkTS widgets.| +| style8+ | {
strokeWidth?: [Length](ts-types.md#length),
scaleCount?: number,
scaleWidth?: [Length](ts-types.md#length)
} | Component style.
- **strokeWidth**: stroke width of the progress indicator. It cannot be set in percentage. Since API version 9, if the stroke width of the ring progress bar is greater than or equal to the radius, the width is changed to half of the radius.
Default value: **4.0Vp**
- **scaleCount**: number of divisions on the determinate ring-type process indicator.
Default value: **120**
- **scaleWidth**: scale width of the ring progress bar. It cannot be set in percentage. If it is greater than the value of **strokeWidth**, the default scale width is used.
Default value: **2.0Vp**
Since API version 9, this API is supported in ArkTS widgets.| ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-qrcode.md b/en/application-dev/reference/arkui-ts/ts-basic-components-qrcode.md index 804d82a8d3b1dcfa91a87384b9f3905acdd39cce..90705e2c5a20844a2346e45dee5835c128054aec 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-qrcode.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-qrcode.md @@ -5,6 +5,8 @@ The **\** component is used to display a QR code. > **NOTE** > > This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. +> +> The number of pixels of the **\** component is subject to the content. If the component size is not large enough, the content may fail to be displayed. In this case, you need to resize the component. ## Child Components @@ -16,11 +18,13 @@ Not supported QRCode(value: string) +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| value | string | Yes| Content of the QR code.| +| value | string | Yes| Content of the QR code. A maximum of 256 characters are supported. If the number of characters exceeds 256, the first 256 characters are used.| ## Attributes @@ -28,13 +32,13 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name| Type| Description| | -------- | -------- | -------- | -| color | [ResourceColor](ts-types.md#resourcecolor) | Color of the QR code.
Default value: **Color.Black**| -| backgroundColor | [ResourceColor](ts-types.md#resourcecolor) | Background color of the QR code.
Default value: **Color.White**| +| color | [ResourceColor](ts-types.md#resourcecolor) | Color of the QR code.
Default value: **Color.Black**
Since API version 9, this API is supported in ArkTS widgets.| +| backgroundColor | [ResourceColor](ts-types.md#resourcecolor) | Background color of the QR code.
Default value: **Color.White**
Since API version 9, this API is supported in ArkTS widgets.| ## Events -Among all the universal events, only the [click event](ts-universal-events-click.md) is supported. +Among the universal events, the [click event](ts-universal-events-click.md), [touch event](ts-universal-events-touch.md), and [show/hide event](ts-universal-events-show-hide.md) are supported. ## Example @@ -45,17 +49,21 @@ Among all the universal events, only the [click event](ts-universal-events-click @Component struct QRCodeExample { private value: string = 'hello world' - build() { Column({ space: 5 }) { - Text('normal').fontSize(9).width('90%').fontColor(0xCCCCCC) + Text('normal').fontSize(9).width('90%').fontColor(0xCCCCCC).fontSize(30) QRCode(this.value).width(200).height(200) - Text('color').fontSize(9).width('90%').fontColor(0xCCCCCC) + // Set the color for the QR code. + Text('color').fontSize(9).width('90%').fontColor(0xCCCCCC).fontSize(30) QRCode(this.value).color(0xF7CE00).width(200).height(200) + + // Set the background color for the QR code. + Text('backgroundColor').fontSize(9).width('90%').fontColor(0xCCCCCC).fontSize(30) + QRCode(this.value).width(200).height(200).backgroundColor(Color.Orange) }.width('100%').margin({ top: 5 }) } } ``` -![en-us_image_0000001256858415](figures/en-us_image_0000001256858415.png) +![qrcode](figures/qrcode.png) diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-radio.md b/en/application-dev/reference/arkui-ts/ts-basic-components-radio.md index f000af680f63404ce37e365b777fbe9e03b96b5d..3213884ab2337bdf548db9b685a64cdd5aa2815b 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-radio.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-radio.md @@ -16,6 +16,8 @@ Not supported Radio(options: {value: string, group: string}) +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name| Type| Mandatory| Description| @@ -29,7 +31,8 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name| Type| Description| | -------- | -------- | -------- | -| checked | boolean | Whether the radio button is selected.
Default value: **false**| +| checked | boolean | Whether the radio button is selected.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.| +| radioStyle10+ | [RadioStyle](#radiostyle) | Style of the radio button in selected or deselected state.
Since API version 10, this API is supported in ArkTS widgets.| ## Events @@ -37,8 +40,15 @@ In addition to the [universal events](ts-universal-events-click.md), the followi | Name| Description| | -------- | -------- | -| onChange(callback: (isChecked: boolean) => void) | Triggered when the selected state of the radio button changes.
- If **isChecked** is **true**, the radio button is selected.
- If **isChecked** is **false**, the radio button is not selected.| +| onChange(callback: (isChecked: boolean) => void) | Triggered when the selected state of the radio button changes.
- If **isChecked** is **true**, the radio button is selected.
- If **isChecked** is **false**, the radio button is not selected.
Since API version 9, this API is supported in ArkTS widgets.| + +## RadioStyle +| Name | Type | Mandatory| Default Value | Description | +| ---------------------- | ------------------------------------------ | ---- | ------- | ---------------------- | +| checkedBackgroundColor | [ResourceColor](ts-types.md#resourcecolor) | No | #007DFF | Color of the background when the radio button is selected. | +| uncheckedBorderColor | [ResourceColor](ts-types.md#resourcecolor) | No | #182431 | Color of the border when the radio button is deselected. | +| indicatorColor | [ResourceColor](ts-types.md#resourcecolor) | No | #FFFFFF | Color of the indicator when the radio button is selected.| ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-rating.md b/en/application-dev/reference/arkui-ts/ts-basic-components-rating.md index 560a20be960ff723ccd1a633272df3cb58024e54..eb3d4489f8cadd3df86f727fe68be24596b407ee 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-rating.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-rating.md @@ -16,6 +16,8 @@ Not supported Rating(options?: { rating: number, indicator?: boolean }) +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name| Type| Mandatory| Description| @@ -28,16 +30,16 @@ Rating(options?: { rating: number, indicator?: boolean }) | Name| Type| Description| | -------- | -------- | -------- | -| stars | number | Total number of stars.
Default value: **5**| -| stepSize | number | Step of an operation.
Default value: **0.5**| -| starStyle | {
backgroundUri: string,
foregroundUri: string,
secondaryUri?: string
} | **backgroundUri**: image link of the unselected star. You can use the default image or a custom local image.
**foregroundUri**: image path of the selected star. You can use the default image or a custom local image.
**secondaryUir**: image path of the partially selected star. You can use the default image or a custom local image.| +| stars | number | Total number of stars.
Default value: **5**
Since API version 9, this API is supported in ArkTS widgets.| +| stepSize | number | Step of an operation.
Default value: **0.5**
Since API version 9, this API is supported in ArkTS widgets.| +| starStyle | {
backgroundUri: string,
foregroundUri: string,
secondaryUri?: string
} | Star style.
**backgroundUri**: image path for the unselected star. You can use the default system image or a custom image.
**foregroundUri**: image path for the selected star. You can use the default system image or a custom image.
**secondaryUir**: image path for the partially selected star. You can use the default system image or a custom image.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
For details about the image types supported by the **startStyle** attribute, see [Image](ts-basic-components-image.md).
Local and online images are supported, but not **PixelMap** and **Resource** objects.
By default, the image is loaded in asynchronous mode. Synchronous loading is not supported.| ## Events | Name| Description| | -------- | -------- | -| onChange(callback:(value: number) => void) | Triggered when the rating value changes.| +| onChange(callback:(value: number) => void) | Triggered when the rating value changes.
Since API version 9, this API is supported in ArkTS widgets.| ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-richtext.md b/en/application-dev/reference/arkui-ts/ts-basic-components-richtext.md index 39321308ca3063bc5da81e5ec94d353b02684cd1..032b5b61a6a49ed33eaa3b65d38321b73cac8117 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-richtext.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-richtext.md @@ -5,7 +5,7 @@ The **\** component parses and displays HTML text. > **NOTE** > > This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. - +> Set the height when using this component. ## Child Components @@ -31,6 +31,10 @@ RichText(content:string) | onStart(callback: () => void) | Triggered when web page loading starts. | | onComplete(callback: () => void) | Triggered when web page loading is completed.| +## Attributes + +Among the [universal attributes](ts-universal-attributes-size.md), only the **width**, **height**, **size**, and **layoutWeight** attributes are supported. + ## Supported Tags | Name| Description| Example| @@ -39,13 +43,13 @@ RichText(content:string) | \

\

| Defines a paragraph.| \

This is a paragraph\

| | \
| Inserts a newline character.| \

This is a paragraph\
This is a new paragraph\

| | \ | Defines the font style for the text contained within it, including the font face, size, and color.| \This is in red\ | -| \
| Defines a thematic break (such as a shift of topic) on an HTML page and creates a horizontal line.| \

This is a paragraph\

\
\

This is a paragraph\

| +| \
| Defines a thematic break (such as a shift of topic) on an HTML page and creates a horizontal line.| \

This is text\

\
\

This is text\

| | \\ | Defines an image.| \\ | | \
\
| Defines a generic container that is generally used to group block-level elements. It allows you to apply CSS styles to multiple elements at the same time.| \
\

This is the heading in a div element\

\
| | \\ | Displays text in italic style.| \This is in italic style\| | \\ | Defines text that should be styled differently or have a non-textual annotation, such as misspelt words or a proper name in Chinese text. It is recommended that you avoid using the \ tag where it could be confused with a hyperlink.| \

\This is an underlined paragraph\\

| | \ | Used to embed CSS within an HTML document.| \ | -| style | Defines the inline style of an element and is placed inside the tag. Use quotation marks (') to separate the styling text and use semicolons (;) to separate styles, for example, **style='width: 500px;height: 500px;border: 1px solid;margin: 0 auto;'**.| \

This is a heading\

\

This is a paragraph\

| +| style | Defines the inline style of an element and is placed inside the tag. Use quotation marks (') to separate the styling text and use semicolons (;) to separate styles, for example, **style='width: 500px;height: 500px;border: 1px solid;margin: 0 auto;'**.| \

This is a heading\

\

This is text\

| | \ | Embeds or references a client-side script, such as JavaScript.| \ | ## Example @@ -66,7 +70,7 @@ struct RichTextExample { '
' + '

Font size: 35px; line height: 45px

' + '

' + - '

This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph. This is a paragraph.

'; + '

This is text. This is text. This is text. This is text. This is text. This is text. This is text. This is text. This is text.

'; build() { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, @@ -78,6 +82,29 @@ struct RichTextExample { .onComplete(() => { console.info('RichText onComplete'); }) + .width(500) + .height(400) + .backgroundColor(0XBDDB69) + RichText('layoutWeight(1)') + .onStart(() => { + console.info('RichText onStart'); + }) + .onComplete(() => { + console.info('RichText onComplete'); + }) + .size({ width: '100%', height: 110 }) + .backgroundColor(0X92D6CC) + .layoutWeight(1) + RichText('layoutWeight(2)') + .onStart(() => { + console.info('RichText onStart'); + }) + .onComplete(() => { + console.info('RichText onComplete'); + }) + .size({ width: '100%', height: 110 }) + .backgroundColor(0X92C48D) + .layoutWeight(2) } } } 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 9f1d13ee9981696905d9383abfde395aa2162c1b..1086c3e68b3f5ca5d7d4383a62477d429ea122e4 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 @@ -12,14 +12,14 @@ Not supported ## APIs -Search(options?: { value?: string; placeholder?: string; icon?: string; controller?: SearchController }) +Search(options?: { value?: string; placeholder?: ResourceStr; icon?: string; controller?: SearchController }) **Parameters** | Name | Type | Mandatory| Description | | ----------- | ---------------- | ---- | ------------------------------------------------------------ | -| value | string | No | Text input in the search text box. | -| placeholder | string | No | Text displayed when there is no input. | +| value | string | No | Text input in the search text box. | +| placeholder | [ResourceStr](ts-types.md#resourcestr)10+ | 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.| | controller | SearchController | No | Controller of the **\** component. | @@ -29,12 +29,46 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name | Type | Description | | ----------------------- | ------------------------------------------------ | ---------------------------------------------- | -| searchButton | string | Text on the search button located next to the search text box. By default, there is no search button. | +| searchButton10+ | value: string,
option?: [SearchButtonOption](#searchbuttonoption10) | Text on the search button located next to the search text box. By default, there is no search button. | | placeholderColor | [ResourceColor](ts-types.md#resourcecolor) | Placeholder text color. | | placeholderFont | [Font](ts-types.md#font) | Placeholder text font. | | textFont | [Font](ts-types.md#font) | Text font for the search text box. | | textAlign | [TextAlign](ts-appendix-enums.md#textalign) | Text alignment mode in the search text box.
Default value: **TextAlign.Start** | | copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed. | +| searchIcon10+ | [IconOptions](#iconoptions10) | Style of the search icon on the left. | +| cancelButton10+ | {
style? : [CancelButtonStyle](#cancelbuttonstyle10)
icon?: [IconOptions](#iconoptions10)
} | Style of the Cancel button on the right. | +| fontColor10+ | [ResourceColor](ts-types.md#resourcecolor) | Font color of the input text. | +| caretStyle10+ | [CaretStyle](#caretstyle10) | Caret style. | + +## IconOptions10+ + +| Name| Type | Mandatory| Description | +| ------ | ------------------------------------------ | ---- | ----------- | +| size | [Length](ts-types.md#length) | No | Icon size. | +| color | [ResourceColor](ts-types.md#resourcecolor) | No | Icon color. | +| src | [ResourceStr](ts-types.md#resourcestr) | No | Image source of the icon.| + +## CaretStyle10+ + +| Name| Type | Mandatory| Description| +| ------ | ------------------------------------------ | ---- | -------- | +| width | [Length](ts-types.md#length) | No | Caret width.| +| color | [ResourceColor](ts-types.md#resourcecolor) | No | Caret color.| + +## SearchButtonOption10+ + +| Name | Type | Mandatory| Description | +| --------- | ------------------------------------------ | ---- | ---------------- | +| fontSize | [Length](ts-types.md#length) | No | Font size of the button.| +| fontColor | [ResourceColor](ts-types.md#resourcecolor) | No | Font color of the button.| + +## CancelButtonStyle10+ + +| Name | Description | +| ----------------------- | ---------------- | +| CONSTANT10+ | The Cancel button is always displayed.| +| INVISIBLE10+ | The Cancel button is always hidden.| +| INPUT10+ | The Cancel button is displayed when there is text input.| ## Events diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-slider.md b/en/application-dev/reference/arkui-ts/ts-basic-components-slider.md index b8bf88b154875799dbaa04ace76d8ea12fcc5d03..4c32cb2686c2f6e3abc7dd4b3ee4af2c9355d6fa 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-slider.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-slider.md @@ -16,6 +16,8 @@ Not supported Slider(options?: {value?: number, min?: number, max?: number, step?: number, style?: SliderStyle, direction?: Axis, reverse?: boolean}) +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name| Type| Mandatory| Description| @@ -30,6 +32,8 @@ Slider(options?: {value?: number, min?: number, max?: number, step?: number, sty ## SliderStyle +Since API version 9, this API is supported in ArkTS widgets. + | Name| Description| | -------- | -------- | | OutSet | The slider is on the slider track.| @@ -42,13 +46,39 @@ Except touch target attributes, the universal attributes are supported. | Name| Type| Description| | -------- | -------- | -------- | -| blockColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the slider.| -| trackColor | [ResourceColor](ts-types.md#resourcecolor) | Background color of the slider.| -| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the selected part of the slider track.| -| showSteps | boolean | Whether to display the current step.
Default value: **false**| -| showTips | boolean | Whether to display a bubble to indicate the percentage when the user drags the slider.
Default value: **false**| -| trackThickness | [Length](ts-types.md#length) | Track thickness of the slider.| +| blockColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the slider.
Since API version 9, this API is supported in ArkTS widgets.| +| trackColor | [ResourceColor](ts-types.md#resourcecolor) | Background color of the slider.
Since API version 9, this API is supported in ArkTS widgets.| +| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the selected part of the slider track.
Since API version 9, this API is supported in ArkTS widgets.| +| showSteps | boolean | Whether to display the current step.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.| +| showTips | boolean | Whether to display a bubble to indicate the percentage when the user drags the slider.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
When **direction** is set to **Axis.Horizontal**, the bubble is displayed right above the slider. When **direction** is set to **Axis.Vertical**, the bubble is displayed on the left of the slider.
The drawing area of the bubble is the overlay of the slider.
If no margin is set for the slider or the margin is not large enough, the bubble will be clipped.| +| trackThickness | [Length](ts-types.md#length) | Track thickness of the slider.
Since API version 9, this API is supported in ArkTS widgets.| +| blockBorderColor10+ | [ResourceColor](ts-types.md#resourcecolor) | Border color of the slider in the block direction.| +| blockBorderWidth10+ | [Length](ts-types.md#length) | Border width of the slider in the block direction.| +| stepColor10+ | [ResourceColor](ts-types.md#resourcecolor) | Step color.| +| trackBorderRadius10+ | [Length](ts-types.md#length) | Radius of the rounded corner of the slider track.| +| blockSize10+ | [SizeOptions](ts-types.md#sizeoptions) | Size of the slider in the block direction.| +| blockStyle10+ | [SliderBlockStyle](#sliderblockstyle10) | Style of the slider in the block direction.| +| stepSize10+ | [Length](ts-types.md#length) | Step size (diameter).| + +## SliderBlockStyle10+ + +Desribes the style of the slider in the block direction. +| Name | Type | Mandatory| Description | +| ----- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| type | [SliderBlockType](#sliderblocktype10) | Yes | Type of the slider in the block direction.
Default value: **SliderBlockType.DEFAULT**, indicating the round slider.| +| image | [ResourceStr](ts-types.md#resourcestr) | No | Image resource of the slider.
The area size for displaying the image is subject to the **blockSize** attribute. Be mindful of the image size when selecting an image.| +| shape | [Circle](ts-drawing-components-circle.md) \| [Ellipse](ts-drawing-components-ellipse.md) \| [Path](ts-drawing-components-path.md) \| [Rect](ts-drawing-components-rect.md) | No | Custom shape of the slider. | + +## SliderBlockType10+ + +Enumerates the types of the slider in the block direction. + +| Name | Description | +| ------- | ---------------------- | +| DEFAULT | Round slider. | +| IMAGE | Slider with an image background. | +| SHAPE | Slider in a custom shape.| ## Events @@ -56,15 +86,17 @@ In addition to the **OnAppear** and **OnDisAppear** universal events, the follow | Name| Description| | -------- | -------- | -| onChange(callback: (value: number, mode: SliderChangeMode) => void) | Invoked when the slider slides.
**value**: current slider value. If the return value contains decimals, you can use **Math.toFixed()** to process the data to the desired precision.
**mode**: dragging state.| +| onChange(callback: (value: number, mode: SliderChangeMode) => void) | Invoked when the slider is dragged or clicked.
**value**: current slider value. If the return value contains decimals, you can use **Math.toFixed()** to process the data to the desired precision.
**mode**: state triggered by the event.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
The **Begin** and **End** states are triggered when the slider is clicked with a gesture. The **Moving** and **Click** states are triggered when the value of **value** changes.
If the coherent action is a drag action, the **Click** state will not be triggered.
The value range of **value** is the **steps** value array.| ## SliderChangeMode +Since API version 9, this API is supported in ArkTS widgets. + | Name| Value| Description| | -------- | -------- | -------- | -| Begin | 0 | The user starts to drag the slider.| +| Begin | 0 | The user touches or presses the slider with a gesture or mouse.| | Moving | 1 | The user is dragging the slider.| -| End | 2 | The user stops dragging the slider.| +| End | 2 | The user stops dragging the slider by lifting their finger or releasing the mouse.| | Click | 3 | The user moves the slider by touching the slider track.| diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-span.md b/en/application-dev/reference/arkui-ts/ts-basic-components-span.md index 0c7c4044634d3751fb653df18bb1be10d98dccaa..f8d1fec7469a7b9b16757fcb59522c1f60d20710 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-span.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-span.md @@ -16,6 +16,8 @@ Not supported Span(value: string | Resource) +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name| Type| Mandatory| Description| @@ -23,21 +25,20 @@ Span(value: string | Resource) | value | string \| [Resource](ts-types.md#resource) | Yes| Plain text.| - ## Attributes In addition to the [universal text style](ts-universal-attributes-text-style.md) attributes, the following attributes are supported. | Name| Type| Description| | -------- | -------- | -------- | -| decoration | {
type: [TextDecorationType](ts-appendix-enums.md#textdecorationtype),
color?: [ResourceColor](ts-types.md#resourcecolor)
} | Style and color of the text decorative line.
Default value: {
type: TextDecorationType.None
color: Color.Black
} | -| letterSpacing | number \| string | Letter spacing. | -| textCase | [TextCase](ts-appendix-enums.md#textcase) | Text case.
Default value: **TextCase.Normal**| +| decoration | {
type: [TextDecorationType](ts-appendix-enums.md#textdecorationtype),
color?: [ResourceColor](ts-types.md#resourcecolor)
} | Style and color of the text decorative line.
Default value: {
type: TextDecorationType.None
color: Color.Black
}
Since API version 9, this API is supported in ArkTS widgets.| +| letterSpacing | number \| string | Letter spacing. A negative value tightens the spacing; a positive value loosens the spacing, and the letters are spread farther apart with the value.
Since API version 9, this API is supported in ArkTS widgets. | +| textCase | [TextCase](ts-appendix-enums.md#textcase) | Text case.
Default value: **TextCase.Normal**
Since API version 9, this API is supported in ArkTS widgets.| ## Events -Among all the [universal events](ts-universal-attributes-click.md), only the click event is supported. +Among all the universal events, only the [click event](ts-universal-attributes-click.md) is supported. > **NOTE** > @@ -59,29 +60,59 @@ struct SpanExample { .decoration({ type: TextDecorationType.None, color: Color.Red }) } + // Add a line under the text. Text('Text Decoration').fontSize(9).fontColor(0xCCCCCC) Text() { Span('I am Underline-span').decoration({ type: TextDecorationType.Underline, color: Color.Red }).fontSize(12) } + Text() { - Span('I am LineThrough-span').decoration({ type: TextDecorationType.LineThrough, color: Color.Red }).fontSize(12) + Span('I am LineThrough-span') + .decoration({ type: TextDecorationType.LineThrough, color: Color.Red }) + .fontSize(12) } + Text() { Span('I am Overline-span').decoration({ type: TextDecorationType.Overline, color: Color.Red }).fontSize(12) } + // Set the letter spacing. + Text('LetterSpacing').fontSize(9).fontColor(0xCCCCCC) + Text() { + Span('span letter spacing') + .letterSpacing(0) + .fontSize(12) + } + + Text() { + Span('span letter spacing') + .letterSpacing(-2) + .fontSize(12) + } + + Text() { + Span('span letter spacing') + .letterSpacing(3) + .fontSize(12) + } + + + // Set the text case. Text('Text Case').fontSize(9).fontColor(0xCCCCCC) Text() { - Span('I am Lower-span').textCase(TextCase.LowerCase).fontSize(12) - .decoration({ type: TextDecorationType.None, color: Color.Red }) + Span('I am Lower-span').fontSize(12) + .textCase(TextCase.LowerCase) + .decoration({ type: TextDecorationType.None }) } + Text() { - Span('I am Upper-span').textCase(TextCase.UpperCase).fontSize(12) - .decoration({ type: TextDecorationType.None, color: Color.Red }) + Span('I am Upper-span').fontSize(12) + .textCase(TextCase.UpperCase) + .decoration({ type: TextDecorationType.None }) } }.width('100%').height(250).padding({ left: 35, right: 35, top: 35 }) } } ``` -![en-us_image_0000001257138363](figures/en-us_image_0000001257138363.gif) +![span](figures/span.png) diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-text.md b/en/application-dev/reference/arkui-ts/ts-basic-components-text.md index 67eedfeb76158d1cd94e57196811406d46dcbf3b..d20ad37b35f6184fb9f3c2b9b626d232fa6a3a6a 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-text.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-text.md @@ -2,7 +2,7 @@ The **\** component is used to display a piece of textual information. -> **NOTE**
+> **NOTE** > > This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. @@ -16,6 +16,8 @@ This component can contain the [\](ts-basic-components-span.md) child comp Text(content?: string | Resource) +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name| Type| Mandatory| Description| @@ -28,17 +30,19 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name | Type | Description | | ----------------------- | ----------------------------------- | ------------------------------------------- | -| textAlign | [TextAlign](ts-appendix-enums.md#textalign) | Horizontal alignment mode of the text.
Default value: **TextAlign.Start**
**NOTE**
The text takes up the full width of the **\** component. To set the vertical alignment for the text, use the [align](ts-universal-attributes-location.md) attribute.| -| textOverflow | {overflow: [TextOverflow](ts-appendix-enums.md#textoverflow)} | Display mode when the text is too long.
Default value: **{overflow: TextOverflow.Clip}**
**NOTE**
Text is clipped at the transition between words. To clip text in the middle of a word, add **\u200B** between characters.
This attribute must be used with `maxLines` to take effect. | -| maxLines | number | Maximum number of lines in the text.
Default value: **Infinity**
**NOTE**
By default, text is automatically folded. If this attribute is specified, the text will not exceed the specified number of lines. If there is extra text, you can use **textOverflow** to specify how it is displayed. | -| lineHeight | string \| number \| [Resource](ts-types.md#resource) | Text line height. If the value is less than or equal to **0**, the line height is not limited and the font size is adaptive. If the value of the number type, the unit fp is used.| -| decoration | {
type: [TextDecorationType](ts-appendix-enums.md#textdecorationtype),
color?: [ResourceColor](ts-types.md#resourcecolor)
} | Style and color of the text decorative line.
Default value: {
type: TextDecorationType.None,
color: Color.Black
} | -| baselineOffset | number \| string | Baseline offset of the text. The default value is **0**. | -| letterSpacing | number \| string | Letter spacing. | -| minFontSize | number \| string \| [Resource](ts-types.md#resource) | Minimum font size.
For the setting to take effect, this attribute must be used together with **maxFontSize**, **maxline**, or a layout size constraint. | -| maxFontSize | number \| string \| [Resource](ts-types.md#resource) | Maximum font size.
For the setting to take effect, this attribute must be used together with **minFontSize**, **maxline**, or a layout size constraint. | -| textCase | [TextCase](ts-appendix-enums.md#textcase) | Text case.
Default value: **TextCase.Normal**| -| copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.
Default value: **CopyOptions.None**| +| textAlign | [TextAlign](ts-appendix-enums.md#textalign) | Horizontal alignment mode of the text.
Default value: **TextAlign.Start**
**NOTE**
The text takes up the full width of the **\** component. To set the vertical alignment for the text, use the [align](ts-universal-attributes-location.md) attribute.
Since API version 9, this API is supported in ArkTS widgets.| +| textOverflow | {overflow: [TextOverflow](ts-appendix-enums.md#textoverflow)} | Display mode when the text is too long.
Default value: **{overflow: TextOverflow.Clip}**
**NOTE**
Text is clipped at the transition between words. To clip text in the middle of a word, add **\u200B** between characters.
This attribute must be used with **maxLines** to take effect.
Since API version 9, this API is supported in ArkTS widgets. | +| maxLines | number | Maximum number of lines in the text.
Default value: **Infinity**
**NOTE**
By default, text is automatically folded. If this attribute is specified, the text will not exceed the specified number of lines. If there is extra text, you can use **textOverflow** to specify how it is displayed.
Since API version 9, this API is supported in ArkTS widgets. | +| lineHeight | string \| number \| [Resource](ts-types.md#resource) | Text line height. If the value is less than or equal to **0**, the line height is not limited and the font size is adaptive. If the value of the number type, the unit fp is used.
Since API version 9, this API is supported in ArkTS widgets.| +| decoration | {
type: [TextDecorationType](ts-appendix-enums.md#textdecorationtype),
color?: [ResourceColor](ts-types.md#resourcecolor)
} | Style and color of the text decorative line.
Default value: {
type: TextDecorationType.None,
color: Color.Black
}
Since API version 9, this API is supported in ArkTS widgets.| +| baselineOffset | number \| string | Baseline offset of the text. The default value is **0**.
Since API version 9, this API is supported in ArkTS widgets. | +| letterSpacing | number \| string | Letter spacing.
Since API version 9, this API is supported in ArkTS widgets. | +| minFontSize | number \| string \| [Resource](ts-types.md#resource) | Minimum font size.
For the setting to take effect, this attribute must be used together with **maxFontSize**, **maxLines**, or layout constraint settings.
Since API version 9, this API is supported in ArkTS widgets. | +| maxFontSize | number \| string \| [Resource](ts-types.md#resource) | Maximum font size.
For the setting to take effect, this attribute must be used together with **minFontSize**, **maxLines**, or layout constraint settings.
Since API version 9, this API is supported in ArkTS widgets. | +| textCase | [TextCase](ts-appendix-enums.md#textcase) | Text case.
Default value: **TextCase.Normal**
Since API version 9, this API is supported in ArkTS widgets.| +| copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.
Default value: **CopyOptions.None**
This API is supported in ArkTS widgets.| +| textShadow10+ | [ShadowOptions](ts-universal-attributes-image-effect.md#shadowoptions) | Text shadow.| +| heightAdaptivePolicy10+ | [TextHeightAdaptivePolicy](ts-appendix-enums.md#TextHeightAdaptivePolicy10) | How the adaptive height is determined for the text.| > **NOTE** > diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md b/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md index bc16a8dd1638b0ad7e1538891707422c60d7ad2b..244b6990bba8d9ccc0817e5eb96b8769d38530df 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md @@ -20,8 +20,8 @@ TextArea(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: Tex | Name | Type | Mandatory | Description | | ----------------------- | ---------------------------------------- | ---- | -------------- | -| placeholder | [ResourceStr](ts-types.md#resourcestr) | No | Placeholder text displayed when there is no input. | -| text | [ResourceStr](ts-types.md#resourcestr) | No | Current text input. | +| placeholder | [ResourceStr](ts-types.md#resourcestr) | No | Placeholder text displayed when there is no input. It is not displayed once there is any input. | +| text | [ResourceStr](ts-types.md#resourcestr) | No | Current text input.
If the component has [stateStyles](ts-universal-attributes-polymorphic-style.md) or any other attribute that may trigger updating configured, you are advised to bind the state variable to the text in real time through the **onChange** event,
so as to prevent display errors when the component is updated. | | controller8+ | [TextAreaController](#textareacontroller8) | No | Text area controller.| @@ -29,26 +29,31 @@ TextArea(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: Tex In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported. -| Name | Type | Description | -| ------------------------ | ---------------------------------------- | ---------------------------------------- | -| placeholderColor | [ResourceColor](ts-types.md#resourcecolor) | Placeholder text color. | -| placeholderFont | [Font](ts-types.md#font) | Placeholder text style. | -| textAlign | [TextAlign](ts-appendix-enums.md#textalign) | Horizontal alignment of the text.
Default value: **TextAlign.Start**| -| caretColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the caret in the text box. | +| Name | Type | Description | +| ------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| placeholderColor | [ResourceColor](ts-types.md#resourcecolor) | Placeholder text color. | +| placeholderFont | [Font](ts-types.md#font) | Placeholder text style, including the font size, font width, font family, and font style. Currently, only the default font family is supported.| +| textAlign | [TextAlign](ts-appendix-enums.md#textalign) | Horizontal alignment of the text.
Default value: **TextAlign.Start**| +| caretColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the caret in the text box. | | inputFilter8+ | {
value: [ResourceStr](ts-types.md#resourcestr),
error?: (value: string) => void
} | Regular expression for input filtering. Only inputs that comply with the regular expression can be displayed. Other inputs are filtered out. The specified regular expression can match single characters, but not strings.
- **value**: regular expression to set.
- **error**: filtered-out content to return when regular expression matching fails.| -| copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.| +| copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.
If this attribute is set to **CopyOptions.None**, the paste operation is allowed, but not the copy or cut operation.| + +> **NOTE** +> +> The default value of the universal attribute [padding](ts-universal-attributes-size.md) is as follows:
{
top: 8 vp,
right: 16 vp,
bottom: 8 vp,
left: 16 vp
} ## Events In addition to the [universal events](ts-universal-events-click.md), the following events are supported. -| Name | Description | +| Name | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | -| onChange(callback: (value: string) => void) | Triggered when the input in the text box changes.
- **value**: text entered. | -| onCopy8+(callback:(value: string) => void) | Triggered when the copy button on the pasteboard, which displays when the text box is long pressed, is clicked.
- **value**: text to be copied.| -| onCut8+(callback:(value: string) => void) | Triggered when the cut button on the pasteboard, which displays when the text box is long pressed, is clicked.
- **value**: text to be cut.| -| onPaste8+(callback:(value: string) => void) | Triggered when the paste button on the pasteboard, which displays when the text box is long pressed, is clicked.
- **value**: text to be pasted.| +| onChange(callback: (value: string) => void) | Triggered when the input in the text box changes.
- **value**: text entered. | +| onEditChange(callback: (isEditing: boolean) => void)10+ | Triggered when the input status changes. When the cursor is placed in the text box, it is in the editing state. Otherwise, it is in the non-editing state. If the value of **isEditing** is **true**, text input is in progress. | +| onCopy8+(callback:(value: string) => void) | Triggered when the copy button on the pasteboard, which displays when the text box is long pressed, is clicked.
- **value**: text to be copied. | +| onCut8+(callback:(value: string) => void) | Triggered when the cut button on the pasteboard, which displays when the text box is long pressed, is clicked.
- **value**: text to be cut. | +| onPaste8+(callback:(value: string) => void) | Triggered when the paste button on the pasteboard, which displays when the text box is long pressed, is clicked.
- **value**: text to be pasted. | ## TextAreaController8+ @@ -72,6 +77,18 @@ Sets the position of the caret. | ------ | -------- | ---- | -------------------------------------- | | value | number | Yes | Length from the start of the string to the position where the caret is located.| +### setTextSelection10+ + +setTextSelection(selectionStart: number, selectionEnd: number): void + +Sets the text selection range. + +**Parameters** + +| Name | Type| Mandatory| Description | +| -------------- | -------- | ---- | ------------------ | +| selectionStart | number | Yes | Start of the selection range.| +| selectionEnd | number | Yes | End of the selection range.| ## Example @@ -86,6 +103,7 @@ struct TextAreaExample { build() { Column() { TextArea({ + text: this.text, placeholder: 'The text area can hold an unlimited amount of text. input your word...', controller: this.controller }) diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md b/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md index b7a72430211190079eec4d628a61658bb664bc21..cf42e030a17593607b5d4ff4a5c0711ed9dc22ad 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md @@ -21,7 +21,7 @@ TextInput(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: Te | Name | Type | Mandatory | Description | | ----------------------- | ---------------------------------------- | ---- | --------------- | | placeholder | [ResourceStr](ts-types.md#resourcestr) | No | Placeholder text displayed when there is no input. | -| text | [ResourceStr](ts-types.md#resourcestr) | No | Current text input. | +| text | [ResourceStr](ts-types.md#resourcestr) | No | Current text input.
If the component has [stateStyles](ts-universal-attributes-polymorphic-style.md) or any other attribute that may trigger updating configured, you are advised to bind the state variable to the text in real time through the **onChange** event,
so as to prevent display errors when the component is updated. | | controller8+ | [TextInputController](#textinputcontroller8) | No | Text input controller.| @@ -37,11 +37,18 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | enterKeyType | [EnterKeyType](#enterkeytype) | Type of the Enter key. Currently, only the default value is supported.
Default value: **EnterKeyType.Done**| | caretColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the caret in the text box. | | maxLength | number | Maximum number of characters in the text input. | -| inputFilter8+ | {
value: [ResourceStr](ts-types.md#resourcestr),
error?: (value: string) => void
} | Regular expression for input filtering. Only inputs that comply with the regular expression can be displayed. Other inputs are filtered out. The specified regular expression can match single characters, but not strings.
- **value**: regular expression to set.
- **error**: filtered-out content to return when regular expression matching fails.| -| copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.| +| inputFilter8+ | {
value: [ResourceStr](ts-types.md#resourcestr),
error?: (value: string) => void
} | Regular expression for input filtering. Only inputs that comply with the regular expression can be displayed. Other inputs are filtered out. The regular expression can match single characters, but not strings.
- **value**: regular expression to set.
- **error**: filtered-out content to return when regular expression matching fails.| +| copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.
If this attribute is set to **CopyOptions.None**, the paste operation is allowed, but not the copy or cut operation.| | showPasswordIcon9+ | boolean | Whether to display the show password icon at the end of the password text box.
Default value: **true**| | style9+ | [TextInputStyle](#textinputstyle9) | Text input style.
Default value: **TextInputStyle.Default**| | textAlign9+ | [TextAlign](ts-appendix-enums.md#textalign) | Alignment mode of the text in the text box.
Default value: **TextAlign.Start** | +| selectedBackgroundColor10+ | [ResourceColor](ts-types.md#resourcecolor) | Background color of the selected text.| +| caretStyle10+ | {
width: [Length](ts-types.md#length)
} | Caret style. | +| caretPosition10+ | number | Caret position.| + +> **NOTE** +> +> The default value of the universal attribute [padding](ts-universal-attributes-size.md) is as follows: { top: 8 vp, right: 16 vp, bottom: 8 vp, left: 16 vp } ## EnterKeyType @@ -58,8 +65,8 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name | Description | | ------------------ | ------------- | | Normal | Normal input mode.
The value can contain digits, letters, underscores (_), spaces, and special characters.| -| Password | Password input mode. | -| Email | Email address input mode.| +| Password | Password input mode. The value can contain digits, letters, underscores (_), spaces, and special characters. An eye icon is used to show or hide the password, and the password is hidden behind dots by default.| +| Email | Email address input mode. The value can contain digits, letters, underscores (_), and at signs (@). Only one at sign (@) is allowed.| | Number | Digit input mode. | | PhoneNumber9+ | Phone number input mode.
The value can contain digits, plus signs (+), hyphens (-), asterisks (*), and number signs (#). The length is not limited.| @@ -74,15 +81,15 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the In addition to the [universal events](ts-universal-events-click.md), the following events are supported. -| Name | Description | +| Name | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | -| onChange(callback: (value: string) => void) | Triggered when the input changes.
**value**: text content.| -| onSubmit(callback: (enterKey: EnterKeyType) => void) | Triggered when the Enter key on the keyboard is pressed. The return value is the current type of the Enter key.
**enterKeyType**: type of the Enter key. For details, see [EnterKeyType](#enterkeytype).| -| onEditChanged(callback: (isEditing: boolean) => void)(deprecated) | Triggered when the input status changes. Since API version 8, **onEditChange** is recommended.| -| onEditChange(callback: (isEditing: boolean) => void)8+ | Triggered when the input status changes. If the value of **isEditing** is **true**, text input is in progress. | -| onCopy(callback:(value: string) => void)8+ | Triggered when the copy button on the pasteboard, which displays when the text box is long pressed, is clicked.
**value**: text to be copied.| -| onCut(callback:(value: string) => void)8+ | Triggered when the cut button on the pasteboard, which displays when the text box is long pressed, is clicked.
**value**: text to be cut.| -| onPaste(callback:(value: string) => void)8+ | Triggered when the paste button on the pasteboard, which displays when the text box is long pressed, is clicked.
**value**: text to be pasted.| +| onChange(callback: (value: string) => void) | Triggered when the input changes.
**value**: text content.
This event is triggered when any of the following conditions is met:
1. Keyboard input is received.
2. Paste and cut is performed.
3. Ctrl+V is pressed. | +| onSubmit(callback: (enterKey: EnterKeyType) => void) | Triggered when the Enter key on the keyboard is pressed. The return value is the current type of the Enter key.
**enterKeyType**: type of the Enter key. For details, see [EnterKeyType](#enterkeytype). | +| onEditChanged(callback: (isEditing: boolean) => void)(deprecated) | Triggered when the input status changes. Since API version 8, **onEditChange** is recommended. | +| onEditChange(callback: (isEditing: boolean) => void)8+ | Triggered when the input status changes. When the cursor is placed in the text box, it is in the editing state. Otherwise, it is in the non-editing state. If the value of **isEditing** is **true**, text input is in progress. | +| onCopy(callback:(value: string) => void)8+ | Triggered when the copy button on the pasteboard, which displays when the text box is long pressed, is clicked.
**value**: text to be copied. | +| onCut(callback:(value: string) => void)8+ | Triggered when the cut button on the pasteboard, which displays when the text box is long pressed, is clicked.
**value**: text to be cut. | +| onPaste(callback:(value: string) => void)8+ | Triggered when the paste button on the pasteboard, which displays when the text box is long pressed, is clicked.
**value**: text to be pasted. | ## TextInputController8+ @@ -103,7 +110,18 @@ Sets the position of the caret. | Name| Type| Mandatory| Description | | ------ | -------- | ---- | -------------------------------------- | | value | number | Yes | Length from the start of the string to the position where the caret is located.| +### setTextSelection10+ + +setTextSelection(selectionStart: number, selectionStart: number): void +Sets the text selection area, which will be highlighted. + +**Parameters** + +| Name | Type| Mandatory| Description | +| -------------- | -------- | ---- | ---------------------- | +| selectionStart | number | Yes | Start position of the text selection area. The start position of the text in the text box is 0.| +| selectionEnd | number | Yes | End position of the text selection area.| ## Example @@ -117,7 +135,7 @@ struct TextInputExample { build() { Column() { - TextInput({ placeholder: 'input your word...', controller: this.controller }) + TextInput({ text: this.text, placeholder: 'input your word...', controller: this.controller }) .placeholderColor(Color.Grey) .placeholderFont({ size: 14, weight: 400 }) .caretColor(Color.Blue) @@ -126,6 +144,9 @@ struct TextInputExample { .margin(20) .fontSize(14) .fontColor(Color.Black) + .inputFilter('[a-z]', (e) => { + console.log(JSON.stringify(e)) + }) .onChange((value: string) => { this.text = value }) 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 33a7c78171bc139b35cdb326c91dc9c325f33799..f644f8d30d81df0d011cd05c4f88339edccca5a1 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 @@ -14,7 +14,7 @@ Not supported ## APIs -TextPicker(options?: {range: string[]|Resource, selected?: number, value?: string}) +TextPicker(options?: {range: string[]|Resource|TextPickerRangeContent[], selected?: number, value?: string}) Creates a text picker based on the selection range specified by **range**. @@ -22,15 +22,27 @@ Creates a text picker based on the selection range specified by **range**. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| range | string[] \| [Resource](ts-types.md#resource)| Yes| Data selection range of the picker.| +| range | string[] \| [Resource](ts-types.md#resource)\|[TextPickerRangeContent](#textpickerrangecontent10)[]10+ | Yes| Data selection range of the picker. This parameter cannot be set to an empty array. If set to an empty array, it will not be displayed. If it is dynamically changed to an empty array, the current value remains displayed.| | selected | number | No| Index of the default item in the range.
Default value: **0**| -| value | string | No| Value of the default item in the range. The priority of this parameter is lower than that of **selected**.
Default value: value of the first item| +| value | string | No| Value of the default item in the range. The priority of this parameter is lower than that of **selected**.
Default value: value of the first item
**NOTE**\
This parameter works only for a text list. It does not work for an image list or a list consisting of text and images.| + +## TextPickerRangeContent10+ + +| Name| Type | Mandatory| Description | +| ------ | -------------------------------------------------------- | ---- | ---------- | +| icon | string \| [Resource](ts-types.md#resource) | Yes | Image resource.| +| text | string \| [Resource](ts-types.md#resource) | No | Text information.| ## Attributes +In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported. + | Name| Type| Description| | -------- | -------- | -------- | | defaultPickerItemHeight | number \| string | Height of each item in the picker.| +| disappearTextStyle10+ | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10) | Font color, font size, and font width for the top and bottom items.| +| textStyle10+ | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10) | Font color, font size, and font width of all items except the top, bottom, and selected items.| +| selectedTextStyle10+ | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10) | Font color, font size, and font width of the selected item.| ## Events @@ -38,7 +50,7 @@ In addition to the [universal events](ts-universal-events-click.md), the followi | Name| Description| | -------- | -------- | -| onChange(callback: (value: string, index: number) => void) | Triggered when an item in the picker is selected.
- **value**: value of the selected item.
- **index**: index of the selected item.| +| onChange(callback: (value: string, index: number) => void) | Triggered when an item in the picker is selected.
- **value**: value of the selected item.
**NOTE**
For a text list or a list consisting of text and images, **value** indicates the text value of the selected item. For an image list, **value** is empty.
- **index**: index of the selected item. | ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-timepicker.md b/en/application-dev/reference/arkui-ts/ts-basic-components-timepicker.md index d8ba7caae7fda819684c2b6ac53133c8bbebbacb..831d427ccc5e558a6119408f105a0277a888323b 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-timepicker.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-timepicker.md @@ -1,6 +1,6 @@ # TimePicker -The **\** component allows users to select a time from the given range. +The **\** component allows users to select a time (with the hour and minute) from the given range. > **NOTE** > @@ -20,20 +20,25 @@ Creates a time picker, which is in 24-hour format by default. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| selected | Date | No| Time of the selected item.
Default value: current system time| - +| Name | Type| Mandatory | Description | +| -------- | ---- | ---- | ------------------------ | +| selected | Date | No | Time of the selected item.
Default value: current system time| ## Attributes -| Name| Type| Description| -| -------- | -------- | -------- | -| useMilitaryTime | boolean | Whether to display time in 24-hour format. The value cannot be modified dynamically.
Default value: **false**| +In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported. +| Name | Type | Description | +| -------------------------------- | ---------------------------------------- | ----------------------------------- | +| useMilitaryTime | boolean | Whether to display time in 24-hour format. The value cannot be modified dynamically.
Default value: **false**| +| disappearTextStyle10+ | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10) | Font color, font size, and font width for the top and bottom items. | +| textStyle10+ | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10) | Font color, font size, and font width of all items except the top, bottom, and selected items. | +| selectedTextStyle10+ | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10) | Font color, font size, and font width of the selected item. | ## Events +In addition to the [universal events](ts-universal-events-click.md), the following events are supported. + | Name | Description | | ---------------------------------------- | ----------- | | onChange(callback: (value: TimePickerResult ) => void) | Triggered when a time is selected.| @@ -48,9 +53,6 @@ Creates a time picker, which is in 24-hour format by default. ## Example - -### Time Picker - ```ts // xxx.ets @Entry diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-toggle.md b/en/application-dev/reference/arkui-ts/ts-basic-components-toggle.md index f1f8e0b31d765b58e10b43d23f19ffdab04bac1d..f5acbb698cb3c77954cd8bd51a8e489f3ad2f1d4 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-toggle.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-toggle.md @@ -6,6 +6,10 @@ The **\** component provides a clickable element in the check box, butto > > This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. + + + + ## Child Components This component can contain child components only when **ToggleType** is set to **Button**. @@ -15,6 +19,8 @@ This component can contain child components only when **ToggleType** is set to * Toggle(options: { type: ToggleType, isOn?: boolean }) +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name| Type| Mandatory | Description | @@ -24,26 +30,29 @@ Toggle(options: { type: ToggleType, isOn?: boolean }) ## ToggleType + +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | -------- | ---------------- | -| Checkbox | Check box type.
**NOTE**
The default value of the universal attribute [padding](ts-universal-attributes-size.md) is as follows:
{
top: 14 vp,
right: 6 vp,
bottom: 14 vp,
left: 6 vp
} | +| Checkbox | Check box type.
**NOTE**
The default value of the universal attribute [margin](ts-universal-attributes-size.md) is as follows:
{
top: 12 vp,
right: 12 vp,
bottom: 12 vp,
left: 12 vp
} | | Button | Button type. The set string, if any, will be displayed inside the button. | -| Switch | Switch type.
**NOTE**
The default value of the universal attribute [padding](ts-universal-attributes-size.md) is as follows:
{
top: 12 vp,
right: 12 vp,
bottom: 12 vp,
left: 12 vp
} | +| Switch | Switch type.
**NOTE**
The default value of the universal attribute [margin](ts-universal-attributes-size.md) is as follows:
{
top: 14 vp,
right:6 vp,
bottom: 6 vp,
left: 14 vp
} | ## Attributes | Name | Parameter | Description | | ---------------- | --------------------------- | ---------------------- | -| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | Background color of the component when it is turned on.| -| switchPointColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the circular slider when the component is of the **Switch** type.
**NOTE**
This attribute is valid only when **type** is set to **ToggleType.Switch**. | +| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | Background color of the component when it is turned on.
Since API version 9, this API is supported in ArkTS widgets.| +| switchPointColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the circular slider when the component is of the **Switch** type.
**NOTE**
This attribute is valid only when **type** is set to **ToggleType.Switch**.
Since API version 9, this API is supported in ArkTS widgets.| ## Events | Name| Description| | -------- | -------- | -| onChange(callback: (isOn: boolean) => void) | Triggered when the toggle status changes.| +| onChange(callback: (isOn: boolean) => void) | Triggered when the toggle status changes.
Since API version 9, this API is supported in ArkTS widgets.| ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-web.md b/en/application-dev/reference/arkui-ts/ts-basic-components-web.md index b49036458e4332cc8444996783545d0760ac8bd8..18f30aeadc5faf4b4457df375ea359cf998f7963 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-components-web.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-components-web.md @@ -1,6 +1,6 @@ # Web -The **** component can be used to display web pages. +The **** component can be used to display web pages. It can be used with the [@ohos.web.webview](../apis/js-apis-webview.md) module, which provides APIs for web control. > **NOTE** > @@ -16,29 +16,32 @@ Not supported ## APIs -Web(options: { src: ResourceStr, controller: WebController | WebviewController}) +Web(options: { src: ResourceStr, controller: WebviewController | WebController}) > **NOTE** > > Transition animation is not supported. -> Different **\** components on the same page must be bound to different **WebController**s. +> +> **\** components on a page must be bound to different **WebviewController**s. **Parameters** | Name | Type | Mandatory | Description | | ---------- | ---------------------------------------- | ---- | ------- | -| src | [ResourceStr](ts-types.md) | Yes | Address of a web page resource.| -| controller | [WebController](#webcontroller) \| [WebviewController9+](../apis/js-apis-webview.md#webviewcontroller) | Yes | Controller. | +| src | [ResourceStr](ts-types.md) | Yes | Address of a web page resource. To access local resource files, use the **$rawfile** or **resource** protocol. To load a local resource file in the sandbox outside of the application package, use **file://** to specify the path of the sandbox.| +| controller | [WebviewController9+](../apis/js-apis-webview.md#webviewcontroller) \| [WebController](#webcontroller) | Yes | Controller. **WebController** is deprecated since API version 9. You are advised to use **WebviewController** instead.| **Example** Example of loading online web pages: ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { Web({ src: 'www.example.com', controller: this.controller }) @@ -46,6 +49,8 @@ Web(options: { src: ResourceStr, controller: WebController | WebviewController}) } } ``` + + Example of loading local web pages: ```ts // xxx.ets import web_webview from '@ohos.web.webview' @@ -56,36 +61,77 @@ Web(options: { src: ResourceStr, controller: WebController | WebviewController}) controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { - Web({ src: 'www.example.com', controller: this.controller }) + // Load a local resource file through $rawfile. + Web({ src: $rawfile("index.html"), controller: this.controller }) } } } ``` - Example of loading local web pages: ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { - Web({ src: $rawfile("index.html"), controller: this.controller }) + // Load a local resource file through the resource protocol. + Web({ src: "resource://rawfile/index.html", controller: this.controller }) } } } ``` - ```html - - - - -

Hello World

- - - ``` + Example of loading local resource files in the sandbox: + + 1. Use [globalthis](../../application-models/uiability-data-sync-with-ui.md#using-globalthis-between-uiability-and-page) to obtain the path of the sandbox. + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview' + let url = 'file://' + globalThis.filesDir + '/xxx.html' + + @Entry + @Component + struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController() + build() { + Column() { + // Load the files in the sandbox. + Web({ src: url, controller: this.controller }) + } + } + } + ``` + + 2. Modify the **MainAbility.ts** file. + + The following uses **filesDir** as an example to describe how to obtain the path of the sandbox. For details about how to obtain other paths, see [Obtaining the Application Development Path](../../application-models/application-context-stage.md#obtaining-the-application-development-path). + ```ts + // xxx.ts + import UIAbility from '@ohos.app.ability.UIAbility'; + import web_webview from '@ohos.web.webview'; + + export default class EntryAbility extends UIAbility { + onCreate(want, launchParam) { + // Bind filesDir to the globalThis object to implement data synchronization between the UIAbility component and the UI. + globalThis.filesDir = this.context.filesDir + console.log("Sandbox path is " + globalThis.filesDir) + } + } + ``` + + ```html + + + + +

Hello World

+ + + ``` ## Attributes @@ -107,10 +153,12 @@ Sets whether to enable the DOM Storage API. By default, this feature is disabled ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { Web({ src: 'www.example.com', controller: this.controller }) @@ -136,10 +184,12 @@ Sets whether to enable access to the file system in the application. This settin ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { Web({ src: 'www.example.com', controller: this.controller }) @@ -164,10 +214,12 @@ Sets whether to enable automatic image loading. By default, this feature is enab **Example** ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { Web({ src: 'www.example.com', controller: this.controller }) @@ -180,7 +232,7 @@ Sets whether to enable automatic image loading. By default, this feature is enab ### javaScriptProxy javaScriptProxy(javaScriptProxy: { object: object, name: string, methodList: Array\, - controller: WebController | WebviewController}) + controller: WebviewController | WebController}) Registers a JavaScript object with the window. APIs of this object can then be invoked in the window. The parameters cannot be updated. @@ -191,41 +243,10 @@ Registers a JavaScript object with the window. APIs of this object can then be i | object | object | Yes | - | Object to be registered. Methods can be declared, but attributes cannot. | | name | string | Yes | - | Name of the object to be registered, which is the same as that invoked in the window.| | methodList | Array\ | Yes | - | Methods of the JavaScript object to be registered at the application side. | -| controller | [WebController](#webcontroller) or [WebviewController](../apis/js-apis-webview.md#webviewcontroller) | Yes | - | Controller. | +| controller | [WebviewController9+](../apis/js-apis-webview.md#webviewcontroller) \| [WebController](#webcontroller) | Yes | - | Controller. **WebController** is deprecated since API version 9. You are advised to use **WebviewController** instead.| **Example** - ```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, - }) - } - } - } - ``` ```ts // xxx.ets import web_webview from '@ohos.web.webview' @@ -276,10 +297,12 @@ Sets whether JavaScript scripts can be executed. By default, JavaScript scripts ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { Web({ src: 'www.example.com', controller: this.controller }) @@ -305,10 +328,12 @@ Sets whether to enable loading of HTTP and HTTPS hybrid content can be loaded. B ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() @State mode: MixedMode = MixedMode.All build() { Column() { @@ -335,10 +360,12 @@ Sets whether to enable access to online images through HTTP and HTTPS. By defaul ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { Web({ src: 'www.example.com', controller: this.controller }) @@ -364,10 +391,12 @@ Sets whether to enable zoom gestures. By default, this feature is enabled. ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { Web({ src: 'www.example.com', controller: this.controller }) @@ -393,10 +422,12 @@ Sets whether to load web pages by using the overview mode. By default, this feat ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { Web({ src: 'www.example.com', controller: this.controller }) @@ -422,10 +453,12 @@ Sets whether to enable database access. By default, this feature is disabled. ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { Web({ src: 'www.example.com', controller: this.controller }) @@ -451,10 +484,12 @@ Sets whether to enable geolocation access. By default, this feature is enabled. ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { Web({ src: 'www.example.com', controller: this.controller }) @@ -480,10 +515,12 @@ Sets whether video playback must be started by user gestures. This API is not ap ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() @State access: boolean = true build() { Column() { @@ -500,6 +537,8 @@ multiWindowAccess(multiWindow: boolean) Sets whether to enable the multi-window permission. +Enabling the multi-window permission requires implementation of the **onWindowNew** event. For details about the sample code, see [onWindowNew](#onwindownew9). + **Parameters** | Name | Type | Mandatory | Default Value | Description | @@ -510,14 +549,16 @@ Sets whether to enable the multi-window permission. ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { Web({ src: 'www.example.com', controller: this.controller }) - .multiWindowAccess(true) + .multiWindowAccess(false) } } } @@ -539,10 +580,12 @@ Sets whether to display the horizontal scrollbar, including the default system s ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { Web({ src: 'www.example.com', controller: this.controller }) @@ -590,10 +633,12 @@ Sets whether to display the vertical scrollbar, including the default system scr ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { Web({ src: 'www.example.com', controller: this.controller }) @@ -642,10 +687,12 @@ Sets the cache mode. ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() @State mode: CacheMode = CacheMode.None build() { Column() { @@ -672,10 +719,12 @@ Sets the text zoom ratio of the page. The default value is **100**, which indica ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() @State atio: number = 150 build() { Column() { @@ -702,10 +751,12 @@ Sets the scale factor of the entire page. The default value is 100%. ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() @State percent: number = 100 build() { Column() { @@ -732,10 +783,12 @@ Sets the user agent. ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() @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() { @@ -1182,7 +1235,7 @@ struct WebComponent { } ``` -### allowWindowOpenMethod9+ +### allowWindowOpenMethod10+ allowWindowOpenMethod(flag: boolean) @@ -1196,7 +1249,9 @@ This API opens a new window when [multiWindowAccess](#multiwindowaccess9) is ena The default value of **flag** is subject to the settings of the **persist.web.allowWindowOpenMethod.enabled** system attribute. If this attribute is not set, the default value of **flag** is **false**. -To check the settings of **persist.web.allowWindowOpenMethod.enabled**, run the **hdc shell param get persist.web.allowWindowOpenMethod.enabled** command. If the attribute is set to 0 or does not exist, +To check the settings of **persist.web.allowWindowOpenMethod.enabled**, + +run the **hdc shell param get persist.web.allowWindowOpenMethod.enabled** command. If the attribute is set to 0 or does not exist, you can run the **hdc shell param set persist.web.allowWindowOpenMethod.enabled 1** command to enable it. **Parameters** @@ -1210,19 +1265,89 @@ you can run the **hdc shell param set persist.web.allowWindowOpenMethod.enabled ```ts // xxx.ets import web_webview from '@ohos.web.webview' + // There are two components on the same page. When the WebComponent object opens a new window, the NewWebViewComp object is displayed. + @CustomDialog + struct NewWebViewComp { + controller: CustomDialogController + webviewController1: web_webview.WebviewController + build() { + Column() { + Web({ src: "", controller: this.webviewController1 }) + .javaScriptAccess(true) + .multiWindowAccess(false) + .onWindowExit(()=> { + console.info("NewWebViewComp onWindowExit") + this.controller.close() + }) + } + } + } + @Entry @Component struct WebComponent { controller: web_webview.WebviewController = new web_webview.WebviewController() - @State access: boolean = true - @State multiWindow: boolean = true - @State flag: boolean = true + dialogController: CustomDialogController = null + build() { + Column() { + Web({ src: 'www.example.com', controller: this.controller }) + .javaScriptAccess(true) + // MultiWindowAccess needs to be enabled. + .multiWindowAccess(true) + .allowWindowOpenMethod(true) + .onWindowNew((event) => { + if (this.dialogController) { + this.dialogController.close() + } + let popController:web_webview.WebviewController = new web_webview.WebviewController() + this.dialogController = new CustomDialogController({ + builder: NewWebViewComp({webviewController1: popController}) + }) + this.dialogController.open() + // Return the WebviewController object corresponding to the new window to the kernel. + // If opening a new window is not needed, set the parameter to null when calling the event.handler.setWebController API. + // If the event.handler.setWebController API is not called, the render process will be blocked. + event.handler.setWebController(popController) + }) + } + } + } + ``` + +### mediaOptions10+ + +mediaOptions(options: WebMediaOptions) + +Sets the web-based media playback policy, including the validity period for automatically resuming a paused web audio, and whether the audio of multiple **\** instances in an application is exclusive. + +> **NOTE** +> +> - Audios in the same **\** instance are considered as the same audio. +> - The media playback policy controls videos with an audio track. +> - After the parameter settings are updated, the playback must be started again for the settings to take effect. +> - It is recommended that you set the same **audioExclusive** value for all **\** components. + +**Parameters** + +| Name| Type| Mandatory| Default Value | Description | +| ------ | ----------- | ---- | --------------- | ------------------ | +| options | [WebMediaOptions](#webmediaoptions10) | Yes | {resumeInterval: 0, audioExclusive: true} | Web-based media playback policy. The default value of **resumeInterval** is **0**, indicating that the playback is not automatically resumed.| + +**Example** + + + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry + @Component + struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController() + @State options: WebMediaOptions = {resumeInterval: 10, audioExclusive: true} build() { Column() { Web({ src: 'www.example.com', controller: this.controller }) - .javaScriptAccess(this.access) - .multiWindowAccess(this.multiWindow) - .allowWindowOpenMethod(this.flag) + .mediaOptions(this.options) } } } @@ -1256,10 +1381,12 @@ Called when **alert()** is invoked to display an alert dialog box on the web pag ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { Web({ src: 'www.example.com', controller: this.controller }) @@ -1314,10 +1441,12 @@ Called when this page is about to exit after the user refreshes or closes the pa ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { @@ -1375,10 +1504,12 @@ Called when **confirm()** is invoked by the web page. ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { @@ -1435,10 +1566,12 @@ onPrompt(callback: (event?: { url: string; message: string; value: string; resul ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { @@ -1495,10 +1628,12 @@ Called to notify the host application of a JavaScript console message. ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { @@ -1532,10 +1667,12 @@ onDownloadStart(callback: (event?: { url: string, userAgent: string, contentDisp ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { @@ -1569,10 +1706,12 @@ Called when an error occurs during web page loading. For better results, simplif ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { @@ -1613,10 +1752,12 @@ Called when an HTTP error (the response code is greater than or equal to 400) oc ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { @@ -1664,10 +1805,12 @@ Called when the web page starts to be loaded. This API is called only for the ma ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { @@ -1697,10 +1840,12 @@ Called when the web page loading is complete. This API takes effect only for the ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { @@ -1729,10 +1874,12 @@ Called when the web page loading progress changes. ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { @@ -1761,10 +1908,12 @@ Called when the document title of the web page is changed. ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { @@ -1794,10 +1943,12 @@ Called when loading of the web page is complete. This API is used by an applicat ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { @@ -1826,10 +1977,12 @@ Called when the rendering process exits abnormally. ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { @@ -1865,10 +2018,12 @@ Called to process an HTML form whose input type is **file**, in response to the ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { @@ -1914,10 +2069,12 @@ Called to notify the **\** component of the URL of the loaded resource file ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { @@ -1947,10 +2104,12 @@ Called when the display ratio of this page changes. ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { @@ -1963,11 +2122,12 @@ Called when the display ratio of this page changes. } ``` -### onUrlLoadIntercept +### onUrlLoadIntercept(deprecated) onUrlLoadIntercept(callback: (event?: { data:string | WebResourceRequest }) => boolean) Called when the **\** component is about to access a URL. This API is used to determine whether to block the access, which is allowed by default. +This API is deprecated since API version 10. You are advised to use [onLoadIntercept10+](#onloadintercept10) instead. **Parameters** @@ -1985,10 +2145,12 @@ Called when the **\** component is about to access a URL. This API is used ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { @@ -2024,10 +2186,12 @@ Called when the **\** component is about to access a URL. This API is used ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() responseweb: WebResourceResponse = new WebResourceResponse() heads:Header[] = new Array() @State webdata: string = "\n" + @@ -2095,7 +2259,7 @@ Called when an HTTP authentication request is received. @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() httpAuth: boolean = false build() { @@ -2157,7 +2321,7 @@ Called when an SSL error occurs during resource loading. @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { @@ -2207,12 +2371,12 @@ Called when an SSL client certificate request is received. **Example** ```ts - // xxx.ets + // xxx.ets API9 import web_webview from '@ohos.web.webview' @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { @@ -2244,7 +2408,107 @@ Called when an SSL client certificate request is received. } ``` -### onPermissionRequest9+ + ```ts + // xxx.ets API10 + import web_webview from '@ohos.web.webview' + import bundle from '@ohos.bundle' + + let uri = ""; + + export default class CertManagerService { + private static sInstance: CertManagerService; + private authUri = ""; + + public static getInstance(): CertManagerService { + if (CertManagerService.sInstance == null) { + CertManagerService.sInstance = new CertManagerService(); + } + return CertManagerService.sInstance; + } + + async grantAppPm(callback) { + let message = ''; + // Note: Replace com.example.myapplication with the actual application name. + let bundleInfo = await bundle.getBundleInfo("com.example.myapplication", bundle.BundleFlag.GET_BUNDLE_DEFAULT) + let clientAppUid = bundleInfo.uid + let appUid = clientAppUid.toString() + + // Note: For globalThis.AbilityContext, add globalThis.AbilityContext = this.context to the onCreate function in the MainAbility.ts file. + await globalThis.AbilityContext.startAbilityForResult( + { + bundleName: "com.ohos.certmanager", + abilityName: "MainAbility", + uri: "requestAuthorize", + parameters: { + appUid: appUid, // UID of the requesting application. + } + }) + .then((data) => { + if (!data.resultCode) { + this.authUri = data.want.parameters.authUri; // Value of authUri returned when authorization is successful. + } + }) + message += "after grantAppPm authUri: " + this.authUri; + uri = this.authUri; + callback(message) + } + } + + @Entry + @Component + struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController(); + @State message: string ='Hello World' // message is used for debugging and observation. + certManager = CertManagerService.getInstance(); + + build() { + Row() { + Column() { + Row() { + // Step 1: Perform authorization to obtain the URI. + Button('GrantApp') + .onClick(() => { + this.certManager.grantAppPm((data) => { + this.message = data; + }); + }) + // Step 2: After the authorization, in two-way authentication, the onClientAuthenticationRequest callback is used to send the URI to the web server for authentication. + Button("ClientCertAuth") + .onClick(() => { + this.controller.loadUrl('https://www.example2.com'); // Server website that supports two-way authentication. + }) + } + + Web({ src: 'https://www.example1.com', controller: this.controller }) + .fileAccess(true) + .javaScriptAccess(true) + .domStorageAccess(true) + .onlineImageAccess(true) + + .onClientAuthenticationRequest((event) => { + AlertDialog.show({ + title: 'ClientAuth', + message: 'Text', + confirm: { + value: 'Confirm', + action: () => { + event.handler.confirm(uri); + } + }, + cancel: () => { + event.handler.cancel(); + } + }) + }) + } + } + .width('100%') + .height('100%') + } + } + ``` + +### onPermissionRequest9+ onPermissionRequest(callback: (event?: { request: PermissionRequest }) => void) @@ -2260,10 +2524,12 @@ Called when a permission request is received. ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { Web({ src: 'www.example.com', controller: this.controller }) @@ -2297,7 +2563,7 @@ Called when a permission request is received. onContextMenuShow(callback: (event?: { param: WebContextMenuParam, result: WebContextMenuResult }) => boolean) -Shows a context menu after the user clicks the right mouse button or long presses a specific element, such as an image or a link. +Called when a context menu is displayed after the user clicks the right mouse button or long presses a specific element, such as an image or a link. **Parameters** @@ -2316,10 +2582,12 @@ Shows a context menu after the user clicks the right mouse button or long presse ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { Web({ src: 'www.example.com', controller: this.controller }) @@ -2350,10 +2618,12 @@ Called when the scrollbar of the page scrolls. ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { Web({ src: 'www.example.com', controller: this.controller }) @@ -2370,7 +2640,7 @@ Called when the scrollbar of the page scrolls. onGeolocationShow(callback: (event?: { origin: string, geolocation: JsGeolocation }) => void) -Registers a callback for receiving a request to obtain the geolocation information. +Called when a request to obtain the geolocation information is received. **Parameters** @@ -2383,10 +2653,12 @@ Registers a callback for receiving a request to obtain the geolocation informati ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller:WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { Web({ src:'www.example.com', controller:this.controller }) @@ -2427,10 +2699,12 @@ Called to notify the user that the request for obtaining the geolocation informa ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller:WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { Web({ src:'www.example.com', controller:this.controller }) @@ -2459,10 +2733,12 @@ Called when the component enters full screen mode. ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller:WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() handler: FullScreenExitHandler = null build() { Column() { @@ -2492,10 +2768,12 @@ Called when the component exits full screen mode. ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller:WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() handler: FullScreenExitHandler = null build() { Column() { @@ -2516,7 +2794,9 @@ Called when the component exits full screen mode. onWindowNew(callback: (event: {isAlert: boolean, isUserTrigger: boolean, targetUrl: string, handler: ControllerHandler}) => void) -Registers a callback for window creation. +Called when a new window is created. This API takes effect when **multiWindowAccess** is enabled. +If the **event.handler.setWebController** API is not called, the render process will be blocked. +If opening a new window is not needed, set the parameter to **null** when calling the **event.handler.setWebController** API. **Parameters** @@ -2525,26 +2805,58 @@ Registers a callback for window creation. | isAlert | boolean | Whether to open the target URL in a new window. The value **true** means to open the target URL in a new window, and **false** means to open the target URL in a new tab.| | isUserTrigger | boolean | Whether the creation is triggered by the user. The value **true** means that the creation is triggered by the user, and **false** means the opposite. | | targetUrl | string | Target URL. | -| handler | [ControllerHandler](#controllerhandler9) | **WebController** instance for setting the new window. | +| handler | [ControllerHandler](#controllerhandler9) | **WebviewController** instance for setting the new window. | **Example** ```ts // xxx.ets import web_webview from '@ohos.web.webview' + + // There are two components on the same page. When the WebComponent object opens a new window, the NewWebViewComp object is displayed. + @CustomDialog + struct NewWebViewComp { + controller: CustomDialogController + webviewController1: web_webview.WebviewController + build() { + Column() { + Web({ src: "", controller: this.webviewController1 }) + .javaScriptAccess(true) + .multiWindowAccess(false) + .onWindowExit(()=> { + console.info("NewWebViewComp onWindowExit") + this.controller.close() + }) + } + } + } + @Entry @Component struct WebComponent { controller: web_webview.WebviewController = new web_webview.WebviewController() + dialogController: CustomDialogController = null build() { Column() { - Web({ src:'www.example.com', controller: this.controller }) - .multiWindowAccess(true) - .onWindowNew((event) => { - console.log("onWindowNew...") - var popController: web_webview.WebviewController = new web_webview.WebviewController() - event.handler.setWebController(popController) - }) + Web({ src: 'www.example.com', controller: this.controller }) + .javaScriptAccess(true) + // MultiWindowAccess needs to be enabled. + .multiWindowAccess(true) + .allowWindowOpenMethod(true) + .onWindowNew((event) => { + if (this.dialogController) { + this.dialogController.close() + } + let popController:web_webview.WebviewController = new web_webview.WebviewController() + this.dialogController = new CustomDialogController({ + builder: NewWebViewComp({webviewController1: popController}) + }) + this.dialogController.open() + // Return the WebviewController object corresponding to the new window to the kernel. + // If opening a new window is not needed, set the parameter to null when calling the event.handler.setWebController API. + // If the event.handler.setWebController API is not called, the render process will be blocked. + event.handler.setWebController(popController) + }) } } } @@ -2554,22 +2866,24 @@ Registers a callback for window creation. onWindowExit(callback: () => void) -Registers a callback for window closure. +Called when this window is closed. **Parameters** | Name | Type | Description | | -------- | ---------- | ------------ | -| callback | () => void | Callback invoked when the window closes.| +| callback | () => void | Callback invoked when the window is closed.| **Example** ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller:WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { Web({ src:'www.example.com', controller: this.controller }) @@ -2599,10 +2913,12 @@ Called to notify the caller of the search result on the web page. ```ts // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry @Component struct WebComponent { - controller: WebController = new WebController() + controller: web_webview.WebviewController = new web_webview.WebviewController() build() { Column() { @@ -2685,7 +3001,7 @@ Called when the old page is not displayed and the new page is about to be visibl onInterceptKeyEvent(callback: (event: KeyEvent) => boolean) -Called when the key event is intercepted and before it is consumed by the Webview. +Called when the key event is intercepted and before it is consumed by the webview. **Parameters** @@ -2697,7 +3013,7 @@ Called when the key event is intercepted and before it is consumed by the Webvie | Type | Description | | ------- | ------------------------------------------------------------ | -| boolean | Whether to continue to transfer the key event to the Webview kernel.| +| boolean | Whether to continue to transfer the key event to the webview kernel.| **Example** @@ -2791,6 +3107,120 @@ Called when this web page receives a new favicon. } ``` +### onAudioStateChanged10+ + +onAudioStateChanged(callback: (event: { playing: boolean }) => void) + +Called when the audio playback status changes on the web page. + +**Parameters** + +| Name | Type | Description | +| ------- | ---------------------------------------------- | ----------------------------------- | +| playing | boolean | Audio playback status on the current page. The value **true** means that audio is being played, and **false** means the opposite.| + +**Example** + + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry + @Component + struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController() + @State playing: boolean = false + build() { + Column() { + Web({ src:'www.example.com', controller: this.controller }) + .onAudioStateChanged(event => { + this.playing = event.playing + console.debug('onAudioStateChanged playing: ' + this.playing) + }) + } + } + } + ``` + +### onFirstContentfulPaint10+ + +onFirstContentfulPaint(callback: (event?: { navigationStartTick: number, firstContentfulPaintMs: number }) => void) + +Called when the web page content is first rendered. + +**Parameters** + +| Name | Type | Description | +| -----------------------| -------- | ----------------------------------- | +| navigationStartTick | number | Navigation start time, in microseconds.| +| firstContentfulPaintMs | number | Time between navigation and when the content is first rendered, in milliseconds.| + +**Example** + + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry + @Component + struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController() + + build() { + Column() { + Web({ src:'www.example.com', controller: this.controller }) + .onFirstContentfulPaint(event => { + console.log("onFirstContentfulPaint:" + "[navigationStartTick]:" + + event.navigationStartTick + ", [firstContentfulPaintMs]:" + + event.firstContentfulPaintMs) + }) + } + } + } + ``` + +### onLoadIntercept10+ + +onLoadIntercept(callback: (event?: { data: WebResourceRequest }) => boolean) + +Called when the **\** component is about to access a URL. This API is used to determine whether to block the access, which is allowed by default. + +**Parameters** + +| Name | Type | Description | +| ------- | ---------------------------------------- | --------- | +| request | [Webresourcerequest](#webresourcerequest) | Information about the URL request.| + +**Return value** + +| Type | Description | +| ------- | ------------------------ | +| boolean | Returns **true** if the access is blocked; returns **false** otherwise.| + +**Example** + + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview' + + @Entry + @Component + struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController() + + build() { + Column() { + Web({ src: 'www.example.com', controller: this.controller }) + .onLoadIntercept((event) => { + console.log('url:' + event.data.getRequestUrl()) + console.log('isMainFrame:' + event.data.isMainFrame()) + console.log('isRedirect:' + event.data.isRedirect()) + console.log('isRequestGesture:' + event.data.isRequestGesture()) + return true + }) + } + } + } + ``` + ## ConsoleMessage Implements the **ConsoleMessage** object. For the sample code, see [onConsole](#onconsole). @@ -2845,7 +3275,7 @@ Obtains the path and name of the web page source file. ## JsResult -Implements the **JsResult** object, which indicates the result returned to the **\** component to indicate the user operation performed in the dialog box. For the sample code, see [onAlert Event](#onalert). +Implements the **JsResult** object, which indicates the result returned to the **\** component to indicate the user operation performed in the dialog box. For the sample code, see [onAlert](#onalert). ### handleCancel @@ -2889,13 +3319,13 @@ Implements a **WebviewController** object for new **\** components. For the setWebController(controller: WebviewController): void -Sets a **WebviewController** object. +Sets a **WebviewController** object. If opening a new window is not needed, set the parameter to **null**. **Parameters** | Name | Type | Mandatory | Default Value | Description | | ---------- | ------------- | ---- | ---- | ------------------------- | -| controller | [WebviewController](../apis/js-apis-webview.md#webviewcontroller) | Yes | - | **WebviewController** object of the **\** component.| +| controller | [WebviewController](../apis/js-apis-webview.md#webviewcontroller) | Yes | - | **WebviewController** object of the **\** component. If opening a new window is not needed, set it to **null**.| ## WebResourceError @@ -2989,6 +3419,18 @@ Checks whether the resource request is associated with a gesture (for example, a | ------- | -------------------- | | boolean | Whether the resource request is associated with a gesture (for example, a tap).| +### getRequestMethod9+ + +getRequestMethod(): string + +Obtains the request method. + +**Return value** + +| Type | Description | +| ------- | -------------------- | +| string | Request method.| + ## Header Describes the request/response header returned by the **\** component. @@ -3179,6 +3621,18 @@ Instructs the **\** component to select a file. Implements the **FileSelectorParam** object. For the sample code, see [onShowFileSelector](#onshowfileselector9). +### getTitle9+ + +getTitle(): string + +Obtains the title of this file selector. + +**Return value** + +| Type | Description | +| ------ | -------- | +| string | Title of the file selector.| + ### getMode9+ getMode(): FileSelectorMode @@ -3289,6 +3743,20 @@ Uses the specified private key and client certificate chain. | priKeyFile | string | Yes | File that stores the private key, which is a directory including the file name. | | certChainFile | string | Yes | File that stores the certificate chain, which is a directory including the file name.| +### confirm10+ + +confirm(authUri : string): void + +**Required permissions**: ohos.permission.ACCESS_CERT_MANAGER + +Instructs the **\** component to use the specified credentials (obtained from the certificate management module). + +**Parameters** + +| Name | Type | Mandatory | Description | +| ------- | ------ | ---- | ------------- | +| authUri | string | Yes | Key value of the credentials. | + ### cancel9+ cancel(): void @@ -3588,40 +4056,223 @@ Sets the geolocation permission status of a web page. | allow | boolean | Yes | - | Geolocation permission status. | | retain | boolean | Yes | - | Whether the geolocation permission status can be saved to the system. You can manage the geolocation permissions saved to the system through [GeolocationPermissions9+](../apis/js-apis-webview.md#geolocationpermissions).| -## WebController - -Implements a **WebController** to control the behavior of the **\** component. A **WebController** can control only one **\** component, and the APIs in the **WebController** can be invoked only after it has been bound to the target **\** component. +## MessageLevel -This API is deprecated since API version 9. You are advised to use [WebviewController9+](../apis/js-apis-webview.md#webviewcontroller). +| Name | Description | +| ----- | :---- | +| Debug | Debug level.| +| Error | Error level.| +| Info | Information level.| +| Log | Log level.| +| Warn | Warning level. | -### Creating an Object +## RenderExitReason -``` -webController: WebController = new WebController() -``` +Enumerates the reasons why the rendering process exits. -### requestFocus(deprecated) +| Name | Description | +| -------------------------- | ----------------- | +| ProcessAbnormalTermination | The rendering process exits abnormally. | +| ProcessWasKilled | The rendering process receives a SIGKILL message or is manually terminated.| +| ProcessCrashed | The rendering process crashes due to segmentation or other errors. | +| ProcessOom | The program memory is running low. | +| ProcessExitUnknown | Other reason. | -requestFocus() +## MixedMode -Requests focus for this web page. +| Name | Description | +| ---------- | ---------------------------------- | +| All | HTTP and HTTPS hybrid content can be loaded. This means that all insecure content can be loaded.| +| Compatible | HTTP and HTTPS hybrid content can be loaded in compatibility mode. This means that some insecure content may be loaded. | +| None | HTTP and HTTPS hybrid content cannot be loaded. | -This API is deprecated since API version 9. You are advised to use [requestFocus9+](../apis/js-apis-webview.md#requestfocus). +## CacheMode +| Name | Description | +| ------- | ------------------------------------ | +| Default | The cache that has not expired is used to load the resources. If the resources do not exist in the cache, they will be obtained from the Internet.| +| None | The cache is used to load the resources. If the resources do not exist in the cache, they will be obtained from the Internet. | +| Online | The cache is not used to load the resources. All resources are obtained from the Internet. | +| Only | The cache alone is used to load the resources. | -**Example** +## FileSelectorMode +| Name | Description | +| -------------------- | ---------- | +| FileOpenMode | Open and upload a file. | +| FileOpenMultipleMode | Open and upload multiple files. | +| FileOpenFolderMode | Open and upload a folder.| +| FileSaveMode | Save a file. | - ```ts - // xxx.ets - @Entry - @Component - struct WebComponent { - controller: WebController = new WebController() + ## HitTestType - build() { - Column() { - Button('requestFocus') - .onClick(() => { - this.controller.requestFocus() +| Name | Description | +| ------------- | ------------------------ | +| EditText | Editable area. | +| Email | Email address. | +| HttpAnchor | Hyperlink whose **src** is **http**. | +| HttpAnchorImg | Image with a hyperlink, where **src** is **http**.| +| Img | HTML::img tag. | +| Map | Geographical address. | +| Phone | Phone number. | +| Unknown | Unknown content. | + +## SslError9+ + +Enumerates the error codes returned by **onSslErrorEventReceive** API. + +| Name | Description | +| ------------ | ----------- | +| Invalid | Minor error. | +| HostMismatch | The host name does not match. | +| DateInvalid | The certificate has an invalid date. | +| Untrusted | The certificate issuer is not trusted.| + +## ProtectedResourceType9+ + +| Name | Description | Remarks | +| --------- | ------------- | -------------------------- | +| MidiSysex | MIDI SYSEX resource.| Currently, only permission events can be reported. MIDI devices are not yet supported.| + +## WebDarkMode9+ +| Name | Description | +| ------- | ------------------------------------ | +| Off | The web dark mode is disabled. | +| On | The web dark mode is enabled. | +| Auto | The web dark mode setting follows the system settings. | + +## WebMediaOptions10+ + +Describes the web-based media playback policy. + +| Name | Type | Readable| Writable| Mandatory| Description | +| -------------- | --------- | ---- | ---- | --- | ---------------------------- | +| resumeInterval | number | Yes | Yes | No |Validity period for automatically resuming a paused web audio, in seconds. The maximum validity period is 60 seconds.| +| audioExclusive | boolean | Yes | Yes | No | Whether the audio of multiple **\** instances in an application is exclusive. | + +## DataResubmissionHandler9+ + +Implements the **DataResubmissionHandler** object for resubmitting or canceling the web form data. + +### resend9+ + +resend(): void + +Resends the web form data. + +**Example** + + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry + @Component + struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController() + build() { + Column() { + Web({ src:'www.example.com', controller: this.controller }) + .onDataResubmitted((event) => { + console.log('onDataResubmitted') + event.handler.resend(); + }) + } + } + } + ``` + +### cancel9+ + +cancel(): void + +Cancels the resending of web form data. + +**Example** + + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry + @Component + struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController() + build() { + Column() { + Web({ src:'www.example.com', controller: this.controller }) + .onDataResubmitted((event) => { + console.log('onDataResubmitted') + event.handler.cancel(); + }) + } + } + } + ``` + + ## WebController + +Implements a **WebController** to control the behavior of the **\** component. A **WebController** can control only one **\** component, and the APIs in the **WebController** can be invoked only after it has been bound to the target **\** component. + +This API is deprecated since API version 9. You are advised to use [WebviewController9+](../apis/js-apis-webview.md#webviewcontroller). + +### Creating an Object + +``` +webController: WebController = new WebController() +``` + +### getCookieManager9+ + +getCookieManager(): WebCookie + +Obtains the cookie management object of the **\** component. + +**Return value** + +| Type | Description | +| --------- | ---------------------------------------- | +| WebCookie | Cookie management object. For details, see [WebCookie](#webcookie).| + +**Example** + + ```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 }) + } + } + } + ``` + +### requestFocus(deprecated) + +requestFocus() + +Requests focus for this web page. + +This API is deprecated since API version 9. You are advised to use [requestFocus9+](../apis/js-apis-webview.md#requestfocus). + +**Example** + + ```ts + // xxx.ets + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController() + + build() { + Column() { + Button('requestFocus') + .onClick(() => { + this.controller.requestFocus() }) Web({ src: 'www.example.com', controller: this.controller }) } @@ -3874,39 +4525,6 @@ This API is deprecated since API version 9. You are advised to use [getHitTest9+ -getTitle(): string - -Obtains the title of the current web page. - -**Return value** - -| Type | Description | -| ------ | -------- | -| string | Title of the current web page.| - -**Example** - - ```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 }) - } - } - } - ``` - ### loadData(deprecated) loadData(options: { data: string, mimeType: string, encoding: string, baseUrl?: string, historyUrl?: string }) @@ -4303,53 +4921,21 @@ This API is deprecated since API version 9. You are advised to use [clearHistory } ``` -### getCookieManager9+ - -getCookieManager(): WebCookie - -Obtains the cookie management object of the **\** component. - -**Return value** - -| Type | Description | -| --------- | ---------------------------------------- | -| WebCookie | Cookie management object. For details, see [WebCookie](#webcookie).| - -**Example** - - ```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 }) - } - } - } - ``` - -## WebCookie +## WebCookie(deprecated) Manages behavior of cookies in **\** components. All **\** components in an application share a **WebCookie**. You can use the **getCookieManager** API in **controller** to obtain the **WebCookie** for subsequent cookie management. -### setCookie9+ +### setCookie(deprecated) setCookie(url: string, value: string): boolean Sets the cookie. This API returns the result synchronously. Returns **true** if the operation is successful; returns **false** otherwise. +This API is deprecated since API version 9. You are advised to use [setCookie9+](../apis/js-apis-webview.md#setcookie) instead. **Parameters** | Name | Type | Mandatory | Default Value | Description | | ----- | ------ | ---- | ---- | ----------------- | -| url | string | Yes | - | URL of the cookie to set.| +| url | string | Yes | - | URL of the cookie to set. A complete URL is recommended.| | value | string | Yes | - | Value of the cookie to set. | **Return value** @@ -4371,7 +4957,7 @@ Sets the cookie. This API returns the result synchronously. Returns **true** if Column() { Button('setCookie') .onClick(() => { - let result = this.controller.getCookieManager().setCookie("www.example.com", "a=b") + let result = this.controller.getCookieManager().setCookie("https://www.example.com", "a=b") console.log("result: " + result) }) Web({ src: 'www.example.com', controller: this.controller }) @@ -4379,10 +4965,11 @@ Sets the cookie. This API returns the result synchronously. Returns **true** if } } ``` -### saveCookieSync9+ -saveCookieSync(): boolean +### saveCookie(deprecated) +saveCookie(): boolean Saves the cookies in the memory to the drive. This API returns the result synchronously. +This API is deprecated since API version 9. You are advised to use [saveCookieAsync9+](../apis/js-apis-webview.md#savecookieasync) instead. **Return value** @@ -4401,9 +4988,9 @@ Saves the cookies in the memory to the drive. This API returns the result synchr build() { Column() { - Button('saveCookieSync') + Button('saveCookie') .onClick(() => { - let result = this.controller.getCookieManager().saveCookieSync() + let result = this.controller.getCookieManager().saveCookie() console.log("result: " + result) }) Web({ src: 'www.example.com', controller: this.controller }) @@ -4411,144 +4998,3 @@ Saves the cookies in the memory to the drive. This API returns the result synchr } } ``` - -## MessageLevel - -| Name | Description | -| ----- | :---- | -| Debug | Debug level.| -| Error | Error level.| -| Info | Information level.| -| Log | Log level.| -| Warn | Warning level. | - -## RenderExitReason - -Enumerates the reasons why the rendering process exits. - -| Name | Description | -| -------------------------- | ----------------- | -| ProcessAbnormalTermination | The rendering process exits abnormally. | -| ProcessWasKilled | The rendering process receives a SIGKILL message or is manually terminated.| -| ProcessCrashed | The rendering process crashes due to segmentation or other errors. | -| ProcessOom | The program memory is running low. | -| ProcessExitUnknown | Other reason. | - -## MixedMode - -| Name | Description | -| ---------- | ---------------------------------- | -| All | HTTP and HTTPS hybrid content can be loaded. This means that all insecure content can be loaded.| -| Compatible | HTTP and HTTPS hybrid content can be loaded in compatibility mode. This means that some insecure content may be loaded. | -| None | HTTP and HTTPS hybrid content cannot be loaded. | - -## CacheMode -| Name | Description | -| ------- | ------------------------------------ | -| Default | The cache that has not expired is used to load the resources. If the resources do not exist in the cache, they will be obtained from the Internet.| -| None | The cache is used to load the resources. If the resources do not exist in the cache, they will be obtained from the Internet. | -| Online | The cache is not used to load the resources. All resources are obtained from the Internet. | -| Only | The cache alone is used to load the resources. | - -## FileSelectorMode -| Name | Description | -| -------------------- | ---------- | -| FileOpenMode | Open and upload a file. | -| FileOpenMultipleMode | Open and upload multiple files. | -| FileOpenFolderMode | Open and upload a folder.| -| FileSaveMode | Save a file. | - - ## HitTestType - -| Name | Description | -| ------------- | ------------------------ | -| EditText | Editable area. | -| Email | Email address. | -| HttpAnchor | Hyperlink whose **src** is **http**. | -| HttpAnchorImg | Image with a hyperlink, where **src** is **http**.| -| Img | HTML::img tag. | -| Map | Geographical address. | -| Phone | Phone number. | -| Unknown | Unknown content. | - -## SslError9+ - -Enumerates the error codes returned by **onSslErrorEventReceive** API. - -| Name | Description | -| ------------ | ----------- | -| Invalid | Minor error. | -| HostMismatch | The host name does not match. | -| DateInvalid | The certificate has an invalid date. | -| Untrusted | The certificate issuer is not trusted.| - -## ProtectedResourceType9+ - -| Name | Description | Remarks | -| --------- | ------------- | -------------------------- | -| MidiSysex | MIDI SYSEX resource.| Currently, only permission events can be reported. MIDI devices are not yet supported.| - -## WebDarkMode9+ -| Name | Description | -| ------- | ------------------------------------ | -| Off | The web dark mode is disabled. | -| On | The web dark mode is enabled. | -| Auto | The web dark mode setting follows the system settings. | - -## DataResubmissionHandler9+ - -Implements the **DataResubmissionHandler** object for resubmitting or canceling the web form data. - -### resend9+ - -resend(): void - -Resends the web form data. - -**Example** - - ```ts - // xxx.ets - import web_webview from '@ohos.web.webview' - @Entry - @Component - struct WebComponent { - controller: web_webview.WebviewController = new web_webview.WebviewController() - build() { - Column() { - Web({ src:'www.example.com', controller: this.controller }) - .onDataResubmitted((event) => { - console.log('onDataResubmitted') - event.handler.resend(); - }) - } - } - } - ``` - -### cancel9+ - -cancel(): void - -Cancels the resending of web form data. - -**Example** - - ```ts - // xxx.ets - import web_webview from '@ohos.web.webview' - @Entry - @Component - struct WebComponent { - controller: web_webview.WebviewController = new web_webview.WebviewController() - build() { - Column() { - Web({ src:'www.example.com', controller: this.controller }) - .onDataResubmitted((event) => { - console.log('onDataResubmitted') - event.handler.cancel(); - }) - } - } - } - ``` diff --git a/en/application-dev/reference/arkui-ts/ts-basic-gestures-pangesture.md b/en/application-dev/reference/arkui-ts/ts-basic-gestures-pangesture.md index 4b8520cfa0e7a2b173eda68caa17d379f5c42759..e1e0af8f5fa486e762f569c7a9f1f628147f9e64 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-gestures-pangesture.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-gestures-pangesture.md @@ -17,7 +17,7 @@ PanGesture(value?: { fingers?: number; direction?: PanDirection; distance?: numb | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| fingers | number | No| Minimum number of fingers to trigger a pan gesture. The value ranges from 1 to 10.
Default value: **1**| +| fingers | number | No| Minimum number of fingers to trigger a pan gesture. The value ranges from 1 to 10.
Default value: **1**
Value range: 1 to 10
**NOTE**
If the value is less than 1 or is not set, the default value is used.| | direction | PanDirection | No| Pan direction. The enumerated value supports the AND (&) and OR (\|) operations.
Default value: **PanDirection.All**| | distance | number | No| Minimum pan distance to trigger the gesture, in vp.
Default value: **5**
**NOTE**
If a pan gesture and [tab](ts-container-tabs.md) swipe occur at the same time, set **distance** to **1** so that the gesture can be more easily recognized.| diff --git a/en/application-dev/reference/arkui-ts/ts-basic-gestures-tapgesture.md b/en/application-dev/reference/arkui-ts/ts-basic-gestures-tapgesture.md index 03109744f1cdc09ed7b2d9f7d7687db8944f602f..ef9a851b418959eeb04ed06675815d82a9bd7dc4 100644 --- a/en/application-dev/reference/arkui-ts/ts-basic-gestures-tapgesture.md +++ b/en/application-dev/reference/arkui-ts/ts-basic-gestures-tapgesture.md @@ -1,6 +1,6 @@ # TapGesture -**TapGesture** is used to trigger a tap gesture with one or more taps. +**TapGesture** is used to trigger a tap gesture with one, two, or more taps. > **NOTE** > @@ -15,8 +15,8 @@ TapGesture(value?: { count?: number, fingers?: number }) | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| count | number | No| Number of consecutive taps. If this parameter is set to a value less than **1**, the default value will be used.
Default value: **1**
> **NOTE**
> If multi-tap is configured, the timeout interval between a lift and the next tap is 300 ms.| -| fingers | number | No| Number of fingers required to trigger a tap. The value ranges from 1 to 10.
Default value: **1**
> **NOTE**
> 1. When multi-finger is configured, the gesture will fail to be recognized if the number of fingers used for tapping is less than the configured number within 300 ms of tapping by the first finger.
> 2. The gesture will fail to be recognized if the number of fingers used for tapping exceeds the configured number.| +| count | number | No| Number of consecutive taps. If the value is less than 1 or is not set, the default value is used.
Default value: **1**
**NOTE**
If multi-tap is configured, the timeout interval between a lift and the next tap is 300 ms.| +| fingers | number | No| Number of fingers required to trigger a tap. The value ranges from 1 to 10. If the value is less than 1 or is not set, the default value is used.
Default value: **1**
**NOTE**
1. When multi-finger is configured, if the number of fingers used for tap does not reach the specified number within 300 ms after the first finger is tapped, the gesture fails to be recognized.
2. Gesture recognition fails if the number of fingers used for tap exceeds the configured number.| ## Events diff --git a/en/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md b/en/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md index 9f858f23a76619be4d0a0e2368a8724ee0fb2ddc..765bafdcd9cb284148d243bc45f18b224f458fb0 100644 --- a/en/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md +++ b/en/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md @@ -683,7 +683,7 @@ Fills a rectangle on the canvas. .height('100%') .backgroundColor('#ffff00') .onReady(() =>{ - this.context.fillRect(0,30,100,100) + this.context.fillRect(30,30,100,100) }) } .width('100%') @@ -1666,10 +1666,15 @@ struct Clip { .backgroundColor('#ffff00') .onReady(() =>{ let region = new Path2D() - region.rect(80,10,20,130) - region.rect(40,50,100,50) + region.moveTo(30, 90) + region.lineTo(110, 20) + region.lineTo(240, 130) + region.lineTo(60, 130) + region.lineTo(190, 20) + region.lineTo(270, 90) + region.closePath() this.context.clip(region,"evenodd") - this.context.fillStyle = "rgb(255,0,0)" + this.context.fillStyle = "rgb(0,255,0)" this.context.fillRect(0, 0, this.context.width, this.context.height) }) } @@ -1918,6 +1923,8 @@ setTransform(transform?: Matrix2D): void Resets the current transformation to the identity matrix, and then creates a new transformation matrix based on the specified **Matrix2D** object. This API is a void API. +Since API version 9, this API is supported in ArkTS widgets. + ### translate @@ -1973,6 +1980,8 @@ drawImage(image: ImageBitmap | PixelMap, sx: number, sy: number, sw: number, sh: Draws an image on the canvas. +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name | Type | Mandatory | Default Value | Description | @@ -2349,6 +2358,8 @@ toDataURL(type?: string, quality?: number): string Generates a URL containing image display information. +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name | Type | Mandatory | Description | diff --git a/en/application-dev/reference/arkui-ts/ts-components-canvas-canvas.md b/en/application-dev/reference/arkui-ts/ts-components-canvas-canvas.md index 82628d7048635b4d907c1b933130abc44a40f938..769ac6cfbc8cef5eb1d07376e29f79fea3794915 100644 --- a/en/application-dev/reference/arkui-ts/ts-components-canvas-canvas.md +++ b/en/application-dev/reference/arkui-ts/ts-components-canvas-canvas.md @@ -14,6 +14,8 @@ Not supported Canvas(context?: CanvasRenderingContext2D) +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name | Type | Mandatory | Default Value | Description | @@ -30,7 +32,7 @@ In addition to the [universal events](ts-universal-events-click.md), the followi | Name | Parameter | Description | | ----------------------------- | ---- | -------------------- | -| onReady(event: () => void) | - | Triggered when a canvas is ready. When this event is triggered, the width and height of the canvas can be obtained, and you can use the canvas APIs to draw images.| +| onReady(event: () => void) | - | Triggered when a canvas is ready. When this event is triggered, the width and height of the canvas can be obtained, and you can use the canvas APIs to draw images.
Since API version 9, this API is supported in ArkTS widgets.| **Example** diff --git a/en/application-dev/reference/arkui-ts/ts-components-canvas-canvasgradient.md b/en/application-dev/reference/arkui-ts/ts-components-canvas-canvasgradient.md index 7c8b95655a9470ea7fd1951132f7b2c7974a45da..3dfd9e208ee1de61b82e2509041469caeef030a9 100644 --- a/en/application-dev/reference/arkui-ts/ts-components-canvas-canvasgradient.md +++ b/en/application-dev/reference/arkui-ts/ts-components-canvas-canvasgradient.md @@ -14,6 +14,8 @@ addColorStop(offset: number, color: string): void Adds a color stop for the **CanvasGradient** object based on the specified offset and gradient color. +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** diff --git a/en/application-dev/reference/arkui-ts/ts-components-canvas-imagebitmap.md b/en/application-dev/reference/arkui-ts/ts-components-canvas-imagebitmap.md index 2de092ebab7c87d6e21d5fede32ec6c7e7a0f9b5..d6bc06bd61f2de584dc111bdc51a46ea44a94778 100644 --- a/en/application-dev/reference/arkui-ts/ts-components-canvas-imagebitmap.md +++ b/en/application-dev/reference/arkui-ts/ts-components-canvas-imagebitmap.md @@ -2,9 +2,21 @@ An **ImageBitmap** object stores pixel data rendered on a canvas. -> **NOTE** -> -> The APIs of this module are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. +> **NOTE** +> +> The APIs of this module are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. + +## APIs + +ImageBitmap(src: string) + +Since API version 9, this API is supported in ArkTS widgets. + +**Parameters** + +| Name| Type| Mandatory| Default Value| Description | +| ------ | -------- | ---- | ------ | ------------------------------------------------------------ | +| src | string | Yes | - | Image source.
**NOTE**
ArkTS widgets do not support the **http://**, **datashare://**, or **file://data/storage** path prefixes.| @@ -12,8 +24,8 @@ An **ImageBitmap** object stores pixel data rendered on a canvas. | Name| Type| Description| | -------- | -------- | -------- | -| width | number | Pixel width of the **ImageBitmap** object.| -| height | number | Pixel height of the **ImageBitmap** object.| +| width | number | Pixel width of the **ImageBitmap** object.
Since API version 9, this API is supported in ArkTS widgets.| +| height | number | Pixel height of the **ImageBitmap** object.
Since API version 9, this API is supported in ArkTS widgets.| **Example** @@ -54,3 +66,5 @@ An **ImageBitmap** object stores pixel data rendered on a canvas. close() Releases all graphics resources associated with this **ImageBitmap** object. This API is a void API. + +Since API version 9, this API is supported in ArkTS widgets. diff --git a/en/application-dev/reference/arkui-ts/ts-components-canvas-imagedata.md b/en/application-dev/reference/arkui-ts/ts-components-canvas-imagedata.md index a0e91d8853652b63091559dc7cea73df658a2920..7e03641e1383e7df649a64c9a579808840953650 100644 --- a/en/application-dev/reference/arkui-ts/ts-components-canvas-imagedata.md +++ b/en/application-dev/reference/arkui-ts/ts-components-canvas-imagedata.md @@ -12,9 +12,9 @@ An **ImageData** object stores pixel data rendered on a canvas. | Name| Type| Description| | -------- | -------- | -------- | -| width | number | Actual width of the rectangle on the canvas, in pixels.| -| height | number | Actual height of the rectangle on the canvas, in pixels.| -| data | Uint8ClampedArray | A one-dimensional array of color values. The values range from 0 to 255.| +| width | number | Actual width of the rectangle on the canvas, in pixels.
Since API version 9, this API is supported in ArkTS widgets.| +| height | number | Actual height of the rectangle on the canvas, in pixels.
Since API version 9, this API is supported in ArkTS widgets.| +| data | Uint8ClampedArray | A one-dimensional array of color values. The values range from 0 to 255.
Since API version 9, this API is supported in ArkTS widgets.| > **NOTE** > diff --git a/en/application-dev/reference/arkui-ts/ts-components-canvas-path2d.md b/en/application-dev/reference/arkui-ts/ts-components-canvas-path2d.md index 9e783167f160f8cdb627d33abaad0ac4212be081..eedbf1762231bd583008cc4ed96bbc544bbb2a63 100644 --- a/en/application-dev/reference/arkui-ts/ts-components-canvas-path2d.md +++ b/en/application-dev/reference/arkui-ts/ts-components-canvas-path2d.md @@ -14,13 +14,15 @@ addPath(path: path2D, transform?:Matrix2D): void Adds a path to this path. +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** - | Name| Type| Mandatory| Default Value| Description| - | -------- | -------- | -------- | -------- | -------- | - | path | path2D | Yes| - | Path to be added to this path.| - | transform | Matrix2D | No| null | Transformation matrix of the new path.| - +| Name| Type| Mandatory| Default Value| Description| +| -------- | -------- | -------- | -------- | -------- | +| path | path2D | Yes| - | Path to be added to this path.| +| transform | Matrix2D | No| null | Transformation matrix of the new path.| + **Example** @@ -61,6 +63,8 @@ closePath(): void Moves the current point of the path back to the start point of the path, and draws a straight line between the current point and the start point. If the shape has already been closed or has only one point, this method does nothing. +Since API version 9, this API is supported in ArkTS widgets. + **Example** ```ts @@ -101,12 +105,14 @@ moveTo(x: number, y: number): void Moves the current coordinate point of the path to the target point, without drawing a line during the movement. +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** - | Name| Type| Mandatory| Default Value| Description| - | -------- | -------- | -------- | -------- | -------- | - | x | number | Yes| 0 | X-coordinate of the target point.| - | y | number | Yes| 0 | Y-coordinate of the target point.| +| Name| Type| Mandatory| Default Value| Description| +| -------- | -------- | -------- | -------- | -------- | +| x | number | Yes| 0 | X-coordinate of the target point.| +| y | number | Yes| 0 | Y-coordinate of the target point.| **Example** @@ -148,12 +154,14 @@ lineTo(x: number, y: number): void Draws a straight line from the current point to the target point. +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** - | Name| Type| Mandatory| Default Value| Description| - | -------- | -------- | -------- | -------- | -------- | - | x | number | Yes| 0 | X-coordinate of the target point.| - | y | number | Yes| 0 | Y-coordinate of the target point.| +| Name| Type| Mandatory| Default Value| Description| +| -------- | -------- | -------- | -------- | -------- | +| x | number | Yes| 0 | X-coordinate of the target point.| +| y | number | Yes| 0 | Y-coordinate of the target point.| **Example** @@ -196,16 +204,18 @@ bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, Draws a cubic bezier curve on the canvas. +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** - | Name| Type| Mandatory| Default Value| Description| - | -------- | -------- | -------- | -------- | -------- | - | cp1x | number | Yes| 0 | X-coordinate of the first parameter of the bezier curve.| - | cp1y | number | Yes| 0 | Y-coordinate of the first parameter of the bezier curve.| - | cp2x | number | Yes| 0 | X-coordinate of the second parameter of the bezier curve.| - | cp2y | number | Yes| 0 | Y-coordinate of the second parameter of the bezier curve.| - | x | number | Yes| 0 | X-coordinate of the end point on the bezier curve.| - | y | number | Yes| 0 | Y-coordinate of the end point on the bezier curve.| +| Name| Type| Mandatory| Default Value| Description| +| -------- | -------- | -------- | -------- | -------- | +| cp1x | number | Yes| 0 | X-coordinate of the first parameter of the bezier curve.| +| cp1y | number | Yes| 0 | Y-coordinate of the first parameter of the bezier curve.| +| cp2x | number | Yes| 0 | X-coordinate of the second parameter of the bezier curve.| +| cp2y | number | Yes| 0 | Y-coordinate of the second parameter of the bezier curve.| +| x | number | Yes| 0 | X-coordinate of the end point on the bezier curve.| +| y | number | Yes| 0 | Y-coordinate of the end point on the bezier curve.| **Example** @@ -245,14 +255,16 @@ quadraticCurveTo(cpx: number, cpy: number, x: number ,y: number): void Draws a quadratic curve on the canvas. +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** - | Name| Type| Mandatory| Default Value| Description| - | -------- | -------- | -------- | -------- | -------- | - | cpx | number | Yes| 0 | X-coordinate of the bezier curve parameter.| - | cpy | number | Yes| 0 | Y-coordinate of the bezier curve parameter.| - | x | number | Yes| 0 | X-coordinate of the end point on the bezier curve.| - | y | number | Yes| 0 | Y-coordinate of the end point on the bezier curve.| +| Name| Type| Mandatory| Default Value| Description| +| -------- | -------- | -------- | -------- | -------- | +| cpx | number | Yes| 0 | X-coordinate of the bezier curve parameter.| +| cpy | number | Yes| 0 | Y-coordinate of the bezier curve parameter.| +| x | number | Yes| 0 | X-coordinate of the end point on the bezier curve.| +| y | number | Yes| 0 | Y-coordinate of the end point on the bezier curve.| **Example** @@ -292,16 +304,18 @@ arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, Draws an arc on the canvas. +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** - | Name| Type| Mandatory| Default Value| Description| - | -------- | -------- | -------- | -------- | -------- | - | x | number | Yes| 0 | X-coordinate of the center point of the arc.| - | y | number | Yes| 0 | Y-coordinate of the center point of the arc.| - | radius | number | Yes| 0 | Radius of the arc.| - | startAngle | number | Yes| 0 | Start radian of the arc.| - | endAngle | number | Yes| 0 | End radian of the arc.| - | counterclockwise | boolean | No| false | Whether to draw the arc counterclockwise.| +| Name| Type| Mandatory| Default Value| Description| +| -------- | -------- | -------- | -------- | -------- | +| x | number | Yes| 0 | X-coordinate of the center point of the arc.| +| y | number | Yes| 0 | Y-coordinate of the center point of the arc.| +| radius | number | Yes| 0 | Radius of the arc.| +| startAngle | number | Yes| 0 | Start radian of the arc.| +| endAngle | number | Yes| 0 | End radian of the arc.| +| counterclockwise | boolean | No| false | Whether to draw the arc counterclockwise.| **Example** @@ -340,15 +354,17 @@ arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void Draws an arc based on the radius and points on the arc. +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** - | Name| Type| Mandatory| Default Value| Description| - | -------- | -------- | -------- | -------- | -------- | - | x1 | number | Yes| 0 | X-coordinate of the first point on the arc.| - | y1 | number | Yes| 0 | Y-coordinate of the first point on the arc.| - | x2 | number | Yes| 0 | X-coordinate of the second point on the arc.| - | y2 | number | Yes| 0 | Y-coordinate of the second point on the arc.| - | radius | number | Yes| 0 | Radius of the arc.| +| Name| Type| Mandatory| Default Value| Description| +| -------- | -------- | -------- | -------- | -------- | +| x1 | number | Yes| 0 | X-coordinate of the first point on the arc.| +| y1 | number | Yes| 0 | Y-coordinate of the first point on the arc.| +| x2 | number | Yes| 0 | X-coordinate of the second point on the arc.| +| y2 | number | Yes| 0 | Y-coordinate of the second point on the arc.| +| radius | number | Yes| 0 | Radius of the arc.| **Example** @@ -387,18 +403,20 @@ ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number Draws an ellipse in the specified rectangular region on the canvas. +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** - | Name| Type| Mandatory| Default Value| Description| - | -------- | -------- | -------- | -------- | -------- | - | x | number | Yes| 0 | X-coordinate of the ellipse center.| - | y | number | Yes| 0 | Y-coordinate of the ellipse center.| - | radiusX | number | Yes| 0 | Ellipse radius on the x-axis.| - | radiusY | number | Yes| 0 | Ellipse radius on the y-axis.| - | rotation | number | Yes| 0 | Rotation angle of the ellipse. The unit is radian.| - | startAngle | number | Yes| 0 | Angle of the start point for drawing the ellipse. The unit is radian.| - | endAngle | number | Yes| 0 | Angle of the end point for drawing the ellipse. The unit is radian.| - | counterclockwise | boolean | No| false | Whether to draw the ellipse counterclockwise.
**true**: Draw the ellipse counterclockwise.
**false**: Draw the ellipse clockwise.| +| Name| Type| Mandatory| Default Value| Description| +| -------- | -------- | -------- | -------- | -------- | +| x | number | Yes| 0 | X-coordinate of the ellipse center.| +| y | number | Yes| 0 | Y-coordinate of the ellipse center.| +| radiusX | number | Yes| 0 | Ellipse radius on the x-axis.| +| radiusY | number | Yes| 0 | Ellipse radius on the y-axis.| +| rotation | number | Yes| 0 | Rotation angle of the ellipse. The unit is radian.| +| startAngle | number | Yes| 0 | Angle of the start point for drawing the ellipse. The unit is radian.| +| endAngle | number | Yes| 0 | Angle of the end point for drawing the ellipse. The unit is radian.| +| counterclockwise | boolean | No| false | Whether to draw the ellipse counterclockwise.
**true**: Draw the ellipse counterclockwise.
**false**: Draw the ellipse clockwise.| **Example** @@ -437,14 +455,16 @@ rect(x: number, y: number, w: number, h: number): void Creates a rectangle on the canvas. +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** - | Name| Type| Mandatory| Default Value| Description| - | -------- | -------- | -------- | -------- | -------- | - | x | number | Yes| 0 | X-coordinate of the upper left corner of the rectangle.| - | y | number | Yes| 0 | Y-coordinate of the upper left corner of the rectangle.| - | w | number | Yes| 0 | Width of the rectangle.| - | h | number | Yes| 0 | Height of the rectangle.| +| Name| Type| Mandatory| Default Value| Description| +| -------- | -------- | -------- | -------- | -------- | +| x | number | Yes| 0 | X-coordinate of the upper left corner of the rectangle.| +| y | number | Yes| 0 | Y-coordinate of the upper left corner of the rectangle.| +| w | number | Yes| 0 | Width of the rectangle.| +| h | number | Yes| 0 | Height of the rectangle.| **Example** diff --git a/en/application-dev/reference/arkui-ts/ts-components-summary.md b/en/application-dev/reference/arkui-ts/ts-components-summary.md index e83d70ccecae5afbb194451ca6ccc03de75ad0e6..19bc1f97eec987ec2e7b97f4507b3e8fc107f29d 100644 --- a/en/application-dev/reference/arkui-ts/ts-components-summary.md +++ b/en/application-dev/reference/arkui-ts/ts-components-summary.md @@ -109,7 +109,7 @@ - [Button](ts-basic-components-button.md) - A component that can be used to create different types of buttons. + A component that is used to create different types of buttons. - [Toggle](ts-basic-components-toggle.md) A component that provides a clickable element in the check box, button, or switch type. @@ -231,7 +231,7 @@ - [Canvas](ts-components-canvas-canvas.md) - A component that can be used to customize drawings. + A component that is used to customize drawings. - [Circle](ts-drawing-components-circle.md) A component that is used to draw a circle. @@ -262,10 +262,10 @@ - [Web](ts-basic-components-web.md) - A component that can be used to display web pages. + A component that is used to display web pages. -## Miscellaneous +## Miscellaneous - [ScrollBar](ts-basic-components-scrollbar.md) @@ -288,3 +288,15 @@ - [RemoteWindow](ts-basic-components-remotewindow.md) A component that is used to control the application window, providing the component animator and application window linkage animator during application startup and exit. +- [Formcomponent](ts-basic-components-formcomponent.md) + + A component that is used to display widgets. +- [Menu](ts-basic-components-menu.md) + + A component that is used to present a vertical list of items to the user. +- [MenuItem](ts-basic-components-menuitem.md) + + A component that is used to represent an item in a menu. +- [MenuItemGroup](ts-basic-components-menuitemgroup.md) + + A component that is used to represent a group of menu items. diff --git a/en/application-dev/reference/arkui-ts/ts-container-alphabet-indexer.md b/en/application-dev/reference/arkui-ts/ts-container-alphabet-indexer.md index 0a33bf8135951134bb63fcd80caba5c00b77e683..ed5df7b82fd0f73742ca53af4920172c90398fe5 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-alphabet-indexer.md +++ b/en/application-dev/reference/arkui-ts/ts-container-alphabet-indexer.md @@ -27,8 +27,8 @@ AlphabetIndexer(value: {arrayValue: Array<string>, selected: number}) In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported. -| Name | Type | Description | -| ----------------------- | --------------- | ----------------------------------------------------------- | +| Name | Type | Description | +| ----------------------- | --------------------| ------------------------------------------------------------------| | color | [ResourceColor](ts-types.md#resourcecolor) | Font color.
Default value: **0x99000000** | | selectedColor | [ResourceColor](ts-types.md#resourcecolor) | Font color of the selected text.
Default value: **0xFF254FF7** | | popupColor | [ResourceColor](ts-types.md#resourcecolor) | Font color of the pop-up text.
Default value: **0xFF254FF7** | @@ -39,9 +39,13 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | popupFont | [Font](ts-types.md#font) | Font style of the pop-up text.
Default value:
{
size:10,
style:FontStyle.Normal,
weight:FontWeight.Normal,
family:'HarmonyOS Sans'
} | | font | [Font](ts-types.md#font) | Default font style of the alphabetic index bar.
Default value:
{
size:10,
style:FontStyle.Normal,
weight:FontWeight.Normal,
family:'HarmonyOS Sans'
} | | itemSize | string \| number | Size of an item in the alphabetic index bar. The item is a square, and the side length needs to be set. This attribute cannot be set to a percentage.
Default value: **24.0** | -| alignStyle | IndexerAlign | Alignment style of the alphabetic index bar. Left alignment and right alignment are supported.
Default value: **IndexerAlign.Right**| +| alignStyle | value: [IndexerAlign](#indexeralign),
offset10+?: [Length](ts-types.md#length) | Alignment style of the alphabetic index bar.
**value**: alignment of the alphabetic index bar with the pop-up window, which can be left-aligned or right-aligned.
Default value: **IndexerAlign.Right**
**offset**: spacing between the pop-up window and the alphabetic index bar. A value greater than or equal to 0 is valid. If this attribute is set to a value less than 0 or is not set, the spacing is the same as **popupPosition.x**.| | selected | number | Index of the selected item.
Default value: **0**| | popupPosition | [Position](ts-types.md#position8) | Position of the pop-up window relative to the center of the indexer bar's top border.
Default value: **{x:96.0, y:48.0}**| +| popupSelectedColor10+ | [ResourceColor](ts-types.md#resourcecolor) | Color of the selected text excluding the initial letter in the pop-up window.
Default value: **#FF182431**| +| popupUnselectedColor10+ | [ResourceColor](ts-types.md#resourcecolor) | Color of the unselected text in the pop-up window.
Default value: **#FF182431**| +| popupItemFont10+ | [Font](ts-types.md#font) | Font of the text excluding the initial letter in the pop-up window.
Default value:
{
size:24,
style:FontStyle.Medium
}| +| popupItemBackgroundColor10+ | [ResourceColor](ts-types.md#resourcecolor) | Background color of the portion excluding the initial letter in the pop-up window.
Default value: **#FFFFFF**| ## IndexerAlign diff --git a/en/application-dev/reference/arkui-ts/ts-container-badge.md b/en/application-dev/reference/arkui-ts/ts-container-badge.md index 91e41e1a16163adb8ccd9f1d2fdb00d59ebd903f..1984ff242a64a9e8360e6ef2064e84211bd6d0d5 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-badge.md +++ b/en/application-dev/reference/arkui-ts/ts-container-badge.md @@ -18,6 +18,8 @@ This component supports only one child component. Creates a badge. +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name| Type| Mandatory| Default Value| Description| @@ -31,6 +33,8 @@ Creates a badge. Creates a badge based on the given string. +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name| Type| Mandatory| Default Value| Description| @@ -41,6 +45,8 @@ Creates a badge based on the given string. ## BadgePosition +Since API version 9, this API is supported in ArkTS widgets. + | Name| Description| | -------- | -------- | | RightTop | The badge is displayed in the upper right corner of the parent component.| @@ -49,12 +55,17 @@ Creates a badge based on the given string. ## BadgeStyle -| Name | Type | Mandatory| Default Value | Description | -| ---------- | ------------------------------------------ | ---- | ----------- | ------------------------------------------- | -| color | [ResourceColor](ts-types.md#resourcecolor) | No | Color.White | Font color. | -| fontSize | number \| string | No | 10 | Font size, in vp. | -| badgeSize | number \| string | No | 16 | Badge size, in vp. This parameter cannot be set in percentage. If it is set to an invalid value, the default value is used.| -| badgeColor | [ResourceColor](ts-types.md#resourcecolor) | No | Color.Red | Badge color. | +Since API version 9, this API is supported in ArkTS widgets. + +| Name | Type | Mandatory| Default Value | Description | +| ------------------------- | ------------------------------------------------------------ | ---- | ----------------- | ------------------------------------------------------------ | +| color | [ResourceColor](ts-types.md#resourcecolor) | No | Color.White | Font color. | +| fontSize | number \| string | No | 10 | Font size, in vp. | +| badgeSize | number \| string | No | 16 | Badge size, in vp. This parameter cannot be set in percentage. If it is set to an invalid value, the default value is used.| +| badgeColor | [ResourceColor](ts-types.md#resourcecolor) | No | Color.Red | Badge color. | +| fontWeight10+ | number \|[FontWeight](ts-appendix-enums.md#fontweight) \| string | No | FontWeight.Normal | Font weight of the text. | +| borderColor10+ | [ResourceColor](ts-types.md#resourcecolor) | No | Color.Red | Border color of the background. | +| borderWidth10+ | [Length](ts-types.md#length) | No | 1.0vp | Border width of the background. | ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-container-column.md b/en/application-dev/reference/arkui-ts/ts-container-column.md index 3f39abc38c116009f358d0470200798c7a51bc2c..5f5cf16fe27d23978db2abf3d1ca58c74f926db4 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-column.md +++ b/en/application-dev/reference/arkui-ts/ts-container-column.md @@ -16,6 +16,8 @@ Supported Column(value?: {space?: string | number}) +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name| Type| Mandatory| Description| @@ -28,8 +30,8 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name| Type| Description| | -------- | -------- | -------- | -| alignItems | [HorizontalAlign](ts-appendix-enums.md#horizontalalign) | Alignment mode of the child components in the horizontal direction.
Default value: **HorizontalAlign.Center**| -| justifyContent8+ | [FlexAlign](ts-appendix-enums.md#flexalign) | Alignment mode of the child components in the vertical direction.
Default value: **FlexAlign.Start**| +| alignItems | [HorizontalAlign](ts-appendix-enums.md#horizontalalign) | Alignment mode of the child components in the horizontal direction.
Default value: **HorizontalAlign.Center**
Since API version 9, this API is supported in ArkTS widgets.| +| justifyContent8+ | [FlexAlign](ts-appendix-enums.md#flexalign) | Alignment mode of the child components in the vertical direction.
Default value: **FlexAlign.Start**
Since API version 9, this API is supported in ArkTS widgets.| ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-container-columnsplit.md b/en/application-dev/reference/arkui-ts/ts-container-columnsplit.md index 9ebb510cd0e108985bb88287f9f61e6893420498..594f3f24a30912af4e05a12d1c3dfe0a51957358 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-columnsplit.md +++ b/en/application-dev/reference/arkui-ts/ts-container-columnsplit.md @@ -1,6 +1,6 @@ # ColumnSplit -The **\** component lays out child components vertically and inserts a horizontal divider between every two child components. +The **\** component lays out child components vertically and inserts a horizontal divider between components. > **NOTE** > @@ -22,13 +22,15 @@ ColumnSplit() | Name| Type| Description| | -------- | -------- | -------- | -| resizeable | boolean | Whether the divider can be dragged. The default value is **false**.| +| resizeable | boolean | Whether the divider can be dragged.
Default value: **false** | > **NOTE** > -> Similar to **\**, the divider of **\** can be dragged to a position that just fully holds a component. +> Similar to **\**, the divider of **\** can be dragged to a position that just fully holds a component. > -> Dragging is not supported in the Previewer. Check the drag effect on a real device. +> Dragging is not supported in the Previewer. Check the drag effect on a real device. +> +> The universal attributes **clip** and **margin** are not supported. ## Example @@ -47,6 +49,7 @@ struct ColumnSplitExample { Text('4').width('100%').height(50).backgroundColor(0xD2B48C).textAlign(TextAlign.Center) Text('5').width('100%').height(50).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center) } + .borderWidth(1) .resizeable(true) // The divider can be dragged. .width('90%').height('60%') }.width('100%') @@ -54,4 +57,4 @@ struct ColumnSplitExample { } ``` -![en-us_image_0000001212378422](figures/en-us_image_0000001212378422.gif) +![en-us_image_0000001219982708](figures/en-us_image_0000001219982708.gif) diff --git a/en/application-dev/reference/arkui-ts/ts-container-counter.md b/en/application-dev/reference/arkui-ts/ts-container-counter.md index fe9baa47e05b60a067545c3d6759373b524ee416..69869ef7610fb7359c194afc45da866d5c96df08 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-counter.md +++ b/en/application-dev/reference/arkui-ts/ts-container-counter.md @@ -16,6 +16,8 @@ Supported Counter() +Since API version 9, this API is supported in ArkTS widgets. + ## Events @@ -23,8 +25,8 @@ The universal events and gestures are not supported. Only the following events a | Name| Description| | -------- | -------- | -| onInc(event: () => void) | Invoked when the number of monitored objects is increased.| -| onDec(event: () => void) | Invoked when the number of monitored objects is decreased.| +| onInc(event: () => void) | Invoked when the number of monitored objects is increased.
Since API version 9, this API is supported in ArkTS widgets.| +| onDec(event: () => void) | Invoked when the number of monitored objects is decreased.
Since API version 9, this API is supported in ArkTS widgets.| ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-container-flex.md b/en/application-dev/reference/arkui-ts/ts-container-flex.md index e29fd91fd85ab9142191700d2b73042fe7f77440..8a98f8237eb7656f48eeb5b2eeba442a64b9b4c6 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-flex.md +++ b/en/application-dev/reference/arkui-ts/ts-container-flex.md @@ -3,9 +3,10 @@ The **\** component allows for flexible layout of child components. > **NOTE** -> +> > - This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. -> - The **\** component adapts the layout of flex items during rendering. This may affect the performance. Therefore, you are advised to use **[\](ts-container-column.md)** or **[\](ts-container-row.md)** instead under scenarios where consistently high performance is required. +> - The **\** component adapts the layout of flex items during rendering. This may affect the performance. Therefore, you are advised to use **[Column](ts-container-column.md)** or **[Row](ts-container-row.md)** instead under scenarios where consistently high performance is required. +> - If the main axis of the **\** component is not set, it follows the size of the parent container. On the contrary, if the main axis of the [\](ts-container-column.md) or [\](ts-container-row.md) component is not set, it follows the size of their child component. ## Child Components @@ -19,11 +20,13 @@ Flex(value?: { direction?: FlexDirection, wrap?: FlexWrap, justifyContent?: Fle Creates a standard **\** component. +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name | Type | Mandatory | Default Value | Description | | -------------- | ---------------------------------------- | ---- | ----------------- | ---------------------------------------- | -| direction | [FlexDirection](ts-appendix-enums.md#flexdirection) | No | FlexDirection.Row | Direction in which child components are arranged in the **\** component, that is, the direction of the main axis. | +| direction | [FlexDirection](ts-appendix-enums.md#flexdirection) | No | FlexDirection.Row | Direction in which child components are arranged in the **\** component, that is, the direction of the main axis. | | wrap | [FlexWrap](ts-appendix-enums.md#flexwrap) | No | FlexWrap.NoWrap | Whether the **\** component has a single line or multiple lines. | | justifyContent | [FlexAlign](ts-appendix-enums.md#flexalign) | No | FlexAlign.Start | Alignment mode of the child components in the **\** component along the main axis. | | alignItems | [ItemAlign](ts-appendix-enums.md#itemalign) | No | ItemAlign.Start | Alignment mode of the child components in the **\** component along the cross axis. | diff --git a/en/application-dev/reference/arkui-ts/ts-container-gridcol.md b/en/application-dev/reference/arkui-ts/ts-container-gridcol.md index 33870e0f047cd048aad3f5e1e049da82cbe1202c..8bf95c5cac475e7f0ecfdcadd77c7d322a25bf63 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-gridcol.md +++ b/en/application-dev/reference/arkui-ts/ts-container-gridcol.md @@ -13,6 +13,8 @@ This component can contain only one child component. GridCol(option?:{span?: number | GridColColumnOption, offset?: number | GridColColumnOption, order?: number | GridColColumnOption}) +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name| Type | Mandatory| Description | @@ -25,12 +27,14 @@ GridCol(option?:{span?: number | GridColColumnOption, offset?: number | GridColC | Name| Type | Mandatory| Description | | ------ | ----------------------------- | ---- | ------------------------------------------------------------ | -| span | number \| GridColColumnOption | No | Number of occupied columns. If it is set to **0**, the element is not involved in layout calculation, that is, the element is not rendered.
Default value: **1**| -| offset | number \| GridColColumnOption | No | Number of offset columns relative to the previous child component of the grid
Default value: **0** | -| order | number \| GridColColumnOption | No | Sequence number of the element. Child components of the grid are sorted in ascending order based on their sequence numbers.
Default value: **0**| +| span | number \| GridColColumnOption | No | Number of occupied columns. If it is set to **0**, the element is not involved in layout calculation, that is, the element is not rendered.
Default value: **1**
Since API version 9, this API is supported in ArkTS widgets.| +| gridColOffset | number \| GridColColumnOption | No | Number of offset columns relative to the previous child component of the grid
Default value: **0**
Since API version 9, this API is supported in ArkTS widgets.| +| order | number \| GridColColumnOption | No | Sequence number of the element. Child components of the grid are sorted in ascending order based on their sequence numbers.
Default value: **0**
Since API version 9, this API is supported in ArkTS widgets.| ## GridColColumnOption +Since API version 9, this API is supported in ArkTS widgets. + | Name | Type | Mandatory | Description | | ----- | ------ | ---- | ---------------------------------------- | | xs | number | No | Device of the minimum size. | @@ -38,7 +42,7 @@ GridCol(option?:{span?: number | GridColColumnOption, offset?: number | GridColC | md | number | No | Medium-sized device. | | lg | number | No | Large-sized device. | | xl | number | No | Extra-large-sized device. | -| xxl | number | No | Ultra-large-sized device. | +| xxl | number | No | Ultra-large-sized device. | The values of `span`, `offset`, and `order` attributes are inherited in the sequence of `xs`, `sm`, `md`, `lg`, `xl`, and `xxl`. If no value is set for a breakpoint, the value is obtained from the previous breakpoint. diff --git a/en/application-dev/reference/arkui-ts/ts-container-gridrow.md b/en/application-dev/reference/arkui-ts/ts-container-gridrow.md index 8522382eb79c938150837fae77a8067f63f19517..8f8f691d44dc7705919c9928515ba39cc40f199d 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-gridrow.md +++ b/en/application-dev/reference/arkui-ts/ts-container-gridrow.md @@ -15,6 +15,8 @@ This component can contain the **\** child component. ## APIs GridRow(option?: {columns?: number | GridRowColumnOption, gutter?: Length | GutterOption, breakpoints?: BreakPoints, direction?: GridRowDirection}) +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name|Type|Mandatory|Description| @@ -26,6 +28,8 @@ GridRow(option?: {columns?: number | GridRowColumnOption, gutter?: Length | Gutt ## GutterOption +Since API version 9, this API is supported in ArkTS widgets. + | Name | Type | Mandatory | Description | | ----- | ------ | ---- | ---------------------------------------- | | x | Length \| GridRowSizeOption | No | Gutter in the horizontal direction. | @@ -35,50 +39,62 @@ GridRow(option?: {columns?: number | GridRowColumnOption, gutter?: Length | Gutt Describes the numbers of grid columns for different device width types. +Since API version 9, this API is supported in ArkTS widgets. + | Name | Type | Mandatory | Description | | ----- | ------ | ---- | ---------------------------------------- | | xs | number | No | Device of the minimum size. | -| sm | number | No | Small-sized device. | -| md | number | No | Medium-sized device. | -| lg | number | No | Large-sized device. | -| xl | number | No | Extra-large-sized device. | -| xxl | number | No | Ultra-large-sized device. | +| sm | number | No | Small-sized device. | +| md | number | No | Medium-sized device. | +| lg | number | No | Large-sized device. | +| xl | number | No | Extra-large-sized device. | +| xxl | number | No | Ultra-large-sized device. | ## GridRowSizeOption Describes the gutter sizes for different device width types. +Since API version 9, this API is supported in ArkTS widgets. + | Name | Type | Mandatory | Description | | ----- | ------ | ---- | ---------------------------------------- | | xs | Length | No | Device of the minimum size. | -| sm | Length | No | Small-sized device. | -| md | Length | No | Medium-sized device. | -| lg | Length | No | Large-sized device. | -| xl | Length | No | Extra-large-sized device. | -| xxl | Length | No | Ultra-large-sized device. | +| sm | Length | No | Small-sized device. | +| md | Length | No | Medium-sized device. | +| lg | Length | No | Large-sized device. | +| xl | Length | No | Extra-large-sized device. | +| xxl | Length | No | Ultra-large-sized device. | ## BreakPoints +Since API version 9, this API is supported in ArkTS widgets. + | Name | Type | Mandatory | Description | | ----- | ------ | ---- | ---------------------------------------- | -| value | Array<string> | No | Array of monotonically increasing breakpoints.
Default value: **["320vp", "520vp", "840vp"]** | +| value | Array<string> | No | Array of monotonically increasing breakpoints.
Default value: **["320vp", "600vp", "840vp"]** | | reference | BreakpointsReference | No | Breakpoint switching reference.| ```ts // Enable the xs, sm, and md breakpoints. breakpoints: {value: ["100vp", "200vp"]} // Enable four breakpoints: xs, sm, md, and lg. The breakpoint range must be monotonically increasing. - breakpoints: {value: ["320vp", "520vp", "840vp"]} + breakpoints: {value: ["320vp", "600vp", "840vp"]} // Enable five breakpoints: xs, sm, md, lg, and xl. The number of breakpoint ranges cannot exceed the number of breakpoints minus 1. - breakpoints: {value: ["320vp", "520vp", "840vp", "1080vp"]} + breakpoints: {value: ["320vp", "600vp", "840vp", "1080vp"]} ``` ## BreakpointsReference + +Since API version 9, this API is supported in ArkTS widgets. + | Name| Description| | -------- | -------- | | WindowSize | The window is used as a reference.| | ComponentSize | The container is used as a reference.| ## GridRowDirection + +Since API version 9, this API is supported in ArkTS widgets. + | Name| Description| | -------- | -------- | | Row | Grid elements are arranged in the row direction.| @@ -110,7 +126,11 @@ A grid supports a maximum of six breakpoints: xs, sm, md, lg, xl and xxl, whose ## Attributes -The [universal attributes](ts-universal-attributes-size.md) are supported. +In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported. + +| Name | Type | Description | +| ----------------------- | ----------------------------------- | ------------------------------------------- | +| alignItems10+ | [ItemAlign](ts-appendix-enums.md#itemalign) | Alignment mode of the **\** cross axis.
Default value: **ItemAlign.Start**
**NOTE**
The alignment mode of the **\** component can also be set using **alignSelf([ItemAlign](ts-appendix-enums.md#itemalign))**. If both of the preceding methods are used, the setting of **alignSelf(ItemAlign)** prevails.
Since API version 10, this API is supported in ArkTS widgets.| ## Events @@ -119,6 +139,8 @@ The [universal attributes](ts-universal-attributes-size.md) are supported. onBreakpointChange(callback: (breakpoints: string) => void) +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name | Type | Mandatory | Description | 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 7a944fbdedacd17582182a44a8ef03c51f8af141..09d9024fb37381dfd67e4bf34688092d94c491fb 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-list.md +++ b/en/application-dev/reference/arkui-ts/ts-container-list.md @@ -1,6 +1,6 @@ # List -The **\** component provides a list container that presents a series of list items arranged in a column with the same width. It supports presentations of the same type of data in a multiple and coherent row style, for example, images or text. +The **\** component provides a list container that presents a series of list items arranged in a column with the same width. It supports presentations of the same type of data in a multiple and coherent row style, for example, images or text. > **NOTE** > @@ -17,6 +17,8 @@ This component supports the **[\](ts-container-listitem.md)** and **[\ List(value?:{space?: number | string, initialIndex?: number, scroller?: Scroller}) +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name| Type| Mandatory| Description| @@ -31,20 +33,22 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name| Type| Description| | -------- | -------- | -------- | -| listDirection | [Axis](ts-appendix-enums.md#axis) | Direction in which the list items are arranged.
Default value: **Axis.Vertical**| -| divider | {
strokeWidth: [Length](ts-types.md#length),
color?:[ResourceColor](ts-types.md),
startMargin?: Length,
endMargin?: Length
} \| null | 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 edge of the list.
- **endMargin**: distance between the divider and the end edge of the list.| -| scrollBar | [BarState](ts-appendix-enums.md#barstate) | Scrollbar status.
Default value: **BarState.Off**| -| cachedCount | number | Number of list items or list item groups to be preloaded. A list item group is calculated as a whole, and all list items of the group are preloaded at the same time. For details, see [Minimizing White Blocks During Swiping](../../ui/ui-ts-performance-improvement-recommendation.md#minimizing-white-blocks-during-swiping).
Default value: **1**| +| listDirection | [Axis](ts-appendix-enums.md#axis) | Direction in which the list items are arranged.
Default value: **Axis.Vertical**
Since API version 9, this API is supported in ArkTS widgets.| +| divider | {
strokeWidth: [Length](ts-types.md#length),
color?:[ResourceColor](ts-types.md#resourcecolor),
startMargin?: Length,
endMargin?: Length
} \| null | 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 edge of the list.
- **endMargin**: distance between the divider and the end edge of the list.
Since API version 9, this API is supported in ArkTS widgets.| +| scrollBar | [BarState](ts-appendix-enums.md#barstate) | Scrollbar status.
Default value: **BarState.Off**
Since API version 9, this API is supported in ArkTS widgets.| +| cachedCount | number | Number of list items or list item groups to be preloaded. A list item group is calculated as a whole, and all list items of the group are preloaded at the same time. For details, see [Minimizing White Blocks During Swiping](../../ui/ui-ts-performance-improvement-recommendation.md#minimizing-white-blocks-during-swiping).
Default value: **1**
Since API version 9, this API is supported in ArkTS widgets.| | editMode(deprecated) | boolean | Whether to enter editing mode.
This API is deprecated since API version 9.
Default value: **false**| -| edgeEffect | [EdgeEffect](ts-appendix-enums.md#edgeeffect) | Scroll effect.
Default value: **EdgeEffect.Spring**| -| chainAnimation | boolean | Whether to display chained animations on this list when it slides or its top or bottom is 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.
Default value: **false**
- **false**: No chained animations are displayed.
- **true**: Chained animations are displayed.| -| multiSelectable8+ | boolean | Whether to enable mouse frame selection.
Default value: **false**
- **false**: The mouse frame selection is disabled.
- **true**: The mouse frame selection is enabled.| -| lanes9+ | number \| [LengthConstrain](ts-types.md#lengthconstrain) | In the following description, **listDirection** is set to **Axis.Vertical**:
Number of columns in which the list items are arranged along the cross axis.
Default value: **1**
The rules are as follows:
- If the value is set to a number, the column width is determined based on the specified number and the cross-axis width of the **\** component.
- If the value is set to {minLength, maxLength}, the number of columns is adjusted adaptively based on the width of the **\** component, ensuring that the width respects the {minLength, maxLength} constraints during adaptation. The **minLength** constraint is prioritized. For example, if **lanes** is set to **{minLength: 40vp, maxLength: 60vp}** and the width of the **\** component is 70 vp, the list items are arranged in one column with their alignment compliant with the **alignListItem** settings. If the width of the **\** component is changed to 80 vp, which is twice the value of **minLength**, the list items are arranged in two columns.| -| alignListItem9+ | ListItemAlign | Alignment mode of list items along the cross axis when: Cross-axis width of the **\** component > Cross-axis width of list items x Value of **lanes**.
Default value: **ListItemAlign.Start**| -| sticky9+ | StickyStyle | Whether to pin the header to the top or the footer to the bottom in the **\** component. This attribute is used together with the **[\](ts-container-listitemgroup.md)** component.
Default value: **StickyStyle.None**
**NOTE**
The **sticky** attribute can be set to **StickyStyle.Header** or \| **StickyStyle.Footer** to support both the pin-to-top and pin-to-bottom features.| +| edgeEffect | [EdgeEffect](ts-appendix-enums.md#edgeeffect) | Scroll effect.
Default value: **EdgeEffect.Spring**
Since API version 9, this API is supported in ArkTS widgets.| +| chainAnimation | boolean | Whether to display chained animations on this list when it slides or its top or bottom is 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.
Default value: **false**
- **false**: No chained animations are displayed.
- **true**: Chained animations are displayed.
Since API version 9, this API is supported in ArkTS widgets.| +| multiSelectable8+ | boolean | Whether to enable mouse frame selection.
Default value: **false**
- **false**: The mouse frame selection is disabled.
- **true**: The mouse frame selection is enabled.
Since API version 9, this API is supported in ArkTS widgets.| +| lanes9+ | number \| [LengthConstrain](ts-types.md#lengthconstrain) | In the following description, **listDirection** is set to **Axis.Vertical**:
Number of columns in which the list items are arranged along the cross axis.
Default value: **1**
The rules are as follows:
- If the value is set to a number, the column width is determined based on the specified number and the cross-axis width of the **\** component.
- If the value is set to {minLength, maxLength}, the number of columns is adjusted adaptively based on the width of the **\** component, ensuring that the width respects the {minLength, maxLength} constraints during adaptation. The **minLength** constraint is prioritized. For example, if **lanes** is set to **{minLength: 40vp, maxLength: 60vp}** and the width of the **\** component is 70 vp, the list items are arranged in one column with their alignment compliant with the **alignListItem** settings. If the width of the **\** component is changed to 80 vp, which is twice the value of **minLength**, the list items are arranged in two columns.
This API is supported in ArkTS widgets.| +| alignListItem9+ | ListItemAlign | Alignment mode of list items along the cross axis when: Cross-axis width of the **\** component > Cross-axis width of list items x Value of **lanes**.
Default value: **ListItemAlign.Start**
This API is supported in ArkTS widgets.| +| sticky9+ | StickyStyle | Whether to pin the header to the top or the footer to the bottom in the **\** component. This attribute is used together with the **[\](ts-container-listitemgroup.md)** component.
Default value: **StickyStyle.None**
This API is supported in ArkTS widgets.
**NOTE**
The **sticky** attribute can be set to **StickyStyle.Header** or \| **StickyStyle.Footer** to support both the pin-to-top and pin-to-bottom features.| ## ListItemAlign9+ +This API is supported in ArkTS widgets. + | Name | Description | | ------ | -------------------------------------- | | Start | The list items are packed toward the start edge of the **\** component along the cross axis.| @@ -53,6 +57,8 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ## StickyStyle9+ +This API is supported in ArkTS widgets. + | Name | Description | | ------ | -------------------------------------- | | None | In the **\** component, the header is not pinned to the top, and the footer is not pinned to the bottom.| @@ -66,13 +72,13 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name| Description| | -------- | -------- | | onItemDelete(deprecated)(event: (index: number) => boolean) | Triggered when a list item is deleted.
This API is deprecated since API version 9.
- **index**: index of the deleted list item.| -| onScroll(event: (scrollOffset: number, scrollState: ScrollState) => void) | Triggered when the list scrolls.
- **scrollOffset**: scroll offset.
- **[scrollState](#scrollstate)**: current scroll state.| -| onScrollIndex(event: (start: number, end: number) => void) | Triggered when scrolling starts.
When calculating the index value, the **\** accounts for one index value as a whole, and the index values of the list items within are not calculated.
- **start**: index of the scroll start position.
- **end**: index of the scroll end position.| -| onReachStart(event: () => void) | Triggered when the list reaches the start position.| -| onReachEnd(event: () => void) | Triggered when the list reaches the end position.| -| onScrollFrameBegin9+(event: (offset: number, state: ScrollState) => { offsetRemain }) | Triggered when the list starts to scroll. The input parameters indicate the amount by which the list will scroll. The event handler then works out the amount by which the list needs to scroll based on the real-world situation and returns the result.
\- **offset**: amount to scroll by.
\- **state**: current sliding status.
- **offsetRemain**: required amount to scroll by in the horizontal direction.| -| onScrollStart9+(event: () => void) | Triggered when the list starts scrolling initiated by the user's finger dragging the **\** component or its scrollbar. This event will not be triggered if the scrolling is initiated by using [Scroller](ts-container-scroll.md#scroller).| -| onScrollStop(event: () => void) | Triggered when the list stops scrolling after the user's finger leaves the screen. This event will not be triggered if the scrolling is initiated by using [Scroller](ts-container-scroll.md#scroller).| +| onScroll(event: (scrollOffset: number, scrollState: ScrollState) => void) | Triggered when the list scrolls.
- **scrollOffset**: scroll offset.
- **[scrollState](#scrollstate)**: current scroll state.
Since API version 9, this API is supported in ArkTS widgets.| +| onScrollIndex(event: (start: number, end: number) => void) | Triggered when scrolling starts.
When calculating the index value, the **\** accounts for one index value as a whole, and the index values of the list items within are not calculated.
- **start**: index of the scroll start position.
- **end**: index of the scroll end position.
Since API version 9, this API is supported in ArkTS widgets.| +| onReachStart(event: () => void) | Triggered when the list reaches the start position.
Since API version 9, this API is supported in ArkTS widgets.| +| onReachEnd(event: () => void) | Triggered when the list reaches the end position.
Since API version 9, this API is supported in ArkTS widgets.| +| onScrollFrameBegin9+(event: (offset: number, state: ScrollState) => { offsetRemain }) | Triggered when the list starts to scroll. The input parameters indicate the amount by which the list will scroll. The event handler then works out the amount by which the list needs to scroll based on the real-world situation and returns the result.
\- **offset**: amount to scroll by.
\- **state**: current sliding status.
- **offsetRemain**: actual amount by which the list scrolls.
This API is supported in ArkTS widgets.
**NOTE**
If **listDirection** is set to **Axis.Vertical**, the return value is the amount by which the list needs to scroll in the vertical direction. If **listDirection** is set to **Axis.Horizontal**, the return value is the amount by which the list needs to scroll in the horizontal direction.| +| onScrollStart9+(event: () => void) | Triggered when the list starts scrolling initiated by the user's finger dragging the **\** component or its scrollbar. This event is also triggered when the animation contained in the scrolling triggered by [Scroller](ts-container-scroll.md#scroller) starts.
This API is supported in ArkTS widgets.| +| onScrollStop(event: () => void) | Triggered when the list stops scrolling after the user's finger leaves the screen. This event is also triggered when the animation contained in the scrolling triggered by [Scroller](ts-container-scroll.md#scroller) stops.
Since API version 9, this API is supported in ArkTS widgets.| | onItemMove(event: (from: number, to: number) => boolean) | Triggered when a list item moves.
- **from**: index of the item before moving.
- **to**: index of the item after moving.| | onItemDragStart(event: (event: ItemDragInfo, itemIndex: number) => ((() => any) \| void) | Triggered when a list element starts to be dragged.
- **event**: See [ItemDragInfo](ts-container-grid.md#itemdraginfo).
- **itemIndex**: index of the dragged list element.| | onItemDragEnter(event: (event: ItemDragInfo) => void) | Triggered when the dragged item enters the drop target of the list.
- **event**: See [ItemDragInfo](ts-container-grid.md#itemdraginfo).| @@ -82,6 +88,8 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ## ScrollState +Since API version 9, this API is supported in ArkTS widgets. + | Name | Description | | ------ | ------------------------- | | Idle | Not scrolling. | @@ -175,7 +183,7 @@ struct ListLanesExample { .lanes({ minLength: 40, maxLength: 40 }) .alignListItem(this.alignListItem) - Button("Change alignListItem: "+ this.alignListItem).onClick(() => { + Button("Click to modify alignListItem: "+ this.alignListItem).onClick(() => { if (this.alignListItem == ListItemAlign.Start) { this.alignListItem = ListItemAlign.Center } else if (this.alignListItem == ListItemAlign.Center) { diff --git a/en/application-dev/reference/arkui-ts/ts-container-listitem.md b/en/application-dev/reference/arkui-ts/ts-container-listitem.md index a101532880cdab858319d8a13cf7df487cfb3a33..c5bb7c662b007a3cd5b186ecf2c910efef2362ef 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-listitem.md +++ b/en/application-dev/reference/arkui-ts/ts-container-listitem.md @@ -16,6 +16,8 @@ This component can contain a single child component. ListItem(value?: string) +Since API version 9, this API is supported in ArkTS widgets. + ## Attributes In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported. @@ -24,7 +26,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | -------- | -------- | -------- | | sticky(deprecated) | [Sticky](#stickydeprecated) | Sticky effect of the list item.
Default value: **Sticky.None**
This API is deprecated since API version 9. You are advised to use **sticky** of the [\](ts-container-list.md#attributes) component.| | editable(deprecated) | boolean \| [EditMode](#editmodedeprecated) | Whether to enter editing mode, where the list item can be deleted or moved.
This API is deprecated since API version 9.
Default value: **false**| -| selectable8+ | boolean | Whether the current list item is selectable by mouse drag.
**NOTE**
This attribute takes effect only when mouse frame selection is enabled for the parent **\** container.
Default value: **true**| +| selectable8+ | boolean | Whether the current list item is selectable by mouse drag.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
This attribute takes effect only when mouse frame selection is enabled for the parent **\** container.
Default value: **true**| | swipeAction9+ | {
start?: CustomBuilder,
end?:CustomBuilder,
edgeEffect?: [SwipeEdgeEffect](#swipeedgeeffect9),
} | Component displayed when the list item is swiped out from the screen edge.
- **start**: component on the left of the list item when the item is swiped to the right (in vertical list layout) or component above the list item when the item is swiped down (in horizontal list layout).
- **end**: component on the right of the list item when the item is swiped to the left (in vertical list layout) or component below the list item when the item is swiped up (in horizontal list layout).
- **edgeEffect**: scroll effect.
| ## Sticky(deprecated) @@ -53,7 +55,7 @@ This API is deprecated since API version 9. | Name| Description| | -------- | -------- | -| onSelect(event: (isSelected: boolean) => void)8+ | Triggered when the selected state of the **\** changes.
**isSelected**: Returns **true** if the **\** is selected by mouse drag; returns **false** otherwise.| +| onSelect(event: (isSelected: boolean) => void)8+ | Triggered when the selected state of the **\** changes.
**isSelected**: Returns **true** if the **\** is selected by mouse drag; returns **false** otherwise.
Since API version 9, this API is supported in ArkTS widgets.| ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-container-navigator.md b/en/application-dev/reference/arkui-ts/ts-container-navigator.md index e1d2c00f81527d3303b45031d858b76f9537099b..f5c24ce3043f17193050c767bcd8a55ee647779b 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-navigator.md +++ b/en/application-dev/reference/arkui-ts/ts-container-navigator.md @@ -27,9 +27,9 @@ Navigator(value?: {target: string, type?: NavigationType}) | Name | Description | | ------- | -------------------------- | -| Push | Navigates to a specified page in the application. | +| Push | Navigates to the specified page in the application. | | Replace | Replaces the current page with another one in the application and destroys the current page.| -| Back | Returns to the previous page or a specified page. | +| Back | Returns to the specified page. If the specified page does not exist in the stack, no response is returned. If no page is specified, the previous page is returned to.| ## Attributes diff --git a/en/application-dev/reference/arkui-ts/ts-container-refresh.md b/en/application-dev/reference/arkui-ts/ts-container-refresh.md index 0b0831d7479bb1f720d25a36712a7ad3a50c8db9..02e9c2172db36df28211c3d987d68a32b147a147 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-refresh.md +++ b/en/application-dev/reference/arkui-ts/ts-container-refresh.md @@ -5,6 +5,8 @@ > **NOTE** > > This component is supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version. +> +> When setting a custom component, make sure its height does not exceed 64 vp. ## Child Components @@ -12,15 +14,16 @@ This component supports only one child component. ## APIs -Refresh\(value: \{ refreshing: boolean, offset?: number | string , friction?: number | string \}\) +Refresh\(value: \{ refreshing: boolean, offset?: number | string , friction?: number | string, builder?: Custombuilder\}\) **Parameters** | Name| Value Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | refreshing | boolean | Yes| Whether the current component is being refreshed.
This parameter supports [$$](../../quick-start/arkts-restrictions-and-extensions.md#two-way-binding-of-variables) for two-way binding of variables.| -| offset | string \| number | No| Distance to the top of the parent component from the **** component that comes to rest after a successful pull-down gesture.
Default value: **16**, in vp| +| offset | string \| number | No| Distance from the pull-down starting point to the top of the component.
Default value: **16**, in vp
**NOTE**
The value cannot be a percentage or a negative number.| | friction | number \| string | No| Coefficient of friction, which indicates the **** component's sensitivity to the pull-down gesture. The value ranges from 0 to 100.
Default value: **62**
- **0** indicates that the **\** component is not sensitive to the pull-down gesture.
- **100** indicates that the **\** component is highly sensitive to the pull-down gesture.
- A larger value indicates a more sensitive response of the **\** component to the pull-down gesture.| +| builder | [CustomBuilder](ts-types.md#custombuilder8)10+ | No| Component with the custom refresh style set for the pull-down gesture.| @@ -32,7 +35,7 @@ Refresh\(value: \{ refreshing: boolean, offset?: number | string , friction?: n | onStateChange(callback: (state: [RefreshStatus](#refreshstatus)) => void)| Triggered when the refresh status changes.
- **state**: refresh status.| | onRefreshing(callback: () => void)| Triggered when the component enters the refresh state.| -## RefreshStatus enums +## RefreshStatus | Name| Description| | -------- | -------- | diff --git a/en/application-dev/reference/arkui-ts/ts-container-relativecontainer.md b/en/application-dev/reference/arkui-ts/ts-container-relativecontainer.md index f0e9f85f122e630c6f73f5443d0d4260abaaf5cf..77f136b9f2c9de3a7e59cb69c017ba33df6b6a10 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-relativecontainer.md +++ b/en/application-dev/reference/arkui-ts/ts-container-relativecontainer.md @@ -31,6 +31,8 @@ Multiple child components are supported. RelativeContainer() +Since API version 9, this API is supported in ArkTS widgets. + ## Example ```ts diff --git a/en/application-dev/reference/arkui-ts/ts-container-row.md b/en/application-dev/reference/arkui-ts/ts-container-row.md index deb83273445d1b5d16e5540476ccfa9c8c9b1fba..606759b76c1d63dda9ebabcfffaeec5f11f833c7 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-row.md +++ b/en/application-dev/reference/arkui-ts/ts-container-row.md @@ -16,6 +16,8 @@ Supported Row(value?:{space?: number | string }) +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name| Type| Mandatory| Description| @@ -27,8 +29,8 @@ Row(value?:{space?: number | string }) | Name| Type| Description| | -------- | -------- | -------- | -| alignItems | [VerticalAlign](ts-appendix-enums.md#verticalalign) | Alignment mode of child components in the vertical direction.
Default value: **VerticalAlign.Center**| -| justifyContent8+ | [FlexAlign](ts-appendix-enums.md#flexalign) | Alignment mode of the child components in the horizontal direction.
FlexAlign.Start | +| alignItems | [VerticalAlign](ts-appendix-enums.md#verticalalign) | Alignment mode of child components in the vertical direction.
Default value: **VerticalAlign.Center**
Since API version 9, this API is supported in ArkTS widgets.| +| justifyContent8+ | [FlexAlign](ts-appendix-enums.md#flexalign) | Alignment mode of the child components in the horizontal direction.
FlexAlign.Start
Since API version 9, this API is supported in ArkTS widgets.| ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-container-rowsplit.md b/en/application-dev/reference/arkui-ts/ts-container-rowsplit.md index cc1ee6af79ad5b6b9682718c57f4e5945e9028dd..4a2fe8e741369350691f6f46ebeb929adbcc208c 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-rowsplit.md +++ b/en/application-dev/reference/arkui-ts/ts-container-rowsplit.md @@ -1,6 +1,6 @@ # RowSplit -The **\** lays out child components horizontally and inserts a vertical divider between every two child components. +The **\** lays out child components horizontally and inserts a vertical divider between child components. > **NOTE** > @@ -23,9 +23,11 @@ RowSplit() > **NOTE** > -> Similar to **\**, the divider of **\** can be dragged to a position that just fully holds a component. +> Similar to **\**, the divider of **\** can be dragged to a position that just fully holds a component. +> +> Dragging is not supported in the Previewer. Check the drag effect on a real device. > -> Dragging is not supported in the Previewer. Check the drag effect on a real device. +> The universal attributes **clip** and **margin** are not supported. ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-container-scroll.md b/en/application-dev/reference/arkui-ts/ts-container-scroll.md index 1ebba8cc427bd9205fa7048310d9e97274f079ea..14ed577d91fb25d1a797573dd045a7e2f7c86555 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-scroll.md +++ b/en/application-dev/reference/arkui-ts/ts-container-scroll.md @@ -18,6 +18,12 @@ This component supports only one child component. Scroll(scroller?: Scroller) +**Parameters** + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------- | +| scroller | [Scroller](#scroller) | No| Scroller, which can be bound to scrollable components.| + ## Attributes In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported. @@ -42,12 +48,12 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | -| onScrollFrameBegin9+(event: (offset: number, state: ScrollState) => { offsetRemain }) | Triggered when each frame scrolling starts. The input parameters indicate the amount by which the **\** component will scroll. The event handler then works out the amount by which the component needs to scroll based on the real-world situation and returns the result.
\- **offset**: amount to scroll by.
\- **state**: current scrolling status.
- **offsetRemain**: required amount to scroll by in the horizontal direction.| +| onScrollFrameBegin9+(event: (offset: number, state: ScrollState) => { offsetRemain }) | Triggered when each frame scrolling starts. The input parameters indicate the amount by which the **\** component will scroll. The event handler then works out the amount by which the component needs to scroll based on the real-world situation and returns the result.
\- **offset**: amount to scroll by.
\- **state**: current scrolling status.
- **offsetRemain**: actual amount by which the component scrolls.| | onScroll(event: (xOffset: number, yOffset: number) => void) | Triggered to return the horizontal and vertical offsets during scrolling when the specified scroll event occurs. | | onScrollEdge(event: (side: Edge) => void) | Triggered when scrolling reaches the edge. | -| onScrollEnd(event: () => void) | Triggered when scrolling stops.
This event is deprecated since API version 9. Use the **onScrollStop** event instead. | -| onScrollStart9+(event: () => void) | Triggered when scrolling starts and is initiated by the user's finger dragging the **\** component or its scrollbar. This event will not be triggered if the scrolling is initiated by using [Scroller](#scroller).| -| onScrollStop9+(event: () => void) | Triggered when scrolling stops after the user's finger leaves the screen. This event will not be triggered if the scrolling is initiated by using [Scroller](#scroller).| +| onScrollEnd(deprecated) (event: () => void) | Triggered when scrolling stops.
This event is deprecated since API version 9. Use the **onScrollStop** event instead. | +| onScrollStart9+(event: () => void) | Triggered when scrolling starts and is initiated by the user's finger dragging the **\** component or its scrollbar. This event is also triggered when the animation contained in the scrolling triggered by [Scroller](#scroller) starts.| +| onScrollStop9+(event: () => void) | Triggered when scrolling stops after the user's finger leaves the screen. This event is also triggered when the animation contained in the scrolling triggered by [Scroller](#scroller) stops.| > **NOTE** > @@ -55,7 +61,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the ## Scroller -Implements a controller for a scrollable container component. You can bind this component to a container component and use it to control the scrolling of that component. Currently, this controller can be bound to the **\**, **\** and **\** components. One controller can control only one container component. +Implements a controller for a scrollable container component. You can bind this component to a container component and use it to control the scrolling of that component. One controller can control only one container component. The supported container components are **\**, **\**, **\**, **\**, and **\**. ### Objects to Import @@ -76,8 +82,8 @@ Scrolls to the specified position. | Name | Type | Mandatory| Description | | --------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| xOffset | Length | Yes | Horizontal scrolling offset. | -| yOffset | Length | Yes | Vertical scrolling offset. | +| xOffset | number | string | Yes | Horizontal scrolling offset. | +| yOffset | number | string | Yes | Vertical scrolling offset. | | animation | {
duration: number,
curve: [Curve](ts-appendix-enums.md#curve)
} | No | Animation configuration, which includes the following:
- **duration**: scrolling duration.
- **curve**: scrolling curve.| @@ -86,7 +92,7 @@ Scrolls to the specified position. scrollEdge(value: Edge): void -Scrolls to the edge of the container. +Scrolls to the edge of the container, regardless of the scroll axis direction. **Edge.Top** and **Edge.Start** produce the same effect, and **Edge.Bottom** and **Edge.End** produce the same effect. **Parameters** @@ -106,12 +112,12 @@ Scrolls to the next or previous page. | Name | Type | Mandatory | Description | | --------- | ------- | ---- | ------------------------------ | | next | boolean | Yes | Whether to turn to the next page. The value **true** means to scroll to the next page, and **false** means to scroll to the previous page.| -| direction(deprecated) | [Axis](ts-appendix-enums.md#axis) | No | Scrolling direction: horizontal or vertical.
This API is deprecated since API version 9. | +| direction(deprecated) | [Axis](ts-appendix-enums.md#axis) | No | Scrolling direction: horizontal or vertical.
This API is deprecated since API version 9. | ### currentOffset -currentOffset() +currentOffset(): { xOffset: number, yOffset: number } Obtains the scrolling offset. @@ -152,7 +158,7 @@ Scrolls by the specified amount. > **NOTE** > -> Only the **\** component is supported. +> Only the **\**, **\**, **\**, and **\** components are supported. **Parameters** diff --git a/en/application-dev/reference/arkui-ts/ts-container-sidebarcontainer.md b/en/application-dev/reference/arkui-ts/ts-container-sidebarcontainer.md index e8f57f0aebcdf81b7f4a5227b76e8795d79543fb..86400597c389b6b30ec1dff940b657e53e25ca26 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-sidebarcontainer.md +++ b/en/application-dev/reference/arkui-ts/ts-container-sidebarcontainer.md @@ -22,7 +22,7 @@ SideBarContainer( type?: SideBarContainerType ) | -------- | -------- | -------- | -------- | | type | SideBarContainerType | No| Display type of the sidebar.
Default value: **SideBarContainerType.Embed**| -## SideBarContainerType enums +## SideBarContainerType | Name| Description| | -------- | -------- | @@ -41,6 +41,7 @@ SideBarContainer( type?: SideBarContainerType ) | maxSideBarWidth | number \| Length9+ | Maximum width of the sidebar.
Default value: **280**, in vp| | autoHide9+ | boolean | Whether to automatically hide the sidebar when it is dragged to be smaller than the minimum width.
Default value: **true**| | sideBarPosition9+ | SideBarPosition | Position of the sidebar.
Default value: **SideBarPosition.Start**| +| divider10+ | [DividerStyle](#dividerstyle10) \| null | Divider style.
- **DividerStyle** (default): The divider is displayed.
- **null**: The divider is not displayed.| ## ButtonStyle @@ -59,6 +60,15 @@ SideBarContainer( type?: SideBarContainerType ) | Start | The sidebar is on the left side of the container.| | End | The sidebar is on the right side of the container.| +## DividerStyle10+ + +| Name | Type | Mandatory| Description | +| ----------- | ------------- | ---- | ---------------------------------------- | +| strokeWidth | [Length](ts-types.md#length) | Yes | Stroke width of the divider.
Default value: **1**, in vp | +| color | [ResourceColor](ts-types.md#resourcecolor) | No | Color of the divider.
Default value: **#000000, 3%** | +| startMargin | [Length](ts-types.md#length) | No | Distance between the divider and the top of the sidebar.
Default value: **0**| +| endMargin | [Length](ts-types.md#length) | No | Distance between the divider and the bottom of the sidebar.
Default value: **0**| + ## Events | Name| Description| diff --git a/en/application-dev/reference/arkui-ts/ts-container-stack.md b/en/application-dev/reference/arkui-ts/ts-container-stack.md index 66dcd7deb957887e5ca627464de88148b1897fe7..766e63854217ff91b3ed49748d60b72ff490fee8 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-stack.md +++ b/en/application-dev/reference/arkui-ts/ts-container-stack.md @@ -16,11 +16,21 @@ Supported Stack(value?: { alignContent?: Alignment }) +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| alignContent | [Alignment](ts-appendix-enums.md#alignment) | No| Alignment of child components in the container.
Default value: **Alignment.Center**| +| Name | Type | Mandatory| Description | +| ------------ | ------------------------------------------- | ---- | ----------------------------------------------------------- | +| alignContent | [Alignment](ts-appendix-enums.md#alignment) | No | Alignment of child components in the container.
Default value: **Alignment.Center**| + +## Attributes + +In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported. + +| Name | Type | Description | +| ------------ | ------------------------------------------- | ------------------------------ | +| alignContent | [Alignment](ts-appendix-enums.md#alignment) | Alignment of child components in the container.
Default value: **Alignment.Center**
Since API version 9, this API is supported in ArkTS widgets.| ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-container-swiper.md b/en/application-dev/reference/arkui-ts/ts-container-swiper.md index 849218cf45e69fd423b020dd8dd26381933c1fe3..2f224afc0377281c20ee36a638b5862a39096106 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-swiper.md +++ b/en/application-dev/reference/arkui-ts/ts-container-swiper.md @@ -30,7 +30,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name | Type | Description | | --------------------------- | ---------------------------------------- | ---------------------------------------- | | index | number | Index of the child component currently displayed in the container.
Default value: **0** | -| autoPlay | boolean | Whether to enable automatic playback for child component switching. If this attribute is **true**, the navigation dots indicator does not take effect.
Default value: **false** | +| autoPlay | boolean | Whether to enable automatic playback for child component switching.
Default value: **false** | | interval | number | Interval for automatic playback, in ms.
Default value: **3000** | | indicator | boolean | Whether to enable the navigation dots indicator.
Default value: **true** | | loop | boolean | Whether to enable loop playback.
The value **true** means to enable loop playback. When LazyForEach is used, it is recommended that the number of the components to load exceed 5.
Default value: **true**| diff --git a/en/application-dev/reference/arkui-ts/ts-container-tabcontent.md b/en/application-dev/reference/arkui-ts/ts-container-tabcontent.md index d874d686fd63a1e00b2892ec5d24a7e069786e02..190118b6a7f136146d6a7d3e5853255439920d43 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-tabcontent.md +++ b/en/application-dev/reference/arkui-ts/ts-container-tabcontent.md @@ -11,6 +11,10 @@ The **\** component is used only in the **\** component. It co This component supports only one child component. +> **NOTE** +> +> System components and custom components can be built in, and rendering control types ([if/else](../../quick-start/arkts-rendering-control-ifelse.md), [ForEach](../../quick-start/arkts-rendering-control-foreach.md), and [LazyForEach](../../quick-start/arkts-rendering-control-lazyforeach.md)) are supported. + ## APIs @@ -23,36 +27,95 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name| Type| Description| | -------- | -------- | -------- | -| tabBar | string \| Resource \| {
icon?: string \| Resource,
text?: string \| Resource
}
\| [CustomBuilder](ts-types.md)8+ | Content displayed on the tab bar.
**CustomBuilder**: builder, to which components can be passed (applicable to API version 8 and later versions).
**NOTE**
If an icon uses an SVG image, the width and height attributes of the SVG image must be deleted. Otherwise, the icon size will be determined by the width and height attributes of the SVG image. | -| tabBar9+ | [SubTabBarStyle](#subtabbarstyle) \| [BottomTabBarStyle](#bottomtabbarstyle) | Content displayed on the tab bar.
**SubTabBarStyle**: subtab style. It takes text as its input parameter.
**BottomTabBarStyle**: bottom and side tab style. It takes text and images as its input parameters.| +| tabBar | string \| Resource \| {
icon?: string \| Resource,
text?: string \| Resource
}
\| [CustomBuilder](ts-types.md)8+ | Content displayed on the tab bar.
**CustomBuilder**: builder, to which components can be passed (applicable to API version 8 and later versions).
**NOTE**
If an icon uses an SVG image, the width and height attributes of the SVG image must be deleted. Otherwise, the icon size will be determined by the width and height attributes of the SVG image.
If the content set exceeds the space provided by the tab bar, it will be clipped.| +| tabBar9+ | [SubTabBarStyle](#subtabbarstyle9) \| [BottomTabBarStyle](#bottomtabbarstyle9) | Content displayed on the tab bar.
**SubTabBarStyle**: subtab style. It takes text as its input parameter.
**BottomTabBarStyle**: bottom and side tab style. It takes text and images as its input parameters.
**NOTE**
The bottom tab style does not include an underline.
When an icon display error occurs, a gray blank block is displayed.| > **NOTE** -> - The **\** component does not support setting of the common width attribute. By default, its width is the same as that of the parent **\** component. -> - The **\** component does not support setting of the common height attribute. Its height is determined by the height of the parent **\** component and the **\** component. +> +> - The **\** component does not support setting of the common width attribute. By default, its width is the same as that of the parent **\** component. +> - The **\** component does not support setting of the common height attribute. Its height is determined by the height of the parent **\** component and the **\** component. +> - If the **vertical** attribute is **false**, the width and height descriptions are swapped in the preceding two restrictions. +> - **\** does not support page scrolling. If page scrolling is required, consider nesting a list. ## SubTabBarStyle9+ Implements the subtab style. -### constructor9+ +### constructor constructor(content: string | Resource) -A constructor used to create a **SubTabBarStyle** instance. +Constructor used to create a **SubTabBarStyle** instance. **Parameters** | Name| Type | Mandatory| Description| | -------- | -------- | -------- | -------- | -| content | string \| [Resource](ts-types.md#resource) | Yes| Text for the tab.| +| content | string \| [Resource](ts-types.md#resource) | Yes| Text for the tab. Since API version 10, the type of **content** is **ResourceStr**.| + +### of10+ + +static of(content: ResourceStr) + +Static constructor used to create a **SubTabBarStyle** instance. + +**Parameters** + +| Name | Type | Mandatory| Description | +| ------- | ------------------------------------------ | ---- | ------------------ | +| content | [ResourceStr](ts-types.md#resourcestr) | Yes | Text for the tab.| + +### Attributes + +The following attributes are supported. + +| Name | Type | Description | +| ------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| indicator10+ | [IndicatorStyle](#indicatorstyle10)| Underline indicator style of the selected subtab. It is valid only in the horizontal layout.
| +| selectedMode10+ | [SelectedMode](#selectedmode10) | Display mode of the selected subtab.
Default value: **SelectedMode.INDICATOR**| +| board10+ | [BoardStyle](#boardstyle10) | Board style of the selected subtab.| +| labelStyle10+ | [LabelStyle](#labelstyle10) | Label text and font style of the selected subtab.| + +## IndicatorStyle10+ + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | -------------------------------- | +| color | [ResourceColor](ts-types.md#resourcecolor) | No| Underline indicator color and board color.
Default value: **#FF007DFF**| +| height | [Length](ts-types.md#length) | No| Height of the underline indicator.
Default value: **2.0**
Unit: vp| +| width | [Length](ts-types.md#length) | No| Width of the underline indicator.
Default value: **0.0**
Unit: vp| +| borderRadius | [Length](ts-types.md#length) | No| Radius of the rounded corner of the underline indicator.
Default value: **0.0**
Unit: vp| +| marginTop | [Length](ts-types.md#length) | No| Spacing between the underline indicator and text.
Default value: **8.0**
Unit: vp| + +## SelectedMode10+ +| Name | Description | +| ---------- | ------------------------ | +| INDICATOR | Underline indicator mode. | +| BOARD | Board mode. | + +## BoardStyle10+ + +| Name| Type| Mandatory| Description| +| -------- | -------- | -------- | ------------------------------------ | +| borderRadius | [Length](ts-types.md#length) | No| Radius of the rounded corner of the underline indicator.
Default value: **8.0**
Unit: vp| + +## LabelStyle10+ + +| Name | Type | Mandatory| Description | +| -------------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| overflow | [TextOverflow](ts-appendix-enums.md#textoverflow) | No | Display mode when the label text is too long. By default, an ellipsis (...) is used to represent text overflow.| +| maxLines | number | No | Maximum number of lines in the label text. By default, text is automatically folded. If this attribute is specified, the text will not exceed the specified number of lines. If there is extra text, you can use **textOverflow** to specify how it is displayed.| +| minFontSize | number \| [ResourceStr](ts-types.md#resourcestr) | No | Minimum font size of the label text. For the setting to take effect, this attribute must be used together with **maxFontSize**, **maxLines**, or layout constraint settings.| +| maxFontSize | number \| [ResourceStr](ts-types.md#resourcestr) | No | Maximum font size of the label text. For the setting to take effect, this attribute must be used together with **minFontSize**, **maxLines**, or layout constraint settings.| +| heightAdaptivePolicy | [TextHeightAdaptivePolicy](ts-appendix-enums.md#textheightadaptivepolicy10) | No | How the adaptive height is determined for the label text. | +| font | [Font](ts-types.md#font) | No | Font of the label text. | ## BottomTabBarStyle9+ Implements the bottom and side tab style. -### constructor9+ +### constructor -constructor(icon: string | Resource, text: string | Resource) +constructor(icon: string | Resource, content: string | Resource) A constructor used to create a **BottomTabBarStyle** instance. @@ -60,8 +123,20 @@ A constructor used to create a **BottomTabBarStyle** instance. | Name| Type | Mandatory| Description| | -------- | -------- | -------- | -------- | -| icon | string \| [Resource](ts-types.md#resource) | Yes| Image for the tab.| -| text | string \| [Resource](ts-types.md#resource) | Yes| Text for the tab.| +| icon | string \| [Resource](ts-types.md#resource) | Yes| Image for the tab. Since API version 10, the type of **icon** is **ResourceStr**.| +| text | string \| [Resource](ts-types.md#resource) | Yes| Text for the tab. Since API version 10, the type of **text** is **ResourceStr**.| + +### of10+ + +static of(icon: ResourceStr, text: ResourceStr) +Static constructor used to create a **BottomTabBarStyle** instance. + +**Parameters** + +| Name| Type | Mandatory| Description| +| -------- | -------- | -------- | -------- | +| icon | [ResourceStr](ts-types.md#resourcestr) | Yes| Image for the tab.| +| text | [ResourceStr](ts-types.md#resourcestr) | Yes| Text for the tab.| ## Example @@ -324,3 +399,4 @@ struct TabBarStyleExample { ``` ![tabbarStyle](figures/TabBarStyle.jpeg) + \ No newline at end of file diff --git a/en/application-dev/reference/arkui-ts/ts-container-tabs.md b/en/application-dev/reference/arkui-ts/ts-container-tabs.md index e1d90464b363777239c670b679a0cf1e2c5d711d..db9325e998325495db17eb915dbd888f834c4ecc 100644 --- a/en/application-dev/reference/arkui-ts/ts-container-tabs.md +++ b/en/application-dev/reference/arkui-ts/ts-container-tabs.md @@ -2,7 +2,7 @@ The **\** component is a container component that allows users to switch between content views through tabs. Each tab page corresponds to a content view. -> **NOTE**
+> **NOTE** > > This component is supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. @@ -18,47 +18,58 @@ Tabs(value?: {barPosition?: BarPosition, index?: number, controller?: [TabsContr **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| barPosition | BarPosition | No| Position of the **\** component.
Default value: **BarPosition.Start**| -| index | number | No| Initial tab index.
Default value: **0**| -| controller | [TabsController](#tabscontroller) | No| Tab controller.| +| Name | Type | Mandatory | Description | +| ----------- | --------------------------------- | ---- | ---------------------------------------- | +| barPosition | BarPosition | No | Position of the **\** component.
Default value: **BarPosition.Start** | +| index | number | No | Initial tab index.
Default value: **0**
**NOTE**

A value less than 0 evaluates to the default value.
The value ranges from 0 to the number of **\** subnodes minus 1.
When this parameter is set to different values, the slide animation for tab switching is enabled by default. To disable the animation, set **animationDuration** to **0**.| +| controller | [TabsController](#tabscontroller) | No | Tab controller. | ## BarPosition -| Name| Description| -| -------- | -------- | +| Name | Description | +| ----- | ---------------------------------------- | | Start | If the **vertical** attribute is set to **true**, the tab is on the left of the container. If the **vertical** attribute is set to **false**, the tab is on the top of the container.| -| End | If the **vertical** attribute is set to **true**, the tab is on the right of the container. If the **vertical** attribute is set to **false**, the tab is at the bottom of the container.| +| End | If the **vertical** attribute is set to **true**, the tab is on the right of the container. If the **vertical** attribute is set to **false**, the tab is at the bottom of the container.| ## Attributes In addition to the [universal attributes](ts-universal-attributes-size.md), the following attributes are supported. -| Name| Type| Description| -| -------- | -------- | -------- | -| vertical | boolean | Whether to use vertical tabs. The value **true** means to use vertical tabs, and **false** means to use horizontal tabs.
Default value: **false**| -| scrollable | boolean | Whether the tabs are scrollable. The value **true** means that the tabs are scrollable, and **false** means the opposite.
Default value: **true**| -| barMode | BarMode | Tab bar layout mode. For details, see **BarMode**.
Default value: **BarMode.Fixed**| -| barWidth | number \| Length8+ | Width of the tab bar. | -| barHeight | number \| Length8+ | Height of the tab bar. | -| animationDuration | number | Duration of the slide animation for tab switching. If this parameter is set, the tab switching animation is played when the user switches between tabs by sliding or clicking. If this parameter is not set, the tab switching animation is played only when the user switches between tabs by sliding.
Default value: **200**| +| Name | Type | Description | +| ------------------------ | ---------------------------------------- | ---------------------------------------- | +| vertical | boolean | Whether to use vertical tabs. The value **true** means to use vertical tabs, and **false** means to use horizontal tabs.
Default value: **false**| +| scrollable | boolean | Whether the tabs are scrollable. The value **true** means that the tabs are scrollable, and **false** means the opposite.
Default value: **true**| +| barMode | BarMode | Tab bar layout mode. For details, see **BarMode**.
Default value: **BarMode.Fixed**| +| barWidth | number \| Length8+ | Width of the tab bar.
**NOTE**

A value less than 0 or greater than the width of the **\** component evaluates to the default value.| +| barHeight | number \| Length8+ | Height of the tab bar.
**NOTE**

A value less than 0 or greater than the width of the **\** component evaluates to the default value.| +| animationDuration | number | Duration of the slide animation for tab switching. If this parameter is set, the tab switching animation is played when the user switches between tabs by sliding or clicking. If this parameter is not set, the tab switching animation is played only when the user switches between tabs by sliding.
Default value: **300**
**NOTE**
A value less than 0 or in percentage evaluates to the default value. | +| divider10+ | [DividerStyle](#dividerstyle10) \| null | Whether the divider is displayed for the **\** and **\** components and the divider style. By default, the divider is not displayed.
**DividerStyle**: divider style.
**null**: The divider is not displayed.| +| FadingEdge10+ | boolean | Whether the tab fades out when it exceeds the container width.
Default value: **true** | + +## DividerStyle10+ + +| Name | Type | Mandatory | Description | +| ----------- | ---------------------------------------- | ---- | ----------------------------------- | +| strokeWidth | [Length](ts-types.md#length) | Yes | Width of the divider. | +| color | [ResourceColor](ts-types.md#resourcecolor) | No | Color of the divider.
Default value: **#33182431** | +| startMargin | [Length](ts-types.md#length) | No | Distance between the divider and the top of the sidebar.
Default value: **0.0**
Unit: vp| +| endMargin | [Length](ts-types.md#length) | No | Distance between the divider and the bottom of the sidebar.
Default value: **0.0**
Unit: vp| ## BarMode -| Name| Description| -| -------- | -------- | +| Name | Description | +| ---------- | ---------------------------------------- | | Scrollable | The width of each tab is determined by the actual layout. The tabs are scrollable in the following case: In horizontal layout, the total width exceeds the tab bar width; in horizontal layout, the total height exceeds the tab bar height.| -| Fixed | The width of each tab is determined by equally dividing the number of tabs by the bar width (or the bar height in vertical layout).| +| Fixed | The width of each tab is determined by equally dividing the number of tabs by the bar width (or bar height in the vertical layout).| ## Events In addition to the [universal events](ts-universal-events-click.md), the following events are supported. -| Name| Description| -| -------- | -------- | -| onChange(event: (index: number) => void) | Event triggered when a tab is switched.| +| Name | Description | +| ------------------------------------------- | ------------------------------------------------------------ | +| onChange(event: (index: number) => void) | Triggered when a tab is switched.
- **index**: index of the active tab. The index starts from 0.
This event is triggered when any of the following conditions is met:
1. The **\** component supports sliding, and the user slides on the tab bar.
2. The [Controller](#tabscontroller) API is called.
3. The attribute value is updated using a [state variable](../../quick-start/arkts-state.md).
4. A tab is clicked. | ## TabsController @@ -66,9 +77,8 @@ Defines a tab controller, which is used to control switching of tabs. One **Tabs ### Objects to Import -``` +```ts controller: TabsController = new TabsController() - ``` ### changeIndex @@ -79,9 +89,9 @@ Switches to the specified tab. **Parameters** -| Name| Type| Mandatory| Description| -| -------- | -------- | -------- | -------- | -| value | number | Yes| Index of the tab. The value starts from 0.| +| Name | Type | Mandatory | Description | +| ----- | ------ | ---- | ---------------------------------------- | +| value | number | Yes | Index of the tab. The value starts from 0.
**NOTE**

If this parameter is set to a value less than 0 or greater than the maximum number, the event will be invalid.| ## Example @@ -148,3 +158,4 @@ struct TabsExample { ``` ![tabs2](figures/tabs2.gif) + \ No newline at end of file diff --git a/en/application-dev/reference/arkui-ts/ts-drawing-components-circle.md b/en/application-dev/reference/arkui-ts/ts-drawing-components-circle.md index 1c17cda5d9d55a722cbf3351b3a72586d224c346..47c8c41f78db5961fb831835c0b73fd8b91e129e 100644 --- a/en/application-dev/reference/arkui-ts/ts-drawing-components-circle.md +++ b/en/application-dev/reference/arkui-ts/ts-drawing-components-circle.md @@ -16,6 +16,8 @@ Not supported Circle(options?: {width?: string | number, height?: string | number}) +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name| Type| Mandatory| Description| @@ -29,17 +31,17 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name| Type| Description| | -------- | -------- | -------- | -| fill | [ResourceColor](ts-types.md) | Color of the fill area.
Default value: **Color.Black**| -| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| Opacity of the fill area.
Default value: **1**| -| stroke | [ResourceColor](ts-types.md) | Stroke color. If this attribute is not set, the component does not have any stroke.| -| strokeDashArray | Array<Length> | Stroke dashes.
Default value: **[]** | -| strokeDashOffset | number \| string | Offset of the start point for drawing the stroke.
Default value: **0**| -| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | Cap style of the stroke.
Default value: **LineCapStyle.Butt**| -| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | Join style of the stroke.
Default value: **LineJoinStyle.Miter**| -| strokeMiterLimit | number \| string | Limit on the ratio of the miter length to the value of **strokeWidth** used to draw a miter join.
Default value: **4**
**NOTE**
This attribute does not take effect for the **\** component, because it does not have a miter join.| -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| Stroke opacity.
Default value: **1**
**NOTE**
The value range is [0.0, 1.0]. If the set value is less than 0.0, **0.0** will be used. If the set value is greater than 1.0, **1.0** will be used.| -| strokeWidth | Length | Stroke width.
Default value: **1**| -| antiAlias | boolean | Whether anti-aliasing is enabled.
Default value: **true**| +| fill | [ResourceColor](ts-types.md) | Color of the fill area.
Default value: **Color.Black**
Since API version 9, this API is supported in ArkTS widgets.| +| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| Opacity of the fill area.
Default value: **1**
Since API version 9, this API is supported in ArkTS widgets.| +| stroke | [ResourceColor](ts-types.md) | Stroke color. If this attribute is not set, the component does not have any stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeDashArray | Array<Length> | Stroke dashes.
Default value: **[]**
Since API version 9, this API is supported in ArkTS widgets.| +| strokeDashOffset | number \| string | Offset of the start point for drawing the stroke.
Default value: **0**
Since API version 9, this API is supported in ArkTS widgets.| +| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | Cap style of the stroke.
Default value: **LineCapStyle.Butt**
Since API version 9, this API is supported in ArkTS widgets.| +| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | Join style of the stroke.
Default value: **LineJoinStyle.Miter**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
This attribute does not work for the **\** component, which does not have corners.| +| strokeMiterLimit | number \| string | Limit on the ratio of the miter length to the value of **strokeWidth** used to draw a miter join.
Default value: **4**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
This attribute does not take effect for the **\** component, because it does not have a miter join.| +| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| Stroke opacity.
Default value: **1**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
The value range is [0.0, 1.0]. If the set value is less than 0.0, **0.0** will be used. If the set value is greater than 1.0, **1.0** will be used.| +| strokeWidth | Length | Stroke width.
Default value: **1**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
The value cannot be a percentage.| +| antiAlias | boolean | Whether anti-aliasing is enabled.
Default value: **true**
Since API version 9, this API is supported in ArkTS widgets.| ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-drawing-components-ellipse.md b/en/application-dev/reference/arkui-ts/ts-drawing-components-ellipse.md index 019f2f008a634f1aee6f1a90d1028b3c69cbd30f..95d6e04adb6cdac5a36d57cc6013c3eb98434491 100644 --- a/en/application-dev/reference/arkui-ts/ts-drawing-components-ellipse.md +++ b/en/application-dev/reference/arkui-ts/ts-drawing-components-ellipse.md @@ -16,6 +16,8 @@ Not supported Ellipse(options?: {width?: string | number, height?: string | number}) +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name| Type| Mandatory| Description| @@ -29,17 +31,17 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name| Type| Default Value| Description| | -------- | -------- | -------- | -------- | -| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.| -| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.| -| stroke | [ResourceColor](ts-types.md) | - |Stroke color. If this attribute is not set, the component does not have any stroke.| -| strokeDashArray | Array<Length> | [] | Stroke dashes.| -| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.| -| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.| -| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.| -| strokeMiterLimit | number \| string | 4 | Limit on the ratio of the miter length to the value of **strokeWidth** used to draw a miter join.
**NOTE**
This attribute does not take effect for the **\** component, because it does not have a miter join.| -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.
**NOTE**
The value range is [0.0, 1.0]. If the set value is less than 0.0, **0.0** will be used. If the set value is greater than 1.0, **1.0** will be used.| -| strokeWidth | Length | 1 | Stroke width.| -| antiAlias | boolean | true | Whether anti-aliasing is enabled.| +| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.
Since API version 9, this API is supported in ArkTS widgets.| +| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.
Since API version 9, this API is supported in ArkTS widgets.| +| stroke | [ResourceColor](ts-types.md) | - |Stroke color. If this attribute is not set, the component does not have any stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeDashArray | Array<Length> | [] | Stroke dashes.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
This attribute does not work for the **\** component, which does not have corners.| +| strokeMiterLimit | number \| string | 4 | Limit on the ratio of the miter length to the value of **strokeWidth** used to draw a miter join.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
This attribute does not take effect for the **\** component, because it does not have a miter join.| +| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
The value range is [0.0, 1.0]. If the set value is less than 0.0, **0.0** will be used. If the set value is greater than 1.0, **1.0** will be used.| +| strokeWidth | Length | 1 | Stroke width.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
The value cannot be a percentage.| +| antiAlias | boolean | true | Whether anti-aliasing is enabled.
Since API version 9, this API is supported in ArkTS widgets.| ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-drawing-components-line.md b/en/application-dev/reference/arkui-ts/ts-drawing-components-line.md index 724c976b06687a818a0456d9fdd4b845a4ea85ab..fec90d36ae1f8b6ebdd3464142a29dbe9bbfd2e7 100644 --- a/en/application-dev/reference/arkui-ts/ts-drawing-components-line.md +++ b/en/application-dev/reference/arkui-ts/ts-drawing-components-line.md @@ -15,6 +15,8 @@ Not supported Line(value?: {width?: string | number, height?: string | number}) +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name| Type| Mandatory| Default Value| Description| @@ -29,19 +31,19 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name| Type| Default Value| Description| | -------- | -------- | -------- | -------- | -| startPoint | Array<Length> | [0, 0] | Coordinates (relative coordinates) of the start point of the line, in vp.| -| endPoint | Array<Length> | [0, 0] | Coordinates (relative coordinates) of the end point of the line, in vp.| -| fill | [ResourceColor](ts-types.md#resourcecolor) | Color.Black | Color of the fill area.
**NOTE**
This attribute does not take effect because the **\** component cannot be used to draw a closed shape.| -| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.
**NOTE**
This attribute does not take effect because the **\** component cannot be used to draw a closed shape.| -| stroke | [ResourceColor](ts-types.md#resourcecolor) | Color.Black | Stroke color.| -| strokeDashArray | Array<Length> | [] | Stroke dashes.| -| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.| -| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.| -| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.| -| strokeMiterLimit | number \| string | 4 | Limit value when the sharp angle is drawn as a miter.
**NOTE**
This attribute does not take effect because the **\** component cannot be used to draw a shape with a sharp angle.| -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.
**NOTE**
The value range is [0.0, 1.0]. If the set value is less than 0.0, **0.0** will be used. If the set value is greater than 1.0, **1.0** will be used.| -| strokeWidth | Length | 1 | Stroke width.| -| antiAlias | boolean | true | Whether anti-aliasing is enabled.| +| startPoint | Array<Length> | [0, 0] | Coordinates (relative coordinates) of the start point of the line, in vp.
Since API version 9, this API is supported in ArkTS widgets.| +| endPoint | Array<Length> | [0, 0] | Coordinates (relative coordinates) of the end point of the line, in vp.
Since API version 9, this API is supported in ArkTS widgets.| +| fill | [ResourceColor](ts-types.md#resourcecolor) | Color.Black | Color of the fill area.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
This attribute does not take effect because the **\** component cannot be used to draw a closed shape.| +| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
This attribute does not take effect because the **\** component cannot be used to draw a closed shape.| +| stroke | [ResourceColor](ts-types.md) | - | Stroke color. If this attribute is not set, the component does not have any stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeDashArray | Array<Length> | [] | Stroke dashes.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
This attribute does not work for the **\** component, which does not have corners. | +| strokeMiterLimit | number \| string | 4 | Limit value when the sharp angle is drawn as a miter.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
This attribute does not take effect because the **\** component cannot be used to draw a shape with a sharp angle.| +| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
The value range is [0.0, 1.0]. If the set value is less than 0.0, **0.0** will be used. If the set value is greater than 1.0, **1.0** will be used.| +| strokeWidth | Length | 1 | Stroke width.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
The value cannot be a percentage.| +| antiAlias | boolean | true | Whether anti-aliasing is enabled.
Since API version 9, this API is supported in ArkTS widgets.| ## Example @@ -56,32 +58,41 @@ struct LineExample { Column({ space: 10 }) { // The coordinates of the start and end points of the line are determined relative to the coordinates of the drawing area of the component. Line() + .width(200) + .height(150) .startPoint([0, 0]) .endPoint([50, 100]) + .stroke(Color.Black) .backgroundColor('#F5F5F5') Line() .width(200) - .height(200) + .height(150) .startPoint([50, 50]) .endPoint([150, 150]) .strokeWidth(5) .stroke(Color.Orange) .strokeOpacity(0.5) .backgroundColor('#F5F5F5') - // If the coordinates of a point are beyond the width and height range of the component, the line will exceed the drawing area. - Line({ width: 50, height: 50 }) + // strokeDashOffset is used to define the offset when the associated strokeDashArray array is rendered. + Line() + .width(200) + .height(150) .startPoint([0, 0]) .endPoint([100, 100]) + .stroke(Color.Black) .strokeWidth(3) .strokeDashArray([10, 3]) + .strokeDashOffset(5) .backgroundColor('#F5F5F5') - // strokeDashOffset is used to define the offset when the associated strokeDashArray array is rendered. - Line({ width: 50, height: 50 }) + // If the coordinates of a point are beyond the width and height range of the component, the line will exceed the drawing area. + Line() + .width(50) + .height(50) .startPoint([0, 0]) .endPoint([100, 100]) + .stroke(Color.Black) .strokeWidth(3) .strokeDashArray([10, 3]) - .strokeDashOffset(5) .backgroundColor('#F5F5F5') } } @@ -105,6 +116,7 @@ struct LineExample1 { .height(200) .startPoint([50, 50]) .endPoint([50, 200]) + .stroke(Color.Black) .strokeWidth(20) .strokeLineCap(LineCapStyle.Butt) .backgroundColor('#F5F5F5').margin(10) @@ -114,6 +126,7 @@ struct LineExample1 { .height(200) .startPoint([50, 50]) .endPoint([50, 200]) + .stroke(Color.Black) .strokeWidth(20) .strokeLineCap(LineCapStyle.Round) .backgroundColor('#F5F5F5') @@ -123,6 +136,7 @@ struct LineExample1 { .height(200) .startPoint([50, 50]) .endPoint([50, 200]) + .stroke(Color.Black) .strokeWidth(20) .strokeLineCap(LineCapStyle.Square) .backgroundColor('#F5F5F5') @@ -143,31 +157,46 @@ struct LineExample { build() { Column() { Line() + .width(300) + .height(30) .startPoint([50, 30]) .endPoint([300, 30]) + .stroke(Color.Black) .strokeWidth(10) // Set the interval for strokeDashArray to 50. Line() + .width(300) + .height(30) .startPoint([50, 20]) .endPoint([300, 20]) + .stroke(Color.Black) .strokeWidth(10) .strokeDashArray([50]) // Set the interval for strokeDashArray to 50, 10. Line() + .width(300) + .height(30) .startPoint([50, 20]) .endPoint([300, 20]) + .stroke(Color.Black) .strokeWidth(10) .strokeDashArray([50, 10]) // Set the interval for strokeDashArray to 50, 10, 20. Line() + .width(300) + .height(30) .startPoint([50, 20]) .endPoint([300, 20]) + .stroke(Color.Black) .strokeWidth(10) .strokeDashArray([50, 10, 20]) // Set the interval for strokeDashArray to 50, 10, 20, 30. Line() + .width(300) + .height(30) .startPoint([50, 20]) .endPoint([300, 20]) + .stroke(Color.Black) .strokeWidth(10) .strokeDashArray([50, 10, 20, 30]) diff --git a/en/application-dev/reference/arkui-ts/ts-drawing-components-path.md b/en/application-dev/reference/arkui-ts/ts-drawing-components-path.md index f0645c5079ef86d29d848e059c5187bf76f5d8d3..25ba06a014b013ed97219d21cca40cca8f8e90c3 100644 --- a/en/application-dev/reference/arkui-ts/ts-drawing-components-path.md +++ b/en/application-dev/reference/arkui-ts/ts-drawing-components-path.md @@ -15,6 +15,8 @@ Not supported Path(value?: { width?: number | string; height?: number | string; commands?: string }) +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name | Type | Mandatory| Description | @@ -29,18 +31,18 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name | Type | Default Value | Description | | -------- | ----------------------------------- | ---- | ---------------------------------------- | -| commands | string | '' | Command for drawing the path. The unit is px. For details about how to convert pixel units, see [Pixel Units](ts-pixel-units.md).| -| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.| -| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.| -| stroke | [ResourceColor](ts-types.md) | - | Stroke color.| -| strokeDashArray | Array<Length> | [] | Stroke dashes.| -| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.| -| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.| -| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.| -| strokeMiterLimit | number \| string | 4 | Limit on the ratio of the miter length to the value of **strokeWidth** used to draw a miter join. The miter length indicates the distance from the outer tip to the inner corner of the miter.
**NOTE**
This attribute must be set to a value greater than or equal to 1 and takes effect when **strokeLineJoin** is set to **LineJoinStyle.Miter**.| -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the stroke.
**NOTE**
The value range is [0.0, 1.0]. If the set value is less than 0.0, **0.0** will be used. If the set value is greater than 1.0, **1.0** will be used.| -| strokeWidth | Length | 1 | Width of the stroke.| -| antiAlias | boolean | true | Whether anti-aliasing is enabled.| +| commands | string | '' | Command for drawing the path. The unit is px. For details about how to convert pixel units, see [Pixel Units](ts-pixel-units.md).
Since API version 9, this API is supported in ArkTS widgets.| +| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.
Since API version 9, this API is supported in ArkTS widgets.| +| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.
Since API version 9, this API is supported in ArkTS widgets.| +| stroke | [ResourceColor](ts-types.md) | - |Stroke color. If this attribute is not set, the component does not have any stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeDashArray | Array<Length> | [] | Stroke dashes.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeMiterLimit | number \| string | 4 | Limit on the ratio of the miter length to the value of **strokeWidth** used to draw a miter join. The miter length indicates the distance from the outer tip to the inner corner of the miter.
**NOTE**
This attribute must be set to a value greater than or equal to 1 and takes effect when **strokeLineJoin** is set to **LineJoinStyle.Miter**.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the stroke.
**NOTE**
The value range is [0.0, 1.0]. If the set value is less than 0.0, **0.0** will be used. If the set value is greater than 1.0, **1.0** will be used.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeWidth | Length | 1 | Width of the stroke.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
The value cannot be a percentage.| +| antiAlias | boolean | true | Whether anti-aliasing is enabled.
Since API version 9, this API is supported in ArkTS widgets.| The supported commands are as follows: @@ -72,9 +74,10 @@ struct PathExample { .fontSize(11) .fontColor(0xCCCCCC) .width('90%') - // Draw a straight line whose length is 900 px and width is 3 vp. + // Draw a straight line whose length is 600 px and width is 3 vp. Path() - .height(10) + .width('600px') + .height('10px') .commands('M0 0 L600 0') .stroke(Color.Black) .strokeWidth(3) @@ -86,16 +89,22 @@ struct PathExample { // Draw a straight line. Flex({ justifyContent: FlexAlign.SpaceBetween }) { Path() + .width('210px') + .height('310px') .commands('M100 0 L200 240 L0 240 Z') .fillOpacity(0) .stroke(Color.Black) .strokeWidth(3) Path() + .width('210px') + .height('310px') .commands('M0 0 H200 V200 H0 Z') .fillOpacity(0) .stroke(Color.Black) .strokeWidth(3) Path() + .width('210px') + .height('310px') .commands('M100 0 L0 100 L50 200 L150 200 L200 100 Z') .fillOpacity(0) .stroke(Color.Black) @@ -106,16 +115,22 @@ struct PathExample { // Draw an arc. Flex({ justifyContent: FlexAlign.SpaceBetween }) { Path() + .width('250px') + .height('310px') .commands("M0 300 S100 0 240 300 Z") .fillOpacity(0) .stroke(Color.Black) .strokeWidth(3) Path() + .width('210px') + .height('310px') .commands('M0 150 C0 100 140 0 200 150 L100 300 Z') .fillOpacity(0) .stroke(Color.Black) .strokeWidth(3) Path() + .width('210px') + .height('310px') .commands('M0 100 A30 20 20 0 0 200 100 Z') .fillOpacity(0) .stroke(Color.Black) diff --git a/en/application-dev/reference/arkui-ts/ts-drawing-components-polygon.md b/en/application-dev/reference/arkui-ts/ts-drawing-components-polygon.md index c8c45849bc38492435bee3aa441af82913bb519d..8a0450ff17a692d98170a9dca96d7acb65250660 100644 --- a/en/application-dev/reference/arkui-ts/ts-drawing-components-polygon.md +++ b/en/application-dev/reference/arkui-ts/ts-drawing-components-polygon.md @@ -16,6 +16,8 @@ Not supported Polygon(value?: {width?: string | number, height?: string | number}) +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name| Type| Mandatory| Default Value| Description| @@ -30,23 +32,25 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name| Type| Default Value| Description| | -------- | -------- | -------- | -------- | -| points | Array<Point> | [] | Vertex coordinates of the polygon.| -| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.| -| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.| -| stroke | [ResourceColor](ts-types.md) | - | Stroke color. If this attribute is not set, the component does not have any stroke.| -| strokeDashArray | Array<Length> | [] | Stroke dashes.| -| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.| -| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.| -| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.| -| strokeMiterLimit | number \| string | 4 | Limit on the ratio of the miter length to the value of **strokeWidth** used to draw a miter join. The miter length indicates the distance from the outer tip to the inner corner of the miter.
**NOTE**
This attribute must be set to a value greater than or equal to 1 and takes effect when **strokeLineJoin** is set to **LineJoinStyle.Miter**.| -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.
**NOTE**
The value range is [0.0, 1.0]. If the set value is less than 0.0, **0.0** will be used. If the set value is greater than 1.0, **1.0** will be used.| -| strokeWidth | Length | 1 | Stroke width.| -| antiAlias | boolean | true | Whether anti-aliasing is enabled.| +| points | Array<Point> | [] | Vertex coordinates of the polygon.
Since API version 9, this API is supported in ArkTS widgets.| +| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.
Since API version 9, this API is supported in ArkTS widgets.| +| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.
Since API version 9, this API is supported in ArkTS widgets.| +| stroke | [ResourceColor](ts-types.md) | - | Stroke color. If this attribute is not set, the component does not have any stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeDashArray | Array<Length> | [] | Stroke dashes.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeMiterLimit | number \| string | 4 | Limit on the ratio of the miter length to the value of **strokeWidth** used to draw a miter join. The miter length indicates the distance from the outer tip to the inner corner of the miter.
**NOTE**
This attribute must be set to a value greater than or equal to 1 and takes effect when **strokeLineJoin** is set to **LineJoinStyle.Miter**.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.
**NOTE**
The value range is [0.0, 1.0]. If the set value is less than 0.0, **0.0** will be used. If the set value is greater than 1.0, **1.0** will be used.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeWidth | Length | 1 | Stroke width.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
The value cannot be a percentage.| +| antiAlias | boolean | true | Whether anti-aliasing is enabled.
Since API version 9, this API is supported in ArkTS widgets.| ## Point Describes the coordinates of a point. +Since API version 9, this API is supported in ArkTS widgets. + | Name | Type | Description | | --------- | -------------------- | ------------------------------------------------------------ | | Point | [number, number] | Coordinates of a point. The first parameter is the x-coordinate, and the second parameter is the y-coordinate (relative coordinate).| diff --git a/en/application-dev/reference/arkui-ts/ts-drawing-components-polyline.md b/en/application-dev/reference/arkui-ts/ts-drawing-components-polyline.md index 739ca2b19aa78128b2154db9df778bb65dfe9ba9..6681e790aeb02e3bcfb706cf0162e9c0376e7906 100644 --- a/en/application-dev/reference/arkui-ts/ts-drawing-components-polyline.md +++ b/en/application-dev/reference/arkui-ts/ts-drawing-components-polyline.md @@ -16,6 +16,8 @@ Not supported Polyline(value?: {width?: string | number, height?: string | number}) +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name| Type| Mandatory| Default Value| Description| @@ -30,23 +32,25 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name| Type| Default Value| Description| | -------- | -------- | -------- | -------- | -| points | Array<Point> | [] | List of coordinates that the polyline passes through.| -| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.| -| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.| -| stroke | [ResourceColor](ts-types.md) | - | Stroke color.| -| strokeDashArray | Array<Length> | [] | Stroke dashes.| -| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.| -| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.| -| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.| -| strokeMiterLimit | number \| string | 4 | Limit on the ratio of the miter length to the value of **strokeWidth** used to draw a miter join. The miter length indicates the distance from the outer tip to the inner corner of the miter.
**NOTE**
This attribute must be set to a value greater than or equal to 1 and takes effect when **strokeLineJoin** is set to **LineJoinStyle.Miter**.| -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.
**NOTE**
The value range is [0.0, 1.0]. If the set value is less than 0.0, **0.0** will be used. If the set value is greater than 1.0, **1.0** will be used.| -| strokeWidth | Length | 1 | Stroke width.| -| antiAlias | boolean | true | Whether anti-aliasing is enabled.| +| points | Array<Point> | [] | List of coordinates that the polyline passes through.
Since API version 9, this API is supported in ArkTS widgets.| +| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.
Since API version 9, this API is supported in ArkTS widgets.| +| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.
Since API version 9, this API is supported in ArkTS widgets.| +| stroke | [ResourceColor](ts-types.md) | - | Stroke color. If this attribute is not set, the component does not have any stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeDashArray | Array<Length> | [] | Stroke dashes.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeMiterLimit | number \| string | 4 | Limit on the ratio of the miter length to the value of **strokeWidth** used to draw a miter join. The miter length indicates the distance from the outer tip to the inner corner of the miter.
**NOTE**
This attribute must be set to a value greater than or equal to 1 and takes effect when **strokeLineJoin** is set to **LineJoinStyle.Miter**.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.
**NOTE**
The value range is [0.0, 1.0]. If the set value is less than 0.0, **0.0** will be used. If the set value is greater than 1.0, **1.0** will be used.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeWidth | Length | 1 | Stroke width.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
The value cannot be a percentage.| +| antiAlias | boolean | true | Whether anti-aliasing is enabled.
Since API version 9, this API is supported in ArkTS widgets.| ## Point Describes the coordinates of a point. +Since API version 9, this API is supported in ArkTS widgets. + | Name | Type | Description | | --------- | -------------------- | ------------------------------------------------------------ | | Point | [number, number] | Coordinates of a point. The first parameter is the x-coordinate, and the second parameter is the y-coordinate (relative coordinate).| diff --git a/en/application-dev/reference/arkui-ts/ts-drawing-components-rect.md b/en/application-dev/reference/arkui-ts/ts-drawing-components-rect.md index e05fad3fd06045b8a6a4641c308378f1caaafbb7..c7fac4fa35067c4e9be6e6e7aca05f0d7e25bdb1 100644 --- a/en/application-dev/reference/arkui-ts/ts-drawing-components-rect.md +++ b/en/application-dev/reference/arkui-ts/ts-drawing-components-rect.md @@ -17,6 +17,8 @@ Not supported Rect(value?: {width?: string | number,height?: string | number,radius?: string | number | Array<string | number>} | {width?: string | number,height?: string | number,radiusWidth?: string | number,radiusHeight?: string | number}) +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name| Type| Mandatory| Default Value| Description| @@ -34,20 +36,20 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name| Type| Default Value| Description| | -------- | -------- | -------- | -------- | -| radiusWidth | string \| number | 0 | Width of the rounded corner. The width and height are the same when only the width is set.| -| radiusHeight | string \| number | 0 | Height of the rounded corner. The width and height are the same only when the height is set.| -| radius | string \| number \| Array<string \| number> | 0 | Radius of the rounded corner. You can set separate radiuses for four rounded corners.| -| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.| -| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.| -| stroke | [ResourceColor](ts-types.md) | - | Stroke color. If this attribute is not set, the component does not have any stroke.| -| strokeDashArray | Array<Length> | [] | Stroke dashes. | -| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.| -| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.| -| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.| -| strokeMiterLimit | number \| string | 4 | Limit on the ratio of the miter length to the value of **strokeWidth** used to draw a miter join. The miter length indicates the distance from the outer tip to the inner corner of the miter.
**NOTE**
This attribute must be set to a value greater than or equal to 1 and takes effect when **strokeLineJoin** is set to **LineJoinStyle.Miter**.| -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.
**NOTE**
The value range is [0.0, 1.0]. If the set value is less than 0.0, **0.0** will be used. If the set value is greater than 1.0, **1.0** will be used.| -| strokeWidth | Length | 1 | Stroke width.| -| antiAlias | boolean | true | Whether anti-aliasing is enabled.| +| radiusWidth | string \| number | 0 | Width of the rounded corner. The width and height are the same when only the width is set.
Since API version 9, this API is supported in ArkTS widgets.| +| radiusHeight | string \| number | 0 | Height of the rounded corner. The width and height are the same only when the height is set.
Since API version 9, this API is supported in ArkTS widgets.| +| radius | string \| number \| Array<string \| number> | 0 | Radius of the rounded corner. You can set separate radiuses for four rounded corners.
Since API version 9, this API is supported in ArkTS widgets.| +| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.
Since API version 9, this API is supported in ArkTS widgets.| +| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.
Since API version 9, this API is supported in ArkTS widgets.| +| stroke | [ResourceColor](ts-types.md) | - | Stroke color. If this attribute is not set, the component does not have any stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeDashArray | Array<Length> | [] | Stroke dashes.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeMiterLimit | number \| string | 4 | Limit on the ratio of the miter length to the value of **strokeWidth** used to draw a miter join. The miter length indicates the distance from the outer tip to the inner corner of the miter.
**NOTE**
This attribute must be set to a value greater than or equal to 1 and takes effect when **strokeLineJoin** is set to **LineJoinStyle.Miter**.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.
**NOTE**
The value range is [0.0, 1.0]. If the set value is less than 0.0, **0.0** will be used. If the set value is greater than 1.0, **1.0** will be used.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeWidth | Length | 1 | Stroke width.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
The value cannot be a percentage.| +| antiAlias | boolean | true | Whether anti-aliasing is enabled.
Since API version 9, this API is supported in ArkTS widgets.| ## Example @@ -84,6 +86,7 @@ struct RectExample { Rect({ width: '90%', height: 80 }) .radius(20) .fill(Color.Pink) + .stroke(Color.Transparent) }.width('100%').margin({ top: 10 }) // Draw a 90% x 50 rectangle, with the width and height of its rounded corners as follows: 40 for the upper left rounded corner, 20 for the upper right rounded corner, 40 for the lower right rounded corner, and 20 for the lower left rounded corner. Rect({ width: '90%', height: 80 }) diff --git a/en/application-dev/reference/arkui-ts/ts-drawing-components-shape.md b/en/application-dev/reference/arkui-ts/ts-drawing-components-shape.md index 5cb117bb123247c736fc870db245c59f6187e41a..d97d69beb73a8ac5c3a0a1c52c701287f056f827 100644 --- a/en/application-dev/reference/arkui-ts/ts-drawing-components-shape.md +++ b/en/application-dev/reference/arkui-ts/ts-drawing-components-shape.md @@ -21,6 +21,8 @@ The following child components are supported: **[\](ts-drawing-components- Shape(value?: PixelMap) +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name| Type| Mandatory| Default Value| Description| @@ -34,19 +36,19 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the | Name| Type| Default Value| Description| | -------- | -------- | -------- | -------- | -| viewPort | {
x?: number \| string,
y?: number \| string,
width?: number \| string,
height?: number \| string
} | { x:0, y:0, width:0, height:0 } | View port of the shape.| -| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.| -| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.| -| stroke | [ResourceColor](ts-types.md) | - | Stroke color. If this attribute is not set, the component does not have any stroke.| -| strokeDashArray | Array<Length> | [] | Stroke dashes.| -| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.| -| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.| -| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.| -| strokeMiterLimit | number \| string | 4 | Limit on the ratio of the miter length to the value of **strokeWidth** used to draw a miter join. The miter length indicates the distance from the outer tip to the inner corner of the miter.
**NOTE**
This attribute must be set to a value greater than or equal to 1 and takes effect when **strokeLineJoin** is set to **LineJoinStyle.Miter**.| -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.
**NOTE**
The value range is [0.0, 1.0]. If the set value is less than 0.0, **0.0** will be used. If the set value is greater than 1.0, **1.0** will be used.| -| strokeWidth | number \| string | 1 | Stroke width.| -| antiAlias | boolean | true | Whether anti-aliasing is enabled.| -| mesh8+ | Array<number>,number,number | [],0,0 | Mesh effect. The first parameter is an array of lengths (column + 1) * (row + 1) * 2, which records the position of each vertex of the distorted bitmap. The second parameter is the number of columns in the mesh matrix. The third parameter is the number of rows in the mesh matrix.| +| viewPort | {
x?: number \| string,
y?: number \| string,
width?: number \| string,
height?: number \| string
} | { x:0, y:0, width:0, height:0 } | View port of the shape.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
If of the string type, the value cannot be a percentage.| +| fill | [ResourceColor](ts-types.md) | Color.Black | Color of the fill area.
Since API version 9, this API is supported in ArkTS widgets.| +| fillOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Opacity of the fill area.
Since API version 9, this API is supported in ArkTS widgets.| +| stroke | [ResourceColor](ts-types.md) | - | Stroke color. If this attribute is not set, the component does not have any stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeDashArray | Array<Length> | [] | Stroke dashes.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeDashOffset | number \| string | 0 | Offset of the start point for drawing the stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | Cap style of the stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | Join style of the stroke.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeMiterLimit | number \| string | 4 | Limit on the ratio of the miter length to the value of **strokeWidth** used to draw a miter join. The miter length indicates the distance from the outer tip to the inner corner of the miter.
**NOTE**
This attribute must be set to a value greater than or equal to 1 and takes effect when **strokeLineJoin** is set to **LineJoinStyle.Miter**.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeOpacity | number \| string \| [Resource](ts-types.md#resource)| 1 | Stroke opacity.
**NOTE**
The value range is [0.0, 1.0]. If the set value is less than 0.0, **0.0** will be used. If the set value is greater than 1.0, **1.0** will be used.
Since API version 9, this API is supported in ArkTS widgets.| +| strokeWidth | number \| string | 1 | Stroke width.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
If of the string type, the value cannot be a percentage.| +| antiAlias | boolean | true | Whether anti-aliasing is enabled.
Since API version 9, this API is supported in ArkTS widgets.| +| mesh8+ | Array<number>,number,number | [],0,0 | Mesh effect. The first parameter is an array of lengths (column + 1) * (row + 1) * 2, which records the position of each vertex of the distorted bitmap. The second parameter is the number of columns in the mesh matrix. The third parameter is the number of rows in the mesh matrix.
Since API version 9, this API is supported in ArkTS widgets.| ## Example @@ -68,6 +70,8 @@ struct ShapeExample { Ellipse().width(300).height(50).offset({ x: 0, y: 60 }) Path().width(300).height(10).commands('M0 0 L900 0').offset({ x: 0, y: 120 }) } + .width(350) + .height(140) .viewPort({ x: -2, y: -2, width: 304, height: 130 }) .fill(0x317AF7) .stroke(Color.Black) @@ -81,6 +85,8 @@ struct ShapeExample { Shape() { Rect().width(300).height(50) } + .width(350) + .height(80) .viewPort({ x: 0, y: 0, width: 320, height: 70 }) .fill(0x317AF7) .stroke(Color.Black) @@ -89,6 +95,8 @@ struct ShapeExample { Shape() { Rect().width(300).height(50) } + .width(350) + .height(80) .viewPort({ x: -5, y: -5, width: 320, height: 70 }) .fill(0x317AF7) .stroke(Color.Black) @@ -99,6 +107,8 @@ struct ShapeExample { Shape() { Path().width(300).height(10).commands('M0 0 L900 0') } + .width(350) + .height(20) .viewPort({ x: 0, y: -5, width: 300, height: 20 }) .stroke(0xEE8443) .strokeWidth(10) @@ -107,6 +117,8 @@ struct ShapeExample { Shape() { Path().width(300).height(10).commands('M0 0 L900 0') } + .width(350) + .height(20) .viewPort({ x: 0, y: -5, width: 300, height: 20 }) .stroke(0xEE8443) .strokeWidth(10) @@ -116,6 +128,8 @@ struct ShapeExample { Shape() { Path().width(300).height(10).commands('M0 0 L900 0') } + .width(350) + .height(20) .viewPort({ x: 0, y: -5, width: 300, height: 20 }) .stroke(0xEE8443) .strokeWidth(10) @@ -124,6 +138,8 @@ struct ShapeExample { Shape() { Path().width(300).height(10).commands('M0 0 L900 0') } + .width(350) + .height(20) .viewPort({ x: 0, y: -5, width: 300, height: 20 }) .stroke(0xEE8443) .strokeWidth(10) @@ -133,7 +149,9 @@ struct ShapeExample { Shape() { Path().width(200).height(60).commands('M0 0 L400 0 L400 150 Z') } - .viewPort({ x: -80, y: -5, width: 310, height: 90 }) + .width(300) + .height(200) + .viewPort({ x: -20, y: -5, width: 310, height: 90 }) .fill(0x317AF7) .stroke(0xEE8443) .strokeWidth(10) @@ -145,3 +163,4 @@ struct ShapeExample { ``` ![en-us_image_0000001184628104](figures/en-us_image_0000001184628104.png) + diff --git a/en/application-dev/reference/arkui-ts/ts-explicit-animation.md b/en/application-dev/reference/arkui-ts/ts-explicit-animation.md index b2802444ab2e297ffc599263910afea57fee2465..3e756f519e74b7f851b3af2401e7272eb133a4a9 100644 --- a/en/application-dev/reference/arkui-ts/ts-explicit-animation.md +++ b/en/application-dev/reference/arkui-ts/ts-explicit-animation.md @@ -6,9 +6,10 @@ You can create explicit animation with your custom settings. > > The APIs of this module are supported since API version 7. Updates will be marked with a superscript to indicate their earliest API version. - animateTo(value: AnimateParam, event: () => void): void +Since API version 9, this API is supported in ArkTS widgets. + | Name | Type | Mandatory | Description | | ---------------- | ------------ | -------------------- | -------------------- | | value | [AnimateParam](#animateparam)| Yes| Animation settings.| @@ -18,13 +19,13 @@ animateTo(value: AnimateParam, event: () => void): void | Name| Type| Description| | -------- | -------- | -------- | -| duration | number | Animation duration, in ms.
Default value: **1000**| +| duration | number | Animation duration, in ms.
Default value: **1000**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
- The maximum animation duration on an ArkTS widget is 1000 ms. If the set value exceeds the limit, the value **1000** will be used.| | tempo | number | Animation playback speed. A larger value indicates faster animation playback, and a smaller value indicates slower animation playback. The value **0** means that there is no animation.
Default value: **1.0**| -| curve | [Curve](ts-appendix-enums.md#curve) \| [ICurve](../apis/js-apis-curve.md#icurve) \| string | Animation curve.
Default value: **Curve.Linear**| +| curve | [Curve](ts-appendix-enums.md#curve) \| [ICurve](../apis/js-apis-curve.md#icurve) \| string | Animation curve.
Default value: **Curve.Linear**
Since API version 9, this API is supported in ArkTS widgets.| | delay | number | Delay of animation playback, in ms. By default, the playback is not delayed.
Default value: **0**| | iterations | number | Number of times that the animation is played. By default, the animation is played once. The value **-1** indicates that the animation is played for an unlimited number of times.
Default value: **1**| -| playMode | [PlayMode](ts-appendix-enums.md#playmode) | Animation playback mode. By default, the animation is played from the beginning after the playback is complete.
Default value: **PlayMode.Normal**| -| onFinish | () => void | Callback invoked when the animation playback is complete.| +| playMode | [PlayMode](ts-appendix-enums.md#playmode) | Animation playback mode. By default, the animation is played from the beginning after the playback is complete.
Default value: **PlayMode.Normal**
Since API version 9, this API is supported in ArkTS widgets.| +| onFinish | () => void | Callback invoked when the animation playback is complete.
Since API version 9, this API is supported in ArkTS widgets.| ## Example @@ -41,7 +42,7 @@ struct AnimateToExample { build() { Column() { - Button('change width and height') + Button('change size') .width(this.widthSize) .height(this.heightSize) .margin(30) @@ -56,8 +57,8 @@ struct AnimateToExample { console.info('play end') } }, () => { - this.widthSize = 100 - this.heightSize = 50 + this.widthSize = 150 + this.heightSize = 60 }) } else { animateTo({}, () => { @@ -76,7 +77,7 @@ struct AnimateToExample { curve: Curve.Friction, delay: 500, iterations: -1, // The value -1 indicates that the animation is played for an unlimited number of times. - playMode: PlayMode.AlternateReverse, + playMode: PlayMode.Alternate, onFinish: () => { console.info('play end') } @@ -89,10 +90,4 @@ struct AnimateToExample { } ``` -The figure below shows two buttons in their initial state. - -![animation](figures/animation.PNG) - -Clicking the first button plays the animation of resizing the button, and clicking the second button plays the animation of rotating the button clockwise by 90 degrees. The figure below shows the two buttons when the animations have finished. - -![animation1](figures/animation1.PNG) +![animation1](figures/animation1.gif) diff --git a/en/application-dev/reference/arkui-ts/ts-gesture-settings.md b/en/application-dev/reference/arkui-ts/ts-gesture-settings.md index 3874138c07f1a156fcd32e59e8cb02d37a9f7099..8268db6dca2ea26db846b343060cc001294905f0 100644 --- a/en/application-dev/reference/arkui-ts/ts-gesture-settings.md +++ b/en/application-dev/reference/arkui-ts/ts-gesture-settings.md @@ -34,7 +34,7 @@ Use the following attributes to bind gesture recognition to a component. When a | Name | Description | | -------------- | ---------------------------------------- | | Normal | The gestures of child components are not ignored and are recognized based on the default gesture recognition sequence. | -| IgnoreInternal | The gestures of child components are ignored. Only the gestures of the current component are recognized.
However, the built-in gestures of the child components are not ignored. For example, when the child component is a **\** component, the built-in sliding gestures can still be triggered. | +| IgnoreInternal | The gestures of child components are ignored, including the built-in gestures. For example, if the child component is **\**, its built-in swipe gesture is also ignored.| ## Gesture Response Event diff --git a/en/application-dev/reference/arkui-ts/ts-media-components-video.md b/en/application-dev/reference/arkui-ts/ts-media-components-video.md index feb0d96571dd263205252f8c849b5a0f6ee967b1..0c143bd234578db616fb7a86fccca80cb592b983 100644 --- a/en/application-dev/reference/arkui-ts/ts-media-components-video.md +++ b/en/application-dev/reference/arkui-ts/ts-media-components-video.md @@ -118,9 +118,9 @@ Requests full-screen mode. **Parameters** -| Name | Type | Mandatory | Description | -| ----- | ------- | ---- | --------------------- | -| value | boolean | Yes | Whether the playback is in full-screen mode.
Default value: **false**| +| Name| Type| Mandatory| Description | +| ------ | -------- | ---- | -------------------------------------------------- | +| value | boolean | Yes | Whether to play the video in full screen mode within the application window.
Default value: **false**| ### exitFullscreen @@ -173,7 +173,7 @@ struct VideoCreateComponent { previewUri: this.previewUri, currentProgressRate: this.curRate, controller: this.controller - }).width(800).height(600) + }).width('100%').height(600) .autoPlay(this.isAutoPlay) .controls(this.showControls) .onStart(() => { @@ -186,7 +186,7 @@ struct VideoCreateComponent { console.info('onFinish') }) .onError(() => { - console.info('onFinish') + console.info('onError') }) .onPrepared((e) => { console.info('onPrepared is ' + e.duration) diff --git a/en/application-dev/reference/arkui-ts/ts-methods-alert-dialog-box.md b/en/application-dev/reference/arkui-ts/ts-methods-alert-dialog-box.md index 3588277a411f29ff33929ecd92d501e1686c1d00..db8ca389e215c3a8ffd750b672212f0db0453ff9 100644 --- a/en/application-dev/reference/arkui-ts/ts-methods-alert-dialog-box.md +++ b/en/application-dev/reference/arkui-ts/ts-methods-alert-dialog-box.md @@ -11,7 +11,7 @@ You can set the text content and response callback for an alert dialog box. | Name | Type | Description| | ---- | --------------- | -------- | -| show | [AlertDialogParamWithConfirm](#alertdialogparamwithconfirm) \| [AlertDialogParamWithButtons](#alertdialogparamwithbuttons) | Defines and displays the **** component.| +| show | [AlertDialogParamWithConfirm](#alertdialogparamwithconfirm) \| [AlertDialogParamWithButtons](#alertdialogparamwithbuttons) | Defines and displays the **\** component. | ## AlertDialogParamWithConfirm | Name | Type | Mandatory | Description | diff --git a/en/application-dev/reference/arkui-ts/ts-methods-custom-dialog-box.md b/en/application-dev/reference/arkui-ts/ts-methods-custom-dialog-box.md index 37bf4de513a5773e660b53d8a07c621882c21714..0f15335b6b4ba61a18b6ebe632e08a6f7fd7ea2c 100644 --- a/en/application-dev/reference/arkui-ts/ts-methods-custom-dialog-box.md +++ b/en/application-dev/reference/arkui-ts/ts-methods-custom-dialog-box.md @@ -11,7 +11,7 @@ A custom dialog box is a dialog box you customize by using APIs of the **CustomD ## APIs -CustomDialogController(value:{builder: CustomDialog, cancel?: () => void, autoCancel?: boolean, alignment?: DialogAlignment, offset?: Offset, customStyle?: boolean, gridCount?: number, maskColor?: ResourceColor, openAnimation?: AnimateParam, closeAniamtion?: AnimateParam}) +CustomDialogController(value:{builder: CustomDialog, cancel?: () => void, autoCancel?: boolean, alignment?: DialogAlignment, offset?: Offset, customStyle?: boolean, gridCount?: number, maskColor?: ResourceColor, openAnimation?: AnimateParam, closeAniamtion?: AnimateParam, showInSubWindow?: boolean}) **Parameters** @@ -26,8 +26,9 @@ CustomDialogController(value:{builder: CustomDialog, cancel?: () => void, aut | customStyle | boolean | No | Whether to use a custom style for the dialog box.
Default value: **false**, which means that the dialog box automatically adapts its width to the grid system and its height to the child components; the maximum height is 90% of the container height; the rounded corner is 24 vp. | | gridCount8+ | number | No | Number of [grid columns](../../ui/ui-ts-layout-grid-container-new.md) occupied by the dialog box.
The default value is 4, and the maximum value is the maximum number of columns supported by the system. If this parameter is set to an invalid value, the default value is used.| | maskColor10+ | [ResourceColor](ts-types.md#resourcecolor) | No | Custom mask color.
Default value: **0x33000000** | -| openAnimation10+ | [AnimateParam](ts-explicit-animation.md#animateparam) | No | Parameters for defining the open animation of the dialog box. | +| openAnimation10+ | [AnimateParam](ts-explicit-animation.md#animateparam) | No | Parameters for defining the open animation of the dialog box.
**NOTE**
If **iterations** is set to an odd number and **playMode** is set to **Reverse**, the dialog box will not be displayed when the animation ends. | | closeAniamtion10+| [AnimateParam](ts-explicit-animation.md#animateparam) | No | Parameters for defining the close animation of the dialog box. | +| showInSubWindow10+| boolean | No | Whether to display a dialog box in a subwindow.
Default value: **false**, indicating that the dialog box is not displayed in the subwindow
**NOTE**
A dialog box whose **showInSubWindow** attribute is **true** cannot trigger the display of another dialog box whose **showInSubWindow** attribute is also **true**. | ## CustomDialogController @@ -36,6 +37,9 @@ CustomDialogController(value:{builder: CustomDialog, cancel?: () => void, aut ```ts dialogController : CustomDialogController = new CustomDialogController(value:{builder: CustomDialog, cancel?: () => void, autoCancel?: boolean}) ``` +> **NOTE** +> +> **CustomDialogController** is valid only when it is a member variable of the **@CustomDialog** and **@Component** decorated struct and is defined in the **@Component** decorated struct. For details, see the following example. ### open() open(): void @@ -108,6 +112,11 @@ struct CustomDialogUser { customStyle: false }) + aboutToDisappear() { + delete this.dialogController, + this.dialogController = undefined + } + onCancel() { console.info('Callback when the first button is clicked') } @@ -124,7 +133,9 @@ struct CustomDialogUser { Column() { Button(this.inputValue) .onClick(() => { - this.dialogController.open() + if (this.dialogController != undefined) { + this.dialogController.open() + } }).backgroundColor(0x317aff) }.width('100%').margin({ top: 5 }) } diff --git a/en/application-dev/reference/arkui-ts/ts-methods-datepicker-dialog.md b/en/application-dev/reference/arkui-ts/ts-methods-datepicker-dialog.md index cdede4871a208b9007ca23842e293d309b1c1481..c1ad40842425ca4cdf7c66635cee70623b1c4509 100644 --- a/en/application-dev/reference/arkui-ts/ts-methods-datepicker-dialog.md +++ b/en/application-dev/reference/arkui-ts/ts-methods-datepicker-dialog.md @@ -21,6 +21,11 @@ Shows a date picker dialog box. | end | Date | No| Date('2100-12-31') | End date of the picker.| | selected | Date | No| Current system date| Selected date.| | lunar | boolean | No| false | Whether to display the lunar calendar.| +| showTime10+ | boolean | No| false | Whether to display the time item.| +| useMilitaryTime10+ | boolean | No| false | Whether to display time in 24-hour format.| +| disappearTextStyle10+ | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10) | No| - | Font color, font size, and font width for the top and bottom items.| +| textStyle10+ | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10) | No| - | Font color, font size, and font width of all items except the top, bottom, and selected items.| +| selectedTextStyle10+ | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10) | No| - | Font color, font size, and font width of the selected item.| | onAccept | (value: [DatePickerResult](ts-basic-components-datepicker.md#DatePickerResult)) => void | No| - | Callback invoked when the OK button in the dialog box is clicked.| | onCancel | () => void | No| - | Callback invoked when the Cancel button in the dialog box is clicked.| | onChange | (value: [DatePickerResult](ts-basic-components-datepicker.md#DatePickerResult)) => void | No| - | Callback invoked when the selected item in the picker changes.| diff --git a/en/application-dev/reference/arkui-ts/ts-methods-textpicker-dialog.md b/en/application-dev/reference/arkui-ts/ts-methods-textpicker-dialog.md index fed5193d5ea62277bf3ed86f4dfcdb5e18f56299..4da30a11300a3c5e2ab2cf3f622384f207bbf415 100644 --- a/en/application-dev/reference/arkui-ts/ts-methods-textpicker-dialog.md +++ b/en/application-dev/reference/arkui-ts/ts-methods-textpicker-dialog.md @@ -17,10 +17,13 @@ Shows a text picker in the given settings. | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| range | string[] \| [Resource](ts-types.md#resource) | Yes| Data selection range of the picker.| +| range | string[] \| [Resource](ts-types.md#resource)\|[TextPickerRangeContent](ts-basic-components-textpicker.md#textpickerrangecontent10)[]10+ | Yes| Data selection range of the picker. This parameter cannot be set to an empty array. If set to an empty array, it will not be displayed.| | selected | number | No| Index of the selected item.
Default value: **0**| | value | string | No | Text of the selected item. This parameter does not take effect when the **selected** parameter is set. If the value is not within the range, the first item in the range is used instead.| | defaultPickerItemHeight | number \| string | No| Height of the picker item.| +| disappearTextStyle10+ | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10) | No| Font color, font size, and font width for the top and bottom items.| +| textStyle10+ | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10) | No| Font color, font size, and font width of all items except the top, bottom, and selected items.| +| selectedTextStyle10+ | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10) | No| Font color, font size, and font width of the selected item.| | onAccept | (value: [TextPickerResult](#textpickerresult)) => void | No| Callback invoked when the OK button in the dialog box is clicked.| | onCancel | () => void | No| Callback invoked when the Cancel button in the dialog box is clicked.| | onChange | (value: [TextPickerResult](#textpickerresult)) => void | No| Callback invoked when the selected item changes.| @@ -29,7 +32,7 @@ Shows a text picker in the given settings. | Name| Type| Description| | -------- | -------- | -------- | -| value | string | Text of the selected item.| +| value | string | Text of the selected item.
**NOTE**
For a text list or a list consisting of text and images, **value** indicates the text value of the selected item.
For an image list, **value** is empty.| | index | number | Index of the selected item in the range.| ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-methods-timepicker-dialog.md b/en/application-dev/reference/arkui-ts/ts-methods-timepicker-dialog.md index 32e6ad27c45532a17222a78b47cdde2c19dcff5b..246beaf9da869b68aa059efe66b7570f042ff205 100644 --- a/en/application-dev/reference/arkui-ts/ts-methods-timepicker-dialog.md +++ b/en/application-dev/reference/arkui-ts/ts-methods-timepicker-dialog.md @@ -19,6 +19,9 @@ Shows a time picker dialog box. | -------- | -------- | -------- | -------- | | selected | Date | No| Selected time.
Default value: current system time| | useMilitaryTime | boolean | No| Whether to display time in 24-hour format. The 12-hour format is used by default.
Default value: **false**| +| disappearTextStyle10+ | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10) | No| Font color, font size, and font width for the top and bottom items.| +| textStyle10+ | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10) | No| Font color, font size, and font width of all items except the top, bottom, and selected items.| +| selectedTextStyle10+ | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10) | No| Font color, font size, and font width of the selected item.| | onAccept | (value: [TimePickerResult](ts-basic-components-timepicker.md#TimePickerResult)) => void | No| Callback invoked when the OK button in the dialog box is clicked.| | onCancel | () => void | No| Callback invoked when the Cancel button in the dialog box is clicked.| | onChange | (value: [TimePickerResult](ts-basic-components-timepicker.md#TimePickerResult)) => void | No| Callback invoked when the selected time changes.| diff --git a/en/application-dev/reference/arkui-ts/ts-motion-path-animation.md b/en/application-dev/reference/arkui-ts/ts-motion-path-animation.md index f32762ea1dd342ff52e4ff80c4bc7fb4245b6137..fd98aadd3525b1d6d37262125bdc544833e9d129 100644 --- a/en/application-dev/reference/arkui-ts/ts-motion-path-animation.md +++ b/en/application-dev/reference/arkui-ts/ts-motion-path-animation.md @@ -11,7 +11,7 @@ The motion path animation is used to animate a component along a custom path. | Name| Type| Default Value| Description| | -------- | -------- | -------- | -------- | -| motionPath | {
path: string,
from?: number,
to?: number,
rotatable?: boolean
}
**NOTE**
In a path, **start** and **end** can be used to replace the start point and end point. Example:
'Mstart.x start.y L50 50 Lend.x end.y Z'
For more information, see [Path Drawing](../../ui/ui-js-components-svg-path.md).| {
'',
0.0,
1.0,
false
} | Motion path of the component.
- **path**: motion path of the translation animation. The value is an SVG path string.
- **from**: start point of the motion path. The default value is **0.0**.
- **to**: end point of the motion path. The default value is **1.0**.
- **rotatable**: whether to rotate along the path. | +| motionPath | {
path: string,
from?: number,
to?: number,
rotatable?: boolean
}
**NOTE**
In a path, **start** and **end** can be used to replace the start point and end point. Example:
'Mstart.x start.y L50 50 Lend.x end.y Z'
For more information, see [Path Drawing](../../ui/ui-js-components-svg-path.md).| {
'',
0.0,
1.0,
false
} | Motion path of the component.
- **path**: motion path of the translation animation. The value is an SVG path string.
- **from**: start point of the motion path.
Default value: **0.0**
Value range: [0, 1]
A value less than 0 evaluates to the value **0**. A value greater than 1 evaluates to the value **1**.
- **to**: end point of the motion path.
Default value: **1.0**
Value range: [0, 1]
A value less than 0 evaluates to the value **0**. A value larger than 1 evaluates to the value **1**.
- **rotatable**: whether to rotate along the path. | ## Example @@ -25,7 +25,7 @@ struct MotionPathExample { build() { Column() { - Button('click me') + Button('click me').margin(50) // Execute the animation: Move from the start point to (300,200), then to (300,500), and finally to the end point. .motionPath({ path: 'Mstart.x start.y L300 200 L300 500 Lend.x end.y', from: 0.0, to: 1.0, rotatable: true }) .onClick(() => { @@ -38,4 +38,4 @@ struct MotionPathExample { } ``` -![en-us_image_0000001212378420](figures/en-us_image_0000001212378420.gif) +![en-us_image_0000001174104400](figures/en-us_image_0000001174104400.gif) diff --git a/en/application-dev/reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md b/en/application-dev/reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md index 0f7d462061595e1d78647dd6e93dbd0b18f6585e..9aa9657ae94666cded17944174a3574223e46a77 100644 --- a/en/application-dev/reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md +++ b/en/application-dev/reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md @@ -727,7 +727,7 @@ Fills a rectangle on the canvas. .height('100%') .backgroundColor('#ffff00') .onReady(() =>{ - this.offContext.fillRect(0,30,100,100) + this.offContext.fillRect(30,30,100,100) var image = this.offContext.transferToImageBitmap() this.context.transferFromImageBitmap(image) }) @@ -1767,10 +1767,15 @@ struct Clip { .backgroundColor('#ffff00') .onReady(() =>{ let region = new Path2D() - region.rect(80,10,20,130) - region.rect(40,50,100,50) + region.moveTo(30, 90) + region.lineTo(110, 20) + region.lineTo(240, 130) + region.lineTo(60, 130) + region.lineTo(190, 20) + region.lineTo(270, 90) + region.closePath() this.offContext.clip(region,"evenodd") - this.offContext.fillStyle = "rgb(255,0,0)" + this.offContext.fillStyle = "rgb(0,255,0)" this.offContext.fillRect(0, 0, 600, 600) var image = this.offContext.transferToImageBitmap() this.context.transferFromImageBitmap(image) @@ -2407,6 +2412,8 @@ toDataURL(type?: string, quality?: number): string Generates a URL containing image display information. +Since API version 9, this API is supported in ArkTS widgets. + **Parameters** | Name | Type | Mandatory | Description | diff --git a/en/application-dev/reference/arkui-ts/ts-page-transition-animation.md b/en/application-dev/reference/arkui-ts/ts-page-transition-animation.md index fe419d713fe257eb593064363f8e1e8d1afe0e92..5cd36a45df7a1b6720be03d6ca9fe59d5f555cbf 100644 --- a/en/application-dev/reference/arkui-ts/ts-page-transition-animation.md +++ b/en/application-dev/reference/arkui-ts/ts-page-transition-animation.md @@ -1,6 +1,6 @@ # Page Transition -The page transition navigates users between pages. You can customize page transitions by configuring the page entrance and exit components in the global **pageTransition** API. +The page transition navigates users between pages. You can customize page transitions by configuring the page entrance and exit components in the **pageTransition** API. > **NOTE** > @@ -8,12 +8,12 @@ The page transition navigates users between pages. You can customize page transi > -| Name | Parameter | Description | -| ------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | -| PageTransitionEnter | {
type?: RouteType,
duration?: number,
curve?: [Curve](ts-appendix-enums.md#curve) \| string,
delay?: number
} | Page entrance animation.
- **type**: route type for the page transition effect to take effect.
Default value: **RouteType.None**
**Note**: If no match is found, the default page transition effect is used (which may vary according to the device). To disable the default page transition effect, set **duration** to **0**.
- **duration**: animation duration, in milliseconds.
- **curve**: animation curve. The value of the string type can be any of the following: "ease", "ease-in", "ease-out", "ease-in-out", "extreme-deceleration", "fast-out-linear-in", "fast-out-slow-in", "friction", "linear", "linear-out-slow-in", "rhythm", "sharp", "smooth".
Default value: **Curve.Linear**
- **delay**: animation delay, in milliseconds. By default, the animation is played without delay.| -| PageTransitionExit | {
type?: RouteType,
duration?: number,
curve?: [Curve](ts-appendix-enums.md#curve) \| string,
delay?: number
} | Page exit animation.
- **type**: route type for the page transition effect to take effect.
Default value: **RouteType.None**
**Note**: If no match is found, the default page transition effect is used (which may vary according to the device). To disable the default page transition effect, set **duration** to **0**.
- **duration**: animation duration, in milliseconds.
- **curve**: animation curve. The value range of the string type is the same as that of **PageTransitionEnter**.
Default value: **Curve.Linear**
- **delay**: animation delay, in milliseconds. By default, the animation is played without delay.| +| Name | Parameter | Mandatory| Description | +| ------------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| PageTransitionEnter | {
type?: RouteType,
duration?: number,
curve?: [Curve](ts-appendix-enums.md#curve) \| string,
delay?: number
} | No | Page entrance animation.
- **type**: route type for the page transition effect to take effect.
Default value: **RouteType.None**
**NOTE**
If no match is found, the default page transition effect is used (which may vary according to the device). To disable the default page transition effect, set **duration** to **0**.
- **duration**: animation duration.
Unit: ms
- **curve**: animation curve. The value of the string type can be any of the following: "ease", "ease-in", "ease-out", "ease-in-out", "extreme-deceleration", "fast-out-linear-in", "fast-out-slow-in", "friction", "linear", "linear-out-slow-in", "rhythm", "sharp", "smooth".
Default value: **Curve.Linear**
- **delay**: animation delay.
Default value: **0**
Unit: ms| +| PageTransitionExit | {
type?: RouteType,
duration?: number,
curve?: [Curve](ts-appendix-enums.md#curve) \| string,
delay?: number
} | No | Page exit animation.
- **type**: route type for the page transition effect to take effect.
Default value: **RouteType.None**
**NOTE**
If no match is found, the default page transition effect is used (which may vary according to the device). To disable the default page transition effect, set **duration** to **0**.
- **duration**: animation duration, in milliseconds.
- **curve**: animation curve. The value range of the string type is the same as that of **PageTransitionEnter**.
Default value: **Curve.Linear**
- **delay**: animation delay.
Default value: **0**
Unit: ms| -## RouteType enums +## RouteType | Name| Description | | ---- | ------------------------------------------------------------ | @@ -28,7 +28,7 @@ The page transition navigates users between pages. You can customize page transi | --------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | slide | [SlideEffect](#slideeffect) | No | Slide effect during page transition.
Default value: **SlideEffect.Right**| | translate | {
x? : number \| string,
y? : number \| string,
z? : number \| string
} | No | Translation effect during page transition, which is the value of the start point of entrance and the end point of exit. When this parameter is set together with **slide**, the latter takes effect by default.
- **x**: translation distance along the x-axis.
- **y**: translation distance along the y-axis.
- **z**: translation distance along the y-axis.| -| scale | {
x? : number,
y? : number,
z? : number,
centerX? : number \| string,
centerY? : number \| string
} | No | Scaling effect during page transition, which is the value of the start point of entrance and the end point of exit.
- **x**: scale ratio along the x-axis.
- **y**: scale ratio along the y-axis.
- **z**: scale ratio along the z-axis.
- **centerX** and **centerY**: scale center point.
- If the center point is 0, it refers to the upper left corner of the component.
| +| scale | {
x? : number,
y? : number,
z? : number,
centerX? : number \| string,
centerY? : number \| string
} | No | Scaling effect during page transition, which is the value of the start point of entrance and the end point of exit.
- **x**: scale ratio along the x-axis.
- **y**: scale ratio along the y-axis.
- **z**: scale ratio along the z-axis.
- **centerX** and **centerY**: scale center point.
- If the center point is 0, it refers to the upper left corner of the component. | | opacity | number | No | Opacity, which is the opacity value of the start point of entrance or the end point of exit.
Default value: **1**| ## SlideEffect @@ -43,10 +43,10 @@ The page transition navigates users between pages. You can customize page transi ## Events -| Name | Description | +| Name | Description | | ------------------------------------------------------------ | ------------------------------------------------------------ | -| onEnter(event: (type?: RouteType, progress?: number) => void) | The callback input parameter is the normalized progress of the current entrance animation. The value range is 0–1.
- **type**: route type.
- **progress**: current progress.| -| onExit(event: (type?: RouteType, progress?: number) => void) | The callback input parameter is the normalized progress of the current exit animation. The value range is 0–1.
- **type**: route type.
- **progress**: current progress.| +| onEnter(event: (type?: RouteType, progress?: number) => void) | Invoked once every animation frame until the entrance animation ends, when the value of **progress** changes from 0 to 1. The input parameter is the normalized progress of the current entrance animation. The value range is 0–1.
- **type**: route type.
- **progress**: current progress. | +| onExit(event: (type?: RouteType, progress?: number) => void) | Invoked once every animation frame until the exit animation ends, when the value of **progress** changes from 0 to 1. The input parameter is the normalized progress of the current exit animation. The value range is 0–1.
- **type**: route type.
- **progress**: current progress. | ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-pixel-units.md b/en/application-dev/reference/arkui-ts/ts-pixel-units.md index 2256aa963c944561e69ccbf110a656347afd448a..4f7099cc28fffbe5b72c6fa3ddd5fe0cfa1b969f 100644 --- a/en/application-dev/reference/arkui-ts/ts-pixel-units.md +++ b/en/application-dev/reference/arkui-ts/ts-pixel-units.md @@ -8,21 +8,21 @@ The framework provides four pixel units, with vp as the reference data unit. | px | Physical pixel unit of the screen. | | vp | Pixel unit specific to the screen density. Pixels in this unit are converted into physical pixels of the screen based on the screen pixel density. This unit is used for values whose unit is not specified.| | fp | Font pixel, which is similar to vp and varies according to the system font size. | -| lpx | Logical pixel unit of the window. It is the ratio of the actual screen width to the logical width (configured by **designWidth**). For example, if **designWidth** is set to **720** (default value), then 1lpx is equal to 2px for a screen with an actual width of 1440 physical pixels. | +| lpx | Logical pixel unit of the window. It is the ratio of the actual screen width to the logical width (configured by **designWidth**). For example, if **designWidth** is set to **720** (default value), then 1lpx is equal to 2px for a screen with an actual width of 1440 physical pixels.| ## Pixel Unit Conversion Conversion between px and other pixel units is supported. -| API | Description | -| ---------------------------------------- | ---------------------- | -| vp2px(value : number) : number | Converts a value in units of vp to a value in units of px. | -| px2vp(value : number) : number | Converts a value in units of px to a value in units of vp. | -| fp2px(value : number) : number | Converts a value in units of fp to a value in units of px. | -| px2fp(value : number) : number | Converts a value in units of px to a value in units of fp. | -| lpx2px(value : number) : number | Converts a value in units of lpx to a value in units of px.| -| px2lpx(value : number) : number | Converts a value in units of px to a value in units of lpx.| +| API | Description | +| --------------------------------------------------- | ------------------------------------------------------------ | +| vp2px(value : number) : number | Converts a value in units of vp to a value in units of px.
Since API version 9, this API is supported in ArkTS widgets.| +| px2vp(value : number) : number | Converts a value in units of px to a value in units of vp.
Since API version 9, this API is supported in ArkTS widgets.| +| fp2px(value : number) : number | Converts a value in units of fp to a value in units of px.
Since API version 9, this API is supported in ArkTS widgets.| +| px2fp(value : number) : number | Converts a value in units of px to a value in units of fp.
Since API version 9, this API is supported in ArkTS widgets.| +| lpx2px(value : number) : number | Converts a value in units of lpx to a value in units of px.
Since API version 9, this API is supported in ArkTS widgets.| +| px2lpx(value : number) : number | Converts a value in units of px to a value in units of lpx.
Since API version 9, this API is supported in ArkTS widgets.| ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-transition-animation-component.md b/en/application-dev/reference/arkui-ts/ts-transition-animation-component.md index 7c62710b64759d42e205eb91b010fb50e478e108..cd072648a81f68b080ae88b9a90cf6a157376dc6 100644 --- a/en/application-dev/reference/arkui-ts/ts-transition-animation-component.md +++ b/en/application-dev/reference/arkui-ts/ts-transition-animation-component.md @@ -12,17 +12,17 @@ Configure the component transition animations for when a component is inserted o | Name| Type| Description| | -------- | -------- | -------- | -| transition | TransitionOptions | Transition parameters, which are all optional. For details, see **TransitionOptions**.| +| transition | TransitionOptions | Transition effects when the component is inserted, displayed, deleted, or hidden.
If no transition effect is set, an opacity transition from 0 to 1 is applied.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
Transition parameters, which are all optional. For details, see **TransitionOptions**.| ## TransitionOptions | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | -| type | [TransitionType](ts-appendix-enums.md#transitiontype) | No| Transition type, which includes component addition and deletion by default.
Default value: **TransitionType.All**
**NOTE**
If **type** is not specified, insertion and deletion use the same transition type.| -| opacity | number | No| Opacity of the component during transition, which is the value of the start point of insertion and the end point of deletion.
Default value: **1**| -| translate | {
x? : number \| string,
y? : number \| string,
z? : number \| string
} | No| Translation of the component during transition, which is the value of the start point of insertion and the end point of deletion.
-**x**: distance to translate along the x-axis.
-**y**: distance to translate along the y-axis.
-**z**: distance to translate along the z-axis.| -| scale | {
x? : number,
y? : number,
z? : number,
centerX? : number \| string,
centerY? : number \| string
} | No| Scaling of the component during transition, which is the value of the start point of insertion and the end point of deletion.
- **x**: scale factor along the x-axis.
- **y**: scale factor along the y-axis.
- **z**: scale factor along the z-axis.
- **centerX** and **centerY**: x coordinate and y coordinate of the scale center, respectively. The default values are both **"50%"**.
- If the center point is 0, it indicates the upper left corner of the component.
| -| rotate | {
x?: number,
y?: number,
z?: number,
angle?: number \| string,
centerX?: number \| string,
centerY?: number \| string
} | No| Rotation of the component during transition, which is the value of the start point of insertion and the end point of deletion.
- **x**: rotation vector along the x-axis.
- **y**: rotation vector along the y-axis.
- **z**: rotation vector along the z-axis.
- **centerX** and **centerY**: x coordinate and y coordinate of the rotation center, respectively. The default values are both **"50%"**.
- If the center point is (0, 0), it indicates the upper left corner of the component.| +| type | [TransitionType](ts-appendix-enums.md#transitiontype) | No| Transition type, which includes component addition and deletion by default.
Default value: **TransitionType.All**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
If **type** is not specified, insertion and deletion use the same transition type.| +| opacity | number | No| Opacity of the component during transition, which is the value of the start point of insertion and the end point of deletion.
Default value: **1**
Value range: [0, 1]
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
A value less than 0 evaluates to the value **0**. A value greater than 1 evaluates to the value **1**.| +| translate | {
x? : number \| string,
y? : number \| string,
z? : number \| string
} | No| Translation of the component during transition, which is the value of the start point of insertion and the end point of deletion.
-**x**: distance to translate along the x-axis.
-**y**: distance to translate along the y-axis.
-**z**: distance to translate along the z-axis.
Since API version 9, this API is supported in ArkTS widgets.| +| scale | {
x? : number,
y? : number,
z? : number,
centerX? : number \| string,
centerY? : number \| string
} | No| Scaling of the component during transition, which is the value of the start point of insertion and the end point of deletion.
- **x**: scale factor along the x-axis.
- **y**: scale factor along the y-axis.
- **z**: scale factor along the z-axis.
- **centerX** and **centerY**: x coordinate and y coordinate of the scale center, respectively. The default values are both **"50%"**.
- If the center point is 0, it indicates the upper left corner of the component.
Since API version 9, this API is supported in ArkTS widgets.| +| rotate | {
x?: number,
y?: number,
z?: number,
angle?: number \| string,
centerX?: number \| string,
centerY?: number \| string
} | No| Rotation of the component during transition, which is the value of the start point of insertion and the end point of deletion.
- **x**: rotation vector along the x-axis.
- **y**: rotation vector along the y-axis.
- **z**: rotation vector along the z-axis.
- **centerX** and **centerY**: x coordinate and y coordinate of the rotation center, respectively. The default values are both **"50%"**.
- If the center point is (0, 0), it indicates the upper left corner of the component.
Since API version 9, this API is supported in ArkTS widgets.| ## Example 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 cd3f67300cfa8b63bac83b973dcb404590426d27..2fcbfe67f010ea80ca278932bf4210074d438878 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,6 +1,6 @@ -# Transition of Shared Elements +# Shared Element Transition -Shared element transition can be used for transition between pages, for example, transition from an image on the current page to the next page. +A shared element transition is a transition animation applied to a component that is present on two pages. This component is called the shared element and can be set in the **sharedTransition** attribute. > **NOTE** > @@ -10,14 +10,14 @@ Shared element transition can be used for transition between pages, for example, ## Attributes -| Name | Parameters | Description | +| Name | Parameter | Description | | ---------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | -| sharedTransition | id: string,
{
duration?: number,
curve?: Curve \| string,
delay?: number,
motionPath?:
{
path: string,
form?: number,
to?: number,
rotatable?: boolean
},
zIndex?: number,
type?: [SharedTransitionEffectType](ts-appendix-enums.md#sharedtransitioneffecttype)
} | Transition of the shared element. If the same **id** value is configured for a component on the two pages, this component is considered as a shared element of the pages. If the **id** value is an empty string, no transition will be applied to the component.
- **id**: component ID.
- **duration**: animation duration, in ms. The default duration is 1000 ms.
- **curve**: animation curve. The default curve is **Linear**. For details about the valid values, see [Curve](ts-animatorproperty.md).
- **delay**: Delay of animation playback, in ms. By default, the playback is not delayed.
- **motionPath**: motion path information. For details, see [Motion Path Animation](ts-motion-path-animation.md).
- **path**: path.
- **from**: start value.
- **to**: end value.
- **rotatable**: whether to rotate.
- **zIndex**: z-axis.
- **type**: animation type.| +| sharedTransition | id: string,
{
duration?: number,
curve?: Curve \| string,
delay?: number,
motionPath?:
{
path: string,
form?: number,
to?: number,
rotatable?: boolean
},
zIndex?: number,
type?: [SharedTransitionEffectType](ts-appendix-enums.md#sharedtransitioneffecttype)
} | Transition of the shared element. If the same **id** value is configured for a component on the two pages, this component is considered as a shared element of the pages. If the **id** value is an empty string, no transition will be applied to the component.
- **id**: component ID.
- **duration**: animation duration.
Default value: **1000**
Unit: ms
Value range: [0, +∞)
The value **0** indicates that no animation is applied. A value less than 0 evaluates to the value **0**.
- **curve**: animation curve. The default curve is **Linear**. For details about the valid values, see [Curve](ts-animatorproperty.md).
- **delay**: animation delay.
Default value: **0**
Unit: ms
Value range: [0, +∞)
A value less than 0 evaluates to the value **0**.
- **motionPath**: motion path information. For details, see [Motion Path Animation](ts-motion-path-animation.md).
- **path**: path.
- **from**: start value.
- **to**: end value.
- **rotatable**: whether to rotate.
- **zIndex**: z-axis.
- **type**: animation type.| ## Example - The example implements the custom transition of a shared image during redirection from one page to another, which is triggered by a click on the image. +This example implements the custom transition of a shared image during redirection from one page to another, which is triggered by a click on the image. ```ts // xxx.ets diff --git a/en/application-dev/reference/arkui-ts/ts-types.md b/en/application-dev/reference/arkui-ts/ts-types.md index ffc46108ad8944d16f354ef022581cca6494f0a0..fac677383a0eedcbd12c7a913d30cc3d2d679845 100644 --- a/en/application-dev/reference/arkui-ts/ts-types.md +++ b/en/application-dev/reference/arkui-ts/ts-types.md @@ -124,10 +124,18 @@ The **ResourceColor** type is used to describe the color types of resources. | Type | Description | | ---------------------------------------- | ------------------------------------------------- | | [Color](ts-appendix-enums.md#color) | Color enums. | -| number | Color in hexadecimal notation. | -| string | Color in RGB or RGBA notation. | +| number | Color in hexadecimal notation. RGB is supported. | +| string | Color in RGB or ARGB notation. | | [Resource](#resource) | Color referenced from system or application resources.| +## ColoringStrategy + +The **ColoringStrategy** type is used to describe the foreground colors. + +| Name | Description | +| --------- | ------- | +| INVERT | Inverse of the component background color.| + ## LengthConstrain The **LengthConstrain** type is used to describe the maximum and minimum lengths of a component. @@ -217,3 +225,14 @@ The **CustomBuilder** type is used to define custom UI descriptions in component | Name | Type | Description | | ------------- | ---------------------- | ---------------------------------------- | | CustomBuilder | () => any | Must be decorated by **@Builder**. For details, see [@Builder](../../quick-start/arkts-dynamic-ui-elememt-building.md#builder).| + +## PixelStretchEffectOptions10+ + +Describes the pixel stretch effect options. + +| Name | Type | Mandatory | Description | +| ----------- | ------ | ---- | ---------- | +| left | [Length](#length) | No | Length by which a pixel is stretched towards the left edge of the image.| +| right | [Length](#length) | No | Length by which a pixel is stretched towards the right edge of the image.| +| top | [Length](#length) | No | Length by which a pixel is stretched towards the top edge of the image.| +| bottom | [Length](#length) | No | Length by which a pixel is stretched towards the bottom edge of the image.| diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-background.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-background.md index 0bde935d8e104ad982c322c342abb71b96909a31..4cc26a594e13004d77784cfbb2d5f0ed24f8976b 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-background.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-background.md @@ -10,10 +10,10 @@ You can set the background of a component. | Name| Type| Description| | -------- | -------- | -------- | -| backgroundColor | [ResourceColor](ts-types.md#resourcecolor) | Background color of the component.| -| backgroundImage | src: [ResourceStr](ts-types.md#resourcestr),
repeat?: [ImageRepeat](ts-appendix-enums.md#imagerepeat) | **src**: image address, which can be the address of an Internet or a local image. (SVG images are not supported.)
**repeat**: whether the background image is repeatedly used. By default, the background image is not repeatedly used.| -| backgroundImageSize | {
width?: [Length](ts-types.md#length),
height?: [Length](ts-types.md#length)
} \| [ImageSize](ts-appendix-enums.md#imagesize) | Width and height of the background image. If the input is a **{width: Length, height: Length}** object and only one attribute is set, the other attribute is the set value multiplied by the original aspect ratio of the image. By default, the original image aspect ratio remains unchanged.
Default value: **ImageSize.Auto**| -| backgroundImagePosition | [Position](ts-types.md#position8) \| [Alignment](ts-appendix-enums.md#alignment) | Position of the background image in the component, that is, the coordinates relative to the upper left corner of the component.
Default value:
{
x: 0,
y: 0
}
When **x** and **y** are set in percentage, the offset is calculated based on the width and height of the component.| +| backgroundColor | [ResourceColor](ts-types.md#resourcecolor) | Background color of the component.
Since API version 9, this API is supported in ArkTS widgets.| +| backgroundImage | src: [ResourceStr](ts-types.md#resourcestr),
repeat?: [ImageRepeat](ts-appendix-enums.md#imagerepeat) | **src**: image address, which can be the address of an Internet or a local image or a Base64 encoded image. SVG images are not supported.
**repeat**: whether the background image is repeatedly used. By default, the background image is not repeatedly used. If the set image has a transparent background and **backgroundColor** is set, the image is overlaid on the background color.
Since API version 9, this API is supported in ArkTS widgets.| +| backgroundImageSize | {
width?: [Length](ts-types.md#length),
height?: [Length](ts-types.md#length)
} \| [ImageSize](ts-appendix-enums.md#imagesize) | Width and height of the background image. If the input is a **{width: Length, height: Length}** object and only one attribute is set, the other attribute is the set value multiplied by the original aspect ratio of the image. By default, the original image aspect ratio remains unchanged.
The value range of **width** and **height** is [0, +∞).
Default value: **ImageSize.Auto**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
A value less than 0 evaluates to the value **0**. If **height** is set but **width** is not, the image width is adjusted based on the original aspect ratio of the image.| +| backgroundImagePosition | [Position](ts-types.md#position8) \| [Alignment](ts-appendix-enums.md#alignment) | Position of the background image in the component, that is, the coordinates relative to the upper left corner of the component.
Default value:
{
x: 0,
y: 0
}
When **x** and **y** are set in percentage, the offset is calculated based on the width and height of the component.
Since API version 9, this API is supported in ArkTS widgets.| ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-backgroundBlurStyle.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-backgroundBlurStyle.md index e24e391a4690c7767dd9449c4ef5d1e6d2daa968..7697d92ebdae9512ebcebfe4d46d6a43cf0143c2 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-backgroundBlurStyle.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-backgroundBlurStyle.md @@ -10,17 +10,16 @@ You can apply background blur effects to a component. ## Attributes -| Name | Type | Description | +| Name | Parameter | Description | | -------------------- | ----------------------- | ------------------------ | -| backgroundBlurStyle | [BlurStyle](#blurstyle) | Style of the blur between the background and content for the current component. The input parameter indicates a blur material.| +| backgroundBlurStyle | value:[BlurStyle](ts-appendix-enums.md#blurstyle9),
options10+?:[BackgroundBlurStyleOptions](#backgroundblurstyleoptions10) | Background blur style applied between the content and the background.
**value**: settings of the background blur style, including the blur radius, mask color, mask opacity, and saturation.
**options**: background blur options. This parameter is optional.
This API is supported in ArkTS widgets.| + +## BackgroundBlurStyleOptions10+ -## BlurStyle - - | Name | Description | - | ------- | ---------- | - | Thin | Thin material. | - | Regular | Regular material. | - | Thick | Thick material. | +| Name| Type| Mandatory| Description| +| ----------- | ------| ------ | ------ | +| colorMode10+ | [ThemeColorMode](ts-appendix-enums.md#themecolormode10) | No| Color mode used for the background blur.
Default value: **ThemeColorMode.System**| +| adaptiveColor10+ | [AdaptiveColor](ts-appendix-enums.md#adaptivecolor10) | No| Adaptive color mode.
Default value: **AdaptiveColor.Default**| ## Example @@ -28,16 +27,16 @@ You can apply background blur effects to a component. // xxx.ets @Entry @Component -struct Index { +struct BackgroundBlurStyleDemo { build() { Column() { Row() { Text("Thin Material") } - .width(350) - .height(300) - .backgroundBlurStyle(BlurStyle.Thin) - .position({ x: "15%", y: "30%" }) + .width('50%') + .height('50%') + .backgroundBlurStyle(BlurStyle.Thin, { colorMode: ThemeColorMode.Light, adaptiveColor: AdaptiveColor.Default }) + .position({ x: '15%', y: '30%' }) } .height('100%') .width('100%') diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-border-image.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-border-image.md index d50f5ec504c3b9f215e033c4d33dd9dc48dba96d..2371633764347fc20d9306e52a561ecb98795a63 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-border-image.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-border-image.md @@ -10,10 +10,12 @@ You can draw an image around a component. | Name | Type | Description | | ---------- | ---------------------------------------- | --------------------------------------- | -| borderImage | [BorderImageOption](#borderimageoption) | Border image or border gradient. | +| borderImage | [BorderImageOption](#borderimageoption) | Border image or border gradient.
This API is supported in ArkTS widgets.| ## BorderImageOption +This API is supported in ArkTS widgets. + | Name | Type | Description | | ---------- | ---------------------------------------- | --------------------------------------- | | source | string \| [Resource](ts-types.md#resource) \| [linearGradient](ts-universal-attributes-gradient-color.md) | Source or gradient color of the border image.
**NOTE**
The border image source applies only to container components, such as **\**, **\**, and **\**.| @@ -23,9 +25,10 @@ You can draw an image around a component. | repeat | [RepeatMode](#repeatmode) | Repeat mode of the border image.
Default value: **RepeatMode.Stretch**| | fill | boolean | Whether to fill the center of the border image.
Default value: **false** | - ## RepeatMode +This API is supported in ArkTS widgets. + | Name | Description | | ------- | ----------------------------------- | | Repeat | The source image's slices are tiled. Tiles beyond the border box will be clipped. | 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 5387323038344bdea0670d857178ad6ae4175ac5..2868a7fdf9c6920437dbd6d105051bd6c2f94f88 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 @@ -13,11 +13,11 @@ The border attributes are used to set border styles for components. | Name | Type | Description | | ------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| border | {
width?: [Length](ts-types.md#length) \| [EdgeWidths](#edgewidths9)9+,
color?: [ResourceColor](ts-types.md#resourcecolor) \| [EdgeColors](#edgecolors9)9+,
radius?: [Length](ts-types.md#length) \| [BorderRadiuses](#borderradiuses9)9+,
style?: [BorderStyle](ts-appendix-enums.md#borderstyle) \| [EdgeStyles](#edgestyles9)9+
} | Unified border style.
- **width**: border width.
- **color**: border color.
- **radius**: radius of the rounded corner of the border.
- **style**: border style.| -| borderStyle | [BorderStyle](ts-appendix-enums.md#borderstyle) \| [EdgeStyles](#edgestyles9)9+ | Border style.
Default value: **BorderStyle.Solid** | -| borderWidth | [Length](ts-types.md#length) \| [EdgeWidths](#edgewidths9)9+ | Border width. The percentage format is not supported. | -| borderColor | [ResourceColor](ts-types.md#resourcecolor) \| [EdgeColors](#edgecolors9)9+ | Border color.
Default value: **Color.Black** | -| borderRadius | [Length](ts-types.md#length) \| [BorderRadiuses](#borderradiuses9)9+ | Border radius. The percentage format is not supported. | +| border | {
width?: [Length](ts-types.md#length) \| [EdgeWidths](#edgewidths9)9+,
color?: [ResourceColor](ts-types.md#resourcecolor) \| [EdgeColors](#edgecolors9)9+,
radius?: [Length](ts-types.md#length) \| [BorderRadiuses](#borderradiuses9)9+,
style?: [BorderStyle](ts-appendix-enums.md#borderstyle) \| [EdgeStyles](#edgestyles9)9+
} | Unified border style.
- **width**: border width.
- **color**: border color.
- **radius**: radius of the rounded corner of the border.
- **style**: border style.
Since API version 9, this API is supported in ArkTS widgets.| +| borderStyle | [BorderStyle](ts-appendix-enums.md#borderstyle) \| [EdgeStyles](#edgestyles9)9+ | Border style.
Default value: **BorderStyle.Solid**
Since API version 9, this API is supported in ArkTS widgets.| +| borderWidth | [Length](ts-types.md#length) \| [EdgeWidths](#edgewidths9)9+ | Border width. The percentage format is not supported.
Since API version 9, this API is supported in ArkTS widgets.| +| borderColor | [ResourceColor](ts-types.md#resourcecolor) \| [EdgeColors](#edgecolors9)9+ | Border color.
Default value: **Color.Black**
Since API version 9, this API is supported in ArkTS widgets.| +| borderRadius | [Length](ts-types.md#length) \| [BorderRadiuses](#borderradiuses9)9+ | Border radius. The percentage format is not supported.
Since API version 9, this API is supported in ArkTS widgets.| ## EdgeWidths9+ diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-component-id.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-component-id.md index 72c361558b417f77d28024abda69e19bc7ad111e..1c96d9b4d0ed36fabb1069bd42eb1ac1a1965b6c 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-component-id.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-component-id.md @@ -11,7 +11,7 @@ | Name | Type | Description | | -----| -------- | ----------------------------- | -| id | string | Unique ID you assigned to the component.
Default value: **''**| +| id | string | Unique ID you assigned to the component.
Default value: **''**
Since API version 9, this API is supported in ArkTS widgets.| ## APIs diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-enable.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-enable.md index 6e7645eabe12366ced89fb469334612d2205bd9f..d30aa033b3dd9276a78d1b47f639661d384d5a7c 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-enable.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-enable.md @@ -10,9 +10,9 @@ The **enabled** attribute sets whether a component responds to user interactions ## Attributes -| Name | Type | Description | -| ------- | ------- | ---------------------------------------- | -| enabled | boolean | Whether the component responds to user interactions, including clicks and touches. The value **true** means that the component responds to user interactions, and **false** means the opposite.
Default value: **true** | +| Name | Type| Description | +| ------- | -------- | ------------------------------------------------------------ | +| enabled | boolean | Whether the component responds to user interactions, including clicks and touches. The value **true** means that the component responds to user interactions, and **false** means the opposite.
Default value: **true**
Since API version 9, this API is supported in ArkTS widgets. | ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-flex-layout.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-flex-layout.md index 9234810c88d381fbeda3bbc8e9b79a244d5f74ac..702fdef1d7c4acb9f3a2bc8eecd9325ec4367181 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-flex-layout.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-flex-layout.md @@ -8,12 +8,12 @@ ## Attributes -| Name | Type | Description | -| ---------- | ---------------------------------------- | ---------------------------------------- | -| flexBasis | number \| string | Base size of the component in the main axis of the parent container.
Default value: **'auto'** (indicating that the base size of the component in the main axis is the original size of the component)
This attribute cannot be set in percentage.| -| flexGrow | number | Percentage of the parent container's remaining space that is allocated to the component.
Default value: **0** | -| flexShrink | number | Percentage of the parent container's shrink size that is allocated to the component.
When the parent container is **\** or **\**, the default value is **0**.
When the parent container is **\**, the default value is **1**. | -| alignSelf | [ItemAlign](ts-appendix-enums.md#itemalign) | Alignment mode of the child components along the cross axis of the parent container. The setting overwrites the **alignItems** setting of the parent container.
Default value: **ItemAlign.Auto**| +| Name | Type | Description | +| ---------- | ------------------------------------------- | ------------------------------------------------------------ | +| flexBasis | number \| string | Base size of the component in the main axis of the parent container.
Default value: **'auto'** (indicating that the base size of the component in the main axis is the original size of the component)
This attribute cannot be set in percentage.
Since API version 9, this API is supported in ArkTS widgets.| +| flexGrow | number | Percentage of the parent container's remaining space that is allocated to the component.
Default value: **0**
Since API version 9, this API is supported in ArkTS widgets.| +| flexShrink | number | Percentage of the parent container's shrink size that is allocated to the component.
When the parent container is **\** or **\**, the default value is **0**.
When the parent container is **\**, the default value is **1**.
Since API version 9, this API is supported in ArkTS widgets.| +| alignSelf | [ItemAlign](ts-appendix-enums.md#itemalign) | Alignment mode of the child components along the cross axis of the parent container. The setting overwrites the **alignItems** setting of the parent container.
Default value: **ItemAlign.Auto**
Since API version 9, this API is supported in ArkTS widgets.| ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-foreground-color.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-foreground-color.md new file mode 100644 index 0000000000000000000000000000000000000000..8098c34b6e8d1f8afe2f97cbddae20cae5934772 --- /dev/null +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-foreground-color.md @@ -0,0 +1,74 @@ +# Foreground Color + +The foreground color attributes set the foreground color of a component. + +> **NOTE** +> +> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version. + +## Attributes + +| Name| Type| Description| +| -------- | -------- | -------- | +| foregroundColor | [ResourceColor](ts-types.md#resourcecolor) \| [ColoringStrategy](ts-types.md#coloringstrategy) | Foreground color. The value can be a specific color or a coloring strategy.| + +## Example + +### Example 1 +```ts +// xxx.ets +@Entry +@Component +struct ForegroundColorExample { + build() { + Column({ space: 100 }) { + // Draw a circle with a diameter of 150 and the default fill color black. + Circle({ width: 150, height: 200 }) + // Draw a circle with a diameter of 150. + Circle({ width: 150, height: 200 }).foregroundColor(Color.Red) + }.width('100%').backgroundColor(Color.Blue) + } +} +``` + +![foregroundColor_circle](figures/foregroundColor_circle.png) + +### Example 2 + +```ts +// xxx.ets +@Entry +@Component +struct ColoringStrategyExample { + build() { + Column({ space: 100 }) { + // Draw a circle with a diameter of 150 and the default fill color black. + Circle({ width: 150, height: 200 }) + // Draw a circle with a diameter of 150 and set its foreground color to the inverse of the component background color. + Circle({ width: 150, height: 200 }) + .backgroundColor(Color.Black) + .foregroundColor(ColoringStrategy.INVERT) + }.width('100%') + } +} +``` +![foregroundColor_circle](figures/ColoringStrategy_circle.png) + +### Example 3 + +```ts +// xxx.ets +@Entry +@Component +struct foregroundColorInherit { + build() { + Column() { + Button('Foreground Color: Set to Orange').fontSize(20).foregroundColor(Color.Orange).backgroundColor(Color.Gray) + Divider() + Button ('Foreground Color: Inherited from Parent Component When Not Set').fontSize(20).backgroundColor(Color.Gray) + }.foregroundColor(Color.Red) + } +} +``` + +![foregroundColor_circle](figures/foregroundColorInherit.jpg) diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-gradient-color.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-gradient-color.md index a8db3e77829f493a331e570449b80cedce5eb2b2..11394a20c84757bfff4fc3d95fc72a7f2c3ee428 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-gradient-color.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-gradient-color.md @@ -12,9 +12,9 @@ Create a more gorgeous look for a component by applying a gradient color effect | Name | Type | Description | | -------------- | -------------------------------------------- | ----------------------------------- | -| linearGradient | {
angle?: number \| string,
direction?: [GradientDirection](ts-appendix-enums.md#gradientdirection),
colors: Array<[ColorStop](ts-basic-components-gauge.md#colorstop)>,
repeating?: boolean
} | Linear gradient.
- **angle**: start angle of the linear gradient. A positive value indicates a clockwise rotation from the origin, (0, 0).
Default value: **180**
- **direction**: direction of the linear gradient. It does not take effect when **angle** is set.
Default value: **GradientDirection.Bottom**
- **colors**: colors of the linear gradient.
- **repeating**: whether the colors are repeated.
Default value: **false**| -| sweepGradient | {
center: Point,
start?: number \| string,
end?: number \| string,
rotation?: number\|string,
colors: Array<[ColorStop](ts-basic-components-gauge.md#colorstop)>,
repeating?: boolean
} | Angle gradient.
- **center**: center point of the angle gradient, that is, the coordinates relative to the upper left corner of the current component.
- **start**: start point of the angle gradient.
Default value: **0**
- **end**: end point of the angle gradient.
Default value: **0**
- **rotation**: rotation angle of the angle gradient.
Default value: **0**
- **colors**: colors of the angle gradient.
- **repeating**: whether the colors are repeated.
Default value: **false**| -| radialGradient | {
center: Point,
radius: number \| string,
colors: Array<[ColorStop](ts-basic-components-gauge.md#colorstop)>,
repeating?: boolean
} | Radial gradient.
- **center**: center point of the radial gradient, that is, the coordinates relative to the upper left corner of the current component.
- **radius**: radius of the radial gradient.
- **colors**: colors of the radial gradient.
- **repeating**: whether the colors are repeated.
Default value: **false**| +| linearGradient | {
angle?: number \| string,
direction?: [GradientDirection](ts-appendix-enums.md#gradientdirection),
colors: Array<[ColorStop](ts-basic-components-gauge.md#colorstop)>,
repeating?: boolean
} | Linear gradient.
- **angle**: start angle of the linear gradient. A positive value indicates a clockwise rotation from the origin, (0, 0).
Default value: **180**
- **direction**: direction of the linear gradient. It does not take effect when **angle** is set.
Default value: **GradientDirection.Bottom**
- **colors**: colors of the linear gradient.
- **repeating**: whether the colors are repeated.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.| +| sweepGradient | {
center: Point,
start?: number \| string,
end?: number \| string,
rotation?: number\|string,
colors: Array<[ColorStop](ts-basic-components-gauge.md#colorstop)>,
repeating?: boolean
} | Sweep gradient, which can sweep around the specified center point in the 0–360 degree range. If the rotation angle exceeds the range, a monochrome color instead of a gradient will be drawn.
- **center**: center point of the sweep gradient, that is, the coordinates relative to the upper left corner of the current component.
- **start**: start point of the sweep gradient.
Default value: **0**
- **end**: end point of the sweep gradient.
Default value: **0**
- **rotation**: rotation angle of the sweep gradient.
Default value: **0**
- **colors**: colors of the sweep gradient.
- **repeating**: whether the colors are repeated.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
A value less than 0 evaluates to the value **0**. A value greater than 360 evaluates to the value **1**.
When the data type of **start**, **end**, and **rotation** is string, the value **"90"** or **"90%"** is equivalent to **90**. | +| radialGradient | {
center: Point,
radius: number \| string,
colors: Array<[ColorStop](ts-basic-components-gauge.md#colorstop)>,
repeating?: boolean
} | Radial gradient.
- **center**: center point of the radial gradient, that is, the coordinates relative to the upper left corner of the current component.
- **radius**: radius of the radial gradient.
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the value **0**.
- **colors**: colors of the radial gradient.
- **repeating**: whether the colors are repeated.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets. | ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-grid.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-grid.md index ff40648d9b60813d533cb79eee781df523738bf8..d5273a2bf095ea4fa4f34e2e7306f7b467ff72db 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-grid.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-grid.md @@ -12,7 +12,7 @@ | Name | Type | Description | | ----------- | ------------------------------------------------------------ | ------------------------------------------------------------ | -| useSizeType | {
xs?: number \| { span: number, offset: number },
sm?: number \| { span: number, offset: number },
md?: number \| { span: number, offset: number },
lg?: number \| { span: number, offset: number }
} | Number of occupied columns and offset columns for a specific device width type. **span** indicates the number of occupied columns, and **offset** indicates the number of offset columns.
If the value is of the number type, only the number of columns can be set. If the value is in the format of {"span": 1, "offset": 0}, both the number of occupied columns and the number of offset columns need to be set.
- **xs** indicates that the device width type is **SizeType.XS**.
- **sm** indicates that the device width type is **SizeType.SM**.
- **md** indicates that the device width type is **SizeType.MD**.
- **lg** indicates that the device width type is **SizeType.LG**.| +| useSizeType(deprecated) | {
xs?: number \| { span: number, offset: number },
sm?: number \| { span: number, offset: number },
md?: number \| { span: number, offset: number },
lg?: number \| { span: number, offset: number }
} | Number of occupied columns and offset columns for a specific device width type. **span** indicates the number of occupied columns, and **offset** indicates the number of offset columns.
If the value is of the number type, only the number of columns can be set. If the value is in the format of {"span": 1, "offset": 0}, both the number of occupied columns and the number of offset columns need to be set.
- **xs** indicates that the device width type is **SizeType.XS**.
- **sm** indicates that the device width type is **SizeType.SM**.
- **md** indicates that the device width type is **SizeType.MD**.
- **lg** indicates that the device width type is **SizeType.LG**.
This attribute is deprecated since API version 9. You are advised to use [GridCol](ts-container-gridcol.md) and [GridRow](ts-container-gridrow.md) instead. | | gridSpan | number | Default number of occupied columns, that is, the number of occupied columns when **span** in **useSizeType** is not set.
**NOTE**
If the **span** attribute is set, the component width is determined by the grid layout.
Default value: **1**| | gridOffset | number | Default number of offset columns, that is, the number of offset columns in the start direction of the parent component (which is also the nth column that the component is in) when **offset** in **useSizeType** is not set.
**NOTE**
- After this attribute is set, the horizontal layout of the current component does not follow the original layout of the parent component. Instead, it offsets along the start direction of the parent component.
- Offset = (Column width + Gap) \* Number of columns.
- After this attribute is set, sibling components will be arranged relatively to this component, as in the relative layout.
Default value: **0**| diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-image-effect.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-image-effect.md index 69272c0d3bf0283b23e894da1342649e6c612472..721a7a425c5153ed672c718921dcfe593958e481 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-image-effect.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-image-effect.md @@ -3,6 +3,7 @@ Image effects include blur, shadow, and much more. > **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. @@ -11,17 +12,41 @@ Image effects include blur, shadow, and much more. | Name | Type | Default Value| Description | | ----------------------------- | ------------------------------------------------------------ | ------ | ------------------------------------------------------------ | -| blur | number | - | Applies the content blur effect to the current component. The input parameter is the blur radius. The larger the radius is, the more blurred the content is. If the value is **0**, the content is not blurred.| -| backdropBlur | number | - | Applies the background blur effect to the current component. The input parameter is the blur radius. The larger the radius is, the more blurred the background is. If the value is **0**, the background is not blurred.| -| shadow | {
radius: number \| [Resource](ts-types.md#resource),
color?: [Color](ts-appendix-enums.md#color) \| string \| [Resource](ts-types.md#resource),
offsetX?: number \| [Resource](ts-types.md#resource),
offsetY?: number \| [Resource](ts-types.md#resource)
} | - | Applies the shadow effect to the current component. The input parameters are the fuzzy radius (mandatory), shadow color (optional; gray by default), x-axis offset (optional; 0 by default), and y-axis offset (optional; 0 by default). The offset unit is px.| -| grayscale | number | 0.0 | Converts the input image to grayscale. The value indicates the grayscale conversion ratio. If the input value is **1.0**, the image is converted into a grayscale image. If the input value is **0.0**, the image does not change. If the input value is between **0.0** and **1.0**, the effect changes in linear mode. The unit is percentage.| -| brightness | number | 1.0 | Applies a brightness to the current component. The input parameter is a brightness ratio. The value **1** indicates no effects. The value **0** indicates the complete darkness. If the value is less than **1**, the brightness decreases. If the value is greater than **1**, the brightness increases. A larger value indicates a higher brightness.| -| saturate | number | 1.0 | Applies the saturation effect to the current component. The saturation is the ratio of the chromatic component to the achromatic component (gray) in a color. When the input value is **1**, the source image is displayed. When the input value is greater than **1**, a higher percentage of the chromatic component indicates a higher saturation. When the input value is less than **1**, a higher percentage of the achromatic component indicates a lower saturation. The unit is percentage.| -| contrast | number | 1.0 | Applies the contrast effect to the current component. The input parameter is a contrast value. If the value is **1**, the source image is displayed. If the value is greater than **1**, a larger value indicates a higher contrast and a clearer image. If the value is less than **1**, a smaller value indicates a lower contrast is. If the value is **0**, the image becomes all gray. The unit is percentage.| -| invert | number | 0 | Inverts the input image. The input parameter is an image inversion ratio. The value **1** indicates complete inversion. The value **0** indicates that the image does not change. The unit is percentage.| -| sepia | number | 0 | Converts the image color to sepia. The input parameter is an image inversion ratio. The value **1** indicates the image is completely sepia. The value **0** indicates that the image does not change. The unit is percentage.| -| hueRotate | number \| string | '0deg' | Applies the hue rotation effect to the current component. The input parameter is a rotation angle. | -| colorBlend 8+ | [Color](ts-appendix-enums.md#color) \| string \| [Resource](ts-types.md#resource) | - | Applies the color blend effect to the current component. The input parameter is the blended color. | +| blur | number | - | Applies the content blur effect to the current component. The input parameter is the blur radius. The larger the radius is, the more blurred the content is. If the value is **0**, the content is not blurred.
Value range: [0, +∞)
Since API version 9, this API is supported in ArkTS widgets.| +| backdropBlur | number | - | Applies the background blur effect to the current component. The input parameter is the blur radius. The larger the radius is, the more blurred the background is. If the value is **0**, the background is not blurred.
Value range: [0, +∞)
Since API version 9, this API is supported in ArkTS widgets.| +| shadow | [ShadowOptions](#shadowoptions) \| [ShadowStyle](#shadowstyle10) | - | Applies a shadow effect to the current component.
When the value type is **ShadowOptions**, the blur radius, shadow color, and offset along the x-axis and y-axis can be specified.
When the value type is **ShadowStyle**, the shadow style can be specified.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
ArkTS widgets do not support the [ShadowStyle](#shadowstyle10) value type.| +| grayscale | number | 0.0 | Converts the input image to grayscale. The value indicates the grayscale conversion ratio. If the input value is **1.0**, the image is converted into a grayscale image. If the input value is **0.0**, the image does not change. If the input value is between **0.0** and **1.0**, the effect changes in linear mode. The unit is percentage.
Value range: [0, 1]
**NOTE**
A value less than 0 evaluates to the value **0**. A value greater than 1 evaluates to the value **1**.
Since API version 9, this API is supported in ArkTS widgets.| +| brightness | number | 1.0 | Applies a brightness to the current component. The input parameter is a brightness ratio. The value **1** indicates no effects. The value **0** indicates the complete darkness. If the value is less than **1**, the brightness decreases. If the value is greater than **1**, the brightness increases. A larger value indicates a higher brightness.
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the value **0**.
Since API version 9, this API is supported in ArkTS widgets.| +| saturate | number | 1.0 | Applies the saturation effect to the current component. The saturation is the ratio of the chromatic component to the achromatic component (gray) in a color. When the input value is **1**, the source image is displayed. When the input value is greater than **1**, a higher percentage of the chromatic component indicates a higher saturation. When the input value is less than **1**, a higher percentage of the achromatic component indicates a lower saturation. The unit is percentage.
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the value **0**.
Since API version 9, this API is supported in ArkTS widgets.| +| contrast | number | 1.0 | Applies the contrast effect to the current component. The input parameter is a contrast value. If the value is **1**, the source image is displayed. If the value is greater than 1, a larger value indicates a higher contrast and a clearer image. If the value is less than 1, a smaller value indicates a lower contrast is. If the value is **0**, the image becomes all gray. The unit is percentage.
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the value **0**.
Since API version 9, this API is supported in ArkTS widgets.| +| invert | number | 0 | Inverts the input image. The input parameter is an image inversion ratio. The value **1** indicates complete inversion, and **0** indicates that the image does not change. The unit is percentage.
Value range: [0, 1]
**NOTE**
A value less than 0 evaluates to the value **0**.
Since API version 9, this API is supported in ArkTS widgets.| +| sepia | number | 0 | Converts the image color to sepia. The input parameter is an image conversion ratio. The value **1** indicates the image is completely sepia, and **0** indicates that the image does not change. The unit is percentage.
Since API version 9, this API is supported in ArkTS widgets.| +| hueRotate | number \| string | '0deg' | Applies the hue rotation effect to the current component. The input parameter is a rotation angle.
Value range: (-∞, +∞)
**NOTE**
A rotation of 360 degrees leaves the color unchanged. A rotation of 180 degrees and then –180 degrees also leaves the color unchanged. When the data type is number, the value 90 is equivalent to **'90deg'**.
Since API version 9, this API is supported in ArkTS widgets.| +| colorBlend 8+ | [Color](ts-appendix-enums.md#color) \| string \| [Resource](ts-types.md#resource) | - | Applies the color blend effect to the current component. The input parameter is the blended color.
Since API version 9, this API is supported in ArkTS widgets.| + +## ShadowOptions + +Provides the shadow attributes, including the blur radius, color, and offset along the x-axis and y-axis. + +Since API version 9, this API is supported in ArkTS widgets. + +| Name | Type | Mandatory | Description | +| ------ | ------ | ---- | --------------- | +| radius | number \| [Resource](ts-types.md#resource) | Yes | Blur radius of the shadow.
Value range: [0, +∞)
**NOTE**
A value less than 0 evaluates to the value **0**.| +| color | [Color](ts-appendix-enums.md#color) \| string \| [Resource](ts-types.md#resource) | No | Color of the shadow.
The default color is black.| +| offsetX | number \| [Resource](ts-types.md#resource) | No | Offset of the shadow along the x-axis.
The default value is **0**. | +| offsetY | number \| [Resource](ts-types.md#resource) | No | Offset of the shadow along the y-axis.
The default value is **0**.| + +## ShadowStyle10+ + +| Name | Description | +| ------ | -------------------------------------- | +| OuterDefaultXS | Mini shadow.| +| OuterDefaultSM | Small shadow.| +| OuterDefaultMD | Medium shadow.| +| OuterDefaultLG | Large shadow.| +| OuterFloatingSM | Floating small shadow.| +| OuterFloatingMD | Floating medium shadow.| ## Example 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 6fbaa35cdd66ca161b41999aedd1a2f06996f13d..76855375443264f0e2552db2b0df1fd339d8a53b 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 @@ -9,10 +9,10 @@ Layout constraints refer to constraints on the aspect ratio and display priority ## Attributes -| Name | Type | Description | -| --------------- | ------ | ---------------------------------------- | -| aspectRatio | number | Aspect ratio of the component, which can be obtained using the following formula: Width/Height. | -| displayPriority | number | Display priority for the component in the layout container. When the space of the parent container is insufficient, the component with a lower priority is hidden.
The digits after the decimal point are not counted in determining the display priority. That is, numbers in the [x, x + 1) range are considered to represent the same priority. For example, **1.0** and **1.9** represent the same priority.
**NOTE**
This attribute is valid only for the **\**, **\**, and **\** (single-row) container components.| +| Name | Type| Description | +| --------------- | -------- | ------------------------------------------------------------ | +| aspectRatio | number | Aspect ratio of the component, which can be obtained using the following formula: Width/Height.
Since API version 9, this API is supported in ArkTS widgets.| +| displayPriority | number | Display priority for the component in the layout container. When the space of the parent container is insufficient, the component with a lower priority is hidden.
The digits after the decimal point are not counted in determining the display priority. That is, numbers in the [x, x + 1) range are considered to represent the same priority. For example, **1.0** and **1.9** represent the same priority.
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
This attribute is valid only for the **\**, **\**, and **\** (single-row) container components.| ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-location.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-location.md index a603c54bc5f16e877420e80c1714ac16f70e2123..af2554cac67dd52793d48f5a3b0c059f70a21f2c 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-location.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-location.md @@ -12,12 +12,12 @@ The location attributes set the alignment mode, layout direction, and position o | Name| Type| Description| | -------- | -------- | -------- | -| align | [Alignment](ts-appendix-enums.md#alignment) | Alignment mode of the component content in the drawing area.
Default value: **Alignment.Center**| -| direction | [Direction](ts-appendix-enums.md#direction) | Horizontal layout of the component.
Default value: **Direction.Auto**| -| position | [Position](ts-types.md#position8) | Offset of the component's upper left corner relative to the parent component's upper left corner. This offset is expressed using absolute values. When laying out components, this attribute does not affect the layout of the parent component. It only adjusts the component position during drawing.| -| markAnchor | [Position](ts-types.md#position8) | Anchor point of the component for positioning. The upper left corner of the component is used as the reference point for offset. Generally, this attribute is used together with the **position** and **offset** attributes. When used independently, this attribute is similar to **offset**.
Default value:
{
x: 0,
y: 0
} | -| offset | [Position](ts-types.md#position8) | Offset of the component relative to itself. This offset is expressed using relative values. This attribute does not affect the layout of the parent component. It only adjusts the component position during drawing.
Default value:
{
x: 0,
y: 0
} | -| alignRules9+ | {
left?: { anchor: string, align: [HorizontalAlign](ts-appendix-enums.md#horizontalalign) };
right?: { anchor: string, align: [HorizontalAlign](ts-appendix-enums.md#horizontalalign) };
middle?: { anchor: string, align: [HorizontalAlign](ts-appendix-enums.md#horizontalalign) };
top?: { anchor: string, align: [VerticalAlign](ts-appendix-enums.md#verticalalign) };
bottom?: { anchor: string, align: [VerticalAlign](ts-appendix-enums.md#verticalalign) };
center?: { anchor: string, align: [VerticalAlign](ts-appendix-enums.md#verticalalign) }
} | Alignment rules relative to the container. This attribute is valid only when the container is [\](ts-container-relativecontainer.md).
- **left**: left-aligned.
- **right**: right-aligned.
- **middle**: center-aligned.
- **top**: top-aligned.
- **bottom**: bottom-aligned.
- **center**: center-aligned.
**NOTE**
- **anchor**: ID of the component that functions as the anchor point.
- **align**: alignment mode relative to the anchor component.| +| align | [Alignment](ts-appendix-enums.md#alignment) | Alignment mode of the component content in the drawing area.
Default value: **Alignment.Center**
Since API version 9, this API is supported in ArkTS widgets.| +| direction | [Direction](ts-appendix-enums.md#direction) | Horizontal layout of the component.
Default value: **Direction.Auto**
Since API version 9, this API is supported in ArkTS widgets.| +| position | [Position](ts-types.md#position8) | Offset of the component's upper left corner relative to the parent component's upper left corner. This offset is expressed using absolute values. When laying out components, this attribute does not affect the layout of the parent component. It only adjusts the component position during drawing.
This attribute is applicable to scenarios where the component is fixed at a position in the parent container, for example, where it is pinned to top or floating above the UI.
Since API version 9, this API is supported in ArkTS widgets.| +| markAnchor | [Position](ts-types.md#position8) | Anchor point of the component for positioning. The upper left corner of the component is used as the reference point for offset. Generally, this attribute is used together with the **position** and **offset** attributes. When used independently, this attribute is similar to **offset**.
Default value:
{
x: 0,
y: 0
}
Since API version 9, this API is supported in ArkTS widgets.| +| offset | [Position](ts-types.md#position8) | Offset of the component relative to itself. This offset is expressed using relative values. This attribute does not affect the layout of the parent component. It only adjusts the component position during drawing.
Default value:
{
x: 0,
y: 0
}
Since API version 9, this API is supported in ArkTS widgets.| +| alignRules9+ | {
left?: { anchor: string, align: [HorizontalAlign](ts-appendix-enums.md#horizontalalign) };
right?: { anchor: string, align: [HorizontalAlign](ts-appendix-enums.md#horizontalalign) };
middle?: { anchor: string, align: [HorizontalAlign](ts-appendix-enums.md#horizontalalign) };
top?: { anchor: string, align: [VerticalAlign](ts-appendix-enums.md#verticalalign) };
bottom?: { anchor: string, align: [VerticalAlign](ts-appendix-enums.md#verticalalign) };
center?: { anchor: string, align: [VerticalAlign](ts-appendix-enums.md#verticalalign) }
} | Alignment rules relative to the container. This attribute is valid only when the container is [\](ts-container-relativecontainer.md).
- **left**: left-aligned.
- **right**: right-aligned.
- **middle**: center-aligned.
- **top**: top-aligned.
- **bottom**: bottom-aligned.
- **center**: center-aligned.
This API is supported in ArkTS widgets.
**NOTE**
- **anchor**: ID of the component that functions as the anchor point.
- **align**: alignment mode relative to the anchor component.| ## Example @@ -32,19 +32,15 @@ struct PositionExample1 { Column({ space: 10 }) { // When the component content is within the area specified by the component width and height, set the alignment mode of the content in the component. Text('align').fontSize(9).fontColor(0xCCCCCC).width('90%') - Text('top start') - .align(Alignment.TopStart) - .height(50) - .width('90%') - .fontSize(16) - .backgroundColor(0xFFE4C4) - - Text('Bottom end') - .align(Alignment.BottomEnd) - .height(50) - .width('90%') - .fontSize(16) - .backgroundColor(0xFFE4C4) + Stack() { + Text('First show in bottom end').height('65%').backgroundColor(0xD2B48C) + Text('Second show in bottom end').backgroundColor(0xF5DEB3).opacity(0.9) + }.width('90%').height(50).margin({ top: 5 }).backgroundColor(0xFFE4C4) + .align(Alignment.BottomEnd) + Stack() { + Text('top start') + }.width('90%').height(50).margin({ top: 5 }).backgroundColor(0xFFE4C4) + .align(Alignment.TopStart) // To arrange the child components from left to right, set direction of the parent container to Direction.Ltr. Text('direction').fontSize(9).fontColor(0xCCCCCC).width('90%') @@ -86,6 +82,7 @@ struct PositionExample2 { Text('position').fontSize(12).fontColor(0xCCCCCC).width('90%') Row() { Text('1').size({ width: '30%', height: '50' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(16) + .textAlign(TextAlign.Center) Text('2 position(30, 10)') .size({ width: '60%', height: '30' }) .backgroundColor(0xbbb2cb) @@ -94,6 +91,7 @@ struct PositionExample2 { .align(Alignment.Start) .position({ x: 30, y: 10 }) Text('3').size({ width: '45%', height: '50' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(16) + .textAlign(TextAlign.Center) Text('4 position(50%, 70%)') .size({ width: '50%', height: '50' }) .backgroundColor(0xbbb2cb) @@ -110,14 +108,20 @@ struct PositionExample2 { .size({ width: '100', height: '100' }) .backgroundColor(0xdeb887) Text('text') + .fontSize('30px') + .textAlign(TextAlign.Center) .size({ width: 25, height: 25 }) .backgroundColor(Color.Green) .markAnchor({ x: 25, y: 25 }) Text('text') + .fontSize('30px') + .textAlign(TextAlign.Center) .size({ width: 25, height: 25 }) .backgroundColor(Color.Green) .markAnchor({ x: -100, y: -25 }) Text('text') + .fontSize('30px') + .textAlign(TextAlign.Center) .size({ width: 25, height: 25 }) .backgroundColor(Color.Green) .markAnchor({ x: 25, y: -25 }) @@ -127,6 +131,7 @@ struct PositionExample2 { Text('offset').fontSize(12).fontColor(0xCCCCCC).width('90%') Row() { Text('1').size({ width: '15%', height: '50' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(16) + .textAlign(TextAlign.Center) Text('2 offset(15, 30)') .size({ width: 120, height: '50' }) .backgroundColor(0xbbb2cb) @@ -135,6 +140,7 @@ struct PositionExample2 { .align(Alignment.Start) .offset({ x: 15, y: 30 }) Text('3').size({ width: '15%', height: '50' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(16) + .textAlign(TextAlign.Center) Text('4 offset(-10%, 20%)') .size({ width: 100, height: '50' }) .backgroundColor(0xbbb2cb) 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 cf02ba55e1483bf32b09caf519f603183ea6064e..c58595fb1861bfb73d5f7700af3cf7d0c130c53e 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,6 +1,6 @@ # Menu Control -A menu – a vertical list of items – can be bound to a component and displayed by long-pressing, clicking, or right-clicking the component. +A context menu – a vertical list of items – can be bound to a component and displayed by long-pressing, clicking, or right-clicking the component. > **NOTE** > @@ -10,18 +10,37 @@ A menu – a vertical list of items – can be bound to a component and displaye ## Attributes -| Name | Type | Description | +| Name | Type | Description | | ---------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | -| bindMenu | Array<[MenuItem](#menuitem)> \| [CustomBuilder](ts-types.md#custombuilder8) | Menu bound to the component, which is displayed when you click the component. Textual and custom menu items are supported.| -| bindContextMenu8+ | content: [CustomBuilder](ts-types.md#custombuilder8),
responseType: [ResponseType](ts-appendix-enums.md#responsetype8) | Context menu bound to the component, which is displayed when you long-press or right-click the component. Only custom menu items are supported.| +| bindMenu | content: Array<[MenuItem](#menuitem)> \| [CustomBuilder](ts-types.md#custombuilder8),
options: [MenuOptions](#menuoptions10) | Menu bound to the component, which is displayed when you click the component. A menu item can be a combination of text and icons or a custom component.
**content**: array of menu item text and icons or custom components.
**options**: parameters of the context menu. Optional.| +| bindContextMenu8+ | content: [CustomBuilder](ts-types.md#custombuilder8),
responseType: [ResponseType](ts-appendix-enums.md#responsetype8)
options: [ContextMenuOptions](#contextmenuoptions10) | Context menu bound to the component, which is displayed when the user long-presses or right-clicks the component. Only custom menu items are supported.
**responseType**: how the context menu triggered, which can be long-press or right-click. Mandatory.
**options**: parameters of the context menu. Optional.| ## MenuItem -| Name | Type | Description | -| ------ | ----------------------- | ----------- | -| value | string | Menu item text. | -| action | () => void | Action triggered when a menu item is clicked.| - +| Name | Type | Mandatory| Description | +| ------------------ | -------------------------------------- | ---- | ---------------------- | +| value | string | Yes | Menu item text. | +| icon10+ | [ResourceStr](ts-types.md#resourcestr) | No | Menu item icon. | +| action | () => void | Yes | Action triggered when a menu item is clicked.| + +## MenuOptions10+ + +| Name | Type | Mandatory| Description | +| ------ | -------------------------------- | ---- | ------------------------------------------------------ | +| title | string | No | Menu title. | +| offset | [Position](ts-types.md#position8) | No | Offset for showing the context menu, which should not cause the menu to extend beyond the screen.| +| placement | [Placement](ts-appendix-enums.md#placement8) | No| Preferred position of the context menu. If the set position is insufficient for holding the component, it will be automatically adjusted.
Default value: **Placement.Bottom**| +| onAppear | () => void | No| Callback triggered when the menu is displayed.| +| onDisappear | () => void | No| Callback triggered when the menu is hidden.| + +## ContextMenuOptions10+ + +| Name | Type | Mandatory| Description | +| ----------- | -------------------------------------------- | ---- | ------------------------------------------------------------ | +| offset | [Position](ts-types.md#position8) | No | Offset for showing the context menu, which should not cause the menu to extend beyond the screen. | +| placement | [Placement](ts-appendix-enums.md#placement8) | No | Preferred position of the context menu. If the set position is insufficient for holding the component, it will be automatically adjusted.
Default value: **Placement.Bottom**| +| onAppear | () => void | No | Callback triggered when the menu is displayed. | +| onDisappear | () => void | No | Callback triggered when the menu is hidden. | ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-opacity.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-opacity.md index 2ead12307d619826e4ae7ae26f29732df1302857..198d40461efcb6d586ef5ff5edb829be3f9ea224 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-opacity.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-opacity.md @@ -10,9 +10,9 @@ You can set the opacity of a component. ## Attributes -| Name | Type | Description | -| ------- | ---------------------------------------- | ---------------------------------------- | -| opacity | number \| [Resource](ts-types.md#resource) | Opacity of the component. The value ranges from 0 to 1. The value **1** means opaque, and **0** means completely transparent. When being completely transparent, the component is hidden, but still takes up space in the layout. Default value: **1**
**NOTE**
A component inherits the opacity setting from its parent component and multiplies it by its own setting. For example, if the opacity of a component is 0.8 and that of its parent component is 0.1, then the actual opacity of the component is 0.1 x 0.8 = 0.8.| +| Name | Type | Description | +| ------- | ---------------------------------------------------- | ------------------------------------------------------------ | +| opacity | number \| [Resource](ts-types.md#resource) | Opacity of the component. The value ranges from 0 to 1. The value **1** means opaque, and **0** means completely transparent. When being completely transparent, the component is hidden, but still takes up space in the layout. Default value: **1**
Since API version 9, this API is supported in ArkTS widgets.
**NOTE**
A component inherits the opacity setting from its parent component and multiplies it by its own setting. For example, if the opacity of a component is 0.8 and that of its parent component is 0.1, then the actual opacity of the component is 0.1 x 0.8 = 0.8. | ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-overlay.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-overlay.md index 4bb23b9f11f8f7ab4aa187fedaca3ab37716a461..412b3b5be90a52e110a7b45eef2069ccbf9c5a34 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-overlay.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-overlay.md @@ -10,7 +10,7 @@ You can set overlay text for a component. | Name| Type| Default Value| Description| | -------- | -------- | -------- | -------- | -| overlay | value: string,
options?: {
align?: [Alignment](ts-appendix-enums.md#alignment),
offset?: {x?: number, y?: number}
} | {
align: Alignment.Center,
offset: {0, 0}
} | Overlay added to the component.
**value**: mask text.
**options**: text positioning. **align** indicates the location of the text relative to the component. **[offset](ts-universal-attributes-location.md)** indicates the offset of the text relative to the upper left corner of itself. By default, the text is in the upper left corner of the component.
If both **align** and **offset** are set, the text is first positioned relative to the component, and then offset relative to the upper left corner of itself.| +| overlay | value: string,
options?: {
align?: [Alignment](ts-appendix-enums.md#alignment),
offset?: {x?: number, y?: number}
} | {
align: Alignment.Center,
offset: {0, 0}
} | Overlay added to the component.
**value**: mask text.
**options**: text positioning. **align** indicates the location of the text relative to the component. **[offset](ts-universal-attributes-location.md)** indicates the offset of the text relative to the upper left corner of itself. By default, the text is in the upper left corner of the component.
If both **align** and **offset** are set, the text is first positioned relative to the component, and then offset relative to the upper left corner of itself.
Since API version 9, this API is supported in ArkTS widgets.| ## Example diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-polymorphic-style.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-polymorphic-style.md index 5d3d604773dd94846f3f77957ce1bce86540e660..f0698f179b985dff0628d8d963b736ad51d7d16e 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-polymorphic-style.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-polymorphic-style.md @@ -11,10 +11,12 @@ You can set state-specific styles for components. | Style| Type| Description| | -------- | -------- | -------- | -| stateStyles | StateStyles | Styles of the component for different states.| +| stateStyles | StateStyles | Styles of the component for different states.
Since API version 9, this API is supported in ArkTS widgets.| ## StateStyles +Since API version 9, this API is supported in ArkTS widgets. + | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | normal | ()=>void | No| Style of the component when being stateless.| diff --git a/en/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md b/en/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md index 44ef15dc387f102ead0ba5b5031d0867b746c29e..e9f1c5c337d47121ada8673d82f832f68a075134 100644 --- a/en/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md +++ b/en/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md @@ -18,28 +18,37 @@ You can bind a popup to a component, specifying its content, interaction logic, | Name | Type | Mandatory | Description | | -------------------------| ------------------------------------------------| -----| ----------------------------------------- | -| message | string | Yes | Content of the popup message. | -| placementOnTop | boolean | No | Whether to display the popup above the component.
Default value: **false** | -| primaryButton | {
value: string,
action: () => void
} | No | Primary button.
**value**: text of the primary button in the popup.
**action**: callback for clicking the primary button.| -| secondaryButton | {
value: string,
action: () => void
} | No | Secondary button.
**value**: text of the secondary button in the popup.
**action**: callback for clicking the secondary button.| -| onStateChange | (event: { isVisible: boolean }) => void | No | Callback for the popup status change event.
**isVisible**: whether the popup is visible. | -| arrowOffset9+ | [Length](ts-types.md#length) | No | Offset of the popup arrow relative to the popup.
When the arrow is at the top or bottom of the popup: The value 0 indicates that the arrow is located on the leftmost, and any other value indicates the distance from the arrow to the leftmost; the arrow is centered by default.
When the arrow is on the left or right side of the popup: The value indicates the distance from the arrow to the top; the arrow is centered by default.
When the popup is displayed on either edge of the screen, it will automatically deviate leftward or rightward to stay within the safe area. When the value is 0, the arrow always points to the bound component. | -| showInSubWindow9+ | boolean | No | Whether to show the popup in the subwindow.
Default value: **false** | - +| message | string | Yes | Content of the popup message. | +| placementOnTop | boolean | No | Whether to display the popup above the component.
Default value: **false** | +| primaryButton | {
value: string,
action: () => void
} | No | Primary button.
**value**: text of the primary button in the popup.
**action**: callback for clicking the primary button.| +| secondaryButton | {
value: string,
action: () => void
} | No | Secondary button.
**value**: text of the secondary button in the popup.
**action**: callback for clicking the secondary button.| +| onStateChange | (event: { isVisible: boolean }) => void | No | Callback for the popup status change event.
**isVisible**: whether the popup is visible. | +| arrowOffset9+ | [Length](ts-types.md#length) | No | Offset of the popup arrow relative to the popup.
When the arrow is at the top or bottom of the popup: The value **0** indicates that the arrow is located on the leftmost, and any other value indicates the distance from the arrow to the leftmost; the arrow is centered by default.
When the arrow is on the left or right side of the popup: The value indicates the distance from the arrow to the top; the arrow is centered by default.
When the popup is displayed on either edge of the screen, it will automatically deviate leftward or rightward to stay within the safe area. When the value is **0**, the arrow always points to the bound component. | +| showInSubWindow9+ | boolean | No | Whether to show the popup in the subwindow.
Default value: **false** | +| mask10+ | boolean \| [ResourceColor](ts-types.md#resourcecolor) | No | Whether to apply a mask to the popup. The value **true** means to apply a transparent mask to the popup, **false** means not to apply a mask to the popup, and a color value means to apply a mask in the corresponding color to the popup.| +| messageOptions10+ | [PopupMessageOptions](#popupmessageoptions10) | No | Parameters of the popup message.| +| targetSpace10+ | [Length](ts-types.md#length) | No | Space between the popup and the target.| + +## PopupMessageOptions10+ + +| Name | Type | Mandatory| Description | +| --------- | ------------------------------------------ | ---- | ---------------------- | +| textColor | [ResourceColor](ts-types.md#resourcecolor) | No | Text color of the popup message.| +| font | [Font](ts-types.md#Font) | No | Font attributes of the popup message.| ## CustomPopupOptions8+ | Name | Type | Mandatory | Description | | -------------------------| ------------------------- | ---- | ---------------------------------------------------- | -| builder | [CustomBuilder](ts-types.md#custombuilder8) | Yes | Popup builder. | -| placement | [Placement](ts-appendix-enums.md#placement8) | No | Preferred position of the popup. If the set position is insufficient for holding the popup, it will be automatically adjusted.
Default value: **Placement.Bottom** | -| maskColor | [ResourceColor](ts-types.md#resourcecolor) | No | Color of the popup mask. | -| popupColor | [ResourceColor](ts-types.md#resourcecolor) | No | Color of the popup. | -| enableArrow | boolean | No | Whether to display an arrow.
Since API version 9, if the position set for the popup is not large enough, the arrow will not be displayed. For example, if **placement** is set to **Left** but the popup height is less than twice the arrow width (64 vp), the arrow will not be displayed.
Default value: **true**| -| autoCancel | boolean | No | Whether to automatically close the popup when an operation is performed on the page.
Default value: **true** | -| onStateChange | (event: { isVisible: boolean }) => void | No | Callback for the popup status change event. The parameter **isVisible** indicates whether the popup is visible.| -| arrowOffset9+ | [Length](ts-types.md#length) | No | Offset of the popup arrow relative to the popup.
When the arrow is at the top or bottom of the popup: The value 0 indicates that the arrow is located on the leftmost, and any other value indicates the distance from the arrow to the leftmost; the arrow is centered by default.
When the arrow is on the left or right side of the popup: The value indicates the distance from the arrow to the top; the arrow is centered by default.
When the popup is displayed on either edge of the screen, it will automatically deviate leftward or rightward to stay within the safe area. When the value is 0, the arrow always points to the bound component. | +| builder | [CustomBuilder](ts-types.md#custombuilder8) | Yes | Popup builder. | +| placement | [Placement](ts-appendix-enums.md#placement8) | No | Preferred position of the popup. If the set position is insufficient for holding the popup, it will be automatically adjusted.
Default value: **Placement.Bottom** | +| popupColor | [ResourceColor](ts-types.md#resourcecolor) | No | Color of the popup. | +| enableArrow | boolean | No | Whether to display an arrow.
Since API version 9, if the position set for the popup is not large enough, the arrow will not be displayed. For example, if **placement** is set to **Left**, but the popup height (80 vp) is less than the sum of the arrow width (32 vp) and diameter of popup rounded corner (48 vp), the arrow will not be displayed.
Default value: **true**| +| autoCancel | boolean | No | Whether to automatically close the popup when an operation is performed on the page.
Default value: **true** | +| onStateChange | (event: { isVisible: boolean }) => void | No | Callback for the popup status change event.
**isVisible**: whether the popup is visible. | +| arrowOffset9+ | [Length](ts-types.md#length) | No | Offset of the popup arrow relative to the popup.
When the arrow is at the top or bottom of the popup: The value **0** indicates that the arrow is located on the leftmost, and any other value indicates the distance from the arrow to the leftmost; the arrow is centered by default.
When the arrow is on the left or right side of the popup: The value indicates the distance from the arrow to the top; the arrow is centered by default.
When the popup is displayed on either edge of the screen, it will automatically deviate leftward or rightward to stay within the safe area. When the value is **0**, the arrow always points to the bound component. | | showInSubWindow9+ | boolean | No | Whether to show the popup in the subwindow.
Default value: **false** | - +| mask10+ | boolean \| [ResourceColor](ts-types.md#resourcecolor) | No| Whether to apply a mask to the popup. The value **true** means to apply a transparent mask to the popup, **false** means not to apply a mask to the popup, and a color value means to apply a mask in the corresponding color to the popup.| +| targetSpace10+ | [Length](ts-types.md#length) | No| Space between the popup and the target.| ## Example ```ts @@ -102,7 +111,7 @@ struct PopupExample { .bindPopup(this.customPopup, { builder: this.popupBuilder, placement: Placement.Top, - maskColor: 0x33000000, + mask: {color: 0x33000000}, popupColor: Color.Yellow, enableArrow: true, showInSubWindow: false, 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 3aaeb64451a672c5eb662fb4f79f166fd7afcab5..e154c2dfe63000e75d2525a02237a4852e1b5d54 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 @@ -12,12 +12,57 @@ Shape clipping changes the visible portion of a component through clipping or ma | Name | Type | Description | | -----| ------------------------------------------ | ------------------------------------ | -| clip | [Circle](ts-drawing-components-circle.md) \| [Ellipse](ts-drawing-components-ellipse.md) \| [Path](ts-drawing-components-path.md) \| [Rect](ts-drawing-components-rect.md) \| boolean | Clip mode. If the value is a shape, the component is clipped based on the specified shape. If the value is of the Boolean type, it specifies whether to clip the component based on the edge outline of the parent container.
Default value: **false**| -| mask | [Circle](ts-drawing-components-circle.md) \| [Ellipse](ts-drawing-components-ellipse.md) \| [Path](ts-drawing-components-path.md) \| [Rect](ts-drawing-components-rect.md) | Mask of the specified shape to add to the component.| +| clip | [Circle](ts-drawing-components-circle.md) \| [Ellipse](ts-drawing-components-ellipse.md) \| [Path](ts-drawing-components-path.md) \| [Rect](ts-drawing-components-rect.md) \| boolean | Clip mode. If the value is a shape, the component is clipped based on the specified shape. If the value is of the Boolean type, it specifies whether to clip the component based on the edge outline of the parent container.
Default value: **false**
Since API version 9, this API is supported in ArkTS widgets.| +| mask | [Circle](ts-drawing-components-circle.md) \| [Ellipse](ts-drawing-components-ellipse.md) \| [Path](ts-drawing-components-path.md) \| [Rect](ts-drawing-components-rect.md)\| [ProgressMask](##progressmask10) | Mask of the specified shape to add to the component.
Since API version 9, this API is supported in ArkTS widgets.
Since API version 10, this API supports the **ProgressMask** parameter.| + +## ProgressMask10+ + +Implements a **ProgressMask** object to set the progress, maximum value, and color of the mask. + +### constructor10+ + +constructor(value: number, total: number, color: ResourceColor) + +Constructs a **ProgressMask** object. + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------------------------------------------ | ---- | ------------------ | +| value | number | Yes | Current value of the progress mask.| +| total | number | Yes | Maximum value of the progress mask.| +| color | [ResourceColor](ts-types.md#resourcecolor) | Yes | Color of the progress mask. | + +### updateProgress10+ + +updateProgress(value: number): void + +Updates the progress value of the progress mask. + +**Parameters** + +| Name| Type| Mandatory| Description | +| ------ | -------- | ---- | ------------------ | +| value | number | Yes | Current value of the progress mask.| + +### updateColor10+ + +updateColor(value: ResourceColor): void + +Updates the color of the progress mask. + +**Parameters** + +| Name| Type | Mandatory| Description | +| ------ | ------------------------------------------ | ---- | ---------------- | +| value | [ResourceColor](ts-types.md#resourcecolor) | Yes | Color of the progress mask.| + ## Example +### Example 1 + ```ts // xxx.ets @Entry @@ -54,3 +99,61 @@ struct ClipAndMaskExample { ``` ![clipAndMask](figures/clipAndMask.PNG) + +### Example 2 + +```ts +@Entry +@Component +struct ProgressMask { + @State progressflag1: boolean = true; + @State color: Color = 0x01006CDE; + @State value: number = 10.0; + @State progress: ProgressMask = new ProgressMask(10.0, 100.0, Color.Gray); + build() { + Column({ space: 15 }) { + Text('progress mask').fontSize(12).width('75%').fontColor('#DCDCDC') + // Add a 280px x 280px progress mask to the image. + Image($r('app.media.testImg')) + .width('500px').height('280px') + .mask(this.progress) + .animation({ + duration: 2000, // Animation duration. + .curve(Curve.Linear) // Animation curve. + delay: 0, // Animation delay. + iterations: 1, // Number of playback times. + playMode: PlayMode.Normal // Animation playback mode. + }) // Animation configuration for the width and height attributes of the + + + + ``` + +2. 在ArkTs中使用JavaScriptProxy方法将ArkTs里的对象注册到H5的window对象中,然后在h5中使用window对象调用该方法。比如下面例子,在ArkTs中将testObj这个对象以别名objName注册到h5的window对象上,在上面的h5中就可以使用window.objName去访问这个对象。 + + ``` + // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry + @Component + struct Index { + @State message: string = 'Hello World' + controller: web_webview.WebviewController = new web_webview.WebviewController() + 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() { + Row() { + Column() { + Web({ src:$rawfile('index.html'), controller:this.controller }) + .javaScriptAccess(true) + .javaScriptProxy({ + object: this.testObj, + name: "objName", + methodList: ["test", "toString"], + controller: this.controller, + }) + } + .width('100%') + } + .height('100%') + } + } + ``` + + +**参考链接** + +[javaScriptProxy](../reference/arkui-ts/ts-basic-components-web.md#javascriptproxy) + +## Web组件domStorageAccess属性设置 + +适用于:OpenHarmony 3.2 Beta5 API 9 + +**解决措施** + +设置是否开启文档对象模型存储接口(DOM Storage API)权限,默认未开启,控制web网页中localStorage的使用,对sessionStorage未做控制 + +**参考链接** + +[domStorageAccess](../reference/arkui-ts/ts-basic-components-web.md#domstorageaccess) diff --git a/zh-cn/application-dev/faqs/faqs-arkui.md b/zh-cn/application-dev/faqs/faqs-arkui.md new file mode 100644 index 0000000000000000000000000000000000000000..b6da3c76c3de9a0623c2128d4e81a60250c79bfb --- /dev/null +++ b/zh-cn/application-dev/faqs/faqs-arkui.md @@ -0,0 +1,1466 @@ +# ArkUI框架开发常见问题 + +## 如何动态替换掉资源文件中的“%s”占位符 + +适用于OpenHarmony 3.2 Beta5 API 9 + +**问题现象** + +引用String资源,如何动态替换资源文件中的“%s”占位符。 + +**解决措施** + +在应用中,通过`$r('app.string.xx')`的形式引用应用资源,\$r的第二个参数可用于替换%s占位符。 + +**代码示例** + +``` +build() { + //do something + //引用的string资源,$r的第二个参数用于替换%s + Text($r('app.string.entry_desc','aaa')) + .fontSize(100) + .fontColor(Color.Black) + //do something +} +``` + +## 自定义弹窗能否在ts文件中定义和使用 + +适用于:OpenHarmony 3.2 Beta5 API 9 Stage模型 + +自定义弹窗的定义和初始化需要用到属于ArkTS语法内容,必须在ets后缀文件中定义使用,不能在ts后缀文件中定义使用。 + +**参考链接** + +[自定义弹窗](../reference/arkui-ts/ts-methods-custom-dialog-box.md) + +## 自定义弹窗中的变量如何传递给页面 + +适用于:OpenHarmony 3.2 Beta5 API 9 Stage模型 + +**问题现象** + +在自定义弹窗内定义的变量内容,在关闭弹窗或变量变化时需要及时传递给页面,可以通过何种方式传递? + +**解决措施** + +- 方式一:使用组件的状态变量传递。 +- 方式二:在初始化弹窗时,传递一个方法给自定义弹窗,在自定义弹窗中触发该方法,弹窗中变量作为方法的参数。 +- 方式三:使用AppStorage或LocalStorage方式管理页面状态,实现自定义弹窗和页面之间状态的共享。 + +**代码示例** + +- 方式一: + + ``` + @CustomDialog + struct CustomDialog01 { + @Link inputValue: string + controller: CustomDialogController + build() { + Column() { + Text('Change text').fontSize(20).margin({ top: 10, bottom: 10 }) + TextInput({ placeholder: '', text: this.inputValue }).height(60).width('90%') + .onChange((value: string) => { + this.inputValue = value + }) + } + } + } + + @Entry + @Component + struct DialogDemo01 { + @State inputValue: string = 'click me' + dialogController: CustomDialogController = new CustomDialogController({ + builder: CustomDialog01({ + inputValue: $inputValue + }) + }) + + build() { + Column() { + Button(this.inputValue) + .onClick(() => { + this.dialogController.open() + }).backgroundColor(0x317aff) + }.width('100%').margin({ top: 5 }) + } + } + + ``` + +- 方式二: + + ``` + @CustomDialog + struct CustomDialog02 { + private inputValue: string + changeInputValue: (val: string) => void + controller: CustomDialogController + build() { + Column() { + Text('Change text').fontSize(20).margin({ top: 10, bottom: 10 }) + TextInput({ placeholder: '', text: this.inputValue }).height(60).width('90%') + .onChange((value: string) => { + this.changeInputValue(value) + }) + } + } + } + + @Entry + @Component + struct DialogDemo02 { + @State inputValue: string = 'click me' + dialogController: CustomDialogController = new CustomDialogController({ + builder: CustomDialog02({ + inputValue: this.inputValue, + changeInputValue: (val: string) => { + this.inputValue = val + } + }) + }) + + build() { + Column() { + Button(this.inputValue) + .onClick(() => { + this.dialogController.open() + }).backgroundColor(0x317aff) + }.width('100%').margin({ top: 5 }) + } + } + + ``` + +- 方式三: + + ``` + let storage = LocalStorage.GetShared() + @CustomDialog + struct CustomDialog03 { + @LocalStorageLink('inputVal') inputValue: string = '' + controller: CustomDialogController + build() { + Column() { + Text('Change text').fontSize(20).margin({ top: 10, bottom: 10 }) + TextInput({ placeholder: '', text: this.inputValue }).height(60).width('90%') + .onChange((value: string) => { + this.inputValue = value; + }) + } + } + } + + @Entry(storage) + @Component + struct DialogDemo03 { + @LocalStorageLink('inputVal') inputValue: string = '' + dialogController: CustomDialogController = new CustomDialogController({ + builder: CustomDialog03() + }) + + build() { + Column() { + Button(this.inputValue) + .onClick(() => { + this.dialogController.open() + }).backgroundColor(0x317aff) + }.width('100%').margin({ top: 5 }) + } + } + + ``` + + +## 如何获取组件的宽高 + +适用于:OpenHarmony 3.2 Beta5 API 9 Stage模型 + +**问题现象** + +组件的宽高信息用于计算布局区域大小以及偏移量等内容,如何获取宽高信息? + +**解决措施** + +- 方式一:使用组件区域变化事件onAreaChange,在组件初始化或组件尺寸发生变化时触发。 +- 方式二:在点击或触摸事件中,事件的回调信息中存在目标元素的区域信息。 + +**参考链接** + +[组件区域变化事件](../reference/arkui-ts/ts-universal-component-area-change-event.md),[点击事件](../reference/arkui-ts/ts-universal-events-click.md),[触摸事件](../reference/arkui-ts/ts-universal-events-touch.md) + +## 如何一键清空TextInput、TextArea组件内容 + +适用于:OpenHarmony 3.2 Beta5 API 9 Stage模型 + +**问题现象** + +TextInput,TextArea组件输入多字符后,需要实现点击清空。 + +**解决措施** + +将状态变量赋值给TextInput或TextArea组件的text属性,在做点击清空事件时为状态变量赋值空字符串。 + +**代码示例** + +``` +struct Index { +@State text: string = 'Hello World' +controller: TextInputController = new TextInputController() + build() { + Row() { + Column() { + TextInput({ placeholder: 'Please input your words.', text: this.text, + controller:this.controller}).onChange((value) => { + this.text = value + }) + Button("Clear TextInput").onClick(() => { + this.text = ""; + }) + } + .width('100%') + } + .height('100%') + } +} +``` + +## 如何设置自定义弹窗位置 + +适用于:OpenHarmony 3.2 Beta5 API 9 Stage模型 + +**问题现象** + +自定义弹窗当前默认在窗口居中显示,当自定义弹窗需要与窗口边框对齐是需要设置自定义弹窗的对齐方式。 + +**解决措施** + +初始化自定义弹窗时,通过alignment参数设置对齐方式,通过offset设置弹窗偏移量。 + +**参考链接** + +[自定义弹窗](../reference/arkui-ts/ts-methods-custom-dialog-box.md) + +## 如何隐藏容器组件的溢出内容 + +适用于:OpenHarmony 3.2 Beta5 API 9 Stage模型 + +**问题现象** + +当容器组件内容溢出时,表现为子组件边缘超出容器组件,需要进行隐藏设置。 + +**解决措施** + +将通用属性-形状裁剪clip属性设置为true,表示按照容器边缘轮廓进行裁剪。此属性默认为false,表示不进行裁剪隐藏。 + +**参考链接** + +[形状裁剪](../reference/arkui-ts/ts-universal-attributes-sharp-clipping.md) + + +## 自定义弹窗大小如何自适应内容 + +适用于:OpenHarmony 3.2 Beta5 API 9 Stage模型 + +**问题现象** + +当自定义弹窗中存在可变化区域大小的子组件时,弹窗大小需要跟随自适应。 + +**解决措施** + +- 方式一:采用弹窗容器默认样式。在默认样式中,弹窗容器高度自适应子节点,最大可为窗口高度的90%;弹窗容器的宽度根据栅格系统自适应,不跟随子节点变化。 +- 方式二:当显示设置customStyle为true时,弹窗宽高跟随子节点内容适应。 + +**参考链接** + +[自定义弹窗](../reference/arkui-ts/ts-methods-custom-dialog-box.md) + +## 如何理解自定义弹窗中的gridCount参数 + +适用于:OpenHarmony 3.2 Beta5 API 9 Stage模型 + +gridCount参数是指弹窗宽度占栅格列数的个数。系统把窗口宽等分,等分的份数即为栅格列数,不同设备栅格列数不同。比如手机屏幕密度值在320vp<=水平宽度<600vp,所以栅格列数是4,则gridCount的有效值在\[1, 4\]。 + +注意:仅采用弹窗默认样式时设置有效。 + +**参考链接** + +[自定义弹窗](../reference/arkui-ts/ts-methods-custom-dialog-box.md) + +## 如何去除自定义弹窗的白色背景 + +适用于:OpenHarmony 3.2 Beta5 API 9 Stage模型 + +**问题现象** + +使用自定义弹窗时,默认样式中存在白色背景。 + +**解决措施** + +需要采用自定义样式来消除自定义弹窗的白色背景: + +1. 在初始化自定义弹窗时设置customStyle为true。 +2. 在定义弹窗时设置组件背景色backgroundColor。 + +**参考链接** + +[自定义弹窗](../reference/arkui-ts/ts-methods-custom-dialog-box.md) + +## TextInput组件密码模式下,右边的眼睛图标能否支持自定义 + +适用于:OpenHarmony 3.2 Beta5 API 9 Stage模型 + +**问题现象** + +TextInput组件设置type为InputType.Password时,右侧出现眼睛图标,不能修改图标样式。 + +**解决措施** + +当前图标不支持自定义,可使用TextInput的showPasswordIcon属性隐藏图标,使用Image组件替代控制TextInput组件的type。 + +**参考链接** + +[TextInput组件](../reference/arkui-ts/ts-basic-components-textinput.md) + +## TextInput的onSubmit事件如何使用 + +适用于:OpenHarmony 3.2 Beta5 API 9 Stage模型 + +**问题现象** + +TextInput的onSubmit事件怎么触发,以及事件回调的参数类型代表的含义。 + +**解决措施** + +onSubmit事件在外接键盘或软键盘回车时触发该回调,回调的参数为当前软键盘回车键类型。通过TextInput的enterKeyType属性可以设置输入法回车键类型,软键盘回车键样式需要输入法的支持。 + +**参考链接** + +[TextInput组件](../reference/arkui-ts/ts-basic-components-textinput.md) + +## TextInput在聚焦时如何使光标回到起点 + +适用于:OpenHarmony 3.2 Beta5 API 9 Stage模型 + +**问题现象** + +TextInput组件在聚焦时,光标位置会自动根据触摸点位置变化,如何使得聚焦时光标固定显示在起点位置? + +**解决措施** + +1. TextInput组件绑定onEditChange事件,该事件TextInput可进行输入时触发。 +2. 在事件回调用TextInputController.caretPosition方法设置光标位置,不过需要用到setTimeout延迟方法。 + +**代码示例** + +``` +@Entry +@Component +struct TextInputDemo { + controller: TextInputController = new TextInputController() + + build() { + Column() { + TextInput({ controller: this.controller }) + .onEditChange((isEditing: boolean) => { + if (isEditing) { + setTimeout(() => { + this.controller.caretPosition(0) + }, 100) + } + }) + } + } +} +``` + +**参考链接** + +[TextInput组件](../reference/arkui-ts/ts-basic-components-textinput.md) + +## 如何获取组件的属性信息 + +适用于:OpenHarmony 3.2 Beta5 API 9 Stage模型 + +**解决措施** + +组件所有属性信息可通过通用属性-组件标识内getInspectorByKey获取。 + +**参考链接** + +[组件标识](../reference/arkui-ts/ts-universal-attributes-component-id.md) + +## 如何获取可滚动组件的当前滚动偏移量 + +适用于:OpenHarmony 3.2 Beta5 API 9 Stage模型 + +**问题现象** + +可滚动组件包含List,Grid,Scroll等,在发生滚动时如何获取滚动偏移量? + +**解决措施** + +1. 可滚动组件在初始化时可设置scroller参数,绑定滚动控制器。 +2. 通过控制器的currentOffset方法可获取水平和竖直方向的滚动偏移量。 + +**参考链接** + +[Scroll](../reference/arkui-ts/ts-container-scroll.md#currentoffset) + +## 如何实现文本竖向排列 + +适用于:OpenHarmony 3.2 Beta5 API 9 Stage模型 + +**问题现象** + +使用Text组件时,无法将文本排列方向设置为竖向排列。 + +**解决措施** + +Text组件当前文本排列方向固定为横向排列,要设置为竖向排列,可将文件拆分,使用Flex容器组件装填,设置主轴方向为竖向。 + +**代码示例** + +``` +@Entry +@Component +struct Index15 { + private message: string = '本文档适用于HarmonyOS应用开发的初学者。通过构建一个简单的具有页面跳转/返回功能的应用,快速了解工程目录的主要文件,熟悉HarmonyOS应用开发流程。'; + build() { + Flex({ direction: FlexDirection.Column, wrap: FlexWrap.Wrap }) { + ForEach(this.message.split(''), (item, index) => { + Text(item) + .fontSize(30) + .flexShrink(0) + }) + } + } +} +``` + +## 如何创建Toast窗口 + +适用于:OpenHarmony 3.2 Beta5 API 9 Stage模型 + +**问题现象** + +应用做弱提示时,需要采用Toast窗口。 + +**解决措施** + +可使用系统提供的@ohos.promptAction接口创建Toast窗口。 + +**参考链接** + +[@ohos.promptAction \(弹窗\)](../reference/apis/js-apis-promptAction.md) + +## Toast弹窗是否支持自定义背景或者字体颜色 + +适用于 OpenHarmony 3.2 Beta5 API 9 Stage模型 + +当前版本不支持Toast弹窗自定义背景和字体颜色。 + +**参考链接** + +[@ohos.promptAction \(弹窗\)](../reference/apis/js-apis-promptAction.md) + +## 如何将Ability的UI界面设置成透明 + +适用于:OpenHarmony SDK 3.2,API9 + +**问题现象** + +如何设置Ability的UI界面为透明 + +**解决措施** + +将最上层容器组件背景色设置为透明,然后通过设置XComponent组件的opacity属性值为0.01来实现。 + +示例: + +``` +build() { + Stack() { + XComponent({ + id: 'componentId', + type: 'surface', + }) + .width('100%') + .height('100%') + .opacity(0.01) + // 页面内容 + } + .width('100%') + .height('100%') + .backgroundColor('rgba(255,255,255, 0)') +} +``` + +## constraintSize尺寸设置不生效 + +适用于:Openharmony 3.2 Beta5 API 9 stage模型 + +**问题现象** + +constraintSize约束组件尺寸时,子组件内设置百分比宽度,例如width\('100%'\)会采用constraintSize约束中的最大宽乘百分比,导致撑开组件,看起来constraintSize设置没生效。 + +**解决措施** + +可以在外层使用Scroll组件,设置constraintSize,当子组件占用空间超过设置的约束值时,会显示滚动条。 + +## 如何将背景颜色设置为透明 + +适用于:OpenHarmony 3.2 Beta5 API 9 + +**解决措施** + +将backgroundColor设置为 '\#00000000'。 + +## Scroll组件滚动到达不了最底部 + +适用于:OpenHarmony 3.2 Beta5 API 9 Stage模型 + +**问题现象** + +Scroll组件在未设置高度情况下,默认为窗口高度,当滚动区域外存在其他组件时,滚动底部区域会出现遮挡。 + +**解决措施** + +Scroll组件需要设置Scroll高度,或者使用Flex布局限制Scroll高度。 + +## backgroundImage如何设置CenterCrop + +适用于:OpenHarmony 3.2 Beta5 API 9 Stage模型 + +**问题现象** + +CenterCrop是android中imageView,scaletype的设置,主要保证图片等比缩放裁剪,位置保持居中,要达到相同效果,应该怎么处理? + +**解决措施** + +可以使用通用属性backgroundImageSize\(ImageSize.cover\)和backgroundImagePosition\(Alignment.Center\)达到相同效果。 + +## 如何自定义Video组件控制栏样式 + +适用于:OpenHarmony 3.2 Beta5 API 9 Stage模型 + +**解决措施** + +1. 通过设置属性controls为false关闭默认控制栏。 + +2. 设置Video组件的controller。 + +3. 通过ArkTS实现自定义的控制栏,并通过VideoController控制视频播放。 + +**代码示例** + +``` +// xxx.ets +@Entry@Componentstruct VideoCreateComponent { + @State videoSrc: Resource = $rawfile('video1.mp4') + @State previewUri: Resource = $r('app.media.poster1') + @State curRate: PlaybackSpeed = PlaybackSpeed.Speed_Forward_1_00_X + @State isAutoPlay: boolean = false + @State showControls: boolean = true + controller: VideoController = new VideoController() + build() { + Column() { + Video({ + src: this.videoSrc, + previewUri: this.previewUri, + currentProgressRate: this.curRate, + controller: this.controller + }).width('100%').height(600) + .autoPlay(this.isAutoPlay) + .controls(this.showControls) + .onStart(() => { + console.info('onStart') + }) + .onPause(() => { + console.info('onPause') + }) + .onFinish(() => { + console.info('onFinish') + }) + .onError(() => { + console.info('onError') + }) + .onPrepared((e) => { + console.info('onPrepared is ' + e.duration) + }) + .onSeeking((e) => { + console.info('onSeeking is ' + e.time) + }) + .onSeeked((e) => { + console.info('onSeeked is ' + e.time) + }) + .onUpdate((e) => { + console.info('onUpdate is ' + e.time) + }) + Row() { + Button('src').onClick(() => { + this.videoSrc = $rawfile('video2.mp4') // 切换视频源 + }).margin(5) + Button('previewUri').onClick(() => { + this.previewUri = $r('app.media.poster2') // 切换视频预览海报 + }).margin(5) + + Button('controls').onClick(() => { + this.showControls = !this.showControls // 切换是否显示视频控制栏 + }).margin(5) + } + Row() { + Button('start').onClick(() => { + this.controller.start() // 开始播放 + }).margin(5) + Button('pause').onClick(() => { + this.controller.pause() // 暂停播放 + }).margin(5) + Button('stop').onClick(() => { + this.controller.stop() // 结束播放 + }).margin(5) + Button('setTime').onClick(() => { + this.controller.setCurrentTime(10, SeekMode.Accurate) // 精准跳转到视频的10s位置 + }).margin(5) + } + Row() { + Button('rate 0.75').onClick(() => { + this.curRate = PlaybackSpeed.Speed_Forward_0_75_X // 0.75倍速播放 + }).margin(5) + Button('rate 1').onClick(() => { + this.curRate = PlaybackSpeed.Speed_Forward_1_00_X // 原倍速播放 + }).margin(5) + Button('rate 2').onClick(() => { + this.curRate = PlaybackSpeed.Speed_Forward_2_00_X // 2倍速播放 + }).margin(5) + } + } + }} +``` + +**参考链接** + +[Video](../reference/arkui-ts/ts-media-components-video.md#start) + +## 如何设置组件不同状态下的样式 + +**问题现象** + +对应组件的不同状态(如无状态、按下、禁用、聚焦、点击),显示不同的样式。 + +**解决措施** + +使用多态样式,在组件的StateStyles接口中,定义组件不同状态下的样式。 + +**代码示例** + +``` +//xxx.ts +@Entry +@Component +struct StyleExample { + @State isEnable: boolean = true; + + @Styles pressedStyles() { + .backgroundColor("#ED6F21") + .borderRadius(10) + .borderStyle(BorderStyle.Dashed) + .borderWidth(2) + .borderColor('#33000000') + .width(120) + .height(30) + .opacity(1) + } + build() { + Flex({direction: FlexDirection.Column, alignItems: ItemAlign.Center}) { + Text("pressed") + .backgroundColor('#0A59F7') + .borderRadius(20) + .borderStyle(BorderStyle.Dotted) + .borderWidth(2) + .borderColor(Color.Red) + .width(100) + .height(25) + .opacity(1) + .fontSize(14) + .fontColor(Color.White) + .stateStyles({ + pressed: this.pressedStyles + }) + .margin({ + bottom: 20 + }) + .textAlign(TextAlign.Center) + } + .width(350) + .height(300) + } +} +``` + +**参考链接** + +[多态样式](../reference/arkui-ts/ts-universal-attributes-polymorphic-style.md) + +## Scroll内Flex加宽高与滑动冲突 + +适用于:OpenHarmony 3.2 Beta5 API 9 Stage模型 + +**问题现象** + +当在Scroll组件中添加容器组件,并设置该容器组件的尺寸时,会破坏滚动布局。 + +**解决措施** + +Scroll组件中的容器组件不设置尺寸,大小由内容撑开。 + +## ArkTS使用position之后height不生效 + +适用于 OpenHarmony 3.2 Beta5 API 9 + +**问题现象** + +ArkTS使用position之后height不生效 + +**解决措施** + +容器组件在使用position之后会脱离文本流,导致容器脱离外层容器束缚,导致height不生效,可以将外层容器换成Stack可以解决这个问题。 + +## 焦点事件onBlur/onFocus回调无法触发 + +适用于 OpenHarmony 3.2 Beta5 API 9 + +**问题现象** + +焦点事件onBlur/onFocus回调无法触发 + +**解决措施** + +焦点事件默认情况下需要外接键盘的Tab键,或方向键触发,点击触发焦点事件需要添加焦点控制属性focusOnTouch。 + +**参考链接** + +[焦点控制](../reference/arkui-ts/ts-universal-attributes-focus.md) + +## scroll里面套一个grid,怎么禁用grid的滑动事件 + +适用于 OpenHarmony 3.2 Beta5 API 9 + +可以通过onScrollFrameBegin事件和scrollBy方法实现容器嵌套滚动。 + +可参考:[容器嵌套滚动样例](../reference/arkui-ts/ts-container-scroll.md#示例2) + +## 如何实现一个组件不停地旋转 + +适用于 OpenHarmony 3.2 Beta5 API 9 + +可以通过[属性动画](../reference/arkui-ts/ts-animatorproperty.md)的方式实现。 + +## 列表目前无法键盘上下滑动,是否能力不支持 + +适用于 OpenHarmony 3.2 Beta5 API 9 + +**问题现象** + +列表目前无法键盘上下滑动,是否能力不支持 + +**解决措施** + +有以下两种方案: + +1. 需要在列表子项中添加focusable\(true\)进行获焦。 +2. 在每个item的外层嵌套一个可获焦组件,例如Button。 + +## 键盘移动焦点对象按下enter,为什么不会触发点击事件? + +适用于 OpenHarmony 3.2 Beta5 API 9 + +组件的内置的点击事件和开发者自定义的onClick点击事件默认会和空格键绑定,并非与enter键绑定(UX规格) + +## 多层组件嵌套button,如何阻止事件传递 + +适用于 OpenHarmony 3.2 Beta5 API 9 + +可以通过将button组件绑定参数stopPropagation来控制冒泡传递。 + +## ArkUI如何通过代码动态创建组件 + +适用于:OpenHarmony 3.2 Beta5 API 9 + +**解决措施** + +ArkUI使用ArkTS声明式开发范式,开发者无法持有组件实例,在声明时通过渲染控制语法以及动态构建UI元素的方式,控制组件的创建。 + +**代码示例** + +``` +// 条件渲染语句创建组件 +if(this.isTrue) { + Text("创建文本组件").fontSize(30) +} +// 循环渲染语句创建组件 +ForEach(this.nums,(item) => { + Text(item + '').fontSize(30) +},item => JSON.stringify(item)) +``` + +**参考链接** + +[渲染控制语法](../quick-start/arkts-rendering-control-overview.md) + +## 使用@Builder装饰器包含自定义组件的方法与普通方法的区别是什么 + +适用于:OpenHarmony 3.2 Beta5 API 9 + +**解决措施** + +@Builder装饰的方法中使用了自定义组件,那么该方法每次被调用时,对应的自定义组件均会重新创建,普通方法中不使用@builder装饰,无法容纳自定义组件。 + +**参考链接** + +[@BuilderParam](../quick-start/arkts-builderparam.md) + +## 如何使用@BuilderParam装饰器进行组件传参 + +适用于:OpenHarmony 3.2 Beta5 API 9 + +**解决措施** + +- 不带参数 + + 对@BuilderParam修饰的属性进行赋值时不带参数(如:content: this.specificParam),则此属性的类型需定义成无返回值的函数(如:@BuilderParam content: \(\) =\> void)。 + +- 带参数 + + 对@BuilderParam修饰的属性进行赋值时带参数(如:callContent: this.specificParam1\("111"\)),则此属性的类型需定义成any(如:@BuilderParam callContent: any)。 + + +**参考链接** + +[@BuilderParam](../quick-start/arkts-builderparam.md) + +## 如何监听数组内对象属性变化 + +适用于:OpenHarmony 3.2 Beta5 API9 + +**问题现象** + +数组内存储对象示例,需要对对象的属性变化进行监听。 + +**解决措施** + +通过@Observed配合@ObjectLink装饰符实现。@Observed用于类,@ObjectLink用于变量。 + +**代码示例** + +1. 在类上使用@Observed。 + + ``` + @Observed + class ClassA { + public name: string + public c: number + public id: number + + constructor(c: number, name: string = 'OK') { + this.name = name + this.c = c + } + } + ``` + +2. 在组件变量使用@ObjectLink。 + + ``` + @Component + struct ViewA { + label: string = 'ViewA1' + @ObjectLink a: ClassA + + build() { + Row() { + Button(`ViewA [${this.label}] this.a.c= ${this.a.c} +1`) + .onClick(() => { + this.a.c += 1 + }) + }.margin({ top: 10 }) + } + } + ``` + + +**参考链接** + +[Observed和ObjectLink数据管理](../quick-start/arkts-observed-and-objectlink.md) + +## 子组件使用@Link修饰成员变量时,如何通过父组件传值 + +适用于:OpenHarmony 3.2 Beta5 API 9 + +**解决措施** + +子组件使用@Link接受父组件的值时,需要使用'\$'建立变量之间的引用关系。才能实现同步。 + +**代码示例** + +@Link语义是从`$`操作符引出,即\$isPlaying是this.isPlaying内部状态的双向数据绑定。当单击子组件PlayButton中的按钮时,@Link变量更改,PlayButton与父组件中的Text和Button将同时进行刷新,同样地,当点击父组件中的Button修改this.isPlaying时,子组件PlayButton与父组件中的Text和Button也将同时刷新。 + +1. 在父组件使用@State装饰器,传递数据使用\$符创建引用。 + + ``` + @Entry + @Component + struct Player { + @State isPlaying: boolean = false + build() { + Column() { + PlayButton({ buttonPlaying: $isPlaying }) + Text(`Player is ${this.isPlaying ? '' : 'not'} playing`).fontSize(18) + Button('Parent:' + this.isPlaying) + .margin(15) + .onClick(() => { + this.isPlaying = !this.isPlaying + }) + } + } + } + + + ``` + +2. 在子组件使用@Link接受数据。 + + ``` + @Component + struct PlayButton { + @Link buttonPlaying: boolean + + build() { + Column() { + Button(this.buttonPlaying ? 'pause' : 'play') + .margin(20) + .onClick(() => { + this.buttonPlaying = !this.buttonPlaying + }) + } + } + } + ``` + + +**参考链接** + +[@Link](../quick-start/arkts-link.md) + +## 父组件如何与孙子组件进行状态同步 + +适用于:OpenHarmony 3.2 Beta5 API 9 + +**解决措施** + +- 方式一(推荐):使用@Provide和@Consume装饰器。在父组件使用@Provide,在孙子组件使用@Consume,可以实现父组件和孙子组件进行双向数据绑定。 + +- 方式二:使用@State和@Link装饰器。在父组件使用@State,在每一层子组件(子组件和孙子组件)都使用@Link。 + +**代码示例一** + +1. 父组件中使用子组件,通过Provide提供reviewVote参数,供跨级传递给孙子组件。 + + ``` + @Entry + @Component + struct Father{ + @Provide("reviewVote") reviewVotes: number = 0; + + build() { + Column() { + Son() + Button(`Father: ${this.reviewVotes}`) + ... + } + } + } + ``` + +2. 子组件中使用孙组件。 + + ``` + @Component + struct Son{ + build() { + Column() { + GrandSon() + } + } + } + ``` + +3. 孙子组件中使用Consume来接受reviewVote的参数。 + + ``` + @Component + struct GrandSon{ + @Consume("reviewVote") reviewVotes: number + + build() { + Column() { + Button(`GrandSon: ${this.reviewVotes}`) + ... + }.width('100%') + } + } + ``` + + +**代码示例二** + +1. 父组件Father使用@State绑定数据reviewVote。 + + ``` + @Entry + @Component + struct Father { + @State reviewVotes: number = 0; + + build() { + Column() { + Son({reviewVotes:$reviewVotes}) + Button(`Father: ${this.reviewVotes}`) + ... + } + } + } + ``` + +2. 子组件Son中使用@Link接受由父组件Father传递的参数reviewVote。 + + ``` + @Component + struct Son{ + @Link reviewVotes: number; + build() { + Column() { + Grandson({reviewVotes:$reviewVotes}) + } + } + } + + + ``` + +3. 孙子组件GrandSon使用@Link接受由Son组件传递的参数reviewVote。 + + ``` + @Component + struct Grandson{ + @Link reviewVotes: number; + + build() { + Column() { + Button(`Grandson: ${this.reviewVotes}`) + ... + }.width('100%') + } + } + ``` + + +## Js如何定义callback函数 + +适用于:OpenHarmony 3.2 Beta5 API 9 + +**解决措施** + +定义个callback函数的样例,**示例如下:** + +1. 定义回调函数 + + ``` + // 页面中定义个2个参数,空返回的callback函数 + myCallback: (a:number,b:string) => void + ``` + +2. 在使用时进行初始化赋值 + + ``` + aboutToAppear() { + // callback函数初始化 + this.myCallback= (a,b)=>{ + console.info(`handle myCallback a=${a},b=${b}`) + }} + ``` + + +## 组件需要多次更新时如何优化性能 + +适用于:OpenHarmony 3.2 Beta5 API 9 + +**解决措施** + +使用状态管理模块,目前已经支持最小化更新,当数据依赖变化时,不再是重新刷新整个自定义组件,而是只更新依赖数据的视图内容。 + +## 对象中函数的this如何指向外层 + +适用于:Openharmony 3.2 Beta5 API 9 + +**解决措施** + +通过箭头函数实现。 + +**代码示例** + +``` +const obj = { + start:() => { + return this.num + } +} +``` + +## 如何实现页面加载前从接口获取数据 + +适用于:Openharmony 3.2 Beta5 API 9 + +**问题现象** + +页面生命周期相关问题,在页面渲染前从接口获取数据,渲染时将数据渲染到页面上。 + +**解决措施** + +在声明周期函数aboutToAppear中使用异步接口获取页面数据,数据变量使用@State修饰,数据获取完成后根据变量自动刷新页面。 + +**代码示例** + +``` +@Entry +@Component +struct Test6Page { + // 数据获取成功,会自动刷新页面 + @State message: string = 'loading.....' + aboutToAppear(){ + // 模拟异步接口获取数据 + setTimeout(()=>{ + this.message = 'new msg' + },3000) + } + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('100%') + } +} +``` + +## Stage模型资源配置文件string.json是否支持配置占位符 + +适用于:Openharmony 3.2 Beta5 API 9 + +资源配置文件string.json文件本身不支持配置占位符,可以在对应的页面中通过定义变量,在实际组件使用Resources和变量拼接的方式达到实现占位符的同等效果。 + +## eTS文件和ts文件的区别 + +适用于:Openharmony 3.2 Beta5 API 9 + +**解决措施** + +ArkTS基于兼容了TS语法,继承了TS的所有特性,当前,ArkTS在TS的基础上主要扩展了声明式UI能力,让开发者能够以更简洁、更自然的方式开发高性能应用。推荐用ArtTS开发UI相关内容,TS可以用来开发业务逻辑相关内容。 + +**参考链接** + +[初识ArkTS](../quick-start/arkts-get-started.md) + +## ArkTS如何发送邮箱验证码 + +适用于:Openharmony 3.2 Beta5 API 9 + +**问题现象** + +ArkTS语言如何给邮箱发送邮箱验证码?用哪个接口? + +**解决措施** + +发送验证码需要请求服务端,然后服务端调用对应的短信验证码接口来实现该功能。可以通过短信服务实现相关功能。 + +## 如何将传感器的数据实时显示在UI的Text中 + +适用于:Openharmony 3.2 Beta5 API9 + +**问题现象** + +ArkUI(ets)如何将传感器的数据实时显示在UI的Text中。 + +**解决措施** + +传感器返回数据类型为double,可将double转为string,再显示在text中。 + +## 如何监听屏幕旋转 + +适用于:Openharmony 3.2 Beta5 API 9 + +**问题现象** + +应用想监听屏幕是否进行旋转操作。 + +**解决措施** + +屏幕旋转可使用媒体查询接口进行监听。 + +``` +import mediaquery from '@ohos.mediaquery' +let listener = mediaquery.matchMediaSync('(orientation: landscape)'); //监听横屏事件 +function onPortrait(mediaQueryResult) { + if (mediaQueryResult.matches) { + // do something here + } else { + // do something here + } +} +listener.on('change', onPortrait) // 注册回调 +listener.off('change', onPortrait) // 去注册回调 +``` + +**参考链接** + +[媒体查询](../reference/apis/js-apis-mediaquery.md) + +## DevEco Studio 升级到最新后ForEach不能遍历全部数据 + +适用于:Openharmony 3.2 Beta5 API 9 + +**问题现象** + +升级DevEco Studio后,ForEach无法遍历全部数据。 + +**解决措施** + +forEach\(\)功能进行了增强,其第三个参数keyGenerator如果传入参数时,需要确保数据源array中的每个元素生成的key不同,才能正常遍历。如果生成的key相同,则只能生成一个。 + +该第三个参数也可以不传,系统采用默认生成方式,也可以正常遍历出全部元素。 + +## 创建的单例换了页面后不生效问题 + +适用于:Openharmony 3.2 Beta5 API 9 + +**问题现象** + +单例只有在同一个流程中才有效,换了页面后之前的实例都全是undefined。 + +**解决措施** + +对于每个Page都会生成一个js文件,定义的单例会在每个js中都生成一份,所以单例的作用范围只是Page的范围。 + +如果想共享一个实例,创建范围需要提升至UIAbility或者App级别。 + +## 如何将时间格式的字符串string转换为Date对象 + +适用于:Openharmony 3.2 Beta5 API 9 + +**解决措施** + +如果字符string满足格式“yyyy-MM-dd”格式,则可直接使用函数new Date\("yyyy-MM-dd"\)来获取对应的Date对象。 + +``` +new Date("2021-05-23"); +new Date("2020/2/29"); +new Date("2020-14-03"); +new Date("14-02-2021"); +``` + +其他格式字符串可使用new Date\(year:number,month:number,day?:number,hour?:number,mintue?:number,second?:number,ms?:number\)方法来获取Date对象。 + +``` +根据参数创建日期的语法: +new Date(yearValue, IndexOfMonth, dayValue, hours, minutes, seconds) +``` + +其中每一个参数换算为对应时间参数传入即可。 + +- yearValue:应符合 ISO 8061 YYYY 格式。例如 2021。如果我们以 YY 格式指定一个值,它将会被错误地接受。例如,仅将 2021 提到 21 会被认为是 1921 年而不是 2021 年。 +- IndexOfMonth:从索引 0 开始。因此,从 Month 值中减去 1。例如,对于 3 月,该值为 3,但 monthIndex 将为 2(即 3-1 = 2)。本月指数通常应在 0-11 范围内 +- dayValue:表示一个月中的某天。它应在 1-31 范围内,具体取决于一个月中的天数。例如:对于 21-05-2021,日期值为 21 +- hours:一天中的小时。例如 10 点。 +- minutes:过去一个小时的分钟数 +- seconds:保留超过一分钟的秒数。 + +## ArkTS如何把string转为byte数组 + +适用于:Openharmony 3.2 Beta5 API 9 + +**解决措施** + +参考如下代码实现,示例: + +``` +stringToArray(str:string) { + var arr = []; + for(var i = 0,j = str.length;i { + /* 原数据,GBK编码 + + + xxxxx + xxxx + xxxx + + + xxxx + + + + xxxx + + + 1 + For Outsourcing Staff/xxxx + + xxxx + xxxx + + + */ + let src = 'PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iR0JLIj8+CjxkYXRhPgo8YXNzZXRfbm8+eHh4eHg8L2Fzc2V0X25vPgo8bWFjaGluZV9zbj54eHh4PC9tYWNoaW5lX3NuPgo8Ymlvc19pZD54eHh4PC9iaW9zX2lkPgo8cmVzcG9uc2libGVfZW1wX25hbWU+PCFbQ0RBVEFbeHh4eF1dPjwvcmVzcG9uc2libGVfZW1wX25hbWU+CjxyZXNwb25zaWJsZV9hY2NvdW50PjwhW0NEQVRBW3h4eHggeHh4eF1dPjwvcmVzcG9uc2libGVfYWNjb3VudD4KPHJlc3BvbnNpYmxlX2VtcF9ubz54eHh4PC9yZXNwb25zaWJsZV9lbXBfbm8+CjxyZXNwb25zaWJsZV9kZXB0PjwhW0NEQVRBW3h4eHhdXT48L3Jlc3BvbnNpYmxlX2RlcHQ+Cjx1c2VyX2RlcHQ+PCFbQ0RBVEFbeHh4eF1dPjwvdXNlcl9kZXB0Pgo8dXNlcl9uYW1lPjwhW0NEQVRBW3h4eF1dPjwvdXNlcl9uYW1lPgo8Y3VyX2RvbWFpbl9hY2NvdW50Pnh4eHg8L2N1cl9kb21haW5fYWNjb3VudD4KPGFzc2V0X2xvYz48IVtDREFUQVstLV1dPjwvYXNzZXRfbG9jPgo8YXNzZXRfbG9jX2N1cj48IVtDREFUQVtdXT48L2Fzc2V0X2xvY19jdXI+Cjxhc3NldF90eXBlPjE8L2Fzc2V0X3R5cGU+Cjxhc3NldF91c2U+Rm9yIE91dHNvdXJjaW5nIFN0YWZmL3h4eHg8L2Fzc2V0X3VzZT4KPG92ZXJkdWVfZGF0ZT48L292ZXJkdWVfZGF0ZT4KPGFzc2V0X3N0YXR1cz54eHh4PC9hc3NldF9zdGF0dXM+Cjxhc3NldF9wZXJpb2Q+eHh4eDwvYXNzZXRfcGVyaW9kPgo8bGljZW5zZT48L2xpY2Vuc2U+CjwvZGF0YT4=' + let base64 = new util.Base64Helper(); + // base解码 + let src_uint8Array = base64.decodeSync(src); + // 解码为utf-8的字符串 + let textDecoder = util.TextDecoder.create("utf-8",{ignoreBOM: true}) + let src_str = textDecoder.decodeWithStream(src_uint8Array) + //替换encoding字段 + src_str = src_str.replace("GBK","utf-8") + console.log('Test src_str: ' + JSON.stringify(src_str)); + // 转换 xml-> json + 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"} + let src_json = JSON.stringify(conv.convertToJSObject(src_str, options)); + console.log('Test json: ' + JSON.stringify(src_json)); + }) + } + .width('100%') + } + .height('100%') + } +} +``` + +## 通过try/catch语句获取到错误码401是什么意思 + +适用于:Openharmony 3.2 Beta5 API 9 + +**问题原因** + +1. 必选参数没有传入。 + +2. 参数类型错误。 + +3. 参数为undefined。 + +**参考链接** + +[通用错误码](../reference/errorcodes/errorcode-universal.md) diff --git a/zh-cn/application-dev/faqs/faqs-bundle-management.md b/zh-cn/application-dev/faqs/faqs-bundle-management.md new file mode 100644 index 0000000000000000000000000000000000000000..70d2dd7518b5674b41fb40d8e6c09945e3cb4bb5 --- /dev/null +++ b/zh-cn/application-dev/faqs/faqs-bundle-management.md @@ -0,0 +1,126 @@ +# 包管理开发常见问题 + +## 如何判断某个应用是否为系统应用 + +适用于OpenHarmony 3.2 Beta5 API 9 + +**解决措施** + +使用bundleManager模块的getApplicationInfo接口(仅系统应用可以使用)获取待检验应用的ApplicaitonInfo,根据ApplicaitonInfo中systemApp字段判断,若为true,则是系统应用,否则为非系统应用。 + +**参考链接** + +[bundleManager模块](../reference/apis/js-apis-bundleManager.md) + +## 如何获取应用配置的versionCode和versionName + +适用于:Openharmony 3.2 Beta5 API 9 + +**解决措施** + +首先通过@ohos.bundle.bundleManager模块bundleManager.getBundleInfoForSelf\(\)接口获取包信息BundleInfo,然后分别通过BundleInfo.versionCode、BundleInfo.versionName获取所需信息。 + +**代码示例** + +``` +import bundleManager from '@ohos.bundle.bundleManager'; +import hilog from '@ohos.hilog'; +let bundleFlags = bundleManager.BundleFlag.GET_BUNDLE_INFO_DEFAULT; +try { + bundleManager.getBundleInfoForSelf(bundleFlags).then((data) => { + const versionCode = data.versionCode; + const versionName = data.versionName; + hilog.info(0x0000, 'testTag', `successfully. versionCode: ${versionCode}, versionName: ${versionName}`); + }).catch(err => { + hilog.error(0x0000, 'testTag', 'failed. Cause: %{public}s', err.message); + }); +} catch (err) { + hilog.error(0x0000, 'testTag', 'failed: %{public}s', err.message); +} +``` + +**参考链接** + +[getBundleInfoForSelf](../reference/apis/js-apis-bundleManager.md#bundlemanagergetbundleinfoforself) + +## 如何获取应用自身的bundleName + +适用于:Openharmony 3.2 Beta5 API9 + +**解决措施** + +可以通过UIAbilityContext.abilityInfo.bundleName获取。 + +**代码示例** + +``` +import common from '@ohos.app.ability.common'; +const context = getContext(this) as common.UIAbilityContext +console.log(`bundleName: ${context.abilityInfo.bundleName}`) +``` + +**参考链接** + +[UIAbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontext)、[AbilityInfo](../reference/apis/js-apis-bundleManager-abilityInfo.md#abilityinfo) + +## 如何获取App版本号,版本名,屏幕分辨率等信息 + +适用于:OpenHarmony 3.2 Beta5 + +**解决措施** + +1. 通过@ohos.bundle.bundleManager模块中的bundleManager查询bundleInfo。 + + 在bundleInfo中包含App版本号、版本名信息。 + + ``` + import bundleManager from '@ohos.bundle.bundleManager'; + ... + bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION).then((bundleInfo)=>{ + let versionName = bundleInfo.versionName;//应用版本名 + let versionNo = bundleInfo.versionCode;//应用版本号 + }).catch((error)=>{ + console.error("get bundleInfo failed,error is "+error) + }) + ``` + +2. 在模块@ohos.app.ability.Configuration中获取screenDensity,其中包含屏幕分辨率信息。 + + ``` + import common from '@ohos.app.ability.common'; + ... + let context = getContext(this) as common.UIAbilityContext; + let screenDensity = context.config.screenDensity; + ``` + + +## 如何获取应用自身的源文件路径 + +适用于:OpenHarmony 3.2 Beta5 API 9 + +**解决措施** + +- 方式一:使用应用上下文context获取。 + + ``` + this.uiAbilityContext.abilityInfo.applicationInfo.codePath + ``` + +- 方式二:使用@ohos.bundle.bundleManager获取。 + + 1. 导入@ohos.bundle.bundleManager模块,使用bundleManager.getBundleInfoForSelf\(\)获取bundleInfo信息。 + 2. 使用bundleInfo.appInfo.codePath获取应用源文件路径。 + + ``` + import bundleManager from '@ohos.bundle.bundleManager'; + bundleManager.getBundleInfoForSelf(bundleManager.BundleFlag.GET_BUNDLE_INFO_WITH_APPLICATION).then((bundleInfo)=>{ + this.sourcePath = bundleInfo.appInfo.codePath; + }) + ``` + + +## 能否在本应用中获取到其他应用的HAP包信息 + +适用于:OpenHarmony 3.2 Beta API 9 + +根据OpenHarmony的安全设计规范,SDK不提供接口能力给三方应用查询其他应用的包信息(包括但不限于应用名称、版本号等)。 diff --git a/zh-cn/application-dev/faqs/faqs-bundle.md b/zh-cn/application-dev/faqs/faqs-bundle.md deleted file mode 100644 index 357149d365e3d2ac59aae11414f0fc26d5c77610..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/faqs/faqs-bundle.md +++ /dev/null @@ -1,31 +0,0 @@ -# 应用程序包管理开发常见问题 - -## 如何获取应用配置的versionCode和versionName - -适用于:OpenHarmony SDK 3.2.3.5版本,API9 Stage模型 - -通过@ohos.bundle模块bundle.getBundleInfo()接口获取包信息bundleInfo,然后分别通过bundleInfo.versionCode、bundleInfo.versionName - -参考文档:[Bundle模块](../reference/apis/js-apis-Bundle.md#bundlegetbundleinfo) - -## 如何获取应用自身的bundleName - -适用于:OpenHarmony SDK 3.2.3.5版本,API9 Stage模型 - -通过可以context.abilityInfo.bundleName获取。 - -参考文档:[AbilityContext](../reference/apis/js-apis-ability-context.md)、[AbilityInfo](../reference/apis/js-apis-bundle-AbilityInfo.md) - -## 如何获取应用图标 - -适用于:OpenHarmony SDK 3.2.3.5版本,API9 Stage模型 - -通过\@ohos.bundle模块 getAbilityIcon 接口获取,需要配置权限:ohos.permission.GET_BUNDLE_INFO。 - -参考文档:[Bundle模块](../reference/apis/js-apis-Bundle.md#bundlegetbundleinfo) - -## 如何判断某个应用是否为系统应用 - -使用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 - -使用bundle模块的getApplicationInfo接口获取待检验的应用的ApplicationInfo,根据ApplicationInfo中systemApp字段判断,若为true,则是系统应用,否则为非系统应用。 diff --git a/zh-cn/application-dev/faqs/faqs-connectivity.md b/zh-cn/application-dev/faqs/faqs-connectivity.md deleted file mode 100644 index 4da4a413145026fd5cea550b5df8fad8ee904644..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/faqs/faqs-connectivity.md +++ /dev/null @@ -1,104 +0,0 @@ -# 网络与连接开发常见问题 - -## 网络请求中extraData支持哪几种的数据格式 - -适用于:OpenHarmony SDK 3.2.2.5版本, API9 Stage模型 - -extraData代表发送请求的额外数据,支持如下数据: - -1. 当HTTP请求为POST、PUT方法时,此字段为HTTP请求的content。 - -2. 当HTTP请求为GET、OPTIONS、DELETE、TRACE、CONNECT方法时,此字段为HTTP请求的参数补充,参数内容会拼接到URL中进行发送。 - -3. 开发者传入string对象,开发者需要自行编码,将编码后的string传入。 - -## 如何理解http请求的错误码28 - -适用于:OpenHarmony SDK 3.2.2.5版本,API9 Stage模型 - -错误码28代表CURLE_OPERATION_TIMEDOUT,操作超时。网络请求底层使用libcurl库,更多错误码可以查看相应文档。 - -参考文档:[Response常用错误码](../reference/apis/js-apis-http.md#response常用错误码)和[Curl错误码](https://curl.se/libcurl/c/libcurl-errors.html) - -## \@ohos.net.http.d.ts的response错误码返回6是什么意思? - -适用于:OpenHarmony SDK 3.2.3.5版本 - -6表示地址无法解析主机,可以尝试ping一下request中的url,确认是否可以ping通。 - -更多错误码参考[Response常用错误码](../reference/apis/js-apis-http.md#response常用错误码)或者[Curl错误码](https://curl.se/libcurl/c/libcurl-errors.html) - -## 调用camera拍摄的照片怎么上传到服务器 - -适用于:所有版本 - -具体开发参考文档:[上传下载](https://gitee.com/openharmony/app_samples/tree/master/Network/UploadDownload) - -## OpenHarmony的http接口如何设置cookie - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -HttpRequestOptions中的header是一个Object类型,可以直接在header里设置cookie,具体开发参考文档:[数据请求](../reference/apis/js-apis-http.md#request)。 - -## http请求的官方示例代码里的extra data部分怎么写 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -1. 鼠标移到extraData, ctrl+鼠标左键,跳转到sdk中,里面有关于extraData的传参说明。可以发现文档中对extraData的定义为 extraData?: string | Object,也就是extraData支持string 和 Object两种类型。 - -2. 这两种写法都可以实现: - a.extraData:"data to send"; - b. extraData:{ data:"data to send", }, - -## 设备连接wifi后,如何获取当前设备的IP地址 - -适用于:OpenHarmony SDK 3.2.7.5版本,API9 Stage模型 - -使用wifi模块获取ipInfo,然后转换为IP常用格式,注意wifi.getIpInfo()接口需要权限 ohos.permission.GET_WIFI_INFO。 - -示例: - - -``` -import wifi from '@ohos.wifi' -@Entry -@Component -struct Page { - @State ip: string = '点击获取ip' - - resolveIP(ip) { - if (ip < 0 || ip > 0xFFFFFFFF) { - throw ("The number is not normal!"); - } - return (ip >>> 24) + "." + (ip >> 16 & 0xFF) + "." + (ip >> 8 & 0xFF) + "." + (ip & 0xFF); - } - - build() { - Row() { - Column() { - Text(this.ip) - .fontSize(50) - .fontWeight(FontWeight.Bold) - .onClick(()=>{ - this.ip = this.resolveIP(wifi.getIpInfo().ipAddress) - }) - } - .width('100%') - } - .height('100%') - } -} -``` - -## 如何判断当前是否有网络 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -通过如下hasDefaultNet接口判断是否有网络,注意需要申请 ohos.permission.GET_NETWORK_INFO 权限 - - -``` -connection.hasDefaultNet().then((has)=> { - console.log("hasDefaultNet " + JSON.stringify(has)) -}) -``` diff --git a/zh-cn/application-dev/faqs/faqs-data-management.md b/zh-cn/application-dev/faqs/faqs-data-management.md deleted file mode 100644 index 5b9e72b2dbd4af5dc6748bd6053e923de7f7a4c2..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/faqs/faqs-data-management.md +++ /dev/null @@ -1,72 +0,0 @@ -# 数据管理开发常见问题 - -## 如何将PixelMap的数据存储到数据库中 - -适用于:OpenHarmony SDK 3.2.3.5版本 - -PixelMap应该被转换成相应的ArrayBuffer再放进数据库。 - -参考文档:[readPixelsToBuffer](../reference/apis/js-apis-image.md#readpixelstobuffer7-1) - -## 如何获取rdb关系型数据库文件 - -适用于:OpenHarmony SDK 3.2.3.5版本,API9 Stage模型 - -开发者可使用hdc_std命令拷贝文件,其中文件路径为: /data/app/el2/100/database/包名/entry/db/ ,然后拷贝该路径下后缀为 .db、.db-shm、.db-wal的文件,拷贝完成后,可以通过SQLite工具打开该数据库文件。 - -示例: - -``` - hdc_std file recv /data/app/el2/100/database/com.xxxx.xxxx/entry/db/test.db ./test.db -``` - -## 数据库在系统层面是否有锁机制,开发过程中是否需要关系数据库加锁问题 - -适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 - -系统提供的分布式数据服务、关系型数据库和首选项均有锁机制,开发者无需关注。 - -## 数据库中加事务与不加事务的区别? - -适用于:所有版本 - -在rdb中进行数据操作时,有可能会导致操作失败,出现意料之外的情况。当对数据库进行大量操作时,此种情况会导致部分数据操作失败,部分操作成功,导致部分数据丢失,可能会导致应用程序发生异常甚至崩溃。加事务后,则会将某一批操作组合成一个整体,要么同时成功,要么同时失败,则不会导致强关联的数据部分缺失的情况出现。 - -## 关系型数据库rdb支持哪些数据类型? - -适用于:OpenHarmony SDK 3.0版本以上,API9 Stage模型 - -关系型数据库rdb支持的数据类型有:number、string、boolean。其中number为数组类型,支持Double,Long,Float,Int,Int64,最大精度为十进制17位数字。 - -## 如何查看数据库db文件 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -1. 执行 hdc_std shell 命令进入系统 - -2. 找到绝对路径:/data/app/el2/<userId默认是100>/database/<bundleName> - 或找到沙箱路径: - - a. 执行 ps -ef | grep hapName 命令找到对应应用的进程ID, - - b. 数据库沙箱路径为:/proc/<应用进程ID>/root/data/storage/el2/database/。 - -3. 在数据库的绝对路径或者沙箱路径下执行 find ./ -name "\*.db" 即可找到数据库文件。 - -## 如何存储长文本数据 - -适用于:OpenHarmony SDK 3.2.5.5版本,API 9 - -- 首选项Preferences数据中的Value为string类型时最大支持8192字节。 - -- 分布式数据管理KV数据模型Value最大支持4M。 - -参考文档:[首选项概述](../database/database-preference-overview.md)、[分布式数据服务概述](../database/database-mdds-overview.md) - -## Stage模型数据共享DataShare开发 - -适用于:OpenHarmony SDK 3.2.5.5版本,API 9 - -Stage模型DataShare不可与FA模型DataAbility混用,连接的服务端应用需使用DataShareExtensionAbility实现。 - -参考文档:[数据共享开发指导](../database/database-datashare-guidelines.md) diff --git a/zh-cn/application-dev/faqs/faqs-development-board.md b/zh-cn/application-dev/faqs/faqs-development-board.md deleted file mode 100644 index 900ba10a82aabfa74029cecd45fe370f1464edc1..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/faqs/faqs-development-board.md +++ /dev/null @@ -1,49 +0,0 @@ -# 开发板使用常见问题 - -## 如何获取开发板上截屏图片? - -适用于:OpenHarmony SDK 3.2.2.5版本,API9 Stage模型 - -- 方法一:点击开发板下拉控制中心的截屏按钮,截屏图片通过相册可以查看。 - -- 方法二:通过截屏脚本一键截屏,可以在电脑上查看。操作方法:Windows上连接开发板,然后电脑上新建文本文件,拷贝如下脚本内容,文件名后缀改为.bat文件(需要提前配置好hdc的环境变量),点击运行后,截屏图片与脚本在同一目录。 - 示例: - - ``` - set filepath=/data/%date:~0,4%%date:~5,2%%date:~8,2%%time:~1,1%%time:~3,2%%time:~6,2%.png - echo %filepath% - : pause - hdc_std shell snapshot_display -f %filepath% - : pause - hdc_std file recv %filepath% . - : pause - ``` - -## RK3568板子和previewer上展示的效果差异较大,如何把previewer的尺寸调整成实际板子一样。 - -适用于:IDE 3.0.0.991 - -1. 给预览器新建Profile - - ![zh-cn_image_0000001361254285](figures/zh-cn_image_0000001361254285.png) - -2. 新建Profile的具体参数可参考如下配置: - Device type : default - - Resolution: 720\*1280 - - DPI: 240 - -## 开发板安装驱动后设备仍然无法识别,设备管理器错误识别为其他设备:FT232R USB UART () - -可能原因:开发版的USB串口驱动没有安装。 - -解决办法:搜索FT232R USB UART确定,下载安装驱动即可。 - -## 在开发板上登录需要认证网络如何进行认证 - -适用于:OpenHarmony SDK 3.2.2.5版本 - -连接需要认证的网络后,用浏览器打开任意网址就可以进入认证页面。 - -如果开发板上没有浏览器,可以安装[浏览器Sample应用](https://gitee.com/openharmony/app_samples/tree/master/device/Browser)。 diff --git a/zh-cn/application-dev/faqs/faqs-device-management.md b/zh-cn/application-dev/faqs/faqs-device-management.md deleted file mode 100644 index 9a62835d2c4ea2a6fa098c18efce5bd89e851b9c..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/faqs/faqs-device-management.md +++ /dev/null @@ -1,50 +0,0 @@ -# 设备管理开发常见问题 - -## 如何获取设备的dpi值 - -适用于:OpenHarmony SDK 3.2.2.5版本,API9 Stage模型 - -导入\@ohos.display包,通过getDefaultDisplay方法获取。 - -示例: - - -``` -import display from '@ohos.display'; -display.getDefaultDisplay((err, data) => { - if (err.code) { - console.error('Test Failed to obtain the default display object. Code: ' + JSON.stringify(err)); - return; - } - console.info('Test Succeeded in obtaining the default display object. Data:' + JSON.stringify(data)); - console.info('Test densityDPI:' + JSON.stringify(data.densityDPI)); -}); -``` - -## 如何获取当前运行设备类型 - -适用于:OpenHarmony SDK 3.2.2.5版本,API9 Stage模型 - -导入\@ohos.deviceInfo包,然后通过deviceInfo.deviceType获取设备类型。 - -参考文档:[设备信息](../reference/apis/js-apis-device-info.md) - -## 如何获取设备系统版本 - -适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 - -通过[deviceInfo](../reference/apis/js-apis-device-info.md)对象的osFullName属性获取设备系统版本。 - -## OpenHarmony设备如何获取UDID? - -适用于:OpenHarmony SDK3.0, API9 Stage模型 - -1. 如果想获取连接设备的udid,可使用 hdc shell bm get --udid命令; - -2. 如果想在代码中获得,参考文档 [udid](../reference/apis/js-apis-device-info.md) 。 - -## 开发快捷键功能 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -快捷键功能开发请使用组合按键api,具体可参考[组合按键(InputConsumer)](../reference/apis/js-apis-inputconsumer.md) diff --git a/zh-cn/application-dev/faqs/faqs-dfx.md b/zh-cn/application-dev/faqs/faqs-dfx.md index 25b326f67864fee3b1dc6616c5c56bc06bdc7736..565f2de33dfad073ca60a7260ebbe0164dd1e689 100644 --- a/zh-cn/application-dev/faqs/faqs-dfx.md +++ b/zh-cn/application-dev/faqs/faqs-dfx.md @@ -1,54 +1,28 @@ # DFX开发常见问题 -## 程序打开直接崩溃了,如何定位问题 +## hilog日志如何落盘存储 -使用于:OpenHarmony SDK 3.2.5.5版本 +适用于:OpenHarmony 3.2Beta API 9 -1. 通过业务日志打印,定位崩溃的代码位置。 +**问题现象** -2. 通过Crash文件查看报错信息,Crash文件路径是:/data/log/faultlog/faultlogger/。 +hilog日志如何落盘存储 -## UiTest测试框架无法获取控件问题 +**解决措施** -使用于:OpenHarmony SDK 3.2.5.5版本 +使用命令:hilog -w start -f ckTest -l 1M -n 5 -m zlib -j 11 -检查系统配置项 persist.ace.testmode.enabled 是开启。 +文件保存在目录:/data/log/hilog/ -通过hdc_std shell param get persist.ace.testmode.enabled 查看,若配置项为0, +参数解释: -可通过命令hdc_std shell param set persist.ace.testmode.enabled 1 开启配置。 +``` +-w 开启日志落盘任务,start表示开始,stop表示停止。 +-f 设置日志文件名 +-l 设置单个日志文件大小,单位可以是:B/K/M/G +-n 设置最大日志文件编号,当文件计数超过此编号时,日志文件旋转。范围:【2,1000】 +-m 设置日志文件压缩算法 +-j 任务ID,范围:[10,0xffffffffff) +更多参数含义请使用hilog --help查看。 +``` - -## C++代码中hilog的格式参数类型为%d或者%s时,日志打印为何显示private - -直接使用%d、%s等格式化参数时,标准系统默认使用private替换真实数据进行打印,防止数据泄露。如果需要打印出真实数据,需要使用%{public}d替换%d或者%{public}s替换%s。 - -## 如何解决hilog.debug日志无法打印 - -适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 - -通过hdc_std命令 hdc_std shell hilog -b D开启调试开关 - -## 应用如何打印日志是使用hilog还是console,hilog接口参数domain的设置范围是什么 - -适用于:OpenHarmony SDK 3.2.2.5版本 - -推荐使用[hilog日志系统](../reference/apis/js-apis-hilog.md)进行日志打印,接口参数domain的设置范围可以参考[开发指南](../reference/apis/js-apis-hilog.md#hilogisloggable)。 - -## hilog日志打印长度限制是多少,是否可以配置 - -适用于:OpenHarmony SDK 3.2.2.5版本 - -日志打印的长度限制为1024个字符,该长度不能配置。 - -## hilog接口的tag参数是否支持用空格隔开的多个字符串 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -不支持。 - -## hilog中没有使用{public}标识的数据,如何打印真实数据 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -使用命令:hdc_std shell hilog -p off diff --git a/zh-cn/application-dev/faqs/faqs-distributed-data-management.md b/zh-cn/application-dev/faqs/faqs-distributed-data-management.md new file mode 100644 index 0000000000000000000000000000000000000000..935a31ebc67a2e390812c5745cd4aa924180082c --- /dev/null +++ b/zh-cn/application-dev/faqs/faqs-distributed-data-management.md @@ -0,0 +1,110 @@ +# 数据管理开发常见问题 + + +## 关系型数据库rdb中如何进行加密 + +适用于:Openharmony 3.1 Beta5 API 9 + +**解决措施** + +创建关系型数据库,可通过StoreConfig管理关系型数据库配置,其中encrypt属性指定数据库是否加密。 + +**参考链接** + +[关系型数据库](../reference/apis/js-apis-data-relationalStore.md#storeconfig) + +## 关系型数据库rdb中使用TRUNCATE TABLE语句无法清空表数据 + +适用于:OpenHarmony SDK 3.2.9.2版本,API9 + +**问题现象** + +通过TRUNCATE TABLE语句清空表数据时报错。 + +**解决措施** + +关系型数据库rdb使用Sqlite数据库, 它不支持 TRUNCATE TABLE 语句,建议使用delete语句,如:DELETE FROM sqlite\_sequence WHERE name = 'table\_name' ,另外发生该错误会抛出空异常。 + + + +## 关系型数据库rdb支持哪些数据类型 + +适用于:OpenHarmony SDK 3.0版本以上,API 9 Stage模型 + +**解决措施** + +关系型数据库rdb支持的数据类型有:number、string、boolean。其中number为数字类型,支持Double,Long,Float,Int,Int64,最大精度为十进制17位数字。 + +## 如何将PixelMap的数据存储到数据库中 + +适用于:OpenHarmony 3.2 Beta5 API 9 + +**问题现象** + +存储PixelMap的数据 + +**解决措施** + +PixelMap应该被转换成相应的ArrayBuffer再放进数据库。 + +**参考链接** + +[readPixelsToBuffer](../reference/apis/js-apis-image.md#readpixelstobuffer7-1) + +## 如何获取rdb关系型数据库文件 + +适用于:OpenHarmony 3.2 Beta5 API 9 + +**问题现象** + +关系型数据库的获取问题 + +**解决措施** + +开发者可使用hdc命令拷贝文件,其中文件路径为: /data/app/el2/100/database/包名/entry/rdb/ ,然后拷贝该路径下的文件,拷贝完成后,可以通过SQLite工具打开该数据库文件。 + +示例: + +``` + hdc file recv /data/app/el2/100/database//entry/db/ ./ +``` + +## 数据库在系统层面是否有锁机制,开发过程中是否需要关系数据库加锁问题 + +适用于:OpenHarmony 3.2 Beta5 API 9 + +**问题现象** + +关系型数据库的加锁疑问 + +**解决措施** + +系统提供的分布式数据服务、关系型数据库和首选项均有锁机制,开发者无需关注。 + +## 在@ohos.data.storage轻量级存储中,调用put方法保存数据后,再重启应用后调用get方法为什么无法获取到保存的值 + +适用于:OpenHarmony 3.2 Beta5 API 9 + +**问题现象** + +关系型数据库的保存以及重启时的调用 + +**解决措施** + +在storage轻量级存储中,调用put方法,只是将数据保存在内存中,并不会持久化到硬盘中,在退出应用后会将内存中的数据清空。如果想持久化到硬盘中,则在调用put方法后需要再调用flush或flushSync接口才行。数据持久化后重启应用时就可以通过get方法获取到之前保存的数据。 + + +## rdb关系型数据库中TEXT类型保存超长文本失败 + +适用于:OpenHarmony 3.2 Beta5 API 9 + +**问题现象** + +API8版本rdb关系型数据库中TEXT类型保存超长文本失败 + +**解决措施** + +API9版本之前对TEXT文本存储长度限制在1024字节,所以会存在超长文本保存失败的情况。 + +在API9的版本中已经放开了长度限制。 + diff --git a/zh-cn/application-dev/faqs/faqs-distributed-device-profile.md b/zh-cn/application-dev/faqs/faqs-distributed-device-profile.md new file mode 100644 index 0000000000000000000000000000000000000000..83817dce8476795747a43b483f856a11e042cd02 --- /dev/null +++ b/zh-cn/application-dev/faqs/faqs-distributed-device-profile.md @@ -0,0 +1,10 @@ +# 分布式设备开发常见问题 + +## OpenHarmony设备如何查看IMEI号 + +适用于:Openharmony 3.2 Beta5 API 9 + +**解决方案** + +通过HuksTag接口的HUKS\_TAG\_ATTESTATION\_ID\_IMEI参数可以获取。[参考文档](../reference/apis/js-apis-huks.md) + diff --git a/zh-cn/application-dev/faqs/faqs-event-notification.md b/zh-cn/application-dev/faqs/faqs-event-notification.md index b507f8f85ca6013c75c5f0559e06b504419f52ef..f4b06e9496b2a5a0d156363a603c339012d419e7 100644 --- a/zh-cn/application-dev/faqs/faqs-event-notification.md +++ b/zh-cn/application-dev/faqs/faqs-event-notification.md @@ -1,48 +1,151 @@ -# 公共事件与通知开发常见问题 +# 事件通知开发常见问题 -## emitter数据大小限制 +## 如何封装一个通用的commonEvent工具类 -适用于:OpenHarmony SDK 3.2.5.3版本,API9 Stage模型 +适用于OpenHarmony 3.1 Beta5 API 9 -emitter数据大小限制不超过10240。 +**问题现象** -## 如何实现点击Notification通知打开对应App +封装一个通用的commonEvent工具类:希望在创建订阅者的同时注册一个自定义的回调函数,然后在收到事件通知的同时能调用这个自定义的回调函数。 -适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 +**解决措施** -通过配置Notification.publish发布通知接口的参数NotificationRequest中wantAgent属性实现 +``` +import commonEvent from '@ohos.commonEventManager'; -参考文档:[Notification](../reference/apis/js-apis-notification.md#notificationpublish)、[WantAgent](../reference/apis/js-apis-app-ability-wantAgent.md) +export class SubscribeEvent { + private static subscriber = null + // 自定义的回调函数变量 + private static callback = null + /** + * 创建订阅者 + * @param subscribeInfo 订阅事件 + * @callback 用户自定义回调函数 + */ + static createSubscriber(subscribeInfo, callback:(a,b)=>void) { + this.callback = callback + commonEvent.createSubscriber(subscribeInfo, (err, subscriber) => { + if (err) { + console.error('CreateSubscriberCallBack err = ' + JSON.stringify(err)) + } else { + this.subscriber = subscriber; + this.subscribe(this.subscriber) + console.info('Create subscriber succeed') + } + }) + } -示例: + /** + * 订阅公共事件 + * @param subscriber 订阅者 + */ + private static subscribe(subscriber) { + if (subscriber != null) { + commonEvent.subscribe(subscriber, (err, data) => { + if (err) { + console.error('subscribe err = ' + JSON.stringify(err)) + } else { + console.info('SubscribeCallBack data= ' + JSON.stringify(data)) + this.callback('hello callback', data) + } + }) + } else { + console.info("Need create subscriber") + } + } +} -```ts -import WantAgent from '@ohos.app.ability.wantAgent'; +@Entry +@Component +struct Faq10_1 { + @State message: string = '' -async function publishNotification() { - let wantAgentInfo = { - wants: [ - { - bundleName: "com.example.myapplication", - abilityName: "EntryAbility", + build() { + Row() { + Column() { + Text('订阅:' + this.message) + .fontSize(30) + .fontWeight(FontWeight.Bold) + .onClick(() => { + let subscribeInfo = { + events: ["myEvent"] + }; + let callback = (a,b) => { + this.message = a + } + SubscribeEvent.createSubscriber(subscribeInfo,callback) + }) + Text('发布') + .fontSize(30) + .fontWeight(FontWeight.Bold) + .onClick(() => { + //公共事件相关信息 + let options = { + code: 0, //公共事件的初始代码 + data: "initial data",//公共事件的初始数据 + isOrdered: true //有序公共事件 + } + //发布公共事件回调 + function publishCB(err) { + if (err) { + console.error(`publish failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("publish"); + } + } + //发布公共事件 + try { + commonEvent.publish("myEvent", options, publishCB); + } catch (err) { + console.error(`publish failed, code is ${err.code}, message is ${err.message}`); + } + }) } - ], - operationType: WantAgent.OperationType.START_ABILITIES, - requestCode: 0, + .width('100%') + } + .height('100%') } - const wantAgent = await WantAgent.getWantAgent(wantAgentInfo) - let contentType = Notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT; - await Notification.publish({ - content: { - contentType: contentType, - normal: { - title: "测试标题", - text: "测试内容", - } - }, - id: 1, - wantAgent: wantAgent - }) - prompt.showToast({ message: "发送成功" }) } ``` + +**参考链接** + +[公共事件模块](../reference/apis/js-apis-commonEventManager.md) + +## 如何让事件只在一个UIAbility实例中传递 + +适用于:OpenHarmony 3.2 Beta5 API 9 + +**问题现象** + +应该如何实现事件只在一个UIAbility实例中订阅和触发 + +**解决措施** + +在UIAbility中使用EventHub订阅事件,EventHub模块提供了事件中心,提供订阅、取消订阅、触发事件的能力 + +**代码示例** + +``` +import UIAbility from '@ohos.app.ability.UIAbility'; + export default class EntryAbility extends UIAbility { + onForeground() { + this.context.eventHub.on('myEvent', this.eventFunc); + // 结果: + // eventFunc is called,undefined,undefined + this.context.eventHub.emit('myEvent'); + // 结果: + // eventFunc is called,1,undefined + this.context.eventHub.emit('myEvent', 1); + // 结果: + // eventFunc is called,1,2 + this.context.eventHub.emit('myEvent', 1, 2); + } + eventFunc(argOne, argTwo) { + console.log('eventFunc is called, ${argOne}, ${argTwo}'); + }} +``` + +**参考链接** + +[使用EventHub进行数据](../application-models/uiability-data-sync-with-ui.md#使用eventhub进行数据通信) diff --git a/zh-cn/application-dev/faqs/faqs-file-management.md b/zh-cn/application-dev/faqs/faqs-file-management.md index 25c84da0e21e29965837eb1b287f1dce35cfb274..13dfb4b635a437205cfac776d39dbbb70df0c9ac 100644 --- a/zh-cn/application-dev/faqs/faqs-file-management.md +++ b/zh-cn/application-dev/faqs/faqs-file-management.md @@ -1,113 +1,23 @@ # 文件管理开发常见问题 -## fileio.rmdir是递归删除吗? +## 如何获取系统截屏图片的保存路径 -适用于:OpenHarmony SDK 3.2.6.3版本,API9 Stage模型 +适用于OpenHarmony 3.2 Beta5 API 9 -是递归删除。 +**解决措施** -## 如何实现如果文件不存在则创建文件 +截图图片保存路径:/storage/media/100/local/files/Pictures/Screenshots/ -适用于:OpenHarmony SDK 3.2.6.3版本,API9 Stage模型 +## 如何修改设备中文件目录为可读写权限 -可以通过调用函数fileio.open(filePath, 0o100, 0o666)来实现,第二个参数0o100表示若文件不存在,则创建文件。使用该选项时必须指定第三个参数 mode。 +适用于OpenHarmony 3.2 Beta5 API 9 -## 使用fileio进行文件复制,传入沙箱路径报错call fail callback fail, code: 202, data: json arguments illegal) +**问题现象** -适用于:OpenHarmony SDK 3.2.6.3版本,API9 Stage模型 +使用hdc命令向设备上发送文件时,报错:权限不足。 -使用fileio模块进行文件复制时,文件路径前缀中不能以“file:///”开头。 +**解决措施** -## fileIo将数据写入流文件writeSync接口,length传参问题 +输入命令 hdc shell mount -o remount,rw /,正确执行无提示信息。 -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 -一个中文字符length为3,英文字符为1,当前buffer为string类型时,length项需要开发者手动换算;如果要写入全部内容,可直接忽略length项,length长度超长时会导致接口报错。 - -## 如何读取应用沙箱之外的文件 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -fileio中接口入参为path时只能是从context获取到的本应用沙箱路径,若要访问其他路径的数据,如公共数据图片视频等,需要通过数据所有者打开文件返回fd进行操作。 - -比如向mediaLibrary请求读取/写入某文件,然后通过打开代表特定文件的URI后返回的fd进行操作,操作步骤如下: - -1. 通过媒体查询获取文件fileAsset对象; - -2. 通过fileAsset.open方法返回的fd; - -3. 将fd作为fileIo接口参数进行文件读写操作; - -## 如何解决文件的中文内容乱码 - -适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 - -读取文件内容的buffer数据后,通过util.TextDecoder对文件内容进行解码。 - -示例: - -``` -import util from '@ohos.util' -async function readFile(path) { - let stream = fileio.createStreamSync(path, "r+"); - let readOut = await stream.read(new ArrayBuffer(4096)); - let textDecoder = new util.TextDecoder("utf-8", { ignoreBOM: true }); - let buffer = new Uint8Array(readOut.buffer) - let readString = textDecoder.decode(buffer, { stream: false }); - console.log("[Demo] 读取的文件内容:" + readString); -} -``` - -## 调用媒体库getAlbums方法,没有收到返回,也没有捕获到异常是为什么 - -适用于:OpenHarmony SDK 3.2.5.3版本,API9 Stage模型 - -getAlbums方法需要权限:ohos.permission.READ_MEDIA,从[OpenHarmony权限定义列表](../security/permission-list.md)查询知道ohos.permission.READ_MEDIA权限是需要用户授权。 - -1. 在module.json5中配置权限: - - ``` - "requestPermissions": [ - { - "name": "ohos.permission.READ_MEDIA" - } - ] - ``` - -2. 在MainAbility.ts -> onWindowStageCreate页面加载前需要增加用户授权代码: - - ``` - import abilityAccessCtrl from '@ohos.abilityAccessCtrl.d.ts'; - - private requestPermissions() { - let permissionList: Array = [ - "ohos.permission.READ_MEDIA" - ]; - let atManager = abilityAccessCtrl.createAtManager(); - atManager.requestPermissionsFromUser(this.context, permissionList) - .then(data => { - console.info(`request permission data result = ${data.authResults}`) - }) - .catch(err => { - console.error(`fail to request permission error:${err}`) - }) - } - ``` - -## 如何解决多次通过媒体库FetchFileResult获取文件应用崩溃 - -适用于:OpenHarmonySDK 3.2.5.5版本,API9 Stage模型 - -通过FetchFileResult.close()方法,在FetchFileResult对象每次调用完,释放并使其失效。 - -## 在Stage模型下调用mediaLibrary.getMediaLibrary()接口,IDE报错 - -适用于:OpenHarmonySDK 3.2.5.5版本,API9 Stage模型 - -Stage模型下,获取媒体库实例应该调用mediaLibrary.getMediaLibrary(context: Context)。 - -## 调用mediaLibrary.getFileAssets()接口返回的内容如何排序 - -适用于:OpenHarmonySDK 3.2.5.5版本,API9 Stage模型 - -通过[MediaFetchOptions](../reference/apis/js-apis-medialibrary.md#mediafetchoptions7)对象参数里面的order属性进行排序。 diff --git a/zh-cn/application-dev/faqs/faqs-globalization.md b/zh-cn/application-dev/faqs/faqs-globalization.md new file mode 100644 index 0000000000000000000000000000000000000000..9c42388f55a0a8ecd34de67d069bca30d0a70660 --- /dev/null +++ b/zh-cn/application-dev/faqs/faqs-globalization.md @@ -0,0 +1,118 @@ +# 资源管理开发常见问题 + +## 如何读取rawfile中的xml文件并转化为String类型 + +适用于:OpenHarmony 3.2 Beta5 API 9 + +**解决措施** + +通过resourceManager的getRawFileContent接口获取xml数据,再通过String.fromCharCode将获取的数据转化为String类型。 + +**代码示例** + +``` +resourceManager.getRawFileContent('test.xml', (error, value) => { + if (error != null) { + console.log("error is " + error); + } else { + let rawFile = value; + let xml = String.fromCharCode.apply(null, rawFile) + } +}); +``` + +**参考链接** + +[资源管理](../reference/apis/js-apis-resource-manager.md) + +## Stage模型下如何获取资源 + +适用于:OpenHarmony 3.1 Beta5 API 9 + +**解决措施** + +Stage模型支持了通过context获取resourceManager对象的方式,再调用其内部获取资源的接口,无需再导入包。此方式不适用于FA模型。 + +**代码示例** + +``` +const context = getContext(this) as any +context + .resourceManager + .getString($r('app.string.entry_desc').id) + .then(value => { + this.message = value.toString() +}) +``` + +## 如何通过接口获取resource目录的路径 + +适用于:Openharmony 3.1 Beta5 API 9 + +**问题现象** + +希望获取resource目录的路径,从而使用文件管理接口操作文件。 + +**解决措施** + +由于应用以hap形式进行安装,安装完成后不会解压hap包,所以在程序运行时无法获取resource路径。 + +可以考虑如下两种方式获取资源文件: + +1. 使用\$r或者\$rawfile访问。适合静态访问,程序运行时不改变资源路径。 + +2. 使用ResourceManage访问。适合动态访问,程序运行时可动态改变资源路径。 + +**参考链接** + +[资源分类与访问](../quick-start/resource-categories-and-access.md) [资源管理](../reference/apis/js-apis-resource-manager.md) + +## 资源管理内的getPluralString方法获取value值有误 + +适用于:OpenHarmony 3.2 Beta5 API 9 + +**问题现象** + +getPluralString接口获取value值有误,显示复数值(other)。 + +**解决措施** + +getPluralString接口只支持英文系统,不支持中文。 + +## 如何获取resources目录中自定义的string字段 + +适用于:OpenHarmony 3.2 Beta5 API 9 + +**解决措施** + +使用ResourceManager模块的getStringValue方法获取。 + +**参考链接** + +[资源管理](../reference/apis/js-apis-resource-manager.md#getstringvalue9) + +## AppScope中的资源如图片,文字等如何引用 + +适用于:OpenHarmony 3.2 Beta5 API 9 + +**解决措施** + +通过\$r\('app.type.name'\)的形式来引用,type代表资源类型,如color,string,media等,name代表资源命名。 + +## Resource类型如何转为String + +适用于:OpenHarmony 3.2 Beta5 API 9 + +**解决措施** + +Resource为string支持限定词目录使用this.context.resourceManager.getStringSync\(\$r\('app.string.test'\).id\),可以同步转换,不支持\$r\('app.string.test', 2\)方式。 + +**参考链接** + +[ResourceManager\(资源管理\)](../reference/apis/js-apis-resource-manager.md#getstringsync9) + +## form\_config.json文件中是否可以使用$引用常量 + +适用于:OpenHarmony 3.2 Beta5 API 9 + +form\_config.json文件中不支持使用\$引用常量。 diff --git a/zh-cn/application-dev/faqs/faqs-graphics.md b/zh-cn/application-dev/faqs/faqs-graphics.md index 229d88e8eaee62dc6f72957a982dc06427e8438c..6f2c98331f3a50ca08c1de6460b91069c1c2bc73 100644 --- a/zh-cn/application-dev/faqs/faqs-graphics.md +++ b/zh-cn/application-dev/faqs/faqs-graphics.md @@ -1,90 +1,93 @@ # 图形图像开发常见问题 -## 调用window实例的setSystemBarProperties接口时,设置isStatusBarLightIcon和isNavigationBarLightIcon属性不生效 - -适用于:OpenHarmony SDK 3.2.5.3版本,API9 Stage模型 - -状态栏字体高亮属性的本质就只是让字体变成白色。调用window实例的setSystemBarProperties接口时,如果设置了状态栏内容颜色statusBarContentColor,就以开发者设置的颜色为准,isStatusBarLightIcon状态栏字体高亮属性就不生效;同理,如果设置了导航栏内容颜色navigationBarContentColor,isNavigationBarLightIcon导航栏字体高亮属性就不生效。 - -## 如何设置系统状态栏样式 - -适用于:OpenHarmony SDK 3.2.3.5版本,API9 Stage模型 - -导入\@ohos.window模块,开发者可以使用window.setSystemBarProperties()接口设置状态栏样式属性,达到自定义样式的效果。 - -## 如何隐藏状态栏,实现沉浸式效果 - -适用于:OpenHarmony SDK 3.2.6.3版本,API9 Stage模型 - -1. 可以在onWindowStageCreate方法获取windowClass对象。 - - ```ts - onWindowStageCreate(windowStage) { - // Main window is created, set main page for this ability - console.log("[Demo] EntryAbility onWindowStageCreate") - windowStage.getMainWindow((err, data) => { - if (err.code) { - console.error('Failed to obtain the main window.') - return; - } - // 获取到窗口对象 - globalThis.windowClass = data; - }) - } - ``` - -2. 设置窗口全屏,隐藏状态栏。 - - ```ts - globalThis.windowClass.setFullScreen(isFullScreen, (err, data) => { - if (err.code) { - console.error('Failed to enable the full-screen mode. Cause:' + JSON.stringify(err)); - return; - } - console.info('Succeeded in enabling the full-screen mode. Data: ' + JSON.stringify(data)); - }); - ``` +## 如何获取设备的dpi值 + +适用于:OpenHarmony 3.2 Beta5,API 9 Stage模型 + +**解决措施** + +导入@ohos.display包,通过getDefaultDisplaySync\(\)方法获取。 + +**代码示例** + +``` +import display from '@ohos.display'; +let displayClass = null; +try { + displayClass = display.getDefaultDisplaySync(); + console.info('Test densityDPI:' + JSON.stringify(displayClass.densityDPI)); +} catch (exception) { + console.error('Failed to obtain the default display object. Code: ' + JSON.stringify(exception)); +} +``` + +## 如何隐藏状态栏实现沉浸式效果 + +适用于:OpenHarmony 3.2 Beta5,API 9 Stage模型 + +**解决措施** + +1. 可以在onWindowStageCreate方法获取windowClass对象。 + + ``` + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate") + windowStage.getMainWindow((err, data) => { + if (err.code) { + console.error('Failed to obtain the main window.') + return; + } + // 获取到窗口对象 + globalThis.windowClass = data; + }) + } + ``` + +2. 设置窗口全屏,隐藏状态栏。 + + ``` + globalThis.windowClass.setFullScreen(isFullScreen, (err, data) => { + if (err.code) { + console.error('Failed to enable the full-screen mode. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in enabling the full-screen mode. Data: ' + JSON.stringify(data)); + }); + ``` + ## 如何获取窗口的宽高信息 -适用于:OpenHarmony SDK 3.2.3.5版本,API9 Stage模型 +适用于:OpenHarmony SDK 3.2 Beta5,API 9 Stage模型 -通过\@ohos.window模块,可以使用getProperties()接口获取窗口属性,然后通过窗口属性的windowRect获取窗口宽高信息 +**解决措施** -示例: +引入窗口模块@ohos.window,获取指定窗口对象Window后,在该对象上使用getWindowProperties\(\)获取窗口各个属性,在属性windowRect中获取窗口宽高信息。 +**代码示例** -```ts -let promise = windowClass.getProperties(); -promise.then((data)=> { - console.info('Succeeded in obtaining the window properties. Data: ' + JSON.stringify(data.windowRect)); -}).catch((err)=>{ - console.error('Failed to obtain the window properties. Cause: ' + JSON.stringify(err)); -}); ``` - -## 如何设置系统状态栏颜色 - -适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 - -参考如下方式实现,示例: - - -```ts -window.getTopWindow(globalThis.mainContext).then(win => { - var systemBarProperties = { - statusBarColor: '#19B6FF', // 状态栏背景颜色 - navigationBarColor: '#19B6FF', // 导航栏背景颜色 - isStatusBarLightIcon: false, // 状态栏图标是否为高亮状态。 - isNavigationBarLightIcon: true, // 导航栏图标是否为高亮状态。 - statusBarContentColor: '#0D0500', // 状态栏文字颜色 - navigationBarContentColor: '#FFA500' // 导航栏文字颜色 - }; - win.setSystemBarProperties(systemBarProperties).catch(err => { - INDEX_LOGGER.info(`set System Bar Properties failed:${err}`) - }) -}) -.catch(err => { - INDEX_LOGGER.info(`get top window failed:${err}`) -}) +import window from '@ohos.window'; +let windowClass = null; +try { + let promise = window.getLastWindow(this.context); + promise.then((data)=> { + //获取窗口对象 + windowClass = data; + try { + //获取窗口属性 + let properties = windowClass.getWindowProperties(); + let rect = properties.windowRect; + //rect.width: 窗口宽度;rect.height: 窗口高度 + } catch (exception) { + console.error('Failed to obtain the window properties. Cause: ' + JSON.stringify(exception)); + } + console.info('Succeeded in obtaining the top window. Data: ' + JSON.stringify(data)); + }).catch((err)=>{ + console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(err)); + });} catch (exception) { + console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(exception)); +} ``` + diff --git a/zh-cn/application-dev/faqs/faqs-hdc-std.md b/zh-cn/application-dev/faqs/faqs-hdc-std.md deleted file mode 100644 index 20cdb7205dd9fca003b2b3b2ea0d6bc152d60e62..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/faqs/faqs-hdc-std.md +++ /dev/null @@ -1,87 +0,0 @@ -# hdc_std命令使用常见问题 - -## 日志的常用命令 - -适用于:OpenHarmony SDK 3.2.2.5版本 - -清理日志:hdc_std shell hilog -r - -调大缓存到20M:hdc_std shell hilog -G 20M - -抓取日志:hdc_std shell hilog > log.txt - -## 日志限流怎么规避 - -适用于:OpenHarmony SDK 3.2.5.3版本,API9 Stage模型 - -- 关闭日志限流 hdc_std shell hilog -Q pidoff - -- 关闭隐私标志 hdc_std shell hilog -p off - -- 增加日志buffer hdc_std shell hilog -G 200M - -- 关闭全局日志,只打开自己领域的日志 hdc_std shell hilog –b D –D 0xd0xxxxx - -执行完命令后重启DevEco Studio。 - -## 用IDE安装HAP到开发板上无法打开 - -适用于:OpenHarmony SDK 3.2.5.3版本,API9 Stage模型 - -请检查sdk和开发板烧录的系统版本是否一致,推荐取同一天的sdk和系统版本。 - -## 如何通过hdc命令上传文件 - -适用于:OpenHarmony SDK 3.2.2.5版本 - -可以使用hdc_std file send上传文件。 - -## 如何让RK3568开发板不熄屏 - -适用于:OpenHarmony SDK 3.2.5.3版本,API9 Stage模型 - -输入命令hdc_std shell "power-shell setmode 602" - -## 如何通过命令启动Ability - -适用于:OpenHarmony SDK 3.2.5.3版本,API9 Stage模型 - -输入命令hdc_std shell aa start -a AbilityName -b bundleName -m moduleName - -## 如何修改开发板中文件目录为可读写权限 - -适用于:OpenHarmony SDK 3.2.5.6版本,API9 Stage模型 - -输入命令 hdc_std shell mount -o remount,rw / - -## 如何解决hdc_std file recv 使用报错:Unkonw file option -r - -适用于:OpenHarmony SDK 3.2.5.6版本,API9 Stage模型 - -1. 使用设备镜像或者同版本SDK中配套的hdc工具进行使用。 - -2. hdc工具指定的路径不要包含中文和空格。 - -## 如何使用命令卸载应用 - -适用于:OpenHarmony SDK 3.2.2.5版本 - -输入命令hdc_std uninstall [-k] [package_name] - -## 如何查看系统是32位还是64位 - -适用于:OpenHarmony SDK 3.2.5.5版本 - -使用命令:hdc_std shell getconf LONG_BIT - -若返回64则为64位系统,否则为32位系统。 - -## 如何查看组件树结构 - -适用于:OpenHarmony SDK 3.2.5.5版本 - -1. 使用命令hdc_std shell 进入命令行界面。 - -2. 输入 aa dump -a 找到abilityID。 - -3. aa dump -i [abilityID] -c -render 查看组件树。 diff --git a/zh-cn/application-dev/faqs/faqs-ide.md b/zh-cn/application-dev/faqs/faqs-ide.md deleted file mode 100644 index 9d2cd9b7db09275aeedd988525bf663e7440d6b0..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/faqs/faqs-ide.md +++ /dev/null @@ -1,80 +0,0 @@ -# IDE使用常见问题 - -## 如何解决报错“npm ERR! code SELF_SIGNED_CERT_IN_CHAIN” - -适用于:OpenHarmony SDK 3.2.5.3版本,API9 Stage模型 - -1. 在Dev Eco Studio terminal中执行npm config set strict-ssl=false; - -2. 在Dev Eco Studio terminal中执行npm install。 - -## 手工更新DevEco的SDK后,编译HAP报错“Cannot find module 'xxx\ets\x.x.x.x\build-tools\ArkTS-loader\node_modules\webpack\bin\webpack.js'” - -适用于:OpenHarmony SDK 3.2.5.3版本,API9 Stage模型 - -1. 到SDK的ets\x.x.x.x\build-tools\ets-loader目录下执行npm install; - -2. 到SDK的js\x.x.x.x\build-tools\ace-loader目录下执行npm install。 完成步骤后重新编辑。 - -## 如何通过命令行打包HAP - -适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 - -方式一:运行hvigor assembleHap。 - -方式二:在工程的package.json的scripts中,定义构建任务脚本后,运行npm buildOhosHaps。“buildOhosHaps”字段可以自定义。 - - -``` -"scripts": { - "buildOhosHaps": "hvigor assembleHap" -}, -``` - -## DevEco创建新工程为什么选不到API9 - -适用于:DevEco Studio 3.0 Beta4 3.0.0.993(B06)版本 - -创建新工程的时候,首先要选择OpenHarmony页签再创建工程就可以选到API9。 - -## 下载时收不到回调且无法返回错误码 - -适用于:OpenHarmony所有版本 - -1. 重装hdc命令: hdc_std重裝 拉起 设备连接 - -2. 关闭日志限流 :hdc_std shell hilog -Q pidoff 打开" - -## IDE点击run按钮后,报错:error: unknow option. usage: aa start <options> - -适用于:OpenHarmony SDK 3.2.5.6版本,API9 Stage模型 - -报错原因:aa命令参数错误,执行打开应用操作报错。 - -有2种处理方法: - -1. 检查SDK版本和OS版本,确保SDK版本和OS版本一致。 - -2. 点击设备上app图标,手动启动app进行使用。 - -## IDE运行app报错:The hdc_std version of the SDK does not match the hdcd version of the device. - -适用于:OpenHarmony SDK 3.2.5.6版本,API9 Stage模型 - -hdc 和 hdcd版本不匹配 ,请更新IDE至Dev Eco 3.0.1.993及以上版本。 - -旧版本IDE检测不匹配会拦截安装,新版本IDE仅提醒不影响正常使用。 - -## 如何在OpenHarmony 的SDK中加入自定义的\*.d.ts文件 - -适用于:OpenHarmony SDK 3.1.7.7版本 , API8 FA模型 - -将dts文件命名为\@ohos.xxxx.d.ts , 放入SDK的路径中,重启IDE。 - -引入时会有代码提醒。 - -## 如何替换full-SDK - -适用于:OpenHarmony SDK 3.2.7.5版本 - -参考文档[full-SDK替换指南](../quick-start/full-sdk-switch-guide.md) diff --git a/zh-cn/application-dev/faqs/faqs-international.md b/zh-cn/application-dev/faqs/faqs-international.md deleted file mode 100644 index bbef24399ad9dfd0c33389edf7b4a66827b87b60..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/faqs/faqs-international.md +++ /dev/null @@ -1,19 +0,0 @@ -# 国际化开发常见问题 - -## AppScope中的资源如图片,文字等的引用方式是什么 - -适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 - -通过$r('app.type.name')的形式来引用,type代表资源类型,如color,string,media等,name代表资源命名 - -## Resource类型转为string - -适用于:OpenHarmony SDK3.0, API9 Stage模型 - -Resource为string支持限定词目录使用this.context.resourceManager.getStringSync(\\$r('app.string.test').id),可以同步转换,不支持\$r('app.string.test', 2)方式。更多用法请参考[ResourceManager(资源管理)](../reference/apis/js-apis-resource-manager.md#getstringsync9) - -## form_config.json文件中使用$引用常量为什么不生效 - -适用于:OpenHarmony SDK 3.2.6.5, API9 Stage模型 - -form_config.json文件中不支持使用$引用常量。 diff --git a/zh-cn/application-dev/faqs/faqs-language.md b/zh-cn/application-dev/faqs/faqs-language.md deleted file mode 100644 index ff82d25aed8c3d9abe1a6e35ddf510fc0702fe9a..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/faqs/faqs-language.md +++ /dev/null @@ -1,286 +0,0 @@ -# 开发语言常见问题 - -## TS语言在生成器函数中编译失败,有哪些使用限制 - -适用于:OpenHarmony SDK 3.2.5.3版本,API9 Stage模型 - -TS语言的使用在生成器函数中存在以下限制: - -- 表达式仅允许在字符串(${expression})、if条件、ForEach的参数和组件的参数中使用; - -- 这些表达式中的任何一个都不能导致任何应用程序状态变量(\@State、\@Link、\@Prop)的改变,否则会导致未定义和潜在不稳定的框架行为; - -- 生成器函数内部不能有局部变量。 - -上述限制都不适用于事件处理函数(例如onClick)的匿名函数实现。 - -错误示例: - -``` -build() { - let a: number = 1 // invalid: variable declaration not allowed - Column() { - Text('Hello ${this.myName.toUpperCase()}') // ok. - ForEach(this.arr.reverse(), ..., ...) // invalid: Array.reverse modifies the @State array variable in place - } - buildSpecial() // invalid: no function calls - Text(this.calcTextValue()) // this function call is ok. -} -``` - -## 如何动态替换掉资源文件中的“%s”占位符 - -适用于:OpenHarmony SDK 3.2.5.3版本,API9 Stage模型 - -在应用中,通过"$r('app.string.xx')"的形式引用应用资源,$r的第二个参数可用于替换%s占位符。 - - 示例: - -``` -build() { - //do something - //引用的string资源,$r的第二个参数用于替换%s - Text($r('app.string.entry_desc','aaa')) - .fontSize(100) - .fontColor(Color.Black) - //do something -} -``` - -## 如何读取Resource中的xml文件并转化为String类型 - -适用于:OpenHarmony SDK 3.2.2.5版本, API9 Stage模型 - -1. 通过resourceManager的RawFile接口获取Uint8Array格式数据。 - -2. 通过String.fromCharCode将Uint8Array格式数据转化为String类型。 - -参考文档:[资源管理](../reference/apis/js-apis-resource-manager.md) - -示例: - - -``` -resourceManager.getRawFile(path, (error, value) => { - if (error != null) { - console.log("error is " + error); - } else { - let rawFile = value; - let xml = String.fromCharCode.apply(null, rawFile) - } -}); -``` - -## 如何将Resource资源对象转成string类型 - -适用于:OpenHarmony SDK 3.2.3.5版本,API9 Stage模型 - -通过\@ohos.resourceManager模块 resourceManager.getString()方法获取字符串。 - -参考文档:[资源管理](../reference/apis/js-apis-resource-manager.md#getstring) - -## class全局静态变量无法使用的问题 - -适用于:OpenHarmony SDK 3.2.3.5版本,API9 Stage模型 - -Page和Ability打包后会对import的对象分别形成两个不同的闭包,即打包出两个Global对象。因此,所引用的静态变量并不是同一对象,所以无法通过class静态变量方式定义全局变量。建议使用AppStorage进行全局变量管理。 - -参考文档:[应用程序的数据存储](../quick-start/arkts-state-mgmt-application-level.md) - -## Stage模型下如何获取资源 - -适用于:OpenHarmony SDK 3.2.3.5版本,API9 Stage模型 - -Stage模型支持了通过context获取resourceManager对象的方式,再调用其内部获取资源的接口,无需再导入包,此方式FA模型不适用。 - -示例: - - -``` -const context = getContext(this) as any -context - .resourceManager - .getString($r('app.string.entry_desc').id) - .then(value => { - this.message = value.toString() -}) -``` - -## 如何实现页面加载前从接口获取数据 - -适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 - -aboutToAppear函数中使用异步接口获取页面数据,使用\@State修饰变量,数据获取完成后根据变量自动刷新页面。 - - -``` -@Entry -@Component -struct Test6Page { - // 数据获取成功,会自动刷新页面 - @State message: string = 'loading.....' - aboutToAppear(){ - // 模拟异步接口获取数据 - setTimeout(()=>{ - this.message = 'new msg' - },3000) - } - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - } - .height('100%') - } -} -``` - -## worker线程与主线程是否运行在相同的全局上下文中 - -适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 - -worker线程与主线程不在同一个上下文中,它们使用数据通信的方式交互。 - -## OpenHarmony上url编码使用哪个接口 - -适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 - -使用全局函数encodeURI进行编码,使用decodeURI进行解码。例如空格字符,编码后为%20。 - -## OpenHarmony有解析xml的接口吗 - -适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 - -使用ConvertXML的convert接口可以将xml文本解析为JavaScript对象。参考文档:[convertxml API文档](../reference/apis/js-apis-convertxml.md) - -## 应用图标一多设置 - -适用于:OpenHarmony SDK3.0, API9 Stage模型 - -借助资源限定词能力,实现应用图标的一多配置,具体使用参考[资源使用](../key-features/multi-device-app-dev/resource-usage.md) - -## Stage模型资源配置文件string.json文件中支持配置占位符吗 - -适用于:OpenHarmony SDK3.2.6.3, API9 Stage模型 - -资源配置文件string.json文件本身不支持配置占位符,可以在对应的页面中通过定义变量,在实际组件使用Resources和变量拼接的方式达到实现占位符的同等效果。 - -## OpenHarmony的systemTime.getCurrentTime()接口和JS的new Date().getTime()有区别吗 - -适用于:OpenHarmony SDK3.2.6.3, API9 Stage模型 - -systemTime.getCurrentTime(false)和new Date().getTime()一样,都是返回1970年1月1日至今的毫秒数;systemTime.getCurrentTime(true)返回1970年1月1日至今的纳秒数。两种方式都是系统时间。 - -## \@BuilderParam装饰器,组件传参问题 - -适用于:OpenHarmony SDK3.2.6.5, API9 Stage模型 - -对\@BuilderParam修饰的属性进行赋值时不带参数(如:content: this.specificParam),则此属性的类型需定义成无返回值的函数(如:\@BuilderParam content: () => void);若带参数(如:callContent: this.specificParam1("111")),则此属性的类型需定义成any(如:\@BuilderParam callContent: any;),具体用法请参考[BuilderParam](../quick-start/arkts-dynamic-ui-elememt-building.md#builderparam8)。 - -## ArkTS如何把string转成byte数组 - -适用于:所有版本 - -参考如下代码实现,示例: - - -``` -function stringToByte(str) { - var bytes = new Array(); - var len,c; - len = str.length; - for(var i = 0;i= 0x010000 && c<= 0x10FFFF) { - bytes.push(((c>>18) & 0x07) | 0xf0); - bytes.push(((c>>12) & 0x3F) | 0x80); - bytes.push(((c>>6) & 0x3f) | 0x80); - bytes.push((c & 0x3F) | 0x80); - } else if(c >= 0x000800 && c<= 0x00FFF){ - bytes.push(((c>>12) & 0x07) | 0xf0); - bytes.push(((c>>6) & 0x3F) | 0x80); - bytes.push((c & 0x3F) | 0x80); - } else if(c >= 0x000800 && c<= 0x0007FF) { - bytes.push(((c>>6) & 0x3F) | 0x80); - bytes.push((c & 0x3F) | 0x80); - } else { - bytes.push(c & 0xFF) - } - } - return bytes; -} -``` - -## 创建woker时报错“Too many wokers,the number of worker exceeds the maximum”如何处理 - -使用于:OpenHarmony SDK 3.2.6.5版本 - -这是因为每个应用的worker上限为7个,因此在worker使用完成后需要通过termiate方法释放worker。参考[worker开发指南](../reference/apis/js-apis-worker.md#terminate)。 - -## OpenHarmony推荐的多线程解决方案是什么 - -使用于:OpenHarmony SDK 3.2.6.5版本 API9 Stage模型 - -OpenHarmony推荐使用worker来处理多线程场景。 - -参考文档:[启动一个worker](../reference/apis/js-apis-worker.md) - -## 使用\@Builder装饰包含自定义组件的方法与普通方法的区别是什么 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -\@Builder装饰的方法中使用了自定义组件,那么该方法每次被调用时,对应的自定义组件均会重新创建。 - -## 状态管理中\@Watch监听,数组内对象属性变化无法触发watch回调函数 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -使用\@Watch监听的对象,只能监听一层数据变化,多层次数据变更无法监听,同\@State状态管理机制一致 - -## 如何监听\@State深层数据变化 - -适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 - -通过\@Observed配合\@ObjectLink装饰符实现。 - -参考文档:[Observed和ObjectLink数据管理](../quick-start/arkts-state-mgmt-page-level.md#observed和objectlink数据管理) - -## 如何实现字符串编解码 - -适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 - -通过util工具函数模块中的TextEncoder和TextDecoder进行解码。 - -参考文档:[TextEncoder](../reference/apis/js-apis-util.md#textencoder)、[TextDecoder](../reference/apis/js-apis-util.md#textdecoder) - -## 如何导入和导出namespace命名空间 - -适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 - -- namespace导出 - - ``` - namespace Util{ - export function getTime(){ - return Date.now() - } - } - export default Util - ``` - -- namespace导入 - - ``` - import Util from './util' - Util.getTime() - ``` - -## worker线程中能进行关系型数据库的操作吗 - -适用于:OpenHarmony SDK 3.2.5.5版本, API9 Stage模型 - -不支持。 diff --git a/zh-cn/application-dev/faqs/faqs-media.md b/zh-cn/application-dev/faqs/faqs-media.md deleted file mode 100644 index 5233b35f5a04136ac8829bdf346f7262aa856ff0..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/faqs/faqs-media.md +++ /dev/null @@ -1,132 +0,0 @@ -# 媒体开发常见问题 - -## 如何设置前置拍照 - -适用于:OpenHarmony SDK 3.2.3.5版本,API9 Stage模型 - -1. 设置相机位置camera.CameraPosition.CAMERA_POSITION_FRONT - -2. 根据相机位置和类型创建CameraInput实例 - -参考文档:[相机管理](../reference/apis/js-apis-camera.md) - -示例: - -``` -//默认设置后置相机,通过设置isFrontCamera来切换相机 -let cameraId -let cameraInput -for(let cameraIndex = 0; cameraIndex < this.cameraArray.length; cameraIndex++) { - let faceType = this.cameraArray[cameraIndex].cameraPosition - switch(faceType) { - case camera.CameraPosition.CAMERA_POSITION_FRONT://前置相机 - if(this.isFrontCamera){ - cameraId = this.cameraArray[cameraIndex].cameraId - } - break - case camera.CameraPosition.CAMERA_POSITION_BACK://后置相机 - if(!this.isFrontCamera){ - cameraId = this.cameraArray[cameraIndex].cameraId - } - break - case camera.CameraPosition.CAMERA_POSITION_UNSPECIFIED: - default: - break - } -} -cameraInput = await this.cameraManager.createCameraInput(cameraId) -``` - -## 如何进行图片剪切 - -适用于:OpenHarmony 3.2.5.6版本,API9 Stage模型 - -1. **通过传入的uri创建图片源实例ImageSource对象。** - - ``` - let path = this.context.getApplicationContext().fileDirs + "test.jpg"; - const imageSourceApi = image.createImageSource(path); - ``` - -2. **设置解码参数,通过图片解码获取PixelMap图像对象,解码过程中同时支持图像处理操作。** - - 设置desiredSize支持按尺寸缩放,如果设置为全0,则不进行缩放。 - - 设置desiredRegion支持按矩形区域裁剪,如果设置为全0,则不进行裁剪。 - - 设置rotateDegrees支持旋转角度,以图像中心点顺时针旋转。 - - ``` - const decodingOptions = { - desiredSize: { - height:0, - width:0 - }, - //按矩形区域裁剪 - desiredRegion: { - size: { - height:100, - width:100 - }, - x:0, - y:0 - }, - //旋转90度 - rotate:90 - } - imageSourceApi.createPixelMap(decodingOptions).then(pixelMap => { - this.handlePixelMap(pixelMap) - }) - ``` - -3. 解码完成获取到PixelMap对象后,可以进行后续处理,比如渲染显示等。 - -## 如何申请设备上的媒体读写权限 - -适用于:OpenHarmonySDK 3.2.5.5版本,API9 Stage模型 - -1. 在module.json5配置文件中配置媒体读写权限ohos.permission.READ_MEDIA和ohos.permission.WRITE_MEDIA。 - 示例: - - - ``` - { - "module" : { - "requestPermissions":[ - { - "name" : "ohos.permission.READ_MEDIA", - "reason": "$string:reason" - }, - { - "name" : "ohos.permission.WRITE_MEDIA", - "reason": "$string:reason" - } - ] - } - } - ``` - -2. 这两个权限的授权方式均为user_grant,因此需要调用requestPermissionsFromUser接口,以动态弹窗的方式向用户申请授权。 - - ``` - import abilityAccessCtrl from '@ohos.abilityAccessCtrl.d.ts'; - - let permissions: Array = ['ohos.permission.READ_MEDIA','ohos.permission.WRITE_MEDIA'] - let atManager = abilityAccessCtrl.createAtManager(); - // context为调用方UIAbility的UIAbilityContext - atManager.requestPermissionsFromUser(context, permissions).then((data) => { - console.log("Succeed to request permission from user with data: " + JSON.stringify(data)) - }).catch((error) => { - console.log("Failed to request permission from user with error: " + JSON.stringify(error)) - }) - ``` - -## MP4格式的视频为什么播放不了 - -适用于:OpenHarmonySDK 3.2.7.5版本,API9 Stage模型 - -暂不支持h.265编码格式的MP4视频播放。 - - -## 为什么视频创建至十几个时新创建的视频无法播放甚至崩溃 - -适用于:OpenHarmonySDK 3.2.7.5版本,API9 Stage模型 - -当前限制最多创建13个媒体播放实例。 diff --git a/zh-cn/application-dev/faqs/faqs-multimedia.md b/zh-cn/application-dev/faqs/faqs-multimedia.md new file mode 100644 index 0000000000000000000000000000000000000000..d2cec03590cf9ac47434dab0d24d911c2bd89835 --- /dev/null +++ b/zh-cn/application-dev/faqs/faqs-multimedia.md @@ -0,0 +1,136 @@ +# 媒体开发常见问题 + +## 使用XComponent组件显示相机的预览输出流时,如何获取相机的帧数据 + +适用于:OpenHarmony 3.2 版本 API 9 Stage模型 + +**问题现象** + +目前接口不支持实时预览相机的帧数据,只能绑定一个动作来获取,比如拍照动作。 + +**解决措施** + +通过创建双路预览来实现。 + +1. Xcomponent来创建预览流。 + + ``` + // 获取PreviewOutput(预览输出类)实例 + const surfaceId = globalThis.mxXComponentController.getXComponentSurfaceld(); + this.mPreviewOutput = await Camera.createPreviewOutput(surfaceld) ; + ``` + +2. 使用imageReceiver来监听图像信息。 + + ``` + // 添加双路预览 + const fullWidth = this.mFullScreenSize.width; + const fullHeight = this.mFullScreenSize.height; + const imageReceiver = await image.createImageReceiver(fullwidth, fullHeight, + formatImage, capacityImage) ; + const photoSurfaceId = await imageReceiver.getReceivingSurfaceld(); + this.mPreviewOutputDouble = await Camera.createPreviewOutput ( photoSurfaceld) + ``` + + +## 如何获取前置摄像头的预览图像 + +适用于:OpenHarmony 3.2版本 API 9 Stage模型 + +**解决措施** + +1. 使用系统相机框架@ohos.multimedia.camera获取物理摄像头信息。 + + ``` + let cameraManager = await camera.getCameraManager(context); + let camerasInfo = await cameraManager.getSupportedCameras(); + let cameraDevice = this.camerasInfo[0]; + ``` + +2. 创建并启动物理摄像头输入流通道。 + + ``` + let cameraInput = await cameraManager.createCameraInput(cameraDevice); + await this.cameraInput.open(); + ``` + +3. 拿到物理摄像头信息查询摄像头支持预览流支持的输出格式,结合XComponent提供的surfaceId创建预览输出通道。 + + ``` + let outputCapability = await this.cameraManager.getSupportedOutputCapability(cameraDevice); + let previewProfile = this.outputCapability.previewProfiles[0]; + let previewOutput = await cameraManager.createPreviewOutput(previewProfile, previewId); + ``` + +4. 创建相机会话,在会话中添加摄像头输入流和预览输出流,然后启动会话,预览画面就会在XComponent组件上送显。 + + ``` + let captureSession = await cameraManager.createCaptureSession(); + await captureSession.beginConfig(); + await captureSession.addInput(cameraInput); + await captureSession.addOutput(previewOutput); + await this.captureSession.commitConfig() + await this.captureSession.start(); + ``` + + +## 如何设置相机焦距 + +适用于:OpenHarmony 3.2版本 API 9 Stage模型 + +**解决措施** + +1. 判断当前摄像头是否为前置摄像头,前置摄像头不支持设置焦距。 +2. 通过captureSession.getZoomRatioRange\(\)接口获取设备焦距设置支持的最大、最小范围。 +3. 判断目标焦距参数大小是否在步骤二获取的范围内,然后通过captureSession.setZoomRatio\(\)接口设置相机焦距。 + +## 如何后台播放音乐 + +适用于:OpenHarmony 3.2版本 API 9 Stage模型 + +**问题现象** + +无法后台播放音乐。 + +**解决措施** + +AVSession对媒体播放做了管控,当三方应用从前台切入后台或者进入锁屏状态,媒体播放会被强制暂停而应用不感知,如果要开发后台播放功能,应该启动后台任务管理的长时任务中播放音乐,同时接入AVSession能力,允许控制中心的播控面板控制三方应用的播放功能。 + +**参考链接** + +[后台任务管理的长时任务开发指导参考](../task-management/continuous-task-dev-guide.md) + +[AVSession开发指导参考](../media/using-avsession-developer.md) + + +## 创建多个视频组件无法播放 + +适用于:OpenHarmony 3.2版本 API 9 Stage模型 + +**问题现象** + +创建十几个视频组件无法播放甚至崩溃。 + +**解决措施** + +当前限制最多创建13个媒体播放实例。 + + +## 如何直接调起图片库 + +适用于:OpenHarmony 3.2版本 API 9 Stage模型 + +**解决措施** + +``` +let want = { + bundleName: 'com.ohos.photos', + abilityName: 'com.ohos.photos.MainAbility', + parameters: { + uri: 'detail' + } +}; +let context = getContext(this) as common.UIAbilityContext; +context.startAbility(want); +``` + diff --git a/zh-cn/application-dev/faqs/faqs-native.md b/zh-cn/application-dev/faqs/faqs-native.md deleted file mode 100644 index b67bb4162d0c840630f11cf78148266ad9d05780..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/faqs/faqs-native.md +++ /dev/null @@ -1,79 +0,0 @@ -# Native API使用常见问题 - -## Native API是否有类似Canvas绘制接口 - -适用于:OpenHarmony SDK 3.2.5.3版本,API9 Stage模型 - -Native API中的[Drawing](../reference/native-apis/_drawing.md)接口可以提供2D绘制功能。 - -## 运行Native HAP的时候,导入的命名空间报错Obj is not a valid object - -适用于:OpenHarmony SDK 3.2.5.3版本,API9 Stage模型 - -检查模块根目录(注意不是工程根目录)下的build-profile.json5文件,如果设备是32位,需要在abiFilters参数中配置armeabi-v7a,如果设备是64位,需要在abiFilters参数中配置arm64-v8a。 - -## 运行Native HAP的时候,报错install parse profile prop check error - -适用于:OpenHarmony SDK 3.2.6.3版本,API9 Stage模型 - -检查模块根目录(注意不是工程根目录)下的build-profile.json5文件,如果设备是32位,需要在abiFilters参数中配置armeabi-v7a,如果设备是64位,需要在abiFilters参数中配置arm64-v8a。 - -## 在Native代码中使用OH_LOG_Print打印日志,报错undefined symbol: OH_LOG_Print - -适用于:OpenHarmony SDK 3.2.6.3版本,API9 Stage模型 - -需要修改CMakeLists.txt文件,在target_link_libraries最后追加libhilog_ndk.z.so。 - -## 如何获取到模块 package.json 文件中的 “version” 值 - -适用于:OpenHarmony SDK 3.2.5.3版本,API9 Stage模型 - -1. 在编译工具Hvigor脚本文件hvigorfile.js中,通过subModule.getPackageJsonPath方法获取module中package.json文件位置。 - -2. 使用nodejs能力读取package.json文件中version字段,写入build-profile.json5文件buildOption.cppFlags字段。 - -示例: - - -``` -// module hvigorfile.js -const subModule = require('@ohos/hvigor')(__filename) - -const fs = require("fs-extra") -const path = require("path") - -const packageJsonPath = subModule.getPackageJsonPath() -const buildProfilePath = path.resolve(packageJsonPath, '../build-profile.json5') -const packageJsonData = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8')) -let buildProfileData = fs.readFileSync(buildProfilePath, 'utf8') -buildProfileData = buildProfileData.replace(/\"cppFlags\"\:(.*)\,/, `"cppFlags": "-D NWEBEX_VERSION=${packageJsonData.version}",`) -fs.writeFileSync(buildProfilePath, buildProfileData, 'utf8') - -const ohosPlugin = require('@ohos/hvigor-ohos-plugin').hapTasks(subModule) // 该插件执行了C++编译任务,读取了build-profile.json5文件 - -module.exports = { - ohos: ohosPlugin -} -``` - - -``` -// hello.cpp 读取 -#define _NWEBEX_VERSION(v) #v -#define _NWEBEX_VER2STR(v) _NWEBEX_VERSION(v) - -static napi_value Add(napi_env env, napi_callback_info info) -{ - - napi_value fixed_version_value = nullptr; - napi_create_string_utf8(env, _NWEBEX_VER2STR(NWEBEX_VERSION), NAPI_AUTO_LENGTH, &fixed_version_value); - - return fixed_version_value; -} -``` - -## 如何遍历rawfiles中的文件 - -适用于:OpenHarmony SDK 3.2版本以上,API9 Stage模型 - -使用Native API中的OH_ResourceManager_OpenRawDir()方法获取到rawfile的根目录,然后对其进行遍历。可参考文档:[Native开发指导](../reference/native-apis/rawfile.md) diff --git a/zh-cn/application-dev/faqs/faqs-network-management.md b/zh-cn/application-dev/faqs/faqs-network-management.md new file mode 100644 index 0000000000000000000000000000000000000000..10f16b87af9246232c846b1b2a28f222dfeea38e --- /dev/null +++ b/zh-cn/application-dev/faqs/faqs-network-management.md @@ -0,0 +1,222 @@ +# 网络管理开发常见问题 + +## http网络请求中extraData支持的数据格式有哪些 + +适用于:OpenHarmony 3.2 Beta API 9 + +**解决措施** + +extraData代表发送请求的额外数据,支持如下数据: + +- 当HTTP请求为POST、PUT方法时,此字段为HTTP请求的content。 +- 当HTTP请求为GET、OPTIONS、DELETE、TRACE、CONNECT方法时,此字段为HTTP请求的参数补充,参数内容会拼接到URL中进行发送。 +- 开发者传入string对象,开发者需要自行编码,将编码后的string传入。 + +## http请求的错误码28是什么意思 + +适用于:OpenHarmony 3.2 Beta API 9 + +**问题现象** + +发起http请求后报错,错误码28。 + +**解决措施** + +错误码28代表CURLE\_OPERATION\_TIMEDOUT,操作超时。网络请求底层使用libcurl库,更多错误码可以查看相应文档。 + +**参考链接** + +[http常见响应码](../reference/apis/js-apis-http.md#responsecode)和[Curl错误码](https://curl.se/libcurl/c/libcurl-errors.html) + +## http请求中response错误码返回6是什么意思 + +适用于:OpenHarmony 3.2 Beta API 9 + +**问题现象** + +发起http请求后,返回信息中response错误码为6。 + +**解决措施** + +错误码6表示地址无法解析主机,可以尝试ping一下request中的URL,确认是否可以ping通。 + +**参考链接** + +更多错误码参考[Response常用错误码](../reference/apis/js-apis-http.md#responsecode)或者[Curl错误码](https://curl.se/libcurl/c/libcurl-errors.html) + +## @ohos/axios三方件post请求queryParams参数场景下如何传参 + +适用于:OpenHarmony 3.2 Beta API 9 + +**问题现象** + +三方件@ohos/axios中发起post请求,以queryParams形式传递参数(将参数拼接在URL后)。 + +**解决措施** + +- 方式一:使用axios.post接口只接收一个参数,Url.URLSearchParams需要转成字符串拼接在url后面。 + + ``` + let params:Url.URLSearchParams = new Url.URLSearchParams() + params.append('ctl', 'sug') + params.append('query', 'wangjunkai') + params.append('cfrom', '1099a') + axios.post('http://10.100.195.234:3000/save?' + params.toString()).then(res => { + this.message = "request result: " + JSON.stringify(res.data); + }).catch(err => { + this.message = "request error: " + err.message; + }) + ``` + +- 方式二:使用axios接口只接收一个config对象,请求参数写在config对象的params中。 + + ``` + axios({ + url: 'http://10.100.195.234:3000/save', + method: 'post', + params: { + ctl: 'sug', + query: 'wangjunkai', + cfrom: '1099a' + } + }).then(res => { + this.message = "request result: " + JSON.stringify(res.data); + }).catch(err => { + this.message = "request error: " + err.message; + }) + ``` + + +## connection.getNetCapabilities\(mNetHandle\)无法正常返回结果 + +适用于:OpenHarmony 3.2 beta2 API 9 + +**问题现象** + +在网络连接管理中,调用connection.getNetCapabilities\(\)函数时无法取到数据。 + +**原因分析** + +this指向存在问题,用\(err,data\)=\>\{\}可以进入回调函数并且拿到返回结果数据,不能使用function\(err,data\),因为function声明的函数内存在自己的this,无法指向全局的this。 + +**解决措施** + +getNetCapabilities的第二个参数把function\(err,data\)改成\(err,data\)。 + +## http请求如何以json形式进行传输 + +适用于:OpenHarmony 3.2 Beta API 9 + +**解决措施** + +在HTTP协议消息头中,使用Content-Type来表示媒体类型信息。它被用来告诉服务端如何处理请求的数据,以及告诉客户端(一般是浏览器)如何解析响应的数据,比如显示图片,解析html或仅仅展示一个文本等。 + +设置该参数值为application/json,请求中的数据就会以json形式进行传输。 + +``` +this.options = { + method: http.RequestMethod.GET, + extraData: this.extraData, + header: { 'Content-Type': 'application/json' }, + readTimeout: 50000, + connectTimeout: 50000 +} +``` + +## 调用camera拍摄的照片如何上传到服务器 + +适用于:OpenHarmony 3.2 Beta5 API 9 + +**问题现象** + +应用调用摄像头拍照后如何将图片上传到服务器? + +**解决措施** + +启动应用,获取权限后系统会访问远程服务器,将拍摄照片保存在本地,通过上传接口将文件从个人手机传送至远程服务器。 + +**参考链接** + +[上传下载](../reference/apis/js-apis-request.md) + +## 手机网络正常,调用connection.hasDefaultNet\(\)接口失败 + +适用于:OpenHarmony 3.2 Beta API 9 + +**问题现象** + +手机可以上网,浏览器可以正常打开网页,但是hasDefaultNet这个方法调用失败,回调函数走到了失败的回调。 + +**解决措施** + +connection.hasDefaultNet 接口需要注明需要权限ohos.permission.GET\_NETWORK\_INFO + +权限申请链接:[访问控制授权申请](../security/accesstoken-guidelines.md) + +## 如何理解connection.getDefaultNet返回对象netHandle中的netId + +适用于:OpenHarmony 3.2 Beta API 9 + +**问题现象** + +netId的值如0、100分别代表什么含义? + +**解决措施** + +正常情况下,netHandle里的netId为0时表示没联网,大于等于100时为有网状态。 + +## 如何使用http请求从网络上获取数据 + +适用于:OpenHarmony 3.2 Beta API 9 + +**解决措施** + +使用@ohos.net.http模块来发起http网络请求。 + +1. 导入http模块,创建http请求对象。 +2. 设置请求地址URLl和参数,发起http请求。 +3. 获取请求结果response,并解析数据。 + +**参考链接** + +详细信息请参考:[http数据请求](../connectivity/http-request.md) + +## 如何使用JS封装网络请求 + +适用于:OpenHarmony 3.2 Beta API 9 + +**解决措施** + +OpenHarmony网络请求支持JS语言开发方式,可直接使用。具体使用参考如下文档:[网络连接](../reference/apis/js-apis-http.md) + +## 基于JS开发智能手表应用,如何编写网络请求 + +适用于:OpenHarmony 3.2 Beta API 9 + +**解决措施** + +OpenHarmony网络请求支持JS语言开发方式,可直接使用。具体使用参考如下文档:[网络连接](../reference/apis/js-apis-http.md) + +## 应用增加权限"ohos.permission.NOTIFICATION\_CONTROLLER",编译后无法启动 + +适用于:OpenHarmony 3.2 Beta API 9 + +**问题现象** + +启动报错:error: install failed due to grant request permissions failed. + +**解决措施** + +权限"ohos.permission.NOTIFICATION\_CONTROLLER为系统级“system core”权限,第三方应用无法获取该权限。 + +## WiFi模块中使用wifi.getIpInfo\(\).ipAddress报错 + +适用于:OpenHarmony 3.2Beta API 9 + +**问题现象** + +WiFi模块中使用wifi.getIpInfo\(\).ipAddress,报错Error: assertion \(wifiDevicePtr != nullptr\) failed: Wifi device instance is null + +**解决措施** + +权限不足。请先检查是否申请了相关的操作权限,权限相关信息可参考[权限管理](../security/accesstoken-overview.md)。 diff --git a/zh-cn/application-dev/faqs/faqs-sdk.md b/zh-cn/application-dev/faqs/faqs-sdk.md new file mode 100644 index 0000000000000000000000000000000000000000..ec62b97108d16192f52ebeea388e589a7f289dfc --- /dev/null +++ b/zh-cn/application-dev/faqs/faqs-sdk.md @@ -0,0 +1,41 @@ +# SDK使用常见问题 + +## cmake中arm64-v8a/armeabi-v7a这层目录的宏定义是什么 + +适用于:OpenHarmony 3.1 Beta5 API 9 + +**解决方案** + +arm64-v8a及armeabi-v7a目录如下所示: + +``` +entry +├─ libs +│ ├─ arm64-v8a +│ │ └─ libMyDemo.so +│ └─ armeabi-v7a +│ └─ libMyDemo.so +└─ src + └─ main + └─ cpp + └─ CMakeLists.txt +``` + +访问到目录的宏定义为:\$\{CMAKE\_CURRENT\_SOURCE\_DIR\}/../../../libs/$\{OHOS\_ARCH\}/xxxx.so + +CMAKE\_CURRENT\_SOURCE\_DIR:CMakeList.txt文件所在目录。 + +OHOS\_ARCH:设置应用程序二进制接口ABI,类型为 armeabi-v7a、arm64-v8a,默认值是 arm64-v8a。 + +**使用示例** + +CMakeLists.txt 中添加链接库。 + +``` +target_link_libraries(entry PUBLIC + libace_napi.z.so + libhilog_ndk.z.so + ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/${OHOS_ARCH}/libMyDemo.so +) +``` + diff --git a/zh-cn/application-dev/faqs/faqs-security.md b/zh-cn/application-dev/faqs/faqs-security.md new file mode 100644 index 0000000000000000000000000000000000000000..a84831563487cd51fb8a1b25c7b18a7fbe7ec2e4 --- /dev/null +++ b/zh-cn/application-dev/faqs/faqs-security.md @@ -0,0 +1,42 @@ +# 安全基础能力开发常见问题 + +## HUKS中AES GCM模式加密,单次最多可对多少字节数据加密 + +适用于:OpenHarmony 3.1 Beta5 API 9 + +**解决措施** + +HUKS中AES GCM模式加密时,单次最多可对64字节的数据进行加密。 + +**代码示例** + +``` +/* 进行密钥加密操作 */ +await huks.init(srcKeyAlias, encryptOptions).then((data) => { + console.info(`test init data: ${JSON.stringify(data)}`); + handle = data.handle; +}).catch((err) => { + console.info('test init err information: ' + JSON.stringify(err)); +}); +encryptOptions.inData = aesCipherStringToUint8Array(cipherInData.slice(0,64)); // 截取64字节 +await huks.update(handle, encryptOptions).then(async (data) => { + console.info(`test update data ${JSON.stringify(data)}`); + encryptUpdateResult = Array.from(data.outData); +}).catch((err) => { + console.info('test update err information: ' + err); +}); +encryptOptions.inData = aesCipherStringToUint8Array(cipherInData.slice(64,80)); // 剩余数据 +``` + +## 在CryptoFramework中,打印Md的digest接口返回结果为乱码 + +适用于:OpenHarmony 3.1 Beta5 API 9 + +**问题现象** + +在CryptoFramework中,打印Md的digest接口返回结果显示为乱码,无法识别。 + +**解决措施** + +digest接口返回的Md计算结果DataBlob是Uint8Array类型,需要转成十六进制字符串再打印,也可以用网页在线版MD5加密工具验证结果。 + diff --git a/zh-cn/application-dev/faqs/faqs-sensor.md b/zh-cn/application-dev/faqs/faqs-sensor.md new file mode 100644 index 0000000000000000000000000000000000000000..19a1a3a9d4061be371c6e9a410f0726dd9d0a8de --- /dev/null +++ b/zh-cn/application-dev/faqs/faqs-sensor.md @@ -0,0 +1,8 @@ +# 泛Sensor服务开发常见问题 + +## 是否对个人开发者开放PPG和ECG血压监测传感器的的数据获取接口 + +适用于OpenHarmony 3.1 Beta5 API 9 + +PPG和ECG的血压监测传感器属于可穿戴设备传感器,传感器数据设计个人隐私数据,暂未对个人开发者开放接口。 + diff --git a/zh-cn/application-dev/faqs/faqs-startup.md b/zh-cn/application-dev/faqs/faqs-startup.md new file mode 100644 index 0000000000000000000000000000000000000000..6a19051ba01a6f61ffa1825133503d10b9c639ec --- /dev/null +++ b/zh-cn/application-dev/faqs/faqs-startup.md @@ -0,0 +1,44 @@ +# 启动恢复开发常见问题 + +## 如何获取设备系统版本 + +适用于Openharmony 3.2 Beta5 API 9 + +**解决措施** + +可通过[deviceInfo](../reference/apis/js-apis-device-info.md)对象的osFullName属性获取设备系统版本。 + +**代码示例** + +``` +import deviceInfo from '@ohos.deviceInfo' +let v = deviceInfo.osFullName +``` + +## OpenHarmony设备如何获取UDID + +适用于Openharmony 3.2 Beta5 API 9 + +**解决措施** + +- 方式一:通过命令行(hdc shell bm get --udid)查询。 +- 方式二:在代码中获得,请参考文档[udid](../reference/apis/js-apis-device-info.md)。 + +## 如何获取设备信息 + +适用于Openharmony 3.2 Beta5 API 9 + +可以使用deviceInfo模块获取设备信息,如设备型号等。 + +**参考链接** + +[设备信息](../reference/apis/js-apis-device-info.md) + +## 开发中如何实现App不被屏保中断 + +适用于Openharmony 3.2 Beta5 API 9 + +**解决方案** + +输入命令hdc shell "power-shell setmode 602" 可达到不息屏的效果。 + diff --git a/zh-cn/application-dev/faqs/faqs-third-fourth-party-library.md b/zh-cn/application-dev/faqs/faqs-third-fourth-party-library.md new file mode 100644 index 0000000000000000000000000000000000000000..887f1862bb7f9a4fe5208786bfa00109bdfdbc1b --- /dev/null +++ b/zh-cn/application-dev/faqs/faqs-third-fourth-party-library.md @@ -0,0 +1,72 @@ +# 三四方库使用常见问题 + +## 如何获取可用的三方库 + +适用于OpenHarmony 3.1 Beta5 API 9 + +通过ohpm可以获取的三四方库在Gitee上做了汇总([OpenHarmony上可直接使用的三方组件汇总](https://gitee.com/openharmony-tpc/tpc_resource)),针对于不同功能三方库内容做了分类,开发者可以根据需要进行参考。 + +## 网络相关的三方库有哪些 + +适用于OpenHarmony 3.1 Beta5 API 9 + +网络相关的三方库有[Axios](https://gitee.com/openharmony-sig/axios)、httpclient、okdownload等,具体分类可以参考[三四方库网络分类](https://gitee.com/openharmony-tpc/tpc_resource?_from=gitee_search#%E7%BD%91%E7%BB%9C)。 + +## 如何使用ohpm引入三四方库 + +适用于OpenHarmony 3.1 Beta5 API 9 + +**解决措施** + +- 方式一: + 1. 打开Terminal窗口,通过如下指令进入到entry目录。 + + ``` + cd entry + ``` + + 2. 以引入“dayjs”为例,执行以下指令进行安装。 + + ``` + ohpm install dayjs + ``` + + 3. 在对应的js文件中直接引用。 + + ``` + import dayjs from 'dayjs'; + ``` + + +- 方式二: + 1. 打开工程目录下的entry目录,找到该目录下的oh-package.json5文件。 + 2. 在oh-package.json5文件中写入想要安装的三方库,以“dayjs”为例,示例如下: + + ``` + { + "dependencies": { + "dayjs": "^1.10.4", + } + } + ``` + + 3. 打开Terminal窗口,通过如下指令进入到entry目录。 + + ``` + cd entry + ``` + + 4. 执行指令进行安装。 + + ``` + ohpm install + ``` + + 5. 在对应的js文件中直接引用。 + + ``` + import dayjs from 'dayjs'; + ``` + + + diff --git a/zh-cn/application-dev/faqs/faqs-third-party-library.md b/zh-cn/application-dev/faqs/faqs-third-party-library.md deleted file mode 100644 index a15136dfb734e626c50c6fb7875c842a3f9d0764..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/faqs/faqs-third-party-library.md +++ /dev/null @@ -1,74 +0,0 @@ -# 三四方库使用常见问题 - -## 报错“Stage model module … does not support including OpenHarmony npm packages or modules in FA model. OpenHarmony build tasks will not be executed, and OpenHarmony resources will not be packed. ”如何解决 - -适用于:OpenHarmony SDK 3.2.5.3版本,API9 Stage模型 - -三四方件未适配API9 Stage模型,无法使用。 - -## 项目是否支持传递依赖 - -适用于:OpenHarmony SDK 3.2.5.3版本,API9 Stage模型 - -比如项目A依赖项目B,项目B依赖项目C,那项目A是否能直接使用项目C提供的接口? - -不支持。由于项目打包使用npm工具,npm不支持传递依赖。可以在项目A增加项目C的依赖来解决问题。 - -## 如何获取可用的三方库 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -参见:[OpenHarmony上可直接使用的三方组件汇总](https://gitee.com/openharmony-sig/third_party_app_libs)。 - -## 网络相关的三方库有哪些 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -网络相关的三方库有[Axios](https://gitee.com/openharmony-sig/axios)。 - -## 如何使用npm引入三四方库 - - 适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 -- 方法一: - 1. 打开Terminal窗口,通过如下指令进入到entry目录。 - - ``` - cd entry - ``` - 2. 以引入“dayjs”为例,执行以下指令进行安装。 - - ``` - npm install dayjs --save - ``` - 3. 在对应的js文件中直接引用。 - - ``` - import dayjs from 'dayjs'; - ``` - -- 方法二: - 1. 打开工程目录下的entry目录,找到该目录下的package.json文件。 - 2. 在package.json文件中写入想要安装的三方npm,以“dayjs”为例,示例如下: - - ``` - { - "dependencies": { - "dayjs": "^1.10.4", - } - } - ``` - 3. 打开Terminal窗口,通过如下指令进入到entry目录。 - - ``` - cd entry - ``` - 4. 执行指令进行安装。 - - ``` - npm install - ``` - 5. 在对应的js文件中直接引用。 - - ``` - import dayjs from 'dayjs'; - ``` diff --git a/zh-cn/application-dev/faqs/faqs-ui-ets.md b/zh-cn/application-dev/faqs/faqs-ui-ets.md deleted file mode 100644 index 65d9f47c91cdc8bb2d9c680c03c55723ef4ce133..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/faqs/faqs-ui-ets.md +++ /dev/null @@ -1,648 +0,0 @@ -# ArkUI组件(ArkTS)开发常见问题 - -## 在Stage模型下,如何通过router实现页面跳转 - -适用于:OpenHarmony SDK 3.2.5.3版本,API9 Stage模型 - -1. 对于通过页面路由router实现页面跳转,首先要在main_pages.json配置文件中将所有跳转的页面加入pages列表; - -2. 页面路由需要在页面渲染完成之后才能调用,在onInit和onReady生命周期中页面还处于渲染阶段,禁止调用页面路由方法。 - -参考文档:[页面路由](../reference/apis/js-apis-router.md) - -## router通过调用push方法进堆栈的page是否会被回收 - -适用于:OpenHarmony SDK 3.2.5.3版本,API9 Stage模型 - -调用push进入堆栈的page不回收,调用back方法出栈后可以被回收。 - -## 如何将容器定位到屏幕的最底部? - -适用于:OpenHarmony SDK 3.2.3.5版本, API9 Stage模型 - -可以使用Stack堆叠容器,设置子组件在容器内的最底部。 - - 示例: - -``` -build() { - Stack({alignContent : Alignment.Bottom}) { - //容器位于最底部 - Stack() { - Column() - .width('100%') - .height('100%') - .backgroundColor(Color.Yellow) - } - .width('100%') - .height('10%') - } - .width('100%') - .height('100%') - .backgroundColor('rgba(255,255,255, 0)') -} -``` - -## CustomDialog是否支持在TS文件中使用 - -适用于:OpenHarmony SDK 3.2.2.5版本,API9 Stage模型 - -不支持,CustomDialog当前只支持在ArkTS的Page中使用。 - -参考文档:[自定义弹窗](../reference/arkui-ts/ts-methods-custom-dialog-box.md) - -## 如何将CustomDialog中的变量传递给Page页面中的变量 - -适用于:OpenHarmony SDK 3.2.2.5版本,API9 Stage模型 - -利用自定义的回调函数,当点击弹窗的confirm按钮时,将data数据从自定义弹窗组件中传递给当前的page的页面。 - -示例: - - -``` -// 弹窗组件 -@CustomDialog -struct MyDialog { - controller: CustomDialogController - title: string - confirm: (data: string) => void - data: string = '' - - build() { - Row() { - Column({ space: 10 }) { - Text(this.title) - .fontSize(30) - .fontColor(Color.Blue) - TextInput({ placeholder: "输入内容", text: this.data }) - .onChange((data) => { - this.data = data // 获取输入框数据 - }) - Button('confirm') - .onClick(() => { - this.confirm(this.data) // 将输入框数据通过回调函数传给主页面 - this.controller.close() - }).backgroundColor(0xffffff).fontColor(Color.Red) - }.width("50%") - }.height("50%") - } -} - -// main页面 -@Entry -@Component -struct DialogTest { - @State dialogTitle: string = '' - @State dialogData: string = '' - dialogController: CustomDialogController = new CustomDialogController({ - builder: MyDialog({ - title: this.dialogTitle, // 绑定数据 - data: this.dialogData, - confirm: this.confirm.bind(this) // 绑定自定义的回调函数,这里要修改this的指向 - }) - }) - - confirm(data: string) { - this.dialogData = data - console.info(`recv dialog data: ${data}`) // 获取弹窗输入的信息 - } - - build() { - Row() { - Column({ space: 10 }) { - Button('点击打开弹窗') - .onClick(() => { - this.dialogTitle = '弹窗' - this.dialogController.open() - }) - Text(`接受弹窗的数据:`) - .fontSize(20) - TextInput({ placeholder: "输入内容", text: this.dialogData }) - .width("50%") - .onChange((data) => { - this.dialogData = data // 获取输入框数据 - }) - }.width("100%") - }.height("100%") - } -} -``` - -## List组件上添加了Text组件后,List组件无法拖动到底部 - -适用于:OpenHarmony SDK 3.2.5.3版本,API9 Stage模型 - -在List的父容器加上代码layoutWeight(1)。原理:List属于可滚动容器组件,默认高度是占满全屏幕高度,当出现其他固定高度的组件占领了屏幕的部分高度时,需要开发人员显性的指定List组件占满剩余高度,而不是全屏幕高度。 - -## 栅格布局子组件如何居中? - -适用于:OpenHarmony SDK 3.2.5.3版本,API9 Stage模型 - -GridContainer内子组件默认水平左对齐,居中显示可以参考以下处理方式: - -内部嵌套布局组件Row,设置Row属性justifyContent(FlexAlign.Center),内部嵌套子组件可保持居中显示,参考[栅格布局](../reference/arkui-ts/ts-container-gridcontainer.md)文档。 - - 示例: - -``` -GridContainer({ sizeType: SizeType.SM, columns: 12 }) { - Row() { - Text('1') - .useSizeType({ - sm: { span: 4, offset: 0 }, - }) - .backgroundColor(0x46F2B4) - }.justifyContent(FlexAlign.Center) // 该属性设置使子组件居中显示 -} -``` - -## 如何获取状态栏和导航栏高度? - -适用于:OpenHarmony SDK 3.2.5.3版本,API9 Stage模型 - -在加载窗口内容之前,采用systemAvoidAreaChange事件监听。 - - 示例: - -```ts -import Window from '@ohos.window'; -import UIAbility from '@ohos.app.ability.UIAbility'; - -/** - * 设置沉浸式窗口,并获取状态栏和导航栏高度 - * @param mainWindow 主窗口对象 - */ -async function enterImmersion(mainWindow: window.Window) { - mainWindow.on("systemAvoidAreaChange", (area: window.AvoidArea) => { - AppStorage.SetOrCreate("topHeight", area.topRect.height); - AppStorage.SetOrCreate("bottomHeight", area.bottomRect.height); - }) - await mainWindow.setFullScreen(true) - await mainWindow.setSystemBarEnable(["status", "navigation"]) - await mainWindow.sArkTSystemBarProperties({ - navigationBarColor: "#00000000", - statusBarColor: "#00000000", - navigationBarContentColor: "#FF0000", - statusBarContentColor: "#FF0000" - }) -} -export default class EntryAbility extends UIAbility { - // do something - async onWindowStageCreate(windowStage: window.WindowStage) { - let mainWindow = await windowStage.getMainWindow() - await enterImmersion(mainWindow) - windowStage.loadContent('pages/index') - } - // do something -} -``` - -## 在容器组件嵌套的场景下,如何解决手势拖拽事件出现错乱的问题 - -适用于:OpenHarmony SDK 3.2.5.3版本,API9 Stage模型 - -gesture的属性distance默认值是5,把gesture的属性distance设成1就可以解决。 - -## 如何获取组件的高度 - -适用于:OpenHarmony SDK 3.2.3.5版本,API9 Stage模型 - -组件宽高变化可通过onAreaChange组件区域变化事件获取。 - -示例: - - -```ts -Column() { - Text(this.value) - .backgroundColor(Color.Green).margin(30).fontSize(20) - .onClick(() => { - this.value = this.value + 'Text' - }) - .onAreaChange((oldValue: Area, newValue: Area) => { - console.info(`Ace: on area change, oldValue is ${JSON.stringify(oldValue)} value is ${JSON.stringify(newValue)}`) - this.size = JSON.stringify(newValue) - }) -``` - -## 如何获取List组件的偏移量 - -适用于:OpenHarmony SDK 3.2.3.5版本,API9 Stage模型 - -List组件绑定Scoller控制器,通过currentOffset方式获取当前的滚动偏移量。 - -示例: - - -```ts -Column() { - List({ space: 20, initialIndex: 0,scroller: this.scroller}) { - ForEach(this.arr, (item) => { - ListItem() { - Text('' + item) - .width('100%').height(100).fontSize(16) - .textAlign(TextAlign.Center).borderRadius(10).backgroundColor(0xFFFFFF) - }.editable(true) - }, item => item) - } - .listDirection(Axis.Vertical) // 排列方向 - .editMode(this.editFlag) - .onScroll((xOffset: number, yOffset: number) => { - console.info("yOffset======="+this.scroller.currentOffset().yOffset) - }) -}.width('100%') -``` - -## 页面使用router携带param跳转后,下一个页面如何获取param - -适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 - - -```ts -// 3.1.5.5版本之前,取值方式为:router.getParams().key -private value: string = router.getParams().value; -// 从3.1.6.5版本起,取值方式为:router.getParams()['key'] -private value: string = router.getParams()['value']; -``` - -## RichText组件是否支持跳转到本地page页面 - -适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 - -不支持。 - -## 使用router或Navigator实现页面跳转时,如何关闭页面间转场动效 - -适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 - -1. 参考[页面间转场示例](../reference/arkui-ts/ts-page-transition-animation.md#示例)在当前页面和目标页面中定义pageTransition方法。 - -2. 将页面入场组件PageTransitionEnter和页面退场组件PageTransitionExit的动效参数duration都设置为0。 - -## UI开发中,像素单位如何选择 - -适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 - -Vp保证了不同分辨率下 视觉效果的等价性,比如一个图标,在不同分辨率下都是视觉效果是等价。 - -lpx相当于百分比视图,按比例扩大或者缩小。 - -如果关注Item等效性的,比如按钮、文字、列表基本上都是VP;比如关注布局,比如1/2之类的网格,lpx更好。 - -## ArkTS中颜色的格式说明 - -适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 - -颜色可以使用两种格式,例如 0x7F000000 或者 '\#7F000000' ,其中前两位是透明度,后六位是RGB。 - - -```ts -fontColor(0x7F000000) -fontColor( '#7F000000' ) -``` - -## 如何在Page页面中监听返回操作 - -适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 - -在Page页面返回时,系统会调用\@Entry修饰的自定义组件的onBackPress()回调,可以在回调函数中实现相关业务诉求。参考[自定义组件生命周期回调函数](../ui/ui-ts-custom-component-lifecycle-callbacks.md) - -## TextInput组件密码模式下,右边的眼睛图标是否支持自定义? - -适用于:OpenHarmony SDK3.0, API9 Stage模型 - -TextInput组件设置type为InputType.Password时,右侧出现眼睛图标,showPasswordIcon控制图标显示隐藏,不支持自定义。更多信息可参考文档:[TextInput组件](../reference/arkui-ts/ts-basic-components-textinput.md) - -## Image图片加载目前只能加载https的,不能加载http的 - -适用于:OpenHarmony SDK3.2.5.5, API9 Stage模型 - -http是不安全的,会被白名单过滤掉,建议使用https。 - -## TextView布局设置间距与显示界面不符合 - -适用于:OpenHarmony SDK3.2.5.5, API9 Stage模型 - -TextView默认设置align属性为居中,文本从左到右显示,需要设置align属性为Start。 - -## constraintSize尺寸设置不生效 - -适用于:OpenHarmony SDK3.0, API9 Stage模型 - -constraintSize约束组件尺寸时,子组件内设置百分比宽度,例如width('100%')会采用constraintSize约束中的最大宽乘百分比,导致撑开组件,看起来constraintSize设置没生效 - -## 如何将背景颜色设置为透明 - -适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 - -将backgroundColor设置为 '\#00000000' 。 - -## Scroll组件滚动到达不了最底部 - -适用于:OpenHarmony SDK3.0, API9 Stage模型 - -Scroll组件在未设置高度情况下,默认为窗口高度,当滚动区域外存在其他组件时,滚动底部区域会出现遮挡,需要设置Scroll高度,或者使用Flex布局限制Scroll高度 - -## 输入框组件TextInput回车事件onSubmit使用 - -适用于:OpenHarmony SDK3.0, API9 Stage模型 - -onSubmit事件在回车键或软键盘回车触发该回调,参数为当前软键盘回车键类型,通过enterKeyType属性可以设置输入法回车键类型,软键盘回车键样式需要输入法的支持,具体文档参考[Textinput组件](../reference/arkui-ts/ts-basic-components-textinput.md) - -## 页面路由时,页面栈内的数量限制是多少 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -页面路由栈支持的最大页面数量是32,当超出此限制时,使用router.push接口页面无法完成跳转 。 - -## ArkUI是否支持通过代码动态创建组件 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -支持使用[条件渲染](../quick-start/arkts-rendering-control.md#条件渲染)和[循环渲染](../quick-start/arkts-rendering-control.md#循环渲染)等方式进行动态创建组件。 - -## 页面路由携带PixelMap对象参数,跳转页面无法获取 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -页面路由只支持普通对象类型,普通JSON数据结构,可以采用localStorage存储PixelMap对象,在跳转页面获取 - -## TextInput组件在onEditChange激活的时候通过.caretPosition(0)让光标回到起点 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -onEditChange事件在输入框聚焦时触发,这时光标位置和手势触发位置有关,在使用caretPosition同步处理无法改变光标位置,需要使用异步处理,在setTimeout中执行可以进行 - -## TextInput是否有方法设置内容为全部选中 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -TextInput组件暂不支持设置内容全选。 - -## input的输入框的type属性是date,但无法选择时间 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -input 组件的 type 设置为 date,只是会有相关格式提示,本质上还是输入控件,如果需要实现日期选择效果,需要使用 picker 组件。 - -## ArkTS TextInput输入时,弹出的输入法框把页面布局挤压变形 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -用Flex布局就会有挤压变形情况,改成Column布局就不会产生挤压 - -## 子组件使用\@Link修饰成员变量时,父组件传值如何传值 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -子组件使用\@Link修饰时,父组件传值需要添加"$" - -示例: - - -``` -@Component -struct FoodImageDisplay { - @Link imageSrc: Resource - - build() { - Stack({ alignContent: Alignment.BottomStart }) { - Image(this.imageSrc) - .objectFit(ImageFit.Contain) - Text('Tomato') - .fontSize(26) - .fontWeight(500) - .margin({ left: 26, bottom: 17.4 }) - } - .backgroundColor('#FFedf2f5') - .height(357) - } -} - -@Entry -@Component -struct FoodDetail { - - @State imageSrc: Resource = $r('app.media.Tomato') - - build() { - Column() { - FoodImageDisplay({imageSrc:$imageSrc}) - } - .alignItems(HorizontalAlign.Center) - } -} -``` - -## 如何多个pageAbility之间共享变量 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -1. 可以使用轻量级数据库 - -2. 可以使用持久化数据管理 - -3. 可以使用emitter事件通信 - - -## 如何自定义Video组件控制栏样式 - -适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 - -1. 通过设置属性controls为false关闭默认控制栏 - -2. 设置Video组件的controller - -3. 通过ArkTS实现自定义的控制栏,并通过VideoController控制视频播放 - -## 对ArkTS组件多次更新时如何优化性能 - -适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 - -通过将需要更新的ArkTS组件抽离成自定义组件,并更新该自定义组件内\@State绑定的变量,以此实现组件的局部刷新。 - -## 如何优化Tab组件性能 - -适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 - -Tab组件处于某一页签时。其他页签并不会被系统卸载,所以会占用部分内存。可以通过if渲染控制判断当前页签是否是需要显示的页签,若不是则不加载,以此来实现卸载其他不显示的页签并释放这部分内存。 - -## 如何设置组件不同状态下的样式 - -适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 - -通过设置组件的多态样式,实现组件不同状态(无状态、按下、禁用、聚焦、点击)的样式 - -参考文档:[多态样式](../reference/arkui-ts/ts-universal-attributes-polymorphic-style.md) - -## 焦点事件onBlur/onFocus回调无法触发 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -焦点事件默认情况下需要外接键盘的Tab键,或方向键触发,点击触发焦点事件需要添加焦点控制属性focusOnTouch - -参考文档:[焦点控制](../reference/arkui-ts/ts-universal-attributes-focus.md) - -## Scroll内Flex加宽高与滑动冲突 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -Scroll支持单个子组件,子组件高度应由内容高度决定,当内容中存在异步加载的图片组件导致滚动布局异常时,可约束子组件最小高度constraintSize({ minHeight: '100%' }) - -## 页面路由跳转后如何阻止其返回原页面 - -适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 - -通过router.clear()接口清空页面栈中的所有历史页面,保留当前页面作为栈顶页面。 - -参考文档:[页面路由](../reference/apis/js-apis-router.md) - -## 如何实现将TextInput组件内容进行一次性清空 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -可以参考如下实现: - - -``` -struct Index { -@State text: string = 'Hello World' -controller: TextInputController = new TextInputController() - build() { - Row() { - Column() { - TextInput({ placeholder: 'Please input your words.', text: this.text, - controller:this.controller}).onChange((value) => { - this.text = value - }) - Button("Clear TextInput").onClick(() => { - this.text = ""; - }) - } - .width('100%') - } - .height('100%') - } -} -``` - -## Tabs组件在点击Tab项时是否支持禁止切换 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -不支持。 - -## 使用 \@state修饰成员变量“id”会报错,报错原因:TypeError: cannot read property 'get' of undefined - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -id添加为唯一值,成为关键字。 - -## 基于OpenHarmony开发的应用,是否支持使用fontFamily属性设置不同的字体 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -基于OpenHarmony开发的应用,默认字体'HarmonyOS Sans',且当前只支持这种字体。 - -## Ability与UI页面推荐的数据交互方式是什么 - -适用于:OpenHarmony SDK 3.2.7.5版本,API9 Stage模型 - -推荐使用[LocalStorage](../quick-start/arkts-state-mgmt-application-level.md#localstorage)。 - -## 父组件如何与其孙子组件进行状态同步 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -- 方式一(推荐):使用\@Provide和\@Consume装饰器。在父组件使用\@Provide,在孙子组件使用\@Consume,可以实现父组件和孙子组件进行双向数据绑定。 - -- 方式二:使用\@State和\@Link装饰器。在父组件使用\@State,在每一层子组件(子组件和孙子组件)都使用\@Link。 - -## 字符超长中间显示省略号 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -代码示例 - - -``` -beautySub(str,len) { - var reg = /[\u4e00-\u9fa5]/g; - //减少字符,达到优化 - var slice = str.substring(0,len) - var charNum = (~~(slice.match(reg) && slice.match(reg).length)) - //减1是为了处理万一超过字符串,不显示多一个不是汉字的字符, - var realen = slice.length*2 - charNum-1 - return str.substr(0,realen) + (realen < str.length ? "..." : "") +str.substr(str.length-realen,str.length) -} -``` - -## richText 组件怎么加上滚动条 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -RichText底层是web,可以参考html的语法,在div上加上的overflow:auto的滚动样式。 - -## scroll里面套一个grid,怎么禁用grid的滑动事件? - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -可以通过onScrollBegin事件和scrollBy方法实现容器嵌套滚动。 - -参考:[容器嵌套滚动样例](../reference/arkui-ts/ts-container-scroll.md#示例2) - -## 能否去除自定义弹窗组件的白色背景 - -适用于:OpenHarmony SDK 3.2.7.5版本,API9 Stage模型 - -当前不支持。原因是当前的UI样式在框架后端写死了,无法更改。 - -## 组件背景图片设置backgroundImage方法是否支持svg图片格式 - -适用于:OpenHarmony SDK 3.2.7.5版本,API9 Stage模型 - -当前不支持。 - -## 自定义弹窗组件如何设置弹窗位置 - -适用于:OpenHarmony SDK 3.2.7.5版本,API9 Stage模型 - -自定义弹窗组件中参数alignment可以指定弹窗的位置。比如设置弹窗在底部:alignment : DialogAlignment.Bottom。 - -参考文档:[自定义弹窗](../reference/arkui-ts/ts-methods-custom-dialog-box.md) - -## scroller如何判断回弹动画的结束误差 - -适用于:OpenHarmony SDK 3.2.5.3版本,API8 FA模型 - -目前可以在触摸结束之后,计算同方向的变化,如果变化方向相反,说明出现回弹了,就规避不处理了。 - - -## 如何实现应用数据持久化存储 - -通过PersistentStorage类实现管理应用持久化数据,可以将特定标记的持久化数据链接到AppStorage中,并由AppStorage接口访问对应持久化数据。 - -参考文档:[持久化数据管理](../quick-start/arkts-state-mgmt-application-level.md#persistentstorage) - -示例: - - -``` -AppStorage.Link('varA') -PersistentStorage.PersistProp("varA", "111"); -@Entry -@Componentstruct Index { - @StorageLink('varA') varA: string = '' - build() { - Column() { - Text('varA: ' + this.varA).fontSize(20) - Button('Set').width(100).height(100).onClick(() => { - this.varA += '333' - }) - } - .width('100%') - .height('100%') - } -} -``` diff --git a/zh-cn/application-dev/faqs/faqs-ui-js.md b/zh-cn/application-dev/faqs/faqs-ui-js.md deleted file mode 100644 index 39e7c8ac2a5885f516e7e2f04f17e4976887f22b..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/faqs/faqs-ui-js.md +++ /dev/null @@ -1,94 +0,0 @@ -# UI框架(JS)开发常见问题 - -## 如何取出xml文件中对应的字段 - -适用于:OpenHarmony SDK 3.2.3.5版本, API9 Stage模型 - -convertxml中convert方法提供了转换xml文本为JavaScript对象的能力。 - -示例: - - -``` -import convertxml from '@ohos.convertxml'; -// xml格式的字符串 -let xml = - '' + - '' + - ' Happy' + - ' Work' + - ' Play' + - ''; -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" -} -let result: any = conv.convert(xml, options) // 将xml文本转为JS对象 -console.log('Test: ' + JSON.stringify(result)) -console.log('Test: ' + result._declaration._attributes.version) // xml字符串中version字段信息 -console.log('Test: ' + result._elements[0]._elements[0]._elements[0]._text) // xml字符串中title字段内容 -``` - -参考文档:[xml转换JavaScript](../reference/apis/js-apis-convertxml.md) - -## 如何将时间转为时分秒格式 - -示例: - - -``` -export default class DateTimeUtil{ - /** - * 时分秒 - */ - getTime() { - const DATETIME = new Date() - return this.concatTime(DATETIME.getHours(),DATETIME.getMinutes(),DATETIME.getSeconds()) - } - /** - * 年月日 - */ - getDate() { - const DATETIME = new Date() - return this.concatDate(DATETIME.getFullYear(),DATETIME.getMonth()+1,DATETIME.getDate()) - } - /** - * 日期不足两位补充0 - * @param value-数据值 - */ - fill(value:number) { - return (value> 9 ? '' : '0') + value - } - /** - * 年月日格式修饰 - * @param year - * @param month - * @param date - */ - concatDate(year: number, month: number, date: number){ - return `${year}${this.fill(month)}${this.fill(date)}` - } - /** - * 时分秒格式修饰 - * @param hours - * @param minutes - * @param seconds - */ - concatTime(hours:number,minutes:number,seconds:number){ - return `${this.fill(hours)}${this.fill(minutes)}${this.fill(seconds)}` - } -} - -``` \ No newline at end of file diff --git a/zh-cn/application-dev/faqs/faqs-web-arkts.md b/zh-cn/application-dev/faqs/faqs-web-arkts.md deleted file mode 100644 index e295e4146d16fc5a890b694dd8ce410a7e1ae3c7..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/faqs/faqs-web-arkts.md +++ /dev/null @@ -1,79 +0,0 @@ -# ArkUI Web组件(ArkTS)开发常见问题 - -## Web组件domStorageAccess属性设置 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -设置是否开启文档对象模型存储接口(DOM Storage API)权限,默认未开启,控制web网页中localStorage的使用,对sessionStorage未做控制 - -## Web组件加载的html页面内如何检测网络状态 - -适用于:OpenHarmony SDK 3.2.7.5版本,API9 Stage模型 - -1. 配置应用权限:ohos.permission.INTERNET 、 ohos.permission.GET_NETWORK_INFO - -2. html中通过window.navigator.onLine获取网络状态 - -## Web组件加载h5页面,首次加载无法设置拼接UserAgent参数 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -默认UserAgent通过WebController获取。一个WebController对象只能控制一个Web组件,且必须在Web组件和WebController绑定后,才能调用WebController上的方法,因此在初次加载前设置默认UserAgent + 自定义字符串拼接,可采用此方式: - -1. 使用\@State定义初始userAgent,绑定到Web组件; - -2. 在web组件的onUrlLoadIntercept回调中,通过WebController获取默认userAgent,修改Web组件绑定的userAgent。 - 参考代码如下: - - - ``` - @Entry - @Component - struct Index { - private controller: WebController = new WebController() - @State userAgentPa: string = '' - build() { - Row() { - Column() { - Web({ src: 'www.example.com', controller: this.controller }) - .width('100%') - .userAgent(this.userAgentPa) - .onUrlLoadIntercept((event) => { - let userAgent = this.controller.getDefaultUserAgent(); - this.userAgentPa = userAgent + ' 111111111' - console.log("userAgent onUrlLoadIntercept: " + userAgent); - return false; - }) - } - .width('100%').alignItems(HorizontalAlign.Start).backgroundColor(Color.Green) - } - .height('100%') - } - } - ``` - -## 加载Lottie动画的逻辑应该写在onAppear函数中还是应该写在onReady函数中 - -适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 - -onAppear方法只是定位完Canvas的位置,onReady方法才是测量完成,加载动画的逻辑应该写在onReady函数中。 - -## 调用deleteJavaScriptRegister后是否需要调用refresh接口 - -适用于:所有版本 - -不需要。 - -## 页面如何传递数据给Web组件 - -适用于:OpenHarmony SDK 3.2.7.5版本,API9 Stage模型 - -1. 使用WebController创建两个消息端口。 - -2. 将消息端口1发送到HTML侧,由HTML侧保存并使用。 - -3. 将消息端口0在应用侧注册回调事件。 - -4. 使用应用侧的端口0给HTML侧消息端口1发送消息。 - -使用参考:[Web组件](../reference/arkui-ts/ts-basic-components-web.md#postmessage9) diff --git a/zh-cn/application-dev/faqs/faqs-window-manager.md b/zh-cn/application-dev/faqs/faqs-window-manager.md new file mode 100644 index 0000000000000000000000000000000000000000..e2cb6b2fbd358cac246d421f01d69564800c880c --- /dev/null +++ b/zh-cn/application-dev/faqs/faqs-window-manager.md @@ -0,0 +1,65 @@ +# 窗口管理开发常见问题 + +## 如何获取状态栏和导航栏高度 + +适用于OpenHarmony 3.2 Beta5 API 9 + +**解决措施** + +在加载窗口内容之前,采用systemAvoidAreaChange事件监听。 + +**代码示例** + +``` +// MainAbility.ts +import window from '@ohos.window'; + +/** + * 设置沉浸式窗口,并获取状态栏和导航栏高度 + * @param mainWindow 主窗口对象 + */ +async function enterImmersion(mainWindow: window.Window) { + mainWindow.on("systemBarTintChange", (data) => { + let avoidAreaRect = data.regionTint[0].region; //data.regionTint是个数组,包含状态栏、导航栏的矩形区域坐标。 + }) + await mainWindow.setFullScreen(true) + await mainWindow.setSystemBarEnable(["status", "navigation"]) + await mainWindow.systemBarProperties({ + navigationBarColor: "#00000000", + statusBarColor: "#00000000", + navigationBarContentColor: "#FF0000", + statusBarContentColor: "#FF0000" + }) +} +export default class MainAbility extends Ability { + // do something + async onWindowStageCreate(windowStage: window.WindowStage) { + let mainWindow = await windowStage.getMainWindow() + await enterImmersion(mainWindow) + windowStage.loadContent('pages/index') + } + // do something +} +``` + +## 应用如何设置隐藏顶部的状态栏 + +适用于OpenHarmony 3.2 Beta5 API 9 + +**解决措施** + +在UIAbility的onWindowStageCreate的生命周期中设置setWindowSystemBarEnable接口即可。 + +**代码示例** + +``` +onWindowStageCreate(windowStage){ + windowStage.getMainWindowSync().setWindowSystemBarEnable([]) + ...... +} +``` + +**参考链接** + +[窗口基础能力文档](../reference/apis/js-apis-window.md) + diff --git a/zh-cn/application-dev/file-management/Readme-CN.md b/zh-cn/application-dev/file-management/Readme-CN.md index 137b758b1584e243b863233b83831d7953f12ef5..ccf665fea3e8c62f374d221a021d0ddb076ee854 100644 --- a/zh-cn/application-dev/file-management/Readme-CN.md +++ b/zh-cn/application-dev/file-management/Readme-CN.md @@ -1,10 +1,23 @@ -# 文件管理 -- 媒体库管理 - - [媒体库开发概述](medialibrary-overview.md) - - [媒体资源使用指导](medialibrary-resource-guidelines.md) - - [文件路径使用指导](medialibrary-filepath-guidelines.md) - - [相册资源使用指导](medialibrary-album-guidelines.md) +# 文件 -- 文件访问框架 - - [用户公共文件访问框架概述](file-access-framework-overview.md) -- [文件选择器使用指导](filepicker-guidelines.md) \ No newline at end of file +- [文件管理概述](file-management-overview.md) +- 应用文件 + - [应用文件概述](app-file-overview.md) + - [应用沙箱目录](app-sandbox-directory.md) + - 应用文件访问与管理 + - [应用文件访问](app-file-access.md) + - [应用文件上传下载](app-file-upload-download.md) + - [应用及文件系统空间统计](app-fs-space-statistics.md) + - [向应用沙箱推送文件](send-file-to-app-sandbox.md) + - [应用文件分享](share-app-file.md) +- 用户文件 + - [用户文件概述](user-file-overview.md) + - 选择与保存用户文件(FilePicker) + - [选择用户文件](select-user-file.md) + - [保存用户文件](save-user-file.md) + - [开发用户文件管理器(仅对系统应用开放)](dev-user-file-manager.md) + - [管理外置存储设备(仅对系统应用开放)](manage-external-storage.md) +- 分布式文件系统 + - [分布式文件系统概述](distributed-fs-overview.md) + - [设置分布式文件数据等级](set-security-label.md) + - [跨设备文件访问](file-access-across-devices.md) diff --git a/zh-cn/application-dev/file-management/app-file-access.md b/zh-cn/application-dev/file-management/app-file-access.md new file mode 100644 index 0000000000000000000000000000000000000000..e974394d85fb090deb66210fa3dd66a3958421af --- /dev/null +++ b/zh-cn/application-dev/file-management/app-file-access.md @@ -0,0 +1,172 @@ +# 应用文件访问 + +应用需要对应用文件目录下的应用文件进行查看、创建、读写、删除、移动、复制、获取属性等访问操作,下文介绍具体方法。 + +## 接口说明 + +开发者通过基础文件操作接口([ohos.file.fs](../reference/apis/js-apis-file-fs.md))实现应用文件访问能力,主要功能如下表所示。 + +**表1** 基础文件操作接口功能 + +| 接口名 | 功能 | 接口类型 | 支持同步 | 支持异步 | +| -------- | -------- | -------- | -------- | -------- | +| access | 检查文件是否存在 | 方法 | √ | √ | +| close | 关闭文件 | 方法 | √ | √ | +| copyFile | 复制文件 | 方法 | √ | √ | +| createStream | 基于文件路径打开文件流 | 方法 | √ | √ | +| listFile | 列出文件夹下所有文件名 | 方法 | √ | √ | +| mkdir | 创建目录 | 方法 | √ | √ | +| moveFile | 移动文件 | 方法 | √ | √ | +| open | 打开文件 | 方法 | √ | √ | +| read | 从文件读取数据 | 方法 | √ | √ | +| rename | 重命名文件或文件夹 | 方法 | √ | √ | +| rmdir | 删除整个目录 | 方法 | √ | √ | +| stat | 获取文件详细属性信息 | 方法 | √ | √ | +| unlink | 删除单个文件 | 方法 | √ | √ | +| write | 将数据写入文件 | 方法 | √ | √ | +| Stream.close | 关闭文件流 | 方法 | √ | √ | +| Stream.flush | 刷新文件流 | 方法 | √ | √ | +| Stream.write | 将数据写入流文件 | 方法 | √ | √ | +| Stream.read | 从流文件读取数据 | 方法 | √ | √ | +| File.fd | 获取文件描述符 | 属性 | √ | × | +| OpenMode | 设置文件打开标签 | 属性 | √ | × | +| Filter | 设置文件过滤配置项 | 类型 | × | × | + +## 开发示例 + +在对应用文件开始访问前,开发者需要[获取应用文件路径](../application-models/application-context-stage.md#获取应用开发路径)。以从UIAbilityContext获取HAP级别的文件路径为例进行说明,UIAbilityContext的获取方式请参见[获取UIAbility的上下文信息](../application-models/uiability-usage.md#获取uiability的上下文信息)。 + +下面介绍几种常用操作示例。 + +### 新建并读写一个文件 + +以下示例代码演示了如何新建一个文件并对其读写。 + +```ts +// pages/xxx.ets +import fs from '@ohos.file.fs'; +import common from '@ohos.app.ability.common'; + +function createFile() { + // 获取应用文件路径 + let context = getContext(this) as common.UIAbilityContext; + let filesDir = context.filesDir; + + // 新建并打开文件 + let file = fs.openSync(filesDir + '/test.txt', fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); + // 写入一段内容至文件 + let writeLen = fs.writeSync(file.fd, "Try to write str."); + console.info("The length of str is: " + writeLen); + // 从文件读取一段内容 + let buf = new ArrayBuffer(1024); + let readLen = fs.readSync(file.fd, buf, { offset: 0 }); + console.info("the content of file: " + String.fromCharCode.apply(null, new Uint8Array(buf.slice(0, readLen)))); + // 关闭文件 + fs.closeSync(file); +} +``` + +### 读取文件内容并写入到另一个文件 + + 以下示例代码演示了如何从一个文件读写内容到另一个文件。 + +```ts +// pages/xxx.ets +import fs from '@ohos.file.fs'; +import common from '@ohos.app.ability.common'; + +function readWriteFile() { + // 获取应用文件路径 + let context = getContext(this) as common.UIAbilityContext; + let filesDir = context.filesDir; + + // 打开文件 + let srcFile = fs.openSync(filesDir + '/test.txt', fs.OpenMode.READ_WRITE); + let destFile = fs.openSync(filesDir + '/destFile.txt', fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); + // 读取源文件内容并写入至目的文件 + let bufSize = 4096; + let readSize = 0; + let buf = new ArrayBuffer(bufSize); + let readLen = fs.readSync(srcFile.fd, buf, { offset: readSize }); + while (readLen > 0) { + readSize += readLen; + fs.writeSync(destFile.fd, buf); + readLen = fs.readSync(srcFile.fd, buf, { offset: readSize }); + } + // 关闭文件 + fs.closeSync(srcFile); + fs.closeSync(destFile); +} +``` + +> **说明:** +> +> 使用读写接口时,需注意可选项参数offset的设置。对于已存在且读写过的文件,文件偏移指针默认在上次读写操作的终止位置。 + +### 以流的形式读写文件 + +以下示例代码演示了如何使用流接口进行文件读写: + +```ts +// pages/xxx.ets +import fs from '@ohos.file.fs'; +import common from '@ohos.app.ability.common'; + +async function readWriteFileWithStream() { + // 获取应用文件路径 + let context = getContext(this) as common.UIAbilityContext; + let filesDir = context.filesDir; + + // 打开文件流 + let inputStream = fs.createStreamSync(filesDir + '/test.txt', 'r+'); + let outputStream = fs.createStreamSync(filesDir + '/destFile.txt', "w+"); + // 以流的形式读取源文件内容并写入目的文件 + let bufSize = 4096; + let readSize = 0; + let buf = new ArrayBuffer(bufSize); + let readLen = await inputStream.read(buf, { offset: readSize }); + readSize += readLen; + while (readLen > 0) { + await outputStream.write(buf); + readLen = await inputStream.read(buf, { offset: readSize }); + readSize += readLen; + } + // 关闭文件流 + inputStream.closeSync(); + outputStream.closeSync(); +} +``` + +> **说明:** +> +> 使用流接口时,需注意流的及时关闭。同时流的异步接口应严格遵循异步接口使用规范,避免同步、异步接口混用。流接口不支持并发读写。 + +### 查看文件列表 + +以下示例代码演示了如何查看文件列表: + +```ts +// 查看文件列表 +import fs from '@ohos.file.fs'; +import common from '@ohos.app.ability.common'; + +// 获取应用文件路径 +let context = getContext(this) as common.UIAbilityContext; +let filesDir = context.filesDir; + +// 查看文件列表 +let options = { + recursion: false, + listNum: 0, + filter: { + suffix: ['.png', '.jpg', '.txt'], // 匹配文件后缀名为'.png','.jpg','.txt' + displayName: ['test%'], // 匹配文件全名以'test'开头 + fileSizeOver: 0, // 匹配文件大小大于等于0 + lastModifiedAfter: new Date(0).getTime(), // 匹配文件最近修改时间在1970年1月1日之后 + }, +} +let files = fs.listFileSync(filesDir, options); +for (let i = 0; i < files.length; i++) { + console.info(`The name of file: ${files[i]}`); +} +``` diff --git a/zh-cn/application-dev/file-management/app-file-overview.md b/zh-cn/application-dev/file-management/app-file-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..e57eabfb1ac7d41b00ed473d29d416c0f097c987 --- /dev/null +++ b/zh-cn/application-dev/file-management/app-file-overview.md @@ -0,0 +1,11 @@ +# 应用文件概述 + +应用文件:文件所有者为应用,包括应用安装文件、应用资源文件、应用缓存文件等。 + +- 设备上应用所使用及存储的数据,以文件、键值对、数据库等形式保存在一个应用专属的目录内。该专属目录我们称为“应用文件目录”,该目录下所有数据以不同的文件格式存放,这些文件即应用文件。 + +- “应用文件目录”与一部分系统文件(应用运行必须使用的系统文件)所在的目录组成了一个集合,该集合称为“[应用沙箱目录](app-sandbox-directory.md)”,代表应用可见的所有目录范围。因此“应用文件目录”是在“应用沙箱目录”内的。 + +- 系统文件及其目录对于应用是只读的;应用仅能保存文件到“[应用文件目录](app-sandbox-directory.md#应用文件目录与应用文件路径)”下,根据目录的使用规范和注意事项来选择将数据保存到不同的子目录中。 + +下文将详细介绍应用沙箱、应用文件目录、应用文件访问与管理、应用文件分享等相关内容。 diff --git a/zh-cn/application-dev/file-management/app-file-upload-download.md b/zh-cn/application-dev/file-management/app-file-upload-download.md new file mode 100644 index 0000000000000000000000000000000000000000..6e04ff93d8700c4357172d72db1720eaa315cab8 --- /dev/null +++ b/zh-cn/application-dev/file-management/app-file-upload-download.md @@ -0,0 +1,105 @@ +# 应用文件上传下载 + +应用可以将应用文件上传到网络服务器,也可以从网络服务器下载网络资源文件到本地应用文件目录。 + +## 上传应用文件 + +开发者可以使用上传下载模块([ohos.request](../reference/apis/js-apis-request.md))的上传接口将本地文件上传。文件上传过程使用系统服务代理完成。 + +> **说明:** +> +> 当前上传应用文件功能,仅支持上传应用缓存文件路径(cacheDir)下的文件。 +> +> 使用上传下载模块,需[申请相关权限](../security/accesstoken-guidelines.md):ohos.permission.INTERNET。 + +以下示例代码演示了如何将应用缓存文件路径下的文件上传至网络服务器。 + +```ts +// pages/xxx.ets +import common from '@ohos.app.ability.common'; +import fs from '@ohos.file.fs'; +import request from '@ohos.request'; + +// 获取应用文件路径 +let context = getContext(this) as common.UIAbilityContext; +let cacheDir = context.cacheDir; + +// 新建一个本地应用文件 +let file = fs.openSync(cacheDir + '/test.txt', fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); +fs.writeSync(file.fd, 'upload file test'); +fs.closeSync(file); + +// 上传任务配置项 +let uploadConfig = { + url: 'https://xxx', + header: { key1: 'value1', key2: 'value2' }, + method: 'POST', + files: [ + { filename: 'test.txt', name: 'test', uri: 'internal://cache/test.txt', type: 'txt' } + ], + data: [ + { name: 'name', value: 'value' } + ] +} + +// 将本地应用文件上传至网络服务器 +try { + request.uploadFile(context, uploadConfig) + .then((uploadTask) => { + uploadTask.on('complete', (taskStates) => { + for (let i = 0; i < taskStates.length; i++) { + console.info(`upload complete taskState: ${JSON.stringify(taskStates[i])}'); + } + }); + }) + .catch((err) => { + console.error(`Invoke uploadFile failed, code is ${err.code}, message is ${err.message}`); + }) +} catch (err) { + console.error(`Invoke uploadFile failed, code is ${err.code}, message is ${err.message}`); +} +``` + +## 下载网络资源文件至应用文件目录 + +开发者可以使用上传下载模块([ohos.request](../reference/apis/js-apis-request.md))的下载接口将网络资源文件下载到应用文件目录。对已下载的网络资源文件,开发者可以使用基础文件IO接口([ohos.file.fs](../reference/apis/js-apis-file-fs.md))对其进行访问,使用方式与[应用文件访问](app-file-access.md)一致。文件下载过程使用系统服务代理完成。 + +> **说明:** +> +> 当前网络资源文件仅支持下载至应用文件目录。 +> +> 使用上传下载模块,需[申请相关权限](../security/accesstoken-guidelines.md):ohos.permission.INTERNET。 + +以下示例代码演示了如何将网络资源文件下载到应用文件目录: + +```ts +// pages/xxx.ets +// 将网络资源文件下载到应用文件目录并读取一段内容 +import common from '@ohos.app.ability.common'; +import fs from '@ohos.file.fs'; +import request from '@ohos.request'; + +// 获取应用文件路径 +let context = getContext(this) as common.UIAbilityContext; +let filesDir = context.filesDir; + +try { + request.downloadFile(context, { + url: 'https://xxxx/xxxx.txt', + filePath: filesDir + '/xxxx.txt' + }).then((downloadTask) => { + downloadTask.on('complete', () => { + console.info('download complete'); + let file = fs.openSync(filesDir + '/xxxx.txt', fs.OpenMode.READ_WRITE); + let buf = new ArrayBuffer(1024); + let readLen = fs.readSync(file.fd, buf); + console.info(`The content of file: ${String.fromCharCode.apply(null, new Uint8Array(buf.slice(0, readLen)))}`); + fs.closeSync(file); + }) + }).catch((err) => { + console.error(`Invoke downloadTask failed, code is ${err.code}, message is ${err.message}`); + }); +} catch (err) { + console.error(`Invoke downloadFile failed, code is ${err.code}, message is ${err.message}`); +} +``` diff --git a/zh-cn/application-dev/file-management/app-fs-space-statistics.md b/zh-cn/application-dev/file-management/app-fs-space-statistics.md new file mode 100644 index 0000000000000000000000000000000000000000..abf59f277bea29c68ba83979ad9fe61d0cd55b69 --- /dev/null +++ b/zh-cn/application-dev/file-management/app-fs-space-statistics.md @@ -0,0 +1,54 @@ +# 应用及文件系统空间统计 + +在系统中,可能出现系统空间不够或者cacheDir等目录受系统配额限制等情况,需要应用开发者关注系统剩余空间,同时控制应用自身占用的空间大小。 + +## 接口说明 + +API的详细介绍请参见[ohos.file.statvfs](../reference/apis/js-apis-file-statvfs.md)、[ohos.file.storageStatistics](../reference/apis/js-apis-file-storage-statistics.md)。 + +**表1** 文件系统空间和应用空间统计 + +| 模块 | 接口名 | 功能 | +| -------- | -------- | -------- | +| \@ohos.file.storageStatistic | getCurrentBundleStats | 获取当前应用的存储空间大小(单位为Byte)。 | +| \@ohos.file.statvfs | getFreeSize | 获取指定文件系统的剩余空间大小(单位为Byte)。 | +| \@ohos.file.statvfs | getTotalSize | 获取指定文件系统的总空间大小(单位为Byte)。 | + +**表2** 应用空间统计 + +| BundleStats属性 | 含义 | 统计路径 | +| -------- | -------- | -------- | +| appSize | 应用安装文件大小(单位为Byte) | 应用安装文件保存在以下目录:
/data/storage/el1/bundle | +| cacheSize | 应用缓存文件大小(单位为Byte) | 应用的缓存文件保存在以下目录:
/data/storage/el1/base/cache
/data/storage/el1/base/haps/entry/cache
/data/storage/el2/base/cache
/data/storage/el2/base/haps/entry/cache | +| dataSize | 应用文件存储大小(除应用安装文件和缓存文件)(单位为Byte) | 应用文件由本地文件、分布式文件以及数据库文件组成。
本地文件保存在以下目录(注意缓存文件目录为以下目录的子目录):
/data/storage/el1/base
/data/storage/el2/base
分布式文件保存在以下目录:
/data/storage/el2/distributedfiles
数据库文件保存在以下目录:
/data/storage/el1/database
/data/storage/el2/database | + +## 开发示例 + +- 获取文件系统数据分区剩余空间大小。 + + ```ts + import statvfs from '@ohos.file.statvfs'; + + let path = "/data"; + statvfs.getFreeSize(path, (err, number) => { + if (err) { + console.error(`Invoke getFreeSize failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info(`Invoke getFreeSize succeeded, size is ${number}`); + } + }); + ``` + +- 获取当前应用的存储空间大小。 + + ```ts + import storageStatistics from "@ohos.file.storageStatistics"; + + storageStatistics.getCurrentBundleStats((err, bundleStats) => { + if (err) { + console.error(`Invoke getCurrentBundleStats failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info(`Invoke getCurrentBundleStats succeeded, appsize is ${bundleStats.appSize}`); + } + }); + ``` diff --git a/zh-cn/application-dev/file-management/app-sandbox-directory.md b/zh-cn/application-dev/file-management/app-sandbox-directory.md new file mode 100644 index 0000000000000000000000000000000000000000..e5ead98a48c1e53f31760686c7bc6060d35c0932 --- /dev/null +++ b/zh-cn/application-dev/file-management/app-sandbox-directory.md @@ -0,0 +1,94 @@ +# 应用沙箱目录 + +应用沙箱是一种以安全防护为目的的隔离机制,避免数据受到恶意路径穿越访问。在这种沙箱的保护机制下,应用可见的目录范围即为“应用沙箱目录”。 + +- 对于每个应用,系统会在内部存储空间映射出一个专属的“应用沙箱目录”,它是“[应用文件目录](app-file-overview.md)”与一部分系统文件(应用运行必需的少量系统文件)所在的目录组成的集合。 + +- 应用沙箱限制了应用可见的数据的最小范围。在“应用沙箱目录”中,应用仅能看到自己的应用文件以及少量的系统文件(应用运行必需的少量系统文件)。因此,本应用的文件也不为其他应用可见,从而保护了应用文件的安全。 + +- 应用可以在“[应用文件目录](app-file-overview.md)”下保存和处理自己的应用文件;系统文件及其目录对于应用是只读的;而应用若需访问[用户文件](user-file-overview.md),则需要通过特定API同时经过用户的相应授权才能进行。 + +下图展示了应用沙箱下,应用可访问的文件范围和方式。 + +**图1** 应用沙箱文件访问关系图 + +![Application sandbox file access relationship](figures/application-sandbox-file-access-relationship.png) + +## 应用沙箱目录与应用沙箱路径 + +在应用沙箱保护机制下,应用无法获知除自身应用文件目录之外的其他应用或用户的数据目录位置及存在。同时,所有应用的目录可见范围均经过权限隔离与文件路径挂载隔离,形成了独立的路径视图,屏蔽了实际物理路径: + +- 如下图所示,在普通应用(也称三方应用)视角下,不仅可见的目录与文件数量限制到了最小范围,并且可见的目录与文件路径也与系统进程等其他进程看到的不同。我们将普通应用视角下看到的“应用沙箱目录”下某个文件或某个具体目录的路径,称为“应用沙箱路径”。 + +- 一般情况下,开发者的hdc shell环境等效于系统进程视角,因此“应用沙箱路径”与开发者使用hdc工具调试时看到的真实物理路径不同,其对应关系详见[应用沙箱路径和调试进程视角下的真实物理路径](send-file-to-app-sandbox.md#应用沙箱路径和调试进程视角下的真实物理路径)。 + +- 从实际物理路径推导物理路径与沙箱路径并不是1:1的映射关系,沙箱路径总是少于系统进程视角可见的物理路径。有些调试进程视角下的物理路径在对应的应用沙箱目录是无法找到的,而沙箱路径总是能够找到其对应的物理路径。 + +**图2** 应用沙箱路径(不同权限与角色的进程下可见的文件路径不同) +   +![Application sandbox path](figures/application-sandbox-path.png) + +## 应用文件目录与应用文件路径 + +如前文所述,“应用沙箱目录”内分为两类:应用文件目录和系统文件目录。 + +系统文件目录对应用的可见范围由OpenHarmony系统预置,开发者无需关注。 + +在此主要介绍应用文件目录,如下图所示。应用文件目录下某个文件或某个具体目录的路径称为应用文件路径。应用文件目录下的各个文件路径,具备不同的属性和特征。 + +**图3** 应用文件目录结构图 + +![Application file directory structure](figures/application-file-directory-structure.png) + +1. 一级目录data/:代表应用文件目录。 + +2. 二级目录storage/:代表本应用持久化文件目录。 + +3. 三级目录el1/、el2/:代表不同文件加密类型。 + - el1,设备级加密区:设备开机后即可访问的数据区。 + - el2,用户级加密区:设备开机后,需要至少一次解锁对应用户的锁屏界面(密码、指纹、人脸等方式或无密码状态)后,才能够访问的加密数据区。
+ 应用如无特殊需要,应将数据存放在el2加密目录下,以尽可能保证数据安全。但是对于某些场景,一些应用文件需要在用户解锁前就可被访问,例如时钟、闹铃、壁纸等,此时应用需要将这些文件存放到设备级加密区(el1)。切换应用文件加密类型目录的方法请参见[获取和修改加密分区](../application-models/application-context-stage.md#获取和修改加密分区)。 + +4. 四级、五级目录: + 通过ApplicationContext可以获取base下的files、cache、preferences、temp、distributedfiles等目录的应用文件路径,应用全局信息可以存放在这些目录下。 + + 通过UIAbilityContext、AbilityStageContext、ExtensionContext可以获取hap级别应用文件路径。HAP信息可以存放在这些目录下,存放在此目录的文件会跟随HAP的卸载而删除,不会影响app级别目录下的文件。在开发态,一个应用包含一个或者多个HAP,详见[Stage模型应用程序包结构](../quick-start/application-package-structure-stage.md)。 + + Context上下文获取及上述应用文件路径的获取,详见[应用上下文Context](../application-models/application-context-stage.md)。 + + > **说明:** + > + > - 禁止直接使用上图中四级目录之前的目录名组成的路径字符串,否则可能导致后续应用版本因应用文件路径变化导致不兼容问题。 + > - 应通过Context属性获取应用文件路径,包括但不限于上图中绿色背景的路径。 + + 应用文件路径具体说明及生命周期如下表所示。 + + **表1** 应用文件路径详细说明 + + | 目录名 | Context属性名称 | 类型 | 说明 | + | -------- | -------- | -------- | -------- | + | bundle | bundleCodeDir | 安装文件路径 | 应用安装后的app的hap资源包所在目录;随应用卸载而清理。不能拼接路径访问资源文件,请使用[资源管理接口](../reference/apis/js-apis-resource-manager.md)访问资源。 | + | base | NA | 本设备文件路径 | 应用在本设备上存放持久化数据的目录,子目录包含files/、cache/、temp/和haps/;随应用卸载而清理。 | + | database | databaseDir | 数据库路径 | 应用在el1加密条件下存放通过分布式数据库服务操作的文件目录;随应用卸载而清理。 | + | distributedfiles | distributedFilesDir | 分布式文件路径 | 应用在el2加密条件下存放分布式文件的目录,应用将文件放入该目录可分布式跨设备直接访问;随应用卸载而清理。 | + | files | filesDir | 应用通用文件路径 | 应用在本设备内部存储上通用的存放默认长期保存的文件路径;随应用卸载而清理。 | + | cache | cacheDir | 应用缓存文件路径 | 应用在本设备内部存储上用于缓存下载的文件或可重新生成的缓存文件的路径,应用cache目录大小超过配额或者系统空间达到一定条件,自动触发清理该目录下文件;用户通过系统空间管理类应用也可能触发清理该目录。应用需判断文件是否仍存在,决策是否需重新缓存该文件。 | + | preferences | preferencesDir | 应用首选项文件路径 | 应用在本设备内部存储上通过数据库API存储配置类或首选项的目录;应用在本设备内部存储上通过数据库API存储配置类或首选项的目录;随应用卸载而清理。详见[通过用户首选项实现数据持久化](../database/data-persistence-by-preferences.md)。 | + | temp | tempDir | 应用临时文件路径 | 应用在本设备内部存储上仅在应用运行期间产生和需要的文件,应用退出后即清理。 | + + 对于上述各类应用文件路径,常见使用场景如下: + + - 安装文件路径 + 可以用于存储应用的代码资源数据,主要包括应用安装的HAP资源包、可重复使用的库文件以及插件资源等。此路径下存储的代码资源数据可以被用于动态加载。 + - 数据库路径 + 仅用于保存应用的私有数据库数据,主要包括数据库文件等。此路径下仅适用于存储分布式数据库相关文件数据。 + - 分布式文件路径 + 可以用于保存应用分布式场景下的数据,主要包括应用多设备共享文件、应用多设备备份文件、应用多设备群组协助文件。此路径下存储这些数据,使得应用更加适合多设备使用场景。 + - 应用通用文件路径 + 可以用于保存应用的任何私有数据,主要包括用户持久性文件、图片、媒体文件以及日志文件等。此路径下存储这些数据,使得数据保持私有、安全且持久有效。 + - 应用缓存文件路径 + 可以用于保存应用的缓存数据,主要包括离线数据、图片缓存、数据库备份以及临时文件等。此路径下存储的数据可能会被系统自动清理,因此不要存储重要数据。 + - 应用首选项文件路径 + 可以用于保存应用的首选项数据,主要包括应用首选项文件以及配置文件等。此路径下仅适用于存储小量数据。 + - 应用临时文件路径 + 可以用于保存应用的临时生成的数据,主要包括数据库缓存、图片缓存、临时日志文件、以及下载的应用安装包文件等。此路径下存储使用后即可删除的数据。 diff --git a/zh-cn/application-dev/file-management/dev-user-file-manager.md b/zh-cn/application-dev/file-management/dev-user-file-manager.md new file mode 100644 index 0000000000000000000000000000000000000000..6b122912ea91e184428f3e4e85654bc7d9daf3ba --- /dev/null +++ b/zh-cn/application-dev/file-management/dev-user-file-manager.md @@ -0,0 +1,145 @@ +# 开发用户文件管理器(仅对系统应用开放) + +OpenHarmony预置了FileManager文件管理器。系统应用开发者也可以根据需要,按以下指导自行开发文件管理器。 + +## 接口说明 + +开发用户文件管理器的相关API详细介绍请参见[API参考](../reference/apis/js-apis-fileAccess.md)。 + +## 开发步骤 + +1. 权限配置和导入模块。 + 申请ohos.permission.FILE_ACCESS_MANAGER和ohos.permission.GET_BUNDLE_INFO_PRIVILEGED权限,配置方式请参见[访问控制授权申请](../security/accesstoken-guidelines.md)。 + + > **说明:** + > + > ohos.permission.FILE_ACCESS_MANAGER是使用文件访问框架接口的基础权限。 + > + > ohos.permission.GET_BUNDLE_INFO_PRIVILEGED权限可以用于查询系统内当前支持的文件管理服务端应用信息。 + +2. 导入依赖模块。 + + ```ts + import fileAccess from '@ohos.file.fileAccess'; + import fileExtensionInfo from '@ohos.file.fileExtensionInfo'; + ``` + + 其中fileAccess提供了文件基础操作的API,fileExtensionInfo提供了应用开发的关键结构体。 + +3. 查询设备列表。 + 开发者可以获取当前系统所有文件管理服务端管理的设备属性,也可以获取某个文件管理服务端管理的设备属性。应用开发者可以按需过滤设备。 + + 在文件访问框架中,使用RootInfo用于表示设备的属性信息。以下示例可以获取所有设备的RootInfo。 + + ```ts + // 创建连接系统内所有文件管理服务端的helper对象 + let fileAccessHelperAllServer = null; + createFileAccessHelper() { + try { // this.context是EntryAbility传过来的Context + fileAccessHelperAllServer = fileAccess.createFileAccessHelper(this.context); + if (!fileAccessHelperAllServer) { + console.error("createFileAccessHelper interface returns an undefined object"); + } + } catch (error) { + console.error("createFileAccessHelper failed, errCode:" + error.code + ", errMessage:" + error.message); + } + } + async getRoots() { + let rootIterator = null; + let rootInfos = []; + let isDone = false; + try { + rootIterator = await fileAccessHelperAllServer.getRoots(); + if (!rootIterator) { + console.error("getRoots interface returns an undefined object"); + return; + } + while (!isDone) { + let result = rootIterator.next(); + console.info("next result = " + JSON.stringify(result)); + isDone = result.done; + if (!isDone) + rootinfos.push(result.value); + } + } catch (error) { + console.error("getRoots failed, errCode:" + error.code + ", errMessage:" + error.message); + } + } + ``` + +4. 浏览目录。 + 在文件访问框架中,使用FileInfo表示一个文件(目录)的基础信息。开发者可以使用listfile接口遍历下一级所有文件(目录)的迭代器对象;也可以通过scanfile过滤指定目录,获取满足条件的迭代器对象。 + + listfile和scanfile接口当前支持RootInfo对象调用,可用于支撑遍历下一级文件或过滤整个目录树。同时,接口也支持FileInfo对象调用,用于支撑遍历下一级文件或过滤指定目录。 + + ```ts + // 从根目录开始 + let rootInfo = rootinfos[0]; + let fileInfos = []; + let isDone = false; + let filter = {suffix : [".txt", ".jpg", ".xlsx"]}; // 设定过滤条件 + try { + let fileIterator = rootInfo.listFile(); // 遍历设备rootinfos[0]的根目录,返回迭代器对象 + // let fileIterator = rootInfo.scanFile(filter); // 过滤设备rootinfos[0]满足指定条件的文件信息,返回迭代对象 + if (!fileIterator) { + console.error("listFile interface returns an undefined object"); + return; + } + while (!isDone) { + let result = fileIterator.next(); + console.info("next result = " + JSON.stringify(result)); + isDone = result.done; + if (!isDone) + fileInfos.push(result.value); + } + } catch (error) { + console.error("listFile failed, errCode:" + error.code + ", errMessage:" + error.message); + } + + // 从指定的目录开始 + let fileInfoDir = fileInfos[0]; // fileInfoDir 表示某个目录信息 + let subFileInfos = []; + let isDone = false; + let filter = {suffix : [".txt", ".jpg", ".xlsx"]}; // 设定过滤条件 + try { + let fileIterator = fileInfoDir.listFile(); // 遍历特定的目录fileinfo,返回迭代器对象 + // let fileIterator = rootInfo.scanFile(filter); // 过滤特定的目录fileinfo,返回迭代器对象 + if (!fileIterator) { + console.error("listFile interface returns an undefined object"); + return; + } + while (!isDone) { + let result = fileIterator.next(); + console.info("next result = " + JSON.stringify(result)); + isDone = result.done; + if (!isDone) + subfileInfos.push(result.value); + } + } catch (error) { + console.error("listFile failed, errCode:" + error.code + ", errMessage:" + error.message); + } + ``` + +5. 操作文件或目录。 + 开发者可以集成文件访问框架的接口,完成一些用户行为,比如删除文件(目录)、重命名文件(目录)、新建文件(目录)、移动文件(目录)等。以下示例展示了如何创建一个文件,其他接口请参见[API参考](../reference/apis/js-apis-fileAccess.md)。 + + ```ts + // 以本地设备为例 + // 创建文件 + // 示例代码sourceUri是Download目录的fileinfo中的URI + // 开发者应根据自己实际获取fileinfo的URI进行开发 + let sourceUri = "datashare:///media/file/6"; + let displayName = "file1"; + let fileUri = null; + try { + // fileAccessHelper 参考 fileAccess.createFileAccessHelper 示例代码获取 + fileUri = await fileAccessHelper.createFile(sourceUri, displayName); + if (!fileUri) { + console.error("createFile return undefined object"); + return; + } + console.info("createFile sucess, fileUri: " + JSON.stringify(fileUri)); + } catch (error) { + console.error("createFile failed, errCode:" + error.code + ", errMessage:" + error.message); + }; + ``` diff --git a/zh-cn/application-dev/file-management/distributed-fs-overview.md b/zh-cn/application-dev/file-management/distributed-fs-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..5777fa0b538108e1de72fc7143c5647a9abc4fe6 --- /dev/null +++ b/zh-cn/application-dev/file-management/distributed-fs-overview.md @@ -0,0 +1,39 @@ +# 分布式文件系统概述 + +分布式文件系统(hmdfs,OpenHarmony Distributed File System)提供跨设备的文件访问能力,适用于如下场景: + +- 两台设备组网,用户可以利用一台设备上的编辑软件编辑另外一台设备上的文档。 + +- 平板保存的音乐,车载系统直接可见并可播放。 + +- 户外拍摄的照片,回家打开平板直接访问原设备拍摄的照片。 + +hmdfs在分布式软总线动态组网的基础上,为网络上各个设备结点提供一个全局一致的访问视图,支持开发者通过基础文件系统接口进行读写访问,具有高性能、低延时等优点。 + +## 分布式文件系统架构 + +![Distributed File System Architecture](figures/distributed-file-system-architecture.png) + +- distributedfile_daemon:主要负责设备上线监听、通过软总线建立链路,并根据分布式的设备安全等级执行不同的数据流转策略。 + +- hmdfs:实现在内核的网络文件系统,包括缓存管理、文件访问、元数据管理和冲突管理等。 + - 缓存管理 + - 设备分布式组网后,hmdfs提供文件的互访能力,但不会主动进行文件数据传输和拷贝。如果应用需要将数据保存到本地,需主动拷贝。 + - hmdfs保证Close-to-Open的一致性,即一端写关闭后,另外一端可以读取到最新数据,不保证文件内容的实时一致性。 + - 数据在远端写入,但是由于网络原因未及时回刷,文件系统会在下次网络接入时回刷本地,但是如果远端已修改则无法回刷。 + - 文件访问 + - 文件访问接口与本地一致([ohos.file.fs](../reference/apis/js-apis-file-fs.md))。 + - 如果文件在本地,则堆叠访问本地文件系统。 + - 如果文件在其他设备,则同步网络访问远端设备文件。 + > **说明:** + > + > symlink:不支持。 + - 元数据管理 + - 分布式组网下,文件一端创建、删除、修改,另一端可以“立即”查看到最新文件,看到速度取决于网络情况。 + - 远端设备离线后,该设备数据将不再在本端设备呈现。但由于设备离线的感知具有延迟,可能会造成部分消息4s超时,因此开发者需要考虑接口的网络超时或一些文件虽然可以看到,但实际设备可能已离线的场景。 + - 冲突处理 + - 本地与远端冲突 ,远端文件被重命名,看到的同名文件是本地同名文件,远端文件被重命名。 + - 远端多个设备冲突,以接入本设备ID为顺序,显示设备ID小的同名文件,其他文件被依次重命名。 + - 如果组网场景,目录树下已经有远端文件,创建同名文件,提示文件已存在。 + - 冲突文件显示_conflict_dev后依次加id,id从1自动递增。 + - 同名目录之间仅融合不存在冲突,文件和远端目录同名冲突,远端目录后缀加_remote_directory。 diff --git a/zh-cn/application-dev/file-management/figures/application-file-directory-structure.png b/zh-cn/application-dev/file-management/figures/application-file-directory-structure.png new file mode 100644 index 0000000000000000000000000000000000000000..9a4b622dbcd94afaaf13a4fc8bf22e9636d1337b Binary files /dev/null and b/zh-cn/application-dev/file-management/figures/application-file-directory-structure.png differ diff --git a/zh-cn/application-dev/file-management/figures/application-sandbox-file-access-relationship.png b/zh-cn/application-dev/file-management/figures/application-sandbox-file-access-relationship.png new file mode 100644 index 0000000000000000000000000000000000000000..cfbbf95d68b132af558f63e204f0d302751ddc44 Binary files /dev/null and b/zh-cn/application-dev/file-management/figures/application-sandbox-file-access-relationship.png differ diff --git a/zh-cn/application-dev/file-management/figures/application-sandbox-path.png b/zh-cn/application-dev/file-management/figures/application-sandbox-path.png new file mode 100644 index 0000000000000000000000000000000000000000..81beec6b260fc52f73680877407a1be1a10c139e Binary files /dev/null and b/zh-cn/application-dev/file-management/figures/application-sandbox-path.png differ diff --git a/zh-cn/application-dev/file-management/figures/distributed-file-system-architecture.png b/zh-cn/application-dev/file-management/figures/distributed-file-system-architecture.png new file mode 100644 index 0000000000000000000000000000000000000000..1c431cf3eced3fa9e6a4f29c705d27d95931d43f Binary files /dev/null and b/zh-cn/application-dev/file-management/figures/distributed-file-system-architecture.png differ diff --git a/zh-cn/application-dev/file-management/figures/external-storage-device-management.png b/zh-cn/application-dev/file-management/figures/external-storage-device-management.png new file mode 100644 index 0000000000000000000000000000000000000000..5ed8f5f41b84b3d2d7e1cc85363ff0d2233f61be Binary files /dev/null and b/zh-cn/application-dev/file-management/figures/external-storage-device-management.png differ diff --git a/zh-cn/application-dev/file-management/figures/file-classification-model.png b/zh-cn/application-dev/file-management/figures/file-classification-model.png new file mode 100644 index 0000000000000000000000000000000000000000..b8afd5937382104b948845da31cfe54fde9a8b32 Binary files /dev/null and b/zh-cn/application-dev/file-management/figures/file-classification-model.png differ diff --git a/zh-cn/application-dev/file-management/figures/user-file-access-framework.png b/zh-cn/application-dev/file-management/figures/user-file-access-framework.png new file mode 100644 index 0000000000000000000000000000000000000000..e324f9c15e7182d0a3dbb743b4728982f46d8682 Binary files /dev/null and b/zh-cn/application-dev/file-management/figures/user-file-access-framework.png differ diff --git "a/zh-cn/application-dev/file-management/figures/\345\205\254\345\205\261\346\226\207\344\273\266\346\223\215\344\275\234\345\261\202\346\254\241\345\233\276.png" "b/zh-cn/application-dev/file-management/figures/\345\205\254\345\205\261\346\226\207\344\273\266\346\223\215\344\275\234\345\261\202\346\254\241\345\233\276.png" deleted file mode 100644 index e3b0db7293ac9b2748ba5f4b625556a4e93c2d74..0000000000000000000000000000000000000000 Binary files "a/zh-cn/application-dev/file-management/figures/\345\205\254\345\205\261\346\226\207\344\273\266\346\223\215\344\275\234\345\261\202\346\254\241\345\233\276.png" and /dev/null differ diff --git "a/zh-cn/application-dev/file-management/figures/\345\205\254\345\205\261\346\226\207\344\273\266\350\256\277\351\227\256\346\241\206\346\236\266\346\225\260\346\215\256\346\265\201.png" "b/zh-cn/application-dev/file-management/figures/\345\205\254\345\205\261\346\226\207\344\273\266\350\256\277\351\227\256\346\241\206\346\236\266\346\225\260\346\215\256\346\265\201.png" deleted file mode 100644 index d3c6fd90b59712bf2728208f247d531b919b4b3b..0000000000000000000000000000000000000000 Binary files "a/zh-cn/application-dev/file-management/figures/\345\205\254\345\205\261\346\226\207\344\273\266\350\256\277\351\227\256\346\241\206\346\236\266\346\225\260\346\215\256\346\265\201.png" and /dev/null differ diff --git a/zh-cn/application-dev/file-management/file-access-across-devices.md b/zh-cn/application-dev/file-management/file-access-across-devices.md new file mode 100644 index 0000000000000000000000000000000000000000..2e0443f9b0817c73cd082413e5bf40ea0931505c --- /dev/null +++ b/zh-cn/application-dev/file-management/file-access-across-devices.md @@ -0,0 +1,60 @@ +# 跨设备文件访问 + +分布式文件系统为应用提供了跨设备文件访问的能力,开发者在多个设备安装同一应用时,通过[基础文件接口](app-file-access.md),可跨设备读写其他设备该应用分布式文件路径(/data/storage/el2/distributedfiles/)下的文件。例如:多设备数据流转的场景,设备组网互联之后,设备A上的应用可访问设备B同应用分布式路径下的文件,当期望应用文件被其他设备访问时,只需将文件移动到分布式文件路径即可。 + +## 开发步骤 + +1. 完成分布式组网。 + 首先将需要进行跨设备访问的设备连接到同一局域网中,同帐号认证完成组网。 + +2. 访问跨设备文件。 + 同一应用不同设备之间实现跨设备文件访问,只需要将对应的文件放在应用沙箱的分布式文件路径即可。 + + 设备A上在分布式路径下创建测试文件,并写入内容。示例中的context的获取方式请参见[获取UIAbility的上下文信息](../application-models/uiability-usage.md#获取uiability的上下文信息)。 + + ```ts + import fs from '@ohos.file.fs'; + + let context = ...; // 获取设备A的UIAbilityContext信息 + let pathDir = context.distributedFilesDir; + // 获取分布式目录的文件路径 + let filePath = pathDir + '/test.txt'; + + try { + // 在分布式目录下创建文件 + let file = fs.openSync(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); + console.info('Succeeded in createing.'); + // 向文件中写入内容 + fs.writeSync(file.fd, 'content'); + // 关闭文件 + fs.closeSync(file.fd); + } catch (err) { + console.error(`Failed to openSync / writeSync / closeSync. Code: ${err.code}, message: ${err.message}`); + } + ``` + + 设备B上在分布式路径下读取测试文件。 + + ```ts + import fs from '@ohos.file.fs'; + + let context = ...; // 获取设备B的UIAbilityContext信息 + let pathDir = context.distributedFilesDir; + // 获取分布式目录的文件路径 + let filePath = pathDir + '/test.txt'; + + try { + // 打开分布式目录下的文件 + let file = fs.openSync(filePath, fs.OpenMode.READ_WRITE); + // 定义接收读取数据的缓存 + let buffer = new ArrayBuffer(4096); + // 读取文件的内容,返回值是读取到的字节个数 + let num = fs.readSync(file.fd, buffer, { + offset: 0 + }); + // 打印读取到的文件数据 + console.info('read result: ' + String.fromCharCode.apply(null, new Uint8Array(buffer.slice(0, num)))); + } catch (err) { + console.error(`Failed to openSync / readSync. Code: ${err.code}, message: ${err.message}`); + } + ``` diff --git a/zh-cn/application-dev/file-management/file-access-framework-overview.md b/zh-cn/application-dev/file-management/file-access-framework-overview.md deleted file mode 100644 index d67feda3017cccc04aa1570d86343809621164de..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/file-management/file-access-framework-overview.md +++ /dev/null @@ -1,44 +0,0 @@ -# 用户公共文件访问框架概述 - -在搭载OpenHarmony 3.2 (API 9)及更高版本的设备上,应用可以基于FileAccessFramework(简称为FAF)对本地公共文件、分布式设备文件、外部存储设备文件、多用户共享文件进行访问。 - -出于对用户数据的隐私安全考虑,目前此框架仅支持用户通过**文件管理器**和**文件选择器**对文件访问服务端进行操作,包括创建、打开、删除、重命名、移动等。 - -应用卸载,不会影响到用户数据,实际用户数据仍保留在对应设备中。 - -其它系统应用如需要访问本地公共文件,请参考使用[媒体库接口](medialibrary-filepath-guidelines.md)。 - -> **注意:** -> 1:如果应用是系统非管理类应用,比如:系统图库,请优先考虑直接使用媒体库接口,媒体库接口提供了一系列直接操作文件的接口。 -> 2:FAF 接口与媒体库接口原则上不能混用。 - -## FileAccessFramework机制介绍 -FAF依托于OpenHarmony上[ExtensionAbility机制](../application-models/extensionability-overview.md),实现了一套对外提供能力的统一接口。应用可以通过这套接口预览和操作公共文件,实现自己的逻辑。 - -有兴趣的开发者,可以预览我们的[源码仓](https://gitee.com/openharmony/filemanagement_user_file_service),提出您宝贵的意见。 - -基于FAF进行文件操作的全流程,包含以下几个元素,如图所示: - -**图1 公共文件操作层次图** - -![](figures/公共文件操作层次图.png) - -- **文件访问客户端应用** - 需要访问或操作公共文件的应用。通过拉起文件选择器,用户可以在可视化界面上进行文件操作。 -- **文件选择器应用** - 可以让用户访问所有共享数据集的系统应用。通过使用 FAF 的对上接口,完成各种文件操作。 -- **文件访问服务端应用** - 系统内支持将数据集进行共享的服务。目前有[UserFileManager](https://gitee.com/openharmony/multimedia_medialibrary_standard)、ExternalFileManager等。前者管理了本地磁盘、分布式设备的数据集,后者管理了SD卡、U盘等多种外置存储设备的数据集。开发者也可以基于 FAF 的服务端配置,共享自己的数据集。 - -FAF提供的主要功能: -- 可以让用户浏览系统内所有文件服务端应用提供的数据集,而不仅仅是单一应用的数据集。 -- 客户端应用不需要获取FAF的使用权限,直接通过选择器应用操作文件。 -- 支持访问多个临时挂载的设备,比如外置存储卡、分布式设备等。 - -## 数据模型 -FAF 中数据模型主要通过URI、FileInfo、RootInfo 进行传递。详情参考[fileExtension](../reference/apis/js-apis-fileExtensionInfo.md)。文件访问服务端应用可以通过 FileAccessExtensionAbility API,将自身的数据安全的共享出去。 - -**图2 公共文件访问框架数据流** - -![](figures/公共文件访问框架数据流.png) - -注意事项: -- 在FAF中,文件访问客户端和文件访问服务端并不直接交互。只需要具备拉起文件选择器应用的权限即可。 -- 文件选择器应用会为用户提供标准的文档访问界面,即使底层的文件访问服务端相互之间差异很大,一致性也不受影响。 \ No newline at end of file diff --git a/zh-cn/application-dev/file-management/file-management-overview.md b/zh-cn/application-dev/file-management/file-management-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..26c1f4c04bd78752520bf6414e3396f1cb11abf1 --- /dev/null +++ b/zh-cn/application-dev/file-management/file-management-overview.md @@ -0,0 +1,25 @@ +# 文件管理概述 + +在操作系统中,存在各种各样的数据,按数据结构可分为: + +- 结构化数据:能够用统一的数据模型加以描述的数据。常见的是各类数据库数据。在应用开发中,对结构化数据的开发活动隶属于[数据管理模块](../database/data-mgmt-overview.md)。 + +- 非结构化数据:指数据结构不规则或不完整,没有预定义的数据结构/模型,不方便用数据库二维逻辑表来表现的数据。常见的是各类文件,如文档、图片、音频、视频等。在应用开发中,对非结构化数据的开发活动隶属于文件管理模块,将在下文展开介绍。 + +在文件管理模块中,按文件所有者的不同,有如下文件分类模型,其示意图如下面文件分类模型示意图: + +- [应用文件](app-file-overview.md):文件所有者为应用,包括应用安装文件、应用资源文件、应用缓存文件等。 + +- [用户文件](user-file-overview.md):文件所有者为登录到该终端设备的用户,包括用户私有的图片、视频、音频、文档等。 + +- 系统文件:与应用和用户无关的其他文件,包括公共库、设备文件、系统资源文件等。这类文件不需要开发者进行文件管理,本文不展开介绍。 + +按文件系统管理的文件存储位置(数据源位置)的不同,有如下文件系统分类模型: + +- 本地文件系统:提供本地设备或外置存储设备(如U盘、移动硬盘)的文件访问能力。本地文件系统是最基本的文件系统,本文不展开介绍。 + +- [分布式文件系统](distributed-fs-overview.md):提供跨设备的文件访问能力。所谓跨设备,指文件不一定存储在本地设备或外置存储设备,而是通过计算机网络与其他分布式设备相连。 + +**图1** 文件分类模型示意图 + +![File classification model](figures/file-classification-model.png) diff --git a/zh-cn/application-dev/file-management/filepicker-guidelines.md b/zh-cn/application-dev/file-management/filepicker-guidelines.md deleted file mode 100644 index d8e64e27301703dfe16623dde201a784a780fc9c..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/file-management/filepicker-guidelines.md +++ /dev/null @@ -1,66 +0,0 @@ -# 文件选择器使用指导 - -文件选择器(FilePicker)是OpenHarmony中预置的系统应用,为用户提供文件选择及保存功能。具体实现可以参考[FilePicker代码仓库](https://gitee.com/openharmony/applications_filepicker)。 - -应用可以通过FilePicker的两种模式实现文件选择和文件保存的功能。 -- choose模式(文件选择):当应用需要选择并上传、发送设备中的文件(包括图片、音视频等媒体资源)时,可以选择该模式。拉起FilePicker的choose模式窗口,系统将弹出弹框供用户选择具体文件。用户通过界面选择目标文件并点击“上传”按钮,应用将接收到FilePicker传回的目标文件uri。 -- save模式(文件保存):当应用需要下载保存文件(包括图片、音视频等媒体资源)时,可以选择该模式。拉起FilePicker的save模式窗口,系统将弹出弹框供用户选择保存文件的目标路径。用户通过界面选择目标路径并点击“保存”按钮,应用将接收到FilePicker传回的已保存文件uri。 - -## 开发指导 - -> **说明:** -> FilePicker仅支持基于Stage模型开发的应用拉起。
-> Stage模型介绍请参考[应用模型解读](../application-models/application-model-description.md)。 - -使用不同的参数调用[AbilityContext.startAbilityForResult(want, options)](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartabilityforresult-1)可以拉起FilePicker不同模式的窗口。 - -开发者需要通过[Want](../reference/apis/js-apis-application-want.md)指定"bundleName"和"abilityName"来拉起FilePicker,具体写法可参见下方的示例代码。 - -同时,开发者还需要设置属性Want.parameters,来指定FilePicker拉起的模式以及文件保存的名称: -- 文件选择:仅需要设置FilePicker拉起的窗口模式为`'startMode': 'choose'`。 -- 文件保存:除了设置FilePicker拉起的窗口模式为`'startMode': 'save'`,还需要设置文件保存名称`'saveFile'`。 - -可以通过设置类型为[StartOptions](../reference/apis/js-apis-app-ability-startOptions.md)的入参options来指定弹出窗口样式,推荐设置为`windowMode: 102`,即自由悬浮形式窗口。 - -> **注意:** -> 1. save模式下,用户保存路径根据保存文件名执行强校验,用户保存路径参考[公共目录路径支持的文件格式](medialibrary-filepath-guidelines.md)。 -> 2. 用户选择目标文件保存路径后,如存在同名文件,FilePicker将弹窗提醒用户是否覆盖原文件。 - -ArkTS语言示例代码如下: -```ts -// 拉起FilePicker选择文件 -globalThis.context.startAbilityForResult( - { - action: "ohos.want.action.OPEN_FILE", - parameters: { - 'startMode': 'choose', //choose or save - } - }, - { windowMode: 102 } -) - -// 拉起FilePicker保存文件 -globalThis.context.startAbilityForResult( - { - action: "ohos.want.action.CREATE_FILE", - parameters: { - 'startMode': 'save', //choose or save - 'saveFile': 'test.jpg', - } - }, - { windowMode: 102 } -) - -// FilePicker返回给startAbilityForResult的数据 -let abilityResult = { - resultCode: resultCode, - want: { - parameters: { - 'startMode': startMode, - 'result': result - } - } -} -globalThis.context.terminateSelfWithResult(abilityResult) -``` - diff --git a/zh-cn/application-dev/file-management/manage-external-storage.md b/zh-cn/application-dev/file-management/manage-external-storage.md new file mode 100644 index 0000000000000000000000000000000000000000..3605bb615958975d445536bc24ff97399575171c --- /dev/null +++ b/zh-cn/application-dev/file-management/manage-external-storage.md @@ -0,0 +1,87 @@ +# 管理外置存储设备(仅对系统应用开放) + +外置存储设备具备可插拔属性,因此系统提供了设备插拔事件的监听及挂载功能,用于管理外置存储设备。 + +外置存储设备的管理由StorageManager和StorageDaemon两个服务完成。StorageDaemon实现底层的的监听挂载等功能;StorageManager则对系统应用提供状态变更通知、查询和管理能力。 + +**图1** 外置存储设备管理示意图   + +![External storage device management](figures/external-storage-device-management.png) + +- 插入外卡时,StorageDaemon进程通过netlink监听获取到外卡插入事件,创建对应的磁盘设备以及卷设备,此时,已创建的卷设备状态为卸载状态(UNMOUNTED)。 + +- StorageDaemon进程在创建完卷设备后,会对卷设备进行检查,此时卷状态为检查状态(CHECKING)。 + - 检查成功后,会对卷设备进行挂载,挂载成功后,卷状态更改为挂载状态(MOUNTED),并通知StorageManager发送COMMON_EVENT_VOLUME_MOUNTED广播。 + - 检查失败,则返回卸载状态(UNMOUNTED)。 + +- 当卷设备处于挂载状态时: + - 拔出卷设备,会直接删除相关卷设备信息,并发送COMMON_EVENT_VOLUME_BAD_REMOVAL广播。 + - 当用户选择弹出时,卷状态设备更改为正在弹出状态(EJECTING),并发送COMMON_EVENT_VOLUME_EJECT广播。StorageDaemon进程将卷设备卸载成功后,卷状态更改为卸载状态(UNMOUNTED),并发送COMMON_EVENT_VOLUME_UNMOUNTED广播。 + +- 当卷设备处于卸载状态时,拔出卷设备会删除相关卷设备信息,并发送COMMON_EVENT_VOLUME_REMOVED广播。 + +## 接口说明 + +外置存储设备管理相关API的详细介绍请参见[API参考](../reference/apis/js-apis-file-volumemanager.md)。 + +各类广播传递的相关参数,请见下表。 + +**表1** 广播传递的参数 + +| 广播类型 | 参数 | +| -------- | -------- | +| usual.event.data.VOLUME_REMOVED | id:卷设备ID
diskId:卷设备所属磁盘设备ID | +| usual.event.data.VOLUME_UNMOUNTED | id:卷设备ID
diskId:卷设备所属磁盘设备ID
volumeState:卷设备状态 | +| usual.event.data.VOLUME_MOUNTED | id:卷设备ID
diskId:卷设备所属磁盘设备ID
volumeState:卷设备状态
fsUuid:卷设备uuid
path:卷设备挂载路径 | +| usual.event.data.VOLUME_BAD_REMOVAL | id:卷设备ID
diskId:卷设备所属磁盘设备ID | +| usual.event.data.VOLUME_EJECT | id:卷设备ID
diskId:卷设备所属磁盘设备ID
volumeState:卷设备状态 | + +## 开发步骤 + +开发者通过订阅卷设备相关的广播事件来感知外置存储的插入,通过广播传递的信息获取卷设备信息后可以对卷设备进行查询以及管理操作。 + +1. 获取权限。 + 订阅卷设备广播事件需要申请ohos.permission.STORAGE_MANAGER权限,配置方式请参见[配置文件权限声明](../security/accesstoken-guidelines.md#配置文件权限声明)。 + +2. 订阅广播事件。 + 需订阅的事件如下: + + - 卷设备移除:"usual.event.data.VOLUME_REMOVED" + - 卷设备卸载:"usual.event.data.VOLUME_UNMOUNTED" + - 卷设备挂载:"usual.event.data.VOLUME_MOUNTED" + - 卷设备异常移除:"usual.event.data.VOLUME_BAD_REMOVAL" + - 卷设备正在弹出:"usual.event.data.VOLUME_EJECT" + + ```ts + import CommonEvent from '@ohos.commonEventManager'; + import volumeManager from '@ohos.file.volumeManager'; + + const subscribeInfo = { + events: [ + "usual.event.data.VOLUME_REMOVED", + "usual.event.data.VOLUME_UNMOUNTED", + "usual.event.data.VOLUME_MOUNTED", + "usual.event.data.VOLUME_BAD_REMOVAL", + "usual.event.data.VOLUME_EJECT" + ] + }; + let subscriber = await CommonEvent.createSubscriber(subscribeInfo); + ``` + +3. 收到广播通知后获取卷设备信息。 + + ```ts + CommonEvent.subscribe(subscriber, function (err, data) { + if (data.event === 'usual.event.data.VOLUME_MOUNTED') { + // 开发者可以通过广播传递的卷设备信息来管理卷设备 + let volId = data.parameters.id; + volumeManager.getVolumeById(volId, function(error, vol) { + if (error) { + console.error('volumeManager getVolumeById failed'); + } else { + console.info('volumeManager getVolumeById successfully, the volume state is ' + vol.state); + } + }) + } + }) + ``` diff --git a/zh-cn/application-dev/file-management/medialibrary-album-guidelines.md b/zh-cn/application-dev/file-management/medialibrary-album-guidelines.md deleted file mode 100644 index 0a697df0dc233a9a1500e868bde802aa7371976d..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/file-management/medialibrary-album-guidelines.md +++ /dev/null @@ -1,94 +0,0 @@ -# 相册资源使用指导 - -mediaLibrary提供相册相关的接口,供开发者创建、删除相册,获取相册中的图片资源等。 - -> **说明:** -> -> 在进行功能开发前,请开发者查阅[媒体库开发概述](medialibrary-overview.md),了解如何获取媒体库实例和如何申请媒体库功能开发相关权限。 - -为了保证应用的运行效率,大部分MediaLibrary调用都是异步的,对于异步调用的API均提供了callback和Promise两种方式,以下示例均采用Promise函数,更多方式可以查阅[API参考](../reference/apis/js-apis-medialibrary.md)。 - -## 获取相册中的图片/视频 - -获取相册中的图片、视频有两种方式: - -一是通过[MediaLibrary.getFileAssets](../reference/apis/js-apis-medialibrary.md#getfileassets7-1)指定相册以获取媒体资源,参考[获取指定相册的媒体资源](medialibrary-resource-guidelines.md#指定相册); - -二是通过[Album.getFileAssets](../reference/apis/js-apis-medialibrary.md#getfileassets7-3)使用相册Album实例获取媒体资源,参考[获取相册中的图片或视频](medialibrary-resource-guidelines.md#获取相册中的图片或视频)。 - -## 创建相册 - -通过[MediaLibrary.createAsset](../reference/apis/js-apis-medialibrary.md#createasset8-1)可以创建媒体资源,可以通过创建图片或视频文件时设置的相对路径,创建出相册。相对路径的命名即为相册名称。 - -**前提条件** - -- 获取媒体库mediaLibrary实例。 -- 申请媒体库读写权限“ohos.permission.WRITE_MEDIA”。 - -下面以创建相册myAlbum为例。 - -**开发步骤** - -1. 调用getPublicDirectory获取文件公共路径。 - - 获取文件公共路径的更多指导可参考[获取文件保存的公共目录](medialibrary-filepath-guidelines.md#获取文件保存的公共目录)。 - -2. 调用createAsset新建图片,并设置相对路径为path+'myAlbum/'。 - - 即在创建相册的同时,往里面放了一张图片。 - -```ts -async function example() { - let mediaType = mediaLibrary.MediaType.IMAGE; - let DIR_IMAGE = mediaLibrary.DirectoryType.DIR_IMAGE; - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - const path = await media.getPublicDirectory(DIR_IMAGE); - //myAlbum为新建文件保存路径,也是新建相册的名称 - media.createAsset(mediaType, 'test.jpg', path + 'myAlbum/', (err, fileAsset) => { - if (fileAsset === undefined) { - console.error('createAlbum failed, message = ' + err); - } else { - console.info('createAlbum successfully, message = ' + JSON.stringify(fileAsset)); - } - }); -} -``` - -## 重命名相册 - -重命名修改的是相册的FileAsset.albumName属性,即相册名称。修改后再通过[Album.commitModify](../reference/apis/js-apis-medialibrary.md#commitmodify8-3)更新到数据库中。 - -**前提条件** - -- 获取媒体库mediaLibrary实例。 -- 申请媒体库读写权限“ohos.permission.WRITE_MEDIA”。 - -下面以重命名相册为“newAlbum“为例。 - -**开发步骤** - -1. 建立检索条件,用于获取目标相册。 -2. 调用getAlbums获取相册列表。 -3. 将相册重命名为“newAlbum“。 -4. 调用Album.commitModify将更新的相册属性修改到数据库中。 - -```ts -async function example() { - let AlbumNoArgsfetchOp = { - selections: '', - selectionArgs: [], - }; - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - let albumList = await media.getAlbums(AlbumNoArgsfetchOp); - let album = albumList[0]; - album.albumName = 'newAlbum'; - //回调返回空 - album.commitModify().then(() => { - console.info("albumRename successfully"); - }).catch((err) => { - console.error("albumRename failed with error: " + err); - }); -} -``` diff --git a/zh-cn/application-dev/file-management/medialibrary-filepath-guidelines.md b/zh-cn/application-dev/file-management/medialibrary-filepath-guidelines.md deleted file mode 100644 index 562ae00767b674be4423014cf1970b4759da5204..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/file-management/medialibrary-filepath-guidelines.md +++ /dev/null @@ -1,249 +0,0 @@ -# 文件路径使用指导 - -Openharmony上用户数据统一由媒体库进行管理,用户数据用户数据可以通过mediaLibrary提供的接口能力进行访问和操作。 - -> **说明:** -> -> 在进行功能开发前,请开发者查阅[媒体库开发概述](medialibrary-overview.md),了解如何获取媒体库实例和如何申请媒体库功能开发相关权限。 - -为了保证应用的运行效率,大部分MediaLibrary调用都是异步的,对于异步调用的API均提供了callback和Promise两种方式,以下示例均采用Promise函数,更多方式可以查阅[API参考](../reference/apis/js-apis-medialibrary.md)。 - -## 公共目录路径支持的文件格式 - -在使用文件路径进行开发之前,需要了解各公共目录路径支持的文件格式说明。 -> **注意:**
-> 下表仅表示系统能识别的文件类型,在具体的开发中,开发者需要关注对应接口支持的文件格式。
如image编码功能只支持.jpeg和.webp,解码功能只支持.jpg .png .gif .bmp .webp RAW。 - -| 目录路径 | 目录类型 | 媒体类型 | 说明 | 支持的文件格式 | -| ---------- | ------------- | ------------- | -------------- | ------------------------------------------------------------ | -| Camera/ | DIR_CAMERA | VIDEO amd IMAGE | 相机拍摄图片与录像的存放路径,目录与子目录下可以存放视频,图片类型文件。 | .bmp / .bm / .gif / .jpg /. jpeg / .jpe / .png / .webp / .raw / .svg / .heif / .mp4 / .3gp / .mpg / .mov / .webm / .mkv | -| Videos/ | DIR_VIDEO | VIDEO | 视频专有目录,目录与子目录下只可以存放视频类型文件。| .mp4 / .3gp / .mpg / .mov / .webm / .mkv | -| Pictures/ | DIR_IMAGE | IMAGE | 图片专有目录,目录与子目录下只可以存放图片类型文件。 | .bmp / .bm / .gif / .jpg /. jpeg / .jpe / .png / .webp / .raw / .svg / .heif | -| Audios/ | DIR_AUDIO | AUDIO |音频专有目录,目录与子目录下只可以存放音频类型文件。| .aac/.mp3/.flac/.wav/.ogg | -| Documents/ | DIR_DOCUMENTS | FILE |文档类型目录,目录与子目录下只可以存放音频,图片,视频以外类型文件。| - | -| Download/ | DIR_DOWNLOAD | ALLTYPE |下载文件存放目录,目录与子目录下文件类型不受限制。| - | - -## 获取文件保存的公共目录 - -不同类型的文件会保存到不同的公共目录下,可以通过接口[getPublicDirectory](../reference/apis/js-apis-medialibrary.md#getpublicdirectory8-1)来获取公共目录路径。 - -**前提条件** - -- 获取媒体库mediaLibrary实例。 -- 申请媒体库读权限"ohos.permission.READ_MEDIA"。 - -下面以获取Camera文件保存的公共目录为例。 - -```ts -async function example(){ - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - let DIR_CAMERA = mediaLibrary.DirectoryType.DIR_CAMERA; - const dicResult = await media.getPublicDirectory(DIR_CAMERA); - if (dicResult == 'Camera/') { - console.info('mediaLibraryTest : getPublicDirectory passed'); - } else { - console.error('mediaLibraryTest : getPublicDirectory failed'); - } -} -``` - -## 沙箱与公共路径间文件的复制 - -OpenHarmony提供应用沙箱机制,增加目录可见性数据访问防线,减少了应用数据和用户隐私信息泄露,建立了更加严格安全的应用沙盒隔离能力。 - -放在公共路径下的文件,用户可以通过系统应用“文件管理”、“图库”访问,但应用沙箱内的文件,只有应用本身可以访问。 - -### 复制文件 - -通过接口[mediaLibrary.FileAsset.open](../reference/apis/js-apis-medialibrary.md#open8-1)可以打开公共路径文件。 - -通过接口[fs.open](../reference/apis/js-apis-file-fs.md#fsopen)可以打开沙箱路径文件,沙箱路径必须通过应用上下文context进行访问。 - -**前提条件** - -- 获取媒体库mediaLibrary实例。 -- 申请媒体库读写权限"ohos.permission.READ_MEDIA, ohos.permission.WRITE_MEDIA"。 -- 除了@ohos.multimedia.mediaLibrary外,还需要导入模块[@ohos.file.fs](../reference/apis/js-apis-file-fs.md)。 -- 测试文件 "testFile.txt" 已创建且有文件内容。 - -**开发步骤** - -1. 调用[context.filesDir](../reference/apis/js-apis-file-fs.md)获取应用沙箱路径。 -2. 调用MediaLibrary.getFileAssets和FetchFileResult.getFirstObject获取公共目录中的FileAsset实例。 -3. 调用fs.open打开沙箱路径文件。 -4. 调用fileAsset.open打开公共路径文件。 -5. 调用[fs.copyfile](../reference/apis/js-apis-file-fs.md#fscopyfile)复制文件。 -6. 调用fileAsset.close和[fs.close](../reference/apis/js-apis-file-fs.md#fsclose)关闭文件。 - -**示例1 将公共路径文件复制到沙箱路径下** - -```ts -async function copyPublic2Sandbox() { - try { - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - let sandboxDirPath = context.filesDir; - let fileKeyObj = mediaLibrary.FileKey; - let fileAssetFetchOp = { - selections: fileKeyObj.DISPLAY_NAME + '= ?', - selectionArgs: ['testFile.txt'], - }; - let fetchResult = await media.getFileAssets(fileAssetFetchOp); - let fileAsset = await fetchResult.getFirstObject(); - - let fdPub = await fileAsset.open('rw'); - let fdSand = await fs.open(sandboxDirPath + '/testFile.txt', fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); - await fs.copyFile(fdPub, fdSand.fd); - - await fileAsset.close(fdPub); - await fs.close(fdSand.fd); - - let content_sand = await fs.readText(sandboxDirPath + '/testFile.txt'); - console.info('content read from sandbox file: ', content_sand) - } catch (err) { - console.info('[demo] copyPublic2Sandbox fail, err: ', err); - } -} -``` - -**示例2 将应用沙箱路径文件复制到公共路径** - -```ts -async function copySandbox2Public() { - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - let sandboxDirPath = context.filesDir; - - let DIR_DOCUMENTS = mediaLibrary.DirectoryType.DIR_DOCUMENTS; - const publicDirPath = await media.getPublicDirectory(DIR_DOCUMENTS); - try { - let fileAsset = await media.createAsset(mediaLibrary.MediaType.FILE, 'testFile02.txt', publicDirPath); - console.info('createFile successfully, message = ' + fileAsset); - } catch (err) { - console.error('createFile failed, message = ' + err); - } - try { - let fileKeyObj = mediaLibrary.FileKey; - let fileAssetFetchOp = { - selections: fileKeyObj.DISPLAY_NAME + '= ?', - selectionArgs: ['testFile02.txt'], - }; - let fetchResult = await media.getFileAssets(fileAssetFetchOp); - var fileAsset = await fetchResult.getFirstObject(); - } catch (err) { - console.error('file asset get failed, message = ' + err); - } - let fdPub = await fileAsset.open('rw'); - let fdSand = await fs.open(sandboxDirPath + 'testFile.txt', OpenMode.READ_WRITE); - await fs.copyFile(fdSand.fd, fdPub); - await fileAsset.close(fdPub); - await fs.close(fdSand.fd); - let fdPubRead = await fileAsset.open('rw'); - try { - let arrayBuffer = new ArrayBuffer(4096); - await fs.read(fdPubRead, arrayBuffer); - var content_pub = String.fromCharCode(...new Uint8Array(arrayBuffer)); - fileAsset.close(fdPubRead); - } catch (err) { - console.error('read text failed, message = ', err); - } - console.info('content read from public file: ', content_pub); -} -``` - -### 读写文件内容 - -通过[mediaLibrary](../reference/apis/js-apis-medialibrary.md)的接口FileAsset.open和FileAsset.close可以打开和关闭文件。通过[file.fs](../reference/apis/js-apis-file-fs.md)中的接口fs.read和fs.write可以读写文件。 - -**前提条件** - -- 获取媒体库mediaLibrary实例。 -- 申请媒体库读写权限"ohos.permission.READ_MEDIA, ohos.permission.WRITE_MEDIA"。 -- 除了@ohos.multimedia.mediaLibrary外,还需要导入模块[@ohos.file.fs](../reference/apis/js-apis-file-fs.md)。 - -**开发步骤** - -1. 创建用于读写示例的文件。 - -```ts -async function example() { - let mediaType = mediaLibrary.MediaType.FILE; - let DIR_DOCUMENTS = mediaLibrary.DirectoryType.DIR_DOCUMENTS; - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - const path = await media.getPublicDirectory(DIR_DOCUMENTS); - media.createAsset(mediaType, "testFile.txt", path).then((asset) => { - console.info("createAsset successfully:" + JSON.stringify(asset)); - }).catch((err) => { - console.error("createAsset failed with error: " + err); - }); -} -``` - -2. 使用open打开文件。 - -3. 使用[fs.write](../reference/apis/js-apis-file-fs.md#fswrite)写入文件,以string形式传入写入数据。 - -4. 使用[fs.read](../reference/apis/js-apis-file-fs.md#fsread)读取文件,以 ArrayBuffer 形式保存读取结果。 - -5. 将ArrayBuffer转化为string,以string形式得到文件内容。 - -6. 使用close关闭文件。 - -**示例1 打开现有文件、向文件中写入** - -```ts -async function writeOnlyPromise() { - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - let fileKeyObj = mediaLibrary.FileKey; - let fileAssetFetchOp = { - selections: fileKeyObj.DISPLAY_NAME + '= ?', - selectionArgs: ['testFile.txt'], - }; - let fetchResult = await media.getFileAssets(fileAssetFetchOp); - let fileAsset = await fetchResult.getFirstObject(); - console.info('fileAssetName: ', fileAsset.displayName); - - try { - let fd = await fileAsset.open('w'); - console.info('file descriptor: ', fd); - await fs.write(fd, "Write file test content."); - await fileAsset.close(fd); - } catch (err) { - console.error('write file failed, message = ', err); - } -} -``` - -**示例2 打开现有文件,读取文件内容** - -```ts -async function readOnlyPromise() { - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - let fileKeyObj = mediaLibrary.FileKey; - let fileAssetFetchOp = { - selections: fileKeyObj.DISPLAY_NAME + '= ?' , - selectionArgs: ['testFile.txt'], - }; - let fetchResult = await media.getFileAssets(fileAssetFetchOp); - let fileAsset = await fetchResult.getFirstObject(); - console.info('fileAssetName: ', fileAsset.displayName); - - try { - let fd = await fileAsset.open('r'); - let arrayBuffer = new ArrayBuffer(4096); - await fs.read(fd, arrayBuffer); - let fileContent = String.fromCharCode(...new Uint8Array(arrayBuffer)); - globalThis.fileContent = fileContent; - globalThis.fileName = fileAsset.displayName; - console.info('file content: ', fileContent); - await fileAsset.close(fd); - } catch (err) { - console.error('read file failed, message = ', err); - } -} -``` - diff --git a/zh-cn/application-dev/file-management/medialibrary-overview.md b/zh-cn/application-dev/file-management/medialibrary-overview.md deleted file mode 100644 index 5ccc5310d3304afab08d7ac98858b32a93e9bb49..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/file-management/medialibrary-overview.md +++ /dev/null @@ -1,127 +0,0 @@ -# 媒体库开发概述 - -MediaLibrary提供媒体库相关能力,帮助开发者更方便地访问和修改媒体文件,具体分为: - -- [媒体资源(音频、视频、图片文件等)相关](medialibrary-resource-guidelines.md),包括: - - 查询指定媒体资源 - - 获取图片/视频 - - 获取图片/视频缩略图 - - 创建媒体资源 - - 重命名媒体资源 - - 将媒体资源放入回收站 -- [文件路径相关](medialibrary-filepath-guidelines.md),包括: - - 获取文件保存的公共目录 - - 沙箱与公共路径间文件的复制 - - 读写文件内容 -- [相册相关](medialibrary-album-guidelines.md),包括: - - 获取相册中的图片/视频 - - 创建相册 - - 重命名相册 - -> **说明:**
-> 本开发指导基于API Version 9,仅适用于Stage模型。 - -应用需要先获取媒体库实例,才能访问和修改用户等个人媒体数据信息。媒体库涉及用户个人数据信息,所以应用需要向用户申请媒体库读写操作权限才能保证功能的正常运行。在使用媒体库相关接口时如无其他注明则默认在工程代码的pages/index.ets或者其他自创的ets文件中使用 - -开发者在使用MediaLibrary进行功能开发前,请先掌握以下内容: - -- [获取媒体库实例](#获取媒体库实例) -- [申请媒体库功能相关权限](#申请媒体库功能相关权限) - -## 获取媒体库实例 - -应用需要使用应用上下文Context通过接口[getMediaLibrary](../reference/apis/js-apis-medialibrary.md#medialibrarygetmedialibrary8),获取媒体库实例,用于访问和修改用户等个人媒体数据信息(如音频、视频、图片、文档等)。 - -**开发步骤** - -1. 导入mediaLibrary模块以使用媒体库相关接口。 -2. 通过getContext获取应用上下文。 -3. 获取媒体库实例。 - -```ts -import mediaLibrary from '@ohos.multimedia.mediaLibrary'; - -const context = getContext(this); -let media = mediaLibrary.getMediaLibrary(context); -``` - -## 申请媒体库功能相关权限 - -媒体库的读写操作需要相应权限,在申请权限前,请保证符合[权限使用的基本原则](../security/accesstoken-overview.md#权限使用的基本原则)。涉及的权限如下表。 - -| 权限名 | 说明 | 授权方式 | -| ------------------------------ | ------------------------------------------ | ---------- | -| ohos.permission.READ_MEDIA | 允许应用读取用户外部存储中的媒体文件信息。 | user_grant | -| ohos.permission.WRITE_MEDIA | 允许应用读写用户外部存储中的媒体文件信息。 | user_grant | -| ohos.permission.MEDIA_LOCATION | 允许应用访问用户媒体文件中的地理位置信息。 | user_grant | - -以上权限的授权方式均为user_grant(用户授权),即开发者在module.json5文件中配置对应的权限后,需要使用接口[abilityAccessCtrl.requestPermissionsFromUser](../reference/apis/js-apis-abilityAccessCtrl.md#requestpermissionsfromuser9)去校验当前用户是否已授权。如果是,应用可以直接访问/操作目标对象;否则需要弹框向用户申请授权。 - -> **说明:**
即使用户曾经授予权限,应用在调用受此权限保护的接口前,也应该先检查是否有权限。不能把之前授予的状态持久化,因为用户在动态授予后还可以通过“设置”取消应用的权限。 - -**开发步骤** - -1. 在配置文件module.json5中声明权限。在配置文件的“module”标签内,增加“requestPermissions”标签,标签内容请根据实际情况填写。标签说明可参考[访问控制(权限)开发指导](../security/accesstoken-guidelines.md)。 - -```json -{ - "module": { - "requestPermissions": [ - { - "name": "ohos.permission.MEDIA_LOCATION", - "reason": "$string:reason", - "usedScene": { - "abilities": [ - "EntryAbility" - ], - "when": "always" - } - }, - { - "name": "ohos.permission.READ_MEDIA", - "reason": "$string:reason", - "usedScene": { - "abilities": [ - "EntryAbility" - ], - "when": "always" - } - }, - { - "name": "ohos.permission.WRITE_MEDIA", - "reason": "$string:reason", - "usedScene": { - "abilities": [ - "EntryAbility" - ], - "when": "always" - } - } - ] - } -} -``` - -2. 在Ability.ts中onWindowStageCreate里调用requestPermissionsFromUser进行权限校验,可以选择需要动态申请获取的权限自行添加相应代码 - -```ts -import UIAbility from '@ohos.app.ability.UIAbility'; -import abilityAccessCtrl, {Permissions} from '@ohos.abilityAccessCtrl'; - -export default class EntryAbility extends UIAbility { - onWindowStageCreate(windowStage) { - let list : Array = ['ohos.permission.READ_MEDIA', 'ohos.permission.WRITE_MEDIA']; - let permissionRequestResult; - let atManager = abilityAccessCtrl.createAtManager(); - atManager.requestPermissionsFromUser(this.context, list, (err, result) => { - if (err) { - console.error('requestPermissionsFromUserError: ' + JSON.stringify(err)); - } else { - permissionRequestResult = result; - console.info('permissionRequestResult: ' + JSON.stringify(permissionRequestResult)); - } - }); - } -} -``` - diff --git a/zh-cn/application-dev/file-management/medialibrary-resource-guidelines.md b/zh-cn/application-dev/file-management/medialibrary-resource-guidelines.md deleted file mode 100644 index 3d87b249e9d8b785b833f8cbd6f471f97f85b152..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/file-management/medialibrary-resource-guidelines.md +++ /dev/null @@ -1,386 +0,0 @@ -# 媒体资源使用指导 - -应用可以通过mediaLibrary的接口,进行媒体资源(音频、视频、图片文件等)相关操作。 - -> **说明:** -> -> 在进行功能开发前,请开发者查阅[媒体库开发概述](medialibrary-overview.md),了解如何获取媒体库实例和如何申请媒体库功能开发相关权限。 - -为了保证应用的运行效率,大部分MediaLibrary调用都是异步的,对于异步调用的API均提供了callback和Promise两种方式,以下示例均采用Promise函数,更多方式可以查阅[API参考](../reference/apis/js-apis-medialibrary.md)。 - -## 获取媒体资源 - -开发者可以根据特定的条件查询媒体资源,如指定类型、指定日期、指定相册等。 - -应用通过调用[MediaLibrary.getFileAssets](../reference/apis/js-apis-medialibrary.md#getfileassets7-1)获取媒体资源,并传入MediaFetchOptions对象指定检索条件。MediaFetchOptions.selections为检索条件,使用FileKey中的枚举值作为检索条件的列名;MediaFetchOptions.selectionArgs对应selections中检索条件列的值;除此之外,可以使用order(结果排序方式)、uri(文件URI)、networkId(注册设备网络ID)作为检索条件。 - -如果只想获取某个位置的对象(如第一个、最后一个、指定索引等),可以通过[FetchFileResult](../reference/apis/js-apis-medialibrary.md#fetchfileresult7)中的接口获取对应位置的媒体资源对象。本小节均采用getNextObject循环获取检索结果中的所有媒体资源。 - -**前提条件** - -- 获取媒体库mediaLibrary实例。 -- 申请媒体库读权限“ohos.permission.READ_MEDIA”。 - -### 指定媒体类型 - -下面以查询图片类型的媒体资源为例。 - -**开发步骤** - -selections: FileKey.MEDIA_TYPE,根据媒体类型检索。 - -selectionArgs: MediaType.IMAGE,媒体类型为图片。 - -```ts -async function example() { - let fileKeyObj = mediaLibrary.FileKey; - let fileType = mediaLibrary.MediaType.IMAGE; - let option = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [fileType.toString()], - }; - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - const fetchFileResult = await media.getFileAssets(option); - fetchFileResult.getFirstObject().then(async (fileAsset) => { - console.log('getFirstObject.displayName : ' + fileAsset.displayName); - for (let i = 1; i < fetchFileResult.getCount(); i++) { - let fileAsset = await fetchFileResult.getNextObject(); - console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); - } - }).catch((err) => { - console.error('Failed to get first object: ' + err); - }); -} -``` - -### 指定日期 - -下面以查询指定添加日期至今的所有媒体资源为例。实际开发中可以设置添加日期、修改日期、拍摄日期。 - -selections: FileKey.DATE_ADDED,根据文件添加日期检索。 - -selectionArgs:2022-8-5,具体添加时间的字符串。 - -```ts -async function example() { - let fileKeyObj = mediaLibrary.FileKey; - let option = { - selections: fileKeyObj.DATE_ADDED + '> ?', - selectionArgs: ['2022-8-5'], - }; - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - const fetchFileResult = await media.getFileAssets(option); - fetchFileResult.getFirstObject().then(async (fileAsset) => { - console.info('getFirstObject.displayName : ' + fileAsset.displayName); - for (let i = 1; i < fetchFileResult.getCount(); i++) { - let fileAsset = await fetchFileResult.getNextObject(); - console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); - } - }).catch((err) => { - console.error('Failed to get first object: ' + err); - }); -} -``` - -### 按指定顺序排列 - -下面以查询图片并按文件添加日期降序排列为例。实际开发中可以设置升序(ASC)和降序(DESC)。 - -order: FileKey.DATE_ADDED,根据文件添加日期排序;并设置排列顺序为DESC降序。 - -```ts -async function example() { - let fileKeyObj = mediaLibrary.FileKey; - let fileType = mediaLibrary.MediaType.IMAGE; - let option = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [fileType.toString()], - order: fileKeyObj.DATE_ADDED + " DESC", - }; - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - const fetchFileResult = await media.getFileAssets(option); - fetchFileResult.getFirstObject().then(async (fileAsset) => { - console.info('getFirstObject.displayName : ' + fileAsset.displayName); - for (let i = 1; i < fetchFileResult.getCount(); i++) { - let fileAsset = await fetchFileResult.getNextObject(); - console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); - } - }).catch((err) => { - console.error('Failed to get first object: ' + err); - }); -} -``` - -### 指定相册 - -下面以指定相册myAlbum为例。 - -selections: FileKey.ALBUM_NAME,根据相册名称检索。 - -selectionArgs:'myAlbum',具体相册名称。 - -```ts -async function example() { - let fileKeyObj = mediaLibrary.FileKey; - let option = { - selections: fileKeyObj.ALBUM_NAME + '= ?', - selectionArgs: ['myAlbum'], - }; - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - const fetchFileResult = await media.getFileAssets(option); - if (albumList.length > 0) { - fetchFileResult.getFirstObject().then((album) => { - console.info('getFirstObject.displayName : ' + album.albumName); - }).catch((err) => { - console.error('Failed to get first object: ' + err); - }); - } else { - console.info('getAlbum list is: 0'); - } -} -``` - -## 获取相册中的图片或视频 - -获取相册的媒体资源有两种方式,一是通过[MediaLibrary.getFileAssets](../reference/apis/js-apis-medialibrary.md#getfileassets7-1)指定相册以获取媒体资源,参考[获取指定相册的媒体资源](#指定相册);二是通过[Album.getFileAssets](../reference/apis/js-apis-medialibrary.md#getfileassets7-3)使用相册Album实例获取媒体资源。 - -**前提条件** - -- 获取媒体库mediaLibrary实例。 -- 申请媒体库读权限“ohos.permission.READ_MEDIA”。 - -**开发步骤** - -下面以获取相册名称为“新建相册1”的视频为例。 - -1. 建立检索条件,用于获取目的相册实例。 - -```ts -let fileKeyObj = mediaLibrary.FileKey; -let AlbumNoArgsFetchOp = { - selections: fileKeyObj.ALBUM_NAME + '= ?', - selectionArgs: ['新建相册1'] -} -``` - -2. 建立检索条件,用于获取目的相册下的视频资源。 - -```ts -let fileKeyObj = mediaLibrary.FileKey; -let videoType = mediaLibrary.MediaType.VIDEO; -let videoFetchOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [videoType.toString()], -} -``` - -3. 通过Album.getFileAssets获取对应的资源。 - -以下为**完整示例**。 - -```ts -async function getCameraImagePromise() { - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - let fileKeyObj = mediaLibrary.FileKey; - let videoType = mediaLibrary.MediaType.VIDEO; - let videoFetchOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [videoType.toString()], - } - let AlbumNoArgsFetchOp = { - selections: fileKeyObj.ALBUM_NAME + '= ?', - selectionArgs: ['新建相册1'] - } - - let albumList = await media.getAlbums(AlbumNoArgsFetchOp); - if (albumList.length > 0) { - const album = albumList[0]; - let fetchFileResult = await album.getFileAssets(videoFetchOp); - let count = fetchFileResult.getCount(); - console.info("get mediaLibrary VIDEO number", count); - } else { - console.info('getAlbum list is: 0'); - } -} -``` - -## 获取图片/视频缩略图 - -通过接口[FileAsset.getThumbnail](../reference/apis/js-apis-medialibrary.md#getthumbnail8-2),传入缩略图尺寸,可以获取图片/视频缩略图。缩略图常用于UI界面展示。 - -**前提条件** - -- 获取媒体库mediaLibrary实例。 -- 申请媒体库读权限“ohos.permission.READ_MEDIA”。 - -### 获取某张图片的缩略图 - -当需要在相册展示图片/视频、编辑预览,应用需要获取某张图片的缩略图。 - -下面以获取相册第一张图片的缩略图为例,缩略图尺寸为720*720。 - -**开发步骤** - -1. 建立检索条件,用于获取目的相册下的图片资源。 -2. 调用getFileAssets获取目标图片资源。 -3. 调用getFirstObject获取第一张图片。 -4. 调用getThumbnail获取相册中图片的缩略图。 - -```ts -async function getFirstThumbnailPromise() { - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - let fileKeyObj = mediaLibrary.FileKey; - let imageType = mediaLibrary.MediaType.IMAGE; - let imagesFetchOp = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [imageType.toString()], - } - - let size = { width: 720, height: 720 }; - const fetchFileResult = await media.getFileAssets(imagesFetchOp); - if (fetchFileResult === undefined) { - console.error("get image failed with error"); - return; - } else { - const asset = await fetchFileResult.getFirstObject(); - asset.getThumbnail(size).then((pixelMap) => { - pixelMap.getImageInfo().then((info) => { - console.info('get Thumbnail info: ' + "width: " + info.size.width + " height: " + info.size.height); - }).catch((err) => { - console.error("getImageInfo failed with error: " + err); - }); - }).catch((err) => { - console.error("getImageInfo failed with error: " + err); - }); - } -} -``` - -## 创建媒体资源 - -通过接口[MediaLibrary.createAsset](../reference/apis/js-apis-medialibrary.md#createasset8-1)可以创建媒体资源。 - -**前提条件** - -- 获取媒体库mediaLibrary实例。 -- 申请媒体库读写权限“ohos.permission.WRITE_MEDIA”。 -- [获取公共目录路径](medialibrary-filepath-guidelines.md)。 - -下面以创建文件类型(MediaType.FILE)的文件为例。 - -```ts -async function example() { - let mediaType = mediaLibrary.MediaType.FILE; - let DIR_DOCUMENTS = mediaLibrary.DirectoryType.DIR_DOCUMENTS; - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - const path = await media.getPublicDirectory(DIR_DOCUMENTS); - media.createAsset(mediaType, "testFile.text", path).then((asset) => { - console.info("createAsset successfully:"+ JSON.stringify(asset)); - }).catch((err) => { - console.error("createAsset failed with error: " + err); - }); -} -``` - -## 将文件放入回收站 - -通过[FileAsset.trash](../reference/apis/js-apis-medialibrary.md#trash8)可以将文件放入回收站。 - -放入回收站的文件将会保存30天,在此期间,开发者可以将trash的入参isTrash设置为false将其恢复为正常文件;应用用户也可以通过系统应用“文件管理”或“图库”恢复文件。 - -**前提条件** - -- 获取媒体库mediaLibrary实例。 -- 申请媒体库读写权限“ohos.permission.WRITE_MEDIA”。 - -下面以将文件检索结果中第一个文件放入回收站为例。 - -**开发步骤** - -1. 建立检索条件,用于获取目的相册下的图片资源。 -2. 调用getFileAssets获取目标图片资源。 -3. 调用getFirstObject获取第一张图片,即要放入回收站的图片对象。 -4. 调用trash将文件放入回收站。 - -```ts -async function example() { - let fileKeyObj = mediaLibrary.FileKey; - let fileType = mediaLibrary.MediaType.FILE; - let option = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [fileType.toString()], - }; - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - const fetchFileResult = await media.getFileAssets(option); - let asset = await fetchFileResult.getFirstObject(); - if (asset === undefined) { - console.error('asset not exist'); - return; - } - //回调为空 - asset.trash(true).then(() => { - console.info("trash successfully"); - }).catch((err) => { - console.error("trash failed with error: " + err); - }); -} -``` - -## 重命名媒体资源 - -重命名修改的是文件的FileAsset.displayName属性,即文件的显示文件名,包含文件后缀。 - -修改后再通过[FileAsset.commitModify](../reference/apis/js-apis-medialibrary.md#commitmodify8-1)更新到数据库中。 - -在重命名文件之前,需要先获取文件对象,可以通过[FetchFileResult](../reference/apis/js-apis-medialibrary.md#fetchfileresult7)中的接口获取对应位置的文件。 - -**前提条件** - -- 获取媒体库mediaLibrary实例。 -- 申请媒体库读写权限“ohos.permission.WRITE_MEDIA”。 - -下面以将文件检索结果中第一个文件重命名为“newImage.jpg”为例。 - -**开发步骤** - -1. 建立检索条件,用于获取目的相册下的图片资源。 -2. 调用getFileAssets获取目标图片资源。 -3. 调用getFirstObject获取第一张图片,即要重命名的图片对象。 -4. 将图片重命名为“newImage.jpg“。 -5. 调用FileAsset.commitModify将更新的图片属性修改到数据库中。 - -```ts -async function example() { - let fileKeyObj = mediaLibrary.FileKey; - let fileType = mediaLibrary.MediaType.IMAGE; - let option = { - selections: fileKeyObj.MEDIA_TYPE + '= ?', - selectionArgs: [fileType.toString()], - }; - const context = getContext(this); - let media = mediaLibrary.getMediaLibrary(context); - const fetchFileResult = await media.getFileAssets(option); - let asset = await fetchFileResult.getFirstObject(); - if (asset === undefined) { - console.error('asset not exist'); - return; - } - asset.displayName = 'newImage.jpg'; - //回调为空 - asset.commitModify((err) => { - if (err) { - console.error('fileRename Failed '); - return; - } - console.info('fileRename successful.'); - }); -} -``` diff --git a/zh-cn/application-dev/file-management/public_sys-resources/icon-caution.gif b/zh-cn/application-dev/file-management/public_sys-resources/icon-caution.gif new file mode 100644 index 0000000000000000000000000000000000000000..6e90d7cfc2193e39e10bb58c38d01a23f045d571 Binary files /dev/null and b/zh-cn/application-dev/file-management/public_sys-resources/icon-caution.gif differ diff --git a/zh-cn/application-dev/file-management/public_sys-resources/icon-danger.gif b/zh-cn/application-dev/file-management/public_sys-resources/icon-danger.gif new file mode 100644 index 0000000000000000000000000000000000000000..6e90d7cfc2193e39e10bb58c38d01a23f045d571 Binary files /dev/null and b/zh-cn/application-dev/file-management/public_sys-resources/icon-danger.gif differ diff --git a/zh-cn/application-dev/file-management/public_sys-resources/icon-note.gif b/zh-cn/application-dev/file-management/public_sys-resources/icon-note.gif new file mode 100644 index 0000000000000000000000000000000000000000..6314297e45c1de184204098efd4814d6dc8b1cda Binary files /dev/null and b/zh-cn/application-dev/file-management/public_sys-resources/icon-note.gif differ diff --git a/zh-cn/application-dev/file-management/public_sys-resources/icon-notice.gif b/zh-cn/application-dev/file-management/public_sys-resources/icon-notice.gif new file mode 100644 index 0000000000000000000000000000000000000000..86024f61b691400bea99e5b1f506d9d9aef36e27 Binary files /dev/null and b/zh-cn/application-dev/file-management/public_sys-resources/icon-notice.gif differ diff --git a/zh-cn/application-dev/file-management/public_sys-resources/icon-tip.gif b/zh-cn/application-dev/file-management/public_sys-resources/icon-tip.gif new file mode 100644 index 0000000000000000000000000000000000000000..93aa72053b510e456b149f36a0972703ea9999b7 Binary files /dev/null and b/zh-cn/application-dev/file-management/public_sys-resources/icon-tip.gif differ diff --git a/zh-cn/application-dev/file-management/public_sys-resources/icon-warning.gif b/zh-cn/application-dev/file-management/public_sys-resources/icon-warning.gif new file mode 100644 index 0000000000000000000000000000000000000000..6e90d7cfc2193e39e10bb58c38d01a23f045d571 Binary files /dev/null and b/zh-cn/application-dev/file-management/public_sys-resources/icon-warning.gif differ diff --git a/zh-cn/application-dev/file-management/save-user-file.md b/zh-cn/application-dev/file-management/save-user-file.md new file mode 100644 index 0000000000000000000000000000000000000000..4695c62d48a5b32e5ac22b35220d17617b6b5f53 --- /dev/null +++ b/zh-cn/application-dev/file-management/save-user-file.md @@ -0,0 +1,103 @@ +# 保存用户文件 + +在从网络下载文件到本地、或将已有用户文件另存为新的文件路径等场景下,需要使用FilePicker提供的保存用户文件的能力。 + +对音频、图片、视频、文档类文件的保存操作类似,均通过调用对应picker的save()接口并传入对应的saveOptions来实现。 + + +## 保存图片或视频类文件 + +1. 导入选择器模块。 + + ```ts + import picker from '@ohos.file.picker'; + ``` + +2. 创建图库保存选项实例。 + + ```ts + const photoSaveOptions = new picker.PhotoSaveOptions(); // 创建文件管理器保存选项实例 + photoSaveOptions.newFileNames = ["PhotoViewPicker01.jpg"]; // 保存文件名(可选) + ``` + +3. 创建图库选择器实例,调用[save()](../reference/apis/js-apis-file-picker.md#save)接口拉起FilePicker界面进行文件保存。 + 用户选择目标文件夹,用户选择与文件类型相对应的文件夹,即可完成文件保存操作。保存成功后,返回保存文档的URI。 + + ```ts + const photoViewPicker = new picker.PhotoViewPicker(); + photoViewPicker.save(photoSaveOptions) + .then(async (photoSaveResult) => { + let uri = photoSaveResult[0]; + // 获取到到图片或者视频文件的URI后进行文件读取等操作 + }) + .catch((err) => { + console.error(`Invoke documentPicker.select failed, code is ${err.code}, message is ${err.message}`); + }) + ``` + +## 保存文档类文件 + +1. 导入选择器模块。 + + ```ts + import picker from '@ohos.file.picker'; + ``` + +2. 创建文档保存选项实例。 + + ```ts + const documentSaveOptions = new picker.DocumentSaveOptions(); // 创建文件管理器选项实例 + documentSaveOptions.newFileNames = ["DocumentViewPicker01.txt"]; // 保存文件名(可选) + ``` + +3. 创建文档选择器实例。调用[save()](../reference/apis/js-apis-file-picker.md#save-3)接口拉起FilePicker界面进行文件保存。 + 用户选择目标文件夹,用户选择与文件类型相对应的文件夹,即可完成文件保存操作。保存成功后,返回保存文档的URI。 + + > **说明:** + > + > 目前DocumentSelectOptions不支持参数配置,默认可以选择所有类型的用户文件。 + + ```ts + const documentViewPicker = new picker.DocumentViewPicker(); // 创建文件选择器实例 + documentViewPicker.save(documentSaveOptions) + .then(async (documentSaveResult) => { + let uri = documentSaveResult[0]; + // 例如,可以根据获取的URI进行文件写入等操作 + }) + .catch((err) => { + console.error(`Invoke documentPicker.save failed, code is ${err.code}, message is ${err.message}`); + }) + ``` + +## 保存音频类文件 + +1. 导入选择器模块。 + + ```ts + import picker from '@ohos.file.picker'; + ``` + +2. 创建音频保存选项实例。 + + ```ts + const audioSaveOptions = new picker.AudioSaveOptions(); // 创建文件管理器选项实例 + audioSaveOptions.newFileNames = ['AudioViewPicker01.mp3']; // 保存文件名(可选) + ``` + +3. 创建音频选择器实例。调用[save()](../reference/apis/js-apis-file-picker.md#save-6)接口拉起FilePicker界面进行文件保存。 + 用户选择目标文件夹,用户选择与文件类型相对应的文件夹,即可完成文件保存操作。保存成功后,返回保存文档的URI。 + > **说明:** + > + > 目前AudioSelectOptions不支持参数配置,默认可以选择所有类型的用户文件。 + + ```ts + const audioViewPicker = new picker.AudioViewPicker(); + audioViewPicker.save(audioSaveOptions) + .then((audioSelectResult) => { + let uri = audioSelectResult[0]; + // 获取到到音频文件的URI后进行文件读取等操作 + }) + .catch((err) => { + console.error(`Invoke audioPicker.select failed, code is ${err.code}, message is ${err.message}`); + }) + ``` diff --git a/zh-cn/application-dev/file-management/select-user-file.md b/zh-cn/application-dev/file-management/select-user-file.md new file mode 100644 index 0000000000000000000000000000000000000000..c1a9983bd0619492545269be343dd24ff7b6bb91 --- /dev/null +++ b/zh-cn/application-dev/file-management/select-user-file.md @@ -0,0 +1,117 @@ +# 选择用户文件 + +终端用户有时需要分享、保存一些图片、视频等用户文件,开发者需要在应用中支持此类使用场景。此时,开发者可以使用OpenHarmony系统预置的[文件选择器(FilePicker)](../reference/apis/js-apis-file-picker.md),实现用户文件选择及保存能力。 + +根据用户文件的常见类型,文件选择器(FilePicker)分别提供以下接口: + +- [PhotoViewPicker](../reference/apis/js-apis-file-picker.md#photoviewpicker):适用于图片或视频类文件的选择与保存。 + +- [DocumentViewPicker](../reference/apis/js-apis-file-picker.md#documentviewpicker):适用于文档类文件的选择与保存。 + +- [AudioViewPicker](../reference/apis/js-apis-file-picker.md#audioviewpicker):适用于音频类文件的选择与保存。 + +## 选择图片或视频类文件 + +1. 导入选择器模块。 + + ```ts + import picker from '@ohos.file.picker'; + ``` + +2. 创建图库选择选项实例。 + + ```ts + const photoSelectOptions = new picker.PhotoSelectOptions(); + ``` + +3. 选择媒体文件类型和选择媒体文件的最大数目。 + 以下示例以图片选择为例,媒体文件类型请参见[PhotoViewMIMETypes](../reference/apis/js-apis-file-picker.md#photoviewmimetypes)。 + + ```ts + photoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE; // 过滤选择媒体文件类型为IMAGE + photoSelectOptions.maxSelectNumber = 5; // 选择媒体文件的最大数目 + ``` + +4. 创建图库选择器实例,调用[select()](../reference/apis/js-apis-file-picker.md#select)接口拉起FilePicker界面进行文件选择。 + + 文件选择成功后,返回[PhotoSelectResult](../reference/apis/js-apis-file-picker.md#photoselectresult)结果集,可以根据结果集中URI进行文件读取等操作。 + + ```ts + const photoPicker = new picker.PhotoViewPicker(); + photoPicker.select(photoSelectOptions) + .then(async (photoSelectResult) => { + let uri = photoSelectResult.photoUris[0]; + // 获取到到图片或者视频文件的URI后进行文件读取等操作 + }) + .catch((err) => { + console.error(`Invoke documentPicker.select failed, code is ${err.code}, message is ${err.message}`); + }) + ``` + +## 选择文档类文件 + +1. 导入选择器模块。 + + ```ts + import picker from '@ohos.file.picker'; + ``` + +2. 创建文档选择选项实例。 + + ```ts + const documentSelectOptions = new picker.DocumentSelectOptions(); + ``` + +3. 创建文档选择器实例。调用[select()](../reference/apis/js-apis-file-picker.md#select-3)接口拉起FilePicker界面进行文件选择。 + 文件选择成功后,返回被选中文档的URI结果集。开发者可以根据结果集中URI做进一步的处理。 + > **说明:** + > + > 目前DocumentSelectOptions不支持参数配置,默认可以选择所有类型的用户文件。 + + ```ts + const documentViewPicker = new picker.DocumentViewPicker(); // 创建文件选择器实例 + documentViewPicker.select(documentSelectOptions) + .then((documentSelectResult) => { + let uri = documentSelectResult[0]; + // 获取到到文档文件的URI后进行文件读取等操作 + }) + .catch((err) => { + console.error(`Invoke documentPicker.select failed, code is ${err.code}, message is ${err.message}`); + }) + ``` + +## 选择音频类文件 + +1. 导入选择器模块。 + + ```ts + import picker from '@ohos.file.picker'; + ``` + +2. 创建音频选择选项实例。 + + ```ts + const audioSelectOptions = new picker.AudioSelectOptions(); + ``` + +3. 创建音频选择器实例。调用[select()](../reference/apis/js-apis-file-picker.md#select-6)接口拉起FilePicker界面进行文件选择。 + + 文件选择成功后,返回被选中音频的URI结果集。开发者可以根据结果集中URI做进一步的处理。 + + 例如通过[文件管理接口](../reference/apis/js-apis-file-fs.md)根据URI拿到音频资源的文件句柄(FD),再配合媒体服务实现音频播放的开发,具体请参考[音频播放开发指导](../media/audio-playback-overview.md)。 + + > **说明:** + > + > 目前AudioSelectOptions不支持参数配置,默认可以选择所有类型的用户文件。 + + ```ts + const audioViewPicker = new picker.AudioViewPicker(); + audioViewPicker.select(audioSelectOptions) + .then(audioSelectResult => { + let uri = audioSelectOptions[0]; + // 获取到到音频文件的URI后进行文件读取等操作 + }) + .catch((err) => { + console.error(`Invoke audioPicker.select failed, code is ${err.code}, message is ${err.message}`); + }) + ``` diff --git a/zh-cn/application-dev/file-management/send-file-to-app-sandbox.md b/zh-cn/application-dev/file-management/send-file-to-app-sandbox.md new file mode 100644 index 0000000000000000000000000000000000000000..d92a47c0afcd3763144debf385a318d998f5d09c --- /dev/null +++ b/zh-cn/application-dev/file-management/send-file-to-app-sandbox.md @@ -0,0 +1,46 @@ +# 向应用沙箱推送文件 + +开发者在应用开发调试时,可能需要向应用沙箱下推送一些文件以期望在应用内访问或测试,此时有两种方式: + +1. 可以通过DevEco Studio向应用安装路径中放入目标文件,详见[应用安装资源访问](../quick-start/resource-categories-and-access.md#资源访问)。 + +2. 在具备设备环境时,可以使用另一种更为灵活的方式,通过hdc工具来向设备中应用沙箱路径推送文件。即本文介绍的内容。 + +但是hdc shell看到的调试进程下的文件路径与应用视角的应用沙箱路径不同,开发者需要先了解如下路径映射关系。 + +## 应用沙箱路径和调试进程视角下的真实物理路径 + +在应用沙箱路径下读写文件,经过映射转换,实际读写的是在hdc进程视角下看到真实物理路径中的应用文件,其对应关系如下表所示。 + +**表1** 应用沙箱路径与真实物理路径对应关系 + +| 应用沙箱路径 | 调试进程(hdc)视角下的实际路径 | 说明 | +| -------- | -------- | -------- | +| /data/storage/el1/bundle | /data/app/el1/bundle/public/<PACKAGENAME> | 应用安装包目录 | +| /data/storage/el1/base | /data/app/el1/<USERID>/base/<PACKAGENAME> | 应用el1级别加密数据目录 | +| /data/storage/el2/base | /data/app/el2/<USERID>/base/<PACKAGENAME> | 应用el2级别加密数据目录 | +| /data/storage/el1/database | /data/app/el1/<USERID>/database/<PACKAGENAME> | 应用el1级别加密数据库目录 | +| /data/storage/el2/database | /data/app/el2/<USERID>/database/<PACKAGENAME> | 应用el2级别加密数据库目录 | +| /data/storage/el2/distributedfiles | /mnt/hmdfs/<USERID>/account/merge_view/data/<PACKAGENAME> | 应用el2加密级别有帐号分布式数据融合目录 | + +## 开发示例 + +以应用包com.ohos.example为例,如果是在example的应用沙箱路径“/data/storage/el1/bundle”下读写文件,从上表可知,对应的真实物理路径为“/data/app/el1/bundle/public/<PACKAGENAME>”,即“/data/app/el1/bundle/public/com.ohos.example”。 + +推送命令示例如下: + +``` +hdc file send ${待推送文件的本地路径} /data/app/el1/bundle/public/com.ohos.example/ +``` + +## 切换应用沙箱视角 + +在调试过程中,如果权限不对或文件不存在,开发者需要从调试进程视角切换为应用视角,以便直观分析权限及文件目录问题。视角切换命令如下: + +``` +hdc shell // 进入shell +ps -ef|grep [hapName] // 通过ps命令找到对应应用的pid +nsenter -t [hapPid] -m /bin/sh // 通过上一步找到的应用pid进入对应应用的沙箱环境中 +``` + +执行完成后,即切换到了应用视角,该视角下的目录路径为应用沙箱路径,可以去排查沙箱路径相关问题。 diff --git a/zh-cn/application-dev/file-management/set-security-label.md b/zh-cn/application-dev/file-management/set-security-label.md new file mode 100644 index 0000000000000000000000000000000000000000..a936e10442733389fc2c764b0a947aea57b496c7 --- /dev/null +++ b/zh-cn/application-dev/file-management/set-security-label.md @@ -0,0 +1,41 @@ +# 设置分布式文件数据等级 + +不同设备本身的安全能力差异较大,一些小的嵌入式设备安全能力远弱于平板等设备类型。用户或者应用不同的文件数据有不同安全诉求,例如个人的健康信息和银行卡信息等不期望被弱设备读取。因此,OpenHarmony提供一套完整的数据分级、设备分级标准,并针对不同设备制定不同的数据流转策略,具体规则请参见[数据、设备安全分级](../database/access-control-by-device-and-data-level.md)。 + +## 接口说明 + +API详细介绍请参见[ohos.file.securityLabel](../reference/apis/js-apis-file-securityLabel.md)。 + +**表1** 设置文件数据等级 + +| 接口名 | 功能 | 接口类型 | 支持同步 | 支持异步 | +| -------- | -------- | -------- | -------- | -------- | +| setSecurityLabel | 设置文件安全标签 | 方法 | √ | √ | +| getSecurityLabel | 获取文件安全标签 | 方法 | √ | √ | + +> **须知:** +> +> 1. 对于不满足安全等级的文件,跨设备仍然可以看到该文件,但是无权限打开访问该文件。 +> +> 2. 分布式文件系统的数据等级默认为S3,应用可以主动设置文件的安全等级。 + +## 开发示例 + +获取通用文件沙箱路径,并设置数据等级标签。示例中的context的获取方式请参见[获取UIAbility的上下文信息](../application-models/uiability-usage.md#获取uiability的上下文信息)。 + + +```ts +import securityLabel from '@ohos.file.securityLabel'; + +// 获取需要设备数据等级的文件沙箱路径 +let context = ...; // 获取UIAbilityContext信息 +let pathDir = context.filesDir; +let filePath = pathDir + '/test.txt'; + +// 设置文件的数据等级为s0 +securityLabel.setSecurityLabel(filePath, 's0').then(() => { + console.info('Succeeded in setSecurityLabeling.'); +}).catch((err) => { + console.error(`Failed to setSecurityLabel. Code: ${err.code}, message: ${err.message}`); +}); +``` diff --git a/zh-cn/application-dev/file-management/share-app-file.md b/zh-cn/application-dev/file-management/share-app-file.md new file mode 100644 index 0000000000000000000000000000000000000000..49da5bd432da6afde84972a0f4679bffe981dcba --- /dev/null +++ b/zh-cn/application-dev/file-management/share-app-file.md @@ -0,0 +1,147 @@ +# 应用文件分享 + +应用文件分享是应用之间通过分享URI(Uniform Resource Identifier)或文件描述符FD(File Descriptor)的方式,进行文件共享的过程。由于FD分享的文件关闭FD后,无法再打开分享文件,因此不推荐使用,本文重点介绍URI分享方式。 + +- 基于URI分享方式,应用可分享单个文件,通过[ohos.app.ability.wantConstant](../reference/apis/js-apis-app-ability-wantConstant.md#wantconstantflags)的wantConstant.Flags接口以只读或读写权限授权给其他应用。应用可通过[ohos.file.fs](../reference/apis/js-apis-file-fs.md#fsopen)的open()接口打开URI,并进行读写操作。当前OpenHarmony API 9仅支持临时授权,分享给其他应用的文件在被分享应用退出时权限被收回。 + +- 基于FD分享方式,应用可分享单个文件,通过ohos.file.fs的open接口以指定权限授权给其他应用。应用从Want中解析拿到FD后可通过ohos.file.fs的读写接口对文件进行读写。 + +开发者可以使用相关接口,[分享文件给其他应用](#分享文件给其他应用)或[使用其他应用分享的文件](#使用其他应用分享的文件)。 + +## 文件URI规范 + +文件URI的格式为: + + 格式为file://<bundleName>/<path>/\#networkid=<networkid> + +- file:文件URI的标志。 + +- bundleName:该文件资源的属主。 + +- path:文件资源在应用沙箱中的路径。 + +- networkid:为可选项,用于分布式文件系统标志该文件资源所归属的设备;当不需要区分文件位置时,该选项可不填写。 + +## 分享文件给其他应用 + +在分享文件给其他应用前,开发者需要先[获取应用文件路径](../application-models/application-context-stage.md#获取应用开发路径)。 + +1. 获取文件在应用沙箱中的路径,并转换为文件URI。 + + ```ts + import UIAbility from '@ohos.app.ability.UIAbility'; + import fileuri from '@ohos.file.fileuri'; + import window from '@ohos.window'; + + export default class EntryAbility extends UIAbility { + onWindowStageCreate(windowStage: window.WindowStage) { + // 获取文件的沙箱路径 + let pathInSandbox = this.context.filesDir + "/test.txt"; + // 将沙箱路径转换为uri + let uri = fileuri.getUriFromPath(pathInSandbox); + // 获取的uri为"file://com.example.demo/data/storage/el2/base/files/test.txt" + } + } + ``` + +2. 设置获取文件的权限以及选择要分享的应用。 + 分享文件给其他应用需要使用[startAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability)接口,将获取到的URI填充在want的参数uri中,标注URI的文件类型,type字段可参考[Want属性](../reference/apis/js-apis-app-ability-want.md#属性),并通过设置want的flag来设置对应的读写权限,action字段配置为"ohos.want.action.sendData"表示进行应用文件分享,开发示例如下。 + + > **说明:** + > + > 写权限分享时,同时授予读权限。 + + ```ts + import fileuri from '@ohos.file.fileuri'; + import window from '@ohos.window'; + import wantConstant from '@ohos.app.ability.wantConstant'; + import UIAbility from '@ohos.app.ability.UIAbility'; + + export default class EntryAbility extends UIAbility { + onWindowStageCreate(windowStage: window.WindowStage) { + // 获取文件沙箱路径 + let filePath = this.context.filesDir + '/test.txt'; + // 将沙箱路径转换为uri + let uri = fileuri.getUriFromPath(filePath); + let want = { + // 配置被分享文件的读写权限,例如对被分享应用进行读写授权 + flags: wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION | wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, + // 配置分享应用的隐式拉起规则 + action: 'ohos.want.action.sendData', + uri: uri, + type: 'text/plain' + } + this.context.startAbility(want) + .then(() => { + console.info('Invoke getCurrentBundleStats succeeded.'); + }) + .catch((err) => { + console.error(`Invoke startAbility failed, code is ${err.code}, message is ${err.message}`); + }); + } + + ... + } + ``` + +## 使用其他应用分享的文件 + +被分享应用需要在[module.json5配置文件](../quick-start/module-configuration-file.md)的actions标签的值配置为"ohos.want.action.sendData",表示接收应用分享文件,配置uris字段,表示接收URI的类型,即只接收其他应用分享该类型的URI,如下表示本应用只接收scheme为file,类型为txt的文件,示例如下。 + +```json +{ + "module": { + ... + "abilities": [ + { + ... + "skills": [ + { + ... + "actions": [ + "ohos.want.action.sendData" + ], + "uris": [ + { + "scheme": "file", + "type": "text/plain" + } + ] + } + ] + } + ] + } +} +``` + +被分享方的UIAbility被启动后,可以在其[onCreate()](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityoncreate)或者[onNewWant()](../reference/apis/js-apis-app-ability-uiAbility.md#uiabilityonnewwant)回调中获取传入的Want参数信息。 + +通过接口want的参数获取分享文件的URI,获取文件URI后通过fs.open()接口打开文件,获取对应的file对象后,可对文件进行读写操作。 + +```ts +// xxx.ets +import fs from '@ohos.file.fs'; + +function getShareFile() { + try { + let want = ...; // 获取分享方传递过来的want信息 + + // 从want信息中获取uri字段 + let uri = want.uri; + if (uri == null || uri == undefined) { + console.info('uri is invalid'); + return; + } + try { + // 根据需要对被分享文件的URI进行相应操作。例如读写的方式打开URI获取file对象 + let file = fs.openSync(uri, fs.OpenMode.READ_WRITE); + console.info('open file successfully!'); + } catch (error) { + console.error(`Invoke openSync failed, code is ${error.code}, message is ${error.message}`); + } + } catch (error) { + console.error(`Invoke openSync failed, code is ${error.code}, message is ${error.message}`); + } +} +``` diff --git a/zh-cn/application-dev/file-management/user-file-overview.md b/zh-cn/application-dev/file-management/user-file-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..080a266fa346a0066605d470d50c1286cfcd7ae0 --- /dev/null +++ b/zh-cn/application-dev/file-management/user-file-overview.md @@ -0,0 +1,60 @@ +# 用户文件概述 + +用户文件:文件所有者为登录到该终端设备的用户,包括用户私有的图片、视频、音频、文档等。 + +1. 用户文件存放在用户目录下,归属于该设备上登录的用户。 + +2. 用户文件存储位置主要分为[内置存储](#内置存储)、[外置存储](#外置存储)。 + +3. 应用对用户文件的创建、访问、删除等行为,需要提前获取用户授权,或由用户操作完成。 + +OpenHarmony提供[用户文件访问框架](#用户文件访问框架),用于开发者访问和管理用户文件,将在下文详细介绍。 + +## 用户文件存储位置 + +### 内置存储 + +内置存储,是指用户文件存储在终端设备的内部存储设备(空间)上。内置存储设备无法被移除。内置存储的用户文件主要有: + +- 用户特有的文件:这部分文件归属于登录该设备的用户,不同用户登录后,仅可看到该用户自己的文件。 + 按照这些文件的特征/属性,以及用户/应用的使用习惯,可分为: + - 图片/视频类媒体文件 + 所具有的特征包括拍摄时间、地点、旋转角度、文件宽高等信息,以媒体文件的形式存储在系统中,通常是以所有文件、相册的形式对外呈现,不会展示其在系统中存储的具体位置。 + + - 音频类媒体文件 + 所具有的特征包括所属专辑、音频创作者、持续时间等信息,以媒体文件的形式存储在系统中,通常会以所有文件、专辑、作家等形式对外部呈现,不会展示其在系统中存储的具体位置。 + + - 其他文件(统称为文档类文件) + 以普通文件的形式存储在系统中,该类文件既包括普通的文本文件、压缩文件等,又包括以普通文件形式存储的图片/视频、音频文件,该类文件通常是以目录树的形式对外展示。 + +- 多用户共享的文件:用户可以通过将文件放在共享文件区,实现多个用户之间文件的共享访问。 + 共享文件区的文件,也是以普通文件的形式存储在系统中,以目录树的形式对外展示。 + +### 外置存储 + +外置存储,是指用户文件存储在外置可插拔设备上(如SD卡、U盘等)。外置存储设备上的文件,和内置存储设备共享区文件一样,可以被所有登录到系统中的用户看到。 + +外置存储设备具备可插拔属性,因此系统提供了设备插拔事件的监听及挂载功能,用于管理外置存储设备,具体可参考[管理外置存储设备(仅对系统应用开放)](manage-external-storage.md)。 + +外置存储设备上的文件,全部以普通文件的形式呈现,和内置存储设备上的文档类文件一样,采用目录树的形式对外展示。 + +## 用户文件访问框架 + +用户文件访问框架(File Access Framework)是一套提供给开发者访问和管理用户文件的基础框架。该框架依托于OpenHarmony的ExtensionAbility组件机制,提供了一套统一访问用户文件的方法和接口。 + +**图1** 用户文件访问框架示意图   +![User file access framework](figures/user-file-access-framework.png) + +- 各类系统应用或三方应用(即图中的文件访问客户端)若需访问用户文件,如选择一张照片或保存多个文档等,可以通过拉起“文件选择器应用”来实现。 + +- OpenHarmony系统预置了文件选择器应用FilePicker和文件管理器应用FileManager。 + - FilePicker:系统预置应用,提供文件访问客户端选择和保存文件的能力,且不需要配置任何权限。FilePicker的使用指导请参见[选择用户文件](select-user-file.md)。 + - FileManager:系统预置应用,终端用户可通过系统文件管理器实现查看文件、修改文件、删除文件(目录)、重命名文件(目录)、移动文件(目录)、创建文件(目录)等操作。 + + 对于系统应用开发者,还可以按需开发自己的文件选择器或文件管理器应用。其中,选择器功能是管理器的子集,本文目前提供了管理器的开发指导,请参见[开发用户文件管理器(仅对系统应用开放)](dev-user-file-manager.md)。 + +- File Access Framework(用户文件访问框架)的主要功能模块如下: + - File Access Helper:提供给文件管理器和文件选择器访问用户文件的API接口。 + - File Access ExtensionAbility:提供文件访问框架能力,由内卡文件管理服务UserFileManager和外卡文件管理服务ExternalFileManager组成,实现对应的文件访问功能。 + - UserFileManager:内卡文件管理服务,基于File Access ExtensionAbility框架实现,用于管理内置存储设备上的文件。 + - ExternalFileManager:外卡文件管理服务,基于File Access ExtensionAbility框架实现,用于管理外置存储设备上的文件。 diff --git a/zh-cn/application-dev/internationalization/intl-guidelines.md b/zh-cn/application-dev/internationalization/intl-guidelines.md index 8c4b8408bd12d3aa2b8a70309081ae8997d2e7b1..54440aa1a4acdf938b360fc0729a3c46de11019e 100644 --- a/zh-cn/application-dev/internationalization/intl-guidelines.md +++ b/zh-cn/application-dev/internationalization/intl-guidelines.md @@ -111,7 +111,7 @@ let dateTimeFormat = new Intl.DateTimeFormat(); ``` - 另一种方法是使用开发者提供的Locale和格式化参数来创建日期时间格式化对象。其中,格式化参数是可选的,完整的格式化参数列表见[DateTimeOptions](../reference/apis/js-apis-intl.md#datetimeoptions)。 + 另一种方法是使用开发者提供的Locale和格式化参数来创建日期时间格式化对象。其中,格式化参数是可选的,完整的格式化参数列表见[DateTimeOptions](../reference/apis/js-apis-intl.md#datetimeoptions9)。 ```js let options = {dateStyle: "full", timeStyle: "full"}; @@ -181,7 +181,7 @@ let numberFormat = new Intl.NumberFormat(); ``` - 另一种方法是使用开发者提供的Locale和格式化参数来创建数字格式化对象。其中,格式化参数是可选的,完整的格式化参数列表参见[NumberOptions](../reference/apis/js-apis-intl.md#numberoptions)。 + 另一种方法是使用开发者提供的Locale和格式化参数来创建数字格式化对象。其中,格式化参数是可选的,完整的格式化参数列表参见[NumberOptions](../reference/apis/js-apis-intl.md#numberoptions9)。 ```js let options = {compactDisplay: "short", notation: "compact"}; @@ -240,7 +240,7 @@ let collator = new Intl.Collator(); ``` - 另一种方法是使用开发者提供的Locale和其他相关参数来创建Collator对象,完整的参数列表参见[CollatorOptions](../reference/apis/js-apis-intl.md#collatoroptions8)。 + 另一种方法是使用开发者提供的Locale和其他相关参数来创建Collator对象,完整的参数列表参见[CollatorOptions](../reference/apis/js-apis-intl.md#collatoroptions9)。 其中,sensitivity参数用于控制哪些级别的差异会被用于比较两个字符串。取值"base"表示,仅比较字符本身,不考虑重音符号、大小写差异。例如,'a' != 'b','a' == 'á','a' == 'A'。取值"accent"表示考虑重音符号,不考虑大小写的差异。例如,'a' != 'b','a' != 'á','a' == 'A'。取值"case"表示考虑大小写的差异,不考虑重音符号的差异。例如,'a' != 'b','a' == 'á','a' != 'A'。取值"variant"表示考虑重音符号、大小写等方面差异。例如'a' != 'b','a' != 'á','a' != 'A'。 ```js @@ -301,7 +301,7 @@ let pluralRules = new Intl.PluralRules(); ``` - 另一种方法是使用开发者提供的Locale和其他相关参数来创建单复数对象。完整的参数列表参见[PluralRulesOptions](../reference/apis/js-apis-intl.md#pluralrulesoptions8)。 + 另一种方法是使用开发者提供的Locale和其他相关参数来创建单复数对象。完整的参数列表参见[PluralRulesOptions](../reference/apis/js-apis-intl.md#pluralrulesoptions9)。 ```js let pluralRules = new Intl.PluralRules("zh-CN", {localeMatcher: "best fit", type: "cardinal"}); @@ -349,7 +349,7 @@ let relativeTimeFormat = new Intl.RelativeTimeFormat(); ``` - 另一种方法是使用开发者提供的Locale和格式化参数来创建相对时间格式化对象。其中,格式化参数是可选的,完整的参数列表参见[ RelativeTimeFormatInputOptions](../reference/apis/js-apis-intl.md#relativetimeformatinputoptions8)。 + 另一种方法是使用开发者提供的Locale和格式化参数来创建相对时间格式化对象。其中,格式化参数是可选的,完整的参数列表参见[RelativeTimeFormatInputOptions](../reference/apis/js-apis-intl.md#relativetimeformatinputoptions9)。 ```js let relativeTimeFormat = new Intl.RelativeTimeFormat("zh-CN", {numeric: "always", style: "long"}); diff --git a/zh-cn/application-dev/key-features/multi-device-app-dev/case.md b/zh-cn/application-dev/key-features/multi-device-app-dev/case.md index f1dc34b9e0514708dca74b4e1f67889d730d57f7..25fd477a9a8c76d09163d3de8d45d7026f33074e 100644 --- a/zh-cn/application-dev/key-features/multi-device-app-dev/case.md +++ b/zh-cn/application-dev/key-features/multi-device-app-dev/case.md @@ -467,8 +467,8 @@ const globalMessageList:any[] = [ | 断点 | 窗口宽度(vp) | 栅格总列数 | 消息气泡占用的列数 | 接收场景偏移的列数 | 发送场景偏移的列数 | | -------- | -------- | -------- | -------- | -------- | -------- | -| sm | [320, 520) | 12 | 12 | 0 | 0 | -| md | [520, 840) | 12 | 8 | 0 | 4 | +| sm | [320, 600) | 12 | 12 | 0 | 0 | +| md | [600, 840) | 12 | 8 | 0 | 4 | | lg | [840, +∞) | 12 | 8 | 0 | 4 | | 默认设备 | 平板 | @@ -526,7 +526,7 @@ struct Conversation { - 通过[Flex组件](../../reference/arkui-ts/ts-container-flex.md)将三个部分组合起来,注意justifyContent: FlexAlign.SpaceBetween配置项是将Flex组件中的元素按照主轴方向均匀分配,其中第一个元素与顶部对齐,最后一个元素与底部对齐。 -- 通过[List组件](../../reference/arkui-ts/ts-container-list.md)和[ForEach语法](../../quick-start/arkts-rendering-control.md#循环渲染),显示整个消息列表。 +- 通过[List组件](../../reference/arkui-ts/ts-container-list.md)和[ForEach语法](../../quick-start/arkts-rendering-control-foreach.md),显示整个消息列表。 | 默认设备 | 平板 | | -------- | -------- | diff --git a/zh-cn/application-dev/key-features/multi-device-app-dev/design-delivery.md b/zh-cn/application-dev/key-features/multi-device-app-dev/design-delivery.md index 658db5e5e1a18a8a49be9f990a4badbddeb6f6d2..49f29e94a09f65410f508301464bebca900c51dc 100644 --- a/zh-cn/application-dev/key-features/multi-device-app-dev/design-delivery.md +++ b/zh-cn/application-dev/key-features/multi-device-app-dev/design-delivery.md @@ -35,8 +35,8 @@ | 设备类型 | 屏幕宽度 | 画板尺寸(vp) | | -------- | -------- | -------- | | 超小设备 | [0, 320) | 240\*320 | -| 小设备 | [320, 520) | 360\*780 | -| 中设备 | [520, 840) | 677\*763 | +| 小设备 | [320, 600) | 360\*780 | +| 中设备 | [600, 840) | 677\*763 | | 大设备 | [840, +) | 1280\*800 | 多设备效果示意图 diff --git a/zh-cn/application-dev/key-features/multi-device-app-dev/design-interaction-event-normalization.md b/zh-cn/application-dev/key-features/multi-device-app-dev/design-interaction-event-normalization.md index 9bef5805ea054e71175ce023aba4247472f22c49..21d43d67cacb5fbaf07ea6c6f645dd416b65844f 100644 --- a/zh-cn/application-dev/key-features/multi-device-app-dev/design-interaction-event-normalization.md +++ b/zh-cn/application-dev/key-features/multi-device-app-dev/design-interaction-event-normalization.md @@ -11,12 +11,12 @@ 用户通过点击某个元素触发功能、访问新页面、或改变自身状态。 - | **输入方式** | **交互行为** | **示意** | +| **输入方式** | **交互行为** | **示意** | | -------- | -------- | -------- | -| 触屏 | 单指单击 | ![zh-cn_image_0000001280472681](figures/zh-cn_image_0000001280472681.png) | -| 鼠标 | 左键单击 / 左键双击 | ![zh-cn_image_0000001236472600](figures/zh-cn_image_0000001236472600.png) | -| 触摸板 | 单指单击 / 单指双击 | ![zh-cn_image_0000001280232265](figures/zh-cn_image_0000001280232265.png) | -| 键盘 | 移动焦点到对象上后按下Enter键 | ![zh-cn_image_0000001280472701](figures/zh-cn_image_0000001280472701.png) | +| 触屏 | 单指单击 | ![zh-cn_image_0000001280472681](figures/zh-cn_image_0000001280472681.png) | +| 鼠标 | 左键单击 / 左键双击 | ![zh-cn_image_0000001236472600](figures/zh-cn_image_0000001236472600.png) | +| 触摸板 | 单指单击 / 单指双击 | ![zh-cn_image_0000001280232265](figures/zh-cn_image_0000001280232265.png) | +| 键盘 | 移动焦点到对象上后按下Space键 | ![zh-cn_image_0000001280472701](figures/zh-cn_image_0000001280472701.png) | 一般地,触屏手指的按下/抬起行为对应于光标的按下/抬起行为。 diff --git a/zh-cn/application-dev/key-features/multi-device-app-dev/faq.md b/zh-cn/application-dev/key-features/multi-device-app-dev/faq.md index 0ec02b55b7ab8c41e20374626b2c6360b1d263fb..8823fbbb79e5a8bb54d2fb072be38f9e14f376a7 100644 --- a/zh-cn/application-dev/key-features/multi-device-app-dev/faq.md +++ b/zh-cn/application-dev/key-features/multi-device-app-dev/faq.md @@ -73,13 +73,13 @@ 应用由一个或多个Ability组成,Ability支持单实例、多实例和指定实例3种[启动模式](../../application-models/uiability-launch-type.md),启动模式可以在[配置文件(module.json5)](../../quick-start/module-configuration-file.md)中通过launchType字段配置。启动模式对应Ability被启动时的行为,对启动模式的详细说明如下: - | 启动模式 | 描述 | 说明 | - | -------- | -------- | -------- | - | standard | 多实例 | 每次startAbility都会启动一个新的实例。 | - | singleton | 单实例 | 系统中最多只可以存在一个实例,startAbility时,如果系统中已存在相应的Ability实例,则复用该实例。 | - | specified | 指定实例 | 运行时由Ability内部业务决定是否创建多实例。 | +| 启动模式 | 描述 | 说明 | +| -------- | -------- | -------- | +| multiton | 多实例 | 每次startAbility都会启动一个新的实例。 | +| singleton | 单实例 | 系统中最多只可以存在一个实例,startAbility时,如果系统中已存在相应的Ability实例,则复用该实例。 | +| specified | 指定实例 | 运行时由Ability内部业务决定是否创建多实例。 | -默认设备屏幕尺寸较小,采用standard启动模式不仅无法给用户提供便利,反而可能消耗更多系统资源,故通常采用singleton启动模式。平板屏幕尺寸较大且可能支持自由窗口,对于文档编辑、网页浏览等场景,使用standard启动模式可以提升用户体验。 +默认设备屏幕尺寸较小,采用multiton启动模式不仅无法给用户提供便利,反而可能消耗更多系统资源,故通常采用singleton启动模式。平板屏幕尺寸较大且可能支持自由窗口,对于文档编辑、网页浏览等场景,使用multiton启动模式可以提升用户体验。 本文中将默认设备和平板等归为同一泛类,推荐同一泛类的设备共用HAP,同时本文也介绍了如何通过自适应布局能力和响应式布局能力开发出适配不同设备的页面。这里将补充介绍,如何实现Ability在不同设备上以不同的模式启动。 diff --git a/zh-cn/application-dev/key-features/multi-device-app-dev/figures/zh-cn_image_0000001280472701.png b/zh-cn/application-dev/key-features/multi-device-app-dev/figures/zh-cn_image_0000001280472701.png index cabcaf5667a4093f188b59b9ce092abd975ab5d8..a27b306ab5457819b1a57599e2a7a95d81faf5c3 100644 Binary files a/zh-cn/application-dev/key-features/multi-device-app-dev/figures/zh-cn_image_0000001280472701.png and b/zh-cn/application-dev/key-features/multi-device-app-dev/figures/zh-cn_image_0000001280472701.png differ diff --git a/zh-cn/application-dev/key-features/multi-device-app-dev/responsive-layout.md b/zh-cn/application-dev/key-features/multi-device-app-dev/responsive-layout.md index cc900b99e416aec4dd418adb6f9385e6dcd35e44..bcf284e7a455cb1ab3cfbcdc33b9db4b862bc94f 100644 --- a/zh-cn/application-dev/key-features/multi-device-app-dev/responsive-layout.md +++ b/zh-cn/application-dev/key-features/multi-device-app-dev/responsive-layout.md @@ -24,8 +24,8 @@ | 断点名称 | 取值范围(vp) | | -------- | -------- | | xs | [0, 320) | -| sm | [320, 520) | -| md | [520, 840) | +| sm | [320, 600) | +| md | [600, 840) | | lg | [840, +∞) | > **说明:** @@ -48,7 +48,7 @@ OpenHarmony提供了多种方法,判断应用当前处于何种断点,进而 通过窗口对象监听断点变化的核心是获取窗口对象及注册窗口尺寸变化的回调函数。 -1. 在Ability的[onWindowStageCreate](../../application-models/uiability-lifecycle.md)生命周期回调中,通过[窗口](../../reference/apis/js-apis-window.md)对象获取启动时的应用窗口宽度并注册回调函数监听窗口尺寸变化。将窗口尺寸的长度单位[由px换算为vp](../../key-features/multi-device-app-dev/visual-basics.md#视觉基础)后,即可基于前文中介绍的规则得到当前断点值,此时可以使用[状态变量](../../quick-start/arkts-state-mgmt-application-level.md)记录当前的断点值方便后续使用。 +1. 在Ability的[onWindowStageCreate](../../application-models/uiability-lifecycle.md)生命周期回调中,通过[窗口](../../reference/apis/js-apis-window.md)对象获取启动时的应用窗口宽度并注册回调函数监听窗口尺寸变化。将窗口尺寸的长度单位[由px换算为vp](../../key-features/multi-device-app-dev/visual-basics.md#视觉基础)后,即可基于前文中介绍的规则得到当前断点值,此时可以使用[状态变量](../../quick-start/arkts-state.md)记录当前的断点值方便后续使用。 ```ts // MainAbility.ts @@ -66,7 +66,7 @@ OpenHarmony提供了多种方法,判断应用当前处于何种断点,进而 let newBp: string = '' if (windowWidthVp < 320) { newBp = 'xs' - } else if (windowWidthVp < 520) { + } else if (windowWidthVp < 600) { newBp = 'sm' } else if (windowWidthVp < 840) { newBp = 'md' @@ -133,7 +133,7 @@ OpenHarmony提供了多种方法,判断应用当前处于何种断点,进而 在实际应用开发过程中,开发者常常需要针对不同类型设备或同一类型设备的不同状态来修改应用的样式。媒体查询提供了丰富的媒体特征监听能力,可以监听应用显示区域变化、横竖屏、深浅色、设备类型等等,因此在应用开发过程中使用的非常广泛。 -本小节仅介绍**媒体查询跟断点的结合**,即如何借助媒体查询能力,监听断点的变化,读者可以自行查阅官网中关于[媒体查询](../../ui/ui-ts-layout-mediaquery.md)的相关介绍了解更详细的用法。 +本小节仅介绍**媒体查询跟断点的结合**,即如何借助媒体查询能力,监听断点的变化,读者可以自行查阅官网中关于[媒体查询](../../ui/arkts-layout-development-media-query.md)的相关介绍了解更详细的用法。 > **说明:** @@ -209,9 +209,9 @@ export class BreakpointSystem { } public register() { - this.smListener = mediaquery.matchMediaSync("(320vp **说明:** @@ -78,13 +78,13 @@ ## 页面开发 -天气应用中涉及较多的页面和弹窗,本小节以天气主页为例,简单介绍不同设备下的页面实现思路。天气应用已经在[OpenHarmony应用示例](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/MultiDeviceAppDev/Weather中开源,感兴趣的读者可以自行下载及了解详细代码实现。 +天气应用中涉及较多的页面和弹窗,本小节以天气主页为例,简单介绍不同设备下的页面实现思路。天气应用已经在[OpenHarmony应用示例](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/MultiDeviceAppDev/Weather)中开源,感兴趣的读者可以自行下载及了解详细代码实现。 观察天气主页在不同设备上的UX设计图,可以进行如下设计: - 将天气主页划分为9个基础区域,如: ![home_full](figures/home_full.png) -- 基础区域9仅在大设备上显示,基础区域1-8虽然在各设备上始终展示但其尺寸及区域内的布局基本保持不变,可以结合[自适应布局](adaptive-layout.md)能力以[自定义组件](../../quick-start/arkts-basic-ui-description.md)的形式分别实现这9个基础区域。 +- 基础区域9仅在大设备上显示,基础区域1-8虽然在各设备上始终展示但其尺寸及区域内的布局基本保持不变,可以结合[自适应布局](adaptive-layout.md)能力以[自定义组件](../../quick-start/arkts-create-custom-components.md)的形式分别实现这9个基础区域。 | | 小设备 | 中设备 | 大设备 | | -------- | -------- | -------- | -------- | | 主页 | ![Home_sm](figures/Home_sm.png) | ![Home_md_mark](figures/Home_md_mark.png) | ![Home_lg_mark](figures/Home_lg_mark.png) | diff --git a/zh-cn/application-dev/key-features/multi-device-app-dev/typical-layout-scenario.md b/zh-cn/application-dev/key-features/multi-device-app-dev/typical-layout-scenario.md index 4bb565e096bb61022c3f76f9256e0ed31054ed74..b2135839a5223c43f1af530b9d371273d6d8cb31 100644 --- a/zh-cn/application-dev/key-features/multi-device-app-dev/typical-layout-scenario.md +++ b/zh-cn/application-dev/key-features/multi-device-app-dev/typical-layout-scenario.md @@ -371,7 +371,6 @@ struct SideBarSample { @Builder itemBuilder(index: number) { Text(images[index].label) - .width('100%') .fontSize(24) .fontWeight(FontWeight.Bold) .borderRadius(5) @@ -470,6 +469,7 @@ struct Item { NavDestination() { Details({imageSrc: this.imageSrc}) }.title(this.label) + .backgroundColor('#FFFFFF') } } } @@ -491,7 +491,7 @@ struct NavigationSample { .backgroundColor('#F1F3F5') .height('100%') .width('100%') - .navBarWidth('40%') + .navBarWidth(360) .hideToolBar(true) .title('Sample') } diff --git a/zh-cn/application-dev/media/Readme-CN.md b/zh-cn/application-dev/media/Readme-CN.md index 7829383ad0546b76ef570725e8a248b72d3afb57..1f2d6d43b8c3686432e4b428f11bc023092e8b62 100755 --- a/zh-cn/application-dev/media/Readme-CN.md +++ b/zh-cn/application-dev/media/Readme-CN.md @@ -1,29 +1,60 @@ # 媒体 +- [媒体应用开发概述](media-application-overview.md) - 音视频 - - [音频开发概述](audio-overview.md) - - [音频渲染开发指导](audio-renderer.md) - - [音频流管理开发指导](audio-stream-manager.md) - - [音频采集开发指导](audio-capturer.md) - - [OpenSL ES播放开发指导](opensles-playback.md) - - [OpenSL ES录音开发指导](opensles-capture.md) - - [音频焦点模式开发指导](audio-interruptmode.md) - - [音量管理开发指导](audio-volume-manager.md) - - [路由、设备管理开发指导](audio-routing-manager.md) - - [音视频播放器开发指导(推荐使用)](avplayer-playback.md) - - [音视频录制开发指导(推荐使用)](avrecorder.md) - - [音频播放开发指导(待停用)](audio-playback.md) - - [音频录制开发指导(待停用)](audio-recorder.md) - - [视频播放开发指导(待停用)](video-playback.md) - - [视频录制开发指导(待停用)](video-recorder.md) - -- 媒体会话 - - [AVSession开发概述](avsession-overview.md) - - [AVSession开发指导](avsession-guidelines.md) - + - [音视频概述](av-overview.md) + - [AVPlayer和AVRecorder](avplayer-avrecorder-overview.md) + - 音频播放 + - [音频播放开发概述](audio-playback-overview.md) + - [使用AVPlayer开发音频播放功能](using-avplayer-for-playback.md) + - [使用AudioRenderer开发音频播放功能](using-audiorenderer-for-playback.md) + - [使用OpenSL ES开发音频播放功能](using-opensl-es-for-playback.md) + - [使用TonePlayer开发音频播放功能(仅对系统应用开放)](using-toneplayer-for-playback.md) + - [多音频播放的并发策略](audio-playback-concurrency.md) + - [播放音量管理](volume-management.md) + - [音频播放流管理](audio-playback-stream-management.md) + - [音频输出设备管理](audio-output-device-management.md) + - [分布式音频播放(仅对系统应用开放)](distributed-audio-playback.md) + - 音频录制 + - [音频录制开发概述](audio-recording-overview.md) + - [使用AVRecorder开发音频录制功能](using-avrecorder-for-recording.md) + - [使用AudioCapturer开发音频录制功能](using-audiocapturer-for-recording.md) + - [使用OpenSLES开发音频录制功能](using-opensl-es-for-recording.md) + - [管理麦克风](mic-management.md) + - [音频录制流管理](audio-recording-stream-management.md) + - [音频输入设备管理](audio-input-device-management.md) + - 音频通话 + - [音频通话开发概述](audio-call-overview.md) + - [开发音频通话功能](audio-call-development.md) + - [视频播放](video-playback.md) + - [视频录制](video-recording.md) +- 媒体会话(仅对系统应用开放) + - [媒体会话概述](avsession-overview.md) + - 本地媒体会话 + - [本地媒体会话概述](local-avsession-overview.md) + - [媒体会话提供方](using-avsession-developer.md) + - [媒体会话控制方](using-avsession-controller.md) + - 分布式媒体会话 + - [分布式媒体会话概述](distributed-avsession-overview.md) + - [使用分布式媒体会话](using-distributed-avsession.md) +- 相机(仅对系统应用开放) + - [相机开发概述](camera-overview.md) + - 相机开发指导 + - [开发准备](camera-preparation.md) + - [设备输入](camera-device-input.md) + - [会话管理](camera-session-management.md) + - [预览](camera-preview.md) + - [拍照](camera-shooting.md) + - [录像](camera-recording.md) + - [元数据](camera-metadata.md) + - 相机最佳实践 + - [拍照实现方案](camera-shooting-case.md) + - [录像实现方案](camera-recording-case.md) - 图片 - - [图片开发指导](image.md) - -- 相机 - - [相机开发指导](camera.md) - - [分布式相机开发指导](remote-camera.md) \ No newline at end of file + - [图片开发概述](image-overview.md) + - [图片解码](image-decoding.md) + - 图片处理 + - [图像变换](image-transformation.md) + - [位图操作](image-pixelmap-operation.md) + - [图片编码](image-encoding.md) + - [图片工具](image-tool.md) diff --git a/zh-cn/application-dev/media/audio-call-development.md b/zh-cn/application-dev/media/audio-call-development.md new file mode 100644 index 0000000000000000000000000000000000000000..949707dc814c6c53673369bdc57e58460064eb06 --- /dev/null +++ b/zh-cn/application-dev/media/audio-call-development.md @@ -0,0 +1,259 @@ +# 开发音频通话功能 + +在音频通话场景下,音频输出(播放对端声音)和音频输入(录制本端声音)会同时进行,应用可以通过使用AudioRenderer来实现音频输出,通过使用AudioCapturer来实现音频输入,同时使用AudioRenderer和AudioCapturer即可实现音频通话功能。 + +在音频通话开始和结束时,应用可以自行检查当前的[音频场景模式](audio-call-overview.md#音频场景模式)和[铃声模式](audio-call-overview.md#铃声模式),以便采取合适的音频管理及提示策略。 + +以下代码示范了同时使用AudioRenderer和AudioCapturer实现音频通话功能的基本过程,其中未包含音频通话数据的传输过程,实际开发中,需要将网络传输来的对端通话数据解码播放,此处仅以读取音频文件的数据代替;同时需要将本端录制的通话数据编码打包,通过网络发送给对端,此处仅以将数据写入音频文件代替。 + +## 使用AudioRenderer播放对端的通话声音 + + 该过程与[使用AudioRenderer开发音频播放功能](using-audiorenderer-for-playback.md)过程相似,关键区别在于audioRendererInfo参数和音频数据来源。audioRendererInfo参数中,音频内容类型需设置为语音,CONTENT_TYPE_SPEECH,音频流使用类型需设置为语音通信,STREAM_USAGE_VOICE_COMMUNICATION。 + +```ts +import audio from '@ohos.multimedia.audio'; +import fs from '@ohos.file.fs'; +const TAG = 'VoiceCallDemoForAudioRenderer'; +// 与使用AudioRenderer开发音频播放功能过程相似,关键区别在于audioRendererInfo参数和音频数据来源 +export default class VoiceCallDemoForAudioRenderer { + private renderModel = undefined; + private audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, // 采样率 + channels: audio.AudioChannel.CHANNEL_2, // 通道 + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, // 采样格式 + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW // 编码格式 + } + private audioRendererInfo = { + // 需使用通话场景相应的参数 + content: audio.ContentType.CONTENT_TYPE_SPEECH, // 音频内容类型:语音 + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, // 音频流使用类型:语音通信 + rendererFlags: 0 // 音频渲染器标志:默认为0即可 + } + private audioRendererOptions = { + streamInfo: this.audioStreamInfo, + rendererInfo: this.audioRendererInfo + } + // 初始化,创建实例,设置监听事件 + init() { + audio.createAudioRenderer(this.audioRendererOptions, (err, renderer) => { // 创建AudioRenderer实例 + if (!err) { + console.info(`${TAG}: creating AudioRenderer success`); + this.renderModel = renderer; + this.renderModel.on('stateChange', (state) => { // 设置监听事件,当转换到指定的状态时触发回调 + if (state == 1) { + console.info('audio renderer state is: STATE_PREPARED'); + } + if (state == 2) { + console.info('audio renderer state is: STATE_RUNNING'); + } + }); + this.renderModel.on('markReach', 1000, (position) => { // 订阅markReach事件,当渲染的帧数达到1000帧时触发回调 + if (position == 1000) { + console.info('ON Triggered successfully'); + } + }); + } else { + console.info(`${TAG}: creating AudioRenderer failed, error: ${err.message}`); + } + }); + } + // 开始一次音频渲染 + async start() { + let stateGroup = [audio.AudioState.STATE_PREPARED, audio.AudioState.STATE_PAUSED, audio.AudioState.STATE_STOPPED]; + if (stateGroup.indexOf(this.renderModel.state) === -1) { // 当且仅当状态为STATE_PREPARED、STATE_PAUSED和STATE_STOPPED之一时才能启动渲染 + console.error(TAG + 'start failed'); + return; + } + await this.renderModel.start(); // 启动渲染 + const bufferSize = await this.renderModel.getBufferSize(); + // 此处仅以读取音频文件的数据举例,实际音频通话开发中,需要读取的是通话对端传输来的音频数据 + let context = getContext(this); + let path = context.filesDir; + + const filePath = path + '/voice_call_data.wav'; // 沙箱路径,实际路径为/data/storage/el2/base/haps/entry/files/voice_call_data.wav + let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); + let stat = await fs.stat(filePath); + let buf = new ArrayBuffer(bufferSize); + let len = stat.size % bufferSize === 0 ? Math.floor(stat.size / bufferSize) : Math.floor(stat.size / bufferSize + 1); + for (let i = 0; i < len; i++) { + let options = { + offset: i * bufferSize, + length: bufferSize + }; + let readsize = await fs.read(file.fd, buf, options); + // buf是要写入缓冲区的音频数据,在调用AudioRenderer.write()方法前可以进行音频数据的预处理,实现个性化的音频播放功能,AudioRenderer会读出写入缓冲区的音频数据进行渲染 + let writeSize = await new Promise((resolve, reject) => { + this.renderModel.write(buf, (err, writeSize) => { + if (err) { + reject(err); + } else { + resolve(writeSize); + } + }); + }); + if (this.renderModel.state === audio.AudioState.STATE_RELEASED) { // 如果渲染器状态为STATE_RELEASED,停止渲染 + fs.close(file); + await this.renderModel.stop(); + } + if (this.renderModel.state === audio.AudioState.STATE_RUNNING) { + if (i === len - 1) { // 如果音频文件已经被读取完,停止渲染 + fs.close(file); + await this.renderModel.stop(); + } + } + } + } + // 暂停渲染 + async pause() { + // 只有渲染器状态为STATE_RUNNING的时候才能暂停 + if (this.renderModel.state !== audio.AudioState.STATE_RUNNING) { + console.info('Renderer is not running'); + return; + } + await this.renderModel.pause(); // 暂停渲染 + if (this.renderModel.state === audio.AudioState.STATE_PAUSED) { + console.info('Renderer is paused.'); + } else { + console.error('Pausing renderer failed.'); + } + } + // 停止渲染 + async stop() { + // 只有渲染器状态为STATE_RUNNING或STATE_PAUSED的时候才可以停止 + if (this.renderModel.state !== audio.AudioState.STATE_RUNNING && this.renderModel.state !== audio.AudioState.STATE_PAUSED) { + console.info('Renderer is not running or paused.'); + return; + } + await this.renderModel.stop(); // 停止渲染 + if (this.renderModel.state === audio.AudioState.STATE_STOPPED) { + console.info('Renderer stopped.'); + } else { + console.error('Stopping renderer failed.'); + } + } + // 销毁实例,释放资源 + async release() { + // 渲染器状态不是STATE_RELEASED状态,才能release + if (this.renderModel.state === audio.AudioState.STATE_RELEASED) { + console.info('Renderer already released'); + return; + } + await this.renderModel.release(); // 释放资源 + if (this.renderModel.state === audio.AudioState.STATE_RELEASED) { + console.info('Renderer released'); + } else { + console.error('Renderer release failed.'); + } + } +} +``` + +## 使用AudioCapturer录制本端的通话声音 + + 该过程与[使用AudioCapturer开发音频录制功能](using-audiocapturer-for-recording.md)过程相似,关键区别在于audioCapturerInfo参数和音频数据流向。audioCapturerInfo参数中音源类型需设置为语音通话,SOURCE_TYPE_VOICE_COMMUNICATION。 + +```ts +import audio from '@ohos.multimedia.audio'; +import fs from '@ohos.file.fs'; +const TAG = 'VoiceCallDemoForAudioCapturer'; +// 与使用AudioCapturer开发音频录制功能过程相似,关键区别在于audioCapturerInfo参数和音频数据流向 +export default class VoiceCallDemoForAudioCapturer { + private audioCapturer = undefined; + private audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, // 采样率 + channels: audio.AudioChannel.CHANNEL_1, // 通道 + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, // 采样格式 + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW // 编码格式 + } + private audioCapturerInfo = { + // 需使用通话场景相应的参数 + source: audio.SourceType.SOURCE_TYPE_VOICE_COMMUNICATION, // 音源类型:语音通话 + capturerFlags: 0 // 音频采集器标志:默认为0即可 + } + private audioCapturerOptions = { + streamInfo: this.audioStreamInfo, + capturerInfo: this.audioCapturerInfo + } + // 初始化,创建实例,设置监听事件 + init() { + audio.createAudioCapturer(this.audioCapturerOptions, (err, capturer) => { // 创建AudioCapturer实例 + if (err) { + console.error(`Invoke createAudioCapturer failed, code is ${err.code}, message is ${err.message}`); + return; + } + console.info(`${TAG}: create AudioCapturer success`); + this.audioCapturer = capturer; + this.audioCapturer.on('markReach', 1000, (position) => { // 订阅markReach事件,当采集的帧数达到1000时触发回调 + if (position === 1000) { + console.info('ON Triggered successfully'); + } + }); + this.audioCapturer.on('periodReach', 2000, (position) => { // 订阅periodReach事件,当采集的帧数达到2000时触发回调 + if (position === 2000) { + console.info('ON Triggered successfully'); + } + }); + }); + } + // 开始一次音频采集 + async start() { + let stateGroup = [audio.AudioState.STATE_PREPARED, audio.AudioState.STATE_PAUSED, audio.AudioState.STATE_STOPPED]; + if (stateGroup.indexOf(this.audioCapturer.state) === -1) { // 当且仅当状态为STATE_PREPARED、STATE_PAUSED和STATE_STOPPED之一时才能启动采集 + console.error(`${TAG}: start failed`); + return; + } + await this.audioCapturer.start(); // 启动采集 + // 此处仅以将音频数据写入文件举例,实际音频通话开发中,需要将本端采集的音频数据编码打包,通过网络发送给通话对端 + let context = getContext(this); + const path = context.filesDir + '/voice_call_data.wav'; // 采集到的音频文件存储路径 + let file = fs.openSync(path, 0o2 | 0o100); // 如果文件不存在则创建文件 + let fd = file.fd; + let numBuffersToCapture = 150; // 循环写入150次 + let count = 0; + while (numBuffersToCapture) { + let bufferSize = await this.audioCapturer.getBufferSize(); + let buffer = await this.audioCapturer.read(bufferSize, true); + let options = { + offset: count * bufferSize, + length: bufferSize + }; + if (buffer === undefined) { + console.error(`${TAG}: read buffer failed`); + } else { + let number = fs.writeSync(fd, buffer, options); + console.info(`${TAG}: write date: ${number}`); + } + numBuffersToCapture--; + count++; + } + } + // 停止采集 + async stop() { + // 只有采集器状态为STATE_RUNNING或STATE_PAUSED的时候才可以停止 + if (this.audioCapturer.state !== audio.AudioState.STATE_RUNNING && this.audioCapturer.state !== audio.AudioState.STATE_PAUSED) { + console.info('Capturer is not running or paused'); + return; + } + await this.audioCapturer.stop(); // 停止采集 + if (this.audioCapturer.state === audio.AudioState.STATE_STOPPED) { + console.info('Capturer stopped'); + } else { + console.error('Capturer stop failed'); + } + } + // 销毁实例,释放资源 + async release() { + // 采集器状态不是STATE_RELEASED或STATE_NEW状态,才能release + if (this.audioCapturer.state === audio.AudioState.STATE_RELEASED || this.audioCapturer.state === audio.AudioState.STATE_NEW) { + console.info('Capturer already released'); + return; + } + await this.audioCapturer.release(); // 释放资源 + if (this.audioCapturer.state == audio.AudioState.STATE_RELEASED) { + console.info('Capturer released'); + } else { + console.error('Capturer release failed'); + } + } +} +``` diff --git a/zh-cn/application-dev/media/audio-call-overview.md b/zh-cn/application-dev/media/audio-call-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..0a021c1a2fbc103a7a84acfb889e1dd907a4ac2e --- /dev/null +++ b/zh-cn/application-dev/media/audio-call-overview.md @@ -0,0 +1,51 @@ +# 音频通话开发概述 + +常用的音频通话模式包括VOIP通话和蜂窝通话。 + +- VOIP通话: + VOIP(Voice over Internet Protocol)通话是指基于互联网协议(IP)进行通讯的一种语音通话技术。VOIP通话会将通话信息打包成数据包,通过网络进行传输,因此VOIP通话对网络要求较高,通话质量与网络连接速度紧密相关。 + +- 蜂窝通话(仅对系统应用开放) + 蜂窝通话是指传统的电话功能,由运营商提供服务,目前仅对系统应用开放,未向第三方应用提供开发接口。 + +在开发音频通话相关功能时,开发者可以根据实际情况,检查当前的[音频场景模式](#音频场景模式)和[铃声模式](#铃声模式),以使用相应的音频处理策略。 + +## 音频场景模式 + +应用使用音频通话相关功能时,系统会切换至与通话相关的音频场景模式([AudioScene](../reference/apis/js-apis-audio.md#audioscene8)),当前预置了多种音频场景,包括响铃、通话、语音聊天等,在不同的场景下,系统会采用不同的策略来处理音频。 + +如在蜂窝通话场景中会更注重人声的清晰度。系统会使用3A算法对音频数据进行预处理,抑制通话回声,消除背景噪音,调整音量范围,从而达到清晰人声的效果。3A算法,指声学回声消除(Acoustic Echo Cancellation, AEC)、背景噪声抑制(Active Noise Control, ANC)、自动增益控制(Automatic Gain Control, AGC)三种音频处理算法。 + +当前预置的四种音频场景: + +- AUDIO_SCENE_DEFAULT:默认音频场景,音频通话之外的场景均可使用。 + +- AUDIO_SCENE_RINGING:响铃音频场景,来电响铃时使用,仅对系统应用开放。 + +- AUDIO_SCENE_PHONE_CALL:蜂窝通话音频场景,蜂窝通话时使用,仅对系统应用开放。 + +- AUDIO_SCENE_VOICE_CHAT:语音聊天音频场景,VOIP通话时使用。 + +应用可通过[AudioManager](../reference/apis/js-apis-audio.md#audiomanager)的getAudioScene来获取当前的音频场景模式。当应用开始或结束使用音频通话相关功能时,可通过此方法检查系统是否已切换为合适的音频场景模式。 + +## 铃声模式 + +在用户进入到音频通话时,应用可以使用铃声或振动来提示用户。系统通过调整铃声模式([AudioRingMode](../reference/apis/js-apis-audio.md#audioringmode)),实现便捷地管理铃声音量,并调整设备的振动模式。 + +当前预置的三种铃声模式: + +- RINGER_MODE_SILENT:静音模式,此模式下铃声音量为零(即静音)。 + +- RINGER_MODE_VIBRATE:振动模式,此模式下铃声音量为零,设备振动开启(即响铃时静音,触发振动)。 + +- RINGER_MODE_NORMAL:响铃模式,此模式下铃声音量正常。 + +应用可以调用[AudioVolumeGroupManager](../reference/apis/js-apis-audio.md#audiovolumegroupmanager9)中的getRingerMode获取当前的铃声模式,以便采取合适的提示策略。 + +如果应用希望及时获取铃声模式的变化情况,可以通过AudioVolumeGroupManager中的on('ringerModeChange')监听铃声模式变化事件,使应用在铃声模式发生变化时及时收到通知,方便应用做出相应的调整。 + +## 通话场景音频设备切换 + +在通话场景下,系统会根据默认优先级选择合适的音频设备。应用可以根据需要,自主切换音频设备。 + +通信设备类型([CommunicationDeviceType](../reference/apis/js-apis-audio.md#communicationdevicetype9))是系统预置的可用于通话场景的设备,应用可以使用[AudioRoutingManager](../reference/apis/js-apis-audio.md#audioroutingmanager9)的isCommunicationDeviceActive函数获取指定通信设备的激活状态,并且可以使用AudioRoutingManager的setCommunicationDevice设置通信设备的激活状态,通过激活设备来实现通话场景音频设备的切换。 diff --git a/zh-cn/application-dev/media/audio-capturer.md b/zh-cn/application-dev/media/audio-capturer.md deleted file mode 100644 index 3d4ecec3a0bb0bbfa9ba8987f140e41659df4f59..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/media/audio-capturer.md +++ /dev/null @@ -1,254 +0,0 @@ -# 音频采集开发指导 - -## 简介 - -AudioCapturer提供了用于获取原始音频文件的方法。开发者可以通过本指导了解应用如何通过AudioCapturer接口的调用实现音频数据的采集。 - -- **状态检查**:在进行应用开发的过程中,建议开发者通过on('stateChange')方法订阅AudioCapturer的状态变更。因为针对AudioCapturer的某些操作,仅在音频采集器在固定状态时才能执行。如果应用在音频采集器处于错误状态时执行操作,系统可能会抛出异常或生成其他未定义的行为。 - -## 运作机制 - -该模块提供了音频采集模块的状态变化示意图。 - -**图1** 音频采集状态变化示意图 - -![audio-capturer-state](figures/audio-capturer-state.png) - -**PREPARED状态:** 通过调用create()方法进入到该状态。
-**RUNNING状态:** 正在进行音频数据播放,可以在prepared状态通过调用start()方法进入此状态,也可以在stopped状态通过调用start()方法进入此状态。
-**STOPPED状态:** 在running状态可以通过stop()方法停止音频数据的播放。
-**RELEASED状态:** 在prepared和stop状态,用户均可通过release()方法释放掉所有占用的硬件和软件资源,并且不会再进入到其他的任何一种状态了。
- -## 约束与限制 - -开发者在进行音频数据采集功能开发前,需要先对所开发的应用配置麦克风权限(ohos.permission.MICROPHONE),配置方式请参见[访问控制授权申请](../security/accesstoken-guidelines.md#配置文件权限声明)。 - -## 开发指导 - -详细API含义可参考:[音频管理API文档AudioCapturer](../reference/apis/js-apis-audio.md#audiocapturer8) - -1. 使用createAudioCapturer()创建一个AudioCapturer实例。 - - 在audioCapturerOptions中设置音频采集器的相关参数。该实例可用于音频采集、控制和获取采集状态,以及注册通知回调。 - - ```js - import audio from '@ohos.multimedia.audio'; - - let audioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - let audioCapturerInfo = { - source: audio.SourceType.SOURCE_TYPE_MIC, - capturerFlags: 0 // 0是音频采集器的扩展标志位,默认为0 - } - - let audioCapturerOptions = { - streamInfo: audioStreamInfo, - capturerInfo: audioCapturerInfo - } - - let audioCapturer = await audio.createAudioCapturer(audioCapturerOptions); - console.log('AudioRecLog: Create audio capturer success.'); - ``` - -2. 调用start()方法来启动/恢复采集任务。 - - 启动完成后,采集器状态将变更为STATE_RUNNING,然后应用可以开始读取缓冲区。 - - ```js - import audio from '@ohos.multimedia.audio'; - - async function startCapturer() { - let state = audioCapturer.state; - // Capturer start时的状态应该是STATE_PREPARED、STATE_PAUSED和STATE_STOPPED之一. - if (state != audio.AudioState.STATE_PREPARED || state != audio.AudioState.STATE_PAUSED || - state != audio.AudioState.STATE_STOPPED) { - console.info('Capturer is not in a correct state to start'); - return; - } - await audioCapturer.start(); - - state = audioCapturer.state; - if (state == audio.AudioState.STATE_RUNNING) { - console.info('AudioRecLog: Capturer started'); - } else { - console.error('AudioRecLog: Capturer start failed'); - } - } - ``` - -3. 读取采集器的音频数据并将其转换为字节流。重复调用read()方法读取数据,直到应用准备停止采集。 - - 参考以下示例,将采集到的数据写入文件。 - - ```js - import fs from '@ohos.file.fs'; - - let state = audioCapturer.state; - // 只有状态为STATE_RUNNING的时候才可以read. - if (state != audio.AudioState.STATE_RUNNING) { - console.info('Capturer is not in a correct state to read'); - return; - } - - const path = '/data/data/.pulse_dir/capture_js.wav'; // 采集到的音频文件存储路径 - let file = fs.openSync(filePath, 0o2); - let fd = file.fd; - if (file !== null) { - console.info('AudioRecLog: file created'); - } else { - console.info('AudioRecLog: file create : FAILED'); - return; - } - - if (fd !== null) { - console.info('AudioRecLog: file fd opened in append mode'); - } - - let numBuffersToCapture = 150; // 循环写入150次 - let count = 0; - while (numBuffersToCapture) { - let bufferSize = await audioCapturer.getBufferSize(); - let buffer = await audioCapturer.read(bufferSize, true); - let options = { - offset: count * this.bufferSize, - length: this.bufferSize - } - if (typeof(buffer) == undefined) { - console.info('AudioRecLog: read buffer failed'); - } else { - let number = fs.writeSync(fd, buffer, options); - console.info(`AudioRecLog: data written: ${number}`); - } - numBuffersToCapture--; - count++; - } - ``` - -4. 采集完成后,调用stop方法,停止录制。 - - ```js - async function StopCapturer() { - let state = audioCapturer.state; - // 只有采集器状态为STATE_RUNNING或STATE_PAUSED的时候才可以停止 - if (state != audio.AudioState.STATE_RUNNING && state != audio.AudioState.STATE_PAUSED) { - console.info('AudioRecLog: Capturer is not running or paused'); - return; - } - - await audioCapturer.stop(); - - state = audioCapturer.state; - if (state == audio.AudioState.STATE_STOPPED) { - console.info('AudioRecLog: Capturer stopped'); - } else { - console.error('AudioRecLog: Capturer stop failed'); - } - } - ``` - -5. 任务结束,调用release()方法释放相关资源。 - - ```js - async function releaseCapturer() { - let state = audioCapturer.state; - // 采集器状态不是STATE_RELEASED或STATE_NEW状态,才能release - if (state == audio.AudioState.STATE_RELEASED || state == audio.AudioState.STATE_NEW) { - console.info('AudioRecLog: Capturer already released'); - return; - } - - await audioCapturer.release(); - - state = audioCapturer.state; - if (state == audio.AudioState.STATE_RELEASED) { - console.info('AudioRecLog: Capturer released'); - } else { - console.info('AudioRecLog: Capturer release failed'); - } - } - ``` - -6. (可选)获取采集器相关信息 - - 通过以下代码,可以获取采集器的相关信息。 - - ```js - // 获取当前采集器状态 - let state = audioCapturer.state; - - // 获取采集器信息 - let audioCapturerInfo : audio.AuduioCapturerInfo = await audioCapturer.getCapturerInfo(); - - // 获取音频流信息 - let audioStreamInfo : audio.AudioStreamInfo = await audioCapturer.getStreamInfo(); - - // 获取音频流ID - let audioStreamId : number = await audioCapturer.getAudioStreamId(); - - // 获取纳秒形式的Unix时间戳 - let audioTime : number = await audioCapturer.getAudioTime(); - - // 获取合理的最小缓冲区大小 - let bufferSize : number = await audioCapturer.getBufferSize(); - ``` - -7. (可选)使用on('markReach')方法订阅采集器标记到达事件,使用off('markReach')取消订阅事件。 - - 注册markReach监听后,当采集器采集的帧数到达设定值时,会触发回调并返回设定的值。 - - ```js - audioCapturer.on('markReach', (reachNumber) => { - console.info('Mark reach event Received'); - console.info(`The Capturer reached frame: ${reachNumber}`); - }); - - audioCapturer.off('markReach'); // 取消markReach事件的订阅,后续将无法监听到“标记到达”事件 - ``` - -8. (可选)使用on('periodReach')方法订阅采集器区间标记到达事件,使用off('periodReach')取消订阅事件。 - - 注册periodReach监听后,**每当**采集器采集的帧数到达设定值时,会触发回调并返回设定的值。 - - ```js - audioCapturer.on('periodReach', (reachNumber) => { - console.info('Period reach event Received'); - console.info(`In this period, the Capturer reached frame: ${reachNumber}`); - }); - - audioCapturer.off('periodReach'); // 取消periodReach事件的订阅,后续将无法监听到“区间标记到达”事件 - ``` - -9. 如果应用需要在采集器状态更新时进行一些操作,可以订阅该事件,当采集器状态更新时,会受到一个包含有事件类型的回调。 - - ```js - audioCapturer.on('stateChange', (state) => { - console.info(`AudioCapturerLog: Changed State to : ${state}`) - switch (state) { - case audio.AudioState.STATE_PREPARED: - console.info('--------CHANGE IN AUDIO STATE----------PREPARED--------------'); - console.info('Audio State is : Prepared'); - break; - case audio.AudioState.STATE_RUNNING: - console.info('--------CHANGE IN AUDIO STATE----------RUNNING--------------'); - console.info('Audio State is : Running'); - break; - case audio.AudioState.STATE_STOPPED: - console.info('--------CHANGE IN AUDIO STATE----------STOPPED--------------'); - console.info('Audio State is : stopped'); - break; - case audio.AudioState.STATE_RELEASED: - console.info('--------CHANGE IN AUDIO STATE----------RELEASED--------------'); - console.info('Audio State is : released'); - break; - default: - console.info('--------CHANGE IN AUDIO STATE----------INVALID--------------'); - console.info('Audio State is : invalid'); - break; - } - }); - ``` \ No newline at end of file diff --git a/zh-cn/application-dev/media/audio-input-device-management.md b/zh-cn/application-dev/media/audio-input-device-management.md new file mode 100644 index 0000000000000000000000000000000000000000..08b85e614f2a9c48ae4c8aba675219b5b95ec01e --- /dev/null +++ b/zh-cn/application-dev/media/audio-input-device-management.md @@ -0,0 +1,88 @@ +# 音频输入设备管理 + +有时设备同时连接多个音频输入设备,需要指定音频输入设备进行音频录制,此时需要使用AudioRoutingManager接口进行输入设备的管理,API说明可以参考[AudioRoutingManager API文档](../reference/apis/js-apis-audio.md#audioroutingmanager9)。 + +## 创建AudioRoutingManager实例 + +在使用AudioRoutingManager管理音频设备前,需要先导入模块并创建实例。 + +```ts +import audio from '@ohos.multimedia.audio'; // 导入audio模块 + +let audioManager = audio.getAudioManager(); // 需要先创建AudioManager实例 + +let audioRoutingManager = audioManager.getRoutingManager(); // 再调用AudioManager的方法创建AudioRoutingManager实例 +``` + +## 支持的音频输入设备类型 + +目前支持的音频输入设备见下表: + +| 名称 | 值 | 说明 | +| -------- | -------- | -------- | +| WIRED_HEADSET | 3 | 有线耳机,带麦克风。 | +| BLUETOOTH_SCO | 7 | 蓝牙设备SCO(Synchronous Connection Oriented)连接。 | +| MIC | 15 | 麦克风。 | +| USB_HEADSET | 22 | USB耳机,带麦克风。 | + +## 获取输入设备信息 + +使用getDevices()方法可以获取当前所有输入设备的信息。 + +```ts +audioRoutingManager.getDevices(audio.DeviceFlag.INPUT_DEVICES_FLAG).then((data) => { + console.info('Promise returned to indicate that the device list is obtained.'); +}); +``` + +## 监听设备连接状态变化 + +可以设置监听事件来监听设备连接状态的变化,当有设备连接或断开时触发回调: + +```ts +// 监听音频设备状态变化 +audioRoutingManager.on('deviceChange', audio.DeviceFlag.INPUT_DEVICES_FLAG, (deviceChanged) => { + console.info('device change type : ' + deviceChanged.type); // 设备连接状态变化,0为连接,1为断开连接 + console.info('device descriptor size : ' + deviceChanged.deviceDescriptors.length); + console.info('device change descriptor : ' + deviceChanged.deviceDescriptors[0].deviceRole); // 设备角色 + console.info('device change descriptor : ' + deviceChanged.deviceDescriptors[0].deviceType); // 设备类型 +}); + +// 取消监听音频设备状态变化 +audioRoutingManager.off('deviceChange', (deviceChanged) => { + console.info('Should be no callback.'); +}); +``` + +## 选择音频输入设备(仅对系统应用开放) + +选择音频输入设备,当前只能选择一个输入设备,以设备id作为唯一标识。AudioDeviceDescriptors的具体信息可以参考[AudioDeviceDescriptors](../reference/apis/js-apis-audio.md#audiodevicedescriptors)。 + +> **说明:** +> +> 用户可以选择连接一组音频设备(如一对蓝牙耳机),但系统侧只感知为一个设备,该组设备共用一个设备id。 + +```ts +let inputAudioDeviceDescriptor = [{ + deviceRole : audio.DeviceRole.INPUT_DEVICE, + deviceType : audio.DeviceType.EARPIECE, + id : 1, + name : "", + address : "", + sampleRates : [44100], + channelCounts : [2], + channelMasks : [0], + networkId : audio.LOCAL_NETWORK_ID, + interruptGroupId : 1, + volumeGroupId : 1, +}]; + +async function getRoutingManager(){ + audioRoutingManager.selectInputDevice(inputAudioDeviceDescriptor).then(() => { + console.info('Invoke selectInputDevice succeeded.'); + }).catch((err) => { + console.error(`Invoke selectInputDevice failed, code is ${err.code}, message is ${err.message}`); + }); +} + +``` diff --git a/zh-cn/application-dev/media/audio-interruptmode.md b/zh-cn/application-dev/media/audio-interruptmode.md deleted file mode 100644 index b6b112551bd1354f46df67d60700e429f9619677..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/media/audio-interruptmode.md +++ /dev/null @@ -1,52 +0,0 @@ -# 音频焦点模式开发指导 - -## 简介 -音频焦点模式指的是应用内,允许对多个声音的播放进行控制。
-音频应用可以在AudioRenderer下设置独立焦点模式、共享焦点模式。
-当设置在共享的模式下,多个音频共用一个会话ID;独立焦点模式下,每一个音频拥有单独会话ID。 - -- **异步操作**:为保证UI线程不被阻塞,大部分AudioRenderer调用都是异步的。对于每个API均提供了callback函数和Promise函数,以下示例均采用Promise函数。 - -## 开发指导 - -详细API含义可参考:[音频管理API文档AudioRenderer](../reference/apis/js-apis-audio.md#audiorenderer8) - -1. 使用createAudioRenderer()创建一个AudioRenderer实例。
- 在audioRendererOptions中设置相关参数。
- 该实例可用于音频渲染、控制和获取采集状态,以及注册通知回调。
- - ```js - import audio from '@ohos.multimedia.audio'; - - var audioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - - var audioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 1 - } - - var audioRendererOptions = { - streamInfo: audioStreamInfo, - rendererInfo: audioRendererInfo - } - - let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); - ``` - -2. 设置焦点模式。 - - 在AudioRenderer初始化完毕后,可以进行焦点模式的设置。
- - ```js - var mode_ = audio.InterruptMode.SHARE_MODE; - await this.audioRenderer.setInterruptMode(mode_).then(() => { - console.log('[JSAR] [SetInterruptMode] 设置: ' + (mode_ == 0 ? "共享模式":"独立焦点模式") + "成功" ); - }); - ``` - diff --git a/zh-cn/application-dev/media/audio-output-device-management.md b/zh-cn/application-dev/media/audio-output-device-management.md new file mode 100644 index 0000000000000000000000000000000000000000..192efbfa08c217912ee4ebc2bdbcb9a0538d382e --- /dev/null +++ b/zh-cn/application-dev/media/audio-output-device-management.md @@ -0,0 +1,90 @@ +# 音频输出设备管理 + +有时设备同时连接多个音频输出设备,需要指定音频输出设备进行音频播放,此时需要使用AudioRoutingManager接口进行输出设备的管理,API说明可以参考[AudioRoutingManager API文档](../reference/apis/js-apis-audio.md#audioroutingmanager9)。 + +## 创建AudioRoutingManager实例 + +在使用AudioRoutingManager管理音频设备前,需要先导入模块并创建实例。 + +```ts +import audio from '@ohos.multimedia.audio'; // 导入audio模块 + +let audioManager = audio.getAudioManager(); // 需要先创建AudioManager实例 + +let audioRoutingManager = audioManager.getRoutingManager(); // 再调用AudioManager的方法创建AudioRoutingManager实例 +``` + +## 支持的音频输出设备类型 + +目前支持的音频输出设备见下表: + +| 名称 | 值 | 说明 | +| -------- | -------- | -------- | +| EARPIECE | 1 | 听筒。 | +| SPEAKER | 2 | 扬声器。 | +| WIRED_HEADSET | 3 | 有线耳机,带麦克风。 | +| WIRED_HEADPHONES | 4 | 有线耳机,无麦克风。 | +| BLUETOOTH_SCO | 7 | 蓝牙设备SCO(Synchronous Connection Oriented)连接。 | +| BLUETOOTH_A2DP | 8 | 蓝牙设备A2DP(Advanced Audio Distribution Profile)连接。 | +| USB_HEADSET | 22 | USB耳机,带麦克风。 | + +## 获取输出设备信息 + +使用getDevices()方法可以获取当前所有输出设备的信息。 + +```ts +audioRoutingManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data) => { + console.info('Promise returned to indicate that the device list is obtained.'); +}); +``` + +## 监听设备连接状态变化 + +可以设置监听事件来监听设备连接状态的变化,当有设备连接或断开时触发回调: + +```ts +// 监听音频设备状态变化 +audioRoutingManager.on('deviceChange', audio.DeviceFlag.OUTPUT_DEVICES_FLAG, (deviceChanged) => { + console.info('device change type : ' + deviceChanged.type); // 设备连接状态变化,0为连接,1为断开连接 + console.info('device descriptor size : ' + deviceChanged.deviceDescriptors.length); + console.info('device change descriptor : ' + deviceChanged.deviceDescriptors[0].deviceRole); // 设备角色 + console.info('device change descriptor : ' + deviceChanged.deviceDescriptors[0].deviceType); // 设备类型 +}); + +// 取消监听音频设备状态变化 +audioRoutingManager.off('deviceChange', (deviceChanged) => { + console.info('Should be no callback.'); +}); +``` + +## 选择音频输出设备(仅对系统应用开放) + +选择音频输出设备,当前只能选择一个输出设备,以设备ID作为唯一标识。AudioDeviceDescriptors的具体信息可以参考[AudioDeviceDescriptors](../reference/apis/js-apis-audio.md#audiodevicedescriptors)。 + +> **说明:** +> +> 用户可以选择连接一组音频设备(如一对蓝牙耳机),但系统侧只感知为一个设备,该组设备共用一个设备ID。 + +```ts +let outputAudioDeviceDescriptor = [{ + deviceRole : audio.DeviceRole.OUTPUT_DEVICE, + deviceType : audio.DeviceType.SPEAKER, + id : 1, + name : "", + address : "", + sampleRates : [44100], + channelCounts : [2], + channelMasks : [0], + networkId : audio.LOCAL_NETWORK_ID, + interruptGroupId : 1, + volumeGroupId : 1, +}]; + +async function selectOutputDevice(){ + audioRoutingManager.selectOutputDevice(outputAudioDeviceDescriptor).then(() => { + console.info('Invoke selectOutputDevice succeeded.'); + }).catch((err) => { + console.error(`Invoke selectOutputDevice failed, code is ${err.code}, message is ${err.message}`); + }); +} +``` diff --git a/zh-cn/application-dev/media/audio-overview.md b/zh-cn/application-dev/media/audio-overview.md deleted file mode 100644 index e0ab05f2e46e16cac84fd1deb19257229912fb4b..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/media/audio-overview.md +++ /dev/null @@ -1,20 +0,0 @@ -# 音频开发概述 - -音频模块支持音频业务的开发,提供音频相关的功能,主要包括音频播放、音量管理等。 - -## 基本概念 - -- **采样**
- 采样是指将连续时域上的模拟信号按照一定的时间间隔采样,获取到离散时域上离散信号的过程。 - -- **采样率**
- 采样率为每秒从连续信号中提取并组成离散信号的采样次数,单位用赫兹(Hz)来表示。通常人耳能听到频率范围大约在20Hz~20kHz之间的声音。常用的音频采样频率有:8kHz、11.025kHz、22.05kHz、16kHz、37.8kHz、44.1kHz、48kHz、96kHz、192kHz等。 - -- **声道**
- 声道是指声音在录制或播放时在不同空间位置采集或回放的相互独立的音频信号,所以声道数也就是声音录制时的音源数量或回放时相应的扬声器数量。 - -- **音频帧**
- 音频数据是流式的,本身没有明确的一帧帧的概念,在实际的应用中,为了音频算法处理/传输的方便,一般约定俗成取2.5ms~60ms为单位的数据量为一帧音频。这个时间被称之为“采样时间”,其长度没有特别的标准,它是根据编解码器和具体应用的需求来决定的。 - -- **PCM**
- PCM(Pulse Code Modulation),即脉冲编码调制,是一种将模拟信号数字化的方法,是将时间连续、取值连续的模拟信号转换成时间离散、抽样值离散的数字信号的过程。 diff --git a/zh-cn/application-dev/media/audio-playback-concurrency.md b/zh-cn/application-dev/media/audio-playback-concurrency.md new file mode 100644 index 0000000000000000000000000000000000000000..d76da75cc0c8bb91f0aa0d57fc3a8ab43c2847a1 --- /dev/null +++ b/zh-cn/application-dev/media/audio-playback-concurrency.md @@ -0,0 +1,119 @@ +# 多音频播放的并发策略 + +## 音频打断策略 + +多音频并发,即多个音频流同时播放。此场景下,如果系统不加管控,会造成多个音频流混音播放,容易让用户感到嘈杂,造成不好的用户体验。为了解决这个问题,系统预设了音频打断策略,对多音频播放的并发进行管控,只有持有音频焦点的音频流才可以正常播放,避免多个音频流无序并发播放的现象出现。 + +当应用开始播放音频时,系统首先为相应的音频流申请音频焦点,获得焦点的音频流可以播放;若焦点申请被拒绝,则不能播放。在音频流播放的过程中,若被其他音频流打断,则会失去音频焦点。当音频流失去音频焦点时,只能暂停播放。在应用播放音频的过程中,这些动作均由系统自行完成,无需应用主动触发。但为了维持应用和系统的状态一致性,保证良好的用户体验,推荐应用[监听音频打断事件](#监听音频打断事件),并在收到音频打断事件([InterruptEvent](../reference/apis/js-apis-audio.md#interruptevent9))时做出相应处理。 + +为满足应用对多音频并发策略的不同需求,音频打断策略预设了两种焦点模式,针对同一应用创建的多个音频流,应用可通过设置[焦点模式](#焦点模式),选择由应用自主管控或由系统统一管控。 + +音频打断策略决定了应该对音频流采取何种操作,如暂停播放、继续播放、降低音量播放、恢复音量播放等,这些操作可能由系统或应用来执行。音频打断策略预置了两种[打断类型](#打断类型),用于区分音频打断事件(InterruptEvent)的执行者。 + +### 焦点模式 + +音频打断策略预设了两种焦点模式([InterruptMode](../reference/apis/js-apis-audio.md#interruptmode9)): + +- 共享焦点模式(SHARED_MODE):由同一应用创建的多个音频流,共享一个音频焦点。这些音频流之间的并发规则由应用自主决定,音频打断策略不会介入。当其他应用创建的音频流与该应用的音频流并发播放时,才会触发音频打断策略的管控。 + +- 独立焦点模式(INDEPENDENT_MODE):应用创建的每一个音频流均会独立拥有一个音频焦点,当多个音频流并发播放时,会触发音频打断策略的管控。 + +应用可以按需选择合适的焦点模式,在创建音频流时,系统默认采用共享焦点模式,应用可主动设置所需的模式。 + +设置焦点模式的方法: + +- 若[使用AVPlayer开发音频播放功能](using-avplayer-for-playback.md),则可以通过修改AVPlayer的[audioInterruptMode](../reference/apis/js-apis-media.md#avplayer9)属性进行设置。 + +- 若[使用AudioRenderer开发音频播放功能](using-audiorenderer-for-playback.md),则可以调用AudioRenderer的[setInterruptMode](../reference/apis/js-apis-audio.md#setinterruptmode9)函数进行设置。 + + +### 打断类型 + +音频打断策略(包括两种焦点模式)决定了应该对各个音频流采取何种操作,如暂停播放、继续播放、降低音量播放、恢复音量播放等。而针对这些操作的执行过程,根据执行者的不同,可以分为两种打断类型([InterruptForceType](../reference/apis/js-apis-audio.md#interruptforcetype9)): + +- 强制打断类型(INTERRUPT_FORCE):由系统进行操作,强制打断音频播放。 + +- 共享打断类型(INTERRUPT_SHARE):由应用进行操作,可以选择打断或忽略。 + +对于音频打断策略的执行,系统默认采用强制打断类型(INTERRUPT_FORCE),应用无法更改。但对于一些策略(如继续播放等),系统无法强制执行,所以这两种打断类型均可能出现。应用可根据音频打断事件(InterruptEvent)的成员变量forceType的值,获取该事件采用的打断类型。 + +在应用播放音频的过程中,系统自动为音频流执行申请焦点、持有焦点、释放焦点等动作,当发生音频打断事件时,系统强制对音频流执行暂停、停止、降低音量、恢复音量等操作,并向应用发送音频打断事件(InterruptEvent)回调。由于系统会强制改变音频流状态,为了维持应用和系统的状态一致性,保证良好的用户体验,推荐应用[监听音频打断事件](#监听音频打断事件),并在收到音频打断事件(InterruptEvent)时做出相应处理。 + +对于一些系统无法强制执行的操作(例如音频流继续播放的场景),会向应用发送包含了共享打断类型的音频打断事件,由应用自行执行相应操作,此时应用可以选择执行或忽略,系统不会干涉。 + +## 监听音频打断事件 + +在应用播放音频时,推荐应用监听音频打断事件,当音频打断事件发生时,系统会根据预设策略,对音频流做出相应的操作,并针对状态发生改变的音频流,向所属的应用发送音频打断事件。 + +应用收到音频打断事件后,需根据其内容提示,做出相应的处理,避免出现应用状态与预期效果不一致的问题。 + +监听音频打断事件的方法: + +- 若[使用AVPlayer开发音频播放功能](using-avplayer-for-playback.md),则可以调用AVPlayer的[on('audioInterrupt')](../reference/apis/js-apis-media.md#onaudiointerrupt9)函数进行监听,当收到音频打断事件(InterruptEvent)时,应用需根据其内容,做出相应的调整。 + +- 若[使用AudioRenderer开发音频播放功能](using-audiorenderer-for-playback.md),则可以调用AudioRenderer的[on('audioInterrupt')](../reference/apis/js-apis-audio.md#onaudiointerrupt9)函数进行监听,当收到音频打断事件(InterruptEvent)时,应用需根据其内容,做出相应的调整。 + + 为了带给用户更好的体验,针对不同的音频打断事件内容,应用需要做出相应的处理操作。此处以使用AudioRenderer开发音频播放功能为例,展示推荐应用采取的处理方法,提供伪代码供开发者参考(若使用AVPlayer开发音频播放功能,处理方法类似),具体的代码实现,开发者可结合实际情况编写,处理方法也可自行调整。 + +```ts +let isPlay; // 是否正在播放,实际开发中,对应与音频播放状态相关的模块 +let isDucked; //是否降低音量,实际开发中,对应与音频音量相关的模块 +let started; // 标识符,记录“开始播放(start)”操作是否成功 + +async function onAudioInterrupt(){ + // 此处以使用AudioRenderer开发音频播放功能举例,变量audioRenderer即为播放时创建的AudioRenderer实例。 + audioRenderer.on('audioInterrupt', async(interruptEvent) => { + // 在发生音频打断事件时,audioRenderer收到interruptEvent回调,此处根据其内容做相应处理 + // 先读取interruptEvent.forceType的类型,判断系统是否已强制执行相应操作 + // 再读取interruptEvent.hintType的类型,做出相应的处理 + if (interruptEvent.forceType === audio.InterruptForceType.INTERRUPT_FORCE) { + // 强制打断类型(INTERRUPT_FORCE):音频相关处理已由系统执行,应用需更新自身状态,做相应调整 + switch (interruptEvent.hintType) { + case audio.InterruptHint.INTERRUPT_HINT_PAUSE: + // 此分支表示系统已将音频流暂停(临时失去焦点),为保持状态一致,应用需切换至音频暂停状态 + // 临时失去焦点:待其他音频流释放音频焦点后,本音频流会收到resume对应的音频打断事件,到时可自行继续播放 + isPlay = false; // 此句为简化处理,代表应用切换至音频暂停状态的若干操作 + break; + case audio.InterruptHint.INTERRUPT_HINT_STOP: + // 此分支表示系统已将音频流停止(永久失去焦点),为保持状态一致,应用需切换至音频暂停状态 + // 永久失去焦点:后续不会再收到任何音频打断事件,若想恢复播放,需要用户主动触发。 + isPlay = false; // 此句为简化处理,代表应用切换至音频暂停状态的若干操作 + break; + case audio.InterruptHint.INTERRUPT_HINT_DUCK: + // 此分支表示系统已将音频音量降低(默认降到正常音量的20%),为保持状态一致,应用需切换至降低音量播放状态 + // 若应用不接受降低音量播放,可在此处选择其他处理方式,如主动暂停等 + isDucked = true; // 此句为简化处理,代表应用切换至降低音量播放状态的若干操作 + break; + case audio.InterruptHint.INTERRUPT_HINT_UNDUCK: + // 此分支表示系统已将音频音量恢复正常,为保持状态一致,应用需切换至正常音量播放状态 + isDucked = false; // 此句为简化处理,代表应用切换至正常音量播放状态的若干操作 + break; + default: + break; + } + } else if (interruptEvent.forceType === audio.InterruptForceType.INTERRUPT_SHARE) { + // 共享打断类型(INTERRUPT_SHARE):应用可自主选择执行相关操作或忽略音频打断事件 + switch (interruptEvent.hintType) { + case audio.InterruptHint.INTERRUPT_HINT_RESUME: + // 此分支表示临时失去焦点后被暂停的音频流此时可以继续播放,建议应用继续播放,切换至音频播放状态 + // 若应用此时不想继续播放,可以忽略此音频打断事件,不进行处理即可 + // 继续播放,此处主动执行start(),以标识符变量started记录start()的执行结果 + await audioRenderer.start().then(async function () { + started = true; // start()执行成功 + }).catch((err) => { + started = false; // start()执行失败 + }); + // 若start()执行成功,则切换至音频播放状态 + if (started) { + isPlay = true; // 此句为简化处理,代表应用切换至音频播放状态的若干操作 + } else { + // 音频继续播放执行失败 + } + break; + default: + break; + } + } + }); +} +``` diff --git a/zh-cn/application-dev/media/audio-playback-overview.md b/zh-cn/application-dev/media/audio-playback-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..6bace05096de29db9288869e1b53abed37fdb4b8 --- /dev/null +++ b/zh-cn/application-dev/media/audio-playback-overview.md @@ -0,0 +1,25 @@ +# 音频播放开发概述 + +## 如何选择音频播放开发方式 + +在OpenHarmony系统中,多种API都提供了音频播放开发的支持,不同的API适用于不同音频数据格式、音频资源来源、音频使用场景,甚至是不同开发语言。因此,选择合适的音频播放API,有助于降低开发工作量,实现更佳的音频播放效果。 + +- [AVPlayer](using-avplayer-for-playback.md):功能较完善的音频、视频播放ArkTS/JS API,集成了流媒体和本地资源解析、媒体资源解封装、音频解码和音频输出功能。可以用于直接播放mp3、m4a等格式的音频文件,不支持直接播放PCM格式文件。 + +- [AudioRenderer](using-audiorenderer-for-playback.md):用于音频输出的的ArkTS/JS API,仅支持PCM格式,需要应用需要持续写入音频数据进行工作。应用可以在输入前添加数据预处理,如设定音频文件的采样率、位宽等,要求开发者具备音频处理的基础知识,适用于更专业、更多样化的媒体播放应用开发。 + +- [OpenSLES](using-opensl-es-for-playback.md):一套跨平台标准化的音频Native API,目前阶段唯一的音频类Native API,同样提供音频输出能力,仅支持PCM格式,适用于从其他嵌入式平台移植,或依赖在Native层实现音频输出功能的播放应用使用。 + +- [TonePlayer](using-toneplayer-for-playback.md):拨号和回铃音播放ArkTS/JS API,只能在固定的类型范围内选择播放内容,无需输入媒体资源或音频数据,适用于拨号盘按键和通话回铃音的特定场景。该功能当前仅对系统应用开放。 + +- 在音频播放中,应用时常需要用到一些急促简短的音效,如相机快门音效、按键音效、游戏射击音效等,当前只能使用AVPlayer播放音频文件替代实现,在OpenHarmony后续版本将会推出相关接口来支持该场景。 + +## 开发音频播放应用须知 + +应用如果要实现后台播放或熄屏播放,需要同时满足: + +1. 使用媒体会话功能注册到系统内统一管理,否则在应用进入后台时,播放将被强制停止。具体参考[媒体会话开发指导](avsession-overview.md)。 + +2. 申请长时任务避免进入挂起(Suspend)状态。具体参考[长时任务开发指导](../task-management/continuous-task-dev-guide.md)。 + +当应用进入后台,播放被中断,如果被媒体会话管控,将打印日志“pause id”;如果没有该日志,则说明被长时任务管控。 diff --git a/zh-cn/application-dev/media/audio-playback-stream-management.md b/zh-cn/application-dev/media/audio-playback-stream-management.md new file mode 100644 index 0000000000000000000000000000000000000000..548c4b0b2c8640585631eb162ac97a9c82b8bf58 --- /dev/null +++ b/zh-cn/application-dev/media/audio-playback-stream-management.md @@ -0,0 +1,118 @@ +# 音频播放流管理 + +对于播放音频类的应用,开发者需要关注该应用的音频流的状态以做出相应的操作,比如监听到状态为播放中/暂停时,及时改变播放按钮的UI显示。 + +## 读取或监听应用内音频流状态变化 + +参考[使用AudioRenderer开发音频播放功能](using-audiorenderer-for-playback.md)或[audio.createAudioRenderer](../reference/apis/js-apis-audio.md#audiocreateaudiorenderer8),完成AudioRenderer的创建,然后可以通过以下两种方式查看音频流状态的变化: + +- 方法1:直接查看AudioRenderer的[state](../reference/apis/js-apis-audio.md#属性): + + ```ts + let audioRendererState = audioRenderer.state; + console.info(`Current state is: ${audioRendererState }`) + ``` + +- 方法2:注册stateChange监听AudioRenderer的状态变化: + + ```ts + audioRenderer.on('stateChange', (rendererState) => { + console.info(`State change to: ${rendererState}`) + }); + ``` + +获取state后可对照[AudioState](../reference/apis/js-apis-audio.md#audiostate8)来进行相应的操作,比如更改暂停播放按钮的显示等。 + +## 读取或监听所有音频流的变化 + +如果部分应用需要查询获取所有音频流的变化信息,可以通过AudioStreamManager读取或监听所有音频流的变化。 + +> **说明:** +> +> 对于标记为系统接口(system api)的音频流变化信息需要系统级别应用才可查看,若应用不是系统应用,将无法获取准确信息。 + +如下为音频流管理调用关系图: + +![Audio stream management invoking relationship](figures/audio-stream-mgmt-invoking-relationship.png) + +在进行应用开发的过程中,开发者需要使用getStreamManager()创建一个AudioStreamManager实例,进而通过该实例管理音频流。开发者可通过调用on('audioRendererChange')监听音频流的变化,在音频流状态变化、设备变化时获得通知。同时可通过off('audioRendererChange')取消相关事件的监听。另外,开发者可以主动调用getCurrentAudioRendererInfoArray()来查询播放流的唯一ID、播放流客户端的UID、音频流状态等信息。 + +详细API含义可参考[音频管理API文档AudioStreamManager](../reference/apis/js-apis-audio.md#audiostreammanager9)。 + +## 开发步骤及注意事项 + +1. 创建AudioStreamManager实例。 + 在使用AudioStreamManager的API前,需要使用getStreamManager()创建一个AudioStreamManager实例。 + + ```ts + import audio from '@ohos.multimedia.audio'; + let audioManager = audio.getAudioManager(); + let audioStreamManager = audioManager.getStreamManager(); + ``` + +2. 使用on('audioRendererChange')监听音频播放流的变化。 如果音频流监听应用需要在音频播放流状态变化、设备变化时获取通知,可以订阅该事件。 + + ```ts + audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + let AudioRendererChangeInfo = AudioRendererChangeInfoArray[i]; + console.info(`## RendererChange on is called for ${i} ##`); + console.info(`StreamId for ${i} is: ${AudioRendererChangeInfo.streamId}`); + console.info(`Content ${i} is: ${AudioRendererChangeInfo.rendererInfo.content}`); + console.info(`Stream ${i} is: ${AudioRendererChangeInfo.rendererInfo.usage}`); + console.info(`Flag ${i} is: ${AudioRendererChangeInfo.rendererInfo.rendererFlags}`); + for (let j = 0;j < AudioRendererChangeInfo.deviceDescriptors.length; j++) { + console.info(`Id: ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].id}`); + console.info(`Type: ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].deviceType}`); + console.info(`Role: ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].deviceRole}`); + console.info(`Name: ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].name}`); + console.info(`Address: ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].address}`); + console.info(`SampleRates: ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].sampleRates[0]}`); + console.info(`ChannelCount ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].channelCounts[0]}`); + console.info(`ChannelMask: ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].channelMasks}`); + } + } + }); + ``` + +3. (可选)使用off('audioRendererChange')取消监听音频播放流变化。 + + ```ts + audioStreamManager.off('audioRendererChange'); + console.info('RendererChange Off is called '); + ``` + +4. (可选)使用getCurrentAudioRendererInfoArray()获取所有音频播放流的信息。 + 该接口可获取音频播放流唯一ID,音频播放客户端的UID,音频状态以及音频播放器的其他信息。 + > **说明:** + > + > 对所有音频流状态进行监听的应用需要[申请权限](../security/accesstoken-guidelines.md)ohos.permission.USE_BLUETOOTH,否则无法获得实际的设备名称和设备地址信息,查询到的设备名称和设备地址(蓝牙设备的相关属性)将为空字符串。 + + ```ts + async function getCurrentAudioRendererInfoArray(){ + await audioStreamManager.getCurrentAudioRendererInfoArray().then( function (AudioRendererChangeInfoArray) { + console.info(`getCurrentAudioRendererInfoArray Get Promise is called `); + if (AudioRendererChangeInfoArray != null) { + for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { + let AudioRendererChangeInfo = AudioRendererChangeInfoArray[i]; + console.info(`StreamId for ${i} is: ${AudioRendererChangeInfo.streamId}`); + console.info(`Content ${i} is: ${AudioRendererChangeInfo.rendererInfo.content}`); + console.info(`Stream ${i} is: ${AudioRendererChangeInfo.rendererInfo.usage}`); + console.info(`Flag ${i} is: ${AudioRendererChangeInfo.rendererInfo.rendererFlags}`); + for (let j = 0;j < AudioRendererChangeInfo.deviceDescriptors.length; j++) { + console.info(`Id: ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].id}`); + console.info(`Type: ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].deviceType}`); + console.info(`Role: ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].deviceRole}`); + console.info(`Name: ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].name}`); + console.info(`Address: ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].address}`); + console.info(`SampleRates: ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].sampleRates[0]}`); + console.info(`ChannelCount ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].channelCounts[0]}`); + console.info(`ChannelMask: ${i} : ${AudioRendererChangeInfo.deviceDescriptors[j].channelMasks}`); + } + } + } + }).catch((err) => { + console.error(`Invoke getCurrentAudioRendererInfoArray failed, code is ${err.code}, message is ${err.message}`); + }); + } + ``` diff --git a/zh-cn/application-dev/media/audio-playback.md b/zh-cn/application-dev/media/audio-playback.md deleted file mode 100644 index 56148027bde421639c42e326a757b718f9bb8084..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/media/audio-playback.md +++ /dev/null @@ -1,252 +0,0 @@ -# 音频播放开发指导 - -## 简介 - -音频播放的主要工作是将音频数据转码为可听见的音频模拟信号,并通过输出设备进行播放,同时对播放任务进行管理,包括开始播放、暂停播放、停止播放、释放资源、设置音量、跳转播放位置、获取轨道信息等功能控制。 - -## 运作机制 - -该模块提供了音频播放状态变化示意图和音频播放外部模块交互图。 - -**图1** 音频播放状态变化示意图 - -![zh-ch_image_audio_state_machine](figures/zh-ch_image_audio_state_machine.png) - -**注意**:当前为Idle状态,设置src不会改变状态;且src设置成功后,不能再次设置其它src,需调用reset()接口后,才能重新设置src。 - - - -**图2** 音频播放外部模块交互图 - -![zh-ch_image_audio_player](figures/zh-ch_image_audio_player.png) - -**说明**:三方应用通过调用JS接口层提供的js接口实现相应功能时,框架层会通过Native Framework的媒体服务,调用音频部件,将软件解码后的音频数据输出至硬件接口层的音频HDI,实现音频播放功能。 - -## 开发指导 - -详细API含义可参考:[媒体服务API文档AudioPlayer](../reference/apis/js-apis-media.md#audioplayer) - -> **说明:** -> -> path路径在FA模型和Stage模型下的获取方式不同,示例代码中仅给出pathDir示例,具体的path路径请开发者根据实际情况获取。获取方式请参考[应用沙箱路径使用说明](../reference/apis/js-apis-fileio.md#使用说明)。 - -### 全流程场景 - -音频播放的全流程场景包含:创建实例,设置uri,播放音频,跳转播放位置,设置音量,暂停播放,获取轨道信息,停止播放,重置,释放资源等流程。 - -AudioPlayer支持的src媒体源输入类型可参考:[src属性说明](../reference/apis/js-apis-media.md#audioplayer_属性) - -```js -import media from '@ohos.multimedia.media' -import fs from '@ohos.file.fs' - -// 打印码流轨道信息 -function printfDescription(obj) { - for (let item in obj) { - let property = obj[item]; - console.info('audio key is ' + item); - console.info('audio value is ' + property); - } -} - -// 设置播放器回调函数 -function setCallBack(audioPlayer) { - audioPlayer.on('dataLoad', () => { // 设置'dataLoad'事件回调,src属性设置成功后,触发此回调 - console.info('audio set source success'); - audioPlayer.play(); // 需等待'dataLoad'事件回调完成后,才可调用play进行播放,触发'play'事件回调 - }); - audioPlayer.on('play', () => { // 设置'play'事件回调 - console.info('audio play success'); - audioPlayer.pause(); // 触发'pause'事件回调,暂停播放 - }); - audioPlayer.on('pause', () => { // 设置'pause'事件回调 - console.info('audio pause success'); - audioPlayer.seek(5000); // 触发'timeUpdate'事件回调,seek到5000ms处播放 - }); - audioPlayer.on('stop', () => { // 设置'stop'事件回调 - console.info('audio stop success'); - audioPlayer.reset(); // 触发'reset'事件回调后,重新设置src属性,可完成切歌 - }); - audioPlayer.on('reset', () => { // 设置'reset'事件回调 - console.info('audio reset success'); - audioPlayer.release(); // audioPlayer资源被销毁 - audioPlayer = undefined; - }); - audioPlayer.on('timeUpdate', (seekDoneTime) => { // 设置'timeUpdate'事件回调 - if (typeof(seekDoneTime) == 'undefined') { - console.info('audio seek fail'); - return; - } - console.info('audio seek success, and seek time is ' + seekDoneTime); - audioPlayer.setVolume(0.5); // 触发'volumeChange'事件回调 - }); - audioPlayer.on('volumeChange', () => { // 设置'volumeChange'事件回调 - console.info('audio volumeChange success'); - audioPlayer.getTrackDescription((error, arrlist) => { // 通过回调方式获取音频轨道信息 - if (typeof (arrlist) != 'undefined') { - for (let i = 0; i < arrlist.length; i++) { - printfDescription(arrlist[i]); - } - } else { - console.log(`audio getTrackDescription fail, error:${error.message}`); - } - audioPlayer.stop(); // 触发'stop'事件回调,停止播放 - }); - }); - audioPlayer.on('finish', () => { // 设置'finish'事件回调,播放完成触发 - console.info('audio play finish'); - }); - audioPlayer.on('error', (error) => { // 设置'error'事件回调 - 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}`); - }); -} - -async function audioPlayerDemo() { - // 1. 创建实例 - let audioPlayer = media.createAudioPlayer(); - setCallBack(audioPlayer); // 设置事件回调 - // 2. 用户选择音频,设置uri - let fdPath = 'fd://' - let pathDir = "/data/storage/el2/base/haps/entry/files" // pathDir在FA模型和Stage模型的获取方式不同,请参考开发步骤首行的说明,根据实际情况自行获取。 - // path路径的码流可通过"hdc file send D:\xxx\01.mp3 /data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files" 命令,将其推送到设备上 - let path = pathDir + '/01.mp3' - let file = await fs.open(path); - fdPath = fdPath + '' + file.fd; - audioPlayer.src = fdPath; // 设置src属性,并触发'dataLoad'事件回调 -} -``` - -### 正常播放场景 - -```js -import media from '@ohos.multimedia.media' -import fs from '@ohos.file.fs' - -export class AudioDemo { - // 设置播放器回调函数 - setCallBack(audioPlayer) { - audioPlayer.on('dataLoad', () => { // 设置'dataLoad'事件回调,src属性设置成功后,触发此回调 - console.info('audio set source success'); - audioPlayer.play(); // 调用play方法开始播放,触发'play'事件回调 - }); - audioPlayer.on('play', () => { // 设置'play'事件回调 - console.info('audio play success'); - }); - audioPlayer.on('finish', () => { // 设置'finish'事件回调,播放完成触发 - console.info('audio play finish'); - audioPlayer.release(); // audioPlayer资源被销毁 - audioPlayer = undefined; - }); - } - - async audioPlayerDemo() { - let audioPlayer = media.createAudioPlayer(); // 创建一个音频播放实例 - this.setCallBack(audioPlayer); // 设置事件回调 - let fdPath = 'fd://' - let pathDir = "/data/storage/el2/base/haps/entry/files" // pathDir在FA模型和Stage模型的获取方式不同,请参考开发步骤首行的说明,根据实际情况自行获取。 - // path路径的码流可通过"hdc file send D:\xxx\01.mp3 /data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files" 命令,将其推送到设备上 - let path = pathDir + '/01.mp3' - let file = await fs.open(path); - fdPath = fdPath + '' + file.fd; - audioPlayer.src = fdPath; // 设置src属性,并触发'dataLoad'事件回调 - } -} -``` - -### 切歌场景 - -```js -import media from '@ohos.multimedia.media' -import fs from '@ohos.file.fs' - -export class AudioDemo { -// 设置播放器回调函数 - private isNextMusic = false; - setCallBack(audioPlayer) { - audioPlayer.on('dataLoad', () => { // 设置'dataLoad'事件回调,src属性设置成功后,触发此回调 - console.info('audio set source success'); - audioPlayer.play(); // 调用play方法开始播放,触发'play'事件回调 - }); - audioPlayer.on('play', () => { // 设置'play'事件回调 - console.info('audio play success'); - audioPlayer.reset(); // 调用reset方法,触发'reset'事件回调 - }); - audioPlayer.on('reset', () => { // 设置'reset'事件回调 - console.info('audio play success'); - if (!this.isNextMusic) { // 当isNextMusic 为false时,实现切歌功能 - this.nextMusic(audioPlayer); // 实现切歌功能 - } else { - audioPlayer.release(); // audioPlayer资源被销毁 - audioPlayer = undefined; - } - }); - } - - async nextMusic(audioPlayer) { - this.isNextMusic = true; - let nextFdPath = 'fd://' - let pathDir = "/data/storage/el2/base/haps/entry/files" // pathDir在FA模型和Stage模型的获取方式不同,请参考开发步骤首行的说明,根据实际情况自行获取。 - // path路径的码流可通过"hdc file send D:\xxx\02.mp3 /data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files" 命令,将其推送到设备上 - let nextpath = pathDir + '/02.mp3' - let nextFile = await fs.open(nextpath); - nextFdPath = nextFdPath + '' + nextFile.fd; - audioPlayer.src = nextFdPath; // 设置src属性,并重新触发触发'dataLoad'事件回调 - } - - async audioPlayerDemo() { - let audioPlayer = media.createAudioPlayer(); // 创建一个音频播放实例 - this.setCallBack(audioPlayer); // 设置事件回调 - let fdPath = 'fd://' - let pathDir = "/data/storage/el2/base/haps/entry/files" // pathDir在FA模型和Stage模型的获取方式不同,请参考开发步骤首行的说明,根据实际情况自行获取。 - // path路径的码流可通过"hdc file send D:\xxx\01.mp3 /data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files" 命令,将其推送到设备上 - let path = pathDir + '/01.mp3' - let file = await fs.open(path); - fdPath = fdPath + '' + file.fd; - audioPlayer.src = fdPath; // 设置src属性,并触发'dataLoad'事件回调 - } -} -``` - -### 单曲循环场景 - -```js -import media from '@ohos.multimedia.media' -import fs from '@ohos.file.fs' - -export class AudioDemo { - // 设置播放器回调函数 - setCallBack(audioPlayer) { - audioPlayer.on('dataLoad', () => { // 设置'dataLoad'事件回调,src属性设置成功后,触发此回调 - console.info('audio set source success'); - audioPlayer.loop = true; // 设置循环播放属性 - audioPlayer.play(); // 调用play方法开始播放,触发'play'事件回调 - }); - audioPlayer.on('play', () => { // 设置'play'事件回调,开始循环播放 - console.info('audio play success'); - }); - } - - async audioPlayerDemo() { - let audioPlayer = media.createAudioPlayer(); // 创建一个音频播放实例 - this.setCallBack(audioPlayer); // 设置事件回调 - let fdPath = 'fd://' - let pathDir = "/data/storage/el2/base/haps/entry/files" // pathDir在FA模型和Stage模型的获取方式不同,请参考开发步骤首行的说明,根据实际情况自行获取。 - // path路径的码流可通过"hdc file send D:\xxx\01.mp3 /data/app/el2/100/base/ohos.acts.multimedia.audio.audioplayer/haps/entry/files" 命令,将其推送到设备上 - let path = pathDir + '/01.mp3' - let file = await fs.open(path); - fdPath = fdPath + '' + file.fd; - audioPlayer.src = fdPath; // 设置src属性,并触发'dataLoad'事件回调 - } -} -``` - -## 相关实例 - -针对音频播放开发,有以下相关实例可供参考: - -- [`JsDistributedMusicPlayer:`分布式音乐播放(JS)(API10)(Full SDK)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/DistributedAppDev/JsDistributedMusicPlayer) -- [`MediaCollections`:媒体管理合集(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/FileManagement/MediaCollections) -- [`Recorder`: 录音机(ArkTS)(API9)(Full SDK)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Media/Recorder) -- [音频播放器(ArkTS)(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 deleted file mode 100644 index 1730280786d3dd42dd5545a8bd2573d5f25002be..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/media/audio-recorder.md +++ /dev/null @@ -1,204 +0,0 @@ -# 音频录制开发指导 - -## 简介 - -音频录制的主要工作是捕获音频信号,完成音频编码并保存到文件中,帮助开发者轻松实现音频录制功能。该模块允许调用者指定音频录制的采样率、声道数、编码格式、封装格式、输出文件的路径等参数。 - -## 运作机制 - -该模块提供了音频录制状态变化示意图和音频录制外部模块交互图。 - -**图1** 音频录制状态变化变化示意图 - -![zh-ch_image_audio_recorder_state_machine](figures/zh-ch_image_audio_recorder_state_machine.png) - - - -**图2** 音频录制外部模块交互图 - -![zh-ch_image_audio_recorder_zero](figures/zh-ch_image_audio_recorder_zero.png) - -**说明**:三方录音应用或录音机通过调用JS接口层提供的js接口实现相应功能时,框架层会通过Native Framework的媒体服务,调用音频部件获取通过音频HDI捕获的音频数据,再通过软件编码输出编码封装后的音频数据保存至文件中,实现音频录制功能。 - -## 约束与限制 - -开发者在进行录制功能开发前,需要先对所开发的应用配置麦克风权限(ohos.permission.MICROPHONE),权限配置相关内容可参考:[访问控制权限申请指导](../security/accesstoken-guidelines.md) - -## 开发指导 - -详细API含义可参考:[媒体服务API文档AudioRecorder](../reference/apis/js-apis-media.md#audiorecorder) - -### 全流程场景 - -音频录制的全流程场景包含:创建实例,设置录制参数,开始录制,暂停录制,恢复录制,停止录制,释放资源等流程。 - -```js -import media from '@ohos.multimedia.media' -import mediaLibrary from '@ohos.multimedia.mediaLibrary' -export class AudioRecorderDemo { - private testFdNumber; // 用于保存fd地址 - - // 设置音频录制相关回调函数 - setCallBack(audioRecorder) { - audioRecorder.on('prepare', () => { // 设置'prepare'事件回调 - console.log('prepare success'); - audioRecorder.start(); // 调用start方法开始录制,并触发start回调 - }); - audioRecorder.on('start', () => { // 设置'start'事件回调 - console.log('audio recorder start success'); - audioRecorder.pause(); // 调用pause方法暂停录制,并触发pause回调 - }); - audioRecorder.on('pause', () => { // 设置'pause'事件回调 - console.log('audio recorder pause success'); - audioRecorder.resume(); // 调用resume方法恢复录制,并触发resume回调 - }); - audioRecorder.on('resume', () => { // 设置'resume'事件回调 - console.log('audio recorder resume success'); - audioRecorder.stop(); // 调用stop方法停止录制,并触发stop回调 - }); - audioRecorder.on('stop', () => { // 设置'stop'事件回调 - console.log('audio recorder stop success'); - audioRecorder.reset(); // 调用reset方法重置录制,并触发reset回调 - }); - audioRecorder.on('reset', () => { // 设置'reset'事件回调 - console.log('audio recorder reset success'); - audioRecorder.release(); // 调用release方法,释放资源,并触发release回调 - }); - audioRecorder.on('release', () => { // 设置'release'事件回调 - console.log('audio recorder release success'); - audioRecorder = undefined; - }); - audioRecorder.on('error', (error) => { // 设置'error'事件回调 - 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}`); - }); - } - - // pathName是传入的录制文件名,例如:01.mp3,生成后的文件地址:/storage/media/100/local/files/Video/01.mp3 - // 使用mediaLibrary需要添加以下权限, ohos.permission.MEDIA_LOCATION、ohos.permission.WRITE_MEDIA、ohos.permission.READ_MEDIA - async getFd(pathName) { - let displayName = pathName; - const mediaTest = mediaLibrary.getMediaLibrary(); - let fileKeyObj = mediaLibrary.FileKey; - let mediaType = mediaLibrary.MediaType.VIDEO; - let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); - let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath); - if (dataUri != undefined) { - let args = dataUri.id.toString(); - let fetchOp = { - selections : fileKeyObj.ID + "=?", - selectionArgs : [args], - } - let fetchFileResult = await mediaTest.getFileAssets(fetchOp); - let fileAsset = await fetchFileResult.getAllObject(); - let fdNumber = await fileAsset[0].open('Rw'); - this.testFdNumber = "fd://" + fdNumber.toString(); - } - } - - async audioRecorderDemo() { - // 1.创建实例 - let audioRecorder = media.createAudioRecorder(); - // 2.设置回调 - this.setCallBack(audioRecorder); - await this.getFd('01.mp3'); // 调用getFd方法获取需要录制文件的fd地址 - // 3.设置录制参数 - let audioRecorderConfig = { - audioEncodeBitRate : 22050, - audioSampleRate : 22050, - numberOfChannels : 2, - uri : this.testFdNumber, // testFdNumber由getFd生成 - location : { latitude : 30, longitude : 130}, - audioEncoderMime : media.CodecMimeType.AUDIO_AAC, - fileFormat : media.ContainerFormatType.CFT_MPEG_4A, - } - audioRecorder.prepare(audioRecorderConfig); // 调用prepare方法,触发prepare回调函数 - } -} -``` - -### 正常录制场景 - -与全流程场景不同,不包括暂停录制,恢复录制的过程。 - -```js -import media from '@ohos.multimedia.media' -import mediaLibrary from '@ohos.multimedia.mediaLibrary' -export class AudioRecorderDemo { - private testFdNumber; // 用于保存fd地址 - - // 设置音频录制相关回调函数 - setCallBack(audioRecorder) { - audioRecorder.on('prepare', () => { // 设置'prepare'事件回调 - console.log('prepare success'); - audioRecorder.start(); // 调用start方法开始录制,并触发start回调 - }); - audioRecorder.on('start', () => { // 设置'start'事件回调 - console.log('audio recorder start success'); - audioRecorder.stop(); // 调用stop方法停止录制,并触发stop回调 - }); - audioRecorder.on('stop', () => { // 设置'stop'事件回调 - console.log('audio recorder stop success'); - audioRecorder.release(); // 调用release方法,释放资源,并触发release回调 - }); - audioRecorder.on('release', () => { // 设置'release'事件回调 - console.log('audio recorder release success'); - audioRecorder = undefined; - }); - audioRecorder.on('error', (error) => { // 设置'error'事件回调 - 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}`); - }); - } - - // pathName是传入的录制文件名,例如:01.mp3,生成后的文件地址:/storage/media/100/local/files/Video/01.mp3 - // 使用mediaLibrary需要添加以下权限, ohos.permission.MEDIA_LOCATION、ohos.permission.WRITE_MEDIA、ohos.permission.READ_MEDIA - async getFd(pathName) { - let displayName = pathName; - const mediaTest = mediaLibrary.getMediaLibrary(); - let fileKeyObj = mediaLibrary.FileKey; - let mediaType = mediaLibrary.MediaType.VIDEO; - let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); - let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath); - if (dataUri != undefined) { - let args = dataUri.id.toString(); - let fetchOp = { - selections : fileKeyObj.ID + "=?", - selectionArgs : [args], - } - let fetchFileResult = await mediaTest.getFileAssets(fetchOp); - let fileAsset = await fetchFileResult.getAllObject(); - let fdNumber = await fileAsset[0].open('Rw'); - this.testFdNumber = "fd://" + fdNumber.toString(); - } - } - - async audioRecorderDemo() { - // 1.创建实例 - let audioRecorder = media.createAudioRecorder(); - // 2.设置回调 - this.setCallBack(audioRecorder); - await this.getFd('01.mp3'); // 调用getFd方法获取需要录制文件的fd地址 - // 3.设置录制参数 - let audioRecorderConfig = { - audioEncodeBitRate : 22050, - audioSampleRate : 22050, - numberOfChannels : 2, - uri : this.testFdNumber, // testFdNumber由getFd生成 - location : { latitude : 30, longitude : 130}, - audioEncoderMime : media.CodecMimeType.AUDIO_AAC, - fileFormat : media.ContainerFormatType.CFT_MPEG_4A, - } - audioRecorder.prepare(audioRecorderConfig); // 调用prepare方法,触发prepare回调函数 - } -} -``` - -## 相关实例 - -针对音频录制开发,有以下相关实例可供参考: - -- [`Recorder:`录音机(ArkTS)(API9)(Full SDK)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Media/Recorder) -- [音频播放器(ArkTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/Media/Audio_OH_ETS) diff --git a/zh-cn/application-dev/media/audio-recording-overview.md b/zh-cn/application-dev/media/audio-recording-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..0fc4a867eb37a17bb77a75441ab5aa41e03eabba --- /dev/null +++ b/zh-cn/application-dev/media/audio-recording-overview.md @@ -0,0 +1,17 @@ +# 音频录制开发概述 + +## 如何选择音频录制开发方式 + +在OpenHarmony系统中,多种API都提供了音频录制开发的支持,不同的API适用于不同录音输出格式、音频使用场景或不同开发语言。因此,选择合适的音频录制API,有助于降低开发工作量,实现更佳的音频录制效果。 + +- [AVRecorder](using-avrecorder-for-recording.md):功能较完善的音频、视频录制ArkTS/JS API,集成了音频输入录制、音频编码和媒体封装的功能。开发者可以直接调用设备硬件如麦克风录音,并生成m4a音频文件。 + +- [AudioCapturer](using-audiocapturer-for-recording.md):用于音频输入的的ArkTS/JS API,仅支持PCM格式,需要应用持续读取音频数据进行工作。应用可以在音频输出后添加数据处理,要求开发者具备音频处理的基础知识,适用于更专业、更多样化的媒体录制应用开发。 + +- [OpenSLES](using-opensl-es-for-recording.md):一套跨平台标准化的音频Native API,目前阶段唯一的音频类Native API,同样提供音频输入原子能力,仅支持PCM格式,适用于从其他嵌入式平台移植,或依赖在Native层实现音频输入功能的录音应用使用。 + +## 开发音频录制应用须知 + +应用可以调用麦克风录制音频,但该行为属于隐私敏感行为,在调用麦克风前,需要先向用户申请权限“ohos.permission.MICROPHONE”。 + +权限申请的流程请参考[访问控制授权申请指导](../security/accesstoken-guidelines.md)。如何使用和管理麦克风请参考[管理麦克风](mic-management.md)。 diff --git a/zh-cn/application-dev/media/audio-recording-stream-management.md b/zh-cn/application-dev/media/audio-recording-stream-management.md new file mode 100644 index 0000000000000000000000000000000000000000..f7739a00c474f1a1f21ad4c0629f8d453a91d862 --- /dev/null +++ b/zh-cn/application-dev/media/audio-recording-stream-management.md @@ -0,0 +1,115 @@ +# 音频录制流管理 + +对于录制音频类的应用,开发者需要关注该应用的音频流的状态以做出相应的操作,比如监听到状态为结束时,及时提示用户录制已结束。 + +## 读取或监听应用内音频流状态变化 + +参考[使用AudioCapturer开发音频录制功能](using-audiocapturer-for-recording.md)或[audio.createAudioCapturer](../reference/apis/js-apis-audio.md#audiocreateaudiocapturer8),完成AudioCapturer的创建,然后可以通过以下两种方式查看音频流状态的变化: + +- 方法1:直接查看AudioCapturer的[state](../reference/apis/js-apis-audio.md#属性): + + ```ts + let audioCapturerState = audioCapturer.state; + console.info(`Current state is: ${audioCapturerState }`) + ``` + +- 方法2:注册stateChange监听AudioCapturer的状态变化: + + ```ts + audioCapturer.on('stateChange', (capturerState) => { + console.info(`State change to: ${capturerState}`) + }); + ``` + +获取state后可对照[AudioState](../reference/apis/js-apis-audio.md#audiostate8)来进行相应的操作,比如显示录制结束的提示等。 + +## 读取或监听所有录制流的变化 + +如果部分应用需要查询获取所有音频流的变化信息,可以通过AudioStreamManager读取或监听所有音频流的变化。 + +> **说明:** +> +> 对于标记为系统接口(system api)的音频流变化信息需要系统级别应用才可查看,若应用不是系统应用,将无法获取准确信息。 + +如下为音频流管理调用关系图: + +![Invoking relationship of recording stream management](figures/invoking-relationship-recording-stream-mgmt.png) + +在进行应用开发的过程中,开发者需要使用getStreamManager()创建一个AudioStreamManager实例,进而通过该实例管理音频流。开发者可通过调用on('audioCapturerChange')监听音频流的变化,在音频流状态变化、设备变化时获得通知,同时可通过off('audioCapturerChange')取消相关事件的监听。另外,开发者可以通过主动调用getCurrentAudioCapturerInfoArray()查询录制流的唯一ID、录制流客户端的UID、以及流状态等信息。 + +详细API含义可参考[音频管理API文档AudioStreamManager](../reference/apis/js-apis-audio.md#audiostreammanager9)。 + + +## 开发步骤及注意事项 + +1. 创建AudioStreamManager实例。 + 在使用AudioStreamManager的API前,需要使用getStreamManager()创建一个AudioStreamManager实例。 + + ```ts + import audio from '@ohos.multimedia.audio'; + let audioManager = audio.getAudioManager(); + let audioStreamManager = audioManager.getStreamManager(); + ``` + +2. 使用on('audioCapturerChange')监听音频录制流更改事件。 如果音频流监听应用需要在音频录制流状态变化、设备变化时获取通知,可以订阅该事件。 + + ```ts + audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(`## CapChange on is called for element ${i} ##`); + console.info(`StreamId for ${i} is: ${AudioCapturerChangeInfoArray[i].streamId}`); + console.info(`Source for ${i} is: ${AudioCapturerChangeInfoArray[i].capturerInfo.source}`); + console.info(`Flag ${i} is: ${AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags}`); + let devDescriptor = AudioCapturerChangeInfoArray[i].deviceDescriptors; + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`Id: ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`Type: ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`Role: ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`Name: ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`Address: ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`SampleRates: ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`ChannelCounts ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`ChannelMask: ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + } + }); + ``` + +3. (可选)使用off('audioCapturerChange')取消监听音频录制流变化。 + + ```ts + audioStreamManager.off('audioCapturerChange'); + console.info('CapturerChange Off is called'); + ``` + +4. (可选)使用getCurrentAudioCapturerInfoArray()获取当前音频录制流的信息。 + 该接口可获取音频录制流唯一ID,音频录制客户端的UID,音频状态以及音频捕获器的其他信息。 + > **说明:** + > 对所有音频流状态进行监听的应用需要[申请权限](../security/accesstoken-guidelines.md)ohos.permission.USE_BLUETOOTH,否则无法获得实际的设备名称和设备地址信息,查询到的设备名称和设备地址(蓝牙设备的相关属性)将为空字符串。 + + ```ts + async function getCurrentAudioCapturerInfoArray(){ + await audioStreamManager.getCurrentAudioCapturerInfoArray().then( function (AudioCapturerChangeInfoArray) { + console.info('getCurrentAudioCapturerInfoArray Get Promise Called '); + if (AudioCapturerChangeInfoArray != null) { + for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { + console.info(`StreamId for ${i} is: ${AudioCapturerChangeInfoArray[i].streamId}`); + console.info(`Source for ${i} is: ${AudioCapturerChangeInfoArray[i].capturerInfo.source}`); + console.info(`Flag ${i} is: ${AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags}`); + for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { + console.info(`Id: ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id}`); + console.info(`Type: ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType}`); + console.info(`Role: ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole}`); + console.info(`Name: ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name}`); + console.info(`Address: ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address}`); + console.info(`SampleRates: ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]}`); + console.info(`ChannelCounts ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]}`); + console.info(`ChannelMask: ${i} : ${AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks}`); + } + } + } + }).catch((err) => { + console.error(`Invoke getCurrentAudioCapturerInfoArray failed, code is ${err.code}, message is ${err.message}`); + }); + } + ``` diff --git a/zh-cn/application-dev/media/audio-renderer.md b/zh-cn/application-dev/media/audio-renderer.md deleted file mode 100644 index c99137e34763e598fa687cd7211870d2432a2c98..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/media/audio-renderer.md +++ /dev/null @@ -1,531 +0,0 @@ -# 音频渲染开发指导 - -## 简介 - -AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可以通过本指导,了解如何在输出设备中播放音频文件并管理播放任务。同时,AudioRenderer支持音频中断的功能。 -开发者在调用AudioRenderer提供的各个接口时,需要理解以下名词: - -- **音频中断**:当优先级较高的音频流需要播放时,AudioRenderer会中断优先级较低的流。例如,当用户在收听音乐时有来电,则优先级较低音乐播放将被暂停。 -- **状态检查**:在进行应用开发的过程中,建议开发者通过on('stateChange')方法订阅AudioRenderer的状态变更。因为针对AudioRenderer的某些操作,仅在音频播放器在固定状态时才能执行。如果应用在音频播放器处于错误状态时执行操作,系统可能会抛出异常或生成其他未定义的行为。 -- **异步操作**:为保证UI线程不被阻塞,大部分AudioRenderer调用都是异步的。对于每个API均提供了callback函数和Promise函数,以下示例均采用Promise函数,更多方式可参考[音频管理API文档AudioRenderer](../reference/apis/js-apis-audio.md#audiorenderer8)。 -- **焦点模式**:OpenHarmony中有两种焦点模式:**共享焦点模式**和**独立焦点模式**。其中,共享焦点模式是指,同一个应用创建的所有AudioRenderer对象共享一个焦点对象,应用内部无焦点转移,因此无法触发回调通知;独立焦点模式与之相反,即同一个应用创建的每个AudioRenderer对象都拥有独立的焦点对象,会发生焦点抢占,当应用内部发生焦点抢占,将会发生焦点转移,原本拥有焦点的AudioRenderer对象会获取到相关的回调通知。需要注意的是,默认情况下,应用创建的都是共享焦点,开发者可以调用setInterruptMode()来设置创建的焦点模式,完整示例请参考开发指导14。 - -## 运作机制 - -该模块提供了音频渲染模块的状态变化示意 - -**图1** 音频渲染状态示意图 - -![audio-renderer-state](figures/audio-renderer-state.png) - -**PREPARED状态:** 通过调用create()方法进入到该状态。
-**RUNNING状态:** 正在进行音频数据播放,可以在prepared状态通过调用start()方法进入此状态,也可以在pause状态和stopped状态通过调用start()方法进入此状态。
-**PAUSED状态:** 在running状态可以通过pause()方法暂停音频数据的播放,暂停播放之后可以通过调用start()方法继续音频数据播放。
-**STOPPED状态:** 在paused状态可以通过调用stop()方法停止音频数据的播放,在running状态可以通过stop()方法停止音频数据的播放。
-**RELEASED状态:** 在prepared、paused、stop等状态,用户均可通过release()方法释放掉所有占用的硬件和软件资源,并且不会再进入到其他的任何一种状态了。
- -## 开发指导 - -详细API含义可参考:[音频管理API文档AudioRenderer](../reference/apis/js-apis-audio.md#audiorenderer8) - -1. 使用createAudioRenderer()创建一个AudioRenderer实例。 - 在audioRendererOptions中设置相关参数。该实例可用于音频渲染、控制和获取渲染状态,以及注册通知回调。 - - ```js - import audio from '@ohos.multimedia.audio'; - - let audioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - let audioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_SPEECH, - usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, - rendererFlags: 0 // 0是音频渲染器的扩展标志位,默认为0 - } - let audioRendererOptions = { - streamInfo: audioStreamInfo, - rendererInfo: audioRendererInfo - } - - let audioRenderer = await audio.createAudioRenderer(audioRendererOptions); - console.log("Create audio renderer success."); - ``` - -2. 调用start()方法来启动/恢复播放任务。 - - ```js - async function startRenderer() { - let state = audioRenderer.state; - // Renderer start时的状态应该是STATE_PREPARED、STATE_PAUSED和STATE_STOPPED之一. - if (state != audio.AudioState.STATE_PREPARED && state != audio.AudioState.STATE_PAUSED && - state != audio.AudioState.STATE_STOPPED) { - console.info('Renderer is not in a correct state to start'); - return; - } - - await audioRenderer.start(); - - state = audioRenderer.state; - if (state == audio.AudioState.STATE_RUNNING) { - console.info('Renderer started'); - } else { - console.error('Renderer start failed'); - } - } - ``` - 启动完成后,渲染器状态将变更为STATE_RUNNING,然后应用可以开始读取缓冲区。 - - -3. 调用write()方法向缓冲区写入数据。 - - 将需要播放的音频数据读入缓冲区,重复调用write()方法写入。 - - ```js - import fs from '@ohos.file.fs'; - import audio from '@ohos.multimedia.audio'; - - async function writeBuffer(buf) { - // 写入数据时,渲染器的状态必须为STATE_RUNNING - if (audioRenderer.state != audio.AudioState.STATE_RUNNING) { - console.error('Renderer is not running, do not write'); - return; - } - let writtenbytes = await audioRenderer.write(buf); - console.info(`Actual written bytes: ${writtenbytes} `); - if (writtenbytes < 0) { - console.error('Write buffer failed. check the state of renderer'); - } - } - - // 此处是渲染器的合理的最小缓冲区大小(也可以选择其它大小的缓冲区) - const bufferSize = await audioRenderer.getBufferSize(); - let dir = globalThis.fileDir; //不可直接访问,没权限,切记!!!一定要使用沙箱路径 - const filePath = dir + '/file_example_WAV_2MG.wav'; // 需要渲染的音乐文件 实际路径为:/data/storage/el2/base/haps/entry/files/file_example_WAV_2MG.wav - console.info(`file filePath: ${ filePath}`); - - let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); - let stat = await fs.stat(filePath); //音乐文件信息 - let buf = new ArrayBuffer(bufferSize); - let len = stat.size % this.bufferSize == 0 ? Math.floor(stat.size / this.bufferSize) : Math.floor(stat.size / this.bufferSize + 1); - for (let i = 0;i < len; i++) { - let options = { - offset: i * this.bufferSize, - length: this.bufferSize - } - let readsize = await fs.read(file.fd, buf, options) - let writeSize = await new Promise((resolve,reject)=>{ - this.audioRenderer.write(buf,(err,writeSize)=>{ - if(err){ - reject(err) - }else{ - resolve(writeSize) - } - }) - }) - } - - fs.close(file) - await audioRenderer.stop(); //停止渲染 - await audioRenderer.release(); //释放资源 - ``` - -4. (可选)调用pause()方法或stop()方法暂停/停止渲染音频数据。 - - ```js - async function pauseRenderer() { - let state = audioRenderer.state; - // 只有渲染器状态为STATE_RUNNING的时候才能暂停 - if (state != audio.AudioState.STATE_RUNNING) { - console.info('Renderer is not running'); - return; - } - - await audioRenderer.pause(); - - state = audioRenderer.state; - if (state == audio.AudioState.STATE_PAUSED) { - console.info('Renderer paused'); - } else { - console.error('Renderer pause failed'); - } - } - - async function stopRenderer() { - let state = audioRenderer.state; - // 只有渲染器状态为STATE_RUNNING或STATE_PAUSED的时候才可以停止 - if (state != audio.AudioState.STATE_RUNNING && state != audio.AudioState.STATE_PAUSED) { - console.info('Renderer is not running or paused'); - return; - } - - await audioRenderer.stop(); - - state = audioRenderer.state; - if (state == audio.AudioState.STATE_STOPPED) { - console.info('Renderer stopped'); - } else { - console.error('Renderer stop failed'); - } - } - ``` - -5. (可选)调用drain()方法清空缓冲区。 - - ```js - async function drainRenderer() { - let state = audioRenderer.state; - // 只有渲染器状态为STATE_RUNNING的时候才能使用drain() - if (state != audio.AudioState.STATE_RUNNING) { - console.info('Renderer is not running'); - return; - } - - await audioRenderer.drain(); - state = audioRenderer.state; - } - ``` - -6. 任务完成,调用release()方法释放相关资源。 - - AudioRenderer会使用大量的系统资源,所以请确保完成相关任务后,进行资源释放。 - - ```js - async function releaseRenderer() { - let state = audioRenderer.state; - // 渲染器状态不是STATE_RELEASED或STATE_NEW状态,才能release - if (state == audio.AudioState.STATE_RELEASED || state == audio.AudioState.STATE_NEW) { - console.info('Renderer already released'); - return; - } - await audioRenderer.release(); - - state = audioRenderer.state; - if (state == audio.AudioState.STATE_RELEASED) { - console.info('Renderer released'); - } else { - console.info('Renderer release failed'); - } - } - ``` - -7. (可选)获取渲染器相关信息 - - 通过以下代码,可以获取渲染器的相关信息。 - - ```js - // 获取当前渲染器状态 - let state = audioRenderer.state; - - // 获取渲染器信息 - let audioRendererInfo : audio.AudioRendererInfo = await audioRenderer.getRendererInfo(); - - // 获取音频流信息 - let audioStreamInfo : audio.AudioStreamInfo = await audioRenderer.getStreamInfo(); - - // 获取音频流ID - let audioStreamId : number = await audioRenderer.getAudioStreamId(); - - // 获取纳秒形式的Unix时间戳 - let audioTime : number = await audioRenderer.getAudioTime(); - - // 获取合理的最小缓冲区大小 - let bufferSize : number = await audioRenderer.getBufferSize(); - - // 获取渲染速率 - let renderRate : audio.AudioRendererRate = await audioRenderer.getRenderRate(); - ``` - -8. (可选)设置渲染器相关信息 - - 通过以下代码,可以设置渲染器的相关信息。 - - ```js - // 设置渲染速率为正常速度 - let renderRate : audio.AudioRendererRate = audio.AudioRendererRate.RENDER_RATE_NORMAL; - await audioRenderer.setRenderRate(renderRate); - - // 设置渲染器音频中断模式为SHARE_MODE - let interruptMode : audio.InterruptMode = audio.InterruptMode.SHARE_MODE; - await audioRenderer.setInterruptMode(interruptMode); - - // 设置一个流的音量为0.5 - let volume : number = 0.5; - await audioRenderer.setVolume(volume); - ``` - -9. (可选)使用on('audioInterrupt')方法订阅渲染器音频中断事件,使用off('audioInterrupt')取消订阅事件。 - - 当优先级更高或相等的Stream-B请求激活并使用输出设备时,Stream-A被中断。 - - 在某些情况下,框架会采取暂停播放、降低音量等强制操作,并通过InterruptEvent通知应用。在其他情况下,应用可以自行对InterruptEvent做出响应。 - - 在音频中断的情况下,应用可能会碰到音频数据写入失败的问题。所以建议不感知、不处理中断的应用在写入音频数据前,使用audioRenderer.state检查播放器状态。而订阅音频中断事件,可以获取到更多详细信息,具体可参考[InterruptEvent](../reference/apis/js-apis-audio.md#interruptevent9)。 - - 需要说明的是,本模块的订阅音频中断事件与[AudioManager](../reference/apis/js-apis-audio.md#audiomanager)模块中的on('interrupt')稍有不同。自api9以来,on('interrupt')和off('interrupt')均被废弃。在AudioRenderer模块,当开发者需要监听焦点变化事件时,只需要调用on('audioInterrupt')函数,当应用内部的AudioRenderer对象在start\stop\pause等动作发生时,会主动请求焦点,从而发生焦点转移,相关的AudioRenderer对象即可获取到对应的回调信息。但对除AudioRenderer的其他对象,例如FM、语音唤醒等,应用不会创建对象,此时可调用AudioManager中的on('interrupt')获取焦点变化通知。 - - ```js - audioRenderer.on('audioInterrupt', (interruptEvent) => { - console.info('InterruptEvent Received'); - console.info(`InterruptType: ${interruptEvent.eventType}`); - console.info(`InterruptForceType: ${interruptEvent.forceType}`); - console.info(`AInterruptHint: ${interruptEvent.hintType}`); - - if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_FORCE) { - switch (interruptEvent.hintType) { - // 音频框架发起的强制暂停操作,为防止数据丢失,此时应该停止数据的写操作 - case audio.InterruptHint.INTERRUPT_HINT_PAUSE: - isPlay = false; - break; - // 音频框架发起的强制停止操作,为防止数据丢失,此时应该停止数据的写操作 - case audio.InterruptHint.INTERRUPT_HINT_STOP: - isPlay = false; - break; - // 音频框架发起的强制降低音量操作 - case audio.InterruptHint.INTERRUPT_HINT_DUCK: - break; - // 音频框架发起的恢复音量操作 - case audio.InterruptHint.INTERRUPT_HINT_UNDUCK: - break; - } - } else if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_SHARE) { - switch (interruptEvent.hintType) { - // 提醒App开始渲染 - case audio.InterruptHint.INTERRUPT_HINT_RESUME: - startRenderer(); - break; - // 提醒App音频流被中断,由App自主决定是否继续(此处选择暂停) - case audio.InterruptHint.INTERRUPT_HINT_PAUSE: - isPlay = false; - pauseRenderer(); - break; - } - } - }); - - audioRenderer.off('audioInterrupt'); // 取消音频中断事件的订阅,后续将无法监听到音频中断事件 - ``` - -10. (可选)使用on('markReach')方法订阅渲染器标记到达事件,使用off('markReach')取消订阅事件。 - - 注册markReach监听后,当渲染器渲染的帧数到达设定值时,会触发回调并返回设定的值。 - - ```js - audioRenderer.on('markReach', (reachNumber) => { - console.info('Mark reach event Received'); - console.info(`The renderer reached frame: ${reachNumber}`); - }); - - audioRenderer.off('markReach'); // 取消markReach事件的订阅,后续将无法监听到“标记到达”事件 - ``` - -11. (可选)使用on('periodReach')方法订阅渲染器区间标记到达事件,使用off('periodReach')取消订阅事件。 - - 注册periodReach监听后,**每当**渲染器渲染的帧数到达设定值时,会触发回调并返回设定的值。 - - ```js - audioRenderer.on('periodReach', (reachNumber) => { - console.info('Period reach event Received'); - console.info(`In this period, the renderer reached frame: ${reachNumber} `); - }); - - audioRenderer.off('periodReach'); // 取消periodReach事件的订阅,后续将无法监听到“区间标记到达”事件 - ``` - -12. (可选)使用on('stateChange')方法订阅渲染器音频状态变化事件。 - - 注册stateChange监听后,当渲染器的状态发生改变时,会触发回调并返回当前渲染器的状态。 - - ```js - audioRenderer.on('stateChange', (audioState) => { - console.info('State change event Received'); - console.info(`Current renderer state is: ${audioState}`); - }); - ``` - -13. (可选)对on()方法的异常处理。 - - 在使用on()方法时,如果传入的字符串错误或传入的参数类型错误,程序会抛出异常,需要用try catch来捕获。 - - ```js - try { - audioRenderer.on('invalidInput', () => { // 字符串不匹配 - }) - } catch (err) { - console.info(`Call on function error, ${err}`); // 程序抛出401异常 - } - try { - audioRenderer.on(1, () => { // 入参类型错误 - }) - } catch (err) { - console.info(`Call on function error, ${err}`); // 程序抛出6800101异常 - } - ``` - -14. (可选)on('audioInterrupt')方法完整示例。 - 同一个应用中的AudioRender1和AudioRender2在创建时均设置了焦点模式为独立,并且调用on('audioInterrupt')监听焦点变化。刚开始AudioRender1拥有焦点,当AudioRender2获取到焦点时,audioRenderer1将收到焦点转移的通知,打印相关日志。如果AudioRender1和AudioRender2不将焦点模式设置为独立,则监听处理中的日志在应用运行过程中永远不会被打印。 - ```js - async runningAudioRender1(){ - let audioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - let audioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 // 0是音频渲染器的扩展标志位,默认为0 - } - let audioRendererOptions = { - streamInfo: audioStreamInfo, - rendererInfo: audioRendererInfo - } - - //1.1 创建对象 - audioRenderer1 = await audio.createAudioRenderer(audioRendererOptions); - console.info("Create audio renderer 1 success."); - - //1.2 设置焦点模式为独立模式 :1 - audioRenderer1.setInterruptMode(1).then( data => { - console.info('audioRenderer1 setInterruptMode Success!'); - }).catch((err) => { - console.error(`audioRenderer1 setInterruptMode Fail: ${err}`); - }); - - //1.3 设置监听 - audioRenderer1.on('audioInterrupt', async(interruptEvent) => { - console.info(`audioRenderer1 on audioInterrupt : ${JSON.stringify(interruptEvent)}`) - }); - - //1.4 启动渲染 - await audioRenderer1.start(); - console.info('startAudioRender1 success'); - - //1.5 获取缓存区大小,此处是渲染器的合理的最小缓冲区大小(也可以选择其它大小的缓冲区) - const bufferSize = await audioRenderer1.getBufferSize(); - console.info(`audio bufferSize: ${bufferSize}`); - - //1.6 获取原始音频数据文件 - let dir = globalThis.fileDir; //不可直接访问,没权限,切记!!!一定要使用沙箱路径 - const path1 = dir + '/music001_48000_32_1.wav'; // 需要渲染的音乐文件 实际路径为:/data/storage/el2/base/haps/entry/files/music001_48000_32_1.wav - console.info(`audioRender1 file path: ${ path1}`); - let file1 = fs.openSync(path1, fs.OpenMode.READ_ONLY); - let stat = await fs.stat(path1); //音乐文件信息 - let buf = new ArrayBuffer(bufferSize); - let len = stat.size % this.bufferSize == 0 ? Math.floor(stat.size / this.bufferSize) : Math.floor(stat.size / this.bufferSize + 1); - - //1.7 通过audioRender对缓存区的原始音频数据进行渲染 - for (let i = 0;i < len; i++) { - let options = { - offset: i * this.bufferSize, - length: this.bufferSize - } - let readsize = await fs.read(file.fd, buf, options) - let writeSize = await new Promise((resolve,reject)=>{ - this.audioRenderer1.write(buf,(err,writeSize)=>{ - if(err){ - reject(err) - }else{ - resolve(writeSize) - } - }) - }) - } - fs.close(file1) - await audioRenderer1.stop(); //停止渲染 - await audioRenderer1.release(); //释放资源 - } - - async runningAudioRender2(){ - let audioStreamInfo = { - samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, - channels: audio.AudioChannel.CHANNEL_1, - sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE, - encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW - } - let audioRendererInfo = { - content: audio.ContentType.CONTENT_TYPE_MUSIC, - usage: audio.StreamUsage.STREAM_USAGE_MEDIA, - rendererFlags: 0 // 0是音频渲染器的扩展标志位,默认为0 - } - let audioRendererOptions = { - streamInfo: audioStreamInfo, - rendererInfo: audioRendererInfo - } - - //2.1 创建对象 - audioRenderer2 = await audio.createAudioRenderer(audioRendererOptions); - console.info("Create audio renderer 2 success."); - - //2.2 设置焦点模式为独立模式 :1 - audioRenderer2.setInterruptMode(1).then( data => { - console.info('audioRenderer2 setInterruptMode Success!'); - }).catch((err) => { - console.error(`audioRenderer2 setInterruptMode Fail: ${err}`); - }); - - //2.3 设置监听 - audioRenderer2.on('audioInterrupt', async(interruptEvent) => { - console.info(`audioRenderer2 on audioInterrupt : ${JSON.stringify(interruptEvent)}`) - }); - - //2.4 启动渲染 - await audioRenderer2.start(); - console.info('startAudioRender2 success'); - - //2.5 获取缓存区大小 - const bufferSize = await audioRenderer2.getBufferSize(); - console.info(`audio bufferSize: ${bufferSize}`); - - //2.6 获取原始音频数据文件 - let dir = globalThis.fileDir; //不可直接访问,没权限,切记!!!一定要使用沙箱路径 - const path2 = dir + '/music002_48000_32_1.wav'; // 需要渲染的音乐文件 实际路径为:/data/storage/el2/base/haps/entry/files/music002_48000_32_1.wav - console.info(`audioRender2 file path: ${ path2}`); - let file2 = fs.openSync(path2, fs.OpenMode.READ_ONLY); - let stat = await fs.stat(path2); //音乐文件信息 - let buf = new ArrayBuffer(bufferSize); - let len = stat.size % this.bufferSize == 0 ? Math.floor(stat.size / this.bufferSize) : Math.floor(stat.size / this.bufferSize + 1); - - //2.7 通过audioRender对缓存区的原始音频数据进行渲染 - for (let i = 0;i < len; i++) { - let options = { - offset: i * this.bufferSize, - length: this.bufferSize - } - let readsize = await fs.read(file.fd, buf, options) - let writeSize = await new Promise((resolve,reject)=>{ - this.audioRenderer2.write(buf,(err,writeSize)=>{ - if(err){ - reject(err) - }else{ - resolve(writeSize) - } - }) - }) - } - fs.close(file2) - await audioRenderer2.stop(); //停止渲染 - await audioRenderer2.release(); //释放资源 - } - - async writeBuffer(buf, audioRender) { - let writtenbytes; - await audioRender.write(buf).then((value) => { - writtenbytes = value; - console.info(`Actual written bytes: ${writtenbytes} `); - }); - if (typeof(writtenbytes) != 'number' || writtenbytes < 0) { - console.error('get Write buffer failed. check the state of renderer'); - } - } - - //综合调用入口 - async test(){ - await runningAudioRender1(); - await runningAudioRender2(); - } - - ``` \ No newline at end of file diff --git a/zh-cn/application-dev/media/audio-routing-manager.md b/zh-cn/application-dev/media/audio-routing-manager.md deleted file mode 100644 index d91249e398ae6a903edfae903cfcf510b6bac4ec..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/media/audio-routing-manager.md +++ /dev/null @@ -1,112 +0,0 @@ -# 路由、设备管理开发指导 - -## 简介 - -AudioRoutingManager提供了音频路由、设备管理的方法。开发者可以通过本指导了解应用如何通过AudioRoutingManager获取当前工作的输入、输出音频设备,监听音频设备的连接状态变化,激活通信设备等。 - -## 运作机制 - -该模块提供了路由、设备管理模块常用接口 - -**图1** 路由、设备管理常用接口 - -![zh-ch_image_audio_routing_manager](figures/zh-ch_image_audio_routing_manager.png) - -**说明:** AudioRoutingManager主要接口有:获取设备列表信息、监听与取消监听设备连接状态、激活通信设备、查询通信设备激活状态。更多介绍请参考[API参考文档](../reference/apis/js-apis-audio.md)。 - - -## 开发指导 - -详细API含义可参考:[音频路由、设备管理API文档AudioRoutingManager](../reference/apis/js-apis-audio.md#audioroutingmanager9) - -1. 创建AudioRoutingManager实例。 - - 在使用AudioRoutingManager的API前,需要使用getRoutingManager创建一个AudioRoutingManager实例。 - - ```js - import audio from '@ohos.multimedia.audio'; - async loadAudioRoutingManager() { - var audioRoutingManager = await audio.getAudioManager().getRoutingManager(); - console.info('audioRoutingManager------create-------success.'); - } - - ``` - -2. (可选)获取设备列表信息、监听设备链接状态变化。 - - 如果开发者需要获取设备列表信息(输入、输出、分布式输入、分布式输出等),或者监听音频设备的链接状态变化时,可参考并调用以下接口。 - - ```js - import audio from '@ohos.multimedia.audio'; - //创建AudioRoutingManager实例 - async loadAudioRoutingManager() { - var audioRoutingManager = await audio.getAudioManager().getRoutingManager(); - console.info('audioRoutingManager------create-------success.'); - } - //获取全部音频设备信息(开发者可以根据自身需要填入适当的DeviceFlag) - async getDevices() { - await loadAudioRoutingManager(); - await audioRoutingManager.getDevices(audio.DeviceFlag.ALL_DEVICES_FLAG).then((data) => { - console.info(`getDevices success and data is: ${JSON.stringify(data)}.`); - }); - } - //监听音频设备状态变化 - async onDeviceChange() { - await loadAudioRoutingManager(); - await audioRoutingManager.on('deviceChange', audio.DeviceFlag.ALL_DEVICES_FLAG, (deviceChanged) => { - console.info('on device change type : ' + deviceChanged.type); - console.info('on device descriptor size : ' + deviceChanged.deviceDescriptors.length); - console.info('on device change descriptor : ' + deviceChanged.deviceDescriptors[0].deviceRole); - console.info('on device change descriptor : ' + deviceChanged.deviceDescriptors[0].deviceType); - }); - } - //取消监听音频设备状态变化 - async offDeviceChange() { - await loadAudioRoutingManager(); - await audioRoutingManager.off('deviceChange', (deviceChanged) => { - console.info('off device change type : ' + deviceChanged.type); - console.info('off device descriptor size : ' + deviceChanged.deviceDescriptors.length); - console.info('off device change descriptor : ' + deviceChanged.deviceDescriptors[0].deviceRole); - console.info('off device change descriptor : ' + deviceChanged.deviceDescriptors[0].deviceType); - }); - } - //综合调用:先查询所有设备,设置监听,然后开发者手动变更设备连接(例如有线耳机),再次查询所有设备,最后取消设备状态变化的监听。 - async test(){ - await getDevices(); - await onDeviceChange()(); - //开发者手动断开/连接设备 - await getDevices(); - await offDeviceChange(); - } - ``` - -3. (可选)设置通信设备激活并查询激活状态。 - - ```js - import audio from '@ohos.multimedia.audio'; - //创建AudioRoutingManager实例 - async loadAudioRoutingManager() { - var audioRoutingManager = await audio.getAudioManager().getRoutingManager(); - console.info('audioRoutingManager------create-------success.'); - } - //设置通信设备激活状态 - async setCommunicationDevice() { - await loadAudioRoutingManager(); - await audioRoutingManager.setCommunicationDevice(audio.CommunicationDeviceType.SPEAKER, true).then(() => { - console.info('setCommunicationDevice true is success.'); - }); - } - //查询通信设备激活状态 - async isCommunicationDeviceActive() { - await loadAudioRoutingManager(); - await audioRoutingManager.isCommunicationDeviceActive(audio.CommunicationDeviceType.SPEAKER).then((value) => { - console.info(`CommunicationDevice state is: ${value}.`); - }); - } - //综合调用:先设置设备激活,然后查询设备状态。 - async test(){ - await setCommunicationDevice(); - await isCommunicationDeviceActive(); - } - ``` - diff --git a/zh-cn/application-dev/media/audio-stream-manager.md b/zh-cn/application-dev/media/audio-stream-manager.md deleted file mode 100644 index eae42fd248eba633fa4ad771bbd92529b93bd59e..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/media/audio-stream-manager.md +++ /dev/null @@ -1,161 +0,0 @@ -# 音频流管理开发指导 - -## 简介 - -AudioStreamManager提供了音频流管理的方法。开发者可以通过本指导了解应用如何通过AudioStreamManager管理音频流。 - -## 运作机制 - -该模块提供了音频流管理调用关系图 - -**图1** 音频流管理调用关系图 - -![zh-ch_image_audio_stream_manager](figures/zh-ch_image_audio_stream_manager.png) - -**说明**:在进行应用开发的过程中,开发者需要使用getStreamManager()创建一个AudioStreamManager实例,进而通过该实例管理音频流。开发者可通过调用on('audioRendererChange')、on('audioCapturerChange')监听音频播放应用和音频录制应用,在应用状态变化、设备变化、音频属性变化时获得通知。同时可通过off('audioRendererChange')、off('audioCapturerChange')取消相关事件的监听。与此同时,开发者可以通过调用(可选)使用getCurrentAudioRendererInfoArray()获取当前音频播放应用的音频流唯一ID、音频播放客户端的UID、音频状态等信息,同理可调用getCurrentAudioCapturerInfoArray()获取音频录制应用的信息。 - -## 开发指导 - -详细API含义可参考:[音频管理API文档AudioStreamManager](../reference/apis/js-apis-audio.md#audiostreammanager9) - -1. 创建AudioStreamManager实例。 - - 在使用AudioStreamManager的API前,需要使用getStreamManager()创建一个AudioStreamManager实例。 - - ```js - var audioManager = audio.getAudioManager(); - var audioStreamManager = audioManager.getStreamManager(); - ``` - -2. (可选)使用on('audioRendererChange')监听音频渲染器更改事件。 -如果音频流监听应用需要在音频播放应用状态变化、设备变化、音频属性变化时获取通知,可以订阅该事件。更多事件请参考[API参考文档](../reference/apis/js-apis-audio.md)。 - - ```js - audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => { - for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { - AudioRendererChangeInfo = AudioRendererChangeInfoArray[i]; - console.info('## RendererChange on is called for ' + i + ' ##'); - console.info('StreamId for ' + i + ' is:' + AudioRendererChangeInfo.streamId); - console.info('ClientUid for ' + i + ' is:' + AudioRendererChangeInfo.clientUid); - console.info('Content for ' + i + ' is:' + AudioRendererChangeInfo.rendererInfo.content); - console.info('Stream for ' + i + ' is:' + AudioRendererChangeInfo.rendererInfo.usage); - console.info('Flag ' + i + ' is:' + AudioRendererChangeInfo.rendererInfo.rendererFlags); - console.info('State for ' + i + ' is:' + AudioRendererChangeInfo.rendererState); - var devDescriptor = AudioRendererChangeInfo.deviceDescriptors; - for (let j = 0; j < AudioRendererChangeInfo.deviceDescriptors.length; j++) { - console.info('Id:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].id); - console.info('Type:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].deviceType); - console.info('Role:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].deviceRole); - console.info('Name:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].name); - console.info('Address:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].address); - console.info('SampleRates:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].sampleRates[0]); - console.info('ChannelCounts' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].channelCounts[0]); - console.info('ChannelMask:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].channelMasks); - } - } - }); - ``` - -3. (可选)使用off('audioRendererChange')取消监听音频渲染器更改事件。 - - ```js - audioStreamManager.off('audioRendererChange'); - console.info('######### RendererChange Off is called #########'); - ``` - -4. (可选)使用on('audioCapturerChange')监听音频捕获器更改事件。 -如果音频流监听应用需要在音频录制应用状态变化、设备变化、音频属性变化时获取通知,可以订阅该事件。更多事件请参考[API参考文档](../reference/apis/js-apis-audio.md)。 - - ```js - audioStreamManager.on('audioCapturerChange', (AudioCapturerChangeInfoArray) => { - for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { - console.info(' ## audioCapturerChange on is called for element ' + i + ' ##'); - console.info('StreamId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); - console.info('ClientUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); - console.info('Source for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); - console.info('Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); - console.info('State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); - for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { - console.info('Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); - console.info('Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); - console.info('Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); - console.info('Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name); - console.info('Address:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); - console.info('SampleRates:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); - console.info('ChannelCounts' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); - console.info('ChannelMask:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); - } - } - }); - ``` - -5. (可选)使用off('audioCapturerChange')取消监听音频捕获器更改事件。 - - ```js - audioStreamManager.off('audioCapturerChange'); - console.info('######### CapturerChange Off is called #########'); - ``` - -6. (可选)使用getCurrentAudioRendererInfoArray()获取当前音频渲染器的信息。 -该接口可获取音频流唯一ID,音频播放客户端的UID,音频状态以及音频播放器的其他信息。需注意的是若对第三方音频流监听应用未配置ohos.permission.USE_BLUETOOTH权限,则查询到的设备名称和设备地址为空字符串,若正确配置权限,则显示的实际的设备名称和设备地址信息。 - - ```js - await audioStreamManager.getCurrentAudioRendererInfoArray().then( function (AudioRendererChangeInfoArray) { - console.info('######### Get Promise is called ##########'); - if (AudioRendererChangeInfoArray != null) { - for (let i = 0; i < AudioRendererChangeInfoArray.length; i++) { - AudioRendererChangeInfo = AudioRendererChangeInfoArray[i]; - console.info('StreamId for ' + i +' is:' + AudioRendererChangeInfo.streamId); - console.info('ClientUid for ' + i + ' is:' + AudioRendererChangeInfo.clientUid); - console.info('Content ' + i + ' is:' + AudioRendererChangeInfo.rendererInfo.content); - console.info('Stream' + i +' is:' + AudioRendererChangeInfo.rendererInfo.usage); - console.info('Flag' + i + ' is:' + AudioRendererChangeInfo.rendererInfo.rendererFlags); - console.info('State for ' + i + ' is:' + AudioRendererChangeInfo.rendererState); - var devDescriptor = AudioRendererChangeInfo.deviceDescriptors; - for (let j = 0; j < AudioRendererChangeInfo.deviceDescriptors.length; j++) { - console.info('Id:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].id); - console.info('Type:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].deviceType); - console.info('Role:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].deviceRole); - console.info('Name:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].name); - console.info('Address:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].address); - console.info('SampleRates:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].sampleRates[0]); - console.info('ChannelCounts' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].channelCounts[0]); - console.info('ChannelMask:' + i + ':' + AudioRendererChangeInfo.deviceDescriptors[j].channelMasks); - } - } - } - }).catch((err) => { - console.log('getCurrentAudioRendererInfoArray :ERROR: ' + err.message); - }); - ``` - -7. (可选)使用getCurrentAudioCapturerInfoArray()获取当前音频捕获器的信息。 -该接口可获取音频流唯一ID,音频录制客户端的UID,音频状态以及音频捕获器的其他信息。需注意的是若对第三方音频流监听应用未配置ohos.permission.USE_BLUETOOTH权限,则查询到的设备名称和设备地址为空字符串,若正确配置权限,则显示的实际的设备名称和设备地址信息。 - - ```js - await audioStreamManager.getCurrentAudioCapturerInfoArray().then( function (AudioCapturerChangeInfoArray) { - console.info('getCurrentAudioCapturerInfoArray: **** Get Promise Called ****'); - if (AudioCapturerChangeInfoArray != null) { - for (let i = 0; i < AudioCapturerChangeInfoArray.length; i++) { - console.info('StreamId for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].streamId); - console.info('ClientUid for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].clientUid); - console.info('Source for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.source); - console.info('Flag ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerInfo.capturerFlags); - console.info('State for ' + i + 'is:' + AudioCapturerChangeInfoArray[i].capturerState); - var devDescriptor = AudioCapturerChangeInfoArray[i].deviceDescriptors; - for (let j = 0; j < AudioCapturerChangeInfoArray[i].deviceDescriptors.length; j++) { - console.info('Id:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].id); - console.info('Type:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceType); - console.info('Role:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].deviceRole); - console.info('Name:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].name) - console.info('Address:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].address); - console.info('SampleRates:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].sampleRates[0]); - console.info('ChannelCounts' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelCounts[0]); - console.info('ChannelMask:' + i + ':' + AudioCapturerChangeInfoArray[i].deviceDescriptors[j].channelMasks); - } - } - } - }).catch((err) => { - console.log('getCurrentAudioCapturerInfoArray :ERROR: ' + err.message); - }); - ``` \ No newline at end of file diff --git a/zh-cn/application-dev/media/audio-volume-manager.md b/zh-cn/application-dev/media/audio-volume-manager.md deleted file mode 100644 index 3876c86e751018f67cccf75ac75fd0580a6a6ed0..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/media/audio-volume-manager.md +++ /dev/null @@ -1,127 +0,0 @@ -# 音量管理开发指导 - -## 简介 - -AudioVolumeManager提供了音量管理的方法。开发者可以通过本指导了解应用如何通过AudioVolumeManager获取指定流音量信息、监听铃声模式变化、设置麦克风静音等。 - -## 运作机制 - -该模块提供了音量管理模块常用接口 - -**图1** 音量管理常用接口 - -![zh-ch_image_audio_volume_manager](figures/zh-ch_image_audio_volume_manager.png) - -**说明:** AudioVolumeManager包含音量变化监听处理和音频音量组管理相关(AudioVolumeGroupManager),开发者调用AudioVolumeGroupManager的相关方法,需要先调用getVolumeGroupManager方法创建AudioVolumeGroupManager实例,从而调用对应的接口实现相应的功能,主要接口有:获取指定流的音量、设置麦克风静音、监听麦克风状态变化等。更多介绍请参考[API参考文档](../reference/apis/js-apis-audio.md)。 - -## 约束与限制 - -开发者在进行麦克风管理开发前,需要先对所开发的应用配置麦克风权限(ohos.permission.MICROPHONE),如果要设置麦克风状态,则需要配置音频管理配置权限(ohos.permission.MANAGE_AUDIO_CONFIG),需注意该权限为系统级别权限。配置方式请参见[访问控制授权申请](../security/accesstoken-guidelines.md#配置文件权限声明)。 - -## 开发指导 - -详细API含义可参考:[音量管理API文档AudioVolumeManager](../reference/apis/js-apis-audio.md#audiovolumemanager9) - -1. 创建AudioVolumeGroupManager实例。 - - 在使用AudioVolumeGroupManager的API前,需要使用getVolumeGroupManager创建一个AudioStreamManager实例。 - - ```js - import audio from '@ohos.multimedia.audio'; - async loadVolumeGroupManager() { - const groupid = audio.DEFAULT_VOLUME_GROUP_ID; - var audioVolumeGroupManager = await audio.getAudioManager().getVolumeManager().getVolumeGroupManager(groupid); - console.error('audioVolumeGroupManager create success.'); - } - - ``` - -2. (可选)获取音量信息、铃声模式。 - - 如果开发者需要获取指定音频流的音量信息(铃声、语音电话、媒体、语音助手等),或者获取当前设备是静音、震动、响铃模式,可参考并调用以下接口。更多事件请参考[API参考文档](../reference/apis/js-apis-audio.md)。 - - ```js - import audio from '@ohos.multimedia.audio'; - async loadVolumeGroupManager() { - const groupid = audio.DEFAULT_VOLUME_GROUP_ID; - var audioVolumeGroupManager = await audio.getAudioManager().getVolumeManager().getVolumeGroupManager(groupid); - console.info('audioVolumeGroupManager create success.'); - } - - //获取指定流的当前音量(范围为0 ~ 15) - async getVolume() { - await loadVolumeGroupManager(); - await audioVolumeGroupManager.getVolume(audio.AudioVolumeType.MEDIA).then((value) => { - console.info(`getVolume success and volume is: ${value}.`); - }); - } - //获取指定流的最小音量 - async getMinVolume() { - await loadVolumeGroupManager(); - await audioVolumeGroupManager.getMinVolume(audio.AudioVolumeType.MEDIA).then((value) => { - console.info(`getMinVolume success and volume is: ${value}.`); - }); - } - //获取指定流的最大音量 - async getMaxVolume() { - await loadVolumeGroupManager(); - await audioVolumeGroupManager.getMaxVolume(audio.AudioVolumeType.MEDIA).then((value) => { - console.info(`getMaxVolume success and volume is: ${value}.`); - }); - } - //获取当前铃声模式: 静音(0)| 震动(1) | 响铃(2) - async getRingerMode() { - await loadVolumeGroupManager(); - await audioVolumeGroupManager.getRingerMode().then((value) => { - console.info(`getRingerMode success and RingerMode is: ${value}.`); - }); - } - ``` - -3. (可选)查询、设置、监听麦克风状态。 - - 如果开发者需要获取、设置麦克风状态,或者监听麦克风状态变化等信息,可参考并调用以下接口。 - - ```js - import audio from '@ohos.multimedia.audio'; - async loadVolumeGroupManager() { - const groupid = audio.DEFAULT_VOLUME_GROUP_ID; - var audioVolumeGroupManager = await audio.getAudioManager().getVolumeManager().getVolumeGroupManager(groupid); - console.info('audioVolumeGroupManager create success.'); - } - - async on() { //监听麦克风状态变化 - await loadVolumeGroupManager(); - await audioVolumeGroupManager.audioVolumeGroupManager.on('micStateChange', (micStateChange) => { - console.info(`Current microphone status is: ${micStateChange.mute} `); - }); - } - - async isMicrophoneMute() { //查询麦克风是否静音 - await audioVolumeGroupManager.audioVolumeGroupManager.isMicrophoneMute().then((value) => { - console.info(`isMicrophoneMute is: ${value}.`); - }); - } - - async setMicrophoneMuteTrue() { //设置麦克风静音 - await loadVolumeGroupManager(); - await audioVolumeGroupManager.audioVolumeGroupManager.setMicrophoneMute(true).then(() => { - console.info('setMicrophoneMute to mute.'); - }); - } - - async setMicrophoneMuteFalse() { //取消麦克风静音 - await loadVolumeGroupManager(); - await audioVolumeGroupManager.audioVolumeGroupManager.setMicrophoneMute(false).then(() => { - console.info('setMicrophoneMute to not mute.'); - }); - } - async test(){ //综合调用:先设置监听,然后查询麦克风状态,设置麦克风静音后再查询状态,最后取消麦克风静音。 - await on(); - await isMicrophoneMute(); - await setMicrophoneMuteTrue(); - await isMicrophoneMute(); - await setMicrophoneMuteFalse(); - } - ``` - diff --git a/zh-cn/application-dev/media/av-overview.md b/zh-cn/application-dev/media/av-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..e69516b5c71aa873b4be350a65d5e0a78f434092 --- /dev/null +++ b/zh-cn/application-dev/media/av-overview.md @@ -0,0 +1,65 @@ +# 音视频概述 + +在音视频开发指导中,将介绍各种涉及音频、视频播放或录制功能场景的开发方式,指导开发者如何使用系统提供的音视频API实现对应功能。比如使用TonePlayer实现简单的提示音,当设备接收到新消息时,会发出短促的“滴滴”声;使用AVPlayer实现音乐播放器,循环播放一首音乐。 + +在每个功能中,会介绍多种实现方式以应对不同的使用场景,以及该场景相关的子功能点。比如在音频播放功能内,会同时介绍音频的并发策略、音量管理和输出设备等在操作系统中的处理方式,帮助开发者能够开发出功能覆盖更全面的应用。 + +本开发指导仅针对音视频播放或录制本身,由[@ohos.multimedia.audio](../reference/apis/js-apis-audio.md)(下文简称audio模块)和[@ohos.multimedia.media](../reference/apis/js-apis-media.md)(下文简称media模块)提供相关能力,不涉及UI界面、图形处理、媒体存储或其他相关领域功能。 + +## 开发说明 + +在开发音频功能之前,尤其是要实现处理音频数据的功能前,建议开发者先了解声学相关的知识,帮助理解操作系统提供的API是如何控制音频系统,从而开发出更易用、体验更好的音视频类应用。建议了解的相关概念包括但不限于: + +- 音频量化的过程:采样 > 量化 > 编码 + +- 音频量化过程的相关概念:模拟信号和数字信号、采样率、声道、采样格式、位宽、码率、常见编码格式(如AAC、MP3、PCM、WMA等)、常见封装格式(如WAV、MPA、FLAC、AAC、OGG等) + +在开发音乐、视频播放功能之前,建议了解流媒体播放的相关概念包括但不限于: + +- 播放过程:网络协议 > 容器格式 > 音视频编解码 > 图形/音频渲染 + +- 网络协议:比如HLS、HTTP/HTTPS;容器格式:比如mp4,mkv,mpeg-ts,webm。 + +- 编码格式:比如h263/h264/h265,MPEG4/MPEG2。 + +## 音频流介绍 + +在开发音频应用之前,还需要了解什么是音频流,它是OpenHarmony音频系统中的关键概念,在之后的章节中会多次提及。 + +音频流,是音频系统中对一个具备音频格式和音频使用场景信息的独立音频数据处理单元的定义,可以表示播放,也可以表示录制,并且具备独立音量调节和音频设备路由切换能力。 + +音频流基础信息通过[AudioStreamInfo](../reference/apis/js-apis-audio.md#audiostreaminfo8)表示,包含采样、声道、位宽、编码信息,是创建音频播放或录制流的必要参数,描述了音频数据的基本属性。在配置时开发者需要保证基础信息与传输的音频数据是相匹配的,音频系统才能正确处理数据。 + +### 音频流使用场景信息 + +除了基本属性,音频流还需要具备使用场景信息。基础信息只能对音频数据进行描述,但在实际的使用过程中,不同的音频流,在音量大小,设备路由,并发策略上是有区别的。系统就是通过音频流所附带的使用场景信息,为不同的音频流制定合适的处理策略,以达到最佳的音频用户体验。 + +- 播放场景 + 音频播放场景的信息,通过[StreamUsage](../reference/apis/js-apis-audio.md#streamusage)和[ContentType](../reference/apis/js-apis-audio.md#contenttype)进行描述。 + + StreamUsage指音频流本身的用途类型,包括媒体、语音通信、语音播报、通知、铃声等。 + + ContentType指音频流中数据的内容类型,包括语音、音乐、影视、通知、铃声等。 + +- 录制场景 + 音频流录制场景的信息,通过[SourceType](../reference/apis/js-apis-audio.md#sourcetype8)进行描述。 + + SourceType指音频流中录音源的类型,包括麦克风音频源、语音识别音频源、语音通话音频源等。 + +## 支持的音频格式 + +audio模块下的接口支持PCM编码,包括AudioRenderer、AudioCapturer、TonePlayer、OpenSL ES等。 + +音频格式说明: + +- 支持的常用的音频采样率(Hz):8000、11025、12000、16000、22050、24000、32000、44100、48000、64000、96000,具体参考枚举[AudioSamplingRate](../reference/apis/js-apis-audio.md#audiosamplingrate8)。 + 不同设备支持的采样率规格会存在差异。 + +- 支持单声道、双声道,具体参考[AudioChannel](../reference/apis/js-apis-audio.md#audiochannel8)。 + +- 支持的采样格式:U8(无符号8位整数)、S16LE(带符号的16位整数,小尾数)、S24LE(带符号的24位整数,小尾数)、S32LE(带符号的32位整数,小尾数)、F32LE(带符号的32位浮点数,小尾数),具体参考[AudioSampleFormat](../reference/apis/js-apis-audio.md#audiosampleformat8)。 + 由于系统限制,S24LE、S32LE、F32LE仅部分设备支持,请根据实际情况使用。 + + 小尾数指的是小端模式,即数据的高字节保存在内存的高地址中,而数据的低字节保存在内存的低地址中。这种存储模式将地址的高低和数据的位权有效结合起来,高地址部分权值高,低地址部分权值低。 + +media模块下的接口支持的音视频格式将在[AVPlayer和AVRecorder](avplayer-avrecorder-overview.md)的介绍中承载。 diff --git a/zh-cn/application-dev/media/avplayer-avrecorder-overview.md b/zh-cn/application-dev/media/avplayer-avrecorder-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..9bad52367caba377b345fd5632a696f69c4621d9 --- /dev/null +++ b/zh-cn/application-dev/media/avplayer-avrecorder-overview.md @@ -0,0 +1,148 @@ +# AVPlayer和AVRecorder + +media模块提供了[AVPlayer](#avplayer)和[AVRecorder](#avrecorder)用于播放、录制音视频。 + +## AVPlayer + +AVPlayer主要工作是将Audio/Video媒体资源(比如mp4/mp3/mkv/mpeg-ts等)转码为可供渲染的图像和可听见的音频模拟信号,并通过输出设备进行播放。 + +AVPlayer提供功能完善一体化播放能力,应用只需要提供流媒体来源,不负责数据解析和解码就可达成播放效果。 + + +### 音频播放 + +当使用AVPlayer开发音乐应用播放音频时,其交互关系如图所示。 + +**图1** 音频播放外部模块交互图   + +![Audio Playback Interaction Diagram](figures/audio-playback-interaction-diagram.png) + +音乐类应用通过调用JS接口层提供的AVPlayer接口实现相应功能时,框架层会通过播放服务(Player Framework)将资源解析成音频数据流(PCM),音频数据流经过软件解码后输出至音频服务(Audio Framework),由音频服务输出至音频驱动渲染,实现音频播放功能。完整的音频播放需要应用、Player Framework、Audio Framework、音频HDI共同实现。 + +图1中,数字标注表示需要数据与外部模块的传递。 + +1. 音乐应用将媒体资源传递给AVPlayer接口。 + +2. Player Framework将音频PCM数据流输出给Audio Framework,再由Audio Framework输出给音频HDI。 + +### 视频播放 + +当使用AVPlayer开发视频应用播放视频时,其交互关系如图所示。 + +**图2** 视频播放外部模块交互图   + +![Video playback interaction diagram](figures/video-playback-interaction-diagram.png) + +应用通过调用JS接口层提供的AVPlayer接口实现相应功能时,框架层会通过播放服务(Player Framework)解析成单独的音频数据流和视频数据流,音频数据流经过软件解码后输出至音频服务(Audio Framework),再至硬件接口层的音频HDI,实现音频播放功能。视频数据流经过硬件(推荐)/软件解码后输出至图形渲染服务(Graphic Framework),再输出至硬件接口层的显示HDI,完成图形渲染。 + +完整的视频播放需要:应用、XComponent、Player Framework、Graphic Framework、Audio Framework、显示HDI和音频HDI共同实现。 + +图2中,数字标注表示需要数据与外部模块的传递。 + +1. 应用从XComponent组件获取窗口SurfaceID,获取方式参考[XComponent](../reference/arkui-ts/ts-basic-components-xcomponent.md)。 + +2. 应用把媒体资源、SurfaceID传递给AVPlayer接口。 + +3. Player Framework把视频ES数据流输出给解码HDI,解码获得视频帧(NV12/NV21/RGBA)。 + +4. Player Framework把音频PCM数据流输出给Audio Framework,Audio Framework输出给音频HDI。 + +5. Player Framework把视频帧(NV12/NV21/RGBA)输出给Graphic Framework,Graphic Framework输出给显示HDI。 + +### 支持的格式与协议 + +推荐使用以下主流的播放格式,音视频容器、音视频编码属于内容创作者所掌握的专业领域,不建议应用开发者自制码流进行测试,以免产生无法播放、卡顿、花屏等兼容性问题。若发生此类问题不会影响系统,退出播放即可。 + +支持的协议如下: + +| 协议类型 | 协议描述 | +| -------- | -------- | +| 本地点播 | 协议格式:支持file descriptor,禁止file path | +| 网络点播 | 协议格式:支持http/https/hls | + +支持的音频播放格式如下: + +| 音频容器规格 | 规格描述 | +| -------- | -------- | +| m4a | 音频格式:AAC | +| aac | 音频格式:AAC | +| mp3 | 音频格式:MP3 | +| ogg | 音频格式:VORBIS | +| wav | 音频格式:PCM | + +> **说明:** +> +> 视频播放支持的视频格式分为必选规格和可选规格。必选规格为所有厂商均支持的视频格式。对于可选规格,厂商将基于实际情况决定是否实现。建议开发者做对应的兼容处理,保证应用功能全平台兼容。 + +| 视频格式 | 是否必选规格 | +| -------- | -------- | +| H264 | 是 | +| MPEG2 | 否 | +| MPEG4 | 否 | +| H263 | 否 | +| VP8 | 否 | + +支持的视频播放格式和主流分辨率如下: + +| 视频容器规格 | 规格描述 | 分辨率 | +| -------- | -------- | -------- | +| mp4 | 视频格式:H264/MPEG2/MPEG4/H263
音频格式:AAC/MP3 | 主流分辨率,如4K/1080P/720P/480P/270P | +| mkv | 视频格式:H264/MPEG2/MPEG4/H263
音频格式:AAC/MP3 | 主流分辨率,如4K/1080P/720P/480P/270P | +| ts | 视频格式:H264/MPEG2/MPEG4
音频格式:AAC/MP3 | 主流分辨率,如4K/1080P/720P/480P/270P | +| webm | 视频格式:VP8
音频格式:VORBIS | 主流分辨率,如4K/1080P/720P/480P/270P | + +## AVRecorder + +AVRecorder主要工作是捕获音频信号,接收视频信号,完成音视频编码并保存到文件中,帮助开发者轻松实现音视频录制功能,包括开始录制、暂停录制、恢复录制、停止录制、释放资源等功能控制。它允许调用者指定录制的编码格式、封装格式、文件路径等参数。 + +**图3** 视频录制外部模块交互图   + +![Video recording interaction diagram](figures/video-recording-interaction-diagram.png) + +- 音频录制:应用通过调用JS接口层提供的AVRecorder接口实现音频录制时,框架层会通过录制服务(Player Framework),调用音频服务(Audio Framework)通过音频HDI捕获音频数据,通过软件编码封装后保存至文件中,实现音频录制功能。 + +- 视频录制:应用通过调用JS接口层提供的AVRecorder接口实现视频录制时,先通过Camera接口调用相机服务(Camera Framework)通过视频HDI捕获图像数据送至框架层的录制服务,录制服务将图像数据通过视频编码HDI编码,再将编码后的图像数据封装至文件中,实现视频录制功能。 + +通过音视频录制组合,可分别实现纯音频录制、纯视频录制,音视频录制。 + +图3中,数字标注表示需要数据与外部模块的传递。 + +1. 应用通过AVRecorder接口从录制服务获取SurfaceID。 + +2. 应用将SurfaceID设置给相机服务,相机服务可以通过SurfaceID获取到Surface。相机服务通过视频HDI捕获图像数据送至框架层的录制服务。 + +3. 相机服务通过Surface将视频数据传递给录制服务。 + +4. 录制服务通过视频编码HDI模块将视频数据编码。 + +5. 录制服务将音频参数设置给音频服务,并从音频服务获取到音频数据。 + +### 支持的格式 + +支持的音频源如下: + +| 音频源类型 | 说明 | +| -------- | -------- | +| mic | 系统麦克风作为音频源输入。 | + +支持的视频源如下: + +| 视频源类型 | 说明 | +| -------- | -------- | +| surface_yuv | 输入surface中携带的是raw data。 | +| surface_es | 输入surface中携带的是ES data。 | + +支持的音视频编码格式如下: + +| 音视频编码格式 | 说明 | +| -------- | -------- | +| audio/mp4a-latm | 音频/mp4a-latm类型 | +| video/mp4v-es | 视频/mpeg4类型 | +| video/avc | 视频/avc类型 | + +支持的输出文件格式如下: + +| 输出文件格式 | 说明 | +| -------- | -------- | +| mp4 | 视频的容器格式,MP4。 | +| m4a | 音频的容器格式,M4A。 | diff --git a/zh-cn/application-dev/media/avplayer-playback.md b/zh-cn/application-dev/media/avplayer-playback.md deleted file mode 100644 index 950ccd19857cd5704b86d82828c522e45ddde4aa..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/media/avplayer-playback.md +++ /dev/null @@ -1,490 +0,0 @@ -# AVPlayer播放器开发指导 - -## 简介 - -AVPlayer主要工作是将Audio/Video媒体资源转码为可供渲染的图像和可听见的音频模拟信号,并通过输出设备进行播放,同时对播放任务进行管理,包括开始播放、暂停播放、停止播放、释放资源、设置音量、跳转播放位置、获取轨道信息等功能控制。 - -## 运作机制 - -该模块提供了播放状态变化示意图[AVPlayerState](../reference/apis/js-apis-media.md#avplayerstate9)、音频播放外部模块交互图和视频播放外部模块交互图。 - -**图1** 播放状态变化示意图 - -![zh-ch_image_avplayer_state_machine](figures/zh-ch_image_avplayer_state_machine.png) - - -**图2** 音频播放外部模块交互图 - -![zh-ch_image_avplayer_audio](figures/zh-ch_image_avplayer_audio.png) - -**说明**:应用通过调用JS接口层提供的AVPlayer js接口实现相应功能时,框架层会通过Player Framework的播放服务解析成音频数据流,音频数据流经过软件解码后输出至Audio Framework的音频服务,由音频子系统输出至硬件接口层的音频HDI,实现音频播放功能。完整的音乐播放器工作需要:应用(应用适配)、Player Framework、Audio Framework、Audio HDI(驱动适配)共同实现。 - -*注意:音频播放需要音频子系统配合* - -1. 应用把url传递给AVPlayer JS。 -2. 播放服务把音频PCM数据流输出给音频服务,音频服务输出给Audio HDI。 - - -**图3** 视频播放外部模块交互图 - -![zh-ch_image_avplayer_video](figures/zh-ch_image_avplayer_video.png) - -**说明**:应用通过调用JS接口层提供的AVPlayer js接口实现相应功能时,框架层会通过Player Framework的播放服务解析成单独的音频数据流和视频数据流,音频数据流经过软件解码后输出至Audio Framework的音频服务,由音频子系统输出至硬件接口层的音频HDI,实现音频播放功能。视频数据流经过硬件(推荐)/软件解码后输出至Graphic Framework的渲染服务(Renderer Service),由RS子系统输出至硬件接口层的显示HDI。完整的视频播放器工作需要:应用(应用适配)、XCompomemt组件、Player Framework、Graphic Framework、Audio Framework、Display HDI(驱动适配)和Audio HDI(驱动适配)共同实现。 - -*注意:视频播放需要显示、音频、解码等多个子系统配合。* - -1. 应用从Xcomponent组件获取surfaceID,[获取方式](../reference/arkui-ts/ts-basic-components-xcomponent.md)。 -2. 应用把url、surfaceID传递给AVPlayer JS。 -3. 播放服务把视频ES数据流输出给Codec HDI,解码获得视频帧(NV12/NV21/RGBA)。 -4. 播放服务把音频PCM数据流输出给音频服务,音频服务输出给Audio HDI。 -5. 播放服务把视频帧(NV12/NV21/RGBA)输出给RS服务,RS服务输出给Display HDI。 - -## 兼容性说明 - -推荐使用主流的播放格式和主流分辨率,不建议开发者自制非常或者异常码流,以免产生无法播放、卡住、花屏等兼容性问题。若发生此类问题不会影响系统,退出码流播放即可。 - -主流的播放格式和主流分辨率如下: - -| 视频容器规格 | 规格描述 | 分辨率 | -| :----------: | :-----------------------------------------------: | :--------------------------------: | -| mp4 | 视频格式:H264/MPEG2/MPEG4/H263 音频格式:AAC/MP3 | 主流分辨率,如1080P/720P/480P/270P | -| mkv | 视频格式:H264/MPEG2/MPEG4/H263 音频格式:AAC/MP3 | 主流分辨率,如1080P/720P/480P/270P | -| ts | 视频格式:H264/MPEG2/MPEG4 音频格式:AAC/MP3 | 主流分辨率,如1080P/720P/480P/270P | -| webm | 视频格式:VP8 音频格式:VORBIS | 主流分辨率,如1080P/720P/480P/270P | - -| 音频容器规格 | 规格描述 | -| :----------: | :----------: | -| m4a | 音频格式:AAC | -| aac | 音频格式:AAC | -| mp3 | 音频格式:MP3 | -| ogg | 音频格式:VORBIS | -| wav | 音频格式:PCM | - -## 开发指导 - -详细API含义可参考:[媒体服务API文档AVPlayer](../reference/apis/js-apis-media.md#avplayer9) - -### 播放流程说明 - -播放的全流程场景包含:创建实例,设置资源,设置窗口(视频),准备播放(获取轨道信息/音量/倍速/焦点模式/缩放模式/设置bitrates),播控(播放/暂停/Seek/音量/停止),重置资源,销毁播放 - -1:创建实例[createAVPlayer()](../reference/apis/js-apis-media.md#mediacreateavplayer9),AVPlayer初始化[idle](#avplayer_state)状态 - -2:设置业务需要的监听事件,搭配全流程场景使用 - -3:设置资源 [url](../reference/apis/js-apis-media.md#avplayer_属性),AVPlayer进入[initialized](#avplayer_state)状态,此时可以设置视频窗口 [surfaceId](../reference/apis/js-apis-media.md#avplayer_属性),支持的规格可参考:[AVPlayer属性说明](../reference/apis/js-apis-media.md#avplayer_属性) - -4:准备播放 [prepare()](../reference/apis/js-apis-media.md#avplayer_prepare),AVPlayer进入[prepared](#avplayer_state)状态 - -5:视频播控:播放 [play()](../reference/apis/js-apis-media.md#avplayer_play),暂停 [pause()](../reference/apis/js-apis-media.md#avplayer_pause),跳转 [seek()](../reference/apis/js-apis-media.md#avplayer_seek),停止 [stop()](../reference/apis/js-apis-media.md#avplayer_stop) 等操作 - -6:重置资源 [reset()](../reference/apis/js-apis-media.md#avplayer_reset),AVPlayer重新进入[idle](#avplayer_state)状态,允许更换资源 [url](../reference/apis/js-apis-media.md#avplayer_属性) - -7:销毁播放 [release()](../reference/apis/js-apis-media.md#avplayer_release),AVPlayer进入[released](#avplayer_state)状态,退出播放 - -> **说明:** -> -> prepared/playing/paused/compeled 状态时,播放引擎处于工作状态,这需要占用系统较多的运行内存,当客户端暂时不使用播放器时,要求调用 reset() 或 release() 回收。 - -### 监听事件 - -| 事件类型 | 说明 | -| ------------------------------------------------- | ------------------------------------------------------------ | -| stateChange | 必要事件,监听播放器的状态机 | -| error | 必要事件,监听播放器的错误信息 | -| durationUpdate | 用于进度条,监听进度条长度,刷新资源时长 | -| timeUpdate | 用于进度条,监听进度条当前位置,刷新当前时间 | -| seekDone | 响应api调用,监听seek()请求完成情况 | -| speedDone | 响应api调用,监听setSpeed()请求完成情况 | -| volumeChange | 响应api调用,监听setVolume()请求完成情况 | -| bitrateDone | 响应api调用,用于HLS协议流,监听setBitrate()请求完成情况 | -| availableBitrates | 用于HLS协议流,监听HLS资源的可选bitrates,用于setBitrate() | -| bufferingUpdate | 用于网络播放,监听网络播放缓冲信息 | -| startRenderFrame | 用于视频播放,监听视频播放首帧渲染时间 | -| videoSizeChange | 用于视频播放,监听视频播放的宽高信息,可用于调整窗口大小、比例 | -| audioInterrupt | 用于视频播放,监听音频焦点切换信息,搭配属性audioInterruptMode使用 | - -### - -### 全量接口示例 - -```js -import media from '@ohos.multimedia.media' -import audio from '@ohos.multimedia.audio'; -import fs from '@ohos.file.fs' - -const TAG = 'AVPlayerDemo:' -export class AVPlayerDemo { - private count:number = 0 - private avPlayer - private surfaceID:string // surfaceID用于播放画面显示,具体的值需要通过Xcomponent接口获取,相关文档链接见上面Xcomponent创建方法 - - // 注册avplayer回调函数 - setAVPlayerCallback() { - // 状态机变化回调函数 - this.avPlayer.on('stateChange', async (state, reason) => { - switch (state) { - case 'idle': // 成功调用reset接口后触发该状态机上报 - console.info(TAG + 'state idle called') - this.avPlayer.release() // 释放avplayer对象 - break; - case 'initialized': // avplayer 设置播放源后触发该状态上报 - console.info(TAG + 'state initialized called ') - this.avPlayer.surfaceId = this.surfaceID // 设置显示画面,当播放的资源为纯音频时无需设置 - this.avPlayer.prepare().then(() => { - console.info(TAG+ 'prepare success'); - }, (err) => { - console.error(TAG + 'prepare filed,error message is :' + err.message) - }) - break; - case 'prepared': // prepare调用成功后上报该状态机 - console.info(TAG + 'state prepared called') - this.avPlayer.play() // 调用播放接口开始播放 - break; - case 'playing': // play成功调用后触发该状态机上报 - console.info(TAG + 'state playing called') - if (this.count == 0) { - this.avPlayer.pause() // 调用暂停播放接口 - } else { - this.avPlayer.seek(10000, media.SeekMode.SEEK_PREV_SYNC) // 前向seek置10秒处,触发seekDone回调函数 - } - break; - case 'paused': // pause成功调用后触发该状态机上报 - console.info(TAG + 'state paused called') - if (this.count == 0) { - this.count++ - this.avPlayer.play() // 继续调用播放接口开始播放 - } - break; - case 'completed': // 播放结束后触发该状态机上报 - console.info(TAG + 'state completed called') - this.avPlayer.stop() //调用播放结束接口 - break; - case 'stopped': // stop接口成功调用后触发该状态机上报 - console.info(TAG + 'state stopped called') - this.avPlayer.reset() // 调用reset接口初始化avplayer状态 - break; - case 'released': - console.info(TAG + 'state released called') - break; - case 'error': - console.info(TAG + 'state error called') - break; - default: - console.info(TAG + 'unkown state :' + state) - break; - } - }) - // 时间上报监听函数 - this.avPlayer.on('timeUpdate', (time:number) => { - console.info(TAG + 'timeUpdate success,and new time is :' + time) - }) - // 音量变化回调函数 - this.avPlayer.on('volumeChange', (vol:number) => { - console.info(TAG + 'volumeChange success,and new volume is :' + vol) - this.avPlayer.setSpeed(media.AVPlayerSpeed.SPEED_FORWARD_2_00_X) // 设置两倍速播放,并触发speedDone回调 - }) - // 视频播放结束触发回调 - this.avPlayer.on('endOfStream', () => { - console.info(TAG + 'endOfStream success') - }) - // seek操作回调函数 - this.avPlayer.on('seekDone', (seekDoneTime:number) => { - console.info(TAG + 'seekDone success,and seek time is:' + seekDoneTime) - this.avPlayer.setVolume(0.5) // 设置音量为0.5,并触发volumeChange回调函数 - }) - // 设置倍速播放回调函数 - this.avPlayer.on('speedDone', (speed:number) => { - console.info(TAG + 'speedDone success,and speed value is:' + speed) - }) - // bitrate设置成功回调函数 - this.avPlayer.on('bitrateDone', (bitrate:number) => { - console.info(TAG + 'bitrateDone success,and bitrate value is:' + bitrate) - }) - // 缓冲上报回调函数 - this.avPlayer.on('bufferingUpdate', (infoType: media.BufferingInfoType, value: number) => { - console.info(TAG + 'bufferingUpdate success,and infoType value is:' + infoType + ', value is :' + value) - }) - // 首帧上报回调函数 - this.avPlayer.on('startRenderFrame', () => { - console.info(TAG + 'startRenderFrame success') - }) - // 视频宽高上报回调函数 - this.avPlayer.on('videoSizeChange', (width: number, height: number) => { - console.info(TAG + 'videoSizeChange success,and width is:' + width + ', height is :' + height) - }) - // 焦点上报回调函数 - this.avPlayer.on('audioInterrupt', (info: audio.InterruptEvent) => { - console.info(TAG + 'audioInterrupt success,and InterruptEvent info is:' + info) - }) - // HLS上报所有支持的比特率 - this.avPlayer.on('availableBitrates', (bitrates: Array) => { - console.info(TAG + 'availableBitrates success,and availableBitrates length is:' + bitrates.length) - }) - } - - async avPlayerDemo() { - // 创建avPlayer实例对象 - this.avPlayer = await media.createAVPlayer() - let fdPath = 'fd://' - let pathDir = "/data/storage/el2/base/haps/entry/files" // pathDir在FA模型和Stage模型的获取方式不同,请参考开发步骤首行的说明,根据实际情况自行获取。 - // path路径的码流可通过"hdc file send D:\xxx\H264_AAC.mp4 /data/app/el2/100/base/ohos.acts.multimedia.media.avplayer/haps/entry/files" 命令,将其推送到设备上 - let path = pathDir + '/H264_AAC.mp4' - let file = await fs.open(path) - fdPath = fdPath + '' + file.fd - this.avPlayer.url = fdPath - } -} -``` - -### 正常播放场景 - -```js -import media from '@ohos.multimedia.media' -import fs from '@ohos.file.fs' - -const TAG = 'AVPlayerDemo:' -export class AVPlayerDemo { - private avPlayer - private surfaceID:string // surfaceID用于播放画面显示,具体的值需要通过Xcomponent接口获取,相关文档链接见上面Xcomponent创建方法 - - // 注册avplayer回调函数 - setAVPlayerCallback() { - // 状态机变化回调函数 - this.avPlayer.on('stateChange', async (state, reason) => { - switch (state) { - case 'idle': // 成功调用reset接口后触发该状态机上报 - console.info(TAG + 'state idle called') - break; - case 'initialized': // avplayer 设置播放源后触发该状态上报 - console.info(TAG + 'state initialized called ') - this.avPlayer.surfaceId = this.surfaceID // 设置显示画面,当播放的资源为纯音频时无需设置 - this.avPlayer.prepare().then(() => { - console.info(TAG+ 'prepare success'); - }, (err) => { - console.error(TAG + 'prepare filed,error message is :' + err.message) - }) - break; - case 'prepared': // prepare调用成功后上报该状态机 - console.info(TAG + 'state prepared called') - this.avPlayer.play() // 调用播放接口开始播放 - break; - case 'playing': // play成功调用后触发该状态机上报 - console.info(TAG + 'state playing called') - break; - case 'paused': // pause成功调用后触发该状态机上报 - console.info(TAG + 'state paused called') - break; - case 'completed': // 播放结束后触发该状态机上报 - console.info(TAG + 'state completed called') - this.avPlayer.stop() //调用播放结束接口 - break; - case 'stopped': // stop接口成功调用后触发该状态机上报 - console.info(TAG + 'state stopped called') - this.avPlayer.release() // 调用reset接口初始化avplayer状态 - break; - case 'released': - console.info(TAG + 'state released called') - break; - case 'error': - console.info(TAG + 'state error called') - break; - default: - console.info(TAG + 'unkown state :' + state) - break; - } - }) - } - - async avPlayerDemo() { - // 创建avPlayer实例对象 - this.avPlayer = await media.createAVPlayer() - let fdPath = 'fd://' - let pathDir = "/data/storage/el2/base/haps/entry/files" // pathDir在FA模型和Stage模型的获取方式不同,请参考开发步骤首行的说明,根据实际情况自行获取。 - // path路径的码流可通过"hdc file send D:\xxx\H264_AAC.mp4 /data/app/el2/100/base/ohos.acts.multimedia.media.avplayer/haps/entry/files" 命令,将其推送到设备上 - let path = pathDir + '/H264_AAC.mp4' - let file = await fs.open(path) - fdPath = fdPath + '' + file.fd - this.avPlayer.url = fdPath - } -} -``` - -### 单曲循环场景 - -```js -import media from '@ohos.multimedia.media' -import fs from '@ohos.file.fs' - -const TAG = 'AVPlayerDemo:' -export class AVPlayerDemo { - private count:number = 0 - private avPlayer - private surfaceID:string // surfaceID用于播放画面显示,具体的值需要通过Xcomponent接口获取,相关文档链接见上面Xcomponent创建方法 - - // 注册avplayer回调函数 - setAVPlayerCallback() { - // 状态机变化回调函数 - this.avPlayer.on('stateChange', async (state, reason) => { - switch (state) { - case 'idle': // 成功调用reset接口后触发该状态机上报 - console.info(TAG + 'state idle called') - break; - case 'initialized': // avplayer 设置播放源后触发该状态上报 - console.info(TAG + 'state initialized called ') - this.avPlayer.surfaceId = this.surfaceID // 设置显示画面,当播放的资源为纯音频时无需设置 - this.avPlayer.prepare().then(() => { - console.info(TAG+ 'prepare success'); - }, (err) => { - console.error(TAG + 'prepare filed,error message is :' + err.message) - }) - break; - case 'prepared': // prepare调用成功后上报该状态机 - console.info(TAG + 'state prepared called') - this.avPlayer.loop = true // 设置单曲循环播放,单曲循环播放至结尾后会触发endOfStream回调 - this.avPlayer.play() // 调用播放接口开始播放 - break; - case 'playing': // play成功调用后触发该状态机上报 - console.info(TAG + 'state playing called') - break; - case 'paused': // pause成功调用后触发该状态机上报 - console.info(TAG + 'state paused called') - break; - case 'completed': // 播放结束后触发该状态机上报 - console.info(TAG + 'state completed called') - // 当第二次触发endOfStream回调后取消循环播放,再次播放到结尾后触发completed状态机上报 - this.avPlayer.stop() //调用播放结束接口 - break; - case 'stopped': // stop接口成功调用后触发该状态机上报 - console.info(TAG + 'state stopped called') - this.avPlayer.release() // 调用reset接口初始化avplayer状态 - break; - case 'released': - console.info(TAG + 'state released called') - break; - case 'error': - console.info(TAG + 'state error called') - break; - default: - console.info(TAG + 'unkown state :' + state) - break; - } - }) - // 视频播放结束触发回调 - this.avPlayer.on('endOfStream', () => { - console.info(TAG + 'endOfStream success') - if (this.count == 1) { - this.avPlayer.loop = false // 取消循环播放 - } else { - this.count++ - } - }) - } - - async avPlayerDemo() { - // 创建avPlayer实例对象 - this.avPlayer = await media.createAVPlayer() - let fdPath = 'fd://' - let pathDir = "/data/storage/el2/base/haps/entry/files" // pathDir在FA模型和Stage模型的获取方式不同,请参考开发步骤首行的说明,根据实际情况自行获取。 - // path路径的码流可通过"hdc file send D:\xxx\H264_AAC.mp4 /data/app/el2/100/base/ohos.acts.multimedia.media.avplayer/haps/entry/files" 命令,将其推送到设备上 - let path = pathDir + '/H264_AAC.mp4' - let file = await fs.open(path) - fdPath = fdPath + '' + file.fd - this.avPlayer.url = fdPath - } -} -``` -### 视频切换场景 - -```js -import media from '@ohos.multimedia.media' -import fs from '@ohos.file.fs' - -const TAG = 'AVPlayerDemo:' -export class AVPlayerDemo { - private count:number = 0 - private avPlayer - private surfaceID:string // surfaceID用于播放画面显示,具体的值需要通过Xcomponent接口获取,相关文档链接见上面Xcomponent创建方法 - - async nextVideo() { - let fdPath = 'fd://' - let pathDir = "/data/storage/el2/base/haps/entry/files" // pathDir在FA模型和Stage模型的获取方式不同,请参考开发步骤首行的说明,根据实际情况自行获取。 - // path路径的码流可通过"hdc file send D:\xxx\H264_MP3.mp4 /data/app/el2/100/base/ohos.acts.multimedia.media.avplayer/haps/entry/files" 命令,将其推送到设备上 - let path = pathDir + '/H264_MP3.mp4' - let file = await fs.open(path) - fdPath = fdPath + '' + file.fd - this.avPlayer.url = fdPath // 再次触发initialized状态机上报 - } - - // 注册avplayer回调函数 - setAVPlayerCallback() { - // 状态机变化回调函数 - this.avPlayer.on('stateChange', async (state, reason) => { - switch (state) { - case 'idle': // 成功调用reset接口后触发该状态机上报 - console.info(TAG + 'state idle called') - await this.nextVideo() // 切换下一个视频播放 - break; - case 'initialized': // avplayer 设置播放源后触发该状态上报 - console.info(TAG + 'state initialized called ') - this.avPlayer.surfaceId = this.surfaceID // 设置显示画面,当播放的资源为纯音频时无需设置 - this.avPlayer.prepare().then(() => { - console.info(TAG+ 'prepare success'); - }, (err) => { - console.error(TAG + 'prepare filed,error message is :' + err.message) - }) - break; - case 'prepared': // prepare调用成功后上报该状态机 - console.info(TAG + 'state prepared called') - this.avPlayer.play() // 调用播放接口开始播放 - break; - case 'playing': // play成功调用后触发该状态机上报 - console.info(TAG + 'state playing called') - break; - case 'paused': // pause成功调用后触发该状态机上报 - console.info(TAG + 'state paused called') - break; - case 'completed': // 播放结束后触发该状态机上报 - console.info(TAG + 'state completed called') - if (this.count == 0) { - this.count++ - this.avPlayer.reset() //调用重置接口准备切换下一个视频 - } else { - this.avPlayer.release() //切换视频后播放至结尾释放avplayer对象 - } - break; - case 'stopped': // stop接口成功调用后触发该状态机上报 - console.info(TAG + 'state stopped called') - break; - case 'released': - console.info(TAG + 'state released called') - break; - case 'error': - console.info(TAG + 'state error called') - break; - default: - console.info(TAG + 'unkown state :' + state) - break; - } - }) - } - - async avPlayerDemo() { - // 创建avPlayer实例对象 - this.avPlayer = await media.createAVPlayer() - let fdPath = 'fd://' - let pathDir = "/data/storage/el2/base/haps/entry/files" // pathDir在FA模型和Stage模型的获取方式不同,请参考开发步骤首行的说明,根据实际情况自行获取。 - // path路径的码流可通过"hdc file send D:\xxx\H264_AAC.mp4 /data/app/el2/100/base/ohos.acts.multimedia.media.avplayer/haps/entry/files" 命令,将其推送到设备上 - let path = pathDir + '/H264_AAC.mp4' - let file = await fs.open(path) - fdPath = fdPath + '' + file.fd - this.avPlayer.url = fdPath - } -} -``` - -## 相关示例 - -针对AVPlayer播放器开发,有以下相关示例可供参考: - -待补充 \ No newline at end of file diff --git a/zh-cn/application-dev/media/avrecorder.md b/zh-cn/application-dev/media/avrecorder.md deleted file mode 100644 index 3cee29c0291e18d417b32fa1ec1a41871f56fd09..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/media/avrecorder.md +++ /dev/null @@ -1,490 +0,0 @@ -# 音视频录制开发指导 - -## 简介 - -音视频录制的主要工作是捕获音频信号,接收视频信号,完成音视频编码并保存到文件中,帮助开发者轻松实现音视频录制功能,包括开始录制、暂停录制、恢复录制、停止录制、释放资源等功能控制。它允许调用者指定录制的编码格式、封装格式、文件路径等参数。 - -## 运作机制 - -该模块提供了音视频录制状态变化示意图和音视频录制外部模块交互图。 - -**图1** 音视频录制状态变化示意图 - -![zh-ch_image_video_recorder_state_machine](figures/zh-ch_image_avrecorder_state_machine.png) - -**图2** 视频录制外部模块交互图--待修改 - -![zh-ch_image_video_recorder_zero](figures/zh-ch_image_avrecorder_module_interaction.png) - -**说明**:音频录制时,框架层会通过Native Framework的媒体服务,调用音频子系统通过音频HDI捕获音频数据,通过软件编码封装后保存至文件中,实现音频录制功能。视频录制时,由相机子系统通过视频HDI捕获图像数据,媒体服务将图像数据通过视频编码HDI编码,再将编码后的图像数据封装至文件中,实现视频录制功能。通过音视频录制组合,可分别实现纯音频录制、纯视频录制,音视频录制。 - -## 约束与限制 - -开发者在进行录制功能开发前,需要先对所开发的应用配置相应权限。涉及音频录制,需要获取麦克风权限(ohos.permission.MICROPHONE),权限配置相关内容可参考:[访问控制权限申请指导](../security/accesstoken-guidelines.md)。 - -使用相机进行视频录制还需要与相机模块配合,接口使用以及权限获取详见[相机管理](../reference/apis/js-apis-camera.md)。 - -## 开发指导 - -详细API含义可参考:[媒体服务API文档AVRecorder](../reference/apis/js-apis-media.md#avrecorder9) - -媒体库相关流程含义可参考:[媒体库管理](../reference/apis/js-apis-medialibrary.md) - -相机相关流程含义可参考:[相机管理](../reference/apis/js-apis-camera.md) - -### 音视频录制全流程场景 - -音视频录制全流程场景包含:创建实例、设置录制参数、获取输入surface、开始录制、暂停录制、恢复录制、停止录制、释放资源等流程。 - -音频录制相关配置参数范围,受到设备编解码性能,音频子系统性能等综合限制。 - -视频录制相关配置参数范围,受到设备编解码性能,相机子系统性能等综合限制。 - -``` -import media from '@ohos.multimedia.media' -import camera from '@ohos.multimedia.camera' -import mediaLibrary from '@ohos.multimedia.mediaLibrary' - -export class AVRecorderDemo { - private testFdNumber; // 用于保存fd地址 - - // 获取录制的音频文件fileName对应的fd,需借助媒体库能力。使用mediaLibrary需要添加以下权限, ohos.permission.MEDIA_LOCATION、ohos.permission.WRITE_MEDIA、ohos.permission.READ_MEDIA. - async getFd(fileName) { - // 实现方式参考媒体库资料文档。 - this.testFdNumber = "fd://" + fdNumber.toString(); // e.g. fd://54 - } - - // 当promise接口发生错误上上报的错误回调接口 - failureCallback(error) { - console.info('error happened, error message is ' + error.message); - } - - // 当promise接口发生异常时,系统调用的错误回调接口 - catchCallback(error) { - console.info('catch error happened, error message is ' + error.message); - } - - async AVRecorderDemo() { - let AVRecorder; // AVRecorder空对象在createAVRecorder成功后赋值 - let surfaceID; // 从getInputSurface获取surfaceID,传递给相机的videoOutput - await this.getFd('01.mp4'); - - // 音视频录制相关参数配置,配置参数以实际硬件设备支持的范围为准 - let avProfile = { - audioBitrate : 48000, - audioChannels : 2, - audioCodec : media.CodecMimeType.AUDIO_AAC, - audioSampleRate : 48000, - fileFormat : media.ContainerFormatType.CFT_MPEG_4, - videoBitrate : 2000000, - videoCodec : media.CodecMimeType.VIDEO_MPEG4, - videoFrameWidth : 640, - videoFrameHeight : 480, - videoFrameRate : 30 - } - let avConfig = { - audioSourceType : media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC, - videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV, - profile : avProfile, - url : 'fd://', - rotation : 0, - location : { latitude : 30, longitude : 130 } - } - - // 创建AVRecorder对象 - await media.createAVRecorder().then((recorder) => { - console.info('case createAVRecorder called'); - if (typeof (recorder) != 'undefined') { - AVRecorder = recorder; - console.info('createAVRecorder success'); - } else { - console.info('createAVRecorder failed'); - } - }, this.failureCallback).catch(this.catchCallback); - - // 对象创建成功后创建on('stateChange')和on('error')监听回调用于监听状态机变化和错误上报 - AVRecorder.on('stateChange', async (state, reason) => { - console.info('case state has changed, new state is :' + state); - switch (state) { - // 用户可以根据需求在不同状态设置自己想要进行的行为 - case 'idle': - // 调用rest接口后触发idle状态;create后也在idle状态 - break; - case 'prepared': - // 调用prepare接口后触发prepared状态; - break; - case 'started': - // 调用start接口后触发started状态; - break; - case 'paused': - // 调用pause接口后触发paused状态; - break; - case 'stopped': - // 调用stop接口后触发stopped状态; - break; - case 'released': - // 调用release接口后触发released状态; - break; - case 'error': - // error状态说明底层出错,用户需排查错误,重新创建avRecorder; - break; - default: - console.info('case state is unknown'); - } - }); - AVRecorder.on('error', (err) => { - // 监听非接口类错误上报 - console.info('case avRecorder.on(error) called, errMessage is ' + err.message); - }); - - // 调用prepare完成音频录制前的准备工作;底层实际是根据prepare的入参来判断是音频录制、视频录制还是音视频录制 - await AVRecorder.prepare(avConfig).then(() => { - console.info('prepare success'); - }, this.failureCallback).catch(this.catchCallback); - - // 包含视频的录制需要调用getInputSurface接口,并将返回值surfaceID传递给camera相关接口 - await AVRecorder.getInputSurface().then((surface) => { - console.info('getInputSurface success'); - surfaceID = surface; // surfaceID给camera的createVideoOutput()作为其中的一个入参 - }, this.failureCallback).catch(this.catchCallback); - - // 视频录制依赖相机相关接口,以下需要先调用相机起流接口后才能继续执行,具体的相机接口调用请参考sample用例 - // 视频录制启动接口 - await AVRecorder.start().then(() => { - console.info('start success'); - }, this.failureCallback).catch(this.catchCallback); - - // 调用pause接口时需要暂停camera出流 - await AVRecorder.pause().then(() => { - console.info('pause success'); - }, this.failureCallback).catch(this.catchCallback); - - // 调用resume接口时需要恢复camera出流 - await AVRecorder.resume().then(() => { - console.info('resume success'); - }, this.failureCallback).catch(this.catchCallback); - - // 停止camera出流后,停止视频录制 - await AVRecorder.stop().then(() => { - console.info('stop success'); - }, this.failureCallback).catch(this.catchCallback); - - // 重置录制相关配置 - await AVRecorder.reset().then(() => { - console.info('reset success'); - }, this.failureCallback).catch(this.catchCallback); - - // 关闭监听回调,如果用户不自行调用off接口,在调用release后,设置的回调接口也会无效 - AVRecorder.off('stateChange'); - AVRecorder.off('error'); - - // 释放视频录制相关资源并释放camera对象相关资源 - await AVRecorder.release().then(() => { - console.info('release success'); - }, this.failureCallback).catch(this.catchCallback); - - // 相关对象置null - AVRecorder = undefined; - surfaceID = undefined; - } -} -``` - -### 纯音频录制全流程场景 - -纯音频录制全流程场景包含:创建实例、设置录制参数、开始录制、暂停录制、恢复录制、停止录制、释放资源等流程。 - -音频录制相关配置参数范围,受到设备编解码性能,音频子系统性能等综合限制。 - -``` -import media from '@ohos.multimedia.media' -import mediaLibrary from '@ohos.multimedia.mediaLibrary' - -export class AudioRecorderDemo { - private testFdNumber; // 用于保存fd地址 - - // 获取录制的音频文件fileName对应的fd,需借助媒体库能力。使用mediaLibrary需要添加以下权限, ohos.permission.MEDIA_LOCATION、ohos.permission.WRITE_MEDIA、ohos.permission.READ_MEDIA - async getFd(fileName) { - // 实现方式参考媒体库资料文档。 - this.testFdNumber = "fd://" + fdNumber.toString(); // e.g. fd://54 - } - - // 当promise接口发生错误上报的错误回调接口 - failureCallback(error) { - console.info('error happened, error message is ' + error.message); - } - - // 当promise接口发生异常时,系统调用的错误回调接口 - catchCallback(error) { - console.info('catch error happened, error message is ' + error.message); - } - - async audioRecorderDemo() { - let audioRecorder; // audioRecorder空对象在createAVRecorder成功后赋值 - await this.getFd('01.m4a'); - // 音频录制相关参数配置 - let audioProfile = { - audioBitrate : 48000, - audioChannels : 2, - audioCodec : media.CodecMimeType.AUDIO_AAC, - audioSampleRate : 48000, - fileFormat : media.ContainerFormatType.CFT_MPEG_4, - } - let audioConfig = { - audioSourceType : media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC, - profile : audioProfile, - url : this.testFdNumber, - rotation : 0, - location : { latitude : 30, longitude : 130 } - } - - // 创建audioRecorder对象 - await media.createAVRecorder().then((recorder) => { - console.info('case createAVRecorder called'); - if (typeof (recorder) != 'undefined') { - audioRecorder = recorder; - console.info('createAudioRecorder success'); - } else { - console.info('createAudioRecorder failed'); - } - }, this.failureCallback).catch(this.catchCallback); - - // 对象创建成功后创建on('stateChange')和on('error')监听回调用于监听状态机变化和错误上报 - audioRecorder.on('stateChange', async (state, reason) => { - console.info('case state has changed, new state is :' + state); - switch (state) { - // 用户可以根据需求在不同状态设置自己想要进行的行为 - case 'idle': - // 调用rest接口后触发idle状态;create后也在idle状态 - break; - case 'prepared': - // 调用prepare接口后触发prepared状态; - break; - case 'started': - // 调用start接口后触发started状态; - break; - case 'paused': - // 调用pause接口后触发paused状态; - break; - case 'stopped': - // 调用stop接口后触发stopped状态; - break; - case 'released': - // 调用release接口后触发released状态; - break; - case 'error': - // error状态说明底层出错,用户需排查错误,重新创建avRecorder; - break; - default: - console.info('case state is unknown'); - } - }); - audioRecorder.on('error', (err) => { - // 监听非接口类错误上报 - console.info('case avRecorder.on(error) called, errMessage is ' + err.message); - }); - - // 调用prepare完成音频录制前的准备工作;底层实际是根据prepare的入参来判断是音频录制、视频录制还是音视频录制 - await audioRecorder.prepare(audioConfig).then(() => { - console.info('prepare success'); - }, this.failureCallback).catch(this.catchCallback); - - // 调用start接口启动音频录制 - await audioRecorder.start().then(() => { - console.info('start success'); - }, this.failureCallback).catch(this.catchCallback); - - // 调用pause接口暂停音频录制 - await audioRecorder.pause().then(() => { - console.info('pause success'); - }, this.failureCallback).catch(this.catchCallback); - - // 调用resume接口恢复音频录制 - await audioRecorder.resume().then(() => { - console.info('resume success'); - }, this.failureCallback).catch(this.catchCallback); - - // 调用stop接口停止音频录制 - await audioRecorder.stop().then(() => { - console.info('stop success'); - }, this.failureCallback).catch(this.catchCallback); - - // 调用reset接口重置录制相关配置 - await audioRecorder.reset().then(() => { - console.info('reset success'); - }, this.failureCallback).catch(this.catchCallback); - - // 关闭监听回调,如果用户不自行调用off接口,在调用release后,设置的回调接口也会无效 - avRecorder.off('stateChange'); - avRecorder.off('error'); - - // 调用release接口释放音频录制相关资源 - await audioRecorder.release().then(() => { - console.info('release success'); - }, this.failureCallback).catch(this.catchCallback); - - // 相关对象置null - audioRecorder = undefined; - } -} - -``` - -### 纯视频录制全流程场景 - -纯视频录制全流程场景包含:创建实例、设置录制参数、获取输入surface、开始录制、暂停录制、恢复录制、停止录制、释放资源等流程。 - -视频录制相关配置参数范围,受到设备编解码性能,相机子系统性能等综合限制。 - -``` -import media from '@ohos.multimedia.media' -import camera from '@ohos.multimedia.camera' -import mediaLibrary from '@ohos.multimedia.mediaLibrary' - -export class VideoRecorderDemo { - private testFdNumber; // 用于保存fd地址 - - // 获取录制的音频文件fileName对应的fd,需借助媒体库能力。使用mediaLibrary需要添加以下权限, ohos.permission.MEDIA_LOCATION、ohos.permission.WRITE_MEDIA、ohos.permission.READ_MEDIA. - async getFd(fileName) { - // 实现方式参考媒体库资料文档。 - this.testFdNumber = "fd://" + fdNumber.toString(); // e.g. fd://54 - } - - // 当promise接口发生错误上上报的错误回调接口 - failureCallback(error) { - console.info('error happened, error message is ' + error.message); - } - - // 当promise接口发生异常时,系统调用的错误回调接口 - catchCallback(error) { - console.info('catch error happened, error message is ' + error.message); - } - - async videoRecorderDemo() { - let videoRecorder; // videoRecorder空对象在createAVRecorder成功后赋值 - let surfaceID; // 从getInputSurface获取surfaceID,传递给相机的videoOutput - await this.getFd('01.mp4'); - - // 纯视频录制相关参数配置,配置参数以实际硬件设备支持的范围为准 - let videoProfile = { - fileFormat : media.ContainerFormatType.CFT_MPEG_4, - videoBitrate : 2000000, - videoCodec : media.CodecMimeType.VIDEO_MPEG4, - videoFrameWidth : 640, - videoFrameHeight : 480, - videoFrameRate : 30 - } - let videoConfig = { - videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV, - profile : videoProfile, - url : 'fd://', - rotation : 0, - location : { latitude : 30, longitude : 130 } - } - - // 创建videoRecorder对象 - await media.createAVRecorder().then((recorder) => { - console.info('case createVideoRecorder called'); - if (typeof (recorder) != 'undefined') { - videoRecorder = recorder; - console.info('createVideoRecorder success'); - } else { - console.info('createVideoRecorder failed'); - } - }, this.failureCallback).catch(this.catchCallback); - - // 对象创建成功后创建on('stateChange')和on('error')监听回调用于监听状态机变化和错误上报 - videoRecorder.on('stateChange', async (state, reason) => { - console.info('case state has changed, new state is :' + state); - switch (state) { - // 用户可以根据需求在不同状态设置自己想要进行的行为 - case 'idle': - // 调用rest接口后触发idle状态;create后也在idle状态 - break; - case 'prepared': - // 调用prepare接口后触发prepared状态; - break; - case 'started': - // 调用start接口后触发started状态; - break; - case 'paused': - // 调用pause接口后触发paused状态; - break; - case 'stopped': - // 调用stop接口后触发stopped状态; - break; - case 'released': - // 调用release接口后触发released状态; - break; - case 'error': - // error状态说明底层出错,用户需排查错误,重新创建avRecorder; - break; - default: - console.info('case state is unknown'); - } - }); - videoRecorder.on('error', (err) => { - // 监听非接口类错误上报 - console.info('case avRecorder.on(error) called, errMessage is ' + err.message); - }); - - // 调用prepare完成音频录制前的准备工作;底层实际是根据prepare的入参来判断是音频录制、视频录制还是音视频录制 - await videoRecorder.prepare(videoConfig).then(() => { - console.info('prepare success'); - }, this.failureCallback).catch(this.catchCallback); - - // 包含视频的录制需要调用getInputSurface接口,并将返回值surfaceID传递给camera相关接口 - await videoRecorder.getInputSurface().then((surface) => { - console.info('getInputSurface success'); - surfaceID = surface; // surfaceID给camera的createVideoOutput()作为其中的一个入参 - }, this.failureCallback).catch(this.catchCallback); - - // 视频录制依赖相机相关接口,以下需要先调用相机起流接口后才能继续执行,具体的相机接口调用请参考sample用例 - // 视频录制启动接口 - await videoRecorder.start().then(() => { - console.info('start success'); - }, this.failureCallback).catch(this.catchCallback); - - // 调用pause接口时需要暂停camera出流 - await videoRecorder.pause().then(() => { - console.info('pause success'); - }, this.failureCallback).catch(this.catchCallback); - - // 调用resume接口时需要恢复camera出流 - await videoRecorder.resume().then(() => { - console.info('resume success'); - }, this.failureCallback).catch(this.catchCallback); - - // 停止camera出流后,停止视频录制 - await videoRecorder.stop().then(() => { - console.info('stop success'); - }, this.failureCallback).catch(this.catchCallback); - - // 重置录制相关配置 - await videoRecorder.reset().then(() => { - console.info('reset success'); - }, this.failureCallback).catch(this.catchCallback); - - // 关闭监听回调,如果用户不自行调用off接口,在调用release后,设置的回调接口也会无效 - videoRecorder.off('stateChange'); - videoRecorder.off('error'); - - // 释放视频录制相关资源并释放camera对象相关资源 - await videoRecorder.release().then(() => { - console.info('release success'); - }, this.failureCallback).catch(this.catchCallback); - - // 相关对象置null - videoRecorder = undefined; - surfaceID = undefined; - } -} -``` - - - -### 音视频录制APP - -音视频录制APP案例包含:创建实例、设置录制参数、获取输入surface、开始录制、暂停录制、恢复录制、停止录制、释放资源等流程。 - -详细代码可参考:[AVRecorderDemo]([multimedia_player_framework: Implementation of media playback and recording | 媒体播放和录制功能实现 - Gitee.com](https://gitee.com/openharmony/multimedia_player_framework/tree/master/test/appdemo/AVRecorderDemo)) \ No newline at end of file diff --git a/zh-cn/application-dev/media/avsession-guidelines.md b/zh-cn/application-dev/media/avsession-guidelines.md deleted file mode 100644 index 761506bfbfb3bdf3e7fcd892447c99195797e9f4..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/media/avsession-guidelines.md +++ /dev/null @@ -1,639 +0,0 @@ -# AVSession开发指导 - -> **说明:** -> -> AVSession的所有接口均为系统接口,其功能仅提供给系统应用使用。 - -## 会话接入端开发指导 - -### 基本概念 -- 会话元数据`'AVMetadata'`: 媒体数据相关属性,包含标识当前媒体的ID(assetId),上一首媒体的ID(previousAssetId),下一首媒体的ID(nextAssetId),标题(title),专辑作者(author),专辑名称(album),词作者(writer),媒体时长(duration)等属性。 -- 会话描述符`'AVSessionDescriptor'`: 描述媒体会话的相关信息。包含标识会话的ID(sessionId),会话的类型type(音频Audio/视频Video),会话自定义名称(sessionTag),会话所属应用的信息(elementName)等。 -- 媒体播放状态`'AVPlaybackState'`:用于描述媒体播放状态的相关属性。包含当前媒体的播放状态(state)、位置(position)、速度(speed)、缓冲时间(bufferedTime)、循环模式(loopMode)、是否收藏(isFavorite)等属性。 - -### 接口说明 -会话接入端常用接口如下表所示。接口返回值有两种返回形式:callback和promise,下表中为callback形式接口,promise和callback只是返回值方式不一样,功能相同。更多API说明请参见[API文档](../reference/apis/js-apis-avsession.md)。 - -表1:会话接入端常用接口 - -| 接口名 | 描述 | -|----------------------------------------------------------------------------------|-------------| -| createAVSession(context: Context, tag: string, type: AVSessionType, callback: AsyncCallback\): void | 创建会话 | -| setAVMetadata(data: AVMetadata, callback: AsyncCallback\): void | 设置会话元数据 | -| setAVPlaybackState(state: AVPlaybackState, callback: AsyncCallback\): void | 设置会话播放状态信息 | -| setLaunchAbility(ability: WantAgent, callback: AsyncCallback\): void | 设置启动ability | -| getController(callback: AsyncCallback\): void | 获取当前会话自身控制器 | -| getOutputDevice(callback: AsyncCallback\): void | 获取音频输出设备信息 | -| activate(callback: AsyncCallback\): void | 激活会话 | -| destroy(callback: AsyncCallback\): void | 销毁会话 | - -### 开发步骤 -1.导入模块接口 - -```js -import avSession from '@ohos.multimedia.avsession'; -import wantAgent from '@ohos.app.ability.wantAgent'; -import featureAbility from '@ohos.ability.featureAbility'; -``` - -2.创建会话并激活会话 -```js -// 全局变量定义 -let mediaFavorite = false; -let currentSession = null; -let context = featureAbility.getContext(); - -// 创建音频类型会话 -avSession.createAVSession(context, "AudioAppSample", 'audio').then((session) => { - currentSession = session; - currentSession.activate(); // 激活会话 -}).catch((err) => { - console.info(`createAVSession : ERROR : ${err.message}`); -}); -``` - -3.设置AVSession会话信息,包括: -- 设置会话元数据,除了媒体ID必选外,可选设置媒体标题、专辑信息、媒体作者、媒体时长、上一首/下一首媒体ID等。详细的会话元数据信息可参考API文档中的`AVMetadata`。 -- 设置启动Ability,通过[WantAgent](../reference/apis/js-apis-app-ability-wantAgent.md)的接口实现。WantAgent一般用于封装行为意图信息。 -- 设置播放状态。 -```js -// 设置会话元数据 -let metadata = { - assetId: "121278", - title: "lose yourself", - artist: "Eminem", - author: "ST", - album: "Slim shady", - writer: "ST", - composer: "ST", - duration: 2222, - mediaImage: "https://www.example.com/example.jpg", // 请开发者根据实际情况使用 - subtitle: "8 Mile", - description: "Rap", - lyric: "https://www.example.com/example.lrc", // 请开发者根据实际情况使用 - previousAssetId: "121277", - nextAssetId: "121279", -}; -currentSession.setAVMetadata(metadata).then(() => { - console.info('setAVMetadata successfully'); -}).catch((err) => { - console.info(`setAVMetadata : ERROR : ${err.message}`); -}); -``` - -```js -// 设置启动ability -let wantAgentInfo = { - wants: [ - { - bundleName: "com.neu.setResultOnAbilityResultTest1", - abilityName: "com.example.test.EntryAbility", - } - ], - operationType: wantAgent.OperationType.START_ABILITIES, - requestCode: 0, - wantAgentFlags:[wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] -} - -wantAgent.getWantAgent(wantAgentInfo).then((agent) => { - currentSession.setLaunchAbility(agent).then(() => { - console.info('setLaunchAbility successfully'); - }).catch((err) => { - console.info(`setLaunchAbility : ERROR : ${err.message}`); - }); -}); -``` - -```js -// 设置播放状态 -let PlaybackState = { - state: avSession.PlaybackState.PLAYBACK_STATE_STOP, - speed: 1.0, - position:{elapsedTime: 0, updateTime: (new Date()).getTime()}, - bufferedTime: 1000, - loopMode: avSession.LoopMode.LOOP_MODE_SEQUENCE, - isFavorite: false, -}; -currentSession.setAVPlaybackState(PlaybackState).then(() => { - console.info('setAVPlaybackState successfully'); -}).catch((err) => { - console.info(`setAVPlaybackState : ERROR : ${err.message}`); -}); -``` - -```js -// 获取当前session会话对象自身的控制器 -currentSession.getController().then((selfController) => { - console.info('getController successfully'); -}).catch((err) => { - console.info(`getController : ERROR : ${err.message}`); -}); -``` - -```js -// 获取音频输出设备信息 -currentSession.getOutputDevice().then((outputInfo) => { - console.info(`getOutputDevice successfully, deviceName : ${outputInfo.deviceName}`); -}).catch((err) => { - console.info(`getOutputDevice : ERROR : ${err.message}`); -}); -``` - -4.注册控制命令监听 -```js -// 注册播放命令监听 -currentSession.on('play', () => { - console.log("调用AudioPlayer.play方法"); - // 设置播放状态 - currentSession.setAVPlaybackState({state: avSession.PlaybackState.PLAYBACK_STATE_PLAY}).then(() => { - console.info('setAVPlaybackState successfully'); - }).catch((err) => { - console.info(`setAVPlaybackState : ERROR : ${err.message}`); - }); -}); - - -// 注册暂停命令监听 -currentSession.on('pause', () => { - console.log("调用AudioPlayer.pause方法"); - // 设置播放状态 - currentSession.setAVPlaybackState({state: avSession.PlaybackState.PLAYBACK_STATE_PAUSE}).then(() => { - console.info('setAVPlaybackState successfully'); - }).catch((err) => { - console.info(`setAVPlaybackState : ERROR : ${err.message}`); - }); -}); - -// 注册停止命令监听 -currentSession.on('stop', () => { - console.log("调用AudioPlayer.stop方法"); - // 设置播放状态 - currentSession.setAVPlaybackState({state: avSession.PlaybackState.PLAYBACK_STATE_STOP}).then(() => { - console.info('setAVPlaybackState successfully'); - }).catch((err) => { - console.info(`setAVPlaybackState : ERROR : ${err.message}`); - }); -}); - -// 注册下一首命令监听 -currentSession.on('playNext', () => { - // 如果媒体文件未准备好,则下载并缓存媒体文件,设置准备状态 - currentSession.setAVPlaybackState({state: avSession.PlaybackState.PLAYBACK_STATE_PREPARE}).then(() => { - console.info('setAVPlaybackState successfully'); - }).catch((err) => { - console.info(`setAVPlaybackState : ERROR : ${err.message}`); - }); - // 成功获取媒体文件 - currentSession.setAVMetadata({assetId: '58970105', title: '不如我们明天见'}).then(() => { - console.info('setAVMetadata successfully'); - }).catch((err) => { - console.info(`setAVMetadata : ERROR : ${err.message}`); - }); - console.log("调用AudioPlayer.play方法"); - // 设置播放状态 - let time = (new Date()).getTime(); - currentSession.setAVPlaybackState({state: avSession.PlaybackState.PLAYBACK_STATE_PLAY, position: {elapsedTime: 0, updateTime: time}, bufferedTime:2000}).then(() => { - console.info('setAVPlaybackState successfully'); - }).catch((err) => { - console.info(`setAVPlaybackState : ERROR : ${err.message}`); - }); -}); - -// 注册播放快进命令监听 -currentSession.on('fastForward', () => { - console.log("调用AudioPlayer的倍速播放"); - // 设置播放状态 - currentSession.setAVPlaybackState({speed: 2.0}).then(() => { - console.info('setAVPlaybackState successfully'); - }).catch((err) => { - console.info(`setAVPlaybackState : ERROR : ${err.message}`); - }); -}); - -// 注册跳播命令监听 -currentSession.on('seek', (time) => { - console.log("调用AudioPlayer的seek方法"); - // 设置播放状态 - currentSession.setAVPlaybackState({position: {elapsedTime: time, updateTime: (new Data()).getTime()}}).then(() => { - console.info('setAVPlaybackState successfully'); - }).catch((err) => { - console.info(`setAVPlaybackState : ERROR : ${err.message}`); - }); -}); - -// 注册设置播放速度命令监听 -currentSession.on('setSpeed', (speed) => { - console.log(`调用AudioPlayer的倍速播放 ${speed}`); - // 设置播放状态 - currentSession.setAVPlaybackState({speed: speed}).then(() => { - console.info('setAVPlaybackState successfully'); - }).catch((err) => { - console.info(`setAVPlaybackState : ERROR : ${err.message}`); - }); -}); - -// 注册设置播放循环模式命令监听 -currentSession.on('setLoopMode', (mode) => { - console.log(`应用自身切换循环模式 ${mode}`); - // 设置播放状态 - currentSession.setAVPlaybackState({loopMode: mode}).then(() => { - console.info('setAVPlaybackState successfully'); - }).catch((err) => { - console.info(`setAVPlaybackState : ERROR : ${err.message}`); - }); -}); - -// 注册设置歌曲收藏命令监听 -currentSession.on('toggleFavorite', (assetId) => { - console.log(`应用保存当前assetId为喜爱 ${assetId}`); - // 根据上一次的状态进行切换 - let favorite = mediaFavorite == false ? true : false; - currentSession.setAVPlaybackState({isFavorite: favorite}).then(() => { - console.info('setAVPlaybackState successfully'); - }).catch((err) => { - console.info(`setAVPlaybackState : ERROR : ${err.message}`); - }); - mediaFavorite = favorite; -}); - -// 注册媒体按键命令监听 -currentSession.on('handleKeyEvent', (event) => { - console.log(`用户按键 ${event.keyCode}`); -}); - -// 注册播放设备变化命令监听 -currentSession.on('outputDeviceChange', (device) => { - console.log(`输出设备变更,更新显示 ${device.deviceName}`); -}); -``` - -5.释放资源 -```js -// 取消注册回调 -currentSession.off('play'); -currentSession.off('pause'); -currentSession.off('stop'); -currentSession.off('playNext'); -currentSession.off('playPrevious'); -currentSession.off('fastForward'); -currentSession.off('rewind'); -currentSession.off('seek'); -currentSession.off('setSpeed'); -currentSession.off('setLoopMode'); -currentSession.off('toggleFavorite'); -currentSession.off('handleKeyEvent'); -currentSession.off('outputDeviceChange'); - -// 去激活session并销毁对象 -currentSession.deactivate().then(() => { - currentSession.destroy(); -}); -``` - -### 调测验证 -在媒体应用上点击播放、暂停、下一首等按键,媒体播放状态出现相应变化。 - -### 常见问题 - -1.会话服务端异常 -- 现象描述: - - 会话服务端异常,应用端无法获取服务端的消息响应。如会话服务未运行或者会话服务通信失败。返回错误信息: Session service exception。 - -- 可能原因: - - 会话重启过程中服务被杀。 - -- 解决办法 - - (1)定时重试,超过3s仍失败时,停止对该会话或者控制器进行操作。 - - (2)销毁当前会话或者会话控制器,并重新创建,如果重新创建失败,则停止会话相关操作。 - -2.会话不存在 -- 现象描述: - - 会话对象不存在时,向该会话设置参数或者发送命令。返回错误信息: The session does not exist。 - -- 可能原因: - - 会话已被销毁,服务端无会话记录。 - -- 解决办法 - - (1)如果在会话被控端产生该错误,请重新创建会话;如果是会话控制端,请停止向该会话发送查询或者控制命令。 - - (2)如果在会话管理端产生该错误,请重新查询系统当前会话记录,在创建控制器时传入正确的会话ID。 - -3.会话未激活 -- 现象描述: - - 会话没有激活时,向会话发送控制命令或者事件。。返回错误信息: The session not active。 - -- 可能原因: - - 会话处于未激活状态。 - -- 解决办法 - - 停止发送该命令或事件,监听会话的激活状态,会话激活后恢复发送该命令或事件。 - -### 相关实例 -提供[音乐Demo](https://gitee.com/openharmony/multimedia_av_session/blob/master/test/resource/player_index_js.md)的代码实例 - -## 会话控制端开发指导(播控中心) - -### 基本概念 -- 远端投播:将本地媒体投播到远端设备,通过本地控制器发送命令,可控制远端播放行为。 -- 发送按键命令:控制器通过发送按键事件的方式控制媒体。 -- 发送控制命令:控制器通过发送控制命令的方式控制媒体。 -- 发送系统按键命令:应用拥有调用该接口的系统权限,通过发送按键事件的方式控制媒体,仅系统应用可用。 -- 发送系统控制命令:应用拥有调用该接口的系统权限,通过发送控制命令的方式控制媒体,仅系统应用可用。 - -### 接口说明 - -会话控制端涉及的常用接口如下表所示。接口返回值有两种返回形式:callback和promise,下表中为callback形式接口,promise和callback只是返回值方式不一样,功能相同。更多API说明请参见[API文档](../reference/apis/js-apis-avsession.md)。 - -表2:会话控制端常用接口 - -| 接口名 | 描述 | -| ------------------------------------------------------------------------------------------------ | ----------------- | -| getAllSessionDescriptors(callback: AsyncCallback\>>): void | 获取所有会话的描述符 | -| createController(sessionId: string, callback: AsyncCallback\): void | 创建控制器 | -| sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback\): void | 发送按键命令 | -| getLaunchAbility(callback: AsyncCallback\): void | 拉起应用 | -| sendControlCommand(command: AVControlCommand, callback: AsyncCallback\): void | 发送控制命令 | -| sendSystemAVKeyEvent(event: KeyEvent, callback: AsyncCallback\): void | 发送系统按键命令 | -| sendSystemControlCommand(command: AVControlCommand, callback: AsyncCallback\): void | 发送系统控制命令 | -| castAudio(session: SessionToken \| 'all', audioDevices: Array\, callback: AsyncCallback\): void | 远端投播 | - -### 开发步骤 -1.导入模块接口 -```js -import avSession from '@ohos.multimedia.avsession'; -import {Action, KeyEvent} from '@ohos.multimodalInput.KeyEvent'; -import wantAgent from '@ohos.app.ability.wantAgent'; -import audio from '@ohos.multimedia.audio'; -``` - -2.获取会话描述符,创建控制器 -```js -// 全局变量定义 -let g_controller = new Array(); -let g_centerSupportCmd:Set = new Set(['play', 'pause', 'playNext', 'playPrevious', 'fastForward', 'rewind', 'seek','setSpeed', 'setLoopMode', 'toggleFavorite']); -let g_validCmd:Set; - -// 获取会话描述符,创建控制器 -avSession.getAllSessionDescriptors().then((descriptors) => { - descriptors.forEach((descriptor) => { - avSession.createController(descriptor.sessionId).then((controller) => { - g_controller.push(controller); - }).catch((err) => { - console.error('createController error'); - }); - }); -}).catch((err) => { - console.error('getAllSessionDescriptors error'); -}); - -// 注册会话创建监听,创建控制器 -avSession.on('sessionCreate', (session) => { - // 新增会话,需要创建控制器 - avSession.createController(session.sessionId).then((controller) => { - g_controller.push(controller); - }).catch((err) => { - console.info(`createController : ERROR : ${err.message}`); - }); -}); -``` - -3.监听AVSession会话状态以及AVSession服务变化 -```js -// 注册会话激活状态变更监听 -controller.on('activeStateChange', (isActive) => { - if (isActive) { - console.log("控制器卡片按键高亮"); - } else { - console.log("控制器卡片按键变更为无效"); - } -}); - -// 注册会话销毁监听 -controller.on('sessionDestroy', () => { - console.info('on sessionDestroy : SUCCESS '); - controller.destroy().then(() => { - console.info('destroy : SUCCESS '); - }).catch((err) => { - console.info(`destroy : ERROR :${err.message}`); - }); -}); - -// 注册系统会话销毁监听 -avSession.on('sessionDestroy', (session) => { - let index = g_controller.findIndex((controller) => { - return controller.sessionId == session.sessionId; - }); - if (index != 0) { - g_controller[index].destroy(); - g_controller.splice(index, 1); - } -}); - -// 注册系统最高优先级会话变更监听 -avSession.on('topSessionChange', (session) => { - let index = g_controller.findIndex((controller) => { - return controller.sessionId == session.sessionId; - }); - // 将该会话显示排到第一个 - if (index != 0) { - g_controller.sort((a, b) => { - return a.sessionId == session.sessionId ? -1 : 0; - }); - } -}); - -// 注册服务异常监听 -avSession.on('sessionServiceDie', () => { - // 服务端异常,应用清理资源 - console.log("服务端异常"); -}) -``` - -4.监听AVSession会话信息变化 -```js -// 注册元数据更新监听 -let metaFilter = ['assetId', 'title', 'description']; -controller.on('metadataChange', metaFilter, (metadata) => { - console.info(`on metadataChange assetId : ${metadata.assetId}`); -}); - -// 注册播放状态更新监听 -let playbackFilter = ['state', 'speed', 'loopMode']; -controller.on('playbackStateChange', playbackFilter, (playbackState) => { - console.info(`on playbackStateChange state : ${playbackState.state}`); -}); - -// 注册会话支持的命令变更监听 -controller.on('validCommandChange', (cmds) => { - console.info(`validCommandChange : SUCCESS : size : ${cmds.size}`); - console.info(`validCommandChange : SUCCESS : cmds : ${cmds.values()}`); - g_validCmd.clear(); - for (let c of g_centerSupportCmd) { - if (cmds.has(c)) { - g_validCmd.add(c); - } - } -}); - -// 注册输出设备变更监听 -controller.on('outputDeviceChange', (device) => { - console.info(`on outputDeviceChange device isRemote : ${device.isRemote}`); -}); -``` - -5.控制AVSession会话行为 -```js -// 用户点击播放按键:发送控制命令--播放 -if (g_validCmd.has('play')) { - controller.sendControlCommand({command:'play'}).then(() => { - console.info('sendControlCommand successfully'); - }).catch((err) => { - console.info(`sendControlCommand : ERROR : ${err.message}`); - }); -} - -// 用户点击循环模式:发送控制命令--单曲循环 -if (g_validCmd.has('setLoopMode')) { - controller.sendControlCommand({command: 'setLoopMode', parameter: avSession.LoopMode.LOOP_MODE_SINGLE}).then(() => { - console.info('sendControlCommand successfully'); - }).catch((err) => { - console.info(`sendControlCommand : ERROR : ${err.message}`); - }); -} - -// 发送按键事件 -let keyItem = {code: 0x49, pressedTime: 123456789, deviceId: 0}; -let event = {action: 2, key: keyItem, keys: [keyItem]}; -controller.sendAVKeyEvent(event).then(() => { - console.info('sendAVKeyEvent Successfully'); -}).catch((err) => { - console.info(`sendAVKeyEvent : ERROR : ${err.message}`); -}); - -// 用户点击卡片空白位置拉起应用 -controller.getLaunchAbility().then((want) => { - console.log("前台拉起应用"); -}).catch((err) => { - console.info(`getLaunchAbility : ERROR : ${err.message}`); -}); - -// 发送系统媒体按键事件 -let keyItem = {code: 0x49, pressedTime: 123456789, deviceId: 0}; -let event = {action: 2, key: keyItem, keys: [keyItem]}; -avSession.sendSystemAVKeyEvent(event).then(() => { - console.info('sendSystemAVKeyEvent Successfully'); -}).catch((err) => { - console.info(`sendSystemAVKeyEvent : ERROR : ${err.message}`); -}); - -// 发送系统控制命令,系统会把控制命令发送到Top会话中 -let avcommand = {command: 'toggleFavorite', parameter: "false"}; -avSession.sendSystemControlCommand(avcommand).then(() => { - console.info('sendSystemControlCommand successfully'); -}).catch((err) => { - console.info(`sendSystemControlCommand : ERROR : ${err.message}`); -}); - -// 投播到其他设备 -let audioManager = audio.getAudioManager(); -let audioDevices; -await audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data) => { - audioDevices = data; - console.info('Promise returned to indicate that the device list is obtained.'); -}).catch((err) => { - console.info(`getDevices : ERROR : ${err.message}`); -}); - -avSession.castAudio('all', audioDevices).then(() => { - console.info('createController : SUCCESS'); -}).catch((err) => { - console.info(`createController : ERROR : ${err.message}`); -}); -``` - -6.释放资源 -```js -// 取消注册回调 - controller.off('metadataChange'); - controller.off('playbackStateChange'); - controller.off('sessionDestroy'); - controller.off('activeStateChange'); - controller.off('validCommandChange'); - controller.off('outputDeviceChange'); - - // 销毁controller对象 - controller.destroy().then(() => { - console.info('destroy : SUCCESS '); - }).catch((err) => { - console.info(`destroy : ERROR : ${err.message}`); - }); -``` - -### 调测验证 -在播控中心点击播放、暂停、下一首等按键,应用播放状态随即发生相应变化。 - -### 常见问题 -1.控制器不存在 -- 现象描述: - - 会话控制器不存在时,向该控制器发送控制命令或者事件。返回错误信息: The session controller does not exist。 - -- 可能原因: - - 控制器已被销毁。 - -- 解决办法 - - 请重新查询系统当前会话记录,并创建对应的会话控制器。 - -2.远端会话连接失败 -- 现象描述: - - 本端会话与远端会话通信失败。返回错误信息: The remote session connection failed。 - -- 可能原因: - - 设备间通信断开。 - -- 解决办法 - - 停止对该会话发送控制命令,并监听输出设备变化,当输出设备发送变化后恢复发送。 - -3.无效会话命令 -- 现象描述: - - 会话被控端不支持该被控命令或事件。返回错误信息: Invalid session command。 - -- 可能原因: - - 被控端不支持该命令。 - -- 解决办法 - - 停止发送该命令或事件,并查询被控会话支持的命令集,发送被控端支持的命令。 - -4.消息过载 -- 现象描述: - - 会话客户端在一段时间内向服务端发送了过多的消息或者命令,引起服务端消息过载。返回错误信息: Command or event overload。 - -- 可能原因: - - 服务端消息过载。 - -- 解决办法 - - 检查自身命令发送是否过于频繁,控制自身查询和控制命令的发送频度。 - -### 相关实例 -提供[播控中心Demo](https://gitee.com/openharmony/multimedia_av_session/blob/master/test/resource/controller_index_js.md)的代码实例 \ No newline at end of file diff --git a/zh-cn/application-dev/media/avsession-overview.md b/zh-cn/application-dev/media/avsession-overview.md index 7c15a9681f97a6a56ba3081192fb8a31aded257b..446e027ad0d8c1d745c7941ee47d4a371cf7bbfe 100644 --- a/zh-cn/application-dev/media/avsession-overview.md +++ b/zh-cn/application-dev/media/avsession-overview.md @@ -1,56 +1,50 @@ -# AVSession开发概述 +# 媒体会话概述 -> **说明:** -> -> AVSession的所有接口均为系统接口,其功能仅提供给系统应用使用。 +媒体会话(AVSession,Audio & Video Session)服务是OpenHarmony提供的音视频管控服务,用于对系统中所有音视频行为进行统一的管理,例如只允许当前存在一个音频应用处于正在播放状态。 -## 简介 +音视频类应用接入媒体会话后,可以发送应用的数据(比如正在播放的歌曲、歌曲的播放状态等),用户可以通过系统播控中心、语音助手等应用切换多个应用、多个设备播放。音视频类应用如果不接入媒体会话,将无法在后台播放,在应用进入后台时,会被强制停止播放。 - AVSession(Audio & Video Session),音视频会话,即媒体会话。 - - 对应用开发者而言,媒体会话提供了将应用内音视频接入系统播控中心的能力。 - - 对系统开发者而言,媒体会话提供了对系统音视频应用的媒体信息进行展示和统一的媒体播放控制的能力。 +实现后台播放,还需申请长时任务避免进入挂起(Suspend)状态。具体参考[长时任务开发指导](../task-management/continuous-task-dev-guide.md)。 - 通过AVSession,可以实现: +## 基础概念 - 1.统一播控入口,提升用户体验。 +在开发前,需要先了解以下基础概念: - 当设备上安装了多个音视频类应用时,用户需要切换、进入不同的应用来控制播放。通过接入AVSession,音视频应用可以通过系统的统一播控入口(如播控中心)来控制设备上的媒体播放,无需切换不同应用,提升使用体验。 +- 媒体会话(AVSession) - 2.完善音视频后台管控。 - - 当应用在后台自行启动音频播放时,用户难以快速定位对应的应用,造成体验问题。接入AVSession后,允许应用在后台进行音乐播放,便于用户在播控中心快速找到播放应用。 + 媒体会话的一端连接被控的音视频应用,另一端连接音视频应用的控制端(如播控中心、语音助手等)。媒体会话提供了音视频应用和音视频应用控制端之间进行信息交换的通道。 -## 基本概念 +- 媒体会话提供方 -- 媒体会话 + 媒体会话提供方指接入媒体会话的音视频应用。音视频应用接入媒体会话后,需要向媒体会话提供播放的媒体信息,例如播放曲目名称、播放状态等。同时,音视频应用需要通过媒体会话接收控制端发出的控制命令并进行正确响应。 - 用于应用和播控中心之间进行信息交换的通道。会话的一端连接被控的媒体应用,另一端连接媒体应用的控制端(如播控中心)。应用接入了媒体会话后,可以通过媒体会话将媒体播放信息传递给控制端,并能够接收到控制端发出的控制命令。 - -- 媒体会话控制器 +- 媒体会话控制方 - 媒体会话控制器的持有者可以控制接入了AVSession应用的播放行为。通过会话控制器,应用可以对应用进程的播放行为进行控制,支持获取应用的播放信息,发送播放控制命令,也支持监听应用的播放状态等的变化,确保媒体会话信息的同步。 + 媒体会话控制方指接入媒体会话并具有全局管控音视频行为功能的应用,例如系统播控中心、语音助手等。为便于开发者理解,下文将多处使用OpenHarmony系统应用播放中心,作为媒体会话控制方举例。播控中心等系统应用接入媒体会话后,可以通过监听媒体会话获取最新的媒体信息,也可以通过媒体会话向音视频应用发出控制命令。 -- 播控中心 - - 系统统一的媒体控制中心,会话控制器的持有者。通过控制器发送命令来控制媒体的播放、暂停等。 +- 媒体会话控制器(AVSessionController) -## 实现原理 + 媒体会话控制器的持有者,一般指媒体会话控制方,可以控制媒体会话提供方的应用播放行为,也可以获取应用的播放信息,还可以监听音视频应用播放状态的变化,用于确保媒体会话信息在音视频应用和播控中间之间的同步。 -该模块提供了`AVSession`会话类和`AVSessionController`控制器类。 +- 媒体会话管理器(AVSessionManager) -**图1** AVSession交互图 + 媒体会话管理器提供了管理媒体会话的能力,可以创建媒体会话、创建媒体会话控制器、发送系统控制事件,也支持对媒体会话的状态进行监听。 -![zh-ch_image_avsession](figures/zh-cn_image_avsession.png) -- 应用与播控中心交互:首先,音频应用创建`AVSession`对象,并设置会话信息(包括媒体元数据、对应拉起的Ability、播放状态等)。然后,播控中心创建`AVSessionController`,可获取会话相关信息,向音频应用发送播放命令。最后,音频应用响应播控中心的命令并更新播放状态。 +## 媒体会话交互过程 -- 支持分布式投播:当组网内的设备创建本地会话之后,播控中心或者音频应用可以根据设备列表选择想要投播的其他设备,将本地会话同步到远端,生成远端会话,并支持远端控制。需要控制远端会话时,通过远端控制器将控制命令发送到远端会话控制中心。 +媒体会话分为本地和分布式两种场景。 + +![AVSession Interaction Process](figures/avsession-interaction-process.png) + +- 本地媒体会话 + + 本地媒体会话在本地设备中的媒体会话提供方和媒体会话控制方之间建立连接,实现系统中音视频应用统一的媒体播放控制和媒体信息显示。 + +- 分布式媒体会话 + + 分布式媒体会话在跨设备场景中的媒体会话提供方和媒体会话控制方之间建立连接,实现音视频应用跨设备的媒体播放控制和媒体信息显示。例如,将设备A中播放的内容投播到设备B,并在设备B中进行播放控制。 ## 约束和限制 -- 播控中心展示的播放信息,依赖媒体应用主动将媒体信息写入到AVSession。 -- 播控中心控制媒体应用播放,依赖于媒体应用侧对控制命令的响应。 -- AVSession只能够传递媒体播放信息和播放控制指令,不进行信息的展示和控制命令的执行。 -- 普通应用不支持开发播控中心端。当普通音视频应用运行在OpenHarmony上时,默认控制端为系统应用播控中心,开发者无需做额外的操作。 -- 播控中心为系统应用,当开发者需要基于OpenHarmony开发自己的系统时,可以开发本系统的播控中心应用。 -- 为了解决音频在后台播放时用户无法获取到停止音频的入口,影响用户体验,AVSession服务增加了应用后台管控策略,只有应用接入了AVSession,才可以后台播放,否则当应用切后台时系统会强制暂停其音频播放。 +媒体会话服务会对系统中的所有音视频应用进行管控,只有接入了媒体会话的音视频应用才可以在后台播放,未接入的应用在退到后台时,将会被强制暂停音频播放。 diff --git a/zh-cn/application-dev/media/camera-device-input.md b/zh-cn/application-dev/media/camera-device-input.md new file mode 100644 index 0000000000000000000000000000000000000000..6aa0dfc4328e3fbfb7da000627e4b9ac4bf32224 --- /dev/null +++ b/zh-cn/application-dev/media/camera-device-input.md @@ -0,0 +1,82 @@ +# 设备输入 + +在开发一个相机应用前,需要先创建一个独立的相机设备,应用通过调用和控制相机设备,完成预览、拍照和录像等基础操作。 + +## 开发步骤 + +详细的API说明请参考[Camera API参考](../reference/apis/js-apis-camera.md)。 + +1. 导入camera接口,接口中提供了相机相关的属性和方法,导入方法如下。 + + ```ts + import camera from '@ohos.multimedia.camera'; + ``` + +2. 通过getCameraManager()方法,获取cameraManager对象。 + + ```ts + let cameraManager; + let context: any = getContext(this); + cameraManager = camera.getCameraManager(context) + ``` + + > **说明:** + > + > 如果获取对象失败,说明相机可能被占用或无法使用。如果被占用,须等到相机被释放后才能重新获取。 + +3. 通过cameraManager类中的getSupportedCameras()方法,获取当前设备支持的相机列表,列表中存储了设备支持的所有相机ID。若列表不为空,则说明列表中的每个ID都支持独立创建相机对象;否则,说明当前设备无可用相机,不可继续后续操作。 + + ```ts + let cameraArray = cameraManager.getSupportedCameras(); + if (cameraArray.length <= 0) { + console.error("cameraManager.getSupportedCameras error"); + return; + } + + for (let index = 0; index < cameraArray.length; index++) { + console.info('cameraId : ' + cameraArray[index].cameraId); // 获取相机ID + console.info('cameraPosition : ' + cameraArray[index].cameraPosition); // 获取相机位置 + console.info('cameraType : ' + cameraArray[index].cameraType); // 获取相机类型 + console.info('connectionType : ' + cameraArray[index].connectionType); // 获取相机连接类型 + } + ``` + +4. 通过getSupportedOutputCapability()方法,获取当前设备支持的所有输出流,如预览流、拍照流等。输出流在CameraOutputCapability中的各个profile字段中。 + + ```ts + // 创建相机输入流 + let cameraInput; + try { + cameraInput = cameraManager.createCameraInput(cameraArray[0]); + } catch (error) { + console.error('Failed to createCameraInput errorCode = ' + error.code); + } + // 监听cameraInput错误信息 + let cameraDevice = cameraArray[0]; + cameraInput.on('error', cameraDevice, (error) => { + console.info(`Camera input error code: ${error.code}`); + }) + // 打开相机 + await cameraInput.open(); + // 获取相机设备支持的输出流能力 + let cameraOutputCapability = cameraManager.getSupportedOutputCapability(cameraArray[0]); + if (!cameraOutputCapability) { + console.error("cameraManager.getSupportedOutputCapability error"); + return; + } + console.info("outputCapability: " + JSON.stringify(cameraOutputCapability)); + ``` + + +## 状态监听 + +在相机应用开发过程中,可以随时监听相机状态,包括新相机的出现、相机的移除、相机的可用状态。在回调函数中,通过相机ID、相机状态这两个参数进行监听,如当有新相机出现时,可以将新相机加入到应用的备用相机中。 + + 通过注册cameraStatus事件,通过回调返回监听结果,callback返回CameraStatusInfo参数,参数的具体内容可参考相机管理器回调接口实例[CameraStatusInfo](../reference/apis/js-apis-camera.md#camerastatusinfo)。 + +```ts +cameraManager.on('cameraStatus', (cameraStatusInfo) => { + console.info(`camera: ${cameraStatusInfo.camera.cameraId}`); + console.info(`status: ${cameraStatusInfo.status}`); +}) +``` diff --git a/zh-cn/application-dev/media/camera-metadata.md b/zh-cn/application-dev/media/camera-metadata.md new file mode 100644 index 0000000000000000000000000000000000000000..c4c5f32656a403af4bb13062bfbafe77fec46489 --- /dev/null +++ b/zh-cn/application-dev/media/camera-metadata.md @@ -0,0 +1,66 @@ +# 元数据 + +元数据(Metadata)是对相机返回的图像信息数据的描述和上下文,针对图像信息,提供的更详细的数据,如照片或视频中,识别人像的取景框坐标等信息。 + +Metadata主要是通过一个TAG(Key),去找对应的Data,用于传递参数和配置信息,减少内存拷贝操作。 + +## 开发步骤 + +详细的API说明请参考[Camera API参考](../reference/apis/js-apis-camera.md)。 + +1. 调用CameraOutputCapability类中的supportedMetadataObjectTypes()方法,获取当前设备支持的元数据类型,并通过createMetadataOutput()方法创建元数据输出流。 + + ```ts + let metadataObjectTypes = cameraOutputCapability.supportedMetadataObjectTypes; + let metadataOutput; + try { + metadataOutput = cameraManager.createMetadataOutput(metadataObjectTypes); + } catch (error) { + // 失败返回错误码error.code并处理 + console.info(error.code); + } + ``` + +2. 调用start()方法输出metadata数据,接口调用失败时,会返回相应错误码,错误码类型参见CameraErrorCode。 + + ```ts + metadataOutput.start().then(() => { + console.info('Callback returned with metadataOutput started.'); + }).catch((err) => { + console.info('Failed to metadataOutput start '+ err.code); + }); + ``` + +3. 调用stop方法停止输出metadata数据,接口调用失败会返回相应错误码,错误码类型参见CameraErrorCode。 + + ```ts + metadataOutput.stop().then(() => { + console.info('Callback returned with metadataOutput stopped.'); + }).catch((err) => { + console.info('Failed to metadataOutput stop '+ err.code); + }); + ``` + +## 状态监听 + +在相机应用开发过程中,可以随时监听metadata数据以及输出流的状态。 + +- 通过注册监听获取metadata对象,监听事件固定为metadataObjectsAvailable。检测到有效metadata数据时,callback返回相应的metadata数据信息,metadataOutput创建成功时可监听。 + + ```ts + metadataOutput.on('metadataObjectsAvailable', (metadataObjectArr) => { + console.info(`metadata output metadataObjectsAvailable`); + }) + ``` + + > **说明:** + > + > 当前的元数据类型仅支持人脸检测(FACE_DETECTION)功能。元数据信息对象为识别到的人脸区域的矩形信息(Rect),包含矩形区域的左上角x坐标、y坐标和矩形的宽高数据。 + +- 通过注册回调函数,获取监听metadata流的错误结果,callback返回metadata输出接口使用错误时返回的错误码,错误码类型参见[CameraErrorCode](../reference/apis/js-apis-camera.md#cameraerrorcode)。 + + ```ts + metadataOutput.on('error', (metadataOutputError) => { + console.info(`Metadata output error code: ${metadataOutputError.code}`); + }) + ``` diff --git a/zh-cn/application-dev/media/camera-overview.md b/zh-cn/application-dev/media/camera-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..c70c86aa89aa2d4bb5bbaf070da49aeb3dbaa17b --- /dev/null +++ b/zh-cn/application-dev/media/camera-overview.md @@ -0,0 +1,27 @@ +# 相机开发概述 + +开发者通过调用OpenHarmony相机服务提供的接口可以开发相机应用,应用通过访问和操作相机硬件,实现基础操作,如预览、拍照和录像;还可以通过接口组合完成更多操作,如控制闪光灯和曝光时间、对焦或调焦等。 + +## 开发模型 + +相机调用摄像头采集、加工图像视频数据,精确控制对应的硬件,灵活输出图像、视频内容,满足多镜头硬件适配(如广角、长焦、TOF)、多业务场景适配(如不同分辨率、不同格式、不同效果)的要求。 + +相机的工作流程如图所示,可概括为相机输入设备管理、会话管理和相机输出管理三部分。 + +- 相机设备调用摄像头采集数据,作为相机输入流。 + +- 会话管理可配置输入流,即选择哪些镜头进行拍摄。另外还可以配置闪光灯、曝光时间、对焦和调焦等参数,实现不同效果的拍摄,从而适配不同的业务场景。应用可以通过切换会话满足不同场景的拍摄需求。 + +- 配置相机的输出流,即将内容以预览流、拍照流或视频流输出。 + +**图1** 相机工作流程   +![Camera Workflow](figures/camera-workflow.png) + +了解相机工作流程后,建议开发者了解相机的开发模型,便于更好地开发相机应用。 + +**图2** 相机开发模型   +![Camera Development Model](figures/camera-development-model.png) + +相机应用通过控制相机,实现图像显示(预览)、照片保存(拍照)、视频录制(录像)等基础操作。在实现基本操作过程中,相机服务会控制相机设备采集和输出数据,采集的图像数据在相机底层的设备硬件接口(HDI,Hardware Device Interfaces),直接通过BufferQueue传递到具体的功能模块进行处理。BufferQueue在应用开发中无需关注,用于将底层处理的数据及时送到上层进行图像显示。 + +以视频录制为例进行说明,相机应用在录制视频过程中,媒体录制服务先创建一个视频Surface用于传递数据,并提供给相机服务,相机服务可控制相机设备采集视频数据,生成视频流。采集的数据通过底层相机HDI处理后,通过Surface将视频流传递给媒体录制服务,媒体录制服务对视频数据进行处理后,保存为视频文件,完成视频录制。 diff --git a/zh-cn/application-dev/media/camera-preparation.md b/zh-cn/application-dev/media/camera-preparation.md new file mode 100644 index 0000000000000000000000000000000000000000..3fb2ca72f6f81d248bcc31f58598551c1eb2383d --- /dev/null +++ b/zh-cn/application-dev/media/camera-preparation.md @@ -0,0 +1,24 @@ +# 开发准备 + +相机应用开发的主要流程包含开发准备、设备输入、会话管理、预览、拍照和录像等。 + +在开发相机应用时,需要先申请相机相关权限,确保应用拥有访问相机硬件及其他功能的权限,需要的权限如下表。在申请权限前,请保证符合[权限使用的基本原则](../security/accesstoken-overview.md#权限使用的基本原则)。 + + +| 权限名 | 说明 | 授权方式 | +| -------- | -------- | -------- | +| ohos.permission.CAMERA | 允许应用使用相机拍摄照片和录制视频。 | user_grant | +| ohos.permission.MICROPHONE | 允许应用使用麦克风(可选)。
如需同时录制音频,需要申请该权限。 | user_grant | +| ohos.permission.WRITE_MEDIA | 允许应用读写用户外部存储中的媒体文件信息(可选)。 | user_grant | +| ohos.permission.READ_MEDIA | 允许应用读取用户外部存储中的媒体文件信息(可选)。 | user_grant | +| ohos.permission.MEDIA_LOCATION | 允许应用访问用户媒体文件中的地理位置信息(可选)。 | user_grant | + + +以上权限的授权方式均为user_grant(用户授权),即开发者在module.json5文件中配置对应的权限后,需要使用接口[abilityAccessCtrl.requestPermissionsFromUser](../reference/apis/js-apis-abilityAccessCtrl.md#requestpermissionsfromuser9)去校验当前用户是否已授权。如果是,应用可以直接访问/操作目标对象;否则需要弹框向用户申请授权。 + + +具体申请方式及校验方式,请参考[访问控制授权申请指导](../security/accesstoken-guidelines.md)。 + + +> **说明:** +> 即使用户曾被授予过权限,应用在调用此权限保护的接口前,也应该先检查是否有权限。不能把之前授予的状态持久化,因为用户在动态授予后可能通过“设置”取消应用权限。 diff --git a/zh-cn/application-dev/media/camera-preview.md b/zh-cn/application-dev/media/camera-preview.md new file mode 100644 index 0000000000000000000000000000000000000000..ec2f45a39cc887d96551acbb6c33a65dfcb1c9e3 --- /dev/null +++ b/zh-cn/application-dev/media/camera-preview.md @@ -0,0 +1,87 @@ +# 预览 + +预览是启动相机后看见的画面,通常在拍照和录像前执行。 + +## 开发步骤 + +详细的API说明请参考[Camera API参考](../reference/apis/js-apis-camera.md)。 + +1. 创建Surface。 + + XComponent组件为预览流提供的Surface,而XComponent的能力由UI提供,相关介绍可参考[XComponent组件参考](../reference/arkui-ts/ts-basic-components-xcomponent.md)。 + + ```ts + // 创建XComponentController + mXComponentController: XComponentController = new XComponentController; + build() { + Flex() { + // 创建XComponent + XComponent({ + id: '', + type: 'surface', + libraryname: '', + controller: this.mXComponentController + }) + .onLoad(() => { + // 设置Surface宽高(1920*1080),预览尺寸设置参考前面 previewProfilesArray 获取的当前设备所支持的预览分辨率大小去设置 + this.mXComponentController.setXComponentSurfaceSize({surfaceWidth:1920,surfaceHeight:1080}); + // 获取Surface ID + globalThis.surfaceId = this.mXComponentController.getXComponentSurfaceId(); + }) + .width('1920px') + .height('1080px') + } + } + ``` + +2. 通过CameraOutputCapability类中的previewProfiles()方法获取当前设备支持的预览能力,返回previewProfilesArray数组 。通过createPreviewOutput()方法创建预览输出流,其中,createPreviewOutput()方法中的而两个参数分别是previewProfilesArray数组中的第一项和步骤一中获取的surfaceId。 + + ```ts + let previewProfilesArray = cameraOutputCapability.previewProfiles; + let previewOutput; + try { + previewOutput = cameraManager.createPreviewOutput(previewProfilesArray[0], surfaceId); + } + catch (error) { + console.error("Failed to create the PreviewOutput instance." + error); + } + ``` + +3. 使能。通过start()方法输出预览流,接口调用失败会返回相应错误码,错误码类型参见[CameraErrorCode](../reference/apis/js-apis-camera.md#cameraerrorcode)。 + + ```ts + previewOutput.start().then(() => { + console.info('Callback returned with previewOutput started.'); + }).catch((err) => { + console.info('Failed to previewOutput start '+ err.code); + }); + ``` + + +## 状态监听 + +在相机应用开发过程中,可以随时监听预览输出流状态,包括预览流启动、预览流结束、预览流输出错误。 + +- 通过注册固定的frameStart回调函数获取监听预览启动结果,previewOutput创建成功时即可监听,预览第一次曝光时触发,有该事件返回结果则认为预览流已启动。 + + ```ts + previewOutput.on('frameStart', () => { + console.info('Preview frame started'); + }) + ``` + +- 通过注册固定的frameEnd回调函数获取监听预览结束结果,previewOutput创建成功时即可监听,预览完成最后一帧时触发,有该事件返回结果则认为预览流已结束。 + + ```ts + previewOutput.on('frameEnd', () => { + console.info('Preview frame ended'); + }) + ``` + +- 通过注册固定的error回调函数获取监听预览输出错误结果,callback返回预览输出接口使用错误时对应的错误码,错误码类型参见[CameraErrorCode](../reference/apis/js-apis-camera.md#cameraerrorcode)。 + + ```ts + previewOutput.on('error', (previewOutputError) => { + console.info(`Preview output error code: ${previewOutputError.code}`); + }) + ``` diff --git a/zh-cn/application-dev/media/camera-recording-case.md b/zh-cn/application-dev/media/camera-recording-case.md new file mode 100644 index 0000000000000000000000000000000000000000..ce31512966b3af7305f777f67af36c53a383944e --- /dev/null +++ b/zh-cn/application-dev/media/camera-recording-case.md @@ -0,0 +1,247 @@ +# 录像实现方案 + +## 开发流程 + +在获取到相机支持的输出流能力后,开始创建录像流,开发流程如下。 + +![Recording Development Process](figures/recording-development-process.png) + + +## 完整示例 + +```ts +import camera from '@ohos.multimedia.camera' +import media from '@ohos.multimedia.media' + +// 创建CameraManager对象 +context: any = getContext(this) +let cameraManager = camera.getCameraManager(this.context) +if (!cameraManager) { + console.error("camera.getCameraManager error") + return; +} + +// 监听相机状态变化 +cameraManager.on('cameraStatus', (cameraStatusInfo) => { + console.log(`camera : ${cameraStatusInfo.camera.cameraId}`); + console.log(`status: ${cameraStatusInfo.status}`); +}) + +// 获取相机设备支持的输出流能力 +let cameraOutputCap = cameraManager.getSupportedOutputCapability(cameraArray[0]); +if (!cameraOutputCap) { + console.error("cameraManager.getSupportedOutputCapability error") + return; +} +console.log("outputCapability: " + JSON.stringify(cameraOutputCap)); + +let previewProfilesArray = cameraOutputCap.previewProfiles; +if (!previewProfilesArray) { + console.error("createOutput previewProfilesArray == null || undefined") +} + +let photoProfilesArray = cameraOutputCap.photoProfiles; +if (!photoProfilesArray) { + console.error("createOutput photoProfilesArray == null || undefined") +} + +let videoProfilesArray = cameraOutputCap.videoProfiles; +if (!videoProfilesArray) { + console.error("createOutput videoProfilesArray == null || undefined") +} + +let metadataObjectTypesArray = cameraOutputCap.supportedMetadataObjectTypes; +if (!metadataObjectTypesArray) { + console.error("createOutput metadataObjectTypesArray == null || undefined") +} + +// 配置参数以实际硬件设备支持的范围为准 +let AVRecorderProfile = { + audioBitrate : 48000, + audioChannels : 2, + audioCodec : media.CodecMimeType.AUDIO_AAC, + audioSampleRate : 48000, + fileFormat : media.ContainerFormatType.CFT_MPEG_4, + videoBitrate : 2000000, + videoCodec : media.CodecMimeType.VIDEO_MPEG4, + videoFrameWidth : 640, + videoFrameHeight : 480, + videoFrameRate : 30 +} +let AVRecorderConfig = { + audioSourceType : media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC, + videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV, + profile : AVRecorderProfile, + url : 'fd://', // 文件需先由调用者创建,赋予读写权限,将文件fd传给此参数,eg.fd://45--file:///data/media/01.mp4 + rotation : 0, // 合理值0、90、180、270,非合理值prepare接口将报错 + location : { latitude : 30, longitude : 130 } +} + +let avRecorder +media.createAVRecorder((error, recorder) => { + if (recorder != null) { + avRecorder = recorder; + console.log('createAVRecorder success'); + } else { + console.log(`createAVRecorder fail, error:${error}`); + } +}); + +avRecorder.prepare(AVRecorderConfig, (err) => { + if (err == null) { + console.log('prepare success'); + } else { + console.log('prepare failed and error is ' + err.message); + } +}) + +let videoSurfaceId = null; // 该surfaceID用于传递给相机接口创造videoOutput +avRecorder.getInputSurface((err, surfaceId) => { + if (err == null) { + console.log('getInputSurface success'); + videoSurfaceId = surfaceId; + } else { + console.log('getInputSurface failed and error is ' + err.message); + } +}); + +// 创建VideoOutput对象 +let videoOutput +try { + videoOutput = cameraManager.createVideoOutput(videoProfilesArray[0], videoSurfaceId) +} catch (error) { + console.error('Failed to create the videoOutput instance. errorCode = ' + error.code); +} + +// 监听视频输出错误信息 +videoOutput.on('error', (error) => { + console.log(`Preview output error code: ${error.code}`); +}) + +//创建会话 +let captureSession +try { + captureSession = cameraManager.createCaptureSession() +} catch (error) { + console.error('Failed to create the CaptureSession instance. errorCode = ' + error.code); +} + +// 监听session错误信息 +captureSession.on('error', (error) => { + console.log(`Capture session error code: ${error.code}`); +}) + +// 开始配置会话 +try { + captureSession.beginConfig() +} catch (error) { + console.error('Failed to beginConfig. errorCode = ' + error.code); +} + +// 获取相机列表 +let cameraArray = cameraManager.getSupportedCameras(); +if (cameraArray.length <= 0) { + console.error("cameraManager.getSupportedCameras error") + return; +} + +// 创建相机输入流 +let cameraInput +try { + cameraInput = cameraManager.createCameraInput(cameraArray[0]); +} catch (error) { + console.error('Failed to createCameraInput errorCode = ' + error.code); +} + +// 监听cameraInput错误信息 +let cameraDevice = cameraArray[0]; +cameraInput.on('error', cameraDevice, (error) => { + console.log(`Camera input error code: ${error.code}`); +}) + +// 打开相机 +await cameraInput.open(); + +// 向会话中添加相机输入流 +try { + captureSession.addInput(cameraInput) +} catch (error) { + console.error('Failed to addInput. errorCode = ' + error.code); +} + +// 创建预览输出流,其中参数 surfaceId 参考下面 XComponent 组件,预览流为XComponent组件提供的surface +let previewOutput +try { + previewOutput = cameraManager.createPreviewOutput(previewProfilesArray[0], surfaceId) +} catch (error) { + console.error("Failed to create the PreviewOutput instance.") +} + +// 向会话中添加预览输入流 +try { + captureSession.addOutput(previewOutput) +} catch (error) { + console.error('Failed to addOutput(previewOutput). errorCode = ' + error.code); +} + +// 向会话中添加录像输出流 +try { + captureSession.addOutput(videoOutput) +} catch (error) { + console.error('Failed to addOutput(videoOutput). errorCode = ' + error.code); +} + +// 提交会话配置 +await captureSession.commitConfig() + +// 启动会话 +await captureSession.start().then(() => { + console.log('Promise returned to indicate the session start success.'); +}) + +// 启动录像输出流 +videoOutput.start(async (err) => { + if (err) { + console.error('Failed to start the video output ${err.message}'); + return; + } + console.log('Callback invoked to indicate the video output start success.'); +}); + +// 开始录像 +avRecorder.start().then(() => { + console.log('videoRecorder start success'); +}) + +// 停止录像输出流 +videoOutput.stop((err) => { + if (err) { + console.error('Failed to stop the video output ${err.message}'); + return; + } + console.log('Callback invoked to indicate the video output stop success.'); +}); + +// 停止录像 +avRecorder.stop().then(() => { + console.log('stop success'); +}) + +// 停止当前会话 +captureSession.stop() + +// 释放相机输入流 +cameraInput.close() + +// 释放预览输出流 +previewOutput.release() + +// 释放录像输出流 +videoOutput.release() + +// 释放会话 +captureSession.release() + +// 会话置空 +captureSession = null +``` diff --git a/zh-cn/application-dev/media/camera-recording.md b/zh-cn/application-dev/media/camera-recording.md new file mode 100644 index 0000000000000000000000000000000000000000..fbf05105b2dbe395e47de3aa27650a1234fb1d27 --- /dev/null +++ b/zh-cn/application-dev/media/camera-recording.md @@ -0,0 +1,155 @@ +# 录像 + +录像也是相机应用的最重要功能之一,录像是循环帧的捕获。对于录像的流畅度,开发者可以参考[拍照](camera-shooting.md)中的步骤4,设置分辨率、闪光灯、焦距、照片质量及旋转角度等信息。 + +## 开发步骤 + +详细的API说明请参考[Camera API参考](../reference/apis/js-apis-camera.md)。 + +1. 导入media模块。创建拍照输出流的SurfaceId以及拍照输出的数据,都需要用到系统提供的[media接口](../reference/apis/js-apis-media.md)能力,导入media接口的方法如下。 + + ```ts + import media from '@ohos.multimedia.media'; + ``` + +2. 创建Surface。 + + 系统提供的media接口可以创建一个录像AVRecorder实例,通过该实例的getInputSurface方法获取SurfaceId,与录像输出流做关联,处理录像输出流输出的数据。 + + ```ts + let AVRecorder; + media.createAVRecorder((error, recorder) => { + if (recorder != null) { + AVRecorder = recorder; + console.info('createAVRecorder success'); + } else { + console.info(`createAVRecorder fail, error:${error}`); + } + }); + // AVRecorderConfig可参考下一章节 + AVRecorder.prepare(AVRecorderConfig, (err) => { + if (err == null) { + console.log('prepare success'); + } else { + console.log('prepare failed and error is ' + err.message); + } + }) + + let videoSurfaceId = null; + AVRecorder.getInputSurface().then((surfaceId) => { + console.info('getInputSurface success'); + videoSurfaceId = surfaceId; + }).catch((err) => { + console.info('getInputSurface failed and catch error is ' + err.message); + }); + ``` + +3. 创建录像输出流。 + + 通过CameraOutputCapability类中的videoProfiles,可获取当前设备支持的录像输出流。然后,定义创建录像的参数,通过createVideoOutput方法创建录像输出流。 + + ```ts + let videoProfilesArray = cameraOutputCapability.videoProfiles; + if (!videoProfilesArray) { + console.error("createOutput videoProfilesArray == null || undefined"); + } + + // 创建视频录制的参数 + let videoConfig = { + videoSourceType: media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV, + profile: { + fileFormat : media.ContainerFormatType.CFT_MPEG_4, // 视频文件封装格式,只支持MP4 + videoBitrate : 100000, // 视频比特率 + videoCodec : media.CodecMimeType.VIDEO_MPEG4, // 视频文件编码格式,支持mpeg4和avc两种格式 + videoFrameWidth : 640, // 视频分辨率的宽 + videoFrameHeight : 480, // 视频分辨率的高 + videoFrameRate : 30 // 视频帧率 + }, + url: 'fd://35', + rotation: 0 + } + // 创建avRecorder + let avRecorder; + media.createAVRecorder((error, recorder) => { + if (recorder != null) { + avRecorder = recorder; + console.info('createAVRecorder success'); + } else { + console.info(`createAVRecorder fail, error:${error}`); + } + }); + // 设置视频录制的参数 + avRecorder.prepare(videoConfig); + // 创建VideoOutput对象 + let videoOutput; + try { + videoOutput = cameraManager.createVideoOutput(videoProfilesArray[0], videoSurfaceId); + } catch (error) { + console.error('Failed to create the videoOutput instance. errorCode = ' + error.code); + } + ``` + +4. 开始录像。 + + 先通过videoOutput的start方法启动录像输出流,再通过avRecorder的start方法开始录像。 + + ``` + videoOutput.start(async (err) => { + if (err) { + console.error('Failed to start the video output ${err.message}'); + return; + } + console.info('Callback invoked to indicate the video output start success.'); + }); + + avRecorder.start().then(() => { + console.info('avRecorder start success'); + } + ``` + +5. 停止录像。 + + 先通过avRecorder的stop方法停止录像,再通过videoOutput的stop方法停止录像输出流。 + + ```ts + videoRecorder.stop().then(() => { + console.info('stop success'); + } + + videoOutput.stop((err) => { + if (err) { + console.error('Failed to stop the video output ${err.message}'); + return; + } + console.info('Callback invoked to indicate the video output stop success.'); + }); + ``` + + +## 状态监听 + +在相机应用开发过程中,可以随时监听录像输出流状态,包括录像开始、录像结束、录像流输出的错误。 + +- 通过注册固定的frameStart回调函数获取监听录像开始结果,videoOutput创建成功时即可监听,录像第一次曝光时触发,有该事件返回结果则认为录像开始。 + + ```ts + videoOutput.on('frameStart', () => { + console.info('Video frame started'); + }) + ``` + +- 通过注册固定的frameEnd回调函数获取监听录像结束结果,videoOutput创建成功时即可监听,录像完成最后一帧时触发,有该事件返回结果则认为录像流已结束。 + + ```ts + videoOutput.on('frameEnd', () => { + console.info('Video frame ended'); + }) + ``` + +- 通过注册固定的error回调函数获取监听录像输出错误结果,callback返回预览输出接口使用错误时对应的错误码,错误码类型参见[CameraErrorCode](../reference/apis/js-apis-camera.md#cameraerrorcode)。 + + ```ts + videoOutput.on('error', (error) => { + console.info(`Video output error code: ${error.code}`); + }) + ``` diff --git a/zh-cn/application-dev/media/camera-session-management.md b/zh-cn/application-dev/media/camera-session-management.md new file mode 100644 index 0000000000000000000000000000000000000000..fdef64d33ff8226ab459f7e3c5f0967b7ee30ad6 --- /dev/null +++ b/zh-cn/application-dev/media/camera-session-management.md @@ -0,0 +1,86 @@ +# 会话管理 + +相机使用预览、拍照、录像、元数据功能前,均需要创建相机会话。 + +在会话中,可以完成以下功能: + +- 配置相机的输入流和输出流。相机在拍摄前,必须完成输入输出流的配置。 + 配置输入流即添加设备输入,对用户而言,相当于选择设备的某一摄像头拍摄;配置输出流,即选择数据将以什么形式输出。当应用需要实现拍照时,输出流应配置为预览流和拍照流,预览流的数据将显示在XComponent组件上,拍照流的数据将通过ImageReceiver接口的能力保存到相册中。 + +- 添加闪光灯、调整焦距等配置。具体支持的配置及接口说明请参考[Camera API参考](../reference/apis/js-apis-camera.md)。 + +- 会话切换控制。应用可以通过移除和添加输出流的方式,切换相机模式。如当前会话的输出流为拍照流,应用可以将拍照流移除,然后添加视频流作为输出流,即完成了拍照到录像的切换。 + +完成会话配置后,应用提交和开启会话,可以开始调用相机相关功能。 + +## 开发步骤 + +1. 调用cameraManager类中的createCaptureSession()方法创建一个会话。 + + ```ts + let captureSession; + try { + captureSession = cameraManager.createCaptureSession(); + } catch (error) { + console.error('Failed to create the CaptureSession instance. errorCode = ' + error.code); + } + ``` + +2. 调用captureSession类中的beginConfig()方法配置会话。 + + ```ts + try { + captureSession.beginConfig(); + } catch (error) { + console.error('Failed to beginConfig. errorCode = ' + error.code); + } + ``` + +3. 使能。向会话中添加相机的输入流和输出流,调用captureSession.addInput()添加相机的输入流;调用captureSession.addOutput()添加相机的输出流。以下示例代码以添加预览流previewOutput和拍照流photoOutput为例,即当前模式支持拍照和预览。 + + 调用captureSession类中的commitConfig()和start()方法提交相关配置,并启动会话。 + + ```ts + try { + captureSession.addInput(cameraInput); + } catch (error) { + console.error('Failed to addInput. errorCode = ' + error.code); + } + try { + captureSession.addOutput(previewOutput); + } catch (error) { + console.error('Failed to addOutput(previewOutput). errorCode = ' + error.code); + } + try { + captureSession.addOutput(photoOutput); + } catch (error) { + console.error('Failed to addOutput(photoOutput). errorCode = ' + error.code); + } + await captureSession.commitConfig() ; + await captureSession.start().then(() => { + console.info('Promise returned to indicate the session start success.'); + }) + ``` + +4. 会话控制。调用captureSession类中的stop()方法可以停止当前会话。调用removeOutput()和addOutput()方法可以完成会话切换控制。以下示例代码以移除拍照流photoOutput,添加视频流videoOutput为例,完成了拍照到录像的切换。 + + ```ts + await captureSession.stop(); + try { + captureSession.beginConfig(); + } catch (error) { + console.error('Failed to beginConfig. errorCode = ' + error.code); + } + // 从会话中移除拍照输出流 + try { + captureSession.removeOutput(photoOutput); + } catch (error) { + console.error('Failed to removeOutput(photoOutput). errorCode = ' + error.code); + } + // 向会话中添加视频输出流 + try { + captureSession.addOutput(videoOutput); + } catch (error) { + console.error('Failed to addOutput(videoOutput). errorCode = ' + error.code); + } + ``` diff --git a/zh-cn/application-dev/media/camera-shooting-case.md b/zh-cn/application-dev/media/camera-shooting-case.md new file mode 100644 index 0000000000000000000000000000000000000000..aa85b7136740b20d84a955e5fccdb4301113914d --- /dev/null +++ b/zh-cn/application-dev/media/camera-shooting-case.md @@ -0,0 +1,240 @@ +# 拍照实现方案 + +## 开发流程 + +在获取到相机支持的输出流能力后,开始创建拍照流,开发流程如下。 + +![Photographing Development Process](figures/photographing-development-process.png) + +## 完整示例 + +```ts +import camera from '@ohos.multimedia.camera' +import image from '@ohos.multimedia.image' +import media from '@ohos.multimedia.media' + +// 创建CameraManager对象 +context: any = getContext(this) +let cameraManager = camera.getCameraManager(this.context) +if (!cameraManager) { + console.error("camera.getCameraManager error") + return; +} +// 监听相机状态变化 +cameraManager.on('cameraStatus', (cameraStatusInfo) => { + console.info(`camera : ${cameraStatusInfo.camera.cameraId}`); + console.info(`status: ${cameraStatusInfo.status}`); +}) + +// 获取相机列表 +let cameraArray = cameraManager.getSupportedCameras(); +if (cameraArray.length <= 0) { + console.error("cameraManager.getSupportedCameras error") + return; +} + +for (let index = 0; index < cameraArray.length; index++) { + console.info('cameraId : ' + cameraArray[index].cameraId); // 获取相机ID + console.info('cameraPosition : ' + cameraArray[index].cameraPosition); // 获取相机位置 + console.info('cameraType : ' + cameraArray[index].cameraType); // 获取相机类型 + console.info('connectionType : ' + cameraArray[index].connectionType); // 获取相机连接类型 +} + +// 创建相机输入流 +let cameraInput +try { + cameraInput = cameraManager.createCameraInput(cameraArray[0]); +} catch (error) { + console.error('Failed to createCameraInput errorCode = ' + error.code); +} + +// 监听cameraInput错误信息 +let cameraDevice = cameraArray[0]; +cameraInput.on('error', cameraDevice, (error) => { + console.info(`Camera input error code: ${error.code}`); +}) + +// 打开相机 +await cameraInput.open(); + +// 获取相机设备支持的输出流能力 +let cameraOutputCap = cameraManager.getSupportedOutputCapability(cameraArray[0]); +if (!cameraOutputCap) { + console.error("cameraManager.getSupportedOutputCapability error") + return; +} +console.info("outputCapability: " + JSON.stringify(cameraOutputCap)); + +let previewProfilesArray = cameraOutputCap.previewProfiles; +if (!previewProfilesArray) { + console.error("createOutput previewProfilesArray == null || undefined") +} + +let photoProfilesArray = cameraOutputCap.photoProfiles; +if (!photoProfilesArray) { + console.error("createOutput photoProfilesArray == null || undefined") +} + +// 创建预览输出流,其中参数 surfaceId 参考上文 XComponent 组件,预览流为XComponent组件提供的surface +let previewOutput +try { + previewOutput = cameraManager.createPreviewOutput(previewProfilesArray[0], surfaceId) +} catch (error) { + console.error("Failed to create the PreviewOutput instance.") +} + +// 监听预览输出错误信息 +previewOutput.on('error', (error) => { + console.info(`Preview output error code: ${error.code}`); +}) + +// 创建ImageReceiver对象,并设置照片参数:分辨率大小是根据前面 photoProfilesArray 获取的当前设备所支持的拍照分辨率大小去设置 +let imageReceiver = await image.createImageReceiver(1920, 1080, 4, 8) +// 获取照片显示SurfaceId +let photoSurfaceId = await imageReceiver.getReceivingSurfaceId() +// 创建拍照输出流 +let photoOutput +try { + photoOutput = cameraManager.createPhotoOutput(photoProfilesArray[0], photoSurfaceId) +} catch (error) { + console.error('Failed to createPhotoOutput errorCode = ' + error.code); +} +//创建会话 +let captureSession +try { + captureSession = cameraManager.createCaptureSession() +} catch (error) { + console.error('Failed to create the CaptureSession instance. errorCode = ' + error.code); +} + +// 监听session错误信息 +captureSession.on('error', (error) => { + console.info(`Capture session error code: ${error.code}`); +}) + +// 开始配置会话 +try { + captureSession.beginConfig() +} catch (error) { + console.error('Failed to beginConfig. errorCode = ' + error.code); +} + +// 向会话中添加相机输入流 +try { + captureSession.addInput(cameraInput) +} catch (error) { + console.error('Failed to addInput. errorCode = ' + error.code); +} + +// 向会话中添加预览输出流 +try { + captureSession.addOutput(previewOutput) +} catch (error) { + console.error('Failed to addOutput(previewOutput). errorCode = ' + error.code); +} + +// 向会话中添加拍照输出流 +try { + captureSession.addOutput(photoOutput) +} catch (error) { + console.error('Failed to addOutput(photoOutput). errorCode = ' + error.code); +} + +// 提交会话配置 +await captureSession.commitConfig() + +// 启动会话 +await captureSession.start().then(() => { + console.info('Promise returned to indicate the session start success.'); +}) +// 判断设备是否支持闪光灯 +let flashStatus +try { + flashStatus = captureSession.hasFlash() +} catch (error) { + console.error('Failed to hasFlash. errorCode = ' + error.code); +} +console.info('Promise returned with the flash light support status:' + flashStatus); + +if (flashStatus) { + // 判断是否支持自动闪光灯模式 + let flashModeStatus + try { + let status = captureSession.isFlashModeSupported(camera.FlashMode.FLASH_MODE_AUTO) + flashModeStatus = status + } catch (error) { + console.error('Failed to check whether the flash mode is supported. errorCode = ' + error.code); + } + if(flashModeStatus) { + // 设置自动闪光灯模式 + try { + captureSession.setFlashMode(camera.FlashMode.FLASH_MODE_AUTO) + } catch (error) { + console.error('Failed to set the flash mode. errorCode = ' + error.code); + } + } +} + +// 判断是否支持连续自动变焦模式 +let focusModeStatus +try { + let status = captureSession.isFocusModeSupported(camera.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO) + focusModeStatus = status +} catch (error) { + console.error('Failed to check whether the focus mode is supported. errorCode = ' + error.code); +} + +if (focusModeStatus) { + // 设置连续自动变焦模式 + try { + captureSession.setFocusMode(camera.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO) + } catch (error) { + console.error('Failed to set the focus mode. errorCode = ' + error.code); + } +} + +// 获取相机支持的可变焦距比范围 +let zoomRatioRange +try { + zoomRatioRange = captureSession.getZoomRatioRange() +} catch (error) { + console.error('Failed to get the zoom ratio range. errorCode = ' + error.code); +} + +// 设置可变焦距比 +try { + captureSession.setZoomRatio(zoomRatioRange[0]) +} catch (error) { + console.error('Failed to set the zoom ratio value. errorCode = ' + error.code); +} +let settings = { + quality: camera.QualityLevel.QUALITY_LEVEL_HIGH, // 设置图片质量高 + rotation: camera.ImageRotation.ROTATION_0 // 设置图片旋转角度0 +} +// 使用当前拍照设置进行拍照 +photoOutput.capture(settings, async (err) => { + if (err) { + console.error('Failed to capture the photo ${err.message}'); + return; + } + console.info('Callback invoked to indicate the photo capture request success.'); +}); +// 停止当前会话 +captureSession.stop() + +// 释放相机输入流 +cameraInput.close() + +// 释放预览输出流 +previewOutput.release() + +// 释放拍照输出流 +photoOutput.release() + +// 释放会话 +captureSession.release() + +// 会话置空 +captureSession = null +``` + diff --git a/zh-cn/application-dev/media/camera-shooting.md b/zh-cn/application-dev/media/camera-shooting.md new file mode 100644 index 0000000000000000000000000000000000000000..1b868fb8ba241472f95e2b3011dede1810bd8435 --- /dev/null +++ b/zh-cn/application-dev/media/camera-shooting.md @@ -0,0 +1,159 @@ +# 拍照 + +拍照是相机的最重要功能之一,拍照模块基于相机复杂的逻辑,为了保证用户拍出的照片质量,在中间步骤可以设置分辨率、闪光灯、焦距、照片质量及旋转角度等信息。 + +## 开发步骤 + +详细的API说明请参考[Camera API参考](../reference/apis/js-apis-camera.md)。 + +1. 导入image接口。创建拍照输出流的SurfaceId以及拍照输出的数据,都需要用到系统提供的image接口能力,导入image接口的方法如下。 + + ```ts + import image from '@ohos.multimedia.image'; + ``` + +2. 获取SurfaceId。 + + 通过image的createImageReceiver方法创建ImageReceiver实例,再通过实例的getReceivingSurfaceId方法获取SurfaceId,与拍照输出流相关联,获取拍照输出流的数据。 + + ```ts + function getImageReceiverSurfaceId() { + let receiver = image.createImageReceiver(640, 480, 4, 8); + console.info('before ImageReceiver check'); + if (receiver !== undefined) { + console.info('ImageReceiver is ok'); + let photoSurfaceId = receiver.getReceivingSurfaceId(); + console.info('ImageReceived id: ' + JSON.stringify(photoSurfaceId)); + } else { + console.info('ImageReceiver is not ok'); + } + } + ``` + +3. 创建拍照输出流。 + + 通过CameraOutputCapability类中的photoProfiles()方法,可获取当前设备支持的拍照输出流,通过createPhotoOutput()方法传入支持的某一个输出流及步骤一获取的SurfaceId创建拍照输出流。 + + ```ts + let photoProfilesArray = cameraOutputCapability.photoProfiles; + if (!photoProfilesArray) { + console.error("createOutput photoProfilesArray == null || undefined"); + } + let photoOutput; + try { + photoOutput = cameraManager.createPhotoOutput(photoProfilesArray[0], photoSurfaceId); + } catch (error) { + console.error('Failed to createPhotoOutput errorCode = ' + error.code); + } + ``` + +4. 参数配置。 + + 配置相机的参数可以调整拍照的一些功能,包括闪光灯、变焦、焦距等。 + + ```ts + // 判断设备是否支持闪光灯 + let flashStatus; + try { + flashStatus = captureSession.hasFlash(); + } catch (error) { + console.error('Failed to hasFlash. errorCode = ' + error.code); + } + console.info('Promise returned with the flash light support status:' + flashStatus); + if (flashStatus) { + // 判断是否支持自动闪光灯模式 + let flashModeStatus; + try { + let status = captureSession.isFlashModeSupported(camera.FlashMode.FLASH_MODE_AUTO); + flashModeStatus = status; + } catch (error) { + console.error('Failed to check whether the flash mode is supported. errorCode = ' + error.code); + } + if(flashModeStatus) { + // 设置自动闪光灯模式 + try { + captureSession.setFlashMode(camera.FlashMode.FLASH_MODE_AUTO); + } catch (error) { + console.error('Failed to set the flash mode. errorCode = ' + error.code); + } + } + } + // 判断是否支持连续自动变焦模式 + let focusModeStatus; + try { + let status = captureSession.isFocusModeSupported(camera.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); + focusModeStatus = status; + } catch (error) { + console.error('Failed to check whether the focus mode is supported. errorCode = ' + error.code); + } + if (focusModeStatus) { + // 设置连续自动变焦模式 + try { + captureSession.setFocusMode(camera.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO); + } catch (error) { + console.error('Failed to set the focus mode. errorCode = ' + error.code); + } + } + // 获取相机支持的可变焦距比范围 + let zoomRatioRange; + try { + zoomRatioRange = captureSession.getZoomRatioRange(); + } catch (error) { + console.error('Failed to get the zoom ratio range. errorCode = ' + error.code); + } + // 设置可变焦距比 + try { + captureSession.setZoomRatio(zoomRatioRange[0]); + } catch (error) { + console.error('Failed to set the zoom ratio value. errorCode = ' + error.code); + } + ``` + +5. 触发拍照。 + + 通过photoOutput类的capture()方法,执行拍照任务。该方法有两个参数,第一个参数为拍照设置参数的setting,setting中可以设置照片的质量和旋转角度,第二参数为回调函数。 + + ```ts + let settings = { + quality: camera.QualityLevel.QUALITY_LEVEL_HIGH, // 设置图片质量高 + rotation: camera.ImageRotation.ROTATION_0, // 设置图片旋转角度0 + location: captureLocation, // 设置图片地理位置 + mirror: false // 设置镜像使能开关(默认关) + }; + photoOutput.capture(settings, async (err) => { + if (err) { + console.error('Failed to capture the photo ${err.message}'); + return; + } + console.info('Callback invoked to indicate the photo capture request success.'); + }); + ``` + +## 状态监听 + +在相机应用开发过程中,可以随时监听拍照输出流状态,包括拍照流开始、拍照帧的开始与结束、拍照输出流的错误。 + +- 通过注册固定的captureStart回调函数获取监听拍照开始结果,photoOutput创建成功时即可监听,拍照第一次曝光时触发,该事件返回此次拍照的captureId。 + + ```ts + photoOutput.on('captureStart', (captureId) => { + console.info(`photo capture stated, captureId : ${captureId}`); + }) + ``` + +- 通过注册固定的captureEnd回调函数获取监听拍照结束结果,photoOutput创建成功时即可监听,该事件返回结果为拍照完全结束后的相关信息[CaptureEndInfo](../reference/apis/js-apis-camera.md#captureendinfo)。 + + ```ts + photoOutput.on('captureEnd', (captureEndInfo) => { + console.info(`photo capture end, captureId : ${captureEndInfo.captureId}`); + console.info(`frameCount : ${captureEndInfo.frameCount}`); + }) + ``` + +- 通过注册固定的error回调函数获取监听拍照输出流的错误结果。callback返回拍照输出接口使用错误时的对应错误码,错误码类型参见[CameraErrorCode](../reference/apis/js-apis-camera.md#cameraerrorcode)。 + + ```ts + photoOutput.on('error', (error) => { + console.info(`Photo output error code: ${error.code}`); + }) + ``` diff --git a/zh-cn/application-dev/media/camera.md b/zh-cn/application-dev/media/camera.md deleted file mode 100644 index 8ca2a6e6484b717359c0399f05ebe901daaf85c4..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/media/camera.md +++ /dev/null @@ -1,511 +0,0 @@ -# 相机开发指导 - -## 场景介绍 - -OpenHarmony相机模块支持相机业务的开发,开发者可以通过已开放的接口实现相机硬件的访问、操作和新功能开发,最常见的操作如:预览、拍照和录像等。开发者也可以通过合适的接口或者接口组合实现闪光灯控制、曝光时间控制、手动对焦和自动对焦控制、变焦控制以及更多的功能。 - -开发者在调用Camera能力时,需要了解Camera的一些基本概念: - -- **相机静态能力**:用于描述相机的固有能力的一系列参数,比如朝向、支持的分辨率等信息。 -- **物理相机**:物理相机就是独立的实体摄像头设备。物理相机ID是用于标志每个物理摄像头的唯一字串。 -- **异步操作**:为保证UI线程不被阻塞,部分Camera接口采用异步调用方式。异步方式API均提供了callback函数和Promise函数。 - -## 开发步骤 - -### 接口说明 - -详细API含义请参考:[相机管理API文档](../reference/apis/js-apis-camera.md) - -### 全流程场景 - -包含流程:权限申请、创建实例、参数设置、会话管理、拍照、录像、释放资源等。 - -#### 权限申请 - -在使用相机之前,需要申请相机的相关权限,保证应用拥有相机硬件及其他功能权限,应用权限的介绍请参考权限章节,相机涉及权限如下表。 - -| 权限名称 | 权限属性值 | -| -------- | ------------------------------ | -| 相机权限 | ohos.permission.CAMERA | -| 录音权限 | ohos.permission.MICROPHONE | -| 存储权限 | ohos.permission.WRITE_MEDIA | -| 读取权限 | ohos.permission.READ_MEDIA | -| 位置权限 | ohos.permission.MEDIA_LOCATION | - -参考代码如下: - -```typescript -const PERMISSIONS: Array = [ - 'ohos.permission.CAMERA', - 'ohos.permission.MICROPHONE', - 'ohos.permission.MEDIA_LOCATION', - 'ohos.permission.READ_MEDIA', - 'ohos.permission.WRITE_MEDIA' -] - -function applyPermission() { - console.info('[permission] get permission'); - globalThis.abilityContext.requestPermissionFromUser(PERMISSIONS) - } -``` - -#### 创建实例 - -在实现一个相机应用之前必须先创建一个独立的相机设备,然后才能继续相机的其他操作。如果此步骤操作失败,相机可能被占用或无法使用。如果被占用,必须等到相机释放后才能重新获取CameraManager对象。通过getSupportedCameras() 方法,获取当前使用的设备支持的相机列表。相机列表中存储了当前设备拥有的所有相机ID,如果列表不为空,则列表中的每个ID都支持独立创建相机对象;否则,说明正在使用的设备无可用的相机,不能继续后续的操作。相机设备具备预览、拍照、录像、Metadata等输出流,需要通过getSupportedOutputCapability()接口获取各个输出流的具体能力,通过该接口,可以获取当前设备支持的所有输出流能力,分别在CameraOutputCapability中的各个profile字段中,相机设备创建的建议步骤如下: - -```typescript -import camera from '@ohos.multimedia.camera' -import image from '@ohos.multimedia.image' -import media from '@ohos.multimedia.media' - -// 创建CameraManager对象 -context: any = getContext(this) -let cameraManager = camera.getCameraManager(this.context) -if (!cameraManager) { - console.error("camera.getCameraManager error") - return; -} -// 监听相机状态变化 -cameraManager.on('cameraStatus', (cameraStatusInfo) => { - console.log(`camera : ${cameraStatusInfo.camera.cameraId}`); - console.log(`status: ${cameraStatusInfo.status}`); -}) - -// 获取相机列表 -let cameraArray = cameraManager.getSupportedCameras(); -if (cameraArray.length <= 0) { - console.error("cameraManager.getSupportedCameras error") - return; -} - -for (let index = 0; index < cameraArray.length; index++) { - console.log('cameraId : ' + cameraArray[index].cameraId); // 获取相机ID - console.log('cameraPosition : ' + cameraArray[index].cameraPosition); // 获取相机位置 - console.log('cameraType : ' + cameraArray[index].cameraType); // 获取相机类型 - console.log('connectionType : ' + cameraArray[index].connectionType); // 获取相机连接类型 -} - -// 创建相机输入流 -let cameraInput -try { - cameraInput = cameraManager.createCameraInput(cameraArray[0]); -} catch () { - console.error('Failed to createCameraInput errorCode = ' + error.code); -} - -// 监听cameraInput错误信息 -let cameraDevice = cameraArray[0]; -cameraInput.on('error', cameraDevice, (error) => { - console.log(`Camera input error code: ${error.code}`); -}) - -// 打开相机 -await cameraInput.open(); - -// 获取相机设备支持的输出流能力 -let cameraOutputCap = cameraManager.getSupportedOutputCapability(cameraArray[0]); -if (!cameraOutputCap) { - console.error("cameraManager.getSupportedOutputCapability error") - return; -} -console.info("outputCapability: " + JSON.stringify(cameraOutputCap)); - -let previewProfilesArray = cameraOutputCap.previewProfiles; -if (!previewProfilesArray) { - console.error("createOutput previewProfilesArray == null || undefined") -} - -let photoProfilesArray = cameraOutputCap.photoProfiles; -if (!photoProfilesArray) { - console.error("createOutput photoProfilesArray == null || undefined") -} - -let videoProfilesArray = cameraOutputCap.videoProfiles; -if (!videoProfilesArray) { - console.error("createOutput videoProfilesArray == null || undefined") -} - -let metadataObjectTypesArray = cameraOutputCap.supportedMetadataObjectTypes; -if (!metadataObjectTypesArray) { - console.error("createOutput metadataObjectTypesArray == null || undefined") -} - -// 创建预览输出流,其中参数 surfaceId 参考下面 XComponent 组件,预览流为XComponent组件提供的surface -let previewOutput -try { - previewOutput = cameraManager.createPreviewOutput(previewProfilesArray[0], surfaceId) -} catch (error) { - console.error("Failed to create the PreviewOutput instance.") -} - -// 监听预览输出错误信息 -previewOutput.on('error', (error) => { - console.log(`Preview output error code: ${error.code}`); -}) - -// 创建ImageReceiver对象,并设置照片参数:分辨率大小是根据前面 photoProfilesArray 获取的当前设备所支持的拍照分辨率大小去设置 -let imageReceiver = await image.createImageReceiver(1920, 1080, 4, 8) -// 获取照片显示SurfaceId -let photoSurfaceId = await imageReceiver.getReceivingSurfaceId() -// 创建拍照输出流 -let photoOutput -try { - photoOutput = cameraManager.createPhotoOutput(photoProfilesArray[0], photoSurfaceId) -} catch (error) { - console.error('Failed to createPhotoOutput errorCode = ' + error.code); -} - -// 创建视频录制的参数 -let videoConfig = { - audioSourceType: 1, - videoSourceType: 1, - profile: { - audioBitrate: 48000, - audioChannels: 2, - audioCodec: 'audio/mp4v-es', - audioSampleRate: 48000, - durationTime: 1000, - fileFormat: 'mp4', - videoBitrate: 48000, - videoCodec: 'video/mp4v-es', - videoFrameWidth: 640, - videoFrameHeight: 480, - videoFrameRate: 30 - }, - url: 'file:///data/media/01.mp4', - orientationHint: 0, - maxSize: 100, - maxDuration: 500, - rotation: 0 -} - -// 创建录像输出流 -let videoRecorder -media.createVideoRecorder().then((recorder) => { - console.log('createVideoRecorder called') - videoRecorder = recorder -}) -// 设置视频录制的参数 -videoRecorder.prepare(videoConfig) -//获取录像SurfaceId -let videoSurfaceId -videoRecorder.getInputSurface().then((id) => { - console.log('getInputSurface called') - videoSurfaceId = id -}) - -// 创建VideoOutput对象 -let videoOutput -try { - videoOutput = cameraManager.createVideoOutput(videoProfilesArray[0], videoSurfaceId) -} catch (error) { - console.error('Failed to create the videoOutput instance. errorCode = ' + error.code); -} - -// 监听视频输出错误信息 -videoOutput.on('error', (error) => { - console.log(`Preview output error code: ${error.code}`); -}) -``` -预览流、拍照流和录像流的输入均需要提前创建surface,其中预览流为XComponent组件提供的surface,拍照流为ImageReceiver提供的surface,录像流为VideoRecorder的surface。 - -**XComponent** - -```typescript -mXComponentController: XComponentController = new XComponentController // 创建XComponentController - -build() { - Flex() { - XComponent({ // 创建XComponent - id: '', - type: 'surface', - libraryname: '', - controller: this.mXComponentController - }) - .onload(() => { // 设置onload回调 - // 设置Surface宽高(1920*1080),预览尺寸设置参考前面 previewProfilesArray 获取的当前设备所支持的预览分辨率大小去设置 - this.mXComponentController.setXComponentSurfaceSize({surfaceWidth:1920,surfaceHeight:1080}) - // 获取Surface ID - globalThis.surfaceId = mXComponentController.getXComponentSurfaceId() - }) - .width('1920px') // 设置XComponent宽度 - .height('1080px') // 设置XComponent高度 - } -} -``` - -**ImageReceiver** - -```typescript -function getImageReceiverSurfaceId() { - let receiver = image.createImageReceiver(640, 480, 4, 8) - console.log(TAG + 'before ImageReceiver check') - if (receiver !== undefined) { - console.log('ImageReceiver is ok') - surfaceId1 = receiver.getReceivingSurfaceId() - console.log('ImageReceived id: ' + JSON.stringify(surfaceId1)) - } else { - console.log('ImageReceiver is not ok') - } - } -``` - -**VideoRecorder** - -```typescript -function getVideoRecorderSurface() { - await getFd('CameraManager.mp4'); - mVideoConfig.url = mFdPath; - media.createVideoRecorder((err, recorder) => { - console.info('Entering create video receiver') - mVideoRecorder = recorder - console.info('videoRecorder is :' + JSON.stringify(mVideoRecorder)) - console.info('videoRecorder.prepare called.') - mVideoRecorder.prepare(mVideoConfig, (err) => { - console.info('videoRecorder.prepare success.') - mVideoRecorder.getInputSurface((err, id) => { - console.info('getInputSurface called') - mVideoSurface = id - console.info('getInputSurface surfaceId: ' + JSON.stringify(mVideoSurface)) - }) - }) - }) - } -``` - -#### 会话管理 - -##### 创建会话 - -```typescript -//创建会话 -let captureSession -try { - captureSession = cameraManager.createCaptureSession() -} catch (error) { - console.error('Failed to create the CaptureSession instance. errorCode = ' + error.code); -} - -// 监听session错误信息 -captureSession.on('error', (error) => { - console.log(`Capture session error code: ${error.code}`); -}) - -// 开始配置会话 -try { - captureSession.beginConfig() -} catch (error) { - console.error('Failed to beginConfig. errorCode = ' + error.code); -} - -// 向会话中添加相机输入流 -try { - captureSession.addInput(cameraInput) -} catch (error) { - console.error('Failed to addInput. errorCode = ' + error.code); -} - -// 向会话中添加预览输入流 -try { - captureSession.addOutput(previewOutput) -} catch (error) { - console.error('Failed to addOutput(previewOutput). errorCode = ' + error.code); -} - -// 向会话中添加拍照输出流 -try { - captureSession.addOutput(photoOutput) -} catch (error) { - console.error('Failed to addOutput(photoOutput). errorCode = ' + error.code); -} - -// 提交会话配置 -await captureSession.commitConfig() - -// 启动会话 -await captureSession.start().then(() => { - console.log('Promise returned to indicate the session start success.'); -}) -``` - -##### 切换会话 - -```typescript -// 停止当前会话 -await captureSession.stop() - -// 开始配置会话 -try { - captureSession.beginConfig() -} catch (error) { - console.error('Failed to beginConfig. errorCode = ' + error.code); -} - -// 从会话中移除拍照输出流 -try { - captureSession.removeOutput(photoOutput) -} catch (error) { - console.error('Failed to removeOutput(photoOutput). errorCode = ' + error.code); -} - -// 向会话中添加录像输出流 -try { - captureSession.addOutput(videoOutput) -} catch (error) { - console.error('Failed to addOutput(videoOutput). errorCode = ' + error.code); -} - -// 提交会话配置 -await captureSession.commitConfig() - -// 启动会话 -await captureSession.start().then(() => { - console.log('Promise returned to indicate the session start success.'); -}) -``` - -#### 参数设置 - -```typescript -// 判断设备是否支持闪光灯 -let flashStatus -try { - flashStatus = captureSession.hasFlash() -} catch (error) { - console.error('Failed to hasFlash. errorCode = ' + error.code); -} -console.log('Promise returned with the flash light support status:' + flashStatus); - -if (flashStatus) { - // 判断是否支持自动闪光灯模式 - let flashModeStatus - try { - let status = captureSession.isFlashModeSupported(camera.FlashMode.FLASH_MODE_AUTO) - flashModeStatus = status - } catch (error) { - console.error('Failed to check whether the flash mode is supported. errorCode = ' + error.code); - } - if(flashModeStatus) { - // 设置自动闪光灯模式 - try { - captureSession.setFlashMode(camera.FlashMode.FLASH_MODE_AUTO) - } catch (error) { - console.error('Failed to set the flash mode. errorCode = ' + error.code); - } - } -} - -// 判断是否支持连续自动变焦模式 -let focusModeStatus -try { - let status = captureSession.isFocusModeSupported(camera.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO) - focusModeStatus = status -} catch (error) { - console.error('Failed to check whether the focus mode is supported. errorCode = ' + error.code); -} - -if (focusModeStatus) { - // 设置连续自动变焦模式 - try { - captureSession.setFocusMode(camera.FocusMode.FOCUS_MODE_CONTINUOUS_AUTO) - } catch (error) { - console.error('Failed to set the focus mode. errorCode = ' + error.code); - } -} - -// 获取相机支持的可变焦距比范围 -let zoomRatioRange -try { - zoomRatioRange = captureSession.getZoomRatioRange() -} catch (error) { - console.error('Failed to get the zoom ratio range. errorCode = ' + error.code); -} - -// 设置可变焦距比 -try { - captureSession.setZoomRatio(zoomRatioRange[0]) -} catch (error) { - console.error('Failed to set the zoom ratio value. errorCode = ' + error.code); -} -``` - -#### 拍照 - -```typescript -let settings = { - quality: camera.QualityLevel.QUALITY_LEVEL_HIGH, // 设置图片质量高 - rotation: camera.ImageRotation.ROTATION_0 // 设置图片旋转角度0 -} -// 使用当前拍照设置进行拍照 -photoOutput.capture(settings, async (err) => { - if (err) { - console.error('Failed to capture the photo ${err.message}'); - return; - } - console.log('Callback invoked to indicate the photo capture request success.'); -}); -``` - -#### 录像 - -```typescript -// 启动录像输出流 -videoOutput.start(async (err) => { - if (err) { - console.error('Failed to start the video output ${err.message}'); - return; - } - console.log('Callback invoked to indicate the video output start success.'); -}); - -// 开始录像 -videoRecorder.start().then(() => { - console.info('videoRecorder start success'); -} - -// 停止录像 -videoRecorder.stop().then(() => { - console.info('stop success'); -} - -// 停止录像输出流 -videoOutput.stop((err) => { - if (err) { - console.error('Failed to stop the video output ${err.message}'); - return; - } - console.log('Callback invoked to indicate the video output stop success.'); -}); -``` - -拍照保存接口可参考:[图片处理API文档](image.md#imagereceiver的使用) - -#### 释放资源 - -```typescript -// 停止当前会话 -captureSession.stop() - -// 释放相机输入流 -cameraInput.close() - -// 释放预览输出流 -previewOutput.release() - -// 释放拍照输出流 -photoOutput.release() - -// 释放录像输出流 -videoOutput.release() - -// 释放会话 -captureSession.release() - -// 会话置空 -captureSession = null -``` - -## 流程图 - -应用使用相机的流程示意图如下 -![camera_framework process](figures/camera_framework_process.png) \ No newline at end of file diff --git a/zh-cn/application-dev/media/distributed-audio-playback.md b/zh-cn/application-dev/media/distributed-audio-playback.md new file mode 100644 index 0000000000000000000000000000000000000000..8b6473a6f48fa8f625efc3c5f35259992f4c0cf2 --- /dev/null +++ b/zh-cn/application-dev/media/distributed-audio-playback.md @@ -0,0 +1,101 @@ +# 分布式音频播放(仅对系统应用开放) + +通过分布式音频播放的能力,用户可以将音频投播远端设备播放,实现音频在组网中不同设备之间流转。 + +开发者可以通过分布式音频播放,将当前设备播放的所有音频投放到指定的远端设备播放,或将设备播放的某个音频流投放到指定的远端设备播放。 + +## 开发步骤及示例 + +在将音频投播到组网内其他设备前,需要先获取组网内的设备列表,并监听设备连接状态的变化,具体开发步骤请参考[音频输出设备管理](audio-output-device-management.md)。 + +在获取组网内的设备列表时,可以通过指定DeviceFlag,筛选出需要的设备。 + +| 名称 | 说明 | +| -------- | -------- | +| NONE_DEVICES_FLAG9+ | 无。此接口为系统接口。 | +| OUTPUT_DEVICES_FLAG | 本地输出设备。 | +| INPUT_DEVICES_FLAG | 本地输入设备。 | +| ALL_DEVICES_FLAG | 本地输入输出设备。 | +| DISTRIBUTED_OUTPUT_DEVICES_FLAG9+ | 分布式输出设备。 此接口为系统接口。 | +| DISTRIBUTED_INPUT_DEVICES_FLAG9+ | 分布式输入设备。 此接口为系统接口。 | +| ALL_DISTRIBUTED_DEVICES_FLAG9+ | 分布式输入输出设备。 此接口为系统接口。 | + +具体接口说明请参考[AudioRoutingManager API文档](../reference/apis/js-apis-audio.md#audioroutingmanager9)。 + +### 投播所有音频 + +1. [获取输出设备信息](audio-output-device-management.md#获取输出设备信息)。 + +2. 创建AudioDeviceDescriptor对象,用于指定音频输出设备。 + +3. 调用selectOutputDevice,将当前设备播放的所有音频投放到指定的远端设备播放。 + +```ts +let outputAudioDeviceDescriptor = [{ + deviceRole: audio.DeviceRole.OUTPUT_DEVICE, + deviceType: audio.DeviceType.SPEAKER, + id: 1, + name: "", + address: "", + sampleRates: [44100], + channelCounts: [2], + channelMasks: [0], + networkId: audio.LOCAL_NETWORK_ID, + interruptGroupId: 1, + volumeGroupId: 1, +}]; + +async function selectOutputDevice() { + audioRoutingManager.selectOutputDevice(outputAudioDeviceDescriptor, (err) => { + if (err) { + console.error(`Invoke selectOutputDevice failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info('Invoke selectOutputDevice succeeded.'); + } + }); +} +``` + +### 投播指定音频流 + +1. [获取输出设备信息](audio-output-device-management.md#获取输出设备信息)。 + +2. 创建AudioRendererFilter对象,通过uid指定应用,通过rendererId指定音频流。 + +3. 创建AudioDeviceDescriptor对象,用于指定音频输出设备。 + +4. 调用selectOutputDeviceByFilter,将当前设备播放的指定音频流投放到指定的远端设备播放。 + +```ts +let outputAudioRendererFilter = { + uid: 20010041, + rendererInfo: { + content: audio.ContentType.CONTENT_TYPE_MUSIC, + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags: 0 }, + rendererId: 0 }; + +let outputAudioDeviceDescriptor = [{ + deviceRole: audio.DeviceRole.OUTPUT_DEVICE, + deviceType: audio.DeviceType.SPEAKER, + id: 1, + name: "", + address: "", + sampleRates: [44100], + channelCounts: [2], + channelMasks: [0], + networkId: audio.LOCAL_NETWORK_ID, + interruptGroupId: 1, + volumeGroupId: 1, +}]; + +async function selectOutputDeviceByFilter() { + audioRoutingManager.selectOutputDeviceByFilter(outputAudioRendererFilter, outputAudioDeviceDescriptor, (err) => { + if (err) { + console.error(`Invoke selectOutputDeviceByFilter failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info('Invoke selectOutputDeviceByFilter succeeded.'); + } + }); +} +``` diff --git a/zh-cn/application-dev/media/distributed-avsession-overview.md b/zh-cn/application-dev/media/distributed-avsession-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..77b70df46cf0ff9a0748d393b9c8f92681835014 --- /dev/null +++ b/zh-cn/application-dev/media/distributed-avsession-overview.md @@ -0,0 +1,52 @@ +# 分布式媒体会话概述 + +OpenHarmony提供的媒体会话允许用户把本地播放的媒体投播到远端分布式设备上,从而实现更好的播放效果,例如将平板上播放的音频投播到智能音箱。 + +当用户将音频媒体投播到远端设备后,可以实时将媒体信息同步到远端设备,同时远端被投播的设备也可以反向控制源端音源,进行上一首/下一首/播放/暂停等控制,用户层面上整个播放控制流程和本地播放一致。 + + +## 交互过程 + +当本地投播主控端设备与远端被控端设备成功配对之后,主控端设备中的媒体会话控制方,可以通过媒体会话管理器将媒体投播到被控设备上,实现分布式媒体会话,交互过程如图所示。 + +![Distributed AVSession Interaction Process](figures/distributed-avsession-interaction-process.png) + +媒体投播时,被控端设备上的AVSession服务会自动创建一个与主控设备保持同步的媒体会话,主控设备的会话信息、主控设备的命令事件与被控设备上的命令事件时刻保持同步。 + +## 分布式媒体会话流程 + +用户进行了分布式投播以后,在投播被控端自动创建出对应的媒体会话,两侧的媒体会话可以相互联动,具体体现在: + +1. 主控端本地媒体会话服务接收到音频跨设备切换命令后将本端的媒体会话信息同步到远端。 + +2. 远端播控中心监听到新增会话后,创建对应会话的控制器。 + +3. 远端播控中心可以通过远端的控制器将控制命令发送到主控端本地媒体会话。 + +4. 主控端本地媒体会话接收远端控制命令后,回调到本端的音频类应用。 + +5. 主控端本地的媒体会话信息变更实时同步到远端播控中心显示。 + +6. 远端设备连接断开后,音频切回主控端本地并暂停播放(音频部件完成回切,媒体会话通知应用暂停)。 + +## 分布式媒体会话场景 + +应用通过分布式媒体会话进行投播时,存在两种场景: + +- 系统投播:通过媒体会话控制方,例如播控中心,发起分布式投播。 + 系统投播对所有应用生效。系统投播后,主控端设备中的所有音频默认从被控端设备播放。 + +- 应用投播:音视频应用在自身应用内通过集成投播组件发起分布式投播(当前暂未支持)。 + 应用投播对单个应用生效。应用投播后,主控端设备中发起投播的应用音频从被控端设备播放,其它应用的音频依旧从主控端设备播放。 + +另外,投播支持抢占,后投播应用可以抢占之前投播的应用,在远端设备进行音频播放。 + +## 分布式媒体会话与分布式音频播放之间的关系 + +媒体会话服务在实现分布式媒体会话进行跨设备投播时,内部的实现逻辑可以粗略描述为: + +- 调用了[分布式音频播放](distributed-audio-playback.md)能力的相关接口,将音频流投播到了远端设备。 + +- 通过分布式能力将媒体会话元数据投播到了远端设备,供远端设备获取并显示。 + +所以,通过分布式媒体会话进行投播,不仅可以实现在远端设备播放音频,而且可以让远端设备显示播放信息,同时借助媒体会话的机制,可以实现在远端设备上对播放的音频进行控制。 diff --git a/zh-cn/application-dev/media/figures/audio-capturer-state.png b/zh-cn/application-dev/media/figures/audio-capturer-state.png deleted file mode 100644 index 52b5556260dbf78c5e816b37013248a07e8dbbc6..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/media/figures/audio-capturer-state.png and /dev/null differ diff --git a/zh-cn/application-dev/media/figures/audio-playback-interaction-diagram.png b/zh-cn/application-dev/media/figures/audio-playback-interaction-diagram.png new file mode 100644 index 0000000000000000000000000000000000000000..6977b8a4b7f56fbb585b6e590aa7d80a4b674756 Binary files /dev/null and b/zh-cn/application-dev/media/figures/audio-playback-interaction-diagram.png differ diff --git a/zh-cn/application-dev/media/figures/audio-renderer-state.png b/zh-cn/application-dev/media/figures/audio-renderer-state.png deleted file mode 100644 index 9ae30c2a9306dc85662405c36da9e11d07ed9a2a..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/media/figures/audio-renderer-state.png and /dev/null differ diff --git a/zh-cn/application-dev/media/figures/audio-stream-mgmt-invoking-relationship.png b/zh-cn/application-dev/media/figures/audio-stream-mgmt-invoking-relationship.png new file mode 100644 index 0000000000000000000000000000000000000000..2179b94304f0f6321a25bdf2d5e1cab9d6814757 Binary files /dev/null and b/zh-cn/application-dev/media/figures/audio-stream-mgmt-invoking-relationship.png differ diff --git a/zh-cn/application-dev/media/figures/audiocapturer-status-change.png b/zh-cn/application-dev/media/figures/audiocapturer-status-change.png new file mode 100644 index 0000000000000000000000000000000000000000..aadbc4fb6470b7cdc0f399ee5954a96c01a7f7c3 Binary files /dev/null and b/zh-cn/application-dev/media/figures/audiocapturer-status-change.png differ diff --git a/zh-cn/application-dev/media/figures/audiorenderer-status-change.png b/zh-cn/application-dev/media/figures/audiorenderer-status-change.png new file mode 100644 index 0000000000000000000000000000000000000000..a721044f7aeccfed0260176963d192cac40dd8a6 Binary files /dev/null and b/zh-cn/application-dev/media/figures/audiorenderer-status-change.png differ diff --git a/zh-cn/application-dev/media/figures/avsession-interaction-process.png b/zh-cn/application-dev/media/figures/avsession-interaction-process.png new file mode 100644 index 0000000000000000000000000000000000000000..8c40fb6070e01fee9e0b9325f34ea6db1a862b71 Binary files /dev/null and b/zh-cn/application-dev/media/figures/avsession-interaction-process.png differ diff --git a/zh-cn/application-dev/media/figures/bitmap-operation.png b/zh-cn/application-dev/media/figures/bitmap-operation.png new file mode 100644 index 0000000000000000000000000000000000000000..8c4c585072bd5f173d32c3e6c22b6193c576419a Binary files /dev/null and b/zh-cn/application-dev/media/figures/bitmap-operation.png differ diff --git a/zh-cn/application-dev/media/figures/camera-development-model.png b/zh-cn/application-dev/media/figures/camera-development-model.png new file mode 100644 index 0000000000000000000000000000000000000000..ab7d2d9317b782701686caff871f418ba66621f8 Binary files /dev/null and b/zh-cn/application-dev/media/figures/camera-development-model.png differ diff --git a/zh-cn/application-dev/media/figures/camera-workflow.png b/zh-cn/application-dev/media/figures/camera-workflow.png new file mode 100644 index 0000000000000000000000000000000000000000..ff41ca019502bea5e54e94b7318a017efaf22861 Binary files /dev/null and b/zh-cn/application-dev/media/figures/camera-workflow.png differ diff --git a/zh-cn/application-dev/media/figures/camera_framework_process.png b/zh-cn/application-dev/media/figures/camera_framework_process.png deleted file mode 100644 index 8dfd6c0d05c643fbd715fe6cf1b7431e01fff3e2..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/media/figures/camera_framework_process.png and /dev/null differ diff --git a/zh-cn/application-dev/media/figures/cropping.jpeg b/zh-cn/application-dev/media/figures/cropping.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..a564818815eb3fde13a40ef02d0811bd56803fb9 Binary files /dev/null and b/zh-cn/application-dev/media/figures/cropping.jpeg differ diff --git a/zh-cn/application-dev/media/figures/distributed-avsession-interaction-process.png b/zh-cn/application-dev/media/figures/distributed-avsession-interaction-process.png new file mode 100644 index 0000000000000000000000000000000000000000..250c3aa0d38f815e768a34407581dfb46a0eba31 Binary files /dev/null and b/zh-cn/application-dev/media/figures/distributed-avsession-interaction-process.png differ diff --git a/zh-cn/application-dev/media/figures/horizontal-flip.jpeg b/zh-cn/application-dev/media/figures/horizontal-flip.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..f43e4f6ab2adc68bf0f90eaf8177d36ee91f32ac Binary files /dev/null and b/zh-cn/application-dev/media/figures/horizontal-flip.jpeg differ diff --git a/zh-cn/application-dev/media/figures/image-development-process.png b/zh-cn/application-dev/media/figures/image-development-process.png new file mode 100644 index 0000000000000000000000000000000000000000..2ef40b6049507edfccb75feef71e99ac5bdb6f77 Binary files /dev/null and b/zh-cn/application-dev/media/figures/image-development-process.png differ diff --git a/zh-cn/application-dev/media/figures/invoking-relationship-recording-stream-mgmt.png b/zh-cn/application-dev/media/figures/invoking-relationship-recording-stream-mgmt.png new file mode 100644 index 0000000000000000000000000000000000000000..2179b94304f0f6321a25bdf2d5e1cab9d6814757 Binary files /dev/null and b/zh-cn/application-dev/media/figures/invoking-relationship-recording-stream-mgmt.png differ diff --git a/zh-cn/application-dev/media/figures/local-avsession-interaction-process.png b/zh-cn/application-dev/media/figures/local-avsession-interaction-process.png new file mode 100644 index 0000000000000000000000000000000000000000..f6c8772afc6c11d10617fe041c462a8a0a1f2918 Binary files /dev/null and b/zh-cn/application-dev/media/figures/local-avsession-interaction-process.png differ diff --git a/zh-cn/application-dev/media/figures/media-system-framework.png b/zh-cn/application-dev/media/figures/media-system-framework.png new file mode 100644 index 0000000000000000000000000000000000000000..a2e8cd0862c9f61509b1a6603db04a6adda40f90 Binary files /dev/null and b/zh-cn/application-dev/media/figures/media-system-framework.png differ diff --git a/zh-cn/application-dev/media/figures/offsets.jpeg b/zh-cn/application-dev/media/figures/offsets.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..ab4c87a69bae55a62feddc0ca61a0ef1081bf199 Binary files /dev/null and b/zh-cn/application-dev/media/figures/offsets.jpeg differ diff --git a/zh-cn/application-dev/media/figures/original-drawing.jpeg b/zh-cn/application-dev/media/figures/original-drawing.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..01a0b0d7022dfc0130029154fec7321bc62dfe36 Binary files /dev/null and b/zh-cn/application-dev/media/figures/original-drawing.jpeg differ diff --git a/zh-cn/application-dev/media/figures/photographing-development-process.png b/zh-cn/application-dev/media/figures/photographing-development-process.png new file mode 100644 index 0000000000000000000000000000000000000000..c4e765c855692df379e6a866f45624279986dd8e Binary files /dev/null and b/zh-cn/application-dev/media/figures/photographing-development-process.png differ diff --git a/zh-cn/application-dev/media/figures/playback-status-change.png b/zh-cn/application-dev/media/figures/playback-status-change.png new file mode 100644 index 0000000000000000000000000000000000000000..860764d3d15b93e544a6f27316584963acba2f0f Binary files /dev/null and b/zh-cn/application-dev/media/figures/playback-status-change.png differ diff --git a/zh-cn/application-dev/media/figures/recording-development-process.png b/zh-cn/application-dev/media/figures/recording-development-process.png new file mode 100644 index 0000000000000000000000000000000000000000..e983bc5c35f7aa9489798292ff0b8897a64ab6af Binary files /dev/null and b/zh-cn/application-dev/media/figures/recording-development-process.png differ diff --git a/zh-cn/application-dev/media/figures/recording-status-change.png b/zh-cn/application-dev/media/figures/recording-status-change.png new file mode 100644 index 0000000000000000000000000000000000000000..9f15af9c1992e34fa7d750d08fd0245b6cb3ba67 Binary files /dev/null and b/zh-cn/application-dev/media/figures/recording-status-change.png differ diff --git a/zh-cn/application-dev/media/figures/rotate.jpeg b/zh-cn/application-dev/media/figures/rotate.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..5965abb46dc9648a3dfd9136e7cc0b5c5203e6a7 Binary files /dev/null and b/zh-cn/application-dev/media/figures/rotate.jpeg differ diff --git a/zh-cn/application-dev/media/figures/transparency.png b/zh-cn/application-dev/media/figures/transparency.png new file mode 100644 index 0000000000000000000000000000000000000000..b9b43939f0dad8ee40bf0b6b7e40ddf49d141c66 Binary files /dev/null and b/zh-cn/application-dev/media/figures/transparency.png differ diff --git a/zh-cn/application-dev/media/figures/vertical-flip.jpeg b/zh-cn/application-dev/media/figures/vertical-flip.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..8ef368d6bb914815a90c8d82352cbd6fd9ab505c Binary files /dev/null and b/zh-cn/application-dev/media/figures/vertical-flip.jpeg differ diff --git a/zh-cn/application-dev/media/figures/video-playback-interaction-diagram.png b/zh-cn/application-dev/media/figures/video-playback-interaction-diagram.png new file mode 100644 index 0000000000000000000000000000000000000000..cc45511de12c37a147e69133fca519630c2b002d Binary files /dev/null and b/zh-cn/application-dev/media/figures/video-playback-interaction-diagram.png differ diff --git a/zh-cn/application-dev/media/figures/video-playback-status-change.png b/zh-cn/application-dev/media/figures/video-playback-status-change.png new file mode 100644 index 0000000000000000000000000000000000000000..860764d3d15b93e544a6f27316584963acba2f0f Binary files /dev/null and b/zh-cn/application-dev/media/figures/video-playback-status-change.png differ diff --git a/zh-cn/application-dev/media/figures/video-recording-interaction-diagram.png b/zh-cn/application-dev/media/figures/video-recording-interaction-diagram.png new file mode 100644 index 0000000000000000000000000000000000000000..5af22c4510a630198ba54125d220db1248e9a09d Binary files /dev/null and b/zh-cn/application-dev/media/figures/video-recording-interaction-diagram.png differ diff --git a/zh-cn/application-dev/media/figures/video-recording-status-change.png b/zh-cn/application-dev/media/figures/video-recording-status-change.png new file mode 100644 index 0000000000000000000000000000000000000000..9f15af9c1992e34fa7d750d08fd0245b6cb3ba67 Binary files /dev/null and b/zh-cn/application-dev/media/figures/video-recording-status-change.png differ diff --git a/zh-cn/application-dev/media/figures/zh-ch_image_audio_player.png b/zh-cn/application-dev/media/figures/zh-ch_image_audio_player.png deleted file mode 100644 index a95dbe631b9187136e25357cb1fd996402513c09..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/media/figures/zh-ch_image_audio_player.png and /dev/null differ diff --git a/zh-cn/application-dev/media/figures/zh-ch_image_audio_recorder_state_machine.png b/zh-cn/application-dev/media/figures/zh-ch_image_audio_recorder_state_machine.png deleted file mode 100644 index 1154a72db714494f912023517c62396ea6f66fd3..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/media/figures/zh-ch_image_audio_recorder_state_machine.png and /dev/null differ diff --git a/zh-cn/application-dev/media/figures/zh-ch_image_audio_recorder_zero.png b/zh-cn/application-dev/media/figures/zh-ch_image_audio_recorder_zero.png deleted file mode 100644 index 90f032d88e6ae0d2a843555c569aa345f19d266c..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/media/figures/zh-ch_image_audio_recorder_zero.png and /dev/null differ diff --git a/zh-cn/application-dev/media/figures/zh-ch_image_audio_routing_manager.png b/zh-cn/application-dev/media/figures/zh-ch_image_audio_routing_manager.png deleted file mode 100644 index 710679f6cac0c30d06dffa97b0e80b3cebe80f79..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/media/figures/zh-ch_image_audio_routing_manager.png and /dev/null differ diff --git a/zh-cn/application-dev/media/figures/zh-ch_image_audio_state_machine.png b/zh-cn/application-dev/media/figures/zh-ch_image_audio_state_machine.png deleted file mode 100644 index 22b7aeaa1db5b369d3daf44854d7f7f9a00f775b..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/media/figures/zh-ch_image_audio_state_machine.png and /dev/null differ diff --git a/zh-cn/application-dev/media/figures/zh-ch_image_audio_stream_manager.png b/zh-cn/application-dev/media/figures/zh-ch_image_audio_stream_manager.png deleted file mode 100644 index b5c72f9d662abb75e177534a888eef14d48d62ab..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/media/figures/zh-ch_image_audio_stream_manager.png and /dev/null differ diff --git a/zh-cn/application-dev/media/figures/zh-ch_image_audio_volume_manager.png b/zh-cn/application-dev/media/figures/zh-ch_image_audio_volume_manager.png deleted file mode 100644 index 0d47fbfacce9c1ff48811e1cf5d764231bdb596b..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/media/figures/zh-ch_image_audio_volume_manager.png and /dev/null differ diff --git a/zh-cn/application-dev/media/figures/zh-ch_image_avplayer_audio.png b/zh-cn/application-dev/media/figures/zh-ch_image_avplayer_audio.png deleted file mode 100644 index 23b05d2a51adb734eab3099c36ff438aba895df8..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/media/figures/zh-ch_image_avplayer_audio.png and /dev/null differ diff --git a/zh-cn/application-dev/media/figures/zh-ch_image_avplayer_state_machine.png b/zh-cn/application-dev/media/figures/zh-ch_image_avplayer_state_machine.png deleted file mode 100644 index aa8afdbcbf142fd745cee03fc422caec51cfe41b..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/media/figures/zh-ch_image_avplayer_state_machine.png and /dev/null differ diff --git a/zh-cn/application-dev/media/figures/zh-ch_image_avplayer_video.png b/zh-cn/application-dev/media/figures/zh-ch_image_avplayer_video.png deleted file mode 100644 index 7a3c6795de742ad057b07223b8051fd2ae576974..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/media/figures/zh-ch_image_avplayer_video.png and /dev/null differ diff --git a/zh-cn/application-dev/media/figures/zh-ch_image_avrecorder_module_interaction.png b/zh-cn/application-dev/media/figures/zh-ch_image_avrecorder_module_interaction.png deleted file mode 100644 index 99f521f7f9b020212db9c19ee64a38649dbe604b..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/media/figures/zh-ch_image_avrecorder_module_interaction.png and /dev/null differ diff --git a/zh-cn/application-dev/media/figures/zh-ch_image_avrecorder_state_machine.png b/zh-cn/application-dev/media/figures/zh-ch_image_avrecorder_state_machine.png deleted file mode 100644 index 7ffcb21f09365e9b072bdaf48f8b98d7d45a8aaa..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/media/figures/zh-ch_image_avrecorder_state_machine.png and /dev/null differ diff --git a/zh-cn/application-dev/media/figures/zh-ch_image_video_player.png b/zh-cn/application-dev/media/figures/zh-ch_image_video_player.png deleted file mode 100644 index df6ee97f4941f854884282f59400fe0bdf675bb0..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/media/figures/zh-ch_image_video_player.png and /dev/null differ diff --git a/zh-cn/application-dev/media/figures/zh-ch_image_video_recorder_state_machine.png b/zh-cn/application-dev/media/figures/zh-ch_image_video_recorder_state_machine.png deleted file mode 100644 index 6fbcfaaa11b645143534b0a76308f6586eda1124..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/media/figures/zh-ch_image_video_recorder_state_machine.png and /dev/null differ diff --git a/zh-cn/application-dev/media/figures/zh-ch_image_video_recorder_zero.png b/zh-cn/application-dev/media/figures/zh-ch_image_video_recorder_zero.png deleted file mode 100644 index 8bfb453f935bd8342be989eba0393541b35ba582..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/media/figures/zh-ch_image_video_recorder_zero.png and /dev/null differ diff --git a/zh-cn/application-dev/media/figures/zh-ch_image_video_state_machine.png b/zh-cn/application-dev/media/figures/zh-ch_image_video_state_machine.png deleted file mode 100644 index 65387d45f1c3a0393643ef06cf6296dd77ad004a..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/media/figures/zh-ch_image_video_state_machine.png and /dev/null differ diff --git a/zh-cn/application-dev/media/figures/zh-cn_image_avsession.png b/zh-cn/application-dev/media/figures/zh-cn_image_avsession.png deleted file mode 100755 index 9abc37206f8a1084796f838ac0c392c175cf93a1..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/media/figures/zh-cn_image_avsession.png and /dev/null differ diff --git a/zh-cn/application-dev/media/figures/zoom.jpeg b/zh-cn/application-dev/media/figures/zoom.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..977db6cfbc5b81f5396e4d81f8954a9f7d4168e4 Binary files /dev/null and b/zh-cn/application-dev/media/figures/zoom.jpeg differ diff --git a/zh-cn/application-dev/media/image-decoding.md b/zh-cn/application-dev/media/image-decoding.md new file mode 100644 index 0000000000000000000000000000000000000000..64aa8ea69ca935ee971484898bc79e7d00c8e7a2 --- /dev/null +++ b/zh-cn/application-dev/media/image-decoding.md @@ -0,0 +1,141 @@ +# 图片解码 + +图片解码指将所支持格式的存档图片解码成统一的[PixelMap](image-overview.md),以便在应用或系统中进行图片显示或[图片处理](image-transformation.md)。当前支持的存档图片格式包括JPEG、PNG、GIF、RAW、WebP、BMP、SVG。 + +## 开发步骤 + +图片解码相关API的详细介绍请参见:[图片解码接口说明](../reference/apis/js-apis-image.md#imagesource)。 + +1. 全局导入Image模块。 + + ```ts + import image from '@ohos.multimedia.image'; + ``` + +2. 获取图片。 + - 方法一:获取沙箱路径。具体请参考[获取应用文件路径](../application-models/application-context-stage.md#获取应用开发路径)。应用沙箱的介绍及如何向应用沙箱推送文件,请参考[文件管理](../file-management/app-sandbox-directory.md)。 + + ```ts + // Stage模型参考如下代码 + const context = getContext(this); + const filePath = context.cacheDir + '/test.jpg'; + ``` + + ```ts + // FA模型参考如下代码 + import featureAbility from '@ohos.ability.featureAbility'; + + const context = featureAbility.getContext(); + const filePath = context.getCacheDir() + "/test.jpg"; + ``` + - 方法二:通过沙箱路径获取图片的文件描述符。具体请参考[file.fs API参考文档](../reference/apis/js-apis-file-fs.md)。 + 该方法需要先导入\@ohos.file.fs模块。 + + ```ts + import fs from '@ohos.file.fs'; + ``` + + 然后调用fs.openSync()获取文件描述符。 + + ```ts + // Stage模型参考如下代码 + const context = getContext(this); + const filePath = context.cacheDir + '/test.jpg'; + const file = fs.openSync(filePath, fs.OpenMode.READ_WRITE); + const fd = file?.fd; + ``` + + ```ts + // FA模型参考如下代码 + import featureAbility from '@ohos.ability.featureAbility'; + + const context = featureAbility.getContext(); + const filePath = context.getCacheDir() + "/test.jpg"; + const file = fs.openSync(filePath, fs.OpenMode.READ_WRITE); + const fd = file?.fd; + ``` + - 方法三:通过资源管理器获取资源文件的ArrayBuffer。具体请参考[ResourceManager API参考文档](../reference/apis/js-apis-resource-manager.md#getrawfilecontent9-1)。 + + ```ts + // Stage模型 + const context = getContext(this); + // 获取resourceManager资源管理器 + const resourceMgr = context.resourceManager; + ``` + + ```ts + // FA模型 + // 导入resourceManager资源管理器 + import resourceManager from '@ohos.resourceManager'; + const resourceMgr = await resourceManager.getResourceManager(); + ``` + + 不同模型获取资源管理器的方式不同,获取资源管理器后,再调用resourceMgr.getRawFileContent()获取资源文件的ArrayBuffer。 + + ```ts + const fileData = await resourceMgr.getRawFileContent('test.jpg'); + // 获取图片的ArrayBuffer + const buffer = fileData.buffer; + ``` + +3. 创建ImageSource实例。 + - 方法一:通过沙箱路径创建ImageSource。沙箱路径可以通过步骤2的方法一获取。 + + ```ts + // path为已获得的沙箱路径 + const imageSource = image.createImageSource(filePath); + ``` + - 方法二:通过文件描述符fd创建ImageSource。文件描述符可以通过步骤2的方法二获取。 + + ```ts + // fd为已获得的文件描述符 + const imageSource = image.createImageSource(fd); + ``` + - 方法三:通过缓冲区数组创建ImageSource。缓冲区数组可以通过步骤2的方法三获取。 + + ```ts + const imageSource = image.createImageSource(buffer); + ``` + +4. 设置解码参数DecodingOptions,解码获取PixelMap图片对象。 + + ```ts + let decodingOptions = { + editable: true, + desiredPixelFormat: 3, + } + // 创建pixelMap并进行简单的旋转和缩放 + const pixelMap = await imageSource.createPixelMap(decodingOptions); + ``` + + 解码完成,获取到PixelMap对象后,可以进行后续[图片处理](image-transformation.md)。 + +## 开发示例-对资源文件中的图片进行解码 + +1. 获取resourceManager资源管理。 + + ```ts + const context = getContext(this); + // 获取resourceManager资源管理 + const resourceMgr = context.resourceManager; + ``` + +2. 获取rawfile文件夹下test.jpg的ArrayBuffer。 + + ```ts + const fileData = await resourceMgr.getRawFileContent('test.jpg'); + // 获取图片的ArrayBuffer + const buffer = fileData.buffer; + ``` + +3. 创建imageSource。 + + ```ts + const imageSource = image.createImageSource(buffer); + ``` + +4. 创建PixelMap。 + + ```ts + const pixelMap = await imageSource.createPixelMap(); + ``` diff --git a/zh-cn/application-dev/media/image-encoding.md b/zh-cn/application-dev/media/image-encoding.md new file mode 100644 index 0000000000000000000000000000000000000000..325a5f94271cf092681d61354f323f146503641a --- /dev/null +++ b/zh-cn/application-dev/media/image-encoding.md @@ -0,0 +1,48 @@ +# 图片编码 + +图片编码指将PixelMap编码成不同格式的存档图片(当前仅支持打包为JPEG和WebP格式),用于后续处理,如保存、传输等。 + +## 开发步骤 + +图片编码相关API的详细介绍请参见:[图片编码接口说明](../reference/apis/js-apis-image.md#imagepacker)。 + +1. 创建图像编码ImagePacker对象。 + + ```ts + // 导入相关模块包 + import image from '@ohos.multimedia.image'; + + const imagePackerApi = image.createImagePacker(); + ``` + +2. 设置编码输出流和编码参数。 + + format为图像的编码格式;quality为图像质量,范围从0-100,100为最佳质量。 + + ```ts + let packOpts = { format:"image/jpeg", quality:98 }; + ``` + +3. [创建PixelMap对象或创建ImageSource](image-decoding.md)对象。 + +4. 进行图片编码,并保存编码后的图片。 + + 方法一:通过PixelMap进行编码。 + + ```ts + imagePackerApi.packing(pixelMap, packOpts).then( data => { + // data 为打包获取到的文件流,写入文件保存即可得到一张图片 + }).catch(error => { + console.error('Failed to pack the image. And the error is: ' + error); + }) + ``` + + 方法二:通过imageSource进行编码。 + + ```ts + imagePackerApi.packing(imageSource, packOpts).then( data => { + // data 为打包获取到的文件流,写入文件保存即可得到一张图片 + }).catch(error => { + console.error('Failed to pack the image. And the error is: ' + error); + }) + ``` diff --git a/zh-cn/application-dev/media/image-overview.md b/zh-cn/application-dev/media/image-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..7806a34f384fd8b36077a186aeba2f9888643733 --- /dev/null +++ b/zh-cn/application-dev/media/image-overview.md @@ -0,0 +1,38 @@ +# 图片开发概述 + +应用开发中的图片开发是对图片像素数据进行解析、处理、构造的过程,达到目标图片效果,主要涉及图片解码、图片处理、图片编码等。 + +在学习图片开发前,需要熟悉以下基本概念。 + +- 图片解码 + + 指将所支持格式的存档图片解码成统一的PixelMap,以便在应用或系统中进行图片显示或图片处理。当前支持的存档图片格式包括JPEG、PNG、GIF、RAW、WebP、BMP、SVG。 + +- PixelMap + + 指图片解码后无压缩的位图,用于图片显示或图片处理。 + +- 图片处理 + + 指对PixelMap进行相关的操作,如旋转、缩放、设置透明度、获取图片信息、读写像素数据等。 + +- 图片编码 + + 指将PixelMap编码成不同格式的存档图片(当前仅支持JPEG和WebP),用于后续处理,如保存、传输等。 + +图片开发的主要流程如下图所示。 + +**图1** 图片开发流程示意图   +![Image development process](figures/image-development-process.png) + +1. 获取图片:通过应用沙箱等方式获取原始图片。 + +2. 创建ImageSource实例:ImageSource是图片解码出来的图片源类,用于获取或修改图片相关信息。 + +3. [图片解码](image-decoding.md):通过ImageSource解码生成PixelMap。 + +4. [图片处理](image-transformation.md):对PixelMap进行处理,更改图片属性实现图片的旋转、缩放、裁剪等效果。然后通过[Image组件](../ui/arkts-graphics-display.md)显示图片。 + +5. [图片编码](image-encoding.md):使用图片打包器类ImagePacker,将PixelMap或ImageSource进行压缩编码,生成一张新的图片。 + +除上述基本图片开发能力外,OpenHarmony还提供常用[图片工具](image-tool.md),供开发者选择使用。 diff --git a/zh-cn/application-dev/media/image-pixelmap-operation.md b/zh-cn/application-dev/media/image-pixelmap-operation.md new file mode 100644 index 0000000000000000000000000000000000000000..c3aa0fd21e0b57355b7dcb0277cd758e4b6943d6 --- /dev/null +++ b/zh-cn/application-dev/media/image-pixelmap-operation.md @@ -0,0 +1,60 @@ +# 位图操作 + +当需要对目标图片中的部分区域进行处理时,可以使用位图操作功能。此功能常用于图片美化等操作。 + +如下图所示,一张图片中,将指定的矩形区域像素数据读取出来,进行修改后,再写回原图片对应区域。 + +**图1** 位图操作示意图   +![Bitmap operation](figures/bitmap-operation.png) + +## 开发步骤 + +位图操作相关API的详细介绍请参见[API参考](../reference/apis/js-apis-image.md#pixelmap7)。 + +1. 完成[图片解码](image-decoding.md#开发步骤),获取PixelMap位图对象。 + +2. 从PixelMap位图对象中获取信息。 + + ```ts + // 获取图像像素的总字节数 + let pixelBytesNumber = pixelMap.getPixelBytesNumber(); + // 获取图像像素每行字节数 + let rowCount = pixelMap.getBytesNumberPerRow(); + // 获取当前图像像素密度。像素密度是指每英寸图片所拥有的像素数量。像素密度越大,图片越精细。 + let getDensity = pixelMap.getDensity(); + ``` + +3. 读取并修改目标区域像素数据,写回原图。 + + ```ts + // 场景一:将读取的整张图像像素数据结果写入ArrayBuffer中 + const readBuffer = new ArrayBuffer(pixelBytesNumber); + pixelMap.readPixelsToBuffer(readBuffer).then(() => { + console.info('Succeeded in reading image pixel data.'); + }).catch(error => { + console.error('Failed to read image pixel data. And the error is: ' + error); + }) + + // 场景二:读取指定区域内的图片数据,结果写入area.pixels中 + const area = { + pixels: new ArrayBuffer(8), + offset: 0, + stride: 8, + region: { size: { height: 1, width: 2 }, x: 0, y: 0 } + } + pixelMap.readPixels(area).then(() => { + console.info('Succeeded in reading the image data in the area.'); + }).catch(error => { + console.error('Failed to read the image data in the area. And the error is: ' + error); + }) + + // 对于读取的图片数据,可以独立使用(创建新的pixelMap),也可以对area.pixels进行所需修改 + // 将图片数据area.pixels写入指定区域内 + pixelMap.writePixels(area).then(() => { + console.info('Succeeded to write pixelMap into the specified area.'); + }) + + // 将图片数据结果写入pixelMap中 + const writeColor = new ArrayBuffer(96); + pixelMap.writeBufferToPixels(writeColor, () => {}); + ``` diff --git a/zh-cn/application-dev/media/image-tool.md b/zh-cn/application-dev/media/image-tool.md new file mode 100644 index 0000000000000000000000000000000000000000..2d7f8c3220d66f5c567814df04e710a6e482c7e2 --- /dev/null +++ b/zh-cn/application-dev/media/image-tool.md @@ -0,0 +1,43 @@ +# 图片工具 + +图片工具当前主要提供图片EXIF信息的读取与编辑能力。 + +EXIF(Exchangeable image file format)是专门为数码相机的照片设定的文件格式,可以记录数码照片的属性信息和拍摄数据。当前仅支持JPEG格式图片。 + +在图库等应用中,需要查看或修改数码照片的EXIF信息。由于摄像机的手动镜头的参数无法自动写入到EXIF信息中或者因为相机断电等原因经常会导致拍摄时间出错,这时候就需要手动修改错误的EXIF数据,即可使用本功能。 + +OpenHarmony目前仅支持对部分EXIF信息的查看和修改,具体支持的范围请参见:[EIXF信息](../reference/apis/js-apis-image.md#propertykey7)。 + +## 开发步骤 + +EXIF信息的读取与编辑相关API的详细介绍请参见[API参考](../reference/apis/js-apis-image.md#getimageproperty7)。 + +1. 获取图片,创建图片源ImageSource。 + + ```ts + // 导入相关模块包 + import image from '@ohos.multimedia.image'; + + // 获取沙箱路径创建ImageSource + const fd = ...; // 获取需要被处理的图片的fd + const imageSource = image.createImageSource(fd); + ``` + +2. 读取、编辑EXIF信息。 + + ```ts + // 读取EXIF信息,BitsPerSample为每个像素比特数 + imageSource.getImageProperty('BitsPerSample', (error, data) => { + if (error) { + console.error('Failed to get the value of the specified attribute key of the image.And the error is: ' + error); + } else { + console.info('Succeeded in getting the value of the specified attribute key of the image ' + data); + } + }) + + // 编辑EXIF信息 + imageSource.modifyImageProperty('ImageWidth', '120').then(() => { + const width = imageSource.getImageProperty("ImageWidth"); + console.info('The new imageWidth is ' + width); + }) + ``` diff --git a/zh-cn/application-dev/media/image-transformation.md b/zh-cn/application-dev/media/image-transformation.md new file mode 100644 index 0000000000000000000000000000000000000000..ed09128d16a072e85847c193eeb43aaea720e83b --- /dev/null +++ b/zh-cn/application-dev/media/image-transformation.md @@ -0,0 +1,93 @@ +# 图像变换 + +图片处理指对PixelMap进行相关的操作,如获取图片信息、裁剪、缩放、偏移、旋转、翻转、设置透明度、读写像素数据等。图片处理主要包括图像变换、[位图操作](image-pixelmap-operation.md),本文介绍图像变换。 + +## 开发步骤 + +图像变换相关API的详细介绍请参见[API参考](../reference/apis/js-apis-image.md#pixelmap7)。 + +1. 完成[图片解码](image-decoding.md#开发步骤),获取Pixelmap对象。 + +2. 获取图片信息。 + + ``` + // 获取图片大小 + pixelMap.getImageInfo().then( info => { + console.info('info.width = ' + info.size.width); + console.info('info.height = ' + info.size.height); + }).catch((err) => { + console.error("Failed to obtain the image pixel map information.And the error is: " + err); + }); + ``` + +3. 进行图像变换操作。 + + 原图: + + ![Original drawing](figures/original-drawing.jpeg) + - 裁剪 + + ``` + // x:裁剪起始点横坐标0 + // y:裁剪起始点纵坐标0 + // height:裁剪高度400,方向为从上往下(裁剪后的图片高度为400) + // width:裁剪宽度400,方向为从左到右(裁剪后的图片宽度为400) + pixelMap.crop({x: 0, y: 0, size: { height: 400, width: 400 } }); + ``` + + ![cropping](figures/cropping.jpeg) + + - 缩放 + + ``` + // 宽为原来的0.5 + // 高为原来的0.5 + pixelMap.scale(0.5, 0.5); + ``` + + ![zoom](figures/zoom.jpeg) + + - 偏移 + + ``` + // 向下偏移100 + // 向右偏移100 + pixelMap.translate(100, 100); + ``` + + ![offsets](figures/offsets.jpeg) + + - 旋转 + + ``` + // 顺时针旋转90° + pixelMap.rotate(90); + ``` + + ![rotate](figures/rotate.jpeg) + + - 翻转 + + ``` + // 垂直翻转 + pixelMap.flip(false, true); + ``` + + ![Vertical Flip](figures/vertical-flip.jpeg) + + + ``` + // 水平翻转 + pixelMap.flip(true, false); + ``` + + ![Horizontal Flip](figures/horizontal-flip.jpeg) + + - 透明度 + + ``` + // 透明度0.5 + pixelMap.opacity(0.5); + ``` + + ![Transparency](figures/transparency.png) diff --git a/zh-cn/application-dev/media/image.md b/zh-cn/application-dev/media/image.md deleted file mode 100644 index 7a07a7d579c4a0df736dbde4215e0b97b23da362..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/media/image.md +++ /dev/null @@ -1,291 +0,0 @@ -# 图片开发指导 - -## 场景介绍 - -图片开发的主要工作是将获取到的图片进行解码,将解码后的pixelmap编码成支持的格式,本文将对图片的解码、编码等场景开发进行介绍说明。 - -## 接口说明 - -详细API含义请参考:[图片处理API文档](../reference/apis/js-apis-image.md) - -## 开发步骤 - -### 全流程场景 - -包含流程:创建实例、读取图片信息、读写pixelmap、更新数据、打包像素、释放资源等流程。 - -```js -const color = new ArrayBuffer(96); // 用于存放图像像素数据 -let opts = { alphaType: 0, editable: true, pixelFormat: 4, scaleMode: 1, size: { height: 2, width: 3 } } // 图像像素数据 - -// 创建pixelmap对象 -image.createPixelMap(color, opts, (err, pixelmap) => { - console.log('Succeeded in creating pixelmap.'); - // 创建pixelmap对象失败 - if (err) { - console.info('create pixelmap failed, err' + err); - return - } - - // 用于读像素 - const area = { - pixels: new ArrayBuffer(8), - offset: 0, - stride: 8, - region: { size: { height: 1, width: 2 }, x: 0, y: 0 } - } - pixelmap.readPixels(area,() => { - let bufferArr = new Uint8Array(area.pixels); - let res = true; - for (let i = 0; i < bufferArr.length; i++) { - console.info(' buffer ' + bufferArr[i]); - if(res) { - if(bufferArr[i] == 0) { - res = false; - console.log('readPixels end.'); - break; - } - } - } - }) - - // 用于存像素 - const readBuffer = new ArrayBuffer(96); - pixelmap.readPixelsToBuffer(readBuffer,() => { - let bufferArr = new Uint8Array(readBuffer); - let res = true; - for (let i = 0; i < bufferArr.length; i++) { - if(res) { - if (bufferArr[i] !== 0) { - res = false; - console.log('readPixelsToBuffer end.'); - break; - } - } - } - }) - - // 用于写像素 - 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,() => { - let readArr = new Uint8Array(readArea.pixels); - let res = true; - for (let i = 0; i < readArr.length; i++) { - if(res) { - if (readArr[i] !== 0) { - res = false; - console.log('readPixels end.please check buffer'); - break; - } - } - } - }) - }) - - const writeColor = new ArrayBuffer(96); //图像像素数据 - // 用于写像素到缓冲区 - pixelmap.writeBufferToPixels(writeColor).then(() => { - const readBuffer = new ArrayBuffer(96); - pixelmap.readPixelsToBuffer(readBuffer).then (() => { - let bufferArr = new Uint8Array(readBuffer); - let res = true; - for (let i = 0; i < bufferArr.length; i++) { - if(res) { - if (bufferArr[i] !== i) { - res = false; - console.log('readPixels end.please check buffer'); - break; - } - } - } - }) - }) - - // 用于获取图片信息 - pixelmap.getImageInfo((err, imageInfo) => { - // 获取图片信息失败 - if (err || imageInfo == null) { - console.info('getImageInfo failed, err' + err); - return - } - if (imageInfo !== null) { - console.log('Succeeded in getting imageInfo'); - } - }) - - // 用于释放pixelmap - pixelmap.release(()=>{ - console.log('Succeeded in releasing pixelmap'); - }) -}) - -// 用于创建imagesource(uri) -let path = '/data/local/tmp/test.jpg'; -const imageSourceApi1 = image.createImageSource(path); - -// 用于创建imagesource(fd) -let fd = 29; -const imageSourceApi2 = image.createImageSource(fd); - -// 用于创建imagesource(data) -const data = new ArrayBuffer(96); -const imageSourceApi3 = image.createImageSource(data); - -// 用于释放imagesource -imageSourceApi3.release(() => { - console.log('Succeeded in releasing imagesource'); -}) - -// 用于编码 -const imagePackerApi = image.createImagePacker(); -const imageSourceApi = image.createImageSource(0); -let packOpts = { format:"image/jpeg", quality:98 }; -imagePackerApi.packing(imageSourceApi, packOpts, (err, data) => { - if (err) { - console.info('packing from imagePackerApi failed, err' + err); - return - } - console.log('Succeeded in packing'); -}) - -// 用于释放imagepacker -imagePackerApi.release(); -``` - -### 解码场景 - -```js -let path = '/data/local/tmp/test.jpg'; // 设置创建imagesource的路径 - -// 用路径创建imagesource -const imageSourceApi = image.createImageSource(path); // '/data/local/tmp/test.jpg' - -// 设置参数 -let decodingOptions = { - sampleSize:1, // 缩略图采样大小 - editable: true, // 是否可编辑 - desiredSize:{ width:1, height:2}, // 期望输出大小 - rotateDegrees:10, // 旋转角度 - desiredPixelFormat:2, // 解码的像素格式 - desiredRegion: { size: { height: 1, width: 2 }, x: 0, y: 0 }, // 解码的区域 - index:0 // 图片序号 - }; - -// 用于回调方式创建pixelmap -imageSourceApi.createPixelMap(decodingOptions, (err, pixelmap) => { - // 创建pixelmap对象失败 - if (err) { - console.info('create pixelmap failed, err' + err); - return - } - console.log('Succeeded in creating pixelmap.'); -}) - -// 用于promise创建pixelmap -imageSourceApi.createPixelMap().then(pixelmap => { - console.log('Succeeded in creating pixelmap.'); - - // 用于获取像素每行字节数 - let num = pixelmap.getBytesNumberPerRow(); - - // 用于获取像素总字节数 - let pixelSize = pixelmap.getPixelBytesNumber(); - - // 用于获取pixelmap信息 - pixelmap.getImageInfo().then( imageInfo => {}); - - // 用于释放pixelmap - pixelmap.release(()=>{ - console.log('Succeeded in releasing pixelmap'); - }) -}).catch(error => { - console.log('Failed in creating pixelmap.' + error); -}) -``` - -### 编码场景 - -```js -let path = '/data/local/tmp/test.png'; // 设置创建imagesource的路径 - -// 用于设置imagesource -const imageSourceApi = image.createImageSource(path); // '/data/local/tmp/test.png' - -// 如果创建imagesource失败,打印错误信息 -if (imageSourceApi == null) { - console.log('Failed in creating imageSource.'); -} - -// 如果创建imagesource成功,则创建imagepacker -const imagePackerApi = image.createImagePacker(); - -// 如果创建失败,打印错误信息 -if (imagePackerApi == null) { - console.log('Failed in creating imagePacker.'); -} - -// 如果创建imagepacker成功,则设置编码参数 -let packOpts = { format:"image/jpeg", // 支持编码的格式为jpg - quality:98 } // 图片质量0-100 - -// 用于编码 -imagePackerApi.packing(imageSourceApi, packOpts) -.then( data => { - console.log('Succeeded in packing'); -}) - -// 编码完成,释放imagepacker -imagePackerApi.release(); - -// 用于获取imagesource信息 -imageSourceApi.getImageInfo((err, imageInfo) => { - console.log('Succeeded in getting imageInfo'); -}) - -const array = new ArrayBuffer(100); //增量数据 -// 用于更新增量数据 -imageSourceApi.updateData(array, false, 0, 10,(error, data)=> {}) - -``` - -### ImageReceiver的使用 - -示例场景:camera作为客户端将拍照数据传给服务端 - -```js -public async init(surfaceId: any) { - - // 服务端代码,创建ImageReceiver - let receiver = image.createImageReceiver(8 * 1024, 8, image.ImageFormat.JPEG, 1); - - // 获取Surface ID - receiver.getReceivingSurfaceId((err, surfaceId) => { - // 获取Surface ID失败 - if (err) { - console.info('getReceivingSurfaceId failed, err' + err); - return - } - console.info("receiver getReceivingSurfaceId success"); - }); - // 注册Surface的监听,在surface的buffer准备好后触发 - receiver.on('imageArrival', () => { - // 去获取Surface中最新的buffer - receiver.readNextImage((err, img) => { - img.getComponent(4, (err, component) => { - // 消费component.byteBuffer,例如:将buffer内容保存成图片。 - }) - }) - }) - - // 调用Camera方法将surfaceId传递给Camera。camera会通过surfaceId获取surface,并生产出surface buffer。 -} -``` - -## 相关实例 - -针对图片开发,有以下相关实例可供参考: - -- [`Image`:图片处理(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Media/Image) - -- [`GamePuzzle`:拼图(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Media/GamePuzzle) \ No newline at end of file diff --git a/zh-cn/application-dev/media/local-avsession-overview.md b/zh-cn/application-dev/media/local-avsession-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..e71021292ba600d5e413aed307edcd28cdb18c03 --- /dev/null +++ b/zh-cn/application-dev/media/local-avsession-overview.md @@ -0,0 +1,63 @@ +# 本地媒体会话概述 + +## 交互过程 + +本地媒体会话的数据源均在设备本地,交互过程如图所示。 + +![Local AVSession Interaction Process](figures/local-avsession-interaction-process.png) + +此过程中涉及两大角色,媒体会话提供方和媒体会话控制方。 + +本地媒体会话中,媒体会话提供方通过媒体会话管理器和媒体会话控制方进行信息交互: + +1. 媒体会话提供方通过AVSessionManager创建AVSession对象。 + +2. 媒体会话提供方通过AVSession对象,设置会话元数据(媒体ID、标题、媒体时长等)、会话播放属性(播放状态、播放倍速、播放位置等)等。 + +3. 媒体会话控制方通过AVSessionManager创建AVSessionController对象。 + +4. 媒体会话控制方通过AVSessionController对象可以监听对应会话元数据变化、播放属性变化等。 + +5. 媒体会话控制方通过AVSessionController对象还可以向媒体会话发送控制命令。 + +6. 媒体会话提供方通过AVSession对象可以监听来自媒体会话控制方的控制命令,例如:“play”播放、“playNext”播放下一首、“fastForward”快进、 “setSpeed”设置播放倍数等。 + +## 媒体会话管理器 + +媒体会话管理器(AVSessionManager),提供了管理AVSession的能力,可以创建AVSession、创建AVSessionController、发送系统控制事件,也支持对AVSession的状态进行监听。 + +实际上,AVSessionManager与AVSession、AVSessionController对象不同,并不是一个具体的对象,它是媒体会话的根命名域。在实际编程过程中,可以通过如下方式引入: + +```ts +import AVSessionManager from '@ohos.multimedia.avsession'; +``` + +根命名域中的所有方法都可以作为AVSessionManager的方法。 + +例如,媒体会话提供方通过AVSessionManager创建媒体会话的示例如下所示: + +```ts +// 创建session +async createSession() { + let session: AVSessionManager.AVSession = await AVSessionManager.createAVSession(this.context, 'SESSION_NAME', 'audio'); + console.info(`session create done : sessionId : ${session.sessionId}`); +} +``` + +例如,媒体会话控制方通过AVSessionManager创建媒体会话控制器的示例如下所示: + +```ts +// 创建controller +async createController() { + // 获取到所有存活session的描述符列表 + let descriptorsArray: Array> = await AVSessionManager.getAllSessionDescriptors(); + if (descriptorsArray.length > 0) { + // 为了演示,我们简单取第一个描述符的sessionId用来创建对应的controller + let sessionId: string = descriptorsArray[0].sessionId; + let avSessionController: AVSessionManager.AVSessionController = await AVSessionManager.createController(sessionId); + console.info(`controller create done : sessionId : ${avSessionController.sessionId}`); + } +} +``` + +更多关于AVSessionManager的方法,可以参考[API文档](../reference/apis/js-apis-avsession.md)。 diff --git a/zh-cn/application-dev/media/media-application-overview.md b/zh-cn/application-dev/media/media-application-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..ff8f726b7d58514f5025f2ebfa50239e2142a313 --- /dev/null +++ b/zh-cn/application-dev/media/media-application-overview.md @@ -0,0 +1,19 @@ +# 媒体应用开发概述 + +## 媒体系统架构 + +媒体系统提供用户视觉、听觉信息的处理能力,如音视频信息的采集、压缩存储、解压播放等。 在操作系统实现中,通常基于不同的媒体信息处理内容,将媒体划分为音频子系统、视频子系统(也称播放录制子系统)、相机子系统、图片子系统或服务等。 + +如下图所示,媒体系统面向应用开发提供音视频应用、相机应用、图库应用的编程框架接口;面向设备开发提供对接不同硬件芯片适配加速功能;中间以服务形态提供媒体核心功能和管理机制。 + +**图1** 媒体系统整体框架   + +![Media system framework](figures/media-system-framework.png) + +- 音频子系统(audio):提供音量管理、音频路由管理、混音管理接口与服务。 + +- 视频子系统(media):提供音视频解压播放、压缩录制接口与服务。 + +- 相机子系统(camera):提供精确控制相机镜头,采集视觉信息的接口与服务。 + +- 图片子系统(image):提供图片编解码、图片处理接口与服务。 diff --git a/zh-cn/application-dev/media/mic-management.md b/zh-cn/application-dev/media/mic-management.md new file mode 100644 index 0000000000000000000000000000000000000000..575271681514dcadfda8e2ed8047324a66000c9a --- /dev/null +++ b/zh-cn/application-dev/media/mic-management.md @@ -0,0 +1,114 @@ +# 管理麦克风 + +因为在录制过程中需要使用麦克风录制相关音频数据,所以建议开发者在调用录制接口前查询麦克风状态,并在录制过程中监听麦克风的状态变化,避免影响录制效果。 + +在音频录制过程中,用户可以将麦克风静音,此时录音过程正常进行,录制生成的数据文件的大小随录制时长递增,但写入文件的数据均为0,即无声数据(空白数据)。 + +## 开发步骤及注意事项 + +在AudioVolumeGroupManager中提供了管理麦克风状态的方法,接口的详细说明请参考[API文档](../reference/apis/js-apis-audio.md#audiovolumegroupmanager9)。 + +1. 创建audioVolumeGroupManager对象。 + + ```ts + import audio from '@ohos.multimedia.audio'; + + let audioVolumeGroupManager; + async function loadVolumeGroupManager() { //创建audioVolumeGroupManager对象 + const groupid = audio.DEFAULT_VOLUME_GROUP_ID; + audioVolumeGroupManager = await audio.getAudioManager().getVolumeManager().getVolumeGroupManager(groupid); + console.info('audioVolumeGroupManager create success.'); + } + ``` + +2. 调用on('micStateChange')监听麦克风状态变化,当麦克风静音状态发生变化时将通知应用。 + + 目前此订阅接口在单进程多AudioManager实例的使用场景下,仅最后一个实例的订阅生效,其他实例的订阅会被覆盖(即使最后一个实例没有进行订阅),因此推荐使用单一AudioManager实例进行开发。 + + + ```ts + async function on() { //监听麦克风状态变化 + audioVolumeGroupManager.on('micStateChange', (micStateChange) => { + console.info(`Current microphone status is: ${micStateChange.mute} `); + }); + } + ``` + +3. 调用isMicrophoneMute查询麦克风当前静音状态,返回true为静音,false为非静音。 + + ```ts + async function isMicrophoneMute() { //查询麦克风是否静音 + await audioVolumeGroupManager.isMicrophoneMute().then((value) => { + console.info(`isMicrophoneMute is: ${value}.`); + }); + } + ``` + +4. 根据查询结果的实际情况,调用setMicrophoneMute设置麦克风静音状态,入参输入true为静音,false为非静音。 + + ```ts + async function setMicrophoneMuteTrue() { //设置麦克风静音,入参为true + await audioVolumeGroupManager.setMicrophoneMute(true).then(() => { + console.info('setMicrophoneMute to mute.'); + }); + } + async function setMicrophoneMuteFalse() { //取消麦克风静音,入参为false + await audioVolumeGroupManager.setMicrophoneMute(false).then(() => { + console.info('setMicrophoneMute to not mute.'); + }); + } + ``` + +## 完整示例 + +参考以下示例,完成从设置麦克风静音到取消麦克风静音的过程。 + +```ts +import audio from '@ohos.multimedia.audio'; + +@Entry +@Component +struct AudioVolumeGroup { + private audioVolumeGroupManager: audio.AudioVolumeGroupManager; + + async loadVolumeGroupManager() { + const groupid = audio.DEFAULT_VOLUME_GROUP_ID; + this.audioVolumeGroupManager = await audio.getAudioManager().getVolumeManager().getVolumeGroupManager(groupid); + console.info('audioVolumeGroupManager------create-------success.'); + } + + async on() { //监听麦克风状态变化 + await this.loadVolumeGroupManager(); + this.audioVolumeGroupManager.on('micStateChange', (micStateChange) => { + console.info(`Current microphone status is: ${micStateChange.mute} `); + }); + } + async isMicrophoneMute() { //查询麦克风是否静音 + await this.audioVolumeGroupManager.isMicrophoneMute().then((value) => { + console.info(`isMicrophoneMute is: ${value}.`); + }); + } + async setMicrophoneMuteTrue() { //设置麦克风静音 + await this.loadVolumeGroupManager(); + await this.audioVolumeGroupManager.setMicrophoneMute(true).then(() => { + console.info('setMicrophoneMute to mute.'); + }); + } + async setMicrophoneMuteFalse() { //取消麦克风静音 + await this.loadVolumeGroupManager(); + await this.audioVolumeGroupManager.setMicrophoneMute(false).then(() => { + console.info('setMicrophoneMute to not mute.'); + }); + } + async test(){ + await this.on(); + await this.isMicrophoneMute(); + await this.setMicrophoneMuteTrue(); + await this.isMicrophoneMute(); + await this.setMicrophoneMuteFalse(); + await this.isMicrophoneMute(); + await this.setMicrophoneMuteTrue(); + await this.isMicrophoneMute(); + } +} +``` diff --git a/zh-cn/application-dev/media/opensles-capture.md b/zh-cn/application-dev/media/opensles-capture.md deleted file mode 100644 index 4c9a88531543ba15f882720fe83e512373496c2c..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/media/opensles-capture.md +++ /dev/null @@ -1,151 +0,0 @@ -# OpenSL ES音频录制开发指导 - -## 简介 - -开发者可以通过本文档了解在**OpenHarmony**中如何使用**OpenSL ES**进行录音相关操作;当前仅实现了部分[**OpenSL ES**接口](https://gitee.com/openharmony/third_party_opensles/blob/master/api/1.0.1/OpenSLES.h),因此调用未实现接口后会返回**SL_RESULT_FEATURE_UNSUPPORTED**。 - -## 开发指导 - -以下步骤描述了在**OpenHarmony**如何使用 **OpenSL ES** 开发音频录音功能: - -1. 添加头文件 - - ```c++ - #include - #include - #include - ``` - -2. 使用 **slCreateEngine** 接口创建引擎对象和实例化引擎对象 **engine** - - ```c++ - SLObjectItf engineObject = nullptr; - slCreateEngine(&engineObject, 0, nullptr, 0, nullptr, nullptr); - (*engineObject)->Realize(engineObject, SL_BOOLEAN_FALSE); - ``` - -3. 获取接口 **SL_IID_ENGINE** 的引擎接口 **engineEngine** 实例 - - ```c++ - SLEngineItf engineItf = nullptr; - result = (*engineObject)->GetInterface(engineObject, SL_IID_ENGINE, &engineItf); - ``` - -4. 配置录音器信息(配置输入源audiosource、输出源audiosink),创建录音对象**pcmCapturerObject** - - ```c++ - SLDataLocator_IODevice io_device = { - SL_DATALOCATOR_IODEVICE, - SL_IODEVICE_AUDIOINPUT, - SL_DEFAULTDEVICEID_AUDIOINPUT, - NULL - }; - - SLDataSource audioSource = { - &io_device, - NULL - }; - - SLDataLocator_BufferQueue buffer_queue = { - SL_DATALOCATOR_BUFFERQUEUE, - 3 - }; - - //具体参数需要根据音频文件格式进行适配 - SLDataFormat_PCM format_pcm = { - SL_DATAFORMAT_PCM, - OHOS::AudioStandard::AudioChannel::MONO, - OHOS::AudioStandard::AudioSamplingRate::SAMPLE_RATE_44100, - OHOS::AudioStandard::AudioSampleFormat::SAMPLE_S16LE, - 0, - 0, - 0 - }; - - SLDataSink audioSink = { - &buffer_queue, - &format_pcm - }; - - SLObjectItf pcmCapturerObject = nullptr; - result = (*engineItf)->CreateAudioRecorder(engineItf, &pcmCapturerObject, - &audioSource, &audioSink, 0, nullptr, nullptr); - (*pcmCapturerObject)->Realize(pcmCapturerObject, SL_BOOLEAN_FALSE); - ``` - -5. 获取录音接口**SL_IID_RECORD** 的 **recordItf** 接口实例 - - ```c++ - SLRecordItf recordItf; - (*pcmCapturerObject)->GetInterface(pcmCapturerObject, SL_IID_RECORD, &recordItf); - ``` - -6. 获取接口 **SL_IID_OH_BUFFERQUEUE** 的 **bufferQueueItf** 实例 - - ```c++ - SLOHBufferQueueItf bufferQueueItf; - (*pcmCapturerObject)->GetInterface(pcmCapturerObject, SL_IID_OH_BUFFERQUEUE, &bufferQueueItf); - ``` - -7. 注册 **BufferQueueCallback** 回调 - - ```c++ - static void BufferQueueCallback(SLOHBufferQueueItf bufferQueueItf, void *pContext, SLuint32 size) - { - AUDIO_INFO_LOG("BufferQueueCallback"); - FILE *wavFile = (FILE *)pContext; - if (wavFile != nullptr) { - SLuint8 *buffer = nullptr; - SLuint32 pSize = 0; - (*bufferQueueItf)->GetBuffer(bufferQueueItf, &buffer, pSize); - if (buffer != nullptr) { - fwrite(buffer, 1, pSize, wavFile); - (*bufferQueueItf)->Enqueue(bufferQueueItf, buffer, size); - } - } - - return; - } - - //wavFile_ 需要设置为用户想要录音的文件描述符 - (*bufferQueueItf)->RegisterCallback(bufferQueueItf, BufferQueueCallback, wavFile_); - ``` - -8. 开始录音 - - ```c++ - static void CaptureStart(SLRecordItf recordItf, SLOHBufferQueueItf bufferQueueItf, FILE *wavFile) - { - AUDIO_INFO_LOG("CaptureStart"); - (*recordItf)->SetRecordState(recordItf, SL_RECORDSTATE_RECORDING); - if (wavFile != nullptr) { - SLuint8* buffer = nullptr; - SLuint32 pSize = 0; - (*bufferQueueItf)->GetBuffer(bufferQueueItf, &buffer, pSize); - if (buffer != nullptr) { - AUDIO_INFO_LOG("CaptureStart, enqueue buffer length: %{public}lu.", pSize); - fwrite(buffer, 1, pSize, wavFile); - (*bufferQueueItf)->Enqueue(bufferQueueItf, buffer, pSize); - } else { - AUDIO_INFO_LOG("CaptureStart, buffer is null or pSize: %{public}lu.", pSize); - } - } - - return; - } - ``` - -9. 结束录音 - - ```c++ - static void CaptureStop(SLRecordItf recordItf) - { - AUDIO_INFO_LOG("Enter CaptureStop"); - fflush(wavFile_); - (*recordItf)->SetRecordState(recordItf, SL_RECORDSTATE_STOPPED); - (*pcmCapturerObject)->Destroy(pcmCapturerObject); - fclose(wavFile_); - wavFile_ = nullptr; - return; - } - ``` \ No newline at end of file diff --git a/zh-cn/application-dev/media/opensles-playback.md b/zh-cn/application-dev/media/opensles-playback.md deleted file mode 100644 index 51108a83dc6567b4c21e69c21a0424cb1b0b951a..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/media/opensles-playback.md +++ /dev/null @@ -1,104 +0,0 @@ -# OpenSL ES音频播放开发指导 - -## 简介 - -开发者可以通过本文档了解在**OpenHarmony**中如何使用**OpenSL ES**进行音频播放相关操作;当前仅实现了部分[**OpenSL ES**接口](https://gitee.com/openharmony/third_party_opensles/blob/master/api/1.0.1/OpenSLES.h),因此调用未实现接口后会返回**SL_RESULT_FEATURE_UNSUPPORTED** - -## 开发指导 - -以下步骤描述了在**OpenHarmony**如何使用**OpenSL ES**开发音频播放功能: - -1. 添加头文件 - - ```c++ - #include - #include - #include - ``` - -2. 使用 **slCreateEngine** 接口和获取 **engine** 实例 - - ```c++ - SLObjectItf engineObject = nullptr; - slCreateEngine(&engineObject, 0, nullptr, 0, nullptr, nullptr); - (*engineObject)->Realize(engineObject, SL_BOOLEAN_FALSE); - ``` - -3. 获取接口 **SL_IID_ENGINE** 的 **engineEngine** 实例 - - ```c++ - SLEngineItf engineEngine = nullptr; - (*engineObject)->GetInterface(engineObject, SL_IID_ENGINE, &engineEngine); - ``` - -4. 配置播放器信息,创建 **AudioPlayer** - - ```c++ - SLDataLocator_BufferQueue slBufferQueue = { - SL_DATALOCATOR_BUFFERQUEUE, - 0 - }; - - // 具体参数需要根据音频文件格式进行适配 - SLDataFormat_PCM pcmFormat = { - SL_DATAFORMAT_PCM, - 2, - 48000, - 16, - 0, - 0, - 0 - }; - SLDataSource slSource = {&slBufferQueue, &pcmFormat}; - - SLObjectItf pcmPlayerObject = nullptr; - (*engineEngine)->CreateAudioPlayer(engineEngine, &pcmPlayerObject, &slSource, null, 0, nullptr, nullptr); - (*pcmPlayerObject)->Realize(pcmPlayerObject, SL_BOOLEAN_FALSE); - ``` - -5. 获取接口 **SL_IID_OH_BUFFERQUEUE** 的 **bufferQueueItf** 实例 - - ```c++ - SLOHBufferQueueItf bufferQueueItf; - (*pcmPlayerObject)->GetInterface(pcmPlayerObject, SL_IID_OH_BUFFERQUEUE, &bufferQueueItf); - ``` - -6. 打开音频文件,注册 **BufferQueueCallback** 回调 - - ```c++ - FILE *wavFile_ = nullptr; - - static void BufferQueueCallback (SLOHBufferQueueItf bufferQueueItf, void *pContext, SLuint32 size) - { - FILE *wavFile = (FILE *)pContext; - if (!feof(wavFile)) { - SLuint8 *buffer = nullptr; - SLuint32 pSize = 0; - (*bufferQueueItf)->GetBuffer(bufferQueueItf, &buffer, pSize); - //从文件读取数据 - fread(buffer, 1, size, wavFile); - (*bufferQueueItf)->Enqueue(bufferQueueItf, buffer, size); - } - return; - } - - // wavFile_ 需要设置为用户想要播放的文件描述符 - wavFile_ = fopen(path, "rb"); - (*bufferQueueItf)->RegisterCallback(bufferQueueItf, BufferQueueCallback, wavFile_); - ``` - -7. 获取接口 **SL_PLAYSTATE_PLAYING** 的 **playItf** 实例,开始播放 - - ```c++ - SLPlayItf playItf = nullptr; - (*pcmPlayerObject)->GetInterface(pcmPlayerObject, SL_IID_PLAY, &playItf); - (*playItf)->SetPlayState(playItf, SL_PLAYSTATE_PLAYING); - ``` - -8. 结束音频播放 - - ```c++ - (*playItf)->SetPlayState(playItf, SL_PLAYSTATE_STOPPED); - (*pcmPlayerObject)->Destroy(pcmPlayerObject); - (*engineObject)->Destroy(engineObject); - ``` \ No newline at end of file diff --git a/zh-cn/application-dev/media/remote-camera.md b/zh-cn/application-dev/media/remote-camera.md deleted file mode 100644 index 91bfd4a6912e972b32b3bf6427b7654c9fca020e..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/media/remote-camera.md +++ /dev/null @@ -1,65 +0,0 @@ -# 分布式相机开发指导 - -## 场景介绍 - -分布式相机模块支持相机相关基础功能介绍说明。 - -## 开发步骤 -在计算器中连接分布式设备,在获取相机列表getSupportedCameras(),遍历返回的列表,判断对应Camera对象中的ConnectionType是否等于CAMERA_CONNECTION_REMOTE,若等于则使用此对象创建cameraInput,之后调用与本地相机使用一样。参考:[相机开发指导](./camera.md) - -详细API含义请参考:[相机管理API文档](../reference/apis/js-apis-camera.md) - -### 连接分布式相机 - -打开设置->WLAN,将需要连接分布式相机的两台设备连入同一局域网。 - -打开计算器,点击右上角小图标,出现新的窗口,按提示输入验证码,连接成功。 - -### 创建实例 - -```js -import camera from '@ohos.multimedia.camera' -import image from '@ohos.multimedia.image' -import media from '@ohos.multimedia.media' -import featureAbility from '@ohos.ability.featureAbility' - -// 创建CameraManager对象 -let cameraManager = camera.getCameraManager(globalThis.Context) -if (!cameraManager) { - console.error("camera.getCameraManager error") - return; -} - -// 注册回调函数监听相机状态变化,获取状态变化的相机信息 -cameraManager.on('cameraStatus', (cameraStatusInfo) => { - console.log('camera : ' + cameraStatusInfo.camera.cameraId); - console.log('status: ' + cameraStatusInfo.status); -}) - -// 获取相机列表 -let remoteCamera -let cameraArray = cameraManager.getSupportedCameras(); -if (cameraArray.length <= 0) { - console.error("cameraManager.getSupportedCameras error") - return; -} - -for(let cameraIndex = 0; cameraIndex < cameraArray.length; cameraIndex++) { - console.log('cameraId : ' + cameraArray[cameraIndex].cameraId) // 获取相机ID - console.log('cameraPosition : ' + cameraArray[cameraIndex].cameraPosition) // 获取相机位置 - console.log('cameraType : ' + cameraArray[cameraIndex].cameraType) // 获取相机类型 - console.log('connectionType : ' + cameraArray[cameraIndex].connectionType) // 获取相机连接类型 - if (cameraArray[cameraIndex].connectionType == CAMERA_CONNECTION_REMOTE) { - remoteCamera = cameraArray[cameraIndex] - } -} - -// 创建相机输入流 -let cameraInput -try { - cameraInput = cameraManager.createCameraInput(remoteCamera); -} catch () { - console.error('Failed to createCameraInput errorCode = ' + error.code); -} -``` -剩余步骤参照[相机开发指导](./camera.md) \ No newline at end of file diff --git a/zh-cn/application-dev/media/using-audiocapturer-for-recording.md b/zh-cn/application-dev/media/using-audiocapturer-for-recording.md new file mode 100644 index 0000000000000000000000000000000000000000..76548cbe10a909340cddf0d1e570d4de08e10139 --- /dev/null +++ b/zh-cn/application-dev/media/using-audiocapturer-for-recording.md @@ -0,0 +1,211 @@ +# 使用AudioCapturer开发音频录制功能 + +AudioCapturer是音频采集器,用于录制PCM(Pulse Code Modulation)音频数据,适合有音频开发经验的开发者实现更灵活的录制功能。 + +## 开发指导 + +使用AudioCapturer录制音频涉及到AudioCapturer实例的创建、音频采集参数的配置、采集的开始与停止、资源的释放等。本开发指导将以一次录制音频数据的过程为例,向开发者讲解如何使用AudioCapturer进行音频录制,建议搭配[AudioCapturer的API说明](../reference/apis/js-apis-audio.md#audiocapturer8)阅读。 + +下图展示了AudioCapturer的状态变化,在创建实例后,调用对应的方法可以进入指定的状态实现对应的行为。需要注意的是在确定的状态执行不合适的方法可能导致AudioCapturer发生错误,建议开发者在调用状态转换的方法前进行状态检查,避免程序运行产生预期以外的结果。 + +**图1** AudioCapturer状态变化示意图   +![AudioCapturer status change](figures/audiocapturer-status-change.png) + +使用on('stateChange')方法可以监听AudioCapturer的状态变化,每个状态对应值与说明见[AudioState](../reference/apis/js-apis-audio.md#audiostate8)。 + +### 开发步骤及注意事项 + +1. 配置音频采集参数并创建AudioCapturer实例,音频采集参数的详细信息可以查看[AudioCapturerOptions](../reference/apis/js-apis-audio.md#audiocaptureroptions8)。 + + ```ts + import audio from '@ohos.multimedia.audio'; + + let audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_2, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + }; + + let audioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, + capturerFlags: 0 + }; + + let audioCapturerOptions = { + streamInfo: audioStreamInfo, + capturerInfo: audioCapturerInfo + }; + + audio.createAudioCapturer(audioCapturerOptions, (err, data) => { + if (err) { + console.error(`Invoke createAudioCapturer failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info('Invoke createAudioCapturer succeeded.'); + let audioCapturer = data; + } + }); + ``` + +2. 调用start()方法进入running状态,开始录制音频。 + + ```ts + audioCapturer.start((err) => { + if (err) { + console.error(`Capturer start failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info('Capturer start success.'); + } + }); + ``` + +3. 指定录制文件地址,调用read()方法读取缓冲区的数据。 + + ```ts + let file = fs.openSync(path, 0o2 | 0o100); + let bufferSize = await audioCapturer.getBufferSize(); + let buffer = await audioCapturer.read(bufferSize, true); + fs.writeSync(file.fd, buffer); + ``` + +4. 调用stop()方法停止录制。 + + ```ts + audioCapturer.stop((err) => { + if (err) { + console.error(`Capturer stop failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info('Capturer stopped.'); + } + }); + ``` + +5. 调用release()方法销毁实例,释放资源。 + + ```ts + audioCapturer.release((err) => { + if (err) { + console.error(`capturer release failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info('capturer released.'); + } + }); + ``` + + +### 完整示例 + +下面展示了使用AudioCapturer录制音频的完整示例代码。 + +```ts +import audio from '@ohos.multimedia.audio'; +import fs from '@ohos.file.fs'; + +const TAG = 'AudioCapturerDemo'; + +export default class AudioCapturerDemo { + private audioCapturer = undefined; + private audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + } + private audioCapturerInfo = { + source: audio.SourceType.SOURCE_TYPE_MIC, // 音源类型 + capturerFlags: 0 // 音频采集器标志 + } + private audioCapturerOptions = { + streamInfo: this.audioStreamInfo, + capturerInfo: this.audioCapturerInfo + } + + // 初始化,创建实例,设置监听事件 + init() { + audio.createAudioCapturer(this.audioCapturerOptions, (err, capturer) => { // 创建AudioCapturer实例 + if (err) { + console.error(`Invoke createAudioCapturer failed, code is ${err.code}, message is ${err.message}`); + return; + } + + console.info(`${TAG}: create AudioCapturer success`); + this.audioCapturer = capturer; + this.audioCapturer.on('markReach', 1000, (position) => { // 订阅markReach事件,当采集的帧数达到1000时触发回调 + if (position === 1000) { + console.info('ON Triggered successfully'); + } + }); + this.audioCapturer.on('periodReach', 2000, (position) => { // 订阅periodReach事件,当采集的帧数达到2000时触发回调 + if (position === 2000) { + console.info('ON Triggered successfully'); + } + }); + + }); + } + + // 开始一次音频采集 + async start() { + let stateGroup = [audio.AudioState.STATE_PREPARED, audio.AudioState.STATE_PAUSED, audio.AudioState.STATE_STOPPED]; + if (stateGroup.indexOf(this.audioCapturer.state) === -1) { // 当且仅当状态为STATE_PREPARED、STATE_PAUSED和STATE_STOPPED之一时才能启动采集 + console.error(`${TAG}: start failed`); + return; + } + await this.audioCapturer.start(); // 启动采集 + + let context = getContext(this); + const path = context.filesDir + '/test.wav'; // 采集到的音频文件存储路径 + + let file = fs.openSync(path, 0o2 | 0o100); // 如果文件不存在则创建文件 + let fd = file.fd; + let numBuffersToCapture = 150; // 循环写入150次 + let count = 0; + while (numBuffersToCapture) { + let bufferSize = await this.audioCapturer.getBufferSize(); + let buffer = await this.audioCapturer.read(bufferSize, true); + let options = { + offset: count * bufferSize, + length: bufferSize + }; + if (buffer === undefined) { + console.error(`${TAG}: read buffer failed`); + } else { + let number = fs.writeSync(fd, buffer, options); + console.info(`${TAG}: write date: ${number}`); + } + numBuffersToCapture--; + count++; + } + } + + // 停止采集 + async stop() { + // 只有采集器状态为STATE_RUNNING或STATE_PAUSED的时候才可以停止 + if (this.audioCapturer.state !== audio.AudioState.STATE_RUNNING && this.audioCapturer.state !== audio.AudioState.STATE_PAUSED) { + console.info('Capturer is not running or paused'); + return; + } + await this.audioCapturer.stop(); // 停止采集 + if (this.audioCapturer.state === audio.AudioState.STATE_STOPPED) { + console.info('Capturer stopped'); + } else { + console.error('Capturer stop failed'); + } + } + + // 销毁实例,释放资源 + async release() { + // 采集器状态不是STATE_RELEASED或STATE_NEW状态,才能release + if (this.audioCapturer.state === audio.AudioState.STATE_RELEASED || this.audioCapturer.state === audio.AudioState.STATE_NEW) { + console.info('Capturer already released'); + return; + } + await this.audioCapturer.release(); // 释放资源 + if (this.audioCapturer.state == audio.AudioState.STATE_RELEASED) { + console.info('Capturer released'); + } else { + console.error('Capturer release failed'); + } + } +} +``` diff --git a/zh-cn/application-dev/media/using-audiorenderer-for-playback.md b/zh-cn/application-dev/media/using-audiorenderer-for-playback.md new file mode 100644 index 0000000000000000000000000000000000000000..1bb55f5d5874923eb440ea911dbd3beedb0b4d5c --- /dev/null +++ b/zh-cn/application-dev/media/using-audiorenderer-for-playback.md @@ -0,0 +1,268 @@ +# 使用AudioRenderer开发音频播放功能 + +AudioRenderer是音频渲染器,用于播放PCM(Pulse Code Modulation)音频数据,相比AVPlayer而言,可以在输入前添加数据预处理,更适合有音频开发经验的开发者,以实现更灵活的播放功能。 + +## 开发指导 + +使用AudioRenderer播放音频涉及到AudioRenderer实例的创建、音频渲染参数的配置、渲染的开始与停止、资源的释放等。本开发指导将以一次渲染音频数据的过程为例,向开发者讲解如何使用AudioRenderer进行音频渲染,建议搭配[AudioRenderer的API说明](../reference/apis/js-apis-audio.md#audiorenderer8)阅读。 + +下图展示了AudioRenderer的状态变化,在创建实例后,调用对应的方法可以进入指定的状态实现对应的行为。需要注意的是在确定的状态执行不合适的方法可能导致AudioRenderer发生错误,建议开发者在调用状态转换的方法前进行状态检查,避免程序运行产生预期以外的结果。 + +为保证UI线程不被阻塞,大部分AudioRenderer调用都是异步的。对于每个API均提供了callback函数和Promise函数,以下示例均采用callback函数。 + +**图1** AudioRenderer状态变化示意图   + +![AudioRenderer status change](figures/audiorenderer-status-change.png) + +在进行应用开发的过程中,建议开发者通过on('stateChange')方法订阅AudioRenderer的状态变更。因为针对AudioRenderer的某些操作,仅在音频播放器在固定状态时才能执行。如果应用在音频播放器处于错误状态时执行操作,系统可能会抛出异常或生成其他未定义的行为。 + +- prepared状态: 通过调用createAudioRenderer()方法进入到该状态。 + +- running状态: 正在进行音频数据播放,可以在prepared状态通过调用start()方法进入此状态,也可以在paused状态和stopped状态通过调用start()方法进入此状态。 + +- paused状态: 在running状态可以通过调用pause()方法暂停音频数据的播放并进入paused状态,暂停播放之后可以通过调用start()方法继续音频数据播放。 + +- stopped状态: 在paused/running状态可以通过stop()方法停止音频数据的播放。 + +- released状态: 在prepared、paused、stopped等状态,用户均可通过release()方法释放掉所有占用的硬件和软件资源,并且不会再进入到其他的任何一种状态了。 + +### 开发步骤及注意事项 + +1. 配置音频渲染参数并创建AudioRenderer实例,音频渲染参数的详细信息可以查看[AudioRendererOptions](../reference/apis/js-apis-audio.md#audiorendereroptions8)。 + + ```ts + import audio from '@ohos.multimedia.audio'; + + let audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100, + channels: audio.AudioChannel.CHANNEL_1, + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW + }; + + let audioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_SPEECH, + usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION, + rendererFlags: 0 + }; + + let audioRendererOptions = { + streamInfo: audioStreamInfo, + rendererInfo: audioRendererInfo + }; + + audio.createAudioRenderer(audioRendererOptions, (err, data) => { + if (err) { + console.error(`Invoke createAudioRenderer failed, code is ${err.code}, message is ${err.message}`); + return; + } else { + console.info('Invoke createAudioRenderer succeeded.'); + let audioRenderer = data; + } + }); + ``` + +2. 调用start()方法进入running状态,开始渲染音频。 + + ```ts + audioRenderer.start((err) => { + if (err) { + console.error(`Renderer start failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info('Renderer start success.'); + } + }); + ``` + +3. 指定待渲染文件地址,打开文件调用write()方法向缓冲区持续写入音频数据进行渲染播放。如果需要对音频数据进行处理以实现个性化的播放,在写入之前操作即可。 + + ```ts + const bufferSize = await audioRenderer.getBufferSize(); + let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); + let buf = new ArrayBuffer(bufferSize); + let readsize = await fs.read(file.fd, buf); + let writeSize = await new Promise((resolve, reject) => { + audioRenderer.write(buf, (err, writeSize) => { + if (err) { + reject(err); + } else { + resolve(writeSize); + } + }); + }); + ``` + +4. 调用stop()方法停止渲染。 + + ```ts + audioRenderer.stop((err) => { + if (err) { + console.error(`Renderer stop failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info('Renderer stopped.'); + } + }); + ``` + +5. 调用release()方法销毁实例,释放资源。 + + ```ts + audioRenderer.release((err) => { + if (err) { + console.error(`Renderer release failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info('Renderer released.'); + } + }); + ``` + +### 完整示例 + +下面展示了使用AudioRenderer渲染音频文件的示例代码。 + +```ts +import audio from '@ohos.multimedia.audio'; +import fs from '@ohos.file.fs'; + +const TAG = 'AudioRendererDemo'; + +export default class AudioRendererDemo { + private renderModel = undefined; + private audioStreamInfo = { + samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000, // 采样率 + channels: audio.AudioChannel.CHANNEL_2, // 通道 + sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE, // 采样格式 + encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW // 编码格式 + } + private audioRendererInfo = { + content: audio.ContentType.CONTENT_TYPE_MUSIC, // 媒体类型 + usage: audio.StreamUsage.STREAM_USAGE_MEDIA, // 音频流使用类型 + rendererFlags: 0 // 音频渲染器标志 + } + private audioRendererOptions = { + streamInfo: this.audioStreamInfo, + rendererInfo: this.audioRendererInfo + } + + // 初始化,创建实例,设置监听事件 + init() { + audio.createAudioRenderer(this.audioRendererOptions, (err, renderer) => { // 创建AudioRenderer实例 + if (!err) { + console.info(`${TAG}: creating AudioRenderer success`); + this.renderModel = renderer; + this.renderModel.on('stateChange', (state) => { // 设置监听事件,当转换到指定的状态时触发回调 + if (state == 1) { + console.info('audio renderer state is: STATE_PREPARED'); + } + if (state == 2) { + console.info('audio renderer state is: STATE_RUNNING'); + } + }); + this.renderModel.on('markReach', 1000, (position) => { // 订阅markReach事件,当渲染的帧数达到1000帧时触发回调 + if (position == 1000) { + console.info('ON Triggered successfully'); + } + }); + } else { + console.info(`${TAG}: creating AudioRenderer failed, error: ${err.message}`); + } + }); + } + + // 开始一次音频渲染 + async start() { + let stateGroup = [audio.AudioState.STATE_PREPARED, audio.AudioState.STATE_PAUSED, audio.AudioState.STATE_STOPPED]; + if (stateGroup.indexOf(this.renderModel.state) === -1) { // 当且仅当状态为prepared、paused和stopped之一时才能启动渲染 + console.error(TAG + 'start failed'); + return; + } + await this.renderModel.start(); // 启动渲染 + + const bufferSize = await this.renderModel.getBufferSize(); + let context = getContext(this); + let path = context.filesDir; + const filePath = path + '/test.wav'; // 使用沙箱路径获取文件,实际路径为/data/storage/el2/base/haps/entry/files/test.wav + + let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); + let stat = await fs.stat(filePath); + let buf = new ArrayBuffer(bufferSize); + let len = stat.size % bufferSize === 0 ? Math.floor(stat.size / bufferSize) : Math.floor(stat.size / bufferSize + 1); + for (let i = 0; i < len; i++) { + let options = { + offset: i * bufferSize, + length: bufferSize + }; + let readsize = await fs.read(file.fd, buf, options); + + // buf是要写入缓冲区的音频数据,在调用AudioRenderer.write()方法前可以进行音频数据的预处理,实现个性化的音频播放功能,AudioRenderer会读出写入缓冲区的音频数据进行渲染 + + let writeSize = await new Promise((resolve, reject) => { + this.renderModel.write(buf, (err, writeSize) => { + if (err) { + reject(err); + } else { + resolve(writeSize); + } + }); + }); + if (this.renderModel.state === audio.AudioState.STATE_RELEASED) { // 如果渲染器状态为released,停止渲染 + fs.close(file); + await this.renderModel.stop(); + } + if (this.renderModel.state === audio.AudioState.STATE_RUNNING) { + if (i === len - 1) { // 如果音频文件已经被读取完,停止渲染 + fs.close(file); + await this.renderModel.stop(); + } + } + } + } + + // 暂停渲染 + async pause() { + // 只有渲染器状态为running的时候才能暂停 + if (this.renderModel.state !== audio.AudioState.STATE_RUNNING) { + console.info('Renderer is not running'); + return; + } + await this.renderModel.pause(); // 暂停渲染 + if (this.renderModel.state === audio.AudioState.STATE_PAUSED) { + console.info('Renderer is paused.'); + } else { + console.error('Pausing renderer failed.'); + } + } + + // 停止渲染 + async stop() { + // 只有渲染器状态为running或paused的时候才可以停止 + if (this.renderModel.state !== audio.AudioState.STATE_RUNNING && this.renderModel.state !== audio.AudioState.STATE_PAUSED) { + console.info('Renderer is not running or paused.'); + return; + } + await this.renderModel.stop(); // 停止渲染 + if (this.renderModel.state === audio.AudioState.STATE_STOPPED) { + console.info('Renderer stopped.'); + } else { + console.error('Stopping renderer failed.'); + } + } + + // 销毁实例,释放资源 + async release() { + // 渲染器状态不是released状态,才能release + if (this.renderModel.state === audio.AudioState.STATE_RELEASED) { + console.info('Renderer already released'); + return; + } + await this.renderModel.release(); // 释放资源 + if (this.renderModel.state === audio.AudioState.STATE_RELEASED) { + console.info('Renderer released'); + } else { + console.error('Renderer release failed.'); + } + } +} +``` + +当同优先级或高优先级音频流要使用输出设备时,当前音频流会被中断,应用可以自行响应中断事件并做出处理。具体的音频并发处理方式可参考[多音频播放的并发策略](audio-playback-concurrency.md)。 diff --git a/zh-cn/application-dev/media/using-avplayer-for-playback.md b/zh-cn/application-dev/media/using-avplayer-for-playback.md new file mode 100644 index 0000000000000000000000000000000000000000..99dc462d4eb110b162b89b9d9e646c4250f8c6b0 --- /dev/null +++ b/zh-cn/application-dev/media/using-avplayer-for-playback.md @@ -0,0 +1,165 @@ +# 使用AVPlayer开发音频播放功能 + +使用AVPlayer可以实现端到端播放原始媒体资源,本开发指导将以完整地播放一首音乐作为示例,向开发者讲解AVPlayer音频播放相关功能。 + +以下指导仅介绍如何实现媒体资源播放,如果要实现后台播放或熄屏播放,需要使用[AVSession(媒体会话)](avsession-overview.md)和[申请长时任务](../task-management/continuous-task-dev-guide.md),避免播放被系统强制中断。 + + +播放的全流程包含:创建AVPlayer,设置播放资源,设置播放参数(音量/倍速/焦点模式),播放控制(播放/暂停/跳转/停止),重置,销毁资源。 + + +在进行应用开发的过程中,开发者可以通过AVPlayer的state属性主动获取当前状态或使用on('stateChange')方法监听状态变化。如果应用在音频播放器处于错误状态时执行操作,系统可能会抛出异常或生成其他未定义的行为。 + + +**图1** 播放状态变化示意图   +![Playback status change](figures/playback-status-change.png) + +状态的详细说明请参考[AVPlayerState](../reference/apis/js-apis-media.md#avplayerstate9)。当播放处于prepared / playing / paused / completed状态时,播放引擎处于工作状态,这需要占用系统较多的运行内存。当客户端暂时不使用播放器时,调用reset()或release()回收内存资源,做好资源利用。 + +## 开发步骤及注意事项 + +详细的API说明请参考[AVPlayer API参考](../reference/apis/js-apis-media.md#avplayer9)。 + +1. 创建实例createAVPlayer(),AVPlayer初始化idle状态。 + +2. 设置业务需要的监听事件,搭配全流程场景使用。支持的监听事件包括: + | 事件类型 | 说明 | + | -------- | -------- | + | stateChange | 必要事件,监听播放器的state属性改变。 | + | error | 必要事件,监听播放器的错误信息。 | + | durationUpdate | 用于进度条,监听进度条长度,刷新资源时长。 | + | timeUpdate | 用于进度条,监听进度条当前位置,刷新当前时间。 | + | seekDone | 响应API调用,监听seek()请求完成情况。
当使用seek()跳转到指定播放位置后,如果seek操作成功,将上报该事件。 | + | speedDone | 响应API调用,监听setSpeed()请求完成情况。
当使用setSpeed()设置播放倍速后,如果setSpeed操作成功,将上报该事件。 | + | volumeChange | 响应API调用,监听setVolume()请求完成情况。
当使用setVolume()调节播放音量后,如果setVolume操作成功,将上报该事件。 | + | bufferingUpdate | 用于网络播放,监听网络播放缓冲信息,用于上报缓冲百分比以及缓存播放进度。 | + | audioInterrupt | 监听音频焦点切换信息,搭配属性audioInterruptMode使用。
如果当前设备存在多个音频正在播放,音频焦点被切换(即播放其他媒体如通话等)时将上报该事件,应用可以及时处理。 | + +3. 设置资源:设置属性url,AVPlayer进入initialized状态。 + > **说明:** + > + > 下面代码示例中的url仅作示意使用,开发者需根据实际情况,确认资源有效性并设置: + > + > - 如果使用本地资源播放,必须确认资源文件可用,并使用应用沙箱路径访问对应资源,参考[获取应用文件路径](../application-models/application-context-stage.md#获取应用开发路径)。应用沙箱的介绍及如何向应用沙箱推送文件,请参考[文件管理](../file-management/app-sandbox-directory.md)。 + > + > - 如果使用网络播放路径,需[申请相关权限](../security/accesstoken-guidelines.md):ohos.permission.INTERNET。 + > + > - 如果使用ResourceManager.getRawFd打开HAP资源文件描述符,使用方法可参考[ResourceManager API参考](../reference/apis/js-apis-resource-manager.md#getrawfd9)。 + > + > - 需要使用[支持的播放格式与协议](avplayer-avrecorder-overview.md#支持的格式与协议)。 + +4. 准备播放:调用prepare(),AVPlayer进入prepared状态,此时可以获取duration,设置音量。 + +5. 音频播控:播放play(),暂停pause(),跳转seek(),停止stop() 等操作。 + +6. (可选)更换资源:调用reset()重置资源,AVPlayer重新进入idle状态,允许更换资源url。 + +7. 退出播放:调用release()销毁实例,AVPlayer进入released状态,退出播放。 + +## 完整示例 + +参考以下示例,完整地播放一首音乐。 + +```ts +import media from '@ohos.multimedia.media'; +import fs from '@ohos.file.fs'; +import common from '@ohos.app.ability.common'; + +export class AVPlayerDemo { + private avPlayer; + private count: number = 0; + + // 注册avplayer回调函数 + setAVPlayerCallback() { + // seek操作结果回调函数 + this.avPlayer.on('seekDone', (seekDoneTime) => { + console.info(`AVPlayer seek succeeded, seek time is ${seekDoneTime}`); + }) + // error回调监听函数,当avPlayer在操作过程中出现错误时调用reset接口触发重置流程 + this.avPlayer.on('error', (err) => { + console.error(`Invoke avPlayer failed, code is ${err.code}, message is ${err.message}`); + this.avPlayer.reset(); // 调用reset重置资源,触发idle状态 + }) + // 状态机变化回调函数 + this.avPlayer.on('stateChange', async (state, reason) => { + switch (state) { + case 'idle': // 成功调用reset接口后触发该状态机上报 + console.info('AVPlayer state idle called.'); + this.avPlayer.release(); // 调用release接口销毁实例对象 + break; + case 'initialized': // avplayer 设置播放源后触发该状态上报 + console.info('AVPlayerstate initialized called.'); + this.avPlayer.prepare().then(() => { + console.info('AVPlayer prepare succeeded.'); + }, (err) => { + console.error(`Invoke prepare failed, code is ${err.code}, message is ${err.message}`); + }); + break; + case 'prepared': // prepare调用成功后上报该状态机 + console.info('AVPlayer state prepared called.'); + this.avPlayer.play(); // 调用播放接口开始播放 + break; + case 'playing': // play成功调用后触发该状态机上报 + console.info('AVPlayer state playing called.'); + if (this.count !== 0) { + console.info('AVPlayer start to seek.'); + this.avPlayer.seek(this.avPlayer.duration); //seek到音频末尾 + } else { + this.avPlayer.pause(); // 调用暂停接口暂停播放 + } + this.count++; + break; + case 'paused': // pause成功调用后触发该状态机上报 + console.info('AVPlayer state paused called.'); + this.avPlayer.play(); // 再次播放接口开始播放 + break; + case 'completed': // 播放结束后触发该状态机上报 + console.info('AVPlayer state completed called.'); + this.avPlayer.stop(); //调用播放结束接口 + break; + case 'stopped': // stop接口成功调用后触发该状态机上报 + console.info('AVPlayer state stopped called.'); + this.avPlayer.reset(); // 调用reset接口初始化avplayer状态 + break; + case 'released': + console.info('AVPlayer state released called.'); + break; + default: + console.info('AVPlayer state unknown called.'); + break; + } + }) + } + + // 以下demo为使用fs文件系统打开沙箱地址获取媒体文件地址并通过url属性进行播放示例 + async avPlayerUrlDemo() { + // 创建avPlayer实例对象 + this.avPlayer = await media.createAVPlayer(); + // 创建状态机变化回调函数 + this.setAVPlayerCallback(); + let fdPath = 'fd://'; + // 通过UIAbilityContext获取沙箱地址filesDir,以Stage模型为例 + let context = getContext(this) as common.UIAbilityContext; + let pathDir = context.filesDir; + let path = pathDir + '/01.mp3'; + // 打开相应的资源文件地址获取fd,并为url赋值触发initialized状态机上报 + let file = await fs.open(path); + fdPath = fdPath + '' + file.fd; + this.avPlayer.url = fdPath; + } + + // 以下demo为使用资源管理接口获取打包在HAP内的媒体资源文件并通过fdSrc属性进行播放示例 + async avPlayerFdSrcDemo() { + // 创建avPlayer实例对象 + this.avPlayer = await media.createAVPlayer(); + // 创建状态机变化回调函数 + this.setAVPlayerCallback(); + // 通过UIAbilityContext的resourceManager成员的getRawFd接口获取媒体资源播放地址 + // 返回类型为{fd,offset,length},fd为HAP包fd地址,offset为媒体资源偏移量,length为播放长度 + let context = getContext(this) as common.UIAbilityContext; + let fileDescriptor = await context.resourceManager.getRawFd('01.mp3'); + // 为fdSrc赋值触发initialized状态机上报 + this.avPlayer.fdSrc = fileDescriptor; + } +} +``` diff --git a/zh-cn/application-dev/media/using-avrecorder-for-recording.md b/zh-cn/application-dev/media/using-avrecorder-for-recording.md new file mode 100644 index 0000000000000000000000000000000000000000..98c9c4633eb25462ed4d8a6f09ab78a7b9883b4e --- /dev/null +++ b/zh-cn/application-dev/media/using-avrecorder-for-recording.md @@ -0,0 +1,179 @@ +# 使用AVRecorder开发音频录制功能 + +使用AVRecorder可以实现音频录制功能,本开发指导将以“开始录制-暂停录制-恢复录制-停止录制”的一次流程为示例,向开发者讲解AVRecorder音频录制相关功能。 + +在进行应用开发的过程中,开发者可以通过AVRecorder的state属性,主动获取当前状态或使用on('stateChange')方法监听状态变化。开发过程中应该严格遵循状态机要求,例如只能在started状态下调用pause()接口,只能在paused状态下调用resume()接口。 + +**图1** 录制状态变化示意图   + +![Recording status change](figures/recording-status-change.png) + +状态的详细说明请参考[AVRecorderState](../reference/apis/js-apis-media.md#avrecorderstate9)。 + + +## 开发步骤及注意事项 + +详细的API说明请参考[AVRecorder API参考](../reference/apis/js-apis-media.md#avrecorder9)。 + +1. 创建AVRecorder实例,实例创建完成进入idle状态。 + + ```ts + import media from '@ohos.multimedia.media'; + + let avRecorder = undefined; + media.createAVRecorder().then((recorder) => { + avRecorder = recorder; + }, (err) => { + console.error(`Invoke createAVRecorder failed, code is ${err.code}, message is ${err.message}`); + }) + ``` + +2. 设置业务需要的监听事件,监听状态变化及错误上报。 + | 事件类型 | 说明 | + | -------- | -------- | + | stateChange | 必要事件,监听AVRecorder的state属性改变 | + | error | 必要事件,监听AVRecorder的错误信息 | + + + ```ts + // 状态上报回调函数 + avRecorder.on('stateChange', (state, reason) => { + console.log(`current state is ${state}`); + // 用户可以在此补充状态发生切换后想要进行的动作 + }) + + // 错误上报回调函数 + avRecorder.on('error', (err) => { + console.error(`avRecorder failed, code is ${err.code}, message is ${err.message}`); + }) + ``` + +3. 配置音频录制参数,调用prepare()接口,此时进入prepared状态。 + > **说明:** + > 配置参数需要注意: + > + > - prepare接口的入参avConfig中仅设置音频相关的配置参数,如示例代码所示。 + > 如果只需要录制音频,请不要设置视频相关配置参数;如果需要录制视频,可以参考[视频录制开发指导](video-recording.md)进行开发。直接设置视频相关参数会导致后续步骤报错。 + > + > - 需要使用支持的[录制规格](avplayer-avrecorder-overview.md#支持的格式)。 + > + > - 录制输出的url地址(即示例里avConfig中的url),形式为fd://xx (fd number)。需要基础文件操作接口([ohos.file.fs](../reference/apis/js-apis-file-fs.md))实现应用文件访问能力,获取方式参考[应用文件访问与管理](../file-management/app-file-access.md)。 + + + ```ts + let avProfile = { + audioBitrate: 100000, // 音频比特率 + audioChannels: 2, // 音频声道数 + audioCodec: media.CodecMimeType.AUDIO_AAC, // 音频编码格式,当前只支持aac + audioSampleRate: 48000, // 音频采样率 + fileFormat: media.ContainerFormatType.CFT_MPEG_4A, // 封装格式,当前只支持m4a + } + let avConfig = { + audioSourceType: media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC, // 音频输入源,这里设置为麦克风 + profile: avProfile, + url: 'fd://35', // 参考应用文件访问与管理中的开发示例获取创建的音频文件fd填入此处 + } + avRecorder.prepare(avConfig).then(() => { + console.log('Invoke prepare succeeded.'); + }, (err) => { + console.error(`Invoke prepare failed, code is ${err.code}, message is ${err.message}`); + }) + ``` + +4. 开始录制,调用start()接口,此时进入started状态。 + +5. 暂停录制,调用pause()接口,此时进入paused状态。 + +6. 恢复录制,调用resume()接口,此时再次进入started状态。 + +7. 停止录制,调用stop()接口,此时进入stopped状态。 + +8. 重置资源,调用reset()重新进入idle状态,允许重新配置录制参数。 + +9. 销毁实例,调用release()进入released状态,退出录制。 + + +## 完整示例 + + 参考以下示例,完成“开始录制-暂停录制-恢复录制-停止录制”的完整流程。 + +```ts +import media from '@ohos.multimedia.media'; + +export class AudioRecorderDemo { + private avRecorder; + private avProfile = { + audioBitrate: 100000, // 音频比特率 + audioChannels: 2, // 音频声道数 + audioCodec: media.CodecMimeType.AUDIO_AAC, // 音频编码格式,当前只支持aac + audioSampleRate: 48000, // 音频采样率 + fileFormat: media.ContainerFormatType.CFT_MPEG_4A, // 封装格式,当前只支持m4a + }; + private avConfig = { + audioSourceType: media.AudioSourceType.AUDIO_SOURCE_TYPE_MIC, // 音频输入源,这里设置为麦克风 + profile: this.avProfile, + url: 'fd://35', // 参考应用文件访问与管理开发示例新建并读写一个文件 + }; + + // 注册audioRecorder回调函数 + setAudioRecorderCallback() { + // 状态机变化回调函数 + this.avRecorder.on('stateChange', (state, reason) => { + console.log(`AudioRecorder current state is ${state}`); + }) + // 错误上报回调函数 + this.avRecorder.on('error', (err) => { + console.error(`AudioRecorder failed, code is ${err.code}, message is ${err.message}`); + }) + } + + // 开始录制对应的流程 + async startRecordingProcess() { + // 1.创建录制实例 + this.avRecorder = await media.createAVRecorder(); + this.setAudioRecorderCallback(); + // 2.获取录制文件fd赋予avConfig里的url;参考FilePicker文档 + // 3.配置录制参数完成准备工作 + await this.avRecorder.prepare(this.avConfig); + // 4.开始录制 + await this.avRecorder.start(); + } + + // 暂停录制对应的流程 + async pauseRecordingProcess() { + if (this.avRecorder.state === 'started') { // 仅在started状态下调用pause为合理状态切换 + await this.avRecorder.pause(); + } + } + + // 恢复录制对应的流程 + async resumeRecordingProcess() { + if (this.avRecorder.state === 'paused') { // 仅在paused状态下调用resume为合理状态切换 + await this.avRecorder.resume(); + } + } + + // 停止录制对应的流程 + async stopRecordingProcess() { + // 1. 停止录制 + if (this.avRecorder.state === 'started' + || this.avRecorder.state === 'paused') { // 仅在started或者paused状态下调用stop为合理状态切换 + await this.avRecorder.stop(); + } + // 2.重置 + await this.avRecorder.reset(); + // 3.释放录制实例 + await this.avRecorder.release(); + // 4.关闭录制文件fd + } + + // 一个完整的【开始录制-暂停录制-恢复录制-停止录制】示例 + async audioRecorderDemo() { + await this.startRecordingProcess(); // 开始录制 + // 用户此处可以自行设置录制时长,例如通过设置休眠阻止代码执行 + await this.pauseRecordingProcess(); //暂停录制 + await this.resumeRecordingProcess(); // 恢复录制 + await this.stopRecordingProcess(); // 停止录制 + } +} +``` diff --git a/zh-cn/application-dev/media/using-avsession-controller.md b/zh-cn/application-dev/media/using-avsession-controller.md new file mode 100644 index 0000000000000000000000000000000000000000..37aea26eb24fd8eeeb011a3ca2a9be5eda43218c --- /dev/null +++ b/zh-cn/application-dev/media/using-avsession-controller.md @@ -0,0 +1,244 @@ +# 媒体会话控制方 + +OpenHarmony系统预置的播控中心,作为媒体会话控制方与音视频应用进行交互,包括获取媒体信息进行展示以及下发播控命令等。 + +系统应用开发者也可以根据需要,按照本章节的内容自行开发一款新的系统应用(例如新开发一款播控中心或语音助手),作为媒体会话控制方的角色,与系统中的音视频应用进行交互。 + +## 基本概念 + +- 媒体会话描述符(AVSessionDescriptor):描述媒体会话的相关信息,包含标识媒体会话的ID(sessionId),媒体会话的类型type(音频Audio/视频Video),媒体会话自定义名称(sessionTag),媒体会话所属应用的信息(elementName)、是否为置顶会话(isTopSession)等。 + +- 置顶会话(TopSession):系统中优先级最高的媒体会话,例如当前处于正在播放状态的会话。一般来说,如果想与媒体会话通信,需要获取会话对应的控制器,而媒体会话控制方可以在不用获取对应控制器的情况下,直接与置顶会话通信,例如直接向置顶会话发送播控命令和按键事件。 + +## 接口说明 + +媒体会话控制方使用的关键接口如下表所示。接口返回值有两种返回形式:callback和promise,下表中为callback形式接口,promise和callback只是返回值方式不一样,功能相同。 + +更多API说明请参见[API文档](../reference/apis/js-apis-avsession.md)。 + +| 接口名 | 说明 | +| -------- | -------- | +| getAllSessionDescriptors(callback: AsyncCallback<Array<Readonly<AVSessionDescriptor>>>): void | 获取系统中所有媒体会话的描述符。 | +| createController(sessionId: string, callback: AsyncCallback<AVSessionController>): void | 创建媒体会话控制器。 | +| getValidCommands(callback: AsyncCallback<Array<AVControlCommandType>>): void | 获取媒体会话支持的有效命令。
音视频应用在接入媒体会话时监听的播控命令,即为媒体会话支持的有效命令,相关信息请参见[媒体会话提供方监听播控命令事件](using-avsession-developer.md)。 | +| getLaunchAbility(callback: AsyncCallback<WantAgent>): void | 获取媒体会话中配置的可被拉起的UIAbility。
当用户在媒体会话控制方应用进行界面操作,例如点击了播控中心卡片后,可以拉起对应的应用。 | +| sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback<void>): void | 通过会话对应的AVSessionController向会话发送按键命令。 | +| sendSystemAVKeyEvent(event: KeyEvent, callback: AsyncCallback<void>): void | 向置顶会话发送按键命令。 | +| sendControlCommand(command: AVControlCommand, callback: AsyncCallback<void>): void | 通过会话对应的AVSessionController向会话发送播控命令。 | +| sendSystemControlCommand(command: AVControlCommand, callback: AsyncCallback<void>): void | 向置顶会话发送播控命令。 | + +## 开发步骤 + +系统应用作为媒体会话控制方接入媒体会话的基本步骤如下所示: + +1. 通过AVSessionManager获取媒体会话描述符AVSessionDescriptor,创建媒体会话控制器AVSessionController。 + 媒体会话控制方可以获取当前系统中所有的AVSessionDescriptor,并创建每个会话对应的AVSessionController,从而对系统中的音视频应用进行统一的播放控制。 + + ```ts + //导入AVSessionManager模块 + import AVSessionManager from '@ohos.multimedia.avsession'; + + // 全局变量定义 + let g_controller = new Array(); + let g_centerSupportCmd:Set = new Set(['play', 'pause', 'playNext', 'playPrevious', 'fastForward', 'rewind', 'seek','setSpeed', 'setLoopMode', 'toggleFavorite']); + let g_validCmd:Set; + // 获取会话描述符,创建控制器 + AVSessionManager.getAllSessionDescriptors().then((descriptors) => { + descriptors.forEach((descriptor) => { + AVSessionManager.createController(descriptor.sessionId).then((controller) => { + g_controller.push(controller); + }).catch((err) => { + console.error(`createController : ERROR : ${err.message}`); + }); + }); + }).catch((err) => { + console.error(`getAllSessionDescriptors : ERROR : ${err.message}`); + }); + + ``` + +2. 监听AVSession会话状态及AVSession服务状态事件。 + + AVSession会话状态事件包括: + + - sessionCreate:媒体会话创建事件。 + - sessionDestroy:媒体会话销毁事件。 + - topSessionChange:置顶会话发生变化事件。 + + AVSession服务状态事件指sessionServiceDie,在AVSession服务异常时产生该事件。 + + ```ts + // 注册会话创建监听,创建控制器 + AVSessionManager.on('sessionCreate', (session) => { + // 新增会话,需要创建控制器 + AVSessionManager.createController(session.sessionId).then((controller) => { + g_controller.push(controller); + }).catch((err) => { + console.info(`createController : ERROR : ${err.message}`); + }); + }); + + // 注册系统会话销毁监听 + AVSessionManager.on('sessionDestroy', (session) => { + let index = g_controller.findIndex((controller) => { + return controller.sessionId === session.sessionId; + }); + if (index !== 0) { + g_controller[index].destroy(); + g_controller.splice(index, 1); + } + }); + // 注册系统最高优先级会话变更监听 + AVSessionManager.on('topSessionChange', (session) => { + let index = g_controller.findIndex((controller) => { + return controller.sessionId === session.sessionId; + }); + // 将该会话显示排到第一个 + if (index !== 0) { + g_controller.sort((a, b) => { + return a.sessionId === session.sessionId ? -1 : 0; + }); + } + }); + // 注册服务异常监听 + AVSessionManager.on('sessionServiceDie', () => { + // 服务端异常,应用清理资源 + console.info("服务端异常"); + }) + ``` + +3. 监听媒体信息变化及会话其他事件。 + + AVSession媒体信息变化事件主要包括: + + - metadataChange:媒体会话元数据变化事件。 + - playbackStateChange:媒体播放状态变化事件。 + - activeStateChange:媒体会话激活状态变化事件。 + - validCommandChange:媒体会话支持的有效命令变化事件。 + - outputDeviceChange:播放设备变化事件。 + - sessionDestroy:媒体会话销毁事件。 + + 媒体会话控制方可以根据实际需要监听对应的事件。 + + ```ts + // 注册会话激活状态变更监听 + controller.on('activeStateChange', (isActive) => { + if (isActive) { + console.info("控制器卡片按键高亮"); + } else { + console.info("控制器卡片按键变更为无效"); + } + }); + // 注册会话销毁监听 + controller.on('sessionDestroy', () => { + console.info('on sessionDestroy : SUCCESS '); + controller.destroy().then(() => { + console.info('destroy : SUCCESS '); + }).catch((err) => { + console.info(`destroy : ERROR :${err.message}`); + }); + }); + + // 注册元数据更新监听 + let metaFilter = ['assetId', 'title', 'description']; + controller.on('metadataChange', metaFilter, (metadata) => { + console.info(`on metadataChange assetId : ${metadata.assetId}`); + }); + // 注册播放状态更新监听 + let playbackFilter = ['state', 'speed', 'loopMode']; + controller.on('playbackStateChange', playbackFilter, (playbackState) => { + console.info(`on playbackStateChange state : ${playbackState.state}`); + }); + // 注册会话支持的命令变更监听 + controller.on('validCommandChange', (cmds) => { + console.info(`validCommandChange : SUCCESS : size : ${cmds.size}`); + console.info(`validCommandChange : SUCCESS : cmds : ${cmds.values()}`); + g_validCmd.clear(); + for (let c of g_centerSupportCmd) { + if (cmds.has(c)) { + g_validCmd.add(c); + } + } + }); + // 注册输出设备变更监听 + controller.on('outputDeviceChange', (device) => { + console.info(`on outputDeviceChange device isRemote : ${device.isRemote}`); + }); + ``` + +4. 获取媒体会话提供方传递的媒体信息,可以用于界面展示,例如在播控中心展示当前播放的曲目及对应的播放状态。 + + ```ts + async getInfoFromSessionByController() { + // 假设我们已经有了一个对应session的controller,如何创建controller可以参考之前的案例 + let controller: AVSessionManager.AVSessionController = ALLREADY_HAVE_A_CONTROLLER; + // 获取sessionId + let sessionId: string = controller.sessionId; + console.info(`get sessionId by controller : isActive : ${sessionId}`); + // 获取session激活状态 + let isActive: boolean = await controller.isActive(); + console.info(`get activeState by controller : ${isActive}`); + // 获取session的媒体信息 + let metadata: AVSessionManager.AVMetadata = await controller.getAVMetadata(); + console.info(`get media title by controller : ${metadata.title}`); + console.info(`get media artist by controller : ${metadata.artist}`); + // 获取session的播放信息 + let avPlaybackState: AVSessionManager.AVPlaybackState = await controller.getAVPlaybackState(); + console.info(`get playbackState by controller : ${avPlaybackState.state}`); + console.info(`get favoriteState by controller : ${avPlaybackState.isFavorite}`); + } + ``` + +5. 控制媒体会话行为,例如发送用户在播控中心对当前曲目的操作(播放/暂停/上一首/下一首等)命令。 + + 作为媒体会话提供方的音视频应用在监听到相关的播控命令事件后,在相应的逻辑中可以完成对应的操作动作。 + + + ```ts + async sendCommandToSessionByController() { + // 假设我们已经有了一个对应session的controller,如何创建controller可以参考之前的案例 + let controller: AVSessionManager.AVSessionController = ALLREADY_HAVE_A_CONTROLLER; + // 获取这个session支持的命令种类 + let validCommandTypeArray: Array = await controller.getValidCommands(); + console.info(`get validCommandArray by controller : length : ${validCommandTypeArray.length}`); + // 下发播放命令 + // 如果可用命令包含播放,则下发播放命令,正常session都应该提供并实现播放功能 + if (validCommandTypeArray.indexOf('play') >= 0) { + let avCommand: AVSessionManager.AVControlCommand = {command:'play'}; + controller.sendControlCommand(avCommand); + } + // 下发暂停命令 + if (validCommandTypeArray.indexOf('pause') >= 0) { + let avCommand: AVSessionManager.AVControlCommand = {command:'pause'}; + controller.sendControlCommand(avCommand); + } + // 下发上一首命令 + if (validCommandTypeArray.indexOf('playPrevious') >= 0) { + let avCommand: AVSessionManager.AVControlCommand = {command:'playPrevious'}; + controller.sendControlCommand(avCommand); + } + // 下发下一首命令 + if (validCommandTypeArray.indexOf('playNext') >= 0) { + let avCommand: AVSessionManager.AVControlCommand = {command:'playNext'}; + controller.sendControlCommand(avCommand); + } + } + ``` + +6. 在媒体会话控制方应用退出时及时取消事件监听,并释放资源。 + + ```ts + async destroyController() { + // 假设我们已经有了一个对应session的controller,如何创建controller可以参考之前的案例 + let controller: AVSessionManager.AVSessionController = ALLREADY_HAVE_A_CONTROLLER; + + // 销毁当前的controller,销毁后这个controller将不在可用 + controller.destroy(function (err) { + if (err) { + console.info(`Destroy controller ERROR : code: ${err.code}, message: ${err.message}`); + } else { + console.info('Destroy controller SUCCESS'); + } + }); + } + ``` diff --git a/zh-cn/application-dev/media/using-avsession-developer.md b/zh-cn/application-dev/media/using-avsession-developer.md new file mode 100644 index 0000000000000000000000000000000000000000..40643ac3e089c5cf6cbd0e980cbab7b3b744d2fd --- /dev/null +++ b/zh-cn/application-dev/media/using-avsession-developer.md @@ -0,0 +1,198 @@ +# 媒体会话提供方 + +音视频应用在实现音视频功能的同时,需要作为媒体会话提供方接入媒体会话,在媒体会话控制方(例如播控中心)中展示媒体相关信息,及响应媒体会话控制方下发的播控命令。 + +## 基本概念 + +- 媒体会话元数据(AVMetadata): 用于描述媒体数据相关属性,包含标识当前媒体的ID(assetId),上一首媒体的ID(previousAssetId),下一首媒体的ID(nextAssetId),标题(title),专辑作者(author),专辑名称(album),词作者(writer),媒体时长(duration)等属性。 + +- 媒体播放状态(AVPlaybackState):用于描述媒体播放状态的相关属性,包含当前媒体的播放状态(state)、播放位置(position)、播放倍速(speed)、缓冲时间(bufferedTime)、循环模式(loopMode)、是否收藏(isFavorite)等属性。 + +## 接口说明 + +媒体会话提供方使用的关键接口如下表所示。接口返回值有两种返回形式:callback和promise,下表中为callback形式接口,promise和callback只是返回值方式不一样,功能相同。 + +更多API说明请参见[API文档](../reference/apis/js-apis-avsession.md)。 + +| 接口名 | 说明 | +| -------- | -------- | +| createAVSession(context: Context, tag: string, type: AVSessionType, callback: AsyncCallback<AVSession>): void | 创建媒体会话。
一个UIAbility只能存在一个媒体会话,重复创建会失败。 | +| setAVMetadata(data: AVMetadata, callback: AsyncCallback<void>): void | 设置媒体会话元数据。 | +| setAVPlaybackState(state: AVPlaybackState, callback: AsyncCallback<void>): void | 设置媒体会话播放状态。 | +| setLaunchAbility(ability: WantAgent, callback: AsyncCallback<void>): void | 设置启动UIAbility。 | +| getController(callback: AsyncCallback<AVSessionController>): void | 获取当前会话自身控制器。 | +| activate(callback: AsyncCallback<void>): void | 激活媒体会话。 | +| destroy(callback: AsyncCallback<void>): void | 销毁媒体会话。 | + +## 开发步骤 + +音视频应用作为媒体会话提供方接入媒体会话的基本步骤如下所示: + +1. 通过AVSessionManager的方法创建并激活媒体会话。 + + ```ts + import AVSessionManager from '@ohos.multimedia.avsession'; //导入AVSessionManager模块 + + // 创建session + async createSession() { + let session: AVSessionManager.AVSession = await AVSessionManager.createAVSession(this.context, 'SESSION_NAME', 'audio'); + session.activate(); + console.info(`session create done : sessionId : ${session.sessionId}`); + } + ``` + +2. 跟随媒体信息的变化,及时设置媒体会话信息。需要设置的媒体会话信息主要包括: + - 媒体会话元数据AVMetadata。 + - 媒体播放状态AVPlaybackState。 + + 音视频应用设置的媒体会话信息,会被媒体会话控制方通过AVSessionController相关方法获取后进行显示或处理。 + + ```ts + async setSessionInfo() { + // 假设已经创建了一个session,如何创建session可以参考之前的案例 + let session: AVSessionManager.AVSession = ALLREADY_CREATE_A_SESSION; + // 播放器逻辑··· 引发媒体信息与播放状态的变更 + // 设置必要的媒体信息 + let metadata: AVSessionManager.AVMetadata = { + assetId: "0", + title: "TITLE", + artist: "ARTIST" + }; + session.setAVMetadata(metadata).then(() => { + console.info('SetAVMetadata successfully'); + }).catch((err) => { + console.info(`SetAVMetadata BusinessError: code: ${err.code}, message: ${err.message}`); + }); + // 简单设置一个播放状态 - 暂停 未收藏 + let playbackState: AVSessionManager.AVPlaybackState = { + state:AVSessionManager.PlaybackState.PLAYBACK_STATE_PAUSE, + isFavorite:false + }; + session.setAVPlaybackState(playbackState, function (err) { + if (err) { + console.info(`SetAVPlaybackState BusinessError: code: ${err.code}, message: ${err.message}`); + } else { + console.info('SetAVPlaybackState successfully'); + } + }); + } + ``` + +3. 设置用于被媒体会话控制方拉起的UIAbility。当用户操作媒体会话控制方的界面时,例如点击播控中心的卡片,可以拉起此处配置的UIAbility。 + 设置UIAbility时通过WantAgent接口实现,更多关于WantAgent的信息请参考[WantAgent](../reference/apis/js-apis-app-ability-wantAgent.md)。 + + ```ts + import WantAgent from "@ohos.app.ability.wantAgent"; + ``` + + ```ts + // 假设已经创建了一个session,如何创建session可以参考之前的案例 + let session: AVSessionManager.AVSession = ALLREADY_CREATE_A_SESSION; + let wantAgentInfo: { + wants: [ + { + bundleName: "com.example.musicdemo", + abilityName: "com.example.musicdemo.MainAbility" + } + ], + operationType: WantAgent.OperationType.START_ABILITIES, + requestCode: 0, + wantAgentFlags: [WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] + } + WantAgent.getWantAgent(wantAgentInfo).then((agent) => { + session.setLaunchAbility(agent) + }) + ``` + +4. 注册播控命令事件监听,便于响应用户通过媒体会话控制方,例如播控中心,下发的播控命令。 + > **说明:** + > + > 媒体会话提供方在注册相关播控命令事件监听时,监听的事件会在媒体会话控制方的getValidCommands()方法中体现,即媒体会话控制方会认为对应的方法有效,进而根据需要触发相应的事件。为了保证媒体会话控制方下发的播控命令可以被正常执行,媒体会话提供方请勿进行无逻辑的空实现监听。 + + ```ts + async setListenerForMesFromController() { + // 假设已经创建了一个session,如何创建session可以参考之前的案例 + let session: AVSessionManager.AVSession = ALLREADY_CREATE_A_SESSION; + // 一般在监听器中会对播放器做相应逻辑处理 + // 不要忘记处理完后需要通过set接口同步播放相关信息,参考上面的用例 + session.on('play', () => { + console.info('on play , do play task'); + + // do some tasks ··· + }); + session.on('pause', () => { + console.info('on pause , do pause task'); + // do some tasks ··· + }); + session.on('stop', () => { + console.info('on stop , do stop task'); + // do some tasks ··· + }); + session.on('playNext', () => { + console.info('on playNext , do playNext task'); + // do some tasks ··· + }); + session.on('playPrevious', () => { + console.info('on playPrevious , do playPrevious task'); + // do some tasks ··· + }); + } + ``` + +5. 获取当前媒体会话自身的控制器,与媒体会话对应进行通信交互。 + + ```ts + async createControllerFromSession() { + // 假设已经创建了一个session,如何创建session可以参考之前的案例 + let session: AVSessionManager.AVSession = ALLREADY_CREATE_A_SESSION; + + // 通过已有session获取一个controller对象 + let controller: AVSessionManager.AVSessionController = await session.getController(); + + // controller可以与原session对象进行基本的通信交互,比如下发播放命令 + let avCommand: AVSessionManager.AVControlCommand = {command:'play'}; + controller.sendControlCommand(avCommand); + + // 或者做状态变更监听 + controller.on('playbackStateChange', 'all', (state: AVSessionManager.AVPlaybackState) => { + + // do some things + }); + + // controller可以做的操作还有很多,具体可以参考媒体会话控制方相关的说明 + } + ``` + +6. 音视频应用在退出,并且不需要继续播放时,及时取消监听以及销毁媒体会话释放资源。 + 取消播控命令监听的示例代码如下所示 : + + ```ts + async unregisterSessionListener() { + // 假设已经创建了一个session,如何创建session可以参考之前的案例 + let session: AVSessionManager.AVSession = ALLREADY_CREATE_A_SESSION; + + // 取消指定session下的相关监听 + session.off('play'); + session.off('pause'); + session.off('stop'); + session.off('playNext'); + session.off('playPrevious'); + } + ``` + + 销毁媒体会话示例代码如下所示: + + ```ts + async destroySession() { + // 假设已经创建了一个session,如何创建session可以参考之前的案例 + let session: AVSessionManager.AVSession = ALLREADY_CREATE_A_SESSION; + // 主动销毁已创建的session + session.destroy(function (err) { + if (err) { + console.info(`Destroy BusinessError: code: ${err.code}, message: ${err.message}`); + } else { + console.info('Destroy : SUCCESS '); + } + }); + } + ``` diff --git a/zh-cn/application-dev/media/using-distributed-avsession.md b/zh-cn/application-dev/media/using-distributed-avsession.md new file mode 100644 index 0000000000000000000000000000000000000000..a37f93e62b264f18e0c080174d59cfaa7918bced --- /dev/null +++ b/zh-cn/application-dev/media/using-distributed-avsession.md @@ -0,0 +1,55 @@ +# 使用分布式媒体会话 + +## 基本概念 + +- 远端媒体会话:可信组网内的设备创建本地媒体会话后,媒体会话服务会将本地会话自动同步到远端,生成远端媒体会话。本地媒体会话与远端媒体会话时刻保持同步。 + +- 远端媒体会话控制器:远端投播后,远端设备上的媒体会话控制器。 + +## 接口说明 + +使用分布式媒体会话进行远端投播时使用的关键接口如下表所示。接口返回值有两种返回形式:callback和promise,下表中为callback形式接口,promise和callback只是返回值方式不一样,功能相同。 + +更多API说明请参见[API文档](../reference/apis/js-apis-avsession.md)。 + +| 接口名 | 说明 | +| -------- | -------- | +| castAudio(session: SessionToken \| 'all', audioDevices: Array<audio.AudioDeviceDescriptor>, callback: AsyncCallback<void>): void | 投播会话到指定设备列表。 | + +## 开发步骤 + +系统应用作为媒体会话控制方接入媒体会话时,根据需要使用分布式媒体会话进行投播的步骤如下所示: + +1. 导入模块接口。由于在进行投播之前,需要从audio模块获取音频设备描述符AudioDeviceDescriptor,所以除了导入AVSessionManager模块外,还需要导入audio模块。 + + ```ts + import AVSessionManager from '@ohos.multimedia.avsession'; + import audio from '@ohos.multimedia.audio'; + ``` + +2. 通过AVSessionManager的castAudio接口将当前设备所有会话投播到其他设备。 + + ```ts + // 投播到其他设备 + let audioManager = audio.getAudioManager(); + let audioRoutingManager = audioManager.getRoutingManager(); + let audioDevices; + await audioRoutingManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data) => { + audioDevices = data; + console.info('Promise returned to indicate that the device list is obtained.'); + }).catch((err) => { + console.info(`getDevices : ERROR : ${err.message}`); + }); + + AVSessionManager.castAudio('all', audioDevices).then(() => { + console.info('createController : SUCCESS'); + }).catch((err) => { + console.info(`createController : ERROR : ${err.message}`); + }); + ``` + + 系统应用在投播主控端发起投播后,媒体会话框架会通知远端设备的AVSession服务创建远端媒体会话。投播主控端的媒体会话变化时(例如媒体信息变化、播放状态变化等),媒体会话框架会自动同步变化到远端设备。 + + 远端设备上的媒体会话处理机制,与本地设备上的机制保持一致,即远端设备上的媒体会话控制方,例如播控中心,会监听媒体会话创建事件,并创建相应的远端媒体会话控制器对远端媒体会话进行管理,而管理过程中的控制命令会由媒体会话框架自动同步到投播主控端设备。 + + 本地投播主控端中的媒体会话提供方,例如各音视频应用,会监听各类播控命令事件,从而可以及时响应来自远端设备的各类播控命令。 diff --git a/zh-cn/application-dev/media/using-opensl-es-for-playback.md b/zh-cn/application-dev/media/using-opensl-es-for-playback.md new file mode 100644 index 0000000000000000000000000000000000000000..72072a6077bb1e54bdd9914066b64482c3d66eb4 --- /dev/null +++ b/zh-cn/application-dev/media/using-opensl-es-for-playback.md @@ -0,0 +1,131 @@ +# 使用OpenSL ES开发音频播放功能 + +OpenSL ES全称为Open Sound Library for Embedded Systems,是一个嵌入式、跨平台、免费的音频处理库。为嵌入式移动多媒体设备上的应用开发者提供标准化、高性能、低延迟的API。OpenHarmony的Native API基于[Khronos Group](https://www.khronos.org/)开发的[OpenSL ES](https://www.khronos.org/opensles/) 1.0.1 API 规范实现,开发者可以通过<OpenSLES.h>和<OpenSLES_OpenHarmony.h>在OpenHarmony上使用相关API。 + +## OpenHarmony上的OpenSL ES + +OpenSL ES中提供了以下的接口,OpenHarmony当前仅实现了部分[接口](https://gitee.com/openharmony/third_party_opensles/blob/master/api/1.0.1/OpenSLES.h),可以实现音频播放的基础功能。 + +调用未实现接口后会返回**SL_RESULT_FEATURE_UNSUPPORTED,**当前没有相关扩展可以使用。 + +以下列表列举了OpenHarmony上已实现的OpenSL ES的接口,具体说明请参考[OpenSL ES](https://www.khronos.org/opensles/)规范: + +- **OpenHarmony上支持的Engine接口:** + - SLresult (\*CreateAudioPlayer) (SLEngineItf self, SLObjectItf \* pPlayer, SLDataSource \*pAudioSrc, SLDataSink \*pAudioSnk, SLuint32 numInterfaces, const SLInterfaceID \* pInterfaceIds, const SLboolean \* pInterfaceRequired) + - SLresult (\*CreateAudioRecorder) (SLEngineItf self, SLObjectItf \* pRecorder, SLDataSource \*pAudioSrc, SLDataSink \*pAudioSnk, SLuint32 numInterfaces, const SLInterfaceID \* pInterfaceIds, const SLboolean \* pInterfaceRequired) + - SLresult (\*CreateOutputMix) (SLEngineItf self, SLObjectItf \* pMix, SLuint32 numInterfaces, const SLInterfaceID \* pInterfaceIds, const SLboolean \* pInterfaceRequired) + +- **OpenHarmony上支持的Object接口:** + - SLresult (\*Realize) (SLObjectItf self, SLboolean async) + - SLresult (\*GetState) (SLObjectItf self, SLuint32 \* pState) + - SLresult (\*GetInterface) (SLObjectItf self, const SLInterfaceID iid, void \* pInterface) + - void (\*Destroy) (SLObjectItf self) + +- **OpenHarmony上支持的Playback接口:** + - SLresult (\*SetPlayState) (SLPlayItf self, SLuint32 state) + - SLresult (\*GetPlayState) (SLPlayItf self, SLuint32 \*pState) + +- **OpenHarmony上支持的Volume控制接口**: + - SLresult (\*SetVolumeLevel) (SLVolumeItf self, SLmillibel level) + - SLresult (\*GetVolumeLevel) (SLVolumeItf self, SLmillibel \*pLevel) + - SLresult (\*GetMaxVolumeLevel) (SLVolumeItf self, SLmillibel \*pMaxLevel) + +- **OpenHarmony上支持的BufferQueue接口**: + + 以下接口需引入<OpenSLES_OpenHarmony.h>使用。 + | 接口 | 说明 | + | -------- | -------- | + | SLresult (\*Enqueue) (SLOHBufferQueueItf self, const void \*buffer, SLuint32 size) | 根据情况将buffer加到相应队列中。
如果是播放操作,则将带有音频数据的buffer插入到filledBufferQ_队列中;如果是录音操作,则将录音使用后的空闲buffer插入到freeBufferQ_队列中。
self:表示调用该函数的BufferQueue接口对象。
buffer:播放时表示带有音频数据的buffer,录音时表示已存储完录音数据后的空闲buffer。
size:表示buffer的大小。 | + | SLresult (\*Clear) (SLOHBufferQueueItf self) | 释放BufferQueue接口对象。
self:表示调用该函数的BufferQueue接口对象将被释放。 | + | SLresult (\*GetState) (SLOHBufferQueueItf self, SLOHBufferQueueState \*state) | 获取BufferQueue接口对象状态。
self:表示调用该函数的BufferQueue接口对象。
state:BufferQueue的当前状态。 | + | SLresult (\*RegisterCallback) (SLOHBufferQueueItf self, SlOHBufferQueueCallback callback, void\* pContext) | 注册回调函数。
self:表示调用该函数的BufferQueue接口对象。
callback:播放/录音时注册的回调函数。
pContext:播放时传入待播放音频文件,录音时传入将要录制的音频文件。 | + | SLresult (\*GetBuffer) (SLOHBufferQueueItf self, SLuint8\*\* buffer, SLuint32\* size) | 根据情况获取相应的buffer。
如果是播放操作,则从freeBufferQ_队列中获取空闲buffer;如果是录音操作,则从filledBufferQ_队列中获取携带录音数据的buffer。
self:表示调用该函数的BufferQueue接口对象。
buffer:播放时表示空闲的buffer,录音时表示携带录音数据的buffer。
size:表示buffer的大小。 | + +## 完整示例 + +参考以下示例代码,播放一个音频文件。 + +1. 添加头文件。 + + ```c++ + #include + #include + #include + ``` + +2. 使用slCreateEngine接口和获取engine实例。 + + ```c++ + SLObjectItf engineObject = nullptr; + slCreateEngine(&engineObject, 0, nullptr, 0, nullptr, nullptr); + (*engineObject)->Realize(engineObject, SL_BOOLEAN_FALSE); + ``` + +3. 获取接口SL_IID_ENGINE的engineEngine实例。 + + ```c++ + SLEngineItf engineEngine = nullptr; + (*engineObject)->GetInterface(engineObject, SL_IID_ENGINE, &engineEngine); + ``` + +4. 配置播放器信息,创建AudioPlayer。 + + ```c++ + SLDataLocator_BufferQueue slBufferQueue = { + SL_DATALOCATOR_BUFFERQUEUE, + 0 + }; + + // 具体参数需要根据音频文件格式进行适配 + SLDataFormat_PCM pcmFormat = { + SL_DATAFORMAT_PCM, + 2, // 通道数 + SL_SAMPLINGRATE_48, // 采样率 + SL_PCMSAMPLEFORMAT_FIXED_16, // 音频采样格式 + 0, + 0, + 0 + }; + SLDataSource slSource = {&slBufferQueue, &pcmFormat}; + SLObjectItf pcmPlayerObject = nullptr; + (*engineEngine)->CreateAudioPlayer(engineEngine, &pcmPlayerObject, &slSource, null, 0, nullptr, nullptr); + (*pcmPlayerObject)->Realize(pcmPlayerObject, SL_BOOLEAN_FALSE); + ``` + +5. 获取接口SL_IID_OH_BUFFERQUEUE的bufferQueueItf实例。 + + ```c++ + SLOHBufferQueueItf bufferQueueItf; + (*pcmPlayerObject)->GetInterface(pcmPlayerObject, SL_IID_OH_BUFFERQUEUE, &bufferQueueItf); + ``` + +6. 打开音频文件,注册BufferQueueCallback回调。 + + ```c++ + static void BufferQueueCallback (SLOHBufferQueueItf bufferQueueItf, void *pContext, SLuint32 size) + { + SLuint8 *buffer = nullptr; + SLuint32 pSize; + (*bufferQueueItf)->GetBuffer(bufferQueueItf, &buffer, &pSize); + // 将待播放音频数据写入buffer + (*bufferQueueItf)->Enqueue(bufferQueueItf, buffer, size); + } + void *pContext; // 可传入自定义的上下文信息,会在Callback内收到 + (*bufferQueueItf)->RegisterCallback(bufferQueueItf, BufferQueueCallback, pContext); + ``` + +7. 获取接口SL_PLAYSTATE_PLAYING的playItf实例,开始播放。 + + ```c++ + SLPlayItf playItf = nullptr; + (*pcmPlayerObject)->GetInterface(pcmPlayerObject, SL_IID_PLAY, &playItf); + (*playItf)->SetPlayState(playItf, SL_PLAYSTATE_PLAYING); + ``` + +8. 结束音频播放。 + + ```c++ + (*playItf)->SetPlayState(playItf, SL_PLAYSTATE_STOPPED); + (*pcmPlayerObject)->Destroy(pcmPlayerObject); + (*engineObject)->Destroy(engineObject); + ``` diff --git a/zh-cn/application-dev/media/using-opensl-es-for-recording.md b/zh-cn/application-dev/media/using-opensl-es-for-recording.md new file mode 100644 index 0000000000000000000000000000000000000000..70e57a8fa95e23509736329dd7ccc88a8d3420c1 --- /dev/null +++ b/zh-cn/application-dev/media/using-opensl-es-for-recording.md @@ -0,0 +1,148 @@ +# 使用OpenSL ES开发音频录制功能 + +OpenSL ES全称为Open Sound Library for Embedded Systems,是一个嵌入式、跨平台、免费的音频处理库。为嵌入式移动多媒体设备上的应用开发者提供标准化、高性能、低延迟的API。OpenHarmony的Native API基于[Khronos Group](https://www.khronos.org/)开发的[OpenSL ES](https://www.khronos.org/opensles/) 1.0.1 API 规范实现,开发者可以通过<OpenSLES.h>和<OpenSLES_OpenHarmony.h>在OpenHarmony上使用相关API。 + +## OpenHarmony上的OpenSL ES + +OpenSL ES中提供了以下的接口,OpenHarmony当前仅实现了部分[接口](https://gitee.com/openharmony/third_party_opensles/blob/master/api/1.0.1/OpenSLES.h),可以实现音频录制的基础功能。 + +调用未实现接口后会返回**SL_RESULT_FEATURE_UNSUPPORTED,**当前没有相关扩展可以使用。 + +以下列表列举了OpenHarmony上已实现的OpenSL ES的接口,具体说明请参考[OpenSL ES](https://www.khronos.org/opensles/)规范: + +- **OpenHarmony上支持的Engine接口:** + - SLresult (\*CreateAudioPlayer) (SLEngineItf self, SLObjectItf \* pPlayer, SLDataSource \*pAudioSrc, SLDataSink \*pAudioSnk, SLuint32 numInterfaces, const SLInterfaceID \* pInterfaceIds, const SLboolean \* pInterfaceRequired) + - SLresult (\*CreateAudioRecorder) (SLEngineItf self, SLObjectItf \* pRecorder, SLDataSource \*pAudioSrc, SLDataSink \*pAudioSnk, SLuint32 numInterfaces, const SLInterfaceID \* pInterfaceIds, const SLboolean \* pInterfaceRequired) + - SLresult (\*CreateOutputMix) (SLEngineItf self, SLObjectItf \* pMix, SLuint32 numInterfaces, const SLInterfaceID \* pInterfaceIds, const SLboolean \* pInterfaceRequired) + +- **OpenHarmony上支持的Object接口:** + - SLresult (\*Realize) (SLObjectItf self, SLboolean async) + - SLresult (\*GetState) (SLObjectItf self, SLuint32 \* pState) + - SLresult (\*GetInterface) (SLObjectItf self, const SLInterfaceID iid, void \* pInterface) + - void (\*Destroy) (SLObjectItf self) + +- **OpenHarmony上支持的Recorder接口:** + - SLresult (\*SetRecordState) (SLRecordItf self, SLuint32 state) + - SLresult (\*GetRecordState) (SLRecordItf self,SLuint32 \*pState) + +- **OpenHarmony上支持的BufferQueue接口**: + + 以下接口需引入<OpenSLES_OpenHarmony.h>使用。 + | 接口 | 说明 | + | -------- | -------- | + | SLresult (\*Enqueue) (SLOHBufferQueueItf self, const void \*buffer, SLuint32 size) | 根据情况将buffer加到相应队列中。
如果是播放操作,则将带有音频数据的buffer插入到filledBufferQ_队列中;如果是录音操作,则将录音使用后的空闲buffer插入到freeBufferQ_队列中。
self:表示调用该函数的BufferQueue接口对象。
buffer:播放时表示带有音频数据的buffer,录音时表示已存储完录音数据后的空闲buffer。
size:表示buffer的大小。 | + | SLresult (\*Clear) (SLOHBufferQueueItf self) | 释放BufferQueue接口对象。
self:表示调用该函数的BufferQueue接口对象将被释放。 | + | SLresult (\*GetState) (SLOHBufferQueueItf self, SLOHBufferQueueState \*state) | 获取BufferQueue接口对象状态。
self:表示调用该函数的BufferQueue接口对象。
state:BufferQueue的当前状态。 | + | SLresult (\*RegisterCallback) (SLOHBufferQueueItf self, SlOHBufferQueueCallback callback, void\* pContext) | 注册回调函数。
self:表示调用该函数的BufferQueue接口对象。
callback:播放/录音时注册的回调函数。
pContext:播放时传入待播放音频文件,录音时传入将要录制的音频文件。 | + | SLresult (\*GetBuffer) (SLOHBufferQueueItf self, SLuint8\*\* buffer, SLuint32\* size) | 根据情况获取相应的buffer。
如果是播放操作,则从freeBufferQ_队列中获取空闲buffer;如果是录音操作,则从filledBufferQ_队列中获取携带录音数据的buffer。
self:表示调用该函数的BufferQueue接口对象。
buffer:播放时表示空闲的buffer,录音时表示携带录音数据的buffer。
size:表示buffer的大小。 | + +## 完整示例 + +参考下列示例代码,完成音频录制。 + +1. 添加头文件 + + ```c++ + #include + #include + #include + ``` + +2. 使用slCreateEngine接口创建引擎对象和实例化引擎对象engine。 + + ```c++ + SLObjectItf engineObject = nullptr; + slCreateEngine(&engineObject, 0, nullptr, 0, nullptr, nullptr); + (*engineObject)->Realize(engineObject, SL_BOOLEAN_FALSE); + ``` + +3. 获取接口SL_IID_ENGINE的引擎接口engineEngine实例。 + + ```c++ + SLEngineItf engineItf = nullptr; + (*engineObject)->GetInterface(engineObject, SL_IID_ENGINE, &engineItf); + ``` + +4. 配置录音器信息(配置输入源audiosource、输出源audiosink),创建录音对象pcmCapturerObject。 + + ```c++ + SLDataLocator_IODevice io_device = { + SL_DATALOCATOR_IODEVICE, + SL_IODEVICE_AUDIOINPUT, + SL_DEFAULTDEVICEID_AUDIOINPUT, + NULL + }; + SLDataSource audioSource = { + &io_device, + NULL + }; + SLDataLocator_BufferQueue buffer_queue = { + SL_DATALOCATOR_BUFFERQUEUE, + 3 + }; + // 具体参数需要根据音频文件格式进行适配 + SLDataFormat_PCM format_pcm = { + SL_DATAFORMAT_PCM, // 输入的音频格式 + 1, // 单声道 + SL_SAMPLINGRATE_44_1, // 采样率: 44100HZ + SL_PCMSAMPLEFORMAT_FIXED_16, // 音频采样格式,小尾数,带符号的16位整数 + 0, + 0, + 0 + }; + SLDataSink audioSink = { + &buffer_queue, + &format_pcm + }; + + SLObjectItf pcmCapturerObject = nullptr; + (*engineItf)->CreateAudioRecorder(engineItf, &pcmCapturerObject, + &audioSource, &audioSink, 0, nullptr, nullptr); + (*pcmCapturerObject)->Realize(pcmCapturerObject, SL_BOOLEAN_FALSE); + + ``` + +5. 获取录音接口SL_IID_RECORD的recordItf接口实例。 + + ```c++ + SLRecordItf recordItf; + (*pcmCapturerObject)->GetInterface(pcmCapturerObject, SL_IID_RECORD, &recordItf); + ``` + +6. 获取接口 SL_IID_OH_BUFFERQUEUE 的 bufferQueueItf 实例 + + ```c++ + SLOHBufferQueueItf bufferQueueItf; + (*pcmCapturerObject)->GetInterface(pcmCapturerObject, SL_IID_OH_BUFFERQUEUE, &bufferQueueItf); + ``` + +7. 注册BufferQueueCallback回调。 + + ```c++ + static void BufferQueueCallback(SLOHBufferQueueItf bufferQueueItf, void *pContext, SLuint32 size) + { + // 可从pContext获取注册时传入的使用者信息 + SLuint8 *buffer = nullptr; + SLuint32 pSize = 0; + (*bufferQueueItf)->GetBuffer(bufferQueueItf, &buffer, &pSize); + if (buffer != nullptr) { + // 可从buffer内读取录音数据进行后续处理 + (*bufferQueueItf)->Enqueue(bufferQueueItf, buffer, size); + } + } + void *pContext; // 可传入自定义的上下文信息,会在Callback内收到 + (*bufferQueueItf)->RegisterCallback(bufferQueueItf, BufferQueueCallback, pContext); + ``` + +8. 开始录音。 + + ```c++ + (*recordItf)->SetRecordState(recordItf, SL_RECORDSTATE_RECORDING); + ``` + +9. 结束音频录制。 + + ```c++ + (*recordItf)->SetRecordState(recordItf, SL_RECORDSTATE_STOPPED); + (*pcmCapturerObject)->Destroy(pcmCapturerObject); + ``` diff --git a/zh-cn/application-dev/media/using-toneplayer-for-playback.md b/zh-cn/application-dev/media/using-toneplayer-for-playback.md new file mode 100644 index 0000000000000000000000000000000000000000..ebe5d84a2ac7a5fc958f03bbd9c56062b3b7a485 --- /dev/null +++ b/zh-cn/application-dev/media/using-toneplayer-for-playback.md @@ -0,0 +1,140 @@ +# 使用TonePlayer开发音频播放功能(仅对系统应用开放) + +TonePlayer9+提供播放和管理DTMF(Dual Tone Multi Frequency,双音多频)音调的方法,包括各种系统监听音调、专有音调,如拨号音、通话回铃音等。主要工作是将需要生成音调的[ToneType](../reference/apis/js-apis-audio.md#tonetype9)类型,通过自带算法生成多个不同频率的正弦波叠加形成声音数据,通过[AudioRenderer](../reference/apis/js-apis-audio.md#audiorenderer8)进行播放,同时对播放任务进行管理。包含加载DTMF音调配置、启动DTMF音调播放、停止当前正在播放的音调、释放与此TonePlayer对象关联的资源等流程。详细API说明请参考[TonePlayer API文档](../reference/apis/js-apis-audio.md#toneplayer9)。 + + +## 支持的播放音调类型 + +播放音调类型[ToneType](../reference/apis/js-apis-audio.md#tonetype9)信息(如下表所示),可通过"audio.ToneType.指定类型" 作为参数调用load()方法加载指定类型的音调资源。 + +| 播放音调类型 | 值 | 说明 | +| -------- | -------- | -------- | +| TONE_TYPE_DIAL_0 | 0 | 键0的DTMF音。 | +| TONE_TYPE_DIAL_1 | 1 | 键1的DTMF音。 | +| TONE_TYPE_DIAL_2 | 2 | 键2的DTMF音。 | +| TONE_TYPE_DIAL_3 | 3 | 键3的DTMF音。 | +| TONE_TYPE_DIAL_4 | 4 | 键4的DTMF音。 | +| TONE_TYPE_DIAL_5 | 5 | 键5的DTMF音。 | +| TONE_TYPE_DIAL_6 | 6 | 键6的DTMF音。 | +| TONE_TYPE_DIAL_7 | 7 | 键7的DTMF音。 | +| TONE_TYPE_DIAL_8 | 8 | 键8的DTMF音。 | +| TONE_TYPE_DIAL_9 | 9 | 键9的DTMF音。 | +| TONE_TYPE_DIAL_S | 10 | 键\*的DTMF音。 | +| TONE_TYPE_DIAL_P | 11 | 键\#的DTMF音。 | +| TONE_TYPE_DIAL_A | 12 | 键A的DTMF音。 | +| TONE_TYPE_DIAL_B | 13 | 键B的DTMF音。 | +| TONE_TYPE_DIAL_C | 14 | 键C的DTMF音。 | +| TONE_TYPE_DIAL_D | 15 | 键D的DTMF音。 | +| TONE_TYPE_COMMON_SUPERVISORY_DIAL | 100 | 呼叫监管音调,拨号音。 | +| TONE_TYPE_COMMON_SUPERVISORY_BUSY | 101 | 呼叫监管音调,忙。 | +| TONE_TYPE_COMMON_SUPERVISORY_CONGESTION | 102 | 呼叫监管音调,拥塞。 | +| TONE_TYPE_COMMON_SUPERVISORY_RADIO_ACK | 103 | 呼叫监管音调,无线电 ACK。 | +| TONE_TYPE_COMMON_SUPERVISORY_RADIO_NOT_AVAILABLE | 104 | 呼叫监管音调,无线电不可用。 | +| TONE_TYPE_COMMON_SUPERVISORY_CALL_WAITING | 106 | 呼叫监管音调,呼叫等待。 | +| TONE_TYPE_COMMON_SUPERVISORY_RINGTONE | 107 | 呼叫监管音调,铃声。 | +| TONE_TYPE_COMMON_PROPRIETARY_BEEP | 200 | 专有声调,一般蜂鸣声。 | +| TONE_TYPE_COMMON_PROPRIETARY_ACK | 201 | 专有声调,ACK。 | +| TONE_TYPE_COMMON_PROPRIETARY_PROMPT | 203 | 专有声调,PROMPT。 | +| TONE_TYPE_COMMON_PROPRIETARY_DOUBLE_BEEP | 204 | 专有声调,双重蜂鸣声。 | + + +## 开发步骤及注意事项 + +以下步骤描述了TonePlayer接口实现播放功能流程: + +1. 创建DTMF播放器 ,获取tonePlayer实例。 + + ```ts + import audio from '@ohos.multimedia.audio'; + let audioRendererInfo = { + content : audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage : audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags : 0 + }; + tonePlayerPromise = audio.createTonePlayer(audioRendererInfo); + ``` + +2. 加载指定类型DTMF音调配置。 + + ```ts + tonePlayerPromise.load(audio.ToneType.TONE_TYPE_DIAL_0); + ``` + +3. 启动DTMF音调播放。 + + ```ts + tonePlayerPromise.start(); + ``` + +4. 停止当前正在播放的音调。 + + ```ts + tonePlayerPromise.stop(); + ``` + +5. 释放与此TonePlayer对象关联的资源。 + + ```ts + tonePlayerPromise.release(); + ``` + +在接口未按此正常调用时序调用时,接口会返回错误码6800301 NAPI_ERR_SYSTEM。 + + +## 完整示例 + +参考以下示例,点击键盘拨号按键,并启动对应的DTMF音调播放。 + +为保证UI线程不被阻塞,大部分TonePlayer调用都是异步的。对于每个API均提供了callback函数和Promise函数,以下示例均采用Promise函数,更多方式可参考API文档[TonePlayer](../reference/apis/js-apis-audio.md#toneplayer9)。 + + +```ts +import audio from '@ohos.multimedia.audio'; + +export class TonelayerDemo { + private timer : number; + private timerPro : number; + // promise调用方式 + async testTonePlayerPromise(type) { + console.info('testTonePlayerPromise start'); + if (this.timerPro) clearTimeout(this.timerPro); + let tonePlayerPromise; + let audioRendererInfo = { + content : audio.ContentType.CONTENT_TYPE_SONIFICATION, + usage : audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags : 0 + }; + this.timerPro = setTimeout(async () => { + try { + console.info('testTonePlayerPromise: createTonePlayer'); + // 创建DTMF播放器 + tonePlayerPromise = await audio.createTonePlayer(audioRendererInfo); + console.info('testTonePlayerPromise: createTonePlayer-success'); + console.info(`testTonePlayerPromise: load type: ${type}`); + // 加载type类型音调 + await tonePlayerPromise.load(type); + console.info('testTonePlayerPromise: load-success'); + console.info(`testTonePlayerPromise: start type: ${type}`); + // 启动DTMF音调播放 + await tonePlayerPromise.start(); + console.info('testTonePlayerPromise: start-success'); + console.info(`testTonePlayerPromise: stop type: ${type}`); + setTimeout(async()=>{ + // 停止当前正在播放的音调 + await tonePlayerPromise.stop(); + console.info('testTonePlayerPromise: stop-success'); + console.info(`testTonePlayerPromise: release type: ${type}`); + // 释放与此TonePlayer对象关联的资源 + await tonePlayerPromise.release(); + console.info('testTonePlayerPromise: release-success'); + }, 30) + } catch(err) { + console.error(`testTonePlayerPromise err : ${err}`); + } + }, 200) + }; + async testTonePlayer() { + this.testTonePlayerPromise(audio.ToneType.TONE_TYPE_DIAL_0); + } +} +``` diff --git a/zh-cn/application-dev/media/video-playback.md b/zh-cn/application-dev/media/video-playback.md index f62da644b121076322bb2c5a155113dcd2601112..1cced19ac0bc0a73b999a49261c992272b58ace4 100644 --- a/zh-cn/application-dev/media/video-playback.md +++ b/zh-cn/application-dev/media/video-playback.md @@ -1,425 +1,176 @@ -# 视频播放开发指导 +# 视频播放 -## 简介 +在OpenHarmony系统中,提供两种视频播放开发的方案: -视频播放的主要工作是将视频数据转码并输出到设备进行播放,同时管理播放任务,包括开始播放、暂停播放、停止播放、资源释放、音量设置、跳转播放位置、设置倍数、获取轨道信息等功能控制。本文将对视频播放全流程、视频切换、视频循环播放等场景开发进行介绍说明。 +- [AVPlayer](using-avplayer-for-playback.md):功能较完善的音视频播放ArkTS/JS API,集成了流媒体和本地资源解析,媒体资源解封装,视频解码和渲染功能,适用于对媒体资源进行端到端播放的场景,可直接播放mp4、mkv等格式的视频文件。 -## 运作机制 +- Video组件:封装了视频播放的基础能力,需要设置数据源以及基础信息即可播放视频,但相对扩展能力较弱。Video组件由ArkUI提供能力,相关指导请参考UI开发文档-[Video组件](../ui/arkts-common-components-video-player.md)。 -该模块提供了视频播放状态变化示意图和视频播放外部模块交互图。 - -**图1** 视频播放状态变化示意图 - -![zh-ch_image_video_state_machine](figures/zh-ch_image_video_state_machine.png) - -**图2** 视频播放外部模块交互图 - -![zh-ch_image_video_player](figures/zh-ch_image_video_player.png) - -**说明**:三方应用通过调用JS接口层提供的js接口实现相应功能时,框架层会通过Native Framework的媒体服务,调用音频部件将软件解码后的音频数据,输出至音频HDI,和图形子系统将硬件接口层的解码HDI部件的解码后的图像数据,输出至显示HDI,实现视频播放功能。 - -*注意:视频播放需要显示、音频、编解码等硬件能力。* - -1. 三方应用从Xcomponent组件获取surfaceID。 -2. 三方应用把surfaceID传递给VideoPlayer JS。 -3. 媒体服务把帧数据flush给surface buffer。 - -## 兼容性说明 - -推荐使用视频软件主流的播放格式和主流分辨率,不建议开发者自制非常或者异常码流,以免产生无法播放、卡住、花屏等兼容性问题。若发生此类问题不会影响系统,退出码流播放即可。 - -主流的播放格式和主流分辨率如下: - -| 视频容器规格 | 规格描述 | 分辨率 | -| :----------: | :-----------------------------------------------: | :--------------------------------: | -| mp4 | 视频格式:H264/MPEG2/MPEG4/H263 音频格式:AAC/MP3 | 主流分辨率,如1080P/720P/480P/270P | -| mkv | 视频格式:H264/MPEG2/MPEG4/H263 音频格式:AAC/MP3 | 主流分辨率,如1080P/720P/480P/270P | -| ts | 视频格式:H264/MPEG2/MPEG4 音频格式:AAC/MP3 | 主流分辨率,如1080P/720P/480P/270P | -| webm | 视频格式:VP8 音频格式:VORBIS | 主流分辨率,如1080P/720P/480P/270P | +本开发指导将介绍如何使用AVPlayer开发视频播放功能,以完整地播放一个视频作为示例,实现端到端播放原始媒体资源。如果要实现后台播放或熄屏播放,需要使用[AVSession(媒体会话)](avsession-overview.md)和[申请长时任务](../task-management/continuous-task-dev-guide.md),避免播放过程中音频模块被系统强制中断。 ## 开发指导 -详细API含义可参考:[媒体服务API文档VideoPlayer](../reference/apis/js-apis-media.md#videoplayer8) - -### 全流程场景 - -视频播放的全流程场景包含:创建实例,设置url,设置SurfaceId,准备播放视频,播放视频,暂停播放,获取轨道信息,跳转播放位置,设置音量,设置倍速,结束播放,重置,释放资源等流程。 - -VideoPlayer支持的url媒体源输入类型可参考:[url属性说明](../reference/apis/js-apis-media.md#videoplayer_属性) - -Xcomponent创建方法可参考:[Xcomponent创建方法](../reference/arkui-ts/ts-basic-components-xcomponent.md) - -```js -import media from '@ohos.multimedia.media' -import fs from '@ohos.file.fs' -export class VideoPlayerDemo { - // 函数调用发生错误时用于上报错误信息 - failureCallback(error) { - console.info(`error happened,error Name is ${error.name}`); - console.info(`error happened,error Code is ${error.code}`); - console.info(`error happened,error Message is ${error.message}`); - } - - // 当函数调用发生异常时用于上报错误信息 - catchCallback(error) { - console.info(`catch error happened,error Name is ${error.name}`); - console.info(`catch error happened,error Code is ${error.code}`); - console.info(`catch error happened,error Message is ${error.message}`); - } - - // 用于打印视频轨道信息 - printfDescription(obj) { - for (let item in obj) { - let property = obj[item]; - console.info('key is ' + item); - console.info('value is ' + property); - } - } - - async videoPlayerDemo() { - let videoPlayer = undefined; - let surfaceID = 'test' // surfaceID用于播放画面显示,具体的值需要通过Xcomponent接口获取,相关文档链接见上面Xcomponent创建方法 - let fdPath = 'fd://' - // path路径的码流可通过"hdc file send D:\xxx\H264_AAC.mp4 /data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile" 命令,将其推送到设备上 - let path = '/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/H264_AAC.mp4'; - let file = await fs.open(path); - fdPath = fdPath + '' + file.fd; - // 调用createVideoPlayer接口返回videoPlayer实例对象 - await media.createVideoPlayer().then((video) => { - if (typeof (video) != 'undefined') { - console.info('createVideoPlayer success!'); - videoPlayer = video; - } else { - console.info('createVideoPlayer fail!'); +播放的全流程包含:创建AVPlayer,设置播放资源和窗口,设置播放参数(音量/倍速/缩放模式),播放控制(播放/暂停/跳转/停止),重置,销毁资源。在进行应用开发的过程中,开发者可以通过AVPlayer的state属性主动获取当前状态或使用on('stateChange')方法监听状态变化。如果应用在视频播放器处于错误状态时执行操作,系统可能会抛出异常或生成其他未定义的行为。 + +**图1** 播放状态变化示意图   + +![Playback status change](figures/video-playback-status-change.png) + +状态的详细说明请参考[AVPlayerState](../reference/apis/js-apis-media.md#avplayerstate9)。当播放处于prepared / playing / paused / completed状态时,播放引擎处于工作状态,这需要占用系统较多的运行内存。当客户端暂时不使用播放器时,调用reset()或release()回收内存资源,做好资源利用。 + +### 开发步骤及注意事项 + +详细的API说明请参考[AVPlayer API参考](../reference/apis/js-apis-media.md#avplayer9)。 + +1. 创建实例createAVPlayer(),AVPlayer初始化idle状态。 + +2. 设置业务需要的监听事件,搭配全流程场景使用。支持的监听事件包括: + | 事件类型 | 说明 | + | -------- | -------- | + | stateChange | 必要事件,监听播放器的state属性改变。 | + | error | 必要事件,监听播放器的错误信息。 | + | durationUpdate | 用于进度条,监听进度条长度,刷新资源时长。 | + | timeUpdate | 用于进度条,监听进度条当前位置,刷新当前时间。 | + | seekDone | 响应API调用,监听seek()请求完成情况。
当使用seek()跳转到指定播放位置后,如果seek操作成功,将上报该事件。 | + | speedDone | 响应API调用,监听setSpeed()请求完成情况。
当使用setSpeed()设置播放倍速后,如果setSpeed操作成功,将上报该事件。 | + | volumeChange | 响应API调用,监听setVolume()请求完成情况。
当使用setVolume()调节播放音量后,如果setVolume操作成功,将上报该事件。 | + | bitrateDone | 响应API调用,用于HLS协议流,监听setBitrate()请求完成情况。
当使用setBitrate()指定播放比特率后,如果setBitrate操作成功,将上报该事件。 | + | availableBitrates | 用于HLS协议流,监听HLS资源的可选bitrates,用于setBitrate()。 | + | bufferingUpdate | 用于网络播放,监听网络播放缓冲信息。 | + | startRenderFrame | 用于视频播放,监听视频播放首帧渲染时间。 | + | videoSizeChange | 用于视频播放,监听视频播放的宽高信息,可用于调整窗口大小、比例。 | + | audioInterrupt | 监听音频焦点切换信息,搭配属性audioInterruptMode使用。
如果当前设备存在多个媒体正在播放,音频焦点被切换(即播放其他媒体如通话等)时将上报该事件,应用可以及时处理。 | + +3. 设置资源:设置属性url,AVPlayer进入initialized状态。 + > **说明:** + > + > 下面代码示例中的url仅作示意使用,开发者需根据实际情况,确认资源有效性并设置: + > + > - 如果使用本地资源播放,必须确认资源文件可用,并使用应用沙箱路径访问对应资源,参考[获取应用文件路径](../application-models/application-context-stage.md#获取应用开发路径)。应用沙箱的介绍及如何向应用沙箱推送文件,请参考[文件管理](../file-management/app-sandbox-directory.md)。 + > + > - 如果使用网络播放路径,需[申请相关权限](../security/accesstoken-guidelines.md):ohos.permission.INTERNET。 + > + > - 如果使用ResourceManager.getRawFd打开HAP资源文件描述符,使用方法可参考[ResourceManager API参考](../reference/apis/js-apis-resource-manager.md#getrawfd9)。 + > + > - 需要使用[支持的播放格式与协议](avplayer-avrecorder-overview.md#支持的格式与协议)。 + +4. 设置窗口:获取并设置属性SurfaceID,用于设置显示画面。 + 应用需要从XComponent组件获取surfaceID,获取方式请参考[XComponent](../reference/arkui-ts/ts-basic-components-xcomponent.md)。 + +5. 准备播放:调用prepare(),AVPlayer进入prepared状态,此时可以获取duration,设置缩放模式、音量等。 + +6. 视频播控:播放play(),暂停pause(),跳转seek(),停止stop() 等操作。 + +7. (可选)更换资源:调用reset()重置资源,AVPlayer重新进入idle状态,允许更换资源url。 + +8. 退出播放:调用release()销毁实例,AVPlayer进入released状态,退出播放。 + + +### 完整示例 + + +```ts +import media from '@ohos.multimedia.media'; +import fs from '@ohos.file.fs'; +import common from '@ohos.app.ability.common'; + +export class AVPlayerDemo { + private avPlayer; + private count: number = 0; + private surfaceID: string; // surfaceID用于播放画面显示,具体的值需要通过Xcomponent接口获取,相关文档链接见上面Xcomponent创建方法 + + // 注册avplayer回调函数 + setAVPlayerCallback() { + // seek操作结果回调函数 + this.avPlayer.on('seekDone', (seekDoneTime) => { + console.info(`AVPlayer seek succeeded, seek time is ${seekDoneTime}`); + }) + // error回调监听函数,当avPlayer在操作过程中出现错误时调用reset接口触发重置流程 + this.avPlayer.on('error', (err) => { + console.error(`Invoke avPlayer failed, code is ${err.code}, message is ${err.message}`); + this.avPlayer.reset(); // 调用reset重置资源,触发idle状态 + }) + // 状态机变化回调函数 + this.avPlayer.on('stateChange', async (state, reason) => { + switch (state) { + case 'idle': // 成功调用reset接口后触发该状态机上报 + console.info('AVPlayer state idle called.'); + this.avPlayer.release(); // 调用release接口销毁实例对象 + break; + case 'initialized': // avplayer 设置播放源后触发该状态上报 + console.info('AVPlayerstate initialized called.'); + this.avPlayer.surfaceId = this.surfaceID; // 设置显示画面,当播放的资源为纯音频时无需设置 + this.avPlayer.prepare().then(() => { + console.info('AVPlayer prepare succeeded.'); + }, (err) => { + console.error(`Invoke prepare failed, code is ${err.code}, message is ${err.message}`); + }); + break; + case 'prepared': // prepare调用成功后上报该状态机 + console.info('AVPlayer state prepared called.'); + this.avPlayer.play(); // 调用播放接口开始播放 + break; + case 'playing': // play成功调用后触发该状态机上报 + console.info('AVPlayer state playing called.'); + if (this.count !== 0) { + console.info('AVPlayer start to seek.'); + this.avPlayer.seek(this.avPlayer.duration); //seek到视频末尾 + } else { + this.avPlayer.pause(); // 调用暂停接口暂停播放 + } + this.count++; + break; + case 'paused': // pause成功调用后触发该状态机上报 + console.info('AVPlayer state paused called.'); + this.avPlayer.play(); // 再次播放接口开始播放 + break; + case 'completed': // 播放结束后触发该状态机上报 + console.info('AVPlayer state completed called.'); + this.avPlayer.stop(); //调用播放结束接口 + break; + case 'stopped': // stop接口成功调用后触发该状态机上报 + console.info('AVPlayer state stopped called.'); + this.avPlayer.reset(); // 调用reset接口初始化avplayer状态 + break; + case 'released': + console.info('AVPlayer state released called.'); + break; + default: + console.info('AVPlayer state unknown called.'); + break; } - }, this.failureCallback).catch(this.catchCallback); - // 设置播放源 - videoPlayer.url = fdPath; - - // 设置surfaceID用于显示视频画面 - await videoPlayer.setDisplaySurface(surfaceID).then(() => { - console.info('setDisplaySurface success'); - }, this.failureCallback).catch(this.catchCallback); - - // 调用prepare完成播放前准备工作 - await videoPlayer.prepare().then(() => { - console.info('prepare success'); - }, this.failureCallback).catch(this.catchCallback); - - // 调用play接口正式开始播放 - await videoPlayer.play().then(() => { - console.info('play success'); - }, this.failureCallback).catch(this.catchCallback); - - // 暂停播放 - await videoPlayer.pause().then(() => { - console.info('pause success'); - }, this.failureCallback).catch(this.catchCallback); - - // 通过promise回调方式获取视频轨道信息communication_dsoftbus - let arrayDescription; - await videoPlayer.getTrackDescription().then((arrlist) => { - if (typeof (arrlist) != 'undefined') { - arrayDescription = arrlist; - } else { - console.log('video getTrackDescription fail'); - } - }, this.failureCallback).catch(this.catchCallback); - - for (let i = 0; i < arrayDescription.length; i++) { - this.printfDescription(arrayDescription[i]); - } - - // 跳转播放时间到50s位置,具体入参意义请参考接口文档 - let seekTime = 50000; - await videoPlayer.seek(seekTime, media.SeekMode.SEEK_NEXT_SYNC).then((seekDoneTime) => { - console.info('seek success'); - }, this.failureCallback).catch(this.catchCallback); - - // 音量设置接口,具体入参意义请参考接口文档 - let volume = 0.5; - await videoPlayer.setVolume(volume).then(() => { - console.info('setVolume success'); - }, this.failureCallback).catch(this.catchCallback); - - // 倍速设置接口,具体入参意义请参考接口文档 - let speed = media.PlaybackSpeed.SPEED_FORWARD_2_00_X; - await videoPlayer.setSpeed(speed).then(() => { - console.info('setSpeed success'); - }, this.failureCallback).catch(this.catchCallback); - - // 结束播放 - await videoPlayer.stop().then(() => { - console.info('stop success'); - }, this.failureCallback).catch(this.catchCallback); - - // 重置播放配置 - await videoPlayer.reset().then(() => { - console.info('reset success'); - }, this.failureCallback).catch(this.catchCallback); - - // 释放播放资源 - await videoPlayer.release().then(() => { - console.info('release success'); - }, this.failureCallback).catch(this.catchCallback); - - // 相关对象置undefined - videoPlayer = undefined; - surfaceID = undefined; - } -} -``` - -### 正常播放场景 - -```js -import media from '@ohos.multimedia.media' -import fs from '@ohos.file.fs' -export class VideoPlayerDemo { - // 函数调用发生错误时用于上报错误信息 - failureCallback(error) { - console.info(`error happened,error Name is ${error.name}`); - console.info(`error happened,error Code is ${error.code}`); - console.info(`error happened,error Message is ${error.message}`); - } - - // 当函数调用发生异常时用于上报错误信息 - catchCallback(error) { - console.info(`catch error happened,error Name is ${error.name}`); - console.info(`catch error happened,error Code is ${error.code}`); - console.info(`catch error happened,error Message is ${error.message}`); - } - - // 用于打印视频轨道信息 - printfDescription(obj) { - for (let item in obj) { - let property = obj[item]; - console.info('key is ' + item); - console.info('value is ' + property); - } - } - - async videoPlayerDemo() { - let videoPlayer = undefined; - let surfaceID = 'test' // surfaceID用于播放画面显示,具体的值需要通过Xcomponent接口获取,相关文档链接: - let fdPath = 'fd://' - // path路径的码流可通过"hdc file send D:\xxx\H264_AAC.mp4 /data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile" 命令,将其推送到设备上 - let path = '/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/H264_AAC.mp4'; + }) + } + + // 以下demo为使用fs文件系统打开沙箱地址获取媒体文件地址并通过url属性进行播放示例 + async avPlayerUrlDemo() { + // 创建avPlayer实例对象 + this.avPlayer = await media.createAVPlayer(); + // 创建状态机变化回调函数 + this.setAVPlayerCallback(); + let fdPath = 'fd://'; + let context = getContext(this) as common.UIAbilityContext; + // 通过UIAbilityContext获取沙箱地址filesDir,以Stage模型为例 + let pathDir = context.filesDir; + let path = pathDir + '/H264_AAC.mp4'; + // 打开相应的资源文件地址获取fd,并为url赋值触发initialized状态机上报 let file = await fs.open(path); fdPath = fdPath + '' + file.fd; - // 调用createVideoPlayer接口返回videoPlayer实例对象 - await media.createVideoPlayer().then((video) => { - if (typeof (video) != 'undefined') { - console.info('createVideoPlayer success!'); - videoPlayer = video; - } else { - console.info('createVideoPlayer fail!'); - } - }, this.failureCallback).catch(this.catchCallback); - // 设置播放源 - videoPlayer.url = fdPath; - - // 设置surfaceID用于显示视频画面 - await videoPlayer.setDisplaySurface(surfaceID).then(() => { - console.info('setDisplaySurface success'); - }, this.failureCallback).catch(this.catchCallback); - - // 调用prepare完成播放前准备工作 - await videoPlayer.prepare().then(() => { - console.info('prepare success'); - }, this.failureCallback).catch(this.catchCallback); - - // 调用play接口正式开始播放 - await videoPlayer.play().then(() => { - console.info('play success'); - }, this.failureCallback).catch(this.catchCallback); - - // 结束播放 - await videoPlayer.stop().then(() => { - console.info('stop success'); - }, this.failureCallback).catch(this.catchCallback); - - // 释放播放资源 - await videoPlayer.release().then(() => { - console.info('release success'); - }, this.failureCallback).catch(this.catchCallback); - - // 相关对象置undefined - videoPlayer = undefined; - surfaceID = undefined; - } -} -``` - -### 切视频场景 - -```js -import media from '@ohos.multimedia.media' -import fs from '@ohos.file.fs' -export class VideoPlayerDemo { - // 函数调用发生错误时用于上报错误信息 - failureCallback(error) { - console.info(`error happened,error Name is ${error.name}`); - console.info(`error happened,error Code is ${error.code}`); - console.info(`error happened,error Message is ${error.message}`); - } - - // 当函数调用发生异常时用于上报错误信息 - catchCallback(error) { - console.info(`catch error happened,error Name is ${error.name}`); - console.info(`catch error happened,error Code is ${error.code}`); - console.info(`catch error happened,error Message is ${error.message}`); - } - - // 用于打印视频轨道信息 - printfDescription(obj) { - for (let item in obj) { - let property = obj[item]; - console.info('key is ' + item); - console.info('value is ' + property); - } - } - - async videoPlayerDemo() { - let videoPlayer = undefined; - let surfaceID = 'test' // surfaceID用于播放画面显示,具体的值需要通过Xcomponent接口获取,相关文档链接: - let fdPath = 'fd://' - // path路径的码流可通过"hdc file send D:\xxx\H264_AAC.mp4 /data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile" 命令,将其推送到设备上 - let path = '/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/H264_AAC.mp4'; - let nextPath = '/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/MP4_AAC.mp4'; - let file = await fs.open(path); - fdPath = fdPath + '' + file.fd; - // 调用createVideoPlayer接口返回videoPlayer实例对象 - await media.createVideoPlayer().then((video) => { - if (typeof (video) != 'undefined') { - console.info('createVideoPlayer success!'); - videoPlayer = video; - } else { - console.info('createVideoPlayer fail!'); - } - }, this.failureCallback).catch(this.catchCallback); - // 设置播放源 - videoPlayer.url = fdPath; - - // 设置surfaceID用于显示视频画面 - await videoPlayer.setDisplaySurface(surfaceID).then(() => { - console.info('setDisplaySurface success'); - }, this.failureCallback).catch(this.catchCallback); - - // 调用prepare完成播放前准备工作 - await videoPlayer.prepare().then(() => { - console.info('prepare success'); - }, this.failureCallback).catch(this.catchCallback); - - // 调用play接口正式开始播放 - await videoPlayer.play().then(() => { - console.info('play success'); - }, this.failureCallback).catch(this.catchCallback); - - // 重置播放配置 - await videoPlayer.reset().then(() => { - console.info('reset success'); - }, this.failureCallback).catch(this.catchCallback); - - // 获取下一个视频fd地址 - fdPath = 'fd://' - let nextFile = await fs.open(nextPath); - fdPath = fdPath + '' + nextFile.fd; - // 设置第二个视频播放源 - videoPlayer.url = fdPath; - - // 调用prepare完成播放前准备工作 - await videoPlayer.prepare().then(() => { - console.info('prepare success'); - }, this.failureCallback).catch(this.catchCallback); - - // 调用play接口正式开始播放 - await videoPlayer.play().then(() => { - console.info('play success'); - }, this.failureCallback).catch(this.catchCallback); - - // 释放播放资源 - await videoPlayer.release().then(() => { - console.info('release success'); - }, this.failureCallback).catch(this.catchCallback); - - // 相关对象置undefined - videoPlayer = undefined; - surfaceID = undefined; - } -} -``` - -### 单个视频循环场景 - -```js -import media from '@ohos.multimedia.media' -import fs from '@ohos.file.fs' -export class VideoPlayerDemo { - // 函数调用发生错误时用于上报错误信息 - failureCallback(error) { - console.info(`error happened,error Name is ${error.name}`); - console.info(`error happened,error Code is ${error.code}`); - console.info(`error happened,error Message is ${error.message}`); - } - - // 当函数调用发生异常时用于上报错误信息 - catchCallback(error) { - console.info(`catch error happened,error Name is ${error.name}`); - console.info(`catch error happened,error Code is ${error.code}`); - console.info(`catch error happened,error Message is ${error.message}`); - } - - // 用于打印视频轨道信息 - printfDescription(obj) { - for (let item in obj) { - let property = obj[item]; - console.info('key is ' + item); - console.info('value is ' + property); - } - } - - async videoPlayerDemo() { - let videoPlayer = undefined; - let surfaceID = 'test' // surfaceID用于播放画面显示,具体的值需要通过Xcomponent接口获取,相关文档链接: - let fdPath = 'fd://' - // path路径的码流可通过"hdc file send D:\xxx\H264_AAC.mp4 /data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile" 命令,将其推送到设备上 - let path = '/data/app/el1/bundle/public/ohos.acts.multimedia.video.videoplayer/ohos.acts.multimedia.video.videoplayer/assets/entry/resources/rawfile/H264_AAC.mp4'; - let file = await fs.open(path); - fdPath = fdPath + '' + file.fd; - // 调用createVideoPlayer接口返回videoPlayer实例对象 - await media.createVideoPlayer().then((video) => { - if (typeof (video) != 'undefined') { - console.info('createVideoPlayer success!'); - videoPlayer = video; - } else { - console.info('createVideoPlayer fail!'); - } - }, this.failureCallback).catch(this.catchCallback); - // 设置播放源 - videoPlayer.url = fdPath; - - // 设置surfaceID用于显示视频画面 - await videoPlayer.setDisplaySurface(surfaceID).then(() => { - console.info('setDisplaySurface success'); - }, this.failureCallback).catch(this.catchCallback); - - // 调用prepare完成播放前准备工作 - await videoPlayer.prepare().then(() => { - console.info('prepare success'); - }, this.failureCallback).catch(this.catchCallback); - // 设置循环播放属性 - videoPlayer.loop = true; - // 调用play接口正式开始循环播放 - await videoPlayer.play().then(() => { - console.info('play success, loop value is ' + videoPlayer.loop); - }, this.failureCallback).catch(this.catchCallback); + this.avPlayer.url = fdPath; + } + + // 以下demo为使用资源管理接口获取打包在HAP内的媒体资源文件并通过fdSrc属性进行播放示例 + async avPlayerFdSrcDemo() { + // 创建avPlayer实例对象 + this.avPlayer = await media.createAVPlayer(); + // 创建状态机变化回调函数 + this.setAVPlayerCallback(); + // 通过UIAbilityContext的resourceManager成员的getRawFd接口获取媒体资源播放地址 + // 返回类型为{fd,offset,length},fd为HAP包fd地址,offset为媒体资源偏移量,length为播放长度 + let context = getContext(this) as common.UIAbilityContext; + let fileDescriptor = await context.resourceManager.getRawFd('H264_AAC.mp4'); + // 为fdSrc赋值触发initialized状态机上报 + this.avPlayer.fdSrc = fileDescriptor; } } ``` - -## 相关实例 -针对视频播放开发,有以下相关实例可供参考: - -- [`MediaCollections:`媒体管理合集(ArkTS)(API9)(Full SDK)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/FileManagement/MediaCollections) -- [视频播放器(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/codelabs/tree/master/Media/VideoPlayerStage) \ No newline at end of file diff --git a/zh-cn/application-dev/media/video-recorder.md b/zh-cn/application-dev/media/video-recorder.md deleted file mode 100644 index 2f6d5b6bbded1c2622fd767db91b807b263f94c4..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/media/video-recorder.md +++ /dev/null @@ -1,159 +0,0 @@ -# 视频录制开发指导 - -## 简介 - -视频录制的主要工作是捕获音视频信号,完成音视频编码并保存到文件中,帮助开发者轻松实现音视频录制功能,包括开始录制、暂停录制、恢复录制、停止录制、释放资源等功能控制。它允许调用者指定录制的编码格式、封装格式、文件路径等参数。 - -## 运作机制 - -该模块提供了视频录制状态变化示意图和视频录制外部模块交互图。 - -**图1** 视频录制状态变化示意图 - -![zh-ch_image_video_recorder_state_machine](figures/zh-ch_image_video_recorder_state_machine.png) - -**图2** 视频录制外部模块交互图 - -![zh-ch_image_video_recorder_zero](figures/zh-ch_image_video_recorder_zero.png) - -**说明**:三方相机应用或系统相机通过调用JS接口层提供的js接口实现相应功能时,框架层会通过Native Framework的媒体服务,调用音频部件通过音频HDI捕获的音频数据,再通过软件编码输出编码封装后的音频数据保存至文件中,和图形子系统通过视频HDI捕获的图像数据,再通过视频编码HDI编码,将编码后的图像数据保存至文件中,实现视频录制功能。 - -## 约束与限制 - -开发者在进行录制功能开发前,需要先对所开发的应用配置麦克风权限(ohos.permission.MICROPHONE)和相机权限(ohos.permission.CAMERA),权限配置相关内容可参考:[访问控制权限申请指导](../security/accesstoken-guidelines.md) - -## 开发指导 - -详细API含义可参考:[媒体服务API文档VideoRecorder](../reference/apis/js-apis-media.md#videorecorder9) - -### 全流程场景 - -视频录制全流程场景包含:创建实例、设置录制参数、开始录制、暂停录制、恢复录制、停止录制、释放资源等流程。 - -```js -import media from '@ohos.multimedia.media' -import mediaLibrary from '@ohos.multimedia.mediaLibrary' -export class VideoRecorderDemo { - private testFdNumber; // 用于保存fd地址 - // pathName是传入的录制文件名,例如:01.mp4,生成后的文件地址:/storage/media/100/local/files/Video/01.mp4 - // 使用mediaLibrary需要添加以下权限, ohos.permission.MEDIA_LOCATION、ohos.permission.WRITE_MEDIA、ohos.permission.READ_MEDIA - async getFd(pathName) { - let displayName = pathName; - const mediaTest = mediaLibrary.getMediaLibrary(); - let fileKeyObj = mediaLibrary.FileKey; - let mediaType = mediaLibrary.MediaType.VIDEO; - let publicPath = await mediaTest.getPublicDirectory(mediaLibrary.DirectoryType.DIR_VIDEO); - let dataUri = await mediaTest.createAsset(mediaType, displayName, publicPath); - if (dataUri != undefined) { - let args = dataUri.id.toString(); - let fetchOp = { - selections : fileKeyObj.ID + "=?", - selectionArgs : [args], - } - let fetchFileResult = await mediaTest.getFileAssets(fetchOp); - let fileAsset = await fetchFileResult.getAllObject(); - let fdNumber = await fileAsset[0].open('Rw'); - this.testFdNumber = "fd://" + fdNumber.toString(); - } - } - - // 当发生错误上上报的错误回调接口 - failureCallback(error) { - console.info('error happened, error name is ' + error.name); - console.info('error happened, error code is ' + error.code); - console.info('error happened, error message is ' + error.message); - } - - // 当发生异常时,系统调用的错误回调接口 - catchCallback(error) { - console.info('catch error happened, error name is ' + error.name); - console.info('catch error happened, error code is ' + error.code); - console.info('catch error happened, error message is ' + error.message); - } - - async videoRecorderDemo() { - let videoRecorder = null; // videoRecorder空对象在createVideoRecorder成功后赋值 - let surfaceID = null; // 用于保存getInputSurface返回的surfaceID - // 获取需要录制的视频的fd地址 - await this.getFd('01.mp4'); - // 录制相关参数配置,配置参数以实际硬件设备支持的范围为准 - let videoProfile = { - audioBitrate : 48000, - audioChannels : 2, - audioCodec : 'audio/mp4a-latm', - audioSampleRate : 48000, - fileFormat : 'mp4', - videoBitrate : 2000000, - videoCodec : 'video/mp4v-es', - videoFrameWidth : 640, - videoFrameHeight : 480, - videoFrameRate : 30 - } - - let videoConfig = { - audioSourceType : 1, - videoSourceType : 0, - profile : videoProfile, - url : this.testFdNumber, // testFdNumber由getFd生成 - orientationHint : 0, - location : { latitude : 30, longitude : 130 } - } - // 创建videoRecorder对象 - await media.createVideoRecorder().then((recorder) => { - console.info('case createVideoRecorder called'); - if (typeof (recorder) != 'undefined') { - videoRecorder = recorder; - console.info('createVideoRecorder success'); - } else { - console.info('createVideoRecorder failed'); - } - }, this.failureCallback).catch(this.catchCallback); - - // 调用prepare完成视频录制前的准备工作 - await videoRecorder.prepare(videoConfig).then(() => { - console.info('prepare success'); - }, this.failureCallback).catch(this.catchCallback); - - // 获取surfaceID并保存下来传递给camera相关接口 - await videoRecorder.getInputSurface().then((surface) => { - console.info('getInputSurface success'); - surfaceID = surface; - }, this.failureCallback).catch(this.catchCallback); - - // 视频录制依赖相机相关接口,以下需要先调用相机起流接口后才能继续执行,具体的相机接口调用请参考sample用例 - // 视频录制启动接口 - await videoRecorder.start().then(() => { - console.info('start success'); - }, this.failureCallback).catch(this.catchCallback); - - // 调用pause接口时需要暂停camera出流 - await videoRecorder.pause().then(() => { - console.info('pause success'); - }, this.failureCallback).catch(this.catchCallback); - - // 调用resume接口时需要恢复camera出流 - await videoRecorder.resume().then(() => { - console.info('resume success'); - }, this.failureCallback).catch(this.catchCallback); - - // 停止camera出流后,停止视频录制 - await videoRecorder.stop().then(() => { - console.info('stop success'); - }, this.failureCallback).catch(this.catchCallback); - - // 重置录制相关配置 - await videoRecorder.reset().then(() => { - console.info('reset success'); - }, this.failureCallback).catch(this.catchCallback); - - // 释放视频录制相关资源并释放camera对象相关资源 - await videoRecorder.release().then(() => { - console.info('release success'); - }, this.failureCallback).catch(this.catchCallback); - - // 相关对象置null - videoRecorder = undefined; - surfaceID = undefined; - } -} -``` \ No newline at end of file diff --git a/zh-cn/application-dev/media/video-recording.md b/zh-cn/application-dev/media/video-recording.md new file mode 100644 index 0000000000000000000000000000000000000000..7cdf749e64ad558962d06fe7d15de88ab0f77b36 --- /dev/null +++ b/zh-cn/application-dev/media/video-recording.md @@ -0,0 +1,230 @@ +# 视频录制 + +在OpenHarmony系统中,当前仅支持AVRecorder开发视频录制,集成了音频捕获,音频编码,视频编码,音视频封装功能,适用于实现简单视频录制并直接得到视频本地文件的场景。 + +本开发指导将以“开始录制-暂停录制-恢复录制-停止录制”的一次流程为示例,向开发者讲解如何使用AVRecorder进行视频录制。 + +在进行应用开发的过程中,开发者可以通过AVRecorder的state属性主动获取当前状态,或使用on('stateChange')方法监听状态变化。开发过程中应该严格遵循状态机要求,例如只能在started状态下调用pause()接口,只能在paused状态下调用resume()接口。 + +**图1** 录制状态变化示意图   + +![Recording status change](figures/video-recording-status-change.png) + +状态的详细说明请参考[AVRecorderState](../reference/apis/js-apis-media.md#avrecorderstate9)。 + +## 开发步骤及注意事项 + +> **说明:** +> +> AVRecorder只负责视频数据的处理,需要与视频数据采集模块配合才能完成视频录制。视频数据采集模块需要通过Surface将视频数据传递给AVRecorder进行数据处理。当前常用的数据采集模块为相机模块,相机模块目前仅对系统应用开放,具体请参考[相机模块](../reference/apis/js-apis-camera.md)。 + +AVRecorder详细的API说明请参考[AVRecorder API参考](../reference/apis/js-apis-media.md#avrecorder9)。 + +1. 创建AVRecorder实例,实例创建完成进入idle状态。 + + ```ts + import media from '@ohos.multimedia.media' + let avRecorder + media.createAVRecorder().then((recorder) => { + avRecorder = recorder + }, (error) => { + console.error('createAVRecorder failed') + }) + ``` + +2. 设置业务需要的监听事件,监听状态变化及错误上报。 + | 事件类型 | 说明 | + | -------- | -------- | + | stateChange | 必要事件,监听播放器的state属性改变 | + | error | 必要事件,监听播放器的错误信息 | + + ```ts + // 状态上报回调函数 + avRecorder.on('stateChange', (state, reason) => { + console.info('current state is: ' + state); + }) + // 错误上报回调函数 + avRecorder.on('error', (err) => { + console.error('error happened, error message is ' + err); + }) + ``` + +3. 配置视频录制参数,调用prepare()接口,此时进入prepared状态。 + > **说明:** + > + > 配置参数需要注意: + > + > - prepare接口的入参avConfig中仅设置视频相关的配置参数,如示例代码所示。 + > 如果添加了音频参数,系统将认为是“音频+视频录制”。 + > + > - 需要使用支持的[录制规格](avplayer-avrecorder-overview.md#支持的格式),视频比特率、分辨率、帧率以实际硬件设备支持的范围为准。 + > + > - 录制输出的url地址(即示例里avConfig中的url),形式为fd://xx (fd number)。需要调用基础文件操作接口([ohos.file.fs](../reference/apis/js-apis-file-fs.md))实现应用文件访问能力,获取方式参考[应用文件访问与管理](../file-management/app-file-access.md)。 + + ```ts + let avProfile = { + fileFormat : media.ContainerFormatType.CFT_MPEG_4, // 视频文件封装格式,只支持MP4 + videoBitrate : 200000, // 视频比特率 + videoCodec : media.CodecMimeType.VIDEO_AVC, // 视频文件编码格式,支持mpeg4和avc两种格式 + videoFrameWidth : 640, // 视频分辨率的宽 + videoFrameHeight : 480, // 视频分辨率的高 + videoFrameRate : 30 // 视频帧率 + } + let avConfig = { + videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV, // 视频源类型,支持YUV和ES两种格式 + profile : this.avProfile, + url : 'fd://35', // 参考应用文件访问与管理开发示例新建并读写一个文件 + rotation : 0, // 视频旋转角度,默认为0不旋转,支持的值为0、90、180、270 + } + avRecorder.prepare(avConfig).then(() => { + console.info('avRecorder prepare success') + }, (error) => { + console.error('avRecorder prepare failed') + }) + ``` + +4. 获取视频录制需要的SurfaceID。 + 调用getInputSurface()接口,接口的返回值SurfaceID用于传递给视频数据输入源模块。常用的输入源模块为相机,以下示例代码中,采用相机作为视频输入源为例。 + + 输入源模块通过SurfaceID可以获取到Surface,通过Surface可以将视频数据流传递给AVRecorder,由AVRecorder再进行视频数据的处理。 + + ```ts + avRecorder.getInputSurface().then((surfaceId) => { + console.info('avRecorder getInputSurface success') + }, (error) => { + console.error('avRecorder getInputSurface failed') + }) + ``` + +5. 初始化视频数据输入源。该步骤需要在输入源模块完成,以相机为例,需要创建录像输出流,包括创建Camera对象、获取相机列表、创建相机输入流等,相机详细步骤请参考[相机-录像实现方案](camera-recording-case.md)。 + +6. 开始录制,启动输入源输入视频数据,例如相机模块调用camera.VideoOutput.start接口启动相机录制。然后调用AVRecorder.start()接口,此时AVRecorder进入started状态。 + +7. 暂停录制,调用pause()接口,此时AVRecorder进入paused状态,同时暂停输入源输入数据。例如相机模块调用camera.VideoOutput.stop停止相机视频数据输入。 + +8. 恢复录制,调用resume()接口,此时再次进入started状态。 + +9. 停止录制,调用stop()接口,此时进入stopped状态,同时停止相机录制。 + +10. 重置资源,调用reset()重新进入idle状态,允许重新配置录制参数。 + +11. 销毁实例,调用release()进入released状态,退出录制,释放视频数据输入源相关资源,例如相机资源。 + + +## 完整示例 + +参考以下示例,完成“开始录制-暂停录制-恢复录制-停止录制”的完整流程。 + + +```ts +import media from '@ohos.multimedia.media' +const TAG = 'VideoRecorderDemo:' +export class VideoRecorderDemo { + private avRecorder; + private videoOutSurfaceId; + private avProfile = { + fileFormat : media.ContainerFormatType.CFT_MPEG_4, // 视频文件封装格式,只支持MP4 + videoBitrate : 100000, // 视频比特率 + videoCodec : media.CodecMimeType.VIDEO_AVC, // 视频文件编码格式,支持mpeg4和avc两种格式 + videoFrameWidth : 640, // 视频分辨率的宽 + videoFrameHeight : 480, // 视频分辨率的高 + videoFrameRate : 30 // 视频帧率 + } + private avConfig = { + videoSourceType : media.VideoSourceType.VIDEO_SOURCE_TYPE_SURFACE_YUV, // 视频源类型,支持YUV和ES两种格式 + profile : this.avProfile, + url : 'fd://35', // 参考应用文件访问与管理开发示例新建并读写一个文件 + rotation : 0, // 视频旋转角度,默认为0不旋转,支持的值为0、90、180、270 + } + + // 注册avRecorder回调函数 + setAvRecorderCallback() { + // 状态机变化回调函数 + this.avRecorder.on('stateChange', (state, reason) => { + console.info(TAG + 'current state is: ' + state); + }) + // 错误上报回调函数 + this.avRecorder.on('error', (err) => { + console.error(TAG + 'error ocConstantSourceNode, error message is ' + err); + }) + } + + // 相机相关准备工作 + async prepareCamera() { + // 具体实现查看相机资料 + } + + // 启动相机出流 + async startCameraOutput() { + // 调用VideoOutput的start接口开始录像输出 + } + + // 停止相机出流 + async stopCameraOutput() { + // 调用VideoOutput的stop接口停止录像输出 + } + + // 释放相机实例 + async releaseCamera() { + // 释放相机准备阶段创建出的实例 + } + + // 开始录制对应的流程 + async startRecordingProcess() { + // 1.创建录制实例; + this.avRecorder = await media.createAVRecorder(); + this.setAvRecorderCallback(); + // 2. 获取录制文件fd;获取到的值传递给avConfig里的url,实现略 + // 3.配置录制参数完成准备工作 + await this.avRecorder.prepare(this.avConfig); + this.videoOutSurfaceId = await this.avRecorder.getInputSurface(); + // 4.完成相机相关准备工作 + await this.prepareCamera(); + // 5.启动相机出流 + await this.startCameraOutput(); + // 6. 启动录制 + await this.videoRecorder.start(); + } + + // 暂停录制对应的流程 + async pauseRecordingProcess() { + if (this.avRecorder.state === 'started') { // 仅在started状态下调用pause为合理状态切换 + await this.avRecorder.pause(); + await this.stopCameraOutput(); // 停止相机出流 + } + } + + // 恢复录制对应的流程 + async resumeRecordingProcess() { + if (this.avRecorder.state === 'paused') { // 仅在paused状态下调用resume为合理状态切换 + await this.startCameraOutput(); // 启动相机出流 + await this.avRecorder.resume(); + } + } + + async stopRecordingProcess() { + // 1. 停止录制 + if (this.avRecorder.state === 'started' + || this.avRecorder.state === 'paused' ) { // 仅在started或者paused状态下调用stop为合理状态切换 + await this.avRecorder.stop(); + await this.stopCameraOutput(); + } + // 2.重置 + await this.avRecorder.reset(); + // 3.释放录制实例 + await this.avRecorder.release(); + // 4.文件录制完成后,关闭fd,实现略 + // 5.释放相机相关实例 + await this.releaseCamera(); + } + + // 一个完整的【开始录制-暂停录制-恢复录制-停止录制】示例 + async videoRecorderDemo() { + await this.startRecordingProcess(); // 开始录制 + // 用户此处可以自行设置录制时长,例如通过设置休眠阻止代码执行 + await this.pauseRecordingProcess(); //暂停录制 + await this.resumeRecordingProcess(); // 恢复录制 + await this.stopRecordingProcess(); // 停止录制 + } +} +``` diff --git a/zh-cn/application-dev/media/volume-management.md b/zh-cn/application-dev/media/volume-management.md new file mode 100644 index 0000000000000000000000000000000000000000..354ad9954fb6aa66d5a05705b2aa1c5011ae9878 --- /dev/null +++ b/zh-cn/application-dev/media/volume-management.md @@ -0,0 +1,48 @@ +# 播放音量管理 + +播放音量的管理主要包括对系统音量的管理和对音频流音量的管理。系统音量与音频流音量分别是指OpenHarmony系统的总音量和指定音频流的音量,其中音频流音量的大小受制于系统音量,管理两者的接口不同。 + +## 系统音量 + +管理系统音量的接口是AudioVolumeManager,在使用之前,需要使用getVolumeManager()获取AudioVolumeManager实例。目前该接口只能获取音量信息及监听音量变化,不能主动调节系统音量。 + +```ts +import audio from '@ohos.multimedia.audio'; +let audioManager = audio.getAudioManager(); +let audioVolumeManager = audioManager.getVolumeManager(); +``` + +### 监听系统音量变化 + +通过设置监听事件,可以监听系统音量的变化: + +```ts +audioVolumeManager.on('volumeChange', (volumeEvent) => { + console.info(`VolumeType of stream: ${volumeEvent.volumeType} `); + console.info(`Volume level: ${volumeEvent.volume} `); + console.info(`Whether to updateUI: ${volumeEvent.updateUi} `); +}); +``` + +### 调节系统音量(仅对系统应用开放) + +目前调节系统音量主要是靠SystemAPI,具体服务于物理音量按键和设置。通过音量按键可以调节系统音量的大小,根据按下的具体按键调用系统接口,实现系统音量的大小调节。调节的音量类型包括媒体、铃声和通知。 + +## 音频流音量 + +管理音频流音量的接口是AVPlayer或AudioRenderer的setVolume()方法,使用AVPlayer设置音频流音量的示例代码如下: + +```ts +let volume = 1.0 // 指定的音量大小,取值范围为[0.00-1.00],1表示最大音量 +avPlayer.setVolume(volume) +``` + +使用AudioRenderer设置音频流音量的示例代码如下: + +```ts +audioRenderer.setVolume(0.5).then(data=>{ // 音量范围为[0.0-1.0] + console.info('Invoke setVolume succeeded.'); +}).catch((err) => { + console.error(`Invoke setVolume failed, code is ${err.code}, message is ${err.message}`); +}); +``` diff --git a/zh-cn/application-dev/napi/Readme-CN.md b/zh-cn/application-dev/napi/Readme-CN.md index 752a456fca9fed148b05885c3ce41c1ebfc1b456..7ab6c418168a4e99ca15a63c0cc17e1dcd797a10 100644 --- a/zh-cn/application-dev/napi/Readme-CN.md +++ b/zh-cn/application-dev/napi/Readme-CN.md @@ -1,6 +1,71 @@ +# Native API +Native API是OHOS SDK上提供的一组native开发接口与工具集合,方便开发者使用C或者C++语言实现应用的关键功能。Native API只覆盖了OHOS基础的一些底层能力,如libc,图形库,窗口系统,多媒体,压缩库等,并没有完全提供类似于JS API上的完整的OHOS 平台能力。在应用中使用Native API会编译成动态库打包到应用中。 + +
+ +## Native API构成介绍 + +### Native API目录结构 + +Native API在SDK包的位置为$(SDK_ROOT)/native目录,主要有以下几个部分组成 + +|目录|功能说明| +|--|--| +|build|应用中编译动态库的toolchain cmake脚本;这个目录下ohos.toolchain.cmake文件定义了给OHOS交叉编译选项| +|build-tools|放置编译构建的工具,如cmake| +|docs|Native API接口参考文档,通过doxgen从头文件中提取出来| +|llvm|支持OHOS ABI的llvm交叉编译器| +|sysroot|放置编译链接的依赖文件目录,包含头文件,动态库等| + +
+ +### Native API接口 + +|接口分类|接口功能|引入版本| +|--|--|--| +|标准C库|以musl为基础提供的标准c库接口,当前提供了1500+的接口|8| +|标准C++库|c++运行时库libc++_shared,此库在打包的时候需要打包或者静态链接到应用中|8| +|日志|打印日志到系统的hilog接口|8| +|napi|ArkUI提供的,方便应用开发接入JS应用环境的一组类Node-API,是属于Native API的一部分|8| +|XComponent|ArkUI XComponent组件中的surface与触屏事件接口,方便开发者开发高性能图形应用|8| +|libuv|ArkUI集成的三方的异步IO库|8| +|libz|zlib库,提供基本的压缩,解压接口|8| +|Drawing|系统提供的2D图形库,可以在surface进行绘制|8| +|OpenGL|系统提供的openglv3接口|8| +|Rawfile|应用资源访问接口,可以读取应用中打包的各种资源|8| +|OpenSLES|用于2D,3D音频加速的接口库|8| +|Mindspore|AI模型接口库|9| +|包管理|包服务接口,方便查询应用包信息|8| + +Native API中有一部分接口采用开源标准,详细列表见《[Native API中支持的标准库](https://docs.openharmony.cn/pages/v3.1/zh-cn/application-dev/reference/native-lib/third_party_libc/musl.md/)》《[Node_API](https://docs.openharmony.cn/pages/v3.1/zh-cn/application-dev/reference/native-lib/third_party_napi/napi.md/)》 + +## 使用介绍 + +
+ +### 建议使用Native API的场景 + +主要有如下一些 + +1. 应用性能敏感代码,比如游戏,物理模拟等计算密集型场景 +2. 需要复用已有的C或C++库 +3. 需要针对CPU特性进行专项定制的库,如neon加速 + +
+ +### 不建议使用Native API的场景 + +1. 写一个纯native的的OHOS应用 +2. 希望在尽可能多的OHOS设备上保持兼容的应用 + +
+ # Native API的相关指导 +- [Native API hello world]() + - 本例子引导开发者开发一个hello的Native API库,在ts界面上显示出从hello库中获取的字符串 - [Native API在应用工程中的使用指导](napi-guidelines.md) + - 介绍如何使用各种napi接口与js中的模块,接口,异步任务进行互操作 - [Drawing开发指导](drawing-guidelines.md) - [Rawfile开发指导](rawfile-guidelines.md) - [NativeWindow开发指导](native-window-guidelines.md) diff --git a/zh-cn/application-dev/napi/drawing-guidelines.md b/zh-cn/application-dev/napi/drawing-guidelines.md index b746e15978646c5c9efed2cc24fc7ac1fac55768..4de946c8a781f1e3f5b16cc929b7cce5bd585ce9 100644 --- a/zh-cn/application-dev/napi/drawing-guidelines.md +++ b/zh-cn/application-dev/napi/drawing-guidelines.md @@ -189,7 +189,7 @@ Native Drawing模块提供了一系列的接口用于基本图形和字体的绘 OH_Drawing_CreateFontCollection()); OH_Drawing_TypographyHandlerPushTextStyle(handler, txtStyle); // 设置文字内容 - const char* text = "OpenHarmony\n"; + const char* text = "Hello World\n"; OH_Drawing_TypographyHandlerAddText(handler, text); OH_Drawing_TypographyHandlerPopTextStyle(handler); OH_Drawing_Typography* typography = OH_Drawing_CreateTypography(handler); diff --git a/zh-cn/application-dev/napi/figures/rawfile1.png b/zh-cn/application-dev/napi/figures/rawfile1.png new file mode 100644 index 0000000000000000000000000000000000000000..9f29f7875cd983f967b7a3b27b5898bfce76c9f3 Binary files /dev/null and b/zh-cn/application-dev/napi/figures/rawfile1.png differ diff --git a/zh-cn/application-dev/napi/mindspore-lite-guidelines.md b/zh-cn/application-dev/napi/mindspore-lite-guidelines.md index f2ad48c2842755eadfa3ceab3327219f664a148a..7dba8071cd464c24ca2a2440f3b2dd31c2d207a6 100644 --- a/zh-cn/application-dev/napi/mindspore-lite-guidelines.md +++ b/zh-cn/application-dev/napi/mindspore-lite-guidelines.md @@ -241,4 +241,4 @@ int GenerateInputDataWithRandom(OH_AI_TensorHandleArray inputs) { ## 相关实例 针对MindSpore Lite 的使用,有以下相关实例可供参考: -- [简易MSLite教程](https://gitee.com/openharmony/third_party_mindspore/tree/master/mindspore/lite/examples/quick_start_c) +- [简易MSLite教程](https://gitee.com/openharmony/third_party_mindspore/tree/OpenHarmony-3.2-Release/mindspore/lite/examples/quick_start_c) diff --git a/zh-cn/application-dev/napi/napi-guidelines.md b/zh-cn/application-dev/napi/napi-guidelines.md index 39a1a1d09fc3f4d02c3eb3a02e8274798b7acee4..e2788d6106d55f287f045f51a68841bc44e18b7d 100644 --- a/zh-cn/application-dev/napi/napi-guidelines.md +++ b/zh-cn/application-dev/napi/napi-guidelines.md @@ -1,652 +1,192 @@ -# Native API在应用工程中的使用指导 +# N-API在应用工程中的使用指导 -OpenHarmony的应用必须用js来桥接native。需要使用[ace_napi](https://gitee.com/openharmony/arkui_napi/tree/master)仓中提供的napi接口来处理js交互。napi提供的接口名与三方Node.js一致,目前支持部分接口,符号表见ace_napi仓中的`libnapi.ndk.json`文件。 +在OpenHarmony中,C API中的N-API接口可以实现ArkTS/TS/JS与C/C++之间的交互。N-API提供的接口名与三方Node.js一致,目前支持部分接口,支持列表见[链接](https://gitee.com/openharmony/arkui_napi/blob/master/libnapi.ndk.json)。 ## 开发流程 -在DevEco Studio的模板工程中包含使用Native API的默认工程,使用`File`->`New`->`Create Project`创建`Native C++`模板工程。创建后在`main`目录下会包含`cpp`目录,可以使用ace_napi仓下提供的napi接口进行开发。 +在DevEco Studio的模板工程中包含使用N-API的默认工程,使用`File`->`New`->`Create Project`创建`Native C++`模板工程。创建后在`entry/src/main`目录下会包含`cpp`目录,可以使用N-API接口,开发C/C++代码(native侧代码)。 -js侧通过`import`引入native侧包含处理js逻辑的so,如:`import hello from 'libhello.so'`,意为使用libhello.so的能力,native侧通过napi接口创建的js对象会给到应用js侧的`hello`对象。 - -## 开发建议 - -### 注册建议 - -* nm_register_func对应的函数需要加上static,防止与其他so里的符号冲突。 -* 模块注册的入口,即使用\_\_attribute\_\_((constructor))修饰的函数的函数名需要确保不与其他模块重复。 - -### so命名规则 - -**so命名必须符合以下规则:** - -* 每个模块对应一个so。 -* 如模块名为`hello`,则so的名字为`libhello.so`,`napi_module`中`nm_modname`字段应为`hello`,大小写与模块名保持一致,应用使用时写作:`import hello from 'libhello.so'`。 - -### js对象线程限制 - -ark引擎会对js对象线程使用进行保护,使用不当会引起应用crash,因此需要遵循如下原则: - -* napi接口只能在js线程使用。 -* env与线程绑定,不能跨线程使用。native侧js对象只能在创建时的线程使用,即与线程所持有的env绑定。 - -### 头文件引入限制 - -在使用napi的对象和方法时需要引用"napi/native_api.h"。否则在只引入三方库头文件时,会出现接口无法找到的编译报错。 - -### napi_create_async_work接口说明 - -napi_create_async_work里有两个回调: - -* execute:用于异步处理业务逻辑。因为不在js线程中,所以不允许调用napi的接口。业务逻辑的返回值可以返回到complete回调中处理。 - -* complete:可以调用napi的接口,将execute中的返回值封装成js对象返回。此回调在js线程中执行。 - -```c++ -napi_status napi_create_async_work(napi_env env, - napi_value async_resource, - napi_value async_resource_name, - napi_async_execute_callback execute, - napi_async_complete_callback complete, - void* data, - napi_async_work* result) -``` +ArkTS/TS/JS侧通过`import`引入native侧的so文件,如:`import hello from 'libhello.so'`,意为使用libhello.so的能力,并将名为`hello`的ArkTS/TS/JS对象给到应用的ArkTS/TS/JS侧,开发者可通过该对象,调用到在`cpp`中开发的native方法。 +## 基本功能 +N-API接口可以实现ArkTS/TS/JS和C/C++之间的交互,这里以HelloWorld工程的两个例子: +1. 提供一个名为`Add`的native方法,ArkTS侧调用该方法并传入两个number,native方法将这两个number相加并返回到ArkTS侧。 +2. 提供一个名为`NativeCallArkTS`的native方法,ArkTS侧调用该方法并传入一个ArkTS function,native方法中调用这个ArkTS function,并将其结果返回ArkTS侧。 +以此来介绍: +1. ArkTS侧如何调用到C++侧方法。 +2. C++侧如何调用到ArkTS侧方法。 -## storage 模块——同步异步接口封装 +下面给出了工程中的: +1. `entry\src\main\cpp\hello.cpp`, 包含native侧逻辑。 +2. `entry\src\main\ets\pages\index.ets`,包含ArkTS侧逻辑。 +3. `entry\src\main\cpp\types\libentry\index.d.ts`,包含native侧暴露给ArkTS侧接口的声明。 -### 模块简介 +同时给出了注解,工程中其余部分均与native默认工程相同。 -本示例通过实现 `storage` 模块展示了同步和异步方法的封装。`storage ` 模块实现了数据的保存、获取、删除、清除功能。 - -### 接口声明 - -```typescript -import { AsyncCallback } from './basic'; -declare namespace storage { - function get(key: string, callback: AsyncCallback): void; - function get(key: string, defaultValue: string, callback: AsyncCallback): void; - function get(key: string, defaultValue?: string): Promise; - function set(key: string, value: string, callback: AsyncCallback): void; - function remove(key: string, callback: AsyncCallback): void; - function clear(callback: AsyncCallback): void; - function getSync(key: string, defaultValue?: string): string; - function setSync(key: string, value: string): void; - function removeSync(key: string): void; - function clearClear(): void; -} -export default storage; -``` - - - -### 具体实现 - -完整代码参见仓下路径:[OpenHarmony/arkui_napi](https://gitee.com/openharmony/arkui_napi/tree/master)仓库`sample/native_module_storage/` - -**1、模块注册** - -如下,注册了4个同步接口(`getSync`、`setSync`、`removeSync`、`clearSync`)、4个异步接口(`get`、`set`、`remove`、`clear`)。 - -```c++ -/*********************************************** - * Module export and register - ***********************************************/ -static napi_value StorageExport(napi_env env, napi_value exports) -{ - napi_property_descriptor desc[] = { - DECLARE_NAPI_FUNCTION("get", JSStorageGet), - DECLARE_NAPI_FUNCTION("set", JSStorageSet), - DECLARE_NAPI_FUNCTION("remove", JSStorageDelete), - DECLARE_NAPI_FUNCTION("clear", JSStorageClear), - - DECLARE_NAPI_FUNCTION("getSync", JSStorageGetSync), - DECLARE_NAPI_FUNCTION("setSync", JSStorageSetSync), - DECLARE_NAPI_FUNCTION("deleteSync", JSStorageDeleteSync), - DECLARE_NAPI_FUNCTION("clearSync", JSStorageClearSync), - }; - NAPI_CALL(env, napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc)); - return exports; -} +```C++ +// entry\src\main\cpp\hello.cpp +// 引入N-API相关头文件。 +#include "napi/native_api.h" -// storage module -static napi_module storage_module = {.nm_version = 1, - .nm_flags = 0, - .nm_filename = nullptr, - .nm_register_func = StorageExport, - .nm_modname = "storage", - .nm_priv = ((void*)0), - .reserved = {0}}; - -// storage module register -extern "C" __attribute__((constructor)) void StorageRegister() +// 开发者提供的native方法,入参有且仅有如下两个,开发者不需进行变更。 +// napi_env 为当前运行的上下文。 +// napi_callback_info 记录了一些信息,包括从ArkTS侧传递过来参数等。 +static napi_value Add(napi_env env, napi_callback_info info) { - napi_module_register(&storage_module); -} -``` - -**2、getSync 函数实现** + // 期望从ArkTS侧获取的参数的数量,napi_value可理解为ArkTS value在native方法中的表现形式。 + size_t argc = 2; + napi_value args[2] = {nullptr}; + + // 从info中,拿到从ArkTS侧传递过来的参数,此处获取了两个ArkTS参数,即arg[0]和arg[1]。 + napi_get_cb_info(env, info, &argc, args , nullptr, nullptr); -如上注册时所写,`getSync` 对应的函数是 `JSStorageGetSync` 。从 `gKeyValueStorage` 中获取数据后,创建一个字符串对象并返回。 + // 将获取的ArkTS参数转换为native信息,此处ArkTS侧传入了两个number,这里将其转换为native侧可以操作的double类型。 + double value0; + napi_get_value_double(env, args[0], &value0); -```c -static napi_value JSStorageGetSync(napi_env env, napi_callback_info info) -{ - GET_PARAMS(env, info, 2); - NAPI_ASSERT(env, argc >= 1, "requires 1 parameter"); - char key[32] = {0}; - size_t keyLen = 0; - char value[128] = {0}; - size_t valueLen = 0; - - // 参数解析 - for (size_t i = 0; i < argc; i++) { - napi_valuetype valueType; - napi_typeof(env, argv[i], &valueType); - - if (i == 0 && valueType == napi_string) { - napi_get_value_string_utf8(env, argv[i], key, 31, &keyLen); - } else if (i == 1 && valueType == napi_string) { - napi_get_value_string_utf8(env, argv[i], value, 127, &valueLen); - break; - } else { - NAPI_ASSERT(env, false, "type mismatch"); - } - } - - // 获取数据的业务逻辑,这里简单地从一个全局变量中获取 - auto itr = gKeyValueStorage.find(key); - napi_value result = nullptr; - if (itr != gKeyValueStorage.end()) { - // 获取到数据后创建一个string类型的JS对象 - napi_create_string_utf8(env, itr->second.c_str(), itr->second.length(), &result); - } else if (valueLen > 0) { - // 没有获取到数据使用默认值创建JS对象 - napi_create_string_utf8(env, value, valueLen, &result); - } else { - NAPI_ASSERT(env, false, "key does not exist"); - } - // 返回结果 - return result; + double value1; + napi_get_value_double(env, args[1], &value1); + + // native侧的业务逻辑,这里简单以两数相加为例。 + double nativeSum = value0 + value1; + + // 此处将native侧业务逻辑处理结果转换为ArkTS值,并返回给ArkTS。 + napi_value sum; + napi_create_double(env, nativeSum , &sum); + return sum; } -``` - -**3、get 函数实现** - -如上注册时所写,`get`对应的函数式`JSStorageGet`。 -```c -static napi_value JSStorageGet(napi_env env, napi_callback_info info) +static napi_value NativeCallArkTS(napi_env env, napi_callback_info info) { - GET_PARAMS(env, info, 3); - NAPI_ASSERT(env, argc >= 1, "requires 1 parameter"); - - // StorageAsyncContext是自己定义的一个类,用于保存执行过程中的数据 - StorageAsyncContext* asyncContext = new StorageAsyncContext(); - - asyncContext->env = env; - - // 获取参数 - for (size_t i = 0; i < argc; i++) { - napi_valuetype valueType; - napi_typeof(env, argv[i], &valueType); - - if (i == 0 && valueType == napi_string) { - napi_get_value_string_utf8(env, argv[i], asyncContext->key, 31, &asyncContext->keyLen); - } else if (i == 1 && valueType == napi_string) { - napi_get_value_string_utf8(env, argv[i], asyncContext->value, 127, &asyncContext->valueLen); - } else if (i == 1 && valueType == napi_function) { - napi_create_reference(env, argv[i], 1, &asyncContext->callbackRef); - break; - } else if (i == 2 && valueType == napi_function) { - napi_create_reference(env, argv[i], 1, &asyncContext->callbackRef); - } else { - NAPI_ASSERT(env, false, "type mismatch"); - } - } - + // 期望从ArkTS侧获取的参数的数量,napi_value可理解为ArkTS value在native方法中的表现形式。 + size_t argc = 1; + napi_value args[1] = {nullptr}; + + // 从info中,拿到从ArkTS侧传递过来的参数,此处获取了一个ArkTS参数,即arg[0]。 + napi_get_cb_info(env, info, &argc, args , nullptr, nullptr); + + // 创建一个ArkTS number作为ArkTS function的入参。 + napi_value argv = nullptr; + napi_create_int32(env, 10, &argv); + napi_value result = nullptr; - - // 根据参数判断开发者使用的是promise还是callback - if (asyncContext->callbackRef == nullptr) { - // 创建promise - napi_create_promise(env, &asyncContext->deferred, &result); - } else { - napi_get_undefined(env, &result); - } - - napi_value resource = nullptr; - napi_create_string_utf8(env, "JSStorageGet", NAPI_AUTO_LENGTH, &resource); - - napi_create_async_work( - env, nullptr, resource, - // 回调1:此回调由napi异步执行,里面就是需要异步执行的业务逻辑。由于是异步线程执行,所以不要在此通过napi接口操作JS对象。 - [](napi_env env, void* data) { - StorageAsyncContext* asyncContext = (StorageAsyncContext*)data; - auto itr = gKeyValueStorage.find(asyncContext->key); - if (itr != gKeyValueStorage.end()) { - strncpy_s(asyncContext->value, 127, itr->second.c_str(), itr->second.length()); - asyncContext->status = 0; - } else { - asyncContext->status = 1; - } - }, - // 回调2:此回调在上述异步回调执行完后执行,此时回到了JS线程来回调开发者传入的回调 - [](napi_env env, napi_status status, void* data) { - StorageAsyncContext* asyncContext = (StorageAsyncContext*)data; - napi_value result[2] = {0}; - if (!asyncContext->status) { - napi_get_undefined(env, &result[0]); - napi_create_string_utf8(env, asyncContext->value, strlen(asyncContext->value), &result[1]); - } else { - napi_value message = nullptr; - napi_create_string_utf8(env, "key does not exist", NAPI_AUTO_LENGTH, &message); - napi_create_error(env, nullptr, message, &result[0]); - napi_get_undefined(env, &result[1]); - } - if (asyncContext->deferred) { - // 如果走的是promise,那么判断回调1的结果 - if (!asyncContext->status) { - // 回调1执行成功(status为1)时触发,也就是触发promise里then里面的回调 - napi_resolve_deferred(env, asyncContext->deferred, result[1]); - } else { - // 回调1执行失败(status为0)时触发,也就是触发promise里catch里面的回调 - napi_reject_deferred(env, asyncContext->deferred, result[0]); - } - } else { - // 如果走的是callback,则通过napi_call_function调用callback回调返回结果 - napi_value callback = nullptr; - napi_value returnVal; - napi_get_reference_value(env, asyncContext->callbackRef, &callback); - napi_call_function(env, nullptr, callback, 2, result, &returnVal); - napi_delete_reference(env, asyncContext->callbackRef); - } - napi_delete_async_work(env, asyncContext->work); - delete asyncContext; - }, - (void*)asyncContext, &asyncContext->work); - napi_queue_async_work(env, asyncContext->work); - + // native方法中调用ArkTS function,其返回值保存到result中并返到ArkTS侧。 + napi_call_function(env, nullptr, args[0], 1, &argv, &result); + return result; } -``` -**4、js示例代码** - -```js -import storage from 'libstorage.so'; - -export default { - testGetSync() { - const name = storage.getSync('name'); - console.log('name is ' + name); - }, - testGet() { - storage.get('name') - .then(date => { - console.log('name is ' + data); - }) - .catch(error => { - console.log('error: ' + error); - }); - } -} -``` - - - -## NetServer 模块——native与js对象绑定 - -### 模块简介 - -本示例展示了`on/off/once`订阅方法的实现,同时也包含了 C++ 与 js对象通过 wrap 接口的绑定。NetServer 模块实现了一个网络服务。 - -### 接口声明 - -```typescript -export class NetServer { - function start(port: number): void; - function stop(): void; - function on('start' | 'stop', callback: Function): void; - function once('start' | 'stop', callback: Function): void; - function off('start' | 'stop', callback: Function): void; -} -``` - -### 具体实现 - -完整代码参见:[OpenHarmony/arkui_napi](https://gitee.com/openharmony/arkui_napi/tree/master)仓库`sample/native_module_netserver/` - -**1、模块注册** - -```c -static napi_value NetServer::Export(napi_env env, napi_value exports) +EXTERN_C_START +// Init将在exports上挂上Add/NativeCallArkTS这些native方法,此处的exports就是开发者import之后获取到的ArkTS对象。 +static napi_value Init(napi_env env, napi_value exports) { - const char className[] = "NetServer"; - napi_property_descriptor properties[] = { - DECLARE_NAPI_FUNCTION("start", JS_Start), - DECLARE_NAPI_FUNCTION("stop", JS_Stop), - DECLARE_NAPI_FUNCTION("on", JS_On), - DECLARE_NAPI_FUNCTION("once", JS_Once), - DECLARE_NAPI_FUNCTION("off", JS_Off), + // 函数描述结构体,以Add为例,第三个参数"Add"为上述的native方法, + // 第一个参数"add"为ArkTS侧对应方法的名称。 + napi_property_descriptor desc[] = { + { "add", nullptr, Add, nullptr, nullptr, nullptr, napi_default, nullptr }, + { "nativeCallArkTS", nullptr, NativeCallArkTS, nullptr, nullptr, nullptr, napi_default, nullptr }, }; - napi_value netServerClass = nullptr; - - napi_define_class(env, className, sizeof(className), JS_Constructor, nullptr, countof(properties), properties, - &netServerClass); - - napi_set_named_property(env, exports, "NetServer", netServerClass); - + // 在exports这个ArkTS对象上,挂载native方法。 + napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc); return exports; } -``` - -**2、在构造函数中绑定 C++ 与 JS 对象** +EXTERN_C_END -```c -napi_value NetServer::JS_Constructor(napi_env env, napi_callback_info cbinfo) -{ - napi_value thisVar = nullptr; - void* data = nullptr; - napi_get_cb_info(env, cbinfo, nullptr, nullptr, &thisVar, &data); - - // C++ Native对象,准备与JS对象映射在一起 - NetServer* netServer = new NetServer(env, thisVar); - - // 使用napi_wrap将netServer与thisVar(即当前创建的这个JS对象)做绑定 - napi_wrap( - env, thisVar, netServer, - // JS对象由引擎自动回收释放,当JS对象释放时触发该回调,在改回调中释放netServer - [](napi_env env, void* data, void* hint) { - printf("NetServer::Destructor\n"); - NetServer* netServer = (NetServer*)data; - delete netServer; - }, - nullptr, nullptr); - - return thisVar; -} -``` - -**3、从 JS 对象中取出 C++ 对象** +// 准备模块加载相关信息,将上述Init函数与本模块名等信息记录下来。 +static napi_module demoModule = { + .nm_version =1, + .nm_flags = 0, + .nm_filename = nullptr, + .nm_register_func = Init, + .nm_modname = "entry", + .nm_priv = ((void*)0), + .reserved = { 0 }, +}; -```c -napi_value NetServer::JS_Start(napi_env env, napi_callback_info cbinfo) +// 打开so时,该函数将自动被调用,使用上述demoModule模块信息,进行模块注册相关动作。 +extern "C" __attribute__((constructor)) void RegisterHelloModule(void) { - size_t argc = 1; - napi_value argv[1] = {0}; - napi_value thisVar = nullptr; - void* data = nullptr; - napi_get_cb_info(env, cbinfo, &argc, argv, &thisVar, &data); - - NetServer* netServer = nullptr; - // 通过napi_unwrap从thisVar中取出C++对象 - napi_unwrap(env, thisVar, (void**)&netServer); - - NAPI_ASSERT(env, argc >= 1, "requires 1 parameter"); - - napi_valuetype valueType; - napi_typeof(env, argv[0], &valueType); - NAPI_ASSERT(env, valueType == napi_number, "type mismatch for parameter 1"); - - int32_t port = 0; - napi_get_value_int32(env, argv[0], &port); - - // 开启服务 - netServer->Start(port); - - napi_value result = nullptr; - napi_get_undefined(env, &result); - return result; + napi_module_register(&demoModule); } ``` -`netServer->Start`后回调通过`on`注册的`start`事件。 - -```c -int NetServer::Start(int port) -{ - printf("NetServer::Start thread_id: %ld \n", uv_thread_self()); - - struct sockaddr_in addr; - int r; - - uv_ip4_addr("0.0.0.0", port, &addr); - - r = uv_tcp_init(loop_, &tcpServer_); - if (r) { - fprintf(stderr, "Socket creation error\n"); - return 1; - } - - r = uv_tcp_bind(&tcpServer_, (const struct sockaddr*)&addr, 0); - if (r) { - fprintf(stderr, "Bind error\n"); - return 1; - } - - r = uv_listen((uv_stream_t*)&tcpServer_, SOMAXCONN, OnConnection); - if (r) { - fprintf(stderr, "Listen error %s\n", uv_err_name(r)); - return 1; +```js +// entry\src\main\ets\pages\index.ets + +import hilog from '@ohos.hilog'; +// 通过import的方式,引入native能力。 +import entry from 'libentry.so' + +@Entry +@Component +struct Index { + + build() { + Row() { + Column() { + // 第一个按钮,调用add方法,对应到native侧的Add方法,进行两数相加。 + Button('ArkTS call C++') + .fontSize(50) + .fontWeight(FontWeight.Bold) + .onClick(() => { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + hilog.info(0x0000, 'testTag', 'Test NAPI 2 + 3 = %{public}d', entry.add(2, 3)); + }) + // 第二个按钮,调用nativeCallArkTS方法,对应到native的NativeCallArkTS,在native中执行ArkTS function。 + Button('C++ call ArkTS') + .fontSize(50) + .fontWeight(FontWeight.Bold) + .onClick(() => { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + let ret = entry.nativeCallArkTS((value)=>{return value * 2;}); + hilog.info(0x0000, 'testTag', 'Test NAPI nativeCallArkTS ret = %{public}d', ret); + }) + } + .width('100%') } - - // 服务启动后触发“start”事件 - Emit("start", nullptr); - - return 0; -} -``` - -**4、注册或释放(on/off/once)事件,以 on 为例** - -```c -napi_value NetServer::JS_On(napi_env env, napi_callback_info cbinfo) -{ - size_t argc = 2; - napi_value argv[2] = {0}; - napi_value thisVar = 0; - void* data = nullptr; - napi_get_cb_info(env, cbinfo, &argc, argv, &thisVar, &data); - - NetServer* netServer = nullptr; - // 通过napi_unwrap取出NetServer指针 - napi_unwrap(env, thisVar, (void**)&netServer); - - NAPI_ASSERT(env, argc >= 2, "requires 2 parameter"); - - // 参数类型校验 - napi_valuetype eventValueType; - napi_typeof(env, argv[0], &eventValueType); - NAPI_ASSERT(env, eventValueType == napi_string, "type mismatch for parameter 1"); - - napi_valuetype eventHandleType; - napi_typeof(env, argv[1], &eventHandleType); - NAPI_ASSERT(env, eventHandleType == napi_function, "type mismatch for parameter 2"); - - char type[64] = {0}; - size_t typeLen = 0; - - napi_get_value_string_utf8(env, argv[0], type, 63, &typeLen); - - // 注册事件handler - netServer->On((const char*)type, argv[1]); - - napi_value result = nullptr; - napi_get_undefined(env, &result); - return result; -} -``` - -**5、js示例代码** - -```javascript -import { NetServer } from 'libnetserver.so'; - -export default { - testNetServer() { - var netServer = new NetServer(); - netServer.on('start', (event) => {}); - netServer.start(1000); // 端口号1000, start完成后回调上面注册的 “start” 回调 + .height('100%') } } -``` - - - -## 在非JS线程中回调JS接口 -### 模块简介 - -本示例介绍如何在非JS线程中回调JS应用的回调函数。例如JS应用中注册了某个sensor的监听,这个sensor的数据是由一个SA服务来上报的,当SA通过IPC调到客户端时,此时的执行线程是一个IPC通信线程,与应用的JS线程是两个不同的线程。这时就需要将执行JS回调的任务抛到JS线程中才能执行,否则会出现崩溃。 - -### 具体实现 - -完整代码参见:[OpenHarmony/arkui_napi](https://gitee.com/openharmony/arkui_napi/tree/master)仓库`sample/native_module_callback/` - -**1、模块注册** - -如下,注册了1个接口`test`,会传入一个参数,类型为包含一个参数的函数。 +``` -```c++ -/*********************************************** - * Module export and register - ***********************************************/ -static napi_value CallbackExport(napi_env env, napi_value exports) -{ - static napi_property_descriptor desc[] = { - DECLARE_NAPI_FUNCTION("test", JSTest) - }; - NAPI_CALL(env, napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc)); - return exports; -} +```js +// entry\src\main\cpp\types\libentry\index.d.ts +// native侧暴露给ArkTS侧接口的声明。 +export const add: (a: number, b: number) => number; +export const nativeCallArkTS: (a: object) => number; +``` -// callback module define -static napi_module callbackModule = { - .nm_version = 1, - .nm_flags = 0, - .nm_filename = nullptr, - .nm_register_func = CallbackExport, - .nm_modname = "callback", - .nm_priv = ((void*)0), - .reserved = { 0 }, -}; +## 开发建议 -// callback module register -extern "C" __attribute__((constructor)) void CallbackTestRegister() -{ - napi_module_register(&callbackModule); -} -``` +### 注册建议 -**2、获取env中的loop,抛任务回JS线程** +* nm_register_func对应的函数(如上述Init函数)需要加上static,防止与其他so里的符号冲突。 +* 模块注册的入口,即使用\_\_attribute\_\_((constructor))修饰的函数的函数名(如上述RegisterHelloModule函数)需要确保不与其他模块重复。 -```c++ -#include +### so命名规则 -#include "napi/native_api.h" -#include "napi/native_node_api.h" +**so命名必须符合以下规则:** -#include "uv.h" +* 每个模块对应一个so。 +* 如模块名为`hello`,则so的名字为`libhello.so`,`napi_module`中`nm_modname`字段应为`hello`,大小写与模块名保持一致,应用使用时写作:`import hello from 'libhello.so'`。 -struct CallbackContext { - napi_env env = nullptr; - napi_ref callbackRef = nullptr; - int retData = 0; -}; +### JS对象线程限制 -void callbackTest(CallbackContext* context) -{ - uv_loop_s* loop = nullptr; - // 此处的env需要在注册JS回调时保存下来。从env中获取对应的JS线程的loop。 - napi_get_uv_event_loop(context->env, &loop); - - // 创建uv_work_t用于传递私有数据,注意回调完成后需要释放内存,此处省略生成回传数据的逻辑,传回int类型1。 - uv_work_t* work = new uv_work_t; - context->retData = 1; - work->data = (void*)context; - - // 调用libuv接口抛JS任务到loop中执行。 - uv_queue_work( - loop, - work, - // 此回调在另一个普通线程中执行,用于处理异步任务,回调执行完后执行下面的回调。本场景下该回调不需要执行任务。 - [](uv_work_t* work) {}, - // 此回调会在env对应的JS线程中执行。 - [](uv_work_t* work, int status) { - CallbackContext* context = (CallbackContext*)work->data; - napi_handle_scope scope = nullptr; - // 打开handle scope用于管理napi_value的生命周期,否则会内存泄露。 - napi_open_handle_scope(context->env, &scope); - if (scope == nullptr) { - return; - } - - // 调用napi。 - napi_value callback = nullptr; - napi_get_reference_value(context->env, context->callbackRef, &callback); - napi_value retArg; - napi_create_int32(context->env, context->retData, &retArg); - napi_value ret; - napi_call_function(context->env, nullptr, callback, 1, &retArg, &ret); - napi_delete_reference(context->env, context->callbackRef); - - // 关闭handle scope释放napi_value。 - napi_close_handle_scope(context->env, scope); - - // 释放work指针。 - if (work != nullptr) { - delete work; - } - - delete context; - } - ); -} +ArkCompiler会对JS对象线程进行保护,使用不当会引起应用crash,因此需要遵循如下原则: -static napi_value JSTest(napi_env env, napi_callback_info info) -{ - size_t argc = 1; - napi_value argv[1] = { 0 }; - napi_value thisVar = nullptr; - void* data = nullptr; - napi_get_cb_info(env, info, &argc, argv, &thisVar, &data); - - // 获取第一个入参,即需要后续触发的回调函数 - napi_valuetype valueType = napi_undefined; - napi_typeof(env, argv[0], &valueType); - if (valueType != napi_function) { - return nullptr; - } - // 存下env与回调函数,用于传递 - auto asyncContext = new CallbackContext(); - asyncContext->env = env; - napi_create_reference(env, argv[0], 1, &asyncContext->callbackRef); - // 模拟抛到非js线程执行逻辑 - std::thread testThread(callbackTest, asyncContext); - testThread.detach(); - - return nullptr; -} -``` +* N-API接口只能在JS线程使用。 +* env与线程绑定,不能跨线程使用。native侧JS对象只能在创建时的线程使用,即与线程所持有的env绑定。 -**3、js示例代码** +### 头文件引入限制 -```js -import callback from 'libcallback.so'; +在引入头文件时,需引入"napi/native_api.h",否则会出现N-API接口无法找到的编译报错。 -export default { - testcallback() { - callback.test((data) => { - console.error('test result = ' + data) - }) - } -} -``` ## 相关实例 -针对Native API的开发,有以下相关完整实例可供参考: +针对N-API的开发,有以下相关完整实例可供参考: - [第一个Native C++应用(ArkTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/NativeAPI/NativeTemplateDemo) diff --git a/zh-cn/application-dev/napi/neural-network-runtime-guidelines.md b/zh-cn/application-dev/napi/neural-network-runtime-guidelines.md index d1db02f381152821b699ffcc3870081a46742641..4fa36ff1f15e23b4d8d1a311384fcf7e42ba2bea 100644 --- a/zh-cn/application-dev/napi/neural-network-runtime-guidelines.md +++ b/zh-cn/application-dev/napi/neural-network-runtime-guidelines.md @@ -244,7 +244,7 @@ Neural Network Runtime的开发流程主要包含**模型构造**、**模型编 // 创建编译实例,用于将模型传递至底层硬件编译 OH_NNCompilation* compilation = OH_NNCompilation_Construct(model); if (compilation == nullptr) { - std::cout << "CreateCompilation failed, error happended when creating compilation." << std::endl; + std::cout << "CreateCompilation failed, error happened when creating compilation." << std::endl; return OH_NN_MEMORY_ERROR; } diff --git a/zh-cn/application-dev/napi/rawfile-guidelines.md b/zh-cn/application-dev/napi/rawfile-guidelines.md index bf57812aec92b68022636939f269d14734aa5bf9..f0b38d25a80e23c1a113c5f606cada27efb9c47c 100644 --- a/zh-cn/application-dev/napi/rawfile-guidelines.md +++ b/zh-cn/application-dev/napi/rawfile-guidelines.md @@ -1,10 +1,8 @@ -# Rawfile开发指导 - - +# 资源管理Rawfile开发指导 ## 场景介绍 -开发者可以通过本指导了解在OpenHarmony应用中,如何使用Native Rawfile接口操作Rawfile目录和文件。功能包括遍历、打开、搜索、读取和关闭Rawfile。 +开发者可以通过本指导了解在OpenHarmony应用中,如何使用Native Rawfile接口操作Rawfile目录和文件。功能包括文件列表遍历、文件打开、搜索、读取和关闭Rawfile。 ## 接口说明 @@ -27,60 +25,289 @@ ## 开发步骤 -1. 添加头文件。 + 以Js侧获取rawfile文件列表、rawfile文件内容、rawfile描述符{fd, offset, length}三种调用方式为例。 + +**1. 创建工程** + +![创建C++应用](figures/rawfile1.png) + +**2. 添加依赖** + +创建完成后,IDE会在工程生成cpp目录,目录有libentry/index.d.ts、hello.cpp、CMakeLists.txt等文件。 + +1. 打开src/main/cpp/CMakeLists.txt,在target_link_libraries依赖中添加资源的librawfile.z.so以及日志依赖libhilog_ndk.z.so ```c++ - #include "raw_file_manager.h" + target_link_libraries(entry PUBLIC libace_napi.z.so libhilog_ndk.z.so librawfile.z.so) ``` - - -2. 使用OH_ResourceManager_InitNativeResourceManager(napi_env env, napi_value jsResMgr)接口获取NativeResourceManager实例。 +2. 打开src/main/cpp/types/libentry/index.d.ts文件,此文件声明了应用侧函数getFileList、getRawFileContent、getRawFileDescriptor。 - ```js - // js侧传递js resource manager。 - import resManager from '@ohos.resourceManager' - import rawfileTest from 'librawFileTest.so' - resManager.getResourceManager().then(resmgr => { - rawfileTest.testRawFile("test", resmgr, (error, value) => { - console.log("test rawFile"); - }) - }); - ``` - - ```c++ - // C++侧获取解析js侧传递的参数。 - NativeResourceManager* nativeResourceManager = nullptr; - std::string path; - if (i == 0 && valueType == napi_string) { - // 解析第一个参数,参数为相对rawfile目录的文件/目录路径。 - ...... - path = buf.data(); - } else if (i == 1 && valueType == napi_object) { - // 解析第二个参数,参数为js resource manager。 - nativeResourceManager = OH_ResourceManager_InitNativeResourceManager(env, argv[i]); + ```c++ + import resourceManager from '@ohos.resourceManager'; + export const getFileList: (resmgr: resourceManager.ResourceManager, path: string) => Array; + export const getRawFileContent: (resmgr: resourceManager.ResourceManager, path: string) => Uint8Array; + export const getRawFileDescriptor: (resmgr: resourceManager.ResourceManager, path: string) => resourceManager.RawFileDescriptor; + ``` + +**3. 修改源文件** + +1. 打开src/main/cpp/hello.cpp文件,文件Init会对当前方法进行初始化映射,这里定义对外接口为getFileList、getRawFileContent、getRawFileDescriptor,映射C++接口分别为GetFileList、GetRawFileContent、GetRawFileDescriptor。 + + ```c++ + EXTERN_C_START + static napi_value Init(napi_env env, napi_value exports) + { + napi_property_descriptor desc[] = { + { "getFileList", nullptr, GetFileList, nullptr, nullptr, nullptr, napi_default, nullptr }, + { "getRawFileContent", nullptr, GetRawFileContent, nullptr, nullptr, nullptr, napi_default, nullptr }, + { "getRawFileDescriptor", nullptr, GetRawFileDescriptor, nullptr, nullptr, nullptr, napi_default, nullptr } + }; + + napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc); + return exports; } + EXTERN_C_END ``` +2. 把src/main/cpp/hello.cpp文件中,增加对应的三个方法,如下所示 + + ```c++ + static napi_value GetFileList(napi_env env, napi_callback_info info) + static napi_value GetRawFileContent(napi_env env, napi_callback_info info) + static napi_value GetRawFileDescriptor(napi_env env, napi_callback_info info) + ``` + +3. 在hello.cpp文件中获取Js的资源对象,并转为Native的资源对象,即可调用资源的Native接口,获取rawfile列表、rawfile文件内容以及rawfile描述符{fd, offset, length}三种调用方式示例代码如下: + + ```c++ + // 示例一:获取rawfile文件列表 GetFileList + static napi_value GetFileList(napi_env env, napi_callback_info info) + { + OH_LOG_Print(LOG_APP, LOG_ERROR, GLOBAL_RESMGR, tag, "NDKTest Begin"); + size_t requireArgc = 3; + size_t argc = 2; + napi_value argv[2] = { nullptr }; + // 获取参数信息 + napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr); + + // argv[0]即为函数第一个参数Js资源对象,OH_ResourceManager_InitNativeResourceManager转为Native对象。 + NativeResourceManager *mNativeResMgr = OH_ResourceManager_InitNativeResourceManager(env, argv[0]); + + // 获取函数argv[1],此为为rawfile相对路径 + size_t strSize; + char strBuf[256]; + napi_get_value_string_utf8(env, argv[1], strBuf, sizeof(strBuf), &strSize); + std::string dirName(strBuf, strSize); + + // 获取对应的rawDir指针对象 + RawDir* rawDir = OH_ResourceManager_OpenRawDir(mNativeResMgr, dirName.c_str()); + + // 获取rawDir下文件及文件夹数量 + int count = OH_ResourceManager_GetRawFileCount(rawDir); + + // 遍历获取文件名称,并保存 + std::vector tempArray; + for(int i = 0; i < count; i++) { + std::string filename = OH_ResourceManager_GetRawFileName(rawDir, i); + tempArray.emplace_back(filename); + } + + napi_value fileList; + napi_create_array(env, &fileList); + for (size_t i = 0; i < tempArray.size(); i++) { + napi_value jsString; + napi_create_string_utf8(env, tempArray[i].c_str(), NAPI_AUTO_LENGTH, &jsString); + napi_set_element(env, fileList, i, jsString); + } + + // 关闭打开的指针对象 + OH_ResourceManager_CloseRawDir(rawDir); + OH_ResourceManager_ReleaseNativeResourceManager(mNativeResMgr); + return fileList; + } + + // 示例二:获取rawfile文件内容 GetRawFileContent + napi_value CreateJsArrayValue(napi_env env, std::unique_ptr &data, long length) + { + napi_value buffer; + napi_status status = napi_create_external_arraybuffer(env, data.get(), length, + [](napi_env env, void *data, void *hint) { + delete[] static_cast(data); + }, nullptr, &buffer); + if (status != napi_ok) { + OH_LOG_Print(LOG_APP, LOG_ERROR, GLOBAL_RESMGR, tag, "Failed to create external array buffer"); + return nullptr; + } + napi_value result = nullptr; + status = napi_create_typedarray(env, napi_uint8_array, length, buffer, 0, &result); + if (status != napi_ok) { + OH_LOG_Print(LOG_APP, LOG_ERROR, GLOBAL_RESMGR, tag, "Failed to create media typed array"); + return nullptr; + } + data.release(); + return result; + } + static napi_value GetRawFileContent(napi_env env, napi_callback_info info) + { + OH_LOG_Print(LOG_APP, LOG_ERROR, GLOBAL_RESMGR, tag, "GetFileContent Begin"); + size_t requireArgc = 3; + size_t argc = 2; + napi_value argv[2] = { nullptr }; + // 获取参数信息 + napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr); + + // argv[0]即为函数第一个参数Js资源对象,OH_ResourceManager_InitNativeResourceManager转为Native对象。 + NativeResourceManager *mNativeResMgr = OH_ResourceManager_InitNativeResourceManager(env, argv[0]); + size_t strSize; + char strBuf[256]; + napi_get_value_string_utf8(env, argv[1], strBuf, sizeof(strBuf), &strSize); + std::string filename(strBuf, strSize); + + // 获取rawfile指针对象 + RawFile *rawFile = OH_ResourceManager_OpenRawFile(mNativeResMgr, filename.c_str()); + if (rawFile != nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, GLOBAL_RESMGR, tag, "OH_ResourceManager_OpenRawFile success"); + } + // 获取rawfile大小并申请内存 + long len = OH_ResourceManager_GetRawFileSize(rawFile); + std::unique_ptr data= std::make_unique(len); + // 读取rawfile + int res = OH_ResourceManager_ReadRawFile(rawFile, data.get(), len); + // 关闭打开的指针对象 + OH_ResourceManager_CloseRawFile(rawFile); + OH_ResourceManager_ReleaseNativeResourceManager(mNativeResMgr); + // 转为js对象 + return CreateJsArrayValue(env, data, len); + } + + // 示例三:获取rawfile文件描述符 GetRawFileDescriptor + napi_value createJsFileDescriptor(napi_env env, RawFileDescriptor &descriptor) + { + napi_value result; + napi_status status = napi_create_object(env, &result); + if (status != napi_ok) { + return result; + } + + napi_value fd; + status = napi_create_int32(env, descriptor.fd, &fd); + if (status != napi_ok) { + return result; + } + status = napi_set_named_property(env, result, "fd", fd); + if (status != napi_ok) { + return result; + } + + napi_value offset; + status = napi_create_int64(env, descriptor.start, &offset); + if (status != napi_ok) { + return result; + } + status = napi_set_named_property(env, result, "offset", offset); + if (status != napi_ok) { + return result; + } + + napi_value length; + status = napi_create_int64(env, descriptor.length, &length); + if (status != napi_ok) { + return result; + } + status = napi_set_named_property(env, result, "length", length); + if (status != napi_ok) { + return result; + } + return result; + } + static napi_value GetRawFileDescriptor(napi_env env, napi_callback_info info) + { + OH_LOG_Print(LOG_APP, LOG_ERROR, GLOBAL_RESMGR, tag, "NDKTest GetRawFileDescriptor Begin"); + size_t requireArgc = 3; + size_t argc = 2; + napi_value argv[2] = { nullptr }; + // 获取参数信息 + napi_get_cb_info(env, info, &argc, argv, nullptr, nullptr); + + napi_valuetype valueType; + napi_typeof(env, argv[0], &valueType); + // 获取native的resourceManager对象 + NativeResourceManager *mNativeResMgr = OH_ResourceManager_InitNativeResourceManager(env, argv[0]); + size_t strSize; + char strBuf[256]; + napi_get_value_string_utf8(env, argv[1], strBuf, sizeof(strBuf), &strSize); + std::string filename(strBuf, strSize); + // 获取rawfile指针对象 + RawFile *rawFile = OH_ResourceManager_OpenRawFile(mNativeResMgr, filename.c_str()); + if (rawFile != nullptr) { + OH_LOG_Print(LOG_APP, LOG_ERROR, GLOBAL_RESMGR, tag, "OH_ResourceManager_OpenRawFile success"); + } + // 获取rawfile的描述符RawFileDescriptor {fd, offset, length} + RawFileDescriptor descriptor; + OH_ResourceManager_GetRawFileDescriptor(rawFile, descriptor); + // 关闭打开的指针对象 + OH_ResourceManager_CloseRawFile(rawFile); + OH_ResourceManager_ReleaseNativeResourceManager(mNativeResMgr); + // 转为js对象 + return createJsFileDescriptor(env,descriptor); + } + ``` + +**4. Js侧调用** + +1. 打开src\main\ets\pages\index.ets, 导入"libentry.so"; + +2. 获取当前js的resourceManager对象; +3. 调用Native接口getFileList即为src/main/cpp/types/libentry/index.d.ts中声明的接口,传入js的资源对象,以及rawfile文件夹的相对路径。示例如下: + + ```js + import hilog from '@ohos.hilog'; + import testNapi from 'libentry.so' // 导入so + @Entry + @Component + struct Index { + @State message: string = 'Hello World' + private resmgr = getContext().resourceManager; // 获取js的资源对象 + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + .onClick(() => { + hilog.isLoggable(0x0000, 'testTag', hilog.LogLevel.INFO); + let rawfilelist = testNapi.getFileList(this.resmgr, ""); //传入资源对象,以及访问的rawfile文件夹名称 + console.log("rawfilelist" + rawfilelist); + let rawfileContet = testNapi.getRawFileContent(this.resmgr, "rawfile1.txt"); + console.log("rawfileContet" + rawfileContet); + let rawfileDescriptor = testNapi.getRawFileDescriptor(this.resmgr, "rawfile1.txt"); + console.log("getRawFileDescriptor" + rawfileDescriptor.fd, rawfileDescriptor.offset, rawfileDescriptor.length); + }) + } + .width('100%') + } + .height('100%') + } + } + ``` + +## 函数介绍 -3. 根据NativeResourceManager实例,使用OH_ResourceManager_OpenRawDir接口获取RawDir实例。 +1. 根据NativeResourceManager实例,使用OH_ResourceManager_OpenRawDir接口获取RawDir实例。 ```c++ RawDir* rawDir = OH_ResourceManager_OpenRawDir(nativeResourceManager, path.c_str()); ``` - - -4. 根据RawDir实例,使用OH_ResourceManager_GetRawFileCount接口获取对应目录下的rawfile文件总数 。 +2. 根据RawDir实例,使用OH_ResourceManager_GetRawFileCount接口获取对应目录下的rawfile文件总数 。 ```c++ int count = OH_ResourceManager_GetRawFileCount(rawDir); ``` - - -5. 根据RawDir实例,使用OH_ResourceManager_GetRawFileName接口获取目录下对应index的rawfile文件名。 +3. 根据RawDir实例,使用OH_ResourceManager_GetRawFileName接口获取目录下对应index的rawfile文件名。 ```c++ for (int index = 0; index < count; index++) { @@ -88,85 +315,65 @@ } ``` - - -6. 根据NativeResourceManager实例,使用OH_ResourceManager_OpenRawFile接口获取指定文件名的RawFile实例 +4. 根据NativeResourceManager实例,使用OH_ResourceManager_OpenRawFile接口获取指定文件名的RawFile实例 ```c++ RawFile* rawFile = OH_ResourceManager_OpenRawFile(nativeResourceManager, fileName.c_str()); ``` - - -7. 根据RawFile实例,使用OH_ResourceManager_GetRawFileSize接口获取对应rawfile文件大小。 +5. 根据RawFile实例,使用OH_ResourceManager_GetRawFileSize接口获取对应rawfile文件大小。 ```c++ long rawFileSize = OH_ResourceManager_GetRawFileSize(rawFile); ``` - - -8. 根据RawFile实例,使用OH_ResourceManager_SeekRawFile接口指定rawfile偏移量。 +6. 根据RawFile实例,使用OH_ResourceManager_SeekRawFile接口指定rawfile偏移量。 ```c++ int position = OH_ResourceManager_SeekRawFile(rawFile, 10, 0); int position = OH_ResourceManager_SeekRawFile(rawFile, 0 , 1); int position = OH_ResourceManager_SeekRawFile(rawFile, -10, 2); ``` - - -9. 根据RawFile实例,使用OH_ResourceManager_GetRawFileOffset接口获取rawfile偏移量。 +7. 根据RawFile实例,使用OH_ResourceManager_GetRawFileOffset接口获取rawfile偏移量。 ```c++ long rawFileOffset = OH_ResourceManager_GetRawFileOffset(rawFile) ``` - - -10. 根据RawFile实例,使用OH_ResourceManager_ReadRawFile接口读取rawfile文件内容。 +8. 根据RawFile实例,使用OH_ResourceManager_ReadRawFile接口读取rawfile文件内容。 ```c++ std::unique_ptr mediaData = std::make_unique(rawFileSize); long rawFileOffset = OH_ResourceManager_ReadRawFile(rawFile, mediaData.get(), rawFileSize); ``` - - -11. 根据RawFile实例,使用OH_ResourceManager_CloseRawFile接口释放rawfile文件相关资源。 +9. 根据RawFile实例,使用OH_ResourceManager_CloseRawFile接口释放rawfile文件相关资源。 ```c++ OH_ResourceManager_CloseRawFile(rawFile); ``` - - -12. 根据RawDir实例,使用OH_ResourceManager_CloseRawDir接口释放rawfile目录相关资源。 +10. 根据RawDir实例,使用OH_ResourceManager_CloseRawDir接口释放rawfile目录相关资源。 ```c++ OH_ResourceManager_CloseRawDir(rawDir); ``` - - -13. 根据RawFile实例,使用OH_ResourceManager_GetRawFileDescriptor接口获取rawfile的RawFileDescriptor。 +11. 根据RawFile实例,使用OH_ResourceManager_GetRawFileDescriptor接口获取rawfile的RawFileDescriptor。 ```c++ RawFileDescriptor descriptor; bool result = OH_ResourceManager_GetRawFileDescriptor(rawFile, descriptor); ``` - - -14. 根据RawFileDescriptor实例,使用OH_ResourceManager_ReleaseRawFileDescriptor接口关闭rawfile的fd。 +12. 根据RawFileDescriptor实例,使用OH_ResourceManager_ReleaseRawFileDescriptor接口关闭rawfile的fd。 ```c++ OH_ResourceManager_ReleaseRawFileDescriptor(descriptor); ``` - - -15. 根据NativeResourceManager实例,使用OH_ResourceManager_ReleaseNativeResourceManager接口释放native resource manager。 +13. 根据NativeResourceManager实例,使用OH_ResourceManager_ReleaseNativeResourceManager接口释放native resource manager。 ```c++ OH_ResourceManager_ReleaseNativeResourceManager(nativeResourceManager); diff --git a/zh-cn/application-dev/notification/Readme-CN.md b/zh-cn/application-dev/notification/Readme-CN.md index de9886a92c2e2a461db1386836f54ac2d55d9a2e..37198818a00d30ab34dbe5c475a2ab7f1bf9495b 100644 --- a/zh-cn/application-dev/notification/Readme-CN.md +++ b/zh-cn/application-dev/notification/Readme-CN.md @@ -3,6 +3,7 @@ - [通知概述](notification-overview.md) - [订阅通知(仅对系统应用开放)](notification-subscription.md) - [使能通知开关](notification-enable.md) +- [通知角标](notification-badge.md) - 发布通知 - [发布基础类型通知](text-notification.md) - [发布进度条类型通知](progress-bar-notification.md) diff --git a/zh-cn/application-dev/notification/notification-badge.md b/zh-cn/application-dev/notification/notification-badge.md new file mode 100644 index 0000000000000000000000000000000000000000..719dd9b5c1481481b8f3a9819470eb25723b0e05 --- /dev/null +++ b/zh-cn/application-dev/notification/notification-badge.md @@ -0,0 +1,70 @@ +# 通知角标 + +应用未读的通知,OpenHarmony提供了角标设置接口,将未读通知个数显示在桌面图标的右上角角标上。 + +通知增加时,角标上显示的未读通知个数需要增加。 + +通知被查看后,角标上显示的未读通知个数需要减少,没有未读通知时,不显示角标。 + + +## 接口说明 + +1. 通知服务提供了两种增加角标数的方法: + + - 发布通知时,在[NotificationRequest](../reference/apis/js-apis-notificationManager.md#notificationrequest)的badgeNumber字段里携带,桌面收到通知后,在原角标数上累加、呈现。 + + - 调用接口[setBadgeNumber](../reference/apis/js-apis-notificationManager.md#setbadgenumber)设置,桌面按设置的角标数呈现。 + +2. 角标数减少,目前仅支持通过[setBadgeNumber](../reference/apis/js-apis-notificationManager.md#setbadgenumber)设置。 + +| **接口名** | **描述** | +| -------- | -------- | +| setBadgeNumber(badgeNumber: number, callback: AsyncCallback\): void | 设置角标个数 | + + +## 开发步骤 + +1. 导入NotificationManager模块。 + + ```ts + import notificationManager from '@ohos.notificationManager'; + ``` + +2. 增加角标个数。 + + 发布通知在[NotificationRequest](../reference/apis/js-apis-notificationManager.md#notificationrequest)的badgeNumber字段里携带,可参考[通知发布](text-notification.md)章节。 + + 示例为调用setBadgeNumber接口增加角标,在发布完新的通知后,调用该接口。 + + ```ts + function setBadgeNumberCallback(err) { + if (err) { + console.info(`Set badge failed code is ${err.code}, message is ${err.message}`); + } else { + console.info(`Set badge success`); + } + } + + let badgeNumber = 10 + notificationManager.setBadgeNumber(badgeNumber, setBadgeNumberCallback); + ``` + +3. 减少角标个数 + + 一条通知被查看后,应用需要调用接口设置剩下未读通知个数,桌面刷新角标。 + + ```ts + function setBadgeNumberCallback(err) { + if (err) { + console.info(`Set badge failed code is ${err.code}, message is ${err.message}`); + } else { + console.info(`Set badge success`); + } + } + + let badgeNumber = 9 + notificationManager.setBadgeNumber(badgeNumber, setBadgeNumberCallback); + ``` + + + diff --git a/zh-cn/application-dev/notification/notification-overview.md b/zh-cn/application-dev/notification/notification-overview.md index 50525376aabb0a39bae6b303bd3fb29c7a84c3bf..18cfacc8a97bc17ab063a9046c5196a31faa2e19 100644 --- a/zh-cn/application-dev/notification/notification-overview.md +++ b/zh-cn/application-dev/notification/notification-overview.md @@ -30,6 +30,4 @@ OpenHarmony通过ANS(Advanced Notification Service,通知系统服务)对 基于通知的开发,有以下相关实例可供参考: -- [`CustomNotification`:自定义通知(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/Notification/CustomNotification) - -- [`Notification`:订阅、发送通知(ArkTS)(API9)(Full SDK)](https://gitee.com/openharmony/applications_app_samples/tree/master/Notification/Notification) \ No newline at end of file +- [`CustomNotification`:自定义通知(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Notification/CustomNotification) \ No newline at end of file diff --git a/zh-cn/application-dev/notification/notification-with-wantagent.md b/zh-cn/application-dev/notification/notification-with-wantagent.md index 83208e2f85841040a5f5c0008e1d766f900d8fff..d3ea33340bf8af7a738c2655abd892d1a67b6357 100644 --- a/zh-cn/application-dev/notification/notification-with-wantagent.md +++ b/zh-cn/application-dev/notification/notification-with-wantagent.md @@ -12,9 +12,8 @@ 具体接口描述,详见[WantAgent接口文档](../reference/apis/js-apis-app-ability-wantAgent.md)。 -| | | -| -------- | -------- | | **接口名** | **描述** | +| -------- | -------- | | getWantAgent(info: WantAgentInfo, callback: AsyncCallback<WantAgent>): void | 创建WantAgent。 | | trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: Callback<CompleteData>): void | 触发WantAgent意图。 | | cancel(agent: WantAgent, callback: AsyncCallback<void>): void | 取消WantAgent。 | diff --git a/zh-cn/application-dev/notification/progress-bar-notification.md b/zh-cn/application-dev/notification/progress-bar-notification.md index f8ea20e12108e82bf8d6a6f764ba264cea7add14..69da9774cda1cd37d28e08fd99e4870011a07147 100644 --- a/zh-cn/application-dev/notification/progress-bar-notification.md +++ b/zh-cn/application-dev/notification/progress-bar-notification.md @@ -3,7 +3,7 @@ 进度条通知也是常见的通知类型,主要应用于文件下载、事务处理进度显示。OpenHarmony提供了进度条模板,发布通知应用设置好进度条模板的属性值,如模板名、模板数据,通过通知子系统发送到通知栏显示。 -目前系统模板仅支持进度条模板,通知模板[NotificationTemplate](../reference/apis/js-apis-notificationManager.md#notificationtemplate)中的data参数为用户自定义数据,用于显示与模块相关的数据,效果示意如下图所示。 +目前系统模板仅支持进度条模板,通知模板[NotificationTemplate](../reference/apis/js-apis-inner-notification-notificationTemplate.md)中的data参数为用户自定义数据,用于显示与模块相关的数据,效果示意如下图所示。 ![zh-cn_image_0000001416903138](figures/zh-cn_image_0000001416903138.png) diff --git a/zh-cn/application-dev/quick-start/Readme-CN.md b/zh-cn/application-dev/quick-start/Readme-CN.md index 82996bf0813c9e9d640bec4dd9fa5fbb2fe81510..732bae3bac983e5d44d8f20301249e8a9b20814d 100755 --- a/zh-cn/application-dev/quick-start/Readme-CN.md +++ b/zh-cn/application-dev/quick-start/Readme-CN.md @@ -4,14 +4,13 @@ - [开发准备](start-overview.md) - [使用ArkTS语言开发(Stage模型)](start-with-ets-stage.md) - [使用ArkTS语言开发(FA模型)](start-with-ets-fa.md) - - [使用JS语言开发(FA模型)](start-with-js-fa.md) + - [使用JS语言开发(FA模型)](start-with-js-fa.md) - 开发基础知识 - 应用程序包基础知识 - [应用程序包概述](application-package-overview.md) - 应用程序包结构 - [Stage模型应用程序包结构](application-package-structure-stage.md) - [FA模型应用程序包结构](application-package-structure-fa.md) - - [HAR包结构](har-structure.md) - 应用程序包多HAP机制 - [多HAP机制设计目标](multi-hap-objective.md) - [多HAP构建视图](multi-hap-build-view.md) @@ -20,6 +19,15 @@ - [多HAP运行机制及数据通信方式](multi-hap-principles.md) - [应用程序包安装和卸载流程](application-package-install-uninstall.md) - [应用程序包更新流程](application-package-update.md) + - 共享包 + - [共享包概述](shared-guide.md) + - [HAR](har-package.md) + - HSP + - [应用内HSP开发指导](in-app-hsp.md) + - [应用间HSP开发指导(仅对系统应用开放)](cross-app-hsp.md) + - 原子化服务 + - [原子化服务开发指导](atomicService.md) + - [原子化服务空间管理(仅对系统应用开放)](atomicService-aging.md) - 应用程序包快速修复 - [快速修复概述](quickfix-principles.md) - [快速修复调试指导](quickfix-debug.md) @@ -35,12 +43,37 @@ - [资源分类与访问](resource-categories-and-access.md) - 学习ArkTS语言 - [初识ArkTS语言](arkts-get-started.md) - - ArkTS语法(声明式UI) - - [基本UI描述](arkts-basic-ui-description.md) - - 状态管理 - - [基本概念](arkts-state-mgmt-concepts.md) - - [页面级变量的状态管理](arkts-state-mgmt-page-level.md) - - [应用级变量的状态管理](arkts-state-mgmt-application-level.md) - - [动态构建UI元素](arkts-dynamic-ui-elememt-building.md) - - [渲染控制](arkts-rendering-control.md) - - [使用限制与扩展](arkts-restrictions-and-extensions.md) \ No newline at end of file + - 基本语法 + - [基本语法概述](arkts-basic-syntax-overview.md) + - [声明式UI描述](arkts-declarative-ui-description.md) + - 自定义组件 + - [创建自定义组件](arkts-create-custom-components.md) + - [页面和自定义组件生命周期](arkts-page-custom-components-lifecycle.md) + - [\@Builder:自定义构建函数](arkts-builder.md) + - [\@BuilderParam:引用\@Builder函数](arkts-builderparam.md) + - [\@Styles:定义组件重用样式](arkts-style.md) + - [\@Extend:定义扩展组件样式](arkts-extend.md) + - [stateStyles:多态样式](arkts-statestyles.md) + - 状态管理 + - [状态管理概述](arkts-state-management-overview.md) + - 管理组件拥有的状态 + - [\@State:组件内状态](arkts-state.md) + - [\@Prop:父子单向同步](arkts-prop.md) + - [\@Link:父子双向同步](arkts-link.md) + - [\@Provide和\@Consume:与后代组件双向同步](arkts-provide-and-consume.md) + - [\@Observed和\@ObjectLink:嵌套类对象属性变化](arkts-observed-and-objectlink.md) + - 管理应用拥有的状态 + - [管理应用拥有的状态概述](arkts-application-state-management-overview.md) + - [LocalStorage:页面级UI状态存储](arkts-localstorage.md) + - [AppStorage:应用全局的UI状态存储](arkts-appstorage.md) + - [PersistentStorage:持久化存储UI状态](arkts-persiststorage.md) + - [Environment:设备环境查询](arkts-environment.md) + - 其他状态管理 + - [其他状态管理概述](arkts-other-state-mgmt-functions-overview.md) + - [\@Watch:状态变量更改通知](arkts-watch.md) + - [$$语法:内置组件双向同步](arkts-two-way-sync.md) + - 渲染控制 + - [渲染控制概述](arkts-rendering-control-overview.md) + - [if/else:条件渲染](arkts-rendering-control-ifelse.md) + - [ForEach:循环渲染](arkts-rendering-control-foreach.md) + - [LazyForEach:数据懒加载](arkts-rendering-control-lazyforeach.md) diff --git a/zh-cn/application-dev/quick-start/app-configuration-file.md b/zh-cn/application-dev/quick-start/app-configuration-file.md index a890fd96269336f5bd3e8b52fa3c1f2e9640bf14..2a78461749b894ed3469a180541bc59cae94df00 100644 --- a/zh-cn/application-dev/quick-start/app-configuration-file.md +++ b/zh-cn/application-dev/quick-start/app-configuration-file.md @@ -19,7 +19,9 @@ "debug": false, "car": { "minAPIVersion": 8, - } + }, + "targetBundleName": "com.application.test", + "targetPriority": 50 }, } ``` @@ -33,6 +35,7 @@ app.json5配置文件包含以下标签。 | 属性名称 | 含义 | 数据类型 | 是否可缺省 | | -------- | -------- | -------- | -------- | | bundleName | 标识应用的Bundle名称,用于标识应用的唯一性。该标签不可缺省。标签的值命名规则 :
- 字符串以字母、数字、下划线和符号“.”组成。
- 以字母开头。
- 最小长度7个字节,最大长度127个字节。
推荐采用反域名形式命名(如com.example.demo,建议第一级为域名后缀com,第二级为厂商/个人名,第三级为应用名,也可以多级)。
其中,随系统源码编译的应用建议命名为“com.ohos.demo”形式, ohos标识OpenHarmony系统应用。 | 字符串 | 该标签不可缺省。 | +| bundleType| 标识应用的Bundle类型,用于区分应用或者原子化服务。该标签可选值为app和atomicService :
- app:当前Bundle为普通应用。
- atomicService:当前Bundle为原子化服务。
- shared:当前Bundle为共享库应用。 | 字符串| 该标签可以缺省,缺省为app。 | | debug | 标识应用是否可调试,该标签由IDE编译构建时生成。
- true:可调试。
- false:不可调式。 | 布尔值 | 该标签可以缺省,缺省为false。 | | icon | 标识[应用的图标](../application-models/application-component-configuration-stage.md),标签值为图标资源文件的索引。 | 字符串 | 该标签不可缺省。 | | label | 标识[应用的名称](../application-models/application-component-configuration-stage.md),标签值为字符串资源的索引。 | 字符串 | 该标签不可缺省。 | @@ -46,8 +49,10 @@ app.json5配置文件包含以下标签。 | apiReleaseType | 标识应用运行需要的API目标版本的类型,采用字符串类型表示。取值为“CanaryN”、“BetaN”或者“Release”,其中,N代表大于零的整数。
- Canary:受限发布的版本。
- Beta:公开发布的Beta版本。
- Release:公开发布的正式版本。
该字段由DevEco Studio读取当前使用的SDK的Stage来生成。 | 字符串 | 该标签可缺省,由IDE生成并覆盖。 | | multiProjects | 标识当前工程是否支持多个工程的联合开发。
- true:当前工程支持多个工程的联合开发。
- false:当前工程不支持多个工程的联合开发。多工程开发可以参考文档:[多工程构建](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/ohos-building-overview-0000001263360495-V3#section71471033104216) | 布尔值 | 可缺省,缺省值为false。 | | assanEnabled | 标识应用程序是否开启asan检测,用于辅助定位buffer越界造成的crash问题。
- true:当前工程开启asan检测。
- false:当前工程不开启asan检测。Release版本不支持开启asan检测。 | 布尔值 | 可缺省,缺省值为false。 | -| tablet | 标识对tablet设备做的特殊配置,可以配置的属性字段有上文提到的:minAPIVersion、distributedNotificationEnabled。
如果使用该属性对tablet设备做了特殊配置,则应用在tablet设备中会采用此处配置的属性值,并忽略在app.json5公共区域配置的属性值。 | 对象 | 该标签可缺省,缺省时tablet设备使用app.json5公共区域配置的属性值。 | -| tv | 标识对tv设备做的特殊配置,可以配置的属性字段有上文提到的:minAPIVersion、distributedNotificationEnabled。
如果使用该属性对tv设备做了特殊配置,则应用在tv设备中会采用此处配置的属性值,并忽略在app.json5公共区域配置的属性值。 | 对象 | 该标签可缺省,缺省时tv设备使用app.json5公共区域配置的属性值。 | -| wearable | 标识对wearable设备做的特殊配置,可以配置的属性字段有上文提到的:minAPIVersion、distributedNotificationEnabled。
如果使用该属性对wearable设备做了特殊配置,则应用在wearable设备中会采用此处配置的属性值,并忽略在app.json5公共区域配置的属性值。 | 对象 | 该标签可缺省,缺省时wearable设备使用app.json5公共区域配置的属性值。 | -| car | 标识对car设备做的特殊配置,可以配置的属性字段有上文提到的:minAPIVersion、distributedNotificationEnabled。
如果使用该属性对car设备做了特殊配置,则应用在car设备中会采用此处配置的属性值,并忽略在app.json5公共区域配置的属性值。 | 对象 | 该标签可缺省,缺省时car设备使用app.json5公共区域配置的属性值。 | -| default | 标识对default设备做的特殊配置,可以配置的属性字段有上文提到的:minAPIVersion、distributedNotificationEnabled。
如果使用该属性对default设备做了特殊配置,则应用在default设备中会采用此处配置的属性值,并忽略在app.json5公共区域配置的属性值。 | 对象 | 该标签可缺省,缺省时default设备使用app.json5公共区域配置的属性值。 | +| tablet | 标识对tablet设备做的特殊配置,可以配置的属性字段有上文提到的:minAPIVersion。
如果使用该属性对tablet设备做了特殊配置,则应用在tablet设备中会采用此处配置的属性值,并忽略在app.json5公共区域配置的属性值。 | 对象 | 该标签可缺省,缺省时tablet设备使用app.json5公共区域配置的属性值。 | +| tv | 标识对tv设备做的特殊配置,可以配置的属性字段有上文提到的:minAPIVersion。
如果使用该属性对tv设备做了特殊配置,则应用在tv设备中会采用此处配置的属性值,并忽略在app.json5公共区域配置的属性值。 | 对象 | 该标签可缺省,缺省时tv设备使用app.json5公共区域配置的属性值。 | +| wearable | 标识对wearable设备做的特殊配置,可以配置的属性字段有上文提到的:minAPIVersion。
如果使用该属性对wearable设备做了特殊配置,则应用在wearable设备中会采用此处配置的属性值,并忽略在app.json5公共区域配置的属性值。 | 对象 | 该标签可缺省,缺省时wearable设备使用app.json5公共区域配置的属性值。 | +| car | 标识对car设备做的特殊配置,可以配置的属性字段有上文提到的:minAPIVersion。
如果使用该属性对car设备做了特殊配置,则应用在car设备中会采用此处配置的属性值,并忽略在app.json5公共区域配置的属性值。 | 对象 | 该标签可缺省,缺省时car设备使用app.json5公共区域配置的属性值。 | +| default | 标识对default设备做的特殊配置,可以配置的属性字段有上文提到的:minAPIVersion。
如果使用该属性对default设备做了特殊配置,则应用在default设备中会采用此处配置的属性值,并忽略在app.json5公共区域配置的属性值。 | 对象 | 该标签可缺省,缺省时default设备使用app.json5公共区域配置的属性值。 | +|targetBundleName|标识当前包所指定的目标应用, 标签值的取值规则和范围与bundleName标签一致。|字符串|该标签可缺省,缺省时当前包为非overlay特性的应用。| +|targetPriority|标识当前应用的优先级, 当targetBundleName字段配置之后,当前应用为overlay特征的应用, 该标签的额取值范围为1~100|数值|该标签可缺省, 缺省值为1。| diff --git a/zh-cn/application-dev/quick-start/application-package-structure-fa.md b/zh-cn/application-dev/quick-start/application-package-structure-fa.md index 3e75f3b114fc2865f54ebbcc70bd0f6e9d39ced6..a8fb2e327d19ad114f265994a07716ceb1d6ad72 100644 --- a/zh-cn/application-dev/quick-start/application-package-structure-fa.md +++ b/zh-cn/application-dev/quick-start/application-package-structure-fa.md @@ -11,7 +11,7 @@ FA模型与Stage模型不同之处在于HAP内部文件存放位置不同,FA - assets是HAP所有的资源文件、库文件和代码文件的集合,内部可以分为entry和js文件夹。entry文件夹中存放的是resources目录和resources.index文件。 -- resources目录用于存放应用的资源文件(字符串、图片等),便于开发者使用和维护,详见[资源文件的使用](../key-features/multi-device-app-dev/resource-usage.md)。 +- resources目录用于存放应用的资源文件(字符串、图片等),便于开发者使用和维护,详见[资源文件的使用](resource-categories-and-access.md)。 - resources.index是资源索引表,由IDE调用SDK工具生成。 diff --git a/zh-cn/application-dev/quick-start/application-package-structure-stage.md b/zh-cn/application-dev/quick-start/application-package-structure-stage.md index b484f0ab579c178fd2e1dd0a62452ee54c0e2157..485f83c1a731e7b0697a1d2e1fe6358492eb2f02 100644 --- a/zh-cn/application-dev/quick-start/application-package-structure-stage.md +++ b/zh-cn/application-dev/quick-start/application-package-structure-stage.md @@ -4,7 +4,7 @@ 基于[Stage模型](application-configuration-file-overview-stage.md)开发的应用,经编译打包后,其应用程序包结构如下图**应用程序包结构(Stage模型)**所示。开发者需要熟悉应用程序包结构相关的基本概念。 -- 在开发态,一个应用包含一个或者多个Module,可以在[DevEco Studio](https://developer.harmonyos.com/cn/develop/deveco-studio/)工程中[创建一个或者多个Module](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/ohos-adding-deleting-module-0000001218760594-V3)。Module是OpenHarmony应用/服务的基本功能单元,包含了源代码、资源文件、第三方库及应用/服务配置文件,每一个Module都可以独立进行编译和运行。Module分为“Ability”和“Library”两种类型,“Ability”类型的Module对应于编译后的HAP(Harmony Ability Package);“Library”类型的Module对应于[HAR](har-structure.md)(Harmony Ability Resources)包,即编译后的.tgz文件。 +- 在开发态,一个应用包含一个或者多个Module,可以在[DevEco Studio](https://developer.harmonyos.com/cn/develop/deveco-studio/)工程中[创建一个或者多个Module](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/ohos-adding-deleting-module-0000001218760594-V3)。Module是OpenHarmony应用/服务的基本功能单元,包含了源代码、资源文件、第三方库及应用/服务配置文件,每一个Module都可以独立进行编译和运行。Module分为“Ability”和“Library”两种类型,“Ability”类型的Module对应于编译后的HAP(Harmony Ability Package);“Library”类型的Module对应于[HAR](har-package.md)(Harmony Archive),或者[HSP](shared-guide.md)(Harmony Shared Package)。 一个Module可以包含一个或多个[UIAbility](../application-models/uiability-overview.md)组件,如**Module与UIAbility组件关系示意图**所示。 **图1** Module与UIAbility组件关系示意图 @@ -21,7 +21,7 @@ - 打包后的HAP结构包括ets、libs、resources等文件夹和resources.index、module.json、pack.info等文件。 - ets目录用于存放应用代码编译后的字节码文件。 - libs目录用于存放库文件。库文件是OpenHarmony应用依赖的第三方代码(.so二进制文件)。 - - resources目录用于存放应用的资源文件(字符串、图片等),便于开发者使用和维护,详见[资源文件的使用](../key-features/multi-device-app-dev/resource-usage.md)。 + - resources目录用于存放应用的资源文件(字符串、图片等),便于开发者使用和维护,详见[资源文件的使用](resource-categories-and-access.md)。 - resources.index是资源索引表,由IDE编译工程时生成。 - module.json是HAP的配置文件,内容由工程配置中的module.json5和app.json5组成,该文件是HAP中必不可少的文件。IDE会自动生成一部分默认配置,开发者按需修改其中的配置。详细字段请参见[应用配置文件](application-configuration-file-overview-stage.md)。 - pack.info是Bundle中用于描述每个HAP属性的文件,例如app中的bundleName和versionCode信息、module中的name、type和abilities等信息,由IDE工具生成Bundle包时自动生成。 diff --git a/zh-cn/application-dev/quick-start/arkts-application-state-management-overview.md b/zh-cn/application-dev/quick-start/arkts-application-state-management-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..f3bb0e45598c3aa59ae20b521eec25ba5cff8375 --- /dev/null +++ b/zh-cn/application-dev/quick-start/arkts-application-state-management-overview.md @@ -0,0 +1,13 @@ +# 管理应用拥有的状态概述 + + +上一个章节中介绍的装饰器仅能在页面内,即一个组件树上共享状态变量。如果开发者要实现应用级的,或者多个页面的状态数据共享,就需要用到应用级别的状态管理的概念。ArkTS根据不同特性,提供了多种应用状态管理的能力: + + +- [LocalStorage](arkts-localstorage.md):页面级UI状态存储,通常用于[UIAbility](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md)内、页面间的状态共享。 + +- [AppStorage](arkts-appstorage.md):特殊的单例LocalStorage对象,由UI框架在应用程序启动时创建,为应用程序UI状态属性提供中央存储; + +- [PersistentStorage](arkts-persiststorage.md):持久化存储UI状态,通常和AppStorage配合使用,选择AppStorage存储的数据写入磁盘,以确保这些属性在应用程序重新启动时的值与应用程序关闭时的值相同; + +- [Environment](arkts-environment.md):应用程序运行的设备的环境参数,环境参数会同步到AppStorage中,可以和AppStorage搭配使用。 diff --git a/zh-cn/application-dev/quick-start/arkts-appstorage.md b/zh-cn/application-dev/quick-start/arkts-appstorage.md new file mode 100644 index 0000000000000000000000000000000000000000..74f7f100bf2749ba34e789c16e443f53db61e587 --- /dev/null +++ b/zh-cn/application-dev/quick-start/arkts-appstorage.md @@ -0,0 +1,204 @@ +# AppStorage:应用全局的UI状态存储 + + +AppStorage是应用全局的UI状态存储,是和应用的进程绑定的,由UI框架在应用程序启动时创建,为应用程序UI状态属性提供中央存储。 + + +和LocalStorage不同的是,LocalStorage是页面级的,通常应用于页面内的数据共享。而对于AppStorage,是应用级的全局状态共享。AppStorage还相当于整个应用的“中枢”,[持久化数据PersistentStorage](arkts-persiststorage.md)和[环境变量Environment](arkts-environment.md)都是通过和AppStorage中转,才可以和UI回交互。 + + +本文仅介绍AppStorage使用场景和相关的装饰器:\@StorageProp和\@StorageLink。 + + +## 概述 + +AppStorage是LocalStorage是在应用启动的时候会被创建的单例。它的目的是为了提供应用状态数据的中心存储,这些状态数据在应用级别都是可访问的。AppStorage将在应用运行过程保留其属性。属性通过唯一的键字符串值访问。 + +AppStorage可以和UI组件同步,且可以在应用业务逻辑中被访问。 + +AppStorage中的属性可以被双向同步,数据可以是存在于本地或远程设备上,并具有不同的功能,比如数据持久化(详见[PersistentStorage](arkts-persiststorage.md))。这些数据是通过业务逻辑中实现,与UI解耦,如果希望这些数据在UI中使用,需要用到[@StorageProp](#storageprop)和[@StorageLink](#storagelink)。 + + +## \@StorageProp + +在上文中已经提到,如果要建立AppStorage和自定义组件的联系,需要使用\@StorageProp和\@StorageLink装饰器。使用\@StorageProp(key)/\@StorageLink(key)装饰组件内的变量,key标识了AppStorage的属性。 + +当自定义组件初始化的时候,\@StorageProp(key)/\@StorageLink(key)装饰的变量会通过给定的key,绑定在AppStorage对应是属性,完成初始化。本地初始化是必要的,因为无法保证AppStorage一定存在给定的key,这取决于应用逻辑,是否在组件初始化之前在AppStorage实例中存入对应的属性。 + + +\@StorageProp(key)是和AppStorage中key对应的属性建立单向数据同步,我们允许本地改变的发生,但是对于\@StorageProp,本地的修改永远不会同步回AppStorage中,相反,如果AppStorage给定key的属性发生改变,改变会被同步给\@StorageProp,并覆盖掉本地的修改。 + + +### 装饰器使用规则说明 + +| \@StorageProp变量装饰器 | 说明 | +| ------------------ | ---------------------------------------- | +| 装饰器参数 | key:常量字符串,必填(字符串需要有引号)。 | +| 允许装饰的变量类型 | Object class、string、number、boolean、enum类型,以及这些类型的数组。嵌套类型的场景请参考[观察变化和行为表现](#观察变化和行为表现)。
类型必须被指定,且必须和LocalStorage中对应属性相同。不支持any,不允许使用undefined和null。 | +| 同步类型 | 单向同步:从AppStorage的对应属性到组件的状态变量。
组件本地的修改是允许的,但是AppStorage中给定的属性一旦发生变化,将覆盖本地的修改。 | +| 被装饰变量的初始值 | 必须指定,如果AppStorage实例中不存在属性,则作为初始化默认值,并存入AppStorage中。 | + + +### 变量的传递/访问规则说明 + +| 传递/访问 | 说明 | +| ---------- | ---------------------------------------- | +| 从父节点初始化和更新 | 禁止,\@StorageProp不支持从父节点初始化,只能AppStorage中key对应的属性初始化,如果没有对应key的话,将使用本地默认值初始化 | +| 初始化子节点 | 支持,可用于初始化\@State、\@Link、\@Prop、\@Provide。 | +| 是否支持组件外访问 | 否。 | + + + **图1** \@StorageProp初始化规则图示   + + +![zh-cn_image_0000001552978157](figures/zh-cn_image_0000001552978157.png) + + +### 观察变化和行为表现 + +**观察变化** + + +- 当装饰的数据类型为boolean、string、number类型时,可以观察到数值的变化。 + +- 当装饰的数据类型为class或者Object时,可以观察到赋值和属性赋值的变化,即Object.keys(observedObject)返回的所有属性。 + +- 当装饰的对象是array时,可以观察到数组添加、删除、更新数组单元的变化。 + + +**框架行为** + + +- 当\@StorageProp(key)装饰的数值改变被观察到时,修改不会被同步回AppStorage对应属性键值key的属性中。 + +- 当前\@StorageProp(key)单向绑定的数据会被修改,即仅限于当前组件的私有成员变量改变,其他的绑定该key的数据不会同步改变。 + +- 当\@StorageProp(key)装饰的数据本身是状态变量,它的改变虽然不会同步回AppStorage中,但是会引起所属的自定义组件的重新渲染。 + +- 当AppStorage中key对应的属性发生改变时,会同步给所有\@StorageProp(key)装饰的数据,\@StorageProp(key)本地的修改将被覆盖。 + + +## \@StorageLink + +\@StorageLink(key)是和AppStorage中key对应的属性建立双向数据同步: + +1. 本地修改发生,该修改会被回AppStorage中; + +2. AppStorage中的修改发生后,该修改会被同步到所有绑定AppStorage对应key的属性上,包括单向(\@StorageProp和通过Prop创建的单向绑定变量)、双向(\@StorageLink和通过Link创建的双向绑定变量)变量和其他实例(比如PersistentStorage)。 + + +### 装饰器使用规则说明 + +| \@StorageLink变量装饰器 | 说明 | +| ------------------ | ---------------------------------------- | +| 装饰器参数 | key:常量字符串,必填(字符串需要有引号)。 | +| 允许装饰的变量类型 | Object、class、string、number、boolean、enum类型,以及这些类型的数组。嵌套类型的场景请参考[观察变化和行为表现](#观察变化和行为表现)。
类型必须被指定,且必须和AppStorage中对应属性相同。不支持any,不允许使用undefined和null。 | +| 同步类型 | 双向同步:从AppStorage的对应属性到自定义组件,从自定义组件到AppStorage对应属性。 | +| 被装饰变量的初始值 | 必须指定,如果AppStorage实例中不存在属性,则作为初始化默认值,并存入AppStorage中。 | + + +### 变量的传递/访问规则说明 + +| 传递/访问 | 说明 | +| ---------- | ---------------------------------------- | +| 从父节点初始化和更新 | 禁止。 | +| 初始化子节点 | 支持,可用于初始化常规变量、\@State、\@Link、\@Prop、\@Provide。 | +| 是否支持组件外访问 | 否。 | + + + **图2** \@StorageLink初始化规则图示   + + +![zh-cn_image_0000001501938718](figures/zh-cn_image_0000001501938718.png) + + +### 观察变化和行为表现 + +**观察变化** + + +- 当装饰的数据类型为boolean、string、number类型时,可以观察到数值的变化。 + +- 当装饰的数据类型为class或者Object时,可以观察到赋值和属性赋值的变化,即Object.keys(observedObject)返回的所有属性。 + +- 当装饰的对象是array时,可以观察到数组添加、删除、更新数组单元的变化。 + + +**框架行为** + + +1. 当\@StorageLink(key)装饰的数值改变被观察到时,修改将被同步回AppStorage对应属性键值key的属性中。 + +2. AppStorage中属性键值key对应的数据一旦改变,属性键值key绑定的所有的数据(包括双向\@StorageLink和单向\@StorageProp)都将同步修改; + +3. 当\@StorageLink(key)装饰的数据本身是状态变量,它的改变不仅仅会同步回AppStorage中,还会引起所属的自定义组件的重新渲染。 + + +## 使用场景 + + +### 从应用逻辑使用AppStorage和LocalStorage + +AppStorage是单例,它的所有API都是静态的,使用方法类似于中LocalStorage对应的非静态方法。 + + +```ts +AppStorage.SetOrCreate('PropA', 47); + +let storage: LocalStorage = new LocalStorage({ 'PropA': 17 }); +let propA: number = AppStorage.Get('PropA') // propA in AppStorage == 47, propA in LocalStorage == 17 +var link1: SubscribedAbstractProperty = AppStorage.Link('PropA'); // link1.get() == 47 +var link2: SubscribedAbstractProperty = AppStorage.Link('PropA'); // link2.get() == 47 +var prop: SubscribedAbstractProperty = AppStorage.Prop('PropA'); // prop.get() = 47 + +link1.set(48); // two-way sync: link1.get() == link2.get() == prop.get() == 48 +prop.set(1); // one-way sync: prop.get()=1; but link1.get() == link2.get() == 48 +link1.set(49); // two-way sync: link1.get() == link2.get() == prop.get() == 49 + +storage.get('PropA') // == 17 +storage.set('PropA', 101); +storage.get('PropA') // == 101 + +AppStorage.Get('PropA') // == 49 +link1.get() // == 49 +link2.get() // == 49 +prop.get() // == 49 +``` + + +### 从UI内部使用AppStorage和LocalStorage + +\@StorageLink变量装饰器与AppStorage配合使用,正如\@LocalStorageLink与LocalStorage配合使用一样。此装饰器使用AppStorage中的属性创建双向数据同步。 + + +```ts +AppStorage.SetOrCreate('PropA', 47); +let storage = new LocalStorage({ 'PropA': 48 }); + +@Entry(storage) +@Component +struct CompA { + @StorageLink('PropA') storLink: number = 1; + @LocalStorageLink('PropA') localStorLink: number = 1; + + build() { + Column({ space: 20 }) { + Text(`From AppStorage ${this.storLink}`) + .onClick(() => this.storLink += 1) + + Text(`From LocalStorage ${this.localStorLink}`) + .onClick(() => this.localStorLink += 1) + } + } +} +``` + + +## 限制条件 + +AppStorage与[PersistentStorage](arkts-persiststorage.md)以及[Environment](arkts-environment.md)配合使用时,需要注意以下几点: + +- 在AppStorage中创建属性后,调用PersistentStorage.PersistProp()接口时,会使用在AppStorage中已经存在的值,并覆盖PersistentStorage中的同名属性,所以建议要使用相反的调用顺序,反例可见[在PersistentStorage之前访问AppStorage中的属性](arkts-persiststorage.md#在persistentstorage之前访问appstorage中的属性); + +- 如果在AppStorage中已经创建属性后,再调用Environment.EnvProp()创建同名的属性,会调用失败。因为AppStorage已经有同名属性,Environment环境变量不会再写入AppStorage中,所以建议AppStorage中属性不要使用Environment预置环境变量名。 + diff --git a/zh-cn/application-dev/quick-start/arkts-basic-syntax-overview.md b/zh-cn/application-dev/quick-start/arkts-basic-syntax-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..553c849749a2a4d8e93fe025143a38984db8aa5c --- /dev/null +++ b/zh-cn/application-dev/quick-start/arkts-basic-syntax-overview.md @@ -0,0 +1,40 @@ +# 基本语法概述 + + +在初步了解了ArkTS语言之后,我们以一个具体的示例来说明ArkTS的基本组成。如下图所示,当开发者点击按钮时,文本内容从“Hello World”变为“Hello ArkUI”。 + + + **图1** 示例效果图   + +![Video_2023-03-06_152548](figures/Video_2023-03-06_152548.gif) + + +本示例中,ArkTS的基本组成如下所示。 + + + **图2** ArkTS的基本组成   + +![arkts-basic-grammar](figures/arkts-basic-grammar.png) + + +- 装饰器: 用于装饰类、结构、方法以及变量,并赋予其特殊的含义。如上述示例中\@Entry、\@Component和\@State都是装饰器,\@Component表示自定义组件,\@Entry表示该自定义组件为入口组件,\@State表示组件中的状态变量,状态变量变化会触发UI刷新。 + +- [UI描述](arkts-declarative-ui-description.md):以声明式的方式来描述UI的结构,例如build()方法中的代码块。 + +- [自定义组件](arkts-create-custom-components.md):可复用的UI单元,可组合其他组件,如上述被\@Component装饰的struct Hello。 + +- 系统组件:ArkUI框架中默认内置的基础和容器组件,可直接被开发者调用,比如示例中的Column、Text、Divider、Button。 + +- 属性方法:组件可以通过链式调用配置多项属性,如fontSize()、width()、height()、color()等。 + +- 事件方法:组件可以通过链式调用设置多个事件的响应逻辑,如跟随在Button后面的onClick()。 + + +除此之外,ArkTS扩展了多种语法范式来使开发更加便捷: + + +- [@Builder](arkts-builder.md)/[@BuilderParam](arkts-builderparam.md):特殊的封装UI描述的方法,细粒度的封装和复用UI描述。 + +- [@Extend](arkts-extend.md)/[@Style](arkts-style.md):扩展内置组件和封装属性样式,更灵活地组合内置组件。 + +- [stateStyles](arkts-statestyles.md):多态样式,可以依据组件的内部状态的不同,设置不同样式。 diff --git a/zh-cn/application-dev/quick-start/arkts-basic-ui-description.md b/zh-cn/application-dev/quick-start/arkts-basic-ui-description.md deleted file mode 100644 index bf975b96765f0b4b0ab94ac3c80dda0aa320eb73..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/quick-start/arkts-basic-ui-description.md +++ /dev/null @@ -1,203 +0,0 @@ -# 基本UI描述 - -ArkTS通过装饰器@Component和@Entry装饰struct关键字声明的数据结构,构成一个自定义组件。自定义组件中提供了一个build函数,开发者需在该函数内以链式调用的方式进行基本的UI描述,UI描述的方法请参考[UI描述规范](#ui描述规范)。 - -## 基本概念 - -- struct:自定义组件可以基于struct实现,不能有继承关系,对于struct的实例化,可以省略new。 - -- 装饰器:装饰器给被装饰的对象赋予某一种能力,其不仅可以装饰类或结构体,还可以装饰类的属性。多个装饰器可以叠加到目标元素上,定义在同一行中或者分开多行,推荐分开多行定义。 - - ```ts - @Entry - @Component - struct MyComponent { - } - ``` - -- build函数:自定义组件必须定义build函数,并且禁止自定义构造函数。build函数满足Builder构造器接口定义,用于定义组件的声明式UI描述。 - - ```ts - interface Builder { - build: () => void - } - ``` - -- @Component:装饰struct,结构体在装饰后具有基于组件的能力,需要实现build方法来创建UI。 - -- @Entry: 装饰struct,组件被装饰后作为页面的入口,页面加载时将被渲染显示。 - -- @Preview:装饰struct, 用@Preview装饰的自定义组件可以在DevEco Studio的预览器上进行实时预览,加载页面时,将创建并显示@Preview装饰的自定义组件。 - - > **说明:** 在单个源文件中,最多可以使用10个@Preview装饰自定义组件,更多说明请参考[查看ArkTS组件预览效果](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-previewing-app-service-0000001218760596#section146052489820)。 - -- 链式调用:以 "." 链式调用的方式配置UI组件的属性方法、事件方法等。 - -## UI描述规范 - -### 无参数构造配置 - -如果组件的接口定义中不包含必选构造参数,组件后面的“()”中不需要配置任何内容。例如,Divider组件不包含构造参数: - -```ts -Column() { - Text('item 1') - Divider() - Text('item 2') -} -``` - -### 有参数构造配置 - -如果组件的接口定义中包含构造参数,则在组件后面的“()”中可配置相应参数,参数可以使用常量进行赋值。 - -例如: - -- Image组件的必选参数src: - - ```ts - Image('https://xyz/test.jpg') - ``` - -- Text组件的参数content,该参数非必选,即配置或不配置均可: - - ```ts - Text('test') - ``` - -变量或表达式也可以用于参数赋值,其中表达式返回的结果类型必须满足参数类型要求,变量的定义详见[页面级变量的状态管理](arkts-state-mgmt-page-level.md)与[应用级变量的状态管理](arkts-state-mgmt-application-level.md)。例如,设置变量或表达式来构造Image和Text组件的参数: - -```ts -Image(this.imagePath) -Image('https://' + this.imageUrl) -Text(`count: ${this.count}`) -``` - -### 属性配置 - -使用属性方法配置组件的属性,属性方法紧随组件,并用"."运算符连接。 - -- 配置Text组件的字体大小属性: - - ```ts - Text('test') - .fontSize(12) - ``` - -- 使用"."运算符进行链式调用并同时配置组件的多个属性,如下所示: - - ```ts - Image('test.jpg') - .alt('error.jpg') - .width(100) - .height(100) - ``` - -- 除了直接传递常量参数外,还可以传递变量或表达式,如下所示: - - ```ts - Text('hello') - .fontSize(this.size) - Image('test.jpg') - .width(this.count % 2 === 0 ? 100 : 200) - .height(this.offset + 100) - ``` - -- 对于系统内置组件,框架还为其属性预定义了一些[枚举类型](../reference/arkui-ts/ts-appendix-enums.md)供开发人员调用,枚举类型可以作为参数传递,且必须满足参数类型要求。例如,可以按以下方式配置Text组件的颜色和字体属性: - - ```ts - Text('hello') - .fontSize(20) - .fontColor(Color.Red) - .fontWeight(FontWeight.Bold) - ``` - -### 事件配置 - -通过事件方法可以配置组件支持的事件,事件方法紧随组件,并用"."运算符连接。 - -- 使用lambda表达式配置组件的事件方法: - - ```ts - Button('add counter') - .onClick(() => { - this.counter += 2; - }) - ``` - -- 使用匿名函数表达式配置组件的事件方法,要求使用bind,以确保函数体中的this引用包含的组件: - - ```ts - Button('add counter') - .onClick(function () { - this.counter += 2; - }.bind(this)) - ``` - -- 使用组件的成员函数配置组件的事件方法: - - ```ts - myClickHandler(): void { - this.counter += 2; - } - - ... - - Button('add counter') - .onClick(this.myClickHandler.bind(this)) - ``` - -### 子组件配置 - -对于支持子组件配置的组件,例如容器组件,在"{ ... }"里为组件添加子组件的UI描述。Column、Row、Stack、Grid、List等组件都是容器组件。 - -- 以下是简单的Column示例: - - ```ts - Column() { - Text('Hello') - .fontSize(100) - Divider() - Text(this.myText) - .fontSize(100) - .fontColor(Color.Red) - } - ``` - -- 容器组件之间也可以互相嵌套,实现相对复杂的多级嵌套效果: - - ```ts - Column() { - Row() { - Image('test1.jpg') - .width(100) - .height(100) - Button('click +1') - .onClick(() => { - console.info('+1 clicked!'); - }) - } - - Divider() - Row() { - Image('test2.jpg') - .width(100) - .height(100) - Button('click +2') - .onClick(() => { - console.info('+2 clicked!'); - }) - } - - Divider() - Row() { - Image('test3.jpg') - .width(100) - .height(100) - Button('click +3') - .onClick(() => { - console.info('+3 clicked!'); - }) - } - } - ``` \ No newline at end of file diff --git a/zh-cn/application-dev/quick-start/arkts-builder.md b/zh-cn/application-dev/quick-start/arkts-builder.md new file mode 100644 index 0000000000000000000000000000000000000000..0de195ec6e80014163e1a76ca973e6563aea79ce --- /dev/null +++ b/zh-cn/application-dev/quick-start/arkts-builder.md @@ -0,0 +1,130 @@ +# \@Builder:自定义构建函数 + + +前面章节介绍了如何创建一个自定义组件。该自定义组件内部UI结构固定,仅与使用方进行数据传递。ArkUI还提供了一种更轻量的UI元素复用机制\@Builder,\@Builder所装饰的函数遵循build()函数语法规则,开发者可以将重复使用的UI元素抽象成一个方法,在build方法里调用。 + + +为了简化语言,我们将\@Builder装饰的函数也称为“自定义构建函数”。 + + +> **说明:** +> +> 从API version 9开始,该装饰器支持在ArkTS卡片中使用。 + + +## 装饰器使用说明 + + +### 自定义组件内自定义构建函数 + +定义的语法: + + +```ts +@Builder myBuilderFunction({ ... }) +``` + +使用方法: + + +```ts +this.myBuilderFunction({ ... }) +``` + +- 允许在自定义组件内定义一个或多个自定义构建函数,该函数被认为是该组件的私有、特殊类型的成员函数。 + +- 自定义构建函数可以在所属组件的build方法和其他自定义构建函数中调用,但不允许在组件外调用。 + +- 在自定义函数体中,this指代当前所属组件,组件的状态变量可以在自定义构建函数内访问。建议通过this访问自定义组件的状态变量而不是参数传递。 + + +### 全局自定义构建函数 + +定义的语法: + + +```ts +@Builder function MyGlobalBuilderFunction({ ... }) +``` + +使用方法: + + +```ts +MyGlobalBuilderFunction() +``` + + +- 全局的自定义构建函数可以被整个应用获取,不允许使用this和bind方法。 + +- 如果不涉及组件状态变化,建议使用全局的自定义构建方法。 + + +## 参数传递规则 + +自定义构建函数的参数传递有[按值传递](#按值传递参数)和[按引用传递](#按引用传递参数)两种,均需遵守以下规则: + +- 参数的类型必须与参数声明的类型一致,不允许undefined、null和返回undefined、null的表达式。 + +- 在自定义构建函数内部,不允许改变参数值。如果需要改变参数值,且同步回调用点,建议使用[@Link](arkts-link.md)。 + +- \@Builder内UI语法遵循[UI语法规则](arkts-create-custom-components.md#build函数)。 + + +### 按引用传递参数 + +按引用传递参数时,传递的参数可为状态变量,且状态变量的改变会引起\@Builder方法内的UI刷新。ArkUI提供$$作为按引用传递参数的范式。 + + +```ts +ABuilder( $$ : { paramA1: string, paramB1 : string } ); +``` + + + +```ts +@Builder function ABuilder($$: { paramA1: string }) { + Row() { + Text(`UseStateVarByReference: ${$$.paramA1} `) + } +} +@Entry +@Component +struct Parent { + @State label: string = 'Hello'; + build() { + Column() { + // 在Parent组件中调用ABuilder的时候,将this.label引用传递给ABuilder + ABuilder({ paramA1: this.label }) + Button('Click me').onClick(() => { + // 点击“Click me”后,UI从“Hello”刷新为“ArkUI” + this.label = 'ArkUI'; + }) + } + } +} +``` + + +### 按值传递参数 + +调用\@Builder装饰的函数默认按值传递。当传递的参数为状态变量时,状态变量的改变不会引起\@Builder方法内的UI刷新。所以当使用状态变量的时候,推荐使用[按引用传递](#按引用传递参数)。 + + +```ts +@Builder function ABuilder(paramA1: string) { + Row() { + Text(`UseStateVarByValue: ${paramA1} `) + } +} +@Entry +@Component +struct Parent { + label: string = 'Hello'; + build() { + Column() { + ABuilder(this.label) + } + } +} +``` diff --git a/zh-cn/application-dev/quick-start/arkts-builderparam.md b/zh-cn/application-dev/quick-start/arkts-builderparam.md new file mode 100644 index 0000000000000000000000000000000000000000..dc606cb66e6ba4731d611f4769f2b90d6e452437 --- /dev/null +++ b/zh-cn/application-dev/quick-start/arkts-builderparam.md @@ -0,0 +1,211 @@ +# \@BuilderParam:引用\@Builder函数 + + +当开发者创建了自定义组件,并想对该组件添加特定功能时,例如在自定义组件中添加一个点击跳转操作。若直接在组件内嵌入事件方法,将会导致所有引入该自定义组件的地方均增加了该功能。为解决此问题,ArkUI引入了\@BuilderParam装饰器,\@BuilderParam用来装饰指向\@Builder方法的变量,开发者可在初始化自定义组件时对此属性进行赋值,为自定义组件增加特定的功能。该装饰器用于声明任意UI描述的一个元素,类似slot占位符。 + + +> **说明:** +> +> 从API version 9开始,该装饰器支持在ArkTS卡片中使用。 + + +## 装饰器使用说明 + + +### 初始化\@BuilderParam装饰的方法 + +\@BuildParam装饰的方法只能被自定义构建函数(\@Builder装饰的方法)初始化。 + +- 使用所属自定义组件的自定义构建函数或者全局的自定义构建函数,在本地初始化\@BuilderParam。 + + ```ts + @Builder function GlobalBuilder0() {} + + @Component + struct Child { + @Builder doNothingBuilder() {}; + + @BuilderParam aBuilder0: () => void = this.doNothingBuilder; + @BuilderParam aBuilder1: () => void = GlobalBuilder0; + build(){} + } + ``` + +- 用父组件自定义构建函数初始化子组件\@BuildParam装饰的方法。 + + ```ts + @Component + struct Child { + @BuilderParam aBuilder0: () => void; + + build() { + Column() { + this.aBuilder0() + } + } + } + + @Entry + @Component + struct Parent { + @Builder componentBuilder() { + Text(`Parent builder `) + } + + build() { + Column() { + Child({ aBuilder0: this.componentBuilder }) + } + } + } + ``` + + +- 需注意this指向正确。 + + 以下示例中,Parent组件在调用this.componentBuilder()时,this.label指向其所属组件,即“Parent”。\@Builder componentBuilder()传给子组件\@BuilderParam aBuilder0,在Child组件中调用this.aBuilder0()时,this.label指向在Child的label,即“Child”。 + + > **说明:** + > + > 开发者谨慎使用bind改变函数调用的上下文,可能会使this指向混乱。 + + ```ts + @Component + struct Child { + label: string = `Child` + @BuilderParam aBuilder0: () => void; + + build() { + Column() { + this.aBuilder0() + } + } + } + + @Entry + @Component + struct Parent { + label: string = `Parent` + + @Builder componentBuilder() { + Text(`${this.label}`) + } + + build() { + Column() { + this.componentBuilder() + Child({ aBuilder0: this.componentBuilder }) + } + } + } + ``` + + +## 使用场景 + + +### 参数初始化组件 + +\@BuilderParam装饰的方法可以是有参数和无参数的两种形式,需与指向的\@Builder方法类型匹配。\@BuilderParam装饰的方法类型需要和\@Builder方法类型一致。 + + +```ts +@Builder function GlobalBuilder1($$ : {label: string }) { + Text($$.label) + .width(400) + .height(50) + .backgroundColor(Color.Blue) +} + +@Component +struct Child { + label: string = 'Child' + // 无参数类,指向的componentBuilder也是无参数类型 + @BuilderParam aBuilder0: () => void; + // 有参数类型,指向的GlobalBuilder1也是有参数类型的方法 + @BuilderParam aBuilder1: ($$ : { label : string}) => void; + + build() { + Column() { + this.aBuilder0() + this.aBuilder1({label: 'global Builder label' } ) + } + } +} + +@Entry +@Component +struct Parent { + label: string = 'Parent' + + @Builder componentBuilder() { + Text(`${this.label}`) + } + + build() { + Column() { + this.componentBuilder() + Child({ aBuilder0: this.componentBuilder, aBuilder1: GlobalBuilder1 }) + } + } +} +``` + + +### 尾随闭包初始化组件示例 + +在自定义组件中使用\@BuilderParam装饰的属性时也可通过尾随闭包进行初始化。在初始化自定义组件时,组件后紧跟一个大括号“{}”形成尾随闭包场景。 + +> **说明:** +> +> 此场景下自定义组件内有且仅有一个使用\@BuilderParam装饰的属性。 + +开发者可以将尾随闭包内的内容看做\@Builder装饰的函数传给\@BuilderParam。示例如下: + + +```ts +// xxx.ets +@Component +struct CustomContainer { + @Prop header: string; + @BuilderParam closer: () => void + + build() { + Column() { + Text(this.header) + .fontSize(30) + this.closer() + } + } +} + +@Builder function specificParam(label1: string, label2: string) { + Column() { + Text(label1) + .fontSize(30) + Text(label2) + .fontSize(30) + } +} + +@Entry +@Component +struct CustomContainerUser { + @State text: string = 'header'; + + build() { + Column() { + // 创建CustomContainer,在创建CustomContainer时,通过其后紧跟一个大括号“{}”形成尾随闭包 + // 作为传递给子组件CustomContainer @BuilderParam closer: () => void的参数 + CustomContainer({ header: this.text }) { + Column() { + specificParam('testA', 'testB') + }.backgroundColor(Color.Yellow) + .onClick(() => { + this.text = 'changeHeader'; + }) + } + } + } +} +``` diff --git a/zh-cn/application-dev/quick-start/arkts-create-custom-components.md b/zh-cn/application-dev/quick-start/arkts-create-custom-components.md new file mode 100644 index 0000000000000000000000000000000000000000..c0aad400230fb95dfdf13b920f14cd308b6050fc --- /dev/null +++ b/zh-cn/application-dev/quick-start/arkts-create-custom-components.md @@ -0,0 +1,382 @@ +# 创建自定义组件 + + +在ArkUI中,UI显示的内容均为组件,由框架直接提供的称为系统组件,由开发者定义的称为自定义组件。在进行 UI 界面开发时,通常不是简单的将系统组件进行组合使用,而是需要考虑代码可复用性、业务逻辑与UI分离,后续版本演进等因素。因此,将UI和部分业务逻辑封装成自定义组件是不可或缺的能力。 + + +自定义组件具有以下特点: + + +- 可组合:允许开发者组合使用系统组件、及其属性和方法。 + +- 可重用:自定义组件可以被其他组件重用,并作为不同的实例在不同的父组件或容器中使用。 + +- 数据驱动UI更新:通过状态变量的改变,来驱动UI的刷新。 + + +以下示例展示了自定义组件的基本用法。 + + + +```ts +@Component +struct HelloComponent { + @State message: string = 'Hello, World!'; + + build() { + // HelloComponent自定义组件组合系统组件Row和Text + Row() { + Text(this.message) + .onClick(() => { + // 状态变量message的改变驱动UI刷新,UI从'Hello, World!'刷新为'Hello, ArkUI!' + this.message = 'Hello, ArkUI!'; + }) + } + } +} +``` + + +HelloComponent可以在其他自定义组件中的build()函数中多次创建,实现自定义组件的重用。 + + + +```ts +@Entry +@Component +struct ParentComponent { + build() { + Column() { + Text('ArkUI message') + HelloComponent({ message: 'Hello, World!' }); + Divider() + HelloComponent({ message: '你好!' }); + } + } +} +``` + + +要完全理解上面的示例,需要了解自定义组件的以下概念定义,本文将在后面的小节中介绍: + + +- [自定义组件的基本结构](#自定义组件的基本结构) + +- [成员函数/变量](#成员函数变量) + +- [自定义组件的参数规定](#自定义组件的参数规定) + +- [build()函数](#build函数) + +- [自定义组件通用样式](#自定义组件通用样式) + +- [自定义属性方法](#自定义属性方法) + + +## 自定义组件的基本结构 + +- struct:自定义组件基于struct实现,struct + 自定义组件名 + {...}的组合构成自定义组件,不能有继承关系。对于struct的实例化,可以省略new。 + > **说明:** + > + > 自定义组件名、类名、函数名不能和系统组件名相同。 + +- \@Component:\@Component装饰器仅能装饰struct关键字声明的数据结构。struct被\@Component装饰后具备组件化的能力,需要实现build方法描述UI,一个struct只能被一个\@Component装饰。 + > **说明:** + > + > 从API version 9开始,该装饰器支持在ArkTS卡片中使用。 + + ```ts + @Component + struct MyComponent { + } + ``` + +- build()函数:build()函数用于定义自定义组件的声明式UI描述,自定义组件必须定义build()函数。 + + ```ts + @Component + struct MyComponent { + build() { + } + } + ``` + +- \@Entry:\@Entry装饰的自定义组件将作为UI页面的入口。在单个UI页面中,最多可以使用\@Entry装饰一个自定义组件。\@Entry可以接受一个可选的[LocalStorage](arkts-localstorage.md)的参数。 + + > **说明:** + > + > 从API version 9开始,该装饰器支持在ArkTS卡片中使用。 + + ```ts + @Entry + @Component + struct MyComponent { + } + ``` + + +## 成员函数/变量 + +自定义组件除了必须要实现build()函数外,还可以实现其他成员函数,成员函数具有以下约束: + + +- 不支持静态函数。 + +- 成员函数的访问始终是私有的,仅能定义private。定义访问权限是可选的,其他访问权限会带来语法错误。 + + +自定义组件可以包含成员变量,成员变量具有以下约束: + + +- 不支持静态成员变量。 + +- 所有成员变量都是私有的,变量的访问规则与成员函数的访问规则相同。 + +- 自定义组件的成员变量本地初始化有些是可选的,有些是必选的。具体是否需要本地初始化,是否需要从父组件通过参数传递初始化子组件的成员变量,请参考[状态管理](arkts-state-management-overview.md)。 + + +## 自定义组件的参数规定 + +从上文的示例中,我们已经了解到,可以在build方法或者[@Builder](arkts-builder.md)装饰的函数里创建自定义组件,在创建的过程中,参数可以被提供给组件。 + + +```ts +@Component +struct MyComponent { + private countDownFrom: number = 0; + private color: Color = Color.Blue; + + build() { + } +} + +@Entry +@Component +struct ParentComponent { + private someColor: Color = Color.Pink; + + build() { + Column() { + // 创建MyComponent实例,并将创建MyComponent成员变量countDownFrom初始化为10,将成员变量color初始化为this.someColor + MyComponent({ countDownFrom: 10, color: this.someColor }) + } + } +} +``` + + +## build()函数 + +所有声明在build()函数的语言,我们统称为UI描述语言,UI描述语言需要遵循以下规则: + +- \@Entry装饰的自定义组件,其build()函数下的根节点唯一且必要,且必须为容器组件,其中ForEach禁止作为根节点。 + \@Component装饰的自定义组件,其build()函数下的根节点唯一且必要,可以为非容器组件,其中ForEach禁止作为根节点。 + + ```ts + @Entry + @Component + struct MyComponent { + build() { + // 根节点唯一且必要,必须为容器组件 + Row() { + ChildComponent() + } + } + } + + @Component + struct ChildComponent { + build() { + // 根节点唯一且必要,可为非容器组件 + Image('test.jpg') + } + } + ``` + +- 不允许声明本地变量,反例如下。 + + ```ts + build() { + // 反例:不允许声明本地变量 + let a: number = 1; + } + ``` + +- 不允许在UI描述里直接使用console.info,但允许在方法或者函数里使用,反例如下。 + + ```ts + build() { + // 反例:不允许console.info + console.info('print debug log'); + } + ``` + +- 不允许创建本地的作用域,反例如下。 + + ```ts + build() { + // 反例:不允许本地作用域 + { + ... + } + } + ``` + +- 不允许调用除了被\@Builder装饰以外的方法,允许系统组件的参数是TS方法的返回值。 + + ```ts + @Component + struct ParentComponent { + doSomeCalculations() { + } + + calcTextValue(): string { + return 'Hello World'; + } + + @Builder doSomeRender() { + Text(`Hello World`) + } + + build() { + Column() { + // 反例:不能调用没有用@Builder装饰的方法 + this.doSomeCalculations(); + // 正例:可以调用 + this.doSomeRender(); + // 正例:参数可以为调用TS方法的返回值 + Text(this.calcTextValue()) + } + } + } + ``` + +- 不允许switch语法,如果需要使用条件判断,请使用if。反例如下。 + + ```ts + build() { + Column() { + // 反例:不允许使用switch语法 + switch (expression) { + case 1: + Text('...') + break; + case 2: + Image('...') + break; + default: + Text('...') + break; + } + } + } + ``` + +- 不允许使用表达式,反例如下。 + + ```ts + build() { + Column() { + // 反例:不允许使用表达式 + (this.aVar > 10) ? Text('...') : Image('...') + } + } + ``` + + +## 自定义组件通用样式 + +自定义组件通过“.”链式调用的形式设置通用样式。 + + +```ts +@Component +struct MyComponent2 { + build() { + Button(`Hello World`) + } +} + +@Entry +@Component +struct MyComponent { + build() { + Row() { + MyComponent2() + .width(200) + .height(300) + .backgroundColor(Color.Red) + } + } +} +``` + +> **说明:** +> +> ArkUI给自定义组件设置样式时,相当于给MyComponent2套了一个不可见的容器组件,而这些样式是设置在容器组件上的,而非直接设置给MyComponent2的Button组件。通过渲染结果我们可以很清楚的看到,背景颜色红色并没有直接生效在Button上,而是生效在Button所处的开发者不可见的容器组件上。 + + +## 自定义属性方法 + +自定义组件不支持提供自定义属性方法,可以借助类似Controller控制器能力,提供自定义接口。 + + +```ts +// 自定义controller +export class MyComponentController { + item: MyComponent = null; + + setItem(item: MyComponent) { + this.item = item; + } + + changeText(value: string) { + this.item.value = value; + } +} + +// 自定义组件 +@Component +export default struct MyComponent { + public controller: MyComponentController = null; + @State value: string = 'Hello World'; + + build() { + Column() { + Text(this.value) + .fontSize(50) + } + } + + aboutToAppear() { + if (this.controller) + this.controller.setItem(this); // 绑定controller + } +} + +// 使用处逻辑 +@Entry +@Component +struct StyleExample { + controller = new MyComponentController(); + + build() { + Column() { + MyComponent({ controller: this.controller }) + } + .onClick(() => { + this.controller.changeText('Text'); + }) + } +} +``` + +在上面的示例中: + +1. 通过子组件MyComponent的aboutToAppear方法,把当前的this指针传递给MyComponentController的item成员变量。 + +2. 在StyleExample父组件中持有controller实例,调用controller的changeText方法,即相当于通过controller持有的MyComponent子组件的this指针,改变MyComponent的状态变量value的值。 + +通过controller的封装,MyComponent对外暴露了changeText的接口,所有持有controller的实例都可以通过调用changeText接口,改变MyComponent的状态变量value的值。 + + diff --git a/zh-cn/application-dev/quick-start/arkts-declarative-ui-description.md b/zh-cn/application-dev/quick-start/arkts-declarative-ui-description.md new file mode 100644 index 0000000000000000000000000000000000000000..f75f73a168f54939cad501488203d137bb37a8d9 --- /dev/null +++ b/zh-cn/application-dev/quick-start/arkts-declarative-ui-description.md @@ -0,0 +1,172 @@ +# 声明式UI描述 + + +ArkTS以声明方式组合和扩展组件来描述应用程序的UI,同时还提供了基本的属性、事件和子组件配置方法,帮助开发者实现应用交互逻辑。 + + +## 创建组件 + +根据组件构造方法的不同,创建组件包含有参数和无参数两种方式。 + +> **说明:** +> +> 创建组件时不需要new运算符。 + + +### 无参数 + +如果组件的接口定义没有包含必选构造参数,则组件后面的“()”不需要配置任何内容。例如,Divider组件不包含构造参数: + + +```ts +Column() { + Text('item 1') + Divider() + Text('item 2') +} +``` + + +### 有参数 + +如果组件的接口定义包含构造参数,则在组件后面的“()”配置相应参数。 + +- Image组件的必选参数src。 + + ```ts + Image('https://xyz/test.jpg') + ``` + + +- Text组件的非必选参数content。 + + ```ts + // string类型的参数 + Text('test') + // $r形式引入应用资源,可应用于多语言场景 + Text($r('app.string.title_value')) + // 无参数形式 + Text() + ``` + + +- 变量或表达式也可以用于参数赋值,其中表达式返回的结果类型必须满足参数类型要求。 + 例如,设置变量或表达式来构造Image和Text组件的参数。 + + ```ts + Image(this.imagePath) + Image('https://' + this.imageUrl) + Text(`count: ${this.count}`) + ``` + + +## 配置属性 + +属性方法以“.”链式调用的方式配置系统组件的样式和其他属性,建议每个属性方法单独写一行。 + + +- 配置Text组件的字体大小。 + + ```ts + Text('test') + .fontSize(12) + ``` + +- 配置组件的多个属性。 + + ```ts + Image('test.jpg') + .alt('error.jpg') + .width(100) + .height(100) + ``` + +- 除了直接传递常量参数外,还可以传递变量或表达式。 + + ```ts + Text('hello') + .fontSize(this.size) + Image('test.jpg') + .width(this.count % 2 === 0 ? 100 : 200) + .height(this.offset + 100) + ``` + +- 对于系统组件,ArkUI还为其属性预定义了一些枚举类型供开发者调用,枚举类型可以作为参数传递,但必须满足参数类型要求。 + 例如,可以按以下方式配置Text组件的颜色和字体样式。 + + ```ts + Text('hello') + .fontSize(20) + .fontColor(Color.Red) + .fontWeight(FontWeight.Bold) + ``` + + +## 配置事件 + +事件方法以“.”链式调用的方式配置系统组件支持的事件,建议每个属性方法单独写一行。 + + +- 使用lambda表达式配置组件的事件方法。 + + ```ts + Button('Click me') + .onClick(() => { + this.myText = 'ArkUI'; + }) + ``` + +- 使用匿名函数表达式配置组件的事件方法,要求使用bind,以确保函数体中的this指向当前组件。 + + ```ts + Button('add counter') + .onClick(function(){ + this.counter += 2; + }.bind(this)) + ``` + +- 使用组件的成员函数配置组件的事件方法。 + + ```ts + myClickHandler(): void { + this.counter += 2; + } + ... + Button('add counter') + .onClick(this.myClickHandler.bind(this)) + ``` + + +## 配置子组件 + +如果组件支持子组件配置,则需在尾随闭包"{...}"中为组件添加子组件的UI描述。Column、Row、Stack、Grid、List等组件都是容器组件。 + + +- 以下是简单的Column组件配置子组件的示例。 + + ```ts + Column() { + Text('Hello') + .fontSize(100) + Divider() + Text(this.myText) + .fontSize(100) + .fontColor(Color.Red) + } + ``` + +- 容器组件均支持子组件配置,可以实现相对复杂的多级嵌套。 + + ```ts + Column() { + Row() { + Image('test1.jpg') + .width(100) + .height(100) + Button('click +1') + .onClick(() => { + console.info('+1 clicked!'); + }) + } + } + ``` diff --git a/zh-cn/application-dev/quick-start/arkts-dynamic-ui-elememt-building.md b/zh-cn/application-dev/quick-start/arkts-dynamic-ui-elememt-building.md deleted file mode 100644 index 3de63bc1291d343afe73d9117f0ec0157348c657..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/quick-start/arkts-dynamic-ui-elememt-building.md +++ /dev/null @@ -1,385 +0,0 @@ -# 动态构建UI元素 - -[基本UI描述](arkts-basic-ui-description.md)介绍的是如何创建一个内部UI结构固定的自定义组件,为了满足开发者自定义组件内部UI结构的需求,ArkTS同时提供了动态构建UI元素的能力。 - -## @Builder - -可通过@Builder装饰器进行描述,该装饰器可以修饰一个函数,此函数可以在build函数之外声明,并在build函数中或其他@Builder修饰的函数中使用,从而实现在一个自定义组件内快速生成多个布局内容。使用方式如下面示例所示。 - -```ts -// xxx.ets -@Component -struct CompB { - @State CompValue: string = '' - - aboutToAppear() { - console.info('CompB aboutToAppear.') - } - - aboutToDisappear() { - console.info('CompB aboutToDisappear.') - } - - build() { - Column() { - Button(this.CompValue) - .margin(5) - } - } -} - -@Entry -@Component -struct CompA { - size1: number = 100 - @State CompValue1: string = "Hello,CompValue1" - @State CompValue2: string = "Hello,CompValue2" - @State CompValue3: string = "Hello,CompValue3" - - // @Builder装饰的函数CompC内使用自定义组件CompB - @Builder CompC(value: string) { - CompB({ CompValue: value }) - } - - @Builder SquareText(label: string) { - Text(label) - .fontSize(18) - .width(1 * this.size1) - .height(1 * this.size1) - } - - // @Builder装饰的函数RowOfSquareTexts内使用@Builder装饰的函数SquareText - @Builder RowOfSquareTexts(label1: string, label2: string) { - Row() { - this.SquareText(label1) - this.SquareText(label2) - } - .width(2 * this.size1) - .height(1 * this.size1) - } - - build() { - Column() { - Row() { - this.SquareText("A") - this.SquareText("B") - } - .width(2 * this.size1) - .height(1 * this.size1) - - this.RowOfSquareTexts("C", "D") - Column() { - // 使用三次@Builder装饰的自定义组件 - this.CompC(this.CompValue1) - this.CompC(this.CompValue2) - this.CompC(this.CompValue3) - } - .width(2 * this.size1) - .height(2 * this.size1) - } - .width(2 * this.size1) - .height(2 * this.size1) - } -} -``` -![builder](figures/builder.PNG) - -## @BuilderParam8+ - -@BuilderParam装饰器用于修饰自定义组件内函数类型的属性(例如:`@BuilderParam noParam: () => void`),并且在初始化自定义组件时被@BuilderParam修饰的属性必须赋值。 - -### 引入动机 - -当开发者创建自定义组件,并想对该组件添加特定功能时(例如在自定义组件中添加一个点击跳转操作)。若直接在组件内嵌入事件方法,将会导致所有引入该自定义组件的地方均增加了该功能。为解决此问题,引入了@BuilderParam装饰器,此装饰器修饰的属性值可为@Builder装饰的函数,开发者可在初始化自定义组件时对此属性进行赋值,为自定义组件增加特定的功能。 - -### 参数初始化组件 - -通过参数初始化组件时,将@Builder装饰的函数赋值给@BuilderParam修饰的属性,并在自定义组件内调用该属性值。若@BuilderParam修饰的属性在进行赋值时不带参数(如:`noParam: this.specificNoParam`),则此属性的类型需定义为无返回值的函数(如:`@BuilderParam noParam: () => void`);若带参数(如:`withParam: this.SpecificWithParam('WithParamA')`),则此属性的类型需定义成any(如:`@BuilderParam withParam: any`)。 - -```ts -// xxx.ets -@Component -struct CustomContainer { - header: string = '' - @BuilderParam noParam: () => void - @BuilderParam withParam: any - footer: string = '' - - build() { - Column() { - Text(this.header) - .fontSize(30) - this.noParam() - this.withParam() - Text(this.footer) - .fontSize(30) - } - } -} - -@Entry -@Component -struct CustomContainerUser { - @Builder specificNoParam() { - Column() { - Text('noParam').fontSize(30) - } - } - - @Builder SpecificWithParam(label: string) { - Column() { - Text(label).fontSize(30) - } - } - - build() { - Column() { - CustomContainer({ - header: 'HeaderA', - noParam: this.specificNoParam, - withParam: this.SpecificWithParam('WithParamA'), - footer: 'FooterA' - }) - Divider() - .strokeWidth(3) - .margin(10) - CustomContainer({ - header: 'HeaderB', - noParam: this.specificNoParam, - withParam: this.SpecificWithParam('WithParamB'), - footer: 'FooterB' - }) - } - } -} -``` - -![builder1](figures/builder1.PNG) - -### 尾随闭包初始化组件 - -在自定义组件中使用@BuilderParam修饰的属性时也可通过尾随闭包进行初始化(在初始化自定义组件时,组件后紧跟一个大括号“{}”形成尾随闭包场景(`CustomContainer(){}`)。开发者可把尾随闭包看做一个容器,向其中填充内容,如在闭包内增加组件(`{Column(){...}`),闭包内语法规范与build函数一致。此场景下自定义组件内有且仅有一个使用@BuilderParam修饰的属性。 - -示例:在闭包内添加Column组件并设置点击事件,在Column组件内调用@Builder修饰的specificParam函数,点击Column组件后将自定义组件CustomContainer中header的属性值由“header”改变为“changeHeader”。在初始化自定义组件CustomContainer时,尾随闭包的内容会被赋值给@BuilderParam修饰的closer属性。 - -```ts -// xxx.ets -@Component -struct CustomContainer { - header: string = '' - @BuilderParam closer: () => void - - build() { - Column() { - Text(this.header) - .fontSize(30) - this.closer() - } - } -} - -@Builder function specificParam(label1: string, label2: string) { - Column() { - Text(label1) - .fontSize(30) - Text(label2) - .fontSize(30) - } -} - -@Entry -@Component -struct CustomContainerUser { - @State text: string = 'header' - - build() { - Column() { - CustomContainer({ - header: this.text, - }) { - Column() { - specificParam('testA', 'testB') - }.backgroundColor(Color.Yellow) - .onClick(() => { - this.text = 'changeHeader' - }) - } - } - } -} -``` - -![builder2](figures/builder2.gif) - -## @Styles - -ArkTS为了避免开发者对重复样式的设置,通过@Styles装饰器可以将多个样式设置提炼成一个方法,直接在组件声明时调用,通过@Styles装饰器可以快速定义并复用自定义样式。当前@Styles仅支持通用属性。 - -@Styles可以定义在组件内或组件外,在组件外定义时需在方法名前面添加function关键字,组件内定义时则不需要添加function关键字。 - -```ts -// xxx.ets -@Styles function globalFancy () { - .width(150) - .height(100) - .backgroundColor(Color.Pink) -} - -@Entry -@Component -struct FancyUse { - @Styles componentFancy() { - .width(100) - .height(200) - .backgroundColor(Color.Yellow) - } - - build() { - Column({ space: 10 }) { - Text('FancyA') - .globalFancy() - .fontSize(30) - Text('FancyB') - .globalFancy() - .fontSize(20) - Text('FancyC') - .componentFancy() - .fontSize(30) - Text('FancyD') - .componentFancy() - .fontSize(20) - } - } -} -``` - -![styles](figures/styles.PNG) - -@Styles还可以在[StateStyles](../reference/arkui-ts/ts-universal-attributes-polymorphic-style.md)属性内部使用,在组件处于不同的状态时赋予相应的属性。 - -在StateStyles内可以直接调用组件外定义的@Styles方法,但需要通过this关键字调用组件内定义的@Styles方法。 - -```ts -// xxx.ets -@Styles function globalFancy () { - .width(120) - .height(120) - .backgroundColor(Color.Green) -} - -@Entry -@Component -struct FancyUse { - @Styles componentFancy() { - .width(80) - .height(80) - .backgroundColor(Color.Red) - } - - build() { - Row({ space: 10 }) { - Button('Fancy') - .stateStyles({ - normal: { - .width(100) - .height(100) - .backgroundColor(Color.Blue) - }, - disabled: this.componentFancy, - pressed: globalFancy - }) - } - } -} -``` - -![styles1](figures/styles1.gif) - -## @Extend - -@Extend装饰器将新的属性方法添加到Text、Column、Button等内置组件上,通过@Extend装饰器可以快速地扩展原生组件。@Extend不能定义在自定义组件struct内。 - -```ts -// xxx.ets -@Extend(Text) function fancy (fontSize: number) { - .fontColor(Color.Red) - .fontSize(fontSize) - .fontStyle(FontStyle.Italic) - .fontWeight(600) -} - -@Entry -@Component -struct FancyUse { - build() { - Row({ space: 10 }) { - Text("Fancy") - .fancy(16) - Text("Fancy") - .fancy(24) - Text("Fancy") - .fancy(32) - } - } -} - -``` - -> **说明:** -> -> - @Extend装饰器不能定义在自定义组件struct内。 -> - @Extend装饰器内仅支持属性方法设置。 - -![extend](figures/extend.PNG) - -## @CustomDialog - -@CustomDialog装饰器用于装饰自定义弹窗组件,使得弹窗可以动态设置内容及样式。 - -```ts -// xxx.ets -@CustomDialog -struct DialogExample { - controller: CustomDialogController - action: () => void - - build() { - Row() { - Button('Close CustomDialog') - .onClick(() => { - this.controller.close() - this.action() - }) - }.padding(20) - } -} - -@Entry -@Component -struct CustomDialogUser { - dialogController: CustomDialogController = new CustomDialogController({ - builder: DialogExample({ action: this.onAccept }), - cancel: this.existApp, - autoCancel: true - }); - - onAccept() { - console.info('onAccept'); - } - - existApp() { - console.info('Cancel dialog!'); - } - - build() { - Column() { - Button('Click to open Dialog') - .onClick(() => { - this.dialogController.open() - }) - } - } -} -``` - -![customdialog](figures/customDialog.gif) \ No newline at end of file diff --git a/zh-cn/application-dev/quick-start/arkts-environment.md b/zh-cn/application-dev/quick-start/arkts-environment.md new file mode 100644 index 0000000000000000000000000000000000000000..4e69f5950e81eace3d8b06d0c034595160ab72f8 --- /dev/null +++ b/zh-cn/application-dev/quick-start/arkts-environment.md @@ -0,0 +1,72 @@ +# Environment:设备环境查询 + + +开发者如果需要应用程序运行的设备的环境参数,以此来作出不同的场景判断,比如多语言,暗黑模式等,需要用到Environment设备环境查询。 + + +Environment是ArkUI框架在应用程序启动时创建的单例对象。它为AppStorage提供了一系列描述应用程序运行状态的属性。Environment的所有属性都是不可变的(即应用不可写入),所有的属性都是简单类型。 + + +## 使用场景 + + +### 从UI中访问Environment参数 + +- 使用Environment.EnvProp将设备运行的环境变量存入AppStorage中: + + ```ts + // 将设备的语言code存入AppStorage,默认值为en + // 后续设备的语言设置切换,都将同步到AppStorage中 + Environment.EnvProp('languageCode', 'en'); + ``` + +- 可以使用\@StorageProp链接到Component中。Component会根据设备运行环境的变化而更新: + + ```ts + @StorageProp('languageCode') lang : string = 'en'; + ``` + +设备环境到Component的更新链:Environment --> AppStorage -->Component。 + +> **说明:** +> +> \@StorageProp关联的环境参数可以在本地更改,但不能同步回AppStorage中,因为应用对环境变量参数是不可写的,只能在Environment中查询。 + + +```ts +// 将设备languageCode存入AppStorage中 +Environment.EnvProp('languageCode', 'en'); +let enable = AppStorage.Get('languageCode'); + +@Entry +@Component +struct Index { + @StorageProp('languageCode') languageCode: string = 'en'; + + build() { + Row() { + Column() { + // 输出当前设备的languageCode + Text(this.languageCode) + } + } + } +} +``` + + +### 应用逻辑使用Environment + + +```ts +// 使用Environment.EnvProp将设备运行languageCode存入AppStorage中; +Environment.EnvProp('languageCode', 'en'); +// 从AppStorage获取单向绑定的languageCode的变量 +const lang: SubscribedAbstractProperty = AppStorage.Prop('languageCode'); + +if (lang.get() === 'zh') { + console.info('你好'); +} else { + console.info('Hello!'); +} +``` diff --git a/zh-cn/application-dev/quick-start/arkts-extend.md b/zh-cn/application-dev/quick-start/arkts-extend.md new file mode 100644 index 0000000000000000000000000000000000000000..450ec1b2450138023f7abf4b55ee0a857bbf72ed --- /dev/null +++ b/zh-cn/application-dev/quick-start/arkts-extend.md @@ -0,0 +1,176 @@ +# \@Extend:定义扩展组件样式 + + +在前文的示例中,可以使用\@Styles用于样式的扩展,在\@Styles的基础上,我们提供了\@Extend,用于扩展原生组件样式。 + + +> **说明:** +> 从API version 9开始,该装饰器支持在ArkTS卡片中使用。 + + +## 装饰器使用说明 + + +### 语法 + + +```ts +@Extend(UIComponentName) function functionName { ... } +``` + + +### 使用规则 + +- 和\@Styles不同,\@Extend仅支持定义在全局,不支持在组件内部定义。 + +- 和\@Styles不同,\@Extend支持封装指定的组件的私有属性和私有事件和预定义相同组件的\@Extend的方法。 + + ```ts + // @Extend(Text)可以支持Text的私有属性fontColor + @Extend(Text) function fancy () { + .fontColor(Color.Red) + } + // superFancyText可以调用预定义的fancy + @Extend(Text) function superFancyText(size:number) { + .fontSize(size) + .fancy() + } + ``` + + +- 和\@Styles不同,\@Extend装饰的方法支持参数,开发者可以在调用时传递参数,调用遵循TS方法传值调用。 + + ```ts + // xxx.ets + @Extend(Text) function fancy (fontSize: number) { + .fontColor(Color.Red) + .fontSize(fontSize) + } + + @Entry + @Component + struct FancyUse { + build() { + Row({ space: 10 }) { + Text('Fancy') + .fancy(16) + Text('Fancy') + .fancy(24) + } + } + } + ``` + +- \@Extend装饰的方法的参数可以为function,作为Event事件的句柄。 + + ```ts + @Extend(Text) function makeMeClick(onClick: () => void) { + .backgroundColor(Color.Blue) + .onClick(onClick) + } + + @Entry + @Component + struct FancyUse { + @State label: string = 'Hello World'; + + onClickHandler() { + this.label = 'Hello ArkUI'; + } + + build() { + Row({ space: 10 }) { + Text(`${this.label}`) + .makeMeClick(this.onClickHandler.bind(this)) + } + } + } + ``` + +- \@Extend的参数可以为[状态变量](arkts-state-management-overview.md),当状态变量改变时,UI可以正常的被刷新渲染。 + + ```ts + @Extend(Text) function fancy (fontSize: number) { + .fontColor(Color.Red) + .fontSize(fontSize) + } + + @Entry + @Component + struct FancyUse { + @State fontSizeValue: number = 20 + build() { + Row({ space: 10 }) { + Text('Fancy') + .fancy(this.fontSizeValue) + .onClick(() => { + this.fontSizeValue = 30 + }) + } + } + } + ``` + + +## 使用场景 + +以下示例声明了3个Text组件,每个Text组件均设置了fontStyle、fontWeight和backgroundColor样式。 + + +```ts +@Entry +@Component +struct FancyUse { + @State label: string = 'Hello World' + + build() { + Row({ space: 10 }) { + Text(`${this.label}`) + .fontStyle(FontStyle.Italic) + .fontWeight(100) + .backgroundColor(Color.Blue) + Text(`${this.label}`) + .fontStyle(FontStyle.Italic) + .fontWeight(200) + .backgroundColor(Color.Pink) + Text(`${this.label}`) + .fontStyle(FontStyle.Italic) + .fontWeight(300) + .backgroundColor(Color.Orange) + }.margin('20%') + } +} +``` + +\@Extend将样式组合复用,示例如下。 + + +```ts +@Extend(Text) function fancyText(weightValue: number, color: Color) { + .fontStyle(FontStyle.Italic) + .fontWeight(weightValue) + .backgroundColor(color) +} +``` + +通过\@Extend组合样式后,使得代码更加简洁,增强可读性。 + + +```ts +@Entry +@Component +struct FancyUse { + @State label: string = 'Hello World' + + build() { + Row({ space: 10 }) { + Text(`${this.label}`) + .fancyText(100, Color.Blue) + Text(`${this.label}`) + .fancyText(200, Color.Pink) + Text(`${this.label}`) + .fancyText(200, Color.Orange) + }.margin('20%') + } +} +``` diff --git a/zh-cn/application-dev/quick-start/arkts-get-started.md b/zh-cn/application-dev/quick-start/arkts-get-started.md index af97f571b9c0fa336d501b3cd322f65e61fb2cd4..378d07d84d7608023257b25cdb4dab983b9cc674 100644 --- a/zh-cn/application-dev/quick-start/arkts-get-started.md +++ b/zh-cn/application-dev/quick-start/arkts-get-started.md @@ -1,30 +1,17 @@ # 初识ArkTS语言 -ArkTS是OpenHarmony优选的主力应用开发语言。ArkTS基于TypeScript(简称TS)语言扩展而来,是TS的超集。 -- ArkTS继承了TS的所有特性。 +ArkTS是OpenHarmony优选的主力应用开发语言。ArkTS围绕应用开发在[TypeScript](https://www.typescriptlang.org/)(简称TS)生态基础上做了进一步扩展,继承了TS的所有特性,是TS的超集。因此,在学习ArkTS语言之前,建议开发者具备TS语言开发能力。 -- 当前,ArkTS在TS的基础上主要扩展了[声明式UI](arkts-basic-ui-description.md)能力,让开发者能够以更简洁、更自然的方式开发高性能应用。 - 当前扩展的声明式UI能力包括如下特性。 +当前,ArkTS在TS的基础上主要扩展了如下能力: - - [基本UI描述](arkts-basic-ui-description.md):ArkTS定义了各种装饰器、自定义组件、UI描述机制,再配合UI开发框架中的内置组件及其相关的事件方法、属性方法等共同构成了UI开发的主体。 - - [状态管理](arkts-state-mgmt-page-level.md):ArkTS提供了多维度的状态管理机制,在UI开发框架中,和UI相关联的数据,不仅可以在组件内使用,还可以在不同组件层级间传递,比如父子组件之间、爷孙组件之间,也可以是应用全局范围内的传递,还可以是跨设备传递。另外,从数据的传递形式来看,可分为只读的单向传递和可变更的双向传递。开发者可以灵活的利用这些能力来实现数据和UI的联动。 - - [动态构建UI元素](arkts-dynamic-ui-elememt-building.md):ArkTS提供了动态构建UI元素的能力,不仅可以自定义组件内部的UI结构,还可以复用组件样式,扩展原生组件。 - - [渲染控制](arkts-rendering-control.md):ArkTS提供了渲染控制的能力。条件渲染可根据应用的不同状态,渲染对应状态下的UI内容。循环渲染可从数据源中迭代获取数据,并在每次迭代过程中创建相应的组件。 - - [使用限制与扩展](arkts-restrictions-and-extensions.md):ArkTS在使用过程中存在限制与约束,同时也扩展了双向绑定等能力。 -- 未来,ArkTS会结合应用开发/运行的需求持续演进,逐步提供并行和并发能力增强、系统类型增强、分布式开发范式等更多特性。 +- [基本语法](arkts-basic-syntax-overview.md):ArkTS定义了声明式UI描述、自定义组件和动态扩展UI元素的能力,再配合ArkUI开发框架中的系统组件及其相关的事件方法、属性方法等共同构成了UI开发的主体。 -下面我们以一个具体的示例来说明ArkTS的基本组成。如下图所示的代码示例,UI界面包含两段文本、一条分割线和一个按钮,当开发者点击按钮时,文本内容会从'Hello World'变为 'Hello ArkUI'。 +- [状态管理](arkts-state-management-overview.md):ArkTS提供了多维度的状态管理机制。在UI开发框架中,与UI相关联的数据可以在组件内使用,也可以在不同组件层级间传递,比如父子组件之间、爷孙组件之间,还可以在应用全局范围内传递或跨设备传递。另外,从数据的传递形式来看,可分为只读的单向传递和可变更的双向传递。开发者可以灵活的利用这些能力来实现数据和UI的联动。 -![arkts-get-started](figures/arkts-get-started.png) +- [渲染控制](arkts-rendering-control-overview.md):ArkTS提供了渲染控制的能力。条件渲染可根据应用的不同状态,渲染对应状态下的UI内容。循环渲染可从数据源中迭代获取数据,并在每次迭代过程中创建相应的组件。数据懒加载从数据源中按需迭代数据,并在每次迭代过程中创建相应的组件。 -这个示例中所包含的ArkTS声明式开发范式的基本组成说明如下: -- 装饰器: 用于装饰类、结构、方法以及变量,赋予其特殊的含义,如上述示例中@Entry、@Component和@State都是装饰器。 具体而言,@Component表示这是个自定义组件;@Entry则表示这是个入口组件;@State表示这是组件中的状态变量,这个变量变化会触发UI刷新。 -- 自定义组件:可复用的UI单元,可组合其他组件,如上述被@Component装饰的struct Hello。 -- UI描述:声明式的方法来描述UI的结构,例如build()方法中的代码块。 -- 内置组件:ArkTS中默认内置的基础组件、容器组件、媒体组件、绘制组件、画布组件等各种组件,开发者可以直接调用,如示例中的Column、Text、Divider、Button等。 -- 属性方法:用于组件属性的配置,如fontSize()、width()、height()、color()等,可通过链式调用的方式设置多项属性。 -- 事件方法:用于添加组件对事件的响应逻辑,如跟随在Button后面的onClick(),同样可以通过链式调用的方式设置多个事件响应逻辑。 +未来,ArkTS会结合应用开发/运行的需求持续演进,逐步提供并行和并发能力增强、系统类型增强、分布式开发范式等更多特性。 diff --git a/zh-cn/application-dev/quick-start/arkts-link.md b/zh-cn/application-dev/quick-start/arkts-link.md new file mode 100644 index 0000000000000000000000000000000000000000..023deb552d0bf44e7d004f8dc8117c411ab7172d --- /dev/null +++ b/zh-cn/application-dev/quick-start/arkts-link.md @@ -0,0 +1,188 @@ +# \@Link:父子双向同步 + + +子组件中被\@Link装饰的变量与其父组件中对应的数据源建立双向数据绑定。 + + +> **说明:** +> +> 从API version 9开始,该装饰器支持在ArkTS卡片中使用。 + + +## 概述 + +\@Link装饰的变量与其父组件中的数据源共享相同的值。 + + +## 装饰器使用规则说明 + +| \@Link变量装饰器 | 说明 | +| ----------- | ---------------------------------------- | +| 装饰器参数 | 无 | +| 同步类型 | 双向同步。
父组件中\@State, \@StorageLink和\@Link 和子组件\@Link可以建立双向数据同步,反之亦然。 | +| 允许装饰的变量类型 | Object、class、string、number、boolean、enum类型,以及这些类型的数组。嵌套类型的场景请参考[观察变化](#观察变化)。
类型必须被指定,且和双向绑定状态变量的类型相同。
不支持any,不支持简单类型和复杂类型的联合类型,不允许使用undefined和null。
**说明:**
不支持Length、ResourceStr、ResourceColor类型,Length、ResourceStr、ResourceColor为简单类型和复杂类型的联合类型。 | +| 被装饰变量的初始值 | 无,禁止本地初始化。 | + + +## 变量的传递/访问规则说明 + +| 传递/访问 | 说明 | +| ---------- | ---------------------------------------- | +| 从父组件初始化和更新 | 必选。与父组件\@State, \@StorageLink和\@Link 建立双向绑定。允许父组件中\@State、\@Link、\@Prop、\@Provide、\@Consume、\@ObjectLink、\@StorageLink、\@StorageProp、\@LocalStorageLink和\@LocalStorageProp装饰变量初始化子组件\@Link。
从API version 9开始,\@Link子组件从父组件初始化\@State的语法为Comp({ aLink: this.aState })。同样Comp({aLink: $aState})也支持。 | +| 用于初始化子组件 | 允许,可用于初始化常规变量、\@State、\@Link、\@Prop、\@Provide。 | +| 是否支持组件外访问 | 私有,只能在所属组件内访问。 | + + **图1** 初始化规则图示   + +![zh-cn_image_0000001502092556](figures/zh-cn_image_0000001502092556.png) + + +## 观察变化和行为表现 + + +### 观察变化 + +- 当装饰的数据类型为boolean、string、number类型时,可以同步观察到数值的变化,示例请参考[简单类型和类对象类型的@Link](#简单类型和类对象类型的link)。 + +- 当装饰的数据类型为class或者Object时,可以观察到赋值和属性赋值的变化,即Object.keys(observedObject)返回的所有属性,示例请参考[简单类型和类对象类型的@Link](#简单类型和类对象类型的link)。 + +- 当装饰的对象是array时,可以观察到数组添加、删除、更新数组单元的变化,示例请参考[数组类型的@Link](#数组类型的link)。 + + +### 框架行为 + +\@Link装饰的变量和其所述的自定义组件共享生命周期。 + +为了了解\@Link变量初始化和更新机制,有必要先了解父组件和和拥有\@Link变量的子组件的关系,初始渲染和双向更新的流程(以父组件为\@State为例)。 + +1. 初始渲染:执行父组件的build()函数后将创建子组件的新实例。初始化过程如下: + 1. 必须指定父组件中的\@State变量,用于初始化子组件的\@Link变量。子组件的\@Link变量值与其父组件的数据源变量保持同步(双向数据同步)。 + 2. 父组件的\@State状态变量包装类通过构造函数传给子组件,子组件的\@Link包装类拿到父组件的\@State的状态变量后,将当前\@Link包装类this指针注册给父组件的\@State变量。 + +2. \@Link的数据源的更新:即父组件中状态变量更新,引起相关子组件的\@Link的更新。处理步骤: + 1. 通过初始渲染的步骤可知,子组件\@Link包装类把当前this指针注册给父组件。父组件\@State变量变更后,会遍历更新所有依赖它的系统组件(elementid)和状态变量(比如\@Link包装类)。 + 2. 通知\@Link包装类更新后,子组件中所有依赖\@Link状态变量的系统组件(elementId)都会被通知更新。以此实现父组件对子组件的状态数据同步。 + +3. \@Link的更新:当子组件中\@Link更新后,处理步骤如下(以父组件为\@State为例): + 1. \@Link更新后,调用父组件的\@State包装类的set方法,将更新后的数值同步回父组件。 + 2. 子组件\@Link和父组件\@State分别遍历依赖的系统组件,进行对应的UI的更新。以此实现子组件\@Link同步回父组件\@State。 + + +## 使用场景 + + +### 简单类型和类对象类型的\@Link + +以下示例中,点击父组件ShufflingContainer中的“Parent View: Set yellowButton”和“Parent View: Set GreenButton”,可以从父组件将变化同步给子组件,子组件GreenButton和YellowButton中\@Link装饰变量的变化也会同步给其父组件。 + + +```ts +class GreenButtonState { + width: number = 0; + constructor(width: number) { + this.width = width; + } +} +@Component +struct GreenButton { + @Link greenButtonState: GreenButtonState; + build() { + Button('Green Button') + .width(this.greenButtonState.width) + .height(150.0) + .backgroundColor('#00ff00') + .onClick(() => { + if (this.greenButtonState.width < 700) { + // 更新class的属性,变化可以被观察到同步回父组件 + this.greenButtonState.width += 125; + } else { + // 更新class,变化可以被观察到同步回父组件 + this.greenButtonState = new GreenButtonState(100); + } + }) + } +} +@Component +struct YellowButton { + @Link yellowButtonState: number; + build() { + Button('Yellow Button') + .width(this.yellowButtonState) + .height(150.0) + .backgroundColor('#ffff00') + .onClick(() => { + // 子组件的简单类型可以同步回父组件 + this.yellowButtonState += 50.0; + }) + } +} +@Entry +@Component +struct ShufflingContainer { + @State greenButtonState: GreenButtonState = new GreenButtonState(300); + @State yellowButtonProp: number = 100; + build() { + Column() { + // 简单类型从父组件@State向子组件@Link数据同步 + Button('Parent View: Set yellowButton') + .onClick(() => { + this.yellowButtonProp = (this.yellowButtonProp < 700) ? this.yellowButtonProp + 100 : 100; + }) + // class类型从父组件@State向子组件@Link数据同步 + Button('Parent View: Set GreenButton') + .onClick(() => { + this.greenButtonState.width = (this.greenButtonState.width < 700) ? this.greenButtonState.width + 100 : 100; + }) + // class类型初始化@Link + GreenButton({ greenButtonState: $greenButtonState }) + // 简单类型初始化@Link + YellowButton({ yellowButtonState: $yellowButtonProp }) + } + } +} +``` + + +### 数组类型的\@Link + + +```ts +@Component +struct Child { + @Link items: number[]; + + build() { + Column() { + Button(`Button1: push`).onClick(() => { + this.items.push(this.items.length + 1); + }) + Button(`Button2: replace whole item`).onClick(() => { + this.items = [100, 200, 300]; + }) + } + } +} + +@Entry +@Component +struct Parent { + @State arr: number[] = [1, 2, 3]; + + build() { + Column() { + Child({ items: $arr }) + ForEach(this.arr, + item => { + Text(`${item}`) + }, + item => item.toString() + ) + } + } +} +``` + + +上文所述,ArkUI框架可以观察到数组元素的添加,删除和替换。在该示例中\@State和\@Link的类型是相同的number[],不允许将\@Link定义成number类型(\@Link item : number),并在父组件中用\@State数组中每个数据项创建子组件。如果要使用这个场景,可以参考[\@Prop](arkts-prop.md)和\@Observed。 + + diff --git a/zh-cn/application-dev/quick-start/arkts-localstorage.md b/zh-cn/application-dev/quick-start/arkts-localstorage.md new file mode 100644 index 0000000000000000000000000000000000000000..e7d0df5b2ce5a7ffb1973b18cfdec3254a897c32 --- /dev/null +++ b/zh-cn/application-dev/quick-start/arkts-localstorage.md @@ -0,0 +1,427 @@ +# LocalStorage:页面级UI状态存储 + + +LocalStorage是页面级的UI状态存储,通过\@Entry装饰器接受的参数可以在页面内共享同一个LocalStorage实例。LocalStorage也可以在UIAbility内,页面间共享状态。 + + +本文仅介绍LocalStorage使用场景和相关的装饰器:\@LocalStorageProp和\@LocalStorageLink。 + + +> **说明:** +> +> 本模块从API version 9开始支持。 + + +## 概述 + +LocalStorage是ArkTS为构建页面级别状态变量提供存储的内存内“数据库”。 + +- 应用程序可以创建多个LocalStorage实例,LocalStorage实例可以在页面内共享,也可以通过GetShared接口,获取在UIAbility里创建的GetShared,实现跨页面、UIAbility内共享。 + +- 组件树的根节点,即被\@Entry装饰的\@Component,可以被分配一个LocalStorage实例,此组件的所有子组件实例将自动获得对该LocalStorage实例的访问权限; + +- 被\@Component装饰的组件最多可以访问一个LocalStorage实例和[AppStorage](arkts-appstorage.md),未被\@Entry装饰的组件不可被独立分配LocalStorage实例,只能接受父组件通过\@Entry传递来的LocalStorage实例。一个LocalStorage实例在组件树上可以被分配给多个组件。 + +- LocalStorage中的所有属性都是可变的。 + +应用程序决定LocalStorage对象的生命周期。当应用释放最后一个指向LocalStorage的引用时,比如销毁最后一个自定义组件,LocalStorage将被JS Engine垃圾回收。 + +LocalStorage根据与\@Component装饰的组件的的同步类型不同,提供了两个装饰器: + +- [@LocalStorageProp](#localstorageprop):\@LocalStorageProp装饰的变量和与LocalStorage中给定属性建立单行同步关系。 + +- [@LocalStorageLink](#localstoragelink):\@LocalStorageLink装饰的变量和在\@Component中创建与LocalStorage中给定属性建立双向同步关系。 + + +## 限制条件 + +LocalStorage创建后,命名属性的类型不可更改。后续调用Set时必须使用相同类型的值。 + + +## \@LocalStorageProp + +在上文中已经提到,如果要建立LocalStorage和自定义组件的联系,需要使用\@LocalStorageProp和\@LocalStorageLink装饰器。使用\@LocalStorageProp(key)/\@LocalStorageLink(key)装饰组件内的变量,key标识了LocalStorage的属性。 + + +当自定义组件初始化的时候,\@LocalStorageProp(key)/\@LocalStorageLink(key)装饰的变量会通过给定的key,绑定在LocalStorage对应是属性,完成初始化。本地初始化是必要的,因为无法保证LocalStorage一定存在给定的key(这取决于应用逻辑,是否在组件初始化之前在LocalStorage实例中存入对应的属性)。 + + +> **说明:** +> +> 从API version 9开始,该装饰器支持在ArkTS卡片中使用。 + + +\@LocalStorageProp(key)是和LocalStorage中key对应的属性建立单向数据同步,我们允许本地改变的发生,但是对于\@LocalStorageProp,本地的修改永远不会同步回LocalStorage中,相反,如果LocalStorage给定key的属性发生改变,改变会被同步给\@LocalStorageProp,并覆盖掉本地的修改。 + + +### 装饰器使用规则说明 + +| \@LocalStorageProp变量装饰器 | 说明 | +| ----------------------- | ---------------------------------------- | +| 装饰器参数 | key:常量字符串,必填(字符串需要有引号)。 | +| 允许装饰的变量类型 | Object、class、string、number、boolean、enum类型,以及这些类型的数组。嵌套类型的场景请参考[观察变化和行为表现](#观察变化和行为表现)。
类型必须被指定,且必须和LocalStorage中对应属性相同。不支持any,不允许使用undefined和null。 | +| 同步类型 | 单向同步:从LocalStorage的对应属性到组件的状态变量。组件本地的修改是允许的,但是LocalStorage中给定的属性一旦发生变化,将覆盖本地的修改。 | +| 被装饰变量的初始值 | 必须指定,如果LocalStorage实例中不存在属性,则作为初始化默认值,并存入LocalStorage中。 | + + +### 变量的传递/访问规则说明 + +| 传递/访问 | 说明 | +| ---------- | ---------------------------------------- | +| 从父节点初始化和更新 | 禁止,\@LocalStorageProp不支持从父节点初始化,只能从LocalStorage中key对应的属性初始化,如果没有对应key的话,将使用本地默认值初始化。 | +| 初始化子节点 | 支持,可用于初始化\@State、\@Link、\@Prop、\@Provide。 | +| 是否支持组件外访问 | 否。 | + + **图1** \@LocalStorageProp初始化规则图示   + +![zh-cn_image_0000001501936014](figures/zh-cn_image_0000001501936014.png) + + +### 观察变化和行为表现 + +**观察变化** + + +- 当装饰的数据类型为boolean、string、number类型时,可以观察到数值的变化。 + +- 当装饰的数据类型为class或者Object时,可以观察到赋值和属性赋值的变化,即Object.keys(observedObject)返回的所有属性。 + +- 当装饰的对象是array时,可以观察到数组添加、删除、更新数组单元的变化。 + + +**框架行为** + + +- 当\@LocalStorageProp(key)装饰的数值改变被观察到时,修改不会被同步回LocalStorage对应属性键值key的属性中。 + +- 当前\@LocalStorageProp(key)单向绑定的数据会被修改,即仅限于当前组件的私有成员变量改变,其他的绑定该key的数据不会同步改变。 + +- 当\@LocalStorageProp(key)装饰的数据本身是状态变量,它的改变虽然不会同步回LocalStorage中,但是会引起所属的自定义组件的重新渲染。 + +- 当LocalStorage中key对应的属性发生改变时,会同步给所有\@LocalStorageProp(key)装饰的数据,\@LocalStorageProp(key)本地的修改将被覆盖。 + + +## \@LocalStorageLink + +如果我们需要将自定义组件的状态变量的更新同步回LocalStorage,就需要用到\@LocalStorageLink。 + +\@LocalStorageLink(key)是和LocalStorage中key对应的属性建立双向数据同步: + +1. 本地修改发生,该修改会被回LocalStorage中; + +2. LocalStorage中的修改发生后,该修改会被同步到所有绑定LocalStorage对应key的属性上,包括单向(\@LocalStorageProp和通过prop创建的单向绑定变量)、双向(\@LocalStorageLink和通过link创建的双向绑定变量)变量。 + + +### 装饰器使用规则说明 + +| \@LocalStorageLink变量装饰器 | 说明 | +| ----------------------- | ---------------------------------------- | +| 装饰器参数 | key:常量字符串,必填(字符串需要有引号)。 | +| 允许装饰的变量类型 | Object、class、string、number、boolean、enum类型,以及这些类型的数组。嵌套类型的场景请参考[观察变化和行为表现](#观察变化和行为表现)。
类型必须被指定,且必须和LocalStorage中对应属性相同。不支持any,不允许使用undefined和null。 | +| 同步类型 | 双向同步:从LocalStorage的对应属性到自定义组件,从自定义组件到LocalStorage对应属性。 | +| 被装饰变量的初始值 | 必须指定,如果LocalStorage实例中不存在属性,则作为初始化默认值,并存入LocalStorage中。 | + + +### 变量的传递/访问规则说明 + +| 传递/访问 | 说明 | +| ---------- | ---------------------------------------- | +| 从父节点初始化和更新 | 禁止,\@LocalStorageLink不支持从父节点初始化,只能从LocalStorage中key对应的属性初始化,如果没有对应key的话,将使用本地默认值初始化。 | +| 初始化子节点 | 支持,可用于初始化\@State、\@Link、\@Prop、\@Provide。 | +| 是否支持组件外访问 | 否。 | + + + **图2** \@LocalStorageLink初始化规则图示   + + +![zh-cn_image_0000001552855957](figures/zh-cn_image_0000001552855957.png) + + +### 观察变化和行为表现 + +**观察变化** + + +- 当装饰的数据类型为boolean、string、number类型时,可以观察到数值的变化。 + +- 当装饰的数据类型为class或者Object时,可以观察到赋值和属性赋值的变化,即Object.keys(observedObject)返回的所有属性。 + +- 当装饰的对象是array时,可以观察到数组添加、删除、更新数组单元的变化。 + + +**框架行为** + + +1. 当\@LocalStorageLink(key)装饰的数值改变被观察到时,修改将被同步回LocalStorage对应属性键值key的属性中。 + +2. LocalStorage中属性键值key对应的数据一旦改变,属性键值key绑定的所有的数据(包括双向\@LocalStorageLink和单向\@LocalStorageProp)都将同步修改; + +3. 当\@LocalStorageLink(key)装饰的数据本身是状态变量,它的改变不仅仅会同步回LocalStorage中,还会引起所属的自定义组件的重新渲染。 + + +## 使用场景 + + +### 应用逻辑使用LocalStorage + + +```ts +let storage = new LocalStorage({ 'PropA': 47 }); // 创建新实例并使用给定对象初始化 +let propA = storage.get('PropA') // propA == 47 +let link1 = storage.link('PropA'); // link1.get() == 47 +let link2 = storage.link('PropA'); // link2.get() == 47 +let prop = storage.prop('PropA'); // prop.get() = 47 +link1.set(48); // two-way sync: link1.get() == link2.get() == prop.get() == 48 +prop.set(1); // one-way sync: prop.get()=1; but link1.get() == link2.get() == 48 +link1.set(49); // two-way sync: link1.get() == link2.get() == prop.get() == 49 +``` + + +### 从UI内部使用LocalStorage + +除了应用程序逻辑使用LocalStorage,还可以借助LocalStorage相关的两个装饰器\@LocalStorageProp和\@LocalStorageLink,在UI组件内部获取到LocalStorage实例中存储的状态变量。 + +本示例以\@LocalStorage为例,展示了: + +- 使用构造函数创建LocalStorage实例storage; + +- 使用\@Entry装饰器将storage添加到CompA顶层组件中; + +- \@LocalStorageLink绑定LocalStorage对给定的属性,建立双向数据同步。 + + ```ts + // 创建新实例并使用给定对象初始化 + let storage = new LocalStorage({ 'PropA': 47 }); + + @Component + struct Child { + // @LocalStorageLink变量装饰器与LocalStorage中的'ProA'属性建立双向绑定 + @LocalStorageLink('PropA') storLink2: number = 1; + + build() { + Button(`Child from LocalStorage ${this.storLink2}`) + // 更改将同步至LocalStorage中的'ProA'以及Parent.storLink1 + .onClick(() => this.storLink2 += 1) + } + } + // 使LocalStorage可从@Component组件访问 + @Entry(storage) + @Component + struct CompA { + // @LocalStorageLink变量装饰器与LocalStorage中的'ProA'属性建立双向绑定 + @LocalStorageLink('PropA') storLink1: number = 1; + + build() { + Column({ space: 15 }) { + Button(`Parent from LocalStorage ${this.storLink1}`) // initial value from LocalStorage will be 47, because 'PropA' initialized already + .onClick(() => this.storLink1 += 1) + // @Component子组件自动获得对CompA LocalStorage实例的访问权限。 + Child() + } + } + } + ``` + + +### \@LocalStorageProp和LocalStorage单向同步的简单场景 + +在下面的示例中,CompA 组件和Child组件分别在本地创建了与storage的'PropA'对应属性的单向同步的数据,我们可以看到: + +- CompA中对this.storProp1的修改,只会在CompA中生效,并没有同步回storage; + +- Child组件中,Text绑定的storProp2 依旧显示47。 + + ```ts + // 创建新实例并使用给定对象初始化 + let storage = new LocalStorage({ 'PropA': 47 }); + // 使LocalStorage可从@Component组件访问 + @Entry(storage) + @Component + struct CompA { + // @LocalStorageProp变量装饰器与LocalStorage中的'ProA'属性建立单向绑定 + @LocalStorageProp('PropA') storProp1: number = 1; + + build() { + Column({ space: 15 }) { + // 点击后从47开始加1,只改变当前组件显示的storProp1,不会同步到LocalStorage中 + Button(`Parent from LocalStorage ${this.storProp1}`) + .onClick(() => this.storProp1 += 1) + Child() + } + } + } + + @Component + struct Child { + // @LocalStorageProp变量装饰器与LocalStorage中的'ProA'属性建立单向绑定 + @LocalStorageProp('PropA') storProp2: number = 2; + + build() { + Column({ space: 15 }) { + // 当CompA改变时,当前storProp2不会改变,显示47 + Text(`Parent from LocalStorage ${this.storProp2}`) + } + } + } + ``` + + +### \@LocalStorageLink和LocalStorage双向同步的简单场景 + +下面的示例展示了\@LocalStorageLink装饰的数据和LocalStorage双向同步的场景 + + +```ts +// 构造LocalStorage实例 +let storage = new LocalStorage({ 'PropA': 47 }); +// 调用link9+接口构造'PropA'的双向同步数据,linkToPropA 是全部变量 +let linkToPropA = storage.link('PropA'); + +@Entry(storage) +@Component +struct CompA { + + // @LocalStorageLink('PropA')在CompA自定义组件中创建'PropA'的双向同步数据,初始值为47,因为在构造LocalStorage已经给“PropA”设置47 + @LocalStorageLink('PropA') storLink: number = 1; + + build() { + Column() { + Text(`incr @LocalStorageLink variable`) + // 点击“incr @LocalStorageLink variable”,this.storLink加1,改变同步回storage,全局变量linkToPropA也会同步改变 + + .onClick(() => this.storLink += 1) + + // 并不建议在组件内使用全局变量linkToPropA.get(),因为可能会有生命周期不同引起的错误。 + Text(`@LocalStorageLink: ${this.storLink} - linkToPropA: ${linkToPropA.get()}`) + } + } +} +``` + + +### 兄弟节点之间同步状态变量 + +下面的示例展示了通过\@LocalStorageLink双向同步兄弟节点之间的状态。 + +先看Parent自定义组件中发生的变化: + +1. 点击“countStorage ${this.playCount} incr by 1”,this.playCount减1,修改同步回LocalStorage中,Child组件中的playCountLink绑定的组件会同步刷新; + +2. 点击“countStorage ${this.playCount} incr by 1”,调用LocalStorage的set接口,更新LocalStorage中“countStorage”对应的属性,Child组件中的playCountLink绑定的组件会同步刷新; + +3. Text组件“playCount in LocalStorage for debug ${storage.get<number>('countStorage')}”没有同步刷新,原因是因为storage.get<number>('countStorage')返回的是常规变量,常规变量的更新并不会引起Text组件的重新渲染。 + +Child自定义组件中的变化: + +1. playCountLink的刷新会同步回LocalStorage,并且引起兄弟组件和父组件相应的刷新。 + + ```ts + let storage = new LocalStorage({ countStorage: 1 }); + + @Component + struct Child { + // 子组件实例的名字 + label: string = 'no name'; + // 和LocalStorage中“countStorage”的双向绑定数据 + @LocalStorageLink('countStorage') playCountLink: number = 0; + + build() { + Row() { + Text(this.label) + .width(50).height(60).fontSize(12) + Text(`playCountLink ${this.playCountLink}: inc by 1`) + .onClick(() => { + this.playCountLink += 1; + }) + .width(200).height(60).fontSize(12) + }.width(300).height(60) + } + } + + @Entry(storage) + @Component + struct Parent { + @LocalStorageLink('countStorage') playCount: number = 0; + + build() { + Column() { + Row() { + Text('Parent') + .width(50).height(60).fontSize(12) + Text(`playCount ${this.playCount} dec by 1`) + .onClick(() => { + this.playCount -= 1; + }) + .width(250).height(60).fontSize(12) + }.width(300).height(60) + + Row() { + Text('LocalStorage') + .width(50).height(60).fontSize(12) + Text(`countStorage ${this.playCount} incr by 1`) + .onClick(() => { + storage.set('countStorage', 1 + storage.get('countStorage')); + }) + .width(250).height(60).fontSize(12) + }.width(300).height(60) + + Child({ label: 'ChildA' }) + Child({ label: 'ChildB' }) + + Text(`playCount in LocalStorage for debug ${storage.get('countStorage')}`) + .width(300).height(60).fontSize(12) + } + } + } + ``` + + +### 将LocalStorage实例从UIAbility共享到一个或多个视图 + +上面的实例中,LocalStorage的实例仅仅在一个\@Entry装饰的组件和其所属的子组件(一个页面)中共享,如果希望其在多个视图中共享,可以在所属UIAbility中创建LocalStorage实例,并调用windowStage.[loadContent](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-window.md#loadcontent9)。 + + +```ts +// EntryAbility.ts +import UIAbility from '@ohos.app.ability.UIAbility'; +import window from '@ohos.window'; + +export default class EntryAbility extends UIAbility { + storage: LocalStorage = new LocalStorage({ + 'PropA': 47 + }); + + onWindowStageCreate(windowStage: window.WindowStage) { + windowStage.loadContent('pages/Index', this.storage); + } +} +``` + +在UI页面通过GetShared接口获取在通过loadContent共享的LocalStorage实例。 + + +```ts +// 通过GetShared接口获取stage共享的Storage实例 +let storage = LocalStorage.GetShared() + +@Entry(storage) +@Component +struct CompA { + // can access LocalStorage instance using + // @LocalStorageLink/Prop decorated variables + @LocalStorageLink('PropA') varA: number = 1; + + build() { + Column() { + Text(`${this.varA}`).fontSize(50) + } + } +} +``` + + +> **说明:** +> +> 对于开发者更建议使用这个方式来构建LocalStorage的实例,并且在创建LocalStorage实例的时候就写入默认值,因为默认值可以作为运行异常的备份,也可以用作页面的单元测试。 + + diff --git a/zh-cn/application-dev/quick-start/arkts-observed-and-objectlink.md b/zh-cn/application-dev/quick-start/arkts-observed-and-objectlink.md new file mode 100644 index 0000000000000000000000000000000000000000..fef50b05be6023bdbae9af402854d3dfe317ee4b --- /dev/null +++ b/zh-cn/application-dev/quick-start/arkts-observed-and-objectlink.md @@ -0,0 +1,383 @@ +# \@Observed和\@ObjectLink:嵌套类对象属性变化 + + +上文所述的装饰器仅能观察到第一层的变化,但是在实际应用开发中,应用会根据开发需要,封装自己的数据模型。对于多层嵌套的情况,比如二维数组,或者数组项class,或者class的属性是class,他们的第二层的属性变化是无法观察到的。这就引出了\@Observed/\@ObjectLink装饰器。 + + +> **说明:** +> +> 从API version 9开始,这两个装饰器支持在ArkTS卡片中使用。 + + +## 概述 + +\@ObjectLink和\@Observed类装饰器用于在涉及嵌套对象或数组的场景中进行双向数据同步: + +- 被\@Observed装饰的类,可以被观察到属性的变化; + +- 子组件中\@ObjectLink装饰器装饰的状态变量用于接受\@Observed装饰的类的实例,和父组件中对应的状态变量建立双向数据绑定。这个实例可以是数组中的被\@Observed装饰的项,或者是class object中是属性,这个属性同样也需要被\@Observed装饰。 + +- 单独使用\@Observed是没有任何作用的,需要搭配\@ObjectLink或者[\@Prop](arkts-prop.md)使用。 + + +## 装饰器说明 + +| \@Observed类装饰器 | 说明 | +| -------------- | --------------------------------- | +| 装饰器参数 | 无 | +| 类装饰器 | 装饰class。需要放在class的定义前,使用new创建类对象。 | + +| \@ObjectLink变量装饰器 | 说明 | +| ----------------- | ---------------------------------------- | +| 装饰器参数 | 无 | +| 同步类型 | 不与父组件中的任何类型同步变量。 | +| 允许装饰的变量类型 | 必须为被\@Observed装饰的class实例,必须指定类型。
不支持简单类型,可以使用[\@Prop](arkts-prop.md)。
\@ObjectLink的属性是可以改变的,但是变量的分配是不允许的,也就是说这个装饰器装饰变量是只读的,不能被改变。 | +| 被装饰变量的初始值 | 不允许。 | + +\@ObjectLink装饰的数据为可读示例。 + + +```ts +// 允许@ObjectLink装饰的数据属性赋值 +this.objLink.a= ... +// 不允许@ObjectLink装饰的数据自身赋值 +this.objLink= ... +``` + +> **说明:** +> +> \@ObjectLink装饰的变量不能被赋值,如果要使用赋值操作,请使用[@Prop](arkts-prop.md)。 +> +> - \@Prop装饰的变量和数据源的关系是是单向同步,\@Prop装饰的变量在本地拷贝了数据源,所以它允许本地更改,如果父组件中的数据源有更新,\@Prop装饰的变量本地的修改将被覆盖; +> +> - \@ObjectLink装饰的变量和数据源的关系是双向同步,\@ObjectLink装饰的变量相当于指向数据源的指针。如果一旦发生\@ObjectLink装饰的变量的赋值,则同步链将被打断。 + + +## 变量的传递/访问规则说明 + +| \@ObjectLink传递/访问 | 说明 | +| ----------------- | ---------------------------------------- | +| 从父组件初始化 | 必须指定。
初始化\@ObjectLink装饰的变量必须同时满足以下场景:
- 类型必须是\@Observed装饰的class。
- 初始化的数值需要是数组项,或者class的属性。
- 同步源的class或者数组必须是\@State,\@Link,\@Provide,\@Consume或者\@ObjectLink装饰的数据。
同步源是数组项的示例请参考[对象数组](#对象数组)。初始化的class的示例请参考[嵌套对象](#嵌套对象)。 | +| 与源对象同步 | 双向。 | +| 可以初始化子组件 | 允许,可用于初始化常规变量、\@State、\@Link、\@Prop、\@Provide | + + + **图1** 初始化规则图示   + + +![zh-cn_image_0000001502255262](figures/zh-cn_image_0000001502255262.png) + + +## 观察变化和行为表现 + + +### 观察的变化 + +\@Observed装饰的类,如果其属性为非简单类型,比如class、Object或者数组,也需要被\@Observed装饰,否则将观察不到其属性的变化。 + + +```ts +class ClassA { + public c: number; + + constructor(c: number) { + this.c = c; + } +} + +@Observed +class ClassB { + public a: ClassA; + public b: number; + + constructor(a: ClassA, b: number) { + this.a = a; + this.b = b; + } +} +``` + +以上示例中,ClassB被\@Observed装饰,其成员变量的赋值的变化是可以被观察到的,但对于ClassA,没有被\@Observed装饰,其属性的修改不能被观察到。 + + +```ts +@ObjectLink b: ClassB + +// 赋值变化可以被观察到 +this.b.a = new ClassA(5) +this.b.b = 5 + +// ClassA没有被@Observed装饰,其属性的变化观察不到 +this.b.a.c = 5 +``` + +\@ObjectLink:\@ObjectLink只能接受被\@Observed装饰class的实例,可以观察到: + +- 其属性的数值的变化,其中属性是指Object.keys(observedObject)返回的所有属性,示例请参考[嵌套对象](#嵌套对象)。 + +- 如果数据源是数组,则可以观察到数组item的替换,如果数据源是class,可观察到class的属性的变化,示例请参考[对象数组](#对象数组)。 + + +### 框架行为 + +1. 初始渲染: + 1. \@Observed装饰的class的实例会被不透明的代理对象包装,代理了class上的属性的setter和getter方法 + 2. 子组件中\@ObjectLink装饰的从父组件初始化,接受被\@Observed装饰的class的实例,\@ObjectLink的包装类会将自己注册给\@Observed class。 + +2. 属性更新:当\@Observed装饰的class属性改变时,会走到代理的setter和getter,然后遍历依赖它的\@ObjectLink包装类,通知数据更新。 + + +## 使用场景 + + +### 嵌套对象 + +以下是嵌套类对象的数据结构。 + + +```ts +// objectLinkNestedObjects.ets +let NextID: number = 1; + +@Observed +class ClassA { + public id: number; + public c: number; + + constructor(c: number) { + this.id = NextID++; + this.c = c; + } +} + +@Observed +class ClassB { + public a: ClassA; + + constructor(a: ClassA) { + this.a = a; + } +} +``` + + + 以下组件层次结构呈现的是此数据结构 + +```ts +@Component +struct ViewA { + label: string = 'ViewA1'; + @ObjectLink a: ClassA; + + build() { + Row() { + Button(`ViewA [${this.label}] this.a.c=${this.a.c} +1`) + .onClick(() => { + this.a.c += 1; + }) + } + } +} + +@Entry +@Component +struct ViewB { + @State b: ClassB = new ClassB(new ClassA(0)); + + build() { + Column() { + ViewA({ label: 'ViewA #1', a: this.b.a }) + ViewA({ label: 'ViewA #2', a: this.b.a }) + + Button(`ViewB: this.b.a.c+= 1`) + .onClick(() => { + this.b.a.c += 1; + }) + Button(`ViewB: this.b.a = new ClassA(0)`) + .onClick(() => { + this.b.a = new ClassA(0); + }) + Button(`ViewB: this.b = new ClassB(ClassA(0))`) + .onClick(() => { + this.b = new ClassB(new ClassA(0)); + }) + } + } +} +``` + + +ViewB中的事件句柄: + + +- this.b.a = new ClassA(0) 和this.b = new ClassB(new ClassA(0)): 对\@State装饰的变量b和其属性的修改。 + +- this.b.a.c = ... :该变化属于第二次的变化,[@State](arkts-state.md#观察变化)无法观察到第二层的变化,但是ClassA被\@Observed装饰,ClassA的属性c的变化可以被\@ObjectLink观察到。 + + +ViewA中的事件句柄: + + +- this.a.c += 1:对\@ObjectLink变量a的修改,将触发Button组件的刷新。\@ObjectLink和\@Prop不同,\@ObjectLink不拷贝来自父组件的数据源,而是在本地构建了指向其数据源的引用。 + +- \@ObjectLink变量是只读的,this.a = new ClassA(...)是不允许的,因为一旦赋值操作发生,指向数据源的引用将被重置,同步将被打断。 + + +### 对象数组 + +对象数组是一种常用的数据结构。以下示例展示了数组对象的用法。 + + +```ts +@Component +struct ViewA { + // 子组件ViewA的@ObjectLink的类型是ClassA + @ObjectLink a: ClassA; + label: string = 'ViewA1'; + + build() { + Row() { + Button(`ViewA [${this.label}] this.a.c = ${this.a.c} +1`) + .onClick(() => { + this.a.c += 1; + }) + } + } +} + +@Entry +@Component +struct ViewB { + // ViewB中有@State装饰的ClassA[] + @State arrA: ClassA[] = [new ClassA(0), new ClassA(0)]; + + build() { + Column() { + ForEach(this.arrA, + (item) => { + ViewA({ label: `#${item.id}`, a: item }) + }, + (item) => item.id.toString() + ) + // 使用@State装饰的数组的数组项初始化@ObjectLink,其中数组项是被@Observed装饰的ClassA的实例 + ViewA({ label: `ViewA this.arrA[first]`, a: this.arrA[0] }) + ViewA({ label: `ViewA this.arrA[last]`, a: this.arrA[this.arrA.length-1] }) + + Button(`ViewB: reset array`) + .onClick(() => { + this.arrA = [new ClassA(0), new ClassA(0)]; + }) + Button(`ViewB: push`) + .onClick(() => { + this.arrA.push(new ClassA(0)) + }) + Button(`ViewB: shift`) + .onClick(() => { + this.arrA.shift() + }) + Button(`ViewB: chg item property in middle`) + .onClick(() => { + this.arrA[Math.floor(this.arrA.length / 2)].c = 10; + }) + Button(`ViewB: chg item property in middle`) + .onClick(() => { + this.arrA[Math.floor(this.arrA.length / 2)] = new ClassA(11); + }) + } + } +} +``` + +- this.arrA[Math.floor(this.arrA.length/2)] = new ClassA(..) :该状态变量的改变触发2次更新: + 1. ForEach:数组项的赋值导致ForEach的[itemGenerator](arkts-rendering-control-foreach.md#接口描述)被修改,因此数组项被识别为有更改,ForEach的item builder将执行,创建新的ViewA组件实例。 + 2. ViewA({ label: `ViewA this.arrA[first]`, a: this.arrA[0] }):上述更改改变了数组中第一个元素,所以绑定this.arrA[0]的ViewA将被更新; + +- this.arrA.push(new ClassA(0)) : 将触发2次不同效果的更新: + 1. ForEach:新添加的ClassA对象对于ForEach是未知的[itemGenerator](arkts-rendering-control-foreach.md#接口描述),ForEach的item builder将执行,创建新的ViewA组件实例。 + 2. ViewA({ label: `ViewA this.arrA[last]`, a: this.arrA[this.arrA.length-1] }):数组的最后一项有更改,因此引起第二个ViewA的实例的更改。对于ViewA({ label: `ViewA this.arrA[first]`, a: this.arrA[0] }),数组的更改并没有触发一个数组项更改的改变,所以第一个ViewA不会刷新。 + +- this.arrA[Math.floor(this.arrA.length/2)].c:[@State](arkts-state.md#观察变化)无法观察到第二层的变化,但是ClassA被\@Observed装饰,ClassA的属性的变化将被\@ObjectLink观察到。 + + +### 二维数组 + +使用\@Observed观察二维数组的变化。可以声明一个被\@Observed装饰的继承Array的子类。 + + +```ts +@Observed +class StringArray extends Array { +} +``` + +使用new StringArray()来构造StringArray的实例,new运算符使得\@Observed生效,\@Observed观察到StringArray的属性变化。 + +声明一个从Array扩展的类class StringArray extends Array<String> {},并创建StringArray的实例。\@Observed装饰的类需要使用new运算符来构建class实例。 + + +```ts +@Observed +class StringArray extends Array { +} + +@Component +struct ItemPage { + @ObjectLink itemArr: StringArray; + + build() { + Row() { + Text('ItemPage') + .width(100).height(100) + + ForEach(this.itemArr, + item => { + Text(item) + .width(100).height(100) + }, + item => item + ) + } + } +} + +@Entry +@Component +struct IndexPage { + @State arr: Array = [new StringArray(), new StringArray(), new StringArray()]; + + build() { + Column() { + ItemPage({ itemArr: this.arr[0] }) + ItemPage({ itemArr: this.arr[1] }) + ItemPage({ itemArr: this.arr[2] }) + + Divider() + + ForEach(this.arr, + itemArr => { + ItemPage({ itemArr: itemArr }) + }, + itemArr => itemArr[0] + ) + + Divider() + + Button('update') + .onClick(() => { + console.error('Update all items in arr'); + if (this.arr[0][0] !== undefined) { + // 正常情况下需要有一个真实的ID来与ForEach一起使用,但此处没有 + // 因此需要确保推送的字符串是唯一的。 + this.arr[0].push(`${this.arr[0].slice(-1).pop()}${this.arr[0].slice(-1).pop()}`); + this.arr[1].push(`${this.arr[1].slice(-1).pop()}${this.arr[1].slice(-1).pop()}`); + this.arr[2].push(`${this.arr[2].slice(-1).pop()}${this.arr[2].slice(-1).pop()}`); + } else { + this.arr[0].push('Hello'); + this.arr[1].push('World'); + this.arr[2].push('!'); + } + }) + } + } +} +``` diff --git a/zh-cn/application-dev/quick-start/arkts-other-state-mgmt-functions-overview.md b/zh-cn/application-dev/quick-start/arkts-other-state-mgmt-functions-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..58682627cedb04b165783fc3aec11a481fab448e --- /dev/null +++ b/zh-cn/application-dev/quick-start/arkts-other-state-mgmt-functions-overview.md @@ -0,0 +1,9 @@ +# 其他状态管理概述 + + +除了前面章节提到的组件状态管理和应用状态管理,ArkTS还提供了\@Watch和$$来为开发者提供更多功能: + + +- [\@Watch](arkts-watch.md)用于监听状态变量的变化。 + +- [$$运算符](arkts-two-way-sync.md):给内置组件提供TS变量的引用,使得TS变量和内置组件的内部状态保持同步。 diff --git a/zh-cn/application-dev/quick-start/arkts-page-custom-components-lifecycle.md b/zh-cn/application-dev/quick-start/arkts-page-custom-components-lifecycle.md new file mode 100644 index 0000000000000000000000000000000000000000..c222dd5c435946369eba7572bdda0ae5d3eb241c --- /dev/null +++ b/zh-cn/application-dev/quick-start/arkts-page-custom-components-lifecycle.md @@ -0,0 +1,186 @@ +# 页面和自定义组件生命周期 + + +在开始之前,我们先明确自定义组件和页面的关系: + + +- 自定义组件:\@Component装饰的UI单元,可以组合多个系统组件实现UI的复用。 + +- 页面:即应用的UI页面。可以由一个或者多个自定义组件组成,\@Entry装饰的自定义组件为页面的入口组件,即页面的根节点,一个页面有且仅能有一个\@Entry。只有被\@Entry装饰的组件才可以调用页面的生命周期。 + + +页面生命周期,即被\@Entry装饰的组件生命周期,提供以下生命周期接口: + + +- [onPageShow](../reference/arkui-ts/ts-custom-component-lifecycle.md#onpageshow):页面每次显示时触发。 + +- [onPageHide](../reference/arkui-ts/ts-custom-component-lifecycle.md#onpagehide):页面每次隐藏时触发一次。 + +- [onBackPress](../reference/arkui-ts/ts-custom-component-lifecycle.md#onbackpress):当用户点击返回按钮时触发。 + + +组件生命周期,即一般用\@Component装饰的自定义组件,提供以下生命周期接口: + + +- [aboutToAppear](../reference/arkui-ts/ts-custom-component-lifecycle.md#abouttoappear):组件即将出现时回调该接口,具体时机为在创建自定义组件的新实例后,在执行其build()函数之前执行。 + +- [aboutToDisappear](../reference/arkui-ts/ts-custom-component-lifecycle.md#abouttodisappear):在自定义组件即将析构销毁时执行。 + + +生命周期流程如下图所示,下图展示的是被\@Entry装饰的组件(首页)生命周期。 + + +![zh-cn_image_0000001502372786](figures/zh-cn_image_0000001502372786.png) + + +根据上面的流程图,我们从自定义组件的初始创建、重新渲染和删除来详细解释。 + + +## 自定义组件的创建和渲染流程 + +1. 自定义组件的创建:自定义组件的实例由ArkUI框架创建。 + +2. 初始化自定义组件的成员变量:通过本地默认值或者构造方法传递参数来初始化自定义组件的成员变量,初始化顺序为成员变量的定义顺序。 + +3. 如果开发者定义了aboutToAppear,则执行aboutToAppear方法。 + +4. 在首次渲染的时候,执行build方法渲染系统组件,如果有自定义子组件,则创建自定义组件的实例。在执行build()函数的过程中,框架会观察每个状态变量的读取状态,将保存两个map: + 1. 状态变量 -> UI组件(包括ForEach和if)。 + 2. UI组件 -> 此组件的更新函数,即一个lambda方法,作为build()函数的子集,创建对应的UI组件并执行其属性方法,示意如下。 + + + ```ts + build() { + ... + this.observeComponentCreation(() => { + Button.create(); + }) + + this.observeComponentCreation(() => { + Text.create(); + }) + ... + } + ``` + + +当应用在后台启动时,此时应用进程并没有销毁,所以仅需要执行onPageShow。 + + +## 自定义组件重新渲染 + +当事件句柄被触发(比如设置了点击事件,即触发点击事件)改变了状态变量时,或者LocalStorage / AppStorage中的属性更改,并导致绑定的状态变量更改其值时: + + +1. 框架观察到了变化,将启动重新渲染。 + +2. 根据框架持有的两个map(自定义组件的创建和渲染流程中第4步),框架可以知道该状态变量管理了哪些UI组件,以及这些UI组件对应的更新函数。执行这些UI组件的更新函数,实现最小化更新。 + + +## 自定义组件的删除 + +如果if组件的分支改变,或者ForEach循环渲染中数组的个数改变,组件将被删除: + + +1. 在删除组件之前,将调用其aboutToDisappear生命周期函数,标记着该节点将要被销毁。ArkUI的节点删除机制是:后端节点直接从组件树上摘下,后端节点被销毁,对前端节点解引用,当前端节点已经没有引用时,将被JS虚拟机垃圾回收。 + +2. 自定义组件和它的变量将被删除,如果其有同步的变量,比如[@Link](arkts-link.md)、[@Prop](arkts-prop.md)、[@StorageLink](arkts-appstorage.md#storagelink),将从[同步源](arkts-state-management-overview.md#基本概念)上取消注册。 + + +不建议在生命周期aboutToDisappear内使用async await,如果在生命周期的aboutToDisappear使用异步操作(Promise或者回调方法),自定义组件将被保留在Promise的闭包中,直到回调方法被执行完,这个行为阻止了自定义组件的垃圾回收。 + + +以下示例展示了生命周期的调用时机: + + + +```ts +// Index.ets +import router from '@ohos.router'; + +@Entry +@Component +struct MyComponent { + @State showChild: boolean = true; + + // 只有被@Entry装饰的组件才可以调用页面的生命周期 + onPageShow() { + console.info('Index onPageShow'); + } + // 只有被@Entry装饰的组件才可以调用页面的生命周期 + onPageHide() { + console.info('Index onPageHide'); + } + + // 只有被@Entry装饰的组件才可以调用页面的生命周期 + onBackPress() { + console.info('Index onBackPress'); + } + + // 组件生命周期 + aboutToAppear() { + console.info('MyComponent aboutToAppear'); + } + + // 组件生命周期 + aboutToDisappear() { + console.info('MyComponent aboutToDisappear'); + } + + build() { + Column() { + // this.showChild为true,创建Child子组件,执行Child aboutToAppear + if (this.showChild) { + Child() + } + // this.showChild为false,删除Child子组件,执行Child aboutToDisappear + Button('create or delete Child').onClick(() => { + this.showChild = false; + }) + // push到Page2页面,执行onPageHide + Button('push to next page') + .onClick(() => { + router.pushUrl({ url: 'pages/Page2' }); + }) + } + + } +} + +@Component +struct Child { + @State title: string = 'Hello World'; + // 组件生命周期 + aboutToDisappear() { + console.info('[lifeCycle] Child aboutToDisappear') + } + // 组件生命周期 + aboutToAppear() { + console.info('[lifeCycle] Child aboutToAppear') + } + + build() { + Text(this.title).fontSize(50).onClick(() => { + this.title = 'Hello ArkUI'; + }) + } +} +``` + + +以上示例中,Index页面包含两个自定义组件,一个是被\@Entry装饰的MyComponent,也是页面的入口组件,即页面的根节点;一个是Child,是MyComponent的子组件。只有\@Entry装饰的节点才可以生效页面的生命周期方法,所以MyComponent中声明了当前Index页面的页面生命周期函数。MyComponent和其子组件Child也同时也声明了组件的生命周期函数。 + + +- 应用冷启动的初始化流程为:MyComponent aboutToAppear --> MyComponent build --> Child aboutToAppear --> Child build --> Child build执行完毕 --> MyComponent build执行完毕 --> Index onPageShow。 + +- 点击“delete Child”,if绑定的this.showChild变成false,删除Child组件,会执行Child aboutToDisappear方法。 + + +- 点击“push to next page”,调用router.pushUrl接口,跳转到另外一个页面,当前Index页面隐藏,执行页面生命周期Index onPageHide。此处调用的是router.pushUrl接口,Index页面被隐藏,并没有销毁,所以只调用onPageHide。跳转到新页面后,执行初始化新页面的生命周期的流程。 + +- 如果调用的是router.replaceUrl,则当前Index页面被销毁,执行的生命周期流程将变为:Index onPageHide --> MyComponent aboutToDisappear --> Child aboutToDisappear。上文已经提到,组件的销毁是从组件树上直接摘下子树,所以先调用父组件的aboutToDisappear,再调用子组件的aboutToDisAppear,然后执行初始化新页面的生命周期流程。 + +- 点击返回按钮,触发页面生命周期Index onBackPress。最小化应用或者应用进入后台,触发Index onPageHide。这两个状态下应用都没有被销毁,所以并不会执行组件的aboutToDisappear 。应用回到前台,执行Index onPageShow。 + + +- 退出应用,执行Index onPageHide --> MyComponent aboutToDisappear --> Child aboutToDisappear。 diff --git a/zh-cn/application-dev/quick-start/arkts-persiststorage.md b/zh-cn/application-dev/quick-start/arkts-persiststorage.md new file mode 100644 index 0000000000000000000000000000000000000000..f6af22c37e5621c8102087df49f03910f52d7811 --- /dev/null +++ b/zh-cn/application-dev/quick-start/arkts-persiststorage.md @@ -0,0 +1,114 @@ +# PersistentStorage:持久化存储UI状态 + + +前两个小节介绍的LocalStorage和AppStorage都是运行时的内存,但是在应用退出再次启动后,依然能保存选定的结果,是应用开发中十分常见的现象,这就需要用到PersistentStorage。 + + +PersistentStorage是应用程序中的可选单例对象。此对象的作用是持久化存储选定的AppStorage属性,以确保这些属性在应用程序重新启动时的值与应用程序关闭时的值相同。 + + +## 概述 + +PersistentStorage将选定的AppStorage属性保留在设备磁盘上。应用程序通过API,以决定哪些AppStorage属性应借助PersistentStorage持久化。UI和业务逻辑不直接访问PersistentStorage中的属性,所有属性访问都是对AppStorage的访问,AppStorage中的更改会自动同步到PersistentStorage。 + +PersistentStorage和AppStorage中的属性建立双向同步。应用开发通常通过AppStorage访问PersistentStorage,另外还有一些接口可以用于管理持久化属性,但是业务逻辑始终是通过AppStorage获取和设置属性的。 + + +## 限制条件 + +持久化数据是一个相对缓慢的操作,应用程序应避免以下情况: + +- 持久化大型数据集。 + +- 持久化经常变化的变量。 + +当持久化更改的过程变得太繁重时,PersistentStorage实现可能会限制持久化属性更改的频率。 + + +## 使用场景 + + +### 从AppStorage中访问PersistentStorage初始化的属性 + +1. 初始化PersistentStorage: + + ```ts + PersistentStorage.PersistProp('aProp', 47); + ``` + +2. 在AppStorage获取对应属性: + + ```ts + AppStorage.Get('aProp'); // returns 47 + ``` + + 或在组件内部定义: + + + ```ts + @StorageLink('aProp') aProp: number = 48; + ``` + +完整代码如下: + + +```ts +PersistentStorage.PersistProp('aProp', 47); + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + @StorageLink('aProp') aProp: number = 48 + + build() { + Row() { + Column() { + Text(this.message) + // 应用退出时会保存当前结果。重新启动后,会显示上一次的保存结果 + Text(`${this.aProp}`) + .onClick(() => { + this.aProp += 1; + }) + } + } + } +} +``` + +- 新应用安装后首次启动运行: + 1. 调用PersistProp初始化PersistentStorage,首先查询在PersistentStorage本地文件中是否存在“aProp”,查询结果为不存在,因为应用是第一次安装; + 2. 接着查询属性“aProp”在AppStorage中是否存在,依旧不存在; + 3. 在AppStorge中创建名为“aProp”的number类型属性,属性初始值是定义的默认值47; + 4. PersistentStorage将属性“aProp”和值47写入磁盘,AppStorage中“aProp”对应的值和其后续的更改将被持久化; + 5. 在Index组件中创建状态变量\@StorageLink('aProp') aProp,和AppStorage中“aProp”双向绑定,在创建的过程中会在AppStorage中查找,成功找到“aProp”,所以使用其在AppStorage找到的值47。 + + **图1** PersistProp初始化流程   + +![zh-cn_image_0000001553348833](figures/zh-cn_image_0000001553348833.png) + +- 触发点击事件后: + 1. 状态变量\@StorageLink('aProp') aProp改变,触发Text组件重新刷新; + 2. \@StorageLink装饰的变量是和AppStorage中建立双向同步的,所以\@StorageLink('aProp') aProp的变化会被同步回AppStorage中; + 3. AppStorage中“aProp”属性的改变会同步到所有绑定该“aProp”的单向或者双向变量,在本示例中没有其他的绑定“aProp”的变量; + 4. 因为“aProp”对应的属性已经被持久化,所以在AppStorage中“aProp”的改变会触发PersistentStorage将新的改变写会本地磁盘。 + +- 后续启动应用: + 1. 执行PersistentStorage.PersistProp('aProp', 47),在首先查询在PersistentStorage本地文件查询“aProp”属性,成功查询到; + 2. 将在PersistentStorage查询到的值写入AppStorage中; + 3. 在Index组件里,\@StorageLink绑定的“aProp”为PersistentStorage写入AppStorage中的值,即为上一次退出引用存入的值。 + + +### 在PersistentStorage之前访问AppStorage中的属性 + +该示例为反例。在调用PersistentStorage.PersistProp或者PersistProps之前使用接口访问AppStorage中的属性是错误的,因为这样的调用顺序会丢失上一次应用程序运行中的属性值: + + +```ts +let aProp = AppStorage.SetOrCreate('aProp', 47); +PersistentStorage.PersistProp('aProp', 48); +``` + +应用在非首次运行时,先执行AppStorage.SetOrCreate('aProp', 47):属性“aProp”在AppStorage中创建,其类型为number,其值设置为指定的默认值47。'aProp'是持久化的属性,所以会被写回PersistentStorage磁盘中,PersistentStorage存储的上次退出应用的值丢失。 + +PersistentStorage.PersistProp('aProp', 48):在PersistentStorage中查找到“aProp”,找到,值为47。 diff --git a/zh-cn/application-dev/quick-start/arkts-prop.md b/zh-cn/application-dev/quick-start/arkts-prop.md new file mode 100644 index 0000000000000000000000000000000000000000..f85f88c5d57eae8be12660cbbc9ccb0a2c236f5c --- /dev/null +++ b/zh-cn/application-dev/quick-start/arkts-prop.md @@ -0,0 +1,368 @@ +# \@Prop:父子单向同步 + + +\@Prop装饰的变量可以和父组件建立单向的同步关系。\@Prop装饰的变量是可变的,但是变化不会同步回其父组件。 + + +> **说明:** +> +> 从API version 9开始,该装饰器支持在ArkTS卡片中使用。 + + +## 概述 + +\@Prop装饰的变量和父组件建立单向的同步关系: + +- \@Prop变量允许在本地修改,但修改后的变化不会同步回父组件。 + +- 当父组件中的数据源更改时,与之相关的\@Prop装饰的变量都会自动更新。如果子组件已经在本地修改了\@Prop装饰的相关变量值,而在父组件中对应的\@State装饰的变量被修改后,子组件本地修改的\@Prop装饰的相关变量值将被覆盖。 + + +## 装饰器使用规则说明 + +| \@Prop变量装饰器 | 说明 | +| ----------- | ---------------------------------------- | +| 装饰器参数 | 无 | +| 同步类型 | 单向同步:对父组件状态变量值的修改,将同步给子组件\@Prop装饰的变量,子组件\@Prop变量的修改不会同步到父组件的状态变量上 | +| 允许装饰的变量类型 | string、number、boolean、enum类型。
不支持any,不允许使用undefined和null。
必须指定类型。
在父组件中,传递给\@Prop装饰的值不能为undefined或者null,反例如下所示。
CompA ({ aProp: undefined })
CompA ({ aProp: null })
\@Prop和[数据源](arkts-state-management-overview.md#基本概念)类型需要相同,有以下三种情况(数据源以\@State为例):
- \@Prop装饰的变量和父组件状态变量类型相同,即\@Prop : S和\@State : S,示例请参考[父组件@State到子组件@Prop简单数据类型同步](#父组件state到子组件prop简单数据类型同步)。
- 当父组件的状态变量为数组时,\@Prop装饰的变量和父组件状态变量的数组项类型相同,即\@Prop : S和\@State : Array<S>,示例请参考[父组件@State数组中的项到子组件@Prop简单数据类型同步](#父组件state数组项到子组件prop简单数据类型同步);
- 当父组件状态变量为Object或者class时,\@Prop装饰的变量和父组件状态变量的属性类型相同,即\@Prop : S和\@State : { propA: S },示例请参考[从父组件中的@State类对象属性到@Prop简单类型的同步](#从父组件中的state类对象属性到prop简单类型的同步)。 | +| 被装饰变量的初始值 | 允许本地初始化。 | + + +## 变量的传递/访问规则说明 + +| 传递/访问 | 说明 | +| --------- | ---------------------------------------- | +| 从父组件初始化 | 如果本地有初始化,则是可选的。没有的话,则必选,支持父组件中的常规变量、\@State、\@Link、\@Prop、\@Provide、\@Consume、\@ObjectLink、\@StorageLink、\@StorageProp、\@LocalStorageLink和\@LocalStorageProp去初始化子组件中的\@Prop变量。 | +| 用于初始化子组件 | \@Prop支持去初始化子组件中的常规变量、\@State、\@Link、\@Prop、\@Provide。 | +| 是否支持组件外访问 | \@Prop装饰的变量是私有的,只能在组件内访问。 | + + + **图1** 初始化规则图示   + + +![zh-cn_image_0000001552972029](figures/zh-cn_image_0000001552972029.png) + + +## 观察变化和行为表现 + + +### 观察变化 + +\@Prop装饰的数据可以观察到以下变化。 + +- 当装饰的类型是允许的类型,即string、number、boolean、enum类型都可以观察到的赋值变化; + + ```ts + // 简单类型 + @Prop count: number; + // 赋值的变化可以被观察到 + this.count = 1; + ``` + +对于\@State和\@Prop的同步场景: + +- 使用父组件中\@State变量的值初始化子组件中的\@Prop变量。当\@State变量变化时,该变量值也会同步更新至\@Prop变量。 + +- \@Prop装饰的变量的修改不会影响其数据源\@State装饰变量的值。 + +- 除了\@State,数据源也可以用\@Link或\@Prop装饰,对\@Prop的同步机制是相同的。 + +- 数据源和\@Prop变量的类型需要相同。 + + +### 框架行为 + +要理解\@Prop变量值初始化和更新机制,有必要了解父组件和拥有\@Prop变量的子组件初始渲染和更新流程。 + +1. 初始渲染: + 1. 执行父组件的build()函数将创建子组件的新实例,将数据源传递给子组件; + 2. 初始化子组件\@Prop装饰的变量。 + +2. 更新: + 1. 子组件\@Prop更新时,更新仅停留在当前子组件,不会同步回父组件; + 2. 当父组件的数据源更新时,子组件的\@Prop装饰的变量将被来自父组件的数据源重置,所有\@Prop装饰的本地的修改将被父组件的更新覆盖。 + + +## 使用场景 + + +### 父组件\@State到子组件\@Prop简单数据类型同步 + + +以下示例是\@State到子组件\@Prop简单数据同步,父组件ParentComponent的状态变量countDownStartValue初始化子组件CountDownComponent中\@Prop装饰的count,点击“Try again”,count的修改仅保留在CountDownComponent 不会同步给父组件CountDownComponent。 + + +ParentComponent的状态变量countDownStartValue的变化将重置CountDownComponent的count。 + + + +```ts +@Component +struct CountDownComponent { + @Prop count: number; + costOfOneAttempt: number = 1; + + build() { + Column() { + if (this.count > 0) { + Text(`You have ${this.count} Nuggets left`) + } else { + Text('Game over!') + } + // @Prop装饰的变量不会同步给父组件 + Button(`Try again`).onClick(() => { + this.count -= this.costOfOneAttempt; + }) + } + } +} + +@Entry +@Component +struct ParentComponent { + @State countDownStartValue: number = 10; + + build() { + Column() { + Text(`Grant ${this.countDownStartValue} nuggets to play.`) + // 父组件的数据源的修改会同步给子组件 + Button(`+1 - Nuggets in New Game`).onClick(() => { + this.countDownStartValue += 1; + }) + // 父组件的修改会同步给子组件 + Button(`-1 - Nuggets in New Game`).onClick(() => { + this.countDownStartValue -= 1; + }) + + CountDownComponent({ count: this.countDownStartValue, costOfOneAttempt: 2 }) + } + } +} +``` + + +在上面的示例中: + + +1. CountDownComponent子组件首次创建时其\@Prop装饰的count变量将从父组件\@State装饰的countDownStartValue变量初始化; + +2. 按“+1”或“-1”按钮时,父组件的\@State装饰的countDownStartValue值会变化,这将触发父组件重新渲染,在父组件重新渲染过程中会刷新使用countDownStartValue状态变量的UI组件并单向同步更新CountDownComponent子组件中的count值; + +3. 更新count状态变量值也会触发CountDownComponent的重新渲染,在重新渲染过程中,评估使用count状态变量的if语句条件(this.count > 0),并执行true分支中的使用count状态变量的UI组件相关描述来更新Text组件的UI显示; + +4. 当按下子组件CountDownComponent的“Try again”按钮时,其\@Prop变量count将被更改,但是count值的更改不会影响父组件的countDownStartValue值; + +5. 父组件的countDownStartValue值会变化时,父组件的修改将覆盖掉子组件CountDownComponent中count本地的修改。 + + +### 父组件\@State数组项到子组件\@Prop简单数据类型同步 + + +父组件中\@State如果装饰的数组,其数组项也可以初始化\@Prop。以下示例中父组件Index中\@State装饰的数组arr,将其数组项初始化子组件Child中\@Prop装饰的value。 + + + +```ts +@Component +struct Child { + @Prop value: number; + + build() { + Text(`${this.value}`) + .fontSize(50) + .onClick(()=>{this.value++}) + } +} + +@Entry +@Component +struct Index { + @State arr: number[] = [1,2,3]; + + build() { + Row() { + Column() { + Child({value: this.arr[0]}) + Child({value: this.arr[1]}) + Child({value: this.arr[2]}) + + Divider().height(5) + + ForEach(this.arr, + item => { + Child({value: item}) + }, + item => item.toString() + ) + Text('replace entire arr') + .fontSize(50) + .onClick(()=>{ + // 两个数组都包含项“3”。 + this.arr = this.arr[0] == 1 ? [3,4,5] : [1,2,3]; + }) + } + } + } +} +``` + + +初始渲染创建6个子组件实例,每个\@Prop装饰的变量初始化都在本地拷贝了一份数组项。子组件onclick事件处理程序会更改局部变量值。 + + +假设我们点击了多次,所有变量的本地取值都是“7”。 + + + +``` +7 +7 +7 +---- +7 +7 +7 +``` + + +单击replace entire arr后,屏幕将显示以下信息。 + + + +``` +3 +4 +5 +---- +7 +4 +5 +``` + + +- 在子组件Child中做的所有的修改都不会同步回父组件Index组件,所以即使6个组件显示都为7,但在父组件Index中,this.arr保存的值依旧是[1,2,3]。 + +- 点击replace entire arr,this.arr[0] == 1成立,将this.arr赋值为[3, 4, 5]; + +- 因为this.arr[0]已更改,Child({value: this.arr[0]})组件将this.arr[0]更新同步到实例\@Prop装饰的变量。Child({value: this.arr[1]})和Child({value: this.arr[2]})的情况也类似。 + + +- this.arr的更改触发ForEach更新,this.arr更新的前后都有数值为3的数组项:[3, 4, 5] 和[1, 2, 3]。根据diff机制,数组项“3”将被保留,删除“1”和“2”的数组项,添加为“4”和“5”的数组项。这就意味着,数组项“3”的组件不会重新生成,而是将其移动到第一位。所以“3”对应的组件不会更新,此时“3”对应的组件数值为“7”,ForEach最终的渲染结果是“7”,“4”,“5”。 + + +### 从父组件中的\@State类对象属性到\@Prop简单类型的同步 + +如果图书馆有一本图书和两位用户,每位用户都可以将图书标记为已读,此标记行为不会影响其它读者用户。从代码角度讲,对\@Prop图书对象的本地更改不会同步给图书馆组件中的\@State图书对象。 + + +```ts +class Book { + public title: string; + public pages: number; + public readIt: boolean = false; + + constructor(title: string, pages: number) { + this.title = title; + this.pages = pages; + } +} + +@Component +struct ReaderComp { + @Prop title: string; + @Prop readIt: boolean; + + build() { + Row() { + Text(this.title) + Text(`... ${this.readIt ? 'I have read' : 'I have bot read it'}`) + .onClick(() => this.readIt = true) + } + } +} + +@Entry +@Component +struct Library { + @State book: Book = new Book('100 secrets of C++', 765); + + build() { + Column() { + ReaderComp({ title: this.book.title, readIt: this.book.readIt }) + ReaderComp({ title: this.book.title, readIt: this.book.readIt }) + } + } +} +``` + + +### \@Prop本地初始化不和父组件同步 + +为了支持\@Component装饰的组件复用场景,\@Prop支持本地初始化,这样可以让\@Prop是否与父组件建立同步关系变得可选。当且仅当\@Prop有本地初始化时,从父组件向子组件传递\@Prop的数据源才是可选的。 + +下面的示例中,子组件包含两个\@Prop变量: + +- \@Prop customCounter没有本地初始化,所以需要父组件提供数据源去初始化\@Prop,并当父组件的数据源变化时,\@Prop也将被更新; + +- \@Prop customCounter2有本地初始化,在这种情况下,\@Prop依旧允许但非强制父组件同步数据源给\@Prop。 + + +```ts +@Component +struct MyComponent { + @Prop customCounter: number; + @Prop customCounter2: number = 5; + + build() { + Column() { + Row() { + Text(`From Main: ${this.customCounter}`).width(90).height(40).fontColor('#FF0010') + } + + Row() { + Button('Click to change locally !').width(480).height(60).margin({ top: 10 }) + .onClick(() => { + this.customCounter2++ + }) + }.height(100).width(480) + + Row() { + Text(`Custom Local: ${this.customCounter2}`).width(90).height(40).fontColor('#FF0010') + } + } + } +} + +@Entry +@Component +struct MainProgram { + @State mainCounter: number = 10; + + build() { + Column() { + Row() { + Column() { + Button('Click to change number').width(480).height(60).margin({ top: 10, bottom: 10 }) + .onClick(() => { + this.mainCounter++ + }) + } + } + + Row() { + Column( + // customCounter必须从父组件初始化,因为MyComponent的customCounter成员变量缺少本地初始化;此处,customCounter2可以不做初始化。 + MyComponent({ customCounter: this.mainCounter }) + // customCounter2也可以从父组件初始化,父组件初始化的值会覆盖子组件customCounter2的本地初始化的值 + MyComponent({ customCounter: this.mainCounter, customCounter2: this.mainCounter }) + }.width('40%') + } + + Row() { + Text('').width(480).height(10) + } + } + } +} +``` + \ No newline at end of file diff --git a/zh-cn/application-dev/quick-start/arkts-provide-and-consume.md b/zh-cn/application-dev/quick-start/arkts-provide-and-consume.md new file mode 100644 index 0000000000000000000000000000000000000000..7b5dff76c60c9431532c2f281fd794d196207be0 --- /dev/null +++ b/zh-cn/application-dev/quick-start/arkts-provide-and-consume.md @@ -0,0 +1,172 @@ +# \@Provide和\@Consume:与后代组件双向同步 + + +\@Provide和\@Consume,应用于与后代组件的双向数据同步,应用于状态数据在多个层级之间传递的场景。不同于上文提到的父子组件之间通过命名参数机制传递,\@Provide和\@Consume摆脱参数传递机制的束缚,实现跨层级传递。 + + +其中\@Provide装饰的变量是在祖先节点中,可以理解为被“提供”给后代的状态变量。\@Consume装饰的变量是在后代组件中,去“消费(绑定)”祖先节点提供的变量。 + + +> **说明:** +> +> 从API version 9开始,这两个装饰器支持在ArkTS卡片中使用。 + + +## 概述 + +\@Provide/\@Consume装饰的状态变量有以下特性: + +- \@Provide装饰的状态变量自动对其所有后代组件可用,即该变量被“provide”给他的后代组件。由此可见,\@Provide的方便之处在于,开发者不需要多次在组件之间传递变量。 + +- 后代通过使用\@Consume去获取\@Provide提供的变量,建立在\@Provide和\@Consume之间的双向数据同步,与\@State/\@Link不同的是,前者可以在多层级的父子组件之间传递。 + +- \@Provide和\@Consume可以通过相同的变量名或者相同的变量别名绑定,变量类型必须相同。 + + +```ts +// 通过相同的变量名绑定 +@Provide a: number = 0; +@Consume a: number; + +// 通过相同的变量别名绑定 +@Provide('a') b: number = 0; +@Consume('a') c: number; +``` + + +\@Provide和\@Consume通过相同的变量名或者相同的变量别名绑定时,\@Provide修饰的变量和\@Consume修饰的变量是一对多的关系。不允许在同一个自定义组件内,包括其子组件中声明多个同名或者同别名的\@Provide装饰的变量。 + + +## 装饰器说明 + +\@State的规则同样适用于\@Provide,差异为\@Provide还作为多层后代的同步源。 + +| \@Provide变量装饰器 | 说明 | +| -------------- | ---------------------------------------- | +| 装饰器参数 | 别名:常量字符串,可选。
如果指定了别名,则通过别名来绑定变量;如果未指定别名,则通过变量名绑定变量。 | +| 同步类型 | 双向同步。
从\@Provide变量到所有\@Consume变量以及相反的方向的数据同步。双向同步的操作与\@State和\@Link的组合相同。 | +| 允许装饰的变量类型 | Object、class、string、number、boolean、enum类型,以及这些类型的数组。嵌套类型的场景请参考[观察变化](#观察变化)。
不支持any,不支持简单类型和复杂类型的联合类型,不允许使用undefined和null。
必须指定类型。\@Provide变量的\@Consume变量的类型必须相同。
**说明:**
不支持Length、ResourceStr、ResourceColor类型,Length、ResourceStr、ResourceColor为简单类型和复杂类型的联合类型。 | +| 被装饰变量的初始值 | 必须指定。 | + +| \@Consume变量装饰器 | 说明 | +| -------------- | ---------------------------------------- | +| 装饰器参数 | 别名:常量字符串,可选。
如果提供了别名,则必须有\@Provide的变量和其有相同的别名才可以匹配成功;否则,则需要变量名相同才能匹配成功。 | +| 同步类型 | 双向:从\@Provide变量(具体请参见\@Provide)到所有\@Consume变量,以及相反的方向。双向同步操作与\@State和\@Link的组合相同。 | +| 允许装饰的变量类型 | Object、class、string、number、boolean、enum类型,以及这些类型的数组。嵌套类型的场景请参考[观察变化](#观察变化)。
不支持any,不允许使用undefined和null。
必须指定类型。\@Provide变量的\@Consume变量的类型必须相同。
**说明:**
\@Consume装饰的变量,在其父节点或者祖先节点上,必须有对应的属性和别名的\@Provide装饰的变量。 | +| 被装饰变量的初始值 | 无,禁止本地初始化。 | + + +## 变量的传递/访问规则说明 + + +| \@Provide传递/访问 | 说明 | +| -------------- | ---------------------------------------- | +| 从父组件初始化和更新 | 可选,允许父组件中常规变量、\@State、\@Link、\@Prop、\@Provide、\@Consume、\@ObjectLink、\@StorageLink、\@StorageProp、\@LocalStorageLink和\@LocalStorageProp装饰的变量装饰变量初始化子组件\@Provide。 | +| 用于初始化子组件 | 允许,可用于初始化\@State、\@Link、\@Prop、\@Provide。 | +| 和父组件同步 | 否。 | +| 和后代组件同步 | 和\@Consume双向同步。 | +| 是否支持组件外访问 | 私有,仅可以在所属组件内访问。 | + + + **图1** \@Provide初始化规则图示   + + +![zh-cn_image_0000001552614217](figures/zh-cn_image_0000001552614217.png) + + +| \@Consume传递/访问 | 说明 | +| -------------- | ---------------------------------------- | +| 从父组件初始化和更新 | 禁止。通过相同的变量名和alias(别名)从\@Provide初始化。 | +| 用于初始化子组件 | 允许,可用于初始化\@State、\@Link、\@Prop、\@Provide。 | +| 和祖先组件同步 | 和\@Provide双向同步。 | +| 是否支持组件外访问 | 私有,仅可以在所属组件内访问 | + + + **图2** \@Consume初始化规则图示   + + +![zh-cn_image_0000001502094666](figures/zh-cn_image_0000001502094666.png) + + +## 观察变化和行为表现 + + +### 观察变化 + +- 当装饰的数据类型为boolean、string、number类型时,可以观察到数值的变化。 + +- 当装饰的数据类型为class或者Object的时候,可以观察到赋值和属性赋值的变化(属性为Object.keys(observedObject)返回的所有属性)。 + +- 当装饰的对象是array的时候,可以观察到数组的添加、删除、更新数组单元。 + + +### 框架行为 + +1. 初始渲染: + 1. \@Provide装饰的变量会以map的形式,传递给当前\@Provide所属组件的所有子组件; + 2. 子组件中如果使用\@Consume变量,则会在map中查找是否有该变量名/alias(别名)对应的\@Provide的变量,如果查找不到,框架会抛出JS ERROR; + 3. 在初始化\@Consume变量时,和\@State/\@Link的流程类似,\@Consume变量会保存在map中查找到的\@Provide变量,并把自己注册给\@Provide。 + +2. 当\@Provide装饰的数据变化时: + 1. 通过初始渲染的步骤可知,子组件\@Consume已把自己注册给父组件。父组件\@Provide变量变更后,会遍历更新所有依赖它的系统组件(elementid)和状态变量(\@Consume); + 2. 通知\@Consume更新后,子组件所有依赖\@Consume的系统组件(elementId)都会被通知更新。以此实现\@Provide对\@Consume状态数据同步。 + +3. 当\@Consume装饰的数据变化时: + + 通过初始渲染的步骤可知,子组件\@Consume持有\@Provide的实例。在\@Consume更新后调用\@Provide的更新方法,将更新的数值同步回\@Provide,以此实现\@Consume向\@Provide的同步更新。 + + +## 使用场景 + +在下面的示例是与后代组件双向同步状态\@Provide和\@Consume场景。当分别点击CompA和CompD组件内Button时,reviewVotes 的更改会双向同步在CompA和CompD中。 + + + +```ts +@Component +struct CompD { + // @Consume装饰的变量通过相同的属性名绑定其祖先组件CompA内的@Provide装饰的变量 + @Consume reviewVotes: number; + + build() { + Column() { + Text(`reviewVotes(${this.reviewVotes})`) + Button(`reviewVotes(${this.reviewVotes}), give +1`) + .onClick(() => this.reviewVotes += 1) + } + .width('50%') + } +} + +@Component +struct CompC { + build() { + Row({ space: 5 }) { + CompD() + CompD() + } + } +} + +@Component +struct CompB { + build() { + CompC() + } +} + +@Entry +@Component +struct CompA { + // @Provide装饰的变量reviewVotes由入口组件CompA提供其后代组件 + @Provide reviewVotes: number = 0; + + build() { + Column() { + Button(`reviewVotes(${this.reviewVotes}), give +1`) + .onClick(() => this.reviewVotes += 1) + CompB() + } + } +} +``` diff --git a/zh-cn/application-dev/quick-start/arkts-rendering-control-foreach.md b/zh-cn/application-dev/quick-start/arkts-rendering-control-foreach.md new file mode 100644 index 0000000000000000000000000000000000000000..a5c2509c19fc680b838bbe5ba221e8597cbd9fc2 --- /dev/null +++ b/zh-cn/application-dev/quick-start/arkts-rendering-control-foreach.md @@ -0,0 +1,347 @@ +# ForEach:循环渲染 + + +ForEach基于数组类型数据执行循环渲染。 + +> **说明:** +> +> 从API version 9开始,该接口支持在ArkTS卡片中使用。 + +## 接口描述 + + +```ts +ForEach( + arr: any[], + itemGenerator: (item: any, index?: number) => void, + keyGenerator?: (item: any, index?: number) => string +) +``` + + +| 参数名 | 参数类型 | 必填 | 参数描述 | +| ------------- | ---------------------------------------- | ---- | ---------------------------------------- | +| arr | Array | 是 | 必须是数组,允许设置为空数组,空数组场景下将不会创建子组件。同时允许设置返回值为数组类型的函数,例如arr.slice(1, 3),设置的函数不得改变包括数组本身在内的任何状态变量,如Array.splice、Array.sort或Array.reverse这些改变原数组的函数。 | +| itemGenerator | (item: any, index?: number) => void | 是 | 生成子组件的lambda函数,为数组中的每一个数据项创建一个或多个子组件,单个子组件或子组件列表必须包括在大括号“{...}”中。
**说明:**
- 子组件的类型必须是ForEach的父容器组件所允许的(例如,只有当ForEach父级为List组件时,才允许LitemItem子组件)。
- 允许子类构造函数返回if或另一个ForEach。ForEach可以在if内的任意位置。
- 可选index参数如在函数体中使用,则必须仅在函数签名中指定。 | +| keyGenerator | (item: any, index?: number) => string | 否 | 匿名函数,用于给数组中的每一个数据项生成唯一且固定的键值。键值生成器的功能是可选的,但是,为了使开发框架能够更好地识别数组更改,提高性能,建议提供。如将数组反向时,如果没有提供键值生成器,则ForEach中的所有节点都将重建。
**说明:**
- 同一数组中的不同项绝对不能计算出相同的ID。
- 如果未使用index参数,则项在数组中的位置变动不得改变项的键值。如果使用了index参数,则当项在数组中的位置有变动时,键值必须更改。
- 当某个项目被新项替换(值不同)时,被替换的项键值和新项的键值必须不同。
- 在构造函数中使用index参数时,键值生成函数也必须使用该参数。
- 键值生成函数不允许改变任何组件状态。 | + + +## 使用限制 + +- ForEach必须在容器组件内使用。 + +- 生成的子组件应当是允许包含在ForEach父容器组件中的子组件。 + +- 允许子组件生成器函数中包含if/else条件渲染,同时也允许ForEach包含在if/else条件渲染语句中。 + +- itemGenerator函数的调用顺序不一定和数组中的数据项相同,在开发过程中不要假设itemGenerator和keyGenerator函数是否执行及其执行顺序。例如,以下示例可能无法正确运行: + + ```ts + ForEach(anArray.map((item1, index1) => { return { i: index1 + 1, data: item1 }; }), + item => Text(`${item.i}. item.data.label`), + item => item.data.id.toString()) + ``` + + +## 开发者的建议 + +- 建议开发者不要假设项构造函数的执行顺序。执行顺序可能不能是数组中项的排列顺序。 + +- 不要假设数组项是否是初始渲染。ForEach的初始渲染在\@Component首次渲染时构建所有数组项。后续框架版本中可能会将此行为更改为延迟加载模式。 + +- 使用 index参数对UI更新性能有严重的负面影响,请尽量避免。 + +- 如果项构造函数中使用index参数,则项索引函数中也必须使用该参数。否则,如果项索引函数未使用index参数,ForEach在生成实际的键值时,框架也会把index考虑进来,默认将index拼接在后面。 + + +## 使用场景 + + +### 简单ForEach示例 + +根据arr数据分别创建3个Text和Divide组件。 + + +```ts +@Entry +@Component +struct MyComponent { + @State arr: number[] = [10, 20, 30]; + + build() { + Column({ space: 5 }) { + Button('Reverse Array') + .onClick(() => { + this.arr.reverse(); + }) + ForEach(this.arr, (item: number) => { + Text(`item value: ${item}`).fontSize(18) + Divider().strokeWidth(2) + }, (item: number) => item.toString()) + } + } +} +``` + + +### 复杂ForEach示例 + + +```ts +@Component +struct CounterView { + label: string; + @State count: number = 0; + + build() { + Button(`${this.label}-${this.count} click +1`) + .width(300).height(40) + .backgroundColor('#a0ffa0') + .onClick(() => { + this.count++; + }) + } +} + +@Entry +@Component +struct MainView { + @State arr: number[] = Array.from(Array(10).keys()); // [0.,.9] + nextUnused: number = this.arr.length; + + build() { + Column() { + Button(`push new item`) + .onClick(() => { + this.arr.push(this.nextUnused++) + }) + .width(300).height(40) + Button(`pop last item`) + .onClick(() => { + this.arr.pop() + }) + .width(300).height(40) + Button(`prepend new item (unshift)`) + .onClick(() => { + this.arr.unshift(this.nextUnused++) + }) + .width(300).height(40) + Button(`remove first item (shift)`) + .onClick(() => { + this.arr.shift() + }) + .width(300).height(40) + Button(`insert at pos ${Math.floor(this.arr.length / 2)}`) + .onClick(() => { + this.arr.splice(Math.floor(this.arr.length / 2), 0, this.nextUnused++); + }) + .width(300).height(40) + Button(`remove at pos ${Math.floor(this.arr.length / 2)}`) + .onClick(() => { + this.arr.splice(Math.floor(this.arr.length / 2), 1); + }) + .width(300).height(40) + Button(`set at pos ${Math.floor(this.arr.length / 2)} to ${this.nextUnused}`) + .onClick(() => { + this.arr[Math.floor(this.arr.length / 2)] = this.nextUnused++; + }) + .width(300).height(40) + ForEach(this.arr, + (item) => { + CounterView({ label: item.toString() }) + }, + (item) => item.toString() + ) + } + } +} +``` + +MainView拥有一个\@State装饰的数字数组。添加、删除和替换数组项是可观察到的变化事件,当这些事件发生时,MainView内的ForEach都会更新。 + +项目索引函数为每个数组项创建唯一且持久的键值,ArkUI框架通过此键值确定数组中的项是否有变化,只要键值相同,数组项的值就假定不变,但其索引位置可能会更改。此机制的运行前提是不同的数组项不能有相同的键值。 + +使用计算出的ID,框架可以对添加、删除和保留的数组项加以区分: + +1. 框架将删除已删除数组项的UI组件。 + +2. 框架仅对新添加的数组项执行项构造函数。 + +3. 框架不会为保留的数组项执行项构造函数。如果数组中的项索引已更改,框架将仅根据新顺序移动其UI组件,但不会更新该UI组件。 + +建议使用项目索引函数,但这是可选的。生成的ID必须是唯一的,这意味着不能为数组中的不同项计算出相同的ID。即使两个数组项具有相同的值,其ID也必须不同。 + +如果数组项值更改,则ID必须更改。 +如前所述,id生成函数是可选的。以下是不带项索引函数的ForEach: + + ```ts + ForEach(this.arr, + (item) => { + CounterView({ label: item.toString() }) + } + ) + ``` + +如果没有提供项ID函数,则框架会尝试在更新ForEach时智能检测数组更改。但是,它可能会删除子组件,并为在数组中移动(索引被更改)的数组项重新执行项构造函数。在上面的示例中,这将更改应用程序针对CounterView counter状态的行为。创建新的CounterView实例时,counter的值将初始化为0。 + + +### 使用\@ObjectLink的ForEach示例 + +当需要保留重复子组件的状态时,\@ObjectLink可将状态在组件树中向父组件推送。 + + +```ts +let NextID: number = 0; + +@Observed +class MyCounter { + public id: number; + public c: number; + + constructor(c: number) { + this.id = NextID++; + this.c = c; + } +} + +@Component +struct CounterView { + @ObjectLink counter: MyCounter; + label: string = 'CounterView'; + + build() { + Button(`CounterView [${this.label}] this.counter.c=${this.counter.c} +1`) + .width(200).height(50) + .onClick(() => { + this.counter.c += 1; + }) + } +} + +@Entry +@Component +struct MainView { + @State firstIndex: number = 0; + @State counters: Array = [new MyCounter(0), new MyCounter(0), new MyCounter(0), + new MyCounter(0), new MyCounter(0)]; + + build() { + Column() { + ForEach(this.counters.slice(this.firstIndex, this.firstIndex + 3), + (item) => { + CounterView({ label: `Counter item #${item.id}`, counter: item }) + }, + (item) => item.id.toString() + ) + Button(`Counters: shift up`) + .width(200).height(50) + .onClick(() => { + this.firstIndex = Math.min(this.firstIndex + 1, this.counters.length - 3); + }) + Button(`counters: shift down`) + .width(200).height(50) + .onClick(() => { + this.firstIndex = Math.max(0, this.firstIndex - 1); + }) + } + } +} +``` + +当增加firstIndex的值时,Mainview内的ForEach将更新,并删除与项ID firstIndex-1关联的CounterView子组件。对于ID为firstindex + 3的数组项,将创建新的CounterView子组件实例。由于CounterView子组件的状态变量counter值由父组件Mainview维护,故重建CounterView子组件实例不会重建状态变量counter值。 + +> **说明:** +> +> 违反上述数组项ID规则是最常见的应用开发错误,尤其是在Array<number>场景下,因为执行过程中很容易添加重复的数字。 + + +### ForEach的嵌套使用 + +允许将ForEach嵌套在同一组件中的另一个ForEach中,但更推荐将组件拆分为两个,每个构造函数只包含一个ForEach。下面为ForEach嵌套使用反例。 + + +```ts +class Month { + year: number; + month: number; + days: number[]; + + constructor(year: number, month: number, days: number[]) { + this.year = year; + this.month = month; + this.days = days; + } +} +@Component +struct CalendarExample { + // 模拟6个月 + @State calendar : Month[] = [ + new Month(2020, 1, [...Array(31).keys()]), + new Month(2020, 2, [...Array(28).keys()]), + new Month(2020, 3, [...Array(31).keys()]), + new Month(2020, 4, [...Array(30).keys()]), + new Month(2020, 5, [...Array(31).keys()]), + new Month(2020, 6, [...Array(30).keys()]) + ] + build() { + Column() { + Button() { + Text('next month') + }.onClick(() => { + this.calendar.shift() + this.calendar.push(new Month(year: 2020, month: 7, days: [...Array(31).keys()])) + }) + ForEach(this.calendar, + (item: Month) => { + ForEach(item.days, + (day : number) => { + // 构建日期块 + }, + (day : number) => day.toString() + )// 内部ForEach + }, + (item: Month) => (item.year * 12 + item.month).toString() // 字段与年和月一起使用,作为月份的唯一ID。 + )// 外部ForEach + } + } +} +``` + +以上示例存在两个问题: + +1. 代码可读性差。 + +2. 对于上述的年月份数据的数组结构形式,由于框架无法观察到针对该数组中Month数据结构的改变(比如day数组变化),从而内层的ForEach无法刷新日期显示。 + +建议应用设计时将Calendar拆分为Year、Month和Day子组件。定义一个“Day”模型类,以保存有关day的信息,并用\@Observed装饰此类。DayView组件利用ObjectLink装饰变量以绑定day数据。对MonthView和Month模型类执行同样的操作。 + + +### ForEach中使用可选index参数示例 + +可以在构造函数和ID生成函数中使用可选的index参数。 + + +```ts +@Entry +@Component +struct ForEachWithIndex { + @State arr: number[] = [4, 3, 1, 5]; + + build() { + Column() { + ForEach(this.arr, + (it, indx) => { + Text(`Item: ${indx} - ${it}`) + }, + (it, indx) => { + return `${indx} - ${it}` + } + ) + } + } +} +``` + +必须正确构造ID生成函数。当在项构造函数中使用index参数时,ID生成函数也必须使用index参数,以生成唯一ID和给定源数组项的ID。当数组项在数组中的索引位置发生变化时,其ID会发生变化。 + +此示例还说明了index参数会造成显著性能下降。即使项在源数组中移动而不做修改,因为索引发生改变,依赖该数组项的UI仍然需要重新渲染。例如,使用索引排序时,数组只需要将ForEach未修改的子UI节点移动到正确的位置,这对于框架来说是一个轻量级操作。而使用索引时,所有子UI节点都需要重新构建,这操作负担要重得多。 diff --git a/zh-cn/application-dev/quick-start/arkts-rendering-control-ifelse.md b/zh-cn/application-dev/quick-start/arkts-rendering-control-ifelse.md new file mode 100644 index 0000000000000000000000000000000000000000..80565882488ebc61723a5db3ff88338d29f0e1f6 --- /dev/null +++ b/zh-cn/application-dev/quick-start/arkts-rendering-control-ifelse.md @@ -0,0 +1,229 @@ +# if/else:条件渲染 + + +ArkTS提供了渲染控制的能力。条件渲染可根据应用的不同状态,使用if、else和else if渲染对应状态下的UI内容。 + +> **说明:** +> +> 从API version 9开始,该接口支持在ArkTS卡片中使用。 + +## 使用规则 + +- 支持if、else和else if语句。 + +- if、else if后跟随的条件语句可以使用状态变量。 + +- 允许在容器组件内使用,通过条件渲染语句构建不同的子组件。 + +- 条件渲染语句在涉及到组件的父子关系时是“透明”的,当父组件和子组件之间存在一个或多个if语句时,必须遵守父组件关于子组件使用的规则。 + +- 每个分支内部的构建函数必须遵循构建函数的规则,并创建一个或多个组件。无法创建组件的空构建函数会产生语法错误。 + +- 某些容器组件限制子组件的类型或数量,将条件渲染语句用于这些组件内时,这些限制将同样应用于条件渲染语句内创建的组件。例如,Grid容器组件的子组件仅支持GridItem组件,在Grid内使用条件渲染语句时,条件渲染语句内仅允许使用GridItem组件。 + + +## 更新机制 + +当if、else if后跟随的状态判断中使用的状态变量值变化时,条件渲染语句会进行更新,更新步骤如下: + +1. 评估if和else if的状态判断条件,如果分支没有变化,请无需执行以下步骤。如果分支有变化,则执行2、3步骤: + +2. 删除此前构建的所有子组件。 + +3. 执行新分支的构造函数,将获取到的组件添加到if父容器中。如果缺少适用的else分支,则不构建任何内容。 + +条件可以包括Typescript表达式。对于构造函数中的表达式,此类表达式不得更改应用程序状态。 + + +## 使用场景 + + +### 使用if进行条件渲染 + + +```ts +@Entry +@Component +struct ViewA { + @State count: number = 0; + + build() { + Column() { + Text(`count=${this.count}`) + + if (this.count > 0) { + Text(`count is positive`) + .fontColor(Color.Green) + } + + Button('increase count') + .onClick(() => { + this.count++; + }) + + Button('decrease count') + .onClick(() => { + this.count--; + }) + } + } +} +``` + +if语句的每个分支都包含一个构建函数。此类构建函数必须创建一个或多个子组件。在初始渲染时,if语句会执行构建函数,并将生成的子组件添加到其父组件中。 + +每当if或else if条件语句中使用的状态变量发生变化时,条件语句都会更新并重新评估新的条件值。如果条件值评估发生了变化,这意味着需要构建另一个条件分支。此时ArkUI框架将: + +1. 删除所有以前渲染的(早期分支的)组件。 + +2. 执行新分支的构造函数,将生成的子组件添加到其父组件中。 + +在以上示例中,如果count从0增加到1,那么if语句更新,条件count > 0将重新评估,评估结果将从false更改为true。因此,将执行条件为真分支的构造函数,创建一个Text组件,并将它添加到父组件Column中。如果后续count更改为0,则Text组件将从Column组件中删除。由于没有else分支,因此不会执行新的构造函数。 + + +### if ... else ...语句和子组件状态 + +以下示例包含if ... else ...语句与拥有\@State装饰变量的子组件。 + + +```ts +@Component +struct CounterView { + @State counter: number = 0; + label: string = 'unknown'; + + build() { + Row() { + Text(`${this.label}`) + Button(`counter ${this.counter} +1`) + .onClick(() => { + this.counter += 1; + }) + } + } +} + +@Entry +@Component +struct MainView { + @State toggle: boolean = true; + + build() { + Column() { + if (this.toggle) { + CounterView({ label: 'CounterView #positive' }) + } else { + CounterView({ label: 'CounterView #negative' }) + } + Button(`toggle ${this.toggle}`) + .onClick(() => { + this.toggle = !this.toggle; + }) + } + } +} +``` + +CounterView(label为 'CounterView \#positive')子组件在初次渲染时创建。此子组件携带名为counter的状态变量。当修改CounterView.counter状态变量时,CounterView(label为 'CounterView \#positive')子组件重新渲染时并保留状态变量值。当MainView.toggle状态变量的值更改为false时,MainView父组件内的if语句将更新,随后将删除CounterView(label为 'CounterView \#positive')子组件。与此同时,将创建新的CounterView(label为 'CounterView \#negative')实例。而它自己的counter状态变量设置为初始值0。 + +> **说明:** +> +> CounterView(label为 'CounterView \#positive')和CounterView(label为 'CounterView \#negative')是同一自定义组件的两个不同实例。if分支的更改,不会更新现有子组件,也不会保留状态。 + +以下示例展示了条件更改时,若需要保留counter值所做的修改。 + + +``` +@Component +struct CounterView { + @Link counter: number; + label: string = 'unknown'; + + build() { + Row() { + Text(`${this.label}`) + Button(`counter ${this.counter} +1`) + .onClick(() => { + this.counter += 1; + }) + } + } +} + +@Entry +@Component +struct MainView { + @State toggle: boolean = true; + @State counter: number = 0; + + build() { + Column() { + if (this.toggle) { + CounterView({ counter: $counter, label: 'CounterView #positive' }) + } else { + CounterView({ counter: $counter, label: 'CounterView #negative' }) + } + Button(`toggle ${this.toggle}`) + .onClick(() => { + this.toggle = !this.toggle; + }) + } + } +} +``` + +此处,\@State counter变量归父组件所有。因此,当CounterView组件实例被删除时,该变量不会被销毁。CounterView组件通过\@Link装饰器引用状态。状态必须从子级移动到其父级(或父级的父级),以避免在条件内容或重复内容被销毁时丢失状态。 + + +### 嵌套if语句 + +条件语句的嵌套对父组件的相关规则没有影响。 + + +```ts +@Entry +@Component +struct CompA { + @State toggle: boolean = false; + @State toggleColor: boolean = false; + + build() { + Column() { + Text('Before') + .fontSize(15) + if (this.toggle) { + Text('Top True, positive 1 top') + .backgroundColor('#aaffaa').fontSize(20) + // 内部if语句 + if (this.toggleColor) { + Text('Top True, Nested True, positive COLOR Nested ') + .backgroundColor('#00aaaa').fontSize(15) + } else { + Text('Top True, Nested False, Negative COLOR Nested ') + .backgroundColor('#aaaaff').fontSize(15) + } + } else { + Text('Top false, negative top level').fontSize(20) + .backgroundColor('#ffaaaa') + if (this.toggleColor) { + Text('positive COLOR Nested ') + .backgroundColor('#00aaaa').fontSize(15) + } else { + Text('Negative COLOR Nested ') + .backgroundColor('#aaaaff').fontSize(15) + } + } + Text('After') + .fontSize(15) + Button('Toggle Outer') + .onClick(() => { + this.toggle = !this.toggle; + }) + Button('Toggle Inner') + .onClick(() => { + this.toggleColor = !this.toggleColor; + }) + } + } +} +``` diff --git a/zh-cn/application-dev/quick-start/arkts-rendering-control-lazyforeach.md b/zh-cn/application-dev/quick-start/arkts-rendering-control-lazyforeach.md new file mode 100644 index 0000000000000000000000000000000000000000..876ae9dd328440fd5816983e3321b61dd92c6b16 --- /dev/null +++ b/zh-cn/application-dev/quick-start/arkts-rendering-control-lazyforeach.md @@ -0,0 +1,220 @@ +# LazyForEach:数据懒加载 + + +LazyForEach从提供的数据源中按需迭代数据,并在每次迭代过程中创建相应的组件。当LazyForEach在滚动容器中使用了,框架会根据滚动容器可视区域按需创建组件,当组件划出可视区域外时,框架会进行组件销毁回收以降低内存占用。 + + +## 接口描述 + + +```ts +LazyForEach( + dataSource: IDataSource, // 需要进行数据迭代的数据源 + itemGenerator: (item: any) => void, // 子组件生成函数 + keyGenerator?: (item: any) => string // (可选) .键值生成函数 +): void +interface IDataSource { + totalCount(): number; // Get total count of data + getData(index: number): any; // Get single data by index + registerDataChangeListener(listener: DataChangeListener): void; // Register listener to listening data changes + unregisterDataChangeListener(listener: DataChangeListener): void; // Unregister listener +} +interface DataChangeListener { + onDataReloaded(): void; // Called while data reloaded + onDataAdd(index: number): void; // Called while single data added + onDataMove(from: number, to: number): void; // Called while single data moved + onDataDelete(index: number): void; // Called while single data deleted + onDataChange(index: number): void; // Called while single data changed +} +``` + +**参数:** + + +| 参数名 | 参数类型 | 必填 | 参数描述 | +| ------------- | --------------------------------------- | ---- | ---------------------------------------- | +| dataSource | IDataSource | 是 | LazyForEach数据源,需要开发者实现相关接口。 | +| itemGenerator | (item: any) => void | 是 | 子组件生成函数,为数组中的每一个数据项创建一个子组件。
**说明:**
itemGenerator的函数体必须使用大括号{...}。itemGenerator每次迭代只能并且必须生成一个子组件。itemGenerator中可以使用if语句,但是必须保证if语句每个分支都会创建一个相同类型的子组件。itemGenerator中不允许使用ForEach和LazyForEach语句。 | +| keyGenerator | (item: any) => string | 否 | 键值生成函数,用于给数据源中的每一个数据项生成唯一且固定的键值。当数据项在数组中的位置更改时,其键值不得更改,当数组中的数据项被新项替换时,被替换项的键值和新项的键值必须不同。键值生成器的功能是可选的,但是,为了使开发框架能够更好地识别数组更改,提高性能,建议提供。如将数组反向时,如果没有提供键值生成器,则LazyForEach中的所有节点都将重建。
**说明:**
数据源中的每一个数据项生成的键值不能重复。 | + + +## IDataSource类型说明 + + +```ts +interface IDataSource { + totalCount(): number; + getData(index: number): any; + registerDataChangeListener(listener: DataChangeListener): void; + unregisterDataChangeListener(listener: DataChangeListener): void; +} +``` + +| 接口声明 | 参数类型 | 说明 | +| ---------------------------------------- | ------------------ | ------------------------------------- | +| totalCount(): number | - | 获得数据总数。 | +| getData(index: number): any | number | 获取索引值index对应的数据。
index:获取数据对应的索引值 | +| registerDataChangeListener(listener:DataChangeListener): void | DataChangeListener | 注册数据改变的监听器。
listener:数据变化监听器 | +| unregisterDataChangeListener(listener:DataChangeListener): void | DataChangeListener | 注销数据改变的监听器。
listener:数据变化监听器 | + + +## DataChangeListener类型说明 + + +```ts +interface DataChangeListener { + onDataReloaded(): void; + onDataAdded(index: number): void; + onDataMoved(from: number, to: number): void; + onDataDeleted(index: number): void; + onDataChanged(index: number): void; + onDataAdd(index: number): void; + onDataMove(from: number, to: number): void; + onDataDelete(index: number): void; + onDataChange(index: number): void; +} +``` + +| 接口声明 | 参数类型 | 说明 | +| ---------------------------------------- | -------------------------------------- | ---------------------------------------- | +| onDataReloaded(): void | - | 通知组件重新加载所有数据。 | +| onDataAdded(index: number):void | number | 通知组件index的位置有数据添加。
index:数据添加位置的索引值 | +| onDataMoved(from: number, to: number): void | from: number,
to: number | 通知组件数据有移动。
from: 数据移动起始位置,to: 数据移动目标位置。
**说明:**
数据移动前后键值要保持不变,如果键值有变化,应使用删除数据和新增数据接口。 | +| onDataChanged(index: number): void | number | 通知组件index的位置有数据有变化。
index:数据变化监听器。 | +| onDataAdd(index: number): void | number | 通知组件index的位置有数据添加。
index:数据添加位置的索引值 | +| onDataMove(from: number, to: number): void | from: number,
to: number | 通知组件数据有移动。
from: 数据移动起始位置,to: 数据移动目标位置。
**说明:**
数据移动前后键值要保持不变,如果键值有变化,应使用删除数据和新增数据接口。 | +| onDataChanged(index: number): void | number | 通知组件index的位置有数据有变化。
index:数据变化位置的索引值 | + + +## 使用限制 + +- LazyForEach必须在容器组件内使用,仅有List、Grid以及Swiper组件支持数据懒加载(即只加载可视部分以及其前后少量数据用于缓冲),其他组件仍然是一次性加载所有的数据。 + +- LazyForEach在每次迭代中,必须创建且只允许创建一个子组件。 + +- 生成的子组件必须是允许包含在LazyForEach父容器组件中的子组件。 + +- 允许LazyForEach包含在if/else条件渲染语句中,也允许LazyForEach中出现if/else条件渲染语句。 + +- 键值生成器必须针对每个数据生成唯一的值,如果键值相同,将导致键值相同的UI组件被框架忽略,从而无法在父容器内显示。 + +- LazyForEach必须使用DataChangeListener对象来进行更新,第一个参数dataSource使用状态变量时,状态变量改变不会触发LazyForEach的UI刷新。 + +- 为了高性能渲染,通过DataChangeListener对象的onDataChange方法来更新UI时,需要生成不同于原来的键值来触发组件刷新。 + +- itemGenerator函数的调用顺序不一定和数据源中的数据项相同,在开发过程中不要假设itemGenerator和keyGenerator函数是否执行及其执行顺序。例如,以下示例可能无法正常运行: + + + ```ts + LazyForEach(dataSource, + item => Text(`${item.i}. item.data.label`), + item => item.data.id.toString()) + ``` + + +## 示例 + + +```ts +// Basic implementation of IDataSource to handle data listener +class BasicDataSource implements IDataSource { + private listeners: DataChangeListener[] = []; + + public totalCount(): number { + return 0; + } + + public getData(index: number): any { + return undefined; + } + + registerDataChangeListener(listener: DataChangeListener): void { + if (this.listeners.indexOf(listener) < 0) { + console.info('add listener'); + this.listeners.push(listener); + } + } + + unregisterDataChangeListener(listener: DataChangeListener): void { + const pos = this.listeners.indexOf(listener); + if (pos >= 0) { + console.info('remove listener'); + this.listeners.splice(pos, 1); + } + } + + notifyDataReload(): void { + this.listeners.forEach(listener => { + listener.onDataReloaded(); + }) + } + + notifyDataAdd(index: number): void { + this.listeners.forEach(listener => { + listener.onDataAdd(index); + }) + } + + notifyDataChange(index: number): void { + this.listeners.forEach(listener => { + listener.onDataChange(index); + }) + } + + notifyDataDelete(index: number): void { + this.listeners.forEach(listener => { + listener.onDataDelete(index); + }) + } + + notifyDataMove(from: number, to: number): void { + this.listeners.forEach(listener => { + listener.onDataMove(from, to); + }) + } +} + +class MyDataSource extends BasicDataSource { + private dataArray: string[] = ['/path/image0', '/path/image1', '/path/image2', '/path/image3']; + + public totalCount(): number { + return this.dataArray.length; + } + + public getData(index: number): any { + return this.dataArray[index]; + } + + public addData(index: number, data: string): void { + this.dataArray.splice(index, 0, data); + this.notifyDataAdd(index); + } + + public pushData(data: string): void { + this.dataArray.push(data); + this.notifyDataAdd(this.dataArray.length - 1); + } +} + +@Entry +@Component +struct MyComponent { + private data: MyDataSource = new MyDataSource(); + + build() { + List({ space: 3 }) { + LazyForEach(this.data, (item: string) => { + ListItem() { + Row() { + Image(item).width('30%').height(50) + Text(item).fontSize(20).margin({ left: 10 }) + }.margin({ left: 10, right: 10 }) + } + .onClick(() => { + this.data.pushData('/path/image' + this.data.totalCount()); + }) + }, item => item) + } + } +} +``` diff --git a/zh-cn/application-dev/quick-start/arkts-rendering-control-overview.md b/zh-cn/application-dev/quick-start/arkts-rendering-control-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..4ee0e53737ad6000377d5ab1e745ba5a1ca1f4f5 --- /dev/null +++ b/zh-cn/application-dev/quick-start/arkts-rendering-control-overview.md @@ -0,0 +1,4 @@ +# 渲染控制概述 + + +ArkUI通过[自定义组件](arkts-create-custom-components.md)的build()函数和[@builder装饰器](arkts-builder.md)中的声明式UI描述语句构建相应的UI。在声明式描述语句中开发者除了使用系统组件外,还可以使用渲染控制语句来辅助UI的构建,这些渲染控制语句包括控制组件是否显示的条件渲染语句,基于数组数据快速生成组件的循环渲染语句以及针对大数据量场景的数据懒加载语句。 diff --git a/zh-cn/application-dev/quick-start/arkts-rendering-control.md b/zh-cn/application-dev/quick-start/arkts-rendering-control.md deleted file mode 100644 index b9cc90f0b09ef277437451bdcd5a7b87daf54949..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/quick-start/arkts-rendering-control.md +++ /dev/null @@ -1,282 +0,0 @@ -# 渲染控制 - -ArkTS也提供了渲染控制的能力。条件渲染可根据应用的不同状态,渲染对应状态下的UI内容。循环渲染可从数据源中迭代获取数据,并在每次迭代过程中创建相应的组件。 - -## 条件渲染 - -使用if/else进行条件渲染。 - - -> **说明:** -> -> - if/else条件语句可以使用状态变量。 -> -> - 使用if/else可以使子组件的渲染依赖条件语句。 -> -> - 必须在容器组件内使用。 -> -> - 某些容器组件限制子组件的类型或数量,将if/else用于这些组件内时,这些限制将同样应用于if/else语句内创建的组件。例如,Grid容器组件的子组件仅支持GridItem组件,在Grid内使用if/else时,则if/else语句内也仅允许使用GridItem组件。 - - -```ts -Column() { - if (this.count < 0) { - Text('count is negative').fontSize(14) - } else if (this.count % 2 === 0) { - Text('count is even').fontSize(14) - } else { - Text('count is odd').fontSize(14) - } -} -``` - -## 循环渲染 - -通过循环渲染(ForEach)从数组中获取数据,并为每个数据项创建相应的组件,可减少代码复杂度。 - -```ts -ForEach( - arr: any[], - itemGenerator: (item: any, index?: number) => void, - keyGenerator?: (item: any, index?: number) => string -) -``` - -**参数:** - -| 参数名 | 参数类型 | 必填 | 参数描述 | -| ------------- | ------------------------------------- | ---- | ------------------------------------------------------------ | -| arr | any[] | 是 | 必须是数组,允许设置为空数组,空数组场景下将不会创建子组件。同时允许设置返回值为数组类型的函数,例如arr.slice(1, 3),设置的函数不得改变包括数组本身在内的任何状态变量,如Array.splice、Array.sort或Array.reverse这些改变原数组的函数。 | -| itemGenerator | (item: any, index?: number) => void | 是 | 生成子组件的lambda函数,为数组中的每一个数据项创建一个或多个子组件,单个子组件或子组件列表必须包括在大括号“{...}”中。 | -| keyGenerator | (item: any, index?: number) => string | 否 | 匿名函数,用于给数组中的每一个数据项生成唯一且固定的键值。当数据项在数组中的位置更改时,其键值不得更改,当数组中的数据项被新项替换时,被替换项的键值和新项的键值必须不同。键值生成器的功能是可选的,但是,为了使开发框架能够更好地识别数组更改,提高性能,建议提供。如将数组反向时,如果没有提供键值生成器,则ForEach中的所有节点都将重建。 | - -> **说明:** -> -> - ForEach必须在容器组件内使用。 -> -> - 生成的子组件应当是允许包含在ForEach父容器组件中的子组件。 -> -> - 允许子组件生成器函数中包含if/else条件渲染,同时也允许ForEach包含在if/else条件渲染语句中。 -> -> - itemGenerator函数的调用顺序不一定和数组中的数据项相同,在开发过程中不要假设itemGenerator和keyGenerator函数是否执行及其执行顺序。例如,以下示例可能无法正常工作: -> -> ```ts -> ForEach(anArray.map((item1, index1) => { return { i: index1 + 1, data: item1 }; }), -> item => Text(`${item.i}. item.data.label`), -> item => item.data.id.toString()) -> ``` - -## 示例 - -```ts -// xxx.ets -@Entry -@Component -struct MyComponent { - @State arr: number[] = [10, 20, 30] - - build() { - Column({ space: 5 }) { - Button('Reverse Array') - .onClick(() => { - this.arr.reverse() - }) - - ForEach(this.arr, (item: number) => { - Text(`item value: ${item}`).fontSize(18) - Divider().strokeWidth(2) - }, (item: number) => item.toString()) - } - } -} -``` - -![forEach1](figures/forEach1.gif) - -## 数据懒加载 - -通过数据懒加载(LazyForEach)从提供的数据源中按需迭代数据,并在每次迭代过程中创建相应的组件。 - -```ts -LazyForEach( - dataSource: IDataSource, - itemGenerator: (item: any) => void, - keyGenerator?: (item: any) => string -): void - -interface IDataSource { - totalCount(): number; - getData(index: number): any; - registerDataChangeListener(listener: DataChangeListener): void; - unregisterDataChangeListener(listener: DataChangeListener): void; -} - -interface DataChangeListener { - onDataReloaded(): void; - onDataAdd(index: number): void; - onDataMove(from: number, to: number): void; - onDataDelete(index: number): void; - onDataChange(index: number): void; -} -``` - -**参数:** - -| 参数名 | 参数类型 | 必填 | 参数描述 | -| ------------- | --------------------- | ---- | ------------------------------------------------------------ | -| dataSource | IDataSource | 是 | 实现IDataSource接口的对象,需要开发者实现相关接口。 | -| itemGenerator | (item: any, index?: number) => void | 是 | 生成子组件的lambda函数,为数组中的每一个数据项创建一个或多个子组件,单个子组件或子组件列表必须包括在大括号“{...}”中。 | -| keyGenerator | (item: any, index?: number) => string | 否 | 匿名函数,用于给数组中的每一个数据项生成唯一且固定的键值。当数据项在数组中的位置更改时,其键值不得更改,当数组中的数据项被新项替换时,被替换项的键值和新项的键值必须不同。键值生成器的功能是可选的,但是,为了使开发框架能够更好地识别数组更改,提高性能,建议提供。如将数组反向时,如果没有提供键值生成器,则LazyForEach中的所有节点都将重建。 | - -### IDataSource类型说明 - -| 名称 | 描述 | -| ------------------------------------------------------------ | ---------------------- | -| totalCount(): number | 获取数据总数。 | -| getData(index: number): any | 获取索引值index对应的数据。 | -| registerDataChangeListener(listener:DataChangeListener): void | 注册数据改变的监听器。 | -| unregisterDataChangeListener(listener:DataChangeListener): void | 注销数据改变的监听器。 | - -### DataChangeListener类型说明 - -| 名称 | 描述 | -| -------------------------------------------------------- | -------------------------------------- | -| onDataReloaded(): void | 重新加载所有数据。 | -| onDataAdded(index: number): voiddeprecated | 通知组件index的位置有数据添加。从API Version 8开始废弃,建议使用onDataAdd。 | -| onDataMoved(from: number, to: number): voiddeprecated | 通知组件数据从from的位置移到to的位置。从API Version 8开始废弃,建议使用onDataMove。 | -| onDataDeleted(index: number): voiddeprecated | 通知组件index的位置有数据删除。从API Version 8开始废弃,建议使用onDataDelete。 | -| onDataChanged(index: number): voiddeprecated | 通知组件index的位置有数据变化。 从API Version 8开始废弃,建议使用onDataChange。 | -| onDataAdd(index: number): void8+ | 通知组件index的位置有数据添加。 | -| onDataMove(from: number, to: number): void8+ | 通知组件数据从from的位置移到to的位置。 | -| onDataDelete(index: number): void8+ | 通知组件index的位置有数据删除。 | -| onDataChange(index: number): void8+ | 通知组件index的位置有数据变化。 | - -## 示例 - -```ts -// xxx.ets -class BasicDataSource implements IDataSource { - private listeners: DataChangeListener[] = [] - - public totalCount(): number { - return 0 - } - - public getData(index: number): any { - return undefined - } - - registerDataChangeListener(listener: DataChangeListener): void { - if (this.listeners.indexOf(listener) < 0) { - console.info('add listener') - this.listeners.push(listener) - } - } - - unregisterDataChangeListener(listener: DataChangeListener): void { - const pos = this.listeners.indexOf(listener); - if (pos >= 0) { - console.info('remove listener') - this.listeners.splice(pos, 1) - } - } - - notifyDataReload(): void { - this.listeners.forEach(listener => { - listener.onDataReloaded() - }) - } - - notifyDataAdd(index: number): void { - this.listeners.forEach(listener => { - listener.onDataAdd(index) - }) - } - - notifyDataChange(index: number): void { - this.listeners.forEach(listener => { - listener.onDataChange(index) - }) - } - - notifyDataDelete(index: number): void { - this.listeners.forEach(listener => { - listener.onDataDelete(index) - }) - } - - notifyDataMove(from: number, to: number): void { - this.listeners.forEach(listener => { - listener.onDataMove(from, to) - }) - } -} - -class MyDataSource extends BasicDataSource { - // 初始化数据列表 - private dataArray: string[] = ['/path/image0.png', '/path/image1.png', '/path/image2.png', '/path/image3.png'] - - public totalCount(): number { - return this.dataArray.length - } - - public getData(index: number): any { - return this.dataArray[index] - } - - public addData(index: number, data: string): void { - this.dataArray.splice(index, 0, data) - this.notifyDataAdd(index) - } - - public pushData(data: string): void { - this.dataArray.push(data) - this.notifyDataAdd(this.dataArray.length - 1) - } -} - -@Entry -@Component -struct MyComponent { - private data: MyDataSource = new MyDataSource() - - build() { - List({ space: 3 }) { - LazyForEach(this.data, (item: string) => { - ListItem() { - Row() { - Image(item).width(50).height(50) - Text(item).fontSize(20).margin({ left: 10 }) - }.margin({ left: 10, right: 10 }) - } - .onClick(() => { - // 每点击一次列表项,数据增加一项 - this.data.pushData('/path/image' + this.data.totalCount() + '.png') - }) - }, item => item) - } - } -} -``` - -> **说明:** -> -> - LazyForEach必须在容器组件内使用,目前仅有List、Grid以及Swiper组件支持数据懒加载(即只加载可视部分以及其前后少量数据用于缓冲),其他组件仍然是一次性加载所有的数据。 -> -> - LazyForEach在每次迭代中,必须创建且只允许创建一个子组件。 -> -> - 生成的子组件必须是允许包含在LazyForEach父容器组件中的子组件。 -> -> - 允许LazyForEach包含在if/else条件渲染语句中。 -> -> - 为了高性能渲染,通过DataChangeListener对象的onDataChange方法来更新UI时,仅当itemGenerator中创建的子组件内使用了状态变量时,才会触发组件刷新。 -> -> - itemGenerator函数的调用顺序不一定和数据源中的数据项相同,在开发过程中不要假设itemGenerator和keyGenerator函数是否执行及其执行顺序。例如,以下示例可能无法正常工作: -> -> ```ts -> LazyForEach(dataSource, -> item => Text(`${item.i}. item.data.label`), -> item => item.data.id.toString()) -> ``` - -![lazyForEach](figures/lazyForEach.gif) \ No newline at end of file diff --git a/zh-cn/application-dev/quick-start/arkts-restrictions-and-extensions.md b/zh-cn/application-dev/quick-start/arkts-restrictions-and-extensions.md deleted file mode 100644 index 946b9ced5bc14583846a28a37b1b4f81535dfc81..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/quick-start/arkts-restrictions-and-extensions.md +++ /dev/null @@ -1,233 +0,0 @@ -# 使用限制与扩展 - -## 在生成器函数中的使用限制 - -ArkTS语言的使用在生成器函数中存在一定的限制: - -- 表达式仅允许在字符串(${expression})、if/else条件语句、ForEach的参数以及组件的参数中使用。 - -- 任何表达式都不能导致应用程序中状态变量(@State、@Link、@Prop)的改变,否则会造成未定义和潜在不稳定的框架行为。 - -- 生成器函数内部不能有局部变量。 - -上述限制都不适用于事件方法(如onClick)的匿名函数实现。 - -## 变量的双向绑定 - -ArkTS支持通过$$双向绑定变量,通常应用于状态值频繁改变的变量。 - -- 当前$$支持基础类型变量,以及@State、@Link和@Prop装饰的变量。 -- 当前$$仅支持[bindPopup](../reference/arkui-ts/ts-universal-attributes-popup.md)属性方法的show参数,[Radio](../reference/arkui-ts/ts-basic-components-radio.md)组件的checked属性,[Refresh](../reference/arkui-ts/ts-container-refresh.md)组件的refreshing参数。 -- $$绑定的变量变化时,仅渲染刷新当前组件,提高渲染速度。 - -```ts -// xxx.ets -@Entry -@Component -struct bindPopupPage { - @State customPopup: boolean = false - - build() { - Column() { - Button('Popup') - .margin(20) - .onClick(() => { - this.customPopup = !this.customPopup - }) - .bindPopup($$this.customPopup, { - message: "showPopup" - }) - } - } -} -``` - -![popup](figures/popup.gif) - -## 状态变量数据类型声明使用限制 - -1. 所有的状态装饰器变量需要显式声明变量类型,不允许声明any,不支持Date数据类型。 - - 示例: - - ```ts - // xxx.ets - @Entry - @Component - struct DatePickerExample { - //错误写法: @State isLunar: any = false - @State isLunar: boolean = false - //错误写法: @State selectedDate: Date = new Date('2021-08-08') - private selectedDate: Date = new Date('2021-08-08') - - build() { - Column() { - Button('切换公历农历') - .margin({ top: 30 }) - .onClick(() => { - this.isLunar = !this.isLunar - }) - DatePicker({ - start: new Date('1970-1-1'), - end: new Date('2100-1-1'), - selected: this.selectedDate - }) - .lunar(this.isLunar) - .onChange((value: DatePickerResult) => { - this.selectedDate.setFullYear(value.year, value.month, value.day) - console.info('select current date is: ' + JSON.stringify(value)) - }) - - }.width('100%') - } - } - ``` - - ![datePicker](../../application-dev/reference/arkui-ts/figures/datePicker.gif) - -2. @State、@Provide、 @Link和@Consume四种状态变量的数据类型声明只能由简单数据类型或引用数据类型的其中一种构成。 - - 类型定义中的Length、ResourceStr、ResourceColor三个类型是简单数据类型或引用数据类型的组合,所以不能被以上四种状态装饰器变量使用。 - Length、ResourceStr、ResourceColor的定义请看文档[arkui-ts类型定义](../../application-dev/reference/arkui-ts/ts-types.md)。 - - 示例: - - ```ts - // xxx.ets - @Entry - @Component - struct IndexPage { - //错误写法: @State message: string | Resource = 'Hello World' - @State message: string = 'Hello World' - //错误写法: @State message: ResourceStr = $r('app.string.hello') - @State resourceStr: Resource = $r('app.string.hello') - - build() { - Row() { - Column() { - Text(`${this.message}`) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - } - .height('100%') - } - } - ``` - - ![hello](figures/hello.PNG) - -## 自定义组件成员变量初始化的方式与约束 - -组件的成员变量可以通过两种方式初始化: - -- 本地初始化: - - ```ts - @State counter: Counter = new Counter() - ``` -- 在构造组件时通过构造参数初始化: - - ```ts - MyComponent({counter: $myCounter}) - ``` - -具体允许哪种方式取决于状态变量的装饰器: - -| 装饰器类型 | 本地初始化 | 通过构造函数参数初始化 | -| ------------ | ----- | ----------- | -| @State | 必须 | 可选 | -| @Prop | 禁止 | 必须 | -| @Link | 禁止 | 必须 | -| @StorageLink | 必须 | 禁止 | -| @StorageProp | 必须 | 禁止 | -| @LocalStorageLink | 必须 | 禁止 | -| @LocalStorageProp | 必须 | 禁止 | -| @Provide | 必须 | 可选 | -| @Consume | 禁止 | 禁止 | -| @ObjectLink | 禁止 | 必须 | -| 常规成员变量 | 推荐 | 可选 | - -从上表中可以看出: - -- @State变量需要本地初始化,初始化的值可以被构造参数覆盖。 - -- @Prop和@Link变量必须且仅通过构造函数参数进行初始化。 - -通过构造函数方法初始化成员变量,需要遵循如下规则: - -| **从父组件中的变量(右)到子组件中的变量(下)** | **regular** | **@State** | **@Link** | **@Prop** | **@Provide** | **@Consume** | **@ObjectLink** | -|---------------------------------|----------------------------|------------|-----------|-----------|--------------|--------------|------------------| -| **regular** | 支持 | 支持 | 支持 | 支持 | 不支持 | 不支持 | 支持 | -| **@State** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | -| **@Link** | 不支持 | 支持(1) | 支持(1) | 支持(1) | 支持(1) | 支持(1) | 支持(1) | -| **@Prop** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | -| **@Provide** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | -| **@Consume** | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | -| **@ObjectLink** | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | - -| **从父组件中的变量(右)到子组件中的变量(下)** | **@StorageLink** | **@StorageProp** | **@LocalStorageLink** | **@LocalStorageProp** | -|------------------|------------------|------------------|-----------------------|------------------------| -| **regular** | 支持 | 不支持 | 不支持 | 不支持 | -| **@State** | 支持 | 支持 | 支持 | 支持 | -| **@Link** | 支持(1) | 支持(1) | 支持(1) | 支持(1) | -| **@Prop** | 支持 | 支持 | 支持 | 支持 | -| **@Provide** | 支持 | 支持 | 支持 | 支持 | -| **@Consume** | 不支持 | 不支持 | 不支持 | 不支持 | -| **@ObjectLink** | 不支持 | 不支持 | 不支持 | 不支持 | - -> **说明** -> -> **支持(1)**:必须使用`$`, 例如 `this.$varA`。 -> **regular**:未加修饰的常规变量。 - -从上表中可以看出: - -- 子组件的@ObjectLink变量不支持父组件装饰器变量的直接赋值,其父组件的源必须是数组的项或对象的属性,该数组或对象必现用`@State`、`@Link`、`@Provide`、`@Consume`或`@ObjectLink`装饰器修饰。 - -- 父组件的常规变量可以用于初始化子组件的`@State`变量,但不能用于初始化`@Link`、`@Consume`和`@ObjectLink`变量。 - -- 父组件的@State变量可以初始化子组件的`@Prop`、`@Link`(通过$)或常规变量,但不能初始化子组件的@Consume变量。 - -- 父组件的@Link变量不可以初始化子组件的`@Consume`和`@ObjectLink`变量。 - -- 父组件的@Prop变量不可以初始化子组件的`@Consume`和`@ObjectLink`变量。 - -- 不允许从父组件初始化`@StorageLink`, `@StorageProp`, `@LocalStorageLink`, `@LocalStorageProp`修饰的变量。 - -- 除了上述规则外,还需要遵循TS的强类型规则。 - -示例: -```ts -@Entry -@Component -struct Parent { - message: string = "Hello World" - build() { - Column() { - Child({ - stateMessage: this.message, - /* ArkTS:ERROR The regular property 'message' cannot be assigned - to the @Link property 'linkMessage'.*/ - linkMessage: this.$message - }) - } - .width('100%') - } -} - -@Component -struct Child { - @State stateMessage: string = "Hello World" - @Link linkMessage: string - build() { - Column() { - Text(this.stateMessage) - .fontSize(50) - .fontWeight(FontWeight.Bold) - } - .width('100%') - } -} -``` diff --git a/zh-cn/application-dev/quick-start/arkts-state-management-overview.md b/zh-cn/application-dev/quick-start/arkts-state-management-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..f9cef2129955f17534cb1efd1be00c17cad7b120 --- /dev/null +++ b/zh-cn/application-dev/quick-start/arkts-state-management-overview.md @@ -0,0 +1,125 @@ +# 状态管理概述 + + +在前文的描述中,我们构建的页面多为静态界面。如果希望构建一个动态的、有交互的界面,就需要引入“状态”的概念。 + + + **图1** 效果图   + +![Video_2023-03-06_152548](figures/Video_2023-03-06_152548.gif) + + +上面的示例中,用户与应用程序的交互触发了文本状态变更,状态变更引起了UI渲染,UI从“Hello World”变更为“Hello ArkUI”。 + + +在声明式UI编程框架中,UI是程序状态的运行结果,用户构建了一个UI模型,其中应用的运行时的状态是参数。当参数改变时,UI作为返回结果,也将进行对应的改变。这些运行时的状态变化所带来的UI的重新渲染,在ArkUI中统称为状态管理机制。 + + +自定义组件拥有变量,变量必须被装饰器装饰才可以成为状态变量,状态变量的改变会引起UI的渲染刷新。如果不使用状态变量,UI只能在初始化时渲染,后续将不会再刷新。 下图展示了State和View(UI)之间的关系。 + + +![zh-cn_image_0000001562352677](figures/zh-cn_image_0000001562352677.png) + + +- View(UI):UI渲染,一般指自定义组件的build方法和\@Builder装饰的方法内的UI描述。 + +- State:状态,一般指的是装饰器装饰的数据。用户通过触发组件的事件方法,改变状态数据。状态数据的改变,引起UI的重新渲染。 + + +## 基本概念 + +- 状态变量:被状态装饰器装饰的变量,改变会引起UI的渲染更新。 + +- 常规变量:没有状态的变量,通常应用于辅助计算。它的改变永远不会引起UI的刷新。 + +- 数据源/同步源:状态变量的原始来源,可以同步给不同的状态数据。通常意义为父组件传给子组件的数据。 + +- 命名参数机制:父组件通过指定参数传递给子组件的状态变量,为父子传递同步参数的主要手段。示例:CompA: ({ aProp: this.aProp })。 + +- 从父组件初始化:父组件传使用命名参数机制,将指定参数传递给子组件。本地初始化的默认值在有父组件传值的情况下,会被覆盖。示例: + + ```ts + @Component + struct MyComponent { + @State count: number = 0; + private increaseBy: number = 1; + + build() { + } + } + + @Component + struct Parent { + build() { + Column() { + // 从父组件初始化,覆盖本地定义的默认值 + MyComponent({ count: 1, increaseBy: 2 }) + } + } + } + ``` + +- 初始化子节点:组件中状态变量可以传递给子组件,初始化子组件对应的状态变量。示例同上。 + +- 本地初始化:变量声明的时候赋值,作为初始化的默认值。示例:\@State count: number = 0。 + + +## 装饰器总览 + +ArkUI提供了多种装饰器,通过使用这些装饰器,状态变量不仅可以观察在组件内的改变,还可以在不同组件层级间传递,比如父子组件、跨组件层级,也可以观察全局范围内的变化。根据状态变量的影响范围,将所有的装饰器可以大致分为: + + +- 管理组件拥有状态的装饰器:组件级别的状态管理,可以观察组件内变化,和不同组件层级的变化,但需要唯一观察同一个组件树上,即同一个页面内。 + +- 管理应用拥有状态的装饰器:应用级别的状态管理,可以观察不同页面,甚至不同UIAbility的状态变化,是应用内全局的状态管理。 + + +从数据的传递形式和同步类型层面看,装饰器也可分为: + + +- 只读的单向传递; + +- 可变更的双向传递。 + + +图示如下,具体装饰器的介绍,可详见[管理组件拥有的状态](arkts-state.md)和[管理应用拥有的状态](arkts-application-state-management-overview.md)。开发者可以灵活地利用这些能力来实现数据和UI的联动。 + + +![zh-cn_image_0000001502704640](figures/zh-cn_image_0000001502704640.png) + + +上图中,Components部分的装饰器为组件级别的状态管理,Application部分为应用的状态管理。开发者可以通过\@StorageLink/\@LocalStorageLink和\@StorageProp/\@LocalStorageProp实现应用和组件状态的双向和单向同步。图中箭头方向为数据同步方向,单箭头为单向同步,双箭头为双向同步。 + + +[管理组件拥有的状态](arkts-state.md),即图中Components级别的状态管理: + + +- \@State:\@State装饰的变量拥有其所属组件的状态,可以作为其子组件单向和双向同步的数据源。当其数值改变时,会引起相关组件的渲染刷新。 + +- \@Prop:\@Prop装饰的变量可以和父组件建立单向同步关系,\@Prop装饰的变量是可变的,但修改不会同步回父组件。 + +- \@Link:\@Link装饰的变量和父组件构建双向同步关系的状态变量,父组件会接受来自\@Link装饰的变量的修改的同步,父组件的更新也会同步给\@Link装饰的变量。 + +- \@Provide/\@Consume:\@Provide/\@Consume装饰的变量用于跨组件层级(多层组件)同步状态变量,可以不需要通过参数命名机制传递,通过alias(别名)或者属性名绑定。 + +- \@Observed:\@Observed装饰class,需要观察多层嵌套场景的class需要被\@Observed装饰。单独使用\@Observed没有任何作用,需要和\@ObjectLink、\@Prop连用。 + +- \@ObjectLink:\@ObjectLink装饰的变量接收\@Observed装饰的class的实例,应用于观察多层嵌套场景,和父组件的数据源构建双向同步。 + + +[管理应用拥有的状态](arkts-application-state-management-overview.md),即图中Application级别的状态管理: + + +- AppStorage是应用程序中的一个特殊的单例LocalStorage对象,是应用级的数据库,和进程绑定,通过[@StorageProp](arkts-appstorage.md#storageprop)和[@StorageLink](arkts-appstorage.md#storagelink)装饰器可以和组件联动。 + +- AppStorage是应用状态的“中枢”,需要和组件(UI)交互的数据存入AppStorage,比如持久化数据PersistentStorage和环境变量Environment。UI再通过AppStorage提供的装饰器或者API接口,访问这些数据; + +- 框架还提供了LocalStorage,AppStorage是LocalStorage特殊的单例。LocalStorage是应用程序声明的应用状态的内存“数据库”,通常用于页面级的状态共享,通过[@LocalStorageProp](arkts-localstorage.md#localstorageprop)和[@LocalStorageLink](arkts-localstorage.md#localstoragelink)装饰器可以和UI联动。 + + +### 其他状态管理功能 + +\@Watch用于监听状态变量的变化。 + + +$$运算符:给内置组件提供TS变量的引用,使得TS变量和内置组件的内部状态保持同步。 diff --git a/zh-cn/application-dev/quick-start/arkts-state-mgmt-application-level.md b/zh-cn/application-dev/quick-start/arkts-state-mgmt-application-level.md deleted file mode 100644 index 820d443c1ebedd22e9ad0617ff5c79906f0b1f23..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/quick-start/arkts-state-mgmt-application-level.md +++ /dev/null @@ -1,269 +0,0 @@ -# 应用级变量的状态管理 - -在前面的章节中,已经讲述了如何管理页面级变量的状态,本章将说明如何管理应用级变量的状态,具体接口说明请参考[应用级变量的状态管理接口](../reference/arkui-ts/ts-state-management.md)。 - -## AppStorage - -[AppStorage](../reference/arkui-ts/ts-state-management.md#appstorage)是应用程序中的单例对象,由UI框架在应用程序启动时创建,在应用程序退出时销毁,为应用程序范围内的可变状态属性提供中央存储。 - -AppStorage包含整个应用程序中需要访问的所有状态属性,只要应用程序保持运行,AppStorage就会保存所有属性及属性值,属性值可以通过唯一的键值进行访问。 - -组件可以通过装饰器将应用程序状态数据与AppStorage进行同步,应用业务逻辑的实现也可以通过接口访问AppStorage。 - -AppStorage的选择状态属性可以与不同的数据源或数据接收器同步,这些数据源和接收器可以是设备上的本地或远程,并具有不同的功能,如数据持久性。这样的数据源和接收器可以独立于UI在业务逻辑中实现。 - -默认情况下,AppStorage中的属性是可变的,AppStorage还可使用不可变(只读)属性。 - -> **说明**:[Worker](../reference/apis/js-apis-worker.md)和主线程只能通过[postMessage](../reference/apis/js-apis-worker.md#postmessage)交互,不能使用AppStorage进行交互。 - -### @StorageLink装饰器 - -组件通过使用@StorageLink(key)装饰的状态变量,与AppStorage建立双向数据绑定,key为AppStorage中的属性键值。当创建包含@StorageLink的状态变量的组件时,该状态变量的值将使用AppStorage中的值进行初始化。在UI组件中对@StorageLink的状态变量所做的更改将同步到AppStorage,并从AppStorage同步到任何其他绑定实例中,如PersistentStorage或其他绑定的UI组件。 - -### @StorageProp装饰器 - -组件通过使用@StorageProp(key)装饰的状态变量,与AppStorage建立单向数据绑定,key标识AppStorage中的属性键值。当创建包含@StorageProp的状态变量的组件时,该状态变量的值将使用AppStorage中的值进行初始化。AppStorage中属性值的更改会导致绑定该状态变量的UI组件进行状态更新。 - -### 示例 - -每次用户单击Count按钮时,this.varA变量值都会增加1,此变量与AppStorage中的varA同步。每次用户单击language按钮时,修改AppStorage中的languageCode,此修改会同步给this.languageCode变量。 - -```ts -// xxx.ets -@Entry -@Component -struct ComponentA { - @StorageLink('varA') varA: number = 2 - @StorageProp('languageCode') languageCode: string = 'en' - private label: string = 'count' - - aboutToAppear() { - this.label = (this.languageCode === 'zh') ? '数量' : 'Count' - } - - build() { - Column() { - Row({ space: 20 }) { - Button(`${this.label}: ${this.varA}`) - .onClick(() => { - AppStorage.Set('varA', AppStorage.Get('varA') + 1) - }) - Button(`language: ${this.languageCode}`) - .onClick(() => { - if (AppStorage.Get('languageCode') === 'zh') { - AppStorage.Set('languageCode', 'en') - } else { - AppStorage.Set('languageCode', 'zh') - } - this.label = (this.languageCode === 'zh') ? '数量' : 'Count' - }) - } - .margin({ top: 50, bottom: 50 }) - - Row() { - Button(`更改@StorageLink修饰的变量:${this.varA}`).height(40).fontSize(14) - .onClick(() => { - this.varA++ - }) - } - }.width('100%') - } -} -``` - -![appstorage](figures/appstorage.gif) - -## LocalStorage - -> **说明:** -> -> 该接口从API version 9开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 - -LocalStorage是应用程序中的存储单元,生命周期跟随其关联的Ability。在Stage模型下,LocalStorage解决AppStorage共享范围过大的问题,提供Ability之间全局数据的隔离。同时,LocalStorage为应用程序范围内的可变状态属性和非可变状态属性提供存储,可变状态属性和非可变状态属性是构建应用程序UI的一部分,如一个Ability的UI。解决App与Ability之间数据互相干扰问题,多实例场景下同一个Ability类的不同Ability实例之间的数据互相干扰问题。在分布式迁移的场景下,Ability是系统调度的最小单元,配合LocalStorage更方便实现组件的数据迁移。 - -应用层:一个应用程序可以创建多个LocalStorage实例,应用程序的每一个Ability对应一个LocalStorage实例。 - -Ability:一个应用程序可以拥有多个Ability,一个Ability中的所有子组件最多可以分配一个LocalStorage实例。并且,Ability中的所有子组件都将继承对此LocalStorage实例存储对象的访问权。 - -一个组件最多可以访问一个LocalStorage实例,一个LocalStorage对象可以分配给多个组件。 - -### @LocalStorageLink装饰器 - -组件通过使用@LocalStorageLink(key)装饰的状态变量,key值为LocalStorage中的属性键值,与LocalStorage建立双向数据绑定。当创建包含@LocalStorageLink的状态变量的组件时,该状态变量的值将会使用LocalStorage中的值进行初始化。如果LocalStorage中未定义初始值,将使用@LocalStorageLink定义的初始值。在UI组件中对@LocalStorageLink的状态变量所做的更改将同步到LocalStorage中,并从LocalStorage同步到Ability下的组件中。 - -### @LocalStorageProp装饰器 - -组件通过使用LocalStorageProp(key)装饰的状态变量,key值为LocalStorage中的属性键值,与LocalStorage建立单向数据绑定。当创建包含@LocalStorageProp的状态变量的组件时,该状态变量的值将使用LocalStorage中的值进行初始化。LocalStorage中的属性值的更改会导致当前Ability下的所有UI组件进行状态更新。 - -> **说明:** 创建LocalStorage实例时如未定义初始值,可以使用组件内@LocalStorageLink和@LocalStorageProp的初始值。如果定义时给定了初始值,那么不会再使用@LocalStorageLink和@LocalStorageProp的初始值。 - -### 示例1(在一个Ability中创建LocalStorage) - -LocalStorage通过loadContent接口加载,接口说明详见[loadContent](../reference/apis/js-apis-window.md#loadcontent9-1)。 - -```ts -import UIAbility from '@ohos.app.ability.UIAbility'; - -export default class EntryAbility extends UIAbility { - storage: LocalStorage - - onCreate() { - this.storage = new LocalStorage() - this.storage.setOrCreate('storageSimpleProp', 121) - console.info('[Demo EntryAbility onCreate]') - } - - onDestroy() { - console.info('[Demo EntryAbility onDestroy]') - } - - onWindowStageCreate(windowStage) { - // storage作为参数传递给loadContent接口 - windowStage.loadContent('pages/Index', this.storage) - } - - onWindowStageDestroy() { - console.info('[Demo] EntryAbility onWindowStageDestroy') - } - - onForeground() { - console.info('[Demo] EntryAbility onForeground') - } - - onBackground() { - console.info('[Demo] EntryAbility onBackground') - } -} -``` - -@Component组件获取数据 - -```ts -// Index.ets -let storage = LocalStorage.GetShared() - -@Entry(storage) -@Component -struct LocalStorageComponent { - @LocalStorageLink('storageSimpleProp') simpleVarName: number = 0 - - build() { - Column() { - Button(`LocalStorageLink: ${this.simpleVarName.toString()}`) - .margin(20) - .onClick(() => { - this.simpleVarName += 1 - }) - Text(JSON.stringify(this.simpleVarName)) - .fontSize(50) - LocalStorageComponentProp() - }.width('100%') - } -} - -@Component -struct LocalStorageComponentProp { - @LocalStorageProp('storageSimpleProp') simpleVarName: number = 0 - - build() { - Column() { - Button(`LocalStorageProp: ${this.simpleVarName.toString()}`) - .margin(20) - .onClick(() => { - this.simpleVarName += 1 - }) - Text(JSON.stringify(this.simpleVarName)) - .fontSize(50) - }.width('100%') - } -} -``` - -![appstorage1](figures/appstorage1.gif) - -### 示例2(在Entry页面定义LocalStorage) - -```ts -// xxx.ets -let storage = new LocalStorage({ "PropA": 47 }) - -@Entry(storage) -@Component -struct ComA { - @LocalStorageLink("PropA") storageLink: number = 1 - - build() { - Column() { - Text(`Parent from LocalStorage ${this.storageLink}`) - .fontSize(18) - .margin(20) - .onClick(() => this.storageLink += 1) - Child() - } - } -} - -@Component -struct Child { - @LocalStorageLink("PropA") storageLink: number = 1 - - build() { - Text(`Child from LocalStorage ${this.storageLink}`) - .fontSize(18) - .margin(20) - .onClick(() => this.storageLink += 1) - } -} -``` - -![appstorage2](figures/appstorage2.gif) - -## PersistentStorage - -[PersistentStorage](../reference/arkui-ts/ts-state-management.md#persistentstorage)提供了一些静态方法用来管理应用持久化数据,可以将特定标记的持久化数据链接到AppStorage中,并由AppStorage接口访问对应持久化数据,或者通过@StorageLink装饰器来访问对应key的变量。 - -> **说明:** -> -> - PersistentStorage的PersistProp接口使用时,需要保证输入对应的key在AppStorage中存在。 -> - PersistentStorage的DeleteProp接口使用时,只能对本次应用启动时已经link过的数据生效。 - -```ts -// xxx.ets -PersistentStorage.PersistProp('highScore', '0') - -@Entry -@Component -struct PersistentComponent { - @StorageLink('highScore') highScore: string = '0' - @State currentScore: number = 0 - - build() { - Column() { - if (this.currentScore === Number(this.highScore)) { - Text(`new highScore : ${this.highScore}`).fontSize(18) - } - Button(`goal!, currentScore : ${this.currentScore}`) - .margin(20) - .onClick(() => { - this.currentScore++ - if (this.currentScore > Number(this.highScore)) { - this.highScore = this.currentScore.toString() - } - }) - }.width('100%') - } -} -``` - -![appstorage3](figures/appstorage3.gif) - -## Environment - -[Environment](../reference/arkui-ts/ts-state-management.md#environment)是框架在应用程序启动时创建的单例对象,它为AppStorage提供了一系列应用程序需要的环境状态数据,这些数据描述了应用程序运行的设备环境,包括系统语言、深浅色模式等等。Environment及其属性是不可变的,所有数据类型均为简单类型。如下示例展示了从Environment获取系统是否开启无障碍屏幕朗读: - -```ts -Environment.EnvProp('accessibilityEnabled', 'default') -var enable = AppStorage.Get('accessibilityEnabled') -``` - -accessibilityEnabled是Environment提供的系统默认变量识别符。首先需要将对应系统属性绑定到AppStorage上,再通过AppStorage中的方法或者装饰器访问对应的系统属性数据。 \ No newline at end of file diff --git a/zh-cn/application-dev/quick-start/arkts-state-mgmt-concepts.md b/zh-cn/application-dev/quick-start/arkts-state-mgmt-concepts.md deleted file mode 100644 index 1e446d1ebd7dc34fbfacf8917bfbfb88cc1384d7..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/quick-start/arkts-state-mgmt-concepts.md +++ /dev/null @@ -1,34 +0,0 @@ -# 基本概念 - -ArkTS提供了多维度的状态管理机制,在ArkUI开发框架中,和UI相关联的数据,不仅可以在组件内使用,还可以在不同组件层级间传递,比如父子组件之间、爷孙组件之间,也可以是应用全局范围内的传递。另外,从数据的传递形式来看,可分为只读的单向传递和可变更的双向传递。开发者可以灵活地利用这些能力来实现数据和UI的联动。 - - -![](figures/CoreSpec_figures_state-mgmt-overview.png) - - -## 页面级变量的状态管理 - -| 装饰器 | 装饰内容 | 说明 | -| ----------- | ------------------------- | ------------------------------------------------------------ | -| @State | 基本数据类型,类,数组 | 修饰的状态数据被修改时会触发组件的build方法进行UI界面更新。 | -| @Prop | 基本数据类型 | 修改后的状态数据用于在父组件和子组件之间建立单向数据依赖关系。修改父组件关联数据时,当前组件会重新渲染。 | -| @Link | 基本数据类型,类,数组 | 父子组件之间的双向数据绑定,父组件的内部状态数据作为数据源,任何一方所做的修改都会反映给另一方。 | -| @Observed | 类 | @Observed应用于类,表示该类中的数据变更被UI页面管理。 | -| @ObjectLink | 被@Observed所装饰类的对象 | @ObjectLink装饰的状态数据被修改时,在父组件或者其他兄弟组件内与它关联的状态数据所在的组件都会重新渲染。 | -| @Provide | 基本数据类型,类,数组 | @Provide作为数据的提供方,可以更新其子孙节点的数据,并触发页面重新渲染。 | -| @Consume | 基本数据类型,类,数组 | @Consume装饰的变量在感知到@Provide装饰的变量更新后,会触发当前自定义组件的重新渲染。 | - -## 应用级变量的状态管理 - -AppStorage是整个应用程序状态的中心“数据库”,UI框架会针对应用程序创建单例AppStorage对象,并提供相应的装饰器和接口供应用程序使用。 - -- @StorageLink:@StorageLink(name)的原理类似于@Consume(name),不同的是,该给定名称的链接对象是从AppStorage中获得的,在UI组件和AppStorage之间建立双向绑定同步数据。 -- @StorageProp:@StorageProp(name)将UI组件数据与AppStorage进行单向同步,AppStorage中值的更改会更新UI组件中的数据,但UI组件无法更改AppStorage中的数据。 -- AppStorage还提供了用于业务逻辑实现的API,用于添加、读取、修改和删除应用程序的状态数据,此API所做的更改会导致修改的状态数据同步到UI组件上进行UI更新。 -- LocalStorage是应用程序中每一个Ability的存储器。 -- @LocalStorageLink:组件通过使用@LocalStorageLink(key)装饰的状态变量,key值为LocalStorage中的属性键值,与LocalStorage建立双向数据绑定。 -- @LocalStorageProp:组件通过使用@LocalStorageProp(key)装饰的状态变量,key值为LocalStorage中的属性键值,与LocalStorage建立单向数据绑定。 -- PersistentStorage提供了一些静态方法用来管理应用持久化数据,可以将特定标记的持久化数据链接到AppStorage中,并由AppStorage接口访问对应持久化数据,或者通过@StorageLink装饰器来访问对应key的变量。 -- Environment是框架在应用程序启动时创建的单例对象,它为AppStorage提供了一系列应用程序需要的环境状态数据,这些数据描述了应用程序运行的设备环境。 - -请参考[状态变量数据类型声明的使用限制](arkts-restrictions-and-extensions.md)了解状态变量使用规范。 diff --git a/zh-cn/application-dev/quick-start/arkts-state-mgmt-page-level.md b/zh-cn/application-dev/quick-start/arkts-state-mgmt-page-level.md deleted file mode 100644 index c8ac889e835c71d0f017286bb8c639e4e5b8c1bb..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/quick-start/arkts-state-mgmt-page-level.md +++ /dev/null @@ -1,525 +0,0 @@ -# 页面级变量的状态管理 - -@State、@Prop、@Link、@Provide、@Consume、@ObjectLink、@Observed和@Watch用于管理页面级变量的状态。 - -请参考[状态变量多种数据类型声明的使用限制](./arkts-restrictions-and-extensions.md)了解@State、@Provide、 @Link和@Consume四种状态变量的约束条件。 - -## @State - -@State装饰的变量是组件内部的状态数据,当这些状态数据被修改时,将会调用所在组件的build方法进行UI刷新。 - -@State状态数据具有以下特征: - -- 支持多种类型数据:支持class、number、boolean、string强类型数据的值类型和引用类型,以及这些强类型构成的数组,即Array<class>、Array<string>、Array<boolean>、Array<number>。不支持object和any。 -- 支持多实例:组件不同实例的内部状态数据独立。 -- 内部私有:标记为@State的属性是私有变量,只能在组件内访问。 -- 需要本地初始化:必须为所有@State变量分配初始值,变量未初始化可能导致未定义的框架异常行为。 -- 创建自定义组件时支持通过状态变量名设置初始值:在创建组件实例时,可以通过变量名显式指定@State状态变量的初始值。 - -**示例:** - -在下面的示例中: - -- 用户定义的组件MyComponent定义了@State状态变量count和title。如果count或title的值发生变化,则执行MyComponent的build方法来重新渲染组件; - -- EntryComponent中有多个MyComponent组件实例,第一个MyComponent内部状态的更改不会影响第二个MyComponent; - -- 创建MyComponent实例时通过变量名给组件内的变量进行初始化,如: - - ```ts - MyComponent({ title: { value: 'Hello World 2' }, count: 7 }) - ``` - -```ts -// xxx.ets -class Model { - value: string - - constructor(value: string) { - this.value = value - } -} - -@Entry -@Component -struct EntryComponent { - build() { - Column() { - MyComponent({ count: 1, increaseBy: 2 }) // 第1个MyComponent实例 - MyComponent({ title: { value: 'Hello World 2' }, count: 7 }) // 第2个MyComponent实例 - } - } -} - -@Component -struct MyComponent { - @State title: Model = { value: 'Hello World' } - @State count: number = 0 - private toggle: string = 'Hello World' - private increaseBy: number = 1 - - build() { - Column() { - Text(`${this.title.value}`).fontSize(30) - Button('Click to change title') - .margin(20) - .onClick(() => { - // 修改内部状态变量title - this.title.value = (this.toggle == this.title.value) ? 'Hello World' : 'Hello ArkUI' - }) - - Button(`Click to increase count=${this.count}`) - .margin(20) - .onClick(() => { - // 修改内部状态变量count - this.count += this.increaseBy - }) - } - } -} -``` - - -## @Prop - -@Prop与@State有相同的语义,但初始化方式不同。@Prop装饰的变量必须使用其父组件提供的@State变量进行初始化,允许组件内部修改@Prop变量,但变量的更改不会通知给父组件,父组件变量的更改会同步到@prop装饰的变量,即@Prop属于单向数据绑定。 - -@Prop状态数据具有以下特征: - -- 支持简单类型:仅支持number、string、boolean等简单数据类型; -- 私有:仅支持组件内访问; -- 支持多个实例:一个组件中可以定义多个标有@Prop的属性; -- 创建自定义组件时将值传递给@Prop变量进行初始化:在创建组件的新实例时,必须初始化所有@Prop变量,不支持在组件内部进行初始化。 - -> **说明:** -> -> @Prop修饰的变量不能在组件内部进行初始化。 - -**示例:** - -在下面的示例中,当按“+1”或“-1”按钮时,父组件状态发生变化,重新执行build方法,此时将创建一个新的CountDownComponent组件实例。父组件的countDownStartValue状态变量被用于初始化子组件的@Prop变量,当按下子组件的“count - costOfOneAttempt”按钮时,其@Prop变量count将被更改,CountDownComponent重新渲染,但是count值的更改不会影响父组件的countDownStartValue值。 - -```ts -// xxx.ets -@Entry -@Component -struct ParentComponent { - @State countDownStartValue: number = 10 // 初始化countDownStartValue - - build() { - Column() { - Text(`Grant ${this.countDownStartValue} nuggets to play.`).fontSize(18) - Button('+1 - Nuggets in New Game') - .margin(15) - .onClick(() => { - this.countDownStartValue += 1 - }) - - Button('-1 - Nuggets in New Game') - .margin(15) - .onClick(() => { - this.countDownStartValue -= 1 - }) - // 创建子组件时,必须在构造函数参数中提供其@Prop变量count的初始值,同时初始化常规变量costOfOneAttempt(非Prop变量) - CountDownComponent({ count: this.countDownStartValue, costOfOneAttempt: 2 }) - } - } -} - -@Component -struct CountDownComponent { - @Prop count: number - private costOfOneAttempt: number - - build() { - Column() { - if (this.count > 0) { - Text(`You have ${this.count} Nuggets left`).fontSize(18) - } else { - Text('Game over!').fontSize(18) - } - - Button('count - costOfOneAttempt') - .margin(15) - .onClick(() => { - this.count -= this.costOfOneAttempt - }) - } - } -} -``` - - -## @Link - -@Link装饰的变量可以和父组件的@State变量建立双向数据绑定: - -- 支持多种类型:@Link支持的数据类型与@State相同,即class、number、string、boolean或这些类型的数组; -- 私有:仅支持组件内访问; -- 单个数据源:父组件中用于初始化子组件@Link变量的必须是父组件定义的状态变量; -- 双向通信:子组件对@Link变量的更改将同步修改父组件中的@State变量; -- 创建自定义组件时需要将变量的引用传递给@Link变量,在创建组件的新实例时,必须使用命名参数初始化所有@Link变量。@Link变量可以使用@State变量或@Link变量的引用进行初始化,@State变量可以通过`'$'`操作符创建引用。 - -> **说明:** -> -> @Link修饰的变量不能在组件内部进行初始化。 - -**简单类型示例:** - -@Link语义是从`'$'`操作符引出,即`$isPlaying`是`this.isPlaying`内部状态的双向数据绑定。当单击子组件PlayButton中的按钮时,@Link变量更改,PlayButton与父组件中的Text和Button将同时进行刷新,同样地,当点击父组件中的Button修改`this.isPlaying`时,子组件PlayButton与父组件中的Text和Button也将同时刷新。 - -```ts -// xxx.ets -@Entry -@Component -struct Player { - @State isPlaying: boolean = false - - build() { - Column() { - PlayButton({ buttonPlaying: $isPlaying }) - Text(`Player is ${this.isPlaying ? '' : 'not'} playing`).fontSize(18) - Button('Parent:' + this.isPlaying) - .margin(15) - .onClick(() => { - this.isPlaying = !this.isPlaying - }) - } - } -} - -@Component -struct PlayButton { - @Link buttonPlaying: boolean - - build() { - Column() { - Button(this.buttonPlaying ? 'pause' : 'play') - .margin(20) - .onClick(() => { - this.buttonPlaying = !this.buttonPlaying - }) - } - } -} -``` - -**复杂类型示例:** - -```ts -// xxx.ets -@Entry -@Component -struct Parent { - @State arr: number[] = [1, 2, 3] - - build() { - Column() { - Child({ items: $arr }) - Button('Parent Button: splice') - .margin(10) - .onClick(() => { - this.arr.splice(0, 1, 60) - }) - ForEach(this.arr, item => { - Text(item.toString()).fontSize(18).margin(10) - }, item => item.toString()) - } - } -} - - -@Component -struct Child { - @Link items: number[] - - build() { - Column() { - Button('Child Button1: push') - .margin(15) - .onClick(() => { - this.items.push(100) - }) - Button('Child Button2: replace whole item') - .margin(15) - .onClick(() => { - this.items = [100, 200, 300] - }) - } - } -} -``` - -**@Link、@State和@Prop结合使用示例:** - -下面示例中,ParentView包含ChildA和ChildB两个子组件,ParentView的状态变量counter分别用于初始化ChildA的@Prop变量和ChildB的@Link变量。 - -- ChildB使用@Link建立双向数据绑定,当ChildB修改counterRef状态变量值时,该更改将同步到ParentView和ChildA共享; -- ChildA使用@Prop建立从ParentView到自身的单向数据绑定,当ChildA修改counterVal状态变量值时,ChildA将重新渲染,但该更改不会传达给ParentView和ChildB。 - -```ts -// xxx.ets -@Entry -@Component -struct ParentView { - @State counter: number = 0 - - build() { - Column() { - ChildA({ counterVal: this.counter }) - ChildB({ counterRef: $counter }) - } - } -} - -@Component -struct ChildA { - @Prop counterVal: number - - build() { - Button(`ChildA: (${this.counterVal}) + 1`) - .margin(15) - .onClick(() => { - this.counterVal += 1 - }) - } -} - -@Component -struct ChildB { - @Link counterRef: number - - build() { - Button(`ChildB: (${this.counterRef}) + 1`) - .margin(15) - .onClick(() => { - this.counterRef += 1 - }) - } -} -``` - -## @Observed和ObjectLink数据管理 - -当开发者需要在子组件中针对父组件的一个变量(parent_a)设置双向同步时,开发者可以在父组件中使用@State装饰变量(parent_a),并在子组件中使用@Link装饰对应的变量(child_a)。这样不仅可以实现父组件与单个子组件之间的数据同步,也可以实现父组件与多个子组件之间的数据同步。如下图所示,可以看到,父子组件针对ClassA类型的变量设置了双向同步,那么当子组件1中变量对应的属性c的值变化时,会通知父组件同步变化,而当父组件中属性c的值变化时,会通知所有子组件同步变化。 - -![zh-cn_image_0000001251090821](figures/zh-cn_image_0000001251090821.png) - -然而,上述例子是针对某个数据对象进行的整体同步,而当开发者只想针对父组件中某个数据对象的部分信息进行同步时,使用@Link就不能满足要求。如果这些部分信息是一个类对象,就可以使用@ObjectLink配合@Observed来实现,如下图所示。 - -![zh-cn_image_0000001206450834](figures/zh-cn_image_0000001206450834.png) - -### 设置要求 - -- @Observed用于类,@ObjectLink用于变量。 - -- @ObjectLink装饰的变量类型必须为类(class type)。 - - 类要被@Observed装饰器所装饰。 - - 不支持简单类型参数,可以使用@Prop进行单向同步。 - -- @ObjectLink装饰的变量是不可变的。 - - 属性的改动是被允许的,当改动发生时,如果同一个对象被多个@ObjectLink变量所引用,那么所有拥有这些变量的自定义组件都会被通知进行重新渲染。 - -- @ObjectLink装饰的变量不可设置默认值。 - - 必须让父组件中有一个由@State、@Link、@StorageLink、@Provide或@Consume装饰的变量所参与的TS表达式进行初始化。 - -- @ObjectLink装饰的变量是私有变量,只能在组件内访问。 - - -### 示例 - -```ts -// xxx.ets -// 父组件ViewB中的类对象ClassA与子组件ViewA保持数据同步时,可以使用@ObjectLink和@Observed,绑定该数据对象的父组件和其他子组件同步更新 -var nextID: number = 0 - -@Observed -class ClassA { - public name: string - public c: number - public id: number - - constructor(c: number, name: string = 'OK') { - this.name = name - this.c = c - this.id = nextID++ - } -} - -@Component -struct ViewA { - label: string = 'ViewA1' - @ObjectLink a: ClassA - - build() { - Row() { - Button(`ViewA [${this.label}] this.a.c= ${this.a.c} +1`) - .onClick(() => { - this.a.c += 1 - }) - }.margin({ top: 10 }) - } -} - -@Entry -@Component -struct ViewB { - @State arrA: ClassA[] = [new ClassA(0), new ClassA(0)] - - build() { - Column() { - ForEach(this.arrA, (item) => { - ViewA({ label: `#${item.id}`, a: item }) - }, (item) => item.id.toString()) - ViewA({ label: `this.arrA[first]`, a: this.arrA[0] }) - ViewA({ label: `this.arrA[last]`, a: this.arrA[this.arrA.length - 1] }) - - Button(`ViewB: reset array`) - .margin({ top: 10 }) - .onClick(() => { - this.arrA = [new ClassA(0), new ClassA(0)] - }) - Button(`ViewB: push`) - .margin({ top: 10 }) - .onClick(() => { - this.arrA.push(new ClassA(0)) - }) - Button(`ViewB: shift`) - .margin({ top: 10 }) - .onClick(() => { - this.arrA.shift() - }) - }.width('100%') - } -} -``` - - -## @Provide和@Consume - -@Provide作为数据的提供方,可以更新其子孙节点的数据,并触发页面渲染。@Consume在感知到@Provide数据的更新后,会触发当前自定义组件的重新渲染。 - -> **说明:** -> -> 使用@Provide和@Consume时应避免循环引用导致死循环。 - -### @Provide - -| 名称 | 说明 | -| -------------- | ------------------------------------------------------------ | -| 装饰器参数 | 是一个string类型的常量,用于给装饰的变量起别名。如果规定别名,则提供对应别名的数据更新。如果没有,则使用变量名作为别名。推荐使用@Provide('alias')这种形式。 | -| 同步机制 | @Provide的变量类似@State,可以修改对应变量进行页面重新渲染。也可以修改@Consume装饰的变量,反向修改@State变量。 | -| 初始值 | 必须设置初始值。 | -| 页面重渲染场景 | 触发页面渲染的修改:
- 基础类型(boolean,string,number)变量的改变;
- @Observed class类型变量及其属性的修改;
- 添加,删除,更新数组中的元素。 | - -### @Consume - -| 类型 | 说明 | -| ------ | ---------------- | -| 初始值 | 不可设置默认初始值。 | - -### 示例 - -```ts -// xxx.ets -@Entry -@Component -struct CompA { - @Provide("reviewVote") reviewVotes: number = 0; - - build() { - Column() { - CompB() - Button(`CompA: ${this.reviewVotes}`) - .margin(10) - .onClick(() => { - this.reviewVotes += 1; - }) - } - } -} - -@Component -struct CompB { - build() { - Column() { - CompC() - } - } -} - -@Component -struct CompC { - @Consume("reviewVote") reviewVotes: number - - build() { - Column() { - Button(`CompC: ${this.reviewVotes}`) - .margin(10) - .onClick(() => { - this.reviewVotes += 1 - }) - }.width('100%') - } -} -``` - -## @Watch - -@Watch用于监听状态变量的变化,语法结构为: - -```ts -@State @Watch("onChanged") count : number = 0 -``` - -如上所示,给状态变量增加一个@Watch装饰器,通过@Watch注册一个回调方法onChanged, 当状态变量count被改变时, 触发onChanged回调。 - -装饰器@State、@Prop、@Link、@ObjectLink、@Provide、@Consume、@StorageProp以及@StorageLink所装饰的变量均可以通过@Watch监听其变化。 - - -> **说明:** -> -> 深层次数据修改不会触发@Watch回调,例如无法监听数组中对象值的改变。 - -```ts -// xxx.ets -@Entry -@Component -struct CompA { - @State @Watch('onBasketUpdated') shopBasket: Array = [7, 12, 47, 3] - @State totalPurchase: number = 0 - @State addPurchase: number = 0 - - aboutToAppear() { - this.updateTotal() - } - - updateTotal(): void { - let sum = 0; - this.shopBasket.forEach((i) => { - sum += i - }) - // 计算新的购物篮总价值,如果超过100,则适用折扣 - this.totalPurchase = (sum < 100) ? sum : 0.9 * sum - return this.totalPurchase - } - - // shopBasket更改时触发该方法 - onBasketUpdated(propName: string): void { - this.updateTotal() - } - - build() { - Column() { - Button('add to basket ' + this.addPurchase) - .margin(15) - .onClick(() => { - this.addPurchase = Math.round(100 * Math.random()) - this.shopBasket.push(this.addPurchase) - }) - Text(`${this.totalPurchase}`) - .fontSize(30) - } - } -} -``` \ No newline at end of file diff --git a/zh-cn/application-dev/quick-start/arkts-state.md b/zh-cn/application-dev/quick-start/arkts-state.md new file mode 100644 index 0000000000000000000000000000000000000000..50cc33b3bf26e654dbb3db5ef408533e8a85fc8d --- /dev/null +++ b/zh-cn/application-dev/quick-start/arkts-state.md @@ -0,0 +1,261 @@ +# \@State:组件内状态 + + +\@State装饰的变量,或称为状态变量,一旦变量拥有了状态属性,就和自定义组件的渲染绑定起来。当状态改变时,UI会发生对应的渲染改变。 + + +在状态变量相关装饰器中,\@State是最基础的,使变量拥有状态属性的装饰器,它也是大部分状态变量的数据源。 + + +> **说明:** +> +> 从API version 9开始,该装饰器支持在ArkTS卡片中使用。 + + +## 概述 + +\@State装饰的变量,与声明式范式中的其他被装饰变量一样,是私有的,只能从组件内部访问,在声明时必须指定其类型和本地初始化。初始化也可选择使用命名参数机制从父组件完成初始化。 + +\@State装饰的变量拥有以下特点: + +- \@State装饰的变量与子组件中的\@Prop、\@Link或\@ObjectLink装饰变量之间建立单向或双向数据同步。 + +- \@State装饰的变量生命周期与其所属自定义组件的生命周期相同。 + + +## 装饰器使用规则说明 + +| \@State变量装饰器 | 说明 | +| ------------ | ---------------------------------------- | +| 装饰器参数 | 无 | +| 同步类型 | 不与父组件中任何类型的变量同步。 | +| 允许装饰的变量类型 | Object、class、string、number、boolean、enum类型,以及这些类型的数组。嵌套类型的场景请参考[观察变化](#观察变化)。
类型必须被指定。
不支持any,不支持简单类型和复杂类型的联合类型,不允许使用undefined和null。
**说明:**
建议不要装饰Date类型,应用可能会产生异常行为。
不支持Length、ResourceStr、ResourceColor类型,Length、ResourceStr、ResourceColor为简单类型和复杂类型的联合类型。 | +| 被装饰变量的初始值 | 必须指定。 | + + +## 变量的传递/访问规则说明 + +| 传递/访问 | 说明 | +| --------- | ---------------------------------------- | +| 从父组件初始化 | 可选,从父组件初始化或者本地初始化。
支持父组件中常规变量、\@State、\@Link、\@Prop、\@Provide、\@Consume、\@ObjectLink、\@StorageLink、\@StorageProp、\@LocalStorageLink和\@LocalStorageProp装饰的变量,初始化子组件的\@State。 | +| 用于初始化子组件 | \@State装饰的变量支持初始化子组件的常规变量、\@State、\@Link、\@Prop、\@Provide。 | +| 是否支持组件外访问 | 不支持,只能在组件内访问。 | + + **图1** 初始化规则图示   + +![zh-cn_image_0000001502091796](figures/zh-cn_image_0000001502091796.png) + + +## 观察变化和行为表现 + +并不是状态变量的所有更改都会引起UI的刷新,只有可以被框架观察到的修改才会引起UI刷新。该小节去介绍什么样的修改才能被观察到,以及观察到变化后,框架的是怎么引起UI刷新的,即框架的行为表现是什么。 + + +### 观察变化 + +- 当装饰的数据类型为boolean、string、number类型时,可以观察到数值的变化。 + + ```ts + // for simple type + @State count: number = 0; + // value changing can be observed + this.count = 1; + ``` + +- 当装饰的数据类型为class或者Object时,可以观察到自身的赋值的变化,和其属性赋值的变化,即Object.keys(observedObject)返回的所有属性。例子如下。 + 声明ClassA和Model类。 + + ```ts + class ClassA { + public value: string; + + constructor(value: string) { + this.value = value; + } + } + + class Model { + public value: string; + public name: ClassA; + constructor(value: string, a: ClassA) { + this.value = value; + this.name = a; + } + } + ``` + + \@State装饰的类型是Model + + ```ts + // class类型 + @State title: Model = new Model('Hello', new ClassA('World')); + ``` + + 对\@State装饰变量的赋值。 + + ```ts + // class类型赋值 + this.title = new Model('Hi', new ClassA('ArkUI')); + ``` + + 对\@State装饰变量的属性赋值。 + + ```ts + // class属性的赋值 + this.title.value = 'Hi' + ``` + + 嵌套属性的赋值观察不到。 + + ```ts + // 嵌套的属性赋值观察不到 + this.title.name.value = 'ArkUI' + ``` +- 当装饰的对象是array时,可以观察到数组本身的赋值和添加、删除、更新数组的变化。例子如下。 + 声明ClassA和Model类。 + + ```ts + class Model { + public value: number; + constructor(value: number) { + this.value = value; + } + } + ``` + + \@State装饰的对象为Model类型数组时。 + + ```ts + @State title: Model[] = [new Model(11), new Model(1)] + ``` + + 数组自身的赋值可以观察到。 + + ```ts + this.title = [new Model(2)] + ``` + + 数组项的赋值可以观察到。 + + ```ts + this.title[0] = new Model(2) + ``` + + 删除数组项可以观察到。 + + ```ts + this.title.pop() + ``` + + 新增数组项可以观察到。 + + ```ts + this.title.push(new Model(12)) + ``` + + +### 框架行为 + +- 当状态变量被改变时,查询依赖该状态变量的组件; + +- 执行依赖该状态变量的组件的更新方法,组件更新渲染; + +- 和该状态变量不相关的组件或者UI描述不会发生重新渲染,从而实现页面渲染的按需更新。 + + +## 使用场景 + + +### 装饰简单类型的变量 + +以下示例为\@State装饰的简单类型,count被\@State装饰成为状态变量,count的改变引起Button组件的刷新: + +- 当状态变量count改变时,查询到只有Buttont组件关联了它; + +- 执行Button组件的更新方法,实现按需刷新。 + + +```ts +@Entry +@Component +struct MyComponent { + @State count: number = 0; + + build() { + Button(`click times: ${this.count}`) + .onClick(() => { + this.count += 1; + }) + } +} +``` + + +### 装饰class对象类型的变量 + +- 自定义组件MyComponent定义了被\@State装饰的状态变量count和title,其中title的类型为自定义类Model。如果count或title的值发生变化,则查询MyComponent中使用该状态变量的UI组件,并进行重新渲染。 + +- EntryComponent中有多个MyComponent组件实例,第一个MyComponent内部状态的更改不会影响第二个MyComponent。 + + + +```ts +class Model { + public value: string; + + constructor(value: string) { + this.value = value; + } +} + +@Entry +@Component +struct EntryComponent { + build() { + Column() { + // 此处指定的参数都将在初始渲染时覆盖本地定义的默认值,并不是所有的参数都需要从父组件初始化 + MyComponent({ count: 1, increaseBy: 2 }) + MyComponent({ title: new Model('Hello, World 2'), count: 7 }) + } + } +} + +@Component +struct MyComponent { + @State title: Model = new Model('Hello World'); + @State count: number = 0; + private increaseBy: number = 1; + + build() { + Column() { + Text(`${this.title.value}`) + Button(`Click to change title`).onClick(() => { + // @State变量的更新将触发上面的Text组件内容更新 + this.title.value = this.title.value === 'Hello ArkUI' ? 'Hello World' : 'HelloArkUI'; + }) + + Button(`Click to increase count=${this.count}`).onClick(() => { + // @State变量的更新将触发上面的Text组件内容更新 + this.count += this.increaseBy; + }) + } + } +} +``` + + +从该示例中,我们可以了解到\@State变量首次渲染的初始化流程: + + +1. 使用默认的本地初始化: + + ```ts + @State title: Model = new Model('Hello World'); + @State count: number = 0; + ``` + +2. 对于\@State来说,命名参数机制传递的值并不是必选的,如果没有命名参数传值,则使用本地初始化的默认值: + + ```ts + MyComponent({ count: 1, increaseBy: 2 }) + ``` diff --git a/zh-cn/application-dev/quick-start/arkts-statestyles.md b/zh-cn/application-dev/quick-start/arkts-statestyles.md new file mode 100644 index 0000000000000000000000000000000000000000..171d0e0ad3445ed5d8ea4c3c0f65e0a6c8b8f5e6 --- /dev/null +++ b/zh-cn/application-dev/quick-start/arkts-statestyles.md @@ -0,0 +1,128 @@ +# stateStyles:多态样式 + + +\@Styles和\@Extend仅仅应用于静态页面的样式复用,stateStyles可以依据组件的内部状态的不同,快速设置不同样式。这就是我们本章要介绍的内容stateStyles(又称为:多态样式)。 + + +## 概述 + +stateStyles是属性方法,可以根据UI内部状态来设置样式,类似于css伪类,但语法不同。ArkUI提供以下四种状态: + +- focused:获焦态。 + +- normal:正常态。 + +- pressed:按压态。 + +- disabled:不可用态。 + + +## 使用场景 + + +### 基础场景 + +下面的示例展示了stateStyles最基本的使用场景。Button处于第一个组件,默认获焦,生效focused指定的粉色样式。按压时显示为pressed态指定的黑色。如果在Button前再放一个组件,使其不处于获焦态,就会生效normal态的黄色。 + + +```ts +@Entry +@Component +struct StateStylesSample { + build() { + Column() { + Button('Click me') + .stateStyles({ + focused: { + .backgroundColor(Color.Pink) + }, + pressed: { + .backgroundColor(Color.Black) + }, + normal: { + .backgroundColor(Color.Yellow) + } + }) + }.margin('30%') + } +} +``` + + + **图1** 获焦态和按压态   + +![Video_2023-03-17_120758](figures/Video_2023-03-17_120758.gif) + + +### \@Styles和stateStyles联合使用 + +以下示例通过\@Styles指定stateStyles的不同状态。 + + + +```ts +@Entry +@Component +struct MyComponent { + @Styles normalStyle() { + .backgroundColor(Color.Gray) + } + + @Styles pressedStyle() { + .backgroundColor(Color.Red) + } + + build() { + Column() { + Text('Text1') + .fontSize(50) + .fontColor(Color.White) + .stateStyles({ + normal: this.normalStyle, + pressed: this.pressedStyle, + }) + } + } +} +``` + + **图2** 正常态和按压态   + +![Video_2023-03-17_144824](figures/Video_2023-03-17_144824.gif) + + +### 在stateStyles里使用常规变量和状态变量 + +stateStyles可以通过this绑定组件内的常规变量和状态变量。 + + +```ts +@Entry +@Component +struct CompWithInlineStateStyles { + @State focusedColor: Color = Color.Red; + normalColor: Color = Color.Green + + build() { + Button('clickMe').height(100).width(100) + .stateStyles({ + normal: { + .backgroundColor(this.normalColor) + }, + focused: { + .backgroundColor(this.focusedColor) + } + }) + .onClick(() => { + this.focusedColor = Color.Pink + }) + .margin('30%') + } +} +``` + +Button默认获焦显示红色,点击事件触发后,获焦态变为粉色。 + + **图3** 点击改变获焦态样式   + +![Video_2023-03-17_144605](figures/Video_2023-03-17_144605.gif) diff --git a/zh-cn/application-dev/quick-start/arkts-style.md b/zh-cn/application-dev/quick-start/arkts-style.md new file mode 100644 index 0000000000000000000000000000000000000000..04a862b4a6c13dd6386738971e8630b883707e2b --- /dev/null +++ b/zh-cn/application-dev/quick-start/arkts-style.md @@ -0,0 +1,104 @@ +# \@Styles:定义组件重用样式 + + +如果每个组件的样式都需要单独设置,在开发过程中会出现大量代码在进行重复样式设置,虽然可以复制粘贴,但为了代码简洁性和后续方便维护,我们推出了可以提炼公共样式进行复用的装饰器\@Styles。 + + +\@Styles装饰器可以将多条样式设置提炼成一个方法,直接在组件声明的位置调用。通过\@Styles装饰器可以快速定义并复用自定义样式。用于快速定义并复用自定义样式。 + + +> **说明:** +> +> 从API version 9开始,该装饰器支持在ArkTS卡片中使用。 + + +## 装饰器使用说明 + +- 当前\@Styles仅支持[通用属性](../reference/arkui-ts/ts-universal-attributes-size.md)和[通用事件](../reference/arkui-ts/ts-universal-events-click.md)。 + +- \@Styles方法不支持参数,反例如下。 + + ```ts + // 反例: @Styles不支持参数 + @Styles function globalFancy (value: number) { + .width(value) + } + ``` + +- \@Styles可以定义在组件内或全局,在全局定义时需在方法名前面添加function关键字,组件内定义时则不需要添加function关键字。 + + ```ts + // 全局 + @Styles function functionName() { ... } + + // 在组件内 + @Component + struct FancyUse { + @Styles fancy() { + .height(100) + } + } + ``` + +- 定义在组件内的\@Styles可以通过this访问组件的常量和状态变量,并可以在\@Styles里通过事件来改变状态变量的值,示例如下: + + ```ts + @Component + struct FancyUse { + @State heightVlaue: number = 100 + @Styles fancy() { + .height(this.heightVlaue) + .backgroundColor(Color.Yellow) + .onClick(() => { + this.heightVlaue = 200 + }) + } + } + ``` + +- 组件内\@Styles的优先级高于全局\@Styles。 + 框架优先找当前组件内的\@Styles,如果找不到,则会全局查找。 + + +## 使用场景 + +以下示例中演示了组件内\@Styles和全局\@Styles的用法。 + + + +```ts +// 定义在全局的@Styles封装的样式 +@Styles function globalFancy () { + .width(150) + .height(100) + .backgroundColor(Color.Pink) +} + +@Entry +@Component +struct FancyUse { + @State heightVlaue: number = 100 + // 定义在组件内的@Styles封装的样式 + @Styles fancy() { + .width(200) + .height(this.heightVlaue) + .backgroundColor(Color.Yellow) + .onClick(() => { + this.heightVlaue = 200 + }) + } + + build() { + Column({ space: 10 }) { + // 使用全局的@Styles封装的样式 + Text('FancyA') + .globalFancy () + .fontSize(30) + // 使用全局的@Styles封装的样式 + Text('FancyB') + .fancy() + .fontSize(30) + } + } +} +``` diff --git a/zh-cn/application-dev/quick-start/arkts-two-way-sync.md b/zh-cn/application-dev/quick-start/arkts-two-way-sync.md new file mode 100644 index 0000000000000000000000000000000000000000..c48a7a148efe5169278de9224faa8da0f84926df --- /dev/null +++ b/zh-cn/application-dev/quick-start/arkts-two-way-sync.md @@ -0,0 +1,47 @@ +# $语法:内置组件双向同步 + + +$$运算符为系统内置组件提供TS变量的引用,使得TS变量和系统内置组件的内部状态保持同步。 + + +内部状态具体指什么取决于组件。例如,[bindPopup](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md)属性方法的show参数。 + + +## 使用规则 + +- 当前$$支持基础类型变量,以及\@State、\@Link和\@Prop装饰的变量。 + +- 当前$$仅支持[bindPopup](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md)属性方法的show参数,[Radio](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-radio.md)组件的checked属性,[Refresh](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/arkui-ts/ts-container-refresh.md)组件的refreshing参数。 + +- $$绑定的变量变化时,会触发UI的同步刷新。 + + +## 使用示例 + +以[bindPopup](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-popup.md)属性方法的show参数为例: + + +```ts +// xxx.ets +@Entry +@Component +struct bindPopupPage { + @State customPopup: boolean = false; + + build() { + Column() { + Button('Popup') + .margin(20) + .onClick(() => { + this.customPopup = !this.customPopup + }) + .bindPopup($$this.customPopup, { + message: 'showPopup' + }) + } + } +} +``` + + +![popup](figures/popup.gif) diff --git a/zh-cn/application-dev/quick-start/arkts-watch.md b/zh-cn/application-dev/quick-start/arkts-watch.md new file mode 100644 index 0000000000000000000000000000000000000000..b1dbbfb0e395c8e7e628783635cb899e0468992a --- /dev/null +++ b/zh-cn/application-dev/quick-start/arkts-watch.md @@ -0,0 +1,175 @@ +# \@Watch:状态变量更改通知 + + +\@Watch应用于对状态变量的监听。如果开发者需要关注某个状态变量的值是否改变,可以使用\@Watch为状态变量设置回调函数。 + + +> **说明:** +> +> 从API version 9开始,该装饰器支持在ArkTS卡片中使用。 + + +## 概述 + +\@Watch用于监听状态变量的变化,当状态变量变化时,\@Watch的回调方法将被调用。\@Watch在ArkUI框架内部判断数值有无更新使用的是严格相等(===),遵循严格相等规范。当在严格相等为false的情况下,就会触发\@Watch的回调。 + + +## 装饰器说明 + +| \@Watch补充变量装饰器 | 说明 | +| -------------- | ---------------------------------------- | +| 装饰器参数 | 必填。常量字符串,字符串需要有引号。是(string) => void自定义成员函数的方法的引用。 | +| 可装饰的自定义组件变量 | 可监听所有装饰器装饰的状态变量。不允许监听常规变量。 | +| 装饰器的顺序 | 建议\@State、\@Prop、\@Link等装饰器在\@Watch装饰器之前。 | + + +## 语法说明 + +| 类型 | 说明 | +| ---------------------------------------- | ---------------------------------------- | +| (changedPropertyName? : string) => void | 该函数是自定义组件的成员函数,changedPropertyName是被watch的属性名。
在多个状态变量绑定同一个\@Watch的回调方法的时候,可以通过changedPropertyName进行不同的逻辑处理
将属性名作为字符串输入参数,不返回任何内容。 | + + +## 观察变化和行为表现 + +1. 当观察到状态变量的变化(包括双向绑定的AppStorage和LocalStorage中对应的key发生的变化)的时候,对应的\@Watch的回调方法将被触发; + +2. \@Watch方法在自定义组件的属性变更之后同步执行; + +3. 如果在\@Watch的方法里改变了其他的状态变量,也会引起的状态变更和\@Watch的执行; + +4. 在第一次初始化的时候,\@Watch装饰的方法不会被调用,即认为初始化不是状态变量的改变。只有在后续状态改变时,才会调用\@Watch回调方法。 + + +## 限制条件 + +- 建议开发者避免无限循环。循环可能是因为在\@Watch的回调方法里直接或者间接地修改了同一个状态变量引起的。为了避免循环的产生,建议不要在\@Watch的回调方法里修改当前装饰的状态变量; + +- 开发者应关注性能,属性值更新函数会延迟组件的重新渲染(具体请见上面的行为表现),因此,回调函数应仅执行快速运算; + +- 不建议在\@Watch函数中调用async await,因为\@Watch设计的用途是为了快速的计算,异步行为可能会导致重新渲染速度的性能问题。 + + +## 使用场景 + + +### \@Watch与\@Link组合使用 + +以下示例说明了如何在子组件中观察\@Link变量。 + + +```ts +class PurchaseItem { + static NextId: number = 0; + public id: number; + public price: number; + + constructor(price: number) { + this.id = PurchaseItem.NextId++; + this.price = price; + } +} + +@Component +struct BasketViewer { + @Link @Watch('onBasketUpdated') shopBasket: PurchaseItem[]; + @State totalPurchase: number = 0; + + updateTotal(): number { + let total = this.shopBasket.reduce((sum, i) => sum + i.price, 0); + // 超过100欧元可享受折扣 + if (total >= 100) { + total = 0.9 * total; + } + return total; + } + // @Watch 回调 + onBasketUpdated(propName: string): void { + this.totalPurchase = this.updateTotal(); + } + + build() { + Column() { + ForEach(this.shopBasket, + (item) => { + Text(`Price: ${item.price.toFixed(2)} €`) + }, + item => item.id.toString() + ) + Text(`Total: ${this.totalPurchase.toFixed(2)} €`) + } + } +} + +@Entry +@Component +struct BasketModifier { + @State shopBasket: PurchaseItem[] = []; + + build() { + Column() { + Button('Add to basket') + .onClick(() => { + this.shopBasket.push(new PurchaseItem(Math.round(100 * Math.random()))) + }) + BasketViewer({ shopBasket: $shopBasket }) + } + } +} +``` + +处理步骤如下: + +1. BasketModifier组件的Button.onClick向BasketModifier shopBasket中添加条目; + +2. \@Link装饰的BasketViewer shopBasket值发生变化; + +3. 状态管理框架调用\@Watch函数BasketViewer onBasketUpdated 更新BaketViewer TotalPurchase的值; + +4. \@Link shopBasket的改变,新增了数组项,ForEach组件会执行item Builder,渲染构建新的Item项;\@State totalPurchase改变,对应的Text组件也重新渲染;重新渲染是异步发生的。 + + +### \@Watch和自定义组件更新 + +以下示例展示组件更新和\@Watch的处理步骤。count在两个组件中均由\@State装饰。 + + +```ts +@Component +struct TotalView { + @Prop @Watch('onCountUpdated') count: number; + @State total: number = 0; + // @Watch cb + onCountUpdated(propName: string): void { + this.total += this.count; + } + + build() { + Text(`Total: ${this.total}`) + } +} + +@Entry +@Component +struct CountModifier { + @State count: number = 0; + + build() { + Column() { + Button('add to basket') + .onClick(() => { + this.count++ + }) + TotalView({ count: this.count }) + } + } +} +``` + +处理步骤: + +1. CountModifier自定义组件的Button.onClick点击事件自增count。 + +2. 由于\@State count变量更改,子组件TotalView中的\@Prop被更新,其\@Watch('onCountUpdated')方法被调用,更新了子组件TotalView 中的total变量。 + +3. 子组件TotalView中的Text重新渲染。 diff --git a/zh-cn/application-dev/quick-start/atomicService-aging.md b/zh-cn/application-dev/quick-start/atomicService-aging.md new file mode 100644 index 0000000000000000000000000000000000000000..6386a526006120cfd6c94bb18252137fedf03e78 --- /dev/null +++ b/zh-cn/application-dev/quick-start/atomicService-aging.md @@ -0,0 +1,72 @@ +# 原子化服务空间管理(仅对系统应用开放) + +从用户的角度,用户不感知原子化服务的安装,也不会主动的卸载原子化服务;从操作系统的角度,原子化服务使用[免安装特性](../reference/apis/js-apis-freeInstall.md),但并不是真的不安装。因此,为了减少系统空间占用,需要对原子化服务有序管理。 + +## 原子化服务数据目录配额管理 + +对原子化服务的数据沙箱目录设置存储配额上限,可通过系统参数persist.sys.bms.aging.policy.atomicservice.datasize.threshold获得,默认值1024MB,当超过该配额限制时,写入数据返回失败。 + +查看和设置系统参数可使用[param get/set](../../device-dev/subsystems/subsys-boot-init-plugin.md)命令 + +## 主动销毁原子化服务 + +可以通过[uninstall](../reference/apis/js-apis-installer.md#bundleinstalleruninstall)接口主动销毁原子化服务。 + +**示例:** + +```ts +import installer from '@ohos.bundle.installer'; +let bundleName = 'com.ohos.demo'; +let installParam = { + userId: 100 +}; + +try { + installer.getBundleInstaller().then(data => { + data.uninstall(bundleName, installParam, err => { + if (err) { + console.error('uninstall failed:' + err.message); + } else { + console.info('uninstall successfully.'); + } + }); + }).catch(error => { + console.error('getBundleInstaller failed. Cause: ' + error.message); + }); +} catch (error) { + console.error('getBundleInstaller failed. Cause: ' + error.message); +} +``` + +## 自动销毁原子化服务 + +### 自动销毁时机 + +- 定时器触发,其间隔可通过系统参数persist.sys.bms.aging.policy.timer.interval获得,默认8小时;要求剩余电量必须大于等于系统参数persist.sys.bms.aging.policy.battery.threshold,默认10% +- 安装原子化服务时触发 +- 修改原子化服务可清理标识时触发 + +### 销毁条件 + +#### 原子化服务可销毁 + +- 通过[isHapModuleRemovable](../reference/apis/js-apis-freeInstall.md#ishapmoduleremovable)返回true +- 非运行状态 + +#### 销毁开始条件 + +当前系统所有原子化服务占用空间(包含安装目录和数据目录)大于系统参数persist.sys.bms.aging.policy.data.size.threshold,默认500MB + +#### 销毁结束条件 + +当前系统所有原子化服务占用空间(包含安装目录和数据目录)小于系统参数persist.sys.bms.aging.policy.data.size.threshold的80% + +### 自动销毁顺序 + +- 将可销毁的原子化服务按照最近使用时间区分到不同时间区域内,如[0, 10), [10, 20), [20, 30), [30, ~), 可通过系统参数persist.sys.bms.aging.policy.recently.used.threshold获得时间区域单位,默认是1天; +- 对于两个可销毁的原子化服务,若处于同一时间区域内优先销毁使用频率低的原子化服务;若处于不同时间区域内优先销毁长时间未使用的原子化服务。 + +### 分级自动销毁 + +- 当满足自动销毁开始条件时,按照销毁顺序优先销毁原子化服务的cache目录,若满足销毁结束条件,则退出; +- 若不满足,则按照销毁顺序再次清理原子化服务的其他目录。 \ No newline at end of file diff --git a/zh-cn/application-dev/quick-start/atomicService.md b/zh-cn/application-dev/quick-start/atomicService.md new file mode 100644 index 0000000000000000000000000000000000000000..8443ee6545da58d949edbe39b816b8c415b5c12f --- /dev/null +++ b/zh-cn/application-dev/quick-start/atomicService.md @@ -0,0 +1,218 @@ +# 原子化服务 + +## 原子化服务分包预加载 + +### 使用分包 + +为了加快首次启动原子化服务时的速度,可以采用分包策略,原子化服务的代码包可以被划分为几个:一个是类型为entry的模块,包含原子化服务启动时会打开的页面代码和相关资源;其余是“分包”,包含其余的代码和资源。这样,启动原子化服务时,只需下载和安装entry模块,即可立刻启动原子化服务,大大降低原子化服务下载的时间。 + +#### 配置方法 + +原子化服务分包可以在`DevEco Studio`中创建,我们以创建一个原子化服务为例。基本的工程目录结构大致如下: + +``` +├── AppScope +| ├── resources +| └── app.json5 +├── entry +| └── src/main +| ├── ets +| ├── resources +| └── module.json5 +├── feature +| └── src/main +| ├── ets +| ├── resources +| └── module.json5 +├── library +| └── src/main +| ├── ets +| ├── resources +| └── module.json5 +├── node_modules +``` + +注意,开发者需要在[app.json5](app-configuration-file.md)中`bundleType`字段指定为`atomicService`,标识当前应用是原子化服务。`app.json5`(路径为:`AppScope/app.json5`)的内容为: + +```json +{ + "app": { + "bundleName": "com.example.hmservice", + "bundleType":"atomicService", + "vendor": "example", + "versionCode": 1000000, + "versionName": "1.0.0", + "icon": "$media:app_icon", + "label": "$string:app_name", + "targetAPIVersion": 9 + } +} +``` + +具体分包攻略,详细可参考[多hap开发](multi-hap-objective.md)。 + +#### 限制 + +1. 原子化服务中每个模块对应的配置文件[module.json5](module-configuration-file.md)中`installationFree`字段必须为`true`。 + +2. 打包原子化服务时,需遵循以下大小校验规则: + +- 原子化服务中,所有包的大小总和不能超过10M。 + +- 单个包加上其依赖的所有[共享包](in-app-hsp.md),大小不能超过2M。 + + +### 使用预加载 + +开发者可以通过配置,在原子化服务进入某个模块时,由系统自动预下载可能需要的模块,从而提升进入后续模块的速度。 + +原子化服务预加载目前只支持通过配置方式使用,暂不支持通过调用API使用。 + +#### 配置方法 + +原子化服务预加载行为在点击进入某个模块时,第一帧绘制结束之后触发,可以通过在相应模块的[module.json5](module-configuration-file.md)文件中配置`atomicService`标签下的`preloads`字段来控制,以下为entry模块的`module.json5`(路径为:`entry/src/main/module.json5`)文件内容: + +```json +{ + "module": { + "name": "entry", + "type": "entry", + "srcEntry": "./ets/Application/MyAbilityStage.ts", + "description": "$string:entry_desc", + "mainElement": "MainAbility", + "deviceTypes": [ + "default", + "tablet" + ], + "deliveryWithInstall": true, + "installationFree": true, + "pages": "$profile:main_pages", + "atomicService": { + "preloads": [ + { + "moduleName": "feature" + } + ] + }, + "abilities": [ + { + "name": "MainAbility", + "srcEntry": "./ets/MainAbility/MainAbility.ts", + "description": "$string:MainAbility_desc", + "icon": "$media:icon", + "label": "$string:MainAbility_label", + "startWindowIcon": "$media:icon", + "startWindowBackground": "$color:white", + "exported": true, + "skills": [ + { + "entities": [ + "entity.system.home" + ], + "actions": [ + "action.system.home" + ] + } + ] + } + ] + } +} +``` + +在完成entry模块的第一帧绘制结束后,会自动执行预加载去下载和安装模块名为feature的模块。 + +#### 限制 + +preloads列表配置的moduleName对应的[moduleType(模块类型)](../reference/apis/js-apis-bundleManager.md#moduletype)不能为entry。 + +## 原子化服务中使用动态共享包 + +[Harmony动态共享包](shared-guide.md)(Harmony Shared Package),简称HSP,其可以包含其他模块公用的代码、C++库、资源和配置文件等。 +在原子化服务中使用HSP,可以参考[应用内HSP开发指导](in-app-hsp.md)。 + +#### 配置方法 + +假设工程目录结构如下: +``` +├── AppScope +| ├── resources +| └── app.json5 +├── entry +| └── src/main +| ├── ets +| ├── entryAbility +| └── pages +| └── Index.ets +| ├── resources +| └── module.json5 +├── feature +| └── src/main +| ├── ets +| ├── resources +| └── module.json5 +├── library +| └── src/main +| ├── ets +| └── pages +| └── menu.ets +| ├── resources +| └── module.json5 +├── node_modules +``` + +若开发者想在entry模块中,添加一个按钮跳转至library模块中的menu页面(路径为:`library/src/main/ets/pages/menu.ets`),那么可以在使用方的代码(entry模块下的Index.ets,路径为:`entry/src/main/ets/MainAbility/Index.ets`)里这样使用: + +```ts +import router from '@ohos.router'; + +@Entry +@Component +struct Index { + @State message: string = 'Hello World'; + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + // 添加按钮,以响应用户点击 + Button() { + Text('click to menu') + .fontSize(30) + .fontWeight(FontWeight.Bold) + } + .type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('40%') + .height('5%') + // 绑定点击事件 + .onClick(() => { + router.pushUrl({ + url: '@bundle:com.example.hmservice/library/ets/pages/menu' + }).then(() => { + console.log("push page success"); + }).catch(err => { + console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); + }) + }) + .width('100%') + } + .height('100%') + } + } +} +``` + +其中`router.pushUrl`方法的入参中`url`的内容为: +```ts +'@bundle:com.example.hmservice/library/ets/pages/menu' +``` +`url`内容的模板为: +```ts +'@bundle:包名(bundleName)/模块名(moduleName)/路径/页面所在的文件名(不加.ets后缀)' +``` \ No newline at end of file diff --git a/zh-cn/application-dev/quick-start/cross-app-hsp.md b/zh-cn/application-dev/quick-start/cross-app-hsp.md index 8b9d5f8832629a6d19659f027b9476ad45397cdd..c338f8c07a3a055ef1b53481cfc200fc0ec7613b 100644 --- a/zh-cn/application-dev/quick-start/cross-app-hsp.md +++ b/zh-cn/application-dev/quick-start/cross-app-hsp.md @@ -1,23 +1,29 @@ # 应用间HSP开发指导 应用间`HSP`用于不同应用间的代码、资源共享。 -应用间`HSP`的宿主应用是一种特殊状态的应用,只能由一个[HSP](hsp-guide.md)包组成,不会独立运行在设备上,而是被普通应用模块的依赖项引用。当普通应用运行时,通过动态调用的方式使用应用间`HSP`提供的能力,从而实现应用自身所需要的功能。 +应用间`HSP`的宿主应用是一种特殊状态的应用,只能由一个`HSP`组成,不会独立运行在设备上,而是被普通应用模块的依赖项引用。当普通应用运行时,通过动态调用的方式使用应用间`HSP`提供的能力,从而实现应用自身所需要的功能。 + +## 注意事项 +1. 应用间`HSP`的代码会运行在开发者应用的进程中,调用相关代码时,需要做好异常捕获与容错处理,防止由于应用间`HSP`功能异常导致的稳定性问题。 +2. 一个应用可以同时依赖多个应用间`HSP`。 +3. 应用间`HSP`会影响开发者应用自身的启动时间,依赖过多的应用间`HSP`可能会导致启动时延发生明显的劣化,建议将依赖的数目控制在16个以内。 +4. 应用间`HSP`安装时需要对特权权限进行校验,如果想要开发应用间`HSP`,需要配置allowAppShareLibrary应用特权,具体配置方式参考[应用特权配置指南](../../device-dev/subsystems/subsys-app-privilege-config-guide.md)。 ## 应用间HSP的使用 应用间HSP会分为两部分对外发布: -一部分为[HAR包](har-package.md),这部分`HAR`包中不会包含具体的功能实现代码,而仅仅包含导出的对象与方法,所以体积很小。应用开发者将`HAR`包集成到自身的工程中,然后就可以通过调用`HAR`包中提供的对象与方法完成自身的应用功能。 +一部分为[HAR](har-package.md),`HAR`包中不会包含具体的功能实现代码,而仅仅包含导出的对象与方法,所以体积很小。应用开发者将`HAR`包集成到自身的工程中,然后就可以通过调用`HAR`包中提供的对象与方法完成自身的应用功能。 -另外一部分为[HSP](hsp-guide.md),这部分为应用间`HSP`的具体实现,里面包含js/ts代码、C++库、资源和配置文件。这部分会上架到应用市场或者集成到系统版本中。 +另外一部分为HSP,这部分为应用间`HSP`的具体实现,里面包含js/ts代码、C++库、资源和配置文件。这部分会上架到应用市场或者集成到系统版本中。 -### 集成应用间HSP的HAR包 -`HAR`包中的`index.d.ets`文件是应用间`HSP`导出的声明文件的入口,所有需要导出的接口,统一在`index.d.ets`文件中定义。`index.d.ets`文件路径如下: +### 集成应用间HSP的HAR +`HAR`中的`index.d.ets`文件是应用间`HSP`导出的声明文件的入口,所有需要导出的接口,统一在`index.d.ets`文件中定义。`index.d.ets`文件路径如下: ``` src ├── main | └── module.json5 ├── index.d.ets -└── package.json +└── oh-package.json5 ``` `index.d.ets`内容样例如下: ```ts @@ -110,8 +116,8 @@ extern "C" __attribute__((constructor)) void RegisterLibaModule(void) { napi_module_register(&demoModule); } ``` -### 使用HAR包导出的能力 -引用`HAR`包前,需要先配置对`HAR`的依赖,配置方式可参考[文档](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-development-npm-package-0000001222578434#section89674298391)。`HAR`包配置成功后,在配置模块的`module.json`中会生成相关依赖项信息,如下所示: +### 使用HAR导出的能力 +引用`HAR`前,需要先配置对`HAR`的依赖,配置方式可参考[文档](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-development-npm-package-0000001222578434#section89674298391)。`HAR`配置成功后,在配置模块的`module.json5`中会生成相关依赖项信息,如下所示: ```json "dependencies": [ { @@ -122,8 +128,8 @@ extern "C" __attribute__((constructor)) void RegisterLibaModule(void) { ] ``` 其中`bundleName`为应用间`HSP`的`bundle`名称,`moduleName`为应用间`HSP`的模块名称,`versionCode`为应用间`HSP`的版本号。 -#### **使用HAR包中的ArkUI组件** -`HAR`共享包的依赖配置成功后,可以引用`HAR`共享包的ArkUI组件。ArkUI组件的导入方式与ts的导入方式一致,通过`import`引入`HAR`共享包导出的ArkUI组件,示例如下所示: +#### **使用HAR中的ArkUI组件** +`HAR`的依赖配置成功后,可以引用`HAR`的ArkUI组件。ArkUI组件的导入方式与ts的导入方式一致,通过`import`引入`HAR`导出的ArkUI组件,示例如下所示: ``` ts import { UIComponent } from 'liba' @@ -133,7 +139,7 @@ struct Index { @State message: string = 'Hello World' build() { Row() { - // 引用HAR共享包的ArkUI组件 + // 引用HAR的ArkUI组件 UIComponent() Column() { Text(this.message) @@ -147,8 +153,8 @@ struct Index { } ``` -#### **使用HAR包中的ts方法** -通过`import`引用`HAR`共享包导出的ts类和方法,示例如下所示: +#### **使用HAR中的ts方法** +通过`import`引用`HAR`导出的ts类和方法,示例如下所示: ``` ts import { foo1 } from 'liba' import { foo2 } from 'liba' @@ -160,7 +166,7 @@ struct Index { Column() { Button('Button') .onClick(()=>{ - // 引用HAR共享包的ts方法 + // 引用HAR的ts方法 foo1(); foo2(); }) @@ -171,8 +177,8 @@ struct Index { } } ``` -#### **使用HAR包中的native方法** -通过`import`引用`HAR`共享包导出的native方法,示例如下所示: +#### **使用HAR中的native方法** +通过`import`引用`HAR`导出的native方法,示例如下所示: ``` ts import { nativeHello } from 'liba' @@ -183,7 +189,7 @@ struct Index { Column() { Button('Button') .onClick(()=>{ - // 引用HAR共享包的native方法 + // 引用HAR的native方法 nativeHello(); }) } @@ -196,26 +202,20 @@ struct Index { ## 应用间HSP的分发方式 应用间`HSP`由于并未直接完整的集成到开发者应用中去,所以需要提前预置在系统版本中或者随开发者应用同步安装到设备上,主要有以下两种形式: -1. 随系统发布,部分常用应用间`HSP`会预置在系统版本中 +1. 随系统发布,部分常用应用间`HSP`会预置在系统版本中。 2. 随应用发布,即用户在应用市场下载应用时,如果应用依赖了一个或者多个应用间`HSP`,同时设备上没有安装这个其依赖的应用间`HSP`时,应用市场会为用户同时下载普通应用以及其依赖的应用间`HSP`。从而保证普通应用能够正常使用共享库的功能。 ### 应用间HSP的调试方式 开发者本地调试应用间`HSP`相关的功能时,可能并不具备上述分发的条件,此时可以通过`bm`相关指令本地完成应用间`HSP`的分发,主要步骤如下: -1. 获取到应用间`HSP`的安装包 -2. 通过`bm`指令先安装应用间`HSP`的安装包 +1. 获取到应用间`HSP`的安装包。 +2. 通过`bm`指令先安装应用间`HSP`的安装包。 ``` bm install -s sharebundle.hsp ``` -3. 通过`bm`指令后安装开发者自身的应用`hap` +3. 通过`bm`指令后安装开发者自身的应用`hap`。 ``` bm install -p feature.hap ``` -4. 启动开发者自身的应用,调试相关功能 +4. 启动开发者自身的应用,调试相关功能。 **注意**:步骤2和步骤3不可以颠倒,否则会由于缺少必要的应用间`HSP`导致开发者的应用安装失败。更多`bm`相关指令可以参考[文档](https://gitee.com/openharmony/bundlemanager_bundle_framework#bm%E5%B7%A5%E5%85%B7%E5%91%BD%E4%BB%A4)。 - -## 注意事项 -1. 应用间`HSP`的代码会运行再开发者应用的进程中,调用相关代码时,需要做好异常捕获与容错处理,防止由于应用间`HSP`功能异常导致的稳定性问题 -2. 一个应用可以同时依赖多个应用间`HSP` -3. 应用间`HSP`会影响开发者应用自身的启动时间,依赖过多的应用间HSP可能会导致启动时延发生明显的劣化,建议将依赖的数目控制在16个以内。 -4. 当前三方开发者开发者只能使用系统提供的应用间`HSP`,不支持开发并发布自己的应用间`HSP`。 \ No newline at end of file diff --git a/zh-cn/application-dev/quick-start/figures/01.png b/zh-cn/application-dev/quick-start/figures/01.png deleted file mode 100644 index 8342856ec6643e20a941187852e6aef3ead11010..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/quick-start/figures/01.png and /dev/null differ diff --git a/zh-cn/application-dev/quick-start/figures/02.png b/zh-cn/application-dev/quick-start/figures/02.png deleted file mode 100644 index eef374a1fd63f2b1e4d72e3323e7f4c23f5705fb..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/quick-start/figures/02.png and /dev/null differ diff --git a/zh-cn/application-dev/quick-start/figures/04.png b/zh-cn/application-dev/quick-start/figures/04.png deleted file mode 100644 index 1190d1e5aa631b12171632d258e4c4fae32e9bba..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/quick-start/figures/04.png and /dev/null differ diff --git a/zh-cn/application-dev/quick-start/figures/07.png b/zh-cn/application-dev/quick-start/figures/07.png deleted file mode 100644 index 17f2b060d300667ff250935b6a37485843e854ce..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/quick-start/figures/07.png and /dev/null differ diff --git a/zh-cn/application-dev/quick-start/figures/CoreSpec_figures_state-mgmt-overview.png b/zh-cn/application-dev/quick-start/figures/CoreSpec_figures_state-mgmt-overview.png deleted file mode 100644 index 37ae5324808a0ab50f210907ca65a09e4456a371..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/quick-start/figures/CoreSpec_figures_state-mgmt-overview.png and /dev/null differ diff --git a/zh-cn/application-dev/quick-start/figures/Video_2023-03-06_152548.gif b/zh-cn/application-dev/quick-start/figures/Video_2023-03-06_152548.gif new file mode 100644 index 0000000000000000000000000000000000000000..c5cd5839d7eebfea2b10d06f197e7caddc30f61c Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/Video_2023-03-06_152548.gif differ diff --git a/zh-cn/application-dev/quick-start/figures/Video_2023-03-17_120758.gif b/zh-cn/application-dev/quick-start/figures/Video_2023-03-17_120758.gif new file mode 100644 index 0000000000000000000000000000000000000000..500d179cd0a05e73a65047711a03c25fac596ba2 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/Video_2023-03-17_120758.gif differ diff --git a/zh-cn/application-dev/quick-start/figures/Video_2023-03-17_144605.gif b/zh-cn/application-dev/quick-start/figures/Video_2023-03-17_144605.gif new file mode 100644 index 0000000000000000000000000000000000000000..d48d7a7d7e0370acaf85fdc9164b526c69397a5d Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/Video_2023-03-17_144605.gif differ diff --git a/zh-cn/application-dev/quick-start/figures/Video_2023-03-17_144824.gif b/zh-cn/application-dev/quick-start/figures/Video_2023-03-17_144824.gif new file mode 100644 index 0000000000000000000000000000000000000000..f4437b3e2c92eaaa6ed7cd6daf508939b8d8ec99 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/Video_2023-03-17_144824.gif differ diff --git a/zh-cn/application-dev/quick-start/figures/application_details.jpg b/zh-cn/application-dev/quick-start/figures/application_details.jpg new file mode 100644 index 0000000000000000000000000000000000000000..17b7172bc5bea2f4e16af8d385834930ca4bf49f Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/application_details.jpg differ diff --git a/zh-cn/application-dev/quick-start/figures/arkts-basic-grammar.png b/zh-cn/application-dev/quick-start/figures/arkts-basic-grammar.png new file mode 100644 index 0000000000000000000000000000000000000000..3f1c355759a60d5d2bca9166776ff3000b947796 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/arkts-basic-grammar.png differ diff --git a/zh-cn/application-dev/quick-start/figures/arkts-get-started.png b/zh-cn/application-dev/quick-start/figures/arkts-get-started.png deleted file mode 100644 index 21de3f9615767dfb3e50fc5a0e1707eb87dfb73d..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/quick-start/figures/arkts-get-started.png and /dev/null differ diff --git a/zh-cn/application-dev/quick-start/figures/chooseFAModel_ets.png b/zh-cn/application-dev/quick-start/figures/chooseFAModel_ets.png new file mode 100644 index 0000000000000000000000000000000000000000..784659f8b0efaf71620d06dd0df5c58d22ac47f4 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/chooseFAModel_ets.png differ diff --git a/zh-cn/application-dev/quick-start/figures/chooseFAModel_js.png b/zh-cn/application-dev/quick-start/figures/chooseFAModel_js.png new file mode 100644 index 0000000000000000000000000000000000000000..4d121aa3a9a1e3ba68cc5f70f6944fcfa3cef792 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/chooseFAModel_js.png differ diff --git a/zh-cn/application-dev/quick-start/figures/chooseStageModel.png b/zh-cn/application-dev/quick-start/figures/chooseStageModel.png new file mode 100644 index 0000000000000000000000000000000000000000..3125c8ba0591ce0c53344f35fb780eb956601624 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/chooseStageModel.png differ diff --git a/zh-cn/application-dev/quick-start/figures/createProject.png b/zh-cn/application-dev/quick-start/figures/createProject.png new file mode 100644 index 0000000000000000000000000000000000000000..7a56a44e0e7f80671b86c521792352db625ccad7 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/createProject.png differ diff --git a/zh-cn/application-dev/quick-start/figures/09.png b/zh-cn/application-dev/quick-start/figures/secondPage.png similarity index 100% rename from zh-cn/application-dev/quick-start/figures/09.png rename to zh-cn/application-dev/quick-start/figures/secondPage.png diff --git a/zh-cn/application-dev/quick-start/figures/06.png b/zh-cn/application-dev/quick-start/figures/signConfig.png similarity index 100% rename from zh-cn/application-dev/quick-start/figures/06.png rename to zh-cn/application-dev/quick-start/figures/signConfig.png diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001206450834.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001206450834.png deleted file mode 100644 index 35a5db40879212c9d90e5a02bba02e49e1158c8f..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001206450834.png and /dev/null differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001251090821.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001251090821.png deleted file mode 100644 index 69aec480939a34e310d8fbeead6a8e33644bb11b..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001251090821.png and /dev/null differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001364054489.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001364054489.png index bcc45efdddb87a39201661c5f6d3ccbce9bfd3e6..8959cbb51a89df8142870313881bd45c2974d2ba 100644 Binary files a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001364054489.png and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001364054489.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001501936014.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001501936014.png new file mode 100644 index 0000000000000000000000000000000000000000..7f6f1aa654cee34259ae3699a4eb82a5fa4bedf6 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001501936014.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001501938718.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001501938718.png new file mode 100644 index 0000000000000000000000000000000000000000..2b133e6c4b8fa5ddd176dde3566ac2fa1aae635f Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001501938718.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001502091796.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001502091796.png new file mode 100644 index 0000000000000000000000000000000000000000..1f66ecd249d5ec2570288f0a4c2d44848d3fae44 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001502091796.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001502092556.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001502092556.png new file mode 100644 index 0000000000000000000000000000000000000000..e7b56752fed8e17502a7685d172cf796f213cbb7 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001502092556.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001502094666.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001502094666.png new file mode 100644 index 0000000000000000000000000000000000000000..c0503a81e37bb673026af6da01c06853531c11bd Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001502094666.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001502255262.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001502255262.png new file mode 100644 index 0000000000000000000000000000000000000000..c4715b0d8616e163f5bed207cf5732ba360f307f Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001502255262.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001502372786.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001502372786.png new file mode 100644 index 0000000000000000000000000000000000000000..b67f19d236bc4684e8eb1802b249e4096398b9ba Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001502372786.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001502704640.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001502704640.png new file mode 100644 index 0000000000000000000000000000000000000000..3bc469d94558ec8c6637d01423e33b053eeaa557 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001502704640.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001552614217.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001552614217.png new file mode 100644 index 0000000000000000000000000000000000000000..e011bf227710e2796bbc6cc075066e608c0d83f5 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001552614217.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001552855957.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001552855957.png new file mode 100644 index 0000000000000000000000000000000000000000..0d81f1ac85bf11bc8d593e677cb284309e39ae8b Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001552855957.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001552972029.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001552972029.png new file mode 100644 index 0000000000000000000000000000000000000000..38c0cfa6f39685d47eb47da8b6a522bf68c2a602 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001552972029.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001552978157.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001552978157.png new file mode 100644 index 0000000000000000000000000000000000000000..13c73e874103d7bc798154d8bdcfde1a8b298e5c Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001552978157.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001553348833.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001553348833.png new file mode 100644 index 0000000000000000000000000000000000000000..3f1eb07e78b2cb1234c50fb9eda495dd3f5f2001 Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001553348833.png differ diff --git a/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001562352677.png b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001562352677.png new file mode 100644 index 0000000000000000000000000000000000000000..64e710ea9ea0fe8e484d262c9260600b01ffd00a Binary files /dev/null and b/zh-cn/application-dev/quick-start/figures/zh-cn_image_0000001562352677.png differ diff --git a/zh-cn/application-dev/quick-start/full-sdk-compile-guide.md b/zh-cn/application-dev/quick-start/full-sdk-compile-guide.md index 655446886bf5dc1d872927cd0c07b35634a5716e..d1b97f4179a7d0e763b5370f31ff2ec9a81f28f4 100644 --- a/zh-cn/application-dev/quick-start/full-sdk-compile-guide.md +++ b/zh-cn/application-dev/quick-start/full-sdk-compile-guide.md @@ -1,4 +1,4 @@ -# full-SDK编译指南 +# 如何编译full-SDK **full-SDK**是提供OpenHarmony全量接口的SDK,包含了系统应用所需要的高权限API,用于厂商开发应用。 @@ -22,9 +22,9 @@ 4. 编译:./build.sh --product-name ohos-sdk -编译成功后导出即可 +编译成功后导出out/sdk/packages/ohos-sdk/目录下的文件即可 ## 替换SDK -full-SDK编译完成后需要在DevEcoStudio替换使用,具体请参考[full-SDK替换指南](../../application-dev/quick-start/full-sdk-switch-guide.md)。 +full-SDK编译完成后需要在DevEcoStudio替换使用,具体请参考[full-SDK替换指南](full-sdk-switch-guide.md)。 diff --git a/zh-cn/application-dev/quick-start/full-sdk-switch-guide.md b/zh-cn/application-dev/quick-start/full-sdk-switch-guide.md index 73c9190d9fc124b353e6372ee1acc52f5d5781a8..b931eda14aa2545281bad1bb8ef8d7e4968c83c0 100644 --- a/zh-cn/application-dev/quick-start/full-sdk-switch-guide.md +++ b/zh-cn/application-dev/quick-start/full-sdk-switch-guide.md @@ -1,4 +1,4 @@ -# full-SDK替换指南 +# 如何替换full-SDK **public-SDK**是提供给应用开发的工具包,跟随DevEco Studio下载,不包含系统应用所需要的高权限API diff --git a/zh-cn/application-dev/quick-start/har-package.md b/zh-cn/application-dev/quick-start/har-package.md index ed82cdf4949b6946feab4f462655346dca070223..cef09be1ef5764c019c3b726bcd2dc333aea2c03 100644 --- a/zh-cn/application-dev/quick-start/har-package.md +++ b/zh-cn/application-dev/quick-start/har-package.md @@ -1,8 +1,8 @@ # HAR -HAR(Harmony Archive)是Harmony静态共享包,可以包含代码、C++库、资源和配置文件。通过HAR共享包,可以实现多个模块或多个工程共享ArkUI组件、资源等相关代码。HAR不同于HAP,不能独立安装运行在设备上,只能作为应用模块的依赖项被引用。 +HAR(Harmony Archive)是静态共享包,可以包含代码、C++库、资源和配置文件。通过HAR可以实现多个模块或多个工程共享ArkUI组件、资源等相关代码。HAR不同于HAP,不能独立安装运行在设备上,只能作为应用模块的依赖项被引用。 ## 创建HAR模块 -HAR包对应DevEco Studio工程中的“Library”类型的[Module](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/ohos-adding-deleting-module-0000001218760594-V3),可以通过DevEco Studio创建一个HAR模块。HAR模块默认不开启混淆能力,开启混淆能力,需要把HAR模块的build-profile.json5文件中的artifactType字段设置为obfuscation,配置如下所示: +HAR对应DevEco Studio工程中的“Library”类型的[Module](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/ohos-adding-deleting-module-0000001218760594-V3),可以通过DevEco Studio创建一个HAR模块。HAR模块默认不开启混淆能力,开启混淆能力,需要把HAR模块的build-profile.json5文件中的artifactType字段设置为obfuscation,配置如下所示: ```json { @@ -19,7 +19,7 @@ artifactType字段有以下两种取值,默认缺省为original。 需要对代码资产进行保护时,建议开启混淆能力,混淆能力开启后,DevEco Studio在构建HAR时,会对代码进行编译、混淆及压缩处理,保护代码资产。 注意:artifactType字段设置为obfuscation时,apiType字段必须设置为stageMode,因为Stage模型才支持混淆。 -## HAR共享包开发注意事项 +## HAR开发注意事项 - HAR不支持在配置文件中声明abilities、extensionAbilities组件。 - HAR不支持在配置文件中声明pages页面。 - HAR不支持在build-profile.json5文件的buildOption中配置worker。 @@ -27,7 +27,7 @@ artifactType字段有以下两种取值,默认缺省为original。 - Stage模型的HAR,不能引用AppScope内的内容。在编译构建时APPScope中的内容不会打包到HAR中,导致HAR资源引用失败。 ## 导出HAR的ArkUI组件、接口、资源 -index.ets文件是HAR共享包导出声明文件的入口,HAR共享包需要导出的接口,统一在index.ets文件中导出。index.ets文件是DevEco Studio默认自动生成的,用户也可以自定义,在模块的package.json文件中的main字段配置入口声明文件,配置如下所示: +index.ets文件是HAR导出声明文件的入口,HAR需要导出的接口,统一在index.ets文件中导出。index.ets文件是DevEco Studio默认自动生成的,用户也可以自定义,在模块的oh-package.json5文件中的main字段配置入口声明文件,配置如下所示: ```json { "main": "index.ets" @@ -84,17 +84,17 @@ export { func } from './src/main/ts/test' export { func2 } from './src/main/ts/test' ``` ### 资源 -HAR模块编译打包时会把资源打包到HAR包中。在编译构建HAP时,DevEco Studio会从HAP模块及依赖的模块中收集资源文件,如果不同模块下的资源文件出现重名冲突时,DevEco Studio会按照以下优先级进行覆盖(优先级由高到低): +HAR模块编译打包时会把资源打包到HAR中。在编译构建HAP时,DevEco Studio会从HAP模块及依赖的模块中收集资源文件,如果不同模块下的资源文件出现重名冲突时,DevEco Studio会按照以下优先级进行覆盖(优先级由高到低): - AppScope(仅API9的Stage模型支持)。 - HAP包自身模块。 - 依赖的HAR模块,如果依赖的多个HAR之间有资源冲突,会按照依赖顺序进行覆盖(依赖顺序在前的优先级较高)。 ## 引用HAR的ArkUI组件、接口、资源 -引用HAR共享包前,需要先配置对HAR的依赖,配置方式可[参考](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-development-npm-package-0000001222578434#section89674298391)。 +引用HAR前,需要先配置对HAR的依赖,配置方式可[参考](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-development-npm-package-0000001222578434#section89674298391)。 -### 引用HAR共享包的ArkUI组件 +### 引用HAR的ArkUI组件 -HAR共享包的依赖配置成功后,可以引用HAR共享包的ArkUI组件。ArkUI组件的导入方式与ts的导入方式一致,通过`import`引入HAR共享包导出的ArkUI组件,示例如下所示: +HAR的依赖配置成功后,可以引用HAR的ArkUI组件。ArkUI组件的导入方式与ts的导入方式一致,通过`import`引入HAR导出的ArkUI组件,示例如下所示: ```js // entry/src/main/ets/pages/index.ets import { MainPage } from "@ohos/library" @@ -105,7 +105,7 @@ struct Index { @State message: string = 'Hello World' build() { Row() { - // 引用HAR共享包的ArkUI组件 + // 引用HAR的ArkUI组件 MainPage() Column() { Text(this.message) @@ -118,8 +118,8 @@ struct Index { } } ``` -### 引用HAR共享包的类和方法 -通过`import`引用HAR共享包导出的ts类和方法,示例如下所示: +### 引用HAR的类和方法 +通过`import`引用HAR导出的ts类和方法,示例如下所示: ```js // entry/src/main/ets/pages/index.ets import { Log } from "@ohos/library" @@ -133,7 +133,7 @@ struct Index { Column() { Button('Button') .onClick(()=>{ - // 引用HAR共享包的类和方法 + // 引用HAR的类和方法 Log.info("har msg"); func(); }) @@ -144,8 +144,8 @@ struct Index { } } ``` -### 引用HAR共享包的资源 -通过`$r`引用HAR共享包中的资源,例如在HAR模块的`src/main/resources`里添加字符串资源(在string.json中定义,name:hello_har)和图片资源(icon_har.png),然后在Entry模块中引用该字符串和图片资源的示例如下所示: +### 引用HAR的资源 +通过`$r`引用HAR中的资源,例如在HAR模块的`src/main/resources`里添加字符串资源(在string.json中定义,name:hello_har)和图片资源(icon_har.png),然后在Entry模块中引用该字符串和图片资源的示例如下所示: ```js // entry/src/main/ets/pages/index.ets @Entry @@ -154,11 +154,11 @@ struct Index { build() { Row() { Column() { - // 引用HAR共享包的字符串资源 + // 引用HAR的字符串资源 Text($r("app.string.hello_har")) .fontSize(50) .fontWeight(FontWeight.Bold) - // 引用HAR共享包的图片资源 + // 引用HAR的图片资源 Image($r("app.media.icon_har")) } .width('100%') diff --git a/zh-cn/application-dev/quick-start/har-structure.md b/zh-cn/application-dev/quick-start/har-structure.md deleted file mode 100644 index cc154c35d98365155bffb2ee8bb995ef51d69571..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/quick-start/har-structure.md +++ /dev/null @@ -1,9 +0,0 @@ -# HAR包结构 - - -[HAR(Harmony Archive)](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-development-npm-package-0000001222578434)是Harmony静态共享包,可以包含代码、C++库、资源和module.json文件(Stage模型)或config.json文件(FA模型)等,用于实现多个模块或多个工程间的代码共享。 - -HAR包不同于HAP,不能独立安装运行在设备上,只能作为应用模块的依赖项被引用。 - -HAR包对应DevEco Studio工程中的“Library”类型的[Module](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/ohos-adding-deleting-module-0000001218760594-V3)。 - diff --git a/zh-cn/application-dev/quick-start/hsp-guide.md b/zh-cn/application-dev/quick-start/hsp-guide.md deleted file mode 100644 index e2a5e3cc161ac493652b89bd5240cfb80c4f7bbd..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/quick-start/hsp-guide.md +++ /dev/null @@ -1,18 +0,0 @@ -# HSP概述 - -`HSP`(`Harmony Shared Package`)是Harmony动态共享包,可以包含代码、C++库、资源和配置文件。 -`HSP`与[HAR(Harmony Achive)](har-package.md)都是为了实现代码和资源的共享,最大的不同之处在于,`HAR`中的代码和资源跟随使用方编译,如果有多个使用方,它们的编译产物中会存在多份相同拷贝。**而`HSP`中的代码和资源可以独立编译,运行时在一个进程中代码也只会存在一份。** - -**图1** `HAR`和`HSP`在`APP`包中的形态示意图 -![in-app-hsp-har](figures/in-app-hsp-har.png) - -**HSP旨在解决HAR包存在的几个问题:** -- 多个`HAP`引用相同`HAR`包,导致的`APP`包大小膨胀问题 -- 多个`HAP`引用相同`HAR`包,`HAR`包中的一些状态变量无法共享的问题 - -**HSP的一些约束:** -- `HSP`及其使用方都必须是`Stage`模型 -- `HSP`及其使用方都必须使用`esmodule`编译模式 -- `HSP`不支持在配置文件中声明`abilities`、`extensionAbilities`标签 - -`HSP`按照使用场景可以分为[应用内HSP](in-app-hsp.md)和[应用间HSP](cross-app-hsp.md)。它们在配置文件和使用方式等方面有所区别。 \ No newline at end of file diff --git a/zh-cn/application-dev/quick-start/in-app-hsp.md b/zh-cn/application-dev/quick-start/in-app-hsp.md index 2c456b608da986d0063c5821f6a515ec13e69761..46a95e3c365fb7b4ca34b11e49917c55ac0afb83 100644 --- a/zh-cn/application-dev/quick-start/in-app-hsp.md +++ b/zh-cn/application-dev/quick-start/in-app-hsp.md @@ -15,7 +15,7 @@ library │ │ └── index.ets │ ├── resources │ └── module.json5 -└── package.json +└── oh-package.json5 ``` 模块`module.json5`中的`"type"`标识模块类型,`HSP`的`"type"`是`"shared"`。 ```json @@ -24,7 +24,7 @@ library } ``` -`HSP`通过在入口文件中导出接口,对外提供能力。入口文件在模块`package.json`的`"main"`中配置。例如: +`HSP`通过在入口文件中导出接口,对外提供能力。入口文件在模块`oh-package.json5`的`"main"`中配置。例如: ```json { "main": "./src/main/ets/index.ets" @@ -103,14 +103,14 @@ export { nativeMulti } from './utils/nativeTest' ``` ## 使用应用内HSP -要使用`HSP`中的接口,首先需要在使用方的`package.json`中配置对它的依赖。如果应用内`HSP`和使用方在同一工程下,可以直接本地引用,例如: +要使用`HSP`中的接口,首先需要在使用方的`oh-package.json5`中配置对它的依赖。如果应用内`HSP`和使用方在同一工程下,可以直接本地引用,例如: ```json -// entry/src/main/module.json5 +// entry/oh-package.json5 "dependencies": { "library": "file:../library" } ``` -然后就可以像使用`HAR`包一样调用`HSP`的对外接口了。 +然后就可以像使用`HAR`一样调用`HSP`的对外接口了。 例如,上面的`library`已经导出了下面这些接口: ```ts // library/src/main/ets/index.ets @@ -150,4 +150,60 @@ struct Index { .height('100%') } } +``` + +### 跨包页面路由跳转 + +若开发者想在entry模块中,添加一个按钮跳转至library模块中的menu页面(路径为:`library/src/main/ets/pages/menu.ets`),那么可以在使用方的代码(entry模块下的Index.ets,路径为:`entry/src/main/ets/MainAbility/Index.ets`)里这样使用: +```ts +import router from '@ohos.router'; + +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + // 添加按钮,以响应用户点击 + Button() { + Text('click to menu') + .fontSize(30) + .fontWeight(FontWeight.Bold) + } + .type(ButtonType.Capsule) + .margin({ + top: 20 + }) + .backgroundColor('#0D9FFB') + .width('40%') + .height('5%') + // 绑定点击事件 + .onClick(() => { + router.pushUrl({ + url: '@bundle:com.example.hmservice/library/ets/pages/menu' + }).then(() => { + console.log("push page success"); + }).catch(err => { + console.error(`pushUrl failed, code is ${err.code}, message is ${err.message}`); + }) + }) + .width('100%') + } + .height('100%') + } + } +} +``` +其中`router.pushUrl`方法的入参中`url`的内容为: +```ets +'@bundle:com.example.hmservice/library/ets/pages/menu' +``` +`url`内容的模板为: +```ets +'@bundle:包名(bundleName)/模块名(moduleName)/路径/页面所在的文件名(不加.ets后缀)' ``` \ No newline at end of file diff --git a/zh-cn/application-dev/quick-start/module-configuration-file.md b/zh-cn/application-dev/quick-start/module-configuration-file.md index dbd64ee433a13647d1cf022a1c0c3984fd6afed3..92393e581ba192448aa7a34674599c328256f237 100644 --- a/zh-cn/application-dev/quick-start/module-configuration-file.md +++ b/zh-cn/application-dev/quick-start/module-configuration-file.md @@ -59,7 +59,9 @@ } } ] - } + }, + "targetModuleName": "feature", + "targetPriority": 50 } ``` @@ -75,11 +77,11 @@ module.json5配置文件包含以下标签。 | type | 标识当前Module的类型。类型有4种,分别:
- entry:应用的主模块。
- feature:应用的动态特性模块。
- har:静态共享包模块。
- shared:动态共享包模块。 | 字符串 | 该标签不可缺省。 | | srcEntry | 标识当前Module所对应的代码路径,标签值为字符串(最长为127字节)。 | 字符串 | 该标签可缺省,缺省值为空。 | | description | 标识当前Module的描述信息,标签值是字符串类型(最长255字节)或对描述内容的字符串资源索引。 | 字符串 | 该标签可缺省,缺省值为空。 | -| process | 标识当前Module的进程名,标签值为字符串类型(最长为31个字节)。如果在HAP标签下配置了process,该应用的所有UIAbility、DataShareExtensionAbility、ServiceExtensionAbility都运行在该进程中。
> **说明:**
> 仅支持系统应用配置,三方应用配置不生效。 | 字符串 | 可缺省,缺省为app.json5文件下app标签下的bundleName。 | +| process | 标识当前Module的进程名,标签值为字符串类型(最长为31个字节)。如果在HAP标签下配置了process,该应用的所有UIAbility、DataShareExtensionAbility、ServiceExtensionAbility都运行在该进程中。
**说明:**
仅支持系统应用配置,三方应用配置不生效。 | 字符串 | 可缺省,缺省为app.json5文件下app标签下的bundleName。 | | mainElement | 标识当前Module的入口UIAbility名称或者ExtensionAbility名称。标签最大字节长度为255。 | 字符串 | 该标签可缺省,缺省值为空。 | | [deviceTypes](#devicetypes标签) | 标识当前Module可以运行在哪类设备上,标签值采用字符串数组的表示。 | 字符串数组 | 该标签不可缺省,可以为空值。 | | deliveryWithInstall | 标识当前Module是否在用户主动安装的时候安装,表示该Module对应的HAP是否跟随应用一起安装。
- true:主动安装时安装。
- false:主动安装时不安装。 | 布尔值 | 该标签不可缺省。 | -| installationFree | 标识当前Module是否支持免安装特性。
- true:表示支持免安装特性,且符合免安装约束。
- false:表示不支持免安装特性。
> **说明:**
> 当应用的entry类型Module的该字段配置为true时,该应用的feature类型的该字段也需要配置为true。
> 当应用的entry类型Module的该字段配置为false时,该应用的feature类型的该字段根据业务需求配置true或false。 | 布尔值 | 该标签不可缺省。 | +| installationFree | 标识当前Module是否支持免安装特性。
- true:表示支持免安装特性,且符合免安装约束。
- false:表示不支持免安装特性。
**说明:**
当应用的entry类型Module的该字段配置为true时,该应用的feature类型的该字段也需要配置为true。
当应用的entry类型Module的该字段配置为false时,该应用的feature类型的该字段根据业务需求配置true或false。 | 布尔值 | 该标签不可缺省。 | | virtualMachine | 标识当前Module运行的目标虚拟机类型,供云端分发使用,如应用市场和分发中心。
该标签值为字符串。如果目标虚拟机类型为ArkTS引擎,则其值为“ark+版本号”。 | 字符串 | 该标签由IDE构建HAP的时候自动插入。 | | [pages](#pages标签) | 标识当前Module的profile资源,用于列举每个页面信息。该标签最大长度为255个字节。 | 字符串 | 在有UIAbility的场景下,该标签不可缺省。 | | [metadata](#metadata标签) | 标识当前Module的自定义元信息,标签值为数组类型,只对当前Module、UIAbility、ExtensionAbility生效。 | 对象数组 | 该标签可缺省,缺省值为空。 | @@ -87,7 +89,10 @@ module.json5配置文件包含以下标签。 | [extensionAbilities](#extensionabilities标签) | 标识当前Module中ExtensionAbility的配置信息,标签值为数组类型,只对当前ExtensionAbility生效。 | 对象 | 该标签可缺省,缺省值为空。 | | [requestPermissions](#requestpermissions标签) | 标识当前应用运行时需向系统申请的权限集合。 | 对象 | 该标签可缺省,缺省值为空。 | | [testRunner](#testrunner标签) | 标识当前Module用于支持对测试框架的配置。 | 对象 | 该标签可缺省,缺省值为空。 | - +| [atomicService](#atomicservice标签)| 标识当前应用是原子化服务时,有关原子化服务的相关配置。| 对象 | 该标签可缺省,缺省值为空。 | +| [dependencies](#dependencies标签)| 标识当前模块运行时依赖的共享库列表。| 对象数组 | 该标签可缺省,缺省值为空。 | +| targetModuleName | 标识当前包所指定的目标module, 标签值采用字符串表示(最大长度31个字节),该名称在指定的应用中要唯一。|字符串|该标签可缺省,缺省时当前包为非overlay特性的Module。| +| targetPriority | 标识当前Module的优先级, 当targetModuleName字段配置之后,当前Module为overlay特征的Module, 该标签的额取值范围为1~100|数值|该标签可缺省, 缺省值为1。| ## deviceTypes标签 @@ -131,8 +136,21 @@ deviceTypes示例: } ``` -在开发视图的resources/base/profile下面定义配置文件**main_pages**.json,其中文件名(**main_pages**)可自定义,需要和前文中pages标签指定的信息对应,配置文件中列举了当前应用组件中的页面信息。 +在开发视图的resources/base/profile下面定义配置文件**main_pages**.json,其中文件名(**main_pages**)可自定义,需要和前文中pages标签指定的信息对应。配置文件中列举了当前应用组件中的页面信息,包含页面的路由信息和显示窗口相关的配置。 + + **表3** **pages配置文件标签说明** +| 属性名称 | 含义 | 数据类型 | 是否可缺省 | +| -------- | -------- | -------- | -------- | +| src | 描述有关JavaScript模块中所有页面的路由信息,包括页面路径和页面名称。该值是一个字符串数组,其中每个元素表示一个页面,第一个元素表示主页。 | 字符串数组 | 该标签不可缺省。 | +| window | 用于定义与显示窗口相关的配置。 | 对象 | 该标签可缺省,缺省值为空。 | + + **表4** **pages配置文件中的window标签说明** + +| 属性名称 | 含义 | 数据类型 | 是否可缺省 | +| -------- | -------- | -------- | -------- | +| designWidth | 标识页面设计基准宽度。以此为基准,根据实际设备宽度来缩放元素大小。 | 数值 | 可缺省,缺省值为720px。 | +| autoDesignWidth | 标识页面设计基准宽度是否自动计算。当配置为true时,designWidth将会被忽略,设计基准宽度由设备宽度与屏幕密度计算得出。 | 布尔值 | 可缺省,缺省值为false。 | ```json { @@ -141,7 +159,11 @@ deviceTypes示例: "pages/second/payment", "pages/third/shopping_cart", "pages/four/owner" - ] + ], + "window": { + "designWidth": 720, + "autoDesignWidth": false + } } ``` @@ -150,7 +172,7 @@ deviceTypes示例: 该标签标识HAP的自定义元信息,标签值为数组类型,包含name,value,resource三个子标签。 -**表3** **metadata标签说明** +**表5** **metadata标签说明** | 属性名称 | 含义 | 数据类型 | 是否可缺省 | | -------- | -------- | -------- | -------- | @@ -165,7 +187,7 @@ deviceTypes示例: "metadata": [{ "name": "module_metadata", "value": "a test demo for module metadata", - "resource": "$profile:shortcuts_config", + "resource": "$profile:shortcuts_config" }], "abilities": [{ @@ -202,14 +224,15 @@ deviceTypes示例: abilities标签描述UIAbility组件的配置信息,标签值为数组类型,该标签下的配置只对当前UIAbility生效。 -**OpenHarmony中不允许应用隐藏启动图标** +**OpenHarmony中不允许应用隐藏入口图标** -OpenHarmony系统对无图标应用严格管控。如果HAP中没有配置启动图标,那么系统将应用app.json中的icon作为启动图标,并显示在桌面上。
-用户点击该图标,将跳转到Settings的应用管理中对应的应用详情页面中。
-如果应用想要隐藏启动图标,需要配置AllowAppDesktopIconHide应用特权,具体配置方式参考[应用特权配置指南](../../device-dev/subsystems/subsys-app-privilege-config-guide.md)。 +OpenHarmony系统对无图标应用严格管控。如果HAP中没有配置入口图标,那么系统将应用app.json中的icon作为入口图标,并显示在桌面上。
+用户点击该图标,将跳转到设置应用管理中对应的应用详情页面(图1)中。
+如果应用想要隐藏入口图标,需要配置AllowAppDesktopIconHide应用特权,具体配置方式参考[应用特权配置指南](../../device-dev/subsystems/subsys-app-privilege-config-guide.md)。 +**场景说明:** 该功能能防止一些恶意应用,故意配置无入口图标,导致用户找不到软件所在的位置,无法操作卸载应用,在一定程度上保证用户的手机安全 -**启动图标的设置:** 需要在配置文件(module.json5)中abilities配置下设置icon,label以及skills,而且skills的配置下的必须同时包含“ohos.want.action.home” 和 “entity.system.home”: +**入口图标的设置:** 需要在配置文件(module.json5)中abilities配置下设置icon,label以及skills,而且skills的配置下的必须同时包含“ohos.want.action.home” 和 “entity.system.home”: ``` { "module":{ @@ -226,40 +249,42 @@ OpenHarmony系统对无图标应用严格管控。如果HAP中没有配置启动 }] }], ... - + } } ``` -**启动图标的查询** -* HAP中包含Ability - * 配置文件(module.json5)中abilities配置中设置了启动图标 +**入口图标及入口标签的显示规则** +* HAP中包含UIAbility + * 配置文件(module.json5)中abilities配置中设置了入口图标 * 该应用没有隐藏图标的特权 - * 返回的桌面图标为该Ability配置的图标 - * 返回的桌面Label为该Ability配置的Label(如果没有配置Label,返回包名) - * 返回的组件名为该Ability的组件名 - * 用户点击该桌面图标,页面跳转到该Ability首页 + * 显示桌面图标为该UIAbility配置的图标 + * 显示桌面Label为该UIAbility配置的Label(如果没有配置Label,返回包名) + * 显示组件名为该UIAbility的组件名 + * 用户点击该桌面图标,页面跳转到该UIAbility首页 * 该应用具有隐藏图标的特权 * 桌面查询时不返回应用信息,不会在桌面上显示对应的图标。 - * 配置文件(module.json5)中abilities配置中未设置启动图标 + * 配置文件(module.json5)中abilities配置中未设置入口图标 * 该应用没有隐藏图标的特权 - * 返回的桌面图标为app配置下的图标(app.json中icon为必填项) - * 返回的桌面Label为app配置下的label(app.json中label为必填项) - * 返回的组件名为应用详情页面的组件名(该组件为系统内置) - * 用户点击该桌面图标,页面跳转到该应用的详情页面 + * 显示桌面图标为app配置下的图标(app.json中icon为必填项) + * 显示桌面Label为app配置下的label(app.json中label为必填项) + * 用户点击该桌面图标,页面跳转到该应用的详情页面(图1) * 该应用具有隐藏图标的特权 * 桌面查询时不返回应用信息,不会在桌面上显示对应的图标。 -* HAP中不包含Ability +* HAP中不包含UIAbility * 该应用没有隐藏图标的特权 - * 返回的桌面图标为app配置下的图标(app.json中icon为必填项) - * 返回的桌面Label为app配置下的label(app.json中label为必填项) - * 返回的组件名为应用详情页面的组件名(该组件为系统内置) - * 用户点击该桌面图标,页面跳转到该应用的详情页面 + * 显示桌面图标为app配置下的图标(app.json中icon为必填项) + * 显示桌面Label为app配置下的label(app.json中label为必填项) + * 用户点击该桌面图标,页面跳转到该应用的详情页面(图1) * 该应用具有隐藏图标的特权 * 桌面查询时不返回应用信息,不会在桌面上显示对应的图标。

+应用的详情页例图 + +![应用的详情页例图](figures/application_details.jpg) + - **表4** **abilities标签说明** + **表6** **abilities标签说明** | 属性名称 | 含义 | 数据类型 | 是否可缺省 | | -------- | -------- | -------- | -------- | @@ -280,14 +305,14 @@ OpenHarmony系统对无图标应用严格管控。如果HAP中没有配置启动 | removeMissionAfterTerminate | 标识当前UIAbility组件销毁后是否从任务列表中移除任务,为布尔类型:
- true表示销毁后移除任务。
- false表示销毁后不移除任务。 | 布尔值 | 该标签可缺省,缺省值为false。 | | orientation | 标识当前UIAbility组件启动时的方向。该方向的取值范围包括:
- unspecified:未指定方向,由系统自动判断显示方向。
- landscape:横屏。
- portrait:竖屏。
- landscape_inverted:反向横屏。
- portrait_inverted:反向竖屏。
- auto_rotation:随传感器旋转。
- auto_rotation_landscape:传感器横屏旋转,包括了横屏和反向横屏。
- auto_rotation_portrait:传感器竖屏旋转,包括了竖屏和反向竖屏。
- auto_rotation_restricted:传感器开关打开,方向可随传感器旋转。
- auto_rotation_landscape_restricted:传感器开关打开,方向可随传感器旋转为横屏, 包括了横屏和反向横屏。
- auto_rotation_portrait_restricted:传感器开关打开,方向随可传感器旋转为竖屏, 包括了横屏和反向横屏。
- locked:传感器开关关闭,方向锁定。 | 字符串 | 该标签可缺省,缺省值为unspecified。 | | supportWindowMode | 标识当前UIAbility组件所支持的窗口模式,包含:
- fullscreen:全屏模式。
- split:分屏模式。
- floating:悬浮窗模式。 | 字符串数组 | 该标签可缺省,缺省值为
["fullscreen", "split", "floating"]。 | -| priority | 标识当前UIAbility组件的优先级。[隐式查询](../application-models/explicit-implicit-want-mappings.md)时,优先级越高,UIAbility在返回列表越靠前。该标签取值为integer类型,取值范围0-10。数值越大,优先级越高。
> **说明:**
> 仅支持系统应用配置,三方应用配置不生效。 | 数值 | 该标签可缺省,缺省值为0。 | +| priority | 标识当前UIAbility组件的优先级。[隐式查询](../application-models/explicit-implicit-want-mappings.md)时,优先级越高,UIAbility在返回列表越靠前。该标签取值为integer类型,取值范围0-10。数值越大,优先级越高。
**说明:**
仅支持系统应用配置,三方应用配置不生效。 | 数值 | 该标签可缺省,缺省值为0。 | | maxWindowRatio | 标识当前UIAbility组件支持的最大的宽高比。该标签最小取值为0。 | 数值 | 该标签可缺省,缺省值为平台支持的最大的宽高比。 | | minWindowRatio | 标识当前UIAbility组件支持的最小的宽高比。该标签最小取值为0。 | 数值 | 该标签可缺省,缺省值为平台支持的最小的宽高比。 | | maxWindowWidth | 标识当前UIAbility组件支持的最大的窗口宽度,宽度单位为vp。该标签最小取值为0,但不能小于minWindowWidth;最大取值不能超过平台支持的最大窗口宽度。窗口尺寸可以参考:[约束与限制](../windowmanager/window-overview.md#约束与限制)。 | 数值 | 该标签可缺省,缺省值为平台支持的最大的窗口宽度。 | | minWindowWidth | 标识当前UIAbility组件支持的最小的窗口宽度, 宽度单位为vp。该标签最小取值为0,但不能小于平台支持的最小窗口宽度;最大取值不能大于maxWindowWidth。窗口尺寸可以参考:[约束与限制](../windowmanager/window-overview.md#约束与限制)。 | 数值 | 该标签可缺省,缺省值为平台支持的最小的窗口宽度。 | | maxWindowHeight | 标识当前UIAbility组件支持的最大的窗口高度, 高度单位为vp。该标签最小取值为0,但不能小于minWindowHeight;最大取值不能超过平台支持的最大窗口高度。 窗口尺寸可以参考:[约束与限制](../windowmanager/window-overview.md#约束与限制)。| 数值 | 该标签可缺省,缺省值为平台支持的最大的窗口高度。 | | minWindowHeight | 标识当前UIAbility组件支持的最小的窗口高度, 高度单位为vp。该标签最小取值为0,但不能小于平台支持的最小窗口高度;最大取值不能大于maxWindowHeight。窗口尺寸可以参考:[约束与限制](../windowmanager/window-overview.md#约束与限制)。| 数值 | 该标签可缺省,缺省值为平台支持的最小的窗口高度。 | -| excludeFromMissions | 标识当前UIAbility组件是否在最近任务列表中显示。
- true:表示不在任务列表中显示。
- false:表示在任务列表中显示。
> **说明:**
> 仅支持系统应用配置,三方应用配置不生效。 | 布尔值 | 该标签可缺省,缺省值为false。 | +| excludeFromMissions | 标识当前UIAbility组件是否在最近任务列表中显示。
- true:表示不在任务列表中显示。
- false:表示在任务列表中显示。
**说明:**
仅支持系统应用配置,三方应用配置不生效。 | 布尔值 | 该标签可缺省,缺省值为false。 | | recoverable | 标识当前是否支持在检测到应用故障后,恢复到应用原界面。
- true:支持检测到出现故障后,恢复到原界面。
- false:不支持检测到出现故障后,恢复到原界面。 | 布尔值 | 该标签可缺省,缺省值为false。 | abilities示例: @@ -343,7 +368,7 @@ abilities示例: 该标签标识UIAbility组件或者ExtensionAbility组件能够接收的[Want](../application-models/want-overview.md)的特征。 - **表5** **skills标签说明** + **表7** **skills标签说明** | 属性名称 | 含义 | 数据类型 | 是否可缺省 | | -------- | -------- | -------- | -------- | @@ -351,7 +376,7 @@ abilities示例: | entities | 标识能够接收Want的[Entity值的集合](../application-models/actions-entities.md)。 | 字符串数组 | 可缺省,缺省值为空。 | |uris | 标识与Want中URI(Uniform Resource Identifier)相匹配的集合。 | 对象数组 | 可缺省,缺省值为空。 | - **表6** **uris对象内部结构说明** + **表8** **uris对象内部结构说明** | 属性名称 | 含义 | 数据类型 | 是否可缺省 | | -------- | -------- | -------- | -------- | @@ -392,44 +417,11 @@ skills示例: } ``` -**增强隐式查询功能** - -支持Uri级别的前缀匹配。 -当配置文件只配置scheme,或者只配置scheme和host,或者只配置scheme,host和port时,参数传入以配置文件为前缀的Uri,配置成功。 - - - * 查询功能增强涉及以下接口
- [@ohos.bundle.bundleManager](../reference/apis/js-apis-bundleManager.md#bundlemanagerqueryabilityinfo)
- 1. function queryAbilityInfo(want: Want, abilityFlags: number, callback: AsyncCallback>): void;
- 2. function queryAbilityInfo(want: Want, abilityFlags: number, userId: number, callback: AsyncCallback>): void;
- 3. function queryAbilityInfo(want: Want, abilityFlags: number, userId?: number): Promise>; - * 配置要求
- abilities -> skills -> uris对象
- 配置1: 只配置 scheme = 'http'
- 配置2: 只配置 ( scheme = 'http' ) + ( host = 'example.com' )
- 配置3: 只配置 ( scheme = 'http' ) + ( host = 'example.com' ) + ( port = '8080' ) - * 前缀匹配
- 参数[want](../application-models/want-overview.md)下uri,调用queryAbilityInfo查询接口
- 1. uri = 'https://' 无匹配
- 2. uri = 'http://' 可以匹配 配置1
- 3. uri = 'https://example.com' 无匹配
- 4. uri = 'https://exa.com' 无匹配
- 5. uri = 'http://exa.com' 可以匹配 配置1
- 6. uri = 'http://example.com' 可以匹配 配置1 配置2
- 7. uri = 'https://example.com:8080' 无匹配
- 8. uri = 'http://exampleaa.com:8080' 可以匹配 配置1
- 9. uri = 'http://example.com:9180' 可以匹配 配置1 配置2
- 10. uri = 'http://example.com:8080' 可以匹配 配置1 配置2 配置3
- 11. uri = 'https://example.com:9180/path' 无匹配
- 12. uri = 'http://exampleap.com:8080/path' 可以匹配 配置1
- 13. uri = 'http://example.com:9180/path' 可以匹配 配置1 配置2
- 14. uri = 'http://example.com:8080/path' 可以匹配 配置1 配置2 配置3
- ## extensionAbilities标签 描述extensionAbilities的配置信息,标签值为数组类型,该标签下的配置只对当前extensionAbilities生效。 - **表7** **extensionAbilities标签说明** + **表9** **extensionAbilities标签说明** | 属性名称 | 含义 | 数据类型 | 是否可缺省 | | -------- | -------- | -------- | -------- | @@ -437,11 +429,11 @@ skills示例: | srcEntry | 标识当前ExtensionAbility组件所对应的代码路径,标签值最大长度为127字节。 | 字符串 | 该标签不可缺省。 | | description | 标识当前ExtensionAbility组件的描述,标签值最大长度为255字节,标签也可以是描述内容的资源索引,用于支持多语言。 | 字符串 | 该标签可缺省,缺省值为空。 | | icon | 标识当前ExtensionAbility组件的图标,标签值为资源文件的索引。如果ExtensionAbility组件被配置为MainElement,该标签必须配置。 | 字符串 | 该标签可缺省,缺省值为空。 | -| label | 标识当前ExtensionAbility组件对用户显示的名称,标签值配置为该名称的资源索引以支持多语言。
> **说明:**
> 如果ExtensionAbility被配置当前Module的mainElement时,该标签必须配置,且应用内唯一。 | 字符串 | 该标签不可缺省。 | -| type | 标识当前ExtensionAbility组件的类型,取值为:
- form:卡片的ExtensionAbility。
- workScheduler:延时任务的ExtensionAbility。
- inputMethod:输入法的ExtensionAbility。
- service:后台运行的service组件。
- accessibility:辅助能力的ExtensionAbility。
- dataShare:数据共享的ExtensionAbility。
- fileShare:文件共享的ExtensionAbility。
- staticSubscriber:静态广播的ExtensionAbility。
- wallpaper:壁纸的ExtensionAbility。
- backup:数据备份的ExtensionAbility。
- window:该ExtensionAbility会在启动过程中创建一个window,为开发者提供界面开发。开发者开发出来的界面将通过abilityComponent控件组合到其他应用的窗口中。
- thumbnail:获取文件缩略图的ExtensionAbility,开发者可以对自定义文件类型的文件提供缩略。
- preview:该ExtensionAbility会将文件解析后在一个窗口中显示,开发者可以通过将此窗口组合到其他应用窗口中。
- print:打印框架的ExtensionAbility。
> **说明:**
> 其中service和dataShare类型,仅支持系统应用配置,三方应用配置不生效。 | 字符串 | 该标签不可缺省。 | +| label | 标识当前ExtensionAbility组件对用户显示的名称,标签值配置为该名称的资源索引以支持多语言。
**说明:**
如果ExtensionAbility被配置当前Module的mainElement时,该标签必须配置,且应用内唯一。 | 字符串 | 该标签不可缺省。 | +| type | 标识当前ExtensionAbility组件的类型,取值为:
- form:卡片的ExtensionAbility。
- workScheduler:延时任务的ExtensionAbility。
- inputMethod:输入法的ExtensionAbility。
- service:后台运行的service组件。
- accessibility:辅助能力的ExtensionAbility。
- dataShare:数据共享的ExtensionAbility。
- fileShare:文件共享的ExtensionAbility。
- staticSubscriber:静态广播的ExtensionAbility。
- wallpaper:壁纸的ExtensionAbility。
- backup:数据备份的ExtensionAbility。
- window:该ExtensionAbility会在启动过程中创建一个window,为开发者提供界面开发。开发者开发出来的界面将通过abilityComponent控件组合到其他应用的窗口中。
- thumbnail:获取文件缩略图的ExtensionAbility,开发者可以对自定义文件类型的文件提供缩略。
- preview:该ExtensionAbility会将文件解析后在一个窗口中显示,开发者可以通过将此窗口组合到其他应用窗口中。
- print:打印框架的ExtensionAbility。
- driver:驱动框架的ExtensionAbility。
**说明:**
其中service和dataShare类型,仅支持系统应用配置,三方应用配置不生效。 | 字符串 | 该标签不可缺省。 | | permissions | 标识当前ExtensionAbility组件自定义的权限信息。当其他应用访问该ExtensionAbility时,需要申请相应的权限信息。
一个数组元素为一个权限名称。通常采用反向域名格式(最大255字节),可以是系统预定义的权限,也可以是该应用自定义的权限。如果是后者,需与defPermissions标签中定义的某个权限的name标签值一致。 | 字符串数组 | 该标签可缺省,缺省值为空。 | -| uri | 标识当前ExtensionAbility组件提供的数据URI,为字符数组类型(最大长度255),用反向域名的格式表示。
> **说明:**
> 该标签在type为dataShare类型的ExtensionAbility时,不可缺省。 | 字符串 | 该标签可缺省,缺省值为空。 | -|skills | 标识当前ExtensionAbility组件能够接收的[Want](../application-models/want-overview.md)的特征集,为数组格式。
配置规则:entry包可以配置多个具有入口能力的skills标签(配置了ohos.want.action.home和entity.system.home)的ExtensionAbility,其中第一个配置了skills标签的ExtensionAbility中的label和icon作为OpenHarmony服务或应用的label和icon。
> **说明:**
> OpenHarmony服务的Feature包不能配置具有入口能力的skills标签。
> OpenHarmony应用的Feature包可以配置具有入口能力的skills标签。 | 数组 | 该标签可缺省,缺省值为空。 | +| uri | 标识当前ExtensionAbility组件提供的数据URI,为字符数组类型(最大长度255),用反向域名的格式表示。
**说明:**
该标签在type为dataShare类型的ExtensionAbility时,不可缺省。 | 字符串 | 该标签可缺省,缺省值为空。 | +|skills | 标识当前ExtensionAbility组件能够接收的[Want](../application-models/want-overview.md)的特征集,为数组格式。
配置规则:entry包可以配置多个具有入口能力的skills标签(配置了ohos.want.action.home和entity.system.home)的ExtensionAbility,其中第一个配置了skills标签的ExtensionAbility中的label和icon作为OpenHarmony服务或应用的label和icon。
**说明:**
OpenHarmony服务的Feature包不能配置具有入口能力的skills标签。
OpenHarmony应用的Feature包可以配置具有入口能力的skills标签。 | 数组 | 该标签可缺省,缺省值为空。 | | [metadata](#metadata标签) | 标识当前ExtensionAbility组件的元信息。 | 对象 | 该标签可缺省,缺省值为空。 | | exported | 标识当前ExtensionAbility组件是否可以被其他应用调用,为布尔类型。
- true:表示可以被其他应用调用。
- false:表示不可以被其他应用调用。 | 布尔值 | 该标签可缺省,缺省值为false。 | @@ -457,7 +449,7 @@ extensionAbilities示例: "icon": "$media:icon", "label" : "$string:extension_name", "description": "$string:form_description", - "type": "form", + "type": "form", "permissions": ["ohos.abilitydemo.permission.PROVIDER"], "readPermission": "", "writePermission": "", @@ -471,7 +463,7 @@ extensionAbilities示例: "metadata": [ { "name": "ohos.extension.form", - "resource": "$profile:form_config", + "resource": "$profile:form_config", } ] } @@ -486,15 +478,16 @@ extensionAbilities示例: > **说明:** > -> 在requestPermissions标签中配置的权限项将在应用级别生效,即该权限适用于整个应用程序。 +> - 在requestPermissions标签中配置的权限项将在应用级别生效,即该权限适用于整个应用程序。 +> - 如果应用需要订阅自己发布的事件,而且应用在extensionAbilities标签中的permissions字段中设置了访问该应用所需要的权限,那么应用也需要在requestPermissions标签中注册相关权限才能收到该事件。 -**表8** **requestPermissions标签说明** +**表10** **requestPermissions标签说明** | 属性 | 含义 | 类型 | 取值范围 | 默认值 | | -------- | -------- | -------- | -------- | -------- | | name | 必须,填写需要使用的权限名称。 | 字符串 | 自定义。 | 无。 | -| reason | 可选,当申请的权限为user_grant权限时此字段必填,用于描述申请权限的原因。
> **说明:**
> 当申请的权限为user_grant权限时,如果未填写该字段则不允许在应用市场上架,并且需要进行多语种适配。 | 字符串 | 使用string类资源引用。格式为$string: \*\*\*。 | 空。 | -| usedScene | 可选,当申请的权限为user_grant权限时此字段必填。描述权限使用的场景由abilities和when组成。其中abilities可以配置为多个UIAbility组件,when表示调用时机。
> **说明:**
> 默认为可选,当申请的权限为user_grant权限时,abilities标签必填,when标签可选。 | abilities:UIAbility或者ExtensionAbility名称的字符串数组
when:字符串 | abilities:UIAbility或者ExtensionAbility组件的名称。
when:inuse(使用时)、always(始终)。 | abilities:空。
when:空。 | +| reason | 可选,当申请的权限为user_grant权限时此字段必填,用于描述申请权限的原因。
**说明:**
当申请的权限为user_grant权限时,如果未填写该字段则不允许在应用市场上架,并且需要进行多语种适配。 | 字符串 | 使用string类资源引用。格式为$string: \*\*\*。 | 空。 | +| usedScene | 可选,当申请的权限为user_grant权限时此字段必填。描述权限使用的场景由abilities和when组成。其中abilities可以配置为多个UIAbility组件,when表示调用时机。
**说明:**
默认为可选,当申请的权限为user_grant权限时,abilities标签必填,when标签可选。 | abilities:UIAbility或者ExtensionAbility名称的字符串数组
when:字符串 | abilities:UIAbility或者ExtensionAbility组件的名称。
when:inuse(使用时)、always(始终)。 | abilities:空。
when:空。 | requestPermissions示例: @@ -528,7 +521,9 @@ metadata中指定shortcut信息,其中: - name:指定shortcuts的名称。使用ohos.ability.shortcuts作为shortcuts信息的标识。 - resource:指定shortcuts信息的资源位置。 - + +**表11** **shortcuts标签说明** + | 属性 | 含义 | 类型 | 默认值 | | -------- | -------- | -------- | -------- | | shortcutId | 标识快捷方式的ID。字符串的最大长度为63字节。 | 字符串 | 该标签不可缺省。 | @@ -538,7 +533,7 @@ metadata中指定shortcut信息,其中: 1. 在/resource/base/profile/目录下配置shortcuts_config.json配置文件。 - + ```json { "shortcuts": [ @@ -558,7 +553,7 @@ metadata中指定shortcut信息,其中: ``` 2. 在module.json5配置文件的abilities标签中,针对需要添加快捷方式的UIAbility进行配置metadata标签,使shortcut配置文件对该UIAbility生效。 - + ```json { "module": { @@ -595,7 +590,7 @@ metadata中指定shortcut信息,其中: 该标签下的子标签均为可选字段,在应用市场云端分发时做精准匹配使用,distributionFilter标签用于定义HAP对应的细分设备规格的分发策略,以便在应用市场进行云端分发应用包时做精准匹配。该标签可配置的分发策略维度包括API Version、屏幕形状、屏幕尺寸、屏幕分辨率,设备的国家与地区码。在进行分发时,通过deviceType与这五个属性的匹配关系,唯一确定一个用于分发到设备的HAP。该标签需要配置在/resource/profile资源目录下。 - **表9** **distributionFilter标签标签配置说明** + **表12** **distributionFilter标签标签配置说明** | 属性名称 | 含义 | 数据类型 | 是否可缺省 | | -------- | -------- | -------- | -------- | @@ -605,28 +600,28 @@ metadata中指定shortcut信息,其中: | countryCode | 表示应用需要分发的国家地区码,具体值以ISO-3166-1标准为准。支持多个国家和地区枚举定义。 | 对象数组 | 该标签可缺省,缺省值为空。 | - **表10** **screenShape对象的内部结构** + **表13** **screenShape对象的内部结构** | 属性名称 | 含义 | 数据类型 | 是否可缺省 | | -------- | -------- | -------- | -------- | | policy | 标识该子属性取值规则。配置为“exclude”或“include”。
- exclude:表示需要排除的value属性。
- include:表示需要包含的value属性。 | 字符串 | 该标签不可缺省。 | | value | 支持的取值为circle(圆形)、rect(矩形)。场景示例:针对智能穿戴设备,可为圆形表盘和矩形表盘分别提供不同的HAP。 | 字符串数组 | 该标签不可缺省。 | - **表11** **screenWindow对象的内部结构说明** + **表14** **screenWindow对象的内部结构说明** | 属性名称 | 含义 | 数据类型 | 是否可缺省 | | -------- | -------- | -------- | -------- | | policy | 标识该子属性取值规则。配置为“exclude”或“include”。
- exclude:表示该字段取值不包含value枚举值匹配规则的匹配该属性。
- include:表示该字段取值满足value枚举值匹配规则的匹配该属性。 | 字符串 | 该标签不可缺省。 | | value | 单个字符串的取值格式为“宽 \* 高”,取值为整数像素值,例如“454 \* 454”。 | 字符串数组 | 该标签不可缺省。 | - **表12** **screenDensity对象的内部结构说明** + **表15** **screenDensity对象的内部结构说明** | 属性名称 | 含义 | 数据类型 | 是否可缺省 | | -------- | -------- | -------- | -------- | | policy | 标识该子属性取值规则。配置为“exclude”或“include”。
- exclude:表示需要排除的value属性。
- include:表示需要包含的value属性。 | 字符串 | 该标签不可缺省。 | | value | 该标签标识屏幕的像素密度(dpi :Dot Per Inch)。 | 字符串数组 | 该标签不可缺省。 | - **表13** **countryCode对象的内部结构说明** + **表16** **countryCode对象的内部结构说明** | 属性名称 | 含义 | 数据类型 | 是否可缺省 | | -------- | -------- | -------- | -------- | @@ -693,7 +688,7 @@ metadata中指定shortcut信息,其中: 此标签用于支持对测试框架的配置。 -**表14** **testRunner标签说明** +**表17** **testRunner标签说明** | 属性名称 | 含义 | 数据类型 | 是否可缺省 | | -------- | -------- | -------- | -------- | @@ -714,3 +709,84 @@ testRunner标签示例: } } ``` + +## atomicService标签 + +此标签用于支持对原子化服务的配置。此标签仅在app.json中bundleType指定为atomicService时使能。 + +**表18** **atomicService标签说明** + +| 属性名称 | 含义 | 数据类型 | 是否可缺省 | +| -------- | -------- | -------- | -------- | +| preloads | 标识原子化服务中预加载列表 | 对象数组 | 可缺省,缺省值为空。 | + +atomicService标签示例: + + +```json +{ + "module": { + "atomicService": { + "preloads":[ + { + "moduleName":"feature" + } + ] + } + } +} +``` + +## preloads标签 + +此标签标识原子化服务中预加载列表。 + +**表19** **preloads标签说明** + +| 属性名称 | 含义 | 数据类型 | 是否可缺省 | +| -------- | -------- | -------- | -------- | +| moduleName | 标识原子化服务中,当前模块被加载时,需预加载的模块名 | 字符串 | 不可缺省。 | + +preloads标签示例: + +```json +{ + "module": { + "atomicService": { + "preloads":[ + { + "moduleName":"feature" + } + ] + } + } +} +``` + +## dependencies标签 + +此标签标识模块运行时依赖的共享库列表。 + +**表20** **dependencies标签说明** + +| 属性名称 | 含义 | 数据类型 | 是否可缺省 | +| ----------- | ------------------------------ | -------- | ---------- | +| bundleName | 标识当前模块依赖的共享包包名。 | 字符串 | 可缺省。 | +| moduleName | 标识当前模块依赖的共享包模块名。| 字符串 | 不可缺省。 | +| versionCode | 标识当前共享包的版本号。 | 数值 | 可缺省。 | + +dependencies标签示例: + +```json +{ + "module": { + "dependencies": [ + { + "bundleName":"com.share.library", + "moduleName": "library", + "versionCode": 10001 + } + ] + } +} +``` \ No newline at end of file diff --git a/zh-cn/application-dev/quick-start/module-structure.md b/zh-cn/application-dev/quick-start/module-structure.md index 5da4b2204179728ef1ddfd900fcaf75066256d98..d859c9c54f5fd7fe1557dba0053b361b3c90b076 100644 --- a/zh-cn/application-dev/quick-start/module-structure.md +++ b/zh-cn/application-dev/quick-start/module-structure.md @@ -20,7 +20,7 @@ module对象包含HAP的配置信息。 | shortcuts | 标识应用的快捷方式信息。采用对象数组格式,其中的每个元素表示一个快捷方式对象。 | 对象数组 | 可缺省,缺省值为空。 | | reqPermissions | 标识应用运行时向系统申请的权限。 | 对象数组 | 可缺省,缺省值为空。 | | colorMode | 标识应用自身的颜色模式,目前支持如下三种模式:
- dark:表示按照深色模式选取资源。
- light:表示按照浅色模式选取资源。
- auto:表示跟随系统的颜色模式值选取资源。 | 字符串 | 可缺省,缺省值为"auto"。 | -| distroFilter | 标识应用的分发规则。该标签用于定义HAP对应的细分设备规格的分发策略,以便在应用市场进行云端分发应用包时做精准匹配。该标签可配置的分发策略维度包括API Version、屏幕形状、屏幕分辨率。在进行分发时,通过deviceType与这三个属性的匹配关系,唯一确定一个用于分发到设备的HAP。 | 对象 | 可缺省,缺省值为空。但当应用中包含多个entry模块时,必须配置该标签。 | +| distributionFilter | 标识应用的分发规则。该标签用于定义HAP对应的细分设备规格的分发策略,以便在应用市场进行云端分发应用包时做精准匹配。该标签可配置的分发策略维度包括API Version、屏幕形状、屏幕分辨率。在进行分发时,通过deviceType与这三个属性的匹配关系,唯一确定一个用于分发到设备的HAP。 | 对象 | 可缺省,缺省值为空。但当应用中包含多个entry模块时,必须配置该标签。 | |commonEvents | 定义了公共事件静态订阅者的信息,该字段中需要声明静态订阅者的名称、权限要求及订阅事件列表信息,当订阅的公共事件发送时,该公共事件静态订阅者将被拉起。这里的静态订阅者区分于常用的动态订阅者,前者无需在业务代码中主动调用订阅事件的接口,在公共事件发布时可能未被拉起,而动态订阅者则在业务代码中主动调用公共事件订阅的相关API,因此需要应用处于活动状态。 | 对象数组 | 可缺省,缺省为空。 | | entryTheme | 此标签标识OpenHarmony内部主题的关键字。将标记值设置为名称的资源索引。 | 字符串 | 可缺省,缺省值为空。 | |testRunner | 此标签用于支持对测试框架的配置。 | 对象 | 可缺省,缺省值为空。 | @@ -190,14 +190,15 @@ metadata对象示例: ## abilities对象的内部结构 -**OpenHarmony中不允许应用隐藏启动图标** +**OpenHarmony中不允许应用隐藏入口图标** -OpenHarmony系统对无图标应用严格管控。如果HAP中没有配置启动图标,那么系统会给该应用创建一个默认的图标显示在桌面上;
-用户点击该图标,将跳转到Settings的应用管理中对应的应用详情页面中。
-如果应用想要隐藏启动图标,需要配置AllowAppDesktopIconHide应用特权,具体配置方式参考[应用特权配置指南](../../device-dev/subsystems/subsys-app-privilege-config-guide.md)。 +OpenHarmony系统对无图标应用严格管控。如果HAP中没有配置入口图标,那么系统会给该应用创建一个默认的图标显示在桌面上;
+用户点击该图标,将跳转到Settings的应用管理中对应的应用详情页面(图1)中。
+如果应用想要隐藏入口图标,需要配置AllowAppDesktopIconHide应用特权,具体配置方式参考[应用特权配置指南](../../device-dev/subsystems/subsys-app-privilege-config-guide.md)。 +**场景说明:** 该功能能防止一些恶意应用,故意配置无入口图标,导致用户找不到软件所在的位置,无法操作卸载应用,在一定程度上保证用户的手机安全 -**启动图标的设置:** 需要在配置文件(config.json)中abilities配置下设置icon,label以及skills,而且skills的配置下必须同时包含“ohos.want.action.home” 和 “entity.system.home”: +**入口图标的设置:** 需要在配置文件(config.json)中abilities配置下设置icon,label以及skills,而且skills的配置下必须同时包含“ohos.want.action.home” 和 “entity.system.home”: ``` { "module":{ @@ -220,34 +221,36 @@ OpenHarmony系统对无图标应用严格管控。如果HAP中没有配置启动 } ``` -**启动图标的查询** -* HAP中包含Page类型的Ability - * 配置文件(config.json)中abilities配置中设置了启动图标 +**入口图标及入口标签的显示规则** +* HAP中包含Page类型的PageAbility + * 配置文件(config.json)中abilities配置中设置了入口图标 * 该应用没有隐藏图标的特权 - * 返回的桌面图标为该Ability配置的图标 - * 返回的桌面Label为该Ability配置的Label(如果没有配置Label,返回包名) - * 返回的组件名为该Ability的组件名 - * 用户点击该桌面图标,页面跳转到该Ability首页 + * 显示桌面图标为该PageAbility配置的图标 + * 显示桌面Label为该PageAbility配置的Label(如果没有配置Label,返回包名) + * 显示组件名为该PageAbility的组件名 + * 用户点击该桌面图标,页面跳转到该PageAbility首页 * 该应用具有隐藏图标的特权 * 桌面查询时不返回应用信息,不会在桌面上显示对应的图标。 - * 配置文件(config.json)中abilities配置中未设置启动图标 + * 配置文件(config.json)中abilities配置中未设置入口图标 * 该应用没有隐藏图标的特权 - * 返回的桌面图标为系统默认图标 - * 返回的桌面Label为该应用的包名 - * 返回的组件名为应用详情页面的组件名(该组件为系统内置) - * 用户点击该桌面图标,页面跳转到该应用的详情页面 + * 显示桌面图标为系统默认图标 + * 显示桌面Label为该应用的包名 + * 用户点击该桌面图标,页面跳转到该应用的详情页面(图1) * 该应用具有隐藏图标的特权 * 桌面查询时不返回应用信息,不会在桌面上显示对应的图标。 -* HAP中不包含Page类型的Ability +* HAP中不包含Page类型的PageAbility * 该应用没有隐藏图标的特权 - * 返回的桌面图标为系统默认图标 - * 返回的桌面Label为该应用的包名 - * 返回的组件名为应用详情页面的组件名(该组件为系统内置) - * 用户点击该桌面图标,页面跳转到该应用的详情页面 + * 显示桌面图标为系统默认图标 + * 显示桌面Label为该应用的包名 + * 用户点击该桌面图标,页面跳转到该应用的详情页面(图1) * 该应用具有隐藏图标的特权 * 桌面查询时不返回应用信息,不会在桌面上显示对应的图标。 -注:应用详情页面中显示的图标与label,可能与桌面上显示的不同。如果非Page类型的ability配置了入口图标和label,那么详情页中显示的即为配置的。

+注:应用详情页面(图1)中显示的label可能与桌面上显示的不同。如果非Page类型的PageAbility配置了入口图标和label,那么详情页中显示的即为配置的。

+ +图1 + +![应用的详情页例图](figures/application_details.jpg) **表8** **abilities对象的内部结构说明** @@ -411,40 +414,6 @@ skills示例: ] ``` -**增强隐式查询功能** - -支持Uri级别的前缀匹配。 -当配置文件只配置scheme,或者只配置scheme和host,或者只配置scheme,host和port时,参数传入以配置文件为前缀的Uri,配置成功。 - - * 查询功能增强涉及以下接口
- [@ohos.bundle.bundleManager](../reference/apis/js-apis-bundleManager.md#bundlemanagerqueryabilityinfo)
- 1. function queryAbilityInfo(want: Want, abilityFlags: number, callback: AsyncCallback>): void;
- 2. function queryAbilityInfo(want: Want, abilityFlags: number, userId: number, callback: AsyncCallback>): void;
- 3. function queryAbilityInfo(want: Want, abilityFlags: number, userId?: number): Promise>; - * 配置要求
- abilities -> skills -> uris对象
- 配置1: 只配置 scheme = 'http'
- 配置2: 只配置 ( scheme = 'http' ) + ( host = 'www.example.com' )
- 配置3: 只配置 ( scheme = 'http' ) + ( host = 'www.example.com' ) + ( port = '8080' ) - * 前缀匹配
- [want](../application-models/want-overview.md)下uri,调用queryAbilityInfo查询接口
- 1. uri = 'https://' 无匹配
- 2. uri = 'http://' 可以匹配 配置1
- 3. uri = 'https://www.example.com' 无匹配
- 4. uri = 'https://www.exa.com' 无匹配
- 5. uri = 'http://www.exa.com' 可以匹配 配置1
- 6. uri = 'http://www.example.com' 可以匹配 配置1 配置2
- 7. uri = 'https://www.example.com:8080' 无匹配
- 8. uri = 'http://www.exampleaa.com:8080' 可以匹配 配置1
- 9. uri = 'http://www.example.com:9180' 可以匹配 配置1 配置2
- 10. uri = 'http://www.example.com:8080' 可以匹配 配置1 配置2 配置3
- 11. uri = 'https://www.example.com:9180/query/student/name' 无匹配
- 12. uri = 'http://www.exampleap.com:8080/query/student/name' 可以匹配 配置1
- 13. uri = 'http://www.example.com:9180/query/student/name' 可以匹配 配置1 配置2
- 14. uri = 'http://www.example.com:8080/query/student/name' 可以匹配 配置1 配置2 配置3
- - - ## reqPermissions权限申请 **表12** **reqPermissions权限申请字段说明** @@ -638,9 +607,9 @@ forms示例: ] ``` -## distroFilter对象的内部结构 +## distributionFilter对象的内部结构 -**表21** **distroFilter对象的内部结构说明** +**表21** **distributionFilter对象的内部结构说明** | 属性名称 | 含义 | 数据类型 | 是否可缺省 | | -------- | -------- | -------- | -------- | @@ -696,10 +665,10 @@ forms示例: | value | 该标签标识应用需要分发的国家码,标签为字符串数组,子串表示支持的国家或地区,由两个大写字母表示。 | 字符串数组 | 不可缺省。 | -distroFilter示例: +distributionFilter示例: ```json -"distroFilter": { +"distributionFilter": { "apiVersion": { "policy": "include", "value": [4,5] diff --git a/zh-cn/application-dev/quick-start/resource-categories-and-access.md b/zh-cn/application-dev/quick-start/resource-categories-and-access.md index 9e2bc724ec9d9234f7eeebc760a5e4196b7c2b92..4f9418e7fa640aad9d93ae569835ba458e191133 100644 --- a/zh-cn/application-dev/quick-start/resource-categories-and-access.md +++ b/zh-cn/application-dev/quick-start/resource-categories-and-access.md @@ -8,8 +8,6 @@ ## 资源分类 -### resources目录 - 应用开发中使用的各类资源文件,需要放入特定子目录中存储管理。resources目录包括三大类目录,一类为base目录,一类为限定词目录,还有一类为rawfile目录。stage模型多工程情况下共有的资源文件放到AppScope下的resources目录。 base目录默认存在,而限定词目录需要开发者自行创建。应用使用某资源时,系统会根据当前设备状态优先从相匹配的限定词目录中寻找该资源。只有当resources目录中没有与设备状态匹配的限定词目录,或者在限定词目录中找不到该资源时,才会去base目录中查找。rawfile是原始文件目录,不会根据设备状态去匹配不同的资源。 @@ -18,24 +16,42 @@ base目录默认存在,而限定词目录需要开发者自行创建。应用 ``` resources -|---base // 默认存在的目录 +|---base +| |---element +| | |---string.json +| |---media +| | |---icon.png +| |---profile +| | |---test_profile.json +|---en_US // 默认存在的目录,设备语言环境是美式英文时,优先匹配此目录下资源 +| |---element +| | |---string.json +| |---media +| | |---icon.png +| |---profile +| | |---test_profile.json +|---zh_CN // 默认存在的目录,设备语言环境是简体中文时,优先匹配此目录下资源 | |---element | | |---string.json | |---media | | |---icon.png -|---en_GB-vertical-car-mdpi // 限定词目录示例,需要开发者自行创建 +| |---profile +| | |---test_profile.json +|---en_GB-vertical-car-mdpi // 自定义多限定词目录示例,由开发者创建 | |---element | | |---string.json | |---media | | |---icon.png -|---rawfile +| |---profile +| | |---test_profile.json +|---rawfile // 其他类型文件,原始文件形式保存,不会被集成到resources.index文件中。文件名可自定义。 ``` **表1** resources目录分类 | 分类 | base目录 | 限定词目录 | rawfile目录 | | ---- | ---------------------------------------- | ---------------------------------------- | ---------------------------------------- | -| 组织形式 | base目录是默认存在的目录。当应用的resources目录中没有与设备状态匹配的限定词目录时,会自动引用该目录中的资源文件。
base目录的二级子目录为**资源组目录**,用于存放字符串、颜色、布尔值等基础元素,以及媒体、动画、布局等资源文件,具体要求参见[资源组目录](#资源组目录)。 | 限定词目录需要开发者自行创建。目录名称由一个或多个表征应用场景或设备特征的限定词组合而成,具体要求参见[限定词目录](#限定词目录)。
限定词目录的二级子目录为**资源组目录**,用于存放字符串、颜色、布尔值等基础元素,以及媒体、动画、布局等资源文件,具体要求参见[资源组目录](#资源组目录)。 | 支持创建多层子目录,目录名称可以自定义,文件夹内可以自由放置各类资源文件。
rawfile目录的文件不会根据设备状态去匹配不同的资源。 | +| 组织形式 | base目录是默认存在的目录。当应用的resources目录中没有与设备状态匹配的限定词目录时,会自动引用该目录中的资源文件。
base目录的二级子目录为**资源组目录**,用于存放字符串、颜色、布尔值等基础元素,以及媒体、动画、布局等资源文件,具体要求参见[资源组目录](#资源组目录)。 | en_US和zh_CN是默认存在的两个限定词目录,其余限定词目录需要开发者自行创建。目录名称由一个或多个表征应用场景或设备特征的限定词组合而成,具体要求参见[限定词目录](#限定词目录)。
限定词目录的二级子目录为**资源组目录**,用于存放字符串、颜色、布尔值等基础元素,以及媒体、动画、布局等资源文件,具体要求参见[资源组目录](#资源组目录)。 | 支持创建多层子目录,目录名称可以自定义,文件夹内可以自由放置各类资源文件。
rawfile目录的文件不会根据设备状态去匹配不同的资源。 | | 编译方式 | 目录中的资源文件会被编译成二进制文件,并赋予资源文件ID。 | 目录中的资源文件会被编译成二进制文件,并赋予资源文件ID。 | 目录中的资源文件会被直接打包进应用,不经过编译,也不会被赋予资源文件ID。 | | 引用方式 | 通过指定资源类型(type)和资源名称(name)来引用。 | 通过指定资源类型(type)和资源名称(name)来引用。 | 通过指定文件路径和文件名来引用。 | @@ -84,7 +100,6 @@ base目录与限定词目录下面可以创建资源组目录(包括element、 | 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 | 表示自定义配置文件,其文件内容可[通过包管理接口](../reference/apis/js-apis-bundleManager.md#bundlemanagergetprofilebyability)获取(目录下只支持文件类型)。 | 文件名可自定义,例如:test_profile.json。 | -| rawfile | 表示其他类型文件,在应用构建为hap包后,以原始文件形式保存,不会被集成到resources.index文件中。 | 文件名可自定义。 | **媒体资源类型说明** diff --git a/zh-cn/application-dev/quick-start/shared-guide.md b/zh-cn/application-dev/quick-start/shared-guide.md new file mode 100644 index 0000000000000000000000000000000000000000..a90453ac7072e643d78e8f98c229ce0c0848e17f --- /dev/null +++ b/zh-cn/application-dev/quick-start/shared-guide.md @@ -0,0 +1,19 @@ +# 共享包概述 + +OpenHarmony提供了两种共享包,[HAR(Harmony Achive)](har-package.md)静态共享包,和HSP(Harmony Shared Package)动态共享包。 + +HAR与HSP都是为了实现代码和资源的共享,都可以包含代码、C++库、资源和配置文件,最大的不同之处在于:HAR中的代码和资源跟随使用方编译,如果有多个使用方,它们的编译产物中会存在多份相同拷贝;而HSP中的代码和资源可以独立编译,运行时在一个进程中代码也只会存在一份。 + +**图1** `HAR`和`HSP`在`APP`包中的形态示意图 +![in-app-hsp-har](figures/in-app-hsp-har.png) + +**HSP旨在解决HAR存在的几个问题:** +- 多个`HAP`引用相同的`HAR`,导致的`APP`包大小膨胀问题。 +- 多个`HAP`引用相同的`HAR`,`HAR`中的一些状态变量无法共享的问题。 + +**HSP的一些约束:** +- `HSP`及其使用方都必须是`Stage`模型。 +- `HSP`及其使用方都必须使用`esmodule`编译模式。 +- `HSP`不支持在配置文件中声明`abilities`、`extensionAbilities`标签。 + +`HSP`按照使用场景可以分为[应用内HSP](in-app-hsp.md)和[应用间HSP](cross-app-hsp.md)。它们在配置文件和使用方式等方面有所区别。 \ No newline at end of file diff --git a/zh-cn/application-dev/quick-start/start-overview.md b/zh-cn/application-dev/quick-start/start-overview.md index 17cfcb5a1cff589cbddf6bffb394eb122e882b3b..d3a3528883a02dbeb91d210de97606e0109455bc 100644 --- a/zh-cn/application-dev/quick-start/start-overview.md +++ b/zh-cn/application-dev/quick-start/start-overview.md @@ -41,6 +41,6 @@ FA模型和Stage模型的整体架构和设计思想等更多区别,请见[应 1. 安装最新版[DevEco Studio](https://developer.harmonyos.com/cn/develop/deveco-studio)。 -2. 请参考[配置OpenHarmony SDK](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/ohos-setting-up-environment-0000001263160443-V3),完成**DevEco Studio**的安装和开发环境配置。 +2. 请参考[配置开发环境](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/environment_config-0000001052902427-V3),完成**DevEco Studio**的安装和开发环境配置。 完成上述操作及基本概念的理解后,可参照[使用ArkTS语言进行开发(Stage模型)](start-with-ets-stage.md)、[使用ArkTS语言开发(FA模型)](start-with-ets-fa.md)、[使用JS语言开发(FA模型)](../quick-start/start-with-js-fa.md)中的任一章节进行下一步体验和学习。 \ No newline at end of file diff --git a/zh-cn/application-dev/quick-start/start-with-ets-fa.md b/zh-cn/application-dev/quick-start/start-with-ets-fa.md index 00fdfdbd088ba060a8d86bcaf31ac03df3326c03..e04557d126081c36aced089576003df3e26b6002 100644 --- a/zh-cn/application-dev/quick-start/start-with-ets-fa.md +++ b/zh-cn/application-dev/quick-start/start-with-ets-fa.md @@ -5,28 +5,29 @@ > > 请使用**DevEco Studio V3.0.0.601 Beta1**及更高版本。 > -> 为确保运行效果,本文以使用**DevEco Studio 3.1 Beta1**版本为例,点击[此处](https://developer.harmonyos.com/cn/develop/deveco-studio)获取下载链接。 +> 为确保运行效果,本文以使用**DevEco Studio 3.1 Beta2**版本为例,点击[此处](https://developer.harmonyos.com/cn/develop/deveco-studio)获取下载链接。 ## 创建ArkTS工程 -1. 若首次打开**DevEco Studio**,请点击**Create Project**创建工程。如果已经打开了一个工程,请在菜单栏选择**File** > **New** > **Create Project**来创建一个新工程。选择**OpenHarmony**模板库,选择模板“**Empty Ability**”,点击**Next**进行下一步配置。 +1. 若首次打开**DevEco Studio**,请点击**Create Project**创建工程。如果已经打开了一个工程,请在菜单栏选择**File** > **New** > **Create Project**来创建一个新工程。选择**Application**应用开发(本文以应用开发为例,**Atomic Service**对应为原子化服务开发),选择模板“**Empty Ability**”,点击**Next**进行下一步配置。 - ![01](figures/01.png) + ![createProject](figures/createProject.png) 2. 进入配置工程界面,**Compile SDK** 选择“**8**”(**Compile SDK**选择“**9**”时注意同步选择**Model** 为“**FA**”,此处以选择“**8**”为例),**Language**选择“**ArkTS**”,其他参数保持默认设置即可。 - ![02](figures/02.png) + ![chooseFAModel_ets](figures/chooseFAModel_ets.png) > **说明:** > - > DevEco Studio V3.0 Beta3及更高版本支持使用ArkTS[低代码开发](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/ohos-ide-low-code-overview-0000001445605884-V3)方式。 + > DevEco Studio V3.0 Beta3及更高版本支持使用ArkTS[低代码开发](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/ide-low-code-overview-0000001480179573-V3)方式。 > > 低代码开发方式具有丰富的UI界面编辑功能,通过可视化界面开发方式快速构建布局,可有效降低开发者的上手成本并提升开发者构建UI界面的效率。 > > 如需使用低代码开发方式,请打开上图中的Enable Super Visual开关。 3. 点击**Finish**,工具会自动生成示例代码和相关资源,等待工程创建完成。 +4. 工程创建完成后,在**entry > build-profile.json5**文件中,将targets中的runtimeOS改为“OpenHarmony”,然后点击右上角提示框的**Sync Now**以进行OpenHarmony应用开发。 ## ArkTS工程目录结构(FA模型) @@ -34,18 +35,16 @@ ![zh-cn_image_0000001384652328](figures/zh-cn_image_0000001384652328.png) - **entry**:OpenHarmony工程模块,编译构建生成一个[HAP](../../glossary.md#hap)包。 - - **src > main > ets**:用于存放ets源码。 + - **src > main > ets**:用于存放ArkTS源码。 - **src > main > ets > MainAbility**:应用/服务的入口。 - **src > main > ets > MainAbility > pages**:MainAbility包含的页面。 - **src > main > ets > MainAbility > pages > index.ets**:pages列表中的第一个页面,即应用的首页入口。 - **src > main > ets > MainAbility > app.ets**:承载Ability生命周期。 - **src > main > resources**:用于存放应用/服务所用到的资源文件,如图形、多媒体、字符串、布局文件等。关于资源文件,详见[资源文件的分类](resource-categories-and-access.md#资源分类)。 - **src > main > config.json**:模块配置文件。主要包含HAP的配置信息、应用/服务在具体设备上的配置信息以及应用/服务的全局配置信息。具体的配置文件说明,详见[应用配置文件(FA模型)](application-configuration-file-overview-fa.md)。 - - **build-profile.json5**:当前的模块信息 、编译信息配置项,包括buildOption、targets配置等。 + - **build-profile.json5**:当前的模块信息 、编译信息配置项,包括buildOption、targets配置等。其中targets中可配置当前运行环境,默认为HarmonyOS。若需开发OpenHarmony应用,则需开发者自行修改为OpenHarmony。 - **hvigorfile.ts**:模块级编译构建任务脚本,开发者可以自定义相关任务和代码实现。 - - **build-profile.json5**:应用级配置信息,包括签名、产品配置等。 - - **hvigorfile.ts**:应用级编译构建任务脚本。 @@ -291,7 +290,7 @@ 2. 点击**File** > **Project Structure...** > **Project** > **SigningConfigs** 界面勾选“**Automatically generate signature**”,等待自动签名完成即可,点击“**OK**”。如下图所示: - ![06](figures/06.png) + ![signConfig](figures/signConfig.png) 3. 在编辑窗口右上角的工具栏,点击![zh-cn_image_0000001364054485](figures/zh-cn_image_0000001364054485.png)按钮运行。效果如下图所示: diff --git a/zh-cn/application-dev/quick-start/start-with-ets-stage.md b/zh-cn/application-dev/quick-start/start-with-ets-stage.md index f913187c82312cb47d3316d36cdf8e1a1998152d..309d69cc9868c8e29311564cf74c2a16c80eeb43 100644 --- a/zh-cn/application-dev/quick-start/start-with-ets-stage.md +++ b/zh-cn/application-dev/quick-start/start-with-ets-stage.md @@ -5,22 +5,22 @@ > > 请使用**DevEco Studio V3.0.0.900 Beta3**及更高版本。 > -> 为确保运行效果,本文以使用**DevEco Studio 3.1 Beta1**版本为例,点击[此处](https://developer.harmonyos.com/cn/develop/deveco-studio)获取下载链接。 +> 为确保运行效果,本文以使用**DevEco Studio 3.1 Beta2**版本为例,点击[此处](https://developer.harmonyos.com/cn/develop/deveco-studio)获取下载链接。 ## 创建ArkTS工程 -1. 若首次打开**DevEco Studio**,请点击**Create Project**创建工程。如果已经打开了一个工程,请在菜单栏选择**File** > **New** > **Create Project**来创建一个新工程。选择**OpenHarmony**模板库,选择模板“**Empty Ability**”,点击**Next**进行下一步配置。 +1. 若首次打开**DevEco Studio**,请点击**Create Project**创建工程。如果已经打开了一个工程,请在菜单栏选择**File** > **New** > **Create Project**来创建一个新工程。选择**Application**应用开发(本文以应用开发为例,**Atomic Service**对应为原子化服务开发),选择模板“**Empty Ability**”,点击**Next**进行下一步配置。 - ![01](figures/01.png) + ![createProject](figures/createProject.png) 2. 进入配置工程界面,**Compile SDK**选择“**9**”,**Model** 选择“**Stage**”,其他参数保持默认设置即可。 - ![07](figures/07.png) + ![chooseStageModel](figures/chooseStageModel.png) > **说明:** > - > 支持使用ArkTS[低代码开发](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/ohos-ide-low-code-overview-0000001445605884-V3)方式。 + > 支持使用ArkTS[低代码开发](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/ide-low-code-overview-0000001480179573-V3)方式。 > > 低代码开发方式具有丰富的UI界面编辑功能,通过可视化界面开发方式快速构建布局,可有效降低开发者的上手成本并提升开发者构建UI界面的效率。 > @@ -28,22 +28,24 @@ 3. 点击**Finish**,工具会自动生成示例代码和相关资源,等待工程创建完成。 +4. 工程创建完成后,在**entry > build-profile.json5**文件中,将targets中的runtimeOS改为“OpenHarmony”,然后点击右上角提示框的**Sync Now**以进行OpenHarmony应用开发。 + ## ArkTS工程目录结构(Stage模型) ![zh-cn_image_0000001364054489](figures/zh-cn_image_0000001364054489.png) +- **AppStore > app.json5**:应用的全局配置信息。 - **entry**:OpenHarmony工程模块,编译构建生成一个[HAP](../../glossary.md#hap)包。 - - **src > main > ets**:用于存放ets源码。 + - **oh_modules**:用于存放三方库依赖信息。关于原npm工程适配ohpm操作,请参考[历史工程手动迁移](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/project_overview-0000001053822398-V3#section108143331212)。 + - **src > main > ets**:用于存放ArkTS源码。 - **src > main > ets > entryability**:应用/服务的入口。 - **src > main > ets > pages**:应用/服务包含的页面。 - **src > main > resources**:用于存放应用/服务所用到的资源文件,如图形、多媒体、字符串、布局文件等。关于资源文件,详见[资源文件的分类](resource-categories-and-access.md#资源分类)。 - **src > main > module.json5**:模块配置文件。主要包含HAP的配置信息、应用/服务在具体设备上的配置信息以及应用/服务的全局配置信息。具体的配置文件说明,详见[module.json5配置文件](module-configuration-file.md)。 - - **build-profile.json5**:当前的模块信息 、编译信息配置项,包括buildOption、targets配置等。 - - **hvigorfile.ts**:模块级编译构建任务脚本,开发者可以自定义相关任务和代码实现。 - + - **build-profile.json5**:当前的模块信息 、编译信息配置项,包括buildOption、targets配置等。其中targets中可配置当前运行环境,默认为HarmonyOS。若需开发OpenHarmony应用,则需开发者自行修改为OpenHarmony。 +- **hvigorfile.ts**:模块级编译构建任务脚本,开发者可以自定义相关任务和代码实现。 - **build-profile.json5**:应用级配置信息,包括签名、产品配置等。 - - **hvigorfile.ts**:应用级编译构建任务脚本。 @@ -123,7 +125,7 @@ - 新建第二个页面文件。在“**Project**”窗口,打开“**entry > src > main > ets**”,右键点击“**pages**”文件夹,选择“**New > ArkTS File**”,命名为“**Second**”,点击“**Finish**”。可以看到文件目录结构如下: - ![09](figures/09.png) + ![secondPage](figures/secondPage.png) > **说明:** > @@ -281,7 +283,7 @@ 2. 点击**File** > **Project Structure...** > **Project** > **SigningConfigs**界面勾选“**Automatically generate signature**”,等待自动签名完成即可,点击“**OK**”。如下图所示: - ![06](figures/06.png) + ![signConfig](figures/signConfig.png) 3. 在编辑窗口右上角的工具栏,点击![zh-cn_image_0000001364054485](figures/zh-cn_image_0000001364054485.png)按钮运行。效果如下图所示: diff --git a/zh-cn/application-dev/quick-start/start-with-js-fa.md b/zh-cn/application-dev/quick-start/start-with-js-fa.md index e1bc75285c9d17d4731418e272001dc865edb16c..027047b98c7f9f57dde812613cff25a3601a5927 100644 --- a/zh-cn/application-dev/quick-start/start-with-js-fa.md +++ b/zh-cn/application-dev/quick-start/start-with-js-fa.md @@ -3,22 +3,22 @@ > **说明:** > -> 为确保运行效果,本文以使用**DevEco Studio 3.1 Beta1**版本为例,点击[此处](https://developer.harmonyos.com/cn/develop/deveco-studio#download)获取下载链接。 +> 为确保运行效果,本文以使用**DevEco Studio 3.1 Beta2**版本为例,点击[此处](https://developer.harmonyos.com/cn/develop/deveco-studio#download)获取下载链接。 ## 创建JS工程 -1. 若首次打开**DevEco Studio**,请点击**Create Project**创建工程。如果已经打开了一个工程,请在菜单栏选择**File** > **New** > **Create Project**来创建一个新工程。选择**OpenHarmony**模板库,选择模板“**Empty Ability**”,点击**Next**进行下一步配置。 +1. 若首次打开**DevEco Studio**,请点击**Create Project**创建工程。如果已经打开了一个工程,请在菜单栏选择**File** > **New** > **Create Project**来创建一个新工程。选择**Application**应用开发(本文以应用开发为例,**Atomic Service**对应为原子化服务开发),选择模板“**Empty Ability**”,点击**Next**进行下一步配置。 - ![01](figures/01.png) + ![createProject](figures/createProject.png) 2. 进入配置工程界面,**Compile SDK**选择“**8**”(**Compile SDK**选择“**9**”时注意同步选择 **Model** 为“**FA**”,此处以选择“**8**”为例),**Language**选择“**JS**”,其他参数保持默认设置即可。 - ![04](figures/04.png) + ![chooseFAModel_js](figures/chooseFAModel_js.png) > **说明:** > - > DevEco Studio V2.2 Beta1及更高版本支持使用JS[低代码开发](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/ohos-ide-low-code-overview-0000001445605884-V3)方式。 + > DevEco Studio V2.2 Beta1及更高版本支持使用JS[低代码开发](https://developer.harmonyos.com/cn/docs/documentation/doc-guides-V3/ide-low-code-overview-0000001480179573-V3)方式。 > > 低代码开发方式具有丰富的UI界面编辑功能,通过可视化界面开发方式快速构建布局,可有效降低开发者的上手成本并提升开发者构建UI界面的效率。 > @@ -26,6 +26,8 @@ 3. 点击**Finish**,工具会自动生成示例代码和相关资源,等待工程创建完成。 +4. 工程创建完成后,在**entry > build-profile.json5**文件中,将targets中的runtimeOS改为“OpenHarmony”,然后点击右上角提示框的**Sync Now**以进行OpenHarmony应用开发。 + ## JS工程目录结构 @@ -40,7 +42,7 @@ - **src > main > resources**:用于存放应用/服务所用到的资源文件,如图形、多媒体、字符串、布局文件等。关于资源文件,详见[资源限定与访问](../ui/js-framework-resource-restriction.md)。 - **src > main > config.json**:模块配置文件。主要包含HAP的配置信息、应用/服务在具体设备上的配置信息以及应用/服务的全局配置信息。具体的配置文件说明,详见[应用配置文件(FA模型)](application-configuration-file-overview-fa.md)。 - - **build-profile.json5**:当前的模块信息 、编译信息配置项,包括buildOption、targets配置等。 + - **build-profile.json5**:当前的模块信息 、编译信息配置项,包括buildOption、targets配置等。其中targets中可配置当前运行环境,默认为HarmonyOS。若需开发OpenHarmony应用,则需开发者自行修改为OpenHarmony。 - **hvigorfile.ts**:模块级编译构建任务脚本,开发者可以自定义相关任务和代码实现。 - **build-profile.json5**:应用级配置信息,包括签名、产品配置等。 @@ -226,11 +228,10 @@ 2. 点击**File** > **Project Structure...** > **Project** > **Signing Configs**界面勾选“**Automatically generate signature**”,等待自动签名完成即可,点击“**OK**”。如下图所示: - ![06](figures/06.png) + ![signConfig](figures/signConfig.png) 3. 在编辑窗口右上角的工具栏,点击![zh-cn_image_0000001364054485](figures/zh-cn_image_0000001364054485.png)按钮运行。效果如下图所示: ![zh-cn_image_0000001311175132](figures/zh-cn_image_0000001311175132.png) 恭喜您已经使用JS语言开发(FA模型)完成了第一个OpenHarmony应用,快来[探索更多的OpenHarmony功能](../application-dev-guide.md)吧。 - diff --git a/zh-cn/application-dev/reference/Readme-CN.md b/zh-cn/application-dev/reference/Readme-CN.md index 88fa07c730e4774e12236232947abd162cc77a0a..6253620ea55348d7cb196bfaa0b3958e7e46a3b1 100644 --- a/zh-cn/application-dev/reference/Readme-CN.md +++ b/zh-cn/application-dev/reference/Readme-CN.md @@ -3,7 +3,8 @@ - [系统能力SystemCapability使用指南](syscap.md) - [系统能力SystemCapability列表](syscap-list.md) - [组件参考(基于ArkTS的声明式开发范式)](arkui-ts/Readme-CN.md) -- [组件参考(兼容JS的类Web开发范式)](arkui-js/Readme-CN.md) +- [组件参考(兼容JS的类Web开发范式-ArkUI.Full)](arkui-js/Readme-CN.md) +- [组件参考(兼容JS的类Web开发范式-ArkUI.Lite)](arkui-js-lite/Readme-CN.md) - [JS服务卡片UI组件参考](js-service-widget-ui/Readme-CN.md) - [接口参考(ArkTS及JS API)](apis/Readme-CN.md) - [错误码参考](errorcodes/Readme-CN.md) diff --git a/zh-cn/application-dev/reference/apis/Readme-CN.md b/zh-cn/application-dev/reference/apis/Readme-CN.md index 0a40190293d8d5d88864b118c96be99eea6edde2..6d83377eb5def012611401569ad36a5242407630 100755 --- a/zh-cn/application-dev/reference/apis/Readme-CN.md +++ b/zh-cn/application-dev/reference/apis/Readme-CN.md @@ -125,7 +125,20 @@ - [@ohos.notification (Notification模块)(待停用)](js-apis-notification.md) - application - [EventHub](js-apis-inner-application-eventHub.md) - + - commonEvent + - [CommonEventData](js-apis-inner-commonEvent-commonEventData.md) + - [CommonEventPublishData](js-apis-inner-commonEvent-commonEventPublishData.md) + - [CommonEventSubscriber](js-apis-inner-commonEvent-commonEventSubscriber.md) + - [CommonEventSubscribeInfo](js-apis-inner-commonEvent-commonEventSubscribeInfo.md) + - notification + - [NotificationActionButton](js-apis-inner-notification-notificationActionButton.md) + - [NotificationCommonDef](js-apis-inner-notification-notificationCommonDef.md) + - [NotificationContent](js-apis-inner-notification-notificationContent.md) + - [NotificationFlags](js-apis-inner-notification-notificationFlags.md) + - [NotificationRequest](js-apis-inner-notification-notificationRequest.md) + - [NotificationSlot](js-apis-inner-notification-notificationSlot.md) + - [NotificationTemplate](js-apis-inner-notification-notificationTemplate.md) + - [NotificationUserInput](js-apis-inner-notification-notificationUserInput.md) - 包管理 - [@ohos.bundle.appControl (appControl模块)](js-apis-appControl.md) - [@ohos.bundle.bundleManager (bundleManager模块)](js-apis-bundleManager.md) @@ -139,6 +152,7 @@ - bundleManager - [abilityInfo](js-apis-bundleManager-abilityInfo.md) - [applicationInfo](js-apis-bundleManager-applicationInfo.md) + - [AppProvisionInfo](js-apis-bundleManager-AppProvisionInfo.md) - [bundleInfo](js-apis-bundleManager-bundleInfo.md) - [BundlePackInfo](js-apis-bundleManager-BundlePackInfo.md) - [dispatchInfo](js-apis-bundleManager-dispatchInfo.md) @@ -159,6 +173,8 @@ - [@ohos.pluginComponent(PluginComponentManager)](js-apis-plugincomponent.md) - [@ohos.promptAction (弹窗)](js-apis-promptAction.md) - [@ohos.router (页面路由)](js-apis-router.md) + - [@ohos.measure (文本计算)](js-apis-measure.md) + - [@ohos.uiAppearance(用户界面外观)](js-apis-uiappearance.md) - 图形图像 - [@ohos.animation.windowAnimationManager (窗口动画管理)](js-apis-windowAnimationManager.md) @@ -185,7 +201,7 @@ - [@ohos.intl (国际化-Intl)](js-apis-intl.md) - [@ohos.resourceManager (资源管理)](js-apis-resource-manager.md) -- 资源调度 +- 后台任务 - [@ohos.distributedMissionManager (分布式任务管理)](js-apis-distributedMissionManager.md) - [@ohos.reminderAgentManager (后台代理提醒)](js-apis-reminderAgentManager.md) - [@ohos.resourceschedule.backgroundTaskManager (后台任务管理)](js-apis-resourceschedule-backgroundTaskManager.md) @@ -203,7 +219,6 @@ - [@ohos.security.huks (通用密钥库系统)](js-apis-huks.md) - [@ohos.userIAM.faceAuth (人脸认证)](js-apis-useriam-faceauth.md) - [@ohos.userIAM.userAuth (用户认证)](js-apis-useriam-userauth.md) - - [@system.cipher (加密算法)](js-apis-system-cipher.md) - security - [PermissionRequestResult](js-apis-permissionrequestresult.md) @@ -214,24 +229,26 @@ - [@ohos.data.dataShareResultSet (数据共享结果集)](js-apis-data-DataShareResultSet.md) - [@ohos.data.distributedDataObject (分布式数据对象)](js-apis-data-distributedobject.md) - [@ohos.data.distributedKVStore (分布式键值数据库)](js-apis-distributedKVStore.md) - - [@ohos.data.preferences (首选项)](js-apis-data-preferences.md) + - [@ohos.data.preferences (用户首选项)](js-apis-data-preferences.md) - [@ohos.data.relationalStore (关系型数据库)](js-apis-data-relationalStore.md) - [@ohos.data.ValuesBucket (数据集)](js-apis-data-valuesBucket.md) - - data/rdb - - [resultSet (结果集)](js-apis-data-resultset.md) - 文件管理 + - [@ohos.file.backup (备份恢复)](js-apis-file-backup.md) + - [@ohos.file.cloudSyncManager (端云同步管理)](js-apis-file-cloudsyncmanager.md) - [@ohos.file.environment (目录环境能力)](js-apis-file-environment.md) - [@ohos.file.fileAccess (公共文件访问与管理)](js-apis-fileAccess.md) - [@ohos.file.fileExtensionInfo (公共文件访问与管理属性信息)](js-apis-fileExtensionInfo.md) + - [@ohos.file.fileuri (文件URI)](js-apis-file-fileuri.md) - [@ohos.file.fs (文件管理)](js-apis-file-fs.md) - [@ohos.file.hash (文件哈希处理)](js-apis-file-hash.md) + - [@ohos.file.picker (选择器)](js-apis-file-picker.md) - [@ohos.file.securityLabel (数据标签)](js-apis-file-securityLabel.md) - [@ohos.file.statvfs (文件系统空间统计)](js-apis-file-statvfs.md) - [@ohos.file.storageStatistics (应用空间统计)](js-apis-file-storage-statistics.md) - [@ohos.file.volumeManager (卷管理)](js-apis-file-volumemanager.md) - [@ohos.filemanagement.userFileManager (用户数据管理)](js-apis-userFileManager.md) - - [@ohos.multimedia.medialibrary (媒体库管理)](js-apis-medialibrary.md) + - [@ohos.fileShare (文件分享)](js-apis-fileShare.md) - 电话服务 - [@ohos.contact (联系人)](js-apis-contact.md) @@ -253,7 +270,8 @@ - [@ohos.request (上传下载)](js-apis-request.md) - 通信与连接 - - [@ohos.bluetooth (蓝牙)](js-apis-bluetooth.md) + - [@ohos.bluetooth (蓝牙)(待停用)](js-apis-bluetooth.md) + - [@ohos.bluetoothManager (蓝牙)(推荐)](js-apis-bluetoothManager.md) - [@ohos.connectedTag (有源标签)](js-apis-connectedTag.md) - [@ohos.nfc.cardEmulation (标准NFC-cardEmulation)](js-apis-cardEmulation.md) - [@ohos.nfc.controller (标准NFC)](js-apis-nfcController.md) @@ -338,6 +356,7 @@ - 定制管理 - [@ohos.configPolicy (配置策略)](js-apis-configPolicy.md) - [@ohos.enterprise.accountManager (帐户管理)](js-apis-enterprise-accountManager.md) + - [@ohos.enterprise.bundleManager (包管理)](js-apis-enterprise-bundleManager.md) - [@ohos.enterprise.adminManager (企业设备管理)](js-apis-enterprise-adminManager.md) - [@ohos.enterprise.dateTimeManager (系统时间管理)](js-apis-enterprise-dateTimeManager.md) - [@ohos.enterprise.deviceControl (设备控制管理)](js-apis-enterprise-deviceControl.md) @@ -389,17 +408,18 @@ - [@ohos.fileio (文件管理)](js-apis-fileio.md) - [@ohos.geolocation (位置服务)](js-apis-geolocation.md) - [@ohos.hiAppEvent (应用打点)](js-apis-hiappevent.md) + - [@ohos.multimedia.medialibrary (媒体库管理)](js-apis-medialibrary.md) - [@ohos.prompt (弹窗)](js-apis-prompt.md) - [@ohos.reminderAgent (后台代理提醒)](js-apis-reminderAgent.md) - [@ohos.statfs (statfs)](js-apis-statfs.md) - [@ohos.systemParameter (系统属性)](js-apis-system-parameter.md) - [@ohos.systemTime (系统时间、时区)](js-apis-system-time.md) - [@ohos.usb (USB管理)](js-apis-usb-deprecated.md) - - [@ohos.usbV9 (USB管理)](js-apis-usb.md) - [@system.app (应用上下文)](js-apis-system-app.md) - [@system.battery (电量信息)](js-apis-system-battery.md) - [@system.bluetooth (蓝牙)](js-apis-system-bluetooth.md) - [@system.brightness (屏幕亮度)](js-apis-system-brightness.md) + - [@system.cipher (加密算法)](js-apis-system-cipher.md) - [@system.configuration (应用配置)](js-apis-system-configuration.md) - [@system.device (设备信息)](js-apis-system-device.md) - [@system.fetch (数据请求)](js-apis-system-fetch.md) @@ -429,3 +449,5 @@ - [PermissionDef](js-apis-bundle-PermissionDef.md) - [remoteAbilityInfo](js-apis-bundle-remoteAbilityInfo.md) - [shortcutInfo](js-apis-bundle-ShortcutInfo.md) + - data/rdb + - [resultSet (结果集)](js-apis-data-resultset.md) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/commonEvent-definitions.md b/zh-cn/application-dev/reference/apis/commonEvent-definitions.md index 6de84fd8a843d2506b05d6df87dfc242d4c3190c..576f230600fe6d6d3e0c9809195009b436a31171 100644 --- a/zh-cn/application-dev/reference/apis/commonEvent-definitions.md +++ b/zh-cn/application-dev/reference/apis/commonEvent-definitions.md @@ -903,3 +903,7 @@ - 值:usual.event.QUICK_FIX_APPLY_RESULT - 订阅者所需权限:无 +## COMMON_EVENT_USER_INFO_UPDATED9+ +表示用户信息已更新。 +- 值:usual.event.USER_INFO_UPDATED +- 订阅者所需权限:无 diff --git a/zh-cn/application-dev/reference/apis/commonEventManager-definitions.md b/zh-cn/application-dev/reference/apis/commonEventManager-definitions.md index 53019c39c737c2a0fa6badf67d3f501eb3ffea8c..5542cd64505178f9a62277d359ee0bde67d70525 100644 --- a/zh-cn/application-dev/reference/apis/commonEventManager-definitions.md +++ b/zh-cn/application-dev/reference/apis/commonEventManager-definitions.md @@ -60,10 +60,13 @@ - 值: usual.event.THERMAL_LEVEL_CHANGED - 订阅者所需权限: 无 -## COMMON_EVENT_USER_PRESENT +## COMMON_EVENT_USER_PRESENT(deprecated) (预留事件,暂未支持)用户解锁设备的公共事件的动作。 - 值: usual.event.USER_PRESENT - 订阅者所需权限: 无 +> 说明: +> +> 从API Version 10 开始废弃。 ## COMMON_EVENT_TIME_TICK 表示系统时间更改的公共事件的动作。 @@ -789,3 +792,121 @@ Wi-Fi P2P群组信息已更改。 表示HTTP代理的配置信息发生变化。 - 值:usual.event.HTTP_PROXY_CHANGE - 订阅者所需权限:无 + +## COMMON_EVENT_DOMAIN_ACCOUNT_STATUS_CHANGED10+ +表示域账号状态发生变化。 +- 值:usual.event.DOMAIN_ACCOUNT_STATUS_CHANGED +- 订阅者所需权限:无 + +## COMMON_EVENT_SIM_STATE_CHANGED10+ +提示SIM卡状态更新。 +- 值:usual.event.SIM_STATE_CHANGED +- 订阅者所需权限:无 + +## COMMON_EVENT_SMS_RECEIVED_COMPLETED10+ +提示短信接收完成。 +- 值:usual.event.SMS_RECEIVED_COMPLETED +- 订阅者所需权限:ohos.permission.RECEIVE_SMS + +## COMMON_EVENT_SMS_EMERGENCY_CB_RECEIVE_COMPLETED10+ +提示紧急小区广播短信接收完成。 +- 值:usual.event.SMS_EMERGENCY_CB_RECEIVE_COMPLETED +- 订阅者所需权限:ohos.permission.RECEIVE_SMS + +## COMMON_EVENT_SMS_CB_RECEIVE_COMPLETED10+ +提示小区广播短信接收完成。 +- 值:usual.event.SMS_CB_RECEIVE_COMPLETED +- 订阅者所需权限:ohos.permission.RECEIVE_SMS + +## COMMON_EVENT_STK_COMMAND10+ +(预留事件,暂未支持)提示STK命令。 +- 值:usual.event.STK_COMMAND +- 订阅者所需权限:无 + +## COMMON_EVENT_STK_SESSION_END10+ +(预留事件,暂未支持)提示STK会话结束。 +- 值:usual.event.STK_SESSION_END +- 订阅者所需权限:无 + +## COMMON_EVENT_STK_CARD_STATE_CHANGED10+ +(预留事件,暂未支持)提示STK卡状态已更新。 +- 值:usual.event.STK_CARD_STATE_CHANGED +- 订阅者所需权限:ohos.permission. + +## COMMON_EVENT_STK_ALPHA_IDENTIFIER10+ +(预留事件,暂未支持)提示STK ALPHA标识符。 +- 值:usual.event.STK_ALPHA_IDENTIFIER +- 订阅者所需权限:无 + +## COMMON_EVENT_SMS_WAPPUSH_RECEIVE_COMPLETED10+ +提示服务信息短信接收完成。 +- 值:usual.event.SMS_WAPPUSH_RECEIVE_COMPLETED +- 订阅者所需权限:ohos.permission.RECEIVE_SMS + +## COMMON_EVENT_OPERATOR_CONFIG_CHANGED10+ +提示运营商配置已更新。 +- 值:usual.event.OPERATOR_CONFIG_CHANGED +- 订阅者所需权限:无 + +## COMMON_EVENT_SIM_CARD_DEFAULT_SMS_SUBSCRIPTION_CHANGED10+ +提示SIM卡默认短信主卡已更新。 +- 值:usual.event.DEFAULT_SMS_SUBSCRIPTION_CHANGED +- 订阅者所需权限:无 + +## COMMON_EVENT_SIM_CARD_DEFAULT_DATA_SUBSCRIPTION_CHANGED10+ +提示SIM卡默认数据主卡已更新。 +- 值:usual.event.DEFAULT_DATA_SUBSCRIPTION_CHANGED +- 订阅者所需权限:无 + +## COMMON_EVENT_SIM_CARD_DEFAULT_MAIN_SUBSCRIPTION_CHANGED10+ +提示SIM卡默认主卡已更新。 +- 值:usual.event.SIM.DEFAULT_MAIN_SUBSCRIPTION_CHANGED +- 订阅者所需权限:无 + +## COMMON_EVENT_SIM_CARD_DEFAULT_VOICE_SUBSCRIPTION_CHANGED10+ +提示SIM卡默认语音主卡已更新。 +- 值:usual.event.DEFAULT_VOICE_SUBSCRIPTION_CHANGED +- 订阅者所需权限:无 + +## COMMON_EVENT_CALL_STATE_CHANGED10+ +提示呼叫状态更新。 +- 值:usual.event.CALL_STATE_CHANGED +- 订阅者所需权限:ohos.permission.GET_TELEPHONY_STATE + +## COMMON_EVENT_CELLULAR_DATA_STATE_CHANGED10+ +提示蜂窝数据状态更新。 +- 值:usual.event.CELLULAR_DATA_STATE_CHANGED +- 订阅者所需权限:无 + +## COMMON_EVENT_NETWORK_STATE_CHANGED10+ +提示网络状态更新。 +- 值:usual.event.NETWORK_STATE_CHANGED +- 订阅者所需权限:无 + +## COMMON_EVENT_SIGNAL_INFO_CHANGED10+ +提示信号信息更新。 +- 值:usual.event.SIGNAL_INFO_CHANGED +- 订阅者所需权限:无 + +## COMMON_EVENT_INCOMING_CALL_MISSED10+ +提示未接来电。 +- 值:usual.event.INCOMING_CALL_MISSED +- 订阅者所需权限:ohos.permission.GET_TELEPHONY_STATE + +## COMMON_EVENT_RADIO_STATE_CHANGE10+ +提示设备modem上下电状态变化。 +- 值:usual.event.RADIO_STATE_CHANGE + +## COMMON_EVENT_SCREEN_LOCKED 10+ + +表示屏幕锁定的公共事件。 + +- 值: usual.event.SCREEN_LOCKED +- 订阅者所需权限: 无 + +## COMMON_EVENT_SCREEN_UNLOCKED10+ + +表示屏幕解锁的公共事件。 + +- 值:usual.event.SCREEN_UNLOCKED +- 订阅者所需权限:无 \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/common_event/commonEvent-ans.md b/zh-cn/application-dev/reference/apis/common_event/commonEvent-ans.md new file mode 100644 index 0000000000000000000000000000000000000000..0a95dea844b855463eed428f362d0f3a409920f2 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/common_event/commonEvent-ans.md @@ -0,0 +1,13 @@ +# 通知服务公共事件定义 +通知服务面向应用发布如下系统公共事件,应用如需订阅系统公共事件,请参考公共事件[接口文档](../js-apis-commonEventManager.md)。 + +## COMMON_EVENT_SLOT_CHANGE +表示通知渠道或通知开关发生变化。 + +- 常量值:"usual.event.SLOT_CHANGE" +- 订阅方需要的权限:ohos.permission.NOTIFICATION_CONTROLLER + +通知设置里修改应用的渠道参数、渠道开关,或者开启、关闭通知使能开关时,都会触发通知服务发布这个系统公共事件。 + +与这个公共事件相关的接口:setSlotByBundle、setNotificationEnableSlot、setNotificationEnable,这些为系统API,一般都是通知设置应用调用,具体参看[通知接口文档](../js-apis-notificationManager.md)。 + diff --git a/zh-cn/application-dev/reference/apis/common_event/commonEvent-subsystem.md b/zh-cn/application-dev/reference/apis/common_event/commonEvent-subsystem.md new file mode 100644 index 0000000000000000000000000000000000000000..24c662b23d8d222260ae74f5111e5edb1c9ecf50 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/common_event/commonEvent-subsystem.md @@ -0,0 +1,13 @@ +# xxx(子系统名称)公共事件定义 +xxxx子系统/服务面向应用发布如下系统公共事件,应用如需订阅系统公共事件,请参考公共事件[接口文档](../js-apis-commonEventManager.md)。 + +## commonEvent1(事件名称) +// 第一段描述:事件的解释,能够简要表达事件包含的含义。 + +- 常量值:"usual.event.xx" +- 订阅方需要的权限:xxx/无需权限 + +// 第二段描述:这里需要详细描述事件上报的机制,用于帮助开发者理解具体是因为什么动作触发了这条系统公共事件。 + +// 第三段描述(可选):如果该事件的触发依赖一些变量,需要额外解释这些变量的成因,比如本子系统某个接口的返回值或回调决定了该事件的触发条件,那么需要在这里进行解释说明,有必要的话需要提供到该接口的链接。 + diff --git a/zh-cn/application-dev/reference/apis/development-intro.md b/zh-cn/application-dev/reference/apis/development-intro.md index d609303628f400b35fa22e9e1e794feb78ebf946..3ae0b33f7b4767ff3342ab5b95cd6417c199183a 100644 --- a/zh-cn/application-dev/reference/apis/development-intro.md +++ b/zh-cn/application-dev/reference/apis/development-intro.md @@ -30,7 +30,7 @@ OpenHarmony中提供的接口,部分是仅供OEM厂商使用的system api, 随DevEco下载的SDK为public-SDK,不包括系统接口。如需使用系统接口,需要: - 参考[full-SDK替换指南](../../quick-start/full-sdk-switch-guide.md)将SDK替换为full-SDK。 -- 参考[HarmonyAppProvision配置文件的说明](../../security/app-provision-structure.md#harmonyappprovision配置文件的说明)修改HarmonyAppProvision配置文件中的app-feature字段为hos_system_app(系统应用)。 +- 参考[HarmonyAppProvision配置文件的说明](../../security/app-provision-structure.md)修改HarmonyAppProvision配置文件中的app-feature字段为hos_system_app(系统应用)。 ## 权限说明 diff --git a/zh-cn/application-dev/reference/apis/figures/zh-ch_image_Average_Color.png b/zh-cn/application-dev/reference/apis/figures/zh-ch_image_Average_Color.png new file mode 100644 index 0000000000000000000000000000000000000000..db2d6dca8a84f09b59aaa1affb5caf5deb289669 Binary files /dev/null and b/zh-cn/application-dev/reference/apis/figures/zh-ch_image_Average_Color.png differ diff --git a/zh-cn/application-dev/reference/apis/figures/zh-ch_image_Highest_Saturation_Color.png b/zh-cn/application-dev/reference/apis/figures/zh-ch_image_Highest_Saturation_Color.png new file mode 100644 index 0000000000000000000000000000000000000000..6bf7c7ba71bee89b092cdf9a8e6a5e786b8e389b Binary files /dev/null and b/zh-cn/application-dev/reference/apis/figures/zh-ch_image_Highest_Saturation_Color.png differ diff --git a/zh-cn/application-dev/reference/apis/figures/zh-ch_image_Largest_Proportion_Color.png b/zh-cn/application-dev/reference/apis/figures/zh-ch_image_Largest_Proportion_Color.png new file mode 100644 index 0000000000000000000000000000000000000000..93f347b1abf77970d9f84569423f0ea1673ecf9a Binary files /dev/null and b/zh-cn/application-dev/reference/apis/figures/zh-ch_image_Largest_Proportion_Color.png differ diff --git a/zh-cn/application-dev/reference/apis/js-apis-Bundle-BundleStatusCallback.md b/zh-cn/application-dev/reference/apis/js-apis-Bundle-BundleStatusCallback.md index e67d24ae07803dcc71bfdf9b2ca9ded609919e5e..4150970237ce4ddf5ec4fc119513fb386d8ba26b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-Bundle-BundleStatusCallback.md +++ b/zh-cn/application-dev/reference/apis/js-apis-Bundle-BundleStatusCallback.md @@ -10,7 +10,7 @@ ## BundleStatusCallback(deprecated) > 从API version 9开始不再支持。建议使用[bundleMonitor](js-apis-bundleMonitor.md)替代。 -**系统API:** 此接口为系统接口,三方应用不支持调用。 +**系统API:** 此接口为系统接口。 **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework。 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 index fb7cd3047e666fe09808f55857eb8e857811d8b1..841a7c9b0b786740baccc129749972f9cee567bc 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-Bundle-InnerBundleManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-Bundle-InnerBundleManager.md @@ -34,7 +34,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -62,7 +62,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -94,7 +94,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -121,7 +121,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -153,7 +153,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -179,7 +179,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -210,7 +210,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -236,7 +236,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -267,7 +267,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -293,7 +293,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** 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 index 49db882be3b123b00dbb25f8a4ee70d406d10eac..76c621f40eeb31b7c60055e90e6035f59ce5292a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-Bundle-distributedBundle.md +++ b/zh-cn/application-dev/reference/apis/js-apis-Bundle-distributedBundle.md @@ -42,7 +42,7 @@ SystemCapability.BundleManager.DistributedBundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -71,7 +71,7 @@ SystemCapability.BundleManager.DistributedBundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -103,7 +103,7 @@ SystemCapability.BundleManager.DistributedBundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -132,7 +132,7 @@ SystemCapability.BundleManager.DistributedBundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** 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 9fbf316d05afb22bf7870b8b9dcb2e073e0fc59f..8d2a5e8afc6db4b729e64972cede9cb5862736c2 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-Bundle.md +++ b/zh-cn/application-dev/reference/apis/js-apis-Bundle.md @@ -157,7 +157,7 @@ bundle.getApplicationInfo(bundleName, bundleFlags, (err, data) => { > 从API version 9开始不再维护,建议使用[bundleManager.getAllBundleInfo](js-apis-bundleManager.md#bundlemanagergetallbundleinfo)替代。 -getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise> +getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise\\> 以异步方法获取指定用户所有的BundleInfo,使用Promise形式异步回调, @@ -201,7 +201,7 @@ bundle.getAllBundleInfo(bundleFlag, userId) > 从API version 9开始不再维护,建议使用[bundleManager.getAllBundleInfo](js-apis-bundleManager.md#bundlemanagergetallbundleinfo)替代。 -getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback>): void +getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback\\>): void 以异步方法获取当前用户所有的BundleInfo,使用callback形式返回结果。 @@ -238,7 +238,7 @@ bundle.getAllBundleInfo(bundleFlag, (err, data) => { > 从API version 9开始不再维护,建议使用[bundleManager.getAllBundleInfo](js-apis-bundleManager.md#bundlemanagergetallbundleinfo)替代。 -getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback>): void +getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback\\>): void 以异步方法获取系统中指定用户下所有的BundleInfo,使用callback形式返回结果。 @@ -426,7 +426,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **返回值:** @@ -462,7 +462,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -499,7 +499,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -540,7 +540,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -584,7 +584,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -626,7 +626,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -671,7 +671,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -699,7 +699,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -754,7 +754,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -794,7 +794,7 @@ SystemCapability.BundleManager.BundleFramework **系统API:** -此接口为系统接口,三方应用不支持调用 +此接口为系统接口。 **参数:** @@ -823,7 +823,7 @@ bundle.getPermissionDef(permissionName).then((data) => { > 从API version 9开始不再维护,建议使用[bundleManager.getAllApplicationInfo](js-apis-bundleManager.md#bundlemanagergetallapplicationinfo)替代。 -getAllApplicationInfo(bundleFlags: number, userId?: number): Promise> +getAllApplicationInfo(bundleFlags: number, userId?: number): Promise\\> 获取指定用户下所有已安装的应用信息,使用promise异步回调。 @@ -865,7 +865,7 @@ bundle.getAllApplicationInfo(bundleFlags, userId) > 从API version 9开始不再维护,建议使用[bundleManager.getAllApplicationInfo](js-apis-bundleManager.md#bundlemanagergetallapplicationinfo)替代。 -getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback>): void +getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback\\>): void 获取指定用户下所有已安装的应用信息,使用callback异步回调。 @@ -1320,7 +1320,7 @@ bundle.isApplicationEnabled(bundleName, (err, data) => { > 从API version 9开始不再维护,建议使用[bundleManager.queryAbilityInfo](js-apis-bundleManager.md#bundlemanagerqueryabilityinfo)替代。 -queryAbilityByWant(want: Want, bundleFlags: number, userId?: number): Promise> +queryAbilityByWant(want: Want, bundleFlags: number, userId?: number): Promise\\> 以异步方法根据给定的意图获取Ability组件信息,使用Promise形式返回结果。 @@ -1371,7 +1371,7 @@ bundle.queryAbilityByWant(want, bundleFlags, userId) > 从API version 9开始不再维护,建议使用[bundleManager.queryAbilityInfo](js-apis-bundleManager.md#bundlemanagerqueryabilityinfo)替代。 -queryAbilityByWant(want: Want, bundleFlags: number, userId: number, callback: AsyncCallback>): void +queryAbilityByWant(want: Want, bundleFlags: number, userId: number, callback: AsyncCallback\\>): void 以异步方法根据给定的意图获取指定用户下Ability信息,使用callback形式返回结果。 @@ -1416,7 +1416,7 @@ bundle.queryAbilityByWant(want, bundleFlags, userId, (err, data) => { > 从API version 9开始不再维护,建议使用[bundleManager.queryAbilityInfo](js-apis-bundleManager.md#bundlemanagerqueryabilityinfo)替代。 -queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback>): void; +queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback\\>): void; 以异步方法根据给定的意图获取Ability信息,使用callback形式返回结果。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-EnterpriseAdminExtensionAbility.md b/zh-cn/application-dev/reference/apis/js-apis-EnterpriseAdminExtensionAbility.md index c7f5608e6f679afad5f6162c343533011d38ed6a..79eb98c313cecc829b95f67828b8d79a82743a56 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-EnterpriseAdminExtensionAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-EnterpriseAdminExtensionAbility.md @@ -110,7 +110,7 @@ export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbil onAppStart(bundleName: string): void -应用卸载事件回调。 +应用启动事件回调。 **系统能力**:SystemCapability.Customization.EnterpriseDeviceManager @@ -136,7 +136,7 @@ export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbil onAppStop(bundleName: string): void -应用卸载事件回调。 +应用停止事件回调。 **系统能力**:SystemCapability.Customization.EnterpriseDeviceManager diff --git a/zh-cn/application-dev/reference/apis/js-apis-UiTest.md b/zh-cn/application-dev/reference/apis/js-apis-UiTest.md deleted file mode 100644 index f04ccc898c1e3f61c1dfe47d01a89a9b3ca89e71..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/reference/apis/js-apis-UiTest.md +++ /dev/null @@ -1,3678 +0,0 @@ -# @ohos.UiTest (UiTest) - -UiTest提供模拟UI操作的能力,供开发者在测试场景使用,主要支持如点击、双击、长按、滑动等UI操作能力。 - -该模块提供以下功能: - -- [On9+](#on9):提供控件特征描述能力,用于控件筛选匹配查找。 -- [Component9+](#component9):代表UI界面上的指定控件,提供控件属性获取,控件点击,滑动查找,文本注入等能力。 -- [Driver9+](#driver9):入口类,提供控件匹配/查找,按键注入,坐标点击/滑动,截图等能力。 -- [UiWindow9+](#uiwindow9):入口类,提供窗口属性获取,窗口拖动、调整窗口大小等能力。 -- [By(deprecated)](#bydeprecated):提供控件特征描述能力,用于控件筛选匹配查找。从API version 9开始不再维护,建议使用[On9+](#on9)。 -- [UiComponent(deprecated)](#uicomponentdeprecated):代表UI界面上的指定控件,提供控件属性获取,控件点击,滑动查找,文本注入等能力。从API version 9开始不再维护,建议使用[Component9+](#component9)。 -- [UiDriver(deprecated)](#uidriverdeprecated):入口类,提供控件匹配/查找,按键注入,坐标点击/滑动,截图等能力。从API version 9开始不再维护,建议使用[Driver9+](#driver9)。 - ->**说明:** -> ->本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 - - -## 导入模块 - -```js -import {UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix} from '@ohos.uitest'; -``` - -## MatchPattern - -控件属性支持的匹配模式。 - -**系统能力**:SystemCapability.Test.UiTest - -| 名称 | 值 | 说明 | -| ----------- | ---- | -------------- | -| EQUALS | 0 | 等于给定值。 | -| CONTAINS | 1 | 包含给定值。 | -| STARTS_WITH | 2 | 以给定值开始。 | -| ENDS_WITH | 3 | 以给定值结束。 | - -## ResizeDirection9+ - -窗口调整大小的方向。 - -**系统能力**:SystemCapability.Test.UiTest - -| 名称 | 值 | 说明 | -| ---------- | ---- | -------- | -| LEFT | 0 | 左方。 | -| RIGHT | 1 | 右方。 | -| UP | 2 | 上方。 | -| DOWN | 3 | 下方。 | -| LEFT_UP | 4 | 左上方。 | -| LEFT_DOWN | 5 | 左下方。 | -| RIGHT_UP | 6 | 右上方。 | -| RIGHT_DOWN | 7 | 右下方。 | - -## Point9+ - -坐标点信息。 - -**系统能力**:SystemCapability.Test.UiTest - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ---- | ------ | ---- | ---- | ---------------- | -| x | number | 是 | 否 | 坐标点的横坐标。 | -| y | number | 是 | 否 | 坐标点的纵坐标。 | - -## Rect9+ - -控件的边框信息。 - -**系统能力**:SystemCapability.Test.UiTest - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ------ | ------ | ---- | ---- | ------------------------- | -| left | number | 是 | 否 | 控件边框的左上角的X坐标。 | -| top | number | 是 | 否 | 控件边框的左上角的Y坐标。 | -| right | number | 是 | 否 | 控件边框的右下角的X坐标。 | -| bottom | number | 是 | 否 | 控件边框的右下角的Y坐标。 | - -## WindowMode9+ - -**系统能力**:SystemCapability.Test.UiTest - -窗口的窗口模式。 - -| 名称 | 值 | 说明 | -| ---------- | ---- | ---------- | -| FULLSCREEN | 0 | 全屏模式。 | -| PRIMARY | 1 | 主窗口。 | -| SECONDARY | 2 | 第二窗口。 | -| FLOATING | 3 | 浮动窗口。 | - -## DisplayRotation9+ - -**系统能力**:SystemCapability.Test.UiTest - -设备显示器的显示方向。 - -| 名称 | 值 | 说明 | -| ------------ | ---- | ---------------------------------------- | -| ROTATION_0 | 0 | 设备显示器不旋转,初始形态垂直显示。 | -| ROTATION_90 | 1 | 设备显示器顺时针旋转90°,水平显示。 | -| ROTATION_180 | 2 | 设备显示器顺时针旋转180°,逆向垂直显示。 | -| ROTATION_270 | 3 | 设备显示器顺时针旋转270°,逆向水平显示。 | - -## WindowFilter9+ - -窗口的标志属性信息。 - -**系统能力**:SystemCapability.Test.UiTest - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ---------- | ------- | ---- | ---- | -------------------------- | -| bundleName | string | 是 | 否 | 窗口归属应用的包名。 | -| title | string | 是 | 否 | 窗口的标题信息。 | -| focused | boolean | 是 | 否 | 窗口是否处于获焦状态。 | -| actived | boolean | 是 | 否 | 窗口是否正与用户进行交互。 | - -## On9+ - -UiTest框架在API 9中,通过On类提供了丰富的控件特征描述API,用于进行控件筛选来匹配/查找出目标控件。
-On提供的API能力具有以下几个特点:
1、支持单属性匹配和多属性组合匹配,例如同时指定目标控件text和id。
2、控件属性支持多种匹配模式。
3、支持控件绝对定位,相对定位,可通过[ON.isBefore](#isbefore)和[ON.isAfter](#isafter)等API限定邻近控件特征进行辅助定位。
On类提供的所有API均为同步接口,建议使用者通过静态构造器ON来链式创建On对象。 - -```js -ON.text('123').type('button'); -``` - -### text9+ - -text(txt: string, pattern?: MatchPattern): On - -指定目标控件文本属性,支持多种匹配模式,返回On对象自身。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------- | ----------------------------- | ---- | --------------------------------------------------- | -| txt | string | 是 | 指定控件文本,用于匹配目标控件文本。 | -| pattern | [MatchPattern](#matchpattern) | 否 | 指定的文本匹配模式,默认为[EQUALS](#matchpattern)。 | - -**返回值:** - -| 类型 | 说明 | -| ---------- | ---------------------------------- | -| [On](#on9) | 返回指定目标控件文本属性的On对象。 | - -**示例:** - -```js -let on = ON.text('123'); // 使用静态构造器ON创建On对象,指定目标控件的text属性。 -``` - - -### id9+ - -id(id: string): On - -指定目标控件id属性,返回On对象自身。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | ---------------- | -| id | string | 是 | 指定控件的id值。 | - -**返回值:** - -| 类型 | 说明 | -| ---------- | -------------------------------- | -| [On](#on9) | 返回指定目标控件id属性的On对象。 | - -**示例:** - -```js -let on = ON.id('123'); // 使用静态构造器ON创建On对象,指定目标控件的id属性。 -``` - - -### type9+ - -type(tp: string): On - -指定目标控件的控件类型属性,返回On对象自身。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | -------------- | -| tp | string | 是 | 指定控件类型。 | - -**返回值:** - -| 类型 | 说明 | -| ---------- | ---------------------------------------- | -| [On](#on9) | 返回指定目标控件的控件类型属性的On对象。 | - -**示例:** - -```js -let on = ON.type('button'); // 使用静态构造器ON创建On对象,指定目标控件的控件类型属性。 -``` - - -### clickable9+ - -clickable(b?: boolean): On - -指定目标控件的可点击状态属性,返回On对象自身。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------- | ---- | ------------------------------------------------------------ | -| b | boolean | 否 | 指定控件可点击状态,true:可点击,false:不可点击。默认为true。 | - -**返回值:** - -| 类型 | 说明 | -| ---------- | ------------------------------------------ | -| [On](#on9) | 返回指定目标控件的可点击状态属性的On对象。 | - -**示例:** - -```js -let on = ON.clickable(true); // 使用静态构造器ON创建On对象,指定目标控件的可点击状态属性。 -``` - -### longClickable9+ - -longClickable(b?: boolean): On - -指定目标控件的可长按点击状态属性,返回On对象自身。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------- | ---- | ------------------------------------------------------------ | -| b | boolean | 否 | 指定控件可长按点击状态,true:可长按点击,false:不可长按点击。默认为true。 | - -**返回值:** - -| 类型 | 说明 | -| ---------- | ---------------------------------------------- | -| [On](#on9) | 返回指定目标控件的可长按点击状态属性的On对象。 | - -**示例:** - -```js -let on = ON.longClickable(true); // 使用静态构造器ON创建On对象,指定目标控件的可长按点击状态属性。 -``` - - -### scrollable9+ - -scrollable(b?: boolean): On - -指定目标控件的可滑动状态属性,返回On对象自身。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------- | ---- | ----------------------------------------------------------- | -| b | boolean | 否 | 控件可滑动状态,true:可滑动,false:不可滑动。默认为true。 | - -**返回值:** - -| 类型 | 说明 | -| ---------- | ------------------------------------------ | -| [On](#on9) | 返回指定目标控件的可滑动状态属性的On对象。 | - -**示例:** - -```js -let on = ON.scrollable(true); // 使用静态构造器ON创建On对象,指定目标控件的可滑动状态属性。 -``` - -### enabled9+ - -enabled(b?: boolean): On - -指定目标控件的使能状态属性,返回On对象自身。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------- | ---- | --------------------------------------------------------- | -| b | boolean | 否 | 指定控件使能状态,true:使能,false:未使能。默认为true。 | - -**返回值:** - -| 类型 | 说明 | -| ---------- | ---------------------------------------- | -| [On](#on9) | 返回指定目标控件的使能状态属性的On对象。 | - -**示例:** - -```js -let on = ON.enabled(true); // 使用静态构造器ON创建On对象,指定目标控件的使能状态属性。 -``` - -### focused9+ - -focused(b?: boolean): On - -指定目标控件的获焦状态属性,返回On对象自身。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------- | ---- | ----------------------------------------------------- | -| b | boolean | 否 | 控件获焦状态,true:获焦,false:未获焦。默认为true。 | - -**返回值:** - -| 类型 | 说明 | -| ---------- | ---------------------------------------- | -| [On](#on9) | 返回指定目标控件的获焦状态属性的On对象。 | - -**示例:** - -```js -let on = ON.focused(true); // 使用静态构造器ON创建On对象,指定目标控件的获焦状态属性。 -``` - -### selected9+ - -selected(b?: boolean): On - -指定目标控件的被选中状态属性,返回On对象自身。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------- | ---- | ------------------------------------------------------------ | -| b | boolean | 否 | 指定控件被选中状态,true:被选中,false:未被选中。默认为true。 | - -**返回值:** - -| 类型 | 说明 | -| ---------- | ------------------------------------------ | -| [On](#on9) | 返回指定目标控件的被选中状态属性的On对象。 | - -**示例:** - -```js -let on = ON.selected(true); // 使用静态构造器ON创建On对象,指定目标控件的被选中状态属性。 -``` - -### checked9+ - -checked(b?: boolean): On - -指定目标控件的被勾选状态属性,返回On对象自身。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------- | ---- | ------------------------------------------------------------ | -| b | boolean | 否 | 指定控件被勾选状态,true:被勾选,false:未被勾选。默认为false。 | - -**返回值:** - -| 类型 | 说明 | -| ---------- | ------------------------------------------ | -| [On](#on9) | 返回指定目标控件的被勾选状态属性的On对象。 | - -**示例:** - -```js -let on = ON.checked(true); // 使用静态构造器ON创建On对象,指定目标控件的被勾选状态属性 -``` - -### checkable9+ - -checkable(b?: boolean): On - -指定目标控件能否被勾选状态属性,返回On对象自身。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------- | ---- | ------------------------------------------------------------ | -| b | boolean | 否 | 指定控件能否被勾选状态,true:能被勾选,false:不能被勾选。默认为false。 | - -**返回值:** - -| 类型 | 说明 | -| ---------- | -------------------------------------------- | -| [On](#on9) | 返回指定目标控件能否被勾选状态属性的On对象。 | - -**示例:** - -```js -let on = ON.checkable(true); // 使用静态构造器ON创建On对象,指定目标控件的能否被勾选状态属性。 -``` - -### isBefore9+ - -isBefore(on: On): On - -指定目标控件位于给出的特征属性控件之前,返回On对象自身。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ---------- | ---- | -------------------- | -| on | [On](#on9) | 是 | 特征控件的属性要求。 | - -**返回值:** - -| 类型 | 说明 | -| ---------- | ---------------------------------------------------- | -| [On](#on9) | 返回指定目标控件位于给出的特征属性控件之前的On对象。 | - -**示例:** - -```js -let on = ON.isBefore(ON.text('123')); // 使用静态构造器ON创建On对象,指定目标控件位于给出的特征属性控件之前。 -``` - -### isAfter9+ - -isAfter(on: On): On - -指定目标控件位于给出的特征属性控件之后,返回On对象自身。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ---------- | ---- | -------------------- | -| on | [On](#on9) | 是 | 特征控件的属性要求。 | - -**返回值:** - -| 类型 | 说明 | -| ---------- | ---------------------------------------------------- | -| [On](#on9) | 返回指定目标控件位于给出的特征属性控件之后的On对象。 | - -**示例:** - -```js -let on = ON.isAfter(ON.text('123')); // 使用静态构造器ON创建On对象,指定目标控件位于给出的特征属性控件之后。 -``` - -## Component9+ - -UiTest框架在API9中,Component类代表了UI界面上的一个控件,提供控件属性获取,控件点击,滑动查找,文本注入等API。 -该类提供的所有方法都使用Promise方式作为异步方法,需使用await调用。 - -### click9+ - -click(): Promise\ - -控件对象进行点击操作。 - -**系统能力**:SystemCapability.Test.UiTest - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let button = await driver.findComponent(ON.type('button')); - await button.click(); -} -``` - -### doubleClick9+ - -doubleClick(): Promise\ - -控件对象进行双击操作。 - -**系统能力**:SystemCapability.Test.UiTest - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let button = await driver.findComponent(ON.type('button')); - await button.doubleClick(); -} -``` - -### longClick9+ - -longClick(): Promise\ - -控件对象进行长按操作。 - -**系统能力**:SystemCapability.Test.UiTest - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let button = await driver.findComponent(ON.type('button')); - await button.longClick(); -} -``` - -### getId9+ - -getId(): Promise\ - -获取控件对象的id值。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| ---------------- | ------------------------------- | -| Promise\ | 以Promise形式返回的控件的id值。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let button = await driver.findComponent(ON.type('button')); - let num = await button.getId(); -} -``` - -### getText9+ - -getText(): Promise\ - -获取控件对象的文本信息。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| ---------------- | --------------------------------- | -| Promise\ | 以Promise形式返回控件的文本信息。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let button = await driver.findComponent(ON.type('button')); - let text = await button.getText(); -} -``` - -### getType9+ - -getType(): Promise\ - -获取控件对象的控件类型。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| ---------------- | ----------------------------- | -| Promise\ | 以Promise形式返回控件的类型。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let button = await driver.findComponent(ON.type('button')); - let type = await button.getType(); -} -``` - -### getBounds9+ - -getBounds(): Promise\ - -获取控件对象的边框信息。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| ------------------------ | ------------------------------------- | -| Promise\<[Rect](#rect9)> | 以Promise形式返回控件对象的边框信息。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let button = await driver.findComponent(ON.type('button')); - let rect = await button.getBounds(); -} -``` - -### getBoundsCenter9+ - -getBoundsCenter(): Promise\ - -获取控件对象所占区域的中心点信息。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| -------------------------- | ----------------------------------------------- | -| Promise\<[Point](#point9)> | 以Promise形式返回控件对象所占区域的中心点信息。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let button = await driver.findComponent(ON.type('button')); - let point = await button.getBoundsCenter(); -} -``` - -### isClickable9+ - -isClickable(): Promise\ - -获取控件对象可点击属性。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| ----------------- | ------------------------------------------------------------ | -| Promise\ | 以Promise形式返回控件对象是否可点击,true:可点击,false:不可点击。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let button = await driver.findComponent(ON.type('button')); - if(await button.isClickable()) { - console.info('This button can be Clicked'); - } else { - console.info('This button can not be Clicked'); - } -} -``` - -### isLongClickable9+ - -isLongClickable(): Promise\ - -获取控件对象可长按点击属性。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| ----------------- | ------------------------------------------------------------ | -| Promise\ | 以Promise形式返回控件对象是否可安装点击,true:可长按点击,false:不可长按点击。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let button = await driver.findComponent(ON.type('button')); - if(await button.isLongClickable()) { - console.info('This button can longClick'); - } else { - console.info('This button can not longClick'); - } -} -``` - -### isChecked9+ - -isChecked(): Promise\ - -获取控件对象被勾选状态。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| ----------------- | ------------------------------------------------------------ | -| Promise\ | 以Promise形式返回控件对象被勾选状态,true:被勾选,false:未被勾选。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let checkBox = await driver.findComponent(ON.type('Checkbox')); - if(await checkBox.isChecked) { - console.info('This checkBox is checked'); - } else { - console.info('This checkBox is not checked'); - } -} -``` - -### isCheckable9+ - -isCheckable(): Promise\ - -获取控件对象能否被勾选属性。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| ----------------- | ------------------------------------------------------------ | -| Promise\ | 以Promise形式返回控件对象能否可被勾选属性,true:可被勾选,false:不可被勾选。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let checkBox = await driver.findComponent(ON.type('Checkbox')); - if(await checkBox.isCheckable) { - console.info('This checkBox is checkable'); - } else { - console.info('This checkBox is not checkable'); - } -} -``` - -### isScrollable9+ - -isScrollable(): Promise\ - -获取控件对象可滑动属性。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| ----------------- | ------------------------------------------------------------ | -| Promise\ | 以Promise形式返回控件对象是否可滑动,true:可滑动,false:不可滑动。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let scrollBar = await driver.findComponent(ON.scrollable(true)); - if(await scrollBar.isScrollable()) { - console.info('This scrollBar can be operated'); - } else { - console.info('This scrollBar can not be operated'); - } -} -``` - - -### isEnabled9+ - -isEnabled(): Promise\ - -获取控件使能状态。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| ----------------- | ---------------------------------------------------------- | -| Promise\ | 以Promise形式返回控件使能状态,true:使能,false:未使能。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let button = await driver.findComponent(ON.type('button')); - if(await button.isEnabled()) { - console.info('This button can be operated'); - } else { - console.info('This button can not be operated'); - } -} - -``` - -### isFocused9+ - -isFocused(): Promise\ - -判断控件对象获焦状态。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| ----------------- | ------------------------------------------------------------ | -| Promise\ | 以Promise形式返回控件对象获焦状态,true:获焦,false:未获焦。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let button = await driver.findComponent(ON.type('button')); - if(await button.isFocused()) { - console.info('This button is focused'); - } else { - console.info('This button is not focused'); - } -} -``` - -### isSelected9+ - -isSelected(): Promise\ - -获取控件对象被选中状态。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| ----------------- | --------------------------------------------------- | -| Promise\ | 控件对象被选中状态,true:被选中,false:未被选中。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let button = await driver.findComponent(ON.type('button')); - if(await button.isSelected()) { - console.info('This button is selected'); - } else { - console.info('This button is not selected'); - } -} -``` - -### inputText9+ - -inputText(text: string): Promise\ - -向控件中输入文本(适用于文本框控件)。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | ---------------------------------------- | -| text | string | 是 | 输入的文本信息,当前支持英文和特殊字符。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let text = await driver.findComponent(ON.text('hello world')); - await text.inputText('123'); -} -``` - -### clearText9+ - -clearText(): Promise\ - -清除控件的文本信息(适用于文本框控件)。 - -**系统能力**:SystemCapability.Test.UiTest - -**错误码:** - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let text = await driver.findComponent(ON.text('hello world')); - await text.clearText(); -} -``` - -### scrollSearch9+ - -scrollSearch(on: On): Promise\ - -在控件上滑动查找目标控件(适用支持滑动的控件)。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ---------- | ---- | -------------------- | -| on | [On](#on9) | 是 | 目标控件的属性要求。 | - -**返回值:** - -| 类型 | 说明 | -| ---------------------------------- | ------------------------------------- | -| Promise\<[Component](#component9)> | 以Promise形式返回找到的目标控件对象。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let button = await driver.findComponent(ON.type('Scroll')); - let button = await scrollBar.scrollSearch(ON.text('next page')); -} -``` - -### scrollToTop9+ - -scrollToTop(speed?: number): Promise\ - -在控件上滑动到顶部(适用支持滑动的控件)。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | ------------------------------------------------------------ | -| speed | number | 否 | 滑动速率,范围:200-15000,不在范围内设为默认值为600,单位:像素点/秒。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let scrollBar = await driver.findComponent(ON.type('Scroll')); - await scrollBar.scrollToTop(); -} -``` - -### scrollToBottom9+ - -scrollToBottom(speed?: number): Promise\ - -在控件上滑动到底部(适用支持滑动的控件)。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | ------------------------------------------------------------ | -| speed | number | 否 | 滑动速率,范围:200-15000,不在范围内设为默认值为600,单位:像素点/秒。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let scrollBar = await driver.findComponent(ON.type('Scroll')); - await scrollBar.scrollToBottom(); -} -``` - -### dragTo9+ - -dragTo(target: Component): Promise\ - -将控件拖拽至目标控件处。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------------------------ | ---- | ---------- | -| target | [Component](#component9) | 是 | 目标控件。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let button = await driver.findComponent(ON.type('button')); - let text = await driver.findComponent(ON.text('hello world')); - await button.dragTo(text); - } -``` - -### pinchOut9+ - -pinchOut(scale: number): Promise\ - -将控件按指定的比例进行捏合放大。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | ---------------- | -| scale | number | 是 | 指定放大的比例。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let image = await driver.findComponent(ON.type('image')); - await image.pinchOut(1.5); - } -``` - -### pinchIn9+ - -pinchIn(scale: number): Promise\ - -将控件按指定的比例进行捏合缩小。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | ---------------- | -| scale | number | 是 | 指定缩小的比例。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let image = await driver.findComponent(ON.type('image')); - await image.pinchIn(0.5); - } -``` - -## Driver9+ - -Driver类为uitest测试框架的总入口,提供控件匹配/查找,按键注入,坐标点击/滑动,截图等能力。 -该类提供的方法除Driver.create()以外的所有方法都使用Promise方式作为异步方法,需使用await方式调用。 - -### create9+ - -static create(): Driver - -静态方法,构造一个Driver对象,并返回该对象。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| -------- | ---------------------- | -| Driver | 返回构造的Driver对象。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ------------------ | -| 17000001 | Initialize failed. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); -} -``` - -### delayMs9+ - -delayMs(duration: number): Promise\ - -Driver对象在给定的时间内延时。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------ | ---- | ---------------------- | -| duration | number | 是 | 给定的时间,单位:ms。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - await driver.delayMs(1000); -} -``` - -### findComponent9+ - -findComponent(on: On): Promise\ - -在Driver对象中,根据给出的目标控件属性要求查找目标控件。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ---------- | ---- | -------------------- | -| on | [On](#on9) | 是 | 目标控件的属性要求。 | - -**返回值:** - -| 类型 | 说明 | -| ---------------------------------- | --------------------------------- | -| Promise\<[Component](#component9)> | 以Promise形式返回找到的控件对象。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let button = await driver.findComponent(ON.text('next page')); -} -``` - -### findComponents9+ - -findComponents(on: On): Promise\> - -在Driver对象中,根据给出的目标控件属性要求查找出所有匹配控件,以列表保存。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ---------- | ---- | -------------------- | -| on | [On](#on9) | 是 | 目标控件的属性要求。 | - -**返回值:** - -| 类型 | 说明 | -| ------------------------------------------ | --------------------------------------- | -| Promise\> | 以Promise形式返回找到的控件对象的列表。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let buttonList = await driver.findComponents(ON.text('next page')); -} -``` - -### findWindow9+ - -findWindow(filter: WindowFilter): Promise\ - -通过指定窗口的属性来查找目标窗口。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------------------------------ | ---- | ---------------- | -| filter | [WindowFilter](#windowfilter9) | 是 | 目标窗口的属性。 | - -**返回值:** - -| 类型 | 说明 | -| -------------------------------- | ------------------------------------- | -| Promise\<[UiWindow](#uiwindow9)> | 以Promise形式返回找到的目标窗口对象。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let window = await driver.findWindow({actived: true}); -} -``` - -### waitForComponent9+ - -waitForComponent(on: On, time: number): Promise\ - -在Driver对象中,在用户给定的时间内,持续查找满足控件属性要求的目标控件。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ---------- | ---- | -------------------------------- | -| On | [On](#on9) | 是 | 目标控件的属性要求。 | -| time | number | 是 | 查找目标控件的持续时间。单位ms。 | - -**返回值:** - -| 类型 | 说明 | -| --------------------------------- | --------------------------------- | -| Promise\<[Component](#component)> | 以Promise形式返回找到的控件对象。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let button = await driver.waitForComponent(ON.text('next page'),500); -} -``` - -### assertComponentExist9+ - -assertComponentExist(on: On): Promise\ - -断言API,用于断言当前界面是否存在满足给出的目标属性的控件。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ---------- | ---- | -------------------- | -| on | [On](#on9) | 是 | 目标控件的属性要求。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000003 | Component existence assertion failed. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - await driver.assertComponentExist(ON.text('next page')); -} -``` - -### pressBack9+ - -pressBack(): Promise\ - -Driver对象进行点击BACK键的操作。 - -**系统能力**:SystemCapability.Test.UiTest - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - await driver.pressBack(); -} -``` - -### triggerKey9+ - -triggerKey(keyCode: number): Promise\ - -Driver对象采取如下操作:传入key值实现模拟点击对应按键的效果。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------- | ------ | ---- | ------------- | -| keyCode | number | 是 | 指定的key值。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - await driver.triggerKey(123); -} -``` - -### triggerCombineKeys9+ - -triggerCombineKeys(key0: number, key1: number, key2?: number): Promise\ - -Driver对象通过给定的key值,找到对应组合键并点击。例如,Key值为(2072, 2019)时,Driver对象找到key值对应的组合键并点击,如ctrl+c。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | ------------------- | -| key0 | number | 是 | 指定的第一个key值。 | -| key1 | number | 是 | 指定的第二个key值。 | -| key2 | number | 否 | 指定的第三个key值。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - await driver.triggerCombineKeys(2072, 2047, 2035); -} -``` - - -### click9+ - -click(x: number, y: number): Promise\ - -Driver对象采取如下操作:在目标坐标点单击。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | -------------------------------------- | -| x | number | 是 | 以number的形式传入目标点的横坐标信息。 | -| y | number | 是 | 以number的形式传入目标点的纵坐标信息。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - await driver.click(100,100); -} -``` - -### doubleClick9+ - -doubleClick(x: number, y: number): Promise\ - -Driver对象采取如下操作:在目标坐标点双击。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | -------------------------------------- | -| x | number | 是 | 以number的形式传入目标点的横坐标信息。 | -| y | number | 是 | 以number的形式传入目标点的纵坐标信息。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - await driver.doubleClick(100,100); -} -``` - -### longClick9+ - -longClick(x: number, y: number): Promise\ - -Driver对象采取如下操作:在目标坐标点长按。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | -------------------------------------- | -| x | number | 是 | 以number的形式传入目标点的横坐标信息。 | -| y | number | 是 | 以number的形式传入目标点的纵坐标信息。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - await driver.longClick(100,100); -} -``` - -### swipe9+ - -swipe(startx: number, starty: number, endx: number, endy: number, speed?: number): Promise\ - -Driver对象采取如下操作:从起始坐标点滑向目的坐标点。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | ------------------------------------------------------------ | -| startx | number | 是 | 以number的形式传入起始点的横坐标信息。 | -| starty | number | 是 | 以number的形式传入起始点的纵坐标信息。 | -| endx | number | 是 | 以number的形式传入目的点的横坐标信息。 | -| endy | number | 是 | 以number的形式传入目的点的纵坐标信息。 | -| speed | number | 否 | 滑动速率,范围:200-15000,不在范围内设为默认值为600,单位:像素点/秒。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - await driver.swipe(100,100,200,200,600); -} -``` - -### drag9+ - -drag(startx: number, starty: number, endx: number, endy: number, speed?: number): Promise\ - -Driver对象采取如下操作:从起始坐标点拖拽至目的坐标点。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | ------------------------------------------------------------ | -| startx | number | 是 | 以number的形式传入起始点的横坐标信息。 | -| starty | number | 是 | 以number的形式传入起始点的纵坐标信息。 | -| endx | number | 是 | 以number的形式传入目的点的横坐标信息。 | -| endy | number | 是 | 以number的形式传入目的点的纵坐标信息。 | -| speed | number | 否 | 滑动速率,范围:200-15000,不在范围内设为默认值为600,单位:像素点/秒。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - await driver.drag(100,100,200,200,600); -} -``` - -### screenCap9+ - -screenCap(savePath: string): Promise\ - -Driver对象采取如下操作:捕获当前屏幕,并保存为PNG格式的图片至给出的保存路径中。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------ | ---- | -------------- | -| savePath | string | 是 | 文件保存路径。 | - -**返回值:** - -| 类型 | 说明 | -| ----------------- | -------------------------------------- | -| Promise\ | 截图操作是否成功完成。成功完成为true。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - await driver.screenCap('/local/tmp/1.png'); -} -``` - -### setDisplayRotation9+ - -setDisplayRotation(rotation: DisplayRotation): Promise\ - -将设备的屏幕显示方向设置为指定的显示方向。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------------------------------------ | ---- | ---------------- | -| rotation | [DisplayRotation](#displayrotation9) | 是 | 设备的显示方向。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - await driver.setDisplayRotation(DisplayRotation.ROTATION_180); -} -``` - -### getDisplayRotation9+ - -getDisplayRotation(): Promise\ - -获取当前设备的屏幕显示方向。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| ---------------------------------------------- | --------------------------------------- | -| Promise\<[DisplayRotation](#displayrotation9)> | 以Promise的形式返回当前设备的显示方向。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let rotation = await driver.getDisplayRotation(); -} -``` - -### setDisplayRotationEnabled9+ - -setDisplayRotationEnabled(enabled: boolean): Promise\ - -启用/禁用设备旋转屏幕的功能。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------- | ------- | ---- | ------------------------------------------------------- | -| enabled | boolean | 是 | 能否旋转屏幕的标识,true:可以旋转,false:不可以旋转。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - await driver.setDisplayRotationEnabled(false); -} -``` - -### getDisplaySize9+ - -getDisplaySize(): Promise\ - -获取当前设备的屏幕大小。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| -------------------------- | --------------------------------------- | -| Promise\<[Point](#point9)> | 以Promise的形式返回当前设备的屏幕大小。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let size = await driver.getDisplaySize(); -} -``` - -### getDisplayDensity9+ - -getDisplayDensity(): Promise\ - -获取当前设备屏幕的分辨率。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| -------------------------- | ----------------------------------------- | -| Promise\<[Point](#point9)> | 以Promise的形式返回当前设备屏幕的分辨率。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let density = await driver.getDisplayDensity(); -} -``` - -### wakeUpDisplay9+ - -wakeUpDisplay(): Promise\ - -唤醒当前设备即设备亮屏。 - -**系统能力**:SystemCapability.Test.UiTest - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - await driver.wakeUpDisplay(); -} -``` - -### pressHome9+ - -pressHome(): Promise\ - -设备返回到桌面。 - -**系统能力**:SystemCapability.Test.UiTest - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - await driver.pressHome(); -} -``` - -### waitForIdle9+ - -waitForIdle(idleTime: number, timeout: number): Promise\ - -判断当前界面的所有控件是否已经空闲。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------ | ---- | ------------------------------------------------------------ | -| idleTime | number | 是 | 空闲时间的阈值。在这个时间段控件不发生变化,视为该控件空闲,单位:毫秒。 | -| timeout | number | 是 | 等待空闲的最大时间,单位:毫秒。 | - -**返回值:** - -| 类型 | 说明 | -| ----------------- | --------------------------------------------------- | -| Promise\ | 以Promise的形式返回当前界面的所有控件是否已经空闲。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let idled = await driver.waitForIdle(4000,5000); -} -``` - -### fling9+ - -fling(from: Point, to: Point, stepLen: number, speed: number): Promise\ - -模拟手指滑动后脱离屏幕的快速滑动操作。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------- | ---------------- | ---- | ------------------------------------------------------------ | -| from | [Point](#point9) | 是 | 手指接触屏幕的起始点坐标。 | -| to | [Point](#point9) | 是 | 手指离开屏幕时的坐标点。 | -| stepLen | number | 是 | 间隔距离,单位:像素点。 | -| speed | number | 是 | 滑动速率,范围:200-15000,不在范围内设为默认值为600,单位:像素点/秒。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - await driver.fling({X: 500, Y: 480},{X: 450, Y: 480},5,600); -} -``` - -### injectMultiPointerAction9+ - -injectMultiPointerAction(pointers: PointerMatrix, speed?: number): Promise\ - -向设备注入多指操作。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------------------------------- | ---- | ------------------------------------------------------------ | -| pointers | [PointerMatrix](#pointermatrix9) | 是 | 滑动轨迹,包括操作手指个数和滑动坐标序列。 | -| speed | number | 否 | 滑动速率,范围:200-15000,不在范围内设为默认值为600,单位:像素点/秒。 | - -**返回值:** - -| 类型 | 说明 | -| ----------------- | ------------------------------------- | -| Promise\ | 以Promise的形式返回操作是否成功完成。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let pointers = PointerMatrix.create(2,3); - pointers.setPoint(0,0,{X:230,Y:480}); - pointers.setPoint(0,1,{X:250,Y:380}); - pointers.setPoint(0,2,{X:270,Y:280}); - pointers.setPoint(1,0,{X:230,Y:680}); - pointers.setPoint(1,1,{X:240,Y:580}); - pointers.setPoint(1,2,{X:250,Y:480}); - await driver.injectMultiPointerAction(pointers); -} -``` - -## PointerMatrix9+ - -存储多指操作中每根手指每一步动作的坐标点及其行为的二维数组。 - -### create9+ - -static create(fingers: number, steps: number): PointerMatrix - -静态方法,构造一个PointerMatrix对象,并返回该对象。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------- | ------ | ---- | ------------------------------------------ | -| fingers | number | 是 | 多指操作中注入的手指数,取值范围:[1,10]。 | -| steps | number | 是 | 每根手指操作的步骤数,取值范围:[1,1000]。 | - -**返回值:** - -| 类型 | 说明 | -| -------------------------------- | ----------------------------- | -| [PointerMatrix](#pointermatrix9) | 返回构造的PointerMatrix对象。 | - -**示例:** - -```js -async function demo() { - let pointerMatrix = PointerMatrix.create(2,3); -} -``` - -### setPoint9+ - -setPoint(finger: number, step: number, point: Point): void - -设置PointerMatrix对象中指定手指和步骤对应动作的坐标点。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ---------------- | ---- | ---------------- | -| finger | number | 是 | 手指的序号。 | -| step | number | 是 | 步骤的序号。 | -| point | [Point](#point9) | 是 | 该行为的坐标点。 | - -**示例:** - -```js -async function demo() { - let pointers = PointerMatrix.create(2,3); - pointers.setPoint(0,0,{X:230,Y:480}); - pointers.setPoint(0,1,{X:250,Y:380}); - pointers.setPoint(0,2,{X:270,Y:280}); - pointers.setPoint(1,0,{X:230,Y:680}); - pointers.setPoint(1,1,{X:240,Y:580}); - pointers.setPoint(1,2,{X:250,Y:480}); -} -``` - -## UiWindow9+ - -UiWindow代表了UI界面上的一个窗口,提供窗口属性获取,窗口拖动、调整窗口大小等能力。 -该类提供的所有方法都使用Promise方式作为异步方法,需使用await方式调用。 - -### getBundleName9+ - -getBundleName(): Promise\ - -获取窗口归属应用的包名信息。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| ---------------- | ----------------------------------------- | -| Promise\ | 以Promise形式返回窗口归属应用的包名信息。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let window = await driver.findWindow({actived: true}); - let name = await window.getBundleName(); -} -``` - -### getBounds9+ - -getBounds(): Promise\ - -获取窗口的边框信息。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| ------------------------ | --------------------------------- | -| Promise\<[Rect](#rect9)> | 以Promise形式返回窗口的边框信息。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let window = await driver.findWindow({actived: true}); - let rect = await window.getBounds(); -} -``` - -### getTitle9+ - -getTitle(): Promise\ - -获取窗口的标题信息。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| ---------------- | --------------------------------- | -| Promise\ | 以Promise形式返回窗口的标题信息。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let window = await driver.findWindow({actived: true}); - let rect = await window.getTitle(); -} -``` - -### getWindowMode9+ - -getWindowMode(): Promise\ - -获取窗口的窗口模式信息。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| ------------------------------------ | ------------------------------------- | -| Promise\<[WindowMode](#windowmode9)> | 以Promise形式返回窗口的窗口模式信息。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let window = await driver.findWindow({actived: true}); - let mode = await window.getWindowMode(); -} -``` - -### isFocused9+ - -isFocused(): Promise\ - -判断窗口是否处于获焦状态。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| ----------------- | ------------------------------------------------------------ | -| Promise\ | 以Promise形式返回窗口对象是否获取获焦状态,true:获焦,false:未获焦。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let window = await driver.findWindow({actived: true}); - let focused = await window.isFocused(); -} -``` - -### isActived9+ - -isActived(): Promise\ - -判断窗口是否为用户正在交互窗口。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| ----------------- | ------------------------------------------------------------ | -| Promise\ | 以Promise形式返回窗口对象是否为用户正在交互窗口,true:交互窗口,false:非交互窗口。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let window = await driver.findWindow({actived: true}); - let focused = await window.isActived(); -} -``` - -### focus9+ - -focus(): Promise\ - -让窗口获焦。 - -**系统能力**:SystemCapability.Test.UiTest - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let window = await driver.findWindow({actived: true}); - await window.focus(); -} -``` - -### moveTo9+ - -moveTo(x: number, y: number): Promise\ - -将窗口移动到目标点。适用于支持移动的窗口。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | -------------------------------------- | -| x | number | 是 | 以number的形式传入目标点的横坐标信息。 | -| y | number | 是 | 以number的形式传入目标点的纵坐标信息。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | -| 17000005 | This operation is not supported. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let window = await driver.findWindow({actived: true}); - await window.moveTo(100, 100); -} -``` - -### resize9+ - -resize(wide: number, height: number, direction: ResizeDirection): Promise\ - -根据传入的宽、高和调整方向来调整窗口的大小。适用于支持调整大小的窗口。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| --------- | ------------------------------------ | ---- | ------------------------------------------------------------ | -| wide | number | 是 | 以number的形式传入调整后窗口的宽度。 | -| height | number | 是 | 以number的形式传入调整后窗口的高度。 | -| direction | [ResizeDirection](#resizedirection9) | 是 | 以[ResizeDirection](#resizedirection9)的形式传入窗口调整的方向。 | - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | -| 17000005 | This operation is not supported. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let window = await driver.findWindow({actived: true}); - await window.resize(100, 100, ResizeDirection.LEFT); -} -``` - -### split9+ - -split(): Promise\ - -将窗口模式切换成分屏模式。适用于支持切换分屏模式的窗口。 - -**系统能力**:SystemCapability.Test.UiTest - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | -| 17000005 | This operation is not supported. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let window = await driver.findWindow({actived: true}); - await window.split(); -} -``` - -### maximize9+ - -maximize(): Promise\ - -将窗口最大化。适用于支持窗口最大化操作的窗口。 - -**系统能力**:SystemCapability.Test.UiTest - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | -| 17000005 | This operation is not supported. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let window = await driver.findWindow({actived: true}); - await window.maximize(); -} -``` - -### minimize9+ - -minimize(): Promise\ - -将窗口最小化。适用于支持窗口最小化操作的窗口。 - -**系统能力**:SystemCapability.Test.UiTest - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | -| 17000005 | This operation is not supported. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let window = await driver.findWindow({actived: true}); - await window.minimize(); -} -``` - -### resume9+ - -resume(): Promise\ - -将窗口恢复到之前的窗口模式。 - -**系统能力**:SystemCapability.Test.UiTest - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | -| 17000005 | This operation is not supported. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let window = await driver.findWindow({actived: true}); - await window.resume(); -} -``` - -### close9+ - -close(): Promise\ - -将窗口关闭。 - -**系统能力**:SystemCapability.Test.UiTest - -**错误码:** - -以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 - -| 错误码ID | 错误信息 | -| -------- | ---------------------------------------- | -| 17000002 | API does not allow calling concurrently. | -| 17000004 | Component lost/UiWindow lost. | -| 17000005 | This operation is not supported. | - -**示例:** - -```js -async function demo() { - let driver = Driver.create(); - let window = await driver.findWindow({actived: true}); - await window.close(); -} -``` - -## By(deprecated) - -UiTest框架通过By类提供了丰富的控件特征描述API,用于进行控件筛选来匹配/查找出目标控件。
-By提供的API能力具有以下几个特点:
1、支持单属性匹配和多属性组合匹配,例如同时指定目标控件text和id。
2、控件属性支持多种匹配模式。
3、支持控件绝对定位,相对定位,可通过[By.isBefore(deprecated)](#isbeforedeprecated)和[By.isAfter(deprecated)](#isafterdeprecated)等API限定邻近控件特征进行辅助定位。
By类提供的所有API均为同步接口,建议使用者通过静态构造器BY来链式创建By对象。 - -从API version 9开始不再维护,建议使用[On9+](#on9)。 - -```js -BY.text('123').type('button'); -``` - -### text(deprecated) - -text(txt: string, pattern?: MatchPattern): By - -指定目标控件文本属性,支持多种匹配模式,返回By对象自身。 - -从API version 9开始不再维护,建议使用[text9+](#text9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------- | ----------------------------- | ---- | --------------------------------------------------- | -| txt | string | 是 | 指定控件文本,用于匹配目标控件文本。 | -| pattern | [MatchPattern](#matchpattern) | 否 | 指定的文本匹配模式,默认为[EQUALS](#matchpattern)。 | - -**返回值:** - -| 类型 | 说明 | -| ------------------- | ---------------------------------- | -| [By](#bydeprecated) | 返回指定目标控件文本属性的By对象。 | - -**示例:** - -```js -let by = BY.text('123'); // 使用静态构造器BY创建by对象,指定目标控件的text属性。 -``` - - -### key(deprecated) - -key(key: string): By - -指定目标控件key值属性,返回By对象自身。 - -从API version 9开始不再维护,建议使用[id9+](#id9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | ----------------- | -| key | string | 是 | 指定控件的Key值。 | - -**返回值:** - -| 类型 | 说明 | -| ------------------- | ----------------------------------- | -| [By](#bydeprecated) | 返回指定目标控件key值属性的By对象。 | - -**示例:** - -```js -let by = BY.key('123'); // 使用静态构造器BY创建by对象,指定目标控件的key值属性。 -``` - - -### id(deprecated) - -id(id: number): By - -指定目标控件id属性,返回By对象自身。 - -从API version 9开始废弃。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | ---------------- | -| id | number | 是 | 指定控件的id值。 | - -**返回值:** - -| 类型 | 说明 | -| ------------------- | -------------------------------- | -| [By](#bydeprecated) | 返回指定目标控件id属性的By对象。 | - -**示例:** - -```js -let by = BY.id(123); // 使用静态构造器BY创建by对象,指定目标控件的id属性。 -``` - - -### type(deprecated) - -type(tp: string): By - -指定目标控件的控件类型属性,返回By对象自身。 - -从API version 9开始不再维护,建议使用[type9+](#type9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | -------------- | -| tp | string | 是 | 指定控件类型。 | - -**返回值:** - -| 类型 | 说明 | -| ------------------- | ---------------------------------------- | -| [By](#bydeprecated) | 返回指定目标控件的控件类型属性的By对象。 | - -**示例:** - -```js -let by = BY.type('button'); // 使用静态构造器BY创建by对象,指定目标控件的控件类型属性。 -``` - - -### clickable(deprecated) - -clickable(b?: boolean): By - -指定目标控件的可点击状态属性,返回By对象自身。 - -从API version 9开始不再维护,建议使用[clickable9+](#clickable9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------- | ---- | ------------------------------------------------------------ | -| b | boolean | 否 | 指定控件可点击状态,true:可点击,false:不可点击。默认为true。 | - -**返回值:** - -| 类型 | 说明 | -| ------------------- | ------------------------------------------ | -| [By](#bydeprecated) | 返回指定目标控件的可点击状态属性的By对象。 | - -**示例:** - -```js -let by = BY.clickable(true); // 使用静态构造器BY创建by对象,指定目标控件的可点击状态属性。 -``` - - -### scrollable(deprecated) - -scrollable(b?: boolean): By - -指定目标控件的可滑动状态属性,返回By对象自身。 - -从API version 9开始不再维护,建议使用[scrollable9+](#scrollable9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------- | ---- | ----------------------------------------------------------- | -| b | boolean | 否 | 控件可滑动状态,true:可滑动,false:不可滑动。默认为true。 | - -**返回值:** - -| 类型 | 说明 | -| ------------------- | ------------------------------------------ | -| [By](#bydeprecated) | 返回指定目标控件的可滑动状态属性的By对象。 | - -**示例:** - -```js -let by = BY.scrollable(true); // 使用静态构造器BY创建by对象,指定目标控件的可滑动状态属性。 -``` - -### enabled(deprecated) - -enabled(b?: boolean): By - -指定目标控件的使能状态属性,返回By对象自身。 - -从API version 9开始不再维护,建议使用[enabled9+](#enabled9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------- | ---- | --------------------------------------------------------- | -| b | boolean | 否 | 指定控件使能状态,true:使能,false:未使能。默认为true。 | - -**返回值:** - -| 类型 | 说明 | -| ------------------- | ---------------------------------------- | -| [By](#bydeprecated) | 返回指定目标控件的使能状态属性的By对象。 | - -**示例:** - -```js -let by = BY.enabled(true); // 使用静态构造器BY创建by对象,指定目标控件的使能状态属性。 -``` - -### focused(deprecated) - -focused(b?: boolean): By - -指定目标控件的获焦状态属性,返回By对象自身。 - -从API version 9开始不再维护,建议使用[focused9+](#focused9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------- | ---- | ----------------------------------------------------- | -| b | boolean | 否 | 控件获焦状态,true:获焦,false:未获焦。默认为true。 | - -**返回值:** - -| 类型 | 说明 | -| ------------------- | ---------------------------------------- | -| [By](#bydeprecated) | 返回指定目标控件的获焦状态属性的By对象。 | - -**示例:** - -```js -let by = BY.focused(true); // 使用静态构造器BY创建by对象,指定目标控件的获焦状态属性。 -``` - -### selected(deprecated) - -selected(b?: boolean): By - -指定目标控件的被选中状态属性,返回By对象自身。 - -从API version 9开始不再维护,建议使用[selected9+](#selected9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------- | ---- | ------------------------------------------------------------ | -| b | boolean | 否 | 指定控件被选中状态,true:被选中,false:未被选中。默认为true。 | - -**返回值:** - -| 类型 | 说明 | -| ------------------- | ------------------------------------------ | -| [By](#bydeprecated) | 返回指定目标控件的被选中状态属性的By对象。 | - -**示例:** - -```js -let by = BY.selected(true); // 使用静态构造器BY创建by对象,指定目标控件的被选中状态属性。 -``` - -### isBefore(deprecated) - -isBefore(by: By): By - -指定目标控件位于给出的特征属性控件之前,返回By对象自身。 - -从API version 9开始不再维护,建议使用[isBefore9+](#isbefore9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------------------- | ---- | ---------------- | -| by | [By](#bydeprecated) | 是 | 特征控件的属性。 | - -**返回值:** - -| 类型 | 说明 | -| ------------------- | ---------------------------------------------------- | -| [By](#bydeprecated) | 返回指定目标控件位于给出的特征属性控件之前的By对象。 | - -**示例:** - -```js -let by = BY.isBefore(BY.text('123')); // 使用静态构造器BY创建by对象,指定目标控件位于给出的特征属性控件之前。 -``` - -### isAfter(deprecated) - -isAfter(by: By): By - -指定目标控件位于给出的特征属性控件之后,返回By对象自身。 - -从API version 9开始不再维护,建议使用[isAfter9+](#isafter9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------------------- | ---- | ---------------- | -| by | [By](#bydeprecated) | 是 | 特征控件的属性。 | - -**返回值:** - -| 类型 | 说明 | -| ------------------- | ---------------------------------------------------- | -| [By](#bydeprecated) | 返回指定目标控件位于给出的特征属性控件之后的By对象。 | - -**示例:** - -```js -let by = BY.isAfter(BY.text('123')); // 使用静态构造器BY创建by对象,指定目标控件位于给出的特征属性控件之后。 -``` - -## UiComponent(deprecated) - -UiTest中,UiComponent类代表了UI界面上的一个控件,提供控件属性获取,控件点击,滑动查找,文本注入等API。 -该类提供的所有方法都使用Promise方式作为异步方法,需使用await调用。 - -从API version 9开始不再维护,建议使用[Component9+](#component9)。 - -### click(deprecated) - -click(): Promise\ - -控件对象进行点击操作。 - -从API version 9开始不再维护,建议使用[click9+](#click9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**示例:** - -```js -async function demo() { - let driver = UiDriver.create(); - let button = await driver.findComponent(BY.type('button')); - await button.click(); -} -``` - -### doubleClick(deprecated) - -doubleClick(): Promise\ - -控件对象进行双击操作。 - -从API version 9开始不再维护,建议使用[doubleClick9+](#doubleclick9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**示例:** - -```js -async function demo() { - let driver = UiDriver.create(); - let button = await driver.findComponent(BY.type('button')); - await button.doubleClick(); -} -``` - -### longClick(deprecated) - -longClick(): Promise\ - -控件对象进行长按操作。 - -从API version 9开始不再维护,建议使用[longClick9+](#longclick9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**示例:** - -```js -async function demo() { - let driver = UiDriver.create(); - let button = await driver.findComponent(BY.type('button')); - await button.longClick(); -} -``` - -### getId(deprecated) - -getId(): Promise\ - -获取控件对象的id值。 - -从API version 9开始不再维护,被废弃。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| ---------------- | ------------------------------- | -| Promise\ | 以Promise形式返回的控件的id值。 | - -**示例:** - -```js -async function demo() { - let driver = UiDriver.create(); - let button = await driver.findComponent(BY.type('button')); - let num = await button.getId(); -} -``` - -### getKey(deprecated) - -getKey(): Promise\ - -获取控件对象的key值。 - -从API version 9开始不再维护,建议使用[getId9+](#getid9) - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| ---------------- | ------------------------------ | -| Promise\ | 以Promise形式返回控件的key值。 | - -**示例:** - -```js -async function demo() { - let driver = UiDriver.create(); - let button = await driver.findComponent(BY.type('button')); - let str_key = await button.getKey(); -} -``` - -### getText(deprecated) - -getText(): Promise\ - -获取控件对象的文本信息。 - -从API version 9开始不再维护,建议使用[getText9+](#gettext9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| ---------------- | --------------------------------- | -| Promise\ | 以Promise形式返回控件的文本信息。 | - -**示例:** - -```js -async function demo() { - let driver = UiDriver.create(); - let button = await driver.findComponent(BY.type('button')); - let text = await button.getText(); -} -``` - -### getType(deprecated) - -getType(): Promise\ - -获取控件对象的控件类型。 - -从API version 9开始不再维护,建议使用[getType9+](#gettype9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| ---------------- | ----------------------------- | -| Promise\ | 以Promise形式返回控件的类型。 | - -**示例:** - -```js -async function demo() { - let driver = UiDriver.create(); - let button = await driver.findComponent(BY.type('button')); - let type = await button.getType(); -} -``` - -### isClickable(deprecated) - -isClickable(): Promise\ - -获取控件对象可点击状态。 - -从API version 9开始不再维护,建议使用[isClickable9+](#isclickable9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| ----------------- | ------------------------------------------------------------ | -| Promise\ | 以Promise形式返回控件对象可点击状态,true:可点击,false:不可点击。 | - -**示例:** - -```js -async function demo() { - let driver = UiDriver.create(); - let button = await driver.findComponent(BY.type('button')); - if(await button.isClickable()) { - console.info('This button can be Clicked'); - } else { - console.info('This button can not be Clicked'); - } -} -``` - -### isScrollable(deprecated) - -isScrollable(): Promise\ - -获取控件对象可滑动状态。 - -从API version 9开始不再维护,建议使用[isScrollable9+](#isscrollable9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| ----------------- | ------------------------------------------------------------ | -| Promise\ | 以Promise形式返回控件对象可滑动状态,true:可滑动,false:不可滑动。 | - -**示例:** - -```js -async function demo() { - let driver = UiDriver.create(); - let scrollBar = await driver.findComponent(BY.scrollable(true)); - if(await scrollBar.isScrollable()) { - console.info('This scrollBar can be operated'); - } else { - console.info('This scrollBar can not be operated'); - } -} -``` - - -### isEnabled(deprecated) - -isEnabled(): Promise\ - -获取控件使能状态。 - -从API version 9开始不再维护,建议使用[isEnabled9+](#isenabled9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| ----------------- | ---------------------------------------------------------- | -| Promise\ | 以Promise形式返回控件使能状态,true:使能,false:未使能。 | - -**示例:** - -```js -async function demo() { - let driver = UiDriver.create(); - let button = await driver.findComponent(BY.type('button')); - if(await button.isEnabled()) { - console.info('This button can be operated'); - } else { - console.info('This button can not be operated'); - } -} - -``` - -### isFocused(deprecated) - -isFocused(): Promise\ - -判断控件对象是否获焦。 - -从API version 9开始不再维护,建议使用[isFocused9+](#isfocused9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| ----------------- | ------------------------------------------------------------ | -| Promise\ | 以Promise形式返回控件对象是否获焦,true:获焦,false:未获焦。 | - -**示例:** - -```js -async function demo() { - let driver = UiDriver.create(); - let button = await driver.findComponent(BY.type('button')); - if(await button.isFocused()) { - console.info('This button is focused'); - } else { - console.info('This button is not focused'); - } -} -``` - -### isSelected(deprecated) - -isSelected(): Promise\ - -获取控件对象被选中状态。 - -从API version 9开始不再维护,建议使用[isSelected9+](#isselected9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| ----------------- | ----------------------------------------------------- | -| Promise\ | 控件对象被选中的状态,true:被选中,false:未被选中。 | - -**示例:** - -```js -async function demo() { - let driver = UiDriver.create(); - let button = await driver.findComponent(BY.type('button')); - if(await button.isSelected()) { - console.info('This button is selected'); - } else { - console.info('This button is not selected'); - } -} -``` - -### inputText(deprecated) - -inputText(text: string): Promise\ - -向控件中输入文本(适用于文本框控件)。 - -从API version 9开始不再维护,建议使用[inputText9+](#inputtext9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | ---------------- | -| text | string | 是 | 输入的文本信息。 | - -**示例:** - -```js -async function demo() { - let driver = UiDriver.create(); - let text = await driver.findComponent(BY.text('hello world')); - await text.inputText('123'); -} -``` - -### scrollSearch(deprecated) - -scrollSearch(by: By): Promise\ - -在控件上滑动查找目标控件(适用于List等支持滑动的控件)。 - -从API version 9开始不再维护,建议使用[scrollSearch9+](#scrollsearch9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------------------- | ---- | -------------------- | -| by | [By](#bydeprecated) | 是 | 目标控件的属性要求。 | - -**返回值:** - -| 类型 | 说明 | -| ----------------------------------------------- | ------------------------------------- | -| Promise\<[UiComponent](#uicomponentdeprecated)> | 以Promise形式返回找到的目标控件对象。 | - -**示例:** - -```js -async function demo() { - let driver = UiDriver.create(); - let scrollBar = await driver.findComponent(BY.type('Scroll')); - let button = await scrollBar.scrollSearch(BY.text('next page')); -} -``` - -## UiDriver(deprecated) - -UiDriver类为uitest测试框架的总入口,提供控件匹配/查找,按键注入,坐标点击/滑动,截图等API。 -该类提供的方法除UiDriver.create()以外的所有方法都使用Promise方式作为异步方法,需使用await调用。 - -从API version 9开始不再维护,建议使用[Driver9+](#driver9)。 - -### create(deprecated) - -static create(): UiDriver - -静态方法,构造一个UiDriver对象,并返回该对象。 - -从API version 9开始不再维护,建议使用[create9+](#create9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**返回值:** - -| 类型 | 说明 | -| -------- | ------------------------ | -| UiDriver | 返回构造的UiDriver对象。 | - -**示例:** - -```js -async function demo() { - let driver = UiDriver.create(); -} -``` - -### delayMs(deprecated) - -delayMs(duration: number): Promise\ - -UiDriver对象在给定的时间内延时。 - -从API version 9开始不再维护,建议使用[delayMs9+](#delayms9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------ | ---- | ------------ | -| duration | number | 是 | 给定的时间。 | - -**示例:** - -```js -async function demo() { - let driver = UiDriver.create(); - await driver.delayMs(1000); -} -``` - -### findComponent(deprecated) - -findComponent(by: By): Promise\ - -在UiDriver对象中,根据给出的目标控件属性要求查找目标控件。 - -从API version 9开始不再维护,建议使用[findComponent9+](#findcomponent9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------------------- | ---- | -------------------- | -| by | [By](#bydeprecated) | 是 | 目标控件的属性要求。 | - -**返回值:** - -| 类型 | 说明 | -| ----------------------------------------------- | --------------------------------- | -| Promise\<[UiComponent](#uicomponentdeprecated)> | 以Promise形式返回找到的控件对象。 | - -**示例:** - -```js -async function demo() { - let driver = UiDriver.create(); - let button = await driver.findComponent(BY.text('next page')); -} -``` - -### findComponents(deprecated) - -findComponents(by: By): Promise\> - -在UiDriver对象中,根据给出的目标控件属性要求查找出所有匹配控件,以列表保存。 - -从API version 9开始不再维护,建议使用[findComponents9+](#findcomponents9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------------------- | ---- | -------------------- | -| by | [By](#bydeprecated) | 是 | 目标控件的属性要求。 | - -**返回值:** - -| 类型 | 说明 | -| ------------------------------------------------------- | --------------------------------------- | -| Promise\> | 以Promise形式返回找到的控件对象的列表。 | - -**示例:** - -```js -async function demo() { - let driver = UiDriver.create(); - let buttonList = await driver.findComponents(BY.text('next page')); -} -``` - -### assertComponentExist(deprecated) - -assertComponentExist(by: By): Promise\ - -断言API,用于断言当前界面存在满足给出的目标控件属性的控件; 如果控件不存在,该API将抛出JS异常,使当前测试用例失败。 - -从API version 9开始不再维护,建议使用[assertComponentExist9+](#assertcomponentexist9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------------------- | ---- | -------------------- | -| by | [By](#bydeprecated) | 是 | 目标控件的属性要求。 | - -**示例:** - -```js -async function demo() { - let driver = UiDriver.create(); - await driver.assertComponentExist(BY.text('next page')); -} -``` - -### pressBack(deprecated) - -pressBack(): Promise\ - -UiDriver对象进行点击BACK键的操作。 - -从API version 9开始不再维护,建议使用[pressBack9+](#pressback9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**示例:** - -```js -async function demo() { - let driver = UiDriver.create(); - await driver.pressBack(); -} -``` - -### triggerKey(deprecated) - -triggerKey(keyCode: number): Promise\ - -UiDriver对象采取如下操作:通过key值找到对应键并点击。 - -从API version 9开始不再维护,建议使用[triggerKey9+](#triggerkey9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------- | ------ | ---- | ------------- | -| keyCode | number | 是 | 指定的key值。 | - -**示例:** - -```js -async function demo() { - let driver = UiDriver.create(); - await driver.triggerKey(123); -} -``` - - -### click(deprecated) - -click(x: number, y: number): Promise\ - -UiDriver对象采取如下操作:在目标坐标点单击。 - -从API version 9开始不再维护,建议使用[click9+](#click9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | -------------------------------------- | -| x | number | 是 | 以number的形式传入目标点的横坐标信息。 | -| y | number | 是 | 以number的形式传入目标点的纵坐标信息。 | - -**示例:** - -```js -async function demo() { - let driver = UiDriver.create(); - await driver.click(100,100); -} -``` - -### doubleClick(deprecated) - -doubleClick(x: number, y: number): Promise\ - -UiDriver对象采取如下操作:在目标坐标点双击。 - -从API version 9开始不再维护,建议使用[doubleClick9+](#doubleclick9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | -------------------------------------- | -| x | number | 是 | 以number的形式传入目标点的横坐标信息。 | -| y | number | 是 | 以number的形式传入目标点的纵坐标信息。 | - -**示例:** - -```js -async function demo() { - let driver = UiDriver.create(); - await driver.doubleClick(100,100); -} -``` - -### longClick(deprecated) - -longClick(x: number, y: number): Promise\ - -UiDriver对象采取如下操作:在目标坐标点长按下鼠标左键。 - -从API version 9开始不再维护,建议使用[longClick9+](#longclick9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | -------------------------------------- | -| x | number | 是 | 以number的形式传入目标点的横坐标信息。 | -| y | number | 是 | 以number的形式传入目标点的纵坐标信息。 | - -**示例:** - -```js -async function demo() { - let driver = UiDriver.create(); - await driver.longClick(100,100); -} -``` - -### swipe(deprecated) - -swipe(startx: number, starty: number, endx: number, endy: number): Promise\ - -UiDriver对象采取如下操作:从给出的起始坐标点滑向给出的目的坐标点。 - -从API version 9开始不再维护,建议使用[swipe9+](#swipe9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | -------------------------------------- | -| startx | number | 是 | 以number的形式传入起始点的横坐标信息。 | -| starty | number | 是 | 以number的形式传入起始点的纵坐标信息。 | -| endx | number | 是 | 以number的形式传入目的点的横坐标信息。 | -| endy | number | 是 | 以number的形式传入目的点的纵坐标信息。 | - -**示例:** - -```js -async function demo() { - let driver = UiDriver.create(); - await driver.swipe(100,100,200,200); -} -``` - -### screenCap(deprecated) - -screenCap(savePath: string): Promise\ - -UiDriver对象采取如下操作:捕获当前屏幕,并保存为PNG格式的图片至给出的保存路径中。 - -从API version 9开始不再维护,建议使用[screenCap9+](#screencap9)。 - -**系统能力**:SystemCapability.Test.UiTest - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------ | ---- | -------------- | -| savePath | string | 是 | 文件保存路径。 | - -**返回值:** - -| 类型 | 说明 | -| ----------------- | -------------------------------------- | -| Promise\ | 截图操作是否成功完成。成功完成为true。 | - -**示例:** - -```js -async function demo() { - let driver = UiDriver.create(); - await driver.screenCap('/local/tmp/1.png'); -} -``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-ability-ability.md b/zh-cn/application-dev/reference/apis/js-apis-ability-ability.md index 2ec899589fce0fd7deb34e659ed1261c23bd6a6c..18c89d87f89719c70a87007b7abe72f5f10a913d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-ability-ability.md +++ b/zh-cn/application-dev/reference/apis/js-apis-ability-ability.md @@ -15,15 +15,15 @@ import ability from '@ohos.ability.ability'; **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityBase -| 名称 | 类型 | 必填 | 描述 | -| ----------- | -------------------- | ---- | ------------------------------------------------------------ | -| DataAbilityHelper | [DataAbilityHelper](js-apis-inner-ability-dataAbilityHelper.md) | 否 | DataAbilityHelper二级模块。 | -| PacMap | [PacMap](js-apis-inner-ability-dataAbilityHelper.md#PacMap) | 否 | PacMap二级模块。 | -| DataAbilityOperation | [DataAbilityOperation](js-apis-inner-ability-dataAbilityOperation.md) | 否 | DataAbilityOperation二级模块。 | -| DataAbilityResult | [DataAbilityResult](js-apis-inner-ability-dataAbilityResult.md) | 否 | DataAbilityResult二级模块。 | -| AbilityResult | [AbilityResult](js-apis-inner-ability-abilityResult.md) | 否 | AbilityResult二级模块。 | -| ConnectOptions | [ConnectOptions](js-apis-inner-ability-connectOptions.md) | 否 | ConnectOptions二级模块。 | -| StartAbilityParameter | [StartAbilityParameter](js-apis-inner-ability-startAbilityParameter.md) | 否 | StartAbilityParameter二级模块。 | +| 名称 | 类型 | 描述 | +| ----------- | -------------------- | ------------------------------------------------------------ | +| DataAbilityHelper | [DataAbilityHelper](js-apis-inner-ability-dataAbilityHelper.md) | DataAbilityHelper二级模块。 | +| PacMap | [PacMap](js-apis-inner-application-pacMap.md) | PacMap二级模块。 | +| DataAbilityOperation | [DataAbilityOperation](js-apis-inner-ability-dataAbilityOperation.md) | DataAbilityOperation二级模块。 | +| DataAbilityResult | [DataAbilityResult](js-apis-inner-ability-dataAbilityResult.md) | DataAbilityResult二级模块。 | +| AbilityResult | [AbilityResult](js-apis-inner-ability-abilityResult.md) | AbilityResult二级模块。 | +| ConnectOptions | [ConnectOptions](js-apis-inner-ability-connectOptions.md) | ConnectOptions二级模块。 | +| StartAbilityParameter | [StartAbilityParameter](js-apis-inner-ability-startAbilityParameter.md) | StartAbilityParameter二级模块。 | **示例:** ```ts 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 4fd64c90d6b8a6b86af701e9fc3d093ab011ca76..606805cd391f69e7eb471522a05626c3f746b7e7 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,13 +46,6 @@ want操作的常数。用于表示要执行的通用操作。 | ACTION_FILE_SELECT7+ | ohos.action.fileSelect | 指示选择文件的操作。 | | PARAMS_STREAM7+ | ability.params.stream | 指示发送数据时与目标关联的数据流的URI。对应的value必须是string类型的数组。 | | ACTION_APP_ACCOUNT_OAUTH 8+ | ohos.account.appAccount.action.oauth | 指示提供oauth服务的操作。 | -| ACTION_APP_ACCOUNT_AUTH 9+ | account.appAccount.action.auth | 指示提供auth服务的操作。 | -| ACTION_MARKET_DOWNLOAD 9+ | ohos.want.action.marketDownload | 表示从应用程序市场下载应用程序的的操作。
**系统API**:该接口为系统接口,三方应用不支持调用。 | -| ACTION_MARKET_CROWDTEST 9+ | ohos.want.action.marketCrowdTest | 指示从应用程序市场众测应用程序的操作。
**系统API**:该接口为系统接口,三方应用不支持调用。 | -| DLP_PARAMS_SANDBOX9+ |ohos.dlp.params.sandbox | 指示沙盒标志的参数的操作。
**系统API**:该接口为系统接口,三方应用不支持调用。 | -| DLP_PARAMS_BUNDLE_NAME9+ |ohos.dlp.params.bundleName |指示DLP Bundle名称的参数的操作。
**系统API**:该接口为系统接口,三方应用不支持调用。 | -| DLP_PARAMS_MODULE_NAME9+ |ohos.dlp.params.moduleName |指示DLP模块名称的参数的操作。
**系统API**:该接口为系统接口,三方应用不支持调用。 | -| DLP_PARAMS_ABILITY_NAME9+ |ohos.dlp.params.abilityName |指示DLP能力名称的参数的操作。
**系统API**:该接口为系统接口,三方应用不支持调用。 | | DLP_PARAMS_INDEX9+ |ohos.dlp.params.index |指示DLP索引参数的操作。
**系统API**:该接口为系统接口,三方应用不支持调用。 | ## wantConstant.Entity @@ -91,6 +84,6 @@ Flags说明。用于表示处理Want的方式。 | FLAG_ABILITY_CONTINUATION_REVERSIBLE | 0x00000400 | 表示迁移是可拉回的。
**系统API**: 此接口为系统接口,三方应用不支持调用。 | | FLAG_INSTALL_ON_DEMAND | 0x00000800 | 如果未安装指定的功能,请安装该功能。 | | FLAG_INSTALL_WITH_BACKGROUND_MODE | 0x80000000 | 如果未安装,使用后台模式安装该功能。 | -| FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | 指示清除其他任务的操作。可以为传递给 **[ohos.app.Context](js-apis-ability-context.md)** 中**startAbility**方法的**Want**设置此标志,并且必须与**flag_ABILITY_NEW_MISSION**一起使用。 | +| FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | 指示清除其他任务的操作。可以为传递给 **FeatureAbility** 中[startAbility](js-apis-ability-featureAbility.md#startability)方法的**Want**设置此标志,并且必须与**flag_ABILITY_NEW_MISSION**一起使用。 | | FLAG_ABILITY_NEW_MISSION | 0x10000000 | 指示在历史任务堆栈上创建任务的操作。 | | FLAG_ABILITY_MISSION_TOP | 0x20000000 | 指示如果启动能力的现有实例已位于任务堆栈的顶部,则将重用该实例。否则,将创建一个新的能力实例。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-abilityAccessCtrl.md b/zh-cn/application-dev/reference/apis/js-apis-abilityAccessCtrl.md index 9d5752add2c1eef78d49b861fd2d151879e4506e..67bf094971d20407ad57f0b73d3849bf8cb49dd0 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-abilityAccessCtrl.md +++ b/zh-cn/application-dev/reference/apis/js-apis-abilityAccessCtrl.md @@ -63,7 +63,7 @@ checkAccessToken(tokenID: number, permissionName: Permissions): Promise<Grant | 错误码ID | 错误信息 | | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID is 0 | +| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256. | **示例:** @@ -110,7 +110,7 @@ verifyAccessTokenSync(tokenID: number, permissionName: Permissions): GrantStatus | 错误码ID | 错误信息 | | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID is 0 | +| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256. | **示例:** @@ -139,7 +139,7 @@ grantUserGrantedPermission(tokenID: number, permissionName: Permissions, permiss | --------- | ------------------- | ---- | ------------------------------------------------------------ | | tokenID | number | 是 | 目标应用的身份标识。可通过应用的[ApplicationInfo](js-apis-bundleManager-applicationInfo.md)获得。 | | permissionName | Permissions | 是 | 被授予的权限名称,合法的权限名取值可在[系统权限定义列表](../../security/permission-list.md)中查询。 | -| permissionFlags | number | 是 | 授权选项,1表示下次仍需弹窗,2表示允许、禁止后不再提醒,3表示系统授权不允许更改。 | +| permissionFlags | number | 是 | 授权选项
- 0表示权限未经过用户主动设置。
- 1表示当次用户若选择禁止该权限,下次权限弹窗仍可以弹出申请用户授权。
- 2表示当次用户若选择禁止该权限,下次不会再弹出权限弹窗,需要用户在setting的权限管理中进行授权。
- 4表示当次权限设置为系统授权,用户不可更改这个权限授权状态。 | **返回值:** @@ -153,7 +153,7 @@ grantUserGrantedPermission(tokenID: number, permissionName: Permissions, permiss | 错误码ID | 错误信息 | | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID is 0 | +| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256, or the flags value is invalid. | | 12100002 | The specified tokenID does not exist. | | 12100003 | The specified permission does not exist. | | 12100006 | The application specified by the tokenID is not allowed to be granted with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. | @@ -196,7 +196,7 @@ grantUserGrantedPermission(tokenID: number, permissionName: Permissions, permiss | --------- | ------------------- | ---- | ------------------------------------------------------------ | | tokenID | number | 是 | 目标应用的身份标识。可通过应用的[ApplicationInfo](js-apis-bundleManager-applicationInfo.md)获得。| | permissionName | Permissions | 是 | 被授予的权限名称,合法的权限名取值可在[系统权限定义列表](../../security/permission-list.md)中查询。 | -| permissionFlags | number | 是 | 授权选项,1表示下次仍需弹窗,2表示允许、禁止后不再提醒,3表示系统授权不允许更改。 | +| permissionFlags | number | 是 | 授权选项
- 0表示权限未经过用户主动设置。
- 1表示当次用户若选择禁止该权限,下次权限弹窗仍可以弹出申请用户授权。
- 2表示当次用户若选择禁止该权限,下次不会再弹出权限弹窗,需要用户在setting的权限管理中进行授权。
- 4表示当次权限设置为系统授权,用户不可更改这个权限授权状态。 | | callback | AsyncCallback<void> | 是 | 授予应用user grant权限。当授予权限成功时,err为undefine;否则为错误对象。 | **错误码:** @@ -205,9 +205,9 @@ grantUserGrantedPermission(tokenID: number, permissionName: Permissions, permiss | 错误码ID | 错误信息 | | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID is 0 | -| 12100002 | TokenId does not exist. | -| 12100003 | Permission does not exist. | +| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256, or the flags value is invalid. | +| 12100002 | The specified tokenID does not exist. | +| 12100003 | The specified permission does not exist. | | 12100006 | The application specified by the tokenID is not allowed to be granted with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. | | 12100007 | Service is abnormal. | @@ -250,7 +250,7 @@ revokeUserGrantedPermission(tokenID: number, permissionName: Permissions, permis | --------- | ------------------- | ---- | ------------------------------------------------------------ | | tokenID | number | 是 | 目标应用的身份标识。可通过应用的[ApplicationInfo](js-apis-bundleManager-applicationInfo.md)获得。 | | permissionName | Permissions | 是 | 被撤销的权限名称,合法的权限名取值可在[系统权限定义列表](../../security/permission-list.md)中查询。 | -| permissionFlags | number | 是 | 授权选项,1表示下次仍需弹窗,2表示允许、禁止后不再提醒,3表示系统授权不允许更改。 | +| permissionFlags | number | 是 | 授权选项
- 0表示权限未经过用户主动设置。
- 1表示当次用户若选择禁止该权限,下次权限弹窗仍可以弹出申请用户授权。
- 2表示当次用户若选择禁止该权限,下次不会再弹出权限弹窗,需要用户在setting的权限管理中进行授权。
- 4表示当次权限设置为系统授权,用户不可更改这个权限授权状态。 | **返回值:** @@ -264,7 +264,7 @@ revokeUserGrantedPermission(tokenID: number, permissionName: Permissions, permis | 错误码ID | 错误信息 | | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID is 0 | +| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256, or the flags value is invalid. | | 12100002 | The specified tokenID does not exist. | | 12100003 | The specified permission does not exist. | | 12100006 | The application specified by the tokenID is not allowed to be revoked with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. | @@ -307,7 +307,7 @@ revokeUserGrantedPermission(tokenID: number, permissionName: Permissions, permis | --------- | ------------------- | ---- | ------------------------------------------------------------ | | tokenID | number | 是 | 目标应用的身份标识。可通过应用的[ApplicationInfo](js-apis-bundleManager-applicationInfo.md)获得。 | | permissionName | Permissions | 是 | 被撤销的权限名称,合法的权限名取值可在[系统权限定义列表](../../security/permission-list.md)中查询。 | -| permissionFlags | number | 是 | 授权选项,1表示下次仍需弹窗,2表示允许、禁止后不再提醒,3表示系统授权不允许更改。 | +| permissionFlags | number | 是 | 授权选项
- 0表示权限未经过用户主动设置。
- 1表示当次用户若选择禁止该权限,下次权限弹窗仍可以弹出申请用户授权。
- 2表示当次用户若选择禁止该权限,下次不会再弹出权限弹窗,需要用户在setting的权限管理中进行授权。
- 4表示当次权限设置为系统授权,用户不可更改这个权限授权状态。 | | callback | AsyncCallback<void> | 是 | 撤销应用user grant权限。当撤销权限成功时,err为undefine;否则为错误对象。 | **错误码:** @@ -316,9 +316,9 @@ revokeUserGrantedPermission(tokenID: number, permissionName: Permissions, permis | 错误码ID | 错误信息 | | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID is 0 | -| 12100002 | TokenId does not exist. | -| 12100003 | Permission does not exist. | +| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256, or the flags value is invalid. | +| 12100002 | The specified tokenID does not exist. | +| 12100003 | The specified permission does not exist. | | 12100006 | The application specified by the tokenID is not allowed to be revoked with the specified permission. Either the application is a sandbox or the tokenID is from a remote device. | | 12100007 | Service is abnormal. | @@ -374,7 +374,7 @@ getPermissionFlags(tokenID: number, permissionName: Permissions): Promise<num | 错误码ID | 错误信息 | | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID is 0 | +| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256. | | 12100002 | The specified tokenID does not exist. | | 12100003 | The specified permission does not exist. | | 12100006 | The operation is not allowed. Either the application is a sandbox or the tokenID is from a remote device. | @@ -451,7 +451,7 @@ on(type: 'permissionStateChange', tokenIDList: Array<number>, permissionLi | 错误码ID | 错误信息 | | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID is 0 | +| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256. | | 12100004 | The interface is called repeatedly with the same input. | | 12100005 | The registration time has exceeded the limitation. | | 12100007 | Service is abnormal. | @@ -461,9 +461,10 @@ on(type: 'permissionStateChange', tokenIDList: Array<number>, permissionLi ```js import abilityAccessCtrl, {Permissions} from '@ohos.abilityAccessCtrl'; +import bundleManager from '@ohos.bundle.bundleManager'; let atManager = abilityAccessCtrl.createAtManager(); -let appInfo = bundle.getApplicationInfoSync('com.example.myapplication', 0, 100); +let appInfo = bundleManager.getApplicationInfoSync('com.example.myapplication', 0, 100); let tokenIDList: Array = [appInfo.accessTokenId]; let permissionList: Array = ["ohos.permission.DISTRIBUTED_DATASYNC"]; try { @@ -502,7 +503,7 @@ off(type: 'permissionStateChange', tokenIDList: Array<number>, permissionL | 错误码ID | 错误信息 | | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID in list is all invalid. | +| 12100001 | The parameter is invalid. The tokenIDs or permissionNames in the list are all invalid. | | 12100004 | The interface is not used together with "on". | | 12100007 | Service is abnormal. | | 12100008 | Out of memory. | @@ -511,9 +512,10 @@ off(type: 'permissionStateChange', tokenIDList: Array<number>, permissionL ```js import abilityAccessCtrl, {Permissions} from '@ohos.abilityAccessCtrl'; +import bundleManager from '@ohos.bundle.bundleManager'; let atManager = abilityAccessCtrl.createAtManager(); -let appInfo = bundle.getApplicationInfoSync('com.example.myapplication', 0, 100); +let appInfo = bundleManager.getApplicationInfoSync('com.example.myapplication', 0, 100); let tokenIDList: Array = [appInfo.accessTokenId]; let permissionList: Array = ["ohos.permission.DISTRIBUTED_DATASYNC"]; try { @@ -529,7 +531,9 @@ verifyAccessToken(tokenID: number, permissionName: Permissions): Promise<Gran 校验应用是否授予权限。使用Promise异步回调。 -> **说明:** 建议使用[checkAccessToken](#checkaccesstoken9)替代。 +> **说明:** +> +> 建议使用[checkAccessToken](#checkaccesstoken9)替代。 **系统能力:** SystemCapability.Security.AccessToken @@ -563,7 +567,10 @@ promise.then(data => { requestPermissionsFromUser(context: Context, permissionList: Array<Permissions>, requestCallback: AsyncCallback<PermissionRequestResult>) : void; -用于拉起弹框请求用户授权。使用callback异步回调。 +用于UIAbility拉起弹框请求用户授权。使用callback异步回调。 +> **说明:** +> +> 非UIAbility不支持调用本函数。 **模型约束**:此接口仅可在Stage模型下使用。 @@ -573,16 +580,17 @@ requestPermissionsFromUser(context: Context, permissionList: Array<Permission | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| context | Context | 是 | 请求权限的应用ability上下文context。 | +| context | Context | 是 | 请求权限的UIAbility的UIAbilityContext。 | | permissionList | Array<Permissions> | 是 | 权限名列表,合法的权限名取值可在[系统权限定义列表](../../security/permission-list.md)中查询。 | | callback | AsyncCallback<[PermissionRequestResult](js-apis-permissionrequestresult.md)> | 是 | 回调函数,返回接口调用是否成功的结果。 | **错误码:** 以下错误码的详细介绍请参见[程序访问控制错误码](../errorcodes/errorcode-access-token.md)。 + | 错误码ID | 错误信息 | | -------- | -------- | -| 12100001 | Parameter invalid. | +| 12100001 | The parameter is invalid. The context is invalid when it does not belong to the application itself. | **示例:** @@ -604,7 +612,11 @@ try { requestPermissionsFromUser(context: Context, permissionList: Array<Permissions>) : Promise<PermissionRequestResult>; -用于拉起弹框请求用户授权。使用promise异步回调。 +用于UIAbility拉起弹框请求用户授权。使用promise异步回调。 + +> **说明:** +> +> 非UIAbility不支持调用本函数。 **模型约束**:此接口仅可在Stage模型下使用。 @@ -614,7 +626,7 @@ requestPermissionsFromUser(context: Context, permissionList: Array<Permission | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| context | Context | 是 | 请求权限的应用ability上下文context。 | +| context | Context | 是 | 请求权限的UIAbility的UIAbilityContext。 | | permissionList | Array<Permissions> | 是 | 需要校验的权限名称,合法的权限名取值可在[系统权限定义列表](../../security/permission-list.md)中查询。 | **返回值:** @@ -626,9 +638,10 @@ requestPermissionsFromUser(context: Context, permissionList: Array<Permission **错误码:** 以下错误码的详细介绍请参见[程序访问控制错误码](../errorcodes/errorcode-access-token.md)。 + | 错误码ID | 错误信息 | | -------- | -------- | -| 12100001 | Parameter invalid. | +| 12100001 | The parameter is invalid. The context is invalid when it does not belong to the application itself. | **示例:** @@ -654,7 +667,9 @@ verifyAccessToken(tokenID: number, permissionName: string): Promise<GrantStat 校验应用是否授予权限。使用Promise异步回调。 -> **说明:** 从API version 9开始不再维护,建议使用[checkAccessToken](#checkaccesstoken9)替代。 +> **说明:** +> +> 从API version 9开始不再维护,建议使用[checkAccessToken](#checkaccesstoken9)替代。 **系统能力:** SystemCapability.Security.AccessToken @@ -684,6 +699,44 @@ promise.then(data => { }); ``` +### checkAccessTokenSync10+ + +checkAccessTokenSync(tokenID: number, permissionName: Permissions): GrantStatus; + +校验应用是否被授予权限,同步返回结果。 + +**系统能力:** SystemCapability.Security.AccessToken + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------- | ---- | ------------------------------------------ | +| tokenID | number | 是 | 要校验应用的身份标识。可通过应用的[ApplicationInfo](js-apis-bundleManager-applicationInfo.md)获得。 | +| permissionName | Permissions | 是 | 需要校验的权限名称,合法的权限名取值可在[系统权限定义列表](../../security/permission-list.md)中查询。 | + +**返回值:** + +| 类型 | 说明 | +| :------------ | :---------------------------------- | +| [GrantStatus](#grantstatus) | 枚举实例,返回授权状态。 | + +**错误码:** + +以下错误码的详细介绍请参见[程序访问控制错误码](../errorcodes/errorcode-access-token.md)。 + +| 错误码ID | 错误信息 | +| -------- | -------- | +| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256. | + +**示例:** + +```js +let atManager = abilityAccessCtrl.createAtManager(); +let tokenID = 0; // 系统应用可以通过bundleManager.getApplicationInfo获取,普通应用可以通过bundleManager.getBundleInfoForSelf获取 +let data = atManager.checkAccessTokenSync(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS"); +console.log(`data->${JSON.stringify(data)}`); +``` + ### GrantStatus 表示授权状态的枚举。 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 16b2e9bef518ae6fe58c830c4373a9deaf34b81a..6822b20d3e216d1a6363874c20bdcfe17086aa59 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-accessibility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-accessibility.md @@ -18,9 +18,9 @@ import accessibility from '@ohos.accessibility'; **系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core -| 名称 | 描述 | -| -------- | -------- | -| enable | 辅助应用已启用。 | +| 名称 | 描述 | +| ------- | -------- | +| enable | 辅助应用已启用。 | | disable | 辅助应用已禁用。 | | install | 辅助应用已安装。 | @@ -30,13 +30,13 @@ import accessibility from '@ohos.accessibility'; **系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core -| 名称 | 描述 | -| -------- | -------- | -| audible | 表示具有听觉反馈。 | -| generic | 表示具有通用反馈。 | -| haptic | 表示具有触觉反馈。 | -| spoken | 表示具有语音反馈。 | -| visual | 表示具有视觉反馈。 | +| 名称 | 描述 | +| ---------------- | --------- | +| audible | 表示具有听觉反馈。 | +| generic | 表示具有通用反馈。 | +| haptic | 表示具有触觉反馈。 | +| spoken | 表示具有语音反馈。 | +| visual | 表示具有视觉反馈。 | | all9+ | 表示以上所有类别。 | ## AccessibilityAbilityInfo @@ -47,16 +47,16 @@ import accessibility from '@ohos.accessibility'; ### 属性 -| 名称 | 类型 | 可读 | 可写 | 说明 | -| -------- | -------- | -------- | -------- | -------- | -| id | string | 是 | 否 | ability id。 | -| name | string | 是 | 否 | ability 名。 | -| bundleName | string | 是 | 否 | Bundle名称。 | -| targetBundleNames9+ | Array<string> | 是 | 否 | 关注的目标Bundle名称。 | -| abilityTypes | Array<[AbilityType](#abilitytype)> | 是 | 否 | 辅助应用类型。 | -| capabilities | Array<[Capability](#capability)> | 是 | 否 | 辅助应用能力列表。 | -| description | string | 是 | 否 | 辅助应用描述。 | -| eventTypes | Array<[EventType](#eventtype)> | 是 | 否 | 辅助应用关注的无障碍事件列表。 | +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ------------------------------ | ---------------------------------------- | ---- | ---- | ---------------- | +| id | string | 是 | 否 | ability id。 | +| name | string | 是 | 否 | ability 名。 | +| bundleName | string | 是 | 否 | Bundle名称。 | +| targetBundleNames9+ | Array<string> | 是 | 否 | 关注的目标Bundle名称。 | +| abilityTypes | Array<[AbilityType](#abilitytype)> | 是 | 否 | 辅助应用类型。 | +| capabilities | Array<[Capability](#capability)> | 是 | 否 | 辅助应用能力列表。 | +| description | string | 是 | 否 | 辅助应用描述。 | +| eventTypes | Array<[EventType](#eventtype)> | 是 | 否 | 辅助应用关注的无障碍事件列表。 | ## Action @@ -64,24 +64,24 @@ import accessibility from '@ohos.accessibility'; **系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core -| 名称 | 描述 | -| -------- | -------- | -| click | 表示点击操作。 | -| longClick | 表示长按操作。 | -| scrollForward | 表示向前滚动操作。 | -| scrollBackward | 表示向后滚动操作。 | -| focus | 表示获得焦点操作。 | -| clearFocus | 表示清除焦点操作。 | -| clearSelection | 表示清除选择操作。 | -| accessibilityFocus | 表示获得无障碍焦点操作。 | -| clearAccessibilityFocus | 表示清除无障碍焦点操作。 | -| cut | 表示剪切操作。 | -| copy | 表示复制操作。 | -| paste | 表示粘贴操作。 | -| select | 表示选择操作。 | -| setText | 表示设置文本操作。 | -| delete | 表示删除操作。 | -| setSelection | 表示选择操作。 | +| 名称 | 描述 | +| ----------------------- | ------------------ | +| click | 表示点击操作。 | +| longClick | 表示长按操作。 | +| scrollForward | 表示向前滚动操作;当前版本暂不支持。 | +| scrollBackward | 表示向后滚动操作;当前版本暂不支持。 | +| focus | 表示获得焦点操作;当前版本暂不支持。 | +| clearFocus | 表示清除焦点操作;当前版本暂不支持。 | +| clearSelection | 表示清除选择操作;当前版本暂不支持。 | +| accessibilityFocus | 表示获得无障碍焦点操作。 | +| clearAccessibilityFocus | 表示清除无障碍焦点操作。 | +| cut | 表示剪切操作;当前版本暂不支持。 | +| copy | 表示复制操作;当前版本暂不支持。 | +| paste | 表示粘贴操作;当前版本暂不支持。 | +| select | 表示选择操作,当前版本暂不支持。 | +| setText | 表示设置文本操作;当前版本暂不支持。 | +| delete | 表示删除操作;当前版本暂不支持。 | +| setSelection | 表示选择操作;当前版本暂不支持。 | ## Capability @@ -89,13 +89,13 @@ import accessibility from '@ohos.accessibility'; **系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core -| 名称 | 描述 | -| -------- | -------- | -| retrieve | 具有检索窗口内容的能力。 | -| touchGuide | 具有触摸探索模式的能力。 | -| keyEventObserver | 具有过滤按键事件的能力。 | -| zoom | 具有控制显示放大的能力。 | -| gesture | 具有执行手势动作的能力。 | +| 名称 | 描述 | +| ---------------- | --------------------- | +| retrieve | 具有检索窗口内容的能力。 | +| touchGuide | 具有触摸探索模式的能力。 | +| keyEventObserver | 具有过滤按键事件的能力。 | +| zoom | 具有控制显示放大的能力;当前版本暂不支持。 | +| gesture | 具有执行手势动作的能力。 | ## CaptionsFontEdgeType8+ @@ -103,12 +103,12 @@ import accessibility from '@ohos.accessibility'; **系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Hearing -| 名称 | 描述 | -| -------- | -------- | -| none | 无效果。 | -| raised | 凸起效果。 | -| depressed | 凹陷效果。 | -| uniform | 轮廓效果。 | +| 名称 | 描述 | +| ---------- | ----- | +| none | 无效果。 | +| raised | 凸起效果。 | +| depressed | 凹陷效果。 | +| uniform | 轮廓效果。 | | dropShadow | 阴影效果。 | ## CaptionsFontFamily8+ @@ -117,16 +117,16 @@ import accessibility from '@ohos.accessibility'; **系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Hearing -| 名称 | 描述 | -| -------- | -------- | -| default | 默认字体。 | -| monospacedSerif | 等宽 Serif 字体。 | -| serif | Serif 字体。 | +| 名称 | 描述 | +| ------------------- | ----------------- | +| default | 默认字体。 | +| monospacedSerif | 等宽 Serif 字体。 | +| serif | Serif 字体。 | | monospacedSansSerif | 等宽 Sans Serif 字体。 | -| sansSerif | Sans Serif 字体。 | -| casual | 非正式字体。 | -| cursive | 手写字体。 | -| smallCapitals | 小型大写字母字体。 | +| sansSerif | Sans Serif 字体。 | +| casual | 非正式字体。 | +| cursive | 手写字体。 | +| smallCapitals | 小型大写字母字体。 | ## CaptionsStyle8+ @@ -134,14 +134,14 @@ import accessibility from '@ohos.accessibility'; **系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Hearing -| 名称 | 类型 | 可读 | 可写 | 说明 | -| -------- | -------- | -------- | -------- | -------- | -| fontFamily | [CaptionsFontFamily](#captionsfontfamily8) | 是 | 否 | 描述字幕字体。 | -| fontScale | number | 是 | 否 | 描述字幕字体缩放系数。 | -| fontColor | number \| string | 是 | 否 | 描述字幕字体颜色。 | -| fontEdgeType | [CaptionsFontEdgeType](#captionsfontedgetype8) | 是 | 否 | 描述字幕字体边缘。 | -| backgroundColor | number \| string | 是 | 否 | 描述字幕背景颜色。 | -| windowColor | number \| string | 是 | 否 | 描述字幕窗口颜色。 | +| 名称 | 类型 | 可读 | 可写 | 说明 | +| --------------- | ---------------------------------------- | ---- | ---- | ----------- | +| fontFamily | [CaptionsFontFamily](#captionsfontfamily8) | 是 | 否 | 描述字幕字体。 | +| fontScale | number | 是 | 否 | 描述字幕字体缩放系数。 | +| fontColor | number \| string | 是 | 否 | 描述字幕字体颜色。 | +| fontEdgeType | [CaptionsFontEdgeType](#captionsfontedgetype8) | 是 | 否 | 描述字幕字体边缘。 | +| backgroundColor | number \| string | 是 | 否 | 描述字幕背景颜色。 | +| windowColor | number \| string | 是 | 否 | 描述字幕窗口颜色。 | ## CaptionsManager8+ @@ -151,10 +151,10 @@ import accessibility from '@ohos.accessibility'; ### 属性 -| 名称 | 类型 | 可读 | 可写 | 说明 | -| -------- | -------- | -------- | -------- | -------- | -| enabled | boolean | 是 | 否 | 表示是否启用字幕配置。 | -| style | [CaptionsStyle](#captionsstyle8) | 是 | 否 | 表示字幕风格。 | +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ------- | -------------------------------- | ---- | ---- | ----------- | +| enabled | boolean | 是 | 否 | 表示是否启用字幕配置。 | +| style | [CaptionsStyle](#captionsstyle8) | 是 | 否 | 表示字幕风格。 | ### on('enableChange') @@ -164,10 +164,10 @@ on(type: 'enableChange', callback: Callback<boolean>): void; **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| type | string | 是 | 监听的事件名,固定为‘enableChange’,即字幕配置启用状态变化事件。 | -| callback | Callback<boolean> | 是 | 回调函数,在启用状态变化时将状态通过此函数进行通知。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | --------------------------------------- | +| type | string | 是 | 监听的事件名,固定为‘enableChange’,即字幕配置启用状态变化事件。 | +| callback | Callback<boolean> | 是 | 回调函数,在启用状态变化时将状态通过此函数进行通知。 | **示例:** @@ -190,10 +190,10 @@ on(type: 'styleChange', callback: Callback<CaptionsStyle>): void; **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| type | string | 是 | 监听的事件名,固定为‘styleChange’,即字幕风格变化事件。 | -| callback | Callback<[CaptionsStyle](#captionsstyle8)> | 是 | 回调函数,在字幕风格变化时通过此函数进行通知。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ---------------------------------- | +| type | string | 是 | 监听的事件名,固定为‘styleChange’,即字幕风格变化事件。 | +| callback | Callback<[CaptionsStyle](#captionsstyle8)> | 是 | 回调函数,在字幕风格变化时通过此函数进行通知。 | **示例:** @@ -218,10 +218,10 @@ off(type: 'enableChange', callback?: Callback<boolean>): void; **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| type | string | 是 | 取消监听的事件名,固定为‘enableChange’,即字幕配置启用状态变化事件。 | -| callback | Callback<boolean> | 否 | 回调函数,在字幕配置启用状态变化时将状态通过此函数进行通知。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | ---------------------------------------- | +| type | string | 是 | 取消监听的事件名,固定为‘enableChange’,即字幕配置启用状态变化事件。 | +| callback | Callback<boolean> | 否 | 回调函数,在字幕配置启用状态变化时将状态通过此函数进行通知。 | **示例:** @@ -244,10 +244,10 @@ off(type: 'styleChange', callback?: Callback<CaptionsStyle>): void; **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| type | string | 是 | 取消监听的事件名,固定为‘styleChange’,即字幕风格变化事件。 | -| callback | Callback<[CaptionsStyle](#captionsstyle8)> | 否 | 回调函数,在字幕风格变化时通过此函数进行通知。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ------------------------------------ | +| type | string | 是 | 取消监听的事件名,固定为‘styleChange’,即字幕风格变化事件。 | +| callback | Callback<[CaptionsStyle](#captionsstyle8)> | 否 | 回调函数,在字幕风格变化时通过此函数进行通知。 | **示例:** @@ -272,22 +272,22 @@ try { ### 属性 -| 名称 | 类型 | 可读 | 可写 | 说明 | -| -------- | -------- | -------- | -------- | -------- | -| type | [EventType](#eventtype) | 是 | 是 | 无障碍事件类型。 | -| windowUpdateType | [WindowUpdateType](#windowupdatetype) | 是 | 是 | 窗口变化类型。 | -| bundleName | string | 是 | 是 | 目标应用名。 | -| componentType | string | 是 | 是 | 事件源组件类型,如按钮、图表。 | -| pageId | number | 是 | 是 | 事件源的页面 ID。 | -| description | string | 是 | 是 | 事件描述。 | -| triggerAction | [Action](#action) | 是 | 是 | 触发事件的 Action。 | -| textMoveUnit | [TextMoveUnit](#textmoveunit) | 是 | 是 | 文本移动粒度。 | -| contents | Array<string> | 是 | 是 | 内容列表。 | -| lastContent | string | 是 | 是 | 最新内容。 | -| beginIndex | number | 是 | 是 | 画面显示条目的开始序号。 | -| currentIndex | number | 是 | 是 | 当前条目序号。 | -| endIndex | number | 是 | 是 | 画面显示条目的结束序号。 | -| itemCount | number | 是 | 是 | 条目总数。 | +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ---------------- | ------------------------------------- | ---- | ---- | --------------------- | +| type | [EventType](#eventtype) | 是 | 是 | 无障碍事件类型。 | +| windowUpdateType | [WindowUpdateType](#windowupdatetype) | 是 | 是 | 窗口变化类型。 | +| bundleName | string | 是 | 是 | 目标应用名。 | +| componentType | string | 是 | 是 | 事件源组件类型,如按钮、图表。 | +| pageId | number | 是 | 是 | 事件源的页面 ID。 | +| description | string | 是 | 是 | 事件描述;当前版本暂不支持。 | +| triggerAction | [Action](#action) | 是 | 是 | 触发事件的 Action。 | +| textMoveUnit | [TextMoveUnit](#textmoveunit) | 是 | 是 | 文本移动粒度;当前版本暂不支持。 | +| contents | Array<string> | 是 | 是 | 内容列表。 | +| lastContent | string | 是 | 是 | 最新内容。 | +| beginIndex | number | 是 | 是 | 画面显示条目的开始序号;当前版本暂不支持。 | +| currentIndex | number | 是 | 是 | 当前条目序号;当前版本暂不支持。 | +| endIndex | number | 是 | 是 | 画面显示条目的结束序号;当前版本暂不支持。 | +| itemCount | number | 是 | 是 | 条目总数;当前版本暂不支持。 | ### constructor @@ -299,9 +299,9 @@ constructor(jsonObject) **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| jsonObject | string | 是 | 创建对象所需要的 JSON 格式字符串。 | +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | ------ | ---- | -------------------- | +| jsonObject | string | 是 | 创建对象所需要的 JSON 格式字符串。 | **示例:** @@ -319,19 +319,19 @@ constructor(jsonObject) **系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core -| 名称 | 描述 | -| -------- | -------- | -| click | 描述点击组件的事件。 | -| longClick | 描述长按组件的事件。 | -| select | 描述选择组件的事件。 | -| focus | 描述组件获得焦点的事件。 | -| textUpdate | 描述组件文本已更改的事件。 | -| hoverEnter | 描述悬停进入组件的事件。 | -| hoverExit | 描述悬停离开组件的事件。 | -| scroll | 描述滚动视图的事件。 | -| textSelectionUpdate | 描述选定文本已更改的事件。 | -| accessibilityFocus | 描述获得无障碍焦点的事件。 | -| accessibilityFocusClear | 描述清除无障碍焦点的事件。 | +| 名称 | 描述 | +| ----------------------- | ---------------------- | +| click | 描述点击组件的事件。 | +| longClick | 描述长按组件的事件。 | +| select | 描述选择组件的事件;当前版本暂不支持。 | +| focus | 描述组件获得焦点的事件;当前版本暂不支持。 | +| textUpdate | 描述组件文本已更改的事件;当前版本暂不支持。 | +| hoverEnter | 描述悬停进入组件的事件;当前版本暂不支持。 | +| hoverExit | 描述悬停离开组件的事件;当前版本暂不支持。 | +| scroll | 描述滚动视图的事件;当前版本暂不支持。 | +| textSelectionUpdate | 描述选定文本已更改的事件;当前版本暂不支持。 | +| accessibilityFocus | 描述获得无障碍焦点的事件。 | +| accessibilityFocusClear | 描述清除无障碍焦点的事件。 | ## TextMoveUnit @@ -339,12 +339,12 @@ constructor(jsonObject) **系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core -| 名称 | 描述 | -| -------- | -------- | -| char | 以字符为移动粒度遍历节点文本。 | -| word | 以词为移动粒度遍历节点文本。 | -| line | 以行为移动粒度遍历节点文本。 | -| page | 以页为移动粒度遍历节点文本。 | +| 名称 | 描述 | +| --------- | --------------- | +| char | 以字符为移动粒度遍历节点文本。 | +| word | 以词为移动粒度遍历节点文本。 | +| line | 以行为移动粒度遍历节点文本。 | +| page | 以页为移动粒度遍历节点文本。 | | paragraph | 以段落为移动粒度遍历节点文本。 | ## WindowUpdateType @@ -353,13 +353,13 @@ constructor(jsonObject) **系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core -| 名称 | 描述 | -| -------- | -------- | -| add | 添加窗口的窗口变化事件。 | -| remove | 一个窗口被删除的窗口变化事件。 | -| bounds | 窗口边界已更改的窗口变化事件。 | +| 名称 | 描述 | +| ------ | ------------------ | +| add | 添加窗口的窗口变化事件。 | +| remove | 一个窗口被删除的窗口变化事件。 | +| bounds | 窗口边界已更改的窗口变化事件。 | | active | 窗口变为活动或不活动的窗口变化事件。 | -| focus | 窗口焦点发生变化的窗口变化事件。 | +| focus | 窗口焦点发生变化的窗口变化事件。 | ## accessibility.getAbilityLists(deprecated) @@ -376,15 +376,15 @@ getAbilityLists(abilityType: AbilityType, stateType: AbilityState): Promise<A **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| abilityType | [AbilityType](#abilitytype) | 是 | 辅助应用的类型。 | -| stateType | [AbilityState](#abilitystate) | 是 | 辅助应用的状态。 | +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ----------------------------- | ---- | -------- | +| abilityType | [AbilityType](#abilitytype) | 是 | 辅助应用的类型。 | +| stateType | [AbilityState](#abilitystate) | 是 | 辅助应用的状态。 | **返回值:** -| 类型 | 说明 | -| -------- | -------- | +| 类型 | 说明 | +| ---------------------------------------- | --------------------- | | Promise<Array<[AccessibilityAbilityInfo](#accessibilityabilityinfo)>> | Promise对象,返回辅助应用信息列表。 | **示例:** @@ -426,11 +426,11 @@ getAbilityLists(abilityType: AbilityType, stateType: AbilityState,callback: Asyn **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| abilityType | [AbilityType](#abilitytype) | 是 | 辅助应用的类型。 | -| stateType | [AbilityState](#abilitystate) | 是 | 辅助应用的状态。 | -| callback | AsyncCallback<Array<[AccessibilityAbilityInfo](#accessibilityabilityinfo)>> | 是 | 回调函数,返回辅助应用信息列表。 | +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ---------------------------------------- | ---- | ---------------- | +| abilityType | [AbilityType](#abilitytype) | 是 | 辅助应用的类型。 | +| stateType | [AbilityState](#abilitystate) | 是 | 辅助应用的状态。 | +| callback | AsyncCallback<Array<[AccessibilityAbilityInfo](#accessibilityabilityinfo)>> | 是 | 回调函数,返回辅助应用信息列表。 | **示例:** @@ -470,15 +470,15 @@ getAccessibilityExtensionList(abilityType: AbilityType, stateType: AbilityState) **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| abilityType | [AbilityType](#abilitytype) | 是 | 辅助应用的类型。 | -| stateType | [AbilityState](#abilitystate) | 是 | 辅助应用的状态。 | +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ----------------------------- | ---- | -------- | +| abilityType | [AbilityType](#abilitytype) | 是 | 辅助应用的类型。 | +| stateType | [AbilityState](#abilitystate) | 是 | 辅助应用的状态。 | **返回值:** -| 类型 | 说明 | -| -------- | -------- | +| 类型 | 说明 | +| ---------------------------------------- | --------------------- | | Promise<Array<[AccessibilityAbilityInfo](#accessibilityabilityinfo)>> | Promise对象,返回辅助应用信息列表。 | **示例:** @@ -515,11 +515,11 @@ getAccessibilityExtensionList(abilityType: AbilityType, stateType: AbilityState, **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| abilityType | [AbilityType](#abilitytype) | 是 | 辅助应用的类型。 | -| stateType | [AbilityState](#abilitystate) | 是 | 辅助应用的状态。 | -| callback | AsyncCallback<Array<[AccessibilityAbilityInfo](#accessibilityabilityinfo)>> | 是 | 回调函数,返回辅助应用信息列表。 | +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ---------------------------------------- | ---- | ---------------- | +| abilityType | [AbilityType](#abilitytype) | 是 | 辅助应用的类型。 | +| stateType | [AbilityState](#abilitystate) | 是 | 辅助应用的状态。 | +| callback | AsyncCallback<Array<[AccessibilityAbilityInfo](#accessibilityabilityinfo)>> | 是 | 回调函数,返回辅助应用信息列表。 | **示例:** @@ -557,8 +557,8 @@ getCaptionsManager(): CaptionsManager **返回值:** -| 类型 | 说明 | -| -------- | -------- | +| 类型 | 说明 | +| ------------------------------------ | ---------- | | [CaptionsManager](#captionsmanager8) | 无障碍字幕配置管理。 | **示例:** @@ -577,10 +577,10 @@ on(type: 'accessibilityStateChange', callback: Callback<boolean>): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| type | string | 是 | 监听的事件名,固定为‘accessibilityStateChange’,即辅助应用启用状态变化事件。 | -| callback | Callback<boolean> | 是 | 回调函数,在辅助应用启用状态变化时将状态通过此函数进行通知。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | ---------------------------------------- | +| type | string | 是 | 监听的事件名,固定为‘accessibilityStateChange’,即辅助应用启用状态变化事件。 | +| callback | Callback<boolean> | 是 | 回调函数,在辅助应用启用状态变化时将状态通过此函数进行通知。 | **示例:** @@ -604,10 +604,10 @@ on(type: 'touchGuideStateChange', callback: Callback<boolean>): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| type | string | 是 | 监听的事件名,固定为‘touchGuideStateChange’,即触摸浏览启用状态变化事件。 | -| callback | Callback<boolean> | 是 | 回调函数,在触摸浏览启用状态变化时将状态通过此函数进行通知。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | ---------------------------------------- | +| type | string | 是 | 监听的事件名,固定为‘touchGuideStateChange’,即触摸浏览启用状态变化事件。 | +| callback | Callback<boolean> | 是 | 回调函数,在触摸浏览启用状态变化时将状态通过此函数进行通知。 | **示例:** @@ -631,10 +631,10 @@ off(type: 'accessibilityStateChange', callback?: Callback<boolean>): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| type | string | 否 | 取消监听的事件名,固定为‘accessibilityStateChange’,即辅助应用启用状态变化事件。 | -| callback | Callback<boolean> | 否 | 回调函数,在辅助应用启用状态变化时将状态通过此函数进行通知。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | ---------------------------------------- | +| type | string | 否 | 取消监听的事件名,固定为‘accessibilityStateChange’,即辅助应用启用状态变化事件。 | +| callback | Callback<boolean> | 否 | 回调函数,在辅助应用启用状态变化时将状态通过此函数进行通知。 | **示例:** @@ -658,10 +658,10 @@ off(type: 'touchGuideStateChange', callback?: Callback<boolean>): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| type | string | 否 | 取消监听的事件名,固定为‘touchGuideStateChange’,即触摸浏览启用状态变化事件。 | -| callback | Callback<boolean> | 否 | 回调函数,在触摸浏览启用状态变化时将状态通过此函数进行通知。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | ---------------------------------------- | +| type | string | 否 | 取消监听的事件名,固定为‘touchGuideStateChange’,即触摸浏览启用状态变化事件。 | +| callback | Callback<boolean> | 否 | 回调函数,在触摸浏览启用状态变化时将状态通过此函数进行通知。 | **示例:** @@ -685,8 +685,8 @@ isOpenAccessibility(): Promise<boolean> **返回值:** -| 类型 | 说明 | -| -------- | -------- | +| 类型 | 说明 | +| ---------------------- | ---------------------------------------- | | Promise<boolean> | Promise对象,如果辅助功能已启用,则返回 true;否则返回 false。 | **示例:** @@ -709,9 +709,9 @@ isOpenAccessibility(callback: AsyncCallback<boolean>): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<boolean> | 是 | 回调函数,如果辅助功能已启用,则返回 true;否则返回 false。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------- | ---- | ----------------------------------- | +| callback | AsyncCallback<boolean> | 是 | 回调函数,如果辅助功能已启用,则返回 true;否则返回 false。 | **示例:** @@ -735,8 +735,8 @@ isOpenTouchGuide(): Promise<boolean> **返回值:** -| 类型 | 说明 | -| -------- | -------- | +| 类型 | 说明 | +| ---------------------- | ---------------------------------------- | | Promise<boolean> | Promise对象,如果触摸浏览模式已开启,则返回 true;否则返回 false。 | **示例:** @@ -759,9 +759,9 @@ isOpenTouchGuide(callback: AsyncCallback<boolean>): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<boolean> | 是 | 回调函数,如果触摸浏览模式已开启,则返回 true;否则返回 false。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------- | ---- | ------------------------------------- | +| callback | AsyncCallback<boolean> | 是 | 回调函数,如果触摸浏览模式已开启,则返回 true;否则返回 false。 | **示例:** @@ -790,14 +790,14 @@ sendEvent(event: EventInfo): Promise<void> **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| event | [EventInfo](#eventinfo) | 是 | 无障碍事件对象。 | +| 参数名 | 类型 | 必填 | 说明 | +| ----- | ----------------------- | ---- | -------- | +| event | [EventInfo](#eventinfo) | 是 | 无障碍事件对象。 | **返回值:** -| 类型 | 说明 | -| -------- | -------- | +| 类型 | 说明 | +| ------------------- | ---------------- | | Promise<void> | 无返回结果的Promise对象。 | **示例:** @@ -830,10 +830,10 @@ sendEvent(event: EventInfo, callback: AsyncCallback<void>): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| event | [EventInfo](#eventinfo) | 是 | 辅助事件对象。 | -| callback | AsyncCallback<void> | 是 | 回调函数,如果发送无障碍事件失败,则 AsyncCallback中err有数据返回。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ---------------------------------------- | +| event | [EventInfo](#eventinfo) | 是 | 辅助事件对象。 | +| callback | AsyncCallback<void> | 是 | 回调函数,如果发送无障碍事件失败,则 AsyncCallback中err有数据返回。 | **示例:** @@ -862,14 +862,14 @@ sendAccessibilityEvent(event: EventInfo): Promise<void> **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| event | [EventInfo](#eventinfo) | 是 | 无障碍事件对象。 | +| 参数名 | 类型 | 必填 | 说明 | +| ----- | ----------------------- | ---- | -------- | +| event | [EventInfo](#eventinfo) | 是 | 无障碍事件对象。 | **返回值:** -| 类型 | 说明 | -| -------- | -------- | +| 类型 | 说明 | +| ------------------- | ---------------- | | Promise<void> | 无返回结果的Promise对象。 | **示例:** @@ -901,10 +901,10 @@ sendAccessibilityEvent(event: EventInfo, callback: AsyncCallback<void>): v **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| event | [EventInfo](#eventinfo) | 是 | 辅助事件对象。 | -| callback | AsyncCallback<void> | 是 | 回调函数,如果发送无障碍事件失败,则 AsyncCallback中err有数据返回。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ---------------------------------------- | +| event | [EventInfo](#eventinfo) | 是 | 辅助事件对象。 | +| callback | AsyncCallback<void> | 是 | 回调函数,如果发送无障碍事件失败,则 AsyncCallback中err有数据返回。 | **示例:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityConstant.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityConstant.md index 1e6f6186b73b04d41e4cad2fc1eafe679f1d7f3b..0e05272aa8e2c5f62656cd102326d2188eb685e2 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityConstant.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityConstant.md @@ -39,6 +39,7 @@ Ability初次启动原因,该类型为枚举,可配合[Ability](js-apis-app- | CALL | 2 | 通过[startAbilityByCall](js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartabilitybycall)接口启动ability。 | | CONTINUATION | 3 | 跨端设备迁移启动ability。 | | APP_RECOVERY | 4 | 设置应用恢复后,应用故障时自动恢复启动ability。 | +| SHARE10+ | 5 | 通过[acquireShareData](js-apis-app-ability-abilityManager.md#acquiresharedata)接口启动ability。 | **示例:** @@ -99,7 +100,7 @@ import UIAbility from '@ohos.app.ability.UIAbility'; class MyAbility extends UIAbility { onContinue(wantParam) { - return AbilityConstant.OnConinueResult.AGREE; + return AbilityConstant.OnContinueResult.AGREE; } } ``` @@ -132,7 +133,7 @@ let option = { }; // 确保从上下文获取到context -this.context.startAbility(want, option).then(()={ +this.context.startAbility(want, option).then(()=>{ console.log('Succeed to start ability.'); }).catch((error)=>{ console.error('Failed to start ability with error: ${JSON.stringify(error)}'); diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityDelegatorRegistry.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityDelegatorRegistry.md index 86bdacebdb73a44154906509e971f4a45efeee88..9389a1a82f36d996ba87cc8e51fa87fe83923977 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityDelegatorRegistry.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityDelegatorRegistry.md @@ -53,10 +53,10 @@ let want = { abilityName: 'EntryAbility' }; abilityDelegator.startAbility(want, (err) => { - if (!err || err.code === 0) { - console.log('Success start ability.'); - } else { + if (err) { console.error('Failed start ability, error: ${JSON.stringify(err)}'); + } else { + console.log('Success start ability.'); } }); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityLifecycleCallback.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityLifecycleCallback.md index cb65694c20c8a95a2aae65493761943af5f972ee..cda0e7434c169a4e2dfdba1c06f21ca8cc6a59f8 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityLifecycleCallback.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityLifecycleCallback.md @@ -275,7 +275,7 @@ export default class MyFirstAbility extends UIAbility { // 2.通过applicationContext注册监听应用内生命周期 try { globalThis.lifecycleId = applicationContext.on('abilityLifecycle', abilityLifecycleCallback); - console.log('registerAbilityLifecycleCallback number: ${JSON.stringify(lifecycleId)}'); + console.log('registerAbilityLifecycleCallback lifecycleId: ${globalThis.lifecycleId}'); } catch (paramError) { console.error('error: ${paramError.code}, ${paramError.message}'); } @@ -285,7 +285,7 @@ export default class MyFirstAbility extends UIAbility { MySecondAbility.ts ```ts -import UIAbility from 'ohos.app.ability.UIAbility'; +import UIAbility from '@ohos.app.ability.UIAbility'; export default class MySecondAbility extends UIAbility { onDestroy() { diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityManager.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityManager.md index 621aba9431df6a4b3808207ad83d21f75684e43d..48cec6bed3381996252d478db696b20a8b3407a7 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityManager.md @@ -59,26 +59,27 @@ updateConfiguration(config: Configuration, callback: AsyncCallback\): void ```ts import abilityManager from '@ohos.app.ability.abilityManager'; +import ConfigurationConstant from '@ohos.app.ability.ConfigurationConstant'; const config = { language: 'Zh-Hans', // 简体中文 - colorMode: COLOR_MODE_LIGHT, // 浅色模式 - direction: DIRECTION_VERTICAL, // 垂直方向 - screenDensity: SCREEN_DENSITY_SDPI, // 屏幕像素密度为'sdpi' + colorMode: ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT, // 浅色模式 + direction: ConfigurationConstant.Direction.DIRECTION_VERTICAL, // 垂直方向 + screenDensity: ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_SDPI, // 屏幕像素密度为'sdpi' displayId: 1, // 应用在Id为1的物理屏上显示 hasPointerDevice: true, // 指针类型设备已连接 }; try { abilityManager.updateConfiguration(config, (err) => { - if (err && err.code !== 0) { + if (err) { console.error('updateConfiguration fail, err: ${JSON.stringify(err)}'); } else { console.log('updateConfiguration success.'); } }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -116,12 +117,13 @@ updateConfiguration(config: Configuration): Promise\ ```ts import abilityManager from '@ohos.app.ability.abilityManager'; +import ConfigurationConstant from '@ohos.app.ability.ConfigurationConstant'; const config = { language: 'Zh-Hans', // 简体中文 - colorMode: COLOR_MODE_LIGHT, // 浅色模式 - direction: DIRECTION_VERTICAL, // 垂直方向 - screenDensity: SCREEN_DENSITY_SDPI, // 屏幕像素密度为'sdpi' + colorMode: ConfigurationConstant.ColorMode.COLOR_MODE_LIGHT, // 浅色模式 + direction: ConfigurationConstant.Direction.DIRECTION_VERTICAL, // 垂直方向 + screenDensity: ConfigurationConstant.ScreenDensity.SCREEN_DENSITY_SDPI, // 屏幕像素密度为'sdpi' displayId: 1, // 应用在Id为1的物理屏上显示 hasPointerDevice: true, // 指针类型设备已连接 }; @@ -133,7 +135,7 @@ try { console.error('updateConfiguration fail, err: ${JSON.stringify(err)}'); }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -168,14 +170,14 @@ import abilityManager from '@ohos.app.ability.abilityManager'; try { abilityManager.getAbilityRunningInfos((err, data) => { - if (err && err.code !== 0) { + if (err) { console.error('getAbilityRunningInfos fail, error: ${JSON.stringify(err)}'); } else { console.log('getAbilityRunningInfos success, data: ${JSON.stringify(data)}'); } }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -215,7 +217,7 @@ try { console.error('getAbilityRunningInfos fail, err: ${JSON.stringify(err)}'); }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -252,15 +254,15 @@ import abilityManager from '@ohos.app.ability.abilityManager'; let upperLimit = 10; try { - abilityManager.getExtensionRunningInfos(upperLimit, (err, data) => { - if (err && err.code !== 0) { + abilityManager.getExtensionRunningInfos(upperLimit, (err, data) => { + if (err) { console.error('getExtensionRunningInfos fail, err: ${JSON.stringify(err)}'); } else { console.log('getExtensionRunningInfos success, data: ${JSON.stringify(data)}'); } }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -308,7 +310,7 @@ try { console.error('getExtensionRunningInfos fail, err: ${JSON.stringify(err)}'); }); } catch (paramError) { - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -340,7 +342,7 @@ getTopAbility(callback: AsyncCallback\): void; import abilityManager from '@ohos.app.ability.abilityManager'; abilityManager.getTopAbility((err, data) => { - if (err && err.code !== 0) { + if (err) { console.error('getTopAbility fail, err: ${JSON.stringify(err)}'); } else { console.log('getTopAbility success, data: ${JSON.stringify(data)}'); @@ -380,4 +382,79 @@ abilityManager.getTopAbility().then((data) => { }).catch((err) => { console.error('getTopAbility fail, err: ${JSON.stringify(err)}'); }); +``` + +## acquireShareData10+ + +acquireShareData(missionId: number, callback: AsyncCallback<{[key: string]: Object}>): void; + +获取目标设备的分享数据(callback形式)。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core + +**参数**: + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ---------------------------------------- | ---- | -------------- | +| missionId | number | 是 | 目标设备的missionId,最大为231-1。 | +| callback | AsyncCallback<{[key: string]: Object}> | 是 | 以回调方式返回接口运行结果及分享得到的数据,可进行错误处理或其他自定义处理。 | + +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000050 | Internal error. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + +**示例**: + +```ts +import abilityManager from '@ohos.app.ability.abilityManager'; + +abilityManager.acquireShareData(1, (err, wantParam) => { + if (err) { + console.error(`acquireShareData fail, err: ${JSON.stringify(err)}`); + } else { + console.log(`acquireShareData success, data: ${JSON.stringify(data)}`); + } +}); + +``` + +## acquireShareData10+ + +acquireShareData(missionId: number): Promise<{[key: string]: Object}>; + +获取目标设备的分享数据(Promise形式)。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core + +**返回值:** + +| 类型 | 说明 | +| ---------------------------------------- | ------- | +| Promise<{[key: string]: Object}>| 以Promise方式返回接口运行结果及分享数据,可进行错误处理或其他自定义处理。 | + +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000050 | Internal error. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + +**示例**: + +```ts +import abilityManager from '@ohos.app.ability.abilityManager'; +try { + abilityManager.acquireShareData(1).then((wantParam) => { + console.log(`acquireShareData success, data: ${JSON.stringify(data)}`); + }).catch((err) => { + console.error(`acquireShareData fail, err: ${JSON.stringify(err)}`); + }); +} catch (paramError) { + console.error(`error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}`); +} ``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-appManager.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-appManager.md index e21fa06af545b8620f13fc7a2b3a45de3570b229..e633beeffecc38634965b99c78200796322d173c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-appManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-appManager.md @@ -40,7 +40,7 @@ static isRunningInStabilityTest(callback: AsyncCallback<boolean>): void import appManager from '@ohos.app.ability.appManager'; appManager.isRunningInStabilityTest((err, flag) => { - if (err && err.code !== 0) { + if (err) { console.error('isRunningInStabilityTest fail, err: ${JSON.stringify(err)}'); } else { console.log('The result of isRunningInStabilityTest is: ${JSON.stringify(flag)}'); @@ -146,7 +146,7 @@ isRamConstrainedDevice(callback: AsyncCallback\): void; import appManager from '@ohos.app.ability.appManager'; appManager.isRamConstrainedDevice((err, data) => { - if (err && err.code !== 0) { + if (err) { console.error('isRamConstrainedDevice fail, err: ${JSON.stringify(err)}'); } else { console.log('The result of isRamConstrainedDevice is: ${JSON.stringify(data)}'); @@ -216,7 +216,7 @@ getAppMemorySize(callback: AsyncCallback\): void; import appManager from '@ohos.app.ability.appManager'; appManager.getAppMemorySize((err, data) => { - if (err && err.code !== 0) { + if (err) { console.error('getAppMemorySize fail, err: ${JSON.stringify(err)}'); } else { console.log('The size of app memory is: ${JSON.stringify(data)}'); @@ -290,7 +290,7 @@ getRunningProcessInformation(callback: AsyncCallback\ import appManager from '@ohos.app.ability.appManager'; appManager.getRunningProcessInformation((err, data) => { - if (err && err.code !== 0) { + if (err) { console.error('getRunningProcessInformation fail, err: ${JSON.stringify(err)}'); } else { console.log('The process running information is: ${JSON.stringify(data)}'); @@ -459,7 +459,7 @@ off(type: 'applicationState', observerId: number, callback: AsyncCallback\; ```ts import appManager from '@ohos.app.ability.appManager'; -let observeId = 0; +let observerId = 0; // 1.注册应用状态监听器 let applicationStateObserver = { @@ -612,7 +612,7 @@ getForegroundApplications(callback: AsyncCallback\>): void; import appManager from '@ohos.app.ability.appManager'; function getForegroundApplicationsCallback(err, data) { - if (err && err.code !== 0) { + if (err) { console.error('getForegroundApplicationsCallback fail, err: ${JSON.stringify(err)}'); } else { console.log('getForegroundApplicationsCallback success, data: ${JSON.stringify(data)}'); @@ -745,7 +745,7 @@ import appManager from '@ohos.app.ability.appManager'; let bundleName = 'bundleName'; let accountId = 0; function killProcessWithAccountCallback(err, data) { - if (err && err.code !== 0) { + if (err) { console.error('killProcessWithAccountCallback fail, err: ${JSON.stringify(err)}'); } else { console.log('killProcessWithAccountCallback success.'); @@ -788,7 +788,7 @@ import appManager from '@ohos.app.ability.appManager'; let bundleName = 'bundleName'; function killProcessesByBundleNameCallback(err, data) { - if (err && err.code !== 0) { + if (err) { console.error('killProcessesByBundleNameCallback fail, err: ${JSON.stringify(err)}'); } else { console.log('killProcessesByBundleNameCallback success.'); @@ -884,7 +884,7 @@ import appManager from '@ohos.app.ability.appManager'; let bundleName = 'bundleName'; function clearUpApplicationDataCallback(err, data) { - if (err && err.code !== 0) { + if (err) { console.error('clearUpApplicationDataCallback fail, err: ${JSON.stringify(err)}'); } else { console.log('clearUpApplicationDataCallback success.'); diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-appRecovery.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-appRecovery.md index 50a0c9579711d987b6a02070d7407eced15925f2..94ac177abec2771b0bda6c3f0413b97bea8f8ec8 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-appRecovery.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-appRecovery.md @@ -4,7 +4,7 @@ appRecovery模块提供了应用在故障状态下的恢复能力。 > **说明:** > -> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。当前版本仅支持单进程中单Ability的应用恢复。 +> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。API9仅支持单进程中单Ability的应用恢复。API10支持进程中包含多个Ability的场景。 ## 导入模块 ```ts @@ -51,7 +51,7 @@ import appRecovery from '@ohos.app.ability.appRecovery'; enableAppRecovery(restart?: [RestartFlag](#apprecoveryrestartflag), saveOccasion?: [SaveOccasionFlag](#apprecoverysaveoccasionflag), saveMode?: [SaveModeFlag](#apprecoverysavemodeflag)) : void; -使能应用恢复功能,参数按顺序填入。 +使能应用恢复功能,参数按顺序填入。该接口调用后,应用从启动器启动时第一个Ability支持恢复。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -72,9 +72,9 @@ import AbilityStage from '@ohos.app.ability.AbilityStage'; export default class MyAbilityStage extends AbilityStage { onCreate() { appRecovery.enableAppRecovery( - appRecovery.RestartFlag::ALWAYS_RESTART, - appRecovery.SaveOccasionFlag::SAVE_WHEN_ERROR, - appRecovery.SaveModeFlag::SAVE_WITH_FILE + appRecovery.RestartFlag.ALWAYS_RESTART, + appRecovery.SaveOccasionFlag.SAVE_WHEN_ERROR, + appRecovery.SaveModeFlag.SAVE_WITH_FILE ); } } @@ -84,7 +84,14 @@ export default class MyAbilityStage extends AbilityStage { restartApp(): void; -重启当前App进程,可以配合[errorManager](js-apis-app-ability-errorManager.md)相关接口使用。 +重启当前进程,并拉起应用启动时第一个Ability,如果该Ability存在已经保存的状态,这些状态数据会在Ability的OnCreate生命周期回调的want参数中作为wantParam属性传入。 + +API10时将启动由[setRestartWant](#apprecoverysetrestartwant)指定的Ability。如果没有指定则按以下规则启动:\ +如果当前应用前台的Ability支持恢复,则重新拉起该Ability。\ +如果存在多个支持恢复的Ability处于前台,则只拉起最后一个。\ +如果没有Ability处于前台,则不拉起。 + +可以配合[errorManager](js-apis-app-ability-errorManager.md)相关接口使用。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -142,3 +149,65 @@ try { console.error('error: ${paramError.code}, ${paramError.message}'); } ``` + +## appRecovery.saveAppState10+ + +saveAppState(context?: UIAbilityContext): boolean; + +主动保存Ability的状态,这个状态将在下次恢复启动时使用。可以配合[errorManager](js-apis-app-ability-errorManager.md)相关接口使用 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| context | [UIAbilityContext](js-apis-inner-application-uiAbilityContext.md)| 否 | UIAbility上下文环境。 | + +**返回值:** + +| 类型 | 说明 | +| -------- | -------- | +| boolean | 保存成功与否。true:保存成功,false:保存失败。 | + +**示例:** + +```ts +import appRecovery from '@ohos.app.ability.appRecovery'; +onBackground() { + hilog.info(0x0000, '[demo]', '%{public}s', 'EntryAbility onBackground'); + appRecovery.saveAppState(this.context) +} +``` + +## appRecovery.setRestartWant10+ + +setRestartWant(want: Want): void; + +设置下次恢复主动拉起场景下的Ability。该Ability必须为当前包下的UIAbility。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| want | [Want](js-apis-application-want.md)| 是 | 通过设置Want中"bundleName"和"abilityName"字段来指定恢复重启的Ability。 | + +**示例:** + +```ts +import appRecovery from '@ohos.app.ability.appRecovery'; +Button("启动到恢复Ability") + .fontSize(40) + .fontWeight(FontWeight.Bold) + .onClick(()=> { + // set restart want + let want = { + bundleName: "ohos.samples.recovery", + abilityName: "RecoveryAbility" + }; + + appRecovery.setRestartWant(want); + }) +``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-common.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-common.md index bd6bccb49048fc3cdc49075e4b22f59a9e2c784c..6b864a63ac5748aa57d97536d44f53b0ce0107ef 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-common.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-common.md @@ -26,7 +26,7 @@ import common from '@ohos.app.ability.common'; | FormExtensionContext | [FormExtensionContext](js-apis-inner-application-formExtensionContext.md) | FormExtensionContext二级模块。 | | ServiceExtensionContext | [ServiceExtensionContext](js-apis-inner-application-serviceExtensionContext.md) | ServiceExtensionContext二级模块。 | | EventHub | [EventHub](js-apis-inner-application-eventHub.md) | EventHub二级模块。 | -| PacMap | [PacMap](js-apis-inner-ability-dataAbilityHelper.md#PacMap) | PacMap二级模块。 | +| PacMap | [PacMap](js-apis-inner-application-pacMap.md) | PacMap二级模块。 | | AbilityResult | [AbilityResult](js-apis-inner-ability-abilityResult.md) | AbilityResult二级模块。 | | ConnectOptions | [ConnectOptions](js-apis-inner-ability-connectOptions.md) | ConnectOptions二级模块。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-environmentCallback.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-environmentCallback.md index cddd09e717948af700578b2b80bdbdf94c58c26b..d81a587c78a62aa5d413cf9ab10860cabc5c6beb 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-environmentCallback.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-environmentCallback.md @@ -35,7 +35,7 @@ onMemoryLevel(level: AbilityConstant.MemoryLevel): void; 注册系统环境变化的监听后,在系统内存变化时触发回调。 -**系统能力**:SystemCapability.Ability.AbilityRuntime.Core +**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore **参数:** @@ -55,7 +55,7 @@ export default class MyAbility extends UIAbility { onCreate() { console.log('MyAbility onCreate'); globalThis.applicationContext = this.context.getApplicationContext(); - let EnvironmentCallback = { + let environmentCallback = { onConfigurationUpdated(config){ console.log('onConfigurationUpdated config: ${JSON.stringify(config)}'); } @@ -67,7 +67,7 @@ export default class MyAbility extends UIAbility { // 1.获取applicationContext let applicationContext = globalThis.applicationContext; // 2.通过applicationContext注册监听应用内生命周期 - callbackId = applicationContext.registerEnvironmentCallback(EnvironmentCallback); + callbackId = applicationContext.registerEnvironmentCallback(environmentCallback); console.log('registerEnvironmentCallback number: ${JSON.stringify(callbackId)}'); } onDestroy() { diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-errorManager.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-errorManager.md index a7323715d263ebdeb399927eedc1c336312c903f..640b08d8cd0ffe1a259e663a9df514bdc175a61b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-errorManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-errorManager.md @@ -32,12 +32,27 @@ on(type: 'error', observer: ErrorObserver): number; | -------- | -------- | | number | 观察器的index值,和观察器一一对应。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000003 | Id does not exist. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts let observer = { onUnhandledException(errorMsg) { console.log('onUnhandledException, errorMsg: ', errorMsg); + }, + onException(errorObj) { + console.log('onException, name: ', errorObj.name); + console.log('onException, message: ', errorObj.message); + if (typeof(errorObj.stack) === 'string') { + console.log('onException, stack: ', errorObj.stack); + } } }; let observerId = -1; @@ -64,6 +79,14 @@ off(type: 'error', observerId: number, callback: AsyncCallback\): void; | observerId | number | 是 | 由on方法返回的观察器的index值。 | | callback | AsyncCallback\ | 是 | 表示指定的回调方法。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000003 | Id does not exist. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -102,6 +125,14 @@ off(type: 'error', observerId: number): Promise\; | -------- | -------- | | Promise\ | 返回执行结果。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000003 | Id does not exist. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-missionManager.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-missionManager.md index 97cc759d203d74b68ddd0c59de0da47e255833f3..4f41fa7a307f7584da825acbf4c8232799d837ce 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-missionManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-missionManager.md @@ -122,6 +122,14 @@ off(type: 'mission', listenerId: number, callback: AsyncCallback<void>): v | listenerId | number | 是 | 系统任务状态监器法的index值,和监听器一一对应,由on方法返回。 | | callback | AsyncCallback<void> | 是 | 执行结果回调函数。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16300002 | Input error. The specified mission listener does not exist. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -209,6 +217,14 @@ off(type: 'mission', listenerId: number): Promise<void>; | -------- | -------- | | Promise<void> | promise方式返回执行结果。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16300002 | Input error. The specified mission listener does not exist. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -290,7 +306,7 @@ getMissionInfo(deviceId: string, missionId: number, callback: AsyncCallback<M | -------- | -------- | -------- | -------- | | deviceId | string | 是 | 设备ID,本机默认为空字符串。 | | missionId | number | 是 | 任务ID。 | - | callback | AsyncCallback<[MissionInfo](./js-apis-inner-application-missionInfo.md))> | 是 | 执行结果回调函数,返回任务信息。 | + | callback | AsyncCallback<[MissionInfo](./js-apis-inner-application-missionInfo.md)> | 是 | 执行结果回调函数,返回任务信息。 | **示例:** @@ -306,7 +322,7 @@ getMissionInfo(deviceId: string, missionId: number, callback: AsyncCallback<M missionManager.getMissionInfo('', testMissionId, (error, mission) => { if (error) { - console.error('getMissionInfo failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfo failed, error.code: ${error.code}, error.message: ${error.message}'); } else { console.log('mission.missionId = ${mission.missionId}'); console.log('mission.runningState = ${mission.runningState}'); @@ -392,7 +408,7 @@ getMissionInfos(deviceId: string, numMax: number, callback: AsyncCallback<Arr try { missionManager.getMissionInfos('', 10, (error, missions) => { if (error) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); } else { console.log('size = ${missions.length}'); console.log('missions = ${JSON.stringify(missions)}'); @@ -624,6 +640,14 @@ lockMission(missionId: number, callback: AsyncCallback<void>): void; | missionId | number | 是 | 任务ID。 | | callback | AsyncCallback<void> | 是 | 执行结果回调函数。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16300001 | Mission not found. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -667,6 +691,14 @@ lockMission(missionId: number): Promise<void>; | -------- | -------- | | Promise<void> | promise方式返回执行结果。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16300001 | Mission not found. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts import missionManager from '@ohos.app.ability.missionManager'; @@ -702,6 +734,14 @@ unlockMission(missionId: number, callback: AsyncCallback<void>): void; | missionId | number | 是 | 任务ID。 | | callback | AsyncCallback<void> | 是 | 执行结果回调函数。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16300001 | Mission not found. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts import missionManager from '@ohos.app.ability.missionManager'; @@ -744,6 +784,14 @@ unlockMission(missionId: number): Promise<void>; | -------- | -------- | | Promise<void> | promise方式返回执行结果。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16300001 | Mission not found. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -924,6 +972,14 @@ moveMissionToFront(missionId: number, callback: AsyncCallback<void>): void | missionId | number | 是 | 任务ID。 | | callback | AsyncCallback<void> | 是 | 执行结果回调函数。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000009 | An ability cannot be started or stopped in Wukong mode. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -963,6 +1019,14 @@ moveMissionToFront(missionId: number, options: StartOptions, callback: AsyncCall | options | [StartOptions](js-apis-app-ability-startOptions.md) | 是 | 启动参数选项,用于指定任务切到前台时的窗口模式,设备ID等。 | | callback | AsyncCallback<void> | 是 | 执行结果回调函数。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000009 | An ability cannot be started or stopped in Wukong mode. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -1007,6 +1071,14 @@ moveMissionToFront(missionId: number, options?: StartOptions): Promise<void&g | -------- | -------- | | Promise<void> | promise方式返回执行结果。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000009 | An ability cannot be started or stopped in Wukong mode. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-quickFixManager.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-quickFixManager.md index b9ae553c8814f479412f04c6e016492306396727..0b908a0bd49caa2dcd9020a731818e17fa7af889 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-quickFixManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-quickFixManager.md @@ -62,6 +62,25 @@ applyQuickFix(hapModuleQuickFixFiles: Array\, callback: AsyncCallback\ | 是 | 快速修复补丁文件(补丁文件需包含有效的文件路径)。 | | callback | AsyncCallback\ | 是 | 表示指定的回调方法。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 18500002 | Copy file failed, maybe not exist or inaccessible. | +| 18500008 | Internal error. | + +在打补丁过程中发生的错误,其错误码及错误信息通过公共事件[COMMON_EVENT_QUICK_FIX_APPLY_RESULT](commonEvent-definitions.md#common_event_quick_fix_apply_result9)的参数返回给应用开发者。这部分错误码及错误信息如下: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 18500003 | Deploy hqf failed. | +| 18500004 | Switch hqf failed. | +| 18500005 | Delete hqf failed. | +| 18500006 | Load patch failed. | +| 18500007 | Unload patch failed. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + > 说明:调用applyQuickFix接口时,补丁文件所在路径为应用沙箱路径。沙箱路径的获取参考[获取应用的沙箱路径](js-apis-bundle-BundleInstaller.md#获取应用的沙箱路径),映射到设备上的路径为/proc/<应用进程Id>/root/沙箱路径。 **示例:** @@ -105,6 +124,25 @@ applyQuickFix(hapModuleQuickFixFiles: Array\): Promise\; | -------- | -------- | | Promise\ | 返回相应结果。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 18500002 | Copy file failed, maybe not exist or inaccessible. | +| 18500008 | Internal error. | + +在打补丁过程中发生的错误,其错误码及错误信息通过公共事件[COMMON_EVENT_QUICK_FIX_APPLY_RESULT](commonEvent-definitions.md#common_event_quick_fix_apply_result9)的参数返回给应用开发者。这部分错误码及错误信息如下: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 18500003 | Deploy hqf failed. | +| 18500004 | Switch hqf failed. | +| 18500005 | Delete hqf failed. | +| 18500006 | Load patch failed. | +| 18500007 | Unload patch failed. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -139,6 +177,15 @@ getApplicationQuickFixInfo(bundleName: string, callback: AsyncCallback\ | 是 | 应用的快速修复信息。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 18500001 | The bundle is not exist. | +| 18500008 | Internal error. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -180,6 +227,15 @@ getApplicationQuickFixInfo(bundleName: string): Promise\ | 返回应用的快速修复信息。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 18500001 | The bundle is not exist. | +| 18500008 | Internal error. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md index 0b27ca5b66f7157df5a301df10f07150968f9173..8e521d379da256f91114d62f06a822f01903758c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-serviceExtensionAbility.md @@ -106,7 +106,7 @@ Extension生命周期回调,如果是startAbility或者startServiceExtensionAb ## ServiceExtensionAbility.onConnect -onConnect(want: Want): rpc.RemoteObject; +onConnect(want: Want): rpc.RemoteObject | Promise; Extension生命周期回调,如果是connectAbility拉起的服务,会在onCreate之后回调。返回一个RemoteObject对象,用于客户端和服务端进行通信。 @@ -148,7 +148,7 @@ Extension生命周期回调,如果是connectAbility拉起的服务,会在onC ## ServiceExtensionAbility.onDisconnect -onDisconnect(want: Want): void; +onDisconnect(want: Want): void | Promise\; Extension的生命周期回调,客户端执行断开连接服务时回调。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-startOptions.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-startOptions.md index ca1f60b2d08a6d425c0ac15af6ebdcf31c464efe..b761614625d15acde69c7e0ad990544fd02ae0af 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-startOptions.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-startOptions.md @@ -32,12 +32,12 @@ import StartOptions from '@ohos.app.ability.StartOptions'; try { missionManager.getMissionInfos('', 10, (error, missions) => { - if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + if (error) { + console.error(`getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}`); return; } - console.log('size = ${missions.length}'); - console.log('missions = ${JSON.stringify(missions)}'); + console.log(`size = ${missions.length}`); + console.log(`missions = ${JSON.stringify(missions)}`); let id = missions[0].missionId; let startOptions = { @@ -45,10 +45,10 @@ import StartOptions from '@ohos.app.ability.StartOptions'; displayId: 0 }; missionManager.moveMissionToFront(id, startOptions).then(() => { - console.log('moveMissionToFront is called '); + console.log('moveMissionToFront is called'); }); }); } catch (paramError) { - console.error('error: ${paramError.code}, ${paramError.message}'); + console.error(`error: ${paramError.code}, ${paramError.message}`); } ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md index 070de1799439d2f830309b00bd804f249b4b8db5..da52ea4a49fc2b6c10123538a887f08ee4310357 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md @@ -124,7 +124,7 @@ onWindowStageRestore(windowStage: window.WindowStage): void ## UIAbility.onDestroy -onDestroy(): void; +onDestroy(): void | Promise<void>; UIAbility生命周期回调,在销毁时回调,执行资源清理等操作。 @@ -181,7 +181,7 @@ UIAbility生命周期回调,当应用从前台转到后台时触发。 ## UIAbility.onContinue -onContinue(wantParam : {[key: string]: any}): AbilityConstant.OnContinueResult; +onContinue(wantParam: { [key: string]: Object }): AbilityConstant.OnContinueResult; 当ability迁移准备迁移时触发,保存数据。 @@ -267,7 +267,7 @@ onDump(params: Array\): Array\; ## UIAbility.onSaveState -onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: any}): AbilityConstant.OnSaveResult; +onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: Object}): AbilityConstant.OnSaveResult; 该API配合[appRecovery](js-apis-app-ability-appRecovery.md)使用。在应用故障时,如果使能了自动保存状态,框架将回调onSaveState保存UIAbility状态。 @@ -300,6 +300,33 @@ class MyUIAbility extends UIAbility { } ``` +## UIAbility.onShare10+ + +onShare(wantParam:{ [key: string]: Object }): void; + +ability分享数据。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| wantParam | {[key: string]: Object} | 是 | want相关参数。 | + +**示例:** + + ```ts +import AbilityConstant from '@ohos.app.ability.AbilityConstant'; +class MyUIAbility extends UIAbility { + onShare(wantParams) { + console.log('onShare'); + wantParams['ohos.extra.param.key.contentTitle'] = {title: "W3"}; + wantParams['ohos.extra.param.key.shareAbstract'] = {abstract: "communication for huawei employee"}; + wantParams['ohos.extra.param.key.shareUrl'] = {url: "w3.huawei.com"}; + } +} + ``` ## Caller @@ -308,7 +335,7 @@ class MyUIAbility extends UIAbility { ## Caller.call -call(method: string, data: rpc.Sequenceable): Promise<void>; +call(method: string, data: rpc.Parcelable): Promise<void>; 向通用组件服务端发送约定序列化数据。 @@ -319,7 +346,7 @@ call(method: string, data: rpc.Sequenceable): Promise<void>; | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | method | string | 是 | 约定的服务端注册事件字符串。 | -| data | [rpc.Sequenceable](js-apis-rpc.md#sequenceabledeprecated) | 是 | 由开发者实现的Sequenceable可序列化数据。 | +| data | [rpc.Parcelable](js-apis-rpc.md#parcelable9) | 是 | 由开发者实现的Parcelable可序列化数据。 | **返回值:** @@ -331,14 +358,16 @@ call(method: string, data: rpc.Sequenceable): Promise<void>; | 错误码ID | 错误信息 | | ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | +| 16200001 | Caller released. The caller has been released. | +| 16200002 | Callee invalid. The callee does not exist. | +| 16000050 | Internal Error. | 以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 **示例:** ```ts - class MyMessageAble{ // 自定义的Sequenceable数据结构 + class MyMessageAble{ // 自定义的Parcelable数据结构 name:'' str:'' num: 1 @@ -346,15 +375,15 @@ call(method: string, data: rpc.Sequenceable): Promise<void>; this.name = name; this.str = str; } - marshalling(messageParcel) { - messageParcel.writeInt(this.num); - messageParcel.writeString(this.str); + marshalling(messageSequence) { + messageSequence.writeInt(this.num); + messageSequence.writeString(this.str); console.log('MyMessageAble marshalling num[${this.num}] str[${this.str}]'); return true; } - unmarshalling(messageParcel) { - this.num = messageParcel.readInt(); - this.str = messageParcel.readString(); + unmarshalling(messageSequence) { + this.num = messageSequence.readInt(); + this.str = messageSequence.readString(); console.log('MyMessageAble unmarshalling num[${this.num}] str[${this.str}]'); return true; } @@ -369,16 +398,16 @@ call(method: string, data: rpc.Sequenceable): Promise<void>; deviceId: '' }).then((obj) => { caller = obj; - let msg = new MyMessageAble('msg', 'world'); // 参考Sequenceable数据定义 + let msg = new MyMessageAble('msg', 'world'); // 参考Parcelable数据定义 caller.call(method, msg) .then(() => { console.log('Caller call() called'); }) .catch((callErr) => { - console.log('Caller.call catch error, error.code: ${JSON.stringify(callErr.code)}, error.message: ${JSON.stringify(callErr.message)}'); + console.log('Caller.call catch error, error.code: ${callErr.code}, error.message: ${callErr.message}'); }); }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -387,7 +416,7 @@ call(method: string, data: rpc.Sequenceable): Promise<void>; ## Caller.callWithResult -callWithResult(method: string, data: rpc.Sequenceable): Promise<rpc.MessageParcel>; +callWithResult(method: string, data: rpc.Parcelable): Promise<rpc.MessageSequence>; 向通用组件服务端发送约定序列化数据, 并将服务端返回的约定序列化数据带回。 @@ -398,19 +427,21 @@ callWithResult(method: string, data: rpc.Sequenceable): Promise<rpc.MessagePa | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | method | string | 是 | 约定的服务端注册事件字符串。 | -| data | [rpc.Sequenceable](js-apis-rpc.md#sequenceabledeprecated) | 是 | 由开发者实现的Sequenceable可序列化数据。 | +| data | [rpc.Parcelable](js-apis-rpc.md#parcelable9) | 是 | 由开发者实现的Parcelable可序列化数据。 | **返回值:** | 类型 | 说明 | | -------- | -------- | -| Promise<[rpc.MessageParcel](js-apis-rpc.md#sequenceabledeprecated)> | Promise形式返回通用组件服务端应答数据。 | +| Promise<[rpc.MessageSequence](js-apis-rpc.md#messagesequence9)> | Promise形式返回通用组件服务端应答数据。 | **错误码:** | 错误码ID | 错误信息 | | ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | +| 16200001 | Caller released. The caller has been released. | +| 16200002 | Callee invalid. The callee does not exist. | +| 16000050 | Internal Error. | 以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 @@ -425,15 +456,15 @@ callWithResult(method: string, data: rpc.Sequenceable): Promise<rpc.MessagePa this.name = name; this.str = str; } - marshalling(messageParcel) { - messageParcel.writeInt(this.num); - messageParcel.writeString(this.str); + marshalling(messageSequence) { + messageSequence.writeInt(this.num); + messageSequence.writeString(this.str); console.log('MyMessageAble marshalling num[${this.num}] str[${this.str}]'); return true; } - unmarshalling(messageParcel) { - this.num = messageParcel.readInt(); - this.str = messageParcel.readString(); + unmarshalling(messageSequence) { + this.num = messageSequence.readInt(); + this.str = messageSequence.readString(); console.log('MyMessageAble unmarshalling num[${this.num] str[${this.str}]'); return true; } @@ -453,13 +484,13 @@ callWithResult(method: string, data: rpc.Sequenceable): Promise<rpc.MessagePa .then((data) => { console.log('Caller callWithResult() called'); let retmsg = new MyMessageAble(0, ''); - data.readSequenceable(retmsg); + data.readParcelable(retmsg); }) .catch((callErr) => { - console.log('Caller.callWithResult catch error, error.code: ${JSON.stringify(callErr.code)}, error.message: ${JSON.stringify(callErr.message)}'); + console.log('Caller.callWithResult catch error, error.code: ${callErr.code}, error.message: ${callErr.message}'); }); }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -478,10 +509,10 @@ release(): void; | 错误码ID | 错误信息 | | ------- | -------------------------------- | -| 401 | Invalid input parameter. | | 16200001 | Caller released. The caller has been released. | | 16200002 | Callee invalid. The callee does not exist. | -| 16000050 | Internal Error. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 **示例:** @@ -498,10 +529,10 @@ release(): void; try { caller.release(); } catch (releaseErr) { - console.log('Caller.release catch error, error.code: ${JSON.stringify(releaseErr.code)}, error.message: ${JSON.stringify(releaseErr.message)}'); + console.log('Caller.release catch error, error.code: ${releaseErr.code}, error.message: ${releaseErr.message}'); } }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -509,17 +540,25 @@ release(): void; ## Caller.onRelease - onRelease(callback: OnReleaseCallBack): void; + onRelease(callback: OnReleaseCallback): void; 注册通用组件服务端Stub(桩)断开监听通知。 **系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------- | +| 16200001 | Caller released. The caller has been released. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| callback | [OnReleaseCallBack](#onreleasecallback) | 是 | 返回onRelease回调结果。 | +| callback | [OnReleaseCallback](#onreleasecallback) | 是 | 返回onRelease回调结果。 | **示例:** @@ -538,15 +577,66 @@ release(): void; console.log(' Caller OnRelease CallBack is called ${str}'); }); } catch (error) { - console.log('Caller.onRelease catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('Caller.onRelease catch error, error.code: $error.code}, error.message: ${error.message}'); } }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } ``` + ## Caller.onRemoteStateChange + + onRemoteStateChange(callback: OnRemoteStateChangeCallback): void; + +注册协同场景下跨设备组件状态变化监听通知。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| callback | [OnRemoteStateChangeCallback](#onremotestatechangecallback) | 是 | 返回onRemoteStateChange回调结果。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------- | +| 16200001 | Caller released. The caller has been released. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + +**示例:** + + ```ts + import UIAbility from '@ohos.app.ability.UIAbility'; + + let caller; + let dstDeviceId: string; + export default class MainAbility extends UIAbility { + onWindowStageCreate(windowStage: Window.WindowStage) { + this.context.startAbilityByCall({ + bundleName: 'com.example.myservice', + abilityName: 'MainUIAbility', + deviceId: dstDeviceId + }).then((obj) => { + caller = obj; + try { + caller.onRemoteStateChange((str) => { + console.log('Remote state changed ' + str); + }); + } catch (error) { + console.log('Caller.onRemoteStateChange catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + } + }).catch((err) => { + console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + }); + } + } + ``` + ## Caller.on on(type: 'release', callback: OnReleaseCallback): void; @@ -560,13 +650,13 @@ release(): void; | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | type | string | 是 | 监听releaseCall事件,固定为'release'。 | -| callback | [OnReleaseCallBack](#onreleasecallback) | 是 | 返回onRelease回调结果。 | +| callback | [OnReleaseCallback](#onreleasecallback) | 是 | 返回onRelease回调结果。 | **错误码:** | 错误码ID | 错误信息 | | ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | +| 16200001 | Caller released. The caller has been released. | 以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 @@ -587,10 +677,10 @@ release(): void; console.log(' Caller OnRelease CallBack is called ${str}'); }); } catch (error) { - console.log('Caller.on catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('Caller.on catch error, error.code: ${error.code}, error.message: ${error.message}'); } }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -609,14 +699,7 @@ off(type: 'release', callback: OnReleaseCallback): void; | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | type | string | 是 | 监听releaseCall事件,固定为'release'。 | -| callback | [OnReleaseCallBack](#onreleasecallback) | 是 | 返回off回调结果。 | - -**错误码:** - -| 错误码ID | 错误信息 | -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | -其他ID见[元能力子系统错误码](../errorcodes/errorcode-ability.md) +| callback | [OnReleaseCallback](#onreleasecallback) | 是 | 返回off回调结果。 | **示例:** @@ -637,10 +720,10 @@ off(type: 'release', callback: OnReleaseCallback): void; caller.on('release', onReleaseCallBack); caller.off('release', onReleaseCallBack); } catch (error) { - console.log('Caller.on or Caller.off catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('Caller.on or Caller.off catch error, error.code: ${error.code}, error.message: ${error.message}'); } }).catch((err) => { - console.log('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.log('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -660,13 +743,6 @@ off(type: 'release'): void; | -------- | -------- | -------- | -------- | | type | string | 是 | 监听releaseCall事件,固定为'release'。 | -**错误码:** - -| 错误码ID | 错误信息 | -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | -其他ID见[元能力子系统错误码](../errorcodes/errorcode-ability.md) - **示例:** ```ts @@ -686,10 +762,10 @@ off(type: 'release'): void; caller.on('release', onReleaseCallBack); caller.off('release'); } catch (error) { - console.error('Caller.on or Caller.off catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('Caller.on or Caller.off catch error, error.code: ${error.code}, error.message: ${error.message}'); } }).catch((err) => { - console.error('Caller GetCaller error, error.code: ${JSON.stringify(err.code)}, error.message: ${JSON.stringify(err.message)}'); + console.error('Caller GetCaller error, error.code: ${err.code}, error.message: ${err.message}'); }); } } @@ -712,13 +788,14 @@ on(method: string, callback: CalleeCallback): void; | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | method | string | 是 | 与客户端约定的通知消息字符串。 | -| callback | [CalleeCallback](#calleecallback) | 是 | 一个[rpc.MessageParcel](js-apis-rpc.md#messageparceldeprecated)类型入参的js通知同步回调函数, 回调函数至少要返回一个空的[rpc.Sequenceable](js-apis-rpc.md#sequenceabledeprecated)数据对象, 其他视为函数执行错误。 | +| callback | [CalleeCallback](#calleecallback) | 是 | 一个[rpc.MessageSequence](js-apis-rpc.md#messagesequence9)类型入参的js通知同步回调函数, 回调函数至少要返回一个空的[rpc.Parcelable](js-apis-rpc.md#parcelable9)数据对象, 其他视为函数执行错误。 | **错误码:** | 错误码ID | 错误信息 | | ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | +| 16200004 | Method registered. The method has registered. | +| 16000050 | Internal error. | 以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 @@ -733,15 +810,15 @@ on(method: string, callback: CalleeCallback): void; this.name = name; this.str = str; } - marshalling(messageParcel) { - messageParcel.writeInt(this.num); - messageParcel.writeString(this.str); + marshalling(messageSequence) { + messageSequence.writeInt(this.num); + messageSequence.writeString(this.str); console.log('MyMessageAble marshalling num[${this.num}] str[${this.str}]'); return true; } - unmarshalling(messageParcel) { - this.num = messageParcel.readInt(); - this.str = messageParcel.readString(); + unmarshalling(messageSequence) { + this.num = messageSequence.readInt(); + this.str = messageSequence.readString(); console.log('MyMessageAble unmarshalling num[${this.num}] str[${this.str}]'); return true; } @@ -750,7 +827,7 @@ on(method: string, callback: CalleeCallback): void; function funcCallBack(pdata) { console.log('Callee funcCallBack is called ${pdata}'); let msg = new MyMessageAble('test', ''); - pdata.readSequenceable(msg); + pdata.readParcelable(msg); return new MyMessageAble('test1', 'Callee test'); } export default class MainUIAbility extends UIAbility { @@ -759,7 +836,7 @@ on(method: string, callback: CalleeCallback): void; try { this.callee.on(method, funcCallBack); } catch (error) { - console.log('Callee.on catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('Callee.on catch error, error.code: ${error.code}, error.message: ${error.message}'); } } } @@ -783,7 +860,8 @@ off(method: string): void; | 错误码ID | 错误信息 | | ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | +| 16200005 | Method not registered. The method has not registered. | +| 16000050 | Internal error. | 以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 @@ -798,7 +876,7 @@ off(method: string): void; try { this.callee.off(method); } catch (error) { - console.log('Callee.off catch error, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.log('Callee.off catch error, error.code: ${error.code}, error.message: ${error.message}'); } } } @@ -814,12 +892,22 @@ off(method: string): void; | -------- | -------- | -------- | -------- | -------- | | (msg: string) | 是 | 否 | function | 调用者注册的侦听器函数接口的原型。 | +## OnRemoteStateChangeCallback + +(msg: string): void; + +**系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore + +| 名称 | 可读 | 可写 | 类型 | 说明 | +| -------- | -------- | -------- | -------- | -------- | +| (msg: string) | 是 | 否 | function | 调用者注册的协同场景下组件状态变化监听函数接口的原型。 | + ## CalleeCallback -(indata: rpc.MessageParcel): rpc.Sequenceable; +(indata: rpc.MessageSequence): rpc.Parcelable; **系统能力**:SystemCapability.Ability.AbilityRuntime.AbilityCore | 名称 | 可读 | 可写 | 类型 | 说明 | | -------- | -------- | -------- | -------- | -------- | -| (indata: [rpc.MessageParcel](js-apis-rpc.md#messageparceldeprecated)) | 是 | 否 | [rpc.Sequenceable](js-apis-rpc.md#sequenceabledeprecated) | 被调用方注册的消息侦听器函数接口的原型。 | +| (indata: [rpc.MessageSequence](js-apis-rpc.md#messagesequence9)) | 是 | 否 | [rpc.Parcelable](js-apis-rpc.md#parcelable9) | 被调用方注册的消息侦听器函数接口的原型。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-want.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-want.md index 1c5085195ca7703e0e9cdd76bc30b8dbe47f4423..ba737871aa6fb6434745828b4c551e6cf9cdae51 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-want.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-want.md @@ -26,7 +26,7 @@ import Want from '@ohos.app.ability.Want'; | entities | Array\ | 否 | 表示目标Ability额外的类别信息(如:浏览器、视频播放器)。在隐式Want中是对action字段的补充。在隐式Want中,您可以定义该字段,来过滤匹配Ability类型。 | | uri | string | 否 | 表示携带的数据,一般配合type使用,指明待处理的数据类型。如果在Want中指定了uri,则Want将匹配指定的Uri信息,包括`scheme`、`schemeSpecificPart`、`authority`和`path`信息。 | | type | string | 否 | 表示MIME type类型描述,打开文件的类型,主要用于文管打开文件。比如:'text/xml' 、 'image/*'等,MIME定义请参见https://www.iana.org/assignments/media-types/media-types.xhtml?utm_source=ld246.com。 | -| parameters | {[key: string]: any} | 否 | 表示WantParams描述,由开发者自行决定传入的键值对。默认会携带以下key值:
- ohos.aafwk.callerPid:表示拉起方的pid。
- ohos.aafwk.param.callerToken:表示拉起方的token。
- ohos.aafwk.param.callerUid:表示[BundleInfo](js-apis-bundleManager-bundleInfo.md#bundleinfo-1)中的uid,应用包里应用程序的uid。
- component.startup.newRules:表示是否启用新的管控规则。
- moduleName:表示拉起方的模块名,该字段的值即使定义成其他字符串,在传递到另一端时会被修改为正确的值。
- ohos.dlp.params.sandbox:表示dlp文件才会有。 | +| parameters | {[key: string]: any} | 否 | 表示WantParams描述,由开发者自行决定传入的键值对。默认会携带以下key值:
- ohos.aafwk.callerPid:表示拉起方的pid。
- ohos.aafwk.param.callerBundleName:表示拉起方的Bundle Name。
- ohos.aafwk.param.callerToken:表示拉起方的token。
- ohos.aafwk.param.callerUid:表示[BundleInfo](js-apis-bundleManager-bundleInfo.md#bundleinfo-1)中的uid,应用包里应用程序的uid。
- component.startup.newRules:表示是否启用新的管控规则。
- moduleName:表示拉起方的模块名,该字段的值即使定义成其他字符串,在传递到另一端时会被修改为正确的值。
- ohos.dlp.params.sandbox:表示dlp文件才会有。 | | [flags](js-apis-ability-wantConstant.md#wantconstantflags) | number | 否 | 表示处理Want的方式。默认传数字。
例如通过wantConstant.Flags.FLAG_ABILITY_CONTINUATION表示是否以设备间迁移方式启动Ability。 | **示例:** @@ -34,6 +34,7 @@ import Want from '@ohos.app.ability.Want'; - 基础用法:在UIAbility对象中调用,示例中的context的获取方式请参见[获取UIAbility的上下文信息](../../application-models/uiability-usage.md#获取uiability的上下文信息)。 ```ts + let context = ...; // UIAbilityContext let want = { 'deviceId': '', // deviceId为空表示本设备 'bundleName': 'com.example.myapplication', @@ -41,16 +42,17 @@ import Want from '@ohos.app.ability.Want'; 'moduleName': 'entry' // moduleName非必选 }; - this.context.startAbility(want, (err) => { + context.startAbility(want, (err) => { // 显式拉起Ability,通过bundleName、abilityName和moduleName可以唯一确定一个Ability - console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); + console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`); }); ``` -- 通过自定字段传递数据,以下为当前支持类型(在UIAbility对象中调用,示例中的context的获取方式请参见[获取UIAbility的上下文信息](../../application-models/uiability-usage.md#获取uiability的上下文信息))。 +- 目前支持的数据类型有:字符串、数字、布尔、对象、数组和文件描述符等。 * 字符串(String) ```ts + let context = ...; // UIAbilityContext let want = { bundleName: 'com.example.myapplication', abilityName: 'FuncAbility', @@ -59,12 +61,13 @@ import Want from '@ohos.app.ability.Want'; }, }; - this.context.startAbility(want, (err) => { - console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); + context.startAbility(want, (err) => { + console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`); }); ``` * 数字(Number) ```ts + let context = ...; // UIAbilityContext let want = { bundleName: 'com.example.myapplication', abilityName: 'FuncAbility', @@ -74,12 +77,13 @@ import Want from '@ohos.app.ability.Want'; }, }; - this.context.startAbility(want, (err) => { - console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); + context.startAbility(want, (err) => { + console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`); }); ``` * 布尔(Boolean) ```ts + let context = ...; // UIAbilityContext let want = { bundleName: 'com.example.myapplication', abilityName: 'FuncAbility', @@ -88,12 +92,13 @@ import Want from '@ohos.app.ability.Want'; }, }; - this.context.startAbility(want, (err) => { - console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); + context.startAbility(want, (err) => { + console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`); }); ``` * 对象(Object) ```ts + let context = ...; // UIAbilityContext let want = { bundleName: 'com.example.myapplication', abilityName: 'FuncAbility', @@ -107,12 +112,13 @@ import Want from '@ohos.app.ability.Want'; }, }; - this.context.startAbility(want, (err) => { - console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); + context.startAbility(want, (err) => { + console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`); }); ``` * 数组(Array) ```ts + let context = ...; // UIAbilityContext let want = { bundleName: 'com.example.myapplication', abilityName: 'FuncAbility', @@ -124,19 +130,21 @@ import Want from '@ohos.app.ability.Want'; }, }; - this.context.startAbility(want, (err) => { - console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); + context.startAbility(want, (err) => { + console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`); }); ``` * 文件描述符(FD) ```ts - import fileio from '@ohos.fileio'; + import fs from '@ohos.file.fs'; + + let context = ...; // UIAbilityContext let fd; try { - fd = fileio.openSync('/data/storage/el2/base/haps/pic.png'); - } catch(e) { - console.error('openSync fail: ${JSON.stringify(e)}'); + fd = fs.openSync('/data/storage/el2/base/haps/pic.png').fd; + } catch(err) { + console.error(`Failed to openSync. Code: ${err.code}, message: ${err.message}`); } let want = { 'deviceId': '', // deviceId为空表示本设备 @@ -148,8 +156,7 @@ import Want from '@ohos.app.ability.Want'; } }; - this.context.startAbility(want, (err) => { - console.error(`startAbility failed, code is ${err.code}, message is ${err.message}`); + context.startAbility(want, (err) => { + console.error(`Failed to startAbility. Code: ${err.code}, message: ${err.message}`); }); ``` - diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-wantAgent.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-wantAgent.md index 1091421a39f7461e182a2ad5f5b149670d14abb7..be50fee49f3337029f03f67e39383cfc4a49366b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-wantAgent.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-wantAgent.md @@ -28,31 +28,13 @@ getWantAgent(info: WantAgentInfo, callback: AsyncCallback\): void | callback | AsyncCallback\ | 是 | 创建WantAgent的回调方法。 | **错误码:** -错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + | 错误码ID | 错误信息 | |-----------|--------------------| -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong.| -| 16000003 | Input error. The specified id does not exist.| -| 16000004 | Visibility verification failed.| -| 16000006 | Can not cross user operations.| | 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| -| 16000008 | Crowdtest App Expiration.| -| 16000009 | Can not start ability in wukong mode.| -| 16000010 | Can not operation with continue flag.| -| 16000011 | Context does not exist.| -| 16000050 | Internal Error.| -| 16000051 | Network error. The network is abnormal.| -| 16000052 | Free install not support. The applicaiotn dose not support free install.| -| 16000053 | Not top ability. The application is not top ability.| -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.| -| 16000055 | Free install timeout.| -| 16000056 | Can not free install other ability.| -| 16000057 | Not support cross device free install.| -| 16000101 | execute shell command failed.| | 16000151 | Invalid wantagent object.| -| 16000152 | wantAgent object not found.| -| 16000153 | wangAgent object canceled.| + +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) **示例:** @@ -125,31 +107,13 @@ getWantAgent(info: WantAgentInfo): Promise\ | Promise\ | 以Promise形式返回WantAgent。 | **错误码:** -错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + | 错误码ID | 错误信息 | |-----------|--------------------| -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong.| -| 16000003 | Input error. The specified id does not exist.| -| 16000004 | Visibility verification failed.| -| 16000006 | Can not cross user operations.| | 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| -| 16000008 | Crowdtest App Expiration.| -| 16000009 | Can not start ability in wukong mode.| -| 16000010 | Can not operation with continue flag.| -| 16000011 | Context does not exist.| -| 16000050 | Internal Error.| -| 16000051 | Network error. The network is abnormal.| -| 16000052 | Free install not support. The applicaiotn dose not support free install.| -| 16000053 | Not top ability. The application is not top ability.| -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.| -| 16000055 | Free install timeout.| -| 16000056 | Can not free install other ability.| -| 16000057 | Not support cross device free install.| -| 16000101 | execute shell command failed.| | 16000151 | Invalid wantagent object.| -| 16000152 | wantAgent object not found.| -| 16000153 | wangAgent object canceled.| + +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) **示例:** @@ -186,10 +150,10 @@ try { WantAgent.getWantAgent(wantAgentInfo).then((data) => { wantAgent = data; }).catch((err) => { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); }); } catch (err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -211,31 +175,13 @@ getBundleName(agent: WantAgent, callback: AsyncCallback\): void | callback | AsyncCallback\ | 是 | 获取WantAgent实例的包名的回调方法。 | **错误码:** -错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + | 错误码ID | 错误信息 | |-----------|--------------------| -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong.| -| 16000003 | Input error. The specified id does not exist.| -| 16000004 | Visibility verification failed.| -| 16000006 | Can not cross user operations.| | 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| -| 16000008 | Crowdtest App Expiration.| -| 16000009 | Can not start ability in wukong mode.| -| 16000010 | Can not operation with continue flag.| -| 16000011 | Context does not exist.| -| 16000050 | Internal Error.| -| 16000051 | Network error. The network is abnormal.| -| 16000052 | Free install not support. The applicaiotn dose not support free install.| -| 16000053 | Not top ability. The application is not top ability.| -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.| -| 16000055 | Free install timeout.| -| 16000056 | Can not free install other ability.| -| 16000057 | Not support cross device free install.| -| 16000101 | execute shell command failed.| | 16000151 | Invalid wantagent object.| -| 16000152 | wantAgent object not found.| -| 16000153 | wangAgent object canceled.| + +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) **示例:** @@ -280,7 +226,7 @@ function getWantAgentCallback(err, data) { //getBundleName回调 function getBundleNameCallback(err, data) { if(err) { - console.error('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getBundleName failed! ${err.code} ${err.message}'); } else { console.info('getBundleName ok! ${JSON.stringify(data)}'); } @@ -288,13 +234,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.getBundleName(wantAgent, getBundleNameCallback); } catch(err) { - console.error('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getBundleName failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -321,31 +267,13 @@ getBundleName(agent: WantAgent): Promise\ | Promise\ | 以Promise形式返回获取WantAgent实例的包名。 | **错误码:** -错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + | 错误码ID | 错误信息 | |-----------|--------------------| -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong.| -| 16000003 | Input error. The specified id does not exist.| -| 16000004 | Visibility verification failed.| -| 16000006 | Can not cross user operations.| | 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| -| 16000008 | Crowdtest App Expiration.| -| 16000009 | Can not start ability in wukong mode.| -| 16000010 | Can not operation with continue flag.| -| 16000011 | Context does not exist.| -| 16000050 | Internal Error.| -| 16000051 | Network error. The network is abnormal.| -| 16000052 | Free install not support. The applicaiotn dose not support free install.| -| 16000053 | Not top ability. The application is not top ability.| -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.| -| 16000055 | Free install timeout.| -| 16000056 | Can not free install other ability.| -| 16000057 | Not support cross device free install.| -| 16000101 | execute shell command failed.| | 16000151 | Invalid wantagent object.| -| 16000152 | wantAgent object not found.| -| 16000153 | wangAgent object canceled.| + +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) **示例:** @@ -391,16 +319,16 @@ function getWantAgentCallback(err, data) { WantAgent.getBundleName(wantAgent).then((data)=>{ console.info('getBundleName ok! ${JSON.stringify(data)}'); }).catch((err)=>{ - console.error('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getBundleName failed! ${err.code} ${err.message}'); }); } catch(err){ - console.error('getBundleName failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getBundleName failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -422,31 +350,13 @@ getUid(agent: WantAgent, callback: AsyncCallback\): void | callback | AsyncCallback\ | 是 | 获取WantAgent实例的用户ID的回调方法。 | **错误码:** -错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + | 错误码ID | 错误信息 | |-----------|--------------------| -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong.| -| 16000003 | Input error. The specified id does not exist.| -| 16000004 | Visibility verification failed.| -| 16000006 | Can not cross user operations.| | 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| -| 16000008 | Crowdtest App Expiration.| -| 16000009 | Can not start ability in wukong mode.| -| 16000010 | Can not operation with continue flag.| -| 16000011 | Context does not exist.| -| 16000050 | Internal Error.| -| 16000051 | Network error. The network is abnormal.| -| 16000052 | Free install not support. The applicaiotn dose not support free install.| -| 16000053 | Not top ability. The application is not top ability.| -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.| -| 16000055 | Free install timeout.| -| 16000056 | Can not free install other ability.| -| 16000057 | Not support cross device free install.| -| 16000101 | execute shell command failed.| | 16000151 | Invalid wantagent object.| -| 16000152 | wantAgent object not found.| -| 16000153 | wangAgent object canceled.| + +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) **示例:** @@ -492,7 +402,7 @@ function getWantAgentCallback(err, data) { //getUid回调 function getUidCallback(err, data) { if(err) { - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } else { console.info('getUid ok! ${JSON.stringify(data)}'); } @@ -500,13 +410,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.getUid(wantAgent, getUidCallback); } catch(err) { - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -533,31 +443,13 @@ getUid(agent: WantAgent): Promise\ | Promise\ | 以Promise形式返回获取WantAgent实例的用户ID。 | **错误码:** -错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + | 错误码ID | 错误信息 | |-----------|--------------------| -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong.| -| 16000003 | Input error. The specified id does not exist.| -| 16000004 | Visibility verification failed.| -| 16000006 | Can not cross user operations.| | 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| -| 16000008 | Crowdtest App Expiration.| -| 16000009 | Can not start ability in wukong mode.| -| 16000010 | Can not operation with continue flag.| -| 16000011 | Context does not exist.| -| 16000050 | Internal Error.| -| 16000051 | Network error. The network is abnormal.| -| 16000052 | Free install not support. The applicaiotn dose not support free install.| -| 16000053 | Not top ability. The application is not top ability.| -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.| -| 16000055 | Free install timeout.| -| 16000056 | Can not free install other ability.| -| 16000057 | Not support cross device free install.| -| 16000101 | execute shell command failed.| | 16000151 | Invalid wantagent object.| -| 16000152 | wantAgent object not found.| -| 16000153 | wangAgent object canceled.| + +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) **示例:** @@ -603,16 +495,16 @@ function getWantAgentCallback(err, data) { WantAgent.getUid(wantAgent).then((data)=>{ console.info('getUid ok! ${JSON.stringify(data)}'); }).catch((err)=>{ - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); }); } catch(err){ - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -635,31 +527,14 @@ getWant(agent: WantAgent, callback: AsyncCallback\): void | callback | AsyncCallback\<[Want](js-apis-app-ability-want.md)\> | 是 | 获取WantAgent对象want的回调方法。 | **错误码:** -错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + | 错误码ID | 错误信息 | |-----------|--------------------| -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong.| -| 16000003 | Input error. The specified id does not exist.| -| 16000004 | Visibility verification failed.| -| 16000006 | Can not cross user operations.| | 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| -| 16000008 | Crowdtest App Expiration.| -| 16000009 | Can not start ability in wukong mode.| -| 16000010 | Can not operation with continue flag.| -| 16000011 | Context does not exist.| -| 16000050 | Internal Error.| -| 16000051 | Network error. The network is abnormal.| -| 16000052 | Free install not support. The applicaiotn dose not support free install.| -| 16000053 | Not top ability. The application is not top ability.| -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.| -| 16000055 | Free install timeout.| -| 16000056 | Can not free install other ability.| -| 16000057 | Not support cross device free install.| -| 16000101 | execute shell command failed.| +| 16000015 | Service timeout.| | 16000151 | Invalid wantagent object.| -| 16000152 | wantAgent object not found.| -| 16000153 | wangAgent object canceled.| + +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) **示例:** @@ -704,7 +579,7 @@ function getWantAgentCallback(err, data) { //getWant回调 function getWantCallback(err, data) { if(err) { - console.error('getWant failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWant failed! ${err.code} ${err.message}'); } else { console.info('getWant ok! ${JSON.stringify(data)}'); } @@ -712,13 +587,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.getWant(wantAgent, getWantCallback); } catch(err) { - console.error('getWant failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWant failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -747,31 +622,14 @@ getWant(agent: WantAgent): Promise\ | Promise\ | 以Promise形式返回获取WantAgent对象的want。 | **错误码:** -错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + | 错误码ID | 错误信息 | |-----------|--------------------| -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong.| -| 16000003 | Input error. The specified id does not exist.| -| 16000004 | Visibility verification failed.| -| 16000006 | Can not cross user operations.| | 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| -| 16000008 | Crowdtest App Expiration.| -| 16000009 | Can not start ability in wukong mode.| -| 16000010 | Can not operation with continue flag.| -| 16000011 | Context does not exist.| -| 16000050 | Internal Error.| -| 16000051 | Network error. The network is abnormal.| -| 16000052 | Free install not support. The applicaiotn dose not support free install.| -| 16000053 | Not top ability. The application is not top ability.| -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.| -| 16000055 | Free install timeout.| -| 16000056 | Can not free install other ability.| -| 16000057 | Not support cross device free install.| -| 16000101 | execute shell command failed.| +| 16000015 | Service timeout.| | 16000151 | Invalid wantagent object.| -| 16000152 | wantAgent object not found.| -| 16000153 | wangAgent object canceled.| + +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) **示例:** @@ -817,16 +675,16 @@ function getWantAgentCallback(err, data) { WantAgent.getUid(wantAgent).then((data)=>{ console.info('getUid ok! ${JSON.stringify(data)}'); }).catch((err)=>{ - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); }); } catch(err){ - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}}'); } ``` @@ -848,31 +706,13 @@ cancel(agent: WantAgent, callback: AsyncCallback\): void | callback | AsyncCallback\ | 是 | 取消WantAgent实例的回调方法。 | **错误码:** -错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + | 错误码ID | 错误信息 | |-----------|--------------------| -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong.| -| 16000003 | Input error. The specified id does not exist.| -| 16000004 | Visibility verification failed.| -| 16000006 | Can not cross user operations.| | 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| -| 16000008 | Crowdtest App Expiration.| -| 16000009 | Can not start ability in wukong mode.| -| 16000010 | Can not operation with continue flag.| -| 16000011 | Context does not exist.| -| 16000050 | Internal Error.| -| 16000051 | Network error. The network is abnormal.| -| 16000052 | Free install not support. The applicaiotn dose not support free install.| -| 16000053 | Not top ability. The application is not top ability.| -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.| -| 16000055 | Free install timeout.| -| 16000056 | Can not free install other ability.| -| 16000057 | Not support cross device free install.| -| 16000101 | execute shell command failed.| | 16000151 | Invalid wantagent object.| -| 16000152 | wantAgent object not found.| -| 16000153 | wangAgent object canceled.| + +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) **示例:** @@ -917,7 +757,7 @@ function getWantAgentCallback(err, data) { //cancel回调 function cancelCallback(err, data) { if(err) { - console.error('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('cancel failed! ${err.code} ${err.message}'); } else { console.info('cancel ok!'); } @@ -925,13 +765,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.cancel(wantAgent, cancelCallback); } catch(err) { - console.error('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('cancel failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -958,31 +798,13 @@ cancel(agent: WantAgent): Promise\ | Promise\ | 以Promise形式获取异步返回结果。 | **错误码:** -错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + | 错误码ID | 错误信息 | |-----------|--------------------| -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong.| -| 16000003 | Input error. The specified id does not exist.| -| 16000004 | Visibility verification failed.| -| 16000006 | Can not cross user operations.| | 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| -| 16000008 | Crowdtest App Expiration.| -| 16000009 | Can not start ability in wukong mode.| -| 16000010 | Can not operation with continue flag.| -| 16000011 | Context does not exist.| -| 16000050 | Internal Error.| -| 16000051 | Network error. The network is abnormal.| -| 16000052 | Free install not support. The applicaiotn dose not support free install.| -| 16000053 | Not top ability. The application is not top ability.| -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.| -| 16000055 | Free install timeout.| -| 16000056 | Can not free install other ability.| -| 16000057 | Not support cross device free install.| -| 16000101 | execute shell command failed.| | 16000151 | Invalid wantagent object.| -| 16000152 | wantAgent object not found.| -| 16000153 | wangAgent object canceled.| + +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) **示例:** @@ -1028,16 +850,16 @@ function getWantAgentCallback(err, data) { WantAgent.cancel(wantAgent).then((data)=>{ console.info('cancel ok!'); }).catch((err)=>{ - console.error('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('cancel failed! ${err.code} ${err.message}'); }); } catch(err){ - console.error('cancel failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('cancel failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1057,33 +879,6 @@ trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: AsyncCallback\ | 否 | 主动激发WantAgent实例的回调方法。 | -**错误码:** -错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) -| 错误码ID | 错误信息 | -|-----------|--------------------| -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong.| -| 16000003 | Input error. The specified id does not exist.| -| 16000004 | Visibility verification failed.| -| 16000006 | Can not cross user operations.| -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| -| 16000008 | Crowdtest App Expiration.| -| 16000009 | Can not start ability in wukong mode.| -| 16000010 | Can not operation with continue flag.| -| 16000011 | Context does not exist.| -| 16000050 | Internal Error.| -| 16000051 | Network error. The network is abnormal.| -| 16000052 | Free install not support. The applicaiotn dose not support free install.| -| 16000053 | Not top ability. The application is not top ability.| -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.| -| 16000055 | Free install timeout.| -| 16000056 | Can not free install other ability.| -| 16000057 | Not support cross device free install.| -| 16000101 | execute shell command failed.| -| 16000151 | Invalid wantagent object.| -| 16000152 | wantAgent object not found.| -| 16000153 | wangAgent object canceled.| - **示例:** ```ts @@ -1131,7 +926,7 @@ function getWantAgentCallback(err, data) { //trigger回调 function triggerCallback(err, data) { if(err) { - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } else { console.info('getUid ok! ${JSON.stringify(data)}'); } @@ -1139,13 +934,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.trigger(wantAgent, triggerInfo, triggerCallback); } catch(err) { - console.error('getUid failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getUid failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1167,33 +962,6 @@ equal(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback\ | 是 | 判断两个WantAgent实例是否相等的回调方法。 | -**错误码:** -错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) -| 错误码ID | 错误信息 | -|-----------|--------------------| -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong.| -| 16000003 | Input error. The specified id does not exist.| -| 16000004 | Visibility verification failed.| -| 16000006 | Can not cross user operations.| -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| -| 16000008 | Crowdtest App Expiration.| -| 16000009 | Can not start ability in wukong mode.| -| 16000010 | Can not operation with continue flag.| -| 16000011 | Context does not exist.| -| 16000050 | Internal Error.| -| 16000051 | Network error. The network is abnormal.| -| 16000052 | Free install not support. The applicaiotn dose not support free install.| -| 16000053 | Not top ability. The application is not top ability.| -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.| -| 16000055 | Free install timeout.| -| 16000056 | Can not free install other ability.| -| 16000057 | Not support cross device free install.| -| 16000101 | execute shell command failed.| -| 16000151 | Invalid wantagent object.| -| 16000152 | wantAgent object not found.| -| 16000153 | wangAgent object canceled.| - **示例:** ```ts @@ -1239,7 +1007,7 @@ function getWantAgentCallback(err, data) { //equal回调 function equalCallback(err, data) { if(err) { - console.error('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('equal failed! ${err.code} ${err.message}'); } else { console.info('equal ok! ${JSON.stringify(data)}'); } @@ -1247,13 +1015,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.equal(wantAgent1,wantAgent2,equalCallback); } catch(err) { - console.error('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('equal failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1280,33 +1048,6 @@ equal(agent: WantAgent, otherAgent: WantAgent): Promise\ | ----------------------------------------------------------- | ------------------------------------------------------------ | | Promise\ | 以Promise形式返回获取判断两个WantAgent实例是否相等的结果。 | -**错误码:** -错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) -| 错误码ID | 错误信息 | -|-----------|--------------------| -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong.| -| 16000003 | Input error. The specified id does not exist.| -| 16000004 | Visibility verification failed.| -| 16000006 | Can not cross user operations.| -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| -| 16000008 | Crowdtest App Expiration.| -| 16000009 | Can not start ability in wukong mode.| -| 16000010 | Can not operation with continue flag.| -| 16000011 | Context does not exist.| -| 16000050 | Internal Error.| -| 16000051 | Network error. The network is abnormal.| -| 16000052 | Free install not support. The applicaiotn dose not support free install.| -| 16000053 | Not top ability. The application is not top ability.| -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.| -| 16000055 | Free install timeout.| -| 16000056 | Can not free install other ability.| -| 16000057 | Not support cross device free install.| -| 16000101 | execute shell command failed.| -| 16000151 | Invalid wantagent object.| -| 16000152 | wantAgent object not found.| -| 16000153 | wangAgent object canceled.| - **示例:** ```ts @@ -1353,16 +1094,16 @@ function getWantAgentCallback(err, data) { WantAgent.equal(wantAgent1,wantAgent2).then((data)=>{ console.info('equal ok! ${JSON.stringify(data)}'); }).catch((err)=>{ - console.error('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('equal failed! ${err.code} ${err.message}'); }) } catch(err){ - console.error('equal failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('equal failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1382,31 +1123,14 @@ getOperationType(agent: WantAgent, callback: AsyncCallback\): void; | callback | AsyncCallback\ | 是 | 获取一个WantAgent的OperationType信息的回调方法。 | **错误码:** -错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + | 错误码ID | 错误信息 | |-----------|--------------------| -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong.| -| 16000003 | Input error. The specified id does not exist.| -| 16000004 | Visibility verification failed.| -| 16000006 | Can not cross user operations.| | 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| -| 16000008 | Crowdtest App Expiration.| -| 16000009 | Can not start ability in wukong mode.| -| 16000010 | Can not operation with continue flag.| -| 16000011 | Context does not exist.| -| 16000050 | Internal Error.| -| 16000051 | Network error. The network is abnormal.| -| 16000052 | Free install not support. The applicaiotn dose not support free install.| -| 16000053 | Not top ability. The application is not top ability.| -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.| -| 16000055 | Free install timeout.| -| 16000056 | Can not free install other ability.| -| 16000057 | Not support cross device free install.| -| 16000101 | execute shell command failed.| +| 16000015 | Service timeout.| | 16000151 | Invalid wantagent object.| -| 16000152 | wantAgent object not found.| -| 16000153 | wangAgent object canceled.| + +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) **示例:** @@ -1451,7 +1175,7 @@ function getWantAgentCallback(err, data) { //getOperationTypeCallback回调 function getOperationTypeCallback(err, data) { if(err) { - console.error('getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getOperationType failed! ${err.code} ${err.message}'); } else { console.info('getOperationType ok! ${JSON.stringify(data)}'); } @@ -1459,13 +1183,13 @@ function getWantAgentCallback(err, data) { try { WantAgent.getOperationTypeCallback(wantAgent, getOperationTypeCallback); } catch(err) { - console.error('getOperationTypeCallback failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getOperationTypeCallback failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` @@ -1490,31 +1214,14 @@ getOperationType(agent: WantAgent): Promise\; | Promise\ | 以Promise形式返回获取operationType的结果。 | **错误码:** -错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + | 错误码ID | 错误信息 | |-----------|--------------------| -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong.| -| 16000003 | Input error. The specified id does not exist.| -| 16000004 | Visibility verification failed.| -| 16000006 | Can not cross user operations.| | 16000007 | Service busyness. There are concurrent tasks, waiting for retry.| -| 16000008 | Crowdtest App Expiration.| -| 16000009 | Can not start ability in wukong mode.| -| 16000010 | Can not operation with continue flag.| -| 16000011 | Context does not exist.| -| 16000050 | Internal Error.| -| 16000051 | Network error. The network is abnormal.| -| 16000052 | Free install not support. The applicaiotn dose not support free install.| -| 16000053 | Not top ability. The application is not top ability.| -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry.| -| 16000055 | Free install timeout.| -| 16000056 | Can not free install other ability.| -| 16000057 | Not support cross device free install.| -| 16000101 | execute shell command failed.| +| 16000015 | Service timeout.| | 16000151 | Invalid wantagent object.| -| 16000152 | wantAgent object not found.| -| 16000153 | wangAgent object canceled.| + +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) **示例:** @@ -1560,16 +1267,16 @@ function getWantAgentCallback(err, data) { WantAgent.getOperationType(wantAgent).then((data)=>{ console.info('getOperationType ok! ${JSON.stringify(data)}'); }).catch((err)=>{ - console.error('getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getOperationType failed! ${err.code} ${err.message}'); }); } catch(err){ - console.error('getOperationType failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getOperationType failed! ${err.code} ${err.message}'); } } try { WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err) { - console.error('getWantAgent failed! ${JSON.stringify(err.code)} ${JSON.stringify(err.message)}'); + console.error('getWantAgent failed! ${err.code} ${err.message}'); } ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-ability-wantConstant.md b/zh-cn/application-dev/reference/apis/js-apis-app-ability-wantConstant.md index c58fb7e7fb84761cb814b2d4892bcdd813586182..6ae0d2a5caa5faacd943fe578668e5ad2e3f6d90 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-ability-wantConstant.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-ability-wantConstant.md @@ -16,13 +16,17 @@ import wantConstant from '@ohos.app.ability.wantConstant'; want的Params操作的常量。 -| 名称 | 值 | 说明 | -| ----------------------- | --------------------------- | ------------------------------------------------------------ | -| DLP_PARAMS_SANDBOX | ohos.dlp.params.sandbox | 指示沙盒标志的参数的操作。
**系统API**:该接口为系统接口,三方应用不支持调用。 | -| DLP_PARAMS_BUNDLE_NAME | ohos.dlp.params.bundleName | 指示DLP Bundle名称的参数的操作。
**系统API**:该接口为系统接口,三方应用不支持调用。 | -| DLP_PARAMS_MODULE_NAME | ohos.dlp.params.moduleName | 指示DLP模块名称的参数的操作。
**系统API**:该接口为系统接口,三方应用不支持调用。 | -| DLP_PARAMS_ABILITY_NAME | ohos.dlp.params.abilityName | 指示DLP能力名称的参数的操作。
**系统API**:该接口为系统接口,三方应用不支持调用。 | -| DLP_PARAMS_INDEX | ohos.dlp.params.index | 指示DLP索引参数的操作。
**系统API**:该接口为系统接口,三方应用不支持调用。 | +| 名称 | 值 | 说明 | +| ----------------------- | ---------------------------------- | ------------------------------------------------------------------------------ | +| DLP_PARAMS_SANDBOX | ohos.dlp.params.sandbox | 指示沙盒标志的参数的操作。
**系统API**:该接口为系统接口,三方应用不支持调用。 | +| DLP_PARAMS_BUNDLE_NAME | ohos.dlp.params.bundleName | 指示DLP Bundle名称的参数的操作。
**系统API**:该接口为系统接口,三方应用不支持调用。 | +| DLP_PARAMS_MODULE_NAME | ohos.dlp.params.moduleName | 指示DLP模块名称的参数的操作。
**系统API**:该接口为系统接口,三方应用不支持调用。 | +| DLP_PARAMS_ABILITY_NAME | ohos.dlp.params.abilityName | 指示DLP能力名称的参数的操作。
**系统API**:该接口为系统接口,三方应用不支持调用。 | +| DLP_PARAMS_INDEX | ohos.dlp.params.index | 指示DLP索引参数的操作。
**系统API**:该接口为系统接口,三方应用不支持调用。 | +| ABILITY_RECOVERY_RESTART | ohos.ability.params.abilityRecoveryRestart | 指示当前Ability是否发生了故障恢复重启。 | +| CONTENT_TITLE_KEY | ohos.extra.param.key.contentTitle | 指示原子化服务支持分享标题的参数的操作。
**系统API**:该接口为系统接口,三方应用不支持调用。 | +| SHARE_ABSTRACT_KEY | ohos.extra.param.key.shareAbstract | 指示原子化服务支持分享内容的参数的操作。
**系统API**:该接口为系统接口,三方应用不支持调用。 | +| SHARE_URL_KEY | ohos.extra.param.key.shareUrl | 指示原子化服务支持分享链接的参数的操作。
**系统API**:该接口为系统接口,三方应用不支持调用。 | ## wantConstant.Flags diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-form-formExtensionAbility.md b/zh-cn/application-dev/reference/apis/js-apis-app-form-formExtensionAbility.md index 5b3007d03598baf856db06c86a9a675efe2e8567..18c63edc927aacb86d53917e94eeb63b84f2cd2b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-form-formExtensionAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-form-formExtensionAbility.md @@ -273,7 +273,7 @@ export default class MyFormExtensionAbility extends FormExtensionAbility { ## onShareForm -onShareForm?(formId: string): { [key: string]: any } +onShareForm?(formId: string): { [key: string]: Object } 卡片提供方接收卡片分享的通知接口。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-form-formHost.md b/zh-cn/application-dev/reference/apis/js-apis-app-form-formHost.md index d12a34d5b0e790448ffff671b0ab2203b5e8939c..cc094eba4f7a6360fe4c6edaa5aa895f75623aff 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-form-formHost.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-form-formHost.md @@ -34,7 +34,14 @@ deleteForm(formId: string, callback: AsyncCallback<void>): void | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 201 | Permissions denied. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 202 | The application is not a system application. | +| 16501000 | An internal functional error occurred. | +| 16501001 | The ID of the form to be operated does not exist. | +| 16501003 | The form can not be operated by the current application. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -83,7 +90,14 @@ deleteForm(formId: string): Promise<void> | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16501000 | An internal functional error occurred. | +| 16501001 | The ID of the form to be operated does not exist. | +| 16501003 | The form can not be operated by the current application. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **参数:** @@ -124,7 +138,14 @@ releaseForm(formId: string, callback: AsyncCallback<void>): void | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16501000 | An internal functional error occurred. | +| 16501001 | The ID of the form to be operated does not exist. | +| 16501003 | The form can not be operated by the current application. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -166,7 +187,14 @@ releaseForm(formId: string, isReleaseCache: boolean, callback: AsyncCallback< | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16501000 | An internal functional error occurred. | +| 16501001 | The ID of the form to be operated does not exist. | +| 16501003 | The form can not be operated by the current application. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -201,7 +229,7 @@ releaseForm(formId: string, isReleaseCache?: boolean): Promise<void> | 参数名 | 类型 | 必填 | 说明 | | -------------- | ------ | ---- | ----------- | | formId | string | 是 | 卡片标识。 | -| isReleaseCache | boolean | 否 | 是否释放缓存。 | +| isReleaseCache | boolean | 否 | 是否释放缓存,默认为false。 | **返回值:** @@ -213,7 +241,14 @@ releaseForm(formId: string, isReleaseCache?: boolean): Promise<void> | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16501000 | An internal functional error occurred. | +| 16501001 | The ID of the form to be operated does not exist. | +| 16501003 | The form can not be operated by the current application. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -254,7 +289,14 @@ requestForm(formId: string, callback: AsyncCallback<void>): void | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16501000 | An internal functional error occurred. | +| 16501001 | The ID of the form to be operated does not exist. | +| 16501003 | The form can not be operated by the current application. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -300,7 +342,14 @@ requestForm(formId: string): Promise<void> | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16501000 | An internal functional error occurred. | +| 16501001 | The ID of the form to be operated does not exist. | +| 16501003 | The form can not be operated by the current application. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -342,7 +391,14 @@ castToNormalForm(formId: string, callback: AsyncCallback<void>): void | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16501000 | An internal functional error occurred. | +| 16501001 | The ID of the form to be operated does not exist. | +| 16501002 | The number of forms exceeds upper bound. | +| 16501003 | The form can not be operated by the current application. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -388,7 +444,14 @@ castToNormalForm(formId: string): Promise<void> | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16501000 | An internal functional error occurred. | +| 16501001 | The ID of the form to be operated does not exist. | +| 16501002 | The number of forms exceeds upper bound. | +| 16501003 | The form can not be operated by the current application. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -429,7 +492,12 @@ notifyVisibleForms(formIds: Array<string>, callback: AsyncCallback<void | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16501000 | An internal functional error occurred. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -475,7 +543,12 @@ notifyVisibleForms(formIds: Array<string>): Promise<void> | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16501000 | An internal functional error occurred. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -516,7 +589,12 @@ notifyInvisibleForms(formIds: Array<string>, callback: AsyncCallback<vo | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16501000 | An internal functional error occurred. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -562,7 +640,12 @@ notifyInvisibleForms(formIds: Array<string>): Promise<void> | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16501000 | An internal functional error occurred. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -603,7 +686,13 @@ enableFormsUpdate(formIds: Array<string>, callback: AsyncCallback<void& | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16501000 | An internal functional error occurred. | +| 16501003 | The form can not be operated by the current application. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -649,7 +738,13 @@ enableFormsUpdate(formIds: Array<string>): Promise<void> | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16501000 | An internal functional error occurred. | +| 16501003 | The form can not be operated by the current application. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -690,7 +785,14 @@ disableFormsUpdate(formIds: Array<string>, callback: AsyncCallback<void | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16501000 | An internal functional error occurred. | +| 16501001 | The ID of the form to be operated does not exist. | +| 16501003 | The form can not be operated by the current application. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -736,7 +838,14 @@ disableFormsUpdate(formIds: Array<string>): Promise<void> | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16501000 | An internal functional error occurred. | +| 16501001 | The ID of the form to be operated does not exist. | +| 16501003 | The form can not be operated by the current application. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -770,6 +879,14 @@ isSystemReady(callback: AsyncCallback<void>): void | ------ | ------ | ---- | ------- | | callback | AsyncCallback<void> | 是 | 回调函数。当检查系统是否准备好成功,error为undefined,否则为错误对象。 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | -------- | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +|以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| + **示例:** ```ts @@ -800,6 +917,13 @@ isSystemReady(): Promise<void> | -------- | -------- | | Promise<void> | 无返回结果的Promise对象。 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | -------- | +| 202 | The application is not a system application. | +|以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| + **示例:** ```ts @@ -826,6 +950,18 @@ getAllFormsInfo(callback: AsyncCallback<Array<formInfo.FormInfo>>): **系统能力**:SystemCapability.Ability.Form +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | -------- | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16501000 | An internal functional error occurred. | +|以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -860,6 +996,17 @@ getAllFormsInfo(): Promise<Array<formInfo.FormInfo>> **系统能力**:SystemCapability.Ability.Form +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | -------- | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16501000 | An internal functional error occurred. | +|以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| + **返回值:** | 类型 | 说明 | @@ -903,7 +1050,13 @@ getFormsInfo(bundleName: string, callback: AsyncCallback<Array<formInfo.Fo | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16500100 | Failed to obtain the configuration information. | +| 16501000 | An internal functional error occurred. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -946,7 +1099,13 @@ getFormsInfo(bundleName: string, moduleName: string, callback: AsyncCallback< | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16500100 | Failed to obtain the configuration information. | +| 16501000 | An internal functional error occurred. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -982,7 +1141,7 @@ getFormsInfo(bundleName: string, moduleName?: string): Promise<Array<formI | 参数名 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | ------- | | bundleName | string | 是 | 要查询的应用Bundle名称。 | -| moduleName | string | 否 | 要查询的模块名称。 | +| moduleName | string | 否 | 要查询的模块名称,缺省默认为空。 | **返回值:** @@ -994,7 +1153,13 @@ getFormsInfo(bundleName: string, moduleName?: string): Promise<Array<formI | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16500100 | Failed to obtain the configuration information. | +| 16501000 | An internal functional error occurred. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -1030,6 +1195,18 @@ deleteInvalidForms(formIds: Array<string>, callback: AsyncCallback<numb | formIds | Array<string> | 是 | 有效卡片标识列表。 | | callback | AsyncCallback<number> | 是 | 回调函数。当根据列表删除应用程序的无效卡片成功,error为undefined,data为删除的卡片个数;否则为错误对象。 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | -------- | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16501000 | An internal functional error occurred. | +|以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| + **示例:** ```ts @@ -1071,6 +1248,18 @@ deleteInvalidForms(formIds: Array<string>): Promise<number> | :------------ | :---------------------------------- | | Promise<number> | Promise对象,返回删除的卡片个数。 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | -------- | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16501000 | An internal functional error occurred. | +|以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| + **示例:** ```ts @@ -1109,7 +1298,13 @@ acquireFormState(want: Want, callback: AsyncCallback<formInfo.FormStateInfo&g | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16500100 | Failed to obtain the configuration information. | +| 16501000 | An internal functional error occurred. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -1166,7 +1361,13 @@ acquireFormState(want: Want): Promise<formInfo.FormStateInfo> | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16500100 | Failed to obtain the configuration information. | +| 16501000 | An internal functional error occurred. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -1210,6 +1411,14 @@ on(type: 'formUninstall', callback: Callback<string>): void | type | string | 是 | 填写'formUninstall',表示卡片卸载事件。 | | callback | Callback<string> | 是 | 回调函数。返回卡片标识。 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | -------- | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +|以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| + **示例:** ```ts @@ -1236,6 +1445,14 @@ off(type: 'formUninstall', callback?: Callback<string>): void | type | string | 是 | 填写'formUninstall',表示卡片卸载事件。 | | callback | Callback<string> | 否 | 回调函数。返回卡片标识。缺省时,表示注销所有已注册事件回调。
需与对应on('formUninstall')的callback一致。| +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | -------- | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +|以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| + **示例:** ```ts @@ -1269,7 +1486,13 @@ notifyFormsVisible(formIds: Array<string>, isVisible: boolean, callback: A | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16501000 | An internal functional error occurred. | +| 16501003 | The form can not be operated by the current application. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -1316,7 +1539,13 @@ notifyFormsVisible(formIds: Array<string>, isVisible: boolean): Promise< | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16501000 | An internal functional error occurred. | +| 16501003 | The form can not be operated by the current application. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -1358,7 +1587,13 @@ notifyFormsEnableUpdate(formIds: Array<string>, isEnableUpdate: boolean, c | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16501000 | An internal functional error occurred. | +| 16501003 | The form can not be operated by the current application. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -1405,7 +1640,13 @@ notifyFormsEnableUpdate(formIds: Array<string>, isEnableUpdate: boolean): | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16501000 | An internal functional error occurred. | +| 16501003 | The form can not be operated by the current application. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -1446,7 +1687,13 @@ shareForm(formId: string, deviceId: string, callback: AsyncCallback<void>) | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16501000 | An internal functional error occurred. | +| 16501001 | The ID of the form to be operated does not exist. | +| 16501003 | The form can not be operated by the current application. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -1494,7 +1741,13 @@ shareForm(formId: string, deviceId: string): Promise<void> | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16501000 | An internal functional error occurred. | +| 16501001 | The ID of the form to be operated does not exist. | +| 16501003 | The form can not be operated by the current application. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -1535,9 +1788,14 @@ notifyFormsPrivacyProtected(formIds: Array\, isProtected: boolean, callb **错误码:** -| 错误码ID | 错误信息 | -| ------------------------------------------------------------ | ------------------ | -| 401 | 调用接口入参错误。 | +| 错误码ID | 错误信息 | +| -------- | -------- | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16501000 | An internal functional error occurred. | | 以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。 | | **示例:** @@ -1582,9 +1840,14 @@ function notifyFormsPrivacyProtected(formIds: Array\, isProtected: bool **错误码:** -| 错误码ID | 错误信息 | -| ------------------------------------------------------------ | ------------------ | -| 401 | 调用接口入参错误。 | +| 错误码ID | 错误信息 | +| -------- | -------- | +| 201 | Permissions denied. | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16501000 | An internal functional error occurred. | | 以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。 | | ```ts diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-form-formInfo.md b/zh-cn/application-dev/reference/apis/js-apis-app-form-formInfo.md index 68c813640be97cb572079e41887ea6770949ee0b..55baab89a6a4390f48466b19e1f84ee177843081 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-form-formInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-form-formInfo.md @@ -47,7 +47,7 @@ import formInfo from '@ohos.app.form.formInfo'; | 名称 | 值 | 说明 | | ----------- | ---- | ------------ | | JS | 1 | 卡片类型为JS。 | -| eTS | 2 | 卡片类型为eTS。 | +| eTS | 2 | 卡片类型为ArkTS。 | ## ColorMode diff --git a/zh-cn/application-dev/reference/apis/js-apis-app-form-formProvider.md b/zh-cn/application-dev/reference/apis/js-apis-app-form-formProvider.md index 5e1b17549769c8d6155a9432129cc6c1becadc55..bf7e9556fc7cdc34e63b12be191eb246c33c1341 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-app-form-formProvider.md +++ b/zh-cn/application-dev/reference/apis/js-apis-app-form-formProvider.md @@ -31,7 +31,14 @@ setFormNextRefreshTime(formId: string, minute: number, callback: AsyncCallback&l | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16500100 | Failed to obtain the configuration information. | +| 16501000 | An internal functional error occurred. | +| 16501001 | The ID of the form to be operated does not exist. | +| 16501002 | The number of forms exceeds upper bound. | +| 16501003 | The form can not be operated by the current application. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -41,12 +48,12 @@ import formProvider from '@ohos.app.form.formProvider'; let formId = '12400633174999288'; try { - formProvider.setFormNextRefreshTime(formId, 5, (error, data) => { + formProvider.setFormNextRefreshTime(formId, 5, (error) => { if (error) { console.error(`callback error, code: ${error.code}, message: ${error.message})`); - } else { - console.log(`formProvider setFormNextRefreshTime success`); + return; } + console.log(`formProvider setFormNextRefreshTime success`); }); } catch (error) { console.error(`catch error, code: ${error.code}, message: ${error.message})`); @@ -78,7 +85,14 @@ setFormNextRefreshTime(formId: string, minute: number): Promise<void> | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16500100 | Failed to obtain the configuration information. | +| 16501000 | An internal functional error occurred. | +| 16501001 | The ID of the form to be operated does not exist. | +| 16501002 | The number of forms exceeds upper bound. | +| 16501003 | The form can not be operated by the current application. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -118,7 +132,13 @@ updateForm(formId: string, formBindingData: formBindingData.FormBindingData,call | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16500100 | Failed to obtain the configuration information. | +| 16501000 | An internal functional error occurred. | +| 16501001 | The ID of the form to be operated does not exist. | +| 16501003 | The form can not be operated by the current application. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -130,12 +150,12 @@ import formProvider from '@ohos.app.form.formProvider'; let formId = '12400633174999288'; try { let obj = formBindingData.createFormBindingData({temperature:'22c', time:'22:00'}); - formProvider.updateForm(formId, obj, (error, data) => { + formProvider.updateForm(formId, obj, (error) => { if (error) { console.error(`callback error, code: ${error.code}, message: ${error.message})`); - } else { - console.log(`formProvider updateForm success`); + return; } + console.log(`formProvider updateForm success`); }); } catch (error) { console.error(`catch error, code: ${error.code}, message: ${error.message})`); @@ -167,7 +187,13 @@ updateForm(formId: string, formBindingData: formBindingData.FormBindingData): Pr | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500060 | A service connection error happened, please try again later. | +| 16500100 | Failed to obtain the configuration information. | +| 16501000 | An internal functional error occurred. | +| 16501001 | The ID of the form to be operated does not exist. | +| 16501003 | The form can not be operated by the current application. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -204,10 +230,12 @@ getFormsInfo(callback: AsyncCallback<Array<formInfo.FormInfo>>): voi | callback | AsyncCallback<Array<[formInfo.FormInfo](js-apis-app-form-formInfo.md)>> | 是 | 回调函数。返回查询到的卡片信息。 | **错误码:** - | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500100 | Failed to obtain the configuration information. | +| 16501000 | An internal functional error occurred. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| @@ -220,9 +248,9 @@ try { formProvider.getFormsInfo((error, data) => { if (error) { console.error(`callback error, code: ${error.code}, message: ${error.message})`); - } else { - console.log('formProvider getFormsInfo, data: ${JSON.stringify(data)}'); + return; } + console.log('formProvider getFormsInfo, data: ${JSON.stringify(data)}'); }); } catch (error) { console.error(`catch error, code: ${error.code}, message: ${error.message})`); @@ -247,7 +275,10 @@ getFormsInfo(filter: formInfo.FormInfoFilter, callback: AsyncCallback<Array&l | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500100 | Failed to obtain the configuration information. | +| 16501000 | An internal functional error occurred. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -264,9 +295,9 @@ try { formProvider.getFormsInfo(filter, (error, data) => { if (error) { console.error(`callback error, code: ${error.code}, message: ${error.message})`); - } else { - console.log('formProvider getFormsInfo, data: ${JSON.stringify(data)}'); + return; } + console.log('formProvider getFormsInfo, data: ${JSON.stringify(data)}'); }); } catch (error) { console.error(`catch error, code: ${error.code}, message: ${error.message})`); @@ -285,7 +316,7 @@ getFormsInfo(filter?: formInfo.FormInfoFilter): Promise<Array<formInfo.For | 参数名 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | ------- | -| filter | [formInfo.FormInfoFilter](js-apis-app-form-formInfo.md#forminfofilter) | 否 | 卡片信息过滤器。 | +| filter | [formInfo.FormInfoFilter](js-apis-app-form-formInfo.md#forminfofilter) | 否 | 卡片信息过滤器, 默认为空,不进行过滤。 | **返回值:** @@ -297,7 +328,10 @@ getFormsInfo(filter?: formInfo.FormInfoFilter): Promise<Array<formInfo.For | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500100 | Failed to obtain the configuration information. | +| 16501000 | An internal functional error occurred. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -343,7 +377,11 @@ requestPublishForm(want: Want, formBindingData: formBindingData.FormBindingData, | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500100 | Failed to obtain the configuration information. | +| 16501000 | An internal functional error occurred. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -365,9 +403,9 @@ try { formProvider.requestPublishForm(want, obj, (error, data) => { if (error) { console.error(`callback error, code: ${error.code}, message: ${error.message})`); - } else { - console.log('formProvider requestPublishForm, form ID is: ${JSON.stringify(data)}'); + return; } + console.log('formProvider requestPublishForm, form ID is: ${JSON.stringify(data)}'); }); } catch (error) { console.error(`catch error, code: ${error.code}, message: ${error.message})`); @@ -395,7 +433,11 @@ requestPublishForm(want: Want, callback: AsyncCallback<string>): void | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500100 | Failed to obtain the configuration information. | +| 16501000 | An internal functional error occurred. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -415,9 +457,9 @@ try { formProvider.requestPublishForm(want, (error, data) => { if (error) { console.error(`callback error, code: ${error.code}, message: ${error.message})`); - } else { - console.log('formProvider requestPublishForm, form ID is: ${JSON.stringify(data)}'); + return; } + console.log('formProvider requestPublishForm, form ID is: ${JSON.stringify(data)}'); }); } catch (error) { console.error(`catch error, code: ${error.code}, message: ${error.message})`); @@ -439,7 +481,7 @@ requestPublishForm(want: Want, formBindingData?: formBindingData.FormBindingData | 参数名 | 类型 | 必填 | 说明 | | --------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | want | [Want](js-apis-application-want.md) | 是 | 发布请求。需包含以下字段。
abilityName: 目标卡片ability
parameters:
'ohos.extra.param.key.form_dimension'
'ohos.extra.param.key.form_name'
'ohos.extra.param.key.module_name' | -| formBindingData | [formBindingData.FormBindingData](js-apis-app-form-formBindingData.md#formbindingdata) | 否 | 创建卡片的数据。 | +| formBindingData | [formBindingData.FormBindingData](js-apis-app-form-formBindingData.md#formbindingdata) | 否 | 创建卡片的数据,默认为空,不提供创建卡片数据。 | **返回值:** @@ -451,7 +493,11 @@ requestPublishForm(want: Want, formBindingData?: formBindingData.FormBindingData | 错误码ID | 错误信息 | | -------- | -------- | -| 401 | 调用接口入参错误。 | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500100 | Failed to obtain the configuration information. | +| 16501000 | An internal functional error occurred. | |以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| **示例:** @@ -494,6 +540,16 @@ isRequestPublishFormSupported(callback: AsyncCallback<boolean>): void | ------ | ------ | ---- | ------- | | callback | AsyncCallback<boolean> | 是 | 回调函数。返回是否支持发布一张卡片到使用方。| +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | -------- | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16501000 | An internal functional error occurred. | +|以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| + **示例:** ```ts @@ -517,9 +573,9 @@ try { formProvider.requestPublishForm(want, (error, data) => { if (error) { console.error(`callback error, code: ${error.code}, message: ${error.message})`); - } else { - console.log('formProvider requestPublishForm, form ID is: ${JSON.stringify(data)}'); + return; } + console.log('formProvider requestPublishForm, form ID is: ${JSON.stringify(data)}'); }); } catch (error) { console.error(`catch error, code: ${error.code}, message: ${error.message})`); @@ -548,6 +604,15 @@ isRequestPublishFormSupported(): Promise<boolean> | :------------ | :---------------------------------- | | Promise<boolean> | Promise对象。返回是否支持发布一张卡片到使用方。 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | -------- | +| 202 | The application is not a system application. | +| 16500050 | An IPC connection error happened. | +| 16501000 | An internal functional error occurred. | +|以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| + **示例:** ```ts 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 719437c9913dc324003a2c9e030945f8f44f8db6..7724c86ea73f651548df234412f36e20f3c33cf2 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-appAccount.md +++ b/zh-cn/application-dev/reference/apis/js-apis-appAccount.md @@ -148,7 +148,6 @@ createAccount(name: string, options?: CreateAccountOptions): Promise<void> | 12300002 | Invalid name or options. | | 12300004 | Account already exists. | | 12300007 | The number of accounts reaches the upper limit. | -| 12400003 | The number of custom data reaches the upper limit. | **示例:** @@ -248,7 +247,7 @@ createAccountImplicitly(owner: string, options: CreateAccountImplicitlyOptions, | 错误码ID | 错误信息 | | ------- | ------- | | 12300001 | System service exception. | -| 12300002 | Invalid name or options. | +| 12300002 | Invalid owner or options. | | 12300007 | The number of accounts reaches the upper limit. | | 12300010 | Account service busy. | | 12300113 | Authenticator service not found. | @@ -481,7 +480,6 @@ checkAppAccess(name: string, bundleName: string, callback: AsyncCallback<bool | 12300001 | System service exception. | | 12300002 | Invalid name or bundleName. | | 12300003 | Account not found. | -| 12400001 | Application not found. | **示例:** @@ -527,7 +525,6 @@ checkAppAccess(name: string, bundleName: string): Promise<boolean> | 12300001 | System service exception. | | 12300002 | Invalid name or bundleName. | | 12300003 | Account not found. | -| 12400001 | Application not found. | **示例:** @@ -903,7 +900,7 @@ setCustomData(name: string, key: string, value: string, callback: AsyncCallback& | 错误码ID | 错误信息| | ------- | -------| | 12300001 | System service exception. | -| 12300002 | Invalid name or key or value. | +| 12300002 | Invalid name, key or value. | | 12300003 | Account not found. | | 12400003 | The number of custom data reaches the upper limit. | @@ -950,7 +947,7 @@ setCustomData(name: string, key: string, value: string): Promise<void> | 错误码ID | 错误信息| | ------- | -------| | 12300001 | System service exception. | -| 12300002 | Invalid name or key or value. | +| 12300002 | Invalid name, key or value. | | 12300003 | Account not found. | | 12400003 | The number of custom data reaches the upper limit. | @@ -1267,7 +1264,6 @@ on(type: 'accountChange', owners: Array<string>, callback: Callback<Arr | ------- | ------- | | 12300001 | System service exception. | | 12300002 | Invalid type or owners. | -| 12300011 | Callback has been registered. | | 12400001 | Application not found. | **示例:** @@ -1304,7 +1300,6 @@ off(type: 'accountChange', callback?: Callback<Array<AppAccountInfo>> | ------- | -------| | 12300001 | System service exception. | | 12300002 | Invalid type. | -| 12300012 | Callback has not been registered. | **示例:** @@ -1347,7 +1342,7 @@ auth(name: string, owner: string, authType: string, callback: AuthCallback): voi | 错误码ID | 错误信息| | ------- | -------| | 12300001 | System service exception. | -| 12300002 | Invalid name or owner or authType. | +| 12300002 | Invalid name, owner or authType. | | 12300003 | Account not found. | | 12300010 | Account service busy. | | 12300113 | Authenticator service not found. | @@ -1410,8 +1405,8 @@ auth(name: string, owner: string, authType: string, options: {[key: string]: Obj | 错误码ID | 错误信息| | ------- | -------| | 12300001 | System service exception. | -| 12300002 | Invalid name or owner or authType. | -| 12300003 | Account not exist. | +| 12300002 | Invalid name, owner, authType or options. | +| 12300003 | Account not found. | | 12300010 | Account service busy. | | 12300113 | Authenticator service not found. | | 12300114 | Authenticator service exception. | @@ -1522,7 +1517,7 @@ getAuthToken(name: string, owner: string, authType: string): Promise<string&g | 错误码ID | 错误信息 | | ------- | ------- | | 12300001 | System service exception. | -| 12300002 | Invalid name or owner or authType. | +| 12300002 | Invalid name, owner or authType. | | 12300003 | Account not found. | | 12300107 | AuthType not found. | @@ -1562,7 +1557,7 @@ setAuthToken(name: string, authType: string, token: string, callback: AsyncCallb | 错误码ID | 错误信息| | ------- | -------| | 12300001 | System service exception. | -| 12300002 | Invalid name or authType or token. | +| 12300002 | Invalid name, authType or token. | | 12300003 | Account not found. | | 12400004 | The number of token reaches the upper limit. | @@ -1609,7 +1604,7 @@ setAuthToken(name: string, authType: string, token: string): Promise<void> | 错误码ID | 错误信息| | ------- | -------| | 12300001 | System service exception. | -| 12300002 | Invalid name or authType or token. | +| 12300002 | Invalid name, authType or token. | | 12300003 | Account not found. | | 12400004 | The number of token reaches the upper limit. | @@ -1650,7 +1645,7 @@ deleteAuthToken(name: string, owner: string, authType: string, token: string, ca | 错误码ID | 错误信息 | | ------- | ------- | | 12300001 | System service exception. | -| 12300002 | Invalid name or owner or authType or token. | +| 12300002 | Invalid name, owner, authType or token. | | 12300003 | Account not found. | | 12300107 | AuthType not found. | @@ -1698,7 +1693,7 @@ deleteAuthToken(name: string, owner: string, authType: string, token: string): P | 错误码ID | 错误信息 | | ------- | ------- | | 12300001 | System service exception. | -| 12300002 | Invalid name or owner or authType or token. | +| 12300002 | Invalid name, owner, authType or token. | | 12300003 | Account not found. | | 12300107 | AuthType not found. | @@ -1739,7 +1734,7 @@ setAuthTokenVisibility(name: string, authType: string, bundleName: string, isVis | 错误码ID | 错误信息| | ------- | -------| | 12300001 | System service exception. | -| 12300002 | Invalid name or authType or bundleName. | +| 12300002 | Invalid name, authType or bundleName. | | 12300003 | Account not found. | | 12300107 | AuthType not found. | | 12400001 | Application not found. | @@ -1789,7 +1784,7 @@ setAuthTokenVisibility(name: string, authType: string, bundleName: string, isVis | 错误码ID | 错误信息| | ------- | -------| | 12300001 | System service exception. | -| 12300002 | Invalid name or authType or bundleName. | +| 12300002 | Invalid name, authType or bundleName. | | 12300003 | Account not found. | | 12300107 | AuthType not found. | | 12400001 | Application not found. | @@ -1831,10 +1826,9 @@ checkAuthTokenVisibility(name: string, authType: string, bundleName: string, cal | 错误码ID | 错误信息| | ------- | -------| | 12300001 | System service exception. | -| 12300002 | Invalid name or authType or bundleName. | +| 12300002 | Invalid name, authType or bundleName. | | 12300003 | Account not found. | | 12300107 | AuthType not found. | -| 12400001 | Application not found. | **示例:** @@ -1879,10 +1873,9 @@ checkAuthTokenVisibility(name: string, authType: string, bundleName: string): Pr | 错误码ID | 错误信息| | ------- | -------| | 12300001 | System service exception. | -| 12300002 | Invalid name or authType or bundleName. | +| 12300002 | Invalid name, authType or bundleName. | | 12300003 | Account not found. | | 12300107 | AuthType not found. | -| 12400001 | Application not found. | **示例:** @@ -2092,31 +2085,34 @@ getAuthCallback(sessionId: string, callback: AsyncCallback<AuthCallback>): **示例:** ```js - import featureAbility from '@ohos.ability.featureAbility'; - featureAbility.getWant((err, want) => { - var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; - try { - appAccountManager.getAuthCallback(sessionId, (err, callback) => { - if (err.code != account_appAccount.ResultCode.SUCCESS) { - console.log("getAuthCallback err: " + JSON.stringify(err)); - return; - } - var result = { - accountInfo: { - name: "Lisi", - owner: "com.example.accountjsdemo", - }, - tokenInfo: { - token: "xxxxxx", - authType: "getSocialData" + import UIAbility from '@ohos.app.ability.UIAbility'; + + export default class EntryAbility extends UIAbility { + onCreate(want, param) { + var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; + try { + appAccountManager.getAuthCallback(sessionId, (err, callback) => { + if (err != null) { + console.log("getAuthCallback err: " + JSON.stringify(err)); + return; } - }; - callback.onResult(account_appAccount.ResultCode.SUCCESS, result); - }); - } catch (err) { - console.log("getAuthCallback exception: " + JSON.stringify(err)); + var result = { + accountInfo: { + name: "Lisi", + owner: "com.example.accountjsdemo", + }, + tokenInfo: { + token: "xxxxxx", + authType: "getSocialData" + } + }; + callback.onResult(0, result); + }); + } catch (err) { + console.log("getAuthCallback exception: " + JSON.stringify(err)); + } } - }); + } ``` ### getAuthCallback9+ @@ -2150,9 +2146,10 @@ getAuthCallback(sessionId: string): Promise<AuthCallback> **示例:** ```js - import featureAbility from '@ohos.ability.featureAbility'; + import UIAbility from '@ohos.app.ability.UIAbility'; - featureAbility.getWant().then((want) => { + export default class EntryAbility extends UIAbility { + onCreate(want, param) { var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; try { appAccountManager.getAuthCallback(sessionId).then((callback) => { @@ -2166,16 +2163,15 @@ getAuthCallback(sessionId: string): Promise<AuthCallback> authType: "getSocialData" } }; - callback.onResult(account_appAccount.ResultCode.SUCCESS, result); + callback.onResult(0, result); }).catch((err) => { - console.log("getAuthCallback err: " + JSON.stringify(err)); + console.log("getAuthCallback err: " + JSON.stringify(err)); }); } catch (err) { console.log("getAuthCallback exception: " + JSON.stringify(err)); } - }).catch((err) => { - console.log("getWant err: " + JSON.stringify(err)); - }); + } + } ``` ### queryAuthenticatorInfo9+ @@ -2281,7 +2277,7 @@ checkAccountLabels(name: string, owner: string, labels: Array<string>, cal | 错误码ID | 错误信息 | | ------- | ------- | | 12300001 | System service exception. | -| 12300002 | Invalid name or owner or labels. | +| 12300002 | Invalid name, owner or labels. | | 12300003 | Account not found. | | 12300010 | Account service busy. | | 12300113 | Authenticator service not found. | @@ -2331,7 +2327,7 @@ checkAccountLabels(name: string, owner: string, labels: Array<string>): Pr | 错误码ID | 错误信息 | | ------- | ------- | | 12300001 | System service exception. | -| 12300002 | Invalid name or owner or labels. | +| 12300002 | Invalid name, owner or labels. | | 12300003 | Account not found. | | 12300010 | Account service busy. | | 12300113 | Authenticator service not found. | @@ -2594,7 +2590,7 @@ verifyCredential(name: string, owner: string, options: VerifyCredentialOptions, | 错误码ID | 错误信息| | ------- | -------| | 12300001 | System service exception. | -| 12300002 | Invalid name or owner or options. | +| 12300002 | Invalid name, owner or options. | | 12300003 | Account not found. | | 12300010 | Account service busy. | | 12300113 | Authenticator service not found. | @@ -4287,10 +4283,12 @@ getAuthenticatorCallback(sessionId: string, callback: AsyncCallback<Authentic **示例:** ```js - import featureAbility from '@ohos.ability.featureAbility'; - featureAbility.getWant((err, want) => { - var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; - appAccountManager.getAuthenticatorCallback(sessionId, (err, callback) => { + import UIAbility from '@ohos.app.ability.UIAbility'; + + export default class EntryAbility extends UIAbility { + onCreate(want, param) { + var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; + appAccountManager.getAuthenticatorCallback(sessionId, (err, callback) => { if (err.code != account_appAccount.ResultCode.SUCCESS) { console.log("getAuthenticatorCallback err: " + JSON.stringify(err)); return; @@ -4300,8 +4298,9 @@ getAuthenticatorCallback(sessionId: string, callback: AsyncCallback<Authentic [account_appAccount.Constants.KEY_AUTH_TYPE]: "getSocialData", [account_appAccount.Constants.KEY_TOKEN]: "xxxxxx"}; callback.onResult(account_appAccount.ResultCode.SUCCESS, result); - }); - }); + }); + } + } ``` ### getAuthenticatorCallback(deprecated) @@ -4331,22 +4330,22 @@ getAuthenticatorCallback(sessionId: string): Promise<AuthenticatorCallback> **示例:** ```js - import featureAbility from '@ohos.ability.featureAbility'; + import UIAbility from '@ohos.app.ability.UIAbility'; - featureAbility.getWant().then((want) => { + export default class EntryAbility extends UIAbility { + onCreate(want, param) { var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID]; appAccountManager.getAuthenticatorCallback(sessionId).then((callback) => { - var result = {[account_appAccount.Constants.KEY_NAME]: "LiSi", - [account_appAccount.Constants.KEY_OWNER]: "com.example.accountjsdemo", - [account_appAccount.Constants.KEY_AUTH_TYPE]: "getSocialData", - [account_appAccount.Constants.KEY_TOKEN]: "xxxxxx"}; - callback.onResult(account_appAccount.ResultCode.SUCCESS, result); + var result = {[account_appAccount.Constants.KEY_NAME]: "LiSi", + [account_appAccount.Constants.KEY_OWNER]: "com.example.accountjsdemo", + [account_appAccount.Constants.KEY_AUTH_TYPE]: "getSocialData", + [account_appAccount.Constants.KEY_TOKEN]: "xxxxxx"}; + callback.onResult(account_appAccount.ResultCode.SUCCESS, result); }).catch((err) => { - console.log("getAuthenticatorCallback err: " + JSON.stringify(err)); + console.log("getAuthenticatorCallback err: " + JSON.stringify(err)); }); - }).catch((err) => { - console.log("getWant err: " + JSON.stringify(err)); - }); + } + } ``` ### getAuthenticatorInfo(deprecated) diff --git a/zh-cn/application-dev/reference/apis/js-apis-appControl.md b/zh-cn/application-dev/reference/apis/js-apis-appControl.md index b9747a0dc7acfb4eaab24f6bd575de660208f660..03286aaa8a0cabe11779d0755aefe5802dbf2eb3 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-appControl.md +++ b/zh-cn/application-dev/reference/apis/js-apis-appControl.md @@ -24,7 +24,7 @@ setDisposedStatus(appId: string, disposedWant: Want): Promise\ **系统能力:** SystemCapability.BundleManager.BundleFramework.AppControl -**系统API:** 此接口为系统接口,三方应用不支持调用。 +**系统API:** 此接口为系统接口。。 **参数:** @@ -75,7 +75,7 @@ setDisposedStatus(appId: string, disposedWant: Want, callback: AsyncCallback\; **系统能力:** SystemCapability.BundleManager.BundleFramework.AppControl -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** @@ -171,7 +171,7 @@ getDisposedStatus(appId: string, callback: AsyncCallback\): void; **系统能力:** SystemCapability.BundleManager.BundleFramework.AppControl -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** @@ -216,7 +216,7 @@ deleteDisposedStatus(appId: string): Promise\ **系统能力:** SystemCapability.BundleManager.BundleFramework.AppControl -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** @@ -265,7 +265,7 @@ deleteDisposedStatus(appId: string, callback: AsyncCallback\) : void **系统能力:** SystemCapability.BundleManager.BundleFramework.AppControl -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** 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 index bb37534a86ff2831456083701d8fd21d39e1389a..209e20483059e5ca06dd284e3b52818a517acb2b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-accessibilityExtensionAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-accessibilityExtensionAbility.md @@ -16,9 +16,9 @@ import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtens **系统能力:** SystemCapability.BarrierFree.Accessibility.Core -| 名称 | 类型 | 可读 | 可写 | 说明 | -| --------- | -------- | ---- | ---- | ------------------------- | -| context | [AccessibilityExtensionContext](js-apis-inner-application-accessibilityExtensionContext.md) | 是 | 否 | 表示辅助扩展能力上下文。 | +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ------- | ---------------------------------------- | ---- | ---- | ------------ | +| context | [AccessibilityExtensionContext](js-apis-inner-application-accessibilityExtensionContext.md) | 是 | 否 | 表示辅助扩展能力上下文。 | ## AccessibilityEvent @@ -28,11 +28,11 @@ import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtens ### 属性 -| 名称 | 类型 | 可读 | 可写 | 说明 | -| --------- | ---------------------------------------- | ---- | ---- | ---------- | -| eventType | [accessibility.EventType](js-apis-accessibility.md#EventType) \| [accessibility.WindowUpdateType](js-apis-accessibility.md#WindowUpdateType) \| [TouchGuideType](#touchguidetype) \| [GestureType](#gesturetype) \| [PageUpdateType](#pageupdatetype) | 是 | 否 | 具体事件类型。 | -| target | [AccessibilityElement](js-apis-inner-application-accessibilityExtensionContext.md#accessibilityelement9) | 是 | 否 | 发生事件的目标组件。 | -| timeStamp | number | 是 | 否 | 事件时间戳。 | +| 名称 | 类型 | 可读 | 可写 | 说明 | +| --------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------------------------------------ | +| eventType | [accessibility.EventType](js-apis-accessibility.md#EventType) \| [accessibility.WindowUpdateType](js-apis-accessibility.md#WindowUpdateType)\| [TouchGuideType](#touchguidetype) \| [GestureType](#gesturetype) \| [PageUpdateType](#pageupdatetype) | 是 | 否 | 具体事件类型。
EventType:无障碍事件类型;
WindowUpdateType:窗口变化类型;TouchGuideType:触摸浏览事件类型;
GestureType:手势事件类型;
PageUpdateType:页面刷新类型,当前版本暂不支持。 | +| target | [AccessibilityElement](js-apis-inner-application-accessibilityExtensionContext.md#accessibilityelement9) | 是 | 否 | 发生事件的目标组件。 | +| timeStamp | number | 是 | 否 | 事件时间戳。 | ## GestureType @@ -40,35 +40,35 @@ import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtens **系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core -| 名称 | 描述 | -| ------------- | ------------ | -| left | 表示向左的手势。 | -| leftThenRight | 表示先向左再向右的手势。 | -| leftThenUp | 表示先向左再向上的手势。 | -| leftThenDown | 表示先向左再向下的手势。 | -| right | 表示向右的手势。 | -| rightThenLeft | 表示先向右再向左的手势。 | -| rightThenUp | 表示先向右再向上的手势。 | -| rightThenDown | 表示先向右再向下的手势。 | -| up | 表示向上的手势。 | -| upThenLeft | 表示先向上再向左的手势。 | -| upThenRight | 表示先向上再向右的手势。 | -| upThenDown | 表示先向上再向下的手势。 | -| down | 表示向下的手势。 | -| downThenLeft | 表示先向下再向左的手势。 | -| downThenRight | 表示先向下再向右的手势。 | -| downThenUp | 表示先向下再向上的手势。 | +| 名称 | 描述 | +| ------------- | ------------------- | +| left | 类型为字符串,表示向左的手势。 | +| leftThenRight | 类型为字符串,表示先向左再向右的手势。 | +| leftThenUp | 类型为字符串,表示先向左再向上的手势。 | +| leftThenDown | 类型为字符串,表示先向左再向下的手势。 | +| right | 类型为字符串,表示向右的手势。 | +| rightThenLeft | 类型为字符串,表示先向右再向左的手势。 | +| rightThenUp | 类型为字符串,表示先向右再向上的手势。 | +| rightThenDown | 类型为字符串,表示先向右再向下的手势。 | +| up | 类型为字符串,表示向上的手势。 | +| upThenLeft | 类型为字符串,表示先向上再向左的手势。 | +| upThenRight | 类型为字符串,表示先向上再向右的手势。 | +| upThenDown | 类型为字符串,表示先向上再向下的手势。 | +| down | 类型为字符串,表示向下的手势。 | +| downThenLeft | 类型为字符串,表示先向下再向左的手势。 | +| downThenRight | 类型为字符串,表示先向下再向右的手势。 | +| downThenUp | 类型为字符串,表示先向下再向上的手势。 | ## PageUpdateType -页面刷新类型。 +页面刷新类型;当前版本暂不支持。 **系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core -| 名称 | 描述 | -| ----------------- | --------- | -| pageContentUpdate | 表示页面内容刷新。 | -| pageStateUpdate | 表示页面状态刷新。 | +| 名称 | 描述 | +| ----------------- | ---------------- | +| pageContentUpdate | 类型为字符串,表示页面内容刷新。 | +| pageStateUpdate | 类型为字符串,表示页面状态刷新。 | ## TouchGuideType @@ -76,10 +76,10 @@ import AccessibilityExtensionAbility from '@ohos.application.AccessibilityExtens **系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core -| 名称 | 描述 | -| ---------- | ------------ | -| touchBegin | 表示触摸浏览时开始触摸。 | -| touchEnd | 表示触摸浏览时结束触摸。 | +| 名称 | 描述 | +| ---------- | ------------------- | +| touchBegin | 类型为字符串,表示触摸浏览时开始触摸。 | +| touchEnd | 类型为字符串,表示触摸浏览时结束触摸。 | ## AccessibilityExtensionAbility.onConnect @@ -127,7 +127,7 @@ onAccessibilityEvent(event: AccessibilityEvent): void; **参数:** -| 参数名 | 类型 | 必填 | 说明 | +| 参数名 | 类型 | 必填 | 说明 | | ----- | ---------------------------------------- | ---- | --------------- | | event | [AccessibilityEvent](#accessibilityevent) | 是 | 无障碍事件回调函数。无返回值。 | @@ -154,7 +154,7 @@ onKeyEvent(keyEvent: KeyEvent): boolean; **参数:** -| 参数名 | 类型 | 必填 | 说明 | +| 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------------------- | ---- | ----------------------- | | keyEvent | [KeyEvent](js-apis-keyevent.md#KeyEvent) | 是 | 按键事件回调函数。返回true表示拦截此按键。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-appManager.md b/zh-cn/application-dev/reference/apis/js-apis-application-appManager.md index a8c1a093346c766f49cab9c0fd6263a4dba55dc4..9d6cd83ab9a2d955d6ac92cfa7df21a3b4281df8 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-appManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-appManager.md @@ -263,49 +263,6 @@ registerApplicationStateObserver(observer: ApplicationStateObserver): number; console.log('-------- observerCode: ---------', observerCode); ``` -## appManager.registerApplicationStateObserver9+ - -registerApplicationStateObserver(observer: ApplicationStateObserver, bundleNameList: Array\): number; - -注册指定应用程序状态观测器。 - -**需要权限**:ohos.permission.RUNNING_STATE_OBSERVER - -**系统能力**:SystemCapability.Ability.AbilityRuntime.Core - -**系统API**:该接口为系统接口,三方应用不支持调用。 - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| observer | [ApplicationStateObserver](js-apis-inner-application-applicationStateObserver.md) | 是 | 返回观察者的数字代码。 | -| bundleNameList | Array | 是 | 表示需要注册监听的bundleName数组。最大值128。 | - -**示例:** - - ```ts - let applicationStateObserver = { - onForegroundApplicationChanged(appStateData) { - console.log('------------ onForegroundApplicationChanged -----------', appStateData); - }, - onAbilityStateChanged(abilityStateData) { - console.log('------------ onAbilityStateChanged -----------', abilityStateData); - }, - onProcessCreated(processData) { - console.log('------------ onProcessCreated -----------', processData); - }, - onProcessDied(processData) { - console.log('------------ onProcessDied -----------', processData); - }, - onProcessStateChanged(processData) { - console.log('------------ onProcessStateChanged -----------', processData); - } - }; - let bundleNameList = ['bundleName1', 'bundleName2']; - const observerCode = appManager.registerApplicationStateObserver(applicationStateObserver, bundleNameList); - console.log('-------- observerCode: ---------', observerCode); - ``` ## appManager.unregisterApplicationStateObserver8+ unregisterApplicationStateObserver(observerId: number, callback: AsyncCallback\): void; diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-configuration.md b/zh-cn/application-dev/reference/apis/js-apis-application-configuration.md index 4a8ad3cb8d203b5b62fa5f3911bb42b855d52b48..b9b86a80fa48dbe3e8b21b4b752a3f0eb97ccd5f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-configuration.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-configuration.md @@ -33,11 +33,14 @@ export default class EntryAbility extends UIAbility { console.info(`envCallback onConfigurationUpdated success: ${JSON.stringify(config)}`); let language = config.language; let colorMode = config.colorMode; + }, + onMemoryLevel(level){ + console.log('onMemoryLevel level: ${JSON.stringify(level)}'); } }; let applicationContext = this.context.getApplicationContext(); - applicationContext.registerEnvironmentCallback(envCallback); + applicationContext.on('environment',envCallback); windowStage.loadContent('pages/index', (err, data) => { if (err.code) { diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-missionManager.md b/zh-cn/application-dev/reference/apis/js-apis-application-missionManager.md index 7ec7acabd0f63624a2175226160689c74162426f..bc25988f7a20c5d3693aa5f0b9949045965299be 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-missionManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-missionManager.md @@ -170,7 +170,7 @@ getMissionInfo(deviceId: string, missionId: number, callback: AsyncCallback<M let allMissions=missionManager.getMissionInfos('',10).catch(function(err){console.log(err);}); missionManager.getMissionInfo('', allMissions[0].missionId, (error, mission) => { if (error.code) { - console.error('getMissionInfo failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfo failed, error.code: ${error.code}, error.message: ${error.message}'); return; } @@ -247,7 +247,7 @@ getMissionInfos(deviceId: string, numMax: number, callback: AsyncCallback<Arr missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -319,7 +319,7 @@ getMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback& missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -328,7 +328,7 @@ getMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback& missionManager.getMissionSnapShot('', id, (error, snapshot) => { if (error.code) { - console.error('getMissionSnapShot failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionSnapShot failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('bundleName = ${snapshot.ability.bundleName}'); @@ -382,97 +382,6 @@ getMissionSnapShot(deviceId: string, missionId: number): Promise<MissionSnaps }); ``` -## missionManager.getLowResolutionMissionSnapShot9+ - -getLowResolutionMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback\): void; - -获取任务低分辨率快照。 - -**需要权限**:ohos.permission.MANAGE_MISSIONS - -**系统能力**:SystemCapability.Ability.AbilityRuntime.Mission - -**系统API**: 此接口为系统接口,三方应用不支持调用。 - -**参数:** - - | 参数名 | 类型 | 必填 | 说明 | - | -------- | -------- | -------- | -------- | - | deviceId | string | 是 | 设备ID,本机默认为空字符串。 | - | missionId | number | 是 | 任务ID。 | - | callback | AsyncCallback<[MissionSnapshot](js-apis-inner-application-missionSnapshot.md)> | 是 | 执行结果回调函数,返回任务快照信息。 | - -**示例:** - - ```ts - import missionManager from '@ohos.application.missionManager'; - - missionManager.getMissionInfos('', 10, (error, missions) => { - if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); - return; - } - console.log('size = ${missions.length}'); - console.log('missions = ${JSON.stringify(missions)}'); - let id = missions[0].missionId; - - missionManager.getLowResolutionMissionSnapShot('', id, (error, snapshot) => { - if (error.code) { - console.error('getLowResolutionMissionSnapShot failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); - return; - } - console.log('bundleName = ${snapshot.ability.bundleName}'); - }); - }); - ``` - - -## missionManager.getLowResolutionMissionSnapShot9+ - -getLowResolutionMissionSnapShot(deviceId: string, missionId: number): Promise\; - -获取任务低分辨率快照。 - -**需要权限**:ohos.permission.MANAGE_MISSIONS - -**系统能力**:SystemCapability.Ability.AbilityRuntime.Mission - -**系统API**: 此接口为系统接口,三方应用不支持调用。 - -**参数:** - - | 参数名 | 类型 | 必填 | 说明 | - | -------- | -------- | -------- | -------- | - | deviceId | string | 是 | 设备ID,本机默认为空字符串。 | - | missionId | number | 是 | 任务ID。 | - -**返回值:** - - | 类型 | 说明 | - | -------- | -------- | - | Promise<[MissionSnapshot](js-apis-inner-application-missionSnapshot.md)> | 任务快照信息。 | - -**示例:** - - ```ts - import missionManager from '@ohos.application.missionManager'; - - let allMissions; - missionManager.getMissionInfos('',10).then(function(res){ - allMissions=res; - }).catch(function(error) { - console.error('getMissionInfos fail, error: ${error}'); - }); - console.log('size = ${allMissions.length}'); - console.log('missions = ${JSON.stringify(allMissions)}'); - let id = allMissions[0].missionId; - - let snapshot = missionManager.getLowResolutionMissionSnapShot('', id).catch(function (error){ - console.error('getLowResolutionMissionSnapShot fail, error: ${error}'); - }); - ``` - - ## missionManager.lockMission lockMission(missionId: number, callback: AsyncCallback<void>): void; @@ -499,7 +408,7 @@ lockMission(missionId: number, callback: AsyncCallback<void>): void; missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -583,7 +492,7 @@ unlockMission(missionId: number, callback: AsyncCallback<void>): void; missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -671,7 +580,7 @@ clearMission(missionId: number, callback: AsyncCallback<void>): void; missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -807,7 +716,7 @@ moveMissionToFront(missionId: number, callback: AsyncCallback<void>): void missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); @@ -848,7 +757,7 @@ moveMissionToFront(missionId: number, options: StartOptions, callback: AsyncCall missionManager.getMissionInfos('', 10, (error, missions) => { if (error.code) { - console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfos failed, error.code: ${error.code}, error.message: ${error.message}'); return; } console.log('size = ${missions.length}'); diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-want.md b/zh-cn/application-dev/reference/apis/js-apis-application-want.md index c8c632e9b60a90f31bc8b99b19cd2e0aaa05642e..184d2ee6fe82c73a60046da37d1b83473491ae73 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-want.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-want.md @@ -23,11 +23,10 @@ import Want from '@ohos.application.Want'; | abilityName | string | 否 | 表示待启动的Ability名称。如果在Want中该字段同时指定了BundleName和AbilityName,则Want可以直接匹配到指定的Ability。AbilityName需要在一个应用的范围内保证唯一。 | | uri | string | 否 | 表示Uri描述。如果在Want中指定了Uri,则Want将匹配指定的Uri信息,包括scheme, schemeSpecificPart, authority和path信息。 | | type | string | 否 | 表示MIME type类型描述,打开文件的类型,主要用于文管打开文件。比如:'text/xml' 、 'image/*'等,MIME定义参考:https://www.iana.org/assignments/media-types/media-types.xhtml?utm_source=ld246.com。 | -| flags | number | 否 | 表示处理Want的方式。默认传数字,具体参考:[flags说明](js-apis-ability-wantConstant.md#wantConstant.Flags)。 | -| action | string | 否 | 表示要执行的通用操作(如:查看、分享、应用详情)。在隐式Want中,您可以定义该字段,配合uri或parameters来表示对数据要执行的操作。具体参考:[action说明](js-apis-app-ability-wantConstant.md#wantConstant.Action)。隐式Want定义及匹配规则参考:[显式Want与隐式Want匹配规则](application-models/explicit-implicit-want-mappings.md)。 | -| parameters | {[key: string]: any} | 否 | 表示WantParams描述,由开发者自行决定传入的键值对。默认会携带以下key值:
ohos.aafwk.callerPid 表示拉起方的pid。
ohos.aafwk.param.callerToken 表示拉起方的token。
ohos.aafwk.param.callerUid 表示[bundleInfo](js-apis-bundle-BundleInfo.md#bundleinfo-1)中的uid,应用包里应用程序的uid。
- component.startup.newRules:表示是否启用新的管控规则。
- moduleName:表示拉起方的模块名,该字段的值即使定义成其他字符串,在传递到另一端时会被修改为正确的值。
- ohos.dlp.params.sandbox:表示dlp文件才会有。 | -| entities | Array\ | 否 | 表示目标Ability额外的类别信息(如:浏览器、视频播放器)。在隐式Want中是对action字段的补充。在隐式Want中,您可以定义该字段,来过滤匹配Ability类型。具体参考:[entity说明](js-apis-app-ability-wantConstant.md#wantConstant.Entity)。 | -| moduleName9+ | string | 否 | 表示待启动的Ability所属的模块(module)。 | +| flags | number | 否 | 表示处理Want的方式。默认传数字,具体参考:[flags说明](js-apis-ability-wantConstant.md#wantconstantflags)。 | +| action | string | 否 | 表示要执行的通用操作(如:查看、分享、应用详情)。在隐式Want中,您可以定义该字段,配合uri或parameters来表示对数据要执行的操作。具体参考:[action说明](js-apis-ability-wantConstant.md#wantconstantaction)。隐式Want定义及匹配规则参考:[显式Want与隐式Want匹配规则](../../application-models/explicit-implicit-want-mappings.md)。 | +| parameters | {[key: string]: any} | 否 | 表示WantParams描述,由开发者自行决定传入的键值对。默认会携带以下key值:
ohos.aafwk.callerPid 表示拉起方的pid。
ohos.aafwk.param.callerToken 表示拉起方的token。
ohos.aafwk.param.callerUid 表示[bundleInfo](js-apis-bundle-BundleInfo.md#bundleinfo)中的uid,应用包里应用程序的uid。
- component.startup.newRules:表示是否启用新的管控规则。
- moduleName:表示拉起方的模块名,该字段的值即使定义成其他字符串,在传递到另一端时会被修改为正确的值。
- ohos.dlp.params.sandbox:表示dlp文件才会有。 | +| entities | Array\ | 否 | 表示目标Ability额外的类别信息(如:浏览器、视频播放器)。在隐式Want中是对action字段的补充。在隐式Want中,您可以定义该字段,来过滤匹配Ability类型。具体参考:[entity说明](js-apis-ability-wantConstant.md#wantconstantentity)。 | **示例:** @@ -109,10 +108,10 @@ import Want from '@ohos.application.Want'; ``` * 文件描述符(FD) ```ts - import fileio from '@ohos.fileio'; + import fs from '@ohos.file.fs'; let fd; try { - fd = fileio.openSync('/data/storage/el2/base/haps/pic.png'); + fd = fs.openSync('/data/storage/el2/base/haps/pic.png').fd; } catch(e) { console.error('openSync fail: ${JSON.stringify(e)}'); } diff --git a/zh-cn/application-dev/reference/apis/js-apis-arkui-drawableDescriptor.md b/zh-cn/application-dev/reference/apis/js-apis-arkui-drawableDescriptor.md new file mode 100644 index 0000000000000000000000000000000000000000..dececbfebf0b5d76bb9e57266f7a97a70a08b0f7 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-arkui-drawableDescriptor.md @@ -0,0 +1,135 @@ +# @ohos.arkui.drawableDescriptor (DrawableDescriptor) + +本模块提供获取pixelMap的能力,包括前景、背景、蒙版和分层图标。 + +> **说明:** +> +> 本模块首批接口从API version 10开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> +> 示例效果请以真机运行为准,当前IDE预览器不支持。 + +## 导入模块 + +```js +import { DrawableDescriptor, LayeredDrawableDescriptor } from '@ohos.arkui.drawableDescriptor'; +``` + +## DrawableDescriptor.constructor +constructor() + +创建DrawableDescriptor或LayeredDrawableDescriptor对象。对象构造需要使用全球化接口[getDrawableDescriptor](js-apis-resource-manager.md##getdrawabledescriptor)或[getDrawableDescriptorByName](js-apis-resource-manager.md##getdrawabledescriptorbyname)。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + +### DrawableDescriptor + +当传入资源id或name为普通图片时,生成DrawableDescriptor对象。 + +### LayeredDrawableDescriptor + +当传入资源id或name为包含前景和背景资源的json文件时,生成LayeredDrawableDescriptor对象。 + +**示例:** +```js +@Entry +@Component +struct Index { + private resManager = getContext().resourceManager + let drawable1 = resManager.getDrawableDescriptor($r('app.media.icon').id) + let drawable2 = resManager.getDrawableDescriptorByName(icon) + let layeredDrawable1 = resManager.getDrawableDescriptor($r('app.media.file').id) + let layeredDrawable1 = resManager.getDrawableDescriptor(file) + } +``` + +## DrawableDescriptor.getPixelMap +getPixelMap(): image.PixelMap; + +获取pixelMap。 + +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + +**返回值:** + +| 类型 | 说明 | +| --------------------------------- | ---------------- | +| [image.PixelMap](../apis/js-apis-image.md#pixelmap7) | PixelMap | + +**示例:** + ```js + @State pixmap: PixelMap = drawable1.getPixelMap(); + ``` + +## LayeredDrawableDescriptor.getPixelMap +getPixelMap(): image.PixelMap; + +获取前景、背景和蒙版融合裁剪后的pixelMap。 + +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + +**返回值:** + +| 类型 | 说明 | +| --------------------------------- | ---------------- | +| [image.PixelMap](../apis/js-apis-image.md#pixelmap7) | PixelMap | + +**示例:** + ```js + @State pixmap: PixelMap = layeredDrawable1.getPixelMap(); + ``` + +## LayeredDrawableDescriptor.getForeground +getForeground(): DrawableDescriptor; + +获取前景的DrawableDescriptor对象。 + +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + +**返回值:** + +| 类型 | 说明 | +| --------------------------------- | ---------------- | +| [DrawableDescriptor](#drawabledescriptor) | DrawableDescriptor对象 | + +**示例:** + ```js + @State drawable: DrawableDescriptor = layeredDrawable1.getForeground(); + ``` + +## LayeredDrawableDescriptor.getBackground +getBackground(): DrawableDescriptor; + +获取背景的DrawableDescriptor对象。 + +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + +**返回值:** + +| 类型 | 说明 | +| --------------------------------- | ---------------- | +| [DrawableDescriptor](#drawabledescriptor) | DrawableDescriptor对象 | + +**示例:** + ```js + @State drawable: DrawableDescriptor = layeredDrawable1.getBackground(); + ``` + +## LayeredDrawableDescriptor.getMask +getMask(): DrawableDescriptor; + +获取蒙版的DrawableDescriptor对象。 + +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + +**返回值:** + +| 类型 | 说明 | +| --------------------------------- | ---------------- | +| [DrawableDescriptor](#drawabledescriptor) | DrawableDescriptor对象 | + +**示例:** + ```js + @State drawable: DrawableDescriptor = layeredDrawable1.getMask(); + ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-arraylist.md b/zh-cn/application-dev/reference/apis/js-apis-arraylist.md index 9dcc2325a08e342f8acdf89f78a7eb2bd302401a..2569a587c6f31f1d64ab16ffb1d6af0edf7d176c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-arraylist.md +++ b/zh-cn/application-dev/reference/apis/js-apis-arraylist.md @@ -1,8 +1,5 @@ # @ohos.util.ArrayList (线性容器ArrayList) -> **说明:** -> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 - ArrayList是一种线性数据结构,底层基于数组实现。ArrayList会根据实际需要动态调整容量,每次扩容增加50%。 ArrayList和[Vector](js-apis-vector.md)相似,都是基于数组实现。它们都可以动态调整容量,但Vector每次扩容增加1倍。 @@ -11,8 +8,13 @@ ArrayList和[LinkedList](js-apis-linkedlist.md)相比,ArrayList的随机访问 **推荐使用场景:** 当需要频繁读取集合中的元素时,推荐使用ArrayList。 -文档中存在泛型的使用,涉及以下泛型标记符:
-- T: Type, 类 +文档中存在泛型的使用,涉及以下泛型标记符:
+- T:Type,类 + +> **说明:** +> +> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + ## 导入模块 @@ -160,9 +162,8 @@ has(element: T): boolean ```ts let arrayList = new ArrayList(); -let result = arrayList.has("squirrel"); arrayList.add("squirrel"); -let result1 = arrayList.has("squirrel"); +let result = arrayList.has("squirrel"); ``` ### getIndexOf @@ -535,9 +536,7 @@ arrayList.add(2); arrayList.add(4); arrayList.add(5); arrayList.add(4); -let result1 = arrayList.subArrayList(2, 4); -let result2 = arrayList.subArrayList(4, 3); -let result3 = arrayList.subArrayList(2, 6); +let result = arrayList.subArrayList(2, 4); ``` ### clear 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 6f465e2fdf0399169ef4547d49f75614838b56ba..1b26e4c82c793b7db094bf83d02894c23dd7fe1b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-audio.md +++ b/zh-cn/application-dev/reference/apis/js-apis-audio.md @@ -485,8 +485,8 @@ async function createTonePlayerBefore(){ | 名称 | 值 | 说明 | | --------- | -------- | -------- | -| CHANNEL_1 | 0x1 << 0 | 单声道。 | -| CHANNEL_2 | 0x1 << 1 | 双声道。 | +| CHANNEL_1 | 0x1 << 0 | 第一声道。 | +| CHANNEL_2 | 0x1 << 1 | 第二声道。 | ## AudioSamplingRate8+ @@ -689,21 +689,19 @@ async function createTonePlayerBefore(){ | forceType | [InterruptForceType](#interruptforcetype9) | 是 | 操作是由系统执行或是由应用程序执行。 | | hintType | [InterruptHint](#interrupthint) | 是 | 中断提示。 | -## VolumeEvent8+ +## VolumeEvent9+ 音量改变时,应用接收的事件。 -**系统接口:** 该接口为系统接口 - **系统能力:** SystemCapability.Multimedia.Audio.Volume | 名称 | 类型 | 必填 | 说明 | | ---------- | ----------------------------------- | ---- | -------------------------------------------------------- | -| volumeType | [AudioVolumeType](#audiovolumetype) | 是 | 音量流类型。 | -| volume | number | 是 | 音量等级,可设置范围通过getMinVolume和getMaxVolume获取。 | -| updateUi | boolean | 是 | 在UI中显示音量变化。 | -| volumeGroupId9+ | number | 是 | 音量组id。可用于getGroupManager入参 | -| networkId9+ | string | 是 | 网络id。 | +| volumeType | [AudioVolumeType](#audiovolumetype) | 是 | 音量流类型。 | +| volume | number | 是 | 音量等级,可设置范围通过getMinVolume和getMaxVolume获取。 | +| updateUi | boolean | 是 | 在UI中显示音量变化。 | +| volumeGroupId | number | 是 | 音量组id。可用于getGroupManager入参。
此接口为系统接口。 | +| networkId | string | 是 | 网络id。
此接口为系统接口。 | ## MicStateChangeEvent9+ @@ -1110,7 +1108,7 @@ setVolume(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback&l 设置指定流的音量,使用callback方式异步返回结果。 > **说明:** -> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用AudioVolumeGroupManager中的[setVolume](#setvolume9)替代。 +> 从 API version 7 开始支持,从 API version 9 开始废弃。建议使用AudioVolumeGroupManager中的[setVolume](#setvolume9)替代,替代接口能力仅对系统应用开放。 **需要权限:** ohos.permission.ACCESS_NOTIFICATION_POLICY @@ -1145,7 +1143,7 @@ setVolume(volumeType: AudioVolumeType, volume: number): Promise<void> 设置指定流的音量,使用Promise方式异步返回结果。 > **说明:** -> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用AudioVolumeGroupManager中的[setVolume](#setvolume9)替代。 +> 从 API version 7 开始支持,从 API version 9 开始废弃。建议使用AudioVolumeGroupManager中的[setVolume](#setvolume9)替代,替代接口能力仅对系统应用开放。 **需要权限:** ohos.permission.ACCESS_NOTIFICATION_POLICY @@ -1364,7 +1362,7 @@ mute(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback<void 设置指定音量流静音,使用callback方式异步返回结果。 > **说明:** -> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用AudioVolumeGroupManager中的[mute](#mute9)替代。 +> 从 API version 7 开始支持,从 API version 9 开始废弃。建议使用AudioVolumeGroupManager中的[mute](#mute9)替代,替代接口能力仅对系统应用开放。 **系统能力:** SystemCapability.Multimedia.Audio.Volume @@ -1395,7 +1393,7 @@ mute(volumeType: AudioVolumeType, mute: boolean): Promise<void> 设置指定音量流静音,使用Promise方式异步返回结果。 > **说明:** -> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用AudioVolumeGroupManager中的[mute](#mute9)替代。 +> 从 API version 7 开始支持,从 API version 9 开始废弃。建议使用AudioVolumeGroupManager中的[mute](#mute9)替代,替代接口能力仅对系统应用开放。 **系统能力:** SystemCapability.Multimedia.Audio.Volume @@ -1550,7 +1548,7 @@ setRingerMode(mode: AudioRingMode, callback: AsyncCallback<void>): void 设置铃声模式,使用callback方式异步返回结果。 > **说明:** -> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用AudioVolumeGroupManager中的[setRingerMode](#setringermode9)替代。 +> 从 API version 7 开始支持,从 API version 9 开始废弃。建议使用AudioVolumeGroupManager中的[setRingerMode](#setringermode9)替代,替代接口能力仅对系统应用开放。 **需要权限:** ohos.permission.ACCESS_NOTIFICATION_POLICY @@ -1584,7 +1582,8 @@ setRingerMode(mode: AudioRingMode): Promise<void> 设置铃声模式,使用Promise方式异步返回结果。 > **说明:** -> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用AudioVolumeGroupManager中的[setRingerMode](#setringermode9)替代。 +> 从 API version 7 开始支持,从 API version 9 开始废弃。建议使用AudioVolumeGroupManager中的[setRingerMode](#setringermode9)替代,替代接口能力仅对系统应用开放。 + **需要权限:** ohos.permission.ACCESS_NOTIFICATION_POLICY @@ -1974,12 +1973,12 @@ audioManager.isMicrophoneMute().then((value) => { }); ``` -### on('volumeChange')(deprecated) +### on('volumeChange')9+ on(type: 'volumeChange', callback: Callback\): void > **说明:** -> 从 API version 8 开始支持,从 API version 9 开始废弃,建议使用AudioVolumeManager中的[on](#on9)替代。 +> 建议使用AudioVolumeManager中的[on('volumeChange')](#onvolumechange9)替代。 监听系统音量变化事件。 @@ -1994,7 +1993,7 @@ on(type: 'volumeChange', callback: Callback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------------------------- | ---- | ------------------------------------------------------------ | | type | string | 是 | 事件回调类型,支持的事件为:'volumeChange'(系统音量变化事件,检测到系统音量改变时,触发该事件)。 | -| callback | Callback<[VolumeEvent](#volumeevent8)> | 是 | 回调方法。 | +| callback | Callback<[VolumeEvent](#volumeevent9)> | 是 | 回调方法。 | **示例:** @@ -2041,7 +2040,7 @@ on(type: 'deviceChange', callback: Callback): void 设备更改。音频设备连接状态变化。 > **说明:** -> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用AudioRoutingManager中的[on](#on9)替代。 +> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用AudioRoutingManager中的[on('deviceChange')](#ondevicechange9)替代。 **系统能力:** SystemCapability.Multimedia.Audio.Device @@ -2070,7 +2069,7 @@ off(type: 'deviceChange', callback?: Callback): void 取消订阅音频设备连接变化事件。 > **说明:** -> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用AudioRoutingManager中的[off](#off9)替代。 +> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用AudioRoutingManager中的[off('deviceChange')](#offdevicechange9)替代。 **系统能力:** SystemCapability.Multimedia.Audio.Device @@ -2089,7 +2088,7 @@ audioManager.off('deviceChange', (deviceChanged) => { }); ``` -### on('interrupt')(deprecated) +### on('interrupt') on(type: 'interrupt', interrupt: AudioInterrupt, callback: Callback\): void @@ -2097,9 +2096,6 @@ on(type: 'interrupt', interrupt: AudioInterrupt, callback: Callback\ **说明:** -> 从 API version 7 开始支持,从 API version 9 开始废弃。 - **系统能力:** SystemCapability.Multimedia.Audio.Renderer **参数:** @@ -2130,15 +2126,12 @@ audioManager.on('interrupt', interAudioInterrupt, (InterruptAction) => { }); ``` -### off('interrupt')(deprecated) +### off('interrupt') off(type: 'interrupt', interrupt: AudioInterrupt, callback?: Callback\): void 取消监听音频打断事件(删除监听事件,取消打断)。 -> **说明:** -> 从 API version 7 开始支持,从 API version 9 开始废弃。 - **系统能力:** SystemCapability.Multimedia.Audio.Renderer **参数:** @@ -2303,7 +2296,7 @@ on(type: 'volumeChange', callback: Callback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------------------------- | ---- | ------------------------------------------------------------ | | type | string | 是 | 事件回调类型,支持的事件为:'volumeChange'。 | -| callback | Callback<[VolumeEvent](#volumeevent8)> | 是 | 回调方法。 | +| callback | Callback<[VolumeEvent](#volumeevent9)> | 是 | 回调方法。 | **错误码:** @@ -3430,7 +3423,7 @@ audioRoutingManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data) }); ``` -### on9+ +### on('deviceChange')9+ on(type: 'deviceChange', deviceFlag: DeviceFlag, callback: Callback): void @@ -3465,7 +3458,7 @@ audioRoutingManager.on('deviceChange', audio.DeviceFlag.OUTPUT_DEVICES_FLAG, (de }); ``` -### off9+ +### off('deviceChange')9+ off(type: 'deviceChange', callback?: Callback): void @@ -3899,6 +3892,151 @@ async function selectOutputDeviceByFilter(){ } ``` +### getPreferOutputDeviceForRendererInfo10+ + +getPreferOutputDeviceForRendererInfo(rendererInfo: AudioRendererInfo, callback: AsyncCallback<AudioDeviceDescriptors>): void + +根据音频信息,返回优先级最高的输出设备,使用callback方式异步返回结果。 + +**系统能力:** SystemCapability.Multimedia.Audio.Device + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------------------------- | ------------------------------------------------------------ | ---- | ------------------------- | +| rendererInfo | [AudioRendererInfo](#audiorendererinfo8) | 是 | 表示渲染器信息。 | +| callback | AsyncCallback<[AudioDeviceDescriptors](#audiodevicedescriptors)> | 是 | 回调,返回优先级最高的输出设备信息。 | + +**示例:** +```js +let rendererInfo = { + content : audio.ContentType.CONTENT_TYPE_MUSIC, + usage : audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags : 0 } + +async function getPreferOutputDevice() { + audioRoutingManager.getPreferOutputDeviceForRendererInfo(rendererInfo, (err, desc) => { + if (err) { + console.error(`Result ERROR: ${err}`); + } else { + console.info(`device descriptor: ${desc}`); + } + }); +} +``` + +### getPreferOutputDeviceForRendererInfo10+ +getPreferOutputDeviceForRendererInfo(rendererInfo: AudioRendererInfo): Promise<AudioDeviceDescriptors> + +根据音频信息,返回优先级最高的输出设备,使用promise方式异步返回结果。 + +**系统能力:** SystemCapability.Multimedia.Audio.Device + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------------------| ------------------------------------------------------------ | ---- | ------------------------- | +| rendererInfo | [AudioRendererInfo](#audiorendererinfo8) | 是 | 表示渲染器信息。 | + +**返回值:** + +| 类型 | 说明 | +| --------------------- | --------------------------- | +| Promise<[AudioDeviceDescriptors](#audiodevicedescriptors)> | Promise返回优先级最高的输出设备信息。 | + +**错误码:** + +以下错误码的详细介绍请参见[音频错误码](../errorcodes/errorcode-audio.md)。 + +| 错误码ID | 错误信息 | +| ------- | --------------------------------------------| +| 6800101 | if input parameter value error | + +**示例:** + +```js +let rendererInfo = { + content : audio.ContentType.CONTENT_TYPE_MUSIC, + usage : audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags : 0 } + +async function getPreferOutputDevice() { + audioRoutingManager.getPreferOutputDeviceForRendererInfo(rendererInfo).then((desc) => { + console.info(`device descriptor: ${desc}`); + }).catch((err) => { + console.error(`Result ERROR: ${err}`); + }) +} +``` + +### on('preferOutputDeviceChangeForRendererInfo')10+ + +on(type: 'preferOutputDeviceChangeForRendererInfo', rendererInfo: AudioRendererInfo, callback: Callback): void + +订阅最高优先级输出设备变化事件,使用callback获取最高优先级输出设备。 + +**系统能力:** SystemCapability.Multimedia.Audio.Device + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| :------- | :--------------------------------------------------- | :--- | :----------------------------------------- | +| type | string | 是 | 订阅的事件的类型。支持事件:'preferOutputDeviceChangeForRendererInfo' | +| rendererInfo | [AudioRendererInfo](#audiorendererinfo8) | 是 | 表示渲染器信息。 | +| callback | Callback<[AudioDeviceDescriptors](#audiodevicedescriptors)\> | 是 | 获取优先级最高的输出设备信息。 | + +**错误码:** + +以下错误码的详细介绍请参见[音频错误码](../errorcodes/errorcode-audio.md)。 + +| 错误码ID | 错误信息 | +| ------- | --------------------------------------------| +| 6800101 | if input parameter value error | + +**示例:** + +```js +let rendererInfo = { + content : audio.ContentType.CONTENT_TYPE_MUSIC, + usage : audio.StreamUsage.STREAM_USAGE_MEDIA, + rendererFlags : 0 } + +audioRoutingManager.on('preferOutputDeviceChangeForRendererInfo', rendererInfo, (desc) => { + console.info(`device descriptor: ${desc}`); +}); +``` + +### off('preferOutputDeviceChangeForRendererInfo')10+ + +off(type: 'preferOutputDeviceChangeForRendererInfo', callback?: Callback): void + +取消订阅最高优先级输出音频设备变化事件。 + +**系统能力:** SystemCapability.Multimedia.Audio.Device + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------------------- | ---- | ------------------------------------------ | +| type | string | 是 | 订阅的事件的类型。支持事件:'preferOutputDeviceChangeForRendererInfo' | +| callback | Callback<[AudioDeviceDescriptors](#audiodevicedescriptors)> | 否 | 监听方法的回调函数。 | + +**错误码:** + +以下错误码的详细介绍请参见[音频错误码](../errorcodes/errorcode-audio.md)。 + +| 错误码ID | 错误信息 | +| ------- | --------------------------------------------| +| 6800101 | if input parameter value error | + +**示例:** + +```js +audioRoutingManager.off('preferOutputDeviceChangeForRendererInfo', () => { + console.info('Should be no callback.'); +}); +``` + ## AudioRendererChangeInfoArray9+ 数组类型,AudioRenderChangeInfo数组,只读。 @@ -3917,6 +4055,7 @@ async function selectOutputDeviceByFilter(){ | clientUid | number | 是 | 否 | 音频渲染器客户端应用程序的Uid。
此接口为系统接口。 | | rendererInfo | [AudioRendererInfo](#audiorendererinfo8) | 是 | 否 | 音频渲染器信息。 | | rendererState | [AudioState](#audiostate) | 是 | 否 | 音频状态。
此接口为系统接口。| +| deviceDescriptors | [AudioDeviceDescriptors](#audiodevicedescriptors) | 是 | 否 | 音频设备描述。| **示例:** @@ -3975,6 +4114,7 @@ audioStreamManager.on('audioRendererChange', (AudioRendererChangeInfoArray) => | clientUid | number | 是 | 否 | 音频采集器客户端应用程序的Uid。
此接口为系统接口。 | | capturerInfo | [AudioCapturerInfo](#audiocapturerinfo8) | 是 | 否 | 音频采集器信息。 | | capturerState | [AudioState](#audiostate) | 是 | 否 | 音频状态。
此接口为系统接口。| +| deviceDescriptors | [AudioDeviceDescriptors](#audiodevicedescriptors) | 是 | 否 | 音频设备描述。| **示例:** @@ -4068,7 +4208,7 @@ promise.then(function (value) { | 名称 | 类型 | 必填 | 说明 | | -------------| ---------------------------------------- | ---- | -------------- | -| uid | number | 是 | 表示应用ID。
**系统能力:** SystemCapability.Multimedia.Audio.Core| +| uid | number | 否 | 表示应用ID。
**系统能力:** SystemCapability.Multimedia.Audio.Core| | rendererInfo | [AudioRendererInfo](#audiorendererinfo8) | 否 | 表示渲染器信息。
**系统能力:** SystemCapability.Multimedia.Audio.Renderer| | rendererId | number | 否 | 音频流唯一id。
**系统能力:** SystemCapability.Multimedia.Audio.Renderer| @@ -4539,15 +4679,15 @@ let filePath = path + '/StarWars10s-2C-48000-4SW.wav'; let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); let stat = await fs.stat(path); let buf = new ArrayBuffer(bufferSize); -let len = stat.size % this.bufferSize == 0 ? Math.floor(stat.size / this.bufferSize) : Math.floor(stat.size / this.bufferSize + 1); +let len = stat.size % bufferSize == 0 ? Math.floor(stat.size / bufferSize) : Math.floor(stat.size / bufferSize + 1); for (let i = 0;i < len; i++) { let options = { - offset: i * this.bufferSize, - length: this.bufferSize + offset: i * bufferSize, + length: bufferSize } let readsize = await fs.read(file.fd, buf, options) let writeSize = await new Promise((resolve,reject)=>{ - this.audioRenderer.write(buf,(err,writeSize)=>{ + audioRenderer.write(buf,(err,writeSize)=>{ if(err){ reject(err) }else{ @@ -4593,15 +4733,15 @@ let filePath = path + '/StarWars10s-2C-48000-4SW.wav'; let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY); let stat = await fs.stat(path); let buf = new ArrayBuffer(bufferSize); -let len = stat.size % this.bufferSize == 0 ? Math.floor(stat.size / this.bufferSize) : Math.floor(stat.size / this.bufferSize + 1); +let len = stat.size % bufferSize == 0 ? Math.floor(stat.size / bufferSize) : Math.floor(stat.size / bufferSize + 1); for (let i = 0;i < len; i++) { let options = { - offset: i * this.bufferSize, - length: this.bufferSize + offset: i * bufferSize, + length: bufferSize } let readsize = await fs.read(file.fd, buf, options) try{ - let writeSize = await this.audioRenderer.write(buf); + let writeSize = await audioRenderer.write(buf); } catch(err) { console.error(`audioRenderer.write err: ${err}`); } @@ -4924,7 +5064,7 @@ on(type: 'audioInterrupt', callback: Callback\): void 监听音频中断事件。使用callback获取中断事件。 -与[on('interrupt')](#oninterruptdeprecated)一致,该接口在AudioRenderer对象start、pause、stop等事件发生前已经主动获取焦点,不需要开发者主动发起焦点申请。 +与[on('interrupt')](#oninterrupt)一致,均用于监听焦点变化。AudioRenderer对象在start事件发生时会主动获取焦点,在pause、stop等事件发生时会主动释放焦点,不需要开发者主动发起获取焦点或释放焦点的申请。 **系统能力:** SystemCapability.Multimedia.Audio.Interrupt @@ -4932,8 +5072,8 @@ on(type: 'audioInterrupt', callback: Callback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------------------------------- | ---- | ------------------------------------------------------------ | -| type | string | 是 | 事件回调类型,支持的事件为:'audioInterrupt'(中断事件被触发,音频播放被中断。) | -| callback | Callback<[InterruptEvent](#interruptevent9)> | 是 | 被监听的中断事件的回调。 | +| type | string | 是 | 事件回调类型,支持的事件为:'audioInterrupt'(中断事件被触发,音频渲染被中断。) | +| callback | Callback\<[InterruptEvent](#interruptevent9)\> | 是 | 被监听的中断事件的回调。 | **错误码:** @@ -4946,50 +5086,68 @@ on(type: 'audioInterrupt', callback: Callback\): void **示例:** ```js -let isPlay; -let started; +let isPlaying; // 标识符,表示是否正在渲染 +let isDucked; // 标识符,表示是否被降低音量 onAudioInterrupt(); async function onAudioInterrupt(){ audioRenderer.on('audioInterrupt', async(interruptEvent) => { if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_FORCE) { + // 由系统进行操作,强制打断音频渲染,应用需更新自身状态及显示内容等 switch (interruptEvent.hintType) { case audio.InterruptHint.INTERRUPT_HINT_PAUSE: - console.info('Force paused. Stop writing'); - isPlay = false; + // 音频流已被暂停,临时失去焦点,待可重获焦点时会收到resume对应的interruptEvent + console.info('Force paused. Update playing status and stop writing'); + isPlaying = false; // 简化处理,代表应用切换至暂停状态的若干操作 break; case audio.InterruptHint.INTERRUPT_HINT_STOP: - console.info('Force stopped. Stop writing'); - isPlay = false; + // 音频流已被停止,永久失去焦点,若想恢复渲染,需用户主动触发 + console.info('Force stopped. Update playing status and stop writing'); + isPlaying = false; // 简化处理,代表应用切换至暂停状态的若干操作 + break; + case audio.InterruptHint.INTERRUPT_HINT_DUCK: + // 音频流已被降低音量渲染 + console.info('Force ducked. Update volume status'); + isDucked = true; // 简化处理,代表应用更新音量状态的若干操作 + break; + case audio.InterruptHint.INTERRUPT_HINT_UNDUCK: + // 音频流已被恢复正常音量渲染 + console.info('Force ducked. Update volume status'); + isDucked = false; // 简化处理,代表应用更新音量状态的若干操作 + break; + default: + console.info('Invalid interruptEvent'); break; } } else if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_SHARE) { + // 由应用进行操作,应用可以自主选择打断或忽略 switch (interruptEvent.hintType) { case audio.InterruptHint.INTERRUPT_HINT_RESUME: + // 建议应用继续渲染(说明音频流此前被强制暂停,临时失去焦点,现在可以恢复渲染) console.info('Resume force paused renderer or ignore'); - await audioRenderer.start().then(async function () { - console.info('AudioInterruptMusic: renderInstant started :SUCCESS '); - started = true; - }).catch((err) => { - console.error(`AudioInterruptMusic: renderInstant start :ERROR : ${err}`); - started = false; - }); - if (started) { - isPlay = true; - console.info(`AudioInterruptMusic Renderer started : isPlay : ${isPlay}`); - } else { - console.error('AudioInterruptMusic Renderer start failed'); - } + // 若选择继续渲染,需在此处主动执行开始渲染的若干操作 break; case audio.InterruptHint.INTERRUPT_HINT_PAUSE: + // 建议应用暂停渲染 console.info('Choose to pause or ignore'); - if (isPlay == true) { - isPlay == false; - console.info('AudioInterruptMusic: Media PAUSE : TRUE'); - } else { - isPlay = true; - console.info('AudioInterruptMusic: Media PLAY : TRUE'); - } + // 若选择暂停渲染,需在此处主动执行暂停渲染的若干操作 + break; + case audio.InterruptHint.INTERRUPT_HINT_STOP: + // 建议应用停止渲染 + console.info('Choose to stop or ignore'); + // 若选择停止渲染,需在此处主动执行停止渲染的若干操作 + break; + case audio.InterruptHint.INTERRUPT_HINT_DUCK: + // 建议应用降低音量渲染 + console.info('Choose to duck or ignore'); + // 若选择降低音量渲染,需在此处主动执行降低音量渲染的若干操作 + break; + case audio.InterruptHint.INTERRUPT_HINT_UNDUCK: + // 建议应用恢复正常音量渲染 + console.info('Choose to unduck or ignore'); + // 若选择恢复正常音量渲染,需在此处主动执行恢复正常音量渲染的若干操作 + break; + default: break; } } @@ -5424,7 +5582,7 @@ release(callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | :------- | :------------------- | :--- | :---------------------------------- | -| callback | AsyncCallback | 是 | Callback used to return the result. | +| callback | AsyncCallback | 是 | 使用callback方式异步返回结果。 | **示例:** @@ -5640,6 +5798,83 @@ audioCapturer.getBufferSize().then((data) => { }); ``` +### on('audioInterrupt')10+ + +on(type: 'audioInterrupt', callback: Callback\): void + +监听音频中断事件。使用callback获取中断事件。 + +与[on('interrupt')](#oninterrupt)一致,均用于监听焦点变化。AudioCapturer对象在start事件发生时会主动获取焦点,在pause、stop等事件发生时会主动释放焦点,不需要开发者主动发起获取焦点或释放焦点的申请。 + +**系统能力:** SystemCapability.Multimedia.Audio.Interrupt + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------------------------------- | ---- | ------------------------------------------------------------ | +| type | string | 是 | 事件回调类型,支持的事件为:'audioInterrupt'(中断事件被触发,音频采集被中断。) | +| callback | Callback\<[InterruptEvent](#interruptevent9)\> | 是 | 被监听的中断事件的回调。 | + +**错误码:** + +以下错误码的详细介绍请参见[音频错误码](../errorcodes/errorcode-audio.md)。 + +| 错误码ID | 错误信息 | +| ------- | --------------------------------------------| +| 6800101 | if input parameter value error | + +**示例:** + +```js +let isCapturing; // 标识符,表示是否正在采集 +onAudioInterrupt(); + +async function onAudioInterrupt(){ + audioCapturer.on('audioInterrupt', async(interruptEvent) => { + if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_FORCE) { + // 由系统进行操作,强制打断音频采集,应用需更新自身状态及显示内容等 + switch (interruptEvent.hintType) { + case audio.InterruptHint.INTERRUPT_HINT_PAUSE: + // 音频流已被暂停,临时失去焦点,待可重获焦点时会收到resume对应的interruptEvent + console.info('Force paused. Update capturing status and stop reading'); + isCapturing = false; // 简化处理,代表应用切换至暂停状态的若干操作 + break; + case audio.InterruptHint.INTERRUPT_HINT_STOP: + // 音频流已被停止,永久失去焦点,若想恢复采集,需用户主动触发 + console.info('Force stopped. Update capturing status and stop reading'); + isCapturing = false; // 简化处理,代表应用切换至暂停状态的若干操作 + break; + default: + console.info('Invalid interruptEvent'); + break; + } + } else if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_SHARE) { + // 由应用进行操作,应用可以自主选择打断或忽略 + switch (interruptEvent.hintType) { + case audio.InterruptHint.INTERRUPT_HINT_RESUME: + // 建议应用继续采集(说明音频流此前被强制暂停,临时失去焦点,现在可以恢复采集) + console.info('Resume force paused renderer or ignore'); + // 若选择继续采集,需在此处主动执行开始采集的若干操作 + break; + case audio.InterruptHint.INTERRUPT_HINT_PAUSE: + // 建议应用暂停采集 + console.info('Choose to pause or ignore'); + // 若选择暂停采集,需在此处主动执行暂停采集的若干操作 + break; + case audio.InterruptHint.INTERRUPT_HINT_STOP: + // 建议应用停止采集 + console.info('Choose to stop or ignore'); + // 若选择停止采集,需在此处主动执行停止采集的若干操作 + break; + default: + break; + } + } + }); +} +``` + + ### on('markReach')8+ on(type: "markReach", frame: number, callback: Callback<number>): void @@ -6079,7 +6314,7 @@ tonePlayer.release().then(() => { 音频打断/获取焦点事件的回调方法。 > **说明:** -> 从 API version 7 开始支持,从 API version 9 开始废弃。 +> 从 API version 7 开始支持,从 API version 9 开始废弃。建议使用[InterruptEvent](#interruptevent9)替代。 **系统能力:** SystemCapability.Multimedia.Audio.Renderer diff --git a/zh-cn/application-dev/reference/apis/js-apis-avsession.md b/zh-cn/application-dev/reference/apis/js-apis-avsession.md index 552b10b89e557e4c0152281a125f38c062638310..e479203da8df13119334a1dd8f01f27f10a276c5 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-avsession.md +++ b/zh-cn/application-dev/reference/apis/js-apis-avsession.md @@ -26,6 +26,8 @@ createAVSession(context: Context, tag: string, type: AVSessionType): Promise\ | 是 | 回调函数。回调返回会话实例对象,可用于获取会话ID,以及设置元数据、播放状态,发送按键事件等操作。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -128,7 +132,7 @@ getAllSessionDescriptors(): Promise\>> | Promise\\>\> | Promise对象。返回所有会话描述的只读对象。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -155,7 +159,7 @@ getAllSessionDescriptors(callback: AsyncCallback\\>\> | 是 | 回调函数。返回所有会话描述的只读对象。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -191,6 +195,99 @@ avSession.getAllSessionDescriptors(function (err, descriptors) { }); ``` +## avSession.getHistoricalSessionDescriptors10+ + +getHistoricalSessionDescriptors(maxSize?: number): Promise\>> + +获取所有会话的相关描述。结果通过Promise异步回调方式返回。 + +**需要权限:** ohos.permission.MANAGE_MEDIA_RESOURCES + +**系统能力:** SystemCapability.Multimedia.AVSession.Manager + +**系统接口:** 该接口为系统接口。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | -----------------------------------------------------------------| +| maxSize | number | 否 | 指定获取描述符数量的最大值,可选范围是0-10,不填则取默认值,默认值为3。| + +**返回值:** + +| 类型 | 说明 | +| --------------------------------------------------------------------------- | -------------------------------------- | +| Promise\\>\> | Promise对象。返回所有会话描述的只读对象。 | + +**错误码:** +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 6600101 | Session service exception. | + +**示例:** + +```js +avSession.getHistoricalSessionDescriptors().then((descriptors) => { + console.info(`getHistoricalSessionDescriptors : SUCCESS : descriptors.length : ${descriptors.length}`); + if(descriptors.length > 0 ){ + console.info(`getHistoricalSessionDescriptors : SUCCESS : descriptors[0].isActive : ${descriptors[0].isActive}`); + console.info(`getHistoricalSessionDescriptors : SUCCESS : descriptors[0].type : ${descriptors[0].type}`); + console.info(`getHistoricalSessionDescriptors : SUCCESS : descriptors[0].sessionTag : ${descriptors[0].sessionTag}`); + console.info(`getHistoricalSessionDescriptors : SUCCESS : descriptors[0].sessionId : ${descriptors[0].sessionId}`); + console.info(`getHistoricalSessionDescriptors : SUCCESS : descriptors[0].elementName.bundleName : ${descriptors[0].elementName.bundleName}`); + } +}).catch((err) => { + console.info(`getHistoricalSessionDescriptors BusinessError: code: ${err.code}, message: ${err.message}`); +}); +``` + +## avSession.getHistoricalSessionDescriptors10+ + +getHistoricalSessionDescriptors(maxSize: number, callback: AsyncCallback\>>): void + +获取所有会话的相关描述。结果通过callback异步回调方式返回。 + +**需要权限:** ohos.permission.MANAGE_MEDIA_RESOURCES。 + +**系统能力:** SystemCapability.Multimedia.AVSession.Manager + +**系统接口:** 该接口为系统接口。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------------------------ | ---- | -----------------------------------------------------------------| +| maxSize | number | 是 | 指定获取描述符数量的最大值,可选范围是0-10,不填则取默认值,默认值为3。| +| callback | AsyncCallback\>\> | 是 | 回调函数。返回所有会话描述的只读对象。 | + +**错误码:** +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 6600101 |Session service exception. | + +**示例:** + +```js +avSession.getHistoricalSessionDescriptors(1, function (err, descriptors) { + if (err) { + console.info(`getHistoricalSessionDescriptors BusinessError: code: ${err.code}, message: ${err.message}`); + } else { + console.info(`getHistoricalSessionDescriptors : SUCCESS : descriptors.length : ${descriptors.length}`); + if(descriptors.length > 0 ){ + console.info(`getHistoricalSessionDescriptors : SUCCESS : descriptors[0].isActive : ${descriptors[0].isActive}`); + console.info(`getHistoricalSessionDescriptors : SUCCESS : descriptors[0].type : ${descriptors[0].type}`); + console.info(`getHistoricalSessionDescriptors : SUCCESS : descriptors[0].sessionTag : ${descriptors[0].sessionTag}`); + console.info(`getHistoricalSessionDescriptors : SUCCESS : descriptors[0].sessionId : ${descriptors[0].sessionId}`); + console.info(`getHistoricalSessionDescriptors : SUCCESS : descriptors[0].elementName.bundleName : ${descriptors[0].elementName.bundleName}`); + } + } +}); +``` + ## avSession.createController createController(sessionId: string): Promise\ @@ -216,7 +313,7 @@ createController(sessionId: string): Promise\ | Promise<[AVSessionController](#avsessioncontroller)\> | Promise对象。返回会话控制器实例,可查看会话ID,
并完成对会话发送命令及事件,获取元数据、播放状态信息等操作。| **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -268,7 +365,7 @@ createController(sessionId: string, callback: AsyncCallback\ | 是 | 回调函数。返回会话控制器实例,可查看会话ID,
并完成对会话发送命令及事件,获取元数据、播放状态信息等操作。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -330,7 +427,7 @@ castAudio(session: SessionToken | 'all', audioDevices: Array | Promise对象。当投播成功,无返回结果,否则返回错误对象。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -344,8 +441,9 @@ castAudio(session: SessionToken | 'all', audioDevices: Array { +await audioRoutingManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data) => { audioDevices = data; console.info('Promise returned to indicate that the device list is obtained.'); }).catch((err) => { @@ -382,7 +480,7 @@ castAudio(session: SessionToken | 'all', audioDevices: Array | 是 | 回调函数。当投播成功,err为undefined,否则返回错误对象。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -396,8 +494,9 @@ castAudio(session: SessionToken | 'all', audioDevices: Array { +await audioRoutingManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data) => { audioDevices = data; console.info('Promise returned to indicate that the device list is obtained.'); }).catch((err) => { @@ -433,7 +532,7 @@ on(type: 'sessionCreate' | 'sessionDestroy' | 'topSessionChange', callback: (ses | callback | (session: [AVSessionDescriptor](#avsessiondescriptor)) => void | 是 | 回调函数。参数为会话相关描述。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -481,7 +580,7 @@ off(type: 'sessionCreate' | 'sessionDestroy' | 'topSessionChange', callback?: (s | callback | (session: [AVSessionDescriptor](#avsessiondescriptor)) => void | 否 | 回调函数。当监听事件取消成功,err为undefined,否则返回错误对象。
该参数为会话相关描述,为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -503,6 +602,8 @@ on(type: 'sessionServiceDie', callback: () => void): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -511,7 +612,7 @@ on(type: 'sessionServiceDie', callback: () => void): void | callback | callback: () => void | 是 | 回调函数。当监听事件注册成功,err为undefined,否则返回错误对象。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -533,6 +634,8 @@ off(type: 'sessionServiceDie', callback?: () => void): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -541,7 +644,7 @@ off(type: 'sessionServiceDie', callback?: () => void): void | callback | callback: () => void | 否 | 回调函数。当监听事件取消成功,err为undefined,否则返回错误对象。
该参数为可选参数,若不填写该参数,则认为取消所有相关会话的服务死亡监听。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -578,7 +681,7 @@ sendSystemAVKeyEvent(event: KeyEvent): Promise\ | Promise | Promise对象。当事件发送成功,无返回结果,否则返回错误对象。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -620,7 +723,7 @@ sendSystemAVKeyEvent(event: KeyEvent, callback: AsyncCallback\): void | callback | AsyncCallback | 是 | 回调函数。当事件发送成功,err为undefined,否则返回错误对象。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -667,7 +770,7 @@ sendSystemControlCommand(command: AVControlCommand): Promise\ | Promise | Promise对象。当命令发送成功,无返回结果,否则返回错误对象。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -721,7 +824,7 @@ sendSystemControlCommand(command: AVControlCommand, callback: AsyncCallback\ | 是 | 回调函数。当命令发送成功,err为undefined,否则返回错误对象。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -765,6 +868,8 @@ avSession.sendSystemControlCommand(avcommand, function (err) { **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + | 名称 | 类型 | 可读 | 可写 | 说明 | | :-------- | :----- | :--- | :--- | :---------------------------- | @@ -784,6 +889,8 @@ setAVMetadata(data: AVMetadata): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -797,7 +904,7 @@ setAVMetadata(data: AVMetadata): Promise\ | Promise | Promise对象。当元数据设置成功,无返回结果,否则返回错误对象。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -838,6 +945,8 @@ setAVMetadata(data: AVMetadata, callback: AsyncCallback\): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -846,7 +955,7 @@ setAVMetadata(data: AVMetadata, callback: AsyncCallback\): void | callback | AsyncCallback | 是 | 回调函数。当元数据设置成功,err为undefined,否则返回错误对象。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -889,6 +998,8 @@ setAVPlaybackState(state: AVPlaybackState): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -902,7 +1013,7 @@ setAVPlaybackState(state: AVPlaybackState): Promise\ | Promise | Promise对象。当播放状态设置成功,无返回结果,否则返回错误对象。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -935,6 +1046,8 @@ setAVPlaybackState(state: AVPlaybackState, callback: AsyncCallback\): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -943,7 +1056,7 @@ setAVPlaybackState(state: AVPlaybackState, callback: AsyncCallback\): void | callback | AsyncCallback | 是 | 回调函数。当播放状态设置成功,err为undefined,否则返回错误对象。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -970,6 +1083,216 @@ session.setAVPlaybackState(PlaybackState, function (err) { }); ``` +### setAVQueueItems10+ + +setAVQueueItems(items: Array\): Promise + +设置媒体播放列表。结果通过Promise异步回调方式返回。 + +**系统能力:** SystemCapability.Multimedia.AVSession.Core + +**系统接口:** 该接口为系统接口 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------------------------------------ | ---- | ---------------------------------- | +| items | Array<[AVQueueItem](#avqueueitem10)\> | 是 | 播放列表单项的队列,用以表示播放列表。 | + +**返回值:** + +| 类型 | 说明 | +| -------------- | ----------------------------- | +| Promise | Promise对象。当播放列表设置成功,无返回结果,否则返回错误对象。 | + +**错误码:** +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 6600101 | Session service exception. | +| 6600102 | The session does not exist. | + +**示例:** + +```js +let queueItemDescription_1 = { + mediaId: '001', + title: 'music_name', + subtitle: 'music_sub_name', + description: 'music_description', + icon: PIXELMAP_OBJECT, + iconUri: 'http://www.icon.uri.com', + extras: {'extras':'any'} +}; +let queueItem_1 = { + itemId: 1, + description: queueItemDescription_1 +}; +let queueItemDescription_2 = { + mediaId: '002', + title: 'music_name', + subtitle: 'music_sub_name', + description: 'music_description', + icon: PIXELMAP_OBJECT, + iconUri: 'http://www.icon.uri.com', + extras: {'extras':'any'} +}; +let queueItem_2 = { + itemId: 2, + description: queueItemDescription_2 +}; +let queueItemsArray = [queueItem_1, queueItem_2]; +session.setAVQueueItems(queueItemsArray).then(() => { + console.info('SetAVQueueItems successfully'); +}).catch((err) => { + console.info(`SetAVQueueItems BusinessError: code: ${err.code}, message: ${err.message}`); +}); +``` + +### setAVQueueItems10+ + +setAVQueueItems(items: Array\, callback: AsyncCallback): void + +设置媒体播放列表。结果通过callback异步回调方式返回。 + +**系统能力:** SystemCapability.Multimedia.AVSession.Core + +**系统接口:** 该接口为系统接口 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------ | ---- | ----------------------------------------------------------- | +| items | Array<[AVQueueItem](#avqueueitem10)\> | 是 | 播放列表单项的队列,用以表示播放列表。 | +| callback | AsyncCallback | 是 | 回调函数。当播放状态设置成功,err为undefined,否则返回错误对象。 | + +**错误码:** +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 6600101 | Session service exception. | +| 6600102 | The session does not exist. | + +**示例:** + +```js +let queueItemDescription_1 = { + mediaId: '001', + title: 'music_name', + subtitle: 'music_sub_name', + description: 'music_description', + icon: PIXELMAP_OBJECT, + iconUri: 'http://www.icon.uri.com', + extras: {'extras':'any'} +}; +let queueItem_1 = { + itemId: 1, + description: queueItemDescription_1 +}; +let queueItemDescription_2 = { + mediaId: '002', + title: 'music_name', + subtitle: 'music_sub_name', + description: 'music_description', + icon: PIXELMAP_OBJECT, + iconUri: 'http://www.icon.uri.com', + extras: {'extras':'any'} +}; +let queueItem_2 = { + itemId: 2, + description: queueItemDescription_2 +}; +let queueItemsArray = [queueItem_1, queueItem_2]; +session.setAVQueueItems(queueItemsArray, function (err) { + if (err) { + console.info(`SetAVQueueItems BusinessError: code: ${err.code}, message: ${err.message}`); + } else { + console.info('SetAVQueueItems successfully'); + } +}); +``` + +### setAVQueueTitle10+ + +setAVQueueTitle(title: string): Promise\ + +设置媒体播放列表名称。结果通过Promise异步回调方式返回。 + +**系统能力:** SystemCapability.Multimedia.AVSession.Core + +**系统接口:** 该接口为系统接口 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------- | +| title | string | 是 | 播放列表的名称。 | + +**返回值:** + +| 类型 | 说明 | +| -------------- | ----------------------------- | +| Promise | Promise对象。当播放列表设置成功,无返回结果,否则返回错误对象。 | + +**错误码:** +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 6600101 | Session service exception. | +| 6600102 | The session does not exist. | + +**示例:** + +```js +let queueTitle = 'QUEUE_TITLE'; +session.setAVQueueTitle(queueTitle).then(() => { + console.info('SetAVQueueTitle successfully'); +}).catch((err) => { + console.info(`SetAVQueueTitle BusinessError: code: ${err.code}, message: ${err.message}`); +}); +``` + +### setAVQueueTitle10+ + +setAVQueueTitle(title: string, callback: AsyncCallback\): void + +设置媒体播放列表名称。结果通过callback异步回调方式返回。 + +**系统能力:** SystemCapability.Multimedia.AVSession.Core + +**系统接口:** 该接口为系统接口 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------- | ---- | ----------------------------------------------------------- | +| title | string | 是 | 播放列表名称字段。 | +| callback | AsyncCallback | 是 | 回调函数。当播放状态设置成功,err为undefined,否则返回错误对象。 | + +**错误码:** +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 6600101 | Session service exception. | +| 6600102 | The session does not exist. | + +**示例:** + +```js +let queueTitle = 'QUEUE_TITLE'; +session.setAVQueueTitle(queueTitle, function (err) { + if (err) { + console.info(`SetAVQueueTitle BusinessError: code: ${err.code}, message: ${err.message}`); + } else { + console.info('SetAVQueueTitle successfully'); + } +}); +``` + ### setLaunchAbility setLaunchAbility(ability: WantAgent): Promise\ @@ -978,6 +1301,8 @@ setLaunchAbility(ability: WantAgent): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -991,7 +1316,7 @@ setLaunchAbility(ability: WantAgent): Promise\ | Promise | Promise对象。当Ability设置成功,无返回结果,否则返回错误对象。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -1048,6 +1373,8 @@ setLaunchAbility(ability: WantAgent, callback: AsyncCallback\): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1056,7 +1383,7 @@ setLaunchAbility(ability: WantAgent, callback: AsyncCallback\): void | callback | AsyncCallback | 是 | 回调函数。当Ability设置成功,err为undefined,否则返回错误对象。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -1107,9 +1434,9 @@ wantAgent.getWantAgent(wantAgentInfo).then((agent) => { }); ``` -### setSessionEvent10+ +### dispatchSessionEvent10+ -setSessionEvent(event: string, args: {[key: string]: any}): Promise\ +dispatchSessionEvent(event: string, args: {[key: string]: Object}): Promise\ 媒体提供方设置一个会话内自定义事件,包括事件名和键值对形式的事件内容, 结果通过Promise异步回调方式返回。 @@ -1131,7 +1458,7 @@ setSessionEvent(event: string, args: {[key: string]: any}): Promise\ | Promise | Promise对象。当事件设置成功,无返回结果,否则返回错误对象。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -1145,14 +1472,14 @@ let eventName = "dynamic_lyric"; let args = { lyric : "This is lyric" } -await session.setSessionEvent(eventName, args).catch((err) => { - console.info(`SetSessionEvent BusinessError: code: ${err.code}, message: ${err.message}`); +await session.dispatchSessionEvent(eventName, args).catch((err) => { + console.info(`dispatchSessionEvent BusinessError: code: ${err.code}, message: ${err.message}`); }) ``` -### setSessionEvent10+ +### dispatchSessionEvent10+ -setSessionEvent(event: string, args: {[key: string]: any}, callback: AsyncCallback): void +dispatchSessionEvent(event: string, args: {[key: string]: Object}, callback: AsyncCallback): void 媒体提供方设置一个会话内自定义事件,包括事件名和键值对形式的事件内容, 结果通过callback异步回调方式返回。 @@ -1169,7 +1496,7 @@ setSessionEvent(event: string, args: {[key: string]: any}, callback: AsyncCallba | callback | AsyncCallback | 是 | 回调函数。当会话事件设置成功,err为undefined,否则返回错误对象。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -1183,9 +1510,9 @@ let eventName = "dynamic_lyric"; let args = { lyric : "This is lyric" } -await session.setSessionEvent(eventName, args, (err) => { +await session.dispatchSessionEvent(eventName, args, (err) => { if(err) { - console.info(`SetSessionEvent BusinessError: code: ${err.code}, message: ${err.message}`); + console.info(`dispatchSessionEvent BusinessError: code: ${err.code}, message: ${err.message}`); } }) ``` @@ -1198,6 +1525,8 @@ getController(): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **返回值:** | 类型 | 说明 | @@ -1205,7 +1534,7 @@ getController(): Promise\ | Promise<[AVSessionController](#avsessioncontroller)> | Promise对象。返回会话控制器。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -1232,6 +1561,8 @@ getController(callback: AsyncCallback\): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1239,7 +1570,7 @@ getController(callback: AsyncCallback\): void | callback | AsyncCallback<[AVSessionController](#avsessioncontroller)\> | 是 | 回调函数。返回会话控制器。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -1268,6 +1599,8 @@ getOutputDevice(): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **返回值:** | 类型 | 说明 | @@ -1275,7 +1608,7 @@ getOutputDevice(): Promise\ | Promise<[OutputDeviceInfo](#outputdeviceinfo)> | Promise对象。返回播放设备信息。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -1300,6 +1633,8 @@ getOutputDevice(callback: AsyncCallback\): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1307,7 +1642,7 @@ getOutputDevice(callback: AsyncCallback\): void | callback | AsyncCallback<[OutputDeviceInfo](#outputdeviceinfo)\> | 是 | 回调函数,返回播放设备信息。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -1334,6 +1669,8 @@ activate(): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **返回值:** | 类型 | 说明 | @@ -1341,7 +1678,7 @@ activate(): Promise\ | Promise | Promise对象。当会话激活成功,无返回结果,否则返回错误对象。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -1366,6 +1703,8 @@ activate(callback: AsyncCallback\): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1373,7 +1712,7 @@ activate(callback: AsyncCallback\): void | callback | AsyncCallback | 是 | 回调函数。当会话激活成功,err为undefined,否则返回错误对象。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -1400,6 +1739,8 @@ deactivate(): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **返回值:** | 类型 | 说明 | @@ -1407,7 +1748,7 @@ deactivate(): Promise\ | Promise | Promise对象。当禁用会话成功,无返回结果,否则返回错误对象。| **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -1434,6 +1775,8 @@ deactivate(callback: AsyncCallback\): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1441,7 +1784,7 @@ deactivate(callback: AsyncCallback\): void | callback | AsyncCallback | 是 | 回调函数。当禁用会话成功,err为undefined,否则返回错误对象。| **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -1468,6 +1811,8 @@ destroy(): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **返回值:** | 类型 | 说明 | @@ -1475,7 +1820,7 @@ destroy(): Promise\ | Promise | Promise对象。当会话销毁成功,无返回结果,否则返回错误对象。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -1498,9 +1843,10 @@ destroy(callback: AsyncCallback\): void 销毁当前会话,使当前会话完全失效。结果通过callback异步回调方式返回。 - **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1508,7 +1854,7 @@ destroy(callback: AsyncCallback\): void | callback | AsyncCallback | 是 | 回调函数。当会话销毁成功,err为undefined,否则返回错误对象。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -1535,6 +1881,8 @@ on(type: 'play'|'pause'|'stop'|'playNext'|'playPrevious'|'fastForward'|'rewind', **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1543,7 +1891,7 @@ on(type: 'play'|'pause'|'stop'|'playNext'|'playPrevious'|'fastForward'|'rewind', | callback | callback: () => void | 是 | 回调函数。当监听事件注册成功,err为undefined,否则为错误对象。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -1584,6 +1932,8 @@ on(type: 'seek', callback: (time: number) => void): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1592,7 +1942,7 @@ on(type: 'seek', callback: (time: number) => void): void | callback | (time: number) => void | 是 | 回调函数。参数time是时间节点,单位为毫秒。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -1615,6 +1965,8 @@ on(type: 'setSpeed', callback: (speed: number) => void): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1623,7 +1975,7 @@ on(type: 'setSpeed', callback: (speed: number) => void): void | callback | (speed: number) => void | 是 | 回调函数。参数speed是播放倍速。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -1646,6 +1998,8 @@ on(type: 'setLoopMode', callback: (mode: LoopMode) => void): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1654,7 +2008,7 @@ on(type: 'setLoopMode', callback: (mode: LoopMode) => void): void | callback | (mode: [LoopMode](#loopmode)) => void | 是 | 回调函数。参数mode是循环模式。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -1677,6 +2031,8 @@ on(type: 'toggleFavorite', callback: (assetId: string) => void): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1685,7 +2041,7 @@ on(type: 'toggleFavorite', callback: (assetId: string) => void): void | callback | (assetId: string) => void | 是 | 回调函数。参数assetId是媒体ID。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -1700,23 +2056,25 @@ session.on('toggleFavorite', (assetId) => { }); ``` -### on('handleKeyEvent') +### on('skipToQueueItem')10+ -on(type: 'handleKeyEvent', callback: (event: KeyEvent) => void): void +on(type: 'skipToQueueItem', callback: (itemId: number) => void): void -设置按键事件的监听 +设置播放列表其中某项被选中的监听事件,session端可以选择对这个单项歌曲进行播放。 **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | 是 | 事件回调类型,支持事件`'handleKeyEvent'`:当按键事件被发送到会话时,触发该事件。 | -| callback | (event: [KeyEvent](js-apis-keyevent.md)) => void | 是 | 回调函数。参数event是按键事件。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------ | ---- | ---------------------------------------------------------------------------------------- | +| type | string | 是 | 事件回调类型,支持事件`'skipToQueueItem'`:当播放列表选中单项的命令被发送到会话时,触发该事件。 | +| callback | (itemId: number) => void | 是 | 回调函数。参数itemId是选中的播放列表项的ID。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -1726,28 +2084,63 @@ on(type: 'handleKeyEvent', callback: (event: KeyEvent) => void): void **示例:** ```js -session.on('handleKeyEvent', (event) => { - console.info(`on handleKeyEvent event : ${event}`); +session.on('skipToQueueItem', (itemId) => { + console.info(`on skipToQueueItem id : ${itemId}`); }); ``` -### on('outputDeviceChange') +### on('handleKeyEvent') -on(type: 'outputDeviceChange', callback: (device: OutputDeviceInfo) => void): void +on(type: 'handleKeyEvent', callback: (event: KeyEvent) => void): void -设置播放设备变化的监听事件。 +设置按键事件的监听 **系统能力:** SystemCapability.Multimedia.AVSession.Core -**参数:** +**系统接口:** 该接口为系统接口 -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------------ | -| type | string | 是 | 事件回调类型,支持事件`'outputDeviceChange'`:当播放设备变化时,触发该事件。 | -| callback | (device: [OutputDeviceInfo](#outputdeviceinfo)) => void | 是 | 回调函数。参数device是设备相关信息。 | +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| type | string | 是 | 事件回调类型,支持事件`'handleKeyEvent'`:当按键事件被发送到会话时,触发该事件。 | +| callback | (event: [KeyEvent](js-apis-keyevent.md)) => void | 是 | 回调函数。参数event是按键事件。 | + +**错误码:** +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 6600101 | Session service exception. | +| 6600102 | The session does not exist. | + +**示例:** + +```js +session.on('handleKeyEvent', (event) => { + console.info(`on handleKeyEvent event : ${event}`); +}); +``` + +### on('outputDeviceChange') + +on(type: 'outputDeviceChange', callback: (device: OutputDeviceInfo) => void): void + +设置播放设备变化的监听事件。 + +**系统能力:** SystemCapability.Multimedia.AVSession.Core + +**系统接口:** 该接口为系统接口 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------------ | +| type | string | 是 | 事件回调类型,支持事件`'outputDeviceChange'`:当播放设备变化时,触发该事件。 | +| callback | (device: [OutputDeviceInfo](#outputdeviceinfo)) => void | 是 | 回调函数。参数device是设备相关信息。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -1762,6 +2155,39 @@ session.on('outputDeviceChange', (device) => { }); ``` +### on('commonCommand')10+ + +on(type: 'commonCommand', callback: (command: string, args: {[key: string]: Object}) => void): void + +设置自定义控制命令变化的监听器。 + +**系统能力:** SystemCapability.Multimedia.AVSession.Core + +**系统接口:** 该接口为系统接口 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| type | string | 是 | 事件回调类型,支持事件`'commonCommand'`:当自定义控制命令变化时,触发该事件。 | +| callback | (commonCommand: string, args: {[key:string]: Object}) => void | 是 | 回调函数,commonCommand为变化的自定义控制命令名,args为自定义控制命令的参数。 | + +**错误码:** +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 + +| 错误码ID | 错误信息 | +| -------- | ------------------------------ | +| 6600101 | Session service exception. | +| 6600103 | The session controller does not exist. | + +**示例:** + +```js +session.on('commonCommand', (commonCommand, args) => { + console.info(`OnCommonCommand, the command is ${commonCommand}, args: ${JSON.stringify(args)}`); +}); +``` + ### off('play'|'pause'|'stop'|'playNext'|'playPrevious'|'fastForward'|'rewind') off(type: 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward' | 'rewind', callback?: () => void): void @@ -1770,6 +2196,8 @@ off(type: 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1778,7 +2206,7 @@ off(type: 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward | callback | callback: () => void | 否 | 回调函数。当监听事件取消成功,err为undefined,否则返回错误对象。
该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -1805,6 +2233,8 @@ off(type: 'seek', callback?: (time: number) => void): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1813,7 +2243,7 @@ off(type: 'seek', callback?: (time: number) => void): void | callback | (time: number) => void | 否 | 回调函数,参数time是时间节点,单位为毫秒。
当监听事件取消成功,err为undefined,否则返回错误对象。
该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -1834,6 +2264,8 @@ off(type: 'setSpeed', callback?: (speed: number) => void): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1842,7 +2274,7 @@ off(type: 'setSpeed', callback?: (speed: number) => void): void | callback | (speed: number) => void | 否 | 回调函数,参数speed是播放倍速。
当监听事件取消成功,err为undefined,否则返回错误对象。
该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -1863,6 +2295,8 @@ off(type: 'setLoopMode', callback?: (mode: LoopMode) => void): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1871,7 +2305,7 @@ off(type: 'setLoopMode', callback?: (mode: LoopMode) => void): void | callback | (mode: [LoopMode](#loopmode)) => void | 否 | 回调函数,参数mode是循环模式。
当监听事件取消成功,err为undefined,否则返回错误对象。
该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -1892,6 +2326,8 @@ off(type: 'toggleFavorite', callback?: (assetId: string) => void): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1900,7 +2336,7 @@ off(type: 'toggleFavorite', callback?: (assetId: string) => void): void | callback | (assetId: string) => void | 否 | 回调函数,参数assetId是媒体ID。
当监听事件取消成功,err为undefined,否则返回错误对象。
该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -1913,6 +2349,37 @@ off(type: 'toggleFavorite', callback?: (assetId: string) => void): void session.off('toggleFavorite'); ``` +### off('skipToQueueItem')10+ + +off(type: 'skipToQueueItem', callback?: (itemId: number) => void): void + +取消监听播放列表单项选中的事件 + +**系统能力:** SystemCapability.Multimedia.AVSession.Core + +**系统接口:** 该接口为系统接口 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------ | ---- | ----------------------------------------------------------------------------------------------------------------------------------------------------------- | +| type | string | 是 | 关闭对应的监听事件,支持关闭事件`'skipToQueueItem'`。 | +| callback | (itemId: number) => void | 否 | 回调函数,参数itemId是播放列表单项ID。
当监听事件取消成功,err为undefined,否则返回错误对象。
该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 | + +**错误码:** +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 6600101 | Session service exception. | +| 6600102 | The session does not exist. | + +**示例:** + +```js +session.off('skipToQueueItem'); +``` + ### off('handleKeyEvent') off(type: 'handleKeyEvent', callback?: (event: KeyEvent) => void): void @@ -1921,6 +2388,8 @@ off(type: 'handleKeyEvent', callback?: (event: KeyEvent) => void): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1929,7 +2398,7 @@ off(type: 'handleKeyEvent', callback?: (event: KeyEvent) => void): void | callback | (event: [KeyEvent](js-apis-keyevent.md)) => void | 否 | 回调函数,参数event是按键事件。
当监听事件取消成功,err为undefined,否则返回错误对象。
该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -1950,6 +2419,8 @@ off(type: 'outputDeviceChange', callback?: (device: OutputDeviceInfo) => void): **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -1958,7 +2429,7 @@ off(type: 'outputDeviceChange', callback?: (device: OutputDeviceInfo) => void): | callback | (device: [OutputDeviceInfo](#outputdeviceinfo)) => void | 否 | 回调函数,参数device是设备相关信息。
当监听事件取消成功,err为undefined,否则返回错误对象。
该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -1972,6 +2443,37 @@ session.off('outputDeviceChange'); ``` +### off('commonCommand')10+ + +off(type: 'commonCommand', callback?: (commonCommand: string, args: {[key:string]: Object}) => void): void + +取消监听自定义控制命令的变化。 + +**系统能力:** SystemCapability.Multimedia.AVSession.Core + +**系统接口:** 该接口为系统接口 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------- | +| type | string | 是 | 取消对应的监听事件,支持事件`'commonCommand'`。 | +| callback | (commonCommand: string, args: {[key:string]: Object}) => void | 否 | 回调函数,参数commonCommand是变化的自定义控制命令名,args为自定义控制命令的参数。
该参数为可选参数,若不填写该参数,则认为取消所有对commonCommand事件的监听。 | + +**错误码:** +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------- | +| 6600101 | Session service exception. | + +**示例:** + +```js +session.off('commonCommand'); +``` + + ## AVSessionController @@ -2005,6 +2507,8 @@ getAVPlaybackState(): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **返回值:** | 类型 | 说明 | @@ -2012,7 +2516,7 @@ getAVPlaybackState(): Promise\ | Promise<[AVPlaybackState](#avplaybackstate)\> | Promise对象。返回播放状态对象。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -2031,34 +2535,255 @@ controller.getAVPlaybackState().then((playbackState) => { ### getAVPlaybackState -getAVPlaybackState(callback: AsyncCallback\): void +getAVPlaybackState(callback: AsyncCallback\): void + +获取当前播放状态相关信息。结果通过callback异步回调方式返回。 + +**系统能力:** SystemCapability.Multimedia.AVSession.Core + +**系统接口:** 该接口为系统接口 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------------------- | ---- | ---------------------------- | +| callback | AsyncCallback<[AVPlaybackState](#avplaybackstate)\> | 是 | 回调函数,返回当前播放状态对象。 | + +**错误码:** +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 6600101 | Session service exception. | +| 6600102 | The session does not exist. | +| 6600103 | The session controller does not exist. | + +**示例:** +```js +controller.getAVPlaybackState(function (err, playbackState) { + if (err) { + console.info(`GetAVPlaybackState BusinessError: code: ${err.code}, message: ${err.message}`); + } else { + console.info(`GetAVPlaybackState : SUCCESS : state : ${playbackState.state}`); + } +}); +``` + +### getAVQueueItems10+ + +getAVQueueItems(): Promise\> + +获取当前会话播放列表相关信息。结果通过Promise异步回调方式返回。 + +**系统能力:** SystemCapability.Multimedia.AVSession.Core + +**系统接口:** 该接口为系统接口 + +**返回值:** + +| 类型 | 说明 | +| --------------------------------------------- | ----------------------------- | +| Promise\> | Promise对象。返回播放列表队列。 | + +**错误码:** +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 6600101 | Session service exception. | +| 6600102 | The session does not exist. | +| 6600103 | The session controller does not exist. | + +**示例:** +```js +controller.getAVQueueItems().then((items) => { + console.info(`GetAVQueueItems : SUCCESS : length : ${items.length}`); +}).catch((err) => { + console.info(`GetAVQueueItems BusinessError: code: ${err.code}, message: ${err.message}`); +}); +``` + +### getAVQueueItems10+ + +getAVQueueItems(callback: AsyncCallback\>): void + +获取当前播放列表相关信息。结果通过callback异步回调方式返回。 + +**系统能力:** SystemCapability.Multimedia.AVSession.Core + +**系统接口:** 该接口为系统接口 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------------------- | ---- | ------------------------- | +| callback | AsyncCallback\> | 是 | 回调函数,返回播放列表队列。 | + +**错误码:** +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 6600101 | Session service exception. | +| 6600102 | The session does not exist. | +| 6600103 | The session controller does not exist. | + +**示例:** +```js +controller.getAVQueueItems(function (err, items) { + if (err) { + console.info(`GetAVQueueItems BusinessError: code: ${err.code}, message: ${err.message}`); + } else { + console.info(`GetAVQueueItems : SUCCESS : length : ${items.length}`); + } +}); +``` + +### getAVQueueTitle10+ + +getAVQueueTitle(): Promise\ + +获取当前会话播放列表的名称。结果通过Promise异步回调方式返回。 + +**系统能力:** SystemCapability.Multimedia.AVSession.Core + +**系统接口:** 该接口为系统接口 + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ----------------------------- | +| Promise | Promise对象。返回播放列表名称。 | + +**错误码:** +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 6600101 | Session service exception. | +| 6600102 | The session does not exist. | +| 6600103 | The session controller does not exist. | + +**示例:** +```js +controller.getAVQueueTitle().then((title) => { + console.info(`GetAVQueueTitle : SUCCESS : title : ${title}`); +}).catch((err) => { + console.info(`GetAVQueueTitle BusinessError: code: ${err.code}, message: ${err.message}`); +}); +``` + +### getAVQueueTitle10+ + +getAVQueueTitle(callback: AsyncCallback\): void + +获取当前播放列表的名称。结果通过callback异步回调方式返回。 + +**系统能力:** SystemCapability.Multimedia.AVSession.Core + +**系统接口:** 该接口为系统接口 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | ------------------------- | +| callback | AsyncCallback | 是 | 回调函数,返回播放列表名称。 | + +**错误码:** +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 6600101 | Session service exception. | +| 6600102 | The session does not exist. | +| 6600103 | The session controller does not exist. | + +**示例:** +```js +controller.getAVQueueTitle(function (err, title) { + if (err) { + console.info(`GetAVQueueTitle BusinessError: code: ${err.code}, message: ${err.message}`); + } else { + console.info(`GetAVQueueTitle : SUCCESS : title : ${title}`); + } +}); +``` + +### skipToQueueItem10+ + +skipToQueueItem(itemId: number): Promise\ + +设置指定播放列表单项的ID,发送给session端处理,session端可以选择对这个单项歌曲进行播放。结果通过Promise异步回调方式返回。 + +**系统能力:** SystemCapability.Multimedia.AVSession.Core + +**系统接口:** 该接口为系统接口 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------- | ---- | ------------------------------------------- | +| itemId | number | 是 | 播放列表单项的ID值,用以表示选中的播放列表单项。 | + +**返回值:** + +| 类型 | 说明 | +| -------------- | --------------------------------------------------------------- | +| Promise | Promise对象。当播放列表单项ID设置成功,无返回结果,否则返回错误对象。 | + +**错误码:** +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 6600101 | Session service exception. | +| 6600102 | The session does not exist. | + +**示例:** + +```js +let queueItemId = 0; +controller.skipToQueueItem(queueItemId).then(() => { + console.info('SkipToQueueItem successfully'); +}).catch((err) => { + console.info(`SkipToQueueItem BusinessError: code: ${err.code}, message: ${err.message}`); +}); +``` + +### skipToQueueItem10+ + +skipToQueueItem(itemId: number, callback: AsyncCallback\): void -获取当前播放状态相关信息。结果通过callback异步回调方式返回。 +设置指定播放列表单项的ID,发送给session端处理,session端可以选择对这个单项歌曲进行播放。结果通过callback异步回调方式返回。 **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | --------------------------------------------------- | ---- | ---------------------------- | -| callback | AsyncCallback<[AVPlaybackState](#avplaybackstate)\> | 是 | 回调函数,返回当前播放状态对象。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------- | ---- | ----------------------------------------------------------- | +| itemId | number | 是 | 播放列表单项的ID值,用以表示选中的播放列表单项。 | +| callback | AsyncCallback | 是 | 回调函数。当播放状态设置成功,err为undefined,否则返回错误对象。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 6600101 | Session service exception. | | 6600102 | The session does not exist. | -| 6600103 | The session controller does not exist. | **示例:** + ```js -controller.getAVPlaybackState(function (err, playbackState) { +let queueItemId = 0; +controller.skipToQueueItem(queueItemId, function (err) { if (err) { - console.info(`GetAVPlaybackState BusinessError: code: ${err.code}, message: ${err.message}`); + console.info(`SkipToQueueItem BusinessError: code: ${err.code}, message: ${err.message}`); } else { - console.info(`GetAVPlaybackState : SUCCESS : state : ${playbackState.state}`); + console.info('SkipToQueueItem successfully'); } }); ``` @@ -2071,6 +2796,8 @@ getAVMetadata(): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **返回值:** | 类型 | 说明 | @@ -2078,7 +2805,7 @@ getAVMetadata(): Promise\ | Promise<[AVMetadata](#avmetadata)\> | Promise对象,返回会话元数据。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -2103,6 +2830,8 @@ getAVMetadata(callback: AsyncCallback\): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2110,7 +2839,7 @@ getAVMetadata(callback: AsyncCallback\): void | callback | AsyncCallback<[AVMetadata](#avmetadata)\> | 是 | 回调函数,返回会话元数据。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -2137,6 +2866,8 @@ getOutputDevice(): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **返回值:** | 类型 | 说明 | @@ -2144,7 +2875,7 @@ getOutputDevice(): Promise\ | Promise<[OutputDeviceInfo](#outputdeviceinfo)\> | Promise对象,返回播放设备信息。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -2168,6 +2899,8 @@ getOutputDevice(callback: AsyncCallback\): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2175,7 +2908,7 @@ getOutputDevice(callback: AsyncCallback\): void | callback | AsyncCallback<[OutputDeviceInfo](#outputdeviceinfo)\> | 是 | 回调函数,返回播放设备信息。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -2202,6 +2935,8 @@ sendAVKeyEvent(event: KeyEvent): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2209,7 +2944,7 @@ sendAVKeyEvent(event: KeyEvent): Promise\ | event | [KeyEvent](js-apis-keyevent.md) | 是 | 按键事件。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -2246,6 +2981,8 @@ sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback\): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2254,7 +2991,7 @@ sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback\): void | callback | AsyncCallback | 是 | 回调函数。当事件发送成功,err为undefined,否则返回错误对象。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -2287,6 +3024,8 @@ getLaunchAbility(): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **返回值:** | 类型 | 说明 | @@ -2294,7 +3033,7 @@ getLaunchAbility(): Promise\ | Promise<[WantAgent](js-apis-app-ability-wantAgent.md)\> | Promise对象,返回在[setLaunchAbility](#setlaunchability)保存的对象,包括应用的相关属性信息,如bundleName,abilityName,deviceId等。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -2322,6 +3061,8 @@ getLaunchAbility(callback: AsyncCallback\): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2329,7 +3070,7 @@ getLaunchAbility(callback: AsyncCallback\): void | callback | AsyncCallback<[WantAgent](js-apis-app-ability-wantAgent.md)\> | 是 | 回调函数。返回在[setLaunchAbility](#setlaunchability)保存的对象,包括应用的相关属性信息,如bundleName,abilityName,deviceId等。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -2359,6 +3100,8 @@ getRealPlaybackPositionSync(): number **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **返回值:** | 类型 | 说明 | @@ -2366,7 +3109,7 @@ getRealPlaybackPositionSync(): number | number | 时间节点,毫秒数。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -2387,6 +3130,8 @@ isActive(): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **返回值:** | 类型 | 说明 | @@ -2394,7 +3139,7 @@ isActive(): Promise\ | Promise | Promise对象,返回会话是否为激活状态,true表示被激活,false表示禁用。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -2420,6 +3165,8 @@ isActive(callback: AsyncCallback\): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2427,7 +3174,7 @@ isActive(callback: AsyncCallback\): void | callback | AsyncCallback | 是 | 回调函数,返回会话是否为激活状态,true表示被激活,false表示禁用。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -2455,6 +3202,8 @@ destroy(): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **返回值:** | 类型 | 说明 | @@ -2462,7 +3211,7 @@ destroy(): Promise\ | Promise | Promise对象。当控制器销毁成功,无返回结果,否则返回错误对象。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -2487,6 +3236,8 @@ destroy(callback: AsyncCallback\): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2494,7 +3245,7 @@ destroy(callback: AsyncCallback\): void | callback | AsyncCallback | 是 | 回调函数。当控制器销毁成功,err为undefined,否则返回错误对象。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -2521,6 +3272,8 @@ getValidCommands(): Promise\> **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **返回值:** | 类型 | 说明 | @@ -2528,7 +3281,7 @@ getValidCommands(): Promise\> | Promise\> | Promise对象。返回有效命令的集合。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -2554,6 +3307,8 @@ getValidCommands(callback: AsyncCallback\>): void **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2561,7 +3316,7 @@ getValidCommands(callback: AsyncCallback\>): void | callback | AsyncCallback\\> | 是 | 回调函数,返回有效命令的集合。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -2589,6 +3344,8 @@ sendControlCommand(command: AVControlCommand): Promise\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2602,7 +3359,7 @@ sendControlCommand(command: AVControlCommand): Promise\ | Promise | Promise对象。当命令发送成功,无返回结果,否则返回错误对象。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | @@ -2642,6 +3399,8 @@ sendControlCommand(command: AVControlCommand, callback: AsyncCallback\): v **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2650,7 +3409,7 @@ sendControlCommand(command: AVControlCommand, callback: AsyncCallback\): v | callback | AsyncCallback | 是 | 回调函数。当命令发送成功,err为undefined,否则返回错误对象。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ------------------------------- | @@ -2684,6 +3443,93 @@ controller.sendControlCommand(avCommand, function (err) { }); ``` +### sendCommonCommand10+ + +sendCommonCommand(command: string, args: {[key: string]: Object}): Promise\ + +通过会话控制器发送自定义控制命令到其对应的会话。结果通过Promise异步回调方式返回。 + +**系统能力:** SystemCapability.Multimedia.AVSession.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------------------------- | ---- | ------------------------------ | +| command | string | 是 | 需要设置的自定义控制命令的名称 | +| args | {[key: string]: any} | 是 | 需要传递的控制命令键值对 | + +**返回值:** + +| 类型 | 说明 | +| -------------- | ----------------------------- | +| Promise | Promise对象。当命令发送成功,无返回结果,否则返回错误对象。 | + +**错误码:** +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 6600101 | Session service exception. | +| 6600102 | The session does not exist. | +| 6600103 | The session controller does not exist. | +| 6600105 | Invalid session command. | +| 6600106 | The session is not activated. | +| 6600107 | Too many commands or events. | + +**示例:** + +```js +let commandName = "my_command"; +let args = { + command : "This is my command" +} +await controller.sendCommonCommand(commandName, args).catch((err) => { + console.info(`SendCommonCommand BusinessError: code: ${err.code}, message: ${err.message}`); +}) +``` + +### sendCommonCommand10+ + +sendCommonCommand(command: string, args: {[key: string]: Object}, callback: AsyncCallback\): void + +通过会话控制器发送自定义命令到其对应的会话。结果通过callback异步回调方式返回。 + +**系统能力:** SystemCapability.Multimedia.AVSession.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------------------------- | ---- | ------------------------------ | +| command | string | 是 | 需要设置的自定义控制命令的名称 | +| args | {[key: string]: any} | 是 | 需要传递的控制命令键值对 | +| callback | AsyncCallback | 是 | 回调函数。当命令发送成功,err为undefined,否则返回错误对象。 | + +**错误码:** +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 + +| 错误码ID | 错误信息 | +| -------- | ------------------------------- | +| 6600101 | Session service exception. | +| 6600102 | The session does not exist. | +| 6600103 | The session controller does not exist. | +| 6600105 | Invalid session command. | +| 6600106 | The session is not activated. | +| 6600107 | Too many commands or events. | + +**示例:** + +```js +let commandName = "my_command"; +let args = { + command : "This is my command" +} +controller.sendCommonCommand(commandName, args, (err) => { + if(err) { + console.info(`SendCommonCommand BusinessError: code: ${err.code}, message: ${err.message}`); + } +}) +``` + ### on('metadataChange') on(type: 'metadataChange', filter: Array\ | 'all', callback: (data: AVMetadata) => void) @@ -2692,6 +3538,8 @@ on(type: 'metadataChange', filter: Array\ | 'all', callback: ( **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2701,7 +3549,7 @@ on(type: 'metadataChange', filter: Array\ | 'all', callback: ( | callback | (data: [AVMetadata](#avmetadata)) => void | 是 | 回调函数,参数data是变化后的元数据。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ------------------------------ | @@ -2729,6 +3577,8 @@ on(type: 'playbackStateChange', filter: Array\ | 'all', c **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2738,7 +3588,7 @@ on(type: 'playbackStateChange', filter: Array\ | 'all', c | callback | (state: [AVPlaybackState](#avplaybackstate)) => void | 是 | 回调函数,参数state是变化后的播放状态。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ------------------------------ | @@ -2758,9 +3608,9 @@ controller.on('playbackStateChange', playbackFilter, (playbackState) => { }); ``` -### on('sessionEventChange')10+ +### on('sessionEvent')10+ -on(type: 'sessionEventChange', callback: (sessionEvent: string, args: {[key:string]: any}) => void): void +on(type: 'sessionEvent', callback: (sessionEvent: string, args: {[key:string]: Object}) => void): void 媒体控制器设置会话自定义事件变化的监听器。 @@ -2772,11 +3622,77 @@ on(type: 'sessionEventChange', callback: (sessionEvent: string, args: {[key:stri | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | 是 | 事件回调类型,支持事件`'sessionEventChange'`:当会话事件变化时,触发该事件。 | -| callback | (sessionEvent: string, args: {[key:string]: any}) => void | 是 | 回调函数,sessionEvent为变化的会话事件名,args为事件的参数。 | +| type | string | 是 | 事件回调类型,支持事件`'sessionEvent'`:当会话事件变化时,触发该事件。 | +| callback | (sessionEvent: string, args: {[key:string]: object}) => void | 是 | 回调函数,sessionEvent为变化的会话事件名,args为事件的参数。 | + +**错误码:** +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 + +| 错误码ID | 错误信息 | +| -------- | ------------------------------ | +| 6600101 | Session service exception. | +| 6600103 | The session controller does not exist. | + +**示例:** + +```js +controller.on('sessionEvent', (sessionEvent, args) => { + console.info(`OnSessionEvent, sessionEvent is ${sessionEvent}, args: ${JSON.stringify(args)}`); +}); +``` + +### on('queueItemsChange')10+ + +on(type: 'queueItemsChange', callback: (items: Array<[AVQueueItem](#avqueueitem10)\>) => void): void + +媒体控制器设置会话自定义播放列表变化的监听器。 + +**系统能力:** SystemCapability.Multimedia.AVSession.Core + +**系统接口:** 该接口为系统接口 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------------------------- | ---- | ---------------------------------------------------------------------------- | +| type | string | 是 | 事件回调类型,支持事件`'queueItemsChange'`:当session修改播放列表时,触发该事件。 | +| callback | (items: Array<[AVQueueItem](#avqueueitem10)\>) => void | 是 | 回调函数,items为变化的播放列表。 | + +**错误码:** +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 + +| 错误码ID | 错误信息 | +| -------- | ------------------------------ | +| 6600101 | Session service exception. | +| 6600103 | The session controller does not exist. | + +**示例:** + +```js +controller.on('queueItemsChange', (items) => { + console.info(`OnQueueItemsChange, items length is ${items.length}`); +}); +``` + +### on('queueTitleChange')10+ + +on(type: 'queueTitleChange', callback: (title: string) => void): void + +媒体控制器设置会话自定义播放列表的名称变化的监听器。 + +**系统能力:** SystemCapability.Multimedia.AVSession.Core + +**系统接口:** 该接口为系统接口 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | ------------------------------------------------------------------------------- | +| type | string | 是 | 事件回调类型,支持事件`'queueTitleChange'`:当session修改播放列表名称时,触发该事件。 | +| callback | (title: string) => void | 是 | 回调函数,title为变化的播放列表名称。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ------------------------------ | @@ -2786,8 +3702,8 @@ on(type: 'sessionEventChange', callback: (sessionEvent: string, args: {[key:stri **示例:** ```js -controller.on('sessionEventChange', (sessionEvent, args) => { - console.info(`OnSessionEventChange, sessionEvent is ${sessionEvent}, args: ${JSON.stringify(args)}`); +controller.on('queueTitleChange', (title) => { + console.info(`queueTitleChange, title is ${title}`); }); ``` @@ -2799,6 +3715,8 @@ on(type: 'sessionDestroy', callback: () => void) **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2807,7 +3725,7 @@ on(type: 'sessionDestroy', callback: () => void) | callback | () => void | 是 | 回调函数。当监听事件注册成功,err为undefined,否则为错误对象。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ------------------------------ | @@ -2830,6 +3748,8 @@ on(type: 'activeStateChange', callback: (isActive: boolean) => void) **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2838,7 +3758,7 @@ on(type: 'activeStateChange', callback: (isActive: boolean) => void) | callback | (isActive: boolean) => void | 是 | 回调函数。参数isActive表示会话是否被激活。true表示被激活,false表示禁用。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ----------------------------- | @@ -2861,6 +3781,8 @@ on(type: 'validCommandChange', callback: (commands: Array\ **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2869,7 +3791,7 @@ on(type: 'validCommandChange', callback: (commands: Array\ | callback | (commands: Array<[AVControlCommandType](#avcontrolcommandtype)\>) => void | 是 | 回调函数。参数commands是有效命令的集合。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ------------------------------ | @@ -2893,6 +3815,8 @@ on(type: 'outputDeviceChange', callback: (device: OutputDeviceInfo) => void): vo **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2901,7 +3825,7 @@ on(type: 'outputDeviceChange', callback: (device: OutputDeviceInfo) => void): vo | callback | (device: [OutputDeviceInfo](#outputdeviceinfo)) => void | 是 | 回调函数,参数device是设备相关信息。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ----------------------- | @@ -2924,6 +3848,8 @@ off(type: 'metadataChange', callback?: (data: AVMetadata) => void) **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2932,7 +3858,7 @@ off(type: 'metadataChange', callback?: (data: AVMetadata) => void) | callback | (data: [AVMetadata](#avmetadata)) => void | 否 | 回调函数,参数data是变化后的元数据。
该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------- | @@ -2952,6 +3878,8 @@ off(type: 'playbackStateChange', callback?: (state: AVPlaybackState) => void) **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -2960,7 +3888,7 @@ off(type: 'playbackStateChange', callback?: (state: AVPlaybackState) => void) | callback | (state: [AVPlaybackState](#avplaybackstate)) => void | 否 | 回调函数,参数state是变化后的播放状态。
该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------- | @@ -2972,11 +3900,11 @@ off(type: 'playbackStateChange', callback?: (state: AVPlaybackState) => void) controller.off('playbackStateChange'); ``` -### off('sessionEventChange')10+ +### off('sessionEvent')10+ -off(type: 'sessionEventChange', callback?: (sessionEvent: string, args: {[key:string]: any}) => void): void +off(type: 'sessionEvent', callback?: (sessionEvent: string, args: {[key:string]: Obejct}) => void): void -控制器取消监听播放状态变化的事件。 +控制器取消监听会话事件的变化通知。 **系统能力:** SystemCapability.Multimedia.AVSession.Core @@ -2986,11 +3914,71 @@ off(type: 'sessionEventChange', callback?: (sessionEvent: string, args: {[key:st | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------- | -| type | string | 是 | 取消对应的监听事件,支持事件`'sessionEventChange'`。 | -| callback | (sessionEvent: string, args: {[key:string]: any}) => void | 否 | 回调函数,参数sessionEvent是变化的事件名,args为事件的参数。
该参数为可选参数,若不填写该参数,则认为取消所有对sessionEventChange事件的监听。 | +| type | string | 是 | 取消对应的监听事件,支持事件`'sessionEvent'`。 | +| callback | (sessionEvent: string, args: {[key:string]: object}) => void | 否 | 回调函数,参数sessionEvent是变化的事件名,args为事件的参数。
该参数为可选参数,若不填写该参数,则认为取消所有对sessionEvent事件的监听。 | + +**错误码:** +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------- | +| 6600101 | Session service exception. | + +**示例:** + +```js +controller.off('sessionEvent'); +``` + +### off('queueItemsChange')10+ + +off(type: 'queueItemsChange', callback?: (items: Array<[AVQueueItem](#avqueueitem10)\>) => void): void + +控制器取消监听播放列表变化的事件。 + +**系统能力:** SystemCapability.Multimedia.AVSession.Core + +**系统接口:** 该接口为系统接口 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------------------- | ---- | --------------------------------------------------------------------------------------------------- | +| type | string | 是 | 取消对应的监听事件,支持事件`'queueItemsChange'`。 | +| callback | (items: Array<[AVQueueItem](#avqueueitem10)\>) => void | 否 | 回调函数,参数items是变化的播放列表。
该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 | + +**错误码:** +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------- | +| 6600101 | Session service exception. | + +**示例:** + +```js +controller.off('queueItemsChange'); +``` + +### off('queueTitleChange')10+ + +off(type: 'queueTitleChange', callback?: (title: string) => void): void + +控制器取消监听播放列表名称变化的事件。 + +**系统能力:** SystemCapability.Multimedia.AVSession.Core + +**系统接口:** 该接口为系统接口 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | ------------------------------------------------------------------------------------------------------- | +| type | string | 是 | 取消对应的监听事件,支持事件`'queueTitleChange'`。 | +| callback | (title: string) => void | 否 | 回调函数,参数items是变化的播放列表名称。
该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------- | @@ -2999,7 +3987,7 @@ off(type: 'sessionEventChange', callback?: (sessionEvent: string, args: {[key:st **示例:** ```js -controller.off('sessionEventChange'); +controller.off('queueTitleChange'); ``` ### off('sessionDestroy') @@ -3010,6 +3998,8 @@ off(type: 'sessionDestroy', callback?: () => void) **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -3018,7 +4008,7 @@ off(type: 'sessionDestroy', callback?: () => void) | callback | () => void | 否 | 回调函数。当监听事件取消成功,err为undefined,否则返回错误对象。
该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------- | @@ -3038,6 +4028,8 @@ off(type: 'activeStateChange', callback?: (isActive: boolean) => void) **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -3046,7 +4038,7 @@ off(type: 'activeStateChange', callback?: (isActive: boolean) => void) | callback | (isActive: boolean) => void | 否 | 回调函数。参数isActive表示会话是否被激活。true表示被激活,false表示禁用。
该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------- | @@ -3066,6 +4058,8 @@ off(type: 'validCommandChange', callback?: (commands: Array\) => void | 否 | 回调函数。参数commands是有效命令的集合。
该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------- | @@ -3094,6 +4088,8 @@ off(type: 'outputDeviceChange', callback?: (device: OutputDeviceInfo) => void): **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -3102,7 +4098,7 @@ off(type: 'outputDeviceChange', callback?: (device: OutputDeviceInfo) => void): | callback | (device: [OutputDeviceInfo](#outputdeviceinfo)) => void | 否 | 回调函数,参数device是设备相关信息。
该参数为可选参数,若不填写该参数,则认为取消所有相关会话的事件监听。 | **错误码:** -以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 +以下错误码的详细介绍请参见[媒体会话管理错误码](../errorcodes/errorcode-avsession.md)。 | 错误码ID | 错误信息 | | -------- | ---------------- | @@ -3135,6 +4131,8 @@ controller.off('outputDeviceChange'); **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口。 + | 名称 | 类型 | 说明 | | ----- | ------ | ---- | | audio | string | 音频 | @@ -3164,6 +4162,8 @@ controller.off('outputDeviceChange'); **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + | 名称 | 类型 | 说明 | | -------------- | ------ | ------------ | | play | string | 播放 | @@ -3184,6 +4184,8 @@ controller.off('outputDeviceChange'); **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + | 名称 | 类型 | 必填 | 说明 | | --------- | ------------------------------------------------- | ---- | -------------- | | command | [AVControlCommandType](#avcontrolcommandtype) | 是 | 命令 | @@ -3195,6 +4197,8 @@ controller.off('outputDeviceChange'); **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + | 名称 | 类型 | 必填 | 说明 | | --------------- |-------------------------| ---- |---------------------------------------------------------------------| | assetId | string | 是 | 媒体ID。 | @@ -3213,12 +4217,42 @@ controller.off('outputDeviceChange'); | previousAssetId | string | 否 | 上一首媒体ID。 | | nextAssetId | string | 否 | 下一首媒体ID。 | +## AVMediaDescription10+ + +播放列表媒体元数据的相关属性。 + +**系统能力:** SystemCapability.Multimedia.AVSession.Core + +| 名称 | 类型 | 必填 | 说明 | +| ------------ | ----------------------- | ---- | ----------------------- | +| mediaId | string | 是 | 播放列表媒体ID。 | +| title | string | 否 | 播放列表媒体标题。 | +| subtitle | string | 否 | 播放列表媒体子标题。 | +| description | string | 否 | 播放列表媒体描述的文本。 | +| icon | image.PixelMap | 否 | 播放列表媒体图片像素数据。 | +| iconUri | string | 否 | 播放列表媒体图片路径地址。 | +| extras | {[key: string]: any} | 否 | 播放列表媒体额外字段。 | +| mediaUri | string | 否 | 播放列表媒体URI。 | + +## AVQueueItem10+ + +播放列表中单项的相关属性。 + +**系统能力:** SystemCapability.Multimedia.AVSession.Core + +| 名称 | 类型 | 必填 | 说明 | +| ------------ | ------------------------------------------ | ---- | --------------------------- | +| itemId | number | 是 | 播放列表中单项的ID。 | +| description | [AVMediaDescription](#avmediadescription10) | 是 | 播放列表中单项的媒体元数据。 | + ## AVPlaybackState 媒体播放状态的相关属性。 **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + | 名称 | 类型 | 必填 | 说明 | | ------------ | ------------------------------------- | ---- | ------- | | state | [PlaybackState](#playbackstate) | 否 | 播放状态 | @@ -3234,6 +4268,8 @@ controller.off('outputDeviceChange'); **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + | 名称 | 类型 | 必填 | 说明 | | ----------- | ------ | ---- | ------------------ | | elapsedTime | number | 是 | 已用时间,单位毫秒(ms)。 | @@ -3245,6 +4281,8 @@ controller.off('outputDeviceChange'); **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + | 名称 | 类型 | 必填 | 说明 | | ---------- | -------------- | ---- | ---------------------- | | isRemote | boolean | 是 | 设备是否连接。 | @@ -3257,6 +4295,8 @@ controller.off('outputDeviceChange'); **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + | 名称 | 值 | 说明 | | --------------------------- | ---- | ----------- | | PLAYBACK_STATE_INITIAL | 0 | 初始状态 | @@ -3274,6 +4314,8 @@ controller.off('outputDeviceChange'); **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + | 名称 | 值 | 说明 | | ------------------ | ---- | -------- | | LOOP_MODE_SEQUENCE | 0 | 顺序播放 | @@ -3287,6 +4329,8 @@ controller.off('outputDeviceChange'); **系统能力:** SystemCapability.Multimedia.AVSession.Core +**系统接口:** 该接口为系统接口 + | 名称 | 值 | 说明 | | ------------------------------ | ------- | ------------------------------- | | ERR_CODE_SERVICE_EXCEPTION | 6600101 | Session service exception. | 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 605da9955596508dd7fa5bf8417aa8e3b2d05486..ca460869b665fa549a3fca272acd283b167fd9ca 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-backgroundTaskManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-backgroundTaskManager.md @@ -161,7 +161,7 @@ startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: Want | 参数名 | 类型 | 必填 | 说明 | | --------- | --------------------------------------------- | ---- | ------------------------------------------------------------ | -| context | Context | 是 | 应用运行的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 | +| context | Context | 是 | 应用运行的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-application-context.md)。 | | bgMode | [BackgroundMode](#backgroundmode8) | 是 | 向系统申请的后台模式。 | | wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | 是 | 通知参数,用于指定长时任务通知点击后跳转的界面。 | | callback | AsyncCallback<void> | 是 | callback形式返回启动长时任务的结果。 | @@ -253,7 +253,7 @@ startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: Want | 参数名 | 类型 | 必填 | 说明 | | --------- | --------------------------------------------- | ---- | ------------------------------------------------------------ | -| context | Context | 是 | 应用运行的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 | +| context | Context | 是 | 应用运行的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-application-context.md)。 | | bgMode | [BackgroundMode](#backgroundmode8) | 是 | 向系统申请的后台模式。 | | wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | 是 | 通知参数,用于指定长时任务通知点击跳转的界面。 | @@ -339,7 +339,7 @@ stopBackgroundRunning(context: Context, callback: AsyncCallback<void>): vo | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ---------------------------------------- | -| context | Context | 是 | 应用运行的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 | +| context | Context | 是 | 应用运行的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-application-context.md)。 | | callback | AsyncCallback<void> | 是 | callback形式返回启动长时任务的结果。 | **示例**: @@ -395,7 +395,7 @@ stopBackgroundRunning(context: Context): Promise<void> | 参数名 | 类型 | 必填 | 说明 | | ------- | ------- | ---- | ---------------------------------------- | -| context | Context | 是 | 应用运行的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 | +| context | Context | 是 | 应用运行的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-application-context.md)。 | **返回值**: diff --git a/zh-cn/application-dev/reference/apis/js-apis-batteryStatistics.md b/zh-cn/application-dev/reference/apis/js-apis-batteryStatistics.md index 95c477c34d8fecf0b0c1a51e2bb36490c4c677a6..5de930534fc4eb5263a316ea122fa23c60820b8e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-batteryStatistics.md +++ b/zh-cn/application-dev/reference/apis/js-apis-batteryStatistics.md @@ -203,7 +203,7 @@ getHardwareUnitPowerValue(type: ConsumptionType): number ```js try { var value = batteryStats.getHardwareUnitPowerValue(ConsumptionType.CONSUMPTION_TYPE_SCREEN); - console.info('battery statistics percent of hardware is: ' + percent); + console.info('battery statistics value of hardware is: ' + value); } catch(err) { console.error('get battery statistics percent of hardware failed, err: ' + err); } @@ -243,7 +243,7 @@ getHardwareUnitPowerPercent(type: ConsumptionType): number ```js try { - var value = batteryStats.getHardwareUnitPowerPercent(ConsumptionType.CONSUMPTION_TYPE_SCREEN); + var percent = batteryStats.getHardwareUnitPowerPercent(ConsumptionType.CONSUMPTION_TYPE_SCREEN); console.info('battery statistics percent of hardware is: ' + percent); } catch(err) { console.error('get battery statistics percent of hardware failed, err: ' + err); 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 d2881854c8714b1daaa7b23a01e83744909fc750..636487cc3dd633f9e8a5141ebc044c786e4441bd 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bluetooth.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bluetooth.md @@ -3,8 +3,8 @@ 蓝牙模块提供了基础的传统蓝牙能力以及BLE的扫描、广播等功能。 > **说明:** -> > 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> 从API Version 9开始,该接口不再维护,推荐使用新接口[bluetoothManager](js-apis-bluetoothManager.md)。 @@ -15,12 +15,15 @@ import bluetooth from '@ohos.bluetooth'; ``` -## bluetooth.enableBluetooth8+ +## bluetooth.enableBluetooth8+(deprecated) enableBluetooth(): boolean 开启蓝牙。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.enableBluetooth](js-apis-bluetoothManager.md#bluetoothmanagerenablebluetooth)替代。 + **需要权限**:ohos.permission.DISCOVER_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -38,12 +41,15 @@ let enable = bluetooth.enableBluetooth(); ``` -## bluetooth.disableBluetooth8+ +## bluetooth.disableBluetooth8+(deprecated) disableBluetooth(): boolean 关闭蓝牙。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.disableBluetooth](js-apis-bluetoothManager.md#bluetoothmanagerdisablebluetooth)替代。 + **需要权限**:ohos.permission.DISCOVER_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -61,12 +67,15 @@ let disable = bluetooth.disableBluetooth(); ``` -## bluetooth.getLocalName8+ +## bluetooth.getLocalName8+(deprecated) getLocalName(): string 获取蓝牙本地设备名称。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.getLocalName](js-apis-bluetoothManager.md#bluetoothmanagergetlocalname)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -84,12 +93,15 @@ let localName = bluetooth.getLocalName(); ``` -## bluetooth.getState +## bluetooth.getState(deprecated) getState(): BluetoothState 获取蓝牙开关状态。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.getState](js-apis-bluetoothManager.md#bluetoothmanagergetstate)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -107,11 +119,14 @@ let state = bluetooth.getState(); ``` -## bluetooth.getBtConnectionState +## bluetooth.getBtConnectionState(deprecated) getBtConnectionState(): ProfileConnectionState -获取蓝牙设备的Profile连接状态。 +获取蓝牙本端的Profile连接状态,例如:任意一个支持的Profile连接状态为已连接,则此接口返回状态为已连接。 + +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.getBtConnectionState](js-apis-bluetoothManager.md#bluetoothmanagergetbtconnectionstate)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -130,12 +145,15 @@ let connectionState = bluetooth.getBtConnectionState(); ``` -## bluetooth.setLocalName8+ +## bluetooth.setLocalName8+(deprecated) setLocalName(name: string): boolean 设置蓝牙本地设备名称。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.setLocalName](js-apis-bluetoothManager.md#bluetoothmanagersetlocalname)替代。 + **需要权限**:ohos.permission.DISCOVER_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -159,12 +177,15 @@ let ret = bluetooth.setLocalName('device_name'); ``` -## bluetooth.pairDevice +## bluetooth.pairDevice(deprecated) pairDevice(deviceId: string): boolean 发起蓝牙配对。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.pairDevice](js-apis-bluetoothManager.md#bluetoothmanagerpairdevice)替代。 + **需要权限**:ohos.permission.DISCOVER_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -189,11 +210,14 @@ let result = bluetooth.pairDevice("XX:XX:XX:XX:XX:XX"); ``` -## bluetooth.getProfileConnState8+ +## bluetooth.getProfileConnState8+(deprecated) getProfileConnState(profileId: ProfileId): ProfileConnectionState -获取profile的连接状态。 +依据ProfileId获取指定profile的连接状态。 + +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.getProfileConnectionState](js-apis-bluetoothManager.md#bluetoothmanagergetprofileconnectionstate)替代。 **需要权限**:ohos.permission.USE_BLUETOOTH @@ -218,12 +242,15 @@ let result = bluetooth.getProfileConnState(bluetooth.ProfileId.PROFILE_A2DP_SOUR ``` -## bluetooth.cancelPairedDevice8+ +## bluetooth.cancelPairedDevice8+(deprecated) cancelPairedDevice(deviceId: string): boolean 删除配对的远程设备。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.cancelPairedDevice](js-apis-bluetoothManager.md#bluetoothmanagercancelpaireddevice)替代。 + **系统接口**:此接口为系统接口。 **需要权限**:ohos.permission.DISCOVER_BLUETOOTH @@ -249,12 +276,15 @@ let result = bluetooth.cancelPairedDevice("XX:XX:XX:XX:XX:XX"); ``` -## bluetooth.getRemoteDeviceName8+ +## bluetooth.getRemoteDeviceName8+(deprecated) getRemoteDeviceName(deviceId: string): string 获取对端蓝牙设备的名称。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.getRemoteDeviceName](js-apis-bluetoothManager.md#bluetoothmanagergetremotedevicename)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -278,12 +308,15 @@ let remoteDeviceName = bluetooth.getRemoteDeviceName("XX:XX:XX:XX:XX:XX"); ``` -## bluetooth.getRemoteDeviceClass8+ +## bluetooth.getRemoteDeviceClass8+(deprecated) getRemoteDeviceClass(deviceId: string): DeviceClass 获取对端蓝牙设备的类别。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.getRemoteDeviceClass](js-apis-bluetoothManager.md#bluetoothmanagergetremotedeviceclass)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -307,12 +340,15 @@ let remoteDeviceClass = bluetooth.getRemoteDeviceClass("XX:XX:XX:XX:XX:XX"); ``` -## bluetooth.getPairedDevices8+ +## bluetooth.getPairedDevices8+(deprecated) getPairedDevices(): Array<string> 获取蓝牙配对列表。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.getPairedDevices](js-apis-bluetoothManager.md#bluetoothmanagergetpaireddevices)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -330,12 +366,15 @@ let devices = bluetooth.getPairedDevices(); ``` -## bluetooth.setBluetoothScanMode8+ +## bluetooth.setBluetoothScanMode8+(deprecated) setBluetoothScanMode(mode: ScanMode, duration: number): boolean 设置蓝牙扫描模式,可以被远端设备发现。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.setBluetoothScanMode](js-apis-bluetoothManager.md#bluetoothmanagersetbluetoothscanmode)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -361,12 +400,15 @@ let result = bluetooth.setBluetoothScanMode(bluetooth.ScanMode.SCAN_MODE_CONNECT ``` -## bluetooth.getBluetoothScanMode8+ +## bluetooth.getBluetoothScanMode8+(deprecated) getBluetoothScanMode(): ScanMode 获取蓝牙扫描模式。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.getBluetoothScanMode](js-apis-bluetoothManager.md#bluetoothmanagergetbluetoothscanmode)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -384,12 +426,15 @@ let scanMode = bluetooth.getBluetoothScanMode(); ``` -## bluetooth.startBluetoothDiscovery8+ +## bluetooth.startBluetoothDiscovery8+(deprecated) startBluetoothDiscovery(): boolean 开启蓝牙扫描,可以发现远端设备。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.startBluetoothDiscovery](js-apis-bluetoothManager.md#bluetoothmanagerstartbluetoothdiscovery)替代。 + **需要权限**:ohos.permission.DISCOVER_BLUETOOTH 和 ohos.permission.LOCATION **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -412,12 +457,15 @@ let result = bluetooth.startBluetoothDiscovery(); ``` -## bluetooth.stopBluetoothDiscovery8+ +## bluetooth.stopBluetoothDiscovery8+(deprecated) stopBluetoothDiscovery(): boolean 关闭蓝牙扫描。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.stopBluetoothDiscovery](js-apis-bluetoothManager.md#bluetoothmanagerstopbluetoothdiscovery)替代。 + **需要权限**:ohos.permission.DISCOVER_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -435,12 +483,15 @@ let result = bluetooth.stopBluetoothDiscovery(); ``` -## bluetooth.setDevicePairingConfirmation8+ +## bluetooth.setDevicePairingConfirmation8+(deprecated) setDevicePairingConfirmation(device: string, accept: boolean): boolean 设置设备配对请求确认。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.setDevicePairingConfirmation](js-apis-bluetoothManager.md#bluetoothmanagersetdevicepairingconfirmation)替代。 + **需要权限**:ohos.permission.MANAGE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -470,12 +521,15 @@ bluetooth.on("pinRequired", onReceivePinRequiredEvent); ``` -## bluetooth.on('bluetoothDeviceFind')8+ +## bluetooth.on('bluetoothDeviceFind')8+(deprecated) on(type: "bluetoothDeviceFind", callback: Callback<Array<string>>): void 订阅蓝牙设备发现上报事件。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.on('bluetoothDeviceFind')](js-apis-bluetoothManager.md#bluetoothmanageronbluetoothdevicefind)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -501,12 +555,15 @@ bluetooth.on('bluetoothDeviceFind', onReceiveEvent); ``` -## bluetooth.off('bluetoothDeviceFind')8+ +## bluetooth.off('bluetoothDeviceFind')8+(deprecated) off(type: "bluetoothDeviceFind", callback?: Callback<Array<string>>): void 取消订阅蓝牙设备发现上报事件。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.off('bluetoothDeviceFind')](js-apis-bluetoothManager.md#bluetoothmanageroffbluetoothdevicefind)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -533,12 +590,15 @@ bluetooth.off('bluetoothDeviceFind', onReceiveEvent); ``` -## bluetooth.on('pinRequired')8+ +## bluetooth.on('pinRequired')8+(deprecated) on(type: "pinRequired", callback: Callback<PinRequiredParam>): void 订阅远端蓝牙设备的配对请求事件。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.on('pinRequired')](js-apis-bluetoothManager.md#bluetoothmanageronpinrequired)替代。 + **需要权限**:ohos.permission.DISCOVER_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -564,12 +624,15 @@ bluetooth.on('pinRequired', onReceiveEvent); ``` -## bluetooth.off('pinRequired')8+ +## bluetooth.off('pinRequired')8+(deprecated) off(type: "pinRequired", callback?: Callback<PinRequiredParam>): void 取消订阅远端蓝牙设备的配对请求事件。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.off('pinRequired')](js-apis-bluetoothManager.md#bluetoothmanageroffpinrequired)替代。 + **需要权限**:ohos.permission.DISCOVER_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -596,12 +659,15 @@ bluetooth.off('pinRequired', onReceiveEvent); ``` -## bluetooth.on('bondStateChange')8+ +## bluetooth.on('bondStateChange')8+(deprecated) on(type: "bondStateChange", callback: Callback<BondStateParam>): void 订阅蓝牙配对状态改变事件。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.on('bondStateChange')](js-apis-bluetoothManager.md#bluetoothmanageronbondstatechange)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -627,12 +693,15 @@ bluetooth.on('bondStateChange', onReceiveEvent); ``` -## bluetooth.off('bondStateChange')8+ +## bluetooth.off('bondStateChange')8+(deprecated) off(type: "bondStateChange", callback?: Callback<BondStateParam>): void 取消订阅蓝牙配对状态改变事件。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.off('bondStateChange')](js-apis-bluetoothManager.md#bluetoothmanageroffbondstatechange)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -659,12 +728,15 @@ bluetooth.off('bondStateChange', onReceiveEvent); ``` -## bluetooth.on('stateChange')8+ +## bluetooth.on('stateChange')8+(deprecated) on(type: "stateChange", callback: Callback<BluetoothState>): void 订阅蓝牙连接状态改变事件。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.on('stateChange')](js-apis-bluetoothManager.md#bluetoothmanageronstatechange)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -690,12 +762,15 @@ bluetooth.on('stateChange', onReceiveEvent); ``` -## bluetooth.off('stateChange')8+ +## bluetooth.off('stateChange')8+(deprecated) off(type: "stateChange", callback?: Callback<BluetoothState>): void 取消订阅蓝牙连接状态改变事件。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.off('stateChange')](js-apis-bluetoothManager.md#bluetoothmanageroffstatechange)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -722,12 +797,15 @@ bluetooth.off('stateChange', onReceiveEvent); ``` -## bluetooth.sppListen8+ +## bluetooth.sppListen8+(deprecated) sppListen(name: string, option: SppOption, callback: AsyncCallback<number>): void 创建一个服务端监听Socket。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.sppListen](js-apis-bluetoothManager.md#bluetoothmanagerspplisten)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -757,12 +835,15 @@ bluetooth.sppListen('server1', sppOption, serverSocket); ``` -## bluetooth.sppAccept8+ +## bluetooth.sppAccept8+(deprecated) sppAccept(serverSocket: number, callback: AsyncCallback<number>): void 服务端监听socket等待客户端连接。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.sppAccept](js-apis-bluetoothManager.md#bluetoothmanagersppaccept)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 **参数:** @@ -796,12 +877,15 @@ bluetooth.sppAccept(serverNumber, acceptClientSocket); ``` -## bluetooth.sppConnect8+ +## bluetooth.sppConnect8+(deprecated) sppConnect(device: string, option: SppOption, callback: AsyncCallback<number>): void 客户端向远端设备发起spp连接。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.sppConnect](js-apis-bluetoothManager.md#bluetoothmanagersppconnect)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -832,12 +916,15 @@ bluetooth.sppConnect('XX:XX:XX:XX:XX:XX', sppOption, clientSocket); ``` -## bluetooth.sppCloseServerSocket8+ +## bluetooth.sppCloseServerSocket8+(deprecated) sppCloseServerSocket(socket: number): void 关闭服务端监听Socket,入参socket由sppListen接口返回。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.sppCloseServerSocket](js-apis-bluetoothManager.md#bluetoothmanagersppcloseserversocket)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 **参数:** @@ -861,12 +948,15 @@ bluetooth.sppCloseServerSocket(serverNumber); ``` -## bluetooth.sppCloseClientSocket8+ +## bluetooth.sppCloseClientSocket8+(deprecated) sppCloseClientSocket(socket: number): void 关闭客户端socket,入参socket由sppAccept或sppConnect接口获取。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.sppCloseClientSocket](js-apis-bluetoothManager.md#bluetoothmanagersppcloseclientsocket)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 **参数:** @@ -892,12 +982,15 @@ bluetooth.sppCloseClientSocket(clientNumber); ``` -## bluetooth.sppWrite8+ +## bluetooth.sppWrite8+(deprecated) sppWrite(clientSocket: number, data: ArrayBuffer): boolean 通过socket向远端发送数据,入参clientSocket由sppAccept或sppConnect接口获取 。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.sppWrite](js-apis-bluetoothManager.md#bluetoothmanagersppwrite)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 **参数:** @@ -937,10 +1030,13 @@ if (ret) { ``` -## bluetooth.on('sppRead')8+ +## bluetooth.on('sppRead')8+(deprecated) on(type: "sppRead", clientSocket: number, callback: Callback<ArrayBuffer>): void +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.on('sppRead')](js-apis-bluetoothManager.md#bluetoothmanageronsppread)替代。 + 订阅spp读请求事件,入参clientSocket由sppAccept或sppConnect接口获取。 **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -977,12 +1073,15 @@ bluetooth.on('sppRead', clientNumber, dataRead); ``` -## bluetooth.off('sppRead')8+ +## bluetooth.off('sppRead')8+(deprecated) off(type: "sppRead", clientSocket: number, callback?: Callback<ArrayBuffer>): void 取消订阅spp读请求事件,入参clientSocket由sppAccept或sppConnect接口获取。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.off('sppRead')](js-apis-bluetoothManager.md#bluetoothmanageroffsppread)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 **参数:** @@ -1013,12 +1112,15 @@ bluetooth.off('sppRead', clientNumber); ``` -## bluetooth.getProfile8+ +## bluetooth.getProfile8+(deprecated) getProfile(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfile 通过ProfileId,获取profile的对象实例。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.getProfileInstance](js-apis-bluetoothManager.md#bluetoothmanagergetprofileinstance)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 **参数:** @@ -1039,41 +1141,18 @@ getProfile(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfi let a2dpSrc = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_A2DP_SOURCE); ``` -## bluetooth.getProfileInst9+ - -getProfileInst(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfile | HidHostProfile | PanProfile - -通过ProfileId,获取profile的对象实例,API9新增了HidHostProfile,PanProfile。 - -**系统能力**:SystemCapability.Communication.Bluetooth.Core。 - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| --------- | --------- | ---- | ------------------------------------- | -| profileId | [ProfileId](#ProfileId) | 是 | 表示profile的枚举值,例如:PROFILE_A2DP_SOURCE。 | - -**返回值:** - -| 类型 | 说明 | -| ------------------------------------------------------------ | ------------------------------------------------------------ | -| [A2dpSourceProfile](#a2dpsourceprofile)或 [HandsFreeAudioGatewayProfile](#handsfreeaudiogatewayprofile)或[HidHostProfile](#hidhostprofile)或[PanProfile](#panprofile) | 对应的profile的对象实例,当前支持A2dpSourceProfile/HandsFreeAudioGatewayProfile/HidHostProfile/PanProfile。 | - -**示例:** - -```js -let hidHost = bluetooth.getProfileInst(bluetooth.ProfileId.PROFILE_HID_HOST); -``` - ## bluetooth.BLE -### bluetooth.BLE.createGattServer +### bluetooth.BLE.createGattServer(deprecated) createGattServer(): GattServer 创建一个可使用的GattServer实例。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.BLE.createGattServer](js-apis-bluetoothManager.md#bluetoothmanagerblecreategattserver)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 **返回值:** @@ -1089,12 +1168,15 @@ let gattServer = bluetooth.BLE.createGattServer(); ``` -### bluetooth.BLE.createGattClientDevice +### bluetooth.BLE.createGattClientDevice(deprecated) createGattClientDevice(deviceId: string): GattClientDevice 创建一个可使用的GattClientDevice实例。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.BLE.createGattClientDevice](js-apis-bluetoothManager.md#bluetoothmanagerblecreategattclientdevice)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 **参数:** @@ -1116,12 +1198,15 @@ let device = bluetooth.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); ``` -### bluetooth.BLE.getConnectedBLEDevices +### bluetooth.BLE.getConnectedBLEDevices(deprecated) getConnectedBLEDevices(): Array<string> 获取和当前设备连接的BLE设备。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.BLE.getConnectedBLEDevices](js-apis-bluetoothManager.md#bluetoothmanagerblegetconnectedbledevices)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -1139,12 +1224,15 @@ let result = bluetooth.BLE.getConnectedBLEDevices(); ``` -### bluetooth.BLE.startBLEScan +### bluetooth.BLE.startBLEScan(deprecated) startBLEScan(filters: Array<ScanFilter>, options?: ScanOptions): void 发起BLE扫描流程。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.BLE.startBLEScan](js-apis-bluetoothManager.md#bluetoothmanagerblestartblescan)替代。 + **需要权限**:ohos.permission.DISCOVER_BLUETOOTH 和 ohos.permission.MANAGE_BLUETOOTH 和 ohos.permission.LOCATION **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -1182,12 +1270,15 @@ bluetooth.BLE.startBLEScan( ``` -### bluetooth.BLE.stopBLEScan +### bluetooth.BLE.stopBLEScan(deprecated) stopBLEScan(): void 停止BLE扫描流程。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.BLE.stopBLEScan](js-apis-bluetoothManager.md#bluetoothmanagerblestopblescan)替代。 + **需要权限**:ohos.permission.DISCOVER_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -1203,12 +1294,15 @@ bluetooth.BLE.stopBLEScan(); ``` -### bluetooth.BLE.on('BLEDeviceFind') +### bluetooth.BLE.on('BLEDeviceFind')(deprecated) on(type: "BLEDeviceFind", callback: Callback<Array<ScanResult>>): void 订阅BLE设备发现上报事件。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.BLE.on('BLEDeviceFind')](js-apis-bluetoothManager.md#bluetoothmanagerbleonbledevicefind)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -1234,12 +1328,15 @@ bluetooth.BLE.on('BLEDeviceFind', onReceiveEvent); ``` -### bluetooth.BLE.off('BLEDeviceFind') +### bluetooth.BLE.off('BLEDeviceFind')(deprecated) off(type: "BLEDeviceFind", callback?: Callback<Array<ScanResult>>): void 取消订阅BLE设备发现上报事件。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.BLE.off('BLEDeviceFind')](js-apis-bluetoothManager.md#bluetoothmanagerbleoffbledevicefind)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -1271,12 +1368,15 @@ bluetooth.BLE.off('BLEDeviceFind', onReceiveEvent); profile基类。 -### getConnectionDevices8+ +### getConnectionDevices8+(deprecated) getConnectionDevices(): Array<string> 获取已连接设备列表。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.BaseProfile.getConnectionDevices](js-apis-bluetoothManager.md#getconnectiondevices)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -1294,12 +1394,15 @@ let a2dpSrc = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_A2DP_SOURCE) as b let retArray = a2dpSrc.getConnectionDevices(); ``` -### getDeviceState8+ +### getDeviceState8+(deprecated) getDeviceState(device: string): ProfileConnectionState 获取设备profile的连接状态。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.BaseProfile.getDeviceState](js-apis-bluetoothManager.md#getdevicestate)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -1328,12 +1431,15 @@ let ret = a2dpSrc.getDeviceState('XX:XX:XX:XX:XX:XX'); 使用A2dpSourceProfile方法之前需要创建该类的实例进行操作,通过getProfile()方法构造此实例。 -### connect8+ +### connect8+(deprecated) connect(device: string): boolean 发起设备的A2dp服务连接请求。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.A2dpSourceProfile.connect](js-apis-bluetoothManager.md#connect)替代。 + **需要权限**:ohos.permission.DISCOVER_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -1358,12 +1464,15 @@ let ret = a2dpSrc.connect('XX:XX:XX:XX:XX:XX'); ``` -### disconnect8+ +### disconnect8+(deprecated) disconnect(device: string): boolean 断开设备的a2dp服务连接。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.A2dpSourceProfile.disconnect](js-apis-bluetoothManager.md#disconnect)替代。 + **需要权限**:ohos.permission.DISCOVER_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -1388,12 +1497,15 @@ let ret = a2dpSrc.disconnect('XX:XX:XX:XX:XX:XX'); ``` -### on('connectionStateChange')8+ +### on('connectionStateChange')8+(deprecated) on(type: "connectionStateChange", callback: Callback<[StateChangeParam](#StateChangeParam)>): void 订阅a2dp连接状态变化事件。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.A2dpSourceProfile.on('connectionStateChange')](js-apis-bluetoothManager.md#onconnectionstatechange)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 **参数:** @@ -1418,12 +1530,15 @@ a2dpSrc.on('connectionStateChange', onReceiveEvent); ``` -### off('connectionStateChange')8+ +### off('connectionStateChange')8+(deprecated) off(type: "connectionStateChange", callback?: Callback<[StateChangeParam](#StateChangeParam)>): void 取消订阅a2dp连接状态变化事件。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.A2dpSourceProfile.off('connectionStateChange')](js-apis-bluetoothManager.md#offconnectionstatechange)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 **参数:** @@ -1449,12 +1564,15 @@ a2dpSrc.off('connectionStateChange', onReceiveEvent); ``` -### getPlayingState8+ +### getPlayingState8+(deprecated) getPlayingState(device: string): PlayingState 获取设备的播放状态。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.A2dpSourceProfile.getPlayingState](js-apis-bluetoothManager.md#getplayingstate)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 **参数:** @@ -1482,12 +1600,15 @@ let state = a2dpSrc.getPlayingState('XX:XX:XX:XX:XX:XX'); 使用HandsFreeAudioGatewayProfile方法之前需要创建该类的实例进行操作,通过getProfile()方法构造此实例。 -### connect8+ +### connect8+(deprecated) connect(device: string): boolean 连接设备的HFP服务。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.HandsFreeAudioGatewayProfile.connect](js-apis-bluetoothManager.md#connect-1)替代。 + **需要权限**:ohos.permission.DISCOVER_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -1513,12 +1634,15 @@ let ret = hfpAg.connect('XX:XX:XX:XX:XX:XX'); ``` -### disconnect8+ +### disconnect8+(deprecated) disconnect(device: string): boolean 断开连接设备的HFP服务。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.HandsFreeAudioGatewayProfile.disconnect](js-apis-bluetoothManager.md#disconnect-1)替代。 + **需要权限**:ohos.permission.DISCOVER_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -1544,12 +1668,15 @@ let ret = hfpAg.disconnect('XX:XX:XX:XX:XX:XX'); ``` -### on('connectionStateChange')8+ +### on('connectionStateChange')8+(deprecated) on(type: "connectionStateChange", callback: Callback<[StateChangeParam](#StateChangeParam)>): void 订阅HFP连接状态变化事件。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.HandsFreeAudioGatewayProfile.on('connectionStateChange')](js-apis-bluetoothManager.md#onconnectionstatechange-1)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 **参数:** @@ -1575,12 +1702,15 @@ hfpAg.on('connectionStateChange', onReceiveEvent); ``` -### off('connectionStateChange')8+ +### off('connectionStateChange')8+(deprecated) off(type: "connectionStateChange", callback?: Callback<[StateChangeParam](#StateChangeParam)>): void 取消订阅HFP连接状态变化事件。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.HandsFreeAudioGatewayProfile.off('connectionStateChange')](js-apis-bluetoothManager.md#offconnectionstatechange-1)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 **参数:** @@ -1607,301 +1737,20 @@ hfpAg.off('connectionStateChange', onReceiveEvent); ``` -## HidHostProfile - -使用HidHostProfile方法之前需要创建该类的实例进行操作,通过getProfile()方法构造此实例。 - - -### connect9+ - -connect(device: string): boolean - -连接设备的HidHost服务。 - -**系统接口**:此接口为系统接口。 - -**需要权限**:ohos.permission.DISCOVER_BLUETOOTH - -**系统能力**:SystemCapability.Communication.Bluetooth.Core。 - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | ------- | -| device | string | 是 | 远端设备地址。 | - -**返回值:** - -| 类型 | 说明 | -| --------------------- | --------------------------------- | -| boolean | 成功返回true,失败返回false。 | - -**示例:** - -```js -let hidHostProfile = bluetooth.getProfileInst(bluetooth.ProfileId.PROFILE_HID_HOST) as bluetooth.HidHostProfile; -let ret = hidHostProfile.connect('XX:XX:XX:XX:XX:XX'); -``` - - -### disconnect9+ - -disconnect(device: string): boolean - -断开连接设备的HidHost服务。 - -**系统接口**:此接口为系统接口。 - -**需要权限**:ohos.permission.DISCOVER_BLUETOOTH - -**系统能力**:SystemCapability.Communication.Bluetooth.Core。 - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | ------- | -| device | string | 是 | 远端设备地址。 | - -**返回值:** - -| 类型 | 说明 | -| --------------------- | --------------------------------- | -| boolean | 成功返回true,失败返回false。 | - -**示例:** - -```js -let hidHostProfile = bluetooth.getProfileInst(bluetooth.ProfileId.PROFILE_HID_HOST) as bluetooth.HidHostProfile; -let ret = hidHostProfile.disconnect('XX:XX:XX:XX:XX:XX'); -``` - - -### on('connectionStateChange')9+ - -on(type: "connectionStateChange", callback: Callback<[StateChangeParam](#StateChangeParam)>): void - -订阅HidHost连接状态变化事件。 - -**系统能力**:SystemCapability.Communication.Bluetooth.Core。 - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ---------------------------------------- | ---- | ---------------------------------------- | -| type | string | 是 | 填写"connectionStateChange"字符串,表示连接状态变化事件。 | -| callback | Callback<[StateChangeParam](#StateChangeParam)> | 是 | 表示回调函数的入参。 | - -**返回值:** - -无 - -**示例:** - -```js -function onReceiveEvent(data) { - console.info('hidHost state = '+ JSON.stringify(data)); -} -let hidHost = bluetooth.getProfileInst(bluetooth.ProfileId.PROFILE_HID_HOST) as bluetooth.HidHostProfile; -hidHost.on('connectionStateChange', onReceiveEvent); -``` - - -### off('connectionStateChange')9+ - -off(type: "connectionStateChange", callback?: Callback<[StateChangeParam](#StateChangeParam)>): void - -取消订阅HidHost连接状态变化事件。 - -**系统能力**:SystemCapability.Communication.Bluetooth.Core。 - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ----------------------------------------------------- | ---- | --------------------------------------------------------- | -| type | string | 是 | 填写"connectionStateChange"字符串,表示连接状态变化事件。 | -| callback | Callback<[StateChangeParam](#StateChangeParam)> | 否 | 表示回调函数的入参。 | - -**返回值:** - -无 - -**示例:** - -```js -function onReceiveEvent(data) { - console.info('hidHost state = '+ JSON.stringify(data)); -} -let hidHost = bluetooth.getProfileInst(bluetooth.ProfileId.PROFILE_HID_HOST) as bluetooth.HidHostProfile; -hidHost.on('connectionStateChange', onReceiveEvent); -hidHost.off('connectionStateChange', onReceiveEvent); -``` - - -## PanProfile - -使用PanProfile方法之前需要创建该类的实例进行操作,通过getProfile()方法构造此实例。 - - -### disconnect9+ - -disconnect(device: string): boolean - -断开连接设备的Pan服务。 - -**系统接口**:此接口为系统接口。 - -**需要权限**:ohos.permission.USE_BLUETOOTH - -**系统能力**:SystemCapability.Communication.Bluetooth.Core。 - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | ------- | -| device | string | 是 | 远端设备地址。 | - -**返回值:** - -| 类型 | 说明 | -| --------------------- | --------------------------------- | -| boolean | 成功返回true,失败返回false。 | - -**示例:** - -```js -let panProfile = bluetooth.getProfileInst(bluetooth.ProfileId.PROFILE_PAN_NETWORK) as bluetooth.PanProfile; -let ret = panProfile.disconnect('XX:XX:XX:XX:XX:XX'); -``` - - -### on('connectionStateChange')9+ - -on(type: "connectionStateChange", callback: Callback<[StateChangeParam](#StateChangeParam)>): void - -订阅Pan连接状态变化事件。 - -**系统能力**:SystemCapability.Communication.Bluetooth.Core。 - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ---------------------------------------- | ---- | ---------------------------------------- | -| type | string | 是 | 填写"connectionStateChange"字符串,表示连接状态变化事件。 | -| callback | Callback<[StateChangeParam](#StateChangeParam)> | 是 | 表示回调函数的入参。 | - -**返回值:** - -无 - -**示例:** - -```js -function onReceiveEvent(data) { - console.info('pan state = '+ JSON.stringify(data)); -} -let panProfile = bluetooth.getProfileInst(bluetooth.ProfileId.PROFILE_PAN_NETWORK) as bluetooth.PanProfile; -panProfile.on('connectionStateChange', onReceiveEvent); -``` - - -### off('connectionStateChange')9+ - -off(type: "connectionStateChange", callback?: Callback<[StateChangeParam](#StateChangeParam)>): void - -取消订阅Pan连接状态变化事件。 - -**系统能力**:SystemCapability.Communication.Bluetooth.Core。 - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ----------------------------------------------------- | ---- | --------------------------------------------------------- | -| type | string | 是 | 填写"connectionStateChange"字符串,表示连接状态变化事件。 | -| callback | Callback<[StateChangeParam](#StateChangeParam)> | 否 | 表示回调函数的入参。 | - -**返回值:** - -无 - -**示例:** - -```js -function onReceiveEvent(data) { - console.info('pan state = '+ JSON.stringify(data)); -} -let panProfile = bluetooth.getProfileInst(bluetooth.ProfileId.PROFILE_PAN_NETWORK) as bluetooth.PanProfile; -panProfile.on('connectionStateChange', onReceiveEvent); -panProfile.off('connectionStateChange', onReceiveEvent); -``` - - -### setTethering9+ - -setTethering(enable: boolean): void - -设置网络共享状态。 - -**系统接口**:此接口为系统接口。 - -**需要权限**:ohos.permission.DISCOVER_BLUETOOTH - -**系统能力**:SystemCapability.Communication.Bluetooth.Core。 - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | ------- | -| value | boolean | 是 | 是否设置蓝牙共享。 | - -**返回值:** - -| 类型 | 说明 | -| --------------------- | --------------------------------- | -| boolean | 成功返回true,失败返回false。 | - -**示例:** - -```js -let panProfile = bluetooth.getProfileInst(bluetooth.ProfileId.PROFILE_PAN_NETWORK) as bluetooth.PanProfile; -let ret = panProfile.setTethering(true); -``` - - -### isTetheringOn9+ - -isTetheringOn(): boolean - -获取网络共享状态。 - -**系统接口**:此接口为系统接口。 - -**系统能力**:SystemCapability.Communication.Bluetooth.Core。 - -**返回值:** - -| 类型 | 说明 | -| --------------------- | --------------------------------- | -| boolean | 网络共享开启返回true,网络共享关闭返回false。 | - -**示例:** - -```js -let panProfile = bluetooth.getProfileInst(bluetooth.ProfileId.PROFILE_PAN_NETWORK) as bluetooth.PanProfile; -let ret = panProfile.isTetheringOn(); -``` - - ## GattServer server端类,使用server端方法之前需要创建该类的实例进行操作,通过createGattServer()方法构造此实例。 -### startAdvertising +### startAdvertising(deprecated) startAdvertising(setting: AdvertiseSetting, advData: AdvertiseData, advResponse?: AdvertiseData): void 开始发送BLE广播。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.startAdvertising](js-apis-bluetoothManager.md#startadvertising)替代。 + **需要权限**:ohos.permission.DISCOVER_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -1963,12 +1812,15 @@ gattServer.startAdvertising({ ``` -### stopAdvertising +### stopAdvertising(deprecated) stopAdvertising(): void 停止发送BLE广播。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.stopAdvertising](js-apis-bluetoothManager.md#stopadvertising)替代。 + **需要权限**:ohos.permission.DISCOVER_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -1985,12 +1837,15 @@ server.stopAdvertising(); ``` -### addService +### addService(deprecated) addService(service: GattService): boolean server端添加服务。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.addService](js-apis-bluetoothManager.md#addservice)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -2044,12 +1899,15 @@ if (ret) { ``` -### removeService +### removeService(deprecated) removeService(serviceUuid: string): boolean 删除已添加的服务。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.removeService](js-apis-bluetoothManager.md#removeservice)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -2074,12 +1932,15 @@ server.removeService('00001810-0000-1000-8000-00805F9B34FB'); ``` -### close +### close(deprecated) close(): void 关闭服务端功能,去注册server在协议栈的注册,调用该接口后[GattServer](#gattserver)实例将不能再使用。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.close](js-apis-bluetoothManager.md#close)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -2092,12 +1953,15 @@ server.close(); ``` -### notifyCharacteristicChanged +### notifyCharacteristicChanged(deprecated) notifyCharacteristicChanged(deviceId: string, notifyCharacteristic: NotifyCharacteristic): boolean server端特征值发生变化时,主动通知已连接的client设备。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.notifyCharacteristicChanged](js-apis-bluetoothManager.md#notifycharacteristicchanged)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -2137,12 +2001,15 @@ server.notifyCharacteristicChanged('XX:XX:XX:XX:XX:XX', notifyCharacteristic); ``` -### sendResponse +### sendResponse(deprecated) sendResponse(serverResponse: ServerResponse): boolean server端回复client端的读写请求。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.sendResponse](js-apis-bluetoothManager.md#sendresponse)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -2184,12 +2051,15 @@ if (ret) { ``` -### on('characteristicRead') +### on('characteristicRead')(deprecated) on(type: "characteristicRead", callback: Callback<CharacteristicReadReq>): void server端订阅特征值读请求事件。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.on('characteristicRead')](js-apis-bluetoothManager.md#oncharacteristicread)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -2232,12 +2102,15 @@ gattServer.on("characteristicRead", ReadCharacteristicReq); ``` -### off('characteristicRead') +### off('characteristicRead')(deprecated) off(type: "characteristicRead", callback?: Callback<CharacteristicReadReq>): void server端取消订阅特征值读请求事件。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.off('characteristicRead')](js-apis-bluetoothManager.md#offcharacteristicread)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -2261,12 +2134,15 @@ gattServer.off("characteristicRead"); ``` -### on('characteristicWrite') +### on('characteristicWrite')(deprecated) on(type: "characteristicWrite", callback: Callback<CharacteristicWriteReq>): void server端订阅特征值写请求事件。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.on('characteristicWrite')](js-apis-bluetoothManager.md#oncharacteristicwrite)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -2312,12 +2188,15 @@ gattServer.on("characteristicWrite", WriteCharacteristicReq); ``` -### off('characteristicWrite') +### off('characteristicWrite')(deprecated) off(type: "characteristicWrite", callback?: Callback<CharacteristicWriteReq>): void server端取消订阅特征值写请求事件。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.off('characteristicWrite')](js-apis-bluetoothManager.md#offcharacteristicwrite)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -2341,12 +2220,15 @@ gattServer.off("characteristicWrite"); ``` -### on('descriptorRead') +### on('descriptorRead')(deprecated) on(type: "descriptorRead", callback: Callback<DescriptorReadReq>): void server端订阅描述符读请求事件。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.on('descriptorRead')](js-apis-bluetoothManager.md#ondescriptorread)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -2389,12 +2271,15 @@ gattServer.on("descriptorRead", ReadDescriptorReq); ``` -### off('descriptorRead') +### off('descriptorRead')(deprecated) off(type: "descriptorRead", callback?: Callback<DescriptorReadReq>): void server端取消订阅描述符读请求事件。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.off('descriptorRead')](js-apis-bluetoothManager.md#offdescriptorread)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -2418,12 +2303,15 @@ gattServer.off("descriptorRead"); ``` -### on('descriptorWrite') +### on('descriptorWrite')(deprecated) on(type: "descriptorWrite", callback: Callback<DescriptorWriteReq>): void server端订阅描述符写请求事件。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.on('descriptorWrite')](js-apis-bluetoothManager.md#ondescriptorwrite)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -2469,12 +2357,15 @@ gattServer.on("descriptorRead", WriteDescriptorReq); ``` -### off('descriptorWrite') +### off('descriptorWrite')(deprecated) off(type: "descriptorWrite", callback?: Callback<DescriptorWriteReq>): void server端取消订阅描述符写请求事件。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.off('descriptorWrite')](js-apis-bluetoothManager.md#offdescriptorwrite)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -2498,12 +2389,15 @@ gattServer.off("descriptorWrite"); ``` -### on('connectStateChange') +### on('connectStateChange')(deprecated) on(type: "connectStateChange", callback: Callback<BLEConnectChangedState>): void server端订阅BLE连接状态变化事件。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.on('connectStateChange')](js-apis-bluetoothManager.md#onconnectstatechange)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -2532,12 +2426,15 @@ gattServer.on("connectStateChange", Connected); ``` -### off('connectStateChange') +### off('connectStateChange')(deprecated) off(type: "connectStateChange", callback?: Callback<BLEConnectChangedState>): void server端取消订阅BLE连接状态变化事件。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattServer.off('connectStateChange')](js-apis-bluetoothManager.md#offconnectstatechange)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -2566,12 +2463,15 @@ gattServer.off("connectStateChange"); client端类,使用client端方法之前需要创建该类的实例进行操作,通过createGattClientDevice(deviceId: string)方法构造此实例。 -### connect +### connect(deprecated) connect(): boolean client端发起连接远端蓝牙低功耗设备。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.connect](js-apis-bluetoothManager.md#connect-3)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -2590,12 +2490,15 @@ let ret = device.connect(); ``` -### disconnect +### disconnect(deprecated) disconnect(): boolean client端断开与远端蓝牙低功耗设备的连接。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.disconnect](js-apis-bluetoothManager.md#disconnect-4)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -2614,12 +2517,15 @@ let ret = device.disconnect(); ``` -### close +### close(deprecated) close(): boolean 关闭客户端功能,注销client在协议栈的注册,调用该接口后[GattClientDevice](#gattclientdevice)实例将不能再使用。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.close](js-apis-bluetoothManager.md#close-1)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -2640,12 +2546,15 @@ let ret = device.close(); -### getServices +### getServices(deprecated) getServices(callback: AsyncCallback<Array<GattService>>): void client端获取蓝牙低功耗设备的所有服务,即服务发现 。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.getServices](js-apis-bluetoothManager.md#getservices)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -2682,12 +2591,15 @@ device.getServices(getServices); ``` -### getServices +### getServices(deprecated) getServices(): Promise<Array<GattService>> client端获取蓝牙低功耗设备的所有服务,即服务发现。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.getServices](js-apis-bluetoothManager.md#getservices-1)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -2710,12 +2622,15 @@ device.getServices().then(result => { ``` -### readCharacteristicValue +### readCharacteristicValue(deprecated) readCharacteristicValue(characteristic: BLECharacteristic, callback: AsyncCallback<BLECharacteristic>): void client端读取蓝牙低功耗设备特定服务的特征值。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.readCharacteristicValue](js-apis-bluetoothManager.md#readcharacteristicvalue)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -2764,12 +2679,15 @@ device.readCharacteristicValue(characteristic, readCcc); ``` -### readCharacteristicValue +### readCharacteristicValue(deprecated) readCharacteristicValue(characteristic: BLECharacteristic): Promise<BLECharacteristic> client端读取蓝牙低功耗设备特定服务的特征值。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.readCharacteristicValue](js-apis-bluetoothManager.md#readcharacteristicvalue-1)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -2810,12 +2728,15 @@ device.readCharacteristicValue(characteristic); ``` -### readDescriptorValue +### readDescriptorValue(deprecated) readDescriptorValue(descriptor: BLEDescriptor, callback: AsyncCallback<BLEDescriptor>): void client端读取蓝牙低功耗设备特定的特征包含的描述符。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.readDescriptorValue](js-apis-bluetoothManager.md#readdescriptorvalue)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -2854,12 +2775,15 @@ device.readDescriptorValue(descriptor, readDesc); ``` -### readDescriptorValue +### readDescriptorValue(deprecated) readDescriptorValue(descriptor: BLEDescriptor): Promise<BLEDescriptor> client端读取蓝牙低功耗设备特定的特征包含的描述符。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.readDescriptorValue](js-apis-bluetoothManager.md#readdescriptorvalue-1)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -2890,12 +2814,15 @@ device.readDescriptorValue(descriptor); ``` -### writeCharacteristicValue +### writeCharacteristicValue(deprecated) writeCharacteristicValue(characteristic: BLECharacteristic): boolean client端向低功耗蓝牙设备写入特定的特征值。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.writeCharacteristicValue](js-apis-bluetoothManager.md#writecharacteristicvalue)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -2940,12 +2867,15 @@ if (retWriteCcc) { ``` -### writeDescriptorValue +### writeDescriptorValue(deprecated) writeDescriptorValue(descriptor: BLEDescriptor): boolean client端向低功耗蓝牙设备特定的描述符写入二进制数据。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.writeDescriptorValue](js-apis-bluetoothManager.md#writedescriptorvalue)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -2981,12 +2911,15 @@ if (retWriteDesc) { ``` -### setBLEMtuSize +### setBLEMtuSize(deprecated) setBLEMtuSize(mtu: number): boolean client协商远端蓝牙低功耗设备的最大传输单元(Maximum Transmission Unit, MTU),调用[connect](#connect)接口连接成功后才能使用。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.setBLEMtuSize](js-apis-bluetoothManager.md#setblemtusize)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3011,12 +2944,15 @@ device.setBLEMtuSize(128); ``` -### setNotifyCharacteristicChanged +### setNotifyCharacteristicChanged(deprecated) setNotifyCharacteristicChanged(characteristic: BLECharacteristic, enable: boolean): boolean 向服务端发送设置通知此特征值请求。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.setNotifyCharacteristicChanged](js-apis-bluetoothManager.md#setnotifycharacteristicchanged)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3054,12 +2990,15 @@ device.setNotifyCharacteristicChanged(characteristic, false); ``` -### on('BLECharacteristicChange') +### on('BLECharacteristicChange')(deprecated) on(type: "BLECharacteristicChange", callback: Callback<BLECharacteristic>): void 订阅蓝牙低功耗设备的特征值变化事件。需要先调用setNotifyCharacteristicChanged接口才能接收server端的通知。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.on('BLECharacteristicChange')](js-apis-bluetoothManager.md#onblecharacteristicchange)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3088,12 +3027,15 @@ device.on('BLECharacteristicChange', CharacteristicChange); ``` -### off('BLECharacteristicChange') +### off('BLECharacteristicChange')(deprecated) off(type: "BLECharacteristicChange", callback?: Callback<BLECharacteristic>): void 取消订阅蓝牙低功耗设备的特征值变化事件。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.off('BLECharacteristicChange')](js-apis-bluetoothManager.md#offblecharacteristicchange)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3117,12 +3059,15 @@ device.off('BLECharacteristicChange'); ``` -### on('BLEConnectionStateChange') +### on('BLEConnectionStateChange')(deprecated) on(type: "BLEConnectionStateChange", callback: Callback<BLEConnectChangedState>): void client端订阅蓝牙低功耗设备的连接状态变化事件。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.on('BLEConnectionStateChange')](js-apis-bluetoothManager.md#onbleconnectionstatechange)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3150,12 +3095,15 @@ device.on('BLEConnectionStateChange', ConnectStateChanged); ``` -### off('BLEConnectionStateChange') +### off('BLEConnectionStateChange')(deprecated) off(type: "BLEConnectionStateChange", callback?: Callback<BLEConnectChangedState>): void 取消订阅蓝牙低功耗设备的连接状态变化事件。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.off('BLEConnectionStateChange')](js-apis-bluetoothManager.md#offbleconnectionstatechange)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3179,12 +3127,15 @@ device.off('BLEConnectionStateChange'); ``` -### getDeviceName +### getDeviceName(deprecated) getDeviceName(callback: AsyncCallback<string>): void client获取远端蓝牙低功耗设备名。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.getDeviceName](js-apis-bluetoothManager.md#getdevicename)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3211,12 +3162,15 @@ let deviceName = gattClient.getDeviceName((err, data)=> { ``` -### getDeviceName +### getDeviceName(deprecated) getDeviceName(): Promise<string> client获取远端蓝牙低功耗设备名。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.getDeviceName](js-apis-bluetoothManager.md#getdevicename-1)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3239,12 +3193,15 @@ let deviceName = gattClient.getDeviceName().then((data) => { ``` -### getRssiValue +### getRssiValue(deprecated) getRssiValue(callback: AsyncCallback<number>): void client获取远端蓝牙低功耗设备的信号强度 (Received Signal Strength Indication, RSSI),调用[connect](#connect)接口连接成功后才能使用。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.getRssiValue](js-apis-bluetoothManager.md#getrssivalue)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3272,12 +3229,15 @@ let rssi = gattClient.getRssiValue((err, data)=> { ``` -### getRssiValue +### getRssiValue(deprecated) getRssiValue(): Promise<number> client获取远端蓝牙低功耗设备的信号强度 (Received Signal Strength Indication, RSSI),调用[connect](#connect)接口连接成功后才能使用。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattClientDevice.getRssiValue](js-apis-bluetoothManager.md#getrssivalue-1)替代。 + **需要权限**:ohos.permission.USE_BLUETOOTH **系统能力**:SystemCapability.Communication.Bluetooth.Core。 @@ -3298,10 +3258,13 @@ let rssi = gattClient.getRssiValue().then((data) => { }) ``` -## ScanMode8+ +## ScanMode8+(deprecated) 枚举,扫描模式。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.ScanMode](js-apis-bluetoothManager.md#scanmode)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 值 | 说明 | @@ -3313,10 +3276,13 @@ let rssi = gattClient.getRssiValue().then((data) => { | SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE | 4 | 可连接general发现模式。 | | SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE | 5 | 可连接limited发现模式。 | -## BondState8+ +## BondState8+(deprecated) 枚举,配对状态。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.BondState](js-apis-bluetoothManager.md#bondstate)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 值 | 说明 | @@ -3326,10 +3292,13 @@ let rssi = gattClient.getRssiValue().then((data) => { | BOND_STATE_BONDED | 2 | 已配对。 | -## SppOption8+ +## SppOption8+(deprecated) 描述spp的配置参数。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.SppOption](js-apis-bluetoothManager.md#sppoption)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 类型 | 可读 | 可写 | 说明 | @@ -3339,10 +3308,13 @@ let rssi = gattClient.getRssiValue().then((data) => { | type | [SppType](#spptype) | 是 | 是 | Spp链路类型。 | -## SppType8+ +## SppType8+(deprecated) 枚举,Spp链路类型。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.SppType](js-apis-bluetoothManager.md#spptype)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 值 | 说明 | @@ -3350,10 +3322,13 @@ let rssi = gattClient.getRssiValue().then((data) => { | SPP_RFCOMM | 0 | 表示rfcomm链路类型。 | -## GattService +## GattService(deprecated) 描述service的接口参数定义。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.GattService](js-apis-bluetoothManager.md#gattservice)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 类型 | 可读 | 可写 | 说明 | @@ -3364,10 +3339,13 @@ let rssi = gattClient.getRssiValue().then((data) => { | includeServices | Array<[GattService](#gattservice)> | 是 | 是 | 当前服务依赖的其它服务。 | -## BLECharacteristic +## BLECharacteristic(deprecated) 描述characteristic的接口参数定义 。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.BLECharacteristic](js-apis-bluetoothManager.md#blecharacteristic)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 类型 | 可读 | 可写 | 说明 | @@ -3378,10 +3356,13 @@ let rssi = gattClient.getRssiValue().then((data) => { | descriptors | Array<[BLEDescriptor](#bledescriptor)> | 是 | 是 | 特定特征的描述符列表。 | -## BLEDescriptor +## BLEDescriptor(deprecated) 描述descriptor的接口参数定义 。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.BLEDescriptor](js-apis-bluetoothManager.md#bledescriptor)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 类型 | 可读 | 可写 | 说明 | @@ -3392,10 +3373,13 @@ let rssi = gattClient.getRssiValue().then((data) => { | descriptorValue | ArrayBuffer | 是 | 是 | 描述符对应的二进制值。 | -## NotifyCharacteristic +## NotifyCharacteristic(deprecated) 描述server端特征值变化时发送的特征通知参数定义。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.NotifyCharacteristic](js-apis-bluetoothManager.md#notifycharacteristic)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 类型 | 可读 | 可写 | 说明 | @@ -3406,10 +3390,13 @@ let rssi = gattClient.getRssiValue().then((data) => { | confirm | boolean | 是 | 是 | 如果是notification则对端回复确认设置为true,如果是indication则对端不需要回复确认设置为false。 | -## CharacteristicReadReq +## CharacteristicReadReq(deprecated) 描述server端订阅后收到的特征值读请求事件参数结构。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.CharacteristicReadRequest](js-apis-bluetoothManager.md#characteristicreadrequest)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 类型 | 可读 | 可写 | 说明 | @@ -3421,10 +3408,13 @@ let rssi = gattClient.getRssiValue().then((data) => { | serviceUuid | string | 是 | 否 | 特定服务(service)的UUID,例如:00001888-0000-1000-8000-00805f9b34fb。 | -## CharacteristicWriteReq +## CharacteristicWriteReq(deprecated) 描述server端订阅后收到的特征值写请求事件参数结构。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.CharacteristicWriteRequest](js-apis-bluetoothManager.md#characteristicwriterequest)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 类型 | 可读 | 可写 | 说明 | @@ -3437,10 +3427,13 @@ let rssi = gattClient.getRssiValue().then((data) => { | serviceUuid | string | 是 | 否 | 特定服务(service)的UUID,例如:00001888-0000-1000-8000-00805f9b34fb。 | -## DescriptorReadReq +## DescriptorReadReq(deprecated) 描述server端订阅后收到的描述符读请求事件参数结构。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.DescriptorReadRequest](js-apis-bluetoothManager.md#descriptorreadrequest)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 类型 | 可读 | 可写 | 说明 | @@ -3453,10 +3446,13 @@ let rssi = gattClient.getRssiValue().then((data) => { | serviceUuid | string | 是 | 否 | 特定服务(service)的UUID,例如:00001888-0000-1000-8000-00805f9b34fb。 | -## DescriptorWriteReq +## DescriptorWriteReq(deprecated) 描述server端订阅后收到的描述符写请求事件参数结构。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.DescriptorWriteRequest](js-apis-bluetoothManager.md#descriptorwriterequest)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 类型 | 可读 | 可写 | 说明 | @@ -3472,10 +3468,13 @@ let rssi = gattClient.getRssiValue().then((data) => { | serviceUuid | string | 是 | 否 | 特定服务(service)的UUID,例如:00001888-0000-1000-8000-00805f9b34fb。 | -## ServerResponse +## ServerResponse(deprecated) 描述server端回复client端读/写请求的响应参数结构。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.ServerResponse](js-apis-bluetoothManager.md#serverresponse)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 类型 | 可读 | 可写 | 说明 | @@ -3487,10 +3486,13 @@ let rssi = gattClient.getRssiValue().then((data) => { | value | ArrayBuffer | 是 | 否 | 表示回复响应的二进制数据。 | -## BLEConnectChangedState +## BLEConnectChangedState(deprecated) 描述Gatt profile连接状态 。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.BLEConnectChangedState](js-apis-bluetoothManager.md#bleconnectchangedstate)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 类型 | 可读 | 可写 | 说明 | @@ -3499,10 +3501,13 @@ let rssi = gattClient.getRssiValue().then((data) => { | state | [ProfileConnectionState](#profileconnectionstate) | 是 | 是 | 表示BLE连接状态的枚举。 | -## ProfileConnectionState +## ProfileConnectionState(deprecated) 枚举,蓝牙设备的profile连接状态。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.ProfileConnectionState](js-apis-bluetoothManager.md#profileconnectionstate)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 值 | 说明 | @@ -3513,10 +3518,13 @@ let rssi = gattClient.getRssiValue().then((data) => { | STATE_DISCONNECTING | 3 | 表示profile正在断连。 | -## ScanFilter +## ScanFilter(deprecated) 扫描过滤参数。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.ScanFilter](js-apis-bluetoothManager.md#scanfilter)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 类型 | 可读 | 可写 | 说明 | @@ -3524,20 +3532,15 @@ let rssi = gattClient.getRssiValue().then((data) => { | deviceId | string | 是 | 是 | 表示过滤的BLE设备地址,例如:"XX:XX:XX:XX:XX:XX"。 | | name | string | 是 | 是 | 表示过滤的BLE设备名。 | | serviceUuid | string | 是 | 是 | 表示过滤包含该UUID服务的设备,例如:00001888-0000-1000-8000-00805f9b34fb。 | -| serviceUuidMask9+ | string | 是 | 是 | 表示过滤包含该UUID服务掩码的设备,例如:FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF。 | -| serviceSolicitationUuid9+ | string | 是 | 是 | 表示过滤包含该UUID服务请求的设备,例如:00001888-0000-1000-8000-00805F9B34FB。 | -| serviceSolicitationUuidMask9+ | string | 是 | 是 | 表示过滤包含该UUID服务请求掩码的设备,例如:FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF。 | -| serviceData9+ | ArrayBuffer | 是 | 是 | 表示过滤包含该服务相关数据的设备,例如:[0x90,0x00,0xF1,0xF2]。 | -| serviceDataMask9+ | ArrayBuffer | 是 | 是 | 表示过滤包含该服务相关数据掩码的设备,例如:[0xFF,0xFF,0xFF,0xFF]。 | -| manufactureId9+ | number | 是 | 是 | 表示过滤包含该制造商ID的设备,例如:0x0006。 | -| manufactureData9+ | ArrayBuffer | 是 | 是 | 表示过滤包含该制造商相关数据的设备,例如:[0x1F,0x2F,0x3F]。 | -| manufactureDataMask9+ | ArrayBuffer | 是 | 是 | 表示过滤包含该制造商相关数据掩码的设备,例如:[0xFF,0xFF,0xFF]。 | -## ScanOptions +## ScanOptions(deprecated) 扫描的配置参数。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.ScanOptions](js-apis-bluetoothManager.md#scanoptions)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 类型 | 可读 | 可写 | 说明 | @@ -3547,10 +3550,13 @@ let rssi = gattClient.getRssiValue().then((data) => { | matchMode | [MatchMode](#matchmode) | 是 | 是 | 表示硬件的过滤匹配模式,默认值为MATCH_MODE_AGGRESSIVE。 | -## ScanDuty +## ScanDuty(deprecated) 枚举,扫描模式。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.ScanDuty](js-apis-bluetoothManager.md#scanduty)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 值 | 说明 | @@ -3560,10 +3566,13 @@ let rssi = gattClient.getRssiValue().then((data) => { | SCAN_MODE_LOW_LATENCY | 2 | 表示低延迟模式。 | -## MatchMode +## MatchMode(deprecated) 枚举,硬件过滤匹配模式。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.MatchMode](js-apis-bluetoothManager.md#matchmode)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 值 | 说明 | @@ -3572,10 +3581,13 @@ let rssi = gattClient.getRssiValue().then((data) => { | MATCH_MODE_STICKY | 2 | 表示硬件上报扫描结果门限较高,更高的功率门限以及扫描到多次才会上报。 | -## ScanResult +## ScanResult(deprecated) 扫描结果上报数据。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.ScanResult](js-apis-bluetoothManager.md#scanresult)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 类型 | 可读 | 可写 | 说明 | @@ -3585,10 +3597,13 @@ let rssi = gattClient.getRssiValue().then((data) => { | data | ArrayBuffer | 是 | 否 | 表示扫描到的设备发送的广播包。 | -## BluetoothState +## BluetoothState(deprecated) 枚举,蓝牙开关状态。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.BluetoothState](js-apis-bluetoothManager.md#bluetoothstate)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 值 | 说明 | @@ -3602,10 +3617,13 @@ let rssi = gattClient.getRssiValue().then((data) => { | STATE_BLE_TURNING_OFF | 6 | 表示蓝牙正在关闭LE-only模式。 | -## AdvertiseSetting +## AdvertiseSetting(deprecated) 描述蓝牙低功耗设备发送广播的参数。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.AdvertiseSetting](js-apis-bluetoothManager.md#advertisesetting)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 类型 | 可读 | 可写 | 说明 | @@ -3615,10 +3633,13 @@ let rssi = gattClient.getRssiValue().then((data) => { | connectable | boolean | 是 | 是 | 表示是否是可连接广播,默认值设置为true。 | -## AdvertiseData +## AdvertiseData(deprecated) 描述BLE广播数据包的内容。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.AdvertiseData](js-apis-bluetoothManager.md#advertisedata)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 类型 | 可读 | 可写 | 说明 | @@ -3628,10 +3649,13 @@ let rssi = gattClient.getRssiValue().then((data) => { | serviceData | Array<[ServiceData](#servicedata)> | 是 | 是 | 表示要广播的服务数据列表。 | -## ManufactureData +## ManufactureData(deprecated) 描述BLE广播数据包的内容。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.ManufactureData](js-apis-bluetoothManager.md#manufacturedata)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 类型 | 可读 | 可写 | 说明 | @@ -3640,10 +3664,13 @@ let rssi = gattClient.getRssiValue().then((data) => { | manufactureValue | ArrayBuffer | 是 | 是 | 表示制造商发送的制造商数据。 | -## ServiceData +## ServiceData(deprecated) 描述广播包中服务数据内容。 +> **说明:**
+> 从API version 7开始支持,从API version 9开始废弃。建议使用[bluetoothManager.ServiceData](js-apis-bluetoothManager.md#servicedata)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 类型 | 可读 | 可写 | 说明 | @@ -3652,10 +3679,13 @@ let rssi = gattClient.getRssiValue().then((data) => { | serviceValue | ArrayBuffer | 是 | 是 | 表示服务数据。 | -## PinRequiredParam8+ +## PinRequiredParam8+(deprecated) 描述配对请求参数。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.PinRequiredParam](js-apis-bluetoothManager.md#pinrequiredparam)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 类型 | 可读 | 可写 | 说明 | @@ -3664,10 +3694,13 @@ let rssi = gattClient.getRssiValue().then((data) => { | pinCode | string | 是 | 否 | 表示要配对的密钥。 | -## BondStateParam8+ +## BondStateParam8+(deprecated) 描述配对状态参数。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.BondStateParam](js-apis-bluetoothManager.md#bondstateparam)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 类型 | 可读 | 可写 | 说明 | @@ -3676,10 +3709,13 @@ let rssi = gattClient.getRssiValue().then((data) => { | state | BondState | 是 | 否 | 表示配对设备的状态。 | -## StateChangeParam8+ +## StateChangeParam8+(deprecated) 描述profile状态改变参数。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.StateChangeParam](js-apis-bluetoothManager.md#statechangeparam)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 类型 | 可读 | 可写 | 说明 | @@ -3688,10 +3724,13 @@ let rssi = gattClient.getRssiValue().then((data) => { | state | [ProfileConnectionState](#profileconnectionstate) | 是 | 否 | 表示蓝牙设备的profile连接状态。 | -## DeviceClass8+ +## DeviceClass8+(deprecated) 描述蓝牙设备的类别。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.DeviceClass](js-apis-bluetoothManager.md#deviceclass)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 类型 | 可读 | 可写 | 说明 | @@ -3702,10 +3741,13 @@ let rssi = gattClient.getRssiValue().then((data) => { -## MajorClass8+ +## MajorClass8+(deprecated) 枚举,蓝牙设备主要类别。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.MajorClass](js-apis-bluetoothManager.md#majorclass)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 值 | 说明 | @@ -3723,10 +3765,13 @@ let rssi = gattClient.getRssiValue().then((data) => { | MAJOR_UNCATEGORIZED | 0x1F00 | 表示未分类设备。 | -## MajorMinorClass8+ +## MajorMinorClass8+(deprecated) 枚举,主要次要蓝牙设备类别。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.MajorMinorClass](js-apis-bluetoothManager.md#majorminorclass)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 值 | 说明 | @@ -3819,10 +3864,13 @@ let rssi = gattClient.getRssiValue().then((data) => { | HEALTH_PERSONAL_MOBILITY_DEVICE | 0x093C | 表示个人移动健康设备。 | -## PlayingState8+ +## PlayingState8+(deprecated) 枚举,蓝牙A2DP 播放状态。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.PlayingState](js-apis-bluetoothManager.md#playingstate)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 值 | 说明 | @@ -3831,15 +3879,16 @@ let rssi = gattClient.getRssiValue().then((data) => { | STATE_PLAYING | 0x0001 | 表示正在播放。 | -## ProfileId8+ +## ProfileId8+(deprecated) 蓝牙profile枚举,API9新增PROFILE_HID_HOST,PROFILE_PAN_NETWORK。 +> **说明:**
+> 从API version 8开始支持,从API version 9开始废弃。建议使用[bluetoothManager.ProfileId](js-apis-bluetoothManager.md#profileid)替代。 + **系统能力**:SystemCapability.Communication.Bluetooth.Core。 | 名称 | 值 | 说明 | | -------------------------------- | ------ | --------------- | | PROFILE_A2DP_SOURCE | 1 | 表示A2DP profile。 | -| PROFILE_HANDS_FREE_AUDIO_GATEWAY | 4 | 表示HFP profile。 | -| PROFILE_HID_HOST9+ | 6 | 表示HID profile。 | -| PROFILE_PAN_NETWORK9+ | 7 | 表示PAN profile。 | \ No newline at end of file +| PROFILE_HANDS_FREE_AUDIO_GATEWAY | 4 | 表示HFP profile。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-bluetoothManager.md b/zh-cn/application-dev/reference/apis/js-apis-bluetoothManager.md new file mode 100644 index 0000000000000000000000000000000000000000..3ab78fbb0abb3d81e51c405c69f3388b3b0abe45 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-bluetoothManager.md @@ -0,0 +1,4607 @@ +# @ohos.bluetoothManager (蓝牙) + +蓝牙模块提供了基础的传统蓝牙能力以及BLE的扫描、广播等功能。 + +> **说明:** +> +> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + + + +## 导入模块 + +```js +import bluetoothManager from '@ohos.bluetoothManager'; +``` + + +## bluetoothManager.enableBluetooth + +enableBluetooth(): void + +开启蓝牙。 + +**需要权限**:ohos.permission.DISCOVER_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + bluetoothManager.enableBluetooth(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.disableBluetooth + +disableBluetooth(): void + +关闭蓝牙。 + +**需要权限**:ohos.permission.DISCOVER_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + bluetoothManager.disableBluetooth(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.getLocalName + +getLocalName(): string + +获取蓝牙本地设备名称。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**返回值:** + +| 类型 | 说明 | +| ------ | --------- | +| string | 蓝牙本地设备名称。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + let localName = bluetoothManager.getLocalName(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.getState + +getState(): BluetoothState + +获取蓝牙开关状态。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**返回值:** + +| 类型 | 说明 | +| --------------------------------- | --------- | +| [BluetoothState](#bluetoothstate) | 表示蓝牙开关状态。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + let state = bluetoothManager.getState(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.getBtConnectionState + +getBtConnectionState(): ProfileConnectionState + +获取蓝牙本端的Profile连接状态,例如:任意一个支持的Profile连接状态为已连接,则此接口返回状态为已连接。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**返回值:** + +| 类型 | 说明 | +| ---------------------------------------- | ------------------- | +| [ProfileConnectionState](#profileconnectionstate) | 表示蓝牙设备的Profile连接状态。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + let connectionState = bluetoothManager.getBtConnectionState(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.setLocalName + +setLocalName(name: string): void + +设置蓝牙本地设备名称。 + +**需要权限**:ohos.permission.DISCOVER_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---- | ------ | ---- | --------------------- | +| name | string | 是 | 要设置的蓝牙名称,最大长度为248字节数。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + bluetoothManager.setLocalName('device_name'); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.pairDevice + +pairDevice(deviceId: string): void + +发起蓝牙配对。 + +**需要权限**:ohos.permission.DISCOVER_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ----------------------------------- | +| deviceId | string | 是 | 表示配对的远端设备地址,例如:"XX:XX:XX:XX:XX:XX"。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + // 实际的地址可由扫描流程获取 + bluetoothManager.pairDevice("XX:XX:XX:XX:XX:XX"); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.getProfileConnectionState + +getProfileConnectionState(profileId: ProfileId): ProfileConnectionState + +依据ProfileId获取指定profile的连接状态。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | --------- | ---- | ------------------------------------- | +| ProfileId | profileId | 是 | 表示profile的枚举值,例如:PROFILE_A2DP_SOURCE。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------- | ------------------- | +| [ProfileConnectionState](#profileconnectionstate) | profile的连接状态。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + let result = bluetoothManager.getProfileConnectionState(bluetoothManager.ProfileId.PROFILE_A2DP_SOURCE); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.cancelPairedDevice + +cancelPairedDevice(deviceId: string): void + +删除配对的远程设备。 + +**系统接口**:此接口为系统接口。 + +**需要权限**:ohos.permission.DISCOVER_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ------------------------------------- | +| deviceId | string | 是 | 表示要删除的远程设备的地址,例如:"XX:XX:XX:XX:XX:XX"。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + bluetoothManager.cancelPairedDevice("XX:XX:XX:XX:XX:XX"); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.getRemoteDeviceName + +getRemoteDeviceName(deviceId: string): string + +获取对端蓝牙设备的名称。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | --------------------------------- | +| deviceId | string | 是 | 表示远程设备的地址,例如:"XX:XX:XX:XX:XX:XX"。 | + +**返回值:** + +| 类型 | 说明 | +| ------ | ------------- | +| string | 以字符串格式返回设备名称。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + let remoteDeviceName = bluetoothManager.getRemoteDeviceName("XX:XX:XX:XX:XX:XX"); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.getRemoteDeviceClass + +getRemoteDeviceClass(deviceId: string): DeviceClass + +获取对端蓝牙设备的类别。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | --------------------------------- | +| deviceId | string | 是 | 表示远程设备的地址,例如:"XX:XX:XX:XX:XX:XX"。 | + +**返回值:** + +| 类型 | 说明 | +| --------------------------- | -------- | +| [DeviceClass](#deviceclass) | 远程设备的类别。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + let remoteDeviceClass = bluetoothManager.getRemoteDeviceClass("XX:XX:XX:XX:XX:XX"); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.getPairedDevices + +getPairedDevices(): Array<string> + +获取蓝牙配对列表。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ------------- | +| Array<string> | 已配对蓝牙设备的地址列表。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + let devices = bluetoothManager.getPairedDevices(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.setBluetoothScanMode + +setBluetoothScanMode(mode: ScanMode, duration: number): void + +设置蓝牙扫描模式,可以被远端设备发现。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------- | ---- | ---------------------------- | +| mode | [ScanMode](#scanmode) | 是 | 蓝牙扫描模式。 | +| duration | number | 是 | 设备可被发现的持续时间,单位为毫秒;设置为0则持续可发现。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + // 设置为可连接可发现才可被远端设备扫描到,可以连接。 + bluetoothManager.setBluetoothScanMode(bluetoothManager.ScanMode.SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE, 100); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.getBluetoothScanMode + +getBluetoothScanMode(): ScanMode + +获取蓝牙扫描模式。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**返回值:** + +| 类型 | 说明 | +| --------------------- | ------- | +| [ScanMode](#scanmode) | 蓝牙扫描模式。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + let scanMode = bluetoothManager.getBluetoothScanMode(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.startBluetoothDiscovery + +startBluetoothDiscovery(): void + +开启蓝牙扫描,可以发现远端设备。 + +**需要权限**:ohos.permission.DISCOVER_BLUETOOTH 和 ohos.permission.LOCATION 和 ohos.permission.APPROXIMATELY_LOCATION + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**示例:** + +```js +let deviceId; +function onReceiveEvent(data) { + deviceId = data; +} +try { + bluetoothManager.on('bluetoothDeviceFind', onReceiveEvent); + bluetoothManager.startBluetoothDiscovery(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.stopBluetoothDiscovery + +stopBluetoothDiscovery(): void + +关闭蓝牙扫描。 + +**需要权限**:ohos.permission.DISCOVER_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + bluetoothManager.stopBluetoothDiscovery(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.setDevicePairingConfirmation + +setDevicePairingConfirmation(device: string, accept: boolean): void + +设置设备配对请求确认。 + +**需要权限**:ohos.permission.MANAGE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------- | ---- | -------------------------------- | +| device | string | 是 | 表示远端设备地址,例如:"XX:XX:XX:XX:XX:XX"。 | +| accept | boolean | 是 | 接受配对请求设置为true,否则设置为false。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**示例:** + +```js + +try { + // 订阅“pinRequired”配对请求事件,收到远端配对请求后设置配对确认 + function onReceivePinRequiredEvent(data) { // data为配对请求的入参,配对请求参数 + console.info('pin required = '+ JSON.stringify(data)); + bluetoothManager.setDevicePairingConfirmation(data.deviceId, true); + } + bluetoothManager.on("pinRequired", onReceivePinRequiredEvent); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.setDevicePinCode10+ + +setDevicePinCode(device: string, code: string, callback: AsyncCallback<void>): void + +当蓝牙配对类型[PinType](#pintype10)为PIN_TYPE_ENTER_PIN_CODE或PIN_TYPE_PIN_16_DIGITS时调用此接口,请求用户输入PIN码。 + +**需要权限**:ohos.permission.MANAGE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------- | ---- | -------------------------------- | +| device | string | 是 | 表示远端设备MAC地址,例如:"XX:XX:XX:XX:XX:XX"。 | +| code | string | 是 | 用户输入的PIN码。 | +| callback | AsyncCallback<void> | 是 | 回调函数,当设置PinCode成功,err为undefined,否则为错误对象。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**示例:** + +```js +//callback +try { + bluetoothManager.setDevicePinCode('11:22:33:44:55:66', '12345', (err, data) => { + console.info('setDevicePinCode,device name err:' + JSON.stringify(err) + ',device name:' + JSON.stringify(data)); + }); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.setDevicePinCode10+ + +setDevicePinCode(device: string, code: string): Promise<void> + +当蓝牙配对类型[PinType](#pintype10)为PIN_TYPE_ENTER_PIN_CODE或PIN_TYPE_PIN_16_DIGITS时调用此接口,请求用户输入PIN码。 + +**需要权限**:ohos.permission.MANAGE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------- | ---- | -------------------------------- | +| device | string | 是 | 表示远端设备MAC地址,例如:"XX:XX:XX:XX:XX:XX"。 | +| code | string | 是 | 用户输入的PIN码。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ------------- | +| Promise<void> | 返回promise对象。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**示例:** + +```js +//promise +try { + bluetoothManager.setDevicePinCode('11:22:33:44:55:66', '12345').then(() => { + console.info('setDevicePinCode'); + }, error => { + console.info('setDevicePinCode: errCode:' + error.code + ',errMessage' + error.message); + }) + +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.on('bluetoothDeviceFind') + +on(type: "bluetoothDeviceFind", callback: Callback<Array<string>>): void + +订阅蓝牙设备发现上报事件。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------- | ---- | -------------------------------------- | +| type | string | 是 | 填写"bluetoothDeviceFind"字符串,表示蓝牙设备发现事件。 | +| callback | Callback<Array<string>> | 是 | 表示回调函数的入参,发现的设备集合。回调函数由用户创建通过该接口注册。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900099 | Operation failed. | + +**示例:** + +```js +function onReceiveEvent(data) { // data为蓝牙设备地址集合 + console.info('bluetooth device find = '+ JSON.stringify(data)); +} +try { + bluetoothManager.on('bluetoothDeviceFind', onReceiveEvent); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.off('bluetoothDeviceFind') + +off(type: "bluetoothDeviceFind", callback?: Callback<Array<string>>): void + +取消订阅蓝牙设备发现上报事件。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------- | ---- | ---------------------------------------- | +| type | string | 是 | 填写"bluetoothDeviceFind"字符串,表示蓝牙设备发现事件。 | +| callback | Callback<Array<string>> | 否 | 表示取消订阅蓝牙设备发现事件上报。不填该参数则取消订阅该type对应的所有回调。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900099 | Operation failed. | + +**示例:** + +```js +function onReceiveEvent(data) { + console.info('bluetooth device find = '+ JSON.stringify(data)); +} +try { + bluetoothManager.on('bluetoothDeviceFind', onReceiveEvent); + bluetoothManager.off('bluetoothDeviceFind', onReceiveEvent); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.on('pinRequired') + +on(type: "pinRequired", callback: Callback<PinRequiredParam>): void + +订阅远端蓝牙设备的配对请求事件。 + +**需要权限**:ohos.permission.DISCOVER_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | -------------------------------- | +| type | string | 是 | 填写"pinRequired"字符串,表示配对请求事件。 | +| callback | Callback<[PinRequiredParam](#pinrequiredparam)> | 是 | 表示回调函数的入参,配对请求。回调函数由用户创建通过该接口注册。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900099 | Operation failed. | + +**示例:** + +```js +function onReceiveEvent(data) { // data为配对请求参数 + console.info('pin required = '+ JSON.stringify(data)); +} +try { + bluetoothManager.on('pinRequired', onReceiveEvent); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.off('pinRequired') + +off(type: "pinRequired", callback?: Callback<PinRequiredParam>): void + +取消订阅远端蓝牙设备的配对请求事件。 + +**需要权限**:ohos.permission.DISCOVER_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | 是 | 填写"pinRequired"字符串,表示配对请求事件。 | +| callback | Callback<[PinRequiredParam](#pinrequiredparam)> | 否 | 表示取消订阅蓝牙配对请求事件上报,入参为配对请求参数。不填该参数则取消订阅该type对应的所有回调。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900099 | Operation failed. | + +**示例:** + +```js +function onReceiveEvent(data) { + console.info('pin required = '+ JSON.stringify(data)); +} +try { + bluetoothManager.on('pinRequired', onReceiveEvent); + bluetoothManager.off('pinRequired', onReceiveEvent); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.on('bondStateChange') + +on(type: "bondStateChange", callback: Callback<BondStateParam>): void + +订阅蓝牙配对状态改变事件。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ------------------------------------ | +| type | string | 是 | 填写"bondStateChange"字符串,表示蓝牙配对状态改变事件。 | +| callback | Callback<[BondStateParam](#BondStateParam)> | 是 | 表示回调函数的入参,配对的状态。回调函数由用户创建通过该接口注册。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900099 | Operation failed. | + +**示例:** + +```js +function onReceiveEvent(data) { // data为回调函数入参,表示配对的状态 + console.info('pair state = '+ JSON.stringify(data)); +} +try { + bluetoothManager.on('bondStateChange', onReceiveEvent); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.off('bondStateChange') + +off(type: "bondStateChange", callback?: Callback<BondStateParam>): void + +取消订阅蓝牙配对状态改变事件。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | 是 | 填写"bondStateChange"字符串,表示蓝牙配对状态改变事件。 | +| callback | Callback<[BondStateParam](#BondStateParam)> | 否 | 表示取消订阅蓝牙配对状态改变事件上报。不填该参数则取消订阅该type对应的所有回调。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900099 | Operation failed. | + +**示例:** + +```js +function onReceiveEvent(data) { + console.info('bond state = '+ JSON.stringify(data)); +} +try { + bluetoothManager.on('bondStateChange', onReceiveEvent); + bluetoothManager.off('bondStateChange', onReceiveEvent); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.on('stateChange') + +on(type: "stateChange", callback: Callback<BluetoothState>): void + +订阅蓝牙连接状态改变事件。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | -------------------------------- | +| type | string | 是 | 填写"stateChange"字符串,表示蓝牙状态改变事件。 | +| callback | Callback<[BluetoothState](#bluetoothstate)> | 是 | 表示回调函数的入参,蓝牙状态。回调函数由用户创建通过该接口注册。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900099 | Operation failed. | + +**示例:** + +```js +function onReceiveEvent(data) { + console.info('bluetooth state = '+ JSON.stringify(data)); +} +try { + bluetoothManager.on('stateChange', onReceiveEvent); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.off('stateChange') + +off(type: "stateChange", callback?: Callback<BluetoothState>): void + +取消订阅蓝牙连接状态改变事件。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | 是 | 填写"stateChange"字符串,表示蓝牙状态改变事件。 | +| callback | Callback<[BluetoothState](#bluetoothstate)> | 否 | 表示取消订阅蓝牙状态改变事件上报。不填该参数则取消订阅该type对应的所有回调。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900099 | Operation failed. | + +**示例:** + +```js +function onReceiveEvent(data) { + console.info('bluetooth state = '+ JSON.stringify(data)); +} +try { + bluetoothManager.on('stateChange', onReceiveEvent); + bluetoothManager.off('stateChange', onReceiveEvent); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.sppListen + +sppListen(name: string, option: SppOption, callback: AsyncCallback<number>): void + +创建一个服务端监听Socket。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------- | ---- | ----------------------- | +| name | string | 是 | 服务的名称。 | +| option | [SppOption](#sppoption) | 是 | spp监听配置参数。 | +| callback | AsyncCallback<number> | 是 | 表示回调函数的入参,服务端Socket的id。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**示例:** + +```js +let serverNumber = -1; +function serverSocket(code, number) { + console.log('bluetooth error code: ' + code.code); + if (code.code == 0) { + console.log('bluetooth serverSocket Number: ' + number); + serverNumber = number; + } +} + +let sppOption = {uuid: '00001810-0000-1000-8000-00805F9B34FB', secure: false, type: 0}; +try { + bluetoothManager.sppListen('server1', sppOption, serverSocket); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.sppAccept + +sppAccept(serverSocket: number, callback: AsyncCallback<number>): void + +服务端监听socket等待客户端连接。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------------ | --------------------------- | ---- | ----------------------- | +| serverSocket | number | 是 | 服务端socket的id。 | +| callback | AsyncCallback<number> | 是 | 表示回调函数的入参,客户端socket的id。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**示例:** + +```js +let serverNumber = -1; +function serverSocket(code, number) { + console.log('bluetooth error code: ' + code.code); + if (code.code == 0) { + console.log('bluetooth serverSocket Number: ' + number); + serverNumber = number; + } +} +let clientNumber = -1; +function acceptClientSocket(code, number) { + console.log('bluetooth error code: ' + code.code); + if (code.code == 0) { + console.log('bluetooth clientSocket Number: ' + number); + // 获取的clientNumber用作服务端后续读/写操作socket的id。 + clientNumber = number; + } +} +try { + bluetoothManager.sppAccept(serverNumber, acceptClientSocket); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.sppConnect + +sppConnect(device: string, option: SppOption, callback: AsyncCallback<number>): void + +客户端向远端设备发起spp连接。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------- | ---- | ------------------------------ | +| device | string | 是 | 对端设备地址,例如:"XX:XX:XX:XX:XX:XX"。 | +| option | [SppOption](#sppoption) | 是 | spp客户端连接配置参数。 | +| callback | AsyncCallback<number> | 是 | 表示回调函数的入参,客户端socket的id。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**示例:** + +```js + +let clientNumber = -1; +function clientSocket(code, number) { + if (code.code != 0) { + return; + } + console.log('bluetooth serverSocket Number: ' + number); + // 获取的clientNumber用作客户端后续读/写操作socket的id。 + clientNumber = number; +} +let sppOption = {uuid: '00001810-0000-1000-8000-00805F9B34FB', secure: false, type: 0}; +try { + bluetoothManager.sppConnect('XX:XX:XX:XX:XX:XX', sppOption, clientSocket); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.sppCloseServerSocket + +sppCloseServerSocket(socket: number): void + +关闭服务端监听Socket,入参socket由sppListen接口返回。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | --------------- | +| socket | number | 是 | 服务端监听socket的id。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900099 | Operation failed. | + +**示例:** + +```js +let serverNumber = -1; +function serverSocket(code, number) { + console.log('bluetooth error code: ' + code.code); + if (code.code == 0) { + console.log('bluetooth serverSocket Number: ' + number); + serverNumber = number; + } +} +try { + bluetoothManager.sppCloseServerSocket(serverNumber); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.sppCloseClientSocket + +sppCloseClientSocket(socket: number): void + +关闭客户端socket,入参socket由sppAccept或sppConnect接口获取。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------------- | +| 参数名 | 类型 | 必填 | 说明 | +| socket | number | 是 | 客户端socket的id。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900099 | Operation failed. | + +**示例:** + +```js +let clientNumber = -1; +function clientSocket(code, number) { + if (code.code != 0) { + return; + } + console.log('bluetooth serverSocket Number: ' + number); + // 获取的clientNumber用作客户端后续读/写操作socket的id。 + clientNumber = number; +} +try { + bluetoothManager.sppCloseClientSocket(clientNumber); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.sppWrite + +sppWrite(clientSocket: number, data: ArrayBuffer): void + +通过socket向远端发送数据,入参clientSocket由sppAccept或sppConnect接口获取 。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------------ | ----------- | ---- | ------------- | +| clientSocket | number | 是 | 客户端socket的id。 | +| data | ArrayBuffer | 是 | 写入的数据。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2901054 | IO error. | +|2900099 | Operation failed. | + +**示例:** + +```js +let clientNumber = -1; +function clientSocket(code, number) { + if (code.code != 0) { + return; + } + console.log('bluetooth serverSocket Number: ' + number); + // 获取的clientNumber用作客户端后续读/写操作socket的id。 + clientNumber = number; +} +let arrayBuffer = new ArrayBuffer(8); +let data = new Uint8Array(arrayBuffer); +data[0] = 123; +try { + bluetoothManager.sppWrite(clientNumber, arrayBuffer); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.on('sppRead') + +on(type: "sppRead", clientSocket: number, callback: Callback<ArrayBuffer>): void + +订阅spp读请求事件,入参clientSocket由sppAccept或sppConnect接口获取。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------------ | --------------------------- | ---- | -------------------------- | +| type | string | 是 | 填写"sppRead"字符串,表示spp读请求事件。 | +| clientSocket | number | 是 | 客户端socket的id。 | +| callback | Callback<ArrayBuffer> | 是 | 表示回调函数的入参,读取到的数据。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2901054 | IO error. | +|2900099 | Operation failed. | + +**示例:** + +```js +let clientNumber = -1; +function clientSocket(code, number) { + if (code.code != 0) { + return; + } + console.log('bluetooth serverSocket Number: ' + number); + // 获取的clientNumber用作客户端后续读/写操作socket的id。 + clientNumber = number; +} +function dataRead(dataBuffer) { + let data = new Uint8Array(dataBuffer); + console.log('bluetooth data is: ' + data[0]); +} +try { + bluetoothManager.on('sppRead', clientNumber, dataRead); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.off('sppRead') + +off(type: "sppRead", clientSocket: number, callback?: Callback<ArrayBuffer>): void + +取消订阅spp读请求事件,入参clientSocket由sppAccept或sppConnect接口获取。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------------ | --------------------------- | ---- | ---------------------------------------- | +| type | string | 是 | 填写"sppRead"字符串,表示spp读请求事件。 | +| clientSocket | number | 是 | 客户端Socket的id。 | +| callback | Callback<ArrayBuffer> | 否 | 表示取消订阅spp读请求事件上报。不填该参数则取消订阅该type对应的所有回调。 | + +**示例:** + +```js +let clientNumber = -1; +function clientSocket(code, number) { + if (code.code != 0) { + return; + } + console.log('bluetooth serverSocket Number: ' + number); + // 获取的clientNumber用作客户端后续读/写操作socket的id。 + clientNumber = number; +} +try { + bluetoothManager.off('sppRead', clientNumber); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + +## bluetoothManager.getProfileInstance + +getProfileInstance(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfile | HidHostProfile | PanProfile + +通过ProfileId,获取profile的对象实例,API9新增了HidHostProfile,PanProfile。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | --------- | ---- | ------------------------------------- | +| profileId | [ProfileId](#ProfileId) | 是 | 表示profile的枚举值,例如:PROFILE_A2DP_SOURCE。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | +| [A2dpSourceProfile](#a2dpsourceprofile)或 [HandsFreeAudioGatewayProfile](#handsfreeaudiogatewayprofile)或[HidHostProfile](#hidhostprofile)或[PanProfile](#panprofile) | 对应的profile的对象实例,当前支持A2dpSourceProfile/HandsFreeAudioGatewayProfile/HidHostProfile/PanProfile。 | + +**示例:** + +```js +try { + let hidHost = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_HID_HOST); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## bluetoothManager.BLE + +### bluetoothManager.BLE.createGattServer + +createGattServer(): GattServer + +创建一个可使用的GattServer实例。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**返回值:** + +| 类型 | 说明 | +| ------------------------- | ------------------------------------ | +| [GattServer](#gattserver) | server端类,使用server端方法之前需要创建该类的实例进行操作。 | + +**示例:** + +```js +let gattServer = bluetoothManager.BLE.createGattServer(); +``` + + +### bluetoothManager.BLE.createGattClientDevice + +createGattClientDevice(deviceId: string): GattClientDevice + +创建一个可使用的GattClientDevice实例。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ------------------------------------ | +| deviceId | string | 是 | 对端设备地址, 例如:"XX:XX:XX:XX:XX:XX"。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------- | ------------------------------------ | +| [GattClientDevice](#gattclientdevice) | client端类,使用client端方法之前需要创建该类的实例进行操作。 | + +**示例:** + +```js +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### bluetoothManager.BLE.getConnectedBLEDevices + +getConnectedBLEDevices(): Array<string> + +获取和当前设备连接的BLE设备。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ------------------- | +| Array<string> | 返回当前设备作为Server端时连接BLE设备地址集合。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + let result = bluetoothManager.BLE.getConnectedBLEDevices(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### bluetoothManager.BLE.startBLEScan + +startBLEScan(filters: Array<ScanFilter>, options?: ScanOptions): void + +发起BLE扫描流程。 + +**需要权限**:ohos.permission.DISCOVER_BLUETOOTH 和 ohos.permission.MANAGE_BLUETOOTH 和 ohos.permission.LOCATION 和 ohos.permission.APPROXIMATELY_LOCATION + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | -------------------------------------- | ---- | ----------------------------------- | +| filters | Array<[ScanFilter](#scanfilter)> | 是 | 表示扫描结果过滤策略集合,如果不使用过滤的方式,该参数设置为null。 | +| options | [ScanOptions](#scanoptions) | 否 | 表示扫描的参数配置,可选参数。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**示例:** + +```js +function onReceiveEvent(data) { + console.info('BLE scan device find result = '+ JSON.stringify(data)); +} +try { + bluetoothManager.BLE.on("BLEDeviceFind", onReceiveEvent); + bluetoothManager.BLE.startBLEScan( + [{ + deviceId:"XX:XX:XX:XX:XX:XX", + name:"test", + serviceUuid:"00001888-0000-1000-8000-00805f9b34fb" + }], + { + interval: 500, + dutyMode: bluetoothManager.ScanDuty.SCAN_MODE_LOW_POWER, + matchMode: bluetoothManager.MatchMode.MATCH_MODE_AGGRESSIVE, + } + ); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### bluetoothManager.BLE.stopBLEScan + +stopBLEScan(): void + +停止BLE扫描流程。 + +**需要权限**:ohos.permission.DISCOVER_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + bluetoothManager.BLE.stopBLEScan(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### bluetoothManager.BLE.on('BLEDeviceFind') + +on(type: "BLEDeviceFind", callback: Callback<Array<ScanResult>>): void + +订阅BLE设备发现上报事件。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ----------------------------------- | +| type | string | 是 | 填写"BLEDeviceFind"字符串,表示BLE设备发现事件。 | +| callback | Callback<Array<[ScanResult](#scanresult)>> | 是 | 表示回调函数的入参,发现的设备集合。回调函数由用户创建通过该接口注册。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900099 | Operation failed. | + +**示例:** + +```js +function onReceiveEvent(data) { + console.info('bluetooth device find = '+ JSON.stringify(data)); +} +try { + bluetoothManager.BLE.on('BLEDeviceFind', onReceiveEvent); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### bluetoothManager.BLE.off('BLEDeviceFind') + +off(type: "BLEDeviceFind", callback?: Callback<Array<ScanResult>>): void + +取消订阅BLE设备发现上报事件。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | 是 | 填写"BLEDeviceFind"字符串,表示BLE设备发现事件。 | +| callback | Callback<Array<[ScanResult](#scanresult)>> | 否 | 表示取消订阅BLE设备发现事件上报。不填该参数则取消订阅该type对应的所有回调。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900099 | Operation failed. | + +**示例:** + +```js +function onReceiveEvent(data) { + console.info('bluetooth device find = '+ JSON.stringify(data)); +} +try { + bluetoothManager.BLE.on('BLEDeviceFind', onReceiveEvent); + bluetoothManager.BLE.off('BLEDeviceFind', onReceiveEvent); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## BaseProfile + +profile基类。 + + +### getConnectionDevices + +getConnectionDevices(): Array<string> + +获取已连接设备列表。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ------------- | +| Array<string> | 返回已连接设备的地址列表。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + let a2dpSrc = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_A2DP_SOURCE) as bluetoothManager.A2dpSourceProfile; + let retArray = a2dpSrc.getConnectionDevices(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + +### getDeviceState + +getDeviceState(device: string): ProfileConnectionState + +获取设备profile的连接状态。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------- | +| device | string | 是 | 远端设备地址。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------- | ----------------------- | +| [ProfileConnectionState](#profileconnectionstate) | 返回profile的连接状态。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + let a2dpSrc = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_A2DP_SOURCE) as bluetoothManager.A2dpSourceProfile; + let ret = a2dpSrc.getDeviceState('XX:XX:XX:XX:XX:XX'); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + +## A2dpSourceProfile + +使用A2dpSourceProfile方法之前需要创建该类的实例进行操作,通过getProfile()方法构造此实例。 + + +### connect + +connect(device: string): void + +发起设备的A2dp服务连接请求。 + +**需要权限**:ohos.permission.DISCOVER_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------- | +| device | string | 是 | 远端设备地址。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + let a2dpSrc = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_A2DP_SOURCE) as bluetoothManager.A2dpSourceProfile; + a2dpSrc.connect('XX:XX:XX:XX:XX:XX'); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### disconnect + +disconnect(device: string): void + +断开设备的a2dp服务连接。 + +**需要权限**:ohos.permission.DISCOVER_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------- | +| device | string | 是 | 远端设备地址。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + let a2dpSrc = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_A2DP_SOURCE) as bluetoothManager.A2dpSourceProfile; + a2dpSrc.disconnect('XX:XX:XX:XX:XX:XX'); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### on('connectionStateChange') + +on(type: "connectionStateChange", callback: Callback<[StateChangeParam](#StateChangeParam)>): void + +订阅a2dp连接状态变化事件。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | 是 | 填写"connectionStateChange"字符串,表示连接状态变化事件。 | +| callback | Callback<[StateChangeParam](#StateChangeParam)> | 是 | 表示回调函数的入参。 | + +**返回值:** + +无 + +**示例:** + +```js +function onReceiveEvent(data) { + console.info('a2dp state = '+ JSON.stringify(data)); +} +let a2dpSrc = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_A2DP_SOURCE) as bluetoothManager.A2dpSourceProfile; +a2dpSrc.on('connectionStateChange', onReceiveEvent); +``` + + +### off('connectionStateChange') + +off(type: "connectionStateChange", callback?: Callback<[StateChangeParam](#StateChangeParam)>): void + +取消订阅a2dp连接状态变化事件。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | 是 | 填写"connectionStateChange"字符串,表示连接状态变化事件。 | +| callback | Callback<[StateChangeParam](#StateChangeParam)> | 否 | 表示回调函数的入参。 | + +**返回值:** + +无 + +**示例:** + +```js +function onReceiveEvent(data) { + console.info('a2dp state = '+ JSON.stringify(data)); +} +let a2dpSrc = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_A2DP_SOURCE) as bluetoothManager.A2dpSourceProfile; +a2dpSrc.on('connectionStateChange', onReceiveEvent); +a2dpSrc.off('connectionStateChange', onReceiveEvent); +``` + + +### getPlayingState + +getPlayingState(device: string): PlayingState + +获取设备的播放状态。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------- | +| device | string | 是 | 远端设备地址。 | + +**返回值:** + +| 类型 | 说明 | +| ----------------------------- | ---------- | +| [PlayingState](#PlayingState) | 远端设备的播放状态。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + let a2dpSrc = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_A2DP_SOURCE) as bluetoothManager.A2dpSourceProfile; + let state = a2dpSrc.getPlayingState('XX:XX:XX:XX:XX:XX'); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## HandsFreeAudioGatewayProfile + +使用HandsFreeAudioGatewayProfile方法之前需要创建该类的实例进行操作,通过getProfile()方法构造此实例。 + + +### connect + +connect(device: string): void + +连接设备的HFP服务。 + +**需要权限**:ohos.permission.DISCOVER_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------- | +| device | string | 是 | 远端设备地址。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + let hfpAg = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_HANDS_FREE_AUDIO_GATEWAY) as bluetoothManager.HandsFreeAudioGatewayProfile; + hfpAg.connect('XX:XX:XX:XX:XX:XX'); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### disconnect + +disconnect(device: string): void + +断开连接设备的HFP服务。 + +**需要权限**:ohos.permission.DISCOVER_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------- | +| device | string | 是 | 远端设备地址。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + let hfpAg = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_HANDS_FREE_AUDIO_GATEWAY) as bluetoothManager.HandsFreeAudioGatewayProfile; + hfpAg.disconnect('XX:XX:XX:XX:XX:XX'); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### on('connectionStateChange') + +on(type: "connectionStateChange", callback: Callback<[StateChangeParam](#StateChangeParam)>): void + +订阅HFP连接状态变化事件。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | 是 | 填写"connectionStateChange"字符串,表示连接状态变化事件。 | +| callback | Callback<[StateChangeParam](#StateChangeParam)> | 是 | 表示回调函数的入参。 | + +**示例:** + +```js +function onReceiveEvent(data) { + console.info('hfp state = '+ JSON.stringify(data)); +} +let hfpAg = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_HANDS_FREE_AUDIO_GATEWAY) as + bluetoothManager.HandsFreeAudioGatewayProfile; +hfpAg.on('connectionStateChange', onReceiveEvent); +``` + + +### off('connectionStateChange') + +off(type: "connectionStateChange", callback?: Callback<[StateChangeParam](#StateChangeParam)>): void + +取消订阅HFP连接状态变化事件。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | 是 | 填写"connectionStateChange"字符串,表示连接状态变化事件。 | +| callback | Callback<[StateChangeParam](#StateChangeParam)> | 否 | 表示回调函数的入参。 | + +**示例:** + +```js +function onReceiveEvent(data) { + console.info('hfp state = '+ JSON.stringify(data)); +} +let hfpAg = bluetoothManager.getProfileInstance(bluetoothManager.ProfileId.PROFILE_HANDS_FREE_AUDIO_GATEWAY) as + bluetoothManager.HandsFreeAudioGatewayProfile; +hfpAg.on('connectionStateChange', onReceiveEvent); +hfpAg.off('connectionStateChange', onReceiveEvent); +``` + + +## HidHostProfile + +使用HidHostProfile方法之前需要创建该类的实例进行操作,通过getProfile()方法构造此实例。 + + +### connect + +connect(device: string): void + +连接设备的HidHost服务。 + +**系统接口**:此接口为系统接口。 + +**需要权限**:ohos.permission.DISCOVER_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------- | +| device | string | 是 | 远端设备地址。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + let hidHostProfile = bluetoothManager.getProfileInst(bluetoothManager.ProfileId.PROFILE_HID_HOST) as bluetoothManager.HidHostProfile; + hidHostProfile.connect('XX:XX:XX:XX:XX:XX'); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### disconnect + +disconnect(device: string): void + +断开连接设备的HidHost服务。 + +**系统接口**:此接口为系统接口。 + +**需要权限**:ohos.permission.DISCOVER_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------- | +| device | string | 是 | 远端设备地址。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + let hidHostProfile = bluetoothManager.getProfileInst(bluetoothManager.ProfileId.PROFILE_HID_HOST) as bluetoothManager.HidHostProfile; + hidHostProfile.disconnect('XX:XX:XX:XX:XX:XX'); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### on('connectionStateChange') + +on(type: "connectionStateChange", callback: Callback<[StateChangeParam](#StateChangeParam)>): void + +订阅HidHost连接状态变化事件。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | 是 | 填写"connectionStateChange"字符串,表示连接状态变化事件。 | +| callback | Callback<[StateChangeParam](#StateChangeParam)> | 是 | 表示回调函数的入参。 | + +**示例:** + +```js +function onReceiveEvent(data) { + console.info('hidHost state = '+ JSON.stringify(data)); +} +let hidHost = bluetoothManager.getProfileInst(bluetoothManager.ProfileId.PROFILE_HID_HOST) as bluetoothManager.HidHostProfile; +hidHost.on('connectionStateChange', onReceiveEvent); +``` + + +### off('connectionStateChange') + +off(type: "connectionStateChange", callback?: Callback<[StateChangeParam](#StateChangeParam)>): void + +取消订阅HidHost连接状态变化事件。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------------------------- | ---- | --------------------------------------------------------- | +| type | string | 是 | 填写"connectionStateChange"字符串,表示连接状态变化事件。 | +| callback | Callback<[StateChangeParam](#StateChangeParam)> | 否 | 表示回调函数的入参。 | + +**示例:** + +```js +function onReceiveEvent(data) { + console.info('hidHost state = '+ JSON.stringify(data)); +} +let hidHost = bluetoothManager.getProfileInst(bluetoothManager.ProfileId.PROFILE_HID_HOST) as bluetoothManager.HidHostProfile; +hidHost.on('connectionStateChange', onReceiveEvent); +hidHost.off('connectionStateChange', onReceiveEvent); +``` + + +## PanProfile + +使用PanProfile方法之前需要创建该类的实例进行操作,通过getProfile()方法构造此实例。 + + +### disconnect + +disconnect(device: string): void + +断开连接设备的Pan服务。 + +**系统接口**:此接口为系统接口。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------- | +| device | string | 是 | 远端设备地址。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + let panProfile = bluetoothManager.getProfileInst(bluetoothManager.ProfileId.PROFILE_PAN_NETWORK) as bluetoothManager.PanProfile; + panProfile.disconnect('XX:XX:XX:XX:XX:XX'); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### on('connectionStateChange') + +on(type: "connectionStateChange", callback: Callback<[StateChangeParam](#StateChangeParam)>): void + +订阅Pan连接状态变化事件。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | 是 | 填写"connectionStateChange"字符串,表示连接状态变化事件。 | +| callback | Callback<[StateChangeParam](#StateChangeParam)> | 是 | 表示回调函数的入参。 | + +**示例:** + +```js +function onReceiveEvent(data) { + console.info('pan state = '+ JSON.stringify(data)); +} +let panProfile = bluetoothManager.getProfileInst(bluetoothManager.ProfileId.PROFILE_PAN_NETWORK) as bluetoothManager.PanProfile; +panProfile.on('connectionStateChange', onReceiveEvent); +``` + + +### off('connectionStateChange') + +off(type: "connectionStateChange", callback?: Callback<[StateChangeParam](#StateChangeParam)>): void + +取消订阅Pan连接状态变化事件。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------------------------- | ---- | --------------------------------------------------------- | +| type | string | 是 | 填写"connectionStateChange"字符串,表示连接状态变化事件。 | +| callback | Callback<[StateChangeParam](#StateChangeParam)> | 否 | 表示回调函数的入参。 | + +**示例:** + +```js +function onReceiveEvent(data) { + console.info('pan state = '+ JSON.stringify(data)); +} +let panProfile = bluetoothManager.getProfileInst(bluetoothManager.ProfileId.PROFILE_PAN_NETWORK) as bluetoothManager.PanProfile; +panProfile.on('connectionStateChange', onReceiveEvent); +panProfile.off('connectionStateChange', onReceiveEvent); +``` + + +### setTethering + +setTethering(enable: boolean): void + +设置网络共享状态。 + +**系统接口**:此接口为系统接口。 + +**需要权限**:ohos.permission.DISCOVER_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------- | +| value | boolean | 是 | 是否设置蓝牙共享。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + let panProfile = bluetoothManager.getProfileInst(bluetoothManager.ProfileId.PROFILE_PAN_NETWORK) as bluetoothManager.PanProfile; + panProfile.setTethering(true); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### isTetheringOn + +isTetheringOn(): boolean + +获取网络共享状态。 + +**系统接口**:此接口为系统接口。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**返回值:** + +| 类型 | 说明 | +| --------------------- | --------------------------------- | +| boolean | 网络共享开启返回true,网络共享关闭返回false。 | + +**示例:** + +```js +try { + let panProfile = bluetoothManager.getProfileInst(bluetoothManager.ProfileId.PROFILE_PAN_NETWORK) as bluetoothManager.PanProfile; + let ret = panProfile.isTetheringOn(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +## GattServer + +server端类,使用server端方法之前需要创建该类的实例进行操作,通过createGattServer()方法构造此实例。 + + +### startAdvertising + +startAdvertising(setting: AdvertiseSetting, advData: AdvertiseData, advResponse?: AdvertiseData): void + +开始发送BLE广播。 + +**需要权限**:ohos.permission.DISCOVER_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ------------------------------------- | ---- | -------------- | +| setting | [AdvertiseSetting](#advertisesetting) | 是 | BLE广播的相关参数。 | +| advData | [AdvertiseData](#advertisedata) | 是 | BLE广播包内容。 | +| advResponse | [AdvertiseData](#advertisedata) | 否 | BLE回复扫描请求回复响应。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**示例:** + +```js +let manufactureValueBuffer = new Uint8Array(4); +manufactureValueBuffer[0] = 1; +manufactureValueBuffer[1] = 2; +manufactureValueBuffer[2] = 3; +manufactureValueBuffer[3] = 4; + +let serviceValueBuffer = new Uint8Array(4); +serviceValueBuffer[0] = 4; +serviceValueBuffer[1] = 6; +serviceValueBuffer[2] = 7; +serviceValueBuffer[3] = 8; +console.info('manufactureValueBuffer = '+ JSON.stringify(manufactureValueBuffer)); +console.info('serviceValueBuffer = '+ JSON.stringify(serviceValueBuffer)); +let gattServer = bluetoothManager.BLE.createGattServer(); +try { + gattServer.startAdvertising({ + interval:150, + txPower:60, + connectable:true, + },{ + serviceUuids:["00001888-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:4567, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"00001888-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + },{ + serviceUuids:["00001889-0000-1000-8000-00805f9b34fb"], + manufactureData:[{ + manufactureId:1789, + manufactureValue:manufactureValueBuffer.buffer + }], + serviceData:[{ + serviceUuid:"00001889-0000-1000-8000-00805f9b34fb", + serviceValue:serviceValueBuffer.buffer + }], + }); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### stopAdvertising + +stopAdvertising(): void + +停止发送BLE广播。 + +**需要权限**:ohos.permission.DISCOVER_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**示例:** + +```js +let server = bluetoothManager.BLE.createGattServer(); +try { + server.stopAdvertising(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### addService + +addService(service: GattService): void + +server端添加服务。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | --------------------------- | ---- | ------------------------ | +| service | [GattService](#gattservice) | 是 | 服务端的service数据。BLE广播的相关参数 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**示例:** + +```js +// 创建descriptors +let descriptors = []; +let arrayBuffer = new ArrayBuffer(8); +let descV = new Uint8Array(arrayBuffer); +descV[0] = 11; +let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', + characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', + descriptorUuid: '00002902-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer}; +descriptors[0] = descriptor; + +// 创建characteristics +let characteristics = []; +let arrayBufferC = new ArrayBuffer(8); +let cccV = new Uint8Array(arrayBufferC); +cccV[0] = 1; +let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', + characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', characteristicValue: arrayBufferC, descriptors:descriptors}; +let characteristicN = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', + characteristicUuid: '00001821-0000-1000-8000-00805F9B34FB', characteristicValue: arrayBufferC, descriptors:descriptors}; +characteristics[0] = characteristic; + +// 创建gattService +let gattService = {serviceUuid:'00001810-0000-1000-8000-00805F9B34FB', isPrimary: true, characteristics:characteristics, includeServices:[]}; + +let gattServer = bluetoothManager.BLE.createGattServer(); +try { + gattServer.addService(gattService); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### removeService + +removeService(serviceUuid: string): void + +删除已添加的服务。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ------ | ---- | ---------------------------------------- | +| serviceUuid | string | 是 | service的UUID,例如“00001810-0000-1000-8000-00805F9B34FB”。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900004 | Profile is not supported. | +|2900099 | Operation failed. | + +**示例:** + +```js +let server = bluetoothManager.BLE.createGattServer(); +try { + server.removeService('00001810-0000-1000-8000-00805F9B34FB'); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### close + +close(): void + +关闭服务端功能,去注册server在协议栈的注册,调用该接口后[GattServer](#gattserver)实例将不能再使用。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**示例:** + +```js +let server = bluetoothManager.BLE.createGattServer(); +try { + server.close(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### notifyCharacteristicChanged + +notifyCharacteristicChanged(deviceId: string, notifyCharacteristic: NotifyCharacteristic): void + +server端特征值发生变化时,主动通知已连接的client设备。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------------------- | ---------------------------------------- | ---- | --------------------------------------- | +| deviceId | string | 是 | 接收通知的client端设备地址,例如“XX:XX:XX:XX:XX:XX”。 | +| notifyCharacteristic | [NotifyCharacteristic](#notifycharacteristic) | 是 | 通知的特征值数据。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**示例:** + +```js +// 创建descriptors +let descriptors = []; +let arrayBuffer = new ArrayBuffer(8); +let descV = new Uint8Array(arrayBuffer); +descV[0] = 11; +let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', + characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', + descriptorUuid: '00002902-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer}; +descriptors[0] = descriptor; +let arrayBufferC = new ArrayBuffer(8); +let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', + characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', characteristicValue: arrayBufferC, descriptors:descriptors}; +let notifyCharacteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', + characteristicUuid: '00001821-0000-1000-8000-00805F9B34FB', characteristicValue: characteristic.characteristicValue, confirm: false}; +let server = bluetoothManager.BLE.createGattServer(); +try { + server.notifyCharacteristicChanged('XX:XX:XX:XX:XX:XX', notifyCharacteristic); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### sendResponse + +sendResponse(serverResponse: ServerResponse): void + +server端回复client端的读写请求。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------------- | --------------------------------- | ---- | --------------- | +| serverResponse | [ServerResponse](#serverresponse) | 是 | server端回复的响应数据。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**示例:** + +```js +/* send response */ +let arrayBufferCCC = new ArrayBuffer(8); +let cccValue = new Uint8Array(arrayBufferCCC); +cccValue[0] = 1123; +let serverResponse = { + "deviceId": "XX:XX:XX:XX:XX:XX", + "transId": 0, + "status": 0, + "offset": 0, + "value": arrayBufferCCC, +}; + +let gattServer = bluetoothManager.BLE.createGattServer(); +try { + gattServer.sendResponse(serverResponse); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### on('characteristicRead') + +on(type: "characteristicRead", callback: Callback<CharacteristicReadRequest>): void + +server端订阅特征值读请求事件。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ------------------------------------- | +| type | string | 是 | 填写"characteristicRead"字符串,表示特征值读请求事件。 | +| callback | Callback<[CharacteristicReadRequest](#characteristicreadrequest)> | 是 | 表示回调函数的入参,client端发送的读请求数据。 | + +**示例:** + +```js +let arrayBufferCCC = new ArrayBuffer(8); +let cccValue = new Uint8Array(arrayBufferCCC); +cccValue[0] = 1123; +function ReadCharacteristicReq(CharacteristicReadRequest) { + let deviceId = CharacteristicReadRequest.deviceId; + let transId = CharacteristicReadRequest.transId; + let offset = CharacteristicReadRequest.offset; + let characteristicUuid = CharacteristicReadRequest.characteristicUuid; + + let serverResponse = {deviceId: deviceId, transId: transId, status: 0, offset: offset, value:arrayBufferCCC}; + + try { + gattServer.sendResponse(serverResponse); + } catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); + } +} + +let gattServer = bluetoothManager.BLE.createGattServer(); +gattServer.on("characteristicRead", ReadCharacteristicReq); +``` + + +### off('characteristicRead') + +off(type: "characteristicRead", callback?: Callback<CharacteristicReadRequest>): void + +server端取消订阅特征值读请求事件。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | 是 | 填写"characteristicRead"字符串,表示特征值读请求事件。 | +| callback | Callback<[CharacteristicReadRequest](#characteristicreadrequest)> | 否 | 表示取消订阅特征值读请求事件上报。不填该参数则取消订阅该type对应的所有回调。 | + +**示例:** + +```js +let gattServer = bluetoothManager.BLE.createGattServer(); +gattServer.off("characteristicRead"); +``` + + +### on('characteristicWrite') + +on(type: "characteristicWrite", callback: Callback<CharacteristicWriteRequest>): void + +server端订阅特征值写请求事件。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | -------------------------------------- | +| type | string | 是 | 填写"characteristicWrite"字符串,表示特征值写请求事件。 | +| callback | Callback<[CharacteristicWriteRequest](#characteristicwriterequest)> | 是 | 表示回调函数的入参,client端发送的写请求数据。 | + +**示例:** + +```js +let arrayBufferCCC = new ArrayBuffer(8); +let cccValue = new Uint8Array(arrayBufferCCC); +function WriteCharacteristicReq(CharacteristicWriteRequest) { + let deviceId = CharacteristicWriteRequest.deviceId; + let transId = CharacteristicWriteRequest.transId; + let offset = CharacteristicWriteRequest.offset; + let isPrep = CharacteristicWriteRequest.isPrep; + let needRsp = CharacteristicWriteRequest.needRsp; + let value = new Uint8Array(CharacteristicWriteRequest.value); + let characteristicUuid = CharacteristicWriteRequest.characteristicUuid; + + cccValue[0] = value[0]; + let serverResponse = {deviceId: deviceId, transId: transId, status: 0, offset: offset, value:arrayBufferCCC}; + + try { + gattServer.sendResponse(serverResponse); + } catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); + } +} + +let gattServer = bluetoothManager.BLE.createGattServer(); +gattServer.on("characteristicWrite", WriteCharacteristicReq); +``` + + +### off('characteristicWrite') + +off(type: "characteristicWrite", callback?: Callback<CharacteristicWriteRequest>): void + +server端取消订阅特征值写请求事件。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | 是 | 填写"characteristicWrite"字符串,表示特征值写请求事件。 | +| callback | Callback<[CharacteristicWriteRequest](#characteristicwriterequest)> | 否 | 表示取消订阅特征值写请求事件上报。不填该参数则取消订阅该type对应的所有回调。 | + +**示例:** + +```js +let gattServer = bluetoothManager.BLE.createGattServer(); +gattServer.off("characteristicWrite"); +``` + + +### on('descriptorRead') + +on(type: "descriptorRead", callback: Callback<DescriptorReadRequest>): void + +server端订阅描述符读请求事件。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | --------------------------------- | +| type | string | 是 | 填写"descriptorRead"字符串,表示描述符读请求事件。 | +| callback | Callback<[DescriptorReadRequest](#descriptorreadrequest)> | 是 | 表示回调函数的入参,client端发送的读请求数据。 | + +**示例:** + +```js +let arrayBufferDesc = new ArrayBuffer(8); +let descValue = new Uint8Array(arrayBufferDesc); +descValue[0] = 1101; +function ReadDescriptorReq(DescriptorReadRequest) { + let deviceId = DescriptorReadRequest.deviceId; + let transId = DescriptorReadRequest.transId; + let offset = DescriptorReadRequest.offset; + let descriptorUuid = DescriptorReadRequest.descriptorUuid; + + let serverResponse = {deviceId: deviceId, transId: transId, status: 0, offset: offset, value:arrayBufferDesc}; + + try { + gattServer.sendResponse(serverResponse); + } catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); + } +} + +let gattServer = bluetoothManager.BLE.createGattServer(); +gattServer.on("descriptorRead", ReadDescriptorReq); +``` + + +### off('descriptorRead') + +off(type: "descriptorRead", callback?: Callback<DescriptorReadRequest>): void + +server端取消订阅描述符读请求事件。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | 是 | 填写"descriptorRead"字符串,表示描述符读请求事件。 | +| callback | Callback<[DescriptorReadRequest](#descriptorreadrequest)> | 否 | 表示取消订阅描述符读请求事件上报。不填该参数则取消订阅该type对应的所有回调。 | + +**示例:** + +```js +let gattServer = bluetoothManager.BLE.createGattServer(); +gattServer.off("descriptorRead"); +``` + + +### on('descriptorWrite') + +on(type: "descriptorWrite", callback: Callback<DescriptorWriteRequest>): void + +server端订阅描述符写请求事件。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ---------------------------------- | +| type | string | 是 | 填写"descriptorWrite"字符串,表示描述符写请求事件。 | +| callback | Callback<[DescriptorWriteRequest](#descriptorwriterequest)> | 是 | 表示回调函数的入参,client端发送的写请求数据。 | + +**示例:** + +```js +let arrayBufferDesc = new ArrayBuffer(8); +let descValue = new Uint8Array(arrayBufferDesc); +function WriteDescriptorReq(DescriptorWriteRequest) { + let deviceId = DescriptorWriteRequest.deviceId; + let transId = DescriptorWriteRequest.transId; + let offset = DescriptorWriteRequest.offset; + let isPrep = DescriptorWriteRequest.isPrep; + let needRsp = DescriptorWriteRequest.needRsp; + let value = new Uint8Array(DescriptorWriteRequest.value); + let descriptorUuid = DescriptorWriteRequest.descriptorUuid; + + descValue[0] = value[0]; + let serverResponse = {deviceId: deviceId, transId: transId, status: 0, offset: offset, value:arrayBufferDesc}; + + try { + gattServer.sendResponse(serverResponse); + } catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); + } +} + +let gattServer = bluetoothManager.BLE.createGattServer(); +gattServer.on("descriptorRead", WriteDescriptorReq); +``` + + +### off('descriptorWrite') + +off(type: "descriptorWrite", callback?: Callback<DescriptorWriteRequest>): void + +server端取消订阅描述符写请求事件。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | 是 | 填写"descriptorWrite"字符串,表示描述符写请求事件。 | +| callback | Callback<[DescriptorWriteRequest](#descriptorwriterequest)> | 否 | 表示取消订阅描述符写请求事件上报。不填该参数则取消订阅该type对应的所有回调。 | + +**示例:** + +```js +let gattServer = bluetoothManager.BLE.createGattServer(); +gattServer.off("descriptorWrite"); +``` + + +### on('connectStateChange') + +on(type: "connectStateChange", callback: Callback<BLEConnectChangedState>): void + +server端订阅BLE连接状态变化事件。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | 是 | 填写"connectStateChange"字符串,表示BLE连接状态变化事件。 | +| callback | Callback<[BLEConnectChangedState](#bleconnectchangedstate)> | 是 | 表示回调函数的入参,连接状态。 | + +**示例:** + +```js +function Connected(BLEConnectChangedState) { + let deviceId = BLEConnectChangedState.deviceId; + let status = BLEConnectChangedState.state; +} + +let gattServer = bluetoothManager.BLE.createGattServer(); +gattServer.on("connectStateChange", Connected); +``` + + +### off('connectStateChange') + +off(type: "connectStateChange", callback?: Callback<BLEConnectChangedState>): void + +server端取消订阅BLE连接状态变化事件。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | 是 | 填写"connectStateChange"字符串,表示BLE连接状态变化事件。 | +| callback | Callback<[BLEConnectChangedState](#bleconnectchangedstate)> | 否 | 表示取消订阅BLE连接状态变化事件。不填该参数则取消订阅该type对应的所有回调。 | + +**示例:** + +```js +let gattServer = bluetoothManager.BLE.createGattServer(); +gattServer.off("connectStateChange"); +``` + + +## GattClientDevice + +client端类,使用client端方法之前需要创建该类的实例进行操作,通过createGattClientDevice(deviceId: string)方法构造此实例。 + + +### connect + +connect(): void + +client端发起连接远端蓝牙低功耗设备。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.connect(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### disconnect + +disconnect(): void + +client端断开与远端蓝牙低功耗设备的连接。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.disconnect(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### close + +close(): void + +关闭客户端功能,注销client在协议栈的注册,调用该接口后[GattClientDevice](#gattclientdevice)实例将不能再使用。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900003 | Bluetooth switch is off. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.close(); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + + + +### getServices + +getServices(callback: AsyncCallback<Array<GattService>>): void + +client端获取蓝牙低功耗设备的所有服务,即服务发现 。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ------------------------ | +| callback | AsyncCallback<Array<[GattService](#gattservice)>> | 是 | client进行服务发现,通过注册回调函数获取。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900099 | Operation failed. | + +**示例:** + +```js +// callkback 模式 +function getServices(code, gattServices) { + if (code.code == 0) { + let services = gattServices; + console.log('bluetooth code is ' + code.code); + console.log("bluetooth services size is ", services.length); + + for (let i = 0; i < services.length; i++) { + console.log('bluetooth serviceUuid is ' + services[i].serviceUuid); + } + } +} + +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.connect(); + device.getServices(getServices); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### getServices + +getServices(): Promise<Array<GattService>> + +client端获取蓝牙低功耗设备的所有服务,即服务发现。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**返回值:** + +| 类型 | 说明 | +| ---------------------------------------- | --------------------------- | +| Promise<Array<[GattService](#gattservice)>> | client进行服务发现,通过promise形式获取。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900099 | Operation failed. | + +**示例:** + +```js +// Promise 模式 +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.connect(); + device.getServices().then(result => { + console.info("getServices successfully:" + JSON.stringify(result)); + }); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### readCharacteristicValue + +readCharacteristicValue(characteristic: BLECharacteristic, callback: AsyncCallback<BLECharacteristic>): void + +client端读取蓝牙低功耗设备特定服务的特征值。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------------- | ---------------------------------------- | ---- | ----------------------- | +| characteristic | [BLECharacteristic](#blecharacteristic) | 是 | 待读取的特征值。 | +| callback | AsyncCallback<[BLECharacteristic](#blecharacteristic)> | 是 | client读取特征值,通过注册回调函数获取。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2901000 | Read forbidden. | +|2900099 | Operation failed. | + +**示例:** + +```js +function readCcc(code, BLECharacteristic) { + if (code.code != 0) { + return; + } + console.log('bluetooth characteristic uuid: ' + BLECharacteristic.characteristicUuid); + let value = new Uint8Array(BLECharacteristic.characteristicValue); + console.log('bluetooth characteristic value: ' + value[0] +','+ value[1]+','+ value[2]+','+ value[3]); +} + +let descriptors = []; +let bufferDesc = new ArrayBuffer(8); +let descV = new Uint8Array(bufferDesc); +descV[0] = 11; +let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', +characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', +descriptorUuid: '00002903-0000-1000-8000-00805F9B34FB', descriptorValue: bufferDesc}; +descriptors[0] = descriptor; + +let bufferCCC = new ArrayBuffer(8); +let cccV = new Uint8Array(bufferCCC); +cccV[0] = 1; +let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', +characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', +characteristicValue: bufferCCC, descriptors:descriptors}; + +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.readCharacteristicValue(characteristic, readCcc); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### readCharacteristicValue + +readCharacteristicValue(characteristic: BLECharacteristic): Promise<BLECharacteristic> + +client端读取蓝牙低功耗设备特定服务的特征值。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------------- | --------------------------------------- | ---- | -------- | +| characteristic | [BLECharacteristic](#blecharacteristic) | 是 | 待读取的特征值。 | + +**返回值:** + +| 类型 | 说明 | +| ---------------------------------------- | -------------------------- | +| Promise<[BLECharacteristic](#blecharacteristic)> | client读取特征值,通过promise形式获取。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2901000 | Read forbidden. | +|2900099 | Operation failed. | + +**示例:** + +```js +let descriptors = []; +let bufferDesc = new ArrayBuffer(8); +let descV = new Uint8Array(bufferDesc); +descV[0] = 11; +let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', +characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', +descriptorUuid: '00002903-0000-1000-8000-00805F9B34FB', descriptorValue: bufferDesc}; +descriptors[0] = descriptor; + +let bufferCCC = new ArrayBuffer(8); +let cccV = new Uint8Array(bufferCCC); +cccV[0] = 1; +let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', +characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', +characteristicValue: bufferCCC, descriptors:descriptors}; + +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.readCharacteristicValue(characteristic); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### readDescriptorValue + +readDescriptorValue(descriptor: BLEDescriptor, callback: AsyncCallback<BLEDescriptor>): void + +client端读取蓝牙低功耗设备特定的特征包含的描述符。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | ---------------------------------------- | ---- | ----------------------- | +| descriptor | [BLEDescriptor](#bledescriptor) | 是 | 待读取的描述符。 | +| callback | AsyncCallback<[BLEDescriptor](#bledescriptor)> | 是 | client读取描述符,通过注册回调函数获取。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2901000 | Read forbidden. | +|2900099 | Operation failed. | + +**示例:** + +```js +function readDesc(code, BLEDescriptor) { + if (code.code != 0) { + return; + } + console.log('bluetooth descriptor uuid: ' + BLEDescriptor.descriptorUuid); + let value = new Uint8Array(BLEDescriptor.descriptorValue); + console.log('bluetooth descriptor value: ' + value[0] +','+ value[1]+','+ value[2]+','+ value[3]); +} + +let bufferDesc = new ArrayBuffer(8); +let descV = new Uint8Array(bufferDesc); +descV[0] = 11; +let descriptor = { + serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', + characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', + descriptorUuid: '00002903-0000-1000-8000-00805F9B34FB', + descriptorValue: bufferDesc +}; +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.readDescriptorValue(descriptor, readDesc); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### readDescriptorValue + +readDescriptorValue(descriptor: BLEDescriptor): Promise<BLEDescriptor> + +client端读取蓝牙低功耗设备特定的特征包含的描述符。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | ------------------------------- | ---- | -------- | +| descriptor | [BLEDescriptor](#bledescriptor) | 是 | 待读取的描述符。 | + +**返回值:** + +| 类型 | 说明 | +| ---------------------------------------- | -------------------------- | +| Promise<[BLEDescriptor](#bledescriptor)> | client读取描述符,通过promise形式获取。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2901000 | Read forbidden. | +|2900099 | Operation failed. | + +**示例:** + +```js +let bufferDesc = new ArrayBuffer(8); +let descV = new Uint8Array(bufferDesc); +descV[0] = 11; +let descriptor = { + serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', + characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', + descriptorUuid: '00002903-0000-1000-8000-00805F9B34FB', + descriptorValue: bufferDesc +}; +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.readDescriptorValue(descriptor); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### writeCharacteristicValue + +writeCharacteristicValue(characteristic: BLECharacteristic): void + +client端向低功耗蓝牙设备写入特定的特征值。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------------- | --------------------------------------- | ---- | ------------------- | +| characteristic | [BLECharacteristic](#blecharacteristic) | 是 | 蓝牙设备特征对应的二进制值及其它参数。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2901001 | Write forbidden. | +|2900099 | Operation failed. | + +**示例:** + +```js +let descriptors = []; +let bufferDesc = new ArrayBuffer(8); +let descV = new Uint8Array(bufferDesc); +descV[0] = 11; +let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', + characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', + descriptorUuid: '00002903-0000-1000-8000-00805F9B34FB', descriptorValue: bufferDesc}; +descriptors[0] = descriptor; + +let bufferCCC = new ArrayBuffer(8); +let cccV = new Uint8Array(bufferCCC); +cccV[0] = 1; +let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', + characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', + characteristicValue: bufferCCC, descriptors:descriptors}; +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.writeCharacteristicValue(characteristic); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### writeDescriptorValue + +writeDescriptorValue(descriptor: BLEDescriptor): void + +client端向低功耗蓝牙设备特定的描述符写入二进制数据。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | ------------------------------- | ---- | ------------------ | +| descriptor | [BLEDescriptor](#bledescriptor) | 是 | 蓝牙设备描述符的二进制值及其它参数。 | +| boolean | 写描述符操作成功返回true,操作失败返回false。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2901001 | Write forbidden. | +|2900099 | Operation failed. | + +**示例:** + +```js +let bufferDesc = new ArrayBuffer(8); +let descV = new Uint8Array(bufferDesc); +descV[0] = 22; +let descriptor = { + serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', + characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', + descriptorUuid: '00002903-0000-1000-8000-00805F9B34FB', + descriptorValue: bufferDesc +}; +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.writeDescriptorValue(descriptor); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### setBLEMtuSize + +setBLEMtuSize(mtu: number): void + +client协商远端蓝牙低功耗设备的最大传输单元(Maximum Transmission Unit, MTU),调用[connect](#connect)接口连接成功后才能使用。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---- | ------ | ---- | -------------- | +| mtu | number | 是 | 设置范围为22~512字节。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900099 | Operation failed. | + +**示例:** + +```js +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.setBLEMtuSize(128); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### setNotifyCharacteristicChanged + +setNotifyCharacteristicChanged(characteristic: BLECharacteristic, enable: boolean): void + +向服务端发送设置通知此特征值请求。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------------- | --------------------------------------- | ---- | ----------------------------- | +| characteristic | [BLECharacteristic](#blecharacteristic) | 是 | 蓝牙低功耗特征。 | +| enable | boolean | 是 | 启用接收notify设置为true,否则设置为false。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900099 | Operation failed. | + +**示例:** + +```js +// 创建descriptors +let descriptors = []; +let arrayBuffer = new ArrayBuffer(8); +let descV = new Uint8Array(arrayBuffer); +descV[0] = 11; +let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', + characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', + descriptorUuid: '00002902-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer}; +descriptors[0] = descriptor; +let arrayBufferC = new ArrayBuffer(8); +let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB', + characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', characteristicValue: arrayBufferC, descriptors:descriptors}; +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.setNotifyCharacteristicChanged(characteristic, false); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} + +``` + + +### on('BLECharacteristicChange') + +on(type: "BLECharacteristicChange", callback: Callback<BLECharacteristic>): void + +订阅蓝牙低功耗设备的特征值变化事件。需要先调用setNotifyCharacteristicChanged接口才能接收server端的通知。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | 是 | 填写"BLECharacteristicChange"字符串,表示特征值变化事件。 | +| callback | Callback<[BLECharacteristic](#blecharacteristic)> | 是 | 表示蓝牙低功耗设备的特征值变化事件的回调函数。 | + +**示例:** + +```js +function CharacteristicChange(CharacteristicChangeReq) { + let serviceUuid = CharacteristicChangeReq.serviceUuid; + let characteristicUuid = CharacteristicChangeReq.characteristicUuid; + let value = new Uint8Array(CharacteristicChangeReq.characteristicValue); +} +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.on('BLECharacteristicChange', CharacteristicChange); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### off('BLECharacteristicChange') + +off(type: "BLECharacteristicChange", callback?: Callback<BLECharacteristic>): void + +取消订阅蓝牙低功耗设备的特征值变化事件。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | 是 | 填写"BLECharacteristicChange"字符串,表示特征值变化事件。 | +| callback | Callback<[BLECharacteristic](#blecharacteristic)> | 否 | 表示取消订阅蓝牙低功耗设备的特征值变化事件。不填该参数则取消订阅该type对应的所有回调。 | + +**示例:** + +```js +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.off('BLECharacteristicChange'); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### on('BLEConnectionStateChange') + +on(type: "BLEConnectionStateChange", callback: Callback<BLEConnectChangedState>): void + +client端订阅蓝牙低功耗设备的连接状态变化事件。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | 是 | 填写"BLEConnectionStateChange"字符串,表示连接状态变化事件。 | +| callback | Callback<[BLEConnectChangedState](#bleconnectchangedstate)> | 是 | 表示连接状态,已连接或断开。 | + +**示例:** + +```js +function ConnectStateChanged(state) { + console.log('bluetooth connect state changed'); + let connectState = state.state; +} +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.on('BLEConnectionStateChange', ConnectStateChanged); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### off('BLEConnectionStateChange') + +off(type: "BLEConnectionStateChange", callback?: Callback<BLEConnectChangedState>): void + +取消订阅蓝牙低功耗设备的连接状态变化事件。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ---------------------------------------- | +| type | string | 是 | 填写"BLEConnectionStateChange"字符串,表示连接状态变化事件。 | +| callback | Callback<[BLEConnectChangedState](#bleconnectchangedstate)> | 否 | 表示取消订阅蓝牙低功耗设备的连接状态变化事件。不填该参数则取消订阅该type对应的所有回调。 | + +**示例:** + +```js +try { + let device = bluetoothManager.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX'); + device.off('BLEConnectionStateChange'); +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### getDeviceName + +getDeviceName(callback: AsyncCallback<string>): void + +client获取远端蓝牙低功耗设备名。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------- | ---- | ------------------------------- | +| callback | AsyncCallback<string> | 是 | client获取对端server设备名,通过注册回调函数获取。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900099 | Operation failed. | + +**示例:** + +```js +// callback +try { + let gattClient = bluetoothManager.BLE.createGattClientDevice("XX:XX:XX:XX:XX:XX"); + gattClient.connect(); + let deviceName = gattClient.getDeviceName((err, data)=> { + console.info('device name err ' + JSON.stringify(err)); + console.info('device name' + JSON.stringify(data)); + }) +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### getDeviceName + +getDeviceName(): Promise<string> + +client获取远端蓝牙低功耗设备名。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**返回值:** + +| 类型 | 说明 | +| --------------------- | ---------------------------------- | +| Promise<string> | client获取对端server设备名,通过promise形式获取。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900001 | Service stopped. | +|2900099 | Operation failed. | + +**示例:** + +```js +// promise +try { + let gattClient = bluetoothManager.BLE.createGattClientDevice("XX:XX:XX:XX:XX:XX"); + gattClient.connect(); + let deviceName = gattClient.getDeviceName().then((data) => { + console.info('device name' + JSON.stringify(data)); + }) +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### getRssiValue + +getRssiValue(callback: AsyncCallback<number>): void + +client获取远端蓝牙低功耗设备的信号强度 (Received Signal Strength Indication, RSSI),调用[connect](#connect)接口连接成功后才能使用。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------- | ---- | ------------------------------ | +| callback | AsyncCallback<number> | 是 | 返回信号强度,单位 dBm,通过注册回调函数获取。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900099 | Operation failed. | + +**示例:** + +```js +// callback +try { + let gattClient = bluetoothManager.BLE.createGattClientDevice("XX:XX:XX:XX:XX:XX"); + gattClient.connect(); + let rssi = gattClient.getRssiValue((err, data)=> { + console.info('rssi err ' + JSON.stringify(err)); + console.info('rssi value' + JSON.stringify(data)); + }) +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + + +### getRssiValue + +getRssiValue(): Promise<number> + +client获取远端蓝牙低功耗设备的信号强度 (Received Signal Strength Indication, RSSI),调用[connect](#connect)接口连接成功后才能使用。 + +**需要权限**:ohos.permission.USE_BLUETOOTH + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +**返回值:** + +| 类型 | 说明 | +| --------------------- | --------------------------------- | +| Promise<number> | 返回信号强度,单位 dBm,通过promise形式获取。 | + +**错误码**: + +以下错误码的详细介绍请参见[蓝牙服务子系统错误码](../errorcodes/errorcode-bluetoothManager.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------- | +|2900099 | Operation failed. | + +**示例:** + +```js +// promise +try { + let gattClient = bluetoothManager.BLE.createGattClientDevice("XX:XX:XX:XX:XX:XX"); + let rssi = gattClient.getRssiValue().then((data) => { + console.info('rssi' + JSON.stringify(data)); + }) +} catch (err) { + console.error("errCode:" + err.code + ",errMessage:" + err.message); +} +``` + +## ScanMode + +枚举,扫描模式。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 值 | 说明 | +| ---------------------------------------- | ---- | --------------- | +| SCAN_MODE_NONE | 0 | 没有扫描模式。 | +| SCAN_MODE_CONNECTABLE | 1 | 可连接扫描模式。 | +| SCAN_MODE_GENERAL_DISCOVERABLE | 2 | general发现模式。 | +| SCAN_MODE_LIMITED_DISCOVERABLE | 3 | limited发现模式。 | +| SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE | 4 | 可连接general发现模式。 | +| SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE | 5 | 可连接limited发现模式。 | + +## BondState + +枚举,配对状态。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 值 | 说明 | +| ------------------ | ---- | ------ | +| BOND_STATE_INVALID | 0 | 无效的配对。 | +| BOND_STATE_BONDING | 1 | 正在配对。 | +| BOND_STATE_BONDED | 2 | 已配对。 | + + +## SppOption + +描述spp的配置参数。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ------ | ------------------- | ---- | ---- | ----------- | +| uuid | string | 是 | 是 | spp单据的uuid。 | +| secure | boolean | 是 | 是 | 是否是安全通道。 | +| type | [SppType](#spptype) | 是 | 是 | Spp链路类型。 | + + +## SppType + +枚举,Spp链路类型。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 值 | 说明 | +| ---------- | ---- | ------------- | +| SPP_RFCOMM | 0 | 表示rfcomm链路类型。 | + + +## GattService + +描述service的接口参数定义。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| --------------- | ---------------------------------------- | ---- | ---- | ---------------------------------------- | +| serviceUuid | string | 是 | 是 | 特定服务(service)的UUID,例如:00001888-0000-1000-8000-00805f9b34fb。 | +| isPrimary | boolean | 是 | 是 | 如果是主服务设置为true,否则设置为false。 | +| characteristics | Array<[BLECharacteristic](#blecharacteristic)> | 是 | 是 | 当前服务包含的特征列表。 | +| includeServices | Array<[GattService](#gattservice)> | 是 | 是 | 当前服务依赖的其它服务。 | + + +## BLECharacteristic + +描述characteristic的接口参数定义 。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ------------------- | ---------------------------------------- | ---- | ---- | ---------------------------------------- | +| serviceUuid | string | 是 | 是 | 特定服务(service)的UUID,例如:00001888-0000-1000-8000-00805f9b34fb。 | +| characteristicUuid | string | 是 | 是 | 特定特征(characteristic)的UUID,例如:00002a11-0000-1000-8000-00805f9b34fb。 | +| characteristicValue | ArrayBuffer | 是 | 是 | 特征对应的二进制值。 | +| descriptors | Array<[BLEDescriptor](#bledescriptor)> | 是 | 是 | 特定特征的描述符列表。 | +| properties10+ | [GattProperties](#gattproperties10) | 是 | 是 | 特定特征的属性描述。 | + + +## BLEDescriptor + +描述descriptor的接口参数定义 。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ------------------ | ----------- | ---- | ---- | ---------------------------------------- | +| serviceUuid | string | 是 | 是 | 特定服务(service)的UUID,例如:00001888-0000-1000-8000-00805f9b34fb。 | +| characteristicUuid | string | 是 | 是 | 特定特征(characteristic)的UUID,例如:00002a11-0000-1000-8000-00805f9b34fb。 | +| descriptorUuid | string | 是 | 是 | 描述符(descriptor)的UUID,例如:00002902-0000-1000-8000-00805f9b34fb。 | +| descriptorValue | ArrayBuffer | 是 | 是 | 描述符对应的二进制值。 | + + +## NotifyCharacteristic + +描述server端特征值变化时发送的特征通知参数定义。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ------------------- | ----------- | ---- | ---- | ---------------------------------------- | +| serviceUuid | string | 是 | 是 | 特定服务(service)的UUID,例如:00001888-0000-1000-8000-00805f9b34fb。 | +| characteristicUuid | string | 是 | 是 | 特定特征(characteristic)的UUID,例如:00002a11-0000-1000-8000-00805f9b34fb。 | +| characteristicValue | ArrayBuffer | 是 | 是 | 特征对应的二进制值。 | +| confirm | boolean | 是 | 是 | 如果是notification则对端回复确认设置为true,如果是indication则对端不需要回复确认设置为false。 | + + +## CharacteristicReadRequest + +描述server端订阅后收到的特征值读请求事件参数结构。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ------------------ | ------ | ---- | ---- | ---------------------------------------- | +| deviceId | string | 是 | 否 | 表示发送特征值读请求的远端设备地址,例如:"XX:XX:XX:XX:XX:XX"。 | +| transId | number | 是 | 否 | 表示读请求的传输ID,server端回复响应时需填写相同的传输ID。 | +| offset | number | 是 | 否 | 表示读特征值数据的起始位置。例如:k表示从第k个字节开始读,server端回复响应时需填写相同的offset。 | +| characteristicUuid | string | 是 | 否 | 特定特征(characteristic)的UUID,例如:00002a11-0000-1000-8000-00805f9b34fb。 | +| serviceUuid | string | 是 | 否 | 特定服务(service)的UUID,例如:00001888-0000-1000-8000-00805f9b34fb。 | + + +## CharacteristicWriteRequest + +描述server端订阅后收到的特征值写请求事件参数结构。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ------------------ | ------ | ---- | ---- | ---------------------------------------- | +| deviceId | string | 是 | 否 | 表示发送特征值写请求的远端设备地址,例如:"XX:XX:XX:XX:XX:XX"。 | +| transId | number | 是 | 否 | 表示写请求的传输ID,server端回复响应时需填写相同的传输ID。 | +| offset | number | 是 | 否 | 表示写特征值数据的起始位置。例如:k表示从第k个字节开始写,server端回复响应时需填写相同的offset。 | +| descriptorUuid | string | 是 | 否 | 表示描述符(descriptor)的UUID,例如:00002902-0000-1000-8000-00805f9b34fb。 | +| characteristicUuid | string | 是 | 否 | 特定特征(characteristic)的UUID,例如:00002a11-0000-1000-8000-00805f9b34fb。 | +| serviceUuid | string | 是 | 否 | 特定服务(service)的UUID,例如:00001888-0000-1000-8000-00805f9b34fb。 | + + +## DescriptorReadRequest + +描述server端订阅后收到的描述符读请求事件参数结构。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ------------------ | ------ | ---- | ---- | ---------------------------------------- | +| deviceId | string | 是 | 否 | 表示发送描述符读请求的远端设备地址,例如:"XX:XX:XX:XX:XX:XX"。 | +| transId | number | 是 | 否 | 表示读请求的传输ID,server端回复响应时需填写相同的传输ID。 | +| offset | number | 是 | 否 | 表示读描述符数据的起始位置。例如:k表示从第k个字节开始读,server端回复响应时需填写相同的offset。 | +| descriptorUuid | string | 是 | 否 | 表示描述符(descriptor)的UUID,例如:00002902-0000-1000-8000-00805f9b34fb。 | +| characteristicUuid | string | 是 | 否 | 特定特征(characteristic)的UUID,例如:00002a11-0000-1000-8000-00805f9b34fb。 | +| serviceUuid | string | 是 | 否 | 特定服务(service)的UUID,例如:00001888-0000-1000-8000-00805f9b34fb。 | + + +## DescriptorWriteRequest + +描述server端订阅后收到的描述符写请求事件参数结构。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ------------------ | ----------- | ---- | ---- | ---------------------------------------- | +| deviceId | string | 是 | 否 | 表示发送描述符写请求的远端设备地址,例如:"XX:XX:XX:XX:XX:XX"。 | +| transId | number | 是 | 否 | 表示写请求的传输ID,server端回复响应时需填写相同的传输ID。 | +| offset | number | 是 | 否 | 表示写描述符数据的起始位置。例如:k表示从第k个字节开始写,server端回复响应时需填写相同的offset。 | +| isPrep | boolean | 是 | 否 | 表示写请求是否立即执行。 | +| needRsp | boolean | 是 | 否 | 表示是否要给client端回复响应。 | +| value | ArrayBuffer | 是 | 否 | 表示写入的描述符二进制数据。 | +| descriptorUuid | string | 是 | 否 | 表示描述符(descriptor)的UUID,例如:00002902-0000-1000-8000-00805f9b34fb。 | +| characteristicUuid | string | 是 | 否 | 特定特征(characteristic)的UUID,例如:00002a11-0000-1000-8000-00805f9b34fb。 | +| serviceUuid | string | 是 | 否 | 特定服务(service)的UUID,例如:00001888-0000-1000-8000-00805f9b34fb。 | + + +## ServerResponse + +描述server端回复client端读/写请求的响应参数结构。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------- | ----------- | ---- | ---- | -------------------------------------- | +| deviceId | string | 是 | 否 | 表示远端设备地址,例如:"XX:XX:XX:XX:XX:XX"。 | +| transId | number | 是 | 否 | 表示请求的传输ID,与订阅的读/写请求事件携带的ID保持一致。 | +| status | number | 是 | 否 | 表示响应的状态,设置为0即可,表示正常。 | +| offset | number | 是 | 否 | 表示请求的读/写起始位置,与订阅的读/写请求事件携带的offset保持一致。 | +| value | ArrayBuffer | 是 | 否 | 表示回复响应的二进制数据。 | + + +## BLEConnectChangedState + +描述Gatt profile连接状态 。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------- | ------------------------------------------------- | ---- | ---- | --------------------------------------------- | +| deviceId | string | 是 | 否 | 表示远端设备地址,例如:"XX:XX:XX:XX:XX:XX"。 | +| state | [ProfileConnectionState](#profileconnectionstate) | 是 | 是 | 表示BLE连接状态的枚举。 | + + +## ProfileConnectionState + +枚举,蓝牙设备的profile连接状态。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 值 | 说明 | +| ------------------- | ---- | -------------- | +| STATE_DISCONNECTED | 0 | 表示profile已断连。 | +| STATE_CONNECTING | 1 | 表示profile正在连接。 | +| STATE_CONNECTED | 2 | 表示profile已连接。 | +| STATE_DISCONNECTING | 3 | 表示profile正在断连。 | + + +## ScanFilter + +扫描过滤参数。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ---------------------------------------- | ----------- | ---- | ---- | ------------------------------------------------------------ | +| deviceId | string | 是 | 是 | 表示过滤的BLE设备地址,例如:"XX:XX:XX:XX:XX:XX"。 | +| name | string | 是 | 是 | 表示过滤的BLE设备名。 | +| serviceUuid | string | 是 | 是 | 表示过滤包含该UUID服务的设备,例如:00001888-0000-1000-8000-00805f9b34fb。 | +| serviceUuidMask | string | 是 | 是 | 表示过滤包含该UUID服务掩码的设备,例如:FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF。 | +| serviceSolicitationUuid | string | 是 | 是 | 表示过滤包含该UUID服务请求的设备,例如:00001888-0000-1000-8000-00805F9B34FB。 | +| serviceSolicitationUuidMask | string | 是 | 是 | 表示过滤包含该UUID服务请求掩码的设备,例如:FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF。 | +| serviceData | ArrayBuffer | 是 | 是 | 表示过滤包含该服务相关数据的设备,例如:[0x90,0x00,0xF1,0xF2]。 | +| serviceDataMask | ArrayBuffer | 是 | 是 | 表示过滤包含该服务相关数据掩码的设备,例如:[0xFF,0xFF,0xFF,0xFF]。 | +| manufactureId | number | 是 | 是 | 表示过滤包含该制造商ID的设备,例如:0x0006。 | +| manufactureData | ArrayBuffer | 是 | 是 | 表示过滤包含该制造商相关数据的设备,例如:[0x1F,0x2F,0x3F]。 | +| manufactureDataMask | ArrayBuffer | 是 | 是 | 表示过滤包含该制造商相关数据掩码的设备,例如:[0xFF,0xFF,0xFF]。 | + + +## ScanOptions + +扫描的配置参数。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| --------- | ----------------------- | ---- | ---- | -------------------------------------- | +| interval | number | 是 | 是 | 表示扫描结果上报延迟时间,默认值为0。 | +| dutyMode | [ScanDuty](#scanduty) | 是 | 是 | 表示扫描模式,默认值为SCAN_MODE_LOW_POWER。 | +| matchMode | [MatchMode](#matchmode) | 是 | 是 | 表示硬件的过滤匹配模式,默认值为MATCH_MODE_AGGRESSIVE。 | + + +## ScanDuty + +枚举,扫描模式。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 值 | 说明 | +| --------------------- | ---- | ------------ | +| SCAN_MODE_LOW_POWER | 0 | 表示低功耗模式,默认值。 | +| SCAN_MODE_BALANCED | 1 | 表示均衡模式。 | +| SCAN_MODE_LOW_LATENCY | 2 | 表示低延迟模式。 | + + +## MatchMode + +枚举,硬件过滤匹配模式。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 值 | 说明 | +| --------------------- | ---- | ---------------------------------------- | +| MATCH_MODE_AGGRESSIVE | 1 | 表示硬件上报扫描结果门限较低,比如扫描到的功率较低或者一段时间扫描到的次数较少也触发上报,默认值。 | +| MATCH_MODE_STICKY | 2 | 表示硬件上报扫描结果门限较高,更高的功率门限以及扫描到多次才会上报。 | + + +## ScanResult + +扫描结果上报数据。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------- | ----------- | ---- | ---- | ---------------------------------- | +| deviceId | string | 是 | 否 | 表示扫描到的设备地址,例如:"XX:XX:XX:XX:XX:XX"。 | +| rssi | number | 是 | 否 | 表示扫描到的设备的rssi值。 | +| data | ArrayBuffer | 是 | 否 | 表示扫描到的设备发送的广播包。 | +| deviceName10+ | string | 是 | 否 | 表示扫描到的设备名称。 | + + +## BluetoothState + +枚举,蓝牙开关状态。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 值 | 说明 | +| --------------------- | ---- | ------------------ | +| STATE_OFF | 0 | 表示蓝牙已关闭。 | +| STATE_TURNING_ON | 1 | 表示蓝牙正在打开。 | +| STATE_ON | 2 | 表示蓝牙已打开。 | +| STATE_TURNING_OFF | 3 | 表示蓝牙正在关闭。 | +| STATE_BLE_TURNING_ON | 4 | 表示蓝牙正在打开LE-only模式。 | +| STATE_BLE_ON | 5 | 表示蓝牙正处于LE-only模式。 | +| STATE_BLE_TURNING_OFF | 6 | 表示蓝牙正在关闭LE-only模式。 | + + +## AdvertiseSetting + +描述蓝牙低功耗设备发送广播的参数。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ----------- | ------- | ---- | ---- | ---------------------------------------- | +| interval | number | 是 | 是 | 表示广播间隔,最小值设置32个slot表示20ms,最大值设置16384个slot,默认值设置为1600个slot表示1s。 | +| txPower | number | 是 | 是 | 表示发送功率,最小值设置-127,最大值设置1,默认值设置-7,单位dbm。 | +| connectable | boolean | 是 | 是 | 表示是否是可连接广播,默认值设置为true。 | + + +## AdvertiseData + +描述BLE广播数据包的内容。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| --------------- | ---------------------------------------- | ---- | ---- | --------------------------- | +| serviceUuids | Array<string> | 是 | 是 | 表示要广播的服务 UUID 列表。 | +| manufactureData | Array<[ManufactureData](#manufacturedata)> | 是 | 是 | 表示要广播的广播的制造商信息列表。 | +| serviceData | Array<[ServiceData](#servicedata)> | 是 | 是 | 表示要广播的服务数据列表。 | + + +## ManufactureData + +描述BLE广播数据包的内容。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ---------------- | ------------------- | ---- | ---- | ------------------ | +| manufactureId | number | 是 | 是 | 表示制造商的ID,由蓝牙SIG分配。 | +| manufactureValue | ArrayBuffer | 是 | 是 | 表示制造商发送的制造商数据。 | + + +## ServiceData + +描述广播包中服务数据内容。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ------------ | ----------- | ---- | ---- | ---------- | +| serviceUuid | string | 是 | 是 | 表示服务的UUID。 | +| serviceValue | ArrayBuffer | 是 | 是 | 表示服务数据。 | + + +## PinRequiredParam + +描述配对请求参数。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------- | ------ | ---- | ---- | ----------- | +| deviceId | string | 是 | 否 | 表示要配对的设备ID。 | +| pinCode | string | 是 | 否 | 表示要配对的密钥。 | +| pinType10+ | [PinType](#pintype10) | 是 | 否 | 表示要配对的设备类型。 | + + +## BondStateParam + +描述配对状态参数。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------- | ------ | ---- | ---- | ----------- | +| deviceId | string | 是 | 否 | 表示要配对的设备ID。 | +| state | BondState | 是 | 否 | 表示配对设备的状态。 | + + +## StateChangeParam + +描述profile状态改变参数。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------- | ------------------------------------------------- | ---- | ---- | ------------------------------- | +| deviceId | string | 是 | 否 | 表示蓝牙设备地址。 | +| state | [ProfileConnectionState](#profileconnectionstate) | 是 | 否 | 表示蓝牙设备的profile连接状态。 | + + +## GattProperties10+ + +描述gatt characteristic的属性。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 类型 | 只读 | 必填 | 说明 | +| -------- | ------ | ---- | ---- | ----------- | +| write10+ | boolean | 是 | 是 | 表示该特征支持写操作,需要对端设备的回复。 | +| writeNoResponse10+ | boolean | 是 | 是 | 表示该特征支持写操作,无需对端设备回复。 | +| read10+ | boolean | 是 | 是 | 表示该特征支持读操作。 | +| notify10+ | boolean | 是 | 是 | 表示该特征可通知对端设备。 | +| indicate10+ | boolean | 是 | 是 | 表示该特征可通知对端设备,需要对端设备的回复。 | + + +## DeviceClass + +描述蓝牙设备的类别。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| --------------- | ----------------------------------- | ---- | ---- | ---------------- | +| majorClass | [MajorClass](#majorclass) | 是 | 否 | 表示蓝牙设备主要类别的枚举。 | +| majorMinorClass | [MajorMinorClass](#majorminorclass) | 是 | 否 | 表示主要次要蓝牙设备类别的枚举。 | +| classOfDevice | number | 是 | 否 | 表示设备类别。 | + + +## MajorClass + +枚举,蓝牙设备主要类别。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 值 | 说明 | +| ------------------- | ------ | ---------- | +| MAJOR_MISC | 0x0000 | 表示杂项设备。 | +| MAJOR_COMPUTER | 0x0100 | 表示计算机设备。 | +| MAJOR_PHONE | 0x0200 | 表示手机设备。 | +| MAJOR_NETWORKING | 0x0300 | 表示网络设备。 | +| MAJOR_AUDIO_VIDEO | 0x0400 | 表示音频和视频设备。 | +| MAJOR_PERIPHERAL | 0x0500 | 表示外围设备。 | +| MAJOR_IMAGING | 0x0600 | 表示成像设备。 | +| MAJOR_WEARABLE | 0x0700 | 表示可穿戴设备。 | +| MAJOR_TOY | 0x0800 | 表示玩具设备。 | +| MAJOR_HEALTH | 0x0900 | 表示健康设备。 | +| MAJOR_UNCATEGORIZED | 0x1F00 | 表示未分类设备。 | + + +## MajorMinorClass + +枚举,主要次要蓝牙设备类别。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 值 | 说明 | +| ---------------------------------------- | ------ | --------------- | +| COMPUTER_UNCATEGORIZED | 0x0100 | 表示未分类计算机设备。 | +| COMPUTER_DESKTOP | 0x0104 | 表示台式计算机设备。 | +| COMPUTER_SERVER | 0x0108 | 表示服务器设备。 | +| COMPUTER_LAPTOP | 0x010C | 表示便携式计算机设备。 | +| COMPUTER_HANDHELD_PC_PDA | 0x0110 | 表示手持式计算机设备。 | +| COMPUTER_PALM_SIZE_PC_PDA | 0x0114 | 表示掌上电脑设备。 | +| COMPUTER_WEARABLE | 0x0118 | 表示可穿戴计算机设备。 | +| COMPUTER_TABLET | 0x011C | 表示平板电脑设备。 | +| PHONE_UNCATEGORIZED | 0x0200 | 表示未分类手机设备。 | +| PHONE_CELLULAR | 0x0204 | 表示便携式手机设备。 | +| PHONE_CORDLESS | 0x0208 | 表示无线电话设备。 | +| PHONE_SMART | 0x020C | 表示智能手机设备。 | +| PHONE_MODEM_OR_GATEWAY | 0x0210 | 表示调制解调器或网关手机设备。 | +| PHONE_ISDN | 0x0214 | 表示ISDN手机设备。 | +| NETWORK_FULLY_AVAILABLE | 0x0300 | 表示网络完全可用设备。 | +| NETWORK_1_TO_17_UTILIZED | 0x0320 | 表示使用网络1到17设备。 | +| NETWORK_17_TO_33_UTILIZED | 0x0340 | 表示使用网络17到33设备。 | +| NETWORK_33_TO_50_UTILIZED | 0x0360 | 表示使用网络33到50设备。 | +| NETWORK_60_TO_67_UTILIZED | 0x0380 | 表示使用网络60到67设备。 | +| NETWORK_67_TO_83_UTILIZED | 0x03A0 | 表示使用网络67到83设备。 | +| NETWORK_83_TO_99_UTILIZED | 0x03C0 | 表示使用网络83到99设备。 | +| NETWORK_NO_SERVICE | 0x03E0 | 表示网络无服务设备。 | +| AUDIO_VIDEO_UNCATEGORIZED | 0x0400 | 表示未分类音频视频设备。 | +| AUDIO_VIDEO_WEARABLE_HEADSET | 0x0404 | 表示可穿戴式音频视频设备。 | +| AUDIO_VIDEO_HANDSFREE | 0x0408 | 表示免提音频视频设备。 | +| AUDIO_VIDEO_MICROPHONE | 0x0410 | 表示麦克风音频视频设备。 | +| AUDIO_VIDEO_LOUDSPEAKER | 0x0414 | 表示扬声器音频视频设备。 | +| AUDIO_VIDEO_HEADPHONES | 0x0418 | 表示头戴式音频视频设备。 | +| AUDIO_VIDEO_PORTABLE_AUDIO | 0x041C | 表示便携式音频视频设备。 | +| AUDIO_VIDEO_CAR_AUDIO | 0x0420 | 表示汽车音频视频设备。 | +| AUDIO_VIDEO_SET_TOP_BOX | 0x0424 | 表示机顶盒音频视频设备。 | +| AUDIO_VIDEO_HIFI_AUDIO | 0x0428 | 表示高保真音响设备。 | +| AUDIO_VIDEO_VCR | 0x042C | 表示录像机音频视频设备。 | +| AUDIO_VIDEO_VIDEO_CAMERA | 0x0430 | 表示照相机音频视频设备。 | +| AUDIO_VIDEO_CAMCORDER | 0x0434 | 表示摄像机音频视频设备。 | +| AUDIO_VIDEO_VIDEO_MONITOR | 0x0438 | 表示监视器音频视频设备。 | +| AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER | 0x043C | 表示视频显示器和扬声器设备。 | +| AUDIO_VIDEO_VIDEO_CONFERENCING | 0x0440 | 表示音频视频会议设备。 | +| AUDIO_VIDEO_VIDEO_GAMING_TOY | 0x0448 | 表示游戏玩具音频视频设备。 | +| PERIPHERAL_NON_KEYBOARD_NON_POINTING | 0x0500 | 表示非键盘非指向外围设备。 | +| PERIPHERAL_KEYBOARD | 0x0540 | 表示外设键盘设备。 | +| PERIPHERAL_POINTING_DEVICE | 0x0580 | 表示定点装置外围设备。 | +| PERIPHERAL_KEYBOARD_POINTING | 0x05C0 | 表示键盘指向外围设备。 | +| PERIPHERAL_UNCATEGORIZED | 0x0500 | 表示未分类外围设备。 | +| PERIPHERAL_JOYSTICK | 0x0504 | 表示周边操纵杆设备。 | +| PERIPHERAL_GAMEPAD | 0x0508 | 表示周边游戏板设备。 | +| PERIPHERAL_REMOTE_CONTROL | 0x05C0 | 表示远程控制外围设备。 | +| PERIPHERAL_SENSING_DEVICE | 0x0510 | 表示外围传感设备设备。 | +| PERIPHERAL_DIGITIZER_TABLET | 0x0514 | 表示外围数字化仪平板电脑设备。 | +| PERIPHERAL_CARD_READER | 0x0518 | 表示外围读卡器设备。 | +| PERIPHERAL_DIGITAL_PEN | 0x051C | 表示外设数码笔设备。 | +| PERIPHERAL_SCANNER_RFID | 0x0520 | 表示射频识别扫描仪外围设备。 | +| PERIPHERAL_GESTURAL_INPUT | 0x0522 | 表示手势输入外围设备。 | +| IMAGING_UNCATEGORIZED | 0x0600 | 表示未分类的图像设备。 | +| IMAGING_DISPLAY | 0x0610 | 表示图像显示设备。 | +| IMAGING_CAMERA | 0x0620 | 表示成像照相机设备。 | +| IMAGING_SCANNER | 0x0640 | 表示成像扫描仪设备。 | +| IMAGING_PRINTER | 0x0680 | 表示成像打印机设备。 | +| WEARABLE_UNCATEGORIZED | 0x0700 | 表示未分类的可穿戴设备。 | +| WEARABLE_WRIST_WATCH | 0x0704 | 表示可穿戴腕表设备。 | +| WEARABLE_PAGER | 0x0708 | 表示可穿戴寻呼机设备。 | +| WEARABLE_JACKET | 0x070C | 表示夹克可穿戴设备。 | +| WEARABLE_HELMET | 0x0710 | 表示可穿戴头盔设备。 | +| WEARABLE_GLASSES | 0x0714 | 表示可穿戴眼镜设备。 | +| TOY_UNCATEGORIZED | 0x0800 | 表示未分类的玩具设备。 | +| TOY_ROBOT | 0x0804 | 表示玩具机器人设备。 | +| TOY_VEHICLE | 0x0808 | 表示玩具车设备。 | +| TOY_DOLL_ACTION_FIGURE | 0x080C | 表示人形娃娃玩具设备。 | +| TOY_CONTROLLER | 0x0810 | 表示玩具控制器设备。 | +| TOY_GAME | 0x0814 | 表示玩具游戏设备。 | +| HEALTH_UNCATEGORIZED | 0x0900 | 表示未分类健康设备。 | +| HEALTH_BLOOD_PRESSURE | 0x0904 | 表示血压健康设备。 | +| HEALTH_THERMOMETER | 0x0908 | 表示温度计健康设备。 | +| HEALTH_WEIGHING | 0x090C | 表示体重健康设备。 | +| HEALTH_GLUCOSE | 0x0910 | 表示葡萄糖健康设备。 | +| HEALTH_PULSE_OXIMETER | 0x0914 | 表示脉搏血氧仪健康设备。 | +| HEALTH_PULSE_RATE | 0x0918 | 表示脉搏率健康设备。 | +| HEALTH_DATA_DISPLAY | 0x091C | 表示数据显示健康设备。 | +| HEALTH_STEP_COUNTER | 0x0920 | 表示阶梯计数器健康设备。 | +| HEALTH_BODY_COMPOSITION_ANALYZER | 0x0924 | 表示身体成分分析仪健康设备。 | +| HEALTH_PEAK_FLOW_MONITOR | 0x0928 | 表示湿度计健康设备。 | +| HEALTH_MEDICATION_MONITOR | 0x092C | 表示药物监视仪健康设备。 | +| HEALTH_KNEE_PROSTHESIS | 0x0930 | 表示膝盖假肢健康设备。 | +| HEALTH_ANKLE_PROSTHESIS | 0x0934 | 表示脚踝假肢健康设备。 | +| HEALTH_GENERIC_HEALTH_MANAGER | 0x0938 | 表示通用健康管理设备。 | +| HEALTH_PERSONAL_MOBILITY_DEVICE | 0x093C | 表示个人移动健康设备。 | + + +## PlayingState + +枚举,蓝牙A2DP 播放状态。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 值 | 说明 | +| ----------------- | ------ | ------- | +| STATE_NOT_PLAYING | 0x0000 | 表示未播放。 | +| STATE_PLAYING | 0x0001 | 表示正在播放。 | + + +## ProfileId + +蓝牙profile枚举,API9新增PROFILE_HID_HOST,PROFILE_PAN_NETWORK。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 值 | 说明 | +| -------------------------------- | ------ | --------------- | +| PROFILE_A2DP_SOURCE | 1 | 表示A2DP profile。 | +| PROFILE_HANDS_FREE_AUDIO_GATEWAY | 4 | 表示HFP profile。 | +| PROFILE_HID_HOST | 6 | 表示HID profile。 | +| PROFILE_PAN_NETWORK | 7 | 表示PAN profile。 | + + +## PinType10+ + +枚举,蓝牙配对类型。 + +**系统能力**:SystemCapability.Communication.Bluetooth.Core。 + +| 名称 | 值 | 说明 | +| -------------------------------- | ------ | --------------- | +| PIN_TYPE_ENTER_PIN_CODE10+ | 0 | 用户需要输入对端设备上显示的PIN码。 | +| PIN_TYPE_ENTER_PASSKEY10+ | 1 | 用户需要输入对端设备上显示的PASSKEY。 | +| PIN_TYPE_CONFIRM_PASSKEY10+ | 2 | 用户需要确认本地设备上显示的PASSKEY。 | +| PIN_TYPE_NO_PASSKEY_CONSENT10+ | 3 | 无PASSKEY,用户需要接受或拒绝配对请求。 | +| PIN_TYPE_NOTIFY_PASSKEY10+ | 4 | 本地设备显示PASSKEY,用户需要在对端设备上输入该PASSKEY。 | +| PIN_TYPE_DISPLAY_PIN_CODE10+ | 5 | bluetooth 2.0设备,用户需要输入对端设备上显示的PIN码。 | +| PIN_TYPE_OOB_CONSENT10+ | 6 | 用户需要接受或拒绝OOB配对请求。 | +| PIN_TYPE_PIN_16_DIGITS10+ | 7 | 用户需要输入对端设备上显示的16位PIN码。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-buffer.md b/zh-cn/application-dev/reference/apis/js-apis-buffer.md index bb380a0d3ce4f09730b869af0cb9a5d1f88db939..9c20286ef332a0afb64454e071a2a915ecb8e74d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-buffer.md +++ b/zh-cn/application-dev/reference/apis/js-apis-buffer.md @@ -417,11 +417,11 @@ isBuffer(obj: Object): boolean ```ts import buffer from '@ohos.buffer'; -buffer.isBuffer(buffer.alloc(10)); // true -buffer.isBuffer(buffer.from('foo')); // true -buffer.isBuffer('a string'); // false -buffer.isBuffer([]); // false -buffer.isBuffer(new Uint8Array(1024)); // false +let result = buffer.isBuffer(buffer.alloc(10)); // true +let result1 = buffer.isBuffer(buffer.from('foo')); // true +let result2 = buffer.isBuffer('a string'); // false +let result3 = buffer.isBuffer([]); // false +let result4 = buffer.isBuffer(new Uint8Array(1024)); // false ``` ## buffer.isEncoding @@ -872,7 +872,7 @@ let buf = buffer.from([0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x70, console.log(buf.readBigInt64BE(0).toString()); let buf1 = buffer.allocUninitializedFromPool(8); -buf1.writeBigInt64BE(0x0102030405060708n, 0); +let result = buf1.writeBigInt64BE(0x0102030405060708n, 0); ``` ### readBigInt64LE @@ -913,7 +913,7 @@ let buf = buffer.from([0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x70, console.log(buf.readBigInt64LE(0).toString()); let buf1 = buffer.allocUninitializedFromPool(8); -buf1.writeBigInt64BE(0x0102030405060708n, 0); +let result = buf1.writeBigInt64BE(0x0102030405060708n, 0); ``` ### readBigUInt64BE @@ -954,7 +954,7 @@ let buf = buffer.from([0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x70, console.log(buf.readBigUInt64BE(0).toString()); let buf1 = buffer.allocUninitializedFromPool(8); -buf1.writeBigUInt64BE(0xdecafafecacefaden, 0); +let result = buf1.writeBigUInt64BE(0xdecafafecacefaden, 0); ``` ### readBigUInt64LE @@ -995,7 +995,7 @@ let buf = buffer.from([0x63, 0x64, 0x65, 0x66, 0x67, 0x68, 0x69, 0x70, console.log(buf.readBigUInt64LE(0).toString()); let buf1 = buffer.allocUninitializedFromPool(8); -buf1.writeBigUInt64BE(0xdecafafecacefaden, 0); +let result = buf1.writeBigUInt64BE(0xdecafafecacefaden, 0); ``` ### readDoubleBE @@ -1035,7 +1035,7 @@ let buf = buffer.from([1, 2, 3, 4, 5, 6, 7, 8]); console.log(buf.readDoubleBE(0).toString()); let buf1 = buffer.allocUninitializedFromPool(8); -buf1.writeDoubleBE(123.456, 0); +let result = buf1.writeDoubleBE(123.456, 0); ``` ### readDoubleLE @@ -1075,7 +1075,7 @@ let buf = buffer.from([1, 2, 3, 4, 5, 6, 7, 8]); console.log(buf.readDoubleLE(0).toString()); let buf1 = buffer.allocUninitializedFromPool(8); -buf1.writeDoubleLE(123.456, 0); +let result = buf1.writeDoubleLE(123.456, 0); ``` ### readFloatBE @@ -1115,7 +1115,7 @@ let buf = buffer.from([1, 2, 3, 4, 5, 6, 7, 8]); console.log(buf.readFloatBE(0).toString()); let buf1 = buffer.allocUninitializedFromPool(4); -buf1.writeFloatBE(0xcabcbcbc, 0); +let result = buf1.writeFloatBE(0xcabcbcbc, 0); ``` ### readFloatLE @@ -1155,7 +1155,7 @@ let buf = buffer.from([1, 2, 3, 4, 5, 6, 7, 8]); console.log(buf.readFloatLE(0).toString()); let buf1 = buffer.allocUninitializedFromPool(4); -buf1.writeFloatLE(0xcabcbcbc, 0); +let result = buf1.writeFloatLE(0xcabcbcbc, 0); ``` ### readInt8 @@ -1196,7 +1196,7 @@ console.log(buf.readInt8(0).toString()); // 打印: -1 console.log(buf.readInt8(1).toString()); // 打印: 5 let buf1 = buffer.allocUninitializedFromPool(2); -buf1.writeInt8(0x12); +let result = buf1.writeInt8(0x12); ``` ### readInt16BE @@ -1236,7 +1236,7 @@ let buf = buffer.from([0, 5]); console.log(buf.readInt16BE(0).toString()); // 打印: 5 let buf1 = buffer.alloc(2); -buf1.writeInt16BE(0x1234, 0); +let result = buf1.writeInt16BE(0x1234, 0); ``` ### readInt16LE @@ -1276,7 +1276,7 @@ let buf = buffer.from([0, 5]); console.log(buf.readInt16LE(0).toString()); // 打印: 1280 let buf1 = buffer.alloc(2); -buf1.writeInt16BE(0x1234, 0); +let result = buf1.writeInt16BE(0x1234, 0); ``` ### readInt32BE @@ -1316,7 +1316,7 @@ let buf = buffer.from([0, 0, 0, 5]); console.log(buf.readInt32BE(0).toString()); // 打印: 5 let buf1 = buffer.alloc(4); -buf1.writeInt32BE(0x12345678, 0); +let result = buf1.writeInt32BE(0x12345678, 0); ``` ### readInt32LE @@ -1356,7 +1356,7 @@ let buf = buffer.from([0, 0, 0, 5]); console.log(buf.readInt32LE(0).toString()); // 打印: 83886080 let buf1 = buffer.alloc(4); -buf1.writeInt32BE(0x12345678, 0); +let result = buf1.writeInt32BE(0x12345678, 0); ``` ### readIntBE @@ -1399,7 +1399,7 @@ let num = buf.readIntBE(0, 1); console.log(num.toString()); // 97 let buf1 = buffer.allocUninitializedFromPool(6); -buf1.writeIntBE(0x123456789011, 0, 6); +let result = buf1.writeIntBE(0x123456789011, 0, 6); ``` @@ -1442,7 +1442,7 @@ let buf = buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]); console.log(buf.readIntLE(0, 6).toString(16)); let buf1 = buffer.allocUninitializedFromPool(6); -buf1.writeIntLE(0x123456789011, 0, 6); +let result = buf1.writeIntLE(0x123456789011, 0, 6); ``` ### readUInt8 @@ -1484,7 +1484,7 @@ console.log(buf.readUInt8(0).toString()); console.log(buf.readUInt8(1).toString()); let buf1 = buffer.allocUninitializedFromPool(4); -buf1.writeUInt8(0x42); +let result = buf1.writeUInt8(0x42); ``` ### readUInt16BE @@ -1526,7 +1526,7 @@ console.log(buf.readUInt16BE(0).toString(16)); console.log(buf.readUInt16BE(1).toString(16)); let buf1 = buffer.allocUninitializedFromPool(4); -buf1.writeUInt16BE(0x1234, 0); +let result = buf1.writeUInt16BE(0x1234, 0); ``` ### readUInt16LE @@ -1568,7 +1568,7 @@ console.log(buf.readUInt16LE(0).toString(16)); console.log(buf.readUInt16LE(1).toString(16)); let buf1 = buffer.allocUninitializedFromPool(4); -buf1.writeUInt16LE(0x1234, 0); +let result = buf1.writeUInt16LE(0x1234, 0); ``` ### readUInt32BE @@ -1609,7 +1609,7 @@ let buf = buffer.from([0x12, 0x34, 0x56, 0x78]); console.log(buf.readUInt32BE(0).toString(16)); let buf1 = buffer.allocUninitializedFromPool(4); -buf1.writeUInt32BE(0x12345678, 0); +let result = buf1.writeUInt32BE(0x12345678, 0); ``` ### readUInt32LE @@ -1650,7 +1650,7 @@ let buf = buffer.from([0x12, 0x34, 0x56, 0x78]); console.log(buf.readUInt32LE(0).toString(16)); let buf1 = buffer.allocUninitializedFromPool(4); -buf1.writeUInt32LE(0x12345678, 0); +let result = buf1.writeUInt32LE(0x12345678, 0); ``` ### readUIntBE @@ -1692,7 +1692,7 @@ let buf = buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]); console.log(buf.readUIntBE(0, 6).toString(16)); let buf1 = buffer.allocUninitializedFromPool(4); -buf1.writeUIntBE(0x13141516, 0, 4); +let result = buf1.writeUIntBE(0x13141516, 0, 4); ``` ### readUIntLE @@ -1734,7 +1734,7 @@ let buf = buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]); console.log(buf.readUIntLE(0, 6).toString(16)); let buf1 = buffer.allocUninitializedFromPool(4); -buf1.writeUIntLE(0x13141516, 0, 4); +let result = buf1.writeUIntLE(0x13141516, 0, 4); ``` ### subarray @@ -2045,7 +2045,7 @@ writeBigInt64BE(value: bigint, offset?: number): number import buffer from '@ohos.buffer'; let buf = buffer.allocUninitializedFromPool(8); -buf.writeBigInt64BE(0x0102030405060708n, 0); +let result = buf.writeBigInt64BE(0x0102030405060708n, 0); ``` ### writeBigInt64LE @@ -2084,7 +2084,7 @@ writeBigInt64LE(value: bigint, offset?: number): number import buffer from '@ohos.buffer'; let buf = buffer.allocUninitializedFromPool(8); -buf.writeBigInt64LE(0x0102030405060708n, 0); +let result = buf.writeBigInt64LE(0x0102030405060708n, 0); ``` ### writeBigUInt64BE @@ -2123,7 +2123,7 @@ writeBigUInt64BE(value: bigint, offset?: number): number import buffer from '@ohos.buffer'; let buf = buffer.allocUninitializedFromPool(8); -buf.writeBigUInt64BE(0xdecafafecacefaden, 0); +let result = buf.writeBigUInt64BE(0xdecafafecacefaden, 0); ``` ### writeBigUInt64LE @@ -2162,7 +2162,7 @@ writeBigUInt64LE(value: bigint, offset?: number): number import buffer from '@ohos.buffer'; let buf = buffer.allocUninitializedFromPool(8); -buf.writeBigUInt64LE(0xdecafafecacefaden, 0); +let result = buf.writeBigUInt64LE(0xdecafafecacefaden, 0); ``` ### writeDoubleBE @@ -2201,7 +2201,7 @@ writeDoubleBE(value: number, offset?: number): number import buffer from '@ohos.buffer'; let buf = buffer.allocUninitializedFromPool(8); -buf.writeDoubleBE(123.456, 0); +let result = buf.writeDoubleBE(123.456, 0); ``` ### writeDoubleLE @@ -2240,7 +2240,7 @@ writeDoubleLE(value: number, offset?: number): number import buffer from '@ohos.buffer'; let buf = buffer.allocUninitializedFromPool(8); -buf.writeDoubleLE(123.456, 0); +let result = buf.writeDoubleLE(123.456, 0); ``` ### writeFloatBE @@ -2279,7 +2279,7 @@ writeFloatBE(value: number, offset?: number): number import buffer from '@ohos.buffer'; let buf = buffer.allocUninitializedFromPool(8); -buf.writeFloatBE(0xcafebabe, 0); +let result = buf.writeFloatBE(0xcafebabe, 0); ``` @@ -2319,7 +2319,7 @@ writeFloatLE(value: number, offset?: number): number import buffer from '@ohos.buffer'; let buf = buffer.allocUninitializedFromPool(8); -buf.writeFloatLE(0xcafebabe, 0); +let result = buf.writeFloatLE(0xcafebabe, 0); ``` ### writeInt8 @@ -2358,8 +2358,8 @@ writeInt8(value: number, offset?: number): number import buffer from '@ohos.buffer'; let buf = buffer.allocUninitializedFromPool(2); -buf.writeInt8(2, 0); -buf.writeInt8(-2, 1); +let result = buf.writeInt8(2, 0); +let result1 = buf.writeInt8(-2, 1); ``` @@ -2399,7 +2399,7 @@ writeInt16BE(value: number, offset?: number): number import buffer from '@ohos.buffer'; let buf = buffer.allocUninitializedFromPool(2); -buf.writeInt16BE(0x0102, 0); +let result = buf.writeInt16BE(0x0102, 0); ``` @@ -2439,7 +2439,7 @@ writeInt16LE(value: number, offset?: number): number import buffer from '@ohos.buffer'; let buf = buffer.allocUninitializedFromPool(2); -buf.writeInt16LE(0x0304, 0); +let result = buf.writeInt16LE(0x0304, 0); ``` ### writeInt32BE @@ -2478,7 +2478,7 @@ writeInt32BE(value: number, offset?: number): number import buffer from '@ohos.buffer'; let buf = buffer.allocUninitializedFromPool(4); -buf.writeInt32BE(0x01020304, 0); +let result = buf.writeInt32BE(0x01020304, 0); ``` @@ -2518,7 +2518,7 @@ writeInt32LE(value: number, offset?: number): number import buffer from '@ohos.buffer'; let buf = buffer.allocUninitializedFromPool(4); -buf.writeInt32LE(0x05060708, 0); +let result = buf.writeInt32LE(0x05060708, 0); ``` ### writeIntBE @@ -2558,7 +2558,7 @@ writeIntBE(value: number, offset: number, byteLength: number): number import buffer from '@ohos.buffer'; let buf = buffer.allocUninitializedFromPool(6); -buf.writeIntBE(0x1234567890ab, 0, 6); +let result = buf.writeIntBE(0x1234567890ab, 0, 6); ``` @@ -2599,7 +2599,7 @@ writeIntLE(value: number, offset: number, byteLength: number): number import buffer from '@ohos.buffer'; let buf = buffer.allocUninitializedFromPool(6); -buf.writeIntLE(0x1234567890ab, 0, 6); +let result = buf.writeIntLE(0x1234567890ab, 0, 6); ``` ### writeUInt8 @@ -2638,10 +2638,10 @@ writeUInt8(value: number, offset?: number): number import buffer from '@ohos.buffer'; let buf = buffer.allocUninitializedFromPool(4); -buf.writeUInt8(0x3, 0); -buf.writeUInt8(0x4, 1); -buf.writeUInt8(0x23, 2); -buf.writeUInt8(0x42, 3); +let result = buf.writeUInt8(0x3, 0); +let result1 = buf.writeUInt8(0x4, 1); +let result2 = buf.writeUInt8(0x23, 2); +let result3 = buf.writeUInt8(0x42, 3); ``` ### writeUInt16BE @@ -2680,8 +2680,8 @@ writeUInt16BE(value: number, offset?: number): number import buffer from '@ohos.buffer'; let buf = buffer.allocUninitializedFromPool(4); -buf.writeUInt16BE(0xdead, 0); -buf.writeUInt16BE(0xbeef, 2); +let result = buf.writeUInt16BE(0xdead, 0); +let result1 = buf.writeUInt16BE(0xbeef, 2); ``` ### writeUInt16LE @@ -2720,8 +2720,8 @@ writeUInt16LE(value: number, offset?: number): number import buffer from '@ohos.buffer'; let buf = buffer.allocUninitializedFromPool(4); -buf.writeUInt16LE(0xdead, 0); -buf.writeUInt16LE(0xbeef, 2); +let result = buf.writeUInt16LE(0xdead, 0); +let result1 = buf.writeUInt16LE(0xbeef, 2); ``` ### writeUInt32BE @@ -2760,7 +2760,7 @@ writeUInt32BE(value: number, offset?: number): number import buffer from '@ohos.buffer'; let buf = buffer.allocUninitializedFromPool(4); -buf.writeUInt32BE(0xfeedface, 0); +let result = buf.writeUInt32BE(0xfeedface, 0); ``` ### writeUInt32LE @@ -2799,7 +2799,7 @@ writeUInt32LE(value: number, offset?: number): number import buffer from '@ohos.buffer'; let buf = buffer.allocUninitializedFromPool(4); -buf.writeUInt32LE(0xfeedface, 0); +let result = buf.writeUInt32LE(0xfeedface, 0); ``` ### writeUIntBE @@ -2839,7 +2839,7 @@ writeUIntBE(value: number, offset: number, byteLength: number): number import buffer from '@ohos.buffer'; let buf = buffer.allocUninitializedFromPool(6); -buf.writeUIntBE(0x1234567890ab, 0, 6); +let result = buf.writeUIntBE(0x1234567890ab, 0, 6); ``` ### writeUIntLE @@ -2879,7 +2879,7 @@ writeUIntLE(value: number, offset: number, byteLength: number): number import buffer from '@ohos.buffer'; let buf = buffer.allocUninitializedFromPool(6); -buf.writeUIntLE(0x1234567890ab, 0, 6); +let result = buf.writeUIntLE(0x1234567890ab, 0, 6); ``` ## Blob 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 e56356947512032eed6b78bb532fdddb82b3eae5..5410dd74cd29becf202eb439a888ea9df22a4885 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 @@ -1,7 +1,7 @@ # ApplicationInfo > **说明:** -> 本模块首批接口从API version 7 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 应用程序信息,未做特殊说明的属性,均通过[bundle.getApplicationInfo](js-apis-Bundle.md#bundlegetapplicationinfodeprecated)获取。 @@ -13,26 +13,25 @@ -| 名称 | 类型 | 可读 | 可写 | 说明 | -|----------------------------|------------------------------------------------------------------------|-----|-----|----------------------------------------------------------------------------------------------------------------------------------------------------------------------| -| name | string | 是 | 否 | 应用程序的名称。 | -| description | string | 是 | 否 | 应用程序的描述信息。 | -| descriptionId | number | 是 | 否 | 应用程序的描述信息的资源id。 | -| systemApp | boolean | 是 | 否 | 判断是否为系统应用程序,默认为false。 | -| enabled | boolean | 是 | 否 | 判断应用程序是否可以使用,默认为true。 | -| label | string | 是 | 否 | 应用程序显示的标签。 | -| labelId | string | 是 | 否 | 应用程序的标签的资源id值。 | -| icon | string | 是 | 否 | 应用程序的图标。 | -| iconId | string | 是 | 否 | 应用程序图标的资源id值。 | -| process | string | 是 | 否 | 应用程序的进程,如果不设置,默认为包的名称。 | -| supportedModes | number | 是 | 否 | 标识应用支持的运行模式,当前只定义了驾驶模式(drive)。该标签只适用于车机。 | -| moduleSourceDirs | Array\ | 是 | 否 | 应用程序的资源存放的相对路径。 | -| permissions | Array\ | 是 | 否 | 访问应用程序所需的权限。
通过调用[bundle.getApplicationInfo](js-apis-Bundle.md#bundlegetapplicationinfodeprecated)接口时,传入GET_APPLICATION_INFO_WITH_PERMISSION获取。 | -| moduleInfos | Array\<[ModuleInfo](js-apis-bundle-ModuleInfo.md)> | 是 | 否 | 应用程序的模块信息。 | -| entryDir | string | 是 | 否 | 应用程序的文件保存路径。 | -| codePath8+ | string | 是 | 否 | 应用程序的安装目录。 | -| metaData8+ | Map\> | 是 | 否 | 应用程序的自定义元信息。
通过调用[bundle.getApplicationInfo](js-apis-Bundle.md#bundlegetapplicationinfodeprecated)接口时,传入GET_APPLICATION_INFO_WITH_METADATA获取。 | -| removable8+ | boolean | 是 | 否 | 应用程序是否可以被移除。 | -| accessTokenId8+ | number | 是 | 否 | 应用程序的accessTokenId。 | -| uid8+ | number | 是 | 否 | 应用程序的uid。 | -| entityType8+ | string | 是 | 否 | 该标签标记该应用的类别,具体有 :游戏类(game),影音类(media)、社交通信类(communication)、新闻类(news)、出行类(travel)、工具类(utility)、购物类(shopping)、教育类(education)、少儿类(kids)、商务类(business)、拍摄类(photography)。 | \ No newline at end of file +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------------------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------------------------------------ | +| name | string | 是 | 否 | 应用程序的名称。 | +| description | string | 是 | 否 | 应用程序的描述信息。 | +| descriptionId | number | 是 | 否 | 应用程序的描述信息的资源id。 | +| systemApp | boolean | 是 | 否 | 判断是否为系统应用程序,默认为false。 | +| enabled | boolean | 是 | 否 | 判断应用程序是否可以使用,默认为true。 | +| label | string | 是 | 否 | 应用程序显示的标签。 | +| labelId | string | 是 | 否 | 应用程序的标签的资源id值。 | +| icon | string | 是 | 否 | 应用程序的图标。 | +| iconId | string | 是 | 否 | 应用程序图标的资源id值。 | +| process | string | 是 | 否 | 应用程序的进程,如果不设置,默认为包的名称。 | +| supportedModes | number | 是 | 否 | 标识应用支持的运行模式,当前只定义了驾驶模式(drive)。该标签只适用于车机。 | +| moduleSourceDirs | Array\ | 是 | 否 | 应用程序的资源存放的相对路径。不能拼接路径访问资源文件,请使用[资源管理接口](js-apis-resource-manager.md)访问资源。 | +| permissions | Array\ | 是 | 否 | 访问应用程序所需的权限。
通过调用[bundle.getApplicationInfo](js-apis-Bundle.md#bundlegetapplicationinfodeprecated)接口时,传入GET_APPLICATION_INFO_WITH_PERMISSION获取。 | +| moduleInfos | Array\<[ModuleInfo](js-apis-bundle-ModuleInfo.md)> | 是 | 否 | 应用程序的模块信息。 | +| entryDir | string | 是 | 否 | 应用程序的文件保存路径。不能拼接路径访问资源文件,请使用[资源管理接口](js-apis-resource-manager.md)访问资源。 | +| codePath8+ | string | 是 | 否 | 应用程序的安装目录。不能拼接路径访问资源文件,请使用[资源管理接口](js-apis-resource-manager.md)访问资源。 | +| metaData8+ | Map\> | 是 | 否 | 应用程序的自定义元信息。
通过调用[bundle.getApplicationInfo](js-apis-Bundle.md#bundlegetapplicationinfodeprecated)接口时,传入GET_APPLICATION_INFO_WITH_METADATA获取。 | +| removable8+ | boolean | 是 | 否 | 应用程序是否可以被移除。 | +| accessTokenId8+ | number | 是 | 否 | 应用程序的accessTokenId。 | +| uid8+ | number | 是 | 否 | 应用程序的uid。 | \ No newline at end of file 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 index 15103ae6cd763d2b54bb4c11955df34ad1be5325..2e8a6df4f99515c552f3cd0ac6de5a5bd7f2a535 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundle-BundleInstaller.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-BundleInstaller.md @@ -21,7 +21,7 @@ ohos.permission.INSTALL_BUNDLE SystemCapability.BundleManager.BundleFramework -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** @@ -71,7 +71,7 @@ ohos.permission.INSTALL_BUNDLE SystemCapability.BundleManager.BundleFramework -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** @@ -120,7 +120,7 @@ ohos.permission.INSTALL_BUNDLE SystemCapability.BundleManager.BundleFramework -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** @@ -161,7 +161,7 @@ bundle.getBundleInstaller().then(installer => { **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework - **系统API:** 此接口为系统接口,三方应用不支持调用 + **系统API:** 此接口为系统接口。 | 名称 | 类型 | 可读 | 可写 | 说明 | | ----------- | ------- | ---- | ---- | ------------------ | @@ -175,7 +175,7 @@ bundle.getBundleInstaller().then(installer => { **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework - **系统API:** 此接口为系统接口,三方应用不支持调用 + **系统API:** 此接口为系统接口。 | 名称 | 类型 | 可读 | 可写 | 说明 | | ------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------ | @@ -183,7 +183,7 @@ bundle.getBundleInstaller().then(installer => { | statusMessage | string | 是 | 否 | 表示安装或卸载的字符串结果信息。取值范围包括:
"SUCCESS" : 安装成功,
"STATUS_INSTALL_FAILURE": 安装失败(不存在安装文件),
"STATUS_INSTALL_FAILURE_ABORTED": 安装中止,
"STATUS_INSTALL_FAILURE_INVALID": 安装参数无效,
"STATUS_INSTALL_FAILURE_CONFLICT": 安装冲突(常见于升级和已有应用基本信息不一致),
"STATUS_INSTALL_FAILURE_STORAGE": 存储包信息失败,
"STATUS_INSTALL_FAILURE_INCOMPATIBLE": 安装不兼容(常见于版本降级安装或者签名信息错误),
"STATUS_UNINSTALL_FAILURE": 卸载失败(不存在卸载的应用),
"STATUS_UNINSTALL_FAILURE_ABORTED": 卸载中止(没有使用),
"STATUS_UNINSTALL_FAILURE_ABORTED": 卸载冲突(卸载系统应用失败, 结束应用进程失败),
"STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT": 安装失败(下载超时),
"STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED": 安装失败(下载失败),
"STATUS_RECOVER_FAILURE_INVALID": 恢复预置应用失败,
"STATUS_ABILITY_NOT_FOUND": Ability未找到,
"STATUS_BMS_SERVICE_ERROR": BMS服务错误,
"STATUS_FAILED_NO_SPACE_LEFT": 设备空间不足,
"STATUS_GRANT_REQUEST_PERMISSIONS_FAILED": 应用授权失败,
"STATUS_INSTALL_PERMISSION_DENIED": 缺少安装权限,
"STATUS_UNINSTALL_PERMISSION_DENIED": 缺少卸载权限| ## 获取应用的沙箱路径 -对于FA模型,应用的沙箱路径可以通过[Context](js-apis-inner-app-context.md)中的方法获取;对于Stage模型,应用的沙箱路径可以通过[Context](js-apis-ability-context.md#abilitycontext)中的属性获取。下面以获取沙箱文件路径为例。 +对于FA模型,应用的沙箱路径可以通过[Context](js-apis-inner-app-context.md)中的方法获取;对于Stage模型,应用的沙箱路径可以通过[Context](js-apis-inner-application-uiAbilityContext.md#abilitycontext)中的属性获取。下面以获取沙箱文件路径为例。 **示例:** ``` ts 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 index c3be16604ba856d95ce87039cb2061e824937218..e0e5c8fb43aec4ef92d5bfcc11e74c08acbd1842 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundle-LauncherAbilityInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-LauncherAbilityInfo.md @@ -11,7 +11,7 @@ LauncherAbilityInfo信息,通过接口[innerBundleManager.getLauncherAbilityIn **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework。 - **系统API:** 此接口为系统接口,三方应用不支持调用。 + **系统API:** 此接口为系统接口。 | 名称 | 类型 | 可读 | 可写 | 说明 | | --------------- | ---------------------------------------------------- | ---- | ---- | -------------------------------------- | diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-ModuleInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-ModuleInfo.md index a3221812add7f5461b29281968e1fd24ae7c3c76..8cfbeddf13b70ba4de142d77d7c0d6289ea22aa4 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundle-ModuleInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-ModuleInfo.md @@ -12,4 +12,4 @@ | 名称 | 类型 | 可读 | 可写 | 说明 | | --------------- | ------ | ---- | ---- | -------- | | moduleName | string | 是 | 否 | 模块名称。 | -| moduleSourceDir | string | 是 | 否 | 安装目录。 | \ No newline at end of file +| moduleSourceDir | string | 是 | 否 | 安装目录。不能拼接路径访问资源文件,请使用[资源管理接口](js-apis-resource-manager.md)访问资源。 | \ 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 index cea742c810f683eb9d204efc6ca7f5dc2cfc5220..da0d229c697483b4e7aa92e07f06dbe6f4766c97 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundle-PermissionDef.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-PermissionDef.md @@ -11,7 +11,7 @@ **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework - **系统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 index 62cf35767b4493b382c281b2c72989448bb8fa0d..5c64ff98ca497b2eb7fd4a5d4c031e1d49b09dff 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundle-remoteAbilityInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-remoteAbilityInfo.md @@ -14,7 +14,7 @@ remoteAbility信息。 **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.DistributedBundleFramework - **系统API:** 此接口为系统接口,三方应用不支持调用 + **系统API:** 此接口为系统接口。 | 名称 | 类型 | 可读 | 可写 | 说明 | | ----------- | -------------------------------------------- | ---- | ---- | ----------------------- | diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundleManager-AppProvisionInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundleManager-AppProvisionInfo.md new file mode 100644 index 0000000000000000000000000000000000000000..4327147b28e0c090f2c98825295be8ae79a277c6 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-bundleManager-AppProvisionInfo.md @@ -0,0 +1,36 @@ +# AppProvisionInfo + +应用[HarmonyAppProvision配置文件](../../security/app-provision-structure.md)中的信息,可以通过[getAppProvisionInfo](js-apis-bundleManager.md#bundlemanagergetappprovisioninfo10)获取。 + +> **说明:** +> 本模块首批接口从API version 10 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +## AppProvisionInfo + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**系统接口:** 此接口为系统接口。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ------------------------- | ------ | ---- | ---- | -------------------- | +| versionCode | number | 是 | 否 | 配置文件的版本号。 | +| versionName | string | 是 | 否 | 配置文件的版本名称。 | +| uuid | string | 是 | 否 | 配置文件中的uuid。 | +| type | string | 是 | 否 | 配置文件的类型,为debug或者release。 | +| appDistributionType | string | 是 | 否 | 配置文件中的分发类型,为app_gallery、enterprise、os_integration和crowdtesting其中之一。 | +| validity | [Validity](#validity) | 是 | 否 | 配置文件中的有效期。 | +| developerId | string | 是 | 否 | 配置文件中的开发者ID。 | +| certificate | string | 是 | 否 | 配置文件中的证书公钥。 | +| apl | string | 是 | 否 | 配置文件中的apl字段,为normal、system_basic和system_core其中之一。 | +| issuer | string | 是 | 否 | 配置文件中的发行者名称。 | + +## Validity + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**系统接口:** 此接口为系统接口。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ------------------------- | ------ | ---- | ---- | -------------------- | +| notBefore | number | 是 | 否 | 配置文件的最早有效日期。 | +| notAfter | number | 是 | 否 | 配置文件的最晚有效日期。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundleManager-BundlePackInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundleManager-BundlePackInfo.md index 553c6f0911813d730d625dd20b84f172f9de0ff8..7de51a3267318e9b7d20dc45bb1b5e2f1150b30e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundleManager-BundlePackInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundleManager-BundlePackInfo.md @@ -1,5 +1,5 @@ # BundlePackInfo - +此接口为系统 > **说明:** > 本模块首批接口从API version 9 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 @@ -62,10 +62,10 @@ | ------------------ | ------------------------------------------------- | ---- | ---- | ---------------------------------- | | mainAbility | string | 是 | 否 | 应用主ability的名称。 | | apiVersion | [ApiVersion](#apiversion) | 是 | 否 | module的api版本。 | -| deviceType | Array\ | 是 | 否 | module的设备类型。 | +| deviceTypes | Array\ | 是 | 否 | module的设备类型。 | | distro | [ModuleDistroInfo](#moduledistroinfo) | 是 | 否 | module发行版信息。 | | abilities | Array\<[ModuleAbilityInfo](#moduleabilityinfo)> | 是 | 否 | module包含的ability组件信息。 | -| extensionAbilities | Array\<[ExtensionAbilities](#extensionability)> | 是 | 否 | 描述extensionAbilities的配置信息。 | +| extensionAbilities | Array\<[ExtensionAbility](#extensionability)> | 是 | 否 | 描述extensionAbilities的配置信息。 | ## ModuleDistroInfo @@ -122,7 +122,7 @@ ## ApiVersion -**系统接口:** 系统接口,三方应用不支持调用。 +**系统接口:** 此接口为系统接口。 **系统能力:** SystemCapability.BundleManager.BundleFrameWork.FreeInstall diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundleManager-applicationInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundleManager-applicationInfo.md index 9ac0871230226db8437ef0c34a495b1d0cac96a2..bf0cbbb9a8716a44ddc1929e97dde91ac8949119 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundleManager-applicationInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundleManager-applicationInfo.md @@ -30,4 +30,6 @@ | descriptionResource | [Resource](js-apis-resource-manager.md#resource9) | 是 | 否 | 应用程序的描述资源信息,通过ApplicationInfo 获取的resource 包含了该资源的信息的bundleName、moduleName 和 id,可以调用全球化的接口[@ohos.resourceManager.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.resourceManager.d.ts)中的getMediaContent来获取详细的资源数据信息。| | appDistributionType | string | 是 | 否 | 应用程序签名证书的分发类型,分为:app_gallery、enterprise、os_integration和crowdtesting。 | | appProvisionType | string | 是 | 否 | 应用程序签名证书文件的类型,分为debug和release两种类型。 | -| systemApp | boolean | 是 | 否 | 标识应用是否为系统应用。 | \ No newline at end of file +| systemApp | boolean | 是 | 否 | 标识应用是否为系统应用。 | +| bundleType |[BundleType](js-apis-bundleManager.md#bundletype) | 是 | 否 | 标识包的类型,取值为APP(普通应用)或者ATOMIC_SERVICE(原子化服务)。 | +| debug10+ | boolean | 是 | 否 | 标识应用是否处于调试模式,默认为false。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundleManager-businessAbilityInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundleManager-businessAbilityInfo.md new file mode 100644 index 0000000000000000000000000000000000000000..deeea708b336bd3a01788a178a6353ff29bbeac8 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-bundleManager-businessAbilityInfo.md @@ -0,0 +1,21 @@ +# BusinessAbilityInfo + +> **说明:** +> 本模块首批接口从API version 10 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +包含基本业务路由信息。 + +## BusinessAbilityInfo + +**系统能力**: SystemCapability.BundleManager.BundleFramework.Core + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| --------------------------------- | ------------------------------------------------------------ | ---- | ---- | -------------------- | +| bundleName | string | 是 | 否 | 表示应用程序的bundleName。 | +| moduleName | string | 是 | 否 | 表示应用程序的moduleName。 | +| name | string | 是 | 否 | 业务路由ability名。 | +| labelId | number | 是 | 否 | 模块标签的资源id。 | +| descriptionId | number | 是 | 否 | 描述信息的资源id。 | +| iconId | number | 是 | 否 | 描述ability信息的图标id。 | +| businessType | [businessAbilityRouter.BusinessType](js-apis-businessAbilityRouter.md#businesstype) | 是 | 否 | 标识枚举业务类型。 | +| applicationInfo | Array\<[ApplicationInfo](js-apis-bundleManager-applicationInfo.md)> | 是 | 否 | 应用程序的信息。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundleManager-hapModuleInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundleManager-hapModuleInfo.md index 3496e020162075029fec44755921de0c08229412..17e56fa5e5866454864b84e4c907f23016e0ce2a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundleManager-hapModuleInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundleManager-hapModuleInfo.md @@ -25,3 +25,28 @@ HAP信息,系统应用可以通过[bundleManager.getBundleInfo](js-apis-bundle | deviceTypes | Array\ | 是 | 否 | 可以运行模块的设备类型。 | | installationFree | boolean | 是 | 否 | 模块是否支持免安装。 | | hashValue | string | 是 | 否 | 模块的Hash值。 | +| moduleType | [ModuleType](js-apis-bundleManager.md#moduletype) | 是 | 否 | 标识当前模块的类型。 | +| preloads | Array\<[PreloadItem](#preloaditem)> | 是 | 否 | 原子化服务中模块的预加载列表。| +| dependencies | Array\<[Dependency](#dependency)> | 是 | 否 | 模块运行依赖的动态共享库列表。 | + +## PreloadItem + +描述原子化服务中模块的预加载模块信息。 + + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| --------- | -------------- | ---- | ---- | --------------------------- | +|moduleName | string | 是 | 否 | 模块运行时,由系统自动执行预加载的模块名称。| + +## Dependency + +描述模块所依赖的动态共享库信息。 + + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ----------- | ------ | ---- | ---- | ---------------------- | +| bundleName | string | 是 | 否 | 标识当前模块依赖的共享包包名。 | +| moduleName | string | 是 | 否 | 标识当前模块依赖的共享包模块名。 | +| versionCode | number | 是 | 否 | 标识当前共享包的版本号。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundleManager-launcherAbilityInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundleManager-launcherAbilityInfo.md index c565e6555c96502f9bfa35e756c80d41127cb03c..6dfe1b84be68dcdda34f3eb03cf204f513faf9a3 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundleManager-launcherAbilityInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundleManager-launcherAbilityInfo.md @@ -8,7 +8,7 @@ **系统能力:** SystemCapability.BundleManager.BundleFramework.Launcher。 - **系统:** 系统接口,三方应用不支持调用。 + **系统:** 此接口为系统接口。 | 名称 | 类型 | 可读 | 可写 | 说明 | | --------------- | ----------------------------------------------------------- | ---- | ---- | ------------------------------------ | diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundleManager-overlayModuleInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundleManager-overlayModuleInfo.md new file mode 100755 index 0000000000000000000000000000000000000000..aaf0668397c0db56c7e0a0ff22eabab2325fc20d --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-bundleManager-overlayModuleInfo.md @@ -0,0 +1,18 @@ +# OverlayModuleInfo + +> **说明:** +> 本模块首批接口从API version 10 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +OverlayModuleInfo信息,系统应用可以通过[overlay.getOverlayModuleInfoByBundleName](js-apis-overlay.md#overlaygetoverlaymoduleinfobybundlename)获取指定应用的overlay特征module的OverlayModuleInfo信息,三方应用可以通过[overlay.getOverlayModuleInfo](js-apis-overlay.md#overlaygetoverlaymoduleinfo)获取当前应用中overlay特征module的OverlayModuleInfo信息。 + +## OverlayModuleInfo + + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Overlay。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| --------------------- | ---------------------------------------------------| ---- | ---- | ---------------------------------------------- | +| bundleName | string | 是 | 否 | overlay特征module所属的应用的bundle名称。 | +| moduleName | string | 是 | 否 | overlay特征module的HAP名称。 | +| targetModuleName | string | 是 | 否 | overlay特征module指定的目标module的HAP名称。 | +| priority | number | 是 | 否 | overlay特征module的优先级。 | +| state | number | 是 | 否 | overlay特征module的禁用使能状态。0代表禁用状态; 1代表使能状态。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundleManager-remoteAbilityInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundleManager-remoteAbilityInfo.md index 8cb105a93ae6b645e7a6918606bdb1c2e42ad73a..95d925883ee3a6bc3c7a7ac40c6002b05887cb92 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundleManager-remoteAbilityInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundleManager-remoteAbilityInfo.md @@ -3,7 +3,7 @@ > **说明:** > 本模块首批接口从API version 9 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 -包含远程的ability信息,通过接口[distributedBundle.getRemoteAbilityInfo](js-apis-distributedBundle.md)获取。 +包含远程的ability信息,通过接口[distributedBundle.getRemoteAbilityInfo](js-apis-distributedBundleManager.md#distributedbundlegetremoteabilityinfo)获取。 ## RemoteAbilityInfo diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundleManager-sharedBundleInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundleManager-sharedBundleInfo.md new file mode 100644 index 0000000000000000000000000000000000000000..7a3f872517b48c574436a6f94ca3d646a8022cf7 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-bundleManager-sharedBundleInfo.md @@ -0,0 +1,32 @@ +# SharedBundleInfo + +> **说明:** +> 本模块首批接口从API version 10 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +共享包信息,通过接口[bundleManager.getSharedBundleInfo](js-apis-bundleManager.md)获取。 + +## SharedBundleInfo + + 共享包信息。 + +**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ---------------- | ------------------------------ | ---- | ---- | ---------------------- | +| name | string | 是 | 否 | 应用共享包名称。 | +| compatiblePolicy | bundleManager.CompatiblePolicy | 是 | 否 | 共享包兼容策略的类型。 | +| sharedModuleInfo | Array\ | 是 | 否 | 应用共享模块信息。 | + +## SharedModuleInfo + +共享模块信息。 + + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ------------- | ------ | ---- | ---- | -------------------------- | +| name | string | 是 | 否 | 共享包模块名称。 | +| versionCode | number | 是 | 否 | 共享包的版本号。 | +| versionName | string | 是 | 否 | 共享包的版本文本描述信息。 | +| description | string | 是 | 否 | 共享包的模块描述信息。 | +| descriptionId | number | 是 | 否 | 共享包描述的资源id值。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundleManager-shortcutInfo.md b/zh-cn/application-dev/reference/apis/js-apis-bundleManager-shortcutInfo.md index 67b3a567cde25339020af03a067b7a4d51f68791..2991bf1bf6718a06c8083f4680434f1813fd41ed 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundleManager-shortcutInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundleManager-shortcutInfo.md @@ -5,7 +5,7 @@ > **说明:** > 本模块首批接口从API version 9 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > -> FA模型配置在[config.json文件中进行配置](../../quick-start/module-structure.md#%E8%A1%A817-shortcuts%E5%AF%B9%E8%B1%A1%E7%9A%84%E5%86%85%E9%83%A8%E7%BB%93%E6%9E%84%E8%AF%B4%E6%98%8E),Stage模型配置参考[shortcuts对象内部结构](../../quick-start/module-configuration-file.md#shortcuts标签)。 +> FA模型配置在[config.json文件中进行配置](../../quick-start/module-structure.md),Stage模型配置参考[shortcuts对象内部结构](../../quick-start/module-configuration-file.md#shortcuts标签)。 ## ShortcutWant diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md b/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md index 4bfaae9a01ad673d9afefbedd94f8113d1e9272c..5dcd85dcb0307a5aecab326370c50d9ef976a5de 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md @@ -48,7 +48,7 @@ import bundleManager from '@ohos.bundle.bundleManager'; **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core。 - **系统接口:** 系统接口,不支持三方应用调用。 + **系统接口:** 此接口为系统接口。 | 名称 | 值 | 说明 | | ------------------------------------ | ---------- | ------------------------------------------------------------ | @@ -63,7 +63,7 @@ Ability组件信息标志,指示需要获取的Ability组件信息的内容。 **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core。 - **系统接口:** 系统接口,不支持三方应用调用。 + **系统接口:** 此接口为系统接口。 | 名称 | 值 | 说明 | | --------------------------------- | ---------- | ------------------------------------------------------------ | @@ -80,7 +80,7 @@ Ability组件信息标志,指示需要获取的Ability组件信息的内容。 **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core。 - **系统接口:** 系统接口,不支持三方应用调用。 + **系统接口:** 此接口为系统接口。 | 名称 | 值 | 说明 | | ------------------------------------------- | ---------- | ------------------------------------------------------------ | @@ -97,12 +97,12 @@ Ability组件信息标志,指示需要获取的Ability组件信息的内容。 | 名称 | 值 | 说明 | |:----------------:|:---:|-----| -| FORM | 0 | [FormExtensionAbility](../../application-models/widget-development-stage.md):卡片扩展能力,提供卡片开发能力。 | +| FORM | 0 | [FormExtensionAbility](../../application-models/service-widget-overview.md):卡片扩展能力,提供卡片开发能力。 | | WORK_SCHEDULER | 1 | [WorkSchedulerExtensionAbility](../../task-management/work-scheduler-dev-guide.md):延时任务扩展能力,允许应用在系统闲时执行实时性不高的任务。 | | INPUT_METHOD | 2 | [InputMethodExtensionAbility](js-apis-inputmethod-extension-ability.md):输入法扩展能力,用于开发输入法应用。 | | SERVICE | 3 | [ServiceExtensionAbility](../../application-models/serviceextensionability.md):后台服务扩展能力,提供后台运行并对外提供相应能力。 | | ACCESSIBILITY | 4 | [AccessibilityExtensionAbility](js-apis-application-accessibilityExtensionAbility.md):无障碍服务扩展能力,支持访问与操作前台界面。 | -| DATA_SHARE | 5 | [DataShareExtensionAbility](../../database/database-datashare-guidelines.md):数据共享扩展能力,用于对外提供数据读写服务。 | +| DATA_SHARE | 5 | [DataShareExtensionAbility](../../database/share-data-by-datashareextensionability.md):数据共享扩展能力,用于对外提供数据读写服务。 | | FILE_SHARE | 6 | FileShareExtensionAbility:文件共享扩展能力,用于应用间的文件分享。预留能力,当前暂未支持。 | | STATIC_SUBSCRIBER| 7 | [StaticSubscriberExtensionAbility](js-apis-application-staticSubscriberExtensionAbility.md):静态广播扩展能力,用于处理静态事件,比如开机事件。 | | WALLPAPER | 8 | WallpaperExtensionAbility:壁纸扩展能力,用于实现桌面壁纸。预留能力,当前暂未支持。 | @@ -111,6 +111,8 @@ Ability组件信息标志,指示需要获取的Ability组件信息的内容。 | ENTERPRISE_ADMIN | 11 | [EnterpriseAdminExtensionAbility](js-apis-EnterpriseAdminExtensionAbility.md):企业设备管理扩展能力,提供企业管理时处理管理事件的能力,比如设备上应用安装事件、锁屏密码输入错误次数过多事件等。 | | THUMBNAIL | 13 | ThumbnailExtensionAbility:文件缩略图扩展能力,用于为文件提供图标缩略图的能力。预留能力,当前暂未支持。 | | PREVIEW | 14 | PreviewExtensionAbility:文件预览扩展能力,提供文件预览的能力,其他应用可以直接在应用中嵌入显示。预留能力,当前暂未支持。 | +| PRINT10+ | 15 | PrintExtensionAbility:文件打印扩展能力,提供应用打印照片、文档等办公场景。当前支持图片打印,文档类型暂未支持。 | +| DRIVER10+ | 18 | DriverExtensionAbility:驱动扩展能力,提供外设驱动扩展能力,当前暂未支持。 | | UNSPECIFIED | 255 | 不指定类型,配合queryExtensionAbilityInfo接口可以查询所有类型的ExtensionAbility。 | @@ -185,6 +187,39 @@ Ability组件信息标志,指示需要获取的Ability组件信息的内容。 | AUTO_ROTATION_PORTRAIT_RESTRICTED |11|表示受开关控制的自动竖向旋转模式。| | LOCKED |12|表示锁定模式。| +### CompatiblePolicy10+ + +标识共享库的版本兼容类型。 + + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core + +| 名称 | 值 | 说明 | +| ---------------------- | ---- | -------------------------------- | +| BACKWARD_COMPATIBILITY | 1 | 该字段表明共享库是向后兼容类型。 | + +### ModuleType + +标识模块类型。 + + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core + +| 名称 | 值 | 说明 | +| ------- | ---- | -------------------- | +| ENTRY | 1 | 应用的主模块。 | +| FEATURE | 2 | 应用的动态特性模块。 | +| SHARED | 3 | 应用的动态共享库模块。 | + +### BundleType + +标识应用的类型。 + + **系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core + +| 名称 | 值 | 说明 | +| -------------- | ---- | --------------- | +| APP | 0 | 该Bundle是普通应用程序。 | +| ATOMIC_SERVICE | 1 | 该Bundle是原子化服务。 | + ## 接口 ### bundleManager.getBundleInfoForSelf @@ -500,7 +535,7 @@ getApplicationInfo(bundleName: string, appFlags: [number](#applicationflag), use | 17700004 | The specified user ID is not found. | | 17700026 | The specified bundle is disabled. | -**示例:** +**示例:** ```ts import bundleManager from '@ohos.bundle.bundleManager'; @@ -1075,7 +1110,7 @@ queryAbilityInfo(want: Want, abilityFlags: [number](#abilityflag), userId?: numb | 错误码ID | 错误信息 | | -------- | ------------------------------------- | | 17700001 | The specified bundleName is not found. | -| 17700003 | The specified extensionAbility is not found. | +| 17700003 | The specified ability is not found. | | 17700004 | The specified userId is invalid. | | 17700026 | The specified bundle is disabled. | | 17700029 | The specified ability is disabled. | @@ -2214,7 +2249,7 @@ try { ### bundleManager.getProfileByAbility -getProfileByAbility(moduleName: string, abilityName: string, metadataName: string, callback: AsyncCallback>): void; +getProfileByAbility(moduleName: string, abilityName: string, metadataName: string, callback: AsyncCallback\\>): void; 以异步方法根据给定的moduleName、abilityName和metadataName获取相应配置文件的json格式字符串,使用callback形式返回结果。 @@ -2265,7 +2300,7 @@ try { ### bundleManager.getProfileByAbility -getProfileByAbility(moduleName: string, abilityName: string, metadataName?: string): Promise>; +getProfileByAbility(moduleName: string, abilityName: string, metadataName?: string): Promise\\>; 以异步方法根据给定的moduleName、abilityName和metadataName获取相应配置文件的json格式字符串,使用Promise形式返回结果。 @@ -2335,7 +2370,7 @@ try { ### bundleManager.getProfileByExtensionAbility -getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName: string, callback: AsyncCallback>): void; +getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName: string, callback: AsyncCallback\\>): void; 以异步方法根据给定的moduleName、extensionAbilityName和metadataName获取相应配置文件的json格式字符串,使用callback形式返回结果。 @@ -2385,7 +2420,7 @@ try { ### bundleManager.getProfileByExtensionAbility -getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName?: string): Promise>; +getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName?: string): Promise\\>; 以异步方法根据给定的moduleName、extensionAbilityName和metadataName获取相应配置文件的json格式字符串,使用Promise形式返回结果。 @@ -2658,7 +2693,6 @@ try { ### bundleManager.getApplicationInfoSync getApplicationInfoSync(bundleName: string, applicationFlags: number, userId: number) : [ApplicationInfo](js-apis-bundleManager-applicationInfo.md); -getApplicationInfoSync(bundleName: string, applicationFlags: number) : [ApplicationInfo](js-apis-bundleManager-applicationInfo.md); 以同步方法根据给定的bundleName、applicationFlags和userId获取ApplicationInfo。 @@ -2709,6 +2743,42 @@ try { } ``` +### bundleManager.getApplicationInfoSync + +getApplicationInfoSync(bundleName: string, applicationFlags: number) : [ApplicationInfo](js-apis-bundleManager-applicationInfo.md); + +以同步方法根据给定的bundleName、applicationFlags获取ApplicationInfo。 + +**系统接口:** 此接口为系统接口。 + +**需要权限:** ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------------- | -------------------------- | ---- | ----------------------------------------------------- | +| bundleName | string | 是 | 表示应用程序的bundleName。 | +| applicationFlags | [number](#applicationflag) | 是 | 表示用于指定将返回的ApplicationInfo对象中包含的信息。 | + +**返回值:** + +| 类型 | 说明 | +| ----------------------------------------------------------- | ------------------------- | +| [ApplicationInfo](js-apis-bundleManager-applicationInfo.md) | 返回ApplicationInfo对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| -------- | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700026 | The specified bundle is disabled. | + +**示例:** + ```ts import bundleManager from '@ohos.bundle.bundleManager'; import hilog from '@ohos.hilog'; @@ -2726,7 +2796,6 @@ try { ### bundleManager.getBundleInfoSync getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag), userId: number): [BundleInfo](js-apis-bundleManager-bundleInfo.md); -getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag)): [BundleInfo](js-apis-bundleManager-bundleInfo.md); 以同步方法根据给定的bundleName、bundleFlags和userId获取BundleInfo。 @@ -2742,7 +2811,7 @@ getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag)): [Bund | ----------- | ------ | ---- | -------------------------------------------------------- | | bundleName | string | 是 | 表示应用程序的bundleName。 | | bundleFlags | [number](#bundleflag) | 是 | 表示用于指定将返回的BundleInfo对象中包含的信息的标志。 | -| userId | number | 否 | 表示用户ID。 | +| userId | number | 是 | 表示用户ID。 | **返回值:** @@ -2777,6 +2846,42 @@ try { } ``` +### bundleManager.getBundleInfoSync + +getBundleInfoSync(bundleName: string, bundleFlags: [number](#bundleflag)): [BundleInfo](js-apis-bundleManager-bundleInfo.md); + +以同步方法根据给定的bundleName、bundleFlags获取BundleInfo。 + +**系统接口:** 此接口为系统接口。 + +**需要权限:** ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | --------------------- | ---- | ------------------------------------------------------ | +| bundleName | string | 是 | 表示应用程序的bundleName。 | +| bundleFlags | [number](#bundleflag) | 是 | 表示用于指定将返回的BundleInfo对象中包含的信息的标志。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------- | -------------------- | +| [BundleInfo](js-apis-bundleManager-bundleInfo.md) | 返回BundleInfo对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| -------- | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700026 | The specified bundle is disabled. | + +**示例:** + ```ts import bundleManager from '@ohos.bundle.bundleManager'; import hilog from '@ohos.hilog'; @@ -2789,3 +2894,340 @@ try { hilog.error(0x0000, 'testTag', 'getBundleInfoSync failed: %{public}s', err.message); } ``` + +### bundleManager.getSharedBundleInfo10+ + +getSharedBundleInfo(bundleName: string, moduleName: string, callback: AsyncCallback\\>): void; + +以异步的方法获取指定的共享包信息,使用callback形式返回结果。 + +**系统接口:** 此接口为系统接口。 + +**需要权限:** ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| bundleName | string | 是 | 表示应用程序的bundleName。 | +| moduleName | string | 是 | 表示被查询的module的name。 | +| callback | AsyncCallback\\> | 是 | 回调函数,当获取成功时,err为null,data为获取的指定共享包信息。 | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| -------- | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700002 | The specified moduleName is not found. | + +**示例:** + +```ts +import bundleManager from '@ohos.bundle.bundleManager'; +import hilog from '@ohos.hilog'; +let bundleName = 'com.example.myapplication'; +let moduleName = 'library'; + +try { + bundleManager.getSharedBundleInfo(bundleName, moduleName, (err, data) => { + if (err) { + hilog.error(0x0000, 'testTag', 'getSharedBundleInfo failed: %{public}s', err.message); + } else { + hilog.info(0x0000, 'testTag', 'getSharedBundleInfo successfully: %{public}s', JSON.stringify(data)); + } + }); +} catch (err) { + hilog.error(0x0000, 'testTag', 'getSharedBundleInfo failed: %{public}s', err.message); +} +``` + +### bundleManager.getSharedBundleInfo10+ + +getSharedBundleInfo(bundleName: string, moduleName: string): Promise\\>; + +以异步的方法获取指定的共享包信息,使用Promise形式返回结果。 + +**系统接口:** 此接口为系统接口 + +**需要权限:** ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | ------ | ---- | -------------------------- | +| bundleName | string | 是 | 表示应用程序的bundleName。 | +| moduleName | string | 是 | 表示被查询的module的name。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------------ | ----------------------------------- | +| Promise\\> | Promise对象,返回指定的共享包信息。 | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| -------- | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700002 | The specified moduleName is not found. | + +**示例:** + +```ts +import bundleManager from '@ohos.bundle.bundleManager'; +import hilog from '@ohos.hilog'; +let bundleName = 'com.example.myapplication'; +let moduleName = 'library'; + +try { + bundleManager.getSharedBundleInfo(bundleName, moduleName).then((data) => { + hilog.info(0x0000, 'testTag', 'getSharedBundleInfo successfully. Data: %{public}s', JSON.stringify(data)); + }).catch(err => { + hilog.error(0x0000, 'testTag', 'getSharedBundleInfo failed. Cause: %{public}s', err.message); + }); +} catch (err) { + hilog.error(0x0000, 'testTag', 'getSharedBundleInfo failed. Cause: %{public}s', err.message); +} +``` + +### bundleManager.getAllSharedBundleInfo10+ + +getAllSharedBundleInfo(callback: AsyncCallback\\>): void; + +以异步的方法获取所有的共享包信息,使用callback形式返回结果。 + +**系统接口:** 此接口为系统接口。 + +**需要权限:** ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| callback | AsyncCallback\\> | 是 | 回调函数,当获取成功时,err为null,data为获所有的共享包信息。 | + +**示例:** + +```ts +import bundleManager from '@ohos.bundle.bundleManager'; +import hilog from '@ohos.hilog'; + +try { + bundleManager.getAllSharedBundleInfo((err, data) => { + if (err) { + hilog.error(0x0000, 'testTag', 'getAllSharedBundleInfo failed: %{public}s', err.message); + } else { + hilog.info(0x0000, 'testTag', 'getAllSharedBundleInfo successfully: %{public}s', JSON.stringify(data)); + } + }); +} catch (err) { + hilog.error(0x0000, 'testTag', 'getAllSharedBundleInfo failed: %{public}s', err.message); +} +``` + +### bundleManager.getAllSharedBundleInfo10+ + +getAllSharedBundleInfo(): Promise\\>; + +以异步的方法获取所有的共享包信息,使用Promise形式返回结果。 + +**系统接口:** 此接口为系统接口 + +**需要权限:** ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------------ | ----------------------------------- | +| Promise\\> | Promise对象,返回所有的共享包信息。 | + +**示例:** + +```ts +import bundleManager from '@ohos.bundle.bundleManager'; +import hilog from '@ohos.hilog'; + +try { + bundleManager.getAllSharedBundleInfo().then((data) => { + hilog.info(0x0000, 'testTag', 'getAllSharedBundleInfo successfully. Data: %{public}s', JSON.stringify(data)); + }).catch(err => { + hilog.error(0x0000, 'testTag', 'getAllSharedBundleInfo failed. Cause: %{public}s', err.message); + }); +} catch (err) { + hilog.error(0x0000, 'testTag', 'getAllSharedBundleInfo failed. Cause: %{public}s', err.message); +} +``` + +### bundleManager.getAppProvisionInfo10+ + +getAppProvisionInfo(bundleName: string, callback: AsyncCallback\<[AppProvisionInfo](js-apis-bundleManager-AppProvisionInfo.md)\>): void; + +以异步的方法获取指定bundleName的provision配置文件信息,使用callback形式返回结果。 + +**系统接口:** 此接口为系统接口。 + +**需要权限:** ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| bundleName | string | 是 | 指定应用的bundleName。 | +| callback | AsyncCallback\<[AppProvisionInfo](js-apis-bundleManager-AppProvisionInfo.md)\> | 是 | 回调函数,当获取成功时,err为null,data为指定bundleName的provision配置文件信息。 | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| -------- | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | + +**示例:** + +```ts +import bundleManager from '@ohos.bundle.bundleManager'; +import hilog from '@ohos.hilog'; +let bundleName = "com.ohos.myapplication"; + +try { + bundleManager.getAppProvisionInfo(bundleName, (err, data) => { + if (err) { + hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed: %{public}s', err.message); + } else { + hilog.info(0x0000, 'testTag', 'getAppProvisionInfo successfully: %{public}s', JSON.stringify(data)); + } + }); +} catch (err) { + hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed: %{public}s', err.message); +} +``` + +### bundleManager.getAppProvisionInfo10+ + +getAppProvisionInfo(bundleName: string, userId: number, callback: AsyncCallback\<[AppProvisionInfo](js-apis-bundleManager-AppProvisionInfo.md)\>): void; + +以异步的方法获取指定bundleName和userId的provision配置文件信息,使用callback形式返回结果。 + +**系统接口:** 此接口为系统接口。 + +**需要权限:** ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| bundleName | string | 是 | 指定应用的bundleName。 | +| userId | number | 是 | 指定用户ID, 可以通过接口[getOsAccountLocalId](js-apis-osAccount.md#getosaccountlocalid9)获取当前设备上的用户ID。 | +| callback | AsyncCallback\<[AppProvisionInfo](js-apis-bundleManager-AppProvisionInfo.md)\> | 是 | 回调函数,当获取成功时,err为null,data为指定bundleName的provision配置文件信息。 | + + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| -------- | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700004 | The specified user ID is not found. | + +**示例:** + +```ts +import bundleManager from '@ohos.bundle.bundleManager'; +import hilog from '@ohos.hilog'; +let bundleName = "com.ohos.myapplication"; +let userId = 100; + +try { + bundleManager.getAppProvisionInfo(bundleName, userId, (err, data) => { + if (err) { + hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed: %{public}s', err.message); + } else { + hilog.info(0x0000, 'testTag', 'getAppProvisionInfo successfully: %{public}s', JSON.stringify(data)); + } + }); +} catch (err) { + hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed: %{public}s', err.message); +} +``` + +### bundleManager.getAppProvisionInfo10+ + +getAppProvisionInfo(bundleName: string, userId?: number): Promise\<[AppProvisionInfo](js-apis-bundleManager-AppProvisionInfo.md)\>; + +以异步的方法根据bundleName和userId获取应用的provision配置文件信息,使用Promise形式返回结果。 + +**系统接口:** 此接口为系统接口 + +**需要权限:** ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| bundleName | string | 是 | 指定的bundleName。 | +| userId | number | 否 | 指定的用户ID,可以通过接口[getOsAccountLocalId](js-apis-osAccount.md#getosaccountlocalid9)获取当前设备上的用户ID。 | + + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------------ | ----------------------------------- | +| Promise\<[AppProvisionInfo](js-apis-bundleManager-AppProvisionInfo.md)\> | Promise对象,返回应用的provision配置文件信息。 | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| -------- | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700004 | The specified user ID is not found. | + +**示例:** + +```ts +import bundleManager from '@ohos.bundle.bundleManager'; +import hilog from '@ohos.hilog'; +let bundleName = "com.ohos.myapplication"; +let userId = 100; + +try { + bundleManager.getAppProvisionInfo(bundleName).then((data) => { + hilog.info(0x0000, 'testTag', 'getAppProvisionInfo successfully. Data: %{public}s', JSON.stringify(data)); + }).catch(err => { + hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed. Cause: %{public}s', err.message); + }); +} catch (err) { + hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed. Cause: %{public}s', err.message); +} + +try { + bundleManager.getAppProvisionInfo(bundleName, userId).then((data) => { + hilog.info(0x0000, 'testTag', 'getAppProvisionInfo successfully. Data: %{public}s', JSON.stringify(data)); + }).catch(err => { + hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed. Cause: %{public}s', err.message); + }); +} catch (err) { + hilog.error(0x0000, 'testTag', 'getAppProvisionInfo failed. Cause: %{public}s', err.message); +} +``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundleMonitor.md b/zh-cn/application-dev/reference/apis/js-apis-bundleMonitor.md index 1660ff419222d10b9fc90290191d0e86712aad7e..639b134facaa224ce680fdecf78220e2add53a34 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-bundleMonitor.md +++ b/zh-cn/application-dev/reference/apis/js-apis-bundleMonitor.md @@ -24,7 +24,7 @@ import bundleMonitor from '@ohos.bundle.bundleMonitor'; **系统能力:** SystemCapability.BundleManager.BundleFramework.Core -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 | 名称 | 类型 | 可读 | 可写 | 说明 | | ---------- | ------ | ---- | ---- | -------------------------- | @@ -33,13 +33,13 @@ import bundleMonitor from '@ohos.bundle.bundleMonitor'; ## bundleMonitor.on -on(type: BundleChangedEvent, callback: callback\): void; +on(type: BundleChangedEvent, callback: Callback\): void; 注册监听应用的安装,卸载,更新。 **需要权限:** ohos.permission.LISTEN_BUNDLE_CHANGE -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **系统能力:** SystemCapability.BundleManager.BundleFramework.Core @@ -66,13 +66,13 @@ try { ## bundleMonitor.off -off(type: BundleChangedEvent, callback?: callback\): void; +off(type: BundleChangedEvent, callback?: Callback\): void; 注销监听应用的安装,卸载,更新。 **需要权限:** ohos.permission.LISTEN_BUNDLE_CHANGE -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **系统能力:** SystemCapability.BundleManager.BundleFramework.Core diff --git a/zh-cn/application-dev/reference/apis/js-apis-businessAbilityRouter.md b/zh-cn/application-dev/reference/apis/js-apis-businessAbilityRouter.md new file mode 100644 index 0000000000000000000000000000000000000000..39213c877d58f8a243a1fd29dd8399f1a82da5ec --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-businessAbilityRouter.md @@ -0,0 +1,130 @@ +# @ohos.app.businessAbilityRouter (业务路由模块) + +本模块用于查询当前设备上安装的各种应用程序的路由ability信息。通过业务路由提供标准的业务模板和业务管理能力,开发者可以按照指定的业务类别注册标准业务,丰富的业务形成一个庞大的超市。系统应用或者三方应用可以从业务路由中获取所需业务,并选择合适的业务使用。同时业务路由提供统一的跳转管控规则,控制应用与业务之间的合理跳转,杜绝前后台任意的跳转行为,避免三方应用通过跳转变相分发,解决安全弱、体验差的问题。 + +> **说明:** +> +> 本模块首批接口从API version 10 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +本模块接口为系统接口。 + +## 导入模块 + +``` ts +import businessAbilityRouter from '@ohos.app.businessAbilityRouter'; +``` + +## 权限列表 + +| 权限 | 权限等级 | 描述 | +| ------------------------------------------ | ------------ | -------------------- | +| ohos.permission.GET_BUNDLE_INFO_PRIVILEGED | system_basic | 可查询所有应用信息。 | + +权限等级参考[权限等级说明](../../security/accesstoken-overview.md#权限等级说明)。 + +## BusinessType + +此枚举值用于标识过滤条件类型。 + +**系统能力:** 以下各项对应的系统能力均为SystemCapability.BundleManager.BundleFramework.Core。 + +**系统接口:** 此接口为系统接口。 + +| 名称 | 值 | 说明 | +| ----------- | ---- | ------------------------------------ | +| SHARE | 0 | 标识具有共享类型的ability信息。 | +| UNSPECIFIED | 255 | 标识未指定类型的ability信息。 | + +## BusinessAbilityFilter + +此过滤值用于过滤查询的ability类型。 + +**系统能力:** SystemCapability.BundleManager.BundleFrameWork.FreeInstall + +**系统接口:** 此接口为系统接口。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ------------ | ------------ | ---- | ---- | -------------------------------------- | +| businessType | BusinessType | 是 | 否 | 标识ability信息的类型。 | +| mimeType | string | 是 | 否 | 标识支持mime类型的ability信息。 | +| uri | string | 是 | 否 | 标识ability信息支持的uri。 | + +## businessAbilityRouter.queryBusinessAbilityInfo + +queryBusinessAbilityInfo(filter: BusinessAbilityFilter, callback: AsyncCallback\\>): void; + +以异步方法通过给定的过滤条件查询ability信息。使用callback异步回调。成功返回查询到的路由ability信息,失败返回对应错误信息。 + +**需要权限:** ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**系统API:** 此接口为系统接口。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ------ | ---- | --------------------------------------- | +| filter | [BusinessAbilityFilter](#businessabilityfilter) | 是 | 支持按业务类型过滤的对象。 | +| callback | AsyncCallback\\> | 是 | 回调函数。返回查询到的ability信息,否则为错误对象。 | + +**示例:** + +```ts +import businessAbilityRouter from '@ohos.app.businessAbilityRouter'; +let filter = {businessType: businessAbilityRouter.BusinessType.SHARE}; + +try { + businessAbilityRouter.queryBusinessAbilityInfo(filter) + .then(() => { + console.info('queryBusinessAbilityInfo success'); + }).catch((error) => { + console.error('queryBusinessAbilityInfo failed ' + error.message); + }); +} catch (error) { + console.error('queryBusinessAbilityInfo failed ' + error.message); +} +``` + +## businessAbilityRouter.queryBusinessAbilityInfo + +queryBusinessAbilityInfo(filter: BusinessAbilityFilter): Promise\\>; + +以异步方法通过给定的过滤条件查询ability信息。使用Promise异步回调,成功返回查询到的路由ability信息,失败返回对应错误信息。 + +**需要权限:** ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**系统API:** 此接口为系统接口。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ------------------------------- | ---- | --------------------------------------- | +| filter | [BusinessAbilityFilter](#businessabilityfilter) | 是 | 包含要查询的ability信息的筛选类型。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------------ | ------------------------------------------- | +| Promise\\> | Promise对象,返回符合过滤条件的ability信息。 | + +**示例:** + +```ts +import businessAbilityRouter from '@ohos.app.businessAbilityRouter'; +let filter = {businessType: businessAbilityRouter.BusinessType.SHARE}; + +try { + businessAbilityRouter.queryBusinessAbilityInfo(filter, (error, data) => { + if (error) { + console.error('queryBusinessAbilityInfo failed ' + error.message); + return; + } + console.info('queryBusinessAbilityInfo success'); + }); +} catch (error) { + console.error('queryBusinessAbilityInfo failed ' + error.message); +} +``` 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 78c21552f22004a4eec28c0c42844ac14faf3a99..6bb1c12adf9393282450eb2a6ab2603d0d614db5 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-call.md +++ b/zh-cn/application-dev/reference/apis/js-apis-call.md @@ -14,12 +14,14 @@ import call from '@ohos.telephony.call'; ``` -## call.dial +## call.dialCall9+ -dial\(phoneNumber: string, callback: AsyncCallback\): void +dialCall\(phoneNumber: string, callback: AsyncCallback\): void 拨打电话。使用callback异步回调。 +**系统接口:** 此接口为系统接口。 + **需要权限**:ohos.permission.PLACE_CALL **系统能力**:SystemCapability.Telephony.CallManager @@ -27,92 +29,142 @@ dial\(phoneNumber: string, callback: AsyncCallback\): void **参数:** | 参数名 | 类型 | 必填 | 说明 | -| ----------- | ---------------------------- | ---- | --------------------------------------- | +| ----------- | ---------------------------- | ---- | -------------------------------------- | | phoneNumber | string | 是 | 电话号码。 | -| callback | AsyncCallback<boolean> | 是 | 回调函数,返回true为成功,false为失败。 | +| callback | AsyncCallback<void> | 是 | 以callback形式异步返回拨打电话的结果。 | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + +| 错误码ID | 错误信息 | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **示例:** ```js -call.dial("138xxxxxxxx", (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.dialCall("138xxxxxxxx", (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` -## call.dial +## call.dialCall9+ -dial\(phoneNumber: string, options: DialOptions, callback: AsyncCallback\): void +dialCall\(phoneNumber: string, options: DialCallOptions, callback: AsyncCallback\): void 拨打电话,可设置通话参数。使用callback异步回调。 +**系统接口:** 此接口为系统接口。 + **需要权限**:ohos.permission.PLACE_CALL **系统能力**:SystemCapability.Telephony.CallManager **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ----------- | ---------------------------- | ---- | --------------------------------------- | -| phoneNumber | string | 是 | 电话号码。 | -| options | [DialOptions](#dialoptions) | 是 | 通话参数,选择为语音通话还是视频通话。 | -| callback | AsyncCallback<boolean> | 是 | 回调函数,返回true为成功,false为失败。 | +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ----------------------------------- | ---- | ----------------------------------- | +| phoneNumber | string | 是 | 电话号码。 | +| options | [DialCallOptions](#dialcalloptions9)| 是 | 通话参数,携带呼叫的其他配置信息。 | +| callback | AsyncCallback<void> | 是 | 以callback形式异步返回拨打电话的结果。| + +**错误码:** + +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + +| 错误码ID | 错误信息 | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **示例:** ```js -call.dial("138xxxxxxxx", { - extras: false -}, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.dialCall("138xxxxxxxx", { + accountId: 0, + videoState: 0, + dialScene: 0, + dialType: 0, +}, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` -## call.dial +## call.dialCall9+ -dial\(phoneNumber: string, options?: DialOptions\): Promise +dialCall\(phoneNumber: string, options?: DialCallOptions\): Promise 拨打电话,可设置通话参数。使用Promise异步回调。 +**系统接口:** 此接口为系统接口。 + **需要权限**:ohos.permission.PLACE_CALL **系统能力**:SystemCapability.Telephony.CallManager **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ----------- | --------------------------- | ---- | -------------------------------------- | -| phoneNumber | string | 是 | 电话号码。 | -| options | [DialOptions](#dialoptions) | 否 | 通话参数,选择为语音通话还是视频通话。 | +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ----------------------------------- | ---- | -------------------------------------- | +| phoneNumber | string | 是 | 电话号码。 | +| options | [DialCallOptions](#dialcalloptions9)| 否 | 通话参数,携带呼叫的其他配置信息。 | **返回值:** -| 类型 | 说明 | -| ---------------------- | ------------------------------------------------------------ | -| Promise<boolean> | 以Promise形式返回拨打电话的结果,返回true为成功,false为失败。 | +| 类型 | 说明 | +| ---------------------- | ---------------------------- | +| Promise<void> | 以Promise形式异步返回拨号结果。| + +**错误码:** + +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + +| 错误码ID | 错误信息 | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | **示例:** ```js -let promise = call.dial("138xxxxxxxx", { - extras: false +let promise = call.dialCall("138xxxxxxxx", { + accountId: 0, + videoState: 0, + dialScene: 0, + dialType: 0, }); -promise.then(data => { - console.log(`dial success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { - console.error(`dial fail, promise: err->${JSON.stringify(err)}`); +promise.then(() => { + console.log(`dialCall success.`); +}).catch((err) => { + console.error(`dialCall fail, promise: err->${JSON.stringify(err)}`); }); ``` +## call.dial(deprecated) -## call.dialCall9+ - -dialCall\(phoneNumber: string, callback: AsyncCallback\): void +dial\(phoneNumber: string, callback: AsyncCallback\): void 拨打电话。使用callback异步回调。 -**系统接口:** 此接口为系统接口。 +> **说明:** +> +> 从API version 6 开始支持,从API version 9 开始废弃。请使用[dialCall](#calldialcall9)替代,替代接口能力仅对系统应用开放。 **需要权限**:ohos.permission.PLACE_CALL @@ -125,33 +177,24 @@ dialCall\(phoneNumber: string, callback: AsyncCallback\): void | phoneNumber | string | 是 | 电话号码。 | | callback | AsyncCallback<boolean> | 是 | 回调函数,返回true为成功,false为失败。 | -**错误码:** - -| 错误码ID | 错误信息 | -| -------- | -------------------------------------------- | -| 201 | Permission denied. | -| 401 | Parameter error. | -| 8300001 | Invalid parameter value. | -| 8300002 | Operation failed. Cannot connect to service. | -| 8300003 | System internal error. | -| 8300999 | Unknown error code. | - **示例:** ```js -call.dialCall("138xxxxxxxx", (err, data) => { +call.dial("138xxxxxxxx", (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` -## call.dialCall9+ +## call.dial(deprecated) -dialCall\(phoneNumber: string, options: DialCallOptions, callback: AsyncCallback\): void +dial\(phoneNumber: string, options: DialOptions, callback: AsyncCallback\): void 拨打电话,可设置通话参数。使用callback异步回调。 -**系统接口:** 此接口为系统接口。 +> **说明:** +> +> 从API version 6 开始支持,从API version 9 开始废弃。请使用[dialCall](#calldialcall9)替代,替代接口能力仅对系统应用开放。 **需要权限**:ohos.permission.PLACE_CALL @@ -159,44 +202,31 @@ dialCall\(phoneNumber: string, options: DialCallOptions, callback: AsyncCallback **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ----------- | ----------------------------------- | ---- | ------------------------------------ | -| phoneNumber | string | 是 | 电话号码。 | -| options | [DialCallOptions](#dialcalloptions9)| 是 | 通话参数,携带呼叫的其他配置信息。 | -| callback | AsyncCallback<boolean> | 是 | 回调函数,返回true为成功,false为失败。 | - -**错误码:** - -| 错误码ID | 错误信息 | -| -------- | -------------------------------------------- | -| 201 | Permission denied. | -| 401 | Parameter error. | -| 8300001 | Invalid parameter value. | -| 8300002 | Operation failed. Cannot connect to service. | -| 8300003 | System internal error. | -| 8300999 | Unknown error code. | +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ---------------------------- | ---- | --------------------------------------- | +| phoneNumber | string | 是 | 电话号码。 | +| options | [DialOptions](#dialoptions) | 是 | 通话参数,选择为语音通话还是视频通话。 | +| callback | AsyncCallback<boolean> | 是 | 回调函数,返回true为成功,false为失败。 | **示例:** ```js -call.dialCall("138xxxxxxxx", { - accountId: 0, - videoState: 0, - dialScene: 0, - dialType: 0, +call.dial("138xxxxxxxx", { + extras: false }, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` +## call.dial(deprecated) -## call.dialCall9+ - -dialCall\(phoneNumber: string, options?: DialCallOptions\): Promise +dial\(phoneNumber: string, options?: DialOptions\): Promise 拨打电话,可设置通话参数。使用Promise异步回调。 -**系统接口:** 此接口为系统接口。 +> **说明:** +> +> 从API version 6 开始支持,从API version 9 开始废弃。请使用[dialCall](#calldialcall9)替代,替代接口能力仅对系统应用开放。 **需要权限**:ohos.permission.PLACE_CALL @@ -204,34 +234,30 @@ dialCall\(phoneNumber: string, options?: DialCallOptions\): Promise **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ----------- | ----------------------------------- | ---- | -------------------------------------- | -| phoneNumber | string | 是 | 电话号码。 | -| options | [DialCallOptions](#dialcalloptions9)| 否 | 通话参数,选择为语音通话还是视频通话。 | +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | --------------------------- | ---- | -------------------------------------- | +| phoneNumber | string | 是 | 电话号码。 | +| options | [DialOptions](#dialoptions) | 否 | 通话参数,选择为语音通话还是视频通话。 | -**错误码:** +**返回值:** -| 错误码ID | 错误信息 | -| -------- | -------------------------------------------- | -| 201 | Permission denied. | -| 401 | Parameter error. | -| 8300001 | Invalid parameter value. | -| 8300002 | Operation failed. Cannot connect to service. | -| 8300003 | System internal error. | -| 8300999 | Unknown error code. | +| 类型 | 说明 | +| ---------------------- | ------------------------------------------------------------ | +| Promise<boolean> | 以Promise形式返回拨打电话的结果,返回true为成功,false为失败。 | **示例:** ```js -try { - call.dialCall('138xxxxxxxx'); - console.log(`dialCall success, promise: data->${JSON.stringify(data)}`); -} catch (error) { - console.log(`dialCall fail, promise: err->${JSON.stringify(error)}`); -} +let promise = call.dial("138xxxxxxxx", { + extras: false +}); +promise.then(data => { + console.log(`dial success, promise: data->${JSON.stringify(data)}`); +}).catch(err => { + console.error(`dial fail, promise: err->${JSON.stringify(err)}`); +}); ``` - ## call.makeCall7+ makeCall(phoneNumber: string, callback: AsyncCallback\): void @@ -249,6 +275,8 @@ makeCall(phoneNumber: string, callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -288,6 +316,8 @@ makeCall(phoneNumber: string): Promise\ **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -440,6 +470,8 @@ isEmergencyPhoneNumber\(phoneNumber: string, callback: AsyncCallback\) **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -475,6 +507,8 @@ isEmergencyPhoneNumber\(phoneNumber: string, options: EmergencyNumberOptions, ca **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -515,6 +549,8 @@ isEmergencyPhoneNumber\(phoneNumber: string, options?: EmergencyNumberOptions\): **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -553,6 +589,8 @@ formatPhoneNumber\(phoneNumber: string, callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -589,6 +627,8 @@ formatPhoneNumber\(phoneNumber: string, options: NumberFormatOptions, callback: **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -633,6 +673,8 @@ formatPhoneNumber\(phoneNumber: string, options?: NumberFormatOptions\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -674,6 +716,8 @@ formatPhoneNumberToE164\(phoneNumber: string, countryCode: string, callback: Asy **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -718,6 +762,8 @@ formatPhoneNumberToE164\(phoneNumber: string, countryCode: string\): Promise\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | +| 201 | Permission denied. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -768,8 +817,8 @@ muteRinger\(callback: AsyncCallback\): void **示例:** ```js -call.muteRinger((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.muteRinger((err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -794,11 +843,11 @@ muteRinger\(\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | -| 401 | Parameter error. | -| 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | | 8300999 | Unknown error code. | @@ -806,18 +855,17 @@ muteRinger\(\): Promise **示例:** ```js -let promise = call.muteRinger(); -promise.then(data => { - console.log(`muteRinger success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.muteRinger().then(() => { + console.log(`muteRinger success.`); +}).catch((err) => { console.error(`muteRinger fail, promise: err->${JSON.stringify(err)}`); }); ``` -## call.answer7+ +## call.answerCall9+ -answer\(callId: number, callback: AsyncCallback\): void +answerCall\(callId: number, callback: AsyncCallback\): void 接听来电。使用callback异步回调。 @@ -836,6 +884,8 @@ answer\(callId: number, callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -848,15 +898,15 @@ answer\(callId: number, callback: AsyncCallback\): void **示例:** ```js -call.answer(1, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.answerCall(1, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` -## call.answer7+ +## call.answerCall9+ -answer(callId?: number\): Promise +answerCall(callId?: number\): Promise 接听来电。使用Promise异步回调。 @@ -880,6 +930,8 @@ answer(callId?: number\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -892,20 +944,19 @@ answer(callId?: number\): 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.answerCall(1).then(() => { + console.log(`answerCall success.`); +}).catch((err) => { + console.error(`answerCall fail, promise: err->${JSON.stringify(err)}`); }); ``` -## call.hangup7+ +## call.answerCall9+ -hangup\(callId: number, callback: AsyncCallback\): void +answerCall\(callback: AsyncCallback\): void -挂断电话。使用callback异步回调。 +接听来电。使用callback异步回调。 **系统接口:** 此接口为系统接口。 @@ -915,13 +966,14 @@ hangup\(callId: number, callback: AsyncCallback\): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------------------------- | ---- | ----------------------------------------------- | -| callId | number | 是 | 呼叫id。可以通过订阅callDetailsChange事件获得。 | -| callback | AsyncCallback<void> | 是 | 回调函数。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ---------- | +| callback | AsyncCallback<void> | 是 | 回调函数。 | **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -934,17 +986,17 @@ hangup\(callId: number, callback: AsyncCallback\): void **示例:** ```js -call.hangup(1, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.answerCall((err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` -## call.answer9+ +## call.hangUpCall9+ -answer\(callback: AsyncCallback\): void +hangUpCall\(callId: number, callback: AsyncCallback\): void -接听来电。使用callback异步回调。 +挂断电话。使用callback异步回调。 **系统接口:** 此接口为系统接口。 @@ -954,12 +1006,15 @@ answer\(callback: AsyncCallback\): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------------------------- | ---- | ---------- | -| callback | AsyncCallback<void> | 是 | 回调函数。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ----------------------------------------------- | +| callId | number | 是 | 呼叫id。可以通过订阅callDetailsChange事件获得。 | +| callback | AsyncCallback<void> | 是 | 回调函数。 | **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -972,15 +1027,15 @@ answer\(callback: AsyncCallback\): void **示例:** ```js -call.answer((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.hangUpCall(1, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` -## call.hangup7+ +## call.hangUpCall9+ -hangup\(callId?: number\): Promise +hangUpCall\(callId?: number\): Promise 挂断电话。使用Promise异步回调。 @@ -1004,6 +1059,8 @@ hangup\(callId?: number\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1016,18 +1073,17 @@ hangup\(callId?: number\): 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.hangUpCall(1).then(() => { + console.log(`hangUpCall success.`); +}).catch((err) => { + console.error(`hangUpCall fail, promise: err->${JSON.stringify(err)}`); }); ``` -## call.hangup9+ +## call.hangUpCall9+ -hangup\(callback: AsyncCallback\): void +hangUpCall\(callback: AsyncCallback\): void 挂断电话。使用callback异步回调。 @@ -1045,6 +1101,8 @@ hangup\(callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1058,15 +1116,15 @@ hangup\(callback: AsyncCallback\): void **示例:** ```js -call.hangup((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.hangUpCall((err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` -## call.reject7+ +## call.rejectCall9+ -reject(callId: number, callback: AsyncCallback\): void +rejectCall(callId: number, callback: AsyncCallback\): void 拒绝来电。使用callback异步回调。 @@ -1085,6 +1143,8 @@ reject(callId: number, callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1098,15 +1158,15 @@ reject(callId: number, callback: AsyncCallback\): void **示例:** ```js -call.reject(1, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.rejectCall(1, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` -## call.reject7+ +## call.rejectCall9+ -reject\(callId: number, options: RejectMessageOptions, callback: AsyncCallback\): void +rejectCall\(callId: number, options: RejectMessageOptions, callback: AsyncCallback\): void 拒绝来电。使用callback异步回调。 @@ -1126,6 +1186,8 @@ reject\(callId: number, options: RejectMessageOptions, callback: AsyncCallback { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.rejectCall(1, rejectMessageOptions, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` -## call.reject7+ +## call.rejectCall9+ -reject(callId?: number, options?: RejectMessageOptions\): Promise +rejectCall(callId?: number, options?: RejectMessageOptions\): Promise 拒绝来电。使用Promise异步回调。 @@ -1174,6 +1236,8 @@ reject(callId?: number, options?: RejectMessageOptions\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1189,18 +1253,17 @@ reject(callId?: number, options?: RejectMessageOptions\): Promise let rejectMessageOptions={ messageContent: "拦截陌生号码" } -let promise = call.reject(1, rejectMessageOptions); -promise.then(data => { - console.log(`reject success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.reject(1, rejectMessageOptions).then(() => { + console.log(`reject success.`); +}).catch((err) => { console.error(`reject fail, promise: err->${JSON.stringify(err)}`); }); ``` -## call.reject9+ +## call.rejectCall9+ -reject\(callback: AsyncCallback\): void +rejectCall\(callback: AsyncCallback\): void 拒绝来电。使用callback异步回调。 @@ -1218,6 +1281,8 @@ reject\(callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1230,15 +1295,15 @@ reject\(callback: AsyncCallback\): void **示例:** ```js -call.reject((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.rejectCall((err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` -## call.reject9+ +## call.rejectCall9+ -reject\(options: RejectMessageOptions, callback: AsyncCallback\): void +rejectCall\(options: RejectMessageOptions, callback: AsyncCallback\): void 拒绝来电。使用callback异步回调。 @@ -1257,6 +1322,8 @@ reject\(options: RejectMessageOptions, callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1272,8 +1339,8 @@ reject\(options: RejectMessageOptions, callback: AsyncCallback\): void let rejectMessageOptions={ messageContent: "拦截陌生号码" } -call.reject(rejectMessageOptions, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.rejectCall(rejectMessageOptions, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1299,6 +1366,8 @@ holdCall\(callId: number, callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1311,8 +1380,8 @@ holdCall\(callId: number, callback: AsyncCallback\): void **示例:** ```js -call.holdCall(1, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.holdCall(1, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1343,6 +1412,8 @@ holdCall\(callId: number\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1355,10 +1426,9 @@ holdCall\(callId: number\): Promise **示例:** ```js -let promise = call.holdCall(1); -promise.then(data => { - console.log(`holdCall success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.holdCall(1).then(() => { + console.log(`holdCall success.`); +}).catch((err) => { console.error(`holdCall fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1384,6 +1454,8 @@ unHoldCall\(callId: number, callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1396,8 +1468,8 @@ unHoldCall\(callId: number, callback: AsyncCallback\): void **示例:** ```js -call.unHoldCall(1, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.unHoldCall(1, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1428,6 +1500,8 @@ unHoldCall\(callId: number\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1440,10 +1514,9 @@ unHoldCall\(callId: number\): Promise **示例:** ```js -let promise = call.unHoldCall(1); -promise.then(data => { - console.log(`unHoldCall success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.unHoldCall(1).then(() => { + console.log(`unHoldCall success.`); +}).catch((err) => { console.error(`unHoldCall fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1469,6 +1542,8 @@ switchCall\(callId: number, callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1481,8 +1556,8 @@ switchCall\(callId: number, callback: AsyncCallback\): void **示例:** ```js -call.switchCall(1, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.switchCall(1, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1513,6 +1588,8 @@ switchCall\(callId: number\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1525,10 +1602,9 @@ switchCall\(callId: number\): Promise **示例:** ```js -let promise = call.switchCall(1); -promise.then(data => { - console.log(`switchCall success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.switchCall(1).then(() => { + console.log(`switchCall success.`); +}).catch((err) => { console.error(`switchCall fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1552,6 +1628,8 @@ combineConference\(callId: number, callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -1563,8 +1641,8 @@ combineConference\(callId: number, callback: AsyncCallback\): void **示例:** ```js -call.combineConference(1, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.combineConference(1, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1593,6 +1671,8 @@ combineConference\(callId: number\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -1604,10 +1684,9 @@ combineConference\(callId: number\): Promise **示例:** ```js -let promise = call.combineConference(1); -promise.then(data => { - console.log(`combineConference success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.combineConference(1).then(() => { + console.log(`combineConference success.`); +}).catch((err) => { console.error(`combineConference fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1631,6 +1710,8 @@ getMainCallId\(callId: number, callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -1673,6 +1754,8 @@ getMainCallId\(callId: number\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -1711,6 +1794,8 @@ getSubCallIdList\(callId: number, callback: AsyncCallback\>\): vo **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -1752,6 +1837,8 @@ getSubCallIdList\(callId: number\): Promise\> **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -1790,6 +1877,8 @@ getCallIdListForConference\(callId: number, callback: AsyncCallback\> **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -1871,6 +1962,8 @@ getCallWaitingStatus\(slotId: number, callback: AsyncCallback **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1957,6 +2052,8 @@ setCallWaiting\(slotId: number, activate: boolean, callback: AsyncCallback { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.setCallWaiting(0, true, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2002,6 +2099,8 @@ setCallWaiting\(slotId: number, activate: boolean\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2014,10 +2113,9 @@ setCallWaiting\(slotId: number, activate: boolean\): Promise **示例:** ```js -let promise = call.setCallWaiting(0, true); -promise.then(data => { - console.log(`setCallWaiting success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.setCallWaiting(0, true).then(() => { + console.log(`setCallWaiting success.`); +}).catch((err) => { console.error(`setCallWaiting fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -2042,6 +2140,8 @@ startDTMF\(callId: number, character: string, callback: AsyncCallback\): **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -2053,8 +2153,8 @@ startDTMF\(callId: number, character: string, callback: AsyncCallback\): **示例:** ```js -call.startDTMF(1, "0", (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.startDTMF(1, "0", (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2084,6 +2184,8 @@ startDTMF\(callId: number, character: string\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -2095,10 +2197,9 @@ startDTMF\(callId: number, character: string\): Promise **示例:** ```js -let promise = call.startDTMF(1, "0"); -promise.then(data => { - console.log(`startDTMF success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.startDTMF(1, "0").then(() => { + console.log(`startDTMF success.`); +}).catch((err) => { console.error(`startDTMF fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -2122,6 +2223,8 @@ stopDTMF\(callId: number, callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -2133,8 +2236,8 @@ stopDTMF\(callId: number, callback: AsyncCallback\): void **示例:** ```js -call.stopDTMF(1, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.stopDTMF(1, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2163,6 +2266,8 @@ stopDTMF\(callId: number\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -2174,10 +2279,9 @@ stopDTMF\(callId: number\): Promise **示例:** ```js -let promise = call.stopDTMF(1); -promise.then(data => { - console.log(`stopDTMF success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.stopDTMF(1).then(() => { + console.log(`stopDTMF success.`); +}).catch((err) => { console.error(`stopDTMF fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -2202,6 +2306,8 @@ isInEmergencyCall\(callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2240,6 +2346,8 @@ isInEmergencyCall\(\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2276,11 +2384,13 @@ on\(type: 'callDetailsChange', callback: Callback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------------- | ---- | -------------------------- | -| type | string | 是 | 通话时监听通话详情的变化。 | -| callback | Callback<[CallAttributeOptions](#callattributeoptions7)> | 是 | 回调函数。 | +| type | string | 是 | 通话时监听通话详情的变化,参数固定为'callDetailsChange'。 | +| callback | Callback<[CallAttributeOptions](#callattributeoptions7)> | 是 | 回调函数。 | **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2314,11 +2424,13 @@ on\(type: 'callEventChange', callback: Callback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------ | ---- | -------------------------- | -| type | string | 是 | 通话时监听通话事件的变化。 | +| type | string | 是 | 通话时监听通话事件的变化,参数固定为'callEventChange'。 | | callback | Callback<[CallEventOptions](#calleventoptions8)> | 是 | 回调函数。 | **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2352,11 +2464,13 @@ on\(type: 'callDisconnectedCause', callback: Callback): vo | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------------ | ---- | -------------------------- | -| type | string | 是 | 通话时监听断开连接的原因。 | +| type | string | 是 | 通话时监听断开连接的原因,参数固定为'callDisconnectedCause'。 | | callback | Callback<[DisconnectedDetails](#disconnecteddetails9)> | 是 | 回调函数。 | **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2390,11 +2504,13 @@ on\(type: 'mmiCodeResult', callback: Callback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------------------------------- | ---- | --------------------- | -| type | string | 是 | 通话时监听MMI码结果。 | +| type | string | 是 | 通话时监听MMI码结果,参数固定为'mmiCodeResult'。 | | callback | Callback<[MmiCodeResults](#mmicoderesults9)> | 是 | 回调函数。 | **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2428,11 +2544,13 @@ off\(type: 'callDetailsChange', callback?: Callback\): vo | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------------------------------------------- | ---- | ---------------------------------- | -| type | string | 是 | 通话结束时取消监听通话详情的变化。 | +| type | string | 是 | 通话结束时取消监听通话详情的变化,参数固定为'callDetailsChange'。 | | callback | Callback<[CallAttributeOptions](#callattributeoptions7)> | 否 | 回调函数。 | **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2466,11 +2584,13 @@ off\(type: 'callEventChange', callback?: Callback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------ | ---- | ---------------------------------- | -| type | string | 是 | 通话结束时取消监听通话事件的变化。 | +| type | string | 是 | 通话结束时取消监听通话事件的变化,参数固定为'callEventChange'。 | | callback | Callback<[CallEventOptions](#calleventoptions8)> | 否 | 回调函数。 | **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2503,12 +2623,14 @@ off\(type: 'callDisconnectedCause', callback?: Callback\): **参数:** | 参数名 | 类型 | 必填 | 说明 | -| -------- | ---------------------------------------------------------- | ---- | -------------------- | -| type | 'callDisconnectedCause' | 是 | 调用断开连接的原因。 | -| callback | Callback**<**[DisconnectedDetails](#disconnecteddetails9)> | 否 | 回调函数。 | +| -------- | ---------------------------------------------------------- | ---- | ------------------- | +| type | string | 是 | 调用断开连接的原因,参数固定为'callDisconnectedCause'。 | +| callback | Callback<[DisconnectedDetails](#disconnecteddetails9)> | 否 | 回调函数。 | **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2540,13 +2662,15 @@ off\(type: 'mmiCodeResult', callback?: Callback\): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | +| 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------ | ---- | ----------- | -| type | 'mmiCodeResult' | 是 | MMI码结果。 | -| callback | Callback<[MmiCodeResults](#mmicoderesults9)> | 否 | 回调函数。 | +| type | string | 是 | MMI码结果,参数固定为'mmiCodeResult'。 | +| callback | Callback<[MmiCodeResults](#mmicoderesults9)> | 否 | 回调函数。 | **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2582,6 +2706,8 @@ isNewCallAllowed\(callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -2617,6 +2743,8 @@ isNewCallAllowed\(\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -2655,6 +2783,8 @@ separateConference\(callId: number, callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -2666,8 +2796,8 @@ separateConference\(callId: number, callback: AsyncCallback\): void **示例:** ```js -call.separateConference(1, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.separateConference(1, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2696,6 +2826,8 @@ separateConference\(callId: number\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -2707,10 +2839,9 @@ separateConference\(callId: number\): Promise **示例:** ```js -let promise = call.separateConference(1); -promise.then(data => { - console.log(`separateConference success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.separateConference(1).then(() => { + console.log(`separateConference success.`); +}).catch((err) => { console.error(`separateConference fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -2737,6 +2868,8 @@ getCallRestrictionStatus\(slotId: number, type: CallRestrictionType, callback: A **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2782,6 +2915,8 @@ getCallRestrictionStatus\(slotId: number, type: CallRestrictionType\): Promise { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.setCallRestriction(0, callRestrictionInfo, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2874,6 +3011,8 @@ setCallRestriction\(slotId: number, info: CallRestrictionInfo\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2891,10 +3030,9 @@ let callRestrictionInfo={ password: "123456", mode: 1 } -let promise = call.setCallRestriction(0, callRestrictionInfo); -promise.then(data => { - console.log(`setCallRestriction success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.setCallRestriction(0, callRestrictionInfo).then(() => { + console.log(`setCallRestriction success.`); +}).catch((err) => { console.error(`setCallRestriction fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -2921,6 +3059,8 @@ getCallTransferInfo\(slotId: number, type: CallTransferType, callback: AsyncCall **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2966,6 +3106,8 @@ getCallTransferInfo\(slotId: number, type: CallTransferType): Promise { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.setCallTransfer(0, callTransferInfo, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -3058,6 +3202,8 @@ setCallTransfer\(slotId: number, info: CallTransferInfo): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -3075,10 +3221,9 @@ let callTransferInfo={ type: 1, settingType: 1 } -let promise = call.setCallTransfer(0, callTransferInfo); -promise.then(data => { - console.log(`setCallTransfer success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.setCallTransfer(0, callTransferInfo).then(() => { + console.log(`setCallTransfer success.`); +}).catch((err) => { console.error(`setCallTransfer fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -3103,6 +3248,8 @@ isRinging\(callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -3141,6 +3288,8 @@ isRinging\(\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -3179,6 +3328,8 @@ setMuted\(callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -3190,8 +3341,8 @@ setMuted\(callback: AsyncCallback\): void **示例:** ```js -call.setMuted((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.setMuted((err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -3214,6 +3365,8 @@ setMuted\(\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -3225,10 +3378,9 @@ setMuted\(\): Promise **示例:** ```js -let promise = call.setMuted(); -promise.then(data => { - console.log(`setMuted success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.setMuted().then(() => { + console.log(`setMuted success.`); +}).catch((err) => { console.error(`setMuted fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -3251,6 +3403,8 @@ cancelMuted(callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -3262,8 +3416,8 @@ cancelMuted(callback: AsyncCallback): void **示例:** ```js -call.cancelMuted((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.cancelMuted((err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -3286,6 +3440,8 @@ cancelMuted(): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -3297,10 +3453,9 @@ cancelMuted(): Promise **示例:** ```js -let promise = call.cancelMuted(); -promise.then(data => { - console.log(`cancelMuted success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.cancelMuted().then(() => { + console.log(`cancelMuted success.`); +}).catch((err) => { console.error(`cancelMuted fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -3324,6 +3479,8 @@ setAudioDevice\(device: AudioDevice, callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -3335,8 +3492,8 @@ setAudioDevice\(device: AudioDevice, callback: AsyncCallback\): void **示例:** ```js -call.setAudioDevice(1, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.setAudioDevice(1, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -3361,6 +3518,8 @@ setAudioDevice\(device: AudioDevice, options: AudioDeviceOptions, callback: Asyn **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -3375,8 +3534,8 @@ setAudioDevice\(device: AudioDevice, options: AudioDeviceOptions, callback: Asyn let audioDeviceOptions={ bluetoothAddress: "IEEE 802-2014" } -call.setAudioDevice(1, audioDeviceOptions, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.setAudioDevice(1, audioDeviceOptions, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -3406,6 +3565,8 @@ setAudioDevice(device: AudioDevice, options?: AudioDeviceOptions): Promise { - console.log(`setAudioDevice success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.setAudioDevice(1, audioDeviceOptions).then(() => { + console.log(`setAudioDevice success.`); +}).catch((err) => { console.error(`setAudioDevice fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -3448,6 +3608,8 @@ joinConference(mainCallId: number, callNumberList: Array, callback: Asy **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -3462,8 +3624,8 @@ joinConference(mainCallId: number, callNumberList: Array, callback: Asy let callNumberList: Array = [ "138XXXXXXXX" ]; -call.joinConference(1, callNumberList, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.joinConference(1, callNumberList, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -3492,6 +3654,8 @@ joinConference(mainCallId: number, callNumberList: Array): Promise): Promise = [ "138XXXXXXXX" ]; -let promise = call.joinConference(1, callNumberList); -promise.then(data => { - console.log(`joinConference success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.joinConference(1, callNumberList).then(() => { + console.log(`joinConference success.`); +}).catch((err) => { console.error(`joinConference fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -3534,6 +3697,8 @@ updateImsCallMode(callId: number, mode: ImsCallMode, callback: AsyncCallback { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.updateImsCallMode(1, 1, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -3575,6 +3740,8 @@ updateImsCallMode(callId: number, mode: ImsCallMode): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -3586,10 +3753,9 @@ updateImsCallMode(callId: number, mode: ImsCallMode): Promise **示例:** ```js -let promise = call.updateImsCallMode(1, 1); -promise.then(data => { - console.log(`updateImsCallMode success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.updateImsCallMode(1, 1).then(() => { + console.log(`updateImsCallMode success.`); +}).catch((err) => { console.error(`updateImsCallMode fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -3615,6 +3781,8 @@ enableImsSwitch(slotId: number, callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -3627,8 +3795,8 @@ enableImsSwitch(slotId: number, callback: AsyncCallback): void **示例:** ```js -call.enableImsSwitch(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.enableImsSwitch(0, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -3658,6 +3826,8 @@ enableImsSwitch(slotId: number): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -3670,10 +3840,9 @@ enableImsSwitch(slotId: number): Promise **示例:** ```js -let promise = call.enableImsSwitch(0); -promise.then(data => { - console.log(`enableImsSwitch success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.enableImsSwitch(0).then(() => { + console.log(`enableImsSwitch success.`); +}).catch((err) => { console.error(`enableImsSwitch fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -3699,6 +3868,8 @@ disableImsSwitch(slotId: number, callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -3711,8 +3882,8 @@ disableImsSwitch(slotId: number, callback: AsyncCallback): void **示例:** ```js -call.disableImsSwitch(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +call.disableImsSwitch(0, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -3730,19 +3901,21 @@ disableImsSwitch(slotId: number): Promise **参数:** -| 参数名 | 类型 | 必填 | 说明 | +| 参数名 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | -------------------------------------- | -| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | **返回值:** -| 类型 | 说明 | +| 类型 | 说明 | | ------------------- | --------------------------- | -| Promise<void> | 以Promise形式异步返回结果。 | +| Promise<void> | 以Promise形式异步返回结果。 | **错误码:** -| 错误码ID | 错误信息 | +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + +| 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | | 401 | Parameter error. | @@ -3754,10 +3927,9 @@ disableImsSwitch(slotId: number): Promise **示例:** ```js -let promise = call.disableImsSwitch(0); -promise.then(data => { - console.log(`disableImsSwitch success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +call.disableImsSwitch(0).then(() => { + console.log(`disableImsSwitch success.`); +}).catch((err) => { console.error(`disableImsSwitch fail, promise: err->${JSON.stringify(err)}`); }); ``` @@ -3781,6 +3953,8 @@ isImsSwitchEnabled(slotId: number, callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -3821,6 +3995,8 @@ isImsSwitchEnabled(slotId: number): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -3844,7 +4020,7 @@ promise.then(data => { 拨打电话的可选参数。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 类型 | 必填 | 说明 | | ------------------------ | ---------------------------------- | ---- | ----------------------------------------------------------------------------------------------- | @@ -3858,7 +4034,7 @@ promise.then(data => { 拨打电话的可选参数。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 类型 | 必填 | 说明 | | ------------------------ | ---------------------------------- | ---- | ------------------------------------------------------------ | @@ -3871,7 +4047,7 @@ promise.then(data => { 通话状态码。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 值 | 说明 | | ------------------ | ---- | ------------------------------------------------------------ | @@ -3884,7 +4060,7 @@ promise.then(data => { 判断是否是紧急电话号码的可选参数。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | ---------------------------------------------- | @@ -3894,7 +4070,7 @@ promise.then(data => { 格式化号码的可选参数。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 类型 | 必填 | 说明 | | ----------- | ------ | ---- | ---------------------------------------------------------- | @@ -3906,7 +4082,7 @@ IP多媒体系统调用模式。 **系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 值 | 说明 | | ---------------------- | ---- | ------------------ | @@ -3922,7 +4098,7 @@ IP多媒体系统调用模式。 **系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 值 | 说明 | | -------------------- | ---- | ------------ | @@ -3938,7 +4114,7 @@ IP多媒体系统调用模式。 **系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 值 | 说明 | | --------------------------------------------- | ---- | -------------------------- | @@ -3957,7 +4133,7 @@ IP多媒体系统调用模式。 **系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 类型 | 必填 | 说明 | | ------------------------ | ---------------------------------------------------- | ---- | ---------------- | @@ -3975,7 +4151,7 @@ IP多媒体系统调用模式。 **系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 值 | 说明 | | --------------------------- | ---- | ------------ | @@ -3990,7 +4166,7 @@ IP多媒体系统调用模式。 **系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 值 | 说明 | | -------------------------- | ---- | ------------ | @@ -4005,7 +4181,7 @@ IP多媒体系统调用模式。 **系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 类型 | 必填 | 说明 | | --------------- | ---------------------------------------- | ---- | -------------- | @@ -4026,7 +4202,7 @@ IP多媒体系统调用模式。 **系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 值 | 说明 | | ---------------------------- | ---- | -------------- | @@ -4041,7 +4217,7 @@ IP多媒体系统调用模式。 **系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 值 | 说明 | | ------------- | ---- | ------------ | @@ -4056,7 +4232,7 @@ IP多媒体系统调用模式。 **系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 值 | 说明 | | ---------- | ---- | -------- | @@ -4069,7 +4245,7 @@ IP多媒体系统调用模式。 **系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 值 | 说明 | | ------------------------- | ---- | -------------- | @@ -4089,7 +4265,7 @@ IP多媒体系统调用模式。 **系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 类型 | 必填 | 说明 | | -------- | -------------------------------------------- | ---- | ------------ | @@ -4103,7 +4279,7 @@ IP多媒体系统调用模式。 **系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 值 | 说明 | | ----------------------------- | ---- | ------------ | @@ -4116,7 +4292,7 @@ IP多媒体系统调用模式。 **系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 类型 | 必填 | 说明 | | ------- | ------------------------------------------ | ---- | -------------- | @@ -4128,7 +4304,7 @@ IP多媒体系统调用模式。 **系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 值 | 说明 | | ------------------------ | ---- | --------------- | @@ -4141,7 +4317,7 @@ IP多媒体系统调用模式。 **系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 值 | 说明 | | --------------- | ---- | ------------ | @@ -4155,7 +4331,7 @@ IP多媒体系统调用模式。 **系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 值 | 说明 | | -------------------- | ---- | ---------------- | @@ -4169,7 +4345,7 @@ IP多媒体系统调用模式。 **系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 类型 | 必填 | 说明 | | -------------- | ------ | ---- | -------- | @@ -4181,7 +4357,7 @@ IP多媒体系统调用模式。 **系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 类型 | 必填 | 说明 | | ------------------------ | ---------------------------------- | ---- | ---------------- | @@ -4198,7 +4374,7 @@ IP多媒体系统调用模式。 **系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 值 | 说明 | | -------------------- | ---- | ------------ | @@ -4211,7 +4387,7 @@ IP多媒体系统调用模式。 **系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 值 | 说明 | | ------------------- | ---- | -------- | @@ -4224,7 +4400,7 @@ IP多媒体系统调用模式。 **系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 值 | 说明 | | ---------------- | ---- | -------- | @@ -4237,7 +4413,7 @@ IP多媒体系统调用模式。 **系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 类型 | 必填 | 说明 | | ------- | ------------------------------------------ | ---- | --------------- | @@ -4250,7 +4426,7 @@ IP多媒体系统调用模式。 **系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 值 | 说明 | | ------------------------------------------------------------ | ---- | --------------------------------------- | @@ -4340,7 +4516,7 @@ MMI码结果。 **系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 类型 | 必填 | 说明 | | ------- | -------------------------------- | ---- | --------------- | @@ -4353,7 +4529,7 @@ MMI码结果。 **系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 值 | 说明 | | ---------------- | ---- | ------------- | @@ -4366,7 +4542,7 @@ MMI码结果。 **系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CallManager。 +**系统能力**:SystemCapability.Telephony.CallManager | 名称 | 类型 | 必填 | 说明 | | ---------------- | ------ | ---- | -------- | 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 9bb488cd0f25aa51bc4b9c220d21f4c82d70e082..38166decdca37fe86b80ab0190efea32f3ecae83 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-camera.md +++ b/zh-cn/application-dev/reference/apis/js-apis-camera.md @@ -31,6 +31,15 @@ getCameraManager(context: Context): CameraManager | ----------------------------------------------- | ---------------------------- | | [CameraManager](#cameramanager) | 相机管理器。 | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | +| 7400201 | Camera service fatal error. | + **示例:** ```js @@ -90,10 +99,10 @@ let cameraManager = camera.getCameraManager(context); | 名称 | 类型 | 必填 | 说明 | | ----------------------------- | -------------------------------------------------- | --- |------------------- | -| previewProfiles | Array<[Profile](#profile)\> | 是 | 支持的预览配置信息。 | -| photoProfiles | Array<[Profile](#profile)\> | 是 | 支持的拍照配置信息。 | -| videoProfiles | Array<[VideoProfile](#videoprofile)\> | 是 | 支持的录像配置信息。 | -| supportedMetadataObjectTypes | Array<[MetadataObjectType](#metadataobjecttype)\> | 是 | 支持的metadata流类型信息。| +| previewProfiles | Array\<[Profile](#profile)\> | 是 | 支持的预览配置信息。 | +| photoProfiles | Array\<[Profile](#profile)\> | 是 | 支持的拍照配置信息。 | +| videoProfiles | Array\<[VideoProfile](#videoprofile)\> | 是 | 支持的录像配置信息。 | +| supportedMetadataObjectTypes | Array\<[MetadataObjectType](#metadataobjecttype)\> | 是 | 支持的metadata流类型信息。| ## CameraErrorCode @@ -119,7 +128,7 @@ let cameraManager = camera.getCameraManager(context); ### getSupportedCameras -getSupportedCameras(): Array +getSupportedCameras(): Array\ 获取支持指定的相机设备对象,同步返回结果。 @@ -129,7 +138,7 @@ getSupportedCameras(): Array | 类型 | 说明 | | ----------------------------------------------- | ---------------------------- | -| Array<[CameraDevice](#cameradevice)> | 相机设备列表。 | +| Array\<[CameraDevice](#cameradevice)> | 相机设备列表。 | **示例:** @@ -140,7 +149,7 @@ let cameras = cameraManager.getSupportedCameras(); ### getSupportedOutputCapability -getSupportedOutputCapability(cameraDevice:CameraDevice): CameraOutputCapability +getSupportedOutputCapability(camera:CameraDevice): CameraOutputCapability 查询相机设备在模式下支持的输出能力,同步返回结果。 @@ -255,6 +264,14 @@ createCameraInput(camera: CameraDevice): CameraInput | ---------- | ----------------------------- | | [CameraInput](#camerainput) | CameraInput实例。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | + **示例:** ```js @@ -291,6 +308,14 @@ createCameraInput(position: CameraPosition, type: CameraType): CameraInput | ---------- | ----------------------------- | | [CameraInput](#camerainput) | CameraInput实例。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | + **示例:** ```js @@ -327,6 +352,14 @@ createPreviewOutput(profile: Profile, surfaceId: string): PreviewOutput | ---------- | ----------------------------- | | [PreviewOutput](#previewoutput) | PreviewOutput实例。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | + **示例:** ```js @@ -361,6 +394,14 @@ createPhotoOutput(profile: Profile, surfaceId: string): PhotoOutput | ---------- | ----------------------------- | | [PhotoOutput](#photooutput) | PhotoOutput实例。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | + **示例:** ```js @@ -395,6 +436,14 @@ createVideoOutput(profile: VideoProfile, surfaceId: string): VideoOutput | ---------- | ----------------------------- | | [VideoOutput](#videooutput) | VideoOutput实例。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | + **示例:** ```js @@ -410,7 +459,7 @@ try { ### createMetadataOutput -createMetadataOutput(metadataObjectTypes:Array): MetadataOutput +createMetadataOutput(metadataObjectTypes:Array\): MetadataOutput 创建metadata流输出对象,同步返回结果。 @@ -420,7 +469,7 @@ createMetadataOutput(metadataObjectTypes:Array): MetadataOu | 参数名 | 类型 | 必填 | 说明 | | -------------------- | -------------------------------------------------- | --- | ---------------------------- | -| metadataObjectTypes | Array<[MetadataObjectType](#metadataobjecttype)\> | 是 | metadata流类型信息,通过getSupportedOutputCapability接口获取。 | +| metadataObjectTypes | Array\<[MetadataObjectType](#metadataobjecttype)\> | 是 | metadata流类型信息,通过getSupportedOutputCapability接口获取。 | **返回值:** @@ -428,6 +477,14 @@ createMetadataOutput(metadataObjectTypes:Array): MetadataOu | ---------- | ----------------------------- | | [MetadataOutput](#metadataoutput) | MetadataOutput实例。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | + **示例:** ```js @@ -455,6 +512,14 @@ createCaptureSession(): CaptureSession | ---------- | ----------------------------- | | [CaptureSession](#capturesession) | CaptureSession实例。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | + **示例:** ```js @@ -469,7 +534,7 @@ try { ### on('cameraStatus') -on(type: 'cameraStatus', callback: AsyncCallback): void +on(type: 'cameraStatus', callback: AsyncCallback\): void 相机设备状态回调,通过注册回调函数获取相机的状态变化。 @@ -480,7 +545,7 @@ on(type: 'cameraStatus', callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -----------------| ---- | --------- | | type | string | 是 | 监听事件,固定为'cameraStatus'。cameraManager对象获取成功后可监听。目前只支持对设备打开或者关闭会触发该事件并返回对应信息 | -| callback | AsyncCallback<[CameraStatusInfo](#camerastatusinfo)\> | 是 | 回调函数,用于获取镜头状态变化信息。 | | +| callback | AsyncCallback\<[CameraStatusInfo](#camerastatusinfo)\> | 是 | 回调函数,用于获取镜头状态变化信息。 | | **示例:** @@ -493,7 +558,7 @@ cameraManager.on('cameraStatus', (cameraStatusInfo) => { ### on('cameraMute') -on(type: 'cameraMute', callback: AsyncCallback): void +on(type: 'cameraMute', callback: AsyncCallback\): void 禁用回调,通过注册回调函数获取相机禁用状态变化。 @@ -618,7 +683,7 @@ cameraManager.on('cameraMute', (curMuetd) => { ### open -open\(callback: AsyncCallback\): void +open\(callback: AsyncCallback\\): void 打开相机,通过注册回调函数获取状态。 @@ -628,7 +693,17 @@ open\(callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------- | ---- | ------------------- | -| callback | AsyncCallback | 是 | 回调函数,用于获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| callback | AsyncCallback\ | 是 | 回调函数,用于获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | + +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400107 | Can not use camera cause of conflict. | +| 7400108 | Camera disabled cause of security reason. | +| 7400201 | Camera service fatal error. | **示例:** @@ -644,7 +719,7 @@ cameraInput.open((err) => { ### open -open(): Promise +open(): Promise\ 打开相机,通过Promise获取相机的状态。 @@ -654,7 +729,17 @@ open(): Promise | 类型 | 说明 | | -------------- | ----------------------- | -| Promise | 使用Promise的方式获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| Promise\ | 使用Promise的方式获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | + +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400107 | Can not use camera cause of conflict. | +| 7400108 | Camera disabled cause of security reason. | +| 7400201 | Camera service fatal error. | **示例:** @@ -668,7 +753,7 @@ cameraInput.open().then(() => { ### close -close\(callback: AsyncCallback\): void +close\(callback: AsyncCallback\\): void 关闭相机,通过注册回调函数获取状态。 @@ -678,7 +763,15 @@ close\(callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------- | ---- | -------------------- | -| callback | AsyncCallback | 是 | 回调函数,用于获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| callback | AsyncCallback\ | 是 | 回调函数,用于获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | + +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | **示例:** @@ -694,7 +787,7 @@ cameraInput.close((err) => { ### close -close(): Promise +close(): Promise\ 关闭相机,通过Promise获取状态。 @@ -704,7 +797,15 @@ close(): Promise | 类型 | 说明 | | -------------- | ----------------------- | -| Promise | 使用Promise的方式获取结果。 | +| Promise\ | 使用Promise的方式获取结果。 | + +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | **示例:** @@ -718,7 +819,7 @@ cameraInput.close().then(() => { ### on('error') -on(type: 'error', cameraDevice:CameraDevice, callback: ErrorCallback): void +on(type: 'error', camera:CameraDevice, callback: ErrorCallback\): void 监听CameraInput的错误事件,通过注册回调函数获取结果。 @@ -730,7 +831,7 @@ on(type: 'error', cameraDevice:CameraDevice, callback: ErrorCallback | 是 | 回调函数,用于获取结果。返回错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| callback | ErrorCallback\ | 是 | 回调函数,用于获取结果。返回错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | **示例:** @@ -823,6 +924,14 @@ beginConfig(): void | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | 接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400105 | Session config locked. | + **示例:** ```js @@ -836,7 +945,7 @@ try { ### commitConfig -commitConfig(callback: AsyncCallback): void +commitConfig(callback: AsyncCallback\): void 提交配置信息,通过注册回调函数获取结果。 @@ -846,7 +955,16 @@ commitConfig(callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------- | ---- | -------------------- | -| callback | AsyncCallback | 是 | 回调函数,用于获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| callback | AsyncCallback\ | 是 | 回调函数,用于获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | + +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400102 | Operation not allow. | +| 7400201 | Camera service fatal error. | **示例:** @@ -862,7 +980,7 @@ captureSession.commitConfig((err) => { ### commitConfig -commitConfig(): Promise +commitConfig(): Promise\ 提交配置信息,通过Promise获取结果。 @@ -872,7 +990,16 @@ commitConfig(): Promise | 类型 | 说明 | | -------------- | ------------------------ | -| Promise | 使用Promise的方式获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| Promise\ | 使用Promise的方式获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | + +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400102 | Operation not allow. | +| 7400201 | Camera service fatal error. | **示例:** @@ -905,6 +1032,15 @@ addInput(cameraInput: CameraInput): void | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | 接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | +| 7400102 | Operation not allow. | + **示例:** ```js @@ -936,6 +1072,15 @@ removeInput(cameraInput: CameraInput): void | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | 接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | +| 7400102 | Operation not allow. | + **示例:** ```js @@ -949,7 +1094,7 @@ try { ### addOutput -addOutput(previewOutput: CameraOutput): void +addOutput(cameraOutput: CameraOutput): void 把[CameraOutput](#cameraoutput)加入到会话。 @@ -959,7 +1104,7 @@ addOutput(previewOutput: CameraOutput): void | 参数名 | 类型 | 必填 | 说明 | | ------------- | ------------------------------- | ---- | ------------------------ | -| previewOutput | [PreviewOutput](#previewoutput) | 是 | 需要添加的previewoutput实例。 | +| cameraOutput | [CameraOutput](#cameraoutput) | 是 | 需要添加的CameraOutput实例。 | **返回值:** @@ -967,11 +1112,20 @@ addOutput(previewOutput: CameraOutput): void | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | 接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | +| 7400102 | Operation not allow. | + **示例:** ```js try { - captureSession.addOutput(previewOutput); + captureSession.addOutput(cameraOutput); } catch (error) { // 失败返回错误码error.code并处理 console.log(error.code); @@ -980,7 +1134,7 @@ try { ### removeOutput -removeOutput(previewOutput: CameraOutput): void +removeOutput(cameraOutput: CameraOutput): void 从会话中移除[CameraOutput](#cameraoutput)。 @@ -990,7 +1144,7 @@ removeOutput(previewOutput: CameraOutput): void | 参数名 | 类型 | 必填 | 说明 | | ------------- | ------------------------------- | ---- | ------------------------ | -| previewOutput | [PreviewOutput](#previewoutput) | 是 | 需要移除的previewoutput实例。 | +| cameraOutput | [CameraOutput](#cameraoutput) | 是 | 需要移除的CameraOutput实例。 | **返回值:** @@ -998,6 +1152,15 @@ removeOutput(previewOutput: CameraOutput): void | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | 接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | +| 7400102 | Operation not allow. | + **示例:** ```js @@ -1011,7 +1174,7 @@ try { ### start -start\(callback: AsyncCallback\): void +start\(callback: AsyncCallback\\): void 开始会话工作,通过注册回调函数获取结果。 @@ -1021,7 +1184,16 @@ start\(callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------- | ---- | -------------------- | -| callback | AsyncCallback | 是 | 回调函数,用于获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| callback | AsyncCallback\ | 是 | 回调函数,用于获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | + +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | +| 7400201 | Camera service fatal error. | **示例:** @@ -1037,7 +1209,7 @@ captureSession.start((err) => { ### start -start\(\): Promise +start\(\): Promise\ 开始会话工作,通过Promise获取结果。 @@ -1047,7 +1219,16 @@ start\(\): Promise | 类型 | 说明 | | -------------- | ------------------------ | -| Promise | 使用Promise的方式获取结果。 | +| Promise\ | 使用Promise的方式获取结果。 | + +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | +| 7400201 | Camera service fatal error. | **示例:** @@ -1061,7 +1242,7 @@ captureSession.start().then(() => { ### stop -stop\(callback: AsyncCallback\): void +stop\(callback: AsyncCallback\\): void 停止会话工作,通过注册回调函数获取结果。 @@ -1071,7 +1252,15 @@ stop\(callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------- | ---- | ------------------- | -| callback | AsyncCallback | 是 | 回调函数,用于获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| callback | AsyncCallback\ | 是 | 回调函数,用于获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | + +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | **示例:** @@ -1087,7 +1276,7 @@ captureSession.stop((err) => { ### stop -stop(): Promise +stop(): Promise\ 停止会话工作,通过Promise获取结果。 @@ -1097,7 +1286,15 @@ stop(): Promise | 类型 | 说明 | | -------------- | ----------------------- | -| Promise | 使用Promise的方式获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| Promise\ | 使用Promise的方式获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | + +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | **示例:** @@ -1111,7 +1308,7 @@ captureSession.stop().then(() => { ### release -release\(callback: AsyncCallback\): void +release\(callback: AsyncCallback\\): void 释放会话资源,通过注册回调函数获取结果。 @@ -1121,7 +1318,15 @@ release\(callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------- | ---- | -------------------- | -| callback | AsyncCallback | 是 | 回调函数,用于获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| callback | AsyncCallback\ | 是 | 回调函数,用于获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | + +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | **示例:** @@ -1137,7 +1342,7 @@ captureSession.release((err) => { ### release -release(): Promise +release(): Promise\ 释放会话资源,通过Promise获取结果。 @@ -1147,7 +1352,15 @@ release(): Promise | 类型 | 说明 | | -------------- | ------------------------ | -| Promise | 使用Promise的方式获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| Promise\ | 使用Promise的方式获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | + +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | **示例:** @@ -1173,6 +1386,14 @@ hasFlash(): boolean | ---------- | ----------------------------- | | boolean | 返回true表示设备支持闪光灯。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | + **示例:** ```js @@ -1204,6 +1425,14 @@ isFlashModeSupported(flashMode: FlashMode): boolean | ---------- | ----------------------------- | | boolean | 返回true表示支持该闪光灯模式。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | + **示例:** ```js @@ -1240,6 +1469,14 @@ setFlashMode(flashMode: FlashMode): void | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | 接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | + **示例:** ```js @@ -1265,6 +1502,14 @@ getFlashMode(): FlashMode | ---------- | ----------------------------- | | [FlashMode](#flashmode) | 获取当前设备的闪光灯模式。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | + **示例:** ```js @@ -1296,6 +1541,14 @@ isExposureModeSupported(aeMode: ExposureMode): boolean; | ---------- | ----------------------------- | | boolean | 获取是否支持曝光模式。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | + **示例:** ```js @@ -1321,6 +1574,14 @@ getExposureMode(): ExposureMode | ---------- | ----------------------------- | | [ExposureMode](#exposuremode) | 获取当前曝光模式。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | + **示例:** ```js @@ -1352,6 +1613,14 @@ setExposureMode(aeMode: ExposureMode): void | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | 接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | + **示例:** ```js @@ -1377,6 +1646,14 @@ getMeteringPoint(): Point | ---------- | ----------------------------- | | [Point](#point) | 获取当前曝光点。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | + **示例:** ```js @@ -1411,6 +1688,14 @@ setMeteringPoint(point: Point): void | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | 接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | + **示例:** ```js @@ -1425,7 +1710,7 @@ try { ### getExposureBiasRange -getExposureBiasRange(): Array +getExposureBiasRange(): Array\ 查询曝光补偿范围。 @@ -1435,7 +1720,15 @@ getExposureBiasRange(): Array | 类型 | 说明 | | ---------- | ----------------------------- | -| Array | 获取补偿范围的数组。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| Array\ | 获取补偿范围的数组。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | + +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | **示例:** @@ -1464,6 +1757,14 @@ setExposureBias(exposureBias: number): void | -------- | -------------------------------| ---- | ------------------- | | exposureBias | number | 是 | 曝光补偿,getExposureBiasRange查询支持的范围,接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | + **示例:** ```js @@ -1490,6 +1791,14 @@ getExposureValue(): number | ---------- | ----------------------------- | | number | 获取曝光值。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | + **示例:** ```js @@ -1521,6 +1830,14 @@ isFocusModeSupported(afMode: FocusMode): boolean | ---------- | ----------------------------- | | boolean | 返回true表示支持该焦距模式。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | + **示例:** ```js @@ -1554,6 +1871,14 @@ setFocusMode(afMode: FocusMode): void | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | 接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | + **示例:** ```js @@ -1579,6 +1904,14 @@ getFocusMode(): FocusMode | ---------- | ----------------------------- | | [FocusMode](#focusmode) | 获取当前设备的焦距模式。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | + **示例:** ```js @@ -1613,6 +1946,14 @@ setFocusPoint(point: Point): void | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | 接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | + **示例:** ```js @@ -1639,6 +1980,14 @@ getFocusPoint(): Point | ---------- | ----------------------------- | | [Point](#point) | 用于获取当前焦点。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | + **示例:** ```js @@ -1664,6 +2013,14 @@ getFocalLength(): number | ---------- | ----------------------------- | | number | 用于获取当前焦距。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | + **示例:** ```js @@ -1677,7 +2034,7 @@ try { ### getZoomRatioRange -getZoomRatioRange(): Array +getZoomRatioRange(): Array\ 获取支持的变焦范围。 @@ -1687,7 +2044,15 @@ getZoomRatioRange(): Array | 类型 | 说明 | | ---------- | ----------------------------- | -| Array | 用于获取可变焦距比范围,返回的数组包括其最小值和最大值。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| Array\ | 用于获取可变焦距比范围,返回的数组包括其最小值和最大值。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | + +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | **示例:** @@ -1720,6 +2085,14 @@ setZoomRatio(zoomRatio: number): void | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | 接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | + **示例:** ```js @@ -1746,6 +2119,14 @@ getZoomRatio(): number | ---------- | ----------------------------- | | number | 获取当前的变焦比结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | + **示例:** ```js @@ -1777,6 +2158,14 @@ isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): boolean | ---------- | ----------------------------- | | boolean | 返回视频防抖模式是否支持。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | + **示例:** ```js @@ -1802,6 +2191,14 @@ getActiveVideoStabilizationMode(): VideoStabilizationMode | ---------- | ----------------------------- | | VideoStabilizationMode | 视频防抖是否正在使用。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | + **示例:** ```js @@ -1833,6 +2230,14 @@ setVideoStabilizationMode(mode: VideoStabilizationMode): void | ---------- | ----------------------------- | | [CameraErrorCode](#cameraerrorcode) | 接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | + **示例:** ```js @@ -1846,7 +2251,7 @@ try { ### on('focusStateChange') -on(type: 'focusStateChange', callback: AsyncCallback): void +on(type: 'focusStateChange', callback: AsyncCallback\): void 监听相机聚焦的状态变化,通过注册回调函数获取结果。 @@ -1857,7 +2262,7 @@ on(type: 'focusStateChange', callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------------------- | ---- | ------------------------ | | type | string | 是 | 监听事件,固定为'focusStateChange',session 创建成功可监听。仅当自动对焦模式时,且相机对焦状态发生改变时可触发该事件 | -| callback | AsyncCallback<[FocusState](#focusstate)\> | 是 | 回调函数,用于获取当前对焦状态。 | +| callback | AsyncCallback\<[FocusState](#focusstate)\> | 是 | 回调函数,用于获取当前对焦状态。 | **示例:** @@ -1869,7 +2274,7 @@ captureSession.on('focusStateChange', (focusState) => { ### on('error') -on(type: 'error', callback: ErrorCallback): void +on(type: 'error', callback: ErrorCallback\): void 监听拍照会话的错误事件,通过注册回调函数获取结果。 @@ -1880,7 +2285,7 @@ on(type: 'error', callback: ErrorCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------------------------------------- | ---- | ------------------------------ | | type | string | 是 | 监听事件,固定为'error',session创建成功之后可监听该接口。session调用相关接口出现错误时会触发该事件,比如调用(beginConfig(),commitConfig(),addInput)等接口发生错误时返回错误信息。 | -| callback | ErrorCallback | 是 | 回调函数,用于获取错误信息。返回错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| callback | ErrorCallback\ | 是 | 回调函数,用于获取错误信息。返回错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | **示例:** @@ -1900,7 +2305,7 @@ captureSession.on('error', (error) => { ### start -start(callback: AsyncCallback): void +start(callback: AsyncCallback\): void 开始输出预览流,通过注册回调函数获取结果。 @@ -1910,7 +2315,15 @@ start(callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------- | ---- | -------------------- | -| callback | AsyncCallback | 是 | 回调函数,用于获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| callback | AsyncCallback\ | 是 | 回调函数,用于获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | + +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | **示例:** @@ -1926,7 +2339,7 @@ previewOutput.start((err) => { ### start -start(): Promise +start(): Promise\ 开始输出预览流,通过Promise获取结果。 @@ -1936,7 +2349,15 @@ start(): Promise | 类型 | 说明 | | -------------- | ----------------------- | -| Promise | 使用Promise的方式获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode)| +| Promise\ | 使用Promise的方式获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode)| + +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | **示例:** @@ -1950,7 +2371,7 @@ previewOutput.start().then(() => { ### stop -stop(callback: AsyncCallback): void +stop(callback: AsyncCallback\): void 停止输出预览流,通过注册回调函数获取结果。 @@ -1960,7 +2381,7 @@ stop(callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------- | ---- | -------------------- | -| callback | AsyncCallback | 是 | 回调函数,用于获取结果。 | +| callback | AsyncCallback\ | 是 | 回调函数,用于获取结果。 | **示例:** @@ -1976,7 +2397,7 @@ previewOutput.stop((err) => { ### stop -stop(): Promise +stop(): Promise\ 停止输出预览流,通过Promise获取结果。 @@ -1986,7 +2407,7 @@ stop(): Promise | 类型 | 说明 | | -------------- | ------------------------ | -| Promise | 使用Promise的方式获取结果。 | +| Promise\ | 使用Promise的方式获取结果。 | **示例:** @@ -2000,7 +2421,7 @@ previewOutput.stop().then(() => { ### release -release(callback: AsyncCallback): void +release(callback: AsyncCallback\): void 释放输出资源,通过注册回调函数获取结果。 @@ -2010,7 +2431,15 @@ release(callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------- | ---- | ------------------- | -| callback | AsyncCallback | 是 | 回调函数,用于获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| callback | AsyncCallback\ | 是 | 回调函数,用于获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | + +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | **示例:** @@ -2026,7 +2455,7 @@ previewOutput.release((err) => { ### release -release(): Promise +release(): Promise\ 释放输出资源,通过Promise获取结果。 @@ -2036,7 +2465,15 @@ release(): Promise | 类型 | 说明 | | -------------- | ----------------------- | -| Promise | 使用Promise的方式获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| Promise\ | 使用Promise的方式获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | + +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | **示例:** @@ -2050,7 +2487,7 @@ previewOutput.release().then(() => { ### on('frameStart') -on(type: 'frameStart', callback: AsyncCallback): void +on(type: 'frameStart', callback: AsyncCallback\): void 监听预览帧启动,通过注册回调函数获取结果。 @@ -2061,7 +2498,7 @@ on(type: 'frameStart', callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------- | ---- | --------------------------------------- | | type | string | 是 | 监听事件,固定为'frameStart',previewOutput创建成功可监听。底层第一次开始曝光时触发该事件并返回 | -| callback | AsyncCallback | 是 | 回调函数,用于获取结果。只要有该事件返回就证明预览开始 | +| callback | AsyncCallback\ | 是 | 回调函数,用于获取结果。只要有该事件返回就证明预览开始 | **示例:** @@ -2073,7 +2510,7 @@ previewOutput.on('frameStart', () => { ### on('frameEnd') -on(type: 'frameEnd', callback: AsyncCallback): void +on(type: 'frameEnd', callback: AsyncCallback\): void 监听预览帧结束,通过注册回调函数获取结果。 @@ -2084,7 +2521,7 @@ on(type: 'frameEnd', callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------- | ---- | ------------------------------------- | | type | string | 是 | 监听事件,固定为'frameEnd',previewOutput创建成功可监听。预览完全结束最后一帧时触发该事件并返回, | -| callback | AsyncCallback | 是 | 回调函数,用于获取结果。只要有该事件返回就证明预览结束 | +| callback | AsyncCallback\ | 是 | 回调函数,用于获取结果。只要有该事件返回就证明预览结束 | **示例:** @@ -2096,7 +2533,7 @@ previewOutput.on('frameEnd', () => { ### on('error') -on(type: 'error', callback: ErrorCallback): void +on(type: 'error', callback: ErrorCallback\): void 监听预览输出的错误事件,通过注册回调函数获取结果。 @@ -2107,7 +2544,7 @@ on(type: 'error', callback: ErrorCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------| ---- | ------------------------ | | type | string | 是 | 监听事件,固定为'error',previewOutput创建成功可监听。预览接口使用错误时触发该事件,比如调用(start(),release())等接口发生错误时返回对应错误信息。| -| callback | ErrorCallback | 是 | 回调函数,用于获取错误信息。返回错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| callback | ErrorCallback\ | 是 | 回调函数,用于获取错误信息。返回错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | **示例:** @@ -2174,7 +2611,7 @@ previewOutput.on('error', (previewOutputError) => { ### capture -capture(callback: AsyncCallback): void +capture(callback: AsyncCallback\): void 以默认设置触发一次拍照,通过注册回调函数获取结果。 @@ -2184,7 +2621,16 @@ capture(callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------- | ---- | ------------------- | -| callback | AsyncCallback | 是 | 回调函数,用于获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| callback | AsyncCallback\ | 是 | 回调函数,用于获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | + +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400104 | Session not running. | +| 7400201 | Camera service fatal error. | **示例:** @@ -2200,7 +2646,7 @@ photoOutput.capture((err) => { ### capture -capture(): Promise +capture(): Promise\ 以默认设置触发一次拍照,通过Promise获取结果。 @@ -2210,7 +2656,16 @@ capture(): Promise | 类型 | 说明 | | -------------- | ------------------------ | -| Promise | 使用Promise的方式获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| Promise\ | 使用Promise的方式获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | + +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400104 | Session not running. | +| 7400201 | Camera service fatal error. | **示例:** @@ -2224,7 +2679,7 @@ photoOutput.capture().then(() => { ### capture -capture(setting: PhotoCaptureSetting, callback: AsyncCallback): void +capture(setting: PhotoCaptureSetting, callback: AsyncCallback\): void 以指定参数触发一次拍照,通过注册回调函数获取结果。 @@ -2235,7 +2690,17 @@ capture(setting: PhotoCaptureSetting, callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------- | ---- | -------------------- | | setting | [PhotoCaptureSetting](#photocapturesetting) | 是 | 拍照设置。 | -| callback | AsyncCallback | 是 | 回调函数,用于获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| callback | AsyncCallback\ | 是 | 回调函数,用于获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | + +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | +| 7400104 | Session not running. | +| 7400201 | Camera service fatal error. | **示例:** @@ -2262,7 +2727,7 @@ photoOutput.capture(settings, (err) => { ### capture -capture(setting?: PhotoCaptureSetting): Promise +capture(setting?: PhotoCaptureSetting): Promise\ 以指定参数触发一次拍照,通过Promise获取结果。 @@ -2278,8 +2743,17 @@ capture(setting?: PhotoCaptureSetting): Promise | 类型 | 说明 | | -------------- | ------------------------ | -| Promise | 使用Promise的方式获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| Promise\ | 使用Promise的方式获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400101 | Parameter missing or parameter type incorrect | +| 7400104 | Session not running. | +| 7400201 | Camera service fatal error. | **示例:** @@ -2313,7 +2787,7 @@ let isSupported = photoOutput.isMirrorSupported(); ### release -release(callback: AsyncCallback): void +release(callback: AsyncCallback\): void 释放输出资源,通过注册回调函数获取结果。 @@ -2323,7 +2797,15 @@ release(callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------- | ---- | ------------------- | -| callback | AsyncCallback | 是 | 回调函数,用于获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| callback | AsyncCallback\ | 是 | 回调函数,用于获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | + +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | **示例:** @@ -2339,7 +2821,7 @@ photoOutput.release((err) => { ### release -release(): Promise +release(): Promise\ 释放输出资源,通过Promise获取结果。 @@ -2349,7 +2831,15 @@ release(): Promise | 类型 | 说明 | | -------------- | ----------------------- | -| Promise | 使用Promise的方式获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| Promise\ | 使用Promise的方式获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | + +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | **示例:** @@ -2363,7 +2853,7 @@ photoOutput.release().then(() => { ### on('captureStart') -on(type: 'captureStart', callback: AsyncCallback): void +on(type: 'captureStart', callback: AsyncCallback\): void 监听拍照开始,通过注册回调函数获取Capture ID。 @@ -2374,7 +2864,7 @@ on(type: 'captureStart', callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------- | ---- | ------------------------------------------ | | type | string | 是 | 监听事件,固定为'captureStart',photoOutput创建成功后可监听。每次拍照,底层开始曝光时触发该事件并返回。 | -| callback | AsyncCallback | 是 | 使用callback的方式获取Capture ID。 | +| callback | AsyncCallback\ | 是 | 使用callback的方式获取Capture ID。 | **示例:** @@ -2386,7 +2876,7 @@ photoOutput.on('captureStart', (captureId) => { ### on('frameShutter') -on(type: 'frameShutter', callback: AsyncCallback): void +on(type: 'frameShutter', callback: AsyncCallback\): void 监听拍照帧输出捕获,通过注册回调函数获取结果。 @@ -2397,7 +2887,7 @@ on(type: 'frameShutter', callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------- | --- | ------------------------------------ | | type | string | 是 | 监听事件,固定为'frameShutter',photoOutput创建成功后可监听。 | -| callback | AsyncCallback<[FrameShutterInfo](#frameshutterinfo)\> | 是 | 回调函数,用于获取相关信息。该回调返回意味着可以再次下发拍照请求。 | +| callback | AsyncCallback\<[FrameShutterInfo](#frameshutterinfo)\> | 是 | 回调函数,用于获取相关信息。该回调返回意味着可以再次下发拍照请求。 | **示例:** @@ -2410,7 +2900,7 @@ photoOutput.on('frameShutter', (frameShutterInfo) => { ### on('captureEnd') -on(type: 'captureEnd', callback: AsyncCallback): void +on(type: 'captureEnd', callback: AsyncCallback\): void 监听拍照结束,通过注册回调函数获取结果。 @@ -2421,7 +2911,7 @@ on(type: 'captureEnd', callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------- | ---- | ---------------------------------------- | | type | string | 是 | 监听事件,固定为'captureEnd',photoOutput创建成功后可监听。拍照完全结束可触发该事件发生并返回相应信息。 | -| callback | AsyncCallback<[CaptureEndInfo](#captureendinfo)\> | 是 | 回调函数,用于获取相关信息。 | +| callback | AsyncCallback\<[CaptureEndInfo](#captureendinfo)\> | 是 | 回调函数,用于获取相关信息。 | **示例:** @@ -2434,7 +2924,7 @@ photoOutput.on('captureEnd', (captureEndInfo) => { ### on('error') -on(type: 'error', callback: ErrorCallback): void +on(type: 'error', callback: ErrorCallback\): void 监听拍照输出发生错误,通过注册回调函数获取结果。 @@ -2445,7 +2935,7 @@ on(type: 'error', callback: ErrorCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------- | ---- | ----------------------------------- | | type | string | 是 | 监听事件,固定为'error',photoOutput创建成功后可监听。拍照接口调用时出现错误触发该事件并返回错误信息。 | -| callback | ErrorCallback | 是 | 回调函数,用于获取错误信息。返回错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| callback | ErrorCallback\ | 是 | 回调函数,用于获取错误信息。返回错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | **示例:** @@ -2483,7 +2973,7 @@ photoOutput.on('error', (error) => { ### start -start(callback: AsyncCallback): void +start(callback: AsyncCallback\): void 启动录制,通过注册回调函数获取结果。 @@ -2493,7 +2983,16 @@ start(callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------- | ---- | -------------------- | -| callback | AsyncCallback | 是 | 回调函数,用于获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| callback | AsyncCallback\ | 是 | 回调函数,用于获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | + +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | +| 7400201 | Camera service fatal error. | **示例:** @@ -2509,7 +3008,7 @@ videoOutput.start((err) => { ### start -start(): Promise +start(): Promise\ 启动录制,通过Promise获取结果。 @@ -2519,8 +3018,16 @@ start(): Promise | 类型 | 说明 | | -------------- | ----------------------- | -| Promise | 使用Promise的方式获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| Promise\ | 使用Promise的方式获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | + +**错误码:** +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | +| 7400201 | Camera service fatal error. | **示例:** @@ -2534,7 +3041,7 @@ videoOutput.start().then(() => { ### stop -stop(callback: AsyncCallback): void +stop(callback: AsyncCallback\): void 结束录制,通过注册回调函数获取结果。 @@ -2544,7 +3051,7 @@ stop(callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------- | ---- | ------------------------ | -| callback | AsyncCallback | 是 | 回调函数,用于获取结果。 | +| callback | AsyncCallback\ | 是 | 回调函数,用于获取结果。 | **示例:** @@ -2560,7 +3067,7 @@ videoOutput.stop((err) => { ### stop -stop(): Promise +stop(): Promise\ 结束录制,通过Promise获取结果。 @@ -2570,7 +3077,7 @@ stop(): Promise | 类型 | 说明 | | -------------- | ----------------------- | -| Promise | 使用Promise的方式获取结果。 | +| Promise\ | 使用Promise的方式获取结果。 | **示例:** @@ -2584,7 +3091,7 @@ videoOutput.stop().then(() => { ### release -release(callback: AsyncCallback): void +release(callback: AsyncCallback\): void 释放输出资源,通过注册回调函数获取结果。 @@ -2594,7 +3101,15 @@ release(callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------- | ---- | ------------------- | -| callback | AsyncCallback | 是 | 回调函数,用于获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| callback | AsyncCallback\ | 是 | 回调函数,用于获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | + +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | **示例:** @@ -2610,7 +3125,7 @@ videoOutput.release((err) => { ### release -release(): Promise +release(): Promise\ 释放输出资源,通过Promise获取结果。 @@ -2620,7 +3135,15 @@ release(): Promise | 类型 | 说明 | | -------------- | ----------------------- | -| Promise | 使用Promise的方式获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| Promise\ | 使用Promise的方式获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | + +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400201 | Camera service fatal error. | **示例:** @@ -2634,7 +3157,7 @@ videoOutput.release().then(() => { ### on('frameStart') -on(type: 'frameStart', callback: AsyncCallback): void +on(type: 'frameStart', callback: AsyncCallback\): void 监听录像开始,通过注册回调函数获取结果。 @@ -2645,7 +3168,7 @@ on(type: 'frameStart', callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------- | ---- | ----------------------------------------- | | type | string | 是 | 监听事件,固定为'frameStart',videoOutput创建成功后可监听。底层第一次曝光时触发该事件并返回。 | -| callback | AsyncCallback | 是 | 回调函数,用于获取结果。 只要有该事件返回就证明录像开始 | +| callback | AsyncCallback\ | 是 | 回调函数,用于获取结果。 只要有该事件返回就证明录像开始 | **示例:** @@ -2657,7 +3180,7 @@ videoOutput.on('frameStart', () => { ### on('frameEnd') -on(type: 'frameEnd', callback: AsyncCallback): void +on(type: 'frameEnd', callback: AsyncCallback\): void 监听录像结束,通过注册回调函数获取结果。 @@ -2668,7 +3191,7 @@ on(type: 'frameEnd', callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------- | ---- | ------------------------------------------ | | type | string | 是 | 监听事件,固定为'frameEnd',videoOutput创建成功后可监听。录像完全结束最后一帧时触发该事件并返回 。 | -| callback | AsyncCallback | 是 | 回调函数,用于获取结果。 只要有该事件返回就证明录像结束 | +| callback | AsyncCallback\ | 是 | 回调函数,用于获取结果。 只要有该事件返回就证明录像结束 | **示例:** @@ -2680,7 +3203,7 @@ videoOutput.on('frameEnd', () => { ### on('error') -on(type: 'error', callback: ErrorCallback): void +on(type: 'error', callback: ErrorCallback\): void 监听录像输出发生错误,通过注册回调函数获取结果。 @@ -2691,7 +3214,7 @@ on(type: 'error', callback: ErrorCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------- | ---- | -------------------------------------- | | type | string | 是 | 监听事件,固定为'error',videoOutput创建成功后可监听。录像接口调用出现错误时触发该事件并返回对应错误码,比如调用(start(),release())接口时出现错误返回对应错误信息。 | -| callback | Callback | 是 | 回调函数,用于获取错误信息。返回错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| callback | Callback\ | 是 | 回调函数,用于获取错误信息。返回错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | **示例:** @@ -2707,7 +3230,7 @@ metadata流。继承[CameraOutput](#cameraoutput) ### start -start(callback: AsyncCallback): void +start(callback: AsyncCallback\): void 开始输出metadata,通过注册回调函数获取结果。 @@ -2717,7 +3240,16 @@ start(callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------------- | ---- | ------------------- | -| callback | AsyncCallback | 是 | 回调函数,用于获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| callback | AsyncCallback\ | 是 | 回调函数,用于获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | + +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | +| 7400201 | Camera service fatal error. | **示例:** @@ -2733,7 +3265,7 @@ metadataOutput.start((err) => { ### start -start(): Promise +start(): Promise\ 开始输出metadata,通过Promise获取结果。 @@ -2743,7 +3275,16 @@ start(): Promise | 类型 | 说明 | | ---------------------- | ------------------------ | -| Promise | 使用Promise的方式获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| Promise\ | 使用Promise的方式获取结果。接口调用失败会返回相应错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | + +**错误码:** + +以下错误码的详细介绍请参见相机错误码 + +| 错误码ID | 错误信息 | +| --------------- | --------------- | +| 7400103 | Session not config. | +| 7400201 | Camera service fatal error. | **示例:** @@ -2757,7 +3298,7 @@ metadataOutput.start().then(() => { ### stop -stop(callback: AsyncCallback): void +stop(callback: AsyncCallback\): void 停止输出metadata,通过注册回调函数获取结果。 @@ -2767,7 +3308,7 @@ stop(callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------------- | ---- | ------------------- | -| callback | AsyncCallback | 是 | 回调函数,用于获取结果。 | +| callback | AsyncCallback\ | 是 | 回调函数,用于获取结果。 | **示例:** @@ -2783,7 +3324,7 @@ metadataOutput.stop((err) => { ### stop -stop(): Promise +stop(): Promise\ 停止输出metadata,通过Promise获取结果。 @@ -2793,7 +3334,7 @@ stop(): Promise | 类型 | 说明 | | ---------------------- | --------------------------- | -| Promise | 使用Promise的方式获取结果。 | +| Promise\ | 使用Promise的方式获取结果。 | **示例:** @@ -2807,7 +3348,7 @@ metadataOutput.stop().then(() => { ### on('metadataObjectsAvailable') -on(type: 'metadataObjectsAvailable', callback: AsyncCallback\>): void +on(type: 'metadataObjectsAvailable', callback: AsyncCallback\\>): void 监听检测到的metadata对象,通过注册回调函数获取结果。 @@ -2818,7 +3359,7 @@ on(type: 'metadataObjectsAvailable', callback: AsyncCallback\> | 是 | 回调函数,用于获取metadata数据。 | +| callback | Callback\\> | 是 | 回调函数,用于获取metadata数据。 | **示例:** @@ -2830,7 +3371,7 @@ metadataOutput.on('metadataObjectsAvailable', (metadataObjectArr) => { ### on('error') -on(type: 'error', callback: ErrorCallback): void +on(type: 'error', callback: ErrorCallback\): void 监听metadata流的错误,通过注册回调函数获取结果。 @@ -2841,7 +3382,7 @@ on(type: 'error', callback: ErrorCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------- | ---- | --------------------------------------- | | type | string | 是 | 监听事件,固定为'error',metadataOutput创建成功后可监听。metadata接口使用错误时触发该事件并返回对应错误码,比如调用(start(),release())接口时发生错误返回对应错误信息。 | -| callback | Callback | 是 | 回调函数,用于获取错误信息。返回错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | +| callback | Callback\ | 是 | 回调函数,用于获取错误信息。返回错误码,错误码类型[CameraErrorCode](#cameraerrorcode) | **示例:** @@ -2878,6 +3419,8 @@ metadataOutput.on('error', (metadataOutputError) => { 相机元能力信息,[CameraInput](#camerainput)相机信息中的数据来源,通过metadataOutput.on('metadataObjectsAvailable')接口获取 +**系统能力:** SystemCapability.Multimedia.Camera.Core + | 名称 | 类型 | 必填 | 说明 | | -------- | ------------------------------- | ---- | -----------------| | type | [MetadataObjectType](#metadataobjecttype) | 否 | metadata 类型,目前只有人脸识别。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-cert.md b/zh-cn/application-dev/reference/apis/js-apis-cert.md index 8ee8bd2309e88546bc98bdb344d8e2757f86bfac..c3451703a6d58475333c37600fa88556b627bedb 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-cert.md +++ b/zh-cn/application-dev/reference/apis/js-apis-cert.md @@ -104,6 +104,11 @@ createX509Cert(inStream : EncodingBlob, callback : AsyncCallback\) : v | inStream | [EncodingBlob](#encodingblob) | 是 | X509证书序列化数据 | | callback | AsyncCallback\ | 是 | 回调函数。表示X509证书对象 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------- | +| 19020001 | memory error. | **示例:** @@ -146,6 +151,12 @@ createX509Cert(inStream : EncodingBlob) : Promise\ | ------- | ---------------- | | Promise\ | 表示X509证书对象 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------- | +| 19020001 | memory error. | + **示例:** ```js @@ -184,6 +195,11 @@ verify(key : cryptoFramework.PubKey, callback : AsyncCallback\) : void | key | cryptoFramework.PubKey | 是 | 用于验签的公钥对象 | | callback | AsyncCallback\ | 是 | 回调函数。使用AsyncCallback的第一个error参数判断是否验签成功,error为null表示成功,不为null表示失败 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------ | +| 19030001 | crypto operation error. | **示例:** @@ -235,6 +251,12 @@ verify(key : cryptoFramework.PubKey) : Promise\ | -------------- | ----------- | | Promise\ | Promise对象 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------ | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -275,6 +297,13 @@ getEncoded(callback : AsyncCallback\) : void | -------- | --------------------------------------------- | ---- | -------------------------------- | | callback | AsyncCallback\<[EncodingBlob](#encodingblob)> | 是 | 回调函数。表示X509证书序列化数据 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error.| **示例:** @@ -318,6 +347,14 @@ getEncoded() : Promise\ | --------------------------------------- | ---------------------- | | Promise\<[EncodingBlob](#encodingblob)> | 表示X509证书序列化数据 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error.| + **示例:** ```js @@ -356,6 +393,13 @@ getPublicKey() : cryptoFramework.PubKey | ------ | ---------------- | | cryptoFramework.PubKey | X509证书公钥对象:仅用于X509Cert的verify接口 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19030001 | crypto operation error.| + **示例:** ```js @@ -398,6 +442,15 @@ checkValidityWithDate(date: string) : void | -------- | -------------- | ---- | ---------- | | date | string | 是 | 日期(格式:YYMMDDHHMMSSZ 或 YYYYMMDDHHMMSSZ,时间必须以Z结尾:表示标准时间) | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19030001 | crypto operation error.| +| 19030003 | the certificate has not taken effect. | +| 19030004 | the certificate has expired.| + **示例:** ```js @@ -513,6 +566,14 @@ getIssuerName() : DataBlob | --------------------- | ---------------------- | | [DataBlob](#datablob) | 表示X509证书颁发者名称 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error.| + **示例:** ```js @@ -549,6 +610,14 @@ getSubjectName() : DataBlob | --------------------- | -------------------- | | [DataBlob](#datablob) | 表示X509证书主体名称 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error.| + **示例:** ```js @@ -585,6 +654,14 @@ getNotBeforeTime() : string | ------ | ------------------------------------------------------------ | | string | 表示X509证书有效期起始时间(格式:YYMMDDHHMMSSZ 或 YYYYMMDDHHMMSSZ,时间以Z结尾:表示标准时间) | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error.| + **示例:** ```js @@ -621,6 +698,14 @@ getNotAfterTime() : string | ------ | ------------------------------------------------------------ | | string | 表示X509证书有效期截止时间(格式:YYMMDDHHMMSSZ 或 YYYYMMDDHHMMSSZ,时间以Z结尾:表示标准时间) | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error.| + **示例:** ```js @@ -657,6 +742,14 @@ getSignature() : DataBlob | --------------------- | -------------------- | | [DataBlob](#datablob) | 表示X509证书签名数据 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error.| + **示例:** ```js @@ -693,6 +786,14 @@ getSignatureAlgName() : string | ------ | ------------------------ | | string | 表示X509证书签名算法名称 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error.| + **示例:** ```js @@ -729,6 +830,14 @@ getSignatureAlgOid() : string | ------ | --------------------------------- | | string | 表示X509证书签名算法对象标志符OID | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error.| + **示例:** ```js @@ -765,6 +874,14 @@ getSignatureAlgParams() : DataBlob | --------------------- | ------------------------ | | [DataBlob](#datablob) | 表示X509证书签名算法参数 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error.| + **示例:** ```js @@ -801,6 +918,13 @@ getKeyUsage() : DataBlob | --------------------- | -------------------- | | [DataBlob](#datablob) | 表示X509证书秘钥用途 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19030001 | crypto operation error.| + **示例:** ```js @@ -837,6 +961,14 @@ getExtKeyUsage() : DataArray | ----------------------- | ------------------------ | | [DataArray](#dataarray) | 表示X509证书扩展秘钥用途 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error.| + **示例:** ```js @@ -909,6 +1041,14 @@ getSubjectAltNames() : DataArray | ----------------------- | ------------------------ | | [DataArray](#dataarray) | 表示X509证书主体可选名称 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error.| + **示例:** ```js @@ -945,6 +1085,14 @@ getIssuerAltNames() : DataArray | ----------------------- | -------------------------- | | [DataArray](#dataarray) | 表示X509证书颁发者可选名称 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error.| + **示例:** ```js @@ -982,6 +1130,11 @@ createX509Crl(inStream : EncodingBlob, callback : AsyncCallback\) : voi | inStream | [EncodingBlob](#encodingblob) | 是 | 表示证书吊销列表序列化数据 | | callback | AsyncCallback\ | 是 | 回调函数。表示证书吊销列表对象 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------- | +| 19020001 | memory error. | **示例:** @@ -1024,6 +1177,12 @@ createX509Crl(inStream : EncodingBlob) : Promise\ | ----------------- | -------------------- | | Promise\ | 表示证书吊销列表对象 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------- | +| 19020001 | memory error. | + **示例:** ```js @@ -1145,6 +1304,13 @@ getEncoded(callback : AsyncCallback\) : void | -------- | ---------------------------- | ---- | ------------------------------------------ | | callback | AsyncCallback\ | 是 | 回调函数,表示X509证书吊销列表的序列化数据 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | **示例:** @@ -1188,6 +1354,14 @@ getEncoded() : Promise\ | ---------------------- | -------------------------------- | | Promise\ | 表示X509证书吊销列表的序列化数据 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -1227,6 +1401,11 @@ verify(key : cryptoFramework.PubKey, callback : AsyncCallback\) : void | key | cryptoFramework.PubKey | 是 | 表示用于验签的公钥对象 | | callback | AsyncCallback\ | 是 | 回调函数,使用AsyncCallback的第一个error参数判断是否验签成功,error为null表示成功,error不为null表示失败。 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19030001 | crypto operation error. | **示例:** @@ -1279,6 +1458,12 @@ verify(key : cryptoFramework.PubKey) : Promise\ | ---- | ------------------------------------------------------------ | | Promise\ | Promise对象 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -1356,6 +1541,14 @@ getIssuerName() : DataBlob | --------------------- | ------------------------------ | | [DataBlob](#datablob) | 表示X509证书吊销列表颁发者名称 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -1392,6 +1585,14 @@ getLastUpdate() : string | ------ | ------------------------------------ | | string | 表示X509证书吊销列表最后一次更新日期 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -1428,6 +1629,14 @@ getNextUpdate() : string | ------ | ------------------------------------ | | string | 表示X509证书吊销列表下一次更新的日期 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -1470,6 +1679,13 @@ getRevokedCert(serialNumber : number) : X509CrlEntry | ---------------------- | --------------------- | | X509CrlEntry | 表示被吊销X509证书对象 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -1518,6 +1734,13 @@ getRevokedCertWithCert(cert : X509Cert) : X509CrlEntry | ------------ | -------------------- | | X509CrlEntry | 表示被吊销X509证书对象 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -1560,6 +1783,12 @@ getRevokedCerts(callback : AsyncCallback>) : void | -------- | ----------------------------------- | ---- | -------------------------------- | | callback | AsyncCallback> | 是 | 回调函数。表示被吊销X509证书列表 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19030001 | crypto operation error. | **示例:** @@ -1603,6 +1832,13 @@ getRevokedCerts() : Promise> | ----------------------------- | ---------------------- | | Promise> | 表示被吊销X509证书列表 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -1641,6 +1877,14 @@ getTbsInfo() : DataBlob | --------------------- | ------------------------------- | | [DataBlob](#datablob) | 表示证书吊销列表的tbsCertList信息 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -1681,6 +1925,14 @@ getSignature() : DataBlob | --------------------- | ------------------------------ | | [DataBlob](#datablob) | 表示X509证书吊销列表的签名数据 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -1717,6 +1969,14 @@ getSignatureAlgName() : string | ------ | -------------------------------- | | string | 表示X509证书吊销列表签名的算法名 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -1753,6 +2013,14 @@ getSignatureAlgOid() : string | ------ | --------------------------------------------- | | string | 表示X509证书吊销列表签名算法的对象标志符OID。 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -1789,6 +2057,14 @@ getSignatureAlgParams() : DataBlob | --------------------- | ---------------------------------- | | [DataBlob](#datablob) | 表示X509证书吊销列表签名的算法参数 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -1831,6 +2107,14 @@ createCertChainValidator(algorithm :string) : CertChainValidator | ------------------ | -------------------- | | CertChainValidator | 表示证书链校验器对象 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -1846,7 +2130,7 @@ let validator = cryptoCert.createCertChainValidator("PKIX"); ### 属性 -**系统能力:** SystemCapability.Security.CryptoFramework +**系统能力:** SystemCapability.Security.Cert | 名称 | 类型 | 可读 | 可写 | 说明 | | ------- | ------ | ---- | ---- | -------------------------- | @@ -1869,6 +2153,19 @@ validate(certChain : CertChainData, callback : AsyncCallback\) : void | certChain | [CertChainData](#certchaindata) | 是 | 表示X509证书链序列化数据 | | callback | AsyncCallback\ | 是 | 回调函数。使用AsyncCallback的第一个error参数判断是否校验成功,error为null表示成功,error不为null表示失败 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | +| 19030002 | the certificate signature verification failed. | +| 19030003 | the certificate has not taken effect. | +| 19030004 | the certificate has expired. | +| 19030005 | failed to obtain the certificate issuer. | +| 19030006 | the key cannot be used for signing a certificate. | +| 19030007 | the key cannot be used for digital signature. | **示例:** @@ -1916,6 +2213,20 @@ validate(certChain : CertChainData) : Promise\ | -------------- | ----------- | | Promise\ | Promise对象 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | +| 19030002 | the certificate signature verification failed. | +| 19030003 | the certificate has not taken effect. | +| 19030004 | the certificate has expired. | +| 19030005 | failed to obtain the certificate issuer. | +| 19030006 | the key cannot be used for signing a certificate. | +| 19030007 | the key cannot be used for digital signature. | + **示例:** ```js @@ -1980,6 +2291,13 @@ getEncoded(callback : AsyncCallback\) : void | -------- | --------------------------------------------- | ---- | ------------------------------------ | | callback | AsyncCallback\<[EncodingBlob](#encodingblob)> | 是 | 回调函数。表示被吊销证书的序列化数据 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | **示例:** @@ -2011,6 +2329,14 @@ getEncoded() : Promise\ | --------------------------------------- | -------------------------- | | Promise\<[EncodingBlob](#encodingblob)> | 表示被吊销证书的序列化数据 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | + **示例:** ```js @@ -2063,6 +2389,13 @@ getCertIssuer() : DataBlob | --------------------- | ----------------------- | | [DataBlob](#datablob) | 表示被吊销证书的颁发者信息 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | -------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | + **示例:** ```js @@ -2091,6 +2424,14 @@ getRevocationDate() : string | ------ | ------------------ | | string | 表示证书被吊销的日期 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------- | +| 19020001 | memory error. | +| 19020002 | runtime error. | +| 19030001 | crypto operation error. | + **示例:** ```js 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 6bb571dc95c24ed6e728b5006cd4b3d33281e8a6..cac5176ad0112516fbcc559094b04bc629dacdef 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-commonEvent.md +++ b/zh-cn/application-dev/reference/apis/js-apis-commonEvent.md @@ -67,7 +67,7 @@ publish(event: string, options: CommonEventPublishData, callback: AsyncCallback< | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------- | ---- | ---------------------- | | event | string | 是 | 表示要发布的公共事件。 | -| options | [CommonEventPublishData](#commoneventpublishdata) | 是 | 表示发布公共事件的属性。 | +| options | [CommonEventPublishData](./js-apis-inner-commonEvent-commonEventPublishData.md) | 是 | 表示发布公共事件的属性。 | | callback | syncCallback\ | 是 | 表示被指定的回调方法。 | **示例:** @@ -151,7 +151,7 @@ publishAsUser(event: string, userId: number, options: CommonEventPublishData, ca | -------- | ---------------------- | ---- | ---------------------- | | event | string | 是 | 表示要发布的公共事件。 | | userId | number | 是 | 表示指定向该用户ID发送此公共事件。 | -| options | [CommonEventPublishData](#commoneventpublishdata) | 是 | 表示发布公共事件的属性。 | +| options | [CommonEventPublishData](./js-apis-inner-commonEvent-commonEventPublishData.md) | 是 | 表示发布公共事件的属性。 | | callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 | **示例:** @@ -194,8 +194,8 @@ createSubscriber(subscribeInfo: CommonEventSubscribeInfo, callback: AsyncCallbac | 参数名 | 类型 | 必填 | 说明 | | ------------- | ------------------------------------------------------------ | ---- | -------------------------- | -| subscribeInfo | [CommonEventSubscribeInfo](#commoneventsubscribeinfo) | 是 | 表示订阅信息。 | -| callback | AsyncCallback\<[CommonEventSubscriber](#commoneventsubscriber)> | 是 | 表示创建订阅者的回调方法。 | +| subscribeInfo | [CommonEventSubscribeInfo](./js-apis-inner-commonEvent-commonEventSubscribeInfo.md) | 是 | 表示订阅信息。 | +| callback | AsyncCallback\<[CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md)> | 是 | 表示创建订阅者的回调方法。 | **示例:** @@ -236,12 +236,12 @@ createSubscriber(subscribeInfo: CommonEventSubscribeInfo): Promise | 返回订阅者对象。 | +| Promise\<[CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md)> | 返回订阅者对象。 | **示例:** @@ -276,8 +276,8 @@ subscribe(subscriber: CommonEventSubscriber, callback: AsyncCallback | 是 | 表示接收公共事件数据的回调函数。 | +| subscriber | [CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md) | 是 | 表示订阅者对象。 | +| callback | AsyncCallback\<[CommonEventData](./js-apis-inner-commonEvent-commonEventData.md)> | 是 | 表示接收公共事件数据的回调函数。 | **示例:** @@ -299,11 +299,12 @@ function subscribeCB(err, data) { } // 创建订阅者回调 -function createCB(err, subscriber) { +function createCB(err, commonEventSubscriber) { if (err.code) { console.error(`createSubscriber failed, code is ${err.code}`); } else { console.info("createSubscriber"); + subscriber = commonEventSubscriber; // 订阅公共事件 CommonEvent.subscribe(subscriber, subscribeCB); } @@ -327,7 +328,7 @@ unsubscribe(subscriber: CommonEventSubscriber, callback?: AsyncCallback): | 参数名 | 类型 | 必填 | 说明 | | ---------- | ----------------------------------------------- | ---- | ------------------------ | -| subscriber | [CommonEventSubscriber](#commoneventsubscriber) | 是 | 表示订阅者对象。 | +| subscriber | [CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md) | 是 | 表示订阅者对象。 | | callback | AsyncCallback\ | 否 | 表示取消订阅的回调方法。 | **示例:** @@ -375,809 +376,4 @@ CommonEvent.createSubscriber(subscribeInfo, createCB); // 取消订阅公共事件 CommonEvent.unsubscribe(subscriber, unsubscribeCB); -``` - -## CommonEventSubscriber - -### getCode - -```ts -getCode(callback: AsyncCallback): void -``` - -以回调形式获取公共事件代码。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ---------------------- | ---- | ------------------ | -| callback | AsyncCallback\ | 是 | 公共事件代码。 | - -**示例:** - -```ts -let subscriber; // 创建成功的订阅者对象 - -// 获取有序公共事件的结果代码回调 -function getCodeCB(err, Code) { - if (err.code) { - console.error(`getCode failed, code is ${err.code}`); - } else { - console.info("getCode " + JSON.stringify(Code)); - } -} -subscriber.getCode(getCodeCB); -``` - -### getCode - -```ts -getCode(): Promise -``` - -以Promise形式获取公共事件代码。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**返回值:** - -| 类型 | 说明 | -| ---------------- | -------------------- | -| Promise\ | 公共事件代码。 | - -**示例:** - -```ts -let subscriber; // 创建成功的订阅者对象 - -subscriber.getCode().then((code) => { - console.info("getCode " + JSON.stringify(code)); -}).catch((err) => { - console.error(`getCode failed, code is ${err.code}`); -}); -``` - -### setCode - -```ts -setCode(code: number, callback: AsyncCallback): void -``` - -以回调形式设置公共事件的代码。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------------------- | ---- | ---------------------- | -| code | number | 是 | 公共事件的代码。 | -| callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 | - -**示例:** - -```ts -let subscriber; // 创建成功的订阅者对象 - -// 设置有序公共事件的结果代码回调 -function setCodeCB(err) { - if (err.code) { - console.error(`setCode failed, code is ${err.code}`); - } else { - console.info("setCode"); - } -} -subscriber.setCode(1, setCodeCB); -``` - -### setCode - -```ts -setCode(code: number): Promise -``` - -以Promise形式设置公共事件的代码。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | ------------------ | -| code | number | 是 | 公共事件的代码。 | - -**返回值:** - -| 类型 | 说明 | -| ---------------- | -------------------- | -| Promise\ | 返回一个Promise的结果。 | - -**示例:** - -```ts -let subscriber; // 创建成功的订阅者对象 - -subscriber.setCode(1).then(() => { - console.info("setCode"); -}).catch((err) => { - console.error(`setCode failed, code is ${err.code}`); -}); -``` - -### getData - -```ts -getData(callback: AsyncCallback): void -``` - -以回调形式获取公共事件的数据。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ---------------------- | ---- | -------------------- | -| callback | AsyncCallback\ | 是 | 公共事件的数据。 | - -**示例:** - -```ts -let subscriber; // 创建成功的订阅者对象 - -// 获取有序公共事件的结果数据回调 -function getDataCB(err, data) { - if (err.code) { - console.error(`getData failed, code is ${err.code}`); - } else { - console.info("getData " + JSON.stringify(data)); - } -} - -subscriber.getData(getDataCB); -``` - -### getData - -```ts -getData(): Promise -``` - -以Promise形式获取公共事件的数据。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**返回值:** - -| 类型 | 说明 | -| ---------------- | ------------------ | -| Promise\ | 公共事件的数据。 | - -**示例:** - -```ts -let subscriber; // 创建成功的订阅者对象 - -subscriber.getData().then((data) => { - console.info("getData " + JSON.stringify(data)); -}).catch((err) => { - console.error(`getData failed, code is ${err.code}`); -}); -``` - -### setData - -```ts -setData(data: string, callback: AsyncCallback): void -``` - -以回调形式设置公共事件的数据。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------------------- | ---- | -------------------- | -| data | string | 是 | 公共事件的数据。 | -| callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 | - -**示例:** - -```ts -let subscriber; // 创建成功的订阅者对象 - -// 设置有序公共事件的结果数据回调 -function setDataCB(err) { - if (err.code) { - console.error(`sendData failed, code is ${err.code}`); - } else { - console.info("setData"); - } -} -subscriber.setData("publish_data_changed", setDataCB); -``` - -### setData - -```ts -setData(data: string): Promise -``` - -以Promise形式设置公共事件的果数据。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | -------------------- | -| data | string | 是 | 公共事件的数据。 | - -**返回值:** - -| 类型 | 说明 | -| ---------------- | -------------------- | -| Promise\ | 返回一个Promise的结果。 | - -**示例:** - -```ts -let subscriber; // 创建成功的订阅者对象 - -subscriber.setData("publish_data_changed").then(() => { - console.info("setData"); -}).catch((err) => { - console.error(`setData failed, code is ${err.code}`); -}); -``` - -### setCodeAndData - -```ts -setCodeAndData(code: number, data: string, callback:AsyncCallback): void -``` - -以回调形式设置公共事件代码和数据。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------------------- | ---- | ---------------------- | -| code | number | 是 | 公共事件的代码。 | -| data | string | 是 | 公共事件的数据。 | -| callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 | - -**示例:** - -```ts -let subscriber; // 创建成功的订阅者对象 - -// 设置有序公共事件的结果代码和结果数据回调 -function setCodeDataCB(err) { - if (err.code) { - console.error(`setCodeAndData failed, code is ${err.code}`); - } else { - console.info("setCodeDataCallback"); - } -} - -subscriber.setCodeAndData(1, "publish_data_changed", setCodeDataCB); -``` - -### setCodeAndData - -```ts -setCodeAndData(code: number, data: string): Promise -``` - -以Promise形式设置公共事件的代码和数据。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | -------------------- | -| code | number | 是 | 公共事件的代码。 | -| data | string | 是 | 公共事件的数据。 | - -**返回值:** - -| 类型 | 说明 | -| ---------------- | -------------------- | -| Promise\ | 返回一个Promise。 | - -**示例:** - -```ts -let subscriber; // 创建成功的订阅者对象 - -subscriber.setCodeAndData(1, "publish_data_changed").then(() => { - console.info("setCodeAndData"); -}).catch((err) => { - console.error(`setCodeAndData failed, code is ${err.code}`); -}); -``` - -### isOrderedCommonEvent - -```ts -isOrderedCommonEvent(callback: AsyncCallback): void -``` - -以回调形式查询当前公共事件的是否为有序公共事件。 - -返回true代表是有序公共事件,false代表不是有序公共事件。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ----------------------- | ---- | ---------------------------------- | -| callback | AsyncCallback\ | 是 | 当前公共事件的是否为有序公共事件。 | - -**示例:** - -```ts -let subscriber; // 创建成功的订阅者对象 - -// 获取当前公共事件是否为有序事件的回调 -function isOrderedCB(err, isOrdered) { - if (err.code) { - console.error(`isOrderedCommonEvent failed, code is ${err.code}`); - } else { - console.info("isOrdered " + JSON.stringify(isOrdered)); - } -} -subscriber.isOrderedCommonEvent(isOrderedCB); -``` - -### isOrderedCommonEvent - -```ts -isOrderedCommonEvent(): Promise -``` - -以Promise形式查询当前公共事件的是否为有序公共事件。 - -返回true代表是有序公共事件,false代表不是有序公共事件。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**返回值:** - -| 类型 | 说明 | -| ----------------- | -------------------------------- | -| Promise\ | 当前公共事件的是否为有序公共事件。 | - -**示例:** - -```ts -let subscriber; // 创建成功的订阅者对象 - -subscriber.isOrderedCommonEvent().then((isOrdered) => { - console.info("isOrdered " + JSON.stringify(isOrdered)); -}).catch((err) => { - console.error(`isOrderedCommonEvent failed, code is ${err.code}`); -}); -``` - -### isStickyCommonEvent - -```ts -isStickyCommonEvent(callback: AsyncCallback): void -``` - -以回调形式检查当前公共事件是否为一个粘性事件。 - -返回true代表是粘性公共事件,false代表不是粘性公共事件。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ----------------------- | ---- | ---------------------------------- | -| callback | AsyncCallback\ | 是 | 当前公共事件的是否为粘性公共事件。 | - -**示例:** - -```ts -let subscriber; // 创建成功的订阅者对象 - -// 获取当前公共事件是否为粘性事件的回调 -function isStickyCB(err, isSticky) { - if (err.code) { - console.error(`isStickyCommonEvent failed, code is ${err.code}`); - } else { - console.info("isSticky " + JSON.stringify(isSticky)); - } -} -subscriber.isStickyCommonEvent(isStickyCB); -``` - -### isStickyCommonEvent - -```ts -isStickyCommonEvent(): Promise -``` - -以Promise形式检查当前公共事件是否为一个粘性事件。 - -返回true代表是粘性公共事件,false代表不是粘性公共事件。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**返回值:** - -| 类型 | 说明 | -| ----------------- | -------------------------------- | -| Promise\ | 当前公共事件的是否为粘性公共事件。 | - -**示例:** - -```ts -let subscriber; // 创建成功的订阅者对象 - -subscriber.isStickyCommonEvent().then((isSticky) => { - console.info("isSticky " + JSON.stringify(isSticky)); -}).catch((err) => { - console.error(`isSticky failed, code is ${err.code}`); -}); -``` - -### abortCommonEvent - -```ts -abortCommonEvent(callback: AsyncCallback): void -``` - -以回调形式取消当前的有序公共事件,取消后,有序公共事件不再向下一个订阅者传递。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------------------- | ---- | -------------------- | -| callback | AsyncCallback\ | 是 | 取消当前的公共事件。 | - -**示例:** - -```ts -let subscriber; // 创建成功的订阅者对象 - -// 取消当前有序公共事件的回调 -function abortCB(err) { - if (err.code) { - console.error(`abortCommonEvent failed, code is ${err.code}`); - } else { - console.info("abortCommonEvent"); - } -} - -subscriber.abortCommonEvent(abortCB); -``` - -### abortCommonEvent - -```ts -abortCommonEvent(): Promise -``` - -以Promise形式取消当前的有序公共事件,取消后,公共事件不再向下一个订阅者传递。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**返回值:** - -| 类型 | 说明 | -| ---------------- | -------------------- | -| Promise\ | 返回一个Promise的结果。 | - -**示例:** - -```ts -let subscriber; // 创建成功的订阅者对象 - -subscriber.abortCommonEvent().then(() => { - console.info("abortCommonEvent"); -}).catch((err) => { - console.error(`abortCommonEvent failed, code is ${err.code}`); -}); -``` - -### clearAbortCommonEvent - -```ts -clearAbortCommonEvent(callback: AsyncCallback): void -``` - -以回调形式清除当前有序公共事件。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------------------- | ---- | -------------------- | -| callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 | - -**示例:** - -```ts -let subscriber; // 创建成功的订阅者对象 - -// 清除当前公共事件取消状态的回调 -function clearAbortCB(err) { - if (err.code) { - console.error(`clearAbortCommonEvent failed, code is ${err.code}`); - } else { - console.info("clearAbortCommonEvent"); - } -} - -subscriber.clearAbortCommonEvent(clearAbortCB); -``` - -### clearAbortCommonEvent - -```ts -clearAbortCommonEvent(): Promise -``` - -以Promise形式清除当前有序公共事件。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**返回值:** - -| 类型 | 说明 | -| ---------------- | -------------------- | -| Promise\ | 返回一个Promise的结果。 | - -**示例:** - -```ts -let subscriber; // 创建成功的订阅者对象 - -subscriber.clearAbortCommonEvent().then(() => { - console.info("clearAbortCommonEvent"); -}).catch((err) => { - console.error(`clearAbortCommonEvent failed, code is ${err.code}`); -}); -``` - -### getAbortCommonEvent - -```ts -getAbortCommonEvent(callback: AsyncCallback): void -``` - -以回调形式获取当前有序公共事件是否取消的状态。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ----------------------- | ---- | ---------------------------------- | -| callback | AsyncCallback\ | 是 | 表示当前有序公共事件是否取消的状态。 | - -**示例:** - -```ts -let subscriber; // 创建成功的订阅者对象 - -// 获取当前有序公共事件是否取消的回调 -function getAbortCB(err, abortEvent) { - if (err.code) { - console.error(`getAbortCommonEvent failed, code is ${err.code}`); - } else { - console.info("abortEvent " + abortEvent) - } -} - -subscriber.getAbortCommonEvent(getAbortCB); -``` - -### getAbortCommonEvent - -```ts -getAbortCommonEvent(): Promise -``` - -以Promise形式获取当前有序公共事件是否取消的状态。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**返回值:** - -| 类型 | 说明 | -| ----------------- | ---------------------------------- | -| Promise\ | 表示当前有序公共事件是否取消的状态。 | - -**示例:** - -```ts -let subscriber; // 创建成功的订阅者对象 - -subscriber.getAbortCommonEvent().then((abortCommonEvent) => { - console.info("abortCommonEvent " + JSON.stringify(abortCommonEvent)); -}).catch((err) => { - console.error(`getAbortCommonEvent failed, code is ${err.code}`); -}); -``` - -### getSubscribeInfo - -```ts -getSubscribeInfo(callback: AsyncCallback): void -``` - -以回调形式获取订阅者的订阅信息。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------------------------------------------------------------ | ---- | ---------------------- | -| callback | AsyncCallback\<[CommonEventSubscribeInfo](#commoneventsubscribeinfo)> | 是 | 表示订阅者的订阅信息。 | - -**示例:** - -```ts -let subscriber; // 创建成功的订阅者对象 - -// 获取订阅者信息回调 -function getCB(err, subscribeInfo) { - if (err.code) { - console.error(`getSubscribeInfo failed, code is ${err.code}`); - } else { - console.info("SubscribeInfo " + JSON.stringify(subscribeInfo)); - } -} - -subscriber.getSubscribeInfo(getCB); -``` - -### getSubscribeInfo - -```ts -getSubscribeInfo(): Promise -``` - -以Promise形式获取订阅者的订阅信息。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**返回值:** - -| 类型 | 说明 | -| ------------------------------------------------------------ | ---------------------- | -| Promise\<[CommonEventSubscribeInfo](#commoneventsubscribeinfo)> | 表示订阅者的订阅信息。 | - -**示例:** - -```ts -let subscriber; // 创建成功的订阅者对象 - -subscriber.getSubscribeInfo().then((subscribeInfo) => { - console.info("subscribeInfo " + JSON.stringify(subscribeInfo)); -}).catch((err) => { - console.error(`getSubscribeInfo failed, code is ${err.code}`); -}); -``` - -### finishCommonEvent9+ - -```ts -finishCommonEvent(callback: AsyncCallback): void -``` - -以回调形式结束当前有序公共事件。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------------------- | ---- | -------------------------------- | -| callback | AsyncCallback\ | 是 | 表示有序公共事件结束后的回调函数。 | - -**示例:** - -```ts -let subscriber; // 创建成功的订阅者对象 - -// 结束当前有序公共事件的回调 -function finishCB(err) { - if (err.code) { - console.error(`finishCommonEvent failed, code is ${err.code}`); - } else { - console.info("FinishCommonEvent"); - } -} - -subscriber.finishCommonEvent(finishCB); -``` - -### finishCommonEvent9+ - -```ts -finishCommonEvent(): Promise -``` - -以Promise形式结束当前有序公共事件。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**返回值:** - -| 类型 | 说明 | -| ---------------- | -------------------- | -| Promise\ | 返回一个Promise的结果。 | - -**示例:** - -```ts -let subscriber; // 创建成功的订阅者对象 - -subscriber.finishCommonEvent().then(() => { - console.info("FinishCommonEvent"); -}).catch((err) => { - console.error(`finishCommonEvent failed, code is ${err.code}`); -}); -``` - -## CommonEventData - -公共事件数据体。 - -**系统能力:** `SystemCapability.Notification.CommonEvent` - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ---------- |-------------------- | ---- | ---- | ------------------------------------------------------- | -| event | string | 是 | 否 | 表示当前接收的公共事件名称。 | -| bundleName | string | 是 | 否 | 表示Bundle名称。 | -| code | number | 是 | 否 | 表示公共事件的结果代码,用于传递int类型的数据。 | -| data | string | 是 | 否 | 表示公共事件的自定义结果数据,用于传递string类型的数据。 | -| parameters | {[key: string]: any} | 是 | 否 | 表示公共事件的附加信息。 | - - -## CommonEventPublishData - -公共事件发送的数据体,包含公共事件内容和属性。 - -**系统能力:** `SystemCapability.Notification.CommonEvent` - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| --------------------- | -------------------- | ---- | ---- | ---------------------------- | -| bundleName | string | 是 | 否 | 表示Bundle名称。 | -| code | number | 是 | 否 | 表示公共事件的结果代码。 | -| data | string | 是 | 否 | 表示公共事件的自定义结果数据。 | -| subscriberPermissions | Array\ | 是 | 否 | 表示订阅者的权限。 | -| isOrdered | boolean | 是 | 否 | 表示是否是有序事件。 | -| isSticky | boolean | 是 | 否 | 表示是否是粘性事件。仅系统应用或系统服务允许发送粘性事件。 | -| parameters | {[key: string]: any} | 是 | 否 | 表示公共事件的附加信息。 | - -## CommonEventSubscribeInfo - -订阅者信息。 - -**系统能力:** `SystemCapability.Notification.CommonEvent` - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ------------------- | -------------- | ---- | ---- | ------------------------------------------------------------ | -| events | Array\ | 是 | 否 | 表示要发送的公共事件。 | -| publisherPermission | string | 是 | 否 | 表示发布者的权限。 | -| publisherDeviceId | string | 是 | 否 | 表示设备ID,该值必须是同一ohos网络上的现有设备ID。 | -| userId | number | 是 | 否 | 表示用户ID。此参数是可选的,默认值当前用户的ID。如果指定了此参数,则该值必须是系统中现有的用户ID。 | -| priority | number | 是 | 否 | 表示订阅者的优先级。值的范围是-100到1000。 | \ No newline at end of file +``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-commonEventManager.md b/zh-cn/application-dev/reference/apis/js-apis-commonEventManager.md index 8873bc0e67a8cd392da2d1c7813c9cf66fafbd26..8ed865ef1cf2b5265c43037b8ef1a125d92ce2ea 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-commonEventManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-commonEventManager.md @@ -20,13 +20,11 @@ import CommonEventManager from '@ohos.commonEventManager'; ## CommonEventManager.publish -```ts publish(event: string, callback: AsyncCallback): void -``` 发布公共事件,并在发布后执行相应的回调函数。 -**系统能力:** `SystemCapability.Notification.CommonEvent` +**系统能力:** SystemCapability.Notification.CommonEvent **参数:** @@ -39,6 +37,14 @@ publish(event: string, callback: AsyncCallback): void 错误码介绍请参考[@ohos.commonEventManager(事件)](../errorcodes/errorcode-CommonEventService.md) +| 错误码ID | 错误信息 | +| -------- | ----------------------------------- | +| 401 | The parameter check failed. | +| 1500004 | not System services. | +| 1500007 | error sending message to Common Event Service. | +| 1500008 | Common Event Service does not complete initialization. | +| 1500009 | error obtaining system parameters. | + **示例:** ```ts @@ -61,26 +67,32 @@ try { ## CommonEventManager.publish -```ts publish(event: string, options: CommonEventPublishData, callback: AsyncCallback): void -``` 以回调的形式发布公共事件。 -**系统能力:** `SystemCapability.Notification.CommonEvent` +**系统能力:**SystemCapability.Notification.CommonEvent **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------- | ---- | ---------------------- | | event | string | 是 | 表示要发布的公共事件。 | -| options | [CommonEventPublishData](#commoneventpublishdata) | 是 | 表示发布公共事件的属性。 | +| options | [CommonEventPublishData](./js-apis-inner-commonEvent-commonEventPublishData.md) | 是 | 表示发布公共事件的属性。 | | callback | syncCallback\ | 是 | 表示被指定的回调方法。 | **错误码:** 错误码介绍请参考[@ohos.commonEventManager(事件)](../errorcodes/errorcode-CommonEventService.md) +| 错误码ID | 错误信息 | +| -------- | ----------------------------------- | +| 401 | The parameter check failed. | +| 1500004 | not System services. | +| 1500007 | error sending message to Common Event Service. | +| 1500008 | Common Event Service does not complete initialization. | +| 1500009 | error obtaining system parameters. | + **示例:** ```ts @@ -110,13 +122,11 @@ try { ## CommonEventManager.publishAsUser -```ts publishAsUser(event: string, userId: number, callback: AsyncCallback): void -``` 以回调的形式向指定用户发布公共事件。 -**系统能力:** `SystemCapability.Notification.CommonEvent` +**系统能力:** SystemCapability.Notification.CommonEvent **系统API**:此接口为系统接口,三方应用不支持调用。 @@ -132,6 +142,15 @@ publishAsUser(event: string, userId: number, callback: AsyncCallback): voi 错误码介绍请参考[@ohos.commonEventManager(事件)](../errorcodes/errorcode-CommonEventService.md) +| 错误码ID | 错误信息 | +| -------- | ----------------------------------- | +| 202 | not system app. | +| 401 | The parameter check failed. | +| 1500004 | not System services. | +| 1500007 | error sending message to Common Event Service. | +| 1500008 | Common Event Service does not complete initialization. | +| 1500009 | error obtaining system parameters. | + **示例:** ```ts @@ -157,13 +176,11 @@ try { ## CommonEventManager.publishAsUser -```ts publishAsUser(event: string, userId: number, options: CommonEventPublishData, callback: AsyncCallback): void -``` 以回调形式向指定用户发布公共事件并指定发布信息。 -**系统能力:** `SystemCapability.Notification.CommonEvent` +**系统能力:** SystemCapability.Notification.CommonEvent **系统API**:此接口为系统接口,三方应用不支持调用。 @@ -173,13 +190,22 @@ publishAsUser(event: string, userId: number, options: CommonEventPublishData, ca | -------- | ---------------------- | ---- | ---------------------- | | event | string | 是 | 表示要发布的公共事件。 | | userId | number | 是 | 表示指定向该用户ID发送此公共事件。 | -| options | [CommonEventPublishData](#commoneventpublishdata) | 是 | 表示发布公共事件的属性。 | +| options | [CommonEventPublishData](./js-apis-inner-commonEvent-commonEventPublishData.md) | 是 | 表示发布公共事件的属性。 | | callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 | **错误码:** 错误码介绍请参考[@ohos.commonEventManager(事件)](../errorcodes/errorcode-CommonEventService.md) +| 错误码ID | 错误信息 | +| -------- | ----------------------------------- | +| 202 | not system app. | +| 401 | The parameter check failed. | +| 1500004 | not System services. | +| 1500007 | error sending message to Common Event Service. | +| 1500008 | Common Event Service does not complete initialization. | +| 1500009 | error obtaining system parameters. | + **示例:** @@ -212,20 +238,26 @@ try { ## CommonEventManager.createSubscriber -```ts createSubscriber(subscribeInfo: CommonEventSubscribeInfo, callback: AsyncCallback): void -``` 以回调形式创建订阅者。 -**系统能力:** `SystemCapability.Notification.CommonEvent` +**系统能力:** SystemCapability.Notification.CommonEvent **参数:** | 参数名 | 类型 | 必填 | 说明 | | ------------- | ------------------------------------------------------------ | ---- | -------------------------- | -| subscribeInfo | [CommonEventSubscribeInfo](#commoneventsubscribeinfo) | 是 | 表示订阅信息。 | -| callback | AsyncCallback\<[CommonEventSubscriber](#commoneventsubscriber)> | 是 | 表示创建订阅者的回调方法。 | +| subscribeInfo | [CommonEventSubscribeInfo](./js-apis-inner-commonEvent-commonEventSubscribeInfo.md) | 是 | 表示订阅信息。 | +| callback | AsyncCallback\<[CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md)> | 是 | 表示创建订阅者的回调方法。 | + +**错误码:** + +错误码介绍请参考[@ohos.commonEventManager(事件)](../errorcodes/errorcode-CommonEventService.md) + +| 错误码ID | 错误信息 | +| -------- | ----------------------------------- | +| 401 | The parameter check failed. | **示例:** @@ -258,24 +290,30 @@ try { ## CommonEventManager.createSubscriber -```ts createSubscriber(subscribeInfo: CommonEventSubscribeInfo): Promise -``` 以Promise形式创建订阅者。 -**系统能力:** `SystemCapability.Notification.CommonEvent` +**系统能力:** SystemCapability.Notification.CommonEvent **参数:** | 参数名 | 类型 | 必填 | 说明 | | ------------- | ----------------------------------------------------- | ---- | -------------- | -| subscribeInfo | [CommonEventSubscribeInfo](#commoneventsubscribeinfo) | 是 | 表示订阅信息。 | +| subscribeInfo | [CommonEventSubscribeInfo](./js-apis-inner-commonEvent-commonEventSubscribeInfo.md) | 是 | 表示订阅信息。 | **返回值:** | 类型 | 说明 | | --------------------------------------------------------- | ---------------- | -| Promise\<[CommonEventSubscriber](#commoneventsubscriber)> | 返回订阅者对象。 | +| Promise\<[CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md)> | 返回订阅者对象。 | + +**错误码:** + +错误码介绍请参考[@ohos.commonEventManager(事件)](../errorcodes/errorcode-CommonEventService.md) + +| 错误码ID | 错误信息 | +| -------- | ----------------------------------- | +| 401 | The parameter check failed. | **示例:** @@ -299,20 +337,29 @@ CommonEventManager.createSubscriber(subscribeInfo).then((commonEventSubscriber) ## CommonEventManager.subscribe -```ts subscribe(subscriber: CommonEventSubscriber, callback: AsyncCallback): void -``` 以回调形式订阅公共事件。 -**系统能力:** `SystemCapability.Notification.CommonEvent` +**系统能力:** SystemCapability.Notification.CommonEvent **参数:** | 参数名 | 类型 | 必填 | 说明 | | ---------- | ---------------------------------------------------- | ---- | -------------------------------- | -| subscriber | [CommonEventSubscriber](#commoneventsubscriber) | 是 | 表示订阅者对象。 | -| callback | AsyncCallback\<[CommonEventData](#commoneventdata)> | 是 | 表示接收公共事件数据的回调函数。 | +| subscriber | [CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md) | 是 | 表示订阅者对象。 | +| callback | AsyncCallback\<[CommonEventData](./js-apis-inner-commonEvent-commonEventData.md)> | 是 | 表示接收公共事件数据的回调函数。 | + +**错误码:** + +错误码介绍请参考[@ohos.commonEventManager(事件)](../errorcodes/errorcode-CommonEventService.md) + +| 错误码ID | 错误信息 | +| -------- | ----------------------------------- | +| 401 | The parameter check failed. | +| 801 | capability not supported. | +| 1500007 | error sending message to Common Event Service. | +| 1500008 | Common Event Service does not complete initialization. | **示例:** @@ -327,7 +374,7 @@ let subscribeInfo = { //订阅公共事件回调 function SubscribeCB(err, data) { - if (err.code) { + if (err) { console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`); } else { console.info("subscribe "); @@ -335,9 +382,10 @@ function SubscribeCB(err, data) { } //创建订阅者回调 -function createCB(err, subscriber) { +function createCB(err, commonEventSubscriber) { if(!err) { console.info("createSubscriber"); + subscriber = commonEventSubscriber; //订阅公共事件 try { CommonEventManager.subscribe(subscriber, SubscribeCB); @@ -359,21 +407,30 @@ try { ## CommonEventManager.unsubscribe -```ts unsubscribe(subscriber: CommonEventSubscriber, callback?: AsyncCallback): void -``` 以回调形式取消订阅公共事件。 -**系统能力:** `SystemCapability.Notification.CommonEvent` +**系统能力:** SystemCapability.Notification.CommonEvent **参数:** | 参数名 | 类型 | 必填 | 说明 | | ---------- | ----------------------------------------------- | ---- | ------------------------ | -| subscriber | [CommonEventSubscriber](#commoneventsubscriber) | 是 | 表示订阅者对象。 | +| subscriber | [CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md) | 是 | 表示订阅者对象。 | | callback | AsyncCallback\ | 否 | 表示取消订阅的回调方法。 | +**错误码:** + +错误码介绍请参考[@ohos.commonEventManager(事件)](../errorcodes/errorcode-CommonEventService.md) + +| 错误码ID | 错误信息 | +| -------- | ----------------------------------- | +| 401 | The parameter check failed. | +| 801 | capability not supported. | +| 1500007 | error sending message to Common Event Service. | +| 1500008 | Common Event Service does not complete initialization. | + **示例:** ```ts @@ -391,11 +448,12 @@ function subscribeCB(err, data) { } } //创建订阅者回调 -function createCB(err, subscriber) { +function createCB(err, commonEventSubscriber) { if (err) { console.error(`createSubscriber failed, code is ${err.code}, message is ${err.message}`); } else { console.info("createSubscriber"); + subscriber = commonEventSubscriber; //订阅公共事件 try { CommonEventManager.subscribe(subscriber, subscribeCB); @@ -427,792 +485,93 @@ try { } ``` -## CommonEventSubscriber - -### getCode - -```ts -getCode(callback: AsyncCallback): void -``` - -以回调形式获取公共事件代码。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ---------------------- | ---- | ------------------ | -| callback | AsyncCallback\ | 是 | 公共事件代码。 | - -**示例:** - -```ts -let subscriber; //创建成功的订阅者对象 - -//获取有序公共事件代码回调 -function getCodeCB(err, code) { - if (err.code) { - console.error(`getCode failed, code is ${err.code}, message is ${err.message}`); - } else { - console.info("getCode " + JSON.stringify(code)); - } -} -subscriber.getCode(getCodeCB); -``` - -### getCode - -```ts -getCode(): Promise -``` - -以Promise形式获取公共事件代码。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**返回值:** - -| 类型 | 说明 | -| ---------------- | -------------------- | -| Promise\ | 公共事件代码。 | - -**示例:** - -```ts -let subscriber; //创建成功的订阅者对象 - -subscriber.getCode().then((code) => { - console.info("getCode " + JSON.stringify(code)); -}).catch((err) => { - console.error(`getCode failed, code is ${err.code}, message is ${err.message}`); -}); -``` - -### setCode - -```ts -setCode(code: number, callback: AsyncCallback): void -``` - -以回调形式设置公共事件的代码。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------------------- | ---- | ---------------------- | -| code | number | 是 | 公共事件的代码。 | -| callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 | - -**示例:** - -```ts -let subscriber; //创建成功的订阅者对象 - -//设置有序公共事件的代码回调 -function setCodeCB(err) { - if (err.code) { - console.error(`setCode failed, code is ${err.code}, message is ${err.message}`); - } else { - console.info("setCode"); - } -} -subscriber.setCode(1, setCodeCB); -``` - -### setCode - -```ts -setCode(code: number): Promise -``` - -以Promise形式设置公共事件的代码。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | ------------------ | -| code | number | 是 | 公共事件的代码。 | - -**返回值:** - -| 类型 | 说明 | -| ---------------- | -------------------- | -| Promise\ | 返回一个Promise的结果。 | - -**示例:** - -```ts -let subscriber; //创建成功的订阅者对象 - -subscriber.setCode(1).then(() => { - console.info("setCode"); -}).catch((err) => { - console.error(`setCode failed, code is ${err.code}, message is ${err.message}`); -}); -``` - -### getData - -```ts -getData(callback: AsyncCallback): void -``` - -以回调形式获取公共事件的数据。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ---------------------- | ---- | -------------------- | -| callback | AsyncCallback\ | 是 | 公共事件的数据。 | - -**示例:** - -```ts -let subscriber; //创建成功的订阅者对象 - -//获取有序公共事件代码数据回调 -function getDataCB(err, data) { - if (err.code) { - console.error(`getData failed, code is ${err.code}, message is ${err.message}`); - } else { - console.info("getData " + JSON.stringify(data)); - } -} -subscriber.getData(getDataCB); -``` - -### getData - -```ts -getData(): Promise -``` - -以Promise形式获取公共事件的数据。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**返回值:** - -| 类型 | 说明 | -| ---------------- | ------------------ | -| Promise\ | 公共事件的数据。 | - -**示例:** - -```ts -let subscriber; //创建成功的订阅者对象 - -subscriber.getData().then((data) => { - console.info("getData " + JSON.stringify(data)); -}).catch((err) => { - console.error(`getData failed, code is ${err.code}, message is ${err.message}`); -}); -``` - -### setData - -setData(data: string, callback: AsyncCallback\): void - -以回调形式设置公共事件的数据。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------------------- | ---- | -------------------- | -| data | string | 是 | 公共事件的数据。 | -| callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 | - -**示例:** - -```ts -let subscriber; //创建成功的订阅者对象 - -//设置有序公共事件的结果数据回调 -function setDataCB(err) { - if (err.code) { - console.error(`setCode failed, code is ${err.code}, message is ${err.message}`); - } else { - console.info("setData"); - } -} -subscriber.setData("publish_data_changed", setDataCB); -``` - -### setData - -```ts -setData(data: string): Promise -``` - -以Promise形式设置公共事件的果数据。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | -------------------- | -| data | string | 是 | 公共事件的数据。 | - -**返回值:** - -| 类型 | 说明 | -| ---------------- | -------------------- | -| Promise\ | 返回一个Promise的结果。 | - -**示例:** - -```ts -let subscriber; //创建成功的订阅者对象 - -subscriber.setData("publish_data_changed").then(() => { - console.info("setData"); -}).catch((err) => { - console.error(`setCode failed, code is ${err.code}, message is ${err.message}`); -}); -``` - -### setCodeAndData - -```ts -setCodeAndData(code: number, data: string, callback:AsyncCallback): void -``` - -以回调形式设置公共事件代码和数据。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------------------- | ---- | ---------------------- | -| code | number | 是 | 公共事件的代码。 | -| data | string | 是 | 公共事件的数据。 | -| callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 | - -**示例:** - -```ts -let subscriber; //创建成功的订阅者对象 - -//设置有序公共事件的代码和数据回调 -function setCodeDataCB(err) { - if (err.code) { - console.error(`setCodeAndData failed, code is ${err.code}, message is ${err.message}`); - } else { - console.info("setCodeDataCallback"); - } -} -subscriber.setCodeAndData(1, "publish_data_changed", setCodeDataCB); -``` - -### setCodeAndData - -```ts -setCodeAndData(code: number, data: string): Promise -``` - -以Promise形式设置公共事件的代码和数据。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | -------------------- | -| code | number | 是 | 公共事件的代码。 | -| data | string | 是 | 公共事件的数据。 | - -**返回值:** - -| 类型 | 说明 | -| ---------------- | -------------------- | -| Promise\ | 返回一个Promise。 | - -**示例:** - -```ts -let subscriber; //创建成功的订阅者对象 - -subscriber.setCodeAndData(1, "publish_data_changed").then(() => { - console.info("setCodeAndData"); -}).catch((err) => { - console.error(`setCodeAndData failed, code is ${err.code}, message is ${err.message}`); -}); -``` - -### isOrderedCommonEvent - -```ts -isOrderedCommonEvent(callback: AsyncCallback): void -``` - -以回调形式查询当前公共事件的是否为有序公共事件。 - -返回true代表是有序公共事件,false代表不是有序公共事件。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ----------------------- | ---- | ---------------------------------- | -| callback | AsyncCallback\ | 是 | 当前公共事件的是否为有序公共事件。 | - -**示例:** - -```ts -let subscriber; //创建成功的订阅者对象 - -//获取当前公共事件是否为有序事件的回调 -function isOrderedCB(err, isOrdered) { - if (err.code) { - console.error(`isOrderedCommonEvent failed, code is ${err.code}, message is ${err.message}`); - } else { - console.info("isOrdered " + JSON.stringify(isOrdered)); - } -} -subscriber.isOrderedCommonEvent(isOrderedCB); -``` - -### isOrderedCommonEvent +## CommonEventManager.removeStickyCommonEvent10+ -```ts -isOrderedCommonEvent(): Promise -``` +removeStickyCommonEvent(event: string, callback: AsyncCallback): void -以Promise形式查询当前公共事件的是否为有序公共事件。 +以回调形式移除粘性公共事件。 -返回true代表是有序公共事件,false代表不是有序公共事件。 +**系统能力:** SystemCapability.Notification.CommonEvent -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**返回值:** - -| 类型 | 说明 | -| ----------------- | -------------------------------- | -| Promise\ | 当前公共事件的是否为有序公共事件。 | - -**示例:** - -```ts -let subscriber; //创建成功的订阅者对象 - -subscriber.isOrderedCommonEvent().then((isOrdered) => { - console.info("isOrdered " + JSON.stringify(isOrdered)); -}).catch((err) => { - console.error(`isOrdered failed, code is ${err.code}, message is ${err.message}`); -}); -``` - -### isStickyCommonEvent - -```ts -isStickyCommonEvent(callback: AsyncCallback): void -``` - -以回调形式检查当前公共事件是否为一个粘性事件。 - -返回true代表是粘性公共事件,false代表不是粘性公共事件。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` +**需要权限**: ohos.permission.COMMONEVENT_STICKY **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ----------------------- | ---- | ---------------------------------- | -| callback | AsyncCallback\ | 是 | 当前公共事件的是否为粘性公共事件。 | - -**示例:** - -```ts -let subscriber; //创建成功的订阅者对象 - -//获取当前公共事件是否为粘性事件的回调 -function isStickyCB(err, isSticky) { - if (err.code) { - console.error(`isStickyCommonEvent failed, code is ${err.code}, message is ${err.message}`); - } else { - console.info("isSticky " + JSON.stringify(isSticky)); - } -} -subscriber.isStickyCommonEvent(isStickyCB); -``` - -### isStickyCommonEvent - -```ts -isStickyCommonEvent(): Promise -``` - -以Promise形式检查当前公共事件是否为一个粘性事件。 - -返回true代表是粘性公共事件,false代表不是粘性公共事件。 +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | -------------------------------- | +| event | string | 是 | 表示被移除的粘性公共事件。 | +| callback | AsyncCallback\ | 是 | 表示移除粘性公共事件的回调方法。 | -**系统能力**:`SystemCapability.Notification.CommonEvent` +**错误码:** -**返回值:** +错误码介绍请参考[@ohos.commonEventManager(事件)](../errorcodes/errorcode-CommonEventService.md) -| 类型 | 说明 | -| ----------------- | -------------------------------- | -| Promise\ | 当前公共事件的是否为粘性公共事件。 | +| 错误码ID | 错误信息 | +| -------- | ----------------------------------- | +| 201 | The application dose not have permission to call the interface. | +| 202 | not system app. | +| 401 | The parameter check failed. | +| 1500004 | not system service. | +| 1500007 | The message send error. | +| 1500008 | The CEMS error. | **示例:** -```ts -let subscriber; //创建成功的订阅者对象 - -subscriber.isStickyCommonEvent().then((isSticky) => { - console.info("isSticky " + JSON.stringify(isSticky)); -}).catch((err) => { - console.error(`isSticky failed, code is ${err.code}, message is ${err.message}`); -}); -``` - -### abortCommonEvent - -```ts -abortCommonEvent(callback: AsyncCallback): void -``` - -以回调形式取消当前的有序公共事件,取消后,有序公共事件不再向下一个订阅者传递。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------------------- | ---- | -------------------- | -| callback | AsyncCallback\ | 是 | 取消当前的有序公共事件。 | - -**示例:** ```ts -let subscriber; //创建成功的订阅者对象 - -//取消当前有序公共事件的回调 -function abortCB(err) { - if (err.code) { - console.error(`abortCommonEvent failed, code is ${err.code}, message is ${err.message}`); - } else { - console.info("abortCommonEvent"); +CommonEventManager.removeStickyCommonEvent("sticky_event", (err) => { + if (err) { + console.info(`Remove sticky event AsyncCallback failed, errCode: ${err.code}, errMes: ${err.message}`); + return; } -} -subscriber.abortCommonEvent(abortCB); -``` - -### abortCommonEvent - -```ts -abortCommonEvent(): Promise -``` - -以Promise形式取消当前的有序公共事件,取消后,公共事件不再向下一个订阅者传递。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**返回值:** - -| 类型 | 说明 | -| ---------------- | -------------------- | -| Promise\ | 返回一个Promise的结果。 | - -**示例:** - -```ts -let subscriber; //创建成功的订阅者对象 - -subscriber.abortCommonEvent().then(() => { - console.info("abortCommonEvent"); -}).catch((err) => { - console.error(`abortCommonEvent failed, code is ${err.code}, message is ${err.message}`); -}); -``` - -### clearAbortCommonEvent - -```ts -clearAbortCommonEvent(callback: AsyncCallback): void -``` - -以回调形式清除当前有序公共事件。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------------------- | ---- | -------------------- | -| callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 | - -**示例:** - -```ts -let subscriber; //创建成功的订阅者对象 - -//清除当前公共事件取消状态的回调 -function clearAbortCB(err) { - if (err.code) { - console.error(`clearAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`); - } else { - console.info("clearAbortCommonEvent"); + console.info(`Remove sticky event AsyncCallback success`); } -} -subscriber.clearAbortCommonEvent(clearAbortCB); -``` - -### clearAbortCommonEvent - -```ts -clearAbortCommonEvent(): Promise -``` - -以Promise形式清除当前有序公共事件。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**返回值:** - -| 类型 | 说明 | -| ---------------- | -------------------- | -| Promise\ | 返回一个Promise的结果。 | - -**示例:** - -```ts -let subscriber; //创建成功的订阅者对象 - -subscriber.clearAbortCommonEvent().then(() => { - console.info("clearAbortCommonEvent"); -}).catch((err) => { - console.error(`clearAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`); }); ``` -### getAbortCommonEvent - -```ts -getAbortCommonEvent(callback: AsyncCallback): void -``` - -以回调形式获取当前有序公共事件是否取消的状态。 +## CommonEventManager.removeStickyCommonEvent10+ -**系统能力**:`SystemCapability.Notification.CommonEvent` +removeStickyCommonEvent(event: string): Promise -**参数:** +以Promise形式移除粘性公共事件。 -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ----------------------- | ---- | ---------------------------------- | -| callback | AsyncCallback\ | 是 | 表示当前有序公共事件是否取消的状态。 | +**系统能力:** SystemCapability.Notification.CommonEvent -**示例:** - -```ts -let subscriber; //创建成功的订阅者对象 - -//获取当前有序公共事件是否取消的回调 -function getAbortCB(err, abortEvent) { - if (err.code) { - console.error(`getAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`); - } else { - console.info("abortCommonEvent " + abortEvent) - } -} -subscriber.getAbortCommonEvent(getAbortCB); -``` - -### getAbortCommonEvent - -```ts -getAbortCommonEvent(): Promise -``` - -以Promise形式获取当前有序公共事件是否取消的状态。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**返回值:** - -| 类型 | 说明 | -| ----------------- | ---------------------------------- | -| Promise\ | 表示当前有序公共事件是否取消的状态。 | - -**示例:** - -```ts -let subscriber; //创建成功的订阅者对象 - -subscriber.getAbortCommonEvent().then((abortEvent) => { - console.info("abortCommonEvent " + JSON.stringify(abortEvent)); -}).catch((err) => { - console.error(`getAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`); -}); -``` - -### getSubscribeInfo - -```ts -getSubscribeInfo(callback: AsyncCallback): void -``` - -以回调形式获取订阅者的订阅信息。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` +**需要权限**: ohos.permission.COMMONEVENT_STICKY **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------------------------------------------------------------ | ---- | ---------------------- | -| callback | AsyncCallback\<[CommonEventSubscribeInfo](#commoneventsubscribeinfo)> | 是 | 表示订阅者的订阅信息。 | - -**示例:** - -```ts -let subscriber; //创建成功的订阅者对象 - -//获取订阅者信息回调 -function getCB(err, subscribeInfo) { - if (err.code) { - console.error(`getSubscribeInfo failed, code is ${err.code}, message is ${err.message}`); - } else { - console.info("subscribeInfo " + JSON.stringify(subscribeInfo)); - } -} -subscriber.getSubscribeInfo(getCB); -``` - -### getSubscribeInfo - -```ts -getSubscribeInfo(): Promise -``` - -以Promise形式获取订阅者的订阅信息。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------- | +| event | string | 是 | 表示被移除的粘性公共事件。 | **返回值:** -| 类型 | 说明 | -| ------------------------------------------------------------ | ---------------------- | -| Promise\<[CommonEventSubscribeInfo](#commoneventsubscribeinfo)> | 表示订阅者的订阅信息。 | - -**示例:** - -```ts -let subscriber; //创建成功的订阅者对象 - -subscriber.getSubscribeInfo().then((subscribeInfo) => { - console.info("subscribeInfo " + JSON.stringify(subscribeInfo)); -}).catch((err) => { - console.error(`getSubscribeInfo failed, code is ${err.code}, message is ${err.message}`); -}); -``` +| 类型 | 说明 | +| -------------- | ---------------------------- | +| Promise\ | 表示移除粘性公共事件的对象。 | -### finishCommonEvent9+ - -```ts -finishCommonEvent(callback: AsyncCallback): void -``` - -以回调形式结束当前有序公共事件。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` +**错误码:** -**参数:** +错误码介绍请参考[@ohos.commonEventManager(事件)](../errorcodes/errorcode-CommonEventService.md) -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------------------- | ---- | -------------------------------- | -| callback | AsyncCallback\ | 是 | 表示有序公共事件结束后的回调函数。 | +| 错误码ID | 错误信息 | +| -------- | ----------------------------------- | +| 201 | The application dose not have permission to call the interface. | +| 202 | not system app. | +| 401 | The parameter check failed. | +| 1500004 | not system service. | +| 1500007 | The message send error. | +| 1500008 | The CEMS error. | **示例:** -```ts -let subscriber; //创建成功的订阅者对象 - -//结束当前有序公共事件的回调 -function finishCB(err) { - if (err.code) { - console.error(`finishCommonEvent failed, code is ${err.code}, message is ${err.message}`); -} else { - console.info("FinishCommonEvent"); -} - -subscriber.finishCommonEvent(finishCB); -``` - -### finishCommonEvent9+ - -```ts -finishCommonEvent(): Promise -``` - -以Promise形式结束当前有序公共事件。 - -**系统能力**:`SystemCapability.Notification.CommonEvent` - -**返回值:** - -| 类型 | 说明 | -| ---------------- | -------------------- | -| Promise\ | 返回一个Promise的结果。 | - -**示例:** ```ts -let subscriber; //创建成功的订阅者对象 - -subscriber.finishCommonEvent().then(() => { - console.info("FinishCommonEvent"); -}).catch((err) => { - console.error(`finishCommonEvent failed, code is ${err.code}, message is ${err.message}`); +commonEventManager.removeStickyCommonEvent("sticky_event").then(() => { + console.info(`Remove sticky event AsyncCallback success`); +}).catch ((err) => { + console.info(`Remove sticky event AsyncCallback failed, errCode: ${err.code}, errMes: ${err.message}`); }); ``` -## CommonEventData - -**系统能力:** `SystemCapability.Notification.CommonEvent` - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ---------- |-------------------- | ---- | ---- | ------------------------------------------------------- | -| event | string | 是 | 否 | 表示当前接收的公共事件名称。 | -| bundleName | string | 是 | 否 | 表示包名称。 | -| code | number | 是 | 否 | 表示公共事件的结果代码,用于传递int类型的数据。 | -| data | string | 是 | 否 | 表示公共事件的自定义结果数据,用于传递string类型的数据。 | -| parameters | {[key: string]: any} | 是 | 否 | 表示公共事件的附加信息。 | - - -## CommonEventPublishData - -**系统能力:** `SystemCapability.Notification.CommonEvent` - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| --------------------- | -------------------- | ---- | ---- | ---------------------------- | -| bundleName | string | 是 | 否 | 表示包名称。 | -| code | number | 是 | 否 | 表示公共事件的结果代码。 | -| data | string | 是 | 否 | 表示公共事件的自定义结果数据。 | -| subscriberPermissions | Array\ | 是 | 否 | 表示订阅者的权限。 | -| isOrdered | boolean | 是 | 否 | 表示是否是有序事件。 | -| isSticky | boolean | 是 | 否 | 表示是否是粘性事件。仅系统应用或系统服务允许发送粘性事件。 | -| parameters | {[key: string]: any} | 是 | 否 | 表示公共事件的附加信息。 | - -## CommonEventSubscribeInfo - -**系统能力:** `SystemCapability.Notification.CommonEvent` - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ------------------- | -------------- | ---- | ---- | ------------------------------------------------------------ | -| events | Array\ | 是 | 否 | 表示要发送的公共事件。 | -| publisherPermission | string | 是 | 否 | 表示发布者的权限。 | -| publisherDeviceId | string | 是 | 否 | 表示设备ID,该值必须是同一ohos网络上的现有设备ID。 | -| userId | number | 是 | 否 | 表示用户ID。此参数是可选的,默认值当前用户的ID。如果指定了此参数,则该值必须是系统中现有的用户ID。 | -| priority | number | 是 | 否 | 表示订阅者的优先级。值的范围是-100到1000。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-contact.md b/zh-cn/application-dev/reference/apis/js-apis-contact.md index 2b5bd4d18cf77bb4846081db199fab89cfe2603b..89ce7fd4540d84e2c5852d7b0ace78963fc6a30c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-contact.md +++ b/zh-cn/application-dev/reference/apis/js-apis-contact.md @@ -488,8 +488,6 @@ selectContact(callback: AsyncCallback<Array<Contact>>): void 选择联系人,使用callback方式作为异步方法。 -**需要权限**:ohos.permission.READ_CONTACTS - **系统能力**:SystemCapability.Applications.Contacts **参数:** @@ -517,8 +515,6 @@ selectContact(): Promise<Array<Contact>> 选择联系人,使用Promise方式作为异步方法。 -**需要权限**:ohos.permission.READ_CONTACTS - **系统能力**:SystemCapability.Applications.Contacts **返回值:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-cryptoFramework.md b/zh-cn/application-dev/reference/apis/js-apis-cryptoFramework.md index ba5f0890e965eae69492c42dfc7014a059c85161..0c80adbe729fabcdff44ca7009521f8963eb2820 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-cryptoFramework.md +++ b/zh-cn/application-dev/reference/apis/js-apis-cryptoFramework.md @@ -2217,6 +2217,8 @@ sign(data : DataBlob) : Promise\ | -------------- | ----------- | | Promise\ | Promise对象 | +**错误码:** + | 错误码ID | 错误信息 | | -------- | ---------------------- | | 17620001 | memory error. | diff --git a/zh-cn/application-dev/reference/apis/js-apis-curve.md b/zh-cn/application-dev/reference/apis/js-apis-curve.md index 51af65f7cc9437fb90a1156ce33f1492008788a9..834ff5f9bcddbcf774371f593e1fcd2934bc4202 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-curve.md +++ b/zh-cn/application-dev/reference/apis/js-apis-curve.md @@ -35,7 +35,6 @@ initCurve(curve?: Curve):ICurve | ---------------------------------- | ---------------- | | [ICurve](#icurve) | 曲线的插值对象。 | - **示例:** ```ts @@ -57,7 +56,7 @@ stepsCurve(count: number, end: boolean):ICurve | 参数名 | 类型 | 必填 | 说明 | | ------ | ------- | ----| ------------------------------------------------------------ | -| count | number | 是 | 阶梯的数量,需要为正整数。 | +| count | number | 是 | 阶梯的数量,需要为正整数。
取值范围:[0, +∞)
**说明:**
设置小于0的值时,按值为0处理。 | | end | boolean | 是 | 在每个间隔的起点或是终点发生阶跃变化。
-true:在终点发生阶跃变化。
-false:在起点发生阶跃变化。 | **返回值:** @@ -66,7 +65,6 @@ stepsCurve(count: number, end: boolean):ICurve | ---------------------------------- | ---------------- | | [ICurve](#icurve) | 曲线的插值对象。 | - **示例:** ```ts @@ -85,12 +83,13 @@ cubicBezierCurve(x1: number, y1: number, x2: number, y2: number):ICurve **系统能力:** SystemCapability.ArkUI.ArkUI.Full **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ---- | ------ | ---- | -------------- | -| x1 | number | 是 | 确定贝塞尔曲线第一点横坐标。 | -| y1 | number | 是 | 确定贝塞尔曲线第一点纵坐标。 | -| x2 | number | 是 | 确定贝塞尔曲线第二点横坐标。 | -| y2 | number | 是 | 确定贝塞尔曲线第二点纵坐标。 | + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------------------------------------------------------------ | +| x1 | number | 是 | 确定贝塞尔曲线第一点横坐标。
取值范围:[0, 1]
**说明:**
设置的值小于0时,按0处理;设置的值大于1时,按1处理。 | +| y1 | number | 是 | 确定贝塞尔曲线第一点纵坐标。
取值范围:(-∞, +∞) | +| x2 | number | 是 | 确定贝塞尔曲线第二点横坐标。
取值范围:[0, 1]
**说明:**
设置的值小于0时,按0处理;设置的值大于1时,按1处理。 | +| y2 | number | 是 | 确定贝塞尔曲线第二点纵坐标。
取值范围:(-∞, +∞) | **返回值:** @@ -112,17 +111,17 @@ Curves.cubicBezierCurve(0.1, 0.0, 0.1, 1.0) // 创建一个三阶贝塞尔曲线 springCurve(velocity: number, mass: number, stiffness: number, damping: number):ICurve -构造弹簧曲线对象。 +构造弹簧曲线对象,曲线形状由弹簧参数决定,动画时长受animation、animateTo中的duration参数控制。 **系统能力:** SystemCapability.ArkUI.ArkUI.Full **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| --------- | ------ | ---- | ----- | -| velocity | number | 是 | 初始速度。是由外部因素对弹性动效产生的影响参数,其目的是保证对象从之前的运动状态平滑的过渡到弹性动效。 | -| mass | number | 是 | 质量。弹性系统的受力对象,会对弹性系统产生惯性影响。质量越大,震荡的幅度越大,恢复到平衡位置的速度越慢。 | -| stiffness | number | 是 | 刚度。是物体抵抗施加的力而形变的程度。在弹性系统中,刚度越大,抵抗变形的能力越强,恢复到平衡位置的速度就越快。 | -| damping | number | 是 | 阻尼。是一个纯数,无真实的物理意义,用于描述系统在受到扰动后震荡及衰减的情形。阻尼越大,弹性运动的震荡次数越少、震荡幅度越小。 | +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------ | ---- | ------------------------------------------------------------ | +| velocity | number | 是 | 初始速度。是由外部因素对弹性动效产生的影响参数,其目的是保证对象从之前的运动状态平滑的过渡到弹性动效。
取值范围:(-∞, +∞) | +| mass | number | 是 | 质量。弹性系统的受力对象,会对弹性系统产生惯性影响。质量越大,震荡的幅度越大,恢复到平衡位置的速度越慢。
取值范围:(0, +∞)
**说明:**
设置的值小于0时,按1处理。 | +| stiffness | number | 是 | 刚度。是物体抵抗施加的力而形变的程度。在弹性系统中,刚度越大,抵抗变形的能力越强,恢复到平衡位置的速度就越快。
取值范围:(0, +∞)
**说明:**
设置的值小于0时,按1处理。 | +| damping | number | 是 | 阻尼。是一个纯数,无真实的物理意义,用于描述系统在受到扰动后震荡及衰减的情形。阻尼越大,弹性运动的震荡次数越少、震荡幅度越小。
取值范围:(0, +∞)
**说明:**
设置的值小于0时,按1处理。 | **返回值:** @@ -149,18 +148,19 @@ springMotion(response?: number, dampingFraction?: number, overlapDuration?: numb **系统能力:** SystemCapability.ArkUI.ArkUI.Full **参数:** + | 参数名 | 类型 | 必填 | 说明 | | --------- | ------ | ---- | ----- | -| response | number | 否 | 弹簧自然振动周期,决定弹簧复位的速度。单位:秒,默认值:0.55。 | -| dampingFraction | number | 否 | 阻尼系数。
0表示无阻尼,一直处于震荡状态;
大于0小于1的值为欠阻尼,运动过程中会超出目标值;
等于1为临界阻尼;
大于1为过阻尼,运动过程中逐渐趋于目标值。
默认值:0.825。 | -| overlapDuration | number | 否 | 弹性动画衔接时长。发生动画继承时,如果前后两个弹性动画response不一致,response参数会在overlapDuration时间内平滑过渡。单位:秒,默认值:0。 | +| response | number | 否 | 弹簧自然振动周期,决定弹簧复位的速度。
默认值:0.55
单位:秒
取值范围:[0, +∞)
**说明:**
设置小于0的值时,按默认值0.55处理。 | +| dampingFraction | number | 否 | 阻尼系数。
0表示无阻尼,一直处于震荡状态;
大于0小于1的值为欠阻尼,运动过程中会超出目标值;
等于1为临界阻尼;
大于1为过阻尼,运动过程中逐渐趋于目标值。
默认值:0.825
单位:秒
取值范围:[0, +∞)
**说明:**
设置小于0的值时,按默认值0.55处理。 | +| overlapDuration | number | 否 | 弹性动画衔接时长。发生动画继承时,如果前后两个弹性动画response不一致,response参数会在overlapDuration时间内平滑过渡。
默认值:0
单位:秒
取值范围:[0, +∞)。
**说明:**
设置小于0的值时,按默认值0处理。
弹性动画曲线为物理曲线,[animation](../arkui-ts/ts-animatorproperty.md)、[animateTo](../arkui-ts/ts-explicit-animation.md)中的duration参数不生效,动画持续时间取决于springMotion动画曲线参数和之前的速度。时间不能归一,故不能通过该曲线的interpolate函数获得插值。 | **返回值:** | 类型 | 说明 | | ---------------------------------- | ---------------- | -| [ICurve](#icurve)| 曲线对象。
**说明:** 弹性动画曲线为物理曲线,animation、animateTo中的duration参数不生效,动画持续时间取决于springMotion动画曲线参数和之前的速度。时间不能归一,故不能通过该曲线的[interpolate](#interpolate)函数获得插值。 | +| [ICurve](#icurve)| 曲线对象。
**说明:** 弹性动画曲线为物理曲线,[animation](../arkui-ts/ts-animatorproperty.md)、[animateTo](../arkui-ts/ts-explicit-animation.md)中的duration参数不生效,动画持续时间取决于springMotion动画曲线参数和之前的速度。时间不能归一,故不能通过该曲线的[interpolate](#interpolate)函数获得插值。 | **示例:** @@ -182,17 +182,18 @@ responsiveSpringMotion(response?: number, dampingFraction?: number, overlapDurat **系统能力:** SystemCapability.ArkUI.ArkUI.Full **参数:** + | 参数名 | 类型 | 必填 | 说明 | | --------- | ------ | ---- | ----- | -| response | number | 否 | 解释同springMotion中的response。单位:秒,默认值:0.15。 | -| dampingFraction | number | 否 | 解释同springMotion中的dampingFraction。默认值:0.86。 | -| overlapDuration | number | 否 | 解释同springMotion中的overlapDuration。单位:秒,默认值:0.25。 | +| response | number | 否 | 解释同springMotion中的response。
默认值:0.15
单位:秒
取值范围:[0, +∞)
**说明:**
设置小于0的值时,按默认值0.15处理。 | +| dampingFraction | number | 否 | 解释同springMotion中的dampingFraction。
默认值:0.86
单位:秒
取值范围:[0, +∞)
**说明:**
设置小于0的值时,按默认值0.86处理。 | +| overlapDuration | number | 否 | 解释同springMotion中的overlapDuration。
默认值:0.25
单位:秒
取值范围:[0, +∞)
**说明:**
设置小于0的值时,按默认值0.25处理。
弹性跟手动画曲线为springMotion的一种特例,仅默认值不同。如果使用自定义参数的弹性曲线,推荐使用springMotion构造曲线。如果使用跟手动画,推荐使用默认参数的弹性跟手动画曲线。
[animation](../arkui-ts/ts-animatorproperty.md)、[animateTo](../arkui-ts/ts-explicit-animation.md)中的duration参数不生效,动画持续时间取决于responsiveSpringMotion动画曲线参数和之前的速度,也不能通过该曲线的interpolate函数获得插值。 | **返回值:** | 类型 | 说明 | | ---------------------------------- | ---------------- | -| [ICurve](#icurve)| 曲线对象。
**说明:**
1.弹性跟手动画曲线为springMotion的一种特例,仅默认值不同。如果使用自定义参数的弹性曲线,推荐使用springMotion构造曲线;如果使用跟手动画,推荐使用默认参数的弹性跟手动画曲线。
2.animation、animateTo中的duration参数不生效,动画持续时间取决于responsiveSpringMotion动画曲线参数和之前的速度,也不能通过该曲线的[interpolate](#interpolate)函数获得插值。 | +| [ICurve](#icurve)| 曲线对象。
**说明:**
1、弹性跟手动画曲线为springMotion的一种特例,仅默认值不同。如果使用自定义参数的弹性曲线,推荐使用springMotion构造曲线;如果使用跟手动画,推荐使用默认参数的弹性跟手动画曲线。
2、[animation](../arkui-ts/ts-animatorproperty.md)、[animateTo](../arkui-ts/ts-explicit-animation.md)中的duration参数不生效,动画持续时间取决于responsiveSpringMotion动画曲线参数和之前的速度,也不能通过该曲线的[interpolate](#interpolate)函数获得插值。 | **示例:** @@ -202,6 +203,39 @@ Curves.responsiveSpringMotion() // 创建一个默认弹性跟手动画曲线 ``` +##  Curves.interpolatingSpringCurve10+ + +interpolatingSpring(velocity: number, mass: number, stiffness: number, damping: number):ICurve + + +构造插值器弹簧曲线对象,生成一条从0到1的动画曲线,实际动画值根据曲线进行插值计算。动画时间由曲线参数决定,不受animation、animateTo中的duration参数控制。 + +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + +**参数:** +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------ | ---- | ----- | +| velocity | number | 是 | 初始速度。外部因素对弹性动效产生的影响参数,目的是保证对象从之前的运动状态平滑的过渡到弹性动效。该速度是归一化速度,其值等于动画开始时的实际速度除以动画属性改变值。 | +| mass | number | 是 | 质量。弹性系统的受力对象,会对弹性系统产生惯性影响。质量越大,震荡的幅度越大,恢复到平衡位置的速度越慢。 | +| stiffness | number | 是 | 刚度。表示物体抵抗施加的力而形变的程度。刚度越大,抵抗变形的能力越强,恢复到平衡位置的速度越快。 | +| damping | number | 是 | 阻尼。是一个纯数,无真实的物理意义,用于描述系统在受到扰动后震荡及衰减的情形。阻尼越大,弹性运动的震荡次数越少、震荡幅度越小。 | + + +**返回值:** + +| 类型 | 说明 | +| ---------------------------------- | ---------------- | +| [ICurve](#icurve)| 曲线的插值对象。 | + + +**示例:** + +```ts +import Curves from '@ohos.curves' +Curves.interpolatingSpring(100, 1, 228, 30) // 创建一个时长由弹簧参数决定的弹簧插值曲线 +``` + + ## ICurve @@ -209,16 +243,17 @@ Curves.responsiveSpringMotion() // 创建一个默认弹性跟手动画曲线 interpolate(fraction: number): number - 插值曲线的插值计算函数,可以通过传入的归一化时间参数返回当前的插值 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **系统能力:** SystemCapability.ArkUI.ArkUI.Full **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------ | ---- | -------------------------------------------- | -| fraction | number | 是 |  当前的归一化时间参数,有效值范围0到1。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ------------------------------------------------------------ | +| fraction | number | 是 | 当前的归一化时间参数。
取值范围:[0,1]
**说明:**
设置的值小于0时,按0处理;设置的值大于1时,按1处理。 | **返回值:** 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 ed4f92d1a9be2d6cc4e64927eb53c8a5d3fd031c..04aae056fea5fb52d08ffe5d45dabb193c60e44e 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 @@ -46,7 +46,7 @@ createDataShareHelper(context: Context, uri: string, callback: AsyncCallback< 使用规则: - 调用方应用位于后台时,使用该接口访问DataShareExtension需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限 - - 跨应用场景下,目标DataShareExtension的visible属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 + - 跨应用场景下,目标DataShareExtension的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md) **系统能力:** SystemCapability.DistributedDataManager.DataShare.Consumer @@ -96,7 +96,7 @@ createDataShareHelper(context: Context, uri: string): Promise<DataShareHelper 使用规则: - 调用方应用位于后台时,使用该接口访问DataShareExtension需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限 - - 跨应用场景下,目标DataShareExtension的visible属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 + - 跨应用场景下,目标DataShareExtension的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md) **系统能力:** SystemCapability.DistributedDataManager.DataShare.Consumer 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 5af7eba6884396c0f309b3b2b74106f3b6d6c780..a44d2d568b7c9e8f202b5318cb9d869a3da953f0 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 @@ -363,7 +363,12 @@ save(deviceId: string, callback: AsyncCallback<SaveSuccessResponse>): void ```ts g_object.setSessionId("123456"); -g_object.save("local", (result) => { +g_object.save("local", (err, result) => { + if (err) { + console.info("save failed, error code = " + err.code); + console.info("save failed, error message: " + err.message); + return; + } console.info("save callback"); console.info("save sessionId: " + result.sessionId); console.info("save version: " + result.version); @@ -408,8 +413,9 @@ g_object.save("local").then((result) => { console.info("save sessionId " + result.sessionId); console.info("save version " + result.version); console.info("save deviceId " + result.deviceId); -}, () => { - console.error("save failed"); +}).catch((err) => { + console.info("save failed, error code = " + err.code); + console.info("save failed, error message: " + err.message); }); ``` @@ -435,16 +441,26 @@ revokeSave(callback: AsyncCallback<RevokeSaveSuccessResponse>): void ```js g_object.setSessionId("123456"); // 持久化数据 -g_object.save("local", (result) => { +g_object.save("local", (err, result) => { + if (err) { + console.info("save failed, error code = " + err.code); + console.info("save failed, error message: " + err.message); + return; + } console.info("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); }); // 删除持久化保存的数据 -g_object.revokeSave((result) => { - console.info("revokeSave callback"); - console.info("revokeSave sessionId " + result.sessionId); +g_object.revokeSave((err, result) => { + if (err) { + console.info("revokeSave failed, error code = " + err.code); + console.info("revokeSave failed, error message: " + err.message); + return; + } + console.info("revokeSave callback"); + console.info("revokeSave sessionId " + result.sessionId); }); ``` @@ -475,15 +491,17 @@ g_object.save("local").then((result) => { console.info("save sessionId " + result.sessionId); console.info("save version " + result.version); console.info("save deviceId " + result.deviceId); -}, () => { - console.error("save failed"); +}).catch((err) => { + console.info("save failed, error code = " + err.code); + console.info("save failed, error message: " + err.message); }); // 删除持久化保存的数据 g_object.revokeSave().then((result) => { console.info("revokeSave callback"); console.info("sessionId" + result.sessionId); -}, () => { - console.error("revokeSave failed"); +}).catch((err)=> { + console.info("revokeSave failed, error code = " + err.code); + console.info("revokeSave failed, error message = " + err.message); }); ``` @@ -583,7 +601,7 @@ on(type: 'change', callback: Callback<{ sessionId: string, fields: Array<stri **示例:** ```js -import distributedObject from '@ohos.data.distributedDataObject'; +import distributedObject from '@ohos.data.distributedDataObject'; let 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); @@ -619,7 +637,7 @@ off(type: 'change', callback?: Callback<{ sessionId: string, fields: Array<st **示例:** ```js -import distributedObject from '@ohos.data.distributedDataObject'; +import distributedObject from '@ohos.data.distributedDataObject'; let g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}}); // 删除数据变更回调changeCallback g_object.off("change", globalThis.changeCallback); @@ -680,7 +698,7 @@ off(type: 'status', callback?: Callback<{ sessionId: string, deviceId: string, s **示例:** ```js -import distributedObject from '@ohos.data.distributedDataObject'; +import distributedObject from '@ohos.data.distributedDataObject'; let 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; diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-preferences.md b/zh-cn/application-dev/reference/apis/js-apis-data-preferences.md index d9bfa5e2d38b3a99cbeaeca7ad3d9084ec824899..9a04bf1a637f946b66b86b054b007a8612bdecc7 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-preferences.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-preferences.md @@ -1,6 +1,6 @@ -# @ohos.data.preferences (首选项) +# @ohos.data.preferences (用户首选项) -首选项为应用提供Key-Value键值型的数据处理能力,支持应用持久化轻量级数据,并对其修改和查询。 +用户首选项为应用提供Key-Value键值型的数据处理能力,支持应用持久化轻量级数据,并对其修改和查询。 数据存储形式为键值对,键的类型为字符串型,值的存储数据类型包括数字型、字符型、布尔型以及这3种类型的数组类型。 @@ -181,7 +181,7 @@ deletePreferences(context: Context, name: string, callback: AsyncCallback<voi **错误码:** -以下错误码的详细介绍请参见[首选项错误码](../errorcodes/errorcode-preferences.md)。 +以下错误码的详细介绍请参见[用户首选项错误码](../errorcodes/errorcode-preferences.md)。 | 错误码ID | 错误信息 | | -------- | ------------------------------| @@ -258,7 +258,7 @@ deletePreferences(context: Context, name: string): Promise<void> **错误码:** -以下错误码的详细介绍请参见[首选项错误码](../errorcodes/errorcode-preferences.md)。 +以下错误码的详细介绍请参见[用户首选项错误码](../errorcodes/errorcode-preferences.md)。 | 错误码ID | 错误信息 | | -------- | ------------------------------| @@ -792,7 +792,7 @@ try { flush(callback: AsyncCallback<void>): void -将当前Preferences实例的数据异步存储到首选项持久化文件中,使用callback异步回调。 +将当前Preferences实例的数据异步存储到用户首选项的持久化文件中,使用callback异步回调。 **系统能力:** SystemCapability.DistributedDataManager.Preferences.Core @@ -823,7 +823,7 @@ try { flush(): Promise<void> -将当前Preferences实例的数据异步存储到首选项持久化文件中,使用Promise异步回调。 +将当前Preferences实例的数据异步存储到用户首选项的持久化文件中,使用Promise异步回调。 **系统能力:** SystemCapability.DistributedDataManager.Preferences.Core 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 28ab08ee63ca43fe7e34fce781ee3ba8282241b3..2bfde00332f7b2fdd874f0952a6d881d95b90a44 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 @@ -1,6 +1,6 @@ # @ohos.data.rdb (关系型数据库) -关系型数据库(Relational Database,RDB)是一种基于关系模型来管理数据的数据库。关系型数据库基于SQLite组件提供了一套完整的对本地数据库进行管理的机制,对外提供了一系列的增、删、改、查等接口,也可以直接运行用户输入的SQL语句来满足复杂的场景需要。 +关系型数据库(Relational Database,RDB)是一种基于关系模型来管理数据的数据库。关系型数据库基于SQLite组件提供了一套完整的对本地数据库进行管理的机制,对外提供了一系列的增、删、改、查等接口,也可以直接运行用户输入的SQL语句来满足复杂的场景需要。不支持Worker线程。 该模块提供以下关系型数据库相关的常用功能: @@ -31,7 +31,7 @@ getRdbStore(context: Context, config: StoreConfig, version: number, callback: As | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------ | ---- | ------------------------------------------------------------ | -| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 | +| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-app-context.md)。 | | config | [StoreConfig](#storeconfig) | 是 | 与此RDB存储相关的数据库配置。 | | version | number | 是 | 数据库版本。
目前暂不支持通过version自动识别数据库升级降级操作,只能由开发者自行维护。 | | callback | AsyncCallback<[RdbStore](#rdbstore)> | 是 | 指定callback回调函数,返回RdbStore对象。 | @@ -92,7 +92,7 @@ getRdbStore(context: Context, config: StoreConfig, version: number): Promise< | 参数名 | 类型 | 必填 | 说明 | | ------- | --------------------------- | ---- | ------------------------------------------------------------ | -| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 | +| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-app-context.md)。 | | config | [StoreConfig](#storeconfig) | 是 | 与此RDB存储相关的数据库配置。 | | version | number | 是 | 数据库版本。
目前暂不支持通过version自动识别数据库升级降级操作,只能由开发者自行维护。 | @@ -156,7 +156,7 @@ deleteRdbStore(context: Context, name: string, callback: AsyncCallback<void&g | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ------------------------------------------------------------ | -| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 | +| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-app-context.md)。 | | name | string | 是 | 数据库名称。 | | callback | AsyncCallback<void> | 是 | 指定callback回调函数。 | @@ -214,7 +214,7 @@ deleteRdbStore(context: Context, name: string): Promise<void> | 参数名 | 类型 | 必填 | 说明 | | ------- | ------- | ---- | ------------------------------------------------------------ | -| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 | +| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-app-context.md)。 | | name | string | 是 | 数据库名称。 | **返回值**: @@ -349,6 +349,10 @@ inDevices(devices: Array<string>): RdbPredicates 同步分布式数据库时连接到组网内指定的远程设备。 +> **说明:** +> +> 其中devices通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 + **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core **参数:** @@ -366,8 +370,24 @@ inDevices(devices: Array<string>): RdbPredicates **示例:** ```js -let predicates = new data_rdb.RdbPredicates("EMPLOYEE") -predicates.inDevices(['12345678abcde']) +import deviceManager from '@ohos.distributedHardware.deviceManager'; +let dmInstance = null; +let deviceIds = []; + +deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => { + if (err) { + console.log("create device manager failed, err=" + err); + return; + } + dmInstance = manager; + let devices = dmInstance.getTrustedDeviceListSync(); + for (var i = 0; i < devices.length; i++) { + deviceIds[i] = devices[i].deviceId; + } +}) + +let predicates = new data_rdb.RdbPredicates("EMPLOYEE"); +predicates.inDevices(deviceIds); ``` ### inAllDevices8+ @@ -1154,7 +1174,7 @@ predicates.notIn("NAME", ["Lisa", "Rose"]) 提供管理关系数据库(RDB)方法的接口。 -在使用以下相关接口前,请使用[executeSql](#executesql8)接口初始化数据库表结构和相关数据,具体可见[关系型数据库开发指导](../../database/database-relational-guidelines.md)。 +在使用以下相关接口前,请使用[executeSql](#executesql8)接口初始化数据库表结构和相关数据。 ### insert @@ -1545,7 +1565,7 @@ querySql(sql: string, bindArgs: Array<ValueType>, callback: AsyncCallback& | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | sql | string | 是 | 指定要执行的SQL语句。 | -| bindArgs | Array<[ValueType](#valuetype)> | 是 | SQL语句中参数的值。 | +| bindArgs | Array<[ValueType](#valuetype)> | 是 | SQL语句中参数的值。该值与sql参数语句中的占位符相对应。当sql参数语句完整时,该参数需为空数组。 | | callback | AsyncCallback<[ResultSet](js-apis-data-resultset.md)> | 是 | 指定callback回调函数。如果操作成功,则返回ResultSet对象。 | **示例:** @@ -1574,7 +1594,7 @@ querySql(sql: string, bindArgs?: Array<ValueType>):Promise<ResultSet> | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | sql | string | 是 | 指定要执行的SQL语句。 | -| bindArgs | Array<[ValueType](#valuetype)> | 否 | SQL语句中参数的值。 | +| bindArgs | Array<[ValueType](#valuetype)> | 否 | SQL语句中参数的值。该值与sql参数语句中的占位符相对应。当sql参数语句完整时,该参数不填。 | **返回值**: @@ -1585,7 +1605,7 @@ querySql(sql: string, bindArgs?: Array<ValueType>):Promise<ResultSet> **示例:** ```js -let promise = rdbStore.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = ?", ['sanguo']) +let promise = rdbStore.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = 'sanguo'") promise.then((resultSet) => { console.log("ResultSet column names: " + resultSet.columnNames) console.log("ResultSet column count: " + resultSet.columnCount) @@ -1607,19 +1627,19 @@ executeSql(sql: string, bindArgs: Array<ValueType>, callback: AsyncCallbac | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | sql | string | 是 | 指定要执行的SQL语句。 | -| bindArgs | Array<[ValueType](#valuetype)> | 是 | SQL语句中参数的值。 | +| bindArgs | Array<[ValueType](#valuetype)> | 是 | SQL语句中参数的值。该值与sql参数语句中的占位符相对应。当sql参数语句完整时,该参数需为空数组。 | | callback | AsyncCallback<void> | 是 | 指定callback回调函数。 | **示例:** ```js -const SQL_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS EMPLOYEE (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL, AGE INTEGER, SALARY REAL, CODES BLOB)" -rdbStore.executeSql(SQL_CREATE_TABLE, null, function(err) { +const SQL_DELETE_TABLE = "DELETE FROM test WHERE name = ?" +rdbStore.executeSql(SQL_CREATE_TABLE, ['zhangsan'], function(err) { if (err) { console.info("ExecuteSql failed, err: " + err) return } - console.info('Create table done.') + console.info('Delete table done.') }) ``` @@ -1636,7 +1656,7 @@ executeSql(sql: string, bindArgs?: Array<ValueType>):Promise<void> | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | sql | string | 是 | 指定要执行的SQL语句。 | -| bindArgs | Array<[ValueType](#valuetype)> | 否 | SQL语句中参数的值。 | +| bindArgs | Array<[ValueType](#valuetype)> | 否 | SQL语句中参数的值。该值与sql参数语句中的占位符相对应。当sql参数语句完整时,该参数不填。 | **返回值**: @@ -1647,10 +1667,10 @@ executeSql(sql: string, bindArgs?: Array<ValueType>):Promise<void> **示例:** ```js -const SQL_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS EMPLOYEE (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL, AGE INTEGER, SALARY REAL, CODES BLOB)" -let promise = rdbStore.executeSql(SQL_CREATE_TABLE) +const SQL_DELETE_TABLE = "DELETE FROM test WHERE name = 'zhangsan'" +let promise = rdbStore.executeSql(SQL_DELETE_TABLE) promise.then(() => { - console.info('Create table done.') + console.info('Delete table done.') }).catch((err) => { console.info("ExecuteSql failed, err: " + err) }) @@ -1808,7 +1828,11 @@ promise.then(() => { obtainDistributedTableName(device: string, table: string, callback: AsyncCallback<string>): void -根据本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名, 使用callback异步回调。 +根据远程设备的本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名, 使用callback异步回调。 + +> **说明:** +> +> 其中device通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 **需要权限:** ohos.permission.DISTRIBUTED_DATASYNC @@ -1818,14 +1842,29 @@ obtainDistributedTableName(device: string, table: string, callback: AsyncCallbac | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| device | string | 是 | 远程设备 。| -| table | string | 是 | 本地表名。 | +| device | string | 是 | 远程设备ID 。 | +| table | string | 是 | 远程设备的本地表名 | | callback | AsyncCallback<string> | 是 | 指定的callback回调函数。如果操作成功,返回远程设备的分布式表名。 | **示例:** ```js -rdbStore.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err, tableName) { +import deviceManager from '@ohos.distributedHardware.deviceManager'; +let dmInstance = null; +let deviceId = null; + +deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => { + if (err) { + console.log("create device manager failed, err=" + err); + return; + } + dmInstance = manager; + let devices = dmInstance.getTrustedDeviceListSync(); + deviceId = devices[0].deviceId; +}) + + +rdbStore.obtainDistributedTableName(deviceId, "EMPLOYEE", function (err, tableName) { if (err) { console.info('ObtainDistributedTableName failed, err: ' + err) return @@ -1838,7 +1877,11 @@ rdbStore.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err, obtainDistributedTableName(device: string, table: string): Promise<string> -根据本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名,使用Promise异步回调。 +根据远程设备的本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名,使用Promise异步回调。 + +> **说明:** +> +> 其中device通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 **需要权限:** ohos.permission.DISTRIBUTED_DATASYNC @@ -1848,8 +1891,8 @@ rdbStore.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err, | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| device | string | 是 | 远程设备。 | -| table | string | 是 | 本地表名。 | +| device | string | 是 | 远程设备ID。 | +| table | string | 是 | 远程设备的本地表名。 | **返回值**: @@ -1860,7 +1903,21 @@ rdbStore.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err, **示例:** ```js -let promise = rdbStore.obtainDistributedTableName("12345678abcde", "EMPLOYEE") +import deviceManager from '@ohos.distributedHardware.deviceManager'; +let dmInstance = null; +let deviceId = null; + +deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => { + if (err) { + console.log("create device manager failed, err=" + err); + return; + } + dmInstance = manager; + let devices = dmInstance.getTrustedDeviceListSync(); + deviceId = devices[0].deviceId; +}) + +let promise = rdbStore.obtainDistributedTableName(deviceId, "EMPLOYEE") promise.then((tableName) => { console.info('ObtainDistributedTableName successfully, tableName= ' + tableName) }).catch((err) => { @@ -1889,8 +1946,24 @@ sync(mode: SyncMode, predicates: RdbPredicates, callback: AsyncCallback<Array **示例:** ```js +import deviceManager from '@ohos.distributedHardware.deviceManager'; +let dmInstance = null; +let deviceIds = []; + +deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => { + if (err) { + console.log("create device manager failed, err=" + err); + return; + } + dmInstance = manager; + let devices = dmInstance.getTrustedDeviceListSync(); + for (var i = 0; i < devices.length; i++) { + deviceIds[i] = devices[i].deviceId; + } +}) + let predicates = new data_rdb.RdbPredicates('EMPLOYEE') -predicates.inDevices(['12345678abcde']) +predicates.inDevices(deviceIds) rdbStore.sync(data_rdb.SyncMode.SYNC_MODE_PUSH, predicates, function (err, result) { if (err) { console.log('Sync failed, err: ' + err) @@ -1929,8 +2002,24 @@ rdbStore.sync(data_rdb.SyncMode.SYNC_MODE_PUSH, predicates, function (err, resul **示例:** ```js +import deviceManager from '@ohos.distributedHardware.deviceManager'; +let dmInstance = null; +let deviceIds = []; + +deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => { + if (err) { + console.log("create device manager failed, err=" + err); + return; + } + dmInstance = manager; + let devices = dmInstance.getTrustedDeviceListSync(); + for (var i = 0; i < devices.length; i++) { + deviceIds[i] = devices[i].deviceId; + } +}) + let predicates = new data_rdb.RdbPredicates('EMPLOYEE') -predicates.inDevices(['12345678abcde']) +predicates.inDevices(deviceIds) let promise = rdbStore.sync(data_rdb.SyncMode.SYNC_MODE_PUSH, predicates) promise.then((result) =>{ console.log('Sync done.') diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-relationalStore.md b/zh-cn/application-dev/reference/apis/js-apis-data-relationalStore.md index 4c94720c13746c8a1ff26203755b29a34106a649..2d2878af51802db8abdead3b6cad268eb3412434 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-data-relationalStore.md +++ b/zh-cn/application-dev/reference/apis/js-apis-data-relationalStore.md @@ -1,12 +1,12 @@ # @ohos.data.relationalStore (关系型数据库) -关系型数据库(Relational Database,RDB)是一种基于关系模型来管理数据的数据库。关系型数据库基于SQLite组件提供了一套完整的对本地数据库进行管理的机制,对外提供了一系列的增、删、改、查等接口,也可以直接运行用户输入的SQL语句来满足复杂的场景需要。 +关系型数据库(Relational Database,RDB)是一种基于关系模型来管理数据的数据库。关系型数据库基于SQLite组件提供了一套完整的对本地数据库进行管理的机制,对外提供了一系列的增、删、改、查等接口,也可以直接运行用户输入的SQL语句来满足复杂的场景需要。不支持Worker线程。 该模块提供以下关系型数据库相关的常用功能: - [RdbPredicates](#rdbpredicates): 数据库中用来代表数据实体的性质、特征或者数据实体之间关系的词项,主要用来定义数据库的操作条件。 - [RdbStore](#rdbstore):提供管理关系数据库(RDB)方法的接口。 -- [Resultset](#resultset):提供用户调用关系型数据库查询接口之后返回的结果集合。 +- [ResultSet](#resultset):提供用户调用关系型数据库查询接口之后返回的结果集合。 > **说明:** > @@ -30,7 +30,7 @@ getRdbStore(context: Context, config: StoreConfig, callback: AsyncCallback<Rd | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------------------------- | ---- | ------------------------------------------------------------ | -| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 | +| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-application-uiAbilityContext.md)。 | | config | [StoreConfig](#storeconfig) | 是 | 与此RDB存储相关的数据库配置。 | | callback | AsyncCallback<[RdbStore](#rdbstore)> | 是 | 指定callback回调函数,返回RdbStore对象。 | @@ -108,7 +108,7 @@ getRdbStore(context: Context, config: StoreConfig): Promise<RdbStore> | 参数名 | 类型 | 必填 | 说明 | | ------- | -------------------------------- | ---- | ------------------------------------------------------------ | -| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 | +| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-application-uiAbilityContext.md)。 | | config | [StoreConfig](#storeconfig) | 是 | 与此RDB存储相关的数据库配置。 | **返回值**: @@ -188,7 +188,7 @@ deleteRdbStore(context: Context, name: string, callback: AsyncCallback<void&g | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ------------------------------------------------------------ | -| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 | +| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-application-uiAbilityContext.md)。 | | name | string | 是 | 数据库名称。 | | callback | AsyncCallback<void> | 是 | 指定callback回调函数。 | @@ -249,7 +249,7 @@ deleteRdbStore(context: Context, name: string): Promise<void> | 参数名 | 类型 | 必填 | 说明 | | ------- | ------- | ---- | ------------------------------------------------------------ | -| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 | +| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-application-uiAbilityContext.md)。 | | name | string | 是 | 数据库名称。 | **返回值**: @@ -317,6 +317,10 @@ class EntryAbility extends UIAbility { 数据库的安全级别枚举。 +> **说明:** +> +> 若需要进行同步操作,数据库安全等级应不高于对端设备安全等级,具体可见[跨设备同步访问控制机制](../../database/sync-app-data-across-devices-overview.md#跨设备同步访问控制机制)。 + **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core | 名称 | 值 | 说明 | @@ -414,9 +418,12 @@ let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); inDevices(devices: Array<string>): RdbPredicates - 同步分布式数据库时连接到组网内指定的远程设备。 +> **说明:** +> +> 其中devices通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 + **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core **参数:** @@ -434,8 +441,24 @@ inDevices(devices: Array<string>): RdbPredicates **示例:** ```js +import deviceManager from '@ohos.distributedHardware.deviceManager'; +let dmInstance = null; +let deviceIds = []; + +deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => { + if (err) { + console.log("create device manager failed, err=" + err); + return; + } + dmInstance = manager; + let devices = dmInstance.getTrustedDeviceListSync(); + for (var i = 0; i < devices.length; i++) { + deviceIds[i] = devices[i].deviceId; + } +}) + let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); -predicates.inDevices(['12345678abcde']); +predicates.inDevices(deviceIds); ``` ### inAllDevices @@ -1227,7 +1250,7 @@ predicates.notIn("NAME", ["Lisa", "Rose"]); 提供管理关系数据库(RDB)方法的接口。 -在使用以下相关接口前,请使用[executeSql](#executesql)接口初始化数据库表结构和相关数据,具体可见[关系型数据库开发指导](../../database/database-relational-guidelines.md)。 +在使用以下相关接口前,请使用[executeSql](#executesql)接口初始化数据库表结构和相关数据。 ### 属性10+ @@ -1262,6 +1285,14 @@ insert(table: string, values: ValuesBucket, callback: AsyncCallback<number> | values | [ValuesBucket](#valuesbucket) | 是 | 表示要插入到表中的数据行。 | | callback | AsyncCallback<number> | 是 | 指定callback回调函数。如果操作成功,返回行ID;否则返回-1。 | +**错误码:** + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **示例:** ```js @@ -1297,6 +1328,14 @@ insert(table: string, values: ValuesBucket, conflict: ConflictResolution, callb | conflict | [ConflictResolution](#conflictresolution10) | 是 | 指定冲突解决方式。 | | callback | AsyncCallback<number> | 是 | 指定callback回调函数。如果操作成功,返回行ID;否则返回-1。 | +**错误码:** + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **示例:** ```js @@ -1336,6 +1375,14 @@ insert(table: string, values: ValuesBucket):Promise<number> | --------------------- | ------------------------------------------------- | | Promise<number> | Promise对象。如果操作成功,返回行ID;否则返回-1。 | +**错误码:** + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **示例:** ```js @@ -1375,6 +1422,14 @@ insert(table: string, values: ValuesBucket, conflict: ConflictResolution):Promi | --------------------- | ------------------------------------------------- | | Promise<number> | Promise对象。如果操作成功,返回行ID;否则返回-1。 | +**错误码:** + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **示例:** ```js @@ -1408,6 +1463,14 @@ batchInsert(table: string, values: Array<ValuesBucket>, callback: AsyncCal | values | Array<[ValuesBucket](#valuesbucket)> | 是 | 表示要插入到表中的一组数据。 | | callback | AsyncCallback<number> | 是 | 指定callback回调函数。如果操作成功,返回插入的数据个数,否则返回-1。 | +**错误码:** + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **示例:** ```js @@ -1461,6 +1524,14 @@ batchInsert(table: string, values: Array<ValuesBucket>):Promise<number& | --------------------- | ----------------------------------------------------------- | | Promise<number> | Promise对象。如果操作成功,返回插入的数据个数,否则返回-1。 | +**错误码:** + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **示例:** ```js @@ -1508,6 +1579,14 @@ update(values: ValuesBucket, predicates: RdbPredicates, callback: AsyncCallback& | predicates | [RdbPredicates](#rdbpredicates) | 是 | RdbPredicates的实例对象指定的更新条件。 | | callback | AsyncCallback<number> | 是 | 指定的callback回调方法。返回受影响的行数。 | +**错误码:** + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **示例:** ```js @@ -1545,6 +1624,14 @@ update(values: ValuesBucket, predicates: RdbPredicates, conflict: ConflictResolu | conflict | [ConflictResolution](#conflictresolution10) | 是 | 指定冲突解决方式。 | | callback | AsyncCallback<number> | 是 | 指定的callback回调方法。返回受影响的行数。 | +**错误码:** + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **示例:** ```js @@ -1586,6 +1673,14 @@ update(values: ValuesBucket, predicates: RdbPredicates):Promise<number> | --------------------- | ----------------------------------------- | | Promise<number> | 指定的Promise回调方法。返回受影响的行数。 | +**错误码:** + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **示例:** ```js @@ -1627,6 +1722,14 @@ update(values: ValuesBucket, predicates: RdbPredicates, conflict: ConflictResolu | --------------------- | ----------------------------------------- | | Promise<number> | 指定的Promise回调方法。返回受影响的行数。 | +**错误码:** + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **示例:** ```js @@ -1665,6 +1768,14 @@ update(table: string, values: ValuesBucket, predicates: dataSharePredicates.Data | predicates | [dataSharePredicates.DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | 是 | DataSharePredicates的实例对象指定的更新条件。 | | callback | AsyncCallback<number> | 是 | 指定的callback回调方法。返回受影响的行数。 | +**错误码:** + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **示例:** ```js @@ -1710,6 +1821,14 @@ update(table: string, values: ValuesBucket, predicates: dataSharePredicates.Data | --------------------- | ----------------------------------------- | | Promise<number> | 指定的Promise回调方法。返回受影响的行数。 | +**错误码:** + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **示例:** ```js @@ -1745,6 +1864,14 @@ delete(predicates: RdbPredicates, callback: AsyncCallback<number>):void | predicates | [RdbPredicates](#rdbpredicates) | 是 | RdbPredicates的实例对象指定的删除条件。 | | callback | AsyncCallback<number> | 是 | 指定callback回调函数。返回受影响的行数。 | +**错误码:** + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **示例:** ```js @@ -1779,6 +1906,14 @@ delete(predicates: RdbPredicates):Promise<number> | --------------------- | ------------------------------- | | Promise<number> | Promise对象。返回受影响的行数。 | +**错误码:** + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **示例:** ```js @@ -1810,6 +1945,14 @@ delete(table: string, predicates: dataSharePredicates.DataSharePredicates, callb | predicates | [dataSharePredicates.DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | 是 | DataSharePredicates的实例对象指定的删除条件。 | | callback | AsyncCallback<number> | 是 | 指定callback回调函数。返回受影响的行数。 | +**错误码:** + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **示例:** ```js @@ -1848,6 +1991,14 @@ delete(table: string, predicates: dataSharePredicates.DataSharePredicates):Promi | --------------------- | ------------------------------- | | Promise<number> | Promise对象。返回受影响的行数。 | +**错误码:** + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **示例:** ```js @@ -2008,24 +2159,42 @@ remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: A 根据指定条件查询远程设备数据库中的数据。使用callback异步回调。 +> **说明:** +> +> 其中device通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 + **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ---------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | -| device | string | 是 | 指定的远程设备的networkId。 | -| table | string | 是 | 指定的目标表名。 | -| predicates | [RdbPredicates](#rdbpredicates) | 是 | RdbPredicates的实例对象,指定查询的条件。 | -| columns | Array<string> | 是 | 表示要查询的列。如果值为空,则查询应用于所有列。 | +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | -------------------------------------------- | ---- | --------------------------------------------------------- | +| device | string | 是 | 指定的远程设备ID。 | +| table | string | 是 | 指定的目标表名。 | +| predicates | [RdbPredicates](#rdbpredicates) | 是 | RdbPredicates的实例对象,指定查询的条件。 | +| columns | Array<string> | 是 | 表示要查询的列。如果值为空,则查询应用于所有列。 | | callback | AsyncCallback<[ResultSet](#resultset)> | 是 | 指定callback回调函数。如果操作成功,则返回ResultSet对象。 | **示例:** ```js +import deviceManager from '@ohos.distributedHardware.deviceManager'; +let dmInstance = null; +let deviceId = null; + +deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => { + if (err) { + console.log("create device manager failed, err=" + err); + return; + } + dmInstance = manager; + let devices = dmInstance.getTrustedDeviceListSync(); + deviceId = devices[0].deviceId; +}) + let predicates = new relationalStore.RdbPredicates('EMPLOYEE'); predicates.greaterThan("id", 0); -store.remoteQuery("deviceId", "EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], +store.remoteQuery(deviceId, "EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], function(err, resultSet) { if (err) { console.error(`Failed to remoteQuery, err: ${err}`); @@ -2043,13 +2212,17 @@ remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: A 根据指定条件查询远程设备数据库中的数据。使用Promise异步回调。 +> **说明:** +> +> 其中device通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 + **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core **参数:** | 参数名 | 类型 | 必填 | 说明 | | ---------- | ------------------------------------ | ---- | ------------------------------------------------ | -| device | string | 是 | 指定的远程设备的networkId。 | +| device | string | 是 | 指定的远程设备ID。 | | table | string | 是 | 指定的目标表名。 | | predicates | [RdbPredicates](#rdbpredicates) | 是 | RdbPredicates的实例对象,指定查询的条件。 | | columns | Array<string> | 是 | 表示要查询的列。如果值为空,则查询应用于所有列。 | @@ -2063,9 +2236,23 @@ remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: A **示例:** ```js +import deviceManager from '@ohos.distributedHardware.deviceManager'; +let dmInstance = null; +let deviceId = null; + +deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => { + if (err) { + console.log("create device manager failed, err=" + err); + return; + } + dmInstance = manager; + let devices = dmInstance.getTrustedDeviceListSync(); + deviceId = devices[0].deviceId; +}) + let predicates = new relationalStore.RdbPredicates('EMPLOYEE'); predicates.greaterThan("id", 0); -let promise = store.remoteQuery("deviceId", "EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]); +let promise = store.remoteQuery(deviceId, "EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]); promise.then((resultSet) => { console.info(`ResultSet column names: ${resultSet.columnNames}`); console.info(`ResultSet column count: ${resultSet.columnCount}`); @@ -2084,11 +2271,11 @@ querySql(sql: string, bindArgs: Array<ValueType>, callback: AsyncCallback& **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | -| sql | string | 是 | 指定要执行的SQL语句。 | -| bindArgs | Array<[ValueType](#valuetype)> | 是 | SQL语句中参数的值。 | -| callback | AsyncCallback<[ResultSet](#resultset)> | 是 | 指定callback回调函数。如果操作成功,则返回ResultSet对象。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------------------------------- | ---- | ------------------------------------------------------------ | +| sql | string | 是 | 指定要执行的SQL语句。 | +| bindArgs | Array<[ValueType](#valuetype)> | 是 | SQL语句中参数的值。该值与sql参数语句中的占位符相对应。当sql参数语句完整时,该参数需为空数组。 | +| callback | AsyncCallback<[ResultSet](#resultset)> | 是 | 指定callback回调函数。如果操作成功,则返回ResultSet对象。 | **示例:** @@ -2113,10 +2300,10 @@ querySql(sql: string, bindArgs?: Array<ValueType>):Promise<ResultSet> **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------------------------------------ | ---- | --------------------- | -| sql | string | 是 | 指定要执行的SQL语句。 | -| bindArgs | Array<[ValueType](#valuetype)> | 否 | SQL语句中参数的值。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------ | ---- | ------------------------------------------------------------ | +| sql | string | 是 | 指定要执行的SQL语句。 | +| bindArgs | Array<[ValueType](#valuetype)> | 否 | SQL语句中参数的值。该值与sql参数语句中的占位符相对应。当sql参数语句完整时,该参数不填。 | **返回值**: @@ -2127,7 +2314,7 @@ querySql(sql: string, bindArgs?: Array<ValueType>):Promise<ResultSet> **示例:** ```js -let promise = store.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = ?", ['sanguo']); +let promise = store.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = 'sanguo'"); promise.then((resultSet) => { console.info(`ResultSet column names: ${resultSet.columnNames}`); console.info(`ResultSet column count: ${resultSet.columnCount}`); @@ -2146,22 +2333,30 @@ executeSql(sql: string, bindArgs: Array<ValueType>, callback: AsyncCallbac **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------------------------------------ | ---- | ---------------------- | -| sql | string | 是 | 指定要执行的SQL语句。 | -| bindArgs | Array<[ValueType](#valuetype)> | 是 | SQL语句中参数的值。 | -| callback | AsyncCallback<void> | 是 | 指定callback回调函数。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------ | ---- | ------------------------------------------------------------ | +| sql | string | 是 | 指定要执行的SQL语句。 | +| bindArgs | Array<[ValueType](#valuetype)> | 是 | SQL语句中参数的值。该值与sql参数语句中的占位符相对应。当sql参数语句完整时,该参数需为空数组。 | +| callback | AsyncCallback<void> | 是 | 指定callback回调函数。 | + +**错误码:** + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| **示例:** ```js -const SQL_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS EMPLOYEE (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL, AGE INTEGER, SALARY REAL, CODES BLOB)" -store.executeSql(SQL_CREATE_TABLE, null, function(err) { +const SQL_DELETE_TABLE = "DELETE FROM test WHERE name = ?" +store.executeSql(SQL_DELETE_TABLE, ['zhangsan'], function(err) { if (err) { console.error(`ExecuteSql failed, err: ${err}`); return; } - console.info(`Create table done.`); + console.info(`Delete table done.`); }) ``` @@ -2175,10 +2370,10 @@ executeSql(sql: string, bindArgs?: Array<ValueType>):Promise<void> **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------------------------------------ | ---- | --------------------- | -| sql | string | 是 | 指定要执行的SQL语句。 | -| bindArgs | Array<[ValueType](#valuetype)> | 否 | SQL语句中参数的值。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------ | ---- | ------------------------------------------------------------ | +| sql | string | 是 | 指定要执行的SQL语句。 | +| bindArgs | Array<[ValueType](#valuetype)> | 否 | SQL语句中参数的值。该值与sql参数语句中的占位符相对应。当sql参数语句完整时,该参数不填。 | **返回值**: @@ -2186,13 +2381,21 @@ executeSql(sql: string, bindArgs?: Array<ValueType>):Promise<void> | ------------------- | ------------------------- | | Promise<void> | 无返回结果的Promise对象。 | +**错误码:** + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **示例:** ```js -const SQL_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS EMPLOYEE (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL, AGE INTEGER, SALARY REAL, CODES BLOB)" -let promise = store.executeSql(SQL_CREATE_TABLE); +const SQL_DELETE_TABLE = "DELETE FROM test WHERE name = 'zhangsan'" +let promise = store.executeSql(SQL_DELETE_TABLE); promise.then(() => { - console.info(`Create table done.`); + console.info(`Delete table done.`); }).catch((err) => { console.error(`ExecuteSql failed, err: ${err}`); }) @@ -2206,6 +2409,14 @@ beginTransaction():void **系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core +**错误码:** + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | ----------------------- | +| 14800047 | The WAL file size exceeds the default limit.| + **示例:** ```js @@ -2488,7 +2699,11 @@ promise.then(() => { obtainDistributedTableName(device: string, table: string, callback: AsyncCallback<string>): void -根据本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名, 使用callback异步回调。 +根据远程设备的本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名, 使用callback异步回调。 + +> **说明:** +> +> 其中device通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 **需要权限:** ohos.permission.DISTRIBUTED_DATASYNC @@ -2498,14 +2713,28 @@ obtainDistributedTableName(device: string, table: string, callback: AsyncCallbac | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------- | ---- | ------------------------------------------------------------ | -| device | string | 是 | 远程设备 。 | -| table | string | 是 | 本地表名。 | +| device | string | 是 | 远程设备ID 。 | +| table | string | 是 | 远程设备的本地表名。 | | callback | AsyncCallback<string> | 是 | 指定的callback回调函数。如果操作成功,返回远程设备的分布式表名。 | **示例:** ```js -store.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err, tableName) { +import deviceManager from '@ohos.distributedHardware.deviceManager'; +let dmInstance = null; +let deviceId = null; + +deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => { + if (err) { + console.log("create device manager failed, err=" + err); + return; + } + dmInstance = manager; + let devices = dmInstance.getTrustedDeviceListSync(); + deviceId = devices[0].deviceId; +}) + +store.obtainDistributedTableName(deviceId, "EMPLOYEE", function (err, tableName) { if (err) { console.error(`ObtainDistributedTableName failed, err: ${err}`); return; @@ -2518,7 +2747,11 @@ store.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err, tab obtainDistributedTableName(device: string, table: string): Promise<string> -根据本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名,使用Promise异步回调。 +根据远程设备的本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名,使用Promise异步回调。 + +> **说明:** +> +> 其中device通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 **需要权限:** ohos.permission.DISTRIBUTED_DATASYNC @@ -2526,10 +2759,10 @@ store.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err, tab **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | ---------- | -| device | string | 是 | 远程设备。 | -| table | string | 是 | 本地表名。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------- | +| device | string | 是 | 远程设备ID。 | +| table | string | 是 | 远程设备的本地表名。 | **返回值**: @@ -2540,7 +2773,21 @@ store.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err, tab **示例:** ```js -let promise = store.obtainDistributedTableName("12345678abcde", "EMPLOYEE"); +import deviceManager from '@ohos.distributedHardware.deviceManager'; +let dmInstance = null; +let deviceId = null; + +deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => { + if (err) { + console.log("create device manager failed, err=" + err); + return; + } + dmInstance = manager; + let devices = dmInstance.getTrustedDeviceListSync(); + deviceId = devices[0].deviceId; +}) + +let promise = store.obtainDistributedTableName(deviceId, "EMPLOYEE"); promise.then((tableName) => { console.info(`ObtainDistributedTableName successfully, tableName= ${tableName}`); }).catch((err) => { @@ -2569,8 +2816,24 @@ sync(mode: SyncMode, predicates: RdbPredicates, callback: AsyncCallback<Array **示例:** ```js +import deviceManager from '@ohos.distributedHardware.deviceManager'; +let dmInstance = null; +let deviceIds = []; + +deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => { + if (err) { + console.log("create device manager failed, err=" + err); + return; + } + dmInstance = manager; + let devices = dmInstance.getTrustedDeviceListSync(); + for (var i = 0; i < devices.length; i++) { + deviceIds[i] = devices[i].deviceId; + } +}) + let predicates = new relationalStore.RdbPredicates('EMPLOYEE'); -predicates.inDevices(['12345678abcde']); +predicates.inDevices(deviceIds); store.sync(relationalStore.SyncMode.SYNC_MODE_PUSH, predicates, function (err, result) { if (err) { console.error(`Sync failed, err: ${err}`); @@ -2609,12 +2872,28 @@ store.sync(relationalStore.SyncMode.SYNC_MODE_PUSH, predicates, function (err, r **示例:** ```js +import deviceManager from '@ohos.distributedHardware.deviceManager'; +let dmInstance = null; +let deviceIds = []; + +deviceManager.createDeviceManager("com.example.appdatamgrverify", (err, manager) => { + if (err) { + console.log("create device manager failed, err=" + err); + return; + } + dmInstance = manager; + let devices = dmInstance.getTrustedDeviceListSync(); + for (var i = 0; i < devices.length; i++) { + deviceIds[i] = devices[i].deviceId; + } +}) + let predicates = new relationalStore.RdbPredicates('EMPLOYEE'); -predicates.inDevices(['12345678abcde']); +predicates.inDevices(deviceIds); let promise = store.sync(relationalStore.SyncMode.SYNC_MODE_PUSH, predicates); -promise.then((resultSet) =>{ +promise.then((result) =>{ console.info(`Sync done.`); - for (let i = 0; i < resultSet.length; i++) { + for (let i = 0; i < result.length; i++) { console.info(`device= ${result[i][0]}, status= ${result[i][1]}`); } }).catch((err) => { @@ -2693,10 +2972,12 @@ try { 首先需要获取resultSet对象。 ```js +let resultSet = null; let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); predicates.equalTo("AGE", 18); let promise = store.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]); -promise.then((resultSet) => { +promise.then((result) => { + resultSet = result; console.info(`resultSet columnNames: ${resultSet.columnNames}`); console.info(`resultSet columnCount: ${resultSet.columnCount}`); }); @@ -2867,7 +3148,7 @@ goToRow(position: number): boolean let predicates = new relationalStore.RdbPredicates("EMPLOYEE"); let promise = store.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]); promise.then((resultSet) => { - resultSet.(5); + resultSet.goToRow(5); resultSet.close(); }).catch((err) => { console.error(`query failed, err: ${err}`); diff --git a/zh-cn/application-dev/reference/apis/js-apis-defaultAppManager.md b/zh-cn/application-dev/reference/apis/js-apis-defaultAppManager.md index 71a3d4ec9aae0e71dc30a4ef9c7eb7f8912a0784..cd91357cd4a3e4840d40d9eaed33e91726b54400 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-defaultAppManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-defaultAppManager.md @@ -109,7 +109,7 @@ getDefaultApplication(type: string, userId?: number): Promise\ **系统能力:** SystemCapability.BundleManager.BundleFramework.DefaultApp -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** @@ -165,7 +165,7 @@ getDefaultApplication(type: string, userId: number, callback: AsyncCallback\) : void **系统能力:** SystemCapability.BundleManager.BundleFramework.DefaultApp -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** @@ -266,7 +266,7 @@ setDefaultApplication(type: string, elementName: ElementName, userId?: number): **系统能力:** SystemCapability.BundleManager.BundleFramework.DefaultApp -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** @@ -338,7 +338,7 @@ setDefaultApplication(type: string, elementName: ElementName, userId: number, ca **系统能力:** SystemCapability.BundleManager.BundleFramework.DefaultApp -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** @@ -399,7 +399,7 @@ setDefaultApplication(type: string, elementName: ElementName, callback: AsyncCal **系统能力:** SystemCapability.BundleManager.BundleFramework.DefaultApp -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** @@ -458,7 +458,7 @@ resetDefaultApplication(type: string, userId?: number): Promise\ **系统能力:** SystemCapability.BundleManager.BundleFramework.DefaultApp -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** @@ -508,7 +508,7 @@ resetDefaultApplication(type: string, userId: number, callback: AsyncCallback\) : void; **系统能力:** SystemCapability.BundleManager.BundleFramework.DefaultApp -**系统API:** 此接口为系统接口,三方应用不支持调用 +**系统API:** 此接口为系统接口。 **参数:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-deque.md b/zh-cn/application-dev/reference/apis/js-apis-deque.md index 4d12db310a1d9bed9cdcf9f1a84ec296f3b2051a..c5a2b838fe567a131879fbbf3cb6cd6cc38f94ec 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-deque.md +++ b/zh-cn/application-dev/reference/apis/js-apis-deque.md @@ -9,7 +9,7 @@ Deque和[Queue](js-apis-queue.md)相比,Queue的特点是先进先出,只能 **推荐使用场景:** 需要频繁在集合两端进行增删元素的操作时,推荐使用Deque。 文档中存在泛型的使用,涉及以下泛型标记符:
-- T:Type, 类 +- T:Type,类 > **说明:** > @@ -156,9 +156,8 @@ has(element: T): boolean ```ts let deque = new Deque(); -let result = deque.has("squirrel"); deque.insertFront("squirrel"); -let result1 = deque.has("squirrel"); +let result = deque.has("squirrel"); ``` ### popFirst diff --git a/zh-cn/application-dev/reference/apis/js-apis-device-manager.md b/zh-cn/application-dev/reference/apis/js-apis-device-manager.md index 83f6e63572daa8b30d9decfa8a8e1131609c11ba..d7a67f5c99718f310d6d5e4126a31880ce03f0be 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-device-manager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-device-manager.md @@ -96,7 +96,7 @@ createDeviceManager(bundleName: string, callback: AsyncCallback<DeviceManager | CAR | 0x83 | 车 | | UNKNOWN_TYPE | 0 | 未知设备 | -## AuthForm +## AuthForm10+ 表示设备认证类型的枚举类。 @@ -262,8 +262,6 @@ getTrustedDeviceListSync(): Array<DeviceInfo> 同步获取所有可信设备列表。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **返回值:** @@ -296,8 +294,6 @@ getTrustedDeviceList(callback:AsyncCallback<Array<DeviceInfo>>): voi 获取所有可信设备列表。使用callback异步回调。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **参数:** @@ -336,8 +332,6 @@ getTrustedDeviceList(): Promise<Array<DeviceInfo>> 获取所有可信设备列表。使用Promise异步回调。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **返回值:** @@ -370,8 +364,6 @@ getLocalDeviceInfoSync(): [DeviceInfo](#deviceinfo) 同步获取本地设备信息。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **返回值:** @@ -404,8 +396,6 @@ getLocalDeviceInfo(callback:AsyncCallback<DeviceInfo>): void 获取本地设备信息。使用callback异步回调。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **参数:** @@ -444,8 +434,6 @@ getLocalDeviceInfo(): Promise<DeviceInfo> 获取本地设备信息。使用Promise异步回调。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **返回值:** @@ -472,14 +460,89 @@ getLocalDeviceInfo(): Promise<DeviceInfo> }); ``` +### getDeviceInfo10+ + +getDeviceInfo(networkId: string, callback:AsyncCallback<DeviceInfo>): void + +通过指定设备的网络标识获取该设备的信息。使用callback异步回调。 + +**系统能力**:SystemCapability.DistributedHardware.DeviceManager + +**参数:** + + | 参数名 | 类型 | 必填 | 说明 | + | -------- | ---------------------------------------- | ---- | --------- | + | networkId| string | 是 | 设备的网络标识。 | + | callback | AsyncCallback<[DeviceInfo](#deviceinfo)> | 是 | 获取指定设备信息。 | + +**错误码:** + +以下的错误码的详细介绍请参见[设备管理错误码](../errorcodes/errorcode-device-manager.md) + +| 错误码ID | 错误信息 | +| -------- | --------------------------------------------------------------- | +| 11600101 | Failed to execute the function. | + +**示例:** + + ```js + try { + dmInstance.getDeviceInfo(networkId, (err, data) => { + if (err) { + console.error("getDeviceInfo errCode:" + err.code + ",errMessage:" + err.message); + return; + } + console.log('get device info: ' + JSON.stringify(data)); + }); + } catch (err) { + console.error("getDeviceInfo errCode:" + err.code + ",errMessage:" + err.message); + } + ``` + +### getDeviceInfo10+ + +getDeviceInfo(networkId: string): Promise<DeviceInfo> + +通过指定设备的网络标识获取该设备的信息。使用Promise异步回调。 + +**系统能力**:SystemCapability.DistributedHardware.DeviceManager + +**参数:** + + | 参数名 | 类型 | 必填 | 说明 | + | -------- | ---------------------------------------- | ---- | --------- | + | networkId| string | 是 | 设备的网络标识。 | + +**返回值:** + + | 类型 | 说明 | + | ---------------------------------------- | --------------------- | + | Promise<[DeviceInfo](#deviceinfo)> | Promise实例,用于获取异步返回结果。 | + +**错误码:** + +以下的错误码的详细介绍请参见[设备管理错误码](../errorcodes/errorcode-device-manager.md) + +| 错误码ID | 错误信息 | +| ------- | --------------------------------------------------------------- | +| 11600101| Failed to execute the function. | + +**示例:** + + ```js + dmInstance.getDeviceInfo(networkId).then((data) => { + console.log('get device info: ' + JSON.stringify(data)); + }).catch((err) => { + console.error("getDeviceInfo errCode:" + err.code + ",errMessage:" + err.message); + }); + ``` + ### startDeviceDiscovery8+ startDeviceDiscovery(subscribeInfo: SubscribeInfo): void 发现周边设备。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **参数:** @@ -524,8 +587,6 @@ startDeviceDiscovery(subscribeInfo: SubscribeInfo, filterOptions?: string): void 发现周边设备。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **参数:** @@ -580,8 +641,6 @@ stopDeviceDiscovery(subscribeId: number): void 停止发现周边设备。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **参数:** @@ -616,8 +675,6 @@ publishDeviceDiscovery(publishInfo: PublishInfo): void 发布设备发现。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **参数:** @@ -659,8 +716,6 @@ unPublishDeviceDiscovery(publishId: number): void 停止发布设备发现。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **参数:** @@ -695,8 +750,6 @@ authenticateDevice(deviceInfo: DeviceInfo, authParam: AuthParam, callback: Async 认证设备。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **参数:** @@ -757,8 +810,6 @@ unAuthenticateDevice(deviceInfo: DeviceInfo): void 解除认证设备。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **参数:** @@ -798,8 +849,6 @@ verifyAuthInfo(authInfo: AuthInfo, callback: AsyncCallback<{deviceId: string, 验证认证信息。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **参数:** @@ -844,8 +893,6 @@ setUserOperation(operateAction: number, params: string): void; 设置用户ui操作行为。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **参数:** @@ -880,8 +927,6 @@ requestCredentialRegisterInfo(requestInfo: string, callback: AsyncCallback<{regi 获取凭据的注册信息。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **参数:** @@ -917,8 +962,6 @@ importCredential(credentialInfo: string, callback: AsyncCallback<{resultInfo: st 导入凭据信息。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **参数:** @@ -970,8 +1013,6 @@ deleteCredential(queryInfo: string, callback: AsyncCallback<{resultInfo: string} 删除凭据信息。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **参数:** @@ -1008,8 +1049,6 @@ on(type: 'uiStateChange', callback: Callback<{ param: string}>): void; ui状态变更回调。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **参数:** @@ -1040,8 +1079,6 @@ off(type: 'uiStateChange', callback?: Callback<{ param: string}>): void; 取消ui状态变更回调。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **参数:** @@ -1067,8 +1104,6 @@ on(type: 'deviceStateChange', callback: Callback<{ action: DeviceStateChange 注册设备状态回调。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **参数:** @@ -1096,8 +1131,6 @@ off(type: 'deviceStateChange', callback?: Callback<{ action: DeviceStateChang 取消注册设备状态回调。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **参数:** @@ -1125,8 +1158,6 @@ on(type: 'deviceFound', callback: Callback<{ subscribeId: number, device: Dev 注册发现设备回调监听。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **参数:** @@ -1154,8 +1185,6 @@ off(type: 'deviceFound', callback?: Callback<{ subscribeId: number, device: D 取消注册设备发现回调。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **参数:** @@ -1183,8 +1212,6 @@ on(type: 'discoverFail', callback: Callback<{ subscribeId: number, reason: nu 注册设备发现失败回调监听。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **参数:** @@ -1212,8 +1239,6 @@ off(type: 'discoverFail', callback?: Callback<{ subscribeId: number, reason: 取消注册设备发现失败回调。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **参数:** @@ -1241,8 +1266,6 @@ on(type: 'publishSuccess', callback: Callback<{ publishId: number }>): voi 注册发布设备发现回调监听。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **参数:** @@ -1271,8 +1294,6 @@ off(type: 'publishSuccess', callback?: Callback<{ publishId: number }>): v 取消注册设备发布成功回调。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **参数:** @@ -1300,8 +1321,6 @@ on(type: 'publishFail', callback: Callback<{ publishId: number, reason: numbe 注册设备发布失败回调监听。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **参数:** @@ -1329,8 +1348,6 @@ off(type: 'publishFail', callback?: Callback<{ publishId: number, reason: num 取消注册设备发布失败回调。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **参数:** @@ -1358,8 +1375,6 @@ on(type: 'serviceDie', callback: () => void): void 注册设备管理服务死亡监听。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **参数:** @@ -1387,8 +1402,6 @@ off(type: 'serviceDie', callback?: () => void): void 取消注册设备管理服务死亡监听。 -**需要权限**:ohos.permission.ACCESS_SERVICE_DM,仅系统应用可用。 - **系统能力**:SystemCapability.DistributedHardware.DeviceManager **参数:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-display.md b/zh-cn/application-dev/reference/apis/js-apis-display.md index 8b73f026dcdc1864fcde3cc02707a890f3c39a9e..db7ab01ce6978bf0a8d49cf115a07ac5f4cd2f39 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-display.md +++ b/zh-cn/application-dev/reference/apis/js-apis-display.md @@ -291,6 +291,63 @@ try { } ``` +## display.on('privateModeChange')10+ + +on(type: 'privateModeChange', callback: Callback<boolean>): void + +开启屏幕隐私模式变化的监听。当屏幕前台有隐私窗口,则屏幕处于隐私模式,屏幕中的隐私窗口内容无法被截屏或录屏。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- |------------------------------------------| ---- | ------------------------------------------------------- | +| type | string | 是 | 监听事件,固定为'privateModeChange',表示屏幕隐私模式状态发生变化。 | +| callback | Callback<boolean> | 是 | 回调函数。表示屏幕隐私模式是否改变。true表示屏幕由非隐私窗口模式变为隐私模式,false表示屏幕由隐私模式变为非隐私模式。 | + +**示例:** + +```js +let callback = (data) => { + console.info('Listening enabled. Data: ' + JSON.stringify(data)); +}; +try { + display.on("privateModeChange", callback); +} catch (exception) { + console.error('Failed to register callback. Code: ' + JSON.stringify(exception)); +} +``` + +## display.off('privateModeChange')10+ + +off(type: 'privateModeChange', callback?: Callback<boolean>): void + +关闭屏幕隐私模式变化的监听。当屏幕前台有隐私窗口,则屏幕处于隐私模式,屏幕中的隐私窗口内容无法被截屏或录屏。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- |------------------------------------------| ---- | ------------------------------------------------------- | +| type | string | 是 | 监听事件,固定为'privateModeChange',表示屏幕隐私模式状态发生变化。 | +| callback | Callback<boolean> | 否 | 回调函数。表示屏幕隐私模式是否改变。true表示屏幕由非隐私模式变为隐私模式,false表示屏幕由隐私模式变为非隐私模式。 | + +**示例:** + +```js +try { + display.off("privateModeChange"); +} catch (exception) { + console.error('Failed to unregister callback. Code: ' + JSON.stringify(exception)); +} +``` + ## display.getDefaultDisplay(deprecated) getDefaultDisplay(callback: AsyncCallback<Display>): void 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 385251bb566383c332c8f10952191ef7121674f7..82c7205626934dbd5ddf5bca020ce943917b171a 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 @@ getOsAccountDistributedInfo(callback: AsyncCallback<DistributedInfo>): voi **系统能力:** SystemCapability.Account.OsAccount -**需要权限:** ohos.permission.MANAGE_DISTRIBUTED_ACCOUNTS 或 ohos.permission.GET_DISTRIBUTED_ACCOUNTS 或 ohos.permission.DISTRIBUTED_DATASYNC。 +**需要权限:** ohos.permission.MANAGE_DISTRIBUTED_ACCOUNTS 或 ohos.permission.GET_DISTRIBUTED_ACCOUNTS 或 ohos.permission.DISTRIBUTED_DATASYNC **参数:** @@ -79,7 +79,7 @@ getOsAccountDistributedInfo(): Promise<DistributedInfo> **系统能力:** SystemCapability.Account.OsAccount -**需要权限:** ohos.permission.MANAGE_DISTRIBUTED_ACCOUNTS 或 ohos.permission.GET_DISTRIBUTED_ACCOUNTS 或 ohos.permission.DISTRIBUTED_DATASYNC。 +**需要权限:** ohos.permission.MANAGE_DISTRIBUTED_ACCOUNTS 或 ohos.permission.GET_DISTRIBUTED_ACCOUNTS 或 ohos.permission.DISTRIBUTED_DATASYNC **返回值:** @@ -118,7 +118,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 **参数:** @@ -148,7 +148,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 **返回值:** @@ -175,7 +175,7 @@ setOsAccountDistributedInfo(accountInfo: DistributedInfo, callback: AsyncCallbac **系统能力:** SystemCapability.Account.OsAccount -**需要权限:** ohos.permission.MANAGE_DISTRIBUTED_ACCOUNTS。 +**需要权限:** ohos.permission.MANAGE_DISTRIBUTED_ACCOUNTS **参数:** @@ -213,7 +213,7 @@ setOsAccountDistributedInfo(accountInfo: DistributedInfo): Promise<void> **系统能力:** SystemCapability.Account.OsAccount -**需要权限:** ohos.permission.MANAGE_DISTRIBUTED_ACCOUNTS。 +**需要权限:** ohos.permission.MANAGE_DISTRIBUTED_ACCOUNTS **参数:** @@ -232,7 +232,8 @@ setOsAccountDistributedInfo(accountInfo: DistributedInfo): Promise<void> | 错误码ID | 错误信息| | -------- | ------------------- | | 12300001 | System service exception. | -| 12300002 | invalid accountInfo. | +| 12300002 | Invalid accountInfo. | +| 12300003 | Account not found. | **示例:** ```js @@ -260,7 +261,7 @@ updateOsAccountDistributedInfo(accountInfo: DistributedInfo, callback: AsyncCall **系统能力:** SystemCapability.Account.OsAccount -**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS。 +**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS **参数:** @@ -288,7 +289,7 @@ updateOsAccountDistributedInfo(accountInfo: DistributedInfo): Promise<void> > 从 API version 7开始支持,从API version 9开始废弃。建议使用[setOsAccountDistributedInfo](#setosaccountdistributedinfo9-1)。 **系统能力:** SystemCapability.Account.OsAccount -**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS。 +**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS **参数:** @@ -325,4 +326,4 @@ updateOsAccountDistributedInfo(accountInfo: DistributedInfo): Promise<void> | event | string | 是 | 分布式帐号登录状态,包括登录、登出、Token失效和注销,分别对应以下字符串:
- Ohos.account.event.LOGIN
- Ohos.account.event.LOGOUT
- Ohos.account.event.TOKEN_INVALID
- Ohos.account.event.LOGOFF | | nickname9+ | string | 否 | 分布式帐号的昵称,非空字符串。 | | avatar9+ | string | 否 | 分布式帐号的头像,非空字符串。 | -| scalableData | object | 否 | 分布式帐号扩展信息,根据业务所需,以k-v形式传递定制化信息。
说明:该参数是预留的可选项,目前查询和更新的方法实现中未使用。 | +| scalableData8+ | object | 否 | 分布式帐号扩展信息,根据业务所需,以k-v形式传递定制化信息。
说明:该参数是预留的可选项,目前查询和更新的方法实现中未使用。 | 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 385a0aa56f3ffbe2e53b49445f1ef59bad60fac9..a7a8b4022dc7b7b3d0214dfa63eb56d07b8af958 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 @@ -16,6 +16,8 @@ >- 从API Version 9开始,该接口不再维护,推荐使用新接口[`@ohos.data.distributedKVStore`](js-apis-distributedKVStore.md)。 > >- 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> +>- 本模块中所有需要获取deviceId的接口,都仅系统应用可用。 ## 导入模块 @@ -88,25 +90,22 @@ createKVManager(config: KVManagerConfig): Promise<KVManager> **示例:** ```js -let kvManager; try { - const kvManagerConfig = { - bundleName : 'com.example.datamanagertest', - userInfo : { - userId : '0', - userType : distributedData.UserType.SAME_USER_ID - } + const kvManagerConfig = { + bundleName: 'com.example.datamanagertest', + userInfo: { + userId: '0', + userType: distributedData.UserType.SAME_USER_ID } - distributedData.createKVManager(kvManagerConfig, function (err, manager) { - if (err) { - console.log("Failed to create KVManager: " + JSON.stringify(err)); - return; - } - console.log("Succeeded in creating KVManager"); - kvManager = manager; - }); + } + distributedData.createKVManager(kvManagerConfig).then((manager) => { + console.log("Succeeded in creating KVManager"); + kvManager = manager; + }).catch((err) => { + console.error("Failed to create KVManager: " + JSON.stringify(err)); + }); } catch (e) { - console.log("An unexpected error occurred. Error:" + e); + console.log("An unexpected error occurred. Error:" + e); } ``` @@ -578,7 +577,7 @@ try { | 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 | +| autoSync | boolean | 否 |设置数据库文件是否自动同步。默认为false,即手动同步;设置为true时,表示自动同步。
**系统能力:** 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 | @@ -2012,6 +2011,10 @@ try { deviceId(deviceId:string):Query 添加设备ID作为key的前缀。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.Core @@ -3664,6 +3667,10 @@ try { removeDeviceData(deviceId: string, callback: AsyncCallback<void>): void 删除指定设备的数据,使用callback异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.Core @@ -3706,6 +3713,10 @@ try { removeDeviceData(deviceId: string): Promise<void> 删除指定设备的数据,使用Promise异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.Core @@ -3754,7 +3765,10 @@ try { sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void -在手动同步方式下,触发数据库同步。关于分布式数据服务的同步方式说明,请见[分布式数据服务概述](../../database/database-mdds-overview.md)。 +在手动同步方式下,触发数据库同步。 +> **说明:** +> +> 其中deviceIds通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 **需要权限**: ohos.permission.DISTRIBUTED_DATASYNC。 @@ -3771,8 +3785,41 @@ sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void **示例:** ```js +import deviceManager from '@ohos.distributedHardware.deviceManager'; + +let devManager; let kvStore; -kvStore.sync(['deviceIds'], distributedData.SyncMode.PULL_ONLY, 1000); +const KEY_TEST_SYNC_ELEMENT = 'key_test_sync'; +const VALUE_TEST_SYNC_ELEMENT = 'value-string-001'; +// create deviceManager +deviceManager.createDeviceManager('bundleName', (err, value) => { + if (!err) { + devManager = value; + let deviceIds = []; + if (devManager != null) { + var devices = devManager.getTrustedDeviceListSync(); + for (var i = 0; i < devices.length; i++) { + deviceIds[i] = devices[i].deviceId; + } + } + try { + kvStore.on('syncComplete', function (data) { + console.log('Sync dataChange'); + }); + kvStore.put(KEY_TEST_SYNC_ELEMENT + 'testSync101', VALUE_TEST_SYNC_ELEMENT, function (err, data) { + if (err != undefined) { + console.log("put err: " + JSON.stringify(err)); + return; + } + console.log('Succeeded in putting data'); + const mode = distributedData.SyncMode.PULL_ONLY; + kvStore.sync(deviceIds, mode, 1000); + }); + } catch (e) { + console.log('Sync e' + e); + } + } +}); ``` ### on('dataChange')8+ @@ -4048,6 +4095,10 @@ try { get(deviceId: string, key: string, callback: AsyncCallback<boolean|string|number|Uint8Array>): void 获取与指定设备ID和key匹配的string值,使用callback异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -4083,6 +4134,10 @@ try{ get(deviceId: string, key: string): Promise<boolean|string|number|Uint8Array> 获取与指定设备ID和key匹配的string值,使用Promise异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -4127,6 +4182,10 @@ try { getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback<Entry[]>): void 获取与指定设备ID和key前缀匹配的所有键值对,使用callback异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -4175,6 +4234,10 @@ try { getEntries(deviceId: string, keyPrefix: string): Promise<Entry[]> 获取与指定设备ID和key前缀匹配的所有键值对,使用Promise异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -4344,6 +4407,10 @@ try { getEntries(deviceId: string, query: Query, callback: AsyncCallback<Entry[]>): void 获取与指定设备ID和Query对象匹配的键值对列表,使用callback异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -4397,6 +4464,10 @@ try { getEntries(deviceId: string, query: Query): Promise<Entry[]> 获取与指定设备ID和Query对象匹配的键值对列表,使用Promise异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -4457,6 +4528,10 @@ try { getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback<KvStoreResultSet>): void 获取与指定设备ID和key前缀匹配的KvStoreResultSet对象,使用callback异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -4492,6 +4567,10 @@ try { getResultSet(deviceId: string, keyPrefix: string): Promise<KvStoreResultSet> 获取与指定设备ID和key前缀匹配的KvStoreResultSet对象,使用Promise异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -4652,6 +4731,10 @@ try { getResultSet(deviceId: string, query: Query, callback: AsyncCallback<KvStoreResultSet>): void 获取与指定设备ID和Query对象匹配的KvStoreResultSet对象,使用callback异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -4704,6 +4787,10 @@ try { getResultSet(deviceId: string, query: Query): Promise<KvStoreResultSet> 获取与指定设备ID和Query对象匹配的KvStoreResultSet对象,使用Promise异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -4946,6 +5033,10 @@ try { getResultSize(deviceId: string, query: Query, callback: AsyncCallback<number>): void; 获取与指定设备ID和Query对象匹配的结果数,使用callback异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -4993,6 +5084,10 @@ try { getResultSize(deviceId: string, query: Query): Promise<number> 获取与指定设备ID和Query对象匹配的结果数,使用Promise异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -5049,6 +5144,10 @@ try { removeDeviceData(deviceId: string, callback: AsyncCallback<void>): void 从当前数据库中删除指定设备的数据,使用callback异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -5091,6 +5190,10 @@ try { removeDeviceData(deviceId: string): Promise<void> 从当前数据库中删除指定设备的数据,使用Promise异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -5139,7 +5242,11 @@ try { sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void -在手动同步方式下,触发数据库同步。关于分布式数据服务的同步方式说明,请见[分布式数据服务概述](../../database/database-mdds-overview.md)。 +在手动同步方式下,触发数据库同步。 + +> **说明:** +> +> 其中deviceIds通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 **需要权限**: ohos.permission.DISTRIBUTED_DATASYNC。 @@ -5156,22 +5263,41 @@ sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void **示例:** ```js +import deviceManager from '@ohos.distributedHardware.deviceManager'; + +let devManager; let kvStore; const KEY_TEST_SYNC_ELEMENT = 'key_test_sync'; const VALUE_TEST_SYNC_ELEMENT = 'value-string-001'; -try { - kvStore.on('syncComplete', function (data) { +// create deviceManager +deviceManager.createDeviceManager('bundleName', (err, value) => { + if (!err) { + devManager = value; + let deviceIds = []; + if (devManager != null) { + var devices = devManager.getTrustedDeviceListSync(); + for (var i = 0; i < devices.length; i++) { + deviceIds[i] = devices[i].deviceId; + } + } + try { + kvStore.on('syncComplete', function (data) { console.log('Sync dataChange'); - }); - kvStore.put(KEY_TEST_SYNC_ELEMENT + 'testSync101', VALUE_TEST_SYNC_ELEMENT, function (err,data) { - console.log('Sync put success'); - const devices = ['deviceList']; + }); + kvStore.put(KEY_TEST_SYNC_ELEMENT + 'testSync101', VALUE_TEST_SYNC_ELEMENT, function (err, data) { + if (err != undefined) { + console.log("put err: " + JSON.stringify(err)); + return; + } + console.log('Succeeded in putting data'); const mode = distributedData.SyncMode.PULL_ONLY; - kvStore.sync(devices, mode); - }); -}catch(e) { - console.log('Sync e' + e); -} + kvStore.sync(deviceIds, mode, 1000); + }); + } catch (e) { + console.log('Sync e' + e); + } + } +}); ``` ### on('dataChange')8+ diff --git a/zh-cn/application-dev/reference/apis/js-apis-distributedKVStore.md b/zh-cn/application-dev/reference/apis/js-apis-distributedKVStore.md index 3b61f968c98f5bd3ac708e912b8f39e7f776a029..6f22a81e047fac925f76a4a07719950e07410d64 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-distributedKVStore.md +++ b/zh-cn/application-dev/reference/apis/js-apis-distributedKVStore.md @@ -13,6 +13,7 @@ > **说明:** > > 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +>
本模块中所有需要获取deviceId的接口,都仅系统应用可用。 ## 导入模块 @@ -28,7 +29,7 @@ import distributedKVStore from '@ohos.data.distributedKVStore'; | 名称 | 类型 | 必填 | 说明 | | ---------- | --------------------- | ---- | ------------------------------------------------------------ | -| context | Context | 是 |应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 | +| context | Context | 是 |应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-application-uiAbilityContext.md)。
从API version 10开始,context的参数类型为[BaseContext](js-apis-inner-application-baseContext.md)。 | | bundleName | string | 是 | 调用方的包名。 | ## Constants @@ -41,7 +42,7 @@ import distributedKVStore from '@ohos.data.distributedKVStore'; | --------------------- | ------- | --------------------------------------- | | MAX_KEY_LENGTH | 1024 | 数据库中Key允许的最大长度,单位字节。 | | MAX_VALUE_LENGTH | 4194303 | 数据库中Value允许的最大长度,单位字节。 | -| MAX_KEY_LENGTH_DEVICE | 896 | 最大设备密钥长度,单位字节。 | +| MAX_KEY_LENGTH_DEVICE | 896 | 设备协同数据库中key允许的最大长度,单位字节。 | | MAX_STORE_ID_LENGTH | 128 | 数据库标识符允许的最大长度,单位字节。 | | MAX_QUERY_LENGTH | 512000 | 最大查询长度,单位字节。 | | MAX_BATCH_SIZE | 128 | 最大批处理操作数量。 | @@ -137,10 +138,10 @@ import distributedKVStore from '@ohos.data.distributedKVStore'; | 名称 | 说明 | | -------: | ------------------------------------------------------------ | -| S1 | 表示数据库的安全级别为低级别,当数据泄露时会产生较低影响。例如,包含壁纸等系统数据的数据库。 | -| S2 | 表示数据库的安全级别为中级别,当数据泄露时会产生较大影响。例如,包含录音、视频等用户生成数据或通话记录等信息的数据库。 | -| S3 | 表示数据库的安全级别为高级别,当数据泄露时会产生重大影响。例如,包含用户运动、健康、位置等信息的数据库。 | -| S4 | 表示数据库的安全级别为关键级别,当数据泄露时会产生严重影响。例如,包含认证凭据、财务数据等信息的数据库。 | +| S1 | 表示数据库的安全级别为低级别,数据的泄露、篡改、破坏、销毁可能会给个人或组织导致有限的不利影响。
例如,性别、国籍,用户申请记录等。 | +| S2 | 表示数据库的安全级别为中级别,数据的泄露、篡改、破坏、销毁可能会给个人或组织导致严重的不利影响。
例如,个人详细通信地址,姓名昵称等。 | +| S3 | 表示数据库的安全级别为高级别,数据的泄露、篡改、破坏、销毁可能会给个人或组织导致严峻的不利影响。
例如,个人实时精确定位信息、运动轨迹等。 | +| S4 | 表示数据库的安全级别为关键级别,业界法律法规中定义的特殊数据类型,涉及个人的最私密领域的信息或者一旦泄露、篡改、破坏、销毁可能会给个人或组织造成重大的不利影响数据。
例如,政治观点、宗教、和哲学信仰、工会成员资格、基因数据、生物信息、健康和性生活状况、性取向等或设备认证鉴权、个人的信用卡等财务信息。 | ## Options @@ -151,7 +152,7 @@ import distributedKVStore from '@ohos.data.distributedKVStore'; | 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 | +| autoSync | boolean | 否 | 设置数据库文件是否自动同步。默认为false,即手动同步;设置为true时,表示自动同步。
**系统能力:** SystemCapability.DistributedDataManager.KVStore.Core
**需要权限**: ohos.permission.DISTRIBUTED_DATASYNC | | kvStoreType | [KVStoreType](#kvstoretype) | 否 | 设置要创建的数据库类型,默认为多设备协同数据库。
**系统能力:** SystemCapability.DistributedDataManager.KVStore.Core | | securityLevel | [SecurityLevel](#securitylevel) | 是 |设置数据库安全级别。
**系统能力:** SystemCapability.DistributedDataManager.KVStore.Core | | schema | [Schema](#schema) | 否 | 设置定义存储在数据库中的值,默认不使用Schema。
**系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore | @@ -226,23 +227,22 @@ appendChild(child: FieldNode): boolean **示例:** ```js -import ddm from '@ohos.data.distributedKVStore'; try { - let node = new ddm.FieldNode("root"); - let child1 = new ddm.FieldNode("child1"); - let child2 = new ddm.FieldNode("child2"); - let child3 = new ddm.FieldNode("child3"); + let node = new distributedKVStore.FieldNode("root"); + let child1 = new distributedKVStore.FieldNode("child1"); + let child2 = new distributedKVStore.FieldNode("child2"); + let child3 = new distributedKVStore.FieldNode("child3"); node.appendChild(child1); node.appendChild(child2); node.appendChild(child3); - console.log("appendNode " + JSON.stringify(node)); + console.info("appendNode " + JSON.stringify(node)); child1 = null; child2 = null; child3 = null; node = null; } catch (e) { - console.log("AppendChild " + e); + console.error("AppendChild " + e); } ``` @@ -276,7 +276,7 @@ import UIAbility from '@ohos.app.ability.UIAbility'; let kvManager; export default class EntryAbility extends UIAbility { onCreate() { - console.log("MyAbilityStage onCreate") + console.info("MyAbilityStage onCreate") let context = this.context const kvManagerConfig = { context: context, @@ -284,7 +284,7 @@ export default class EntryAbility extends UIAbility { } try { kvManager = distributedKVStore.createKVManager(kvManagerConfig); - console.log("Succeeded in creating KVManager"); + console.info("Succeeded in creating KVManager"); } catch (e) { console.error(`Failed to create KVManager.code is ${e.code},message is ${e.message}`); } @@ -304,7 +304,7 @@ const kvManagerConfig = { } try { kvManager = distributedKVStore.createKVManager(kvManagerConfig); - console.log("Succeeded in creating KVManager"); + console.info("Succeeded in creating KVManager"); } catch (e) { console.error(`Failed to create KVManager.code is ${e.code},message is ${e.message}`); } @@ -316,7 +316,7 @@ try { ### getKVStore -getKVStore<T >(storeId: string, options: Options, callback: AsyncCallback<T>): void +getKVStore<T>(storeId: string, options: Options, callback: AsyncCallback<T>): void 通过指定Options和storeId,创建并获取分布式键值数据库,使用callback异步回调。 @@ -343,7 +343,6 @@ getKVStore<T >(storeId: string, options: Options, callback: AsyncCallback& ```js let kvStore; -let kvManager; try { const options = { createIfMissing: true, @@ -355,20 +354,20 @@ try { }; kvManager.getKVStore('storeId', options, function (err, store) { if (err) { - console.error(`Fail to get KVStore.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get KVStore.code is ${err.code},message is ${err.message}`); return; } - console.log("Succeeded in getting KVStore"); + console.info("Succeeded in getting KVStore"); kvStore = store; }); } catch (e) { - console.log(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` ### getKVStore -getKVStore<T >(storeId: string, options: Options): Promise<T> +getKVStore<T>(storeId: string, options: Options): Promise<T> 通过指定Options和storeId,创建并获取分布式键值数据库,使用Promise异步回调。 @@ -400,7 +399,6 @@ getKVStore<T >(storeId: string, options: Options): Promise<T> ```js let kvStore; -let kvManager; try { const options = { createIfMissing: true, @@ -411,13 +409,13 @@ try { securityLevel: distributedKVStore.SecurityLevel.S2, }; kvManager.getKVStore('storeId', options).then((store) => { - console.log("Succeeded in getting KVStore"); + console.info("Succeeded in getting KVStore"); kvStore = store; }).catch((err) => { - console.error(`Fail to get KVStore.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get KVStore.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.log(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -440,8 +438,6 @@ closeKVStore(appId: string, storeId: string, callback: AsyncCallback<void> **示例:** ```js -let kvStore; -let kvManager; const options = { createIfMissing: true, encrypt: false, @@ -453,14 +449,20 @@ const options = { } try { kvManager.getKVStore('storeId', options, async function (err, store) { - console.log('Succeeded in getting KVStore'); + if (err != undefined) { + console.error(`Failed to get KVStore.code is ${err.code},message is ${err.message}`); + return; + } + console.info('Succeeded in getting KVStore'); kvStore = store; + kvStore = null; + store = null; kvManager.closeKVStore('appId', 'storeId', function (err, data) { if (err != undefined) { - console.error(`Fail to close KVStore.code is ${err.code},message is ${err.message}`); + console.error(`Failed to close KVStore.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in closing KVStore'); + console.info('Succeeded in closing KVStore'); }); }); } catch (e) { @@ -492,8 +494,6 @@ closeKVStore(appId: string, storeId: string): Promise<void> **示例:** ```js -let kvManager; -let kvStore; const options = { createIfMissing: true, encrypt: false, @@ -505,18 +505,20 @@ const options = { } try { kvManager.getKVStore('storeId', options).then(async (store) => { - console.log('Succeeded in getting KVStore'); + console.info('Succeeded in getting KVStore'); kvStore = store; + kvStore = null; + store = null; kvManager.closeKVStore('appId', 'storeId').then(() => { - console.log('Succeeded in closing KVStore'); + console.info('Succeeded in closing KVStore'); }).catch((err) => { - console.error(`Fail to close KVStore.code is ${err.code},message is ${err.message}`); + console.error(`Failed to close KVStore.code is ${err.code},message is ${err.message}`); }); }).catch((err) => { - console.error(`Fail to get KVStore.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get KVStore.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`Fail to close KVStore.code is ${e.code},message is ${e.message}`); + console.error(`Failed to close KVStore.code is ${e.code},message is ${e.message}`); } ``` @@ -547,8 +549,6 @@ deleteKVStore(appId: string, storeId: string, callback: AsyncCallback<void> **示例:** ```js -let kvManager; -let kvStore; const options = { createIfMissing: true, encrypt: false, @@ -561,21 +561,23 @@ const options = { try { kvManager.getKVStore('store', options, async function (err, store) { if (err != undefined) { - console.error(`Fail to get KVStore.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get KVStore.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in getting KVStore'); + console.info('Succeeded in getting KVStore'); kvStore = store; + kvStore = null; + store = null; kvManager.deleteKVStore('appId', 'storeId', function (err, data) { if (err != undefined) { - console.error(`Fail to delete KVStore.code is ${err.code},message is ${err.message}`); + console.error(`Failed to delete KVStore.code is ${err.code},message is ${err.message}`); return; } - console.log(`Succeeded in deleting KVStore`); + console.info(`Succeeded in deleting KVStore`); }); }); } catch (e) { - console.error(`Fail to delete KVStore.code is ${e.code},message is ${e.message}`); + console.error(`Failed to delete KVStore.code is ${e.code},message is ${e.message}`); } ``` @@ -611,8 +613,6 @@ deleteKVStore(appId: string, storeId: string): Promise<void> **示例:** ```js -let kvManager; -let kvStore; const options = { createIfMissing: true, encrypt: false, @@ -624,18 +624,20 @@ const options = { } try { kvManager.getKVStore('storeId', options).then(async (store) => { - console.log('Succeeded in getting KVStore'); + console.info('Succeeded in getting KVStore'); kvStore = store; + kvStore = null; + store = null; kvManager.deleteKVStore('appId', 'storeId').then(() => { - console.log('Succeeded in deleting KVStore'); + console.info('Succeeded in deleting KVStore'); }).catch((err) => { - console.error(`Fail to delete KVStore.code is ${err.code},message is ${err.message}`); + console.error(`Failed to delete KVStore.code is ${err.code},message is ${err.message}`); }); }).catch((err) => { - console.error(`Fail to get KVStore.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get KVStore.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`Fail to delete KVStore.code is ${e.code},message is ${e.message}`); + console.error(`Failed to delete KVStore.code is ${e.code},message is ${e.message}`); } ``` @@ -657,18 +659,17 @@ getAllKVStoreId(appId: string, callback: AsyncCallback<string[]>): void **示例:** ```js -let kvManager; try { kvManager.getAllKVStoreId('appId', function (err, data) { if (err != undefined) { - console.error(`Fail to get AllKVStoreId.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get AllKVStoreId.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in getting AllKVStoreId'); - console.log(`GetAllKVStoreId size = ${data.length}`); + console.info('Succeeded in getting AllKVStoreId'); + console.info(`GetAllKVStoreId size = ${data.length}`); }); } catch (e) { - console.error(`Fail to get AllKVStoreId.code is ${e.code},message is ${e.message}`); + console.error(`Failed to get AllKVStoreId.code is ${e.code},message is ${e.message}`); } ``` @@ -695,17 +696,16 @@ getAllKVStoreId(appId: string): Promise<string[]> **示例:** ```js -let kvManager; try { - console.log('GetAllKVStoreId'); + console.info('GetAllKVStoreId'); kvManager.getAllKVStoreId('appId').then((data) => { - console.log('Succeeded in getting AllKVStoreId'); - console.log(`GetAllKVStoreId size = ${data.length}`); + console.info('Succeeded in getting AllKVStoreId'); + console.info(`GetAllKVStoreId size = ${data.length}`); }).catch((err) => { - console.error(`Fail to get AllKVStoreId.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get AllKVStoreId.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`Fail to get AllKVStoreId.code is ${e.code},message is ${e.message}`); + console.error(`Failed to get AllKVStoreId.code is ${e.code},message is ${e.message}`); } ``` @@ -713,7 +713,7 @@ try { on(event: 'distributedDataServiceDie', deathCallback: Callback<void>): void -订阅服务状态变更通知。 +订阅服务状态变更通知。如果服务终止,需要重新注册数据变更通知和同步完成事件回调通知,并且同步操作会返回失败。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -727,15 +727,14 @@ on(event: 'distributedDataServiceDie', deathCallback: Callback<void>): voi **示例:** ```js -let kvManager; try { - console.log('KVManagerOn'); + console.info('KVManagerOn'); const deathCallback = function () { - console.log('death callback call'); + console.info('death callback call'); } kvManager.on('distributedDataServiceDie', deathCallback); } catch (e) { - console.log(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -743,7 +742,7 @@ try { off(event: 'distributedDataServiceDie', deathCallback?: Callback<void>): void -取消订阅服务状态变更通知。 +取消订阅服务状态变更通知。参数中的deathCallback必须是已经订阅过的deathCallback,否则会取消订阅失败。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -752,26 +751,25 @@ off(event: 'distributedDataServiceDie', deathCallback?: Callback<void>): v | 参数名 | 类型 | 必填 | 说明 | | ------------- | -------------------- | ---- | ------------------------------------------------------------ | | event | string | 是 | 取消订阅的事件名,固定为'distributedDataServiceDie',即服务状态变更事件。 | -| deathCallback | Callback<void> | 否 | 回调函数。 | +| deathCallback | Callback<void> | 否 | 回调函数。如果该参数不填,那么会将之前订阅过的所有的deathCallback取消订阅。 | **示例:** ```js -let kvManager; try { - console.log('KVManagerOff'); + console.info('KVManagerOff'); const deathCallback = function () { - console.log('death callback call'); + console.info('death callback call'); } kvManager.off('distributedDataServiceDie', deathCallback); } catch (e) { - console.log(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` ## KVStoreResultSet -提供获取数据库结果集的相关方法,包括查询和移动数据读取位置等。 +提供获取数据库结果集的相关方法,包括查询和移动数据读取位置等。同时允许打开的结果集的最大数量为8个。 在调用KVStoreResultSet的方法前,需要先通过[getKVStore](#getkvstore)构建一个SingleKVStore或者DeviceKVStore实例。 @@ -792,19 +790,19 @@ getCount(): number **示例:** ```js -let kvStore; try { let resultSet; + let count; kvStore.getResultSet('batch_test_string_key').then((result) => { - console.log('getResultSet succeed.'); + console.info('getResultSet succeed.'); resultSet = result; + count = resultSet.getCount(); + console.info("getCount succeed:" + count); }).catch((err) => { - console.log('getResultSet failed: ' + err); + console.error('getResultSet failed: ' + err); }); - const count = resultSet.getCount(); - console.log("getCount succeed:" + count); } catch (e) { - console.log("getCount failed: " + e); + console.error("getCount failed: " + e); } ``` @@ -812,7 +810,7 @@ try { getPosition(): number -获取结果集中当前的读取位置。 +获取结果集中当前的读取位置。读取位置会因[moveToFirst](#movetofirst)、[moveToLast](#movetolast)等操作而发生变化。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.Core @@ -820,24 +818,24 @@ getPosition(): number | 类型 | 说明 | | ------ | ------------------ | -| number | 返回当前读取位置。 | +| number | 返回当前读取位置。取值范围>= -1,值为 -1 时表示还未开始读取,值为 0 时表示第一行。 | **示例:** ```js -let kvStore; try { let resultSet; + let position; kvStore.getResultSet('batch_test_string_key').then((result) => { - console.log('getResultSet succeeded.'); + console.info('getResultSet succeeded.'); resultSet = result; + position = resultSet.getPosition(); + console.info("getPosition succeed:" + position); }).catch((err) => { - console.log('getResultSet failed: ' + err); + console.error('getResultSet failed: ' + err); }); - const position = resultSet.getPosition(); - console.log("getPosition succeed:" + position); } catch (e) { - console.log("getPosition failed: " + e); + console.error("getPosition failed: " + e); } ``` @@ -858,19 +856,19 @@ moveToFirst(): boolean **示例:** ```js -let kvStore; try { let resultSet; + let moved; kvStore.getResultSet('batch_test_string_key').then((result) => { - console.log('getResultSet succeed.'); + console.info('getResultSet succeed.'); resultSet = result; + moved = resultSet.moveToFirst(); + console.info("moveToFirst succeed: " + moved); }).catch((err) => { - console.log('getResultSet failed: ' + err); + console.error('getResultSet failed: ' + err); }); - const moved1 = resultSet.moveToFirst(); - console.log("moveToFirst succeed: " + moved1); } catch (e) { - console.log("moveToFirst failed " + e); + console.error("moveToFirst failed " + e); } ``` @@ -891,19 +889,19 @@ moveToLast(): boolean **示例:** ```js -let kvStore; try { let resultSet; + let moved; kvStore.getResultSet('batch_test_string_key').then((result) => { - console.log('getResultSet succeed.'); + console.info('getResultSet succeed.'); resultSet = result; + moved = resultSet.moveToLast(); + console.info("moveToLast succeed:" + moved); }).catch((err) => { - console.log('getResultSet failed: ' + err); + console.error('getResultSet failed: ' + err); }); - const moved2 = resultSet.moveToLast(); - console.log("moveToLast succeed:" + moved2); } catch (e) { - console.log("moveToLast failed: " + e); + console.error("moveToLast failed: " + e); } ``` @@ -911,7 +909,7 @@ try { moveToNext(): boolean -将读取位置移动到下一行。如果结果集为空,则返回false。 +将读取位置移动到下一行。如果结果集为空,则返回false。适用于全量获取数据库结果集的场景。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.Core @@ -924,19 +922,22 @@ moveToNext(): boolean **示例:** ```js -let kvStore; try { let resultSet; + let moved; kvStore.getResultSet('batch_test_string_key').then((result) => { - console.log('getResultSet succeed.'); + console.info('getResultSet succeed.'); resultSet = result; + do { + moved = resultSet.moveToNext(); + const entry = resultSet.getEntry(); + console.info("moveToNext succeed: " + moved); + } while (moved) }).catch((err) => { - console.log('getResultSet failed: ' + err); + console.error('getResultSet failed: ' + err); }); - const moved3 = resultSet.moveToNext(); - console.log("moveToNext succeed: " + moved3); } catch (e) { - console.log("moveToNext failed: " + e); + console.error("moveToNext failed: " + e); } ``` @@ -944,7 +945,7 @@ try { moveToPrevious(): boolean -将读取位置移动到上一行。如果结果集为空,则返回false。 +将读取位置移动到上一行。如果结果集为空,则返回false。适用于全量获取数据库结果集的场景。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.Core @@ -957,19 +958,20 @@ moveToPrevious(): boolean **示例:** ```js -let kvStore; try { let resultSet; + let moved; kvStore.getResultSet('batch_test_string_key').then((result) => { - console.log('getResultSet succeed.'); + console.info('getResultSet succeed.'); resultSet = result; + moved = resultSet.moveToLast(); + moved = resultSet.moveToPrevious(); + console.info("moveToPrevious succeed:" + moved); }).catch((err) => { - console.log('getResultSet failed: ' + err); + console.error('getResultSet failed: ' + err); }); - const moved4 = resultSet.moveToPrevious(); - console.log("moveToPrevious succeed:" + moved4); } catch (e) { - console.log("moveToPrevious failed: " + e); + console.error("moveToPrevious failed: " + e); } ``` @@ -977,7 +979,7 @@ try { move(offset: number): boolean -将读取位置移动到当前位置的相对偏移量。 +将读取位置移动到当前位置的相对偏移量。即当前游标位置向下偏移 offset 行。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.Core @@ -996,19 +998,19 @@ move(offset: number): boolean **示例:** ```js -let kvStore; try { let resultSet; + let moved; kvStore.getResultSet('batch_test_string_key').then((result) => { - console.log('Succeeded in getting resultSet'); + console.info('Succeeded in getting resultSet'); resultSet = result; + moved = resultSet.move(2); //若当前位置为0,将读取位置从绝对位置为0的位置移动2行,即移动到绝对位置为2,行数为3的位置 + console.info(`Succeeded in moving.moved = ${moved}`); }).catch((err) => { - console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get resultSet.code is ${err.code},message is ${err.message}`); }); - const moved5 = resultSet.move(1); - console.log(`Succeeded in moving.moved5 = ${moved5}`); } catch (e) { - console.log(`Fail to move.code is ${e.code},message is ${e.message}`); + console.error(`Failed to move.code is ${e.code},message is ${e.message}`); } ``` @@ -1035,19 +1037,19 @@ moveToPosition(position: number): boolean **示例** ```js -let kvStore; try { let resultSet; + let moved; kvStore.getResultSet('batch_test_string_key').then((result) => { - console.log('Succeeded in getting resultSet'); + console.info('Succeeded in getting resultSet'); resultSet = result; + moved = resultSet.moveToPosition(1); + console.info(`Succeeded in moving to position.moved=${moved}`); }).catch((err) => { - console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get resultSet.code is ${err.code},message is ${err.message}`); }); - const moved6 = resultSet.moveToPosition(1); - console.log(`Succeeded in moving to position.moved6=${moved6}`); } catch (e) { - console.error(`Fail to move to position.code is ${e.code},message is ${e.message}`); + console.error(`Failed to move to position.code is ${e.code},message is ${e.message}`); } ``` @@ -1068,19 +1070,19 @@ isFirst(): boolean **示例:** ```js -let kvStore; try { let resultSet; + let isfirst; kvStore.getResultSet('batch_test_string_key').then((result) => { - console.log('getResultSet succeed.'); + console.info('getResultSet succeed.'); resultSet = result; + isfirst = resultSet.isFirst(); + console.info("Check isFirst succeed:" + isfirst); }).catch((err) => { - console.log('getResultSet failed: ' + err); + console.error('getResultSet failed: ' + err); }); - const isfirst = resultSet.isFirst(); - console.log("Check isFirst succeed:" + isfirst); } catch (e) { - console.log("Check isFirst failed: " + e); + console.error("Check isFirst failed: " + e); } ``` @@ -1101,19 +1103,19 @@ isLast(): boolean **示例:** ```js -let kvStore; try { let resultSet; + let islast; kvStore.getResultSet('batch_test_string_key').then((result) => { - console.log('getResultSet succeed.'); + console.info('getResultSet succeed.'); resultSet = result; + islast = resultSet.isLast(); + console.info("Check isLast succeed: " + islast); }).catch((err) => { - console.log('getResultSet failed: ' + err); + console.error('getResultSet failed: ' + err); }); - const islast = resultSet.isLast(); - console.log("Check isLast succeed: " + islast); } catch (e) { - console.log("Check isLast failed: " + e); + console.error("Check isLast failed: " + e); } ``` @@ -1134,19 +1136,18 @@ isBeforeFirst(): boolean **示例:** ```js -let kvStore; try { let resultSet; kvStore.getResultSet('batch_test_string_key').then((result) => { - console.log('getResultSet succeed.'); + console.info('getResultSet succeed.'); resultSet = result; + const isbeforefirst = resultSet.isBeforeFirst(); + console.info("Check isBeforeFirst succeed: " + isbeforefirst); }).catch((err) => { - console.log('getResultSet failed: ' + err); + console.error('getResultSet failed: ' + err); }); - const isbeforefirst = resultSet.isBeforeFirst(); - console.log("Check isBeforeFirst succeed: " + isbeforefirst); } catch (e) { - console.log("Check isBeforeFirst failed: " + e); + console.error("Check isBeforeFirst failed: " + e); } ``` @@ -1167,19 +1168,18 @@ isAfterLast(): boolean **示例:** ```js -let kvStore; try { let resultSet; kvStore.getResultSet('batch_test_string_key').then((result) => { - console.log('getResultSet succeed.'); + console.info('getResultSet succeed.'); resultSet = result; + const isafterlast = resultSet.isAfterLast(); + console.info("Check isAfterLast succeed:" + isafterlast); }).catch((err) => { - console.log('getResultSet failed: ' + err); + console.error('getResultSet failed: ' + err); }); - const isafterlast = resultSet.isAfterLast(); - console.log("Check isAfterLast succeed:" + isafterlast); } catch (e) { - console.log("Check isAfterLast failed: " + e); + console.error("Check isAfterLast failed: " + e); } ``` @@ -1200,25 +1200,24 @@ getEntry(): Entry **示例:** ```js -let kvStore; try { let resultSet; kvStore.getResultSet('batch_test_string_key').then((result) => { - console.log('getResultSet succeed.'); + console.info('getResultSet succeed.'); resultSet = result; + const entry = resultSet.getEntry(); + console.info("getEntry succeed:" + JSON.stringify(entry)); }).catch((err) => { - console.log('getResultSet failed: ' + err); + console.error('getResultSet failed: ' + err); }); - const entry = resultSet.getEntry(); - console.log("getEntry succeed:" + JSON.stringify(entry)); } catch (e) { - console.log("getEntry failed: " + e); + console.error("getEntry failed: " + e); } ``` ## Query -使用谓词表示数据库查询,提供创建Query实例、查询数据库中的数据和添加谓词的方法。 +使用谓词表示数据库查询,提供创建Query实例、查询数据库中的数据和添加谓词的方法。一个Query对象中谓词数量上限为256个。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.Core @@ -1242,7 +1241,7 @@ reset(): Query | 类型 | 说明 | | -------------- | --------------------- | -| [Query](query) | 返回重置的Query对象。 | +| [Query](#query) | 返回重置的Query对象。 | **示例:** @@ -1250,12 +1249,12 @@ reset(): Query try { let query = new distributedKVStore.Query(); query.equalTo("key", "value"); - console.log("query is " + query.getSqlLike()); + console.info("query is " + query.getSqlLike()); query.reset(); - console.log("query is " + query.getSqlLike()); + console.info("query is " + query.getSqlLike()); query = null; } catch (e) { - console.log("simply calls should be ok :" + e); + console.error("simply calls should be ok :" + e); } ``` @@ -1278,7 +1277,7 @@ equalTo(field: string, value: number|string|boolean): Query | 类型 | 说明 | | -------------- | --------------- | -| [Query](query) | 返回Query对象。 | +| [Query](#query) | 返回Query对象。 | **示例:** @@ -1286,7 +1285,7 @@ equalTo(field: string, value: number|string|boolean): Query try { let query = new distributedKVStore.Query(); query.equalTo("field", "value"); - console.log(`query is ${query.getSqlLike()}`); + console.info(`query is ${query.getSqlLike()}`); query = null; } catch (e) { console.error(`duplicated calls should be ok.ode is ${e.code},message is ${e.message}`); @@ -1312,7 +1311,7 @@ notEqualTo(field: string, value: number|string|boolean): Query | 类型 | 说明 | | -------------- | --------------- | -| [Query](query) | 返回Query对象。 | +| [Query](#query) | 返回Query对象。 | **示例:** @@ -1320,7 +1319,7 @@ notEqualTo(field: string, value: number|string|boolean): Query try { let query = new distributedKVStore.Query(); query.notEqualTo("field", "value"); - console.log(`query is ${query.getSqlLike()}`); + console.info(`query is ${query.getSqlLike()}`); query = null; } catch (e) { console.error(`duplicated calls should be ok.code is ${e.code},message is ${e.message}`); @@ -1345,7 +1344,7 @@ greaterThan(field: string, value: number|string|boolean): Query | 类型 | 说明 | | -------------- | --------------- | -| [Query](query) | 返回Query对象。 | +| [Query](#query) | 返回Query对象。 | **示例:** @@ -1353,7 +1352,7 @@ greaterThan(field: string, value: number|string|boolean): Query try { let query = new distributedKVStore.Query(); query.greaterThan("field", "value"); - console.log(`query is ${query.getSqlLike()}`); + console.info(`query is ${query.getSqlLike()}`); query = null; } catch (e) { console.error(`duplicated calls should be ok.code is ${e.code},message is ${e.message}`); @@ -1380,7 +1379,7 @@ lessThan(field: string, value: number|string): Query | 类型 | 说明 | | -------------- | --------------- | -| [Query](query) | 返回Query对象。 | +| [Query](#query) | 返回Query对象。 | **示例:** @@ -1388,7 +1387,7 @@ lessThan(field: string, value: number|string): Query try { let query = new distributedKVStore.Query(); query.lessThan("field", "value"); - console.log(`query is ${query.getSqlLike()}`); + console.info(`query is ${query.getSqlLike()}`); query = null; } catch (e) { console.error(`duplicated calls should be ok.code is ${e.code},message is ${e.message}`); @@ -1415,7 +1414,7 @@ greaterThanOrEqualTo(field: string, value: number|string): Query | 类型 | 说明 | | -------------- | --------------- | -| [Query](query) | 返回Query对象。 | +| [Query](#query) | 返回Query对象。 | **示例:** @@ -1423,7 +1422,7 @@ greaterThanOrEqualTo(field: string, value: number|string): Query try { let query = new distributedKVStore.Query(); query.greaterThanOrEqualTo("field", "value"); - console.log(`query is ${query.getSqlLike()}`); + console.info(`query is ${query.getSqlLike()}`); query = null; } catch (e) { console.error(`duplicated calls should be ok.code is ${e.code},message is ${e.message}`); @@ -1450,7 +1449,7 @@ lessThanOrEqualTo(field: string, value: number|string): Query | 类型 | 说明 | | -------------- | --------------- | -| [Query](query) | 返回Query对象。 | +| [Query](#query) | 返回Query对象。 | **示例:** @@ -1458,7 +1457,7 @@ lessThanOrEqualTo(field: string, value: number|string): Query try { let query = new distributedKVStore.Query(); query.lessThanOrEqualTo("field", "value"); - console.log(`query is ${query.getSqlLike()}`); + console.info(`query is ${query.getSqlLike()}`); query = null; } catch (e) { console.error(`duplicated calls should be ok.code is ${e.code},message is ${e.message}`); @@ -1483,7 +1482,7 @@ isNull(field: string): Query | 类型 | 说明 | | -------------- | --------------- | -| [Query](query) | 返回Query对象。 | +| [Query](#query) | 返回Query对象。 | **示例:** @@ -1491,7 +1490,7 @@ isNull(field: string): Query try { let query = new distributedKVStore.Query(); query.isNull("field"); - console.log(`query is ${query.getSqlLike()}`); + console.info(`query is ${query.getSqlLike()}`); query = null; } catch (e) { console.error(`duplicated calls should be ok.code is ${e.code},message is ${e.message}`); @@ -1517,7 +1516,7 @@ inNumber(field: string, valueList: number[]): Query | 类型 | 说明 | | -------------- | --------------- | -| [Query](query) | 返回Query对象。 | +| [Query](#query) | 返回Query对象。 | **示例:** @@ -1525,7 +1524,7 @@ inNumber(field: string, valueList: number[]): Query try { let query = new distributedKVStore.Query(); query.inNumber("field", [0, 1]); - console.log(`query is ${query.getSqlLike()}`); + console.info(`query is ${query.getSqlLike()}`); query = null; } catch (e) { console.error(`duplicated calls should be ok.code is ${e.code},message is ${e.message}`); @@ -1551,7 +1550,7 @@ inString(field: string, valueList: string[]): Query | 类型 | 说明 | | -------------- | --------------- | -| [Query](query) | 返回Query对象。 | +| [Query](#query) | 返回Query对象。 | **示例:** @@ -1559,7 +1558,7 @@ inString(field: string, valueList: string[]): Query try { let query = new distributedKVStore.Query(); query.inString("field", ['test1', 'test2']); - console.log(`query is ${query.getSqlLike()}`); + console.info(`query is ${query.getSqlLike()}`); query = null; } catch (e) { console.error(`duplicated calls should be ok.code is ${e.code},message is ${e.message}`); @@ -1585,7 +1584,7 @@ notInNumber(field: string, valueList: number[]): Query | 类型 | 说明 | | -------------- | --------------- | -| [Query](query) | 返回Query对象。 | +| [Query](#query) | 返回Query对象。 | **示例:** @@ -1593,7 +1592,7 @@ notInNumber(field: string, valueList: number[]): Query try { let query = new distributedKVStore.Query(); query.notInNumber("field", [0, 1]); - console.log(`query is ${query.getSqlLike()}`); + console.info(`query is ${query.getSqlLike()}`); query = null; } catch (e) { console.error(`duplicated calls should be ok.code is ${e.code},message is ${e.message}`); @@ -1619,7 +1618,7 @@ notInString(field: string, valueList: string[]): Query | 类型 | 说明 | | -------------- | --------------- | -| [Query](query) | 返回Query对象。 | +| [Query](#query) | 返回Query对象。 | **示例:** @@ -1627,7 +1626,7 @@ notInString(field: string, valueList: string[]): Query try { let query = new distributedKVStore.Query(); query.notInString("field", ['test1', 'test2']); - console.log(`query is ${query.getSqlLike()}`); + console.info(`query is ${query.getSqlLike()}`); query = null; } catch (e) { console.error(`duplicated calls should be ok.code is ${e.code},message is ${e.message}`); @@ -1653,7 +1652,7 @@ like(field: string, value: string): Query | 类型 | 说明 | | -------------- | --------------- | -| [Query](query) | 返回Query对象。 | +| [Query](#query) | 返回Query对象。 | **示例:** @@ -1661,7 +1660,7 @@ like(field: string, value: string): Query try { let query = new distributedKVStore.Query(); query.like("field", "value"); - console.log(`query is ${query.getSqlLike()}`); + console.info(`query is ${query.getSqlLike()}`); query = null; } catch (e) { console.error(`duplicated calls should be ok.code is ${e.code},message is ${e.message}`); @@ -1687,7 +1686,7 @@ unlike(field: string, value: string): Query | 类型 | 说明 | | -------------- | --------------- | -| [Query](query) | 返回Query对象。 | +| [Query](#query) | 返回Query对象。 | **示例:** @@ -1695,7 +1694,7 @@ unlike(field: string, value: string): Query try { let query = new distributedKVStore.Query(); query.unlike("field", "value"); - console.log(`query is ${query.getSqlLike()}`); + console.info(`query is ${query.getSqlLike()}`); query = null; } catch (e) { console.error(`duplicated calls should be ok.code is ${e.code},message is ${e.message}`); @@ -1714,7 +1713,7 @@ and(): Query | 类型 | 说明 | | -------------- | -------------- | -| [Query](query) | 返回查询对象。 | +| [Query](#query) | 返回查询对象。 | **示例:** @@ -1724,10 +1723,10 @@ try { query.notEqualTo("field", "value1"); query.and(); query.notEqualTo("field", "value2"); - console.log("query is " + query.getSqlLike()); + console.info("query is " + query.getSqlLike()); query = null; } catch (e) { - console.log("duplicated calls should be ok :" + e); + console.error("duplicated calls should be ok :" + e); } ``` @@ -1743,7 +1742,7 @@ or(): Query | 类型 | 说明 | | -------------- | -------------- | -| [Query](query) | 返回查询对象。 | +| [Query](#query) | 返回查询对象。 | **示例:** @@ -1753,10 +1752,10 @@ try { query.notEqualTo("field", "value1"); query.or(); query.notEqualTo("field", "value2"); - console.log("query is " + query.getSqlLike()); + console.info("query is " + query.getSqlLike()); query = null; } catch (e) { - console.log("duplicated calls should be ok :" + e); + console.error("duplicated calls should be ok :" + e); } ``` @@ -1778,7 +1777,7 @@ orderByAsc(field: string): Query | 类型 | 说明 | | -------------- | --------------- | -| [Query](query) | 返回Query对象。 | +| [Query](#query) | 返回Query对象。 | **示例:** @@ -1787,7 +1786,7 @@ try { let query = new distributedKVStore.Query(); query.notEqualTo("field", "value"); query.orderByAsc("field"); - console.log(`query is ${query.getSqlLike()}`); + console.info(`query is ${query.getSqlLike()}`); query = null; } catch (e) { console.error(`duplicated calls should be ok.code is ${e.code},message is ${e.message}`); @@ -1812,7 +1811,7 @@ orderByDesc(field: string): Query | 类型 | 说明 | | -------------- | --------------- | -| [Query](query) | 返回Query对象。 | +| [Query](#query) | 返回Query对象。 | **示例:** @@ -1821,7 +1820,7 @@ try { let query = new distributedKVStore.Query(); query.notEqualTo("field", "value"); query.orderByDesc("field"); - console.log(`query is ${query.getSqlLike()}`); + console.info(`query is ${query.getSqlLike()}`); query = null; } catch (e) { console.error(`duplicated calls should be ok.code is ${e.code},message is ${e.message}`); @@ -1832,7 +1831,7 @@ try { limit(total: number, offset: number): Query -构造一个Query对象来指定结果的数量和开始位置。 +构造一个Query对象来指定结果的数量和开始位置。该接口必须要在Query对象查询和升降序等操作之后调用,调用limit接口后,不可再对Query对象进行查询和升降序等操作。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.Core @@ -1847,7 +1846,7 @@ limit(total: number, offset: number): Query | 类型 | 说明 | | -------------- | --------------- | -| [Query](query) | 返回Query对象。 | +| [Query](#query) | 返回Query对象。 | **示例:** @@ -1858,7 +1857,7 @@ try { let query = new distributedKVStore.Query(); query.notEqualTo("field", "value"); query.limit(total, offset); - console.log(`query is ${query.getSqlLike()}`); + console.info(`query is ${query.getSqlLike()}`); query = null; } catch (e) { console.error(`duplicated calls should be ok.code is ${e.code},message is ${e.message}`); @@ -1883,7 +1882,7 @@ isNotNull(field: string): Query | 类型 | 说明 | | -------------- | --------------- | -| [Query](query) | 返回Query对象。 | +| [Query](#query) | 返回Query对象。 | **示例:** @@ -1891,7 +1890,7 @@ isNotNull(field: string): Query try { let query = new distributedKVStore.Query(); query.isNotNull("field"); - console.log(`query is ${query.getSqlLike()}`); + console.info(`query is ${query.getSqlLike()}`); query = null; } catch (e) { console.error(`duplicated calls should be ok.code is ${e.code},message is ${e.message}`); @@ -1910,7 +1909,7 @@ beginGroup(): Query | 类型 | 说明 | | -------------- | --------------- | -| [Query](query) | 返回Query对象。 | +| [Query](#query) | 返回Query对象。 | **示例:** @@ -1920,10 +1919,10 @@ try { query.beginGroup(); query.isNotNull("field"); query.endGroup(); - console.log("query is " + query.getSqlLike()); + console.info("query is " + query.getSqlLike()); query = null; } catch (e) { - console.log("duplicated calls should be ok :" + e); + console.error("duplicated calls should be ok :" + e); } ``` @@ -1939,7 +1938,7 @@ endGroup(): Query | 类型 | 说明 | | -------------- | --------------- | -| [Query](query) | 返回Query对象。 | +| [Query](#query) | 返回Query对象。 | **示例:** @@ -1949,10 +1948,10 @@ try { query.beginGroup(); query.isNotNull("field"); query.endGroup(); - console.log("query is " + query.getSqlLike()); + console.info("query is " + query.getSqlLike()); query = null; } catch (e) { - console.log("duplicated calls should be ok :" + e); + console.error("duplicated calls should be ok :" + e); } ``` @@ -1974,7 +1973,7 @@ prefixKey(prefix: string): Query | 类型 | 说明 | | -------------- | --------------- | -| [Query](query) | 返回Query对象。 | +| [Query](#query) | 返回Query对象。 | **示例:** @@ -1983,7 +1982,7 @@ try { let query = new distributedKVStore.Query(); query.prefixKey("$.name"); query.prefixKey("0"); - console.log(`query is ${query.getSqlLike()}`); + console.info(`query is ${query.getSqlLike()}`); query = null; } catch (e) { console.error(`duplicated calls should be ok.code is ${e.code},message is ${e.message}`); @@ -2008,7 +2007,7 @@ setSuggestIndex(index: string): Query | 类型 | 说明 | | -------------- | --------------- | -| [Query](query) | 返回Query对象。 | +| [Query](#query) | 返回Query对象。 | **示例:** @@ -2017,7 +2016,7 @@ try { let query = new distributedKVStore.Query(); query.setSuggestIndex("$.name"); query.setSuggestIndex("0"); - console.log(`query is ${query.getSqlLike()}`); + console.info(`query is ${query.getSqlLike()}`); query = null; } catch (e) { console.error(`duplicated calls should be ok.code is ${e.code},message is ${e.message}`); @@ -2029,6 +2028,10 @@ try { deviceId(deviceId:string):Query 添加设备ID作为key的前缀。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync) **系统能力:** SystemCapability.DistributedDataManager.KVStore.Core @@ -2042,7 +2045,7 @@ deviceId(deviceId:string):Query | 类型 | 说明 | | -------------- | --------------- | -| [Query](query) | 返回Query对象。 | +| [Query](#query) | 返回Query对象。 | **示例:** @@ -2050,7 +2053,7 @@ deviceId(deviceId:string):Query try { let query = new distributedKVStore.Query(); query.deviceId("deviceId"); - console.log(`query is ${query.getSqlLike()}`); + console.info(`query is ${query.getSqlLike()}`); } catch (e) { console.error(`duplicated calls should be ok.code is ${e.code},message is ${e.message}`); } @@ -2076,9 +2079,9 @@ getSqlLike():string try { let query = new distributedKVStore.Query(); let sql1 = query.getSqlLike(); - console.log(`GetSqlLike sql= ${sql1}`); + console.info(`GetSqlLike sql= ${sql1}`); } catch (e) { - console.log("duplicated calls should be ok : " + e); + console.error("duplicated calls should be ok : " + e); } ``` @@ -2108,24 +2111,29 @@ put(key: string, value: Uint8Array | string | number | boolean, callback: AsyncC 以下错误码的详细介绍请参见[分布式键值数据库错误码](../errorcodes/errorcode-distributedKVStore.md)。 -| **错误码ID** | **错误信息** | -| ------------ | -------------------------------------- | -| 15100003 | Database corrupted. | -| 15100005 | Database or result set already closed. | +| **错误码ID** | **错误信息** | +| ------------ | ---------------------------------------- | +| 15100003 | Database corrupted. | +| 15100005 | Database or result set already closed. | + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | -------------------------------------------- | +| 14800047 | The WAL file size exceeds the default limit. | **示例:** ```js -let kvStore; const KEY_TEST_STRING_ELEMENT = 'key_test_string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; try { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT, function (err, data) { if (err != undefined) { - console.error(`Fail to put.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put.code is ${err.code},message is ${err.message}`); return; } - console.log("Succeeded in putting"); + console.info("Succeeded in putting"); }); } catch (e) { console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); @@ -2157,22 +2165,27 @@ put(key: string, value: Uint8Array | string | number | boolean): Promise<void 以下错误码的详细介绍请参见[分布式键值数据库错误码](../errorcodes/errorcode-distributedKVStore.md)。 -| **错误码ID** | **错误信息** | -| ------------ | -------------------------------------- | -| 15100003 | Database corrupted. | -| 15100005 | Database or result set already closed. | +| **错误码ID** | **错误信息** | +| ------------ | ---------------------------------------- | +| 15100003 | Database corrupted. | +| 15100005 | Database or result set already closed. | + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | -------------------------------------------- | +| 14800047 | The WAL file size exceeds the default limit. | **示例:** ```js -let kvStore; const KEY_TEST_STRING_ELEMENT = 'key_test_string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; try { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then((data) => { - console.log(`Succeeded in putting.data=${data}`); + console.info(`Succeeded in putting.data=${data}`); }).catch((err) => { - console.error(`Fail to put.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put.code is ${err.code},message is ${err.message}`); }); } catch (e) { console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); @@ -2191,22 +2204,27 @@ putBatch(entries: Entry[], callback: AsyncCallback<void>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------ | ---- | ------------------------ | -| entries | [Entry](#entry)[] | 是 | 表示要批量插入的键值对。 | +| entries | [Entry](#entry)[] | 是 | 表示要批量插入的键值对。一个entries对象中允许的最大条目个数为128个。 | | callback | AsyncCallback<void> | 是 | 回调函数。 | **错误码:** 以下错误码的详细介绍请参见[分布式键值数据库错误码](../errorcodes/errorcode-distributedKVStore.md)。 -| **错误码ID** | **错误信息** | -| ------------ | -------------------------------------- | -| 15100003 | Database corrupted. | -| 15100005 | Database or result set already closed. | +| **错误码ID** | **错误信息** | +| ------------ | ---------------------------------------- | +| 15100003 | Database corrupted. | +| 15100005 | Database or result set already closed. | + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | -------------------------------------------- | +| 14800047 | The WAL file size exceeds the default limit. | **示例:** ```js -let kvStore; try { let entries = []; for (var i = 0; i < 10; i++) { @@ -2220,20 +2238,20 @@ try { } entries.push(entry); } - console.log(`entries: ${entries}`); + console.info(`entries: ${entries}`); kvStore.putBatch(entries, async function (err, data) { if (err != undefined) { - console.error(`Fail to put Batch.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put Batch.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in putting Batch'); + console.info('Succeeded in putting Batch'); kvStore.getEntries('batch_test_string_key', function (err, entries) { if (err != undefined) { - console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get Entries.code is ${err.code},message is ${err.message}`); } - console.log('Succeeded in getting Entries'); - console.log(`entries.length: ${entries.length}`); - console.log(`entries[0]: ${entries[0]}`); + console.info('Succeeded in getting Entries'); + console.info(`entries.length: ${entries.length}`); + console.info(`entries[0]: ${entries[0]}`); }); }); } catch (e) { @@ -2253,7 +2271,7 @@ putBatch(entries: Entry[]): Promise<void> | 参数名 | 类型 | 必填 | 说明 | | ------- | ----------------- | ---- | ------------------------ | -| entries | [Entry](#entry)[] | 是 | 表示要批量插入的键值对。 | +| entries | [Entry](#entry)[] | 是 | 表示要批量插入的键值对。一个entries对象中允许的最大条目个数为128个。 | **返回值:** @@ -2265,15 +2283,20 @@ putBatch(entries: Entry[]): Promise<void> 以下错误码的详细介绍请参见[分布式键值数据库错误码](../errorcodes/errorcode-distributedKVStore.md)。 -| **错误码ID** | **错误信息** | -| ------------ | -------------------------------------- | -| 15100003 | Database corrupted. | -| 15100005 | Database or result set already closed. | +| **错误码ID** | **错误信息** | +| ------------ | ---------------------------------------- | +| 15100003 | Database corrupted. | +| 15100005 | Database or result set already closed. | + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | -------------------------------------------- | +| 14800047 | The WAL file size exceeds the default limit. | **示例:** ```js -let kvStore; try { let entries = []; for (var i = 0; i < 10; i++) { @@ -2287,17 +2310,17 @@ try { } entries.push(entry); } - console.log(`entries: ${entries}`); + console.info(`entries: ${entries}`); kvStore.putBatch(entries).then(async (entries) => { - console.log('Succeeded in putting Batch'); + console.info('Succeeded in putting Batch'); kvStore.getEntries('batch_test_string_key').then((entries) => { - console.log('Succeeded in getting Entries'); - console.log(`PutBatch ${entries}`); + console.info('Succeeded in getting Entries'); + console.info(`PutBatch ${entries}`); }).catch((err) => { - console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get Entries.code is ${err.code},message is ${err.message}`); }); }).catch((err) => { - console.error(`Fail to put Batch.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put Batch.code is ${err.code},message is ${err.message}`); }); } catch (e) { console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message} `); @@ -2325,15 +2348,20 @@ putBatch(value: Array<ValuesBucket>, callback: AsyncCallback<void>): 以下错误码的详细介绍请参见[分布式键值数据库错误码](../errorcodes/errorcode-distributedKVStore.md)。 -| **错误码ID** | **错误信息** | -| ------------ | -------------------------------------- | -| 15100003 | Database corrupted. | -| 15100005 | Database or result set already closed. | +| **错误码ID** | **错误信息** | +| ------------ | ---------------------------------------- | +| 15100003 | Database corrupted. | +| 15100005 | Database or result set already closed. | + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | -------------------------------------------- | +| 14800047 | The WAL file size exceeds the default limit. | **示例:** ```js -let kvStore; try { let v8Arr = []; let arr = new Uint8Array([4, 5, 6, 7]); @@ -2346,13 +2374,13 @@ try { v8Arr.push(vb3); kvStore.putBatch(v8Arr, async function (err, data) { if (err != undefined) { - console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put batch.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in putting batch'); + console.info('Succeeded in putting batch'); }) } catch (e) { - console.error(`Fail to put batch.code is ${e.code},message is ${e.message}`); + console.error(`Failed to put batch.code is ${e.code},message is ${e.message}`); } ``` @@ -2382,15 +2410,20 @@ putBatch(value: Array<ValuesBucket>): Promise<void> 以下错误码的详细介绍请参见[分布式键值数据库错误码](../errorcodes/errorcode-distributedKVStore.md)。 -| **错误码ID** | **错误信息** | -| ------------ | -------------------------------------- | -| 15100003 | Database corrupted. | -| 15100005 | Database or result set already closed. | +| **错误码ID** | **错误信息** | +| ------------ | ---------------------------------------- | +| 15100003 | Database corrupted. | +| 15100005 | Database or result set already closed. | + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | -------------------------------------------- | +| 14800047 | The WAL file size exceeds the default limit. | **示例:** ```js -let kvStore; try { let v8Arr = []; let arr = new Uint8Array([4, 5, 6, 7]); @@ -2402,7 +2435,7 @@ try { v8Arr.push(vb2); v8Arr.push(vb3); kvStore.putBatch(v8Arr).then(async (data) => { - console.log(`Succeeded in putting patch`); + console.info(`Succeeded in putting patch`); }).catch((err) => { console.error(`putBatch fail.code is ${err.code},message is ${err.message}`); }); @@ -2435,25 +2468,30 @@ delete(key: string, callback: AsyncCallback<void>): void | 15100003 | Database corrupted. | | 15100005 | Database or result set already closed. | +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | -------------------------------------------- | +| 14800047 | The WAL file size exceeds the default limit. | + **示例:** ```js -let kvStore; const KEY_TEST_STRING_ELEMENT = 'key_test_string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; try { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT, function (err, data) { if (err != undefined) { - console.error(`Fail to put.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in putting'); + console.info('Succeeded in putting'); kvStore.delete(KEY_TEST_STRING_ELEMENT, function (err, data) { if (err != undefined) { - console.error(`Fail to delete.code is ${err.code},message is ${err.message}`); + console.error(`Failed to delete.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in deleting'); + console.info('Succeeded in deleting'); }); }); } catch (e) { @@ -2485,27 +2523,32 @@ delete(key: string): Promise<void> 以下错误码的详细介绍请参见[分布式键值数据库错误码](../errorcodes/errorcode-distributedKVStore.md)。 -| **错误码ID** | **错误信息** | -| ------------ | -------------------------------------- | -| 15100003 | Database corrupted. | -| 15100005 | Database or result set already closed. | +| **错误码ID** | **错误信息** | +| ------------ | ---------------------------------------- | +| 15100003 | Database corrupted. | +| 15100005 | Database or result set already closed. | + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | -------------------------------------------- | +| 14800047 | The WAL file size exceeds the default limit. | **示例:** ```js -let kvStore; const KEY_TEST_STRING_ELEMENT = 'key_test_string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; try { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then((data) => { - console.log(`Succeeded in putting: ${data}`); + console.info(`Succeeded in putting: ${data}`); kvStore.delete(KEY_TEST_STRING_ELEMENT).then((data) => { - console.log('Succeeded in deleting'); + console.info('Succeeded in deleting'); }).catch((err) => { - console.error(`Fail to delete.code is ${err.code},message is ${err.message}`); + console.error(`Failed to delete.code is ${err.code},message is ${err.message}`); }); }).catch((err) => { - console.error(`Fail to put.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put.code is ${err.code},message is ${err.message}`); }); } catch (e) { console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); @@ -2526,7 +2569,7 @@ delete(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallb | 参数名 | 类型 | 必填 | 说明 | | ---------- | ------------------------------------------------------------ | ---- | ----------------------------------------------- | -| predicates | [dataSharePredicates.DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | 是 | 指示筛选条件,当此参数为null时,应定义处理逻辑。 | +| predicates | [dataSharePredicates.DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | 是 | 指示筛选条件,当此参数为null时,应定义处理逻辑。 | | callback | AsyncCallback<void> | 是 | 回调函数。 | **错误码:** @@ -2538,19 +2581,33 @@ delete(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallb | 15100003 | Database corrupted. | | 15100005 | Database or result set already closed. | +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | -------------------------------------------- | +| 14800047 | The WAL file size exceeds the default limit. | + **示例:** ```js import dataSharePredicates from '@ohos.data.dataSharePredicates'; -let kvStore; try { let predicates = new dataSharePredicates.DataSharePredicates(); - kvStore.delete(predicates, function (err, data) { - if (err == undefined) { - console.log('Succeeded in deleting'); - } else { - console.error(`Fail to delete.code is ${err.code},message is ${err.message}`); + let arr = ["name"]; + predicates.inKeys(arr); + kvStore.put("name", "bob", function (err, data) { + if (err != undefined) { + console.error(`Failed to put.code is ${err.code},message is ${err.message}`); + return; } + console.info("Succeeded in putting"); + kvStore.delete(predicates, function (err, data) { + if (err == undefined) { + console.info('Succeeded in deleting'); + } else { + console.error(`Failed to delete.code is ${err.code},message is ${err.message}`); + } + }); }); } catch (e) { console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); @@ -2583,30 +2640,35 @@ delete(predicates: dataSharePredicates.DataSharePredicates): Promise<void> 以下错误码的详细介绍请参见[分布式键值数据库错误码](../errorcodes/errorcode-distributedKVStore.md)。 -| **错误码ID** | **错误信息** | -| ------------ | -------------------------------------- | -| 15100003 | Database corrupted. | -| 15100005 | Database or result set already closed. | +| **错误码ID** | **错误信息** | +| ------------ | ---------------------------------------- | +| 15100003 | Database corrupted. | +| 15100005 | Database or result set already closed. | + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | -------------------------------------------- | +| 14800047 | The WAL file size exceeds the default limit. | **示例:** ```js import dataSharePredicates from '@ohos.data.dataSharePredicates'; -let kvStore; try { let predicates = new dataSharePredicates.DataSharePredicates(); let arr = ["name"]; predicates.inKeys(arr); kvStore.put("name", "bob").then((data) => { - console.log(`Succeeded in putting: ${data}`); + console.info(`Succeeded in putting: ${data}`); kvStore.delete(predicates).then((data) => { - console.log('Succeeded in deleting'); + console.info('Succeeded in deleting'); }).catch((err) => { - console.error(`Fail to delete.code is ${err.code},message is ${err.message}`); + console.error(`Failed to delete.code is ${err.code},message is ${err.message}`); }); }).catch((err) => { - console.error(`Fail to put.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put.code is ${err.code},message is ${err.message}`); }); } catch (e) { console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); @@ -2632,15 +2694,20 @@ deleteBatch(keys: string[], callback: AsyncCallback<void>): void 以下错误码的详细介绍请参见[分布式键值数据库错误码](../errorcodes/errorcode-distributedKVStore.md)。 -| **错误码ID** | **错误信息** | -| ------------ | -------------------------------------- | -| 15100003 | Database corrupted. | -| 15100005 | Database or result set already closed. | +| **错误码ID** | **错误信息** | +| ------------ | ---------------------------------------- | +| 15100003 | Database corrupted. | +| 15100005 | Database or result set already closed. | + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | -------------------------------------------- | +| 14800047 | The WAL file size exceeds the default limit. | **示例:** ```js -let kvStore; try { let entries = []; let keys = []; @@ -2656,19 +2723,19 @@ try { entries.push(entry); keys.push(key + i); } - console.log(`entries: ${entries}`); + console.info(`entries: ${entries}`); kvStore.putBatch(entries, async function (err, data) { if (err != undefined) { - console.error(`Fail to put Batch.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put Batch.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in putting Batch'); + console.info('Succeeded in putting Batch'); kvStore.deleteBatch(keys, async function (err, data) { if (err != undefined) { - console.error(`Fail to delete Batch.code is ${err.code},message is ${err.message}`); + console.error(`Failed to delete Batch.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in deleting Batch'); + console.info('Succeeded in deleting Batch'); }); }); } catch (e) { @@ -2700,15 +2767,20 @@ deleteBatch(keys: string[]): Promise<void> 以下错误码的详细介绍请参见[分布式键值数据库错误码](../errorcodes/errorcode-distributedKVStore.md)。 -| **错误码ID** | **错误信息** | -| ------------ | -------------------------------------- | -| 15100003 | Database corrupted. | -| 15100005 | Database or result set already closed. | +| **错误码ID** | **错误信息** | +| ------------ | ---------------------------------------- | +| 15100003 | Database corrupted. | +| 15100005 | Database or result set already closed. | + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | -------------------------------------------- | +| 14800047 | The WAL file size exceeds the default limit. | **示例:** ```js -let kvStore; try { let entries = []; let keys = []; @@ -2724,19 +2796,19 @@ try { entries.push(entry); keys.push(key + i); } - console.log(`entries: ${entries}`); + console.info(`entries: ${entries}`); kvStore.putBatch(entries).then(async (data) => { - console.log('Succeeded in putting Batch'); + console.info('Succeeded in putting Batch'); kvStore.deleteBatch(keys).then((err) => { - console.log('Succeeded in deleting Batch'); + console.info('Succeeded in deleting Batch'); }).catch((err) => { - console.error(`Fail to delete Batch.code is ${err.code},message is ${err.message}`); + console.error(`Failed to delete Batch.code is ${err.code},message is ${err.message}`); }); }).catch((err) => { - console.error(`Fail to put Batch.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put Batch.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -2745,6 +2817,10 @@ try { removeDeviceData(deviceId: string, callback: AsyncCallback<void>): void 删除指定设备的数据,使用callback异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync) **系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -2766,26 +2842,25 @@ removeDeviceData(deviceId: string, callback: AsyncCallback<void>): void **示例:** ```js -let kvStore; const KEY_TEST_STRING_ELEMENT = 'key_test_string_2'; const VALUE_TEST_STRING_ELEMENT = 'value-string-002'; try { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT, async function (err, data) { - console.log('Succeeded in putting data'); + console.info('Succeeded in putting data'); const deviceid = 'no_exist_device_id'; kvStore.removeDeviceData(deviceid, async function (err, data) { if (err == undefined) { - console.log('succeeded in removing device data'); + console.info('succeeded in removing device data'); } else { - console.error(`Fail to remove device data.code is ${err.code},message is ${err.message} `); + console.error(`Failed to remove device data.code is ${err.code},message is ${err.message} `); kvStore.get(KEY_TEST_STRING_ELEMENT, async function (err, data) { - console.log('Succeeded in getting data'); + console.info('Succeeded in getting data'); }); } }); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`) + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`) } ``` @@ -2794,6 +2869,10 @@ try { removeDeviceData(deviceId: string): Promise<void> 删除指定设备的数据,使用Promise异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync) **系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -2820,28 +2899,27 @@ removeDeviceData(deviceId: string): Promise<void> **示例:** ```js -let kvStore; const KEY_TEST_STRING_ELEMENT = 'key_test_string_2'; const VALUE_TEST_STRING_ELEMENT = 'value-string-001'; try { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then((err) => { - console.log('Succeeded in putting data'); + console.info('Succeeded in putting data'); }).catch((err) => { - console.error(`Fail to put data.code is ${err.code},message is ${err.message} `); + console.error(`Failed to put data.code is ${err.code},message is ${err.message} `); }); const deviceid = 'no_exist_device_id'; kvStore.removeDeviceData(deviceid).then((err) => { - console.log('succeeded in removing device data'); + console.info('succeeded in removing device data'); }).catch((err) => { - console.error(`Fail to remove device data.code is ${err.code},message is ${err.message} `); + console.error(`Failed to remove device data.code is ${err.code},message is ${err.message} `); }); kvStore.get(KEY_TEST_STRING_ELEMENT).then((data) => { - console.log('Succeeded in getting data'); + console.info('Succeeded in getting data'); }).catch((err) => { - console.error(`Fail to get data.code is ${err.code},message is ${err.message} `); + console.error(`Failed to get data.code is ${err.code},message is ${err.message} `); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`) + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`) } ``` @@ -2873,26 +2951,25 @@ get(key: string, callback: AsyncCallback<boolean | string | number | Uint8Arr **示例:** ```js -let kvStore; const KEY_TEST_STRING_ELEMENT = 'key_test_string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; try { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT, function (err, data) { if (err != undefined) { - console.error(`Fail to put.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put.code is ${err.code},message is ${err.message}`); return; } - console.log("Succeeded in putting"); + console.info("Succeeded in putting"); kvStore.get(KEY_TEST_STRING_ELEMENT, function (err, data) { if (err != undefined) { - console.error(`Fail to get.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get.code is ${err.code},message is ${err.message}`); return; } - console.log(`Succeeded in getting data.data=${data}`); + console.info(`Succeeded in getting data.data=${data}`); }); }); } catch (e) { - console.error(`Fail to get.code is ${e.code},message is ${e.message}`); + console.error(`Failed to get.code is ${e.code},message is ${e.message}`); } ``` @@ -2929,22 +3006,21 @@ get(key: string): Promise<boolean | string | number | Uint8Array> **示例:** ```js -let kvStore; const KEY_TEST_STRING_ELEMENT = 'key_test_string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; try { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then((data) => { - console.log(`Succeeded in putting data.data=${data}`); + console.info(`Succeeded in putting data.data=${data}`); kvStore.get(KEY_TEST_STRING_ELEMENT).then((data) => { - console.log(`Succeeded in getting data.data=${data}`); + console.info(`Succeeded in getting data.data=${data}`); }).catch((err) => { - console.error(`Fail to get.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get.code is ${err.code},message is ${err.message}`); }); }).catch((err) => { - console.error(`Fail to put.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`Fail to get.code is ${e.code},message is ${e.message}`); + console.error(`Failed to get.code is ${e.code},message is ${e.message}`); } ``` @@ -2975,7 +3051,6 @@ getEntries(keyPrefix: string, callback: AsyncCallback<Entry[]>): void **示例:** ```js -let kvStore; try { let entries = []; for (var i = 0; i < 10; i++) { @@ -2989,21 +3064,21 @@ try { } entries.push(entry); } - console.log(`entries: ${entries}`); + console.info(`entries: ${entries}`); kvStore.putBatch(entries, async function (err, data) { if (err != undefined) { - console.error(`Fail to put Batch.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put Batch.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in putting Batch'); + console.info('Succeeded in putting Batch'); kvStore.getEntries('batch_test_string_key', function (err, entries) { if (err != undefined) { - console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get Entries.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in getting Entries'); - console.log(`entries.length: ${entries.length}`); - console.log(`entries[0]: ${entries[0]}`); + console.info('Succeeded in getting Entries'); + console.info(`entries.length: ${entries.length}`); + console.info(`entries[0]: ${entries[0]}`); }); }); } catch (e) { @@ -3043,7 +3118,6 @@ getEntries(keyPrefix: string): Promise<Entry[]> **示例:** ```js -let kvStore; try { let entries = []; for (var i = 0; i < 10; i++) { @@ -3057,17 +3131,17 @@ try { } entries.push(entry); } - console.log(`entries: ${entries}`); + console.info(`entries: ${entries}`); kvStore.putBatch(entries).then(async (entries) => { - console.log('Succeeded in putting Batch'); + console.info('Succeeded in putting Batch'); kvStore.getEntries('batch_test_string_key').then((entries) => { - console.log('Succeeded in getting Entries'); - console.log(`PutBatch ${entries}`); + console.info('Succeeded in getting Entries'); + console.info(`PutBatch ${entries}`); }).catch((err) => { - console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get Entries.code is ${err.code},message is ${err.message}`); }); }).catch((err) => { - console.error(`Fail to put Batch.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put Batch.code is ${err.code},message is ${err.message}`); }); } catch (e) { console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message} `); @@ -3086,7 +3160,7 @@ getEntries(query: Query, callback: AsyncCallback<Entry[]>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------------------------- | ---- | ----------------------------------------------- | -| query | [Query](query) | 是 | 表示要匹配的键前缀。 | +| query | [Query](#query) | 是 | 表示要匹配的键前缀。 | | callback | AsyncCallback<[Entry](#entry)[]> | 是 | 回调函数。返回与指定Query对象匹配的键值对列表。 | **错误码:** @@ -3101,7 +3175,6 @@ getEntries(query: Query, callback: AsyncCallback<Entry[]>): void **示例:** ```js -let kvStore; try { var arr = new Uint8Array([21, 31]); let entries = []; @@ -3116,23 +3189,23 @@ try { } entries.push(entry); } - console.log(`entries: {entries}`); + console.info(`entries: {entries}`); kvStore.putBatch(entries, async function (err, data) { - console.log('Succeeded in putting Batch'); + console.info('Succeeded in putting Batch'); const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getEntries(query, function (err, entries) { if (err != undefined) { - console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get Entries.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in getting Entries'); - console.log(`entries.length: ${entries.length}`); - console.log(`entries[0]: ${entries[0]}`); + console.info('Succeeded in getting Entries'); + console.info(`entries.length: ${entries.length}`); + console.info(`entries[0]: ${entries[0]}`); }); }); } catch (e) { - console.error(`Fail to get Entries.code is ${e.code},message is ${e.message}`); + console.error(`Failed to get Entries.code is ${e.code},message is ${e.message}`); } ``` @@ -3148,7 +3221,7 @@ getEntries(query: Query): Promise<Entry[]> | 参数名 | 类型 | 必填 | 说明 | | ------ | -------------- | ---- | -------------- | -| query | [Query](query) | 是 | 表示查询对象。 | +| query | [Query](#query) | 是 | 表示查询对象。 | **返回值:** @@ -3168,7 +3241,6 @@ getEntries(query: Query): Promise<Entry[]> **示例:** ```js -let kvStore; try { var arr = new Uint8Array([21, 31]); let entries = []; @@ -3183,22 +3255,22 @@ try { } entries.push(entry); } - console.log(`entries: {entries}`); + console.info(`entries: {entries}`); kvStore.putBatch(entries).then(async (err) => { - console.log('Succeeded in putting Batch'); + console.info('Succeeded in putting Batch'); const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getEntries(query).then((entries) => { - console.log('Succeeded in getting Entries'); + console.info('Succeeded in getting Entries'); }).catch((err) => { - console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get Entries.code is ${err.code},message is ${err.message}`); }); }).catch((err) => { - console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`) + console.error(`Failed to get Entries.code is ${err.code},message is ${err.message}`) }); - console.log('Succeeded in getting Entries'); + console.info('Succeeded in getting Entries'); } catch (e) { - console.error(`Fail to get Entries.code is ${e.code},message is ${e.message}`); + console.error(`Failed to get Entries.code is ${e.code},message is ${e.message}`); } ``` @@ -3223,13 +3295,14 @@ getResultSet(keyPrefix: string, callback: AsyncCallback<KVStoreResultSet>) | **错误码ID** | **错误信息** | | ------------ | -------------------------------------- | +| 15100001 | Over max limits. | | 15100003 | Database corrupted. | | 15100005 | Database or result set already closed. | + **示例:** ```js -let kvStore; try { let resultSet; let entries = []; @@ -3246,28 +3319,28 @@ try { } kvStore.putBatch(entries, async function (err, data) { if (err != undefined) { - console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put batch.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in putting batch'); + console.info('Succeeded in putting batch'); kvStore.getResultSet('batch_test_string_key', async function (err, result) { if (err != undefined) { - console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get resultset.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in getting result set'); + console.info('Succeeded in getting result set'); resultSet = result; kvStore.closeResultSet(resultSet, function (err, data) { if (err != undefined) { - console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); + console.error(`Failed to close resultset.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in closing result set'); + console.info('Succeeded in closing result set'); }) }); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -3297,13 +3370,13 @@ getResultSet(keyPrefix: string): Promise<KVStoreResultSet> | **错误码ID** | **错误信息** | | ------------ | -------------------------------------- | +| 15100001 | Over max limits. | | 15100003 | Database corrupted. | | 15100005 | Database or result set already closed. | **示例:** ```js -let kvStore; try { let resultSet; let entries = []; @@ -3319,23 +3392,23 @@ try { entries.push(entry); } kvStore.putBatch(entries).then(async (err) => { - console.log('Succeeded in putting batch'); + console.info('Succeeded in putting batch'); }).catch((err) => { - console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put batch.code is ${err.code},message is ${err.message}`); }); kvStore.getResultSet('batch_test_string_key').then((result) => { - console.log('Succeeded in getting result set'); + console.info('Succeeded in getting result set'); resultSet = result; }).catch((err) => { - console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get resultset.code is ${err.code},message is ${err.message}`); }); kvStore.closeResultSet(resultSet).then((err) => { - console.log('Succeeded in closing result set'); + console.info('Succeeded in closing result set'); }).catch((err) => { - console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); + console.error(`Failed to close resultset.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -3360,13 +3433,13 @@ getResultSet(query: Query, callback: AsyncCallback<KVStoreResultSet>): voi | **错误码ID** | **错误信息** | | ------------ | -------------------------------------- | +| 15100001 | Over max limits. | | 15100003 | Database corrupted. | | 15100005 | Database or result set already closed. | **示例:** ```js -let kvStore; try { let resultSet; let entries = []; @@ -3383,22 +3456,22 @@ try { } kvStore.putBatch(entries, async function (err, data) { if (err != undefined) { - console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put batch.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in putting batch'); + console.info('Succeeded in putting batch'); const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getResultSet(query, async function (err, result) { if (err != undefined) { - console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get resultset.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in getting result set'); + console.info('Succeeded in getting result set'); }); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -3414,7 +3487,7 @@ getResultSet(query: Query): Promise<KVStoreResultSet> | 参数名 | 类型 | 必填 | 说明 | | ------ | -------------- | ---- | -------------- | -| query | [Query](query) | 是 | 表示查询对象。 | +| query | [Query](#query) | 是 | 表示查询对象。 | **返回值:** @@ -3428,13 +3501,13 @@ getResultSet(query: Query): Promise<KVStoreResultSet> | **错误码ID** | **错误信息** | | ------------ | -------------------------------------- | +| 15100001 | Over max limits. | | 15100003 | Database corrupted. | | 15100005 | Database or result set already closed. | **示例:** ```js -let kvStore; try { let resultSet; let entries = []; @@ -3450,20 +3523,20 @@ try { entries.push(entry); } kvStore.putBatch(entries).then(async (err) => { - console.log('Succeeded in putting batch'); + console.info('Succeeded in putting batch'); }).catch((err) => { - console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put batch.code is ${err.code},message is ${err.message}`); }); const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getResultSet(query).then((result) => { - console.log('Succeeded in getting result set'); + console.info('Succeeded in getting result set'); resultSet = result; }).catch((err) => { - console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get resultset.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -3490,6 +3563,7 @@ getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: Asyn | **错误码ID** | **错误信息** | | ------------ | -------------------------------------- | +| 15100001 | Over max limits. | | 15100003 | Database corrupted. | | 15100005 | Database or result set already closed. | @@ -3498,28 +3572,27 @@ getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: Asyn ```js import dataSharePredicates from '@ohos.data.dataSharePredicates'; -let kvStore; try { let resultSet; let predicates = new dataSharePredicates.DataSharePredicates(); predicates.prefixKey("batch_test_string_key"); kvStore.getResultSet(predicates, async function (err, result) { if (err != undefined) { - console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get resultset.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in getting result set'); + console.info('Succeeded in getting result set'); resultSet = result; kvStore.closeResultSet(resultSet, function (err, data) { if (err != undefined) { - console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); + console.error(`Failed to close resultset.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in closing result set'); + console.info('Succeeded in closing result set'); }) }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -3551,6 +3624,7 @@ getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise<KV | **错误码ID** | **错误信息** | | ------------ | -------------------------------------- | +| 15100001 | Over max limits. | | 15100003 | Database corrupted. | | 15100005 | Database or result set already closed. | @@ -3559,24 +3633,23 @@ getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise<KV ```js import dataSharePredicates from '@ohos.data.dataSharePredicates'; -let kvStore; try { let resultSet; let predicates = new dataSharePredicates.DataSharePredicates(); predicates.prefixKey("batch_test_string_key"); kvStore.getResultSet(predicates).then((result) => { - console.log('Succeeded in getting result set'); + console.info('Succeeded in getting result set'); resultSet = result; }).catch((err) => { - console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get resultset.code is ${err.code},message is ${err.message}`); }); kvStore.closeResultSet(resultSet).then((err) => { - console.log('Succeeded in closing result set'); + console.info('Succeeded in closing result set'); }).catch((err) => { - console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); + console.error(`Failed to close resultset.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -3598,18 +3671,17 @@ closeResultSet(resultSet: KVStoreResultSet, callback: AsyncCallback<void>) **示例:** ```js -let kvStore; try { let resultSet = null; kvStore.closeResultSet(resultSet, function (err, data) { if (err == undefined) { - console.log('Succeeded in closing result set'); + console.info('Succeeded in closing result set'); } else { - console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); + console.error(`Failed to close resultset.code is ${err.code},message is ${err.message}`); } }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -3636,16 +3708,15 @@ closeResultSet(resultSet: KVStoreResultSet): Promise<void> **示例:** ```js -let kvStore; try { let resultSet = null; kvStore.closeResultSet(resultSet).then(() => { - console.log('Succeeded in closing result set'); + console.info('Succeeded in closing result set'); }).catch((err) => { - console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); + console.error(`Failed to close resultset.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -3661,7 +3732,7 @@ getResultSize(query: Query, callback: AsyncCallback<number>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------- | ---- | ------------------------------------------- | -| query | [Query](query) | 是 | 表示查询对象。 | +| query | [Query](#query) | 是 | 表示查询对象。 | | callback | AsyncCallback<number> | 是 | 回调函数。返回与指定Query对象匹配的结果数。 | **错误码:** @@ -3676,7 +3747,6 @@ getResultSize(query: Query, callback: AsyncCallback<number>): void **示例:** ```js -let kvStore; try { let entries = []; for (var i = 0; i < 10; i++) { @@ -3691,19 +3761,19 @@ try { entries.push(entry); } kvStore.putBatch(entries, async function (err, data) { - console.log('Succeeded in putting batch'); + console.info('Succeeded in putting batch'); const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getResultSize(query, async function (err, resultSize) { if (err != undefined) { - console.error(`Fail to get result size.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get result size.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in getting result set size'); + console.info('Succeeded in getting result set size'); }); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -3719,7 +3789,7 @@ getResultSize(query: Query): Promise<number> | 参数名 | 类型 | 必填 | 说明 | | ------ | -------------- | ---- | -------------- | -| query | [Query](query) | 是 | 表示查询对象。 | +| query | [Query](#query) | 是 | 表示查询对象。 | **返回值:** @@ -3739,7 +3809,6 @@ getResultSize(query: Query): Promise<number> **示例:** ```js -let kvStore; try { let entries = []; for (var i = 0; i < 10; i++) { @@ -3754,19 +3823,19 @@ try { entries.push(entry); } kvStore.putBatch(entries).then(async (err) => { - console.log('Succeeded in putting batch'); + console.info('Succeeded in putting batch'); }).catch((err) => { - console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put batch.code is ${err.code},message is ${err.message}`); }); const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getResultSize(query).then((resultSize) => { - console.log('Succeeded in getting result set size'); + console.info('Succeeded in getting result set size'); }).catch((err) => { - console.error(`Fail to get result size.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get result size.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -3796,12 +3865,11 @@ backup(file:string, callback: AsyncCallback<void>):void **示例:** ```js -let kvStore; let file = "BK001"; try { kvStore.backup(file, (err, data) => { if (err) { - console.error(`Fail to backup.code is ${err.code},message is ${err.message} `); + console.error(`Failed to backup.code is ${err.code},message is ${err.message} `); } else { console.info(`Succeeded in backupping data.data=${data}`); } @@ -3842,13 +3910,12 @@ backup(file:string): Promise<void> **示例:** ```js -let kvStore; let file = "BK001"; try { kvStore.backup(file).then((data) => { console.info(`Succeeded in backupping data.data=${data}`); }).catch((err) => { - console.error(`Fail to backup.code is ${err.code},message is ${err.message}`); + console.error(`Failed to backup.code is ${err.code},message is ${err.message}`); }); } catch (e) { console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); @@ -3881,12 +3948,11 @@ restore(file:string, callback: AsyncCallback<void>):void **示例:** ```js -let kvStore; let file = "BK001"; try { kvStore.restore(file, (err, data) => { if (err) { - console.error(`Fail to restore.code is ${err.code},message is ${err.message}`); + console.error(`Failed to restore.code is ${err.code},message is ${err.message}`); } else { console.info(`Succeeded in restoring data.data=${data}`); } @@ -3927,13 +3993,12 @@ restore(file:string): Promise<void> **示例:** ```js -let kvStore; let file = "BK001"; try { kvStore.restore(file).then((data) => { console.info(`Succeeded in restoring data.data=${data}`); }).catch((err) => { - console.error(`Fail to restore.code is ${err.code},message is ${err.message}`); + console.error(`Failed to restore.code is ${err.code},message is ${err.message}`); }); } catch (e) { console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); @@ -3958,12 +4023,11 @@ deleteBackup(files:Array<string>, callback: AsyncCallback<Array<[str **示例:** ```js -let kvStore; let files = ["BK001", "BK002"]; try { kvStore.deleteBackup(files, (err, data) => { if (err) { - console.error(`Fail to delete Backup.code is ${err.code},message is ${err.message}`); + console.error(`Failed to delete Backup.code is ${err.code},message is ${err.message}`); } else { console.info(`Succeed in deleting Backup.data=${data}`); } @@ -3996,16 +4060,15 @@ deleteBackup(files:Array<string>): Promise<Array<[string, number]> **示例:** ```js -let kvStore; let files = ["BK001", "BK002"]; try { kvStore.deleteBackup(files).then((data) => { console.info(`Succeed in deleting Backup.data=${data}`); }).catch((err) => { - console.error(`Fail to delete Backup.code is ${err.code},message is ${err.message}`); + console.error(`Failed to delete Backup.code is ${err.code},message is ${err.message}`); }) } catch (e) { - console.log(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -4027,14 +4090,19 @@ startTransaction(callback: AsyncCallback<void>): void 以下错误码的详细介绍请参见[分布式键值数据库错误码](../errorcodes/errorcode-distributedKVStore.md)。 -| **错误码ID** | **错误信息** | -| ------------ | -------------------------------------- | -| 15100005 | Database or result set already closed. | +| **错误码ID** | **错误信息** | +| ------------ | ---------------------------------------- | +| 15100005 | Database or result set already closed. | + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | -------------------------------------------- | +| 14800047 | The WAL file size exceeds the default limit. | **示例:** ```js -let kvStore; function putBatchString(len, prefix) { let entries = []; for (var i = 0; i < len; i++) { @@ -4053,27 +4121,27 @@ function putBatchString(len, prefix) { try { var count = 0; kvStore.on('dataChange', 0, function (data) { - console.log(`startTransaction 0 ${data}`); + console.info(`startTransaction 0 ${data}`); count++; }); kvStore.startTransaction(async function (err, data) { if (err != undefined) { - console.error(`Fail to start Transaction.code is ${err.code},message is ${err.message}`); + console.error(`Failed to start Transaction.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in starting Transaction'); + console.info('Succeeded in starting Transaction'); let entries = putBatchString(10, 'batch_test_string_key'); - console.log(`entries: ${entries}`); + console.info(`entries: ${entries}`); kvStore.putBatch(entries, async function (err, data) { if (err != undefined) { - console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put batch.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in putting Batch'); + console.info('Succeeded in putting Batch'); }); }); } catch (e) { - console.error(`Fail to start Transaction.code is ${e.code},message is ${e.message}`); + console.error(`Failed to start Transaction.code is ${e.code},message is ${e.message}`); } ``` @@ -4095,27 +4163,32 @@ startTransaction(): Promise<void> 以下错误码的详细介绍请参见[分布式键值数据库错误码](../errorcodes/errorcode-distributedKVStore.md)。 -| **错误码ID** | **错误信息** | -| ------------ | -------------------------------------- | -| 15100005 | Database or result set already closed. | +| **错误码ID** | **错误信息** | +| ------------ | ---------------------------------------- | +| 15100005 | Database or result set already closed. | + +以下错误码的详细介绍请参见[关系型数据库错误码](../errorcodes/errorcode-data-rdb.md)。 + +| **错误码ID** | **错误信息** | +| ------------ | -------------------------------------------- | +| 14800047 | The WAL file size exceeds the default limit. | **示例:** ```js -let kvStore; try { var count = 0; kvStore.on('dataChange', distributedKVStore.SubscribeType.SUBSCRIBE_TYPE_ALL, function (data) { - console.log(`startTransaction 0 ${data}`); + console.info(`startTransaction 0 ${data}`); count++; }); kvStore.startTransaction().then(async (err) => { - console.log('Succeeded in starting Transaction'); + console.info('Succeeded in starting Transaction'); }).catch((err) => { - console.error(`Fail to start Transaction.code is ${err.code},message is ${err.message}`); + console.error(`Failed to start Transaction.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`Fail to start Transaction.code is ${e.code},message is ${e.message}`); + console.error(`Failed to start Transaction.code is ${e.code},message is ${e.message}`); } ``` @@ -4144,17 +4217,16 @@ commit(callback: AsyncCallback<void>): void **示例:** ```js -let kvStore; try { kvStore.commit(function (err, data) { if (err == undefined) { - console.log('Succeeded in committing'); + console.info('Succeeded in committing'); } else { - console.error(`Fail to commit.code is ${err.code},message is ${err.message}`); + console.error(`Failed to commit.code is ${err.code},message is ${err.message}`); } }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -4183,15 +4255,14 @@ commit(): Promise<void> **示例:** ```js -let kvStore; try { kvStore.commit().then(async (err) => { - console.log('Succeeded in committing'); + console.info('Succeeded in committing'); }).catch((err) => { - console.error(`Fail to commit.code is ${err.code},message is ${err.message}`); + console.error(`Failed to commit.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.ode is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.ode is ${e.code},message is ${e.message}`); } ``` @@ -4220,17 +4291,16 @@ rollback(callback: AsyncCallback<void>): void **示例:** ```js -let kvStore; try { kvStore.rollback(function (err,data) { if (err == undefined) { - console.log('Succeeded in rolling back'); + console.info('Succeeded in rolling back'); } else { - console.error(`Fail to rollback.code is ${err.code},message is ${err.message}`); + console.error(`Failed to rollback.code is ${err.code},message is ${err.message}`); } }); }catch(e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -4259,15 +4329,14 @@ rollback(): Promise<void> **示例:** ```js -let kvStore; try { kvStore.rollback().then(async (err) => { - console.log('Succeeded in rolling back'); + console.info('Succeeded in rolling back'); }).catch((err) => { - console.error(`Fail to rollback.code is ${err.code},message is ${err.message}`); + console.error(`Failed to rollback.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -4289,17 +4358,16 @@ enableSync(enabled: boolean, callback: AsyncCallback<void>): void **示例:** ```js -let kvStore; try { kvStore.enableSync(true, function (err, data) { if (err == undefined) { - console.log('Succeeded in enabling sync'); + console.info('Succeeded in enabling sync'); } else { - console.error(`Fail to enable sync.code is ${err.code},message is ${err.message}`); + console.error(`Failed to enable sync.code is ${err.code},message is ${err.message}`); } }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -4326,15 +4394,14 @@ enableSync(enabled: boolean): Promise<void> **示例:** ```js -let kvStore; try { kvStore.enableSync(true).then((err) => { - console.log('Succeeded in enabling sync'); + console.info('Succeeded in enabling sync'); }).catch((err) => { - console.error(`Fail to enable sync.code is ${err.code},message is ${err.message}`); + console.error(`Failed to enable sync.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -4357,19 +4424,18 @@ setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: Asy **示例:** ```js -let kvStore; try { const localLabels = ['A', 'B']; const remoteSupportLabels = ['C', 'D']; kvStore.setSyncRange(localLabels, remoteSupportLabels, function (err, data) { if (err != undefined) { - console.error(`Fail to set syncRange.code is ${err.code},message is ${err.message}`); + console.error(`Failed to set syncRange.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in setting syncRange'); + console.info('Succeeded in setting syncRange'); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -4397,17 +4463,16 @@ setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise<v **示例:** ```js -let kvStore; try { const localLabels = ['A', 'B']; const remoteSupportLabels = ['C', 'D']; kvStore.setSyncRange(localLabels, remoteSupportLabels).then((err) => { - console.log('Succeeded in setting syncRange'); + console.info('Succeeded in setting syncRange'); }).catch((err) => { - console.error(`Fail to set syncRange.code is ${err.code},message is ${err.message}`); + console.error(`Failed to set syncRange.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -4429,18 +4494,17 @@ setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback<void>) **示例:** ```js -let kvStore; try { const defaultAllowedDelayMs = 500; kvStore.setSyncParam(defaultAllowedDelayMs, function (err, data) { if (err != undefined) { - console.error(`Fail to set syncParam.code is ${err.code},message is ${err.message}`); + console.error(`Failed to set syncParam.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in setting syncParam'); + console.info('Succeeded in setting syncParam'); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -4467,16 +4531,15 @@ setSyncParam(defaultAllowedDelayMs: number): Promise<void> **示例:** ```js -let kvStore; try { const defaultAllowedDelayMs = 500; kvStore.setSyncParam(defaultAllowedDelayMs).then((err) => { - console.log('Succeeded in setting syncParam'); + console.info('Succeeded in setting syncParam'); }).catch((err) => { - console.error(`Fail to set syncParam.code is ${err.code},message is ${err.message}`); + console.error(`Failed to set syncParam.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -4484,7 +4547,10 @@ try { sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void -在手动同步方式下,触发数据库同步。关于分布式数据服务的同步方式说明,请见[分布式数据服务概述](../../database/database-mdds-overview.md)。 +在手动同步方式下,触发数据库同步。关于键值型数据库的同步方式说明,请见[键值型数据库跨设备数据同步](../../database/data-sync-of-kv-store.md)。 +> **说明:** +> +> 其中deviceIds通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 **需要权限**: ohos.permission.DISTRIBUTED_DATASYNC。 @@ -4510,33 +4576,50 @@ sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void **示例:** ```js -let kvStore; +import deviceManager from '@ohos.distributedHardware.deviceManager'; + +let devManager; const KEY_TEST_SYNC_ELEMENT = 'key_test_sync'; const VALUE_TEST_SYNC_ELEMENT = 'value-string-001'; -try { - kvStore.on('syncComplete', function (data) { - console.log('Sync dataChange'); - }); - kvStore.put(KEY_TEST_SYNC_ELEMENT + 'testSync101', VALUE_TEST_SYNC_ELEMENT, function (err, data) { +// create deviceManager +deviceManager.createDeviceManager('bundleName', (err, value) => { + if (!err) { + devManager = value; + let deviceIds = []; + if (devManager != null) { + var devices = devManager.getTrustedDeviceListSync(); + for (var i = 0; i < devices.length; i++) { + deviceIds[i] = devices[i].deviceId; + } + } + try { + kvStore.on('syncComplete', function (data) { + console.info('Sync dataChange'); + }); + kvStore.put(KEY_TEST_SYNC_ELEMENT + 'testSync101', VALUE_TEST_SYNC_ELEMENT, function (err, data) { if (err != undefined) { - console.error(`Fail to sync.code is ${err.code},message is ${err.message}`); - return; + console.error(`Failed to sync.code is ${err.code},message is ${err.message}`); + return; } - console.log('Succeeded in putting data'); - const devices = ['deviceList']; + console.info('Succeeded in putting data'); const mode = distributedKVStore.SyncMode.PULL_ONLY; - kvStore.sync(devices, mode, 1000); - }); -} catch (e) { - console.error(`Fail to sync.code is ${e.code},message is ${e.message}`); -} + kvStore.sync(deviceIds, mode, 1000); + }); + } catch (e) { + console.error(`Failed to sync.code is ${e.code},message is ${e.message}`); + } + } +}); ``` ### sync sync(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void -在手动同步方式下,触发数据库同步,此方法为同步方法。关于分布式数据服务的同步方式说明,请见[分布式数据服务概述](../../database/database-mdds-overview.md)。 +在手动同步方式下,触发数据库同步,此方法为同步方法。关于键值型数据库的同步方式说明,请见[键值型数据库跨设备数据同步](../../database/data-sync-of-kv-store.md)。 +> **说明:** +> +> 其中deviceIds通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 **需要权限**: ohos.permission.DISTRIBUTED_DATASYNC。 @@ -4548,7 +4631,7 @@ sync(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void | --------- | --------------------- | ---- | ---------------------------------------------- | | deviceIds | string[] | 是 | 同一组网环境下,需要同步的设备的deviceId列表。 | | mode | [SyncMode](#syncmode) | 是 | 同步模式。 | -| query | [Query](query) | 是 | 表示数据库的查询谓词条件 | +| query | [Query](#query) | 是 | 表示数据库的查询谓词条件 | | delayMs | number | 否 | 可选参数,允许延时时间,单位:ms(毫秒)。 | **错误码:** @@ -4563,29 +4646,43 @@ sync(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void **示例:** ```js -let kvStore; +import deviceManager from '@ohos.distributedHardware.deviceManager'; + +let devManager; const KEY_TEST_SYNC_ELEMENT = 'key_test_sync'; const VALUE_TEST_SYNC_ELEMENT = 'value-string-001'; -try { - kvStore.on('syncComplete', function (data) { - console.log('Sync dataChange'); - }); - kvStore.put(KEY_TEST_SYNC_ELEMENT + 'testSync101', VALUE_TEST_SYNC_ELEMENT, function (err, data) { +// create deviceManager +deviceManager.createDeviceManager('bundleName', (err, value) => { + if (!err) { + devManager = value; + let deviceIds = []; + if (devManager != null) { + var devices = devManager.getTrustedDeviceListSync(); + for (var i = 0; i < devices.length; i++) { + deviceIds[i] = devices[i].deviceId; + } + } + try { + kvStore.on('syncComplete', function (data) { + console.info('Sync dataChange'); + }); + kvStore.put(KEY_TEST_SYNC_ELEMENT + 'testSync101', VALUE_TEST_SYNC_ELEMENT, function (err, data) { if (err != undefined) { - console.error(`Fail to sync.code is ${err.code},message is ${err.message}`); - return; + console.error(`Failed to sync.code is ${err.code},message is ${err.message}`); + return; } - console.log('Succeeded in putting data'); - const devices = ['deviceList']; + console.info('Succeeded in putting data'); const mode = distributedKVStore.SyncMode.PULL_ONLY; const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); query.deviceId('localDeviceId'); - kvStore.sync(devices, query, mode, 1000); - }); -} catch (e) { - console.error(`Fail to sync.code is ${e.code},message is ${e.message}`); -} + kvStore.sync(deviceIds, query, mode, 1000); + }); + } catch (e) { + console.error(`Failed to sync.code is ${e.code},message is ${e.message}`); + } + } +}); ``` ### on('dataChange') @@ -4610,19 +4707,18 @@ on(event: 'dataChange', type: SubscribeType, listener: Callback<ChangeNotific | **错误码ID** | **错误信息** | | ------------ | -------------------------------------- | -| 15100001 | Over max subscribe limits. | +| 15100001 | Over max limits. | | 15100005 | Database or result set already closed. | **示例:** ```js -let kvStore; try { kvStore.on('dataChange', distributedKVStore.SubscribeType.SUBSCRIBE_TYPE_LOCAL, function (data) { - console.log(`dataChange callback call data: ${data}`); + console.info(`dataChange callback call data: ${data}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -4644,20 +4740,19 @@ on(event: 'syncComplete', syncCallback: Callback<Array<[string, number]> **示例:** ```js -let kvStore; const KEY_TEST_FLOAT_ELEMENT = 'key_test_float'; const VALUE_TEST_FLOAT_ELEMENT = 321.12; try { kvStore.on('syncComplete', function (data) { - console.log(`syncComplete ${data}`); + console.info(`syncComplete ${data}`); }); kvStore.put(KEY_TEST_FLOAT_ELEMENT, VALUE_TEST_FLOAT_ELEMENT).then((data) => { - console.log('succeeded in putting'); + console.info('succeeded in putting'); }).catch((err) => { - console.error(`Fail to put.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`Fail to subscribe syncComplete.code is ${e.code},message is ${e.message}`); + console.error(`Failed to subscribe syncComplete.code is ${e.code},message is ${e.message}`); } ``` @@ -4687,10 +4782,9 @@ off(event:'dataChange', listener?: Callback<ChangeNotification>): void **示例:** ```js -let kvStore; class KvstoreModel { call(data) { - console.log(`dataChange : ${data}`); + console.info(`dataChange : ${data}`); } subscribeDataChange() { @@ -4699,7 +4793,7 @@ class KvstoreModel { kvStore.on('dataChange', distributedKVStore.SubscribeType.SUBSCRIBE_TYPE_REMOTE, this.call); } } catch (err) { - console.error(`Fail to subscribeDataChange.code is ${err.code},message is ${err.message}`); + console.error(`Failed to subscribeDataChange.code is ${err.code},message is ${err.message}`); } } @@ -4709,7 +4803,7 @@ class KvstoreModel { kvStore.off('dataChange', this.call); } } catch (err) { - console.error(`Fail to unsubscribeDataChange.code is ${err.code},message is ${err.message}`); + console.error(`Failed to unsubscribeDataChange.code is ${err.code},message is ${err.message}`); } } } @@ -4733,10 +4827,9 @@ off(event: 'syncComplete', syncCallback?: Callback<Array<[string, number]& **示例:** ```js -let kvStore; class KvstoreModel { call(data) { - console.log(`syncComplete : ${data}`); + console.info(`syncComplete : ${data}`); } subscribeDataChange() { @@ -4745,7 +4838,7 @@ class KvstoreModel { kvStore.on('syncComplete', distributedKVStore.SubscribeType.SUBSCRIBE_TYPE_REMOTE, this.call); } } catch (err) { - console.error(`Fail to subscribeDataChange.code is ${err.code},message is ${err.message}`); + console.error(`Failed to subscribeDataChange.code is ${err.code},message is ${err.message}`); } } @@ -4755,7 +4848,7 @@ class KvstoreModel { kvStore.off('dsyncComplete', this.call); } } catch (err) { - console.error(`Fail to unsubscribeDataChange.code is ${err.code},message is ${err.message}`); + console.error(`Failed to unsubscribeDataChange.code is ${err.code},message is ${err.message}`); } } } @@ -4786,17 +4879,16 @@ getSecurityLevel(callback: AsyncCallback<SecurityLevel>): void **示例:** ```js -let kvStore; try { kvStore.getSecurityLevel(function (err, data) { if (err != undefined) { - console.error(`Fail to get SecurityLevel.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get SecurityLevel.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in getting securityLevel'); + console.info('Succeeded in getting securityLevel'); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -4825,15 +4917,14 @@ getSecurityLevel(): Promise<SecurityLevel> **示例:** ```js -let kvStore; try { kvStore.getSecurityLevel().then((data) => { - console.log('Succeeded in getting securityLevel'); + console.info('Succeeded in getting securityLevel'); }).catch((err) => { - console.error(`Fail to get SecurityLevel.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get SecurityLevel.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -4875,26 +4966,25 @@ get(key: string, callback: AsyncCallback<boolean | string | number | Uint8Arr **示例:** ```js -let kvStore; const KEY_TEST_STRING_ELEMENT = 'key_test_string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; try { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT, function (err, data) { if (err != undefined) { - console.error(`Fail to put.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put.code is ${err.code},message is ${err.message}`); return; } - console.log("Succeeded in putting"); + console.info("Succeeded in putting"); kvStore.get(KEY_TEST_STRING_ELEMENT, function (err, data) { if (err != undefined) { - console.error(`Fail to get.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get.code is ${err.code},message is ${err.message}`); return; } - console.log(`Succeeded in getting data.data=${data}`); + console.info(`Succeeded in getting data.data=${data}`); }); }); } catch (e) { - console.error(`Fail to get.code is ${e.code},message is ${e.message}`); + console.error(`Failed to get.code is ${e.code},message is ${e.message}`); } ``` @@ -4931,22 +5021,21 @@ get(key: string): Promise<boolean | string | number | Uint8Array> **示例:** ```js -let kvStore; const KEY_TEST_STRING_ELEMENT = 'key_test_string'; const VALUE_TEST_STRING_ELEMENT = 'value-test-string'; try { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then((data) => { - console.log(`Succeeded in putting data.data=${data}`); + console.info(`Succeeded in putting data.data=${data}`); kvStore.get(KEY_TEST_STRING_ELEMENT).then((data) => { - console.log(`Succeeded in getting data.data=${data}`); + console.info(`Succeeded in getting data.data=${data}`); }).catch((err) => { - console.error(`Fail to get.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get.code is ${err.code},message is ${err.message}`); }); }).catch((err) => { - console.error(`Fail to put.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`Fail to get.code is ${e.code},message is ${e.message}`); + console.error(`Failed to get.code is ${e.code},message is ${e.message}`); } ``` @@ -4955,6 +5044,10 @@ try { get(deviceId: string, key: string, callback: AsyncCallback<boolean | string | number | Uint8Array>): void 获取与指定设备ID和key匹配的string值,使用callback异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -4979,26 +5072,25 @@ get(deviceId: string, key: string, callback: AsyncCallback<boolean | string | **示例:** ```js -let kvStore; const KEY_TEST_STRING_ELEMENT = 'key_test_string_2'; const VALUE_TEST_STRING_ELEMENT = 'value-string-002'; try { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT, async function (err, data) { if (err != undefined) { - console.error(`Fail to put.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in putting'); + console.info('Succeeded in putting'); kvStore.get('localDeviceId', KEY_TEST_STRING_ELEMENT, function (err, data) { if (err != undefined) { - console.error(`Fail to get.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in getting'); + console.info('Succeeded in getting'); }); }) } catch (e) { - console.error(`Fail to get.code is ${e.code},message is ${e.message}`); + console.error(`Failed to get.code is ${e.code},message is ${e.message}`); } ``` @@ -5007,6 +5099,10 @@ try { get(deviceId: string, key: string): Promise<boolean | string | number | Uint8Array> 获取与指定设备ID和key匹配的string值,使用Promise异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -5036,22 +5132,21 @@ get(deviceId: string, key: string): Promise<boolean | string | number | Uint8 **示例:** ```js -let kvStore; const KEY_TEST_STRING_ELEMENT = 'key_test_string_2'; const VALUE_TEST_STRING_ELEMENT = 'value-string-002'; try { kvStore.put(KEY_TEST_STRING_ELEMENT, VALUE_TEST_STRING_ELEMENT).then(async (data) => { - console.log('Succeeded in putting'); + console.info('Succeeded in putting'); kvStore.get('localDeviceId', KEY_TEST_STRING_ELEMENT).then((data) => { - console.log('Succeeded in getting'); + console.info('Succeeded in getting'); }).catch((err) => { - console.error(`Fail to get.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get.code is ${err.code},message is ${err.message}`); }); }).catch((error) => { - console.error(`Fail to put.code is ${error.code},message is ${error.message}`); + console.error(`Failed to put.code is ${error.code},message is ${error.message}`); }); } catch (e) { - console.error(`Fail to get.code is ${e.code},message is ${e.message}`); + console.error(`Failed to get.code is ${e.code},message is ${e.message}`); } ``` @@ -5082,7 +5177,6 @@ getEntries(keyPrefix: string, callback: AsyncCallback<Entry[]>): void **示例:** ```js -let kvStore; try { let entries = []; for (var i = 0; i < 10; i++) { @@ -5096,21 +5190,21 @@ try { } entries.push(entry); } - console.log(`entries: ${entries}`); + console.info(`entries: ${entries}`); kvStore.putBatch(entries, async function (err, data) { if (err != undefined) { - console.error(`Fail to put Batch.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put Batch.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in putting Batch'); + console.info('Succeeded in putting Batch'); kvStore.getEntries('batch_test_string_key', function (err, entries) { if (err != undefined) { - console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get Entries.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in getting Entries'); - console.log(`entries.length: ${entries.length}`); - console.log(`entries[0]: ${entries[0]}`); + console.info('Succeeded in getting Entries'); + console.info(`entries.length: ${entries.length}`); + console.info(`entries[0]: ${entries[0]}`); }); }); } catch (e) { @@ -5150,7 +5244,6 @@ getEntries(keyPrefix: string): Promise<Entry[]> **示例:** ```js -let kvStore; try { let entries = []; for (var i = 0; i < 10; i++) { @@ -5164,17 +5257,17 @@ try { } entries.push(entry); } - console.log(`entries: ${entries}`); + console.info(`entries: ${entries}`); kvStore.putBatch(entries).then(async (entries) => { - console.log('Succeeded in putting Batch'); + console.info('Succeeded in putting Batch'); kvStore.getEntries('batch_test_string_key').then((entries) => { - console.log('Succeeded in getting Entries'); - console.log(`PutBatch ${entries}`); + console.info('Succeeded in getting Entries'); + console.info(`PutBatch ${entries}`); }).catch((err) => { - console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get Entries.code is ${err.code},message is ${err.message}`); }); }).catch((err) => { - console.error(`Fail to put Batch.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put Batch.code is ${err.code},message is ${err.message}`); }); } catch (e) { console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message} `); @@ -5186,6 +5279,10 @@ try { getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback<Entry[]>): void 获取与指定设备ID和key前缀匹配的所有键值对,使用callback异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -5209,7 +5306,6 @@ getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback<Entry **示例:** ```js -let kvStore; try { let entries = []; for (var i = 0; i < 10; i++) { @@ -5223,25 +5319,25 @@ try { } entries.push(entry); } - console.log(`entries : ${entries}`); + console.info(`entries : ${entries}`); kvStore.putBatch(entries, async function (err, data) { if (err != undefined) { - console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put batch.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in putting batch'); + console.info('Succeeded in putting batch'); kvStore.getEntries('localDeviceId', 'batch_test_string_key', function (err, entries) { if (err != undefined) { - console.error(`Fail to get entries.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get entries.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in getting entries'); - console.log(`entries.length: ${entries.length}`); - console.log(`entries[0]: ${entries[0]}`); + console.info('Succeeded in getting entries'); + console.info(`entries.length: ${entries.length}`); + console.info(`entries[0]: ${entries[0]}`); }); }); } catch (e) { - console.error(`Fail to put batch.code is ${e.code},message is ${e.message}`); + console.error(`Failed to put batch.code is ${e.code},message is ${e.message}`); } ``` @@ -5250,6 +5346,10 @@ try { getEntries(deviceId: string, keyPrefix: string): Promise<Entry[]> 获取与指定设备ID和key前缀匹配的所有键值对,使用Promise异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -5278,7 +5378,6 @@ getEntries(deviceId: string, keyPrefix: string): Promise<Entry[]> **示例:** ```js -let kvStore; try { let entries = []; for (var i = 0; i < 10; i++) { @@ -5292,23 +5391,23 @@ try { } entries.push(entry); } - console.log(`entries: ${entries}`); + console.info(`entries: ${entries}`); kvStore.putBatch(entries).then(async (err) => { - console.log('Succeeded in putting batch'); + console.info('Succeeded in putting batch'); kvStore.getEntries('localDeviceId', 'batch_test_string_key').then((entries) => { - console.log('Succeeded in getting entries'); - console.log(`entries.length: ${entries.length}`); - console.log(`entries[0]: ${entries[0]}`); - console.log(`entries[0].value: ${entries[0].value}`); - console.log(`entries[0].value.value: ${entries[0].value.value}`); + console.info('Succeeded in getting entries'); + console.info(`entries.length: ${entries.length}`); + console.info(`entries[0]: ${entries[0]}`); + console.info(`entries[0].value: ${entries[0].value}`); + console.info(`entries[0].value.value: ${entries[0].value.value}`); }).catch((err) => { - console.error(`Fail to get entries.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get entries.code is ${err.code},message is ${err.message}`); }); }).catch((err) => { - console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put batch.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`Fail to put batch.code is ${e.code},message is ${e.message}`); + console.error(`Failed to put batch.code is ${e.code},message is ${e.message}`); } ``` @@ -5324,7 +5423,7 @@ getEntries(query: Query, callback: AsyncCallback<Entry[]>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------------------------- | ---- | ----------------------------------------------------- | -| query | [Query](query) | 是 | 表示要匹配的键前缀。 | +| query | [Query](#query) | 是 | 表示要匹配的键前缀。 | | callback | AsyncCallback<[Entry](#entry)[]> | 是 | 回调函数。返回本设备与指定Query对象匹配的键值对列表。 | **错误码:** @@ -5339,7 +5438,6 @@ getEntries(query: Query, callback: AsyncCallback<Entry[]>): void **示例:** ```js -let kvStore; try { var arr = new Uint8Array([21, 31]); let entries = []; @@ -5354,23 +5452,23 @@ try { } entries.push(entry); } - console.log(`entries: {entries}`); + console.info(`entries: {entries}`); kvStore.putBatch(entries, async function (err, data) { - console.log('Succeeded in putting Batch'); + console.info('Succeeded in putting Batch'); const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getEntries(query, function (err, entries) { if (err != undefined) { - console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get Entries.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in getting Entries'); - console.log(`entries.length: ${entries.length}`); - console.log(`entries[0]: ${entries[0]}`); + console.info('Succeeded in getting Entries'); + console.info(`entries.length: ${entries.length}`); + console.info(`entries[0]: ${entries[0]}`); }); }); } catch (e) { - console.error(`Fail to get Entries.code is ${e.code},message is ${e.message}`); + console.error(`Failed to get Entries.code is ${e.code},message is ${e.message}`); } ``` @@ -5386,7 +5484,7 @@ getEntries(query: Query): Promise<Entry[]> | 参数名 | 类型 | 必填 | 说明 | | ------ | -------------- | ---- | -------------- | -| query | [Query](query) | 是 | 表示查询对象。 | +| query | [Query](#query) | 是 | 表示查询对象。 | **返回值:** @@ -5406,7 +5504,6 @@ getEntries(query: Query): Promise<Entry[]> **示例:** ```js -let kvStore; try { var arr = new Uint8Array([21, 31]); let entries = []; @@ -5421,22 +5518,22 @@ try { } entries.push(entry); } - console.log(`entries: {entries}`); + console.info(`entries: {entries}`); kvStore.putBatch(entries).then(async (err) => { - console.log('Succeeded in putting Batch'); + console.info('Succeeded in putting Batch'); const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getEntries(query).then((entries) => { - console.log('Succeeded in getting Entries'); + console.info('Succeeded in getting Entries'); }).catch((err) => { - console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get Entries.code is ${err.code},message is ${err.message}`); }); }).catch((err) => { - console.error(`Fail to get Entries.code is ${err.code},message is ${err.message}`) + console.error(`Failed to get Entries.code is ${err.code},message is ${err.message}`) }); - console.log('Succeeded in getting Entries'); + console.info('Succeeded in getting Entries'); } catch (e) { - console.error(`Fail to get Entries.code is ${e.code},message is ${e.message}`); + console.error(`Failed to get Entries.code is ${e.code},message is ${e.message}`); } ``` @@ -5445,6 +5542,10 @@ try { getEntries(deviceId: string, query: Query, callback: AsyncCallback<Entry[]>): void 获取与指定设备ID和Query对象匹配的键值对列表,使用callback异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -5453,7 +5554,7 @@ getEntries(deviceId: string, query: Query, callback: AsyncCallback<Entry[]> | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------------------------- | ---- | ------------------------------------------------------- | | deviceId | string | 是 | 键值对所属的设备ID。 | -| query | [Query](query) | 是 | 表示查询对象。 | +| query | [Query](#query) | 是 | 表示查询对象。 | | callback | AsyncCallback<[Entry](#entry)[]> | 是 | 回调函数。返回与指定设备ID和Query对象匹配的键值对列表。 | **错误码:** @@ -5468,7 +5569,6 @@ getEntries(deviceId: string, query: Query, callback: AsyncCallback<Entry[]> **示例:** ```js -let kvStore; try { var arr = new Uint8Array([21, 31]); let entries = []; @@ -5483,29 +5583,29 @@ try { } entries.push(entry); } - console.log(`entries: ${entries}`); + console.info(`entries: ${entries}`); kvStore.putBatch(entries, async function (err, data) { if (err != undefined) { - console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put batch.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in putting batch'); + console.info('Succeeded in putting batch'); var query = new distributedKVStore.Query(); query.deviceId('localDeviceId'); query.prefixKey("batch_test"); kvStore.getEntries('localDeviceId', query, function (err, entries) { if (err != undefined) { - console.error(`Fail to get entries.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get entries.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in getting entries'); - console.log(`entries.length: ${entries.length}`); - console.log(`entries[0]: ${entries[0]}`); + console.info('Succeeded in getting entries'); + console.info(`entries.length: ${entries.length}`); + console.info(`entries[0]: ${entries[0]}`); }) }); - console.log('Succeeded in getting entries'); + console.info('Succeeded in getting entries'); } catch (e) { - console.error(`Fail to get entries.code is ${e.code},message is ${e.message}`); + console.error(`Failed to get entries.code is ${e.code},message is ${e.message}`); } ``` @@ -5514,6 +5614,10 @@ try { getEntries(deviceId: string, query: Query): Promise<Entry[]> 获取与指定设备ID和Query对象匹配的键值对列表,使用Promise异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -5522,7 +5626,7 @@ getEntries(deviceId: string, query: Query): Promise<Entry[]> | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------- | ---- | -------------------- | | deviceId | string | 是 | 键值对所属的设备ID。 | -| query | [Query](query) | 是 | 表示查询对象。 | +| query | [Query](#query) | 是 | 表示查询对象。 | **返回值:** @@ -5542,7 +5646,6 @@ getEntries(deviceId: string, query: Query): Promise<Entry[]> **示例:** ```js -let kvStore; try { var arr = new Uint8Array([21, 31]); let entries = []; @@ -5557,23 +5660,23 @@ try { } entries.push(entry); } - console.log(`entries: ${entries}`); + console.info(`entries: ${entries}`); kvStore.putBatch(entries).then(async (err) => { - console.log('Succeeded in putting batch'); + console.info('Succeeded in putting batch'); var query = new distributedKVStore.Query(); query.deviceId('localDeviceId'); query.prefixKey("batch_test"); kvStore.getEntries('localDeviceId', query).then((entries) => { - console.log('Succeeded in getting entries'); + console.info('Succeeded in getting entries'); }).catch((err) => { - console.error(`Fail to get entries.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get entries.code is ${err.code},message is ${err.message}`); }); }).catch((err) => { - console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put batch.code is ${err.code},message is ${err.message}`); }); - console.log('Succeeded in getting entries'); + console.info('Succeeded in getting entries'); } catch (e) { - console.error(`Fail to get entries.code is ${e.code},message is ${e.message}`); + console.error(`Failed to get entries.code is ${e.code},message is ${e.message}`); } ``` @@ -5598,13 +5701,13 @@ getResultSet(keyPrefix: string, callback: AsyncCallback<KVStoreResultSet>) | **错误码ID** | **错误信息** | | ------------ | -------------------------------------- | +| 15100001 | Over max limits. | | 15100003 | Database corrupted. | | 15100005 | Database or result set already closed. | **示例:** ```js -let kvStore; try { let resultSet; let entries = []; @@ -5621,28 +5724,28 @@ try { } kvStore.putBatch(entries, async function (err, data) { if (err != undefined) { - console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put batch.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in putting batch'); + console.info('Succeeded in putting batch'); kvStore.getResultSet('batch_test_string_key', async function (err, result) { if (err != undefined) { - console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get resultset.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in getting result set'); + console.info('Succeeded in getting result set'); resultSet = result; kvStore.closeResultSet(resultSet, function (err, data) { if (err != undefined) { - console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); + console.error(`Failed to close resultset.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in closing result set'); + console.info('Succeeded in closing result set'); }) }); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.message}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.message}`); } ``` @@ -5672,13 +5775,13 @@ getResultSet(keyPrefix: string): Promise<KVStoreResultSet> | **错误码ID** | **错误信息** | | ------------ | -------------------------------------- | +| 15100001 | Over max limits. | | 15100003 | Database corrupted. | | 15100005 | Database or result set already closed. | **示例:** ```js -let kvStore; try { let resultSet; let entries = []; @@ -5694,23 +5797,23 @@ try { entries.push(entry); } kvStore.putBatch(entries).then(async (err) => { - console.log('Succeeded in putting batch'); + console.info('Succeeded in putting batch'); }).catch((err) => { - console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put batch.code is ${err.code},message is ${err.message}`); }); kvStore.getResultSet('batch_test_string_key').then((result) => { - console.log('Succeeded in getting result set'); + console.info('Succeeded in getting result set'); resultSet = result; }).catch((err) => { - console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get resultset.code is ${err.code},message is ${err.message}`); }); kvStore.closeResultSet(resultSet).then((err) => { - console.log('Succeeded in closing result set'); + console.info('Succeeded in closing result set'); }).catch((err) => { - console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); + console.error(`Failed to close resultset.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -5719,6 +5822,10 @@ try { getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback<KVStoreResultSet>): void 获取与指定设备ID和key前缀匹配的KVStoreResultSet对象,使用callback异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -5736,32 +5843,32 @@ getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback<KVS | **错误码ID** | **错误信息** | | ------------ | -------------------------------------- | +| 15100001 | Over max limits. | | 15100003 | Database corrupted. | | 15100005 | Database or result set already closed. | **示例:** ```js -let kvStore; try { let resultSet; kvStore.getResultSet('localDeviceId', 'batch_test_string_key', async function (err, result) { if (err != undefined) { - console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get resultSet.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in getting resultSet'); + console.info('Succeeded in getting resultSet'); resultSet = result; kvStore.closeResultSet(resultSet, function (err, data) { if (err != undefined) { - console.error(`Fail to close resultSet.code is ${err.code},message is ${err.message}`); + console.error(`Failed to close resultSet.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in closing resultSet'); + console.info('Succeeded in closing resultSet'); }) }); } catch (e) { - console.error(`Fail to get resultSet.code is ${e.code},message is ${e.message}`); + console.error(`Failed to get resultSet.code is ${e.code},message is ${e.message}`); } ``` @@ -5770,6 +5877,10 @@ try { getResultSet(deviceId: string, keyPrefix: string): Promise<KVStoreResultSet> 获取与指定设备ID和key前缀匹配的KVStoreResultSet对象,使用Promise异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -5792,28 +5903,28 @@ getResultSet(deviceId: string, keyPrefix: string): Promise<KVStoreResultSet&g | **错误码ID** | **错误信息** | | ------------ | -------------------------------------- | +| 15100001 | Over max limits. | | 15100003 | Database corrupted. | | 15100005 | Database or result set already closed. | **示例:** ```js -let kvStore; try { let resultSet; kvStore.getResultSet('localDeviceId', 'batch_test_string_key').then((result) => { - console.log('Succeeded in getting resultSet'); + console.info('Succeeded in getting resultSet'); resultSet = result; }).catch((err) => { - console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get resultSet.code is ${err.code},message is ${err.message}`); }); kvStore.closeResultSet(resultSet).then((err) => { - console.log('Succeeded in closing resultSet'); + console.info('Succeeded in closing resultSet'); }).catch((err) => { - console.error(`Fail to close resultSet.code is ${err.code},message is ${err.message}`); + console.error(`Failed to close resultSet.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`Fail to get resultSet.code is ${e.code},message is ${e.message}`); + console.error(`Failed to get resultSet.code is ${e.code},message is ${e.message}`); } ``` @@ -5822,6 +5933,10 @@ try { getResultSet(deviceId: string, query: Query, callback: AsyncCallback<KVStoreResultSet>): void 获取与指定设备ID和Query对象匹配的KVStoreResultSet对象,使用callback异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -5830,7 +5945,7 @@ getResultSet(deviceId: string, query: Query, callback: AsyncCallback<KVStoreR | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | deviceId | string | 是 | KVStoreResultSet对象所属的设备ID。 | -| query | [Query](query) | 是 | 表示查询对象。 | +| query | [Query](#query) | 是 | 表示查询对象。 | | callback | AsyncCallback<[KVStoreResultSet](#kvstoreresultset)> | 是 | 回调函数。返回与指定设备ID和Query对象匹配的KVStoreResultSet对象。 | **错误码:** @@ -5839,13 +5954,13 @@ getResultSet(deviceId: string, query: Query, callback: AsyncCallback<KVStoreR | **错误码ID** | **错误信息** | | ------------ | -------------------------------------- | +| 15100001 | Over max limits. | | 15100003 | Database corrupted. | | 15100005 | Database or result set already closed. | **示例:** ```js -let kvStore; try { let resultSet; let entries = []; @@ -5862,30 +5977,30 @@ try { } kvStore.putBatch(entries, async function (err, data) { if (err != undefined) { - console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put batch.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in putting batch'); + console.info('Succeeded in putting batch'); const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getResultSet('localDeviceId', query, async function (err, result) { if (err != undefined) { - console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get resultSet.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in getting resultSet'); + console.info('Succeeded in getting resultSet'); resultSet = result; kvStore.closeResultSet(resultSet, function (err, data) { if (err != undefined) { - console.error(`Fail to close resultSet.code is ${err.code},message is ${err.message}`); + console.error(`Failed to close resultSet.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in closing resultSet'); + console.info('Succeeded in closing resultSet'); }) }); }); } catch (e) { - console.error(`Fail to get resultSet.code is ${e.code},message is ${e.message}`); + console.error(`Failed to get resultSet.code is ${e.code},message is ${e.message}`); } ``` @@ -5894,6 +6009,10 @@ try { getResultSet(deviceId: string, query: Query): Promise<KVStoreResultSet> 获取与指定设备ID和Query对象匹配的KVStoreResultSet对象,使用Promise异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -5902,7 +6021,7 @@ getResultSet(deviceId: string, query: Query): Promise<KVStoreResultSet> | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------- | ---- | ---------------------------------- | | deviceId | string | 是 | KVStoreResultSet对象所属的设备ID。 | -| query | [Query](query) | 是 | 表示查询对象。 | +| query | [Query](#query) | 是 | 表示查询对象。 | **返回值:** @@ -5916,13 +6035,13 @@ getResultSet(deviceId: string, query: Query): Promise<KVStoreResultSet> | **错误码ID** | **错误信息** | | ------------ | -------------------------------------- | +| 15100001 | Over max limits. | | 15100003 | Database corrupted. | | 15100005 | Database or result set already closed. | **示例:** ```js -let kvStore; try { let resultSet; let entries = []; @@ -5938,28 +6057,28 @@ try { entries.push(entry); } kvStore.putBatch(entries).then(async (err) => { - console.log('Succeeded in putting batch'); + console.info('Succeeded in putting batch'); }).catch((err) => { - console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put batch.code is ${err.code},message is ${err.message}`); }); const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getResultSet('localDeviceId', query).then((result) => { - console.log('Succeeded in getting resultSet'); + console.info('Succeeded in getting resultSet'); resultSet = result; }).catch((err) => { - console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get resultSet.code is ${err.code},message is ${err.message}`); }); query.deviceId('localDeviceId'); - console.log("GetResultSet " + query.getSqlLike()); + console.info("GetResultSet " + query.getSqlLike()); kvStore.closeResultSet(resultSet).then((err) => { - console.log('Succeeded in closing resultSet'); + console.info('Succeeded in closing resultSet'); }).catch((err) => { - console.error(`Fail to close resultSet.code is ${err.code},message is ${err.message}`); + console.error(`Failed to close resultSet.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`Fail to get resultSet.code is ${e.code},message is ${e.message}`); + console.error(`Failed to get resultSet.code is ${e.code},message is ${e.message}`); } ``` @@ -5975,7 +6094,7 @@ getResultSet(query: Query): Promise<KVStoreResultSet> | 参数名 | 类型 | 必填 | 说明 | | ------ | -------------- | ---- | -------------- | -| query | [Query](query) | 是 | 表示查询对象。 | +| query | [Query](#query) | 是 | 表示查询对象。 | **返回值:** @@ -5989,13 +6108,13 @@ getResultSet(query: Query): Promise<KVStoreResultSet> | **错误码ID** | **错误信息** | | ------------ | -------------------------------------- | +| 15100001 | Over max limits. | | 15100003 | Database corrupted. | | 15100005 | Database or result set already closed. | **示例:** ```js -let kvStore; try { let resultSet; let entries = []; @@ -6011,43 +6130,42 @@ try { entries.push(entry); } kvStore.putBatch(entries).then(async (err) => { - console.log('Succeeded in putting batch'); + console.info('Succeeded in putting batch'); }).catch((err) => { - console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put batch.code is ${err.code},message is ${err.message}`); }); const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getResultSet(query).then((result) => { - console.log('Succeeded in getting result set'); + console.info('Succeeded in getting result set'); resultSet = result; }).catch((err) => { - console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get resultset.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` ### getResultSet -getResultSet(deviceId: string, query: Query): Promise<KVStoreResultSet> +getResultSet(query: Query, callback:AsyncCallback<KVStoreResultSet>): void -获取与指定设备ID和Query对象匹配的KVStoreResultSet对象,使用Promise异步回调。 +获取与本设备指定Query对象匹配的KVStoreResultSet对象,使用callback异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 -**系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore +**系统能力:** SystemCapability.DistributedDataManager.KVStore.Core **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------- | ---- | ---------------------------------- | -| deviceId | string | 是 | KVStoreResultSet对象所属的设备ID。 | -| query | [Query](query) | 是 | 表示查询对象。 | +| query | [Query](#query) | 是 | 表示查询对象。 | +| callback | AsyncCallback<[KVStoreResultSet](#kvstoreresultset)> | 是 | 回调函数,获取与指定Predicates对象匹配的KVStoreResultSet对象。 | -**返回值:** - -| 类型 | 说明 | -| ---------------------------------------------------- | ------------------------------------------------------------ | -| Promise<[KVStoreResultSet](#kvstoreresultset)> | Promise对象。返回与指定设备ID和Query对象匹配的KVStoreResultSet对象。 | **错误码:** @@ -6055,13 +6173,13 @@ getResultSet(deviceId: string, query: Query): Promise<KVStoreResultSet> | **错误码ID** | **错误信息** | | ------------ | -------------------------------------- | +| 15100001 | Over max limits. | | 15100003 | Database corrupted. | | 15100005 | Database or result set already closed. | **示例:** ```js -let kvStore; try { let resultSet; let entries = []; @@ -6076,29 +6194,32 @@ try { } entries.push(entry); } - kvStore.putBatch(entries).then(async (err) => { - console.log('Succeeded in putting batch'); - }).catch((err) => { - console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); - }); - const query = new distributedKVStore.Query(); - query.prefixKey("batch_test"); - kvStore.getResultSet('localDeviceId', query).then((result) => { - console.log('Succeeded in getting resultSet'); - resultSet = result; - }).catch((err) => { - console.error(`Fail to get resultSet.code is ${err.code},message is ${err.message}`); - }); - query.deviceId('localDeviceId'); - console.log("GetResultSet " + query.getSqlLike()); - kvStore.closeResultSet(resultSet).then((err) => { - console.log('Succeeded in closing resultSet'); - }).catch((err) => { - console.error(`Fail to close resultSet.code is ${err.code},message is ${err.message}`); + kvStore.putBatch(entries, async function (err, data) { + if (err != undefined) { + console.error(`Failed to put batch.code is ${err.code},message is ${err.message}`); + return; + } + console.info('Succeeded in putting batch'); + const query = new distributedKVStore.Query(); + query.prefixKey("batch_test"); + kvStore.getResultSet(query, async function (err, result) { + if (err != undefined) { + console.error(`Failed to get resultSet.code is ${err.code},message is ${err.message}`); + return; + } + console.info('Succeeded in getting resultSet'); + resultSet = result; + kvStore.closeResultSet(resultSet, function (err, data) { + if (err != undefined) { + console.error(`Failed to close resultSet.code is ${err.code},message is ${err.message}`); + return; + } + console.info('Succeeded in closing resultSet'); + }) + }); }); - } catch (e) { - console.error(`Fail to get resultSet.code is ${e.code},message is ${e.message}`); + console.error(`Failed to get resultSet.code is ${e.code},message is ${e.message}`); } ``` @@ -6125,6 +6246,7 @@ getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: Asyn | **错误码ID** | **错误信息** | | ------------ | -------------------------------------- | +| 15100001 | Over max limits. | | 15100003 | Database corrupted. | | 15100005 | Database or result set already closed. | @@ -6133,28 +6255,27 @@ getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: Asyn ```js import dataSharePredicates from '@ohos.data.dataSharePredicates'; -let kvStore; try { let resultSet; let predicates = new dataSharePredicates.DataSharePredicates(); predicates.prefixKey("batch_test_string_key"); kvStore.getResultSet(predicates, async function (err, result) { if (err != undefined) { - console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get resultset.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in getting result set'); + console.info('Succeeded in getting result set'); resultSet = result; kvStore.closeResultSet(resultSet, function (err, data) { if (err != undefined) { - console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); + console.error(`Failed to close resultset.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in closing result set'); + console.info('Succeeded in closing result set'); }) }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -6186,6 +6307,7 @@ getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise<KV | **错误码ID** | **错误信息** | | ------------ | -------------------------------------- | +| 15100001 | Over max limits. | | 15100003 | Database corrupted. | | 15100005 | Database or result set already closed. | @@ -6194,24 +6316,23 @@ getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise<KV ```js import dataSharePredicates from '@ohos.data.dataSharePredicates'; -let kvStore; try { let resultSet; let predicates = new dataSharePredicates.DataSharePredicates(); predicates.prefixKey("batch_test_string_key"); kvStore.getResultSet(predicates).then((result) => { - console.log('Succeeded in getting result set'); + console.info('Succeeded in getting result set'); resultSet = result; }).catch((err) => { - console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get resultset.code is ${err.code},message is ${err.message}`); }); kvStore.closeResultSet(resultSet).then((err) => { - console.log('Succeeded in closing result set'); + console.info('Succeeded in closing result set'); }).catch((err) => { - console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); + console.error(`Failed to close resultset.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -6220,6 +6341,10 @@ try { getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<KVStoreResultSet>): void 获取与指定Predicate对象匹配的KVStoreResultSet对象,使用callback异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统接口:** 此接口为系统接口。 @@ -6239,6 +6364,7 @@ getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicat | **错误码ID** | **错误信息** | | ------------ | -------------------------------------- | +| 15100001 | Over max limits. | | 15100003 | Database corrupted. | | 15100005 | Database or result set already closed. | @@ -6247,28 +6373,27 @@ getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicat ```js import dataSharePredicates from '@ohos.data.dataSharePredicates'; -let kvStore; try { let resultSet; let predicates = new dataSharePredicates.DataSharePredicates(); predicates.prefixKey("batch_test_string_key"); kvStore.getResultSet('localDeviceId', predicates, async function (err, result) { if (err != undefined) { - console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get resultset.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in getting result set'); + console.info('Succeeded in getting result set'); resultSet = result; kvStore.closeResultSet(resultSet, function (err, data) { if (err != undefined) { - console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); + console.error(`Failed to close resultset.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in closing result set'); + console.info('Succeeded in closing result set'); }) }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -6277,6 +6402,10 @@ try { getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates): Promise<KVStoreResultSet> 获取与指定Predicate对象匹配的KVStoreResultSet对象,使用Promise异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统接口:** 此接口为系统接口。 @@ -6301,6 +6430,7 @@ getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicat | **错误码ID** | **错误信息** | | ------------ | -------------------------------------- | +| 15100001 | Over max limits. | | 15100003 | Database corrupted. | | 15100005 | Database or result set already closed. | @@ -6308,24 +6438,24 @@ getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicat ```js import dataSharePredicates from '@ohos.data.dataSharePredicates'; -let kvStore; + try { let resultSet; let predicates = new dataSharePredicates.DataSharePredicates(); predicates.prefixKey("batch_test_string_key"); kvStore.getResultSet('localDeviceId', predicates).then((result) => { - console.log('Succeeded in getting result set'); + console.info('Succeeded in getting result set'); resultSet = result; }).catch((err) => { - console.error(`Fail to get resultset.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get resultset.code is ${err.code},message is ${err.message}`); }); kvStore.closeResultSet(resultSet).then((err) => { - console.log('Succeeded in closing result set'); + console.info('Succeeded in closing result set'); }).catch((err) => { - console.error(`Fail to close resultset.code is ${err.code},message is ${err.message}`); + console.error(`Failed to close resultset.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -6341,7 +6471,7 @@ getResultSize(query: Query, callback: AsyncCallback<number>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------- | ---- | ------------------------------------------------- | -| query | [Query](query) | 是 | 表示查询对象。 | +| query | [Query](#query) | 是 | 表示查询对象。 | | callback | AsyncCallback<number> | 是 | 回调函数。返回与本设备指定Query对象匹配的结果数。 | **错误码:** @@ -6356,7 +6486,6 @@ getResultSize(query: Query, callback: AsyncCallback<number>): void **示例:** ```js -let kvStore; try { let entries = []; for (var i = 0; i < 10; i++) { @@ -6371,19 +6500,19 @@ try { entries.push(entry); } kvStore.putBatch(entries, async function (err, data) { - console.log('Succeeded in putting batch'); + console.info('Succeeded in putting batch'); const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getResultSize(query, async function (err, resultSize) { if (err != undefined) { - console.error(`Fail to get result size.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get result size.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in getting result set size'); + console.info('Succeeded in getting result set size'); }); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -6399,7 +6528,7 @@ getResultSize(query: Query): Promise<number> | 参数名 | 类型 | 必填 | 说明 | | ------ | -------------- | ---- | -------------- | -| query | [Query](query) | 是 | 表示查询对象。 | +| query | [Query](#query) | 是 | 表示查询对象。 | **返回值:** @@ -6419,7 +6548,6 @@ getResultSize(query: Query): Promise<number> **示例:** ```js -let kvStore; try { let entries = []; for (var i = 0; i < 10; i++) { @@ -6434,19 +6562,19 @@ try { entries.push(entry); } kvStore.putBatch(entries).then(async (err) => { - console.log('Succeeded in putting batch'); + console.info('Succeeded in putting batch'); }).catch((err) => { - console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put batch.code is ${err.code},message is ${err.message}`); }); const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getResultSize(query).then((resultSize) => { - console.log('Succeeded in getting result set size'); + console.info('Succeeded in getting result set size'); }).catch((err) => { - console.error(`Fail to get result size.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get result size.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`An unexpected error occured.code is ${e.code},message is ${e.code}`); + console.error(`An unexpected error occurred.code is ${e.code},message is ${e.code}`); } ``` @@ -6455,6 +6583,10 @@ try { getResultSize(deviceId: string, query: Query, callback: AsyncCallback<number>): void; 获取与指定设备ID和Query对象匹配的结果数,使用callback异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -6463,7 +6595,7 @@ getResultSize(deviceId: string, query: Query, callback: AsyncCallback<number& | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------- | ---- | --------------------------------------------------- | | deviceId | string | 是 | KVStoreResultSet对象所属的设备ID。 | -| query | [Query](query) | 是 | 表示查询对象。 | +| query | [Query](#query) | 是 | 表示查询对象。 | | callback | AsyncCallback<number> | 是 | 回调函数。返回与指定设备ID和Query对象匹配的结果数。 | **错误码:** @@ -6478,7 +6610,6 @@ getResultSize(deviceId: string, query: Query, callback: AsyncCallback<number& **示例:** ```js -let kvStore; try { let entries = []; for (var i = 0; i < 10; i++) { @@ -6494,23 +6625,23 @@ try { } kvStore.putBatch(entries, async function (err, data) { if (err != undefined) { - console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put batch.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in putting batch'); + console.info('Succeeded in putting batch'); const query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getResultSize('localDeviceId', query, async function (err, resultSize) { if (err != undefined) { - console.error(`Fail to get resultSize.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get resultSize.code is ${err.code},message is ${err.message}`); return; } - console.log('Succeeded in getting resultSize'); + console.info('Succeeded in getting resultSize'); ; }); }); } catch (e) { - console.error(`Fail to get resultSize.code is ${e.code},message is ${e.message}`); + console.error(`Failed to get resultSize.code is ${e.code},message is ${e.message}`); } ``` @@ -6519,6 +6650,10 @@ try { getResultSize(deviceId: string, query: Query): Promise<number> 获取与指定设备ID和Query对象匹配的结果数,使用Promise异步回调。 +> **说明:** +> +> 其中deviceId通过调用[deviceManager.getTrustedDeviceListSync](js-apis-device-manager.md#gettrusteddevicelistsync)方法得到。deviceManager模块的接口均为系统接口,仅系统应用可用。 +> deviceId具体获取方式请参考[sync接口示例](#sync)。 **系统能力:** SystemCapability.DistributedDataManager.KVStore.DistributedKVStore @@ -6527,7 +6662,7 @@ getResultSize(deviceId: string, query: Query): Promise<number> | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------- | ---- | ---------------------------------- | | deviceId | string | 是 | KVStoreResultSet对象所属的设备ID。 | -| query | [Query](query) | 是 | 表示查询对象。 | +| query | [Query](#query) | 是 | 表示查询对象。 | **返回值:** @@ -6547,7 +6682,6 @@ getResultSize(deviceId: string, query: Query): Promise<number> **示例:** ```js -let kvStore; try { let entries = []; for (var i = 0; i < 10; i++) { @@ -6562,19 +6696,19 @@ try { entries.push(entry); } kvStore.putBatch(entries).then(async (err) => { - console.log('Succeeded in putting batch'); + console.info('Succeeded in putting batch'); }).catch((err) => { - console.error(`Fail to put batch.code is ${err.code},message is ${err.message}`); + console.error(`Failed to put batch.code is ${err.code},message is ${err.message}`); }); var query = new distributedKVStore.Query(); query.prefixKey("batch_test"); kvStore.getResultSize('localDeviceId', query).then((resultSize) => { - console.log('Succeeded in getting resultSize'); + console.info('Succeeded in getting resultSize'); ; }).catch((err) => { - console.error(`Fail to get resultSize.code is ${err.code},message is ${err.message}`); + console.error(`Failed to get resultSize.code is ${err.code},message is ${err.message}`); }); } catch (e) { - console.error(`Fail to get resultSize.code is ${e.code},message is ${e.message}`); + console.error(`Failed to get resultSize.code is ${e.code},message is ${e.message}`); } ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-distributedMissionManager.md b/zh-cn/application-dev/reference/apis/js-apis-distributedMissionManager.md index ca314eff605dd2044ddc27603fad7d937747b526..d346ef568f3ba995f77b8c2b2a7adccc65ec73bb 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-distributedMissionManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-distributedMissionManager.md @@ -368,8 +368,8 @@ continueMission(parameter: ContinueDeviceInfo, options: ContinueCallback, callba | 参数名 | 类型 | 必填 | 说明 | | --------- | --------------------------------------- | ---- | ----- | -| parameter | [ContinueDeviceInfo](#continuedeviceinfo) | 是 | 迁移信息。 | -| options | [ContinueCallback](#continuecallback) | 是 | 迁移任务完成回调函数。 | +| parameter | [ContinueDeviceInfo](#js-apis-inner-application-continueDeviceInfo.md) | 是 | 迁移信息。 | +| options | [ContinueCallback](#js-apis-inner-application-continueCallback.md) | 是 | 迁移任务完成回调函数。 | | callback | AsyncCallback<void> | 是 | 执行结果回调函数。 | **错误码:** @@ -426,8 +426,8 @@ continueMission(parameter: ContinueDeviceInfo, options: ContinueCallback): Promi | 参数名 | 类型 | 必填 | 说明 | | --------- | --------------------------------------- | ---- | ----- | -| parameter | [ContinueDeviceInfo](#continuedeviceinfo) | 是 | 迁移信息。 | -| options | [ContinueCallback](#continuecallback) | 是 | 迁移任务完成回调函数。 | +| parameter | [ContinueDeviceInfo](#js-apis-inner-application-continueDeviceInfo.md) | 是 | 迁移信息。 | +| options | [ContinueCallback](#js-apis-inner-application-continueCallback.md) | 是 | 迁移任务完成回调函数。 | **返回值:** @@ -513,31 +513,4 @@ continueMission(parameter: ContinueDeviceInfo, options: ContinueCallback): Promi | 名称 | 类型 | 可读 | 可写 | 说明 | | -------- | ------ | ---- | ---- | ------- | -| deviceId | string | 是 | 是 | 表示设备ID。 | - -## ContinueDeviceInfo - -表示发起任务迁移时所需参数的枚举。 - -**需要权限**:ohos.permission.MANAGE_MISSIONS - -**系统能力**:SystemCapability.Ability.AbilityRuntime.Mission - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| -------- | ------ | ---- | ---- | ------- | -| srcDeviceId | string | 是 | 是 | 表示任务迁移源设备ID。 | -| dstDeviceId | string | 是 | 是 | 表示任务迁移目标设备ID。 | -| missionId | number | 是 | 是 | 表示任务ID。 | -| wantParam | {[key: string]: any} | 是 | 是 | 表示扩展参数。 | - -## ContinueCallback - -表示迁移完成后,返回迁移结果回调函数。 - -**需要权限**:ohos.permission.MANAGE_MISSIONS - -**系统能力**:SystemCapability.Ability.AbilityRuntime.Mission - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| --------------------- | -------- | ---- | ---- | ------------------ | -| onContinueDone | function | 是 | 否 | 通知迁移完成,返回迁移结果。 | \ No newline at end of file +| deviceId | string | 是 | 是 | 表示设备ID。 | \ No newline at end of file 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 5610c212819c32fc322225e6824da36fbc87a736..377f3e7ef73d3941138ff7b6693aed3a7267e5b6 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-effectKit.md +++ b/zh-cn/application-dev/reference/apis/js-apis-effectKit.md @@ -29,7 +29,7 @@ createEffect(source: image.PixelMap): Filter | 参数名 | 类型 | 必填 | 说明 | | ------- | ----------------- | ---- | -------- | -| source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | image模块创建的PixelMap实例。 | +| source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | image模块创建的PixelMap实例。可通过图片解码或直接创建获得,具体可见[图片开发指导](../../media/image-overview.md)。 | **返回值:** @@ -61,7 +61,7 @@ createColorPicker(source: image.PixelMap): Promise\ | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------- | ---- | -------------------------- | -| source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | image模块创建的PixelMap实例。 | +| source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | image模块创建的PixelMap实例。可通过图片解码或直接创建获得,具体可见[图片开发指导](../../media/image-overview.md)。 | **返回值:** @@ -95,7 +95,7 @@ createColorPicker(source: image.PixelMap, callback: AsyncCallback\) | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------ | ---- | -------------------------- | -| source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 |image模块创建的PixelMap实例。 | +| source | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 |image模块创建的PixelMap实例。可通过图片解码或直接创建获得,具体可见[图片开发指导](../../media/image-overview.md)。 | | callback | AsyncCallback\<[ColorPicker](#colorpicker)> | 是 | 回调函数。返回创建的ColorPicker实例。 | **示例:** @@ -180,6 +180,93 @@ console.log('get main color =' + color); ``` ![zh-ch_image_Main_Color.png](figures/zh-ch_image_Main_Color.png) +### getLargestProportionColor10+ + +getLargestProportionColor(): Color + +读取图像占比最多的颜色值,结果写入[Color](#color)里,使用同步方式返回。 + +**系统能力:** SystemCapability.Multimedia.Image.Core + +**返回值:** + +| 类型 | 说明 | +| :------------- | :---------------------------------------------- | +| [Color](#color) | Color实例,即图像占比最多的颜色值,失败时返回null。 | + +**示例:** + +```js +let color = colorPicker.getLargestProportionColor(); +console.log('get largest proportion color =' + color); +``` +![zh-ch_image_Largest_Proportion_Color.png](figures/zh-ch_image_Largest_Proportion_Color.png) + +### getHighestSaturationColor10+ + +getHighestSaturationColor(): Color + +读取图像饱和度最高的颜色值,结果写入[Color](#color)里,使用同步方式返回。 + +**系统能力:** SystemCapability.Multimedia.Image.Core + +**返回值:** + +| 类型 | 说明 | +| :------------- | :---------------------------------------------- | +| [Color](#color) | Color实例,即图像饱和度最高的颜色值,失败时返回null。 | + +**示例:** + +```js +let color = colorPicker.getHighestSaturationColor(); +console.log('get highest saturation color =' + color); +``` +![zh-ch_image_Highest_Saturation_Color.png](figures/zh-ch_image_Highest_Saturation_Color.png) + +### getAverageColor10+ + +getAverageColor(): Color + +读取图像平均的颜色值,结果写入[Color](#color)里,使用同步方式返回。 + +**系统能力:** SystemCapability.Multimedia.Image.Core + +**返回值:** + +| 类型 | 说明 | +| :------------- | :---------------------------------------------- | +| [Color](#color) | Color实例,即图像平均的颜色值,失败时返回null。 | + +**示例:** + +```js +let color = colorPicker.getAverageColor(); +console.log('get average color =' + color); +``` +![zh-ch_image_Average_Color.png](figures/zh-ch_image_Average_Color.png) + +### isBlackOrWhiteOrGrayColor10+ + +isBlackOrWhiteOrGrayColor(color: number): boolean + +判断图像是否为黑白灰颜色,返回true或false。 + +**系统能力:** SystemCapability.Multimedia.Image.Core + +**返回值:** + +| 类型 | 说明 | +| :------------- | :---------------------------------------------- | +| boolean | 如果此图像为黑白灰颜色,则返回true;否则返回false。 | + +**示例:** + +```js +let bJudge = colorPicker.isBlackOrWhiteOrGrayColor(0xFFFFFFFF); +console.log('is black or white or gray color[bool](white) =' + bJudge); +``` + ## Filter 图像效果类,用于将指定的效果添加到输入图像中。在调用Filter的方法前,需要先通过[createEffect](#effectkitcreateeffect)创建一个Filter实例。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-emitter.md b/zh-cn/application-dev/reference/apis/js-apis-emitter.md index 64187e6a825c930ddadbd4cfa75401d1ecac1ea8..c77ef0bc116f020640db7c0d920bbb82c409867d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-emitter.md +++ b/zh-cn/application-dev/reference/apis/js-apis-emitter.md @@ -161,4 +161,4 @@ emitter.emit(innerEvent, eventData); | 名称 | 类型 | 可读 | 可写 | 说明 | | ---- | ------------------ | ---- | ---- | -------------- | -| data | [key: string]: any | 是 | 是 | 发送事件时传递的数据,数据类型支持字符串、整型和布尔型。 | +| data | [key: string]: any | 是 | 是 | 发送事件时传递的数据,数据类型支持字符串、整型和布尔型。
其中字符串长度最大为10240字节。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-enterprise-accountManager.md b/zh-cn/application-dev/reference/apis/js-apis-enterprise-accountManager.md index bee6cc69d5bcacfdbbea479f2f56958c283e4193..ae6c7f9e45e34b18e8c502982bd51e78d72ea9d8 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-enterprise-accountManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-enterprise-accountManager.md @@ -16,7 +16,7 @@ import accountManager from '@ohos.enterprise.accountManager'; disallowAddLocalAccount(admin: Want, disallow: boolean, callback: AsyncCallback<void>): void -是否禁止创建本地用户接口,使用callback异步回调。 +指定设备管理员应用禁止创建本地用户接口,使用callback形式返回设置结果。 **需要权限:** ohos.permission.ENTERPRISE_SET_ACCOUNT_POLICY @@ -28,9 +28,9 @@ disallowAddLocalAccount(admin: Want, disallow: boolean, callback: AsyncCallback& | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------------------- | ---- | ------------------------------- | -| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用 | -| disallow | boolean | 是 | 是否禁止创建本地用户,true表示禁止,false表示解除禁止。 | -| callback | AsyncCallback<void> | 是 | 回调函数。当接口调用成功err为null,否则为错误对象。 | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | +| disallow | boolean | 是 | 是否禁止创建本地用户,true表示禁止创建本地用户,false表示允许创建本地用户。 | +| callback | AsyncCallback<void> | 是 | 回调函数。当接口调用成功,err为null,否则为错误对象。 | **错误码**: @@ -59,7 +59,7 @@ accountManager.disallowAddLocalAccount(admin, true, (error) => { disallowAddLocalAccount(admin: Want, disallow: boolean): Promise<void> -是否禁止创建本地用户,使用promise异步回调。 +指定设备管理员应用禁止创建本地用户,使用Promise形式返回设置结果。 **需要权限:** ohos.permission.ENTERPRISE_SET_ACCOUNT_POLICY @@ -71,14 +71,14 @@ disallowAddLocalAccount(admin: Want, disallow: boolean): Promise<void> | 参数名 | 类型 | 必填 | 说明 | | ----- | ----------------------------------- | ---- | ------- | -| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用 | -| disallow | boolean | 是 | 是否禁止创建本地用户,true表示禁止,false表示解除禁止。 | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | +| disallow | boolean | 是 | 是否禁止创建本地用户,true表示禁止创建本地用户,false表示允许创建本地用户。 | **返回值:** | 类型 | 说明 | | --------------------- | ------------------------- | -| Promise<void> | 无返回结果的Promise对象。 | +| Promise<void> | 无返回结果的Promise对象。当禁止创建本地用户失败时抛出错误对象。 | **错误码**: diff --git a/zh-cn/application-dev/reference/apis/js-apis-enterprise-adminManager.md b/zh-cn/application-dev/reference/apis/js-apis-enterprise-adminManager.md index b590eaabcd37d55076372d91e1827ca98e9e79ea..a2a47106d0b1a5f329b7e9ed58d24b152a2b89d5 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-enterprise-adminManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-enterprise-adminManager.md @@ -16,7 +16,7 @@ import adminManager from '@ohos.enterprise.adminManager'; enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, callback: AsyncCallback\): void -以异步方法根据给定的包名和类名激活设备管理员应用,使用Callback形式返回是否激活成功。 +激活当前用户下的指定设备管理员应用,使用callback形式返回是否激活成功。其中超级管理员应用只能在管理员用户下被激活。 **需要权限:** ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN @@ -28,10 +28,10 @@ enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, callba | 参数名 | 类型 | 必填 | 说明 | | -------------- | ----------------------------------- | ---- | ------------------ | -| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用 | -| enterpriseInfo | [EnterpriseInfo](#enterpriseinfo) | 是 | 设备管理员应用的企业信息 | -| type | [AdminType](#admintype) | 是 | 激活的设备管理员类型 | -| callback | AsyncCallback\ | 是 | callback方式返回是否激活成功 | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | +| enterpriseInfo | [EnterpriseInfo](#enterpriseinfo) | 是 | 设备管理员应用的企业信息。 | +| type | [AdminType](#admintype) | 是 | 激活的设备管理员类型。 | +| callback | AsyncCallback\ | 是 | 回调函数,当接口调用成功,err为null,否则为错误对象。 | **错误码**: @@ -67,7 +67,7 @@ adminManager.enableAdmin(wantTemp, enterpriseInfo, adminManager.AdminType.ADMIN_ enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId: number, callback: AsyncCallback\): void -以异步方法根据给定的包名和类名激活设备管理员应用,使用Callback形式返回是否激活成功。 +激活指定用户下的指定设备管理员应用,使用callback形式返回是否激活成功。其中超级管理员应用只能在管理员用户下被激活。 **需要权限:** ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN @@ -79,11 +79,11 @@ enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId | 参数名 | 类型 | 必填 | 说明 | | -------------- | ----------------------------------- | ---- | ---------------------------- | -| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用 | -| enterpriseInfo | [EnterpriseInfo](#enterpriseinfo) | 是 | 设备管理员应用的企业信息 | -| type | [AdminType](#admintype) | 是 | 激活的设备管理员类型 | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | +| enterpriseInfo | [EnterpriseInfo](#enterpriseinfo) | 是 | 设备管理员应用的企业信息。 | +| type | [AdminType](#admintype) | 是 | 激活的设备管理员类型。 | | userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 | -| callback | AsyncCallback\ | 是 | callback方式返回是否激活成功 | +| callback | AsyncCallback\ | 是 | 回调函数,当接口调用成功,err为null,否则为错误对象。 | **错误码**: @@ -119,7 +119,7 @@ adminManager.enableAdmin(wantTemp, enterpriseInfo, adminManager.AdminType.ADMIN_ enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId?: number): Promise\ -以异步方法根据给定的包名和类名激活设备管理员应用,使用Promise形式返回是否激活成功。 +如果调用接口时传入了可选参数userId,则激活指定用户下的指定设备管理员应用,否则激活当前用户下的指定设备管理员应用,使用Promise形式返回是否激活成功。其中超级管理员应用只能在管理员用户下被激活。 **需要权限:** ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN @@ -131,16 +131,16 @@ enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId | 参数名 | 类型 | 必填 | 说明 | | -------------- | ----------------------------------- | ---- | ---------------------------- | -| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用 | -| enterpriseInfo | [EnterpriseInfo](#enterpriseinfo) | 是 | 设备管理员应用的企业信息 | -| type | [AdminType](#admintype) | 是 | 激活的设备管理员类型 | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | +| enterpriseInfo | [EnterpriseInfo](#enterpriseinfo) | 是 | 设备管理员应用的企业信息。 | +| type | [AdminType](#admintype) | 是 | 激活的设备管理员类型。 | | userId | number | 否 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 | **返回值:** | 类型 | 说明 | | ----------------- | ----------------- | -| Promise\ | Promise形式返回是否激活成功 | +| Promise\ | 无返回结果的Promise对象。当激活设备管理员应用失败时会抛出错误对象。 | **错误码**: @@ -173,7 +173,7 @@ adminManager.enableAdmin(wantTemp, enterpriseInfo, adminManager.AdminType.ADMIN_ disableAdmin(admin: Want, callback: AsyncCallback\): void -以异步方法根据给定的包名和类名将设备普通管理员应用去激活,使用Callback形式返回是否去激活成功。 +将当前用户下的指定普通管理员应用去激活,使用callback形式返回是否去激活成功。 **需要权限:** ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN @@ -185,8 +185,8 @@ disableAdmin(admin: Want, callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------------- | ---- | ------------------- | -| admin | [Want](js-apis-app-ability-want.md) | 是 | 普通设备管理员应用 | -| callback | AsyncCallback\ | 是 | callback方式返回是否去激活成功 | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 普通设备管理员应用。 | +| callback | AsyncCallback\ | 是 | 回调函数,当接口调用成功,err为null,否则为错误对象。 | **错误码**: @@ -216,7 +216,7 @@ adminManager.disableAdmin(wantTemp, error => { disableAdmin(admin: Want, userId: number, callback: AsyncCallback\): void -以异步方法根据给定的包名和类名将设备普通管理员应用去激活,使用Callback形式返回是否去激活成功。 +将指定用户下的指定普通管理员应用去激活,使用callback形式返回是否去激活成功。 **需要权限:** ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN @@ -228,9 +228,9 @@ disableAdmin(admin: Want, userId: number, callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------------- | ---- | ---------------------------- | -| admin | [Want](js-apis-app-ability-want.md) | 是 | 普通设备管理员应用 | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 普通设备管理员应用。 | | userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 | -| callback | AsyncCallback\ | 是 | callback方式返回是否去激活成功 | +| callback | AsyncCallback\ | 是 | 回调函数,当接口调用成功,err为null,否则为错误对象。 | **错误码**: @@ -260,7 +260,7 @@ adminManager.disableAdmin(wantTemp, 100, error => { disableAdmin(admin: Want, userId?: number): Promise\ -以异步方法根据给定的包名和类名将设备普通管理员应用去激活,使用Promise形式返回是否去激活成功。 +如果调用接口时传入了可选参数userId,则将指定用户下的指定普通管理员应用去激活,否则将当前用户下的指定普通管理员应用去激活,使用Promise形式返回是否去激活成功。 **需要权限:** ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN @@ -272,14 +272,14 @@ disableAdmin(admin: Want, userId?: number): Promise\ | 参数名 | 类型 | 必填 | 说明 | | ------ | ----------------------------------- | ---- | ---------------------------- | -| admin | [Want](js-apis-app-ability-want.md) | 是 | 普通设备管理员应用 | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 普通设备管理员应用。 | | userId | number | 否 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 | **返回值:** | 类型 | 说明 | | ----------------- | ----------------- | -| Promise\ | Promise形式返回是否激活成功 | +| Promise\ | 无返回结果的Promise对象。当去激活普通管理员应用失败时会抛出错误对象。 | **错误码**: @@ -305,7 +305,7 @@ adminManager.disableAdmin(wantTemp, 100).catch(error => { disableSuperAdmin(bundleName: String, callback: AsyncCallback\): void -以异步方法根据给定的包名将设备超级管理员应用去激活,使用Callback形式返回是否去激活成功。 +根据bundleName将管理员用户下的超级管理员应用去激活,使用callback形式返回是否去激活成功。 **需要权限:** ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN @@ -317,8 +317,8 @@ disableSuperAdmin(bundleName: String, callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | ---------- | ----------------------- | ---- | ------------------- | -| bundleName | String | 是 | 超级设备管理员应用的包名 | -| callback | AsyncCallback\ | 是 | callback方式返回是否去激活成功 | +| bundleName | String | 是 | 超级设备管理员应用的包名。 | +| callback | AsyncCallback\ | 是 | 回调函数,当接口调用成功,err为null,否则为错误对象。 | **错误码**: @@ -345,7 +345,7 @@ adminManager.disableSuperAdmin(bundleName, error => { disableSuperAdmin(bundleName: String): Promise\ -以异步方法根据给定的包名将设备超级管理员应用去激活,使用Promise形式返回是否去激活成功。 +根据bundleName将管理员用户下的超级管理员应用去激活,使用Promise形式返回是否去激活成功。 **需要权限:** ohos.permission.MANAGE_ENTERPRISE_DEVICE_ADMIN @@ -357,13 +357,13 @@ disableSuperAdmin(bundleName: String): Promise\ | 参数名 | 类型 | 必填 | 说明 | | ---------- | ------ | ---- | ------------ | -| bundleName | String | 是 | 超级设备管理员应用的包名 | +| bundleName | String | 是 | 超级设备管理员应用的包名。 | **返回值:** | 类型 | 说明 | | ----------------- | ----------------- | -| Promise\ | Promise形式返回是否激活成功 | +| Promise\ | 无返回结果的Promise对象。当去激活超级管理员应用失败时会抛出错误对象。 | **错误码**: @@ -386,7 +386,7 @@ adminManager.disableSuperAdmin(bundleName).catch(error => { isAdminEnabled(admin: Want, callback: AsyncCallback\): void -以异步方法根据给定的包名和类名判断设备管理员应用是否被激活,使用Callback形式返回是否处于激活状态。 +查询当前用户下的指定设备管理员应用是否被激活,使用callback形式返回是否处于激活状态。 **系统能力:** SystemCapability.Customization.EnterpriseDeviceManager @@ -396,8 +396,8 @@ isAdminEnabled(admin: Want, callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------------- | ---- | -------------------- | -| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用 | -| callback | AsyncCallback\ | 是 | callback方式返回是否处于激活状态 | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | +| callback | AsyncCallback\ | 是 | 回调函数,当接口调用成功,err为null,data为boolean值,true表示当前用户下的指定设备管理员应用被激活,false表示当前用户下的指定设备管理员应用未激活,否则err为错误对象。 | **示例**: @@ -419,7 +419,7 @@ adminManager.isAdminEnabled(wantTemp, (error, result) => { isAdminEnabled(admin: Want, userId: number, callback: AsyncCallback\): void -以异步方法根据给定的包名和类名判断设备管理员应用是否被激活,使用Callback形式返回是否处于激活状态。 +查询指定用户下的指定设备管理员应用是否被激活,使用callback形式返回是否处于激活状态。 **系统能力:** SystemCapability.Customization.EnterpriseDeviceManager @@ -429,9 +429,9 @@ isAdminEnabled(admin: Want, userId: number, callback: AsyncCallback\): | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------------- | ---- | ---------------------------- | -| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用 | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | | userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 | -| callback | AsyncCallback\ | 是 | callback方式返回是否处于激活状态 | +| callback | AsyncCallback\ | 是 | 回调函数,当接口调用成功,err为null,data为boolean值,true表示当前用户下的指定设备管理员应用被激活,false表示当前用户下的指定设备管理员应用未激活,否则err为错误对象。 | **示例**: @@ -453,7 +453,7 @@ adminManager.isAdminEnabled(wantTemp, 100, (error, result) => { isAdminEnabled(admin: Want, userId?: number): Promise\ -以异步方法根据给定的包名和类名判断设备管理员应用是否被激活,使用Promise形式返回是否处于激活状态。 +如果调用接口时传入参数userId,则查询指定用户下的设备管理员应用是否被激活,否则判断当前用户下的设备管理员应用是否被激活,使用Promise形式返回是否处于激活状态。 **系统能力:** SystemCapability.Customization.EnterpriseDeviceManager @@ -463,14 +463,14 @@ isAdminEnabled(admin: Want, userId?: number): Promise\ | 参数名 | 类型 | 必填 | 说明 | | ------ | ----------------------------------- | ---- | ---------------------------- | -| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用 | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | | userId | number | 否 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 | **返回值:** | 类型 | 说明 | | ----------------- | ------------------- | -| Promise\ | Promise形式返回是否处于激活状态 | +| Promise\ | Promise对象, 返回true表示指定的管理员应用被激活,返回false表示指定的管理员应用未激活。| **示例**: @@ -490,7 +490,7 @@ adminManager.isAdminEnabled(wantTemp, 100).then((result) => { isSuperAdmin(bundleName: String, callback: AsyncCallback\): void -以异步方法根据给定的包名判断设备超级管理员应用是否被激活,使用Callback形式返回是否处于激活状态。 +根据bundleName查询管理员用户下的超级管理员应用是否被激活,使用callback形式返回是否处于激活状态。 **系统能力:** SystemCapability.Customization.EnterpriseDeviceManager @@ -500,8 +500,8 @@ isSuperAdmin(bundleName: String, callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | ---------- | ----------------------- | ---- | -------------------- | -| bundleName | String | 是 | 设备管理员应用 | -| callback | AsyncCallback\ | 是 | callback方式返回是否处于激活状态 | +| bundleName | String | 是 | 设备管理员应用。 | +| callback | AsyncCallback\ | 是 | 回调函数,当接口调用成功,err为null,data为boolean类型值,true表示当前用户下的指定设备管理员应用被激活,false表示当前用户下的指定设备管理员应用未激活,否则err为错误对象。 | **示例**: @@ -520,7 +520,7 @@ adminManager.isSuperAdmin(bundleName, (error, result) => { isSuperAdmin(bundleName: String): Promise\ -以异步方法根据给定的包名判断设备超级管理员应用是否被激活,使用Promise形式返回是否处于激活状态。 +根据bundleName查询管理员用户下的超级管理员应用是否被激活,使用Promise形式返回是否处于激活状态。 **系统能力:** SystemCapability.Customization.EnterpriseDeviceManager @@ -530,13 +530,13 @@ isSuperAdmin(bundleName: String): Promise\ | 参数名 | 类型 | 必填 | 说明 | | ---------- | ------ | ---- | --------- | -| bundleName | String | 是 | 超级设备管理员应用 | +| bundleName | String | 是 | 超级设备管理员应用。 | **返回值:** | 错误码ID | 错误信息 | | ----------------- | ------------------- | -| Promise\ | Promise形式返回是否处于激活状态 | +| Promise\ | Promise对象, 返回true表示指定的超级管理员应用被激活,返回false表示指定的超级管理员应用未激活。 | **示例**: @@ -553,7 +553,7 @@ adminManager.isSuperAdmin(bundleName).then((result) => { setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo, callback: AsyncCallback\;): void -设置设备管理员应用的企业信息,使用callback形式返回是否设置成功。 +设置指定设备管理员应用的企业信息,使用callback形式返回是否设置成功。 **需要权限:** ohos.permission.SET_ENTERPRISE_INFO @@ -565,9 +565,9 @@ setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo, callback: AsyncCa | 参数名 | 类型 | 必填 | 说明 | | -------------- | ----------------------------------- | ---- | ---------------------- | -| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用 | -| enterpriseInfo | [EnterpriseInfo](#enterpriseinfo) | 是 | 设备管理员应用的企业信息 | -| callback | AsyncCallback\; | 是 | callback方式返回是否设置企业信息成功 | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | +| enterpriseInfo | [EnterpriseInfo](#enterpriseinfo) | 是 | 设备管理员应用的企业信息。 | +| callback | AsyncCallback\; | 是 | 回调函数,当接口调用成功,err为null,否则为错误对象。 | **错误码**: @@ -601,7 +601,7 @@ adminManager.setEnterpriseInfo(wantTemp, enterpriseInfo, error => { setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo): Promise\; -设置设备管理员应用的企业信息,使用Promise形式返回是否设置成功。 +设置指定设备管理员应用的企业信息,使用Promise形式返回是否设置成功。 **需要权限:** ohos.permission.SET_ENTERPRISE_INFO @@ -620,7 +620,7 @@ setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo): Promise\; | 类型 | 说明 | | ----------------- | --------------------- | -| Promise\ | Promise方式返回是否设置企业信息成功 | +| Promise\ | 无返回结果的Promise对象。当设置设备管理员应用企业信息失败时会抛出错误对象。 | **错误码**: @@ -650,7 +650,7 @@ adminManager.setEnterpriseInfo(wantTemp, enterpriseInfo).catch(error => { getEnterpriseInfo(admin: Want, callback: AsyncCallback<EnterpriseInfo>): void -获取设备管理员应用的企业信息,使用callback形式返回设备管理员应用的企业信息。 +获取指定设备管理员应用的企业信息,使用callback形式返回设备管理员应用的企业信息。 **系统能力:** SystemCapability.Customization.EnterpriseDeviceManager @@ -661,7 +661,7 @@ getEnterpriseInfo(admin: Want, callback: AsyncCallback<EnterpriseInfo>): v | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------------------- | ---- | ------------------------ | | admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用 | -| callback | AsyncCallback<[EnterpriseInfo](#enterpriseinfo)> | 是 | callback方式返回设备管理员应用的企业信息 | +| callback | AsyncCallback<[EnterpriseInfo](#enterpriseinfo)> | 是 | 回调函数,当接口调用成功,err为null,data为设备管理员应用的企业信息,否则err为错误对象。 | **错误码**: @@ -692,7 +692,7 @@ adminManager.getEnterpriseInfo(wantTemp, (error, result) => { getEnterpriseInfo(admin: Want): Promise<EnterpriseInfo> -获取设备管理员应用的企业信息,使用Promise形式返回设备管理员应用的企业信息。 +获取指定设备管理员应用的企业信息,使用Promise形式返回设备管理员应用的企业信息。 **系统能力:** SystemCapability.Customization.EnterpriseDeviceManager @@ -708,7 +708,7 @@ getEnterpriseInfo(admin: Want): Promise<EnterpriseInfo> | 类型 | 说明 | | ---------------------------------------- | ------------------------- | -| Promise<[EnterpriseInfo](#enterpriseinfo)> | Promise方式返回设备管理员应用的企业信息对象 | +| Promise<[EnterpriseInfo](#enterpriseinfo)> | Promise对象,返回指定设备管理员应用的企业信息。 | **错误码**: @@ -737,7 +737,7 @@ adminManager.getEnterpriseInfo(wantTemp).then((result) => { subscribeManagedEvent(admin: Want, managedEvents: Array\, callback: AsyncCallback\): void -订阅系统管理事件。使用callback异步回调。 +指定设备管理员应用订阅系统管理事件。使用callback形式返回结果。 **需要权限:** ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT @@ -751,7 +751,7 @@ subscribeManagedEvent(admin: Want, managedEvents: Array\, callback | ----- | ----------------------------------- | ---- | ------- | | admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | | managedEvents | Array\<[ManagedEvent](#managedevent)> | 是 | 订阅事件数组。 | -| callback | AsyncCallback\ | 是 | 回调函数。当系统管理事件订阅成功err为null,否则为错误对象。 | +| callback | AsyncCallback\ | 是 | 回调函数,当接口调用成功,err为null,否则为错误对象。 | **错误码**: @@ -781,7 +781,7 @@ adminManager.subscribeManagedEvent(wantTemp, events, (error) => { subscribeManagedEvent(admin: Want, managedEvents: Array\): Promise\ -订阅系统管理事件。使用Promise异步回调。 +指定设备管理员应用订阅系统管理事件。使用Promise形式返回结果。 **需要权限:** ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT @@ -800,7 +800,7 @@ subscribeManagedEvent(admin: Want, managedEvents: Array\): Promise | 类型 | 说明 | | ----- | ----------------------------------- | -| Promise\ | Promise对象。无返回结果的Promise对象。 | +| Promise\ | 无返回结果的Promise对象。当指定设备管理员应用订阅系统事件失败时会抛出错误对象。 | **错误码**: @@ -829,7 +829,7 @@ adminManager.subscribeManagedEvent(wantTemp, events).then(() => { unsubscribeManagedEvent(admin: Want, managedEvents: Array\, callback: AsyncCallback\): void -取消订阅系统管理事件。使用callback异步回调。 +指定设备管理员应用取消订阅系统管理事件。使用callback形式返回结果。 **需要权限:** ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT @@ -843,7 +843,7 @@ unsubscribeManagedEvent(admin: Want, managedEvents: Array\, callba | ----- | ----------------------------------- | ---- | ------- | | admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | | managedEvents | Array\<[ManagedEvent](#managedevent)> | 是 | 取消订阅事件数组。 | -| callback | AsyncCallback\ | 是 | 回调函数。当系统管理事件取消订阅成功err为null,否则为错误对象。 | +| callback | AsyncCallback\ | 是 | 回调函数,当接口调用成功,err为null,否则为错误对象。 | **错误码**: @@ -873,7 +873,7 @@ adminManager.unsubscribeManagedEvent(wantTemp, events, (error) => { unsubscribeManagedEvent(admin: Want, managedEvents: Array\): Promise\ -取消订阅系统管理事件。使用callback异步回调。 +指定设备管理员应用取消订阅系统管理事件。使用Promise形式返回结果。 **需要权限:** ohos.permission.ENTERPRISE_SUBSCRIBE_MANAGED_EVENT @@ -892,7 +892,7 @@ unsubscribeManagedEvent(admin: Want, managedEvents: Array\): Promi | 类型 | 说明 | | ----- | ----------------------------------- | -| Promise\ | Promise对象。无返回结果的Promise对象。 | +| Promise\ | 无返回结果的Promise对象。当指定设备管理员应用取消订阅系统管理时间失败时会抛出错误对象。 | **错误码**: diff --git a/zh-cn/application-dev/reference/apis/js-apis-enterprise-bundleManager.md b/zh-cn/application-dev/reference/apis/js-apis-enterprise-bundleManager.md new file mode 100644 index 0000000000000000000000000000000000000000..1f07f73ff0ef1c72242ced25dd950f3d97e0d5eb --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-enterprise-bundleManager.md @@ -0,0 +1,432 @@ +# @ohos.enterprise.bundleManager(包管理) + +本模块提供包管理能力,包括添加包安装白名单、获取包安装白名单、移除包安装白名单等。仅企业设备管理员应用才能调用。 + +> **说明:** +> +> 本模块首批接口从API version 10开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +## 导入模块 + +```js +import bundleManager from '@ohos.enterprise.bundleManager'; +``` + +## bundleManager.addAllowedInstallBundles + +addAllowedInstallBundles(admin: Want, appIds: Array\, callback: AsyncCallback<void>): void; + +指定设备管理员应用添加包安装白名单接口,添加至白名单的应用允许在管理员用户下安装,否则不允许安装,使用callback形式返回是否添加成功。 + +**需要权限:** ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY + +**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager + +**系统API**: 此接口为系统接口。 + +**参数:** + +| 参数 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ------------------------------- | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | +| appIds | Array<string> | 是 | 允许安装包的白名单。 | +| callback | AsyncCallback<void> | 是 | 回调函数。当接口调用成功,err为null,否则为错误对象。 | + +**错误码**: + +以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md) + +| 错误码ID | 错误信息 | +| ------- | ---------------------------------------------------------------------------- | +| 9200003 | the administrator ability component is invalid. | +| 9200007 | the system ability work abnormally. | + +**示例:** + +```js +let wantTemp = { + bundleName: "com.example.myapplication", + abilityName: "EntryAbility", +}; +let appIds = {"com.example.myapplication"}; + +bundleManager.AddAllowedInstallBundles(wantTemp, appIds, (error) => { + if (error != null) { + console.log("error code:" + error.code + " error message:" + error.message); + } +}); +``` + +## bundleManager.addAllowedInstallBundles + +addAllowedInstallBundles(admin: Want, appIds: Array\, userId: number, callback: AsyncCallback<void>): void; + +指定设备管理员应用添加包安装白名单接口,添加至白名单的应用允许在指定用户下安装,否则不允许安装,使用callback形式返回是否添加成功。 + +**需要权限:** ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY + +**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager + +**系统API**: 此接口为系统接口。 + +**参数:** + +| 参数 | 类型 | 必填 | 说明 | +| ----- | ----------------------------------- | ---- | ------- | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | +| appIds | Array<string> | 是 | 允许安装包的白名单。 | +| userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 | +| callback | AsyncCallback<void> | 是 | 回调函数,当接口调用成功,err为null,否则为错误对象。 | + +**错误码**: + +以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md) + +| 错误码ID | 错误信息 | +| ------- | ---------------------------------------------------------------------------- | +| 9200003 | the administrator ability component is invalid. | +| 9200007 | the system ability work abnormally. | + +**示例:** + +```js +let wantTemp = { + bundleName: "com.example.myapplication", + abilityName: "EntryAbility", +}; +let appIds = {"com.example.myapplication"}; + +bundleManager.AddAllowedInstallBundles(wantTemp, appIds, 100, (error) => { + if (error != null) { + console.log("error code:" + error.code + " error message:" + error.message); + } +}); +``` + +## bundleManager.addAllowedInstallBundles + +addAllowedInstallBundles(admin: Want, appIds: Array\, userId?: number): Promise<void>; + +指定设备管理员应用添加包安装白名单接口,如果调用接口时传入了可选参数userId,则添加至白名单的应用允许在指定用户下安装,如果调用接口时没有传入参数userId,则添加至白名单的应用允许在当前用户下安装,使用promise形式返回是否添加成功。 + +**需要权限:** ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY + +**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager + +**系统API**: 此接口为系统接口。 + +**参数:** + +| 参数 | 类型 | 必填 | 说明 | +| ----- | ----------------------------------- | ---- | ------- | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | +| appIds | Array<string> | 是 | 允许安装包的白名单。 | +| userId | number | 否 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 | + +**返回值:** + +| 类型 | 说明 | +| --------------------- | ------------------------- | +| Promise<void> | 无返回结果的Promise对象。当指定设备管理员应用添加包安装白名单失败时会抛出错误对象。 | + +**错误码**: + +以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md) + +| 错误码ID | 错误信息 | +| ------- | ---------------------------------------------------------------------------- | +| 9200003 | the administrator ability component is invalid. | +| 9200007 | the system ability work abnormally. | + +**示例:** + +```js +let wantTemp = { + bundleName: "com.example.myapplication", + abilityName: "EntryAbility", +}; +let appIds = {"com.example.myapplication"}; + +bundleManager.addAllowedInstallBundles(wantTemp, appIds, 100).then(() => { + console.log("success"); +}).catch(error => { + console.log("error code:" + error.code + " error message:" + error.message); +}); +``` + +## bundleManager.removeAllowedInstallBundles + +removeAllowedInstallBundles(admin: Want, appIds: Array\, callback: AsyncCallback<void>): void; + +指定设备管理员应用移除包安装白名单接口,在白名单存在的情况下,不在包安装白名单中的应用不允许在当前用户下安装,使用callback形式返回移除结果。 + +**需要权限:** ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY + +**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager + +**系统API**: 此接口为系统接口。 + +**参数:** + +| 参数 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ------------------------------- | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | +| appIds | Array<string> | 是 | 移除允许安装包的白名单。 | +| callback | AsyncCallback<void> | 是 | 回调函数。当接口调用成功,err为null,否则为错误对象。 | + +**错误码**: + +以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md) + +| 错误码ID | 错误信息 | +| ------- | ---------------------------------------------------------------------------- | +| 9200003 | the administrator ability component is invalid. | +| 9200007 | the system ability work abnormally. | + +**示例:** + +```js +let wantTemp = { + bundleName: "com.example.myapplication", + abilityName: "EntryAbility", +}; +let appIds = {"com.example.myapplication"}; + +bundleManager.removeAllowedInstallBundles(wantTemp, appIds, (error) => { + if (error != null) { + console.log("error code:" + error.code + " error message:" + error.message); + } +}); +``` + +## bundleManager.removeAllowedInstallBundles + +removeAllowedInstallBundles(admin: Want, appIds: Array\, userId: number, callback: AsyncCallback<void>): void; + +指定设备管理员应用移除包安装白名单接口,在白名单存在的情况下,不在包安装白名单中的应用不允许在指定用户下安装,使用callback形式返回移除结果。 + +**需要权限:** ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY + +**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager + +**系统API**: 此接口为系统接口。 + +**参数:** + +| 参数 | 类型 | 必填 | 说明 | +| ----- | ----------------------------------- | ---- | ------- | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | +| appIds | Array<string> | 是 | 允许安装包的白名单。 | +| userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 | +| callback | AsyncCallback<void> | 是 | 回调函数。当接口调用成功,err为null,否则为错误对象。 | + +**错误码**: + +以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md) + +| 错误码ID | 错误信息 | +| ------- | ---------------------------------------------------------------------------- | +| 9200003 | the administrator ability component is invalid. | +| 9200007 | the system ability work abnormally. | + +**示例:** + +```js +let wantTemp = { + bundleName: "com.example.myapplication", + abilityName: "EntryAbility", +}; +let appIds = {"com.example.myapplication"}; + +bundleManager.removeAllowedInstallBundles(wantTemp, appIds, 100, (error) => { + if (error != null) { + console.log("error code:" + error.code + " error message:" + error.message); + } +}); +``` + +## bundleManager.removeAllowedInstallBundles + +removeAllowedInstallBundles(admin: Want, appIds: Array\, userId?: number): Promise<void>; + +指定设备管理员应用移除包安装白名单接口,在白名单存在的情况下,如果调用接口时传入参数userId,则不在包安装白名单中的应用不允许在指定用户下安装,如果调用接口时没有传入参数userId,则不在包安装白名单中的应用不允许在当前用户下安装,使用promise形式返回移除结果。 + +**需要权限:** ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY + +**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager + +**系统API**: 此接口为系统接口。 + +**参数:** + +| 参数 | 类型 | 必填 | 说明 | +| ----- | ----------------------------------- | ---- | ------- | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | +| appIds | Array\<string> | 是 | 允许安装包的白名单。 | +| userId | number | 否 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 | + +**返回值:** + +| 类型 | 说明 | +| --------------------- | ------------------------- | +| Promise<void> | 无返回结果的Promise对象。当指定设备管理员应用移除包安装白名单失败时会抛出错误对象。 | + +**错误码**: + +以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md) + +| 错误码ID | 错误信息 | +| ------- | ---------------------------------------------------------------------------- | +| 9200003 | the administrator ability component is invalid. | +| 9200007 | the system ability work abnormally. | + +**示例:** + +```js +let wantTemp = { + bundleName: "com.example.myapplication", + abilityName: "EntryAbility", +}; +let appIds = {"com.example.myapplication"}; + +bundleManager.removeAllowedInstallBundles(wantTemp, appIds, 100).then(() => { + console.log("success"); +}).catch(error => { + console.log("error code:" + error.code + " error message:" + error.message); +}); +``` + +## bundleManager.getAllowedInstallBundles + +getAllowedInstallBundles(admin: Want, callback: AsyncCallback<Array<string>>): void; + +指定管理员应用获取管理员用户下的包安装白名单接口,使用callback形式返回获取包安装白名单。 + +**需要权限:** ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY + +**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager + +**系统API**: 此接口为系统接口。 + +**参数:** + +| 参数 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ------------------------------- | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | +| callback | AsyncCallback<Array<string>> | 是 | 回调函数,当接口调用成功,err为null,否则为错误对象。 | + +**错误码**: + +以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md) + +| 错误码ID | 错误信息 | +| ------- | ---------------------------------------------------------------------------- | +| 9200003 | the administrator ability component is invalid. | +| 9200007 | the system ability work abnormally. | + +**示例:** + +```js +let wantTemp = { + bundleName: "com.example.myapplication", + abilityName: "EntryAbility", +}; + +bundleManager.getAllowedInstallBundles(wantTemp, (error) => { + if (error != null) { + console.log("error code:" + error.code + " error message:" + error.message); + } +}); +``` + +## bundleManager.getAllowedInstallBundles + +getAllowedInstallBundles(admin: Want, userId: number, callback: AsyncCallback<Array<string>>): void; + +指定管理员应用获取指定用户下的包安装白名单接口,使用callback形式返回获取包安装白名单。 + +**需要权限:** ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY + +**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager + +**系统API**: 此接口为系统接口。 + +**参数:** + +| 参数 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ------------------------------- | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | +| userId | number | 是 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 | +| callback | AsyncCallback<Array<string>> | 是 | 回调函数,当接口调用成功,err为null,否则为错误对象。 | + +**错误码**: + +以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md) + +| 错误码ID | 错误信息 | +| ------- | ---------------------------------------------------------------------------- | +| 9200003 | the administrator ability component is invalid. | +| 9200007 | the system ability work abnormally. | + +**示例:** + +```js +let wantTemp = { + bundleName: "com.example.myapplication", + abilityName: "EntryAbility", +}; + +bundleManager.getAllowedInstallBundles(wantTemp, 100, (error) => { + if (error != null) { + console.log("error code:" + error.code + " error message:" + error.message); + } +}); +``` + +## bundleManager.getAllowedInstallBundles + +getAllowedInstallBundles(admin: Want, userId?: number): Promise<Array<string>>; + +指定管理员应用获取管理员用户下包安装白名单接口,使用promise形式返回获取包安装白名单。 + +**需要权限:** ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY + +**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager + +**系统API**: 此接口为系统接口。 + +**参数:** + +| 参数 | 类型 | 必填 | 说明 | +| ----- | ----------------------------------- | ---- | ------- | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | +| userId | number | 否 | 用户ID。默认值:调用方所在用户,取值范围:大于等于0。 | + +**返回值:** + +| 类型 | 说明 | +| --------------------- | ------------------------- | +| Promise<Array<string>> | Promise对象,返回管理员用户下的包安装白名单。 | + +**错误码**: + +以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md) + +| 错误码ID | 错误信息 | +| ------- | ---------------------------------------------------------------------------- | +| 9200003 | the administrator ability component is invalid. | +| 9200007 | the system ability work abnormally. | + +**示例:** + +```js +let wantTemp = { + bundleName: "com.example.myapplication", + abilityName: "EntryAbility", +}; +bundleManager.getAllowedInstallBundles(wantTemp, 100).then(() => { + console.log("success"); +}).catch(error => { + console.log("error code:" + error.code + " error message:" + error.message); +}); +``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-enterprise-dateTimeManager.md b/zh-cn/application-dev/reference/apis/js-apis-enterprise-dateTimeManager.md index 7e807d81339a21f771863d0a6149e089fd18ab35..b3a7bb6eef5d14b0104e1bb053c68e37af2caf5f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-enterprise-dateTimeManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-enterprise-dateTimeManager.md @@ -16,7 +16,7 @@ import dateTimeManager from '@ohos.enterprise.dateTimeManager' setDateTime(admin: Want, time: number, callback: AsyncCallback\): void -设置系统时间。使用callback异步回调。 +指定设备管理员应用设置系统时间。使用callback形式返回设置结果。 **需要权限:** ohos.permission.ENTERPRISE_SET_DATETIME @@ -30,7 +30,7 @@ setDateTime(admin: Want, time: number, callback: AsyncCallback\): void | ----- | ----------------------------------- | ---- | ------- | | admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | | time | number | 是 | 时间戳(ms)。 | -| callback | AsyncCallback\ | 是 | 回调函数。当系统时间设置成功err为null,否则为错误对象。 | +| callback | AsyncCallback\ | 是 | 回调函数。当接口调用成功,err为null,否则为错误对象。 | **错误码**: @@ -59,7 +59,7 @@ dateTimeManager.setDateTime(wantTemp, 1526003846000, (error) => { setDateTime(admin: Want, time: number): Promise\ -设置系统时间。使用Promise异步回调。 +指定设备管理员应用设置系统时间。使用Promise形式返回设置结果。 **需要权限:** ohos.permission.ENTERPRISE_SET_DATETIME @@ -101,3 +101,181 @@ dateTimeManager.setDateTime(wantTemp, 1526003846000).then(() => { console.log("error code:" + error.code + " error message:" + error.message); }) ``` + +## dateTimeManager.disallowModifyDateTime10+ + +disallowModifyDateTime(admin: Want, disallow: boolean, callback: AsyncCallback\): void + +指定设备管理员应用禁止修改系统时间。使用callback形式返回结果。 + +**需要权限:** ohos.permission.ENTERPRISE_SET_DATETIME + +**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager + +**系统API**: 此接口为系统接口。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----- | ----------------------------------- | ---- | ------- | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | +| disallow | boolean | 是 | true 表示禁止修改系统时间,false表示允许修改系统时间。 | +| callback | AsyncCallback\ | 是 | 回调函数。当接口调用成功,err为null,否则为错误对象。 | + +**错误码**: + +以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md) + +| 错误码ID | 错误信息 | +| ------- | ---------------------------------------------------------------------------- | +| 9200001 | the application is not an administrator of the device. | +| 9200002 | the administrator application does not have permission to manage the device. | + +**示例:** + +```js +let wantTemp = { + bundleName: "bundleName", + abilityName: "abilityName", +}; +dateTimeManager.disallowModifyDateTime(wantTemp, true, (error) => { + if (error) { + console.log("error code:" + error.code + " error message:" + error.message); + } +}) +``` + +## dateTimeManager.disallowModifyDateTime10+ + +disallowModifyDateTime(admin: Want, disallow: boolean): Promise\ + +指定设备管理员应用禁止修改系统时间。使用Promise形式返回结果。 + +**需要权限:** ohos.permission.ENTERPRISE_SET_DATETIME + +**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager + +**系统API**: 此接口为系统接口。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----- | ----------------------------------- | ---- | ------- | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | +| disallow | boolean | 是 | true 表示禁止修改系统时间,false表示允许修改系统时间。 | + +**返回值:** + +| 类型 | 说明 | +| ----- | ----------------------------------- | +| Promise\ | 无返回结果的Promise对象。当指定设备管理员应用禁止修改系统时间失败时抛出错误对象。 | + +**错误码**: + +以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md) + +| 错误码ID | 错误信息 | +| ------- | ---------------------------------------------------------------------------- | +| 9200001 | the application is not an administrator of the device. | +| 9200002 | the administrator application does not have permission to manage the device. | + +**示例:** + +```js +let wantTemp = { + bundleName: "bundleName", + abilityName: "abilityName", +}; +dateTimeManager.disallowModifyDateTime(wantTemp, true).then(() => { +}).catch((error) => { + console.log("error code:" + error.code + " error message:" + error.message); +}) +``` + +## dateTimeManager.isModifyDateTimeDisallowed10+ + +isModifyDateTimeDisallowed(admin: Want, callback: AsyncCallback\): void + +指定设备管理员应用查询是否允许修改系统时间。使用callback形式返回是否禁止修改系统时间策略。 + +**需要权限:** ohos.permission.ENTERPRISE_SET_DATETIME + +**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager + +**系统API**: 此接口为系统接口。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----- | ----------------------------------- | ---- | ------- | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | +| callback | AsyncCallback\ | 是 | 回调函数,callbac方式返回是否禁止修改系统时间策略,true表示禁止修改系统时间,否则表示允许修改系统时间。 | + +**错误码**: + +以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md) + +| 错误码ID | 错误信息 | +| ------- | ---------------------------------------------------------------------------- | +| 9200001 | the application is not an administrator of the device. | +| 9200002 | the administrator application does not have permission to manage the device. | + +**示例:** + +```js +let wantTemp = { + bundleName: "bundleName", + abilityName: "abilityName", +}; +dateTimeManager.isModifyDateTimeDisallowed(wantTemp, (error) => { + if (error) { + console.log("error code:" + error.code + " error message:" + error.message); + } +}) +``` + +## dateTimeManager.isModifyDateTimeDisallowed10+ + +isModifyDateTimeDisallowed(admin: Want): Promise\ + +指定设备管理员应用查询是否允许修改系统时间。使用Promise形式返回是否禁止修改系统时间策略。 + +**需要权限:** ohos.permission.ENTERPRISE_SET_DATETIME + +**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager + +**系统API**: 此接口为系统接口。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----- | ----------------------------------- | ---- | ------- | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | + +**返回值:** + +| 类型 | 说明 | +| ----- | ----------------------------------- | +| Promise\ | Promise对象。promise方式返回是否禁止修改系统时间策略,true表示禁止修改系统时间,否则表示允许修改系统时间。 | + +**错误码**: + +以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md) + +| 错误码ID | 错误信息 | +| ------- | ---------------------------------------------------------------------------- | +| 9200001 | the application is not an administrator of the device. | +| 9200002 | the administrator application does not have permission to manage the device. | + +**示例:** + +```js +let wantTemp = { + bundleName: "bundleName", + abilityName: "abilityName", +}; +dateTimeManager.disallowModifyDateTime(wantTemp).then(() => { +}).catch((error) => { + console.log("error code:" + error.code + " error message:" + error.message); +}) +``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-enterprise-deviceControl.md b/zh-cn/application-dev/reference/apis/js-apis-enterprise-deviceControl.md index d497f07be910d4aeba6949dce61f4ac7b94e9cf6..00dd06e183b4188caa4b800b444e5afc4f21c1fc 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-enterprise-deviceControl.md +++ b/zh-cn/application-dev/reference/apis/js-apis-enterprise-deviceControl.md @@ -16,7 +16,7 @@ import deviceControl from '@ohos.enterprise.deviceControl' resetFactory(admin: Want, callback: AsyncCallback): void -恢复出厂设置。使用callback异步回调。 +指定设备管理员应用恢复出厂设置。使用callback异步回调。 **需要权限:** ohos.permission.ENTERPRISE_RESET_DEVICE @@ -29,7 +29,7 @@ resetFactory(admin: Want, callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | ----- | ----------------------------------- | ---- | ------- | | admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | -| callback | AsyncCallback\ | 是 | 回调函数。当系统时间设置成功err为null,否则为错误对象。 | +| callback | AsyncCallback\ | 是 | 回调函数。当接口调用成功,err为null,否则为错误对象。 | **错误码**: @@ -58,7 +58,7 @@ deviceControl.resetFactory(wantTemp, (error) => { resetFactory(admin: Want): Promise -恢复出厂设置。使用Promise异步回调。 +恢复出厂设置。使用Promise形式返回设置结果。 **需要权限:** ohos.permission.ENTERPRISE_RESET_DEVICE @@ -76,7 +76,7 @@ resetFactory(admin: Want): Promise | 类型 | 说明 | | ----- | ----------------------------------- | -| Promise\ | Promise对象。无返回结果的Promise对象。 | +| Promise\ | 无返回结果的Promise对象。当恢复出厂设置失败时抛出错误对象。| **错误码**: diff --git a/zh-cn/application-dev/reference/apis/js-apis-enterprise-deviceInfo.md b/zh-cn/application-dev/reference/apis/js-apis-enterprise-deviceInfo.md index 0fc0db10c4ceca845a55eda4d93d6ea54f4cbc66..c62ff21885856223fec6dabe5cbc7fbed5b238a7 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-enterprise-deviceInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-enterprise-deviceInfo.md @@ -16,7 +16,7 @@ import deviceInfo from '@ohos.enterprise.deviceInfo'; getDeviceSerial(admin: Want, callback: AsyncCallback<string>): void -获取设备序列号,使用callback形式返回设备序列号。 +指定设备管理员应用获取设备序列号,使用callback形式返回设备序列号。 **需要权限:** ohos.permission.ENTERPRISE_GET_DEVICE_INFO @@ -28,8 +28,8 @@ getDeviceSerial(admin: Want, callback: AsyncCallback<string>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------------------- | ---- | ------------------------------- | -| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用 | -| callback | AsyncCallback<string> | 是 | callback方式返回设备序列号 | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | +| callback | AsyncCallback<string> | 是 | 回调函数。当接口调用成功,err为null,data为设备序列号,否则err为错误对象。 | **错误码**: @@ -60,7 +60,7 @@ deviceInfo.getDeviceSerial(wantTemp, (error, result) => { getDeviceSerial(admin: Want): Promise<string> -获取设备序列号,使用callback形式返回设备序列号。 +指定设备管理员应用获取设备序列号,使用Promise形式返回设备序列号。 **需要权限:** ohos.permission.ENTERPRISE_GET_DEVICE_INFO @@ -72,13 +72,13 @@ getDeviceSerial(admin: Want): Promise<string> | 参数名 | 类型 | 必填 | 说明 | | ----- | ----------------------------------- | ---- | ------- | -| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用 | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | **返回值:** | 类型 | 说明 | | --------------------- | ------------------------- | -| Promise<string> | Promise方式返回设备序列号 | +| Promise<string> | Promise对象,返回设备序列号。 | **错误码**: @@ -107,7 +107,7 @@ deviceInfo.getDeviceSerial(wantTemp).then((result) => { getDisplayVersion(admin: Want, callback: AsyncCallback<string>): void; -获取设备版本号,使用callback形式返回设备版本号。 +指定设备管理员应用获取设备版本号,使用callback形式返回设备版本号。 **需要权限:** ohos.permission.ENTERPRISE_GET_DEVICE_INFO @@ -119,8 +119,8 @@ getDisplayVersion(admin: Want, callback: AsyncCallback<string>): void; | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------------------- | ---- | ------------------------------- | -| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用 | -| callback | AsyncCallback<string> | 是 | callback方式返回设备版本号 | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | +| callback | AsyncCallback<string> | 是 | 回调函数。当接口调用成功,err为null,data为设备版本号,否则err为错误对象。 | **错误码**: @@ -151,7 +151,7 @@ deviceInfo.getDisplayVersion(wantTemp, (error, result) => { getDisplayVersion(admin: Want): Promise<string> -获取设备版本号,使用callback形式返回设备版本号。 +指定设备管理员应用获取设备版本号,使用Promise形式返回设备版本号。 **需要权限:** ohos.permission.ENTERPRISE_GET_DEVICE_INFO @@ -163,13 +163,13 @@ getDisplayVersion(admin: Want): Promise<string> | 参数名 | 类型 | 必填 | 说明 | | ----- | ----------------------------------- | ---- | ------- | -| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用 | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | **返回值:** | 类型 | 说明 | | --------------------- | ------------------------- | -| Promise<string> | Promise方式返回设备版本号 | +| Promise<string> | Promise对象,返回设备版本号。 | **错误码**: @@ -198,7 +198,7 @@ deviceInfo.getDisplayVersion(wantTemp).then((result) => { getDeviceName(admin: Want, callback: AsyncCallback<string>): void -获取设备名称,使用callback形式返回设备名称。 +指定设备管理员应用获取设备名称,使用callback形式返回设备名称。 **需要权限:** ohos.permission.ENTERPRISE_GET_DEVICE_INFO @@ -210,8 +210,8 @@ getDeviceName(admin: Want, callback: AsyncCallback<string>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------------------- | ---- | ------------------------------- | -| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用 | -| callback | AsyncCallback<string> | 是 | callback方式返回设备名称 | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | +| callback | AsyncCallback<string> | 是 | 回调函数。当接口调用成功,err为null,data为设备名称,否则err为错误对象。 | **错误码**: @@ -242,7 +242,7 @@ deviceInfo.getDeviceName(wantTemp, (error, result) => { getDeviceName(admin: Want): Promise<string> -获取设备名称,使用callback形式返回设备名称。 +指定设备管理员应用获取设备名称,使用Promise形式返回设备名称。 **需要权限:** ohos.permission.ENTERPRISE_GET_DEVICE_INFO @@ -254,13 +254,13 @@ getDeviceName(admin: Want): Promise<string> | 参数名 | 类型 | 必填 | 说明 | | ----- | ----------------------------------- | ---- | ------- | -| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用 | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | **返回值:** | 类型 | 说明 | | --------------------- | ------------------------- | -| Promise<string> | Promise方式返回设备名称 | +| Promise<string> | Promise结果,返回设备名称。 | **错误码**: diff --git a/zh-cn/application-dev/reference/apis/js-apis-enterprise-networkManager.md b/zh-cn/application-dev/reference/apis/js-apis-enterprise-networkManager.md index d42ddca63e9e1e464bbc68ca5eecba4798837a0e..cbe54b4d8f951d5bd317d03de2bde061c309fa44 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-enterprise-networkManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-enterprise-networkManager.md @@ -16,7 +16,7 @@ import networkManager from '@ohos.enterprise.networkManager'; getAllNetworkInterfaces(admin: Want, callback: AsyncCallback<Array<string>>): void -获取所有活动的网络接口,使用callback形式返回网络接口名称数组。 +指定设备管理员应用获取所有活动的网络接口,使用callback形式返回网络接口名称数组。 **需要权限:** ohos.permission.GET_NETWORK_INFO @@ -28,8 +28,8 @@ getAllNetworkInterfaces(admin: Want, callback: AsyncCallback<Array<string& | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------------------- | ---- | ------------------------------- | -| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用 | -| callback | AsyncCallback<Array<string>> | 是 | callback方式返回网络接口名称数组 | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | +| callback | AsyncCallback<Array<string>> | 是 | 回调函数。当接口调用成功,err为null,data为网络接口名称数组,否则err为错误对象。 | **错误码**: @@ -60,7 +60,7 @@ networkManager.getAllNetworkInterfaces(admin, (error, result) => { getAllNetworkInterfaces(admin: Want): Promise<Array<string>> -获取所有活动的网络接口,使用promise形式返回网络接口名称数组。 +指定设备管理员应用获取所有活动的网络接口,使用Promise形式返回网络接口名称数组。 **需要权限:** ohos.permission.ENTERPRISE_GET_NETWORK_INFO @@ -72,13 +72,13 @@ getAllNetworkInterfaces(admin: Want): Promise<Array<string>> | 参数名 | 类型 | 必填 | 说明 | | ----- | ----------------------------------- | ---- | ------- | -| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用 | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | **返回值:** | 类型 | 说明 | | --------------------- | ------------------------- | -| Promise<Array<string>> | Promise方式返回网络接口名称数组 | +| Promise<Array<string>> | Promise结果,返回网络接口名称数组。 | **错误码**: @@ -107,7 +107,7 @@ networkManager.getAllNetworkInterfaces(wantTemp).then((result) => { getIpAddress(admin: Want, networkInterface: string, callback: AsyncCallback<string>): void -获取设备IP地址,使用callback形式返回设备IP地址。 +指定设备管理员应用根据networkInterface获取设备IP地址,使用callback形式返回设备IP地址。 **需要权限:** ohos.permission.GET_NETWORK_INFO @@ -119,9 +119,9 @@ getIpAddress(admin: Want, networkInterface: string, callback: AsyncCallback<s | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------------------- | ---- | ------------------------------- | -| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用 | -| networkInterface | string | 是 | 指定网络接口 | -| callback | AsyncCallback<string> | 是 | callback方式返回设备IP地址 | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | +| networkInterface | string | 是 | 指定网络接口。 | +| callback | AsyncCallback<string> | 是 | 回调函数。当接口调用成功,err为null,data为IP地址,否则err为错误对象。 | **错误码**: @@ -152,7 +152,7 @@ networkManager.getIpAddress(wantTemp, "eth0", (error, result) => { getIpAddress(admin: Want, networkInterface: string): Promise<string> -获取设备IP地址,使用promise形式返回设备IP地址。 +指定设备管理员应用根据networkInterface获取设备IP地址,使用Promise形式返回设备IP地址。 **需要权限:** ohos.permission.ENTERPRISE_GET_NETWORK_INFO @@ -164,14 +164,14 @@ getIpAddress(admin: Want, networkInterface: string): Promise<string> | 参数名 | 类型 | 必填 | 说明 | | ----- | ----------------------------------- | ---- | ------- | -| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用 | -| networkInterface | string | 是 | 指定网络接口 | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | +| networkInterface | string | 是 | 指定网络接口。 | **返回值:** | 类型 | 说明 | | --------------------- | ------------------------- | -| Promise<string> | Promise方式返回设备IP地址 | +| Promise<string> | Promise结果,返回设备IP地址。 | **错误码**: @@ -200,7 +200,7 @@ networkManager.getIpAddress(wantTemp, "eth0").then((result) => { getMac(admin: Want, networkInterface: string, callback: AsyncCallback<string>): void -获取设备MAC地址,使用callback形式返回设备MAC地址。 +指定设备管理员应用根据networkInterface获取设备MAC地址,使用callback形式返回设备MAC地址。 **需要权限:** ohos.permission.ENTERPRISE_GET_NETWORK_INFO @@ -212,9 +212,9 @@ getMac(admin: Want, networkInterface: string, callback: AsyncCallback<string& | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------------------- | ---- | ------------------------------- | -| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用 | -| networkInterface | string | 是 | 指定网络接口 | -| callback | AsyncCallback<string> | 是 | callback方式返回设备MAC地址 | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | +| networkInterface | string | 是 | 指定网络接口。 | +| callback | AsyncCallback<string> | 是 | 回调函数。当接口调用成功,err为null,data为设备MAC地址,否则err为错误对象。 | **错误码**: @@ -245,7 +245,7 @@ networkManager.getMac(wantTemp, "eth0", (error, result) => { getIpAddress(admin: Want, networkInterface: string): Promise<string> -获取设备MAC地址,使用promise形式返回设备IP地址。 +指定设备管理员应用根据networkInterface获取设备MAC地址,使用Promise形式返回设备IP地址。 **需要权限:** ohos.permission.ENTERPRISE_GET_NETWORK_INFO @@ -257,14 +257,14 @@ getIpAddress(admin: Want, networkInterface: string): Promise<string> | 参数名 | 类型 | 必填 | 说明 | | ----- | ----------------------------------- | ---- | ------- | -| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用 | -| networkInterface | string | 是 | 指定网络接口 | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | +| networkInterface | string | 是 | 指定网络接口。 | **返回值:** | 类型 | 说明 | | --------------------- | ------------------------- | -| Promise<string> | Promise方式返回设备MAC地址 | +| Promise<string> | Promise结果,返回设备MAC地址。 | **错误码**: diff --git a/zh-cn/application-dev/reference/apis/js-apis-enterprise-wifiManager.md b/zh-cn/application-dev/reference/apis/js-apis-enterprise-wifiManager.md index 81dbd16db9c033e8ce5dffa52fcc2db355336b7c..2450bf9cb6a746dbaca55ddb6590ef11e86007bd 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-enterprise-wifiManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-enterprise-wifiManager.md @@ -16,7 +16,7 @@ import wifiManager from '@ohos.enterprise.wifiManager'; isWifiActive(admin: Want, callback: AsyncCallback<boolean>): void -查询wifi开启状态,使用callback形式返回wifi开启状态。 +指定设备管理员应用查询wifi开启状态,使用callback形式返回wifi开启状态。 **需要权限:** ohos.permission.ENTERPRISE_SET_WIFI @@ -28,8 +28,8 @@ isWifiActive(admin: Want, callback: AsyncCallback<boolean>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------------------- | ---- | ------------------------------- | -| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用 | -| callback | AsyncCallback<boolean> | 是 | callback方式返回wifi开启状态 | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | +| callback | AsyncCallback<boolean> | 是 | 回调函数,当接口调用成功,err为null,data为boolean值,true表示wifi开启,false表示wifi关闭,否则err为错误对象。 | **错误码**: @@ -60,7 +60,7 @@ wifiManager.isWifiActive(wantTemp, (error, result) => { isWifiActive(admin: Want): Promise<boolean> -获取wifi开启状态,使用callback形式返回wifi开启状态。 +获取wifi开启状态,使用Promise形式返回wifi开启状态。 **需要权限:** ohos.permission.ENTERPRISE_SET_WIFI @@ -72,13 +72,13 @@ isWifiActive(admin: Want): Promise<boolean> | 参数名 | 类型 | 必填 | 说明 | | ----- | ----------------------------------- | ---- | ------- | -| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用 | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | **返回值:** | 类型 | 说明 | | --------------------- | ------------------------- | -| Promise<boolean> | Promise方式返回wifi开启状态 | +| Promise<boolean> | Promise结果,返回wifi开启状态,true表示wifi开启,false表示wifi关闭。 | **错误码**: @@ -102,3 +102,247 @@ wifiManager.isWifiActive(wantTemp).then((result) => { console.log("error code:" + error.code + " error message:" + error.message); }); ``` + +## wifiManager.setWifiProfile + +setWifiProfile(admin: Want, profile: WifiProfile, callback: AsyncCallback<void>): void + +配置wifi,使连接到指定网络,使用callback返回配置结果。 + +**需要权限:** ohos.permission.ENTERPRISE_SET_WIFI + +**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager + +**系统API**: 此接口为系统接口。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ------------------------------- | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | +| profile | [WifiProfile](#wifiprofile) | 是 | WLAN配置信息。 | +| callback | AsyncCallback<void> | 是 | 回调函数,当接口调用成功,err为null,否则为错误对象。 | + +**错误码**: + +以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md) + +| 错误码ID | 错误信息 | +| ------- | ---------------------------------------------------------------------------- | +| 9200001 | the application is not an administrator of the device. | +| 9200002 | the administrator application does not have permission to manage the device. | + +**示例:** + +```js +let wantTemp = { + bundleName: "com.example.myapplication", + abilityName: "EntryAbility", +}; +let profile : WifiProfile = { + "ssid": "name", + "preSharedKey": "passwd", + "securityType": wifiManager.WifiSecurityType.WIFI_SEC_TYPE_PSK +}; +wifiManager.setWifiProfile(wantTemp, profile, (error) => { + if (error != null) { + console.log("error code:" + error.code + " error message:" + error.message); + return; + } + console.log("set wifi success"); +}); +``` + +## wifiManager.setWifiProfile + +setWifiProfile(admin: Want, profile: WifiProfile): Promise<void> + +配置wifi,使连接到指定网络,使用Promise返回配置结果。 + +**需要权限:** ohos.permission.ENTERPRISE_SET_WIFI + +**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager + +**系统API**: 此接口为系统接口。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----- | ----------------------------------- | ---- | ------- | +| admin | [Want](js-apis-app-ability-want.md) | 是 | 设备管理员应用。 | +| profile | [WifiProfile](#wifiprofile) | 是 | WLAN配置信息。 | + +**返回值:** + +| 类型 | 说明 | +| --------------------- | ------------------------- | +| Promise<void> | 无返回结果的Promise对象。当配置wifi连接到指定网络失败时会抛出错误对象。 | + +**错误码**: + +以下的错误码的详细介绍请参见[企业设备管理错误码](../errorcodes/errorcode-enterpriseDeviceManager.md) + +| 错误码ID | 错误信息 | +| ------- | ---------------------------------------------------------------------------- | +| 9200001 | the application is not an administrator of the device. | +| 9200002 | the administrator application does not have permission to manage the device. | + +**示例:** + +```js +let wantTemp = { + bundleName: "com.example.myapplication", + abilityName: "EntryAbility", +}; +let profile : WifiProfile = { + "ssid": "name", + "preSharedKey": "passwd", + "securityType": wifiManager.WifiSecurityType.WIFI_SEC_TYPE_PSK +}; +wifiManager.isWifiActive(wantTemp, profile).then(() => { + console.log("set wifi success"); +}).catch(error => { + console.log("error code:" + error.code + " error message:" + error.message); +}); +``` + +## WifiProfile + +WLAN配置信息 + +**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager + +**系统API**: 此接口为系统接口。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ----------- | --------| ---- | ----- | ------------------------------- | +| ssid | string | 是 | 否 | 热点的SSID,编码格式为UTF-8。 | +| bssid | string | 是 | 否 | 热点的BSSID。 | +| preSharedKey | string | 是 | 否 | 热点的密钥。 | +| isHiddenSsid | boolean | 是 | 否 | 是否是隐藏网络。 | +| securityType | [WifiSecurityType](#wifisecuritytype) | 是 | 否 | 加密类型。 | +| creatorUid | number | 是 | 否 | 创建用户的ID。 | +| disableReason | number | 是 | 否 | 禁用原因。 | +| netId | number | 是 | 否 | 分配的网络ID。 | +| randomMacType | number | 是 | 否 | 随机MAC类型 | +| randomMacAddr | string | 是 | 否 | 随机MAC地址 | +| ipType | [IpType](#iptype) | 是 | 否 | IP地址类型 | +| staticIp | [IpProfile](#ipprofile) | 是 | 否 | 静态IP配置信息。 | +| eapProfile | [WifiEapProfile](#wifieapprofile) | 是 | 否 | 可扩展身份验证协议配置。 | + +## WifiSecurityType + +表示加密类型的枚举。 + +**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager + +**系统API**: 此接口为系统接口。 + +| 名称 | 值 | 说明 | +| -------- | -------- | -------- | +| WIFI_SEC_TYPE_INVALID | 0 | 无效加密类型。 | +| WIFI_SEC_TYPE_OPEN | 1 | 开放加密类型。 | +| WIFI_SEC_TYPE_WEP | 2 | Wired Equivalent Privacy (WEP)加密类型。 | +| WIFI_SEC_TYPE_PSK | 3 | Pre-shared key (PSK)加密类型。 | +| WIFI_SEC_TYPE_SAE | 4 | Simultaneous Authentication of Equals (SAE)加密类型。 | +| WIFI_SEC_TYPE_EAP | 5 | EAP加密类型。 | +| WIFI_SEC_TYPE_EAP_SUITE_B | 6 | Suite-B 192位加密类型。 | +| WIFI_SEC_TYPE_OWE | 7 | 机会性无线加密类型。 | +| WIFI_SEC_TYPE_WAPI_CERT | 8 | WAPI-Cert加密类型。 | +| WIFI_SEC_TYPE_WAPI_PSK | 9 | WAPI-PSK加密类型。 | + +## IpType + +表示IP类型的枚举。 + +**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager + +**系统API**: 此接口为系统接口。 + +| 名称 | 值 | 说明 | +| -------- | -------- | -------- | +| STATIC | 0 | 静态IP。 | +| DHCP | 1 | 通过DHCP获取。 | +| UNKNOWN | 2 | 未指定。 | + +## IpProfile + +IP配置信息。 + +**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager + +**系统API**: 此接口为系统接口。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------- | -------- | -------- | -------- | -------- | +| ipAddress | number | 是 | 否 | IP地址。 | +| gateway | number | 是 | 否 | 网关。 | +| prefixLength | number | 是 | 否 | 掩码。 | +| dnsServers | number[] | 是 | 否 | DNS服务器。 | +| domains | Array<string> | 是 | 否 | 域信息。 | + +## WifiEapProfile + +可扩展身份验证协议配置信息。 + +**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager + +**系统API**: 此接口为系统接口。 + +| **名称** | **类型** | **可读** | **可写** | **说明** | +| -------- | -------- | -------- | -------- | -------- | +| eapMethod | [EapMethod](#eapmethod) | 是 | 否 | EAP认证方式。 | +| phase2Method | [Phase2Method](#phase2method) | 是 | 否 | 第二阶段认证方式。 | +| identity | string | 是 | 否 | 身份信息。 | +| anonymousIdentity | string | 是 | 否 | 匿名身份。 | +| password | string | 是 | 否 | 密码。 | +| caCertAliases | string | 是 | 否 | CA 证书别名。 | +| caPath | string | 是 | 否 | CA 证书路径。 | +| clientCertAliases | string | 是 | 否 | 客户端证书别名。 | +| certEntry | Uint8Array | 是 | 是 | CA 证书内容。 | +| certPassword | string | 是 | 是 | CA证书密码。 | +| altSubjectMatch | string | 是 | 否 | 替代主题匹配。 | +| domainSuffixMatch | string | 是 | 否 | 域后缀匹配。 | +| realm | string | 是 | 否 | 通行证凭证的领域。 | +| plmn | string | 是 | 否 | 公共陆地移动网的直通凭证提供商。 | +| eapSubId | number | 是 | 否 | SIM卡的子ID。 | + +## EapMethod + +表示EAP认证方式的枚举。 + +**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager + +**系统API**: 此接口为系统接口。 + +| 名称 | 值 | 说明 | +| -------- | -------- | -------- | +| EAP_NONE | 0 | 不指定。 | +| EAP_PEAP | 1 | PEAP类型。 | +| EAP_TLS | 2 | TLS类型。 | +| EAP_TTLS | 3 | TTLS类型。 | +| EAP_PWD | 4 | PWD类型。 | +| EAP_SIM | 5 | SIM类型。 | +| EAP_AKA | 6 | AKA类型。 | +| EAP_AKA_PRIME | 7 | AKA Prime类型。 | +| EAP_UNAUTH_TLS | 8 | UNAUTH TLS类型。 | + + +## Phase2Method + +表示第二阶段认证方式的枚举。 + +**系统能力:** SystemCapability.Customization.EnterpriseDeviceManager + +**系统API**: 此接口为系统接口。 + +| 名称 | 值 | 说明 | +| -------- | -------- | -------- | +| PHASE2_NONE | 0 | 不指定。 | +| PHASE2_PAP | 1 | PAP类型。 | +| PHASE2_MSCHAP | 2 | MSCHAP类型。 | +| PHASE2_MSCHAPV2 | 3 | MSCHAPV2类型。 | +| PHASE2_GTC | 4 | GTC类型。 | +| PHASE2_SIM | 5 | SIM类型。 | +| PHASE2_AKA | 6 | AKA类型。 | +| PHASE2_AKA_PRIME | 7 | AKA Prime类型。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-faultLogger.md b/zh-cn/application-dev/reference/apis/js-apis-faultLogger.md index 4d23dcbbf40b40346096ff71db83443c53911676..c403de289f98a680174bef93c5392adc47d3909f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-faultLogger.md +++ b/zh-cn/application-dev/reference/apis/js-apis-faultLogger.md @@ -40,11 +40,9 @@ import faultLogger from '@ohos.faultLogger' | summary | string | 是 | 故障的概要 | | fullLog | string | 是 | 故障日志全文 | -## faultLogger.querySelfFaultLog(deprecated) - -querySelfFaultLog(faultType: FaultType, callback: AsyncCallback<Array<FaultLogInfo>>) : void +## faultLogger.query9+ -> **说明:** 从 API Version 9 开始废弃,建议使用[faultLogger.query](#faultloggerquery9)替代。 +query(faultType: FaultType, callback: AsyncCallback<Array<FaultLogInfo>>) : void 获取当前进程故障信息,该方法通过回调方式获取故障信息数组,故障信息数组内最多上报10份故障信息。 @@ -57,6 +55,14 @@ querySelfFaultLog(faultType: FaultType, callback: AsyncCallback<Array<Faul | faultType | [FaultType](#faulttype) | 是 | 输入要查询的故障类型。 | | callback | AsyncCallback<Array<[FaultLogInfo](#faultloginfo)>> | 是 | 回调函数,在回调函数中获取故障信息数组。
- value拿到故障信息数组;value为undefined表示获取过程中出现异常,error返回错误提示字符串 +**错误码:** + +以下错误码的详细介绍参见[ohos.faultLogger错误码](../errorcodes/errorcode-faultlogger.md)。 + +| 错误码ID | 错误信息 | +| --- | --- | +| 10600001 | The service is not started or is faulty | + **示例:** ```js @@ -79,14 +85,16 @@ function queryFaultLogCallback(error, value) { } } } -faultLogger.querySelfFaultLog(faultLogger.FaultType.JS_CRASH, queryFaultLogCallback); +try { + faultLogger.query(faultLogger.FaultType.JS_CRASH, queryFaultLogCallback); +} catch (err) { + console.error(`code: ${err.code}, message: ${err.message}`); +} ``` -## faultLogger.querySelfFaultLog(deprecated) - -querySelfFaultLog(faultType: FaultType) : Promise<Array<FaultLogInfo>> +## faultLogger.query9+ -> **说明:** 从 API Version 9 开始废弃,建议使用[faultLogger.query](#faultloggerquery9-1)替代。 +query(faultType: FaultType) : Promise<Array<FaultLogInfo>> 获取当前进程故障信息,该方法通过Promise方式返回故障信息数组,故障信息数组内最多上报10份故障信息。 @@ -104,32 +112,48 @@ querySelfFaultLog(faultType: FaultType) : Promise<Array<FaultLogInfo>&g | -------- | -------- | | Promise<Array<[FaultLogInfo](#faultloginfo)>> | Promise实例,可以在其then()方法中获取故障信息实例,也可以使用await。
- value拿到故障信息数组;value为undefined表示获取过程中出现异常 | +**错误码:** + +以下错误码的详细介绍参见[ohos.faultLogger错误码](../errorcodes/errorcode-faultlogger.md)。 + +| 错误码ID | 错误信息 | +| --- | --- | +| 10600001 | The service is not started or is faulty | + **示例:** ```js async function getLog() { - let value = await faultLogger.querySelfFaultLog(faultLogger.FaultType.JS_CRASH); - if (value) { - console.info("value length is " + value.length); - let len = value.length; - for (let i = 0; i < len; i++) { - console.info("log: " + i); - console.info("Log pid: " + value[i].pid); - console.info("Log uid: " + value[i].uid); - console.info("Log type: " + value[i].type); - console.info("Log timestamp: " + value[i].timestamp); - console.info("Log reason: " + value[i].reason); - console.info("Log module: " + value[i].module); - console.info("Log summary: " + value[i].summary); - console.info("Log text: " + value[i].fullLog); + try { + let value = await faultLogger.query(faultLogger.FaultType.JS_CRASH); + if (value) { + console.info("value length is " + value.length); + let len = value.length; + for (let i = 0; i < len; i++) { + console.info("log: " + i); + console.info("Log pid: " + value[i].pid); + console.info("Log uid: " + value[i].uid); + console.info("Log type: " + value[i].type); + console.info("Log timestamp: " + value[i].timestamp); + console.info("Log reason: " + value[i].reason); + console.info("Log module: " + value[i].module); + console.info("Log summary: " + value[i].summary); + console.info("Log text: " + value[i].fullLog); + } } + } catch (err) { + console.error(`code: ${err.code}, message: ${err.message}`); } } ``` -## faultLogger.query9+ +## faultLogger.querySelfFaultLog(deprecated) -query(faultType: FaultType, callback: AsyncCallback<Array<FaultLogInfo>>) : void +querySelfFaultLog(faultType: FaultType, callback: AsyncCallback<Array<FaultLogInfo>>) : void + +> **说明:** +> +> 从 API Version 9 开始废弃,建议使用[faultLogger.query](#faultloggerquery9)替代。 获取当前进程故障信息,该方法通过回调方式获取故障信息数组,故障信息数组内最多上报10份故障信息。 @@ -142,14 +166,6 @@ query(faultType: FaultType, callback: AsyncCallback<Array<FaultLogInfo> | faultType | [FaultType](#faulttype) | 是 | 输入要查询的故障类型。 | | callback | AsyncCallback<Array<[FaultLogInfo](#faultloginfo)>> | 是 | 回调函数,在回调函数中获取故障信息数组。
- value拿到故障信息数组;value为undefined表示获取过程中出现异常,error返回错误提示字符串 -**错误码:** - -以下错误码的详细介绍参见[ohos.faultLogger错误码](../errorcodes/errorcode-faultlogger.md)。 - -| 错误码ID | 错误信息 | -| --- | --- | -| 10600001 | The service is not running or broken | - **示例:** ```js @@ -172,16 +188,16 @@ function queryFaultLogCallback(error, value) { } } } -try { - faultLogger.query(faultLogger.FaultType.JS_CRASH, queryFaultLogCallback); -} catch (err) { - console.error(`code: ${err.code}, message: ${err.message}`); -} +faultLogger.querySelfFaultLog(faultLogger.FaultType.JS_CRASH, queryFaultLogCallback); ``` -## faultLogger.query9+ +## faultLogger.querySelfFaultLog(deprecated) -query(faultType: FaultType) : Promise<Array<FaultLogInfo>> +querySelfFaultLog(faultType: FaultType) : Promise<Array<FaultLogInfo>> + +> **说明:** +> +> 从 API Version 9 开始废弃,建议使用[faultLogger.query](#faultloggerquery9-1)替代。 获取当前进程故障信息,该方法通过Promise方式返回故障信息数组,故障信息数组内最多上报10份故障信息。 @@ -199,37 +215,25 @@ query(faultType: FaultType) : Promise<Array<FaultLogInfo>> | -------- | -------- | | Promise<Array<[FaultLogInfo](#faultloginfo)>> | Promise实例,可以在其then()方法中获取故障信息实例,也可以使用await。
- value拿到故障信息数组;value为undefined表示获取过程中出现异常 | -**错误码:** - -以下错误码的详细介绍参见[ohos.faultLogger错误码](../errorcodes/errorcode-faultlogger.md)。 - -| 错误码ID | 错误信息 | -| --- | --- | -| 10600001 | The service is not running or broken | - **示例:** ```js async function getLog() { - try { - let value = await faultLogger.query(faultLogger.FaultType.JS_CRASH); - if (value) { - console.info("value length is " + value.length); - let len = value.length; - for (let i = 0; i < len; i++) { - console.info("log: " + i); - console.info("Log pid: " + value[i].pid); - console.info("Log uid: " + value[i].uid); - console.info("Log type: " + value[i].type); - console.info("Log timestamp: " + value[i].timestamp); - console.info("Log reason: " + value[i].reason); - console.info("Log module: " + value[i].module); - console.info("Log summary: " + value[i].summary); - console.info("Log text: " + value[i].fullLog); - } + let value = await faultLogger.querySelfFaultLog(faultLogger.FaultType.JS_CRASH); + if (value) { + console.info("value length is " + value.length); + let len = value.length; + for (let i = 0; i < len; i++) { + console.info("log: " + i); + console.info("Log pid: " + value[i].pid); + console.info("Log uid: " + value[i].uid); + console.info("Log type: " + value[i].type); + console.info("Log timestamp: " + value[i].timestamp); + console.info("Log reason: " + value[i].reason); + console.info("Log module: " + value[i].module); + console.info("Log summary: " + value[i].summary); + console.info("Log text: " + value[i].fullLog); } - } catch (err) { - console.error(`code: ${err.code}, message: ${err.message}`); } } -``` +``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-file-backup.md b/zh-cn/application-dev/reference/apis/js-apis-file-backup.md new file mode 100644 index 0000000000000000000000000000000000000000..903f7fc07acc394651d9c4fdba7976e566ff25d1 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-file-backup.md @@ -0,0 +1,686 @@ +# @ohos.file.backup (备份恢复) + +该模块为应用提供备份/恢复数据的能力。 + +> **说明:** +> - 本模块首批接口从API version 10开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> - 本模块接口为系统接口。 +> - 本模块支持对错误码进行处理,错误码及其适配方式[参考文档](../errorcodes/errorcode-filemanagement.md#错误码适配指导)。 + +## 导入模块 + +```js +import backup from '@ohos.file.backup'; +``` + +## FileMeta + +文件的元数据,包含一个应用名称以及文件uri。FileMeta在执行备份/恢复时是不可缺少的对象 + +**系统能力**:SystemCapability.FileManagement.StorageService.Backup + +| 名称 | 类型 | 必填 | 说明 | +| ---------- | ------ | ---- | ---------------------------------------------------------------------------------------------- | +| bundleName | string | 是 | 应用名称,可通过[bundle.BundleInfo](js-apis-bundle-BundleInfo.md)提供的获取方式获取。 | +| uri | string | 是 | 应用沙箱内待传输文件的名称,当前uri尚未升级为标准格式,仅接受0-9a-zA-Z下划线(_)点(.)组成的名称 | + +## FileData + +文件的元数据,包含一个已经打开的文件描述符。FileData在执行备份/恢复时是不可缺少的对象 + +> **说明:** +> - FileData使用完成后必须关闭,如不关闭会出现内心泄露问题。关闭的方法可参考由[@ohos.file.fs](./js-apis-file-fs.md)提供的[fs.closeSync](js-apis-file-fs.md#fsclosesync)等相关关闭接口 + +**系统能力**:SystemCapability.FileManagement.StorageService.Backup + +| 名称 | 类型 | 必填 | 说明 | +| ---- | ------ | ---- | ---------------------------------------- | +| fd | number | 是 | 已经打开的文件描述符,通过备份服务获取。 | + +## File + +一个文件对象。 +继承[FileMeta](#filemeta)和[FileData](#filedata) + +> **说明:** +> - file.backup.File与@ohos.file.fs中的提供的[File](js-apis-file-fs.md#file)是带有不同的涵义,前者是继承[FileMeta](#filemeta)和[FileData](#filedata)的对象而后者只有一个文件描述符的对象。请注意做区分,不要混淆。 + +**系统能力**:SystemCapability.FileManagement.StorageService.Backup + +## GeneralCallbacks + +备份/恢复过程中的通用回调,备份服务将通过这些回调通知客户端其应用的备份/恢复阶段。 + +**系统能力**:SystemCapability.FileManagement.StorageService.Backup + +### onFileReady + +onFileReady : AsyncCallback<File> + +回调函数。当服务端返向客户端发送文件成功,err为undefined,否则为错误对象。 + +> **说明:** +> - AsyncCallback回调中返回的File 所属file.backup.[File](#file)类型,返回的文件归备份服务所有,一旦文件关闭,备份服务将选择合适的实际去清理,但客户端必须关闭文件句柄。 + +**系统能力**:SystemCapability.FileManagement.StorageService.Backup + +**示例:** + + ```js + import fs from '@ohos.file.fs'; + onFileReady: (err, file) => { + if (err) { + console.error('onFileReady failed with err: ' + err); + } + console.info('onFileReady success with file: ' + file.bundleName + ' ' + file.uri); + fs.closeSync(file.fd); + } + ``` + +### onBundleBegin + +onBundleBegin : AsyncCallback<string> + + 回调函数。当应用备份/恢复开始时返回bundle名称成功,err为undefined,否则为错误对象。 + +> **说明:** +> - 回调函数。当应用备份/恢复开始时,err为undefined,否则为错误对象。 + +**系统能力**:SystemCapability.FileManagement.StorageService.Backup + +**示例:** + + ```js + onBundleBegin: (err, bundleName) => { + if (err) { + console.error('onBundleBegin failed with err: ' + err); + } + console.info('onBundleBegin success with bundleName: ' + bundleName); + } + ``` + +### onBundleEnd + +onBundleEnd : AsyncCallback<string> + +回调函数。当应用备份/恢复结束后返回bundle名称成功,err为undefined,否则为错误对象。 + +**系统能力**:SystemCapability.FileManagement.StorageService.Backup + +**示例:** + + ```js + onBundleEnd: (err, bundleName) => { + if (err) { + console.error('onBundleEnd failed with err: ' + err); + } + console.info('onBundleEnd success with bundleName: ' + bundleName); + } + ``` + +### onAllBundlesEnd + +onAllBundlesEnd : AsyncCallback<undefined> + +回调函数。当所有bundle的备份/恢复过程结束成功,err为undefined,否则为错误对象。 + +**系统能力**:SystemCapability.FileManagement.StorageService.Backup + +**示例:** + + ```js + onAllBundlesEnd: (err) => { + if (err) { + console.error('onAllBundlesEnd failed with err: ' + err); + } + console.info('onAllBundlesEnd success'); + } + ``` + +### onBackupServiceDied + +onBackupServiceDied : Callback<undefined> + +回调函数,返回备份服务死亡。 + +**系统能力**:SystemCapability.FileManagement.StorageService.Backup + +**示例:** + + ```js + onBackupServiceDied: () => { + console.info('onBackupServiceDied success'); + } + ``` + +## getLocalCapabilities + +getLocalCapabilities(callback: AsyncCallback<FileData>): void; + +用于获取一个描述本地能力的Json文件。使用callback异步回调。 + +**需要权限**:ohos.permission.BACKUP + +**系统能力**:SystemCapability.FileManagement.StorageService.Backup + +**参数:** +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------ | ---- | ------------------------------------------------------ | +| callback | AsyncCallback<[FileData](#filedata)> | 是 | 回调函数。当获取成功,err为undefined,否则为错误对象。 | + +**示例:** + + ```js + import fs from '@ohos.file.fs'; + try { + backup.getLocalCapabilities((err, fileData) => { + if (err) { + console.error('getLocalCapabilities failed with err: ' + err); + } + console.info('getLocalCapabilities success'); + fs.closeSync(fileData.fd); + }); + } catch (err) { + console.error('getLocalCapabilities failed with err: ' + err); + } + ``` + + +**返回的能力文件内容示例:** + + ```json + { + "bundleInfos" :[{ + "allToBackup" : true, + "extensionName" : "BackupExtensionAbility", + "name" : "com.example.hiworld", + "needToInstall" : false, + "spaceOccupied" : 0, + "versionCode" : 1000000, + "versionName" : "1.0.0" + }], + "deviceType" : "phone", + "systemFullName" : "OpenHarmony-4.0.0.0" + } + ``` + +## getLocalCapabilities + +getLocalCapabilities(): Promise<FileData>; + +用于获取一个描述本地能力的Json文件。使用Promise异步回调。 + +**需要权限**:ohos.permission.BACKUP + +**系统能力**:SystemCapability.FileManagement.StorageService.Backup + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------ | --------------------------------------------------- | +| Promise<[FileData](#filedata)> | Promise对象,返回描述本地能力的Json文件的FileData。 | + +**示例:** + + ```js + import fs from '@ohos.file.fs'; + try { + let fileData = await backup.getLocalCapabilities(); + console.info('getLocalCapabilities success'); + fs.closeSync(fileData.fd); + } catch (err) { + console.error('getLocalCapabilities failed with err: ' + err); + } + ``` + + **返回的能力文件内容示例:** + + ```json + { + "bundleInfos" :[{ + "allToBackup" : true, + "extensionName" : "BackupExtensionAbility", + "name" : "com.example.hiworld", + "needToInstall" : false, + "spaceOccupied" : 0, + "versionCode" : 1000000, + "versionName" : "1.0.0" + }], + "deviceType" : "phone", + "systemFullName" : "OpenHarmony-4.0.0.0" + } + ``` + +## SessionBackup + +备份流程对象,用来支撑应用备份的流程。在使用前,需要先创建SessionBackup实例。 + +### constructor + +constructor(callbacks: GeneralCallbacks); + +备份流程的构造函数,用于获取SessionBackup类的实例。 + +**需要权限**:ohos.permission.BACKUP + +**系统能力**:SystemCapability.FileManagement.StorageService.Backup + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------- | ---- | -------------------- | +| callback | [GeneralCallbacks](#generalcallbacks) | 是 | 备份流程所需的回调。 | + +**示例:** + + ```js + import fs from '@ohos.file.fs'; + let sessionBackup = new backup.SessionBackup({ + onFileReady: (err, file) => { + if (err) { + console.error('onFileReady failed with err: ' + err); + } + console.info('onFileReady success'); + fs.closeSync(file.fd); + }, + onBundleBegin: (err, bundleName) => { + if (err) { + console.error('onBundleBegin failed with err: ' + err); + } + console.info('onBundleBegin success'); + }, + onBundleEnd: (err, bundleName) => { + if (err) { + console.error('onBundleEnd failed with err: ' + err); + } + console.info('onBundleEnd success'); + }, + onAllBundlesEnd: (err) => { + if (err) { + console.error('onAllBundlesEnd failed with err: ' + err); + } + console.info('onAllBundlesEnd success'); + }, + onBackupServiceDied: () => { + console.info('service died'); + } + }); + ``` + +### appendBundles + +appendBundles(bundlesToBackup: string[], callback: AsyncCallback<void>): void; + +添加需要备份的应用。当前整个流程中,在获取SessionBackup类的实例后只能调用一次。使用callback异步回调。 + +**需要权限**:ohos.permission.BACKUP + +**系统能力**:SystemCapability.FileManagement.StorageService.Backup + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------------- | ------------------------- | ---- | -------------------------------------------------------------- | +| bundlesToBackup | string[] | 是 | 需要备份的应用名称的数组。 | +| callback | AsyncCallback<void> | 是 | 回调函数。当添加备份应用成功,err为undefined,否则为错误对象。 | + +**示例:** + + ```js + try { + sessionBackup.appendBundles(['com.example.hiworld'], (err) => { + if (err) { + console.error('appendBundles failed with err: ' + err); + } + console.info('appendBundles success'); + }); + } catch (err) { + console.error('appendBundles failed with err: ' + err); + } + ``` + +### appendBundles + +appendBundles(bundlesToBackup: string[]): Promise<void>; + +添加需要备份的应用。当前整个流程中,在获取SessionBackup类的实例后只能调用一次。使用Promise异步回调。 + +**需要权限**:ohos.permission.BACKUP + +**系统能力**:SystemCapability.FileManagement.StorageService.Backup + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------------- | -------- | ---- | -------------------------- | +| bundlesToBackup | string[] | 是 | 需要备份的应用名称的数组。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | -------------------------------------- | +| Promise<void> | Promise对象。无返回结果的Promise对象。 | + +**示例:** + + ```js + try { + await sessionBackup.appendBundles(['com.example.hiworld']); + console.info('appendBundles success'); + } catch (err) { + console.error('appendBundles failed with err: ' + err); + } + ``` + +## SessionRestore + +恢复流程对象,用来支撑应用恢复的流程。在使用前,需要先创建SessionRestore实例。 + +### constructor + +constructor(callbacks: GeneralCallbacks); + +恢复流程的构造函数,用于获取SessionRestore类的实例。 + +**需要权限**:ohos.permission.BACKUP + +**系统能力**:SystemCapability.FileManagement.StorageService.Backup + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------- | ---- | -------------------- | +| callback | [GeneralCallbacks](#generalcallbacks) | 是 | 恢复流程所需的回调。 | + +**示例:** + + ```js + import fs from '@ohos.file.fs'; + let sessionRestore = new backup.SessionRestore({ + onFileReady: (err, file) => { + if (err) { + console.error('onFileReady failed with err: ' + err); + } + console.info('onFileReady success'); + fs.closeSync(file.fd); + }, + onBundleBegin: (err, bundleName) => { + if (err) { + console.error('onBundleBegin failed with err: ' + err); + } + console.info('onBundleBegin success'); + }, + onBundleEnd: (err, bundleName) => { + if (err) { + console.error('onBundleEnd failed with err: ' + err); + } + console.info('onBundleEnd success'); + }, + onAllBundlesEnd: (err) => { + if (err) { + console.error('onAllBundlesEnd failed with err: ' + err); + } + console.info('onAllBundlesEnd success'); + }, + onRestoreServiceDied: () => { + console.info('service died'); + } + }); + ``` + +### appendBundles + +appendBundles(remoteCapabilitiesFd: number, bundlesToBackup: string[], callback: AsyncCallback<void>): void; + +添加需要恢复的应用。当前整个流程中,在获取SessionRestore类的实例后只能调用一次。使用callback异步回调。 + +> **说明:** +> - 服务在恢复时需要其能力文件进行相关校验。 +> - 因此remoteCapabilitiesFd可通过备份端服务所提供的[getLocalCapabilities](#getlocalcapabilities)接口获取,可对其内容根据恢复应用的实际状况修改参数。也可通过getLocalCapabilities提供的json示例自行生成能力文件。 + +**需要权限**:ohos.permission.BACKUP + +**系统能力**:SystemCapability.FileManagement.StorageService.Backup + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------------------- | ------------------------- | ---- | -------------------------------------------------------------- | +| remoteCapabilitiesFd | number | 是 | 用于恢复所需能力文件的文件描述符。 | +| bundlesToBackup | string[] | 是 | 需要恢复的应用名称的数组。 | +| callback | AsyncCallback<void> | 是 | 回调函数。当添加恢复应用成功,err为undefined,否则为错误对象。 | + +**示例:** + + ```js + try { + let fileData = await backup.getLocalCapabilities(); + console.info('getLocalCapabilities success'); + sessionRestore.appendBundles(fileData.fd, ['com.example.hiworld'], (err) => { + if (err) { + console.error('appendBundles failed with err: ' + err); + } + console.info('appendBundles success'); + }); + } catch (err) { + console.error('appendBundles failed with err: ' + err); + } + ``` + +### appendBundles + +appendBundles(remoteCapabilitiesFd: number, bundlesToBackup: string[]): Promise<void>; + +添加需要恢复的应用。当前整个流程中,在获取SessionRestore类的实例后只能调用一次。使用Promise异步回调。 + +> **说明:** +> - 服务在恢复时需要其能力文件进行相关校验。 +> - 因此remoteCapabilitiesFd可通过备份端服务所提供的[getLocalCapabilities](#getlocalcapabilities)接口获取,可对其内容根据恢复应用的实际状况修改参数。也可通过getLocalCapabilities提供的json示例自行生成能力文件。 + +**需要权限**:ohos.permission.BACKUP + +**系统能力**:SystemCapability.FileManagement.StorageService.Backup + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------------------- | -------- | ---- | ---------------------------------- | +| remoteCapabilitiesFd | number | 是 | 用于恢复所需能力文件的文件描述符。 | +| bundlesToBackup | string[] | 是 | 需要恢复的应用包名称的数组。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | -------------------------------------- | +| Promise<void> | Promise对象。无返回结果的Promise对象。 | + +**示例:** + + ```js + try { + let fileData = await backup.getLocalCapabilities(); + console.info('getLocalCapabilities success'); + await sessionRestore.appendBundles(fileData.fd, ['com.example.hiworld']); + console.info('appendBundles success'); + } catch (err) { + console.error('appendBundles failed with err: ' + err); + } + ``` + +### getFileHandle + +getFileHandle(fileMeta: FileMeta, callback: AsyncCallback<void>): void; + +用于请求从服务中获取共享文件。使用callback异步回调。 + +> **说明:** +> - 这个接口是零拷贝特性(减少不必要的内存拷贝,实现了更高效率的传输)的一部分。零拷贝方法可参考由[@ohos.file.fs](./js-apis-file-fs.md)提供的[fs.copyFile](js-apis-file-fs.md#fscopyfile)等相关零拷贝接口。 +> - 使用getFileHandle前需要获取SessionRestore类的实例,并且成功通过appendBundles添加需要待恢复的应用。 +> - 开发者可以通过onFileReady回调来获取文件句柄,当客户端完成文件操作时,需要使用publishFile来进行发布。 +> - 根据所需要恢复的文件个数,可以多次调用getFileHandle。 + +**需要权限**:ohos.permission.BACKUP + +**系统能力**:SystemCapability.FileManagement.StorageService.Backup + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | -------------------------------------------------------------- | +| fileMeta | [FileMeta](#filemeta) | 是 | 恢复文件的元数据。 | +| callback | AsyncCallback<void> | 是 | 回调函数。当请求文件句柄成功,err为undefined,否则为错误对象。 | + +**示例:** + + ```js + try { + sessionRestore.getFileHandle({ + bundleName: "com.example.hiworld", + uri: "test.txt" + }, (err, file) => { + if (err) { + console.error('getFileHandle failed with err: ' + err); + } + console.info('getFileHandle success'); + }); + } catch (err) { + console.error('getFileHandle failed with err: ' + err); + } + ``` + +### getFileHandle + +getFileHandle(fileMeta: FileMeta): Promise<void>; + +用于请求从服务中获取共享文件。使用Promise异步回调。 + +> **说明:** +> - 这个接口是零拷贝特性(减少不必要的内存拷贝,实现了更高效率的传输)的一部分。零拷贝方法可参考由[@ohos.file.fs](./js-apis-file-fs.md)提供的[fs.copyFile](js-apis-file-fs.md#fscopyfile)等相关零拷贝接口。 +> - 使用getFileHandle前需要获取SessionRestore类的实例,并且成功通过appendBundles添加需要待恢复的应用。 +> - 开发者可以通过onFileReady回调来获取文件句柄,当客户端完成文件操作时,需要使用publishFile来进行发布。 +> - 根据所需要恢复的文件个数,可以多次调用getFileHandle。 + +**需要权限**:ohos.permission.BACKUP + +**系统能力**:SystemCapability.FileManagement.StorageService.Backup + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------- | ---- | ------------------ | +| fileMeta | [FileMeta](#filemeta) | 是 | 恢复文件的元数据。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | -------------------------------------- | +| Promise<void> | Promise对象。无返回结果的Promise对象。 | + +**示例:** + + ```js + try { + await sessionRestore.getFileHandle({ + bundleName: "com.example.hiworld", + uri: "test.txt" + }); + console.info('getFileHandle success'); + } catch (err) { + console.error('getFileHandle failed with err: ' + err); + } + ``` + +### publishFile + +publishFile(fileMeta: FileMeta, callback: AsyncCallback<void>): void; + +用于将FileMeta发布到备份服务,使服务知道文件的内容已经准备完成。使用callback异步回调。 + +> **说明:** +> - 这个接口是零拷贝特性(减少不必要的内存拷贝,实现了更高效率的传输)的一部分。零拷贝方法可参考由[@ohos.file.fs](./js-apis-file-fs.md)提供的[fs.copyFile](js-apis-file-fs.md#fscopyfile)等相关零拷贝接口。 +> - 服务端通过onFileReady返回文件句柄后,客户端可通过零拷贝操作将其对应的文件内容拷贝到服务端提供的文件句柄中。 +> - 在完成拷贝操作后可使用publishFile通知备份服务文件已经准备完成。 + +**需要权限**:ohos.permission.BACKUP + +**系统能力**:SystemCapability.FileManagement.StorageService.Backup + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | ---------------------------------------------------------- | +| fileMeta | [FileMeta](#filemeta) | 是 | 恢复文件元数据。 | +| callback | AsyncCallback<void> | 是 | 回调函数。当发布文件成功,err为undefined,否则为错误对象。 | + +**示例:** + + ```js + try { + onFileReady: (err, file) => { + if (err) { + console.error('onFileReady failed with err: ' + err); + } + console.info('onFileReady success'); + fs.closeSync(file.fd); + sessionRestore.publishFile({ + bundleName: file.bundleName, + uri: file.uri + }, (err) => { + if (err) { + console.error('publishFile failed with err: ' + err); + } + console.info('publishFile success'); + }); + } + } catch (err) { + console.error('publishFile failed with err: ' + err); + } + ``` + +### publishFile + +publishFile(fileMeta: FileMeta): Promise<void>; + +用于将FileMeta发布到备份服务,使服务知道文件的内容已经准备完成。使用Promise异步回调。 + +> **说明:** +> - 这个接口是零拷贝特性(减少不必要的内存拷贝,实现了更高效率的传输)的一部分。零拷贝方法可参考由[@ohos.file.fs](./js-apis-file-fs.md)提供的[fs.copyFile](js-apis-file-fs.md#fscopyfile)等相关零拷贝接口。 +> - 服务端通过onFileReady返回文件句柄后,客户端可通过零拷贝操作将其对应的文件内容拷贝到服务端提供的文件句柄中。 +> - 在完成拷贝操作后可使用publishFile通知备份服务文件已经准备完成。 + +**需要权限**:ohos.permission.BACKUP + +**系统能力**:SystemCapability.FileManagement.StorageService.Backup + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------- | ---- | ---------------- | +| fileMeta | [FileMeta](#filemeta) | 是 | 恢复文件元数据。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | -------------------------------------- | +| Promise<void> | Promise对象。无返回结果的Promise对象。 | + +**示例:** + + ```js + try { + onFileReady: (err, file) => { + if (err) { + console.error('onFileReady failed with err: ' + err); + } + console.info('onFileReady success'); + fs.closeSync(file.fd); + await sessionRestore.publishFile({ + bundleName: file.bundleName, + uri: file.uri + }); + console.info('publishFile success'); + }, + } catch (err) { + console.error('publishFile failed with err: ' + err); + } + ``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-file-cloudsyncmanager.md b/zh-cn/application-dev/reference/apis/js-apis-file-cloudsyncmanager.md new file mode 100644 index 0000000000000000000000000000000000000000..58d96ecbea75a0a5a4840405dfebe1539000481d --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-file-cloudsyncmanager.md @@ -0,0 +1,141 @@ +# @ohos.file.cloudSyncManager (端云同步管理能力) + +该模块向云空间提供通知或更改端云服务状态的能力。 + +> **说明:** +> 本模块首批接口从API version 10开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> 本模块接口为系统接口,三方应用不支持调用。 +> 本模块支持对错误码进行处理,错误码及其适配方式[参考文档](../errorcodes/errorcode-filemanagement.md#错误码适配指导)。 + +## 导入模块 + +```js +import cloudSyncManager from '@ohos.file.cloudSyncManager'; +``` + +## cloudSyncManager.changeAppCloudSwitch + +changeAppCloudSwitch(accountId: string, bundleName: string, status: boolean): Promise<void>; + +异步方法修改应用的端云文件同步开关,以Promise形式返回结果。 + +**系统能力**:SystemCapability.FileManagement.DistributedFileService.CloudSyncManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | ------ | ---- | ---- | +| accountId | string | 是 | 帐号| +| bundleName | string | 是 | 应用包名| +| status | boolean | 是 | 修改的应用云同步开关状态,true为打开,false为关闭| + +**返回值:** + +| 类型 | 说明 | +| --------------------- | ---------------- | +| Promise<void> | 使用Promise形式返回修改应用的端云文件同步开关的结果 | + +**示例:** + + ```js + let accountId = "testAccount"; + let bundleName = "com.example.bundle"; + cloudSyncManager.changeAppCloudSwitch(accountId, bundleName, true).then(function() { + console.info("changeAppCloudSwitch successfully"); + }).catch(function(err) { + console.info("changeAppCloudSwitch failed with error message: " + err.message + ", error code: " + err.code); + }); + ``` + +## cloudSyncManager.changeAppCloudSwitch + +changeAppCloudSwitch(accountId: string, bundleName: string, status: boolean, callback: AsyncCallback<void>): void; + +异步方法修改应用的端云文件同步开关,以callback形式返回结果。 + +**系统能力**:SystemCapability.FileManagement.DistributedFileService.CloudSyncManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | ------ | ---- | ---- | +| accountId | string | 是 | 帐号| +| bundleName | string | 是 | 应用包名| +| status | boolean | 是 | 修改的应用云同步开关状态,true为打开,false为关闭| +| callback | AsyncCallback<void> | 是 | 异步修改应用的端云文件同步开关之后的回调 | + +**示例:** + + ```js + let accountId = "testAccount"; + let bundleName = "com.example.bundle"; + cloudSyncManager.changeAppCloudSwitch(accountId, bundleName, true, (err) => { + if (err) { + console.info("changeAppCloudSwitch failed with error message: " + err.message + ", error code: " + err.code); + } else { + console.info("changeAppCloudSwitch successfully"); + } + }); + ``` +## cloudSyncManager.notifyDataChange + +notifyDataChange(accountId: string, bundleName: string): Promise<void>; + +异步方法通知端云服务应用的云数据变更,以Promise形式返回结果。 + +**系统能力**:SystemCapability.FileManagement.DistributedFileService.CloudSyncManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | ------ | ---- | ---- | +| accountId | string | 是 | 帐号| +| bundleName | string | 是 | 应用包名| + +**返回值:** + +| 类型 | 说明 | +| --------------------- | ---------------- | +| Promise<void> | 使用Promise形式返回通知端云服务应用的云数据变更的结果 | + +**示例:** + + ```js + let accountId = "testAccount"; + let bundleName = "com.example.bundle"; + cloudSyncManager.notifyDataChange(accountId, bundleName).then(function() { + console.info("notifyDataChange successfully"); + }).catch(function(err) { + console.info("notifyDataChange failed with error message: " + err.message + ", error code: " + err.code); + }); + ``` + +## cloudSyncManager.notifyDataChange + +notifyDataChange(accountId: string, bundleName: string, callback: AsyncCallback<void>): void; + +异步方法通知端云服务应用的云数据变更,以callback形式返回结果。 + +**系统能力**:SystemCapability.FileManagement.DistributedFileService.CloudSyncManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | ------ | ---- | ---- | +| accountId | string | 是 | 帐号| +| bundleName | string | 是 | 应用包名| +| callback | AsyncCallback<void> | 是 | 异步通知端云服务应用的云数据变更之后的回调 | + +**示例:** + + ```js + let accountId = "testAccount"; + let bundleName = "com.example.bundle"; + cloudSyncManager.notifyDataChange(accountId, bundleName, (err) => { + if (err) { + console.info("notifyDataChange failed with error message: " + err.message + ", error code: " + err.code); + } else { + console.info("notifyDataChange successfully"); + } + }); + ``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-file-fileuri.md b/zh-cn/application-dev/reference/apis/js-apis-file-fileuri.md new file mode 100644 index 0000000000000000000000000000000000000000..acf1eb72d5a85f823a743a396be2c70459ae5f3c --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-file-fileuri.md @@ -0,0 +1,60 @@ +# @ohos.file.fileuri (文件URI) + +该模块提供通过PATH获取文件统一资源标志符(Uniform Resource Identifier,URI),后续可通过使用[@ohos.file.fs](js-apis-file-fs.md)进行相关open、read、write等操作,实现文件分享。 + +> **说明:** +> - 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +## 导入模块 + +```js +import fileuri from "@ohos.file.fileuri"; +``` + +使用该功能模块前,需要先获取其应用沙箱路径,开发示例如下: + + ```js +import UIAbility from '@ohos.app.ability.UIAbility'; + +export default class EntryAbility extends UIAbility { + onWindowStageCreate(windowStage) { + let context = this.context; + let pathDir = context.filesDir; + } +} + ``` + +## fileUri.getUriFromPath + +getUriFromPath(path: string): string + +以同步方法获取文件URI。 + +**系统能力**:SystemCapability.FileManagement.AppFileService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------- | +| path | string | 是 | 文件的沙箱路径 | + +**返回值:** + + | 类型 | 说明 | + | ---------------------------- | ---------- | + | string | 返回文件URI | + +**错误码:** + +以下错误码的详细介绍请参见[文件管理子系统错误码](../errorcodes/errorcode-filemanagement.md#错误码适配指导) + | 错误码ID | 错误信息 | + | ---------------------------- | ---------- | + | 401 | The input parameter is invalid | + + +**示例:** + + ```js +let filePath = pathDir + "test.txt"; +let uri = fileuri.getUriFromPath(filePath); + ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-file-fs.md b/zh-cn/application-dev/reference/apis/js-apis-file-fs.md index 9bb182ad56fd974c080cf006f1ed7819b96da131..5375a3f055c573b43f33c01f6eebbebc3865f61c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-file-fs.md +++ b/zh-cn/application-dev/reference/apis/js-apis-file-fs.md @@ -4,7 +4,6 @@ > **说明:** > 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 -> 本模块支持对错误码进行处理,错误码及其适配方式[参考文档](../errorcodes/errorcode-filemanagement.md#错误码适配指导)。 ## 导入模块 @@ -12,6 +11,10 @@ import fs from '@ohos.file.fs'; ``` +## 错误码说明 + +本模块支持对错误码进行处理,错误码及其适配方式请参考文档:[文件管理错误码](../errorcodes/errorcode-filemanagement.md#错误码适配指导)。 + ## 使用说明 使用该功能模块对文件/目录进行操作前,需要先获取其应用沙箱路径,获取方式及其接口用法请参考: @@ -65,7 +68,7 @@ stat(file: string|number): Promise<Stat> **示例:** ```js - let filePath = pathDir + "test.txt"; + let filePath = pathDir + "/test.txt"; fs.stat(filePath).then((stat) => { console.info("get file info succeed, the size of file is " + stat.size); }).catch((err) => { @@ -146,7 +149,7 @@ access(path: string): Promise<boolean> | 类型 | 说明 | | ------------------- | ---------------------------- | - | Promise<boolean> | Promise对象。返回boolean。 | + | Promise<boolean> | Promise对象。返回boolean,表示文件是否存在。 | **示例:** @@ -206,6 +209,12 @@ accessSync(path: string): boolean | ------ | ------ | ---- | ------------------------------------------------------------ | | path | string | 是 | 文件应用沙箱路径。 | +**返回值:** + + | 类型 | 说明 | + | ------------------- | ---------------------------- | + | boolean | 返回boolean,表示文件是否存在。 | + **示例:** ```js @@ -330,8 +339,8 @@ copyFile(src: string|number, dest: string|number, mode?: number): Promise<voi **示例:** ```js - let srcPath = pathDir + "srcDir/test.txt"; - let dstPath = pathDir + "dstDir/test.txt"; + let srcPath = pathDir + "/srcDir/test.txt"; + let dstPath = pathDir + "/dstDir/test.txt"; fs.copyFile(srcPath, dstPath).then(() => { console.info("copy file succeed"); }).catch((err) => { @@ -359,8 +368,8 @@ copyFile(src: string|number, dest: string|number, mode?: number, callback: Async **示例:** ```js - let srcPath = pathDir + "srcDir/test.txt"; - let dstPath = pathDir + "dstDir/test.txt"; + let srcPath = pathDir + "/srcDir/test.txt"; + let dstPath = pathDir + "/dstDir/test.txt"; fs.copyFile(srcPath, dstPath, (err) => { if (err) { console.info("copy file failed with error message: " + err.message + ", error code: " + err.code); @@ -390,8 +399,8 @@ copyFileSync(src: string|number, dest: string|number, mode?: number): void **示例:** ```js - let srcPath = pathDir + "srcDir/test.txt"; - let dstPath = pathDir + "dstDir/test.txt"; + let srcPath = pathDir + "/srcDir/test.txt"; + let dstPath = pathDir + "/dstDir/test.txt"; fs.copyFileSync(srcPath, dstPath); ``` @@ -419,7 +428,7 @@ mkdir(path: string): Promise<void> **示例:** ```js - let dirPath = pathDir + '/testDir'; + let dirPath = pathDir + "/testDir"; fs.mkdir(dirPath).then(() => { console.info("mkdir succeed"); }).catch((err) => { @@ -446,7 +455,7 @@ mkdir(path: string, callback: AsyncCallback<void>): void **示例:** ```js - let dirPath = pathDir + '/testDir'; + let dirPath = pathDir + "/testDir"; fs.mkdir(dirPath, (err) => { if (err) { console.info("mkdir failed with error message: " + err.message + ", error code: " + err.code); @@ -474,7 +483,7 @@ mkdirSync(path: string): void **示例:** ```js - let dirPath = path + '/testDir'; + let dirPath = pathDir + "/testDir"; fs.mkdirSync(dirPath); ``` @@ -600,7 +609,7 @@ read(fd: number, buffer: ArrayBuffer, options?: { offset?: number; length?: numb let buf = new ArrayBuffer(4096); fs.read(file.fd, buf).then((readLen) => { console.info("read file data succeed"); - console.info(String.fromCharCode.apply(null, new Uint8Array(readLen))); + console.info(String.fromCharCode.apply(null, new Uint8Array(buf.slice(0, readLen)))); fs.closeSync(file); }).catch((err) => { console.info("read file data failed with error message: " + err.message + ", error code: " + err.code); @@ -635,7 +644,7 @@ read(fd: number, buffer: ArrayBuffer, options?: { offset?: number; length?: numb console.info("mkdir failed with error message: " + err.message + ", error code: " + err.code); } else { console.info("read file data succeed"); - console.info(String.fromCharCode.apply(null, new Uint8Array(readLen))); + console.info(String.fromCharCode.apply(null, new Uint8Array(buf.slice(0, readLen)))); fs.closeSync(file); } }); @@ -698,7 +707,7 @@ rmdir(path: string): Promise<void> **示例:** ```js - let dirPath = pathDir + '/testDir'; + let dirPath = pathDir + "/testDir"; fs.rmdir(dirPath).then(() => { console.info("rmdir succeed"); }).catch((err) => { @@ -725,7 +734,7 @@ rmdir(path: string, callback: AsyncCallback<void>): void **示例:** ```js - let dirPath = pathDir + '/testDir'; + let dirPath = pathDir + "/testDir"; fs.rmdir(dirPath, (err) => { if (err) { console.info("rmdir failed with error message: " + err.message + ", error code: " + err.code); @@ -753,7 +762,7 @@ rmdirSync(path: string): void **示例:** ```js - let dirPath = pathDir + '/testDir'; + let dirPath = pathDir + "/testDir"; fs.rmdirSync(dirPath); ``` @@ -955,7 +964,7 @@ truncate(file: string|number, len?: number): Promise<void> | 参数名 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | -------------------------------- | | file | string\|number | 是 | 文件的应用沙箱路径或已打开的文件描述符fd。 | -| len | number | 否 | 文件截断后的长度,以字节为单位。 | +| len | number | 否 | 文件截断后的长度,以字节为单位。默认为0。 | **返回值:** @@ -989,7 +998,7 @@ truncate(file: string|number, len?: number, callback: AsyncCallback<void>) | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | -------------------------------- | | file | string\|number | 是 | 文件的应用沙箱路径或已打开的文件描述符fd。 | -| len | number | 否 | 文件截断后的长度,以字节为单位。 | +| len | number | 否 | 文件截断后的长度,以字节为单位。默认为0。 | | callback | AsyncCallback<void> | 是 | 回调函数,本调用无返回值。 | **示例:** @@ -1020,7 +1029,7 @@ truncateSync(file: string|number, len?: number): void | 参数名 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | -------------------------------- | | file | string\|number | 是 | 文件的应用沙箱路径或已打开的文件描述符fd。 | -| len | number | 否 | 文件截断后的长度,以字节为单位。 | +| len | number | 否 | 文件截断后的长度,以字节为单位。默认为0。 | **示例:** @@ -1235,7 +1244,7 @@ rename(oldPath: string, newPath: string): Promise<void> ```js let srcFile = pathDir + "/test.txt"; - let dstFile = pathDir + '/new.txt'; + let dstFile = pathDir + "/new.txt"; fs.rename(srcFile, dstFile).then(() => { console.info("rename succeed"); }).catch((err) => { @@ -1263,7 +1272,7 @@ rename(oldPath: string, newPath: string, callback: AsyncCallback<void>): v ```js let srcFile = pathDir + "/test.txt"; - let dstFile = pathDir + '/new.txt'; + let dstFile = pathDir + "/new.txt"; fs.rename(srcFile, dstFile, (err) => { if (err) { console.info("rename failed with error message: " + err.message + ", error code: " + err.code); @@ -1292,7 +1301,7 @@ renameSync(oldPath: string, newPath: string): void ```js let srcFile = pathDir + "/test.txt"; - let dstFile = pathDir + '/new.txt'; + let dstFile = pathDir + "/new.txt"; fs.renameSync(srcFile, dstFile); ``` @@ -1498,7 +1507,7 @@ symlink(target: string, srcPath: string): Promise<void> ```js let srcFile = pathDir + "/test.txt"; - let dstFile = pathDir + '/test'; + let dstFile = pathDir + "/test"; fs.symlink(srcFile, dstFile).then(() => { console.info("symlink succeed"); }).catch((err) => { @@ -1526,7 +1535,7 @@ symlink(target: string, srcPath: string, callback: AsyncCallback<void>): v ```js let srcFile = pathDir + "/test.txt"; - let dstFile = pathDir + '/test'; + let dstFile = pathDir + "/test"; fs.symlink(srcFile, dstFile, (err) => { if (err) { console.info("symlink failed with error message: " + err.message + ", error code: " + err.code); @@ -1555,7 +1564,7 @@ symlinkSync(target: string, srcPath: string): void ```js let srcFile = pathDir + "/test.txt"; - let dstFile = pathDir + '/test'; + let dstFile = pathDir + "/test"; fs.symlinkSync(srcFile, dstFile); ``` @@ -1564,7 +1573,7 @@ listFile(path: string, options?: { recursion?: boolean; listNum?: number; filter?: Filter; -}): Promise; +}): Promise 列出文件夹下所有文件名,支持递归列出所有文件名(包含子目录下),支持文件过滤,使用Promise异步回调。 @@ -1575,7 +1584,7 @@ listFile(path: string, options?: { | 参数名 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | --------------------------- | | path | string | 是 | 文件夹的应用沙箱路径。 | - | options | Object | 否 | 文件过滤选项。 | + | options | Object | 否 | 文件过滤选项。默认不进行过滤。 | **options参数说明:** @@ -1606,7 +1615,7 @@ listFile(path: string, options?: { }; fs.listFile(pathDir, options).then((filenames) => { console.info("listFile succeed"); - for (let i = 0; i < filenames.size; i++) { + for (let i = 0; i < filenames.length; i++) { console.info("fileName: %s", filenames[i]); } }).catch((err) => { @@ -1619,7 +1628,7 @@ listFile(path: string, options?: { recursion?: boolean; listNum?: number; filter?: Filter; -}, callback: AsyncCallback): void; +}, callback: AsyncCallback): void 列出文件夹下所有文件名,支持递归列出所有文件名(包含子目录下),支持文件过滤,使用Callback异步回调。 @@ -1628,7 +1637,7 @@ listFile(path: string, options?: { | 参数名 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | --------------------------- | | path | string | 是 | 文件夹的应用沙箱路径。 | - | options | Object | 否 | 文件过滤选项。 | + | options | Object | 否 | 文件过滤选项。默认不进行过滤。 | | callback | AsyncCallback<string[]> | 是 | 异步列出文件名数组之后的回调。 | **options参数说明:** @@ -1657,7 +1666,7 @@ listFile(path: string, options?: { console.info("list file failed with error message: " + err.message + ", error code: " + err.code); } else { console.info("listFile succeed"); - for (let i = 0; i < filenames.size; i++) { + for (let i = 0; i < filenames.length; i++) { console.info("filename: %s", filenames[i]); } } @@ -1670,7 +1679,7 @@ listFileSync(path: string, options?: { recursion?: boolean; listNum?: number; filter?: Filter; -}): string[]; +}): string[] 以同步方式列出文件夹下所有文件名,支持递归列出所有文件名(包含子目录下),支持文件过滤。 @@ -1679,7 +1688,7 @@ listFileSync(path: string, options?: { | 参数名 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | --------------------------- | | path | string | 是 | 文件夹的应用沙箱路径。 | - | options | Object | 否 | 文件过滤选项。 | + | options | Object | 否 | 文件过滤选项。默认不进行过滤。 | **options参数说明:** @@ -1710,13 +1719,93 @@ listFileSync(path: string, options?: { }; let filenames = fs.listFileSync(pathDir, options); console.info("listFile succeed"); - for (let i = 0; i < filenames.size; i++) { + for (let i = 0; i < filenames.length; i++) { console.info("filename: %s", filenames[i]); } ``` + +## fs.moveDir10+ + +moveDir(src: string, dest: string, mode?: number): Promise\ + +移动源文件夹至目标路径下,使用Promise异步回调。 + +**系统能力**:SystemCapability.FileManagement.File.FileIO + +**参数:** + + | 参数名 | 类型 | 必填 | 说明 | + | ------ | ------ | ---- | --------------------------- | + | src | string | 是 | 源文件夹的应用沙箱路径。 | + | dest | string | 是 | 目标应用沙箱路径。 | + | mode | number | 否 | 移动模式。默认mode为0。
- mode为0,文件夹级别抛异常。若目标路径存在与源文件夹名冲突的文件夹,则抛出异常。
- mode为1,文件级别抛异常。目标路径存在与源文件夹名冲突的文件夹,若此目标文件夹下存在与源文件夹下同名文件,则抛出异常。源文件夹下未冲突的文件全部移动至此目标文件夹下,此目标文件夹下未冲突文件将继续保留,且冲突文件信息将在抛出异常的data属性中提供。
-  mode为2,文件级别强制覆盖。目标路径存在与源文件夹名冲突的文件夹,若此目标文件夹下存在与源文件夹下同名文件,则强制覆盖此目标文件夹下所有同名文件。目标文件夹下未冲突文件将继续保留。
-  mode为3,文件夹级别强制覆盖。移动源文件夹至目标路径下,目标文件夹与源文件夹内容完全一致。目标文件夹下所有原始文件将不会保留。| + +**返回值:** + + | 类型 | 说明 | + | ------------------- | ---------------------------- | + | Promise<void> | Promise对象。无返回值。 | + +**示例:** + + ```js + // move directory from srcPath to destPath/srcPath + let srcPath = pathDir + "/srcDir/"; + let destPath = pathDir + "/destDir/"; + fs.moveDir(srcPath, destPath, 1).then(() => { + console.info("move directory succeed"); + }).catch((err) => { + if (err.code == 13900015) { + for (let i = 0; i < err.data.length; i++) { + console.info("move directory failed with conflicting files: " + err.data[i].srcFile + + " " + err.data[i].destFile); + } + } else { + console.info("move directory failed with error message: " + err.message + ", error code: " + err.code); + } + }); + ``` + +## fs.moveDir10+ + +moveDir(src: string, dest: string, mode?: number, callback: AsyncCallback\): void + +移动源文件夹至目标路径下,使用Callback异步回调。 + +**系统能力**:SystemCapability.FileManagement.File.FileIO + +**参数:** + + | 参数名 | 类型 | 必填 | 说明 | + | ------ | ------ | ---- | --------------------------- | + | src | string | 是 | 源文件夹的应用沙箱路径。 | + | dest | string | 是 | 目标应用沙箱路径。 | + | mode | number | 否 | 移动模式。默认mode为0。
- mode为0,文件夹级别抛异常。若目标路径存在与源文件夹名冲突的文件夹,则抛出异常。
- mode为1,文件级别抛异常。目标路径存在与源文件夹名冲突的文件夹,若此目标文件夹下存在与源文件夹下同名文件,则抛出异常。源文件夹下未冲突的文件全部移动至此目标文件夹下,此目标文件夹下未冲突文件将继续保留,且冲突文件信息将在抛出异常的data属性中提供。
-  mode为2,文件级别强制覆盖。目标路径存在与源文件夹名冲突的文件夹,若此目标文件夹下存在与源文件夹下同名文件,则强制覆盖此目标文件夹下所有同名文件。目标文件夹下未冲突文件将继续保留。
-  mode为3,文件夹级别强制覆盖。移动源文件夹至目标路径下,目标文件夹与源文件夹内容完全一致。目标文件夹下所有原始文件将不会保留。| + | callback | AsyncCallback<void> | 是 | 异步移动文件夹之后的回调。 | + +**示例:** + + ```js + // move directory from srcPath to destPath/srcPath + let srcPath = pathDir + "/srcDir/"; + let destPath = pathDir + "/destDir/"; + fs.moveDir(srcPath, destPath, 1, (err) => { + if (err && err.code == 13900015) { + for (let i = 0; i < err.data.length; i++) { + console.info("move directory failed with conflicting files: " + err.data[i].srcFile + + " " + err.data[i].destFile); + } + } else if (err) { + console.info("move directory failed with error message: " + err.message + ", error code: " + err.code); + } else { + console.info("move directory succeed"); + } + }); + ``` + ## fs.moveFile -moveFile(src: string, dest: string, mode?: number): Promise; +moveFile(src: string, dest: string, mode?: number): Promise\ 移动文件,使用Promise异步回调。 @@ -1730,9 +1819,17 @@ moveFile(src: string, dest: string, mode?: number): Promise; | dest | string | 是 | 目的文件的应用沙箱路径。 | | mode | number | 否 | 移动模式。若mode为0,移动位置存在同名文件时,强制移动覆盖。若mode为1,移动位置存在同名文件时,抛出异常。默认为0。 | +**返回值:** + + | 类型 | 说明 | + | ------------------- | ---------------------------- | + | Promise<void> | Promise对象。无返回值。 | + **示例:** ```js + let srcPath = pathDir + "/source.txt"; + let destPath = pathDir + "/dest.txt"; fs.moveFile(srcPath, destPath, 0).then(() => { console.info("move file succeed"); }).catch((err) => { @@ -1742,7 +1839,7 @@ moveFile(src: string, dest: string, mode?: number): Promise; ## fs.moveFile -moveFile(src: string, dest: string, mode?: number, callback: AsyncCallback): void; +moveFile(src: string, dest: string, mode?: number, callback: AsyncCallback\): void 移动文件,使用Callback异步回调。 @@ -1760,6 +1857,8 @@ moveFile(src: string, dest: string, mode?: number, callback: AsyncCallback **示例:** ```js + let srcPath = pathDir + "/source.txt"; + let destPath = pathDir + "/dest.txt"; fs.moveFile(srcPath, destPath, 0, (err) => { if (err) { console.info("move file failed with error message: " + err.message + ", error code: " + err.code); @@ -1771,7 +1870,7 @@ moveFile(src: string, dest: string, mode?: number, callback: AsyncCallback ## fs.moveFileSync -moveFile(src: string, dest: string, mode?: number): void; +moveFile(src: string, dest: string, mode?: number): void 以同步方式移动文件。 @@ -1788,6 +1887,8 @@ moveFile(src: string, dest: string, mode?: number): void; **示例:** ```js + let srcPath = pathDir + "/source.txt"; + let destPath = pathDir + "/dest.txt"; fs.moveFileSync(srcPath, destPath, 0); console.info("move file succeed"); ``` @@ -2578,7 +2679,7 @@ read(buffer: ArrayBuffer, options?: { offset?: number; length?: number; }): Prom let buf = new ArrayBuffer(4096); ss.read(buf, {offset: 5, length: 5}).then((readLen) => { console.info("read data succeed"); - console.log(String.fromCharCode.apply(null, new Uint8Array(buf))); + console.log(String.fromCharCode.apply(null, new Uint8Array(buf.slice(0, readLen)))); }).catch((err) => { console.info("read data failed with error message: " + err.message + ", error code: " + err.code); }); @@ -2612,7 +2713,7 @@ read(buffer: ArrayBuffer, options?: { position?: number; offset?: number; length console.info("read stream failed with error message: " + err.message + ", error code: " + err.code); } else { console.info("read data succeed"); - console.log(String.fromCharCode.apply(null, new Uint8Array(buf))); + console.log(String.fromCharCode.apply(null, new Uint8Array(buf.slice(0, readLen)))); } }); ``` @@ -2660,7 +2761,7 @@ readSync(buffer: ArrayBuffer, options?: { offset?: number; length?: number; }): ### lock -lock(exclusive?: boolean): Promise; +lock(exclusive?: boolean): Promise\ 文件阻塞式施加共享锁或独占锁,使用Promise异步回调。 @@ -2691,7 +2792,7 @@ lock(exclusive?: boolean): Promise; ### lock -lock(exclusive?: boolean, callback: AsyncCallback): void; +lock(exclusive?: boolean, callback: AsyncCallback\): void 文件阻塞式施加共享锁或独占锁,使Callback异步回调。 @@ -2719,7 +2820,7 @@ lock(exclusive?: boolean, callback: AsyncCallback): void; ### tryLock -tryLock(exclusive?: boolean): void; +tryLock(exclusive?: boolean): void 文件非阻塞式施加共享锁或独占锁。 @@ -2741,7 +2842,7 @@ tryLock(exclusive?: boolean): void; ### unlock -unlock(): void; +unlock(): void 以同步方式给文件解锁。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-file-picker.md b/zh-cn/application-dev/reference/apis/js-apis-file-picker.md index a14b82314a97c1e7d99e69ecf1291bb32b718ece..1455a8178919639982f472593c84f4bb8a4042a9 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-file-picker.md +++ b/zh-cn/application-dev/reference/apis/js-apis-file-picker.md @@ -34,13 +34,13 @@ select(option?: PhotoSelectOptions) : Promise<PhotoSelectResult> | 参数名 | 类型 | 必填 | 说明 | | ------- | ------- | ---- | -------------------------- | -| option | [PhotoSelectOptions](#photoselectoptions) | 否 | photoPicker选择选项 | +| option | [PhotoSelectOptions](#photoselectoptions) | 否 | photoPicker选择选项,若无此参数,则默认选择媒体文件类型为图片和视频类型,选择媒体文件数量的最大值为50 | **返回值:** | 类型 | 说明 | | ----------------------------- | :---- | -| [PhotoSelectResult](#photoselectresult) | 返回photoPicker选择后的结果集 | +| Promise<[PhotoSelectResult](#photoselectresult)> | Promise对象。返回photoPicker选择后的结果集 | **示例:** @@ -144,13 +144,13 @@ save(option?: PhotoSaveOptions) : Promise<Array<string>> | 参数名 | 类型 | 必填 | 说明 | | ------- | ------- | ---- | -------------------------- | -| option | [PhotoSaveOptions](#photosaveoptions) | 否 | photoPicker保存图片或视频文件选项 | +| option | [PhotoSaveOptions](#photosaveoptions) | 否 | photoPicker保存图片或视频文件选项,若无此参数,则拉起photoPicker界面后需用户自行输入保存的文件名 | **返回值:** | 类型 | 说明 | | ----------------------------- | :---- | -| <Array<string>> | 返回photoPicker保存图片或视频文件后的结果集 | +| Promise<Array<string>> | Promise对象。返回photoPicker保存图片或视频文件后的结果集 | **示例:** @@ -264,13 +264,13 @@ select(option?: DocumentSelectOptions) : Promise<Array<string>> | 参数名 | 类型 | 必填 | 说明 | | ------- | ------- | ---- | -------------------------- | -| option | [DocumentSelectOptions](#documentselectoptions) | 否 | documentPicker选择选项 | +| option | [DocumentSelectOptions](#documentselectoptions) | 否 | documentPicker选择选项,若无此参数,则默认拉起documentPicker主界面 | **返回值:** | 类型 | 说明 | | ----------------------------- | :---- | -| <Array<string>> | 返回documentPicker选择后的结果集 | +| Promise<Array<string>> | Promise对象。返回documentPicker选择后的结果集 | **示例:** @@ -371,13 +371,13 @@ save(option?: DocumentSaveOptions) : Promise<Array<string>> | 参数名 | 类型 | 必填 | 说明 | | ------- | ------- | ---- | -------------------------- | -| option | [DocumentSaveOptions](#documentsaveoptions) | 否 | documentPicker保存选项 | +| option | [DocumentSaveOptions](#documentsaveoptions) | 否 | documentPicker保存选项,若无此参数,则拉起documentPicker界面后需用户自行输入保存的文件名 | **返回值:** | 类型 | 说明 | | ----------------------------- | :---- | -| <Array<string>> | 返回documentPicker保存后的结果集 | +| Promise<Array<string>> | Promise对象。返回documentPicker保存后的结果集 | **示例:** @@ -393,7 +393,7 @@ async function example() { console.error('DocumentViewPicker.save failed with err: ' + err); }); } catch (err) { - console.errort('DocumentViewPicker failed with err: ' + err); + console.error('DocumentViewPicker failed with err: ' + err); } } ``` @@ -429,7 +429,7 @@ async function example() { console.info('DocumentViewPicker.save successfully, DocumentSaveResult uri: ' + JSON.stringify(DocumentSaveResult)); }); } catch (err) { - console.errort('DocumentViewPicker failed with err: ' + err); + console.error('DocumentViewPicker failed with err: ' + err); } } ``` @@ -462,7 +462,7 @@ async function example() { console.info('DocumentViewPicker.save successfully, DocumentSaveResult uri: ' + JSON.stringify(DocumentSaveResult)); }); } catch (err) { - console.errort('DocumentViewPicker failed with err: ' + err); + console.error('DocumentViewPicker failed with err: ' + err); } } ``` @@ -491,13 +491,13 @@ select(option?: AudioSelectOptions) : Promise<Array<string>> | 参数名 | 类型 | 必填 | 说明 | | ------- | ------- | ---- | -------------------------- | -| option | [AudioSelectOptions](#audioselectoptions) | 否 | audioPicker音频选择选项 | +| option | [AudioSelectOptions](#audioselectoptions) | 否 | audioPicker音频选择选项,若无此参数,则默认拉起audioPicker主界面 | **返回值:** | 类型 | 说明 | | ----------------------------- | :---- | -| <Array<string>> | 返回audioPicker选择音频后的结果集 | +| Promise<Array<string>> | Promise对象。返回audioPicker选择音频后的结果集 | **示例:** @@ -597,13 +597,13 @@ save(option?: AudioSaveOptions) : Promise<Array<string>> | 参数名 | 类型 | 必填 | 说明 | | ------- | ------- | ---- | -------------------------- | -| option | [AudioSaveOptions](#audiosaveoptions) | 否 | audioPicker保存音频文件选项 | +| option | [AudioSaveOptions](#audiosaveoptions) | 否 | audioPicker保存音频文件选项,若无此参数,则拉起audioPicker界面后需用户自行输入保存的文件名 | **返回值:** | 类型 | 说明 | | ----------------------------- | ---- | -| <Array<string>> | 返回audioPicker保存音频文件后的结果集 | +| Promise<Array<string>> | Promise对象。返回audioPicker保存音频文件后的结果集 | **示例:** @@ -713,7 +713,7 @@ async function example() { | 名称 | 类型 | 必填 | 说明 | | ----------------------- | ------------------- | ---- | -------------------------------- | -| MIMEType? | [PhotoViewMIMETypes](#photoviewmimetypes) | 否 | 可选择的媒体文件类型 | +| MIMEType? | [PhotoViewMIMETypes](#photoviewmimetypes) | 否 | 可选择的媒体文件类型,若无此参数,则默认为图片和视频类型 | | maxSelectNumber? | number | 否 | 选择媒体文件数量的最大值(默认值为50,最大值为500) | ## PhotoSelectResult @@ -735,7 +735,7 @@ async function example() { | 名称 | 类型 | 必填 | 说明 | | ----------------------- | ------------------- | ---- | ---------------------------- | -| newFileNames? | Array<string> | 否 | 拉起photoPicker进行保存图片或视频资源的文件名 | +| newFileNames? | Array<string> | 否 | 拉起photoPicker进行保存图片或视频资源的文件名,若无此参数,则默认需要用户自行输入 | ## DocumentSelectOptions @@ -751,7 +751,7 @@ async function example() { | 名称 | 类型 | 必填 | 说明 | | ----------------------- | ------------------- | ---- | ---------------------------- | -| newFileNames? | Array<string> | 否 | 拉起documentPicker进行保存的文件名 | +| newFileNames? | Array<string> | 否 | 拉起documentPicker进行保存的文件名,若无此参数,则默认需要用户自行输入 | ## AudioSelectOptions @@ -767,4 +767,4 @@ async function example() { | 名称 | 类型 | 必填 | 说明 | | ----------------------- | ------------------- | ---- | ---------------------------- | -| newFileNames? | Array<string> | 否 | 拉起audioPicker进行保存音频资源的文件名 | +| newFileNames? | Array<string> | 否 | 拉起audioPicker进行保存音频资源的文件名,若无此参数,则默认需要用户自行输入 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-file-securityLabel.md b/zh-cn/application-dev/reference/apis/js-apis-file-securityLabel.md index 3fbf979eaeb97928b5d92528c46067b18fbf3d52..d7110ee4df486c1824d88d152ec98b8325e165e8 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-file-securityLabel.md +++ b/zh-cn/application-dev/reference/apis/js-apis-file-securityLabel.md @@ -66,7 +66,8 @@ setSecurityLabel(path:string, type:DataLevel):Promise<void> **示例:** ```js - securityLabel.setSecurityLabel(path, "s0").then(() => { + let filePath = pathDir + '/test.txt'; + securityLabel.setSecurityLabel(filePath, "s0").then(() => { console.info("setSecurityLabel successfully"); }).catch((err) => { console.info("setSecurityLabel failed with error message: " + err.message + ", error code: " + err.code); @@ -92,7 +93,8 @@ setSecurityLabel(path:string, type:DataLevel, callback: AsyncCallback<void> **示例:** ```js - securityLabel.setSecurityLabel(path, "s0", (err) => { + let filePath = pathDir + '/test.txt'; + securityLabel.setSecurityLabel(filePath, "s0", (err) => { if (err) { console.info("setSecurityLabel failed with error message: " + err.message + ", error code: " + err.code); } else { @@ -119,7 +121,8 @@ setSecurityLabelSync(path:string, type:DataLevel):void **示例:** ```js -securityLabel.setSecurityLabelSync(path, "s0"); +let filePath = pathDir + '/test.txt'; +securityLabel.setSecurityLabelSync(filePath, "s0"); ``` ## securityLabel.getSecurityLabel @@ -145,7 +148,8 @@ getSecurityLabel(path:string):Promise<string> **示例:** ```js - securityLabel.getSecurityLabel(path).then((type) => { + let filePath = pathDir + '/test.txt'; + securityLabel.getSecurityLabel(filePath).then((type) => { console.log("getSecurityLabel successfully, Label: " + type); }).catch((err) => { console.log("getSecurityLabel failed with error message: " + err.message + ", error code: " + err.code); @@ -170,7 +174,8 @@ getSecurityLabel(path:string, callback:AsyncCallback<string>): void **示例:** ```js - securityLabel.getSecurityLabel(path, (err, type) => { + let filePath = pathDir + '/test.txt'; + securityLabel.getSecurityLabel(filePath, (err, type) => { if (err) { console.log("getSecurityLabel failed with error message: " + err.message + ", error code: " + err.code); } else { @@ -201,6 +206,7 @@ getSecurityLabelSync(path:string):string **示例:** ```js -let type = securityLabel.getSecurityLabelSync(path); +let filePath = pathDir + '/test.txt'; +let type = securityLabel.getSecurityLabelSync(filePath); console.log("getSecurityLabel successfully, Label: " + type); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-file-storage-statistics.md b/zh-cn/application-dev/reference/apis/js-apis-file-storage-statistics.md index 076072d2c1ba984bb5682fc4b55af8f3d91aa978..424cca1a83e12606d13f05772fe4bb3e1d2314d1 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-file-storage-statistics.md +++ b/zh-cn/application-dev/reference/apis/js-apis-file-storage-statistics.md @@ -22,9 +22,7 @@ getTotalSizeOfVolume(volumeUuid: string): Promise<number> **系统能力**:SystemCapability.FileManagement.StorageService.SpatialStatistics - -该接口为系统接口。 - +**系统接口:** 该接口为系统接口。 **参数:** @@ -59,9 +57,7 @@ getTotalSizeOfVolume(volumeUuid: string, callback: AsyncCallback<number>): **系统能力**:SystemCapability.FileManagement.StorageService.SpatialStatistics - -该接口为系统接口。 - +**系统接口:** 该接口为系统接口。 **参数:** @@ -90,9 +86,7 @@ getFreeSizeOfVolume(volumeUuid: string): Promise<number> **系统能力**:SystemCapability.FileManagement.StorageService.SpatialStatistics - -该接口为系统接口。 - +**系统接口:** 该接口为系统接口。 **参数:** @@ -128,9 +122,7 @@ getFreeSizeOfVolume(volumeUuid: string, callback: AsyncCallback<number>): **系统能力**:SystemCapability.FileManagement.StorageService.SpatialStatistics - -该接口为系统接口。 - +**系统接口:** 该接口为系统接口。 **参数:** @@ -159,9 +151,7 @@ getBundleStats(packageName: string): Promise<BundleStats> **系统能力**:SystemCapability.FileManagement.StorageService.SpatialStatistics - -该接口为系统接口。 - +**系统接口:** 该接口为系统接口。 **参数:** @@ -196,9 +186,7 @@ getBundleStats(packageName: string, callback: AsyncCallback<BundleStats>) **系统能力**:SystemCapability.FileManagement.StorageService.SpatialStatistics - -该接口为系统接口。 - +**系统接口:** 该接口为系统接口。 **参数:** @@ -263,11 +251,7 @@ getCurrentBundleStats(callback: AsyncCallback<BundleStats>): void ## BundleStats9+ -### 属性 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.FileManagement.StorageService.SpatialStatistics - - +**系统能力**:SystemCapability.FileManagement.StorageService.SpatialStatistics | 名称 | 类型 | 可读 | 可写 | 说明 | | --------- | ------ | --- | ---- | -------------- | @@ -286,9 +270,7 @@ getTotalSize(): Promise<number> **系统能力**:SystemCapability.FileManagement.StorageService.SpatialStatistics - -该接口为系统接口。 - +**系统接口:** 该接口为系统接口。 **返回值:** @@ -313,9 +295,7 @@ getTotalSize(callback: AsyncCallback<number>): void **系统能力**:SystemCapability.FileManagement.StorageService.SpatialStatistics - -该接口为系统接口。 - +**系统接口:** 该接口为系统接口。 **参数:** @@ -332,7 +312,6 @@ getTotalSize(callback: AsyncCallback<number>): void }); ``` - ## storageStatistics.getFreeSize9+ getFreeSize(): Promise<number> @@ -343,9 +322,7 @@ getFreeSize(): Promise<number> **系统能力**:SystemCapability.FileManagement.StorageService.SpatialStatistics - -该接口为系统接口。 - +**系统接口:** 该接口为系统接口。 **返回值:** @@ -360,7 +337,6 @@ getFreeSize(): Promise<number> console.info("getFreeSize successfully:"+ JSON.stringify(number)); ``` - ## storageStatistics.getFreeSize9+ getFreeSize(callback: AsyncCallback<number>): void @@ -371,9 +347,7 @@ getFreeSize(callback: AsyncCallback<number>): void **系统能力**:SystemCapability.FileManagement.StorageService.SpatialStatistics - -该接口为系统接口。 - +**系统接口:** 该接口为系统接口。 **参数:** @@ -400,9 +374,7 @@ getSystemSize(): Promise<number> **系统能力**:SystemCapability.FileManagement.StorageService.SpatialStatistics - -该接口为系统接口。 - +**系统接口:** 该接口为系统接口。 **返回值:** @@ -430,9 +402,7 @@ getSystemSize(callback: AsyncCallback<number>): void **系统能力**:SystemCapability.FileManagement.StorageService.SpatialStatistics - -该接口为系统接口。 - +**系统接口:** 该接口为系统接口。 **参数:** @@ -459,9 +429,7 @@ getUserStorageStats(): Promise<StorageStats> **系统能力**:SystemCapability.FileManagement.StorageService.SpatialStatistics - -该接口为系统接口。 - +**系统接口:** 该接口为系统接口。 **返回值:** @@ -489,9 +457,7 @@ getUserStorageStats(callback: AsyncCallback<StorageStats>): void **系统能力**:SystemCapability.FileManagement.StorageService.SpatialStatistics - -该接口为系统接口。 - +**系统接口:** 该接口为系统接口。 **参数:** @@ -515,9 +481,7 @@ getUserStorageStats(userId: number): Promise<StorageStats> **系统能力**:SystemCapability.FileManagement.StorageService.SpatialStatistics - -该接口为系统接口。 - +**系统接口:** 该接口为系统接口。 **参数:** @@ -552,9 +516,7 @@ getUserStorageStats(userId: number, callback: AsyncCallback<StorageStats>) **系统能力**:SystemCapability.FileManagement.StorageService.SpatialStatistics - -该接口为系统接口。 - +**系统接口:** 该接口为系统接口。 **参数:** @@ -573,15 +535,11 @@ getUserStorageStats(userId: number, callback: AsyncCallback<StorageStats>) }); ``` - ## StorageStats9+ -### 属性 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.FileManagement.StorageService.SpatialStatistics - +**系统能力**:SystemCapability.FileManagement.StorageService.SpatialStatistics -该接口为系统接口。 +**系统接口:** 该接口为系统接口。 | 名称 | 类型 | 可读 | 可写 | 说明 | | --------- | ------ | ---- | ----- | -------------- | diff --git a/zh-cn/application-dev/reference/apis/js-apis-file-volumemanager.md b/zh-cn/application-dev/reference/apis/js-apis-file-volumemanager.md index 3a26a3679bbdeb8982f7a95cf182cafac1b549b2..289147e5a41d5cf52e7f480b77d3687480c9cb0b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-file-volumemanager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-file-volumemanager.md @@ -1,6 +1,6 @@ # @ohos.file.volumeManager (卷管理) -该模块提供卷、磁盘查询和管理的相关功能:包括查询卷信息,对卷的挂载卸载、对磁盘分区以及卷的格式化等功能。 +该模块提供卷设备、磁盘设备查询和管理的相关功能:包括查询卷设备信息,对卷设备的挂载卸载、对磁盘设备分区以及卷设备的格式化等功能。 > **说明:** > @@ -18,7 +18,7 @@ import volumemanager from "@ohos.file.volumeManager"; getAllVolumes(): Promise<Array<Volume>> -异步获取当前所有可获得的卷信息,以promise方式返回。 +异步获取当前外置存储中所有卷设备信息,以promise方式返回。 **需要权限**:ohos.permission.STORAGE_MANAGER @@ -28,13 +28,15 @@ getAllVolumes(): Promise<Array<Volume>> | 类型 | 说明 | | ---------------------------------- | -------------------------- | - | Promise<[Volume](#volume)[]> | 返回当前所有可获得的卷信息 | + | Promise<[Volume](#volume)[]> | 返回当前所有可获得的卷设备信息 | **示例:** ```js volumemanager.getAllVolumes().then(function(volumes){ // do something + }).catch(function(error){ + console.info("getAllVolumes failed"); }); ``` @@ -42,7 +44,7 @@ getAllVolumes(): Promise<Array<Volume>> getAllVolumes(callback: AsyncCallback<Array<Volume>>): void -异步获取当前所有可获得的卷信息,以callback方式返回。 +异步获取当前外置存储中所有卷设备信息,以callback方式返回。 **需要权限**:ohos.permission.STORAGE_MANAGER @@ -52,7 +54,7 @@ getAllVolumes(callback: AsyncCallback<Array<Volume>>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------- | ---- | ------------------------------------ | - | callback | AsyncCallback<[Volume](#volume)[]> | 是 | 获取当前所有可获得的卷信息之后的回调 | + | callback | AsyncCallback<[Volume](#volume)[]> | 是 | 获取当前所有可获得的卷设备信息之后的回调 | **示例:** @@ -68,7 +70,7 @@ getAllVolumes(callback: AsyncCallback<Array<Volume>>): void mount(volumeId: string): Promise<void> -异步挂载指定卷,以promise方式返回。 +异步挂载指定卷设备,以promise方式返回。当前仅支持fat、exfat以及ntfs三中文件系统的卷设备挂载。 **需要权限**:ohos.permission.MOUNT_UNMOUNT_MANAGER @@ -78,20 +80,22 @@ mount(volumeId: string): Promise<void> | 参数名 | 类型 | 必填 | 说明 | | -------- | ------ | ---- | ---- | - | volumeId | string | 是 | 卷id | + | volumeId | string | 是 | 卷设备id | **返回值:** | 类型 | 说明 | | ---------------------- | ---------- | - | Promise<void> | 挂载指定卷 | + | Promise<void> | 挂载指定卷设备 | **示例:** ```js let volumeId = ""; - volumemanager.mount(volumeId).then(function(flag){ + volumemanager.mount(volumeId).then(function(){ // do something + }).catch(function(error){ + console.info("mount failed"); }); ``` @@ -99,7 +103,7 @@ mount(volumeId: string): Promise<void> mount(volumeId: string, callback:AsyncCallback<void>):void -异步获取指定卷的可用空间大小,以callback方式返回。 +异步挂载指定卷设备,以callback方式返回。当前仅支持fat、exfat以及ntfs三中文件系统的卷设备挂载。 **需要权限**:ohos.permission.MOUNT_UNMOUNT_MANAGER @@ -109,14 +113,14 @@ mount(volumeId: string, callback:AsyncCallback<void>):void | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------- | ---- | -------------------- | - | volumeId | string | 是 | 卷id | - | callback | AsyncCallback<void> | 是 | 挂载指定卷之后的回调 | + | volumeId | string | 是 | 卷设备id | + | callback | AsyncCallback<void> | 是 | 挂载指定卷设备之后的回调 | **示例:** ```js let volumeId = ""; - volumemanager.mount(volumeId, function(error, flag){ + volumemanager.mount(volumeId, function(error){ // do something }); ``` @@ -125,7 +129,7 @@ mount(volumeId: string, callback:AsyncCallback<void>):void unmount(volumeId: string): Promise<void> -异步卸载指定卷,以promise方式返回。 +异步卸载指定卷设备,以promise方式返回。 **需要权限**:ohos.permission.MOUNT_UNMOUNT_MANAGER @@ -135,20 +139,22 @@ unmount(volumeId: string): Promise<void> | 参数名 | 类型 | 必填 | 说明 | | -------- | ------ | ---- | ---- | - | volumeId | string | 是 | 卷id | + | volumeId | string | 是 | 卷设备id | **返回值:** | 类型 | 说明 | | ---------------------- | ---------- | - | Promise<void> | 卸载指定卷 | + | Promise<void> | 卸载指定卷设备 | **示例:** ```js let volumeId = ""; - volumemanager.unmount(volumeId).then(function(flag){ + volumemanager.unmount(volumeId).then(function(){ // do something + }).catch(function(error){ + console.info("mount failed"); }); ``` @@ -156,7 +162,7 @@ unmount(volumeId: string): Promise<void> unmount(volumeId: string, callback: AsyncCallback<void>): void -异步卸载指定卷,以callback方式返回。 +异步卸载指定卷设备,以callback方式返回。 **需要权限**:ohos.permission.MOUNT_UNMOUNT_MANAGER @@ -166,14 +172,14 @@ unmount(volumeId: string, callback: AsyncCallback<void>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------- | ---- | -------------------- | - | volumeId | string | 是 | 卷id | - | callback | AsyncCallback<void> | 是 | 卸载指定卷之后的回调 | + | volumeId | string | 是 | 卷设备id | + | callback | AsyncCallback<void> | 是 | 卸载指定卷设备之后的回调 | **示例:** ```js let volumeId = ""; - volumemanager.unmount(volumeId, function(error, flag){ + volumemanager.unmount(volumeId, function(error){ // do something }); ``` @@ -182,7 +188,7 @@ unmount(volumeId: string, callback: AsyncCallback<void>): void getVolumeByUuid(uuid: string): Promise<Volume> -异步通过uuid获得卷信息,以promise方式返回。 +异步通过卷设备uuid获得指定卷设备信息,以promise方式返回。 **需要权限**:ohos.permission.STORAGE_MANAGER @@ -192,13 +198,13 @@ getVolumeByUuid(uuid: string): Promise<Volume> | 参数名 | 类型 | 必填 | 说明 | | -------- | ------ | ---- | ---- | - | uuid | string | 是 | 卷uuid | + | uuid | string | 是 | 卷设备uuid | **返回值:** | 类型 | 说明 | | ---------------------------------- | -------------------------- | - | Promise<[Volume](#volume)> | 返回当前所有可获得的卷信息 | + | Promise<[Volume](#volume)> | 返回当前所有可获得的卷设备信息 | **示例:** @@ -215,7 +221,7 @@ getVolumeByUuid(uuid: string): Promise<Volume> getVolumeByUuid(uuid: string, callback: AsyncCallback<Volume>): void -异步通过uuid获得卷信息,以callback方式返回。 +异步通过卷设备uuid获得指定卷设备信息,以callback方式返回。 **需要权限**:ohos.permission.STORAGE_MANAGER @@ -225,8 +231,8 @@ getVolumeByUuid(uuid: string, callback: AsyncCallback<Volume>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------ | ---- | -------------------- | - | uuid | string | 是 | 卷uuid | - | callback | AsyncCallback<[Volume](#volume)> | 是 | 获取卷信息之后的回调 | + | uuid | string | 是 | 卷设备uuid | + | callback | AsyncCallback<[Volume](#volume)> | 是 | 获取卷设备信息之后的回调 | **示例:** @@ -241,7 +247,7 @@ getVolumeByUuid(uuid: string, callback: AsyncCallback<Volume>): void getVolumeById(volumeId: string): Promise<Volume> -异步通过卷id获得卷信息,以promise方式返回。 +异步通过卷设备id获得指定卷设备信息,以promise方式返回。 **需要权限**:ohos.permission.STORAGE_MANAGER @@ -251,13 +257,13 @@ getVolumeById(volumeId: string): Promise<Volume> | 参数名 | 类型 | 必填 | 说明 | | -------- | ------ | ---- | ---- | - | volumeId | string | 是 | 卷id | + | volumeId | string | 是 | 卷设备id | **返回值:** | 类型 | 说明 | | ---------------------------------- | -------------------------- | - | Promise<[Volume](#volume)> | 返回当前所有可获得的卷信息 | + | Promise<[Volume](#volume)> | 返回当前所有可获得的卷设备信息 | **示例:** @@ -274,7 +280,7 @@ getVolumeById(volumeId: string): Promise<Volume> getVolumeById(volumeId: string, callback: AsyncCallback<Volume>): void -异步通过卷id获得卷信息,以callback方式返回。 +异步通过指定卷设备id获得卷设备信息,以callback方式返回。 **需要权限**:ohos.permission.STORAGE_MANAGER @@ -284,8 +290,8 @@ getVolumeById(volumeId: string, callback: AsyncCallback<Volume>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ----------------------------- | - | volumeId | string | 是 | 卷id | - | callback | AsyncCallback<[Volume](#volume)> | 是 | 获取卷信息之后的回调 | + | volumeId | string | 是 | 卷设备id | + | callback | AsyncCallback<[Volume](#volume)> | 是 | 获取卷设备信息之后的回调 | **示例:** @@ -300,7 +306,7 @@ getVolumeById(volumeId: string, callback: AsyncCallback<Volume>): void setVolumeDescription(uuid: string, description: string): Promise<void> -异步通过uuid设置卷描述,以promise方式返回。 +异步修改指定卷设备描述,以promise方式返回。 **需要权限**:ohos.permission.MOUNT_UNMOUNT_MANAGER @@ -310,14 +316,14 @@ setVolumeDescription(uuid: string, description: string): Promise<void> | 参数名 | 类型 | 必填 | 说明 | | --------- | ------ | ---- | ---- | - | uuid | string | 是 | 卷uuid | - | description | string | 是 | 卷描述 | + | uuid | string | 是 | 卷设备uuid | + | description | string | 是 | 卷设备描述 | **返回值:** | 类型 | 说明 | | ---------------------- | -------------------------- | - | Promise<void> | 设置卷信息 | + | Promise<void> | 设置卷设备信息 | **示例:** @@ -335,7 +341,7 @@ setVolumeDescription(uuid: string, description: string): Promise<void> setVolumeDescription(uuid: string, description: string, callback: AsyncCallback<void>): void -异步通过uuid设置卷描述,以callback方式返回。 +异步修改指定卷设备描述,以callback方式返回。 **需要权限**:ohos.permission.MOUNT_UNMOUNT_MANAGER @@ -345,8 +351,8 @@ setVolumeDescription(uuid: string, description: string, callback: AsyncCallback& | 参数名 | 类型 | 必填 | 说明 | | ---------- | --------------------------------------- | ---- | ---------------- | - | uuid | string | 是 | 卷uuid | - | description | string | 是 | 卷描述 | + | uuid | string | 是 | 卷设备uuid | + | description | string | 是 | 卷设备描述 | | callback | AsyncCallback<void> | 是 | 设置卷描述之后的回调 | **示例:** @@ -354,7 +360,7 @@ setVolumeDescription(uuid: string, description: string, callback: AsyncCallback& ```js let uuid = ""; let description = ""; - volumemanager.setVolumeDescription(uuid, description, (error, bool) => { + volumemanager.setVolumeDescription(uuid, description, (error) => { // do something }); ``` @@ -363,7 +369,7 @@ setVolumeDescription(uuid: string, description: string, callback: AsyncCallback& format(volumeId: string, fsType: string): Promise<void> -异步对指定卷进行格式化,以promise方式返回。 +异步对指定卷设备进行格式化,以promise方式返回。当前仅支持vfat和exfat两种文件系统类型的格式化,只有处于卸载状态的卷设备可以进行格式化,格式化后卷设备的uuid、挂载路径和卷设备描述均会发生变化。 **需要权限**:ohos.permission.MOUNT_FORMAT_MANAGER @@ -373,14 +379,14 @@ format(volumeId: string, fsType: string): Promise<void> | 参数名 | 类型 | 必填 | 说明 | | ----------- | ------ | ---- | ---- | - | volumeId | string | 是 | 卷id | - | fsType | string | 是 | 文件系统类型 | + | volumeId | string | 是 | 卷设备id | + | fsType | string | 是 | 文件系统类型(vfat或者exfat) | **返回值:** | 类型 | 说明 | | ---------------------- | ---------- | - | Promise<void> | 对指定卷进行格式化 | + | Promise<void> | 对指定卷设备进行格式化 | **示例:** @@ -398,7 +404,7 @@ format(volumeId: string, fsType: string): Promise<void> format(volumeId: string, fsType: string, callback: AsyncCallback<void>): void -异步对指定卷进行格式化,以callback方式返回。 +异步对指定卷设备进行格式化,以callback方式返回。当前仅支持vfat和exfat两种文件系统类型的格式化,只有处于卸载状态的卷设备可以进行格式化,格式化后卷设备的uuid、挂载路径和卷设备描述均会发生变化。 **需要权限**:ohos.permission.MOUNT_FORMAT_MANAGER @@ -408,16 +414,16 @@ format(volumeId: string, fsType: string, callback: AsyncCallback<void>): v | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ----------------------------- | - | volumeId | string | 是 | 卷id | - | fsType | string | 是 | 文件系统类型 | - | callback | AsyncCallback<void> | 是 | 对指定卷格式化后的回调 | + | volumeId | string | 是 | 卷设备id | + | fsType | string | 是 | 文件系统类型(vfat或者exfat) | + | callback | AsyncCallback<void> | 是 | 对指定卷设备格式化后的回调 | **示例:** ```js let volumeId = ""; let fsType = ""; - volumemanager.format(volumeId, fsType, (error, bool) => { + volumemanager.format(volumeId, fsType, (error) => { // do something }); ``` @@ -426,7 +432,7 @@ format(volumeId: string, fsType: string, callback: AsyncCallback<void>): v partition(diskId: string, type: number): Promise<void> -异步对磁盘进行分区,以promise方式返回。 +异步对磁盘设备进行分区,以promise方式返回。当前仅支持将磁盘设备重新分区为一个分区,系统是支持读取多分区的磁盘设备。 **需要权限**:ohos.permission.MOUNT_FORMAT_MANAGER @@ -436,7 +442,7 @@ partition(diskId: string, type: number): Promise<void> | 参数名 | 类型 | 必填 | 说明 | | ----------- | ------ | ---- | ---- | - | diskId | string | 是 | 卷所属的磁盘id | + | diskId | string | 是 | 卷设备所属的磁盘设备id | | type | number | 是 | 分区类型 | **返回值:** @@ -461,7 +467,7 @@ partition(diskId: string, type: number): Promise<void> partition(diskId: string, type: number, callback: AsyncCallback<void>): void -异步对磁盘进行分区,以callback方式返回。 +异步对磁盘进行分区,以callback方式返回。当前仅支持将磁盘设备重新分区为一个分区,系统是支持读取多分区的磁盘设备。 **需要权限**:ohos.permission.MOUNT_FORMAT_MANAGER @@ -471,16 +477,16 @@ partition(diskId: string, type: number, callback: AsyncCallback<void>): vo | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------------------- | ---- | ---------------- | - | diskId | string | 是 | 卷所属的磁盘id | + | diskId | string | 是 | 卷设备所属的磁盘id | | type | number | 是 | 分区类型 | - | callback | AsyncCallback<void> | 是 | 对磁盘进行分区 | + | callback | AsyncCallback<void> | 是 | 对磁盘设备进行分区 | **示例:** ```js let diskId = ""; let type = 0; - volumemanager.partition(diskId, type, (error, bool) => { + volumemanager.partition(diskId, type, (error) => { // do something }); ``` @@ -493,10 +499,10 @@ partition(diskId: string, type: number, callback: AsyncCallback<void>): vo | 名称 | 类型 | 可读 | 可写 | 说明 | | ----------- | ------- | ------- | ----- | -------------------- | -| id | string | 是 | 否 | 卷id | -| uuid | string | 是 | 否 | 卷uuid | -| diskId | string | 是 | 否 | 卷所属的磁盘id | -| description | string | 是 | 否 | 卷相关描述 | -| removable | boolean | 是 | 否 | 是否为可移动存储设备 | -| state | number | 是 | 否 | 当前卷状态 | -| path | string | 是 | 否 | 卷的挂载地址 | \ No newline at end of file +| id | string | 是 | 否 | 卷设备ID的格式为vol-{主设备号}-{次设备号},主设备号用来区分不同种类的设备,次设备号用来区分同一类型的多个设备,卷设备ID会随着插卡顺序不同而变化。 | +| uuid | string | 是 | 否 | 卷设备uuid是卷设备的通用唯一识别码,不会随着插卡顺序变化而变化,但是卷设备的格式化会改变卷设备的uuid | +| diskId | string | 是 | 否 | 卷设备所属的磁盘ID,一个磁盘可以有一个或者多个卷设备。磁盘设备ID好格式为disk-{主设备号}-{次设备号},与卷设备ID相似。 | +| description | string | 是 | 否 | 卷设备描述、 | +| removable | boolean | 是 | 否 | 表示卷设备是否可移除,当前仅支持可移除存储设备、 | +| state | number | 是 | 否 | 卷设备状态标识:
0:卸载状态 UNMOUNTED
1:检查状态 CHECKING
2:挂载状态 MOUNTED
3:正在弹出状态 EJECTING | +| path | string | 是 | 否 | 卷设备的挂载地址,一般为/mnt/external/{uuid} | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-fileAccess.md b/zh-cn/application-dev/reference/apis/js-apis-fileAccess.md index 2f66868a47a28345d007b1320abbd349800f41d8..7b1c68e35a569c2abf385020f5315e1bdbb215b3 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-fileAccess.md +++ b/zh-cn/application-dev/reference/apis/js-apis-fileAccess.md @@ -6,6 +6,7 @@ fileAccess模块是基于extension机制实现的一个对公共文件访问和 > >- 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 >- 本模块接口为系统接口,三方应用不支持调用,当前只支持filepicker、文件管理器调用。 +>- 本模块支持对错误码进行处理,错误码及其适配方式[参考文档](../errorcodes/errorcode-filemanagement.md#错误码适配指导)。 ## 导入模块 @@ -1017,6 +1018,492 @@ access(sourceFileUri: string, callback: AsyncCallback<boolean>) : void; }; ``` +## FileAccessHelper.getFileInfoFromUri10+ + +getFileInfoFromUri(uri: string) : Promise; + +以异步方法获取uri对应的[FileInfo](#fileinfo)对象。使用promise异步回调。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**需要权限**:ohos.permission.FILE_ACCESS_MANAGER + +**参数:** + + | 参数名 | 类型 | 必填 | 说明 | + | --- | --- | --- | -- | + | uri | string | 是 | 文件(夹)的Uri | + +**返回值:** + +| 类型 | 说明 | +| --- | -- | +| [FileInfo](#fileinfo) | FileInfo对象 | + +**示例:** + + ```js + // 以媒体库uri为例 + // 示例代码sourceUri表示Download目录,该uri是对应的fileInfo中uri + // 开发者应根据自己实际获取的uri进行开发 + let sourceUri = "datashare:///media/file/6"; + try { + // fileAccessHelper 参考 fileAccess.createFileAccessHelper 示例代码获取 + let fileInfo = await fileAccessHelper.getFileInfoFromUri(sourceUri); + } catch (error) { + console.error("getFileInfoFromUri failed, errCode:" + error.code + ", errMessage:" + error.message); + }; + ``` + +## FileAccessHelper.getFileInfoFromUri10+ + +getFileInfoFromUri(uri: string, callback: AsyncCallback) : void; + +以异步方法获取uri对应的[FileInfo](#fileinfo)对象。使用callback异步回调。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**需要权限**:ohos.permission.FILE_ACCESS_MANAGER + +**参数:** + + | 参数名 | 类型 | 必填 | 说明 | + | --- | --- | --- | -- | + | uri | string | 是 | 文件(夹)的Uri | + | callback | AsyncCallback<string> | 是 | uri对应的FileInfo对象 | + +**示例:** + + ```js + // 以媒体库uri为例 + // 示例代码sourceUri表示Download目录,该uri是对应的fileInfo中uri + // 开发者应根据自己实际获取的uri进行开发 + let sourceUri = "datashare:///media/file/6"; + try { + // fileAccessHelper 参考 fileAccess.createFileAccessHelper 示例代码获取 + fileAccessHelper.getFileInfoFromUri(sourceUri, function (err, fileInfo) { + if (err) { + console.error("Failed to getFileInfoFromUri in async, errCode:" + err.code + ", errMessage:" + err.message); + return; + } + console.log("getFileInfoFromUri success, fileInfo: " + JSON.stringify(fileInfo)); + }); + } catch (error) { + console.error("getFileInfoFromUri failed, errCode:" + error.code + ", errMessage:" + error.message); + }; + ``` + + +## FileAccessHelper.getFileInfoFromRelativePath10+ + +getFileInfoFromRelativePath(relativePath: string) : Promise; + +以异步方法获取relativePath对应的[FileInfo](#fileinfo)对象。使用promise异步回调。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**需要权限**:ohos.permission.FILE_ACCESS_MANAGER + +**参数:** + + | 参数名 | 类型 | 必填 | 说明 | + | --- | --- | --- | -- | + | relativePath | string | 是 | 文件(夹)的相对路径 | + +**返回值:** + +| 类型 | 说明 | +| --- | -- | +| [FileInfo](#fileinfo) | FileInfo对象 | + +**示例:** + + ```js + // 以媒体库relativePath为例 + // 示例代码relativePath表示Download目录,该relativePath是对应的fileInfo中relativePath + // 开发者应根据自己实际获取的relativePath进行开发 + let relativePath = "Download/"; + try { + // fileAccessHelper 参考 fileAccess.createFileAccessHelper 示例代码获取 + let fileInfo = await fileAccessHelper.getFileInfoFromRelativePath(relativePath); + } catch (error) { + console.error("getFileInfoFromRelativePath failed, errCode:" + error.code + ", errMessage:" + error.message); + }; + ``` + +## FileAccessHelper.getFileInfoFromRelativePath10+ + +getFileInfoFromRelativePath(relativePath: string, callback: AsyncCallback) : void; + +以异步方法获取relativePath对应的[FileInfo](#fileinfo)对象。使用callback异步回调。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**需要权限**:ohos.permission.FILE_ACCESS_MANAGER + +**参数:** + + | 参数名 | 类型 | 必填 | 说明 | + | --- | --- | --- | -- | + | relativePath | string | 是 | 文件(夹)的相对路径 | + | callback | AsyncCallback<string> | 是 | relativePath对应的FileInfo对象 | + +**示例:** + + ```js + // 以媒体库relativePath为例 + // 示例代码relativePath表示Download目录,该relativePath是对应的fileInfo中relativePath + // 开发者应根据自己实际获取的relativePath进行开发 + let relativePath = "Download/"; + try { + // fileAccessHelper 参考 fileAccess.createFileAccessHelper 示例代码获取 + fileAccessHelper.getFileInfoFromRelativePath(relativePath, function (err, fileInfo) { + if (err) { + console.error("Failed to getFileInfoFromRelativePath in async, errCode:" + err.code + ", errMessage:" + err.message); + return; + } + console.log("getFileInfoFromRelativePath success, fileInfo: " + JSON.stringify(fileInfo)); + }); + } catch (error) { + console.error("getFileInfoFromRelativePath failed, errCode:" + error.code + ", errMessage:" + error.message); + }; + ``` + +## FileAccessHelper.getThumbnail10+ + +getThumbnail(uri: string, size: image.Size) : Promise<image.PixelMap> + +通过指定uri和尺寸获取媒体文件的Pixelmap对象,使用Promise异步回调。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**需要权限**:ohos.permission.FILE_ACCESS_MANAGER + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ----------------------------------- | ---- | ----------- | +| uri | string | 是 | 媒体文件uri | +| size | [image.Size](js-apis-image.md#size) | 是 | 缩略图尺寸 | + +**返回值:** + +| 类型 | 说明 | +| :---------------------------- | :----------------- | +| Promise<image.PixelMap> | 返回的Pixelmap对象 | + +**示例:** + +```js +// 以媒体库uri为例 +// 示例代码targetUri表示Download目录下某个媒体文件(图片、音频、视频),该uri是对应的fileInfo中uri +// 开发者应根据自己实际获取的uri进行开发 +let targetUri = "datashare:///media/image/100"; +let size = { width: 128, height: 128 }; +try { + // fileAccessHelper 参考 fileAccess.createFileAccessHelper 示例代码获取 + let pixelMap = await fileAccessHelper.getThumbnail(targetUri, size); + let imageInfo = await pixelMap.getImageInfo(); + console.log("getThumbnail sucess, pixelMap.width: " + imageInfo.size.width); + console.log("getThumbnail sucess, pixelMap.height: " + imageInfo.size.height); +} catch (error) { + console.error("getThumbnail failed, errCode:" + error.code + ", errMessage:" + error.message); +}; +``` + +## FileAccessHelper.getThumbnail10+ + + getThumbnail(uri: string, size: image.Size, callback: AsyncCallback<image.PixelMap>) : void + +通过指定uri和尺寸获取媒体文件的Pixelmap对象,使用callback异步回调。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**需要权限**:ohos.permission.FILE_ACCESS_MANAGER + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------- | ---- | ------------------ | +| uri | string | 是 | 媒体文件uri | +| size | [image.Size](js-apis-image.md#size) | 是 | 缩略图尺寸 | +| callback | AsyncCallback<image.PixelMap> | 是 | 返回的Pixelmap对象 | + +**示例:** + +```js +// 以媒体库uri为例 +// 示例代码targetUri表示Download目录下某个媒体文件(图片、音频、视频),该uri是对应的fileInfo中uri +// 开发者应根据自己实际获取的uri进行开发 +let targetUri = "datashare:///media/image/100"; +let size = { width: 128, height: 128 }; +try { + // fileAccessHelper 参考 fileAccess.createFileAccessHelper 示例代码获取 + fileAccessHelper.getThumbnail(targetUri, size, async(err, pixelMap) => { + if (err) { + console.error("Failed to getThumbnail in async, errCode:" + err.code + ", errMessage:" + err.message); + return; + } + let imageInfo = await pixelMap.getImageInfo(); + console.log("getThumbnail sucess, pixelMap.width: " + imageInfo.size.width); + console.log("getThumbnail sucess, pixelMap.height: " + imageInfo.size.height); + }); +} catch (error) { + console.error("getThumbnail failed, errCode:" + error.code + ", errMessage:" + error.message); +}; +``` + +## FileAccessHelper.query10+ + +query(uri:string, metaJson: string) : Promise<string> + +通过uri查询文件或目录的相关信息,使用Promise异步回调。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**需要权限**:ohos.permission.FILE_ACCESS_MANAGER + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ---------------------------------------------------- | +| uri | string | 是 | 所选文件或目录的uri(从[FileInfo](#fileinfo)中获取) | +| metaJson | string | 是 | json字符串,包含查询属性[FILEKEY](#filekey10) | + +**返回值:** + +| 类型 | 说明 | +| :-------------------- | :------------------------------- | +| Promise<string> | 返回json字符串,包括查询属性和值 | + +**示例:** + +```js +var imageFileRelativePath = "Download/queryTest/image/01.jpg"; +var jsonStrSingleRelativepath = JSON.stringify({ [fileAccess.FileKey.RELATIVE_PATH]: "" }); +try { + // fileAccessHelper 参考 fileAccess.createFileAccessHelper 示例代码获取 + var fileInfo = await fileAccessHelper.getFileInfoFromRelativePath(imageFileRelativePath); + let queryResult = await fileAccessHelper.query(fileInfo.uri, jsonStrSingleRelativepath); + console.log("query_file_single faf query, queryResult.relative_path: " + JSON.parse(queryResult).relative_path); +} catch (error) { + console.error("query_file_single faf query failed, error.code :" + error.code + ", errorMessage :" + error.message); +}; +``` + +## FileAccessHelper.query10+ + +query(uri:string, metaJson: string, callback: AsyncCallback<string>) : void + +通过uri查询文件或目录的相关信息,使用callback异步回调。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**需要权限**:ohos.permission.FILE_ACCESS_MANAGER + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------- | ---- | ---------------------------------------------------- | +| uri | string | 是 | 所选文件或目录的uri(从[FileInfo](#fileinfo)中获取) | +| metaJson | string | 是 | json字符串,包含查询属性[FILEKEY](#filekey10) | +| callback | AsyncCallback<string> | 是 | 返回json字符串,包括查询属性和值 | + +**示例:** + +```js +var imageFileRelativePath = "Download/queryTest/image/01.jpg"; +var jsonStrSingleRelativepath = JSON.stringify({ [fileAccess.FileKey.RELATIVE_PATH]: "" }); +try { + // fileAccessHelper 参考 fileAccess.createFileAccessHelper 示例代码获取 + var fileInfo = await fileAccessHelper.getFileInfoFromRelativePath(imageFileRelativePath); + fileAccessHelper.query(fileInfo.uri, jsonStrSingleRelativepath, (err, queryResult)=>{ + if (err) { + console.log("query_file_single faf query Failed, errCode:" + err.code + ", errMessage:" + err.message); + return; + } + console.log("query_file_single faf query, queryResult.relative_path: " + JSON.parse(queryResult).relative_path); + }) +} catch (error) { + console.error("query_file_single faf query failed, error.code :" + error.code + ", errorMessage :" + error.message); +}; +``` + +## FileAccessHelper.copy10+ + +copy(sourceUri: string, destUri: string, force?: boolean) : Promise<Array<CopyResult>> + +复制文件或目录,使用 Promise 异步回调。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**需要权限**:ohos.permission.FILE_ACCESS_MANAGER + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------- | ---- | ------------------------------------------------------------ | +| sourceUri | string | 是 | 待拷贝的源文件(夹)的 uri,例如:datashare:///media/file/102 | +| destUri | string | 是 | 目标文件夹的 uri,例如:datashare:///media/file/101 | +| force | boolean | 否 | 含有同名文件时是否强制覆盖文件,force 为 true 时强制覆盖文件,force 为空或 false 时不强制覆盖文件 | + +**返回值:** + +| 类型 | 说明 | +| :------------------------------------------------------ | :----------------------------------------------------------- | +| Promise<Array<[CopyResult](#copyresult10)>> | 返回 copyresult 数组,copyResult 为复制操作失败的返回信息,复制成功无返回信息 | + +**示例 1:force 为空** + +```js +// 以媒体库uri为例 +// 示例代码中的sourceFile表示Download目录下的源文件(夹),destFile表示Download目录下的目标文件夹,该uri对应fileInfo中的uri +// 开发者应根据自己实际获取的uri进行开发 +let sourceFile = "datashare:///media/file/102"; +let destFile = "datashare:///media/file/101"; +try { + // fileAccessHelper 参考 fileAccess.createFileAccessHelper 示例代码获取 + let copyResult = await fileAccessHelper.copy(sourceFile, destFile); + if (copyResult.length === 0) { + console.log("copy success"); + } else { + for (let i = 0; i < copyResult.length; i++) { + console.error("errCode" + copyResult[i].errCode); + console.error("errMsg" + copyResult[i].errMsg); + console.error("sourceUri" + copyResult[i].sourceUri); + console.error("destUri" + copyResult[i].destUri); + } + } +} catch (error) { + console.error("copy failed, errCode:" + error.code + ", errMessage:" + error.message); +} +``` + +**示例 2:force 为 true** + +```js +// 以媒体库uri为例 +// 示例代码中的sourceFile表示Download目录下的源文件(夹),destFile表示Download目录下的目标文件夹,该uri对应fileInfo中的uri +// 开发者应根据自己实际获取的uri进行开发 +let sourceFile = "datashare:///media/file/102"; +let destFile = "datashare:///media/file/101"; +try { + // fileAccessHelper 参考 fileAccess.createFileAccessHelper 示例代码获取 + let copyResult = await fileAccessHelper.copy(sourceFile, destFile, true); + if (copyResult.length === 0) { + console.log("copy success"); + } else { + for (let i = 0; i < copyResult.length; i++) { + console.error("errCode" + copyResult[i].errCode); + console.error("errMsg" + copyResult[i].errMsg); + console.error("sourceUri" + copyResult[i].sourceUri); + console.error("destUri" + copyResult[i].destUri); + } + } +} catch (error) { + console.error("copy failed, errCode:" + error.code + ", errMessage:" + error.message); +} +``` + +## FileAccessHelper.copy10+ + +copy(sourceUri: string, destUri: string, callback: AsyncCallback<Array<CopyResult>>) : void + +复制文件或目录,使用 callback 异步回调。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**需要权限**:ohos.permission.FILE_ACCESS_MANAGER + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------------------------------------------------ | ---- | ------------------------------------------------------------ | +| sourceUri | string | 是 | 待拷贝的源文件(夹)的 uri,例如:datashare:///media/file/102 | +| destUri | string | 是 | 目标文件夹的 uri,例如:datashare:///media/file/101 | +| callback | <Array<[CopyResult](#copyresult10)>> | 是 | 返回 copyresult 数组,copyResult 为复制操作失败的返回信息,复制成功无返回信息 | + +**示例:** + +```js +// 以媒体库uri为例 +// 示例代码中的sourceFile表示Download目录下的源文件(夹),destFile表示Download目录下的目标文件夹,该uri对应fileInfo中的uri +// 开发者应根据自己实际获取的uri进行开发 +let sourceFile = "datashare:///media/file/102"; +let destFile = "datashare:///media/file/101"; +try { + // fileAccessHelper 参考 fileAccess.createFileAccessHelper 示例代码获取 + fileAccessHelper.copy(sourceFile, destFile, async (err, copyResult) => { + if (err) { + console.error("copy failed, errCode:" + err.code + ", errMessage:" + err.message); + return; + } + if (copyResult.length === 0) { + console.log("copy success"); + } else { + for (let i = 0; i < copyResult.length; i++) { + console.error("errCode" + copyResult[i].errCode); + console.error("errMsg" + copyResult[i].errMsg); + console.error("sourceUri" + copyResult[i].sourceUri); + console.error("destUri" + copyResult[i].destUri); + } + } + }); +} catch (error) { + console.error("copy failed, errCode:" + error.code + ", errMessage:" + error.message); +} +``` + +## FileAccessHelper.copy10+ + +copy(sourceUri: string, destUri: string, force: boolean, callback: AsyncCallback<Array<CopyResult>>) : void + +复制文件或目录,使用 callback 异步回调。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**需要权限**:ohos.permission.FILE_ACCESS_MANAGER + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------------------------------------------------ | ---- | ------------------------------------------------------------ | +| sourceUri | string | 是 | 待拷贝的源文件(夹)的 uri,例如:datashare:///media/file/102 | +| destUri | string | 是 | 目标文件夹的 uri,例如:datashare:///media/file/101 | +| force | boolean | 是 | 含有同名文件时是否强制覆盖文件,force 为 true 时强制覆盖文件,force 为空或 false 时不强制覆盖文件 | +| callback | <Array<[CopyResult](#copyresult10)>> | 是 | 返回 copyresult 数组,copyResult 为复制操作失败的返回信息,复制成功无返回信息 | + +**示例:** + +```js +// 以媒体库uri为例 +// 示例代码中的sourceFile表示Download目录下的源文件(夹),destFile表示Download目录下的目标文件夹,该uri对应fileInfo中的uri +// 开发者应根据自己实际获取的uri进行开发 +let sourceFile = "datashare:///media/file/102"; +let destFile = "datashare:///media/file/101"; +try { + // fileAccessHelper 参考 fileAccess.createFileAccessHelper 示例代码获取 + fileAccessHelper.copy(sourceFile, destFile, true, async (err, copyResult) => { + if (err) { + console.error("copy failed, errCode:" + err.code + ", errMessage:" + err.message); + return; + } + if (copyResult.length === 0) { + console.log("copy success"); + } else { + for (let i = 0; i < copyResult.length; i++) { + console.error("errCode" + copyResult[i].errCode); + console.error("errMsg" + copyResult[i].errMsg); + console.error("sourceUri" + copyResult[i].sourceUri); + console.error("destUri" + copyResult[i].destUri); + } + } + }); +} catch (error) { + console.error("copy failed, errCode:" + error.code + ", errMessage:" + error.message); +} +``` + ## RootIterator.next next( ) : { value: RootInfo, done: boolean } @@ -1063,6 +1550,7 @@ FileIterator表示文件夹的迭代器对象,可以通过next同步方法获 | ------ | ------ | -------- | ------ | -------- | | deviceType | number | 是 | 否 |设备类型 | | uri | string | 是 | 否 | 设备根目录Uri | +| relativePath10+ | string | 是 | 否 | 根目录的相对路径 | | displayName | string | 是 | 否 | 设备名称 | | deviceFlags | number | 是 | 否 | 设备支持的能力 | @@ -1079,12 +1567,30 @@ FileIterator表示文件夹的迭代器对象,可以通过next同步方法获 | 名称 | 类型 | 可读 | 可写 | 说明 | | ------ | ------ | -------- | ------ | -------- | | uri | string | 是 | 否 | 文件(夹)的uri | +| relativePath10+ | string | 是 | 否 | 文件(夹)的相对路径 | | fileName | string | 是 | 否 | 文件(夹)的名称 | | mode | number | 是 | 否 | 文件(夹)的权限信息 | | size | number | 是 | 否 | 文件(夹)的大小 | | mtime | number | 是 | 否 | 文件(夹)的修改时间 | | mimeType | string | 是 | 否 | 文件(夹)的媒体资源类型 | +## CopyResult10+ + +表示复制操作失败时的返回信息,复制成功时则没有返回信息。 + +**系统能力**:SystemCapability.FileManagement.UserFileService + +**需要权限**:ohos.permission.FILE_ACCESS_MANAGER + +### 属性 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| --------- | ------ | ---- | ---- | ------------------------------------------------------ | +| sourceUri | string | 是 | 否 | 源文件(夹) uri | +| destUri | string | 是 | 否 | 产生冲突的目标文件的 uri。如果非冲突导致的错误,则为空 | +| errCode | number | 是 | 否 | 错误码 | +| errMsg | string | 是 | 否 | 错误信息 | + ## OPENFLAGS 目前支持的文件打开的标志位。 @@ -1096,3 +1602,20 @@ FileIterator表示文件夹的迭代器对象,可以通过next同步方法获 | READ | 0o0 | 读模式。 | | WRITE | 0o1 | 写模式。 | | WRITE_READ | 0o2 | 读写模式。 | + +## FILEKEY10+ + +支持查询的键。 + +**系统能力:** SystemCapability.FileManagement.UserFileService + +| 名称 | 值 | 说明 | +| ------------- | ------------- | ----------------------------------- | +| DISPLAY_NAME | display_name | 文件名 | +| DATE_ADDED | date_added | 文件创建的日期,例如1501925454 | +| DATE_MODIFIED | date_modified | 文件的修改日期,例如1665310670 | +| RELATIVE_PATH | relative_path | 相对路径,例如Pictures/Screenshots/ | +| FILE_SIZE | size | 文件(夹)大小(单位:字节) | +| WIDTH | width | 图像文件的宽度(单位:像素) | +| HEIGHT | height | 图像文件的高度(单位:像素) | +| DURATION | duration | 音频和视频文件的时长(单位:毫秒) | diff --git a/zh-cn/application-dev/reference/apis/js-apis-fileShare.md b/zh-cn/application-dev/reference/apis/js-apis-fileShare.md new file mode 100644 index 0000000000000000000000000000000000000000..bf8700d75fd6c63c15fe868a0f15ad8ae8da3823 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-fileShare.md @@ -0,0 +1,119 @@ +# @ohos.fileShare (文件分享) + +该模块提供文件分享能力,提供系统应用将公共目录文件统一资源标志符(Uniform Resource Identifier,URI)以读写权限授权给其他应用的接口,授权后应用可通过[@ohos.file.fs](js-apis-file-fs.md)的相关接口进行相关open、read、write等操作,实现文件分享。 + +> **说明:** +> - 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +## 导入模块 + +```js +import fileShare from '@ohos.fileShare'; +``` + +## fileShare.grantUriPermission + +grantUriPermission(uri: string, bundleName: string, mode: number, callback: AsyncCallback<void>): void + +对公共目录文件URI进行授权操作,使用callback异步回调。 +**需要权限**:ohos.permission.WRITE_MEDIA +**系统接口**:此接口为系统接口 +**系统能力**:SystemCapability.FileManagement.AppFileService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------- | +| uri | string | 是 | 公共目录文件URI | +| bundleName | string | 是 | 分享目标的包名 | +| mode | number | 是 | 授权的权限,参考[wantConstant.Flags](js-apis-app-ability-wantConstant.md#wantconstantflags)
wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION:读授权
wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION:写授权| + | callback | AsyncCallback<void> | 是 | 异步授权之后的回调 | + +**错误码:** + +以下错误码的详细介绍请参见[文件管理子系统错误码](../errorcodes/errorcode-filemanagement.md#错误码适配指导) + + | 错误码ID | 错误信息 | + | ---------------------------- | ---------- | + | 201 | Permission verification failed | + | 202 | The caller is not a system application | + | 401 | The input parameter is invalid | + | 143000001 | IPC error | + + +**示例:** + + ```js +import wantConstant from '@ohos.app.ability.wantConstant'; + + +let uri = 'datashare:///media/image/8'; +let bundleName = 'com.demo.test'; +try { + fileShare.grantUriPermission(uri, bundleName, wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION | wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION, (err) => { + if (err) { + console.error("grantUriPermission failed with error: " + err); + return; + } + console.info("grantUriPermission success!"); + }); +} catch (error) { + console.error("grantUriPermission failed with error:" + error); +} + ``` + + +## fileShare.grantUriPermission + +grantUriPermission(uri: string, bundleName: string, mode: number): Promise<void> + +将公共目录文件URI进行授权操作,使用Promise异步回调。 +**需要权限**:ohos.permission.WRITE_MEDIA +**系统接口**:此接口为系统接口 +**系统能力**:SystemCapability.FileManagement.AppFileService + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------- | +| uri | string | 是 | 公共目录文件URI | +| bundleName | string | 是 | 分享目标的包名 | +| mode | number | 是 | 授权的权限,参考[wantConstant.Flags](js-apis-app-ability-wantConstant.md#wantconstantflags)
wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION:读授权
wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION:写授权| + +**返回值:** + + | 类型 | 说明 | + | ---------------------------- | ---------- | + | Promise<void> | Promise对象,无返回值 | + + +**错误码:** + +以下错误码的详细介绍请参见[文件管理子系统错误码](../errorcodes/errorcode-filemanagement.md#错误码适配指导) + + | 错误码ID | 错误信息 | + | ---------------------------- | ---------- | + | 201 | Permission verification failed | + | 202 | The caller is not a system application | + | 401 | The input parameter is invalid | + | 143000001 | IPC error | + + +**示例:** + + ```js +import wantConstant from '@ohos.app.ability.wantConstant'; + +let uri = 'datashare:///media/image/8'; +let bundleName = 'com.demo.test'; +try { + fileShare.grantUriPermission(uri, bundleName, wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION | + wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION).then(function () { + console.info("grantUriPermission success!"); + }).catch(function (error) { + console.error("grantUriPermission failed with error:" + error); + }); +} catch (error) { + console.error("grantUriPermission failed with error:" + error); +} + ``` \ No newline at end of file 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 204537e9f0ff89cf89040682b07c8448cee57370..367b069c7a35a87ca9ec8162368b5294d2302439 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-fileio.md +++ b/zh-cn/application-dev/reference/apis/js-apis-fileio.md @@ -30,7 +30,7 @@ export default class EntryAbility extends UIAbility { } ``` - Stage模型context的具体获取方法参见[Stage模型](js-apis-ability-context.md#abilitycontext)。 + Stage模型context的具体获取方法参见[Stage模型](js-apis-inner-application-uiAbilityContext.md)。 **FA模型** @@ -569,7 +569,7 @@ open(path: string, flags?: number, mode?: number): Promise<number> | ------ | ------ | ---- | ------------------------------------------------------------ | | path | string | 是 | 待打开文件的应用沙箱路径。 | | flags | number | 否 | 打开文件的选项,必须指定如下选项中的一个,默认以只读方式打开:
- 0o0:只读打开。
- 0o1:只写打开。
- 0o2:读写打开。
同时,也可给定如下选项,以按位或的方式追加,默认不给定任何额外选项:
- 0o100:若文件不存在,则创建文件。使用该选项时必须指定第三个参数 mode。
- 0o200:如果追加了0o100选项,且文件已经存在,则出错。
- 0o1000:如果文件存在且以只写或读写的方式打开文件,则将其长度裁剪为零。
- 0o2000:以追加方式打开,后续写将追加到文件末尾。
- 0o4000:如果path指向FIFO、块特殊文件或字符特殊文件,则本次打开及后续 IO 进行非阻塞操作。
- 0o200000:如果path不指向目录,则出错。
- 0o400000:如果path指向符号链接,则出错。
- 0o4010000:以同步IO的方式打开文件。 | -| mode | number | 否 | 若创建文件,则指定文件的权限,可给定如下权限,以按位或的方式追加权限,默认给定0o666。
- 0o666:所有者具有读、写权限,所有用户组具有读、写权限,其余用户具有读、写权限。
- 0o700:所有者具有读、写及可执行权限。
- 0o400:所有者具有读权限。
- 0o200:所有者具有写权限。
- 0o100:所有者具有可执行权限。
- 0o070:所有用户组具有读、写及可执行权限。
- 0o040:所有用户组具有读权限。
- 0o020:所有用户组具有写权限。
- 0o010:所有用户组具有可执行权限。
- 0o007:其余用户具有读、写及可执行权限。
- 0o004:其余用户具有读权限。
- 0o002:其余用户具有写权限。
- 0o001:其余用户具有可执行权限。 | +| mode | number | 否 | 若创建文件,则指定文件的权限,可给定如下权限,以按位或的方式追加权限,默认给定0o660。
- 0o660:所有者具有读、写权限,所有用户组具有读、写权限。
- 0o700:所有者具有读、写及可执行权限。
- 0o400:所有者具有读权限。
- 0o200:所有者具有写权限。
- 0o100:所有者具有可执行权限。
- 0o070:所有用户组具有读、写及可执行权限。
- 0o040:所有用户组具有读权限。
- 0o020:所有用户组具有写权限。
- 0o010:所有用户组具有可执行权限。
- 0o007:其余用户具有读、写及可执行权限。
- 0o004:其余用户具有读权限。
- 0o002:其余用户具有写权限。
- 0o001:其余用户具有可执行权限。 | **返回值:** @@ -603,7 +603,7 @@ open(path: string, flags: number, mode: number, callback: AsyncCallback<numbe | -------- | ------------------------------- | ---- | ------------------------------------------------------------ | | path | string | 是 | 待打开文件的应用沙箱路径。 | | flags | number | 否 | 打开文件的选项,必须指定如下选项中的一个,默认以只读方式打开:
- 0o0:只读打开。
- 0o1:只写打开。
- 0o2:读写打开。
同时,也可给定如下选项,以按位或的方式追加,默认不给定任何额外选项:
- 0o100:若文件不存在,则创建文件。使用该选项时必须指定第三个参数 mode。
- 0o200:如果追加了0o100选项,且文件已经存在,则出错。
- 0o1000:如果文件存在且以只写或读写的方式打开文件,则将其长度裁剪为零。
- 0o2000:以追加方式打开,后续写将追加到文件末尾。
- 0o4000:如果path指向FIFO、块特殊文件或字符特殊文件,则本次打开及后续 IO 进行非阻塞操作。
- 0o200000:如果path不指向目录,则出错。
- 0o400000:如果path指向符号链接,则出错。
- 0o4010000:以同步IO的方式打开文件。 | -| mode | number | 否 | 若创建文件,则指定文件的权限,可给定如下权限,以按位或的方式追加权限,默认给定0o666。
- 0o666:所有者具有读、写权限,所有用户组具有读、写权限,其余用户具有读、写权限。
- 0o700:所有者具有读、写及可执行权限。
- 0o400:所有者具有读权限。
- 0o200:所有者具有写权限。
- 0o100:所有者具有可执行权限。
- 0o070:所有用户组具有读、写及可执行权限。
- 0o040:所有用户组具有读权限。
- 0o020:所有用户组具有写权限。
- 0o010:所有用户组具有可执行权限。
- 0o007:其余用户具有读、写及可执行权限。
- 0o004:其余用户具有读权限。
- 0o002:其余用户具有写权限。
- 0o001:其余用户具有可执行权限。 | +| mode | number | 否 | 若创建文件,则指定文件的权限,可给定如下权限,以按位或的方式追加权限,默认给定0o660。
- 0o660:所有者具有读、写权限,所有用户组具有读、写权限。
- 0o700:所有者具有读、写及可执行权限。
- 0o400:所有者具有读权限。
- 0o200:所有者具有写权限。
- 0o100:所有者具有可执行权限。
- 0o070:所有用户组具有读、写及可执行权限。
- 0o040:所有用户组具有读权限。
- 0o020:所有用户组具有写权限。
- 0o010:所有用户组具有可执行权限。
- 0o007:其余用户具有读、写及可执行权限。
- 0o004:其余用户具有读权限。
- 0o002:其余用户具有写权限。
- 0o001:其余用户具有可执行权限。 | | callback | AsyncCallback<number> | 是 | 异步打开文件之后的回调。 | **示例:** @@ -630,7 +630,7 @@ openSync(path: string, flags?: number, mode?: number): number | ------ | ------ | ---- | ------------------------------------------------------------ | | path | string | 是 | 待打开文件的应用沙箱路径。 | | flags | number | 否 | 打开文件的选项,必须指定如下选项中的一个,默认以只读方式打开:
- 0o0:只读打开。
- 0o1:只写打开。
- 0o2:读写打开。
同时,也可给定如下选项,以按位或的方式追加,默认不给定任何额外选项:
- 0o100:若文件不存在,则创建文件。使用该选项时必须指定第三个参数 mode。
- 0o200:如果追加了0o100选项,且文件已经存在,则出错。
- 0o1000:如果文件存在且以只写或读写的方式打开文件,则将其长度裁剪为零。
- 0o2000:以追加方式打开,后续写将追加到文件末尾。
- 0o4000:如果path指向FIFO、块特殊文件或字符特殊文件,则本次打开及后续 IO 进行非阻塞操作。
- 0o200000:如果path不指向目录,则出错。
- 0o400000:如果path指向符号链接,则出错。
- 0o4010000:以同步IO的方式打开文件。 | -| mode | number | 否 | 若创建文件,则指定文件的权限,可给定如下权限,以按位或的方式追加权限,默认给定0o666。
- 0o666:所有者具有读、写权限,所有用户组具有读、写权限,其余用户具有读、写权限。
- 0o640:所有者具有读、写权限,所有用户组具有读权限。
- 0o700:所有者具有读、写及可执行权限。
- 0o400:所有者具有读权限。
- 0o200:所有者具有写权限。
- 0o100:所有者具有可执行权限。
- 0o070:所有用户组具有读、写及可执行权限。
- 0o040:所有用户组具有读权限。
- 0o020:所有用户组具有写权限。
- 0o010:所有用户组具有可执行权限。
- 0o007:其余用户具有读、写及可执行权限。
- 0o004:其余用户具有读权限。
- 0o002:其余用户具有写权限。
- 0o001:其余用户具有可执行权限。
创建出的文件权限受umask影响,umask随进程启动确定,其修改当前不开放。 | +| mode | number | 否 | 若创建文件,则指定文件的权限,可给定如下权限,以按位或的方式追加权限,默认给定0o660。
- 0o660:所有者具有读、写权限,所有用户组具有读、写权限。
- 0o640:所有者具有读、写权限,所有用户组具有读权限。
- 0o700:所有者具有读、写及可执行权限。
- 0o400:所有者具有读权限。
- 0o200:所有者具有写权限。
- 0o100:所有者具有可执行权限。
- 0o070:所有用户组具有读、写及可执行权限。
- 0o040:所有用户组具有读权限。
- 0o020:所有用户组具有写权限。
- 0o010:所有用户组具有可执行权限。
- 0o007:其余用户具有读、写及可执行权限。
- 0o004:其余用户具有读权限。
- 0o002:其余用户具有写权限。
- 0o001:其余用户具有可执行权限。
创建出的文件权限受umask影响,umask随进程启动确定,其修改当前不开放。 | **返回值:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-freeInstall.md b/zh-cn/application-dev/reference/apis/js-apis-freeInstall.md index b5b7d4ac44a91d873c07827c3cd0e9b6dd4541e2..82865a328dca54530c4e2bd1af0725ac909369ff 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-freeInstall.md +++ b/zh-cn/application-dev/reference/apis/js-apis-freeInstall.md @@ -299,7 +299,7 @@ try { getBundlePackInfo(bundleName: string, bundlePackFlag : BundlePackFlag): Promise\; -基于bundleName和bundleFlag来获取bundlePackInfo。使用Promise异步回调。 +基于bundleName和BundlePackFlag来获取bundlePackInfo。使用Promise异步回调。 **系统接口:** 此接口为系统接口。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-geoLocationManager.md b/zh-cn/application-dev/reference/apis/js-apis-geoLocationManager.md index 9de4f4b835bdf90523da4838d0ddaade3112884d..4fed31bc7e47b856011d64ba9679245080154ab2 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-geoLocationManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-geoLocationManager.md @@ -662,7 +662,7 @@ on(type: 'nmeaMessage', callback: Callback<string>): void; 订阅GNSS NMEA信息上报事件。 -**需要权限**:ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION +**需要权限**:ohos.permission.LOCATION 和 ohos.permission.APPROXIMATELY_LOCATION **系统能力**:SystemCapability.Location.Location.Gnss @@ -705,7 +705,7 @@ off(type: 'nmeaMessage', callback?: Callback<string>): void; 取消订阅GNSS NMEA信息上报事件。 -**需要权限**:ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION +**需要权限**:ohos.permission.LOCATION 和 ohos.permission.APPROXIMATELY_LOCATION **系统能力**:SystemCapability.Location.Location.Gnss @@ -882,7 +882,6 @@ on(type: 'countryCodeChange', callback: Callback<CountryCode>): void; | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | |3301000 | Location service is unavailable. | -|3301100 | The location switch is off. | |3301500 | Failed to query the area information. | @@ -924,7 +923,6 @@ off(type: 'countryCodeChange', callback?: Callback<CountryCode>): void; | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | |3301000 | Location service is unavailable. | -|3301100 | The location switch is off. | |3301500 | Failed to query the area information. | **示例** diff --git a/zh-cn/application-dev/reference/apis/js-apis-geolocation.md b/zh-cn/application-dev/reference/apis/js-apis-geolocation.md index bed48f3ffc6401166c69140a567cfaa5b258743d..1e7eccc4c18451a0c1521c7d0b47c344e586d8fd 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-geolocation.md +++ b/zh-cn/application-dev/reference/apis/js-apis-geolocation.md @@ -1,4 +1,4 @@ -# 位置服务 +# @ohos.geolocation (位置服务) 位置服务提供GNSS定位、网络定位、地理编码、逆地理编码、国家码和地理围栏等基本功能。 @@ -1486,7 +1486,7 @@ GNSS围栏的配置参数。目前只支持圆形围栏。 位置服务中的错误码信息。 > **说明:**
-> 从API version 9开始废弃。 +> 从API version 9开始废弃,建议使用[位置服务子系统错误码](../errorcodes/errorcode-geoLocationManager.md)替代。 **需要权限**:ohos.permission.LOCATION diff --git a/zh-cn/application-dev/reference/apis/js-apis-hashmap.md b/zh-cn/application-dev/reference/apis/js-apis-hashmap.md index caf15684fdf99d8ca47b23e532811ae492a52989..6a92f196697fa2f5cdef70e93fa32152abba9141 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-hashmap.md +++ b/zh-cn/application-dev/reference/apis/js-apis-hashmap.md @@ -119,9 +119,8 @@ hasKey(key: K): boolean ```ts let hashMap = new HashMap(); -let result = hashMap.hasKey("squirrel"); hashMap.set("squirrel", 123); -let result1 = hashMap.hasKey("squirrel"); +let result = hashMap.hasKey("squirrel"); ``` @@ -157,9 +156,8 @@ hasValue(value: V): boolean ```ts let hashMap = new HashMap(); -let result = hashMap.hasValue(123); hashMap.set("squirrel", 123); -let result1 = hashMap.hasValue(123); +let result = hashMap.hasValue(123); ``` @@ -230,6 +228,7 @@ let hashMap = new HashMap(); hashMap.set("squirrel", 123); hashMap.set("sparrow", 356); let newHashMap = new HashMap(); +newHashMap.set("newMap", 99); hashMap.setAll(newHashMap); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-hashset.md b/zh-cn/application-dev/reference/apis/js-apis-hashset.md index 36fed1ef17a3ffb0dd2b39d4f04a209650e7e88c..b60726627ddc7563fa9ded2e752919ecfb4d0a02 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-hashset.md +++ b/zh-cn/application-dev/reference/apis/js-apis-hashset.md @@ -1,16 +1,18 @@ # @ohos.util.HashSet (非线性容器HashSet) -> **说明:** -> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 - HashSet基于[HashMap](js-apis-hashmap.md)实现。在HashSet中,只对value对象进行处理。 HashSet和[TreeSet](js-apis-treeset.md)相比,HashSet中的数据无序存放,即存放元素的顺序和取出的顺序不一致,而TreeSet是有序存放。它们集合中的元素都不允许重复,但HashSet允许放入null值,TreeSet不允许。 **推荐使用场景:** 可以利用HashSet不重复的特性,当需要不重复的集合或需要去重某个集合的时候使用。 -文档中存在泛型的使用,涉及以下泛型标记符:
-- T: Type, 类 +文档中存在泛型的使用,涉及以下泛型标记符:
+- T:Type,类 + +> **说明:** +> +> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + ## 导入模块 @@ -125,9 +127,8 @@ has(value: T): boolean ```ts let hashSet = new HashSet(); -let result = hashSet.has("squirrel"); hashSet.add("squirrel"); -let result1 = hashSet.has("squirrel"); +let result = hashSet.has("squirrel"); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-hiappevent.md b/zh-cn/application-dev/reference/apis/js-apis-hiappevent.md index 394a61c58f2034dd2e818c1a8561a6b12ec22496..5887ffaecdfd82e17bec2a2d38cf614db67fe11f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-hiappevent.md +++ b/zh-cn/application-dev/reference/apis/js-apis-hiappevent.md @@ -31,9 +31,10 @@ import hiAppEvent from '@ohos.hiAppEvent'; 事件参数为object类型,key为事件的参数名称,value为事件的参数值,其规格定义如下: - 参数名为string类型,字符串非空且长度在16个字符以内,有效的字符是0-9、a-z、下划线,只能以小写字母开头,不能以下划线结尾; -- 参数值支持string、number、boolean、Array类型; -- 参数值为string类型时,其长度需在8*1024个字符以内,超出会做截断处理; -- 参数值为Array类型时,Array中的元素类型只能全为string、number、boolean中的一种,且元素个数需在100以内,超出会做丢弃处理; +- 参数值支持string、number、boolean、数组类型; +- 参数值为string类型时,其长度需在8*1024个字符以内,超出会做丢弃处理; +- 参数值为number类型时,其取值需在Number.MIN_SAFE_INTEGER~Number.MAX_SAFE_INTEGER范围内,超出可能会产生不确定值; +- 参数值为数组类型时,数组中的元素类型只能全为string、number、boolean中的一种,且元素个数需在100以内,超出会做丢弃处理; - 参数个数需在32以内,超出的参数会做丢弃处理。 **事件回调** diff --git a/zh-cn/application-dev/reference/apis/js-apis-hichecker.md b/zh-cn/application-dev/reference/apis/js-apis-hichecker.md index b66101c41937973184db2f07fdbb06184173d37e..74cd7a0da311b6683b10fdb273047b376374cc71 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-hichecker.md +++ b/zh-cn/application-dev/reference/apis/js-apis-hichecker.md @@ -122,7 +122,9 @@ try { addRule(rule: bigint): void -> **说明:** 从 API Version 9 开始废弃,建议使用[hichecker.addCheckRule](#hicheckeraddcheckrule9)替代。 +> **说明:** +> +> 从 API Version 9 开始废弃,建议使用[hichecker.addCheckRule](#hicheckeraddcheckrule9)替代。 添加一条或多条规则到系统,系统根据添加的规则进行检测或反馈。 @@ -149,7 +151,9 @@ hichecker.addRule( removeRule(rule: bigint): void -> **说明:** 从 API Version 9 开始废弃,建议使用[hichecker.removeCheckRule](#hicheckerremovecheckrule9)替代。 +> **说明:** +> +> 从 API Version 9 开始废弃,建议使用[hichecker.removeCheckRule](#hicheckerremovecheckrule9)替代。 删除一条或多条规则,删除的规则后续将不再生效。 @@ -200,7 +204,9 @@ hichecker.getRule(); // return 1n; contains(rule: bigint): boolean -> **说明:** 从 API Version 9 开始废弃,建议使用[hichecker.containsCheckRule](#hicheckercontainscheckrule9)替代。 +> **说明:** +> +> 从 API Version 9 开始废弃,建议使用[hichecker.containsCheckRule](#hicheckercontainscheckrule9)替代。 当前已添加的规则集中是否包含了某一个特定的规则,如果传入的规则级别为线程级别,则仅在当前线程中进行查询。 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 66306729dc0da5f124d69eb0f9865c17b4259048..6e0ff9955904669d81a26636da37297d77821c13 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-hidebug.md +++ b/zh-cn/application-dev/reference/apis/js-apis-hidebug.md @@ -19,8 +19,6 @@ getNativeHeapSize(): bigint 获取本应用堆内存的总大小。 -本接口在OpenHarmony 3.1 Release版本仅为接口定义,暂不支持使用。 - **系统能力:** SystemCapability.HiviewDFX.HiProfiler.HiDebug **返回值:** @@ -29,21 +27,17 @@ getNativeHeapSize(): bigint | ------ | --------------------------- | | bigint | 返回本应用堆内存总大小,单位为kB。 | - **示例:** ```js let nativeHeapSize = hidebug.getNativeHeapSize(); ``` - ## hidebug.getNativeHeapAllocatedSize getNativeHeapAllocatedSize(): bigint 获取本应用堆内存的已分配内存大小。 -本接口在OpenHarmony 3.1 Release版本仅为接口定义,暂不支持使用。 - **系统能力:** SystemCapability.HiviewDFX.HiProfiler.HiDebug **返回值:** @@ -58,15 +52,12 @@ getNativeHeapAllocatedSize(): bigint let nativeHeapAllocatedSize = hidebug.getNativeHeapAllocatedSize(); ``` - ## hidebug.getNativeHeapFreeSize getNativeHeapFreeSize(): bigint 获取本应用堆内存的空闲内存大小。 -本接口在OpenHarmony 3.1 Release版本仅为接口定义,暂不支持使用。 - **系统能力:** SystemCapability.HiviewDFX.HiProfiler.HiDebug **返回值:** @@ -80,7 +71,6 @@ getNativeHeapFreeSize(): bigint let nativeHeapFreeSize = hidebug.getNativeHeapFreeSize(); ``` - ## hidebug.getPss getPss(): bigint @@ -100,7 +90,6 @@ getPss(): bigint let pss = hidebug.getPss(); ``` - ## hidebug.getSharedDirty getSharedDirty(): bigint @@ -135,7 +124,6 @@ getPrivateDirty(): bigint | ------ | -------------------------- | | bigint | 返回进程的私有脏内存大小,单位为kB。 | - **示例:** ```js let privateDirty = hidebug.getPrivateDirty(); @@ -163,76 +151,6 @@ getCpuUsage(): number let cpuUsage = hidebug.getCpuUsage(); ``` -## hidebug.startProfiling(deprecated) - -startProfiling(filename : string) : void - -> **说明:** 从 API Version 9 开始废弃,建议使用[hidebug.startJsCpuProfiling](#hidebugstartjscpuprofiling9)替代。 - -启动虚拟机Profiling方法跟踪,`startProfiling()`方法的调用需要与`stopProfiling()`方法的调用一一对应,先开启后关闭,严禁使用`start->start->stop`,`start->stop->stop`,`start->start->stop->stop`等类似的顺序调用。 - -**系统能力:** SystemCapability.HiviewDFX.HiProfiler.HiDebug - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------ | ---- | ------------------------------------------------------------ | -| filename | string | 是 | 用户自定义的profiling文件名,根据传入的`filename`,将在应用的`files`目录生成`filename.json`文件。 | - -**示例:** - -```js -hidebug.startProfiling("cpuprofiler-20220216"); -// code block -// ... -// code block -hidebug.stopProfiling(); -``` - - - -## hidebug.stopProfiling(deprecated) - -stopProfiling() : void - -> **说明:** 从 API Version 9 开始废弃,建议使用[hidebug.stopJsCpuProfiling](#hidebugstopjscpuprofiling9)替代。 - -停止虚拟机Profiling方法跟踪,`stopProfiling()`方法的调用需要与`startProfiling()`方法的调用一一对应,先开启后关闭,严禁使用`start->start->stop`,`start->stop->stop`,`start->start->stop->stop`等类似的顺序调用。 - -**系统能力:** SystemCapability.HiviewDFX.HiProfiler.HiDebug - -**示例:** - -```js -hidebug.startProfiling("cpuprofiler-20220216"); -// code block -// ... -// code block -hidebug.stopProfiling(); -``` - -## hidebug.dumpHeapData(deprecated) - -dumpHeapData(filename : string) : void - -> **说明:** 从 API Version 9 开始废弃,建议使用[hidebug.dumpJsHeapData](#hidebugdumpjsheapdata9)替代。 - -虚拟机堆导出。 - -**系统能力:** SystemCapability.HiviewDFX.HiProfiler.HiDebug - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------ | ---- | ------------------------------------------------------------ | -| filename | string | 是 | 用户自定义的虚拟机堆文件名,根据传入的`filename`,将在应用的`files`目录生成`filename.heapsnapshot`文件。 | - -**示例:** - -```js -hidebug.dumpHeapData("heap-20220216"); -``` - ## hidebug.getServiceDump9+ getServiceDump(serviceid : number, fd : number, args : Array\) : void @@ -255,7 +173,7 @@ getServiceDump(serviceid : number, fd : number, args : Array\) : void **示例:** ```js -import fileio from '@ohos.fileio' +import fs from '@ohos.file.fs' import hidebug from '@ohos.hidebug' import featureAbility from '@ohos.ability.featureAbility' @@ -263,7 +181,7 @@ let context = featureAbility.getContext(); context.getFilesDir().then((data) => { var path = data + "/serviceInfo.txt" console.info("output path: " + path) - let fd = fileio.openSync(path, 0o102, 0o666) + let fd = fs.openSync(path, 0o102, 0o666) var serviceId = 10 var args = new Array("allInfo") try { @@ -272,7 +190,7 @@ context.getFilesDir().then((data) => { console.info(error.code) console.info(error.message) } - fileio.closeSync(fd); + fs.closeSync(fd); }) ``` @@ -359,4 +277,72 @@ try { console.info(error.code) console.info(error.message) } -``` \ No newline at end of file +``` + +## hidebug.startProfiling(deprecated) + +startProfiling(filename : string) : void + +> **说明:** 从 API Version 9 开始废弃,建议使用[hidebug.startJsCpuProfiling](#hidebugstartjscpuprofiling9)替代。 + +启动虚拟机Profiling方法跟踪,`startProfiling()`方法的调用需要与`stopProfiling()`方法的调用一一对应,先开启后关闭,严禁使用`start->start->stop`,`start->stop->stop`,`start->start->stop->stop`等类似的顺序调用。 + +**系统能力:** SystemCapability.HiviewDFX.HiProfiler.HiDebug + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ------------------------------------------------------------ | +| filename | string | 是 | 用户自定义的profiling文件名,根据传入的`filename`,将在应用的`files`目录生成`filename.json`文件。 | + +**示例:** + +```js +hidebug.startProfiling("cpuprofiler-20220216"); +// code block +// ... +// code block +hidebug.stopProfiling(); +``` + +## hidebug.stopProfiling(deprecated) + +stopProfiling() : void + +> **说明:** 从 API Version 9 开始废弃,建议使用[hidebug.stopJsCpuProfiling](#hidebugstopjscpuprofiling9)替代。 + +停止虚拟机Profiling方法跟踪,`stopProfiling()`方法的调用需要与`startProfiling()`方法的调用一一对应,先开启后关闭,严禁使用`start->start->stop`,`start->stop->stop`,`start->start->stop->stop`等类似的顺序调用。 + +**系统能力:** SystemCapability.HiviewDFX.HiProfiler.HiDebug + +**示例:** + +```js +hidebug.startProfiling("cpuprofiler-20220216"); +// code block +// ... +// code block +hidebug.stopProfiling(); +``` + +## hidebug.dumpHeapData(deprecated) + +dumpHeapData(filename : string) : void + +> **说明:** 从 API Version 9 开始废弃,建议使用[hidebug.dumpJsHeapData](#hidebugdumpjsheapdata9)替代。 + +虚拟机堆导出。 + +**系统能力:** SystemCapability.HiviewDFX.HiProfiler.HiDebug + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ------------------------------------------------------------ | +| filename | string | 是 | 用户自定义的虚拟机堆文件名,根据传入的`filename`,将在应用的`files`目录生成`filename.heapsnapshot`文件。 | + +**示例:** + +```js +hidebug.dumpHeapData("heap-20220216"); +``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-hiviewdfx-hiappevent.md b/zh-cn/application-dev/reference/apis/js-apis-hiviewdfx-hiappevent.md index f8ce582776b930ad6a65a0cb54a082e00c2120f6..2c41ccc0392e70edb1e2d0c40870bf1cbbdeee6b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-hiviewdfx-hiappevent.md +++ b/zh-cn/application-dev/reference/apis/js-apis-hiviewdfx-hiappevent.md @@ -120,12 +120,12 @@ hiAppEvent.write({ **系统能力:** SystemCapability.HiviewDFX.HiAppEvent -| 名称 | 类型 | 必填 | 说明 | -| --------- | ----------------------- | ---- | ---------- | -| domain | string | 是 | 事件领域。 | -| name | string | 是 | 事件名称。 | -| eventType | [EventType](#eventtype) | 是 | 事件类型。 | -| params | object | 是 | 事件参数。 | +| 名称 | 类型 | 必填 | 说明 | +| --------- | ----------------------- | ---- | ------------------------------------------------------------ | +| domain | string | 是 | 事件领域。事件领域名称支持数字、小写字母、下划线字符,需要以小写字母开头且不能以下划线结尾,长度非空且不超过32个字符。 | +| name | string | 是 | 事件名称。事件名称支持数字、小写字母、下划线字符,需要以小写字母开头且不能以下划线结尾,长度非空且不超过48个字符。 | +| eventType | [EventType](#eventtype) | 是 | 事件类型。 | +| params | object | 是 | 事件参数对象,每个事件参数包括参数名和参数值,其规格定义如下:
- 参数名为string类型,只支持数字、小写字母、下划线字符,需要以小写字母开头且不能以下划线结尾,长度非空且不超过16个字符。
- 参数值支持string、number、boolean、数组类型,string类型参数长度需在8*1024个字符以内,超出会做丢弃处理;number类型参数取值需在Number.MIN_SAFE_INTEGER~Number.MAX_SAFE_INTEGER范围内,超出可能会产生不确定值;数组类型参数中的元素类型只能全为string、number、boolean中的一种,且元素个数需在100以内,超出会做丢弃处理。
- 参数个数需在32个以内,超出的参数会做丢弃处理。 | ## hiAppEvent.configure diff --git a/zh-cn/application-dev/reference/apis/js-apis-http.md b/zh-cn/application-dev/reference/apis/js-apis-http.md index 1cdf224165953ca89bc5d02298ff045a4f45b23c..ae7c9c8f2efcc79aa1c8e879f035ea0ad1f3242e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-http.md +++ b/zh-cn/application-dev/reference/apis/js-apis-http.md @@ -2,7 +2,7 @@ 本模块提供HTTP数据请求能力。应用可以通过HTTP发起一个数据请求,支持常见的GET、POST、OPTIONS、HEAD、PUT、DELETE、TRACE、CONNECT方法。 ->**说明:** +> **说明:** > >本模块首批接口从API version 6开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > @@ -24,50 +24,50 @@ let httpRequest = http.createHttp(); // 用于订阅HTTP响应头,此接口会比request请求先返回。可以根据业务需要订阅此消息 // 从API 8开始,使用on('headersReceive', Callback)替代on('headerReceive', AsyncCallback)。 8+ httpRequest.on('headersReceive', (header) => { - console.info('header: ' + JSON.stringify(header)); + console.info('header: ' + JSON.stringify(header)); }); httpRequest.request( - // 填写HTTP请求的URL地址,可以带参数也可以不带参数。URL地址需要开发者自定义。请求的参数可以在extraData中指定 - "EXAMPLE_URL", - { - method: http.RequestMethod.POST, // 可选,默认为http.RequestMethod.GET - // 开发者根据自身业务需要添加header字段 - header: { - 'Content-Type': 'application/json' - }, - // 当使用POST请求时此字段用于传递内容 - extraData: { - "data": "data to send", - }, - expectDataType: http.HttpDataType.STRING, // 可选,指定返回数据的类型 - usingCache: true, // 可选,默认为true - priority: 1, // 可选,默认为1 - connectTimeout: 60000, // 可选,默认为60000ms - readTimeout: 60000, // 可选,默认为60000ms - usingProtocol: http.HttpProtocol.HTTP1_1, // 可选,协议类型默认值由系统自动指定 - usingProxy: false, //可选,默认不使用网络代理,自API 10开始支持该属性 - }, (err, data) => { - if (!err) { - // data.result为HTTP响应内容,可根据业务需要进行解析 - console.info('Result:' + JSON.stringify(data.result)); - console.info('code:' + JSON.stringify(data.responseCode)); - // data.header为HTTP响应头,可根据业务需要进行解析 - console.info('header:' + JSON.stringify(data.header)); - console.info('cookies:' + JSON.stringify(data.cookies)); // 8+ - } else { - console.info('error:' + JSON.stringify(err)); - // 取消订阅HTTP响应头事件 - httpRequest.off('headersReceive'); - // 当该请求使用完毕时,调用destroy方法主动销毁。 - httpRequest.destroy(); - } + // 填写HTTP请求的URL地址,可以带参数也可以不带参数。URL地址需要开发者自定义。请求的参数可以在extraData中指定 + "EXAMPLE_URL", + { + method: http.RequestMethod.POST, // 可选,默认为http.RequestMethod.GET + // 开发者根据自身业务需要添加header字段 + header: { + 'Content-Type': 'application/json' + }, + // 当使用POST请求时此字段用于传递内容 + extraData: { + "data": "data to send", + }, + expectDataType: http.HttpDataType.STRING, // 可选,指定返回数据的类型 + usingCache: true, // 可选,默认为true + priority: 1, // 可选,默认为1 + connectTimeout: 60000, // 可选,默认为60000ms + readTimeout: 60000, // 可选,默认为60000ms + usingProtocol: http.HttpProtocol.HTTP1_1, // 可选,协议类型默认值由系统自动指定 + usingProxy: false, //可选,默认不使用网络代理,自API 10开始支持该属性 + }, (err, data) => { + if (!err) { + // data.result为HTTP响应内容,可根据业务需要进行解析 + console.info('Result:' + JSON.stringify(data.result)); + console.info('code:' + JSON.stringify(data.responseCode)); + // data.header为HTTP响应头,可根据业务需要进行解析 + console.info('header:' + JSON.stringify(data.header)); + console.info('cookies:' + JSON.stringify(data.cookies)); // 8+ + } else { + console.info('error:' + JSON.stringify(err)); + // 取消订阅HTTP响应头事件 + httpRequest.off('headersReceive'); + // 当该请求使用完毕时,调用destroy方法主动销毁。 + httpRequest.destroy(); } + } ); ``` ## http.createHttp -createHttp\(\): HttpRequest +createHttp(): HttpRequest 创建一个HTTP请求,里面包括发起请求、中断请求、订阅/取消订阅HTTP Response Header事件。每一个HttpRequest对象对应一个HTTP请求。如需发起多个HTTP请求,须为每个HTTP请求创建对应HttpRequest对象。 @@ -77,25 +77,29 @@ createHttp\(\): HttpRequest | 类型 | 说明 | | :---------- | :----------------------------------------------------------- | -| HttpRequest | 返回一个HttpRequest对象,里面包括request、destroy、on和off方法。 | +| HttpRequest | 返回一个HttpRequest对象,里面包括request、request2、destroy、on和off方法。 | **示例:** ```js import http from '@ohos.net.http'; + let httpRequest = http.createHttp(); ``` ## HttpRequest -HTTP请求任务。在调用HttpRequest的方法前,需要先通过[createHttp\(\)](#httpcreatehttp)创建一个任务。 +HTTP请求任务。在调用HttpRequest的方法前,需要先通过[createHttp()](#httpcreatehttp)创建一个任务。 ### request -request\(url: string, callback: AsyncCallback\\):void +request(url: string, callback: AsyncCallback\):void 根据URL地址,发起HTTP网络请求,使用callback方式作为异步方法。 +> **说明:** +> 此接口仅支持数据大小为5M以内的数据传输。 + **需要权限**:ohos.permission.INTERNET **系统能力**:SystemCapability.Communication.NetStack @@ -119,7 +123,7 @@ request\(url: string, callback: AsyncCallback\\):void | 2300052 | Server returned nothing (no headers, no data). | | 2300999 | Unknown Other Error. | ->**错误码说明:** +> **错误码说明:** > 以上错误码的详细介绍参见[HTTP错误码](../errorcodes/errorcode-net-http.md)。 > HTTP 错误码映射关系:2300000 + curl错误码。更多常用错误码,可参考:[curl错误码](https://curl.se/libcurl/c/libcurl-errors.html) @@ -127,23 +131,26 @@ request\(url: string, callback: AsyncCallback\\):void ```js httpRequest.request("EXAMPLE_URL", (err, data) => { - if (!err) { - console.info('Result:' + data.result); - console.info('code:' + data.responseCode); - console.info('header:' + JSON.stringify(data.header)); - console.info('cookies:' + data.cookies); // 8+ - } else { - console.info('error:' + JSON.stringify(err)); - } + if (!err) { + console.info('Result:' + data.result); + console.info('code:' + data.responseCode); + console.info('header:' + JSON.stringify(data.header)); + console.info('cookies:' + data.cookies); // 8+ + } else { + console.info('error:' + JSON.stringify(err)); + } }); ``` ### request -request\(url: string, options: HttpRequestOptions, callback: AsyncCallback\\):void +request(url: string, options: HttpRequestOptions, callback: AsyncCallback\):void 根据URL地址和相关配置项,发起HTTP网络请求,使用callback方式作为异步方法。 +> **说明:** +> 此接口仅支持数据大小为5M以内的数据传输。 + **需要权限**:ohos.permission.INTERNET **系统能力**:SystemCapability.Communication.NetStack @@ -192,7 +199,7 @@ request\(url: string, options: HttpRequestOptions, callback: AsyncCallback\**错误码说明:** +> **错误码说明:** > 以上错误码的详细介绍参见[HTTP错误码](../errorcodes/errorcode-net-http.md)。 > HTTP 错误码映射关系:2300000 + curl错误码。更多常用错误码,可参考:[curl错误码](https://curl.se/libcurl/c/libcurl-errors.html) @@ -200,33 +207,36 @@ request\(url: string, options: HttpRequestOptions, callback: AsyncCallback\ { + }, (err, data) => { if (!err) { - console.info('Result:' + data.result); - console.info('code:' + data.responseCode); - console.info('header:' + JSON.stringify(data.header)); - console.info('cookies:' + data.cookies); // 8+ - console.info('header.Content-Type:' + data.header['Content-Type']); - console.info('header.Status-Line:' + data.header['Status-Line']); + console.info('Result:' + data.result); + console.info('code:' + data.responseCode); + console.info('header:' + JSON.stringify(data.header)); + console.info('cookies:' + data.cookies); // 8+ + console.info('header.Content-Type:' + data.header['Content-Type']); + console.info('header.Status-Line:' + data.header['Status-Line']); } else { - console.info('error:' + JSON.stringify(err)); + console.info('error:' + JSON.stringify(err)); } -}); + }); ``` ### request -request\(url: string, options? : HttpRequestOptions\): Promise\ +request(url: string, options? : HttpRequestOptions): Promise\ 根据URL地址,发起HTTP网络请求,使用Promise方式作为异步方法。 +> **说明:** +> 此接口仅支持数据大小为5M以内的数据传输。 + **需要权限**:ohos.permission.INTERNET **系统能力**:SystemCapability.Communication.NetStack @@ -280,36 +290,36 @@ request\(url: string, options? : HttpRequestOptions\): Promise\ | 2300094 | An authentication function returned an error. | | 2300999 | Unknown Other Error. | ->**错误码说明:** +> **错误码说明:** > 以上错误码的详细介绍参见[HTTP错误码](../errorcodes/errorcode-net-http.md)。 -> HTTP 错误码映射关系:2300000 + curl错误码。更多常用错误码,可参考:[curl错误码](https://curl.se/libcurl/c/libcurl-errors.html) +> HTTP 错误码映射关系:2300000 + curl错误码。更多常用错误码,可参考:[curl错误码](https://curl.se/libcurl/c/libcurl-errors.html) **示例:** ```js let promise = httpRequest.request("EXAMPLE_URL", { - method: http.RequestMethod.GET, - connectTimeout: 60000, - readTimeout: 60000, - header: { - 'Content-Type': 'application/json' - } + method: http.RequestMethod.GET, + connectTimeout: 60000, + readTimeout: 60000, + header: { + 'Content-Type': 'application/json' + } }); promise.then((data) => { - console.info('Result:' + data.result); - console.info('code:' + data.responseCode); - console.info('header:' + JSON.stringify(data.header)); - console.info('cookies:' + data.cookies); // 8+ - console.info('header.Content-Type:' + data.header['Content-Type']); - console.info('header.Status-Line:' + data.header['Status-Line']); + console.info('Result:' + data.result); + console.info('code:' + data.responseCode); + console.info('header:' + JSON.stringify(data.header)); + console.info('cookies:' + data.cookies); // 8+ + console.info('header.Content-Type:' + data.header['Content-Type']); + console.info('header.Status-Line:' + data.header['Status-Line']); }).catch((err) => { - console.info('error:' + JSON.stringify(err)); + console.info('error:' + JSON.stringify(err)); }); ``` ### destroy -destroy\(\): void +destroy(): void 中断请求任务。 @@ -323,9 +333,9 @@ httpRequest.destroy(); ### request210+ -request2(url: string, callback: AsyncCallback): void +request2(url: string, callback: AsyncCallback\): void -根据URL地址和相关配置项,发起HTTP网络请求并返回流式响应,使用callback方式作为异步方法。 +根据URL地址,发起HTTP网络请求并返回流式响应,使用callback方式作为异步方法。 **需要权限**:ohos.permission.INTERNET @@ -336,7 +346,7 @@ request2(url: string, callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------------------------- | ---- | ----------------------------------------------- | | url | string | 是 | 发起网络请求的URL地址。 | -| callback | AsyncCallback\ | 是 | 回调函数。 | +| callback | AsyncCallback\<[number](#responsecode)\> | 是 | 回调函数。 | **错误码:** @@ -350,25 +360,25 @@ request2(url: string, callback: AsyncCallback): void | 2300052 | Server returned nothing (no headers, no data). | | 2300999 | Unknown Other Error. | ->**错误码说明:** +> **错误码说明:** > 以上错误码的详细介绍参见[HTTP错误码](../errorcodes/errorcode-net-http.md)。 > HTTP 错误码映射关系:2300000 + curl错误码。更多常用错误码,可参考:[curl错误码](https://curl.se/libcurl/c/libcurl-errors.html) **示例:** ```js -httpRequest.request2("EXAMPLE_URL", (err) => { - if (!err) { - console.info(request2 OK!); - } else { - console.info("request2 ERROR : err = " + JSON.stringify(err)); - } +httpRequest.request2("EXAMPLE_URL", (err, data) => { + if (!err) { + console.info("request2 OK! ResponseCode is " + JSON.stringify(data)); + } else { + console.info("request2 ERROR : err = " + JSON.stringify(err)); + } }) ``` ### request210+ -request2(url: string, options: HttpRequestOptions, callback: AsyncCallback): void +request2(url: string, options: HttpRequestOptions, callback: AsyncCallback\): void 根据URL地址和相关配置项,发起HTTP网络请求并返回流式响应,使用callback方式作为异步方法。 @@ -382,7 +392,7 @@ request2(url: string, options: HttpRequestOptions, callback: AsyncCallback | -------- | ---------------------------------------------- | ---- | ----------------------------------------------- | | url | string | 是 | 发起网络请求的URL地址。 | | options | HttpRequestOptions | 是 | 参考[HttpRequestOptions](#httprequestoptions)。 | -| callback | AsyncCallback\ | 是 | 回调函数。 | +| callback | AsyncCallback\<[number](#responsecode)\> | 是 | 回调函数。 | **错误码:** @@ -420,7 +430,7 @@ request2(url: string, options: HttpRequestOptions, callback: AsyncCallback | 2300094 | An authentication function returned an error. | | 2300999 | Unknown Other Error. | ->**错误码说明:** +> **错误码说明:** > 以上错误码的详细介绍参见[HTTP错误码](../errorcodes/errorcode-net-http.md)。 > HTTP 错误码映射关系:2300000 + curl错误码。更多常用错误码,可参考:[curl错误码](https://curl.se/libcurl/c/libcurl-errors.html) @@ -428,24 +438,25 @@ request2(url: string, options: HttpRequestOptions, callback: AsyncCallback ```js httpRequest.request2("EXAMPLE_URL", -{ + { method: http.RequestMethod.GET, header: { - 'Content-Type': 'application/json' + 'Content-Type': 'application/json' }, readTimeout: 60000, connectTimeout: 60000 -}, (err) => { + }, (err, data) => { if (!err) { - console.info(request2 OK!); + console.info("request2 OK! ResponseCode is " + JSON.stringify(data)); } else { - console.info("request2 ERROR : err = " + JSON.stringify(err)); + console.info("request2 ERROR : err = " + JSON.stringify(err)); } -}) + }) ``` + ### request210+ -request2\(url: string, options? : HttpRequestOptions\): Promise\ +request2(url: string, options? : HttpRequestOptions): Promise\ 根据URL地址,发起HTTP网络请求并返回流式响应,使用Promise方式作为异步方法。 @@ -464,7 +475,7 @@ request2\(url: string, options? : HttpRequestOptions\): Promise\ | 类型 | 说明 | | :------------------------------------- | :-------------------------------- | -| Promise\ | 以Promise形式返回发起请求的结果。 | +| Promise\<[number](#responsecode)\> | 以Promise形式返回发起请求的结果。 | **错误码:** @@ -502,36 +513,36 @@ request2\(url: string, options? : HttpRequestOptions\): Promise\ | 2300094 | An authentication function returned an error. | | 2300999 | Unknown Other Error. | ->**错误码说明:** +> **错误码说明:** > 以上错误码的详细介绍参见[HTTP错误码](../errorcodes/errorcode-net-http.md)。 > HTTP 错误码映射关系:2300000 + curl错误码。更多常用错误码,可参考: **示例:** ```js -let promise = httpRequest.request("EXAMPLE_URL", { - method: http.RequestMethod.GET, - connectTimeout: 60000, - readTimeout: 60000, - header: { - 'Content-Type': 'application/json' - } +let promise = httpRequest.request2("EXAMPLE_URL", { + method: http.RequestMethod.GET, + connectTimeout: 60000, + readTimeout: 60000, + header: { + 'Content-Type': 'application/json' + } }); -promise.then(() => { - console.info(request2 OK!); +promise.then((data) => { + console.info("request2 OK!" + JSON.stringify(data)); }).catch((err) => { - console.info("request2 ERROR : err = " + JSON.stringify(err)); + console.info("request2 ERROR : err = " + JSON.stringify(err)); }); ``` -### on\('headerReceive'\) +### on('headerReceive') -on\(type: 'headerReceive', callback: AsyncCallback\): void +on(type: 'headerReceive', callback: AsyncCallback\): void 订阅HTTP Response Header 事件。 ->![](public_sys-resources/icon-note.gif) **说明:** ->此接口已废弃,建议使用[on\('headersReceive'\)8+](#onheadersreceive8)替代。 +> **说明:** +> 此接口已废弃,建议使用[on('headersReceive')8+](#onheadersreceive8)替代。 **系统能力**:SystemCapability.Communication.NetStack @@ -545,24 +556,20 @@ on\(type: 'headerReceive', callback: AsyncCallback\): void **示例:** ```js -httpRequest.on('headerReceive', (err, data) => { - if (!err) { - console.info('header: ' + JSON.stringify(data)); - } else { - console.info('error:' + JSON.stringify(err)); - } +httpRequest.on('headerReceive', (data) => { + console.info('error:' + JSON.stringify(data)); }); ``` -### off\('headerReceive'\) +### off('headerReceive') -off\(type: 'headerReceive', callback?: AsyncCallback\): void +off(type: 'headerReceive', callback?: AsyncCallback\): void 取消订阅HTTP Response Header 事件。 ->![](public_sys-resources/icon-note.gif) **说明:** +> **说明:** > ->1. 此接口已废弃,建议使用[off\('headersReceive'\)8+](#offheadersreceive8)替代。 +>1. 此接口已废弃,建议使用[off('headersReceive')8+](#offheadersreceive8)替代。 > >2. 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 @@ -581,9 +588,9 @@ off\(type: 'headerReceive', callback?: AsyncCallback\): void httpRequest.off('headerReceive'); ``` -### on\('headersReceive'\)8+ +### on('headersReceive')8+ -on\(type: 'headersReceive', callback: Callback\): void +on(type: 'headersReceive', callback: Callback\): void 订阅HTTP Response Header 事件。 @@ -600,18 +607,18 @@ on\(type: 'headersReceive', callback: Callback\): void ```js httpRequest.on('headersReceive', (header) => { - console.info('header: ' + JSON.stringify(header)); + console.info('header: ' + JSON.stringify(header)); }); ``` -### off\('headersReceive'\)8+ +### off('headersReceive')8+ -off\(type: 'headersReceive', callback?: Callback\): void +off(type: 'headersReceive', callback?: Callback\): void 取消订阅HTTP Response Header 事件。 ->![](public_sys-resources/icon-note.gif) **说明:** ->可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 +> **说明:** +> 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 **系统能力**:SystemCapability.Communication.NetStack @@ -628,9 +635,9 @@ off\(type: 'headersReceive', callback?: Callback\): void httpRequest.off('headersReceive'); ``` -### once\('headersReceive'\)8+ +### once('headersReceive')8+ -once\(type: 'headersReceive', callback: Callback\): void +once(type: 'headersReceive', callback: Callback\): void 订阅HTTP Response Header 事件,但是只触发一次。一旦触发之后,订阅器就会被移除。使用callback方式作为异步方法。 @@ -647,12 +654,13 @@ once\(type: 'headersReceive', callback: Callback\): void ```js httpRequest.once('headersReceive', (header) => { - console.info('header: ' + JSON.stringify(header)); + console.info('header: ' + JSON.stringify(header)); }); ``` -### on\('dataReceive'\)10+ -on\(type: 'dataReceive', callback: Callback\\): void +### on('dataReceive')10+ + +on(type: 'dataReceive', callback: Callback\): void 订阅HTTP流式响应数据接收事件。 @@ -669,18 +677,18 @@ on\(type: 'dataReceive', callback: Callback\\): void ```js httpRequest.on('dataReceive', (data) => { - console.info('dataReceive length: ' + JSON.stringify(data.byteLength)); + console.info('dataReceive length: ' + JSON.stringify(data.byteLength)); }); ``` -### off\('dataReceive'\)10+ +### off('dataReceive')10+ -off\(type: 'dataReceive', callback?: Callback\\): void +off(type: 'dataReceive', callback?: Callback\): void 取消订阅HTTP流式响应数据接收事件。 ->![](public_sys-resources/icon-note.gif) **说明:** ->可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 +> **说明:** +> 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 **系统能力**:SystemCapability.Communication.NetStack @@ -697,9 +705,9 @@ off\(type: 'dataReceive', callback?: Callback\\): void httpRequest.off('dataReceive'); ``` -### on\('dataEnd'\)10+ +### on('dataEnd')10+ -on\(type: 'dataEnd', callback: Callback\\): void +on(type: 'dataEnd', callback: Callback\): void 订阅HTTP流式响应数据接收完毕事件。 @@ -715,19 +723,19 @@ on\(type: 'dataEnd', callback: Callback\\): void **示例:** ```js -httpRequest.on('dataReceive', () => { - console.info('Receive dataEnd!'); +httpRequest.on('dataEnd', () => { + console.info('Receive dataEnd !'); }); ``` -### off\('dataEnd'\)10+ +### off('dataEnd')10+ off(type: 'dataEnd', callback?: Callback\): void 取消订阅HTTP流式响应数据接收完毕事件。 ->![](public_sys-resources/icon-note.gif) **说明:** ->可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 +> **说明:** +> 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 **系统能力**:SystemCapability.Communication.NetStack @@ -744,9 +752,9 @@ off(type: 'dataEnd', callback?: Callback\): void httpRequest.off('dataEnd'); ``` -### on\('dataProgress'\)10+ +### on('dataProgress')10+ - on\(type: 'dataProgress', callback: Callback\<{ receiveSize: number, totalSize: number }\>\): void +on(type: 'dataProgress', callback: AsyncCallback\<{ receiveSize: number, totalSize: number }\>): void 订阅HTTP流式响应数据接收进度事件。 @@ -757,26 +765,24 @@ httpRequest.off('dataEnd'); | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------- | ---- | --------------------------------- | | type | string | 是 | 订阅的事件类型,'dataProgress'。 | -| callback | AsyncCallback\<{ receiveSize: number, totalSize: number }\> | 是 | 回调函数。 | +| callback | AsyncCallback\<{ receiveSize: number, totalSize: number }\> | 是 | 回调函数。
receiveSize:已接收的数据字节数,totalSize待接收的字节总数 | **示例:** ```js httpRequest.on('dataProgress', (data) => { - if (!err) { - console.info('dataProgress:' + JSON.stringify(data)); - } + console.info('dataProgress:' + JSON.stringify(data)); }); ``` -### off\('dataProgress'\)10+ +### off('dataProgress')10+ off(type: 'dataProgress', callback?: Callback\<{ receiveSize: number, totalSize: number }\>): void 取消订阅HTTP流式响应数据接收进度事件。 ->![](public_sys-resources/icon-note.gif) **说明:** ->可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 +> **说明:** +> 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 **系统能力**:SystemCapability.Communication.NetStack @@ -792,19 +798,20 @@ off(type: 'dataProgress', callback?: Callback\<{ receiveSize: number, totalSize: ```js httpRequest.off('dataProgress'); ``` + ## HttpRequestOptions 发起请求可选参数的类型和取值范围。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetStack。 +**系统能力**:SystemCapability.Communication.NetStack | 名称 | 类型 | 必填 | 说明 | | -------------- | --------------------------------------------- | ---- | ------------------------------------------------------------ | -| method | [RequestMethod](#requestmethod) | 否 | 请求方式。 | -| extraData | string \| Object \| ArrayBuffer6+ | 否 | 发送请求的额外数据。
- 当HTTP请求为POST、PUT等方法时,此字段为HTTP请求的content。
- 当HTTP请求为GET、OPTIONS、DELETE、TRACE、CONNECT等方法时,此字段为HTTP请求的参数补充,参数内容会拼接到URL中进行发送。6+
- 开发者传入string对象,开发者需要自行编码,将编码后的string传入。6+ | -| expectDataType9+ | [HttpDataType](#httpdatatype9) | 否 | 指定返回数据的类型。如果设置了此参数,系统将优先返回指定的类型。 | +| method | [RequestMethod](#requestmethod) | 否 | 请求方式,默认为GET。 | +| extraData | string6+ \| Object6+ \| ArrayBuffer8+ | 否 | 发送请求的额外数据,默认无此字段。
- 当HTTP请求为POST、PUT等方法时,此字段为HTTP请求的content,以UTF-8编码形式作为请求体。6+
- 当HTTP请求为GET、OPTIONS、DELETE、TRACE、CONNECT等方法时,此字段为HTTP请求参数的补充。开发者需传入Encode编码后的string类型参数,Object类型的参数无需预编码,参数内容会拼接到URL中进行发送;ArrayBuffer类型的参数不会做拼接处理。6+ | +| expectDataType9+ | [HttpDataType](#httpdatatype9) | 否 | 指定返回数据的类型,默认无此字段。如果设置了此参数,系统将优先返回指定的类型。 | | usingCache9+ | boolean | 否 | 是否使用缓存,默认为true。 | -| priority9+ | number | 否 | 优先级,范围\[1,1000],默认是1。 | +| priority9+ | number | 否 | 优先级,范围\[0,1000],默认是0。 | | header | Object | 否 | HTTP请求头字段。默认{'Content-Type': 'application/json'}。 | | readTimeout | number | 否 | 读取超时时间。单位为毫秒(ms),默认为60000ms。 | | connectTimeout | number | 否 | 连接超时时间。单位为毫秒(ms),默认为60000ms。 | @@ -815,7 +822,7 @@ httpRequest.off('dataProgress'); HTTP 请求方法。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetStack。 +**系统能力**:SystemCapability.Communication.NetStack | 名称 | 值 | 说明 | | :------ | ------- | :------------------ | @@ -832,7 +839,7 @@ HTTP 请求方法。 发起请求返回的响应码。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetStack。 +**系统能力**:SystemCapability.Communication.NetStack | 名称 | 值 | 说明 | | ----------------- | ---- | ------------------------------------------------------------ | @@ -876,14 +883,14 @@ HTTP 请求方法。 request方法回调函数的返回值类型。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetStack。 +**系统能力**:SystemCapability.Communication.NetStack | 名称 | 类型 | 必填 | 说明 | | -------------------- | -------------------------------------------- | ---- | ------------------------------------------------------------ | -| result | string \| Object \| ArrayBuffer6+ | 是 | HTTP请求根据响应头中Content-type类型返回对应的响应格式内容:
- application/json:返回JSON格式的字符串,如需HTTP响应具体内容,需开发者自行解析
- application/octet-stream:ArrayBuffer
- 其他:string | +| result | string6+ \| Objectdeprecated 8+ \| ArrayBuffer8+ | 是 | HTTP请求根据响应头中Content-type类型返回对应的响应格式内容:
- application/json:返回JSON格式的字符串,如需HTTP响应具体内容,需开发者自行解析
- application/octet-stream:ArrayBuffer
- 其他:string | | resultType9+ | [HttpDataType](#httpdatatype9) | 是 | 返回值类型。 | | responseCode | [ResponseCode](#responsecode) \| number | 是 | 回调函数执行成功时,此字段为[ResponseCode](#responsecode)。若执行失败,错误码将会从AsyncCallback中的err字段返回。 | -| header | Object | 是 | 发起HTTP请求返回来的响应头。当前返回的是JSON格式字符串,如需具体字段内容,需开发者自行解析。常见字段及解析方式如下:
- Content-Type:header['Content-Type'];
- Status-Line:header['Status-Line'];
- Date:header.Date/header['Date'];
- Server:header.Server/header['Server']; | +| header | Object | 是 | 发起HTTP请求返回来的响应头。当前返回的是JSON格式字符串,如需具体字段内容,需开发者自行解析。常见字段及解析方式如下:
- content-type:header['content-type'];
- status-line:header['status-line'];
- date:header.date/header['date'];
- server:header.server/header['server']; | | cookies8+ | string | 是 | 服务器返回的 cookies。 | ## http.createHttpResponseCache9+ @@ -910,16 +917,17 @@ createHttpResponseCache(cacheSize?: number): HttpResponseCache ```js import http from '@ohos.net.http'; + let httpResponseCache = http.createHttpResponseCache(); ``` ## HttpResponseCache9+ -存储HTTP访问请求响应的对象。 +存储HTTP访问请求响应的对象。在调用HttpResponseCache的方法前,需要先通过[createHttpResponseCache()](#httpcreatehttpresponsecache9)创建一个任务。 ### flush9+ -flush(callback: AsyncCallback\): void +flush(callback: AsyncCallback\): void 将缓存中的数据写入文件系统,以便在下一个HTTP请求中访问所有缓存数据,使用callback方式作为异步方法。 @@ -929,7 +937,7 @@ flush(callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------------------- | ---- | ---------- | -| callback | AsyncCallback\ | 是 | 回调函数返回写入结果。 | +| callback | AsyncCallback\ | 是 | 回调函数返回写入结果。 | **示例:** @@ -945,7 +953,7 @@ httpResponseCache.flush(err => { ### flush9+ -flush(): Promise\ +flush(): Promise\ 将缓存中的数据写入文件系统,以便在下一个HTTP请求中访问所有缓存数据,使用Promise方式作为异步方法。 @@ -955,7 +963,7 @@ flush(): Promise\ | 类型 | 说明 | | --------------------------------- | ------------------------------------- | -| Promise\> | 以Promise形式返回写入结果。 | +| Promise\ | 以Promise形式返回写入结果。 | **示例:** @@ -969,7 +977,7 @@ httpResponseCache.flush().then(() => { ### delete9+ -delete(callback: AsyncCallback\): void +delete(callback: AsyncCallback\): void 禁用缓存并删除其中的数据,使用callback方式作为异步方法。 @@ -979,7 +987,7 @@ delete(callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------------------- | ---- | ---------- | -| callback | AsyncCallback\ | 是 | 回调函数返回删除结果。| +| callback | AsyncCallback\ | 是 | 回调函数返回删除结果。| **示例:** @@ -992,9 +1000,10 @@ httpResponseCache.delete(err => { console.info('delete success'); }); ``` + ### delete9+ -delete(): Promise\ +delete(): Promise\ 禁用缓存并删除其中的数据,使用Promise方式作为异步方法。 @@ -1004,7 +1013,7 @@ delete(): Promise\ | 类型 | 说明 | | --------------------------------- | ------------------------------------- | -| Promise\ | 以Promise形式返回删除结果。 | +| Promise\ | 以Promise形式返回删除结果。 | **示例:** @@ -1023,7 +1032,7 @@ http的数据类型。 **系统能力**:SystemCapability.Communication.NetStack | 名称 | 值 | 说明 | -| ------------------ | -- | ----------- | +| ------------------ | -- | ----------- | | STRING | 0 | 字符串类型。 | | OBJECT | 1 | 对象类型。 | | ARRAY_BUFFER | 2 | 二进制数组类型。| diff --git a/zh-cn/application-dev/reference/apis/js-apis-huks.md b/zh-cn/application-dev/reference/apis/js-apis-huks.md index e69ecb237c9c3097bed2036b013531fe27d3d6f6..d43a4d0105efba5b2c84282915114bdb593c614c 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-huks.md +++ b/zh-cn/application-dev/reference/apis/js-apis-huks.md @@ -75,7 +75,7 @@ generateKeyItem(keyAlias: string, options: HuksOptions, callback: AsyncCallback\ | -------- | --------------------------- | ---- | --------------------------------------------- | | keyAlias | string | 是 | 别名。 | | options | [HuksOptions](#huksoptions) | 是 | 用于存放生成key所需TAG。其中密钥使用的算法、密钥用途、密钥长度为必选参数。 | -| callback | AsyncCallback\ | 是 | 回调函数。不返回err值时表示接口使用成功,其他时为错误。 | +| callback | AsyncCallback\ | 是 | 回调函数。未捕获error时代表用户指定别名的密钥生成成功,基于密钥不出TEE原则,此接口不会返回密钥材料内容,若捕获error,则为生成阶段出现异常。 | **示例:** @@ -121,7 +121,7 @@ try { generateKeyItem(keyAlias: string, options: HuksOptions) : Promise\ -生成密钥,使用Promise方式异步返回结果。 +生成密钥,使用Promise方式异步返回结果。基于密钥不出TEE原则,通过promise不会返回密钥材料内容,只用于表示此次调用是否成功。 **系统能力**:SystemCapability.Security.Huks @@ -926,7 +926,7 @@ exportKeyItem(keyAlias: string, options: HuksOptions, callback: AsyncCallback\ | 是 | 回调函数。返回HUKS_SUCCESS时表示接口使用成功,其他时为错误。outData:返回从密钥中导出的公钥。 | +| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | 是 | 回调函数。不返回err值时表示接口使用成功,其他时为错误。outData:返回从密钥中导出的公钥。 | **示例:** @@ -1005,7 +1005,7 @@ getKeyItemProperties(keyAlias: string, options: HuksOptions, callback: AsyncCall | -------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ | | keyAlias | string | 是 | 密钥别名,应与所用密钥生成时使用的别名相同。 | | options | [HuksOptions](#huksoptions) | 是 | 空对象(此处传空即可)。 | -| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | 是 | 回调函数。errorCode:返回HUKS_SUCCESS时表示接口使用成功,其他时为错误。 | +| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | 是 | 回调函数。不返回err值时表示接口使用成功,其他时为错误。properties:返回值为生成密钥时所需参数。 | **示例:** @@ -1084,7 +1084,7 @@ isKeyItemExist(keyAlias: string, options: HuksOptions, callback: AsyncCallback\< | -------- | --------------------------- | ---- | --------------------------------------- | | keyAlias | string | 是 | 所需查找的密钥的别名。 | | options | [HuksOptions](#huksoptions) | 是 | 空对象(此处传空即可)。 | -| callback | AsyncCallback\ | 是 | 回调函数。FALSE代表密钥不存在,TRUE代表密钥存在。 | +| callback | AsyncCallback\ | 是 | 回调函数。若密钥存在,data为true,若密钥不存在,则error中会输出密钥不存在的error code。 | **示例:** @@ -1094,17 +1094,19 @@ let keyAlias = 'keyAlias'; let emptyOptions = { properties: [] }; -try { - huks.isKeyItemExist(keyAlias, emptyOptions, function (error, data) { - if (error) { - console.error(`callback: isKeyItemExist failed, code: ${error.code}, msg: ${error.message}`); - } else { - console.info(`callback: isKeyItemExist success, data = ${JSON.stringify(data)}`); - } - }); -} catch (error) { - console.error(`promise: isKeyItemExist input arg invalid, code: ${error.code}, msg: ${error.message}`); -} +huks.isKeyItemExist(keyAlias, emptyOptions, function (error, data) { + if (data) { + promptAction.showToast({ + message: "keyAlias: " + keyAlias +"is existed!", + duration: 2500, + }) + } else { + promptAction.showToast({ + message: "find key failed,error code: " + error.code + " error msg: " + error.message, + duration: 2500, + }) + } +}); ``` ## huks.isKeyItemExist9+ @@ -1126,7 +1128,7 @@ isKeyItemExist(keyAlias: string, options: HuksOptions) : Promise\ | 类型 | 说明 | | ----------------- | --------------------------------------- | -| Promise\ | Promise对象。FALSE代表密钥不存在,TRUE代表密钥存在。 | +| Promise\ | Promise对象。密钥存在时,可通过then进行密钥存在后的相关处理,若不存在,可通过error处理密钥不存在后的相关业务操作。 | **示例:** @@ -1136,17 +1138,17 @@ let keyAlias = 'keyAlias'; let emptyOptions = { properties: [] }; -try { - huks.isKeyItemExist(keyAlias, emptyOptions) - .then ((data) => { - console.info(`promise: isKeyItemExist success, data = ${JSON.stringify(data)}`); - }) - .catch(error => { - console.error(`promise: isKeyItemExist failed, code: ${error.code}, msg: ${error.message}`); - }); -} catch (error) { - console.error(`promise: isKeyItemExist input arg invalid, code: ${error.code}, msg: ${error.message}`); -} +await huks.isKeyItemExist(keyAlias, emptyOptions).then((data) => { + promptAction.showToast({ + message: "keyAlias: " + keyAlias +"is existed!", + duration: 500, + }) + }).catch((err)=>{ + promptAction.showToast({ + message: "find key failed, error code: " + err.code + " error message: " + err.message, + duration: 6500, + }) + }) ``` ## huks.initSession9+ @@ -1161,9 +1163,9 @@ initSession操作密钥接口,使用Callback回调异步返回结果。huks.in | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------------- | ---- | ---------------------------------------------------- | -| keyAlias | string | 是 | Init操作密钥的别名。 | -| options | [HuksOptions](#huksoptions) | 是 | Init操作的参数集合。 | -| callback | AsyncCallback\<[HuksSessionHandle](#hukssessionhandle9)> | 是 | 回调函数。将Init操作操作返回的handle添加到密钥管理系统的回调。 | +| keyAlias | string | 是 | initSession操作密钥的别名。 | +| options | [HuksOptions](#huksoptions) | 是 | initSession操作的参数集合。 | +| callback | AsyncCallback\<[HuksSessionHandle](#hukssessionhandle9)> | 是 | 回调函数。将initSession操作返回的handle添加到密钥管理系统的回调。 | ## huks.initSession9+ @@ -1177,14 +1179,14 @@ initSession操作密钥接口,使用Promise方式异步返回结果。huks.ini | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------- | ---- | ------------------------------------------------ | -| keyAlias | string | 是 | Init操作密钥的别名。 | -| options | [HuksOptions](#huksoptions) | 是 | Init参数集合。 | +| keyAlias | string | 是 | initSession操作密钥的别名。 | +| options | [HuksOptions](#huksoptions) | 是 | initSession参数集合。 | **返回值**: | 类型 | 说明 | | ----------------------------------- | -------------------------------------------------- | -| Promise\<[HuksSessionHandle](#hukssessionhandle9)> | Promise对象。将Init操作返回的handle添加到密钥管理系统的回调。 | +| Promise\<[HuksSessionHandle](#hukssessionhandle9)> | Promise对象。将initSession操作返回的handle添加到密钥管理系统的回调。 | ## huks.updateSession9+ @@ -1198,9 +1200,9 @@ updateSession操作密钥接口,使用Callback回调异步返回结果。huks. | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------------------------------- | ---- | -------------------------------------------- | -| handle | number | 是 | Update操作的handle。 | -| options | [HuksOptions](#huksoptions) | 是 | Update的参数集合。 | -| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | 是 | 回调函数。将Update操作的结果添加到密钥管理系统的回调。 | +| handle | number | 是 | updateSession操作的handle。 | +| options | [HuksOptions](#huksoptions) | 是 | updateSession的参数集合。 | +| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | 是 | 回调函数。将updateSession操作的结果添加到密钥管理系统的回调。 | ## huks.updateSession9+ @@ -1215,16 +1217,16 @@ updateSession操作密钥接口,使用Callback回调异步返回结果。huks. | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------------------------------- | ---- | -------------------------------------------- | -| handle | number | 是 | Update操作的handle。 | -| options | [HuksOptions](#huksoptions) | 是 | Update操作的参数集合。 | -| token | Uint8Array | 是 | Update操作的token。 | -| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | 是 | 回调函数。将Update操作的结果添加到密钥管理系统的回调。 | +| handle | number | 是 | updateSession操作的handle。 | +| options | [HuksOptions](#huksoptions) | 是 | updateSession操作的参数集合。 | +| token | Uint8Array | 是 | updateSession操作的token。 | +| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | 是 | 回调函数。将updateSession操作的结果添加到密钥管理系统的回调。 | ## huks.updateSession9+ updateSession(handle: number, options: HuksOptions, token?: Uint8Array) : Promise\ -uupdateSession操作密钥接口,使用Promise方式异步返回结果。huks.initSession, huks.updateSession, huks.finishSession为三段式接口,需要一起使用。 +updateSession操作密钥接口,使用Promise方式异步返回结果。huks.initSession, huks.updateSession, huks.finishSession为三段式接口,需要一起使用。 **系统能力**:SystemCapability.Security.Huks @@ -1232,15 +1234,15 @@ uupdateSession操作密钥接口,使用Promise方式异步返回结果。huks. | 参数名 | 类型 | 必填 | 说明 | | ------- | ---------------------------------------------- | ---- | -------------------------------------------- | -| handle | number | 是 | Update操作的handle。 | -| options | [HuksOptions](#huksoptions) | 是 | Update操作的参数集合。 | -| token | Uint8Array | 否 | Update操作的token。 | +| handle | number | 是 | updateSession操作的handle。 | +| options | [HuksOptions](#huksoptions) | 是 | updateSession操作的参数集合。 | +| token | Uint8Array | 否 | updateSession操作的token。 | **返回值**: | 类型 | 说明 | | ----------------------------------- | -------------------------------------------------- | -| Promise<[HuksReturnResult](#huksreturnresult9)> | Promise对象。将Update操作的结果添加到密钥管理系统的回调。 | +| Promise<[HuksReturnResult](#huksreturnresult9)> | Promise对象。将updateSession操作的结果添加到密钥管理系统的回调。 | ## huks.finishSession9+ @@ -1254,10 +1256,10 @@ finishSession操作密钥接口,使用Callback回调异步返回结果。huks. | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------------------------------- | ---- | -------------------------------------------- | -| handle | number | 是 | Finish操作的handle。 | -| options | [HuksOptions](#huksoptions) | 是 | Finish的参数集合。 | -| token | Uint8Array | 是 | Finish操作的token。 | -| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | 是 | 回调函数。将Finish操作的结果添加到密钥管理系统的回调。 | +| handle | number | 是 | finishSession操作的handle。 | +| options | [HuksOptions](#huksoptions) | 是 | finishSession的参数集合。 | +| token | Uint8Array | 是 | finishSession操作的token。 | +| callback | AsyncCallback<[HuksReturnResult](#huksreturnresult9)> | 是 | 回调函数。将finishSession操作的结果添加到密钥管理系统的回调。 | ## huks.finishSession9+ @@ -1271,10 +1273,10 @@ finishSession操作密钥接口,使用Callback回调异步返回结果。huks. | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------------------------------- | ---- | -------------------------------------------- | -| handle | number | 是 | Finish操作的handle。 | -| options | [HuksOptions](#huksoptions) | 是 | Finish的参数集合。 | -| token | Uint8Array | 是 | Finish操作的token。 | -| callback | AsyncCallback\<[HuksReturnResult](#huksreturnresult9)> | 是 | 回调函数。将Finish操作的结果添加到密钥管理系统的回调。 | +| handle | number | 是 | finishSession操作的handle。 | +| options | [HuksOptions](#huksoptions) | 是 | finishSession的参数集合。 | +| token | Uint8Array | 是 | finishSession操作的token。 | +| callback | AsyncCallback\<[HuksReturnResult](#huksreturnresult9)> | 是 | 回调函数。将finishSession操作的结果添加到密钥管理系统的回调。 | ## huks.finishSession9+ @@ -1288,9 +1290,9 @@ finishSession操作密钥接口,使用Promise方式异步返回结果。huks.i | 参数名 | 类型 | 必填 | 说明 | | ------- | ----------------------------------------------- | ---- | ----------------------------------- | -| handle | number | 是 | Finish操作的handle。 | -| options | [HuksOptions](#huksoptions) | 是 | Finish操作的参数集合。 | -| token | Uint8Array | 否 | Finish操作的token。 | +| handle | number | 是 | finishSession操作的handle。 | +| options | [HuksOptions](#huksoptions) | 是 | finishSession操作的参数集合。 | +| token | Uint8Array | 否 | finishSession操作的token。 | **返回值**: @@ -1302,7 +1304,7 @@ finishSession操作密钥接口,使用Promise方式异步返回结果。huks.i abortSession(handle: number, options: HuksOptions, callback: AsyncCallback\) : void -abort操作密钥接口,使用Callback回调异步返回结果 。 +abortSession操作密钥接口,使用Callback回调异步返回结果 。 **系统能力**:SystemCapability.Security.Huks @@ -1310,9 +1312,9 @@ abort操作密钥接口,使用Callback回调异步返回结果 。 | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------- | ---- | ------------------------------------------- | -| handle | number | 是 | Abort操作的handle。 | -| options | [HuksOptions](#huksoptions) | 是 | Abort操作的参数集合。 | -| callback | AsyncCallback\ | 是 | 回调函数。将Abort操作的结果添加到密钥管理系统的回调。 | +| handle | number | 是 | abortSession操作的handle。 | +| options | [HuksOptions](#huksoptions) | 是 | abortSession操作的参数集合。 | +| callback | AsyncCallback\ | 是 | 回调函数。将abortSession操作的结果添加到密钥管理系统的回调。 | **示例:** @@ -1447,7 +1449,7 @@ async function huksAbort() { abortSession(handle: number, options: HuksOptions) : Promise\; -abort操作密钥接口,使用Promise方式异步返回结果。 +abortSession操作密钥接口,使用Promise方式异步返回结果。 **系统能力**:SystemCapability.Security.Huks @@ -1455,14 +1457,14 @@ abort操作密钥接口,使用Promise方式异步返回结果。 | 参数名 | 类型 | 必填 | 说明 | | ------- | --------------------------- | ---- | ------------------------------------------- | -| handle | number | 是 | Abort操作的handle。 | -| options | [HuksOptions](#huksoptions) | 是 | Abort操作的参数集合。 | +| handle | number | 是 | abortSession操作的handle。 | +| options | [HuksOptions](#huksoptions) | 是 | abortSession操作的参数集合。 | **返回值**: | 类型 | 说明 | | ----------------------------------- | -------------------------------------------------- | -| Promise\ | Promise对象。将Abort操作的结果添加到密钥管理系统的回调。 | +| Promise\ | Promise对象。将abortSession操作的结果添加到密钥管理系统的回调。 | **示例:** @@ -1707,7 +1709,7 @@ async function huksAbort() { | HUKS_ECC_KEY_SIZE_384 | 384 | 表示使用ECC算法的密钥长度为384bit。 | | HUKS_ECC_KEY_SIZE_521 | 521 | 表示使用ECC算法的密钥长度为521bit。 | | HUKS_AES_KEY_SIZE_128 | 128 | 表示使用AES算法的密钥长度为128bit。 | -| HUKS_AES_KEY_SIZE_192 | 192 | 表示使用AES算法的密钥长度为196bit。 | +| HUKS_AES_KEY_SIZE_192 | 192 | 表示使用AES算法的密钥长度为192bit。 | | HUKS_AES_KEY_SIZE_256 | 256 | 表示使用AES算法的密钥长度为256bit。 | | HUKS_AES_KEY_SIZE_512 | 512 | 表示使用AES算法的密钥长度为512bit。 | | HUKS_CURVE25519_KEY_SIZE_256 | 256 | 表示使用CURVE25519算法的密钥长度为256bit。 | @@ -1818,9 +1820,9 @@ async function huksAbort() { | 名称 | 值 | 说明 | | ------------------------------- | ---- | ------------------------- | -| HUKS_USER_AUTH_TYPE_FINGERPRINT | 1 | 表示用户认证类型为指纹。 | -| HUKS_USER_AUTH_TYPE_FACE | 2 | 表示用户认证类型为人脸 。 | -| HUKS_USER_AUTH_TYPE_PIN | 4 | 表示用户认证类型为PIN码。 | +| HUKS_USER_AUTH_TYPE_FINGERPRINT | 1 << 0 | 表示用户认证类型为指纹。 | +| HUKS_USER_AUTH_TYPE_FACE | 1 << 1 | 表示用户认证类型为人脸 。 | +| HUKS_USER_AUTH_TYPE_PIN | 1 << 2 | 表示用户认证类型为PIN码。 | ## HuksAuthAccessType9+ @@ -1830,8 +1832,8 @@ async function huksAbort() { | 名称 | 值 | 说明 | | --------------------------------------- | ---- | ------------------------------------------------ | -| HUKS_AUTH_ACCESS_INVALID_CLEAR_PASSWORD | 1 | 表示安全访问控制类型为清除密码后密钥无效。 | -| HUKS_AUTH_ACCESS_INVALID_NEW_BIO_ENROLL | 2 | 表示安全访问控制类型为新录入生物特征后密钥无效。 | +| HUKS_AUTH_ACCESS_INVALID_CLEAR_PASSWORD | 1 << 0 | 表示安全访问控制类型为清除密码后密钥无效。 | +| HUKS_AUTH_ACCESS_INVALID_NEW_BIO_ENROLL | 1 << 1 | 表示安全访问控制类型为新录入生物特征后密钥无效。 | ## HuksChallengeType9+ @@ -1892,7 +1894,7 @@ async function huksAbort() { | 名称 | 值 | 说明 | | -------------------------------------------- | ---------------------------------------- | -------------------------------------- | | HUKS_TAG_INVALID | HuksTagType.HUKS_TAG_TYPE_INVALID \| 0 | 表示非法的Tag。 | -| HUKS_TAG_ALGORITHM | HUKS_TAG_TYPE_UINT \| 1 | 表示算法的Tag。 | +| HUKS_TAG_ALGORITHM | HuksTagType.HUKS_TAG_TYPE_UINT \| 1 | 表示算法的Tag。 | | HUKS_TAG_PURPOSE | HuksTagType.HUKS_TAG_TYPE_UINT \| 2 | 表示密钥用途的Tag。 | | HUKS_TAG_KEY_SIZE | HuksTagType.HUKS_TAG_TYPE_UINT \| 3 | 表示密钥长度的Tag。 | | HUKS_TAG_DIGEST | HuksTagType.HUKS_TAG_TYPE_UINT \| 4 | 表示摘要算法的Tag。 | @@ -1918,16 +1920,16 @@ async function huksAbort() { | HUKS_TAG_DERIVE_KEY_SIZE | HuksTagType.HUKS_TAG_TYPE_UINT \| 24 | 表示派生密钥的大小。 | | HUKS_TAG_IMPORT_KEY_TYPE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 25 | 表示导入的密钥类型。 | | HUKS_TAG_UNWRAP_ALGORITHM_SUITE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 26 | 表示导入加密密钥的套件。 | -| HUKS_TAG_ACTIVE_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 201 | 预留。 | -| HUKS_TAG_ORIGINATION_EXPIRE_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 202 | 预留。 | -| HUKS_TAG_USAGE_EXPIRE_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 203 | 预留。 | -| HUKS_TAG_CREATION_DATETIME | HuksTagType.HUKS_TAG_TYPE_ULONG \| 204 | 预留。 | -| HUKS_TAG_ALL_USERS | ksTagType.HUKS_TAG_TYPE_BOOL \| 301 | 预留。 | -| HUKS_TAG_USER_ID | HuksTagType.HUKS_TAG_TYPE_UINT \| 302 | 预留。 | +| HUKS_TAG_ACTIVE_DATETIME(deprecated) | HuksTagType.HUKS_TAG_TYPE_ULONG \| 201 | 原为证书业务预留字段,当前证书管理已独立,此字段废弃,不再预留。 | +| HUKS_TAG_ORIGINATION_EXPIRE_DATETIME(deprecated) | HuksTagType.HUKS_TAG_TYPE_ULONG \| 202 | 原为证书业务预留字段,当前证书管理已独立,此字段废弃,不再预留。 | +| HUKS_TAG_USAGE_EXPIRE_DATETIME(deprecated) | HuksTagType.HUKS_TAG_TYPE_ULONG \| 203 | 原为证书业务预留字段,当前证书管理已独立,此字段废弃,不再预留。 | +| HUKS_TAG_CREATION_DATETIME(deprecated) | HuksTagType.HUKS_TAG_TYPE_ULONG \| 204 | 原为证书业务预留字段,当前证书管理已独立,此字段废弃,不再预留。 | +| HUKS_TAG_ALL_USERS | HuksTagType.HUKS_TAG_TYPE_BOOL \| 301 | 预留 | +| HUKS_TAG_USER_ID | HuksTagType.HUKS_TAG_TYPE_UINT \| 302 | 表示当前密钥属于哪个userID | | HUKS_TAG_NO_AUTH_REQUIRED | HuksTagType.HUKS_TAG_TYPE_BOOL \| 303 | 预留。 | | HUKS_TAG_USER_AUTH_TYPE | HuksTagType.HUKS_TAG_TYPE_UINT \| 304 | 表示用户认证类型。从[HuksUserAuthType](#huksuserauthtype9)中选择,需要与安全访问控制类型同时设置。支持同时指定两种用户认证类型,如:安全访问控制类型指定为HKS_SECURE_ACCESS_INVALID_NEW_BIO_ENROLL时,密钥访问认证类型可以指定以下三种: HKS_USER_AUTH_TYPE_FACE 、HKS_USER_AUTH_TYPE_FINGERPRINT、HKS_USER_AUTH_TYPE_FACE \| HKS_USER_AUTH_TYPE_FINGERPRINT | -| HUKS_TAG_AUTH_TIMEOUT | HuksTagType.HUKS_TAG_TYPE_UINT \| 305 | 预留。 | -| HUKS_TAG_AUTH_TOKEN | HuksTagType.HUKS_TAG_TYPE_BYTES \| 306 | 预留。 | +| HUKS_TAG_AUTH_TIMEOUT | HuksTagType.HUKS_TAG_TYPE_UINT \| 305 | 表示authtoken单次有效期。 | +| HUKS_TAG_AUTH_TOKEN | HuksTagType.HUKS_TAG_TYPE_BYTES \| 306 | 用于传入authToken的字段 | | HUKS_TAG_KEY_AUTH_ACCESS_TYPE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 307 | 表示安全访问控制类型。从[HuksAuthAccessType](#huksauthaccesstype9)中选择,需要和用户认证类型同时设置。 | | HUKS_TAG_KEY_SECURE_SIGN_TYPE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 308 | 表示生成或导入密钥时,指定该密钥的签名类型。 | | HUKS_TAG_CHALLENGE_TYPE9+ | HuksTagType.HUKS_TAG_TYPE_UINT \| 309 | 表示密钥使用时生成的challenge类型。从[HuksChallengeType](#hukschallengetype9)中选择 | @@ -1966,7 +1968,7 @@ async function huksAbort() { | HUKS_TAG_KEY | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10006 | 预留。 | | HUKS_TAG_KEY_VERSION | HuksTagType.HUKS_TAG_TYPE_UINT \| 10007 | 表示密钥版本的Tag。 | | HUKS_TAG_PAYLOAD_LEN | HuksTagType.HUKS_TAG_TYPE_UINT \| 10008 | 预留。 | -| HUKS_TAG_AE_TAG | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10009 | 预留。 | +| HUKS_TAG_AE_TAG | HuksTagType.HUKS_TAG_TYPE_BYTES \| 10009 | 用于传入GCM模式中的AEAD数据的字段。 | | HUKS_TAG_IS_KEY_HANDLE | HuksTagType.HUKS_TAG_TYPE_ULONG \| 10010 | 预留。 | | HUKS_TAG_OS_VERSION | HuksTagType.HUKS_TAG_TYPE_UINT \| 10101 | 表示操作系统版本的Tag。 | | HUKS_TAG_OS_PATCHLEVEL | HuksTagType.HUKS_TAG_TYPE_UINT \| 10102 | 表示操作系统补丁级别的Tag。 | @@ -2821,6 +2823,7 @@ function huksAbort() { huks Handle结构体。 **系统能力**:SystemCapability.Security.Huks +> **说明:** 从API Version 9开始废弃,建议使用[HuksSessionHandle9+](#hukssessionhandle9)替代。 | 名称 | 类型 | 必填 | 说明 | | ---------- | ---------------- | ---- | -------- | @@ -2834,6 +2837,8 @@ huks Handle结构体。 **系统能力**:SystemCapability.Security.Huks +> **说明:** 从API Version 9开始废弃,建议使用[HuksReturnResult9+](#huksreturnresult9)替代。 + | 名称 | 类型 | 必填 | 说明 | | ---------- | ------------------------------- | ---- | ---------------- | | errorCode | number | 是 | 表示错误码。 | @@ -2847,6 +2852,7 @@ huks Handle结构体。 表示错误码的枚举。 **系统能力**:SystemCapability.Security.Huks +> **说明:** 从API Version 9开始废弃,建议使用[HuksExceptionErrCode9+](#huksexceptionerrcode9)替代。 | 名称 | 值 | 说明 | | -------------------------- | ----- | ---- | @@ -2889,11 +2895,6 @@ huks Handle结构体。 | HUKS_ERROR_NEW_ROOT_KEY_MATERIAL_EXIST | -36 |表示存在新的根密钥材料。| | HUKS_ERROR_UPDATE_ROOT_KEY_MATERIAL_FAIL | -37 |表示更新根密钥材料失败。| | HUKS_ERROR_VERIFICATION_FAILED | -38 |表示验证证书链失败。| -| HUKS_ERROR_GET_USERIAM_SECINFO_FAILED9+ | -40 |表示获取当前用户安全属性信息失败。| -| HUKS_ERROR_GET_USERIAM_AUTHINFO_FAILED9+ | -41 |表示获取当前用户认证信息失败。| -| HUKS_ERROR_USER_AUTH_TYPE_NOT_SUPPORT9+ | -42 |表示不支持当前用户认证类型的访问控制。| -| HUKS_ERROR_KEY_AUTH_FAILED9+ | -43 |表示安全访问控制认证失败。| -| HUKS_ERROR_DEVICE_NO_CREDENTIAL9+ | -44 |表示设备当前未录入凭据。| | HUKS_ERROR_CHECK_GET_ALG_FAIL | -100 |表示检查获取 ALG 失败。| | HUKS_ERROR_CHECK_GET_KEY_SIZE_FAIL | -101 |表示检查获取密钥大小失败。| | HUKS_ERROR_CHECK_GET_PADDING_FAIL | -102 |表示检查获取填充失败。| @@ -2920,7 +2921,5 @@ huks Handle结构体。 | HUKS_ERROR_INVALID_SALT | -123 |表示无效SALT。| | HUKS_ERROR_INVALID_ITERATION | -124 |表示无效的迭代。| | HUKS_ERROR_INVALID_OPERATION | -125 |表示无效操作。| -| HUKS_ERROR_INVALID_WRAPPED_FORMAT9+ | -126 |表示导入加密密钥时,密钥格式错误。| -| HUKS_ERROR_INVALID_USAGE_OF_KEY9+ | -127 |表示导入加密密钥时,密钥用途错误。| | HUKS_ERROR_INTERNAL_ERROR | -999 |表示内部错误。| | HUKS_ERROR_UNKNOWN_ERROR | -1000 |表示未知错误。| \ No newline at end of file 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 44256b9542e9a4ce38a6b11475e6dcba71bb4f71..1ab0f3ee0be051fe56bb233261285db7f0c3b5ea 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-i18n.md +++ b/zh-cn/application-dev/reference/apis/js-apis-i18n.md @@ -1059,7 +1059,7 @@ constructor(country: string, options?: PhoneNumberFormatOptions) | 参数名 | 类型 | 必填 | 说明 | | ------- | ---------------------------------------- | ---- | ---------------- | | country | string | 是 | 表示电话号码所属国家或地区代码。 | -| options | [PhoneNumberFormatOptions](#phonenumberformatoptions8) | 否 | 电话号码格式化对象的相关选项。 | +| options | [PhoneNumberFormatOptions](#phonenumberformatoptions9) | 否 | 电话号码格式化对象的相关选项。 | **示例:** ```js @@ -1149,7 +1149,7 @@ getLocationName(number: string, locale: string): string ``` -## PhoneNumberFormatOptions8+ +## PhoneNumberFormatOptions9+ 表示电话号码格式化对象可设置的属性。 @@ -1194,7 +1194,7 @@ getInstance(locale?:string): IndexUtil **示例:** ```js - let indexUtil= I18n.getInstance("zh-CN"); + let indexUtil = I18n.getInstance("zh-CN"); ``` @@ -1267,7 +1267,7 @@ getIndex(text: string): string **示例:** ```js - let indexUtil= I18n.getInstance("zh-CN"); + let indexUtil = I18n.getInstance("zh-CN"); let index = indexUtil.getIndex("hi"); // index = "H" ``` @@ -1382,7 +1382,7 @@ first(): number **示例:** ```js - let iterator = i18n.getLineInstance("en"); + let iterator = I18n.getLineInstance("en"); iterator.setLineBreakText("Apple is my favorite fruit."); let firstPos = iterator.first(); // firstPos = 0 ``` @@ -2112,6 +2112,75 @@ static getDateOrder(locale: string): string ``` +## Normalizer10+ + +### getInstance10+ + +static getInstance(mode: NormalizerMode): Normalizer + +获取文本正则化对象。 + +**系统能力**:SystemCapability.Global.I18n + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------------------------- | +| mode | [NormalizerMode](#normalizermode10) | 是 | 文本正则化范式。 | + +**返回值:** + +| 类型 | 说明 | +| ------ | ------------------- | +| [Normalizer](#normalizer10) | 返回指定范式的文本正则化对象。 | + +**示例:** + ```js + let normalizer = I18n.Normalizer.getInstance(I18n.NormalizerMode.NFC); + ``` + + +### normalize10+ + +normalize(text: string): string + +对字符串进行正则化。 + +**系统能力**:SystemCapability.Global.I18n + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------------------------- | +| text | string | 是 | 待正则化的字符串。 | + +**返回值:** + +| 类型 | 说明 | +| ------ | ------------------- | +| string | 正则化后的字符串。 | + +**示例:** + ```js + let normalizer = I18n.Normalizer.getInstance(I18n.NormalizerMode.NFC); + let normalizedText = normalizer.normalize('\u1E9B\u0323'); // normalizedText = \u1E9B\u0323 + ``` + + +## NormalizerMode10+ + +表示文本正则化范式的枚举。 + +**系统能力:** :SystemCapability.Global.I18n + +| 名称 | 值 | 说明 | +| -------- | -------- | -------- | +| NFC | 1 | NFC范式。 | +| NFD | 2 | NFD范式。 | +| NFKC | 3 | NFKC范式。 | +| NFKD | 4 | NFKD范式。 | + + ## I18n.getDisplayCountry(deprecated) getDisplayCountry(country: string, locale: string, sentenceCase?: boolean): string 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 b08aa4862fdb7c553b6b1fe5e1ffb648687d6e08..e2db66ac13ef747d502a405acc2f1ae45ebd5b93 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-image.md +++ b/zh-cn/application-dev/reference/apis/js-apis-image.md @@ -79,7 +79,7 @@ image.createPixelMap(color, opts, (error, pixelmap) => { ## PixelMap7+ -图像像素类,用于读取或写入图像数据以及获取图像信息。在调用PixelMap的方法前,需要先通过createPixelMap创建一个PixelMap实例。 +图像像素类,用于读取或写入图像数据以及获取图像信息。在调用PixelMap的方法前,需要先通过createPixelMap创建一个PixelMap实例。目前pixelmap序列化大小最大128MB,超过会送显失败。大小计算方式为(宽\*高\*每像素占用字节数)。 ### 属性 @@ -947,8 +947,18 @@ createImageSource(uri: string): ImageSource **示例:** ```js -let context = featureAbility.getContext(); -let path = context.getCacheDir() + "test.jpg"; +//Stage模型 +const context = getContext(this); +const path = context.cacheDir() + "/test.jpg"; +const imageSourceApi = image.createImageSource(path); +``` + +```js +//FA模型 +import featureAbility from '@ohos.ability.featureAbility'; + +const context = featureAbility.getContext(); +const path = context.getCacheDir() + "/test.jpg"; const imageSourceApi = image.createImageSource(path); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-ability-abilityResult.md b/zh-cn/application-dev/reference/apis/js-apis-inner-ability-abilityResult.md index 1affde15177fd27edca009fe043bd7a9bc118332..9db916a4563da925a2ad831e1efb1025a6cefd54 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-ability-abilityResult.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-ability-abilityResult.md @@ -1,6 +1,6 @@ # AbilityResult -定义Ability被拉起并退出后返回的结果码和数据,可以通过[startAbilityForResult](js-apis-ability-context.md#abilitycontextstartabilityforresult)获取被拉起Ability退出后返回的AbilityResult对象,被startAbilityForResult拉起的Ability对象可以通过[terminateSelfWithResult](js-apis-ability-context.md#abilitycontextterminateselfwithresult)返回AbilityResult对象。 +定义Ability被拉起并退出后返回的结果码和数据,可以通过[startAbilityForResult](js-apis-ability-featureAbility.md#featureabilitystartabilityforresult7)获取被拉起Ability退出后返回的AbilityResult对象,被startAbilityForResult拉起的Ability对象可以通过[terminateSelfWithResult](js-apis-ability-featureAbility.md#featureabilityterminateselfwithresult7)返回AbilityResult对象。 > **说明:** > diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-ability-dataAbilityHelper.md b/zh-cn/application-dev/reference/apis/js-apis-inner-ability-dataAbilityHelper.md index f1e4e395e42bbc0028263ed54067757e07961c91..2f2babef92ca9837fc86209b2fc0eddea5d8d275 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-ability-dataAbilityHelper.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-ability-dataAbilityHelper.md @@ -859,8 +859,8 @@ call(uri: string, method: string, arg: string, extras: PacMap, callback: AsyncCa | uri | string | 是 | 指示待处理的DataAbility。例:'dataability:///com.example.xxx.xxxx' | | method | string | 是 | 指示被调用的方法名。 | | arg | string | 是 | 指示需传入的参数。 | -| extras | [PacMap](#pacmap) | 是 | 指示扩展的键值对参数。 | -| callback | AsyncCallback\<[PacMap](#pacmap)> | 是 | 指示数据操作的回调方法,返回操作结果。 | +| extras | [PacMap](js-apis-inner-application-pacMap.md) | 是 | 指示扩展的键值对参数。 | +| callback | AsyncCallback\<[PacMap](js-apis-inner-application-pacMap.md)> | 是 | 指示数据操作的回调方法,返回操作结果。 | **示例:** @@ -895,13 +895,13 @@ call(uri: string, method: string, arg: string, extras: PacMap): Promise\ | uri | string | 是 | 指示待处理的DataAbility。例:'dataability:///com.example.xxx.xxxx' | | method | string | 是 | 指示被调用的方法名。 | | arg | string | 是 | 指示需传入的参数。 | -| extras | [PacMap](#pacmap) | 是 | 指示扩展的键值对参数。 | +| extras | [PacMap](js-apis-inner-application-pacMap.md) | 是 | 指示扩展的键值对参数。 | **返回值:** | 类型 | 说明 | |------ | ------- | -|Promise\<[PacMap](#pacmap)> | 返回操作结果。 | +|Promise\<[PacMap](js-apis-inner-application-pacMap.md)> | 返回操作结果。 | **示例:** @@ -991,14 +991,4 @@ dataAbilityHelper.executeBatch('dataability:///com.example.jsapidemo.UserDataAbi console.error('executeBatch failed, error: ${error}'); }); -``` - -## PacMap - -[key: string]: number | string | boolean | Array\ | null; - -**系统能力**:SystemCapability.Ability.AbilityRuntime.FAModel - -| 参数名 | 参数类型 | 必填 | 说明 | -| ------ | ------ | ------ | ------ | -| [key: string] | number \| string \| boolean \| Array\ \| null | Yes| 数据存储在键值对中。| \ No newline at end of file +``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-ability-dataAbilityResult.md b/zh-cn/application-dev/reference/apis/js-apis-inner-ability-dataAbilityResult.md index 2d736dafd9e04e113f4310b0aad0d5939ac49c76..5afc8692841976d2ee9438812d521c17f0c4a928 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-ability-dataAbilityResult.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-ability-dataAbilityResult.md @@ -27,11 +27,9 @@ function executeBatchOperation() { DAHelper = featureAbility.acquireDataAbilityHelper(dataAbilityUri); if (DAHelper === null) { console.error('DAHelper is null'); - return; } } catch (err) { console.error('acquireDataAbilityHelper fail, error: ${JSON.stringify(err)}'); - return; } let valueBucket = { diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-ability-want.md b/zh-cn/application-dev/reference/apis/js-apis-inner-ability-want.md index b9a0005234e5543cd7def7eb9967827d8e6a3f99..d89ffb47d8e21db0c8ef7ba29933a9e39cc2c505 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-ability-want.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-ability-want.md @@ -15,10 +15,10 @@ Want是对象间信息传递的载体, 可以用于应用组件间的信息传 | abilityName | string | 否 | 表示待启动的Ability名称。如果在Want中该字段同时指定了BundleName和AbilityName,则Want可以直接匹配到指定的Ability。AbilityName需要在一个应用的范围内保证唯一。 | | uri | string | 否 | 表示Uri。如果在Want中指定了Uri,则Want将匹配指定的Uri信息,包括scheme, schemeSpecificPart, authority和path信息。 | | type | string | 否 | 表示MIME type类型,打开文件的类型,主要用于文管打开文件。比如:'text/xml' 、 'image/*'等,MIME定义参考:https://www.iana.org/assignments/media-types/media-types.xhtml?utm_source=ld246.com。 | -| flags | number | 否 | 表示处理Want的方式。默认传数字,具体参考:[flags说明](js-apis-ability-wantConstant.md#wantConstant.Flags)。 | -| action | string | 否 | 表示要执行的通用操作(如:查看、分享、应用详情)。在隐式Want中,您可以定义该字段,配合uri或parameters来表示对数据要执行的操作。具体参考:[action说明](js-apis-app-ability-wantConstant.md#wantConstant.Action)。隐式Want定义及匹配规则参考:[显式Want与隐式Want匹配规则](application-models/explicit-implicit-want-mappings.md)。 | -| parameters | {[key: string]: any} | 否 | 表示WantParams,由开发者自行决定传入的键值对。默认会携带以下key值:
ohos.aafwk.callerPid 表示拉起方的pid。
ohos.aafwk.param.callerToken 表示拉起方的token。
ohos.aafwk.param.callerUid 表示[bundleInfo](js-apis-bundle-BundleInfo.md#bundleinfo-1)中的uid,应用包里应用程序的uid。
- component.startup.newRules:表示是否启用新的管控规则。
- moduleName:表示拉起方的模块名,该字段的值即使定义成其他字符串,在传递到另一端时会被修改为正确的值。
- ohos.dlp.params.sandbox:表示dlp文件才会有。 | -| entities | Array\ | 否 | 表示目标Ability额外的类别信息(如:浏览器、视频播放器),在隐式Want中是对action字段的补充。在隐式Want中,您可以定义该字段,来过滤匹配Ability类型。具体参考:[entity说明](js-apis-app-ability-wantConstant.md#wantConstant.Entity)。 | +| flags | number | 否 | 表示处理Want的方式。默认传数字,具体参考:[flags说明](js-apis-ability-wantConstant.md#wantconstantflags)。 | +| action | string | 否 | 表示要执行的通用操作(如:查看、分享、应用详情)。在隐式Want中,您可以定义该字段,配合uri或parameters来表示对数据要执行的操作。具体参考:[action说明](js-apis-ability-wantConstant.md#wantconstantaction)。隐式Want定义及匹配规则参考:[显式Want与隐式Want匹配规则](../../application-models/explicit-implicit-want-mappings.md)。 | +| parameters | {[key: string]: Object} | 否 | 表示WantParams,由开发者自行决定传入的键值对。默认会携带以下key值:
ohos.aafwk.callerPid 表示拉起方的pid。
ohos.aafwk.param.callerToken 表示拉起方的token。
ohos.aafwk.param.callerUid 表示[bundleInfo](js-apis-bundle-BundleInfo.md#bundleinfo)中的uid,应用包里应用程序的uid。
- component.startup.newRules:表示是否启用新的管控规则。
- moduleName:表示拉起方的模块名,该字段的值即使定义成其他字符串,在传递到另一端时会被修改为正确的值。
- ohos.dlp.params.sandbox:表示dlp文件才会有。 | +| entities | Array\ | 否 | 表示目标Ability额外的类别信息(如:浏览器、视频播放器),在隐式Want中是对action字段的补充。在隐式Want中,您可以定义该字段,来过滤匹配Ability类型。具体参考:[entity说明](js-apis-app-ability-wantConstant.md#wantconstantentity)。 | | moduleName9+ | string | 否 | 表示待启动的Ability所属的模块(module)。 | **示例:** @@ -41,12 +41,12 @@ Want是对象间信息传递的载体, 可以用于应用组件间的信息传 - 传递FD(文件描述符)数据(在UIAbility对象中调用,其中示例中的context为UIAbility的上下文对象) ```ts - import fileio from '@ohos.fileio'; + import fs from '@ohos.file.fs'; // ... let fd; try { - fd = fileio.openSync('/data/storage/el2/base/haps/pic.png'); + fd = fs.openSync('/data/storage/el2/base/haps/pic.png').fd; } catch(e) { console.error('openSync fail: ${JSON.stringify(e)}'); } diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityDelegator.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityDelegator.md index 654266d918243b97d796ce135eb35e3669b37ece..38cf79906cf55377de45f345b94c32b70a76fb1a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityDelegator.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityDelegator.md @@ -11,8 +11,6 @@ AbilityDelegator提供添加用于监视指定ability的生命周期状态更改 通过AbilityDelegatorRegistry中[getAbilityDelegator](js-apis-app-ability-abilityDelegatorRegistry.md#abilitydelegatorregistrygetabilitydelegator)方法获取。 ```ts import AbilityDelegatorRegistry from '@ohos.app.ability.abilityDelegatorRegistry'; - -let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); ``` ## AbilityDelegator @@ -32,6 +30,14 @@ addAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback\): void | monitor | [AbilityMonitor](js-apis-inner-application-abilityMonitor.md#AbilityMonitor) | 是 | [AbilityMonitor](js-apis-inner-application-abilityMonitor.md#AbilityMonitor)实例 | | callback | AsyncCallback\ | 是 | 表示指定的回调方法 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000100 | AddAbilityMonitor failed. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -72,6 +78,14 @@ addAbilityMonitor(monitor: AbilityMonitor): Promise\; | -------------- | ------------------- | | Promise\ | 以Promise形式返回。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000100 | AddAbilityMonitor failed. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -107,6 +121,14 @@ removeAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback\): v | monitor | [AbilityMonitor](js-apis-inner-application-abilityMonitor.md#AbilityMonitor) | 是 | [AbilityMonitor](js-apis-inner-application-abilityMonitor.md#AbilityMonitor)实例 | | callback | AsyncCallback\ | 是 | 表示指定的回调方法 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000100 | RemoveAbilityMonitor failed. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -147,6 +169,14 @@ removeAbilityMonitor(monitor: AbilityMonitor): Promise\; | -------------- | ------------------- | | Promise\ | 以Promise形式返回。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000100 | RemoveAbilityMonitor failed. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + - 示例 ```ts @@ -182,6 +212,14 @@ waitAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback\) | monitor | [AbilityMonitor](js-apis-inner-application-abilityMonitor.md#AbilityMonitor) | 是 | [AbilityMonitor](js-apis-inner-application-abilityMonitor.md#AbilityMonitor)实例 | | callback | AsyncCallback\<[UIAbility](js-apis-app-ability-uiAbility.md)> | 是 | 表示指定的回调方法 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000100 | WaitAbilityMonitor failed. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -198,7 +236,7 @@ let monitor = { abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.waitAbilityMonitor(monitor, (error : any, data : any) => { - if (error && error.code !== 0) { + if (error) { console.error('waitAbilityMonitor fail, error: ${JSON.stringify(error)}'); } else { console.log('waitAbilityMonitor success, data: ${JSON.stringify(data)}'); @@ -222,6 +260,14 @@ waitAbilityMonitor(monitor: AbilityMonitor, timeout: number, callback: AsyncCall | timeout | number | 否 | 最大等待时间,单位毫秒(ms) | | callback | AsyncCallback\<[UIAbility](js-apis-app-ability-uiAbility.md)> | 是 | 表示指定的回调方法 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000100 | WaitAbilityMonitor failed. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -270,6 +316,14 @@ waitAbilityMonitor(monitor: AbilityMonitor, timeout?: number): Promise\ | 以Promise形式返回Ability。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000100 | WaitAbilityMonitor failed. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -362,6 +416,14 @@ getCurrentTopAbility(callback: AsyncCallback\): void; | -------- | ------------------------------------------------------------ | ---- | ------------------ | | callback | AsyncCallback\<[UIAbility](js-apis-app-ability-uiAbility.md)> | 是 | 表示指定的回调方法 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000100 | GetCurrentTopAbility failed. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -389,6 +451,14 @@ getCurrentTopAbility(): Promise\; | ----------------------------------------------------------- | -------------------------------------- | | Promise\<[UIAbility](js-apis-app-ability-uiAbility.md)> | 以Promise形式返回当前应用顶部ability。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000100 | GetCurrentTopAbility failed. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -417,6 +487,26 @@ startAbility(want: Want, callback: AsyncCallback\): void; | want | [Want](js-apis-application-want.md) | 是 | 启动Ability参数 | | callback | AsyncCallback\ | 是 | 表示指定的回调方法 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000004 | Can not start invisible component. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000008 | The crowdtesting application expires. | +| 16000009 | An ability cannot be started or stopped in Wukong mode. | +| 16000010 | The call with the continuation flag is forbidden. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16000053 | The ability is not on the top of the UI. | +| 16000055 | Installation-free timed out. | +| 16200001 | The caller has been released. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -452,6 +542,26 @@ startAbility(want: Want): Promise\; | -------------- | ------------------- | | Promise\ | 以Promise形式返回。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000004 | Can not start invisible component. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000008 | The crowdtesting application expires. | +| 16000009 | An ability cannot be started or stopped in Wukong mode. | +| 16000010 | The call with the continuation flag is forbidden. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16000053 | The ability is not on the top of the UI. | +| 16000055 | Installation-free timed out. | +| 16200001 | The caller has been released. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -482,6 +592,14 @@ doAbilityForeground(ability: UIAbility, callback: AsyncCallback\): void; | ability | UIAbility | 是 | 指定Ability对象 | | callback | AsyncCallback\ | 是 | 表示指定的回调方法
\- true:成功
\- false:失败 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000100 | DoAbilityForeground failed. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -492,8 +610,8 @@ abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.getCurrentTopAbility((err : any, data : any) => { console.info('getCurrentTopAbility callback'); ability = data; - abilityDelegator.doAbilityForeground(ability, (err : any, data : any) => { - console.info('doAbilityForeground callback'); + abilityDelegator.doAbilityForeground(ability, (err : any) => { + console.info("doAbilityForeground callback"); }); }); ``` @@ -518,6 +636,14 @@ doAbilityForeground(ability: UIAbility): Promise\; | ----------------- | ------------------------------------------------------------ | | Promise\ | 以Promise形式返回执行结果。
\- true:成功
\- false:失败 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000100 | DoAbilityForeground failed. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -528,8 +654,8 @@ abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.getCurrentTopAbility((err : any, data : any) => { console.info('getCurrentTopAbility callback'); ability = data; - abilityDelegator.doAbilityForeground(ability).then((data : any) => { - console.info('doAbilityForeground promise'); + abilityDelegator.doAbilityForeground(ability).then(() => { + console.info("doAbilityForeground promise"); }); }); ``` @@ -549,6 +675,14 @@ doAbilityBackground(ability: UIAbility, callback: AsyncCallback\): void; | ability | UIAbility | 是 | 指定Ability对象 | | callback | AsyncCallback\ | 是 | 表示指定的回调方法
\- true:成功
\- false:失败 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000100 | DoAbilityBackground failed. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -559,8 +693,8 @@ abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.getCurrentTopAbility((err : any, data : any) => { console.info('getCurrentTopAbility callback'); ability = data; - abilityDelegator.doAbilityBackground(ability, (err : any, data : any) => { - console.info('doAbilityBackground callback'); + abilityDelegator.doAbilityBackground(ability, (err : any) => { + console.info("doAbilityBackground callback"); }); }); ``` @@ -585,6 +719,14 @@ doAbilityBackground(ability: UIAbility): Promise\; | ----------------- | ------------------------------------------------------------ | | Promise\ | 以Promise形式返回执行结果。
\- true:成功
\- false:失败 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000100 | DoAbilityBackground failed. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -595,8 +737,8 @@ abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.getCurrentTopAbility((err : any, data : any) => { console.info('getCurrentTopAbility callback'); ability = data; - abilityDelegator.doAbilityBackground(ability).then((data : any) => { - console.info('doAbilityBackground promise'); + abilityDelegator.doAbilityBackground(ability).then(() => { + console.info("doAbilityBackground promise"); }); }); ``` @@ -790,6 +932,14 @@ finishTest(msg: string, code: number, callback: AsyncCallback\): void; | code | number | 是 | 日志码 | | callback | AsyncCallback\ | 是 | 表示指定的回调方法 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000100 | FinishTest failed. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -823,6 +973,14 @@ finishTest(msg: string, code: number): Promise\; | -------------- | ------------------- | | Promise\ | 以Promise形式返回。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000100 | FinishTest failed. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -850,6 +1008,14 @@ addAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback\ | 是 | 表示指定的回调方法 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000100 | AddAbilityStageMonitor failed. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -886,6 +1052,14 @@ addAbilityStageMonitor(monitor: AbilityStageMonitor): Promise\; | -------------- | ------------------- | | Promise\ | 以Promise形式返回。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000100 | AddAbilityStageMonitor failed. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -917,6 +1091,14 @@ removeAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback\ | monitor | [AbilityStageMonitor](js-apis-inner-application-abilityStageMonitor.md) | 是 | [AbilityStageMonitor](js-apis-inner-application-abilityStageMonitor.md) 实例 | | callback | AsyncCallback\ | 是 | 表示指定的回调方法 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000100 | RemoveAbilityStageMonitor failed. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -953,6 +1135,14 @@ removeAbilityStageMonitor(monitor: AbilityStageMonitor): Promise\; | -------------- | ------------------- | | Promise\ | 以Promise形式返回。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000100 | RemoveAbilityStageMonitor failed. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -984,6 +1174,14 @@ waitAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback\ | 是 | 成功返回AbilityStage对象,失败返回空。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000100 | WaitAbilityStageMonitor failed. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -1025,6 +1223,14 @@ waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout?: number): Promise | -------------- | ------------------- | | Promise\ | 成功返回AbilityStage对象,失败返回空。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000100 | WaitAbilityStageMonitor failed. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -1061,6 +1267,14 @@ waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout: number, callback: | timeout | number | 否 | 超时最大等待时间,以毫秒为单位。 | | callback | AsyncCallback\ | 是 | 成功返回AbilityStage对象,失败返回空。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000100 | WaitAbilityStageMonitor failed. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityMonitor.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityMonitor.md index 653b7e8d2c99736c7b04ba7d49e3f74c2a8c470a..f196580d6ec336e7083299746ec78b291a7f31db 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityMonitor.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityMonitor.md @@ -45,7 +45,7 @@ let monitor = { let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.addAbilityMonitor(monitor, (error : any) => { - if (error && error.code !== 0) { + if (error) { console.error('addAbilityMonitor fail, error: ${JSON.stringify(error)}'); } }); diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityRunningInfo.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityRunningInfo.md index cc5aa4a04b72ddad8073f7a0f1d2f508c0862ee9..5e3687a27a94eee22349a15ede7222f1ffb9de77 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityRunningInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityRunningInfo.md @@ -31,7 +31,7 @@ AbilityRunningInfo模块提供对Ability运行的相关信息和状态的定义 import abilitymanager from '@ohos.app.ability.abilityManager'; abilitymanager.getAbilityRunningInfos((error, data) => { - if (error && error.code !== 0) { + if (error) { console.error('getAbilityRunningInfos fail, error: ${JSON.stringify(error)}'); } else { console.log('getAbilityRunningInfos success, data: ${JSON.stringify(data)}'); diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityStageMonitor.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityStageMonitor.md index feb761168adbd83a89b4bab41d498e9cc71e4b56..46229019c49f578bdb2ad6cc181f27955c64d54e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityStageMonitor.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityStageMonitor.md @@ -20,7 +20,7 @@ let monitor = { let abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.waitAbilityStageMonitor(monitor, (error, data) => { - if (error && error.code !== 0) { + if (error) { console.error('waitAbilityStageMonitor fail, error: ${JSON.stringify(error)}'); } else { console.log('waitAbilityStageMonitor success, data: ${JSON.stringify(data)}'); diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-accessibilityExtensionContext.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-accessibilityExtensionContext.md index 91a31e1e435b861c6e867c9621d818d2cf024c22..9546f6d83aa87a3ad7730441518eed5b8a93a58d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-accessibilityExtensionContext.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-accessibilityExtensionContext.md @@ -34,7 +34,7 @@ class EntryAbility extends AccessibilityExtensionAbility { | 名称 | 说明 | | -------- | ------- | | up | 表示向上查询。 | -| down | 表示向上查询。 | +| down | 表示向下查询。 | | left | 表示向左查询。 | | right | 表示向右查询。 | | forward | 表示向前查询。 | @@ -57,7 +57,7 @@ class EntryAbility extends AccessibilityExtensionAbility { **系统能力**:以下各项对应的系统能力均为 SystemCapability.BarrierFree.Accessibility.Core -| 名称 | 类型 | 可读 | 可写 | 说明 | +| 名称 | 类型 | 可读 | 可写 | 说明 | | ------ | ------ | ---- | ---- | --------- | | left | number | 是 | 否 | 矩形区域的左边界。 | | top | number | 是 | 否 | 矩形区域的上边界。 | @@ -85,14 +85,14 @@ setTargetBundleName(targetNames: Array\): Promise\; **参数:** -| 参数名 | 类型 | 必填 | 说明 | +| 参数名 | 类型 | 必填 | 说明 | | ----------- | ------------------- | ---- | -------- | | targetNames | Array<string> | 是 | 关注的目标包名。 | **返回值:** -| 类型 | 说明 | -| ---------------------- | --------------------- | +| 类型 | 说明 | +| ------------------- | ---------------- | | Promise<void> | 无返回结果的Promise对象。 | **示例:** @@ -120,9 +120,9 @@ setTargetBundleName(targetNames: Array\, callback: AsyncCallback\) **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ----------- | ------------------- | ---- | -------- | -| targetNames | Array<string> | 是 | 关注的目标包名。 | +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ------------------------- | ---- | ---------------------------------------- | +| targetNames | Array<string> | 是 | 关注的目标包名。 | | callback | AsyncCallback<void> | 是 | 回调函数,如果设置关注的目标包名失败,则AsyncCallback中err有数据返回。 | **示例:** @@ -131,7 +131,7 @@ setTargetBundleName(targetNames: Array\, callback: AsyncCallback\) let targetNames = ['com.ohos.xyz']; try { axContext.setTargetBundleName(targetNames, (err, data) => { - if (err) { + if (err && err.code) { console.error('failed to set target bundle names, because ${JSON.stringify(err)}'); return; } @@ -152,7 +152,7 @@ getFocusElement(isAccessibilityFocus?: boolean): Promise\; **参数:** -| 参数名 | 类型 | 必填 | 说明 | +| 参数名 | 类型 | 必填 | 说明 | | -------------------- | ------- | ---- | ------------------- | | isAccessibilityFocus | boolean | 否 | 获取的是否是无障碍焦点元素,默认为否。 | @@ -166,8 +166,8 @@ getFocusElement(isAccessibilityFocus?: boolean): Promise\; 以下错误码的详细介绍请参见[无障碍子系统错误码](../errorcodes/errorcode-accessibility.md)。 -| 错误码ID | 错误信息 | -| ------- | -------------------------------- | +| 错误码ID | 错误信息 | +| ------- | ---------------------------------------- | | 9300003 | Do not have accessibility right for this operation. | **示例:** @@ -196,16 +196,16 @@ getFocusElement(callback: AsyncCallback\): void; **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<AccessibilityElement> | 是 | 回调函数,返回当前对应的焦点元素。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ----------------- | +| callback | AsyncCallback<AccessibilityElement> | 是 | 回调函数,返回当前对应的焦点元素。 | **错误码:** 以下错误码的详细介绍请参见[无障碍子系统错误码](../errorcodes/errorcode-accessibility.md)。 -| 错误码ID | 错误信息 | -| ------- | -------------------------------- | +| 错误码ID | 错误信息 | +| ------- | ---------------------------------------- | | 9300003 | Do not have accessibility right for this operation. | **示例:** @@ -214,7 +214,7 @@ getFocusElement(callback: AsyncCallback\): void; let focusElement; try { axContext.getFocusElement((err, data) => { - if (err) { + if (err && err.code) { console.error('failed to get focus element, because ${JSON.stringify(err)}'); return; } @@ -236,10 +236,10 @@ getFocusElement(isAccessibilityFocus: boolean, callback: AsyncCallback\ { - if (err) { + if (err && err.code) { console.error('failed to get focus element, because ${JSON.stringify(err)}'); return; } @@ -269,8 +269,8 @@ getWindowRootElement(windowId?: number): Promise\; **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------------------- | ------- | ---- | ------------------- | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ---------------------- | | windowId | number | 否 | 指定窗口的编号,未指定则从当前活跃窗口获取。 | **返回值:** @@ -283,8 +283,8 @@ getWindowRootElement(windowId?: number): Promise\; 以下错误码的详细介绍请参见[无障碍子系统错误码](../errorcodes/errorcode-accessibility.md)。 -| 错误码ID | 错误信息 | -| ------- | -------------------------------- | +| 错误码ID | 错误信息 | +| ------- | ---------------------------------------- | | 9300003 | Do not have accessibility right for this operation. | **示例:** @@ -313,16 +313,16 @@ getWindowRootElement(callback: AsyncCallback\): void; **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<AccessibilityElement> | 是 | 回调函数,返回指定窗口的根节点元素。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ------------------ | +| callback | AsyncCallback<AccessibilityElement> | 是 | 回调函数,返回指定窗口的根节点元素。 | **错误码:** 以下错误码的详细介绍请参见[无障碍子系统错误码](../errorcodes/errorcode-accessibility.md)。 -| 错误码ID | 错误信息 | -| ------- | -------------------------------- | +| 错误码ID | 错误信息 | +| ------- | ---------------------------------------- | | 9300003 | Do not have accessibility right for this operation. | **示例:** @@ -331,7 +331,7 @@ getWindowRootElement(callback: AsyncCallback\): void; let rootElement; try { axContext.getWindowRootElement((err, data) => { - if (err) { + if (err && err.code) { console.error('failed to get root element of the window, because ${JSON.stringify(err)}'); return; } @@ -353,17 +353,17 @@ getWindowRootElement(windowId: number, callback: AsyncCallback\ { - if (err) { + if (err && err.code) { console.error('failed to get root element of the window, because ${JSON.stringify(err)}'); return; } @@ -395,22 +395,22 @@ getWindows(displayId?: number): Promise\>; **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------------------- | ------- | ---- | ------------------- | +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------ | ---- | --------------------- | | displayId | number | 否 | 指定的屏幕编号,未指定则从默认主屏幕获取。 | **返回值:** -| 类型 | 说明 | -| ----------------------------------- | ---------------------- | +| 类型 | 说明 | +| ---------------------------------------- | ---------------------- | | Promise<Array<AccessibilityElement>> | Promise对象,返回指定屏幕的所有窗口。 | **错误码:** 以下错误码的详细介绍请参见[无障碍子系统错误码](../errorcodes/errorcode-accessibility.md)。 -| 错误码ID | 错误信息 | -| ------- | -------------------------------- | +| 错误码ID | 错误信息 | +| ------- | ---------------------------------------- | | 9300003 | Do not have accessibility right for this operation. | **示例:** @@ -439,16 +439,16 @@ getWindows(callback: AsyncCallback\>): void; **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| callback | AsyncCallback<Array<AccessibilityElement>> | 是 | 回调函数,返回指定屏幕的所有窗口。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | ----------------- | +| callback | AsyncCallback<Array<AccessibilityElement>> | 是 | 回调函数,返回指定屏幕的所有窗口。 | **错误码:** 以下错误码的详细介绍请参见[无障碍子系统错误码](../errorcodes/errorcode-accessibility.md)。 -| 错误码ID | 错误信息 | -| ------- | -------------------------------- | +| 错误码ID | 错误信息 | +| ------- | ---------------------------------------- | | 9300003 | Do not have accessibility right for this operation. | **示例:** @@ -457,7 +457,7 @@ getWindows(callback: AsyncCallback\>): void; let windows; try { axContext.getWindows((err, data) => { - if (err) { + if (err && err.code) { console.error('failed to get windows, because ${JSON.stringify(err)}'); return; } @@ -479,17 +479,17 @@ getWindows(displayId: number, callback: AsyncCallback\ { - if (err) { + if (err && err.code) { console.error('failed to get windows, because ${JSON.stringify(err)}'); return; } @@ -521,22 +521,22 @@ injectGesture(gesturePath: GesturePath): Promise\; **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ----------- | ---------------------------------------- | ---- | -------------- | -| gesturePath | [GesturePath](js-apis-accessibility-GesturePath.md#gesturepath) | 是 | 表示手势的路径信息。 | +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ---------------------------------------- | ---- | ---------- | +| gesturePath | [GesturePath](js-apis-accessibility-GesturePath.md#gesturepath) | 是 | 表示手势的路径信息。 | **返回值:** -| 类型 | 说明 | -| ----------------------------------- | ---------------------- | +| 类型 | 说明 | +| ------------------- | ---------------- | | Promise<void> | 无返回结果的Promise对象。 | **错误码:** 以下错误码的详细介绍请参见[无障碍子系统错误码](../errorcodes/errorcode-accessibility.md)。 -| 错误码ID | 错误信息 | -| ------- | -------------------------------- | +| 错误码ID | 错误信息 | +| ------- | ---------------------------------------- | | 9300003 | Do not have accessibility right for this operation. | **示例:** @@ -569,17 +569,17 @@ injectGesture(gesturePath: GesturePath, callback: AsyncCallback\): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ----------- | ---------------------------------------- | ---- | -------------- | -| gesturePath | [GesturePath](js-apis-accessibility-GesturePath.md#gesturepath) | 是 | 表示手势的路径信息。 | -| callback | AsyncCallback<void> | 是 | 回调函数,表示注入手势执行结果的回调。 | +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ---------------------------------------- | ---- | ------------------- | +| gesturePath | [GesturePath](js-apis-accessibility-GesturePath.md#gesturepath) | 是 | 表示手势的路径信息。 | +| callback | AsyncCallback<void> | 是 | 回调函数,表示注入手势执行结果的回调。 | **错误码:** 以下错误码的详细介绍请参见[无障碍子系统错误码](../errorcodes/errorcode-accessibility.md)。 -| 错误码ID | 错误信息 | -| ------- | -------------------------------- | +| 错误码ID | 错误信息 | +| ------- | ---------------------------------------- | | 9300003 | Do not have accessibility right for this operation. | **示例:** @@ -594,7 +594,7 @@ try { gesturePath.points.push(gesturePoint); } axContext.injectGesture(gesturePath, (err, data) => { - if (err) { + if (err && err.code) { console.error('failed to inject gesture, because ${JSON.stringify(err)}'); return; } @@ -620,8 +620,8 @@ attributeNames\(): Promise\>; **返回值:** -| 类型 | 说明 | -| ---------------------------------------- | ------------------------ | +| 类型 | 说明 | +| ----------------------------- | ------------------------ | | Promise<Array<T>> | Promise对象,返回节点元素的所有属性名称。 | **示例:** @@ -646,9 +646,9 @@ attributeNames\(callback: AsyncCallback\ **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ----------- | ---------------------------------------- | ---- | -------------- | -| callback | AsyncCallback<Array<T>> | 是 | 回调函数,返回节点元素的所有属性名称。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------- | ---- | ------------------- | +| callback | AsyncCallback<Array<T>> | 是 | 回调函数,返回节点元素的所有属性名称。 | **示例:** @@ -674,22 +674,22 @@ attributeValue\(attributeName: T): Promi **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ----------- | ---------------------------------------- | ---- | -------------- | -| attributeName | T | 是 | 表示属性的名称。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------------- | ---- | ---- | -------- | +| attributeName | T | 是 | 表示属性的名称。 | **返回值:** -| 类型 | 说明 | -| ---------------------------------------- | ------------------------ | +| 类型 | 说明 | +| ---------------------------------------- | --------------------------- | | Promise<ElementAttributeValues[T]> | Promise对象,返回根据节点属性名称获取的属性值。 | **错误码:** 以下错误码的详细介绍请参见[无障碍子系统错误码](../errorcodes/errorcode-accessibility.md)。 -| 错误码ID | 错误信息 | -| ------- | -------------------------------- | +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | | 9300004 | This property does not exist. | **示例:** @@ -720,17 +720,17 @@ attributeValue\(attributeName: T, **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ----------- | ---------------------------------------- | ---- | -------------- | -| attributeName | T | 是 | 表示属性的名称。 | -| callback | AsyncCallback<ElementAttributeValues[T]> | 是 | 回调函数,返回根据节点属性名称获取的属性值。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------------- | ---------------------------------------- | ---- | ---------------------- | +| attributeName | T | 是 | 表示属性的名称。 | +| callback | AsyncCallback<ElementAttributeValues[T]> | 是 | 回调函数,返回根据节点属性名称获取的属性值。 | **错误码:** 以下错误码的详细介绍请参见[无障碍子系统错误码](../errorcodes/errorcode-accessibility.md)。 -| 错误码ID | 错误信息 | -| ------- | -------------------------------- | +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | | 9300004 | This property does not exist. | **示例:** @@ -762,8 +762,8 @@ actionNames(): Promise\>; **返回值:** -| 类型 | 说明 | -| ---------------------------------------- | ------------------------ | +| 类型 | 说明 | +| ---------------------------------- | -------------------------- | | Promise<Array<string>> | Promise对象,返回节点元素支持的所有操作名称。 | **示例:** @@ -788,9 +788,9 @@ actionNames(callback: AsyncCallback\>): void; **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ----------- | ---------------------------------------- | ---- | -------------- | -| callback | AsyncCallback<Array<string>> | 是 | 回调函数,返回节点元素支持的所有操作名称。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------------------------- | ---- | --------------------- | +| callback | AsyncCallback<Array<string>> | 是 | 回调函数,返回节点元素支持的所有操作名称。 | **示例:** @@ -818,21 +818,21 @@ performAction(actionName: string, parameters?: object): Promise\; | 参数名 | 类型 | 必填 | 说明 | | ----------- | ---------------------------------------- | ---- | -------------- | -| actionName | string | 是 | 表示属性的名称。 | -| parameters | object | 否 | 表示执行操作时所需要的参数。 | +| actionName | string | 是 | 表示属性的名称,取值参考[Action](./js-apis-accessibility.md#action)。 +| parameters | object | 否 | 表示执行操作时所需要的参数;当前版本暂不支持。 | **返回值:** -| 类型 | 说明 | -| ---------------------------------------- | ------------------------ | +| 类型 | 说明 | +| ------------------- | ---------------- | | Promise<void> | 无返回结果的Promise对象。 | **错误码:** 以下错误码的详细介绍请参见[无障碍子系统错误码](../errorcodes/errorcode-accessibility.md)。 -| 错误码ID | 错误信息 | -| ------- | -------------------------------- | +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | | 9300005 | This action is not supported. | **示例:** @@ -861,15 +861,15 @@ performAction(actionName: string, callback: AsyncCallback\): void; | 参数名 | 类型 | 必填 | 说明 | | ----------- | ---------------------------------------- | ---- | -------------- | -| actionName | string | 是 | 表示属性的名称。 | +| actionName | string | 是 | 表示属性的名称,取值参考[Action](./js-apis-accessibility.md#action)。 | callback | AsyncCallback<void> | 是 | 回调函数,表示执行指定操作的回调。| **错误码:** 以下错误码的详细介绍请参见[无障碍子系统错误码](../errorcodes/errorcode-accessibility.md)。 -| 错误码ID | 错误信息 | -| ------- | -------------------------------- | +| 错误码ID | 错误信息 | +| ------- | ----------------------------- | | 9300005 | This action is not supported. | **示例:** @@ -898,18 +898,18 @@ performAction(actionName: string, parameters: object, callback: AsyncCallback\ { - if (error && error.code) { + if (error) { console.log('getForegroundApplications failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); return; } diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationContext.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationContext.md index a85e243fd61273ba7ab495cc8f3b092443e5af17..44e683a0961defa502ef29e61f2d5914b1420096 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationContext.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationContext.md @@ -88,7 +88,7 @@ export default class EntryAbility extends UIAbility { } ``` -## ApplicationContext.off(type: 'abilityLifecycle', callbackId: number, callback: AsyncCallback) +## ApplicationContext.off(type: 'abilityLifecycle', callbackId: number, callback: AsyncCallback\) off(type: 'abilityLifecycle', callbackId: **number**, callback: AsyncCallback<**void**>): **void**; @@ -115,8 +115,8 @@ export default class EntryAbility extends UIAbility { onDestroy() { let applicationContext = this.context.getApplicationContext(); console.log('stage applicationContext: ${applicationContext}'); - applicationContext.off(type: 'abilityLifecycle', lifecycleId, (error, data) => { - if (error && error.code !== 0) { + applicationContext.off('abilityLifecycle', lifecycleId, (error, data) => { + if (error) { console.error('unregisterAbilityLifecycleCallback fail, err: ${JSON.stringify(error)}'); } else { console.log('unregisterAbilityLifecycleCallback success, data: ${JSON.stringify(data)}'); @@ -152,7 +152,7 @@ export default class MyAbility extends Ability { onDestroy() { let applicationContext = this.context.getApplicationContext(); console.log('stage applicationContext: ${applicationContext}'); - applicationContext.off(type: 'abilityLifecycle', lifecycleId); + applicationContext.off('abilityLifecycle', lifecycleId); } } ``` @@ -206,7 +206,7 @@ export default class EntryAbility extends UIAbility { } ``` -## ApplicationContext.off(type: 'environment', callbackId: number, callback: AsyncCallback) +## ApplicationContext.off(type: 'environment', callbackId: number, callback: AsyncCallback\) off(type: 'environment', callbackId: **number**, callback: AsyncCallback<**void**>): **void**; @@ -233,7 +233,7 @@ export default class EntryAbility extends UIAbility { onDestroy() { let applicationContext = this.context.getApplicationContext(); applicationContext.off('environment', callbackId, (error, data) => { - if (error && error.code !== 0) { + if (error) { console.error('unregisterEnvironmentCallback fail, err: ${JSON.stringify(error)}'); } else { console.log('unregisterEnvironmentCallback success, data: ${JSON.stringify(data)}'); @@ -291,6 +291,15 @@ getRunningProcessInformation(): Promise\>; | -------- | -------- | | Promise\> | 以Promise方式返回接口运行结果及有关运行进程的信息,可进行错误处理或其他自定义处理。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -320,12 +329,21 @@ getRunningProcessInformation(callback: AsyncCallback\ | -------- | -------- | |AsyncCallback\> | 以回调方式返回接口运行结果及有关运行进程的信息,可进行错误处理或其他自定义处理。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts let applicationContext = this.context.getApplicationContext(); applicationContext.getRunningProcessInformation((err, data) => { - if (err.code !== 0) { + if (err) { console.error('getRunningProcessInformation faile, err: ${JSON.stringify(err)}'); } else { console.log('The process running information is: ${JSON.stringify(data)}'); @@ -347,6 +365,14 @@ killAllProcesses(): Promise\; | -------- | -------- | | Promise\ | 以Promise方式返回杀死应用所在的进程结果。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000011 | The context does not exist. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -368,12 +394,20 @@ killAllProcesses(callback: AsyncCallback\); | -------- | -------- | |AsyncCallback\ | 以callback方式返回杀死应用所在的进程结果。 | +**错误码**: + +| 错误码ID | 错误信息 | +| ------- | -------- | +| 16000011 | The context does not exist. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts let applicationContext = this.context.getApplicationContext(); applicationContext.killAllProcesses(error => { - if (error && error.code !== 0) { + if (error) { console.error('killAllProcesses fail, error: ${JSON.stringify(error)}'); } }); diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-context.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-context.md index 2c78be7ca1adbe8592335d2f25f27efab5b0329e..8fe7e62465b288d5468dee12bb58174c4d62eec6 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-context.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-context.md @@ -20,7 +20,7 @@ Context模块提供了ability或application的上下文的能力,包括访问 | filesDir | string | 是 | 否 | 文件目录。 | | databaseDir | string | 是 | 否 | 数据库目录。 | | preferencesDir | string | 是 | 否 | preferences目录。 | -| bundleCodeDir | string | 是 | 否 | 安装包目录。 | +| bundleCodeDir | string | 是 | 否 | 安装包目录。不能拼接路径访问资源文件,请使用[资源管理接口](js-apis-resource-manager.md)访问资源。 | | distributedFilesDir | string | 是 | 否 | 分布式文件目录。 | | eventHub | [EventHub](js-apis-inner-application-eventHub.md) | 是 | 否 | 事件中心,提供订阅、取消订阅、触发事件对象。 | | area | contextConstant.[AreaMode](js-apis-app-ability-contextConstant.md) | 是 | 否 | 文件分区信息。 | @@ -47,14 +47,6 @@ createBundleContext(bundleName: string): Context; | -------- | -------- | | Context | 安装包的上下文。 | -**错误码:** - -| 错误码ID | 错误信息 | -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 - **示例:** ```ts @@ -62,7 +54,7 @@ let bundleContext; try { bundleContext = this.context.createBundleContext('com.example.test'); } catch (error) { - console.error('createBundleContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('createBundleContext failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` @@ -86,14 +78,6 @@ createModuleContext(moduleName: string): Context; | -------- | -------- | | Context | 模块的上下文。 | -**错误码:** - -| 错误码ID | 错误信息 | -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 - **示例:** ```ts @@ -101,7 +85,7 @@ let moduleContext; try { moduleContext = this.context.createModuleContext('entry'); } catch (error) { - console.error('createModuleContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('createModuleContext failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` @@ -126,14 +110,6 @@ createModuleContext(bundleName: string, moduleName: string): Context; | -------- | -------- | | Context | 模块的上下文。 | -**错误码:** - -| 错误码ID | 错误信息 | -| ------- | -------------------------------- | -| 401 | If the input parameter is not valid parameter. | - -以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 - **示例:** ```ts @@ -141,7 +117,7 @@ let moduleContext; try { moduleContext = this.context.createModuleContext('com.example.test', 'entry'); } catch (error) { - console.error('createModuleContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('createModuleContext failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` @@ -166,7 +142,7 @@ let applicationContext; try { applicationContext = this.context.getApplicationContext(); } catch (error) { - console.error('getApplicationContext failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getApplicationContext failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-continueCallback.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-continueCallback.md index 63c005cac40f77ebbf57a1ceab9fba2ef75a907d..768e509c1ec52fbd1060017a06dd431f253b108a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-continueCallback.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-continueCallback.md @@ -38,7 +38,7 @@ Mission迁移完成后调用,返回迁移结果。 distributedMissionManager.continueMission(continueDeviceInfo, continueCallback, (error) => { if (error && error.code) { - console.error('continueMission failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('continueMission failed, error.code: ${error.code}, error.message: ${error.message}'); } console.log('continueMission finished'); }); diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md index 0a2b55830f4d7a3f6c5fe0d8fa3f1b1557aedd30..209d0a0567bf64818844ce7fac0057b31fa6de56 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md @@ -33,7 +33,7 @@ distributedMissionManager.continueMission(continueDeviceInfo, continueCallback, (error) => { if (error && error.code) { - console.error('continueMission failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('continueMission failed, error.code: ${error.code}, error.message: ${error.message}'); } console.log('continueMission finished'); }); diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-errorObserver.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-errorObserver.md index 989be4d2ddf279b004091d1a92eae152ee9e23e9..d18486f4fff03e6e5066159985929df272fb207d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-errorObserver.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-errorObserver.md @@ -30,6 +30,45 @@ let observer = { try { errorManager.on('error', observer); } catch (error) { - console.error('registerErrorObserver failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('registerErrorObserver failed, error.code: ${error.code}, error.message: ${error.message}'); +} +``` + +## ErrorObserver.onException + +onException?(errObject: Error): void; + +将在应用运行异常时调用。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| errObject | Error | 是 | 有关异常事件名字、消息和错误堆栈信息的对象。 | + +**示例:** + +```ts +import errorManager from '@ohos.app.ability.errorManager'; + +let observer = { + onUnhandledException(errorMsg) { + console.error('onUnhandledException, errorMsg: ', errorMsg); + }, + onException(errorObj) { + console.log('onException, name: ', errorObj.name); + console.log('onException, message: ', errorObj.message); + if (typeof(errorObj.stack) === 'string') { + console.log('onException, stack: ', errorObj.stack); + } + } +}; + +try { + errorManager.on('error', observer); +} catch (error) { + console.error('registerErrorObserver failed, error.code: ${error.code}, error.message: ${error.message}'); } ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md index 5dd3ccabac7f20b0c74aad2abf0cfa9a81f488c5..97efeab178d0ba376d2c47bbc39c77380c27aa54 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md @@ -32,7 +32,7 @@ import abilityManager from '@ohos.app.ability.abilityManager'; let upperLimit = 1; function getExtensionInfos() { abilityManager.getExtensionRunningInfos(upperLimit, (error, data) => { - if (error && error.code) { + if (error) { console.error('getForegroundApplications failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); return; } diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-formExtensionContext.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-formExtensionContext.md index 15734b7eb09bd941548b4ec9f1cfd6a63fe4697d..4a8293605d88b32b8569a8afca06b4fb01b34113 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-formExtensionContext.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-formExtensionContext.md @@ -41,6 +41,18 @@ startAbility(want: Want, callback: AsyncCallback<void>): void **系统能力**:SystemCapability.Ability.Form +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | -------- | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500100 | Failed to obtain the configuration information. | +| 16500101 | The application is not a system application. | +| 16501000 | An internal functional error occurred. | +|以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -65,7 +77,7 @@ export default class MyFormExtensionAbility extends FormExtensionAbility { 'message': message } }; - this.context.startAbility(want, (error, data) => { + this.context.startAbility(want, (error) => { if (error) { console.error('FormExtensionContext startAbility, error:${JSON.stringify(error)}'); } else { @@ -98,6 +110,18 @@ startAbility(want: Want): Promise<void> | ------------ | ---------------------------------- | | Promise<void> | 无返回结果的Promise对象。 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | -------- | +| 202 | The application is not a system application. | +| 401 | If the input parameter is not valid parameter. | +| 16500050 | An IPC connection error happened. | +| 16500100 | Failed to obtain the configuration information. | +| 16500101 | The application is not a system application. | +| 16501000 | An internal functional error occurred. | +|以上错误码的详细介绍请参见[卡片错误码](../errorcodes/errorcode-form.md)。|| + **示例:** ```ts diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionInfo.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionInfo.md index cab87eea78ef2427c8ae3c346f81552deff4a6a0..b0fd97e672bedbbc3bbfefb504eba7b742f3b9d3 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionInfo.md @@ -23,9 +23,9 @@ import missionManager from '@ohos.app.ability.missionManager'; try { missionManager.getMissionInfo('', 1, (error, data) => { - if (error.code) { + if (error) { // 处理业务逻辑错误 - console.error('getMissionInfo failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('getMissionInfo failed, error.code: ${error.code}, error.message: ${error.message}'); return; } diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionListener.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionListener.md index ee31283918f377d19d78cd89fe5c4f91d269286c..4cd21a38f960a8018100082cd70ad502b6722477 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionListener.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionListener.md @@ -31,9 +31,13 @@ let listener = { onMissionMovedToFront: function (mission) { console.log('onMissionMovedToFront mission: ${JSON.stringify(mission)}'); }, - onMissionIconUpdated: function (mission, icon) { - console.log('onMissionIconUpdated mission: ${JSON.stringify(mission)}'); + onMissionLabelUpdated: function (mission) { + console.log('onMissionLabelUpdated mission: ' + JSON.stringify(mission)); }, + onMissionIconUpdated: function (mission, icon) { + console.log('onMissionIconUpdated mission: ' + JSON.stringify(mission)); + console.log('onMissionIconUpdated icon: ' + JSON.stringify(icon)); + }, onMissionClosed: function (mission) { console.log('onMissionClosed mission: ${JSON.stringify(mission)}'); } diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md index cc8c511b378e4af108e98ce5051bd95d45e7c3c0..4fb11aecd33bc78210e3e8c07a47ddd8e836159d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md @@ -26,7 +26,7 @@ try { missionManager.getMissionInfos('', 10, (error, missions) => { - if (error.code) { + if (error) { console.error('getMissionInfos failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); return; } @@ -35,7 +35,7 @@ let id = missions[0].missionId; missionManager.getMissionSnapShot('', id, (err, snapshot) => { - if (err.code) { + if (err) { console.error('getMissionInfos failed, err.code: ${JSON.stringify(err.code)}, err.message: ${JSON.stringify(err.message)}'); return; } diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-pacMap.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-pacMap.md new file mode 100644 index 0000000000000000000000000000000000000000..aa62c06d90ec15bf2b2850c1c565736d31b6a069 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-pacMap.md @@ -0,0 +1,9 @@ +## PacMap + +[key: string]: number | string | boolean | Array\ | null; + +**系统能力**:SystemCapability.Ability.AbilityRuntime.FAModel + +| 参数名 | 参数类型 | 必填 | 说明 | +| ------ | ------ | ------ | ------ | +| [key: string] | number \| string \| boolean \| Array\ \| null | Yes| 数据存储在键值对中。| \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-processInformation.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-processInformation.md index 67d68c40c1955e6ed325c03e8a70687bbba5162e..9c53ad272f0146348ce4075baa608a031b4e139a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-processInformation.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-processInformation.md @@ -14,7 +14,7 @@ ProcessInformation模块提供对进程运行信息进行查询的能力。 import appManager from '@ohos.app.ability.appManager'; appManager.getRunningProcessInformation((error, data) => { - if (error && error.code !== 0) { + if (error) { console.error('getRunningProcessInformation fail, error: ${JSON.stringify(error)}'); } else { console.log('getRunningProcessInformation success, data: ${JSON.stringify(data)}'); diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md index 2b7f7978baf952ca18b79abaa50bd9af15233193..70bf03ef4bfefc91a671814da61b308c289cbf25 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md @@ -17,6 +17,7 @@ ServiceExtensionContext模块提供ServiceExtensionAbility具有的能力,包 import ServiceExtensionAbility from '@ohos.app.ability.ServiceExtensionAbility'; let context; + let commRemote; // 断开连接时需要释放 class EntryAbility extends ServiceExtensionAbility { onCreate() { context = this.context; // 获取ServiceExtensionContext @@ -45,25 +46,21 @@ startAbility(want: Want, callback: AsyncCallback<void>): void; | 错误码ID | 错误信息 | | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000004 | Visibility verification failed. | -| 16000005 | Static permission denied. The specified process does not have the permission. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000008 | Crowdtest App Expiration. | -| 16000009 | Can not start ability in wukong mode. | -| 16000010 | Can not operation with continue flag. | -| 16000011 | Context does not exist. | -| 16000051 | Network error. The network is abnormal. | -| 16000052 | Free install not support. The application does not support freeinstall | -| 16000053 | Not top ability. The application is not top ability. | -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry. | -| 16000055 | Free install timeout. | -| 16000056 | Can not free install other ability. | -| 16000057 | Not support cross device free install. | -| 16200001 | Caller released. The caller has been released. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000004 | Can not start invisible component. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000008 | The crowdtesting application expires. | +| 16000009 | An ability cannot be started or stopped in Wukong mode. | +| 16000010 | The call with the continuation flag is forbidden. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16000053 | The ability is not on the top of the UI. | +| 16000055 | Installation-free timed out. | +| 16200001 | The caller has been released. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 **示例:** @@ -77,7 +74,7 @@ startAbility(want: Want, callback: AsyncCallback<void>): void; this.context.startAbility(want, (error) => { if (error.code) { // 处理业务逻辑错误 - console.error('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // 执行正常业务 @@ -85,7 +82,7 @@ startAbility(want: Want, callback: AsyncCallback<void>): void; }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -116,25 +113,21 @@ startAbility(want: Want, options?: StartOptions): Promise\; | 错误码ID | 错误信息 | | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000004 | Visibility verification failed. | -| 16000005 | Static permission denied. The specified process does not have the permission. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000008 | Crowdtest App Expiration. | -| 16000009 | Can not start ability in wukong mode. | -| 16000010 | Can not operation with continue flag. | -| 16000011 | Context does not exist. | -| 16000051 | Network error. The network is abnormal. | -| 16000052 | Free install not support. The application does not support freeinstall | -| 16000053 | Not top ability. The application is not top ability. | -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry. | -| 16000055 | Free install timeout. | -| 16000056 | Can not free install other ability. | -| 16000057 | Not support cross device free install. | -| 16200001 | Caller released. The caller has been released. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000004 | Can not start invisible component. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000008 | The crowdtesting application expires. | +| 16000009 | An ability cannot be started or stopped in Wukong mode. | +| 16000010 | The call with the continuation flag is forbidden. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16000053 | The ability is not on the top of the UI. | +| 16000055 | Installation-free timed out. | +| 16200001 | The caller has been released. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 **示例:** @@ -155,11 +148,11 @@ startAbility(want: Want, options?: StartOptions): Promise\; }) .catch((error) => { // 处理业务逻辑错误 - console.error('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbility failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -185,25 +178,21 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void& | 错误码ID | 错误信息 | | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000004 | Visibility verification failed. | -| 16000005 | Static permission denied. The specified process does not have the permission. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000008 | Crowdtest App Expiration. | -| 16000009 | Can not start ability in wukong mode. | -| 16000010 | Can not operation with continue flag. | -| 16000011 | Context does not exist. | -| 16000051 | Network error. The network is abnormal. | -| 16000052 | Free install not support. The application does not support freeinstall | -| 16000053 | Not top ability. The application is not top ability. | -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry. | -| 16000055 | Free install timeout. | -| 16000056 | Can not free install other ability. | -| 16000057 | Not support cross device free install. | -| 16200001 | Caller released. The caller has been released. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000004 | Can not start invisible component. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000008 | The crowdtesting application expires. | +| 16000009 | An ability cannot be started or stopped in Wukong mode. | +| 16000010 | The call with the continuation flag is forbidden. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16000053 | The ability is not on the top of the UI. | +| 16000055 | Installation-free timed out. | +| 16200001 | The caller has been released. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 **示例:** @@ -221,7 +210,7 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void& this.context.startAbility(want, options, (error) => { if (error.code) { // 处理业务逻辑错误 - console.error('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // 执行正常业务 @@ -229,7 +218,7 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void& }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -241,7 +230,7 @@ startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\< 使用规则: - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限 - - 跨应用场景下,目标Ability的visible属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 + - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md) **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -260,26 +249,21 @@ startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\< | 错误码ID | 错误信息 | | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000004 | Visibility verification failed. | -| 16000005 | Static permission denied. The specified process does not have the permission. | -| 16000006 | Can not cross user operations. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000008 | Crowdtest App Expiration. | -| 16000009 | Can not start ability in wukong mode. | -| 16000010 | Can not operation with continue flag. | -| 16000011 | Context does not exist. | -| 16000051 | Network error. The network is abnormal. | -| 16000052 | Free install not support. The application does not support freeinstall | -| 16000053 | Not top ability. The application is not top ability. | -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry. | -| 16000055 | Free install timeout. | -| 16000056 | Can not free install other ability. | -| 16000057 | Not support cross device free install. | -| 16200001 | Caller released. The caller has been released. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000004 | Can not start invisible component. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000008 | The crowdtesting application expires. | +| 16000009 | An ability cannot be started or stopped in Wukong mode. | +| 16000010 | The call with the continuation flag is forbidden. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16000053 | The ability is not on the top of the UI. | +| 16000055 | Installation-free timed out. | +| 16200001 | The caller has been released. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 **示例:** @@ -295,7 +279,7 @@ startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\< this.context.startAbilityWithAccount(want, accountId, (error) => { if (error.code) { // 处理业务逻辑错误 - console.error('startAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // 执行正常业务 @@ -303,7 +287,7 @@ startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\< }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -315,7 +299,7 @@ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, ca 使用规则: - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限 - - 跨应用场景下,目标Ability的visible属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 + - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md) **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -335,26 +319,21 @@ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, ca | 错误码ID | 错误信息 | | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000004 | Visibility verification failed. | -| 16000005 | Static permission denied. The specified process does not have the permission. | -| 16000006 | Can not cross user operations. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000008 | Crowdtest App Expiration. | -| 16000009 | Can not start ability in wukong mode. | -| 16000010 | Can not operation with continue flag. | -| 16000011 | Context does not exist. | -| 16000051 | Network error. The network is abnormal. | -| 16000052 | Free install not support. The application does not support freeinstall | -| 16000053 | Not top ability. The application is not top ability. | -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry. | -| 16000055 | Free install timeout. | -| 16000056 | Can not free install other ability. | -| 16000057 | Not support cross device free install. | -| 16200001 | Caller released. The caller has been released. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000004 | Can not start invisible component. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000008 | The crowdtesting application expires. | +| 16000009 | An ability cannot be started or stopped in Wukong mode. | +| 16000010 | The call with the continuation flag is forbidden. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16000053 | The ability is not on the top of the UI. | +| 16000055 | Installation-free timed out. | +| 16200001 | The caller has been released. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 **示例:** @@ -373,7 +352,7 @@ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, ca this.context.startAbilityWithAccount(want, accountId, options, (error) => { if (error.code) { // 处理业务逻辑错误 - console.error('startAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // 执行正常业务 @@ -381,7 +360,7 @@ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, ca }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -394,7 +373,7 @@ startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): 使用规则: - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限 - - 跨应用场景下,目标Ability的visible属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 + - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md) **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -419,26 +398,21 @@ startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): | 错误码ID | 错误信息 | | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000004 | Visibility verification failed. | -| 16000005 | Static permission denied. The specified process does not have the permission. | -| 16000006 | Can not cross user operations. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000008 | Crowdtest App Expiration. | -| 16000009 | Can not start ability in wukong mode. | -| 16000010 | Can not operation with continue flag. | -| 16000011 | Context does not exist. | -| 16000051 | Network error. The network is abnormal. | -| 16000052 | Free install not support. The application does not support freeinstall | -| 16000053 | Not top ability. The application is not top ability. | -| 16000054 | Free install busyness. There are concurrent tasks, waiting for retry. | -| 16000055 | Free install timeout. | -| 16000056 | Can not free install other ability. | -| 16000057 | Not support cross device free install. | -| 16200001 | Caller released. The caller has been released. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000004 | Can not start invisible component. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000008 | The crowdtesting application expires. | +| 16000009 | An ability cannot be started or stopped in Wukong mode. | +| 16000010 | The call with the continuation flag is forbidden. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16000053 | The ability is not on the top of the UI. | +| 16000055 | Installation-free timed out. | +| 16200001 | The caller has been released. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 **示例:** @@ -461,11 +435,11 @@ startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): }) .catch((error) => { // 处理业务逻辑错误 - console.error('startAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -490,18 +464,16 @@ startServiceExtensionAbility(want: Want, callback: AsyncCallback\): void; | 错误码ID | 错误信息 | | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong. | -| 16000004 | Visibility verification failed. | -| 16000005 | Static permission denied. The specified process does not have the permission. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000008 | Crowdtest App Expiration. | -| 16000009 | Can not start ability in wukong mode. | -| 16000011 | Context does not exist. | -| 16200001 | Caller released. The caller has been released. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000008 | The crowdtesting application expires. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16200001 | The caller has been released. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 **示例:** @@ -516,7 +488,7 @@ startServiceExtensionAbility(want: Want, callback: AsyncCallback\): void; this.context.startServiceExtensionAbility(want, (error) => { if (error.code) { // 处理业务逻辑错误 - console.error('startServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // 执行正常业务 @@ -524,7 +496,7 @@ startServiceExtensionAbility(want: Want, callback: AsyncCallback\): void; }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -554,18 +526,16 @@ startServiceExtensionAbility(want: Want): Promise\; | 错误码ID | 错误信息 | | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong. | -| 16000004 | Visibility verification failed. | -| 16000005 | Static permission denied. The specified process does not have the permission. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000008 | Crowdtest App Expiration. | -| 16000009 | Can not start ability in wukong mode. | -| 16000011 | Context does not exist. | -| 16200001 | Caller released. The caller has been released. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000008 | The crowdtesting application expires. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16200001 | The caller has been released. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 **示例:** @@ -584,11 +554,11 @@ startServiceExtensionAbility(want: Want): Promise\; }) .catch((error) => { // 处理业务逻辑错误 - console.error('startServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -616,19 +586,16 @@ startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: | 错误码ID | 错误信息 | | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong. | -| 16000004 | Visibility verification failed. | -| 16000005 | Static permission denied. The specified process does not have the permission. | -| 16000006 | Can not cross user operations. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000008 | Crowdtest App Expiration. | -| 16000009 | Can not start ability in wukong mode. | -| 16000011 | Context does not exist. | -| 16200001 | Caller released. The caller has been released. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000008 | The crowdtesting application expires. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16200001 | The caller has been released. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 **示例:** @@ -645,7 +612,7 @@ startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: this.context.startServiceExtensionAbilityWithAccount(want, accountId, (error) => { if (error.code) { // 处理业务逻辑错误 - console.error('startServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startServiceExtensionAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // 执行正常业务 @@ -653,7 +620,7 @@ startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -686,19 +653,16 @@ startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\ | 错误码ID | 错误信息 | | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong. | -| 16000004 | Visibility verification failed. | -| 16000005 | Static permission denied. The specified process does not have the permission. | -| 16000006 | Can not cross user operations. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000008 | Crowdtest App Expiration. | -| 16000009 | Can not start ability in wukong mode. | -| 16000011 | Context does not exist. | -| 16200001 | Caller released. The caller has been released. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000008 | The crowdtesting application expires. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16200001 | The caller has been released. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 **示例:** @@ -718,11 +682,11 @@ startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\ }) .catch((error) => { // 处理业务逻辑错误 - console.error('startServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startServiceExtensionAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -747,15 +711,15 @@ stopServiceExtensionAbility(want: Want, callback: AsyncCallback\): void; | 错误码ID | 错误信息 | | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong. | -| 16000004 | Visibility verification failed. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000011 | Context does not exist. | -| 16200001 | Caller released. The caller has been released. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16200001 | The caller has been released. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 **示例:** @@ -770,7 +734,7 @@ stopServiceExtensionAbility(want: Want, callback: AsyncCallback\): void; this.context.stopServiceExtensionAbility(want, (error) => { if (error.code) { // 处理业务逻辑错误 - console.error('stopServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('stopServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // 执行正常业务 @@ -778,7 +742,7 @@ stopServiceExtensionAbility(want: Want, callback: AsyncCallback\): void; }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -808,15 +772,15 @@ stopServiceExtensionAbility(want: Want): Promise\; | 错误码ID | 错误信息 | | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong. | -| 16000004 | Visibility verification failed. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000011 | Context does not exist. | -| 16200001 | Caller released. The caller has been released. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16200001 | The caller has been released. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 **示例:** @@ -835,11 +799,11 @@ stopServiceExtensionAbility(want: Want): Promise\; }) .catch((error) => { // 处理业务逻辑错误 - console.error('stopServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('stopServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -867,16 +831,15 @@ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: | 错误码ID | 错误信息 | | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong. | -| 16000004 | Visibility verification failed. | -| 16000006 | Can not cross user operations. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000011 | Context does not exist. | -| 16200001 | Caller released. The caller has been released. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16200001 | The caller has been released. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 **示例:** @@ -892,7 +855,7 @@ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: this.context.stopServiceExtensionAbilityWithAccount(want, accountId, (error) => { if (error.code) { // 处理业务逻辑错误 - console.error('stopServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code), error.message: ${JSON.stringify(error.message)}'); + console.error('stopServiceExtensionAbilityWithAccount failed, error.code: ${error.code, error.message: ${error.message}'); return; } // 执行正常业务 @@ -900,7 +863,7 @@ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -933,16 +896,15 @@ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\< | 错误码ID | 错误信息 | | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong. | -| 16000004 | Visibility verification failed. | -| 16000006 | Can not cross user operations. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000011 | Context does not exist. | -| 16200001 | Caller released. The caller has been released. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16200001 | The caller has been released. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 **示例:** @@ -962,11 +924,11 @@ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\< }) .catch((error) => { // 处理业务逻辑错误 - console.error('stopServiceExtensionAbilityWithAccount failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('stopServiceExtensionAbilityWithAccount failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -990,12 +952,14 @@ terminateSelf(callback: AsyncCallback<void>): void; | 错误码ID | 错误信息 | | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000011 | Context does not exist. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000004 | Can not start invisible component. | +| 16000005 | The specified process does not have the permission. | +| 16000009 | An ability cannot be started or stopped in Wukong mode. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 **示例:** @@ -1003,7 +967,7 @@ terminateSelf(callback: AsyncCallback<void>): void; this.context.terminateSelf((error) => { if (error.code) { // 处理业务逻辑错误 - console.error('terminateSelf failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('terminateSelf failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // 执行正常业务 @@ -1031,12 +995,14 @@ terminateSelf(): Promise<void>; | 错误码ID | 错误信息 | | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | -| 16000011 | Context does not exist. | -| 16000050 | Internal Error. | +| 16000001 | The specified ability does not exist. | +| 16000004 | Can not start invisible component. | +| 16000005 | The specified process does not have the permission. | +| 16000009 | An ability cannot be started or stopped in Wukong mode. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 **示例:** @@ -1046,7 +1012,7 @@ terminateSelf(): Promise<void>; console.log('terminateSelf succeed'); }).catch((error) => { // 处理业务逻辑错误 - console.error('terminateSelf failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('terminateSelf failed, error.code: ${error.code}, error.message: ${error.message}'); }); ``` @@ -1077,14 +1043,13 @@ connectServiceExtensionAbility(want: Want, options: ConnectOptions): number; | 错误码ID | 错误信息 | | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | | 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong. | -| 16000004 | Visibility verification failed. | -| 16000011 | Context does not exist. | +| 16000005 | The specified process does not have the permission. | +| 16000011 | The context does not exist. | | 16000050 | Internal Error. | +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -1093,7 +1058,10 @@ connectServiceExtensionAbility(want: Want, options: ConnectOptions): number; abilityName: 'MyAbility' }; let options = { - onConnect(elementName, remote) { console.log('----------- onConnect -----------') }, + onConnect(elementName, remote) { + commRemote = remote; + console.log('----------- onConnect -----------'); + }, onDisconnect(elementName) { console.log('----------- onDisconnect -----------') }, onFailed(code) { console.error('----------- onFailed -----------') } }; @@ -1103,7 +1071,7 @@ connectServiceExtensionAbility(want: Want, options: ConnectOptions): number; connection = this.context.connectServiceExtensionAbility(want, options); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1135,15 +1103,13 @@ connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options | 错误码ID | 错误信息 | | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | | 16000001 | Input error. The specified ability name does not exist. | -| 16000002 | Ability type error. The specified ability type is wrong. | -| 16000004 | Visibility verification failed. | -| 16000006 | Can not cross user operations. | -| 16000011 | Context does not exist. | +| 16000005 | The specified process does not have the permission. | +| 16000011 | The context does not exist. | | 16000050 | Internal Error. | +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -1154,7 +1120,10 @@ connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options }; let accountId = 100; let options = { - onConnect(elementName, remote) { console.log('----------- onConnect -----------'); }, + onConnect(elementName, remote) { + commRemote = remote; + console.log('----------- onConnect -----------'); + }, onDisconnect(elementName) { console.log('----------- onDisconnect -----------'); }, onFailed(code) { console.log('----------- onFailed -----------'); } }; @@ -1164,7 +1133,7 @@ connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options connection = this.context.connectServiceExtensionAbilityWithAccount(want, accountId, options); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1172,7 +1141,7 @@ connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options disconnectServiceExtensionAbility(connection: number, callback:AsyncCallback<void>): void; -将一个Ability与绑定的服务类型的Ability解绑。 +将一个Ability与绑定的服务类型的Ability解绑,断开连接之后需要将连接成功时返回的remote对象置空。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -1189,13 +1158,11 @@ disconnectServiceExtensionAbility(connection: number, callback:AsyncCallback< | 错误码ID | 错误信息 | | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000003 | Input error. The specified id does not exist. | -| 16000011 | Context does not exist. | +| 16000011 | The context does not exist. | | 16000050 | Internal Error. | +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -1204,17 +1171,19 @@ disconnectServiceExtensionAbility(connection: number, callback:AsyncCallback< try { this.context.disconnectServiceExtensionAbility(connection, (error) => { + commRemote = null; if (error.code) { // 处理业务逻辑错误 - console.error('disconnectServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('disconnectServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // 执行正常业务 console.log('disconnectServiceExtensionAbility succeed'); }); } catch (paramError) { + commRemote = null; // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1222,7 +1191,7 @@ disconnectServiceExtensionAbility(connection: number, callback:AsyncCallback< disconnectServiceExtensionAbility(connection: number): Promise<void>; -将一个Ability与绑定的服务类型的Ability解绑。通过Promise返回结果。 +将一个Ability与绑定的服务类型的Ability解绑,断开连接之后需要将连接成功时返回的remote对象置空(Promise形式返回结果)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -1244,13 +1213,11 @@ disconnectServiceExtensionAbility(connection: number): Promise<void>; | 错误码ID | 错误信息 | | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | -| 16000001 | Input error. The specified ability name does not exist. | -| 16000003 | Input error. The specified id does not exist. | -| 16000011 | Context does not exist. | +| 16000011 | The context does not exist. | | 16000050 | Internal Error. | +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 + **示例:** ```ts @@ -1260,16 +1227,19 @@ disconnectServiceExtensionAbility(connection: number): Promise<void>; try { this.context.disconnectServiceExtensionAbility(connection) .then((data) => { + commRemote = null; // 执行正常业务 console.log('disconnectServiceExtensionAbility succeed'); }) .catch((error) => { + commRemote = null; // 处理业务逻辑错误 - console.error('disconnectServiceExtensionAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('disconnectServiceExtensionAbility failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { + commRemote = null; // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1281,7 +1251,7 @@ startAbilityByCall(want: Want): Promise<Caller>; 使用规则: - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限 - - 跨应用场景下,目标Ability的visible属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 + - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 - 同设备与跨设备场景下,该接口的使用规则存在差异,详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md) **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -1304,15 +1274,17 @@ startAbilityByCall(want: Want): Promise<Caller>; | 错误码ID | 错误信息 | | ------- | -------------------------------- | -| 201 | The application does not have permission to call the interface. | -| 401 | Invalid input parameter. | | 16000001 | Input error. The specified ability name does not exist. | +| 16000002 | Incorrect ability type. | | 16000004 | Visibility verification failed. | | 16000005 | Static permission denied. The specified process does not have the permission. | -| 16000007 | Service busyness. There are concurrent tasks, waiting for retry. | +| 16000006 | Cross-user operations are not allowed. | | 16000008 | Crowdtest App Expiration. | -| 16000009 | Can not start ability in wukong mode. | +| 16000011 | The context does not exist. | | 16000050 | Internal Error. | +| 16200001 | The caller has been released. | + +以上错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md)。 **示例:** @@ -1337,11 +1309,11 @@ startAbilityByCall(want: Want): Promise<Caller>; console.log('startAbilityByCall succeed'); }).catch((error) => { // 处理业务逻辑错误 - console.error('startAbilityByCall failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbilityByCall failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -1369,10 +1341,10 @@ startAbilityByCall(want: Want): Promise<Caller>; console.log('startAbilityByCall succeed'); }).catch((error) => { // 处理业务逻辑错误 - console.error('startAbilityByCall failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbilityByCall failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-shellCmdResult.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-shellCmdResult.md index 35c5f6cf8286d207fb5492bff09f78a0d3ad607d..98b00530ca021ebb02ef94820a547fa6362abc3f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-shellCmdResult.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-shellCmdResult.md @@ -25,7 +25,7 @@ let cmd = 'cmd'; abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator(); abilityDelegator.executeShellCommand(cmd, (error: any, data: any) => { - if (error && error.code !== 0) { + if (error) { console.error('executeShellCommand fail, error: ${JSON.stringify(error)}'); } else { console.log('executeShellCommand success, data: ${JSON.stringify(data)}'); diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md index 61bee851f877695cf4cacfbe4eb4ab51ac501a6e..af98dbea4d4b39c5800d3f9ff5ee606929da3c71 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md @@ -29,7 +29,7 @@ startAbility(want: Want, callback: AsyncCallback<void>): void; 使用规则: - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限 - - 跨应用场景下,目标Ability的visible属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 + - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md) **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -59,6 +59,8 @@ startAbility(want: Want, callback: AsyncCallback<void>): void; | 16000055 | Installation-free timed out. | | 16200001 | The caller has been released. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -91,7 +93,7 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void& 使用规则: - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限 - - 跨应用场景下,目标Ability的visible属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 + - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md) **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -122,6 +124,8 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void& | 16000055 | Installation-free timed out. | | 16200001 | The caller has been released. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -158,7 +162,7 @@ startAbility(want: Want, options?: StartOptions): Promise<void>; 使用规则: - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限 - - 跨应用场景下,目标Ability的visible属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 + - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md) **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -194,6 +198,8 @@ startAbility(want: Want, options?: StartOptions): Promise<void>; | 16000055 | Installation-free timed out. | | 16200001 | The caller has been released. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -232,7 +238,7 @@ startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): 使用规则: - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限 - - 跨应用场景下,目标Ability的visible属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 + - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md) **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -262,6 +268,8 @@ startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): | 16000055 | Installation-free timed out. | | 16200001 | The caller has been released. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -298,7 +306,7 @@ startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback 使用规则: - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限 - - 跨应用场景下,目标Ability的visible属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 + - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md) **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -329,6 +337,8 @@ startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback | 16000055 | Installation-free timed out. | | 16200001 | The caller has been released. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -369,7 +379,7 @@ startAbilityForResult(want: Want, options?: StartOptions): Promise<AbilityRes 使用规则: - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限 - - 跨应用场景下,目标Ability的visible属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 + - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md) **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -406,6 +416,8 @@ startAbilityForResult(want: Want, options?: StartOptions): Promise<AbilityRes | 16000055 | Installation-free timed out. | | 16200001 | The caller has been released. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -441,7 +453,7 @@ startAbilityForResultWithAccount(want: Want, accountId: number, callback: AsyncC 使用规则: - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限 - - 跨应用场景下,目标Ability的visible属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 + - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md) **需要权限**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS,当accountId为当前用户时,不需要校验该权限。 @@ -476,6 +488,8 @@ startAbilityForResultWithAccount(want: Want, accountId: number, callback: AsyncC | 16000055 | Installation-free timed out. | | 16200001 | The caller has been released. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -511,7 +525,7 @@ startAbilityForResultWithAccount(want: Want, accountId: number, options: StartOp 使用规则: - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限 - - 跨应用场景下,目标Ability的visible属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 + - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md) **需要权限**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS,当accountId为当前用户时,不需要校验该权限。 @@ -547,6 +561,8 @@ startAbilityForResultWithAccount(want: Want, accountId: number, options: StartOp | 16000055 | Installation-free timed out. | | 16200001 | The caller has been released. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -585,7 +601,7 @@ startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartO 使用规则: - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限 - - 跨应用场景下,目标Ability的visible属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 + - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md) **需要权限**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS,当accountId为当前用户时,不需要校验该权限。 @@ -626,6 +642,8 @@ startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartO | 16000055 | Installation-free timed out. | | 16200001 | The caller has been released. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -684,6 +702,8 @@ startServiceExtensionAbility(want: Want, callback: AsyncCallback\): void; | 16000050 | Internal error. | | 16200001 | The caller has been released. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -738,6 +758,8 @@ startServiceExtensionAbility(want: Want): Promise\; | 16000050 | Internal error. | | 16200001 | The caller has been released. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -796,6 +818,8 @@ startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: | 16000050 | Internal error. | | 16200001 | The caller has been released. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -854,6 +878,8 @@ startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\ | 16000050 | Internal error. | | 16200001 | The caller has been released. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -908,6 +934,8 @@ stopServiceExtensionAbility(want: Want, callback: AsyncCallback\): void; | 16000050 | Internal error. | | 16200001 | The caller has been released. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -961,6 +989,8 @@ stopServiceExtensionAbility(want: Want): Promise\; | 16000050 | Internal error. | | 16200001 | The caller has been released. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -1018,6 +1048,8 @@ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: | 16000050 | Internal error. | | 16200001 | The caller has been released. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -1075,6 +1107,8 @@ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\< | 16000050 | Internal error. | | 16200001 | The caller has been released. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -1126,6 +1160,8 @@ terminateSelf(callback: AsyncCallback<void>): void; | 16000011 | The context does not exist. | | 16000050 | Internal error. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -1171,6 +1207,8 @@ terminateSelf(): Promise<void>; | 16000011 | The context does not exist. | | 16000050 | Internal error. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -1217,6 +1255,8 @@ terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<voi | 16000011 | The context does not exist. | | 16000050 | Internal error. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -1279,6 +1319,8 @@ terminateSelfWithResult(parameter: AbilityResult): Promise<void>; | 16000011 | The context does not exist. | | 16000050 | Internal error. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -1339,6 +1381,8 @@ connectServiceExtensionAbility(want: Want, options: ConnectOptions): number; | 16000011 | The context does not exist. | | 16000050 | Internal error. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -1349,6 +1393,7 @@ let want = { }; let options = { onConnect(elementName, remote) { + commRemote = remote; console.info('onConnect...') }, onDisconnect(elementName) { @@ -1404,6 +1449,8 @@ connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options | 16000011 | The context does not exist. | | 16000050 | Internal error. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -1415,6 +1462,7 @@ let want = { let accountId = 100; let options = { onConnect(elementName, remote) { + commRemote = remote; console.info('onConnect...') }, onDisconnect(elementName) { @@ -1438,7 +1486,7 @@ try { disconnectServiceExtensionAbility(connection: number): Promise\; -断开与ServiceExtensionAbility的连接(promise形式)。 +断开与ServiceExtensionAbility的连接,断开连接之后需要将连接成功时返回的remote对象置空(promise形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -1458,11 +1506,11 @@ disconnectServiceExtensionAbility(connection: number): Promise\; | 错误码ID | 错误信息 | | ------- | -------------------------------- | -| 16000001 | The specified ability does not exist. | -| 16000005 | The specified process does not have the permission. | | 16000011 | The context does not exist. | | 16000050 | Internal error. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -1471,6 +1519,7 @@ let connection = 1; try { this.context.disconnectServiceExtensionAbility(connection, (err) => { + commRemote = null; if (err.code) { // 处理业务逻辑错误 console.error(`disconnectServiceExtensionAbility failed, code is ${err.code}, message is ${err.message}`); @@ -1480,6 +1529,7 @@ try { console.info('disconnectServiceExtensionAbility succeed'); }); } catch (err) { + commRemote = null; // 处理入参错误异常 console.error(`disconnectServiceExtensionAbility failed, code is ${err.code}, message is ${err.message}`); } @@ -1489,7 +1539,7 @@ try { disconnectServiceExtensionAbility(connection: number, callback:AsyncCallback\): void; -断开与ServiceExtensionAbility的连接(callback形式)。 +断开与ServiceExtensionAbility的连接,断开连接之后需要将连接成功时返回的remote对象置空(callback形式)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -1504,11 +1554,11 @@ disconnectServiceExtensionAbility(connection: number, callback:AsyncCallback\ { + commRemote = null; if (err.code) { // 处理业务逻辑错误 console.error(`disconnectServiceExtensionAbility failed, code is ${err.code}, message is ${err.message}`); @@ -1526,6 +1577,7 @@ try { console.info('disconnectServiceExtensionAbility succeed'); }); } catch (err) { + commRemote = null; // 处理入参错误异常 console.error(`disconnectServiceExtensionAbility failed, code is ${err.code}, message is ${err.message}`); } @@ -1539,7 +1591,7 @@ startAbilityByCall(want: Want): Promise<Caller>; 使用规则: - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限 - - 跨应用场景下,目标Ability的visible属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 + - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 - 同设备与跨设备场景下,该接口的使用规则存在差异,详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md) **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -1566,14 +1618,12 @@ startAbilityByCall(want: Want): Promise<Caller>; | 16000005 | The specified process does not have the permission. | | 16000006 | Cross-user operations are not allowed. | | 16000008 | The crowdtesting application expires. | -| 16000009 | An ability cannot be started or stopped in Wukong mode. | -| 16000010 | The call with the continuation flag is forbidden. | | 16000011 | The context does not exist. | | 16000050 | Internal error. | -| 16000053 | The ability is not on the top of the UI. | -| 16000055 | Installation-free timed out. | | 16200001 | The caller has been released. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** 后台启动: @@ -1645,7 +1695,7 @@ startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\< 使用规则: - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限 - - 跨应用场景下,目标Ability的visible属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 + - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md) **需要权限**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS,当accountId为当前用户时,不需要校验该权限。 @@ -1680,6 +1730,8 @@ startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\< | 16000055 | Installation-free timed out. | | 16200001 | The caller has been released. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -1715,7 +1767,7 @@ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, ca 使用规则: - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限 - - 跨应用场景下,目标Ability的visible属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 + - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md) **需要权限**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS,当accountId为当前用户时,不需要校验该权限。 @@ -1751,6 +1803,8 @@ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, ca | 16000055 | Installation-free timed out. | | 16200001 | The caller has been released. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -1789,7 +1843,7 @@ startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): 使用规则: - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限 - - 跨应用场景下,目标Ability的visible属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 + - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限 - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md) **需要权限**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS,当accountId为当前用户时,不需要校验该权限。 @@ -1824,6 +1878,8 @@ startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): | 16000055 | Installation-free timed out. | | 16200001 | The caller has been released. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -1868,6 +1924,15 @@ setMissionLabel(label: string, callback:AsyncCallback<void>): void; | label | string | 是 | 显示名称。 | | callback | AsyncCallback<void> | 是 | 回调函数,返回接口调用是否成功的结果。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------- | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | + +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -1903,6 +1968,8 @@ setMissionLabel(label: string): Promise<void>; | 16000011 | The context does not exist. | | 16000050 | Internal error. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -1936,6 +2003,8 @@ setMissionIcon(icon: image.PixelMap, callback:AsyncCallback\): void; | 16000011 | The context does not exist. | | 16000050 | Internal error. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -1991,6 +2060,8 @@ setMissionIcon(icon: image.PixelMap): Promise\; | 16000011 | The context does not exist. | | 16000050 | Internal error. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -2038,6 +2109,8 @@ restoreWindowStage(localStorage: LocalStorage) : void; | 16000011 | The context does not exist. | | 16000050 | Internal error. | +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -2064,7 +2137,8 @@ isTerminating(): boolean; | 错误码ID | 错误信息 | | ------- | -------------------------------- | | 16000011 | The context does not exist. | -| 16000050 | Internal error. | + +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) **示例:** @@ -2081,7 +2155,7 @@ requestDialogService(want: Want, result: AsyncCallback<dialogRequest.RequestR 使用规则: - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限。 - - 跨应用场景下,目标Ability的visible属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限。 + - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限。 - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -2093,6 +2167,26 @@ requestDialogService(want: Want, result: AsyncCallback<dialogRequest.RequestR | want |[Want](js-apis-application-want.md) | 是 | 启动ServiceExtensionAbility的want信息。 | | result | AsyncCallback<[dialogRequest.RequestResult](js-apis-app-ability-dialogRequest.md)> | 是 | 执行结果回调函数。 | +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------- | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000004 | Can not start invisible component. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000008 | The crowdtesting application expires. | +| 16000009 | An ability cannot be started or stopped in Wukong mode. | +| 16000010 | The call with the continuation flag is forbidden. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16000053 | The ability is not on the top of the UI. | +| 16000055 | Installation-free timed out. | +| 16200001 | The caller has been released. | + +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts @@ -2128,7 +2222,7 @@ requestDialogService(want: Want): Promise<dialogRequest.RequestResult>; 使用规则: - 调用方应用位于后台时,使用该接口启动Ability需申请`ohos.permission.START_ABILITIES_FROM_BACKGROUND`权限。 - - 跨应用场景下,目标Ability的visible属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限。 + - 跨应用场景下,目标Ability的exported属性若配置为false,调用方应用需申请`ohos.permission.START_INVISIBLE_ABILITY`权限。 - 组件启动规则详见:[组件启动规则(Stage模型)](../../application-models/component-startup-rules.md)。 **系统能力**:SystemCapability.Ability.AbilityRuntime.Core @@ -2146,6 +2240,26 @@ requestDialogService(want: Want): Promise<dialogRequest.RequestResult>; | -------- | -------- | | Promise<[dialogRequest.RequestResult](js-apis-app-ability-dialogRequest.md)> | Promise形式返回执行结果。 +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------- | +| 16000001 | The specified ability does not exist. | +| 16000002 | Incorrect ability type. | +| 16000004 | Can not start invisible component. | +| 16000005 | The specified process does not have the permission. | +| 16000006 | Cross-user operations are not allowed. | +| 16000008 | The crowdtesting application expires. | +| 16000009 | An ability cannot be started or stopped in Wukong mode. | +| 16000010 | The call with the continuation flag is forbidden. | +| 16000011 | The context does not exist. | +| 16000050 | Internal error. | +| 16000053 | The ability is not on the top of the UI. | +| 16000055 | Installation-free timed out. | +| 16200001 | The caller has been released. | + +错误码详细介绍请参考[errcode-ability](../errorcodes/errorcode-ability.md) + **示例:** ```ts diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-application-windowExtensionContext.md b/zh-cn/application-dev/reference/apis/js-apis-inner-application-windowExtensionContext.md index 363fce781c87703a4b5de91ebd2b3e0d4398589e..70808c6cf9a511ae825b4ab8b878978cd4b094b8 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-application-windowExtensionContext.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-application-windowExtensionContext.md @@ -58,7 +58,7 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void& this.context.startAbility(want, options, (error) => { if (error.code) { // 处理业务逻辑错误 - console.error('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbility failed, error.code: ${error.code}, error.message: ${error.message}'); return; } // 执行正常业务 @@ -66,7 +66,7 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void& }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` @@ -110,10 +110,10 @@ startAbility(want: Want, options?: StartOptions): Promise\ }) .catch((error) => { // 处理业务逻辑错误 - console.error('startAbility failed, error.code: ${JSON.stringify(error.code)}, error.message: ${JSON.stringify(error.message)}'); + console.error('startAbility failed, error.code: ${error.code}, error.message: ${error.message}'); }); } catch (paramError) { // 处理入参错误异常 - console.error('error.code: ${JSON.stringify(paramError.code)}, error.message: ${JSON.stringify(paramError.message)}'); + console.error('error.code: ${paramError.code}, error.message: ${paramError.message}'); } ``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventData.md b/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventData.md new file mode 100644 index 0000000000000000000000000000000000000000..e84f3b4abffbb032a8a79c489a780ad252158737 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventData.md @@ -0,0 +1,11 @@ +# CommonEventData + +**系统能力:** `SystemCapability.Notification.CommonEvent` + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ---------- |-------------------- | ---- | ---- | ------------------------------------------------------- | +| event | string | 是 | 否 | 表示当前接收的公共事件名称。 | +| bundleName | string | 是 | 否 | 表示包名称。 | +| code | number | 是 | 否 | 表示公共事件的结果代码,用于传递int类型的数据。 | +| data | string | 是 | 否 | 表示公共事件的自定义结果数据,用于传递string类型的数据。 | +| parameters | {[key: string]: any} | 是 | 否 | 表示公共事件的附加信息。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventPublishData.md b/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventPublishData.md new file mode 100644 index 0000000000000000000000000000000000000000..9d5fe786465e99ce4e85c49310943df600ccb8e6 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventPublishData.md @@ -0,0 +1,13 @@ +# CommonEventPublishData + +**系统能力:** `SystemCapability.Notification.CommonEvent` + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| --------------------- | -------------------- | ---- | ---- | ---------------------------- | +| bundleName | string | 是 | 否 | 表示包名称。 | +| code | number | 是 | 否 | 表示公共事件的结果代码。 | +| data | string | 是 | 否 | 表示公共事件的自定义结果数据。 | +| subscriberPermissions | Array\ | 是 | 否 | 表示订阅者的权限。 | +| isOrdered | boolean | 是 | 否 | 表示是否是有序事件。 | +| isSticky | boolean | 是 | 否 | 表示是否是粘性事件。仅系统应用或系统服务允许发送粘性事件。 | +| parameters | {[key: string]: any} | 是 | 否 | 表示公共事件的附加信息。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscribeInfo.md b/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscribeInfo.md new file mode 100644 index 0000000000000000000000000000000000000000..6938b5351b61ab96cf8d87cc78fc3333af21cfa6 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscribeInfo.md @@ -0,0 +1,11 @@ +# CommonEventSubscribeInfo + +**系统能力:** `SystemCapability.Notification.CommonEvent` + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ------------------- | -------------- | ---- | ---- | ------------------------------------------------------------ | +| events | Array\ | 是 | 否 | 表示要发送的公共事件。 | +| publisherPermission | string | 是 | 否 | 表示发布者的权限。 | +| publisherDeviceId | string | 是 | 否 | 表示设备ID,该值必须是同一ohos网络上的现有设备ID。 | +| userId | number | 是 | 否 | 表示用户ID。此参数是可选的,默认值当前用户的ID。如果指定了此参数,则该值必须是系统中现有的用户ID。 | +| priority | number | 是 | 否 | 表示订阅者的优先级。值的范围是-100到1000。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscriber.md b/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscriber.md new file mode 100644 index 0000000000000000000000000000000000000000..411b63e250403b1f5ee916d273f5306c88cda65c --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscriber.md @@ -0,0 +1,750 @@ +# CommonEventSubscriber + +## getCode + +```ts +getCode(callback: AsyncCallback): void +``` + +以回调形式获取公共事件代码。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | ------------------ | +| callback | AsyncCallback\ | 是 | 公共事件代码。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +//获取有序公共事件代码回调 +function getCodeCB(err, code) { + if (err.code) { + console.error(`getCode failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("getCode " + JSON.stringify(code)); + } +} +subscriber.getCode(getCodeCB); +``` + +## getCode + +```ts +getCode(): Promise +``` + +以Promise形式获取公共事件代码。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**返回值:** + +| 类型 | 说明 | +| ---------------- | -------------------- | +| Promise\ | 公共事件代码。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +subscriber.getCode().then((code) => { + console.info("getCode " + JSON.stringify(code)); +}).catch((err) => { + console.error(`getCode failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## setCode + +```ts +setCode(code: number, callback: AsyncCallback): void +``` + +以回调形式设置公共事件的代码。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | ---------------------- | +| code | number | 是 | 公共事件的代码。 | +| callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +//设置有序公共事件的代码回调 +function setCodeCB(err) { + if (err.code) { + console.error(`setCode failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("setCode"); + } +} +subscriber.setCode(1, setCodeCB); +``` + +## setCode + +```ts +setCode(code: number): Promise +``` + +以Promise形式设置公共事件的代码。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------------------ | +| code | number | 是 | 公共事件的代码。 | + +**返回值:** + +| 类型 | 说明 | +| ---------------- | -------------------- | +| Promise\ | 返回一个Promise的结果。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +subscriber.setCode(1).then(() => { + console.info("setCode"); +}).catch((err) => { + console.error(`setCode failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## getData + +```ts +getData(callback: AsyncCallback): void +``` + +以回调形式获取公共事件的数据。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | -------------------- | +| callback | AsyncCallback\ | 是 | 公共事件的数据。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +//获取有序公共事件代码数据回调 +function getDataCB(err, data) { + if (err.code) { + console.error(`getData failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("getData " + JSON.stringify(data)); + } +} +subscriber.getData(getDataCB); +``` + +## getData + +```ts +getData(): Promise +``` + +以Promise形式获取公共事件的数据。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ------------------ | +| Promise\ | 公共事件的数据。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +subscriber.getData().then((data) => { + console.info("getData " + JSON.stringify(data)); +}).catch((err) => { + console.error(`getData failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## setData + +setData(data: string, callback: AsyncCallback\): void + +以回调形式设置公共事件的数据。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | -------------------- | +| data | string | 是 | 公共事件的数据。 | +| callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +//设置有序公共事件的结果数据回调 +function setDataCB(err) { + if (err.code) { + console.error(`setCode failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("setData"); + } +} +subscriber.setData("publish_data_changed", setDataCB); +``` + +## setData + +```ts +setData(data: string): Promise +``` + +以Promise形式设置公共事件的果数据。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------- | +| data | string | 是 | 公共事件的数据。 | + +**返回值:** + +| 类型 | 说明 | +| ---------------- | -------------------- | +| Promise\ | 返回一个Promise的结果。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +subscriber.setData("publish_data_changed").then(() => { + console.info("setData"); +}).catch((err) => { + console.error(`setCode failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## setCodeAndData + +```ts +setCodeAndData(code: number, data: string, callback:AsyncCallback): void +``` + +以回调形式设置公共事件代码和数据。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | ---------------------- | +| code | number | 是 | 公共事件的代码。 | +| data | string | 是 | 公共事件的数据。 | +| callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +//设置有序公共事件的代码和数据回调 +function setCodeDataCB(err) { + if (err.code) { + console.error(`setCodeAndData failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("setCodeDataCallback"); + } +} +subscriber.setCodeAndData(1, "publish_data_changed", setCodeDataCB); +``` + +## setCodeAndData + +```ts +setCodeAndData(code: number, data: string): Promise +``` + +以Promise形式设置公共事件的代码和数据。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------- | +| code | number | 是 | 公共事件的代码。 | +| data | string | 是 | 公共事件的数据。 | + +**返回值:** + +| 类型 | 说明 | +| ---------------- | -------------------- | +| Promise\ | 返回一个Promise。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +subscriber.setCodeAndData(1, "publish_data_changed").then(() => { + console.info("setCodeAndData"); +}).catch((err) => { + console.error(`setCodeAndData failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## isOrderedCommonEvent + +```ts +isOrderedCommonEvent(callback: AsyncCallback): void +``` + +以回调形式查询当前公共事件的是否为有序公共事件。 + +返回true代表是有序公共事件,false代表不是有序公共事件。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | ---------------------------------- | +| callback | AsyncCallback\ | 是 | 当前公共事件的是否为有序公共事件。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +//获取当前公共事件是否为有序事件的回调 +function isOrderedCB(err, isOrdered) { + if (err.code) { + console.error(`isOrderedCommonEvent failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("isOrdered " + JSON.stringify(isOrdered)); + } +} +subscriber.isOrderedCommonEvent(isOrderedCB); +``` + +## isOrderedCommonEvent + +```ts +isOrderedCommonEvent(): Promise +``` + +以Promise形式查询当前公共事件的是否为有序公共事件。 + +返回true代表是有序公共事件,false代表不是有序公共事件。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**返回值:** + +| 类型 | 说明 | +| ----------------- | -------------------------------- | +| Promise\ | 当前公共事件的是否为有序公共事件。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +subscriber.isOrderedCommonEvent().then((isOrdered) => { + console.info("isOrdered " + JSON.stringify(isOrdered)); +}).catch((err) => { + console.error(`isOrdered failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## isStickyCommonEvent + +```ts +isStickyCommonEvent(callback: AsyncCallback): void +``` + +以回调形式检查当前公共事件是否为一个粘性事件。 + +返回true代表是粘性公共事件,false代表不是粘性公共事件。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | ---------------------------------- | +| callback | AsyncCallback\ | 是 | 当前公共事件的是否为粘性公共事件。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +//获取当前公共事件是否为粘性事件的回调 +function isStickyCB(err, isSticky) { + if (err.code) { + console.error(`isStickyCommonEvent failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("isSticky " + JSON.stringify(isSticky)); + } +} +subscriber.isStickyCommonEvent(isStickyCB); +``` + +## isStickyCommonEvent + +```ts +isStickyCommonEvent(): Promise +``` + +以Promise形式检查当前公共事件是否为一个粘性事件。 + +返回true代表是粘性公共事件,false代表不是粘性公共事件。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**返回值:** + +| 类型 | 说明 | +| ----------------- | -------------------------------- | +| Promise\ | 当前公共事件的是否为粘性公共事件。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +subscriber.isStickyCommonEvent().then((isSticky) => { + console.info("isSticky " + JSON.stringify(isSticky)); +}).catch((err) => { + console.error(`isSticky failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## abortCommonEvent + +```ts +abortCommonEvent(callback: AsyncCallback): void +``` + +以回调形式取消当前的有序公共事件,取消后,有序公共事件不再向下一个订阅者传递。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | -------------------- | +| callback | AsyncCallback\ | 是 | 取消当前的有序公共事件。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +//取消当前有序公共事件的回调 +function abortCB(err) { + if (err.code) { + console.error(`abortCommonEvent failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("abortCommonEvent"); + } +} +subscriber.abortCommonEvent(abortCB); +``` + +## abortCommonEvent + +```ts +abortCommonEvent(): Promise +``` + +以Promise形式取消当前的有序公共事件,取消后,公共事件不再向下一个订阅者传递。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**返回值:** + +| 类型 | 说明 | +| ---------------- | -------------------- | +| Promise\ | 返回一个Promise的结果。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +subscriber.abortCommonEvent().then(() => { + console.info("abortCommonEvent"); +}).catch((err) => { + console.error(`abortCommonEvent failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## clearAbortCommonEvent + +```ts +clearAbortCommonEvent(callback: AsyncCallback): void +``` + +以回调形式清除当前有序公共事件。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | -------------------- | +| callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +//清除当前公共事件取消状态的回调 +function clearAbortCB(err) { + if (err.code) { + console.error(`clearAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("clearAbortCommonEvent"); + } +} +subscriber.clearAbortCommonEvent(clearAbortCB); +``` + +## clearAbortCommonEvent + +```ts +clearAbortCommonEvent(): Promise +``` + +以Promise形式清除当前有序公共事件。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**返回值:** + +| 类型 | 说明 | +| ---------------- | -------------------- | +| Promise\ | 返回一个Promise的结果。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +subscriber.clearAbortCommonEvent().then(() => { + console.info("clearAbortCommonEvent"); +}).catch((err) => { + console.error(`clearAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## getAbortCommonEvent + +```ts +getAbortCommonEvent(callback: AsyncCallback): void +``` + +以回调形式获取当前有序公共事件是否取消的状态。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | ---------------------------------- | +| callback | AsyncCallback\ | 是 | 表示当前有序公共事件是否取消的状态。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +//获取当前有序公共事件是否取消的回调 +function getAbortCB(err, abortEvent) { + if (err.code) { + console.error(`getAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("abortCommonEvent " + abortEvent) + } +} +subscriber.getAbortCommonEvent(getAbortCB); +``` + +## getAbortCommonEvent + +```ts +getAbortCommonEvent(): Promise +``` + +以Promise形式获取当前有序公共事件是否取消的状态。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**返回值:** + +| 类型 | 说明 | +| ----------------- | ---------------------------------- | +| Promise\ | 表示当前有序公共事件是否取消的状态。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +subscriber.getAbortCommonEvent().then((abortEvent) => { + console.info("abortCommonEvent " + JSON.stringify(abortEvent)); +}).catch((err) => { + console.error(`getAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## getSubscribeInfo + +```ts +getSubscribeInfo(callback: AsyncCallback): void +``` + +以回调形式获取订阅者的订阅信息。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | ---------------------- | +| callback | AsyncCallback\<[CommonEventSubscribeInfo](./js-apis-inner-commonEvent-commonEventSubscribeInfo.md)> | 是 | 表示订阅者的订阅信息。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +//获取订阅者信息回调 +function getCB(err, subscribeInfo) { + if (err.code) { + console.error(`getSubscribeInfo failed, code is ${err.code}, message is ${err.message}`); + } else { + console.info("subscribeInfo " + JSON.stringify(subscribeInfo)); + } +} +subscriber.getSubscribeInfo(getCB); +``` + +## getSubscribeInfo + +```ts +getSubscribeInfo(): Promise +``` + +以Promise形式获取订阅者的订阅信息。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------------ | ---------------------- | +| Promise\<[CommonEventSubscribeInfo](./js-apis-inner-commonEvent-commonEventSubscribeInfo.md)> | 表示订阅者的订阅信息。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +subscriber.getSubscribeInfo().then((subscribeInfo) => { + console.info("subscribeInfo " + JSON.stringify(subscribeInfo)); +}).catch((err) => { + console.error(`getSubscribeInfo failed, code is ${err.code}, message is ${err.message}`); +}); +``` + +## finishCommonEvent9+ + +```ts +finishCommonEvent(callback: AsyncCallback): void +``` + +以回调形式结束当前有序公共事件。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | -------------------------------- | +| callback | AsyncCallback\ | 是 | 表示有序公共事件结束后的回调函数。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +//结束当前有序公共事件的回调 +function finishCB(err) { + if (err.code) { + console.error(`finishCommonEvent failed, code is ${err.code}, message is ${err.message}`); +} else { + console.info("FinishCommonEvent"); +} + +subscriber.finishCommonEvent(finishCB); +``` + +## finishCommonEvent9+ + +```ts +finishCommonEvent(): Promise +``` + +以Promise形式结束当前有序公共事件。 + +**系统能力**:`SystemCapability.Notification.CommonEvent` + +**返回值:** + +| 类型 | 说明 | +| ---------------- | -------------------- | +| Promise\ | 返回一个Promise的结果。 | + +**示例:** + +```ts +let subscriber; //创建成功的订阅者对象 + +subscriber.finishCommonEvent().then(() => { + console.info("FinishCommonEvent"); +}).catch((err) => { + console.error(`finishCommonEvent failed, code is ${err.code}, message is ${err.message}`); +}); +``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationActionButton.md b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationActionButton.md new file mode 100644 index 0000000000000000000000000000000000000000..d822600d6939bf2c981a1ddbd611d2d6672816ca --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationActionButton.md @@ -0,0 +1,16 @@ +# NotificationActionButton + +描述通知中显示的操作按钮。 + +> **说明:** +> +> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| --------- | ----------------------------------------------- | --- | ---- | ------------------------- | +| title | string | 是 | 是 | 按钮标题。 | +| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | 是 | 是 | 点击按钮时触发的WantAgent。 | +| extras | { [key: string]: any } | 是 | 是 | 按钮扩展信息。 | +| userInput8+ | [NotificationUserInput](js-apis-inner-notification-notificationUserInput.md) | 是 | 是 | 用户输入对象实例。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationCommonDef.md b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationCommonDef.md new file mode 100644 index 0000000000000000000000000000000000000000..5d3e7eee4755935751d1aaa1859fa16d3663197b --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationCommonDef.md @@ -0,0 +1,16 @@ +# NotificationCommonDef + +> **说明:** +> +> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +## BundleOption + +BundleOption模块为指定应用的包信息。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification + +| 名称 | 类型 | 必填 | 说明 | +| ------ | ------ |---- | ------ | +| bundle | string | 是 | 应用的包信息。 | +| uid | number | 否 | 用户ID。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationContent.md b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationContent.md new file mode 100644 index 0000000000000000000000000000000000000000..be8496b25a4909e2c7f2796e7e98c1381b50dfe1 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationContent.md @@ -0,0 +1,77 @@ +# NotificationContent + +描述通知类型。 + +> **说明:** +> +> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ----------- | ------------------------------------------------------------ | ---- | --- | ------------------ | +| contentType | [ContentType](./js-apis-notificationManager.md#contenttype) | 是 | 是 | 通知内容类型。 | +| normal | [NotificationBasicContent](#notificationbasiccontent) | 是 | 是 | 基本类型通知内容。 | +| longText | [NotificationLongTextContent](#notificationlongtextcontent) | 是 | 是 | 长文本类型通知内容。 | +| multiLine | [NotificationMultiLineContent](#notificationmultilinecontent) | 是 | 是 | 多行类型通知内容。 | +| picture | [NotificationPictureContent](#notificationpicturecontent) | 是 | 是 | 图片类型通知内容。 | + +## NotificationBasicContent + +描述普通文本通知。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------------- | ------ | ---- | ---- | ---------------------------------- | +| title | string | 是 | 是 | 通知标题。 | +| text | string | 是 | 是 | 通知内容。 | +| additionalText | string | 是 | 是 | 通知附加内容,是对通知内容的补充。 | + + +## NotificationLongTextContent + +描述长文本通知。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------------- | ------ | ---- | --- | -------------------------------- | +| title | string | 是 | 是 | 通知标题。 | +| text | string | 是 | 是 | 通知内容。 | +| additionalText | string | 是 | 是 | 通知附加内容,是对通知内容的补充。 | +| longText | string | 是 | 是 | 通知的长文本。 | +| briefText | string | 是 | 是 | 通知概要内容,是对通知内容的总结。 | +| expandedTitle | string | 是 | 是 | 通知展开时的标题。 | + + +## NotificationMultiLineContent + +描述多行文本通知。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------------- | --------------- | --- | --- | -------------------------------- | +| title | string | 是 | 是 | 通知标题。 | +| text | string | 是 | 是 | 通知内容。 | +| additionalText | string | 是 | 是 | 通知附加内容,是对通知内容的补充。 | +| briefText | string | 是 | 是 | 通知概要内容,是对通知内容的总结。 | +| longTitle | string | 是 | 是 | 通知展开时的标题。 | +| lines | Array\ | 是 | 是 | 通知的多行文本。 | + + +## NotificationPictureContent + +描述附有图片的通知。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------------- | -------------- | ---- | --- | -------------------------------- | +| title | string | 是 | 是 | 通知标题。 | +| text | string | 是 | 是 | 通知内容。 | +| additionalText | string | 是 | 是 | 通知附加内容,是对通知内容的补充。 | +| briefText | string | 是 | 是 | 通知概要内容,是对通知内容的总结。 | +| expandedTitle | string | 是 | 是 | 通知展开时的标题。 | +| picture | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | 是 | 通知的图片内容。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationFlags.md b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationFlags.md new file mode 100644 index 0000000000000000000000000000000000000000..1dfc0990395386c786064be441c7c413d2fc744c --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationFlags.md @@ -0,0 +1,29 @@ +# NotificationFlags + +描述通知标志的实例。 + +> **说明:** +> +> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ---------------- | ---------------------- | ---- | ---- | --------------------------------- | +| soundEnabled | [NotificationFlagStatus](#notificationflagstatus) | 是 | 否 | 是否启用声音提示。 | +| vibrationEnabled | [NotificationFlagStatus](#notificationflagstatus) | 是 | 否 | 是否启用振动提醒功能。 | + + +## NotificationFlagStatus + +描述通知标志状态。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification + +**系统接口**:此接口为系统接口,三方应用不支持调用。 + +| 名称 | 值 | 说明 | +| -------------- | --- | --------------------------------- | +| TYPE_NONE | 0 | 默认标志。 | +| TYPE_OPEN | 1 | 通知标志打开。 | +| TYPE_CLOSE | 2 | 通知标志关闭。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationRequest.md b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationRequest.md new file mode 100644 index 0000000000000000000000000000000000000000..9c37ecd7a7fa595eb456796051157c62cf30ae68 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationRequest.md @@ -0,0 +1,63 @@ +# NotificationRequest + +描述通知的请求。 + +> **说明:** +> +> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| --------------------- | --------------------------------------------- | ---- | --- | -------------------------- | +| content | [NotificationContent](js-apis-inner-notification-notificationContent.md#notificationcontent) | 是 | 是 | 通知内容。 | +| id | number | 是 | 是 | 通知ID。 | +| slotType | [SlotType](js-apis-notificationManager.md#slottype) | 是 | 是 | 通道类型。 | +| isOngoing | boolean | 是 | 是 | 是否进行时通知。 | +| isUnremovable | boolean | 是 | 是 | 是否可移除。 | +| deliveryTime | number | 是 | 是 | 通知发送时间。 | +| tapDismissed | boolean | 是 | 是 | 通知是否自动清除。 | +| autoDeletedTime | number | 是 | 是 | 自动清除的时间。 | +| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | 是 | 是 | WantAgent封装了应用的行为意图,点击通知时触发该行为。 | +| extraInfo | {[key: string]: any} | 是 | 是 | 扩展参数。 | +| color | number | 是 | 是 | 通知背景颜色。预留能力,暂未支持。 | +| colorEnabled | boolean | 是 | 是 | 通知背景颜色是否使能。预留能力,暂未支持。 | +| isAlertOnce | boolean | 是 | 是 | 设置是否仅有一次此通知提醒。 | +| isStopwatch | boolean | 是 | 是 | 是否显示已用时间。 | +| isCountDown | boolean | 是 | 是 | 是否显示倒计时时间。 | +| isFloatingIcon | boolean | 是 | 是 | 是否显示状态栏图标。 | +| label | string | 是 | 是 | 通知标签。 | +| badgeIconStyle | number | 是 | 是 | 通知角标类型。 | +| showDeliveryTime | boolean | 是 | 是 | 是否显示分发时间。 | +| actionButtons | Array\<[NotificationActionButton](js-apis-inner-notification-notificationActionButton.md)\> | 是 | 是 | 通知按钮,最多三个按钮。 | +| smallIcon | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | 是 | 通知小图标。可选字段,大小不超过30KB。 | +| largeIcon | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | 是 | 通知大图标。可选字段,大小不超过30KB。 | +| creatorBundleName | string | 是 | 否 | 创建通知的包名。 | +| creatorUid8+ | number | 是 | 否 | 创建通知的UID。 | +| creatorPid | number | 是 | 否 | 创建通知的PID。 | +| creatorUserId| number | 是 | 否 | 创建通知的UserId。 | +| hashCode | string | 是 | 否 | 通知唯一标识。 | +| classification | string | 是 | 是 | 通知分类。
**系统API**: 此接口为系统接口,三方应用不支持调用。 | +| groupName8+ | string | 是 | 是 | 组通知名称。 | +| template8+ | [NotificationTemplate](./js-apis-inner-notification-notificationTemplate.md) | 是 | 是 | 通知模板。 | +| isRemoveAllowed8+ | boolean | 是 | 否 | 通知是否能被移除。
**系统API**: 此接口为系统接口,三方应用不支持调用。 | +| source8+ | number | 是 | 否 | 通知源。
**系统API**: 此接口为系统接口,三方应用不支持调用。 | +| distributedOption8+ | [DistributedOptions](#distributedoptions) | 是 | 是 | 分布式通知的选项。 | +| deviceId8+ | string | 是 | 否 | 通知源的deviceId。
**系统API**: 此接口为系统接口,三方应用不支持调用。 | +| notificationFlags8+ | [NotificationFlags](js-apis-inner-notification-notificationflags#notificationFlags) | 是 | 否 | 获取NotificationFlags。 | +| removalWantAgent9+ | [WantAgent](js-apis-app-ability-wantAgent.md) | 是 | 是 | 当移除通知时,通知将被重定向到的WantAgent实例。 | +| badgeNumber9+ | number | 是 | 是 | 应用程序图标上显示的通知数。 | + + +## DistributedOptions + +描述分布式选项。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ---------------------- | -------------- | ---- | ---- | ---------------------------------- | +| isDistributed8+ | boolean | 是 | 是 | 是否为分布式通知。 | +| supportDisplayDevices8+ | Array\ | 是 | 是 | 可以同步通知到的设备列表。 | +| supportOperateDevices8+ | Array\ | 是 | 是 | 可以打开通知的设备列表。 | +| remindType8+ | number | 是 | 否 | 通知的提醒方式。
**系统API**: 此接口为系统接口,三方应用不支持调用。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationSlot.md b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationSlot.md new file mode 100644 index 0000000000000000000000000000000000000000..27d5aec3672ee7caa0eefd640153f3ee70514a3a --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationSlot.md @@ -0,0 +1,24 @@ +# NotificationSlot + +描述通知槽 + +> **说明:** +> +> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------------------- | --------------------- | ---- | --- | ------------------------------------------ | +| type | [SlotType](js-apis-notificationManager.md#slottype) | 是 | 是 | 通道类型。 | +| level | number | 是 | 是 | 通知级别,不设置则根据通知渠道类型有默认值。 | +| desc | string | 是 | 是 | 通知渠道描述信息。 | +| badgeFlag | boolean | 是 | 是 | 是否显示角标。 | +| bypassDnd | boolean | 是 | 是 | 置是否在系统中绕过免打扰模式。 | +| lockscreenVisibility | number | 是 | 是 | 在锁定屏幕上显示通知的模式。 | +| vibrationEnabled | boolean | 是 | 是 | 是否可振动。 | +| sound | string | 是 | 是 | 通知提示音。 | +| lightEnabled | boolean | 是 | 是 | 是否闪灯。 | +| lightColor | number | 是 | 是 | 通知灯颜色。 | +| vibrationValues | Array\ | 是 | 是 | 通知振动样式。 | +| enabled9+ | boolean | 是 | 否 | 此通知插槽中的启停状态。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationTemplate.md b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationTemplate.md new file mode 100644 index 0000000000000000000000000000000000000000..58e9d4442712e965f56d6837de8d9cbfef010544 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationTemplate.md @@ -0,0 +1,14 @@ +# NotificationTemplate + +通知模板。 + +> **说明:** +> +> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ---- | ---------------------- | ---- | ---- | ---------- | +| name | string | 是 | 是 | 模板名称。 | +| data | {[key:string]: Object} | 是 | 是 | 模板数据。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationUserInput.md b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationUserInput.md new file mode 100644 index 0000000000000000000000000000000000000000..bc60f868ba6d787cbacf2b79e50102b7f06cb103 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationUserInput.md @@ -0,0 +1,13 @@ +# NotificationUserInput + +保存用户输入的通知消息。 + +> **说明:** +> +> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +**系统能力**:SystemCapability.Notification.Notification + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------- | ------ | --- | ---- | ----------------------------- | +| inputKey | string | 是 | 是 | 用户输入时用于标识此输入的key。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-context.md b/zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-context.md index 1633733d83c6688037a4614a2613a47543e03f94..263b4f1da9cb4ce51ee3449c806c1f65cc6ed95d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-context.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-context.md @@ -51,7 +51,7 @@ this.context.destroy((err) => { ## InputMethodExtensionContext.destroy -destroy(): Promise; 停止输入法应用自身。通过Promise异步回调。 @@ -61,7 +61,7 @@ destroy(): Promise; | 无返回结果的Promise对象。 | **示例:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-inputmethod-subtype.md b/zh-cn/application-dev/reference/apis/js-apis-inputmethod-subtype.md index d3c7dc85ce834a9f260efcae4a569666fc59cac5..84564975e3bafd9b5ebc3706046fb57ded2a2fef 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inputmethod-subtype.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inputmethod-subtype.md @@ -21,11 +21,12 @@ import InputMethodSubtype from '@ohos.InputMethodSubtype'; | 名称 | 类型 | 可读 | 可写 | 必选 | 说明 | | -------- | -------- | -------- | -------- | -------- | -------- | | label | string | 是 | 否 | 否 | 输入法子类型的标签。 | -| name | string | 是 | 否 | 是 | 输入法子类型的名字。 | +| labelId10+ | string | 是 | 否 | 否 | 输入法子类型的标签资源号。 | +| name | string | 是 | 否 | 是 | 输入法应用的包名。 | | id | string | 是 | 否 | 是 | 输入法子类型的id。 | | mode | string | 是 | 否 | 否 | 输入法子类型的模式,包括upper(大写)和lower(小写)。 | | locale | string | 是 | 否 | 是 | 输入法子类型的方言版本。 | | language | string | 是 | 否 | 是 | 输入法子类型的语言。 | | icon | string | 是 | 否 | 否 | 输入法子类型的图标。 | | iconId | number | 是 | 否 | 否 | 输入法子类型的图标id。 | -| extra | object | 是 | 是 | 是 | 输入法子类型的其他信息。 | +| extra | object | 是 | 是 | 否 | 输入法子类型的其他信息。
**说明:** 从API version 10开始改为非必选参数。 | 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 454e533f1ee846fd3105c038cf69b98719578d7a..3b05f3c4a6784b92844b5a21ffaf47715f9598da 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md @@ -1,6 +1,6 @@ # @ohos.inputMethod (输入法框架) -本模块提供对输入法框架的管理,包括隐藏输入法、查询已安装的输入法列表和显示输入法选择对话框。 +本模块主要面向普通前台应用(备忘录、信息、设置等系统应用与三方应用),提供对输入法的控制、管理能力,包括显示/隐藏输入法软键盘、切换输入法、获取所有输入法列表等。 > **说明:** > @@ -34,9 +34,10 @@ import inputMethod from '@ohos.inputMethod'; | name9+ | string | 是 | 否 | 输入法内部名称。必填。| | id9+ | string | 是 | 否 | 输入法唯一标识。必填。| | label9+ | string | 是 | 否 | 输入法对外显示名称。 非必填。| +| labelId10+ | string | 是 | 否 | 输入法对外显示名称资源号。 非必填。| | icon9+ | string | 是 | 否 | 输入法图标数据。非必填。 | | iconId9+ | number | 是 | 否 | 输入法图标资源号。非必填。 | -| extra9+ | object | 是 | 是 | 输入法扩展信息。 必填。| +| extra9+ | object | 是 | 是 | 输入法扩展信息。 非必填。
**说明:** 从API version 10开始改为非必选参数。| | packageName(deprecated) | string | 是 | 否 | 输入法包名。必填。
**说明:** 从API version 8开始支持,从API version 9开始废弃,建议使用name替代。 | | methodId(deprecated) | string | 是 | 否 | 输入法唯一标识。必填。
**说明:** 从API version 8开始支持,从API version 9开始废弃,建议使用id替代。 | @@ -231,7 +232,7 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallb 在当前输入法应用内切换子类型。使用callback异步回调。 -**需要权限:** ohos.permission.CONNECT_IME_ABILITY,仅系统应用可用。 +**需要权限:** ohos.permission.CONNECT_IME_ABILITY,仅系统应用可用。
**说明:** 从API version 10开始,如果调用者为当前输入法应用,则不需要此权限。 **系统能力:** SystemCapability.MiscServices.InputMethodFramework @@ -256,9 +257,9 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallb ```js try { inputMethod.switchCurrentInputMethodSubtype({ - id: "com.example.kikakeyboard", - label: "ServiceExtAbility", - name: "", + id: "ServiceExtAbility", + label: "", + name: "com.example.kikakeyboard", mode: "upper", locale: "", language: "", @@ -287,7 +288,7 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise<boolean& 在当前输入法应用内切换子类型。使用promise异步回调。 -**需要权限:** ohos.permission.CONNECT_IME_ABILITY,仅系统应用可用。 +**需要权限:** ohos.permission.CONNECT_IME_ABILITY,仅系统应用可用。
**说明:** 从API version 10开始,如果调用者为当前输入法应用,则不需要此权限。 **系统能力:** SystemCapability.MiscServices.InputMethodFramework @@ -317,9 +318,9 @@ switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise<boolean& ```js try { inputMethod.switchCurrentInputMethodSubtype({ - id: "com.example.kikakeyboard", - label: "ServiceExtAbility", - name: "", + id: "ServiceExtAbility", + label: "", + name: "com.example.kikakeyboard", mode: "upper", locale: "", language: "", @@ -391,25 +392,9 @@ switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inp ```js let im = inputMethod.getCurrentInputMethod(); -let inputMethodProperty = { - packageName: im.packageName, - methodId: im.methodId, - name: im.packageName, - id: im.methodId, - extra: {} -} +let imSubType = inputMethod.getCurrentInputMethodSubtype(); try { - inputMethod.switchCurrentInputMethodAndSubtype(inputMethodProperty, { - id: "com.example.kikakeyboard", - label: "ServiceExtAbility", - name: "", - mode: "upper", - locale: "", - language: "", - icon: "", - iconId: 0, - extra: {} - }, (err,result) => { + inputMethod.switchCurrentInputMethodAndSubtype(im, imSubType, (err,result) => { if (err !== undefined) { console.error('Failed to switchCurrentInputMethodAndSubtype: ' + JSON.stringify(err)); return; @@ -461,25 +446,9 @@ switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inp ```js let im = inputMethod.getCurrentInputMethod(); -let inputMethodProperty = { - packageName: im.packageName, - methodId: im.methodId, - name: im.packageName, - id: im.methodId, - extra: {} -} +let imSubType = inputMethod.getCurrentInputMethodSubtype(); try { - inputMethod.switchCurrentInputMethodAndSubtype(inputMethodProperty, { - id: im.packageName, - label: im.methodId, - name: "", - mode: "upper", - locale: "", - language: "", - icon: "", - iconId: 0, - extra: {} - }).then((result) => { + inputMethod.switchCurrentInputMethodAndSubtype(im, imSubType).then((result) => { if (result) { console.info('Succeeded in switching currentInputMethodAndSubtype.'); } else { @@ -884,7 +853,7 @@ inputMethodController.off('selectByRange'); ### on('selectByMovement')10+ -on(type: 'selectByMovement', callback: Callback<Range>): void +on(type: 'selectByMovement', callback: Callback<Movement>): void 订阅输入法应用按光标动作选中文本事件。使用callback异步回调。 @@ -1235,8 +1204,6 @@ showOptionalInputMethods(callback: AsyncCallback<boolean>): void 显示输入法选择对话框。使用callback异步回调。 -**需要权限:** ohos.permission.CONNECT_IME_ABILITY,仅系统应用可用。 - **系统能力:** SystemCapability.MiscServices.InputMethodFramework **参数:** @@ -1275,8 +1242,6 @@ showOptionalInputMethods(): Promise<boolean> 显示输入法选择对话框。使用promise异步回调。 -**需要权限:** ohos.permission.CONNECT_IME_ABILITY,仅系统应用可用。 - **系统能力:** SystemCapability.MiscServices.InputMethodFramework **返回值:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md b/zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md index 551562a61c610c300fc0c789ebd47b16a5f6dff9..b4a9b9f9d610dbd34fa8920cd419a56d6380d228 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md @@ -1,6 +1,6 @@ # @ohos.inputMethodEngine (输入法服务) -本模块的作用是拉通输入法应用和其他三方应用(联系人、微信等),功能包括:将三方应用与输入法应用的服务进行绑定、三方应用通过输入法应用进行文本输入、三方应用对输入法应用进行显示键盘请求和隐藏键盘请求、三方应用对输入法应用当前状态进行监听等。 +本模块面向输入法应用(包括系统输入法应用、三方输入法应用),为输入法应用提供能力,功能包括:创建软键盘窗口、插入/删除字符、选中文本、物理键盘按键事件监听等。 > **说明:** > @@ -56,15 +56,15 @@ import inputMethodEngine from '@ohos.inputMethodEngine'; getInputMethodAbility(): InputMethodAbility -获取服务端实例。 +为输入法应用获取输入法应用客户端实例[InputMethodAbility](#inputmethodability)。输入法应用获取该实例可订阅软键盘显示/隐藏请求事件、创建/销毁输入法应用面板等。 **系统能力:** SystemCapability.MiscServices.InputMethodFramework **返回值:** -| 类型 | 说明 | -| --------------------------------------- | ------------ | -| [InputMethodAbility](#inputmethodability) | 服务端实例。 | +| 类型 | 说明 | +| ----------------------------------------- | ------------------ | +| [InputMethodAbility](#inputmethodability) | 输入法应用客户端。 | **示例:** @@ -76,15 +76,15 @@ let InputMethodAbility = inputMethodEngine.getInputMethodAbility(); getKeyboardDelegate(): KeyboardDelegate -获取客户端监听实例。 +为输入法应用获取客户端编辑事件监听代理实例[KeyboardDelegate](#keyboarddelegate)。输入法应用获取该实例可订阅物理键盘按键事件、选中文本变化事件等。 **系统能力:** SystemCapability.MiscServices.InputMethodFramework **返回值:** -| 类型 | 说明 | -| ------------------------------------- | ---------------- | -| [KeyboardDelegate](#keyboarddelegate) | 客户端监听实例。 | +| 类型 | 说明 | +| ------------------------------------- | ------------------------ | +| [KeyboardDelegate](#keyboarddelegate) | 客户端编辑事件监听代理。 | **示例:** @@ -96,7 +96,7 @@ let KeyboardDelegate = inputMethodEngine.getKeyboardDelegate(); getInputMethodEngine(): InputMethodEngine -获取服务端实例。 +为输入法应用获取输入法应用客户端实例[InputMethodEngine](#inputmethodengine-1)。输入法应用获取该实例可订阅软键盘显示/隐藏请求事件等。 > **说明:** > @@ -106,9 +106,9 @@ getInputMethodEngine(): InputMethodEngine **返回值:** -| 类型 | 说明 | -| --------------------------------------- | ------------ | -| [InputMethodEngine](#inputmethodengine-1) | 服务端实例。 | +| 类型 | 说明 | +| ----------------------------------------- | ------------------ | +| [InputMethodEngine](#inputmethodengine-1) | 输入法应用客户端。 | **示例:** @@ -120,7 +120,7 @@ let InputMethodEngine = inputMethodEngine.getInputMethodEngine(); createKeyboardDelegate(): KeyboardDelegate -获取客户端监听实例。 +为输入法应用获取客户端编辑事件监听代理实例[KeyboardDelegate](#keyboarddelegate)。输入法应用获取该实例可订阅物理键盘按键事件、选中文本变化事件等。 > **说明:** > @@ -130,9 +130,9 @@ createKeyboardDelegate(): KeyboardDelegate **返回值:** -| 类型 | 说明 | -| ------------------------------------- | ---------------- | -| [KeyboardDelegate](#keyboarddelegate) | 客户端监听实例。 | +| 类型 | 说明 | +| ------------------------------------- | ------------------------ | +| [KeyboardDelegate](#keyboarddelegate) | 客户端编辑事件监听代理。 | **示例:** @@ -478,6 +478,186 @@ inputMethodEngine.getInputMethodAbility().off('setSubtype', () => { }); ``` +### createPanel10+ + +createPanel(ctx: BaseContext, info: PanelInfo, callback: AsyncCallback\): void + +创建输入法应用面板。仅支持输入法应用或者具有system_core权限的系统应用调用。单个输入法应用仅仅允许创建一个SOFT_KEYBOARD及一个STATUS_BAR类型的面板。使用callback异步回调。 + +**系统能力:** SystemCapability.MiscServices.InputMethodFramework + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ----------- | ---- | ------------------------ | +| ctx | [BaseContext](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-inner-application-baseContext.md) | 是 | 当前输入法应用上下文信息。 | +| info | [PanelInfo](#panelinfo10) | 是 | 输入法面板信息。 | +| callback | AsyncCallback\<[Panel](#panel10)> | 是 | 回调函数。当输入法面板创建成功,返回当前创建的输入法面板对象。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ---------- | ----------------------------- | +| 12800004 | not an input method extension | + +**示例:** + +```js +let panelInfo: inputMethodEngine.PanelInfo = { + panelType: SOFT_KEYBOARD, + panelFlag: FLG_FIXED +} +try { + inputMethodEngine.getInputMethodAbility().createPanel(this.context, panelInfo, (err, panel) => { + if (err !== undefined) { + console.log('Failed to create panel, err: ' + JSON.stringify(err)); + return; + } + console.log('Succeed in creating panel.'); + }) +} catch(err) { + console.log('Failed to create panel, err: ' + JSON.stringify(err)); +} +``` + +### createPanel10+ + +createPanel(ctx: BaseContext, info: PanelInfo): Promise\ + +创建输入法应用面板。仅支持输入法应用或者具有system_core权限的系统应用调用。单个输入法应用仅仅允许创建一个SOFT_KEYBOARD及一个STATUS_BAR类型的面板。使用promise异步回调。 + +**系统能力:** SystemCapability.MiscServices.InputMethodFramework + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ----------- | ---- | ------------------------ | +| ctx | [BaseContext](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-inner-application-baseContext.md) | 是 | 当前输入法应用上下文信息。 | +| info | [PanelInfo](#panelinfo10) | 是 | 输入法面板信息。 | + +**返回值:** +| 类型 | 说明 | +| ------- | ------------------------------------------------------------------ | +| Promise\<[Panel](#panel10)> | 回调函数。当输入法面板创建成功,返回当前创建的输入法面板对象。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| ---------- | ----------------------------- | +| 12800004 | not an input method extension | + +**示例:** + +```js +let panelInfo: inputMethodEngine.PanelInfo = { + panelType: SOFT_KEYBOARD, + panelFlag: FLG_FIXED +} +inputMethodEngine.getInputMethodAbility().createPanel(this.context, panelInfo).then((panel) => { + console.log('Succeed in creating panel.'); +}).catch((err) => { + console.log('Failed to create panel, err: ' + JSON.stringify(err)); +}) +``` + +### destroyPanel10+ + +destroyPanel(panel: Panel, callback: AsyncCallback\): void; + +销毁输入法应用面板。使用callback异步回调。 + +**系统能力:** SystemCapability.MiscServices.InputMethodFramework + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ----------- | ---- | ------------------------ | +| panel | [Panel](#panel10) | 是 | 要销毁的panel对象。 | +| callback | AsyncCallback\ | 是 | 回调函数。当输入法面板销毁成功,err为undefined,否则为错误对象。 | + +**示例:** + +```js +let panelInfo: inputMethodEngine.PanelInfo = { + panelType: SOFT_KEYBOARD, + panelFlag: FLG_FIXED +} +try { + inputMethodEngine.getInputMethodAbility().createPanel(this.context, panelInfo, (err, panel) => { + if (err !== undefined) { + console.log('Failed to create panel, err: ' + JSON.stringify(err)); + return; + } + globalThis.inputMethodPanel = panel; + console.log('Succeed in creating panel.'); + }) +} catch(err) { + console.log('Failed to create panel, err: ' + JSON.stringify(err)); +} + +try { + inputMethodEngine.getInputMethodAbility().destroyPanel(globalThis.inputMethodPanel, (err) => { + if(err !== undefined) { + console.log('Failed to destroy panel, err: ' + JSON.stringify(err)); + return; + } + console.log('Succeed in destroying panel.'); + }) +} catch(err) { + console.log('Failed to destroy panel, err: ' + JSON.stringify(err)); +} +``` + +### destroyPanel10+ + +destroyPanel(panel: Panel): Promise\; + +销毁输入法应用面板。使用promise异步回调。 + +**系统能力:** SystemCapability.MiscServices.InputMethodFramework + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------| ----------- | ---- | ------------------------ | +| panel | [Panel](#panel10) | 是 | 要销毁的panel对象。 | + +**返回值:** +| 类型 | 说明 | +| ------- | -------------------------------------------------------------------- | +| Promise\ | 无返回结果的Promise对象。| + +**示例:** + +```js +let panelInfo: inputMethodEngine.PanelInfo = { + panelType: SOFT_KEYBOARD, + panelFlag: FLG_FIXED +} +try { + inputMethodEngine.getInputMethodAbility().createPanel(this.context, panelInfo, (err, panel) => { + if (err !== undefined) { + console.log('Failed to create panel, err: ' + JSON.stringify(err)); + return; + } + globalThis.inputMethodPanel = panel; + console.log('Succeed in creating panel.'); + }) +} catch(err) { + console.log('Failed to create panel, err: ' + JSON.stringify(err)); +} + +try { + inputMethodEngine.getInputMethodAbility().destroyPanel(globalThis.inputMethodPanel).then(() => { + console.log('Succeed in destroying panel.'); + }).catch((err) => { + console.log('Failed to destroy panel, err: ' + JSON.stringify(err)); + }); +} catch (err) { + console.log('Failed to destroy panel, err: ' + JSON.stringify(err)); +} +``` + ## KeyboardDelegate 下列API示例中都需使用[getKeyboardDelegate](#inputmethodenginegetkeyboarddelegate9)回调获取到KeyboardDelegate实例,再通过此实例调用对应方法。 @@ -684,6 +864,455 @@ inputMethodEngine.getKeyboardDelegate().off('textChange', (text) => { }); ``` +## Panel10+ + +下列API示例中都需使用[createPanel](#createpanel10)回调获取到Panel实例,再通过此实例调用对应方法。 + +### setUiContent10+ + +setUiContent(path: string, callback: AsyncCallback\): void + +为当前面板加载具体页面内容,使用callback异步回调。 + +**系统能力:** SystemCapability.MiscServices.InputMethodFramework + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | -------- | +| path | string | 是 | 设置加载页面的路径。 | +| callback | AsyncCallback\ | 是 | 回调函数。当面板页面内容加载成功,err为undefined,否则err为错误对象。 | + +**示例:** + +```js +try { + panel.setUiContent('pages/page2/page2', (err) => { + if (err) { + console.error('Failed to set the content. err:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in setting the content.'); + }); +} catch (exception) { + console.error('Failed to set the content. err:' + JSON.stringify(exception)); +} +``` + +### setUiContent10+ + +setUiContent(path: string): Promise\ + +为当前面板加载具体页面内容,使用Promise异步回调。 + +**系统能力:** SystemCapability.MiscServices.InputMethodFramework + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | -------- | +| path | string | 是 | 设置加载页面的路径。 | + +**返回值:** + +| 类型 | 说明 | +| ------- | ------------------------------ | +| Promise\ | 无返回结果的Promise对象。 | + +**示例:** + +```js +try { + let promise = panel.setUiContent('pages/page2/page2'); + promise.then(() => { + console.info('Succeeded in setting the content.'); + }).catch((err) =>{ + console.error('Failed to set the content. err: ' + JSON.stringify(err)); + }); +} catch (exception) { + console.error('Failed to set the content. err: ' + JSON.stringify(exception)); +} +``` + +### setUiContent10+ + +setUiContent(path: string, storage: LocalStorage, callback: AsyncCallback\): void + +为当前面板加载与LocalStorage相关联的具体页面内容,使用callback异步回调。 + +**系统能力:** SystemCapability.MiscServices.InputMethodFramework + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | -------- | +| path | string | 是 | 设置加载页面的路径。 | +| storage | [LocalStorage](../../quick-start/arkts-state-mgmt-application-level.md#localstorage) | 是 | 存储单元,为应用程序范围内的可变状态属性和非可变状态属性提供存储。| +| callback | AsyncCallback\ | 是 | 回调函数。当面板页面内容加载成功,err为undefined,否则err为错误对象。 | + +**示例:** + +```js +let storage = new LocalStorage(); +storage.setOrCreate('storageSimpleProp',121); +try { + panel.setUiContent('pages/page2/page2', storage, (err) => { + if (err) { + console.error('Failed to set the content. err:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in setting the content.'); + }); +} catch (exception) { + console.error('Failed to set the content. err:' + JSON.stringify(exception)); +} +``` + +### setUiContent10+ + +setUiContent(path: string, storage: LocalStorage): Promise\ + +为当前面板加载与LocalStorage相关联的具体页面内容,使用Promise异步回调。 + +**系统能力:** SystemCapability.MiscServices.InputMethodFramework + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | -------- | +| path | string | 是 | 设置加载页面的路径。 | +| storage | [LocalStorage](../../quick-start/arkts-state-mgmt-application-level.md#localstorage) | 是 | 存储单元,为应用程序范围内的可变状态属性和非可变状态属性提供存储。| + +**返回值:** + +| 类型 | 说明 | +| ------- | ------------------------------ | +| Promise\ | 无返回结果的Promise对象。 | + +**示例:** + +```js +let storage = new LocalStorage(); +storage.setOrCreate('storageSimpleProp',121); +try { + let promise = panel.setUiContent('pages/page2/page2'); + promise.then(() => { + console.info('Succeeded in setting the content.'); + }).catch((err) =>{ + console.error('Failed to set the content. err: ' + JSON.stringify(err)); + }); +} catch (exception) { + console.error('Failed to set the content. err: ' + JSON.stringify(exception)); +} +``` + +### resize10+ + +resize(width: number, height: number, callback: AsyncCallback\): void + +改变当前面板大小,使用callback异步回调。 +面板存在大小限制,面板宽度不超出屏幕宽度,面板高度不高于屏幕高度的二分之一。 + +**系统能力:** SystemCapability.MiscServices.InputMethodFramework + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | -------- | +| width | number | 是 | 目标面板的宽度,单位为px。| +| height | number | 是 | 目标面板的高度,单位为px。| +| callback | AsyncCallback\ | 是 | 回调函数。当面板大小改变成功,err为undefined,否则err为错误对象。 | + +**示例:** + +```js +try { + panel.resize(500, 1000, (err) => { + if (err) { + console.error('Failed to change the panel size. Cause:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in changing the panel size.'); + }); +} catch (exception) { + console.error('Failed to change the panel size. Cause:' + JSON.stringify(exception)); +} +``` + +### resize10+ + +resize(width: number, height: number): Promise\; + +改变当前面板大小,使用Promise异步回调。 +面板存在大小限制,面板宽度不超出屏幕宽度,面板高度不高于屏幕高度的二分之一。 + +**系统能力:** SystemCapability.MiscServices.InputMethodFramework + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | -------- | +| width | number | 是 | 目标面板的宽度,单位为px。| +| height | number | 是 | 目标面板的高度,单位为px。| + +**返回值:** + +| 类型 | 说明 | +| ------- | ------------------------------ | +| Promise | 无返回结果的Promise对象。 | + +**示例:** + +```js +try { + let promise = panel.resize(500, 1000); + promise.then(() => { + console.info('Succeeded in changing the panel size.'); + }).catch((err) =>{ + console.error('Failed to change the panel size. err: ' + JSON.stringify(err)); + }); +} catch (exception) { + console.error('Failed to change the panel size. err: ' + JSON.stringify(exception)); +} +``` + +### moveTo10+ + +moveTo(x: number, y: number, callback: AsyncCallback\): void + +移动面板位置,使用callback异步回调。 +对FLG_FIXED状态的panel不产生实际移动效果。 + +**系统能力:** SystemCapability.MiscServices.InputMethodFramework + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | -------- | +| x | number | 是 | 面板在x轴方向移动的值,值为正表示右移,单位为px。| +| y | number | 是 | 面板在y轴方向移动的值,值为正表示下移,单位为px。| +| callback | AsyncCallback\ | 是 | 回调函数。当面板位置移动成功,err为undefined,否则err为错误对象。 | + +**示例:** + +```js +try { + panel.moveTo(300, 300, (err) =>{ + if (err) { + console.error('Failed to move the panel. err:' + JSON.stringify(err)); + return; + } + console.info('Succeeded in moving the panel.'); + }); +} catch (exception) { + console.error('Failed to move the panel. err:' + JSON.stringify(exception)); +} +``` + +### moveTo10+ + +moveTo(x: number, y: number): Promise\ + +移动面板位置,使用callback异步回调。 +对FLG_FIXED状态的panel不产生实际移动效果。 + +**系统能力:** SystemCapability.MiscServices.InputMethodFramework + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | -------- | +| x | number | 是 | 面板在x轴方向移动的值,值为正表示右移,单位为px。| +| y | number | 是 | 面板在y轴方向移动的值,值为正表示下移,单位为px。| + +**返回值:** + +| 类型 | 说明 | +| ------- | ------------------------------ | +| Promise | 无返回结果的Promise对象。 | + +**示例:** + +```js +try { + let promise = windowClass.moveTo(300, 300); + promise.then(() => { + console.info('Succeeded in moving the panel.'); + }).catch((err) =>{ + console.error('Failed to move the panel. Cause: ' + JSON.stringify(err)); + }); +} catch (exception) { + console.error('Failed to move the panel. Cause:' + JSON.stringify(exception)); +} +``` + +### show10+ + +show(callback: AsyncCallback\): void + +显示当前面板,使用callback异步回调。 + +**系统能力:** SystemCapability.MiscServices.InputMethodFramework + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | -------- | +| callback | AsyncCallback\ | 是 | 回调函数。当面板显示成功,err为undefined,否则err为错误对象。 | + +**示例:** + +```js +panel.show((err) => { + if (err) { + console.error('Failed to show the panel. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Succeeded in showing the panel.'); +}); +``` + +### show10+ + +show(): Promise\ + +显示当前面板,使用callback异步回调。 + +**系统能力:** SystemCapability.MiscServices.InputMethodFramework + +**返回值:** + +| 类型 | 说明 | +| ------- | ------------------------------ | +| Promise\ | 无返回结果的Promise对象。 | + +**示例:** + +```js +let promise = panel.show(); +promise.then(() => { + console.info('Succeeded in showing the panel.'); +}).catch((err) =>{ + console.error('Failed to show the panel. err: ' + JSON.stringify(err)); +}); +``` + +### hide10+ + +hide(callback: AsyncCallback\): void + +隐藏当前面板,使用callback异步回调。 + +**系统能力:** SystemCapability.MiscServices.InputMethodFramework + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | -------- | +| callback | AsyncCallback\ | 是 | 回调函数。当面板隐藏成功,err为undefined,否则err为错误对象。 | + +**示例:** + +```js +panel.hide((err) => { + if (err) { + console.error('Failed to hide the panel. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Succeeded in hiding the panel.'); +}); +``` + +### hide10+ + +hide(): Promise\ + +隐藏当前面板,使用callback异步回调。 + +**系统能力:** SystemCapability.MiscServices.InputMethodFramework + +**返回值:** + +| 类型 | 说明 | +| ------- | ------------------------------ | +| Promise\ | 无返回结果的Promise对象。 | + +**示例:** + +```js +let promise = panel.hide(); +promise.then(() => { + console.info('Succeeded in hiding the panel.'); +}).catch((err) =>{ + console.error('Failed to hide the panel. err: ' + JSON.stringify(err)); +}); +``` + +### on10+ + +on(type: 'show' | 'hide', callback: () => void): void + +监听当前面板状态,可监听面板类型为show或者hide, 使用callback异步回调。 + +**系统能力:** SystemCapability.MiscServices.InputMethodFramework + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | -------- | +| type | 'show'\|'hide' | 是 | 监听当前面板的状态类型,show表示显示状态,hide表示隐藏状态 | +| callback | () => void | 是 | 回调函数。 | + +**示例:** + +```js +panel.on('show', () => { + console.info('Panel is showing.'); +}); +``` + +### off10+ + +off(type: 'show' | 'hide', callback?: () => void): void + +取消监听当前面板状态,可取消监听的面板类型为show或者hide,使用callback异步回调。 + +**系统能力:** SystemCapability.MiscServices.InputMethodFramework + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | -------- | +| type | 'show'/'hide' | 是 | 要取消监听的当前面板状态类型,show表示显示状态,hide表示隐藏状态 | +| callback | () => void | 否 | 回调函数。 | + +**示例:** + +```js +panel.off('show'); +``` + +### changeFlag10+ + +changeFlag(flag: PanelFlag): void + +改变面板状态为固定态或者悬浮态。仅对SOFT_KEYBOARD类型生效。 + +**系统能力:** SystemCapability.MiscServices.InputMethodFramework + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | -------- | +| flag | [PanelFlag](#panelflag10) | 是 | 要切换到的面板状态类型。 | + +**示例:** + +```js +let panelFlag = inputMethodEngine.getInputMethodAbility().PanelFlag.FLG_FIXED; +panel.changeFlag(panelFlag); +``` + ## KeyboardController 下列API示例中都需使用[on('inputStart')](#oninputstart9)回调获取到KeyboardController实例,再通过此实例调用对应方法。 @@ -708,7 +1337,7 @@ hide(callback: AsyncCallback<void>): void | 错误码ID | 错误信息 | | -------- | -------------------------- | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -742,7 +1371,7 @@ hide(): Promise<void> | 错误码ID | 错误信息 | | -------- | -------------------------- | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -837,7 +1466,7 @@ sendKeyFunction(action:number, callback: AsyncCallback<boolean>): void | 错误码ID | 错误信息 | | -------- | -------------------------- | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -886,7 +1515,7 @@ sendKeyFunction(action: number): Promise<boolean> | 错误码ID | 错误信息 | | -------- | -------------------------- | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -928,7 +1557,7 @@ getForward(length:number, callback: AsyncCallback<string>): void | 错误码ID | 错误信息 | | -------- | ------------------------------ | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | | 12800006 | Input method controller error. | **示例:** @@ -974,7 +1603,7 @@ getForward(length:number): Promise<string> | 错误码ID | 错误信息 | | -------- | ------------------------------ | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | | 12800006 | Input method controller error. | **示例:** @@ -1013,7 +1642,7 @@ getBackward(length:number, callback: AsyncCallback<string>): void | 错误码ID | 错误信息 | | -------- | ------------------------------ | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | | 12800006 | Input method controller error. | **示例:** @@ -1059,7 +1688,7 @@ getBackward(length:number): Promise<string> | 错误码ID | 错误信息 | | -------- | ------------------------------ | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | | 12800006 | Input method controller error. | **示例:** @@ -1099,7 +1728,7 @@ deleteForward(length:number, callback: AsyncCallback<boolean>): void | 错误码ID | 错误信息 | | -------- | -------------------------- | | 12800002 | Input method engine error. | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -1149,7 +1778,7 @@ deleteForward(length:number): Promise<boolean> | 错误码ID | 错误信息 | | -------- | -------------------------- | | 12800002 | Input method engine error. | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -1192,7 +1821,7 @@ deleteBackward(length:number, callback: AsyncCallback<boolean>): void | 错误码ID | 错误信息 | | -------- | -------------------------- | | 12800002 | Input method engine error. | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -1242,7 +1871,7 @@ deleteBackward(length:number): Promise<boolean> | 错误码ID | 错误信息 | | -------- | -------------------------- | | 12800002 | Input method engine error. | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -1281,7 +1910,7 @@ insertText(text:string, callback: AsyncCallback<boolean>): void | 错误码ID | 错误信息 | | -------- | -------------------------- | | 12800002 | Input method engine error. | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -1326,7 +1955,7 @@ insertText(text:string): Promise<boolean> | 错误码ID | 错误信息 | | -------- | -------------------------- | | 12800002 | Input method engine error. | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -1366,7 +1995,7 @@ getEditorAttribute(callback: AsyncCallback<EditorAttribute>): void | 错误码ID | 错误信息 | | -------- | -------------------------- | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -1401,7 +2030,7 @@ getEditorAttribute(): Promise<EditorAttribute> | 错误码ID | 错误信息 | | -------- | -------------------------- | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -1435,7 +2064,7 @@ moveCursor(direction: number, callback: AsyncCallback<void>): void | 错误码ID | 错误信息 | | -------- | -------------------------- | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -1479,7 +2108,7 @@ moveCursor(direction: number): Promise<void> | 错误码ID | 错误信息 | | -------- | -------------------------- | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -1517,7 +2146,7 @@ selectByRange(range: Range, callback: AsyncCallback<void>): void | 错误码ID | 错误信息 | | -------- | -------------------------- | | 401 | parameter error. | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -1562,7 +2191,7 @@ selectByRange(range: Range): Promise<void> | 错误码ID | 错误信息 | | -------- | -------------------------- | | 401 | parameter error. | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -1600,7 +2229,7 @@ selectByMovement(movement: Movement, callback: AsyncCallback<void>): void | 错误码ID | 错误信息 | | -------- | -------------------------- | | 401 | parameter error. | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -1620,7 +2249,7 @@ try { ### selectByMovement10+ -selectByMovement(range: Range): Promise<void> +selectByMovement(movement: Movement): Promise<void> 根据索引范围选中文本。使用promise异步回调。 @@ -1645,7 +2274,7 @@ selectByMovement(range: Range): Promise<void> | 错误码ID | 错误信息 | | -------- | -------------------------- | | 401 | parameter error. | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | **示例:** @@ -1682,7 +2311,7 @@ getTextIndexAtCursor(callback: AsyncCallback<number>): void | 错误码ID | 错误信息 | | -------- | ------------------------------ | | 401 | parameter error. | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | | 12800006 | Input method controller error. | **示例:** @@ -1717,7 +2346,7 @@ getTextIndexAtCursor(): Promise<number> | 错误码ID | 错误信息 | | -------- | ------------------------------ | -| 12800003 | Input method client error. | +| 12800003 | input method client error. | | 12800006 | Input method controller error. | **示例:** @@ -1752,6 +2381,39 @@ inputClient.getTextIndexAtCursor().then((index) => { | keyCode | number | 是 | 否 | 按键的键值。 | | keyAction | number | 是 | 否 | 按键的状态。 | +## PanelFlag10+ + +输入法面板状态类型枚举。 + +**系统能力:** SystemCapability.MiscServices.InputMethodFramework + +| 名称 | 值 | 说明 | +| ------------ | -- | ------------------ | +| FLG_FIXED | 0 | 固定态面板类型。 | +| FLG_FLOATING | 1 | 悬浮态面板类型。 | + +## PanelType10+ + +输入法面板类型枚举。 + +**系统能力:** SystemCapability.MiscServices.InputMethodFramework + +| 名称 | 值 | 说明 | +| ------------ | -- | ------------------ | +| SOFT_KEYBOARD | 0 | 软键盘类型。 | +| STATUS_BAR | 1 | 状态栏类型。 | + +## PanelInfo10+ + +**系统能力:** SystemCapability.MiscServices.InputMethodFramework + +输入法面板属性。 + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| --------- | -------- | ---- | ---- | ------------ | +| type | number | 是 | 是 | 面板的类型。 | +| flag | number | 是 | 是 | 面板的状态类型。 | + ## TextInputClient(deprecated) > **说明:** @@ -2250,3 +2912,4 @@ textInputClient.getEditorAttribute().then((editorAttribute) => { console.error('Failed to getEditorAttribute: ' + JSON.stringify(err)); }); ``` + \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-installer.md b/zh-cn/application-dev/reference/apis/js-apis-installer.md index dc3d93aabe3def9d5ec9b4e6efdbe13b941c43cf..079649bbbdb3af1851fdac372fb1ce1a71ea9412 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-installer.md +++ b/zh-cn/application-dev/reference/apis/js-apis-installer.md @@ -25,7 +25,7 @@ getBundleInstaller(callback: AsyncCallback\): void; 获取BundleInstaller对象,使用callback形式返回结果。 -**系统接口:** 此接口为系统接口,三方应用不支持调用 +**系统接口:** 此接口为系统接口。 **系统能力:** SystemCapability.BundleManager.BundleFramework.Core @@ -59,7 +59,7 @@ getBundleInstaller(): Promise\; 获取BundleInstaller对象,使用callback形式返回结果。 -**系统接口:** 此接口为系统接口,三方应用不支持调用 +**系统接口:** 此接口为系统接口。 **系统能力:** SystemCapability.BundleManager.BundleFramework.Core @@ -89,7 +89,7 @@ install(hapFilePaths: Array<string>, installParam: InstallParam, callback: 以异步方法安装应用,使用callback形式返回结果。 -**系统接口:** 此接口为系统接口,三方应用不支持调用 +**系统接口:** 此接口为系统接口。 **需要权限:** ohos.permission.INSTALL_BUNDLE @@ -118,6 +118,9 @@ install(hapFilePaths: Array<string>, installParam: InstallParam, callback: | 17700017 | Failed to install the HAP since the version of the HAP to install is too early. | | 17700018 | Failed to install because the dependent module does not exist. | | 17700031 | Failed to install the HAP because the overlay check of the HAP is failed. | +| 17700036 | Failed to install the HSP because lacks appropriate permissions. | +| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. | +| 17700041 | Failed to install because enterprise device management disallow install. | **示例:** @@ -146,6 +149,135 @@ try { console.error('getBundleInstaller failed. Cause: ' + error.message); } ``` +## BundleInstaller.install +install(hapFilePaths: Array<string>, callback: AsyncCallback<void>): void; + +以异步方法安装应用,使用callback形式返回结果。 + +**系统接口:** 此接口为系统接口。 + +**需要权限:** ohos.permission.INSTALL_BUNDLE + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------------- | ---------------------------------------------------- | ---- | ------------------------------------------------------------ | +| hapFilePaths | Array<string> | 是 | 存储应用程序包的路径。路径应该是当前应用程序中存放HAP的数据目录。当传入的路径是一个目录时, 该目录下只能放同一个应用的HAP,且这些HAP的签名需要保持一致。 | +| callback | AsyncCallback<void> | 是 | 回调函数,安装应用成功,err为undefined,否则为错误对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------------------ | +| 17700010 | Failed to install the HAP because the HAP fails to be parsed. | +| 17700011 | Failed to install the HAP because the HAP signature fails to be verified. | +| 17700012 | Failed to install the HAP because the HAP path is invalid or the HAP is too large. | +| 17700015 | Failed to install the HAPs because they have different configuration information. | +| 17700016 | Failed to install the HAP because of insufficient system disk space. | +| 17700017 | Failed to install the HAP since the version of the HAP to install is too early. | +| 17700018 | Failed to install because the dependent module does not exist. | +| 17700031 | Failed to install the HAP because the overlay check of the HAP is failed. | +| 17700036 | Failed to install the HSP because lacks appropriate permissions. | +| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. | +| 17700041 | Failed to install because enterprise device management disallow install. | + +**示例:** + +```ts +import installer from '@ohos.bundle.installer'; +let hapFilePaths = ['/data/storage/el2/base/haps/entry/files/']; + +try { + installer.getBundleInstaller().then(data => { + data.install(hapFilePaths, err => { + if (err) { + console.error('install failed:' + err.message); + } else { + console.info('install successfully.'); + } + }); + }).catch(error => { + console.error('getBundleInstaller failed. Cause: ' + error.message); + }); +} catch (error) { + console.error('getBundleInstaller failed. Cause: ' + error.message); +} +``` + +## BundleInstaller.install + +install(hapFilePaths: Array\, installParam?: InstallParam) : Promise\; + +以异步方法安装应用,使用Promise形式返回结果。 + +**系统接口:** 此接口为系统接口。 + +**需要权限:** ohos.permission.INSTALL_BUNDLE + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ | +| hapFilePaths | Array\ | 是 | 存储应用程序包的路径。路径应该是当前应用程序中存放HAP的数据目录。当传入的路径是一个目录时, 该目录下只能放同一个应用的HAP,且这些HAP的签名需要保持一致。 | +| installParam | [InstallParam](#installparam) | 否 | 指定安装所需的其他参数。 | + +**返回值:** + +| 类型 | 说明 | +| --------------- | -------------------------------------- | +| Promise\ | Promise对象。无返回结果的Promise对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------------------ | +| 17700004 | The specified user ID is not found. | +| 17700010 | Failed to install the HAP because the HAP fails to be parsed. | +| 17700011 | Failed to install the HAP because the HAP signature fails to be verified. | +| 17700012 | Failed to install the HAP because the HAP path is invalid or the HAP is too large. | +| 17700015 | Failed to install the HAPs because they have different configuration information. | +| 17700016 | Failed to install the HAP because of insufficient system disk space. | +| 17700017 | Failed to install the HAP since the version of the HAP to install is too early. | +| 17700018 | Failed to install because the dependent module does not exist. | +| 17700031 | Failed to install the HAP because the overlay check of the HAP is failed. | +| 17700036 | Failed to install the HSP because lacks appropriate permissions. | +| 17700039 | Failed to install because disallow install a shared bundle by hapFilePaths. | +| 17700041 | Failed to install because enterprise device management disallow install. | + +**示例:** + +```ts +import installer from '@ohos.bundle.installer'; +let hapFilePaths = ['/data/storage/el2/base/haps/entry/files/']; +let installParam = { + userId: 100, + isKeepData: false, + installFlag: 1, +}; + +try { + installer.getBundleInstaller().then(data => { + data.install(hapFilePaths, installParam) + .then((data) => { + console.info('install successfully: ' + JSON.stringify(data)); + }).catch((error) => { + console.error('install failed:' + error.message); + }); + }).catch(error => { + console.error('getBundleInstaller failed. Cause: ' + error.message); + }); +} catch (error) { + console.error('getBundleInstaller failed. Cause: ' + error.message); +} +``` ## BundleInstaller.uninstall @@ -153,7 +285,7 @@ uninstall(bundleName: string, installParam: InstallParam, callback: AsyncCallbac 以异步方法卸载应用,使用callback形式返回结果。 -**系统接口:** 此接口为系统接口,三方应用不支持调用 +**系统接口:** 此接口为系统接口。 **需要权限:** ohos.permission.INSTALL_BUNDLE @@ -173,9 +305,10 @@ uninstall(bundleName: string, installParam: InstallParam, callback: AsyncCallbac | 错误码ID | 错误信息 | | -------- | ------------------------------------------------------------ | -| 17700004 | The specified user ID is not found. | +| 17700001 | The specified bundle name is not found. | +| 17700004 | The specified user ID is not found. | | 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. | -| 17700101 | The system service is excepted. | +| 17700040 | The specified bundle is a shared bundle which cannot be uninstalled. | **示例:** @@ -205,13 +338,126 @@ try { } ``` +## BundleInstaller.uninstall + +uninstall(bundleName: string, callback: AsyncCallback<void>): void; + +以异步方法卸载应用,使用callback形式返回结果。 + +**系统接口:** 此接口为系统接口。 + +**需要权限:** ohos.permission.INSTALL_BUNDLE + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | ---------------------------------------------------- | ---- | ---------------------------------------------- | +| bundleName | string | 是 | 待卸载应用的包名。 | +| callback | AsyncCallback<void> | 是 | 回调函数,卸载应用成功,err为undefined,否则为错误对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------------------ | +| 17700001 | The specified bundle name is not found. | +| 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. | +| 17700040 | The specified bundle is a shared bundle which cannot be uninstalled. | + +**示例:** + +```ts +import installer from '@ohos.bundle.installer'; +let bundleName = 'com.ohos.demo'; + +try { + installer.getBundleInstaller().then(data => { + data.uninstall(bundleName, err => { + if (err) { + console.error('uninstall failed:' + err.message); + } else { + console.info('uninstall successfully.'); + } + }); + }).catch(error => { + console.error('getBundleInstaller failed. Cause: ' + error.message); + }); +} catch (error) { + console.error('getBundleInstaller failed. Cause: ' + error.message); +} +``` +## BundleInstaller.uninstall + +uninstall(bundleName: string, installParam?: InstallParam) : Promise\; + +以异步方法卸载应用,使用Promise形式返回结果。 + +**系统接口:** 此接口为系统接口。 + +**需要权限:** ohos.permission.INSTALL_BUNDLE + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ | +| bundleName | string | 是 | 待卸载应用的包名。 | +| installParam | [InstallParam](#installparam) | 否 | 指定安装所需的其他参数。 | + +**返回值:** + +| 类型 | 说明 | +| --------------- | -------------------------------------- | +| Promise\ | Promise对象。无返回结果的Promise对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------------------ | +| 17700001 | The specified bundle name is not found. | +| 17700004 | The specified userId is not existed. | +| 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. | +| 17700040 | The specified bundle is a shared bundle which cannot be uninstalled. | + +**示例:** +```ts +import installer from '@ohos.bundle.installer'; +let bundleName = 'com.ohos.demo'; +let installParam = { + userId: 100, + isKeepData: false, + installFlag: 1, +}; + +try { + installer.getBundleInstaller().then(data => { + data.uninstall(bundleName, installParam) + .then((data) => { + console.info('uninstall successfully: ' + JSON.stringify(data)); + }).catch((error) => { + console.error('uninstall failed:' + error.message); + }); + }).catch(error => { + console.error('getBundleInstaller failed. Cause: ' + error.message); + }); +} catch (error) { + console.error('getBundleInstaller failed. Cause: ' + error.message); +} +``` + ## BundleInstaller.recover recover(bundleName: string, installParam: InstallParam, callback: AsyncCallback<void>): void; -以异步方法回滚应用,使用callback形式返回结果。 +以异步方法回滚应用到初次安装时的状态,使用callback形式返回结果。 -**系统接口:** 此接口为系统接口,三方应用不支持调用 +**系统接口:** 此接口为系统接口。 **需要权限:** ohos.permission.INSTALL_BUNDLE @@ -231,6 +477,7 @@ recover(bundleName: string, installParam: InstallParam, callback: AsyncCallback& | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 17700001 | The specified bundle name is not found. | | 17700004 | The specified user ID is not found. | **示例:** @@ -261,13 +508,236 @@ try { } ``` + +## BundleInstaller.recover + +recover(bundleName: string, callback: AsyncCallback<void>): void; + +以异步方法回滚应用到初次安装时的状态,使用callback形式返回结果。 + +**系统接口:** 此接口为系统接口。 + +**需要权限:** ohos.permission.INSTALL_BUNDLE + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | ---------------------------------------------------- | ---- | ---------------------------------------------- | +| bundleName | string | 是 | 待恢复应用的包名。 | +| callback | AsyncCallback<void> | 是 | 回调函数,回滚应用成功,err为undefined,否则为错误对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| -------- | ----------------------------------- | +| 17700001 | The specified bundle name is not found. | + +**示例:** + +```ts +import installer from '@ohos.bundle.installer'; +let bundleName = 'com.ohos.demo'; + +try { + installer.getBundleInstaller().then(data => { + data.recover(bundleName, err => { + if (err) { + console.error('recover failed:' + err.message); + } else { + console.info('recover successfully.'); + } + }); + }).catch(error => { + console.error('getBundleInstaller failed. Cause: ' + error.message); + }); +} catch (error) { + console.error('getBundleInstaller failed. Cause: ' + error.message); +} +``` + +## BundleInstaller.recover + +recover(bundleName: string, installParam?: InstallParam) : Promise\; + +以异步方法回滚应用到初次安装时的状态,使用Promise形式返回结果。 + +**系统接口:** 此接口为系统接口。 + +**需要权限:** ohos.permission.INSTALL_BUNDLE + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------------ | ----------------------------- | ---- | ------------------------------------------------------------ | +| bundleName | string | 是 | 待卸载应用的包名。 | +| installParam | [InstallParam](#installparam) | 否 | 指定安装所需的其他参数。 | + +**返回值:** + +| 类型 | 说明 | +| --------------- | -------------------------------------- | +| Promise\ | Promise对象。无返回结果的Promise对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| -------- | ----------------------------------- | +| 17700001 | The specified bundle name is not found. | +| 17700004 | The specified user ID is not found. | + +**示例:** +```ts +import installer from '@ohos.bundle.installer'; +let bundleName = 'com.ohos.demo'; +let installParam = { + userId: 100, + isKeepData: false, + installFlag: 1, +}; + +try { + installer.getBundleInstaller().then(data => { + data.recover(bundleName, installParam) + .then((data) => { + console.info('recover successfully: ' + JSON.stringify(data)); + }).catch((error) => { + console.error('recover failed:' + error.message); + }); + }).catch(error => { + console.error('getBundleInstaller failed. Cause: ' + error.message); + }); +} catch (error) { + console.error('getBundleInstaller failed. Cause: ' + error.message); +} +``` + +## BundleInstaller.uninstall10+ + +uninstall(uninstallParam: UninstallParam, callback : AsyncCallback\) : void ; + +以异步方法卸载一个共享包,使用callback形式返回结果。 + +**系统接口:** 此接口为系统接口。 + +**需要权限:** ohos.permission.INSTALL_BUNDLE + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------------- | ----------------------------------- | ---- | -------------------------------------------------------- | +| uninstallParam | [UninstallParam](#uninstallparam10) | 是 | 共享包卸载需指定的参数信息。 | +| callback | AsyncCallback<void> | 是 | 回调函数,卸载应用成功,err为undefined,否则为错误对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------------------ | +| 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. | +| 17700037 | The version of shared bundle is dependent on other applications. | +| 17700038 | The specified shared bundle does not exist. | + +**示例:** + +```ts +import installer from '@ohos.bundle.installer'; +let uninstallParam = { + bundleName : "com.ohos.demo", +}; + +try { + installer.getBundleInstaller().then(data => { + data.uninstall(uninstallParam, err => { + if (err) { + console.error('uninstall failed:' + err.message); + } else { + console.info('uninstall successfully.'); + } + }); + }).catch(error => { + console.error('getBundleInstaller failed. Cause: ' + error.message); + }); +} catch (error) { + console.error('getBundleInstaller failed. Cause: ' + error.message); +} +``` + +## BundleInstaller.uninstall10+ + +uninstall(uninstallParam: UninstallParam) : Promise\; + +以异步方法卸载一个共享包,使用Promise形式返回结果。 + +**系统接口:** 此接口为系统接口。 + +**需要权限:** ohos.permission.INSTALL_BUNDLE + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------------- | ----------------------------------- | ---- | ---------------------------- | +| uninstallParam | [UninstallParam](#uninstallparam10) | 是 | 共享包卸载需指定的参数信息。 | + +**返回值:** + +| 类型 | 说明 | +| ------------- | -------------------------------------- | +| Promise\ | Promise对象。无返回结果的Promise对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------------------ | +| 17700020 | The specified bundle is pre-installed bundle which cannot be uninstalled. | +| 17700037 | The version of shared bundle is dependent on other applications. | +| 17700038 | The specified shared bundle does not exist. | + +**示例:** + +```ts +import installer from '@ohos.bundle.installer'; +let uninstallParam = { + bundleName : "com.ohos.demo", +}; + +try { + installer.getBundleInstaller().then(data => { + data.uninstall(uninstallParam, err => { + if (err) { + console.error('uninstall failed:' + err.message); + } else { + console.info('uninstall successfully.'); + } + }); + }).catch(error => { + console.error('getBundleInstaller failed. Cause: ' + error.message); + }); +} catch (error) { + console.error('getBundleInstaller failed. Cause: ' + error.message); +} +``` ## HashParam 应用程序安装卸载哈希参数信息。 **系统能力:** SystemCapability.BundleManager.BundleFramework.Core - **系统接口:** 此接口为系统接口,三方应用不支持调用 + **系统接口:** 此接口为系统接口。 | 名称 | 类型 | 必填 | 说明 | | ---------- | ------ | ---------------- | ---------------- | @@ -280,12 +750,26 @@ try { **系统能力:** SystemCapability.BundleManager.BundleFramework.Core - **系统接口:** 此接口为系统接口,三方应用不支持调用 + **系统接口:** 此接口为系统接口。 | 名称 | 类型 | 必填 | 说明 | | ------------------------------ | ------------------------------ | ------------------ | ------------------ | -| userId | number | 是 | 指示用户id,可使用[queryOsAccountLocalIdFromProcess](js-apis-osAccount.md#queryosaccountlocalidfromprocess9)获取当前进程所在用户。 | -| installFlag | number | 是 | 指示安装标志,枚举值:0:应用初次安装,1:应用覆盖安装。 | -| isKeepData | boolean | 是 | 卸载时是否保留数据目录。 | -| hashParams | Array<[HashParam](#hashparam)> | 是 | 哈希值参数。 | -| crowdtestDeadline| number | 是 |[众测](https://developer.huawei.com/consumer/cn/agconnect/crowd-test/)截止日期。 | \ No newline at end of file +| userId | number | 否 | 指示用户id,可使用[queryOsAccountLocalIdFromProcess](js-apis-osAccount.md#getOsAccountLocalId)获取当前进程所在用户。 | +| installFlag | number | 否 | 指示安装标志,枚举值:0:应用初次安装,1:应用覆盖安装。 | +| isKeepData | boolean | 否 | 卸载时是否保留数据目录。 | +| hashParams | Array<[HashParam](#hashparam)> | 否 | 哈希值参数。 | +| crowdtestDeadline| number | 否 |[众测](https://developer.huawei.com/consumer/cn/agconnect/crowd-test/)截止日期。 | +| sharedBundleDirPaths10+ | Array\ | 否 |共享包文件所在路径。 | + +## UninstallParam10+ + +共享包卸载需指定的参数信息。 + + **系统能力:** SystemCapability.BundleManager.BundleFramework.Core + + **系统接口:** 此接口为系统接口。 + +| 名称 | 类型 | 必填 | 说明 | +| ----------- | ------ | ---- | ------------------------------------------------------------ | +| bundleName | string | 是 | 共享包包名。 | +| versionCode | number | 否 | 指示共享包的版本号。如果不填写versionCode,则卸载该包名的所有共享包。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-intl.md b/zh-cn/application-dev/reference/apis/js-apis-intl.md index 584bd5b433ad8435b4c5067b4ec71823219bad56..1065a275779112f4950ce0c8316c02699444c798 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-intl.md +++ b/zh-cn/application-dev/reference/apis/js-apis-intl.md @@ -67,7 +67,7 @@ constructor(locale: string, options?: LocaleOptions) | 参数名 | 类型 | 必填 | 说明 | | -------------------- | -------------------------------- | ---- | ---------------------------- | | locale | string | 是 | 包含区域信息的字符串,包括语言以、脚本、国家或地区。语言、脚本、国家或地区的国际标准及组合方式请见[Intl开发指导](../../internationalization/intl-guidelines.md#设置区域信息) | -| options9+ | [LocaleOptions](#localeoptions6) | 否 | 用于创建区域对象的选项。 | +| options9+ | [LocaleOptions](#localeoptions9) | 否 | 用于创建区域对象的选项。 | **示例:** ```js @@ -159,7 +159,7 @@ minimize(): Locale ``` -## LocaleOptions6+ +## LocaleOptions9+ 表示区域初始化选项。 @@ -206,7 +206,7 @@ constructor(locale: string | Array<string>, options?: DateTimeOptions) | 参数名 | 类型 | 必填 | 说明 | | -------------------- | ------------------------------------ | ---- | ---------------------------- | | locale | string \| Array<string> | 是 | 包含区域设置信息的字符串,包括语言以及可选的脚本和区域。 | -| options9+ | [DateTimeOptions](#datetimeoptions6) | 否 | 用于创建时间日期格式化的选项。 | +| options9+ | [DateTimeOptions](#datetimeoptions9) | 否 | 用于创建时间日期格式化的选项。 | **示例:** ```js @@ -298,7 +298,7 @@ resolvedOptions(): DateTimeOptions | 类型 | 说明 | | ------------------------------------ | ----------------------------- | -| [DateTimeOptions](#datetimeoptions6) | DateTimeFormat 对象的格式化选项。 | +| [DateTimeOptions](#datetimeoptions9) | DateTimeFormat 对象的格式化选项。 | **示例:** ```js @@ -310,7 +310,7 @@ resolvedOptions(): DateTimeOptions ``` -## DateTimeOptions6+ +## DateTimeOptions9+ 表示时间日期格式化选项。 @@ -370,7 +370,7 @@ constructor(locale: string | Array<string>, options?: NumberOptions) | 参数名 | 类型 | 必填 | 说明 | | -------------------- | -------------------------------- | ---- | ---------------------------- | | locale | string \| Array<string> | 是 | 包含区域设置信息的字符串,包括语言以及可选的脚本和区域。 | -| options9+ | [NumberOptions](#numberoptions6) | 否 | 用于创建数字格式化的选项。 | +| options9+ | [NumberOptions](#numberoptions9) | 否 | 用于创建数字格式化的选项。 | **示例:** ```js @@ -420,7 +420,7 @@ resolvedOptions(): NumberOptions | 类型 | 说明 | | -------------------------------- | --------------------------- | -| [NumberOptions](#numberoptions6) | NumberFormat 对象的格式化选项。 | +| [NumberOptions](#numberoptions9) | NumberFormat 对象的格式化选项。 | **示例:** @@ -433,7 +433,7 @@ resolvedOptions(): NumberOptions ``` -## NumberOptions6+ +## NumberOptions9+ 表示设备支持的能力。 @@ -493,7 +493,7 @@ constructor(locale: string | Array<string>, options?: CollatorOptions) | 参数名 | 类型 | 必填 | 说明 | | -------------------- | ------------------------------------ | ---- | ---------------------------- | | locale | string \| Array<string> | 是 | 包含区域设置信息的字符串,包括语言以及可选的脚本和区域。 | -| options9+ | [CollatorOptions](#collatoroptions8) | 否 | 用于创建排序对象的选项。 | +| options9+ | [CollatorOptions](#collatoroptions9) | 否 | 用于创建排序对象的选项。 | **示例:** ```js @@ -544,7 +544,7 @@ resolvedOptions(): CollatorOptions | 类型 | 说明 | | ------------------------------------ | ----------------- | -| [CollatorOptions](#collatoroptions8) | 返回的Collator对象的属性。 | +| [CollatorOptions](#collatoroptions9) | 返回的Collator对象的属性。 | **示例:** ```js @@ -556,7 +556,7 @@ resolvedOptions(): CollatorOptions ``` -## CollatorOptions8+ +## CollatorOptions9+ 表示Collator可设置的属性。 @@ -604,7 +604,7 @@ constructor(locale: string | Array<string>, options?: PluralRulesOptions) | 参数名 | 类型 | 必填 | 说明 | | -------------------- | ---------------------------------------- | ---- | ---------------------------- | | locale | string \| Array<string> | 是 | 包含区域设置信息的字符串,包括语言以及可选的脚本和区域。 | -| options9+ | [PluralRulesOptions](#pluralrulesoptions8) | 否 | 用于创建单复数对象的选项。 | +| options9+ | [PluralRulesOptions](#pluralrulesoptions9) | 否 | 用于创建单复数对象的选项。 | **示例:** ```js @@ -647,7 +647,7 @@ select(n: number): string ``` -## PluralRulesOptions8+ +## PluralRulesOptions9+ 表示PluralRules对象可设置的属性。 @@ -695,7 +695,7 @@ constructor(locale: string | Array<string>, options?: RelativeTimeFormatIn | 参数名 | 类型 | 必填 | 说明 | | -------------------- | ---------------------------------------- | ---- | ---------------------------- | | locale | string \| Array<string> | 是 | 包含区域设置信息的字符串,包括语言以及可选的脚本和区域。 | -| options9+ | [RelativeTimeFormatInputOptions](#relativetimeformatinputoptions8) | 否 | 用于创建相对时间格式化对象的选项。 | +| options9+ | [RelativeTimeFormatInputOptions](#relativetimeformatinputoptions9) | 否 | 用于创建相对时间格式化对象的选项。 | **示例:** ```js @@ -787,7 +787,7 @@ resolvedOptions(): RelativeTimeFormatResolvedOptions ``` -## RelativeTimeFormatInputOptions8+ +## RelativeTimeFormatInputOptions9+ 表示RelativeTimeFormat对象可设置的属性。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-launcherBundleManager.md b/zh-cn/application-dev/reference/apis/js-apis-launcherBundleManager.md index be132d3f887219bb55d89c63cbd09be6f7b42d59..c0eee70d41e4a9dd645b472388f8821dc56ca5cb 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-launcherBundleManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-launcherBundleManager.md @@ -45,7 +45,7 @@ getLauncherAbilityInfo(bundleName: string, userId: number, callback: AsyncCallba | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | | 17700001 | The specified bundle name is not found. | -| 17700004 | The specified userId is not found. | +| 17700004 | The specified user ID is not found. | **示例:** @@ -97,7 +97,7 @@ getLauncherAbilityInfo(bundleName: string, userId: number) : Promise **说明:** -> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 - LightWeightMap可用于存储具有关联关系的key-value键值对集合,存储元素中key值唯一,每个key对应一个value。 LightWeightMap依据泛型定义,采用轻量级结构,初始默认容量大小为8,每次扩容大小为原始容量的两倍。 @@ -13,9 +10,14 @@ LightWeightMap和[HashMap](js-apis-hashmap.md)都是用来存储键值对的集 **推荐使用场景:** 当需要存取key-value键值对时,推荐使用占用内存更小的LightWeightMap。 -文档中存在泛型的使用,涉及以下泛型标记符:
-- K: Key, 键
-- V: Value, 值 +文档中存在泛型的使用,涉及以下泛型标记符:
+- K:Key,键
+- V:Value,值 + +> **说明:** +> +> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + ## 导入模块 @@ -197,9 +199,8 @@ hasValue(value: V): boolean ```ts let lightWeightMap = new LightWeightMap(); -let result = lightWeightMap.hasValue(123); lightWeightMap.set("squirrel", 123); -let result1 = lightWeightMap.hasValue(123); +let result = lightWeightMap.hasValue(123); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-lightweightset.md b/zh-cn/application-dev/reference/apis/js-apis-lightweightset.md index 7de14cbeef300fbad13e1a49af32ad098ca167e5..78454733bd5f4f4e3aa27e694e2fb670bfc089e6 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-lightweightset.md +++ b/zh-cn/application-dev/reference/apis/js-apis-lightweightset.md @@ -1,8 +1,5 @@ # @ohos.util.LightWeightSet (非线性容器LightWeightSet) -> **说明:** -> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 - LightWeightSet可用于存储一系列值的集合,存储元素中value值唯一。 LightWeightSet依据泛型定义,采用轻量级结构,初始默认容量大小为8,每次扩容大小为原始容量的两倍。 @@ -13,8 +10,13 @@ LightWeightSet和[HashSet](js-apis-hashset.md)都是用来存储键值的集合 **推荐使用场景:** 当需要存取某个集合或是对某个集合去重时,推荐使用占用内存更小的LightWeightSet。 -文档中存在泛型的使用,涉及以下泛型标记符:
-- T: Type, 类 +文档中存在泛型的使用,涉及以下泛型标记符:
+- T:Type,类 + +> **说明:** +> +> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + ## 导入模块 @@ -227,9 +229,8 @@ has(key: T): boolean ```ts let lightWeightSet = new LightWeightSet(); -let result = lightWeightSet.has(123); lightWeightSet.add(123); -result = lightWeightSet.has(123); +let result = lightWeightSet.has(123); ``` @@ -267,7 +268,7 @@ equal(obj: Object): boolean let lightWeightSet = new LightWeightSet(); lightWeightSet.add("squirrel"); lightWeightSet.add("sparrow"); -let obj = ["squirrel", "sparrow"]; +let obj = ["sparrow", "squirrel"]; let result = lightWeightSet.equal(obj); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-linkedlist.md b/zh-cn/application-dev/reference/apis/js-apis-linkedlist.md index 0dacc445d76d0c16ee6239f890bebd6177532c6d..1e1f79303dd7fad0b09ae16d06e6f1a6beb903e1 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-linkedlist.md +++ b/zh-cn/application-dev/reference/apis/js-apis-linkedlist.md @@ -198,7 +198,6 @@ has(element: T): boolean ```ts let linkedList = new LinkedList(); -let result1 = linkedList.has("squirrel"); linkedList.add("squirrel"); let result = linkedList.has("squirrel"); ``` @@ -802,7 +801,7 @@ linkedList.add(2); linkedList.add(4); linkedList.add(5); linkedList.add(4); -linkedList.getLast(); +let result = linkedList.getLast(); ``` ### [Symbol.iterator] diff --git a/zh-cn/application-dev/reference/apis/js-apis-list.md b/zh-cn/application-dev/reference/apis/js-apis-list.md index 340e534933ea1233516c9fa77589eb15dc32f5fa..e97ac4ed48a60c348da698992021b4691bccd089 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-list.md +++ b/zh-cn/application-dev/reference/apis/js-apis-list.md @@ -7,12 +7,13 @@ List和[LinkedList](js-apis-linkedlist.md)相比,LinkedList是双向链表, **推荐使用场景:** 当需要频繁的插入删除时,推荐使用List高效操作。 文档中存在泛型的使用,涉及以下泛型标记符:
-- T:Type, 类 +- T:Type,类 > **说明:** > > 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + ## 导入模块 ```ts @@ -160,9 +161,8 @@ has(element: T): boolean ```ts let list = new List(); -let result = list.has("squirrel"); list.add("squirrel"); -let result1 = list.has("squirrel"); +let result = list.has("squirrel"); ``` ### get @@ -288,7 +288,6 @@ list.add(2); list.add(1); list.add(2); list.add(4); -list.getIndexOf(2); let result = list.getIndexOf(2); ``` @@ -327,14 +326,11 @@ let list = new List(); list.add(2); list.add(4); list.add(5); -list.add(2); -let obj1 = new List(); -obj1.add(2); -obj1.add(4); -obj1.add(5); -list.equal(obj1); -let obj2 = {name : "Dylon", age : "13"}; -let result = list.equal(obj2); +let obj = new List(); +obj.add(2); +obj.add(4); +obj.add(5); +let result = list.equal(obj); ``` ### removeByIndex @@ -457,11 +453,9 @@ list.add(2); list.add(4); list.add(5); list.add(4); -list.replaceAllElements((value: number, index: number) => { - return value = 2 * value; -}); -list.replaceAllElements((value: number, index: number) => { - return value = value - 2; +list.replaceAllElements((value) => { + // 用户操作逻辑根据实际场景进行添加。 + return value; }); ``` @@ -589,9 +583,7 @@ list.add(2); list.add(4); list.add(5); list.add(4); -let result = list.getSubList(2, 4); -let result1 = list.getSubList(4, 3); -let result2 = list.getSubList(2, 6); +let result = list.getSubList(1, 3); ``` ### clear @@ -659,7 +651,7 @@ list.add(2); list.add(4); list.add(5); list.add(4); -list.set(2, "b"); +let result = list.set(2, "b"); ``` ### convertToArray diff --git a/zh-cn/application-dev/reference/apis/js-apis-logs.md b/zh-cn/application-dev/reference/apis/js-apis-logs.md index 40213556ac95c072d5b85679700734315d2e9470..31dd38d1423d394442eafa6978746e051941944a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-logs.md +++ b/zh-cn/application-dev/reference/apis/js-apis-logs.md @@ -83,7 +83,7 @@ error(message: string): void | message | string | 是 | 表示要打印的文本信息。 | -## 示例 +**示例:** ``` export default { @@ -99,3 +99,260 @@ export default { 在DevEco Studio的底部,切换到“HiLog”窗口。选择当前的设备及进程,日志级别选择Info,搜索内容设置为“Hello World”。此时窗口仅显示符合条件的日志,效果如图所示: ![zh-cn_image_0000001200913929](figures/zh-cn_image_0000001200913929.png) + +## console.assert10+ + +assert(value?: Object, ...arguments: Object[]): void + +若value为假,打印后续内容。 + +**系统能力:** SystemCapability.Utils.Lang + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | ----------- | +| value | Object | 否 | 值 | +| arguments | Object | 否 | 错误消息打印。 | + +**示例:** +``` +console.assert(true, 'does nothing'); + +console.assert(false, 'console %s work', 'didn\'t'); +// Assertion console:ohos didn't work + +console.assert(); +// Assertion failed +``` +## console.count10+ + +count(label?: string): void + +维护一个内部计数器, 并输出调用label的console.count()次数。默认值为'default'。 + +**系统能力:** SystemCapability.Utils.Lang + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | ----------- | +| label | string | 否 | 计数器标签名。 | + +**示例:** +``` +console.count() +// default: 1 +console.count('default') +// default: 2 +console.count('abc') +// abc: 1 +console.count('xyz') +// xyz: 1 +console.count('abc') +abc: 2 +console.count() +// default: 3 +``` + +## console.countReset10+ + +countReset(label?: string): void + +清除label名的计数。默认值为'default'。 + +**系统能力:** SystemCapability.Utils.Lang + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | ----------- | +| label | string | 否 | 计数器标签名。 | + +**示例:** +``` +console.count('abc'); +// abc: 1 +console.countReset('abc'); +console.count('abc'); +// abc: 1 +``` + +## console.dir10+ + +dir(dir?: Object): void + +打印对象内容。 + +**系统能力:** SystemCapability.Utils.Lang + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | ----------- | +| dir | Object | 否 | 需要打印内容的对象。 | + +## console.dirxml10+ + +dirxml(...arguments: Object[]): void + +此方法调用 console.log() 将接收到的参数传给它。此方法不会产生任何 XML 格式。 + +**系统能力:** SystemCapability.Utils.Lang + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | ----------- | +| arguments | Object | 否 | 要打印的信息。 | + +## console.group10+ + +group(...arguments: Object[]): void + +将后续行的缩进增加 groupIndentation 长度的空格。 +如果提供需要打印的信息,首先先打印信息,没有额外的缩进。 + +**系统能力:** SystemCapability.Utils.Lang + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | ----------- | +| arguments | Object | 否 | 要打印的信息。 | +## console.groupCollapsed10+ + +groupCollapsed(...arguments: Object[]): void + +group的别名。 + +**系统能力:** SystemCapability.Utils.Lang + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | ----------- | +| arguments | Object | 否 | 要打印的信息。| + +## console.groupEnd10+ + +groupEnd(): void + +将后续行的缩进减少 groupIndentation 长度的空格。 + +**系统能力:** SystemCapability.Utils.Lang + +## console.table10+ + +table(tableData?: Object): void + +以表格形式打印数据。 + +**系统能力:** SystemCapability.Utils.Lang + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | ----------- | +| tableData | Object | 否 | 要打印为表格形式的对象。 | + +**示例:** +``` +console.table([1, 2, 3]); +// ┌─────────┬────────┐ +// │ (index) │ Values │ +// ├─────────┼────────┤ +// │ 0 │ 1 │ +// │ 1 │ 2 │ +// │ 2 │ 3 │ +// └─────────┴────────┘ + +console.table({ a: [1, 2, 3, 4, 5], b: 5, c: { e: 5 } }); + +// ┌─────────┬───┬───┬───┬───┬───┬───┬────────┐ +// │ (index) │ 0 │ 1 │ 2 │ 3 │ 4 │ e │ Values │ +// ├─────────┼───┼───┼───┼───┼───┼───┼────────┤ +// │ a │ 1 │ 2 │ 3 │ 4 │ 5 │ │ │ +// │ b │ │ │ │ │ │ │ 5 │ +// │ c │ │ │ │ │ │ 5 │ │ +// └─────────┴───┴───┴───┴───┴───┴───┴────────┘ +``` +## console.time10+ + +time(label?: string): void + +启动可用于计算操作持续时间的计时器。默认值为'default'。可使用console.timeEnd()关闭计时器并打印结果。 + +**系统能力:** SystemCapability.Utils.Lang + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | ----------- | +| label | string | 否 | 计时器标识。 | + +## console.timeEnd10+ + +timeEnd(label?: string): void + +停止之前通过调用 console.time() 启动的计时器并将结果打印。默认值为'default'。 + +**系统能力:** SystemCapability.Utils.Lang + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | ----------- | +| label | string | 否 | 计时器标识。 | + +**示例:** +``` +console.time('abc'); +console.timeEnd('abc'); +// abc: 225.438ms +``` + +## console.timeLog10+ + +timeLog(label?: string, ...arguments: Object[]): void + +对于先前通过调用 console.time() 启动的计时器,打印经过时间和其他 data 参数。 + +**系统能力:** SystemCapability.Utils.Lang + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | ----------- | +| label | string | 否 | 计时器标识。 | +| arguments | Object | 否 | 需要打印的其他日志。 | + +**示例:** +``` +console.time('timer1'); +const value = aaa(); // 返回 17 +console.timeLog('timer1', value); +// timer1: 365.227ms 17 +console.timeEnd('timer1'); +// timer1: 513.22ms +``` + +## console.trace10+ + +trace(...arguments: Object[]): void + +打印当前堆栈。 + +**系统能力:** SystemCapability.Utils.Lang + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | ----------- | +| arguments | Object | 否 | 需要打印的其他日志。 | + +**示例:** +``` +console.trace(); +console.trace("Show the trace"); +``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-matrix4.md b/zh-cn/application-dev/reference/apis/js-apis-matrix4.md index 424e3d5b4cddc2ffbd92f00a3e76ed8e7a660d2a..8e5bd9f7f01cd257b104671976a23bdce21c2b83 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-matrix4.md +++ b/zh-cn/application-dev/reference/apis/js-apis-matrix4.md @@ -281,11 +281,11 @@ Matrix的平移函数,可以为当前矩阵增加x轴/Y轴/Z轴平移效果。 **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | ------------------------------------- | -| x | number | 否 | x轴的平移距离,单位px。
默认值:0 | -| y | number | 否 | y轴的平移距离,单位px。
默认值:0 | -| z | number | 否 | z轴的平移距离,单位px。
默认值:0 | +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ----------------------------------------------------------- | +| x | number | 否 | x轴的平移距离,单位px。
默认值:0
取值范围 (-∞, +∞) | +| y | number | 否 | y轴的平移距离,单位px。
默认值:0
取值范围 (-∞, +∞) | +| z | number | 否 | z轴的平移距离,单位px。
默认值:0
取值范围 (-∞, +∞) | **返回值:** @@ -328,13 +328,13 @@ Matrix的缩放函数,可以为当前矩阵增加x轴/Y轴/Z轴缩放效果。 **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ------- | ------ | ---- | --------------------------------- | -| x | number | 否 | x轴的缩放倍数。
默认值:1 | -| y | number | 否 | y轴的缩放倍数。
默认值:1 | -| z | number | 否 | z轴的缩放倍数。
默认值:1 | -| centerX | number | 否 | 变换中心点x轴坐标。
默认值:0 | -| centerY | number | 否 | 变换中心点y轴坐标。
默认值:0 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | ------------------------------------------------------------ | +| x | number | 否 | x轴的缩放倍数。x>1时以x轴方向放大,x<1时以x轴方向缩小。
默认值:1
取值范围 [0, +∞)
**说明:**
设置小于0的值时,按照默认值处理。 | +| y | number | 否 | y轴的缩放倍数。y>1时以y轴方向放大,y<1时以y轴方向缩小。
默认值:1
取值范围 [0, +∞)
**说明:**
设置小于0的值时,按照默认值处理。 | +| z | number | 否 | z轴的缩放倍数。z>1时以z轴方向放大,z<1时以z轴方向缩小。
默认值:1
取值范围 [0, +∞)
**说明:**
设置小于0的值时,按照默认值处理。 | +| centerX | number | 否 | 变换中心点x轴坐标。
默认值:0。
取值范围 (-∞, +∞) | +| centerY | number | 否 | 变换中心点y轴坐标。
默认值:0。
取值范围 (-∞, +∞) | **返回值:** @@ -376,14 +376,14 @@ Matrix的旋转函数,可以为当前矩阵增加x轴/Y轴/Z轴旋转效果。 **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ------- | ------ | ---- | --------------------------------- | -| x | number | 否 | 旋转轴向量x坐标。
默认值:1 | -| y | number | 否 | 旋转轴向量y坐标。
默认值:1 | -| z | number | 否 | 旋转轴向量z坐标。
默认值:1 | -| angle | number | 否 | 旋转角度。
默认值:0 | -| centerX | number | 否 | 变换中心点x轴坐标。
默认值:0 | -| centerY | number | 否 | 变换中心点y轴坐标。
默认值:0 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | ------------------------------------------------------- | +| x | number | 否 | 旋转轴向量x坐标。
默认值:1。
取值范围 (-∞, +∞) | +| y | number | 否 | 旋转轴向量y坐标。
默认值:1。
取值范围 (-∞, +∞) | +| z | number | 否 | 旋转轴向量z坐标。
默认值:1。
取值范围 (-∞, +∞) | +| angle | number | 否 | 旋转角度。
默认值:0 | +| centerX | number | 否 | 变换中心点x轴坐标。
默认值:0 | +| centerY | number | 否 | 变换中心点y轴坐标。
默认值:0 | **返回值:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-measure.md b/zh-cn/application-dev/reference/apis/js-apis-measure.md new file mode 100644 index 0000000000000000000000000000000000000000..9b6a74cd976bea0e277631025fe3c9f5c5c1322e --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-measure.md @@ -0,0 +1,128 @@ +# @ohos.measure (文本计算) + +本模块提供文本宽度、高度等相关计算。 + +> **说明** +> +> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + + +## 导入模块 + +``` +import measure from '@ohos.measure' +``` + +## measure.measureText + +measureText(options: MeasureOptions): number + +计算指定文本单行布局下的宽度。 + +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------------------- | ---- | --------- | +| options | [MeasureOptions](#measureoptions) | 是 | 被计算文本描述信息。 | + +**返回值:** + +| 类型 | 说明 | +| ------------ | --------- | +| number | 文本宽度。
**说明:** 单位px。 | + + +**示例:** + +```ts +import measure from '@ohos.measure' +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + @State textWidth : number = measure.measureText({ + textContent: "Hello word", + fontSize: '50px' + }) + build() { + Row() { + Column() { + Text("The width of 'Hello World': " + this.textWidth) + } + .width('100%') + } + .height('100%') + } +} +``` + +## measure.measureTextSize10+ + +measureTextSize(options: MeasureOptions): SizeOptions + +计算指定文本单行布局下的宽度。 + +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------------------- | ---- | --------- | +| options | [MeasureOptions](#measureoptions) | 是 | 被计算文本描述信息。 | + +**返回值:** + +| 类型 | 说明 | +| ------------ | --------- | +| SizeOptions | 返回文本所占布局宽度和高度。
**说明:** 文本宽度以及高度返回值单位均为px。 | + + +**示例:** + +```ts +import measure from '@ohos.measure' +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + textSize : SizeOptions = measure.measureTextSize({ + textContent: "Hello word", + fontSize: '50px' + }) + build() { + Row() { + Column() { + Text("The width of 'Hello World': " + this.textSize.width) + Text("The height of 'Hello World': " + this.textSize.height) + } + .width('100%') + } + .height('100%') + } +} +``` + +## MeasureOptions + +被计算文本属性。 + +**系统能力:** SystemCapability.ArkUI.ArkUI.Full + +| 名称 | 类型 | 必填 | 说明 | +| -------------- | -------------------------------------------------------------------------------------------------- | ---- | ----------------------------------------------- | +| textContent | string | 是 | 设置被计算文本内容。 | +| constraintWidth10+ | number \| string \| [Resource](../arkui-ts/ts-types.md#resource) | 否 | 设置被计算文本布局宽度。
**说明:** 默认单位为vp | +| fontSize | number \| string \| [Resource](../arkui-ts/ts-types.md#resource) | 否 | 设置被计算文本字体大小,fontSize为number类型时,使用fp单位。
默认值:16fp。
**说明:** 不支持设置百分比字符串。 | +| fontStyle | number \| [FontStyle](../arkui-ts/ts-appendix-enums.md#fontstyle) | 否 | 设置被计算文本字体样式。
默认值:FontStyle.Normal | +| fontWeight | number \| string \| [FontWeight](../arkui-ts/ts-appendix-enums.md#fontweight) | 否 | 设置被计算文本的字体粗细,number类型取值[100, 900],取值间隔为100,默认为400,取值越大,字体越粗。string类型仅支持number类型取值的字符串形式,例如"400",以及"bold"、"bolder"、"lighter"、"regular"、"medium",分别对应FontWeight中相应的枚举值。
默认值:FontWeight.Normal| +| fontFamily | string \| [Resource](../arkui-ts/ts-types.md#resource) | 否 | 设置被计算文本字体列表。默认字体'HarmonyOS Sans',且当前只支持这种字体。| +| letterSpacing | number \| string | 否 | 设置被计算文本字符间距。| +| textAlign10+ | number \| [TextAlign](../arkui-ts/ts-appendix-enums.md#textalign) | 否 | 设置被计算文本水平方向的对齐方式。
默认值:TextAlign.Start| +| overflow10+ | number \| [TextOverflow](../arkui-ts/ts-appendix-enums.md#textoverflow) | 否 | 设置被计算文本超长时的截断方式。| +| maxLines10+ | number | 否 | 设置被计算文本最大行数。| +| lineHeight10+ | number \| string \| [Resource](../arkui-ts/ts-types.md#resource) | 否 | 设置被计算文本行高。| +| baselineOffset10+ | number \| string | 否 | 设置被计算文本基线的偏移量。
默认值:0 | +| textCase10+ | number \| [TextCase](../arkui-ts/ts-appendix-enums.md#textcase) | 否 | 设置被计算文本大小写。
默认值:TextCase.Normal | + 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 25907d1fbcd5e36ef3450ac6174c7a815a6444fc..7efa6ee75400d5f8daecb9c59e244a5f50c1414b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-media.md +++ b/zh-cn/application-dev/reference/apis/js-apis-media.md @@ -350,7 +350,7 @@ Codec MIME类型枚举。 播放管理类,用于管理和播放媒体资源。在调用AVPlayer的方法前,需要先通过[createAVPlayer()](#mediacreateavplayer9)构建一个AVPlayer实例。 -Audio/Video播放demo可参考:[AVPlayer开发指导](../../media/avplayer-playback.md)。 +Audio/Video播放demo可参考:[音频播放开发指导](../../media/using-avplayer-for-playback.md)、[视频播放开发指导](../../media/video-playback.md)。 ### 属性
@@ -372,6 +372,10 @@ Audio/Video播放demo可参考:[AVPlayer开发指导](../../media/avplayer-pla | width9+ | number | 是 | 否 | 视频宽,单位为像素(px),可查询参数。
返回为(0)表示无效值,**prepared**/**playing**/**paused**/**completed**状态下有效。 | | height9+ | number | 是 | 否 | 视频高,单位为像素(px),可查询参数。
返回为(0)表示无效值,**prepared**/**playing**/**paused**/**completed**状态下有效。 | +**说明:** + +将资源句柄(fd)传递给媒体播放器之后,请不要通过该资源句柄做其他读写操作,包括但不限于将同一个资源句柄传递给多个媒体播放器。同一时间通过同一个资源句柄读写文件时存在竞争关系,将导致播放异常。 + ### on('stateChange')9+ on(type: 'stateChange', callback: (state: AVPlayerState, reason: StateChangeReason) => void): void @@ -470,9 +474,9 @@ AVPlayer回调的**错误分类**可以分为以下几 | 801 | Unsupport Capability: | 不支持该API能力,表示调用无效。 | | 5400101 | No Memory: | 播放内存不足,[AVPlayerState](#avplayerstate9)会进入error状态。 | | 5400102 | Operate Not Permit: | 当前状态机不支持此操作,表示调用无效。 | -| 5400103 | IO Error: | 播放中发现码流异常。 | +| 5400103 | IO Error: | 播放中发现码流异常,[AVPlayerState](#avplayerstate9)会进入error状态。 | | 5400104 | Network Timeout: | 网络原因超时响应,[AVPlayerState](#avplayerstate9)会进入error状态。 | -| 5400105 | Service Died: | 播放进程死亡,[AVPlayerState](#avplayerstate9)会进入error状态。 | +| 5400105 | Service Died: | 播放进程死亡,[AVPlayerState](#avplayerstate9)会进入error状态,需要调用release后重新创建实例。 | | 5400106 | Unsupport Format: | 不支持的文件格式,[AVPlayerState](#avplayerstate9)会进入error状态。 | **示例:** @@ -927,6 +931,14 @@ getTrackDescription(callback: AsyncCallback\>): void **示例:** ```js +printfDescription(obj) { + for (let item in obj) { + let property = obj[item]; + console.info('audio key is ' + item); + console.info('audio value is ' + property); + } +} + avPlayer.getTrackDescription((error, arrList) => { if ((arrList) != null) { for (let i = 0; i < arrList.length; i++) { @@ -964,6 +976,14 @@ getTrackDescription(): Promise\> ```js let arrayDescription; + +printfDescription(obj) { + for (let item in obj) { + let property = obj[item]; + console.info('audio key is ' + item); + console.info('audio value is ' + property); + } +} avPlayer.getTrackDescription().then((arrList) => { if (arrList != null) { arrayDescription = arrList; @@ -1118,7 +1138,7 @@ setBitrate(bitrate: number): void | 参数名 | 类型 | 必填 | 说明 | | ------- | ------ | ---- | ------------------------------------------------------------ | -| bitrate | number | 是 | 指定比特率,可以通过[availableBitrates](#availableBitrates_on)事件获得当前HLS协议流可用的比特率,如果用户指定的比特率不在此列表中,则播放器将从可用比特率列表中选择最小和最接近的比特率。 | +| bitrate | number | 是 | 指定比特率,可以通过[availableBitrates](#availableBitrates_on)事件获得当前HLS协议流可用的比特率,如果用户指定的比特率不在此列表中,则播放器将从可用比特率列表中选择最小和最接近的比特率。如果通过availableBitrates时间获得的比特率列表长度为0,则不支持指定比特率,也不会产生bitrateDone回调。 | **示例:** @@ -1183,7 +1203,7 @@ on(type: 'availableBitrates', callback: (bitrates: Array\) => void): voi | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | ---- | ------------------------------------------------------------ | | type | string | 是 | HLS协议可用比特率上报事件回调类型,支持的事件:'availableBitrates',只会在prepared之后上报一次。 | -| callback | function | 是 | HLS协议可用比特率上报事件回调方法,使用数组存放支持的比特率。 | +| callback | function | 是 | HLS协议可用比特率上报事件回调方法,使用数组存放支持的比特率。如果数组长度为0,则不支持指定比特率。 | **示例:** @@ -1553,6 +1573,8 @@ on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void **示例:** ```js +import audio from '@ohos.multimedia.audio'; + avPlayer.on('audioInterrupt', (info: audio.InterruptEvent) => { console.info('audioInterrupt success,and InterruptEvent info is:' + info) }) @@ -1580,7 +1602,7 @@ avPlayer.off('audioInterrupt') ## AVPlayerState9+ -[AVPlayer](#avplayer9)的状态机,可通过state属性主动获取当前状态,也可通过监听[stateChange](#stateChange_on)事件上报当前状态,状态机之间的切换规则,可参考[AVPlayer播放器开发指导](../../media/avplayer-playback.md)。 +[AVPlayer](#avplayer9)的状态机,可通过state属性主动获取当前状态,也可通过监听[stateChange](#stateChange_on)事件上报当前状态,状态机之间的切换规则,可参考[音频播放开发指导](../../media/using-avplayer-for-playback.md)。 **系统能力:** SystemCapability.Multimedia.Media.AVPlayer @@ -1687,7 +1709,11 @@ audioPlayer.getTrackDescription((error, arrList) => { 音视频录制管理类,用于音视频媒体录制。在调用AVRecorder的方法前,需要先通过createAVRecorder()构建一个AVRecorder实例。 -音视频录制demo可参考:[音视频录制开发指导](../../media/avrecorder.md) +音视频录制demo可参考:[音频录制开发指导](../../media/using-avrecorder-for-recording.md)、[视频录制开发指导](../../media/video-recording.md)。 + +> **说明:** +> +> 使用相机进行视频录制时,需要与相机模块配合,相机模块接口开放状态以及使用详情见[相机管理](js-apis-camera.md)。 ### 属性 @@ -1740,7 +1766,7 @@ let AVRecorderProfile = { audioSampleRate : 48000, fileFormat : media.ContainerFormatType.CFT_MPEG_4, videoBitrate : 2000000, - videoCodec : media.CodecMimeType.VIDEO_MPEG4, + videoCodec : media.CodecMimeType.VIDEO_AVC, videoFrameWidth : 640, videoFrameHeight : 480, videoFrameRate : 30 @@ -1754,7 +1780,7 @@ let AVRecorderConfig = { location : { latitude : 30, longitude : 130 } } -AVRecorder.prepare(AVRecorderConfig, (err) => { +avRecorder.prepare(AVRecorderConfig, (err) => { if (err == null) { console.info('prepare success'); } else { @@ -1811,7 +1837,7 @@ let AVRecorderProfile = { audioSampleRate : 48000, fileFormat : media.ContainerFormatType.CFT_MPEG_4, videoBitrate : 2000000, - videoCodec : media.CodecMimeType.VIDEO_MPEG4, + videoCodec : media.CodecMimeType.VIDEO_AVC, videoFrameWidth : 640, videoFrameHeight : 480, videoFrameRate : 30 @@ -1825,7 +1851,7 @@ let AVRecorderConfig = { location : { latitude : 30, longitude : 130 } } -AVRecorder.prepare(AVRecorderConfig).then(() => { +avRecorder.prepare(AVRecorderConfig).then(() => { console.info('prepare success'); }).catch((err) => { console.info('prepare failed and catch error is ' + err.message); @@ -1866,7 +1892,7 @@ getInputSurface(callback: AsyncCallback\): void ```js let surfaceID = null; // 该surfaceID用于传递给相机接口创造videoOutput -AVRecorder.getInputSurface((err, surfaceId) => { +avRecorder.getInputSurface((err, surfaceId) => { if (err == null) { console.info('getInputSurface success'); surfaceID = surfaceId; @@ -1875,8 +1901,6 @@ AVRecorder.getInputSurface((err, surfaceId) => { } }); -// videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID); - ``` ### getInputSurface9+ @@ -1912,14 +1936,12 @@ getInputSurface(): Promise\ ```js let surfaceID = null; // 该surfaceID用于传递给相机接口创造videoOutput -AVRecorder.getInputSurface().then((surfaceId) => { +avRecorder.getInputSurface().then((surfaceId) => { console.info('getInputSurface success'); surfaceID = surfaceId; }).catch((err) => { console.info('getInputSurface failed and catch error is ' + err.message); }); - -// videoOutput = await cameraManager.createVideoOutput(videoProfiles[0], surfaceID); ``` ### start9+ @@ -1951,7 +1973,7 @@ start(callback: AsyncCallback\): void **示例:** ```js -AVRecorder.start((err) => { +avRecorder.start((err) => { if (err == null) { console.info('start AVRecorder success'); } else { @@ -1989,7 +2011,7 @@ start(): Promise\ **示例:** ```js -AVRecorder.start().then(() => { +avRecorder.start().then(() => { console.info('start AVRecorder success'); }).catch((err) => { console.info('start AVRecorder failed and catch error is ' + err.message); @@ -2025,7 +2047,7 @@ pause(callback: AsyncCallback\): void **示例:** ```js -AVRecorder.pause((err) => { +avRecorder.pause((err) => { if (err == null) { console.info('pause AVRecorder success'); } else { @@ -2063,7 +2085,7 @@ pause(): Promise\ **示例:** ```js -AVRecorder.pause().then(() => { +avRecorder.pause().then(() => { console.info('pause AVRecorder success'); }).catch((err) => { console.info('pause AVRecorder failed and catch error is ' + err.message); @@ -2099,7 +2121,7 @@ resume(callback: AsyncCallback\): void **示例:** ```js -AVRecorder.resume((err) => { +avRecorder.resume((err) => { if (err == null) { console.info('resume AVRecorder success'); } else { @@ -2137,7 +2159,7 @@ resume(): Promise\ **示例:** ```js -AVRecorder.resume().then(() => { +avRecorder.resume().then(() => { console.info('resume AVRecorder success'); }).catch((err) => { console.info('resume AVRecorder failed and catch error is ' + err.message); @@ -2175,7 +2197,7 @@ stop(callback: AsyncCallback\): void **示例:** ```js -AVRecorder.stop((err) => { +avRecorder.stop((err) => { if (err == null) { console.info('stop AVRecorder success'); } else { @@ -2215,7 +2237,7 @@ stop(): Promise\ **示例:** ```js -AVRecorder.stop().then(() => { +avRecorder.stop().then(() => { console.info('stop AVRecorder success'); }).catch((err) => { console.info('stop AVRecorder failed and catch error is ' + err.message); @@ -2250,7 +2272,7 @@ reset(callback: AsyncCallback\): void **示例:** ```js -AVRecorder.reset((err) => { +avRecorder.reset((err) => { if (err == null) { console.info('reset AVRecorder success'); } else { @@ -2287,7 +2309,7 @@ reset(): Promise\ **示例:** ```js -AVRecorder.reset().then(() => { +avRecorder.reset().then(() => { console.info('reset AVRecorder success'); }).catch((err) => { console.info('reset AVRecorder failed and catch error is ' + err.message); @@ -2321,7 +2343,7 @@ release(callback: AsyncCallback\): void **示例:** ```js -AVRecorder.release((err) => { +avRecorder.release((err) => { if (err == null) { console.info('release AVRecorder success'); } else { @@ -2357,7 +2379,7 @@ release(): Promise\ **示例:** ```js -AVRecorder.release().then(() => { +avRecorder.release().then(() => { console.info('release AVRecorder success'); }).catch((err) => { console.info('release AVRecorder failed and catch error is ' + err.message); @@ -2382,9 +2404,8 @@ on(type: 'stateChange', callback: (state: AVRecorderState, reason: StateChangeRe **示例:** ```js -AVRecorder.on('stateChange', async (state, reason) => { +avRecorder.on('stateChange', async (state, reason) => { console.info('case state has changed, new state is :' + state + ',and new reason is : ' + reason); - } }); ``` @@ -2405,7 +2426,7 @@ off(type: 'stateChange'): void **示例:** ```js -AVRecorder.off('stateChange'); +avRecorder.off('stateChange'); ``` ### on('error')9+ @@ -2437,7 +2458,7 @@ on(type: 'error', callback: ErrorCallback): void **示例:** ```js -AVRecorder.on('error', (err) => { +avRecorder.on('error', (err) => { console.info('case avRecorder.on(error) called, errMessage is ' + err.message); }); ``` @@ -2468,7 +2489,7 @@ off(type: 'error'): void **示例:** ```js -AVRecorder.off('error'); +avRecorder.off('error'); ``` ## AVRecorderState9+ @@ -2518,7 +2539,7 @@ AVRecorder.off('error'); | audioSampleRate | number | 否 | 音频采样率,选择音频录制时必填。 | | fileFormat | [ContainerFormatType](#containerformattype8) | 是 | 文件的容器格式,必要参数。 | | videoBitrate | number | 否 | 视频编码比特率,选择视频录制时必填。 | -| videoCodec | [CodecMimeType](#codecmimetype8) | 否 | 视频编码格式,选择视频录制时必填。当前仅支持VIDEO_AVC和VIDEO_MPEG4。 | +| videoCodec | [CodecMimeType](#codecmimetype8) | 否 | 视频编码格式,选择视频录制时必填。需要查询设备支持的编码能力(包括编码格式,分辨率大小等)。 | | videoFrameWidth | number | 否 | 视频帧的宽,选择视频录制时必填。 | | videoFrameHeight | number | 否 | 视频帧的高,选择视频录制时必填。 | | videoFrameRate | number | 否 | 视频帧率,选择视频录制时必填。 | @@ -2574,8 +2595,6 @@ AVRecorder.off('error'); 视频录制管理类,用于录制视频媒体。在调用VideoRecorder的方法前,需要先通过[createVideoRecorder()](#mediacreatevideorecorder9)构建一个[VideoRecorder](#videorecorder9)实例。 -视频录制demo可参考:[视频录制开发指导](../../media/video-recorder.md) - ### 属性 **系统能力:** SystemCapability.Multimedia.Media.VideoRecorder @@ -2627,7 +2646,7 @@ let videoProfile = { audioSampleRate : 48000, fileFormat : 'mp4', videoBitrate : 2000000, - videoCodec : 'video/mp4v-es', + videoCodec : 'video/avc', videoFrameWidth : 640, videoFrameHeight : 480, videoFrameRate : 30 @@ -2698,7 +2717,7 @@ let videoProfile = { audioSampleRate : 48000, fileFormat : 'mp4', videoBitrate : 2000000, - videoCodec : 'video/mp4v-es', + videoCodec : 'video/avc', videoFrameWidth : 640, videoFrameHeight : 480, videoFrameRate : 30 @@ -3770,7 +3789,7 @@ on(type: 'play' | 'pause' | 'stop' | 'reset' | 'dataLoad' | 'finish' | 'volumeCh **示例:** ```js -import fileio from '@ohos.fileio' +import fs from '@ohos.file.fs'; let audioPlayer = media.createAudioPlayer(); //创建一个音频播放实例 audioPlayer.on('dataLoad', () => { //设置'dataLoad'事件回调,src属性设置成功后,触发此回调 @@ -3814,15 +3833,15 @@ audioPlayer.on('error', (error) => { //设置'error'事件回调 let fdPath = 'fd://'; // path路径的码流可通过"hdc file send D:\xxx\01.mp3 /data/accounts/account_0/appdata" 命令,将其推送到设备上 let path = '/data/accounts/account_0/appdata/ohos.xxx.xxx.xxx/01.mp3'; -fileio.open(path).then((fdValue) => { - fdPath = fdPath + '' + fdValue; +fs.open(path).then((file) => { + fdPath = fdPath + '' + file.fd; console.info('open fd success fd is' + fdPath); + audioPlayer.src = fdPath; //设置src属性,并触发'dataLoad'事件回调 }, (err) => { console.info('open fd failed err is' + err); }).catch((err) => { console.info('open fd failed err is' + err); }); -audioPlayer.src = fdPath; //设置src属性,并触发'dataLoad'事件回调 ``` ### on('timeUpdate') @@ -3901,8 +3920,6 @@ audioPlayer.setVolume(3); //设置volume为无效值,触发'error'事件 视频播放管理类,用于管理和播放视频媒体。在调用VideoPlayer的方法前,需要先通过[createVideoPlayer()](#createvideoplayer)构建一个VideoPlayer实例。 -视频播放demo可参考:[视频播放开发指导](../../media/video-playback.md) - ### 属性 **系统能力:** SystemCapability.Multimedia.Media.VideoPlayer @@ -4721,8 +4738,6 @@ videoPlayer.url = 'fd://error'; //设置错误的播放地址,触发'error' 音频录制管理类,用于录制音频媒体。在调用AudioRecorder的方法前,需要先通过[createAudioRecorder()](#mediacreateaudiorecorder) 构建一个AudioRecorder实例。 -音频录制demo可参考:[音频录制开发指导](../../media/audio-recorder.md) - ### prepare prepare(config: AudioRecorderConfig): void 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 752de65c1cb3089d882ca922587c05e2455a56f7..246d3418a2114a7e61ddef6227147087994cc6a3 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-medialibrary.md +++ b/zh-cn/application-dev/reference/apis/js-apis-medialibrary.md @@ -1,7 +1,10 @@ # @ohos.multimedia.medialibrary (媒体库管理) > **说明:** -> 该组件从API Version 6开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 +> - 该组件从API Version 6开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 +> - 从API Version 9开始废弃。保留至API Version 13版本。 +> - 部分功能变更为系统接口,仅供系统应用使用,请使用[@ohos.filemanagement.userFileManager](js-apis-userFileManager.md)相应接口替代。 +> - 媒体资源选择和保存功能仍开放给普通应用,请使用[@ohos.file.picker](js-apis-file-picker.md)相应接口替代。 ## 导入模块 ```js @@ -130,17 +133,12 @@ async function example() { console.info('fileAsset.displayName ' + '0 : ' + fileAsset.displayName); // 调用 getNextObject 接口获取下一个资源,直到最后一个 for (let i = 1; i < count; i++) { - fetchFileResult.getNextObject((error, fileAsset) => { - if (fileAsset == undefined) { - console.error('get next object failed with error: ' + error); - return; - } - console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); - }) + let fileAsset = await fetchFileResult.getNextObject(); + console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); } + // 释放FetchFileResult实例并使其失效。无法调用其他方法 + fetchFileResult.close(); }); - // 释放FetchFileResult实例并使其失效。无法调用其他方法 - fetchFileResult.close(); }); } ``` @@ -198,18 +196,15 @@ async function example() { console.info('fileAsset.displayName ' + '0 : ' + fileAsset.displayName); // 调用 getNextObject 接口获取下一个资源,直到最后一个 for (let i = 1; i < count; i++) { - fetchFileResult.getNextObject().then((fileAsset) => { - console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); - }).catch((error) => { - console.error('get next object failed with error: ' + error); - }) + let fileAsset = await fetchFileResult.getNextObject(); + console.info('fileAsset.displayName ' + i + ': ' + fileAsset.displayName); } + // 释放FetchFileResult实例并使其失效。无法调用其他方法 + fetchFileResult.close(); }).catch((error) => { // 调用getFirstObject接口失败 console.error('get first object failed with error: ' + error); }); - // 释放FetchFileResult实例并使其失效。无法调用其他方法 - fetchFileResult.close(); }).catch((error) => { // 调用getFileAssets接口失败 console.error('get file assets failed with error: ' + error); @@ -499,7 +494,7 @@ async function example() { ### getAlbums7+ -getAlbums(options: MediaFetchOptions, callback: AsyncCallback): void +getAlbums(options: MediaFetchOptions, callback: AsyncCallback<Array<Album>>): void 获取相册列表,使用callback 方式返回结果。 @@ -534,7 +529,7 @@ async function example() { ### getAlbums7+ -getAlbums(options: MediaFetchOptions): Promise +getAlbums(options: MediaFetchOptions): Promise<Array<Album>> 获取相册列表,使用 promise 方式返回结果。 @@ -614,13 +609,13 @@ release(): Promise<void> media.release() ``` -### storeMediaAsset(deprecated) +### storeMediaAsset storeMediaAsset(option: MediaAssetOption, callback: AsyncCallback<string>): void 保存媒体资源,以异步方法获取保存成功的URI,使用callback形式返回结果。 -> **说明**: 从API Version 9开始废弃。 +> **说明**:此接口为API Version 6开始支持,只支持FA模型使用。 **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -650,13 +645,13 @@ mediaLibrary.getMediaLibrary().storeMediaAsset(option, (error, value) => { ``` -### storeMediaAsset(deprecated) +### storeMediaAsset storeMediaAsset(option: MediaAssetOption): Promise<string> 保存媒体资源,以异步方法获取保存成功的URI,使用Promise形式返回结果。 -> **说明**: 从API Version 9开始废弃。 +> **说明**:此接口为API Version 6开始支持,只支持FA模型使用。 **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -689,13 +684,15 @@ mediaLibrary.getMediaLibrary().storeMediaAsset(option).then((value) => { ``` -### startImagePreview(deprecated) +### startImagePreview startImagePreview(images: Array<string>, index: number, callback: AsyncCallback<void>): void 启动图片预览界面并限定预览开始显示的图片。可以预览指定序号的单张本地图片(datashare://),也可以预览列表中的所有网络图片(https://)。使用callback方式进行异步回调。 -> **说明**:
从API Version 9开始废弃。建议使用[Image组件](../arkui-ts/ts-basic-components-image.md)替代。
Image组件,可用于本地图片和网络图片的渲染展示。 +> **说明**: +> 此接口为API Version 6开始支持,只支持FA模型使用。 +> 建议使用[Image组件](../arkui-ts/ts-basic-components-image.md)替代。
Image组件,可用于本地图片和网络图片的渲染展示。 **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -731,13 +728,15 @@ mediaLibrary.getMediaLibrary().startImagePreview(images, index, (error) => { ``` -### startImagePreview(deprecated) +### startImagePreview startImagePreview(images: Array<string>, callback: AsyncCallback<void>): void 启动图片预览界面,可以预览列表中首张本地图片(datashare://),也可以预览列表中的所有网络图片(https://)。使用callback方式进行异步回调。 -> **说明**:
从API Version 9开始废弃。建议使用[Image组件](../arkui-ts/ts-basic-components-image.md)替代。
Image组件,可用于本地图片和网络图片的渲染展示。 +> **说明**: +> 此接口为API Version 6开始支持,只支持FA模型使用。 +> 建议使用[Image组件](../arkui-ts/ts-basic-components-image.md)替代。
Image组件,可用于本地图片和网络图片的渲染展示。 **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -771,13 +770,15 @@ mediaLibrary.getMediaLibrary().startImagePreview(images, (error) => { ``` -### startImagePreview(deprecated) +### startImagePreview startImagePreview(images: Array<string>, index?: number): Promise<void> 启动图片预览界面并限定预览开始显示的图片。可以预览指定序号的单张本地图片(datashare://),也可以预览列表中的所有网络图片(https://)。使用Promise方式进行异步回调。 -> **说明**:
从API Version 9开始废弃。建议使用[Image组件](../arkui-ts/ts-basic-components-image.md)替代。
Image组件,可用于本地图片和网络图片的渲染展示。 +> **说明**: +> 此接口为API Version 6开始支持,只支持FA模型使用。 +> 建议使用[Image组件](../arkui-ts/ts-basic-components-image.md)替代。
Image组件,可用于本地图片和网络图片的渲染展示。 **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -816,13 +817,15 @@ mediaLibrary.getMediaLibrary().startImagePreview(images, index).then(() => { ``` -### startMediaSelect(deprecated) +### startMediaSelect startMediaSelect(option: MediaSelectOption, callback: AsyncCallback<Array<string>>): void 启动媒体选择界面,以异步方法获取选择的媒体URI列表,使用callback形式返回结果。 -> **说明**:
从API Version 9开始废弃。建议使用系统应用图库替代。图库是系统内置的可视资源访问应用,提供图片和视频的管理、浏览等功能,使用方法请参考[OpenHarmony/applications_photos](https://gitee.com/openharmony/applications_photos#4-%E5%85%B8%E5%9E%8B%E6%8E%A5%E5%8F%A3%E7%9A%84%E4%BD%BF%E7%94%A8)。 +> **说明**: +> 此接口为API Version 6开始支持,只支持FA模型使用。 +> 建议使用系统应用图库替代。图库是系统内置的可视资源访问应用,提供图片和视频的管理、浏览等功能,使用方法请参考[OpenHarmony/applications_photos](https://gitee.com/openharmony/applications_photos#4-%E5%85%B8%E5%9E%8B%E6%8E%A5%E5%8F%A3%E7%9A%84%E4%BD%BF%E7%94%A8)。 **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -830,7 +833,7 @@ startMediaSelect(option: MediaSelectOption, callback: AsyncCallback<Array< | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------------------- | ---- | ------------------------------------ | -| option | [MediaSelectOption](#mediaselectoptiondeprecated) | 是 | 媒体选择选项。 | +| option | [MediaSelectOption](#mediaselectoption) | 是 | 媒体选择选项。 | | callback | AsyncCallback<Array<string>> | 是 | 媒体选择回调,返回选择的媒体URI(datashare://)列表。 | **示例:** @@ -851,13 +854,15 @@ mediaLibrary.getMediaLibrary().startMediaSelect(option, (error, value) => { ``` -### startMediaSelect(deprecated) +### startMediaSelect startMediaSelect(option: MediaSelectOption): Promise<Array<string>> 启动媒体选择界面,以异步方法获取选择的媒体URI列表,使用Promise形式返回结果。 -> **说明**:
从API Version 9开始废弃。建议使用系统应用图库替代。图库是系统内置的可视资源访问应用,提供图片和视频的管理、浏览等功能,使用方法请参考[OpenHarmony/applications_photos](https://gitee.com/openharmony/applications_photos#4-%E5%85%B8%E5%9E%8B%E6%8E%A5%E5%8F%A3%E7%9A%84%E4%BD%BF%E7%94%A8)。 +> **说明**: +> 此接口为API Version 6开始支持,只支持FA模型使用。 +> 建议使用系统应用图库替代。图库是系统内置的可视资源访问应用,提供图片和视频的管理、浏览等功能,使用方法请参考[OpenHarmony/applications_photos](https://gitee.com/openharmony/applications_photos#4-%E5%85%B8%E5%9E%8B%E6%8E%A5%E5%8F%A3%E7%9A%84%E4%BD%BF%E7%94%A8)。 **系统能力**:SystemCapability.Multimedia.MediaLibrary.Core @@ -865,7 +870,7 @@ startMediaSelect(option: MediaSelectOption): Promise<Array<string>> | 参数名 | 类型 | 必填 | 说明 | | ------ | --------------------------------------- | ---- | ------- | -| option | [MediaSelectOption](#mediaselectoptiondeprecated) | 是 | 媒体选择选项。 | +| option | [MediaSelectOption](#mediaselectoption) | 是 | 媒体选择选项。 | **返回值:** @@ -1907,9 +1912,9 @@ async function example() { if(i == fetchCount - 1) { var result = fetchFileResult.isAfterLast(); console.info('mediaLibrary fileAsset isAfterLast result: ' + result); + fetchFileResult.close(); } } - fetchFileResult.close(); } ``` @@ -1969,8 +1974,8 @@ async function example() { return; } console.info('getFirstObject successfully, displayName : ' + fileAsset.displayName); + fetchFileResult.close(); }) - fetchFileResult.close(); } ``` @@ -2002,10 +2007,10 @@ async function example() { let fetchFileResult = await media.getFileAssets(getImageOp); fetchFileResult.getFirstObject().then((fileAsset) => { console.info('getFirstObject successfully, displayName: ' + fileAsset.displayName); + fetchFileResult.close(); }).catch((error) => { console.error('getFirstObject failed with error: ' + error); }); - fetchFileResult.close(); } ``` @@ -2038,16 +2043,16 @@ async function example() { }; let fetchFileResult = await media.getFileAssets(getImageOp); let fileAsset = await fetchFileResult.getFirstObject(); - if (!fetchFileResult.isAfterLast) { + if (!fileAsset.isAfterLast) { fetchFileResult.getNextObject((error, fileAsset) => { if (error) { console.error('fetchFileResult getNextObject failed with error: ' + error); return; } console.log('fetchFileResult getNextObject successfully, displayName: ' + fileAsset.displayName); + fetchFileResult.close(); }) } - fetchFileResult.close(); } ``` @@ -2081,14 +2086,14 @@ async function example() { }; let fetchFileResult = await media.getFileAssets(getImageOp); let fileAsset = await fetchFileResult.getFirstObject(); - if (!fetchFileResult.isAfterLast) { + if (!fileAsset.isAfterLast) { fetchFileResult.getNextObject().then((fileAsset) => { console.info('fetchFileResult getNextObject successfully, displayName: ' + fileAsset.displayName); + fetchFileResult.close(); }).catch((error) => { console.error('fetchFileResult getNextObject failed with error: ' + error); }) } - fetchFileResult.close(); } ``` @@ -2124,8 +2129,8 @@ async function example() { return; } console.info('getLastObject successfully, displayName: ' + fileAsset.displayName); + fetchFileResult.close(); }) - fetchFileResult.close(); } ``` @@ -2157,10 +2162,10 @@ async function example() { let fetchFileResult = await media.getFileAssets(getImageOp); fetchFileResult.getLastObject().then((fileAsset) => { console.info('getLastObject successfully, displayName: ' + fileAsset.displayName); + fetchFileResult.close(); }).catch((error) => { console.error('getLastObject failed with error: ' + error); }); - fetchFileResult.close(); } ``` @@ -2197,8 +2202,8 @@ async function example() { return; } console.info('getPositionObject successfully, displayName: ' + fileAsset.displayName); + fetchFileResult.close(); }) - fetchFileResult.close(); } ``` @@ -2236,10 +2241,10 @@ async function example() { let fetchFileResult = await media.getFileAssets(getImageOp); fetchFileResult.getPositionObject(0).then((fileAsset) => { console.info('getPositionObject successfully, displayName: ' + fileAsset.displayName); + fetchFileResult.close(); }).catch((error) => { console.error('getPositionObject failed with error: ' + error); }); - fetchFileResult.close(); } ``` @@ -2276,9 +2281,9 @@ async function example() { } for (let i = 0; i < fetchFileResult.getCount(); i++) { console.info('getAllObject fileAssetList ' + i + ' displayName: ' + fileAssetList[i].displayName); - } + } + fetchFileResult.close(); }) - fetchFileResult.close(); } ``` @@ -2312,10 +2317,10 @@ async function example() { for (let i = 0; i < fetchFileResult.getCount(); i++) { console.info('getAllObject fileAssetList ' + i + ' displayName: ' + fileAssetList[i].displayName); } + fetchFileResult.close(); }).catch((error) => { console.error('getAllObject failed with error: ' + error); }); - fetchFileResult.close(); } ``` @@ -2447,10 +2452,10 @@ async function example() { console.error('album getFileAssets failed with error: ' + error); return; } - let count = fetchFileResult.getcount(); + let count = fetchFileResult.getCount(); console.info('album getFileAssets successfully, count: ' + count); + fetchFileResult.close(); }); - fetchFileResult.close(); } ``` @@ -2484,7 +2489,7 @@ async function example() { selections: '', selectionArgs: [], }; - let fileNoArgsfetchOp = { + let fileNoArgsfetchOp = { selections: '', selectionArgs: [], }; @@ -2492,13 +2497,13 @@ async function example() { const albumList = await media.getAlbums(AlbumNoArgsfetchOp); const album = albumList[0]; // 取到相册列表中的一个相册,获取此相册中所有符合媒体检索选项的媒体资源 - album.getFileAssets(fileNoArgsfetchOp).then((albumFetchFileResult) => { - let count = fetchFileResult.getcount(); + album.getFileAssets(fileNoArgsfetchOp).then((fetchFileResult) => { + let count = fetchFileResult.getCount(); console.info('album getFileAssets successfully, count: ' + count); + fetchFileResult.close(); }).catch((error) => { console.error('album getFileAssets failed with error: ' + error); }); - fetchFileResult.close(); } ``` @@ -2622,12 +2627,10 @@ async function example() { | width | number | 是 | 是 | 宽(单位:像素) | | height | number | 是 | 是 | 高(单位:像素) | -## MediaAssetOption(deprecated) +## MediaAssetOption 媒体资源选项。 -> **说明**: 从API Version 9开始废弃。 - **系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.MediaLibrary.Core @@ -2637,16 +2640,14 @@ async function example() { | mimeType | string | 是 | 是 | 媒体MIME(Multipurpose Internet Mail Extensions)类型。
包括:'image/\*'、'video/\*'、'audio/\*'、 'file\*'。 | | relativePath | string | 是 | 是 | 自定义媒体资源保存位置,例:Pictures/ 不填则保存到默认路径。
image类型默认路径Pictures/
video类型默认路径Videos/
audio类型默认路径Audios/
file类型默认路径Documents/ 。 | -## MediaSelectOption(deprecated) +## MediaSelectOption 媒体资源类型选项。 -> **说明**: 从API Version 9开始废弃。 - **系统能力:** 以下各项对应的系统能力均为SystemCapability.Multimedia.MediaLibrary.Core | 名称 | 类型 | 可读 | 可写 | 说明 | | ----- | ------ | ---- | ---- | -------------------- | | type | 'image' | 'video' | 'media' | 是 | 是 | 媒体类型,包括:image, video, media,当前仅支持media类型 | -| count | number | 是 | 是 | 媒体选择,count = 1表示单选,count大于1表示多选。 | +| count | number | 是 | 是 | 可以选择媒体数量的最大值,count = 1表示单选,count大于1表示多选。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-mediaquery.md b/zh-cn/application-dev/reference/apis/js-apis-mediaquery.md index bb2de659db473c3e52555009445d620a87b2b012..5244b2c693a4c372a6cdf2e0e5a2272f9b36cd67 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-mediaquery.md +++ b/zh-cn/application-dev/reference/apis/js-apis-mediaquery.md @@ -26,7 +26,7 @@ matchMediaSync(condition: string): MediaQueryListener | 参数名 | 类型 | 必填 | 说明 | | --------- | ------ | ---- | ---------------------------------------- | -| condition | string | 是 | 媒体事件的匹配条件,具体可参考[媒体查询语法规则](../../ui/ui-ts-layout-mediaquery.md#语法规则)。 | +| condition | string | 是 | 媒体事件的匹配条件,具体可参考[媒体查询语法规则](../../ui/arkts-layout-development-media-query.md#语法规则)。 | **返回值:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-net-connection.md b/zh-cn/application-dev/reference/apis/js-apis-net-connection.md index cfd1405bc9385985c34cee0500f6a82aa9e7cf98..bd367fc4d2d43e7921032a97b36782870f460d86 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-net-connection.md +++ b/zh-cn/application-dev/reference/apis/js-apis-net-connection.md @@ -10,6 +10,7 @@ ```js import connection from '@ohos.net.connection' ``` + ## connection.createNetConnection createNetConnection(netSpecifier?: NetSpecifier, timeout?: number): NetConnection @@ -34,14 +35,14 @@ createNetConnection(netSpecifier?: NetSpecifier, timeout?: number): NetConnectio **示例:** ```js -// 关注默认网络 +// 关注默认网络, 不需要传参 let netConnection = connection.createNetConnection() -// 关注蜂窝网络 +// 关注蜂窝网络,需要传入相关网络特征,timeout参数未传入说明未使用超时时间,此时timeout为0 let netConnectionCellular = connection.createNetConnection({ - netCapabilities: { - bearerTypes: [connection.NetBearType.BEARER_CELLULAR] - } + netCapabilities: { + bearerTypes: [connection.NetBearType.BEARER_CELLULAR] + } }) ``` @@ -73,8 +74,8 @@ getDefaultNet(callback: AsyncCallback\): void ```js connection.getDefaultNet(function (error, data) { - console.log(JSON.stringify(error)) - console.log(JSON.stringify(data)) + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) }) ``` @@ -106,7 +107,7 @@ getDefaultNet(): Promise\ ```js connection.getDefaultNet().then(function (data) { - console.log(JSON.stringify(data)) + console.log(JSON.stringify(data)) }) ``` @@ -166,9 +167,9 @@ getGlobalHttpProxy(callback: AsyncCallback\): void **示例:** ```js -connection.getGlobalHttpProxy((error,data) => { - console.info(JSON.stringify(error)); - console.info(JSON.stringify(data)); +connection.getGlobalHttpProxy((error, data) => { + console.info(JSON.stringify(error)); + console.info(JSON.stringify(data)); }) ``` @@ -199,9 +200,9 @@ getGlobalHttpProxy(): Promise\; ```js connection.getGlobalHttpProxy().then((data) => { - console.info(JSON.stringify(data)); + console.info(JSON.stringify(data)); }).catch(error => { - console.info(JSON.stringify(error)); + console.info(JSON.stringify(error)); }) ``` @@ -237,16 +238,15 @@ setGlobalHttpProxy(httpProxy: HttpProxy, callback: AsyncCallback\): void **示例:** ```js -let exclusionStr="192.168,baidu.com" +let exclusionStr = "192.168,baidu.com" let exclusionArray = exclusionStr.split(','); let httpProxy = { - host: "192.168.xx.xxx", - port: 8080, - exclusionList: exclusionArray + host: "192.168.xx.xxx", + port: 8080, + exclusionList: exclusionArray } -connection.setGlobalHttpProxy(httpProxy, (error, data) => { - console.info(JSON.stringify(error)); - console.info(JSON.stringify(data)); +connection.setGlobalHttpProxy(httpProxy, (error) => { + console.info(JSON.stringify(error)); }); ``` @@ -287,17 +287,17 @@ setGlobalHttpProxy(httpProxy: HttpProxy): Promise\; **示例:** ```js -let exclusionStr="192.168,baidu.com" +let exclusionStr = "192.168,baidu.com" let exclusionArray = exclusionStr.split(','); let httpProxy = { - host: "192.168.xx.xxx", - port: 8080, - exclusionList: exclusionArray + host: "192.168.xx.xxx", + port: 8080, + exclusionList: exclusionArray } -connection.setGlobalHttpProxy(httpProxy).then((error, data) => { - console.info(JSON.stringify(data)); -}).catch(error=>{ - console.info(JSON.stringify(error)); +connection.setGlobalHttpProxy(httpProxy).then(() => { + console.info("success"); +}).catch(error => { + console.info(JSON.stringify(error)); }) ``` @@ -325,9 +325,9 @@ getAppNet(callback: AsyncCallback\): void **示例:** ```js -connection.getAppNet(function(error, data) { - console.log(JSON.stringify(error)) - console.log(JSON.stringify(data)) +connection.getAppNet(function (error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) }) ``` @@ -356,9 +356,9 @@ getAppNet(): Promise\; ```js connection.getAppNet().then((data) => { - console.info(JSON.stringify(data)); + console.info(JSON.stringify(data)); }).catch(error => { - console.info(JSON.stringify(error)); + console.info(JSON.stringify(error)); }) ``` @@ -393,10 +393,10 @@ setAppNet(netHandle: NetHandle, callback: AsyncCallback\): void ```js connection.getDefaultNet(function (error, netHandle) { - connection.setAppNet(netHandle, (error, data) => { - console.log(JSON.stringify(error)) - console.log(JSON.stringify(data)) - }); + connection.setAppNet(netHandle, (error, data) => { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) + }); }) ``` @@ -436,11 +436,11 @@ setAppNet(netHandle: NetHandle): Promise\; ```js connection.getDefaultNet().then(function (netHandle) { - connection.setAppNet(netHandle).then((error, data) => { - console.log(JSON.stringify(data)) - }).catch(error => { - console.log(JSON.stringify(error)) - }) + connection.setAppNet(netHandle).then(() => { + console.log("success") + }).catch(error => { + console.log(JSON.stringify(error)) + }) }) ``` @@ -472,8 +472,8 @@ getAllNets(callback: AsyncCallback<Array<NetHandle>>): void ```js connection.getAllNets(function (error, data) { - console.log(JSON.stringify(error)) - console.log(JSON.stringify(data)) + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) }); ``` @@ -505,7 +505,7 @@ getAllNets(): Promise<Array<NetHandle>> ```js connection.getAllNets().then(function (data) { - console.log(JSON.stringify(data)) + console.log(JSON.stringify(data)) }); ``` @@ -540,10 +540,10 @@ getConnectionProperties(netHandle: NetHandle, callback: AsyncCallback\ ```js connection.getDefaultNet().then(function (netHandle) { - connection.getConnectionProperties(netHandle).then(function (data) { - console.log(JSON.stringify(data)) - }) + connection.getConnectionProperties(netHandle).then(function (data) { + console.log(JSON.stringify(data)) + }) }) ``` @@ -620,10 +620,10 @@ getNetCapabilities(netHandle: NetHandle, callback: AsyncCallback\ ```js connection.getDefaultNet().then(function (netHandle) { - connection.getNetCapabilities(netHandle).then(function (data) { - console.log(JSON.stringify(data)) - }) + connection.getNetCapabilities(netHandle).then(function (data) { + console.log(JSON.stringify(data)) + }) }) ``` @@ -697,8 +697,8 @@ isDefaultNetMetered(callback: AsyncCallback\): void ```js connection.isDefaultNetMetered(function (error, data) { - console.log(JSON.stringify(error)) - console.log('data: ' + data) + console.log(JSON.stringify(error)) + console.log('data: ' + data) }) ``` @@ -730,7 +730,7 @@ isDefaultNetMetered(): Promise\ ```js connection.isDefaultNetMetered().then(function (data) { - console.log('data: ' + data) + console.log('data: ' + data) }) ``` @@ -762,8 +762,8 @@ hasDefaultNet(callback: AsyncCallback\): void ```js connection.hasDefaultNet(function (error, data) { - console.log(JSON.stringify(error)) - console.log('data: ' + data) + console.log(JSON.stringify(error)) + console.log('data: ' + data) }) ``` @@ -795,7 +795,7 @@ hasDefaultNet(): Promise\ ```js connection.hasDefaultNet().then(function (data) { - console.log('data: ' + data) + console.log('data: ' + data) }) ``` @@ -828,7 +828,7 @@ enableAirplaneMode(callback: AsyncCallback\): void ```js connection.enableAirplaneMode(function (error) { - console.log(JSON.stringify(error)) + console.log(JSON.stringify(error)) }) ``` @@ -861,7 +861,7 @@ enableAirplaneMode(): Promise\ ```js connection.enableAirplaneMode().then(function (error) { - console.log(JSON.stringify(error)) + console.log(JSON.stringify(error)) }) ``` @@ -894,7 +894,7 @@ disableAirplaneMode(callback: AsyncCallback\): void ```js connection.disableAirplaneMode(function (error) { - console.log(JSON.stringify(error)) + console.log(JSON.stringify(error)) }) ``` @@ -927,7 +927,7 @@ disableAirplaneMode(): Promise\ ```js connection.disableAirplaneMode().then(function (error) { - console.log(JSON.stringify(error)) + console.log(JSON.stringify(error)) }) ``` @@ -935,8 +935,7 @@ connection.disableAirplaneMode().then(function (error) { reportNetConnected(netHandle: NetHandle, callback: AsyncCallback<void>): void -向网络管理报告网络处于可用状态,调用此接口说明应用程序认为网络的可用性(ohos.net.connection.NetCap.NET_CAPABILITY_VAILDATED)与网络管理不一致。 -使用callback方式作为异步方法。 +向网络管理报告网络处于可用状态,使用callback方式作为异步方法。 **需要权限**:ohos.permission.GET_NETWORK_INFO 和 ohos.permission.INTERNET @@ -963,9 +962,9 @@ reportNetConnected(netHandle: NetHandle, callback: AsyncCallback<void>): v ```js connection.getDefaultNet().then(function (netHandle) { - connection.reportNetConnected(netHandle, function (error) { - console.log(JSON.stringify(error)) - }); + connection.reportNetConnected(netHandle, function (error) { + console.log(JSON.stringify(error)) + }); }); ``` @@ -973,8 +972,7 @@ connection.getDefaultNet().then(function (netHandle) { reportNetConnected(netHandle: NetHandle): Promise<void> -向网络管理报告网络处于可用状态,调用此接口说明应用程序认为网络的可用性(ohos.net.connection.NetCap.NET_CAPABILITY_VAILDATED)与网络管理不一致。 -使用Promise方式作为异步方法。 +向网络管理报告网络处于可用状态,使用Promise方式作为异步方法。 **需要权限**:ohos.permission.GET_NETWORK_INFO 和 ohos.permission.INTERNET @@ -1005,9 +1003,9 @@ reportNetConnected(netHandle: NetHandle): Promise<void> ```js connection.getDefaultNet().then(function (netHandle) { - connection.reportNetConnected(netHandle).then(function () { - console.log(`report success`) - }); + connection.reportNetConnected(netHandle).then(function () { + console.log(`report success`) + }); }); ``` @@ -1015,8 +1013,7 @@ connection.getDefaultNet().then(function (netHandle) { reportNetDisconnected(netHandle: NetHandle, callback: AsyncCallback<void>): void -向网络管理报告网络处于不可用状态,调用此接口说明应用程序认为网络的可用性(ohos.net.connection.NetCap.NET_CAPABILITY_VAILDATED)与网络管理不一致。 -使用callback方式作为异步方法。 +向网络管理报告网络处于不可用状态,使用callback方式作为异步方法。 **需要权限**:ohos.permission.GET_NETWORK_INFO 和 ohos.permission.INTERNET @@ -1043,9 +1040,9 @@ reportNetDisconnected(netHandle: NetHandle, callback: AsyncCallback<void>) ```js connection.getDefaultNet().then(function (netHandle) { - connection.reportNetDisconnected(netHandle, function (error) { - console.log(JSON.stringify(error)) - }); + connection.reportNetDisconnected(netHandle, function (error) { + console.log(JSON.stringify(error)) + }); }); ``` @@ -1053,8 +1050,7 @@ connection.getDefaultNet().then(function (netHandle) { reportNetDisconnected(netHandle: NetHandle): Promise<void> -向网络管理报告网络处于不可用状态,调用此接口说明应用程序认为网络的可用性(ohos.net.connection.NetCap.NET_CAPABILITY_VAILDATED)与网络管理不一致。 -使用Promise方式作为异步方法。 +向网络管理报告网络处于不可用状态,使用Promise方式作为异步方法。 **需要权限**:ohos.permission.GET_NETWORK_INFO 和 ohos.permission.INTERNET @@ -1085,9 +1081,9 @@ reportNetDisconnected(netHandle: NetHandle): Promise<void> ```js connection.getDefaultNet().then(function (netHandle) { - connection.reportNetDisconnected(netHandle).then(function () { - console.log(`report success`) - }); + connection.reportNetDisconnected(netHandle).then(function () { + console.log(`report success`) + }); }); ``` @@ -1097,7 +1093,7 @@ getAddressesByName(host: string, callback: AsyncCallback\>): 使用默认网络解析主机名以获取所有IP地址,使用callback方式作为异步方法。 -**需要权限**:ohos.permission.GET_NETWORK_INFO +**需要权限**:ohos.permission.INTERNET **系统能力**:SystemCapability.Communication.NetManager.Core @@ -1123,8 +1119,8 @@ getAddressesByName(host: string, callback: AsyncCallback\>): ```js let host = "xxxx"; connection.getAddressesByName(host, function (error, data) { - console.log(JSON.stringify(error)) - console.log(JSON.stringify(data)) + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) }) ``` @@ -1134,7 +1130,7 @@ getAddressesByName(host: string): Promise\> 使用默认网络解析主机名以获取所有IP地址,使用Promise方式作为异步方法。 -**需要权限**:ohos.permission.GET_NETWORK_INFO +**需要权限**:ohos.permission.INTERNET **系统能力**:SystemCapability.Communication.NetManager.Core @@ -1165,7 +1161,7 @@ getAddressesByName(host: string): Promise\> ```js let host = "xxxx"; connection.getAddressesByName(host).then(function (data) { - console.log(JSON.stringify(data)) + console.log(JSON.stringify(data)) }) ``` @@ -1173,6 +1169,11 @@ connection.getAddressesByName(host).then(function (data) { 网络连接的句柄。 +> **说明:** +> 设备从无网络到有网络会触发netAvailable事件、netCapabilitiesChange事件和netConnectionPropertiesChange事件; +> 设备从有网络到无网络状态会触发netLost事件; +> 设备从WiFi到蜂窝会触发netLost事件(WiFi丢失)之后触发 netAvaliable事件(蜂窝可用); + ### register register(callback: AsyncCallback\): void @@ -1199,12 +1200,11 @@ register(callback: AsyncCallback\): void | 2101008 | The callback is not exists. | | 2101022 | The number of requests exceeded the maximum. | - **示例:** ```js netConnection.register(function (error) { - console.log(JSON.stringify(error)) + console.log(JSON.stringify(error)) }) ``` @@ -1234,7 +1234,7 @@ unregister(callback: AsyncCallback\): void ```js netConnection.unregister(function (error) { - console.log(JSON.stringify(error)) + console.log(JSON.stringify(error)) }) ``` @@ -1263,17 +1263,17 @@ let netCon = connection.createNetConnection() // 先使用register接口注册订阅事件 netCon.register(function (error) { - console.log(JSON.stringify(error)) + console.log(JSON.stringify(error)) }) // 订阅网络可用事件。调用register后,才能接收到此事件通知 netCon.on('netAvailable', function (data) { - console.log(JSON.stringify(data)) + console.log(JSON.stringify(data)) }) // 使用unregister接口取消订阅 netCon.unregister(function (error) { - console.log(JSON.stringify(error)) + console.log(JSON.stringify(error)) }) ``` @@ -1302,17 +1302,17 @@ let netCon = connection.createNetConnection() // 先使用register接口注册订阅事件 netCon.register(function (error) { - console.log(JSON.stringify(error)) + console.log(JSON.stringify(error)) }) // 订阅网络阻塞状态事件。调用register后,才能接收到此事件通知 netCon.on('netBlockStatusChange', function (data) { - console.log(JSON.stringify(data)) + console.log(JSON.stringify(data)) }) // 使用unregister接口取消订阅 netCon.unregister(function (error) { - console.log(JSON.stringify(error)) + console.log(JSON.stringify(error)) }) ``` @@ -1341,23 +1341,24 @@ let netCon = connection.createNetConnection() // 先使用register接口注册订阅事件 netCon.register(function (error) { - console.log(JSON.stringify(error)) + console.log(JSON.stringify(error)) }) // 订阅网络能力变化事件。调用register后,才能接收到此事件通知 netCon.on('netCapabilitiesChange', function (data) { - console.log(JSON.stringify(data)) + console.log(JSON.stringify(data)) }) // 使用unregister接口取消订阅 netCon.unregister(function (error) { - console.log(JSON.stringify(error)) + console.log(JSON.stringify(error)) }) ``` ### on('netConnectionPropertiesChange') -on(type: 'netConnectionPropertiesChange', callback: Callback<{ netHandle: NetHandle, connectionProperties: ConnectionProperties }>): void +on(type: 'netConnectionPropertiesChange', callback: Callback<{ netHandle: NetHandle, connectionProperties: +ConnectionProperties }>): void 订阅网络连接信息变化事件。 @@ -1380,17 +1381,17 @@ let netCon = connection.createNetConnection() // 先使用register接口注册订阅事件 netCon.register(function (error) { - console.log(JSON.stringify(error)) + console.log(JSON.stringify(error)) }) // 订阅网络连接信息变化事件。调用register后,才能接收到此事件通知 netCon.on('netConnectionPropertiesChange', function (data) { - console.log(JSON.stringify(data)) + console.log(JSON.stringify(data)) }) // 使用unregister接口取消订阅 netCon.unregister(function (error) { - console.log(JSON.stringify(error)) + console.log(JSON.stringify(error)) }) ``` @@ -1419,17 +1420,17 @@ let netCon = connection.createNetConnection() // 先使用register接口注册订阅事件 netCon.register(function (error) { - console.log(JSON.stringify(error)) + console.log(JSON.stringify(error)) }) // 订阅网络丢失事件。调用register后,才能接收到此事件通知 netCon.on('netLost', function (data) { - console.log(JSON.stringify(data)) + console.log(JSON.stringify(data)) }) // 使用unregister接口取消订阅 netCon.unregister(function (error) { - console.log(JSON.stringify(error)) + console.log(JSON.stringify(error)) }) ``` @@ -1458,17 +1459,17 @@ let netCon = connection.createNetConnection() // 先使用register接口注册订阅事件 netCon.register(function (error) { - console.log(JSON.stringify(error)) + console.log(JSON.stringify(error)) }) // 订阅网络不可用事件。调用register后,才能接收到此事件通知 netCon.on('netUnavailable', function (data) { - console.log(JSON.stringify(data)) + console.log(JSON.stringify(data)) }) // 使用unregister接口取消订阅 netCon.unregister(function (error) { - console.log(JSON.stringify(error)) + console.log(JSON.stringify(error)) }) ``` @@ -1514,48 +1515,51 @@ bindSocket(socketParam: TCPSocket \| UDPSocket, callback: AsyncCallback\): ```js import socket from "@ohos.net.socket"; + connection.getDefaultNet().then((netHandle) => { - var tcp = socket.constructTCPSocketInstance(); - var udp = socket.constructUDPSocketInstance(); - let socketType = "TCPSocket"; - if (socketType == "TCPSocket") { - tcp.bind({ - address: '192.168.xx.xxx', port: 8080, family: 1 - }, error => { - if (error) { - console.log('bind fail'); - } - netHandle.bindSocket(tcp, (error, data) => { - if (error) { - console.log(JSON.stringify(error)); - } else { - console.log(JSON.stringify(data)); - } - }) - }) - } else { - let callback = value => { - console.log("on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo); + var tcp = socket.constructTCPSocketInstance(); + var udp = socket.constructUDPSocketInstance(); + let socketType = "TCPSocket"; + if (socketType == "TCPSocket") { + tcp.bind({ + address: '192.168.xx.xxx', port: 8080, family: 1 + }, error => { + if (error) { + console.log('bind fail'); + return; + } + netHandle.bindSocket(tcp, (error, data) => { + if (error) { + console.log(JSON.stringify(error)); + } else { + console.log(JSON.stringify(data)); } - udp.on('message', callback); - udp.bind({ - address: '192.168.xx.xxx', port: 8080, family: 1 - }, error => { - if (error) { - console.log('bind fail'); - } - udp.on('message', (data) => { - console.log(JSON.stringify(data)) - }); - netHandle.bindSocket(udp, (error, data) => { - if (error) { - console.log(JSON.stringify(error)); - } else { - console.log(JSON.stringify(data)); - } - }) - }) + }) + }) + } else { + let callback = value => { + console.log("on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo); } + udp.on('message', callback); + udp.bind({ + address: '192.168.xx.xxx', port: 8080, family: 1 + }, error => { + if (error) { + console.log('bind fail'); + return; + } + udp.on('message', (data) => { + console.log(JSON.stringify(data)) + }); + netHandle.bindSocket(udp, (error, data) => { + if (error) { + console.log(JSON.stringify(error)); + } else { + console.log(JSON.stringify(data)); + } + }) + }) + } }) ``` @@ -1592,44 +1596,47 @@ bindSocket(socketParam: TCPSocket \| UDPSocket): Promise\; ```js import socket from "@ohos.net.socket"; + connection.getDefaultNet().then((netHandle) => { - var tcp = socket.constructTCPSocketInstance(); - var udp = socket.constructUDPSocketInstance(); - let socketType = "TCPSocket"; - if (socketType == "TCPSocket") { - tcp.bind({ - address: '192.168.xx.xxx', port: 8080, family: 1 - }, error => { - if (error) { - console.log('bind fail'); - } - netHandle.bindSocket(tcp).then((data) => { - console.log(JSON.stringify(data)); - }).catch(error => { - console.log(JSON.stringify(error)); - }) - }) - } else { - let callback = value => { - console.log("on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo); - } - udp.on('message', callback); - udp.bind({ - address: '192.168.xx.xxx', port: 8080, family: 1 - }, error => { - if (error) { - console.log('bind fail'); - } - udp.on('message', (data) => { - console.log(JSON.stringify(data)); - }) - netHandle.bindSocket(udp).then((data) => { - console.log(JSON.stringify(data)); - }).catch(error => { - console.log(JSON.stringify(error)); - }) - }) + var tcp = socket.constructTCPSocketInstance(); + var udp = socket.constructUDPSocketInstance(); + let socketType = "TCPSocket"; + if (socketType == "TCPSocket") { + tcp.bind({ + address: '192.168.xx.xxx', port: 8080, family: 1 + }, error => { + if (error) { + console.log('bind fail'); + return; + } + netHandle.bindSocket(tcp).then((data) => { + console.log(JSON.stringify(data)); + }).catch(error => { + console.log(JSON.stringify(error)); + }) + }) + } else { + let callback = value => { + console.log("on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo); } + udp.on('message', callback); + udp.bind({ + address: '192.168.xx.xxx', port: 8080, family: 1 + }, error => { + if (error) { + console.log('bind fail'); + return; + } + udp.on('message', (data) => { + console.log(JSON.stringify(data)); + }) + netHandle.bindSocket(udp).then((data) => { + console.log(JSON.stringify(data)); + }).catch(error => { + console.log(JSON.stringify(error)); + }) + }) + } }) ``` @@ -1639,7 +1646,7 @@ getAddressesByName(host: string, callback: AsyncCallback\>): 使用对应网络解析主机名以获取所有IP地址,使用callback方式作为异步方法。 -**需要权限**:ohos.permission.GET_NETWORK_INFO +**需要权限**:ohos.permission.INTERNET **系统能力**:SystemCapability.Communication.NetManager.Core @@ -1664,11 +1671,11 @@ getAddressesByName(host: string, callback: AsyncCallback\>): ```js connection.getDefaultNet().then(function (netHandle) { - let host = "xxxx"; - netHandle.getAddressesByName(host, function (error, data) { - console.log(JSON.stringify(error)) - console.log(JSON.stringify(data)) - }) + let host = "xxxx"; + netHandle.getAddressesByName(host, function (error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) + }) }) ``` @@ -1678,7 +1685,7 @@ getAddressesByName(host: string): Promise\> 使用对应网络解析主机名以获取所有IP地址,使用Promise方式作为异步方法。 -**需要权限**:ohos.permission.GET_NETWORK_INFO +**需要权限**:ohos.permission.INTERNET **系统能力**:SystemCapability.Communication.NetManager.Core @@ -1708,10 +1715,10 @@ getAddressesByName(host: string): Promise\> ```js connection.getDefaultNet().then(function (netHandle) { - let host = "xxxx"; - netHandle.getAddressesByName(host).then(function (data) { - console.log(JSON.stringify(data)) - }) + let host = "xxxx"; + netHandle.getAddressesByName(host).then(function (data) { + console.log(JSON.stringify(data)) + }) }) ``` @@ -1721,7 +1728,7 @@ getAddressByName(host: string, callback: AsyncCallback\): void 使用对应网络解析主机名以获取第一个IP地址,使用callback方式作为异步方法。 -**需要权限**:ohos.permission.GET_NETWORK_INFO +**需要权限**:ohos.permission.INTERNET **系统能力**:SystemCapability.Communication.NetManager.Core @@ -1746,11 +1753,11 @@ getAddressByName(host: string, callback: AsyncCallback\): void ```js connection.getDefaultNet().then(function (netHandle) { - let host = "xxxx"; - netHandle.getAddressByName(host, function (error, data) { - console.log(JSON.stringify(error)) - console.log(JSON.stringify(data)) - }) + let host = "xxxx"; + netHandle.getAddressByName(host, function (error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) + }) }) ``` @@ -1760,7 +1767,7 @@ getAddressByName(host: string): Promise\ 使用对应网络解析主机名以获取第一个IP地址,使用Promise方式作为异步方法。 -**需要权限**:ohos.permission.GET_NETWORK_INFO +**需要权限**:ohos.permission.INTERNET **系统能力**:SystemCapability.Communication.NetManager.Core @@ -1790,10 +1797,10 @@ getAddressByName(host: string): Promise\ ```js connection.getDefaultNet().then(function (netHandle) { - let host = "xxxx"; - netHandle.getAddressByName(host).then(function (data) { - console.log(JSON.stringify(data)) - }) + let host = "xxxx"; + netHandle.getAddressByName(host).then(function (data) { + console.log(JSON.stringify(data)) + }) }) ``` @@ -1801,7 +1808,7 @@ connection.getDefaultNet().then(function (netHandle) { 网络具体能力。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。 +**系统能力**:SystemCapability.Communication.NetManager.Core | 名称 | 值 | 说明 | | ------------------------ | ---- | ---------------------- | @@ -1815,7 +1822,7 @@ connection.getDefaultNet().then(function (netHandle) { 网络类型。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。 +**系统能力**:SystemCapability.Communication.NetManager.Core | 名称 | 值 | 说明 | | --------------- | ---- | ----------- | @@ -1839,7 +1846,7 @@ connection.getDefaultNet().then(function (netHandle) { 提供承载数据网络能力的实例。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。 +**系统能力**:SystemCapability.Communication.NetManager.Core | 名称 | 类型 | 必填 | 说明 | | ----------------------- | ----------------------------------- | ---- | ------------------------------------------------------------ | @@ -1850,7 +1857,7 @@ connection.getDefaultNet().then(function (netHandle) { 网络的能力集。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。 +**系统能力**:SystemCapability.Communication.NetManager.Core | 名称 | 类型 | 必填 | 说明 | | --------------------- | ---------------------------------- | --- | ------------------------ | @@ -1863,7 +1870,7 @@ connection.getDefaultNet().then(function (netHandle) { 网络连接信息。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。 +**系统能力**:SystemCapability.Communication.NetManager.Core | 名称 | 类型 | 必填 | 说明 | | ------------- | ---------------------------------- | ----|---------------- | @@ -1878,7 +1885,7 @@ connection.getDefaultNet().then(function (netHandle) { 网络路由信息。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。 +**系统能力**:SystemCapability.Communication.NetManager.Core | 名称 | 类型 | 必填 |说明 | | -------------- | --------------------------- | --- |---------------- | @@ -1892,7 +1899,7 @@ connection.getDefaultNet().then(function (netHandle) { 网络链路信息。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。 +**系统能力**:SystemCapability.Communication.NetManager.Core | 名称 | 类型 | 必填 |说明 | | ------------ | ----------------------- |---- |-------------------- | @@ -1903,10 +1910,10 @@ connection.getDefaultNet().then(function (netHandle) { 网络地址。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。 +**系统能力**:SystemCapability.Communication.NetManager.Core -| 名称 | 类型 | 必填 | 说明 | +| 名称 | 类型 | 必填 | 说明 | | ------- | ------ | -- |------------------------------ | -| address | string | 是 |地址。 | +| address | string | 是 |地址。 | | family | number | 否 |IPv4 = 1,IPv6 = 2,默认IPv4。 | -| port | number | 否 |端口,取值范围\[0, 65535]。 | +| port | number | 否 |端口,取值范围\[0, 65535]。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-net-ethernet.md b/zh-cn/application-dev/reference/apis/js-apis-net-ethernet.md index 823f3f1aa66f05d8d518deeb7c6d43fcba681282..f7ca1d622efc3bc8cbffbf620c055a264ad6edb2 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-net-ethernet.md +++ b/zh-cn/application-dev/reference/apis/js-apis-net-ethernet.md @@ -48,19 +48,19 @@ setIfaceConfig(iface: string, ic: InterfaceConfiguration, callback: AsyncCallbac ```js ethernet.setIfaceConfig("eth0", { - mode: 0, - ipAddr: "192.168.xx.xxx", - route: "192.168.xx.xxx", - gateway: "192.168.xx.xxx", - netMask: "255.255.255.0", - dnsServers: "1.1.1.1", - domain: "2.2.2.2" + mode: 0, + ipAddr: "192.168.xx.xxx", + route: "192.168.xx.xxx", + gateway: "192.168.xx.xxx", + netMask: "255.255.255.0", + dnsServers: "1.1.1.1", + domain: "2.2.2.2" }, (error) => { - if (error) { - console.log("setIfaceConfig callback error = " + JSON.stringify(error)); - } else { - console.log("setIfaceConfig callback ok "); - } + if (error) { + console.log("setIfaceConfig callback error = " + JSON.stringify(error)); + } else { + console.log("setIfaceConfig callback ok "); + } }); ``` @@ -106,17 +106,17 @@ setIfaceConfig(iface: string, ic: InterfaceConfiguration): Promise\ ```js ethernet.setIfaceConfig("eth0", { - mode: 0, - ipAddr: "192.168.xx.xxx", - route: "192.168.xx.xxx", - gateway: "192.168.xx.xxx", - netMask: "255.255.255.0", - dnsServers: "1.1.1.1", - domain: "2.2.2.2" + mode: 0, + ipAddr: "192.168.xx.xxx", + route: "192.168.xx.xxx", + gateway: "192.168.xx.xxx", + netMask: "255.255.255.0", + dnsServers: "1.1.1.1", + domain: "2.2.2.2" }).then(() => { - console.log("setIfaceConfig promiss ok "); + console.log("setIfaceConfig promise ok "); }).catch(error => { - console.log("setIfaceConfig promiss error = " + JSON.stringify(error)); + console.log("setIfaceConfig promise error = " + JSON.stringify(error)); }); ``` @@ -154,17 +154,17 @@ getIfaceConfig(iface: string, callback: AsyncCallback\): ```js ethernet.getIfaceConfig("eth0", (error, value) => { - if (error) { - console.log("getIfaceConfig callback error = " + JSON.stringify(error)); - } else { - console.log("getIfaceConfig callback mode = " + JSON.stringify(value.mode)); - console.log("getIfaceConfig callback ipAddr = " + JSON.stringify(value.ipAddr)); - console.log("getIfaceConfig callback route = " + JSON.stringify(value.route)); - console.log("getIfaceConfig callback gateway = " + JSON.stringify(value.gateway)); - console.log("getIfaceConfig callback netMask = " + JSON.stringify(value.netMask)); - console.log("getIfaceConfig callback dnsServers = " + JSON.stringify(value.dnsServers)); - console.log("getIfaceConfig callback domain = " + JSON.stringify(value.domain)); - } + if (error) { + console.log("getIfaceConfig callback error = " + JSON.stringify(error)); + } else { + console.log("getIfaceConfig callback mode = " + JSON.stringify(value.mode)); + console.log("getIfaceConfig callback ipAddr = " + JSON.stringify(value.ipAddr)); + console.log("getIfaceConfig callback route = " + JSON.stringify(value.route)); + console.log("getIfaceConfig callback gateway = " + JSON.stringify(value.gateway)); + console.log("getIfaceConfig callback netMask = " + JSON.stringify(value.netMask)); + console.log("getIfaceConfig callback dnsServers = " + JSON.stringify(value.dnsServers)); + console.log("getIfaceConfig callback domain = " + JSON.stringify(value.domain)); + } }); ``` @@ -207,15 +207,15 @@ getIfaceConfig(iface: string): Promise\ ```js ethernet.getIfaceConfig("eth0").then((data) => { - console.log("getIfaceConfig promiss mode = " + JSON.stringify(data.mode)); - console.log("getIfaceConfig promiss ipAddr = " + JSON.stringify(data.ipAddr)); - console.log("getIfaceConfig promiss route = " + JSON.stringify(data.route)); - console.log("getIfaceConfig promiss gateway = " + JSON.stringify(data.gateway)); - console.log("getIfaceConfig promiss netMask = " + JSON.stringify(data.netMask)); - console.log("getIfaceConfig promiss dnsServers = " + JSON.stringify(data.dnsServers)); - console.log("getIfaceConfig promiss domain = " + JSON.stringify(data.domain)); + console.log("getIfaceConfig promise mode = " + JSON.stringify(data.mode)); + console.log("getIfaceConfig promise ipAddr = " + JSON.stringify(data.ipAddr)); + console.log("getIfaceConfig promise route = " + JSON.stringify(data.route)); + console.log("getIfaceConfig promise gateway = " + JSON.stringify(data.gateway)); + console.log("getIfaceConfig promise netMask = " + JSON.stringify(data.netMask)); + console.log("getIfaceConfig promise dnsServers = " + JSON.stringify(data.dnsServers)); + console.log("getIfaceConfig promise domain = " + JSON.stringify(data.domain)); }).catch(error => { - console.log("getIfaceConfig promiss error = " + JSON.stringify(error)); + console.log("getIfaceConfig promise error = " + JSON.stringify(error)); }); ``` @@ -253,11 +253,11 @@ isIfaceActive(iface: string, callback: AsyncCallback\): void ```js ethernet.isIfaceActive("eth0", (error, value) => { - if (error) { - console.log("whether2Activate callback error = " + JSON.stringify(error)); - } else { - console.log("whether2Activate callback = " + JSON.stringify(value)); - } + if (error) { + console.log("whether2Activate callback error = " + JSON.stringify(error)); + } else { + console.log("whether2Activate callback = " + JSON.stringify(value)); + } }); ``` @@ -300,9 +300,9 @@ isIfaceActive(iface: string): Promise\ ```js ethernet.isIfaceActive("eth0").then((data) => { - console.log("isIfaceActive promiss = " + JSON.stringify(data)); + console.log("isIfaceActive promise = " + JSON.stringify(data)); }).catch(error => { - console.log("isIfaceActive promiss error = " + JSON.stringify(error)); + console.log("isIfaceActive promise error = " + JSON.stringify(error)); }); ``` @@ -336,14 +336,14 @@ getAllActiveIfaces(callback: AsyncCallback\>): void ```js ethernet.getAllActiveIfaces((error, value) => { - if (error) { - console.log("getAllActiveIfaces callback error = " + JSON.stringify(error)); - } else { - console.log("getAllActiveIfaces callback value.length = " + JSON.stringify(value.length)); - for (let i = 0; i < value.length; i++) { - console.log("getAllActiveIfaces callback = " + JSON.stringify(value[i])); - } + if (error) { + console.log("getAllActiveIfaces callback error = " + JSON.stringify(error)); + } else { + console.log("getAllActiveIfaces callback value.length = " + JSON.stringify(value.length)); + for (let i = 0; i < value.length; i++) { + console.log("getAllActiveIfaces callback = " + JSON.stringify(value[i])); } + } }); ``` @@ -377,22 +377,90 @@ getAllActiveIfaces(): Promise\> ```js ethernet.getAllActiveIfaces().then((data) => { - console.log("getAllActiveIfaces promiss data.length = " + JSON.stringify(data.length)); - for (let i = 0; i < data.length; i++) { - console.log("getAllActiveIfaces promiss = " + JSON.stringify(data[i])); - } + console.log("getAllActiveIfaces promise data.length = " + JSON.stringify(data.length)); + for (let i = 0; i < data.length; i++) { + console.log("getAllActiveIfaces promise = " + JSON.stringify(data[i])); + } }).catch(error => { - console.log("getAllActiveIfaces promiss error = " + JSON.stringify(error)); + console.log("getAllActiveIfaces promise error = " + JSON.stringify(error)); }); ``` +## ethernet.on('interfaceStateChange')10+ + +on(type: 'interfaceStateChange', callback: Callback\<{ iface: string, active: boolean }\>): void + +注册网卡热插拔事件,使用callback方式作为异步方法。 + +**系统接口**:此接口为系统接口。 + +**需要权限**:ohos.permission.GET_NETWORK_INFO + +**系统能力**:SystemCapability.Communication.NetManager.Ethernet + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| type | string | 是 | 订阅的事件类型,'interfaceStateChange'。 | +| callback | AsyncCallback\<{ iface: string, active: boolean }\> | 是 | 回调函数。
iface:网卡名称。
active:是否处于激活状态(true:激活;false:未激活) | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 202 | Applicable only to system applications. | +| 401 | Parameter error. | + +**示例:** + +```js + ethernet.on('interfaceStateChange', (data) => { + console.log('on interfaceSharingStateChange:' + JSON.stringify(data)); +}); +``` + +## ethernet.off('interfaceStateChange')10+ + +off(type: 'interfaceStateChange', callback?: Callback\<{ iface: string, active: boolean }\>): void + +注销网卡热插拔事件,使用callback方式作为异步方法。 + +**系统接口**:此接口为系统接口。 + +**需要权限**:ohos.permission.GET_NETWORK_INFO + +**系统能力**:SystemCapability.Communication.NetManager.Ethernet + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ---------- | +| type | string | 是 | 订阅的事件类型,'interfaceStateChange'。 | +| callback | AsyncCallback\<{ iface: string, active: boolean }> | 否 | 回调函数。
iface:网卡名称。
active:是否处于激活状态(true:激活;false:未激活) | + +**错误码:** + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 201 | Permission denied. | +| 202 | Applicable only to system applications. | +| 401 | Parameter error. | + +**示例:** + +```js +ethernet.off('interfaceStateChange'); +``` + ## InterfaceConfiguration 以太网连接配置网络信息。 **系统接口**:此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Ethernet。 +**系统能力**:SystemCapability.Communication.NetManager.Ethernet | 名称 | 类型 | 必填 | 说明 | | ------------ | ----------------------- | ---|------------------------------------------------------------ | @@ -409,7 +477,7 @@ ethernet.getAllActiveIfaces().then((data) => { **系统接口**:此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Ethernet。 +**系统能力**:SystemCapability.Communication.NetManager.Ethernet | 名称 | 值 | 说明 | | ------------------------ | ---- | ---------------------- | diff --git a/zh-cn/application-dev/reference/apis/js-apis-net-mdns.md b/zh-cn/application-dev/reference/apis/js-apis-net-mdns.md new file mode 100644 index 0000000000000000000000000000000000000000..4ddf1deca564c3302ab92a06c625e5332b50fea7 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-net-mdns.md @@ -0,0 +1,835 @@ +# @ohos.net.mdns (MDNS管理) + +MDNS即多播DNS(Multicast DNS),提供局域网内的本地服务添加、移除、发现、解析等能力。 + +> **说明:** +> 本模块首批接口从API version 10开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +## 导入模块 + +```js +import mdns from '@ohos.net.mdns' +``` + +## mdns.addLocalService + +addLocalService(context: Context, serviceInfo: LocalServiceInfo, callback: AsyncCallback\): void + +添加一个mDNS服务,使用callback方式作为异步方法。 + +**系统能力**:SystemCapability.Communication.NetManager.MDNS + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +|-------------|----------------------------------|-----------|-------------------------------------------------| +| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-app-ability-uiAbility.md)。 | +| serviceInfo | [LocalServiceInfo](#localserviceinfo) | 是 | mDNS服务的信息。 | +| callback | AsyncCallback\<[LocalServiceInfo](#localserviceinfo)> | 是 | 回调函数。成功添加error为undefined,data为添加到本地的mdns服务信息。 | + +**错误码:** + +| 错误码ID | 错误信息 | +|---------|---| +| 401 | Parameter error. | +| 2100002 | Operation failed. Cannot connect to service. | +| 2100003 | System internal error. | +| 2204003 | Callback duplicated. | +| 2204008 | Service instance duplicated. | +| 2204010 | Send packet failed. | + +> **错误码说明:** +> 以上错误码的详细介绍参见[MDNS错误码](../errorcodes/errorcode-net-mdns.md)。 + +**示例:** + +FA模型示例: + +```js +// 获取context +import featureAbility from '@ohos.ability.featureAbility'; +let context = featureAbility.getContext(); + +let localServiceInfo = { + serviceType: "_print._tcp", + serviceName: "servicename", + port: 5555, + host: { + address: "10.14.**.***", + }, + serviceAttribute: [{ + key: "111", + value: [1] + }] +} + +mdns.addLocalService(context, localServiceInfo, function (error, data) { + console.log(JSON.stringify(error)); + console.log(JSON.stringify(data)); +}); +``` + +Stage模型示例: + +```ts +// 获取context +import UIAbility from '@ohos.app.ability.UIAbility'; +class EntryAbility extends UIAbility { + onWindowStageCreate(windowStage){ + globalThis.context = this.context; + } +} +let context = globalThis.context; + +let localServiceInfo = { + serviceType: "_print._tcp", + serviceName: "servicename", + port: 5555, + host: { + address: "10.14.**.***", + }, + serviceAttribute: [{ + key: "111", + value: [1] + }] +} + +mdns.addLocalService(context, localServiceInfo, function (error, data) { + console.log(JSON.stringify(error)); + console.log(JSON.stringify(data)); +}); +``` + +## mdns.addLocalService + +addLocalService(context: Context, serviceInfo: LocalServiceInfo): Promise\ + +添加一个mDNS服务,使用Promise方式作为异步方法。 + +**系统能力**:SystemCapability.Communication.NetManager.MDNS + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +|-------------|----------------------------------|-----------|-------------------------------------------------| +| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-app-ability-uiAbility.md)。 | +| serviceInfo | [LocalServiceInfo](#localserviceinfo) | 是 | mDNS服务的信息。 | + +**返回值:** + +| 类型 | 说明 | +| --------------------------------- | ------------------------------------- | +| Promise\<[LocalServiceInfo](#localserviceinfo)> | 以Promise形式返回添加的mdns服务信息。 | + +**错误码:** + +| 错误码ID | 错误信息 | +|---------|---| +| 401 | Parameter error. | +| 2100002 | Operation failed. Cannot connect to service. | +| 2100003 | System internal error. | +| 2204003 | Callback duplicated. | +| 2204008 | Service instance duplicated. | +| 2204010 | Send packet failed. | + +> **错误码说明:** +> 以上错误码的详细介绍参见[MDNS错误码](../errorcodes/errorcode-net-mdns.md)。 + +**示例:** + +FA模型示例: + +```js +// 获取context +import featureAbility from '@ohos.ability.featureAbility'; +let context = featureAbility.getContext(); + +let localServiceInfo = { + serviceType: "_print._tcp", + serviceName: "servicename", + port: 5555, + host: { + address: "10.14.**.***", + }, + serviceAttribute: [{ + key: "111", + value: [1] + }] +} + +mdns.addLocalService(context, localServiceInfo).then(function (data) { + console.log(JSON.stringify(data)); +}); +``` + +Stage模型示例: + +```ts +// 获取context +import UIAbility from '@ohos.app.ability.UIAbility'; +class EntryAbility extends UIAbility { + onWindowStageCreate(windowStage){ + globalThis.context = this.context; + } +} +let context = globalThis.context; + +let localServiceInfo = { + serviceType: "_print._tcp", + serviceName: "servicename", + port: 5555, + host: { + address: "10.14.**.***", + }, + serviceAttribute: [{ + key: "111", + value: [1] + }] +} + +mdns.addLocalService(context, localServiceInfo).then(function (data) { + console.log(JSON.stringify(data)); +}); +``` + +## mdns.removeLocalService + +removeLocalService(context: Context, serviceInfo: LocalServiceInfo, callback: AsyncCallback\): void + +移除一个mDNS服务,使用callback方式作为异步方法。 + +**系统能力**: SystemCapability.Communication.NetManager.MDNS + +**参数** + +| 参数名 | 类型 | 必填 | 说明 | +|-------------|----------------------------------|-----------|-------------------------------------------------| +| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-app-ability-uiAbility.md)。 | +| serviceInfo | [LocalServiceInfo](#localserviceinfo) | 是 | mDNS服务的信息。 | +| callback | AsyncCallback\<[LocalServiceInfo](#localserviceinfo)> | 是 | 回调函数。成功移除error为undefined,data为移除本地的mdns服务信息。 | + +**错误码:** + +| 错误码ID | 错误信息 | +|---------|---| +| 401 | Parameter error. | +| 2100002 | Operation failed. Cannot connect to service. | +| 2100003 | System internal error. | +| 2204002 | Callback not found. | +| 2204008 | Service instance duplicated. | +| 2204010 | Send packet failed. | + +> **错误码说明:** +> 以上错误码的详细介绍参见[MDNS错误码](../errorcodes/errorcode-net-mdns.md)。 + +**示例:** + +FA模型示例: + +```js +// 获取context +import featureAbility from '@ohos.ability.featureAbility'; +let context = featureAbility.getContext(); + +let localServiceInfo = { + serviceType: "_print._tcp", + serviceName: "servicename", + port: 5555, + host: { + address: "10.14.**.***", + }, + serviceAttribute: [{ + key: "111", + value: [1] + }] +} + +mdns.removeLocalService(context, localServiceInfo, function (error, data) { + console.log(JSON.stringify(error)); + console.log(JSON.stringify(data)); +}); +``` + +Stage模型示例: + +```ts +// 获取context +import UIAbility from '@ohos.app.ability.UIAbility'; +class EntryAbility extends UIAbility { + onWindowStageCreate(windowStage){ + globalThis.context = this.context; + } +} +let context = globalThis.context; + +let localServiceInfo = { + serviceType: "_print._tcp", + serviceName: "servicename", + port: 5555, + host: { + address: "10.14.**.***", + }, + serviceAttribute: [{ + key: "111", + value: [1] + }] +} + +mdns.removeLocalService(context, localServiceInfo, function (error, data) { + console.log(JSON.stringify(error)); + console.log(JSON.stringify(data)); +}); +``` + +## mdns.removeLocalService + +removeLocalService(context: Context, serviceInfo: LocalServiceInfo): Promise\ + +移除一个mDNS服务. 使用Promise方式作为异步方法。 + +**系统能力**: SystemCapability.Communication.NetManager.MDNS + +**参数** + +| 参数名 | 类型 | 必填 | 说明 | +|-------------|----------------------------------|-----------|-------------------------------------------------| +| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-app-ability-uiAbility.md)。 | +| serviceInfo | [LocalServiceInfo](#localserviceinfo) | 是 | mDNS服务的信息。 | + +**返回值:** + +| 类型 | 说明 | +| --------------------------------- | ------------------------------------- | +| Promise\<[LocalServiceInfo](#localserviceinfo)> | 以Promise形式返回移除的mdns服务信息。 | + +**错误码:** + +| 错误码ID | 错误信息 | +|---------|---| +| 401 | Parameter error. | +| 2100002 | Operation failed. Cannot connect to service. | +| 2100003 | System internal error. | +| 2204002 | Callback not found. | +| 2204008 | Service instance duplicated. | +| 2204010 | Send packet failed. | + +> **错误码说明:** +> 以上错误码的详细介绍参见[MDNS错误码](../errorcodes/errorcode-net-mdns.md)。 + +**示例:** + +FA模型示例: + +```js +// 获取context +import featureAbility from '@ohos.ability.featureAbility'; +let context = featureAbility.getContext(); + +let localServiceInfo = { + serviceType: "_print._tcp", + serviceName: "servicename", + port: 5555, + host: { + address: "10.14.**.***", + }, + serviceAttribute: [{ + key: "111", + value: [1] + }] +} + +mdns.removeLocalService(context, localServiceInfo).then(function (data) { + console.log(JSON.stringify(data)); +}); +``` + +Stage模型示例: + +```ts +// 获取context +import UIAbility from '@ohos.app.ability.UIAbility'; +class EntryAbility extends UIAbility { + onWindowStageCreate(windowStage){ + globalThis.context = this.context; + } +} +let context = globalThis.context; + +let localServiceInfo = { + serviceType: "_print._tcp", + serviceName: "servicename", + port: 5555, + host: { + address: "10.14.**.***", + }, + serviceAttribute: [{ + key: "111", + value: [1] + }] +} + +mdns.removeLocalService(context, localServiceInfo).then(function (data) { + console.log(JSON.stringify(data)); +}); +``` + +## mdns.createDiscoveryService + +createDiscoveryService(context: Context, serviceType: string): DiscoveryService + +返回一个DiscoveryService对象,该对象用于发现指定服务类型的mDNS服务。 + +**系统能力**:SystemCapability.Communication.NetManager.MDNS + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +|-------------|---------|-----------| ------------------------------------------------------------ | +| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-app-ability-uiAbility.md)。 | +| serviceType | string | 是 | 需要发现的mDNS服务类型。| + +**返回值:** + +| Type | Description | +| ----------------------------- |---------------------------------| +| DiscoveryService | 基于指定serviceType和Context的发现服务对象。 | + +**示例** + +FA模型示例: + +```js +// 获取context +import featureAbility from '@ohos.ability.featureAbility'; +let context = featureAbility.getContext(); + +let serviceType = "_print._tcp"; +let discoveryService = mdns.createDiscoveryService(context, serviceType); +``` + +Stage模型示例: + +```ts +// 获取context +import UIAbility from '@ohos.app.ability.UIAbility'; +class EntryAbility extends UIAbility { + onWindowStageCreate(windowStage){ + globalThis.context = this.context; + } +} +let context = globalThis.context; + +let serviceType = "_print._tcp"; +let discoveryService = mdns.createDiscoveryService(context, serviceType); +``` + +## mdns.resolveLocalService + +resolveLocalService(context: Context, serviceInfo: LocalServiceInfo, callback: AsyncCallback\): void + +解析一个mDNS服务,使用callback方式作为异步方法。 + +**系统能力**: SystemCapability.Communication.NetManager.MDNS + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +|-------------|----------------------------------|-----------|-------------------------------------------------------------| +| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-app-ability-uiAbility.md)。 | +| serviceInfo | [LocalServiceInfo](#localserviceinfo) | 是 | mDNS服务的信息。 | +| callback | AsyncCallback\<[LocalServiceInfo](#localserviceinfo)> | 是 | 回调函数。成功移除error为undefined,data为解析的mdns服务信息。 | + +**错误码:** + +| 错误码ID | 错误信息 | +|---------|----------------------------------------------| +| 401 | Parameter error. | +| 2100002 | Operation failed. Cannot connect to service. | +| 2100003 | System internal error. | +| 2204003 | Callback duplicated. | +| 2204006 | Request timeout. | +| 2204010 | Send packet failed. | + +> **错误码说明:** +> 以上错误码的详细介绍参见[MDNS错误码](../errorcodes/errorcode-net-mdns.md)。 + +**示例:** + +FA模型示例: + +```js +// 获取context +import featureAbility from '@ohos.ability.featureAbility'; +let context = featureAbility.getContext(); + +let localServiceInfo = { + serviceType: "_print._tcp", + serviceName: "servicename", + port: 5555, + host: { + address: "10.14.**.***", + }, + serviceAttribute: [{ + key: "111", + value: [1] + }] +} + +mdns.resolveLocalService(context, localServiceInfo, function (error, data) { + console.log(JSON.stringify(error)); + console.log(JSON.stringify(data)); +}); +``` + +Stage模型示例: + +```ts +// 获取context +import UIAbility from '@ohos.app.ability.UIAbility'; +class EntryAbility extends UIAbility { + onWindowStageCreate(windowStage){ + globalThis.context = this.context; + } +} +let context = globalThis.context; + +let localServiceInfo = { + serviceType: "_print._tcp", + serviceName: "servicename", + port: 5555, + host: { + address: "10.14.**.***", + }, + serviceAttribute: [{ + key: "111", + value: [1] + }] +} + +mdns.resolveLocalService(context, localServiceInfo, function (error, data) { + console.log(JSON.stringify(error)); + console.log(JSON.stringify(data)); +}); +``` + +## mdns.resolveLocalService + +resolveLocalService(context: Context, serviceInfo: LocalServiceInfo): Promise\ + +解析一个mDNS服务,使用Promise方式作为异步方法。 + +**系统能力**: SystemCapability.Communication.NetManager.MDNS + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +|-------------|--------------|-----------|-----------------------------------------------------| +| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-app-ability-uiAbility.md)。 | +| serviceInfo | [LocalServiceInfo](#localserviceinfo) | 是 | mDNS服务的信息。 | + +**返回值:** + +| 类型 | 说明 | +|----------------------------| ------------------------------------- | +| Promise\<[LocalServiceInfo](#localserviceinfo)> | 以Promise形式返回解析的mDNS服务信息。| + +**错误码:** + +| 错误码ID | 错误信息 | +|---------|----------------------------------------------| +| 401 | Parameter error. | +| 2100002 | Operation failed. Cannot connect to service. | +| 2100003 | System internal error. | +| 2204003 | Callback duplicated. | +| 2204006 | Request timeout. | +| 2204010 | Send packet failed. | + +> **错误码说明:** +> 以上错误码的详细介绍参见[MDNS错误码](../errorcodes/errorcode-net-mdns.md)。 + +**示例:** + +FA模型示例: + +```js +// 获取context +import featureAbility from '@ohos.ability.featureAbility'; +let context = featureAbility.getContext(); + +let localServiceInfo = { + serviceType: "_print._tcp", + serviceName: "servicename", + port: 5555, + host: { + address: "10.14.**.***", + }, + serviceAttribute: [{ + key: "111", + value: [1] + }] +} + +mdns.resolveLocalService(context, localServiceInfo).then(function (data) { + console.log(JSON.stringify(data)); +}); +``` + +Stage模型示例: + +```ts +// 获取context +import UIAbility from '@ohos.app.ability.UIAbility'; +class EntryAbility extends UIAbility { + onWindowStageCreate(windowStage){ + globalThis.context = this.context; + } +} +let context = globalThis.context; + +let localServiceInfo = { + serviceType: "_print._tcp", + serviceName: "servicename", + port: 5555, + host: { + address: "10.14.**.***", + }, + serviceAttribute: [{ + key: "111", + value: [1] + }] +} + +mdns.resolveLocalService(context, localServiceInfo).then(function (data) { + console.log(JSON.stringify(data)); +}); +``` +## DiscoveryService + +指定服务类型的发现服务对象。 + +### startSearchingMDNS + +startSearchingMDNS(): void + +开始搜索局域网内的mDNS服务。 + +**系统能力**:SystemCapability.Communication.NetManager.MDNS + +**示例:** + +FA模型示例: + +```js +// 获取context +import featureAbility from '@ohos.ability.featureAbility'; +let context = featureAbility.getContext(); + +let discoveryService = mdns.createDiscoveryService(context, serviceType); +discoveryService.startSearchingMDNS(); +``` + +Stage模型示例: + +```ts +// 获取context +import UIAbility from '@ohos.app.ability.UIAbility'; +class EntryAbility extends UIAbility { + onWindowStageCreate(windowStage){ + globalThis.context = this.context; + } +} +let context = globalThis.context; + +let discoveryService = mdns.createDiscoveryService(context, serviceType); +discoveryService.startSearchingMDNS(); +``` + +### stopSearchingMDNS + +stopSearchingMDNS(): void + +停止搜索局域网内的mDNS服务。 + +**系统能力**:SystemCapability.Communication.NetManager.MDNS + +**示例:** + +FA模型示例: + +```js +// 获取context +import featureAbility from '@ohos.ability.featureAbility'; +let context = featureAbility.getContext(); + +let discoveryService = mdns.createDiscoveryService(context, serviceType); +discoveryService.stopSearchingMDNS(); +``` + +Stage模型示例: + +```ts +// 获取context +import UIAbility from '@ohos.app.ability.UIAbility'; +class EntryAbility extends UIAbility { + onWindowStageCreate(windowStage){ + globalThis.context = this.context; + } +} +let context = globalThis.context; + +let discoveryService = mdns.createDiscoveryService(context, serviceType); +discoveryService.stopSearchingMDNS(); +``` + +### on('discoveryStart') + +on(type: 'discoveryStart', callback: Callback<{serviceInfo: LocalServiceInfo, errorCode?: MdnsError}>): void + +订阅开启监听mDNS服务的通知。 + +**系统能力**:SystemCapability.Communication.NetManager.MDNS + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +|-------------|--------------|-----------|-----------------------------------------------------| +| type | string | 是 |订阅事件,固定为'discoveryStart'。
discoveryStart:开始搜索局域网内的mDNS服务事件。 | +| callback | Callback<{serviceInfo: [LocalServiceInfo](#localserviceinfo), errorCode?: [MdnsError](#mdnserror)}> | 是 | mDNS服务的信息和事件错误信息。 | + +**示例:** + +```js +// 参考mdns.createDiscoveryService +let discoveryService = mdns.createDiscoveryService(context, serviceType); +discoveryService.startSearchingMDNS(); + +discoveryService.on('discoveryStart', (data) => { + console.log(JSON.stringify(data)); +}); + +discoveryService.stopSearchingMDNS(); +``` + +### on('discoveryStop') + +on(type: 'discoveryStop', callback: Callback<{serviceInfo: LocalServiceInfo, errorCode?: MdnsError}>): void + +订阅停止监听mDNS服务的通知。 + +**系统能力**:SystemCapability.Communication.NetManager.MDNS + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +|-------------|--------------|-----------|-----------------------------------------------------| +| type | string | 是 |订阅事件,固定为'discoveryStop'。
discoveryStop:停止搜索局域网内的mDNS服务事件。 | +| callback | Callback<{serviceInfo: [LocalServiceInfo](#localserviceinfo), errorCode?: [MdnsError](#mdnserror)}> | 是 | mDNS服务的信息和事件错误信息。 | + +**示例:** + +```js +// 参考mdns.createDiscoveryService +let discoveryService = mdns.createDiscoveryService(context, serviceType); +discoveryService.startSearchingMDNS(); + +discoveryService.on('discoveryStop', (data) => { + console.log(JSON.stringify(data)); +}); + +discoveryService.stopSearchingMDNS(); +``` + +### on('serviceFound') + +on(type: 'serviceFound', callback: Callback\): void + +订阅发现mDNS服务的通知。 + +**系统能力**:SystemCapability.Communication.NetManager.MDNS + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +|-------------|--------------|-----------|-----------------------------------------------------| +| type | string | 是 |订阅事件,固定为'serviceFound'。
serviceFound:发现mDNS服务事件。 | +| callback | Callback<[LocalServiceInfo](#localserviceinfo)> | 是 | mDNS服务的信息。 | + +**示例:** + +```js +// 参考mdns.createDiscoveryService +let discoveryService = mdns.createDiscoveryService(context, serviceType); +discoveryService.startSearchingMDNS(); + +discoveryService.on('serviceFound', (data) => { + console.log(JSON.stringify(data)); +}); + +discoveryService.stopSearchingMDNS(); +``` + +### on('serviceLost') + +on(type: 'serviceLost', callback: Callback\): void + +订阅移除mDNS服务的通知。 + +**系统能力**:SystemCapability.Communication.NetManager.MDNS + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +|-------------|--------------|-----------|-----------------------------------------------------| +| type | string | 是 |订阅事件,固定为'serviceLost'。
serviceLost:移除mDNS服务事件。 | +| callback | Callback<[LocalServiceInfo](#localserviceinfo)> | 是 | mDNS服务的信息。 | + +**示例:** + +```js +// 参考mdns.createDiscoveryService +let discoveryService = mdns.createDiscoveryService(context, serviceType); +discoveryService.startSearchingMDNS(); + +discoveryService.on('serviceLost', (data) => { + console.log(JSON.stringify(data)); +}); + +discoveryService.stopSearchingMDNS(); +``` + +## LocalServiceInfo + +mDNS服务信息 + +**系统能力**:SystemCapability.Communication.NetManager.MDNS + +| 名称 | 类型 | 必填 | 说明 | +| --------------------- | ---------------------------------- | --- | ------------------------ | +| serviceType | string | 是 | mDNS服务的类型。格式_\.<_tcp/_udp>,name长度小于63字符并且不能包含字符'.'。 | +| serviceName | string | 是 | mDNS服务的名字。 | +| port | number | 否 | mDNS服务的端口号。 | +| host | [NetAddress](js-apis-net-connection.md#netaddress) | 否 | mDNS服务设备的IP地址。采用设备的IP,添加服务和移除服务时候不生效。 | +| serviceAttribute | serviceAttribute\<[ServiceAttribute](#serviceattribute)> | 否 | mDNS服务属性信息。 | + +## ServiceAttribute + +mDNS服务属性信息 + +**系统能力**:SystemCapability.Communication.NetManager.MDNS + +| 名称 | 类型 | 必填 | 说明 | +| --------------------- | ---------------------------------- | --- | ------------------------ | +| key | string | 是 | mDNS服务属性键值,键值长度应该小于9个字符。 | +| value | Array\ | 是 | mDNS服务属性值。 | + +## MdnsError + +mDNS错误信息。 + +**系统能力**:SystemCapability.Communication.NetManager.MDNS + +| 名称 | 值 | 说明 | +| --------------- | ---- | ----------- | +| INTERNAL_ERROR | 0 | 内部错误导致操作失败。(暂不支持) | +| ALREADY_ACTIVE | 1 | 服务已经存在导致操作失败。(暂不支持) | +| MAX_LIMIT | 2 | 请求超过最大限制导致操作失败。(暂不支持) | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-net-policy.md b/zh-cn/application-dev/reference/apis/js-apis-net-policy.md index a628c3346a7f923f1c170b340d922fa2336882bc..617c98b070096e2bce38ffe115678e1812a78ca6 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-net-policy.md +++ b/zh-cn/application-dev/reference/apis/js-apis-net-policy.md @@ -43,10 +43,12 @@ setBackgroundPolicy(isAllowed: boolean, callback: AsyncCallback\): void ```js policy.setBackgroundPolicy(Boolean(Number.parseInt(this.isBoolean))), (error, data) => { - this.callBack(error, data); - console.log(JSON.stringify(error)) - console.log(JSON.stringify(data)) -}); + this.callBack(error, data); + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) +} +) +; ``` ## policy.setBackgroundPolicy @@ -84,9 +86,9 @@ setBackgroundPolicy(isAllowed: boolean): Promise\ **示例:** ```js -policy.setBackgroundPolicy(Boolean(Number.parseInt(this.isBoolean))).then(function(error, data) { - console.log(JSON.stringify(error)) - console.log(JSON.stringify(data)) +policy.setBackgroundPolicy(Boolean(Number.parseInt(this.isBoolean))).then(function (error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) }) ``` @@ -118,9 +120,9 @@ isBackgroundAllowed(callback: AsyncCallback\): void ```js policy.isBackgroundAllowed((error, data) => { - this.callBack(error, data); - console.log(JSON.stringify(error)) - console.log(JSON.stringify(data)) + this.callBack(error, data); + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) }); ``` @@ -151,9 +153,9 @@ isBackgroundAllowed(): Promise\; **示例:** ```js -policy.isBackgroundAllowed().then(function(error, data) { - console.log(JSON.stringify(error)) - console.log(JSON.stringify(data)) +policy.isBackgroundAllowed().then(function (error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) }) ``` @@ -190,10 +192,10 @@ setPolicyByUid(uid: number, policy: NetUidPolicy, callback: AsyncCallback\ ```js let param = { - uid: Number.parseInt(this.firstParam), policy: Number.parseInt(this.currentNetUidPolicy) + uid: Number.parseInt(this.firstParam), policy: Number.parseInt(this.currentNetUidPolicy) } policy.setPolicyByUid(Number.parseInt(this.firstParam), Number.parseInt(this.currentNetUidPolicy), (error, data) => { - this.callBack(error, data); + this.callBack(error, data); }); ``` @@ -234,11 +236,11 @@ setPolicyByUid(uid: number, policy: NetUidPolicy): Promise\; ```js let param = { - uid: Number.parseInt(this.firstParam), policy: Number.parseInt(this.currentNetUidPolicy) + uid: Number.parseInt(this.firstParam), policy: Number.parseInt(this.currentNetUidPolicy) } -policy.setPolicyByUid(Number.parseInt(this.firstParam), Number.parseInt(this.currentNetUidPolicy)).then(function(error, data) { - console.log(JSON.stringify(error)) - console.log(JSON.stringify(data)) +policy.setPolicyByUid(Number.parseInt(this.firstParam), Number.parseInt(this.currentNetUidPolicy)).then(function (error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) }) ``` @@ -274,7 +276,7 @@ getPolicyByUid(uid: number, callback: AsyncCallback\): void ```js policy.getPolicyByUid(Number.parseInt(this.firstParam), (error, data) => { - this.callBack(error, data); + this.callBack(error, data); }); ``` @@ -313,9 +315,9 @@ getPolicyByUid(uid: number): Promise\; **示例:** ```js -policy.getPolicyByUid(Number.parseInt(this.firstParam)).then(function(error, data) { - console.log(JSON.stringify(error)) - console.log(JSON.stringify(data)) +policy.getPolicyByUid(Number.parseInt(this.firstParam)).then(function (error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) }) ``` @@ -351,7 +353,7 @@ getUidsByPolicy(policy: NetUidPolicy, callback: AsyncCallback\>): ```js policy.getUidsByPolicy(Number.parseInt(this.currentNetUidPolicy), (error, data) => { - this.callBack(error, data); + this.callBack(error, data); }); ``` @@ -390,9 +392,9 @@ function getUidsByPolicy(policy: NetUidPolicy): Promise\>; **示例:** ```js -policy.getUidsByPolicy(Number.parseInt(this.firstParam)).then(function(error, data) { - console.log(JSON.stringify(error)) - console.log(JSON.stringify(data)) +policy.getUidsByPolicy(Number.parseInt(this.firstParam)).then(function (error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) }) ``` @@ -425,7 +427,7 @@ getNetQuotaPolicies(callback: AsyncCallback\>): void ```js policy.getNetQuotaPolicies((error, data) => { - this.callBack(error, data); + this.callBack(error, data); }); ``` @@ -456,9 +458,9 @@ getNetQuotaPolicies(): Promise\>; **示例:** ```js -policy.getNetQuotaPolicies().then(function(error, data) { - console.log(JSON.stringify(error)) - console.log(JSON.stringify(data)) +policy.getNetQuotaPolicies().then(function (error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) }) ``` @@ -493,12 +495,22 @@ setNetQuotaPolicies(quotaPolicies: Array\, callback: AsyncCallba **示例:** ```js -let param = {netType:Number.parseInt(this.netType), iccid:this.iccid, ident:this.ident, periodDuration:this.periodDuration, warningBytes:Number.parseInt(this.warningBytes), - limitBytes:Number.parseInt(this.limitBytes), lastWarningRemind:this.lastWarningRemind, lastLimitRemind:this.lastLimitRemind, metered:Boolean(Number.parseInt(this.metered)), limitAction:this.limitAction}; +let param = { + netType: Number.parseInt(this.netType), + iccid: this.iccid, + ident: this.ident, + periodDuration: this.periodDuration, + warningBytes: Number.parseInt(this.warningBytes), + limitBytes: Number.parseInt(this.limitBytes), + lastWarningRemind: this.lastWarningRemind, + lastLimitRemind: this.lastLimitRemind, + metered: Boolean(Number.parseInt(this.metered)), + limitAction: this.limitAction +}; this.netQuotaPolicyList.push(param); policy.setNetQuotaPolicies(this.netQuotaPolicyList, (error, data) => { - this.callBack(error, data); + this.callBack(error, data); }); ``` @@ -537,13 +549,23 @@ setNetQuotaPolicies(quotaPolicies: Array\): Promise\; **示例:** ```js -let param = {netType:Number.parseInt(this.netType), iccid:this.iccid, ident:this.ident, periodDuration:this.periodDuration, warningBytes:Number.parseInt(this.warningBytes), - limitBytes:Number.parseInt(this.limitBytes), lastWarningRemind:this.lastWarningRemind, lastLimitRemind:this.lastLimitRemind, metered:Boolean(Number.parseInt(this.metered)), limitAction:this.limitAction}; +let param = { + netType: Number.parseInt(this.netType), + iccid: this.iccid, + ident: this.ident, + periodDuration: this.periodDuration, + warningBytes: Number.parseInt(this.warningBytes), + limitBytes: Number.parseInt(this.limitBytes), + lastWarningRemind: this.lastWarningRemind, + lastLimitRemind: this.lastLimitRemind, + metered: Boolean(Number.parseInt(this.metered)), + limitAction: this.limitAction +}; this.netQuotaPolicyList.push(param); -policy.setNetQuotaPolicies(this.netQuotaPolicyList).then(function(error, data) { - console.log(JSON.stringify(error)) - console.log(JSON.stringify(data)) +policy.setNetQuotaPolicies(this.netQuotaPolicyList).then(function (error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) }) ``` @@ -579,7 +601,7 @@ restoreAllPolicies(iccid: string, callback: AsyncCallback\): void ```js this.firstParam = iccid; policy.restoreAllPolicies(this.firstParam, (error, data) => { - this.callBack(error, data); + this.callBack(error, data); }); ``` @@ -619,9 +641,9 @@ restoreAllPolicies(iccid: string): Promise\; ```js this.firstParam = iccid; -policy.restoreAllPolicies(this.firstParam).then(function(error, data){ - console.log(JSON.stringify(error)) - console.log(JSON.stringify(data)) +policy.restoreAllPolicies(this.firstParam).then(function (error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) }) ``` @@ -659,10 +681,10 @@ isUidNetAllowed(uid: number, isMetered: boolean, callback: AsyncCallback\ { - this.callBack(error, data); + this.callBack(error, data); }); ``` @@ -704,11 +726,11 @@ isUidNetAllowed(uid: number, isMetered: boolean): Promise\; ```js let param = { - uid: Number.parseInt(this.firstParam), isMetered: Boolean(Number.parseInt(this.isBoolean)) + uid: Number.parseInt(this.firstParam), isMetered: Boolean(Number.parseInt(this.isBoolean)) } -policy.isUidNetAllowed(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean))).then(function(error, data) { - console.log(JSON.stringify(error)) - console.log(JSON.stringify(data)) +policy.isUidNetAllowed(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean))).then(function (error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) }) ``` @@ -746,10 +768,10 @@ isUidNetAllowed(uid: number, iface: string, callback: AsyncCallback\): ```js let param = { - uid: Number.parseInt(this.firstParam), iface: this.secondParam + uid: Number.parseInt(this.firstParam), iface: this.secondParam } policy.isUidNetAllowed(Number.parseInt(this.firstParam), this.secondParam, (error, data) => { - this.callBack(error, data); + this.callBack(error, data); }); ``` @@ -790,11 +812,11 @@ isUidNetAllowed(uid: number, iface: string): Promise\; ```js let param = { - uid: Number.parseInt(this.firstParam), iface: this.secondParam + uid: Number.parseInt(this.firstParam), iface: this.secondParam } -policy.isUidNetAllowed(Number.parseInt(this.firstParam), this.secondParam).then(function(error, data) { - console.log(JSON.stringify(error)) - console.log(JSON.stringify(data)) +policy.isUidNetAllowed(Number.parseInt(this.firstParam), this.secondParam).then(function (error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) }) ``` @@ -831,10 +853,10 @@ setDeviceIdleAllowList(uid: number, isAllowed: boolean, callback: AsyncCallback\ ```js let param = { - uid: Number.parseInt(this.firstParam), isAllowed: Boolean(Number.parseInt(this.isBoolean)) + uid: Number.parseInt(this.firstParam), isAllowed: Boolean(Number.parseInt(this.isBoolean)) } policy.setDeviceIdleAllowList(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean)), (error, data) => { - this.callBack(error, data); + this.callBack(error, data); }); ``` @@ -875,11 +897,11 @@ setDeviceIdleAllowList(uid: number, isAllowed: boolean): Promise\; ```js let param = { - uid: Number.parseInt(this.firstParam), isAllowed: Boolean(Number.parseInt(this.isBoolean)) + uid: Number.parseInt(this.firstParam), isAllowed: Boolean(Number.parseInt(this.isBoolean)) } -policy.setDeviceIdleAllowList(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean))).then(function(error, data) { - console.log(JSON.stringify(error)) - console.log(JSON.stringify(data)) +policy.setDeviceIdleAllowList(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean))).then(function (error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) }) ``` @@ -912,7 +934,7 @@ getDeviceIdleAllowList(callback: AsyncCallback\>): void ```js policy.getDeviceIdleAllowList((error, data) => { - this.callBack(error, data); + this.callBack(error, data); }); ``` @@ -943,9 +965,9 @@ getDeviceIdleAllowList(): Promise\>; **示例:** ```js -policy.getDeviceIdleAllowList().then(function(error, data) { - console.log(JSON.stringify(error)) - console.log(JSON.stringify(data)) +policy.getDeviceIdleAllowList().then(function (error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) }) ``` @@ -981,7 +1003,7 @@ getBackgroundPolicyByUid(uid: number, callback: AsyncCallback\ { - this.callBack(error, data); + this.callBack(error, data); }); ``` @@ -1021,9 +1043,9 @@ getBackgroundPolicyByUid(uid: number): Promise\; ```js this.firstParam = uid -policy.getBackgroundPolicyByUid(Number.parseInt(this.firstParam)).then(function(error, data) { - console.log(JSON.stringify(error)) - console.log(JSON.stringify(data)) +policy.getBackgroundPolicyByUid(Number.parseInt(this.firstParam)).then(function (error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) }) ``` @@ -1059,7 +1081,7 @@ resetPolicies(iccid: string, callback: AsyncCallback\): void ```js this.firstParam = iccid policy.resetPolicies(this.firstParam, (error, data) => { - this.callBack(error, data); + this.callBack(error, data); }); ``` @@ -1098,13 +1120,13 @@ resetPolicies(iccid: string): Promise\; **示例:** ```js -policy.getUidsByPolicy(Number.parseInt(this.firstParam)).then(function(error, data) { +policy.getUidsByPolicy(Number.parseInt(this.firstParam)).then(function (error, data) { }) this.firstParam = iccid -policy.resetPolicies(this.firstParam).then(function(error, data) { - console.log(JSON.stringify(error)) - console.log(JSON.stringify(data)) +policy.resetPolicies(this.firstParam).then(function (error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) }) ``` @@ -1142,10 +1164,10 @@ updateRemindPolicy(netType: NetBearType, iccid: string, remindType: RemindType, ```js let param = { - netType: Number.parseInt(this.netType), iccid: this.firstParam, remindType: this.currentRemindType + netType: Number.parseInt(this.netType), iccid: this.firstParam, remindType: this.currentRemindType } policy.updateRemindPolicy(Number.parseInt(this.netType), this.firstParam, Number.parseInt(this.currentRemindType), (error, data) => { - this.callBack(error, data); + this.callBack(error, data); }); ``` @@ -1187,11 +1209,11 @@ updateRemindPolicy(netType: NetBearType, iccid: string, remindType: RemindType): ```js let param = { - netType: Number.parseInt(this.netType), iccid: this.firstParam, remindType: this.currentRemindType + netType: Number.parseInt(this.netType), iccid: this.firstParam, remindType: this.currentRemindType } -policy.updateRemindPolicy(Number.parseInt(this.netType), this.firstParam, Number.parseInt(this.currentRemindType)).then(function(error, data) { - console.log(JSON.stringify(error)) - console.log(JSON.stringify(data)) +policy.updateRemindPolicy(Number.parseInt(this.netType), this.firstParam, Number.parseInt(this.currentRemindType)).then(function (error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) }) ``` @@ -1228,10 +1250,10 @@ setPowerSaveAllowList(uid: number, isAllowed: boolean, callback: AsyncCallback\< ```js let param = { - uid: Number.parseInt(this.firstParam), isAllowed: Boolean(Number.parseInt(this.isBoolean)) + uid: Number.parseInt(this.firstParam), isAllowed: Boolean(Number.parseInt(this.isBoolean)) } policy.setPowerSaveAllowList(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean)), (error, data) => { - this.callBack(error, data); + this.callBack(error, data); }); ``` @@ -1272,11 +1294,11 @@ setPowerSaveAllowList(uid: number, isAllowed: boolean): Promise\; ```js let param = { - uid: Number.parseInt(this.firstParam), isAllowed: Boolean(Number.parseInt(this.isBoolean)) + uid: Number.parseInt(this.firstParam), isAllowed: Boolean(Number.parseInt(this.isBoolean)) } -policy.setPowerSaveAllowList(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean))).then(function(error, data) { - console.log(JSON.stringify(error)) - console.log(JSON.stringify(data)) +policy.setPowerSaveAllowList(Number.parseInt(this.firstParam), Boolean(Number.parseInt(this.isBoolean))).then(function (error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) }) ``` @@ -1309,7 +1331,7 @@ getPowerSaveAllowList(callback: AsyncCallback\>): void ```js policy.getPowerSaveAllowList((error, data) => { - this.callBack(error, data); + this.callBack(error, data); }); ``` @@ -1340,9 +1362,9 @@ getPowerSaveAllowList(): Promise\>; **示例:** ```js -policy.getPowerSaveAllowList().then(function(error, data) { - console.log(JSON.stringify(error)) - console.log(JSON.stringify(data)) +policy.getPowerSaveAllowList().then(function (error, data) { + console.log(JSON.stringify(error)) + console.log(JSON.stringify(data)) }) ``` @@ -1371,7 +1393,7 @@ on(type: "netUidPolicyChange", callback: Callback\<{ uid: number, policy: NetUid ```js policy.on('netUidPolicyChange', (data) => { - this.log('on netUidPolicyChange:' + JSON.stringify(data)); + this.log('on netUidPolicyChange:' + JSON.stringify(data)); }) ``` @@ -1396,7 +1418,7 @@ on(type: "netUidRuleChange", callback: Callback\<{ uid: number, rule: NetUidRule ```js policy.on('netUidRuleChange', (data) => { - this.log('on netUidRuleChange:' + JSON.stringify(data)); + this.log('on netUidRuleChange:' + JSON.stringify(data)); }) ``` @@ -1421,7 +1443,7 @@ on(type: "netMeteredIfacesChange", callback: Callback\>): void ```js policy.on('netMeteredIfacesChange', (data) => { - this.log('on netMeteredIfacesChange:' + JSON.stringify(data)); + this.log('on netMeteredIfacesChange:' + JSON.stringify(data)); }) ``` @@ -1446,7 +1468,7 @@ on(type: "netQuotaPolicyChange", callback: Callback\>): v ```js policy.on('netQuotaPolicyChange', (data) => { - this.log('on netQuotaPolicyChange:' + JSON.stringify(data)); + this.log('on netQuotaPolicyChange:' + JSON.stringify(data)); }) ``` @@ -1471,7 +1493,7 @@ on(type: "netBackgroundPolicyChange", callback: Callback\): void ```js policy.on('netBackgroundPolicyChange', (data) => { - this.log('on netBackgroundPolicyChange:' + JSON.stringify(data)); + this.log('on netBackgroundPolicyChange:' + JSON.stringify(data)); }) ``` @@ -1479,7 +1501,7 @@ policy.on('netBackgroundPolicyChange', (data) => { 后台网络策略。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。 +**系统能力**:SystemCapability.Communication.NetManager.Core | 参数名 | 值 | 说明 | | ------------------------ | ---- | ---------------------- | @@ -1492,7 +1514,7 @@ policy.on('netBackgroundPolicyChange', (data) => { 计量网络策略。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。 +**系统能力**:SystemCapability.Communication.NetManager.Core | 参数名 | 类型 | 说明 | | ----------------------- | ----------------------------------- | ------------------------------------------------------------ | @@ -1511,7 +1533,7 @@ policy.on('netBackgroundPolicyChange', (data) => { 限制动作。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。 +**系统能力**:SystemCapability.Communication.NetManager.Core | 参数名 | 值 | 说明 | | ---------------------- | ----- | ------------ | @@ -1523,7 +1545,7 @@ policy.on('netBackgroundPolicyChange', (data) => { 计量网络规则。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。 +**系统能力**:SystemCapability.Communication.NetManager.Core | 参数名 | 值 | 说明 | | ---------------------- | ----- | ------------ | @@ -1538,18 +1560,18 @@ policy.on('netBackgroundPolicyChange', (data) => { 提醒类型。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。 +**系统能力**:SystemCapability.Communication.NetManager.Core -| 参数名 | 值 | 说明 | +| 参数名 | 值 | 说明 | | ---------------------- | - | ------- | -| REMIND_TYPE_WARNING | 1 | 警告提醒 | -| REMIND_TYPE_LIMIT | 2 | 限制提醒 | +| REMIND_TYPE_WARNING | 1 | 警告提醒 | +| REMIND_TYPE_LIMIT | 2 | 限制提醒 | ## NetUidPolicy 应用对应的网络策略。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetManager.Core。 +**系统能力**:SystemCapability.Communication.NetManager.Core | 参数名 | 值 | 说明 | | ---------------------- | ----- | ------------ | diff --git a/zh-cn/application-dev/reference/apis/js-apis-net-sharing.md b/zh-cn/application-dev/reference/apis/js-apis-net-sharing.md index fd4ed040b47b0a7729efc4eb4b30f43c98e9a8e2..0419052af8cd7c222d788f2f7c04bf020e7e3280 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-net-sharing.md +++ b/zh-cn/application-dev/reference/apis/js-apis-net-sharing.md @@ -43,8 +43,8 @@ isSharingSupported(callback: AsyncCallback\): void ```js sharing.isSharingSupported((error, data) => { - console.log(JSON.stringify(error)); - console.log(JSON.stringify(data)); + console.log(JSON.stringify(error)); + console.log(JSON.stringify(data)); }); ``` @@ -79,9 +79,9 @@ isSharingSupported(): Promise\ ```js sharing.isSharingSupported().then(data => { - console.log(JSON.stringify(data)); + console.log(JSON.stringify(data)); }).catch(error => { - console.log(JSON.stringify(error)); + console.log(JSON.stringify(error)); }); ``` @@ -115,8 +115,8 @@ isSharing(callback: AsyncCallback\): void ```js sharing.isSharing((error, data) => { - console.log(JSON.stringify(error)); - console.log(JSON.stringify(data)); + console.log(JSON.stringify(error)); + console.log(JSON.stringify(data)); }); ``` @@ -150,9 +150,9 @@ isSharing(): Promise\ ```js sharing.isSharing().then(data => { - console.log(JSON.stringify(data)); + console.log(JSON.stringify(data)); }).catch(error => { - console.log(JSON.stringify(error)); + console.log(JSON.stringify(error)); }); ``` @@ -194,9 +194,10 @@ startSharing(type: SharingIfaceType, callback: AsyncCallback\): void ```js import SharingIfaceType from '@ohos.net.sharing' -let SHARING_WIFI=0; + +let SHARING_WIFI = 0; sharing.startSharing(SHARING_WIFI, (error) => { - console.log(JSON.stringify(error)); + console.log(JSON.stringify(error)); }); ``` @@ -243,11 +244,12 @@ startSharing(type: SharingIfaceType): Promise\ ```js import SharingIfaceType from '@ohos.net.sharing' -let SHARING_WIFI=0; + +let SHARING_WIFI = 0; sharing.startSharing(SHARING_WIFI).then(() => { - console.log("start wifi sharing successful"); + console.log("start wifi sharing successful"); }).catch(error => { - console.log("start wifi sharing failed"); + console.log("start wifi sharing failed"); }); ``` @@ -287,9 +289,10 @@ stopSharing(type: SharingIfaceType, callback: AsyncCallback\): void ```js import SharingIfaceType from '@ohos.net.sharing' -let SHARING_WIFI=0; + +let SHARING_WIFI = 0; sharing.stopSharing(SHARING_WIFI, (error) => { - console.log(JSON.stringify(error)); + console.log(JSON.stringify(error)); }); ``` @@ -334,11 +337,12 @@ stopSharing(type: SharingIfaceType): Promise\ ```js import SharingIfaceType from '@ohos.net.sharing' -let SHARING_WIFI=0; + +let SHARING_WIFI = 0; sharing.stopSharing(SHARING_WIFI).then(() => { - console.log("stop wifi sharing successful"); + console.log("stop wifi sharing successful"); }).catch(error => { - console.log("stop wifi sharing failed"); + console.log("stop wifi sharing failed"); }); ``` @@ -372,8 +376,8 @@ getStatsRxBytes(callback: AsyncCallback\): void ```js sharing.getStatsRxBytes((error, data) => { - console.log(JSON.stringify(error)); - console.log(JSON.stringify(data)); + console.log(JSON.stringify(error)); + console.log(JSON.stringify(data)); }); ``` @@ -407,9 +411,9 @@ getStatsRxBytes(): Promise\ ```js sharing.getStatsRxBytes().then(data => { - console.log(JSON.stringify(data)); + console.log(JSON.stringify(data)); }).catch(error => { - console.log(JSON.stringify(error)); + console.log(JSON.stringify(error)); }); ``` @@ -443,8 +447,8 @@ getStatsTxBytes(callback: AsyncCallback\): void ```js sharing.getStatsTxBytes((error, data) => { - console.log(JSON.stringify(error)); - console.log(JSON.stringify(data)); + console.log(JSON.stringify(error)); + console.log(JSON.stringify(data)); }); ``` @@ -478,9 +482,9 @@ getStatsTxBytes(): Promise\ ```js sharing.getStatsTxBytes().then(data => { - console.log(JSON.stringify(data)); + console.log(JSON.stringify(data)); }).catch(error => { - console.log(JSON.stringify(error)); + console.log(JSON.stringify(error)); }); ``` @@ -514,8 +518,8 @@ getStatsTotalBytes(callback: AsyncCallback\): void ```js sharing.getStatsTotalBytes((error, data) => { - console.log(JSON.stringify(error)); - console.log(JSON.stringify(data)); + console.log(JSON.stringify(error)); + console.log(JSON.stringify(data)); }); ``` @@ -549,9 +553,9 @@ getStatsTotalBytes(): Promise\ ```js sharing.getStatsTotalBytes().then(data => { - console.log(JSON.stringify(data)); + console.log(JSON.stringify(data)); }).catch(error => { - console.log(JSON.stringify(error)); + console.log(JSON.stringify(error)); }); ``` @@ -588,10 +592,11 @@ getSharingIfaces(state: SharingIfaceState, callback: AsyncCallback\ { - console.log(JSON.stringify(error)); - console.log(JSON.stringify(data)); + console.log(JSON.stringify(error)); + console.log(JSON.stringify(data)); }); ``` @@ -633,11 +638,12 @@ getSharingIfaces(state: SharingIfaceState): Promise\> ```js import SharingIfaceState from '@ohos.net.sharing' -let SHARING_BLUETOOTH=2; + +let SHARING_BLUETOOTH = 2; sharing.getSharingIfaces(SHARING_BLUETOOTH).then(data => { - console.log(JSON.stringify(data)); + console.log(JSON.stringify(data)); }).catch(error => { - console.log(JSON.stringify(error)); + console.log(JSON.stringify(error)); }); ``` @@ -674,10 +680,11 @@ getSharingState(type: SharingIfaceType, callback: AsyncCallback\ { - console.log(JSON.stringify(error)); - console.log(JSON.stringify(data)); + console.log(JSON.stringify(error)); + console.log(JSON.stringify(data)); }); ``` @@ -719,11 +726,12 @@ getSharingState(type: SharingIfaceType): Promise\ ```js import SharingIfaceType from '@ohos.net.sharing' -let SHARING_WIFI=0; + +let SHARING_WIFI = 0; sharing.getSharingState(SHARING_WIFI).then(data => { - console.log(JSON.stringify(data)); + console.log(JSON.stringify(data)); }).catch(error => { - console.log(JSON.stringify(error)); + console.log(JSON.stringify(error)); }); ``` @@ -760,10 +768,11 @@ getSharableRegexes(type: SharingIfaceType, callback: AsyncCallback\ { - console.log(JSON.stringify(error)); - console.log(JSON.stringify(data)); + console.log(JSON.stringify(error)); + console.log(JSON.stringify(data)); }); ``` @@ -805,11 +814,12 @@ getSharableRegexes(type: SharingIfaceType): Promise\> ```js import SharingIfaceType from '@ohos.net.sharing' -let SHARING_WIFI=0; + +let SHARING_WIFI = 0; sharing.getSharableRegexes(SHARING_WIFI).then(data => { - console.log(JSON.stringify(data)); + console.log(JSON.stringify(data)); }).catch(error => { - console.log(JSON.stringify(error)); + console.log(JSON.stringify(error)); }); ``` @@ -842,8 +852,8 @@ on(type: 'sharingStateChange', callback: Callback\): void **示例:** ```js - sharing.on('sharingStateChange', (data) => { - console.log('on sharingStateChange:' + JSON.stringify(data)); +sharing.on('sharingStateChange', (data) => { + console.log('on sharingStateChange: ' + JSON.stringify(data)); }); ``` @@ -877,13 +887,14 @@ off(type: 'sharingStateChange', callback?: Callback\): void ```js sharing.off('sharingStateChange', (data) => { - console.log(JSON.stringify(data)); + console.log(JSON.stringify(data)); }); ``` ## sharing.on('interfaceSharingStateChange') -on(type: 'interfaceSharingStateChange', callback: Callback\<{ type: SharingIfaceType, iface: string, state: SharingIfaceState }>): void +on(type: 'interfaceSharingStateChange', callback: Callback\<{ type: SharingIfaceType, iface: string, state: +SharingIfaceState }>): void 注册网卡网络共享状态变化事件,使用callback方式作为异步方法。 @@ -910,14 +921,15 @@ on(type: 'interfaceSharingStateChange', callback: Callback\<{ type: SharingIface **示例:** ```js - sharing.on('interfaceSharingStateChange', (data) => { - console.log('on interfaceSharingStateChange:' + JSON.stringify(data)); +sharing.on('interfaceSharingStateChange', (data) => { + console.log('on interfaceSharingStateChange:' + JSON.stringify(data)); }); ``` ## sharing.off('interfaceSharingStateChange') -off(type: 'interfaceSharingStateChange', callback?: Callback\<{ type: SharingIfaceType, iface: string, state: SharingIfaceState }>): void +off(type: 'interfaceSharingStateChange', callback?: Callback\<{ type: SharingIfaceType, iface: string, state: +SharingIfaceState }>): void 注销网卡网络共享状态变化事件,使用callback方式作为异步方法。 @@ -945,7 +957,7 @@ off(type: 'interfaceSharingStateChange', callback?: Callback\<{ type: SharingIfa ```js sharing.off('interfaceSharingStateChange', (data) => { - console.log(JSON.stringify(data)); + console.log(JSON.stringify(data)); }); ``` @@ -978,8 +990,8 @@ on(type: 'sharingUpstreamChange', callback: Callback\): void **示例:** ```js - sharing.on('sharingUpstreamChange', (data) => { - console.log('on sharingUpstreamChange:' + JSON.stringify(data)); +sharing.on('sharingUpstreamChange', (data) => { + console.log('on sharingUpstreamChange:' + JSON.stringify(data)); }); ``` @@ -1013,7 +1025,7 @@ off(type: 'sharingUpstreamChange', callback?: Callback\): void ```js sharing.off('sharingUpstreamChange', (data) => { - console.log(JSON.stringify(data)); + console.log(JSON.stringify(data)); }); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-nfcController.md b/zh-cn/application-dev/reference/apis/js-apis-nfcController.md index b46c3e52c46c256fad4ca33851398ed62e7aad52..6721457686b722d50b67c43a0612213b0afc90f0 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-nfcController.md +++ b/zh-cn/application-dev/reference/apis/js-apis-nfcController.md @@ -64,7 +64,7 @@ openNfc(): boolean ## controller.enableNfc9+ -enableNfc(): boolean +enableNfc(): void 打开NFC开关。 @@ -101,7 +101,7 @@ closeNfc(): boolean ## controller.disableNfc9+ -disableNfc(): boolean +disableNfc(): void 关闭NFC开关。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-nfcTag.md b/zh-cn/application-dev/reference/apis/js-apis-nfcTag.md index d7ebd70b23d8889b5d04fda6832cda2f340f55da..32415c68aa57bcca2e42fee15c968a0019833955 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-nfcTag.md +++ b/zh-cn/application-dev/reference/apis/js-apis-nfcTag.md @@ -382,7 +382,7 @@ getNdef(tagInfo: [TagInfo](#taginfo)): [NdefTag](js-apis-nfctech.md#ndeftag9) ## tag.getMifareClassic9+ -getMifareClassic(tagInfo: [TagInfo](#taginfo)): [MifareClassicTag](js-apis-nfctech.md#mifareclassictag-9) +getMifareClassic(tagInfo: [TagInfo](#taginfo)): [MifareClassicTag](js-apis-nfctech.md#mifareclassictag9) 获取MIFARE Classic类型Tag对象,通过该对象访问支持MIFARE Classic技术类型的Tag。 @@ -766,8 +766,8 @@ NFC服务在读取到标签时给出的对象,通过改对象属性,应用 | -------- | -------- | -------- | -------- | -------- | | uid9+ | number[] | 是 | 否 | 标签的uid,每个number值是十六进制表示,范围是0x00~0xFF。| | technology9+ | number[] | 是 | 否 | 支持的技术类型,每个number值表示所支持技术类型的常量值。 | -| supportedProfiles | number[] | 是 | 否 | 支持的技术类型,从API9开始不支持,使用[tag.TagInfo#technology](#taginfo)替代。| -| extrasData9+ | [PacMap](js-apis-inner-ability-dataAbilityHelper.md#pacmap)[] | 是 | 否 | 标签所支持技术的扩展属性值。
**系统接口:** 此接口为系统接口。| +| supportedProfiles | number[] | 是 | 否 | 支持的技术类型,从API9开始不支持,使用[tag.TagInfo#technology](#tagtaginfo)替代。| +| extrasData9+ | [PacMap](js-apis-inner-application-pacMap.md)[] | 是 | 否 | 标签所支持技术的扩展属性值。
**系统接口:** 此接口为系统接口。| | tagRfDiscId9+ | number | 是 | 否 | 标签发现时分配的ID值。
**系统接口:** 此接口为系统接口。| | remoteTagService9+ | [rpc.RemoteObject](js-apis-rpc.md#remoteobject) | 是 | 否 | NFC服务进程的远端对象,用于客户端和服务之间的接口通信。
**系统接口:** 此接口为系统接口。| ## NdefRecord9+ 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 b9b5f24a3c572b586124b379039bca1eaa99cdb2..8b646e42f6042ec81666bd46964b9e802b059562 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-notification.md +++ b/zh-cn/application-dev/reference/apis/js-apis-notification.md @@ -853,8 +853,8 @@ function unsubscribeCallback(err) { console.info("unsubscribe success"); } } -function onDisconnectCallback(data) { - console.info("Cancel callback: " + JSON.stringify(data)); +function onDisconnectCallback() { + console.info("subscribe disconnect"); } let subscriber = { onDisconnect: onDisconnectCallback @@ -883,8 +883,8 @@ unsubscribe(subscriber: NotificationSubscriber): Promise\ **示例:** ```js -function onDisconnectCallback(data) { - console.info("Cancel callback: " + JSON.stringify(data)); +function onDisconnectCallback() { + console.info("subscribe disconnect"); } let subscriber = { onDisconnect: onDisconnectCallback diff --git a/zh-cn/application-dev/reference/apis/js-apis-notificationManager.md b/zh-cn/application-dev/reference/apis/js-apis-notificationManager.md index 804b78251304dccae0f08e9d9a88565b65ac794e..7384faeb10636aa3850ae29e789a07cc47d1d079 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-notificationManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-notificationManager.md @@ -24,7 +24,7 @@ publish(request: NotificationRequest, callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------- | ---- | ------------------------------------------- | -| request | [NotificationRequest](#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 | +| request | [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 | | callback | AsyncCallback\ | 是 | 发布通知的回调方法。 | **错误码:** @@ -33,12 +33,14 @@ publish(request: NotificationRequest, callback: AsyncCallback\): void | 错误码ID | 错误信息 | | -------- | ----------------------------------------- | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | | 1600004 | Notification is not enabled. | | 1600005 | Notification slot is not enabled. | | 1600009 | Over max number notifications per second. | +| 1600012 | No memory space. | **示例:** @@ -78,7 +80,7 @@ publish(request: NotificationRequest): Promise\ | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------- | ---- | ------------------------------------------- | -| request | [NotificationRequest](#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 | +| request | [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 | **错误码:** @@ -86,12 +88,15 @@ publish(request: NotificationRequest): Promise\ | 错误码ID | 错误信息 | | -------- | ----------------------------------------- | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | | 1600004 | Notification is not enabled. | | 1600005 | Notification slot is not enabled. | | 1600009 | Over max number notifications per second. | +| 1600012 | No memory space. | **示例:** @@ -130,7 +135,7 @@ publish(request: NotificationRequest, userId: number, callback: AsyncCallback\ | 是 | 被指定的回调方法。 | @@ -140,6 +145,8 @@ publish(request: NotificationRequest, userId: number, callback: AsyncCallback\ | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------------------- | ---- | ------------------------------------------- | -| request | [NotificationRequest](#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 | +| request | [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 | | userId | number | 是 | 用户ID。 | **错误码:** @@ -201,6 +209,8 @@ publish(request: NotificationRequest, userId: number): Promise\ | 错误码ID | 错误信息 | | -------- | ----------------------------------------- | +| 201 | Permission denied. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -208,6 +218,7 @@ publish(request: NotificationRequest, userId: number): Promise\ | 1600005 | Notification slot is not enabled. | | 1600008 | The user is not exist. | | 1600009 | Over max number notifications per second. | +| 1600012 | No memory space. | **示例:** @@ -254,6 +265,7 @@ cancel(id: number, label: string, callback: AsyncCallback\): void | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -294,6 +306,7 @@ cancel(id: number, label?: string): Promise\ | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -328,6 +341,7 @@ cancel(id: number, callback: AsyncCallback\): void | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -361,6 +375,7 @@ cancelAll(callback: AsyncCallback\): void | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -399,6 +414,7 @@ cancelAll(): Promise\ | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -427,7 +443,7 @@ addSlot(slot: NotificationSlot, callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------- | ---- | -------------------- | -| slot | [NotificationSlot](#notificationslot) | 是 | 要创建的通知通道对象。 | +| slot | [NotificationSlot](js-apis-inner-notification-notificationSlot.md) | 是 | 要创建的通知通道对象。 | | callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 | **错误码:** @@ -436,9 +452,13 @@ addSlot(slot: NotificationSlot, callback: AsyncCallback\): void | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | +| 1600012 | No memory space. | **示例:** @@ -474,7 +494,7 @@ addSlot(slot: NotificationSlot): Promise\ | 参数名 | 类型 | 必填 | 说明 | | ---- | ---------------- | ---- | -------------------- | -| slot | [NotificationSlot](#notificationslot) | 是 | 要创建的通知通道对象。 | +| slot | [NotificationSlot](js-apis-inner-notification-notificationSlot.md) | 是 | 要创建的通知通道对象。 | **错误码:** @@ -482,9 +502,13 @@ addSlot(slot: NotificationSlot): Promise\ | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | +| 1600012 | No memory space. | **示例:** @@ -519,9 +543,11 @@ addSlot(type: SlotType, callback: AsyncCallback\): void | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | +| 1600012 | No memory space. | **示例:** @@ -557,9 +583,11 @@ addSlot(type: SlotType): Promise\ | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | +| 1600012 | No memory space. | **示例:** @@ -585,7 +613,7 @@ addSlots(slots: Array\, callback: AsyncCallback\): voi | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ------------------------ | -| slots | Array\<[NotificationSlot](#notificationslot)\> | 是 | 要创建的通知通道对象数组。 | +| slots | Array\<[NotificationSlot](js-apis-inner-notification-notificationSlot.md)\> | 是 | 要创建的通知通道对象数组。 | | callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 | **错误码:** @@ -594,9 +622,13 @@ addSlots(slots: Array\, callback: AsyncCallback\): voi | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | +| 1600012 | No memory space. | **示例:** @@ -636,7 +668,7 @@ addSlots(slots: Array\): Promise\ | 参数名 | 类型 | 必填 | 说明 | | ----- | ------------------------- | ---- | ------------------------ | -| slots | Array\<[NotificationSlot](#notificationslot)\> | 是 | 要创建的通知通道对象数组。 | +| slots | Array\<[NotificationSlot](js-apis-inner-notification-notificationSlot.md)\> | 是 | 要创建的通知通道对象数组。 | **错误码:** @@ -644,9 +676,13 @@ addSlots(slots: Array\): Promise\ | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | +| 1600012 | No memory space. | **示例:** @@ -677,7 +713,7 @@ getSlot(slotType: SlotType, callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------------- | ---- | ----------------------------------------------------------- | | slotType | [SlotType](#slottype) | 是 | 通知渠道类型,目前分为社交通信、服务提醒、内容咨询和其他类型。 | -| callback | AsyncCallback\<[NotificationSlot](#notificationslot)\> | 是 | 表示被指定的回调方法。 | +| callback | AsyncCallback\<[NotificationSlot](js-apis-inner-notification-notificationSlot.md)\> | 是 | 表示被指定的回调方法。 | **错误码:** @@ -685,6 +721,7 @@ getSlot(slotType: SlotType, callback: AsyncCallback\): void | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -730,6 +767,7 @@ getSlot(slotType: SlotType): Promise\ | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -757,12 +795,13 @@ getSlots(callback: AsyncCallback>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------------- | ---- | -------------------- | -| callback | AsyncCallback\\> | 是 | 以callback形式返回获取此应用程序的所有通知通道的结果。 | +| callback | AsyncCallback\\> | 是 | 以callback形式返回获取此应用程序的所有通知通道的结果。 | **错误码:** | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -793,7 +832,7 @@ getSlots(): Promise\> | 类型 | 说明 | | ----------------------------------------------------------- | ------------------------------------------------------------ | -| Promise\\> | 以Promise形式返回获取此应用程序的所有通知通道的结果。 | +| Promise\\> | 以Promise形式返回获取此应用程序的所有通知通道的结果。 | **错误码:** @@ -801,6 +840,7 @@ getSlots(): Promise\> | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -834,6 +874,7 @@ removeSlot(slotType: SlotType, callback: AsyncCallback\): void | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -873,6 +914,7 @@ removeSlot(slotType: SlotType): Promise\ | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -906,6 +948,7 @@ removeAllSlots(callback: AsyncCallback\): void | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -937,6 +980,7 @@ removeAllSlots(): Promise\ | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -965,7 +1009,7 @@ setNotificationEnable(bundle: BundleOption, enable: boolean, callback: AsyncCall | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------- | ---- | -------------------- | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | | enable | boolean | 是 | 使能状态。 | | callback | AsyncCallback\ | 是 | 设定通知使能回调函数。 | @@ -975,6 +1019,9 @@ setNotificationEnable(bundle: BundleOption, enable: boolean, callback: AsyncCall | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -1012,7 +1059,7 @@ setNotificationEnable(bundle: BundleOption, enable: boolean): Promise\ | 参数名 | 类型 | 必填 | 说明 | | ------ | ------------ | ---- | ---------- | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | | enable | boolean | 是 | 使能状态。 | **错误码:** @@ -1021,6 +1068,9 @@ setNotificationEnable(bundle: BundleOption, enable: boolean): Promise\ | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -1053,7 +1103,7 @@ isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback\): | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------- | ---- | ------------------------ | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | | callback | AsyncCallback\ | 是 | 获取通知使能状态回调函数。 | **错误码:** @@ -1062,6 +1112,9 @@ isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback\): | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -1099,7 +1152,7 @@ isNotificationEnabled(bundle: BundleOption): Promise\ | 参数名 | 类型 | 必填 | 说明 | | ------ | ------------ | ---- | ---------- | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | **返回值:** @@ -1113,6 +1166,9 @@ isNotificationEnabled(bundle: BundleOption): Promise\ | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -1153,6 +1209,9 @@ isNotificationEnabled(callback: AsyncCallback\): void | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -1187,7 +1246,7 @@ isNotificationEnabled(): Promise\ | 参数名 | 类型 | 必填 | 说明 | | ------ | ------------ | ---- | ---------- | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | **返回值:** @@ -1201,6 +1260,9 @@ isNotificationEnabled(): Promise\ | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -1230,7 +1292,7 @@ displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback\ | 是 | 设定角标使能回调函数。 | @@ -1240,6 +1302,9 @@ displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback\ | 参数名 | 类型 | 必填 | 说明 | | ------ | ------------ | ---- | ---------- | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | | enable | boolean | 是 | 使能状态。 | **错误码:** @@ -1286,6 +1351,9 @@ displayBadge(bundle: BundleOption, enable: boolean): Promise\ | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -1318,7 +1386,7 @@ isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------- | ---- | ------------------------ | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | | callback | AsyncCallback\ | 是 | 获取角标使能状态回调函数。 | **错误码:** @@ -1327,6 +1395,9 @@ isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback\): void | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -1364,7 +1435,7 @@ isBadgeDisplayed(bundle: BundleOption): Promise\ | 参数名 | 类型 | 必填 | 说明 | | ------ | ------------ | ---- | ---------- | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | **返回值:** @@ -1378,6 +1449,9 @@ isBadgeDisplayed(bundle: BundleOption): Promise\ | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -1412,10 +1486,11 @@ setBadgeNumber(badgeNumber: number): Promise\ | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | -| 1600012 | No memory space. | +| 1600012 | No memory space. | **示例:** @@ -1447,10 +1522,11 @@ setBadgeNumber(badgeNumber: number, callback: AsyncCallback\): void | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | -| 1600012 | No memory space. | +| 1600012 | No memory space. | **示例:** @@ -1483,8 +1559,8 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCal | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------- | ---- | -------------------- | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | -| slot | [NotificationSlot](#notificationslot) | 是 | 通知通道。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | +| slot | [NotificationSlot](js-apis-inner-notification-notificationSlot.md) | 是 | 通知通道。 | | callback | AsyncCallback\ | 是 | 设定通知通道回调函数。 | **错误码:** @@ -1493,6 +1569,9 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCal | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -1533,8 +1612,8 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise\ | 参数名 | 类型 | 必填 | 说明 | | ------ | ------------ | ---- | ---------- | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | -| slot | [NotificationSlot](#notificationslot) | 是 | 通知通道。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | +| slot | [NotificationSlot](js-apis-inner-notification-notificationSlot.md) | 是 | 通知通道。 | **错误码:** @@ -1542,6 +1621,9 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise\ | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -1577,8 +1659,8 @@ getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback> | 是 | 获取通知通道回调函数。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | +| callback | AsyncCallback> | 是 | 获取通知通道回调函数。 | **错误码:** @@ -1586,6 +1668,9 @@ getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback> | 参数名 | 类型 | 必填 | 说明 | | ------ | ------------ | ---- | ---------- | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | **返回值:** | 类型 | 说明 | | ----------------------------------------------------------- | ------------------------------------------------------------ | -| Promise> | 以Promise形式返回获取指定应用的通知通道。 | +| Promise> | 以Promise形式返回获取指定应用的通知通道。 | **错误码:** @@ -1637,6 +1722,9 @@ getSlotsByBundle(bundle: BundleOption): Promise> | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -1669,7 +1757,7 @@ getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback\): voi | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ---------------------- | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | | callback | AsyncCallback\ | 是 | 获取通知通道数量回调函数。 | **错误码:** @@ -1678,6 +1766,9 @@ getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback\): voi | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -1715,7 +1806,7 @@ getSlotNumByBundle(bundle: BundleOption): Promise\ | 参数名 | 类型 | 必填 | 说明 | | ------ | ------------ | ---- | ---------- | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | **返回值:** @@ -1729,6 +1820,9 @@ getSlotNumByBundle(bundle: BundleOption): Promise\ | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -1762,12 +1856,15 @@ getAllActiveNotifications(callback: AsyncCallback>) | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------------------ | ---- | -------------------- | -| callback | AsyncCallback> | 是 | 获取活动通知回调函数。 | +| callback | AsyncCallback> | 是 | 获取活动通知回调函数。 | **错误码:** | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -1788,7 +1885,7 @@ notificationManager.getAllActiveNotifications(getAllActiveNotificationsCallback) ## notificationManager.getAllActiveNotifications -getAllActiveNotifications(): Promise\\> +getAllActiveNotifications(): Promise\\> 获取当前未删除的所有通知(Promise形式)。 @@ -1802,7 +1899,7 @@ getAllActiveNotifications(): Promise\\> | 以Promise形式返回获取活动通知。 | +| Promise\\> | 以Promise形式返回获取活动通知。 | **错误码:** @@ -1810,6 +1907,9 @@ getAllActiveNotifications(): Promise\): void | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -1880,6 +1981,7 @@ getActiveNotificationCount(): Promise\ | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -1904,7 +2006,7 @@ getActiveNotifications(callback: AsyncCallback>): v | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------------------ | ---- | ------------------------------ | -| callback | AsyncCallback> | 是 | 获取当前应用通知列表回调函数。 | +| callback | AsyncCallback> | 是 | 获取当前应用通知列表回调函数。 | **错误码:** @@ -1912,6 +2014,7 @@ getActiveNotifications(callback: AsyncCallback>): v | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -1932,7 +2035,7 @@ notificationManager.getActiveNotifications(getActiveNotificationsCallback); ## notificationManager.getActiveNotifications -getActiveNotifications(): Promise\\> +getActiveNotifications(): Promise\\> 获取当前应用未删除的通知列表(Promise形式)。 @@ -1942,7 +2045,7 @@ getActiveNotifications(): Promise\\> | 以Promise形式返回获取当前应用通知列表。 | +| Promise\\> | 以Promise形式返回获取当前应用通知列表。 | **错误码:** @@ -1950,6 +2053,7 @@ getActiveNotifications(): Promise\): void | 参数名 | 类型 | 必填 | 说明 | | --------- | --------------------- | ---- | ---------------------------- | -| groupName | string | 是 | 通知组名称,此名称需要在发布通知时通过[NotificationRequest](#notificationrequest)对象指定。 | +| groupName | string | 是 | 通知组名称,此名称需要在发布通知时通过[NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest)对象指定。 | | callback | AsyncCallback\ | 是 | 取消本应用指定组下通知的回调函数。 | **错误码:** @@ -1983,6 +2087,7 @@ cancelGroup(groupName: string, callback: AsyncCallback\): void | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -2023,6 +2128,7 @@ cancelGroup(groupName: string): Promise\ | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -2052,7 +2158,7 @@ removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCall | 参数名 | 类型 | 必填 | 说明 | | --------- | --------------------- | ---- | ---------------------------- | -| bundle | [BundleOption](#bundleoption) | 是 | 应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 应用的包信息。 | | groupName | string | 是 | 通知组名称。 | | callback | AsyncCallback\ | 是 | 删除指定应用指定组下通知的回调函数。 | @@ -2062,6 +2168,9 @@ removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCall | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -2100,7 +2209,7 @@ removeGroupByBundle(bundle: BundleOption, groupName: string): Promise\ | 参数名 | 类型 | 必填 | 说明 | | --------- | ------------ | ---- | -------------- | -| bundle | [BundleOption](#bundleoption) | 是 | 应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 应用的包信息。 | | groupName | string | 是 | 通知组名称。 | **错误码:** @@ -2109,6 +2218,9 @@ removeGroupByBundle(bundle: BundleOption, groupName: string): Promise\ | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -2149,9 +2261,13 @@ setDoNotDisturbDate(date: DoNotDisturbDate, callback: AsyncCallback\): vo | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | +| 1600012 | No memory space. | **示例:** @@ -2197,9 +2313,13 @@ setDoNotDisturbDate(date: DoNotDisturbDate): Promise\ | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | +| 1600012 | No memory space. | **示例:** @@ -2241,10 +2361,14 @@ setDoNotDisturbDate(date: DoNotDisturbDate, userId: number, callback: AsyncCallb | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | | 1600008 | The user is not exist. | +| 1600012 | No memory space. | **示例:** @@ -2293,10 +2417,14 @@ setDoNotDisturbDate(date: DoNotDisturbDate, userId: number): Promise\ | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | | 1600008 | The user is not exist. | +| 1600012 | No memory space. | **示例:** @@ -2339,9 +2467,13 @@ getDoNotDisturbDate(callback: AsyncCallback\): void | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | +| 1600012 | No memory space. | **示例:** @@ -2381,9 +2513,13 @@ getDoNotDisturbDate(): Promise\ | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | +| 1600012 | No memory space. | **示例:** @@ -2419,10 +2555,14 @@ getDoNotDisturbDate(userId: number, callback: AsyncCallback\) | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | | 1600008 | The user is not exist. | +| 1600012 | No memory space. | **示例:** @@ -2470,10 +2610,14 @@ getDoNotDisturbDate(userId: number): Promise\ | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | | 1600008 | The user is not exist. | +| 1600012 | No memory space. | **示例:** @@ -2508,6 +2652,9 @@ notificationManager.getDoNotDisturbDate(userId).then((data) => { | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -2550,6 +2697,9 @@ isSupportDoNotDisturbMode(): Promise\ | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -2583,6 +2733,7 @@ isSupportTemplate(templateName: string, callback: AsyncCallback\): voi | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -2629,6 +2780,7 @@ isSupportTemplate(templateName: string): Promise\ | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -2664,6 +2816,7 @@ requestEnableNotification(callback: AsyncCallback\): void | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -2696,6 +2849,7 @@ requestEnableNotification(): Promise\ | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -2735,6 +2889,9 @@ setDistributedEnable(enable: boolean, callback: AsyncCallback\): void | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -2743,7 +2900,7 @@ setDistributedEnable(enable: boolean, callback: AsyncCallback\): void **示例:** ```javascript -function setDistributedEnableCallback() { +function setDistributedEnableCallback(err) { if (err) { console.error(`setDistributedEnable failed, code is ${err.code}, message is ${err.message}`); } else { @@ -2780,6 +2937,9 @@ setDistributedEnable(enable: boolean): Promise\ | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -2816,6 +2976,7 @@ isDistributedEnabled(callback: AsyncCallback\): void | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -2857,6 +3018,7 @@ isDistributedEnabled(): Promise\ | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -2888,7 +3050,7 @@ setDistributedEnableByBundle(bundle: BundleOption, enable: boolean, callback: As | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------ | ---- | -------------------------- | -| bundle | [BundleOption](#bundleoption) | 是 | 应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 应用的包信息。 | | enable | boolean | 是 | 是否支持。 | | callback | AsyncCallback\ | 是 | 应用程序是否支持分布式通知的回调函数。 | @@ -2898,6 +3060,9 @@ setDistributedEnableByBundle(bundle: BundleOption, enable: boolean, callback: As | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -2942,7 +3107,7 @@ setDistributedEnableByBundle(bundle: BundleOption, enable: boolean): Promise\ | 是 | 查询指定应用是否支持分布式通知的回调函数。 | **错误码:** @@ -2996,6 +3164,9 @@ isDistributedEnabledByBundle(bundle: BundleOption, callback: AsyncCallback\ | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------ | ---- | -------------------------- | -| bundle | [BundleOption](#bundleoption) | 是 | 应用的包。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 应用的包。 | **返回值:** @@ -3050,6 +3221,9 @@ isDistributedEnabledByBundle(bundle: BundleOption): Promise\ | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -3093,6 +3267,9 @@ getDeviceRemindType(callback: AsyncCallback\): void | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -3135,6 +3312,9 @@ getDeviceRemindType(): Promise\ | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -3164,7 +3344,7 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user | 参数名 | 类型 | 必填 | 说明 | | -------------------- | ------------------------------------------- | ---- | ---------------------------------------- | -| request | [NotificationRequest](#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 | +| request | [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 | | representativeBundle | string | 是 | 被代理应用的包名。 | | userId | number | 是 | 用户ID。 | | callback | AsyncCallback | 是 | 发布代理通知的回调方法。 | @@ -3175,6 +3355,9 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user | 错误码ID | 错误信息 | | -------- | ----------------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -3182,6 +3365,7 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user | 1600005 | Notification slot is not enabled. | | 1600008 | The user is not exist. | | 1600009 | Over max number notifications per second. | +| 1600012 | No memory space. | **示例:** @@ -3231,7 +3415,7 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user | 参数名 | 类型 | 必填 | 说明 | | -------------------- | ------------------------------------------- | ---- | --------------------------------------------- | -| request | [NotificationRequest](#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 | +| request | [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 | | representativeBundle | string | 是 | 被代理应用的包名。 | | userId | number | 是 | 用户ID。 | @@ -3241,6 +3425,9 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user | 错误码ID | 错误信息 | | -------- | ----------------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -3248,6 +3435,7 @@ publishAsBundle(request: NotificationRequest, representativeBundle: string, user | 1600005 | Notification slot is not enabled. | | 1600008 | The user is not exist. | | 1600009 | Over max number notifications per second. | +| 1600012 | No memory space. | **示例:** @@ -3303,6 +3491,9 @@ cancelAsBundle(id: number, representativeBundle: string, userId: number, callbac | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -3356,6 +3547,9 @@ cancelAsBundle(id: number, representativeBundle: string, userId: number): Promis | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -3391,7 +3585,7 @@ setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean, | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------- | ---- | ---------------------- | -| bundle | [BundleOption](#bundleoption) | 是 | 应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 应用的包信息。 | | type | [SlotType](#slottype) | 是 | 指定渠道类型。 | | enable | boolean | 是 | 使能状态。 | | callback | AsyncCallback\ | 是 | 设置渠道使能回调函数。 | @@ -3402,6 +3596,9 @@ setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean, | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -3442,7 +3639,7 @@ setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean) | 参数名 | 类型 | 必填 | 说明 | | ------ | ----------------------------- | ---- | -------------- | -| bundle | [BundleOption](#bundleoption) | 是 | 应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 应用的包信息。 | | type | [SlotType](#slottype) | 是 | 渠道类型。 | | enable | boolean | 是 | 使能状态。 | @@ -3452,6 +3649,9 @@ setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean) | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -3485,7 +3685,7 @@ isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncC | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------- | ---- | ---------------------- | -| bundle | [BundleOption](#bundleoption) | 是 | 应用的包信息。 | +| bundle | [BundleOption](./js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 应用的包信息。 | | type | [SlotType](#slottype) | 是 | 渠道类型。 | | callback | AsyncCallback\ | 是 | 获取渠道使能状态回调函数。 | @@ -3495,6 +3695,9 @@ isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncC | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -3534,7 +3737,7 @@ isNotificationSlotEnabled(bundle: BundleOption, type: SlotType): Promise\ | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -3809,16 +4027,6 @@ notificationManager.getSyncNotificationEnabledWithoutApp(userId).then((data) => | LEVEL_HIGH | 4 | 表示通知功能已启用,状态栏中显示通知图标,有横幅和提示音。 | -## BundleOption - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ------ | ------ |---- | --- | ------ | -| bundle | string | 是 | 是 | 应用的包信息。 | -| uid | number | 是 | 是 | 用户ID。 | - - ## SlotType **系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification @@ -3832,227 +4040,6 @@ notificationManager.getSyncNotificationEnabledWithoutApp(userId).then((data) => | OTHER_TYPES | 0xFFFF | 其他类型。 | -## NotificationActionButton - -描述通知中显示的操作按钮。 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| --------- | ----------------------------------------------- | --- | ---- | ------------------------- | -| title | string | 是 | 是 | 按钮标题。 | -| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | 是 | 是 | 点击按钮时触发的WantAgent。 | -| extras | { [key: string]: any } | 是 | 是 | 按钮扩展信息。 | -| userInput | [NotificationUserInput](#notificationuserinput) | 是 | 是 | 用户输入对象实例。 | - - -## NotificationBasicContent - -描述普通文本通知。 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| -------------- | ------ | ---- | ---- | ---------------------------------- | -| title | string | 是 | 是 | 通知标题。 | -| text | string | 是 | 是 | 通知内容。 | -| additionalText | string | 是 | 是 | 通知附加内容,是对通知内容的补充。 | - - -## NotificationLongTextContent - -描述长文本通知。 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| -------------- | ------ | ---- | --- | -------------------------------- | -| title | string | 是 | 是 | 通知标题。 | -| text | string | 是 | 是 | 通知内容。 | -| additionalText | string | 是 | 是 | 通知附加内容,是对通知内容的补充。 | -| longText | string | 是 | 是 | 通知的长文本。 | -| briefText | string | 是 | 是 | 通知概要内容,是对通知内容的总结。 | -| expandedTitle | string | 是 | 是 | 通知展开时的标题。 | - - -## NotificationMultiLineContent - -描述多行文本通知。 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| -------------- | --------------- | --- | --- | -------------------------------- | -| title | string | 是 | 是 | 通知标题。 | -| text | string | 是 | 是 | 通知内容。 | -| additionalText | string | 是 | 是 | 通知附加内容,是对通知内容的补充。 | -| briefText | string | 是 | 是 | 通知概要内容,是对通知内容的总结。 | -| longTitle | string | 是 | 是 | 通知展开时的标题。 | -| lines | Array\ | 是 | 是 | 通知的多行文本。 | - - -## NotificationPictureContent - -描述附有图片的通知。 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| -------------- | -------------- | ---- | --- | -------------------------------- | -| title | string | 是 | 是 | 通知标题。 | -| text | string | 是 | 是 | 通知内容。 | -| additionalText | string | 是 | 是 | 通知附加内容,是对通知内容的补充。 | -| briefText | string | 是 | 是 | 通知概要内容,是对通知内容的总结。 | -| expandedTitle | string | 是 | 是 | 通知展开时的标题。 | -| picture | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | 是 | 通知的图片内容。 | - - -## NotificationContent - -描述通知类型。 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ----------- | ------------------------------------------------------------ | ---- | --- | ------------------ | -| contentType | [ContentType](#contenttype) | 是 | 是 | 通知内容类型。 | -| normal | [NotificationBasicContent](#notificationbasiccontent) | 是 | 是 | 基本类型通知内容。 | -| longText | [NotificationLongTextContent](#notificationlongtextcontent) | 是 | 是 | 长文本类型通知内容。 | -| multiLine | [NotificationMultiLineContent](#notificationmultilinecontent) | 是 | 是 | 多行类型通知内容。 | -| picture | [NotificationPictureContent](#notificationpicturecontent) | 是 | 是 | 图片类型通知内容。 | - - -## NotificationFlagStatus - -描述通知标志状态。 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -**系统接口**:此接口为系统接口,三方应用不支持调用。 - -| 名称 | 值 | 说明 | -| -------------- | --- | --------------------------------- | -| TYPE_NONE | 0 | 默认标志。 | -| TYPE_OPEN | 1 | 通知标志打开。 | -| TYPE_CLOSE | 2 | 通知标志关闭。 | - - -## NotificationFlags - -描述通知标志的实例。 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ---------------- | ---------------------- | ---- | ---- | --------------------------------- | -| soundEnabled | [NotificationFlagStatus](#notificationflagstatus) | 是 | 否 | 是否启用声音提示。 | -| vibrationEnabled | [NotificationFlagStatus](#notificationflagstatus) | 是 | 否 | 是否启用振动提醒功能。 | - - -## NotificationRequest - -描述通知的请求。 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| --------------------- | --------------------------------------------- | ---- | --- | -------------------------- | -| content | [NotificationContent](#notificationcontent) | 是 | 是 | 通知内容。 | -| id | number | 是 | 是 | 通知ID。 | -| slotType | [SlotType](#slottype) | 是 | 是 | 通道类型。 | -| isOngoing | boolean | 是 | 是 | 是否进行时通知。 | -| isUnremovable | boolean | 是 | 是 | 是否可移除。 | -| deliveryTime | number | 是 | 是 | 通知发送时间。 | -| tapDismissed | boolean | 是 | 是 | 通知是否自动清除。 | -| autoDeletedTime | number | 是 | 是 | 自动清除的时间。 | -| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | 是 | 是 | WantAgent封装了应用的行为意图,点击通知时触发该行为。 | -| extraInfo | {[key: string]: any} | 是 | 是 | 扩展参数。 | -| color | number | 是 | 是 | 通知背景颜色。预留能力,暂未支持。 | -| colorEnabled | boolean | 是 | 是 | 通知背景颜色是否使能。预留能力,暂未支持。 | -| isAlertOnce | boolean | 是 | 是 | 设置是否仅有一次此通知提醒。 | -| isStopwatch | boolean | 是 | 是 | 是否显示已用时间。 | -| isCountDown | boolean | 是 | 是 | 是否显示倒计时时间。 | -| isFloatingIcon | boolean | 是 | 是 | 是否显示状态栏图标。 | -| label | string | 是 | 是 | 通知标签。 | -| badgeIconStyle | number | 是 | 是 | 通知角标类型。 | -| showDeliveryTime | boolean | 是 | 是 | 是否显示分发时间。 | -| actionButtons | Array\<[NotificationActionButton](#notificationactionbutton)\> | 是 | 是 | 通知按钮,最多三个按钮。 | -| smallIcon | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | 是 | 通知小图标。可选字段,大小不超过30KB。 | -| largeIcon | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | 是 | 通知大图标。可选字段,大小不超过30KB。 | -| creatorBundleName | string | 是 | 否 | 创建通知的包名。 | -| creatorUid | number | 是 | 否 | 创建通知的UID。 | -| creatorPid | number | 是 | 否 | 创建通知的PID。 | -| creatorUserId| number | 是 | 否 | 创建通知的UserId。 | -| hashCode | string | 是 | 否 | 通知唯一标识。 | -| classification | string | 是 | 是 | 通知分类。
**系统API**: 此接口为系统接口,三方应用不支持调用。 | -| groupName| string | 是 | 是 | 组通知名称。 | -| template | [NotificationTemplate](#notificationtemplate) | 是 | 是 | 通知模板。 | -| isRemoveAllowed | boolean | 是 | 否 | 通知是否能被移除。
**系统API**: 此接口为系统接口,三方应用不支持调用。 | -| source | number | 是 | 否 | 通知源。
**系统API**: 此接口为系统接口,三方应用不支持调用。 | -| distributedOption | [DistributedOptions](#distributedoptions) | 是 | 是 | 分布式通知的选项。 | -| deviceId | string | 是 | 否 | 通知源的deviceId。
**系统API**: 此接口为系统接口,三方应用不支持调用。 | -| notificationFlags | [NotificationFlags](#notificationflags) | 是 | 否 | 获取NotificationFlags。 | -| removalWantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | 是 | 是 | 当移除通知时,通知将被重定向到的WantAgent实例。 | -| badgeNumber | number | 是 | 是 | 应用程序图标上显示的通知数。 | - - -## DistributedOptions - -描述分布式选项。 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ---------------------- | -------------- | ---- | ---- | ---------------------------------- | -| isDistributed | boolean | 是 | 是 | 是否为分布式通知。 | -| supportDisplayDevices | Array\ | 是 | 是 | 可以同步通知到的设备列表。 | -| supportOperateDevices | Array\ | 是 | 是 | 可以打开通知的设备列表。 | -| remindType | number | 是 | 否 | 通知的提醒方式。
**系统API**: 此接口为系统接口,三方应用不支持调用。 | - - -## NotificationSlot - -描述通知槽 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| -------------------- | --------------------- | ---- | --- | ------------------------------------------ | -| type | [SlotType](#slottype) | 是 | 是 | 通道类型。 | -| level | number | 是 | 是 | 通知级别,不设置则根据通知渠道类型有默认值。 | -| desc | string | 是 | 是 | 通知渠道描述信息。 | -| badgeFlag | boolean | 是 | 是 | 是否显示角标。 | -| bypassDnd | boolean | 是 | 是 | 置是否在系统中绕过免打扰模式。 | -| lockscreenVisibility | number | 是 | 是 | 在锁定屏幕上显示通知的模式。 | -| vibrationEnabled | boolean | 是 | 是 | 是否可振动。 | -| sound | string | 是 | 是 | 通知提示音。 | -| lightEnabled | boolean | 是 | 是 | 是否闪灯。 | -| lightColor | number | 是 | 是 | 通知灯颜色。 | -| vibrationValues | Array\ | 是 | 是 | 通知振动样式。 | -| enabled9+ | boolean | 是 | 否 | 此通知插槽中的启停状态。 | - - -## NotificationTemplate - -通知模板。 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ---- | ---------------------- | ---- | ---- | ---------- | -| name | string | 是 | 是 | 模板名称。 | -| data | {[key:string]: Object} | 是 | 是 | 模板数据。 | - - -## NotificationUserInput - -保存用户输入的通知消息。 - -**系统能力**:SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| -------- | ------ | --- | ---- | ----------------------------- | -| inputKey | string | 是 | 是 | 用户输入时用于标识此输入的key。 | ## DeviceRemindType diff --git a/zh-cn/application-dev/reference/apis/js-apis-notificationSubscribe.md b/zh-cn/application-dev/reference/apis/js-apis-notificationSubscribe.md index 868c70f3f7828b5d55fba84f489b460be9cef06e..0d986594532e10b6a7e6070b0d7db089322fabd6 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-notificationSubscribe.md +++ b/zh-cn/application-dev/reference/apis/js-apis-notificationSubscribe.md @@ -30,8 +30,8 @@ subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, c | 参数名 | 类型 | 必填 | 说明 | | ---------- | ------------------------- | ---- | ---------------- | -| subscriber | [NotificationSubscriber](#notificationsubscriber) | 是 | 通知订阅对象。 | -| info | [NotificationSubscribeInfo](#notificationsubscribeinfo) | 是 | 通知订阅信息。 | +| subscriber | [NotificationSubscriber](js-apis-notification.md#notificationsubscriber) | 是 | 通知订阅对象。 | +| info | [NotificationSubscribeInfo](js-apis-notification.md#notificationsubscribeinfo) | 是 | 通知订阅信息。 | | callback | AsyncCallback\ | 是 | 订阅动作回调函数。 | **错误码:** @@ -40,9 +40,13 @@ subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, c | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | +| 1600012 | No memory space. | **示例:** @@ -83,7 +87,7 @@ subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\): | 参数名 | 类型 | 必填 | 说明 | | ---------- | ---------------------- | ---- | ---------------- | -| subscriber | [NotificationSubscriber](#notificationsubscriber) | 是 | 通知订阅对象。 | +| subscriber | [NotificationSubscriber](js-apis-notification.md#notificationsubscriber) | 是 | 通知订阅对象。 | | callback | AsyncCallback\ | 是 | 订阅动作回调函数。 | **错误码:** @@ -92,9 +96,13 @@ subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\): | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | +| 1600012 | No memory space. | **示例:** @@ -133,8 +141,8 @@ subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo): | 参数名 | 类型 | 必填 | 说明 | | ---------- | ------------------------- | ---- | ------------ | -| subscriber | [NotificationSubscriber](#notificationsubscriber) | 是 | 通知订阅对象。 | -| info | [NotificationSubscribeInfo](#notificationsubscribeinfo) | 否 | 通知订阅信息。 | +| subscriber | [NotificationSubscriber](js-apis-notification.md#notificationsubscriber) | 是 | 通知订阅对象。 | +| info | [NotificationSubscribeInfo](js-apis-notification.md#notificationsubscribeinfo) | 否 | 通知订阅信息。 | **错误码:** @@ -142,9 +150,13 @@ subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo): | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | +| 1600012 | No memory space. | **示例:** @@ -178,7 +190,7 @@ unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\) | 参数名 | 类型 | 必填 | 说明 | | ---------- | ---------------------- | ---- | -------------------- | -| subscriber | [NotificationSubscriber](#notificationsubscriber) | 是 | 通知订阅对象。 | +| subscriber | [NotificationSubscriber](js-apis-notification.md#notificationsubscriber) | 是 | 通知订阅对象。 | | callback | AsyncCallback\ | 是 | 取消订阅动作回调函数。 | **错误码:** @@ -187,6 +199,9 @@ unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\) | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -201,8 +216,8 @@ function unsubscribeCallback(err) { console.info("unsubscribe success"); } } -function onDisconnectCallback(data) { - console.info("Cancel callback: " + JSON.stringify(data)); +function onDisconnectCallback() { + console.info("subscribe disconnect"); } let subscriber = { onDisconnect: onDisconnectCallback @@ -226,7 +241,7 @@ unsubscribe(subscriber: NotificationSubscriber): Promise\ | 参数名 | 类型 | 必填 | 说明 | | ---------- | ---------------------- | ---- | ------------ | -| subscriber | [NotificationSubscriber](#notificationsubscriber) | 是 | 通知订阅对象。 | +| subscriber | [NotificationSubscriber](js-apis-notification.md#notificationsubscriber) | 是 | 通知订阅对象。 | **错误码:** @@ -234,6 +249,9 @@ unsubscribe(subscriber: NotificationSubscriber): Promise\ | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -241,8 +259,8 @@ unsubscribe(subscriber: NotificationSubscriber): Promise\ **示例:** ```js -function onDisconnectCallback(data) { - console.info("Cancel callback: " + JSON.stringify(data)); +function onDisconnectCallback() { + console.info("subscribe disconnect"); } let subscriber = { onDisconnect: onDisconnectCallback @@ -268,8 +286,8 @@ remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveRea | 参数名 | 类型 | 必填 | 说明 | | --------------- | ----------------------------------| ---- | -------------------- | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | -| notificationKey | [NotificationKey](#notificationkey) | 是 | 通知键值。 | +| bundle | [BundleOption](js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | +| notificationKey | [NotificationKey](js-apis-notification.md#notificationkey) | 是 | 通知键值。 | | reason | [RemoveReason](#removereason) | 是 | 通知删除原因。 | | callback | AsyncCallback\ | 是 | 删除指定通知回调函数。 | @@ -279,6 +297,9 @@ remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveRea | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -324,8 +345,8 @@ remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveRea | 参数名 | 类型 | 必填 | 说明 | | --------------- | --------------- | ---- | ---------- | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | -| notificationKey | [NotificationKey](#notificationkey) | 是 | 通知键值。 | +| bundle | [BundleOption](js-apis-inner-notification-notificationCommonDef.md#bundleoption) | 是 | 指定应用的包信息。 | +| notificationKey | [NotificationKey]((js-apis-notification.md#notificationkey)) | 是 | 通知键值。 | | reason | [RemoveReason](#removereason) | 是 | 通知删除原因。 | **错误码:** @@ -334,6 +355,9 @@ remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveRea | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -372,7 +396,7 @@ remove(hashCode: string, reason: RemoveReason, callback: AsyncCallback\): | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------- | ---- | -------------------- | -| hashCode | string | 是 | 通知唯一ID。可以通过[onConsume](#onconsume)回调的入参[SubscribeCallbackData](#subscribecallbackdata)获取其内部[NotificationRequest](#notificationrequest)对象中的hashCode。 | +| hashCode | string | 是 | 通知唯一ID。可以通过[onConsume](#onconsume)回调的入参[SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata)获取其内部[NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest)对象中的hashCode。 | | reason | [RemoveReason](#removereason) | 是 | 通知删除原因。 | | callback | AsyncCallback\ | 是 | 删除指定通知回调函数。 | @@ -382,6 +406,9 @@ remove(hashCode: string, reason: RemoveReason, callback: AsyncCallback\): | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -428,6 +455,9 @@ remove(hashCode: string, reason: RemoveReason): Promise\ | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -459,7 +489,7 @@ removeAll(bundle: BundleOption, callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------- | ---- | ---------------------------- | -| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 | +| bundle | [BundleOption]((js-apis-inner-notification-notificationCommonDef.md#bundleoption)) | 是 | 指定应用的包信息。 | | callback | AsyncCallback\ | 是 | 删除指定应用的所有通知回调函数。 | **错误码:** @@ -468,6 +498,9 @@ removeAll(bundle: BundleOption, callback: AsyncCallback\): void | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -513,6 +546,9 @@ removeAll(callback: AsyncCallback\): void | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -547,7 +583,7 @@ removeAll(bundle?: BundleOption): Promise\ | 参数名 | 类型 | 必填 | 说明 | | ------ | ------------ | ---- | ---------- | -| bundle | [BundleOption](#bundleoption) | 否 | 指定应用的包信息。 | +| bundle | [BundleOption]((js-apis-inner-notification-notificationCommonDef.md#bundleoption)) | 否 | 指定应用的包信息。 | **错误码:** @@ -555,6 +591,9 @@ removeAll(bundle?: BundleOption): Promise\ | 错误码ID | 错误信息 | | -------- | ---------------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -594,6 +633,9 @@ removeAll(userId: number, callback: AsyncCallback\): void | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -639,6 +681,9 @@ removeAll(userId: number): Promise\ | 错误码ID | 错误信息 | | -------- | ----------------------------------- | +| 201 | Permission denied. | +| 202 | Not system application to call the interface. | +| 401 | The parameter check failed. | | 1600001 | Internal error. | | 1600002 | Marshalling or unmarshalling error. | | 1600003 | Failed to connect service. | @@ -668,7 +713,7 @@ notificationSubscribe.removeAll(userId, removeAllCallback); ### onConsume -onConsume?: (data: [SubscribeCallbackData](#subscribecallbackdata)) => void +onConsume?: (data: [SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata)) => void 接收到新通知的回调函数。 @@ -680,7 +725,7 @@ onConsume?: (data: [SubscribeCallbackData](#subscribecallbackdata)) => void | 参数名 | 类型 | 必填 | 说明 | | ------------ | ------------------------ | ---- | -------------------------- | -| data | [SubscribeCallbackData](#subscribecallbackdata) | 是 | 新接收到的通知信息。 | +| data | [SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata) | 是 | 新接收到的通知信息。 | **示例:** @@ -708,7 +753,7 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback); ### onCancel -onCancel?:(data: [SubscribeCallbackData](#subscribecallbackdata)) => void +onCancel?:(data: [SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata)) => void 取消通知的回调函数。 @@ -720,7 +765,7 @@ onCancel?:(data: [SubscribeCallbackData](#subscribecallbackdata)) => void | 参数名 | 类型 | 必填 | 说明 | | ------------ | ------------------------ | ---- | -------------------------- | -| data | [SubscribeCallbackData](#subscribecallbackdata) | 是 | 需要取消的通知信息。 | +| data | [SubscribeCallbackData](js-apis-notification.md#subscribecallbackdata) | 是 | 需要取消的通知信息。 | **示例:** @@ -748,7 +793,7 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback); ### onUpdate -onUpdate?:(data: [NotificationSortingMap](#notificationsortingmap)) => void +onUpdate?:(data: [NotificationSortingMap](js-apis-notification.md#notificationsortingmap)) => void 更新通知排序的回调函数。 @@ -760,7 +805,7 @@ onUpdate?:(data: [NotificationSortingMap](#notificationsortingmap)) => void | 参数名 | 类型 | 必填 | 说明 | | ------------ | ------------------------ | ---- | -------------------------- | -| data | [NotificationSortingMap](#notificationsortingmap) | 是 | 最新的通知排序列表。 | +| data | [NotificationSortingMap](js-apis-notification.md#notificationsortingmap)) | 是 | 最新的通知排序列表。 | **示例:** @@ -935,7 +980,7 @@ notificationSubscribe.subscribe(subscriber, subscribeCallback); ### onEnabledNotificationChanged -onEnabledNotificationChanged?:(callbackData: [EnabledNotificationCallbackData](#enablednotificationcallbackdata)) => void +onEnabledNotificationChanged?:(callbackData: [EnabledNotificationCallbackData](js-apis-notification.md#enablednotificationcallbackdata)) => void 监听应用通知使能变化。 @@ -947,7 +992,7 @@ onEnabledNotificationChanged?:(callbackData: [EnabledNotificationCallbackData](# | 参数名 | 类型 | 必填 | 说明 | | ------------ | ------------------------ | ---- | -------------------------- | -| callback | AsyncCallback\<[EnabledNotificationCallbackData](#enablednotificationcallbackdata)\> | 是 | 回调返回监听到的应用信息。 | +| callback | AsyncCallback\<[EnabledNotificationCallbackData](js-apis-notification.md#enablednotificationcallbackdata)\> | 是 | 回调返回监听到的应用信息。 | **示例:** @@ -1013,104 +1058,6 @@ let subscriber = { notificationSubscribe.subscribe(subscriber, subscribeCallback); ``` -## BundleOption - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ------ | ------ |---- | --- | ------ | -| bundle | string | 是 | 是 | 应用的包信息。 | -| uid | number | 是 | 是 | 用户ID。 | - -## NotificationKey - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ----- | ------ | ---- | --- | -------- | -| id | number | 是 | 是 | 通知ID。 | -| label | string | 是 | 是 | 通知标签。 | - -## SubscribeCallbackData - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -**系统API**:此接口为系统接口,三方应用不支持调用。 - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| --------------- | ------------------------------------------------- | -------- | -------- | -------- | -| request | [NotificationRequest](js-apis-notificationManager.md#notificationrequest) | 是 | 否 | 通知内容。 | -| sortingMap | [NotificationSortingMap](#notificationsortingmap) | 是 | 否 | 排序信息。 | -| reason | number | 是 | 否 | 删除原因。 | -| sound | string | 是 | 否 | 通知声音。 | -| vibrationValues | Array\ | 是 | 否 | 通知震动。 | - - -## EnabledNotificationCallbackData - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -**系统API**:此接口为系统接口,三方应用不支持调用。 - -| 名称 | 类型 | 可读 | 可写 | 描述 | -| ------ | ------- | ---------------- | ---------------- | ---------------- | -| bundle | string | 是 | 否 | 应用的包名。 | -| uid | number | 是 | 否 | 应用的uid。 | -| enable | boolean | 是 | 否 | 应用通知使能状态。 | - - -## NotificationSorting - -提供有关活动通知的排序信息。 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -**系统API**: 此接口为系统接口,三方应用不支持调用。 - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| -------- | ------------------------------------- | ---- | --- | ------------ | -| slot | [NotificationSlot](js-apis-notificationManager.md#notificationslot) | 是 | 否 | 通知通道内容。 | -| hashCode | string | 是 | 否 | 通知唯一标识。 | -| ranking | number | 是 | 否 | 通知排序序号。 | - - -## NotificationSortingMap - -提供关于已订阅的所有通知中活动通知的排序信息 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -**系统API**:此接口为系统接口,三方应用不支持调用。 - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| -------------- | ------------------------------------------------------------ | ---- | --- | ---------------- | -| sortings | {[key: string]: [NotificationSorting](#notificationsorting)} | 是 | 否 | 通知排序信息数组。 | -| sortedHashCode | Array\ | 是 | 否 | 通知唯一标识数组。 | - - -## NotificationSubscribeInfo - -设置订阅所需通知的发布者的信息。 - -**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification - -**系统API**: 此接口为系统接口,三方应用不支持调用。 - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| ----------- | --------------- | --- | ---- | ------------------------------- | -| bundleNames | Array\ | 是 | 是 | 指定订阅哪些包名的APP发来的通知。 | -| userId | number | 是 | 是 | 指定订阅哪个用户下发来的通知。 | - - -## NotificationUserInput - -保存用户输入的通知消息。 - -**系统能力**:SystemCapability.Notification.Notification - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| -------- | ------ | --- | ---- | ----------------------------- | -| inputKey | string | 是 | 是 | 用户输入时用于标识此输入的key。 | ## RemoveReason diff --git a/zh-cn/application-dev/reference/apis/js-apis-observer.md b/zh-cn/application-dev/reference/apis/js-apis-observer.md index f3d1b051fc1eab8f70b8af83f950ae70427582ec..5ca4f0376b6386f9458a5cc38bfa17cc143b7f49 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-observer.md +++ b/zh-cn/application-dev/reference/apis/js-apis-observer.md @@ -10,7 +10,7 @@ ## 导入模块 ``` -import observer from '@ohos.telephony.observer' +import observer from '@ohos.telephony.observer'; ``` ## observer.on('networkStateChange') @@ -25,13 +25,15 @@ on\(type: \'networkStateChange\', callback: Callback\): void; **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ | -| type | string | 是 | 网络状态变化事件 | -| callback | Callback\<[NetworkState](js-apis-radio.md#networkstate)\> | 是 | 回调函数。参考radio的[NetworkState](js-apis-radio.md#networkstate) | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------------------------- | ---- | ---------------------------------------------------------------- | +| type | string | 是 | 网络状态变化事件,参数固定为'networkStateChange'。 | +| callback | Callback\<[NetworkState](js-apis-radio.md#networkstate)\> | 是 | 回调函数。参考radio的[NetworkState](js-apis-radio.md#networkstate)| **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -44,7 +46,7 @@ on\(type: \'networkStateChange\', callback: Callback\): void; **示例:** ```js -observer.on('networkStateChange', data =>{ +observer.on('networkStateChange', data => { console.log("on networkStateChange, data:" + JSON.stringify(data)); }); ``` @@ -62,14 +64,16 @@ on\(type: \'networkStateChange\', options: { slotId: number }, callback: Callbac **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | -------------------------------------- | -| type | string | 是 | 网络状态变化事件 | -| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------------------------- | ---- | ---------------------------------------------------------------- | +| type | string | 是 | 网络状态变化事件,参数固定为'networkStateChange'。 | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | | callback | Callback\<[NetworkState](js-apis-radio.md#networkstate)\> | 是 | 回调函数。参考radio的[NetworkState](js-apis-radio.md#networkstate) | **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -82,7 +86,7 @@ on\(type: \'networkStateChange\', options: { slotId: number }, callback: Callbac **示例:** ```js -observer.on('networkStateChange', {slotId: 0}, data =>{ +observer.on('networkStateChange', {slotId: 0}, data => { console.log("on networkStateChange, data:" + JSON.stringify(data)); }); ``` @@ -104,7 +108,7 @@ off\(type: \'networkStateChange\', callback?: Callback\): void; | 参数名 | 类型 | 必填 | 说明 | | -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ | -| type | string | 是 | 网络状态变化事件 | +| type | string | 是 | 网络状态变化事件,参数固定为'networkStateChange'。 | | callback | Callback\<[NetworkState](js-apis-radio.md#networkstate)\> | 否 | 回调函数。参考radio的[NetworkState](js-apis-radio.md#networkstate) | | 错误码ID | 错误信息 | @@ -138,12 +142,14 @@ on\(type: \'signalInfoChange\', callback: Callback\>): **参数:** | 参数名 | 类型 | 必填 | 说明 | -| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | 是 | 信号状态变化事件 | +| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | +| type | string | 是 | 信号状态变化事件,参数固定为'signalInfoChange'。 | | callback | Callback\> | 是 | 回调函数。参考radio的[SignalInformation](js-apis-radio.md#signalinformation) | **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -156,7 +162,7 @@ on\(type: \'signalInfoChange\', callback: Callback\>): **示例:** ```js -observer.on('signalInfoChange', data =>{ +observer.on('signalInfoChange', data => { console.log("on signalInfoChange, data:" + JSON.stringify(data)); }); ``` @@ -172,14 +178,16 @@ on\(type: \'signalInfoChange\', options: { slotId: number }, callback: Callback< **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | -------------------------------------- | -| type | string | 是 | 信号状态变化事件 | -| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | +| type | string | 是 | 信号状态变化事件,参数固定为'signalInfoChange'。 | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | | callback | Callback\> | 是 | 回调函数。参考radio的[SignalInformation](js-apis-radio.md#signalinformation) | **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -192,7 +200,7 @@ on\(type: \'signalInfoChange\', options: { slotId: number }, callback: Callback< **示例:** ```js -observer.on('signalInfoChange', {slotId: 0}, data =>{ +observer.on('signalInfoChange', {slotId: 0}, data => { console.log("on signalInfoChange, data:" + JSON.stringify(data)); }); ``` @@ -214,11 +222,13 @@ off\(type: \'signalInfoChange\', callback?: Callback\> | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | 是 | 信号状态变化事件 | +| type | string | 是 | 信号状态变化事件,参数固定为'signalInfoChange'。 | | callback | Callback\> | 否 | 回调函数。参考radio的[SignalInformation](js-apis-radio.md#signalinformation) | **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -239,6 +249,125 @@ observer.off('signalInfoChange', callback); observer.off('signalInfoChange'); ``` +## observer.on('cellInfoChange')8+ + +on\(type: \'cellInfoChange\', callback: Callback\): void; + +订阅小区信息变化事件,使用callback方式作为异步方法。 + +**系统接口:** 此接口为系统接口。 + +**需要权限**:ohos.permission.LOCATION 和 ohos.permission.APPROXIMATELY_LOCATION + +**系统能力**:SystemCapability.Telephony.StateRegistry + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------------------------- | ---- |------------------------------------------------------------| +| type | string | 是 | 小区信息变化事件,固定为'cellInfoChange'。 | +| callback | Callback\<[CellInformation](js-apis-radio.md#cellinformation8)\> | 是 | 回调函数。| + +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + +**示例:** + +```js +observer.on('cellInfoChange', data => { + console.log("on cellInfoChange, data:" + JSON.stringify(data)); +}); +``` + + +## observer.on('cellInfoChange')8+ + +on\(type: \'cellInfoChange\', options: { slotId: number }, callback: Callback\): void; + +订阅指定卡槽位的小区信息变化事件,使用callback方式作为异步方法。 + +**系统接口:** 此接口为系统接口。 + +**需要权限**:ohos.permission.LOCATION 和 ohos.permission.APPROXIMATELY_LOCATION + +**系统能力**:SystemCapability.Telephony.StateRegistry + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ |--------------------------------------------------| ---- |------------------------------------------------------------| +| type | string | 是 | 小区信息变化事件,固定为'cellInfoChange'。 | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| callback | Callback\<[CellInformation](js-apis-radio.md#cellinformation8)\> | 是 | 回调函数。| + +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + +**示例:** + +```js +observer.on('cellInfoChange', {slotId: 0}, data => { + console.log("on cellInfoChange, data:" + JSON.stringify(data)); +}); +``` + + +## observer.off('cellInfoChange')8+ + +off\(type: \'cellInfoChange\', callback?: Callback\): void; + +取消订阅小区信息变化事件,使用callback方式作为异步方法。 + +>**说明:** +> +>可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 + +**系统接口:** 此接口为系统接口。 + +**系统能力**:SystemCapability.Telephony.StateRegistry + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ | +| type | string | 是 | 小区信息变化事件,固定为'cellInfoChange'。 | +| callback | Callback\<[CellInformation](js-apis-radio.md#cellinformation8)\> | 否 | 回调函数。| + +| 错误码ID | 错误信息 | +| -------- | -------------------------------------------- | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + +**示例:** + +```js +let callback = data => { + console.log("on cellInfoChange, data:" + JSON.stringify(data)); +} +observer.on('cellInfoChange', callback); +// 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 +observer.off('cellInfoChange', callback); +observer.off('cellInfoChange'); +``` ## observer.on('callStateChange') @@ -251,12 +380,14 @@ on(type: 'callStateChange', callback: Callback\<{ state: CallState, number: stri **参数:** | 参数名 | 类型 | 必填 | 说明 | -| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | 是 | 通话状态变化事件 | +| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | +| type | string | 是 | 通话状态变化事件,参数固定为'callStateChange'。 | | callback | Callback\<{ state: [CallState](js-apis-call.md#callstate), number: string }\> | 是 | 回调函数,参考call的[CallState](js-apis-call.md#callstate)
number:电话号码 | **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -268,7 +399,7 @@ on(type: 'callStateChange', callback: Callback\<{ state: CallState, number: stri **示例:** ```js -observer.on('callStateChange', value =>{ +observer.on('callStateChange', value => { console.log("on callStateChange, state:" + value.state + ", number:" + value.number); }); ``` @@ -285,13 +416,15 @@ on(type: 'callStateChange', options: { slotId: number }, callback: Callback<{ st **参数:** | 参数名 | 类型 | 必填 | 说明 | -| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | 是 | 通话状态变化事件 | +| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | +| type | string | 是 | 通话状态变化事件,参数固定为'callStateChange'。 | | slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | | callback | Callback\<{ state: [CallState](js-apis-call.md#callstate), number: string }\> | 是 | 回调函数,参考call的[CallState](js-apis-call.md#callstate)
number:电话号码 | **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -303,7 +436,7 @@ on(type: 'callStateChange', options: { slotId: number }, callback: Callback<{ st **示例:** ```js -observer.on('callStateChange', {slotId: 0}, value =>{ +observer.on('callStateChange', {slotId: 0}, value => { console.log("on callStateChange, state:" + value.state + ", number:" + value.number); }); ``` @@ -324,12 +457,14 @@ off(type: 'callStateChange', callback?: Callback<{ state: CallState, number: str **参数:** | 参数名 | 类型 | 必填 | 说明 | -| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | 是 | 通话状态变化事件 | +| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | +| type | string | 是 | 通话状态变化事件,参数固定为'callStateChange'。 | | callback | Callback\<{ state: [CallState](js-apis-call.md#callstate), number: string }\> | 否 | 回调函数,参考call的[CallState](js-apis-call.md#callstate)
number:电话号码 | **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -363,11 +498,13 @@ on\(type: 'cellularDataConnectionStateChange', callback: Callback\<{ state: Data | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | 是 | 蜂窝数据链路连接状态事件 | +| type | string | 是 | 蜂窝数据链路连接状态事件,参数固定为'cellularDataConnectionStateChange'。| | callback | Callback\<{ state: [DataConnectState](js-apis-telephony-data.md#dataconnectstate), network: [RatType](js-apis-radio.md#radiotechnology) }\> | 是 | 回调函数,参考data的[DataConnectState](js-apis-telephony-data.md#dataconnectstate),radio的[RadioTechnology](js-apis-radio.md#radiotechnology)。 | **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -379,7 +516,7 @@ on\(type: 'cellularDataConnectionStateChange', callback: Callback\<{ state: Data **示例:** ```js -observer.on('cellularDataConnectionStateChange', value =>{ +observer.on('cellularDataConnectionStateChange', value => { console.log("on cellularDataConnectionStateChange, state:" + value.state + ", network:" + value.network); }); ``` @@ -397,12 +534,14 @@ on\(type: 'cellularDataConnectionStateChange', options: { slotId: number }, call | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | 是 | 蜂窝数据链路连接状态事件 | +| type | string | 是 | 蜂窝数据链路连接状态事件,参数固定为'cellularDataConnectionStateChange'。| | slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | | callback | Callback\<{ state: [DataConnectState](js-apis-telephony-data.md#dataconnectstate), network: [RatType](js-apis-radio.md#radiotechnology) }\> | 是 | 回调函数,参考data的[DataConnectState](js-apis-telephony-data.md#dataconnectstate),radio的[RadioTechnology](js-apis-radio.md#radiotechnology)。 | **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -414,7 +553,7 @@ on\(type: 'cellularDataConnectionStateChange', options: { slotId: number }, call **示例:** ```js -observer.on('cellularDataConnectionStateChange', {slotId: 0}, value =>{ +observer.on('cellularDataConnectionStateChange', {slotId: 0}, value => { console.log("on cellularDataConnectionStateChange, state:" + value.state + ", network:" + value.network); }); ``` @@ -436,11 +575,13 @@ off\(type: 'cellularDataConnectionStateChange', callback?: Callback\<{ state: D | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | 是 | 蜂窝数据链路连接状态事件 | +| type | string | 是 | 蜂窝数据链路连接状态事件,参数固定为'cellularDataConnectionStateChange'。| | callback | Callback\<{ state: [DataConnectState](js-apis-telephony-data.md#dataconnectstate), network: [RatType](js-apis-radio.md#radiotechnology) }\> | 否 | 回调函数,参考data的[DataConnectState](js-apis-telephony-data.md#dataconnectstate),radio的[RadioTechnology](js-apis-radio.md#radiotechnology)。 | **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -474,11 +615,13 @@ on\(type: 'cellularDataFlowChange', callback: Callback\\): void; | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | 是 | 蜂窝数据业务的上下行数据流状态状态事件 | +| type | string | 是 | 蜂窝数据业务的上下行数据流状态状态事件,参数固定为'cellularDataFlowChange'。 | | callback | Callback\<[DataFlowType](js-apis-telephony-data.md#dataflowtype)\> | 是 | 回调函数,参考data的[DataFlowType](js-apis-telephony-data.md#dataflowtype)。 | **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -490,7 +633,7 @@ on\(type: 'cellularDataFlowChange', callback: Callback\\): void; **示例:** ```js -observer.on('cellularDataFlowChange', data =>{ +observer.on('cellularDataFlowChange', data => { console.log("on networkStateChange, data:" + JSON.stringify(data)); }); ``` @@ -508,12 +651,14 @@ on\(type: 'cellularDataFlowChange', options: { slotId: number }, callback: Call | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | 是 | 蜂窝数据业务的上下行数据流状态事件 | -| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | +| type | string | 是 | 蜂窝数据业务的上下行数据流状态状态事件,参数固定为'cellularDataFlowChange'。 | +| slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | | callback | Callback\<[DataFlowType](js-apis-telephony-data.md#dataflowtype)\> | 是 | 回调函数,参考data的[DataFlowType](js-apis-telephony-data.md#dataflowtype)。 | **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -525,7 +670,7 @@ on\(type: 'cellularDataFlowChange', options: { slotId: number }, callback: Call **示例:** ```js -observer.on('cellularDataFlowChange', {slotId: 0}, data =>{ +observer.on('cellularDataFlowChange', {slotId: 0}, data => { console.log("on cellularDataFlowChange, data:" + JSON.stringify(data)); }); ``` @@ -545,13 +690,15 @@ off\(type: 'cellularDataFlowChange', callback?: Callback\\): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | 是 | 蜂窝数据业务的上下行数据流状态事件 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| type | string | 是 | 蜂窝数据业务的上下行数据流状态状态事件,参数固定为'cellularDataFlowChange'。 | | callback | Callback\<[DataFlowType](js-apis-telephony-data.md#dataflowtype)\> | 否 | 回调函数,参考data的[DataFlowType](js-apis-telephony-data.md#dataflowtype)。 | **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -584,12 +731,14 @@ on\(type: 'simStateChange', callback: Callback\\): void; **参数:** | 参数名 | 类型 | 必填 | 说明 | -| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | 是 | sim状态更改事件 | +| -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | +| type | string | 是 | sim状态更改事件,参数固定为'simStateChange'。 | | callback | Callback\<[SimStateData](#simstatedata7)\> | 是 | 回调函数。 | **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -601,7 +750,7 @@ on\(type: 'simStateChange', callback: Callback\\): void; **示例:** ```js -observer.on('simStateChange', data =>{ +observer.on('simStateChange', data => { console.log("on simStateChange, data:" + JSON.stringify(data)); }); ``` @@ -619,12 +768,14 @@ on\(type: 'simStateChange', options: { slotId: number }, callback: Callback\- 0:卡槽1
- 1:卡槽2 | | callback | Callback\<[SimStateData](#simstatedata7)\> | 是 | 回调函数。 | **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -636,7 +787,7 @@ on\(type: 'simStateChange', options: { slotId: number }, callback: Callback\{ +observer.on('simStateChange', {slotId: 0}, data => { console.log("on simStateChange, data:" + JSON.stringify(data)); }); ``` @@ -658,11 +809,13 @@ off\(type: 'simStateChange', callback?: Callback\\): void; | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| type | string | 是 | sim状态更改事件 | +| type | string | 是 | sim状态更改事件,参数固定为'simStateChange'。 | | callback | Callback\<[SimStateData](#simstatedata7)\> | 否 | 回调函数。 | **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -688,7 +841,7 @@ observer.off('simStateChange'); SIM卡锁类型。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.StateRegistry。 +**系统能力**:SystemCapability.Telephony.StateRegistry | 名称 | 值 | 说明 | | ----------- | ---- | ----------------- | @@ -711,11 +864,10 @@ SIM卡锁类型。 SIM卡类型和状态。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.StateRegistry。 +**系统能力**:SystemCapability.Telephony.StateRegistry | 名称 | 类型 | 必填 | 说明 | | ------------------- | ----------------------------------- | ---- | -------------------------------------------------------- | -| type | [CardType](js-apis-sim.md#cardtype) | 是 | SIM卡类型,参考sim的[CardType](js-apis-sim.md#cardtype)。 | -| state | [SimState](js-apis-sim.md#simstate) | 是 | SIM卡状态,参考sim的[SimState](js-apis-sim.md#simstate)。 | +| type | [CardType](js-apis-sim.md#cardtype7) | 是 | SIM卡类型。 | +| state | [SimState](js-apis-sim.md#simstate) | 是 | SIM卡状态。 | | reason8+ | [LockReason](#lockreason8) | 是 | SIM卡锁类型。 | - 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 e2a3d4ccd66b3feb6572fcb77ffdad6a390cea9f..f1b0cd323a58af7b79795ccad728bceefd9d88df 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-osAccount.md +++ b/zh-cn/application-dev/reference/apis/js-apis-osAccount.md @@ -327,7 +327,7 @@ checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: A | 错误码ID | 错误信息 | | -------- | ------------------- | | 12300001 | System service exception. | -| 12300002 | Invalid localId. | +| 12300002 | Invalid localId or constraint. | | 12300003 | Account not found. | **示例:** 判断ID为100的系统帐号是否有禁止使用Wi-Fi的约束 @@ -377,7 +377,7 @@ checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise< | 错误码ID | 错误信息 | | -------- | ------------------- | | 12300001 | System service exception. | -| 12300002 | Invalid localId. | +| 12300002 | Invalid localId or constraint. | | 12300003 | Account not found. | **示例:** 判断ID为100的系统帐号是否有禁止使用Wi-Fi的约束 @@ -475,8 +475,6 @@ checkOsAccountVerified(callback: AsyncCallback<boolean>): void 检查当前系统帐号是否已验证。使用callback异步回调。 -**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS 或 ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS - **系统能力:** SystemCapability.Account.OsAccount **参数:** @@ -490,8 +488,6 @@ checkOsAccountVerified(callback: AsyncCallback<boolean>): void | 错误码ID | 错误信息 | | -------- | ------------------- | | 12300001 | System service exception. | -| 12300002 | Invalid localId. | -| 12300003 | Account not found. | **示例:** @@ -555,7 +551,7 @@ checkOsAccountVerified(localId: number, callback: AsyncCallback<boolean>): ### checkOsAccountVerified9+ -checkOsAccountVerified(localId?: number): Promise<boolean> +checkOsAccountVerified(localId: number): Promise<boolean> 检查指定系统帐号是否已验证。使用Promise异步回调。 @@ -567,7 +563,7 @@ checkOsAccountVerified(localId?: number): Promise<boolean> | 参数名 | 类型 | 必填 | 说明 | | ------- | ------ | ---- | --------------------------------------------------------------- | -| localId | number | 否 | 系统帐号ID。不填则检查当前系统帐号是否已验证。 | +| localId | number | 是 | 系统帐号ID。不填则检查当前系统帐号是否已验证。 | **返回值:** @@ -724,7 +720,7 @@ setOsAccountConstraints(localId: number, constraints: Array<string>, enabl | 错误码ID | 错误信息 | | -------- | ------------------- | | 12300001 | System service exception. | -| 12300002 | Invalid localId. | +| 12300002 | Invalid localId or constraints. | | 12300003 | Account not found. | | 12300008 | Restricted Account. | @@ -778,7 +774,7 @@ setOsAccountConstraints(localId: number, constraints: Array<string>, enabl | 错误码ID | 错误信息 | | -------- | ------------------- | | 12300001 | System service exception. | -| 12300002 | Invalid localId. | +| 12300002 | Invalid localId or constraints. | | 12300003 | Account not found. | | 12300008 | Restricted Account. | @@ -1862,7 +1858,7 @@ queryOsAccountById(localId: number): Promise<OsAccountInfo> | 错误码ID | 错误信息 | | -------- | ------------------- | | 12300001 | System service exception. | -| 12300002 | Invalid localId. | +| 12300002 | Invalid localId. | | 12300003 | Account not found. | **示例:** 查询ID为100的系统帐号信息 @@ -2235,7 +2231,7 @@ getOsAccountLocalIdForSerialNumber(serialNumber: number, callback: AsyncCallback | -------- | ------------------- | | 12300001 | System service exception. | | 12300002 | Invalid serialNumber. | -| 12300003 | Account not found. | +| 12300003 | The account indicated by serialNumber dose not exist. | **示例:** 查询与SN码12345关联的系统帐号的ID @@ -2278,7 +2274,7 @@ getOsAccountLocalIdForSerialNumber(serialNumber: number): Promise<number> | -------- | ------------------- | | 12300001 | System service exception. | | 12300002 | Invalid serialNumber. | -| 12300003 | Account not found. | +| 12300003 | The account indicated by serialNumber dose not exist. | **示例:** 查询与SN码12345关联的系统帐号的ID @@ -2404,7 +2400,6 @@ on(type: 'activate' | 'activating', name: string, callback: Callback<number&g | -------- | ------------- | | 12300001 | System service exception. | | 12300002 | Invalid type or name. | -| 12300011 | Callback has been registered. | **示例:** @@ -2437,7 +2432,7 @@ off(type: 'activate' | 'activating', name: string, callback?: Callback<number | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------------- | ---- | ------------------------------------------------------------ | | type | 'activate' \| 'activating' | 是 | 取消订阅类型,activate表示取消订阅帐号已激活完成的事件,activating取消订阅帐号正在激活的事件。 | -| name | string | 是 | 订阅名称,可自定义,,要求非空且长度不超过1024字节,需要与订阅接口传入的值保持一致。 | +| name | string | 是 | 订阅名称,可自定义,要求非空且长度不超过1024字节,需要与订阅接口传入的值保持一致。 | | callback | Callback<number> | 否 | 取消订阅系统帐号激活完成与激活中的事件回调,默认返回0。 | **错误码:** @@ -2446,7 +2441,6 @@ off(type: 'activate' | 'activating', name: string, callback?: Callback<number | -------- | ------------- | | 12300001 | System service exception. | | 12300002 | Invalid type or name. | -| 12300012 | Callback has not been registered. | **示例:** @@ -2645,7 +2639,7 @@ getOsAccountConstraintSourceTypes(localId: number, constraint: string, callback: | 错误码ID | 错误信息 | | -------- | ------------- | | 12300001 | System service exception. | -| 12300002 | Invalid localId or constraint. | +| 12300002 | Invalid name or constraint. | | 12300003 | Account not found. | **示例:** @@ -2692,7 +2686,7 @@ getOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise& | 错误码ID | 错误信息 | | -------- | ------------- | | 12300001 | System service exception. | -| 12300002 | Invalid localId or constraint. | +| 12300002 | Invalid name or constraint. | | 12300003 | Account not found. | **示例:** @@ -4117,9 +4111,9 @@ auth(challenge: Uint8Array, authType: AuthType, authTrustLevel: AuthTrustLevel, | 12300101 | Credential is incorrect. | | 12300105 | Unsupported authTrustLevel. | | 12300106 | Unsupported authType. | -| 12300110 | Authentication locked. | +| 12300110 | Authentication is locked. | | 12300111 | Authentication timeout. | -| 12300112 | Authentication service busy. | +| 12300112 | Authentication service is busy. | **示例:** ```js @@ -4176,9 +4170,9 @@ authUser(userId: number, challenge: Uint8Array, authType: AuthType, authTrustLev | 12300101 | Credential is incorrect. | | 12300105 | Unsupported authTrustLevel. | | 12300106 | Unsupported authType. | -| 12300110 | Authentication locked. | +| 12300110 | Authentication is locked. | | 12300111 | Authentication timeout. | -| 12300112 | Authentication service busy. | +| 12300112 | Authentication service is busy. | **示例:** ```js @@ -4286,7 +4280,7 @@ registerInputer(inputer: IInputer): void; | 错误码ID | 错误信息 | | -------- | --------------------------- | | 12300001 | System service exception. | -| 12300102 | Invalid inputer. | +| 12300002 | Invalid inputer. | | 12300103 | Inputer already registered. | **示例:** @@ -4351,7 +4345,7 @@ static registerInputer(authType: AuthType, inputer: IInputer): void | 错误码ID | 错误信息 | | -------- | --------------------------- | | 12300001 | System service exception. | -| 12300102 | Invalid authType or inputer. | +| 12300002 | Invalid authType or inputer. | | 12300103 | The credential inputer has been registered. | | 12300106 | Unsupported authType. | @@ -4433,15 +4427,28 @@ auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUs **示例:** ```js let plugin = { - auth: (domainInfo, credential, callback) => { + auth: (domainAccountInfo, credential, callback) => { // mock authentication - callback.onResult(0, {}); - } + // notify authentication result + callback.onResult(0, { + token: new Uint8Array([0]), + remainTimes: 5, + freezingTime: 0 + }); + }, + authWithPopup: (domainAccountInfo, callback) => {}, + authWithToken: (domainAccountInfo, callback) => {}, + getAccountInfo: (domain, accountName, callback) => {}, + getAuthStatusInfo: (domainAccountInfo, callback) => {}, + bindAccount: (domainAccountInfo, localId, callback) => {}, + unbindAccount: (domainAccountInfo, callback) => {}, + isAccountTokenValid: (domainAccountInfo, callback) => {}, + getAccessToken: (options, callback) => {} } account_osAccount.DomainAccountManager.registerPlugin(plugin); let userAuth = new account_osAccount.UserAuth(); let challenge = new Uint8Array([0]); - let authType = account_osAccount.AuthType.PIN; + let authType = account_osAccount.AuthType.DOMAIN; let authTrustLevel = account_osAccount.AuthTrustLevel.ATL1; try { userAuth.auth(challenge, authType, authTrustLevel, { @@ -4455,6 +4462,323 @@ auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUs } ``` +### authWithPopup10+ + +authWithPopup(domainAccountInfo: DomainAccountInfo, callback: IUserAuthCallback): void + +弹窗认证指定的域帐号。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** SystemCapability.Account.OsAccount + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | --------------------------------------- | ---- | --------------- | +| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | 是 | 指示域帐号信息。| +| callback | [IUserAuthCallback](#iuserauthcallback8) | 是 | 指示认证结果回调。| + +**示例:** + ```js + let plugin = { + auth: (domainAccountInfo, credential, callback) => {}, + authWithPopup: (domainAccountInfo, callback) => { + // mock authentication + // notify authentication result + callback.onResult(0, { + token: new Uint8Array([0]), + remainTimes: 5, + freezingTime: 0 + }); + }, + authWithToken: (domainAccountInfo, callback) => {}, + getAccountInfo: (domain, accountName, callback) => {}, + getAuthStatusInfo: (domainAccountInfo, callback) => {}, + bindAccount: (domainAccountInfo, localId, callback) => {}, + unbindAccount: (domainAccountInfo, callback) => {}, + isAccountTokenValid: (domainAccountInfo, callback) => {}, + getAccessToken: (options, callback) => {} + } + account_osAccount.DomainAccountManager.registerPlugin(plugin) + ``` + +### authWithToken10+ + +authWithToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array, callback: IUserAuthCallback): void + +使用授权令牌认证指定的域帐号。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** SystemCapability.Account.OsAccount + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | --------------------------------------- | ---- | --------------- | +| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | 是 | 指示域帐号信息。| +| token | Uint8Array | 是 | 指示PIN码或生物识别认证成功时生成的授权令牌。| +| callback | [IUserAuthCallback](#iuserauthcallback8) | 是 | 指示认证结果回调。| + +**示例:** + ```js + let plugin = { + auth: (domainAccountInfo, credential, callback) => {}, + authWithPopup: (domainAccountInfo, callback) => {}, + authWithToken: (domainAccountInfo, callback) => { + // mock authentication + // notify authentication result + callback.onResult(0, { + token: new Uint8Array([0]), + remainTimes: 5, + freezingTime: 0 + }); + }, + getAccountInfo: (domain, accountName, callback) => {}, + getAuthStatusInfo: (domainAccountInfo, callback) => {}, + bindAccount: (domainAccountInfo, localId, callback) => {}, + unbindAccount: (domainAccountInfo, callback) => {}, + isAccountTokenValid: (domainAccountInfo, callback) => {}, + getAccessToken: (options, callback) => {} + } + account_osAccount.DomainAccountManager.registerPlugin(plugin) + ``` + +### getAccountInfo10+ + +getAccountInfo(domain: string, accountName: string, callback: AsyncCallback<DomainAccountInfo>): void + +查询指定域帐号的信息。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** SystemCapability.Account.OsAccount + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | --------------------------------------- | ---- | --------------- | +| domain | string | 是 | 指示帐号所属域。| +| accountName | string | 是 | 指示帐号的名称。| +| callback | AsyncCallback<[DomainAccountInfo](#domainaccountinfo8)> | 是 | 指示查询结果回调。| + +**示例:** + ```js + let plugin = { + auth: (domainAccountInfo, credential, callback) => {}, + authWithPopup: (domainAccountInfo, callback) => {}, + authWithToken: (domainAccountInfo, callback) => {}, + getAccountInfo: (domain, accountName, callback) => { + // mock getting account information + // notify result + callback({ + code: 0 + }, { + domain: domain, + accountName: accountName, + accountId: "xxxx" + }) + }, + getAuthStatusInfo: (domainAccountInfo, callback) => {}, + bindAccount: (domainAccountInfo, localId, callback) => {}, + unbindAccount: (domainAccountInfo, callback) => {}, + isAccountTokenValid: (domainAccountInfo, callback) => {}, + getAccessToken: (options, callback) => {} + } + account_osAccount.DomainAccountManager.registerPlugin(plugin) + ``` + +### getAuthStatusInfo10+ + +getAuthStatusInfo(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback<AuthStatusInfo>): void + +查询指定域帐号的认证状态信息。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** SystemCapability.Account.OsAccount + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | --------------------------------------- | ---- | --------------- | +| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | 是 | 指示域帐号信息。| +| callback | AsyncCallback<[AuthStatusInfo](#authstatusinfo10)> | 是 | 指示查询结果回调。| + +**示例:** + ```js + let plugin = { + auth: (domainAccountInfo, credential, callback) => {}, + authWithPopup: (domainAccountInfo, callback) => {}, + authWithToken: (domainAccountInfo, callback) => {}, + getAccountInfo: (domain, accountName, callback) => {}, + getAuthStatusInfo: (domainAccountInfo, callback) => { + callback({ + code: 0 + }, { + remainTimes: 5, + freezingTime: 0 + }) + }, + bindAccount: (domainAccountInfo, localId, callback) => {}, + unbindAccount: (domainAccountInfo, callback) => {}, + isAccountTokenValid: (domainAccountInfo, callback) => {}, + getAccessToken: (options, callback) => {} + } + account_osAccount.DomainAccountManager.registerPlugin(plugin) + ``` + +### bindAccount10+ + +bindAccount(domainAccountInfo: DomainAccountInfo, localId: number, callback: AsyncCallback<void>): void + +绑定指定的域帐号。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** SystemCapability.Account.OsAccount + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | --------------------------------------- | ---- | --------------- | +| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | 是 | 指示域帐号信息。| +| callback | AsyncCallback<void> | 是 | 指示绑定结果回调。| + +**示例:** + ```js + let plugin = { + auth: (domainAccountInfo, credential, callback) => {}, + authWithPopup: (domainAccountInfo, callback) => {}, + authWithToken: (domainAccountInfo, callback) => {}, + getAccountInfo: (domain, accountName, callback) => {}, + getAuthStatusInfo: (domainAccountInfo, callback) => {}, + bindAccount: (domainAccountInfo, localId, callback) => { + // mock unbinding operation + // notify binding result + callback({code: 0}) + }, + unbindAccount: (domainAccountInfo, callback) => {}, + isAccountTokenValid: (domainAccountInfo, callback) => {}, + getAccessToken: (options, callback) => {} + } + account_osAccount.DomainAccountManager.registerPlugin(plugin) + ``` + +### unbindAccount10+ + +unbindAccount(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback<void>): void + +解绑指定的域帐号。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** SystemCapability.Account.OsAccount + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | --------------------------------------- | ---- | --------------- | +| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | 是 | 指示域帐号信息。| +| callback | AsyncCallback<void> | 是 | 指示绑定结果回调。| + +**示例:** + ```js + let plugin = { + auth: (domainAccountInfo, credential, callback) => {}, + authWithPopup: (domainAccountInfo, callback) => {}, + authWithToken: (domainAccountInfo, callback) => {}, + getAccountInfo: (domain, accountName, callback) => {}, + getAuthStatusInfo: (domainAccountInfo, callback) => {}, + bindAccount: (domainAccountInfo, localId, callback) => {}, + unbindAccount: (domainAccountInfo, callback) => { + // mock unbinding operation + // notify unbinding result + callback({code: 0}) + }, + isAccountTokenValid: (domainAccountInfo, callback) => {}, + getAccessToken: (options, callback) => {} + } + account_osAccount.DomainAccountManager.registerPlugin(plugin) + ``` + +### isAccountTokenValid10+ + +isAccountTokenValid(domainAccountInfo: DomainAccountInfo, token: Uint8Array, callback: AsyncCallback<boolean>): void + +检查指定的域帐号令牌是否有效。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** SystemCapability.Account.OsAccount + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | --------------------------------------- | ---- | --------------- | +| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | 是 | 指示域帐号信息。| +| token | Uint8Array | 是 | 指示域帐号令牌。 | +| callback | AsyncCallback<boolean> | 是 | 指示检查结果回调。| + +**示例:** + ```js + let plugin = { + auth: (domainAccountInfo, credential, callback) => {}, + authWithPopup: (domainAccountInfo, callback) => {}, + authWithToken: (domainAccountInfo, callback) => {}, + getAccountInfo: (domain, accountName, callback) => {}, + getAuthStatusInfo: (domainAccountInfo, callback) => {}, + bindAccount: (domainAccountInfo, localId, callback) => {}, + unbindAccount: (domainAccountInfo, callback) => {}, + isAccountTokenValid: (domainAccountInfo, callback) => { + // mock checking operation + // notify checking result + callback({code: 0}, true); + }, + getAccessToken: (options, callback) => {} + } + account_osAccount.DomainAccountManager.registerPlugin(plugin) + ``` + +### getAccessToken10+ + +getAccessToken(options: GetDomainAccessTokenOptions, callback: AsyncCallback<Uint8Array>): void + +根据指定的选项获取域访问令牌。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** SystemCapability.Account.OsAccount + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | --------------------------------------- | ---- | --------------- | +| options | [GetDomainAccessTokenOptions](#getdomainaccesstokenoptions10) | 是 | 指示获取域访问令牌的选项。| +| callback | AsyncCallback<Uint8Array> | 是 | 指示结果回调。| + +**示例:** + ```js + let plugin = { + auth: (domainAccountInfo, credential, callback) => {}, + authWithPopup: (domainAccountInfo, callback) => {}, + authWithToken: (domainAccountInfo, callback) => {}, + getAccountInfo: (domain, accountName, callback) => {}, + getAuthStatusInfo: (domainAccountInfo, callback) => {}, + bindAccount: (domainAccountInfo, localId, callback) => {}, + unbindAccount: (domainAccountInfo, callback) => {}, + isAccountTokenValid: (domainAccountInfo, callback) => {}, + getAccessToken: (options, callback) => { + // mock getting operation + let token = new Uint8Array([0]); + // notify result + callback({code: 0}, token); + } + } + account_osAccount.DomainAccountManager.registerPlugin(plugin) + ``` + ## DomainAccountManager 9+ 域帐号管理器类。 @@ -4485,10 +4809,13 @@ static registerPlugin(plugin: DomainPlugin): void **示例:** ```js let plugin = { - auth: (domainInfo, credential, callback) => { - // mock authentication - callback.onResult(0, {}); - } + auth: (domainAccountInfo, credential, callback) => {}, + authWithPopup: (domainAccountInfo, callback) => {}, + authWithToken: (domainAccountInfo, callback) => {}, + getAccountInfo: (domain, accountName, callback) => {}, + getAuthStatusInfo: (domainAccountInfo, callback) => {}, + bindAccount: (domainAccountInfo, localId, callback) => {}, + unbindAccount: (domainAccountInfo, callback) => {} } try { account_osAccount.DomainAccountManager.registerPlugin(plugin); @@ -4520,6 +4847,353 @@ static unregisterPlugin(): void } ``` +### auth10+ + +auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUserAuthCallback): void + +认证指定的域帐号。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** SystemCapability.Account.OsAccount + +**需要权限:** ohos.permission.ACCESS_USER_AUTH_INTERNAL + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | --------------------------------------- | ---- | --------------- | +| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | 是 | 指示域帐号信息。| +| credential | Uint8Array | 是 | 指示域帐号的凭据。| +| callback | [IUserAuthCallback](#iuserauthcallback8) | 是 | 指示认证结果回调。| + +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | --------------------------- | +| 12300001 | System service exception. | +| 12300002 | Invalid domainAccountInfo or credential. | +| 12300003 | Domain account does not exist. | +| 12300013 | Network exception. | +| 12300101 | Authentication failed. | +| 12300109 | Authentication is canceled. | +| 12300110 | Authentication is locked. | +| 12300111 | Authentication timeout. | +| 12300112 | Authentication service is busy. | +| 12300113 | Authentication service does not exist. | +| 12300114 | Authentication service exception. | + +**示例:** + ```js + let domainAccountInfo = { + domain: "CHINA", + accountName: "zhangsan" + } + let credential = new Uint8Array([0]) + try { + account_osAccount.DomainAccountManager.auth(domainAccountInfo, credential, { + onResult: (resultCode, authResult) => { + console.log('auth resultCode = ' + resultCode); + console.log('auth authResult = ' + JSON.stringify(authResult)); + } + }); + } catch (err) { + console.log('auth exception = ' + JSON.stringify(err)); + } + ``` + +### authWithPopup10+ + +authWithPopup(callback: IUserAuthCallback): void + +弹框认证指定的域帐号。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** SystemCapability.Account.OsAccount + +**需要权限:** ohos.permission.ACCESS_USER_AUTH_INTERNAL + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | --------------------------------------- | ---- | --------------- | +| callback | [IUserAuthCallback](#iuserauthcallback8) | 是 | 指示认证结果回调。| + +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | --------------------------- | +| 12300001 | System service exception. | +| 12300003 | No domain account is bound. | +| 12300013 | Network exception. | +| 12300101 | Authentication failed. | +| 12300109 | Authentication is canceled. | +| 12300110 | Authentication is locked. | +| 12300111 | Authentication timeout. | +| 12300112 | Authentication service is busy. | +| 12300113 | Authentication service does not exist. | +| 12300114 | Authentication service exception. | + +**示例:** + ```js + try { + account_osAccount.DomainAccountManager.authWithPopup({ + onResult: (resultCode, authResult) => { + console.log('auth resultCode = ' + resultCode); + console.log('auth authResult = ' + JSON.stringify(authResult)); + } + }) + } catch (err) { + console.log('auth exception = ' + JSON.stringify(err)); + } + ``` + +### authWithPopup10+ + +authWithPopup(localId: number, callback: IUserAuthCallback): void + +弹框认证指定的域帐号。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** SystemCapability.Account.OsAccount + +**需要权限:** ohos.permission.ACCESS_USER_AUTH_INTERNAL + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | --------------------------------------- | ---- | --------------- | +| localId | number | 是 | 指示绑定域帐号的系统帐号的本地标识。| +| callback | [IUserAuthCallback](#iuserauthcallback8) | 是 | 指示认证结果回调。| + +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | --------------------------- | +| 12300001 | System service exception. | +| 12300002 | Invalid localId. | +| 12300003 | No domain account is bound. | +| 12300013 | Network exception. | +| 12300101 | Authentication failed. | +| 12300109 | Authentication is canceled. | +| 12300110 | Authentication is locked. | +| 12300111 | Authentication timeout. | +| 12300112 | Authentication service is busy. | +| 12300113 | Authentication service does not exist. | +| 12300114 | Authentication service exception. | + +**示例:** + ```js + try { + account_osAccount.DomainAccountManager.authWithPopup(100, { + onResult: (resultCode, authResult) => { + console.log('authWithPopup resultCode = ' + resultCode); + console.log('authWithPopup authResult = ' + JSON.stringify(authResult)); + } + }) + } catch (err) { + console.log('authWithPopup exception = ' + JSON.stringify(err)); + } + ``` + +### hasAccount10+ + +hasAccount(domainAccountInfo: DomainAccountInfo, callback: AsyncCallback<boolean>): void + +检查是否存在指定的域帐号。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** SystemCapability.Account.OsAccount + +**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | --------------------------------------- | ---- | --------------- | +| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | 是 | 指示域帐号信息。| +| callback | AsyncCallback<boolean> | 是 | 指示检查结果回调。| + +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | --------------------------- | +| 12300001 | System service exception. | +| 12300002 | Invalid domainAccountInfo. | +| 12300013 | Network exception. | + +**示例:** + ```js + let domainAccountInfo = { + domain: "CHINA", + accountName: "zhangsan" + } + try { + account_osAccount.DomainAccountManager.hasAccount(domainAccountInfo, (err, result) => { + if (err) { + console.log("call hasAccount failed, error: " + JSON.stringify(err)); + } else { + console.log("hasAccount result: " + result); + } + }); + } catch (err) { + console.log('hasAccount exception = ' + JSON.stringify(err)); + } + ``` + +### hasAccount10+ + +hasAccount(domainAccountInfo: DomainAccountInfo): Promise<boolean> + +检查是否存在指定的域帐号。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** SystemCapability.Account.OsAccount + +**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | --------------------------------------- | ---- | --------------- | +| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | 是 | 指示域帐号信息。| + +**返回值:** + +| 类型 | 说明 | +| :------------------------ | ----------------------- | +| Promise<boolean> | Promise对象,返回指定的域帐号是否存在。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | --------------------------- | +| 12300001 | System service exception. | +| 12300002 | Invalid domainAccountInfo. | +| 12300013 | Network exception. | + +**示例:** + ```js + let domainAccountInfo = { + domain: "CHINA", + accountName: "zhangsan" + } + try { + account_osAccount.DomainAccountManager.hasAccount(domainAccountInfo).then((result) => { + console.log("hasAccount result: " + result); + }).catch((err) => { + console.log("call hasAccount failed, error: " + JSON.stringify(err)); + }); + } catch (err) { + console.log('hasAccount exception = ' + JSON.stringify(err)); + } + ``` + +### updateAccountToken10+ + +updateAccountToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array, callback: AsyncCallback<void>): void; + +更新指定域帐号的令牌,空令牌表示目标域帐号的令牌失效。使用callback异步回调。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** SystemCapability.Account.OsAccount + +**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | --------------------------------------- | ---- | --------------- | +| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | 是 | 指示域帐号信息。| +| token | Uint8Array | 是 | 指示域帐号的令牌。| +| callback | AsyncCallback<void> | 是 | 回调函数。如果更新成功,err为null,否则为错误对象。| + +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | --------------------------- | +| 12300001 | System service exception. | +| 12300002 | Invalid token. | +| 12300003 | Account not found. | + +**示例:** + ```js + let domainAccountInfo = { + domain: "CHINA", + accountName: "zhangsan", + accountId: "123456" + } + let token = new Uint8Array([0]) + try { + account_osAccount.DomainAccountManager.updateAccountToken(domainAccountInfo, token, (err) => { + if (err != null) { + console.log("updateAccountToken failed, error: " + JSON.stringify(err)); + } else { + console.log("updateAccountToken successfully"); + } + }) + } catch (err) { + console.log('updateAccountToken exception = ' + JSON.stringify(err)); + } + ``` + +### updateAccountToken10+ + +updateAccountToken(domainAccountInfo: DomainAccountInfo, token: Uint8Array): Promise<void> + +更新指定域帐号的令牌,空令牌表示目标域帐号的令牌失效。使用Promise异步回调。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** SystemCapability.Account.OsAccount + +**需要权限:** ohos.permission.MANAGE_LOCAL_ACCOUNTS + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | --------------------------------------- | ---- | --------------- | +| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | 是 | 指示域帐号信息。| +| token | Uint8Array | 是 | 指示域帐号的令牌。| + +**返回值:** + +| 类型 | 说明 | +| :------------------------ | ----------------------- | +| Promise<void> | Promise对象,无返回结果的Promise对象。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | --------------------------- | +| 12300001 | System service exception. | +| 12300002 | Invalid token. | +| 12300003 | Account not found. | + +**示例:** + ```js + let domainAccountInfo = { + domain: "CHINA", + accountName: "zhangsan", + accountId: "123456" + } + let token = new Uint8Array([0]) + try { + account_osAccount.DomainAccountManager.updateAccountToken(domainAccountInfo, token).then(() => { + console.log("updateAccountToken successfully"); + }).catch((err) => { + console.log("updateAccountToken failed, error: " + JSON.stringify(err)); + }); + } catch (err) { + console.log('updateAccountToken exception = ' + JSON.stringify(err)); + } + ``` + ## UserIdentityManager8+ 获取用户身份管理类。 @@ -4904,7 +5578,6 @@ getAuthInfo(callback: AsyncCallback<Array<EnrolledCredInfo>>): void; | 错误码ID | 错误信息 | | -------- | --------------------- | | 12300001 | System service exception. | -| 12300102 | Credential not found. | **示例:** ```js @@ -4944,7 +5617,6 @@ getAuthInfo(authType: AuthType, callback: AsyncCallback<Array<EnrolledCred | -------- | ------------------- | | 12300001 | System service exception. | | 12300002 | Invalid authType. | -| 12300102 | Credential not found. | **示例:** ```js @@ -4989,7 +5661,6 @@ getAuthInfo(authType?: AuthType): Promise<Array<EnrolledCredInfo>>; | -------- | ------------------- | | 12300001 | System service exception. | | 12300002 | Invalid authType. | -| 12300102 | Credential not found. | **示例:** ```js @@ -5028,6 +5699,12 @@ onSetData: (authSubType: AuthSubType, data: Uint8Array) => void; | authSubType | [AuthSubType](#authsubtype8) | 是 | 用于认证的凭据子类型。 | | data | Uint8Array | 是 | 要设置的数据是凭据,用来在认证、添加、修改凭据操作。 | +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------- | +| 12300002 | Invalid pinSubType. | + **示例:** ```js let password = new Uint8Array([0, 0, 0, 0, 0, 0]); @@ -5254,7 +5931,7 @@ onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void; | ------------ | ---------------------------------------- | ----- | ----------------- | | result | number | 是 | 指示结果。 | | authSubType | [AuthSubType](#authsubtype8) | 是 | 指示认证凭据子类型。| -| remainTimes | number | 否 | 指示剩余时间。 | +| remainTimes | number | 否 | 指示剩余次数。 | | freezingTime | number | 否 | 指示冻结时间。 | ## AuthResult8+ @@ -5268,7 +5945,7 @@ onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void; | 名称 | 类型 | 必填 | 说明 | | ------------ | ----------- | ----- | ----------------- | | token | Uint8Array | 否 | 指示认证令牌。 | -| remainTimes | number | 否 | 指示剩余时间。 | +| remainTimes | number | 否 | 指示剩余次数。 | | freezingTime | number | 否 | 指示冻结时间。 | ## CredentialInfo8+ @@ -5351,7 +6028,7 @@ onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void; | PIN | 1 | 表示PIN认证类型。 | | FACE | 2 | 表示脸部认证类型。| | FINGERPRINT10+ | 4 | 表示指纹认证类型。 | -| DOMAIN10+ | 1024 | 表示域认证类型。| +| DOMAIN9+ | 1024 | 表示域认证类型。| ## AuthSubType8+ @@ -5368,7 +6045,7 @@ onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void; | PIN_MIXED | 10002 | 表示自定义混合凭据。 | | FACE_2D | 20000 | 表示2D 人脸凭证。 | | FACE_3D | 20001 | 表示3D 人脸凭证。 | -| DOMAIN_MIXED10+ | 10240001 | 表示域认证混合凭证。 | +| DOMAIN_MIXED9+ | 10240001 | 表示域认证混合凭证。 | ## AuthTrustLevel8+ @@ -5470,7 +6147,7 @@ onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void; | localName | string | 是 | 系统帐号名称。 | | type | [OsAccountType](#osaccounttype) | 是 | 系统帐号类型 | | constraints | Array<string> | 否 | 系统帐号[约束](#系统帐号约束列表) | -| isVerified8+ | boolean | 是 | 帐号是否锁屏 | +| isVerified8+ | boolean | 是 | 帐号是否验证 | | photo8+ | string | 否 | 系统帐号头像 | | createTime8+ | number | 是 | 系统帐号创建时间 | | lastLoginTime8+ | number | 否 | 系统帐号最后一次登录时间 | @@ -5490,6 +6167,7 @@ onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void; | ----------- | ------ | ---- | ---------- | | domain | string | 是 | 域名。 | | accountName | string | 是 | 域帐号名。 | +| accountId10+ | string | 否 | 域帐号标识。
**系统接口:** 此接口为系统接口。 | ## 系统帐号约束列表 @@ -5585,4 +6263,32 @@ onAcquireInfo?: (module: number, acquire: number, extraInfo: any) => void; | CONSTRAINT_NOT_EXIST | 0 | 约束不存在 | | CONSTRAINT_TYPE_BASE | 1 | 约束源自系统设置 | | CONSTRAINT_TYPE_DEVICE_OWNER | 2 | 约束源自设备所有者设置 | -| CONSTRAINT_TYPE_PROFILE_OWNER | 3 | 约束源自资料所有者设置 | \ No newline at end of file +| CONSTRAINT_TYPE_PROFILE_OWNER | 3 | 约束源自资料所有者设置 | + +## AuthStatusInfo10+ + +表示认证状态信息。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.OsAccount。 + +| 名称 | 类型 | 必填 | 说明 | +| ----------- | ------ | ---- | ---------- | +| remainTimes | number | 是 | 剩余次数 | +| freezingTime | number | 是 | 冻结时间 | + +## GetDomainAccessTokenOptions10+ + +表示获取域访问令牌的选项。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** 以下各项对应的系统能力均为SystemCapability.Account.OsAccount。 + +| 名称 | 类型 | 必填 | 说明 | +| ----------- | ------ | ---- | ---------- | +| domainAccountInfo | [DomainAccountInfo](#domainaccountinfo8) | 是 | 域帐号的信息 | +| domainAccountToken | Uint8Array | 是 | 域帐号的令牌 | +| businessParams | { [key: string]: object } | 是 | 业务参数,由业务方根据请求协议自定义 | +| callerUid | number | 是 | 调用方唯一标识符 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-overlay.md b/zh-cn/application-dev/reference/apis/js-apis-overlay.md new file mode 100755 index 0000000000000000000000000000000000000000..23b52e190a2ddb18d912fb9f93584e919d20cc47 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-overlay.md @@ -0,0 +1,693 @@ +# @ohos.bundle.overlay (overlay模块) + +本模块提供[overlay特征应用](#overlay特征应用介绍)的安装,overlay特征应用的[OverlayModuleInfo](js-apis-bundleManager-overlayModuleInfo.md)信息的查询以及overlay特征应用的禁用使能的能力。 + +> **说明:** +> +> 本模块首批接口从API version 10开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + +## 导入模块 + +``` ts +import overlay from '@ohos.bundle.overlay' +``` + +## overlay.setOverlayEnabled + +setOverlayEnabled(moduleName:string, isEnabled: boolean): Promise\; + +以异步方法设置当前应用中overlay特征module的禁用使能状态。使用Promise异步回调。成功返回null,失败返回对应错误信息。 + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Overlay + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ------ | ---- | --------------------------------------- | +| moduleName | string | 是 | overlay特征module的HAP名称。 | +| isEnabled | boolean | 是 | 值为true表示使能,值为false表示禁用。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------- | ------------------ | +| Promise\ | Promise对象。无返回结果的Promise对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| ------ | -------------------------------------- | +| 17700002 | The specified module name is not found. | +| 17700033 | The specified module is not an overlay module. | + +**示例:** + +```ts +var moduleName = "feature"; +var isEnabled = false; + +try { + overlay.setOverlayEnabled(moduleName, isEnabled) + .then(() => { + console.info('setOverlayEnabled success'); + }).catch((error) => { + console.info('setOverlayEnabled failed due to error code: ' + err.code + ' ' + 'message:' + err.message); + }); +} catch (error) { + console.info('setOverlayEnabled failed due to error code: ' + err.code + ' ' + 'message:' + err.message); +} +``` + +## overlay.setOverlayEnabled + +setOverlayEnabled(moduleName:string, isEnabled: boolean, callback: AsyncCallback\): void; + +以异步方法设置当前应用中overlay module的禁用使能状态。使用callback异步回调。成功返回null,失败返回对应错误信息。 + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Overlay + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ------ | ---- | --------------------------------------- | +| moduleName | string | 是 | overlay特征module的HAP名称。 | +| isEnabled | boolean | 是 | 值为true表示使能,值为false表示禁用。| +| callback | AsyncCallback\ | 是 | 回调函数,当设置指定module的overlay禁用使能状态成功时,err为undefined,否则为错误对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| ------ | -------------------------------------- | +| 17700002 | The specified module name is not found. | +| 17700033 | The specified module is not an overlay module. | + +**示例:** + +```ts +var moduleName = "feature"; +var isEnabled = false; + +try { + overlay.setOverlayEnabled(moduleName, isEnabled, (error, data) => { + if (error) { + console.info('setOverlayEnabled failed due to error code: ' + err.code + ' ' + 'message:' + err.message); + return; + } + console.info('setOverlayEnabled success'); + }); +} catch (error) { + console.info('setOverlayEnabled failed due to error code: ' + err.code + ' ' + 'message:' + err.message); +} +``` + +## overlay.setOverlayEnabledByBundleName + +setOverlayEnabledByBundleName(bundleName:string, moduleName:string, isEnabled: boolean): Promise\; + +以异步方法设置指定应用的overlay module的禁用使能状态。使用Promise异步回调,成功返回应用的处置状态,失败返回对应错误信息。 + +**需要权限:** ohos.permission.CHANGE_OVERLAY_ENABLED_STATE + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Overlay + +**系统API:** 此接口为系统接口。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ------ | ---- | --------------------------------------- | +| bundleName | string | 是 | 指定应用的bundle名称。 | +| moduleName | string | 是 | 指定应用的overlay module的HAP名称。 | +| isEnabled | boolean | 是 | 值为true表示使能,值为false表示禁用。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------- | ------------------ | +| Promise\ | Promise对象。无返回结果的Promise对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| ------ | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700002 | The specified module name is not found. | +| 17700032 | The specified bundle does not contain any overlay module. | +| 17700033 | The specified module is not an overlay module. | + +**示例:** + +```ts +var bundleName = "com.example.myapplication_xxxxx"; +var moduleName = "feature" +var isEnabled = false; + +try { + overlay.setOverlayEnabledByBundleName(bundleName, moduleName, isEnabled) + .then((data) => { + console.info('setOverlayEnabledByBundleName successfully'); + }).catch((error) => { + console.info('setOverlayEnabledByBundleName failed due to error code: ' + err.code + ' ' + 'message:' + err.message); + }); +} catch (error) { + console.info('setOverlayEnabledByBundleName failed due to error code: ' + err.code + ' ' + 'message:' + err.message); +} +``` + +## overlay.setOverlayEnabledByBundleName + +setOverlayEnabledByBundleName(bundleName:string, moduleName:string, isEnabled: boolean, callback: AsyncCallback\): void; + +以异步方法设置指定应用的overlay module的禁用使能状态。使用callback异步回调,成功返回应用的处置状态,失败返回对应错误信息。 + +**需要权限:** ohos.permission.CHANGE_OVERLAY_ENABLED_STATE + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Overlay + +**系统API:** 此接口为系统接口。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ------ | ---- | --------------------------------------- | +| bundleName | string | 是 | 指定应用的bundle名称。 | +| moduleName | string | 是 | 指定应用的overlay特征module的HAP名称。 | +| isEnabled | boolean | 是 | 值为true表示使能,值为false表示禁用。 | +| callback | AsyncCallback\ | 是 | 回调函数。当设置指定应用的overlay module的禁用使能状态成功时,err为undefined,data为获取到的处置状态;否则为错误对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| ------ | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700002 | The specified module name is not found. | +| 17700032 | The specified bundle does not contain any overlay module. | +| 17700033 | The specified module is not an overlay module. | + +**示例:** + +```ts +var bundleName = "com.example.myapplication_xxxxx"; +var moduleName = "feature" +var isEnabled = false; + +try { + overlay.setOverlayEnabledByBundleName(bundleName, moduleName, isEnabled, (error, data) => { + if (error) { + console.info('setOverlayEnabledByBundleName failed due to error code: ' + err.code + ' ' + 'message:' + err.message); + return; + } + console.info('setOverlayEnabledByBundleName successfully'); + }); +} catch (error) { + console.info('setOverlayEnabledByBundleName failed due to error code: ' + err.code + ' ' + 'message:' + err.message); +} +``` + +## overlay.getOverlayModuleInfo + +getOverlayModuleInfo(moduleName: string): Promise\; + +以异步方法获取当前应用中指定的module的overlayModuleInfo信息。使用promise异步回调,成功返回null,失败返回对应错误信息。 + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Overlay + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ------ | ---- | ------------------------------------------ | +| moduleName | string | 是 | 指定当前应用中的overlay module的HAP名称。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------- | ------------------ | +| Promise\ | Promise对象,返回OverlayModuleInfo| + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| ------ | -------------------------------------- | +| 17700002 | The specified module name is not found. | +| 17700032 | The specified bundle does not contain any overlay module. | +| 17700033 | The specified module is not an overlay module. | + +**示例:** + +```ts +var moduleName = "feature" + +(async() => { + try { + let overlayModuleInfo = await overlay.getOverlayModuleInfo(moduleName); + console.log('overlayModuleInfo is ' + JSON.stringify(overlayModuleInfo)); + } catch(err) { + console.log('getOverlayModuleInfo failed due to error code : ' + err.code + ' ' + 'message :' + err.message); + } +})(); +``` + +## overlay.getOverlayModuleInfo + +getOverlayModuleInfo(moduleName: string, callback: AsyncCallback\): void; + +以异步方法获取当前应用中指定的module的overlayModuleInfo信息。使用callback异步回调,成功返回null,失败返回对应错误信息。 + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Overlay + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ------ | ---- | --------------------------------------- | +| moduleName | string | 是 | 指定当前应用中的overlay特征module的HAP名称。 | +| callback | AsyncCallback\ | 是 | 回调函数,当获取当前应用中指定的module的overlayModuleInfo信息成功时,err返回undefined。否则回调函数返回具体错误对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| ------ | -------------------------------------- | +| 17700002 | The specified module name is not found. | +| 17700032 | he specified bundle does not contain any overlay module. | +| 17700033 | The specified module is not an overlay module. | + +**示例:** + +```ts +var moduleName = "feature" +try { + overlay.getOverlayModuleInfo(moduleName, (error, data) => { + if (error) { + console.log('getOverlayModuleInfo failed due to error code : ' + err.code + ' ' + 'message :' + err.message); + return; + } + console.log('overlayModuleInfo is ' + JSON.stringify(data)); + }); +} catch (error) { + console.log('getOverlayModuleInfo failed due to error code : ' + err.code + ' ' + 'message :' + err.message); +} +``` + +## overlay.getTargetOverlayModuleInfos + +getTargetOverlayModuleInfos(targetModuleName: string): Promise\>; + +以异步方法获取指定的目标module的OverlayModuleInfo。使用promise异步回调,成功返回null,失败返回对应错误信息。 + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Overlay + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ------ | ---- | --------------------------------------- | +| targetModuleName | string | 是 | 指定当前应用中的目标module的HAP名称。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------- | ------------------ | +| Promise\> | Promise对象,返回\> | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| ------ | -------------------------------------- | +| 17700002 | The specified module name is not found. | +| 17700034 | The specified module is an overlay module. | + +**示例:** + +```ts +var targetModuleName = "feature" + +(async() => { + try { + let overlayModuleInfos = await overlay.getTargetOverlayModuleInfos(targetModuleName); + console.log('overlayModuleInfos are ' + JSON.stringify(overlayModuleInfos)); + } catch(err) { + console.log('getTargetOverlayModuleInfos failed due to error code : ' + err.code + ' ' + 'message :' + err.message); + } +})(); +``` + +## overlay.getTargetOverlayModuleInfos + +getTargetOverlayModuleInfos(targetModuleName: string, callback: AsyncCallback\>): void; + +以异步方法获取指定的目标module的OverlayModuleInfo。使用callback异步回调,成功返回null,失败返回对应错误信息。 + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Overlay + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ------ | ---- | --------------------------------------- | +| targetModuleName | string | 是 | 指定当前应用中的目标module的HAP名称。 | +| callback | AsyncCallback\> | 是 | 回调函数,当获取指定的目标module的OverlayModuleInfo成功时,err返回undefined。否则回调函数返回具体错误对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| ------ | -------------------------------------- | +| 17700002 | The specified module name is not found. | +| 17700034 | The specified module is an overlay module. | + +**示例:** + +```ts +var targetModuleName = "feature" +try { + overlay.getTargetOverlayModuleInfos(targetModuleName, (error, data) => { + if (error) { + console.log('getTargetOverlayModuleInfos failed due to error code : ' + err.code + ' ' + 'message :' + err.message); + return; + } + console.log('overlayModuleInfo is ' + JSON.stringify(data)); + }); +} catch (error) { + console.log('getTargetOverlayModuleInfos failed due to error code : ' + err.code + ' ' + 'message :' + err.message); +} +``` + +## overlay.getOverlayModuleInfoByBundleName + +getOverlayModuleInfoByBundleName(bundleName: string, moduleName?: string): Promise\>; + +以异步方法获取指定应用中指定module的OverlayModuleInfo信息。使用promise异步回调,成功返回null,失败返回对应错误信息。 + +**需要权限:** ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Overlay + +**系统API:** 此接口为系统接口。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ------ | ---- | --------------------------------------- | +| bundleName | string | 是 | 指定应用的bundle名称。 | +| moduleName | string | 否 | 指定应用中的overlay module的HAP名称。缺省该字段时,查询接口将查询指定应用中所有module的OverlayModuleInfo信息。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------- | ------------------ | +| Promise\> | Promise对象,返回\ | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| ------ | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700002 | The specified module name is not found. | +| 17700032 | The specified bundle does not contain any overlay module. | +| 17700033 | The specified module is not an overlay module. | + +**示例:** + +```ts +var bundleName = "com.example.myapplication_xxxxx"; +var moduleName = "feature" + +(async() => { + try { + let overlayModuleInfos = await overlay.getOverlayModuleInfoByBundleName(bundleName, moduleName); + console.log('overlayModuleInfos are ' + JSON.stringify(overlayModuleInfos)); + } catch(err) { + console.log('getTargetOverlayModuleInfos failed due to error code : ' + err.code + ' ' + 'message :' + err.message); + } +})(); +``` + +## overlay.getOverlayModuleInfoByBundleName + +getOverlayModuleInfoByBundleName(bundleName: string, moduleName: string, callback: AsyncCallback\>): void; + +以异步方法获取指定应用中指定module的OverlayModuleInfo信息。使用callback异步回调,成功返回null,失败返回对应错误信息。 + +**需要权限:** ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Overlay + +**系统API:** 此接口为系统接口。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ------ | ---- | --------------------------------------- | +| bundleName | string | 是 | 指定应用的bundle名称。 | +| moduleName | string | 是 | 指定应用中的overlay module的HAP名称。缺省该字段时,查询接口将查询指定应用中所有module的OverlayModuleInfo信息。 | +| callback | AsyncCallback\> | 是 | 回调函数,当获取指定应用中指定module的OverlayModuleInfo信息成功时,err返回undefined。否则回调函数返回具体错误对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| ------ | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700002 | The specified module name is not found. | +| 17700032 | The specified bundle does not contain any overlay module. | +| 17700033 | The specified module is not an overlay module. | + +**示例:** + +```ts +var bundleName = "com.example.myapplication_xxxxx"; +var moduleName = "feature" + +try { + overlay.getOverlayModuleInfoByBundleName(bundleName, moduleName, (error, data) => { + if (error) { + console.log('getOverlayModuleInfoByBundleName failed due to error code : ' + err.code + ' ' + 'message :' + err.message); + return; + } + console.log('overlayModuleInfo is ' + JSON.stringify(data)); + }); +} catch (error) { + console.log('getOverlayModuleInfoByBundleName failed due to error code : ' + err.code + ' ' + 'message :' + err.message); +} +``` + +## overlay.getOverlayModuleInfoByBundleName + +getOverlayModuleInfoByBundleName(bundleName: string, callback: AsyncCallback\>): void; + +以异步方法获取指定应用中所有module的OverlayModuleInfo信息。使用callback异步回调,成功返回null,失败返回对应错误信息。 + +**需要权限:** ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Overlay + +**系统API:** 此接口为系统接口。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ------ | ---- | --------------------------------------- | +| bundleName | string | 是 | 指定应用的bundle名称。 | +| callback | AsyncCallback\> | 是 | 回调函数,当获取指定应用中所有module的OverlayModuleInfo信息成功时,err返回undefined。否则回调函数返回具体错误对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| ------ | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700002 | The specified module name is not found. | +| 17700032 | The specified bundle does not contain any overlay module. | +| 17700033 | The specified module is not an overlay module. | + +**示例:** + +```ts +var bundleName = "com.example.myapplication_xxxxx"; + +try { + overlay.getOverlayModuleInfoByBundleName(bundleName, (error, data) => { + if (error) { + console.log('getOverlayModuleInfoByBundleName failed due to error code : ' + err.code + ' ' + 'message :' + err.message); + return; + } + console.log('overlayModuleInfo is ' + JSON.stringify(data)); + }); +} catch (error) { + console.log('getOverlayModuleInfoByBundleName failed due to error code : ' + err.code + ' ' + 'message :' + err.message); +} +``` + +## overlay.getTargetOverlayModuleInfosByBundleName + +getTargetOverlayModuleInfosByBundleName(targetBundleName: string, moduleName?: string): Promise\>; + +以异步方法获取指定应用中指定module关联的所有OverlayModuleInfo信息。使用promise异步回调,成功返回null,失败返回对应错误信息。 + +**需要权限:** ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Overlay + +**系统API:** 此接口为系统接口。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ------ | ---- | --------------------------------------- | +| targetBundleName | string | 是 | 指定目标应用的bundle名称。 | +| moduleName | string | 否 | 指定应用中的目标module的HAP名称。缺省该字段时,查询接口将查询指定应用中所有module所关联的OverlayModuleInfo信息。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------- | ------------------ | +| Promise\> | Promise对象,返回\> | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| ------ | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700002 | The specified module name is not found. | +| 17700034 | The specified module is an overlay module. | +| 17700035 | The specified bundle is an overlay bundle. | + +**示例:** + +```ts +var targetBundleName = "com.example.myapplication_xxxxx"; +var moduleName = "feature" + +(async() => { + try { + let overlayModuleInfos = await overlay.getTargetOverlayModuleInfosByBundleName(targetBundleName, moduleName); + console.log('overlayModuleInfos are ' + JSON.stringify(overlayModuleInfos)); + } catch(err) { + console.log('getTargetOverlayModuleInfosByBundleName failed due to error code : ' + err.code + ' ' + 'message :' + err.message); + } +})(); +``` + +## overlay.getTargetOverlayModuleInfosByBundleName + +getTargetOverlayModuleInfosByBundleName(targetBundleName: string, moduleName: string, callback: AsyncCallback\>): void; + +以异步方法获取指定应用中指定module关联的所有OverlayModuleInfo信息。使用callback异步回调,成功返回null,失败返回对应错误信息。 + +**需要权限:** ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Overlay + +**系统API:** 此接口为系统接口。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ------ | ---- | --------------------------------------- | +| targetBundleName | string | 是 | 指定目标应用的bundle名称。 | +| moduleName | string | 是 | 指定应用中的目标module的HAP名称。缺省该字段时,查询接口将查询指定应用中所有module所关联的OverlayModuleInfo信息。 | +| callback | AsyncCallback\> | 是 | 回调函数,当获取指定应用中指定module关联的所有OverlayModuleInfo信息成功时,err返回undefined。否则回调函数返回具体错误对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| ------ | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700002 | The specified module name is not found. | +| 17700034 | The specified module is an overlay module. | +| 17700035 | The specified bundle is an overlay bundle. | + +**示例:** + +```ts +var targetBundleName = "com.example.myapplication_xxxxx"; +var moduleName = "feature" + +try { + overlay.getTargetOverlayModuleInfosByBundleName(targetBundleName, moduleName, (error, data) => { + if (error) { + console.log('getTargetOverlayModuleInfosByBundleName failed due to error code : ' + err.code + ' ' + 'message :' + err.message); + return; + } + console.log('overlayModuleInfo is ' + JSON.stringify(data)); + }); +} catch (error) { + console.log('getTargetOverlayModuleInfosByBundleName failed due to error code : ' + err.code + ' ' + 'message :' + err.message); +} +``` + +## overlay.getTargetOverlayModuleInfosByBundleName + +getTargetOverlayModuleInfosByBundleName(targetBundleName: string, callback: AsyncCallback\>): void; + +以异步方法获取指定应用中所有module关联的所有OverlayModuleInfo信息。使用callback异步回调,成功返回null,失败返回对应错误信息。 + +**需要权限:** ohos.permission.GET_BUNDLE_INFO_PRIVILEGED + +**系统能力:** SystemCapability.BundleManager.BundleFramework.Overlay + +**系统API:** 此接口为系统接口。 + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----------- | ------ | ---- | --------------------------------------- | +| targetBundleName | string | 是 | 指定目标应用的bundle名称。 | +| callback | AsyncCallback\> | 是 | 回调函数,当获取指定应用中所有module关联的所有OverlayModuleInfo信息成功时,err返回undefined。否则回调函数返回具体错误对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[ohos.bundle错误码](../errorcodes/errorcode-bundle.md)。 + +| 错误码ID | 错误信息 | +| ------ | -------------------------------------- | +| 17700001 | The specified bundleName is not found. | +| 17700002 | The specified module name is not found. | +| 17700034 | The specified module is an overlay module. | +| 17700035 | The specified bundle is an overlay bundle. | + +**示例:** + +```ts +var targetBundleName = "com.example.myapplication_xxxxx"; + +try { + overlay.getTargetOverlayModuleInfosByBundleName(targetBundleName, (error, data) => { + if (error) { + console.log('getTargetOverlayModuleInfosByBundleName failed due to error code : ' + err.code + ' ' + 'message :' + err.message); + return; + } + console.log('overlayModuleInfo is ' + JSON.stringify(data)); + }); +} catch (error) { + console.log('getTargetOverlayModuleInfosByBundleName failed due to error code : ' + err.code + ' ' + 'message :' + err.message); +} +``` + +## overlay特征应用介绍 + +**概念** +overlay特征应用指的是应用中包含有overlay特征的module。该特征module一般是为设备上存在的非overlay特征的module提供额外的资源文件,以便于目标module在运行阶段可以使用这些额外的资源文件来展示不同的颜色,标签,主题等等。overlay特征仅适用与stage模型。 + +**如何识别overlay特征的module** +在IDE中创建应用工程时, module的配置文件module.json5中包含targetModuleName和targetPriority字段时,该module将会在安装阶段被识别为overlay特征的module。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-pasteboard.md b/zh-cn/application-dev/reference/apis/js-apis-pasteboard.md index 8c47f29f71e8bc20fed17d4f270fd445a01cefe3..8a153ca2cab76359d918d5491b783c1311f5ee3b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-pasteboard.md +++ b/zh-cn/application-dev/reference/apis/js-apis-pasteboard.md @@ -376,11 +376,11 @@ let record = pasteboard.createUriRecord('dataability:///com.example.myapplicatio | 名称 | 类型 | 可读 | 可写 | 说明 | | -------- | -------- | -------- | -------- |--------------------------------------------------------------------------------------------| -| additions7+ | {[key:string]:object} | 是 | 是 | 设置的其他附加属性数据。 | +| additions7+ | {[key:string]:object} | 是 | 是 | 设置其他附加属性数据。 | | mimeTypes7+ | Array<string> | 是 | 否 | 剪贴板内容条目的数据类型,非重复的类型列表。 | | tag7+ | string | 是 | 是 | 用户自定义标签。 | | timestamp7+ | number | 是 | 否 | 剪贴板数据的写入时间戳(单位:ms)。 | -| localOnly7+ | boolean | 是 | 是 | 配置剪贴板内容是否为“仅在本地”。默认值为true。
- 配置为true时,表示内容仅在本地,不会在设备之间传递。
- 配置为false时,表示内容将在设备间传递。 | +| localOnly7+ | boolean | 是 | 是 | 配置剪贴板内容是否为“仅在本地”,默认值为false。暂不支持,推荐使用shareOption属性。
- 配置为true时,表示内容仅在本地,不会在设备之间传递。
- 配置为false时,表示内容将在设备间传递。 | | shareOption9+ | [ShareOption](#shareoption9) | 是 | 是 | 指示剪贴板数据可以粘贴到的范围,如果未设置或设置不正确,则默认值为CROSSDEVICE。 | ## PasteDataRecord7+ @@ -606,7 +606,7 @@ let opt = { scaleMode: 1 }; image.createPixelMap(buffer, opt).then((pixelMap) => { - let pasteData = pasteboard.createData(MIMETYPE_PIXELMAP, pixelMap); + let pasteData = pasteboard.createData(pasteboard.MIMETYPE_PIXELMAP, pixelMap); let PixelMap = pasteData.getPrimaryPixelMap(); }); ``` @@ -782,7 +782,7 @@ getRecord(index: number): PasteDataRecord | 错误码ID | 错误信息 | | -------- | -------- | -| 12900001 | The index is out of range. | +| 12900001 | The index is out of the record. | **示例:** @@ -880,7 +880,7 @@ removeRecord(index: number): void | 错误码ID | 错误信息 | | -------- | -------- | -| 12900001 | The index is out of range. | +| 12900001 | The index is out of the record. | **示例:** @@ -910,7 +910,7 @@ replaceRecord(index: number, record: PasteDataRecord): void | 错误码ID | 错误信息 | | -------- | -------- | -| 12900001 | The index is out of range. | +| 12900001 | The index is out of the record. | **示例:** @@ -1192,10 +1192,10 @@ off(type: 'update', callback?: () =>void ): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| type | string | 是 | 取值为'update',表示系统剪贴板内容变化事件。 | -| callback | function | 否 | 剪贴板中内容变化时触发的用户程序的回调。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- |---------------------------------------------------------| +| type | string | 是 | 取值为'update',表示系统剪贴板内容变化事件。 | +| callback | function | 否 | 剪贴板中内容变化时触发的用户程序的回调。如果此参数未填,表明清除本应用的所有监听回调,否则表示清除指定监听回调。| **示例:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-permissionrequestresult.md b/zh-cn/application-dev/reference/apis/js-apis-permissionrequestresult.md index 1eae91fc9ae92b7a9082ae4a66692a45a77ddf73..948eb9a341774b3d717489f6b80a0136966716b5 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-permissionrequestresult.md +++ b/zh-cn/application-dev/reference/apis/js-apis-permissionrequestresult.md @@ -14,7 +14,7 @@ | 名称 | 类型 | 可读 | 可写 | 说明 | | -------- | -------- | -------- | -------- | -------- | | permissions | Array<string> | 是 | 否 | 用户传入的权限。| -| authResults | Array<number> | 是 | 否 | 相应请求权限的结果:
-1表示权限已设置,无需弹窗,需要用户在"设置"中修改。
0表示无需任何操作。
1表示需要动态弹窗授权。
2表示请求无效,可能原因有:
-未在设置文件中声明目标权限;
-权限名非法;
-部分权限存在特殊申请条件,在申请对应权限时未满足其指定的条件,见[ohos.permission.LOCATION](../../security/permission-list.md#ohospermissionlocation)与[ohos.permission.APPROXIMATELY_LOCATION](../../security/permission-list.md#ohospermissionapproximately_location)| +| authResults | Array<number> | 是 | 否 | 相应请求权限的结果:
- -1:未授权,表示权限已设置,无需弹窗,需要用户在"设置"中修改。
- 0:已授权。
- 2:未授权,表示请求无效,可能原因有:
-未在设置文件中声明目标权限。
-权限名非法。
-部分权限存在特殊申请条件,在申请对应权限时未满足其指定的条件,见[ohos.permission.LOCATION](../../security/permission-list.md#ohospermissionlocation)与[ohos.permission.APPROXIMATELY_LOCATION](../../security/permission-list.md#ohospermissionapproximately_location) | ## 使用说明 diff --git a/zh-cn/application-dev/reference/apis/js-apis-plainarray.md b/zh-cn/application-dev/reference/apis/js-apis-plainarray.md index 6b311ca0809802d5d8ab9d3013ea76f4ec0e457a..22ef728b1147bcc182a1cd55d15149754ed06713 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-plainarray.md +++ b/zh-cn/application-dev/reference/apis/js-apis-plainarray.md @@ -1,8 +1,5 @@ # @ohos.util.PlainArray (非线性容器PlainArray) -> **说明:** -> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 - PlainArray可用于存储具有关联关系的key-value键值对集合,存储元素中key值唯一,key值类型为number类型,每个key对应一个value。 PlainArray依据泛型定义,采用轻量级结构,集合中key值的查找依赖于二分查找算法,然后映射到其他数组中的value值。 @@ -11,8 +8,13 @@ PlainArray和[LightWeightMap](js-apis-lightweightmap.md)都是用来存储键值 **推荐使用场景:** 当需要存储key值为number类型的键值对时,可以使用PlainArray。 -文档中存在泛型的使用,涉及以下泛型标记符:
-- T: Type, 类 +文档中存在泛型的使用,涉及以下泛型标记符:
+- T:Type,类 + +> **说明:** +> +> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + ## 导入模块 @@ -21,7 +23,6 @@ import PlainArray from '@ohos.util.PlainArray'; ``` - ## PlainArray ### 属性 @@ -118,9 +119,8 @@ has(key: number): boolean ```ts let plainArray = new PlainArray(); -plainArray.has(1); plainArray.add(1, "squirrel"); -let result1 = plainArray.has(1); +let result = plainArray.has(1); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-power.md b/zh-cn/application-dev/reference/apis/js-apis-power.md index 3e253f3241eb521b5faf08d1e6f78bde517fdcb0..47027996ffa8ed2db9b6f5161700d2b7f561e4da 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-power.md +++ b/zh-cn/application-dev/reference/apis/js-apis-power.md @@ -293,7 +293,7 @@ power.setPowerMode(power.DevicePowerMode.MODE_PERFORMANCE) rebootDevice(reason: string): void -> **说明:**
从API version 9开始不再维护,建议使用[power.reboot](#powerreboot9)替代。 +> **说明:**
从API version 7开始支持,从API version 9开始不再维护。建议使用[power.reboot](#powerreboot9)替代,替代接口能力仅对系统应用开放。 重启设备。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-privacyManager.md b/zh-cn/application-dev/reference/apis/js-apis-privacyManager.md index 04918ca06f0759a4033d73afcfb769861dcbecc5..84beb19662ebd11529f7256c4ae745b6b5220e37 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-privacyManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-privacyManager.md @@ -45,9 +45,9 @@ addPermissionUsedRecord(tokenID: number, permissionName: Permissions, successCou | 错误码ID | 错误信息 | | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID is 0 | -| 12100002 | The specified tokenID does not exist or it does not refer to an application process. | -| 12100003 | The specified permission does not exist or it is not an user_grant permission. | +| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256, or the count value is invalid. | +| 12100002 | The specified tokenID does not exist or refer to an application process. | +| 12100003 | The specified permission does not exist or is not an user_grant permission. | | 12100007 | Service is abnormal. | | 12100008 | Out of memory. | @@ -95,9 +95,9 @@ addPermissionUsedRecord(tokenID: number, permissionName: Permissions, successCou | 错误码ID | 错误信息 | | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID is 0 | -| 12100002 | The specified tokenID does not exist or it does not refer to an application process. | -| 12100003 | The specified permission does not exist or it is not an user_grant permission. | +| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256, or the count value is invalid. | +| 12100002 | The specified tokenID does not exist or refer to an application process. | +| 12100003 | The specified permission does not exist or is not an user_grant permission. | | 12100007 | Service is abnormal. | | 12100008 | Out of memory. | @@ -149,8 +149,8 @@ getPermissionUsedRecord(request: PermissionUsedRequest): Promise<PermissionUs | 错误码ID | 错误信息 | | -------- | -------- | | 12100001 | The parameter is invalid. the value of flag in request is invalid. | -| 12100002 | The specified tokenID does not exist or it does not refer to an application process. | -| 12100003 | The specified permission does not exist or it is not an user_grant permission. | +| 12100002 | The specified tokenID does not exist or refer to an application process. | +| 12100003 | The specified permission does not exist or is not an user_grant permission. | | 12100007 | Service is abnormal. | | 12100008 | Out of memory. | @@ -204,8 +204,8 @@ getPermissionUsedRecord(request: PermissionUsedRequest, callback: AsyncCallback& | 错误码ID | 错误信息 | | -------- | -------- | | 12100001 | The parameter is invalid. the value of flag in request is invalid. | -| 12100002 | The specified tokenID does not exist or it does not refer to an application process. | -| 12100003 | The specified permission does not exist or it is not an user_grant permission. | +| 12100002 | The specified tokenID does not exist or refer to an application process. | +| 12100003 | The specified permission does not exist or is not an user_grant permission. | | 12100007 | Service is abnormal. | | 12100008 | Out of memory. | @@ -266,9 +266,9 @@ startUsingPermission(tokenID: number, permissionName: Permissions): Promise<v | 错误码ID | 错误信息 | | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID is 0 | -| 12100002 | The specified tokenID does not exist or it does not refer to an application process. | -| 12100003 | The specified permission does not exist or it is not an user_grant permission. | +| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256. | +| 12100002 | The specified tokenID does not exist or refer to an application process. | +| 12100003 | The specified permission does not exist or is not an user_grant permission. | | 12100004 | The interface is called repeatedly with the same input. It means the application specified by the tokenID has been using the specified permission. | | 12100007 | Service is abnormal. | | 12100008 | Out of memory. | @@ -314,9 +314,9 @@ startUsingPermission(tokenID: number, permissionName: Permissions, callback: Asy | 错误码ID | 错误信息 | | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID is 0 | -| 12100002 | The specified tokenID does not exist or it does not refer to an application process. | -| 12100003 | The specified permission does not exist or it is not an user_grant permission. | +| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256. | +| 12100002 | The specified tokenID does not exist or refer to an application process. | +| 12100003 | The specified permission does not exist or is not an user_grant permission. | | 12100004 | The interface is called repeatedly with the same input. It means the application specified by the tokenID has been using the specified permission. | | 12100007 | Service is abnormal. | | 12100008 | Out of memory. | @@ -369,9 +369,9 @@ stopUsingPermission(tokenID: number, permissionName: Permissions): Promise<vo | 错误码ID | 错误信息 | | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID is 0 | -| 12100002 | The specified tokenID does not exist or it does not refer to an application process. | -| 12100003 | The specified permission does not exist or it is not an user_grant permission. | +| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256. | +| 12100002 | The specified tokenID does not exist or refer to an application process. | +| 12100003 | The specified permission does not exist or is not an user_grant permission. | | 12100004 | The interface is not used with | | 12100007 | Service is abnormal. | | 12100008 | Out of memory. | @@ -417,9 +417,9 @@ stopUsingPermission(tokenID: number, permissionName: Permissions, callback: Asyn | 错误码ID | 错误信息 | | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID is 0 | -| 12100002 | The specified tokenID does not exist or it does not refer to an application process. | -| 12100003 | The specified permission does not exist or it is not an user_grant permission. | +| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256. | +| 12100002 | The specified tokenID does not exist or refer to an application process. | +| 12100003 | The specified permission does not exist or is not an user_grant permission. | | 12100004 | The interface is not used with | | 12100007 | Service is abnormal. | | 12100008 | Out of memory. | @@ -445,7 +445,7 @@ try { ## privacyManager.on -on(type: 'activeStateChange', permissionNameList: Array<Permissions>, callback: Callback<ActiveChangeResponse>): void +on(type: 'activeStateChange', permissionList: Array<Permissions>, callback: Callback<ActiveChangeResponse>): void 订阅指定权限列表的权限使用状态变更事件。 @@ -458,7 +458,7 @@ on(type: 'activeStateChange', permissionNameList: Array<Permissions>, call | 参数名 | 类型 | 必填 | 说明 | | ------------------ | --------------------- | ---- | ------------------------------------------------------------ | | type | string | 是 | 订阅事件类型,固定为'activeStateChange',权限使用状态变更事件。 | -| permissionNameList | Array<Permissions> | 是 | 订阅的权限名列表,为空时表示订阅所有的权限使用状态变化。 | +| permissionList | Array<Permissions> | 是 | 订阅的权限名列表,为空时表示订阅所有的权限使用状态变化。 | | callback | Callback<[ActiveChangeResponse](#activechangeresponse)> | 是 | 订阅指定权限使用状态变更事件的回调。 | **错误码:** @@ -467,7 +467,7 @@ on(type: 'activeStateChange', permissionNameList: Array<Permissions>, call | 错误码ID | 错误信息 | | -------- | -------- | -| 12100001 | The parameter is invalid. The tokenID is 0 | +| 12100001 | The parameter is invalid. The tokenID is 0, or the string size of permissionName is larger than 256. | | 12100004 | The interface is called repeatedly with the same input. | | 12100005 | The registration time has exceeded the limitation. | | 12100007 | Service is abnormal. | @@ -478,9 +478,9 @@ on(type: 'activeStateChange', permissionNameList: Array<Permissions>, call ```js import privacyManager from '@ohos.privacyManager'; -let permissionNameList = []; +let permissionList = []; try { - privacyManager.on('activeStateChange', permissionNameList, (data) => { + privacyManager.on('activeStateChange', permissionList, (data) => { console.debug("receive permission state change, data:" + JSON.stringify(data)); }); } catch(err) { @@ -490,7 +490,7 @@ try { ## privacyManager.off -off(type: 'activeStateChange', permissionNameList: Array<Permissions>, callback?: Callback<ActiveChangeResponse>): void; +off(type: 'activeStateChange', permissionList: Array<Permissions>, callback?: Callback<ActiveChangeResponse>): void; 取消订阅指定权限列表的权限使用状态变更事件。 @@ -503,7 +503,7 @@ off(type: 'activeStateChange', permissionNameList: Array<Permissions>, cal | 参数名 | 类型 | 必填 | 说明 | | ------------------ | --------------------- | ---- | ------------------------------------------------------------ | | type | string | 是 | 订阅事件类型,固定为'activeStateChange',权限使用状态变更事件。 | -| permissionNameList | Array<Permissions> | 是 | 订阅的权限名列表,为空时表示订阅所有的权限状态变化,必须与on的输入一致。 | +| permissionList | Array<Permissions> | 是 | 订阅的权限名列表,为空时表示订阅所有的权限状态变化,必须与on的输入一致。 | | callback | Callback<[ActiveChangeResponse](#activechangeresponse)> | 否 | 取消订阅指定tokenId与指定权限名状态变更事件的回调。| **错误码:** @@ -512,8 +512,8 @@ off(type: 'activeStateChange', permissionNameList: Array<Permissions>, cal | 错误码ID | 错误信息 | | -------- | -------- | -| 12100001 | The parameter is invalid. The permissionName in list is all invalid or the list size is larger than 1024. | -| 12100004 | The interface is not used with | +| 12100001 | The permissionNames in the list are all invalid, or the list size exceeds 1024 bytes. | +| 12100004 | The interface is not used together with "on"| | 12100007 | Service is abnormal. | | 12100008 | Out of memory. | @@ -522,9 +522,9 @@ off(type: 'activeStateChange', permissionNameList: Array<Permissions>, cal ```js import privacyManager from '@ohos.privacyManager'; -let permissionNameList = []; +let permissionList = []; try { - privacyManager.off('activeStateChange', permissionNameList); + privacyManager.off('activeStateChange', permissionList); }catch(err) { console.log(`catch err->${JSON.stringify(err)}`); } 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 8f9f63a038ed0a31cd4e02b0985db02181b7e553..eb8f6cf090140a3e536e19a519488db43ff668df 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-process.md +++ b/zh-cn/application-dev/reference/apis/js-apis-process.md @@ -18,13 +18,8 @@ import process from '@ohos.process'; | 名称 | 类型 | 可读 | 可写 | 说明 | | -------- | -------- | -------- | -------- | -------- | -| egid | number | 是 | 否 | 进程的有效组标识。
**系统接口:** 此接口为系统接口。
此接口仅用于对应用的测试。| -| euid | number | 是 | 否 | 进程的有效用户身份。
**系统接口:** 此接口为系统接口。
此接口仅用于对应用的测试。 | -| gid | number | 是 | 否 | 进程的组标识。
**系统接口:** 此接口为系统接口。
此接口仅用于对应用的测试。| | uid | number | 是 | 否 | 进程的用户标识。 | -| groups | number[] | 是 | 否 | 带有补充组id的数组。
**系统接口:** 此接口为系统接口。
此接口仅用于对应用的测试。 | | pid | number | 是 | 否 | 当前进程的pid。 | -| ppid | number | 是 | 否 | 当前进程的父进程的pid。
**系统接口:** 此接口为系统接口。
此接口仅用于对应用的测试。 | | tid8+ | number | 是 | 否 | 当前线程的tid。 | @@ -120,50 +115,6 @@ let result = process.getPastCpuTime() ; ``` -## process.runCmd - -runCmd(command: string, options?: { timeout?: number, killSignal?: number | string, maxBuffer?: number }): ChildProcess - -通过runcmd可以fork一个新的进程来运行一段shell,并返回ChildProcess对象。 - -**系统接口:** 此接口为系统接口。 - -此接口仅用于对应用的测试。 - -**系统能力:** SystemCapability.Utils.Lang - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| command | string | 是 | shell命令。 | -| options | Object | 否 | 相关选项参数。 | - -**表1** options - -| 名称 | 参数类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| timeout | number | 否 | 子进程运行的毫秒数,当子进程运行时间超出此时间,则父进程发送killSignal信号给子进程。timeout默认为0。 | -| killSignal | number \| string | 否 | 子进程运行时间超出timeout时,父进程发送killSignal 信号给子进程。killSignal 默认为'SIGTERM'。 | -| maxBuffer | number | 否 | 子进程标准输入输出的最大缓冲区大小,当超出此大小时则终止子进程。maxBuffer默认1024\*1024。 | - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| [ChildProcess](#childprocess) | 子进程对象。 | - -**示例:** - -```js -let child = process.runCmd('ls', { maxBuffer : 2 }); -let result = child.wait(); -child.getOutput.then(val=>{ - console.log("child.getOutput = " + val); -}) -``` - - ## process.abort abort(): void @@ -179,118 +130,6 @@ process.abort(); ``` -## process.on - -on(type: string, listener: EventListener): void - -存储用户所触发的事件。 - -**系统接口:** 此接口为系统接口。 - -此接口仅用于对应用的测试。 - -**系统能力:** SystemCapability.Utils.Lang - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| type | string | 是 | 存储事件的type。 | -| listener | [EventListener](#eventlistener) | 是 | 回调的事件。 | - -**示例:** - -```js -process.on("data", (e)=>{ - console.log("data callback"); -}) -``` - - -## process.off - -off(type: string): boolean - -删除用户存储的事件。 - -**系统接口:** 此接口为系统接口。 - -此接口仅用于对应用的测试。 - -**系统能力:** SystemCapability.Utils.Lang - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| type | string | 是 | 删除事件的type。 | - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| boolean | 事件删除成功则返回true,没有成功则为false。| - -**示例:** - -```js -process.on("data", (e)=>{ - console.log("data callback"); -}) -let result = process.off("data"); -``` - - -## process.cwd - -cwd(): string - -获取进程的工作目录。 - -**系统接口:** 此接口为系统接口。 - -此接口仅用于对应用的测试。 - -**系统能力:** SystemCapability.Utils.Lang - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| string| 返回当前进程的工作目录。 | - -**示例:** - -```js -let path = process.cwd(); -``` - - -## process.chdir - -chdir(dir: string): void - -更改进程的当前工作目录。 - -**系统接口:** 此接口为系统接口。 - -此接口仅用于对应用的测试。 - -**系统能力:** SystemCapability.Utils.Lang - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| dir | string | 是 | 路径。 | - -**示例:** - -```js -process.chdir('/system'); -``` - - ## process.uptime uptime(): number @@ -728,157 +567,4 @@ kill(signal: number, pid: number): boolean let pro = new process.ProcessManager(); let pres = process.pid; let result = pro.kill(28, pres); -``` - - -## ChildProcess - -ChildProcess对象为创建的新的子进程,主进程可以获取子进程的标准输入输出,以及发送信号和关闭子进程,可以通过[process.runCmd](#processruncmd)获取ChildProcess对象。 - -**系统接口:** 此接口为系统接口。 - -### 属性 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** SystemCapability.Utils.Lang - -| 名称 | 类型 | 可读 | 可写 | 说明 | -| -------- | -------- | -------- | -------- | -------- | -| pid | number | 是 | 否 | 子进程的pid。
**系统接口:** 此接口为系统接口。
此接口仅用于对应用的测试。 | -| ppid | number | 是 | 否 | 子进程的父进程的pid。
**系统接口:** 此接口为系统接口。
此接口仅用于对应用的测试。 | -| exitCode | number | 是 | 否 | 子进程的退出码。
**系统接口:** 此接口为系统接口。
此接口仅用于对应用的测试。| -| killed | boolean | 是 | 否 | 父进程给子进程发信号是否成功。
**系统接口:** 此接口为系统接口。
此接口仅用于对应用的测试。 | - - -### wait - -wait(): Promise<number> - -等待子进程运行结束,返回promise对象,其值为子进程的退出码。 - -**系统接口:** 此接口为系统接口。 - -此接口仅用于对应用的测试。 - -**系统能力:** SystemCapability.Utils.Lang - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| Promise<number> | 异步返回子进程的退出码。 | - -**示例:** - -```js -let child = process.runCmd('ls'); -let result = child.wait(); -result.then(val=>{ - console.log("result = " + val); -}) -``` - - -### getOutput - -getOutput(): Promise<Uint8Array> - -获取子进程的标准输出。 - -**系统接口:** 此接口为系统接口。 - -此接口仅用于对应用的测试。 - -**系统能力:** SystemCapability.Utils.Lang - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| Promise<Uint8Array> | 异步返回标准输出的字节流。 | - -**示例:** - -```js -let child = process.runCmd('ls'); -let result = child.wait(); -child.getOutput().then(val=>{ - console.log("child.getOutput = " + val); -}) -``` - - -### getErrorOutput - -getErrorOutput(): Promise<Uint8Array> - -获取子进程的标准错误输出。 - -**系统接口:** 此接口为系统接口。 - -此接口仅用于对应用的测试。 - -**系统能力:** SystemCapability.Utils.Lang - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| Promise<Uint8Array> | 异步返回标准错误输出的字节流。 | - -**示例:** - -```js -let child = process.runCmd('madir test.text'); -let result = child.wait(); -child.getErrorOutput().then(val=>{ - console.log("child.getErrorOutput= " + val); -}) -``` - - -### close - -close(): void - -关闭正在运行的子进程。 - -**系统接口:** 此接口为系统接口。 - -此接口仅用于对应用的测试。 - -**系统能力:** SystemCapability.Utils.Lang - -**示例:** - -```js -let child = process.runCmd('sleep 5; ls'); -child.close(); -``` - - -### kill - -kill(signal: number | string): void - -用于发送信号给子进程,结束指定进程。 - -**系统接口:** 此接口为系统接口。 - -此接口仅用于对应用的测试。 - -**系统能力:** SystemCapability.Utils.Lang - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| signal | number \| string | 是 | 数字或字符串。 | - -**示例:** - -```js -let child = process.runCmd('sleep 5; ls'); -child.kill(9); -``` +``` \ No newline at end of file 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 ea3d513f6271e4d8f426ea22e83035b45e62527c..a41981e8e95b1459b63fce66d94482809b3e7280 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-prompt.md +++ b/zh-cn/application-dev/reference/apis/js-apis-prompt.md @@ -44,11 +44,11 @@ prompt.showToast({ **系统能力:** SystemCapability.ArkUI.ArkUI.Full。 -| 名称 | 类型 | 必填 | 说明 | -| -------- | ---------------------------------------- | ---- | ---------------------------------------- | -| message | string\| [Resource](../arkui-ts/ts-types.md#resource)9+ | 是 | 显示的文本信息。 | -| duration | number | 否 | 默认值1500ms,取值区间:1500ms-10000ms。若小于1500ms则取默认值,若大于10000ms则取上限值10000ms。 | -| bottom | string\| number | 否 | 设置弹窗边框距离屏幕底部的位置,无上限值,默认单位vp。 | +| 名称 | 类型 | 必填 | 说明 | +| -------- | --------------- | ---- | ------------------------------------------------------------ | +| message | string | 是 | 显示的文本信息。 | +| duration | number | 否 | 默认值1500ms,取值区间:1500ms-10000ms。若小于1500ms则取默认值,若大于10000ms则取上限值10000ms。 | +| bottom | string\| number | 否 | 设置弹窗边框距离屏幕底部的位置,无上限值,默认单位vp。 | ## prompt.showDialog @@ -145,11 +145,11 @@ prompt.showDialog({ **系统能力:** SystemCapability.ArkUI.ArkUI.Full -| 名称 | 类型 | 必填 | 说明 | -| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| title | string\| [Resource](../arkui-ts/ts-types.md#resource)9+ | 否 | 标题文本。 | -| message | string\| [Resource](../arkui-ts/ts-types.md#resource)9+ | 否 | 内容文本。 | -| buttons | [[Button](#button),[Button](#button)?,[Button](#button)?] | 否 | 对话框中按钮的数组,结构为:{text:'button', color: '\#666666'},支持1-3个按钮。其中第一个为positiveButton;第二个为negativeButton;第三个为neutralButton。 | +| 名称 | 类型 | 必填 | 说明 | +| ------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ | +| title | string | 否 | 标题文本。 | +| message | string | 否 | 内容文本。 | +| buttons | [[Button](#button),[Button](#button)?,[Button](#button)?] | 否 | 对话框中按钮的数组,结构为:{text:'button', color: '\#666666'},支持1-3个按钮。其中第一个为positiveButton;第二个为negativeButton;第三个为neutralButton。 | ## ShowDialogSuccessResponse @@ -256,7 +256,7 @@ prompt.showActionMenu({ | 名称 | 类型 | 必填 | 说明 | | ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| title | string\| [Resource](../arkui-ts/ts-types.md#resource)9+ | 否 | 标题文本。 | +| title | string | 否 | 标题文本。 | | buttons | [[Button](#button),[Button](#button)?,[Button](#button)?,[Button](#button)?,[Button](#button)?,[Button](#button)?] | 是 | 菜单中菜单项按钮的数组,结构为:{text:'button', color: '\#666666'},支持1-6个按钮。大于6个按钮时弹窗不显示。 | ## ActionMenuSuccessResponse @@ -275,8 +275,8 @@ prompt.showActionMenu({ **系统能力:** SystemCapability.ArkUI.ArkUI.Full -| 名称 | 类型 | 必填 | 说明 | -| ----- | ---------------------------------------- | ---- | ------- | -| text | string\| [Resource](../arkui-ts/ts-types.md#resource)9+ | 是 | 按钮文本内容。 | -| color | string\| [Resource](../arkui-ts/ts-types.md#resource)9+ | 是 | 按钮文本颜色。 | +| 名称 | 类型 | 必填 | 说明 | +| ----- | ------ | ---- | -------------- | +| text | string | 是 | 按钮文本内容。 | +| color | string | 是 | 按钮文本颜色。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-queue.md b/zh-cn/application-dev/reference/apis/js-apis-queue.md index 1e9383532964b92ae027a154f7dcf7d99eff2b25..2f8c6595fe23a73fa92718a0526f269947722270 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-queue.md +++ b/zh-cn/application-dev/reference/apis/js-apis-queue.md @@ -1,16 +1,18 @@ # @ohos.util.Queue (线性容器Queue) -> **说明:** -> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 - Queue的特点是先进先出,在尾部增加元素,在头部删除元素。根据循环队列的数据结构实现。 Queue和[Deque](js-apis-deque.md)相比,Queue只能在一端删除一端增加,Deque可以两端增删。 **推荐使用场景:** 一般符合先进先出的场景可以使用Queue。 -文档中存在泛型的使用,涉及以下泛型标记符:
-- T: Type, 类 +文档中存在泛型的使用,涉及以下泛型标记符:
+- T:Type,类 + +> **说明:** +> +> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + ## 导入模块 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 e4b9820b11024bba97664856f3fa020da0af66a2..92cac4d69345aa5a635e5b202b0e9936a6865b1d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-radio.md +++ b/zh-cn/application-dev/reference/apis/js-apis-radio.md @@ -10,7 +10,7 @@ ## 导入模块 ``` -import radio from '@ohos.telephony.radio' +import radio from '@ohos.telephony.radio'; ``` ## radio.getRadioTech @@ -32,6 +32,8 @@ getRadioTech\(slotId: number, callback: AsyncCallback<\{psRadioTech: RadioTechno **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -45,7 +47,7 @@ getRadioTech\(slotId: number, callback: AsyncCallback<\{psRadioTech: RadioTechno ```js let slotId = 0; -radio.getRadioTech(slotId, (err, data) =>{ +radio.getRadioTech(slotId, (err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -75,6 +77,8 @@ getRadioTech\(slotId: number\): Promise<\{psRadioTech: RadioTechnology, csRadioT **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -115,6 +119,8 @@ getNetworkState\(callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -127,7 +133,7 @@ getNetworkState\(callback: AsyncCallback\): void **示例:** ```js -radio.getNetworkState((err, data) =>{ +radio.getNetworkState((err, data) => { console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); }); ``` @@ -152,6 +158,8 @@ getNetworkState\(slotId: number, callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -195,6 +203,8 @@ getNetworkState\(slotId?: number\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -234,6 +244,8 @@ getNetworkSelectionMode\(slotId: number, callback: AsyncCallback **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -312,6 +326,8 @@ getISOCountryCodeForNetwork\(slotId: number, callback: AsyncCallback\): **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -352,6 +368,8 @@ getISOCountryCodeForNetwork\(slotId: number\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -389,12 +407,13 @@ getPrimarySlotId\(callback: AsyncCallback\\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | -| 8300004 | Do not have sim card. | | 8300999 | Unknown error code. | **示例:** @@ -422,12 +441,13 @@ getPrimarySlotId\(\): Promise\ **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | -| 8300004 | Do not have sim card. | | 8300999 | Unknown error code. | **示例:** @@ -459,6 +479,8 @@ getSignalInformation\(slotId: number, callback: AsyncCallback\> **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -646,6 +670,8 @@ isRadioOn\(callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -683,6 +709,8 @@ isRadioOn\(slotId: number, callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -726,6 +754,8 @@ isRadioOn\(slotId?: number\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -765,6 +795,8 @@ getOperatorName\(slotId: number, callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -805,6 +837,8 @@ getOperatorName\(slotId: number\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -831,7 +865,7 @@ setPrimarySlotId(slotId: number, callback: AsyncCallback): void 设置主卡所在卡槽的索引号。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -846,6 +880,8 @@ setPrimarySlotId(slotId: number, callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -860,8 +896,8 @@ setPrimarySlotId(slotId: number, callback: AsyncCallback): void ```js let slotId = 0; -radio.setPrimarySlotId(slotId, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +radio.setPrimarySlotId(slotId, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -872,7 +908,7 @@ setPrimarySlotId\(slotId: number\): Promise\ 设置主卡所在卡槽的索引号。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -892,6 +928,8 @@ setPrimarySlotId\(slotId: number\): Promise\ **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -907,9 +945,9 @@ setPrimarySlotId\(slotId: number\): Promise\ ```js let slotId = 0; let promise = radio.setPrimarySlotId(slotId); -promise.then(data => { - console.log(`setPrimarySlotId success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`setPrimarySlotId success.`); +}).catch((err) => { console.log(`setPrimarySlotId failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -920,7 +958,7 @@ getIMEI(callback: AsyncCallback): void 获取设备的指定卡槽的IMEI。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -934,6 +972,8 @@ getIMEI(callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -958,7 +998,7 @@ getIMEI(slotId: number, callback: AsyncCallback): void 获取设备的指定卡槽的IMEI。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -973,6 +1013,8 @@ getIMEI(slotId: number, callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -998,7 +1040,7 @@ getIMEI(slotId?: number): Promise 获取设备的指定卡槽的IMEI。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -1018,6 +1060,8 @@ getIMEI(slotId?: number): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1045,7 +1089,7 @@ getMEID(callback: AsyncCallback): void 获取设备的指定卡槽的MEID。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -1059,6 +1103,8 @@ getMEID(callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1083,7 +1129,7 @@ getMEID(slotId: number, callback: AsyncCallback): void 获取设备的指定卡槽的MEID。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -1098,6 +1144,8 @@ getMEID(slotId: number, callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1123,7 +1171,7 @@ getMEID(slotId?: number): Promise 获取设备的指定卡槽的MEID。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -1143,6 +1191,8 @@ getMEID(slotId?: number): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1170,7 +1220,7 @@ getUniqueDeviceId(callback: AsyncCallback): void 获取设备的指定卡槽的唯一设备ID。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -1184,6 +1234,8 @@ getUniqueDeviceId(callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1208,7 +1260,7 @@ getUniqueDeviceId(slotId: number, callback: AsyncCallback): void 获取设备的指定卡槽的唯一设备ID。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -1223,6 +1275,8 @@ getUniqueDeviceId(slotId: number, callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1248,7 +1302,7 @@ getUniqueDeviceId(slotId?: number): Promise 获取设备的指定卡槽的唯一设备ID。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -1268,6 +1322,8 @@ getUniqueDeviceId(slotId?: number): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1295,7 +1351,7 @@ sendUpdateCellLocationRequest\(callback: AsyncCallback\): void 发送更新小区位置请求。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.LOCATION 和 ohos.permission.APPROXIMATELY_LOCATION @@ -1309,6 +1365,8 @@ sendUpdateCellLocationRequest\(callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1321,8 +1379,8 @@ sendUpdateCellLocationRequest\(callback: AsyncCallback\): void **示例:** ```js -radio.sendUpdateCellLocationRequest((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +radio.sendUpdateCellLocationRequest((err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1332,7 +1390,7 @@ sendUpdateCellLocationRequest\(slotId: number, callback: AsyncCallback\): 发送更新小区位置请求。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.LOCATION 和 ohos.permission.APPROXIMATELY_LOCATION @@ -1347,6 +1405,8 @@ sendUpdateCellLocationRequest\(slotId: number, callback: AsyncCallback\): **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1360,8 +1420,8 @@ sendUpdateCellLocationRequest\(slotId: number, callback: AsyncCallback\): ```js let slotId = 0; -radio.sendUpdateCellLocationRequest(slotId, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +radio.sendUpdateCellLocationRequest(slotId, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1371,7 +1431,7 @@ sendUpdateCellLocationRequest\(slotId?: number): Promise 发送更新小区位置请求。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.LOCATION 和 ohos.permission.APPROXIMATELY_LOCATION @@ -1391,6 +1451,8 @@ sendUpdateCellLocationRequest\(slotId?: number): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1404,10 +1466,9 @@ sendUpdateCellLocationRequest\(slotId?: number): Promise ```js let slotId = 0; -let promise = radio.sendUpdateCellLocationRequest(slotId); -promise.then(data => { - console.log(`sendUpdateCellLocationRequest success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +radio.sendUpdateCellLocationRequest(slotId).then(() => { + console.log(`sendUpdateCellLocationRequest success.`); +}).catch((err) => { console.log(`sendUpdateCellLocationRequest failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1418,7 +1479,7 @@ getCellInformation(callback: AsyncCallback>): void 获取小区信息。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.LOCATION 和 ohos.permission.APPROXIMATELY_LOCATION @@ -1432,6 +1493,8 @@ getCellInformation(callback: AsyncCallback>): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1456,7 +1519,7 @@ getCellInformation(slotId: number, callback: AsyncCallback\> 获取小区信息。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.LOCATION 和 ohos.permission.APPROXIMATELY_LOCATION @@ -1516,6 +1581,8 @@ getCellInformation(slotId?: number): Promise\> **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1543,7 +1610,7 @@ setNetworkSelectionMode\(options: NetworkSelectionModeOptions, callback: AsyncCa 设置网络选择模式。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -1558,6 +1625,8 @@ setNetworkSelectionMode\(options: NetworkSelectionModeOptions, callback: AsyncCa **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1582,8 +1651,8 @@ let networkSelectionModeOptions={ networkInformation: networkInformation, resumeSelection: true } -radio.setNetworkSelectionMode(networkSelectionModeOptions, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +radio.setNetworkSelectionMode(networkSelectionModeOptions, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1593,7 +1662,7 @@ setNetworkSelectionMode\(options: NetworkSelectionModeOptions\): Promise 设置网络选择模式。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -1613,6 +1682,8 @@ setNetworkSelectionMode\(options: NetworkSelectionModeOptions\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1638,9 +1709,9 @@ let networkSelectionModeOptions={ resumeSelection: true } let promise = radio.setNetworkSelectionMode(networkSelectionModeOptions); -promise.then(data => { - console.log(`setNetworkSelectionMode success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`setNetworkSelectionMode success.`); +}).catch((err) => { console.log(`setNetworkSelectionMode failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1651,7 +1722,7 @@ getNetworkSearchInformation\(slotId: number, callback: AsyncCallback 获取网络搜索信息。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -1709,6 +1782,8 @@ getNetworkSearchInformation\(slotId: number\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1735,7 +1810,7 @@ getNrOptionMode(callback: AsyncCallback): void 获取Nr选项模式 。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **系统能力**:SystemCapability.Telephony.CoreService @@ -1747,6 +1822,8 @@ getNrOptionMode(callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -1770,7 +1847,7 @@ getNrOptionMode(slotId: number, callback: AsyncCallback): void 获取Nr选项模式 。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **系统能力**:SystemCapability.Telephony.CoreService @@ -1783,6 +1860,8 @@ getNrOptionMode(slotId: number, callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -1807,7 +1886,7 @@ getNrOptionMode(slotId?: number): Promise 获取Nr选项模式 。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **系统能力**:SystemCapability.Telephony.CoreService @@ -1825,6 +1904,8 @@ getNrOptionMode(slotId?: number): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -1851,7 +1932,7 @@ turnOnRadio(callback: AsyncCallback): void 打开Radio。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -1865,6 +1946,8 @@ turnOnRadio(callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1877,8 +1960,8 @@ turnOnRadio(callback: AsyncCallback): void **示例:** ```js -radio.turnOnRadio((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +radio.turnOnRadio((err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1889,7 +1972,7 @@ turnOnRadio(slotId: number, callback: AsyncCallback): void 打开Radio。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -1904,6 +1987,8 @@ turnOnRadio(slotId: number, callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1917,8 +2002,8 @@ turnOnRadio(slotId: number, callback: AsyncCallback): void ```js let slotId = 0; -radio.turnOnRadio(slotId, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +radio.turnOnRadio(slotId, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1929,7 +2014,7 @@ turnOnRadio(slotId?: number): Promise 打开Radio。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -1949,6 +2034,8 @@ turnOnRadio(slotId?: number): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1962,10 +2049,9 @@ turnOnRadio(slotId?: number): Promise ```js let slotId = 0; -let promise = radio.turnOnRadio(slotId); -promise.then(data => { - console.log(`turnOnRadio success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +radio.turnOnRadio(slotId).then(() => { + console.log(`turnOnRadio success.`); +}).catch((err) => { console.error(`turnOnRadio failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1976,7 +2062,7 @@ turnOffRadio(callback: AsyncCallback): void 关闭Radio。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -1990,6 +2076,8 @@ turnOffRadio(callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2002,8 +2090,8 @@ turnOffRadio(callback: AsyncCallback): void **示例:** ```js -radio.turnOffRadio((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +radio.turnOffRadio((err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2014,7 +2102,7 @@ turnOffRadio(slotId: number, callback: AsyncCallback): void 关闭Radio。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -2029,6 +2117,8 @@ turnOffRadio(slotId: number, callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2042,8 +2132,8 @@ turnOffRadio(slotId: number, callback: AsyncCallback): void ```js let slotId = 0; -radio.turnOffRadio(slotId, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +radio.turnOffRadio(slotId, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2054,7 +2144,7 @@ turnOffRadio(slotId?: number): Promise 关闭Radio。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -2074,6 +2164,8 @@ turnOffRadio(slotId?: number): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2087,10 +2179,9 @@ turnOffRadio(slotId?: number): Promise ```js let slotId = 0; -let promise = radio.turnOffRadio(slotId); -promise.then(data => { - console.log(`turnOffRadio success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +radio.turnOffRadio(slotId).then(() => { + console.log(`turnOffRadio success.`); +}).catch((err) => { console.error(`turnOffRadio failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -2101,7 +2192,7 @@ setPreferredNetwork\(slotId: number, networkMode: PreferredNetworkMode, callback 设置首选网络。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -2117,6 +2208,8 @@ setPreferredNetwork\(slotId: number, networkMode: PreferredNetworkMode, callback **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2129,8 +2222,9 @@ setPreferredNetwork\(slotId: number, networkMode: PreferredNetworkMode, callback **示例:** ```js -radio.setPreferredNetwork(0, 1, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +let slotId = 0; +radio.setPreferredNetwork(slotId, radio.PreferredNetworkMode.PREFERRED_NETWORK_MODE_GSM, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2140,7 +2234,7 @@ setPreferredNetwork(slotId: number, networkMode: PreferredNetworkMode): Promise< 设置首选网络。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -2161,7 +2255,9 @@ setPreferredNetwork(slotId: number, networkMode: PreferredNetworkMode): Promise< **错误码:** -| 错误码ID | 错误信息 | +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + +| 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | | 401 | Parameter error. | @@ -2173,10 +2269,10 @@ setPreferredNetwork(slotId: number, networkMode: PreferredNetworkMode): Promise< **示例:** ```js -let promise = radio.setPreferredNetwork(0, 1); -promise.then(data => { - console.log(`setPreferredNetwork success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +let slotId = 0; +radio.setPreferredNetwork(slotId, radio.PreferredNetworkMode.PREFERRED_NETWORK_MODE_GSM).then(() => { + console.log(`setPreferredNetwork success.`); +}).catch((err) => { console.log(`setPreferredNetwork failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -2187,7 +2283,7 @@ getPreferredNetwork\(slotId: number, callback: AsyncCallback 获取首选网络。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -2245,6 +2343,8 @@ getPreferredNetwork(slotId: number): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2271,7 +2371,7 @@ getImsRegInfo(slotId: number, imsType: ImsServiceType, callback: AsyncCallback 获取特定IMS服务类型的IMS注册状态信息。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -2331,6 +2433,8 @@ getImsRegInfo(slotId: number, imsType: ImsServiceType): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2357,7 +2461,7 @@ on(type: 'imsRegStateChange', slotId: number, imsType: ImsServiceType, callback: 订阅imsRegStateChange事件,使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -2374,6 +2478,8 @@ on(type: 'imsRegStateChange', slotId: number, imsType: ImsServiceType, callback: **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2397,7 +2503,7 @@ off(type: 'imsRegStateChange', slotId: number, imsType: ImsServiceType, callback 取消订阅imsRegStateChange事件,使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -2407,13 +2513,15 @@ off(type: 'imsRegStateChange', slotId: number, imsType: ImsServiceType, callback | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------ | ---- | -------------------------------------- | -| type | string | 是 | 通话结束时取消监听通话详情的变化。 | +| type | string | 是 | 取消监听IMS注册状态的变化。 | | slotId | number | 是 | 卡槽ID。
- 0:卡槽1
- 1:卡槽2 | | imsType | [ImsServiceType](#imsservicetype9) | 是 | IMS服务类型。 | | callback | Callback<[ImsRegInfo](#imsreginfo9)> | 否 | 回调函数。 | **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2435,7 +2543,7 @@ radio.off('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, data => { 无线接入技术。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 值 | 说明 | | ------------------------- | ---- | ------------------------------------------------------------ | @@ -2458,7 +2566,7 @@ radio.off('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, data => { 网络信号强度信息对象。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 类型 | 必填 | 说明 | | --------------- | --------------------------- | ---- | ------------------ | @@ -2470,7 +2578,7 @@ radio.off('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, data => { 网络类型。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 值 | 说明 | | -------------------- | ---- | ------------------------------------------------------------ | @@ -2486,7 +2594,7 @@ radio.off('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, data => { 网络注册状态。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 类型 | 必填 | 说明 | | -------------------- | ----------------------------------- | ---- | ------------------------------------------------------------ | @@ -2505,7 +2613,7 @@ radio.off('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, data => { 网络注册状态。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 值 | 说明 | | ----------------------------- | ---- | -------------------------- | @@ -2519,7 +2627,7 @@ radio.off('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, data => { 非独立组网状态。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 值 | 说明 | | -------------------------- | ---- | ---------------------------------------------------------- | @@ -2535,7 +2643,7 @@ radio.off('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, data => { 选网模式。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 值 | 说明 | | --------------------------- | ---- | -------------- | @@ -2547,9 +2655,9 @@ radio.off('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, data => { 首选网络模式。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 值 | 说明 | | --------------------------------------------------------- | ---- | --------------------------------------------- | @@ -2592,9 +2700,9 @@ radio.off('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, data => { 小区信息。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 类型 | 必填 | 说明 | | ----------------- | --------------------------------------- | ---- | ------------------------------------------------------------ | @@ -2608,9 +2716,9 @@ radio.off('imsRegStateChange', 0, radio.ImsServiceType.TYPE_VIDEO, data => { CDMA小区信息。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 类型 | 必填 | 说明 | | --------- | ------ | ---- | ------------ | @@ -2624,9 +2732,9 @@ CDMA小区信息。 GSM小区信息。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | -------------------- | @@ -2641,9 +2749,9 @@ GSM小区信息。 LTE小区信息。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 类型 | 必填 | 说明 | | ------------- | ------- | ---- | ----------------------- | @@ -2660,9 +2768,9 @@ LTE小区信息。 NR小区信息。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 类型 | 必填 | 说明 | | ------- | ------ | ---- | ---------------- | @@ -2677,9 +2785,9 @@ NR小区信息。 TD-SCDMA小区信息。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | ------------ | @@ -2694,9 +2802,9 @@ TD-SCDMA小区信息。 WCDMA小区信息。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | ------------ | @@ -2711,9 +2819,9 @@ WCDMA小区信息。 NR的选择模式。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 值 | 说明 | | -------------------- | ---- | ---------------------------------- | @@ -2726,9 +2834,9 @@ NR的选择模式。 网络搜索结果。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 类型 | 必填 | 说明 | | ---------------------- | ------------------------------------------------- | ---- | -------------- | @@ -2739,9 +2847,9 @@ NR的选择模式。 网络信息。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 类型 | 必填 | 说明 | | --------------- | --------------------------------------------------- | ---- | -------------- | @@ -2754,9 +2862,9 @@ NR的选择模式。 网络信息状态。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 值 | 说明 | | ----------------- | ---- | ---------------- | @@ -2769,9 +2877,9 @@ NR的选择模式。 网络选择模式选项。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 类型 | 必填 | 说明 | | ------------------ | --------------------------------------------- | ---- | -------------------------------------- | @@ -2784,9 +2892,9 @@ NR的选择模式。 IMS注册状态。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 值 | 说明 | | ---------------- | ---- | -------- | @@ -2797,9 +2905,9 @@ IMS注册状态。 IMS注册技术。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 值 | 说明 | | ----------------------- | ---- | --------------- | @@ -2812,9 +2920,9 @@ IMS注册技术。 IMS注册信息。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 类型 | 必填 | 说明 | | ----------- | ---------------------------- | ---- | ------------- | @@ -2825,9 +2933,9 @@ IMS注册信息。 IMS服务类型。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 值 | 说明 | | ---------- | ---- | ---------- | diff --git a/zh-cn/application-dev/reference/apis/js-apis-reminderAgentManager.md b/zh-cn/application-dev/reference/apis/js-apis-reminderAgentManager.md index 4f4b71d51187dc14c92a6d3992a07ec6a3b8b95b..1b48b9b9e9a7539a3831299b54a7b2a3588d01d3 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-reminderAgentManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-reminderAgentManager.md @@ -570,6 +570,7 @@ try { | -------- | -------- | -------- | | ACTION_BUTTON_TYPE_CLOSE | 0 | 表示关闭提醒的按钮。 | | ACTION_BUTTON_TYPE_SNOOZE | 1 | 表示延迟提醒的按钮。 | +| ACTION_BUTTON_TYPE_CUSTOM10+ | 2 | 表示自定义的按钮。(系统接口) | ## ReminderType @@ -595,18 +596,19 @@ try { | -------- | -------- | -------- | -------- | | title | string | 是 | 按钮显示的标题。 | | type | [ActionButtonType](#actionbuttontype) | 是 | 按钮的类型。 | +| wantAgent10+ | [WantAgent](#wantagent) | 否 | 点击按钮跳转的ability信息。(系统接口) | ## WantAgent -点击提醒通知后跳转的目标`ability`信息。 +跳转目标的ability信息。 **系统能力**:`SystemCapability.Notification.ReminderAgent` | 名称 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| pkgName | string | 是 | 指明点击提醒通知栏后跳转的目标HAP名。 | -| abilityName | string | 是 | 指明点击提醒通知栏后跳转的目标ability名称。 | +| pkgName | string | 是 | 指明跳转的目标包名。 | +| abilityName | string | 是 | 指明跳转的目标ability名称。 | ## MaxScreenWantAgent @@ -617,7 +619,7 @@ try { | 名称 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| pkgName | string | 是 | 指明提醒到达时自动拉起的目标HAP名(如果设备在使用中,则只弹出通知横幅框)。 | +| pkgName | string | 是 | 指明提醒到达时自动拉起的目标包名(如果设备在使用中,则只弹出通知横幅框)。 | | abilityName | string | 是 | 指明提醒到达时自动拉起的目标ability名(如果设备在使用中,则只弹出通知横幅框)。 | @@ -630,18 +632,20 @@ try { | 名称 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | reminderType | [ReminderType](#remindertype) | 是 | 指明提醒类型。 | -| actionButton | [ActionButton](#actionbutton) | 否 | 弹出的提醒通知栏中显示的按钮(参数可选,支持0/1/2个按钮)。 | +| actionButton | [ActionButton](#actionbutton) | 否 | 弹出的提醒通知栏中显示的按钮(参数可选。普通应用:最多支持两个按钮,系统应用:API9最多支持两个按钮,API10及以后最多支持三个按钮。)。 | | wantAgent | [WantAgent](#wantagent) | 否 | 点击通知后需要跳转的目标ability信息。 | | maxScreenWantAgent | [MaxScreenWantAgent](#maxscreenwantagent) | 否 | 提醒到达时跳转的目标包。如果设备正在使用中,则弹出一个通知框。 | | ringDuration | number | 否 | 指明响铃时长(单位:秒),默认1秒。 | | snoozeTimes | number | 否 | 指明延迟提醒次数,默认0次。 | -| timeInterval | number | 否 | 执行延迟提醒间隔(单位:秒),默认0秒。 | +| timeInterval | number | 否 | 执行延迟提醒间隔(单位:秒),最少5分钟。 | | title | string | 否 | 指明提醒标题。 | | content | string | 否 | 指明提醒内容。 | | expiredContent | string | 否 | 指明提醒过期后需要显示的内容。 | | snoozeContent | string | 否 | 指明延迟提醒时需要显示的内容。 | | notificationId | number | 否 | 指明提醒使用的通知的id号,相同id号的提醒会覆盖。 | -| slotType | [notification.SlotType](js-apis-notification.md#slottype) | 否 | 指明提醒的slot类型。 | +| slotType | [notification.SlotType](js-apis-notificationManager.md#slottype) | 否 | 指明提醒的slot类型。 | +| tapDismissed10+ | boolean | 否 | 通知是否自动清除,同[NotificationRequest.tapDismissed](js-apis-inner-notification-notificationRequest.md#notificationrequest)。 | +| autoDeletedTime10+ | number | 否 | 自动清除的时间,同[NotificationRequest.autoDeletedTime](js-apis-inner-notification-notificationRequest.md#notificationrequest)。 | ## ReminderRequestCalendar diff --git a/zh-cn/application-dev/reference/apis/js-apis-request.md b/zh-cn/application-dev/reference/apis/js-apis-request.md index dcf6443aab41e058fb9a23741c3200da1d5e7b4d..8dc9917ec6cc08bb6befd35b0235f4ff96589a7b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-request.md +++ b/zh-cn/application-dev/reference/apis/js-apis-request.md @@ -17,26 +17,8 @@ import request from '@ohos.request'; ## 限制与约束 -在开发FA模型下的应用程序时, 默认支持https,如果要支持http,需要在config.json里增加network标签,属性标识 "cleartextTraffic": true。即: - -```js -var config = { - "deviceConfig": { - "default": { - "network": { - "cleartextTraffic": true - } - //... - } - } -} -``` - -在开发stage模型下的应用程序时,不涉及属性标识 "cleartextTraffic"。 - -下载服务器需要支持HTTP协议的head方法,能够通过Content-length获取下载数据大小,否则下载任务失败,可通过[on('fail')7+](#onfail7)查看失败原因。 - 上传目前仅支持HTTP请求,不支持HTTPS。 +下载服务器需要支持HTTP协议的head方法,能够通过Content-length获取下载数据大小,否则下载任务失败,可通过[on('fail')7+](#onfail7)查看失败原因。 ## 常量 @@ -97,7 +79,7 @@ var config = { uploadFile(context: BaseContext, config: UploadConfig): Promise<UploadTask> -上传,异步方法,使用promise形式返回结果。 +上传,异步方法,使用promise形式返回结果。通过[on('complete'|'fail')9+](#oncomplete--fail9)可获取任务上传时的错误信息。 **需要权限**:ohos.permission.INTERNET @@ -151,7 +133,7 @@ uploadFile(context: BaseContext, config: UploadConfig): Promise<UploadTask> uploadFile(context: BaseContext, config: UploadConfig, callback: AsyncCallback<UploadTask>): void -上传,异步方法,使用callback形式返回结果。 +上传,异步方法,使用callback形式返回结果。通过[on('complete'|'fail')9+](#oncomplete--fail9)可获取任务上传时的错误信息。 **需要权限**:ohos.permission.INTERNET @@ -635,6 +617,7 @@ remove(callback: AsyncCallback<boolean>): void ``` ## UploadConfig +上传任务的配置信息。 **需要权限**:ohos.permission.INTERNET @@ -649,6 +632,7 @@ remove(callback: AsyncCallback<boolean>): void | data | Array<[RequestData](#requestdata)> | 是 | 请求的表单数据。 | ## TaskState9+ +上传任务信息,[on('complete' | 'fail')9+](#oncomplete--fail9)和[off('complete' | 'fail')9+](#offcomplete--fail9)接口的回调参数。 **需要权限**:ohos.permission.INTERNET @@ -661,6 +645,7 @@ remove(callback: AsyncCallback<boolean>): void | message | string | 是 | 上传任务结果描述信息 | ## File +[UploadConfig](#uploadconfig)中的文件列表。 **需要权限**:ohos.permission.INTERNET @@ -675,6 +660,7 @@ remove(callback: AsyncCallback<boolean>): void ## RequestData +[UploadConfig](#uploadconfig)中的表单数据。 **需要权限**:ohos.permission.INTERNET @@ -689,7 +675,8 @@ remove(callback: AsyncCallback<boolean>): void downloadFile(context: BaseContext, config: DownloadConfig): Promise<DownloadTask> -下载,异步方法,使用promise形式返回结果。 +下载,异步方法,使用promise形式返回结果。通过[on('complete'|'pause'|'remove')7+](#oncompletepauseremove7)可获取任务下载时的状态信息,包括任务完成、暂停或移除。通过[on('fail')7+](#onfail7)可获取任务下载时的错误信息。 + **需要权限**:ohos.permission.INTERNET @@ -737,7 +724,8 @@ downloadFile(context: BaseContext, config: DownloadConfig): Promise<DownloadT downloadFile(context: BaseContext, config: DownloadConfig, callback: AsyncCallback<DownloadTask>): void; -下载,异步方法,使用callback形式返回结果。 +下载,异步方法,使用callback形式返回结果。通过[on('complete'|'pause'|'remove')7+](#oncompletepauseremove7)可获取任务下载时的状态信息,包括任务完成、暂停或移除。通过[on('fail')7+](#onfail7)可获取任务下载时的错误信息。 + **需要权限**:ohos.permission.INTERNET @@ -1675,6 +1663,7 @@ resume(callback: AsyncCallback<void>): void ## DownloadConfig +下载任务的配置信息。 **需要权限**:ohos.permission.INTERNET @@ -1687,13 +1676,14 @@ resume(callback: AsyncCallback<void>): void | enableMetered | boolean | 否 | 设置是否允许在按流量计费的连接下下载。
- true:是
- false:否 | | enableRoaming | boolean | 否 | 设置是否允许在漫游网络中下载。
- true:是
- false:否| | description | string | 否 | 设置下载会话的描述。 | -| filePath7+ | string | 否 | 设置下载路径。
- filePath:'/data/storage/el2/base/haps/entry/files/test.txt':将文件存储在绝对路径下。
- FA模型下使用[context](js-apis-inner-app-context.md#contextgetcachedir) 获取应用存储路径,比如:'${featureAbility.getContext().getFilesDir()}/test.txt',并将文件存储在此路径下。
- Stage模型下使用[AbilityContext](js-apis-inner-application-context.md) 类获取文件路径,比如:'${globalThis.abilityContext.tempDir}/test.txt'并将文件存储在此路径下。| +| filePath7+ | string | 否 | 设置下载路径。
- filePath:'/data/storage/el2/base/haps/entry/files/test.txt':将文件存储在绝对路径下。
- FA模型下使用[context](js-apis-inner-app-context.md#contextgetcachedir) 获取应用存储路径,比如:\`${featureAbility.getContext().getFilesDir()}/test.txt\`,并将文件存储在此路径下。
- Stage模型下使用[AbilityContext](js-apis-inner-application-context.md) 类获取文件路径,比如:\`${globalThis.abilityContext.tempDir}/test.txt\`,并将文件存储在此路径下。| | networkType | number | 否 | 设置允许下载的网络类型。
- NETWORK_MOBILE:0x00000001
- NETWORK_WIFI:0x00010000| | title | string | 否 | 设置下载任务名称。 | | background9+ | boolean | 否 | 后台任务通知开关,开启后可在通知中显示下载状态。 | ## DownloadInfo7+ +下载任务信息,[query(deprecated)](#querydeprecated-1)接口的回调参数。 **需要权限**:ohos.permission.INTERNET @@ -1711,4 +1701,6 @@ resume(callback: AsyncCallback<void>): void | downloadTitle | string | 是 | 下载任务名称。 | | downloadTotalBytes | number | 是 | 下载的文件的总大小(int bytes)。 | | description | string | 是 | 待下载文件的描述信息。 | -| downloadedBytes | number | 是 | 实时下载大小(int  bytes)。 | \ No newline at end of file +| downloadedBytes | number | 是 | 实时下载大小(int  bytes)。 | + + \ No newline at end of file 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 a9730a9f75e06f699156c449338d52ebb8c1d855..8c2d6a082ca0b7d5ea317815f04494b1b9447444 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 @@ -1234,9 +1234,9 @@ getPluralStringValue(resource: Resource, num: number, callback: AsyncCallback< ``` -### getPluralString9+ +### getPluralStringValue9+ -getPluralString(resource: Resource, num: number): Promise<string> +getPluralStringValue(resource: Resource, num: number): Promise<string> 根据指定数量获取对指定resource对象表示的单复数字符串,使用Promise形式返回字符串。 @@ -1273,10 +1273,10 @@ getPluralString(resource: Resource, num: number): Promise<string> id: $r('app.plural.test').id }; try { - this.context.resourceManager.getPluralString(resource, 1).then(value => { + this.context.resourceManager.getPluralStringValue(resource, 1).then(value => { let str = value; }).catch(error => { - console.log("getPluralString promise error is " + error); + console.log("getPluralStringValue promise error is " + error); }); } catch (error) { console.error(`callback getPluralStringValue failed, error code: ${error.code}, message: ${error.message}.`) @@ -1543,7 +1543,7 @@ closeRawFd(path: string, callback: AsyncCallback<void>): void ``` -### closeRawFd8+ +### closeRawFd9+ closeRawFd(path: string): Promise<void> @@ -2057,6 +2057,47 @@ getStringSync(resId: number): string } ``` +### getStringSync10+ + +getStringSync(resId: number, ...args: Array): string + +用户获取指定资源ID对应的字符串,根据args参数进行格式化,使用同步方式返回相应字符串。 + +**系统能力**:SystemCapability.Global.ResourceManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----- | ------ | ---- | ----- | +| resId | number | 是 | 资源ID值 | +| args | Array | 否 | 格式化字符串资源参数
支持参数类型:
-%d、%f、%s、%%
说明:%%转译符,转译%
举例:%%d格式化后为%d字符串| + +**返回值:** + +| 类型 | 说明 | +| ------ | ---------------------------- | +| string | 资源ID值对应的格式化字符串| + +以下错误码的详细介绍请参见[资源管理错误码](../errorcodes/errorcode-resource-manager.md)。 + +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ----------------------------------------------- | +| 9001001 | If the resId invalid. | +| 9001002 | If the resource not found by resId. | +| 9001006 | If the resource re-ref too much. | +| 9001007 | If the resource obtained by resId formatting error. | + +**示例:** + ```ts + try { + this.context.resourceManager.getStringSync($r('app.string.test').id, "format string", 10, 98.78); + } catch (error) { + console.error(`getStringSync failed, error code: ${error.code}, message: ${error.message}.`) + } + ``` + ### getStringSync9+ getStringSync(resource: Resource): string @@ -2101,6 +2142,52 @@ getStringSync(resource: Resource): string } ``` +### getStringSync10+ + +getStringSync(resource: Resource, ...args: Array): string + +用户获取指定resource对象对应的字符串,根据args参数进行格式化,使用同步方式返回相应字符串。 + +**系统能力**:SystemCapability.Global.ResourceManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | ---- | +| resource | [Resource](#resource9) | 是 | 资源信息 | +| args | Array | 否 | 格式化字符串资源参数
支持参数类型:
-%d、%f、%s、%%
说明:%%转译符,转译%
举例:%%d格式化后为%d字符串| + +**返回值:** + +| 类型 | 说明 | +| ------ | ---------------------------- | +| string | resource对象对应的格式化字符串| + +以下错误码的详细介绍请参见[资源管理错误码](../errorcodes/errorcode-resource-manager.md)。 + +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 9001001 | If the resId invalid. | +| 9001002 | If the resource not found by resId. | +| 9001006 | If the resource re-ref too much. | +| 9001007 | If the resource obtained by resId formatting error. | + +**示例:** + ```ts + let resource = { + bundleName: "com.example.myapplication", + moduleName: "entry", + id: $r('app.string.test').id + }; + try { + this.context.resourceManager.getStringSync(resource, "format string", 10, 98.78); + } catch (error) { + console.error(`getStringSync failed, error code: ${error.code}, message: ${error.message}.`) + } + ``` + ### getStringByNameSync9+ getStringByNameSync(resName: string): string @@ -2140,6 +2227,47 @@ getStringByNameSync(resName: string): string } ``` +### getStringByNameSync10+ + +getStringByNameSync(resName: string, ...args: Array): string + +用户获取指定资源名称对应的字符串,根据args参数进行格式化,使用同步方式返回相应字符串。 + +**系统能力**:SystemCapability.Global.ResourceManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | ---- | +| resName | string | 是 | 资源名称 | +| args | Array | 否 | 格式化字符串资源参数
支持参数类型:
-%d、%f、%s、%%
说明:%%转译符,转译%
举例:%%d格式化后为%d字符串| + +**返回值:** + +| 类型 | 说明 | +| ------ | ---------------------------- | +| string | 资源名称对应的格式化字符串| + +以下错误码的详细介绍请参见[资源管理错误码](../errorcodes/errorcode-resource-manager.md)。 + +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 9001003 | If the resName invalid. | +| 9001004 | If the resource not found by resName. | +| 9001006 | If the resource re-ref too much. | +| 9001008 | If the resource obtained by resName formatting error. | + +**示例:** + ```ts + try { + this.context.resourceManager.getStringByNameSync("test", "format string", 10, 98.78); + } catch (error) { + console.error(`getStringByNameSync failed, error code: ${error.code}, message: ${error.message}.`) + } + ``` + ### getBoolean9+ getBoolean(resId: number): boolean @@ -2278,8 +2406,8 @@ getNumber(resId: number): number **返回值:** | 类型 | 说明 | -| ------ | ---------- | -| number | 资源ID值对应的数值 | +| ------ | ---------- | +| number | 资源ID值对应的数值。Integer对应的是原数值,float对应的是真实像素点值 | 以下错误码的详细介绍请参见[资源管理错误码](../errorcodes/errorcode-resource-manager.md)。 @@ -2294,13 +2422,13 @@ getNumber(resId: number): number **示例:** ```ts try { - this.context.resourceManager.getNumber($r('app.integer.integer_test').id); + this.context.resourceManager.getNumber($r('app.integer.integer_test').id); // integer对应返回的是原数值 } catch (error) { console.error(`getNumber failed, error code: ${error.code}, message: ${error.message}.`) } try { - this.context.resourceManager.getNumber($r('app.float.float_test').id); + this.context.resourceManager.getNumber($r('app.float.float_test').id); // float对应返回的是真实像素点值 } catch (error) { console.error(`getNumber failed, error code: ${error.code}, message: ${error.message}.`) } @@ -2324,7 +2452,7 @@ getNumber(resource: Resource): number | 类型 | 说明 | | ------ | --------------- | -| number | resource对象对应的数值 | +| number | resource对象对应的数值。Integer对应的是原数值,float对应的是真实像素点值 | 以下错误码的详细介绍请参见[资源管理错误码](../errorcodes/errorcode-resource-manager.md)。 @@ -2344,7 +2472,7 @@ getNumber(resource: Resource): number id: $r('app.integer.integer_test').id }; try { - this.context.resourceManager.getNumber(resource); + this.context.resourceManager.getNumber(resource);// integer对应返回的是原数值, float对应返回的是真实像素点值 } catch (error) { console.error(`getNumber failed, error code: ${error.code}, message: ${error.message}.`) } @@ -2395,6 +2523,142 @@ getNumberByName(resName: string): number } ``` +### getDrawableDescriptor10+ + +getDrawableDescriptor(resId: number, density?: number): DrawableDescriptor; + +用户获取指定资源ID对应的DrawableDescriptor对象,使用同步方式返回资源对应的DrawableDescriptor,用于图标的显示。 + +**系统能力**:SystemCapability.Global.ResourceManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ----- | ------ | ---- | ----- | +| resId | number | 是 | 资源ID值 | +| [density](#screendensity) | number | 否 | 资源获取需要的屏幕密度,默认为0 | + +**返回值:** + +| 类型 | 说明 | +| ------ | ---------- | +| DrawableDescriptor | 资源ID值对应的DrawableDescriptor对象 | + +以下错误码的详细介绍请参见[资源管理错误码](../errorcodes/errorcode-resource-manager.md)。 + +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 9001001 | If the resId invalid. | +| 9001002 | If the resource not found by resId. | + +**示例:** + ```ts + try { + this.context.resourceManager.getDrawableDescriptor($r('app.media.icon').id); + } catch (error) { + console.error(`getDrawableDescriptor failed, error code: ${error.code}, message: ${error.message}.`) + } + try { + this.context.resourceManager.getDrawableDescriptor($r('app.media.icon').id, 120); + } catch (error) { + console.error(`getDrawableDescriptor failed, error code: ${error.code}, message: ${error.message}.`) + } + ``` + +### getDrawableDescriptor10+ + +getDrawableDescriptor(resource: Resource, density?: number): DrawableDescriptor; + +用户获取指定resource对应的DrawableDescriptor对象,使用同步方式返回资源对应的DrawableDescriptor,用于图标的显示。 + +**系统能力**:SystemCapability.Global.ResourceManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ---------------------- | ---- | ---- | +| resource | [Resource](#resource9) | 是 | 资源信息 | +| [density](#screendensity) | number | 否 | 资源获取需要的屏幕密度,默认为0 | + +**返回值:** + +| 类型 | 说明 | +| ------- | ----------------- | +| DrawableDescriptor | 资源ID值对应的DrawableDescriptor对象 | + +以下错误码的详细介绍请参见[资源管理错误码](../errorcodes/errorcode-resource-manager.md)。 + +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 9001001 | If the resId invalid. | +| 9001002 | If the resource not found by resId. | + +**示例:** + ```ts + let resource = { + bundleName: "com.example.myapplication", + moduleName: "entry", + id: $r('app.media.icon').id + }; + try { + this.context.resourceManager.getDrawableDescriptor(resource); + } catch (error) { + console.error(`getDrawableDescriptor failed, error code: ${error.code}, message: ${error.message}.`) + } + try { + this.context.resourceManager.getDrawableDescriptor(resource, 120); + } catch (error) { + console.error(`getDrawableDescriptor failed, error code: ${error.code}, message: ${error.message}.`) + } + ``` + +### getDrawableDescriptorByName10+ + +getDrawableDescriptorByName(resName: string, density?: number): DrawableDescriptor; + +用户获取指定资源名称对应的DrawableDescriptor对象,使用同步方式返回资源对应的DrawableDescriptor,用于图标的显示。 + +**系统能力**:SystemCapability.Global.ResourceManager + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | ---- | +| resName | string | 是 | 资源名称 | +| [density](#screendensity) | number | 否 | 资源获取需要的屏幕密度,默认为0 | + +**返回值:** + +| 类型 | 说明 | +| ------ | --------- | +| DrawableDescriptor | 资源ID值对应的DrawableDescriptor对象 | + +以下错误码的详细介绍请参见[资源管理错误码](../errorcodes/errorcode-resource-manager.md)。 + +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 9001003 | If the resName invalid. | +| 9001004 | If the resource not found by resName. | + +**示例:** + ```ts + try { + this.context.resourceManager.getDrawableDescriptorByName('icon'); + } catch (error) { + console.error(`getDrawableDescriptor failed, error code: ${error.code}, message: ${error.message}.`) + } + try { + this.context.resourceManager.getDrawableDescriptorByName('icon', 120); + } catch (error) { + console.error(`getDrawableDescriptor failed, error code: ${error.code}, message: ${error.message}.`) + } + ``` ### getString(deprecated) diff --git a/zh-cn/application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md b/zh-cn/application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md index be9f645ab42c723e38cbb7e8f38876424841afe9..4afbde5bb95dc7df32b41f8d62c9cb42b800e960 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md @@ -233,7 +233,7 @@ startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: Want | 参数名 | 类型 | 必填 | 说明 | | --------- | ---------------------------------- | ---- | ---------------------------------------- | -| context | Context | 是 | 应用运行的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 | +| context | Context | 是 | 应用运行的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-application-context.md)。 | | bgMode | [BackgroundMode](#backgroundmode) | 是 | 向系统申请的后台模式。 | | wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | 是 | 通知参数,用于指定长时任务通知点击后跳转的界面。 | | callback | AsyncCallback<void> | 是 | callback形式返回启动长时任务的结果。 | @@ -311,7 +311,7 @@ startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: Want | 参数名 | 类型 | 必填 | 说明 | | --------- | ---------------------------------- | ---- | ---------------------------------------- | -| context | Context | 是 | 应用运行的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 | +| context | Context | 是 | 应用运行的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-application-context.md)。 | | bgMode | [BackgroundMode](#backgroundmode) | 是 | 向系统申请的后台模式。 | | wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | 是 | 通知参数,用于指定长时任务通知点击跳转的界面。 | @@ -388,7 +388,7 @@ stopBackgroundRunning(context: Context, callback: AsyncCallback<void>): vo | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ---------------------------------------- | -| context | Context | 是 | 应用运行的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 | +| context | Context | 是 | 应用运行的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-application-context.md)。 | | callback | AsyncCallback<void> | 是 | callback形式返回启动长时任务的结果。 | **错误码**: @@ -444,7 +444,7 @@ stopBackgroundRunning(context: Context): Promise<void> | 参数名 | 类型 | 必填 | 说明 | | ------- | ------- | ---- | ---------------------------------------- | -| context | Context | 是 | 应用运行的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 | +| context | Context | 是 | 应用运行的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-application-context.md)。 | **返回值**: diff --git a/zh-cn/application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md b/zh-cn/application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md index ee84849081ba394ad675f8591072bd5acde14c25..99f78c4574d577f0717b88258cae25d98602b489 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md +++ b/zh-cn/application-dev/reference/apis/js-apis-resourceschedule-workScheduler.md @@ -130,7 +130,7 @@ getWorkStatus(workId: number, callback : AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------- | ---- | ---------------------------------------- | | workId | number | 是 | work的id。 | -| callback | AsyncCallback\<[WorkInfo](#workinfo)> | 是 | 指定的callback回调方法。如果指定的工作Id有效,则返回从WorkSchedulerService获取的有效工作状态;否则返回null。 | +| callback | AsyncCallback\<[WorkInfo](#workinfo)> | 是 | 指定的callback回调方法。如果指定的工作Id有效,则返回从WorkSchedulerService获取的有效工作状态;否则抛出异常。 | **错误码**: @@ -178,7 +178,7 @@ getWorkStatus(workId: number): Promise\ | 类型 | 说明 | | ------------------------------- | ---------------------------------------- | -| Promise\<[WorkInfo](#workinfo)> | 指定的Promise回调方法。如果指定的工作ID有效,则返回从WorkSchedulerService获取的有效工作状态;否则返回null。 | +| Promise\<[WorkInfo](#workinfo)> | 指定的Promise回调方法。如果指定的工作ID有效,则返回从WorkSchedulerService获取的有效工作状态;否则抛出异常。 | **错误码**: @@ -346,6 +346,7 @@ isLastWorkTimeOut(workId: number, callback : AsyncCallback\): boolean | 9700001 | Memory operation failed. | | 9700002 | Parcel operation failed. | | 9700003 | System service operation failed. | +| 9700004 | Checking workInfo failed. | **示例**: @@ -391,6 +392,7 @@ isLastWorkTimeOut(workId: number): Promise\ | 9700001 | Memory operation failed. | | 9700002 | Parcel operation failed. | | 9700003 | System service operation failed. | +| 9700004 | Checking workInfo failed. | **示例**: 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 307b3bd73a7b84c49a2f8cb3f19a2cb9b6829d2e..d5821a1d124d51c927f76909ff723fde6d634b56 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-router.md +++ b/zh-cn/application-dev/reference/apis/js-apis-router.md @@ -362,7 +362,7 @@ replaceUrl(options: RouterOptions, mode: RouterMode, callback: AsyncCallback< | 错误码ID | 错误信息 | | --------- | ------- | -| 100001 | if UI execution context not found, only throw in standard system. | +| 100001 | if can not get the delegate, only throw in standard system. | | 200002 | if the uri is not exist. | **示例:** @@ -395,7 +395,7 @@ back(options?: RouterOptions ): void | 参数名 | 类型 | 必填 | 说明 | | ------- | ------------------------------- | ---- | ------------------------------------------------------------ | -| options | [RouterOptions](#routeroptions) | 否 | 返回页面描述信息,其中参数url指路由跳转时会返回到指定url的界面,如果页面栈上没有url页面,则不响应该情况。如果url未设置,则返回上一页,页面栈里面的page不会回收,出栈后会被回收。 | +| options | [RouterOptions](#routeroptions) | 否 | 返回页面描述信息,其中参数url指路由跳转时会返回到指定url的界面,如果页面栈上没有url页面,则不响应该情况。如果url未设置,则返回上一页,页面不会重新构建,页面栈里面的page不会回收,出栈后会被回收。 | **示例:** @@ -573,8 +573,8 @@ router.getParams(); | 名称 | 说明 | | -------- | ------------------------------------------------------------ | -| Standard | 标准模式。
目标页面会被添加到页面路由栈顶,无论栈中是否存在相同url的页面。
**说明:**不使用路由跳转模式时,按标准模式跳转。 | -| Single | 单实例模式。
如果目标页面的url在页面栈中已经存在同url页面,离栈顶最近的页面会被移动到栈顶,移动后的页面为新建页。
如目标页面的url在页面栈中不存在同url页面,按标准模式跳转。 | +| Standard | 多实例模式,也是默认情况下的跳转模式。
目标页面会被添加到页面栈顶,无论栈中是否存在相同url的页面。
**说明:** 不使用路由跳转模式时,则按照默认的多实例模式进行跳转。 | +| Single | 单实例模式。
如果目标页面的url已经存在于页面栈中,则会将离栈顶最近的同url页面移动到栈顶,该页面成为新建页。
如果目标页面的url在页面栈中不存在同url页面,则按照默认的多实例模式进行跳转。 | ## 完整示例 @@ -597,7 +597,7 @@ export default { // 在detail页面中 export default { onInit() { - console.info('showData1:' + router.getParams()[data1]); + console.info('showData1:' + router.getParams()['data1']); } } ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-rpc.md b/zh-cn/application-dev/reference/apis/js-apis-rpc.md index 4a3af98149c6aef5924d47cb4c0ed1e3285b2086..b5e1808f23bee943f177affcdf7d733e883975a9 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-rpc.md +++ b/zh-cn/application-dev/reference/apis/js-apis-rpc.md @@ -97,9 +97,9 @@ writeRemoteObject(object: [IRemoteObject](#iremoteobject)): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | -------- | ------- | - | 1900008 | proxy or remote object is invalid | - | 1900009 | write data to message sequence failed | + | -------- | -------- | + | 1900008 | proxy or remote object is invalid | + | 1900009 | write data to message sequence failed | **示例:** @@ -138,9 +138,9 @@ readRemoteObject(): IRemoteObject 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900008 | proxy or remote object is invalid | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900008 | proxy or remote object is invalid | + | 1900010 | read data from message sequence failed | **示例:** @@ -180,8 +180,8 @@ writeInterfaceToken(token: string): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900009 | write data to message sequence failed | + | -------- | -------- | + | 1900009 | write data to message sequence failed | **示例:** @@ -214,8 +214,8 @@ readInterfaceToken(): string 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | ----- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** @@ -266,7 +266,7 @@ getCapacity(): number **返回值:** - | 类型 | 说明 | + | 类型 | 说明 | | ------ | ----- | | number | 获取的MessageSequence实例的容量大小。以字节为单位。 | @@ -288,7 +288,7 @@ setSize(size: number): void **参数:** - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | ------ | | size | number | 是 | MessageSequence实例的数据大小。以字节为单位。 | @@ -324,8 +324,8 @@ setCapacity(size: number): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | -------- | ------ | - | 1900011 | parcel memory alloc failed | + | -------- | -------- | + | 1900011 | parcel memory alloc failed | **示例:** @@ -350,7 +350,7 @@ getWritableBytes(): number **返回值:** - | 类型 | 说明 | + | 类型 | 说明 | | ------ | ------ | | number | 获取到的MessageSequence实例的可写字节空间。以字节为单位。 | @@ -376,7 +376,7 @@ getReadableBytes(): number **返回值:** - | 类型 | 说明 | + | 类型 | 说明 | | ------ | ------- | | number | 获取到的MessageSequence实例的可读字节空间。以字节为单位。 | @@ -402,7 +402,7 @@ getReadPosition(): number **返回值:** - | 类型 | 说明 | + | 类型 | 说明 | | ------ | ------ | | number | 返回MessageSequence实例中的当前读取位置。 | @@ -424,7 +424,7 @@ getWritePosition(): number **返回值:** - | 类型 | 说明 | + | 类型 | 说明 | | ------ | ----- | | number | 返回MessageSequence实例中的当前写入位置。 | @@ -447,7 +447,7 @@ rewindRead(pos: number): void **参数:** - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | ------- | | pos | number | 是 | 开始读取数据的目标位置。 | @@ -479,7 +479,7 @@ rewindWrite(pos: number): void **参数:** - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | ----- | | pos | number | 是 | 开始写入数据的目标位置。 | @@ -509,17 +509,17 @@ writeByte(val: number): void **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | ----- | ------ | ---- | ----- | - | val | number | 是 | 要写入的字节值。 | + | 参数名 | 类型 | 必填 | 说明 | + | ------ | ------ | ---- | ----- | + | val | number | 是 | 要写入的字节值。 | **错误码:** 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | -------- | ------- | - | 1900009 | write data to message sequence failed | + | -------- | ------- | + | 1900009 | write data to message sequence failed | **示例:** @@ -543,7 +543,7 @@ readByte(): number **返回值:** - | 类型 | 说明 | + | 类型 | 说明 | | ------ | ----- | | number | 返回字节值。 | @@ -585,16 +585,16 @@ writeShort(val: number): void **参数:** | 参数名 | 类型 | 必填 | 说明 | - | ------ | ------ | --- | --- | - | val | number | 是 | 要写入的短整数值。 | + | ------ | ------ | --- | --- | + | val | number | 是 | 要写入的短整数值。 | **错误码:** 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | ------ | - | 1900009 | write data to message sequence failed | + | -------- | -------- | + | 1900009 | write data to message sequence failed | **示例:** @@ -627,8 +627,8 @@ readShort(): number 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** @@ -668,8 +668,8 @@ writeInt(val: number): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | -------- | ------- | - | 1900009 | write data to message sequence failed | + | -------- | -------- | + | 1900009 | write data to message sequence failed | **示例:** @@ -702,8 +702,8 @@ readInt(): number 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | ------- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** @@ -743,8 +743,8 @@ writeLong(val: number): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | ------- | - | 1900009 | write data to message sequence failed | + | -------- | -------- | + | 1900009 | write data to message sequence failed | **示例:** @@ -777,8 +777,8 @@ readLong(): number 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** @@ -809,17 +809,17 @@ writeFloat(val: number): void **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | ----- | ---- | ---- | ----- | - | val | number | 是 | 要写入的浮点值。 | + | 参数名 | 类型 | 必填 | 说明 | + | ------ | ------ | ---- | ----- | + | val | number | 是 | 要写入的浮点值。 | **错误码:** 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | ------- | - | 1900009 | write data to message sequence failed | + | -------- | -------- | + | 1900009 | write data to message sequence failed | **示例:** @@ -852,8 +852,8 @@ readFloat(): number 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** @@ -893,8 +893,8 @@ writeDouble(val: number): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900009 | write data to message sequence failed | + | -------- | -------- | + | 1900009 | write data to message sequence failed | **示例:** @@ -927,8 +927,8 @@ readDouble(): number 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** @@ -968,8 +968,8 @@ writeBoolean(val: boolean): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | ------- | - | 1900009 | write data to message sequence failed | + | -------- | -------- | + | 1900009 | write data to message sequence failed | **示例:** @@ -1002,8 +1002,8 @@ readBoolean(): boolean 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | -------- | ------- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** @@ -1043,8 +1043,8 @@ writeChar(val: number): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900009 | write data to message sequence failed | + | -------- | -------- | + | 1900009 | write data to message sequence failed | **示例:** @@ -1077,8 +1077,8 @@ readChar(): number 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------ | --------- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** @@ -1118,8 +1118,8 @@ writeString(val: string): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900009 | write data to message sequence failed | + | -------- | -------- | + | 1900009 | write data to message sequence failed | **示例:** @@ -1152,8 +1152,8 @@ readString(): string 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** @@ -1193,8 +1193,8 @@ writeParcelable(val: Parcelable): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900009 | write data to message sequence failed | + | -------- | -------- | + | 1900009 | write data to message sequence failed | **示例:** @@ -1239,16 +1239,16 @@ readParcelable(dataIn: Parcelable): void | 参数名 | 类型 | 必填 | 说明 | | ------ | ------------------------- | ---- | ----------------------------------------- | - | dataIn | Parcelable | 是 | 需要从MessageSequence读取成员变量的对象。 | + | dataIn | Parcelable | 是 | 需要从MessageSequence读取成员变量的对象。 | **错误码:** 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | -------- | ------- | - | 1900010 | read data from message sequence failed | - | 1900012 | call js callback function failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | + | 1900012 | call js callback function failed | **示例:** @@ -1302,8 +1302,8 @@ writeByteArray(byteArray: number[]): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900009 | write data to message sequence failed | + | -------- | -------- | + | 1900009 | write data to message sequence failed | **示例:** @@ -1337,8 +1337,8 @@ readByteArray(dataIn: number[]): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** @@ -1379,8 +1379,8 @@ readByteArray(): number[] 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | -------- | ------- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** @@ -1421,8 +1421,8 @@ writeShortArray(shortArray: number[]): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ----- | ----- | - | 1900009 | write data to message sequence failed | + | -------- | -------- | + | 1900009 | write data to message sequence failed | **示例:** @@ -1455,8 +1455,8 @@ readShortArray(dataIn: number[]): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------ | ------- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** @@ -1496,8 +1496,8 @@ readShortArray(): number[] 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | -------- | ------- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** @@ -1537,8 +1537,8 @@ writeIntArray(intArray: number[]): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ----- | --------- | - | 1900009 | write data to message sequence failed | + | -------- | -------- | + | 1900009 | write data to message sequence failed | **示例:** @@ -1571,8 +1571,8 @@ readIntArray(dataIn: number[]): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** @@ -1612,8 +1612,8 @@ readIntArray(): number[] 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ----- | ------- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** @@ -1653,8 +1653,8 @@ writeLongArray(longArray: number[]): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | ----- | - | 1900009 | write data to message sequence failed | + | -------- | -------- | + | 1900009 | write data to message sequence failed | **示例:** @@ -1687,8 +1687,8 @@ readLongArray(dataIn: number[]): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | ------ | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** @@ -1728,8 +1728,8 @@ readLongArray(): number[] 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** @@ -1769,8 +1769,8 @@ writeFloatArray(floatArray: number[]): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900009 | write data to message sequence failed | + | -------- | -------- | + | 1900009 | write data to message sequence failed | **示例:** @@ -1803,8 +1803,8 @@ readFloatArray(dataIn: number[]): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** @@ -1844,8 +1844,8 @@ readFloatArray(): number[] 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** @@ -1885,8 +1885,8 @@ writeDoubleArray(doubleArray: number[]): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900009 | write data to message sequence failed | + | -------- | -------- | + | 1900009 | write data to message sequence failed | **示例:** @@ -1919,8 +1919,8 @@ readDoubleArray(dataIn: number[]): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** @@ -1960,8 +1960,8 @@ readDoubleArray(): number[] 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** @@ -2001,8 +2001,8 @@ writeBooleanArray(booleanArray: boolean[]): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900009 | write data to message sequence failed | + | -------- | -------- | + | 1900009 | write data to message sequence failed | **示例:** @@ -2035,8 +2035,8 @@ readBooleanArray(dataIn: boolean[]): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** @@ -2076,8 +2076,8 @@ readBooleanArray(): boolean[] 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** @@ -2117,8 +2117,8 @@ writeCharArray(charArray: number[]): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | -------- | ------ | - | 1900009 | write data to message sequence failed | + | -------- | -------- | + | 1900009 | write data to message sequence failed | **示例:** @@ -2151,8 +2151,8 @@ readCharArray(dataIn: number[]): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** @@ -2192,8 +2192,8 @@ readCharArray(): number[] 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** @@ -2234,8 +2234,8 @@ writeStringArray(stringArray: string[]): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900009 | write data to message sequence failed | + | -------- | -------- | + | 1900009 | write data to message sequence failed | **示例:** @@ -2268,8 +2268,8 @@ readStringArray(dataIn: string[]): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** @@ -2309,8 +2309,8 @@ readStringArray(): string[] 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** @@ -2344,8 +2344,8 @@ writeNoException(): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900009 | write data to message sequence failed | + | -------- | -------- | + | 1900009 | write data to message sequence failed | **示例:** @@ -2386,15 +2386,17 @@ readException(): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** - 获取服务 + Stage模型的应用在获取服务前需要先获取context,具体方法可参考[获取context](#获取context) ```ts - import FA from "@ohos.ability.featureAbility"; + // 仅FA模型需要导入@ohos.ability.featureAbility + // import FA from "@ohos.ability.featureAbility"; + let proxy; let connect = { onConnect: function(elementName, remoteProxy) { @@ -2412,7 +2414,11 @@ readException(): void "bundleName": "com.ohos.server", "abilityName": "com.ohos.server.EntryAbility", }; - FA.connectAbility(want, connect); + + // FA模型使用此方法连接服务 + // FA.connectAbility(want,connect); + + globalThis.context.connectServiceExtensionAbility(want, connect); ``` 上述onConnect回调函数中的proxy对象需要等ability异步连接成功后才会被赋值,然后才可调用proxy对象的sendMessageRequest接口方法发送消息 @@ -2466,8 +2472,8 @@ writeParcelableArray(parcelableArray: Parcelable[]): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900009 | write data to message sequence failed | + | -------- | -------- | + | 1900009 | write data to message sequence failed | **示例:** @@ -2522,9 +2528,9 @@ readParcelableArray(parcelableArray: Parcelable[]): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900010 | read data from message sequence failed | - | 1900012 | call js callback function failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | + | 1900012 | call js callback function failed | **示例:** @@ -2583,8 +2589,8 @@ writeRemoteObjectArray(objectArray: IRemoteObject[]): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | ------- | - | 1900009 | write data to message sequence failed | + | -------- | -------- | + | 1900009 | write data to message sequence failed | **示例:** @@ -2630,8 +2636,8 @@ readRemoteObjectArray(objects: IRemoteObject[]): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** @@ -2683,8 +2689,8 @@ readRemoteObjectArray(): IRemoteObject[] 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** @@ -2729,11 +2735,11 @@ static closeFileDescriptor(fd: number): void **示例:** ```ts - import fileio from '@ohos.fileio'; + import fs from '@ohos.file.fs'; let filePath = "path/to/file"; - let fd = fileio.openSync(filePath, 0o2| 0o100, 0o666); + let file = fs.openSync(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); try { - rpc.MessageSequence.closeFileDescriptor(fd); + rpc.MessageSequence.closeFileDescriptor(file.fd); } catch(error) { console.info("rpc close file descriptor fail, errorCode " + error.code); console.info("rpc close file descriptor fail, errorMessage" + error.message); @@ -2765,17 +2771,17 @@ static dupFileDescriptor(fd: number) :number 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | ------- | - | 1900013 | call os dup function failed | + | -------- | -------- | + | 1900013 | call os dup function failed | **示例:** ```ts - import fileio from '@ohos.fileio'; + import fs from '@ohos.file.fs'; let filePath = "path/to/file"; - let fd = fileio.openSync(filePath, 0o2| 0o100, 0o666); + let file = fs.openSync(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); try { - let newFd = rpc.MessageSequence.dupFileDescriptor(fd); + let newFd = rpc.MessageSequence.dupFileDescriptor(file.fd); } catch(error) { console.info("rpc dup file descriptor fail, errorCode " + error.code); console.info("rpc dup file descriptor fail, errorMessage" + error.message); @@ -2800,13 +2806,13 @@ containFileDescriptors(): boolean ```ts - import fileio from '@ohos.fileio'; + import fs from '@ohos.file.fs'; let sequence = new rpc.MessageSequence(); let filePath = "path/to/file"; let r1 = sequence.containFileDescriptors(); - let fd = fileio.openSync(filePath, 0o2| 0o100, 0o666); + let file = fs.openSync(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); try { - sequence.writeFileDescriptor(fd); + sequence.writeFileDescriptor(file.fd); } catch(error) { console.info("rpc write file descriptor fail, errorCode " + error.code); console.info("rpc write file descriptor fail, errorMessage" + error.message); @@ -2839,18 +2845,18 @@ writeFileDescriptor(fd: number): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | -------- | ------ | - | 1900009 | write data to message sequence failed | + | -------- | -------- | + | 1900009 | write data to message sequence failed | **示例:** ```ts - import fileio from '@ohos.fileio'; + import fs from '@ohos.file.fs'; let sequence = new rpc.MessageSequence(); let filePath = "path/to/file"; - let fd = fileio.openSync(filePath, 0o2| 0o100, 0o666); + let file = fs.openSync(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); try { - sequence.writeFileDescriptor(fd); + sequence.writeFileDescriptor(file.fd); } catch(error) { console.info("rpc write file descriptor fail, errorCode " + error.code); console.info("rpc write file descriptor fail, errorMessage" + error.message); @@ -2876,18 +2882,18 @@ readFileDescriptor(): number 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** ```ts - import fileio from '@ohos.fileio'; + import fs from '@ohos.file.fs'; let sequence = new rpc.MessageSequence(); let filePath = "path/to/file"; - let fd = fileio.openSync(filePath, 0o2| 0o100, 0o666); + let file = fs.openSync(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); try { - sequence.writeFileDescriptor(fd); + sequence.writeFileDescriptor(file.fd); } catch(error) { console.info("rpc write file descriptor fail, errorCode " + error.code); console.info("rpc write file descriptor fail, errorMessage" + error.message); @@ -2919,8 +2925,8 @@ writeAshmem(ashmem: Ashmem): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | ------- | - | 1900003 | write to ashmem failed | + | -------- | ------- | + | 1900003 | write to ashmem failed | **示例:** @@ -2961,8 +2967,8 @@ readAshmem(): Ashmem 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900004 | read from ashmem failed | + | -------- | -------- | + | 1900004 | read from ashmem failed | **示例:** @@ -3032,8 +3038,8 @@ writeRawData(rawData: number[], size: number): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | ------ | - | 1900009 | write data to message sequence failed | + | -------- | -------- | + | 1900009 | write data to message sequence failed | **示例:** @@ -3073,8 +3079,8 @@ readRawData(size: number): number[] 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900010 | read data from message sequence failed | + | -------- | -------- | + | 1900010 | read data from message sequence failed | **示例:** @@ -4027,8 +4033,8 @@ writeSequenceable(val: Sequenceable): boolean **返回值:** - | 类型 | 说明 | - | ------- | --------------------------------- | + | 类型 | 说明 | + | ------- | -------------------------------- | | boolean | true:写入成功,false:写入失败。| **示例:** @@ -4068,14 +4074,14 @@ readSequenceable(dataIn: Sequenceable): boolean **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | ------ | ----------------------------- | ---- | --------------------------------------- | + | 参数名 | 类型 | 必填 | 说明 | + | ------ | ----------------------------- | ------- | ---------------------------------------------- | | dataIn | [Sequenceable](#sequenceabledeprecated) | 是 | 需要从MessageParcel读取成员变量的对象。 | **返回值:** - | 类型 | 说明 | - | ------- | ------------------------------------------- | + | 类型 | 说明 | + | ------- | ---------------------------------------- | | boolean | true:反序列化成功,false:反序列化失败。| **示例:** @@ -4124,8 +4130,8 @@ writeByteArray(byteArray: number[]): boolean **返回值:** - | 类型 | 说明 | - | ------- | --------------------------------- | + | 类型 | 说明 | + | ------- | -------------------------------- | | boolean | true:写入成功,false:写入失败。| **示例:** @@ -4203,8 +4209,8 @@ writeShortArray(shortArray: number[]): boolean **返回值:** - | 类型 | 说明 | - | ------- | ----------------------------- | + | 类型 | 说明 | + | ------- | -------------------------------- | | boolean | true:写入成功,false:写入失败。| **示例:** @@ -4279,8 +4285,8 @@ writeIntArray(intArray: number[]): boolean **返回值:** - | 类型 | 说明 | - | ------- | ----------------------------- | + | 类型 | 说明 | + | ------- | -------------------------------- | | boolean | true:写入成功,false:写入失败。| **示例:** @@ -4425,14 +4431,14 @@ writeFloatArray(floatArray: number[]): boolean **参数:** - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | ---------- | -------- | ---- | --- | | floatArray | number[] | 是 | 要写入的浮点数组。由于系统内部对float类型的数据是按照double处理的,使用时对于数组所占的总字节数应按照double类型来计算。 | **返回值:** - | 类型 | 说明 | - | ------- | ----------------------------- | + | 类型 | 说明 | + | ------- | -------------------------------- | | boolean | true:写入成功,false:写入失败。| **示例:** @@ -4453,7 +4459,7 @@ readFloatArray(dataIn: number[]): void **参数:** - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | ------ | -------- | ---- | ------ | | dataIn | number[] | 是 | 要读取的浮点数组。由于系统内部对float类型的数据是按照double处理的,使用时对于数组所占的总字节数应按照double类型来计算。 | @@ -4507,8 +4513,8 @@ writeDoubleArray(doubleArray: number[]): boolean **返回值:** - | 类型 | 说明 | - | ------- | ----------------------------- | + | 类型 | 说明 | + | ------- | -------------------------------- | | boolean | true:写入成功,false:写入失败。| **示例:** @@ -4583,8 +4589,8 @@ writeBooleanArray(booleanArray: boolean[]): boolean **返回值:** - | 类型 | 说明 | - | ------- | --------------------------------- | + | 类型 | 说明 | + | ------- | -------------------------------- | | boolean | true:写入成功,false:写入失败。| **示例:** @@ -4659,8 +4665,8 @@ writeCharArray(charArray: number[]): boolean **返回值:** - | 类型 | 说明 | - | ------- | --------------------------------- | + | 类型 | 说明 | + | ------- | -------------------------------- | | boolean | true:写入成功,false:写入失败。| **示例:** @@ -4729,14 +4735,14 @@ writeStringArray(stringArray: string[]): boolean **参数:** - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | ----------- | -------- | ---- | ---------------- | | stringArray | string[] | 是 | 要写入的字符串数组,数组单个元素的长度应小于40960字节。 | **返回值:** | 类型 | 说明 | - | ------- | --------------------------------- | + | ------- | -------------------------------- | | boolean | true:写入成功,false:写入失败。| **示例:** @@ -4846,11 +4852,13 @@ readException(): void **系统能力**:SystemCapability.Communication.IPC.Core **示例:** - - 获取服务 + + Stage模型的应用在获取服务前需要先获取context,具体方法可参考[获取context](#获取context) ```ts - import FA from "@ohos.ability.featureAbility"; + // 仅FA模型需要导入@ohos.ability.;featureAbility + // import FA from "@ohos.ability.featureAbility"; + let proxy; let connect = { onConnect: function(elementName, remoteProxy) { @@ -4868,7 +4876,11 @@ readException(): void "bundleName": "com.ohos.server", "abilityName": "com.ohos.server.EntryAbility", }; - FA.connectAbility(want, connect); + + // FA模型使用此方法连接服务 + // FA.connectAbility(want,connect); + + globalThis.context.connectServiceExtensionAbility(want, connect); ``` 上述onConnect回调函数中的proxy对象需要等ability异步连接成功后才会被赋值,然后才可调用proxy对象的sendMessageRequest接口方法发送消息 @@ -4914,8 +4926,8 @@ writeSequenceableArray(sequenceableArray: Sequenceable[]): boolean **返回值:** - | 类型 | 说明 | - | ------- | --------------------------------- | + | 类型 | 说明 | + | ------- | -------------------------------- | | boolean | true:写入成功,false:写入失败。| **示例:** @@ -5004,14 +5016,14 @@ writeRemoteObjectArray(objectArray: IRemoteObject[]): boolean **参数:** - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | ----------- | --------------- | ---- | ----- | | objectArray | IRemoteObject[] | 是 | 要写入MessageParcel的IRemoteObject对象数组。 | **返回值:** | 类型 | 说明 | - | ------- | -------------------------------------------------------------------------------------------------------------------- | + | ------- | -------------------------------- | | boolean | true:写入成功,false:写入失败。| **示例:** @@ -5056,7 +5068,7 @@ readRemoteObjectArray(objects: IRemoteObject[]): void **参数:** - | 参数名 | 类型 | 必填 | 说明 | + | 参数名 | 类型 | 必填 | 说明 | | ------- | --------------- | ---- | --------- | | objects | IRemoteObject[] | 是 | 从MessageParcel读取的IRemoteObject对象数组。 | @@ -5103,8 +5115,8 @@ readRemoteObjectArray(): IRemoteObject[] **返回值:** - | 类型 | 说明 | - | --------------- | -------- | + | 类型 | 说明 | + | --------------- | --------------------------- | | IRemoteObject[] | 返回IRemoteObject对象数组。 | **示例:** @@ -5158,10 +5170,10 @@ static closeFileDescriptor(fd: number): void **示例:** ```ts - import fileio from '@ohos.fileio'; + import fs from '@ohos.file.fs'; let filePath = "path/to/file"; - let fd = fileio.openSync(filePath, 0o2| 0o100, 0o666); - rpc.MessageParcel.closeFileDescriptor(fd); + let file = fs.openSync(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); + rpc.MessageParcel.closeFileDescriptor(file.fd); ``` ### dupFileDescriptor8+ @@ -5187,10 +5199,10 @@ static dupFileDescriptor(fd: number) :number **示例:** ```ts - import fileio from '@ohos.fileio'; + import fs from '@ohos.file.fs'; let filePath = "path/to/file"; - let fd = fileio.openSync(filePath, 0o2| 0o100, 0o666); - let newFd = rpc.MessageParcel.dupFileDescriptor(fd); + let file = fs.openSync(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); + let newFd = rpc.MessageParcel.dupFileDescriptor(file.fd); ``` ### containFileDescriptors8+ @@ -5203,19 +5215,19 @@ containFileDescriptors(): boolean **返回值:** - | 类型 | 说明 | - | ------- | ------------------------------------------------------------------ | + | 类型 | 说明 | + | ------- | --------------------------------------------- | | boolean |true:包含文件描述符,false:未包含文件描述符。| **示例:** ```ts - import fileio from '@ohos.fileio'; + import fs from '@ohos.file.fs'; let parcel = new rpc.MessageParcel(); let filePath = "path/to/file"; let r1 = parcel.containFileDescriptors(); - let fd = fileio.openSync(filePath, 0o2| 0o100, 0o666); - let writeResult = parcel.writeFileDescriptor(fd); + let file = fs.openSync(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); + let writeResult = parcel.writeFileDescriptor(file.fd); console.log("RpcTest: parcel writeFd result is : " + writeResult); let containFD = parcel.containFileDescriptors(); console.log("RpcTest: parcel after write fd containFd result is : " + containFD); @@ -5237,18 +5249,18 @@ writeFileDescriptor(fd: number): boolean **返回值:** - | 类型 | 说明 | - | ------- | ----------------------------------------- | + | 类型 | 说明 | + | ------- | -------------------------------- | | boolean | true:操作成功,false:操作失败。| **示例:** ```ts - import fileio from '@ohos.fileio'; + import fs from '@ohos.file.fs'; let parcel = new rpc.MessageParcel(); let filePath = "path/to/file"; - let fd = fileio.openSync(filePath, 0o2| 0o100, 0o666); - let writeResult = parcel.writeFileDescriptor(fd); + let file = fs.openSync(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); + let writeResult = parcel.writeFileDescriptor(file.fd); console.log("RpcTest: parcel writeFd result is : " + writeResult); ``` @@ -5269,11 +5281,11 @@ readFileDescriptor(): number **示例:** ```ts - import fileio from '@ohos.fileio'; + import fs from '@ohos.file.fs'; let parcel = new rpc.MessageParcel(); let filePath = "path/to/file"; - let fd = fileio.openSync(filePath, 0o2| 0o100, 0o666); - let writeResult = parcel.writeFileDescriptor(fd); + let file = fs.openSync(filePath, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); + let writeResult = parcel.writeFileDescriptor(file.fd); let readFD = parcel.readFileDescriptor(); console.log("RpcTest: parcel read fd is : " + readFD); ``` @@ -5294,8 +5306,8 @@ writeAshmem(ashmem: Ashmem): boolean **返回值:** - | 类型 | 说明 | - | ------- | -------------------------------------------------------------------- | + | 类型 | 说明 | + | ------- | -------------------------------- | | boolean | true:写入成功,false:写入失败。| **示例:** @@ -5371,8 +5383,8 @@ writeRawData(rawData: number[], size: number): boolean **返回值:** - | 类型 | 说明 | - | ------- | ----------------------------------------- | + | 类型 | 说明 | + | ------- | -------------------------------- | | boolean | true:写入成功,false:写入失败。| **示例:** @@ -5435,9 +5447,9 @@ marshalling(dataOut: MessageSequence): boolean **返回值:** - | 类型 | 说明 | - | ------- | ----------------------------------------- | - | boolean | true:封送成功,false:封送失败。 + | 类型 | 说明 | + | ------- | -------------------------------- | + | boolean | true:封送成功,false:封送失败。| **示例:** ```ts @@ -5484,8 +5496,8 @@ unmarshalling(dataIn: MessageSequence): boolean **返回值:** - | 类型 | 说明 | - | ------- | --------------------------------------------- | + | 类型 | 说明 | + | ------- | ---------------------------------------- | | boolean | true:反序列化成功,false:反序列化失败。| **示例:** @@ -5534,15 +5546,15 @@ marshalling(dataOut: MessageParcel): boolean **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | ------- | ------------------------------- | ---- | ----------------------------------------- | + | 参数名 | 类型 | 必填 | 说明 | + | ------- | ----------------------------------------- | ---- | ----------------------------------------- | | dataOut | [MessageParcel](#messageparceldeprecated) | 是 | 可序列对象将被封送到的MessageParcel对象。 | **返回值:** - | 类型 | 说明 | - | ------- | ----------------------------------------- | - | boolean | true:封送成功,false:封送失败。 + | 类型 | 说明 | + | ------- | -------------------------------- | + | boolean | true:封送成功,false:封送失败。 | **示例:** ```ts @@ -5583,14 +5595,14 @@ unmarshalling(dataIn: MessageParcel): boolean **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | ------ | ------------------------------- | ---- | --------------------------------------------- | + | 参数名 | 类型 | 必填 | 说明 | + | ------ | ----------------------------------------- | ---- | --------------------------------------------- | | dataIn | [MessageParcel](#messageparceldeprecated) | 是 | 已将可序列对象封送到其中的MessageParcel对象。 | **返回值:** - | 类型 | 说明 | - | ------- | --------------------------------------------- | + | 类型 | 说明 | + | ------- | ---------------------------------------- | | boolean | true:反序列化成功,false:反序列化失败。| **示例:** @@ -5637,8 +5649,8 @@ asObject(): IRemoteObject **返回值:** - | 类型 | 说明 | - | ---- | ----- | + | 类型 | 说明 | + | ----- | ----- | | [IRemoteObject](#iremoteobject) | 如果调用者是RemoteObject对象,则直接返回本身;如果调用者是[RemoteProxy](#remoteproxy)对象,则返回它的持有者[IRemoteObject](#iremoteobject)。 | **示例:** @@ -5649,25 +5661,27 @@ asObject(): IRemoteObject return this; } } - let remoteObject = new TestAbility().asObject(); + let remoteObject = new TestAbility("testObject").asObject(); ``` **示例:** - 获取服务 + Stage模型的应用在获取服务前需要先获取context,具体方法可参考[获取context](#获取context) ```ts - import FA from "@ohos.ability.featureAbility"; + // 仅FA模型需要导入@ohos.ability.featureAbility + // import FA from "@ohos.ability.featureAbility"; + let proxy; let connect = { - onConnect: function (elementName, remoteProxy) { + onConnect: function(elementName, remoteProxy) { console.log("RpcClient: js onConnect called."); proxy = remoteProxy; }, - onDisconnect: function (elementName) { + onDisconnect: function(elementName) { console.log("RpcClient: onDisconnect"); }, - onFailed: function () { + onFailed: function() { console.log("RpcClient: onFailed"); } }; @@ -5675,11 +5689,15 @@ asObject(): IRemoteObject "bundleName": "com.ohos.server", "abilityName": "com.ohos.server.EntryAbility", }; - FA.connectAbility(want, connect); - ``` - 上述onConnect回调函数中的proxy对象需要等ability异步连接成功后才会被赋值,然后才可调用proxy对象的asObject接口方法获取代理或远端对象 + // FA模型使用此方法连接服务 + // FA.connectAbility(want,connect); + globalThis.context.connectServiceExtensionAbility(want, connect); + ``` + + 上述onConnect回调函数中的proxy对象需要等ability异步连接成功后才会被赋值,然后才可调用proxy对象的asObject接口方法获取代理或远端对象 + ```ts class TestProxy { remote: rpc.RemoteObject; @@ -5691,7 +5709,6 @@ asObject(): IRemoteObject } } let iRemoteObject = new TestProxy(proxy).asObject(); - ``` ## DeathRecipient @@ -5802,17 +5819,17 @@ sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: Me **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | ------- | ------------------------------- | ---- | ---- | - | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | + | 参数名 | 类型 | 必填 | 说明 | + | ------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- | + | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | | data | [MessageParcel](#messageparceldeprecated) | 是 | 保存待发送数据的 MessageParcel对象。 | | reply | [MessageParcel](#messageparceldeprecated) | 是 | 接收应答数据的MessageParcel对象。 | - | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | + | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | **返回值:** - | 类型 | 说明 | - | ------- | --------------------------------------------- | + | 类型 | 说明 | + | ------- | -------------------------------- | | boolean | true:发送成功,false:发送失败。| @@ -5828,12 +5845,12 @@ sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: Me **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | ------- | ------------------------------- | ---- | -------------------------------------------------------------------------------------- | - | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | + | 参数名 | 类型 | 必填 | 说明 | + | ------- | ---------------------------------------- | ---- | -------------------------------------------------------------------------------------- | + | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | | data | [MessageParcel](#messageparceldeprecated) | 是 | 保存待发送数据的 MessageParcel对象。 | | reply | [MessageParcel](#messageparceldeprecated) | 是 | 接收应答数据的MessageParcel对象。 | - | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | + | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | **返回值:** @@ -5852,12 +5869,12 @@ sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | ------- | ------------------------------- | ---- | -------------------------------------------------------------------------------------- | - | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | + | 参数名 | 类型 | 必填 | 说明 | + | ------- | ------------------------------------ | ---- | -------------------------------------------------------------------------------------- | + | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | | data | [MessageSequence](#messagesequence9) | 是 | 保存待发送数据的 MessageSequence对象。 | | reply | [MessageSequence](#messagesequence9) | 是 | 接收应答数据的MessageSequence对象。 | - | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | + | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | **返回值:** @@ -5876,13 +5893,13 @@ sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | -------- | ---------------------------------- | ---- | -------------------------------------------------------------------------------------- | - | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | + | 参数名 | 类型 | 必填 | 说明 | + | -------- | ------------------------------------ | ---- | -------------------------------------------------------------------------------------- | + | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | | data | [MessageSequence](#messagesequence9) | 是 | 保存待发送数据的 MessageSequence对象。 | | reply | [MessageSequence](#messagesequence9) | 是 | 接收应答数据的MessageSequence对象。 | - | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | - | callback | AsyncCallback<RequestResult> | 是 | 接收发送结果的回调。 | + | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | + | callback | AsyncCallback<RequestResult> | 是 | 接收发送结果的回调。 | ### sendRequest8+(deprecated) @@ -5896,13 +5913,13 @@ sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: Me **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | -------- | -------------------------------------- | ---- | -------------------------------------------------------------------------------------- | - | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | - | data | [MessageParcel](#messageparceldeprecated) | 是 | 保存待发送数据的 MessageParcel对象。 | - | reply | [MessageParcel](#messageparceldeprecated) | 是 | 接收应答数据的MessageParcel对象。 | - | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | - | callback | AsyncCallback<SendRequestResult> | 是 | 接收发送结果的回调。 | + | 参数名 | 类型 | 必填 | 说明 | + | -------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- | + | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | + | data | [MessageParcel](#messageparceldeprecated) | 是 | 保存待发送数据的 MessageParcel对象。 | + | reply | [MessageParcel](#messageparceldeprecated) | 是 | 接收应答数据的MessageParcel对象。 | + | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | + | callback | AsyncCallback<SendRequestResult> | 是 | 接收发送结果的回调。 | ### registerDeathRecipient9+ @@ -5924,8 +5941,8 @@ registerDeathRecipient(recipient: DeathRecipient, flags: number): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900008 | proxy or remote object is invalid | + | -------- | -------- | + | 1900008 | proxy or remote object is invalid | ### addDeathrecipient(deprecated) @@ -5946,8 +5963,8 @@ addDeathRecipient(recipient: DeathRecipient, flags: number): boolean **返回值:** - | 类型 | 说明 | - | ------- | --------------------------------------------- | + | 类型 | 说明 | + | ------- | ---------------------------------------- | | boolean | true:回调注册成功,false:回调注册失败。| @@ -5971,8 +5988,8 @@ unregisterDeathRecipient(recipient: DeathRecipient, flags: number): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900008 | proxy or remote object is invalid | + | -------- | -------- | + | 1900008 | proxy or remote object is invalid | ### removeDeathRecipient(deprecated) @@ -5993,8 +6010,8 @@ removeDeathRecipient(recipient: DeathRecipient, flags: number): boolean **返回值:** - | 类型 | 说明 | - | ------- | --------------------------------------------- | + | 类型 | 说明 | + | ------- | -----------------------------------------| | boolean | true:回调注销成功,false:回调注销失败。| ### getDescriptor9+ @@ -6016,8 +6033,8 @@ getDescriptor(): string 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900008 | proxy or remote object is invalid | + | -------- | -------- | + | 1900008 | proxy or remote object is invalid | ### getInterfaceDescriptor(deprecated) @@ -6047,8 +6064,8 @@ isObjectDead(): boolean **返回值:** - | 类型 | 说明 | - | ------- | ------------------------------------------- | + | 类型 | 说明 | + | ------- | ---------------------------------- | | boolean | true:对象死亡,false:对象未死亡。| @@ -6058,7 +6075,7 @@ isObjectDead(): boolean **系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.IPC.Core。 -| 名称 | 默认值 | 说明 | +| 名称 | 值 | 说明 | | --------------------- | ----------------------- | --------------------------------- | | PING_TRANSACTION | 1599098439 (0x5f504e47) | 内部指令码,用于测试IPC服务正常。 | | DUMP_TRANSACTION | 1598311760 (0x5f444d50) | 内部指令码,获取Binder内部状态。 | @@ -6078,25 +6095,27 @@ sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: Me **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | ------- | ------------------------------- | ---- | -------------------------------------------------------------------------------------- | - | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | + | 参数名 | 类型 | 必填 | 说明 | + | ------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- | + | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | | data | [MessageParcel](#messageparceldeprecated) | 是 | 保存待发送数据的 MessageParcel对象。 | | reply | [MessageParcel](#messageparceldeprecated) | 是 | 接收应答数据的MessageParcel对象。 | - | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | + | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | **返回值:** - | 类型 | 说明 | - | ------- | --------------------------------------------- | + | 类型 | 说明 | + | ------- | ---------------------------------| | boolean | true:发送成功,false:发送失败。| **示例:** - 获取服务 + Stage模型的应用在获取服务前需要先获取context,具体方法可参考[获取context](#获取context) ```ts - import FA from "@ohos.ability.featureAbility"; + // 仅FA模型需要导入@ohos.ability.featureAbility + // import FA from "@ohos.ability.featureAbility"; + let proxy; let connect = { onConnect: function(elementName, remoteProxy) { @@ -6114,11 +6133,15 @@ sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: Me "bundleName": "com.ohos.server", "abilityName": "com.ohos.server.EntryAbility", }; - FA.connectAbility(want, connect); - ``` - 上述onConnect回调函数中的proxy对象需要等ability异步连接成功后才会被赋值,然后才可调用proxy对象的sendRequest接口方法发送消息 + // FA模型使用此方法连接服务 + // FA.connectAbility(want,connect); + globalThis.context.connectServiceExtensionAbility(want, connect); + ``` + + 上述onConnect回调函数中的proxy对象需要等ability异步连接成功后才会被赋值,然后才可调用proxy对象的sendRequest接口方法发送消息 + ```ts let option = new rpc.MessageOption(); let data = rpc.MessageParcel.create(); @@ -6148,12 +6171,12 @@ sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | ------- | ------------------------------- | ---- | -------------------------------------------------------------------------------------- | - | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | + | 参数名 | 类型 | 必填 | 说明 | + | ------- | ------------------------------------ | ---- | -------------------------------------------------------------------------------------- | + | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | | data | [MessageSequence](#messagesequence9) | 是 | 保存待发送数据的 MessageSequence对象。 | - | reply | [MessageSequence](#messagesequence9) | 是 | 接收应答数据的MessageSequence对象。 | - | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | + | reply | [MessageSequence](#messagesequence9) | 是 | 接收应答数据的MessageSequence对象。 | + | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | **返回值:** @@ -6163,10 +6186,12 @@ sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, **示例:** - 获取服务 + Stage模型的应用在获取服务前需要先获取context,具体方法可参考[获取context](#获取context) ```ts - import FA from "@ohos.ability.featureAbility"; + // 仅FA模型需要导入@ohos.ability.featureAbility + // import FA from "@ohos.ability.featureAbility"; + let proxy; let connect = { onConnect: function(elementName, remoteProxy) { @@ -6184,9 +6209,13 @@ sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, "bundleName": "com.ohos.server", "abilityName": "com.ohos.server.EntryAbility", }; - FA.connectAbility(want, connect); - ``` + // FA模型使用此方法连接服务 + // FA.connectAbility(want,connect); + + globalThis.context.connectServiceExtensionAbility(want, connect); + ``` + 上述onConnect回调函数中的proxy对象需要等ability异步连接成功后才会被赋值,然后才可调用proxy对象的sendMessageRequest接口方法发送消息 ```ts @@ -6226,12 +6255,12 @@ sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: Me **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | ------- | ------------------------------- | ---- | -------------------------------------------------------------------------------------- | - | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | + | 参数名 | 类型 | 必填 | 说明 | + | ------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- | + | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | | data | [MessageParcel](#messageparceldeprecated) | 是 | 保存待发送数据的 MessageParcel对象。 | | reply | [MessageParcel](#messageparceldeprecated) | 是 | 接收应答数据的MessageParcel对象。 | - | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | + | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | **返回值:** @@ -6241,10 +6270,12 @@ sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: Me **示例:** - 获取服务 + Stage模型的应用在获取服务前需要先获取context,具体方法可参考[获取context](#获取context) ```ts - import FA from "@ohos.ability.featureAbility"; + // 仅FA模型需要导入@ohos.ability.featureAbility + // import FA from "@ohos.ability.featureAbility"; + let proxy; let connect = { onConnect: function(elementName, remoteProxy) { @@ -6262,7 +6293,11 @@ sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: Me "bundleName": "com.ohos.server", "abilityName": "com.ohos.server.EntryAbility", }; - FA.connectAbility(want, connect); + + // FA模型使用此方法连接服务 + // FA.connectAbility(want,connect); + + globalThis.context.connectServiceExtensionAbility(want, connect); ``` 上述onConnect回调函数中的proxy对象需要等ability异步连接成功后才会被赋值,然后才可调用proxy对象的sendRequest接口方法发送消息 @@ -6302,20 +6337,22 @@ sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | -------- | ---------------------------------- | ---- | -------------------------------------------------------------------------------------- | - | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | + | 参数名 | 类型 | 必填 | 说明 | + | -------- | ------------------------------------ | ---- | -------------------------------------------------------------------------------------- | + | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | | data | [MessageSequence](#messagesequence9) | 是 | 保存待发送数据的 MessageSequence对象。 | | reply | [MessageSequence](#messagesequence9) | 是 | 接收应答数据的MessageSequence对象。 | - | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | - | callback | AsyncCallback<RequestResult> | 是 | 接收发送结果的回调。 | + | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | + | callback | AsyncCallback<RequestResult> | 是 | 接收发送结果的回调。 | **示例:** - - 获取服务 + + Stage模型的应用在获取服务前需要先获取context,具体方法可参考[获取context](#获取context) ```ts - import FA from "@ohos.ability.featureAbility"; + // 仅FA模型需要导入@ohos.ability.featureAbility + // import FA from "@ohos.ability.featureAbility"; + let proxy; let connect = { onConnect: function(elementName, remoteProxy) { @@ -6346,7 +6383,11 @@ sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, result.data.reclaim(); result.reply.reclaim(); } - FA.connectAbility(want, connect); + + // FA模型使用此方法连接服务 + // FA.connectAbility(want,connect); + + globalThis.context.connectServiceExtensionAbility(want, connect); ``` 上述onConnect回调函数中的proxy对象需要等ability异步连接成功后才会被赋值,然后才可调用proxy对象的sendMessageRequest接口方法发送消息 @@ -6358,7 +6399,7 @@ sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, data.writeInt(1); data.writeString("hello"); try { - proxy.sendRequest(1, data, reply, option, sendRequestCallback); + proxy.sendMessageRequest(1, data, reply, option, sendRequestCallback); } catch(error) { console.info("rpc send sequence request fail, errorCode " + error.code); console.info("rpc send sequence request fail, errorMessage " + error.message); @@ -6377,20 +6418,22 @@ sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: Me **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | -------- | -------------------------------------- | ---- | -------------------------------------------------------------------------------------- | - | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | - | data | [MessageParcel](#messageparceldeprecated) | 是 | 保存待发送数据的 MessageParcel对象。 | - | reply | [MessageParcel](#messageparceldeprecated) | 是 | 接收应答数据的MessageParcel对象。 | - | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | - | callback | AsyncCallback<SendRequestResult> | 是 | 接收发送结果的回调。 | + | 参数名 | 类型 | 必填 | 说明 | + | -------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- | + | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | + | data | [MessageParcel](#messageparceldeprecated) | 是 | 保存待发送数据的 MessageParcel对象。 | + | reply | [MessageParcel](#messageparceldeprecated) | 是 | 接收应答数据的MessageParcel对象。 | + | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | + | callback | AsyncCallback<SendRequestResult> | 是 | 接收发送结果的回调。 | **示例:** - 获取服务 + Stage模型的应用在获取服务前需要先获取context,具体方法可参考[获取context](#获取context) ```ts - import FA from "@ohos.ability.featureAbility"; + // 仅FA模型需要导入@ohos.ability.featureAbility + // import FA from "@ohos.ability.featureAbility"; + let proxy; let connect = { onConnect: function(elementName, remoteProxy) { @@ -6408,7 +6451,7 @@ sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: Me "bundleName": "com.ohos.server", "abilityName": "com.ohos.server.EntryAbility", }; - function sendRequestCallback(result) { + function sendRequestCallback(result) { if (result.errCode === 0) { console.log("sendRequest got result"); result.reply.readException(); @@ -6421,7 +6464,11 @@ sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: Me result.data.reclaim(); result.reply.reclaim(); } - FA.connectAbility(want, connect); + + // FA模型使用此方法连接服务 + // FA.connectAbility(want,connect); + + globalThis.context.connectServiceExtensionAbility(want, connect); ``` 上述onConnect回调函数中的proxy对象需要等ability异步连接成功后才会被赋值,然后才可调用proxy对象的sendRequest接口方法发送消息 @@ -6460,22 +6507,24 @@ getLocalInterface(interface: string): IRemoteBroker 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900006 | only remote object permitted | + | -------- | -------- | + | 1900006 | only remote object permitted | **示例:** - 获取服务 + Stage模型的应用在获取服务前需要先获取context,具体方法可参考[获取context](#获取context) ```ts - import FA from "@ohos.ability.featureAbility"; + // 仅FA模型需要导入@ohos.ability.featureAbility + // import FA from "@ohos.ability.featureAbility"; + let proxy; let connect = { onConnect: function(elementName, remoteProxy) { console.log("RpcClient: js onConnect called."); proxy = remoteProxy; }, - onDisconnect: function (elementName) { + onDisconnect: function(elementName) { console.log("RpcClient: onDisconnect"); }, onFailed: function() { @@ -6483,10 +6532,14 @@ getLocalInterface(interface: string): IRemoteBroker } }; let want = { - "bundleName":"com.ohos.server", - "abilityName":"com.ohos.server.EntryAbility", + "bundleName": "com.ohos.server", + "abilityName": "com.ohos.server.EntryAbility", }; - FA.connectAbility(want, connect); + + // FA模型使用此方法连接服务 + // FA.connectAbility(want,connect); + + globalThis.context.connectServiceExtensionAbility(want, connect); ``` 上述onConnect回调函数中的proxy对象需要等ability异步连接成功后才会被赋值,然后才可调用proxy对象的getLocalInterface接口方法查询接口对象 @@ -6525,17 +6578,19 @@ queryLocalInterface(interface: string): IRemoteBroker **示例:** - 获取服务 + Stage模型的应用在获取服务前需要先获取context,具体方法可参考[获取context](#获取context) ```ts - import FA from "@ohos.ability.featureAbility"; + // 仅FA模型需要导入@ohos.ability.featureAbility + // import FA from "@ohos.ability.featureAbility"; + let proxy; let connect = { onConnect: function(elementName, remoteProxy) { console.log("RpcClient: js onConnect called."); proxy = remoteProxy; }, - onDisconnect: function (elementName) { + onDisconnect: function(elementName) { console.log("RpcClient: onDisconnect"); }, onFailed: function() { @@ -6543,12 +6598,16 @@ queryLocalInterface(interface: string): IRemoteBroker } }; let want = { - "bundleName":"com.ohos.server", - "abilityName":"com.ohos.server.EntryAbility", + "bundleName": "com.ohos.server", + "abilityName": "com.ohos.server.EntryAbility", }; - FA.connectAbility(want, connect); - ``` + // FA模型使用此方法连接服务 + // FA.connectAbility(want,connect); + + globalThis.context.connectServiceExtensionAbility(want, connect); + ``` + 上述onConnect回调函数中的proxy对象需要等ability异步连接成功后才会被赋值,然后才可调用proxy对象的queryLocalInterface接口获取接口对象 ```ts @@ -6576,15 +6635,17 @@ registerDeathRecipient(recipient: DeathRecipient, flags: number): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900008 | proxy or remote object is invalid | + | -------- | -------- | + | 1900008 | proxy or remote object is invalid | **示例:** - 获取服务 + Stage模型的应用在获取服务前需要先获取context,具体方法可参考[获取context](#获取context) ```ts - import FA from "@ohos.ability.featureAbility"; + // 仅FA模型需要导入@ohos.ability.featureAbility + // import FA from "@ohos.ability.featureAbility"; + let proxy; let connect = { onConnect: function(elementName, remoteProxy) { @@ -6602,11 +6663,15 @@ registerDeathRecipient(recipient: DeathRecipient, flags: number): void "bundleName": "com.ohos.server", "abilityName": "com.ohos.server.EntryAbility", }; - FA.connectAbility(want, connect); + + // FA模型使用此方法连接服务 + // FA.connectAbility(want,connect); + + globalThis.context.connectServiceExtensionAbility(want, connect); ``` 上述onConnect回调函数中的proxy对象需要等ability异步连接成功后才会被赋值,然后才可调用proxy对象的registerDeathRecipient接口注册死亡回调 - + ```ts class MyDeathRecipient { onRemoteDied() { @@ -6641,16 +6706,18 @@ addDeathRecipient(recipient: DeathRecipient, flags: number): boolean **返回值:** - | 类型 | 说明 | - | ------- | --------------------------------------------- | + | 类型 | 说明 | + | ------- | ---------------------------------------- | | boolean | true:回调注册成功,false:回调注册失败。| **示例:** - 获取服务 + Stage模型的应用在获取服务前需要先获取context,具体方法可参考[获取context](#获取context) ```ts - import FA from "@ohos.ability.featureAbility"; + // 仅FA模型需要导入@ohos.ability.featureAbility + // import FA from "@ohos.ability.featureAbility"; + let proxy; let connect = { onConnect: function(elementName, remoteProxy) { @@ -6668,9 +6735,13 @@ addDeathRecipient(recipient: DeathRecipient, flags: number): boolean "bundleName": "com.ohos.server", "abilityName": "com.ohos.server.EntryAbility", }; - FA.connectAbility(want, connect); - ``` + // FA模型使用此方法连接服务 + // FA.connectAbility(want,connect); + + globalThis.context.connectServiceExtensionAbility(want, connect); + ``` + 上述onConnect回调函数中的proxy对象需要等ability异步连接成功后才会被赋值,然后才可调用proxy对象的addDeathRecippient接口方法新增死亡回调 ```ts @@ -6703,15 +6774,17 @@ unregisterDeathRecipient(recipient: DeathRecipient, flags: number): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900008 | proxy or remote object is invalid | + | -------- | -------- | + | 1900008 | proxy or remote object is invalid | **示例:** - 获取服务 + Stage模型的应用在获取服务前需要先获取context,具体方法可参考[获取context](#获取context) ```ts - import FA from "@ohos.ability.featureAbility"; + // 仅FA模型需要导入@ohos.ability.featureAbility + // import FA from "@ohos.ability.featureAbility"; + let proxy; let connect = { onConnect: function(elementName, remoteProxy) { @@ -6729,9 +6802,13 @@ unregisterDeathRecipient(recipient: DeathRecipient, flags: number): void "bundleName": "com.ohos.server", "abilityName": "com.ohos.server.EntryAbility", }; - FA.connectAbility(want, connect); - ``` + // FA模型使用此方法连接服务 + // FA.connectAbility(want,connect); + + globalThis.context.connectServiceExtensionAbility(want, connect); + ``` + 上述onConnect回调函数中的proxy对象需要等ability异步连接成功后才会被赋值,然后才可调用proxy对象的unregisterDeathRecipient接口方法注销死亡回调 ```ts @@ -6769,16 +6846,18 @@ removeDeathRecipient(recipient: DeathRecipient, flags: number): boolean **返回值:** - | 类型 | 说明 | - | ------- | --------------------------------------------- | + | 类型 | 说明 | + | ------- | ---------------------------------------- | | boolean | true:回调注销成功,false:回调注销失败。| **示例:** - 获取服务 + Stage模型的应用在获取服务前需要先获取context,具体方法可参考[获取context](#获取context) ```ts - import FA from "@ohos.ability.featureAbility"; + // 仅FA模型需要导入@ohos.ability.featureAbility + // import FA from "@ohos.ability.featureAbility"; + let proxy; let connect = { onConnect: function(elementName, remoteProxy) { @@ -6796,9 +6875,13 @@ removeDeathRecipient(recipient: DeathRecipient, flags: number): boolean "bundleName": "com.ohos.server", "abilityName": "com.ohos.server.EntryAbility", }; - FA.connectAbility(want, connect); - ``` + // FA模型使用此方法连接服务 + // FA.connectAbility(want,connect); + + globalThis.context.connectServiceExtensionAbility(want, connect); + ``` + 上述onConnect回调函数中的proxy对象需要等ability异步连接成功后才会被赋值,然后才可调用proxy对象的removeDeathRecipient接口方法去注册死亡回调 ```ts @@ -6831,16 +6914,18 @@ getDescriptor(): string 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | -------- | ------- | - | 1900008 | proxy or remote object is invalid | - | 1900007 | communication failed | + | -------- | -------- | + | 1900008 | proxy or remote object is invalid | + | 1900007 | communication failed | **示例:** - 获取服务 + Stage模型的应用在获取服务前需要先获取context,具体方法可参考[获取context](#获取context) ```ts - import FA from "@ohos.ability.featureAbility"; + // 仅FA模型需要导入@ohos.ability.featureAbility + // import FA from "@ohos.ability.featureAbility"; + let proxy; let connect = { onConnect: function(elementName, remoteProxy) { @@ -6858,7 +6943,11 @@ getDescriptor(): string "bundleName": "com.ohos.server", "abilityName": "com.ohos.server.EntryAbility", }; - FA.connectAbility(want, connect); + + // FA模型使用此方法连接服务 + // FA.connectAbility(want,connect); + + globalThis.context.connectServiceExtensionAbility(want, connect); ``` 上述onConnect回调函数中的proxy对象需要等ability异步连接成功后才会被赋值,然后才可调用proxy对象的getDescriptor接口方法获取对象的接口描述符 @@ -6890,10 +6979,12 @@ getInterfaceDescriptor(): string **示例:** - 获取服务 + Stage模型的应用在获取服务前需要先获取context,具体方法可参考[获取context](#获取context) ```ts - import FA from "@ohos.ability.featureAbility"; + // 仅FA模型需要导入@ohos.ability.featureAbility + // import FA from "@ohos.ability.featureAbility"; + let proxy; let connect = { onConnect: function(elementName, remoteProxy) { @@ -6911,9 +7002,13 @@ getInterfaceDescriptor(): string "bundleName": "com.ohos.server", "abilityName": "com.ohos.server.EntryAbility", }; - FA.connectAbility(want, connect); - ``` + // FA模型使用此方法连接服务 + // FA.connectAbility(want,connect); + + globalThis.context.connectServiceExtensionAbility(want, connect); + ``` + 上述onConnect回调函数中的proxy对象需要等ability异步连接成功后才会被赋值,然后才可调用proxy对象的getInterfaceDescriptor接口方法查询当前代理对象接口的描述符 ```ts @@ -6931,16 +7026,18 @@ isObjectDead(): boolean **返回值:** - | 类型 | 说明 | - | ------- | --------------------------------------------------------- | - | boolean | true:对应的对象已经死亡,false:对应的对象未死亡| + | 类型 | 说明 | + | ------- | ------------------------------------------------- | + | boolean | true:对应的对象已经死亡,false:对应的对象未死亡 | **示例:** - 获取服务 + Stage模型的应用在获取服务前需要先获取context,具体方法可参考[获取context](#获取context) ```ts - import FA from "@ohos.ability.featureAbility"; + // 仅FA模型需要导入@ohos.ability.featureAbility + // import FA from "@ohos.ability.featureAbility"; + let proxy; let connect = { onConnect: function(elementName, remoteProxy) { @@ -6958,7 +7055,11 @@ isObjectDead(): boolean "bundleName": "com.ohos.server", "abilityName": "com.ohos.server.EntryAbility", }; - FA.connectAbility(want, connect); + + // FA模型使用此方法连接服务 + // FA.connectAbility(want,connect); + + globalThis.context.connectServiceExtensionAbility(want, connect); ``` 上述onConnect回调函数中的proxy对象需要等ability异步连接成功后才会被赋值,然后才可调用proxy对象的isObjectDead接口方法判断当前对象是否已经死亡 @@ -6974,12 +7075,12 @@ isObjectDead(): boolean **系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.IPC.Core。 - | 名称 | 默认值 | 说明 | + | 名称 | 值 | 说明 | | ------------- | ---- | ----------------------------------------------------------- | - | TF_SYNC | 0 | 同步调用标识。 | - | TF_ASYNC | 1 | 异步调用标识。 | + | TF_SYNC | 0 | 同步调用标识。 | + | TF_ASYNC | 1 | 异步调用标识。 | | TF_ACCEPT_FDS | 0x10 | 指示sendMessageRequest9+接口可以返回文件描述符。 | - | TF_WAIT_TIME | 8 | 默认等待时间(单位/秒)。 | + | TF_WAIT_TIME | 8 | 默认等待时间(单位/秒)。 | ### constructor9+ @@ -7041,9 +7142,9 @@ isAsync(): boolean; **返回值:** - | 类型 | 说明 | - | ------- | ------------------------------------ | - | boolean | true:同步调用成功,false:异步调用成功。 | + | 类型 | 说明 | + | ------- | ---------------------------------------- | + | boolean | true:同步调用成功,false:异步调用成功。| **示例:** @@ -7349,8 +7450,8 @@ static isLocalCalling(): boolean **返回值:** - | 类型 | 说明 | - | ------- | --------------------------------------------------------- | + | 类型 | 说明 | + | ------- | -------------------------------------------------- | | boolean | true:调用在同一台设备,false:调用未在同一台设备。| **示例:** @@ -7522,8 +7623,8 @@ static setCallingIdentity(identity: string): boolean **返回值:** - | 类型 | 说明 | - | ------- | ----------------------------------------- | + | 类型 | 说明 | + | ------- | ---------------------------------| | boolean | true:设置成功,false:设置失败。| **示例:** @@ -7575,17 +7676,17 @@ sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: Me **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | ------- | ------------------------------- | ---- | -------------------------------------------------------------------------------------- | - | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | + | 参数名 | 类型 | 必填 | 说明 | + | ------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- | + | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | | data | [MessageParcel](#messageparceldeprecated) | 是 | 保存待发送数据的 MessageParcel对象。 | | reply | [MessageParcel](#messageparceldeprecated) | 是 | 接收应答数据的MessageParcel对象。 | - | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | + | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | **返回值:** - | 类型 | 说明 | - | ------- | --------------------------------------------- | + | 类型 | 说明 | + | ------- | -------------------------------- | | boolean | true:发送成功,false:发送失败。| **示例:** @@ -7641,12 +7742,12 @@ sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: Me **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | ------- | ------------------------------- | ---- | -------------------------------------------------------------------------------------- | - | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | + | 参数名 | 类型 | 必填 | 说明 | + | ------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- | + | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | | data | [MessageParcel](#messageparceldeprecated) | 是 | 保存待发送数据的 MessageParcel对象。 | | reply | [MessageParcel](#messageparceldeprecated) | 是 | 接收应答数据的MessageParcel对象。 | - | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | + | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | **返回值:** @@ -7711,12 +7812,12 @@ sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | ------- | ------------------------------- | ---- | -------------------------------------------------------------------------------------- | - | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | + | 参数名 | 类型 | 必填 | 说明 | + | ------- | ------------------------------------ | ---- | -------------------------------------------------------------------------------------- | + | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | | data | [MessageSequence](#messagesequence9) | 是 | 保存待发送数据的 MessageSequence对象。 | | reply | [MessageSequence](#messagesequence9) | 是 | 接收应答数据的MessageSequence对象。 | - | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | + | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | **返回值:** @@ -7767,13 +7868,13 @@ sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | ------------- | ---------------------------------- | ---- | -------------------------------------------------------------------------------------- | - | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | + | 参数名 | 类型 | 必填 | 说明 | + | ------------- | ------------------------------------ | ---- | -------------------------------------------------------------------------------------- | + | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | | data | [MessageSequence](#messagesequence9) | 是 | 保存待发送数据的 MessageSequence对象。 | | reply | [MessageSequence](#messagesequence9) | 是 | 接收应答数据的MessageSequence对象。 | - | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | - | AsyncCallback | AsyncCallback<RequestResult> | 是 | 接收发送结果的回调。 | + | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | + | AsyncCallback | AsyncCallback<RequestResult> | 是 | 接收发送结果的回调。 | **示例:** @@ -7817,13 +7918,13 @@ sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: Me **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | ------------- | -------------------------------------- | ---- | -------------------------------------------------------------------------------------- | - | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | - | data | [MessageParcel](#messageparceldeprecated) | 是 | 保存待发送数据的 MessageParcel对象。 | - | reply | [MessageParcel](#messageparceldeprecated) | 是 | 接收应答数据的MessageParcel对象。 | - | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | - | AsyncCallback | AsyncCallback<SendRequestResult> | 是 | 接收发送结果的回调。 | + | 参数名 | 类型 | 必填 | 说明 | + | ------------- | ----------------------------------------- | ---- | -------------------------------------------------------------------------------------- | + | code | number | 是 | 本次请求调用的消息码,由通信双方确定。如果接口由IDL工具生成,则消息代码由IDL自动生成。 | + | data | [MessageParcel](#messageparceldeprecated) | 是 | 保存待发送数据的 MessageParcel对象。 | + | reply | [MessageParcel](#messageparceldeprecated) | 是 | 接收应答数据的MessageParcel对象。 | + | options | [MessageOption](#messageoption) | 是 | 本次请求的同异步模式,默认同步调用。 | + | AsyncCallback | AsyncCallback<SendRequestResult> | 是 | 接收发送结果的回调。 | **示例:** @@ -7881,17 +7982,17 @@ sendMessageRequest请求的响应处理函数,服务端在该函数里处理 **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | ------ | ------------------------------- | ---- | --------------------------------------- | - | code | number | 是 | 对端发送的服务请求码。 | + | 参数名 | 类型 | 必填 | 说明 | + | ------ | ----------------------------------------- | ---- | --------------------------------------- | + | code | number | 是 | 对端发送的服务请求码。 | | data | [MessageParcel](#messageparceldeprecated) | 是 | 携带客户端调用参数的MessageParcel对象。 | | reply | [MessageParcel](#messageparceldeprecated) | 是 | 写入结果的MessageParcel对象。 | - | option | [MessageOption](#messageoption) | 是 | 指示操作是同步还是异步。 | + | option | [MessageOption](#messageoption) | 是 | 指示操作是同步还是异步。 | **返回值:** - | 类型 | 说明 | - | ------- | ----------------------------------------- | + | 类型 | 说明 | + | ------- | -------------------------------- | | boolean | true:操作成功,false:操作失败。| **示例:** @@ -7942,17 +8043,17 @@ sendMessageRequest请求的响应处理函数,服务端在该函数里同步 **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | ------ | ------------------------------- | ---- | ----------------------------------------- | - | code | number | 是 | 对端发送的服务请求码。 | + | 参数名 | 类型 | 必填 | 说明 | + | ------ | ------------------------------------ | ---- | ----------------------------------------- | + | code | number | 是 | 对端发送的服务请求码。 | | data | [MessageSequence](#messagesequence9) | 是 | 携带客户端调用参数的MessageSequence对象。 | | reply | [MessageSequence](#messagesequence9) | 是 | 写入结果的MessageSequence对象。 | - | option | [MessageOption](#messageoption) | 是 | 指示操作是同步还是异步。 | + | option | [MessageOption](#messageoption) | 是 | 指示操作是同步还是异步。 | **返回值:** - | 类型 | 说明 | - | ----------------- | ---------------------------------------------------------------------------------------------- | + | 类型 | 说明 | + | ----------------- | ----------------------------------------------------------------------------------------------- | | boolean | 若在onRemoteMessageRequest中同步地处理请求,则返回一个布尔值:true:操作成功,false:操作失败。 | | Promise\ | 若在onRemoteMessageRequest中异步地处理请求,则返回一个Promise对象。 | @@ -8233,8 +8334,8 @@ getDescriptor(): string 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900008 | proxy or remote object is invalid | + | -------- | -------- | + | 1900008 | proxy or remote object is invalid | **示例:** @@ -8259,13 +8360,13 @@ getDescriptor(): string } } let testRemoteObject = new TestRemoteObject("testObject"); + console.log("RpcServer: descriptor is: " + descriptor); try { let descriptor = testRemoteObject.getDescriptor(); } catch(error) { console.info("rpc get local interface fail, errorCode " + error.code); console.info("rpc get local interface fail, errorMessage " + error.message); } - console.log("RpcServer: descriptor is: " + descriptor); ``` ### getInterfaceDescriptor(deprecated) @@ -8340,8 +8441,8 @@ modifyLocalInterface(localInterface: IRemoteBroker, descriptor: string): void try { this.modifyLocalInterface(this, descriptor); } catch(error) { - console.info(rpc attach local interface fail, errorCode " + error.code); - console.info(rpc attach local interface fail, errorMessage " + error.message); + console.info(" rpc attach local interface fail, errorCode " + error.code); + console.info(" rpc attach local interface fail, errorMessage " + error.message); } } registerDeathRecipient(recipient: MyDeathRecipient, flags: number) { @@ -8414,7 +8515,7 @@ attachLocalInterface(localInterface: IRemoteBroker, descriptor: string): void 映射内存保护类型: - | 名称 | 默认值 | 说明 | + | 名称 | 值 | 说明 | | ---------- | --- | ------------------ | | PROT_EXEC | 4 | 映射的内存可执行 | | PROT_NONE | 0 | 映射的内存不可访问 | @@ -8625,8 +8726,8 @@ mapTypedAshmem(mapType: number): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | ------ | - | 1900001 | call mmap function failed | + | -------- | -------- | + | 1900001 | call mmap function failed | **示例:** @@ -8658,8 +8759,8 @@ mapAshmem(mapType: number): boolean **返回值:** - | 类型 | 说明 | - | ------- | ----------------------------------------- | + | 类型 | 说明 | + | ------- | -------------------------------- | | boolean | true:映射成功,false:映射失败。| **示例:** @@ -8683,8 +8784,8 @@ mapReadWriteAshmem(): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900001 | call mmap function failed | + | -------- | -------- | + | 1900001 | call mmap function failed | **示例:** @@ -8710,8 +8811,8 @@ mapReadAndWriteAshmem(): boolean **返回值:** - | 类型 | 说明 | - | ------- | ----------------------------------------- | + | 类型 | 说明 | + | ------- | -------------------------------- | | boolean | true:映射成功,false:映射失败。| **示例:** @@ -8735,8 +8836,8 @@ mapReadonlyAshmem(): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900001 | call mmap function failed | + | -------- | -------- | + | 1900001 | call mmap function failed | **示例:** @@ -8762,8 +8863,8 @@ mapReadOnlyAshmem(): boolean **返回值:** - | 类型 | 说明 | - | ------- | ----------------------------------------- | + | 类型 | 说明 | + | ------- | -------------------------------- | | boolean | true:映射成功,false:映射失败。| **示例:** @@ -8793,8 +8894,8 @@ setProtectionType(protectionType: number): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | -------- | ------- | - | 1900002 | call os ioctl function failed | + | -------- | -------- | + | 1900002 | call os ioctl function failed | **示例:** @@ -8826,8 +8927,8 @@ setProtection(protectionType: number): boolean **返回值:** - | 类型 | 说明 | - | ------- | ----------------------------------------- | + | 类型 | 说明 | + | ------- | -------------------------------- | | boolean | true:设置成功,false:设置失败。| **示例:** @@ -8859,8 +8960,8 @@ writeAshmem(buf: number[], size: number, offset: number): void 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) | 错误码ID | 错误信息 | - | ------- | -------- | - | 1900003 | write to ashmem failed | + | -------- | -------- | + | 1900003 | write to ashmem failed | **示例:** @@ -8896,9 +8997,9 @@ writeToAshmem(buf: number[], size: number, offset: number): boolean **返回值:** - | 类型 | 说明 | - | ------- | ----------------------------------------------------------------------------------------- | - | boolean | true:如果数据写入成功,false:在其他情况下,如数据写入越界或未获得写入权限。。 | + | 类型 | 说明 | + | ------- | ----------------------------------------------------------------------------- | + | boolean | true:如果数据写入成功,false:在其他情况下,如数据写入越界或未获得写入权限。 | **示例:** @@ -8936,9 +9037,9 @@ readAshmem(size: number, offset: number): number[] 以下错误码的详细介绍请参见[ohos.rpc错误码](../errorcodes/errorcode-rpc.md) - | 错误码ID | 错误信息 | + | 错误码ID | 错误信息 | | -------- | -------- | - | 1900004 | read from ashmem failed | + | 1900004 | read from ashmem failed | **示例:** @@ -8981,7 +9082,7 @@ readFromAshmem(size: number, offset: number): number[] **示例:** - ```ts + ``` ts let ashmem = rpc.Ashmem.createAshmem("ashmem", 1024*1024); let mapResult = ashmem.mapReadAndWriteAshmem(); console.info("RpcTest map ashmem result is " + mapResult); @@ -8990,4 +9091,38 @@ readFromAshmem(size: number, offset: number): number[] console.log("RpcTest: write to Ashmem result is : " + writeResult); let readResult = ashmem.readFromAshmem(5, 0); console.log("RpcTest: read to Ashmem result is : " + readResult); - ``` \ No newline at end of file + ``` + +## 获取context + +**示例:** + + ```ts + import Ability from '@ohos.app.ability.UIAbility'; + export default class MainAbility extends Ability { + onCreate(want, launchParam) { + console.log("[Demo] MainAbility onCreate"); + globalThis.context = this.context; + } + onDestroy() { + console.log("[Demo] MainAbility onDestroy"); + } + onWindowStageCreate(windowStage) { + // Main window is created, set main page for this ability + console.log("[Demo] MainAbility onWindowStageCreate"); + } + onWindowStageDestroy() { + // Main window is destroyed, release UI related resources + console.log("[Demo] MainAbility onWindowStageDestroy"); + } + onForeground() { + // Ability has brought to foreground + console.log("[Demo] MainAbility onForeground"); + } + onBackground() { + // Ability has back to background + console.log("[Demo] MainAbility onBackground"); + } + }; + ``` + 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 5bbab366210ab5c920f97732f24d33e47f037468..32e95a0cdcac8699ef3f7f588cadaf88c9188e15 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 @@ -12,12 +12,14 @@ import screenlock from '@ohos.screenLock'; ``` -## EventType +## EventType9+ 定义系统事件类型。 **系统能力:** SystemCapability.MiscServices.ScreenLock +**系统接口**:此接口为系统接口。 + | 事件类型 | 说明 | | ------------------ | ------------------------ | | beginWakeUp | 表示设备开始唤醒。 | @@ -35,15 +37,17 @@ import screenlock from '@ohos.screenLock'; | screenlockEnabled | 表示锁屏是否启用。 | | serviceRestart | 表示锁屏服务进行重启。 | -## SystemEvent +## SystemEvent9+ 定义系统事件回调参数结构。 **系统能力:** SystemCapability.MiscServices.ScreenLock +**系统接口**:此接口为系统接口 + | 名称 | 类型 | 必填 | 说明 | | --------- | ------ | ---- | ------------- | -| eventType | [EventType](#eventtype) | 是 | 系统事件类型。 | +| eventType | [EventType](#eventtype9) | 是 | 系统事件类型。 | | params | string | 是 | 系统事件参数。 | ## screenlock.isLocked9+ @@ -54,6 +58,8 @@ isLocked(): boolean **系统能力:** SystemCapability.MiscServices.ScreenLock +**系统接口**:此接口为系统接口 + **返回值:** | 类型 | 说明 | @@ -66,26 +72,6 @@ isLocked(): boolean let isLocked = screenlock.isLocked(); ``` -## screenlock.isSecure9+ - -isSecure(): boolean - -判断当前设备的屏幕锁定是否安全(安全屏幕锁定意味着解锁屏幕需要密码、图案或其他用户身份识别)。 - -**系统能力:** SystemCapability.MiscServices.ScreenLock - -**返回值:** - -| 类型 | 说明 | -| ------- | ------------------------------------------------------------ | -| boolean | 返回true表示当前设备的屏幕锁定安全;返回false表示当前设备的屏幕锁定不安全。 | - -**示例:** - -```js -let isSecure = screenlock.isSecure(); -``` - ## screenlock.unlock9+ unlock(callback: AsyncCallback<boolean>): void @@ -94,6 +80,8 @@ unlock(callback: AsyncCallback<boolean>): void **系统能力:** SystemCapability.MiscServices.ScreenLock +**系统接口**:此接口为系统接口 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -128,6 +116,8 @@ unlock(): Promise<boolean> **系统能力:** SystemCapability.MiscServices.ScreenLock +**系统接口**:此接口为系统接口 + **返回值:** | 类型 | 说明 | @@ -160,7 +150,9 @@ lock(callback: AsyncCallback<boolean>): void **系统能力:** SystemCapability.MiscServices.ScreenLock -**系统接口**:此接口为系统接口。 +**需要权限:** ohos.permission.ACCESS_SCREEN_LOCK_INNER + +**系统接口**:此接口为系统接口 **参数:** @@ -196,7 +188,9 @@ lock(): Promise<boolean> **系统能力:** SystemCapability.MiscServices.ScreenLock -**系统接口**:此接口为系统接口。 +**需要权限:** ohos.permission.ACCESS_SCREEN_LOCK_INNER + +**系统接口**:此接口为系统接口 **返回值:** @@ -230,13 +224,15 @@ onSystemEvent(callback: Callback<SystemEvent>): boolean **系统能力:** SystemCapability.MiscServices.ScreenLock -**系统接口**:此接口为系统接口。 +**需要权限:** ohos.permission.ACCESS_SCREEN_LOCK_INNER + +**系统接口**:此接口为系统接口 **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------- | ---- | ----------------- | -| callback | Callback\<[SystemEvent](#systemevent)> | 是 | 锁屏相关的系统事件回调函数。 | +| callback | Callback\<[SystemEvent](#systemevent9)> | 是 | 锁屏相关的系统事件回调函数。 | **返回值:** @@ -266,19 +262,21 @@ try { ## screenlock.sendScreenLockEvent9+ -sendScreenLockEvent(event: string, parameter: number, callback: AsyncCallback<boolean>): void +sendScreenLockEvent(event: String, parameter: number, callback: AsyncCallback<boolean>): void 应用发送事件到锁屏服务。使用callback异步回调。 **系统能力:** SystemCapability.MiscServices.ScreenLock -**系统接口**:此接口为系统接口。 +**需要权限:** ohos.permission.ACCESS_SCREEN_LOCK_INNER + +**系统接口**:此接口为系统接口 **参数:** | 参数名 | 类型 | 必填 | 说明 | | --------- | ------------------------ | ---- | -------------------- | -| event | string | 是 | 事件类型,支持如下取值:
- "unlockScreenResult",表示解锁结果。
- "lockScreenResult",表示锁屏结果。
- "screenDrawDone",表示屏幕绘制完成。 | +| event | String | 是 | 事件类型,支持如下取值:
- "unlockScreenResult",表示解锁结果。
- "lockScreenResult",表示锁屏结果。
- "screenDrawDone",表示屏幕绘制完成。 | | parameter | number | 是 | 事件结果。
- parameter为0,表示成功。例如解锁成功或锁屏成功。
- parameter为1,表示失败。例如解锁失败或锁屏失败。
- parameter为2,表示取消。例如锁屏取消或解锁取消。 | | callback | AsyncCallback\ | 是 | 回调函数。返回true表示发送事件成功;返回false表示发送事件失败。 | @@ -304,19 +302,21 @@ screenlock.sendScreenLockEvent('unlockScreenResult', 0, (err, result) => { ## screenlock.sendScreenLockEvent9+ -sendScreenLockEvent(event: string, parameter: number): Promise<boolean> +sendScreenLockEvent(event: String, parameter: number): Promise<boolean> 应用发送事件到锁屏服务。使用Promise异步回调。 **系统能力:** SystemCapability.MiscServices.ScreenLock -**系统接口**:此接口为系统接口。 +**需要权限:** ohos.permission.ACCESS_SCREEN_LOCK_INNER + +**系统接口**:此接口为系统接口 **参数:** | 参数名 | 类型 | 必填 | 说明 | | --------- | ------ | ---- | --------------------------------------- | -| event | string | 是 | 事件类型,支持如下取值:
- "unlockScreenResult",表示解锁结果。
- "lockScreenResult",表示锁屏结果。
- "screenDrawDone",表示屏幕绘制完成。 | +| event | String | 是 | 事件类型,支持如下取值:
- "unlockScreenResult",表示解锁结果。
- "lockScreenResult",表示锁屏结果。
- "screenDrawDone",表示屏幕绘制完成。 | | parameter | number | 是 | 事件结果。
- parameter为0,表示成功。例如解锁成功或锁屏成功。
- parameter为1,表示失败。例如解锁失败或锁屏失败。
- parameter为2,表示取消。例如锁屏取消或解锁取消。 | **返回值:** @@ -343,7 +343,7 @@ isScreenLocked(callback: AsyncCallback<boolean>): void > **说明:** > -> 从API version 7开始支持,从API version 9开始废弃,建议使用[screenlock.isLocked9+](#screenlockislocked9)代替。 +> 从API version 7开始支持,从API version 9开始废弃。 **系统能力:** SystemCapability.MiscServices.ScreenLock @@ -373,7 +373,7 @@ isScreenLocked(): Promise<boolean> > **说明:** > -> 从API version 7开始支持,从API version 9开始废弃,建议使用[screenlock.isLocked9+](#screenlockislocked9)代替。 +> 从API version 7开始支持,从API version 9开始废弃。 **系统能力:** SystemCapability.MiscServices.ScreenLock @@ -401,7 +401,7 @@ isSecureMode(callback: AsyncCallback<boolean>): void > **说明:** > -> 从API version 7开始支持,从API version 9开始废弃,建议使用[screenlock.isSecure9+](#screenlockissecure9)代替。 +> 从API version 7开始支持,从API version 9开始废弃。 **系统能力:** SystemCapability.MiscServices.ScreenLock @@ -431,7 +431,7 @@ isSecureMode(): Promise<boolean> > **说明:** > -> 从API version 7开始支持,从API version 9开始废弃,建议使用[screenlock.isSecure9+](#screenlockissecure9)代替。 +> 从API version 7开始支持,从API version 9开始废弃。 **系统能力:** SystemCapability.MiscServices.ScreenLock @@ -458,7 +458,7 @@ unlockScreen(callback: AsyncCallback<void>): void > **说明:** > -> 从API version 7开始支持,从API version 9开始废弃,建议使用[screenlock.unlock9+](#screenlockunlock9)代替。 +> 从API version 7开始支持,从API version 9开始废弃。 **系统能力:** SystemCapability.MiscServices.ScreenLock @@ -488,7 +488,7 @@ unlockScreen(): Promise<void> > **说明:** > -> 从API version 7开始支持,从API version 9开始废弃,建议使用[screenlock.unlock9+](#screenlockunlock9)代替。 +> 从API version 7开始支持,从API version 9开始废弃。 **系统能力:** SystemCapability.MiscServices.ScreenLock 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 2ad6cfdbd0bb03dccb912bd2d67d67c6e24c1cd8..ec90213b049c0a140bea2d3837d6ee697ddab435 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-screen.md +++ b/zh-cn/application-dev/reference/apis/js-apis-screen.md @@ -744,7 +744,7 @@ try { | id | number | 是 | 否 | 屏幕的id。 | | parent | number | 是 | 否 | 屏幕所属群组的id。 | | supportedModeInfo | Array<[ScreenModeInfo](#screenmodeinfo)> | 是 | 否 | 屏幕支持的模式集合。 | -| activeModeIndex | number | 是 | 否 | 当前屏幕所处模式索引。 | +| activeModeIndex | number | 是 | 否 | 当前屏幕所处模式索引。模式索引的当前值和值的范围,会根据屏幕当前分辨率、刷新率和设备硬件差异产生变化。 | | orientation | [Orientation](#orientation) | 是 | 否 | 屏幕方向。 | | sourceMode10+ | [ScreenSourceMode](#screensourcemode10) | 是 | 否 | 屏幕来源模式。 | @@ -836,7 +836,7 @@ setScreenActiveMode(modeIndex: number, callback: AsyncCallback<void>): voi | 参数名 | 类型 | 必填 | 说明 | | --------- | ------------------------- | ---- | ------------------------------------------------------------ | -| modeIndex | number | 是 | 模式索引。 | +| modeIndex | number | 是 | 模式索引。模式索引的当前值和值的范围,会根据屏幕当前分辨率、刷新率和设备硬件差异产生变化。 | | callback | AsyncCallback<void> | 是 | 回调函数。当设置屏幕当前显示模式成功,err为undefined,否则为错误对象。 | **错误码:** @@ -874,7 +874,7 @@ setScreenActiveMode(modeIndex: number): Promise<void> | 参数名 | 类型 | 必填 | 说明 | | --------- | ------ | ---- | ---------- | -| modeIndex | number | 是 | 模式索引。 | +| modeIndex | number | 是 | 模式索引。模式索引的当前值和值的范围,会根据屏幕当前分辨率、刷新率和设备硬件差异产生变化。 | **返回值:** 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 282bab54a75a6fb77c5fe7a8ac5e1457b319b4bf..0e34a4bffb1eefdc22b922f869219fe05ed62d3a 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-sensor.md +++ b/zh-cn/application-dev/reference/apis/js-apis-sensor.md @@ -31,7 +31,7 @@ on(type: SensorId.ACCELEROMETER, callback: Callback<AccelerometerResponse> | -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | | type | [SensorId](#sensorid9).ACCELEROMETER | 是 | 传感器类型,该值固定为SensorId.ACCELEROMETER。 | | callback | Callback<[AccelerometerResponse](#accelerometerresponse)> | 是 | 回调函数,异步上报的传感器数据固定为AccelerometerResponse。 | -| options | [Options](#options) | 否 | 设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | **错误码**: @@ -71,7 +71,7 @@ on(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback: Callback<Acceleromete | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | type | [SensorId](#sensorid9).ACCELEROMETER_UNCALIBRATED | 是 | 传感器类型,该值固定为SensorId.ACCELEROMETER_UNCALIBRATED。 | | callback | Callback<[AccelerometerUncalibratedResponse](#accelerometeruncalibratedresponse)> | 是 | 回调函数,异步上报的传感器数据固定为AccelerometerUncalibratedResponse。 | -| options | [Options](#options) | 否 | 设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | **错误码**: @@ -112,7 +112,7 @@ on(type: SensorId.AMBIENT_LIGHT, callback: Callback<LightResponse>, option | -------- | ----------------------------------------------- | ---- | --------------------------------------------------- | | type | [SensorId](#sensorid9).AMBIENT_LIGHT | 是 | 传感器类型,该值固定为SensorId.AMBIENT_LIGHT。 | | callback | Callback<[LightResponse](#lightresponse)> | 是 | 回调函数,异步上报的传感器数据固定为LightResponse。 | -| options | [Options](#options) | 否 | 设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | **错误码**: @@ -148,7 +148,7 @@ on(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback<AmbientTemperatureR | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | type | [SensorId](#sensorid9).AMBIENT_TEMPERATURE | 是 | 传感器类型,该值固定为SensorId.AMBIENT_TEMPERATURE。 | | callback | Callback<[AmbientTemperatureResponse](#ambienttemperatureresponse)> | 是 | 回调函数,异步上报的传感器数据固定为AmbientTemperatureResponse。 | -| options | [Options](#options) | 否 | 设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | **错误码**: @@ -184,7 +184,7 @@ on(type: SensorId.BAROMETER, callback: Callback<BarometerResponse>, option | -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------- | | type | [SensorId](#sensorid9).BAROMETER | 是 | 传感器类型,该值固定为SensorId.BAROMETER。 | | callback | Callback<[BarometerResponse](#barometerresponse)> | 是 | 回调函数,异步上报的传感器数据固定为BarometerResponse。 | -| options | [Options](#options) | 否 | 设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | **错误码**: @@ -220,7 +220,7 @@ on(type: SensorId.GRAVITY, callback: Callback<GravityResponse>,options?: O | -------- | --------------------------------------------------- | ---- | ----------------------------------------------------- | | type | [SensorId](#sensorid9).GRAVITY | 是 | 传感器类型,该值固定为SensorId.GRAVITY。 | | callback | Callback<[GravityResponse](#gravityresponse)> | 是 | 回调函数,异步上报的传感器数据固定为GravityResponse。 | -| options | [Options](#options) | 否 | 设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | **错误码**: @@ -260,7 +260,7 @@ on(type: SensorId.GYROSCOPE, callback: Callback<GyroscopeResponse>,options | -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------- | | type | [SensorId](#sensorid9).GYROSCOPE | 是 | 传感器类型,该值固定为SensorId.GYROSCOPE。 | | callback | Callback<[GyroscopeResponse](#gyroscoperesponse)> | 是 | 回调函数,异步上报的传感器数据固定为GyroscopeResponse。 | -| options | [Options](#options) | 否 | 设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | **错误码**: @@ -301,7 +301,7 @@ on(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback<GyroscopeUncalib | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | type | [SensorId](#sensorid9).GYROSCOPE_UNCALIBRATED | 是 | 传感器类型,该值固定为SensorId.GYROSCOPE_UNCALIBRATED。 | | callback | Callback<[GyroscopeUncalibratedResponse](#gyroscopeuncalibratedresponse)> | 是 | 回调函数,异步上报的传感器数据固定为GyroscopeUncalibratedResponse。 | -| options | [Options](#options) | 否 | 设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | **错误码**: @@ -342,7 +342,7 @@ on(type: SensorId.HALL, callback: Callback<HallResponse>, options?: Option | -------- | --------------------------------------------- | ---- | -------------------------------------------------- | | type | [SensorId](#sensorid9).HALL | 是 | 传感器类型,该值固定为SensorId.HALL。 | | callback | Callback<[HallResponse](#hallresponse)> | 是 | 回调函数,异步上报的传感器数据固定为HallResponse。 | -| options | [Options](#options) | 否 | 设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | **错误码**: @@ -380,7 +380,7 @@ on(type: SensorId.HEART_RATE, callback: Callback<HeartRateResponse>,option | -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------- | | type | [SensorId](#sensorid9).HEART_RATE | 是 | 传感器类型,该值固定为SensorId.HEART_RATE。 | | callback | Callback<[HeartRateResponse](#heartrateresponse)> | 是 | 回调函数,异步上报的传感器数据固定为HeartRateResponse。 | -| options | [Options](#options) | 否 | 设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | **错误码**: @@ -416,7 +416,7 @@ on(type: SensorId.HUMIDITY, callback: Callback<HumidityResponse>,options?: | -------- | ----------------------------------------------------- | ---- | ------------------------------------------------------ | | type | [SensorId](#sensorid9).HUMIDITY | 是 | 传感器类型,该值固定为SensorId.HUMIDITY。 | | callback | Callback<[HumidityResponse](#humidityresponse)> | 是 | 回调函数,异步上报的传感器数据固定为HumidityResponse。 | -| options | [Options](#options) | 否 | 设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | **错误码**: @@ -455,7 +455,7 @@ on(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback<LinearAcceleromete | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | type | [SensorId](#sensorid9).LINEAR_ACCELEROMETER | 是 | 传感器类型,该值固定为SensorId.LINEAR_ACCELEROMETER。 | | callback | Callback<[LinearAccelerometerResponse](#linearaccelerometerresponse)> | 是 | 回调函数,异步上报的传感器数据固定为LinearAccelerometerResponse。 | -| options | [Options](#options) | 否 | 设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | **错误码**: @@ -493,7 +493,7 @@ on(type: SensorId.MAGNETIC_FIELD, callback: Callback<MagneticFieldResponse> | -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | | type | [SensorId](#sensorid9).MAGNETIC_FIELD | 是 | 传感器类型,该值固定为SensorId.MAGNETIC_FIELD。 | | callback | Callback<[MagneticFieldResponse](#magneticfieldresponse)> | 是 | 回调函数,异步上报的传感器数据固定为MagneticFieldResponse。 | -| options | [Options](#options) | 否 | 设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | **错误码**: @@ -531,7 +531,7 @@ on(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback: Callback<MagneticFie | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | type | [SensorId](#sensorid9).MAGNETIC_FIELD_UNCALIBRATED | 是 | 传感器类型,该值固定为SensorId.MAGNETIC_FIELD_UNCALIBRATED。 | | callback | Callback<[MagneticFieldUncalibratedResponse](#magneticfielduncalibratedresponse)> | 是 | 回调函数,异步上报的传感器数据固定为MagneticFieldUncalibratedResponse。 | -| options | [Options](#options) | 否 | 设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | **错误码**: @@ -580,7 +580,7 @@ on(type: SensorId.ORIENTATION, callback: Callback<OrientationResponse>,opt | -------- | ----------------------------------------------------------- | ---- | --------------------------------------------------------- | | type | [SensorId](#sensorid9).ORIENTATION | 是 | 传感器类型,该值固定为SensorId.ORIENTATION。 | | callback | Callback<[OrientationResponse](#orientationresponse)> | 是 | 回调函数,异步上报的传感器数据固定为OrientationResponse。 | -| options | [Options](#options) | 否 | 设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | **示例:** @@ -620,7 +620,7 @@ on(type: SensorId.PEDOMETER, callback: Callback<PedometerResponse>, option | -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------- | | type | [SensorId](#sensorid9).PEDOMETER | 是 | 传感器类型,该值固定为SensorId.PEDOMETER。 | | callback | Callback<[PedometerResponse](#pedometerresponse)> | 是 | 回调函数,异步上报的传感器数据固定为PedometerResponse。 | -| options | [Options](#options) | 否 | 设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | **示例:** @@ -651,7 +651,7 @@ on(type: SensorId.PEDOMETER_DETECTION, callback: Callback<PedometerDetectionR | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | type | [SensorId](#sensorid9).PEDOMETER_DETECTION | 是 | 传感器类型,该值固定为SensorId.PEDOMETER_DETECTION。 | | callback | Callback<[PedometerDetectionResponse](#pedometerdetectionresponse)> | 是 | 回调函数,异步上报的传感器数据固定为PedometerDetectionResponse。 | -| options | [Options](#options) | 否 | 设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | **错误码**: @@ -687,7 +687,7 @@ on(type: SensorId.PROXIMITY, callback: Callback<ProximityResponse>, option | -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------- | | type | [SensorId](#sensorid9).PROXIMITY | 是 | 传感器类型,该值固定为SensorId.PROXIMITY。 | | callback | Callback<[ProximityResponse](#proximityresponse)> | 是 | 回调函数,异步上报的传感器数据固定为ProximityResponse。 | -| options | [Options](#options) | 否 | 设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | **错误码**: @@ -724,7 +724,7 @@ on(type: SensorId.ROTATION_VECTOR, callback: Callback<RotationVectorResponse& | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | type | [SensorId](#sensorid9).ROTATION_VECTOR | 是 | 传感器类型,该值固定为SensorId.ROTATION_VECTOR。 | | callback | Callback<[RotationVectorResponse](#rotationvectorresponse)> | 是 | 回调函数,异步上报的传感器数据固定为RotationVectorResponse。 | -| options | [Options](#options) | 否 | 设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | **错误码**: @@ -764,7 +764,7 @@ on(type: SensorId.SIGNIFICANT_MOTION, callback: Callback<SignificantMotionRes | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | type | [SensorId](#sensorid9).SIGNIFICANT_MOTION | 是 | 传感器类型,该值固定为SensorId.SIGNIFICANT_MOTION。 | | callback | Callback<[SignificantMotionResponse](#significantmotionresponse)> | 是 | 回调函数,异步上报的传感器数据固定为SignificantMotionResponse。 | -| options | [Options](#options) | 否 | 设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | **错误码**: @@ -801,7 +801,7 @@ on(type: SensorId.WEAR_DETECTION, callback: Callback<WearDetectionResponse> | -------- | ------------------------------------------------------------ | ---- | ----------------------------------------------------------- | | type | [SensorId](#sensorid9).WEAR_DETECTION | 是 | 传感器类型,该值固定为SensorId.WEAR_DETECTION。 | | callback | Callback<[WearDetectionResponse](#weardetectionresponse)> | 是 | 回调函数,异步上报的传感器数据固定为WearDetectionResponse。 | -| options | [Options](#options) | 否 | 设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | **错误码**: @@ -2661,7 +2661,7 @@ try { ## sensor.getAngleVariation9+ getAngleVariation(currentRotationMatrix: Array<number>, preRotationMatrix: Array<number>, - callback: AsyncCallback): void + callback: AsyncCallback<Array<number>>): void 计算两个旋转矩阵之间的角度变化。 @@ -2717,7 +2717,7 @@ try { ## sensor.getAngleVariation9+ -getAngleVariation(currentRotationMatrix: Array<number>, preRotationMatrix: Array<number>): Promise +getAngleVariation(currentRotationMatrix: Array<number>, preRotationMatrix: Array<number>): Promise<Array<number>> 得到两个旋转矩阵之间的角度变化。 @@ -2777,7 +2777,7 @@ try { ## sensor.getRotationMatrix9+ -getRotationMatrix(rotationVector: Array<number>, callback: AsyncCallback): void +getRotationMatrix(rotationVector: Array<number>, callback: AsyncCallback<Array<number>>): void 根据旋转矢量获取旋转矩阵。 @@ -2819,7 +2819,7 @@ try { ## sensor.getRotationMatrix9+ -getRotationMatrix(rotationVector: Array<number>): Promise +getRotationMatrix(rotationVector: Array<number>): Promise<Array<number>> 根据旋转矢量获取旋转矩阵。 @@ -2866,7 +2866,7 @@ try { ## sensor.transformRotationMatrix9+ transformRotationMatrix(inRotationVector: Array<number>, coordinates: CoordinatesOptions, - callback: AsyncCallback): void + callback: AsyncCallback<Array<number>>): void 根据指定坐标系映射旋转矩阵。 @@ -2913,7 +2913,7 @@ try { ## sensor.transformRotationMatrix9+ -transformRotationMatrix(inRotationVector: Array<number>, coordinates: CoordinatesOptions): Promise +transformRotationMatrix(inRotationVector: Array<number>, coordinates: CoordinatesOptions): Promise<Array<number>> 根据指定坐标系映射旋转矩阵。 @@ -2964,7 +2964,7 @@ try { ## sensor.getQuaternion9+ -getQuaternion(rotationVector: Array<number>, callback: AsyncCallback): void +getQuaternion(rotationVector: Array<number>, callback: AsyncCallback<Array<number>>): void 根据旋转向量计算归一化四元数。 @@ -3006,7 +3006,7 @@ try { ## sensor.getQuaternion9+ -getQuaternion(rotationVector: Array<number>): Promise +getQuaternion(rotationVector: Array<number>): Promise<Array<number>> 根据旋转向量计算归一化四元数。 @@ -3052,7 +3052,7 @@ try { ## sensor.getOrientation9+ -getOrientation(rotationMatrix: Array<number>, callback: AsyncCallback): void +getOrientation(rotationMatrix: Array<number>, callback: AsyncCallback<Array<number>>): void 根据旋转矩阵计算设备方向。 @@ -3101,7 +3101,7 @@ try { ## sensor.getOrientation9+ -getOrientation(rotationMatrix: Array<number>): Promise +getOrientation(rotationMatrix: Array<number>): Promise<Array<number>> 根据旋转矩阵计算设备的方向。 @@ -3193,7 +3193,7 @@ try { ## sensor.getRotationMatrix9+ -getRotationMatrix(gravity: Array<number>, geomagnetic: Array<number>,): Promise<RotationMatrixResponse> +getRotationMatrix(gravity: Array<number>, geomagnetic: Array<number>): Promise<RotationMatrixResponse> 根据重力矢量和地磁矢量计算旋转矩阵。 @@ -3239,7 +3239,7 @@ try { ## sensor.getSensorList9+ -getSensorList(callback: AsyncCallback): void +getSensorList(callback: AsyncCallback<Array<Sensor>>): void 获取设备上的所有传感器信息。 @@ -3249,7 +3249,7 @@ getSensorList(callback: AsyncCallback): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ---------------------------------------------- | ---- | ---------------- | -| callback | AsyncCallback | 是 | 回调函数,返回传感器属性列表。 | +| callback | AsyncCallback<Array<[Sensor](#sensor9)>> | 是 | 回调函数,返回传感器属性列表。 | **错误码**: @@ -3279,7 +3279,7 @@ try { ## sensor.getSensorList9+ - getSensorList(): Promise< Array<Sensor>> + getSensorList(): Promise<Array<Sensor>> 获取设备上的所有传感器信息。 @@ -3289,7 +3289,7 @@ try { | 参数名 | 类型 | 必填 | 说明 | | ------- | ---------------------------------------- | ---- | ---------------- | -| promise | Promise | 是 | Promise对象,返回传感器属性列表。 | +| promise | Promise<Array<[Sensor](#sensor9)>> | 是 | Promise对象,返回传感器属性列表。 | **错误码**: @@ -3851,7 +3851,7 @@ on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback<Acceler | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | type | [SensorType](#sensortype).SENSOR_TYPE_ID_ACCELEROMETER | 是 | 要订阅的加速度传感器类型为SENSOR_TYPE_ID_ACCELEROMETER。 | | callback | Callback<[AccelerometerResponse](#accelerometerresponse)> | 是 | 注册加速度传感器的回调函数,上报的数据类型为AccelerometerResponse。 | -| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表列表,设置上报频率,默认值为200000000ns。 | **示例:** @@ -3883,7 +3883,7 @@ on(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION,callback:Callback<Line | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | type | [SensorType](#sensortype).SENSOR_TYPE_ID_LINEAR_ACCELERATION | 是 | 要订阅的线性加速度传感器类型为SENSOR_TYPE_ID_LINEAR_ACCELERATION。 | | callback | Callback<[LinearAccelerometerResponse](#linearaccelerometerresponse)> | 是 | 注册线性加速度传感器的回调函数,上报的数据类型为LinearAccelerometerResponse。 | -| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表列表,设置上报频率,默认值为200000000ns。 | ### ACCELEROMETER_UNCALIBRATED(deprecated) @@ -3903,7 +3903,7 @@ on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED,callback: Callback | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | type | [SensorType](#sensortype).SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED | 是 | 要订阅的未校准加速度计传感器类型为SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED。 | | callback | Callback<[AccelerometerUncalibratedResponse](#accelerometeruncalibratedresponse)> | 是 | 注册未校准加速度计传感器的回调函数,上报的数据类型为AccelerometerUncalibratedResponse。 | -| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表列表,设置上报频率,默认值为200000000ns。 | **示例:** ```js @@ -3935,9 +3935,10 @@ on(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback<GravityRespons | -------- | --------------------------------------------------- | ---- | ----------------------------------------------------------- | | type | [SensorType](#sensortype).SENSOR_TYPE_ID_GRAVITY | 是 | 要订阅的重力传感器类型为SENSOR_TYPE_ID_GRAVITY。 | | callback | Callback<[GravityResponse](#gravityresponse)> | 是 | 注册重力传感器的回调函数,上报的数据类型为GravityResponse。 | -| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表列表,设置上报频率,默认值为200000000ns。 | **示例:** + ```js sensor.on(sensor.SensorType.SENSOR_TYPE_ID_GRAVITY,function(data){ console.info('X-coordinate component: ' + data.x); @@ -3966,7 +3967,7 @@ on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback<GyroscopeRes | -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------------ | | type | [SensorType](#sensortype).SENSOR_TYPE_ID_GYROSCOPE | 是 | 要订阅的陀螺仪传感器类型为SENSOR_TYPE_ID_GYROSCOPE。 | | callback | Callback<[GyroscopeResponse](#gyroscoperesponse)> | 是 | 注册陀螺仪传感器的回调函数,上报的数据类型为GyroscopeResponse。 | -| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表列表,设置上报频率,默认值为200000000ns。 | **示例:** ```js @@ -3997,7 +3998,7 @@ on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED,callback:Callback<G | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | type | [SensorType](#sensortype).SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED | 是 | 要订阅的未校准陀螺仪传感器类型为SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED。 | | callback | Callback<[GyroscopeUncalibratedResponse](#gyroscopeuncalibratedresponse)> | 是 | 注册未校准陀螺仪传感器的回调函数,上报的数据类型为GyroscopeUncalibratedResponse。 | -| options | [Options](#options) | 否 | 可选参数列表,设置上报频率。 | +| options | [Options](#options) | 否 | 可选参数列表列表,设置上报频率,默认值为200000000ns。 | **示例:** ```js @@ -4029,7 +4030,7 @@ on(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback<Sig | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | type | [SensorType](#sensortype).SENSOR_TYPE_ID_SIGNIFICANT_MOTION | 是 | 要订阅的大幅动作传感器类型为SENSOR_TYPE_ID_SIGNIFICANT_MOTION。 | | callback | Callback<[SignificantMotionResponse](#significantmotionresponse)> | 是 | 注册有效运动传感器的回调函数,上报的数据类型为SignificantMotionResponse。 | -| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表列表,设置上报频率,默认值为200000000ns。 | **示例:** ```js @@ -4058,7 +4059,7 @@ on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback<Pe | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | type | [SensorType](#sensortype).SENSOR_TYPE_ID_PEDOMETER_DETECTION | 是 | 要订阅的计步检测传感器类型为SENSOR_TYPE_ID_PEDOMETER_DETECTION。 | | callback | Callback<[PedometerDetectionResponse](#pedometerdetectionresponse)> | 是 | 注册计步检测传感器的回调函数,上报的数据类型为PedometerDetectionResponse。 | -| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表列表,设置上报频率,默认值为200000000ns。 | **示例:** ```js @@ -4087,7 +4088,7 @@ on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback<PedometerRes | -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------------ | | type | [SensorType](#sensortype).SENSOR_TYPE_ID_PEDOMETER | 是 | 要订阅的计步传感器类型为SENSOR_TYPE_ID_PEDOMETER。 | | callback | Callback<[PedometerResponse](#pedometerresponse)> | 是 | 注册计步传感器的回调函数,上报的数据类型为PedometerResponse。 | -| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表列表,设置上报频率,默认值为200000000ns。 | **示例:** ```js @@ -4114,7 +4115,7 @@ on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE,callback:Callback<Ambi | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | type | [SensorType](#sensortype).SENSOR_TYPE_ID_AMBIENT_TEMPERATURE | 是 | 要订阅的环境温度传感器类型为SENSOR_TYPE_ID_AMBIENT_TEMPERATURE。 | | callback | Callback<[AmbientTemperatureResponse](#ambienttemperatureresponse)> | 是 | 注册环境温度传感器的回调函数,上报的数据类型为AmbientTemperatureResponse。 | -| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表列表,设置上报频率,默认值为200000000ns。 | **示例:** @@ -4142,7 +4143,7 @@ on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback<Magneti | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | type | [SensorType](#sensortype).SENSOR_TYPE_ID_MAGNETIC_FIELD | 是 | 要订阅的磁场传感器类型为SENSOR_TYPE_ID_MAGNETIC_FIELD。 | | callback | Callback<[MagneticFieldResponse](#magneticfieldresponse)> | 是 | 注册磁场传感器的回调函数,上报的数据类型为MagneticFieldResponse。 | -| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表列表,设置上报频率,默认值为200000000ns。 | **示例:** @@ -4172,7 +4173,7 @@ on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED,callback: Callbac | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | type | [SensorType](#sensortype).SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED | 是 | 要订阅的未校准磁场传感器类型为SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED。 | | callback | Callback<[MagneticFieldUncalibratedResponse](#magneticfielduncalibratedresponse)> | 是 | 注册未校准磁场传感器的回调函数,上报的数据类型为MagneticFieldUncalibratedResponse。 | -| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表列表,设置上报频率,默认值为200000000ns。 | **示例:** ```js @@ -4204,7 +4205,7 @@ on(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback<ProximityRes | -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------------ | | type | [SensorType](#sensortype).SENSOR_TYPE_ID_PROXIMITY | 是 | 要订阅的接近光传感器类型为SENSOR_TYPE_ID_PROXIMITY。 | | callback | Callback<[ProximityResponse](#proximityresponse)> | 是 | 注册接近光传感器的回调函数,上报的数据类型为ProximityResponse。 | -| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表列表,设置上报频率,默认值为200000000ns。 | **示例:** ```js @@ -4231,7 +4232,7 @@ on(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback<HumidityRespo | -------- | ----------------------------------------------------- | ---- | ------------------------------------------------------------ | | type | [SensorType](#sensortype).SENSOR_TYPE_ID_HUMIDITY | 是 | 要订阅的湿度传感器类型为SENSOR_TYPE_ID_HUMIDITY。 | | callback | Callback<[HumidityResponse](#humidityresponse)> | 是 | 注册湿度传感器的回调函数,上报的数据类型为HumidityResponse。 | -| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表列表,设置上报频率,默认值为200000000ns。 | **示例:** @@ -4259,7 +4260,7 @@ on(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback<BarometerRes | -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------------ | | type | [SensorType](#sensortype).SENSOR_TYPE_ID_BAROMETER | 是 | 要订阅的气压计传感器类型为SENSOR_TYPE_ID_BAROMETER。 | | callback | Callback<[BarometerResponse](#barometerresponse)> | 是 | 注册气压计传感器的回调函数,上报的数据类型为BarometerResponse。 | -| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表列表,设置上报频率,默认值为200000000ns。 | **示例:** @@ -4287,7 +4288,7 @@ on(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback<HallResponse>, | -------- | --------------------------------------------- | ---- | ------------------------------------------------------------ | | type | [SensorType](#sensortype).SENSOR_TYPE_ID_HALL | 是 | 要订阅的霍尔传感器类型为SENSOR_TYPE_ID_HALL。 | | callback | Callback<[HallResponse](#hallresponse)> | 是 | 注册霍尔传感器的回调函数,上报的数据类型为 HallResponse。 | -| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表列表,设置上报频率,默认值为200000000ns。 | **示例:** ```js @@ -4314,7 +4315,7 @@ on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback<LightRes | -------- | ------------------------------------------------------ | ---- | ----------------------------------------------------------- | | type | [SensorType](#sensortype).SENSOR_TYPE_ID_AMBIENT_LIGHT | 是 | 要订阅的环境光传感器类型为SENSOR_TYPE_ID_AMBIENT_LIGHT。 | | callback | Callback<[LightResponse](#lightresponse)> | 是 | 注册环境光传感器的回调函数,上报的数据类型为LightResponse。 | -| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表列表,设置上报频率,默认值为200000000ns。 | **示例:** @@ -4342,7 +4343,7 @@ on(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback<Orientatio | -------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ | | type | [SensorType](#sensortype).SENSOR_TYPE_ID_ORIENTATION | 是 | 要订阅的方向传感器类型为SENSOR_TYPE_ID_ORIENTATION | | callback | Callback<[OrientationResponse](#orientationresponse)> | 是 | 注册方向传感器的回调函数,上报的数据类型为OrientationResponse。 | -| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表列表,设置上报频率,默认值为200000000ns。 | **示例:** ```js @@ -4390,7 +4391,7 @@ on(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR,callback: Callback<Rotatio | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | type | [SensorType](#sensortype).SENSOR_TYPE_ID_ROTATION_VECTOR | 是 | 要订阅的旋转矢量传感器类型为SENSOR_TYPE_ID_ROTATION_VECTOR。 | | callback | Callback<[RotationVectorResponse](#rotationvectorresponse)> | 是 | 注册旋转矢量传感器的回调函数,上报的数据类型为RotationVectorResponse。 | -| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表列表,设置上报频率,默认值为200000000ns。 | **示例:** ```js @@ -4420,7 +4421,7 @@ on(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback<WearDet | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | type | [SensorType](#sensortype).SENSOR_TYPE_ID_WEAR_DETECTION | 是 | 要订阅的佩戴检测传感器类型为SENSOR_TYPE_ID_WEAR_DETECTION。 | | callback | Callback<[WearDetectionResponse](#weardetectionresponse)> | 是 | 注册佩戴检测传感器的回调函数,上报的数据类型为WearDetectionResponse。 | -| options | [Options](#options) | 否 | 可选参数列表,设置上报频率,默认值为200000000ns。 | +| options | [Options](#options) | 否 | 可选参数列表列表,设置上报频率,默认值为200000000ns。 | **示例:** ```js @@ -5584,7 +5585,7 @@ sensor.transformCoordinateSystem([1, 0, 0, 0, 1, 0, 0, 0, 1], {x:2, y:3}, functi console.error("Operation failed. Error code: " + err.code + ", message: " + err.message); return; } - console.info("Operation successed. Data obtained: " + data); + console.info("Operation succeeded. Data obtained: " + data); for (var i=0; i < data.length; i++) { console.info("transformCoordinateSystem data[ " + i + "] = " + data[i]); } @@ -5618,7 +5619,7 @@ transformCoordinateSystem(inRotationVector: Array<number>, coordinates: Co ```js const promise = sensor.transformCoordinateSystem([1, 0, 0, 0, 1, 0, 0, 0, 1], {x:2, y:3}); promise.then((data) => { - console.info("Operation successed."); + console.info("Operation succeeded."); for (var i=0; i < data.length; i++) { console.info("transformCoordinateSystem data[ " + i + "] = " + data[i]); } @@ -5718,7 +5719,7 @@ getAltitude(seaPressure: number, currentPressure: number, callback: AsyncCallbac "Operation failed. Error code: " + err.code + ", message: " + err.message); return; } - console.info("Successed to get getAltitude interface get data: " + data); + console.info("Succeeded to get getAltitude interface get data: " + data); }); ``` @@ -5783,7 +5784,7 @@ getGeomagneticDip(inclinationMatrix: Array<number>, callback: AsyncCallbac err.message); return; } - console.info("Successed to get getGeomagneticDip interface get data: " + data); + console.info("Succeeded to get getGeomagneticDip interface get data: " + data); }) ``` @@ -5814,7 +5815,7 @@ getGeomagneticDip(inclinationMatrix: Array<number>): Promise<number> ```js const promise = sensor.getGeomagneticDip([1, 0, 0, 0, 1, 0, 0, 0, 1]); promise.then((data) => { - console.info('getGeomagneticDip_promise successed', data); + console.info('getGeomagneticDip_promise succeeded', data); }).catch((err) => { console.error("Operation failed"); }) @@ -5882,7 +5883,7 @@ getAngleModify(currentRotationMatrix: Array<number>, preRotationMatrix: Ar ```js const promise = sensor.getAngleModify([1,0,0,0,1,0,0,0,1], [1,0,0,0,0.87,-0.50,0,0.50,0.87]); promise.then((data) => { - console.info('getAngleModifiy_promise success'); + console.info('getAngleModify_promise success'); for (var i=0; i < data.length; i++) { console.info("data[" + i + "]: " + data[i]); } @@ -6022,7 +6023,7 @@ createQuaternion(rotationVector: Array<number>): Promise<Array<numbe ```js const promise = sensor.createQuaternion([0.20046076, 0.21907, 0.73978853, 0.60376877]); promise.then((data) => { - console.info('createQuaternion_promise successed'); + console.info('createQuaternion_promise succeeded'); for (var i=0; i < data.length; i++) { console.info("data[" + i + "]: " + data[i]); } @@ -6058,7 +6059,7 @@ getDirection(rotationMatrix: Array<number>, callback: AsyncCallback<Arr err.message); return; } - console.info("SensorJsAPI--->Successed to get getDirection interface get data: " + data); + console.info("SensorJsAPI--->Succeeded to get getDirection interface get data: " + data); for (var i = 1; i < data.length; i++) { console.info("sensor_getDirection_callback" + data[i]); } 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 2b2def039972e6044e70c0b7afed2fae469204a5..d533ba3be47e2b6dfe06320edc602f2057d86c11 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-sim.md +++ b/zh-cn/application-dev/reference/apis/js-apis-sim.md @@ -134,13 +134,14 @@ hasOperatorPrivileges(slotId: number, callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | -| 8300004 | Do not have sim card. | | 8300999 | Unknown error code. | **示例:** @@ -173,13 +174,14 @@ hasOperatorPrivileges(slotId: number): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | -| 8300004 | Do not have sim card. | | 8300999 | Unknown error code. | **示例:** @@ -210,6 +212,8 @@ getISOCountryCodeForSim\(slotId: number, callback: AsyncCallback\): voi **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -250,6 +254,8 @@ getISOCountryCodeForSim\(slotId: number\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -288,6 +294,8 @@ getSimOperatorNumeric\(slotId: number, callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -328,6 +336,8 @@ getSimOperatorNumeric\(slotId: number\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -366,6 +376,8 @@ getSimSpn\(slotId: number, callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -406,6 +418,8 @@ getSimSpn\(slotId: number\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -444,13 +458,14 @@ getSimState\(slotId: number, callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | -| 8300004 | Do not have sim card. | | 8300999 | Unknown error code. | **示例:** @@ -484,13 +499,14 @@ getSimState\(slotId: number\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | -| 8300004 | Do not have sim card. | | 8300999 | Unknown error code. | **示例:** @@ -521,6 +537,8 @@ getCardType\(slotId: number, callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -561,6 +579,8 @@ getCardType\(slotId: number\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -599,13 +619,14 @@ hasSimCard\(slotId: number, callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | -| 8300004 | Do not have sim card. | | 8300999 | Unknown error code. | **示例:** @@ -639,13 +660,14 @@ hasSimCard\(slotId: number\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | -| 8300004 | Do not have sim card. | | 8300999 | Unknown error code. | **示例:** @@ -665,7 +687,7 @@ getSimAccountInfo(slotId: number, callback: AsyncCallback): voi 获取SIM卡账户信息。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -680,6 +702,8 @@ getSimAccountInfo(slotId: number, callback: AsyncCallback): voi **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -706,7 +730,7 @@ getSimAccountInfo(slotId: number): Promise 获取SIM卡账户信息。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -726,6 +750,8 @@ getSimAccountInfo(slotId: number): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -754,7 +780,7 @@ getActiveSimAccountInfoList(callback: AsyncCallback>): vo 获取活跃SIM卡账户信息列表。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -768,6 +794,8 @@ getActiveSimAccountInfoList(callback: AsyncCallback>): vo **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -793,7 +821,7 @@ getActiveSimAccountInfoList(): Promise>; 获取活跃SIM卡账户信息列表。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -807,6 +835,8 @@ getActiveSimAccountInfoList(): Promise>; **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -834,7 +864,7 @@ setDefaultVoiceSlotId(slotId: number, callback: AsyncCallback): void 设置默认语音业务的卡槽ID。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -849,6 +879,8 @@ setDefaultVoiceSlotId(slotId: number, callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -863,8 +895,8 @@ setDefaultVoiceSlotId(slotId: number, callback: AsyncCallback): void **示例:** ```js -sim.setDefaultVoiceSlotId(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.setDefaultVoiceSlotId(0, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -875,7 +907,7 @@ setDefaultVoiceSlotId(slotId: number): Promise\ 设置默认语音业务的卡槽ID。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -895,6 +927,8 @@ setDefaultVoiceSlotId(slotId: number): Promise\ **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -910,9 +944,9 @@ setDefaultVoiceSlotId(slotId: number): Promise\ ```js let promise = sim.setDefaultVoiceSlotId(0); -promise.then(data => { - console.log(`setDefaultVoiceSlotId success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`setDefaultVoiceSlotId success.`); +}).catch((err) => { console.log(`setDefaultVoiceSlotId failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -923,7 +957,7 @@ setShowName\(slotId: number, name: string, callback: AsyncCallback\): voi 设置指定卡槽SIM卡显示的名称。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -939,6 +973,8 @@ setShowName\(slotId: number, name: string, callback: AsyncCallback\): voi **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -953,8 +989,8 @@ setShowName\(slotId: number, name: string, callback: AsyncCallback\): voi ```js let name = "ShowName"; -sim.setShowName(0, name, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.setShowName(0, name, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -964,7 +1000,7 @@ setShowName\(slotId: number, name: string\): Promise\ 设置指定卡槽SIM卡显示的名称。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -985,6 +1021,8 @@ setShowName\(slotId: number, name: string\): Promise\ **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1000,9 +1038,9 @@ setShowName\(slotId: number, name: string\): Promise\ ```js let name = "ShowName"; let promise = sim.setShowName(0, name); -promise.then(data => { - console.log(`setShowName success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`setShowName success.`); +}).catch((err) => { console.log(`setShowName failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1013,7 +1051,7 @@ getShowName(slotId: number, callback: AsyncCallback): void 获取指定卡槽SIM卡的名称。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -1028,6 +1066,8 @@ getShowName(slotId: number, callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1053,7 +1093,7 @@ getShowName(slotId: number): Promise 获取指定卡槽SIM卡的名称。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -1073,6 +1113,8 @@ getShowName(slotId: number): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1100,7 +1142,7 @@ setShowNumber\(slotId: number, number: string, callback: AsyncCallback\): 设置指定卡槽SIM卡的号码。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -1116,6 +1158,8 @@ setShowNumber\(slotId: number, number: string, callback: AsyncCallback\): **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1130,8 +1174,8 @@ setShowNumber\(slotId: number, number: string, callback: AsyncCallback\): ```js let number = '+861xxxxxxxxxx'; -sim.setShowNumber(0, number, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.setShowNumber(0, number, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1142,7 +1186,7 @@ setShowNumber\(slotId: number, number: string\): Promise\ 设置指定卡槽SIM卡的号码。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -1163,6 +1207,8 @@ setShowNumber\(slotId: number, number: string\): Promise\ **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1178,9 +1224,9 @@ setShowNumber\(slotId: number, number: string\): Promise\ ```js let number = '+861xxxxxxxxxx'; let promise = sim.setShowNumber(0, number); -promise.then(data => { - console.log(`setShowNumber success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`setShowNumber success.`); +}).catch((err) => { console.log(`setShowNumber failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1191,7 +1237,7 @@ getShowNumber(slotId: number, callback: AsyncCallback): void 获取指定卡槽SIM卡的号码。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -1206,6 +1252,8 @@ getShowNumber(slotId: number, callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1231,7 +1279,7 @@ getShowNumber(slotId: number): Promise 获取指定卡槽SIM卡的号码。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -1251,6 +1299,8 @@ getShowNumber(slotId: number): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1278,7 +1328,7 @@ activateSim(slotId: number, callback: AsyncCallback): void 激活指定卡槽SIM卡。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -1293,6 +1343,8 @@ activateSim(slotId: number, callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1306,8 +1358,8 @@ activateSim(slotId: number, callback: AsyncCallback): void **示例:** ```js -sim.activateSim(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.activateSim(0, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1318,7 +1370,7 @@ activateSim(slotId: number): Promise\ 激活指定卡槽SIM卡。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -1338,6 +1390,8 @@ activateSim(slotId: number): Promise\ **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1352,9 +1406,9 @@ activateSim(slotId: number): Promise\ ```js let promise = sim.activateSim(0); -promise.then(data => { - console.log(`activateSim success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`activateSim success.`); +}).catch((err) => { console.log(`activateSim failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1365,7 +1419,7 @@ deactivateSim(slotId: number, callback: AsyncCallback): void 禁用指定卡槽SIM卡。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -1380,6 +1434,8 @@ deactivateSim(slotId: number, callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1393,8 +1449,8 @@ deactivateSim(slotId: number, callback: AsyncCallback): void **示例:** ```js -sim.deactivateSim(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.deactivateSim(0, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -1405,7 +1461,7 @@ deactivateSim(slotId: number): Promise\ 禁用指定卡槽SIM卡。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -1425,6 +1481,8 @@ deactivateSim(slotId: number): Promise\ **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1439,9 +1497,9 @@ deactivateSim(slotId: number): Promise\ ```js let promise = sim.deactivateSim(0); -promise.then(data => { - console.log(`deactivateSim success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`deactivateSim success.`); +}).catch((err) => { console.log(`deactivateSim failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1452,7 +1510,7 @@ setLockState(slotId: number, options: LockInfo, callback: AsyncCallback 设置指定卡槽SIM卡的锁状态。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -1520,6 +1580,8 @@ setLockState(slotId: number, options: LockInfo): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1553,7 +1615,7 @@ getLockState(slotId: number, lockType: LockType, callback: AsyncCallback 获取指定卡槽SIM卡的锁状态。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -1616,6 +1680,8 @@ getLockState(slotId: number, lockType: LockType): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1644,7 +1710,7 @@ alterPin(slotId: number, newPin: string, oldPin: string, callback: AsyncCallback 更改Pin密码。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -1661,6 +1727,8 @@ alterPin(slotId: number, newPin: string, oldPin: string, callback: AsyncCallback **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1687,7 +1755,7 @@ alterPin(slotId: number, newPin: string, oldPin: string): Promise 解锁指定卡槽SIM卡密码。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -1894,6 +1970,8 @@ unlockPin(slotId: number, pin: string): Promise<LockStatusResponse\> **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -1923,7 +2001,7 @@ unlockPuk(slotId: number, newPin: string, puk: string, callback: AsyncCallback 解锁指定卡槽SIM卡密码。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -2084,6 +2168,8 @@ unlockPin2(slotId: number, pin2: string): Promise<LockStatusResponse\> **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2113,7 +2199,7 @@ unlockPuk2(slotId: number, newPin2: string, puk2: string, callback: AsyncCallbac 解锁指定卡槽SIM卡密码的解锁密码。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -2130,6 +2216,8 @@ unlockPuk2(slotId: number, newPin2: string, puk2: string, callback: AsyncCallbac **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2158,7 +2246,7 @@ unlockPuk2(slotId: number, newPin2: string, puk2: string): Promise<LockStatus 解锁指定卡槽SIM卡密码的解锁密码。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -2180,6 +2268,8 @@ unlockPuk2(slotId: number, newPin2: string, puk2: string): Promise<LockStatus **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2230,7 +2320,7 @@ getSimIccId(slotId: number, callback: AsyncCallback): void 获取指定卡槽SIM卡的ICCID。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -2245,6 +2335,8 @@ getSimIccId(slotId: number, callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2270,7 +2362,7 @@ getSimIccId(slotId: number): Promise 获取指定卡槽SIM卡的ICCID。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -2290,6 +2382,8 @@ getSimIccId(slotId: number): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2317,7 +2411,7 @@ getVoiceMailIdentifier(slotId: number, callback: AsyncCallback): void 获取指定卡槽中SIM卡语音信箱的alpha标识符。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -2332,6 +2426,8 @@ getVoiceMailIdentifier(slotId: number, callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2357,7 +2453,7 @@ getVoiceMailIdentifier(slotId: number): Promise 获取指定卡槽中SIM卡语音信箱的alpha标识符。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -2377,6 +2473,8 @@ getVoiceMailIdentifier(slotId: number): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2404,7 +2502,7 @@ getVoiceMailNumber(slotId: number, callback: AsyncCallback): void 获取指定卡槽中SIM卡的语音信箱号。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -2419,6 +2517,8 @@ getVoiceMailNumber(slotId: number, callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2444,7 +2544,7 @@ getVoiceMailNumber(slotId: number): Promise 获取指定卡槽中SIM卡的语音信箱号。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -2464,6 +2564,8 @@ getVoiceMailNumber(slotId: number): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2492,7 +2594,7 @@ setVoiceMailInfo(slotId: number, mailName: string, mailNumber: string, callback: 设置语音邮件信息。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -2509,6 +2611,8 @@ setVoiceMailInfo(slotId: number, mailName: string, mailNumber: string, callback: **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2523,8 +2627,8 @@ setVoiceMailInfo(slotId: number, mailName: string, mailNumber: string, callback: **示例:** ```js -sim.setVoiceMailInfo(0, "mail", "xxx@xxx.com", (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.setVoiceMailInfo(0, "mail", "xxx@xxx.com", (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -2535,7 +2639,7 @@ setVoiceMailInfo(slotId: number, mailName: string, mailNumber: string): Promise< 设置语音邮件信息。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -2557,6 +2661,8 @@ setVoiceMailInfo(slotId: number, mailName: string, mailNumber: string): Promise< **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2572,9 +2678,9 @@ setVoiceMailInfo(slotId: number, mailName: string, mailNumber: string): 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 => { +promise.then(() => { + console.log(`setVoiceMailInfo success.`); +}).catch((err) => { console.log(`setVoiceMailInfo failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -2585,7 +2691,7 @@ getSimTelephoneNumber(slotId: number, callback: AsyncCallback): void 获取指定卡槽中SIM卡的MSISDN。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -2600,6 +2706,8 @@ getSimTelephoneNumber(slotId: number, callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2625,7 +2733,7 @@ getSimTelephoneNumber(slotId: number): Promise 获取指定卡槽中SIM卡的MSISDN。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -2645,6 +2753,8 @@ getSimTelephoneNumber(slotId: number): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2672,7 +2782,7 @@ getSimGid1(slotId: number, callback: AsyncCallback): void 获取指定卡槽中SIM卡的组标识符级别1(GID1)。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -2687,6 +2797,8 @@ getSimGid1(slotId: number, callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2712,7 +2824,7 @@ getSimGid1(slotId: number): Promise 获取指定卡槽中SIM卡的组标识符级别1(GID1)。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -2732,6 +2844,8 @@ getSimGid1(slotId: number): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2759,7 +2873,7 @@ getIMSI(slotId: number, callback: AsyncCallback): void 获取国际移动用户识别码。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -2774,6 +2888,8 @@ getIMSI(slotId: number, callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2799,7 +2915,7 @@ getIMSI(slotId: number): Promise 获取国际移动用户识别码。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -2819,6 +2935,8 @@ getIMSI(slotId: number): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2846,7 +2964,7 @@ getOperatorConfigs(slotId: number, callback: AsyncCallback> 获取运营商配置。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE @@ -2906,6 +3025,8 @@ getOperatorConfigs(slotId: number): Promise> **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2913,7 +3034,6 @@ getOperatorConfigs(slotId: number): Promise> | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | -| 8300004 | Do not have sim card. | | 8300999 | Unknown error code. | **示例:** @@ -2933,7 +3053,7 @@ queryIccDiallingNumbers(slotId: number, type: ContactType, callback: AsyncCallba 查询SIM卡联系人号码。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.READ_CONTACTS @@ -2949,6 +3069,8 @@ queryIccDiallingNumbers(slotId: number, type: ContactType, callback: AsyncCallba **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -2975,7 +3097,7 @@ queryIccDiallingNumbers(slotId: number, type: ContactType): Promise { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.addIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -3072,7 +3198,7 @@ addIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: Dialli 添加SIM卡联系人号码。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.WRITE_CONTACTS @@ -3094,6 +3220,8 @@ addIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: Dialli **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -3113,9 +3241,9 @@ let diallingNumbersInof = { number: "138xxxxxxxx" }; let promise = sim.addIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof); -promise.then(data => { - console.log(`addIccDiallingNumbers success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`addIccDiallingNumbers success.`); +}).catch((err) => { console.log(`addIccDiallingNumbers failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -3126,7 +3254,7 @@ delIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: Dialli 删除SIM卡联系人号码。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.WRITE_CONTACTS @@ -3143,6 +3271,8 @@ delIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: Dialli **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -3163,8 +3293,8 @@ let diallingNumbersInof = { recordNumber: 123, pin2: "1234" }; -sim.delIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.delIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -3175,7 +3305,7 @@ delIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: Dialli 删除SIM卡联系人号码。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.WRITE_CONTACTS @@ -3197,6 +3327,8 @@ delIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: Dialli **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -3216,9 +3348,9 @@ let diallingNumbersInof = { number: "138xxxxxxxx" }; let promise = sim.delIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof); -promise.then(data => { - console.log(`delIccDiallingNumbers success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`delIccDiallingNumbers success.`); +}).catch((err) => { console.log(`delIccDiallingNumbers failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -3229,7 +3361,7 @@ updateIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: Dia 更新SIM卡联系人号码。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.WRITE_CONTACTS @@ -3246,6 +3378,8 @@ updateIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: Dia **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -3266,8 +3400,8 @@ let diallingNumbersInof = { recordNumber: 123, pin2: "1234" }; -sim.updateIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.updateIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -3278,7 +3412,7 @@ updateIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: Dia 更新SIM卡联系人号码。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.WRITE_CONTACTS @@ -3300,6 +3434,8 @@ updateIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: Dia **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -3320,9 +3456,9 @@ let diallingNumbersInof = { recordNumber: 123 }; let promise = sim.updateIccDiallingNumbers(0, sim.ContactType.GENERAL_CONTACT, diallingNumbersInof); -promise.then(data => { - console.log(`updateIccDiallingNumbers success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`updateIccDiallingNumbers success.`); +}).catch((err) => { console.log(`updateIccDiallingNumbers failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -3333,7 +3469,7 @@ sendEnvelopeCmd(slotId: number, cmd: string, callback: AsyncCallback): vo 发送信封命令。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -3349,6 +3485,8 @@ sendEnvelopeCmd(slotId: number, cmd: string, callback: AsyncCallback): vo **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -3362,8 +3500,8 @@ sendEnvelopeCmd(slotId: number, cmd: string, callback: AsyncCallback): vo **示例:** ```js -sim.sendEnvelopeCmd(0, "ls", (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.sendEnvelopeCmd(0, "ls", (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -3374,7 +3512,7 @@ sendEnvelopeCmd(slotId: number, cmd: string): Promise 发送信封命令。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -3395,6 +3533,8 @@ sendEnvelopeCmd(slotId: number, cmd: string): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -3409,9 +3549,9 @@ sendEnvelopeCmd(slotId: number, cmd: string): Promise ```js let promise = sim.sendEnvelopeCmd(0, "ls"); -promise.then(data => { - console.log(`sendEnvelopeCmd success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`sendEnvelopeCmd success.`); +}).catch((err) => { console.log(`sendEnvelopeCmd failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -3422,7 +3562,7 @@ sendTerminalResponseCmd(slotId: number, cmd: string, callback: AsyncCallback { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sim.sendTerminalResponseCmd(0, "ls", (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -3463,7 +3605,7 @@ sendTerminalResponseCmd(slotId: number, cmd: string): Promise 发送终端响应命令。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -3484,6 +3626,8 @@ sendTerminalResponseCmd(slotId: number, cmd: string): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -3498,9 +3642,9 @@ sendTerminalResponseCmd(slotId: number, cmd: string): Promise ```js let promise = sim.sendTerminalResponseCmd(0, "ls"); -promise.then(data => { - console.log(`sendTerminalResponseCmd success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`sendTerminalResponseCmd success.`); +}).catch((err) => { console.log(`sendTerminalResponseCmd failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -3512,7 +3656,7 @@ unlockSimLock(slotId: number, lockInfo: PersoLockInfo, callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -3629,7 +3779,6 @@ getOpKey(slotId: number, callback: AsyncCallback): void | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | -| 8300004 | Do not have sim card. | | 8300999 | Unknown error code. | **示例:** @@ -3671,6 +3820,8 @@ getOpKey(slotId: number): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -3678,7 +3829,6 @@ getOpKey(slotId: number): Promise | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | -| 8300004 | Do not have sim card. | | 8300999 | Unknown error code. | **示例:** @@ -3709,6 +3859,8 @@ getOpName(slotId: number, callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -3716,7 +3868,6 @@ getOpName(slotId: number, callback: AsyncCallback): void | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | -| 8300004 | Do not have sim card. | | 8300999 | Unknown error code. | **示例:** @@ -3758,6 +3909,8 @@ getOpName(slotId: number): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -3765,7 +3918,6 @@ getOpName(slotId: number): Promise | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | | 8300003 | System internal error. | -| 8300004 | Do not have sim card. | | 8300999 | Unknown error code. | **示例:** @@ -3783,7 +3935,7 @@ try { SIM卡状态。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 值 | 说明 | | --------------------- | ---- | ---------------------------------------------------------- | @@ -3798,7 +3950,7 @@ SIM卡状态。 卡类型。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 值 | 说明 | | ----- | ----- | ----- | @@ -3817,9 +3969,9 @@ SIM卡状态。 锁类型。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 值 | 说明 | | -------- | ---- | ----------- | @@ -3830,9 +3982,9 @@ SIM卡状态。 锁状态。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 值 | 说明 | | -------- | ---- | ---------- | @@ -3843,30 +3995,30 @@ SIM卡状态。 定制锁类型。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService -| 名称 | 值 | 说明 | -| ------------ | ---- | ----------------------------------------------- | -| PN_PIN_LOCK | 0 | 定制网络PIN锁*(参照 3GPP TS 22.022 [33])*。 | +| 名称 | 值 | 说明 | +| ------------ | ---- | ------------------------------------------------ | +| 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_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_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_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_PIN_LOCK | 8 | 定制SIM的PIN锁(参照 3GPP TS 22.022 [33])。 | | SIM_PUK_LOCK | 9 | 定制SIM的PUK锁。 | ## LockStatusResponse7+ 锁状态响应。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 类型 | 必填 | 说明 | | --------------- | ------ | ---- | --------------------- | @@ -3877,9 +4029,9 @@ SIM卡状态。 锁状态响应。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 类型 | 必填 | 说明 | | -------- | ------------------------ | ---- | -------- | @@ -3891,9 +4043,9 @@ SIM卡状态。 锁状态响应。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 类型 | 必填 | 说明 | | -------- | -------------------------------- | ---- | ------------- | @@ -3904,9 +4056,9 @@ SIM卡状态。 Icc账户信息。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 类型 | 必填 | 说明 | | ---------- | ------- | ---- | ---------------- | @@ -3922,9 +4074,9 @@ Icc账户信息。 运营商配置。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 类型 | 必填 | 说明 | | ----- | ------ | ---- | ---- | @@ -3935,9 +4087,9 @@ Icc账户信息。 拨号号码信息。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 类型 | 必填 | 说明 | | ------------ | ------ | ---- | ---------- | @@ -3950,9 +4102,9 @@ Icc账户信息。 联系人类型。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 值 | 说明 | | --------------- | ---- | ---------- | @@ -3963,9 +4115,9 @@ Icc账户信息。 运营商配置键。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CoreService。 +**系统能力**:SystemCapability.Telephony.CoreService | 名称 | 值 | 说明 | | ------------------------------------------------------- | ------------------------------------------------------ | -------------------- | 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 9d92f570c3639794f016f4b6426dc940b2b34ce8..b93e9ac1a15d4eb3f3bc053f63f4ec8facb6f1bb 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-sms.md +++ b/zh-cn/application-dev/reference/apis/js-apis-sms.md @@ -91,6 +91,19 @@ sendMessage(options: SendMessageOptions): void | ------- | ----------------------------------------- | ---- | ------------------------------------------------------------ | | options | [SendMessageOptions](#sendmessageoptions) | 是 | 发送短信的参数和回调,参考[SendMessageOptions](#sendmessageoptions)。 | +**错误码:** + +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + +| 错误码ID | 错误信息 | +| -------- | -------------------------------------------- | +| 201 | Permission denied. | +| 401 | Parameter error. | +| 8300001 | Invalid parameter value. | +| 8300002 | Operation failed. Cannot connect to service. | +| 8300003 | System internal error. | +| 8300999 | Unknown error code. | + **示例:** ```js @@ -164,7 +177,7 @@ setDefaultSmsSlotId\(slotId: number, callback: AsyncCallback<void>\): void 设置发送短信的默认SIM卡槽ID。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -179,6 +192,8 @@ setDefaultSmsSlotId\(slotId: number, callback: AsyncCallback<void>\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -192,8 +207,8 @@ setDefaultSmsSlotId\(slotId: number, callback: AsyncCallback<void>\): void **示例:** ```js -sms.setDefaultSmsSlotId(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sms.setDefaultSmsSlotId(0, (err) => { + console.log(`callback: err->${JSON.stringify(err)}.`); }); ``` @@ -204,7 +219,7 @@ setDefaultSmsSlotId\(slotId: number\): Promise<void> 设置发送短信的默认SIM卡槽ID。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -224,6 +239,8 @@ setDefaultSmsSlotId\(slotId: number\): Promise<void> **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -238,9 +255,9 @@ setDefaultSmsSlotId\(slotId: number\): Promise<void> ```js let promise = sms.setDefaultSmsSlotId(0); -promise.then(data => { - console.log(`setDefaultSmsSlotId success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`setDefaultSmsSlotId success.`); +}).catch((err) => { console.error(`setDefaultSmsSlotId failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -251,7 +268,7 @@ setSmscAddr\(slotId: number, smscAddr: string, callback: AsyncCallback\): 设置短信服务中心(SMSC)地址。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE,该权限为系统权限 @@ -267,6 +284,8 @@ setSmscAddr\(slotId: number, smscAddr: string, callback: AsyncCallback\): **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -281,8 +300,8 @@ setSmscAddr\(slotId: number, smscAddr: string, callback: AsyncCallback\): ```js let slotId = 0; let smscAddr = '+861xxxxxxxxxx'; -sms.setSmscAddr(slotId, smscAddr, (err,data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sms.setSmscAddr(slotId, smscAddr, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -293,7 +312,7 @@ setSmscAddr\(slotId: number, smscAddr: string\): Promise\ 设置短信服务中心(SMSC)地址。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE,该权限为系统权限 @@ -314,6 +333,8 @@ setSmscAddr\(slotId: number, smscAddr: string\): Promise\ **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -329,9 +350,9 @@ setSmscAddr\(slotId: number, smscAddr: string\): Promise\ let slotId = 0; let smscAddr = '+861xxxxxxxxxx'; let promise = sms.setSmscAddr(slotId, smscAddr); -promise.then(data => { - console.log(`setSmscAddr success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`setSmscAddr success.`); +}).catch((err) => { console.error(`setSmscAddr failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -343,7 +364,7 @@ getSmscAddr\(slotId: number, callback: AsyncCallback\): void 获取短信服务中心(SMSC)地址。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE,该权限为系统权限 @@ -358,6 +379,8 @@ getSmscAddr\(slotId: number, callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -383,7 +406,7 @@ getSmscAddr\(slotId: number\): Promise 获取短信服务中心(SMSC)地址。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.GET_TELEPHONY_STATE,该权限为系统权限 @@ -403,6 +426,8 @@ getSmscAddr\(slotId: number\): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -449,7 +474,7 @@ splitMessage(content: string, callback: AsyncCallback>): void 将长短信拆分为多个片段。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SEND_MESSAGES @@ -464,6 +489,8 @@ splitMessage(content: string, callback: AsyncCallback>): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -489,7 +516,7 @@ splitMessage(content: string): Promise> 将长短信拆分为多个片段。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SEND_MESSAGES @@ -509,6 +536,8 @@ splitMessage(content: string): Promise> **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -536,7 +565,7 @@ addSimMessage(options: SimMessageOptions, callback: AsyncCallback): void 添加SIM卡消息。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES @@ -551,6 +580,8 @@ addSimMessage(options: SimMessageOptions, callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -569,8 +600,8 @@ let simMessageOptions = { pdu: "xxxxxx", status: sms.SimMessageStatus.SIM_MESSAGE_STATUS_READ }; -sms.addSimMessage(simMessageOptions, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sms.addSimMessage(simMessageOptions, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -581,7 +612,7 @@ addSimMessage(options: SimMessageOptions): Promise 添加SIM卡消息。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES @@ -601,6 +632,8 @@ addSimMessage(options: SimMessageOptions): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -620,9 +653,9 @@ let simMessageOptions = { status: sms.SimMessageStatus.SIM_MESSAGE_STATUS_READ }; let promise = sms.addSimMessage(simMessageOptions); -promise.then(data => { - console.log(`addSimMessage success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`addSimMessage success.`); +}).catch((err) => { console.error(`addSimMessage failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -633,7 +666,7 @@ delSimMessage(slotId: number, msgIndex: number, callback: AsyncCallback): 删除SIM卡消息。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES @@ -649,6 +682,8 @@ delSimMessage(slotId: number, msgIndex: number, callback: AsyncCallback): **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -663,8 +698,8 @@ delSimMessage(slotId: number, msgIndex: number, callback: AsyncCallback): ```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.delSimMessage(slotId, msgIndex, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -675,7 +710,7 @@ delSimMessage(slotId: number, msgIndex: number): Promise 删除SIM卡信息。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES @@ -696,6 +731,8 @@ delSimMessage(slotId: number, msgIndex: number): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -711,9 +748,9 @@ delSimMessage(slotId: number, msgIndex: number): Promise 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 => { +promise.then(() => { + console.log(`delSimMessage success.`); +}).catch((err) => { console.error(`delSimMessage failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -724,7 +761,7 @@ updateSimMessage(options: UpdateSimMessageOptions, callback: AsyncCallback { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sms.updateSimMessage(updateSimMessageOptions, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -770,7 +809,7 @@ updateSimMessage(options: UpdateSimMessageOptions): Promise 更新SIM卡消息。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.RECEIVE_SMS,ohos.permission.SEND_MESSAGES @@ -790,6 +829,8 @@ updateSimMessage(options: UpdateSimMessageOptions): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -810,9 +851,9 @@ let updateSimMessageOptions = { smsc: "test" }; let promise = sms.updateSimMessage(updateSimMessageOptions); -promise.then(data => { - console.log(`updateSimMessage success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`updateSimMessage success.`); +}).catch((err) => { console.error(`updateSimMessage failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -823,7 +864,7 @@ getAllSimMessages(slotId: number, callback: AsyncCallback> 获取所有SIM卡消息。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.RECEIVE_SMS @@ -883,6 +926,8 @@ getAllSimMessages(slotId: number): Promise> **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -910,7 +955,7 @@ setCBConfig(options: CBConfigOptions, callback: AsyncCallback): void 设置小区广播配置。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.RECEIVE_SMS @@ -925,6 +970,8 @@ setCBConfig(options: CBConfigOptions, callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -944,8 +991,8 @@ let cbConfigOptions = { endMessageId: 200, ranType: sms.RanType.TYPE_GSM }; -sms.setCBConfig(cbConfigOptions, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +sms.setCBConfig(cbConfigOptions, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -956,7 +1003,7 @@ setCBConfig(options: CBConfigOptions): Promise 设置小区广播配置。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.RECEIVE_SMS @@ -976,6 +1023,8 @@ setCBConfig(options: CBConfigOptions): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -996,9 +1045,9 @@ let cbConfigOptions = { ranType: sms.RanType.TYPE_GSM }; let promise = sms.setCBConfig(cbConfigOptions); -promise.then(data => { - console.log(`setCBConfig success, promise: data->${JSON.stringify(data)}`); -}).catch(err => { +promise.then(() => { + console.log(`setCBConfig success.`); +}).catch((err) => { console.error(`setCBConfig failed, promise: err->${JSON.stringify(err)}`); }); ``` @@ -1009,7 +1058,7 @@ getSmsSegmentsInfo(slotId: number, message: string, force7bit: boolean, callback 获取短信段信息。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **系统能力**:SystemCapability.Telephony.SmsMms @@ -1024,6 +1073,8 @@ getSmsSegmentsInfo(slotId: number, message: string, force7bit: boolean, callback **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -1048,7 +1099,7 @@ getSmsSegmentsInfo(slotId: number, message: string, force7bit: boolean): Promise 获取短信段信息。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **系统能力**:SystemCapability.Telephony.SmsMms @@ -1068,6 +1119,8 @@ getSmsSegmentsInfo(slotId: number, message: string, force7bit: boolean): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -1094,7 +1147,7 @@ isImsSmsSupported(slotId: number, callback: AsyncCallback): void 如果IMS已注册并且在IMS上支持SMS,则支持通过IMS发送SMS。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **系统能力**:SystemCapability.Telephony.SmsMms @@ -1107,6 +1160,8 @@ isImsSmsSupported(slotId: number, callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -1131,7 +1186,7 @@ isImsSmsSupported(slotId: number): Promise 如果IMS已注册并且在IMS上支持SMS,则支持通过IMS发送SMS。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **系统能力**:SystemCapability.Telephony.SmsMms @@ -1149,6 +1204,8 @@ isImsSmsSupported(slotId: number): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -1175,7 +1232,7 @@ getImsShortMessageFormat(callback: AsyncCallback): void 获取IMS上支持的SMS格式。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **系统能力**:SystemCapability.Telephony.SmsMms @@ -1187,9 +1244,10 @@ getImsShortMessageFormat(callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | -| 201 | Permission denied. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -1211,7 +1269,7 @@ getImsShortMessageFormat(): Promise 获取IMS上支持的SMS格式。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **系统能力**:SystemCapability.Telephony.SmsMms @@ -1223,9 +1281,10 @@ getImsShortMessageFormat(): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | -| 201 | Permission denied. | | 401 | Parameter error. | | 8300001 | Invalid parameter value. | | 8300002 | Operation failed. Cannot connect to service. | @@ -1249,7 +1308,7 @@ decodeMms(mmsFilePathName: string | Array, callback: AsyncCallback, callback: AsyncCallback): Promise 彩信解码。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **系统能力**:SystemCapability.Telephony.SmsMms @@ -1304,6 +1365,8 @@ decodeMms(mmsFilePathName: string | Array): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -1330,7 +1393,7 @@ encodeMms(mms: MmsInformation, callback: AsyncCallback>): void 彩信编码。使用callback异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **系统能力**:SystemCapability.Telephony.SmsMms @@ -1343,6 +1406,8 @@ encodeMms(mms: MmsInformation, callback: AsyncCallback>): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -1375,7 +1440,7 @@ encodeMms(mms: MmsInformation): Promise> 彩信编码。使用Promise异步回调。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **系统能力**:SystemCapability.Telephony.SmsMms @@ -1393,6 +1458,8 @@ encodeMms(mms: MmsInformation): Promise> **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 401 | Parameter error. | @@ -1425,7 +1492,7 @@ promise.then(data => { 短信实例。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 类型 | 必填 | 说明 | | ------------------------ | --------------------------------------- | ---- | ------------------------------------------------------------ | @@ -1446,7 +1513,7 @@ promise.then(data => { 短信类型。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 值 | 说明 | | ---------------- | ---- | ---------------------------------------- | @@ -1461,7 +1528,7 @@ promise.then(data => { 发送短信的参数和回调。根据SendMessageOptions中的可选参数content的值判断短信类型。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 类型 | 必填 | 说明 | | ---------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | @@ -1478,7 +1545,7 @@ promise.then(data => { 回调实例。返回短信发送结果、存储已发送短信的URI和是否为长短信的最后一部分。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 类型 | 必填 | 说明 | | ---------- | ------------------------------- | ---- | ----------------------------------------------------------------------------------------- | @@ -1491,7 +1558,7 @@ promise.then(data => { 回调实例,返回短信送达报告。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 类型 | 必填 | 说明 | | ---- | ------------------- | ---- | -------------- | @@ -1502,7 +1569,7 @@ promise.then(data => { 短信发送结果。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 值 | 说明 | | ------------------------------------ | ---- | ------------------------------------------------------ | @@ -1515,9 +1582,9 @@ promise.then(data => { 彩信信息。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 类型 | 必填 | 说明 | | ----------- | ------------------------------------------------------------ | ---- | ---------- | @@ -1529,9 +1596,9 @@ promise.then(data => { 彩信发送请求。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 类型 | 必填 | 说明 | | ---------------- | ------------------------------------ | ---- | ------------ | @@ -1555,9 +1622,9 @@ promise.then(data => { 彩信发送配置。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 类型 | 必填 | 说明 | | ------------- | ---------------------------------- | ---- | -------- | @@ -1570,9 +1637,9 @@ promise.then(data => { 彩信通知索引。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 类型 | 必填 | 说明 | | --------------- | ---------------------------------- | ---- | -------- | @@ -1591,9 +1658,9 @@ promise.then(data => { 彩信确认索引。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 类型 | 必填 | 说明 | | ------------- | ---------------------------------- | ---- | -------- | @@ -1605,9 +1672,9 @@ promise.then(data => { 彩信检索配置。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 类型 | 必填 | 说明 | | -------------- | ------------------------------------ | ---- | -------- | @@ -1630,9 +1697,9 @@ promise.then(data => { 彩信读取原始索引。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 类型 | 必填 | 说明 | | ---------- | ---------------------------------- | ---- | -------- | @@ -1647,9 +1714,9 @@ promise.then(data => { 彩信读取记录索引。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 类型 | 必填 | 说明 | | ---------- | ---------------------------------- | ---- | -------- | @@ -1664,9 +1731,9 @@ promise.then(data => { 彩信附件。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 类型 | 必填 | 说明 | | ----------------------- | ------------------------------------ | ---- | ------------------ | @@ -1685,9 +1752,9 @@ promise.then(data => { 彩信地址。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 类型 | 必填 | 说明 | | ------- | ---------------------------- | ---- | ------ | @@ -1698,9 +1765,9 @@ promise.then(data => { 消息类型。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 值 | 说明 | | ------------------------- | ---- | -------------------- | @@ -1718,9 +1785,9 @@ promise.then(data => { 彩信优先级类型。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 值 | 说明 | | ---------- | ---- | -------------- | @@ -1732,9 +1799,9 @@ promise.then(data => { 彩信版本类型。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 值 | 说明 | | --------------- | ---- | ----------- | @@ -1747,9 +1814,9 @@ promise.then(data => { 彩信字符集。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 值 | 说明 | | --------------- | ------ | ------------------- | @@ -1772,9 +1839,9 @@ promise.then(data => { 处理类型。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 值 | 说明 | | ---------- | ---- | -------- | @@ -1786,9 +1853,9 @@ promise.then(data => { 报告类型。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 值 | 说明 | | ------- | ---- | ---- | @@ -1799,9 +1866,9 @@ promise.then(data => { 小区广播配置选项。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 类型 | 必填 | 说明 | | -------------- | -------------------- | ---- | ------------ | @@ -1815,9 +1882,9 @@ promise.then(data => { SIM卡消息状态。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 值 | 说明 | | ------------------------- | ---- | --------------------------- | @@ -1831,9 +1898,9 @@ SIM卡消息状态。 设备网络制式。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 值 | 说明 | | --------- | ---- | ---- | @@ -1844,9 +1911,9 @@ SIM卡消息状态。 短信编码方案。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 值 | 说明 | | -------------------- | ---- | ------------ | @@ -1859,9 +1926,9 @@ SIM卡消息状态。 SIM卡消息选项。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 类型 | 必填 | 说明 | | ------ | -------------------------------------- | ---- | -------------- | @@ -1874,9 +1941,9 @@ SIM卡消息选项。 更新SIM卡消息选项。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 类型 | 必填 | 说明 | | --------- | -------------------------------------- | ---- | -------------- | @@ -1890,9 +1957,9 @@ SIM卡消息选项。 SIM卡短消息。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 类型 | 必填 | 说明 | | ---------------- | -------------------------------------- | ---- | ------------- | @@ -1904,9 +1971,9 @@ SIM卡短消息。 彩信发送标识。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 类型 | 必填 | 说明 | | --------- | ---------------------------------- | ---- | ------ | @@ -1920,9 +1987,9 @@ SIM卡短消息。 彩信回复标志。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 类型 | 必填 | 说明 | | ------------- | ---------------------------------- | ---- | -------- | @@ -1935,9 +2002,9 @@ SIM卡短消息。 短信段信息。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.SmsMms。 +**系统能力**:SystemCapability.Telephony.SmsMms | 名称 | 类型 | 必填 | 说明 | | -------------------- | ---------------------------------------- | ---- | ------------ | diff --git a/zh-cn/application-dev/reference/apis/js-apis-socket.md b/zh-cn/application-dev/reference/apis/js-apis-socket.md index 944301f6c5509de4702c4535529b73987f310208..15da749a5bda97786e7a63f6fad4f7e127d90619 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-socket.md +++ b/zh-cn/application-dev/reference/apis/js-apis-socket.md @@ -1,6 +1,8 @@ # @ohos.net.socket (Socket连接) -> **说明:** +本模块提供利用Socket进行数据传输的能力,支持TCPSocket、UDPSocket、WebSocket和TLSSocket。 + +> **说明:** > > 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 @@ -12,7 +14,7 @@ import socket from '@ohos.net.socket'; ## socket.constructUDPSocketInstance -constructUDPSocketInstance\(\): UDPSocket +constructUDPSocketInstance(): UDPSocket 创建一个UDPSocket对象。 @@ -24,21 +26,19 @@ constructUDPSocketInstance\(\): UDPSocket | :--------------------------------- | :---------------------- | | [UDPSocket](#udpsocket) | 返回一个UDPSocket对象。 | - **示例:** ```js let udp = socket.constructUDPSocketInstance(); ``` - ## UDPSocket UDPSocket连接。在调用UDPSocket的方法前,需要先通过[socket.constructUDPSocketInstance](#socketconstructudpsocketinstance)创建UDPSocket对象。 ### bind -bind\(address: NetAddress, callback: AsyncCallback\): void +bind(address: NetAddress, callback: AsyncCallback\): void 绑定IP地址和端口,端口可以指定或由系统随机分配。使用callback方式作为异步方法。 @@ -66,17 +66,16 @@ bind\(address: NetAddress, callback: AsyncCallback\): void let udp = socket.constructUDPSocketInstance(); udp.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}, err => { if (err) { - console.log('bind fail'); - return; + console.log('bind fail'); + return; } console.log('bind success'); }) ``` - ### bind -bind\(address: NetAddress\): Promise +bind(address: NetAddress): Promise\ 绑定IP地址和端口,端口可以指定或由系统随机分配。使用Promise方式作为异步方法。 @@ -108,17 +107,16 @@ bind\(address: NetAddress\): Promise ```js let udp = socket.constructUDPSocketInstance(); let promise = udp.bind({address: '192.168.xx.xxx', port: 8080, family: 1}); -promise .then(() => { +promise.then(() => { console.log('bind success'); }).catch(err => { console.log('bind fail'); }); ``` - ### send -send\(options: UDPSendOptions, callback: AsyncCallback\): void +send(options: UDPSendOptions, callback: AsyncCallback\): void 通过UDPSocket连接发送数据。使用callback方式作为异步方法。 @@ -147,25 +145,24 @@ send\(options: UDPSendOptions, callback: AsyncCallback\): void ```js let udp = socket.constructUDPSocketInstance(); udp.send({ - data:'Hello, server!', + data: 'Hello, server!', address: { - address:'192.168.xx.xxx', - port:xxxx, - family:1 + address: '192.168.xx.xxx', + port: xxxx, + family: 1 + } +}, err => { + if (err) { + console.log('send fail'); + return; } -}, err=> { - if (err) { - console.log('send fail'); - return; - } - console.log('send success'); + console.log('send success'); }) ``` - ### send -send\(options: UDPSendOptions\): Promise +send(options: UDPSendOptions): Promise\ 通过UDPSocket连接发送数据。使用Promise方式作为异步方法。 @@ -199,11 +196,11 @@ send\(options: UDPSendOptions\): Promise ```js let udp = socket.constructUDPSocketInstance(); let promise = udp.send({ - data:'Hello, server!', + data: 'Hello, server!', address: { - address:'192.168.xx.xxx', - port:xxxx, - family:1 + address: '192.168.xx.xxx', + port: xxxx, + family: 1 } }); promise.then(() => { @@ -213,10 +210,9 @@ promise.then(() => { }); ``` - ### close -close\(callback: AsyncCallback\): void +close(callback: AsyncCallback\): void 关闭UDPSocket连接。使用callback方式作为异步方法。 @@ -236,17 +232,16 @@ close\(callback: AsyncCallback\): void let udp = socket.constructUDPSocketInstance(); udp.close(err => { if (err) { - console.log('close fail'); - return; + console.log('close fail'); + return; } console.log('close success'); }) ``` - ### close -close\(\): Promise +close(): Promise\ 关闭UDPSocket连接。使用Promise方式作为异步方法。 @@ -272,15 +267,14 @@ promise.then(() => { }); ``` - ### getState -getState\(callback: AsyncCallback\): void +getState(callback: AsyncCallback\): void 获取UDPSocket状态。使用callback方式作为异步方法。 ->![](public_sys-resources/icon-note.gif) **说明:** ->[bind](#bind)方法调用成功后,才可调用此方法。 +> **说明:** +> bind方法调用成功后,才可调用此方法。 **需要权限**:ohos.permission.INTERNET @@ -304,29 +298,28 @@ getState\(callback: AsyncCallback\): void let udp = socket.constructUDPSocketInstance(); udp.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}, err => { if (err) { - console.log('bind fail'); - return; + console.log('bind fail'); + return; } console.log('bind success'); udp.getState((err, data) => { - if (err) { - console.log('getState fail'); - return; - } - console.log('getState success:' + JSON.stringify(data)); + if (err) { + console.log('getState fail'); + return; + } + console.log('getState success:' + JSON.stringify(data)); }) }) ``` - ### getState -getState\(\): Promise +getState(): Promise\ 获取UDPSocket状态。使用Promise方式作为异步方法。 ->![](public_sys-resources/icon-note.gif) **说明:** ->[bind](#bind)方法调用成功后,才可调用此方法。 +> **说明:** +> bind方法调用成功后,才可调用此方法。 **需要权限**:ohos.permission.INTERNET @@ -336,36 +329,36 @@ getState\(\): Promise | 类型 | 说明 | | :----------------------------------------------- | :----------------------------------------- | -| Promise<[SocketStateBase](#socketstatebase)> | 以Promise形式返回获取UDPSocket状态的结果。 | +| Promise\<[SocketStateBase](#socketstatebase)\> | 以Promise形式返回获取UDPSocket状态的结果。 | **示例:** ```js let udp = socket.constructUDPSocketInstance(); -udp.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}, err => { +let promise = udp.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}); +promise.then(err => { if (err) { - console.log('bind fail'); - return; + console.log('bind fail'); + return; } console.log('bind success'); let promise = udp.getState(); promise.then(data => { - console.log('getState success:' + JSON.stringify(data)); + console.log('getState success:' + JSON.stringify(data)); }).catch(err => { - console.log('getState fail'); + console.log('getState fail'); }); -}) +}); ``` - ### setExtraOptions -setExtraOptions\(options: UDPExtraOptions, callback: AsyncCallback\): void +setExtraOptions(options: UDPExtraOptions, callback: AsyncCallback\): void 设置UDPSocket连接的其他属性。使用callback方式作为异步方法。 ->![](public_sys-resources/icon-note.gif) **说明:** ->[bind](#bind)方法调用成功后,才可调用此方法。 +> **说明:** +> bind方法调用成功后,才可调用此方法。 **需要权限**:ohos.permission.INTERNET @@ -389,37 +382,36 @@ setExtraOptions\(options: UDPExtraOptions, callback: AsyncCallback\): voi ```js let udp = socket.constructUDPSocketInstance(); -udp.bind({address:'192.168.xx.xxx', port:xxxx, family:1}, err=> { +udp.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}, err => { if (err) { - console.log('bind fail'); - return; + console.log('bind fail'); + return; } console.log('bind success'); udp.setExtraOptions({ - receiveBufferSize:1000, - sendBufferSize:1000, - reuseAddress:false, - socketTimeout:6000, - broadcast:true - }, err=> { - if (err) { - console.log('setExtraOptions fail'); - return; - } - console.log('setExtraOptions success'); + receiveBufferSize: 1000, + sendBufferSize: 1000, + reuseAddress: false, + socketTimeout: 6000, + broadcast: true + }, err => { + if (err) { + console.log('setExtraOptions fail'); + return; + } + console.log('setExtraOptions success'); }) }) ``` - ### setExtraOptions -setExtraOptions\(options: UDPExtraOptions\): Promise +setExtraOptions(options: UDPExtraOptions): Promise\ 设置UDPSocket连接的其他属性。使用Promise方式作为异步方法。 ->![](public_sys-resources/icon-note.gif) **说明:** ->[bind](#bind)方法调用成功后,才可调用此方法。 +> **说明:** +> bind方法调用成功后,才可调用此方法。 **需要权限**:ohos.permission.INTERNET @@ -448,30 +440,29 @@ setExtraOptions\(options: UDPExtraOptions\): Promise ```js let udp = socket.constructUDPSocketInstance(); -let promise = udp.bind({address:'192.168.xx.xxx', port:xxxx, family:1}); +let promise = udp.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}); promise.then(() => { console.log('bind success'); let promise1 = udp.setExtraOptions({ - receiveBufferSize:1000, - sendBufferSize:1000, - reuseAddress:false, - socketTimeout:6000, - broadcast:true + receiveBufferSize: 1000, + sendBufferSize: 1000, + reuseAddress: false, + socketTimeout: 6000, + broadcast: true }); promise1.then(() => { - console.log('setExtraOptions success'); + console.log('setExtraOptions success'); }).catch(err => { - console.log('setExtraOptions fail'); + console.log('setExtraOptions fail'); }); }).catch(err => { console.log('bind fail'); }); ``` +### on('message') -### on\('message'\) - -on\(type: 'message', callback: Callback<\{message: ArrayBuffer, remoteInfo: SocketRemoteInfo\}\>\): void +on(type: 'message', callback: Callback\<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}\>): void 订阅UDPSocket连接的接收消息事件。使用callback方式作为异步方法。 @@ -482,26 +473,25 @@ on\(type: 'message', callback: Callback<\{message: ArrayBuffer, remoteInfo: Sock | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------------------ | ---- | ----------------------------------------- | | type | string | 是 | 订阅的事件类型。'message':接收消息事件。 | -| callback | Callback<{message: ArrayBuffer, remoteInfo: [SocketRemoteInfo](#socketremoteinfo)}> | 是 | 回调函数。 | +| callback | Callback\<{message: ArrayBuffer, remoteInfo: [SocketRemoteInfo](#socketremoteinfo)}\> | 是 | 回调函数。 | **示例:** ```js let udp = socket.constructUDPSocketInstance(); udp.on('message', value => { - console.log("on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo); + console.log("on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo); }); ``` +### off('message') -### off\('message'\) - -off\(type: 'message', callback?: Callback<\{message: ArrayBuffer, remoteInfo: SocketRemoteInfo\}\>\): void +off(type: 'message', callback?: Callback\<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}\>): void 取消订阅UDPSocket连接的接收消息事件。使用callback方式作为异步方法。 ->![](public_sys-resources/icon-note.gif) **说明:** ->可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 +> **说明:** +> 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 **系统能力**:SystemCapability.Communication.NetStack @@ -516,8 +506,8 @@ off\(type: 'message', callback?: Callback<\{message: ArrayBuffer, remoteInfo: So ```js let udp = socket.constructUDPSocketInstance(); -let callback = value =>{ - console.log("on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo); +let callback = value => { + console.log("on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo); } udp.on('message', callback); // 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 @@ -525,10 +515,9 @@ udp.off('message', callback); udp.off('message'); ``` +### on('listening' | 'close') -### on\('listening' | 'close'\) - -on\(type: 'listening' | 'close', callback: Callback\): void +on(type: 'listening' | 'close', callback: Callback\): void 订阅UDPSocket连接的数据包消息事件或关闭事件。使用callback方式作为异步方法。 @@ -546,22 +535,21 @@ on\(type: 'listening' | 'close', callback: Callback\): void ```js let udp = socket.constructUDPSocketInstance(); udp.on('listening', () => { - console.log("on listening success"); + console.log("on listening success"); }); udp.on('close', () => { - console.log("on close success" ); + console.log("on close success"); }); ``` +### off('listening' | 'close') -### off\('listening' | 'close'\) - -off\(type: 'listening' | 'close', callback?: Callback\): void +off(type: 'listening' | 'close', callback?: Callback\): void 取消订阅UDPSocket连接的数据包消息事件或关闭事件。使用callback方式作为异步方法。 ->![](public_sys-resources/icon-note.gif) **说明:** ->可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 +> **说明:** +> 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 **系统能力**:SystemCapability.Communication.NetStack @@ -576,15 +564,15 @@ off\(type: 'listening' | 'close', callback?: Callback\): void ```js let udp = socket.constructUDPSocketInstance(); -let callback1 = () =>{ - console.log("on listening, success"); +let callback1 = () => { + console.log("on listening, success"); } udp.on('listening', callback1); // 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 udp.off('listening', callback1); udp.off('listening'); -let callback2 = () =>{ - console.log("on close, success"); +let callback2 = () => { + console.log("on close, success"); } udp.on('close', callback2); // 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 @@ -592,10 +580,9 @@ udp.off('close', callback2); udp.off('close'); ``` +### on('error') -### on\('error'\) - -on\(type: 'error', callback: ErrorCallback\): void +on(type: 'error', callback: ErrorCallback): void 订阅UDPSocket连接的error事件。使用callback方式作为异步方法。 @@ -613,19 +600,18 @@ on\(type: 'error', callback: ErrorCallback\): void ```js let udp = socket.constructUDPSocketInstance(); udp.on('error', err => { - console.log("on error, err:" + JSON.stringify(err)) + console.log("on error, err:" + JSON.stringify(err)) }); ``` +### off('error') -### off\('error'\) - -off\(type: 'error', callback?: ErrorCallback\): void +off(type: 'error', callback?: ErrorCallback): void 取消订阅UDPSocket连接的error事件。使用callback方式作为异步方法。 ->![](public_sys-resources/icon-note.gif) **说明:** ->可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 +> **说明:** +> 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 **系统能力**:SystemCapability.Communication.NetStack @@ -640,8 +626,8 @@ off\(type: 'error', callback?: ErrorCallback\): void ```js let udp = socket.constructUDPSocketInstance(); -let callback = err =>{ - console.log("on error, err:" + JSON.stringify(err)); +let callback = err => { + console.log("on error, err:" + JSON.stringify(err)); } udp.on('error', callback); // 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 @@ -649,12 +635,11 @@ udp.off('error', callback); udp.off('error'); ``` - ## NetAddress 目标地址信息。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetStack。 +**系统能力**:SystemCapability.Communication.NetStack | 名称 | 类型 | 必填 | 说明 | | ------- | ------ | ---- | ------------------------------------------------------------ | @@ -666,7 +651,7 @@ udp.off('error'); UDPSocket发送参数。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetStack。 +**系统能力**:SystemCapability.Communication.NetStack | 名称 | 类型 | 必填 | 说明 | | ------- | ---------------------------------- | ---- | -------------- | @@ -677,7 +662,7 @@ UDPSocket发送参数。 UDPSocket连接的其他属性。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetStack。 +**系统能力**:SystemCapability.Communication.NetStack | 名称 | 类型 | 必填 | 说明 | | ----------------- | ------- | ---- | -------------------------------- | @@ -691,7 +676,7 @@ UDPSocket连接的其他属性。 Socket的状态信息。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetStack。 +**系统能力**:SystemCapability.Communication.NetStack | 名称 | 类型 | 必填 | 说明 | | ----------- | ------- | ---- | ---------- | @@ -703,7 +688,7 @@ Socket的状态信息。 Socket的连接信息。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetStack。 +**系统能力**:SystemCapability.Communication.NetStack | 名称 | 类型 | 必填 | 说明 | | ------- | ------ | ---- | ------------------------------------------------------------ | @@ -720,7 +705,7 @@ UDP 其余错误码映射形式为:2301000 + Linux内核错误码。 ## socket.constructTCPSocketInstance -constructTCPSocketInstance\(\): TCPSocket +constructTCPSocketInstance(): TCPSocket 创建一个TCPSocket对象。 @@ -728,9 +713,9 @@ constructTCPSocketInstance\(\): TCPSocket **返回值:** - | 类型 | 说明 | +| 类型 | 说明 | | :--------------------------------- | :---------------------- | - | [TCPSocket](#tcpsocket) | 返回一个TCPSocket对象。 | +| [TCPSocket](#tcpsocket) | 返回一个TCPSocket对象。 | **示例:** @@ -738,14 +723,13 @@ constructTCPSocketInstance\(\): TCPSocket let tcp = socket.constructTCPSocketInstance(); ``` - ## TCPSocket TCPSocket连接。在调用TCPSocket的方法前,需要先通过[socket.constructTCPSocketInstance](#socketconstructtcpsocketinstance)创建TCPSocket对象。 ### bind -bind\(address: NetAddress, callback: AsyncCallback\): void +bind(address: NetAddress, callback: AsyncCallback\): void 绑定IP地址和端口,端口可以指定或由系统随机分配。使用callback方法作为异步方法。 @@ -773,17 +757,16 @@ bind\(address: NetAddress, callback: AsyncCallback\): void let tcp = socket.constructTCPSocketInstance(); tcp.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}, err => { if (err) { - console.log('bind fail'); - return; + console.log('bind fail'); + return; } console.log('bind success'); }) ``` - ### bind -bind\(address: NetAddress\): Promise +bind(address: NetAddress): Promise\ 绑定IP地址和端口,端口可以指定或由系统随机分配。使用Promise方法作为异步方法。 @@ -822,13 +805,15 @@ promise.then(() => { }); ``` - ### connect -connect\(options: TCPConnectOptions, callback: AsyncCallback\): void +connect(options: TCPConnectOptions, callback: AsyncCallback\): void 连接到指定的IP地址和端口。使用callback方法作为异步方法。 +> **说明:** +> bind方法调用成功后,才可调用此方法。 + **需要权限**:ohos.permission.INTERNET **系统能力**:SystemCapability.Communication.NetStack @@ -851,19 +836,18 @@ connect\(options: TCPConnectOptions, callback: AsyncCallback\): void ```js let tcp = socket.constructTCPSocketInstance(); -tcp.connect({ address: {address: '192.168.xx.xxx', port: xxxx, family: 1} , timeout: 6000}, err => { +tcp.connect({address: {address: '192.168.xx.xxx', port: xxxx, family: 1}, timeout: 6000}, err => { if (err) { - console.log('connect fail'); - return; + console.log('connect fail'); + return; } console.log('connect success'); }) ``` - ### connect -connect\(options: TCPConnectOptions\): Promise +connect(options: TCPConnectOptions): Promise\ 连接到指定的IP地址和端口。使用promise方法作为异步方法。 @@ -894,7 +878,7 @@ connect\(options: TCPConnectOptions\): Promise ```js let tcp = socket.constructTCPSocketInstance(); -let promise = tcp.connect({ address: {address: '192.168.xx.xxx', port: xxxx, family: 1} , timeout: 6000}); +let promise = tcp.connect({address: {address: '192.168.xx.xxx', port: xxxx, family: 1}, timeout: 6000}); promise.then(() => { console.log('connect success') }).catch(err => { @@ -902,15 +886,14 @@ promise.then(() => { }); ``` - ### send -send\(options: TCPSendOptions, callback: AsyncCallback\): void +send(options: TCPSendOptions, callback: AsyncCallback\): void 通过TCPSocket连接发送数据。使用callback方式作为异步方法。 ->![](public_sys-resources/icon-note.gif) **说明:** ->[connect](#connect)方法调用成功后,才可调用此方法。 +> **说明:** +> connect方法调用成功后,才可调用此方法。 **需要权限**:ohos.permission.INTERNET @@ -934,32 +917,29 @@ send\(options: TCPSendOptions, callback: AsyncCallback\): void ```js let tcp = socket.constructTCPSocketInstance(); -let promise = tcp.connect({ address: {address: '192.168.xx.xxx', port: xxxx, family: 1} , timeout: 6000}); -promise.then(() => { +tcp.connect({address: {address: '192.168.xx.xxx', port: xxxx, family: 1}, timeout: 6000}, () => { console.log('connect success'); tcp.send({ - data:'Hello, server!' - },err => { - if (err) { - console.log('send fail'); - return; - } - console.log('send success'); + data: 'Hello, server!' + //此处省略encoding, 默认为utf-8编码格式 + }, err => { + if (err) { + console.log('send fail'); + return; + } + console.log('send success'); }) -}).catch(err => { - console.log('connect fail'); -}); +}) ``` - ### send -send\(options: TCPSendOptions\): Promise +send(options: TCPSendOptions): Promise\ 通过TCPSocket连接发送数据。使用Promise方式作为异步方法。 ->![](public_sys-resources/icon-note.gif) **说明:** ->[connect](#connect)方法调用成功后,才可调用此方法。 +> **说明:** +> connect方法调用成功后,才可调用此方法。 **需要权限**:ohos.permission.INTERNET @@ -988,26 +968,25 @@ send\(options: TCPSendOptions\): Promise ```js let tcp = socket.constructTCPSocketInstance(); -let promise1 = tcp.connect({ address: {address: '192.168.xx.xxx', port: xxxx, family: 1} , timeout: 6000}); +let promise1 = tcp.connect({address: {address: '192.168.xx.xxx', port: xxxx, family: 1}, timeout: 6000}); promise1.then(() => { console.log('connect success'); let promise2 = tcp.send({ - data:'Hello, server!' + data: 'Hello, server!' }); promise2.then(() => { - console.log('send success'); + console.log('send success'); }).catch(err => { - console.log('send fail'); + console.log('send fail'); }); }).catch(err => { console.log('connect fail'); }); ``` - ### close -close\(callback: AsyncCallback\): void +close(callback: AsyncCallback\): void 关闭TCPSocket连接。使用callback方式作为异步方法。 @@ -1033,17 +1012,16 @@ close\(callback: AsyncCallback\): void let tcp = socket.constructTCPSocketInstance(); tcp.close(err => { if (err) { - console.log('close fail'); - return; + console.log('close fail'); + return; } console.log('close success'); }) ``` - ### close -close\(\): Promise +close(): Promise\ 关闭TCPSocket连接。使用Promise方式作为异步方法。 @@ -1075,15 +1053,14 @@ promise.then(() => { }); ``` - ### getRemoteAddress -getRemoteAddress\(callback: AsyncCallback\): void +getRemoteAddress(callback: AsyncCallback\): void 获取对端Socket地址。使用callback方式作为异步方法。 ->![](public_sys-resources/icon-note.gif) **说明:** ->[connect](#connect)方法调用成功后,才可调用此方法。 +> **说明:** +> connect方法调用成功后,才可调用此方法。 **需要权限**:ohos.permission.INTERNET @@ -1105,30 +1082,26 @@ getRemoteAddress\(callback: AsyncCallback\): void ```js let tcp = socket.constructTCPSocketInstance(); -let promise = tcp.connect({ address: {address: '192.168.xx.xxx', port: xxxx, family: 1} , timeout: 6000}); -promise.then(() => { +tcp.connect({address: {address: '192.168.xx.xxx', port: xxxx, family: 1}, timeout: 6000}, () => { console.log('connect success'); tcp.getRemoteAddress((err, data) => { - if (err) { - console.log('getRemoteAddressfail'); - return; - } - console.log('getRemoteAddresssuccess:' + JSON.stringify(data)); + if (err) { + console.log('getRemoteAddressfail'); + return; + } + console.log('getRemoteAddresssuccess:' + JSON.stringify(data)); }) -}).catch(err => { - console.log('connect fail'); }); ``` - ### getRemoteAddress -getRemoteAddress\(\): Promise +getRemoteAddress(): Promise\ 获取对端Socket地址。使用Promise方式作为异步方法。 ->![](public_sys-resources/icon-note.gif) **说明:** ->[connect](#connect)方法调用成功后,才可调用此方法。 +> **说明:** +> connect方法调用成功后,才可调用此方法。 **需要权限**:ohos.permission.INTERNET @@ -1150,29 +1123,28 @@ getRemoteAddress\(\): Promise ```js let tcp = socket.constructTCPSocketInstance(); -let promise1 = tcp.connect({ address: {address: '192.168.xx.xxx', port: xxxx, family: 1} , timeout: 6000}); +let promise1 = tcp.connect({address: {address: '192.168.xx.xxx', port: xxxx, family: 1}, timeout: 6000}); promise1.then(() => { console.log('connect success'); let promise2 = tcp.getRemoteAddress(); promise2.then(() => { - console.log('getRemoteAddress success'); + console.log('getRemoteAddress success'); }).catch(err => { - console.log('getRemoteAddressfail'); + console.log('getRemoteAddressfail'); }); }).catch(err => { console.log('connect fail'); }); ``` - ### getState -getState\(callback: AsyncCallback\): void +getState(callback: AsyncCallback\): void 获取TCPSocket状态。使用callback方式作为异步方法。 ->![](public_sys-resources/icon-note.gif) **说明:** ->[bind](#bind)或[connect](#connect)方法调用成功后,才可调用此方法。 +> **说明:** +> bind或connect方法调用成功后,才可调用此方法。 **需要权限**:ohos.permission.INTERNET @@ -1194,30 +1166,26 @@ getState\(callback: AsyncCallback\): void ```js let tcp = socket.constructTCPSocketInstance(); -let promise = tcp.connect({ address: {address: '192.168.xx.xxx', port: xxxx, family: 1} , timeout: 6000}); -promise.then(() => { +let promise = tcp.connect({address: {address: '192.168.xx.xxx', port: xxxx, family: 1}, timeout: 6000}, () => { console.log('connect success'); tcp.getState((err, data) => { - if (err) { - console.log('getState fail'); - return; - } - console.log('getState success:' + JSON.stringify(data)); + if (err) { + console.log('getState fail'); + return; + } + console.log('getState success:' + JSON.stringify(data)); }); -}).catch(err => { - console.log('connect fail'); }); ``` - ### getState -getState\(\): Promise +getState(): Promise\ 获取TCPSocket状态。使用Promise方式作为异步方法。 ->![](public_sys-resources/icon-note.gif) **说明:** ->[bind](#bind)或[connect](#connect)方法调用成功后,才可调用此方法。 +> **说明:** +> bind或connect方法调用成功后,才可调用此方法。 **需要权限**:ohos.permission.INTERNET @@ -1239,29 +1207,28 @@ getState\(\): Promise ```js let tcp = socket.constructTCPSocketInstance(); -let promise = tcp.connect({ address: {address: '192.168.xx.xxx', port: xxxx, family: 1} , timeout: 6000}); +let promise = tcp.connect({address: {address: '192.168.xx.xxx', port: xxxx, family: 1}, timeout: 6000}); promise.then(() => { console.log('connect success'); let promise1 = tcp.getState(); promise1.then(() => { - console.log('getState success'); + console.log('getState success'); }).catch(err => { - console.log('getState fail'); + console.log('getState fail'); }); }).catch(err => { console.log('connect fail'); }); ``` - ### setExtraOptions -setExtraOptions\(options: TCPExtraOptions, callback: AsyncCallback\): void +setExtraOptions(options: TCPExtraOptions, callback: AsyncCallback\): void 设置TCPSocket连接的其他属性。使用callback方式作为异步方法。 ->![](public_sys-resources/icon-note.gif) **说明:** ->[bind](#bind)或[connect](#connect)方法调用成功后,才可调用此方法。 +> **说明:** +> bind或connect方法调用成功后,才可调用此方法。 **需要权限**:ohos.permission.INTERNET @@ -1285,39 +1252,35 @@ setExtraOptions\(options: TCPExtraOptions, callback: AsyncCallback\): voi ```js let tcp = socket.constructTCPSocketInstance(); -let promise = tcp.connect({ address: {address: '192.168.xx.xxx', port: xxxx, family: 1} , timeout: 6000}); -promise.then(() => { +let promise = tcp.connect({address: {address: '192.168.xx.xxx', port: xxxx, family: 1}, timeout: 6000}, () => { console.log('connect success'); tcp.setExtraOptions({ - keepAlive: true, - OOBInline: true, - TCPNoDelay: true, - socketLinger: { on:true, linger:10 }, - receiveBufferSize: 1000, - sendBufferSize: 1000, - reuseAddress: true, - socketTimeout: 3000, - },err => { - if (err) { - console.log('setExtraOptions fail'); - return; - } - console.log('setExtraOptions success'); + keepAlive: true, + OOBInline: true, + TCPNoDelay: true, + socketLinger: {on: true, linger: 10}, + receiveBufferSize: 1000, + sendBufferSize: 1000, + reuseAddress: true, + socketTimeout: 3000, + }, err => { + if (err) { + console.log('setExtraOptions fail'); + return; + } + console.log('setExtraOptions success'); }); -}).catch(err => { - console.log('connect fail'); }); ``` - ### setExtraOptions -setExtraOptions\(options: TCPExtraOptions\): Promise +setExtraOptions(options: TCPExtraOptions): Promise\ 设置TCPSocket连接的其他属性,使用Promise方式作为异步方法。 ->![](public_sys-resources/icon-note.gif) **说明:** ->[bind](#bind)或[connect](#connect)方法调用成功后,才可调用此方法。 +> **说明:** +> bind或connect方法调用成功后,才可调用此方法。 **需要权限**:ohos.permission.INTERNET @@ -1346,33 +1309,32 @@ setExtraOptions\(options: TCPExtraOptions\): Promise ```js let tcp = socket.constructTCPSocketInstance(); -let promise = tcp.connect({ address: {address: '192.168.xx.xxx', port: xxxx, family: 1} , timeout: 6000}); +let promise = tcp.connect({address: {address: '192.168.xx.xxx', port: xxxx, family: 1}, timeout: 6000}); promise.then(() => { console.log('connect success'); let promise1 = tcp.setExtraOptions({ - keepAlive: true, - OOBInline: true, - TCPNoDelay: true, - socketLinger: { on:true, linger:10 }, - receiveBufferSize: 1000, - sendBufferSize: 1000, - reuseAddress: true, - socketTimeout: 3000, + keepAlive: true, + OOBInline: true, + TCPNoDelay: true, + socketLinger: {on: true, linger: 10}, + receiveBufferSize: 1000, + sendBufferSize: 1000, + reuseAddress: true, + socketTimeout: 3000, }); promise1.then(() => { - console.log('setExtraOptions success'); + console.log('setExtraOptions success'); }).catch(err => { - console.log('setExtraOptions fail'); + console.log('setExtraOptions fail'); }); }).catch(err => { console.log('connect fail'); }); ``` +### on('message') -### on\('message'\) - -on\(type: 'message', callback: Callback<\{message: ArrayBuffer, remoteInfo: SocketRemoteInfo\}\>\): void +on(type: 'message', callback: Callback<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}\>): void 订阅TCPSocket连接的接收消息事件。使用callback方式作为异步方法。 @@ -1390,19 +1352,18 @@ on\(type: 'message', callback: Callback<\{message: ArrayBuffer, remoteInfo: Sock ```js let tcp = socket.constructTCPSocketInstance(); tcp.on('message', value => { - console.log("on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo) + console.log("on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo) }); ``` +### off('message') -### off\('message'\) - -off\(type: 'message', callback?: Callback<\{message: ArrayBuffer, remoteInfo: SocketRemoteInfo\}\>\): void +off(type: 'message', callback?: Callback<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}\>): void 取消订阅TCPSocket连接的接收消息事件。使用callback方式作为异步方法。 ->![](public_sys-resources/icon-note.gif) **说明:** ->可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 +> **说明:** +> 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 **系统能力**:SystemCapability.Communication.NetStack @@ -1417,8 +1378,8 @@ off\(type: 'message', callback?: Callback<\{message: ArrayBuffer, remoteInfo: So ```js let tcp = socket.constructTCPSocketInstance(); -let callback = value =>{ - console.log("on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo); +let callback = value => { + console.log("on message, message:" + value.message + ", remoteInfo:" + value.remoteInfo); } tcp.on('message', callback); // 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 @@ -1426,10 +1387,9 @@ tcp.off('message', callback); tcp.off('message'); ``` +### on('connect' | 'close') -### on\('connect' | 'close'\) - -on\(type: 'connect' | 'close', callback: Callback\): void +on(type: 'connect' | 'close', callback: Callback\): void 订阅TCPSocket的连接事件或关闭事件。使用callback方式作为异步方法。 @@ -1447,22 +1407,21 @@ on\(type: 'connect' | 'close', callback: Callback\): void ```js let tcp = socket.constructTCPSocketInstance(); tcp.on('connect', () => { - console.log("on connect success") + console.log("on connect success") }); tcp.on('close', data => { - console.log("on close success") + console.log("on close success") }); ``` +### off('connect' | 'close') -### off\('connect' | 'close'\) - -off\(type: 'connect' | 'close', callback?: Callback\): void +off(type: 'connect' | 'close', callback?: Callback\): void 取消订阅TCPSocket的连接事件或关闭事件。使用callback方式作为异步方法。 ->![](public_sys-resources/icon-note.gif) **说明:** ->可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 +> **说明:** +> 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 **系统能力**:SystemCapability.Communication.NetStack @@ -1477,15 +1436,15 @@ off\(type: 'connect' | 'close', callback?: Callback\): void ```js let tcp = socket.constructTCPSocketInstance(); -let callback1 = () =>{ - console.log("on connect success"); +let callback1 = () => { + console.log("on connect success"); } tcp.on('connect', callback1); // 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 tcp.off('connect', callback1); tcp.off('connect'); -let callback2 = () =>{ - console.log("on close success"); +let callback2 = () => { + console.log("on close success"); } tcp.on('close', callback2); // 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 @@ -1493,10 +1452,9 @@ tcp.off('close', callback2); tcp.off('close'); ``` +### on('error') -### on\('error'\) - -on\(type: 'error', callback: ErrorCallback\): void +on(type: 'error', callback: ErrorCallback): void 订阅TCPSocket连接的error事件。使用callback方式作为异步方法。 @@ -1514,19 +1472,18 @@ on\(type: 'error', callback: ErrorCallback\): void ```js let tcp = socket.constructTCPSocketInstance(); tcp.on('error', err => { - console.log("on error, err:" + JSON.stringify(err)) + console.log("on error, err:" + JSON.stringify(err)) }); ``` +### off('error') -### off\('error'\) - -off\(type: 'error', callback?: ErrorCallback\): void +off(type: 'error', callback?: ErrorCallback): void 取消订阅TCPSocket连接的error事件。使用callback方式作为异步方法。 ->![](public_sys-resources/icon-note.gif) **说明:** ->可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 +> **说明:** +> 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 **系统能力**:SystemCapability.Communication.NetStack @@ -1541,8 +1498,8 @@ off\(type: 'error', callback?: ErrorCallback\): void ```js let tcp = socket.constructTCPSocketInstance(); -let callback = err =>{ - console.log("on error, err:" + JSON.stringify(err)); +let callback = err => { + console.log("on error, err:" + JSON.stringify(err)); } tcp.on('error', callback); // 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 @@ -1550,12 +1507,11 @@ tcp.off('error', callback); tcp.off('error'); ``` - ## TCPConnectOptions TCPSocket连接的参数。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetStack。 +**系统能力**:SystemCapability.Communication.NetStack | 名称 | 类型 | 必填 | 说明 | | ------- | ---------------------------------- | ---- | -------------------------- | @@ -1566,7 +1522,7 @@ TCPSocket连接的参数。 TCPSocket发送请求的参数。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetStack。 +**系统能力**:SystemCapability.Communication.NetStack | 名称 | 类型 | 必填 | 说明 | | -------- | ------ | ---- | ------------------------------------------------------------ | @@ -1577,7 +1533,7 @@ TCPSocket发送请求的参数。 TCPSocket连接的其他属性。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetStack。 +**系统能力**:SystemCapability.Communication.NetStack | 名称 | 类型 | 必填 | 说明 | | ----------------- | ------- | ---- | ------------------------------------------------------------ | @@ -1622,7 +1578,7 @@ TLSSocket连接。在调用TLSSocket的方法前,需要先通过[socket.constr ### bind9+ -bind\(address: NetAddress, callback: AsyncCallback\): void +bind(address: NetAddress, callback: AsyncCallback\): void 绑定IP地址和端口。使用callback方法作为异步方法。 @@ -1660,7 +1616,7 @@ tls.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}, err => { ### bind9+ -bind\(address: NetAddress\): Promise +bind(address: NetAddress): Promise\ 绑定IP地址和端口。使用Promise方法作为异步方法。 @@ -1702,7 +1658,7 @@ promise.then(() => { ### getState9+ -getState\(callback: AsyncCallback\): void +getState(callback: AsyncCallback\): void 在TLSSocket的bind成功之后,获取TLSSocket状态。使用callback方式作为异步方法。 @@ -1742,7 +1698,7 @@ tls.getState((err, data) => { ### getState9+ -getState\(\): Promise +getState(): Promise\ 在TLSSocket的bind成功之后,获取TLSSocket状态。使用Promise方式作为异步方法。 @@ -1764,12 +1720,11 @@ getState\(\): Promise **示例:** ```js -tls.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}, err => { - if (err) { - console.log('bind fail'); - return; - } +let promiseBind = tls.bind({address: '192.168.xx.xxx', port: xxxx, family: 1}); +promiseBind.then(() => { console.log('bind success'); +}).catch((err) => { + console.log('bind fail'); }); let promise = tls.getState(); promise.then(() => { @@ -1781,7 +1736,7 @@ promise.then(() => { ### setExtraOptions9+ -setExtraOptions\(options: TCPExtraOptions, callback: AsyncCallback\): void +setExtraOptions(options: TCPExtraOptions, callback: AsyncCallback\): void 在TLSSocket的bind成功之后,设置TCPSocket连接的其他属性。使用callback方式作为异步方法。 @@ -1817,23 +1772,24 @@ tls.setExtraOptions({ keepAlive: true, OOBInline: true, TCPNoDelay: true, - socketLinger: { on:true, linger:10 }, + socketLinger: {on: true, linger: 10}, receiveBufferSize: 1000, sendBufferSize: 1000, reuseAddress: true, socketTimeout: 3000, -},err => { +}, err => { if (err) { console.log('setExtraOptions fail'); return; } console.log('setExtraOptions success'); }); + ``` ### setExtraOptions9+ -setExtraOptions\(options: TCPExtraOptions\): Promise +setExtraOptions(options: TCPExtraOptions): Promise\ 在TLSSocket的bind成功之后,设置TCPSocket连接的其他属性,使用Promise方式作为异步方法。 @@ -1873,7 +1829,7 @@ let promise = tls.setExtraOptions({ keepAlive: true, OOBInline: true, TCPNoDelay: true, - socketLinger: { on:true, linger:10 }, + socketLinger: {on: true, linger: 10}, receiveBufferSize: 1000, sendBufferSize: 1000, reuseAddress: true, @@ -1888,7 +1844,7 @@ promise.then(() => { ### connect9+ -connect(options: TLSConnectOptions, callback: AsyncCallback\): void +connect(options: TLSConnectOptions, callback: AsyncCallback\): void 在TLSSocket上bind成功之后,进行通信连接,并创建和初始化TLS会话,实现建立连接过程,启动与服务器的TLS/SSL握手,实现数据传输功能,使用callback方式作为异步方法。 @@ -1951,12 +1907,12 @@ let options = { }, }; tlsTwoWay.connect(options, (err, data) => { - console.error("connect callback error"+err); + console.error("connect callback error" + err); console.log(JSON.stringify(data)); }); let tlsOneWay = socket.constructTLSSocketInstance(); // One way authentication - tlsOneWay.bind({address: '192.168.xxx.xxx', port: 8080, family: 1}, err => { +tlsOneWay.bind({address: '192.168.xxx.xxx', port: 8080, family: 1}, err => { if (err) { console.log('bind fail'); return; @@ -1970,19 +1926,19 @@ let oneWayOptions = { family: 1, }, secureOptions: { - ca: ["xxxx","xxxx"], + ca: ["xxxx", "xxxx"], cipherSuite: "AES256-SHA256", }, }; tlsOneWay.connect(oneWayOptions, (err, data) => { - console.error("connect callback error"+err); + console.error("connect callback error" + err); console.log(JSON.stringify(data)); }); ``` ### connect9+ -connect(options: TLSConnectOptions): Promise\ +connect(options: TLSConnectOptions): Promise\ 在TLSSocket上bind成功之后,进行通信连接,并创建和初始化TLS会话,实现建立连接过程,启动与服务器的TLS/SSL握手,实现数据传输功能,该连接包括两种认证方式,单向认证与双向认证,使用Promise方式作为异步方法。 @@ -1998,7 +1954,7 @@ connect(options: TLSConnectOptions): Promise\ | 类型 | 说明 | | ------------------------------------------- | ----------------------------- | -| Promise\ | 以Promise形式返回,成功无返回,失败返回错误码,错误信息。| +| Promise\ | 以Promise形式返回,成功无返回,失败返回错误码,错误信息。| **错误码:** @@ -2070,7 +2026,7 @@ let oneWayOptions = { family: 1, }, secureOptions: { - ca: ["xxxx","xxxx"], + ca: ["xxxx", "xxxx"], cipherSuite: "AES256-SHA256", }, }; @@ -2083,7 +2039,7 @@ tlsOneWay.connect(oneWayOptions).then(data => { ### getRemoteAddress9+ -getRemoteAddress\(callback: AsyncCallback\): void +getRemoteAddress(callback: AsyncCallback\): void 在TLSSocket通信连接成功之后,获取对端Socket地址。使用callback方式作为异步方法。 @@ -2093,7 +2049,7 @@ getRemoteAddress\(callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------- | ---- | ---------- | -| callback | AsyncCallback\<[NetAddress](#netaddress)> | 是 | 回调函数。成功返回对端的socket地址,失败返回错误码,错误信息。 | +| callback | AsyncCallback\<[NetAddress](#netaddress)\> | 是 | 回调函数。成功返回对端的socket地址,失败返回错误码,错误信息。 | **错误码:** @@ -2116,7 +2072,7 @@ tls.getRemoteAddress((err, data) => { ### getRemoteAddress9+ -getRemoteAddress\(\): Promise\ +getRemoteAddress(): Promise\ 在TLSSocket通信连接成功之后,获取对端Socket地址。使用Promise方式作为异步方法。 @@ -2148,7 +2104,7 @@ promise.then(() => { ### getCertificate9+ -getCertificate(callback: AsyncCallback\<[X509CertRawData](#x509certrawdata9)>): void +getCertificate(callback: AsyncCallback\<[X509CertRawData](#x509certrawdata9)\>): void 在TLSSocket通信连接成功之后,获取本地的数字证书,该接口只适用于双向认证时,使用callback方式作为异步方法。 @@ -2158,7 +2114,7 @@ getCertificate(callback: AsyncCallback\<[X509CertRawData](#x509certrawdata9)>): | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------------------| ---- | ---------------| -| callback | AsyncCallback\<[X509CertRawData](#x509certrawdata9)> | 是 | 回调函数,成功返回本地的证书,失败返回错误码,错误信息。| +| callback | AsyncCallback\<[X509CertRawData](#x509certrawdata9)\> | 是 | 回调函数,成功返回本地的证书,失败返回错误码,错误信息。| **错误码:** @@ -2182,7 +2138,7 @@ tls.getCertificate((err, data) => { ### getCertificate9+ -getCertificate():Promise\<[X509CertRawData](#x509certrawdata9)> +getCertificate():Promise\<[X509CertRawData](#x509certrawdata9)\> 在TLSSocket通信连接之后,获取本地的数字证书,该接口只适用于双向认证时,使用Promise方式作为异步方法。 @@ -2192,7 +2148,7 @@ getCertificate():Promise\<[X509CertRawData](#x509certrawdata9)> | 类型 | 说明 | | -------------- | -------------------- | -| Promise\<[X509CertRawData](#x509certrawdata9)> | 以Promise形式返回本地的数字证书的结果。失败返回错误码,错误信息。 | +| Promise\<[X509CertRawData](#x509certrawdata9)\> | 以Promise形式返回本地的数字证书的结果。失败返回错误码,错误信息。 | **错误码:** @@ -2214,7 +2170,7 @@ tls.getCertificate().then(data => { ### getRemoteCertificate9+ -getRemoteCertificate(callback: AsyncCallback\<[X509CertRawData](#x509certrawdata9)>): void +getRemoteCertificate(callback: AsyncCallback\<[X509CertRawData](#x509certrawdata9)\>): void 在TLSSocket通信连接成功之后,获取服务端的数字证书,使用callback方式作为异步方法。 @@ -2224,7 +2180,7 @@ getRemoteCertificate(callback: AsyncCallback\<[X509CertRawData](#x509certrawdata | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------------------| ---- | ---------------| -| callback | AsyncCallback\<[X509CertRawData](#x509certrawdata9)> | 是 | 回调函数,返回服务端的证书。失败返回错误码,错误信息。 | +| callback | AsyncCallback\<[X509CertRawData](#x509certrawdata9)\> | 是 | 回调函数,返回服务端的证书。失败返回错误码,错误信息。 | **错误码:** @@ -2247,7 +2203,7 @@ tls.getRemoteCertificate((err, data) => { ### getRemoteCertificate9+ -getRemoteCertificate():Promise\<[X509CertRawData](#x509certrawdata9)> +getRemoteCertificate():Promise\<[X509CertRawData](#x509certrawdata9)\> 在TLSSocket通信连接成功之后,获取服务端的数字证书,使用Promise方式作为异步方法。 @@ -2257,7 +2213,7 @@ getRemoteCertificate():Promise\<[X509CertRawData](#x509certrawdata9)> | 类型 | 说明 | | -------------- | -------------------- | -| Promise\<[X509CertRawData](#x509certrawdata9)> | 以Promise形式返回服务端的数字证书的结果。失败返回错误码,错误信息。 | +| Promise\<[X509CertRawData](#x509certrawdata9)\> | 以Promise形式返回服务端的数字证书的结果。失败返回错误码,错误信息。 | **错误码:** @@ -2278,7 +2234,7 @@ tls.getRemoteCertificate().then(data => { ### getProtocol9+ -getProtocol(callback: AsyncCallback\): void +getProtocol(callback: AsyncCallback\): void 在TLSSocket通信连接成功之后,获取通信的协议版本,使用callback方式作为异步方法。 @@ -2288,7 +2244,7 @@ getProtocol(callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------------------| ---- | ---------------| -| callback | AsyncCallback\ | 是 | 回调函数,返回通信的协议。失败返回错误码,错误信息。| +| callback | AsyncCallback\ | 是 | 回调函数,返回通信的协议。失败返回错误码,错误信息。| **错误码:** @@ -2312,7 +2268,7 @@ tls.getProtocol((err, data) => { ### getProtocol9+ -getProtocol():Promise\ +getProtocol():Promise\ 在TLSSocket通信连接成功之后,获取通信的协议版本,使用Promise方式作为异步方法。 @@ -2322,7 +2278,7 @@ getProtocol():Promise\ | 类型 | 说明 | | -------------- | -------------------- | -| Promise\ | 以Promise形式返回通信的协议。失败返回错误码,错误信息。 | +| Promise\ | 以Promise形式返回通信的协议。失败返回错误码,错误信息。 | **错误码:** @@ -2344,7 +2300,7 @@ tls.getProtocol().then(data => { ### getCipherSuite9+ -getCipherSuite(callback: AsyncCallback\>): void +getCipherSuite(callback: AsyncCallback\\>): void 在TLSSocket通信连接成功之后,获取通信双方协商后的加密套件,使用callback方式作为异步方法。 @@ -2354,7 +2310,7 @@ getCipherSuite(callback: AsyncCallback\>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------------------| ---- | ---------------| -| callback | AsyncCallback\> | 是 | 回调函数,返回通信双方支持的加密套件。 失败返回错误码,错误信息。 | +| callback | AsyncCallback\\> | 是 | 回调函数,返回通信双方支持的加密套件。 失败返回错误码,错误信息。 | **错误码:** @@ -2379,7 +2335,7 @@ tls.getCipherSuite((err, data) => { ### getCipherSuite9+ -getCipherSuite(): Promise\> +getCipherSuite(): Promise\\> 在TLSSocket通信连接成功之后,获取通信双方协商后的加密套件,使用Promise方式作为异步方法。 @@ -2389,7 +2345,7 @@ getCipherSuite(): Promise\> | 类型 | 说明 | | ---------------------- | --------------------- | -| Promise\> | 以Promise形式返回通信双方支持的加密套件。失败返回错误码,错误信息。 | +| Promise\\> | 以Promise形式返回通信双方支持的加密套件。失败返回错误码,错误信息。 | **错误码:** @@ -2412,7 +2368,7 @@ tls.getCipherSuite().then(data => { ### getSignatureAlgorithms9+ -getSignatureAlgorithms(callback: AsyncCallback\>): void +getSignatureAlgorithms(callback: AsyncCallback\\>): void 在TLSSocket通信连接成功之后,获取通信双方协商后签名算法,该接口只适配双向认证模式下,使用callback方式作为异步方法。 @@ -2422,7 +2378,7 @@ getSignatureAlgorithms(callback: AsyncCallback\>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------------------------------------| ---- | ---------------| -| callback | AsyncCallback\> | 是 | 回调函数,返回双方支持的签名算法。 | +| callback | AsyncCallback\\> | 是 | 回调函数,返回双方支持的签名算法。 | **错误码:** @@ -2445,7 +2401,7 @@ tls.getSignatureAlgorithms((err, data) => { ### getSignatureAlgorithms9+ -getSignatureAlgorithms(): Promise\> +getSignatureAlgorithms(): Promise\\> 在TLSSocket通信连接成功之后,获取通信双方协商后的签名算法,该接口只适配双向认证模式下,使用Promise方式作为异步方法。 @@ -2455,7 +2411,7 @@ getSignatureAlgorithms(): Promise\> | 类型 | 说明 | | ---------------------- | -------------------- | -| Promise\> | 以Promise形式返回获取到的双方支持的签名算法。 | +| Promise\\> | 以Promise形式返回获取到的双方支持的签名算法。 | **错误码:** @@ -2476,7 +2432,7 @@ tls.getSignatureAlgorithms().then(data => { ### send9+ -send(data: string, callback: AsyncCallback\): void +send(data: string, callback: AsyncCallback\): void 在TLSSocket通信连接成功之后,向服务端发送消息,使用callback方式作为异步方法。 @@ -2487,7 +2443,7 @@ send(data: string, callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -----------------------------| ---- | ---------------| | data | string | 是 | 发送的数据内容。 | -| callback | AsyncCallback\ | 是 | 回调函数,返回TLSSocket发送数据的结果。失败返回错误码,错误信息。 | +| callback | AsyncCallback\ | 是 | 回调函数,返回TLSSocket发送数据的结果。失败返回错误码,错误信息。 | **错误码:** @@ -2514,7 +2470,7 @@ tls.send("xxxx", (err) => { ### send9+ -send(data: string): Promise\ +send(data: string): Promise\ 在TLSSocket通信连接成功之后,向服务端发送消息,使用Promise方式作为异步方法。 @@ -2541,12 +2497,12 @@ send(data: string): Promise\ | 类型 | 说明 | | -------------- | -------------------- | -| Promise\ | 以Promise形式返回,返回TLSSocket发送数据的结果。失败返回错误码,错误信息。 | +| Promise\ | 以Promise形式返回,返回TLSSocket发送数据的结果。失败返回错误码,错误信息。 | **示例:** ```js -tls.send("xxxx").then(() =>{ +tls.send("xxxx").then(() => { console.log("send success"); }).catch(err => { console.error(err); @@ -2555,7 +2511,7 @@ tls.send("xxxx").then(() =>{ ### close9+ -close(callback: AsyncCallback\): void +close(callback: AsyncCallback\): void 在TLSSocket通信连接成功之后,断开连接,使用callback方式作为异步方法。 @@ -2565,7 +2521,7 @@ close(callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -----------------------------| ---- | ---------------| -| callback | AsyncCallback\ | 是 | 回调函数,成功返回TLSSocket关闭连接的结果。 失败返回错误码,错误信息。 | +| callback | AsyncCallback\ | 是 | 回调函数,成功返回TLSSocket关闭连接的结果。 失败返回错误码,错误信息。 | **错误码:** @@ -2590,7 +2546,7 @@ tls.close((err) => { ### close9+ -close(): Promise\ +close(): Promise\ 在TLSSocket通信连接成功之后,断开连接,使用Promise方式作为异步方法。 @@ -2600,7 +2556,7 @@ close(): Promise\ | 类型 | 说明 | | -------------- | -------------------- | -| Promise\ | 以Promise形式返回,返回TLSSocket关闭连接的结果。失败返回错误码,错误信息。 | +| Promise\ | 以Promise形式返回,返回TLSSocket关闭连接的结果。失败返回错误码,错误信息。 | **错误码:** @@ -2614,7 +2570,7 @@ close(): Promise\ **示例:** ```js -tls.close().then(() =>{ +tls.close().then(() => { console.log("close success"); }).catch(err => { console.error(err); @@ -2631,7 +2587,7 @@ TLS连接的操作。 | -------------- | ------------------------------------- | --- |-------------- | | address | [NetAddress](#netaddress) | 是 | 网关地址。 | | secureOptions | [TLSSecureOptions](#tlssecureoptions9) | 是 | TLS安全相关操作。| -| ALPNProtocols | Array\ | 否 | ALPN协议。 | +| ALPNProtocols | Array\ | 否 | ALPN协议。 | ## TLSSecureOptions9+ @@ -2641,11 +2597,11 @@ TLS安全相关操作,其中ca证书为必选参数,其他参数为可选参 | 名称 | 类型 | 必填 | 说明 | | --------------------- | ------------------------------------------------------ | --- |----------------------------------- | -| ca | string \| Array\ | 是 | 服务端的ca证书,用于认证校验服务端的数字证书。| +| ca | string \| Array\ | 是 | 服务端的ca证书,用于认证校验服务端的数字证书。| | cert | string | 否 | 本地客户端的数字证书。 | | key | string | 否 | 本地数字证书的私钥。 | | password | string | 否 | 读取私钥的密码。 | -| protocols | [Protocol](#protocol9) \|Array\<[Protocol](#protocol9)> | 否 | TLS的协议版本。 | +| protocols | [Protocol](#protocol9) \|Array\<[Protocol](#protocol9)\> | 否 | TLS的协议版本。 | | useRemoteCipherPrefer | boolean | 否 | 优先使用对等方的密码套件。 | | signatureAlgorithms | string | 否 | 通信过程中的签名算法。 | | cipherSuite | string | 否 | 通信过程中的加密套件。 | @@ -2669,4 +2625,4 @@ TLS通信的协议版本。 | 类型 | 说明 | | --------------------------------------------------------------------- | --------------------- | -|[cryptoFramework.EncodingBlob](js-apis-cryptoFramework.md#datablob) | 存储证书的数据和编码格式 | +|[cert.EncodingBlob](js-apis-cert.md#datablob) | 存储证书的数据和编码格式 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-stack.md b/zh-cn/application-dev/reference/apis/js-apis-stack.md index a3d0fc0a094835df6d5e0694e94ee1068a16692c..ef9891fa2ae4cdef93c1e5216a0e5f46019fe063 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-stack.md +++ b/zh-cn/application-dev/reference/apis/js-apis-stack.md @@ -1,16 +1,18 @@ # @ohos.util.Stack (线性容器Stack) -> **说明:** -> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 - Stack基于数组的数据结构实现,特点是先进后出,只能在一端进行数据的插入和删除。 Stack和[Queue](js-apis-queue.md)相比,Queue基于循环队列实现,只能在一端删除,另一端插入,而Stack都在一端操作。 **推荐使用场景:** 一般符合先进后出的场景可以使用Stack。 -文档中存在泛型的使用,涉及以下泛型标记符:
-- T: Type, 类 +文档中存在泛型的使用,涉及以下泛型标记符:
+- T:Type,类 + +> **说明:** +> +> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + ## 导入模块 diff --git a/zh-cn/application-dev/reference/apis/js-apis-stationary.md b/zh-cn/application-dev/reference/apis/js-apis-stationary.md index acb4c1767efade3f622be4c76d074bc653319e17..e4c3ad1ac1ca278f18abda61c3b2b9d41d881c84 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-stationary.md +++ b/zh-cn/application-dev/reference/apis/js-apis-stationary.md @@ -18,11 +18,11 @@ import stationary from '@ohos.stationary' 服务响应抽象接口。 -**系统能力** SystemCapability.Msdp.DeviceStatus.Stationary +**系统能力**:SystemCapability.Msdp.DeviceStatus.Stationary ### 属性 -| 名称 | 参数类型 | 可读 | 可写 | 说明 | +| 名称 | 类型 | 可读 | 可写 | 说明 | | -------- | -------- | -------- | -------- | -------- | | state | [ActivityState](#activitystate) | 是 | 否 | 设备状态变化返回值。 | @@ -30,9 +30,9 @@ import stationary from '@ohos.stationary' 设备状态类型。 -**系统能力** SystemCapability.Msdp.DeviceStatus.Stationary +**系统能力**:SystemCapability.Msdp.DeviceStatus.Stationary -| 名称 | 描述 | +| 名称 | 说明 | | -------- | -------- | | still | 绝对静止。 | | relativeStill | 相对静止。 | @@ -41,9 +41,9 @@ import stationary from '@ohos.stationary' 设备状态事件。 -**系统能力** SystemCapability.Msdp.DeviceStatus.Stationary +**系统能力**:SystemCapability.Msdp.DeviceStatus.Stationary -| 变量 | 值 | 说明 | +| 名称 | 值 | 说明 | | ------------------------------ | ---- | ---------------------------------------- | | ENTER | 1 | 进入。 | | EXIT | 2 | 退出。 | @@ -53,9 +53,9 @@ import stationary from '@ohos.stationary' 设备状态返回值。 -**系统能力** SystemCapability.Msdp.DeviceStatus.Stationary +**系统能力**:SystemCapability.Msdp.DeviceStatus.Stationary -| 变量 | 值 | 说明 | +| 名称 | 值 | 说明 | | ------------------------------ | ---- | ---------------------------------------- | | ENTER | 1 | 进入。 | | EXIT | 2 | 退出。 | @@ -66,11 +66,11 @@ on(activity: ActivityType, event: ActivityEvent, reportLatencyNs: number, callba 设备状态管理,订阅设备状态服务。 -**系统能力** SystemCapability.Msdp.DeviceStatus.Stationary +**系统能力**:SystemCapability.Msdp.DeviceStatus.Stationary **参数:** -| 名称 | 类型 | 必填 | 说明 | +| 参数名 | 类型 | 必填 | 说明 | | -------------------- | -------------------------------------------------- | ---- | ---------------------------- | | activity | [ActivityType](#activitytype) | 是 | 设备状态能力类型。 | | event | [ActivityEvent](#activityevent) | 是 | 事件类型。 | @@ -92,11 +92,11 @@ once(activity: ActivityType, callback: Callback<ActivityResponse>): void 设备状态管理,查询设备状态。 -**系统能力** SystemCapability.Msdp.DeviceStatus.Stationary +**系统能力**:SystemCapability.Msdp.DeviceStatus.Stationary **参数:** -| 名称 | 类型 | 必填 | 说明 | +| 参数名 | 类型 | 必填 | 说明 | | -------------------- | -------------------------------------------------- | ---- | ---------------------------- | | activity | [ActivityType](#activitytype) | 是 | 设备状态能力类型。 | | callback | Callback<[ActivityResponse](#activityresponse)\> | 是 | 回调函数,接收上报状态变化事件。 | @@ -115,11 +115,11 @@ off(activity: ActivityType, event: ActivityEvent, callback?: Callback<Activit 设备状态管理,取消订阅设备状态服务。 -**系统能力** SystemCapability.Msdp.DeviceStatus.Stationary +**系统能力**:SystemCapability.Msdp.DeviceStatus.Stationary **参数:** -| 名称 | 类型 | 必填 | 说明 | +| 参数名 | 类型 | 必填 | 说明 | | -------------------- | -------------------------------------------------- | ---- | ---------------------------- | | activity | [ActivityType](#activitytype) | 是 | 设备状态能力类型。 | | event | [ActivityEvent](#activityevent) | 是 | 事件类型。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-app.md b/zh-cn/application-dev/reference/apis/js-apis-system-app.md index 8a03bfb8c5842b16ec77570d4a577400b3073893..2595d85b30288d01f32894c7d4d70fe9f740c32d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-app.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-app.md @@ -199,7 +199,7 @@ export default { ## ScreenOnVisible(deprecated) -screenOnVisible(options?: ScreenOnVisibleOptions) +screenOnVisible(options?: ScreenOnVisibleOptions): void 定义屏幕唤醒时是否保持应用可见。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-battery.md b/zh-cn/application-dev/reference/apis/js-apis-system-battery.md index f56300b43ae741066b0f693c16eb652fa02dbb62..a93d7a157b3d30225be59b1f287a96a6d7c07874 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-battery.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-battery.md @@ -25,7 +25,7 @@ getStatus(options?: GetStatusOptions): void; **参数:** -| 参数名 | 类型 | 必填 | 说明 | +| 名称 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | options | [GetStatusOptions](#getstatusoptions) | 否 | 包含接口调用结果的对象。 | @@ -46,7 +46,9 @@ battery.getStatus({ 包含接口调用结果的对象。 -| 参数名 | 类型 | 必填 | 说明 | +**系统能力:** SystemCapability.PowerManager.BatteryManager.Core + +| 名称 | 类型 | 必填 | 说明 | | -------- | --------------------------------------------------- | ---- | ------------------------------------------------------------ | | success | (data: [BatteryResponse](#batteryresponse)) => void | 否 | 接口调用成功的回调函数,data为[BatteryResponse](#batteryresponse)类型的返回值。 | | fail | (data: string, code: number) => void | 否 | 接口调用失败的回调函数。data为错误信息,code为错误码。 | @@ -56,7 +58,9 @@ battery.getStatus({ 包含充电状态及剩余电量的对象。 -| 参数名 | 类型 | 说明 | -| -------- | -------- | -------- | -| charging | boolean | 当前电池是否在充电中。 | -| level | number | 当前电池的电量,取值范围:0.00 - 1.00 。 | +**系统能力:** SystemCapability.PowerManager.BatteryManager.Core + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------- | -------- | -------- | -------- | -------- | +| charging | boolean | 是 | 否 | 当前电池是否在充电中。 | +| level | number | 是 | 否 | 当前电池的电量,取值范围:0.00 - 1.00 。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-bluetooth.md b/zh-cn/application-dev/reference/apis/js-apis-system-bluetooth.md index 7e4043be8c4c7b55404274d2c931e897324eeefb..3efeff8a95fd8528d3fdd5aed4836ebce8caa29c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-bluetooth.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-bluetooth.md @@ -19,14 +19,12 @@ import bluetooth from '@system.bluetooth'; 开始搜寻附近的低功耗蓝牙外围设备。此操作比较耗费系统资源,请在搜索并连接到设备后调用[bluetooth.stopBLEScan](#bluetoothstopblescanobject)方法停止搜索。 -**需要权限:** ohos.permission.DISCOVER_BLUETOOTH、ohos.permission.LOCATION - **系统能力:** SystemCapability.Communication.Bluetooth.Lite **参数:** **表1** StartBLEScanOptions -| 参数名 | 类型 | 必填 | 说明 | +| 名称 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | interval | number | 否 | 上报设备的间隔,单位毫秒,默认值为0。0表示找到新设备立即上报,其他数值根据传入的间隔上报。 | | success | Function | 否 | 接口调用成功的回调函数。 | @@ -42,7 +40,7 @@ import bluetooth from '@system.bluetooth'; console.log('call bluetooth.startBLEScan success.'); }, fail(code, data) { - console.log('call bluetooth.startBLEScan failed, code: ${code}, data: ${data}.'); + console.log('call bluetooth.startBLEScan failed, code:' + code + ', data:' + data); }, complete() { console.log('call bluetooth.startBLEScan complete.'); @@ -55,14 +53,12 @@ import bluetooth from '@system.bluetooth'; 停止搜寻附近的低功耗蓝牙外围设备。与[bluetooth.startBLEScan(OBJECT)](#bluetoothstartblescanobject)接口配套使用。 -**需要权限:** ohos.permission.DISCOVER_BLUETOOTH、ohos.permission.LOCATION - **系统能力:** SystemCapability.Communication.Bluetooth.Lite **参数:** **表2** StopBLEScanOptions -| 参数名 | 类型 | 必填 | 说明 | +| 名称 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | success | Function | 否 | 接口调用成功的回调函数。 | | fail | Function | 否 | 接口调用失败的回调函数。 | @@ -76,7 +72,7 @@ import bluetooth from '@system.bluetooth'; console.log('call bluetooth.stopBLEScan success.'); }, fail(data, code) { - console.log('call bluethooth.stopBLEScan fail, code: ${code}, data: ${data}.'); + console.log('call bluethooth.stopBLEScan fail, code:' + code + ', data:' + data); }, complete() { console.log('call bluethooth.stopBLEScan complete.'); @@ -89,14 +85,12 @@ import bluetooth from '@system.bluetooth'; 订阅寻找到新设备。再次调用时,会覆盖前一次调用效果,即仅最后一次调用生效。 -**需要权限:** ohos.permission.DISCOVER_BLUETOOTH、ohos.permission.LOCATION - **系统能力:** SystemCapability.Communication.Bluetooth.Lite **参数:** **表3** SubscribeBLEFoundOptions -| 参数 | 类型 | 必填 | 说明 | +| 名称 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | success | Function | 是 | 寻找到新设备上报时调用的回调函数。 | | fail | Function | 否 | 接口调用失败的回调函数。 | @@ -125,7 +119,7 @@ import bluetooth from '@system.bluetooth'; console.log('call bluetooth.subscribeBLEFound success, data: ${data}.'); }, fail(data, code) { - console.log('call bluetooth.startBLEScan failed, data: ${data}, code: ${code}.'); + console.log('call bluetooth.startBLEScan failed, code:' + code + ', data:' + data); } }); ``` @@ -135,8 +129,6 @@ import bluetooth from '@system.bluetooth'; 解除订阅寻找到新设备。 -**需要权限:** ohos.permission.DISCOVER_BLUETOOTH、ohos.permission.LOCATION - **系统能力:** SystemCapability.Communication.Bluetooth.Lite **示例:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-brightness.md b/zh-cn/application-dev/reference/apis/js-apis-system-brightness.md index 2f019ad51b018cbde409f27d59c69b904f123aa9..0d44e435efd777c9f7a0c557ecbb69ca552c3d62 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-brightness.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-brightness.md @@ -3,7 +3,8 @@ 该模块提供屏幕亮度和模式的查询、调节接口。 > **说明:** -> - 从API Version 7 开始不再维护,建议使用[`@ohos.brightness`](js-apis-brightness.md)替代。 +> +> - 从API Version 7 开始不再维护。建议使用[`@ohos.brightness`](js-apis-brightness.md)替代,替代接口能力仅对系统应用开放。 > - 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 @@ -45,7 +46,7 @@ getValue(options?: GetBrightnessOptions): void ## brightness.setValue -etValue(options?: SetBrightnessOptions): void +setValue(options?: SetBrightnessOptions): void 设置设备当前的屏幕亮度值。 @@ -74,7 +75,7 @@ etValue(options?: SetBrightnessOptions): void ## brightness.getMode -getMode(options?: GetBrightnessModeOptions: void +getMode(options?: GetBrightnessModeOptions): void 获得当前屏幕亮度模式。 @@ -161,6 +162,8 @@ setKeepScreenOn(options?: SetKeepScreenOnOptions): void 获取屏幕亮度的参数对象。 +**系统能力:** SystemCapability.PowerManager.DisplayPowerManager + | 名称 | 类型 | 必填 | 说明 | | -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ | | success | (data: [BrightnessResponse](#brightnessresponse)) => void | 否 | 接口调用成功的回调函数。data为[BrightnessResponse](#brightnessresponse)类型的返回值。 | @@ -171,6 +174,8 @@ setKeepScreenOn(options?: SetKeepScreenOnOptions): void 设置屏幕亮度的参数对象。 +**系统能力:** SystemCapability.PowerManager.DisplayPowerManager + | 名称 | 类型 | 必填 | 说明 | | -------- | ------------------------------------ | ---- | ------------------------------------------------------------ | | value | number | 是 | 屏幕亮度,值为1-255之间的整数。
- 如果值小于等于0,系统按1处理。
- 如果值大于255,系统按255处理。
- 如果值为小数,系统将处理为整数。例如设置为8.1,系统按8处理。 | @@ -182,14 +187,18 @@ setKeepScreenOn(options?: SetKeepScreenOnOptions): void 包含屏幕亮度的对象。 -| 名称 | 类型 | 说明 | -| -------- | -------- | -------- | -| value | number | 屏幕亮度,范围:1到255。 | +**系统能力:** SystemCapability.PowerManager.DisplayPowerManager + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------- | -------- | -------- | -------- | -------- | +| value | number | 是 | 否 | 屏幕亮度,范围:1到255。 | ## GetBrightnessModeOptions 获取屏幕亮度模式的参数对象。 +**系统能力:** SystemCapability.PowerManager.DisplayPowerManager + | 名称 | 类型 | 必填 | 说明 | | -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | | success | (data: [BrightnessModeResponse](#brightnessmoderesponse)) => void | 否 | 接口调用成功的回调函数。data为[BrightnessModeResponse](#brightnessmoderesponse)类型的返回值。 | @@ -200,6 +209,8 @@ setKeepScreenOn(options?: SetKeepScreenOnOptions): void 设置屏幕亮度模式的参数对象。 +**系统能力:** SystemCapability.PowerManager.DisplayPowerManager + | 名称 | 类型 | 必填 | 说明 | | -------- | ------------------------------------ | ---- | ------------------------------------------------------ | | mode | number | 是 | 0表示手动调节屏幕亮度模式,1表示自动调节屏幕亮度模式。 | @@ -211,14 +222,18 @@ setKeepScreenOn(options?: SetKeepScreenOnOptions): void 包含屏幕亮度模式的对象。 -| 名称 | 类型 | 说明 | -| -------- | -------- | -------- | -| mode | number | 0表示手动调节屏幕亮度模式,1表示自动调节屏幕亮度模式。 | +**系统能力:** SystemCapability.PowerManager.DisplayPowerManager + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------- | -------- | -------- | -------- | -------- | +| mode | number | 是 | 否 | 0表示手动调节屏幕亮度模式,1表示自动调节屏幕亮度模式。 | ## SetKeepScreenOnOptions 设置屏幕常亮的参数对象。 +**系统能力:** SystemCapability.PowerManager.DisplayPowerManager + | 名称 | 类型 | 必填 | 说明 | | ------------ | ------------------------------------ | ---- | ------------------------------------------------------ | | keepScreenOn | boolean | 是 | true表示保持屏幕常亮,false表示取消屏幕常亮。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-capability.md b/zh-cn/application-dev/reference/apis/js-apis-system-capability.md index e0fdd2062e6a4faa1314218be2c47882e90da0ea..0acb7d8db08f10bc6cc45300ab5839f862839bb8 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-system-capability.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-capability.md @@ -16,7 +16,7 @@ import systemcapability from '@ohos.systemCapability' ## systemcapability.querySystemCapabilities -querySystemCapabilities(callback: AsyncCallback): void; +querySystemCapabilities(callback: AsyncCallback<string>): void; 获取系统能力集合的字符串,并调用回调函数。 @@ -51,7 +51,7 @@ querySystemCapabilities(): Promise<string> 获取系统能力的集合。 -**系统能力:** SystemCapability.Startup.SystemInfo +**系统能力:** SystemCapability.Developtools.Syscap **返回值:** @@ -76,6 +76,7 @@ try { > **说明:** -> - 以上接口所返回的system capability集合形式均为编码后的数字字符串形式。 +> +> 以上接口所返回的system capability集合形式均为编码后的数字字符串形式。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-cipher.md b/zh-cn/application-dev/reference/apis/js-apis-system-cipher.md index 766b981ad11d3891b1b7e366f6c0c9c4cdd1157e..b87349eb95221cd68f45e90b7665ceef1e7d3a49 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-cipher.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-cipher.md @@ -3,7 +3,8 @@ > **说明:** > > 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 - +> +> 从API version 9开始废弃, 建议使用[@ohos.security.cryptoFramework的Cipher](js-apis-cryptoFramework.md#Cipher)替代。 ## 导入模块 @@ -18,9 +19,10 @@ import cipher from '@system.cipher'; **系统能力**:SystemCapability.Security.Cipher -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | ------------ | -| text | string | 是 | 返回的内容。 | +| 名称 | 类型 | 可读 | 可写 |说明 | +| ------ | ------ | ---- | ---- | ------------ | +| text | string | 是 | 否 | 返回的内容。 | + ## CipherRsaOptions @@ -28,7 +30,7 @@ import cipher from '@system.cipher'; **系统能力**:SystemCapability.Security.Cipher -| 参数名 | 类型 | 必填 | 说明 | +| 名称 | 类型 | 必填 | 说明 | | -------------- | ------------------------------------ | ---- | ------------------------------------------------------------ | | action | string | 是 | 加密类型,可选项有:
1. encrypt 加密
2. decrypt 解密 | | text | string | 是 | 待加密或解密的文本内容。待加密的文本内容应该是一段普通文本,长度不能超过 keySize / 8 - 66,其中 keySize 是密钥的长度(例如密钥长度为 1024 时,text 不能超过 62 个字节)。待解密的文本内容应该是经过 base64 编码的一段二进制值。base64 编码使用默认风格。 | @@ -44,7 +46,7 @@ import cipher from '@system.cipher'; **系统能力**:SystemCapability.Security.Cipher -| 参数名 | 类型 | 必填 | 说明 | +| 名称 | 类型 | 必填 | 说明 | | -------------- | ------------------------------------ | ---- | ------------------------------------------------------------ | | action | string | 是 | 加密类型,可选项有:
1. encrypt 加密
2. decrypt 解密 | | text | string | 是 | 待加密或解密的文本内容。待加密的文本内容应该是一段普通文本。待解密的文本内容应该是经过 base64 编码的一段二进制值。base64 编码使用默认风格。 | @@ -74,39 +76,39 @@ RSA 算法加解密。 **示例:** ```js -export default { - rsa() { - cipher.rsa({ - //加密 - action: 'encrypt', - //待加密的文本内容 - text: 'hello', - //base64编码后的加密公钥 - key: - 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCx414QSP3RsYWYzf9mkBMiBAXo\n' + - '6S7Lpva1fKlcuVxjoFC1iMnzD4mC0uiL4k5MNi43J64c7dbqi3qAJjdAtuwQ6NZJ\n' + +export default { + rsa() { + cipher.rsa({ + //加密 + action: 'encrypt', + //待加密的文本内容 + text: 'hello', + //base64编码后的加密公钥 + key: + 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCx414QSP3RsYWYzf9mkBMiBAXo\n' + + '6S7Lpva1fKlcuVxjoFC1iMnzD4mC0uiL4k5MNi43J64c7dbqi3qAJjdAtuwQ6NZJ\n' + '+Enz0RzmVFh/4yk6lmqRzuEFQqhQqSZzaLq6sq2N2G0Sv2Xl3sLvqAfe2HNm2oBw\n' + - 'jBpApTJ3TeneOo6Z5QIDAQAB', - success: function(data) { - console.log(`handling success:${data.text}`); - }, - fail: function(data, code) { - console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`); + 'jBpApTJ3TeneOo6Z5QIDAQAB', + success: function(data) { + console.log(`handling success:${data.text}`); + }, + fail: function(data, code) { + console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`); }, complete: function() { console.log(`operation complete!`); } - }); - cipher.rsa({ - //解密: - action: 'decrypt', - //待解密的内容,是base64编码后的一段二进制值,解密后是文本内容“hello” - text: + }); + cipher.rsa({ + //解密: + action: 'decrypt', + //待解密的内容,是base64编码后的一段二进制值,解密后是文本内容“hello” + text: 'EPeCFPib6ayKbA0M6oSywARvFZ8dFYfjQv3nY8ikZGtS9UHq2sLPvAfpeIzggSiCxqbWeCftP1XQ\n' + 'Sa+jEpzFlT1qoSTunBbrYzugPTajIJDTg6R1IRsF/J+mmakn0POVPvi4jCo9wqavB324Bx0Wipnc\n' + - 'EU5WO0oBHo5l4x6dTpU=', - //base64编码后的解密私钥 - key: + 'EU5WO0oBHo5l4x6dTpU=', + //base64编码后的解密私钥 + key: 'MIICXgIBAAKBgQCx414QSP3RsYWYzf9mkBMiBAXo6S7Lpva1fKlcuVxjoFC1iMnz\n' + 'D4mC0uiL4k5MNi43J64c7dbqi3qAJjdAtuwQ6NZJ+Enz0RzmVFh/4yk6lmqRzuEF\n' + 'QqhQqSZzaLq6sq2N2G0Sv2Xl3sLvqAfe2HNm2oBwjBpApTJ3TeneOo6Z5QIDAQAB\n' + @@ -118,18 +120,18 @@ export default { 'PKoljdXmJeS6rGgzGibstuHLrP3tcIho4+0CQD3ZFWzF/xq0jxKlrpWhnJuNCRfE\n' + 'oO6e9yNvVA8J/5oEDSOcmqSNIp4+RhbUx8InUxnCG6Ryv5aSFu71pYcKrPkCQQCL\n' + 'RUGcm3ZGTnslduB0knNF+V2ndwzDUQ7P74UXT+PjurTPhujFYiuxCEd6ORVnEOzG\n' + - 'M9TORIgdH8MjIbWsGnndAkEAw9yURDaorE8IYPLF2IEn09g1uzvWPs3phDb6smVx\n' + + 'M9TORIgdH8MjIbWsGnndAkEAw9yURDaorE8IYPLF2IEn09g1uzvWPs3phDb6smVx\n' + '8GfqIdUNf+aCG5TZK/kXBF1sqcsi7jXMAf4jBlejVbSVZg==', - success: function(data) { - console.log(`handling success:${data.text}`); - }, - fail: function(data, code) { - console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`); + success: function(data) { + console.log(`handling success:${data.text}`); + }, + fail: function(data, code) { + console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`); }, complete: function() { console.log(`operation complete!`); - } - }); + } + }); } } ``` @@ -152,48 +154,48 @@ AES 算法加解密。 **示例:** ```js -export default { - aes() { - cipher.aes({ - //加密 - action: 'encrypt', - //待加密的文本内容 - text: 'hello', - //base64编码后的密钥 - key: 'NDM5Qjk2UjAzMEE0NzVCRjlFMkQwQkVGOFc1NkM1QkQ=', - transformation: 'AES/CBC/PKCS5Padding', - ivOffset: '0', - ivLen: '16', - success: function(data) { - console.log(`handling success:${data.text}`); - }, - fail: function(data, code) { - console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`); +export default { + aes() { + cipher.aes({ + //加密 + action: 'encrypt', + //待加密的文本内容 + text: 'hello', + //base64编码后的密钥 + key: 'NDM5Qjk2UjAzMEE0NzVCRjlFMkQwQkVGOFc1NkM1QkQ=', + transformation: 'AES/CBC/PKCS5Padding', + ivOffset: '0', + ivLen: '16', + success: function(data) { + console.log(`handling success:${data.text}`); + }, + fail: function(data, code) { + console.log(`### cipher.rsa encrypt fail ### ${code}:${data}`); }, complete: function() { console.log(`operation complete!`); } - }); - cipher.aes({ - //解密: - action: 'decrypt', - //待解密的内容,是base64编码后的一段二进制值 - text: '1o0kf2HXwLxHkSh5W5NhzA==', - //base64编码后的密钥 - key: 'NDM5Qjk2UjAzMEE0NzVCRjlFMkQwQkVGOFc1NkM1QkQ=', - transformation: 'AES/CBC/PKCS5Padding', - ivOffset: '0', - ivLen: '16', - success: function(data) { - console.log(`handling success:${data.text}`); - }, - fail: function(data, code) { - console.log(`### cipher.aes encrypt fail ### ${code}:${data}`); + }); + cipher.aes({ + //解密: + action: 'decrypt', + //待解密的内容,是base64编码后的一段二进制值 + text: '1o0kf2HXwLxHkSh5W5NhzA==', + //base64编码后的密钥 + key: 'NDM5Qjk2UjAzMEE0NzVCRjlFMkQwQkVGOFc1NkM1QkQ=', + transformation: 'AES/CBC/PKCS5Padding', + ivOffset: '0', + ivLen: '16', + success: function(data) { + console.log(`handling success:${data.text}`); + }, + fail: function(data, code) { + console.log(`### cipher.aes encrypt fail ### ${code}:${data}`); }, complete: function() { console.log(`operation complete!`); } - }); + }); } } diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-configuration.md b/zh-cn/application-dev/reference/apis/js-apis-system-configuration.md index 3ab1617f8e9dcec885ee4503df291eba6e273f73..3c330f4869faaf3f86cc6d7a696a28afde553c55 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-configuration.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-configuration.md @@ -45,7 +45,7 @@ static getLocale(): LocaleResponse **系统能力**:以下各项对应的系统能力均为SystemCapability.ArkUI.ArkUI.Lite -| 名称 | 参数类型 | 可读 | 可写 | 说明 | +| 名称 | 类型 | 可读 | 可写 | 说明 | | ---- | ------ | ---- | ---- | ---------------------------------------- | | language | string | 是 | 否 | 语言。例如:zh。 | | countryOrRegion | string | 是 | 否 | 国家或地区。例如:CN。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-device.md b/zh-cn/application-dev/reference/apis/js-apis-system-device.md index 4215cce99d6414f55b0a047139273a5c87a573a3..b514f2afb2d0847419ac7615946a48b5ceb97f88 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-device.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-device.md @@ -16,11 +16,11 @@ import device from '@system.device'; ## device.getInfo -getInfo(Object): void +getInfo(options?: GetDeviceOptions): void 获取当前设备的信息。 -> **说明:** +> **说明:**
> 在首页的onShow生命周期之前不建议调用device.getInfo接口。 **系统能力:** SystemCapability.Startup.SystemInfo @@ -29,13 +29,27 @@ getInfo(Object): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| success | Function | 否 | 接口调用成功的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | -| complete | Function | 否 | 接口调用结束的回调函数。 | +| options | [GetDeviceOptions](#getdeviceoptions) | 否 | 定义设备信息获取的参数选项。 | + +## GetDeviceOptions + +定义设备信息获取的参数选项。 -success返回值: +**系统能力:** SystemCapability.Startup.SystemInfo + +| 名称 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| success | (data:DeviceResponse)=> void | 否 | 接口调用成功的回调函数。 data为成功返回的设备信息,具体参考[DeviceResponse](#deviceresponse)。| +| fail | (data:any,code:number)=> void | 否 | 接口调用失败的回调函数。 code为失败返回的错误码。
code:200,表示返回结果中存在无法获得的信息。| +| complete | ()=> void | 否 | 接口调用结束的回调函数。 | -| 参数名 | 类型 | 说明 | +## DeviceResponse + +设备信息。 + +**系统能力:** SystemCapability.Startup.SystemInfo + +| 名称 | 类型 | 说明 | | -------- | -------- | -------- | | brand | string | 品牌。 | | manufacturer | string | 生产商。 | @@ -51,11 +65,6 @@ success返回值: | releaseType4+ | string | 版本发布类型,值为类型+版本号,如Beta1。
类型可能值有:
- Canary:同一apiVersion下,canary版本之间保持API兼容,beta版本不对canary版本兼容。
- Beta:同一apiVersion下,beta版本之间保持API兼容,release版本不对beta版本兼容。
- Release:release版本会保持5个API版本兼容。 | | deviceType4+ | string | 设备类型。 | -fail返回错误代码: - -| 错误码 | 说明 | -| -------- | -------- | -| 200 | 返回结果中存在无法获得的信息。 | **示例:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-fetch.md b/zh-cn/application-dev/reference/apis/js-apis-system-fetch.md index ed8c646e3d6082c779bd9e02b726cc4c634dbac0..b4e7eb8eccbab3614d8182eb6492a9a9ce189d48 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-fetch.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-fetch.md @@ -14,7 +14,7 @@ import fetch from '@system.fetch'; ``` -## fetch.fetch +## fetch.fetch3+ fetch(Object): void @@ -45,7 +45,7 @@ fetch(Object): void ## FetchResponse -| 参数名 | 类型 | 可读 | 可写 | 说明 | +| 名称 | 类型 | 可读 | 可写 | 说明 | | -------- | -------- | -------- | -------- | -------- | | code | number | 是 | 否 | 表示服务器的状态code。 | | data | string \| Object | 是 | 否 | 返回数据类型由responseType确定,详见表 responseType与success中data关系。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-location.md b/zh-cn/application-dev/reference/apis/js-apis-system-location.md index 433fb412161875ec2d95864421874b2da19259f0..a9509c8e5b49b608fee4583f4cec72474837304f 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-location.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-location.md @@ -21,44 +21,22 @@ ohos.permission.LOCATION ## geolocation.getLocation(deprecated) -getLocation(Object): void +getLocation(options?: GetLocationOption): void 获取设备的地理位置。 > **说明:**
> 从API version 9开始废弃,建议使用[geoLocationManager.getCurrentLocation](js-apis-geoLocationManager.md#geolocationmanagergetcurrentlocation)替代。 +**需要权限**:ohos.permission.LOCATION + **系统能力:** SystemCapability.Location.Location.Lite **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| timeout | number | 否 | 超时时间,单位为ms,默认值为30000。
设置超时,是为了防止出现权限被系统拒绝、定位信号弱或者定位设置不当,导致请求阻塞的情况。超时后会使用fail回调函数。
取值范围为32位正整数。如果设置值小于等于0,系统按默认值处理。 | -| coordType | string | 否 | 坐标系的类型,可通过getSupportedCoordTypes获取可选值,缺省值为wgs84。 | -| success | Function | 否 | 接口调用成功的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | -| complete | Function | 否 | 接口调用结束的回调函数。 | - -success返回值: - -| 参数名 | 类型 | 说明 | -| -------- | -------- | -------- | -| longitude | number | 设备位置信息:经度。 | -| latitude | number | 设备位置信息:纬度。 | -| altitude | number | 设备位置信息:海拔。 | -| accuracy | number | 设备位置信息:精确度。 | -| time | number | 设备位置信息:时间。 | - -fail返回错误代码: - -| 错误码 | 说明 | -| -------- | -------- | -| 601 | 获取定位权限失败,失败原因:用户拒绝。 | -| 602 | 权限未声明。 | -| 800 | 超时,失败原因:网络状况不佳或GNSS不可用。 | -| 801 | 系统位置开关未打开。 | -| 802 | 该次调用结果未返回前接口又被重新调用,该次调用失败返回错误码。 | +| options | [GetLocationOption](#getlocationoptiondeprecated) | 否 | 单次定位请求的配置参数。 | **示例:** @@ -80,7 +58,7 @@ export default { ## geolocation.getLocationType(deprecated) -getLocationType(Object): void +getLocationType(options?: GetLocationTypeOption): void 获取当前设备支持的定位类型。 @@ -93,15 +71,7 @@ getLocationType(Object): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| success | Function | 否 | 接口调用成功的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | -| complete | Function | 否 | 接口调用结束的回调函数。 | - -success返回值: - -| 参数名 | 类型 | 说明 | -| -------- | -------- | -------- | -| types | Array<string> | 可选的定位类型['gps', 'network']。 | +| options | [GetLocationTypeOption](#getlocationtypeoptiondeprecated) | 否 | 回调函数,用于接收查询结果,或者接收查询失败的结果。 | **示例:** @@ -123,40 +93,22 @@ export default { ## geolocation.subscribe(deprecated) -subscribe(Object): void +subscribe(options: SubscribeLocationOption): void 订阅设备的地理位置信息。多次调用的话,只有最后一次的调用生效。 > **说明:**
> 从API version 9开始废弃,建议使用[geoLocationManager.on('locationChange')](js-apis-geoLocationManager.md#geolocationmanageronlocationchange)替代。 +**需要权限**:ohos.permission.LOCATION + **系统能力:** SystemCapability.Location.Location.Lite **参数:** | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | -| coordType | string | 否 | 坐标系的类型,可通过getSupportedCoordTypes获取可选值,默认值为wgs84。 | -| success | Function | 是 | 位置信息发生变化的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | - -success返回值: - -| 参数名 | 类型 | 说明 | -| -------- | -------- | -------- | -| longitude | number | 设备位置信息:经度。 | -| latitude | number | 设备位置信息:纬度。 | -| altitude | number | 设备位置信息:海拔。 | -| accuracy | number | 设备位置信息:精确度。 | -| time | number | 设备位置信息:时间。 | - -fail返回错误代码: - -| 错误码 | 说明 | -| -------- | -------- | -| 601 | 获取定位权限失败,失败原因:用户拒绝。 | -| 602 | 权限未声明。 | -| 801 | 系统位置开关未打开。 | +| options | [SubscribeLocationOption](#subscribelocationoptiondeprecated) | 是 | 持续定位的配置参数。 | **示例:** @@ -185,6 +137,8 @@ unsubscribe(): void > **说明:**
> 从API version 9开始废弃,建议使用[geoLocationManager.off('locationChange')](js-apis-geoLocationManager.md#geolocationmanagerofflocationchange)替代。 +**需要权限**:ohos.permission.LOCATION + **系统能力:** SystemCapability.Location.Location.Lite **示例:** @@ -223,4 +177,103 @@ export default { var types = geolocation.getSupportedCoordTypes(); }, } -``` \ No newline at end of file +``` + +## GetLocationOption(deprecated) + +单次定位请求的配置参数。 + +> **说明:**
+> 从API version 9开始废弃,建议使用[geoLocationManager.CurrentLocationRequest](js-apis-geoLocationManager.md#CurrentLocationRequest)替代。 + +**需要权限**:ohos.permission.LOCATION + +**系统能力**:SystemCapability.Location.Location.Lite + +| 名称 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| timeout | number | 否 | 超时时间,单位为ms,默认值为30000。
设置超时,是为了防止出现权限被系统拒绝、定位信号弱或者定位设置不当,导致请求阻塞的情况。超时后会使用fail回调函数。
取值范围为32位正整数。如果设置值小于等于0,系统按默认值处理。 | +| coordType | string | 否 | 坐标系的类型,可通过getSupportedCoordTypes获取可选值,缺省值为wgs84。 | +| success | (data: [GeolocationResponse](#geolocationresponsedeprecated)) => void | 否 | 接口调用成功的回调函数。 | +| fail | (data: string, code: number) => void | 否 | 接口调用失败的回调函数。data为错误信息,code为错误码。 | +| complete | () => void | 否 | 接口调用结束的回调函数。 | + +fail返回错误代码: + +| 错误码 | 说明 | +| -------- | -------- | +| 601 | 获取定位权限失败,失败原因:用户拒绝。 | +| 602 | 权限未声明。 | +| 800 | 超时,失败原因:网络状况不佳或GNSS不可用。 | +| 801 | 系统位置开关未打开。 | +| 802 | 该次调用结果未返回前接口又被重新调用,该次调用失败返回错误码。 | + +## GeolocationResponse(deprecated) + +位置信息,包含经度、纬度、定位精度等信息。 + +> **说明:**
+> 从API version 9开始废弃,建议使用[geoLocationManager.Location](js-apis-geoLocationManager.md#location)替代。 + +**系统能力**:SystemCapability.Location.Location.Lite + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------- | -------- | -------- | -------- | -------- | +| longitude | number | 是 | 否 | 设备位置信息:经度。 | +| latitude | number | 是 | 否 | 设备位置信息:纬度。 | +| altitude | number | 是 | 否 | 设备位置信息:海拔。 | +| accuracy | number | 是 | 否 | 设备位置信息:精确度。 | +| time | number | 是 | 否 | 设备位置信息:时间。 | + +## GetLocationTypeOption(deprecated) + +查询定位类型接口的入参,用于存放回调函数,在查询成功或者失败时接收查询结果。 + +> **说明:**
+> 从API version 9开始废弃。 + +**系统能力**:SystemCapability.Location.Location.Lite + +| 名称 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| success | (data: [GetLocationTypeResponse](#getlocationtyperesponsedeprecated)) => void | 否 | 接口调用成功的回调函数。 | +| fail | (data: string, code: number) => void | 否 | 接口调用失败的回调函数。 | +| complete | () => void | 否 | 接口调用结束的回调函数。 | + +## GetLocationTypeResponse(deprecated) + +当前设备支持的定位类型列表 + +> **说明:**
+> 从API version 9开始废弃。 + +**系统能力**:SystemCapability.Location.Location.Lite + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| -------- | -------- | -------- | -------- | -------- | +| types | Array<string> | 是 | 否 | 可选的定位类型['gps', 'network']。 | + +## SubscribeLocationOption(deprecated) + +持续定位请求的配置参数。 + +> **说明:**
+> 从API version 9开始废弃,建议使用[geoLocationManager.CurrentLocationRequest](js-apis-geoLocationManager.md#locationrequest)替代。 + +**需要权限**:ohos.permission.LOCATION + +**系统能力**:SystemCapability.Location.Location.Lite + +| 名称 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| coordType | string | 否 | 坐标系的类型,可通过getSupportedCoordTypes获取可选值,默认值为wgs84。 | +| success | (data: [GeolocationResponse](#geolocationresponsedeprecated)) => void | 是 | 位置信息发生变化的回调函数。 | +| fail | (data: string, code: number) => void | 否 | 接口调用失败的回调函数。 | + +fail返回错误代码: + +| 错误码 | 说明 | +| -------- | -------- | +| 601 | 获取定位权限失败,失败原因:用户拒绝。 | +| 602 | 权限未声明。 | +| 801 | 系统位置开关未打开。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-network.md b/zh-cn/application-dev/reference/apis/js-apis-system-network.md index dafd8dfb0cc77456536366353b7b3a3a01e9851b..85e7aa74af1e2d315ba9d602d61528d2a1a4caa6 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-network.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-network.md @@ -124,7 +124,7 @@ export default { **系统能力:** SystemCapability.Communication.NetManager.Core -| 参数名 | 类型 | 必填 | 说明 | +| 名称 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | | metered | boolean | 否 |是否按照流量计费。 | | type | string | 是|网络类型,可能的值有2g,3g,4g,5g,wifi,none等。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-notification.md b/zh-cn/application-dev/reference/apis/js-apis-system-notification.md index 90e659026163849de506824f05de742aa919db44..62de17e20deea8e360dd120e81514740aec84907 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-notification.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-notification.md @@ -17,22 +17,22 @@ import notification from '@system.notification'; **系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification -| 名称 | 类型 | 可读 | 可写 | 必填 | 描述 | -| ----------- | ---------------------------------------------- | ---- | ------------------------- | ------------------------- | ------------------------- | -| bundleName | string | 是 | 是 | 是 | 单击通知后要重定向到的应用程序的Bundle名。 | -| abilityName | string | 是 | 是 | 是 | 单击通知后要重定向到的应用程序的Ability名称。 | -| uri | string | 是 | 是 | 否 | 要重定向到的页面的uri。 | +| 名称 | 类型 | 必填 | 说明 | +| ----------- | ---------------------------------------------- | ---- | ------------------------- | +| bundleName | string | 是 | 单击通知后要重定向到的应用程序的Bundle名。 | +| abilityName | string | 是 | 单击通知后要重定向到的应用程序的Ability名称。 | +| uri | string | 否 | 要重定向到的页面的uri。 | ## ShowNotificationOptions **系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification -| 名称 | 类型 | 可读 | 可写 | 必填 | 描述 | -| ------------- | ---------------------------------------------- | ---- | ------------------------- | ------------------------- | ------------------------- | -| contentTitle | string | 是 | 是 | 否 | 通知标题。 | -| contentText | string | 是 | 是 | 否 | 通知内容。 | -| clickAction | ActionResult | 是 | 是 | 否 | 通知被点击后触发的行为。 | +| 名称 | 类型 | 必填 | 说明 | +| ------------- | ---------------------------------------------- | ---- | ------------------------- | +| contentTitle | string | 否 | 通知标题。 | +| contentText | string | 否 | 通知内容。 | +| clickAction | ActionResult | 否 | 通知被点击后触发的行为。 | ## notification.show diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-package.md b/zh-cn/application-dev/reference/apis/js-apis-system-package.md index aaaae2ffa6001a2ae226d2b333498b789c79522c..252cee0e700766d5591ccf8dbdb5c9d8a5cf251d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-package.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-package.md @@ -23,8 +23,6 @@ hasInstalled(options: CheckPackageHasInstalledOptions): void 查询指定应用是否存在,或者原生应用是否安装。 -**需要权限:** None - **系统能力:** SystemCapability.BundleManager.BundleFramework **参数:** @@ -65,7 +63,7 @@ export default { **系统能力:** SystemCapability.BundleManager.BundleFramework。 -| 参数名 | 类型 | 必填 | 说明 | +| 名称 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | |result | boolean | 是 | 指示应用是否已安装。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-parameter.md b/zh-cn/application-dev/reference/apis/js-apis-system-parameter.md index d7a6269fca2d55fce28433cb4bf7a35a8a8d917d..f43838efc108328c8c10fe6737bd6f352fea1235 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-system-parameter.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-parameter.md @@ -5,7 +5,7 @@ [系统参数](../../../device-dev/subsystems/subsys-boot-init-sysparam.md)。 > **说明:** -> - 本模块接口从API version 9开始不再维护,建议使用新接口[`@ohos.systemParameterV9`](js-apis-system-parameterV9.md)替代。 +> - 本模块接口从API version 9开始不再维护,建议使用新接口[`@ohos.systemParameterEnhance`](js-apis-system-parameterEnhance.md)替代。 > - 本模块首批接口从API version 6开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > - 本模块接口为系统接口。 > - 由于系统参数都是各个系统服务的内部信息和控制参数,每个系统参数都有各自不同的DAC和MAC访问控制权限,三方应用不能使用此类接口。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-sensor.md b/zh-cn/application-dev/reference/apis/js-apis-system-sensor.md index 3ad1ecd1983a0849dca0c47b44303ae31b62c7da..2f3d54255a9a81a80a337a8877df9e76c032fecc 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-sensor.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-sensor.md @@ -1,7 +1,5 @@ # @system.sensor (传感器) -## 模块说明 - sensor模块提供订阅传感器数据基本能力,主要包含查询传感器的列表、订阅/取消传感器的数据、执行控制命令等。 根据传感器的用途,可以将传感器分为六大类:运动类传感器、环境类传感器、方向类传感器、光线类传感器、健康类传感器、其他类传感器(如霍尔传感器),每一大类传感器包含不同类型的传感器,某种类型的传感器可能是单一的物理传感器,也可能是由多个物理传感器复合而成。 @@ -10,7 +8,7 @@ sensor模块提供订阅传感器数据基本能力,主要包含查询传感 > **说明:** > > - 从API Version 8开始,该接口不再维护,推荐使用新接口[`@ohos.sensor`](js-apis-sensor.md)。 -> - 本模块首批接口从API version 4开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> - 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > - 该功能使用需要对应硬件支持,仅支持真机调试。 @@ -21,15 +19,9 @@ sensor模块提供订阅传感器数据基本能力,主要包含查询传感 import sensor from '@system.sensor'; ``` -## 传感器错误码列表 - -| 错误码 | 说明 | -| ---- | -------------- | -| 900 | 当前设备不支持相应的传感器。 | - ## sensor.subscribeAccelerometer -subscribeAccelerometer(Object): void + subscribeAccelerometer(options: subscribeAccelerometerOptions): void 观察加速度数据变化。针对同一个应用,多次点击调用时,会覆盖前面的调用效果,即仅最后一次调用生效。 @@ -39,23 +31,13 @@ subscribeAccelerometer(Object): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | ---- | ---------------------------------------- | -| interval | string | 是 | 频率参数,加速度的回调函数执行频率。
默认为normal,可选值有:
- game:极高的回调频率,20ms/次,适用于游戏。
- ui:较高的回调频率,60ms/次,适用于UI更新。
- normal:普通的回调频率,200ms/次,低功耗。 | -| success | Function | 是 | 感应到加速度数据变化后的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | - -success返回值: - -| 参数名 | 类型 | 说明 | -| ---- | ------ | ------- | -| x | number | x轴的加速度。 | -| y | number | y轴的加速度。 | -| z | number | z轴的加速度。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------ | +| options | [subscribeAccelerometerOptions](#subscribeaccelerometeroptions) | 是 | 监听加速度传感器数据的回调函数的执行频率。 | **示例:** -``` +```js sensor.subscribeAccelerometer({ interval: 'normal', success: function(ret) { @@ -84,13 +66,13 @@ unsubscribeAccelerometer(): void **示例:** -``` +```js sensor.unsubscribeAccelerometer(); ``` ## sensor.subscribeCompass -subscribeCompass(Object): void + subscribeCompass(options: SubscribeCompassOptions): void 订阅罗盘数据变化。针对同一个应用,多次点击调用时,会覆盖前面的调用效果,即仅最后一次调用生效。 @@ -98,20 +80,13 @@ subscribeCompass(Object): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ------- | -------- | ---- | --------------- | -| success | Function | 是 | 罗盘数据改变后触发的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | - -success返回值: - -| 参数名 | 类型 | 说明 | -| --------- | ------ | ---------- | -| direction | number | 设备面对的方向度数。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | --------------------------------------------------- | ---- | -------------------------------- | +| options | [SubscribeCompassOptions](#subscribecompassoptions) | 是 | 当罗盘传感器数据发生变化时调用。 | **示例:** -``` +```js sensor.subscribeCompass({ success: function(ret) { console.log('get data direction:' + ret.direction); @@ -135,13 +110,13 @@ unsubscribeCompass(): void **示例:** -``` +```js sensor.unsubscribeCompass(); ``` ## sensor.subscribeProximity -subscribeProximity(Object): void + subscribeProximity(options: SubscribeProximityOptions): void 订阅距离感应数据变化。针对同一个应用,多次点击调用时,会覆盖前面的调用效果,即仅最后一次调用生效。 @@ -149,20 +124,13 @@ subscribeProximity(Object): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ------- | -------- | ---- | ----------------- | -| success | Function | 是 | 距离感应数据改变后调用的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | - -success返回值: - -| 参数名 | 类型 | 说明 | -| -------- | ------ | --------------------- | -| distance | number | 可见物体相对于设备显示屏的接近或远离状态。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------------------------------------------- | ---- | -------------------------------- | +| options | [SubscribeProximityOptions](#subscribeproximityoptions) | 是 | 当距离传感器数据发生变化时调用。 | **示例:** -``` +```js sensor.subscribeProximity({ success: function(ret) { console.log('get data distance:' + ret.distance); @@ -186,13 +154,13 @@ unsubscribeProximity(): void **示例:** -``` +```js sensor.unsubscribeProximity(); ``` ## sensor.subscribeLight -sensor.subscribeLight(Object): void + subscribeLight(options: SubscribeLightOptions): void 订阅环境光线感应数据变化。再次调用时,会覆盖前一次调用效果,即仅最后一次调用生效。 @@ -200,20 +168,13 @@ sensor.subscribeLight(Object): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ------- | -------- | ---- | --------------- | -| success | Function | 是 | 光线感应数据改变后的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | - -success返回值: - -| 参数名 | 类型 | 说明 | -| --------- | ------ | ------------ | -| intensity | number | 光线强度,单位为lux。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ----------------------------------------------- | ---- | ---------------------------------- | +| options | [SubscribeLightOptions](#subscribelightoptions) | 是 | 当环境光传感器数据发生变化时调用。 | **示例:** -``` +```js sensor.subscribeLight({ success: function(ret) { console.log('get data intensity:' + ret.intensity); @@ -237,13 +198,13 @@ unsubscribeLight(): void **示例:** -``` +```js sensor.unsubscribeLight(); ``` ## sensor.subscribeStepCounter -subscribeStepCounter(Object): void + subscribeStepCounter(options: SubscribeStepCounterOptions): void 订阅计步传感器数据变化。针对同一个应用,多次点击调用时,会覆盖前面的调用效果,即仅最后一次调用生效。 @@ -253,20 +214,13 @@ subscribeStepCounter(Object): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ------- | -------- | ---- | ---------------- | -| success | Function | 是 | 计步传感器数据改变后的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | - -success返回值: - -| 参数名 | 类型 | 说明 | -| ----- | ------ | --------------------- | -| steps | number | 计步传感器重启后累计记录的步数。
| +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ----------------------------------------------------------- | ---- | -------------------------------------- | +| options | [SubscribeStepCounterOptions](#subscribestepcounteroptions) | 是 | 当步进计数器传感器数据发生变化时调用。 | **示例:** -``` +```js sensor.subscribeStepCounter({ success: function(ret) { console.log('get step value:' + ret.steps); @@ -292,14 +246,14 @@ unsubscribeStepCounter(): void **示例:** -``` +```js sensor.unsubscribeStepCounter(); ``` ## sensor.subscribeBarometer -subscribeBarometer(Object): void +subscribeBarometer(options: SubscribeBarometerOptions): void 订阅气压传感器数据变化。针对同一个应用,多次点击调用时,会覆盖前面的调用效果,即仅最后一次调用生效。 @@ -307,20 +261,13 @@ subscribeBarometer(Object): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ------- | -------- | ---- | ---------------- | -| success | Function | 是 | 气压传感器数据改变后的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | - -success返回值: - -| 参数名 | 类型 | 说明 | -| -------- | ------ | ----------- | -| pressure | number | 气压值,单位:帕斯卡。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------------------------------------------- | ---- | ---------------------------------- | +| options | [SubscribeBarometerOptions](#subscribebarometeroptions) | 是 | 当气压计传感器数据发生变化时调用。 | **示例:** -``` +```js sensor.subscribeBarometer({ success: function(ret) { console.log('get data value:' + ret.pressure); @@ -345,14 +292,14 @@ unsubscribeBarometer(): void **示例:** -``` +```js sensor.unsubscribeBarometer(); ``` ## sensor.subscribeHeartRate -subscribeHeartRate(Object): void + subscribeHeartRate(options: SubscribeHeartRateOptions): void 订阅心率传感器数据变化。针对同一个应用,多次点击调用时,会覆盖前面的调用效果,即仅最后一次调用生效。 @@ -362,20 +309,13 @@ subscribeHeartRate(Object): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ------- | -------- | ---- | ------------------------- | -| success | Function | 是 | 心率传感器数据改变后的回调函数,默认频率5s/次。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | - -success返回值: - -| 参数名 | 类型 | 说明 | -| --------- | ------ | ---- | -| heartRate | number | 心率值。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------------------------------------------- | ---- | -------------------------------- | +| options | [SubscribeHeartRateOptions](#subscribeheartrateoptions) | 是 | 当心率传感器数据发生变化时调用。 | **示例:** -``` +```js sensor.subscribeHeartRate({ success: function(ret) { console.log('get heartrate value:' + ret.heartRate); @@ -402,13 +342,13 @@ unsubscribeHeartRate(): void **示例:** -``` +```js sensor.unsubscribeHeartRate(); ``` ## sensor.subscribeOnBodyState -subscribeOnBodyState(Object): void + subscribeOnBodyState(options: SubscribeOnBodyStateOptions): void 订阅设备佩戴状态。针对同一个应用,多次点击调用时,会覆盖前面的调用效果,即仅最后一次调用生效。 @@ -416,20 +356,13 @@ subscribeOnBodyState(Object): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ------- | -------- | ---- | ------------- | -| success | Function | 是 | 穿戴状态改变后的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | - -success返回值: - -| 参数名 | 类型 | 说明 | -| ----- | ------- | ------ | -| value | boolean | 是否已佩戴。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ----------------------------------------------------------- | ---- | ---------------------- | +| options | [SubscribeOnBodyStateOptions](#subscribeonbodystateoptions) | 是 | 当穿着状态改变时调用。 | **示例:** -``` +```js sensor.subscribeOnBodyState({ success: function(ret) { console.log('get on-body state value:' + ret.value); @@ -453,13 +386,13 @@ unsubscribeOnBodyState(): void **示例:** -``` +```js sensor.unsubscribeOnBodyState(); ``` ## sensor.getOnBodyState -getOnBodyState(Object): void + getOnBodyState(options: GetOnBodyStateOptions): void 获取设备佩戴状态。 @@ -467,21 +400,13 @@ getOnBodyState(Object): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | ---- | ------------ | -| success | Function | 否 | 接口调用成功的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | -| complete | Function | 否 | 接口调用结束的回调函数。 | - -success返回值: - -| 参数名 | 类型 | 说明 | -| ----- | ------- | ------ | -| value | boolean | 是否已佩戴。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ----------------------------------------------- | ---- | -------------------------- | +| options | [GetOnBodyStateOptions](#getonbodystateoptions) | 是 | 获取传感器磨损状态时调用。 | **示例:** -``` +```js sensor.getOnBodyState({ success: function(ret) { console.log('on body state: ' + ret.value); @@ -494,7 +419,7 @@ sensor.getOnBodyState({ ## sensor.subscribeDeviceOrientation6+ -subscribeDeviceOrientation(interval: string, success: (data: DeviceOrientationResponse), fail?: (data: string, code: number)): void + subscribeDeviceOrientation(options: SubscribeDeviceOrientationOptions): void 观察设备方向传感器数据变化。 @@ -504,22 +429,13 @@ subscribeDeviceOrientation(interval: string, success: (data: DeviceOrientationRe **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | ---- | ---------------------------------------- | -| interval | string | 是 | 频率参数,设备方向传感器的回调函数执行频率。
默认为normal,可选值有:
- game:极高的回调频率,20ms/次,适用于游戏。
- ui:较高的回调频率,60ms/次,适用于UI更新。
- normal:普通的回调频率,200ms/次,低功耗。 | -| success | Function | 是 | 感应到设备方向传感器数据变化后的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | - - success返回值: -| 参数名 | 类型 | 说明 | -| ----- | ------ | ---------------------------------------- | -| alpha | number | 当设备坐标 X/Y 和地球 X/Y 重合时,绕着 Z 轴转动的夹角为 alpha。 | -| beta | number | 当设备坐标 Y/Z 和地球 Y/Z 重合时,绕着 X 轴转动的夹角为 beta。 | -| gamma | number | 当设备 X/Z 和地球 X/Z 重合时,绕着 Y 轴转动的夹角为 gamma。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------ | +| options | [SubscribeDeviceOrientationOptions](#subscribedeviceorientationoptions) | 是 | 用于监听设备方向传感器数据的回调函数的执行频率。 | **示例:** -``` +```js sensor.subscribeDeviceOrientation({ interval: 'normal', success: function(ret) { @@ -546,13 +462,13 @@ unsubscribeDeviceOrientation(): void **示例:** -``` +```js sensor.unsubscribeDeviceOrientation(); ``` ## sensor.subscribeGyroscope6+ -subscribeGyroscope(interval: string, success: (data: GyroscopeResponse), fail?: (data: string, code: number)): void + subscribeGyroscope(options: SubscribeGyroscopeOptions): void 观察陀螺仪数据变化。 @@ -564,23 +480,13 @@ subscribeGyroscope(interval: string, success: (data: GyroscopeResponse), fail?: **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | ---- | ---------------------------------------- | -| interval | string | 是 | 频率参数,陀螺仪的回调函数执行频率。
默认为normal,可选值有:
- game:极高的回调频率,20ms/次,适用于游戏。
- ui:较高的回调频率,60ms/次,适用于UI更新。
- normal:普通的回调频率,200ms/次,低功耗。 | -| success | Function | 是 | 感应到陀螺仪数据变化后的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | - -success返回值: - -| 参数名 | 类型 | 说明 | -| ---- | ------ | --------- | -| x | number | x轴的旋转角速度。 | -| y | number | y轴的旋转角速度。 | -| z | number | z轴的旋转角速度。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------------------------------------------------------- | ---- | ---------------------------------------------- | +| options | [SubscribeGyroscopeOptions](#subscribegyroscopeoptions) | 是 | 用于侦听陀螺仪传感器数据的回调函数的执行频率。 | **示例:** -``` +```js sensor.subscribeGyroscope({ interval: 'normal', success: function(ret) { @@ -609,6 +515,253 @@ unsubscribeGyroscope(): void **示例:** -``` +```js sensor.unsubscribeGyroscope(); ``` + +## subscribeAccelerometerOptions + +用于监听加速度传感器数据的回调函数的执行频率。 + +**需要权限**:ohos.permission.ACCELEROMETER + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| -------- | ----------------------------------------------- | ---- | ------------------------------------------------------------ | +| interval | string | 是 | 频率参数,加速度的回调函数执行频率。 默认为normal,可选值有: - game:极高的回调频率,20ms/次,适用于游戏。 - ui:较高的回调频率,60ms/次,适用于UI更新。 - normal:普通的回调频率,200ms/次,低功耗。 | +| success | [AccelerometerResponse](#accelerometerresponse) | 是 | 感应到加速度数据变化后的回调函数。 | +| fail | Function | 否 | 接口调用失败的回调函数。 | + +## AccelerometerResponse + +感应到加速度数据变化后的回调函数。 + +**需要权限**:ohos.permission.ACCELEROMETER + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| ---- | ------ | ---- | ------------- | +| x | number | 是 | x轴的加速度。 | +| y | number | 是 | y轴的加速度。 | +| z | number | 是 | z轴的加速度。 | + +## SubscribeCompassOptions + +当罗盘传感器数据发生变化时调用。 + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| ------- | ----------------------------------- | ---- | ------------------------------ | +| success | [CompassResponse](#compassresponse) | 是 | 罗盘数据改变后触发的回调函数。 | +| fail | Function | 否 | 接口调用失败的回调函数。 | + +## CompassResponse + +罗盘数据改变后触发的回调函数。 + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| --------- | ------ | ---- | -------------------- | +| direction | number | 是 | 设备面对的方向度数。 | + +## SubscribeProximityOptions + +当距离传感器数据发生变化时调用。 + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| ------- | --------------------------------------- | ---- | ---------------------------------- | +| success | [ProximityResponse](#proximityresponse) | 是 | 距离感应数据改变后调用的回调函数。 | +| fail | Function | 否 | 接口调用失败的回调函数。 | + +## ProximityResponse + +距离感应数据改变后调用的回调函数。 + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ------------------------------------------ | +| distance | number | 是 | 可见物体相对于设备显示屏的接近或远离状态。 | + +## SubscribeLightOptions + +当环境光传感器数据发生变化时调用。 + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| ------- | ------------------------------- | ---- | ------------------------------ | +| success | [LightResponse](#lightresponse) | 是 | 光线感应数据改变后的回调函数。 | +| fail | Function | 否 | 接口调用失败的回调函数。 | + +## LightResponse + +光线感应数据改变后的回调函数。 + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| --------- | ------ | ---- | --------------------- | +| intensity | number | 是 | 光线强度,单位为lux。 | + +## SubscribeStepCounterOptions + +当步进计数器传感器数据发生变化时调用。 + +**需要权限**:ohos.permission.ACTIVITY_MOTION + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| ------- | ------------------------------------------- | ---- | -------------------------------- | +| success | [StepCounterResponse](#stepcounterresponse) | 是 | 计步传感器数据改变后的回调函数。 | +| fail | Function | 否 | 接口调用失败的回调函数。 | + +## StepCounterResponse + +计步传感器数据改变后的回调函数。 + +**需要权限**:ohos.permission.ACTIVITY_MOTION + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| ----- | ------ | ---- | -------------------------------- | +| steps | number | 是 | 计步传感器重启后累计记录的步数。 | + +## SubscribeBarometerOptions + +当气压计传感器数据发生变化时调用。 + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| ------- | --------------------------------------- | ---- | -------------------------------- | +| success | [BarometerResponse](#barometerresponse) | 是 | 气压传感器数据改变后的回调函数。 | +| fail | Function | 否 | 接口调用失败的回调函数。 | + +## BarometerResponse + +气压传感器数据改变后的回调函数。 + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ---------------------- | +| pressure | number | 是 | 气压值,单位:帕斯卡。 | + +## SubscribeHeartRateOptions + +当心率传感器数据发生变化时调用。 + +**需要权限**:ohos.permission.READ_HEALTH_DATA + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| ------- | --------------------------------------- | ---- | ----------------------------------------------- | +| success | [HeartRateResponse](#heartrateresponse) | 是 | 心率传感器数据改变后的回调函数,默认频率5s/次。 | +| fail | Function | 否 | 接口调用失败的回调函数。 | + +## HeartRateResponse + +心率传感器数据改变后的回调函数,默认频率5s/次。 + +**需要权限**:ohos.permission.READ_HEALTH_DATA + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| --------- | ------ | ---- | -------- | +| heartRate | number | 是 | 心率值。 | + +## SubscribeOnBodyStateOptions + +当穿着状态改变时调用。 + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| ------- | ------------------------------------------- | ---- | -------------------------- | +| success | [OnBodyStateResponse](#onbodystateresponse) | 是 | 穿戴状态改变后的回调函数。 | +| fail | Function | 否 | 接口调用失败的回调函数。 | + +## OnBodyStateResponse + +传感器是否磨损。 + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| ----- | ------- | ---- | ------------ | +| value | boolean | 是 | 是否已佩戴。 | + +## GetOnBodyStateOptions + + 获取传感器磨损状态时调用。 + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------- | ---- | ------------------------ | +| success | [OnBodyStateResponse](#onbodystateresponse) | 否 | 接口调用成功的回调函数。 | +| fail | Function | 否 | 接口调用失败的回调函数。 | +| complete | Function | 否 | 接口调用结束的回调函数。 | + +## SubscribeDeviceOrientationOptions6+ + +用于监听设备方向传感器数据的回调函数的执行频率。 + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------------------------- | ---- | ------------------------------------------------------------ | +| interval | string | 是 | 频率参数,设备方向传感器的回调函数执行频率。
默认为normal,可选值有:
- game:极高的回调频率,20ms/次,适用于游戏。
- ui:较高的回调频率,60ms/次,适用于UI更新。
- normal:普通的回调频率,200ms/次,低功耗。 | +| success | [DeviceOrientationResponse](#deviceorientationresponse) | 是 | 感应到设备方向传感器数据变化后的回调函数。 | +| fail | Function | 否 | 接口调用失败的回调函数。 | + +## DeviceOrientationResponse6+ + +感应到设备方向传感器数据变化后的回调函数。 + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| ----- | ------ | ---- | ------------------------------------------------------------ | +| alpha | number | 是 | 当设备坐标 X/Y 和地球 X/Y 重合时,绕着 Z 轴转动的夹角为 alpha。 | +| beta | number | 是 | 当设备坐标 Y/Z 和地球 Y/Z 重合时,绕着 X 轴转动的夹角为 beta。 | +| gamma | number | 是 | 当设备 X/Z 和地球 X/Z 重合时,绕着 Y 轴转动的夹角为 gamma。 | + +## SubscribeGyroscopeOptions6+ + +用于侦听陀螺仪传感器数据的回调函数的执行频率。 + +**需要权限**:ohos.permission.GYROSCOPE + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------- | ---- | ------------------------------------------------------------ | +| interval | string | 是 | 频率参数,陀螺仪的回调函数执行频率。
默认为normal,可选值有:
- game:极高的回调频率,20ms/次,适用于游戏。
- ui:较高的回调频率,60ms/次,适用于UI更新。
- normal:普通的回调频率,200ms/次,低功耗。 | +| success | [GyroscopeResponse](#gyroscoperesponse) | 是 | 感应到陀螺仪数据变化后的回调函数。 | +| fail | Function | 否 | 接口调用失败的回调函数。 | + +## GyroscopeResponse6+ + +感应到陀螺仪数据变化后的回调函数。 + +**需要权限**:ohos.permission.GYROSCOPE + +**系统能力**:SystemCapability.Sensors.Sensor + +| 名称 | 类型 | 必填 | 说明 | +| ---- | ------ | ---- | ----------------- | +| x | number | 是 | x轴的旋转角速度。 | +| y | number | 是 | y轴的旋转角速度。 | +| z | number | 是 | z轴的旋转角速度。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-vibrate.md b/zh-cn/application-dev/reference/apis/js-apis-system-vibrate.md index 0d8e3958c0847d20639ed13991919981a6bdcb84..7726086cc4e0c4e0327b773d8278e9240fcb5041 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-vibrate.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-vibrate.md @@ -1,14 +1,12 @@ # @system.vibrator (振动) -## 模块说明 - vibrator模块提供控制马达振动的能力,主要包含灯的列表查询、打开灯、关闭灯等接口,振动器的列表查询、振动器的振动器效果查询、触发/关闭振动器等接口。 控制类小器件指的是设备上的LED灯和振动器。其中,LED灯主要用作指示(如充电状态)、闪烁功能(如三色灯)等;振动器主要用于闹钟、开关机振动、来电振动等场景。 > **说明:** -> - 本模块首批接口从API version 4开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 +> - 本模块首批接口从API version 3开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 > - 从API Version 8开始,该接口不再维护,推荐使用新接口[`@ohos.vibrator`](js-apis-vibrator.md)。 > - 该功能使用需要对应硬件支持,仅支持真机调试。 @@ -22,26 +20,23 @@ import vibrator from '@system.vibrator'; ## vibrator.vibrate -vibrate(Object): void + vibrate(options?: VibrateOptions): void 触发设备振动。 -**系统能力**:SystemCapability.Sensors.MiscDevice +**需要权限**:ohos.permission.VIBRATE -**需要权限**:ohos.permission.VIBRATE,该权限为系统权限 +**系统能力**:SystemCapability.Sensors.MiscDevice **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| mode | string | 否 | 振动的模式,其中long表示长振动,short表示短振动,默认值为long。 | -| success | Function | 是 | 感应到振动数据变化后的回调函数。 | -| fail | Function | 否 | 接口调用失败的回调函数。 | -| complete | Function | 否 | 接口调用结束的回调函数。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | --------------------------------- | ---- | ---------- | +| options | [VibrateOptions](#vibrateoptions) | 否 | 振动模式。 | **示例:** -``` +```js vibrator.vibrate({ mode: 'short', success: function() { @@ -56,3 +51,17 @@ vibrator.vibrate({ }); ``` +## VibrateOptions + +振动模式。 + +**需要权限**:ohos.permission.VIBRATE + +**系统能力**:SystemCapability.Sensors.MiscDevice + +| 名称 | 类型 | 必填 | 说明 | +| -------- | -------- | ---- | ------------------------------------------------------------ | +| mode | string | 否 | 振动的模式,其中long表示长振动,short表示短振动,默认值为long。 | +| success | Function | 否 | 感应到振动数据变化后的回调函数。 | +| fail | Function | 否 | 接口调用失败的回调函数。 | +| complete | Function | 否 | 接口调用结束的回调函数。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-tagSession.md b/zh-cn/application-dev/reference/apis/js-apis-tagSession.md index 32b66bd40eecb8b10ef4313dbd7325c80cf8162e..fda6cf598264cd5e2cbb6972ee0f24329dc51446 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-tagSession.md +++ b/zh-cn/application-dev/reference/apis/js-apis-tagSession.md @@ -183,8 +183,6 @@ isTagConnected(): boolean > **说明:** > 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用[tagSession.isConnected](#tagsessionisconnected9)替代。 -**需要权限:** ohos.permission.NFC_TAG - **系统能力:** SystemCapability.Communication.NFC.Tag **返回值:** @@ -211,8 +209,6 @@ isConnected(): boolean 检查是否已与标签建立连接。 -**需要权限:** ohos.permission.NFC_TAG - **系统能力:** SystemCapability.Communication.NFC.Tag **返回值:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-taskpool.md b/zh-cn/application-dev/reference/apis/js-apis-taskpool.md index ee10746563fe247ab24658a01fc503d9841ba538..89d050ecfc85ab531f3e7e3b4b04dd8cc9de4248 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-taskpool.md +++ b/zh-cn/application-dev/reference/apis/js-apis-taskpool.md @@ -13,7 +13,7 @@ ## 导入模块 -```js +```ts import taskpool from '@ohos.taskpool'; ``` @@ -58,9 +58,9 @@ Task的构造函数。 **示例:** -```js +```ts +@Concurrent function func(args) { - "use concurrent" console.log("func: " + args); return args; } @@ -110,9 +110,9 @@ execute(func: Function, ...args: unknown[]): Promise\ **示例:** -```js +```ts +@Concurrent function func(args) { - "use concurrent" console.log("func: " + args); return args; } @@ -158,9 +158,9 @@ execute(task: Task, priority?: Priority): Promise\ **示例:** -```js +```ts +@Concurrent function func(args) { - "use concurrent" console.log("func: " + args); return args; } @@ -199,9 +199,9 @@ cancel(task: Task): void **示例:** -```js +```ts +@Concurrent function func(args) { - "use concurrent" console.log("func: " + args); return args; } @@ -209,7 +209,11 @@ function func(args) { async function taskpoolTest() { let task = new taskpool.Task(func, 100); let value = await taskpool.execute(task); - taskpool.cancel(task); + try { + taskpool.cancel(task); + } catch (e) { + console.log("taskpool.cancel occur error:" + e); + } } taskpoolTest(); @@ -221,12 +225,19 @@ taskpoolTest(); 序列化支持类型包括:All Primitive Type(不包括symbol)、Date、String、RegExp、Array、Map、Set、Object、ArrayBuffer、TypedArray。 ### 注意事项 -taskpool任务只支持引用入参传递或者import的变量,不支持使用闭包变量。 +- 仅支持在Stage模型且module的compileMode为esmodule的project中使用taskpool api。确认module的compileMode方法:查看当前module的build-profile.json5,在buildOption中补充"compileMode": "esmodule"。 +- taskpool任务只支持引用入参传递或者import的变量,不支持使用闭包变量,使用装饰器@Concurrent进行拦截。 +- taskpool任务只支持普通函数或者async函数,不支持类成员函数或者匿名函数,使用装饰器@Concurrent进行拦截。 +- 装饰器@Concurrent仅支持在ets文件使用,在ts文件中创建taskpool任务需使用"use concurrent"。 -```js -// 1. 引用入参传递 +### 简单使用 + +**示例一** + +```ts +// 支持普通函数、引用入参传递 +@Concurrent function func(args) { - "use concurrent" console.log("func: " + args); return args; } @@ -245,17 +256,19 @@ async function taskpoolTest() { taskpoolTest(); ``` -```js -// 2. 引用import变量 +**示例二** -// b.ts +```ts +// b.ets export var c = 2000; +``` +```ts +// 引用import变量 +// a.ets(与b.ets位于同一目录中) +import { c } from "./b"; -// a.ts(与b.ts同目录) -import { c } from './b' - +@Concurrent function test(a) { - "use concurrent" console.log(a); console.log(c); return a; @@ -273,4 +286,64 @@ async function taskpoolTest() { } taskpoolTest(); +``` + +**示例三** + +```ts +// 支持async函数 +@Concurrent +async function task() { + let ret = await Promise.all([ + new Promise(resolve => setTimeout(resolve, 1000, "resolved")) + ]); + return ret; +} + +async function taskpoolTest() { + taskpool.execute(task).then((result) => { + console.log("TaskPoolTest task result: " + result); + }); +} + +taskpoolTest(); +``` + +**示例四** + +```ts +// 在ts文件中创建taskpool任务需使用"use concurrent" +// c.ts +function test1(n) { + "use concurrent" + return n; +} +export async function taskpoolTest1() { + console.log("taskpoolTest1 start"); + var task = new taskpool.Task(test1, 100); + var result = await taskpool.execute(task); + console.log("taskpoolTest1 result:" + result); +} + +async function test2() { + "use concurrent" + var ret = await Promise.all([ + new Promise(resolve => setTimeout(resolve, 1000, "resolved")) + ]); + return ret; +} +export async function taskpoolTest2() { + console.log("taskpoolTest2 start"); + taskpool.execute(test2).then((result) => { + console.log("TaskPoolTest2 result: " + result); + }); +} +``` + +```ts +// a.ets(与c.ts在同一目录中) +import { taskpoolTest1, taskpoolTest2 } from "./c"; + +taskpoolTest1(); +taskpoolTest2(); ``` \ No newline at end of file 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 3b47746d554cb7d47e7d0ac83c9089ca2990dda9..268ecceda7a0bbdb2bfcef330ed4fe2d426fb2c5 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 @@ -85,7 +85,7 @@ setDefaultCellularDataSlotId(slotId: number, callback: AsyncCallback\): v 设置默认移动数据的SIM卡,使用callback方式作为异步方法。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -100,6 +100,8 @@ setDefaultCellularDataSlotId(slotId: number, callback: AsyncCallback\): v **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -114,8 +116,8 @@ setDefaultCellularDataSlotId(slotId: number, callback: AsyncCallback\): v **示例:** ```js -data.setDefaultCellularDataSlotId(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +data.setDefaultCellularDataSlotId(0, (err) => { + console.log(`callback: err->${JSON.stringify(err)}.`); }); ``` @@ -125,7 +127,7 @@ setDefaultCellularDataSlotId(slotId: number): Promise\ 设置默认移动数据的SIM卡,使用Promise方式作为异步方法。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -145,6 +147,8 @@ setDefaultCellularDataSlotId(slotId: number): Promise\ **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -160,8 +164,8 @@ setDefaultCellularDataSlotId(slotId: number): Promise\ ```js let promise = data.setDefaultCellularDataSlotId(0); -promise.then((data) => { - console.log(`setDefaultCellularDataSlotId success, promise: data->${JSON.stringify(data)}`); +promise.then(() => { + console.log(`setDefaultCellularDataSlotId success.`); }).catch((err) => { console.error(`setDefaultCellularDataSlotId fail, promise: err->${JSON.stringify(err)}`); }); @@ -279,6 +283,8 @@ isCellularDataEnabled(callback: AsyncCallback\): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -314,6 +320,8 @@ isCellularDataEnabled(): Promise\ **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -353,6 +361,8 @@ isCellularDataRoamingEnabled(slotId: number, callback: AsyncCallback\) **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -394,6 +404,8 @@ isCellularDataRoamingEnabled(slotId: number): Promise\ **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -420,7 +432,7 @@ enableCellularData(callback: AsyncCallback): void 启用蜂窝数据服务,使用callback方式作为异步方法。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -434,6 +446,8 @@ enableCellularData(callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -446,8 +460,8 @@ enableCellularData(callback: AsyncCallback): void **示例:** ```js -data.enableCellularData((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +data.enableCellularData((err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -457,7 +471,7 @@ enableCellularData(): Promise 启用蜂窝数据服务,使用Promise方式作为异步方法。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -471,6 +485,8 @@ enableCellularData(): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -484,8 +500,8 @@ enableCellularData(): Promise ```js let promise = data.enableCellularData(); -promise.then((data) => { - console.log(`enableCellularData success, promise: data->${JSON.stringify(data)}`); +promise.then(() => { + console.log(`enableCellularData success.`); }).catch((err) => { console.error(`enableCellularData fail, promise: err->${JSON.stringify(err)}`); }); @@ -497,7 +513,7 @@ disableCellularData(callback: AsyncCallback): void 禁用蜂窝数据服务,使用callback方式作为异步方法。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -511,6 +527,8 @@ disableCellularData(callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -523,8 +541,8 @@ disableCellularData(callback: AsyncCallback): void **示例:** ```js -data.disableCellularData((err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +data.disableCellularData((err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -534,7 +552,7 @@ disableCellularData(): Promise 禁用蜂窝数据服务,使用Promise方式作为异步方法。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -548,6 +566,8 @@ disableCellularData(): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -561,8 +581,8 @@ disableCellularData(): Promise ```js let promise = data.disableCellularData(); -promise.then((data) => { - console.log(`disableCellularData success, promise: data->${JSON.stringify(data)}`); +promise.then(() => { + console.log(`disableCellularData success.`); }).catch((err) => { console.error(`disableCellularData fail, promise: err->${JSON.stringify(err)}`); }); @@ -574,7 +594,7 @@ enableCellularDataRoaming(slotId: number, callback: AsyncCallback): void 启用蜂窝数据漫游,使用callback方式作为异步方法。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -589,6 +609,8 @@ enableCellularDataRoaming(slotId: number, callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -601,8 +623,8 @@ enableCellularDataRoaming(slotId: number, callback: AsyncCallback): void **示例:** ```js -data.enableCellularDataRoaming(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +data.enableCellularDataRoaming(0, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -612,7 +634,7 @@ enableCellularDataRoaming(slotId: number): Promise 启用蜂窝数据漫游,使用Promise方式作为异步方法。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -632,6 +654,8 @@ enableCellularDataRoaming(slotId: number): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -645,8 +669,8 @@ enableCellularDataRoaming(slotId: number): Promise ```js let promise = data.enableCellularDataRoaming(0); -promise.then((data) => { - console.log(`enableCellularDataRoaming success, promise: data->${JSON.stringify(data)}`); +promise.then(() => { + console.log(`enableCellularDataRoaming success.`); }).catch((err) => { console.error(`enableCellularDataRoaming fail, promise: err->${JSON.stringify(err)}`); }); @@ -658,7 +682,7 @@ disableCellularDataRoaming(slotId: number, callback: AsyncCallback): void 禁用蜂窝数据漫游,使用callback方式作为异步方法。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -673,6 +697,8 @@ disableCellularDataRoaming(slotId: number, callback: AsyncCallback): void **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -685,8 +711,8 @@ disableCellularDataRoaming(slotId: number, callback: AsyncCallback): void **示例:** ```js -data.disableCellularDataRoaming(0, (err, data) => { - console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`); +data.disableCellularDataRoaming(0, (err) => { + console.log(`callback: err->${JSON.stringify(err)}`); }); ``` @@ -696,7 +722,7 @@ disableCellularDataRoaming(slotId: number): Promise 禁用蜂窝数据漫游,使用Promise方式作为异步方法。 -此接口为系统接口。 +**系统接口:** 此接口为系统接口。 **需要权限**:ohos.permission.SET_TELEPHONY_STATE @@ -716,6 +742,8 @@ disableCellularDataRoaming(slotId: number): Promise **错误码:** +以下错误码的详细介绍请参见[ohos.telephony(电话子系统)错误码](../../reference/errorcodes/errorcode-telephony.md)错误码。 + | 错误码ID | 错误信息 | | -------- | -------------------------------------------- | | 201 | Permission denied. | @@ -729,8 +757,8 @@ disableCellularDataRoaming(slotId: number): Promise ```js let promise = data.disableCellularDataRoaming(0); -promise.then((data) => { - console.log(`disableCellularDataRoaming success, promise: data->${JSON.stringify(data)}`); +promise.then(() => { + console.log(`disableCellularDataRoaming success.`); }).catch((err) => { console.error(`disableCellularDataRoaming fail, promise: err->${JSON.stringify(err)}`); }); @@ -740,7 +768,7 @@ promise.then((data) => { 描述蜂窝数据流类型。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CellularData。 +**系统能力**:SystemCapability.Telephony.CellularData | 名称 | 值 | 说明 | | ---------------------- | ---- | ------------------------------------------ | @@ -754,7 +782,7 @@ promise.then((data) => { 描述蜂窝数据链路连接状态。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Telephony.CellularData。 +**系统能力**:SystemCapability.Telephony.CellularData | 名称 | 值 | 说明 | | ----------------------- | ---- | -------------------------- | diff --git a/zh-cn/application-dev/reference/apis/js-apis-treemap.md b/zh-cn/application-dev/reference/apis/js-apis-treemap.md index cd780e9e1fe63c7f9f159dfc779c1821a825fc3f..3162435c76ab6357d1b02239180116a7f07f39bb 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-treemap.md +++ b/zh-cn/application-dev/reference/apis/js-apis-treemap.md @@ -8,16 +8,17 @@ TreeMap和[HashMap](js-apis-treemap.md)相比,HashMap依据键的hashCode存 **推荐使用场景:** 一般需要存储有序键值对的场景,可以使用TreeMap。 -文档中存在泛型的使用,涉及以下泛型标记符: +文档中存在泛型的使用,涉及以下泛型标记符: -- K: Key, 键 +- K:Key,键 -- V: Value, 值 +- V:Value,值 > **说明:** > > 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + ## 导入模块 ```ts @@ -126,9 +127,8 @@ hasKey(key: K): boolean ```ts let treeMap = new TreeMap(); -let result = treeMap.hasKey("squirrel"); treeMap.set("squirrel", 123); -let result1 = treeMap.hasKey("squirrel"); +let result = treeMap.hasKey("squirrel"); ``` @@ -164,9 +164,8 @@ hasValue(value: V): boolean ```ts let treeMap = new TreeMap(); -let result = treeMap.hasValue(123); treeMap.set("squirrel", 123); -let result1 = treeMap.hasValue(123); +let result = treeMap.hasValue(123); ``` @@ -304,7 +303,7 @@ let map = new TreeMap(); map.set("demo", 12); map.setAll(treeMap); // 将treeMap中的所有元素添加到map中 map.forEach((value, key) => { - console.log("test" + value, key); // 打印结果 12 demo、356 sparrow、123 squirrel + console.log("value" + value, "key" + key); // 打印结果 12 demo、356 sparrow、123 squirrel }) ``` @@ -380,7 +379,7 @@ remove(key: K): V let treeMap = new TreeMap(); treeMap.set("squirrel", 123); treeMap.set("sparrow", 356); -treeMap.remove("sparrow"); +let result = treeMap.remove("sparrow"); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-treeset.md b/zh-cn/application-dev/reference/apis/js-apis-treeset.md index e90aabc45e5f3725274881f7859cedfecd3a89c2..a101191a61c2f684c07baa0695570f8f292758e6 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-treeset.md +++ b/zh-cn/application-dev/reference/apis/js-apis-treeset.md @@ -6,14 +6,15 @@ TreeSet和[HashSet](js-apis-hashset.md)相比,HashSet中的数据无序存放 **推荐使用场景:** 一般需要存储有序集合的场景,可以使用TreeSet。 -文档中存在泛型的使用,涉及以下泛型标记符: +文档中存在泛型的使用,涉及以下泛型标记符: -- T: Type, 类 +- T:Type,类 > **说明:** > > 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + ## 导入模块 ```ts @@ -122,9 +123,8 @@ has(value: T): boolean ```ts let treeSet = new TreeSet(); -treeSet.has(123); treeSet.add(123); -let result1 = treeSet.has(123); +let result = treeSet.has(123); ``` diff --git a/zh-cn/application-dev/reference/apis/js-apis-uiappearance.md b/zh-cn/application-dev/reference/apis/js-apis-uiappearance.md new file mode 100644 index 0000000000000000000000000000000000000000..a3f5ed1d72ab614ad2180c16468b793674b9f0c3 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-uiappearance.md @@ -0,0 +1,106 @@ +# @ohos.uiAppearance (用户界面外观) + +用户界面外观提供管理系统外观的一些基础能力,目前仅包括深浅色模式配置。 + +> **说明:** +> +> 从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 +> +> 本模块接口为系统接口。 + + +## 导入模块 + +```ts +import uiAppearance from '@ohos.uiAppearance' +``` + + +## DarkMode + +深色模式枚举。 + + +**系统能力:** SystemCapability.ArkUI.UiAppearance + +| 名称 | 值 | 说明 | +| -- | -- | -- | +| ALWAYS_DARK | 0 | 系统始终为深色。 | +| ALWAYS_LIGHT | 1 | 系统始终为浅色。 | + + +## uiAppearance.setDarkMode + +setDarkMode(mode: DarkMode, callback: AsyncCallback\): void + +设置系统深色模式。 + +**需要权限:** ohos.permission.UPDATE_CONFIGURATION + +**系统能力:** SystemCapability.ArkUI.UiAppearance + +**参数:** +| 参数名 | 类型 | 必填 | 说明 | +| -- | -- | -- | -- | +| mode | [DarkMode](#darkmode) | 是 | 指定系统的深色模式配置 | +| callback | AsyncCallback\| 是 | 配置深色模式的异步回调 | + +**示例:** + ```ts +uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK, (err) => { + console.info(`${err}`); +}) + ``` + + +## uiAppearance.setDarkMode + +setDarkMode(mode: DarkMode): Promise\; + +设置系统深色模式。 + +**需要权限:** ohos.permission.UPDATE_CONFIGURATION + +**系统能力:** SystemCapability.ArkUI.UiAppearance + +**参数:** +| 参数名 | 类型 | 必填 | 说明 | +| -- | -- | -- | -- | +| mode | [DarkMode](#darkmode) | 是 | 指定系统深色模式配置 | + +**返回值:** + +| 类型 | 说明 | +| ------ | ------------------------------ | +| Promise\ | Promise对象。无返回结果的Promise对象。| + +**示例:** + ```ts +uiAppearance.setDarkMode(uiAppearance.DarkMode.ALWAYS_DARK).then(() => { + console.log('Set dark-mode successfully.'); +}).catch((err) => { + console.log(`Set dark-mode failed, ${err}`); +}); + ``` + + +## uiAppearance.getDarkMode + +getDarkMode(): DarkMode; + +获取当前的深色模式配置。 + +**需要权限:** ohos.permission.UPDATE_CONFIGURATION + +**系统能力:** SystemCapability.ArkUI.UiAppearance + +**返回值:** +| 类型 | 说明 | +| -- | -- | +|[DarkMode](#darkmode) | 系统当前的深色模式配置 | + +**示例:** + ```ts +let darkMode = uiAppearance.getDarkMode(); +console.log(`Get dark-mode ${darkMode}`); + ``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-uitest.md b/zh-cn/application-dev/reference/apis/js-apis-uitest.md new file mode 100644 index 0000000000000000000000000000000000000000..84cb3f5d01d51e217035371df3e1e447103eaa8d --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-uitest.md @@ -0,0 +1,3925 @@ +# @ohos.UiTest + +UiTest提供模拟UI操作的能力,供开发者在测试场景使用,主要支持如点击、双击、长按、滑动等UI操作能力。 + +该模块提供以下功能: + +- [On9+](#on9):提供控件特征描述能力,用于控件筛选匹配查找。 +- [Component9+](#component9):代表UI界面上的指定控件,提供控件属性获取,控件点击,滑动查找,文本注入等能力。 +- [Driver9+](#driver9):入口类,提供控件匹配/查找,按键注入,坐标点击/滑动,截图等能力。 +- [UiWindow9+](#uiwindow9):入口类,提供窗口属性获取,窗口拖动、调整窗口大小等能力。 +- [By(deprecated)](#bydeprecated):提供控件特征描述能力,用于控件筛选匹配查找。从API version 9开始不再维护,建议使用[On9+](#on9)。 +- [UiComponent(deprecated)](#uicomponentdeprecated):代表UI界面上的指定控件,提供控件属性获取,控件点击,滑动查找,文本注入等能力。从API version 9开始不再维护,建议使用[Component9+](#component9)。 +- [UiDriver(deprecated)](#uidriverdeprecated):入口类,提供控件匹配/查找,按键注入,坐标点击/滑动,截图等能力。从API version 9开始不再维护,建议使用[Driver9+](#driver9)。 + +>**说明:** +> +>本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + + +## 导入模块 + +```js +import {UiComponent, UiDriver, Component, Driver, UiWindow, ON, BY, MatchPattern, DisplayRotation, ResizeDirection, WindowMode, PointerMatrix, UiDirection, MouseButton} from '@ohos.UiTest'; +``` + +## MatchPattern + +控件属性支持的匹配模式。 + +**系统能力**:SystemCapability.Test.UiTest + +| 名称 | 值 | 说明 | +| ----------- | ---- | -------------- | +| EQUALS | 0 | 等于给定值。 | +| CONTAINS | 1 | 包含给定值。 | +| STARTS_WITH | 2 | 以给定值开始。 | +| ENDS_WITH | 3 | 以给定值结束。 | + +## ResizeDirection9+ + +窗口调整大小的方向。 + +**系统能力**:SystemCapability.Test.UiTest + +| 名称 | 值 | 说明 | +| ---------- | ---- | -------- | +| LEFT | 0 | 左方。 | +| RIGHT | 1 | 右方。 | +| UP | 2 | 上方。 | +| DOWN | 3 | 下方。 | +| LEFT_UP | 4 | 左上方。 | +| LEFT_DOWN | 5 | 左下方。 | +| RIGHT_UP | 6 | 右上方。 | +| RIGHT_DOWN | 7 | 右下方。 | + +## Point9+ + +坐标点信息。 + +**系统能力**:SystemCapability.Test.UiTest + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ---- | ------ | ---- | ---- | ---------------- | +| x | number | 是 | 否 | 坐标点的横坐标。 | +| y | number | 是 | 否 | 坐标点的纵坐标。 | + +## Rect9+ + +控件的边框信息。 + +**系统能力**:SystemCapability.Test.UiTest + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ------ | ------ | ---- | ---- | ------------------------- | +| left | number | 是 | 否 | 控件边框的左上角的X坐标。 | +| top | number | 是 | 否 | 控件边框的左上角的Y坐标。 | +| right | number | 是 | 否 | 控件边框的右下角的X坐标。 | +| bottom | number | 是 | 否 | 控件边框的右下角的Y坐标。 | + +## WindowMode9+ + +窗口的窗口模式。 + +**系统能力**:SystemCapability.Test.UiTest + +| 名称 | 值 | 说明 | +| ---------- | ---- | ---------- | +| FULLSCREEN | 0 | 全屏模式。 | +| PRIMARY | 1 | 主窗口。 | +| SECONDARY | 2 | 第二窗口。 | +| FLOATING | 3 | 浮动窗口。 | + +## DisplayRotation9+ + +设备显示器的显示方向。 + +**系统能力**:SystemCapability.Test.UiTest + +| 名称 | 值 | 说明 | +| ------------ | ---- | ---------------------------------------- | +| ROTATION_0 | 0 | 设备显示器不旋转,初始形态垂直显示。 | +| ROTATION_90 | 1 | 设备显示器顺时针旋转90°,水平显示。 | +| ROTATION_180 | 2 | 设备显示器顺时针旋转180°,逆向垂直显示。 | +| ROTATION_270 | 3 | 设备显示器顺时针旋转270°,逆向水平显示。 | + +## WindowFilter9+ + +窗口的标志属性信息。 + +**系统能力**:SystemCapability.Test.UiTest + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ---------- | ------- | ---- | ---- | -------------------------- | +| bundleName | string | 是 | 否 | 窗口归属应用的包名。 | +| title | string | 是 | 否 | 窗口的标题信息。 | +| focused | boolean | 是 | 否 | 窗口是否处于获焦状态。 | +| actived | boolean | 是 | 否 | 窗口是否正与用户进行交互。 | + +## UiDirection10+ + +进行抛滑等UI操作时的方向。 + +**系统能力**:SystemCapability.Test.UiTest + +| 名称 | 值 | 说明 | +| ----- | ---- | ------ | +| LEFT | 0 | 向左。 | +| RIGHT | 1 | 向右。 | +| UP | 2 | 向上。 | +| DOWN | 3 | 向下。 | + +## MouseButton10+ + +模拟注入的鼠标按钮。 + +**系统能力**:SystemCapability.Test.UiTest + +| 名称 | 值 | 说明 | +| ------------------- | ---- | ------------ | +| MOUSE_BUTTON_LEFT | 0 | 鼠标左键。 | +| MOUSE_BUTTON_RIGHT | 1 | 鼠标右键。 | +| MOUSE_BUTTON_MIDDLE | 2 | 鼠标中间键。 | + +## On9+ + +UiTest框架在API 9中,通过On类提供了丰富的控件特征描述API,用于进行控件筛选来匹配/查找出目标控件。
+On提供的API能力具有以下几个特点:
1、支持单属性匹配和多属性组合匹配,例如同时指定目标控件text和id。
2、控件属性支持多种匹配模式。
3、支持控件绝对定位,相对定位,可通过[ON.isBefore](#isbefore)和[ON.isAfter](#isafter)等API限定邻近控件特征进行辅助定位。
On类提供的所有API均为同步接口,建议使用者通过静态构造器ON来链式创建On对象。 + +```js +ON.text('123').type('button'); +``` + +### text9+ + +text(txt: string, pattern?: MatchPattern): On + +指定目标控件文本属性,支持多种匹配模式,返回On对象自身。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ----------------------------- | ---- | --------------------------------------------------- | +| txt | string | 是 | 指定控件文本,用于匹配目标控件文本。 | +| pattern | [MatchPattern](#matchpattern) | 否 | 指定的文本匹配模式,默认为[EQUALS](#matchpattern)。 | + +**返回值:** + +| 类型 | 说明 | +| ---------- | ---------------------------------- | +| [On](#on9) | 返回指定目标控件文本属性的On对象。 | + +**示例:** + +```js +let on = ON.text('123'); // 使用静态构造器ON创建On对象,指定目标控件的text属性。 +``` + + +### id9+ + +id(id: string): On + +指定目标控件id属性,返回On对象自身。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ---------------- | +| id | string | 是 | 指定控件的id值。 | + +**返回值:** + +| 类型 | 说明 | +| ---------- | -------------------------------- | +| [On](#on9) | 返回指定目标控件id属性的On对象。 | + +**示例:** + +```js +let on = ON.id('123'); // 使用静态构造器ON创建On对象,指定目标控件的id属性。 +``` + + +### type9+ + +type(tp: string): On + +指定目标控件的控件类型属性,返回On对象自身。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------- | +| tp | string | 是 | 指定控件类型。 | + +**返回值:** + +| 类型 | 说明 | +| ---------- | ---------------------------------------- | +| [On](#on9) | 返回指定目标控件的控件类型属性的On对象。 | + +**示例:** + +```js +let on = ON.type('button'); // 使用静态构造器ON创建On对象,指定目标控件的控件类型属性。 +``` + + +### clickable9+ + +clickable(b?: boolean): On + +指定目标控件的可点击状态属性,返回On对象自身。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------- | ---- | ------------------------------------------------------------ | +| b | boolean | 否 | 指定控件可点击状态,true:可点击,false:不可点击。默认为true。 | + +**返回值:** + +| 类型 | 说明 | +| ---------- | ------------------------------------------ | +| [On](#on9) | 返回指定目标控件的可点击状态属性的On对象。 | + +**示例:** + +```js +let on = ON.clickable(true); // 使用静态构造器ON创建On对象,指定目标控件的可点击状态属性。 +``` + +### longClickable9+ + +longClickable(b?: boolean): On + +指定目标控件的可长按点击状态属性,返回On对象自身。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------- | ---- | ------------------------------------------------------------ | +| b | boolean | 否 | 指定控件可长按点击状态,true:可长按点击,false:不可长按点击。默认为true。 | + +**返回值:** + +| 类型 | 说明 | +| ---------- | ---------------------------------------------- | +| [On](#on9) | 返回指定目标控件的可长按点击状态属性的On对象。 | + +**示例:** + +```js +let on = ON.longClickable(true); // 使用静态构造器ON创建On对象,指定目标控件的可长按点击状态属性。 +``` + + +### scrollable9+ + +scrollable(b?: boolean): On + +指定目标控件的可滑动状态属性,返回On对象自身。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------- | ---- | ----------------------------------------------------------- | +| b | boolean | 否 | 控件可滑动状态,true:可滑动,false:不可滑动。默认为true。 | + +**返回值:** + +| 类型 | 说明 | +| ---------- | ------------------------------------------ | +| [On](#on9) | 返回指定目标控件的可滑动状态属性的On对象。 | + +**示例:** + +```js +let on = ON.scrollable(true); // 使用静态构造器ON创建On对象,指定目标控件的可滑动状态属性。 +``` + +### enabled9+ + +enabled(b?: boolean): On + +指定目标控件的使能状态属性,返回On对象自身。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------- | ---- | --------------------------------------------------------- | +| b | boolean | 否 | 指定控件使能状态,true:使能,false:未使能。默认为true。 | + +**返回值:** + +| 类型 | 说明 | +| ---------- | ---------------------------------------- | +| [On](#on9) | 返回指定目标控件的使能状态属性的On对象。 | + +**示例:** + +```js +let on = ON.enabled(true); // 使用静态构造器ON创建On对象,指定目标控件的使能状态属性。 +``` + +### focused9+ + +focused(b?: boolean): On + +指定目标控件的获焦状态属性,返回On对象自身。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------- | ---- | ----------------------------------------------------- | +| b | boolean | 否 | 控件获焦状态,true:获焦,false:未获焦。默认为true。 | + +**返回值:** + +| 类型 | 说明 | +| ---------- | ---------------------------------------- | +| [On](#on9) | 返回指定目标控件的获焦状态属性的On对象。 | + +**示例:** + +```js +let on = ON.focused(true); // 使用静态构造器ON创建On对象,指定目标控件的获焦状态属性。 +``` + +### selected9+ + +selected(b?: boolean): On + +指定目标控件的被选中状态属性,返回On对象自身。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------- | ---- | ------------------------------------------------------------ | +| b | boolean | 否 | 指定控件被选中状态,true:被选中,false:未被选中。默认为true。 | + +**返回值:** + +| 类型 | 说明 | +| ---------- | ------------------------------------------ | +| [On](#on9) | 返回指定目标控件的被选中状态属性的On对象。 | + +**示例:** + +```js +let on = ON.selected(true); // 使用静态构造器ON创建On对象,指定目标控件的被选中状态属性。 +``` + +### checked9+ + +checked(b?: boolean): On + +指定目标控件的被勾选状态属性,返回On对象自身。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------- | ---- | ------------------------------------------------------------ | +| b | boolean | 否 | 指定控件被勾选状态,true:被勾选,false:未被勾选。默认为false。 | + +**返回值:** + +| 类型 | 说明 | +| ---------- | ------------------------------------------ | +| [On](#on9) | 返回指定目标控件的被勾选状态属性的On对象。 | + +**示例:** + +```js +let on = ON.checked(true); // 使用静态构造器ON创建On对象,指定目标控件的被勾选状态属性 +``` + +### checkable9+ + +checkable(b?: boolean): On + +指定目标控件能否被勾选状态属性,返回On对象自身。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------- | ---- | ------------------------------------------------------------ | +| b | boolean | 否 | 指定控件能否被勾选状态,true:能被勾选,false:不能被勾选。默认为false。 | + +**返回值:** + +| 类型 | 说明 | +| ---------- | -------------------------------------------- | +| [On](#on9) | 返回指定目标控件能否被勾选状态属性的On对象。 | + +**示例:** + +```js +let on = ON.checkable(true); // 使用静态构造器ON创建On对象,指定目标控件的能否被勾选状态属性。 +``` + +### isBefore9+ + +isBefore(on: On): On + +指定目标控件位于给出的特征属性控件之前,返回On对象自身。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ---------- | ---- | -------------------- | +| on | [On](#on9) | 是 | 特征控件的属性要求。 | + +**返回值:** + +| 类型 | 说明 | +| ---------- | ---------------------------------------------------- | +| [On](#on9) | 返回指定目标控件位于给出的特征属性控件之前的On对象。 | + +**示例:** + +```js +let on = ON.isBefore(ON.text('123')); // 使用静态构造器ON创建On对象,指定目标控件位于给出的特征属性控件之前。 +``` + +### isAfter9+ + +isAfter(on: On): On + +指定目标控件位于给出的特征属性控件之后,返回On对象自身。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ---------- | ---- | -------------------- | +| on | [On](#on9) | 是 | 特征控件的属性要求。 | + +**返回值:** + +| 类型 | 说明 | +| ---------- | ---------------------------------------------------- | +| [On](#on9) | 返回指定目标控件位于给出的特征属性控件之后的On对象。 | + +**示例:** + +```js +let on = ON.isAfter(ON.text('123')); // 使用静态构造器ON创建On对象,指定目标控件位于给出的特征属性控件之后。 +``` + +### within10+ + +within(on: On): On + +指定目标控件位于给出的特征属性控件之内,返回On对象自身。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ---------- | ---- | -------------------- | +| on | [On](#on9) | 是 | 特征控件的属性要求。 | + +**返回值:** + +| 类型 | 说明 | +| ---------- | -------------------------------------------------- | +| [On](#on9) | 返回指定目标控件位于给出的特征属性控件内的On对象。 | + +**示例:** + +```js +let on = ON.within(ON.type('List')); // 使用静态构造器ON创建On对象,指定目标控件位于给出的特征属性控件之内。 +``` + +### inWindow10+ + +inWindow(bundleName: string): On; + +指定目标控件位于给出的应用窗口内,返回On对象自身。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---------- | ------ | ---- | ---------------- | +| bundleName | string | 是 | 应用窗口的包名。 | + +**返回值:** + +| 类型 | 说明 | +| ---------- | ---------------------------------------------- | +| [On](#on9) | 返回指定目标控件位于给出的应用窗口内的On对象。 | + +**示例:** + +```js +let on = ON.inWindow('com.uitestScene.acts'); // 使用静态构造器ON创建On对象,指定目标控件位于给出的应用窗口内。 +``` + +## Component9+ + +UiTest框架在API9中,Component类代表了UI界面上的一个控件,提供控件属性获取,控件点击,滑动查找,文本注入等API。 +该类提供的所有方法都使用Promise方式作为异步方法,需使用await调用。 + +### click9+ + +click(): Promise\ + +控件对象进行点击操作。 + +**系统能力**:SystemCapability.Test.UiTest + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let button = await driver.findComponent(ON.type('button')); + await button.click(); +} +``` + +### doubleClick9+ + +doubleClick(): Promise\ + +控件对象进行双击操作。 + +**系统能力**:SystemCapability.Test.UiTest + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let button = await driver.findComponent(ON.type('button')); + await button.doubleClick(); +} +``` + +### longClick9+ + +longClick(): Promise\ + +控件对象进行长按操作。 + +**系统能力**:SystemCapability.Test.UiTest + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let button = await driver.findComponent(ON.type('button')); + await button.longClick(); +} +``` + +### getId9+ + +getId(): Promise\ + +获取控件对象的id值。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ------------------------------- | +| Promise\ | 以Promise形式返回的控件的id值。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let button = await driver.findComponent(ON.type('button')); + let num = await button.getId(); +} +``` + +### getText9+ + +getText(): Promise\ + +获取控件对象的文本信息。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| ---------------- | --------------------------------- | +| Promise\ | 以Promise形式返回控件的文本信息。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let button = await driver.findComponent(ON.type('button')); + let text = await button.getText(); +} +``` + +### getType9+ + +getType(): Promise\ + +获取控件对象的控件类型。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ----------------------------- | +| Promise\ | 以Promise形式返回控件的类型。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let button = await driver.findComponent(ON.type('button')); + let type = await button.getType(); +} +``` + +### getBounds9+ + +getBounds(): Promise\ + +获取控件对象的边框信息。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| ------------------------ | ------------------------------------- | +| Promise\<[Rect](#rect9)> | 以Promise形式返回控件对象的边框信息。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let button = await driver.findComponent(ON.type('button')); + let rect = await button.getBounds(); +} +``` + +### getBoundsCenter9+ + +getBoundsCenter(): Promise\ + +获取控件对象所占区域的中心点信息。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| -------------------------- | ----------------------------------------------- | +| Promise\<[Point](#point9)> | 以Promise形式返回控件对象所占区域的中心点信息。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let button = await driver.findComponent(ON.type('button')); + let point = await button.getBoundsCenter(); +} +``` + +### isClickable9+ + +isClickable(): Promise\ + +获取控件对象可点击属性。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| ----------------- | ------------------------------------------------------------ | +| Promise\ | 以Promise形式返回控件对象是否可点击,true:可点击,false:不可点击。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let button = await driver.findComponent(ON.type('button')); + if(await button.isClickable()) { + console.info('This button can be Clicked'); + } else { + console.info('This button can not be Clicked'); + } +} +``` + +### isLongClickable9+ + +isLongClickable(): Promise\ + +获取控件对象可长按点击属性。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| ----------------- | ------------------------------------------------------------ | +| Promise\ | 以Promise形式返回控件对象是否可安装点击,true:可长按点击,false:不可长按点击。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let button = await driver.findComponent(ON.type('button')); + if(await button.isLongClickable()) { + console.info('This button can longClick'); + } else { + console.info('This button can not longClick'); + } +} +``` + +### isChecked9+ + +isChecked(): Promise\ + +获取控件对象被勾选状态。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| ----------------- | ------------------------------------------------------------ | +| Promise\ | 以Promise形式返回控件对象被勾选状态,true:被勾选,false:未被勾选。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let checkBox = await driver.findComponent(ON.type('Checkbox')); + if(await checkBox.isChecked) { + console.info('This checkBox is checked'); + } else { + console.info('This checkBox is not checked'); + } +} +``` + +### isCheckable9+ + +isCheckable(): Promise\ + +获取控件对象能否被勾选属性。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| ----------------- | ------------------------------------------------------------ | +| Promise\ | 以Promise形式返回控件对象能否可被勾选属性,true:可被勾选,false:不可被勾选。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let checkBox = await driver.findComponent(ON.type('Checkbox')); + if(await checkBox.isCheckable) { + console.info('This checkBox is checkable'); + } else { + console.info('This checkBox is not checkable'); + } +} +``` + +### isScrollable9+ + +isScrollable(): Promise\ + +获取控件对象可滑动属性。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| ----------------- | ------------------------------------------------------------ | +| Promise\ | 以Promise形式返回控件对象是否可滑动,true:可滑动,false:不可滑动。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let scrollBar = await driver.findComponent(ON.scrollable(true)); + if(await scrollBar.isScrollable()) { + console.info('This scrollBar can be operated'); + } else { + console.info('This scrollBar can not be operated'); + } +} +``` + + +### isEnabled9+ + +isEnabled(): Promise\ + +获取控件使能状态。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| ----------------- | ---------------------------------------------------------- | +| Promise\ | 以Promise形式返回控件使能状态,true:使能,false:未使能。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let button = await driver.findComponent(ON.type('button')); + if(await button.isEnabled()) { + console.info('This button can be operated'); + } else { + console.info('This button can not be operated'); + } +} + +``` + +### isFocused9+ + +isFocused(): Promise\ + +判断控件对象获焦状态。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| ----------------- | ------------------------------------------------------------ | +| Promise\ | 以Promise形式返回控件对象获焦状态,true:获焦,false:未获焦。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let button = await driver.findComponent(ON.type('button')); + if(await button.isFocused()) { + console.info('This button is focused'); + } else { + console.info('This button is not focused'); + } +} +``` + +### isSelected9+ + +isSelected(): Promise\ + +获取控件对象被选中状态。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| ----------------- | --------------------------------------------------- | +| Promise\ | 控件对象被选中状态,true:被选中,false:未被选中。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let button = await driver.findComponent(ON.type('button')); + if(await button.isSelected()) { + console.info('This button is selected'); + } else { + console.info('This button is not selected'); + } +} +``` + +### inputText9+ + +inputText(text: string): Promise\ + +向控件中输入文本(适用于文本框控件)。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ---------------------------------------- | +| text | string | 是 | 输入的文本信息,当前支持英文和特殊字符。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let text = await driver.findComponent(ON.text('hello world')); + await text.inputText('123'); +} +``` + +### clearText9+ + +clearText(): Promise\ + +清除控件的文本信息(适用于文本框控件)。 + +**系统能力**:SystemCapability.Test.UiTest + +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let text = await driver.findComponent(ON.text('hello world')); + await text.clearText(); +} +``` + +### scrollSearch9+ + +scrollSearch(on: On): Promise\ + +在控件上滑动查找目标控件(适用支持滑动的控件)。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ---------- | ---- | -------------------- | +| on | [On](#on9) | 是 | 目标控件的属性要求。 | + +**返回值:** + +| 类型 | 说明 | +| ---------------------------------- | ------------------------------------- | +| Promise\<[Component](#component9)> | 以Promise形式返回找到的目标控件对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let button = await driver.findComponent(ON.type('Scroll')); + let button = await scrollBar.scrollSearch(ON.text('next page')); +} +``` + +### scrollToTop9+ + +scrollToTop(speed?: number): Promise\ + +在控件上滑动到顶部(适用支持滑动的控件)。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------------------------------------------------------------ | +| speed | number | 否 | 滑动速率,范围:200-15000,不在范围内设为默认值为600,单位:像素点/秒。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let scrollBar = await driver.findComponent(ON.type('Scroll')); + await scrollBar.scrollToTop(); +} +``` + +### scrollToBottom9+ + +scrollToBottom(speed?: number): Promise\ + +在控件上滑动到底部(适用支持滑动的控件)。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------------------------------------------------------------ | +| speed | number | 否 | 滑动速率,范围:200-15000,不在范围内设为默认值为600,单位:像素点/秒。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let scrollBar = await driver.findComponent(ON.type('Scroll')); + await scrollBar.scrollToBottom(); +} +``` + +### dragTo9+ + +dragTo(target: Component): Promise\ + +将控件拖拽至目标控件处。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------------------------ | ---- | ---------- | +| target | [Component](#component9) | 是 | 目标控件。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let button = await driver.findComponent(ON.type('button')); + let text = await driver.findComponent(ON.text('hello world')); + await button.dragTo(text); + } +``` + +### pinchOut9+ + +pinchOut(scale: number): Promise\ + +将控件按指定的比例进行捏合放大。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ---------------- | +| scale | number | 是 | 指定放大的比例。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let image = await driver.findComponent(ON.type('image')); + await image.pinchOut(1.5); + } +``` + +### pinchIn9+ + +pinchIn(scale: number): Promise\ + +将控件按指定的比例进行捏合缩小。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ---------------- | +| scale | number | 是 | 指定缩小的比例。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let image = await driver.findComponent(ON.type('image')); + await image.pinchIn(0.5); + } +``` + +## Driver9+ + +Driver类为uitest测试框架的总入口,提供控件匹配/查找,按键注入,坐标点击/滑动,截图等能力。 +该类提供的方法除Driver.create()以外的所有方法都使用Promise方式作为异步方法,需使用await方式调用。 + +### create9+ + +static create(): Driver + +静态方法,构造一个Driver对象,并返回该对象。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| -------- | ---------------------- | +| Driver | 返回构造的Driver对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ------------------ | +| 17000001 | Initialize failed. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); +} +``` + +### delayMs9+ + +delayMs(duration: number): Promise\ + +Driver对象在给定的时间内延时。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ---------------------- | +| duration | number | 是 | 给定的时间,单位:ms。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + await driver.delayMs(1000); +} +``` + +### findComponent9+ + +findComponent(on: On): Promise\ + +在Driver对象中,根据给出的目标控件属性要求查找目标控件。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ---------- | ---- | -------------------- | +| on | [On](#on9) | 是 | 目标控件的属性要求。 | + +**返回值:** + +| 类型 | 说明 | +| ---------------------------------- | --------------------------------- | +| Promise\<[Component](#component9)> | 以Promise形式返回找到的控件对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let button = await driver.findComponent(ON.text('next page')); +} +``` + +### findComponents9+ + +findComponents(on: On): Promise\> + +在Driver对象中,根据给出的目标控件属性要求查找出所有匹配控件,以列表保存。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ---------- | ---- | -------------------- | +| on | [On](#on9) | 是 | 目标控件的属性要求。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------ | --------------------------------------- | +| Promise\> | 以Promise形式返回找到的控件对象的列表。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let buttonList = await driver.findComponents(ON.text('next page')); +} +``` + +### findWindow9+ + +findWindow(filter: WindowFilter): Promise\ + +通过指定窗口的属性来查找目标窗口。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------------------------------ | ---- | ---------------- | +| filter | [WindowFilter](#windowfilter9) | 是 | 目标窗口的属性。 | + +**返回值:** + +| 类型 | 说明 | +| -------------------------------- | ------------------------------------- | +| Promise\<[UiWindow](#uiwindow9)> | 以Promise形式返回找到的目标窗口对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let window = await driver.findWindow({actived: true}); +} +``` + +### waitForComponent9+ + +waitForComponent(on: On, time: number): Promise\ + +在Driver对象中,在用户给定的时间内,持续查找满足控件属性要求的目标控件。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ---------- | ---- | -------------------------------- | +| On | [On](#on9) | 是 | 目标控件的属性要求。 | +| time | number | 是 | 查找目标控件的持续时间。单位ms。 | + +**返回值:** + +| 类型 | 说明 | +| --------------------------------- | --------------------------------- | +| Promise\<[Component](#component)> | 以Promise形式返回找到的控件对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let button = await driver.waitForComponent(ON.text('next page'),500); +} +``` + +### assertComponentExist9+ + +assertComponentExist(on: On): Promise\ + +断言API,用于断言当前界面是否存在满足给出的目标属性的控件。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ---------- | ---- | -------------------- | +| on | [On](#on9) | 是 | 目标控件的属性要求。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000003 | Component existence assertion failed. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + await driver.assertComponentExist(ON.text('next page')); +} +``` + +### pressBack9+ + +pressBack(): Promise\ + +Driver对象进行点击BACK键的操作。 + +**系统能力**:SystemCapability.Test.UiTest + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + await driver.pressBack(); +} +``` + +### triggerKey9+ + +triggerKey(keyCode: number): Promise\ + +Driver对象采取如下操作:传入key值实现模拟点击对应按键的效果。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | ------------- | +| keyCode | number | 是 | 指定的key值。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + await driver.triggerKey(123); +} +``` + +### triggerCombineKeys9+ + +triggerCombineKeys(key0: number, key1: number, key2?: number): Promise\ + +Driver对象通过给定的key值,找到对应组合键并点击。例如,Key值为(2072, 2019)时,Driver对象找到key值对应的组合键并点击,如ctrl+c。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------------------- | +| key0 | number | 是 | 指定的第一个key值。 | +| key1 | number | 是 | 指定的第二个key值。 | +| key2 | number | 否 | 指定的第三个key值。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + await driver.triggerCombineKeys(2072, 2047, 2035); +} +``` + + +### click9+ + +click(x: number, y: number): Promise\ + +Driver对象采取如下操作:在目标坐标点单击。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| x | number | 是 | 以number的形式传入目标点的横坐标信息。 | +| y | number | 是 | 以number的形式传入目标点的纵坐标信息。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + await driver.click(100,100); +} +``` + +### doubleClick9+ + +doubleClick(x: number, y: number): Promise\ + +Driver对象采取如下操作:在目标坐标点双击。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| x | number | 是 | 以number的形式传入目标点的横坐标信息。 | +| y | number | 是 | 以number的形式传入目标点的纵坐标信息。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + await driver.doubleClick(100,100); +} +``` + +### longClick9+ + +longClick(x: number, y: number): Promise\ + +Driver对象采取如下操作:在目标坐标点长按。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| x | number | 是 | 以number的形式传入目标点的横坐标信息。 | +| y | number | 是 | 以number的形式传入目标点的纵坐标信息。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + await driver.longClick(100,100); +} +``` + +### swipe9+ + +swipe(startx: number, starty: number, endx: number, endy: number, speed?: number): Promise\ + +Driver对象采取如下操作:从起始坐标点滑向目的坐标点。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------------------------------------------------------------ | +| startx | number | 是 | 以number的形式传入起始点的横坐标信息。 | +| starty | number | 是 | 以number的形式传入起始点的纵坐标信息。 | +| endx | number | 是 | 以number的形式传入目的点的横坐标信息。 | +| endy | number | 是 | 以number的形式传入目的点的纵坐标信息。 | +| speed | number | 否 | 滑动速率,范围:200-15000,不在范围内设为默认值为600,单位:像素点/秒。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + await driver.swipe(100,100,200,200,600); +} +``` + +### drag9+ + +drag(startx: number, starty: number, endx: number, endy: number, speed?: number): Promise\ + +Driver对象采取如下操作:从起始坐标点拖拽至目的坐标点。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ------------------------------------------------------------ | +| startx | number | 是 | 以number的形式传入起始点的横坐标信息。 | +| starty | number | 是 | 以number的形式传入起始点的纵坐标信息。 | +| endx | number | 是 | 以number的形式传入目的点的横坐标信息。 | +| endy | number | 是 | 以number的形式传入目的点的纵坐标信息。 | +| speed | number | 否 | 滑动速率,范围:200-15000,不在范围内设为默认值为600,单位:像素点/秒。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + await driver.drag(100,100,200,200,600); +} +``` + +### screenCap9+ + +screenCap(savePath: string): Promise\ + +Driver对象采取如下操作:捕获当前屏幕,并保存为PNG格式的图片至给出的保存路径中。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | -------------- | +| savePath | string | 是 | 文件保存路径。 | + +**返回值:** + +| 类型 | 说明 | +| ----------------- | -------------------------------------- | +| Promise\ | 截图操作是否成功完成。成功完成为true。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + await driver.screenCap('/data/storage/el2/base/cache/1.png'); +} +``` + +### setDisplayRotation9+ + +setDisplayRotation(rotation: DisplayRotation): Promise\ + +将设备的屏幕显示方向设置为指定的显示方向。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------------------ | ---- | ---------------- | +| rotation | [DisplayRotation](#displayrotation9) | 是 | 设备的显示方向。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + await driver.setDisplayRotation(DisplayRotation.ROTATION_180); +} +``` + +### getDisplayRotation9+ + +getDisplayRotation(): Promise\ + +获取当前设备的屏幕显示方向。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| ---------------------------------------------- | --------------------------------------- | +| Promise\<[DisplayRotation](#displayrotation9)> | 以Promise的形式返回当前设备的显示方向。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let rotation = await driver.getDisplayRotation(); +} +``` + +### setDisplayRotationEnabled9+ + +setDisplayRotationEnabled(enabled: boolean): Promise\ + +启用/禁用设备旋转屏幕的功能。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------- | ---- | ------------------------------------------------------- | +| enabled | boolean | 是 | 能否旋转屏幕的标识,true:可以旋转,false:不可以旋转。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + await driver.setDisplayRotationEnabled(false); +} +``` + +### getDisplaySize9+ + +getDisplaySize(): Promise\ + +获取当前设备的屏幕大小。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| -------------------------- | --------------------------------------- | +| Promise\<[Point](#point9)> | 以Promise的形式返回当前设备的屏幕大小。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let size = await driver.getDisplaySize(); +} +``` + +### getDisplayDensity9+ + +getDisplayDensity(): Promise\ + +获取当前设备屏幕的分辨率。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| -------------------------- | ----------------------------------------- | +| Promise\<[Point](#point9)> | 以Promise的形式返回当前设备屏幕的分辨率。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let density = await driver.getDisplayDensity(); +} +``` + +### wakeUpDisplay9+ + +wakeUpDisplay(): Promise\ + +唤醒当前设备即设备亮屏。 + +**系统能力**:SystemCapability.Test.UiTest + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + await driver.wakeUpDisplay(); +} +``` + +### pressHome9+ + +pressHome(): Promise\ + +设备返回到桌面。 + +**系统能力**:SystemCapability.Test.UiTest + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + await driver.pressHome(); +} +``` + +### waitForIdle9+ + +waitForIdle(idleTime: number, timeout: number): Promise\ + +判断当前界面的所有控件是否已经空闲。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ------------------------------------------------------------ | +| idleTime | number | 是 | 空闲时间的阈值。在这个时间段控件不发生变化,视为该控件空闲,单位:毫秒。 | +| timeout | number | 是 | 等待空闲的最大时间,单位:毫秒。 | + +**返回值:** + +| 类型 | 说明 | +| ----------------- | --------------------------------------------------- | +| Promise\ | 以Promise的形式返回当前界面的所有控件是否已经空闲。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let idled = await driver.waitForIdle(4000,5000); +} +``` + +### fling9+ + +fling(from: Point, to: Point, stepLen: number, speed: number): Promise\ + +模拟手指滑动后脱离屏幕的快速滑动操作。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ---------------- | ---- | ------------------------------------------------------------ | +| from | [Point](#point9) | 是 | 手指接触屏幕的起始点坐标。 | +| to | [Point](#point9) | 是 | 手指离开屏幕时的坐标点。 | +| stepLen | number | 是 | 间隔距离,单位:像素点。 | +| speed | number | 是 | 滑动速率,范围:200-40000,不在范围内设为默认值为600,单位:像素点/秒。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + await driver.fling({x: 500, y: 480},{x: 450, y: 480},5,600); +} +``` + +### injectMultiPointerAction9+ + +injectMultiPointerAction(pointers: PointerMatrix, speed?: number): Promise\ + +向设备注入多指操作。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------------------- | ---- | ------------------------------------------------------------ | +| pointers | [PointerMatrix](#pointermatrix9) | 是 | 滑动轨迹,包括操作手指个数和滑动坐标序列。 | +| speed | number | 否 | 滑动速率,范围:200-15000,不在范围内设为默认值为600,单位:像素点/秒。 | + +**返回值:** + +| 类型 | 说明 | +| ----------------- | ------------------------------------- | +| Promise\ | 以Promise的形式返回操作是否成功完成。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let pointers = PointerMatrix.create(2,3); + pointers.setPoint(0,0,{x:230,y:480}); + pointers.setPoint(0,1,{x:250,y:380}); + pointers.setPoint(0,2,{x:270,y:280}); + pointers.setPoint(1,0,{x:230,y:680}); + pointers.setPoint(1,1,{x:240,y:580}); + pointers.setPoint(1,2,{x:250,y:480}); + await driver.injectMultiPointerAction(pointers); +} +``` + +### fling10+ + +fling(direction: UiDirection, speed: number): Promise; + +指定方向和速度,模拟手指滑动后脱离屏幕的快速滑动操作。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ----------------------------- | ---- | ------------------------------------------------------------ | +| direction | [UiDirection](#uidirection10) | 是 | 进行抛滑的方向。 | +| speed | number | 是 | 滑动速率,范围:200-40000,不在范围内设为默认值为600,单位:像素点/秒。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + await driver.fling(UiDirection.DOWN, 10000); +} +``` + +### screenCapture10+ + +screenCapture(savePath: string, rect?: Rect): Promise; + +捕获当前屏幕的指定区域,并保存为PNG格式的图片至给出的保存路径中。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------- | ---- | ---------------------- | +| savePath | string | 是 | 文件保存路径。 | +| rect | [Rect](#rect9) | 否 | 截图区域,默认为全屏。 | + +**返回值:** + +| 类型 | 说明 | +| ----------------- | -------------------------------------- | +| Promise\ | 截图操作是否成功完成。成功完成为true。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + await driver.screenCapture('/data/storage/el2/base/cache/1.png', {left: 0, top: 0, right: 100, bottom: 100}); +} +``` + +### mouseClick10+ + +mouseClick(p: Point, btnId: MouseButton, key1?: number, key2?: number): Promise; + +在指定坐标点注入鼠标点击动作,支持同时按下对应键盘组合键。例如,Key值为2072时,按下ctrl并进行鼠标点击动作。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ----------------------------- | ---- | ------------------- | +| p | [Point](#point9) | 是 | 鼠标点击的坐标。 | +| btnId | [MouseButton](#mousebutton10) | 是 | 按下的鼠标按钮。 | +| key1 | number | 是 | 指定的第一个key值。 | +| key2 | number | 否 | 指定的第二个key值。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + await driver.mouseClick({x:248, y:194}, MouseButton.MOUSE_BUTTON_LEFT, 2072); +} +``` + +### mouseScroll10+ + +mouseScroll(p: Point, down: boolean, d: number, key1?: number, key2?: number): Promise; + +在指定坐标点注入鼠标滚轮滑动动作,支持同时按下对应键盘组合键。例如,Key值为2072时,按下ctrl并进行鼠标滚轮滑动动作。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ---------------- | ---- | --------------------------------------------------- | +| p | [Point](#point9) | 是 | 鼠标点击的坐标。 | +| down | boolean | 是 | 滚轮滑动方向是否向下。 | +| d | number | 是 | 鼠标滚轮滚动的格数,每格对应目标点位移120个像素点。 | +| key1 | number | 是 | 指定的第一个key值。 | +| key2 | number | 否 | 指定的第二个key值。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + await driver.mouseScroll({x:360, y:640}, true, 30, 2072) +} +``` + +### mouseMoveTo10+ + +mouseMoveTo(p: Point): Promise; + +将鼠标光标移到目标点。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ---------------- | ---- | -------------- | +| p | [Point](#point9) | 是 | 目标点的坐标。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + await driver.mouseMoveTo({x:100, y:100}) +} +``` + +## PointerMatrix9+ + +存储多指操作中每根手指每一步动作的坐标点及其行为的二维数组。 + +### create9+ + +static create(fingers: number, steps: number): PointerMatrix + +静态方法,构造一个PointerMatrix对象,并返回该对象。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | ------------------------------------------ | +| fingers | number | 是 | 多指操作中注入的手指数,取值范围:[1,10]。 | +| steps | number | 是 | 每根手指操作的步骤数,取值范围:[1,1000]。 | + +**返回值:** + +| 类型 | 说明 | +| -------------------------------- | ----------------------------- | +| [PointerMatrix](#pointermatrix9) | 返回构造的PointerMatrix对象。 | + +**示例:** + +```js +async function demo() { + let pointerMatrix = PointerMatrix.create(2,3); +} +``` + +### setPoint9+ + +setPoint(finger: number, step: number, point: Point): void + +设置PointerMatrix对象中指定手指和步骤对应动作的坐标点。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ---------------- | ---- | ---------------- | +| finger | number | 是 | 手指的序号。 | +| step | number | 是 | 步骤的序号。 | +| point | [Point](#point9) | 是 | 该行为的坐标点。 | + +**示例:** + +```js +async function demo() { + let pointers = PointerMatrix.create(2,3); + pointers.setPoint(0,0,{x:230,y:480}); + pointers.setPoint(0,1,{x:250,y:380}); + pointers.setPoint(0,2,{x:270,y:280}); + pointers.setPoint(1,0,{x:230,y:680}); + pointers.setPoint(1,1,{x:240,y:580}); + pointers.setPoint(1,2,{x:250,y:480}); +} +``` + +## UiWindow9+ + +UiWindow代表了UI界面上的一个窗口,提供窗口属性获取,窗口拖动、调整窗口大小等能力。 +该类提供的所有方法都使用Promise方式作为异步方法,需使用await方式调用。 + +### getBundleName9+ + +getBundleName(): Promise\ + +获取窗口归属应用的包名信息。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ----------------------------------------- | +| Promise\ | 以Promise形式返回窗口归属应用的包名信息。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let window = await driver.findWindow({actived: true}); + let name = await window.getBundleName(); +} +``` + +### getBounds9+ + +getBounds(): Promise\ + +获取窗口的边框信息。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| ------------------------ | --------------------------------- | +| Promise\<[Rect](#rect9)> | 以Promise形式返回窗口的边框信息。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let window = await driver.findWindow({actived: true}); + let rect = await window.getBounds(); +} +``` + +### getTitle9+ + +getTitle(): Promise\ + +获取窗口的标题信息。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| ---------------- | --------------------------------- | +| Promise\ | 以Promise形式返回窗口的标题信息。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let window = await driver.findWindow({actived: true}); + let rect = await window.getTitle(); +} +``` + +### getWindowMode9+ + +getWindowMode(): Promise\ + +获取窗口的窗口模式信息。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------ | ------------------------------------- | +| Promise\<[WindowMode](#windowmode9)> | 以Promise形式返回窗口的窗口模式信息。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let window = await driver.findWindow({actived: true}); + let mode = await window.getWindowMode(); +} +``` + +### isFocused9+ + +isFocused(): Promise\ + +判断窗口是否处于获焦状态。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| ----------------- | ------------------------------------------------------------ | +| Promise\ | 以Promise形式返回窗口对象是否获取获焦状态,true:获焦,false:未获焦。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let window = await driver.findWindow({actived: true}); + let focused = await window.isFocused(); +} +``` + +### isActived9+ + +isActived(): Promise\ + +判断窗口是否为用户正在交互窗口。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| ----------------- | ------------------------------------------------------------ | +| Promise\ | 以Promise形式返回窗口对象是否为用户正在交互窗口,true:交互窗口,false:非交互窗口。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let window = await driver.findWindow({actived: true}); + let focused = await window.isActived(); +} +``` + +### focus9+ + +focus(): Promise\ + +让窗口获焦。 + +**系统能力**:SystemCapability.Test.UiTest + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let window = await driver.findWindow({actived: true}); + await window.focus(); +} +``` + +### moveTo9+ + +moveTo(x: number, y: number): Promise\ + +将窗口移动到目标点。适用于支持移动的窗口。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| x | number | 是 | 以number的形式传入目标点的横坐标信息。 | +| y | number | 是 | 以number的形式传入目标点的纵坐标信息。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | +| 17000005 | This operation is not supported. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let window = await driver.findWindow({actived: true}); + await window.moveTo(100, 100); +} +``` + +### resize9+ + +resize(wide: number, height: number, direction: ResizeDirection): Promise\ + +根据传入的宽、高和调整方向来调整窗口的大小。适用于支持调整大小的窗口。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| --------- | ------------------------------------ | ---- | ------------------------------------------------------------ | +| wide | number | 是 | 以number的形式传入调整后窗口的宽度。 | +| height | number | 是 | 以number的形式传入调整后窗口的高度。 | +| direction | [ResizeDirection](#resizedirection9) | 是 | 以[ResizeDirection](#resizedirection9)的形式传入窗口调整的方向。 | + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | +| 17000005 | This operation is not supported. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let window = await driver.findWindow({actived: true}); + await window.resize(100, 100, ResizeDirection.LEFT); +} +``` + +### split9+ + +split(): Promise\ + +将窗口模式切换成分屏模式。适用于支持切换分屏模式的窗口。 + +**系统能力**:SystemCapability.Test.UiTest + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | +| 17000005 | This operation is not supported. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let window = await driver.findWindow({actived: true}); + await window.split(); +} +``` + +### maximize9+ + +maximize(): Promise\ + +将窗口最大化。适用于支持窗口最大化操作的窗口。 + +**系统能力**:SystemCapability.Test.UiTest + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | +| 17000005 | This operation is not supported. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let window = await driver.findWindow({actived: true}); + await window.maximize(); +} +``` + +### minimize9+ + +minimize(): Promise\ + +将窗口最小化。适用于支持窗口最小化操作的窗口。 + +**系统能力**:SystemCapability.Test.UiTest + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | +| 17000005 | This operation is not supported. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let window = await driver.findWindow({actived: true}); + await window.minimize(); +} +``` + +### resume9+ + +resume(): Promise\ + +将窗口恢复到之前的窗口模式。 + +**系统能力**:SystemCapability.Test.UiTest + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | +| 17000005 | This operation is not supported. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let window = await driver.findWindow({actived: true}); + await window.resume(); +} +``` + +### close9+ + +close(): Promise\ + +将窗口关闭。 + +**系统能力**:SystemCapability.Test.UiTest + +**错误码:** + +以下错误码的详细介绍请参见[uitest测试框架错误码](../errorcodes/errorcode-uitest.md)。 + +| 错误码ID | 错误信息 | +| -------- | ---------------------------------------- | +| 17000002 | API does not allow calling concurrently. | +| 17000004 | Component lost/UiWindow lost. | +| 17000005 | This operation is not supported. | + +**示例:** + +```js +async function demo() { + let driver = Driver.create(); + let window = await driver.findWindow({actived: true}); + await window.close(); +} +``` + +## By(deprecated) + +UiTest框架通过By类提供了丰富的控件特征描述API,用于进行控件筛选来匹配/查找出目标控件。
+By提供的API能力具有以下几个特点:
1、支持单属性匹配和多属性组合匹配,例如同时指定目标控件text和id。
2、控件属性支持多种匹配模式。
3、支持控件绝对定位,相对定位,可通过[By.isBefore(deprecated)](#isbeforedeprecated)和[By.isAfter(deprecated)](#isafterdeprecated)等API限定邻近控件特征进行辅助定位。
By类提供的所有API均为同步接口,建议使用者通过静态构造器BY来链式创建By对象。 + +从API version 9开始不再维护,建议使用[On9+](#on9)。 + +```js +BY.text('123').type('button'); +``` + +### text(deprecated) + +text(txt: string, pattern?: MatchPattern): By + +指定目标控件文本属性,支持多种匹配模式,返回By对象自身。 + +从API version 9开始不再维护,建议使用[text9+](#text9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ----------------------------- | ---- | --------------------------------------------------- | +| txt | string | 是 | 指定控件文本,用于匹配目标控件文本。 | +| pattern | [MatchPattern](#matchpattern) | 否 | 指定的文本匹配模式,默认为[EQUALS](#matchpattern)。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ---------------------------------- | +| [By](#bydeprecated) | 返回指定目标控件文本属性的By对象。 | + +**示例:** + +```js +let by = BY.text('123'); // 使用静态构造器BY创建by对象,指定目标控件的text属性。 +``` + + +### key(deprecated) + +key(key: string): By + +指定目标控件key值属性,返回By对象自身。 + +从API version 9开始不再维护,建议使用[id9+](#id9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ----------------- | +| key | string | 是 | 指定控件的Key值。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ----------------------------------- | +| [By](#bydeprecated) | 返回指定目标控件key值属性的By对象。 | + +**示例:** + +```js +let by = BY.key('123'); // 使用静态构造器BY创建by对象,指定目标控件的key值属性。 +``` + + +### id(deprecated) + +id(id: number): By + +指定目标控件id属性,返回By对象自身。 + +从API version 9开始废弃。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ---------------- | +| id | number | 是 | 指定控件的id值。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | -------------------------------- | +| [By](#bydeprecated) | 返回指定目标控件id属性的By对象。 | + +**示例:** + +```js +let by = BY.id(123); // 使用静态构造器BY创建by对象,指定目标控件的id属性。 +``` + + +### type(deprecated) + +type(tp: string): By + +指定目标控件的控件类型属性,返回By对象自身。 + +从API version 9开始不再维护,建议使用[type9+](#type9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------- | +| tp | string | 是 | 指定控件类型。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ---------------------------------------- | +| [By](#bydeprecated) | 返回指定目标控件的控件类型属性的By对象。 | + +**示例:** + +```js +let by = BY.type('button'); // 使用静态构造器BY创建by对象,指定目标控件的控件类型属性。 +``` + + +### clickable(deprecated) + +clickable(b?: boolean): By + +指定目标控件的可点击状态属性,返回By对象自身。 + +从API version 9开始不再维护,建议使用[clickable9+](#clickable9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------- | ---- | ------------------------------------------------------------ | +| b | boolean | 否 | 指定控件可点击状态,true:可点击,false:不可点击。默认为true。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ------------------------------------------ | +| [By](#bydeprecated) | 返回指定目标控件的可点击状态属性的By对象。 | + +**示例:** + +```js +let by = BY.clickable(true); // 使用静态构造器BY创建by对象,指定目标控件的可点击状态属性。 +``` + + +### scrollable(deprecated) + +scrollable(b?: boolean): By + +指定目标控件的可滑动状态属性,返回By对象自身。 + +从API version 9开始不再维护,建议使用[scrollable9+](#scrollable9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------- | ---- | ----------------------------------------------------------- | +| b | boolean | 否 | 控件可滑动状态,true:可滑动,false:不可滑动。默认为true。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ------------------------------------------ | +| [By](#bydeprecated) | 返回指定目标控件的可滑动状态属性的By对象。 | + +**示例:** + +```js +let by = BY.scrollable(true); // 使用静态构造器BY创建by对象,指定目标控件的可滑动状态属性。 +``` + +### enabled(deprecated) + +enabled(b?: boolean): By + +指定目标控件的使能状态属性,返回By对象自身。 + +从API version 9开始不再维护,建议使用[enabled9+](#enabled9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------- | ---- | --------------------------------------------------------- | +| b | boolean | 否 | 指定控件使能状态,true:使能,false:未使能。默认为true。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ---------------------------------------- | +| [By](#bydeprecated) | 返回指定目标控件的使能状态属性的By对象。 | + +**示例:** + +```js +let by = BY.enabled(true); // 使用静态构造器BY创建by对象,指定目标控件的使能状态属性。 +``` + +### focused(deprecated) + +focused(b?: boolean): By + +指定目标控件的获焦状态属性,返回By对象自身。 + +从API version 9开始不再维护,建议使用[focused9+](#focused9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------- | ---- | ----------------------------------------------------- | +| b | boolean | 否 | 控件获焦状态,true:获焦,false:未获焦。默认为true。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ---------------------------------------- | +| [By](#bydeprecated) | 返回指定目标控件的获焦状态属性的By对象。 | + +**示例:** + +```js +let by = BY.focused(true); // 使用静态构造器BY创建by对象,指定目标控件的获焦状态属性。 +``` + +### selected(deprecated) + +selected(b?: boolean): By + +指定目标控件的被选中状态属性,返回By对象自身。 + +从API version 9开始不再维护,建议使用[selected9+](#selected9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------- | ---- | ------------------------------------------------------------ | +| b | boolean | 否 | 指定控件被选中状态,true:被选中,false:未被选中。默认为true。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ------------------------------------------ | +| [By](#bydeprecated) | 返回指定目标控件的被选中状态属性的By对象。 | + +**示例:** + +```js +let by = BY.selected(true); // 使用静态构造器BY创建by对象,指定目标控件的被选中状态属性。 +``` + +### isBefore(deprecated) + +isBefore(by: By): By + +指定目标控件位于给出的特征属性控件之前,返回By对象自身。 + +从API version 9开始不再维护,建议使用[isBefore9+](#isbefore9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------------------- | ---- | ---------------- | +| by | [By](#bydeprecated) | 是 | 特征控件的属性。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ---------------------------------------------------- | +| [By](#bydeprecated) | 返回指定目标控件位于给出的特征属性控件之前的By对象。 | + +**示例:** + +```js +let by = BY.isBefore(BY.text('123')); // 使用静态构造器BY创建by对象,指定目标控件位于给出的特征属性控件之前。 +``` + +### isAfter(deprecated) + +isAfter(by: By): By + +指定目标控件位于给出的特征属性控件之后,返回By对象自身。 + +从API version 9开始不再维护,建议使用[isAfter9+](#isafter9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------------------- | ---- | ---------------- | +| by | [By](#bydeprecated) | 是 | 特征控件的属性。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ---------------------------------------------------- | +| [By](#bydeprecated) | 返回指定目标控件位于给出的特征属性控件之后的By对象。 | + +**示例:** + +```js +let by = BY.isAfter(BY.text('123')); // 使用静态构造器BY创建by对象,指定目标控件位于给出的特征属性控件之后。 +``` + +## UiComponent(deprecated) + +UiTest中,UiComponent类代表了UI界面上的一个控件,提供控件属性获取,控件点击,滑动查找,文本注入等API。 +该类提供的所有方法都使用Promise方式作为异步方法,需使用await调用。 + +从API version 9开始不再维护,建议使用[Component9+](#component9)。 + +### click(deprecated) + +click(): Promise\ + +控件对象进行点击操作。 + +从API version 9开始不再维护,建议使用[click9+](#click9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**示例:** + +```js +async function demo() { + let driver = UiDriver.create(); + let button = await driver.findComponent(BY.type('button')); + await button.click(); +} +``` + +### doubleClick(deprecated) + +doubleClick(): Promise\ + +控件对象进行双击操作。 + +从API version 9开始不再维护,建议使用[doubleClick9+](#doubleclick9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**示例:** + +```js +async function demo() { + let driver = UiDriver.create(); + let button = await driver.findComponent(BY.type('button')); + await button.doubleClick(); +} +``` + +### longClick(deprecated) + +longClick(): Promise\ + +控件对象进行长按操作。 + +从API version 9开始不再维护,建议使用[longClick9+](#longclick9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**示例:** + +```js +async function demo() { + let driver = UiDriver.create(); + let button = await driver.findComponent(BY.type('button')); + await button.longClick(); +} +``` + +### getId(deprecated) + +getId(): Promise\ + +获取控件对象的id值。 + +从API version 9开始不再维护,被废弃。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ------------------------------- | +| Promise\ | 以Promise形式返回的控件的id值。 | + +**示例:** + +```js +async function demo() { + let driver = UiDriver.create(); + let button = await driver.findComponent(BY.type('button')); + let num = await button.getId(); +} +``` + +### getKey(deprecated) + +getKey(): Promise\ + +获取控件对象的key值。 + +从API version 9开始不再维护,建议使用[getId9+](#getid9) + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ------------------------------ | +| Promise\ | 以Promise形式返回控件的key值。 | + +**示例:** + +```js +async function demo() { + let driver = UiDriver.create(); + let button = await driver.findComponent(BY.type('button')); + let str_key = await button.getKey(); +} +``` + +### getText(deprecated) + +getText(): Promise\ + +获取控件对象的文本信息。 + +从API version 9开始不再维护,建议使用[getText9+](#gettext9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| ---------------- | --------------------------------- | +| Promise\ | 以Promise形式返回控件的文本信息。 | + +**示例:** + +```js +async function demo() { + let driver = UiDriver.create(); + let button = await driver.findComponent(BY.type('button')); + let text = await button.getText(); +} +``` + +### getType(deprecated) + +getType(): Promise\ + +获取控件对象的控件类型。 + +从API version 9开始不再维护,建议使用[getType9+](#gettype9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| ---------------- | ----------------------------- | +| Promise\ | 以Promise形式返回控件的类型。 | + +**示例:** + +```js +async function demo() { + let driver = UiDriver.create(); + let button = await driver.findComponent(BY.type('button')); + let type = await button.getType(); +} +``` + +### isClickable(deprecated) + +isClickable(): Promise\ + +获取控件对象可点击状态。 + +从API version 9开始不再维护,建议使用[isClickable9+](#isclickable9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| ----------------- | ------------------------------------------------------------ | +| Promise\ | 以Promise形式返回控件对象可点击状态,true:可点击,false:不可点击。 | + +**示例:** + +```js +async function demo() { + let driver = UiDriver.create(); + let button = await driver.findComponent(BY.type('button')); + if(await button.isClickable()) { + console.info('This button can be Clicked'); + } else { + console.info('This button can not be Clicked'); + } +} +``` + +### isScrollable(deprecated) + +isScrollable(): Promise\ + +获取控件对象可滑动状态。 + +从API version 9开始不再维护,建议使用[isScrollable9+](#isscrollable9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| ----------------- | ------------------------------------------------------------ | +| Promise\ | 以Promise形式返回控件对象可滑动状态,true:可滑动,false:不可滑动。 | + +**示例:** + +```js +async function demo() { + let driver = UiDriver.create(); + let scrollBar = await driver.findComponent(BY.scrollable(true)); + if(await scrollBar.isScrollable()) { + console.info('This scrollBar can be operated'); + } else { + console.info('This scrollBar can not be operated'); + } +} +``` + + +### isEnabled(deprecated) + +isEnabled(): Promise\ + +获取控件使能状态。 + +从API version 9开始不再维护,建议使用[isEnabled9+](#isenabled9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| ----------------- | ---------------------------------------------------------- | +| Promise\ | 以Promise形式返回控件使能状态,true:使能,false:未使能。 | + +**示例:** + +```js +async function demo() { + let driver = UiDriver.create(); + let button = await driver.findComponent(BY.type('button')); + if(await button.isEnabled()) { + console.info('This button can be operated'); + } else { + console.info('This button can not be operated'); + } +} + +``` + +### isFocused(deprecated) + +isFocused(): Promise\ + +判断控件对象是否获焦。 + +从API version 9开始不再维护,建议使用[isFocused9+](#isfocused9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| ----------------- | ------------------------------------------------------------ | +| Promise\ | 以Promise形式返回控件对象是否获焦,true:获焦,false:未获焦。 | + +**示例:** + +```js +async function demo() { + let driver = UiDriver.create(); + let button = await driver.findComponent(BY.type('button')); + if(await button.isFocused()) { + console.info('This button is focused'); + } else { + console.info('This button is not focused'); + } +} +``` + +### isSelected(deprecated) + +isSelected(): Promise\ + +获取控件对象被选中状态。 + +从API version 9开始不再维护,建议使用[isSelected9+](#isselected9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| ----------------- | ----------------------------------------------------- | +| Promise\ | 控件对象被选中的状态,true:被选中,false:未被选中。 | + +**示例:** + +```js +async function demo() { + let driver = UiDriver.create(); + let button = await driver.findComponent(BY.type('button')); + if(await button.isSelected()) { + console.info('This button is selected'); + } else { + console.info('This button is not selected'); + } +} +``` + +### inputText(deprecated) + +inputText(text: string): Promise\ + +向控件中输入文本(适用于文本框控件)。 + +从API version 9开始不再维护,建议使用[inputText9+](#inputtext9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ---------------- | +| text | string | 是 | 输入的文本信息。 | + +**示例:** + +```js +async function demo() { + let driver = UiDriver.create(); + let text = await driver.findComponent(BY.text('hello world')); + await text.inputText('123'); +} +``` + +### scrollSearch(deprecated) + +scrollSearch(by: By): Promise\ + +在控件上滑动查找目标控件(适用于List等支持滑动的控件)。 + +从API version 9开始不再维护,建议使用[scrollSearch9+](#scrollsearch9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------------------- | ---- | -------------------- | +| by | [By](#bydeprecated) | 是 | 目标控件的属性要求。 | + +**返回值:** + +| 类型 | 说明 | +| ----------------------------------------------- | ------------------------------------- | +| Promise\<[UiComponent](#uicomponentdeprecated)> | 以Promise形式返回找到的目标控件对象。 | + +**示例:** + +```js +async function demo() { + let driver = UiDriver.create(); + let scrollBar = await driver.findComponent(BY.type('Scroll')); + let button = await scrollBar.scrollSearch(BY.text('next page')); +} +``` + +## UiDriver(deprecated) + +UiDriver类为uitest测试框架的总入口,提供控件匹配/查找,按键注入,坐标点击/滑动,截图等API。 +该类提供的方法除UiDriver.create()以外的所有方法都使用Promise方式作为异步方法,需使用await调用。 + +从API version 9开始不再维护,建议使用[Driver9+](#driver9)。 + +### create(deprecated) + +static create(): UiDriver + +静态方法,构造一个UiDriver对象,并返回该对象。 + +从API version 9开始不再维护,建议使用[create9+](#create9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**返回值:** + +| 类型 | 说明 | +| -------- | ------------------------ | +| UiDriver | 返回构造的UiDriver对象。 | + +**示例:** + +```js +async function demo() { + let driver = UiDriver.create(); +} +``` + +### delayMs(deprecated) + +delayMs(duration: number): Promise\ + +UiDriver对象在给定的时间内延时。 + +从API version 9开始不再维护,建议使用[delayMs9+](#delayms9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | ------------ | +| duration | number | 是 | 给定的时间。 | + +**示例:** + +```js +async function demo() { + let driver = UiDriver.create(); + await driver.delayMs(1000); +} +``` + +### findComponent(deprecated) + +findComponent(by: By): Promise\ + +在UiDriver对象中,根据给出的目标控件属性要求查找目标控件。 + +从API version 9开始不再维护,建议使用[findComponent9+](#findcomponent9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------------------- | ---- | -------------------- | +| by | [By](#bydeprecated) | 是 | 目标控件的属性要求。 | + +**返回值:** + +| 类型 | 说明 | +| ----------------------------------------------- | --------------------------------- | +| Promise\<[UiComponent](#uicomponentdeprecated)> | 以Promise形式返回找到的控件对象。 | + +**示例:** + +```js +async function demo() { + let driver = UiDriver.create(); + let button = await driver.findComponent(BY.text('next page')); +} +``` + +### findComponents(deprecated) + +findComponents(by: By): Promise\> + +在UiDriver对象中,根据给出的目标控件属性要求查找出所有匹配控件,以列表保存。 + +从API version 9开始不再维护,建议使用[findComponents9+](#findcomponents9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------------------- | ---- | -------------------- | +| by | [By](#bydeprecated) | 是 | 目标控件的属性要求。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------------------------------------------- | --------------------------------------- | +| Promise\> | 以Promise形式返回找到的控件对象的列表。 | + +**示例:** + +```js +async function demo() { + let driver = UiDriver.create(); + let buttonList = await driver.findComponents(BY.text('next page')); +} +``` + +### assertComponentExist(deprecated) + +assertComponentExist(by: By): Promise\ + +断言API,用于断言当前界面存在满足给出的目标控件属性的控件; 如果控件不存在,该API将抛出JS异常,使当前测试用例失败。 + +从API version 9开始不再维护,建议使用[assertComponentExist9+](#assertcomponentexist9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------------------- | ---- | -------------------- | +| by | [By](#bydeprecated) | 是 | 目标控件的属性要求。 | + +**示例:** + +```js +async function demo() { + let driver = UiDriver.create(); + await driver.assertComponentExist(BY.text('next page')); +} +``` + +### pressBack(deprecated) + +pressBack(): Promise\ + +UiDriver对象进行点击BACK键的操作。 + +从API version 9开始不再维护,建议使用[pressBack9+](#pressback9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**示例:** + +```js +async function demo() { + let driver = UiDriver.create(); + await driver.pressBack(); +} +``` + +### triggerKey(deprecated) + +triggerKey(keyCode: number): Promise\ + +UiDriver对象采取如下操作:通过key值找到对应键并点击。 + +从API version 9开始不再维护,建议使用[triggerKey9+](#triggerkey9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | ------------- | +| keyCode | number | 是 | 指定的key值。 | + +**示例:** + +```js +async function demo() { + let driver = UiDriver.create(); + await driver.triggerKey(123); +} +``` + + +### click(deprecated) + +click(x: number, y: number): Promise\ + +UiDriver对象采取如下操作:在目标坐标点单击。 + +从API version 9开始不再维护,建议使用[click9+](#click9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| x | number | 是 | 以number的形式传入目标点的横坐标信息。 | +| y | number | 是 | 以number的形式传入目标点的纵坐标信息。 | + +**示例:** + +```js +async function demo() { + let driver = UiDriver.create(); + await driver.click(100,100); +} +``` + +### doubleClick(deprecated) + +doubleClick(x: number, y: number): Promise\ + +UiDriver对象采取如下操作:在目标坐标点双击。 + +从API version 9开始不再维护,建议使用[doubleClick9+](#doubleclick9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| x | number | 是 | 以number的形式传入目标点的横坐标信息。 | +| y | number | 是 | 以number的形式传入目标点的纵坐标信息。 | + +**示例:** + +```js +async function demo() { + let driver = UiDriver.create(); + await driver.doubleClick(100,100); +} +``` + +### longClick(deprecated) + +longClick(x: number, y: number): Promise\ + +UiDriver对象采取如下操作:在目标坐标点长按下鼠标左键。 + +从API version 9开始不再维护,建议使用[longClick9+](#longclick9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| x | number | 是 | 以number的形式传入目标点的横坐标信息。 | +| y | number | 是 | 以number的形式传入目标点的纵坐标信息。 | + +**示例:** + +```js +async function demo() { + let driver = UiDriver.create(); + await driver.longClick(100,100); +} +``` + +### swipe(deprecated) + +swipe(startx: number, starty: number, endx: number, endy: number): Promise\ + +UiDriver对象采取如下操作:从给出的起始坐标点滑向给出的目的坐标点。 + +从API version 9开始不再维护,建议使用[swipe9+](#swipe9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------------------------- | +| startx | number | 是 | 以number的形式传入起始点的横坐标信息。 | +| starty | number | 是 | 以number的形式传入起始点的纵坐标信息。 | +| endx | number | 是 | 以number的形式传入目的点的横坐标信息。 | +| endy | number | 是 | 以number的形式传入目的点的纵坐标信息。 | + +**示例:** + +```js +async function demo() { + let driver = UiDriver.create(); + await driver.swipe(100,100,200,200); +} +``` + +### screenCap(deprecated) + +screenCap(savePath: string): Promise\ + +UiDriver对象采取如下操作:捕获当前屏幕,并保存为PNG格式的图片至给出的保存路径中。 + +从API version 9开始不再维护,建议使用[screenCap9+](#screencap9)。 + +**系统能力**:SystemCapability.Test.UiTest + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------ | ---- | -------------- | +| savePath | string | 是 | 文件保存路径。 | + +**返回值:** + +| 类型 | 说明 | +| ----------------- | -------------------------------------- | +| Promise\ | 截图操作是否成功完成。成功完成为true。 | + +**示例:** + +```js +async function demo() { + let driver = UiDriver.create(); + await driver.screenCap('/data/storage/el2/base/cache/1.png'); +} +``` 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 144bb69c2bbef40ef5605b4ab7883475b3eb8970..e2aa8974228692c77c455a1276bfa002f3b8b61c 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-update.md +++ b/zh-cn/application-dev/reference/apis/js-apis-update.md @@ -2036,7 +2036,7 @@ localUpdater.off(eventClassifyInfo, onTaskUpdate); | WAITING_INSTALL | 30 | 待安装。 | | UPDATING | 31 | 更新中。 | | WAITING_APPLY | 40 | 待生效。 | -| APPLYING | 21 | 生效中。 | +| APPLYING | 41 | 生效中。 | | UPGRADE_SUCCESS | 50 | 升级成功。 | | UPGRADE_FAIL | 51 | 升级失败。 | @@ -2058,7 +2058,7 @@ localUpdater.off(eventClassifyInfo, onTaskUpdate); | 名称 | 值 | 说明 | | ---------------------- | ---------- | ------ | -| EVENT_TASK_BASE | 0x01000000 | 任务事件。 | +| EVENT_TASK_BASE | EventClassify.TASK | 任务事件。 | | EVENT_TASK_RECEIVE | 0x01000001 | 收到任务。 | | EVENT_TASK_CANCEL | 0x01000010 | 取消任务。 | | EVENT_DOWNLOAD_WAIT | 0x01000011 | 待下载。 | 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 e26fa93fa16ac7e99705c433b2fc1c3088b69e23..c3f14431c3c490f82d03c2f9b87b555567826d65 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-uri.md +++ b/zh-cn/application-dev/reference/apis/js-apis-uri.md @@ -145,7 +145,7 @@ toString(): string ```js const result = new uri.URI('https://username:password@host:8080/directory/file?query=pppppp#qwer=da'); -result.toString() +let result1 = result.toString(); ``` @@ -205,7 +205,7 @@ equalsTo(other: URI): boolean ```js const uriInstance = new uri.URI('https://username:password@host:8080/directory/file?query=pppppp#qwer=da'); const uriInstance1 = new uri.URI('https://username:password@host:8080/directory/file?query=pppppp#qwer=da'); -uriInstance.equalsTo(uriInstance1); +let result = uriInstance.equalsTo(uriInstance1); ``` ### checkIsAbsolute diff --git a/zh-cn/application-dev/reference/apis/js-apis-uripermissionmanager.md b/zh-cn/application-dev/reference/apis/js-apis-uripermissionmanager.md new file mode 100644 index 0000000000000000000000000000000000000000..cee5e86fc967c55eca93e79d4033485b9e5b0a14 --- /dev/null +++ b/zh-cn/application-dev/reference/apis/js-apis-uripermissionmanager.md @@ -0,0 +1,143 @@ +# @ohos.application.uriPermissionManager(URI权限管理) +> **说明:** +> +> 本模块首批接口从API version 10 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 + + +URI权限管理模块。用于应用A授权/撤销授权URI给应用B + + +## 导入模块 + + +```js +import UriPermissionManager from '@ohos.application.uriPermissionManager'; +``` + + +## uriPermissionManager.grantUriPermission + +grantUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number, callback: AsyncCallback<number>): void + +授权URI给指定应用,通过callback返回结果。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + + | 参数名 | 类型 | 必填 | 说明 | + | -------- | -------- | -------- | -------- | + | uri | string | 是 | 指向文件的URI,例如fileshare:///com.samples.filesharetest.FileShare/person/10。 | + | flag | [wantConstant.Flags](js-apis-ability-wantConstant.md#wantconstantflags) | 是 | URI的读权限或写权限。 | + | targetBundleName | string | 是 | 被授权URI的应用包名 | + | callback | AsyncCallback<number> | 是 | callback形式返回检验结果,返回0表示有权限,返回-1表示无权限。 | + +**示例:** + + ```js + import WantConstant from '@ohos.ability.wantConstant'; + let targetBundleName = 'com.example.test_case1' + let uri = "fileshare:///com.samples.filesharetest.FileShare/person/10" + uriPermissionManager.grantUriPermission(uri, WantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, targetBundleName, (result) => { + console.log("result.code = " + result.code) + }) + ``` + + +## uriPermissionManager.grantUriPermission + +grantUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number): Promise<number> + +授权URI给指定应用,通过返回值返回结果。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + + | 参数名 | 类型 | 必填 | 说明 | + | -------- | -------- | -------- | -------- | + | uri | string | 是 | 指向文件的URI,例如fileshare:///com.samples.filesharetest.FileShare/person/10。 | + | flag | [wantConstant.Flags](js-apis-ability-wantConstant.md#wantconstantflags) | 是 | URI的读权限或写权限。 | + | targetBundleName | string | 是 | 被授权URI的应用包名 | + +**返回值:** + + | 类型 | 说明 | + | -------- | -------- | + | Promise<number> | 返回0表示有权限,返回-1表示无权限。 | + +**示例:** + + ```js + import WantConstant from '@ohos.ability.wantConstant'; + let targetBundleName = 'com.example.test_case1' + let uri = "fileshare:///com.samples.filesharetest.FileShare/person/10" + uriPermissionManager.grantUriPermission(uri, wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION, targetBundleName) + .then((data) => { + console.log('Verification succeeded.' + data) + }).catch((error) => { + console.log('Verification failed.'); + }) + ``` +## uriPermissionManager.revokeUriPermission + +revokeUriPermission(uri: string, accessTokenId: number, callback: AsyncCallback<number>): void + +撤销授权指定应用的URI,通过callback返回结果。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + + | 参数名 | 类型 | 必填 | 说明 | + | -------- | -------- | -------- | -------- | + | uri | string | 是 | 指向文件的URI,例如fileshare:///com.samples.filesharetest.FileShare/person/10。 | + | targetBundleName | string | 是 | 被撤销授权uri的应用包名 | + | callback | AsyncCallback<number> | 是 | callback形式返回检验结果,返回0表示有权限,返回-1表示无权限。 | + +**示例:** + + ```js + import WantConstant from '@ohos.ability.wantConstant'; + let targetBundleName = 'com.example.test_case1' + let URI = "fileshare:///com.samples.filesharetest.FileShare/person/10" + uriPermissionManager.revokeUriPermission(uri, targetBundleName, (result) => { + console.log("result.code = " + result.code) + }) + ``` + + +## uriPermissionManager.revokeUriPermission + +revokeUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number): Promise<number> + +撤销授权指定应用的URI,通过返回值返回结果。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + + | 参数名 | 类型 | 必填 | 说明 | + | -------- | -------- | -------- | -------- | + | uri | string | 是 | 指向文件的URI,例如fileshare:///com.samples.filesharetest.FileShare/person/10。 | + | targetBundleName | string | 是 | 被授权URI的应用包名 | + +**返回值:** + + | 类型 | 说明 | + | -------- | -------- | + | Promise<number> | 返回0表示有权限,返回-1表示无权限。 | + +**示例:** + + ```js + import WantConstant from '@ohos.ability.wantConstant'; + let targetBundleName = 'com.example.test_case1' + let uri = "fileshare:///com.samples.filesharetest.FileShare/person/10" + uriPermissionManager.revokeUriPermission(uri, targetBundleName) + .then((data) => { + console.log('Verification succeeded.' + data) + }).catch((error) => { + console.log('Verification failed.'); + }) + ``` 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 bf8455c9ba1840f357a8ddd7d1abc36d02187264..9545f710b3bb38e7c78ce52010f2b5e4c92ff25e 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-url.md +++ b/zh-cn/application-dev/reference/apis/js-apis-url.md @@ -225,7 +225,7 @@ has(name: string): boolean ```js let urlObject = Url.URL.parseURL('https://developer.exampleUrl/?fod=1&bard=2'); let paramsObject = new Url.URLParams(urlObject.search.slice(1)); -paramsObject.has('bard') === true; +let result = paramsObject.has('bard'); ``` @@ -336,7 +336,7 @@ for (var value of searchParams.values()) { ```js const paramsObject = new Url.URLParams('fod=bay&edg=bap'); -for (const [name, value] of paramsObject) { +for (const [name, value] of paramsObject[Symbol.iterator]()) { console.log(name, value); } ``` @@ -460,7 +460,7 @@ URL静态成员函数。 ```js let mm = 'https://username:password@host:8080'; let url = Url.URL.parseURL(mm); -url.toString(); // Output 'https://username:password@host:8080/'; +let result = url.toString(); // Output 'https://username:password@host:8080/' ``` ### tostring @@ -481,7 +481,7 @@ toString(): string ```js const url = Url.URL.parseURL('https://username:password@host:8080/directory/file?query=pppppp#qwer=da'); -url.toString(); +let result = url.toString(); ``` ### toJSON @@ -501,7 +501,7 @@ toJSON(): string **示例:** ```js const url = Url.URL.parseURL('https://username:password@host:8080/directory/file?query=pppppp#qwer=da'); -url.toJSON(); +let result = url.toJSON(); ``` ## URLSearchParams(deprecated) diff --git a/zh-cn/application-dev/reference/apis/js-apis-usb-deprecated.md b/zh-cn/application-dev/reference/apis/js-apis-usb-deprecated.md index 8cfdfad79d999541c7aa89f26a00b738a76ea06b..90a86e2c1b414f4509e807450837cc3952045da0 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-usb-deprecated.md +++ b/zh-cn/application-dev/reference/apis/js-apis-usb-deprecated.md @@ -32,7 +32,7 @@ getDevices(): Array<Readonly<USBDevice>> ```js let devicesList = usb.getDevices(); -console.log(`devicesList = ${JSON.stringify(devicesList)}`); +console.log(`devicesList = ${devicesList}`); //devicesList 返回的数据结构 //此处提供一个简单的示例,如下 [ @@ -111,7 +111,7 @@ connectDevice(device: USBDevice): Readonly<USBDevicePipe> ```js let devicepipe= usb.connectDevice(device); -console.log(`devicepipe = ${JSON.stringify(devicepipe)}`); +console.log(`devicepipe = ${devicepipe}`); ``` ## usb.hasRight @@ -167,7 +167,7 @@ requestRight(deviceName: string): Promise<boolean> ```js let devicesName="1-1"; usb.requestRight(devicesName).then((ret) => { - console.log(`requestRight = ${JSON.stringify(ret)}`); + console.log(`requestRight = ${ret}`); }); ``` @@ -375,8 +375,9 @@ controlTransfer(pipe: USBDevicePipe, controlparam: USBControlParams, timeout ?: **示例:** ```js -usb.controlTransfer(devicepipe, USBControlParams).then((ret) => { - console.log(`controlTransfer = ${JSON.stringify(ret)}`); +let param = new usb.USBControlParams(); +usb.controlTransfer(devicepipe, param).then((ret) => { + console.log(`controlTransfer = ${ret}`); }) ``` @@ -412,7 +413,7 @@ bulkTransfer(pipe: USBDevicePipe, endpoint: USBEndpoint, buffer: Uint8Array, tim //把获取到的设备对象作为参数传入usb.connectDevice;当usb.connectDevice接口成功返回之后; //才可以调用第三个接口usb.claimInterface.当usb.claimInterface 调用成功以后,再调用该接口。 usb.bulkTransfer(devicepipe, endpoint, buffer).then((ret) => { - console.log(`bulkTransfer = ${JSON.stringify(ret)}`); + console.log(`bulkTransfer = ${ret}`); }); ``` @@ -499,7 +500,7 @@ usbFunctionsToString(funcs: FunctionType): string **示例:** ```js -let funcs = ACM | ECM; +let funcs = usb.ACM | usb.ECM; let ret = usb.usbFunctionsToString(funcs); ``` @@ -528,7 +529,7 @@ setCurrentFunctions(funcs: FunctionType): Promise\ **示例:** ```js -let funcs = HDC; +let funcs = usb.HDC; let ret = usb.setCurrentFunctions(funcs); ``` @@ -631,7 +632,12 @@ setPortRoles(portId: number, powerRole: PowerRoleType, dataRole: DataRoleType): **示例:** ```js -let ret = usb.getSupportedModes(0); +let portId = 1; +usb.setPortRoles(portId, usb.PowerRoleType.SOURCE, usb.DataRoleType.HOST).then(() => { + console.info('usb setPortRoles successfully.'); +}).catch(err => { + console.error('usb setPortRoles failed: ' + err.code + ' message: ' + err.message); +}); ``` ## USBEndpoint diff --git a/zh-cn/application-dev/reference/apis/js-apis-usb.md b/zh-cn/application-dev/reference/apis/js-apis-usb.md deleted file mode 100644 index dbc589203251e74a0158365d73da639edd0d48a8..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/reference/apis/js-apis-usb.md +++ /dev/null @@ -1,953 +0,0 @@ -# @ohos.usbV9 (USB管理) - -本模块主要提供管理USB设备的相关功能,包括主设备上查询USB设备列表、批量数据传输、控制命令传输、权限控制等;从设备上端口管理、功能切换及查询等。 - -> **说明:** -> -> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 -> -> 从API version 9开始,该接口不再维护,推荐使用新接口[`@ohos.usbManager`](js-apis-usbManager.md)。 - -## 导入模块 - -```js -import usb from "@ohos.usbV9"; -``` - -## usb.getDevices - -getDevices(): Array<Readonly<USBDevice>> - -获取接入主设备的USB设备列表。如果没有设备接入,那么将会返回一个空的列表。 - -**系统能力:** SystemCapability.USB.USBManager - -**返回值:** - -| 类型 | 说明 | -| ---------------------------------------------------- | ------- | -| 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, - }, - ], - }, - ], - }, - ], - }, -] -``` - -## usb.connectDevice - -connectDevice(device: USBDevice): Readonly<USBDevicePipe> - -根据getDevices()返回的设备信息打开USB设备。 - -需要调用[usb.getDevices](#usbgetdevices)获取设备信息以及device,再调用[usb.requestRight](#usbrequestright)请求使用该设备的权限。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| device | [USBDevice](#usbdevice) | 是 | USB设备信息。 | - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| Readonly<[USBDevicePipe](#usbdevicepipe)> | 指定的传输通道对象。 | - -**错误码:** - -以下错误码的详细介绍参见[USB错误码](../errorcodes/errorcode-usb.md)。 - -| 错误码ID | 错误信息 | -| -------- | -------- | -| 14400001 |Permission denied. Need call requestRight to get permission. | - -**示例:** - -```js -let devicesList = usb.getDevices(); -if (devicesList.length == 0) { - console.log(`device list is empty`); - return; -} - -let device = devicesList[0]; -usb.requestRight(device.name); -let devicepipe = usb.connectDevice(device); -console.log(`devicepipe = ${JSON.stringify(devicepipe)}`); -``` - -## usb.hasRight - -hasRight(deviceName: string): boolean - -判断是否有权访问该设备。 - -如果“使用者”(如各种App或系统)有权访问设备则返回true;无权访问设备则返回false。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| deviceName | string | 是 | 设备名称。 | - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| boolean | true表示有访问设备的权限,false表示没有访问设备的权限。 | - -**示例:** - -```js -let devicesName="1-1"; -let bool = usb.hasRight(devicesName); -console.log(bool); -``` - -## usb.requestRight - -requestRight(deviceName: string): Promise<boolean> - -请求软件包的临时权限以访问设备。使用Promise异步回调。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| deviceName | string | 是 | 设备名称。 | - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| Promise<boolean> | Promise对象,返回临时权限的申请结果。返回true表示临时权限申请成功;返回false则表示临时权限申请失败。 | - -**示例:** - -```js -let devicesName="1-1"; -usb.requestRight(devicesName).then((ret) => { - console.log(`requestRight = ${JSON.stringify(ret)}`); -}); -``` - -## usb.removeRight - -removeRight(deviceName: string): boolean - -移除软件包访问设备的权限。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| deviceName | string | 是 | 设备名称。 | - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| boolean | 返回权限移除结果。返回true表示权限移除成功;返回false则表示权限移除失败。 | - -**示例:** - -```js -let devicesName="1-1"; -if (usb.removeRight(devicesName) { - console.log(`Succeed in removing right`); -} -``` - -## usb.addRight - -addRight(bundleName: string, deviceName: string): boolean - -添加软件包访问设备的权限。 - -[requestRight](#usbrequestright)会触发弹框请求用户授权;addRight不会触发弹框,而是直接添加软件包访问设备的权限。 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| deviceName | string | 是 | 设备名称。 | -| bundleName | string | 是 | 软件包名称。| - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| boolean | 返回权限添加结果。返回true表示权限添加成功;返回false则表示权限添加失败。 | - -**示例:** - -```js -let devicesName = "1-1"; -let bundleName = "com.example.hello"; -if (usb.addRight(bundleName, devicesName) { - console.log(`Succeed in adding right`); -} -``` - -## usb.claimInterface - -claimInterface(pipe: USBDevicePipe, iface: USBInterface, force ?: boolean): number - -注册通信接口。 - -需要调用[usb.getDevices](#usbgetdevices)获取设备信息以及interfaces;调用[usb.requestRight](#usbrequestright)获取设备请求权限;调用[usb.connectDevice](#usbconnectdevice)接口得到devicepipe作为参数。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| pipe | [USBDevicePipe](#usbdevicepipe) | 是 | 用于确定总线号和设备地址。 | -| iface | [USBInterface](#usbinterface) | 是 | 用于确定需要获取接口的索引。 | -| force | boolean | 否 | 可选参数,是否强制获取。默认值为false ,表示不强制获取。 | - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| number | 注册通信接口成功返回0;注册通信接口失败返回其他错误码。 | - -**示例:** - -```js -let ret = usb.claimInterface(devicepipe, interfaces); -console.log(`claimInterface = ${ret}`); -``` - -## usb.releaseInterface - -releaseInterface(pipe: USBDevicePipe, iface: USBInterface): number - -释放注册过的通信接口。 - -需要调用[usb.claimInterface](#usbclaiminterface)先获取接口,才能使用此方法释放接口。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| pipe | [USBDevicePipe](#usbdevicepipe) | 是 | 用于确定总线号和设备地址。 | -| iface | [USBInterface](#usbinterface) | 是 | 用于确定需要释放接口的索引。 | - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| number | 释放接口成功返回0;释放接口失败返回其他错误码。 | - -**示例:** - -```js -let ret = usb.releaseInterface(devicepipe, interfaces); -console.log(`releaseInterface = ${ret}`); -``` - -## usb.setConfiguration - -setConfiguration(pipe: USBDevicePipe, config: USBConfig): number - -设置设备配置。 - -需要调用[usb.getDevices](#usbgetdevices)获取设备信息以及config;调用[usb.requestRight](#usbrequestright)获取设备请求权限;调用[usb.connectDevice](#usbconnectdevice)得到devicepipe作为参数。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| pipe | [USBDevicePipe](#usbdevicepipe) | 是 | 用于确定总线号和设备地址。 | -| config | [USBConfig](#usbconfig) | 是 | 用于确定需要设置的配置。 | - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| number | 设置设备配置成功返回0;设置设备配置失败返回其他错误码。 | - -**示例:** - -```js -let ret = usb.setConfiguration(devicepipe, config); -console.log(`setConfiguration = ${ret}`); -``` - -## usb.setInterface - -setInterface(pipe: USBDevicePipe, iface: USBInterface): number - -设置设备接口。 - -需要调用[usb.getDevices](#usbgetdevices)获取设备列表以及interfaces;调用[usb.requestRight](#usbrequestright)获取设备请求权限;调用[usb.connectDevice](#usbconnectdevice)得到devicepipe作为参数;调用[usb.claimInterface](#usbclaiminterface)注册通信接口。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ----- | ------------------------------- | --- | ------------- | -| pipe | [USBDevicePipe](#usbdevicepipe) | 是 | 用于确定总线号和设备地址。 | -| iface | [USBInterface](#usbinterface) | 是 | 用于确定需要设置的接口。 | - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| number | 设置设备接口成功返回0;设置设备接口失败返回其他错误码。 | - -**示例:** - -```js -let ret = usb.setInterface(devicepipe, interfaces); -console.log(`setInterface = ${ret}`); -``` - -## usb.getRawDescriptor - -getRawDescriptor(pipe: USBDevicePipe): Uint8Array - -获取原始的USB描述符。 - -需要调用[usb.getDevices](#usbgetdevices)获取设备列表;调用[usb.requestRight](#usbrequestright)获取设备请求权限;调用[usb.connectDevice](#usbconnectdevice)接口得到devicepipe作为参数。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| pipe | [USBDevicePipe](#usbdevicepipe) | 是 | 用于确定总线号和设备地址。 | - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| Uint8Array | 返回获取的原始数据;失败返回undefined。 | - -**示例:** - -```js -let ret = usb.getRawDescriptor(devicepipe); -``` - -## usb.getFileDescriptor - -getFileDescriptor(pipe: USBDevicePipe): number - -获取文件描述符。 - -需要调用[usb.getDevices](#usbgetdevices)获取设备列表;调用[usb.requestRight](#usbrequestright)获取设备请求权限;调用[usb.connectDevice](#usbconnectdevice)接口得到devicepipe作为参数。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| pipe | [USBDevicePipe](#usbdevicepipe) | 是 | 用于确定总线号和设备地址。 | - -**返回值:** - -| 类型 | 说明 | -| ------ | -------------------- | -| number | 返回设备对应的文件描述符;失败返回-1。 | - -**示例:** - -```js -let ret = usb.getFileDescriptor(devicepipe); -``` - -## usb.controlTransfer - -controlTransfer(pipe: USBDevicePipe, controlparam: USBControlParams, timeout ?: number): Promise<number> - -控制传输。 - -需要调用[usb.getDevices](#usbgetdevices)获取设备列表;调用[usb.requestRight](#usbrequestright)获取设备请求权限;调用[usb.connectDevice](#usbconnectdevice)接口得到devicepipe作为参数。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| pipe | [USBDevicePipe](#usbdevicepipe) | 是 | 用于确定设备。 | -| controlparam | [USBControlParams](#usbcontrolparams) | 是 | 控制传输参数。 | -| timeout | number | 否 | 超时时间(单位:ms),可选参数,默认为0不超时。 | - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| Promise<number> | Promise对象,获取传输或接收到的数据块大小。失败返回-1。 | - -**示例:** - -```js -usb.controlTransfer(devicepipe, USBControlParams).then((ret) => { - console.log(`controlTransfer = ${JSON.stringify(ret)}`); -}) -``` - -## usb.bulkTransfer - -bulkTransfer(pipe: USBDevicePipe, endpoint: USBEndpoint, buffer: Uint8Array, timeout ?: number): Promise<number> - -批量传输。 - -需要调用[usb.getDevices](#usbgetdevices)获取设备信息列表以及endpoint;再调用[usb.requestRight](#usbrequestright)获取设备请求权限;然后调用[usb.connectDevice](#usbconnectdevice)接口得到返回数据devicepipe之后,再次获取接口[usb.claimInterface](#usbclaiminterface);再调用usb.bulkTransfer接口。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| pipe | [USBDevicePipe](#usbdevicepipe) | 是 | 用于确定设备。 | -| endpoint | [USBEndpoint](#usbendpoint) | 是 | 用于确定传输的端口。 | -| buffer | Uint8Array | 是 | 用于写入或读取的缓冲区。 | -| timeout | number | 否 | 超时时间(单位:ms),可选参数,默认为0不超时。| - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| Promise<number> | Promise对象,获取传输或接收到的数据块大小。失败返回-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)}`); -}); -``` - -## usb.closePipe - -closePipe(pipe: USBDevicePipe): number - -关闭设备消息控制通道。 - -需要调用[usb.getDevices](#usbgetdevices)获取设备列表;调用[usb.requestRight](#usbrequestright)获取设备请求权限;调用[usb.connectDevice](#usbconnectdevice)得到devicepipe作为参数。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| pipe | [USBDevicePipe](#usbdevicepipe) | 是 | 用于确定USB设备消息控制通道。 | - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| number | 关闭设备消息控制通道成功返回0;关闭设备消息控制通道失败返回其他错误码。 | - -**示例:** - -```js -let ret = usb.closePipe(devicepipe); -console.log(`closePipe = ${ret}`); -``` - -## usb.usbFunctionsFromString - -usbFunctionsFromString(funcs: string): number - -在设备模式下,将字符串形式的USB功能列表转化为数字掩码。 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | ---------------------- | -| funcs | string | 是 | 字符串形式的功能列表。 | - -**返回值:** - -| 类型 | 说明 | -| ------ | ------------------ | -| number | 转化后的数字掩码。 | - -**示例:** - -```js -let funcs = "acm"; -let ret = usb.usbFunctionsFromString(funcs); -``` - -## usb.usbFunctionsToString - -usbFunctionsToString(funcs: FunctionType): string - -在设备模式下,将数字掩码形式的USB功能列表转化为字符串。 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------------------------------ | ---- | ----------------- | -| funcs | [FunctionType](#functiontype) | 是 | USB功能数字掩码。 | - -**返回值:** - -| 类型 | 说明 | -| ------ | ------------------------------ | -| string | 转化后的字符串形式的功能列表。 | - -**示例:** - -```js -let funcs = ACM | ECM; -let ret = usb.usbFunctionsToString(funcs); -``` - -## usb.setCurrentFunctions - -setCurrentFunctions(funcs: FunctionType): Promise\ - -在设备模式下,设置当前的USB功能列表。 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------------------------------ | ---- | ----------------- | -| funcs | [FunctionType](#functiontype) | 是 | USB功能数字掩码。 | - -**返回值:** - -| 类型 | 说明 | -| --------------- | ------------- | -| Promise\ | Promise对象。 | - -**示例:** - -```js -let funcs = HDC; -usb.setCurrentFunctions(funcs).then(() => { - console.info('usb setCurrentFunctions successfully.'); -}).catch(err => { - console.error('usb setCurrentFunctions failed: ' + err.code + ' message: ' + err.message); -}); -``` - -## usb.getCurrentFunctions - -getCurrentFunctions(): FunctionType - -在设备模式下,获取当前的USB功能列表的数字组合掩码。 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** SystemCapability.USB.USBManager - -**返回值:** - -| 类型 | 说明 | -| ------------------------------ | --------------------------------- | -| [FunctionType](#functiontype) | 当前的USB功能列表的数字组合掩码。 | - -**示例:** - -```js -let ret = usb.getCurrentFunctions(); -``` - -## usb.getPorts - -getPorts(): Array\ - -获取所有物理USB端口描述信息。 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** SystemCapability.USB.USBManager - -**返回值:** - -| 类型 | 说明 | -| ----------------------------- | --------------------- | -| [Array\](#usbport) | USB端口描述信息列表。 | - -**示例:** - -```js -let ret = usb.getPorts(); -``` - -## usb.getSupportedModes - -getSupportedModes(portId: number): PortModeType - -获取指定的端口支持的模式列表的组合掩码。 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ------ | ------ | ---- | -------- | -| portId | number | 是 | 端口号。 | - -**返回值:** - -| 类型 | 说明 | -| ------------------------------ | -------------------------- | -| [PortModeType](#portmodetype) | 支持的模式列表的组合掩码。 | - -**示例:** - -```js -let ret = usb.getSupportedModes(0); -``` - -## usb.setPortRoles - -setPortRoles(portId: number, powerRole: PowerRoleType, dataRole: DataRoleType): Promise\ - -设置指定的端口支持的角色模式,包含充电角色、数据传输角色。 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** SystemCapability.USB.USBManager - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| --------- | -------------------------------- | ---- | ---------------- | -| portId | number | 是 | 端口号。 | -| powerRole | [PowerRoleType](#powerroletype) | 是 | 充电的角色。 | -| dataRole | [DataRoleType](#dataroletype) | 是 | 数据传输的角色。 | - -**返回值:** - -| 类型 | 说明 | -| --------------- | ------------- | -| Promise\ | Promise对象。 | - -**示例:** - -```js -let portId = 1; -usb.usb.setPortRoles(portId, usb.PowerRoleType.SOURCE, usb.DataRoleType.HOST).then(() => { - console.info('usb setPortRoles successfully.'); -}).catch(err => { - console.error('usb setPortRoles failed: ' + err.code + ' message: ' + err.message); -}); -``` - -## USBEndpoint - -通过USB发送和接收数据的端口。通过[USBInterface](#usbinterface)获取。 - -**系统能力:** 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)> | 是 |当前接口所包含的端点。 | - -## USBConfig - -USB配置,一个[USBDevice](#usbdevice)中可以含有多个配置。 - -**系统能力:** 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)> | 是 |设备配置描述符信息。 | - -## USBDevicePipe - -USB设备消息传输通道,用于确定设备。 - -**系统能力:** SystemCapability.USB.USBManager - -| 名称 | 类型 | 必填 |说明 | -| ---------- | ------ | ----- |----- | -| busNum | number |是 | 总线地址。 | -| devAddress | number |是 | 设备地址。 | - -## USBControlParams - -控制传输参数。 - -**系统能力:** SystemCapability.USB.USBManager - -| 名称 | 类型 | 必填 |说明 | -| ------- | ----------------------------------------------- | ---------------- |---------------- | -| request | number | 是 |请求类型。 | -| target | [USBRequestTargetType](#usbrequesttargettype) | 是 |请求目标类型。 | -| reqType | [USBControlRequestType](#usbcontrolrequesttype) | 是 |请求控制类型。 | -| value | number | 是 |请求参数。 | -| index | number | 是 |请求参数value对应的索引值。 | -| data | Uint8Array | 是 |用于写入或读取的缓冲区。 | - -## USBPort - -USB设备端口。 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** SystemCapability.USB.USBManager - -| 名称 | 类型 | 必填 |说明 | -| -------------- | ------------------------------- | ------------------- |------------------------ | -| id | number | 是 |USB端口唯一标识。 | -| supportedModes | [PortModeType](#portmodetype) | 是 |USB端口所支持的模式的数字组合掩码。 | -| status | [USBPortStatus](#usbportstatus) | 是 |USB端口角色。 | - -## USBPortStatus - -USB设备端口角色信息。 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** 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 | 其他。 | - -## USBControlRequestType - -控制请求类型。 - -**系统能力:** SystemCapability.USB.USBManager - -| 名称 | 值 | 说明 | -| ------------------------- | ---- | ------ | -| USB_REQUEST_TYPE_STANDARD | 0 | 标准。 | -| USB_REQUEST_TYPE_CLASS | 1 | 类。 | -| USB_REQUEST_TYPE_VENDOR | 2 | 厂商。 | - -## USBRequestDirection - -请求方向。 - -**系统能力:** SystemCapability.USB.USBManager - -| 名称 | 值 | 说明 | -| --------------------------- | ---- | ------------------------ | -| USB_REQUEST_DIR_TO_DEVICE | 0 | 写数据,主设备往从设备。 | -| USB_REQUEST_DIR_FROM_DEVICE | 0x80 | 读数据,从设备往主设备。 | - -## FunctionType - -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 | 暂不支持。 | - -## PortModeType - -USB端口模式类型。 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** SystemCapability.USB.USBManager - -| 名称 | 值 | 说明 | -| --------- | ---- | ---------------------------------------------------- | -| NONE | 0 | 无。 | -| UFP | 1 | 数据上行,需要外部供电。 | -| DFP | 2 | 数据下行,对外提供电源。 | -| DRP | 3 | 既可以做DFP(Host),也可以做UFP(Device),当前不支持。 | -| NUM_MODES | 4 | 当前不支持。 | - -## PowerRoleType - -电源角色类型。 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** SystemCapability.USB.USBManager - -| 名称 | 值 | 说明 | -| ------ | ---- | ---------- | -| NONE | 0 | 无。 | -| SOURCE | 1 | 外部供电。 | -| SINK | 2 | 内部供电。 | - -## DataRoleType - -数据角色类型。 - -**系统接口:** 此接口为系统接口。 - -**系统能力:** SystemCapability.USB.USBManager - -| 名称 | 值 | 说明 | -| ------ | ---- | ------------ | -| NONE | 0 | 无。 | -| HOST | 1 | 主设备角色。 | -| DEVICE | 2 | 从设备角色。 | - diff --git a/zh-cn/application-dev/reference/apis/js-apis-usbManager.md b/zh-cn/application-dev/reference/apis/js-apis-usbManager.md index 6eaf7501cc163afbec26e8b9749da044f94b4e05..5b8d67b962b11b834dda0bfe4d14edbcf39a4b61 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-usbManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-usbManager.md @@ -30,7 +30,7 @@ getDevices(): Array<Readonly<USBDevice>> ```js let devicesList = usb.getDevices(); -console.log(`devicesList = ${JSON.stringify(devicesList)}`); +console.log(`devicesList = ${devicesList}`); //devicesList 返回的数据结构 //此处提供一个简单的示例,如下 [ @@ -119,13 +119,12 @@ connectDevice(device: USBDevice): Readonly<USBDevicePipe> let devicesList = usb.getDevices(); if (devicesList.length == 0) { console.log(`device list is empty`); - return; } let device = devicesList[0]; usb.requestRight(device.name); let devicepipe = usb.connectDevice(device); -console.log(`devicepipe = ${JSON.stringify(devicepipe)}`); +console.log(`devicepipe = ${devicepipe}`); ``` ## usb.hasRight @@ -155,7 +154,7 @@ hasRight(deviceName: string): boolean ```js let devicesName="1-1"; let bool = usb.hasRight(devicesName); -console.log(bool); +console.log(`${bool}`); ``` ## usb.requestRight @@ -183,7 +182,7 @@ requestRight(deviceName: string): Promise<boolean> ```js let devicesName="1-1"; usb.requestRight(devicesName).then((ret) => { - console.log(`requestRight = ${JSON.stringify(ret)}`); + console.log(`requestRight = ${ret}`); }); ``` @@ -211,7 +210,7 @@ removeRight(deviceName: string): boolean ```js let devicesName="1-1"; -if (usb.removeRight(devicesName) { +if usb.removeRight(devicesName) { console.log(`Succeed in removing right`); } ``` @@ -246,7 +245,7 @@ addRight(bundleName: string, deviceName: string): boolean ```js let devicesName = "1-1"; let bundleName = "com.example.hello"; -if (usb.addRight(bundleName, devicesName) { +if usb.addRight(bundleName, devicesName) { console.log(`Succeed in adding right`); } ``` @@ -455,8 +454,9 @@ controlTransfer(pipe: USBDevicePipe, controlparam: USBControlParams, timeout ?: **示例:** ```js -usb.controlTransfer(devicepipe, USBControlParams).then((ret) => { - console.log(`controlTransfer = ${JSON.stringify(ret)}`); +let param = new usb.USBControlParams(); +usb.controlTransfer(devicepipe, param).then((ret) => { + console.log(`controlTransfer = ${ret}`); }) ``` @@ -492,7 +492,7 @@ bulkTransfer(pipe: USBDevicePipe, endpoint: USBEndpoint, buffer: Uint8Array, tim //把获取到的设备对象作为参数传入usb.connectDevice;当usb.connectDevice接口成功返回之后; //才可以调用第三个接口usb.claimInterface.当usb.claimInterface 调用成功以后,再调用该接口。 usb.bulkTransfer(devicepipe, endpoint, buffer).then((ret) => { - console.log(`bulkTransfer = ${JSON.stringify(ret)}`); + console.log(`bulkTransfer = ${ret}`); }); ``` @@ -579,7 +579,7 @@ usbFunctionsToString(funcs: FunctionType): string **示例:** ```js -let funcs = ACM | ECM; +let funcs = usb.ACM | usb.ECM; let ret = usb.usbFunctionsToString(funcs); ``` @@ -608,7 +608,7 @@ setCurrentFunctions(funcs: FunctionType): Promise\ **示例:** ```js -let funcs = HDC; +let funcs = usb.HDC; usb.setCurrentFunctions(funcs).then(() => { console.info('usb setCurrentFunctions successfully.'); }).catch(err => { @@ -716,7 +716,7 @@ setPortRoles(portId: number, powerRole: PowerRoleType, dataRole: DataRoleType): ```js let portId = 1; -usb.usb.setPortRoles(portId, usb.PowerRoleType.SOURCE, usb.DataRoleType.HOST).then(() => { +usb.setPortRoles(portId, usb.PowerRoleType.SOURCE, usb.DataRoleType.HOST).then(() => { console.info('usb setPortRoles successfully.'); }).catch(err => { console.error('usb setPortRoles failed: ' + err.code + ' message: ' + err.message); diff --git a/zh-cn/application-dev/reference/apis/js-apis-useriam-userauth.md b/zh-cn/application-dev/reference/apis/js-apis-useriam-userauth.md index 251d446bdb9f8250d97fb8e57ef3821f40248522..c7ca4781f1471cb644fe477972ac8bc0604fe88d 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-useriam-userauth.md +++ b/zh-cn/application-dev/reference/apis/js-apis-useriam-userauth.md @@ -22,8 +22,8 @@ import userIAM_userAuth from '@ohos.userIAM.userAuth'; | ------------ | ---------- | ---- | -------------------- | | result | number | 是 | 认证结果。 | | token | Uint8Array | 否 | 用户身份认证通过的凭证。 | -| remainAttempts | number | 否 | 剩余的认证操作次数。 | -| lockoutDuration | number | 否 | 认证操作的冻结时间。 | +| remainAttempts | number | 否 | 剩余的认证尝试次数。 | +| lockoutDuration | number | 否 | 认证操作的锁定时长,时间单位为毫秒ms。 | ## TipInfo9+ @@ -399,44 +399,6 @@ try { } ``` -## userIAM_userAuth.getVersion9+ - -getVersion(): number - -获取认证器的版本信息。 - -**需要权限**:ohos.permission.ACCESS_BIOMETRIC - -**系统能力**:SystemCapability.UserIAM.UserAuth.Core - -**返回值:** - -| 类型 | 说明 | -| ------ | ---------------------- | -| number | 认证器版本信息。 | - -以下错误码的详细介绍请参见[用户认证错误码](../errorcodes/errorcode-useriam.md) - -**错误码:** - -| 错误码ID | 错误信息 | -| -------- | ------- | -| 201 | Permission verification failed. | -| 12500002 | General operation error. | - -**示例:** - -```js -import userIAM_userAuth from '@ohos.userIAM.userAuth'; - -try { - let version = userIAM_userAuth.getVersion(); - console.info("auth version = " + version); -} catch (error) { - console.info("get version failed, error = " + error); -} -``` - ## userIAM_userAuth.getAvailableStatus9+ getAvailableStatus(authType : UserAuthType, authTrustLevel : AuthTrustLevel): void @@ -535,7 +497,7 @@ getVersion() : number 获取认证器的版本信息。 > **说明:** -> 从 API version 8 开始支持,从 API version 9 开始废弃,请使用[getVersion](#useriam_userauthgetversion9)替代。 +> 从 API version 8 开始支持,从 API version 9 开始废弃。 **需要权限**:ohos.permission.ACCESS_BIOMETRIC 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 0254aca1a63d8d2086da50f893b1c9b2f657d8c9..a7f1478ff199c9251237a8009802bff0acde40e4 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-util.md +++ b/zh-cn/application-dev/reference/apis/js-apis-util.md @@ -110,7 +110,7 @@ async function fn() { return 'hello world'; } let cb = util.callbackWrapper(fn); -cb((err, ret) => { +cb(1, (err, ret) => { if (err) throw err; console.log(ret); }); @@ -1119,7 +1119,7 @@ updateCapacity(newCapacity: number): void ```js let pro = new util.LRUCache(); -let result = pro.updateCapacity(100); +pro.updateCapacity(100); ``` @@ -1954,7 +1954,7 @@ let tempLower = new Temperature(30); let tempUpper = new Temperature(40); let tempMiDF = new Temperature(35); let range = new util.ScopeHelper(tempLower, tempUpper); -range.contains(tempMiDF); +let result = range.contains(tempMiDF); ``` 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 c21feac3f1d6302352458849818b1045ee5bb743..9bb19451f0b5c38dd4250215900a122d65e6ba77 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-wallpaper.md +++ b/zh-cn/application-dev/reference/apis/js-apis-wallpaper.md @@ -14,7 +14,7 @@ import wallpaper from '@ohos.wallpaper'; ``` -## WallpaperType +## WallpaperType7+ 定义壁纸的枚举类型。 @@ -26,10 +26,14 @@ import wallpaper from '@ohos.wallpaper'; | WALLPAPER_LOCKSCREEN | 1 |锁屏壁纸标识。 | -## RgbaColor +## RgbaColor(deprecated) 定义壁纸颜色信息结构。 +> **说明:** +> +> 从 API version 7开始支持,从API version 9开始废弃。 + **系统能力**: SystemCapability.MiscServices.Wallpaper | 名称 | 类型 | 可读 | 可写 | 说明 | @@ -48,6 +52,8 @@ getColorsSync(wallpaperType: WallpaperType): Array<RgbaColor> **系统能力**: SystemCapability.MiscServices.Wallpaper +**系统接口**:此接口为系统接口。 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -71,37 +77,6 @@ try { } ``` -## wallpaper.getIdSync9+ - -getIdSync(wallpaperType: WallpaperType): number - -获取指定类型壁纸的ID。 - -**系统能力**: SystemCapability.MiscServices.Wallpaper - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| wallpaperType | [WallpaperType](#wallpapertype) | 是 | 壁纸类型。 | - -**返回值**: - -| 类型 | 说明 | -| -------- | -------- | -| number | 返回壁纸的ID。如果配置了这种壁纸类型的壁纸就返回一个大于等于0的数,否则返回-1。取值范围是-1到(2^31-1)。 | - -**示例**: - -```js -try { - let id = wallpaper.getIdSync(wallpaper.WallpaperType.WALLPAPER_SYSTEM); - console.log(`success to getIdSync: ${JSON.stringify(id)}`); -} catch (error) { - console.error(`failed to getIdSync because: ${JSON.stringify(error)}`); -} -``` - ## wallpaper.getMinHeightSync9+ getMinHeightSync(): number @@ -110,6 +85,8 @@ getMinHeightSync(): number **系统能力**: SystemCapability.MiscServices.Wallpaper +**系统接口**:此接口为系统接口。 + **返回值:** | 类型 | 说明 | @@ -130,6 +107,8 @@ getMinWidthSync(): number **系统能力**: SystemCapability.MiscServices.Wallpaper +**系统接口**:此接口为系统接口。 + **返回值:** | 类型 | 说明 | @@ -142,46 +121,6 @@ getMinWidthSync(): number let minWidth = wallpaper.getMinWidthSync(); ``` -## wallpaper.isChangeAllowed9+ - -isChangeAllowed(): boolean - -是否允许应用改变当前用户的壁纸。 - -**系统能力**: SystemCapability.MiscServices.Wallpaper - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| boolean | 返回是否允许应用改变当前用户的壁纸。如果允许返回true,否则返回false。 | - -**示例:** - -```js -let isChangeAllowed = wallpaper.isChangeAllowed(); -``` - -## wallpaper.isUserChangeAllowed9+ - -isUserChangeAllowed(): boolean - -是否允许用户设置壁纸。 - -**系统能力**: SystemCapability.MiscServices.Wallpaper - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| boolean | 返回是否允许用户设置壁纸。如果允许返回true,否则返回false。 | - -**示例:** - -```js -let isUserChangeAllowed = wallpaper.isUserChangeAllowed(); -``` - ## wallpaper.restore9+ restore(wallpaperType: WallpaperType, callback: AsyncCallback<void>): void @@ -192,6 +131,8 @@ restore(wallpaperType: WallpaperType, callback: AsyncCallback<void>): void **系统能力**: SystemCapability.MiscServices.Wallpaper +**系统接口**:此接口为系统接口。 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -221,6 +162,8 @@ restore(wallpaperType: WallpaperType): Promise<void> **系统能力**: SystemCapability.MiscServices.Wallpaper +**系统接口**:此接口为系统接口。 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -253,6 +196,8 @@ setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback **系统能力**: SystemCapability.MiscServices.Wallpaper +**系统接口**:此接口为系统接口。 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -306,6 +251,8 @@ setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise **系统能力**: SystemCapability.MiscServices.Wallpaper +**系统接口**:此接口为系统接口。 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -350,39 +297,6 @@ imageSource.createPixelMap(opts).then((pixelMap) => { }); ``` -## wallpaper.getFileSync9+ - -getFileSync(wallpaperType: WallpaperType): number; - -获取指定类型的壁纸文件。 - -**需要权限**:ohos.permission.GET_WALLPAPER - -**系统能力**: SystemCapability.MiscServices.Wallpaper - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| -------- | -------- | -------- | -------- | -| wallpaperType | [WallpaperType](#wallpapertype) | 是 | 壁纸类型。 | - -**返回值:** - -| 类型 | 说明 | -| -------- | -------- | -| number | 调用成功则返回壁纸文件描述符ID,调用失败则返回error信息。 | - -**示例:** - -```js -try { - let file = wallpaper.getFileSync(wallpaper.WallpaperType.WALLPAPER_SYSTEM); - console.log(`success to getFileSync: ${JSON.stringify(file)}`); -} catch (error) { - console.error(`failed to getFileSync because: ${JSON.stringify(error)}`); -} -``` - ## wallpaper.getImage9+ getImage(wallpaperType: WallpaperType, callback: AsyncCallback<image.PixelMap>): void; @@ -449,12 +363,16 @@ wallpaper.getImage(wallpaper.WallpaperType.WALLPAPER_SYSTEM).then((data) => { }); ``` -## wallpaper.on('colorChange')9+ +## wallpaper.on('colorChange')(deprecated) on(type: 'colorChange', callback: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void 订阅壁纸颜色变化结果上报事件。 +> **说明:** +> +> 从 API version 7开始支持,从API version 9开始废弃。 + **系统能力**: SystemCapability.MiscServices.Wallpaper **参数:** @@ -477,12 +395,16 @@ try { } ``` -## wallpaper.off('colorChange')9+ +## wallpaper.off('colorChange')(deprecated) off(type: 'colorChange', callback?: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void 取消订阅壁纸颜色变化结果上报事件。 +> **说明:** +> +> 从 API version 7开始支持,从API version 9开始废弃。 + **系统能力**: SystemCapability.MiscServices.Wallpaper **参数:** @@ -527,7 +449,7 @@ getColors(wallpaperType: WallpaperType, callback: AsyncCallback<Array<Rgba > **说明:** > -> 从 API version 7开始支持,从API version 9开始废弃。建议使用[wallpaper.getColorsSync9+](#wallpapergetcolorssync9)代替。 +> 从 API version 7开始支持,从API version 9开始废弃。 **系统能力**: SystemCapability.MiscServices.Wallpaper @@ -558,7 +480,7 @@ getColors(wallpaperType: WallpaperType): Promise<Array<RgbaColor>> > **说明:** > -> 从 API version 7开始支持,从API version 9开始废弃。建议使用[wallpaper.getColorsSync9+](#wallpapergetcolorssync9)代替。 +> 从 API version 7开始支持,从API version 9开始废弃。 **系统能力**: SystemCapability.MiscServices.Wallpaper @@ -592,7 +514,7 @@ getId(wallpaperType: WallpaperType, callback: AsyncCallback<number>): void > **说明:** > -> 从 API version 7开始支持,从API version 9开始废弃。建议使用[wallpaper.getIdSync9+](#wallpapergetidsync9)代替。 +> 从 API version 7开始支持,从API version 9开始废弃。 **系统能力**: SystemCapability.MiscServices.Wallpaper @@ -623,7 +545,7 @@ getId(wallpaperType: WallpaperType): Promise<number> > **说明:** > -> 从 API version 7开始支持,从API version 9开始废弃。建议使用[wallpaper.getIdSync9+](#wallpapergetidsync9)代替。 +> 从 API version 7开始支持,从API version 9开始废弃。 **系统能力**: SystemCapability.MiscServices.Wallpaper @@ -657,7 +579,7 @@ getMinHeight(callback: AsyncCallback<number>): void > **说明:** > -> 从 API version 7开始支持,从API version 9开始废弃。建议使用[wallpaper.getMinHeightSync9+](#wallpapergetminheightsync9)代替。 +> 从 API version 7开始支持,从API version 9开始废弃。 **系统能力**: SystemCapability.MiscServices.Wallpaper @@ -687,7 +609,7 @@ getMinHeight(): Promise<number> > **说明:** > -> 从 API version 7开始支持,从API version 9开始废弃。建议使用[wallpaper.getMinHeightSync9+](#wallpapergetminheightsync9)代替。 +> 从 API version 7开始支持,从API version 9开始废弃。 **系统能力**: SystemCapability.MiscServices.Wallpaper @@ -715,7 +637,7 @@ getMinWidth(callback: AsyncCallback<number>): void > **说明:** > -> 从 API version 7开始支持,从API version 9开始废弃。建议使用[wallpaper.getMinWidthSync9+](#wallpapergetminwidthsync9)代替。 +> 从 API version 7开始支持,从API version 9开始废弃。 **系统能力**: SystemCapability.MiscServices.Wallpaper @@ -745,7 +667,7 @@ getMinWidth(): Promise<number> > **说明:** > -> 从 API version 7开始支持,从API version 9开始废弃。建议使用[wallpaper.getMinWidthSync9+](#wallpapergetminwidthsync9)代替。 +> 从 API version 7开始支持,从API version 9开始废弃。 **系统能力**: SystemCapability.MiscServices.Wallpaper @@ -773,7 +695,7 @@ isChangePermitted(callback: AsyncCallback<boolean>): void > **说明:** > -> 从 API version 7开始支持,从API version 9开始废弃。建议使用[wallpaper.isChangeAllowed9+](#wallpaperischangeallowed9)代替。 +> 从 API version 7开始支持,从API version 9开始废弃。 **系统能力**: SystemCapability.MiscServices.Wallpaper @@ -803,7 +725,7 @@ isChangePermitted(): Promise<boolean> > **说明:** > -> 从 API version 7开始支持,从API version 9开始废弃。建议使用[wallpaper.isChangeAllowed9+](#wallpaperischangeallowed9)代替。 +> 从 API version 7开始支持,从API version 9开始废弃。 **系统能力**: SystemCapability.MiscServices.Wallpaper @@ -831,7 +753,7 @@ isOperationAllowed(callback: AsyncCallback<boolean>): void > **说明:** > -> 从 API version 7开始支持,从API version 9开始废弃。建议使用[wallpaper.isUserChangeAllowed9+](#wallpaperisuserchangeallowed9)代替。 +> 从 API version 7开始支持,从API version 9开始废弃。 **系统能力**: SystemCapability.MiscServices.Wallpaper @@ -861,7 +783,7 @@ isOperationAllowed(): Promise<boolean> > **说明:** > -> 从 API version 7开始支持,从API version 9开始废弃。建议使用[wallpaper.isUserChangeAllowed9+](#wallpaperisuserchangeallowed9)代替。 +> 从 API version 7开始支持,从API version 9开始废弃。 **系统能力**: SystemCapability.MiscServices.Wallpaper @@ -889,7 +811,7 @@ reset(wallpaperType: WallpaperType, callback: AsyncCallback<void>): void > **说明:** > -> 从 API version 7开始支持,从API version 9开始废弃。建议使用[wallpaper.restore9+](#wallpaperrestore9)代替。 +> 从 API version 7开始支持,从API version 9开始废弃。 **需要权限**:ohos.permission.SET_WALLPAPER @@ -922,7 +844,7 @@ reset(wallpaperType: WallpaperType): Promise<void> > **说明:** > -> 从 API version 7开始支持,从API version 9开始废弃。建议使用[wallpaper.restore9+](#wallpaperrestore9)代替。 +> 从 API version 7开始支持,从API version 9开始废弃。 **需要权限**:ohos.permission.SET_WALLPAPER @@ -958,7 +880,7 @@ setWallpaper(source: string | image.PixelMap, wallpaperType: WallpaperType, call > **说明:** > -> 从 API version 7开始支持,从API version 9开始废弃。建议使用[wallpaper.setImage9+](#wallpapersetimage9)代替。 +> 从 API version 7开始支持,从API version 9开始废弃。 **需要权限**:ohos.permission.SET_WALLPAPER @@ -1015,7 +937,7 @@ setWallpaper(source: string | image.PixelMap, wallpaperType: WallpaperType): Pro > **说明:** > -> 从 API version 7开始支持,从API version 9开始废弃。建议使用[wallpaper.setImage9+](#wallpapersetimage9)代替。 +> 从 API version 7开始支持,从API version 9开始废弃。 **需要权限**:ohos.permission.SET_WALLPAPER @@ -1074,7 +996,7 @@ getFile(wallpaperType: WallpaperType, callback: AsyncCallback<number>): vo > **说明:** > -> 从 API version 8开始支持,从API version 9开始废弃。建议使用[wallpaper.getFileSync9+](#wallpapergetfilesync9)代替。 +> 从 API version 8开始支持,从API version 9开始废弃。 **需要权限**:ohos.permission.GET_WALLPAPER @@ -1107,7 +1029,7 @@ getFile(wallpaperType: WallpaperType): Promise<number> > **说明:** > -> 从 API version 8开始支持,从API version 9开始废弃。建议使用[wallpaper.getFileSync9+](#wallpapergetfilesync9)代替。 +> 从 API version 8开始支持,从API version 9开始废弃。 **需要权限**:ohos.permission.GET_WALLPAPER @@ -1143,7 +1065,7 @@ getPixelMap(wallpaperType: WallpaperType, callback: AsyncCallback<image.Pixel > **说明:** > -> 从 API version 7开始支持,从API version 9开始废弃。建议使用[wallpaper.getImage9+](#wallpapergetimage9)代替。 +> 从 API version 7开始支持,从API version 9开始废弃。 **需要权限**:ohos.permission.GET_WALLPAPER @@ -1178,7 +1100,7 @@ getPixelMap(wallpaperType: WallpaperType): Promise<image.PixelMap> > **说明:** > -> 从 API version 7开始支持,从API version 9开始废弃。建议使用[wallpaper.getImage9+](#wallpapergetimage9)代替。 +> 从 API version 7开始支持,从API version 9开始废弃。 **需要权限**:ohos.permission.GET_WALLPAPER diff --git a/zh-cn/application-dev/reference/apis/js-apis-wantAgent.md b/zh-cn/application-dev/reference/apis/js-apis-wantAgent.md index 318a37a9735cabd2ad566542c7783eec2dfeb621..e9cf45b13c404c672dea9facc48b922f3f54da92 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-wantAgent.md +++ b/zh-cn/application-dev/reference/apis/js-apis-wantAgent.md @@ -12,6 +12,145 @@ WantAgent模块提供了创建WantAgent实例、获取实例的用户ID、获取 import WantAgent from '@ohos.wantAgent'; ``` +## WantAgent.getWant + +getWant(agent: WantAgent, callback: AsyncCallback\): void + +获取WantAgent中的Want(callback形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------------- | ---- | ----------------------- | +| agent | [WantAgent](js-apis-wantAgent.md) | 是 | WantAgent信息。 | +| callback | AsyncCallback\ | 是 | 获取WantAgent中的Want的回调方法。 | + +**示例:** + +```ts +import WantAgent from '@ohos.wantAgent'; + + +//wantAgent对象 +let wantAgent; + +//getWantAgent回调 +function getWantAgentCallback(err, data) { + console.info('==========================>getWantAgentCallback=======================>'); + if (err.code == 0) { + wantAgent = data; + } else { + console.error('getWantAgent failed, error: ' + JSON.stringify(err)); + return; + } + + //getWant回调 + function getWantCallback(err, data) { + console.info('==========================>getWantCallback=======================>'); + } + WantAgent.getWant(wantAgent, getWantCallback); +} +//WantAgentInfo对象 +let wantAgentInfo = { + wants: [ + { + deviceId: 'deviceId', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.EntryAbility', + action: 'action1', + entities: ['entity1'], + type: 'MIMETYPE', + uri: 'key={true,true,false}', + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: '[1, 2, 3]', + mykey3: 'ssssssssssssssssssssssssss', + mykey4: [false, true, false], + mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], + mykey6: true, + } + } + ], + operationType: WantAgent.OperationType.START_ABILITIES, + requestCode: 0, + wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] +}; + +WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); +``` + +## WantAgent.getWant + +getWant(agent: WantAgent): Promise\ + +获取WantAgent中的Want(Promise形式)。 + +**系统能力**:SystemCapability.Ability.AbilityRuntime.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ---- | ------------- | ---- | ------------- | +| agent | [WantAgent](js-apis-wantAgent.md) | 是 | WantAgent信息。 | + +**返回值:** + +| 类型 | 说明 | +| ----------------------------------------------------------- | ------------------------------------------------------------ | +| Promise\ | 以Promise形式返回Want。 | + +**示例:** + +```ts +import WantAgent from '@ohos.wantAgent'; + + +//wantAgent对象 +let wantAgent; + +//WantAgentInfo对象 +let wantAgentInfo = { + wants: [ + { + deviceId: 'deviceId', + bundleName: 'com.neu.setResultOnAbilityResultTest1', + abilityName: 'com.example.test.EntryAbility', + action: 'action1', + entities: ['entity1'], + type: 'MIMETYPE', + uri: 'key={true,true,false}', + parameters: + { + mykey0: 2222, + mykey1: [1, 2, 3], + mykey2: '[1, 2, 3]', + mykey3: 'ssssssssssssssssssssssssss', + mykey4: [false, true, false], + mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], + mykey6: true, + } + } + ], + operationType: WantAgent.OperationType.START_ABILITIES, + requestCode: 0, + wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] +} + +WantAgent.getWantAgent(wantAgentInfo).then((data) => { + console.info('==========================>getWantAgentCallback=======================>'); + wantAgent = data; + if (wantAgent) { + WantAgent.getWant(wantAgent).then((data) => { + console.info('==========================>getWantCallback=======================>'); + }); + } +}); +``` + ## WantAgent.getWantAgent getWantAgent(info: WantAgentInfo, callback: AsyncCallback\): void @@ -786,135 +925,6 @@ WantAgent.equal(wantAgent1, wantAgent2).then((data) => { }); ``` -## WantAgent.getOperationType9+ - -getOperationType(agent: WantAgent, callback: AsyncCallback\): void; - -获取一个WantAgent的OperationType信息(callback形式)。 - -**系统能力**:SystemCapability.Ability.AbilityRuntime.Core - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ---------- | ------------------------ | ---- | --------------------------------------- | -| agent | WantAgent | 是 | WantAgent对象。 | -| callback | AsyncCallback\ | 是 | 获取一个WantAgent的OperationType信息的回调方法。 | - -**示例:** - -```ts -import WantAgent from '@ohos.wantAgent'; - -//wantAgent对象 -let wantAgent; - -//WantAgentInfo对象 -let wantAgentInfo = { - wants: [ - { - deviceId: 'deviceId', - bundleName: 'com.neu.setResultOnAbilityResultTest1', - abilityName: 'com.example.test.EntryAbility', - action: 'action1', - entities: ['entity1'], - type: 'MIMETYPE', - uri: 'key={true,true,false}', - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: '[1, 2, 3]', - mykey3: 'ssssssssssssssssssssssssss', - mykey4: [false, true, false], - mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], - mykey6: true, - } - } - ], - operationType: WantAgent.OperationType.START_ABILITIES, - requestCode: 0, - wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] -} - -WantAgent.getWantAgent(wantAgentInfo).then((data) => { - console.info('==========================>getWantAgentCallback=======================>'); - wantAgent = data; - if (data) { - WantAgent.getOperationType(wantAgent, (OperationType) => { - console.log('----------- getOperationType ----------, OperationType: ' + OperationType); - }) - } -}); -``` - -## WantAgent.getOperationType9+ - -getOperationType(agent: WantAgent): Promise\; - -获取一个WantAgent的OperationType信息(Promise形式)。 - -**系统能力**:SystemCapability.Ability.AbilityRuntime.Core - -**参数:** - -| 参数名 | 类型 | 必填 | 说明 | -| ---------- | --------- | ---- | ------------- | -| agent | WantAgent | 是 | WantAgent对象。 | - -**返回值:** - -| 类型 | 说明 | -| ----------------------------------------------------------- | ------------------------------------------------------------ | -| Promise\ | 以Promise形式返回获取operationType的结果。 | - -**示例:** - -```ts -import WantAgent from '@ohos.wantAgent'; - -//wantAgent对象 -let wantAgent; - -//WantAgentInfo对象 -let wantAgentInfo = { - wants: [ - { - deviceId: 'deviceId', - bundleName: 'com.neu.setResultOnAbilityResultTest1', - abilityName: 'com.example.test.EntryAbility', - action: 'action1', - entities: ['entity1'], - type: 'MIMETYPE', - uri: 'key={true,true,false}', - parameters: - { - mykey0: 2222, - mykey1: [1, 2, 3], - mykey2: '[1, 2, 3]', - mykey3: 'ssssssssssssssssssssssssss', - mykey4: [false, true, false], - mykey5: ['qqqqq', 'wwwwww', 'aaaaaaaaaaaaaaaaa'], - mykey6: true, - } - } - ], - operationType: WantAgent.OperationType.START_ABILITIES, - requestCode: 0, - wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG] -} - -WantAgent.getWantAgent(wantAgentInfo).then((data) => { - console.info('==========================>getWantAgentCallback=======================>'); - wantAgent = data; - WantAgent.getOperationType(wantAgent).then((OperationType) => { - console.log('getOperationType success, OperationType: ' + OperationType); - }).catch((err) => { - console.log('getOperationType fail, err: ' + err); - }) -}); -``` - ## WantAgentFlags **系统能力**:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core diff --git a/zh-cn/application-dev/reference/apis/js-apis-webSocket.md b/zh-cn/application-dev/reference/apis/js-apis-webSocket.md index bb4cff3e2293e3d89c9ec53f1367f41d51b18104..a6474bf69108d1bb6e627fd086dabd26dec5ae04 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-webSocket.md +++ b/zh-cn/application-dev/reference/apis/js-apis-webSocket.md @@ -1,15 +1,16 @@ # @ohos.net.webSocket (WebSocket连接) -> **说明:** +> **说明:** > > 本模块首批接口从API version 6开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 -使用WebSocket建立服务器与客户端的双向连接,需要先通过[createWebSocket](#websocketcreatewebsocket)方法创建[WebSocket](#websocket)对象,然后通过[connect](#connect)方法连接到服务器。当连接成功后,客户端会收到[open](#onopen)事件的回调,之后客户端就可以通过[send](#send)方法与服务器进行通信。当服务器发信息给客户端时,客户端会收到[message](#onmessage)事件的回调。当客户端不要此连接时,可以通过调用[close](#close)方法主动断开连接,之后客户端会收到[close](#onclose)事件的回调。 +使用WebSocket建立服务器与客户端的双向连接,需要先通过[createWebSocket](#websocketcreatewebsocket)方法创建[WebSocket](#websocket)对象,然后通过[connect](#connect)方法连接到服务器。 +当连接成功后,客户端会收到[open](#onopen)事件的回调,之后客户端就可以通过[send](#send)方法与服务器进行通信。 +当服务器发信息给客户端时,客户端会收到[message](#onmessage)事件的回调。当客户端不要此连接时,可以通过调用[close](#close)方法主动断开连接,之后客户端会收到[close](#onclose)事件的回调。 若在上述任一过程中发生错误,客户端会收到[error](#onerror)事件的回调。 - ## 导入模块 ```js @@ -21,50 +22,54 @@ import webSocket from '@ohos.net.webSocket'; ```js import webSocket from '@ohos.net.webSocket'; -var defaultIpAddress = "ws://"; +let defaultIpAddress = "ws://"; let ws = webSocket.createWebSocket(); ws.on('open', (err, value) => { - console.log("on open, status:" + value['status'] + ", message:" + value['message']); - // 当收到on('open')事件时,可以通过send()方法与服务器进行通信 - ws.send("Hello, server!", (err, value) => { - if (!err) { - console.log("send success"); - } else { - console.log("send fail, err:" + JSON.stringify(err)); - } - }); + if (err != undefined) { + console.log(JSON.stringify(err)) + return + } + console.log("on open, status:" + value['status'] + ", message:" + value['message']); + // 当收到on('open')事件时,可以通过send()方法与服务器进行通信 + ws.send("Hello, server!", (err, value) => { + if (!err) { + console.log("send success"); + } else { + console.log("send fail, err:" + JSON.stringify(err)); + } + }); }); ws.on('message', (err, value) => { - console.log("on message, message:" + value); - // 当收到服务器的`bye`消息时(此消息字段仅为示意,具体字段需要与服务器协商),主动断开连接 - if (value === 'bye') { - ws.close((err, value) => { - if (!err) { - console.log("close success"); - } else { - console.log("close fail, err is " + JSON.stringify(err)); - } - }); - } + console.log("on message, message:" + value); + // 当收到服务器的`bye`消息时(此消息字段仅为示意,具体字段需要与服务器协商),主动断开连接 + if (value === 'bye') { + ws.close((err, value) => { + if (!err) { + console.log("close success"); + } else { + console.log("close fail, err is " + JSON.stringify(err)); + } + }); + } }); ws.on('close', (err, value) => { - console.log("on close, code is " + value.code + ", reason is " + value.reason); + console.log("on close, code is " + value.code + ", reason is " + value.reason); }); ws.on('error', (err) => { - console.log("on error, error:" + JSON.stringify(err)); + console.log("on error, error:" + JSON.stringify(err)); }); ws.connect(defaultIpAddress, (err, value) => { - if (!err) { - console.log("connect success"); - } else { - console.log("connect fail, err:" + JSON.stringify(err)); - } + if (!err) { + console.log("connect success"); + } else { + console.log("connect fail, err:" + JSON.stringify(err)); + } }); ``` ## webSocket.createWebSocket -createWebSocket\(\): WebSocket +createWebSocket(): WebSocket 创建一个WebSocket,里面包括建立连接、关闭连接、发送数据和订阅/取消订阅WebSocket连接的打开事件、接收到服务器消息事件、关闭事件和错误事件。 @@ -82,17 +87,19 @@ createWebSocket\(\): WebSocket let ws = webSocket.createWebSocket(); ``` - ## WebSocket 在调用WebSocket的方法前,需要先通过[webSocket.createWebSocket](#websocketcreatewebsocket)创建一个WebSocket。 ### connect -connect\(url: string, callback: AsyncCallback\): void +connect(url: string, callback: AsyncCallback\): void 根据URL地址,建立一个WebSocket连接,使用callback方式作为异步方法。 +> **说明:** +> 可通过监听error事件获得该接口的执行结果,错误发生时会得到错误码:200。 + **需要权限**:ohos.permission.INTERNET **系统能力**:SystemCapability.Communication.NetStack @@ -117,21 +124,23 @@ connect\(url: string, callback: AsyncCallback\): void let ws = webSocket.createWebSocket(); let url = "ws://" ws.connect(url, (err, value) => { - if (!err) { - console.log("connect success"); - } else { - console.log("connect fail, err:" + JSON.stringify(err)) - } + if (!err) { + console.log("connect success"); + } else { + console.log("connect fail, err:" + JSON.stringify(err)) + } }); ``` - ### connect -connect\(url: string, options: WebSocketRequestOptions, callback: AsyncCallback\): void +connect(url: string, options: WebSocketRequestOptions, callback: AsyncCallback\): void 根据URL地址和header,建立一个WebSocket连接,使用callback方式作为异步方法。 +> **说明:** +> 可通过监听error事件获得该接口的执行结果,错误发生时会得到错误码:200。 + **需要权限**:ohos.permission.INTERNET **系统能力**:SystemCapability.Communication.NetStack @@ -157,26 +166,28 @@ connect\(url: string, options: WebSocketRequestOptions, callback: AsyncCallback< let ws = webSocket.createWebSocket(); let url = "ws://" ws.connect(url, { - header: { - "key": "value", - "key2": "value2" - } + header: { + "key": "value", + "key2": "value2" + } }, (err, value) => { - if (!err) { - console.log("connect success"); - } else { - console.log("connect fail, err:" + JSON.stringify(err)) - } + if (!err) { + console.log("connect success"); + } else { + console.log("connect fail, err:" + JSON.stringify(err)) + } }); ``` - ### connect -connect\(url: string, options?: WebSocketRequestOptions\): Promise +connect(url: string, options?: WebSocketRequestOptions): Promise\ 根据URL地址和header,建立一个WebSocket连接,使用Promise方式作为异步方法。 +> **说明:** +> 可通过监听error事件获得该接口的执行结果,错误发生时会得到错误码:200。 + **需要权限**:ohos.permission.INTERNET **系统能力**:SystemCapability.Communication.NetStack @@ -208,16 +219,15 @@ let ws = webSocket.createWebSocket(); let url = "ws://" let promise = ws.connect(url); promise.then((value) => { - console.log("connect success") + console.log("connect success") }).catch((err) => { - console.log("connect fail, error:" + JSON.stringify(err)) + console.log("connect fail, error:" + JSON.stringify(err)) }); ``` - ### send -send\(data: string | ArrayBuffer, callback: AsyncCallback\): void +send(data: string | ArrayBuffer, callback: AsyncCallback\): void 通过WebSocket连接发送数据,使用callback方式作为异步方法。 @@ -229,7 +239,7 @@ send\(data: string | ArrayBuffer, callback: AsyncCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------------------ | ---- | ------------ | -| data | string \| ArrayBuffer 8+ | 是 | 发送的数据。 | +| data | string \| ArrayBuffer | 是 | 发送的数据。
API 6及更早版本仅支持string类型。API 8起同时支持string和ArrayBuffer类型。 | | callback | AsyncCallback\ | 是 | 回调函数。 | **错误码:** @@ -245,20 +255,19 @@ send\(data: string | ArrayBuffer, callback: AsyncCallback\): void let ws = webSocket.createWebSocket(); let url = "ws://" ws.connect(url, (err, value) => { - ws.send("Hello, server!", (err, value) => { - if (!err) { - console.log("send success"); - } else { - console.log("send fail, err:" + JSON.stringify(err)) - } - }); + ws.send("Hello, server!", (err, value) => { + if (!err) { + console.log("send success"); + } else { + console.log("send fail, err:" + JSON.stringify(err)) + } + }); }); ``` - ### send -send\(data: string | ArrayBuffer\): Promise +send(data: string | ArrayBuffer): Promise\ 通过WebSocket连接发送数据,使用Promise方式作为异步方法。 @@ -270,7 +279,7 @@ send\(data: string | ArrayBuffer\): Promise | 参数名 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | ------------ | -| data | string \| ArrayBuffer 8+ | 是 | 发送的数据。 | +| data | string \| ArrayBuffer | 是 | 发送的数据。
API 6及更早版本仅支持string类型。API 8起同时支持string和ArrayBuffer类型。 | **返回值:** @@ -291,19 +300,18 @@ send\(data: string | ArrayBuffer\): Promise let ws = webSocket.createWebSocket(); let url = "ws://" ws.connect(url, (err, value) => { - let promise = ws.send("Hello, server!"); - promise.then((value) => { - console.log("send success") - }).catch((err) => { - console.log("send fail, error:" + JSON.stringify(err)) - }); + let promise = ws.send("Hello, server!"); + promise.then((value) => { + console.log("send success") + }).catch((err) => { + console.log("send fail, error:" + JSON.stringify(err)) + }); }); ``` - ### close -close\(callback: AsyncCallback\): void +close(callback: AsyncCallback\): void 关闭WebSocket连接,使用callback方式作为异步方法。 @@ -328,20 +336,18 @@ close\(callback: AsyncCallback\): void ```js let ws = webSocket.createWebSocket(); -let url = "ws://" ws.close((err, value) => { - if (!err) { - console.log("close success") - } else { - console.log("close fail, err is " + JSON.stringify(err)) - } + if (!err) { + console.log("close success") + } else { + console.log("close fail, err is " + JSON.stringify(err)) + } }); ``` - ### close -close\(options: WebSocketCloseOptions, callback: AsyncCallback\): void +close(options: WebSocketCloseOptions, callback: AsyncCallback\): void 根据可选参数code和reason,关闭WebSocket连接,使用callback方式作为异步方法。 @@ -367,23 +373,21 @@ close\(options: WebSocketCloseOptions, callback: AsyncCallback\): void ```js let ws = webSocket.createWebSocket(); -let url = "ws://" ws.close({ - code: 1000, - reason: "your reason" + code: 1000, + reason: "your reason" }, (err, value) => { - if (!err) { - console.log("close success") - } else { - console.log("close fail, err is " + JSON.stringify(err)) - } + if (!err) { + console.log("close success") + } else { + console.log("close fail, err is " + JSON.stringify(err)) + } }); ``` - ### close -close\(options?: WebSocketCloseOptions\): Promise +close(options?: WebSocketCloseOptions): Promise\ 根据可选参数code和reason,关闭WebSocket连接,使用Promise方式作为异步方法。 @@ -414,22 +418,20 @@ close\(options?: WebSocketCloseOptions\): Promise ```js let ws = webSocket.createWebSocket(); -let url = "ws://" let promise = ws.close({ - code: 1000, - reason: "your reason" + code: 1000, + reason: "your reason" }); promise.then((value) => { - console.log("close success") + console.log("close success") }).catch((err) => { - console.log("close fail, err is " + JSON.stringify(err)) + console.log("close fail, err is " + JSON.stringify(err)) }); ``` +### on('open') -### on\('open'\) - -on\(type: 'open', callback: AsyncCallback\): void +on(type: 'open', callback: AsyncCallback\): void 订阅WebSocket的打开事件,使用callback方式作为异步方法。 @@ -442,25 +444,23 @@ on\(type: 'open', callback: AsyncCallback\): void | type | string | 是 | 'open':WebSocket的打开事件。 | | callback | AsyncCallback\ | 是 | 回调函数。 | - **示例:** ```js let ws = webSocket.createWebSocket(); ws.on('open', (err, value) => { - console.log("on open, status:" + value['status'] + ", message:" + value['message']); + console.log("on open, status:" + value['status'] + ", message:" + value['message']); }); ``` +### off('open') -### off\('open'\) - -off\(type: 'open', callback?: AsyncCallback\): void +off(type: 'open', callback?: AsyncCallback\): void 取消订阅WebSocket的打开事件,使用callback方式作为异步方法。 ->![](public_sys-resources/icon-note.gif) **说明:** ->可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 +> **说明:** +> 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 **系统能力**:SystemCapability.Communication.NetStack @@ -476,22 +476,21 @@ off\(type: 'open', callback?: AsyncCallback\): void ```js let ws = webSocket.createWebSocket(); let callback1 = (err, value) => { - console.log("on open, status:" + value['status'] + ", message:" + value['message']); + console.log("on open, status:" + value['status'] + ", message:" + value['message']); } ws.on('open', callback1); // 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅 ws.off('open', callback1); ``` +### on('message') -### on\('message'\) - -on\(type: 'message', callback: AsyncCallback\): void +on(type: 'message', callback: AsyncCallback\): void 订阅WebSocket的接收到服务器消息事件,使用callback方式作为异步方法。每个消息最大长度为4K,超过4K自动分片。 ->![](public_sys-resources/icon-note.gif) **说明:** ->AsyncCallback中的数据可以是字符串\(API 6\)或ArrayBuffer\(API 8\)。 +> **说明:** +> AsyncCallback中的数据可以是字符串(API 6)或ArrayBuffer(API 8)。 **系统能力**:SystemCapability.Communication.NetStack @@ -507,20 +506,19 @@ on\(type: 'message', callback: AsyncCallback\): void ```js let ws = webSocket.createWebSocket(); ws.on('message', (err, value) => { - console.log("on message, message:" + value); + console.log("on message, message:" + value); }); ``` +### off('message') -### off\('message'\) - -off\(type: 'message', callback?: AsyncCallback\): void +off(type: 'message', callback?: AsyncCallback\): void 取消订阅WebSocket的接收到服务器消息事件,使用callback方式作为异步方法。每个消息最大长度为4K,超过4K自动分片。 ->![](public_sys-resources/icon-note.gif) **说明:** ->AsyncCallback中的数据可以是字符串\(API 6\)或ArrayBuffer\(API 8\)。 ->可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 +> **说明:** +> AsyncCallback中的数据可以是字符串(API 6)或ArrayBuffer(API 8)。 +> 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 **系统能力**:SystemCapability.Communication.NetStack @@ -538,10 +536,9 @@ let ws = webSocket.createWebSocket(); ws.off('message'); ``` +### on('close') -### on\('close'\) - -on\(type: 'close', callback: AsyncCallback<\{ code: number, reason: string \}\>\): void +on(type: 'close', callback: AsyncCallback\<{ code: number, reason: string }\>): void 订阅WebSocket的关闭事件,使用callback方式作为异步方法。 @@ -552,26 +549,25 @@ on\(type: 'close', callback: AsyncCallback<\{ code: number, reason: string \}\>\ | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------------------------- | ---- | ------------------------------ | | type | string | 是 | 'close':WebSocket的关闭事件。 | -| callback | AsyncCallback<{ code: number, reason: string }> | 是 | 回调函数。 | +| callback | AsyncCallback\<{ code: number, reason: string }\> | 是 | 回调函数。
close:close错误码,reason:错误码说明 | **示例:** ```js let ws = webSocket.createWebSocket(); ws.on('close', (err, value) => { - console.log("on close, code is " + value.code + ", reason is " + value.reason); + console.log("on close, code is " + value.code + ", reason is " + value.reason); }); ``` +### off('close') -### off\('close'\) - -off\(type: 'close', callback?: AsyncCallback<\{ code: number, reason: string \}\>\): void +off(type: 'close', callback?: AsyncCallback\<{ code: number, reason: string }\>): void 取消订阅WebSocket的关闭事件,使用callback方式作为异步方法。 ->![](public_sys-resources/icon-note.gif) **说明:** ->可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 +> **说明:** +> 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 **系统能力**:SystemCapability.Communication.NetStack @@ -580,7 +576,7 @@ off\(type: 'close', callback?: AsyncCallback<\{ code: number, reason: string \}\ | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------------------------- | ---- | ------------------------------ | | type | string | 是 | 'close':WebSocket的关闭事件。 | -| callback | AsyncCallback<{ code: number, reason: string }> | 否 | 回调函数。 | +| callback | AsyncCallback\<{ code: number, reason: string }\> | 否 | 回调函数。
close:close错误码,reason:错误码说明 | **示例:** @@ -589,10 +585,9 @@ let ws = webSocket.createWebSocket(); ws.off('close'); ``` +### on('error') -### on\('error'\) - -on\(type: 'error', callback: ErrorCallback\): void +on(type: 'error', callback: ErrorCallback): void 订阅WebSocket的Error事件,使用callback方式作为异步方法。 @@ -603,26 +598,25 @@ on\(type: 'error', callback: ErrorCallback\): void | 参数名 | 类型 | 必填 | 说明 | | -------- | ------------- | ---- | ------------------------------- | | type | string | 是 | 'error':WebSocket的Error事件。 | -| callback | ErrorCallback | 是 | 回调函数。 | +| callback | ErrorCallback | 是 | 回调函数。
常见错误码:200 | **示例:** ```js let ws = webSocket.createWebSocket(); ws.on('error', (err) => { - console.log("on error, error:" + JSON.stringify(err)) + console.log("on error, error:" + JSON.stringify(err)) }); ``` +### off('error') -### off\('error'\) - -off\(type: 'error', callback?: ErrorCallback\): void +off(type: 'error', callback?: ErrorCallback): void 取消订阅WebSocket的Error事件,使用callback方式作为异步方法。 ->![](public_sys-resources/icon-note.gif) **说明:** ->可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 +> **说明:** +> 可以指定传入on中的callback取消一个订阅,也可以不指定callback清空所有订阅。 **系统能力**:SystemCapability.Communication.NetStack @@ -640,23 +634,21 @@ let ws = webSocket.createWebSocket(); ws.off('error'); ``` - ## WebSocketRequestOptions 建立WebSocket连接时,可选参数的类型和说明。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetStack。 +**系统能力**:SystemCapability.Communication.NetStack | 名称 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | ------------------------------------------------------------ | | header | Object | 否 | 建立WebSocket连接可选参数,代表建立连接时携带的HTTP头信息。参数内容自定义,也可以不指定。 | - ## WebSocketCloseOptions 关闭WebSocket连接时,可选参数的类型和说明。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetStack。 +**系统能力**:SystemCapability.Communication.NetStack | 名称 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | ------------------------------------------------------------ | @@ -667,7 +659,7 @@ ws.off('error'); 发送给服务端的错误码可以自行定义,下面的列表仅供参考。 -**系统能力**:以下各项对应的系统能力均为SystemCapability.Communication.NetStack。 +**系统能力**:SystemCapability.Communication.NetStack | 值 | 说明 | | :-------- | :----------------- | diff --git a/zh-cn/application-dev/reference/apis/js-apis-webview.md b/zh-cn/application-dev/reference/apis/js-apis-webview.md index d59bab84d8990988055fb4975eb010a084c8c05a..ec1919d679632e574c605d50570fe0eb4cc32b53 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-webview.md +++ b/zh-cn/application-dev/reference/apis/js-apis-webview.md @@ -2,7 +2,7 @@ # @ohos.web.webview (Webview) -提供web控制能力。 +@ohos.web.webview提供web控制能力,[web](../arkui-ts/ts-basic-components-web.md)组件提供具有网页显示能力。 > **说明:** > @@ -81,7 +81,7 @@ import web_webview from '@ohos.web.webview' @Component struct WebComponent { controller: web_webview.WebviewController = new web_webview.WebviewController(); - msgPort: WebMessagePort[] = null; + msgPort: web_webview.WebMessagePort[] = null; build() { Column() { @@ -103,7 +103,7 @@ struct WebComponent { postMessageEvent(message: WebMessage): void -发送消息。完整示例代码参考[postMessage](#postmessage) +发送消息。完整示例代码参考[postMessage](#postmessage)。 **系统能力:** SystemCapability.Web.Webview.Core @@ -155,7 +155,7 @@ struct WebComponent { onMessageEvent(callback: (result: WebMessage) => void): void -注册回调函数,接收HTML5侧发送过来的消息。完整示例代码参考[postMessage](#postmessage) +注册回调函数,接收HTML5侧发送过来的消息。完整示例代码参考[postMessage](#postmessage)。 **系统能力:** SystemCapability.Web.Webview.Core @@ -214,6 +214,240 @@ struct WebComponent { } ``` +### isExtentionType10+ + +**系统能力:** SystemCapability.Web.Webview.Core + +| 名称 | 类型 | 可读 | 可写 | 说明 | +| ------------ | ------ | ---- | ---- | ------------------------------------------------| +| isExtentionType | boolean | 是 | 否 | 创建WebMessagePort时是否指定使用扩展增强接口。 | + +### postMessageEventExt10+ + +postMessageEventExt(message: WebMessageExt): void + +发送消息。完整示例代码参考[onMessageEventExt](#onmessageeventext10)。 + +**系统能力:** SystemCapability.Web.Webview.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | :------------- | +| message | [WebMessageExt](#webmessageext) | 是 | 要发送的消息。 | + +**错误码:** + +以下错误码的详细介绍请参见[webview错误码](../errorcodes/errorcode-webview.md)。 + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------- | +| 17100010 | Can not post message using this port. | + + +### onMessageEventExt10+ + +onMessageEventExt(callback: (result: WebMessageExt) => void): void + +注册回调函数,接收HTML5侧发送过来的消息。 + +**系统能力:** SystemCapability.Web.Webview.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | ---- | :------------------- | +| result | [WebMessageExt](#webmessageext10) | 是 | 接收到的消息。 | + +**错误码:** + +以下错误码的详细介绍请参见[webview错误码](../errorcodes/errorcode-webview.md)。 + +| 错误码ID | 错误信息 | +| -------- | ----------------------------------------------- | +| 17100006 | Can not register message event using this port. | + +**示例:** + +```ts +// xxx.ets +import web_webview from '@ohos.web.webview' + +// 应用与网页互发消息的示例:使用"init_web_messageport"的通道,通过端口0在应用侧接受网页发送的消息,通过端口1在网页侧接受应用发送的消息。 +@Entry +@Component +struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController(); + ports: web_webview.WebMessagePort[] = null; + nativePort: web_webview.WebMessagePort = null; + @State msg1:string = ""; + @State msg2:string = ""; + message: web_webview.WebMessageExt = new web_webview.WebMessageExt(); + build() { + Column() { + Text(this.msg1).fontSize(16) + Text(this.msg2).fontSize(16) + Button('SendToH5') + .onClick(() => { + // 使用本侧端口发送消息给HTML5 + try { + console.log("In eTS side send true start"); + if (this.nativePort) { + this.message.setString("helloFromEts"); + this.nativePort.postMessageEventExt(this.message); + } + } + catch (error) { + console.log("In eTS side send message catch error:" + error.code + ", msg:" + error.message); + } + }) + + Web({ src: $rawfile('index.html'), controller: this.controller }) + .onPageEnd((e)=>{ + console.log("In eTS side message onPageEnd init mesaage channel"); + // 1. 创建消息端口 + this.ports = this.controller.createWebMessagePorts(true); + // 2. 发送端口1到HTML5 + this.controller.postMessage("init_web_messageport", [this.ports[1]], "*"); + // 3. 保存端口0到本地 + this.nativePort = this.ports[0]; + // 4. 设置回调函数 + this.nativePort.onMessageEventExt((result) => { + console.log("In eTS side got message"); + try { + var type = result.getType(); + console.log("In eTS side getType:" + type); + switch (type) { + case web_webview.WebMessageType.STRING: { + this.msg1 = "result type:" + typeof (result.getString()); + this.msg2 = "result getString:" + ((result.getString())); + break; + } + case web_webview.WebMessageType.NUMBER: { + this.msg1 = "result type:" + typeof (result.getNumber()); + this.msg2 = "result getNumber:" + ((result.getNumber())); + break; + } + case web_webview.WebMessageType.BOOLEAN: { + this.msg1 = "result type:" + typeof (result.getBoolean()); + this.msg2 = "result getBoolean:" + ((result.getBoolean())); + break; + } + case web_webview.WebMessageType.ARRAY_BUFFER: { + this.msg1 = "result type:" + typeof (result.getArrayBuffer()); + this.msg2 = "result getArrayBuffer byteLength:" + ((result.getArrayBuffer().byteLength)); + break; + } + case web_webview.WebMessageType.ARRAY: { + this.msg1 = "result type:" + typeof (result.getArray()); + this.msg2 = "result getArray:" + result.getArray(); + break; + } + case web_webview.WebMessageType.ERROR: { + this.msg1 = "result type:" + typeof (result.getError()); + this.msg2 = "result getError:" + result.getError(); + break; + } + default: { + this.msg1 = "default break, type:" + type; + break; + } + } + } + catch (resError) { + console.log(`log error code: ${resError.code}, Message: ${resError.message}`); + } + }); + }) + } + } +} +``` + +```html + + + + + WebView MessagePort Demo + + + +

Html5 Send and Receive Message

+

Receive string:

+

Receive arraybuffer:

+
+
+
+ + + +``` + +```js +//index.js +var h5Port; +window.addEventListener('message', function(event) { + if (event.data == 'init_web_messageport') { + if(event.ports[0] != null) { + h5Port = event.ports[0]; // 1. 保存从ets侧发送过来的端口 + h5Port.onmessage = function(event) { + console.log("hwd In html got message"); + // 2. 接收ets侧发送过来的消息. + var result = event.data; + console.log("In html got message, typeof: ", typeof(result)); + console.log("In html got message, result: ", (result)); + if (typeof(result) == "string") { + console.log("In html got message, String: ", result); + document.getElementById("msg").innerHTML = "String:" + result; + } else if (typeof(result) == "number") { + console.log("In html side got message, number: ", result); + document.getElementById("msg").innerHTML = "Number:" + result; + } else if (typeof(result) == "boolean") { + console.log("In html side got message, boolean: ", result); + document.getElementById("msg").innerHTML = "Boolean:" + result; + } else if (typeof(result) == "object") { + if (result instanceof ArrayBuffer) { + document.getElementById("msg2").innerHTML = "ArrayBuffer:" + result.byteLength; + console.log("In html got message, byteLength: ", result.byteLength); + } else if (result instanceof Error) { + console.log("In html error message, err:" + (result)); + console.log("In html error message, typeof err:" + typeof(result)); + document.getElementById("msg2").innerHTML = "Error:" + result.name + ", msg:" + result.message; + } else if (result instanceof Array) { + console.log("In html got message, Array"); + console.log("In html got message, Array length:" + result.length); + console.log("In html got message, Array[0]:" + (result[0])); + console.log("In html got message, typeof Array[0]:" + typeof(result[0])); + document.getElementById("msg2").innerHTML = "Array len:" + result.length + ", value:" + result; + } else { + console.log("In html got message, not any instance of support type"); + document.getElementById("msg").innerHTML = "not any instance of support type"; + } + } else { + console.log("In html got message, not support type"); + document.getElementById("msg").innerHTML = "not support type"; + } + } + h5Port.onmessageerror = (event) => { + console.error(`hwd In html Error receiving message: ${event}`); + }; + } + } +}) + +// 使用h5Port往ets侧发送String类型的消息. +function postStringToApp() { + if (h5Port) { + console.log("In html send string message"); + h5Port.postMessage("hello"); + console.log("In html send string message end"); + } else { + console.error("In html h5port is null, please init first"); + } +} +``` + ## WebviewController 通过WebviewController可以控制Web组件各种行为。一个WebviewController对象只能控制一个Web组件,且必须在Web组件和WebviewController绑定后,才能调用WebviewController上的方法(静态方法除外)。 @@ -245,7 +479,7 @@ export default class EntryAbility extends UIAbility { } ``` -### setHttpDns +### setHttpDns10+ static setHttpDns(secureDnsMode:SecureDnsMode, secureDnsConfig:string): void @@ -422,7 +656,8 @@ struct WebComponent { } ``` -加载本地网页 +加载本地网页,加载本地资源文件有三种方式。 +1.$rawfile方式。 ```ts // xxx.ets import web_webview from '@ohos.web.webview' @@ -448,7 +683,7 @@ struct WebComponent { } } ``` - +2.resources协议。 ```ts // xxx.ets import web_webview from '@ohos.web.webview' @@ -475,6 +710,8 @@ struct WebComponent { } ``` +3.通过沙箱路径加载本地文件,可以参考[web](../arkui-ts/ts-basic-components-web.md#web)加载沙箱路径的示例代码。 + ```html @@ -1229,6 +1466,232 @@ struct WebComponent { } ``` + +### runJavaScriptExt10+ + +runJavaScriptExt(script: string, callback : AsyncCallback\): void + +异步执行JavaScript脚本,并通过回调方式返回脚本执行的结果。runJavaScriptExt需要在loadUrl完成后,比如onPageEnd中调用。 + +**系统能力:** SystemCapability.Web.Webview.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------------------- | ---- | ---------------------------- | +| script | string | 是 | JavaScript脚本。 | +| callback | AsyncCallback\<[JsMessageExt](#jsmessageext10)\> | 是 | 回调执行JavaScript脚本结果。 | + +**错误码:** + +以下错误码的详细介绍请参见[webview错误码](../errorcodes/errorcode-webview.md)。 + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------------------ | +| 17100001 | Init error. The WebviewController must be associated with a Web compoent. | + +**示例:** + +```ts +import web_webview from '@ohos.web.webview' + +@Entry +@Component +struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController(); + @State msg1: string = '' + @State msg2: string = '' + + build() { + Column() { + Text(this.msg1).fontSize(20) + Text(this.msg2).fontSize(20) + Web({ src: $rawfile('index.html'), controller: this.controller }) + .javaScriptAccess(true) + .onPageEnd(e => { + try { + this.controller.runJavaScriptExt( + 'test()', + (error, result) => { + if (error) { + console.info(`run JavaScript error: ` + JSON.stringify(error)) + return; + } + if (result) { + try { + var type = result.getType(); + switch (type) { + case web_webview.JsMessageType.STRING: { + this.msg1 = "result type:" + typeof (result.getString()); + this.msg2 = "result getString:" + ((result.getString())); + break; + } + case web_webview.JsMessageType.NUMBER: { + this.msg1 = "result type:" + typeof (result.getNumber()); + this.msg2 = "result getNumber:" + ((result.getNumber())); + break; + } + case web_webview.JsMessageType.BOOLEAN: { + this.msg1 = "result type:" + typeof (result.getBoolean()); + this.msg2 = "result getBoolean:" + ((result.getBoolean())); + break; + } + case web_webview.JsMessageType.ARRAY_BUFFER: { + this.msg1 = "result type:" + typeof (result.getArrayBuffer()); + this.msg2 = "result getArrayBuffer byteLength:" + ((result.getArrayBuffer().byteLength)); + break; + } + case web_webview.JsMessageType.ARRAY: { + this.msg1 = "result type:" + typeof (result.getArray()); + this.msg2 = "result getArray:" + result.getArray(); + break; + } + default: { + this.msg1 = "default break, type:" + type; + break; + } + } + } + catch (resError) { + console.log(`log error code: ${resError.code}, Message: ${resError.message}`); + } + } + }); + console.info('url: ', e.url); + } catch (error) { + console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); + } + }) + } + } +} + +//index.html + + + +

run JavaScript Ext demo

+ + + +``` + +### runJavaScriptExt10+ + +runJavaScriptExt(script: string): Promise\ + +异步执行JavaScript脚本,并通过Promise方式返回脚本执行的结果。runJavaScriptExt需要在loadUrl完成后,比如onPageEnd中调用。 + +**系统能力:** SystemCapability.Web.Webview.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | -------- | ---- | ---------------- | +| script | string | 是 | JavaScript脚本。 | + +**返回值:** + +| 类型 | 说明 | +| --------------- | --------------------------------------------------- | +| Promise\<[JsMessageExt](#jsmessageext10)> | Promise实例,返回脚本执行的结果。 | + +**错误码:** + +以下错误码的详细介绍请参见[webview错误码](../errorcodes/errorcode-webview.md)。 + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------------------ | +| 17100001 | Init error. The WebviewController must be associated with a Web compoent. | + +**示例:** + +```ts +// xxx.ets +import web_webview from '@ohos.web.webview' + +@Entry +@Component +struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController(); + @State webResult: string = ''; + @State msg1: string = '' + @State msg2: string = '' + + build() { + Column() { + Text(this.webResult).fontSize(20) + Text(this.msg1).fontSize(20) + Text(this.msg2).fontSize(20) + Web({ src: $rawfile('index.html'), controller: this.controller }) + .javaScriptAccess(true) + .onPageEnd(e => { + this.controller.runJavaScriptExt('test()') + .then((result) => { + try { + var type = result.getType(); + switch (type) { + case web_webview.JsMessageType.STRING: { + this.msg1 = "result type:" + typeof (result.getString()); + this.msg2 = "result getString:" + ((result.getString())); + break; + } + case web_webview.JsMessageType.NUMBER: { + this.msg1 = "result type:" + typeof (result.getNumber()); + this.msg2 = "result getNumber:" + ((result.getNumber())); + break; + } + case web_webview.JsMessageType.BOOLEAN: { + this.msg1 = "result type:" + typeof (result.getBoolean()); + this.msg2 = "result getBoolean:" + ((result.getBoolean())); + break; + } + case web_webview.JsMessageType.ARRAY_BUFFER: { + this.msg1 = "result type:" + typeof (result.getArrayBuffer()); + this.msg2 = "result getArrayBuffer byteLength:" + ((result.getArrayBuffer().byteLength)); + break; + } + case web_webview.JsMessageType.ARRAY: { + this.msg1 = "result type:" + typeof (result.getArray()); + this.msg2 = "result getArray:" + result.getArray(); + break; + } + default: { + this.msg1 = "default break, type:" + type; + break; + } + } + } + catch (resError) { + console.log(`log error code: ${resError.code}, Message: ${resError.message}`); + } + }) + .catch(function (error) { + console.error("error: " + error); + }) + }) + } + } +} + +//index.html + + + +

run JavaScript Ext demo

+ + + +``` + ### deleteJavaScriptRegister deleteJavaScriptRegister(name: string): void @@ -1565,12 +2028,18 @@ struct WebComponent { ### createWebMessagePorts - createWebMessagePorts(): Array\ +createWebMessagePorts(isExtentionType?: boolean): Array\ -创建Web消息端口。 +创建Web消息端口。完整示例代码参考[onMessageEventExt](#onmessageeventext10)。 **系统能力:** SystemCapability.Web.Webview.Core +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ---------------------- | ---- | :------------------------------| +| isExtentionType10+ | boolean | 否 | 是否使用扩展增强接口,默认false不使用。 | + **返回值:** | 类型 | 说明 | @@ -1626,8 +2095,8 @@ postMessage(name: string, ports: Array\, uri: string): void | 参数名 | 类型 | 必填 | 说明 | | ------ | ---------------------- | ---- | :------------------------------- | -| name | string | 是 | 要发送的消息,包含数据和消息端口。 | -| ports | Array\ | 是 | 接收该消息的URI。 | +| name | string | 是 | 要发送的消息名称。 | +| ports | Array\ | 是 | 要发送的消息端口。 | | uri | string | 是 | 接收该消息的URI。 | **错误码:** @@ -2379,6 +2848,8 @@ backOrForward(step: number): void 按照历史栈,前进或者后退指定步长的页面,当历史栈中不存在对应步长的页面时,不会进行页面跳转。 +前进或者后退页面时,直接使用已加载过的网页,无需重新加载网页。 + **系统能力:** SystemCapability.Web.Webview.Core **参数:** @@ -3117,10 +3588,11 @@ serializeWebState(): Uint8Array **示例:** +1.对文件的操作需要导入文件管理模块,详情请参考[文件管理](./js-apis-file-fs.md)。 ```ts // xxx.ets import web_webview from '@ohos.web.webview'; -import fileio from '@ohos.fileio'; +import fs from '@ohos.file.fs'; @Entry @Component @@ -3133,11 +3605,13 @@ struct WebComponent { .onClick(() => { try { let state = this.controller.serializeWebState(); - let path = globalThis.AbilityContext.cacheDir; + // globalThis.cacheDir从MainAbility.ts中获取。 + let path = globalThis.cacheDir; path += '/WebState'; - let fd = fileio.openSync(path, 0o2 | 0o100, 0o666); - fileio.writeSync(fd, state.buffer); - fileio.closeSync(fd); + // 以同步方法打开文件。 + let file = fs.openSync(path, fs.OpenMode.READ_WRITE | fs.OpenMode.CREATE); + fs.writeSync(file.fd, state.buffer); + fs.closeSync(file.fd); } catch (error) { console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); } @@ -3148,6 +3622,21 @@ struct WebComponent { } ``` +2.修改MainAbility.ts。 +获取应用缓存文件路径。 +```ts +// xxx.ts +import UIAbility from '@ohos.app.ability.UIAbility'; +import web_webview from '@ohos.web.webview'; + +export default class MainAbility extends UIAbility { + onCreate(want, launchParam) { + // 通过在globalThis对象上绑定cacheDir,可以实现UIAbility组件与Page之间的数据同步。 + globalThis.cacheDir = this.context.cacheDir; + } +} +``` + ### restoreWebState restoreWebState(state: Uint8Array): void @@ -3172,10 +3661,11 @@ restoreWebState(state: Uint8Array): void **示例:** +1.对文件的操作需要导入文件管理模块,详情请参考[文件管理](./js-apis-file-fs.md)。 ```ts // xxx.ets import web_webview from '@ohos.web.webview'; -import fileio from '@ohos.fileio'; +import fs from '@ohos.file.fs'; @Entry @Component @@ -3187,17 +3677,22 @@ struct WebComponent { Button('RestoreWebState') .onClick(() => { try { - let path = globalThis.AbilityContext.cacheDir; + // globalThis.cacheDir从MainAbility.ts中获取。 + let path = globalThis.cacheDir; path += '/WebState'; - let fd = fileio.openSync(path, 0o002, 0o666); - let stat = fileio.fstatSync(fd); + // 以同步方法打开文件。 + let file = fs.openSync(path, fs.OpenMode.READ_WRITE); + let stat = fs.statSync(path); let size = stat.size; let buf = new ArrayBuffer(size); - fileio.read(fd, buf, (err, data) => { - if (data) { - this.controller.restoreWebState(new Uint8Array(data.buffer)); + fs.read(file.fd, buf, (err, readLen) => { + if (err) { + console.info("mkdir failed with error message: " + err.message + ", error code: " + err.code); + } else { + console.info("read file data succeed"); + this.controller.restoreWebState(new Uint8Array(buf.slice(0, readLen))); + fs.closeSync(file); } - fileio.closeSync(fd); }); } catch (error) { console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); @@ -3209,6 +3704,21 @@ struct WebComponent { } ``` +2.修改MainAbility.ts。 +获取应用缓存文件路径。 +```ts +// xxx.ts +import UIAbility from '@ohos.app.ability.UIAbility'; +import web_webview from '@ohos.web.webview'; + +export default class MainAbility extends UIAbility { + onCreate(want, launchParam) { + // 通过在globalThis对象上绑定cacheDir,可以实现UIAbility组件与Page之间的数据同步。 + globalThis.cacheDir = this.context.cacheDir; + } +} +``` + ### customizeSchemes static customizeSchemes(schemes: Array\): void @@ -3572,7 +4082,7 @@ struct Index { } ``` -### setAudioMuted +### setAudioMuted10+ setAudioMuted(mute: boolean): void @@ -3586,11 +4096,19 @@ setAudioMuted(mute: boolean): void | -------- | ------- | ---- | -------------------------------------- | | mute | boolean | 是 | 表示是否将网页设置为静音状态,true表示设置为静音状态,false表示取消静音状态。 | -**示例:** +**错误码:** -```ts -// xxx.ets -import web_webview from '@ohos.web.webview' +以下错误码的详细介绍请参见[webview错误码](../errorcodes/errorcode-webview.md)。 + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------------------------------ | +| 17100001 | Init error. The WebviewController must be associated with a Web component. | + +**示例:** + +```ts +// xxx.ets +import web_webview from '@ohos.web.webview' @Entry @Component @@ -3626,7 +4144,7 @@ static getCookie(url: string): string | 参数名 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | :------------------------ | -| url | string | 是 | 要获取的cookie所属的url。 | +| url | string | 是 | 要获取的cookie所属的url,建议使用完整的url。 | **返回值:** @@ -3682,7 +4200,7 @@ static setCookie(url: string, value: string): void | 参数名 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | :------------------------ | -| url | string | 是 | 要设置的cookie所属的url。 | +| url | string | 是 | 要设置的cookie所属的url,建议使用完整的url。 | | value | string | 是 | 要设置的cookie的值。 | **错误码:** @@ -5112,6 +5630,463 @@ Web组件返回的请求/响应头对象。 | string | 字符串类型数据。 | | ArrayBuffer | 二进制类型数据。 | +## JsMessageType10+ + +[runJavaScirptExt](#runjavascriptext10)接口脚本执行后返回的结果的类型。 + +**系统能力:** SystemCapability.Web.Webview.Core + +| 名称 | 值 | 说明 | +| ------------ | -- |--------------------------------- | +| NOT_SUPPORT | 0 |不支持的数据类型。| +| STRING | 1 |字符串类型。| +| NUMBER | 2 |数值类型。| +| BOOLEAN | 3 |布尔类型。| +| ARRAY_BUFFER | 4 |原始二进制数据缓冲区。| +| ARRAY | 5 |数组类型| + + +## WebMessageType10+ + +[webMessagePort](#webmessageport)接口所支持的数据类型。 + +**系统能力:** SystemCapability.Web.Webview.Core + +| 名称 | 值 | 说明 | +| ------------ | -- |------------------------------- | +| NOT_SUPPORT | 0 |不支持的数据类型。| +| STRING | 1 |字符串类型。| +| NUMBER | 2 |数值类型。| +| BOOLEAN | 3 |布尔类型。| +| ARRAY_BUFFER | 4 |原始二进制数据缓冲区。| +| ARRAY | 5 |数组类型。| +| ERROR | 6 |错误类型。| + +## JsMessageExt10+ + +[runJavaScirptExt](#runjavascriptext10)接口执行脚本返回的数据对象。 + +### getType10+ + +getType(): JsMessageType + +获取数据对象的类型。 + +**系统能力:** SystemCapability.Web.Webview.Core + +**返回值:** + +| 类型 | 说明 | +| --------------| --------------------------------------------------------- | +| [JsMessageType](#jsmessagetype10) | [runJavaScirptExt](#runjavascriptext10)接口脚本执行后返回的结果的类型。 | + +### getString10+ + +getString(): string + +获取数据对象的字符串类型数据。完整示例代码参考[runJavaScriptExt](#runjavascriptext10)。 + +**系统能力:** SystemCapability.Web.Webview.Core + +**返回值:** + +| 类型 | 说明 | +| --------------| ------------- | +| string | 返回字符串类型的数据。 | + +**错误码:** + +以下错误码的详细介绍请参见[webview错误码](../errorcodes/errorcode-webview.md)。 + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the result. | + + +### getNumber10+ + +getNumber(): number + +获取数据对象的数值类型数据。完整示例代码参考[runJavaScriptExt](#runjavascriptext10)。 + +**系统能力:** SystemCapability.Web.Webview.Core + +**返回值:** + +| 类型 | 说明 | +| --------------| ------------- | +| number | 返回数值类型的数据。 | + +**错误码:** + +以下错误码的详细介绍请参见[webview错误码](../errorcodes/errorcode-webview.md)。 + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the result. | + +### getBoolean10+ + +getBoolean(): boolean + +获取数据对象的布尔类型数据。完整示例代码参考[runJavaScriptExt](#runjavascriptext10)。 + +**系统能力:** SystemCapability.Web.Webview.Core + +**返回值:** + +| 类型 | 说明 | +| --------------| ------------- | +| boolean | 返回布尔类型的数据。 | + +**错误码:** + +以下错误码的详细介绍请参见[webview错误码](../errorcodes/errorcode-webview.md)。 + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the result. | + + +### getArrayBuffer10+ + +getArrayBuffer(): ArrayBuffer + +获取数据对象的原始二进制数据。完整示例代码参考[runJavaScriptExt](#runjavascriptext10)。 +**系统能力:** SystemCapability.Web.Webview.Core + +**返回值:** + +| 类型 | 说明 | +| --------------| ------------- | +| ArrayBuffer | 返回原始二进制数据。 | + +**错误码:** + +以下错误码的详细介绍请参见[webview错误码](../errorcodes/errorcode-webview.md)。 + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the result. | + +### getArray10+ + +getArray(): Array\ + +获取数据对象的数组类型数据。完整示例代码参考[runJavaScriptExt](#runjavascriptext10)。 + +**系统能力:** SystemCapability.Web.Webview.Core + +**返回值:** + +| 类型 | 说明 | +| --------------| ------------- | +| Array\ | 返回数组类型的数据。 | + +**错误码:** + +以下错误码的详细介绍请参见[webview错误码](../errorcodes/errorcode-webview.md)。 + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the result. | + + +## WebMessageExt10+ + +[webMessagePort](#webmessageport)接口接收、发送的的数据对象。 + +### getType10+ + +getType(): WebMessageType + +获取数据对象的类型。 + +**系统能力:** SystemCapability.Web.Webview.Core + +**返回值:** + +| 类型 | 说明 | +| --------------| --------------------------------------------------------- | +| [WebMessageType](#webmessagetype10) | [webMessagePort](#webmessageport)接口所支持的数据类型。 | + + +### getString10+ + +getString(): string + +获取数据对象的字符串类型数据。完整示例代码参考[onMessageEventExt](#onmessageeventext10)。 + +**系统能力:** SystemCapability.Web.Webview.Core + +**返回值:** + +| 类型 | 说明 | +| --------------| ------------- | +| string | 返回字符串类型的数据。 | + +**错误码:** + +以下错误码的详细介绍请参见[webview错误码](../errorcodes/errorcode-webview.md)。 + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the web message. | + + +### getNumber10+ + +getNumber(): number + +获取数据对象的数值类型数据。完整示例代码参考[onMessageEventExt](#onmessageeventext10)。 + +**系统能力:** SystemCapability.Web.Webview.Core + +**返回值:** + +| 类型 | 说明 | +| --------------| ------------- | +| number | 返回数值类型的数据。 | + +**错误码:** + +以下错误码的详细介绍请参见[webview错误码](../errorcodes/errorcode-webview.md)。 + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the web message. | + + +### getBoolean10+ + +getBoolean(): boolean + +获取数据对象的布尔类型数据。完整示例代码参考[onMessageEventExt](#onmessageeventext10)。 + +**系统能力:** SystemCapability.Web.Webview.Core + +**返回值:** + +| 类型 | 说明 | +| --------------| ------------- | +| boolean | 返回布尔类型的数据。 | + +**错误码:** + +以下错误码的详细介绍请参见[webview错误码](../errorcodes/errorcode-webview.md)。 + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the web message. | + + +### getArrayBuffer10+ + +getArrayBuffer(): ArrayBuffer + +获取数据对象的原始二进制数据。完整示例代码参考[onMessageEventExt](#onmessageeventext10)。 +**系统能力:** SystemCapability.Web.Webview.Core + +**返回值:** + +| 类型 | 说明 | +| --------------| ------------- | +| ArrayBuffer | 返回原始二进制数据。 | + +**错误码:** + +以下错误码的详细介绍请参见[webview错误码](../errorcodes/errorcode-webview.md)。 + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the web message. | + +### getArray10+ + +getArray(): Array\ + +获取数据对象的数组类型数据。完整示例代码参考[onMessageEventExt](#onmessageeventext10)。 + +**系统能力:** SystemCapability.Web.Webview.Core + +**返回值:** + +| 类型 | 说明 | +| --------------| ------------- | +| Array\ | 返回数组类型的数据。 | + +**错误码:** + +以下错误码的详细介绍请参见[webview错误码](../errorcodes/errorcode-webview.md)。 + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the web message. | + +### getError10+ + +getError(): Error + +获取数据对象的错误类型数据。完整示例代码参考[onMessageEventExt](#onmessageeventext10)。 + +**系统能力:** SystemCapability.Web.Webview.Core + +**返回值:** + +| 类型 | 说明 | +| --------------| ------------- | +| Error | 返回错误对象类型的数据。 | + +**错误码:** + +以下错误码的详细介绍请参见[webview错误码](../errorcodes/errorcode-webview.md)。 + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the web message. | + + +### setType10+ + +setType(type: WebMessageType): void + +设置数据对象的类型。 + +**系统能力:** SystemCapability.Web.Webview.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | ---------------------- | +| type | [WebMessageType](#webmessagetype10) | 是 | [webMessagePort](#webmessageport)接口所支持的数据类型。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the web message. | + +### setString10+ + +setString(message: string): void + +设置数据对象的字符串类型数据。完整示例代码参考[onMessageEventExt](#onmessageeventext10)。 + +**系统能力:** SystemCapability.Web.Webview.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------- | +| message | string | 是 | 字符串类型数据。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the web message. | + +### setNumber10+ + +setNumber(message: number): void + +设置数据对象的数值类型数据。完整示例代码参考[onMessageEventExt](#onmessageeventext10)。 + +**系统能力:** SystemCapability.Web.Webview.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------- | +| message | number | 是 | 数值类型数据。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the web message. | + +### setBoolean10+ + +setBoolean(message: boolean): void + +设置数据对象的布尔类型数据。完整示例代码参考[onMessageEventExt](#onmessageeventext10)。 + +**系统能力:** SystemCapability.Web.Webview.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------- | +| message | boolean | 是 | 布尔类型数据。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the web message. | + +### setArrayBuffer10+ + +setArrayBuffer(message: ArrayBuffer): void + +设置数据对象的原始二进制数据。完整示例代码参考[onMessageEventExt](#onmessageeventext10)。 + +**系统能力:** SystemCapability.Web.Webview.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------- | +| message | ArrayBuffer | 是 | 原始二进制类型数据。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the web message. | + +### setArray10+ + +setArray(message: Array\): void + +设置数据对象的数组类型数据。完整示例代码参考[onMessageEventExt](#onmessageeventext10)。 + +**系统能力:** SystemCapability.Web.Webview.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------- | +| message | Array\ | 是 | 数组类型数据。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the web message. | + +### setError10+ + +setError(message: Error): void + +设置数据对象的错误对象类型数据。完整示例代码参考[onMessageEventExt](#onmessageeventext10)。 + +**系统能力:** SystemCapability.Web.Webview.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------ | ---- | -------------------- | +| message | Error | 是 | 错误对象类型数据。 | + +**错误码:** + +| 错误码ID | 错误信息 | +| -------- | ------------------------------------- | +| 17100014 | The type does not match with the value of the web message. | + + ## WebStorageOrigin 提供Web SQL数据库的使用信息。 @@ -5212,7 +6187,7 @@ struct WebComponent { | isSupportCORS | boolean | 是 | 是 | 是否支持跨域请求。 | | isSupportFetch | boolean | 是 | 是 | 是否支持fetch请求。 | -## SecureDnsMode +## SecureDnsMode10+ Web組件使用HTTPDNS的模式。 @@ -5221,5 +6196,5 @@ Web組件使用HTTPDNS的模式。 | 名称 | 值 | 说明 | | ------------- | -- |----------------------------------------- | | Off | 0 |不使用HTTPDNS, 可以用于撤销之前使用的HTTPDNS配置。| -| Automatic | 1 |自动模式,用于解析的设定dns服务器不可用时,可自动回落至built-in DNS及系统DNS。| +| Auto | 1 |自动模式,用于解析的设定dns服务器不可用时,可自动回落至系统DNS。| | SecureOnly | 2 |强制使用设定的HTTPDNS服务器进行域名解析。| \ No newline at end of file diff --git a/zh-cn/application-dev/reference/apis/js-apis-wifiManager.md b/zh-cn/application-dev/reference/apis/js-apis-wifiManager.md index 31c3a192e7d0bc5449d9b4984546987f75b60a5e..241776a9120c3c76f25f800a1738db8399034e3b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-wifiManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-wifiManager.md @@ -408,6 +408,8 @@ IP配置信息。 | caCertAliases | string | 是 | 否 | CA 证书别名。 | | caPath | string | 是 | 否 | CA 证书路径。 | | clientCertAliases | string | 是 | 否 | 客户端证书别名。 | +| certEntry | Uint8Array | 是 | 是 | CA 证书内容。 | +| certPassword | string | 是 | 是 | CA证书密码。 | | altSubjectMatch | string | 是 | 否 | 替代主题匹配。 | | domainSuffixMatch | string | 是 | 否 | 域后缀匹配。 | | realm | string | 是 | 否 | 通行证凭证的领域。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-wifiManagerExt.md b/zh-cn/application-dev/reference/apis/js-apis-wifiManagerExt.md index 6b973ac78d449daa3d32e2a7c28da46a5115202e..c20d64f6b5b7c381db039126c9dc01fb74e4e856 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-wifiManagerExt.md +++ b/zh-cn/application-dev/reference/apis/js-apis-wifiManagerExt.md @@ -12,9 +12,9 @@ import wifiManagerExt from '@ohos.wifiManagerExt'; ``` -## wifiext.enableHotspot +## wifiext.enableHotspot9+ -enableHotspot(): boolean; +enableHotspot(): void; 使能WLAN热点。 @@ -30,9 +30,9 @@ enableHotspot(): boolean; | -------- | -------- | | 2701000 | Operation failed.| -## wifiext.disableHotspot +## wifiext.disableHotspot9+ -disableHotspot(): boolean; +disableHotspot(): void; 去使能WLAN热点。 @@ -48,9 +48,9 @@ disableHotspot(): boolean; | -------- | -------- | | 2701000 | Operation failed.| -## wifiext.getSupportedPowerModel +## wifiext.getSupportedPowerMode9+ -getSupportedPowerModel(): Promise<Array<PowerModel>> +getSupportedPowerMode(): Promise<Array<PowerMode>> 获取支持的功率模式,使用Promise异步回调。 @@ -62,7 +62,7 @@ getSupportedPowerModel(): Promise<Array<PowerModel>> | 类型 | 说明 | | -------- | -------- | - | Promise<Array<[PowerModel](#powermodel)>> | Promise对象。表示功率模式。 | + | Promise<Array<[PowerMode](#powermode)>> | Promise对象。表示功率模式。 | **错误码:** @@ -72,7 +72,7 @@ getSupportedPowerModel(): Promise<Array<PowerModel>> | -------- | -------- | | 2701000 | Operation failed.| -## PowerModel +## PowerMode 表示功率模式的枚举。 @@ -85,9 +85,9 @@ getSupportedPowerModel(): Promise<Array<PowerModel>> | THROUGH_WALL | 2 | 穿墙模式。 | -## wifiext.getSupportedPowerModel +## wifiext.getSupportedPowerMode9+ -getSupportedPowerModel(callback: AsyncCallback<Array<PowerModel>>): void +getSupportedPowerMode(callback: AsyncCallback<Array<PowerMode>>): void 获取支持的功率模式,使用callback异步回调。 @@ -99,7 +99,7 @@ getSupportedPowerModel(callback: AsyncCallback<Array<PowerModel>>): | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<Array<[PowerModel](#powermodel)>> | 是 | 回调函数。当操作成功时,err为0,data表示支持的功率模式。如果error为非0,表示处理出现错误。 | + | callback | AsyncCallback<Array<[PowerMode](#powermode)>> | 是 | 回调函数。当操作成功时,err为0,data表示支持的功率模式。如果error为非0,表示处理出现错误。 | **错误码:** @@ -109,9 +109,9 @@ getSupportedPowerModel(callback: AsyncCallback<Array<PowerModel>>): | -------- | -------- | | 2701000 | Operation failed.| -## wifiext.getPowerModel +## wifiext.getPowerMode9+ -getPowerModel(): Promise<PowerModel> +getPowerMode(): Promise<PowerMode> 获取功率模式,使用Promise异步回调。 @@ -123,7 +123,7 @@ getPowerModel(): Promise<PowerModel> | 类型 | 说明 | | -------- | -------- | - | Promise<[PowerModel](#powermodel)> | Promise对象。表示功率模式。 | + | Promise<[PowerMode](#powermode)> | Promise对象。表示功率模式。 | **错误码:** @@ -133,9 +133,9 @@ getPowerModel(): Promise<PowerModel> | -------- | -------- | | 2701000 | Operation failed.| -## wifiext.getPowerModel +## wifiext.getPowerMode9+ -getPowerModel(callback: AsyncCallback<PowerModel>): void +getPowerMode(callback: AsyncCallback<PowerMode>): void 获取功率模式,使用callback异步回调。 @@ -147,7 +147,7 @@ getPowerModel(callback: AsyncCallback<PowerModel>): void | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | callback | AsyncCallback<[PowerModel](#powermodel)> | 是 | 回调函数。当操作成功时,err为0,data表示功率模式。如果error为非0,表示处理出现错误。 | + | callback | AsyncCallback<[PowerMode](#powermode)> | 是 | 回调函数。当操作成功时,err为0,data表示功率模式。如果error为非0,表示处理出现错误。 | **错误码:** @@ -157,9 +157,9 @@ getPowerModel(callback: AsyncCallback<PowerModel>): void | -------- | -------- | | 2701000 | Operation failed.| -## wifiext.setPowerModel +## wifiext.setPowerMode9+ -setPowerModel(model: PowerModel) : boolean; +setPowerMode(model: PowerMode) : boolean; 设置功率模式。 @@ -171,7 +171,7 @@ setPowerModel(model: PowerModel) : boolean; | 参数名 | 类型 | 必填 | 说明 | | -------- | -------- | -------- | -------- | - | model | [PowerModel](#powermodel) | 是 | 功率模式。 | + | model | [PowerMode](#powermode) | 是 | 功率模式。 | **错误码:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-window.md b/zh-cn/application-dev/reference/apis/js-apis-window.md index fafc82ba358585d0bca4198176f536a778caeefb..0994ad1615e8dd2616eb543a394076d00ade2ba8 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-window.md +++ b/zh-cn/application-dev/reference/apis/js-apis-window.md @@ -66,7 +66,7 @@ import window from '@ohos.window'; | 名称 | 值 | 说明 | | -------------------------------- | ---- | ------------------------------------------------------------ | -| TYPE_SYSTEM | 0 | 表示系统默认区域。一般包括状态栏、导航栏和Dock栏,各设备系统定义可能不同。 | +| TYPE_SYSTEM | 0 | 表示系统默认区域。一般包括状态栏、导航栏,各设备系统定义可能不同。 | | TYPE_CUTOUT | 1 | 表示刘海屏区域。 | | TYPE_SYSTEM_GESTURE9+ | 2 | 表示手势区域。 | | TYPE_KEYBOARD9+ | 3 | 表示软键盘区域。 | @@ -300,8 +300,6 @@ import window from '@ohos.window'; 窗口生命周期。 -**系统接口:** 此接口为系统接口。 - **系统能力**:SystemCapability.WindowManager.WindowManager.Core | 名称 | 值 | 说明 | @@ -832,6 +830,148 @@ try { } ``` +## window.on('gestureNavigationEnabledChange')10+ + +on(type: 'gestureNavigationEnabledChange', callback: Callback<boolean>): void + +添加手势导航启用状态变化的监听。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | ---- | ----------------------------------------------------------------------------- | +| type | string | 是 | 监听事件,固定为'gestureNavigationEnabledChange',即手势导航启用状态变化事件。 | +| callback | Callback<boolean> | 是 | 回调函数。返回当前手势导航的启用状态。true表示手势导航状态变化为启用;false表示手势导航状态变化为禁用。 | + +**示例:** + +```js +try { + window.on('gestureNavigationEnabledChange', (data) => { + console.info('Succeeded in enabling the listener for gesture navigation status changes. Data: ' + JSON.stringify(data)); + }); +} catch (exception) { + console.error('Failed to enable the listener for gesture navigation status changes. Cause: ' + JSON.stringify(exception)); +} +``` + +## window.off('gestureNavigationEnabledChange')10+ + +off(type: 'gestureNavigationEnabledChange', callback?: Callback<boolean>): void + +移除手势导航启用状态变化的监听。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ----------------------- | -- | ------------------------------------------------------------ | +| type | string | 是 | 监听事件,固定为'gestureNavigationEnabledChange',即手势导航启用状态变化事件。 | +| callback | Callback<boolean> | 否 | 已注册的回调函数。参数传入时表示只移除该监听;参数未传入时表示移除所有手势导航启用状态变化的监听。 | + +**示例:** + +```js +try { + window.off('gestureNavigationEnabledChange'); +} catch (exception) { + console.error('Failed to disable the listener for gesture navigation status changes. Cause: ' + JSON.stringify(exception)); +} +``` + +## window.setGestureNavigationEnabled10+ +setGestureNavigationEnabled(enable: boolean, callback: AsyncCallback<void>): void + +设置手势导航启用状态。使用callback异步回调。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| -------- | ------------------------- | ---- | -------------- | +| enable | boolean | 是 | 设置手势导航启用状态。true表示启用手势导航;false表示禁用手势导航。 | +| callback | AsyncCallback<void> | 是 | 回调信息。 | + +**错误码:** + +以下错误码的详细介绍请参见[窗口错误码](../errorcodes/errorcode-window.md)。 + +| 错误码ID | 错误信息 | +| ------- | --------------------------------------------- | +| 1300002 | This window state is abnormal. | +| 1300003 | This window manager service works abnormally. | + +**示例:** + +```js +try { + window.setGestureNavigationEnabled(true, (err) => { + if(err.code) { + console.error('Failed to set gesture navigation enabled. Cause: ' + JSON.stringify(err)); + return; + } + console.info('Succeeded in setting gesture navigation enabled.'); + }); +} catch (exception) { + console.error('Failed to set gesture navigation enabled. Cause: ' + JSON.stringify(exception)); +} +``` + +## window.setGestureNavigationEnabled10+ +setGestureNavigationEnabled(enable: boolean): Promise<void> + +设置手势导航启用状态。使用Promise异步回调。 + +**系统接口:** 此接口为系统接口。 + +**系统能力:** SystemCapability.WindowManager.WindowManager.Core + +**参数:** + +| 参数名 | 类型 | 必填 | 说明 | +| ------ | ------- | ---- | -------------------- | +| enable | boolean | 是 | 设置手势导航启用状态。true表示启用手势导航;false表示禁用手势导航。 | + +**返回值:** + +| 类型 | 说明 | +| ------------------- | ------------------------- | +| Promise<void> | 无返回结果的Promise对象。 | + +**错误码:** + +以下错误码的详细介绍请参见[窗口错误码](../errorcodes/errorcode-window.md)。 + +| 错误码ID | 错误信息 | +| ------- | -------------------------------------------- | +| 1300002 | This window state is abnormal. | +| 1300003 | This window manager service works abnormally. | + +**示例:** + +```js +try { + let promise = window.setGestureNavigationEnabled(true); + promise.then(()=> { + console.info('Succeeded in setting gesture navigation enabled.'); + }).catch((err)=>{ + console.error('Failed to set gesture navigation enabled. Cause: ' + JSON.stringify(err)); + }); +} catch (exception) { + console.error('Failed to set gesture navigation enabled. Cause: ' + JSON.stringify(exception)); +} +``` + ## window.create(deprecated) create(id: string, type: WindowType, callback: AsyncCallback<Window>): void @@ -1910,7 +2050,9 @@ try { setWindowLayoutFullScreen(isLayoutFullScreen: boolean, callback: AsyncCallback<void>): void -设置窗口的布局是否为全屏显示状态,使用callback异步回调。 +设置窗口的布局是否为沉浸式布局,使用callback异步回调。 +沉浸式布局是指布局不避让状态栏与导航栏,组件可能产生与其重叠的情况。 +非沉浸式布局是指布局避让状态栏与导航栏,组件不会与其重叠。 **系统能力:** SystemCapability.WindowManager.WindowManager.Core @@ -1918,7 +2060,7 @@ setWindowLayoutFullScreen(isLayoutFullScreen: boolean, callback: AsyncCallback&l | 参数名 | 类型 | 必填 | 说明 | | ------------------ | ------------------------- | -- | --------- | -| isLayoutFullScreen | boolean | 是 | 窗口的布局是否为全屏显示状态(该全屏状态下状态栏、导航栏仍然显示)。true表示全屏显示;false表示非全屏显示。 | +| isLayoutFullScreen | boolean | 是 | 窗口的布局是否为沉浸式布局(该沉浸式布局状态栏、导航栏仍然显示)。true表示沉浸式布局;false表示非沉浸式布局。 | | callback | AsyncCallback<void> | 是 | 回调函数。 | **错误码:** @@ -1951,7 +2093,9 @@ try { setWindowLayoutFullScreen(isLayoutFullScreen: boolean): Promise<void> -设置窗口的布局是否为全屏显示状态,使用Promise异步回调。 +设置窗口的布局是否为沉浸式布局,使用Promise异步回调。 +沉浸式布局是指布局不避让状态栏与导航栏,组件可能产生与其重叠的情况。 +非沉浸式布局是指布局避让状态栏与导航栏,组件不会与其重叠。 **系统能力:** SystemCapability.WindowManager.WindowManager.Core @@ -1959,7 +2103,7 @@ setWindowLayoutFullScreen(isLayoutFullScreen: boolean): Promise<void> | 参数名 | 类型 | 必填 | 说明 | | ------------------ | ------- | -- | ------------------------------------------------------------------------------------------------ | -| isLayoutFullScreen | boolean | 是 | 窗口的布局是否为全屏显示状态(该全屏状态下状态栏、导航栏仍然显示)。true表示全屏显示;false表示非全屏显示。 | +| isLayoutFullScreen | boolean | 是 | 窗口的布局是否为沉浸式布局(该沉浸式布局状态栏、导航栏仍然显示)。true表示沉浸式布局;false表示非沉浸式布局。 | **返回值:** @@ -2361,7 +2505,7 @@ loadContent(path: string, storage: LocalStorage, callback: AsyncCallback<void | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------------------------- | ---- | ------------------------------------------------------------ | | path | string | 是 | 设置加载页面的路径。 | -| storage | [LocalStorage](../../quick-start/arkts-state-mgmt-application-level.md#localstorage) | 是 | 存储单元,为应用程序范围内的可变状态属性和非可变状态属性提供存储。 | +| storage | [LocalStorage](../../quick-start/arkts-localstorage.md) | 是 | 存储单元,为应用程序范围内的可变状态属性和非可变状态属性提供存储。 | | callback | AsyncCallback<void> | 是 | 回调函数。 | **错误码:** @@ -2407,7 +2551,7 @@ loadContent(path: string, storage: LocalStorage): Promise<void> | 参数名 | 类型 | 必填 | 说明 | | ------- | ----------------------------------------------- | ---- | ------------------------------------------------------------ | | path | string | 是 | 设置加载页面的路径。 | -| storage | [LocalStorage](../../quick-start/arkts-state-mgmt-application-level.md#localstorage) | 是 | 存储单元,为应用程序范围内的可变状态属性和非可变状态属性提供存储。 | +| storage | [LocalStorage](../../quick-start/arkts-localstorage.md) | 是 | 存储单元,为应用程序范围内的可变状态属性和非可变状态属性提供存储。 | **返回值:** @@ -4019,7 +4163,7 @@ promise.then((pixelMap)=> { opacity(opacity: number): void -设置窗口透明度。 +设置窗口不透明度。仅支持在[自定义系统窗口的显示与隐藏动画](../../windowmanager/system-window-stage.md#自定义系统窗口的显示与隐藏动画)中使用。 **系统接口:** 此接口为系统接口。 @@ -4027,9 +4171,9 @@ opacity(opacity: number): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ------- | ------ | ---- | --------------------- | -| opacity | number | 是 | 透明度,范围0.0~1.0。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | ------ | ---- | ----------------------------------------------------------- | +| opacity | number | 是 | 不透明度,范围0.0~1.0。0.0表示完全透明,1.0表示完全不透明。 | **错误码:** @@ -4054,7 +4198,7 @@ try { scale(scaleOptions: ScaleOptions): void -设置窗口缩放参数。 +设置窗口缩放参数。仅支持在[自定义系统窗口的显示与隐藏动画](../../windowmanager/system-window-stage.md#自定义系统窗口的显示与隐藏动画)中使用。 **系统接口:** 此接口为系统接口。 @@ -4095,7 +4239,7 @@ try { rotate(rotateOptions: RotateOptions): void -设置窗口旋转参数。 +设置窗口旋转参数。仅支持在[自定义系统窗口的显示与隐藏动画](../../windowmanager/system-window-stage.md#自定义系统窗口的显示与隐藏动画)中使用。 **系统接口:** 此接口为系统接口。 @@ -4137,7 +4281,7 @@ try { translate(translateOptions: TranslateOptions): void -设置窗口平移参数。 +设置窗口平移参数。仅支持在[自定义系统窗口的显示与隐藏动画](../../windowmanager/system-window-stage.md#自定义系统窗口的显示与隐藏动画)中使用。 **系统接口:** 此接口为系统接口。 @@ -4145,9 +4289,9 @@ translate(translateOptions: TranslateOptions): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ---------------- | -------------------------------------- | ---- | ---------- | -| translateOptions | [TranslateOptions](#translateoptions9) | 是 | 平移参数。 | +| 参数名 | 类型 | 必填 | 说明 | +| ---------------- | -------------------------------------- | ---- | -------------------- | +| translateOptions | [TranslateOptions](#translateoptions9) | 是 | 平移参数,单位为px。 | **错误码:** @@ -5241,7 +5385,7 @@ setFullScreen(isFullScreen: boolean, callback: AsyncCallback<void>): void | 参数名 | 类型 | 必填 | 说明 | | ------------ | ------------------------- | ---- | ---------------------------------------------- | -| isFullScreen | boolean | 是 | 是否设为全屏状态(该全屏状态隐藏状态栏导航栏)。true表示全屏;false表示非全屏。 | +| isFullScreen | boolean | 是 | 是否设为全屏状态(该全屏状态隐藏状态栏导航栏)。true表示全屏;false表示非全屏。 | | callback | AsyncCallback<void> | 是 | 回调函数。 | **示例:** @@ -5297,7 +5441,9 @@ promise.then(()=> { setLayoutFullScreen(isLayoutFullScreen: boolean, callback: AsyncCallback<void>): void -设置窗口的布局是否为全屏显示状态,使用callback异步回调。 +设置窗口的布局是否为沉浸式布局,使用callback异步回调。 +沉浸式布局是指布局不避让状态栏与导航栏,组件可能产生与其重叠的情况。 +非沉浸式布局是指布局避让状态栏与导航栏,组件不会与其重叠。 > **说明:** > @@ -5309,7 +5455,7 @@ setLayoutFullScreen(isLayoutFullScreen: boolean, callback: AsyncCallback<void | 参数名 | 类型 | 必填 | 说明 | | ------------------ | ------------------------- | ---- | ------------------------------------------------------------ | -| isLayoutFullScreen | boolean | 是 | 窗口的布局是否为全屏显示状态(该全屏状态下状态栏、导航栏仍然显示)。true表示全屏;false表示非全屏。 | +| isLayoutFullScreen | boolean | 是 | 窗口的布局是否为沉浸式布局(该沉浸式布局状态栏、导航栏仍然显示)。true表示沉浸式布局;false表示非沉浸式布局。 | | callback | AsyncCallback<void> | 是 | 回调函数。 | **示例:** @@ -5329,7 +5475,9 @@ windowClass.setLayoutFullScreen(isLayoutFullScreen, (err) => { setLayoutFullScreen(isLayoutFullScreen: boolean): Promise<void> -设置窗口的布局是否为全屏显示状态,使用Promise异步回调。 +设置窗口的布局是否为沉浸式布局,使用Promise异步回调。 +沉浸式布局是指布局不避让状态栏与导航栏,组件可能产生与其重叠的情况。 +非沉浸式布局是指布局避让状态栏与导航栏,组件不会与其重叠。 > **说明:** > @@ -5341,7 +5489,7 @@ setLayoutFullScreen(isLayoutFullScreen: boolean): Promise<void> | 参数名 | 类型 | 必填 | 说明 | | ------------------ | ------- | ---- | ------------------------------------------------------------ | -| isLayoutFullScreen | boolean | 是 | 窗口的布局是否为全屏显示状态(该全屏状态下状态栏、导航栏仍然显示)。true表示全屏;false表示非全屏。 | +| isLayoutFullScreen | boolean | 是 | 窗口的布局是否为沉浸式布局(该沉浸式布局状态栏、导航栏仍然显示)。true表示沉浸式布局;false表示非沉浸式布局。 | **返回值:** @@ -6788,7 +6936,7 @@ loadContent(path: string, storage: LocalStorage, callback: AsyncCallback<void | 参数名 | 类型 | 必填 | 说明 | | -------- | ----------------------------------------------- | ---- | ------------------------------------------------------------ | | path | string | 是 | 设置加载页面的路径。 | -| storage | [LocalStorage](../../quick-start/arkts-state-mgmt-application-level.md#localstorage) | 是 | 存储单元,为应用程序范围内的可变状态属性和非可变状态属性提供存储。 | +| storage | [LocalStorage](../../quick-start/arkts-localstorage.md) | 是 | 存储单元,为应用程序范围内的可变状态属性和非可变状态属性提供存储。 | | callback | AsyncCallback<void> | 是 | 回调函数。 | **错误码:** @@ -6843,7 +6991,7 @@ loadContent(path: string, storage?: LocalStorage): Promise<void> | 参数名 | 类型 | 必填 | 说明 | | ------- | ----------------------------------------------- | ---- | ------------------------------------------------------------ | | path | string | 是 | 设置加载页面的路径。 | -| storage | [LocalStorage](../../quick-start/arkts-state-mgmt-application-level.md#localstorage) | 否 | 存储单元,为应用程序范围内的可变状态属性和非可变状态属性提供存储。 | +| storage | [LocalStorage](../../quick-start/arkts-localstorage.md) | 否 | 存储单元,为应用程序范围内的可变状态属性和非可变状态属性提供存储。 | **返回值:** 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 93740ac120886dc62da6dab35d265410a029d6c9..cd5afe9467f8a4ab42c40cadbedb4ee0b3f1512e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-xml.md +++ b/zh-cn/application-dev/reference/apis/js-apis-xml.md @@ -456,7 +456,7 @@ function func(key, value){ arrTag[i] = 'key:'+key+' value:'+ value.getDepth(); str += arrTag[i]; i++; - return true; // Determines whether to continuely parse, which is used to continue or terminate parsing. + return true; // Determines whether to continually parse, which is used to continue or terminate parsing. } let options = {supportDoctype:true, ignoreNameSpace:true, tokenValueCallbackFunction:func} that.parse(options); @@ -527,7 +527,7 @@ function func(key, value){ arrTag[i] = 'key:'+key+' value:'+ value.getColumnNumber(); str += arrTag[i]; i++; - return true; // Determines whether to continuely parse, which is used to continue or terminate parsing. + return true; // Determines whether to continually parse, which is used to continue or terminate parsing. } let options = {supportDoctype:true, ignoreNameSpace:true, tokenValueCallbackFunction:func} that.parse(options); @@ -574,7 +574,7 @@ function func(key, value){ arrTag[i] = 'key:'+key+' value:'+ value.getDepth(); str += arrTag[i]; i++; - return true; // Determines whether to continuely parse, which is used to continue or terminate parsing. + return true; // Determines whether to continually parse, which is used to continue or terminate parsing. } let options = {supportDoctype:true, ignoreNameSpace:true, tokenValueCallbackFunction:func} that.parse(options); @@ -624,7 +624,7 @@ function func(key, value){ arrTag[i] = 'key:'+key+' value:'+ value.getLineNumber(); str += arrTag[i]; i++; - return true; // Determines whether to continuely parse, which is used to continue or terminate parsing. + return true; // Determines whether to continually parse, which is used to continue or terminate parsing. } let options = {supportDoctype:true, ignoreNameSpace:true, tokenValueCallbackFunction:func} that.parse(options); @@ -671,7 +671,7 @@ function func(key, value){ arrTag[i] = 'key:'+key+' value:'+ value.getName(); str += arrTag[i]; i++; - return true; // Determines whether to continuely parse, which is used to continue or terminate parsing. + return true; // Determines whether to continually parse, which is used to continue or terminate parsing. } let options = {supportDoctype:true, ignoreNameSpace:true, tokenValueCallbackFunction:func} that.parse(options); @@ -717,7 +717,7 @@ function func(key, value){ arrTag[i] = 'key:'+key+' value:'+ value.getNamespace(); str += arrTag[i]; i++; - return true; // Determines whether to continuely parse, which is used to continue or terminate parsing. + return true; // Determines whether to continually parse, which is used to continue or terminate parsing. } let options = {supportDoctype:true, ignoreNameSpace:true, tokenValueCallbackFunction:func} that.parse(options); @@ -763,7 +763,7 @@ function func(key, value){ arrTag[i] = 'key:'+key+' value:'+ value.getPrefix(); str += arrTag[i]; i++; - return true; // Determines whether to continuely parse, which is used to continue or terminate parsing. + return true; // Determines whether to continually parse, which is used to continue or terminate parsing. } let options = {supportDoctype:true, ignoreNameSpace:true, tokenValueCallbackFunction:func} that.parse(options); @@ -810,7 +810,7 @@ function func(key, value){ arrTag[i] = 'key:'+key+' value:'+ value.getText(); str += arrTag[i]; i++; - return true; // Determines whether to continuely parse, which is used to continue or terminate parsing. + return true; // Determines whether to continually parse, which is used to continue or terminate parsing. } let options = {supportDoctype:true, ignoreNameSpace:true, tokenValueCallbackFunction:func} that.parse(options); @@ -856,7 +856,7 @@ function func(key, value){ arrTag[i] = 'key:'+key+' value:'+ value.isEmptyElementTag(); str += arrTag[i]; i++; - return true; // Determines whether to continuely parse, which is used to continue or terminate parsing. + return true; // Determines whether to continually parse, which is used to continue or terminate parsing. } let options = {supportDoctype:true, ignoreNameSpace:true, tokenValueCallbackFunction:func} that.parse(options); @@ -902,7 +902,7 @@ function func(key, value){ arrTag[i] = 'key:'+key+' value:'+ value.isWhitespace(); str += arrTag[i]; i++; - return true; // Determines whether to continuely parse, which is used to continue or terminate parsing. + return true; // Determines whether to continually parse, which is used to continue or terminate parsing. } let options = {supportDoctype:true, ignoreNameSpace:true, tokenValueCallbackFunction:func} that.parse(options); @@ -947,7 +947,7 @@ function func(key, value){ arrTag[i] = 'key:'+key+' value:'+ value.getAttributeCount(); str += arrTag[i]; i++; - return true; // Determines whether to continuely parse, which is used to continue or terminate parsing. + return true; // Determines whether to continually parse, which is used to continue or terminate parsing. } let options = {supportDoctype:true, ignoreNameSpace:true, tokenValueCallbackFunction:func} that.parse(options); diff --git a/zh-cn/application-dev/reference/apis/js-apis-zlib.md b/zh-cn/application-dev/reference/apis/js-apis-zlib.md index 8a2d9c2f02cb04c467bcc35e49a263641fa9d526..c49189019424cd9d4e1c02dc5b0c0f5b8e5ddf75 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-zlib.md +++ b/zh-cn/application-dev/reference/apis/js-apis-zlib.md @@ -25,7 +25,7 @@ zipFile(inFile: string, outFile: string, options: Options): Promise<void> | 参数名 | 类型 | 必填 | 说明 | | ------- | ------------------- | ---- | ------------------------------------------------------------ | -| inFile | string | 是 | 指定压缩的文件夹路径或者文件路径,路径必须为沙箱路径,沙箱路径可以通过context获取,可参考[FA模型](js-apis-inner-app-context.md),[Stage模型](js-apis-application-context.md)。 | +| inFile | string | 是 | 指定压缩的文件夹路径或者文件路径,路径必须为沙箱路径,沙箱路径可以通过context获取,可参考[FA模型](js-apis-inner-app-context.md),[Stage模型](js-apis-inner-application-context.md)。 | | outFile | string | 是 | 指定压缩结果的文件路径(文件的扩展名zip)。 | | options | [Options](#options) | 是 | 压缩的可选参数。 | @@ -50,9 +50,9 @@ let options = { }; zlib.zipFile(inFile, outFile, options).then((data) => { - console.log('zipFile result is ' + JSON.Stringify(data)); + console.log('zipFile result is ' + JSON.stringify(data)); }).catch((err) => { - console.log('error is ' + JSON.Stringify(err)); + console.log('error is ' + JSON.stringify(err)); }); ``` @@ -71,9 +71,9 @@ let options = { }; zlib.zipFile(inFile , outFile, options).then((data) => { - console.log('zipFile result is ' + JSON.Stringify(data)); + console.log('zipFile result is ' + JSON.stringify(data)); }).catch((err)=>{ - console.log('error is ' + JSON.Stringify(err)); + console.log('error is ' + JSON.stringify(err)); }); ``` @@ -91,7 +91,7 @@ unzipFile(inFile:string, outFile:string, options: Options): Promise<void> | 参数名 | 类型 | 必填 | 说明 | | ------- | ------------------- | ---- | ------------------------------------------------------------ | -| inFile | string | 是 | 指定的待解压缩文件的文件路径,路径必须为沙箱路径,沙箱路径可以通过context获取,可参考[FA模型](js-apis-inner-app-context.md),[Stage模型](js-apis-application-context.md)。 | +| inFile | string | 是 | 指定的待解压缩文件的文件路径,路径必须为沙箱路径,沙箱路径可以通过context获取,可参考[FA模型](js-apis-inner-app-context.md),[Stage模型](js-apis-inner-application-context.md)。 | | outFile | string | 是 | 指定的解压文件路径。 | | options | [Options](#options) | 是 | 解压的可选参数。 | @@ -116,9 +116,9 @@ let options = { strategy: zlib.CompressStrategy.COMPRESS_STRATEGY_DEFAULT_STRATEGY }; zlib.unzipFile(inFile, outFile, options).then((data) => { - console.log('unzipFile result is ' + JSON.Stringify(data)); + console.log('unzipFile result is ' + JSON.stringify(data)); }).catch((err)=>{ - console.log('error is ' + JSON.Stringify(err)); + console.log('error is ' + JSON.stringify(err)); }) ``` @@ -134,7 +134,7 @@ compressFile(inFile: string, outFile: string, options: Options, callback: AsyncC | 参数名 | 类型 | 必填 | 说明 | | ----------------------- | ------------------- | ---- | ------------------------------------------------------------ | -| inFile | string | 是 | 指定压缩的文件夹路径或者文件路径,路径必须为沙箱路径,沙箱路径可以通过context获取,可参考[FA模型](js-apis-inner-app-context.md),[Stage模型](js-apis-application-context.md)。 | +| inFile | string | 是 | 指定压缩的文件夹路径或者文件路径,路径必须为沙箱路径,沙箱路径可以通过context获取,可参考[FA模型](js-apis-inner-app-context.md),[Stage模型](js-apis-inner-application-context.md)。 | | outFile | string | 是 | 指定的解压文件路径。 | | options | [Options](#options) | 是 | 压缩的配置参数。 | | AsyncCallback<**void**> | callback | 否 | 压缩时的回调函数。 | @@ -172,6 +172,8 @@ try { } ``` +## zlib.compressFile9+ + compressFile(inFile: string, outFile: string, options: Options): Promise\; 压缩文件,压缩的结果通过promise返回,成功时返回null,失败时返回错误码。 @@ -182,7 +184,7 @@ compressFile(inFile: string, outFile: string, options: Options): Promise\; | 参数名 | 类型 | 必填 | 说明 | | ------- | ------------------- | ---- | ------------------------------------------------------------ | -| inFile | string | 是 | 指定压缩的文件夹路径或者文件路径,路径必须为沙箱路径,沙箱路径可以通过context获取,可参考[FA模型](js-apis-inner-app-context.md),[Stage模型](js-apis-application-context.md)。 | +| inFile | string | 是 | 指定压缩的文件夹路径或者文件路径,路径必须为沙箱路径,沙箱路径可以通过context获取,可参考[FA模型](js-apis-inner-app-context.md),[Stage模型](js-apis-inner-application-context.md)。 | | outFile | string | 是 | 指定的解压文件路径。 | | options | [Options](#options) | 是 | 压缩的配置参数。 | @@ -232,10 +234,10 @@ decompressFile(inFile: string, outFile: string, options: Options, callback: Asyn | 参数名 | 类型 | 必填 | 说明 | | ----------------------- | ------------------- | ---- | ------------------------------------------------------------ | -| inFile | string | 是 | 指定的待解压缩文件的文件路径,路径必须为沙箱路径,沙箱路径可以通过context获取,可参考[FA模型](js-apis-inner-app-context.md),[Stage模型](js-apis-application-context.md)。 | -| outFile | string | 是 | 指定的解压后的目录路径。 | -| options | [Options](#options) | 是 | 解压的配置参数。 | -| AsyncCallback<**void**> | callback | 否 | 解压是的回调函数。 | +| inFile | string | 是 | 指定的待解压缩文件的文件路径,路径必须为沙箱路径,沙箱路径可以通过context获取,可参考[FA模型](js-apis-inner-app-context.md),[Stage模型](js-apis-inner-application-context.md)。 | +| outFile | string | 是 | 指定的解压后的文件夹路径,文件夹目录路径需要在系统中存在,不存在则会解压失败。路径必须为沙箱路径,沙箱路径可以通过context获取,具体方法可参考[application/context(Stage模型)](js-apis-inner-application-context.md)或 [app/context(FA模型)](js-apis-inner-app-context.md)。 | +| options | [Options](#options) | 是 | 解压的配置参数。 | +| AsyncCallback<**void**> | callback | 否 | 解压的回调函数。 | **相关错误码** @@ -253,7 +255,7 @@ decompressFile(inFile: string, outFile: string, options: Options, callback: Asyn // 代码中使用的路径需为应用的沙箱路径,如/data/storage/el2/base/haps,也可以通过context获取 import zlib from '@ohos.zlib'; let inFile = '/xx/xxx.zip'; -let outFile = '/xxx'; +let outFileDir = '/xxx'; let options = { level: zlib.CompressLevel.COMPRESS_LEVEL_DEFAULT_COMPRESSION, memLevel: zlib.MemLevel.MEM_LEVEL_DEFAULT, @@ -261,7 +263,7 @@ let options = { }; try { - zlib.decompressFile(inFile, outFile, options, (errData) => { + zlib.decompressFile(inFile, outFileDir, options, (errData) => { if (errData !== null) { console.log(`errData is errCode:${errData.code} message:${errData.message}`); } @@ -271,6 +273,8 @@ try { } ``` +## zlib.decompressFile9+ + decompressFile(inFile: string, outFile: string, options: Options): Promise\; 解压文件,解压的结果通过promise返回,成功时返回null,失败时返回错误码。 @@ -281,9 +285,9 @@ decompressFile(inFile: string, outFile: string, options: Options): Promise\ { + zlib.decompressFile(inFile, outFileDir, options).then((data) => { console.info('decompressFile success'); }).catch((errData) => { console.log(`errData is errCode:${errData.code} message:${errData.message}`); diff --git a/zh-cn/application-dev/reference/arkui-js-lite/Readme-CN.md b/zh-cn/application-dev/reference/arkui-js-lite/Readme-CN.md new file mode 100644 index 0000000000000000000000000000000000000000..9d94f7dd8f4595b8e23ddbeb69e6dc0f58d6a131 --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js-lite/Readme-CN.md @@ -0,0 +1,37 @@ +# 兼容JS的类Web开发范式(ArkUI.Lite) + +- 框架说明 + - [文件组织](js-framework-file.md) + - [js标签配置](js-framework-js-tag.md) + - [app.js](js-framework-js-file.md) + - 语法 + - [HML语法参考](js-framework-syntax-hml.md) + - [CSS语法参考](js-framework-syntax-css.md) + - [JS语法参考](js-framework-syntax-js.md) +- 组件通用信息 + - [通用事件](js-common-events.md) + - [通用属性](js-common-attributes.md) + - [通用样式](js-common-styles.md) + - [动画样式](js-components-common-animation.md) + - [媒体查询](js-components-common-mediaquery.md) +- 容器组件 + - [div](js-components-container-div.md) + - [list](js-components-container-list.md) + - [list-item](js-components-container-list-item.md) + - [stack](js-components-container-stack.md) + - [swiper](js-components-container-swiper.md) +- 基础组件 + - [chart](js-components-basic-chart.md) + - [image](js-components-basic-image.md) + - [image-animator](js-components-basic-image-animator.md) + - [input](js-components-basic-input.md) + - [marquee](js-components-basic-marquee.md) + - [picker-view](js-components-basic-picker-view.md) + - [progress](js-components-basic-progress.md) + - [qrcode](js-components-basic-qrcode.md) + - [slider](js-components-basic-slider.md) + - [switch](js-components-basic-switch.md) + - [text](js-components-basic-text.md) +- 画布组件 + - [canvas组件](js-components-canvas-canvas.md) + - [CanvasRenderingContext2D对象](js-components-canvas-canvasrenderingcontext2d.md) diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/#000000.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/#000000.png new file mode 100644 index 0000000000000000000000000000000000000000..58293d5e874f2aa36ecaf7282ca9e4736318092f Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/#000000.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/GIF.gif b/zh-cn/application-dev/reference/arkui-js-lite/figures/GIF.gif new file mode 100644 index 0000000000000000000000000000000000000000..fa77bb91654623c2de68a19e7f9f95bbd1d029bc Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/GIF.gif differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/aliceblue.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/aliceblue.png new file mode 100644 index 0000000000000000000000000000000000000000..378000d344e90ab4db41869a4612daf6b60d66ab Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/aliceblue.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/antiquewhite.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/antiquewhite.png new file mode 100644 index 0000000000000000000000000000000000000000..8e195633945b3387c46a7d295862351d4ff1fc64 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/antiquewhite.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/aqua.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/aqua.png new file mode 100644 index 0000000000000000000000000000000000000000..3e6aaacfe1c26157294e6dedfeaa1488aeed12a3 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/aqua.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/aquamarine.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/aquamarine.png new file mode 100644 index 0000000000000000000000000000000000000000..c25a692065d473ccf9f5b6d36254787e2497fad6 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/aquamarine.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/azure.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/azure.png new file mode 100644 index 0000000000000000000000000000000000000000..2e7cec00f9d186d76ff5cb12d47811084217cc1c Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/azure.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/barchart.PNG b/zh-cn/application-dev/reference/arkui-js-lite/figures/barchart.PNG new file mode 100644 index 0000000000000000000000000000000000000000..aa4ba3f9fa64250b1b86bd6d39b6a8071d3de1c3 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/barchart.PNG differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/beige.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/beige.png new file mode 100644 index 0000000000000000000000000000000000000000..21f20a4220aabf9449c707291633e7b3723fe378 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/beige.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/bisque.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/bisque.png new file mode 100644 index 0000000000000000000000000000000000000000..7983d590a2c617c6cad68c90af6b12aa17518810 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/bisque.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/blanchedalmond.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/blanchedalmond.png new file mode 100644 index 0000000000000000000000000000000000000000..04bcf099edface801be6074a33ff33a980c9b606 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/blanchedalmond.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/blue.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/blue.png new file mode 100644 index 0000000000000000000000000000000000000000..e370a44cf043fc34bd8891f57faad2cd2ca05707 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/blue.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/blueviolet.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/blueviolet.png new file mode 100644 index 0000000000000000000000000000000000000000..ca1edf2219980ab9c8533b9fda3219521c50533d Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/blueviolet.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/brown.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/brown.png new file mode 100644 index 0000000000000000000000000000000000000000..0d22570503febc7a7dcba0d1e870f49f32fe489a Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/brown.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/burlywood.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/burlywood.png new file mode 100644 index 0000000000000000000000000000000000000000..0d53a47b7eace81d5c7da88c59fee61e30c89681 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/burlywood.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/cadetblue.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/cadetblue.png new file mode 100644 index 0000000000000000000000000000000000000000..a59bc9cdb0f75ad79e4714d3593216021369c862 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/cadetblue.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/chartreuse.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/chartreuse.png new file mode 100644 index 0000000000000000000000000000000000000000..3026d3c195598159232b4b1f08e9f198f4b4fa2c Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/chartreuse.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/chocolate.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/chocolate.png new file mode 100644 index 0000000000000000000000000000000000000000..02d5f4e31b020ea9f64e36a7b7cd50299cf3d7f2 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/chocolate.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/coral.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/coral.png new file mode 100644 index 0000000000000000000000000000000000000000..8442c9b2258c79ee6b6a3d5963df5b792bbb1a16 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/coral.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/cornflowerblue.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/cornflowerblue.png new file mode 100644 index 0000000000000000000000000000000000000000..3621ef6876dbd1103487aed8ff190e6a0204ffde Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/cornflowerblue.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/cornsilk.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/cornsilk.png new file mode 100644 index 0000000000000000000000000000000000000000..bf38fe45eaf254939b88b9d2a66635408060acf7 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/cornsilk.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/crimson.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/crimson.png new file mode 100644 index 0000000000000000000000000000000000000000..bca655617699ef8dc1265bf692a3170c7effe15b Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/crimson.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/cyan.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/cyan.png new file mode 100644 index 0000000000000000000000000000000000000000..3e6aaacfe1c26157294e6dedfeaa1488aeed12a3 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/cyan.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/darkblue.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkblue.png new file mode 100644 index 0000000000000000000000000000000000000000..b234a769d1a9f1f30c4d2127160cf067e9f71ad6 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkblue.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/darkcyan.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkcyan.png new file mode 100644 index 0000000000000000000000000000000000000000..b780eb08852e8916ec6ff1a401ea6946c8d727cf Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkcyan.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/darkgoldenrod.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkgoldenrod.png new file mode 100644 index 0000000000000000000000000000000000000000..26f2f228b47b8acb8adcddc3abf9156d6c29364e Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkgoldenrod.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/darkgray.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkgray.png new file mode 100644 index 0000000000000000000000000000000000000000..f1abe2afcb7902557ac3c4f58abfdf333af03121 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkgray.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/darkgreen.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkgreen.png new file mode 100644 index 0000000000000000000000000000000000000000..4c4c304b67c398f32c5fff516cdde377ca39c73d Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkgreen.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/darkgrey.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkgrey.png new file mode 100644 index 0000000000000000000000000000000000000000..f1abe2afcb7902557ac3c4f58abfdf333af03121 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkgrey.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/darkkhaki.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkkhaki.png new file mode 100644 index 0000000000000000000000000000000000000000..12085848c0f6472d53f7e6504c1924ea6f5a44c1 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkkhaki.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/darkmagenta.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkmagenta.png new file mode 100644 index 0000000000000000000000000000000000000000..9ed54c6c5c5186fb43f24dab24f7689ae0d14a12 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkmagenta.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/darkolivegreen.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkolivegreen.png new file mode 100644 index 0000000000000000000000000000000000000000..53081e06f458cfc1772de30f669180333b8d783d Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkolivegreen.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/darkorange.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkorange.png new file mode 100644 index 0000000000000000000000000000000000000000..6064f64867e3aca621244e1e6fdb16d3ab2ed748 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkorange.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/darkorchid.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkorchid.png new file mode 100644 index 0000000000000000000000000000000000000000..6315d4654d04dd6b9b295fa1f8b37e8c550b17cf Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkorchid.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/darkred.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkred.png new file mode 100644 index 0000000000000000000000000000000000000000..c33d763d18f5108bf0eedba19c662d05af397ee9 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkred.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/darksalmon.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/darksalmon.png new file mode 100644 index 0000000000000000000000000000000000000000..57594c6855d4cdf1b37cc3e5354374c9dae0823b Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/darksalmon.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/darkseagreen.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkseagreen.png new file mode 100644 index 0000000000000000000000000000000000000000..454b1796715794d51e2a1a4649bfafa1bfde80f0 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkseagreen.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/darkslateblue.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkslateblue.png new file mode 100644 index 0000000000000000000000000000000000000000..7dfc7ee8793298d19c939369ba980abd547982ff Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkslateblue.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/darkslategray.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkslategray.png new file mode 100644 index 0000000000000000000000000000000000000000..5e23c304c4911dc0ef487dfeb8d7820aea5fb44b Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkslategray.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/darkslategrey.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkslategrey.png new file mode 100644 index 0000000000000000000000000000000000000000..5e23c304c4911dc0ef487dfeb8d7820aea5fb44b Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkslategrey.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/darkturquoise.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkturquoise.png new file mode 100644 index 0000000000000000000000000000000000000000..4e41450db5d70f6d10d6d7bf59daba33085c177e Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkturquoise.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/darkviolet.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkviolet.png new file mode 100644 index 0000000000000000000000000000000000000000..6f085565bd8c64d44bf58ce0969557515ec7ab97 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/darkviolet.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/deeppink.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/deeppink.png new file mode 100644 index 0000000000000000000000000000000000000000..6348bb2b6ee281976f7d58159e4c33db29f542ad Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/deeppink.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/deepskyblue.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/deepskyblue.png new file mode 100644 index 0000000000000000000000000000000000000000..0ac129028e67b43fcae8e3d5c1a539cc45ba6d21 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/deepskyblue.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/default.PNG b/zh-cn/application-dev/reference/arkui-js-lite/figures/default.PNG new file mode 100644 index 0000000000000000000000000000000000000000..5e4322d20ad887573ad85958bc181a1be0f85f1c Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/default.PNG differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/dimgray.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/dimgray.png new file mode 100644 index 0000000000000000000000000000000000000000..1072a50f468dda3c90c889c31424b7c290eb1a13 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/dimgray.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/dimgrey.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/dimgrey.png new file mode 100644 index 0000000000000000000000000000000000000000..1072a50f468dda3c90c889c31424b7c290eb1a13 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/dimgrey.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/dodgerblue.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/dodgerblue.png new file mode 100644 index 0000000000000000000000000000000000000000..fe422eecde9ec9f1fcac762bd81a23b3fa3abde7 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/dodgerblue.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/ellipse.PNG b/zh-cn/application-dev/reference/arkui-js-lite/figures/ellipse.PNG new file mode 100644 index 0000000000000000000000000000000000000000..d0379dfc66b4d2151dae49beeb8af38c774381aa Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/ellipse.PNG differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/firebrick.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/firebrick.png new file mode 100644 index 0000000000000000000000000000000000000000..af32ecea68c1cef693bcfa379af5ac28f66c1e14 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/firebrick.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/floralwhite.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/floralwhite.png new file mode 100644 index 0000000000000000000000000000000000000000..5ee9f7e893611dce988b8aa7ccfe3fab4b9d912f Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/floralwhite.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/forestgreen.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/forestgreen.png new file mode 100644 index 0000000000000000000000000000000000000000..7cfd4846ca697424582edbfed23ed93ef9e98138 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/forestgreen.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/fuchsia.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/fuchsia.png new file mode 100644 index 0000000000000000000000000000000000000000..6823cbc9203b07abae455b4ee5c7692878c4be72 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/fuchsia.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/gainsboro.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/gainsboro.png new file mode 100644 index 0000000000000000000000000000000000000000..d1d37504e15eb6fccd6b1c8e985d37fcc8ba9875 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/gainsboro.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/gauge.PNG b/zh-cn/application-dev/reference/arkui-js-lite/figures/gauge.PNG new file mode 100644 index 0000000000000000000000000000000000000000..31c0141d716059519377e1f39b9b8305370f239a Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/gauge.PNG differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/ghostwhite.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/ghostwhite.png new file mode 100644 index 0000000000000000000000000000000000000000..45467f3e6fc0866b6da0521911bdb5e7d740df29 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/ghostwhite.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/gold.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/gold.png new file mode 100644 index 0000000000000000000000000000000000000000..91a276a7dffb4d98c507e9af6afa1912cca1fed2 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/gold.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/goldenrod.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/goldenrod.png new file mode 100644 index 0000000000000000000000000000000000000000..04ab7decab16cb7341665c2a67e8d5655a7eed6a Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/goldenrod.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/gray.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/gray.png new file mode 100644 index 0000000000000000000000000000000000000000..dfcb0c5e259b3f8d7375c21712249c1e847edd67 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/gray.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/green.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/green.png new file mode 100644 index 0000000000000000000000000000000000000000..bc28f5056c679e189543c8ad6fba67fb56db7655 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/green.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/greenyellow.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/greenyellow.png new file mode 100644 index 0000000000000000000000000000000000000000..c89f746719790333bce2bde8c5b8d86102fdfc33 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/greenyellow.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/grey.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/grey.png new file mode 100644 index 0000000000000000000000000000000000000000..dfcb0c5e259b3f8d7375c21712249c1e847edd67 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/grey.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/honeydew.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/honeydew.png new file mode 100644 index 0000000000000000000000000000000000000000..51fb00e10bb5c167506ddfae1689b58e368df340 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/honeydew.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/hotpink.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/hotpink.png new file mode 100644 index 0000000000000000000000000000000000000000..cbc1d312680f479e8c443476ea39eaf1e8a16e55 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/hotpink.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/image-animator.gif b/zh-cn/application-dev/reference/arkui-js-lite/figures/image-animator.gif new file mode 100644 index 0000000000000000000000000000000000000000..8321366bdb79b9e6530d53b0f45a6465ae7b967d Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/image-animator.gif differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/image.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/image.png new file mode 100644 index 0000000000000000000000000000000000000000..79db22cd94523a8854562e4c8b45ee22d8b45e90 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/image.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/indianred.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/indianred.png new file mode 100644 index 0000000000000000000000000000000000000000..069f570291be858a1768b75719a4a6adbd1bdef8 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/indianred.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/indigo.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/indigo.png new file mode 100644 index 0000000000000000000000000000000000000000..db83d39f98583ee653ee39b0237eb55961e539c7 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/indigo.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/input-type-button.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/input-type-button.png new file mode 100644 index 0000000000000000000000000000000000000000..247fed609d862aa73184f3428486ab62e82bf897 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/input-type-button.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/input-type-checkbox.gif b/zh-cn/application-dev/reference/arkui-js-lite/figures/input-type-checkbox.gif new file mode 100644 index 0000000000000000000000000000000000000000..2215e5cfa56f533c6b4d1318b2fa1fb07093dfaa Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/input-type-checkbox.gif differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/input-type-radio.gif b/zh-cn/application-dev/reference/arkui-js-lite/figures/input-type-radio.gif new file mode 100644 index 0000000000000000000000000000000000000000..bd5fea51c64deb1268793f3a3f70a2c379aebfda Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/input-type-radio.gif differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/ivory.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/ivory.png new file mode 100644 index 0000000000000000000000000000000000000000..ff0aa71de78cb461a6602398ee915c677efdf3d4 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/ivory.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/khaki.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/khaki.png new file mode 100644 index 0000000000000000000000000000000000000000..3fca22c329e9dc9ef73eee20757eac4ce7386842 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/khaki.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/lavender.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/lavender.png new file mode 100644 index 0000000000000000000000000000000000000000..44e4d991524bd0ef88a0dd10f204e022dd9d0621 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/lavender.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/lavenderblush.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/lavenderblush.png new file mode 100644 index 0000000000000000000000000000000000000000..5b22707e37ec772dc08a961e557a937862210167 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/lavenderblush.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/lawngreen.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/lawngreen.png new file mode 100644 index 0000000000000000000000000000000000000000..41be1a646e14511b5d177d11a7bce10deaee5bc9 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/lawngreen.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/lemonchiffon.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/lemonchiffon.png new file mode 100644 index 0000000000000000000000000000000000000000..d77ed21418dc3035feb9f9c8e15815e577d71a90 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/lemonchiffon.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/lightblue.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/lightblue.png new file mode 100644 index 0000000000000000000000000000000000000000..7cc96f8f6364b93923f0a88b895fe6b151080932 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/lightblue.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/lightcoral.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/lightcoral.png new file mode 100644 index 0000000000000000000000000000000000000000..515185ab1b3cf9aaba1204760dae19ab3c112b42 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/lightcoral.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/lightcyan.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/lightcyan.png new file mode 100644 index 0000000000000000000000000000000000000000..6f929d8ab35b708978d8053047cb56bec4fa83bc Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/lightcyan.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/lightgoldenrodyellow.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/lightgoldenrodyellow.png new file mode 100644 index 0000000000000000000000000000000000000000..1b0ed50716d897398c1e9a741e08ff5f1b9fd9de Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/lightgoldenrodyellow.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/lightgray.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/lightgray.png new file mode 100644 index 0000000000000000000000000000000000000000..0a5eb251a8d731dc6a9d8b1f31f904c42fd372c3 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/lightgray.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/lightgreen.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/lightgreen.png new file mode 100644 index 0000000000000000000000000000000000000000..f89943fc98661a6d2b78b5659c41483308a0c54b Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/lightgreen.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/lightpink.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/lightpink.png new file mode 100644 index 0000000000000000000000000000000000000000..6eb2d41877c85cccfb918b042bc13c81c58ec191 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/lightpink.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/lightsalmon.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/lightsalmon.png new file mode 100644 index 0000000000000000000000000000000000000000..d87462d1cdc9410e91ee050a53d58e71d1c5f312 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/lightsalmon.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/lightseagreen.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/lightseagreen.png new file mode 100644 index 0000000000000000000000000000000000000000..e863d7a1c3b9c1ca08bd182dce43c55a4866d59b Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/lightseagreen.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/lightskyblue.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/lightskyblue.png new file mode 100644 index 0000000000000000000000000000000000000000..daa035cea33b810571c18de67e4ac887eeb11850 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/lightskyblue.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/lightslategray.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/lightslategray.png new file mode 100644 index 0000000000000000000000000000000000000000..2dadb92ce56793e2dd693bfa7d99b0c1168130dc Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/lightslategray.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/lightslategrey.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/lightslategrey.png new file mode 100644 index 0000000000000000000000000000000000000000..2dadb92ce56793e2dd693bfa7d99b0c1168130dc Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/lightslategrey.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/lightsteelblue.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/lightsteelblue.png new file mode 100644 index 0000000000000000000000000000000000000000..ac0521001d2513fd69e48ce61e1d1128b9d3a6dd Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/lightsteelblue.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/lightyellow.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/lightyellow.png new file mode 100644 index 0000000000000000000000000000000000000000..d1ca7dd07fe7812ec1f87bf748595174569a5672 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/lightyellow.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/lime.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/lime.png new file mode 100644 index 0000000000000000000000000000000000000000..481c833482d38c5f564127c8f412fe3c0275fd24 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/lime.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/limegreen.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/limegreen.png new file mode 100644 index 0000000000000000000000000000000000000000..63a8c6adc29d340634ed06a1006a0fb56c991a9d Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/limegreen.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/linen.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/linen.png new file mode 100644 index 0000000000000000000000000000000000000000..486baf6be50982404fd1c68a5bc51db45c62046a Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/linen.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/list.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/list.png new file mode 100644 index 0000000000000000000000000000000000000000..eea4ba1ba4f92ab65a41990b830e7b1c72d99f09 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/list.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/lite_bar.PNG b/zh-cn/application-dev/reference/arkui-js-lite/figures/lite_bar.PNG new file mode 100644 index 0000000000000000000000000000000000000000..a180cd74fb6455adb495cf0d8471b34c93a9415e Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/lite_bar.PNG differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/lite_line.PNG b/zh-cn/application-dev/reference/arkui-js-lite/figures/lite_line.PNG new file mode 100644 index 0000000000000000000000000000000000000000..664ade98b38a3b6ac2b3e96dc4af8b75b6749a72 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/lite_line.PNG differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/magenta.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/magenta.png new file mode 100644 index 0000000000000000000000000000000000000000..6823cbc9203b07abae455b4ee5c7692878c4be72 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/magenta.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/maroon.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/maroon.png new file mode 100644 index 0000000000000000000000000000000000000000..1324b43b3f5b8dd0548cf2069c4c532c5284c445 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/maroon.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/marquee.gif b/zh-cn/application-dev/reference/arkui-js-lite/figures/marquee.gif new file mode 100644 index 0000000000000000000000000000000000000000..3b6df4b26274fdf5c3e6e1fab2423400455b7050 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/marquee.gif differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/mediumaquamarine.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/mediumaquamarine.png new file mode 100644 index 0000000000000000000000000000000000000000..800bf296338fd01962f16a8863c37bfe515ce3be Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/mediumaquamarine.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/mediumblue.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/mediumblue.png new file mode 100644 index 0000000000000000000000000000000000000000..c0df3f4f7d99f0b8c39995133c71d944bc07ea4b Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/mediumblue.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/mediumorchid.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/mediumorchid.png new file mode 100644 index 0000000000000000000000000000000000000000..664d13c38389361e61a45870899e2a6f0bfc835f Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/mediumorchid.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/mediumpurple.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/mediumpurple.png new file mode 100644 index 0000000000000000000000000000000000000000..848454297b67eb73ab641424badc438433e24479 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/mediumpurple.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/mediumseagreen.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/mediumseagreen.png new file mode 100644 index 0000000000000000000000000000000000000000..984e7a561e661ecefca8b60d5ac239b67f96c98c Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/mediumseagreen.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/mediumslateblue.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/mediumslateblue.png new file mode 100644 index 0000000000000000000000000000000000000000..39cf9d01563cf63bee003a47cd88258e860a0757 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/mediumslateblue.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/mediumspringgreen.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/mediumspringgreen.png new file mode 100644 index 0000000000000000000000000000000000000000..56db1024a714f821528656c64e12520311bae8f5 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/mediumspringgreen.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/mediumturquoise.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/mediumturquoise.png new file mode 100644 index 0000000000000000000000000000000000000000..b3c353b6a872d3597b767f4c216b2d16bfc2139b Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/mediumturquoise.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/mediumvioletred.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/mediumvioletred.png new file mode 100644 index 0000000000000000000000000000000000000000..00767e63c899eec52c2c732e834bca8d26d348ce Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/mediumvioletred.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/midnightblue.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/midnightblue.png new file mode 100644 index 0000000000000000000000000000000000000000..ac66614c0f277cd722b3d090cb10efb973152b0f Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/midnightblue.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/mintcream.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/mintcream.png new file mode 100644 index 0000000000000000000000000000000000000000..64fdda07447707816e8a6238939169f58a4ce58f Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/mintcream.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/mistyrose.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/mistyrose.png new file mode 100644 index 0000000000000000000000000000000000000000..6f5fe69b5a5a62b2d2b719b2be0a17a501363918 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/mistyrose.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/moccasin.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/moccasin.png new file mode 100644 index 0000000000000000000000000000000000000000..115cb4c96382681743381aeba099549dc24c2ae5 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/moccasin.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/navajowhite.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/navajowhite.png new file mode 100644 index 0000000000000000000000000000000000000000..a68e61ab120651294310c5e3632ce22d71917a52 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/navajowhite.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/navy.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/navy.png new file mode 100644 index 0000000000000000000000000000000000000000..4e41c2cd90ba17798448d70b493ccceb3ac960f0 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/navy.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/oldlace.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/oldlace.png new file mode 100644 index 0000000000000000000000000000000000000000..ecf361e4c749446160da1e8a07169b21d99f362a Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/oldlace.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/olive.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/olive.png new file mode 100644 index 0000000000000000000000000000000000000000..0d386fef5c4fa9faf1b29c7667c7392db250f2eb Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/olive.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/olivedrab.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/olivedrab.png new file mode 100644 index 0000000000000000000000000000000000000000..639f16f8aaf261176b3bc760c2eb616ad2f4aa28 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/olivedrab.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/orange.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/orange.png new file mode 100644 index 0000000000000000000000000000000000000000..9c43caf5fdfd466eafc37b793f509a6bde2b885d Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/orange.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/orangered.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/orangered.png new file mode 100644 index 0000000000000000000000000000000000000000..e72165fdf1b24d80f0abde742ad3d848497c6ea7 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/orangered.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/orchid.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/orchid.png new file mode 100644 index 0000000000000000000000000000000000000000..9114031e04fc28be59e8c9567c0fcfe81a9cc5cb Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/orchid.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/palegoldenrod.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/palegoldenrod.png new file mode 100644 index 0000000000000000000000000000000000000000..131584c72c082f40e2b466e2706c86a05df375e0 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/palegoldenrod.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/palegreen.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/palegreen.png new file mode 100644 index 0000000000000000000000000000000000000000..891d52276622fd51893634ce26e08bd56f62b782 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/palegreen.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/paleturquoise.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/paleturquoise.png new file mode 100644 index 0000000000000000000000000000000000000000..a618da21cf6c6d32066286e594921c0fc75b5dba Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/paleturquoise.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/palevioletred.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/palevioletred.png new file mode 100644 index 0000000000000000000000000000000000000000..c88212b6818d6d18c77ee497cfcafaf661a70d52 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/palevioletred.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/papayawhip.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/papayawhip.png new file mode 100644 index 0000000000000000000000000000000000000000..4b1948de8581602c6c5879c03d68c14f06eccd00 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/papayawhip.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/peachpuff.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/peachpuff.png new file mode 100644 index 0000000000000000000000000000000000000000..1821f9c40ad9d24dc10dc662ecbe7936c9e10633 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/peachpuff.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/peru.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/peru.png new file mode 100644 index 0000000000000000000000000000000000000000..3ca3e045717379bb09fa8d13ea0d42019bf546f2 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/peru.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/picker-view.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/picker-view.png new file mode 100644 index 0000000000000000000000000000000000000000..3e5375876c6c7403b254df56c75d08031ad9801d Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/picker-view.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/pink.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/pink.png new file mode 100644 index 0000000000000000000000000000000000000000..5c5e360f249a2002ba68ad9b94bd7f66f5d6aab1 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/pink.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/plum.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/plum.png new file mode 100644 index 0000000000000000000000000000000000000000..1e0bad2b2bfed2559e53a8bc21162e6163ec8434 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/plum.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/powderblue.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/powderblue.png new file mode 100644 index 0000000000000000000000000000000000000000..8b3eec4e46f6a29dc47694940ceaef1cfa1314af Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/powderblue.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/progress.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/progress.png new file mode 100644 index 0000000000000000000000000000000000000000..fb9170121d950b8d8b5a4a5a209c25b452791d25 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/progress.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/purple.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/purple.png new file mode 100644 index 0000000000000000000000000000000000000000..8bc3583f82d21c8bec0c70b2da36ed05723fd9a7 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/purple.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/qrcode.gif b/zh-cn/application-dev/reference/arkui-js-lite/figures/qrcode.gif new file mode 100644 index 0000000000000000000000000000000000000000..53e718c2879554c82d4a3d9800507a00e37613dc Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/qrcode.gif differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/rebeccapurple.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/rebeccapurple.png new file mode 100644 index 0000000000000000000000000000000000000000..6a64534a0a867d44cf81c8a34c9981b5fbaf5faf Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/rebeccapurple.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/red.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/red.png new file mode 100644 index 0000000000000000000000000000000000000000..309d1c46f8bc396df5eaed381a5ffa2f0389d602 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/red.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/rosybrown.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/rosybrown.png new file mode 100644 index 0000000000000000000000000000000000000000..adca00e684afb79ff4f21313d0586025576a8be1 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/rosybrown.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/royalblue.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/royalblue.png new file mode 100644 index 0000000000000000000000000000000000000000..69cb300d4bc8decee06c7fb64b03a24287865a8f Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/royalblue.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/saddlebrown.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/saddlebrown.png new file mode 100644 index 0000000000000000000000000000000000000000..5d0ae86ad14ff863511a10ecc1a85b273e826dfc Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/saddlebrown.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/salmon.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/salmon.png new file mode 100644 index 0000000000000000000000000000000000000000..b80a6c31cdb287c35965c7841aa97711d79b371c Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/salmon.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/sample1.gif b/zh-cn/application-dev/reference/arkui-js-lite/figures/sample1.gif new file mode 100644 index 0000000000000000000000000000000000000000..6168a14aa67c866abf6185ba3a3c2ae9f595153c Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/sample1.gif differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/sample_css.PNG b/zh-cn/application-dev/reference/arkui-js-lite/figures/sample_css.PNG new file mode 100644 index 0000000000000000000000000000000000000000..43c345e521bd9c87a9fb6da469548716cd20f918 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/sample_css.PNG differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/sandybrown.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/sandybrown.png new file mode 100644 index 0000000000000000000000000000000000000000..c952585d8032733700b57ce1a919d71ce9a4b58b Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/sandybrown.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/seagreen.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/seagreen.png new file mode 100644 index 0000000000000000000000000000000000000000..858c4187d3a2874f651adc09dcae9a32f8407d86 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/seagreen.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/seashell.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/seashell.png new file mode 100644 index 0000000000000000000000000000000000000000..c0b21ed6b44c2f756458137f931873f540c16e5f Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/seashell.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/sienna.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/sienna.png new file mode 100644 index 0000000000000000000000000000000000000000..bdb02fdda28a155e2f622eeea2ff820144780e50 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/sienna.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/silver.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/silver.png new file mode 100644 index 0000000000000000000000000000000000000000..0491d350277cd67d7774e3761164b9dd7038a117 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/silver.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/skyblue.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/skyblue.png new file mode 100644 index 0000000000000000000000000000000000000000..1c4f9ae52153198f8690a1066fe66ba8c7bd1ee1 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/skyblue.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/slateblue.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/slateblue.png new file mode 100644 index 0000000000000000000000000000000000000000..87915df37741dacfe9448bfebccf5a88d3ca2a76 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/slateblue.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/slategray.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/slategray.png new file mode 100644 index 0000000000000000000000000000000000000000..6e4476c4791e37d4681f8e12313ae1cad0887c1b Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/slategray.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/slider.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/slider.png new file mode 100644 index 0000000000000000000000000000000000000000..b72ed8404c613ec9283d7be1f56071d70fcbbc1f Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/slider.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/smoothOff.PNG b/zh-cn/application-dev/reference/arkui-js-lite/figures/smoothOff.PNG new file mode 100644 index 0000000000000000000000000000000000000000..c699e78774fadbd8da8c0cc290e88294d445aa6f Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/smoothOff.PNG differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/smoothOn.PNG b/zh-cn/application-dev/reference/arkui-js-lite/figures/smoothOn.PNG new file mode 100644 index 0000000000000000000000000000000000000000..b7a5a2a819eeafeb000c00bd7009a02e5fe1bbe5 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/smoothOn.PNG differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/snow.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/snow.png new file mode 100644 index 0000000000000000000000000000000000000000..283cf90b3828b36af6fb3a746e806f6715053310 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/snow.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/springgreen.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/springgreen.png new file mode 100644 index 0000000000000000000000000000000000000000..93825b7fe53a0794751ee4aa3ca46300c404835e Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/springgreen.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/sssssss.PNG b/zh-cn/application-dev/reference/arkui-js-lite/figures/sssssss.PNG new file mode 100644 index 0000000000000000000000000000000000000000..e108f5f8f2e096b319ef5097145ab43f2ad97594 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/sssssss.PNG differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/steelblue.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/steelblue.png new file mode 100644 index 0000000000000000000000000000000000000000..a9aba5f67b94427168fade014542532431e28a2e Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/steelblue.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/swiper.gif b/zh-cn/application-dev/reference/arkui-js-lite/figures/swiper.gif new file mode 100644 index 0000000000000000000000000000000000000000..2ec52b162dcfdd39c2d2f5a7be4106321935b010 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/swiper.gif differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/switch.gif b/zh-cn/application-dev/reference/arkui-js-lite/figures/switch.gif new file mode 100644 index 0000000000000000000000000000000000000000..64f8c8eb0c1ecf13e8b91f291782d825ce9f0076 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/switch.gif differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/tan.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/tan.png new file mode 100644 index 0000000000000000000000000000000000000000..b162dbf0a6c890a03ea1aa0b28bdb454651b697c Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/tan.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/teal.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/teal.png new file mode 100644 index 0000000000000000000000000000000000000000..93299fc38d761e5251673210c364f6825e319153 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/teal.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/text.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/text.png new file mode 100644 index 0000000000000000000000000000000000000000..d3a79bc7ae959d16d1eb4b915fa9040f00996b16 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/text.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/thistle.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/thistle.png new file mode 100644 index 0000000000000000000000000000000000000000..d62fc7767f7b2e0e8d0d7fed57e30bdf6a6a332f Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/thistle.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/tomato.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/tomato.png new file mode 100644 index 0000000000000000000000000000000000000000..6d795f1618b1546c94266548069eccf9e9af2e01 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/tomato.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/turquoise.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/turquoise.png new file mode 100644 index 0000000000000000000000000000000000000000..a33c4fce8448e2127b21e277437195ce0002766b Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/turquoise.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/violet.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/violet.png new file mode 100644 index 0000000000000000000000000000000000000000..e9a0799a203fdd7bd41fa5175585dc170a20156e Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/violet.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/wheat.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/wheat.png new file mode 100644 index 0000000000000000000000000000000000000000..8a5c7039b580128e75299672dc5438151dcf3572 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/wheat.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/white.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/white.png new file mode 100644 index 0000000000000000000000000000000000000000..56d32d4cd371c5374b133cb81c9c077aaf7b110d Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/white.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/whitesmoke.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/whitesmoke.png new file mode 100644 index 0000000000000000000000000000000000000000..6dc88e656c293c2e65939e4a793684488dfc81be Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/whitesmoke.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/yellow.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/yellow.png new file mode 100644 index 0000000000000000000000000000000000000000..b54dbc2391d1a8f16312dd02dc3d65a35ea2626f Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/yellow.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/yellowgreen.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/yellowgreen.png new file mode 100644 index 0000000000000000000000000000000000000000..f89e20a55ba1e81f2cbda2bd0241edefadbe7149 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/yellowgreen.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380789168.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380789168.png new file mode 100644 index 0000000000000000000000000000000000000000..4481b08ab897619b408425f9bfe0fd5b1fcb6ef0 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380789168.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380789172.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380789172.png new file mode 100644 index 0000000000000000000000000000000000000000..9a73bd33782f06a704ed9b288226dfa381d1d57c Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380789172.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380789180.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380789180.png new file mode 100644 index 0000000000000000000000000000000000000000..6e58c669a2976297f71d35c304e988c2884e7dc0 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380789180.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380789184.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380789184.png new file mode 100644 index 0000000000000000000000000000000000000000..5113bc6bad4f88bc2558aae304394e00e107ce88 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380789184.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380789188.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380789188.png new file mode 100644 index 0000000000000000000000000000000000000000..4d0696a9ade017acbbdfb8812dafdec5d715cac5 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380789188.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380789196.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380789196.png new file mode 100644 index 0000000000000000000000000000000000000000..ee003430ca365892a94c0dbe3e7ba0879f83059d Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380789196.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380789296.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380789296.png new file mode 100644 index 0000000000000000000000000000000000000000..f627659cef03f443e01fb28b44ceb9363369b8d8 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380789296.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380948700.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380948700.png new file mode 100644 index 0000000000000000000000000000000000000000..8f6b4abcc27039c624bd21aad775db7c47a22dea Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380948700.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380948704.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380948704.png new file mode 100644 index 0000000000000000000000000000000000000000..151ef990edbb33e1f54632609990f6c540149a5e Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380948704.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380948708.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380948708.png new file mode 100644 index 0000000000000000000000000000000000000000..e061801d6eeb27d7fee0b287414e512559a87ea9 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380948708.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380948712.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380948712.png new file mode 100644 index 0000000000000000000000000000000000000000..56c65edbcd66a2ebe9d8ef35c55eba90652bca0f Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380948712.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380948716.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380948716.png new file mode 100644 index 0000000000000000000000000000000000000000..db54e678d8c42daca3e56dd85567c9978a9657c8 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380948716.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380948720.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380948720.png new file mode 100644 index 0000000000000000000000000000000000000000..f59a10b44b9e9793bc3a9134f6c4633c8cfb49ce Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380948720.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380948828.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380948828.png new file mode 100644 index 0000000000000000000000000000000000000000..f304daf1f80c86ca6f415e4f7a49b17ca20dae04 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001380948828.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381108312.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381108312.png new file mode 100644 index 0000000000000000000000000000000000000000..3917378fdcb47448e7daf8ae197e6d033fd345e9 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381108312.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381108316.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381108316.png new file mode 100644 index 0000000000000000000000000000000000000000..4c8300af3bdf43e4d2192699b5ed4065fef451c0 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381108316.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381108320.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381108320.png new file mode 100644 index 0000000000000000000000000000000000000000..3404b29dff12b910ae1be71ebf762252895468a8 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381108320.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381108324.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381108324.png new file mode 100644 index 0000000000000000000000000000000000000000..dfee4f8cddcddd2ada89cb6d7e812fd0739d9cb8 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381108324.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381108328.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381108328.png new file mode 100644 index 0000000000000000000000000000000000000000..33787429dd3205f9faac254950e95c097bd63b21 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381108328.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381108332.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381108332.png new file mode 100644 index 0000000000000000000000000000000000000000..67959174e9b810b9278a7940bc097ac0c0738c7e Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381108332.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381108420.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381108420.png new file mode 100644 index 0000000000000000000000000000000000000000..3ecdf0c714fa633f03db339626f51e62318cbf82 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381108420.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381108436.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381108436.png new file mode 100644 index 0000000000000000000000000000000000000000..f6288a0361793fbbce554fd293831fae4bcefc9d Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381108436.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381268264.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381268264.png new file mode 100644 index 0000000000000000000000000000000000000000..0c8973bcb7d55910c6702fe6b9b54506ad3b3727 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381268264.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381268268.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381268268.png new file mode 100644 index 0000000000000000000000000000000000000000..3cc02a6196604a6a3d64b9961c04aaaa51dc829e Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381268268.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381268272.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381268272.png new file mode 100644 index 0000000000000000000000000000000000000000..658dca4b52032016c15f77a94b3ef76c093b1d2c Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381268272.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381268276.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381268276.png new file mode 100644 index 0000000000000000000000000000000000000000..8192453ec25d486b3923da4a25b0a6fe5034d869 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381268276.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381268280.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381268280.png new file mode 100644 index 0000000000000000000000000000000000000000..2f786e33181995c2b5bf5f835df4557ff3f7e9b4 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381268280.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381268284.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381268284.png new file mode 100644 index 0000000000000000000000000000000000000000..9ac4a39e925322831752617b71a77d040626d251 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381268284.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381268388.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381268388.png new file mode 100644 index 0000000000000000000000000000000000000000..366ab30f3e3f9f4b7e8b579b06cd84a76b2bfabc Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001381268388.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431148353.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431148353.png new file mode 100644 index 0000000000000000000000000000000000000000..e89a1b24da145cf480cceb28ed7249b717e614bf Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431148353.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431148357.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431148357.png new file mode 100644 index 0000000000000000000000000000000000000000..68562c1006ec7c61c49c24aec99ecfd173ca055a Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431148357.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431148361.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431148361.png new file mode 100644 index 0000000000000000000000000000000000000000..bd4f47314f89fa4bbbd2d14527dd250b5e3e141b Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431148361.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431148365.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431148365.png new file mode 100644 index 0000000000000000000000000000000000000000..42efd9018bc05408596a768cbbe309f1e46273d7 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431148365.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431148369.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431148369.png new file mode 100644 index 0000000000000000000000000000000000000000..3108e0436219c1c3a7335679cdfea962c49f454d Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431148369.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431148457.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431148457.png new file mode 100644 index 0000000000000000000000000000000000000000..91c55d3677922b76ac78c4e56c87ef90b5b31fc2 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431148457.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431308057.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431308057.png new file mode 100644 index 0000000000000000000000000000000000000000..cc1dc87c79f827c8bb5be3f3771c37f4cb8b214e Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431308057.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431308061.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431308061.png new file mode 100644 index 0000000000000000000000000000000000000000..1362b8a3d98f4edf36420d3799f01476817e43d4 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431308061.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431308065.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431308065.png new file mode 100644 index 0000000000000000000000000000000000000000..2f9a8bacc0f78cb141820e8188d4ae5ef03dc7c1 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431308065.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431308073.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431308073.png new file mode 100644 index 0000000000000000000000000000000000000000..44ae627d6e40dd4b297eccdcf1c5dceef5a08d82 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431308073.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431308077.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431308077.png new file mode 100644 index 0000000000000000000000000000000000000000..f4e18dbe51e815ccdfc6f594e3424850c3b93a12 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431308077.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431308169.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431308169.png new file mode 100644 index 0000000000000000000000000000000000000000..612bc55f4aa5e832133801edf61cef01ffd1bc64 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431308169.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431308185.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431308185.png new file mode 100644 index 0000000000000000000000000000000000000000..3dccd46b21e76a7bbbaabc1ab77a29bd72ae850d Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431308185.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431388505.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431388505.png new file mode 100644 index 0000000000000000000000000000000000000000..47f90714bcb37e4df1b698503db6893d6c2a98c4 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431388505.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431388513.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431388513.png new file mode 100644 index 0000000000000000000000000000000000000000..072d846a3cd629316cd0dcf25d5e9e1e1d3e0dc4 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431388513.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431388517.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431388517.png new file mode 100644 index 0000000000000000000000000000000000000000..5b526bdf7cd539297715bbcddbbd505b7c683695 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431388517.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431388521.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431388521.png new file mode 100644 index 0000000000000000000000000000000000000000..1d5aedb22cb51d00b176f44c5ac5f3ad29d843f2 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431388521.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431388525.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431388525.png new file mode 100644 index 0000000000000000000000000000000000000000..1d71cee4618f1f2822cea1031c9b0e5d602e0a9b Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431388525.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431388529.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431388529.png new file mode 100644 index 0000000000000000000000000000000000000000..8253c65764c8d74e0a25404aa62fdd69d43f3c26 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431388529.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431388581.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431388581.png new file mode 100644 index 0000000000000000000000000000000000000000..5ccdc532cb219f1175708b11241a37d912e2ec2e Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431388581.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431388637.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431388637.png new file mode 100644 index 0000000000000000000000000000000000000000..f9db5c31c8eae66244cd3f6e11336f72284bb2a6 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431388637.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431548105.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431548105.png new file mode 100644 index 0000000000000000000000000000000000000000..5da42e3e14d601745274cb62d914c6600620bb25 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431548105.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431548109.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431548109.png new file mode 100644 index 0000000000000000000000000000000000000000..63b480df9e9700601da85abef015c8326095851f Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431548109.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431548113.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431548113.png new file mode 100644 index 0000000000000000000000000000000000000000..63f343e89f62b15c117e0148c87ac049308c3117 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431548113.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431548117.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431548117.png new file mode 100644 index 0000000000000000000000000000000000000000..6afdd1b39e4bcb3664c7664a55b47b8537f4aeaa Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431548117.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431548121.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431548121.png new file mode 100644 index 0000000000000000000000000000000000000000..d6bbab16659f4b34b38a714510665ea7fd309055 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431548121.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431548125.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431548125.png new file mode 100644 index 0000000000000000000000000000000000000000..fea0122d3ef81899a02199c6cb265a099ad6c44f Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431548125.png differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431548233.png b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431548233.png new file mode 100644 index 0000000000000000000000000000000000000000..4cef59797fd8b9650c398562ac0b473485a9274b Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/figures/zh-cn_image_0000001431548233.png differ diff --git "a/zh-cn/application-dev/reference/arkui-js-lite/figures/\345\212\250\347\224\273\346\240\267\345\274\217demo1.gif" "b/zh-cn/application-dev/reference/arkui-js-lite/figures/\345\212\250\347\224\273\346\240\267\345\274\217demo1.gif" new file mode 100644 index 0000000000000000000000000000000000000000..fc1eadbb05520daa6d79779683db96d0afe7cbdd Binary files /dev/null and "b/zh-cn/application-dev/reference/arkui-js-lite/figures/\345\212\250\347\224\273\346\240\267\345\274\217demo1.gif" differ diff --git "a/zh-cn/application-dev/reference/arkui-js-lite/figures/\345\212\250\347\224\273\346\240\267\345\274\217demo2.gif" "b/zh-cn/application-dev/reference/arkui-js-lite/figures/\345\212\250\347\224\273\346\240\267\345\274\217demo2.gif" new file mode 100644 index 0000000000000000000000000000000000000000..c3d337edf8e35352dcc9d9b9919019e1f7ec4d96 Binary files /dev/null and "b/zh-cn/application-dev/reference/arkui-js-lite/figures/\345\212\250\347\224\273\346\240\267\345\274\217demo2.gif" differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-common-attributes.md b/zh-cn/application-dev/reference/arkui-js-lite/js-common-attributes.md new file mode 100644 index 0000000000000000000000000000000000000000..36637b58e4af2013c749aadb93fc173bcfada4d7 --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js-lite/js-common-attributes.md @@ -0,0 +1,28 @@ +# 通用属性 + + +## 常规属性 + +常规属性指的是组件普遍支持的用来设置组件基本标识和外观显示特征的属性。 + +| 名称 | 类型 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | +| id | string | 否 | 组件的唯一标识。 | +| style | string | 否 | 组件的样式声明。 | +| class | string | 否 | 组件的样式类,用于引用样式表。 | +| ref | string | 否 | 用来指定指向子元素的引用信息,该引用将注册到父组件的$refs 属性对象上。 | + + +## 渲染属性 + +组件普遍支持的用来设置组件是否渲染的属性。 + +| 名称 | 类型 | 描述 | +| -------- | -------- | -------- | +| for | Array | 根据设置的数据列表,展开当前元素。 | +| if | boolean | 根据设置的boolean值,添加或移除当前元素。 | +| show | boolean | 根据设置的boolean值,显示或隐藏当前元素。 | + +> **说明:** +> +> 属性和样式不能混用,不能在属性字段中进行样式设置。 diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-common-events.md b/zh-cn/application-dev/reference/arkui-js-lite/js-common-events.md new file mode 100644 index 0000000000000000000000000000000000000000..b97c3cc525ce41b8bc8a1a9f4d1e3ecc1b13e743 --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js-lite/js-common-events.md @@ -0,0 +1,18 @@ +# 通用事件 + + +相对于私有事件,大部分组件都可以绑定如下事件。 + + +| 名称 | 参数 | 描述 | +| -------- | -------- | -------- | +| click | - | 点击动作触发该事件。 | +| longpress | - | 长按动作触发该事件。 | +| swipe5+ | SwipeEvent | 组件上快速滑动后触发。 | + + + **表6** SwipeEvent 基础事件对象属性列表(继承BaseEvent) + +| 属性 | 类型 | 说明 | +| -------- | -------- | -------- | +| direction | string | 滑动方向,可能值有:
1. left:向左滑动;
2. right:向右滑动;
3. up:向上滑动;
4. down:向下滑动。 | diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-common-styles.md b/zh-cn/application-dev/reference/arkui-js-lite/js-common-styles.md new file mode 100644 index 0000000000000000000000000000000000000000..48e1311e360318cab2a240d45d8e7075c5c5605b --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js-lite/js-common-styles.md @@ -0,0 +1,187 @@ +# 通用样式 + + +组件普遍支持的可以在style或css中设置组件外观样式。 + + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| width | <length> \| <percentage>5+ | - | 否 | 设置组件自身的宽度。

未设置时组件宽度默认为0。 | +| height | <length> \| <percentage>5+ | - | 否 | 设置组件自身的高度。

未设置时组件高度默认为0。 | +| padding | <length> | 0 | 否 | 使用简写属性设置所有的内边距属性。
  该属性可以有1到4个值:
- 指定一个值时,该值指定四个边的内边距。
- 指定两个值时,第一个值指定上下两边的内边距,第二个指定左右两边的内边距。
- 指定三个值时,第一个指定上边的内边距,第二个指定左右两边的内边距,第三个指定下边的内边距。
- 指定四个值时分别为上、右、下、左边的内边距(顺时针顺序)。 | +| padding-[left\|top\|right\|bottom] | <length> | 0 | 否 | 设置左、上、右、下内边距属性。 | +| margin | <length> \| <percentage>5+ | 0 | 否 | 使用简写属性设置所有的外边距属性,该属性可以有1到4个值。
- 只有一个值时,这个值会被指定给全部的四个边。
- 两个值时,第一个值被匹配给上和下,第二个值被匹配给左和右。
- 三个值时,第一个值被匹配给上, 第二个值被匹配给左和右,第三个值被匹配给下。
- 四个值时,会依次按上、右、下、左的顺序匹配 (即顺时针顺序)。 | +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | 否 | 设置左、上、右、下外边距属性。 | +| border-width | <length> | 0 | 否 | 使用简写属性设置元素的所有边框宽度。 | +| border-color | <color> | black | 否 | 使用简写属性设置元素的所有边框颜色。 | +| border-radius | <length> | - | 否 | border-radius属性是设置元素的外边框圆角半径。 | +| background-color | <color> | - | 否 | 设置背景颜色。 | +| opacity5+ | number | 1 | 否 | 元素的透明度,取值范围为0到1,1表示为不透明,0表示为完全透明。 | +| display | string | flex | 否 | 确定一个元素所产生的框的类型,可选值为:
- flex:弹性布局。
- none:不渲染此元素。 | +| [left\|top] | <length> \| <percentage>6+ | - | 否 | left\|top确定元素的偏移位置。
- left属性规定元素的左边缘。该属性定义了定位元素左外边距边界与其包含块左边界之间的偏移。
- top属性规定元素的顶部边缘。该属性定义了一个定位元素的上外边距边界与其包含块上边界之间的偏移。 | + + +> **说明:** +> 通用样式都不是必填项。 +> +> 目前,样式支持的颜色格式如下: +> - rgb(255, 255, 255) +> +> - rgba(255, 255, 255, 1.0) +> +> - HEX格式:\#rrggbb,\#aarrggbb +> +> - 枚举格式:black,white等,详见 **表1** 当前支持的颜色枚举。Script脚本中不支持枚举格式。 + + + **表1** 当前支持的颜色枚举 + +| 枚举名称 | 对应颜色 | 颜色 | +| -------- | -------- | -------- | +| aliceblue | \#f0f8ff | ![aliceblue](figures/aliceblue.png) | +| antiquewhite | \#faebd7 | ![antiquewhite](figures/antiquewhite.png) | +| aqua | \#00ffff | ![aqua](figures/aqua.png) | +| aquamarine | \#7fffd4 | ![aquamarine](figures/aquamarine.png) | +| azure | \#f0ffff | ![azure](figures/azure.png) | +| beige | \#f5f5dc | ![beige](figures/beige.png) | +| bisque | \#ffe4c4 | ![bisque](figures/bisque.png) | +| black | \#000000 | ![#000000](figures/#000000.png) | +| blanchedalmond | \#ffebcd | ![blanchedalmond](figures/blanchedalmond.png) | +| blue | \#0000ff | ![blue](figures/blue.png) | +| blueviolet | \#8a2be2 | ![blueviolet](figures/blueviolet.png) | +| brown | \#a52a2a | ![brown](figures/brown.png) | +| burlywood | \#deB887 | ![burlywood](figures/burlywood.png) | +| cadetblue | \#5f9ea0 | ![cadetblue](figures/cadetblue.png) | +| chartreuse | \#7fff00 | ![chartreuse](figures/chartreuse.png) | +| chocolate | \#d2691e | ![chocolate](figures/chocolate.png) | +| coral | \#ff7f50 | ![coral](figures/coral.png) | +| cornflowerblue | \#6495ed | ![cornflowerblue](figures/cornflowerblue.png) | +| cornsilk | \#fff8dc | ![cornsilk](figures/cornsilk.png) | +| crimson | \#dc143c | ![crimson](figures/crimson.png) | +| cyan | \#00ffff | ![cyan](figures/cyan.png) | +| darkblue | \#00008b | ![darkblue](figures/darkblue.png) | +| darkcyan | \#008b8b | ![darkcyan](figures/darkcyan.png) | +| darkgoldenrod | \#b8860b | ![darkgoldenrod](figures/darkgoldenrod.png) | +| darkgray | \#a9a9a9 | ![darkgray](figures/darkgray.png) | +| darkgreen | \#006400 | ![darkgreen](figures/darkgreen.png) | +| darkgrey | \#a9a9a9 | ![darkgrey](figures/darkgrey.png) | +| darkkhaki | \#bdb76b | ![darkkhaki](figures/darkkhaki.png) | +| darkmagenta | \#8b008b | ![darkmagenta](figures/darkmagenta.png) | +| darkolivegreen | \#556b2f | ![darkolivegreen](figures/darkolivegreen.png) | +| darkorange | \#ff8c00 | ![darkorange](figures/darkorange.png) | +| darkorchid | \#9932cc | ![darkorchid](figures/darkorchid.png) | +| darkred | \#8b0000 | ![darkred](figures/darkred.png) | +| darksalmon | \#e9967a | ![darksalmon](figures/darksalmon.png) | +| darkseagreen | \#8fbc8f | ![darkseagreen](figures/darkseagreen.png) | +| darkslateblue | \#483d8b | ![darkslateblue](figures/darkslateblue.png) | +| darkslategray | \#2f4f4f | ![darkslategray](figures/darkslategray.png) | +| darkslategrey | \#2f4f4f | ![darkslategrey](figures/darkslategrey.png) | +| darkturquoise | \#00ced1 | ![darkturquoise](figures/darkturquoise.png) | +| darkviolet | \#9400d3 | ![darkviolet](figures/darkviolet.png) | +| deeppink | \#ff1493 | ![deeppink](figures/deeppink.png) | +| deepskyblue | \#00bfff | ![deepskyblue](figures/deepskyblue.png) | +| dimgray | \#696969 | ![dimgray](figures/dimgray.png) | +| dimgrey | \#696969 | ![dimgrey](figures/dimgrey.png) | +| dodgerblue | \#1e90ff | ![dodgerblue](figures/dodgerblue.png) | +| firebrick | \#b22222 | ![firebrick](figures/firebrick.png) | +| floralwhite | \#fffaf0 | ![floralwhite](figures/floralwhite.png) | +| forestgreen | \#228b22 | ![forestgreen](figures/forestgreen.png) | +| fuchsia | \#ff00ff | ![fuchsia](figures/fuchsia.png) | +| gainsboro | \#dcdcdc | ![gainsboro](figures/gainsboro.png) | +| ghostwhite | \#f8f8ff | ![ghostwhite](figures/ghostwhite.png) | +| gold | \#ffd700 | ![gold](figures/gold.png) | +| goldenrod | \#daa520 | ![goldenrod](figures/goldenrod.png) | +| gray | \#808080 | ![gray](figures/gray.png) | +| green | \#008000 | ![green](figures/green.png) | +| greenyellow | \#adff2f | ![greenyellow](figures/greenyellow.png) | +| grey | \#808080 | ![grey](figures/grey.png) | +| honeydew | \#f0fff0 | ![honeydew](figures/honeydew.png) | +| hotpink | \#ff69b4 | ![hotpink](figures/hotpink.png) | +| indianred | \#cd5c5c | ![indianred](figures/indianred.png) | +| indigo | \#4b0082 | ![indigo](figures/indigo.png) | +| ivory | \#fffff0 | ![ivory](figures/ivory.png) | +| khaki | \#f0e68c | ![khaki](figures/khaki.png) | +| lavender | \#e6e6fa | ![lavender](figures/lavender.png) | +| lavenderblush | \#fff0f5 | ![lavenderblush](figures/lavenderblush.png) | +| lawngreen | \#7cfc00 | ![lawngreen](figures/lawngreen.png) | +| lemonchiffon | \#fffacd | ![lemonchiffon](figures/lemonchiffon.png) | +| lightblue | \#add8e6 | ![lightblue](figures/lightblue.png) | +| lightcoral | \#f08080 | ![lightcoral](figures/lightcoral.png) | +| lightcyan | \#e0ffff | ![lightcyan](figures/lightcyan.png) | +| lightgoldenrodyellow | \#fafad2 | ![lightgoldenrodyellow](figures/lightgoldenrodyellow.png) | +| lightgray | \#d3d3d3 | ![lightgray](figures/lightgray.png) | +| lightgreen | \#90ee90 | ![lightgreen](figures/lightgreen.png) | +| lightpink | \#ffb6c1 | ![lightpink](figures/lightpink.png) | +| lightsalmon | \#ffa07a | ![lightsalmon](figures/lightsalmon.png) | +| lightseagreen | \#20b2aa | ![lightseagreen](figures/lightseagreen.png) | +| lightskyblue | \#87cefa | ![lightskyblue](figures/lightskyblue.png) | +| lightslategray | \#778899 | ![lightslategray](figures/lightslategray.png) | +| lightslategrey | \#778899 | ![lightslategrey](figures/lightslategrey.png) | +| lightsteelblue | \#b0c4de | ![lightsteelblue](figures/lightsteelblue.png) | +| lightyellow | \#ffffe0 | ![lightyellow](figures/lightyellow.png) | +| lime | \#00ff00 | ![lime](figures/lime.png) | +| limegreen | \#32cd32 | ![limegreen](figures/limegreen.png) | +| linen | \#faf0e6 | ![linen](figures/linen.png) | +| magenta | \#ff00ff | ![magenta](figures/magenta.png) | +| maroon | \#800000 | ![maroon](figures/maroon.png) | +| mediumaquamarine | \#66cdaa | ![mediumaquamarine](figures/mediumaquamarine.png) | +| mediumblue | \#0000cd | ![mediumblue](figures/mediumblue.png) | +| mediumorchid | \#ba55d3 | ![mediumorchid](figures/mediumorchid.png) | +| mediumpurple | \#9370db | ![mediumpurple](figures/mediumpurple.png) | +| mediumseagreen | \#3cb371 | ![mediumseagreen](figures/mediumseagreen.png) | +| mediumslateblue | \#7b68ee | ![mediumslateblue](figures/mediumslateblue.png) | +| mediumspringgreen | \#00fa9a | ![mediumspringgreen](figures/mediumspringgreen.png) | +| mediumturquoise | \#48d1cc | ![mediumturquoise](figures/mediumturquoise.png) | +| mediumvioletred | \#c71585 | ![mediumvioletred](figures/mediumvioletred.png) | +| midnightblue | \#191970 | ![midnightblue](figures/midnightblue.png) | +| mintcream | \#f5fffa | ![mintcream](figures/mintcream.png) | +| mistyrose | \#ffe4e1 | ![mistyrose](figures/mistyrose.png) | +| moccasin | \#ffe4b5 | ![moccasin](figures/moccasin.png) | +| navajowhite | \#ffdead | ![navajowhite](figures/navajowhite.png) | +| navy | \#000080 | ![navy](figures/navy.png) | +| oldlace | \#fdf5e6 | ![oldlace](figures/oldlace.png) | +| olive | \#808000 | ![olive](figures/olive.png) | +| olivedrab | \#6b8e23 | ![olivedrab](figures/olivedrab.png) | +| orange | \#ffa500 | ![orange](figures/orange.png) | +| orangered | \#ff4500 | ![orangered](figures/orangered.png) | +| orchid | \#da70d6 | ![orchid](figures/orchid.png) | +| palegoldenrod | \#eee8aa | ![palegoldenrod](figures/palegoldenrod.png) | +| palegreen | \#98fb98 | ![palegreen](figures/palegreen.png) | +| paleturquoise | \#afeeee | ![paleturquoise](figures/paleturquoise.png) | +| palevioletred | \#db7093 | ![palevioletred](figures/palevioletred.png) | +| papayawhip | \#ffefd5 | ![papayawhip](figures/papayawhip.png) | +| peachpuff | \#ffdab9 | ![peachpuff](figures/peachpuff.png) | +| peru | \#cd853f | ![peru](figures/peru.png) | +| pink | \#ffc0cb | ![pink](figures/pink.png) | +| plum | \#dda0dd | ![plum](figures/plum.png) | +| powderblue | \#b0e0e6 | ![powderblue](figures/powderblue.png) | +| purple | \#800080 | ![purple](figures/purple.png) | +| rebeccapurple | \#663399 | ![rebeccapurple](figures/rebeccapurple.png) | +| red | \#ff0000 | ![red](figures/red.png) | +| rosybrown | \#bc8f8f | ![rosybrown](figures/rosybrown.png) | +| royalblue | \#4169e1 | ![royalblue](figures/royalblue.png) | +| saddlebrown | \#8b4513 | ![saddlebrown](figures/saddlebrown.png) | +| salmon | \#fa8072 | ![salmon](figures/salmon.png) | +| sandybrown | \#f4a460 | ![sandybrown](figures/sandybrown.png) | +| seagreen | \#2e8b57 | ![seagreen](figures/seagreen.png) | +| seashell | \#fff5ee | ![seashell](figures/seashell.png) | +| sienna | \#a0522d | ![sienna](figures/sienna.png) | +| silver | \#c0c0c0 | ![silver](figures/silver.png) | +| skyblue | \#87ceeb | ![skyblue](figures/skyblue.png) | +| slateblue | \#6a5acd | ![slateblue](figures/slateblue.png) | +| slategray | \#708090 | ![slategray](figures/slategray.png) | +| slategrey | \#708090 | ![slategray](figures/slategray.png) | +| snow | \#fffafa | ![snow](figures/snow.png) | +| springgreen | \#00ff7f | ![springgreen](figures/springgreen.png) | +| steelblue | \#4682b4 | ![steelblue](figures/steelblue.png) | +| tan | \#d2b48c | ![tan](figures/tan.png) | +| teal | \#008080 | ![teal](figures/teal.png) | +| thistle | \#d8Bfd8 | ![thistle](figures/thistle.png) | +| tomato | \#ff6347 | ![tomato](figures/tomato.png) | +| turquoise | \#40e0d0 | ![turquoise](figures/turquoise.png) | +| violet | \#ee82ee | ![violet](figures/violet.png) | +| wheat | \#f5deb3 | ![wheat](figures/wheat.png) | +| white | \#ffffff | ![white](figures/white.png) | +| whitesmoke | \#f5f5f5 | ![whitesmoke](figures/whitesmoke.png) | +| yellow | \#ffff00 | ![yellow](figures/yellow.png) | +| yellowgreen | \#9acd32 | ![yellowgreen](figures/yellowgreen.png) | diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-chart.md b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-chart.md new file mode 100644 index 0000000000000000000000000000000000000000..71730347c3280ff915655e5d916c4c97fa5e3693 --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-chart.md @@ -0,0 +1,275 @@ +# chart + +图表组件,用于呈现线形图、柱状图界面。 + +> **说明:** +> +> 该组件从从API version 4 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + + +## 子组件 + +不支持。 + + +## 属性 + +| 名称 | 类型 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | +| type | string | 否 | 设置图表类型(不支持动态修改),可选项有:
- bar:柱状图。
- line:线形图。
默认值:line | +| options | ChartOptions | 是 | 图表参数设置,柱状图和线形图必须设置参数设置。可以设置x轴、y轴的最小值、最大值、刻度数、是否显示,线条宽度、是否平滑等。(不支持动态修改) | +| datasets | Array<ChartDataset> | 是 | 数据集合,柱状图和线形图必须设置数据集合。可以设置多条数据集及其背景色。 | +| id | string | 否 | 组件的唯一标识。 | +| style | string | 否 | 组件的样式声明。 | +| class | string | 否 | 组件的样式类,用于引用样式表。 | +| ref | string | 否 | 用来指定指向子元素的引用信息,该引用将注册到父组件的$refs 属性对象上。 | + + **表2** ChartOptions + +| 名称 | 类型 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | +| xAxis | ChartAxis | 是 | x轴参数设置。可以设置x轴最小值、最大值、刻度数以及是否显示。 | +| yAxis | ChartAxis | 是 | y轴参数设置。可以设置y轴最小值、最大值、刻度数以及是否显示。 | +| series | ChartSeries | 否 | 数据序列参数设置。可以设置:
1. 线的样式,如线宽、是否平滑;
2. 设置线最前端位置白点的样式和大小。
**说明:**
仅线形图支持。 | + + **表3** ChartDataset + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| backgroundColor(deprecated) | <color> | \#ff6384 | 否 | 设置线或柱的颜色(不推荐使用)。 | +| strokeColor | <color> | \#ff6384 | 否 | 线条颜色。仅线形图支持。 | +| fillColor | <color> | \#ff6384 | 否 | 填充颜色。线形图表示填充的渐变颜色。 | +| data | Array<number> | - | 是 | 设置绘制线或柱中的点集。 | +| gradient | boolean | false | 否 | 设置是否显示填充渐变颜色。仅线形图支持。 | + + **表4** ChartAxis + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| min | number | 0 | 否 | 轴的最小值。
不支持负数。仅线形图支持。 | +| max | number | 100 | 否 | 轴的最大值。
不支持负数。仅线形图支持。 | +| axisTick | number | 10 | 否 | 轴显示的刻度数量。
**说明:**
仅支持1~20,且具体显示的效果与如下计算值有关(图的宽度所占的像素/(max-min))。
因轻量级智能穿戴为整型运行,在除不尽的情况下会有误差产生,具体的表现形式是x轴末尾可能会空出一段。
在柱状图中,每组数据显示的柱子数量与刻度数量一致,且柱子显示在刻度处。 | +| display | boolean | false | 否 | 是否显示轴。 | +| color | <color> | \#c0c0c0 | 否 | 轴颜色。 | + + **表5** ChartSeries + +| 名称 | 类型 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | +| lineStyle | ChartLineStyle | 否 | 线样式设置,如线宽、是否平滑。 | +| headPoint | PointStyle | 否 | 线最前端位置白点的样式和大小。 | +| topPoint | PointStyle | 否 | 最高点的样式和大小。 | +| bottomPoint | PointStyle | 否 | 最低点的样式和大小。 | +| loop | ChartLoop | 否 | 设置屏幕显示满时,是否需要重头开始绘制。 | + + **表6** ChartLineStyle + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| width | <length> | 1px | 否 | 线宽设置。 | +| smooth | boolean | false | 否 | 是否平滑。 | + + **表7** PointStyle + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| shape | string | circle | 否 | 高亮点的形状。可选值为:
- circle:圆形。 | +| size | <length> | 5px | 否 | 高亮点的大小。 | +| strokeWidth | <length> | 1px | 否 | 边框宽度 | +| strokeColor | <color> | \#ff0000 | 否 | 边框颜色。 | +| fillColor | <color> | \#ff0000 | 否 | 填充颜色。 | +| display | boolean | true | 否 | 是否高亮显示。 | + + **表8** ChartLoop + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| margin | <length> | 1 | 否 | 擦除点的个数(最新绘制的点与最老的点之间的横向距离)。注意:轻量设备margin和topPoint/bottomPoint/headPoint同时使用时,有概率出现point正好位于擦除区域的情况,导致point不可见,因此不建议同时使用。 | + + + + +## 方法 + +| 方法 | 参数 | 描述 | +| -------- | -------- | -------- | +| append | {
serial: number, // 设置要更新的线形图数据下标
data: Array<number>, // 设置新增的数据
} | 往已有的数据序列中动态添加数据,根据serial指定目标序列,serial为datasets数组的下标,从0开始。注意:不会更新datasets[index].data。仅线形图支持,按横坐标加1递增(与xAxis min/max设置相关)。 | + + +## 事件 + +| 名称 | 参数 | 描述 | +| -------- | -------- | -------- | +| click | - | 点击动作触发该事件。 | +| longpress | - | 长按动作触发该事件。 | +| swipe5+ | [SwipeEvent](js-common-events.md) | 组件上快速滑动后触发。 | + + +## 样式 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| width | <length> \| <percentage>5+ | - | 否 | 设置组件自身的宽度。

未设置时组件宽度默认为0。 | +| height | <length> \| <percentage>5+ | - | 否 | 设置组件自身的高度。

未设置时组件高度默认为0。 | +| padding | <length> | 0 | 否 | 使用简写属性设置所有的内边距属性。
  该属性可以有1到4个值:
- 指定一个值时,该值指定四个边的内边距。
- 指定两个值时,第一个值指定上下两边的内边距,第二个指定左右两边的内边距。
- 指定三个值时,第一个指定上边的内边距,第二个指定左右两边的内边距,第三个指定下边的内边距。
- 指定四个值时分别为上、右、下、左边的内边距(顺时针顺序)。 | +| padding-[left\|top\|right\|bottom] | <length> | 0 | 否 | 设置左、上、右、下内边距属性。 | +| margin | <length> \| <percentage>5+ | 0 | 否 | 使用简写属性设置所有的外边距属性,该属性可以有1到4个值。
- 只有一个值时,这个值会被指定给全部的四个边。
- 两个值时,第一个值被匹配给上和下,第二个值被匹配给左和右。
- 三个值时,第一个值被匹配给上, 第二个值被匹配给左和右,第三个值被匹配给下。
- 四个值时,会依次按上、右、下、左的顺序匹配 (即顺时针顺序)。 | +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | 否 | 设置左、上、右、下外边距属性。 | +| border-width | <length> | 0 | 否 | 使用简写属性设置元素的所有边框宽度。 | +| border-color | <color> | black | 否 | 使用简写属性设置元素的所有边框颜色。 | +| border-radius | <length> | - | 否 | border-radius属性是设置元素的外边框圆角半径。 | +| background-color | <color> | - | 否 | 设置背景颜色。 | +| display | string | flex | 否 | 确定一个元素所产生的框的类型,可选值为:
- flex:弹性布局。
- none:不渲染此元素。 | +| [left\|top] | <length> \| <percentage>6+ | - | 否 | left\|top确定元素的偏移位置。
- left属性规定元素的左边缘。该属性定义了定位元素左外边距边界与其包含块左边界之间的偏移。
- top属性规定元素的顶部边缘。该属性定义了一个定位元素的上外边距边界与其包含块上边界之间的偏移。 | + +## 示例 + +1. 线形图 + + ```html + +
+ + +
+ ``` + + + ```css + /* xxx.css */ + .container { + flex-direction: column; + justify-content: center; + align-items: center; + width: 454px; + height: 454px; + background-color: white; + } + .chart { + width: 300px; + height: 300px; + } + .button { + width: 280px; + border-radius: 0px; + } + ``` + + + ```js + // xxx.js + export default { + data: { + lineData: [ + { + strokeColor: '#0081ff', + fillColor: '#cce5ff', + data: [763, 550, 551, 554, 731, 654, 525, 696, 595, 628, 791, 505, 613, 575, 475, 553, 491, 680, 657, 716], + gradient: true, + } + ], + lineOps: { + xAxis: { + min: 0, + max: 20, + display: false, + }, + yAxis: { + min: 0, + max: 1000, + display: false, + }, + series: { + lineStyle: { + width: "5px", + smooth: true, + }, + headPoint: { + shape: "circle", + size: 10, + strokeWidth: 5, + fillColor: '#ffffff', + strokeColor: '#007aff', + display: true, + }, + loop: { + margin: 2, + gradient: true, + } + } + }, + }, + addData() { + this.$refs.linechart.append({ + serial: 0, + data: [Math.floor(Math.random() * 400) + 400] + }) + } + } + ``` + + ![lite_line](figures/lite_line.PNG) + +2. 柱状图 + + ```html + +
+ +
+ ``` + + + ```css + /* xxx.css */ + .container { + flex-direction: column; + justify-content: center; + align-items: center; + width: 454px; + height: 454px; + background-color: white; + } + .chart { + width: 300px; + height: 300px; + } + ``` + + + ```js + // xxx.js + export default { + data: { + barData: [ + { + fillColor: '#f07826', + data: [763, 550, 551, 554, 731, 654, 525, 696, 595, 628], + }, + { + fillColor: '#cce5ff', + data: [535, 776, 615, 444, 694, 785, 677, 609, 562, 410], + }, + { + fillColor: '#ff88bb', + data: [673, 500, 574, 483, 702, 583, 437, 506, 693, 657], + }, + ], + barOps: { + xAxis: { + min: 0, + max: 20, + display: false, + axisTick: 10 + }, + yAxis: { + min: 0, + max: 1000, + display: false, + }, + }, + } + } + ``` + + ![lite_bar](figures/lite_bar.PNG) diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-image-animator.md b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-image-animator.md new file mode 100644 index 0000000000000000000000000000000000000000..9c85c0e3808241dda5faad0aa459c627d5ed069b --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-image-animator.md @@ -0,0 +1,207 @@ +# image-animator + +图片帧动画播放器。 + +> **说明:** +> +> 该组件从从API version 4 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + + +## 子组件 + +不支持。 + + +## 属性 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| images | Array<ImageFrame> | - | 是 | 设置图片帧信息集合。每一帧的帧信息包含图片路径、图片大小和图片位置信息。目前支持以下图片格式:png、jpg和bmp。ImageFrame的详细说明请见表1。
**说明:**
使用时需要使用数据绑定的方式,如images = {{images}},js中声明相应变量:images: [{src: "/common/heart-rate01.png"}, {src: "/common/heart-rate02.png"}]。 | +| iteration | number \| string | infinite | 否 | 设置帧动画播放次数。number表示固定次数,infinite枚举表示无限次数播放。 | +| reverse | boolean | false | 否 | 设置播放顺序。false表示从第1张图片播放到最后1张图片; true表示从最后1张图片播放到第1张图片。 | +| fixedsize | boolean | true | 否 | 设置图片大小是否固定为组件大小。 true表示图片大小与组件大小一致,此时设置图片的width 、height 、top 和left属性是无效的。false表示每一张图片的 width 、height 、top和left属性都要单独设置。 | +| duration | string | - | 是 | 设置单次播放时长。单位支持[s(秒)\|ms(毫秒)],默认单位为ms。 duration为0时,不播放图片。 值改变只会在下一次循环开始时生效。 | +| fillmode5+ | string | forwards | 否 | 指定帧动画执行结束后的状态。可选项有:
- none:恢复初始状态。
- forwards:保持帧动画结束时的状态(在最后一个关键帧中定义)。 | +| id | string | - | 否 | 组件的唯一标识。 | +| style | string | - | 否 | 组件的样式声明。 | +| class | string | - | 否 | 组件的样式类,用于引用样式表。 | +| ref | string | - | 否 | 用来指定指向子元素的引用信息,该引用将注册到父组件的$refs 属性对象上。 | + + **表2** ImageFrame说明 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| src | <uri> | - | 是 | 图片路径。 | +| width | <length> | 0 | 否 | 图片宽度。 | +| height | <length> | 0 | 否 | 图片高度。 | +| top | <length> | 0 | 否 | 图片相对于组件左上角的纵向坐标。 | +| left | <length> | 0 | 否 | 图片相对于组件左上角的横向坐标。 | + + +## 事件 + +| 名称 | 参数 | 描述 | +| -------- | -------- | -------- | +| stop | - | 帧动画结束时触发。 | +| click | - | 点击动作触发该事件。 | +| longpress | - | 长按动作触发该事件。 | +| swipe5+ | [SwipeEvent](js-common-events.md) | 组件上快速滑动后触发。 | + + +## 样式 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| width | <length> \| <percentage>5+ | - | 否 | 设置组件自身的宽度。

未设置时组件宽度默认为0。 | +| height | <length> \| <percentage>5+ | - | 否 | 设置组件自身的高度。

未设置时组件高度默认为0。 | +| padding | <length> | 0 | 否 | 使用简写属性设置所有的内边距属性。
  该属性可以有1到4个值:
- 指定一个值时,该值指定四个边的内边距。
- 指定两个值时,第一个值指定上下两边的内边距,第二个指定左右两边的内边距。
- 指定三个值时,第一个指定上边的内边距,第二个指定左右两边的内边距,第三个指定下边的内边距。
- 指定四个值时分别为上、右、下、左边的内边距(顺时针顺序)。 | +| padding-[left\|top\|right\|bottom] | <length> | 0 | 否 | 设置左、上、右、下内边距属性。 | +| margin | <length> \| <percentage>5+ | 0 | 否 | 使用简写属性设置所有的外边距属性,该属性可以有1到4个值。
- 只有一个值时,这个值会被指定给全部的四个边。
- 两个值时,第一个值被匹配给上和下,第二个值被匹配给左和右。
- 三个值时,第一个值被匹配给上, 第二个值被匹配给左和右,第三个值被匹配给下。
- 四个值时,会依次按上、右、下、左的顺序匹配 (即顺时针顺序)。 | +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | 否 | 设置左、上、右、下外边距属性。 | +| border-width | <length> | 0 | 否 | 使用简写属性设置元素的所有边框宽度。 | +| border-color | <color> | black | 否 | 使用简写属性设置元素的所有边框颜色。 | +| border-radius | <length> | - | 否 | border-radius属性是设置元素的外边框圆角半径。 | +| background-color | <color> | - | 否 | 设置背景颜色。 | +| opacity5+ | number | 1 | 否 | 元素的透明度,取值范围为0到1,1表示为不透明,0表示为完全透明。 | +| display | string | flex | 否 | 确定一个元素所产生的框的类型,可选值为:
- flex:弹性布局。
- none:不渲染此元素。 | +| [left\|top] | <length> \| <percentage>6+ | - | 否 | left\|top确定元素的偏移位置。
- left属性规定元素的左边缘。该属性定义了定位元素左外边距边界与其包含块左边界之间的偏移。
- top属性规定元素的顶部边缘。该属性定义了一个定位元素的上外边距边界与其包含块上边界之间的偏移。 | + + +## 方法 + +| 名称 | 参数 | 描述 | +| -------- | -------- | -------- | +| start | - | 开始播放图片帧动画。再次调用,重新从第1帧开始播放。 | +| pause | - | 暂停播放图片帧动画。 | +| stop | - | 停止播放图片帧动画。 | +| resume | - | 继续播放图片帧。 | +| getState | - | 获取播放状态。可能值有:
- playing:播放中
- paused:已暂停
- stopped:已停止。 | + + +## 示例 + + +```html + +
+ +
+ + + + +
+
+``` + + +```css +/* xxx.css */ +.container { + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 454px; + height: 454px; +} +.animator { + width: 70px; + height: 70px; +} +.btn-box { + width: 264px; + height: 120px; + flex-wrap: wrap; + justify-content: space-around; + align-items: center; +} +.btn { + border-radius: 8px; + width: 120px; + margin-top: 8px; +} +``` + + +```js +//xxx.js +export default { + data: { + frames: [ + { + src: "/common/asserts/heart78.png", + }, + { + src: "/common/asserts/heart79.png", + }, + { + src: "/common/asserts/heart80.png", + }, + { + src: "/common/asserts/heart81.png", + }, + { + src: "/common/asserts/heart82.png", + }, + { + src: "/common/asserts/heart83.png", + }, + { + src: "/common/asserts/heart84.png", + }, + { + src: "/common/asserts/heart85.png", + }, + { + src: "/common/asserts/heart86.png", + }, + { + src: "/common/asserts/heart87.png", + }, + { + src: "/common/asserts/heart88.png", + }, + { + src: "/common/asserts/heart89.png", + }, + { + src: "/common/asserts/heart90.png", + }, + { + src: "/common/asserts/heart91.png", + }, + { + src: "/common/asserts/heart92.png", + }, + { + src: "/common/asserts/heart93.png", + }, + { + src: "/common/asserts/heart94.png", + }, + { + src: "/common/asserts/heart95.png", + }, + { + src: "/common/asserts/heart96.png", + }, + ], + }, + handleStart() { + this.$refs.animator.start(); + }, + handlePause() { + this.$refs.animator.pause(); + }, + handleResume() { + this.$refs.animator.resume(); + }, + handleStop() { + this.$refs.animator.stop(); + }, +}; +``` + +![image-animator](figures/image-animator.gif) diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-image.md b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-image.md new file mode 100644 index 0000000000000000000000000000000000000000..838db18b496f1fd144bc2cebddb70dfc2e84e516 --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-image.md @@ -0,0 +1,74 @@ +# image + +图片组件,用来渲染展示图片。 + +> **说明:** +> +> 该组件从从API version 4 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + + +## 子组件 + +不支持。 + + +## 属性 + +| 名称 | 类型 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | +| src | string | 否 |
图片的路径,支持的图片格式包括png、jpg。 | +| id | string | 否 | 组件的唯一标识。 | +| style | string | 否 | 组件的样式声明。 | +| class | string | 否 | 组件的样式类,用于引用样式表。 | +| ref | string | 否 | 用来指定指向子元素的引用信息,该引用将注册到父组件的$refs 属性对象上。 | + + +## 事件 + +| 名称 | 参数 | 描述 | +| -------- | -------- | -------- | +| click | - | 点击动作触发该事件。 | +| longpress | - | 长按动作触发该事件。 | +| swipe5+ | [SwipeEvent](js-common-events.md) | 组件上快速滑动后触发。 | + + +## 样式 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| width | <length> \| <percentage>5+ | - | 否 | 设置组件自身的宽度。

未设置时组件宽度默认为0。 | +| height | <length> \| <percentage>5+ | - | 否 | 设置组件自身的高度。

未设置时组件高度默认为0。 | +| padding | <length> | 0 | 否 | 使用简写属性设置所有的内边距属性。
  该属性可以有1到4个值:
- 指定一个值时,该值指定四个边的内边距。
- 指定两个值时,第一个值指定上下两边的内边距,第二个指定左右两边的内边距。
- 指定三个值时,第一个指定上边的内边距,第二个指定左右两边的内边距,第三个指定下边的内边距。
- 指定四个值时分别为上、右、下、左边的内边距(顺时针顺序)。 | +| padding-[left\|top\|right\|bottom] | <length> | 0 | 否 | 设置左、上、右、下内边距属性。 | +| margin | <length> \| <percentage>5+ | 0 | 否 | 使用简写属性设置所有的外边距属性,该属性可以有1到4个值。
- 只有一个值时,这个值会被指定给全部的四个边。
- 两个值时,第一个值被匹配给上和下,第二个值被匹配给左和右。
- 三个值时,第一个值被匹配给上, 第二个值被匹配给左和右,第三个值被匹配给下。
- 四个值时,会依次按上、右、下、左的顺序匹配 (即顺时针顺序)。 | +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | 否 | 设置左、上、右、下外边距属性。 | +| border-width | <length> | 0 | 否 | 使用简写属性设置元素的所有边框宽度。 | +| border-color | <color> | black | 否 | 使用简写属性设置元素的所有边框颜色。 | +| border-radius | <length> | - | 否 | border-radius属性是设置元素的外边框圆角半径。 | +| background-color | <color> | - | 否 | 设置背景颜色。 | +| opacity | number | 1 | 否 | 元素的透明度,取值范围为0到1,1表示为不透明,0表示为完全透明。 | +| display | string | flex | 否 | 确定一个元素所产生的框的类型,可选值为:
- flex:弹性布局。
- none:不渲染此元素。 | +| [left\|top] | <length> \| <percentage>6+ | - | 否 | left\|top确定元素的偏移位置。
- left属性规定元素的左边缘。该属性定义了定位元素左外边距边界与其包含块左边界之间的偏移。
- top属性规定元素的顶部边缘。该属性定义了一个定位元素的上外边距边界与其包含块上边界之间的偏移。 | + +## 示例 + +```html + +
+ + +
+``` + +```css +/* xxx.css */ +.container { + justify-content: center; + align-items: center; + flex-direction: column; + width: 100%; + height: 100%; +} +``` + +![image](figures/image.png) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-input.md b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-input.md new file mode 100644 index 0000000000000000000000000000000000000000..facd4e72415f5c740b879c02698c0f4e5823e620 --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-input.md @@ -0,0 +1,181 @@ +# input + +交互式组件,包括单选框,多选框,按钮。 + +> **说明:** +> +> 该组件从从API version 4 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + + +## 子组件 + +不支持。 + + +## 属性 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| type | string |
button | 否 | input组件类型,可选值为button,checkbox,radio。

button,checkbox,radio不支持动态修改。可选值定义如下:
- button:定义可点击的按钮;
- checkbox:定义多选框;
- radio:定义单选按钮,允许在多个拥有相同name值的选项中选中其中一个; | +| checked | boolean | false | 否 | 当前组件是否选中,仅type为checkbox和radio生效。 | +| name | string | - | 否 | input组件的名称。 | +| value | string | - | 否 | input组件的value值,当类型为radio时必填且相同name值的选项该值唯一。 | +| id | string | - | 否 | 组件的唯一标识。 | +| style | string | - | 否 | 组件的样式声明。 | +| class | string | - | 否 | 组件的样式类,用于引用样式表。 | +| ref | string | - | 否 | 用来指定指向子元素的引用信息,该引用将注册到父组件的$refs 属性对象上。 | + + +## 事件 + +- 当input类型为checkbox、radio时,支持如下事件: + | 名称 | 参数 | 描述 | + | -------- | -------- | -------- | + | change | { checked:true \| false } | checkbox多选框或radio单选框的checked状态发生变化时触发该事件。 | + | click | - | 点击动作触发该事件。 | + | longpress | - | 长按动作触发该事件。 | + | swipe5+ | [SwipeEvent](js-common-events.md) | 组件上快速滑动后触发。 | + +- 当input类型为button时,支持如下事件: + | 名称 | 参数 | 描述 | + | -------- | -------- | -------- | + | click | - | 点击动作触发该事件。 | + | longpress | - | 长按动作触发该事件。 | + | swipe5+ | [SwipeEvent](js-common-events.md) | 组件上快速滑动后触发。 | + + +## 样式 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| color | <color> | \#ffffff | 否 | 按钮的文本颜色。 | +| font-size | <length> | 30px | 否 | 按钮的文本尺寸。 | +| width | <length> | - | 否 | type为button时,默认值为100px。 | +| height | <length> | - | 否 | type为button时,默认值为50px。 | +| font-family | string | SourceHanSansSC-Regular | 否 | 字体。目前仅支持SourceHanSansSC-Regular 字体。 | +| padding | <length> | 0 | 否 | 使用简写属性设置所有的内边距属性。
  该属性可以有1到4个值:
- 指定一个值时,该值指定四个边的内边距。
- 指定两个值时,第一个值指定上下两边的内边距,第二个指定左右两边的内边距。
- 指定三个值时,第一个指定上边的内边距,第二个指定左右两边的内边距,第三个指定下边的内边距。
- 指定四个值时分别为上、右、下、左边的内边距(顺时针顺序)。 | +| padding-[left\|top\|right\|bottom] | <length> | 0 | 否 | 设置左、上、右、下内边距属性。 | +| margin | <length> \| <percentage>5+ | 0 | 否 | 使用简写属性设置所有的外边距属性,该属性可以有1到4个值。
- 只有一个值时,这个值会被指定给全部的四个边。
- 两个值时,第一个值被匹配给上和下,第二个值被匹配给左和右。
- 三个值时,第一个值被匹配给上, 第二个值被匹配给左和右,第三个值被匹配给下。
- 四个值时,会依次按上、右、下、左的顺序匹配 (即顺时针顺序)。 | +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | 否 | 设置左、上、右、下外边距属性。 | +| border-width | <length> | 0 | 否 | 使用简写属性设置元素的所有边框宽度。 | +| border-color | <color> | black | 否 | 使用简写属性设置元素的所有边框颜色。 | +| border-radius | <length> | - | 否 | border-radius属性是设置元素的外边框圆角半径。 | +| background-color | <color> | - | 否 | 设置背景颜色。 | +| display | string | flex | 否 | 确定一个元素所产生的框的类型,可选值为:
- flex:弹性布局。
- none:不渲染此元素。 | +| [left\|top] | <length> \| <percentage>6+ | - | 否 | left\|top确定元素的偏移位置。
- left属性规定元素的左边缘。该属性定义了定位元素左外边距边界与其包含块左边界之间的偏移。
- top属性规定元素的顶部边缘。该属性定义了一个定位元素的上外边距边界与其包含块上边界之间的偏移。 | + +## 示例 + +1. type为button + + ```html + +
+ +
+ ``` + + ```css + /* xxx.css */ + .div-button { + flex-direction: column; + align-items: center; + width: 100%; + height: 100%; + } + .button { + margin-top: 30px; + width: 280px; + } + ``` + + ![input-type-button](figures/input-type-button.png) + + + +2. type为checkbox + + ```html + +
+ + {{text}} +
+ ``` + + ```css + /* xxx.css */ + .content{ + width: 100%; + height: 100%; + flex-direction: column; + align-items: center; + justify-content: center; + } + .text{ + font-size: 30px; + text-align: center; + width: 200px; + margin-top: 20px; + height: 100px; + } + ``` + + ```javascript + // xxx.js + export default { + data: { + text: "text" + }, + checkboxOnChange(e) { + this.text = e.checked; + } + } + ``` + + ![input-type-checkbox](figures/input-type-checkbox.gif) + +3. type为radio + + ```html + +
+
+ + radio1 +
+
+ + radio2 +
+
+ + radio3 +
+
+ ``` + + ```css + /* xxx.css */ + .container { + width: 100%; + height: 100%; + justify-content: center; + align-items: center; + flex-direction: column; + } + .item { + width: 50%; + height: 30%; + justify-content: center; + } + .text { + margin-top: 25%; + font-size: 30px; + text-align: center; + width: 200px; + height: 100px; + } + ``` + + ![input-type-radio](figures/input-type-radio.gif) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-marquee.md b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-marquee.md new file mode 100644 index 0000000000000000000000000000000000000000..e146eb244ac7c796efca5773842feaf1607502ee --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-marquee.md @@ -0,0 +1,118 @@ +# marquee + +跑马灯组件,用于展示一段单行滚动的文字。 + +> **说明:** +> +> 该组件从从API version 4 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + + +## 子组件 + +不支持。 + + +## 属性 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| scrollamount | number | 6 | 否 | 跑马灯每次滚动时移动的最大长度。 | +| id | string | - | 否 | 组件的唯一标识。 | +| style | string | - | 否 | 组件的样式声明。 | +| class | string | - | 否 | 组件的样式类,用于引用样式表。 | +| ref | string | - | 否 | 用来指定指向子元素的引用信息,该引用将注册到父组件的$refs 属性对象上。 | + + +## 事件 + +| 名称 | 参数 | 描述 | +| -------- | -------- | -------- | +| click | - | 点击动作触发该事件。 | +| longpress | - | 长按动作触发该事件。 | +| swipe5+ | [SwipeEvent](js-common-events.md) | 组件上快速滑动后触发。 | + + +## 样式 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| color | <color> | \#ffffff


| 否 | 设置跑马灯中文字的文本颜色。 | +| font-size | <length> |
30 | 否 | 设置跑马灯中文字的文本尺寸。 | +| font-family | string |

SourceHanSansSC-Regular | 否 |

字体。目前仅支持SourceHanSansSC-Regular 字体。 | +| width | <length> \| <percentage>5+ | - | 否 | 设置组件自身的宽度。

未设置时组件宽度默认为0。 | +| height | <length> \| <percentage>5+ | - | 否 | 设置组件自身的高度。

未设置时组件高度默认为0。 | +| padding | <length> | 0 | 否 | 使用简写属性设置所有的内边距属性。
  该属性可以有1到4个值:
- 指定一个值时,该值指定四个边的内边距。
- 指定两个值时,第一个值指定上下两边的内边距,第二个指定左右两边的内边距。
- 指定三个值时,第一个指定上边的内边距,第二个指定左右两边的内边距,第三个指定下边的内边距。
- 指定四个值时分别为上、右、下、左边的内边距(顺时针顺序)。 | +| padding-[left\|top\|right\|bottom] | <length> | 0 | 否 | 设置左、上、右、下内边距属性。 | +| margin | <length> \| <percentage>5+ | 0 | 否 | 使用简写属性设置所有的外边距属性,该属性可以有1到4个值。
- 只有一个值时,这个值会被指定给全部的四个边。
- 两个值时,第一个值被匹配给上和下,第二个值被匹配给左和右。
- 三个值时,第一个值被匹配给上, 第二个值被匹配给左和右,第三个值被匹配给下。
- 四个值时,会依次按上、右、下、左的顺序匹配 (即顺时针顺序)。 | +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | 否 | 设置左、上、右、下外边距属性。 | +| border-width | <length> | 0 | 否 | 使用简写属性设置元素的所有边框宽度。 | +| border-color | <color> | black | 否 | 使用简写属性设置元素的所有边框颜色。 | +| border-radius | <length> | - | 否 | border-radius属性是设置元素的外边框圆角半径。 | +| background-color | <color> | - | 否 | 设置背景颜色。 | +| opacity5+ | number | 1 | 否 | 元素的透明度,取值范围为0到1,1表示为不透明,0表示为完全透明。 | +| display | string | flex | 否 | 确定一个元素所产生的框的类型,可选值为:
- flex:弹性布局。
- none:不渲染此元素。 | +| [left\|top] | <length> \| <percentage>6+ | - | 否 | left\|top确定元素的偏移位置。
- left属性规定元素的左边缘。该属性定义了定位元素左外边距边界与其包含块左边界之间的偏移。
- top属性规定元素的顶部边缘。该属性定义了一个定位元素的上外边距边界与其包含块上边界之间的偏移。 | + +## 示例 + +```html + +
+ {{marqueeCustomData}} + speed+ + speed- + changeData +
+``` + +```css +/* xxx.css */ +.container { + flex-direction: column; + width: 100%; + height: 100%; + flex-direction: column; + align-items: center; +} +.customMarquee { + width: 50%; + height: 80px; + padding: 10px; + margin: 20px; + border-width: 4px; + border-color: #ffffff; + border-radius: 20px; + font-size: 38px; +} +.text { + font-size: 30px; + text-align: center; + width: 30%; + height: 10%; + margin-top: 5%; + background-color: #f2f2f2; + border-radius: 40px; + color: #0d81f2; +} +``` + +```javascript +// xxx.js +export default { + data: { + scrollAmount: 30, + marqueeCustomData: 'Custom marquee Custom marquee Custom marquee' + }, + addSpeed() { + this.scrollAmount++; + }, + downSpeed() { + this.scrollAmount--; + }, + changeData() { + this.marqueeCustomData = 'Change Data Change Data Change Data'; + } +} +``` + +![marquee](figures/marquee.gif) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-picker-view.md b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-picker-view.md new file mode 100644 index 0000000000000000000000000000000000000000..3722716aae1e0d42bf1638e0efc50d475430ee13 --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-picker-view.md @@ -0,0 +1,145 @@ +# picker-view + +嵌入页面的滑动选择器。 + +> **说明:** +> +> 该组件从从API version 4 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + + +## 子组件 + +不支持。 + + +## 属性 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| type | string | text | 否 | 设置滑动选择器的类型,该属性不支持动态修改,可选项有:
- text:文本选择器。
- time:时间选择器。 | +| id | string | - | 否 | 组件的唯一标识。 | +| style | string | - | 否 | 组件的样式声明。 | +| class | string | - | 否 | 组件的样式类,用于引用样式表。 | +| ref | string | - | 否 | 用来指定指向子元素的引用信息,该引用将注册到父组件的$refs 属性对象上。 | + +文本选择器:type=text + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| range | Array | - | 否 | 设置文本选择器的取值范围。
使用时需要使用数据绑定的方式,如range = {{data}},js中声明相应变量:data:["15", "20", "25"]。 | +| selected | string | 0 | 否 | 设置文本选择器的默认选择值,该值需要为range的索引。 | + +时间选择器:type=time + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| selected | string | 00:00 | 否 | 设置时间选择器的默认取值,格式为 HH:mm;
| + + +## 事件 + +type=text: + +| 名称 | 参数 | 描述 | +| -------- | -------- | -------- | +| change | { newValue: newValue, newSelected: newSelected } | 文本选择器选定值后触发该事件。 | + +type=time: + +| 名称 | 参数 | 描述 | +| -------- | -------- | -------- | +| change | { hour: hour, minute: minute} | 时间选择器选定值后触发该事件。
| + + +## 样式 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| color | <color> | \#808080
| 否 | 候选项字体颜色。 | +| font-size | <length> | 30px
| 否 | 候选项字体尺寸,类型length,单位px。 | +| selected-color | <color> | \#ffffff
| 否 | 选中项字体颜色。 | +| selected-font-size | <length> | 38px
| 否 | 选中项字体尺寸,类型length,单位px。 | +| selected-font-family | string | HYQiHei-65S | 否 | 选中项字体类型。 | +| font-family | string |
HYQiHei-65S | 否 | 选项字体类型。 | +| width | <length> \| <percentage>5+ | - | 否 | 设置组件自身的宽度。

未设置时组件宽度默认为0。 | +| height | <length> \| <percentage>5+ | - | 否 | 设置组件自身的高度。

未设置时组件高度默认为0。 | +| padding | <length> | 0 | 否 | 使用简写属性设置所有的内边距属性。
  该属性可以有1到4个值:
- 指定一个值时,该值指定四个边的内边距。
- 指定两个值时,第一个值指定上下两边的内边距,第二个指定左右两边的内边距。
- 指定三个值时,第一个指定上边的内边距,第二个指定左右两边的内边距,第三个指定下边的内边距。
- 指定四个值时分别为上、右、下、左边的内边距(顺时针顺序)。 | +| padding-[left\|top\|right\|bottom] | <length> | 0 | 否 | 设置左、上、右、下内边距属性。 | +| margin | <length> \| <percentage>5+ | 0 | 否 | 使用简写属性设置所有的外边距属性,该属性可以有1到4个值。
- 只有一个值时,这个值会被指定给全部的四个边。
- 两个值时,第一个值被匹配给上和下,第二个值被匹配给左和右。
- 三个值时,第一个值被匹配给上, 第二个值被匹配给左和右,第三个值被匹配给下。
- 四个值时,会依次按上、右、下、左的顺序匹配 (即顺时针顺序)。 | +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | 否 | 设置左、上、右、下外边距属性。 | +| border-width | <length> | 0 | 否 | 使用简写属性设置元素的所有边框宽度。 | +| border-color | <color> | black | 否 | 使用简写属性设置元素的所有边框颜色。 | +| border-radius | <length> | - | 否 | border-radius属性是设置元素的外边框圆角半径。 | +| background-color | <color> | - | 否 | 设置背景颜色。 | +| display | string | flex | 否 | 确定一个元素所产生的框的类型,可选值为:
- flex:弹性布局。
- none:不渲染此元素。 | +| [left\|top] | <length> \| <percentage>6+ | - | 否 | left\|top确定元素的偏移位置。
- left属性规定元素的左边缘。该属性定义了定位元素左外边距边界与其包含块左边界之间的偏移。
- top属性规定元素的顶部边缘。该属性定义了一个定位元素的上外边距边界与其包含块上边界之间的偏移。 | + + +## 示例 + + +```html + +
+ + Selected:{{time}} + + +
+``` + + +```css +/* xxx.css */ +.container { + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 454px; + height: 454px; +} +.title { + font-size: 30px; + text-align: center; +} +.time-picker { + width: 500px; + height: 400px; + margin-top: 20px; +} +``` + + +```js +/* xxx.js */ +export default { + data: { + defaultTime: "", + time: "", + }, + onInit() { + this.defaultTime = this.now(); + }, + handleChange(data) { + this.time = this.concat(data.hour, data.minute); + }, + now() { + const date = new Date(); + const hours = date.getHours(); + const minutes = date.getMinutes(); + return this.concat(hours, minutes); + }, + + fill(value) { + return (value > 9 ? "" : "0") + value; + }, + + concat(hours, minutes) { + return `${this.fill(hours)}:${this.fill(minutes)}`; + }, +} +``` + +![picker-view](figures/picker-view.png) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-progress.md b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-progress.md new file mode 100644 index 0000000000000000000000000000000000000000..afbbb9010be0c457ac3419da1c5f30aae9fa8388 --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-progress.md @@ -0,0 +1,125 @@ +# progress + +进度条,用于显示内容加载或操作处理进度。 + +> **说明:** +> +> 该组件从从API version 4 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + + +## 子组件 + +不支持。 + + +## 属性 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| type | string | horizontal | 否 | 设置进度条的类型,该属性不支持动态修改,可选值为:
- horizontal:线性进度条;
- arc:弧形进度条。 | +| id | string | - | 否 | 组件的唯一标识。 | +| style | string | - | 否 | 组件的样式声明。 | +| class | string | - | 否 | 组件的样式类,用于引用样式表。 | +| ref | string | - | 否 | 用来指定指向子元素的引用信息,该引用将注册到父组件的$refs 属性对象上。 | + +不同类型的进度条还支持不同的属性: + +- 类型为horizontal时,支持如下属性: + | 名称 | 类型 | 默认值 | 必填 | 描述 | + | -------- | -------- | -------- | -------- | -------- | + | percent | number | 0 | 否 | 当前进度。取值范围为0-100。 | + +- 类型为arc时,支持如下属性: + | 名称 | 类型 | 默认值 | 必填 | 描述 | + | -------- | -------- | -------- | -------- | -------- | + | percent | number | 0 | 否 | 当前进度。取值范围为0-100。 | + + +## 事件 + +| 名称 | 参数 | 描述 | +| -------- | -------- | -------- | +| click | - | 点击动作触发该事件。 | +| longpress | - | 长按动作触发该事件。 | +| swipe5+ | [SwipeEvent](js-common-events.md) | 组件上快速滑动后触发。 | + + +## 样式 + +- type为horizontal,支持如下样式: + + | 名称 | 类型 | 默认值 | 必填 | 描述 | + | ------------ | -------------- | ---------------------------------------------- | ---- | ------------------ | + | color | <color> | \#6b9ac7 | 否 | 设置进度条的颜色。 | + | stroke-width | <length> | 321-4 \| 45+px | 否 | 设置进度条的宽度。 | + +- type为arc,支持如下样式: + + | 名称 | 类型 | 默认值 | 必填 | 描述 | + | ---------------- | -------------- | ------ | ---- | ------------------------------------------------------------ | + | color | <color> | - | 否 | 弧形进度条的颜色。 | + | background-color | <color> | - | 否 | 弧形进度条的背景色。 | + | stroke-width | <length> | - | 否 | 弧形进度条的宽度。
进度条宽度越大,进度条越靠近圆心。即进度条始终在半径区域内。 | + | start-angle | <deg> | 240 | 否 | 弧形进度条起始角度,以时钟0点为基线。范围为0到360(顺时针)。 | + | total-angle | <deg> | 240 | 否 | 弧形进度条总长度,范围为-360到360,负数标识起点到终点为逆时针。 | + | center-x | <length> | - | 否 | 弧形进度条中心位置,(坐标原点为组件左上角顶点)。该样式需要和center-y和radius一起。 | + | center-y | <length> | - | 否 | 弧形进度条中心位置,(坐标原点为组件左上角顶点)。该样式需要和center-x和radius一起。 | + | radius | <length> | - | 否 | 弧形进度条半径,该样式需要和center-x和center-y一起。 | + +除上述样式之外,还支持如下样式: + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| width | <length> \| <percentage>5+ | - | 否 | 设置组件自身的宽度。
未设置时组件宽度默认为0。 | +| height | <length> \| <percentage>5+ | - | 否 | 设置组件自身的高度。
未设置时组件高度默认为0。 | +| padding | <length> | 0 | 否 | 使用简写属性设置所有的内边距属性。
  该属性可以有1到4个值:
- 指定一个值时,该值指定四个边的内边距。
- 指定两个值时,第一个值指定上下两边的内边距,第二个指定左右两边的内边距。
- 指定三个值时,第一个指定上边的内边距,第二个指定左右两边的内边距,第三个指定下边的内边距。
- 指定四个值时分别为上、右、下、左边的内边距(顺时针顺序)。 | +| padding-[left\|top\|right\|bottom] | <length> | 0 | 否 | 设置左、上、右、下内边距属性。 | +| margin | <length> \| <percentage>5+ | 0 | 否 | 使用简写属性设置所有的外边距属性,该属性可以有1到4个值。
- 只有一个值时,这个值会被指定给全部的四个边。
- 两个值时,第一个值被匹配给上和下,第二个值被匹配给左和右。
- 三个值时,第一个值被匹配给上, 第二个值被匹配给左和右,第三个值被匹配给下。
- 四个值时,会依次按上、右、下、左的顺序匹配 (即顺时针顺序)。 | +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | 否 | 设置左、上、右、下外边距属性。 | +| border-width | <length> | 0 | 否 | 使用简写属性设置元素的所有边框宽度。 | +| border-color | <color> | black | 否 | 使用简写属性设置元素的所有边框颜色。 | +| border-radius | <length> | - | 否 | border-radius属性是设置元素的外边框圆角半径。 | +| display | string | flex | 否 | 确定一个元素所产生的框的类型,可选值为:
- flex:弹性布局。
- none:不渲染此元素。 | +| [left\|top] | <length> \| <percentage>6+ | - | 否 | left\|top确定元素的偏移位置。
- left属性规定元素的左边缘。该属性定义了定位元素左外边距边界与其包含块左边界之间的偏移。
- top属性规定元素的顶部边缘。该属性定义了一个定位元素的上外边距边界与其包含块上边界之间的偏移。 | + +## 示例 + +```html + +
+ + +
+``` + +```css +/* xxx.css */ +.container { + flex-direction: column; + height: 100%; + width: 100%; + align-items: center; +} +.min-progress { + width: 300px; + height: 300px; +} +``` + +```javascript +// xxx.js +export default { + data: { + arcVal: 0, + horizontalVal: 0 + }, + changeArc() { + this.arcVal+= 10; + }, + changeHorizontal() { + this.horizontalVal+= 10; + } +} +``` + +![progress](figures/progress.png) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-qrcode.md b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-qrcode.md new file mode 100644 index 0000000000000000000000000000000000000000..c454322301d03fe4ae53bb7d3c83aa3b733cf239 --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-qrcode.md @@ -0,0 +1,125 @@ +# qrcode + + +生成并显示二维码。 + +> **说明:** +> +> 该组件从从API version 5 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + + +## 子组件 + +不支持。 + + +## 属性 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| value | string | - | 是 | 用来生成二维码的内容。最大长度为256。 | +| id | string | - | 否 | 组件的唯一标识。 | +| style | string | - | 否 | 组件的样式声明。 | +| class | string | - | 否 | 组件的样式类,用于引用样式表。 | +| ref | string | - | 否 | 用来指定指向子元素的引用信息,该引用将注册到父组件的$refs 属性对象上。 | + + +## 事件 + +| 名称 | 参数 | 描述 | +| -------- | -------- | -------- | +| click | - | 点击动作触发该事件。 | +| longpress | - | 长按动作触发该事件。 | +| swipe5+ | [SwipeEvent](js-common-events.md) | 组件上快速滑动后触发。 | + + +## 样式 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| color | <color> | \#000000 | 否 | 二维码颜色 | +| background-color | <color> | \#ffffff | 否 | 二维码背景颜色 | +| width | <length> \| <percentage>5+ | - | 否 | 设置组件自身的宽度。

未设置时组件宽度默认为0。 | +| height | <length> \| <percentage>5+ | - | 否 | 设置组件自身的高度。

未设置时组件高度默认为0。 | +| padding | <length> | 0 | 否 | 使用简写属性设置所有的内边距属性。
  该属性可以有1到4个值:
- 指定一个值时,该值指定四个边的内边距。
- 指定两个值时,第一个值指定上下两边的内边距,第二个指定左右两边的内边距。
- 指定三个值时,第一个指定上边的内边距,第二个指定左右两边的内边距,第三个指定下边的内边距。
- 指定四个值时分别为上、右、下、左边的内边距(顺时针顺序)。 | +| padding-[left\|top\|right\|bottom] | <length> | 0 | 否 | 设置左、上、右、下内边距属性。 | +| margin | <length> \| <percentage>5+ | 0 | 否 | 使用简写属性设置所有的外边距属性,该属性可以有1到4个值。
- 只有一个值时,这个值会被指定给全部的四个边。
- 两个值时,第一个值被匹配给上和下,第二个值被匹配给左和右。
- 三个值时,第一个值被匹配给上, 第二个值被匹配给左和右,第三个值被匹配给下。
- 四个值时,会依次按上、右、下、左的顺序匹配 (即顺时针顺序)。 | +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | 否 | 设置左、上、右、下外边距属性。 | +| border-width | <length> | 0 | 否 | 使用简写属性设置元素的所有边框宽度。 | +| border-color | <color> | black | 否 | 使用简写属性设置元素的所有边框颜色。 | +| border-radius | <length> | - | 否 | border-radius属性是设置元素的外边框圆角半径。 | +| display | string | flex | 否 | 确定一个元素所产生的框的类型,可选值为:
- flex:弹性布局。
- none:不渲染此元素。 | +| [left\|top] | <length> \| <percentage>6+ | - | 否 | left\|top确定元素的偏移位置。
- left属性规定元素的左边缘。该属性定义了定位元素左外边距边界与其包含块左边界之间的偏移。
- top属性规定元素的顶部边缘。该属性定义了一个定位元素的上外边距边界与其包含块上边界之间的偏移。 | + +> **说明:** +> - width和height不一致时,以二者最小值作为二维码的边长。且最终生成的二维码居中显示; +> +>- width和height的最小值为200px。 + + +## 示例 + + +```html + +
+ + Color + BackgroundColor + Value +
+``` + +```css +/* xxx.css */ +.container { + width: 100%; + height: 100%; + flex-direction: column; + justify-content: center; + align-items: center; +} +.qrCode { + width: 200px; + height: 200px; +} +.button { + width: 30%; + height: 10%; + margin-top: 5%; +} +``` + +```javascript +// xxx.js +export default { + data: { + qr_col: '#87ceeb', + qr_bcol: '#f0ffff', + qr_value: 'value' + }, + changeColor() { + if (this.qr_col == '#87ceeb') { + this.qr_col = '#fa8072'; + } else { + this.qr_col = '#87ceeb'; + } + }, + changeBackgroundColor() { + if (this.qr_bcol == '#f0ffff') { + this.qr_bcol = '#ffffe0'; + } else { + this.qr_bcol = '#f0ffff'; + } + }, + changeValue() { + if (this.qr_value == 'value') { + this.qr_value = 'change'; + } else { + this.qr_value = 'value'; + } + } +} +``` + +![qrcode](figures/qrcode.gif) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-slider.md b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-slider.md new file mode 100644 index 0000000000000000000000000000000000000000..a686e9cf6202041c883ce347c9feaf34af329572 --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-slider.md @@ -0,0 +1,102 @@ +# slider + +滑动条组件,用来快速调节设置值,如音量、亮度等。 + +> **说明:** +> +> 该组件从从API version 4 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + + +## 子组件 + +不支持。 + + +## 属性 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| min | number | 0 | 否 | 滑动选择器的最小值。 | +| max | number | 100 | 否 | 滑动选择器的最大值。 | +| value | number | 0 | 否 | 滑动选择器的初始值。 | +| id | string | - | 否 | 组件的唯一标识。 | +| style | string | - | 否 | 组件的样式声明。 | +| class | string | - | 否 | 组件的样式类,用于引用样式表。 | +| ref | string | - | 否 | 用来指定指向子元素的引用信息,该引用将注册到父组件的$refs 属性对象上。 | + + +## 事件 + +| 名称 | 参数 | 描述 | +| -------- | -------- | -------- | +| change | ChangeEvent | 选择值发生变化时触发该事件。 | +| click | - | 点击动作触发该事件。 | +| longpress | - | 长按动作触发该事件。 | +| swipe5+ | [SwipeEvent](js-common-events.md) | 组件上快速滑动后触发。 | + + **表2** ChangeEvent + +| 属性 | 类型 | 说明 | +| -------- | -------- | -------- | +| progress(deprecated5+) | string | 当前slider的进度值。 | +| value5+ | number | 当前slider的进度值。 | + + +## 样式 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| color | <color> | \#000000 | 否 | 滑动条的背景颜色。 | +| selected-color | <color> | \#ffffff | 否 | 滑动条的已选择颜色。 | +| width | <length> \| <percentage>5+ | - | 否 | 设置组件自身的宽度。

未设置时组件宽度默认为0。 | +| height | <length> \| <percentage>5+ | - | 否 | 设置组件自身的高度。

未设置时组件高度默认为0。 | +| padding | <length> | 0 | 否 | 使用简写属性设置所有的内边距属性。
  该属性可以有1到4个值:
- 指定一个值时,该值指定四个边的内边距。
- 指定两个值时,第一个值指定上下两边的内边距,第二个指定左右两边的内边距。
- 指定三个值时,第一个指定上边的内边距,第二个指定左右两边的内边距,第三个指定下边的内边距。
- 指定四个值时分别为上、右、下、左边的内边距(顺时针顺序)。 | +| padding-[left\|top\|right\|bottom] | <length> | 0 | 否 | 设置左、上、右、下内边距属性。 | +| margin | <length> \| <percentage>5+ | 0 | 否 | 使用简写属性设置所有的外边距属性,该属性可以有1到4个值。
- 只有一个值时,这个值会被指定给全部的四个边。
- 两个值时,第一个值被匹配给上和下,第二个值被匹配给左和右。
- 三个值时,第一个值被匹配给上, 第二个值被匹配给左和右,第三个值被匹配给下。
- 四个值时,会依次按上、右、下、左的顺序匹配 (即顺时针顺序)。 | +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | 否 | 设置左、上、右、下外边距属性。 | +| border-width | <length> | 0 | 否 | 使用简写属性设置元素的所有边框宽度。 | +| border-color | <color> | black | 否 | 使用简写属性设置元素的所有边框颜色。 | +| border-radius | <length> | - | 否 | border-radius属性是设置元素的外边框圆角半径。 | +| background-color | <color> | - | 否 | 设置背景颜色。 | +| display | string | flex | 否 | 确定一个元素所产生的框的类型,可选值为:
- flex:弹性布局。
- none:不渲染此元素。 | +| [left\|top] | <length> \| <percentage>6+ | - | 否 | left\|top确定元素的偏移位置。
- left属性规定元素的左边缘。该属性定义了定位元素左外边距边界与其包含块左边界之间的偏移。
- top属性规定元素的顶部边缘。该属性定义了一个定位元素的上外边距边界与其包含块上边界之间的偏移。 | + +## 示例 + +```html + +
+ slider start value is {{startValue}} + slider current value is {{currentValue}} + slider end value is {{endValue}} + +
+``` + +```css +/* xxx.css */ +.container { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + height: 100%; +} +``` + +```javascript +// xxx.js +export default { + data: { + value: 0, + startValue: 0, + currentValue: 0, + endValue: 100, + }, + setvalue(e) { + this.currentValue = e.value; + } +} +``` + +![slider](figures/slider.png) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-switch.md b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-switch.md new file mode 100644 index 0000000000000000000000000000000000000000..4891bf42f55debc468e561b2736911725336b609 --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-switch.md @@ -0,0 +1,99 @@ +# switch + +开关选择器,通过开关,开启或关闭某个功能。 + +> **说明:** +> +> 该组件从从API version 4 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + + +## 子组件 + +不支持。 + + +## 属性 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| checked | boolean | false | 否 | 是否选中。 | +| id | string | - | 否 | 组件的唯一标识。 | +| style | string | - | 否 | 组件的样式声明。 | +| class | string | - | 否 | 组件的样式类,用于引用样式表。 | +| ref | string | - | 否 | 用来指定指向子元素的引用信息,该引用将注册到父组件的$refs 属性对象上。 | + + +## 事件 + +| 名称 | 参数 | 描述 | +| -------- | -------- | -------- | +| change | { checked: checkedValue } | 选中状态改变时触发该事件。 | +| click | - | 点击动作触发该事件。 | +| longpress | - | 长按动作触发该事件。 | +| swipe5+ | [SwipeEvent](js-common-events.md) | 组件上快速滑动后触发。 | + + +## 样式 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| width | <length> \| <percentage>5+ | - | 否 | 设置组件自身的宽度。

未设置时组件宽度默认为0。 | +| height | <length> \| <percentage>5+ | - | 否 | 设置组件自身的高度。

未设置时组件高度默认为0。 | +| padding | <length> | 0 | 否 | 使用简写属性设置所有的内边距属性。
  该属性可以有1到4个值:
- 指定一个值时,该值指定四个边的内边距。
- 指定两个值时,第一个值指定上下两边的内边距,第二个指定左右两边的内边距。
- 指定三个值时,第一个指定上边的内边距,第二个指定左右两边的内边距,第三个指定下边的内边距。
- 指定四个值时分别为上、右、下、左边的内边距(顺时针顺序)。 | +| padding-[left\|top\|right\|bottom] | <length> | 0 | 否 | 设置左、上、右、下内边距属性。 | +| margin | <length> \| <percentage>5+ | 0 | 否 | 使用简写属性设置所有的外边距属性,该属性可以有1到4个值。
- 只有一个值时,这个值会被指定给全部的四个边。
- 两个值时,第一个值被匹配给上和下,第二个值被匹配给左和右。
- 三个值时,第一个值被匹配给上, 第二个值被匹配给左和右,第三个值被匹配给下。
- 四个值时,会依次按上、右、下、左的顺序匹配 (即顺时针顺序)。 | +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | 否 | 设置左、上、右、下外边距属性。 | +| border-width | <length> | 0 | 否 | 使用简写属性设置元素的所有边框宽度。 | +| border-color | <color> | black | 否 | 使用简写属性设置元素的所有边框颜色。 | +| border-radius | <length> | - | 否 | border-radius属性是设置元素的外边框圆角半径。 | +| background-color | <color> | - | 否 | 设置背景颜色。 | +| display | string | flex | 否 | 确定一个元素所产生的框的类型,可选值为:
- flex:弹性布局。
- none:不渲染此元素。 | +| [left\|top] | <length> \| <percentage>6+ | - | 否 | left\|top确定元素的偏移位置。
- left属性规定元素的左边缘。该属性定义了定位元素左外边距边界与其包含块左边界之间的偏移。
- top属性规定元素的顶部边缘。该属性定义了一个定位元素的上外边距边界与其包含块上边界之间的偏移。 | + +## 示例 + +```html + +
+
+ + {{title}} +
+
+``` + +```css +/* xxx.css */ +.container { + width: 100%; + height: 100%; + justify-content: center; + align-items: center; +} +.box{ + width: 18%; + height: 25%; + flex-direction:column; + justify-content: center; + align-items: center; +} +``` + +```javascript +// xxx.js +export default { + data: { + title: 'on' + }, + switchChange(e){ + console.log(e.checked); + if(e.checked){ + this.title="on" + }else{ + this.title="off" + } + } +} +``` + +![switch](figures/switch.gif) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-text.md b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-text.md new file mode 100644 index 0000000000000000000000000000000000000000..8eae2cbea67e59d15aba3e9d848e037a5d54ade1 --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js-lite/js-components-basic-text.md @@ -0,0 +1,99 @@ +# text + +文本,用于呈现一段信息。 + +> **说明:** +> +> 该组件从从API version 4 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + + +## 子组件 + +不支持。 + + +## 属性 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| id | string | - | 否 | 组件的唯一标识。 | +| style | string | - | 否 | 组件的样式声明。 | +| class | string | - | 否 | 组件的样式类,用于引用样式表。 | +| ref | string | - | 否 | 用来指定指向子元素的引用信息,该引用将注册到父组件的$refs 属性对象上。 | + + +## 事件 + +| 名称 | 参数 | 描述 | +| -------- | -------- | -------- | +| click | - | 点击动作触发该事件。 | +| longpress | - | 长按动作触发该事件。 | +| swipe5+ | [SwipeEvent](js-common-events.md) | 组件上快速滑动后触发。 | + + +## 样式 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| color | <color> | \#ffffff | 否 | 设置文本的颜色。 | +| font-size | <length> | 30px | 否 | 设置文本的尺寸。
| +| letter-spacing | <length> | 2px | 否 | 设置文本的字符间距。 | +| text-align | string | left | 否 | 设置文本的文本对齐方式,可选值为:
- left:文本左对齐;
- center:文本居中对齐;
- right:文本右对齐; | +| text-overflow | string | clip | 否 | 可选值为:
- clip:将文本根据父容器大小进行裁剪显示;
- ellipsis:根据父容器大小显示,显示不下的文本用省略号代替。 | +| font-family | string | SourceHanSansSC-Regular | 否 | 字体。目前仅支持SourceHanSansSC-Regular 字体。 | +| width | <length> \| <percentage>5+ | 0px | 否 | 设置组件自身的宽度。
单位:px
未设置时组件宽度默认为0。 | +| height | <length> \| <percentage>5+ | 0px | 否 | 设置组件自身的高度。
单位:px
未设置时组件高度默认为0。 | +| padding | <length> | 0 | 否 | 使用简写属性设置所有的内边距属性。
  该属性可以有1到4个值:
- 指定一个值时,该值指定四个边的内边距。
- 指定两个值时,第一个值指定上下两边的内边距,第二个指定左右两边的内边距。
- 指定三个值时,第一个指定上边的内边距,第二个指定左右两边的内边距,第三个指定下边的内边距。
- 指定四个值时分别为上、右、下、左边的内边距(顺时针顺序)。 | +| padding-[left\|top\|right\|bottom] | <length> | 0 | 否 | 设置左、上、右、下内边距属性。 | +| margin | <length> \| <percentage>5+ | 0 | 否 | 使用简写属性设置所有的外边距属性,该属性可以有1到4个值。
- 只有一个值时,这个值会被指定给全部的四个边。
- 两个值时,第一个值被匹配给上和下,第二个值被匹配给左和右。
- 三个值时,第一个值被匹配给上, 第二个值被匹配给左和右,第三个值被匹配给下。
- 四个值时,会依次按上、右、下、左的顺序匹配 (即顺时针顺序)。 | +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | 否 | 设置左、上、右、下外边距属性。 | +| border-width | <length> | 0 | 否 | 使用简写属性设置元素的所有边框宽度。 | +| border-color | <color> | black | 否 | 使用简写属性设置元素的所有边框颜色。 | +| border-radius | <length> | - | 否 | border-radius属性是设置元素的外边框圆角半径。 | +| background-color | <color> | - | 否 | 设置背景颜色。 | +| opacity5+ | number | 1 | 否 | 元素的透明度,取值范围为0到1,1表示为不透明,0表示为完全透明。 | +| display | string | flex | 否 | 确定一个元素所产生的框的类型,可选值为:
- flex:弹性布局。
- none:不渲染此元素。 | +| [left\|top] | <length> \| <percentage>6+ | - | 否 | left\|top确定元素的偏移位置。
- left属性规定元素的左边缘。该属性定义了定位元素左外边距边界与其包含块左边界之间的偏移。
- top属性规定元素的顶部边缘。该属性定义了一个定位元素的上外边距边界与其包含块上边界之间的偏移。 | +| line-height10+ | number | 0px | 否 | 设置文本的行高。
单位:px
未设置时文本行高默认为适应性行高。 | + +## 示例 + +```html + +
+ + Hello {{ title }} + +
+``` + +```CSS +/* xxx.css */ +.container { + width: 100%; + height: 100%; + justify-content: center; + align-items: center; +} + +.title { + width: 100px; + font-size: 30px; + text-align: center; + color: red; +} +``` + +```javascript +// xxx.js +export default { + data: { + title: "" + }, + onInit() { + this.title = "World"; + } +} +``` + +![text](figures/text.png) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-components-canvas-canvas.md b/zh-cn/application-dev/reference/arkui-js-lite/js-components-canvas-canvas.md new file mode 100644 index 0000000000000000000000000000000000000000..4ba0df786f1c888c861e9e002c12ee35eb794d4a --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js-lite/js-components-canvas-canvas.md @@ -0,0 +1,55 @@ +# canvas组件 + +提供画布组件。用于自定义绘制图形。 + +> **说明:** +> +> 该组件从从API version 5 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + + +## 子组件 + +不支持。 + + +## 属性 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| id | string | - | 否 | 组件的唯一标识。 | +| style | string | - | 否 | 组件的样式声明。 | +| class | string | - | 否 | 组件的样式类,用于引用样式表。 | +| ref | string | - | 否 | 用来指定指向子元素的引用信息,该引用将注册到父组件的$refs 属性对象上。 | + + +## 事件 + +| 名称 | 参数 | 描述 | +| -------- | -------- | -------- | +| click | - | 点击动作触发该事件。 | +| longpress | - | 长按动作触发该事件。 | +| swipe5+ | [SwipeEvent](js-common-events.md) | 组件上快速滑动后触发。 | + + +## 样式 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| width | <length> \| <percentage>5+ | - | 否 | 设置组件自身的宽度。

未设置时组件宽度默认为0。 | +| height | <length> \| <percentage>5+ | - | 否 | 设置组件自身的高度。

未设置时组件高度默认为0。 | +| padding | <length> | 0 | 否 | 使用简写属性设置所有的内边距属性。
  该属性可以有1到4个值:
- 指定一个值时,该值指定四个边的内边距。
- 指定两个值时,第一个值指定上下两边的内边距,第二个指定左右两边的内边距。
- 指定三个值时,第一个指定上边的内边距,第二个指定左右两边的内边距,第三个指定下边的内边距。
- 指定四个值时分别为上、右、下、左边的内边距(顺时针顺序)。 | +| margin | <length> \| <percentage>5+ | 0 | 否 | 使用简写属性设置所有的外边距属性,该属性可以有1到4个值。
- 只有一个值时,这个值会被指定给全部的四个边。
- 两个值时,第一个值被匹配给上和下,第二个值被匹配给左和右。
- 三个值时,第一个值被匹配给上, 第二个值被匹配给左和右,第三个值被匹配给下。
- 四个值时,会依次按上、右、下、左的顺序匹配 (即顺时针顺序)。 | +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | 否 | 设置左、上、右、下外边距属性。 | +| border-width | <length> | 0 | 否 | 使用简写属性设置元素的所有边框宽度。 | +| border-color | <color> | black | 否 | 使用简写属性设置元素的所有边框颜色。 | +| border-radius | <length> | - | 否 | border-radius属性是设置元素的外边框圆角半径。 | +| background-color | <color> | - | 否 | 设置背景颜色。 | +| display | string | flex | 否 | 确定一个元素所产生的框的类型,可选值为:
- flex:弹性布局。
- none:不渲染此元素。 | +| [left\|top] | <length> \| <percentage>6+ | - | 否 | left\|top确定元素的偏移位置。
- left属性规定元素的左边缘。该属性定义了定位元素左外边距边界与其包含块左边界之间的偏移。
- top属性规定元素的顶部边缘。该属性定义了一个定位元素的上外边距边界与其包含块上边界之间的偏移。 | + + +## 方法 + +| 名称 | 参数 | 描述 | +| -------- | -------- | -------- | +| getContext | string  | 获取canvas绘图上下文,参数仅支持“2d”,返回值为2D绘制对象,该对象提供具体的2D绘制操作。详见[CanvasRenderingContext2D对象](js-components-canvas-canvasrenderingcontext2d.md)章节。 | diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-components-canvas-canvasrenderingcontext2d.md b/zh-cn/application-dev/reference/arkui-js-lite/js-components-canvas-canvasrenderingcontext2d.md new file mode 100644 index 0000000000000000000000000000000000000000..0986adc7e314f7f2ed5acc2d39c56352eca100f4 --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js-lite/js-components-canvas-canvasrenderingcontext2d.md @@ -0,0 +1,365 @@ +# CanvasRenderingContext2D对象 + + +使用CanvasRenderingContext2D在canvas画布组件上进行绘制,绘制对象可以是矩形、文本。 + +**示例:** + +```html + + + + +``` + + +```javascript +// xxx.js +export default { + handleClick() { + const el = this.$refs.canvas1; + const ctx = el.getContext('2d'); + ctx.beginPath(); + ctx.arc(100, 75, 50, 0, 6.28); + ctx.stroke(); + }, +} +``` + + ![zh-cn_image_0000001431548113](figures/zh-cn_image_0000001431548113.png) + + +## fillRect() + +填充一个矩形。 + +**参数:** + +| 参数 | 类型 | 描述 | +| -------- | -------- | -------- | +| x | number | 指定矩形左上角点的x坐标。 | +| y | number | 指定矩形左上角点的y坐标。 | +| width | number | 指定矩形的宽度。 | +| height | number | 指定矩形的高度。 | + +**示例:** + + ![zh-cn_image_0000001431388525](figures/zh-cn_image_0000001431388525.png) + + + ```javascript + ctx.fillRect(20, 20, 200, 150); + ``` + + +## fillStyle + +指定绘制的填充色。 + +**参数:** + +| 参数 | 类型 | 描述 | +| -------- | -------- | -------- | +| color | <color> | 设置填充区域的颜色。 | + +**示例:** + + ![zh-cn_image_0000001431388505](figures/zh-cn_image_0000001431388505.png) + + + ```javascript + ctx.fillStyle = '#0000ff'; + ctx.fillRect(20, 20, 150, 100); + ``` + + +## strokeRect() + +绘制具有边框的矩形,矩形内部不填充。 + +**参数:** + +| 参数 | 类型 | 描述 | +| -------- | -------- | -------- | +| x | number | 指定矩形的左上角x坐标。 | +| y | number | 指定矩形的左上角y坐标。 | +| width | number | 指定矩形的宽度。 | +| height | number | 指定矩形的高度。 | + +**示例:** + + ![zh-cn_image_0000001381268264](figures/zh-cn_image_0000001381268264.png) + + + ```javascript + ctx.strokeRect(30, 30, 200, 150); + ``` + + +## fillText() + +绘制填充类文本。 + +**参数:** + +| 参数 | 类型 | 描述 | +| -------- | -------- | -------- | +| text | string | 需要绘制的文本内容。 | +| x | number | 需要绘制的文本的左下角x坐标。 | +| y | number | 需要绘制的文本的左下角y坐标。 | + +**示例:** + + ![zh-cn_image_0000001431548109](figures/zh-cn_image_0000001431548109.png) + + + ```javascript + ctx.font = '35px sans-serif'; + ctx.fillText("Hello World!", 20, 60); + ``` + + +## lineWidth + +指定绘制线条的宽度值。 + +**参数:** + +| 参数 | 类型 | 描述 | +| -------- | -------- | -------- | +| lineWidth | number | 设置绘制线条的宽度。 | + +**示例:** + + ![zh-cn_image_0000001431548121](figures/zh-cn_image_0000001431548121.png) + + + ```javascript + ctx.lineWidth = 5; + ctx.strokeRect(25, 25, 85, 105); + ``` + + +## strokeStyle + +设置描边的颜色。 + +**参数:** + +| 参数 | 类型 | 描述 | +| -------- | -------- | -------- | +| color | <color> | 指定描边使用的颜色 | + +**示例:** + + ![zh-cn_image_0000001380789172](figures/zh-cn_image_0000001380789172.png) + + + ```javascript + ctx.lineWidth = 10; + ctx.strokeStyle = '#0000ff'; + ctx.strokeRect(25, 25, 155, 105); + ``` + + +### stroke()5+ + +进行边框绘制操作。 + +**示例:** + +![zh-cn_image_0000001431388513](figures/zh-cn_image_0000001431388513.png) + + ```javascript + ctx.moveTo(25, 25); + ctx.lineTo(25, 105); + ctx.strokeStyle = 'rgb(0,0,255)'; + ctx.stroke(); + ``` + + +### beginPath()5+ + +创建一个新的绘制路径。 + +**示例:** + + ![zh-cn_image_0000001431548125](figures/zh-cn_image_0000001431548125.png) + + + ```javascript + ctx.beginPath(); + ctx.lineWidth = '6'; + ctx.strokeStyle = '#0000ff'; + ctx.moveTo(15, 80); + ctx.lineTo(280, 160); + ctx.stroke(); + ``` + + +### moveTo()5+ + +路径从当前点移动到指定点。 + +**参数:** + +| 参数 | 类型 | 描述 | +| -------- | -------- | -------- | +| x | number | 指定位置的x坐标。 | +| y | number | 指定位置的y坐标。 | + +**示例:** + + ![zh-cn_image_0000001431388529](figures/zh-cn_image_0000001431388529.png) + + ```javascript + ctx.beginPath(); + ctx.moveTo(10, 10); + ctx.lineTo(280, 160); + ctx.stroke(); + ``` + + +### lineTo()5+ + +从当前点到指定点进行路径连接。 + +**参数:** + +| 参数 | 类型 | 描述 | +| -------- | -------- | -------- | +| x | number | 指定位置的x坐标。 | +| y | number | 指定位置的y坐标。 | + +**示例:** + +![zh-cn_image_0000001431148365](figures/zh-cn_image_0000001431148365.png) + + ```javascript + ctx.beginPath(); + ctx.moveTo(10, 10); + ctx.lineTo(280, 160); + ctx.stroke(); + ``` + + +### closePath()5+ + +结束当前路径形成一个封闭路径。 + +**示例:** + + ![zh-cn_image_0000001381268284](figures/zh-cn_image_0000001381268284.png) + + + ```javascript + ctx.beginPath(); + ctx.moveTo(30, 30); + ctx.lineTo(110, 30); + ctx.lineTo(70, 90); + ctx.closePath(); + ctx.stroke(); + ``` + + +## font + +设置文本绘制中的字体样式。 + +**参数:** + +| 参数 | 类型 | 描述 | +| -------- | -------- | -------- | +| value | string | 字体样式支持:sans-serif, serif, monospace,该属性默认值为30px HYQiHei-65S。 | + +**示例:** + + ![zh-cn_image_0000001381108328](figures/zh-cn_image_0000001381108328.png) + + + ```javascript + ctx.font = '30px sans-serif'; + ctx.fillText("Hello World", 20, 60); + ``` + + +## textAlign + +设置文本绘制中的文本对齐方式。 + +**参数:** + +| 参数 | 类型 | 描述 | +| -------- | -------- | -------- | +| align | string | 可选值为:
- left(默认):文本左对齐;
- right:文本右对齐;
- center:文本居中对齐; | + +**示例:** + + ![zh-cn_image_0000001431388517](figures/zh-cn_image_0000001431388517.png) + + + ```javascript + ctx.strokeStyle = '#0000ff'; + ctx.moveTo(140, 10); + ctx.lineTo(140, 160); + ctx.stroke(); + + ctx.font = '18px sans-serif'; + + // Show the different textAlign values + ctx.textAlign = 'left'; + ctx.fillText('textAlign=left', 140, 100); + ctx.textAlign = 'center'; + ctx.fillText('textAlign=center',140, 120); + ctx.textAlign = 'right'; + ctx.fillText('textAlign=right',140, 140); + ``` + + +## arc()5+ + +绘制弧线路径。 + +**参数:** + +| 参数 | 类型 | 描述 | +| -------- | -------- | -------- | +| x | number | 弧线圆心的x坐标值。 | +| y | number | 弧线圆心的y坐标值。 | +| radius | number | 弧线的圆半径。 | +| startAngle | number | 弧线的起始弧度。 | +| endAngle | number | 弧线的终止弧度。 | +| anticlockwise | boolean | 是否逆时针绘制圆弧。 | + +**示例:** + +![zh-cn_image_0000001381108320](figures/zh-cn_image_0000001381108320.png) + + ```javascript + ctx.beginPath(); + ctx.arc(100, 75, 50, 0, 6.28); + ctx.stroke(); + ``` + + +### rect()5+ + +创建矩形路径。 + +**参数:** + +| 参数 | 类型 | 描述 | +| -------- | -------- | -------- | +| x | number | 指定矩形的左上角x坐标值。 | +| y | number | 指定矩形的左上角y坐标值。 | +| width | number | 指定矩形的宽度。 | +| height | number | 指定矩形的高度。 | + +**示例:** + +![zh-cn_image_0000001381108312](figures/zh-cn_image_0000001381108312.png) + + ```javascript + ctx.rect(20, 20, 100, 100); // Create a 100*100 rectangle at (20, 20) + ctx.stroke(); // Draw it + ``` diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-components-common-animation.md b/zh-cn/application-dev/reference/arkui-js-lite/js-components-common-animation.md new file mode 100644 index 0000000000000000000000000000000000000000..14f9864dd0a2fd63a1ee158668d09b4191b5e626 --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js-lite/js-components-common-animation.md @@ -0,0 +1,63 @@ +# 动画样式 + + +组件普遍支持的可以在style或css中设置的动态的旋转、平移、缩放效果。 + + +| 名称 | 类型 | 默认值 | 描述 | +| -------- | -------- | -------- | -------- | +| transform | string | - | 详见表1。 | +| animation-name | string | - | 指定\@keyframes,详见表2。 | +| animation-delay | <time> | 0 | 定义动画播放的延迟时间。支持的单位为[s(秒)\|ms(毫秒) ],默认单位为ms,格式为:1000ms或1s。 | +| animation-duration | <time> | 0 | 定义一个动画周期。支持的单位为[s(秒)\|ms(毫秒) ],默认单位为ms,格式为:1000ms或1s。
**说明:**
animation-duration 样式必须设置,否则时长为 0,则不会播放动画。 | +| animation-iteration-count | number  \| infinite | 1 | 定义动画播放的次数,默认播放一次,可通过设置为infinite无限次播放。 | +| animation-timing-function | string |
linear | 描述动画执行的速度曲线,用于使动画更为平滑。
可选项有:
- linear:表示动画从头到尾的速度都是相同的。
- ease-in:表示动画以低速开始,cubic-bezier(0.42, 0.0, 1.0, 1.0)。
- ease-out:表示动画以低速结束,cubic-bezier(0.0, 0.0, 0.58, 1.0)。
- ease-in-out:表示动画以低速开始和结束,cubic-bezier(0.42, 0.0, 0.58, 1.0)。 | +| animation-fill-mode | string | none | 指定动画开始和结束的状态:
- none:在动画执行之前和之后都不会应用任何样式到目标上。
- forwards:在动画结束后,目标将保留动画结束时的状态(在最后一个关键帧中定义)。 | + + + **表1** transform操作说明 + +| 名称 | 类型 | 描述 | +| -------- | -------- | -------- | +| translateX | <length> | X轴方向平移动画属性 | +| translateY | <length> | Y轴方向平移动画属性 | +| rotate | <deg> \| <rad> | 旋转动画属性 | + +> **说明:** +> 轻量级智能穿戴仅支持原始大小的图片进行旋转。 + + + **表2** \@keyframes属性说明 + +| 名称 | 类型 | 默认值 | 描述 | +| -------- | -------- | -------- | -------- | +| background-color | <color> | - | 动画执行后应用到组件上的背景颜色。 | +| width | <length> | - | 动画执行后应用到组件上的宽度值。 | +| height | <length> | - | 动画执行后应用到组件上的高度值。 | +| transform | string | - | 定义应用在组件上的变换类型,见表1。 | + + +对于不支持起始值或终止值缺省的情况,可以通过from和to显示指定起始和结束。示例: + + +``` +@keyframes Go +{ + from { + background-color: #f76160; + } + to { + background-color: #09ba07; + } +} +``` + + +![动画样式demo1](figures/动画样式demo1.gif) + + + + + +> **说明:** +> \@keyframes的from/to不支持动态绑定。 diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-components-common-mediaquery.md b/zh-cn/application-dev/reference/arkui-js-lite/js-components-common-mediaquery.md new file mode 100644 index 0000000000000000000000000000000000000000..4ee8dd602ae16078380f199a889ca0613b420f37 --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js-lite/js-components-common-mediaquery.md @@ -0,0 +1,110 @@ +# 媒体查询 + +> **说明:** +> +> - 从API version 8 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 +> +> - media属性值默认为设备的真实尺寸大小、物理像素和真实的屏幕分辨率。 + + +媒体查询(Media Query)应用十分广泛,开发者经常需要根据设备的大致类型或者特定的特征和设备参数(例如屏幕分辨率)来修改应用的样式。使用媒体查询针对设备和应用的属性信息,可以设计出相匹配的布局样式。 + + +## CSS语法规则 + +使用@media来引入查询语句,具体规则如下: + +``` +@media [media-type] [and|or] [(media-feature)] { + CSS-Code; +} +``` + +@media screen and (round-screen: true) { … } : 当设备屏幕是圆形时条件成立 + +@media (max-height: 454) { … } :范围查询,CSS level 3 写法 + +> **说明:** +> +> - 不支持<=,>=,<,>操作符; +> - api 9开始才支持多重 () 嵌套使用; +> - media语句整体长度不能超过 512 个字符; +> - 单个media条件长度不能超过32个字符; + + +## 媒体类型 + +| 类型 | 说明 | +| ------ | -------------- | +| screen | 按屏幕相关参数进行媒体查询。 | + + +## 媒体逻辑操作 + +媒体逻辑操作符:and、or9+用于构成媒体查询语句,详细解释说明如下表。 + +**表1** 媒体逻辑操作符 + +| 类型 | 说明 | +| --------------- | ------------------------------------------------------------ | +| and | 将多个媒体特征(Media Feature)以“与”的方式连接成一个媒体查询,只有当所有媒体特征都为true,查询条件成立。另外,它还可以将媒体类型和媒体功能结合起来。
例如:screen and (device-type: liteWearable) and (max-height: 454) 表示当设备类型是智能穿戴同时应用的最大高度小于等于454个像素单位时成立。 | +| or9+ | 将多个媒体特征以“或”的方式连接成一个媒体查询,如果存在结果为true的媒体特征,则查询条件成立。
例如:screen and (max-height: 454)  or  (round-screen:true)表示当应用高度小于等于454个像素单位或者设备屏幕是圆形时,条件成立。 | + + + + +## 媒体特征 + +| 类型 | 说明 | +| ---------------- | ------------------------------------------------------------ | +| height | 应用页面显示区域的高度。 | +| min-height | 应用页面显示区域的最小高度。 | +| max-height | 应用页面显示区域的最大高度。 | +| width | 应用页面显示区域的宽度。 | +| min-width | 应用页面显示区域的最小宽度。 | +| max-width | 应用页面显示区域的最大宽度。 | +| aspect-ratio | 应用页面显示区域的宽度与高度的比值。
例如:aspect-ratio: 1/2 | +| min-aspect-ratio | 应用页面显示区域的宽度与高度的最小比值。 | +| max-aspect-ratio | 应用页面显示区域的宽度与高度的最大比值。 | +| round-screen | 屏幕类型,圆形屏幕为 true, 非圆形屏幕为 false。 | + + +## 通用媒体特征示例代码 + +多个.container中的所写的属性个数以及类型需要相同,若不相同会导致显示异常。 + +```html + +
+
+ Hello World +
+
+``` + +```css +/* xxx.css */ +.container { + width: 300px; + height: 600px; + background-color: #008000; +} +.title { + font-size: 30px; + text-align: center; +} +@media (device-type: samrtVision) { + .container { + width: 500px; + height: 500px; + background-color: #fa8072; + } +} +@media (device-type: liteWearable) { + .container { + width: 300px; + height: 300px; + background-color: #008b8b; + } +} +``` diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-components-container-div.md b/zh-cn/application-dev/reference/arkui-js-lite/js-components-container-div.md new file mode 100644 index 0000000000000000000000000000000000000000..d8485dc11445111f2c7165b8c2f7088d246328a8 --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js-lite/js-components-container-div.md @@ -0,0 +1,154 @@ +# div + +基础容器,用作页面结构的根节点或将内容进行分组。 + +> **说明:** +> +> 该组件从从API version 4 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + + +## 子组件 + +支持。 + + +## 属性 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| id | string | - | 否 | 组件的唯一标识。 | +| style | string | - | 否 | 组件的样式声明。 | +| class | string | - | 否 | 组件的样式类,用于引用样式表。 | +| ref | string | - | 否 | 用来指定指向子元素的引用信息,该引用将注册到父组件的$refs 属性对象上。 | + + +## 事件 + +| 名称 | 参数 | 描述 | +| -------- | -------- | -------- | +| click | - | 点击动作触发该事件。 | +| longpress | - | 长按动作触发该事件。 | +| swipe5+ | [SwipeEvent](js-common-events.md) | 组件上快速滑动后触发。 | + + +## 样式 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| flex-direction | string | row | 否 | flex容器主轴方向。可选项有:
- column:垂直方向从上到下
- row:水平方向从左到右 | +| flex-wrap | string | nowrap | 否 | flex容器是单行还是多行显示,该值暂不支持动态修改。可选项有:
- nowrap:不换行,单行显示。
- wrap:换行,多行显示。 | +| justify-content | string | flex-start | 否 | flex容器当前行的主轴对齐格式。可选项有:
- flex-start:项目位于容器的开头。
- flex-end:项目位于容器的结尾。
- center:项目位于容器的中心。
- space-between:项目位于各行之间留有空白的容器内。
- space-around:项目位于各行之前、之间、之后都留有空白的容器内。 | +| align-items | string | stretch5+
flex-start1-4 | 否 | flex容器当前行的交叉轴对齐格式,可选值为:
- stretch:弹性元素被在交叉轴方向被拉伸到与容器相同的高度或宽度。5+
- flex-start:元素向交叉轴起点对齐。
- flex-end:元素向交叉轴终点对齐。
- center:元素在交叉轴居中。 | +| display | string | flex | 否 | 确定该元素视图框的类型,该值暂不支持动态修改。可选值为:
- flex:弹性布局
- none:不渲染此元素 | +| width | <length> \| <percentage>5+ | - | 否 | 设置组件自身的宽度。

未设置时组件宽度默认为0。 | +| height | <length> \| <percentage>5+ | - | 否 | 设置组件自身的高度。

未设置时组件高度默认为0。 | +| padding | <length> | 0 | 否 | 使用简写属性设置所有的内边距属性。
  该属性可以有1到4个值:
- 指定一个值时,该值指定四个边的内边距。
- 指定两个值时,第一个值指定上下两边的内边距,第二个指定左右两边的内边距。
- 指定三个值时,第一个指定上边的内边距,第二个指定左右两边的内边距,第三个指定下边的内边距。
- 指定四个值时分别为上、右、下、左边的内边距(顺时针顺序)。 | +| padding-[left\|top\|right\|bottom] | <length> | 0 | 否 | 设置左、上、右、下内边距属性。 | +| margin | <length> \| <percentage>5+ | 0 | 否 | 使用简写属性设置所有的外边距属性,该属性可以有1到4个值。
- 只有一个值时,这个值会被指定给全部的四个边。
- 两个值时,第一个值被匹配给上和下,第二个值被匹配给左和右。
- 三个值时,第一个值被匹配给上, 第二个值被匹配给左和右,第三个值被匹配给下。
- 四个值时,会依次按上、右、下、左的顺序匹配 (即顺时针顺序)。 | +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | 否 | 设置左、上、右、下外边距属性。 | +| border-width | <length> | 0 | 否 | 使用简写属性设置元素的所有边框宽度。 | +| border-color | <color> | black | 否 | 使用简写属性设置元素的所有边框颜色。 | +| border-radius | <length> | - | 否 | border-radius属性是设置元素的外边框圆角半径。 | +| background-color | <color> | - | 否 | 设置背景颜色。 | +| opacity5+ | number | 1 | 否 | 元素的透明度,取值范围为0到1,1表示为不透明,0表示为完全透明。 | +| [left\|top] | <length> \| <percentage>6+ | - | 否 | left\|top确定元素的偏移位置。
- left属性规定元素的左边缘。该属性定义了定位元素左外边距边界与其包含块左边界之间的偏移。
- top属性规定元素的顶部边缘。该属性定义了一个定位元素的上外边距边界与其包含块上边界之间的偏移。 | + + +## 示例 + +1. Flex样式 + + ```html + +
+
+
+
+
+
+
+ ``` + + + ```css + /* xxx.css */ + .container { + flex-direction: column; + justify-content: center; + align-items: center; + width: 454px; + height: 454px; + } + .flex-box { + justify-content: space-around; + align-items: center; + width: 400px; + height: 140px; + background-color: #ffffff; + } + .flex-item { + width: 120px; + height: 120px; + border-radius: 16px; + } + .color-primary { + background-color: #007dff; + } + .color-warning { + background-color: #ff7500; + } + .color-success { + background-color: #41ba41; + } + ``` + + ![zh-cn_image_0000001381108420](figures/zh-cn_image_0000001381108420.png) + +2. Flex Wrap样式 + + ```html + +
+
+
+
+
+
+
+ ``` + + + ```css + /* xxx.css */ + .container { + flex-direction: column; + justify-content: center; + align-items: center; + width: 454px; + height: 454px; + } + .flex-box { + justify-content: space-around; + align-items: center; + flex-wrap: wrap; + width: 300px; + height: 250px; + background-color: #ffffff; + } + .flex-item { + width: 120px; + height: 120px; + border-radius: 16px; + } + .color-primary { + background-color: #007dff; + } + .color-warning { + background-color: #ff7500; + } + .color-success { + background-color: #41ba41; + } + ``` + + ![zh-cn_image_0000001431148457](figures/zh-cn_image_0000001431148457.png) diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-components-container-list-item.md b/zh-cn/application-dev/reference/arkui-js-lite/js-components-container-list-item.md new file mode 100644 index 0000000000000000000000000000000000000000..8db4c78b3b042eaded0f5c90d6406917b1abf255 --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js-lite/js-components-container-list-item.md @@ -0,0 +1,53 @@ +# list-item + +<[list](js-components-container-list.md)>的子组件,用来展示列表具体item。 + +> **说明:** +> +> 该组件从从API version 4 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + + +## 子组件 + +支持。 + + +## 属性 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| id | string | - | 否 | 组件的唯一标识。 | +| style | string | - | 否 | 组件的样式声明。 | +| class | string | - | 否 | 组件的样式类,用于引用样式表。 | +| ref | string | - | 否 | 用来指定指向子元素的引用信息,该引用将注册到父组件的$refs 属性对象上。 | + + +## 事件 + +| 名称 | 参数 | 描述 | +| -------- | -------- | -------- | +| click | - | 点击动作触发该事件。 | +| longpress | - | 长按动作触发该事件。 | +| swipe5+ | [SwipeEvent](js-common-events.md) | 组件上快速滑动后触发。 | + + +## 样式 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| width | <length> \| <percentage>5+ | - | 否 | 设置组件自身的宽度。
未设置时组件宽度默认为0。 | +| height | <length> \| <percentage>5+ | - | 否 | 设置组件自身的高度。
未设置时组件高度默认为0。 | +| padding | <length> | 0 | 否 | 使用简写属性设置所有的内边距属性。
  该属性可以有1到4个值:
- 指定一个值时,该值指定四个边的内边距。
- 指定两个值时,第一个值指定上下两边的内边距,第二个指定左右两边的内边距。- 指定三个值时,第一个指定上边的内边距,第二个指定左右两边的内边距,第三个指定下边的内边距。- 指定四个值时分别为上、右、下、左边的内边距(顺时针顺序)。 | +| padding-[left\|top\|right\|bottom] | <length> | 0 | 否 | 设置左、上、右、下内边距属性。 | +| border-width | <length> | 0 | 否 | 使用简写属性设置元素的所有边框宽度。 | +| border-color | <color> | black | 否 | 使用简写属性设置元素的所有边框颜色。 | +| border-radius | <length> | - | 否 | border-radius属性是设置元素的外边框圆角半径。 | +| background-color | <color> | - | 否 | 设置背景颜色。 | +| opacity5+ | number | 1 | 否 | 元素的透明度,取值范围为0到1,1表示为不透明,0表示为完全透明。 | +| display | string | flex | 否 | 确定一个元素所产生的框的类型,可选值为:
- flex:弹性布局。
- none:不渲染此元素。 | + + + +## 示例 + +参考 [list示例](js-components-container-list.md) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-components-container-list.md b/zh-cn/application-dev/reference/arkui-js-lite/js-components-container-list.md new file mode 100644 index 0000000000000000000000000000000000000000..905cf802427c20a6b474de2f32adcb241b01db28 --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js-lite/js-components-container-list.md @@ -0,0 +1,123 @@ +# list + +列表包含一系列相同宽度的列表项。适合连续、多行呈现同类数据,例如图片和文本。 + +> **说明:** +> +> 该组件从从API version 4 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + + +## 子组件 + +仅支持<[list-item](js-components-container-list-item.md)>。 + + +## 属性 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| id | string | - | 否 | 组件的唯一标识。 | +| style | string | - | 否 | 组件的样式声明。 | +| class | string | - | 否 | 组件的样式类,用于引用样式表。 | +| ref | string | - | 否 | 用来指定指向子元素的引用信息,该引用将注册到父组件的$refs 属性对象上。 | + + +## 事件 + +| 名称 | 参数 | 描述 | +| -------- | -------- | -------- | +| scrollend | - | 列表滑动已经结束。 | +| click | - | 点击动作触发该事件。 | +| longpress | - | 长按动作触发该事件。 | +| swipe5+ | [SwipeEvent](js-common-events.md) | 组件上快速滑动后触发。 | +| scrolltop8+ | - | 当前列表已滑动到顶部位置。 | +| scrollbottom8+ | - | 当前列表已滑动到底部位置。 | + + +## 样式 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| flex-direction | string | column | 否 | 设置flex容器主轴的方向,指定flex项如何放置在flex容器中,可选值为:
- column:主轴为纵向。
- row:主轴为横向。
其他组件默认值为row,在list组件中默认值为column。轻量级智能穿戴不支持动态修改。 | +| width | <length> \| <percentage>5+ | - | 否 | 设置组件自身的宽度。

未设置时组件宽度默认为0。 | +| height | <length> \| <percentage>5+ | - | 否 | 设置组件自身的高度。

未设置时组件高度默认为0。 | +| padding | <length> | 0 | 否 | 使用简写属性设置所有的内边距属性。
  该属性可以有1到4个值:
- 指定一个值时,该值指定四个边的内边距。
- 指定两个值时,第一个值指定上下两边的内边距,第二个指定左右两边的内边距。
- 指定三个值时,第一个指定上边的内边距,第二个指定左右两边的内边距,第三个指定下边的内边距。
- 指定四个值时分别为上、右、下、左边的内边距(顺时针顺序)。 | +| padding-[left\|top\|right\|bottom] | <length> | 0 | 否 | 设置左、上、右、下内边距属性。 | +| margin | <length> \| <percentage>5+ | 0 | 否 | 使用简写属性设置所有的外边距属性,该属性可以有1到4个值。
- 只有一个值时,这个值会被指定给全部的四个边。
- 两个值时,第一个值被匹配给上和下,第二个值被匹配给左和右。
- 三个值时,第一个值被匹配给上, 第二个值被匹配给左和右,第三个值被匹配给下。
- 四个值时,会依次按上、右、下、左的顺序匹配 (即顺时针顺序)。 | +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | 否 | 设置左、上、右、下外边距属性。 | +| border-width | <length> | 0 | 否 | 使用简写属性设置元素的所有边框宽度。 | +| border-color | <color> | black | 否 | 使用简写属性设置元素的所有边框颜色。 | +| border-radius | <length> | - | 否 | border-radius属性是设置元素的外边框圆角半径。 | +| background-color | <color> | - | 否 | 设置背景颜色。 | +| opacity5+ | number | 1 | 否 | 元素的透明度,取值范围为0到1,1表示为不透明,0表示为完全透明。 | +| display | string | flex | 否 | 确定一个元素所产生的框的类型,可选值为:
- flex:弹性布局。
- none:不渲染此元素。 | +| [left\|top] | <length> \| <percentage>6+ | - | 否 | left\|top确定元素的偏移位置。
- left属性规定元素的左边缘。该属性定义了定位元素左外边距边界与其包含块左边界之间的偏移。
- top属性规定元素的顶部边缘。该属性定义了一个定位元素的上外边距边界与其包含块上边界之间的偏移。 | + + +## 方法 + +| 名称 | 参数 | 描述 | +| -------- | -------- | -------- | +| scrollTo | { index: number(指定位置) } | list滑动到指定index的item位置。 | + + +## 示例 + + +```html + +
+ + + {{$item.title}} + {{$item.date}} + + +
+``` + + +```js +// index.js +export default { + data: { + todolist: [{ + title: '刷题', + date: '2021-12-31 10:00:00', + }, { + title: '看电影', + date: '2021-12-31 20:00:00', + }], + }, +} +``` + + +```css +/* index.css */ +.container { + display: flex; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 454px; + height: 454px; +} +.todo-wraper { + width: 454px; + height: 300px; +} +.todo-item { + width: 454px; + height: 80px; + flex-direction: column; +} +.todo-title { + width: 454px; + height: 40px; + text-align: center; +} +``` + +![list](figures/list.png) diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-components-container-stack.md b/zh-cn/application-dev/reference/arkui-js-lite/js-components-container-stack.md new file mode 100644 index 0000000000000000000000000000000000000000..47a0a062124bc9a92c26dc325739f5cb1b0b3812 --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js-lite/js-components-container-stack.md @@ -0,0 +1,100 @@ +# stack + +堆叠容器,子组件按照顺序依次入栈,后一个子组件覆盖前一个子组件。 + +> **说明:** +> +> 该组件从从API version 4 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + + +## 子组件 + +支持。 + + +## 属性 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| id | string | - | 否 | 组件的唯一标识。 | +| style | string | - | 否 | 组件的样式声明。 | +| class | string | - | 否 | 组件的样式类,用于引用样式表。 | +| ref | string | - | 否 | 用来指定指向子元素的引用信息,该引用将注册到父组件的$refs 属性对象上。 | + + +## 事件 + +| 名称 | 参数 | 描述 | +| -------- | -------- | -------- | +| click | - | 点击动作触发该事件。 | +| longpress | - | 长按动作触发该事件。 | +| swipe5+ | [SwipeEvent](js-common-events.md) | 组件上快速滑动后触发。 | + + +## 样式 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| width | <length> \| <percentage>5+ | - | 否 | 设置组件自身的宽度。

未设置时组件宽度默认为0。 | +| height | <length> \| <percentage>5+ | - | 否 | 设置组件自身的高度。

未设置时组件高度默认为0。 | +| padding | <length> | 0 | 否 | 使用简写属性设置所有的内边距属性。
  该属性可以有1到4个值:
- 指定一个值时,该值指定四个边的内边距。
- 指定两个值时,第一个值指定上下两边的内边距,第二个指定左右两边的内边距。
- 指定三个值时,第一个指定上边的内边距,第二个指定左右两边的内边距,第三个指定下边的内边距。
- 指定四个值时分别为上、右、下、左边的内边距(顺时针顺序)。 | +| padding-[left\|top\|right\|bottom] | <length> | 0 | 否 | 设置左、上、右、下内边距属性。 | +| margin | <length> \| <percentage>5+ | 0 | 否 | 使用简写属性设置所有的外边距属性,该属性可以有1到4个值。
- 只有一个值时,这个值会被指定给全部的四个边。
- 两个值时,第一个值被匹配给上和下,第二个值被匹配给左和右。
- 三个值时,第一个值被匹配给上, 第二个值被匹配给左和右,第三个值被匹配给下。
- 四个值时,会依次按上、右、下、左的顺序匹配 (即顺时针顺序)。 | +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | 否 | 设置左、上、右、下外边距属性。 | +| border-width | <length> | 0 | 否 | 使用简写属性设置元素的所有边框宽度。 | +| border-color | <color> | black | 否 | 使用简写属性设置元素的所有边框颜色。 | +| border-radius | <length> | - | 否 | border-radius属性是设置元素的外边框圆角半径。 | +| background-color | <color> | - | 否 | 设置背景颜色。 | +| opacity5+ | number | 1 | 否 | 元素的透明度,取值范围为0到1,1表示为不透明,0表示为完全透明。 | +| display | string | flex | 否 | 确定一个元素所产生的框的类型,可选值为:
- flex:弹性布局。
- none:不渲染此元素。 | +| [left\|top] | <length> \| <percentage>6+ | - | 否 | left\|top确定元素的偏移位置。
- left属性规定元素的左边缘。该属性定义了定位元素左外边距边界与其包含块左边界之间的偏移。
- top属性规定元素的顶部边缘。该属性定义了一个定位元素的上外边距边界与其包含块上边界之间的偏移。 | + +> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> 由于绝对定位不支持设置百分比,所以也不支持stack组件的子组件上设置margin。 + + +## 示例 + + +```html + + +
+
+
+
+``` + + +```css +/* xxx.css */ +.stack-parent { + width: 400px; + height: 400px; + background-color: #ffffff; + border-width: 1px; + border-style: solid; +} +.back-child { + width: 300px; + height: 300px; + background-color: #3f56ea; +} +.front-child { + width: 100px; + height: 100px; + background-color: #00bfc9; +} +.positioned-child { + width: 100px; + height: 100px; + left: 50px; + top: 50px; + background-color: #47cc47; +} +.bd-radius { + border-radius: 16px; +} +``` + +![zh-cn_image_0000001380789188](figures/zh-cn_image_0000001380789188.png) diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-components-container-swiper.md b/zh-cn/application-dev/reference/arkui-js-lite/js-components-container-swiper.md new file mode 100644 index 0000000000000000000000000000000000000000..37865ab41d81a1d873ab0df01b06253f397b779b --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js-lite/js-components-container-swiper.md @@ -0,0 +1,112 @@ +# swiper + +滑动容器,提供切换子组件显示的能力。 + +> **说明:** +> +> 该组件从从API version 4 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + + +## 子组件 + +支持除<list>之外的子组件。 + + +## 属性 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| index | number | 0 | 否 | 当前在容器中显示的子组件的索引值。 | +| loop | boolean | true | 否 | 是否开启循环轮播。
| +| duration | number | - | 否 | 子组件切换的动画时长。 | +| vertical | boolean | false | 否 | 是否为纵向滑动,纵向滑动时采用纵向的指示器。
不支持动态修改。 | +| id | string | - | 否 | 组件的唯一标识。 | +| style | string | - | 否 | 组件的样式声明。 | +| class | string | - | 否 | 组件的样式类,用于引用样式表。 | +| ref | string | - | 否 | 用来指定指向子元素的引用信息,该引用将注册到父组件的$refs 属性对象上。 | + + +## 事件 + +| 名称 | 参数 | 描述 | +| -------- | -------- | -------- | +| change | { index: currentIndex } | 当前显示的组件索引变化时触发该事件。 | +| click | - | 点击动作触发该事件。 | +| longpress | - | 长按动作触发该事件。 | +| swipe5+ | [SwipeEvent](js-common-events.md) | 组件上快速滑动后触发。 | + + +## 样式 + +| 名称 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| width | <length> \| <percentage>5+ | - | 否 | 设置组件自身的宽度。

未设置时组件宽度默认为0。 | +| height | <length> \| <percentage>5+ | - | 否 | 设置组件自身的高度。

未设置时组件高度默认为0。 | +| padding | <length> | 0 | 否 | 使用简写属性设置所有的内边距属性。
  该属性可以有1到4个值:
- 指定一个值时,该值指定四个边的内边距。
- 指定两个值时,第一个值指定上下两边的内边距,第二个指定左右两边的内边距。
- 指定三个值时,第一个指定上边的内边距,第二个指定左右两边的内边距,第三个指定下边的内边距。
- 指定四个值时分别为上、右、下、左边的内边距(顺时针顺序)。 | +| padding-[left\|top\|right\|bottom] | <length> | 0 | 否 | 设置左、上、右、下内边距属性。 | +| margin | <length> \| <percentage>5+ | 0 | 否 | 使用简写属性设置所有的外边距属性,该属性可以有1到4个值。
- 只有一个值时,这个值会被指定给全部的四个边。
- 两个值时,第一个值被匹配给上和下,第二个值被匹配给左和右。
- 三个值时,第一个值被匹配给上, 第二个值被匹配给左和右,第三个值被匹配给下。
- 四个值时,会依次按上、右、下、左的顺序匹配 (即顺时针顺序)。 | +| margin-[left\|top\|right\|bottom] | <length> \| <percentage>5+ | 0 | 否 | 设置左、上、右、下外边距属性。 | +| border-width | <length> | 0 | 否 | 使用简写属性设置元素的所有边框宽度。 | +| border-color | <color> | black | 否 | 使用简写属性设置元素的所有边框颜色。 | +| border-radius | <length> | - | 否 | border-radius属性是设置元素的外边框圆角半径。 | +| background-color | <color> | - | 否 | 设置背景颜色。 | +| opacity5+ | number | 1 | 否 | 元素的透明度,取值范围为0到1,1表示为不透明,0表示为完全透明。 | +| display | string | flex | 否 | 确定一个元素所产生的框的类型,可选值为:
- flex:弹性布局。
- none:不渲染此元素。 | +| [left\|top] | <length> \| <percentage>6+ | - | 否 | left\|top确定元素的偏移位置。
- left属性规定元素的左边缘。该属性定义了定位元素左外边距边界与其包含块左边界之间的偏移。
- top属性规定元素的顶部边缘。该属性定义了一个定位元素的上外边距边界与其包含块上边界之间的偏移。 | + + +## 示例 + + +```html + + +
+ 1 +
+
+ 2 +
+
+ 3 +
+
+``` + + +```css +/* xxx.css */ +.container { + left: 0px; + top: 0px; + width: 454px; + height: 454px; +} +.swiper-item { + width: 454px; + height: 454px; + justify-content: center; + align-items: center; +} +.primary-item { + background-color: #007dff; +} +.warning-item { + background-color: #ff7500; +} +.success-item { + background-color: #41ba41; +} +``` + + +```js +/* xxx.js */ +export default { + data: { + index: 1 + } +} +``` + +![swiper](figures/swiper.gif) diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-framework-file.md b/zh-cn/application-dev/reference/arkui-js-lite/js-framework-file.md new file mode 100644 index 0000000000000000000000000000000000000000..77b4940269728279a8a07fcbcbfcc17f5f1c19c9 --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js-lite/js-framework-file.md @@ -0,0 +1,73 @@ +# 文件组织 + + +## 目录结构 + +JS FA应用的JS模块(entry/src/main/js/module)的典型开发目录结构如下: + + **图2** 目录结构   + +![zh-cn_image_0000001431388581](figures/zh-cn_image_0000001431388581.png) + +目录结构中文件分类如下: + +- .hml结尾的HML模板文件,这个文件用来描述当前页面的文件布局结构。 + +- .css结尾的CSS样式文件,这个文件用于描述页面样式。 + +- .js结尾的JS文件,这个文件用于处理页面和用户的交互。 + +各个文件夹的作用: + +- app.js文件用于全局JavaScript逻辑和应用生命周期管理。 +- pages目录用于存放所有组件页面。 +- common目录用于存放公共资源文件,比如:媒体资源和JS文件。 +- i18n目录用于配置不同语言场景资源内容,比如应用文本词条,图片路径等资源。 + +> **说明:** +> +> - i18n是开发保留文件夹,不可重命名。 +> +> +>- 在使用DevEco Studio进行应用开发时,目录结构中的可选文件夹需要开发者根据实际情况自行创建。 + + +## 文件访问规则 + +应用资源可通过绝对路径或相对路径的方式进行访问,本开发框架中绝对路径以"/"开头,相对路径以"./"或"../"。具体访问规则如下: + +- 引用代码文件,需使用相对路径,比如:../common/utils.js。 + +- 引用资源文件,推荐使用绝对路径。比如:/common/xxx.png。 + +- 公共代码文件和资源文件推荐放在common下,通过以上两条规则进行访问。 + +- CSS样式文件中通过url()函数创建<url>数据类型,如:url(/common/xxx.png)。 + +> **说明:** +> 当代码文件A需要引用代码文件B时: +> +> - 如果代码文件A和文件B位于同一目录,则代码文件B引用资源文件时可使用相对路径,也可使用绝对路径。 +> +> - 如果代码文件A和文件B位于不同目录,则代码文件B引用资源文件时必须使用绝对路径。因为Webpack打包时,代码文件B的目录会发生变化。 +> +> + + +## 媒体文件格式 + + **表1** 支持的图片格式 + +| 格式 | 支持版本 | 支持的文件类型 | +| -------- | -------- | -------- | +| BMP | API Version 4+ | .bmp | +| JPEG | API Version 4+ | .jpg | +| PNG | API Version 4+ | .png | + +## 存储目录定义 + +从API Version 5开始,[image](js-components-basic-image.md)组件支持应用私有目录内的图片资源访问。 + +| 目录类型 | 路径前缀 | 访问可见性 | 说明 | +| ------------ | --------------- | ------------ | --------------------------------------------------- | +| 应用私有目录 | internal://app/ | 仅本应用可见 | 目录随应用卸载删除,路径禁止使用../等方式访问父目录 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-framework-js-file.md b/zh-cn/application-dev/reference/arkui-js-lite/js-framework-js-file.md new file mode 100644 index 0000000000000000000000000000000000000000..7b6bdf24e68d92376a99174713a0c8350a3f6dd9 --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js-lite/js-framework-js-file.md @@ -0,0 +1,83 @@ +# app.js + +## 应用生命周期4+ + +每个应用可以在app.js自定义应用级生命周期的实现逻辑,包括: + + +- onCreate:在应用生成时被调用的生命周期函数。 + +- onDestory:在应用销毁时被调用的生命周期函数。 + + +以下示例仅在生命周期函数中打印对应日志: + + + +``` +// app.js +export default { + onCreate() { + console.info('Application onCreate'); + }, + onDestroy() { + console.info('Application onDestroy'); + }, +} +``` + +## 应用对象10+ + +| 属性 | 类型 | 描述 | +| ------ | -------- | ------------------------------------------------------------ | +| getApp | Function | 提供getApp()全局方法,可以在页面js文件中获取app.js中暴露的数据对象。 | + +> **说明**:应用对象是全局数据,其在整个应用消亡之前都会一直占用JS内存。尽管应用对象可为不同页面共享数据提供便利,但因为小型设备本身内存比较小,也应谨慎使用。如果过度使用,则容易造成应用在进入复杂page页面时,内存不够而出现异常。 + +示例如下: + +在 app.js 中声明应用对象: + +```javascript +// app.js +export default { + data: { + test: "by getAPP" + }, + onCreate() { + console.info('Application onCreate'); + }, + onDestroy() { + console.info('Application onDestroy'); + }, +}; +``` + +在具体的页面中访问应用对象: + +```javascript +// index.js +export default { + data: { + title: "" + }, + onInit() { + if (typeof getApp !== 'undefined') { + var appData = getApp().data; + if (typeof appData !== 'undefined') { + this.title = appData.name; // read from app data + } + } + }, + clickHandler() { + if (typeof getApp !== 'undefined') { + var appData = getApp().data; + if (typeof appData !== 'undefined') { + appData.name = this.title; // write to app data + } + } + } +} +``` + +> **说明**:为了应用可在不支持getApp的低版本上正常运行,代码中应进行兼容性处理,即在使用getApp前先判断其是否可用。 \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-framework-js-tag.md b/zh-cn/application-dev/reference/arkui-js-lite/js-framework-js-tag.md new file mode 100644 index 0000000000000000000000000000000000000000..5866a02f7f613be4064058dbb94b82beb06fcd4a --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js-lite/js-framework-js-tag.md @@ -0,0 +1,73 @@ +# js标签配置 + + +js标签中包含了实例名称、页面路由信息。 + + +| 标签 | 类型 | 默认值 | 必填 | 描述 | +| -------- | -------- | -------- | -------- | -------- | +| name | string | default | 是 | 标识JS实例的名字。 | +| pages | Array | - | 是 | 路由信息,详见“**[pages](#pages)**”。 | + + +> **说明:** +> name、pages标签配置需在配置文件中的“js”标签中完成设置。 + + +## pages + +定义每个页面的路由信息,每个页面由页面路径和页面名组成,页面的文件名就是页面名。比如: + + +``` +{ + ... + "pages": [ + "pages/index/index", + "pages/detail/detail" + ] + ... +} +``` + + +> **说明:** +> +> +> - 应用首页固定为"pages/index/index"。 +> +> - 页面文件名不能使用组件名称,比如:text.hml、button.hml等。 + + +## 示例 + + +``` +{ + "app": { + "bundleName": "com.huawei.player", + "version": { + "code": 1, + "name": "1.0" + }, + "vendor": "example" + } + "module": { + ... + "js": [ + { + "name": "default", + "pages": [ + "pages/index/index", + "pages/detail/detail" + ] + } + ], + "abilities": [ + { + ... + } + ] + } +} +``` diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-framework-syntax-css.md b/zh-cn/application-dev/reference/arkui-js-lite/js-framework-syntax-css.md new file mode 100644 index 0000000000000000000000000000000000000000..b61f1a17c557b0871ce8caeb2cc85245edbb83af --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js-lite/js-framework-syntax-css.md @@ -0,0 +1,161 @@ +# CSS语法参考 + + +CSS是描述HML页面结构的样式语言。所有组件均存在系统默认样式,也可在页面CSS样式文件中对组件、页面自定义不同的样式。 + + +## 样式导入 + +为了模块化管理和代码复用,CSS样式文件支持 \@import 语句,导入 CSS 文件。 + + +## 声明样式 + +每个页面目录下存在一个与布局hml文件同名的css文件,用来描述该hml页面中组件的样式,决定组件应该如何显示。 + +1. 内部样式,支持使用style、class属性来控制组件的样式。例如: + + ``` + +
+ Hello World +
+ ``` + + + ``` + /* index.css */ + .container { + justify-content: center; + } + ``` + +2. 文件导入,合并外部样式文件。例如,在common目录中定义样式文件style.css,并在index.css文件首行中进行导入: + + ``` + /* style.css */ + .title { + font-size: 50px; + } + ``` + + + ``` + /* index.css */ + @import '../../common/style.css'; + .container { + justify-content: center; + } + ``` + + +## 选择器 + +css选择器用于选择需要添加样式的元素,支持的选择器如下表所示: + +| 选择器 | 样例 | 样例描述 | +| -------- | -------- | -------- | +| .class | .container | 用于选择class="container"的组件。 | +| \#id | \#titleId | 用于选择id="titleId"的组件。 | +| , | .title, .content | 用于选择class="title"和class="content"的组件。 | + +示例: + + +``` + +
+ 标题 +
+ 内容 +
+
+``` + + +``` +/* 页面样式xxx.css */ +/* 对class="title"的组件设置样式 */ +.title { + font-size: 30px; +} +/* 对id="contentId"的组件设置样式 */ +#contentId { + font-size: 20px; +} +/* 对所有class="title"以及class="content"的组件都设置padding为5px */ +.title, .content { + padding: 5px; +} + +``` + + +## 伪类 + +css伪类是选择器中的关键字,用于指定要选择元素的特殊状态。 + + + +| 名称 | 支持组件 | 描述 | +| -------- | -------- | -------- | +| :active |
input[type="button"] | 表示被用户激活的元素,如:被用户按下的按钮。轻量级智能穿戴上伪类选择器上仅支持background-color 和background-image 的样式设置。 | +| :checked | input[type="checkbox"、type="radio"] | 表示checked属性为true的元素。轻量级智能穿戴上伪类选择器上仅支持background-color 和background-image 的样式设置。 | + +伪类示例如下,设置按钮的:active伪类可以控制被用户按下时的样式: + + +``` + +
+ +
+``` + + +``` +/* index.css */ +.button:active { + background-color: #888888;/*按钮被激活时,背景颜色变为#888888 */ +} +``` + + +## 样式预编译 + +预编译提供了利用特有语法生成css的程序,可以提供变量、运算等功能,令开发者更便捷地定义组件样式,目前支持less、sass和scss的预编译。使用样式预编译时,需要将原css文件后缀改为less、sass或scss,如index.css改为index.less、index.sass或index.scss。 + +- 当前文件使用样式预编译,例如将原index.css改为index.less: + + ``` + /* index.less */ + /* 定义变量 */ + @colorBackground: #000000; + .container { + background-color: @colorBackground; /* 使用当前less文件中定义的变量 */ + } + ``` + +- 引用预编译文件,例如common中存在style.scss文件,将原index.css改为index.scss,并引入style.scss: + + ``` + /* style.scss */ + /* 定义变量 */ + $colorBackground: #000000; + ``` + + 在index.scss中引用: + + + ``` + /* index.scss */ + /* 引入外部scss文件 */ + @import '../../common/style.scss'; + .container { + background-color: $colorBackground; /* 使用style.scss中定义的变量 */ + } + ``` + + + > **说明:** + > 引用的预编译文件建议放在common目录进行管理。 diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-framework-syntax-hml.md b/zh-cn/application-dev/reference/arkui-js-lite/js-framework-syntax-hml.md new file mode 100644 index 0000000000000000000000000000000000000000..73ebc3421624f68c271b1bc3718136fc1a4b0556 --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js-lite/js-framework-syntax-hml.md @@ -0,0 +1,308 @@ +# HML语法参考 + + +HML(OpenHarmony Markup Language)是一套类HTML的标记语言,通过组件,事件构建出页面的内容。页面具备数据绑定、事件绑定、列表渲染、条件渲染等高级能力。 + + +## 页面结构 + + +``` + +
+ Image Show +
+ +
+
+``` + + +## 数据绑定 + + +``` + +
+ {{content[1]}} +
+``` + + +``` +// xxx.js +export default { + data: { + content: ['Hello World!', 'Welcome to my world!'] + }, + changeText: function() { + this.content.splice(1, 1, this.content[0]); + } +} +``` + +> **说明:** +> - 针对数组内的数据修改,请使用splice方法生效数据绑定变更。 +> +> - hml中的js表达式不支持ES6语法。 + + +## 事件绑定 + +事件绑定的回调函数接收一个事件对象参数,可以通过访问该事件对象获取事件信息。 + + +``` + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+
+``` + + +``` +// xxx.js +export default { + data: { + obj: '', + }, + clickfunc: function(e) { + this.obj = 'Hello World'; + console.log(e); + }, +} +``` + +> **说明:** +> +> 事件冒泡机制从API Version 5开始支持。升级SDK后,运行存量JS应用,采用旧写法(onclick)的事件绑定还是按事件不冒泡进行处理。但如果使用新版本SDK重新打包JS应用,将旧写法按事件冒泡进行处理。为了避免业务逻辑错误,建议将旧写法(如onclick)改成新写法(grab:click)。 + +**示例:** + +``` + +
+ {{count}} +
+ + + + + + +
+
+``` + + +``` +/* xxx.js */ +export default { + data: { + count: 0 + }, + increase() { + this.count++; + }, + decrease() { + this.count--; + }, + multiply(multiplier) { + this.count = multiplier * this.count; + } +}; +``` + + +``` +/* xxx.css */ +.container { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + left: 0px; + top: 0px; + width: 454px; + height: 454px; +} +.title { + font-size: 30px; + text-align: center; + width: 200px; + height: 100px; +} +.box { + width: 454px; + height: 200px; + justify-content: center; + align-items: center; + flex-wrap: wrap; +} +.btn { + width: 200px; + border-radius: 0; + margin-top: 10px; + margin-left: 10px; +} +``` + + +## 列表渲染 + + +``` + +
+ + +
+ {{$idx}}.{{$item.name}} +
+ +
+ {{$idx}}.{{value.name}} +
+ +
+ {{index}}.{{value.name}} +
+
+``` + + +``` +// xxx.js +export default { + data: { + array: [ + {id: 1, name: 'jack', age: 18}, + {id: 2, name: 'tony', age: 18}, + ], + }, + changeText: function() { + if (this.array[1].name === "tony"){ + this.array.splice(1, 1, {id:2, name: 'Isabella', age: 18}); + } else { + this.array.splice(2, 1, {id:3, name: 'Bary', age: 18}); + } + }, +} +``` + +tid属性主要用来加速for循环的重渲染,旨在列表中的数据有变更时,提高重新渲染的效率。tid属性是用来指定数组中每个元素的唯一标识,如果未指定,数组中每个元素的索引为该元素的唯一id。例如上述tid="id"表示数组中的每个元素的id属性为该元素的唯一标识。for循环支持的写法如下: + +- for="array":其中array为数组对象,array的元素变量默认为$item。 + +- for="v in array":其中v为自定义的元素变量,元素索引默认为$idx。 + +- for="(i, v) in array":其中元素索引为i,元素变量为v,遍历数组对象array。 + +> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** +> - 数组中的每个元素必须存在tid指定的数据属性,否则运行时可能会导致异常。 +> +> - 数组中被tid指定的属性要保证唯一性,如果不是则会造成性能损耗。比如,示例中只有id和name可以作为tid字段,因为它们属于唯一字段。 +> +> - tid不支持表达式。 + + +## 条件渲染 + +条件渲染分为2种:if/elif/else和show。两种写法的区别在于:第一种写法里if为false时,组件不会在vdom中构建,也不会渲染,而第二种写法里show为false时虽然也不渲染,但会在vdom中构建;另外,当使用if/elif/else写法时,节点必须是兄弟节点,否则编译无法通过。实例如下: + + +``` + +
+ + + Hello-One + Hello-Two + Hello-World +
+``` + + +``` +// xxx.css +.container{ + flex-direction: column; + align-items: center; +} +.btn{ + width: 280px; + font-size: 26px; + margin: 10px 0; +} +``` + + +``` +// xxx.js +export default { + data: { + show: false, + display: true, + }, + toggleShow: function() { + this.show = !this.show; + }, + toggleDisplay: function() { + this.display = !this.display; + } +} +``` + +优化渲染优化:show方法。当show为真时,节点正常渲染;当为假时,仅仅设置display样式为none。 + + +``` + +
+ + Hello World +
+``` + + +``` +// xxx.css +.container{ + flex-direction: column; + align-items: center; +} +.btn{ + width: 280px; + font-size: 26px; + margin: 10px 0; +} +``` + + +``` +// xxx.js +export default { + data: { + visible: false, + }, + toggle: function() { + this.visible = !this.visible; + }, +} +``` + +> **说明:** +> 禁止在同一个元素上同时设置for和if属性。 diff --git a/zh-cn/application-dev/reference/arkui-js-lite/js-framework-syntax-js.md b/zh-cn/application-dev/reference/arkui-js-lite/js-framework-syntax-js.md new file mode 100644 index 0000000000000000000000000000000000000000..1a9c10683d0a75f0aab1997e49ada59b84a664c4 --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-js-lite/js-framework-syntax-js.md @@ -0,0 +1,122 @@ +# JS语法参考 + + +JS文件用来定义HML页面的业务逻辑,支持ECMA规范的JavaScript语言。基于JavaScript语言的动态化能力,可以使应用更加富有表现力,具备更加灵活的设计。下面讲述JS文件的编译和运行的支持情况。 + + +## 语法 + +支持ES6语法。轻量级智能穿戴支持的ES6语法有限,仅支持以下ES6 语法: + +1. let/const + +2. arrow functions + +3. class + +4. default value + +5. destructuring assignment + +6. destructuring binding pattern + +7. enhanced object initializer + +8. for-of + +9. rest parameter + +10. template strings + +- 模块声明 + 使用import方法引入功能模块: + + + ``` + import router from '@system.router'; + ``` + +- 代码引用 + 使用import方法导入js代码: + + + ``` + import utils from '../../common/utils.js'; + ``` + + +## 对象 + +- 页面对象 + | 属性 | 类型 | 描述 | + | -------- | -------- | -------- | + | data | Object/Function | 页面的数据模型,类型是对象或者函数,如果类型是函数,返回值必须是对象。属性名不能以$或_开头,不要使用保留字for, if, show, tid。
| + | $refs | Object | 持有注册过ref 属性的DOM元素或子组件实例的对象。示例见[获取DOM元素](#获取dom元素)。 | + + +## 获取DOM元素 + +1. 通过$refs获取DOM元素 + + ``` + +
+ +
+ ``` + + + ``` + // index.js + export default { + data: { + images: [ + { src: '/common/frame1.png' }, + { src: '/common/frame2.png' }, + { src: '/common/frame3.png' }, + ], + }, + handleClick() { + const animator = this.$refs.animator; // 获取ref属性为animator的DOM元素 + const state = animator.getState(); + if (state === 'paused') { + animator.resume(); + } else if (state === 'stopped') { + animator.start(); + } else { + animator.pause(); + } + }, + }; + ``` + + +## 生命周期接口 + +- 页面生命周期 + | 属性 | 类型 | 参数 | 返回值 | 描述 | 触发时机 | + | -------- | -------- | -------- | -------- | -------- | -------- | + | onInit | Function | 无 | 无 | 页面初始化 | 页面数据初始化完成时触发,只触发一次。 | + | onReady | Function | 无 | 无 | 页面创建完成 | 页面创建完成时触发,只触发一次。 | + | onShow | Function | 无 | 无 | 页面显示 | 页面显示时触发。 | + | onHide | Function | 无 | 无 | 页面消失 | 页面消失时触发。 | + | onDestroy | Function | 无 | 无 | 页面销毁 | 页面销毁时触发。 | + + 页面A的生命周期接口的调用顺序: + - 打开页面A:onInit() -> onReady() -> onShow() + + - 在页面A打开页面B:onHide() -> onDestroy() + + - 从页面B返回页面A:onInit() -> onReady() -> onShow() + + - 退出页面A:onHide() -> onDestroy() + + - 页面隐藏到后台运行:onHide() + + - 页面从后台运行恢复到前台:onShow() + +- 应用生命周期 + | 属性 | 类型 | 参数 | 返回值 | 描述 | 触发时机 | + | -------- | -------- | -------- | -------- | -------- | -------- | + | onCreate | Function | 无 | 无 | 应用创建 | 当应用创建时调用。 | + | onDestroy | Function | 无 | 无 | 应用退出 | 当应用退出时触发。 | diff --git a/zh-cn/application-dev/reference/arkui-js-lite/public_sys-resources/icon-caution.gif b/zh-cn/application-dev/reference/arkui-js-lite/public_sys-resources/icon-caution.gif new file mode 100644 index 0000000000000000000000000000000000000000..6e90d7cfc2193e39e10bb58c38d01a23f045d571 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/public_sys-resources/icon-caution.gif differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/public_sys-resources/icon-danger.gif b/zh-cn/application-dev/reference/arkui-js-lite/public_sys-resources/icon-danger.gif new file mode 100644 index 0000000000000000000000000000000000000000..6e90d7cfc2193e39e10bb58c38d01a23f045d571 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/public_sys-resources/icon-danger.gif differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/public_sys-resources/icon-note.gif b/zh-cn/application-dev/reference/arkui-js-lite/public_sys-resources/icon-note.gif new file mode 100644 index 0000000000000000000000000000000000000000..6314297e45c1de184204098efd4814d6dc8b1cda Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/public_sys-resources/icon-note.gif differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/public_sys-resources/icon-notice.gif b/zh-cn/application-dev/reference/arkui-js-lite/public_sys-resources/icon-notice.gif new file mode 100644 index 0000000000000000000000000000000000000000..86024f61b691400bea99e5b1f506d9d9aef36e27 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/public_sys-resources/icon-notice.gif differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/public_sys-resources/icon-tip.gif b/zh-cn/application-dev/reference/arkui-js-lite/public_sys-resources/icon-tip.gif new file mode 100644 index 0000000000000000000000000000000000000000..93aa72053b510e456b149f36a0972703ea9999b7 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/public_sys-resources/icon-tip.gif differ diff --git a/zh-cn/application-dev/reference/arkui-js-lite/public_sys-resources/icon-warning.gif b/zh-cn/application-dev/reference/arkui-js-lite/public_sys-resources/icon-warning.gif new file mode 100644 index 0000000000000000000000000000000000000000..6e90d7cfc2193e39e10bb58c38d01a23f045d571 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-js-lite/public_sys-resources/icon-warning.gif differ 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 a0f754de20cb86ba2ba7bd370e52c5162e7d8417..b4f136fbe25313fbb7925f96d35bed69c8511219 100644 --- a/zh-cn/application-dev/reference/arkui-js/Readme-CN.md +++ b/zh-cn/application-dev/reference/arkui-js/Readme-CN.md @@ -1,4 +1,4 @@ -# 兼容JS的类Web开发范式 +# 兼容JS的类Web开发范式(ArkUI.Full) - 组件通用信息 - [通用属性](js-components-common-attributes.md) diff --git a/zh-cn/application-dev/reference/arkui-js/figures/text.png b/zh-cn/application-dev/reference/arkui-js/figures/js-text.png similarity index 100% rename from zh-cn/application-dev/reference/arkui-js/figures/text.png rename to zh-cn/application-dev/reference/arkui-js/figures/js-text.png diff --git a/zh-cn/application-dev/reference/arkui-js/js-components-basic-picker-view.md b/zh-cn/application-dev/reference/arkui-js/js-components-basic-picker-view.md index d5311a381b6e5cc61d8e6b10b56109645a68039d..e686e7e6f2acea233acccef2d8ea35770a0714a8 100644 --- a/zh-cn/application-dev/reference/arkui-js/js-components-basic-picker-view.md +++ b/zh-cn/application-dev/reference/arkui-js/js-components-basic-picker-view.md @@ -120,228 +120,232 @@ ## 示例 -1. 文本选择器 - ```html - -
- - 选中值:{{value}} 选中下标: {{index}} - - -
- ``` - - ```css - /* xxx.css */ - .container { - flex-direction: column; - justify-content: center; - align-items: center; - width: 100%; - height: 50%; - } - .title { - font-size: 30px; - text-align: center; - margin-top: 50%; - } - ``` - - ```js - /* xxx.js */ - export default { - data: { - options: ['选项1', '选项2', '选项3'], - value: "选项1", - index: 0 - }, - handleChange(data) { - this.value = data.newValue; - this.index = data.newSelected; - }, - } - ``` - ![picker-view0](figures/picker-view0.gif) - -2. 时间选择器 - ```html - -
- - Selected:{{time}} - - -
- ``` - - ```css - /* xxx.css */ - .container { - flex-direction: column; - justify-content: center; - align-items: center; - width: 100%; - height: 50%; - } - .title { - font-size: 31px; - text-align: center; - margin-top: 50%; - } - ``` - - ```js - /* xxx.js */ - export default { - data: { - defaultTime: "", - time: "", - }, - onInit() { - this.defaultTime = this.now(); - }, - handleChange(data) { - this.time = this.concat(data.hour, data.minute); - }, - now() { - const date = new Date(); - const hours = date.getHours(); - const minutes = date.getMinutes(); - return this.concat(hours, minutes); - }, - fill(value) { - return (value > 9 ? "" : "0") + value; - }, - concat(hours, minutes) { - return `${this.fill(hours)}:${this.fill(minutes)}`; - }, - } - ``` - - ![picker-view1](figures/picker-view1.gif) - -3. 日期选择器 - ```html - -
- - Selected:{{date}} - - -
- ``` - - ```css - /* xxx.css */ - .container { - flex-direction: column; - justify-content: center; - align-items: center; - width: 100%; - height: 50%; - } - .title { - font-size: 31px; - text-align: center; - margin-top: 50%; - } - ``` - - ```js - /* xxx.js */ - export default { - data: { - date: "", - }, - handleChange(data) { - this.date = data.year + "年" + data.month + "月" + data.day + "日"; - }, - } - ``` - ![picker-view2](figures/picker-view2.gif) - -4. 日期时间选择器 - ```html - -
- - Selected:{{datetime}} - - -
- ``` - - ```css - /* xxx.css */ - .container { - flex-direction: column; - justify-content: center; - align-items: center; - width: 100%; - height: 50%; - } - .title { - font-size: 31px; - text-align: center; - margin-top: 50%; - } - ``` - - ```js - /* xxx.js */ - export default { - data: { - datetime: "", - }, - handleChange(data) { - this.datetime = data.year + "年" + data.month + "月" + data.day + "日" + data.hour + "时" + data.minute + "分"; - }, - } - ``` - ![picker-view3](figures/picker-view3.gif) - -5. 多列文本选择器 - - ```html - -
- - Selected:{{ value }} - - -
- ``` - - ```css - /* xxx.css */ - .container { - flex-direction: column; - justify-content: center; - align-items: center; - width: 100%; - height: 50%; - } - .title { - font-size: 31px; - text-align: center; - margin-top: 50%; - } - ``` - - ```js - /* xxx.js */ - export default { - data: { - multitext: [ - [1, 2, 3], - [4, 5, 6], - [7, 8, 9], - ], - value: "" - }, - handleChange(data) { - this.value = data.column + "列," + "值为" + data.newValue + ",下标为" + data.newSelected; - }, - } - ``` - ![picker-view4](figures/picker-view4.gif) \ No newline at end of file +### 文本选择器 + +```html + +
+ + 选中值:{{value}} 选中下标: {{index}} + + +
+``` + +```css +/* xxx.css */ +.container { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + height: 50%; +} +.title { + font-size: 30px; + text-align: center; + margin-top: 50%; +} +``` + +```js +/* xxx.js */ +export default { + data: { + options: ['选项1', '选项2', '选项3'], + value: "选项1", + index: 0 + }, + handleChange(data) { + this.value = data.newValue; + this.index = data.newSelected; + }, +} +``` +![picker-view0](figures/picker-view0.gif) + +### 时间选择器 + +```html + +
+ + Selected:{{time}} + + +
+``` + +```css +/* xxx.css */ +.container { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + height: 50%; +} +.title { + font-size: 31px; + text-align: center; + margin-top: 50%; +} +``` + +```js +/* xxx.js */ +export default { + data: { + defaultTime: "", + time: "", + }, + onInit() { + this.defaultTime = this.now(); + }, + handleChange(data) { + this.time = this.concat(data.hour, data.minute); + }, + now() { + const date = new Date(); + const hours = date.getHours(); + const minutes = date.getMinutes(); + return this.concat(hours, minutes); + }, + fill(value) { + return (value > 9 ? "" : "0") + value; + }, + concat(hours, minutes) { + return `${this.fill(hours)}:${this.fill(minutes)}`; + }, +} +``` + +![picker-view1](figures/picker-view1.gif) + +### 日期选择器 + +```html + +
+ + Selected:{{date}} + + +
+``` + +```css +/* xxx.css */ +.container { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + height: 50%; +} +.title { + font-size: 31px; + text-align: center; + margin-top: 50%; +} +``` + +```js +/* xxx.js */ +export default { + data: { + date: "", + }, + handleChange(data) { + this.date = data.year + "年" + data.month + "月" + data.day + "日"; + }, +} +``` +![picker-view2](figures/picker-view2.gif) + +### 日期时间选择器 + +```html + +
+ + Selected:{{datetime}} + + +
+``` + +```css +/* xxx.css */ +.container { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + height: 50%; +} +.title { + font-size: 31px; + text-align: center; + margin-top: 50%; +} +``` + +```js +/* xxx.js */ +export default { + data: { + datetime: "", + }, + handleChange(data) { + this.datetime = data.year + "年" + data.month + "月" + data.day + "日" + data.hour + "时" + data.minute + "分"; + }, +} +``` +![picker-view3](figures/picker-view3.gif) + +### 多列文本选择器 + +```html + +
+ + Selected:{{ value }} + + +
+``` + +```css +/* xxx.css */ +.container { + flex-direction: column; + justify-content: center; + align-items: center; + width: 100%; + height: 50%; +} +.title { + font-size: 31px; + text-align: center; + margin-top: 50%; +} +``` + +```js +/* xxx.js */ +export default { + data: { + multitext: [ + [1, 2, 3], + [4, 5, 6], + [7, 8, 9], + ], + value: "" + }, + handleChange(data) { + this.value = data.column + "列," + "值为" + data.newValue + ",下标为" + data.newSelected; + }, +} +``` +![picker-view4](figures/picker-view4.gif) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-js/js-components-basic-text.md b/zh-cn/application-dev/reference/arkui-js/js-components-basic-text.md index d3b8dbe68f3073c3cde2cee2c1ad0b85943a1458..61f266a3d790cbdb92721fc1d446d860ba545bde 100644 --- a/zh-cn/application-dev/reference/arkui-js/js-components-basic-text.md +++ b/zh-cn/application-dev/reference/arkui-js/js-components-basic-text.md @@ -76,7 +76,7 @@ ## 示例 -1. +1. ​ ```html
@@ -137,5 +137,5 @@ ``` -![zh-cn_image_0000001167823076](figures/text.png) +![zh-cn_image_0000001167823076](figures/js-text.png) 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 a729e82a2490d80e25295f5f83173831e6fe4765..80e1fced38bfce12740fe9c04130e9748aeaf8dc 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 @@ -1025,7 +1025,7 @@ bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, ```html
- +
``` diff --git a/zh-cn/application-dev/reference/arkui-js/js-components-container-list-item-group.md b/zh-cn/application-dev/reference/arkui-js/js-components-container-list-item-group.md index 1fdb3cbdc86883d35884ff080e716f66407c777c..0982188e5582a0edc675a2fbb1c889ff272cae75 100644 --- a/zh-cn/application-dev/reference/arkui-js/js-components-container-list-item-group.md +++ b/zh-cn/application-dev/reference/arkui-js/js-components-container-list-item-group.md @@ -1,7 +1,7 @@ # list-item-group > **说明:** -> 从API version 4开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 +> 从API version 4开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 <[list](../arkui-js/js-components-container-list.md)>的子组件,用来展示分组,宽度默认充满list组件。 @@ -30,7 +30,7 @@ > **说明:** > -> - 通用属性中的id用来标识一个group。list中相关的函数的入参以及事件的信息皆以此标识一个唯一的group。 +> - 通用属性中的id用来标识一个group。list中相关的函数的入参以及事件的信息皆以此标识一个唯一的group。 ## 样式 @@ -125,48 +125,55 @@ // xxx.js import promptAction from '@ohos.promptAction'; export default { - data: { - direction: 'column', - list: [], - listAdd: [] - }, - onInit() { - this.list = [] - this.listAdd = [] - for (var i = 1; i <= 3; i++) { - var dataItem = { - value: 'GROUP' + i, - }; - this.list.push(dataItem); + data: { + direction: 'column', + list: [], + listAdd: [] + }, + onInit() { + this.list = [] + this.listAdd = [] + for (var i = 1; i <= 3; i++) { + var dataItem = { + value: 'GROUP' + i, + }; + this.list.push(dataItem); + } + }, + collapseOne(e) { + this.$element('mylist').collapseGroup({ + groupid: 'GROUP1' + }) + }, + expandOne(e) { + this.$element('mylist').expandGroup({ + groupid: 'GROUP1' + }) + }, + collapseAll(e) { + this.$element('mylist').collapseGroup({ + groupid: '' + }) + }, + expandAll(e) { + this.$element('mylist').expandGroup({ + groupid: '' + }) + }, + collapse(e) { + promptAction.showToast({ + message: 'Close ' + e.groupid + }) + }, + expand(e) { + promptAction.showToast({ + message: 'Open ' + e.groupid + }) } - }, - collapseOne(e) { - this.$element('mylist').collapseGroup({ - groupid: 'GROUP1' - }) - }, - expandOne(e) { - this.$element('mylist').expandGroup({ - groupid: 'GROUP1' - }) - }, - collapseAll(e) { - this.$element('mylist').collapseGroup() - }, - expandAll(e) { - this.$element('mylist').expandGroup() - }, - collapse(e) { - promptAction.showToast({ - message: 'Close ' + e.groupid - }) - }, - expand(e) { - promptAction.showToast({ - message: 'Open ' + e.groupid - }) - } } + + + ``` ![zh-cn_image_0000001127284978](figures/zh-cn_image_0000001127284978.gif) diff --git a/zh-cn/application-dev/reference/arkui-js/js-components-container-stepper.md b/zh-cn/application-dev/reference/arkui-js/js-components-container-stepper.md index 75c4249b57fe899efe5110456a38cf8948f5dff1..4932696e40bd61e59713be726d9ebbdd246edff5 100644 --- a/zh-cn/application-dev/reference/arkui-js/js-components-container-stepper.md +++ b/zh-cn/application-dev/reference/arkui-js/js-components-container-stepper.md @@ -130,7 +130,7 @@ text { ```js // xxx.js -import prompt from '@system.prompt'; +import prompt from '@ohos.promptAction'; export default { data: { diff --git a/zh-cn/application-dev/reference/arkui-js/js-components-container-tab-content.md b/zh-cn/application-dev/reference/arkui-js/js-components-container-tab-content.md index 1d80f62b21b550d043a24153720a5e9da190dc4d..0ab16c7bdb3d8de0d215e19c8b1b596ea7c51019 100644 --- a/zh-cn/application-dev/reference/arkui-js/js-components-container-tab-content.md +++ b/zh-cn/application-dev/reference/arkui-js/js-components-container-tab-content.md @@ -3,7 +3,7 @@ > **说明:** > 从API version 4开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 -<[tabs](../arkui-js/js-components-container-tabs.md)>的子组件,用来展示tab的内容区,高度默认充满tabs剩余空间,子组件排列方式为横向排列,当作为容器组件的子元素时在主轴方向需要设置tab-content的确定长度,否则无法显示。 +<[tabs](../arkui-js/js-components-container-tabs.md)>的子组件,用来展示tab的内容区,高度默认充满tabs剩余空间,子组件排列方式为横向排列,当作为容器组件的子元素时在主轴方向需要设置tab-content的确定长度,否则无法显示。tab-content组件不支持内容过长时页面的滑动,如需页面滑动,可嵌套List使用。 ## 权限列表 diff --git a/zh-cn/application-dev/reference/arkui-js/js-components-custom-basic-usage.md b/zh-cn/application-dev/reference/arkui-js/js-components-custom-basic-usage.md index bbd00b8c1bf389bc026f2f3617fc3cc70e93cdd4..18cf415472a1b896c485b35bea6dfe5fe0583695 100644 --- a/zh-cn/application-dev/reference/arkui-js/js-components-custom-basic-usage.md +++ b/zh-cn/application-dev/reference/arkui-js/js-components-custom-basic-usage.md @@ -3,7 +3,7 @@ 自定义组件是用户根据业务需求,将已有的组件组合,封装成的新组件,可以在工程中多次调用,从而提高代码的可读性。自定义组件通过element引入到宿主页面,使用方法如下: ```html - +
@@ -12,8 +12,8 @@ 结合if-else使用自定义组件的示例,showComp1为true时显示自定义组件comp1,否则显示comp2: ```html - - + +
@@ -76,7 +76,7 @@ export default { ```html - +
@@ -125,7 +125,7 @@ export default { ```html - +
父组件:{{text}} diff --git a/zh-cn/application-dev/reference/arkui-js/js-components-custom-props.md b/zh-cn/application-dev/reference/arkui-js/js-components-custom-props.md index a384d0cce0f98cbb715089815d29acc5285db440..882d732f5a7e097dcfb573c49b67101a85f2dfcd 100644 --- a/zh-cn/application-dev/reference/arkui-js/js-components-custom-props.md +++ b/zh-cn/application-dev/reference/arkui-js/js-components-custom-props.md @@ -21,7 +21,7 @@ export default { ```html - +
@@ -57,7 +57,7 @@ export default { ```html - +
diff --git a/zh-cn/application-dev/reference/arkui-js/js-components-custom-slot.md b/zh-cn/application-dev/reference/arkui-js/js-components-custom-slot.md index f5bceca1a24068409268c4e600872f24afafcba3..b3d541c6c8473b6a6da0d74348f0f98d97ef39cc 100644 --- a/zh-cn/application-dev/reference/arkui-js/js-components-custom-slot.md +++ b/zh-cn/application-dev/reference/arkui-js/js-components-custom-slot.md @@ -20,7 +20,7 @@ 引用该自定义组件方式如下: ```html - +
父组件中定义的内容 @@ -45,7 +45,7 @@ 引用该自定义组件方式如下: ```html - +
插入第二个插槽中 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 8b4292e8592f2ba22382ebf488ec8dd9e1c263e9..62c15d1718469b8b857c585a4dd1b0b9f4bc3385 100644 --- a/zh-cn/application-dev/reference/arkui-ts/Readme-CN.md +++ b/zh-cn/application-dev/reference/arkui-ts/Readme-CN.md @@ -28,7 +28,6 @@ - [图形变换](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) @@ -43,6 +42,10 @@ - [背景模糊设置](ts-universal-attributes-backgroundBlurStyle.md) - [分布式迁移标识](ts-universal-attributes-restoreId.md) - [前景色设置](ts-universal-attributes-foreground-color.md) + - [图像球面效果设置](ts-universal-attributes-sphericalEffect.md) + - [图像渐亮效果设置](ts-universal-attributes-lightUpEffect.md) + - [图像像素扩展效果设置](ts-universal-attributes-pixelStretchEffect.md) + - [文本通用属性](ts-universal-attributes-text-style.md) - 手势处理 - [绑定手势方法](ts-gesture-settings.md) - 基础手势 @@ -54,6 +57,7 @@ - [SwipeGesture](ts-basic-gestures-swipegesture.md) - [组合手势](ts-combined-gestures.md) - 基础组件 + - [AlphabetIndexer](ts-container-alphabet-indexer.md) - [Blank](ts-basic-components-blank.md) - [Button](ts-basic-components-button.md) - [Checkbox](ts-basic-components-checkbox.md) @@ -100,7 +104,6 @@ - [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) @@ -164,6 +167,7 @@ - [时间选择弹窗](ts-methods-timepicker-dialog.md) - [文本选择弹窗](ts-methods-textpicker-dialog.md) - [菜单](ts-methods-menu.md) +- [自定义组件的生命周期](ts-custom-component-lifecycle.md) - [应用级变量的状态管理](ts-state-management.md) - [像素单位](ts-pixel-units.md) - [枚举说明](ts-appendix-enums.md) diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/LoadingProgress.gif b/zh-cn/application-dev/reference/arkui-ts/figures/LoadingProgress.gif new file mode 100644 index 0000000000000000000000000000000000000000..90d9c7bba27ef616fb6bfdea407358df25ac6f91 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/LoadingProgress.gif differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/align.png b/zh-cn/application-dev/reference/arkui-ts/figures/align.png index ffabc26d3ee59984dda6cb375f8b18bb319b4fc7..5cdeb7cfd622b90a6fe52ef8cc94f187847d05b7 100644 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/align.png and b/zh-cn/application-dev/reference/arkui-ts/figures/align.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/animation.PNG b/zh-cn/application-dev/reference/arkui-ts/figures/animation.PNG deleted file mode 100644 index 92f92e0001a90840d03ebd00e0b0ef736c2a94c8..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/animation.PNG and /dev/null differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/animation.gif b/zh-cn/application-dev/reference/arkui-ts/figures/animation.gif index 6cfbc07fc5122be3ecd69e6b33b6f00c0f676a0f..e1f1e9d8eedba5f4d7e9895fe10c1028cb8e19bd 100644 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/animation.gif and b/zh-cn/application-dev/reference/arkui-ts/figures/animation.gif differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/animation1.PNG b/zh-cn/application-dev/reference/arkui-ts/figures/animation1.PNG deleted file mode 100644 index 98cc1fa8c0537071549fa8185fa14f7ad103e7f8..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/animation1.PNG and /dev/null differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/animation1.gif b/zh-cn/application-dev/reference/arkui-ts/figures/animation1.gif new file mode 100644 index 0000000000000000000000000000000000000000..d4fae00973755cc243e1d48f10acf9ef4b24682e Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/animation1.gif differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/coordinates.png b/zh-cn/application-dev/reference/arkui-ts/figures/coordinates.png new file mode 100644 index 0000000000000000000000000000000000000000..a975e862118c6048cec5981049a5df160444540b Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/coordinates.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/datePicker.gif b/zh-cn/application-dev/reference/arkui-ts/figures/datePicker.gif index b00b7fad991682b2cd81b0afdd149a3b7f73dc49..0d83b0a08128d1e43f3fa633eb72cca66114a3d6 100644 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/datePicker.gif and b/zh-cn/application-dev/reference/arkui-ts/figures/datePicker.gif differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/datePickerLightUp1.png b/zh-cn/application-dev/reference/arkui-ts/figures/datePickerLightUp1.png new file mode 100644 index 0000000000000000000000000000000000000000..120c59b0dcd102d538973fa3c62784d99e93cc17 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/datePickerLightUp1.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/datePickerLightUp2.png b/zh-cn/application-dev/reference/arkui-ts/figures/datePickerLightUp2.png new file mode 100644 index 0000000000000000000000000000000000000000..a2172a8da22332f1ccec1714112e4a229ca36f53 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/datePickerLightUp2.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/drag-drop.gif b/zh-cn/application-dev/reference/arkui-ts/figures/drag-drop.gif new file mode 100644 index 0000000000000000000000000000000000000000..05b0d0a29dfff526df15e64914f77d598124581c Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/drag-drop.gif differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/ifButton.gif b/zh-cn/application-dev/reference/arkui-ts/figures/ifButton.gif new file mode 100644 index 0000000000000000000000000000000000000000..d92e24eadd8b744c17ee098ae876c2e9ef605325 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/ifButton.gif differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/imagespan.png b/zh-cn/application-dev/reference/arkui-ts/figures/imagespan.png new file mode 100644 index 0000000000000000000000000000000000000000..6b0684be4d1e785c4301f97ca50016b0ccd83623 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/imagespan.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/loadProgress.jpeg b/zh-cn/application-dev/reference/arkui-ts/figures/loadProgress.jpeg deleted file mode 100644 index 141bc03c7528681e90fc3ed91b4c05611355e092..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/loadProgress.jpeg and /dev/null differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/progressMask.PNG b/zh-cn/application-dev/reference/arkui-ts/figures/progressMask.PNG new file mode 100755 index 0000000000000000000000000000000000000000..fac3dda28c11979572ff69ed3005be5d40e62b3b Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/progressMask.PNG differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/rating.gif b/zh-cn/application-dev/reference/arkui-ts/figures/rating.gif index 58cab3e9455db71825d0533d5619a2e12f8b0975..fe6a69b71ecd5d8094d2431e39ff9b07ca3852b0 100644 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/rating.gif and b/zh-cn/application-dev/reference/arkui-ts/figures/rating.gif differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/richText.png b/zh-cn/application-dev/reference/arkui-ts/figures/richText.png index 1520a854a9baed9fcc4e50e989bbfb4e83acf487..5d9db6f68aab7954ae1ac31e51f0b1abff7ebd76 100644 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/richText.png and b/zh-cn/application-dev/reference/arkui-ts/figures/richText.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/textInputSpherical1.png b/zh-cn/application-dev/reference/arkui-ts/figures/textInputSpherical1.png new file mode 100644 index 0000000000000000000000000000000000000000..f74c71cb969043be9633db7a9992c68b1be6d184 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/textInputSpherical1.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/textInputSpherical2.png b/zh-cn/application-dev/reference/arkui-ts/figures/textInputSpherical2.png new file mode 100644 index 0000000000000000000000000000000000000000..b4c67f4f18c92adc7a7f9e78d3935ba2c60da40a Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/textInputSpherical2.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/textLightUp1.png b/zh-cn/application-dev/reference/arkui-ts/figures/textLightUp1.png new file mode 100644 index 0000000000000000000000000000000000000000..d696e61fa669c6592e260e3ad0f3206e2cf45074 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/textLightUp1.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/textLightUp2.png b/zh-cn/application-dev/reference/arkui-ts/figures/textLightUp2.png new file mode 100644 index 0000000000000000000000000000000000000000..8674b8af58468eec28e065311b610c290265d882 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/textLightUp2.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/textLightUp3.png b/zh-cn/application-dev/reference/arkui-ts/figures/textLightUp3.png new file mode 100644 index 0000000000000000000000000000000000000000..d22967a38886f445e189451aae173edb2455c478 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/textLightUp3.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/textPixelStretch1.png b/zh-cn/application-dev/reference/arkui-ts/figures/textPixelStretch1.png new file mode 100644 index 0000000000000000000000000000000000000000..bcf4db606d9e10ef6c418474bbaedae96c232436 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/textPixelStretch1.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/textPixelStretch2.png b/zh-cn/application-dev/reference/arkui-ts/figures/textPixelStretch2.png new file mode 100644 index 0000000000000000000000000000000000000000..aca08823440ca1fb14ca9a681c625ed4e392154f Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/textPixelStretch2.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/textPixelStretch3.png b/zh-cn/application-dev/reference/arkui-ts/figures/textPixelStretch3.png new file mode 100644 index 0000000000000000000000000000000000000000..418870d8dce2b5a7c492bdc26193894a57b9b66d Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/textPixelStretch3.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image1_0000001219982725.png b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image1_0000001219982725.png old mode 100644 new mode 100755 diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image2_0000001219982725.PNG b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image2_0000001219982725.PNG index 310eae1cbaec0f37b61787a9cfa6ddf032c887d4..97b4e3e93daf8eb2b3d73a6776b56a4b745f0ba6 100644 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image2_0000001219982725.PNG and b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image2_0000001219982725.PNG differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001174104400.gif b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001174104400.gif index ec293bafaf6cd7204ebb231c4eee7daa504b78c3..da442c6a4f02d281bafff3f9fde8a51c6ebbf932 100644 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001174104400.gif and b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001174104400.gif differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001174422904.jpg b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001174422904.jpg deleted file mode 100644 index bf5c3a49c58818ec9dec43db3c2d4c5e16949a94..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001174422904.jpg and /dev/null differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001174422904.png b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001174422904.png new file mode 100644 index 0000000000000000000000000000000000000000..0bbc2e605057072db375a583813ba69a67de34bf Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001174422904.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001184628104.png b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001184628104.png index ef4a4905fb4c0c1a6559bb622c523282ef01ee27..c334da3c021801a8c3c741bc5d2fbf76bcfe0455 100644 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001184628104.png and b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001184628104.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001219744193.png b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001219744193.png index 17a7767c1f69c12ccfb0c1436110a9e22b848c26..4279bc045cae702953a3b0fd6d0e25450b27d945 100644 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001219744193.png and b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001219744193.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001219982707.gif b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001219982707.gif deleted file mode 100644 index ac096bd0f149b02d46013420a9c323fe8aa5805a..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001219982707.gif and /dev/null differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001219982708.gif b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001219982708.gif new file mode 100644 index 0000000000000000000000000000000000000000..738e50b17cf1c20514f17034ec08bba1cadf2893 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001219982708.gif differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001219982725.png b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001219982725.png index 048fdc4749a41e0675390e66e61b5d63953ed8e1..f5116e56dcaf8e48edc8f1d62a70160d8b84fba0 100644 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001219982725.png and b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001219982725.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001232775585.gif b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001232775585.gif index 070ae9d042d5211b2ccc6c187ec0f87a90d2c963..36e5cf928d08d719eab8bb0c417da0bc23472798 100644 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001232775585.gif and b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001232775585.gif differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001239032420.png b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001239032420.png new file mode 100644 index 0000000000000000000000000000000000000000..faf9e54e927094688fc3d086903d27cc895760f1 Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001239032420.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_000000127777774.png b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_000000127777774.png index 60f430b646b45a3e3b16a9bb024e4a14e48bf4d3..24edbed60b52947c5effbba951a6523582603f30 100644 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_000000127777774.png and b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_000000127777774.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_000000127777775.png b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_000000127777775.png index 60f430b646b45a3e3b16a9bb024e4a14e48bf4d3..24edbed60b52947c5effbba951a6523582603f30 100644 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_000000127777775.png and b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_000000127777775.png differ diff --git a/zh-cn/application-dev/ui/figures/customLayout.png b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001511900496.png similarity index 100% rename from zh-cn/application-dev/ui/figures/customLayout.png rename to zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001511900496.png diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001563060749.png b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001563060749.png new file mode 100644 index 0000000000000000000000000000000000000000..a9b5769ad867f880dbe2b746b15de80cadbf799e Binary files /dev/null and b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_0000001563060749.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_background_blur_style.png b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_background_blur_style.png index e9a7b0e3baa6d48739c2a3cfbc7b5b46600f9c70..9bec842e6d41af8a815ab24ce0897a0b75c8b8c4 100644 Binary files a/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_background_blur_style.png and b/zh-cn/application-dev/reference/arkui-ts/figures/zh-cn_image_background_blur_style.png differ diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-animatorproperty.md b/zh-cn/application-dev/reference/arkui-ts/ts-animatorproperty.md index adfe8558de0cf3cac1ec2cbe908c18c75a11f0ab..4a3f72bfb5d05206e9370adc6c1449de15c24bbe 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-animatorproperty.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-animatorproperty.md @@ -6,20 +6,21 @@ > > 从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 - animation(value: {duration?: number, tempo?: number, curve?: string | Curve | ICurve, delay?:number, iterations: number, playMode?: PlayMode, onFinish?: () => void}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 名称 | 参数类型 | 必填 | 描述 | | ---------- | ------------------------------------------| ---- | ------------------------------------------------------------ | -| duration | number | 否 | 设置动画时长。单位为毫秒,默认动画时长为1000毫秒。
默认值:1000 | -| tempo | number | 否 | 动画播放速度。数值越大,动画播放速度越快,数值越小,播放速度越慢
值为0时,表示不存在动画。
默认值:1 | -| curve | string \| [Curve](ts-appendix-enums.md#curve) \| ICurve9+ | 否 | 设置动画曲线。默认曲线为线性。
默认值:Curve.Linear | -| delay | number | 否 | 设置动画延迟执行的时长。单位为毫秒,默认不延时播放。
默认值:0 | -| iterations | number | 否 | 设置播放次数。默认播放一次,设置为-1时表示无限次播放。
默认值:1 | -| playMode | [PlayMode](ts-appendix-enums.md#playmode) | 否 | 设置动画播放模式,默认播放完成后重头开始播放。
默认值:PlayMode.Normal | -| onFinish | () => void | 否 | 状态回调,动画播放完成时触发。 | +| duration | number | 否 | 设置动画时长。
默认值:1000
单位:毫秒
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
- 在ArkTS卡片上最大动画持续时间为1000毫秒。
- 设置小于1的值时按0处理。
- 设置浮点型类型的值时,向下取整;设置值为1.2,按照1处理。 | +| tempo | number | 否 | 动画播放速度。数值越大,动画播放速度越快,数值越小,播放速度越慢。
值为0时,表示不存在动画。
默认值:1
**说明:**
当设置小于1的值时按值为1处理。 | +| curve | string \| [Curve](ts-appendix-enums.md#curve) \| ICurve9+ | 否 | 设置动画曲线。默认曲线为线性。
默认值:Curve.Linear
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| delay | number | 否 | 设置动画延迟执行的时长。单位为毫秒,默认不延时播放。
默认值:0
取值范围:[0, +∞)
**说明:**
当设置的值小于1时按0处理。设置浮点型类型的值时,向下取整。例如,设置值为1.2,按照1处理。 | +| iterations | number | 否 | 设置播放次数。
默认值:1
取值范围:[-1, +∞)
**说明:**
设置为-1时表示无限次播放。设置为0时表示无动画效果。 | +| playMode | [PlayMode](ts-appendix-enums.md#playmode) | 否 | 设置动画播放模式,默认播放完成后重头开始播放。
默认值:PlayMode.Normal
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| onFinish | () => void | 否 | 状态回调,动画播放完成时触发。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
当iterations设置为-1时,动画效果无限循环不会停止,所以不会触发此回调。 | ## 示例 @@ -36,11 +37,11 @@ struct AttrAnimationExample { build() { Column() { - Button('change width and height') + Button('change size') .onClick(() => { if (this.flag) { - this.widthSize = 100 - this.heightSize = 50 + this.widthSize = 150 + this.heightSize = 60 } else { this.widthSize = 250 this.heightSize = 100 @@ -66,8 +67,8 @@ struct AttrAnimationExample { duration: 1200, curve: Curve.Friction, delay: 500, - iterations: -1, // 设置-1表示动画无限循环 - playMode: PlayMode.AlternateReverse + iterations: -1, // 设置-1表示动画无限循环 + playMode: PlayMode.Alternate }) }.width('100%').margin({ top: 20 }) } diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-appendix-enums.md b/zh-cn/application-dev/reference/arkui-ts/ts-appendix-enums.md index 01bd2021d811cf64c04b249a092e45ba3c45a858..8d436ee457008f7271c4cf479c2f69fc6c145261 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-appendix-enums.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-appendix-enums.md @@ -2,6 +2,8 @@ ## Color +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 颜色名称 | 颜色值 | 颜色示意 | | ------------------------ | -------- | ------------------------------------------------------------ | | Black | 0x000000 | ![zh-cn_image_0000001219864153](figures/zh-cn_image_0000001219864153.png) | @@ -19,6 +21,8 @@ ## ImageFit +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | --------- | ------------------------------------------------------------ | | Contain | 保持宽高比进行缩小或者放大,使得图片完全显示在显示边界内。 | @@ -30,6 +34,8 @@ ## BorderStyle +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------ | ----------------------------------------------- | | Dotted | 显示为一系列圆点,圆点半径为borderWidth的一半。 | @@ -38,6 +44,8 @@ ## LineJoinStyle +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ----- | -------------------- | | Bevel | 使用斜角连接路径段。 | @@ -75,6 +83,8 @@ ## Curve +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------------------- | ------------------------------------------------------------ | | Linear | 表示动画从头到尾的速度都是相同的。 | @@ -93,6 +103,8 @@ ## AnimationStatus +从API version 10开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------- | ------------------ | | Initial | 动画初始状态。 | @@ -102,6 +114,8 @@ ## FillMode +从API version 10开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | --------- | ------------------------------------------------------------ | | None | 动画未执行时不会将任何样式应用于目标,动画播放完成之后恢复初始默认状态。 | @@ -111,6 +125,8 @@ ## PlayMode +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ---------------- | ------------------------------------------------------------ | | Normal | 动画按正常播放。 | @@ -136,13 +152,13 @@ | 名称 | 描述 | | -------- | ---------------------- | -| Top | 竖直方向上边缘 | -| Center(deprecated) | 竖直方向居中位置
从API version 9开始废弃 | -| Bottom | 竖直方向下边缘 | +| Top | 竖直方向上边缘
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| Center(deprecated) | 竖直方向居中位置
从API version 9开始废弃 | +| Bottom | 竖直方向下边缘
从API version 9开始,该接口支持在ArkTS卡片中使用。 | | Baseline(deprecated) | 交叉轴方向文本基线位置
从API version 9开始废弃 | -| Start | 水平方向起始位置 | -| Middle(deprecated) | 水平方向居中位置
从API version 9开始废弃 | -| End | 水平方向末尾位置 | +| Start | 水平方向起始位置
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| Middle(deprecated) | 水平方向居中位置
从API version 9开始废弃 | +| End | 水平方向末尾位置
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## Week @@ -158,6 +174,8 @@ ## Direction +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ---- | ---------------------- | | Ltr | 元素从左到右布局。 | @@ -166,6 +184,8 @@ ## BarState +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ---- | -------------------------------- | | Off | 不显示。 | @@ -174,6 +194,8 @@ ## EdgeEffect +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------ | ------------------------------------------------------------ | | Spring | 弹性物理动效,滑动到边缘后可以根据初始速度或通过触摸事件继续滑动一段距离,松手后回弹。 | @@ -182,6 +204,8 @@ ## Alignment +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ----------- | ---------------- | | TopStart | 顶部起始端。 | @@ -196,11 +220,13 @@ ## TransitionType +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------ | -------------------------------------------------- | | All | 指定当前的Transition动效生效在组件的所有变化场景。 | -| Insert | 指定当前的Transition动效生效在组件的插入场景。 | -| Delete | 指定当前的Transition动效生效在组件的删除场景。 | +| Insert | 指定当前的Transition动效生效在组件的插入显示场景。 | +| Delete | 指定当前的Transition动效生效在组件的删除隐藏场景。 | ## RelateType @@ -211,6 +237,8 @@ ## Visibility +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------- | -------------------------------- | | Hidden | 隐藏,但参与布局进行占位。 | @@ -219,6 +247,8 @@ ## LineCapStyle +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------ | -------------------- | | Butt | 线条两端为平行线,不额外扩展。 | @@ -227,6 +257,8 @@ ## Axis +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ---------- | ------------ | | Vertical | 方向为纵向。 | @@ -234,6 +266,8 @@ ## HorizontalAlign +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------ | ------------------------ | | Start | 按照语言方向起始端对齐。 | @@ -242,6 +276,8 @@ ## FlexAlign +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------------ | ------------------------------------------------------------ | | Start | 元素在主轴方向首端对齐,第一个元素与行首对齐,同时后续的元素与前一个对齐。 | @@ -253,17 +289,21 @@ ## ItemAlign +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | -------- | ------------------------------------------------------------ | -| Auto | 使用Flex容器中默认配置。 | -| Start | 元素在Flex容器中,交叉轴方向首部对齐。 | -| Center | 元素在Flex容器中,交叉轴方向居中对齐。 | -| End | 元素在Flex容器中,交叉轴方向底部对齐。 | -| Stretch | 元素在Flex容器中,交叉轴方向拉伸填充,在未设置尺寸时,拉伸到容器尺寸。 | -| Baseline | 元素在Flex容器中,交叉轴方向文本基线对齐。 | +| Auto | 使用Flex、GridRow容器中默认配置。 | +| Start | 元素在Flex、GridRow容器中,交叉轴方向首部对齐。 | +| Center | 元素在Flex、GridRow容器中,交叉轴方向居中对齐。 | +| End | 元素在Flex、GridRow容器中,交叉轴方向底部对齐。 | +| Stretch | 元素在Flex、GridRow容器中,交叉轴方向拉伸填充。容器为Flex且设置Wrap为FlexWrap.Wrap或FlexWrap.WrapReverse时,元素拉伸到与当前行/列交叉轴长度最长的元素尺寸。其余情况在元素未设置尺寸时,拉伸到容器尺寸。 | +| Baseline | 元素在Flex、GridRow容器中,交叉轴方向文本基线对齐。 | ## FlexDirection +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------------- | ------------------------------ | | Row | 主轴与行方向一致作为布局模式。 | @@ -273,6 +313,8 @@ ## FlexWrap +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ----------- | ------------------------------------------------- | | NoWrap | Flex容器的元素单行/列布局,子项不允许超出容器。 | @@ -281,6 +323,8 @@ ## VerticalAlign +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------ | ------------------------ | | Top | 顶部对齐。 | @@ -289,6 +333,8 @@ ## ImageRepeat +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | -------- | -------------------------- | | X | 只在水平轴上重复绘制图片。 | @@ -298,6 +344,8 @@ ## ImageSize +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 类型 | 描述 | | ------- | ------------------------------------------------------------ | | Cover | 默认值,保持宽高比进行缩小或者放大,使得图片两边都大于或等于显示边界。 | @@ -306,6 +354,8 @@ ## GradientDirection +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ----------- | ---------- | | Left | 从右向左。 | @@ -327,6 +377,8 @@ ## FontStyle +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------ | ---------------- | | Normal | 标准的字体样式。 | @@ -334,6 +386,8 @@ ## FontWeight +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------- | -------------- | | Lighter | 字体较细。 | @@ -345,22 +399,30 @@ ## TextAlign -| 名称 | 描述 | -| ------ | -------------- | -| Start | 水平对齐首部。 | -| Center | 水平居中对齐。 | -| End | 水平对齐尾部。 | +从API version 9开始,该接口支持在ArkTS卡片中使用。 + +| 名称 | 描述 | +| --------------------- | -------------- | +| Start | 水平对齐首部。 | +| Center | 水平居中对齐。 | +| End | 水平对齐尾部。 | +| Justify10+ | 双端对齐。 | ## TextOverflow -| 名称 | 描述 | -| -------- | -------------------------------------- | -| Clip | 文本超长时进行裁剪显示。 | -| Ellipsis | 文本超长时显示不下的文本用省略号代替。 | -| None | 文本超长时不进行裁剪。 | +从API version 9开始,该接口支持在ArkTS卡片中使用。 + +| 名称 | 描述 | +| --------------------- | -------------------------------------- | +| None | 文本超长时不进行裁剪。 | +| Clip | 文本超长时进行裁剪显示。 | +| Ellipsis | 文本超长时显示不下的文本用省略号代替。 | +| Marquee10+ | 文本超长时以跑马灯的方式展示。 | ## TextDecorationType +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ----------- | ------------------ | | Underline | 文字下划线修饰。 | @@ -370,6 +432,8 @@ ## TextCase +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | --------- | -------------------- | | Normal | 保持文本原有大小写。 | @@ -411,6 +475,8 @@ ## CopyOptions9+ +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ----------- | -------------------- | | None | 不支持复制。 | @@ -425,3 +491,40 @@ | Block | 自身节点响应触摸事件的命中测试,但阻止被该节点屏蔽的子节点和其他节点的命中测试。 | | Transparent | 自身节点和子节点响应触摸事件的命中测试,并允许对被该节点屏蔽的其他节点进行命中测试。 | | None | 自身节点不会响应触摸事件的命中测试,但子节点会对触摸事件进行命中测试。 | + +## BlurStyle9+ + +该接口支持在ArkTS卡片中使用。 + +| 名称 | 描述 | +| ------- | ---------- | +| Thin | 轻薄材质模糊。 | +| Regular | 普通厚度材质模糊。 | +| Thick | 厚材质模糊。 | +| BackgroundThin | 近距景深模糊。 | +| BackgroundRegular | 中距景深模糊。 | +| BackgroundThick | 远距景深模糊。 | +| BackgroundUltraThick | 超远距景深模糊。 | + +## ThemeColorMode10+ + +| 名称 | 描述 | +| ------- | ---------- | +| System | 跟随系统深浅色模式。 | +| Light | 固定使用浅色模式。 | +| Dark | 固定使用深色模式。 | + +## AdaptiveColor10+ + +| 名称 | 描述 | +| ------- | ----------- | +| Default | 不使用取色模糊。使用默认的颜色作为蒙版颜色。 | +| Average | 使用取色模糊。将取色区域的颜色平均值作为蒙版颜色。 | + +## TextHeightAdaptivePolicy10+ + +| 名称 | 描述 | +| ----------------------- | ------------------------------------------------ | +| MAX_LINES_FIRST | 设置文本高度自适应方式为以MaxLines优先。 | +| MIN_FONT_SIZE_FIRST | 设置文本高度自适应方式为以缩小字体优先。 | +| LAYOUT_CONSTRAINT_FIRST | 设置文本高度自适应方式为以布局约束(高度)优先。 | 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 6d1d1b49596bbd1dc23c5852b8e471918e5d58cf..891e3964deb2a69acc23c0b6811da9bb2c3dbe16 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 @@ -16,11 +16,13 @@ Blank(min?: number | string) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | | -------- | -------- | -------- | -------- | -| min | number \| string | 否 | 空白填充组件在容器主轴上的最小大小。
默认值:0 | +| min | number \| string | 否 | 空白填充组件在容器主轴上的最小大小。
默认值:0
**说明:**
不支持设置百分比。负值使用默认值。当最小值大于容器可用空间时,使用最小值作为自身大小并超出容器。 | ## 属性 @@ -28,10 +30,14 @@ Blank(min?: number | string) | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| color | [ResourceColor](ts-types.md#resourcecolor) | 设置空白填充的填充颜色。 | +| color | [ResourceColor](ts-types.md#resourcecolor) | 设置空白填充的填充颜色。

默认值:Color.Transparent
从API version 9开始,该接口支持在ArkTS卡片中使用。 | + +## 事件 +支持[通用事件](ts-universal-events-click.md)。 ## 示例 + ### 示例1 Blank组件在横竖屏占满空余空间效果。 ```ts 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 3579acfe447e6c34457ea9337d0502357c9d5a43..b5c9301887044d2bd3c4d709e12f02efefe4b1d3 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 @@ -16,34 +16,42 @@ **方法1:** Button(options?: {type?: ButtonType, stateEffect?: boolean}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | | ----------- | ---------- | ------| --------------------------------- | | type | ButtonType | 否 | 描述按钮显示样式。
默认值:ButtonType.Capsule | -| stateEffect | boolean | 否 | 按钮按下时是否开启按压态显示效果,当设置为false时,按压效果关闭。
默认值:true | - +| stateEffect | boolean | 否 | 按钮按下时是否开启按压态显示效果,当设置为false时,按压效果关闭。
默认值:true
**说明:**
当开启按压态显示效果,开发者设置状态样式时,会基于状态样式设置完成后的背景色再进行颜色叠加。 | **方法2:** Button(label?: ResourceStr, options?: { type?: ButtonType, stateEffect?: boolean }) 使用文本内容创建相应的按钮组件,此时Button无法包含子组件。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | | ------- | ----------------------------------- | ---- | ------------- | -| label | [ResourceStr](ts-types.md#resourcestr) | 否 | 按钮文本内容。 | +| label | [ResourceStr](ts-types.md#resourcestr) | 否 | 按钮文本内容。 | | options | { type?: ButtonType, stateEffect?: boolean } | 否 | 见方法1参数说明。 | - ## 属性 +除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性: + | 名称 | 参数类型 | 描述 | | ----------- | ----------- | --------------------------------- | -| type | ButtonType | 设置Button样式。
默认值:ButtonType.Capsule | -| stateEffect | boolean | 按钮按下时是否开启按压态显示效果,当设置为false时,按压效果关闭。
默认值:true | +| type | ButtonType | 设置Button样式。
默认值:ButtonType.Capsule
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| stateEffect | boolean | 按钮按下时是否开启按压态显示效果,当设置为false时,按压效果关闭。
默认值:true
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| labelStyle10+ | [LabelStyle](#labelstyle10对象说明) | 设置Button组件label文本和字体的样式。 | ## ButtonType枚举说明 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------- | ------------------ | | Capsule | 胶囊型按钮(圆角默认为高度的一半)。 | @@ -51,14 +59,29 @@ | Normal | 普通按钮(默认不带圆角)。 | > **说明:** -> - 按钮圆角通过[通用属性borderRadius](ts-universal-attributes-border.md)设置(不支持通过border接口设置圆角),且只支持设置一个相同的圆角。 -> - 当按钮类型为Capsule时,borderRadius设置不生效,按钮圆角始终为高度的一半。 +> - 按钮圆角通过[通用属性borderRadius](ts-universal-attributes-border.md)设置(不支持通过border接口设置圆角),且只支持设置参数为[Length](ts-types.md#length)的圆角。 +> - 当按钮类型为Capsule时,borderRadius设置不生效,按钮圆角始终为宽、高中较小值的一半。 > - 当按钮类型为Circle时,borderRadius即为按钮半径,若未设置borderRadius按钮半径则为宽、高中较小值的一半。 > - 按钮文本通过[通用文本样式](ts-universal-attributes-text-style.md)进行设置。 +> - 设置[颜色渐变](ts-universal-attributes-gradient-color.md)需先设置[backgroundColor](ts-universal-attributes-background.md)为透明色。 + +## LabelStyle10+对象说明 +| 名称 | 参数类型 | 必填 | 描述 | +| -------------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| overflow | [TextOverflow](ts-appendix-enums.md#textoverflow) | 否 | 设置Label文本超长时的显示方式。文本截断是按字截断。例如,英文以单词为最小单位进行截断,若需要以字母为单位进行截断,可在字母间添加零宽空格。 | +| maxLines | number | 否 | 设置Label文本的最大行数。默认情况下,文本是自动折行的,如果指定此参数,则文本最多不会超过指定的行。如果有多余的文本,可以通过textOverflow来指定截断方式。 | +| minFontSize | number \| [ResourceStr](ts-types.md#resourcestr) | 否 | 设置Label文本最小显示字号。需配合maxFontSize以及maxLines或布局大小限制使用。 | +| maxFontSize | number \| [ResourceStr](ts-types.md#resourcestr) | 否 | 设置Label文本最大显示字号。需配合minFontSize以及maxLines或布局大小限制使用。 | +| heightAdaptivePolicy | [TextHeightAdaptivePolicy](ts-appendix-enums.md#TextHeightAdaptivePolicy10) | 否 | 设置Label文本自适应高度的方式。 | +| font | [Font](ts-types.md#Font) | 否 | 设置Label文本字体样式。 | +## 事件 +支持[通用事件](ts-universal-events-click.md)。 ## 示例 +### 示例1 + ```ts // xxx.ets @Entry @@ -68,7 +91,13 @@ struct ButtonExample { Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start, justifyContent: FlexAlign.SpaceBetween }) { Text('Normal button').fontSize(9).fontColor(0xCCCCCC) Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.SpaceBetween }) { - Button('OK', { type: ButtonType.Normal, stateEffect: true }).borderRadius(8).backgroundColor(0x317aff).width(90) + Button('OK', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(90) + .onClick(() => { + console.log('ButtonType.Normal') + }) Button({ type: ButtonType.Normal, stateEffect: true }) { Row() { LoadingProgress().width(20).height(20).margin({ left: 12 }).color(0xFFFFFF) @@ -109,4 +138,34 @@ struct ButtonExample { } ``` -![button](figures/button.gif) \ No newline at end of file +![button](figures/button.gif) + +### 示例2 + +```ts +// xxx.ets +@Entry +@Component +struct SwipeGestureExample { + @State count: number = 0 + + build() { + Column() { + Text(`${this.count}`) + .fontSize(30) + .onClick(() => { + this.count++ + }) + if (this.count <= 0) { + Button('count is negative').fontSize(30).height(50) + } else if (this.count % 2 === 0) { + Button('count is even').fontSize(30).height(50) + } else { + Button('count is odd').fontSize(30).height(50) + } + }.height('100%').width('100%').justifyContent(FlexAlign.Center) + } +} +``` + +![ifButton](figures/ifButton.gif) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-checkbox.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-checkbox.md index 9d1669047af57332bf85b5a6122bd183ed2b49e7..1a516dd67748cfb992494ff59ce149b982bc3828 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-checkbox.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-checkbox.md @@ -14,12 +14,14 @@ Checkbox(options?: {name?: string, group?: string }) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | | --------| --------| ------ | -------- | | name | string | 否 | 多选框名称。 | -| group | string | 否 | 多选框的群组名称。 | +| group | string | 否 | 多选框的群组名称。
**说明:**
未配合使用CheckboxGroup组件时,此值无用。 | ## 属性 @@ -28,16 +30,26 @@ Checkbox(options?: {name?: string, group?: string }) | 名称 | 参数类型 | 描述 | | ------------- | ------- | -------- | -| select | boolean | 设置多选框是否选中。
默认值:false | -| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | 设置多选框选中状态颜色。 | +| select | boolean | 设置多选框是否选中。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | 设置多选框选中状态颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| unselectedColor10+ | [ResourceColor](ts-types.md#resourcecolor) | 设置多选框非选中状态边框颜色。 | +| mark10+ | [MarkStyle](#markstyle10对象说明) | 多选框内部图标样式。 | ## 事件 支持[通用事件](ts-universal-events-click.md)外,还支持以下事件: -| 名称 | 功能描述 | -| ----------| -------- | -|onChange(callback: (value: boolean) => void) | 当选中状态发生变化时,触发该回调。(只有手动触发且Checkbox状态改变时才会触发onChange回调)
- value为true时,表示已选中。
- value为false时,表示未选中。 | +| 名称 | 功能描述 | +| -------------------------------------------- | ------------------------------------------------------------ | +| onChange(callback: (value: boolean) => void) | 当选中状态发生变化时,触发该回调。(只有手动触发且Checkbox状态改变时才会触发onChange回调)
- value为true时,表示已选中。
- value为false时,表示未选中。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | + +## MarkStyle10+对象说明 + +| 名称 | 类型 | 必填 | 默认值 | 描述 | +| ----------- | ------------------------------------------ | ---- | ----------- | ------------------------------------------------------------ | +| strokeColor | [ResourceColor](ts-types.md#resourcecolor) | 否 | Color.White | 内部图标颜色。 | +| size | number \| string | 否 | - | 内部图标大小,单位vp。默认大小与多选框组件宽度设置值一致。
不支持百分比形式设置。当设置为非法值时,按照默认值处理。 | +| strokeWidth | number \| string | 否 | 2 | 内部图标粗细,单位vp。不支持百分比形式设置。当设置为非法值时,按照默认值处理。 | ## 示例 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 df19c5e7c4a4781734ad174552f239fe63219a81..3358043333bb34ad64e4f9418811671816a1135d 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 @@ -16,9 +16,9 @@ CheckboxGroup(options?: { group?: string }) 创建多选框群组,可以控制群组内的Checkbox全选或者不全选,group值相同的Checkbox和CheckboxGroup为同一群组。 -**参数:** - +从API version 9开始,该接口支持在ArkTS卡片中使用。 +**参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | | -------- | -------- | -------- | -------- | @@ -30,8 +30,10 @@ CheckboxGroup(options?: { group?: string }) | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| selectAll | boolean | 设置是否全选。
默认值:false,若同组的Checkbox显式设置select,则Checkbox的优先级高。 | -| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | 设置被选中或部分选中状态的颜色。 | +| selectAll | boolean | 设置是否全选。
默认值:false,若同组的[Checkbox](ts-basic-components-checkbox.md)设置了select属性,则Checkbox的优先级高。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
若同组的[Checkbox](ts-basic-components-checkbox.md)显式设置了select属性,则Checkbox的优先级高。 | +| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | 设置被选中或部分选中状态的颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| unselectedColor10+ | [ResourceColor](ts-types.md#resourcecolor) | 设置非选中状态边框颜色。 | +| mark10+ | [MarkStyle](#markstyle10对象说明) | 多选框内部图标样式。 | ## 事件 @@ -39,9 +41,12 @@ CheckboxGroup(options?: { group?: string }) | 名称 | 功能描述 | | -------- | -------- | -| onChange (callback: (event: [CheckboxGroupResult](#checkboxgroupresult对象说明)) => void ) |CheckboxGroup的选中状态或群组内的Checkbox的选中状态发生变化时,触发回调。(只有手动触发且Checkbox或CheckboxGroup状态改变时才会触发onChange回调)| +| onChange (callback: (event: [CheckboxGroupResult](#checkboxgroupresult对象说明)) => void ) |CheckboxGroup的选中状态或群组内的Checkbox的选中状态发生变化时,触发回调。(只有手动触发且Checkbox或CheckboxGroup状态改变时才会触发onChange回调)
从API version 9开始,该接口支持在ArkTS卡片中使用。| ## CheckboxGroupResult对象说明 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 类型 | 描述 | | ------ | ------ | ------- | | name | Array<string> | 群组内所有被选中的多选框名称。 | @@ -49,12 +54,21 @@ CheckboxGroup(options?: { group?: string }) ## SelectStatus枚举说明 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ----- | -------------------- | | All | 群组多选择框全部选择。 | | Part | 群组多选择框部分选择。 | | None | 群组多选择框全部没有选择。 | +## MarkStyle10+对象说明 + +| 名称 | 类型 | 必填 | 默认值 | 描述 | +| ----------- | ------------------------------------------ | ---- | ----------- | ------------------------------------------------------------ | +| strokeColor | [ResourceColor](ts-types.md#resourcecolor) | 否 | Color.White | 内部图标颜色。 | +| size | number \| string | 否 | - | 内部图标大小,单位vp。默认大小与多选框群组组件宽度设置值一致。
不支持百分比形式设置。当设置为非法值时,按照默认值处理。 | +| strokeWidth | number \| string | 否 | 2 | 内部图标粗细,单位vp。不支持百分比形式设置。当设置为非法值时,按照默认值处理。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md index 49309776f39130ac5b3641563ba7826615c810b6..647e934cecd29e52ec55630de50f0310f01e267a 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-datapanel.md @@ -18,6 +18,8 @@ DataPanel(options:{values: number[], max?: number, type?: DataPanelType}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -28,12 +30,59 @@ DataPanel(options:{values: number[], max?: number, type?: DataPanelType}) ## DataPanelType枚举说明 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | -------| ------------ | | Line | 线型数据面板。 | | Circle | 环形数据面板。 | +## 属性 + +除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性: + + +| 名称 | 参数类型 | 必填 | 描述 | +| ------------- | ------- | ---- | -------- | +| closeEffect | boolean | 是 | 关闭数据占比图表旋转动效。
默认值:false。| +| valueColors10+ | Array<[ResourceColor](ts-types.md#resourcecolor) \| [LinearGradient](#lineargradient10)> | 是 | 各数据段颜色,ResourceColor为纯色,LinearGradient为渐变色。| +| trackBackgroundColor10+ | [ResourceColor](ts-types.md#resourcecolor) | 是 | 底板颜色。| +| strokeWidth10+ | [Length](ts-types.md#Length) | 是 | 圆环粗细。 | +| trackShadow10+ | [DataPanelShadowOption](#datapanelshadowoption10) | 是 | 投影样式,不设置为不开启投影。| + + +## DataPanelShadowOption10+ +| 名称 | 参数类型 | 必填 | 描述 | +| ------------- | ------- | ---- | -------- | +| radius | number \| [Resource](ts-types.md#resource类型) | 否 | 阴影模糊半径。
默认值:5vp。 | +| colors | Array<[ResourceColor](ts-types.md#resourcecolor) \| [LinearGradient](#lineargradient10)> | 否 | 各数据段阴影的颜色。
默认值:与valueColors值相同。 | +| offsetX | number \| [Resource](ts-types.md#resource类型) | 否 | X轴的偏移量。
默认值:5vp。 | +| offsetY | number \| [Resource](ts-types.md#resource类型) | 否 | Y轴的偏移量。
默认值:5vp。 | + +## LinearGradient10+ + +线性渐变颜色描述。 + +LinearGradient(colorStops: ColorStop[]) + +| 名称 | 参数类型 | 必填 | 描述 | +| ------------- | ------- | ---- | -------- | +| colorStops | [ColorStop](#colorstop10)[] | 是 | 存储渐变颜色和渐变点。| + + +## ColorStop10+ + +颜色断点类型,用于描述渐进色颜色断点。 + +| 名称 | 参数类型 | 必填 | 描述 | +| ------------- | ------- | ---- | -------- | +| color | [ResourceColor](ts-types.md#resourcecolor) | 是 | 颜色值。| +| offset | [Length](ts-types.md#Length) | 是 | 渐变色断点(0~1之间的比例值)。| + + + ## 示例 ```ts diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-datepicker.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-datepicker.md index 23ee9d666a1cb8a15ca1edb1db80957ed70c23f6..d21ed937c49f9d90109c24aca11514a46424fb4a 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-datepicker.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-datepicker.md @@ -1,10 +1,10 @@ # DatePicker -选择日期的滑动选择器组件 +日期选择器组件,用于根据指定日期范围创建日期滑动选择器。 > **说明:** > -> 该组件从API Version 8开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 +> 该组件从API Version 8开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 ## 子组件 @@ -20,33 +20,45 @@ DatePicker(options?: {start?: Date, end?: Date, selected?: Date}) **参数:** -| 参数名 | 参数类型 | 必填 | 参数描述 | -| -------- | -------- | ------------- | -------- | -| start | Date | 否 | 指定选择器的起始日期。
默认值:Date('1970-1-1') | -| end | Date | 否 | 指定选择器的结束日期。
默认值:Date('2100-12-31') | -| selected | Date | 否 | 设置选中项的日期。
默认值:当前系统日期 | - +| 参数名 | 参数类型 | 必填 | 参数描述 | +| -------- | ---- | ---- | -------------------------------------- | +| start | Date | 否 | 指定选择器的起始日期。
默认值:Date('1970-1-1') | +| end | Date | 否 | 指定选择器的结束日期。
默认值:Date('2100-12-31') | +| selected | Date | 否 | 设置选中项的日期。
默认值:当前系统日期 | ## 属性 -| 名称 | 参数类型 | 描述 | -| ------| -------------- | -------- | -| lunar | boolean | 日期是否显示农历。
- true:展示农历。
- false:不展示农历。
默认值:false | +除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性: + +| 名称 | 参数类型 | 描述 | +| -------------------------------- | ---------------------------------------- | ---------------------------------------- | +| lunar | boolean | 日期是否显示农历。
- true:展示农历。
- false:不展示农历。
默认值:false | +| disappearTextStyle10+ | [PickerTextStyle](#pickertextstyle10类型说明) | 设置所有选项中最上和最下两个选项的文本颜色、字号、字体粗细。 | +| textStyle10+ | [PickerTextStyle](#pickertextstyle10类型说明) | 设置所有选项中除了最上、最下及选中项以外的文本颜色、字号、字体粗细。 | +| selectedTextStyle10+ | [PickerTextStyle](#pickertextstyle10类型说明) | 设置选中项的文本颜色、字号、字体粗细。 | +## PickerTextStyle10+类型说明 + +| 参数名 | 参数类型 | 必填 | 参数描述 | +| ----- | ---------------------------------------- | ---- | ------------------------- | +| color | [ResourceColor](ts-types.md#resourcecolor) | 否 | 文本颜色。 | +| font | [Font](ts-types.md#font) | 否 | 文本样式,picker只支持字号、字体粗细的设置。 | ## 事件 -| 名称 | 功能描述 | -| -------- | -------- | +除支持[通用事件](ts-universal-events-click.md)外,还支持以下事件: + +| 名称 | 功能描述 | +| ---------------------------------------- | ----------- | | onChange(callback: (value: DatePickerResult) => void) | 选择日期时触发该事件。 | ## DatePickerResult对象说明 -| 名称 | 参数类型 | 描述 | -| -------- | -------- | -------- | -| year | number | 选中日期的年。 | +| 名称 | 参数类型 | 描述 | +| ----- | ------ | --------------------------- | +| year | number | 选中日期的年。 | | month | number | 选中日期的月(0~11),0表示1月,11表示12月。 | -| day | number | 选中日期的日。 | +| day | number | 选中日期的日。 | ## 示例 @@ -63,7 +75,7 @@ struct DatePickerExample { build() { Column() { Button('切换公历农历') - .margin({ top: 30 }) + .margin({ top: 30, bottom: 30 }) .onClick(() => { this.isLunar = !this.isLunar }) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-divider.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-divider.md index 46f2ac309214572ce06ddc33505ff882353ff43d..7da2322a170b7cb5d93c45316cfe5bff3fffb22c 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-divider.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-divider.md @@ -16,21 +16,18 @@ Divider() +从API version 9开始,该接口支持在ArkTS卡片中使用。 + ## 属性 除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性: | 名称 | 参数类型 | 描述 | | ----------- | ---------- | ------------------ | -| vertical | boolean | 使用水平分割线还是垂直分割线。false:水平分割线;true:垂直分割线。
默认值:false | -| color | [ResourceColor](ts-types.md#resourcecolor) | 分割线颜色。 | -| strokeWidth | number \| string | 分割线宽度。
默认值:1 | -| lineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | 分割线的端点样式。
默认值:LineCapStyle.Butt | - - -## 事件 - -不支持通用事件。 +| vertical | boolean | 使用水平分割线还是垂直分割线。false:水平分割线;true:垂直分割线。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| color | [ResourceColor](ts-types.md#resourcecolor) | 分割线颜色。
默认值:'\#33182431'
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeWidth | number \| string | 分割线宽度。
默认值:1
单位:vp
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
分割线的宽度不支持百分比设置。优先级低于[通用属性height](ts-universal-attributes-size.md),超过通用属性设置大小时,按照通用属性进行裁切。 | +| lineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | 分割线的端点样式。
默认值:LineCapStyle.Butt
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-formcomponent.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-formcomponent.md index d451d3fd941f47c54577fc54125255a713e35ea7..90a4e4d3d9c2ab1b991dc07d7b6eaa8e5b5ab34b 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-formcomponent.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-formcomponent.md @@ -6,7 +6,7 @@ > > - 该组件从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 > -> - 该组件为卡片组件的使用方,对应提供方的使用参考文档[JS服务卡片UI组件](../js-service-widget-ui/Readme-CN.md)。 +> - 该组件为卡片组件的使用方,对应提供方的使用参考文档[JS服务卡片UI组件](../js-service-widget-ui/js-service-widget-file.md)。 > > - 该组件使用需要具有系统签名。 @@ -108,7 +108,7 @@ struct CardExample { .visibility(Visibility.Visible) .onAcquired((form)=>{ console.log(`form info : ${JSON.stringify(form)}`); - this.fomId = form.id; + this.formId = form.id; }) .onError((err)=>{ console.log(`fail to add form, err: ${JSON.stringify(err)}`); diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-gauge.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-gauge.md index 16884200f16f3521dcd875a035f242050afb282a..8f2609ef6a4828d2703f7066e08036266a107ca9 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-gauge.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-gauge.md @@ -17,6 +17,8 @@ Gauge(options:{value: number, min?: number, max?: number}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -31,16 +33,18 @@ Gauge(options:{value: number, min?: number, max?: number}) | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| value | number | 设置量规图的数据值,可用于动态修改量规图的数据值。
默认值:0 | -| startAngle | number | 设置起始角度位置,时钟0点为0度,顺时针方向为正角度。
默认值:0 | -| endAngle | number | 设置终止角度位置,时钟0点为0度,顺时针方向为正角度。
默认值:360 | -| colors | Array<[ColorStop](#colorstop)> | 设置量规图的颜色,支持分段颜色设置。 | -| strokeWidth | Length | 设置环形量规图的环形厚度。 | +| value | number | 设置量规图的数据值,可用于动态修改量规图的数据值。
默认值:0
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| startAngle | number | 设置起始角度位置,时钟0点为0度,顺时针方向为正角度。
默认值:0
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| endAngle | number | 设置终止角度位置,时钟0点为0度,顺时针方向为正角度。
默认值:360
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| colors | Array<[ColorStop](#colorstop)> | 设置量规图的颜色,支持分段颜色设置。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeWidth | Length | 设置环形量规图的环形厚度。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## ColorStop 颜色断点类型,用于描述渐进色颜色断点。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 类型定义 | 描述 | | --------- | -------------------- | ------------------------------------------------------------ | | ColorStop | [[ResourceColor](ts-types.md#resourcecolor), number] | 描述渐进色颜色断点类型,第一个参数为颜色值,若设置为非颜色类型,则置为黑色。第二个参数为颜色所占比重,若设置为负数或是非数值类型,则将比重置为0,该颜色不显示。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-image.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-image.md index c24c6392c9aed18c90c1a03806dc51ce7ceaa601..d1d6bf93edd65162cffd1c4aa9442cdd297a78ac 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-image.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-image.md @@ -19,36 +19,38 @@ ## 接口 -Image(src: string | PixelMap | Resource) +Image(src: PixelMap | ResourceStr | DrawableDescriptor) 通过图片数据源获取图片,用于后续渲染展示。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** -| 参数名 | 参数类型 | 必填 | 参数描述 | -| ------ | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| src | string\| [PixelMap](../apis/js-apis-image.md#pixelmap7) \| [Resource](ts-types.md#resource类型) | 是 | 图片的数据源,支持本地图片和网络图片。
当使用相对路径引用图片资源时,例如`Image("common/test.jpg")`,不支持跨包/跨模块调用该Image组件,建议使用`$r`方式来管理需全局使用的图片资源。
\- 支持的图片格式包括png、jpg、bmp、svg和gif。
\- 支持`Base64`字符串。格式`data:image/[png\|jpeg\|bmp\|webp];base64,[base64 data]`, 其中`[base64 data]`为`Base64`字符串数据。
\- 支持`datashare://`路径前缀的字符串,用于访问通过data ability提供的图片路径。图片加载前需要申请[媒体库功能相关权限](../../file-management/medialibrary-overview.md#申请媒体库功能相关权限)
\- 支持file:///data/storage路径前缀的字符串,用于读取本应用安装目录下files文件夹下的图片资源。需要保证目录包路径下的文件有可读权限。 | +| 参数名 | 参数类型 | 必填 | 参数描述 | +| ---- | ---------------------------------------- | ---- | ---------------------------------------- | +| src |  [PixelMap](../apis/js-apis-image.md#pixelmap7) \|ResourceStr\| [DrawableDescriptor](../apis/js-apis-arkui-drawableDescriptor.md#drawabledescriptor) | 是 | 图片的数据源,支持本地图片和网络图片。
当使用相对路径引用图片资源时,例如`Image("common/test.jpg")`,不支持跨包/跨模块调用该Image组件,建议使用`$r`方式来管理需全局使用的图片资源。
\- 支持的图片格式包括png、jpg、bmp、svg和gif。
\- 支持`Base64`字符串。格式`data:image/[png\|jpeg\|bmp\|webp];base64,[base64 data]`, 其中`[base64 data]`为`Base64`字符串数据。
\- 支持`datashare://`路径前缀的字符串,用于访问通过data ability提供的图片路径。
\- 支持file:///data/storage路径前缀的字符串,用于读取本应用安装目录下files文件夹下的图片资源。需要保证目录包路径下的文件有可读权限。
\- 支持[DrawableDescriptor](../apis/js-apis-arkui-drawableDescriptor.md#drawabledescriptor)对象
**说明:**
- ArkTS卡片上支持gif图片格式动效,但仅在显示时播放一次。
- ArkTS卡片上不支持`http://`等网络相关路径前缀、`datashare://`路径前缀以及`file://data/storage`路径前缀的字符串
- ArkTS卡片上不支持 [PixelMap](../apis/js-apis-image.md#pixelmap7)类型 | ## 属性 除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性: -| 名称 | 参数类型 | 描述 | -| --------------------- | ------------------------------------------------------- | ------------------------------------------------------------ | -| alt | string \| [Resource](ts-types.md#resource类型) | 加载时显示的占位图,支持本地图片。 | -| objectFit | [ImageFit](ts-appendix-enums.md#imagefit) | 设置图片的缩放类型。
默认值:ImageFit.Cover | -| objectRepeat | [ImageRepeat](ts-appendix-enums.md#imagerepeat) | 设置图片的重复样式。
默认值:ImageRepeat.NoRepeat
**说明:**
svg类型图源不支持该属性。 | -| interpolation | [ImageInterpolation](#imageinterpolation) | 设置图片的插值效果,即减轻低清晰度图片在放大显示的时候出现的锯齿问题,仅针对图片放大插值。
默认值:ImageInterpolation.None
**说明:**
svg类型图源不支持该属性。
PixelMap资源不支持该属性。 | -| renderMode | [ImageRenderMode](#imagerendermode) | 设置图片渲染的模式。
默认值:ImageRenderMode.Original
**说明:**
svg类型图源不支持该属性。 | -| sourceSize | {
width: number,
height: number
} | 设置图片裁剪尺寸,将原始图片解码成pixelMap,指定尺寸的图片,单位为px。
**说明:**
PixelMap资源和SVG图片不支持该属性。 | -| matchTextDirection | boolean | 设置图片是否跟随系统语言方向,在RTL语言环境下显示镜像翻转显示效果。
默认值:false | -| fitOriginalSize | boolean | 图片组件尺寸未设置时,其显示尺寸是否跟随图源尺寸。
默认值:false | -| fillColor | [ResourceColor](ts-types.md#resourcecolor) | 填充颜色。设置的填充颜色会覆盖在图片上。仅对svg图源生效,设置后会替换svg图片的fill颜色。 | -| autoResize | boolean | 是否需要在图片解码过程中对图源做resize操作,该操作会根据显示区域的尺寸决定用于绘制的图源尺寸,有利于减少内存占用。
默认值:true | -| syncLoad8+ | boolean | 设置是否同步加载图片,默认是异步加载。同步加载时阻塞UI线程,不会显示占位图。
默认值:false | -| copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | 设置图片是否可复制(SVG图片不支持复制)。
当copyOption设置为非CopyOptions.None时,支持使用长按、鼠标右击、快捷组合键'CTRL+C'等方式进行复制。
默认值:CopyOptions.None | -| colorFilter9+ | [ColorFilter](ts-types.md#colorfilter9) | 给图像设置颜色滤镜效果。 | -| draggable9+ | boolean | 设置默认拖拽效果。(不能和[onDragStart](ts-universal-events-drag-drop.md)事件同时使用。)
默认值:false | +| 名称 | 参数类型 | 描述 | +| ------------------------ | ---------------------------------------- | ---------------------------------------- | +| alt | string \| [Resource](ts-types.md#resource类型) | 加载时显示的占位图,支持本地图片。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| objectFit | [ImageFit](ts-appendix-enums.md#imagefit) | 设置图片的缩放类型。
默认值:ImageFit.Cover
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| objectRepeat | [ImageRepeat](ts-appendix-enums.md#imagerepeat) | 设置图片的重复样式。
默认值:ImageRepeat.NoRepeat
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
svg类型图源不支持该属性。 | +| interpolation | [ImageInterpolation](#imageinterpolation) | 设置图片的插值效果,即减轻低清晰度图片在放大显示的时候出现的锯齿问题,仅针对图片放大插值。
默认值:ImageInterpolation.None
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
svg类型图源不支持该属性。
PixelMap资源不支持该属性。 | +| renderMode | [ImageRenderMode](#imagerendermode) | 设置图片渲染的模式。
默认值:ImageRenderMode.Original
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
svg类型图源不支持该属性。 | +| sourceSize | {
width: number,
height: number
} | 设置图片裁剪尺寸,将原始图片解码成pixelMap,指定尺寸的图片,单位为px。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
PixelMap资源和SVG图片不支持该属性。 | +| matchTextDirection | boolean | 设置图片是否跟随系统语言方向,在RTL语言环境下显示镜像翻转显示效果。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| fitOriginalSize | boolean | 图片组件尺寸未设置时,其显示尺寸是否跟随图源尺寸。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| fillColor | [ResourceColor](ts-types.md#resourcecolor) | 填充颜色。设置的填充颜色会覆盖在图片上。仅对svg图源生效,设置后会替换svg图片的fill颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| autoResize | boolean | 是否需要在图片解码过程中对图源做resize操作,该操作会根据显示区域的尺寸决定用于绘制的图源尺寸,有利于减少内存占用。
默认值:true
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| syncLoad8+ | boolean | 设置是否同步加载图片,默认是异步加载。同步加载时阻塞UI线程,不会显示占位图。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | 设置图片是否可复制(SVG图片不支持复制)。
当copyOption设置为非CopyOptions.None时,支持使用长按、鼠标右击、快捷组合键'CTRL+C'等方式进行复制。
默认值:CopyOptions.None
该接口支持在ArkTS卡片中使用。 | +| colorFilter9+ | [ColorFilter](ts-types.md#colorfilter9) | 给图像设置颜色滤镜效果。
该接口支持在ArkTS卡片中使用。 | +| draggable9+ | boolean | 设置默认拖拽效果。(不能和[onDragStart](ts-universal-events-drag-drop.md)事件同时使用。)
默认值:false
该接口支持在ArkTS卡片中使用。 | > **说明:** > @@ -57,6 +59,8 @@ Image(src: string | PixelMap | Resource) ### ImageInterpolation +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------ | ------------------------- | | None | 不使用插值图片数据。 | @@ -66,6 +70,8 @@ Image(src: string | PixelMap | Resource) ### ImageRenderMode +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | -------- | --------------------- | | Original | 按照原图进行渲染,包括颜色。 | @@ -75,11 +81,11 @@ Image(src: string | PixelMap | Resource) 除支持[通用事件](ts-universal-events-click.md)外,还支持以下事件: -| 名称 | 功能描述 | -| ------------------------------------------------------------ | ------------------------------------------------------------ | -| onComplete(callback: (event?: { width: number, height: number, componentWidth: number,
 componentHeight: number, loadingStatus: number }) => void) | 图片成功加载时触发该回调,返回成功加载的图片尺寸。
- width:图片的宽,单位为像素。
- height:图片的高,单位为像素。
- componentWidth:组件的宽,单位为像素。
- componentHeight:组件的高,单位为像素。
- loadingStatus:图片加载成功的状态。
| -| onError(callback: (event?: { componentWidth: number, componentHeight: number , message9+: string }) => void) | 图片加载出现异常时触发该回调。
- componentWidth:组件的宽,单位为像素。
- componentHeight:组件的高,单位为像素。 | -| onFinish(event: () => void) | 当加载的源文件为带动效的svg图片时,当svg动效播放完成时会触发这个回调,如果动效为无限循环动效,则不会触发这个回调。 | +| 名称 | 功能描述 | +| ---------------------------------------- | ---------------------------------------- | +| onComplete(callback: (event?: { width: number, height: number, componentWidth: number,
 componentHeight: number, loadingStatus: number }) => void) | 图片成功加载时触发该回调,返回成功加载的图片尺寸。
- width:图片的宽,单位为像素。
- height:图片的高,单位为像素。
- componentWidth:组件的宽,单位为像素。
- componentHeight:组件的高,单位为像素。
- loadingStatus:图片加载成功的状态。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
loadingStatus返回的状态值为0时,代表图片加载失败;返回的状态值为1时,代表图片加载成功。 | +| onError(callback: (event?: { componentWidth: number, componentHeight: number , message9+: string }) => void) | 图片加载出现异常时触发该回调。
- componentWidth:组件的宽,单位为像素。
- componentHeight:组件的高,单位为像素。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| onFinish(event: () => void) | 当加载的源文件为带动效的svg图片时,当svg动效播放完成时会触发这个回调,如果动效为无限循环动效,则不会触发这个回调。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 @@ -157,7 +163,7 @@ struct ImageExample1 { ### 网络图片 -加载网络图片时,默认网络超时是5分钟,建议使用alt配置加载时的占位图。如果需要更灵活的网络配置,可以使用SDK中提供的[HTTP](../../connectivity/http-request.md)工具包发送网络请求,接着将返回的数据解码为Image组件中的`PixelMap`,图片开发可参考[图片处理](../../media/image.md)。代码如下。 +加载网络图片时,默认网络超时是5分钟,建议使用alt配置加载时的占位图。如果需要更灵活的网络配置,可以使用SDK中提供的[HTTP](../../connectivity/http-request.md)工具包发送网络请求,接着将返回的数据解码为Image组件中的`PixelMap`,图片开发可参考[图片处理](../../media/image-overview.md)。代码如下。 ```tsx // @ts-nocheck @@ -356,18 +362,14 @@ struct ImageExample3 { ```ts import fileio from '@ohos.fileio'; import fs from '@ohos.file.fs'; -import context from '@ohos.app.ability.context'; +import context from '@ohos.app.ability.common'; @Entry @Component struct LoadImageExample { @State resourcesPath: string = '' @State sandboxPath: string = '' - context: context.AbilityContext - - aboutToAppear() { - this.context = getContext(this) as context.AbilityContext - } + context: context.UIAbilityContext = getContext(this) as context.UIAbilityContext build() { Column() { @@ -394,6 +396,12 @@ struct LoadImageExample { Image(this.resourcesPath) .width(100) .height(100) + .colorFilter([ + 0.30, 0.59, 0.11, 0, 0, + 0.30, 0.59, 0.11, 0, 0, + 0.30, 0.59, 0.11, 0, 0, + 0, 0, 0, 1.0, 0 + ]) Text(`沙箱图片路径:${this.sandboxPath}`) .fontSize(20) .margin({ bottom: 10 }) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-imageanimator.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-imageanimator.md index c43cdc2d4abec8e72c858d517a5dbb988e21b2ae..178c95ff9f2f3515d59ae425d5b1a8dfaa131ffa 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-imageanimator.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-imageanimator.md @@ -17,9 +17,10 @@ ImageAnimator() - ## 属性 +除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性: + | 参数名称 | 参数类型 |参数描述 | | ---------- | ----------------------- |-------- | | images | Array<[ImageFrameInfo](#imageframeinfo对象说明)> | 设置图片帧信息集合。每一帧的帧信息(ImageFrameInfo)包含图片路径、图片大小、图片位置和图片播放时长信息,详见ImageFrameInfo属性说明。
默认值:[]
**说明:**
不支持动态更新。 | @@ -42,9 +43,10 @@ ImageAnimator() | left | number \| string | 否 | 图片相对于组件左上角的横向坐标。
默认值:0 | | duration | number | 否 | 每一帧图片的播放时长,单位毫秒。
默认值:0 | - ## 事件 +除支持[通用事件](ts-universal-events-click.md)外,还支持以下事件: + | 名称 | 功能描述 | | -------- | -------- | | onStart(event: () => void) | 状态回调,动画开始播放时触发。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-imagespan.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-imagespan.md new file mode 100644 index 0000000000000000000000000000000000000000..c17c931c135b54f67aef3fcd25271eef61784dfa --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-imagespan.md @@ -0,0 +1,96 @@ +# ImageSpan + +[Text](ts-basic-components-text.md)组件的子组件,用于显示行内图片。 + +> **说明:** +> +> 该组件从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + + +## 子组件 + +无 + + +## 接口 + +ImageSpan(value: ResourceStr | PixelMap) + +**参数:** + +| 参数名 | 参数类型 | 必填 | 参数描述 | +| -------- | -------- | -------- | -------- | +| value | [ResourceStr](ts-types.md#ResourceStr) \| [PixelMap](../apis/js-apis-image.md#pixelmap7)  | 是 | 图片的数据源,支持本地图片和网络图片。
当使用相对路径引用图片资源时,例如`ImageSpan("common/test.jpg")`,不支持跨包/跨模块调用该ImageSpan组件,建议使用`$r`方式来管理需全局使用的图片资源。
\- 支持的图片格式包括png、jpg、bmp、svg和gif。
\- 支持`Base64`字符串。格式`data:image/[png\|jpeg\|bmp\|webp];base64,[base64 data]`, 其中`[base64 data]`为`Base64`字符串数据。
\- 支持file:///data/storage路径前缀的字符串,用于读取本应用安装目录下files文件夹下的图片资源。需要保证目录包路径下的文件有可读权限。 | + + +## 属性 + +[通用属性](ts-universal-attributes-size.md)方法仅支持宽(width)、高(height)和size。 + +| 名称 | 参数类型 | 描述 | +| -------- | -------- | -------- | +| verticalAlign | [ImageSpanAlignment](#imagespanalignment) | 图片基于文本的对齐方式。 | +| objectFit | [ImageFit](ts-appendix-enums.md#imagefit) | 设置图片的缩放类型。
默认值:ImageFit.Cover | + +## ImageSpanAlignment + +| 名称 | 描述 | +| -------- | ------------------------------ | +| TOP | 图片上边沿与文本上边沿对齐。 | +| CENTER | 图片中间与文本中间对齐。 | +| BOTTOM | 图片下边沿与文本下边沿对齐。 | +| BASELINE | 图片下边沿与文本BaseLine对齐。 | + +## 事件 + +通用事件仅支持[点击事件](ts-universal-attributes-click.md)。 + +## 示例 + +```ts +// xxx.ets +@Entry +@Component +struct SpanExample { + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Start}) { + Text() { + Span('This is the Span and ImageSpan component').fontSize(25).textCase(TextCase.Normal) + .decoration({ type: TextDecorationType.None, color: Color.Pink }) + }.width('100%') + Text() { + ImageSpan($r('app.media.icon')) + .width('200px') + .height('200px') + .objectFit(ImageFit.Fill) + .verticalAlign(ImageSpanAlignment.CENTER) + Span('I am LineThrough-span') + .decoration({ type: TextDecorationType.LineThrough, color: Color.Red }).fontSize(25) + ImageSpan($r('app.media.icon')) + .width('50px') + .height('50px') + .verticalAlign(ImageSpanAlignment.TOP) + Span('I am Underline-span') + .decoration({ type: TextDecorationType.Underline, color: Color.Red }).fontSize(25) + ImageSpan($r('app.media.icon')) + .size({width:'100px', height:'100px'}) + .verticalAlign(ImageSpanAlignment.BASELINE) + Span('I am Underline-span') + .decoration({ type: TextDecorationType.Underline, color: Color.Red }).fontSize(25) + ImageSpan($r('app.media.icon')) + .width('70px') + .height('70px') + .verticalAlign(ImageSpanAlignment.BOTTOM) + Span('I am Underline-span') + .decoration({ type: TextDecorationType.Underline, color: Color.Red }).fontSize(50) + } + .width('100%') + .backgroundColor(Color.Orange) + .textIndent(50) + }.width('100%').height('100%').padding({ left: 0, right: 0, top: 0 }) + } +} +``` + +![imagespan](figures/imagespan.png) + diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-loadingprogress.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-loadingprogress.md index d52eaf34dbfe8a77bebb67e3e18f43238e35644a..0a76407d200709c72058d0c1a788bdc5ed7efdb4 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-loadingprogress.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-loadingprogress.md @@ -18,11 +18,13 @@ LoadingProgress() 创建加载进展组件。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + ## 属性 | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| color | [ResourceColor](ts-types.md#resourcecolor) | 设置加载进度条前景色。 | +| color | [ResourceColor](ts-types.md#resourcecolor) | 设置加载进度条前景色。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 @@ -41,4 +43,4 @@ struct LoadingProgressExample { } ``` -![loadProgress](figures/loadProgress.jpeg) +![LoadingProgress](figures/LoadingProgress.gif) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-marquee.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-marquee.md index bb26b0a9af1b258a36a7ca6c5eef246fd8274740..bbf92272113f7c71bcfdeaeee4570e11947566cc 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-marquee.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-marquee.md @@ -17,29 +17,31 @@ Marquee(value: { start: boolean, step?: number, loop?: number, fromStart?: boolean, src: string }) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | | -------- | -------- | -------- | -------- | | start | boolean | 是 | 控制跑马灯是否进入播放状态。 | | step | number | 否 | 滚动动画文本滚动步长。
默认值:6,单位vp | -| loop | number | 否 | 设置重复滚动的次数,小于等于零时无限循环。
默认值:-1 | +| loop | number | 否 | 设置重复滚动的次数,小于等于零时无限循环。
默认值:-1
**说明:**
ArkTS卡片上该参数设置任意值都仅在可见时滚动一次。 | | fromStart | boolean | 否 | 设置文本从头开始滚动或反向滚动。
默认值:true | | src | string | 是 | 需要滚动的文本。 | ## 属性 -| 名称 | 参数类型 | 描述 | -| ---------- | -------- | ------------------------------------ | -| allowScale | boolean | 是否允许文本缩放。
默认值:false | +| 名称 | 参数类型 | 描述 | +| ---------- | -------- | ------------------------------------------------------------ | +| allowScale | boolean | 是否允许文本缩放。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 事件 | 名称 | 功能描述 | | -------- | -------- | -| onStart(event: () => void) | 开始滚动时触发回调。 | -| onBounce(event: () => void) | 完成一次滚动时触发,若循环次数不为1,则该事件会多次触发。 | -| onFinish(event: () => void) | 滚动全部循环次数完成时触发回调。 | +| onStart(event: () => void) | 开始滚动时触发回调。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| onBounce(event: () => void) | 完成一次滚动时触发,若循环次数不为1,则该事件会多次触发。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| onFinish(event: () => void) | 滚动全部循环次数完成时触发回调。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-menu.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-menu.md index dde03192a4d6bbcc5a935e4a0072351436c03131..4b969fc2a131e382b0a07670353af3ff096e2229 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-menu.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-menu.md @@ -22,7 +22,9 @@ Menu() | 名称 | 参数类型 | 描述 | | -------- | ------------------------- | ---------------------------------------------------------------- | -| fontSize | [Length](ts-types.md#length) | 统一设置Menu中所有文本的尺寸,Length为number类型时,使用fp单位。 | +| fontSizedeprecated | [Length](ts-types.md#length) | 统一设置Menu中所有文本的尺寸,Length为number类型时,使用fp单位。
从API Version 10开始废弃,建议使用font代替。 | +| font10+ | [Font](ts-types.md#font) | 统一设置Menu中所有文本的字体样式。 | +| fontColor10+ | [ResourceColor](ts-types.md#resourcecolor) | 统一设置Menu中所有文本的颜色。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-menuitem.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-menuitem.md index 038af44a42a7ffbdc5fd9688be54b1fc0782c78d..baca369fe5b425e76e7471285da48a55dbf3a4f7 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-menuitem.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-menuitem.md @@ -22,10 +22,10 @@ MenuItem(value?: MenuItemOptions| CustomBuilder) ## MenuItemOptions类型说明 -| 名称 | 类型 | 必填 | 描述 | -| --------- | ---------------------------------------- | ---- | -------------------------------------- | +| 名称 | 类型 | 必填 | 描述 | +| --------- | ------------------------------------------- | ---- | -------------------------------------- | | startIcon | [ResourceStr](ts-types.md#resourcestr) | 否 | item中显示在左侧的图标信息路径。 | -| content | [ResourceStr](ts-types.md#resourcestr) | 是 | item的内容信息。 | +| content | [ResourceStr](ts-types.md#resourcestr) | 否 | item的内容信息。 | | endIcon | [ResourceStr](ts-types.md#resourcestr) | 否 | item中显示在右侧的图标信息路径。 | | labelInfo | [ResourceStr](ts-types.md#resourcestr) | 否 | 定义结束标签信息,如快捷方式Ctrl+C等。 | | builder | [CustomBuilder](ts-types.md#custombuilder8) | 否 | 用于构建二级菜单。 | @@ -34,10 +34,14 @@ MenuItem(value?: MenuItemOptions| CustomBuilder) 除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性: -| 名称 | 参数类型 | 描述 | -| ---------- | -------- | ---------------------------------------- | -| selected | boolean | 设置菜单项是否选中。
默认值:false | -| selectIcon | boolean | 当菜单项被选中时,是否显示被选中的图标。 | +| 名称 | 参数类型 | 描述 | +| ------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| selected | boolean | 设置菜单项是否选中。
默认值:false | +| selectIcon | boolean \| [ResourceStr](ts-types.md#resourcestr)10+ | 当菜单项被选中时,是否显示被选中的图标。
默认值:false
true: 菜单项被选中时,显示默认的对勾图标
false: 即使菜单项被选中也不显示图标
ResourceStr: 菜单项被选中时,显示指定的图标 | +| contentFont10+ | [Font](ts-types.md#font) | 设置菜单项中内容信息的字体样式。 | +| contentFontColor10+ | [ResourceColor](ts-types.md#resourcecolor) | 设置菜单项中内容信息的字体颜色。 | +| labelFont10+ | [Font](ts-types.md#font) | 设置菜单项中标签信息的字体样式。 | +| labelFontColor10+ | [ResourceColor](ts-types.md#resourcecolor) | 设置菜单项中标签信息的字体颜色。 | ## 事件 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-navdestination.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-navdestination.md index 49669a8f1be61875c2538ee030347e2edb559ea4..c107b4a81593695d71741f59378a5a746126cd66 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-navdestination.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-navdestination.md @@ -9,7 +9,10 @@ ## 子组件 -可以包含子组件。 +> **说明:** +> +> - 子组件类型:系统组件和自定义组件,支持渲染控制类型([if/else](../../quick-start/arkts-rendering-control-ifelse.md)、[ForEach](../../quick-start/arkts-rendering-control-foreach.md)和[LazyForEach](../../quick-start/arkts-rendering-control-lazyforeach.md))。 +> - 子组件个数:多个。 ## 接口 @@ -21,7 +24,11 @@ NavDestination() 仅支持[backgroundColor](ts-universal-attributes-background.md)通用属性。 -| 名称 | 参数类型 | 描述 | -| -------------- | ---------------------------------------- | ---------------------------------------- | -| title | string \| [CustomBuilder](ts-types.md#custombuilder8) \| [NavigationCommonTitle](ts-basic-components-navigation.md#navigationcommontitle类型说明) \| [NavigationCustomTitle](ts-basic-components-navigation.md##navigationcustomtitle类型说明) | 页面标题。 | -| hideTitleBar | boolean | 是否显示标题栏。
默认值:false
true: 隐藏标题栏。
false: 显示标题栏。 | \ No newline at end of file +| 名称 | 参数类型 | 描述 | +| ------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| title | string \| [CustomBuilder](ts-types.md#custombuilder8) \| [NavigationCommonTitle](ts-basic-components-navigation.md#navigationcommontitle类型说明) \| [NavigationCustomTitle](ts-basic-components-navigation.md##navigationcustomtitle类型说明) | 页面标题。
**说明:**
使用NavigationCustomTitle类型设置height高度时,titleMode属性不会生效。
字符串超长时,如果不设置副标题,先缩小再换行2行后以...截断。如果设置副标题,先缩小后以...截断。 | +| hideTitleBar | boolean | 是否显示标题栏。
默认值:false
true: 隐藏标题栏。
false: 显示标题栏。 | + +## 事件 + +支持[通用事件](ts-universal-events-click.md)。 \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-navigation.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-navigation.md index 9fad298ffe627e1c9c8d2f9cb9fc1ac1a0f6589e..4b3a3950f10962b34f6a6f59812fb677c5c6d82e 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-navigation.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-navigation.md @@ -21,86 +21,86 @@ Navigation() 除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性: -| 名称 | 参数类型 | 描述 | -| -------------- | ---------------------------------------- | ---------------------------------------- | -| title | string \| [CustomBuilder](ts-types.md#custombuilder8)8+ \| [NavigationCommonTitle](#navigationcommontitle类型说明)9+ \| [NavigationCustomTitle](#navigationcustomtitle类型说明)9+ | 页面标题。 | -| subTitledeprecated | string | 页面副标题。从API Version 9开始废弃,建议使用title代替。 | -| menus | Array<[NavigationMenuItem](#navigationmenuitem类型说明)> \| [CustomBuilder](ts-types.md#custombuilder8)8+ | 页面右上角菜单。使用Array<[NavigationMenuItem](#navigationmenuitem类型说明)> 写法时,竖屏最多支持显示3个图标,横屏最多支持显示5个图标,多余的图标会被放入自动生成的更多图标。 | -| titleMode | [NavigationTitleMode](#navigationtitlemode枚举说明) | 页面标题栏显示模式。
默认值:NavigationTitleMode.Free | -| toolBar | [object](#object类型说明) \| [CustomBuilder](ts-types.md#custombuilder8)8+ | 设置工具栏内容。
items: 工具栏所有项。 | -| hideToolBar | boolean | 隐藏工具栏。
默认值:false
true: 隐藏工具栏。
false: 显示工具栏。 | -| hideTitleBar | boolean | 隐藏标题栏。
默认值:false
true: 隐藏标题栏。
false: 显示标题栏。 | -| hideBackButton | boolean | 隐藏返回键。
默认值:false
true: 隐藏返回键。
false: 显示返回键。 | -| navBarWidth9+ | [Length](ts-types.md#length) | 导航栏宽度。
默认值:200vp | -| navBarPosition9+ | [NavBarPosition](#navbarposition枚举说明) | 导航栏位置。
默认值:NavBarPosition.Start | -| mode9+ | [NavigationMode](#navigationmode枚举说明) | 导航栏的显示模式。
默认值:NavigationMode.Auto | -| backButtonIcon9+ | string \| [PixelMap](../apis/js-apis-image.md#pixelmap7) \| [Resource](ts-types.md#resource) | 设置导航栏返回图标。 | -| hideNavBar9+ | boolean | 是否显示导航栏(仅在mode为NavigationMode.Split时生效)。 | +| 名称 | 参数类型 | 描述 | +| ----------------------------- | ---------------------------------------- | ---------------------------------------- | +| title | [ResourceStr](ts-types.md#resourcestr)10+ \| [CustomBuilder](ts-types.md#custombuilder8)8+ \| [NavigationCommonTitle](#navigationcommontitle类型说明)9+ \| [NavigationCustomTitle](#navigationcustomtitle类型说明)9+ | 页面标题。
**说明:**
使用NavigationCustomTitle类型设置height高度时,titleMode属性不会生效。
字符串超长时,如果不设置副标题,先缩小再换行(2行)最后...截断。如果设置副标题,先缩小最后...截断。 | +| subTitledeprecated | string | 页面副标题。不设置时不显示副标题。从API Version 9开始废弃,建议使用title代替。 | +| menus | Array<[NavigationMenuItem](#navigationmenuitem类型说明)> \| [CustomBuilder](ts-types.md#custombuilder8)8+ | 页面右上角菜单。不设置时不显示菜单项。使用Array<[NavigationMenuItem](#navigationmenuitem类型说明)> 写法时,竖屏最多支持显示3个图标,横屏最多支持显示5个图标,多余的图标会被放入自动生成的更多图标。 | +| titleMode | [NavigationTitleMode](#navigationtitlemode枚举说明) | 页面标题栏显示模式。
默认值:NavigationTitleMode.Free | +| toolBar | [object](#object类型说明) \| [CustomBuilder](ts-types.md#custombuilder8)8+ | 设置工具栏内容。不设置时不显示工具栏。
items: 工具栏所有项。
**说明:**
items均分底部工具栏,在每个均分内容区布局文本和图标,文本超长时,逐级缩小,缩小之后换行,最后...截断。 | +| hideToolBar | boolean | 隐藏工具栏。
默认值:false
true: 隐藏工具栏。
false: 显示工具栏。 | +| hideTitleBar | boolean | 隐藏标题栏。
默认值:false
true: 隐藏标题栏。
false: 显示标题栏。 | +| hideBackButton | boolean | 隐藏返回键。
默认值:false
true: 隐藏返回键。
false: 显示返回键。
不支持隐藏NavDestination组件标题栏中的返回图标。
**说明:**
返回键键仅针对titleMode为NavigationTitleMode.Mini时才生效。 | +| navBarWidth9+ | [Length](ts-types.md#length) | 导航栏宽度。
默认值:200
单位:vp
**说明:**
仅在Navigation组件分栏时生效。 | +| navBarPosition9+ | [NavBarPosition](#navbarposition枚举说明) | 导航栏位置。
默认值:NavBarPosition.Start
**说明:**
仅在Navigation组件分栏时生效。 | +| mode9+ | [NavigationMode](#navigationmode枚举说明) | 导航栏的显示模式。
默认值:NavigationMode.Auto
自适应:基于组件宽度自适应单栏和双栏。 | +| backButtonIcon9+ | string \| [PixelMap](../apis/js-apis-image.md#pixelmap7) \| [Resource](ts-types.md#resource) | 设置导航栏返回图标。不支持隐藏NavDestination组件标题栏中的返回图标。 | +| hideNavBar9+ | boolean | 是否显示导航栏(仅在mode为NavigationMode.Split时生效)。 | ## NavigationMenuItem类型说明 -| 名称 | 类型 | 必填 | 描述 | -| ------ | ----------------------- | ---- | ------------------------------ | -| value | string | 是 | 菜单栏单个选项的显示文本。 | -| icon | string | 否 | 菜单栏单个选项的图标资源路径。 | -| action | () => void | 否 | 当前选项被选中的事件回调。 | +| 名称 | 类型 | 必填 | 描述 | +| ------ | ----------------------- | ---- | --------------- | +| value | string | 是 | 菜单栏单个选项的显示文本。 | +| icon | string | 否 | 菜单栏单个选项的图标资源路径。 | +| action | () => void | 否 | 当前选项被选中的事件回调。 | ## object类型说明 -| 名称 | 类型 | 必填 | 描述 | -| ------ | ----------------------- | ---- | ------------------------------ | -| value | string | 是 | 工具栏单个选项的显示文本。 | -| icon | string | 否 | 工具栏单个选项的图标资源路径。 | -| action | () => void | 否 | 当前选项被选中的事件回调。 | +| 名称 | 类型 | 必填 | 描述 | +| ------ | ----------------------- | ---- | --------------- | +| value | string | 是 | 工具栏单个选项的显示文本。 | +| icon | string | 否 | 工具栏单个选项的图标资源路径。 | +| action | () => void | 否 | 当前选项被选中的事件回调。 | ## NavigationTitleMode枚举说明 | 名称 | 描述 | | ---- | ---------------------------------------- | | Free | 当内容为可滚动组件时,标题随着内容向上滚动而缩小(子标题的大小不变、淡出)。向下滚动内容到顶时则恢复原样。 | -| Mini | 固定为小标题模式。 | -| Full | 固定为大标题模式。 | +| Mini | 固定为小标题模式。 | +| Full | 固定为大标题模式。 | ## NavigationCommonTitle类型说明 -| 名称 | 类型 | 必填 | 描述 | -| ------ | --------- | ---- | -------- | -| main | string | 是 | 设置主标题。 | -| sub | string | 是 | 设置副标题。 | +| 名称 | 类型 | 必填 | 描述 | +| ---- | ------ | ---- | ------ | +| main | string | 是 | 设置主标题。 | +| sub | string | 是 | 设置副标题。 | ## NavigationCustomTitle类型说明 -| 名称 | 类型 | 必填 | 描述 | -| ------ | ----------------------- | ---- | ------------------------------ | -| builder | [CustomBuilder](ts-types.md#custombuilder8) | 是 | 设置标题栏内容。 | -| height | [TitleHeight](#titleheight枚举说明) \| [Length](ts-types.md#length) | 是 | 设置标题栏高度。 | +| 名称 | 类型 | 必填 | 描述 | +| ------- | ---------------------------------------- | ---- | -------- | +| builder | [CustomBuilder](ts-types.md#custombuilder8) | 是 | 设置标题栏内容。 | +| height | [TitleHeight](#titleheight枚举说明) \| [Length](ts-types.md#length) | 是 | 设置标题栏高度。 | ## NavBarPosition枚举说明 -| 名称 | 描述 | -| ---- | ---------------------------------------- | +| 名称 | 描述 | +| ----- | ---------------- | | Start | 双栏显示时,主列在主轴方向首部。 | -| End | 双栏显示时,主列在主轴方向尾部。 | +| End | 双栏显示时,主列在主轴方向尾部。 | ## NavigationMode枚举说明 -| 名称 | 描述 | -| ---- | ---------------------------------------- | -| Stack | 导航栏与内容区独立显示,相当于两个页面。 | -| Split | 导航栏与内容区分两栏显示。 | -| Auto | 窗口宽度>=520vp时,采用Split模式显示;窗口宽度<520vp时,采用Stack模式显示。 | +| 名称 | 描述 | +| ----- | ---------------------------------------- | +| Stack | 导航栏与内容区独立显示,相当于两个页面。 | +| Split | 导航栏与内容区分两栏显示。 | +| Auto | 窗口宽度>=520vp时,采用Split模式显示;窗口宽度<520vp时,采用Stack模式显示。 | ## TitleHeight枚举说明 -| 名称 | 描述 | -| ---- | ---------------------------------------- | -| MainOnly | 只有主标题时标题栏的推荐高度(56vp)。 | +| 名称 | 描述 | +| ----------- | -------------------------- | +| MainOnly | 只有主标题时标题栏的推荐高度(56vp)。 | | MainWithSub | 同时有主标题和副标题时标题栏的推荐高度(82vp)。 | > **说明:** -> 目前可滚动组件只支持List。 +> 目前可滚动组件只支持List。 ## 事件 @@ -147,7 +147,7 @@ struct NavigationExample { .fontSize(14) .lineHeight(19) .opacity(0.4) - .margin({ top: 2 }) + .margin({ top: 2, bottom: 20 }) }.alignItems(HorizontalAlign.Start) } @@ -192,16 +192,16 @@ struct NavigationExample { Column() { Navigation() { TextInput({ placeholder: 'search...' }) - .width(336) + .width('90%') .height(40) .backgroundColor('#FFFFFF') - .margin({ top: 8, left: 12 }) + .margin({ top: 8 }) List({ space: 12, initialIndex: 0 }) { ForEach(this.arr, (item) => { ListItem() { Text('' + item) - .width(336) + .width('90%') .height(72) .backgroundColor('#FFFFFF') .borderRadius(24) @@ -213,7 +213,7 @@ struct NavigationExample { } .height(324) .width('100%') - .margin({ top: 12, left: 12 }) + .margin({ top: 12, left: '10%' }) } .title(this.NavigationTitle) .menus(this.NavigationMenus) @@ -229,4 +229,4 @@ struct NavigationExample { } ``` -![zh-cn_image_0000001192655288](figures/zh-cn_image_0000001192655288.gif) \ No newline at end of file +![zh-cn_image_0000001192655288](figures/zh-cn_image_0000001192655288.gif) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-navrouter.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-navrouter.md index 162f15f8f3645a41808ef0ad7dfca5a20077aa87..4bbe47093ab9d614d64d21544cc43d6ca90f0de2 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-navrouter.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-navrouter.md @@ -10,6 +10,14 @@ 必须包含两个子组件,其中第二个子组件必须为[NavDestination](ts-basic-components-navdestination.md)。 +> **说明:** +> +> 子组件个数异常时: +> 1. 有且仅有1个时,触发路由到NavDestination的能力失效。 +> 2. 有且仅有1个时,且使用NavDestination场景下,不进行路由。 +> 3. 大于2个时,后续的子组件不显示。 +> 4. 第二个子组件不为NavDestination时,触发路由功能失效。 + ## 接口 NavRouter() @@ -17,9 +25,9 @@ NavRouter() ## 事件 -| 名称 | 功能描述 | -| ---------------------------------------- | ---------------------------------------- | -| onStateChange(callback: (isActivated: boolean) => void) | 组件激活状态切换时触发该回调。返回值isActivated为true时表示激活,为false时表示未激活。
**说明:** 用户点击NavRouter,激活NavRouter,加载对应的NavDestination子组件时,回调onStateChange(true);NavRouter对应的NavDestination子组件不再显示时,回调onStateChange(false)。 | +| 名称 | 功能描述 | +| ------------------------------------------------------- | ------------------------------------------------------------ | +| onStateChange(callback: (isActivated: boolean) => void) | 组件激活状态切换时触发该回调。返回值isActivated为true时表示激活,为false时表示未激活。
**说明:**
开发者点击激活NavRouter,加载对应的NavDestination子组件时,回调onStateChange(true)。NavRouter对应的NavDestination子组件不再显示时,回调onStateChange(false)。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-plugincomponent.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-plugincomponent.md index 0bad69d7c539028e0e165cc3e16a27ca93575876..2a947a983a64ce376f584f02a2c287b1a781cc6e 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-plugincomponent.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-plugincomponent.md @@ -31,9 +31,16 @@ PluginComponent(value: { template: PluginComponentTemplate, data: KVObject}) | source | string | 组件模板名。 | | bundleName | string | 提供者Ability的bundleName。 | +## 属性 + +除支持[通用属性size](ts-universal-attributes-size.md),且必须设置size。 ## 事件 +仅支持[手势事件](ts-gesture-settings.md)分发给提供方页面,并在提供方页面内部处理。 + +除支持[通用事件](ts-universal-events-click.md),还支持以下事件: + | 名称 | 功能描述 | | ------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------- | | onComplete(callback: () => void) | 组件加载完成回调。 | @@ -46,7 +53,7 @@ PluginComponent(value: { template: PluginComponentTemplate, data: KVObject}) ```ts //PluginUserExample.ets -import plugin from "plugin_component.js" +import plugin from "./plugin_component.js" @Entry @Component @@ -102,7 +109,7 @@ struct PluginUserExample { ```ts //PluginProviderExample.ets -import plugin from "plugin_component.js" +import plugin from "./plugin_component.js" @Entry @Component diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-progress.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-progress.md index 85d343bdb5a1e405b2a30f966d1f3f5d2099ab55..11107f9c944bd327916d74bab34354dd058a95db 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-progress.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-progress.md @@ -18,17 +18,21 @@ Progress(options: {value: number, total?: number, type?: ProgressType}) 创建进度组件,用于显示内容加载或操作处理进度。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | | -------- | -------- | -------- | -------- | -| value | number | 是 | 指定当前进度值。设置小于0的数值时置为0,设置大于total的数值时置为total。 | -| total | number | 否 | 指定进度总长。
默认值:100 | -| type8+ | [ProgressType](#progresstype枚举说明) | 否 | 指定进度条类型。
默认值:ProgressType.Linear | +| value | number | 是 | 指定当前进度值。设置小于0的数值时置为0,设置大于total的数值时置为total。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| total | number | 否 | 指定进度总长。
默认值:100
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| type8+ | [ProgressType](#progresstype枚举说明) | 否 | 指定进度条类型。
默认值:ProgressType.Linear
从API version 9开始,该接口支持在ArkTS卡片中使用。 | | styledeprecated | [ProgressStyle](#progressstyle枚举说明) | 否 | 指定进度条样式。
该参数从API version8开始废弃,建议使用type替代。
默认值:ProgressStyle.Linear | ## ProgressType枚举说明 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | -------- | -------- | | Linear | 线性样式。从API version9开始,高度大于宽度的时候自适应垂直显示。 | @@ -39,6 +43,8 @@ Progress(options: {value: number, total?: number, type?: ProgressType}) ## ProgressStyle枚举说明 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | --------- | ------------------------------------------------------------ | | Linear | 线性样式。 | @@ -49,13 +55,18 @@ Progress(options: {value: number, total?: number, type?: ProgressType}) ## 属性 +除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性: + | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| value | number | 设置当前进度值。设置小于0的数值时置为0,设置大于total的数值时置为total。非法数值不生效。 | -| color | [ResourceColor](ts-types.md#resourcecolor) | 设置进度条前景色。 | -| backgroundColor | [ResourceColor](ts-types.md#resourcecolor) | 设置进度条底色。 | -| style8+ | {
strokeWidth?: [Length](ts-types.md#length),
scaleCount?: number,
scaleWidth?: [Length](ts-types.md#length)
} | 定义组件的样式。
- strokeWidth: 设置进度条宽度(不支持百分比设置)。从API version9开始,环形进度条设置宽度大于等于半径时,默认修改宽度至半径值的二分之一。
默认值:4.0Vp
- scaleCount: 设置环形进度条总刻度数。
默认值:120
- scaleWidth: 设置环形进度条刻度粗细(不支持百分比设置),刻度粗细大于进度条宽度时,为系统默认粗细。
默认值:2.0Vp | +| value | number | 设置当前进度值。设置小于0的数值时置为0,设置大于total的数值时置为total。非法数值不生效。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| color | [ResourceColor](ts-types.md#resourcecolor) | 设置进度条前景色。
默认值:'\#ff007dff'
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| backgroundColor | [ResourceColor](ts-types.md#resourcecolor) | 设置进度条底色。
默认值:'\#19182431'

从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| style8+ | {
strokeWidth?: [Length](ts-types.md#length),
scaleCount?: number,
scaleWidth?: [Length](ts-types.md#length)
} | 定义组件的样式。
- strokeWidth: 设置进度条宽度(不支持百分比设置)。从API version9开始,环形进度条设置宽度大于等于半径时,默认修改宽度至半径值的二分之一。
默认值:4.0Vp
- scaleCount: 设置环形进度条总刻度数。
默认值:120
- scaleWidth: 设置环形进度条刻度粗细(不支持百分比设置),刻度粗细大于进度条宽度时,为系统默认粗细。
默认值:2.0Vp
从API version 9开始,该接口支持在ArkTS卡片中使用。 | + +## 事件 +支持[通用事件](ts-universal-events-click.md)。 ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-qrcode.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-qrcode.md index 89ae82004a405e536ad3e7c686190a68528b43ba..a3cb4fb0b2188f67bf6a5c7b199008b53e891d3e 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-qrcode.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-qrcode.md @@ -5,6 +5,8 @@ > **说明:** > > 该组件从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 +> +> 二维码组件的像素点数量与内容有关,当组件尺寸过小时,可能出现无法展示内容的情况,此时需要适当调整组件尺寸。 ## 子组件 @@ -16,11 +18,13 @@ QRCode(value: string) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | | -------- | -------- | -------- | -------- | -| value | string | 是 | 二维码内容字符串。 | +| value | string | 是 | 二维码内容字符串。最大支持256个字符,若超出,则截取前256个字符。 | ## 属性 @@ -28,13 +32,13 @@ QRCode(value: string) | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| color | [ResourceColor](ts-types.md#resourcecolor) | 设置二维码颜色。
默认值:Color.Black | -| backgroundColor | [ResourceColor](ts-types.md#resourcecolor) | 设置二维码背景颜色。
默认值:Color.White | +| color | [ResourceColor](ts-types.md#resourcecolor) | 设置二维码颜色。
默认值:Color.Black
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| backgroundColor | [ResourceColor](ts-types.md#resourcecolor) | 设置二维码背景颜色。
默认值:Color.White
从API version 9开始,该接口支持在ArkTS卡片中使用。| ## 事件 -通用事件仅支持[点击事件](ts-universal-events-click.md)。 +通用事件支持[点击事件](ts-universal-events-click.md)、[触摸事件](ts-universal-events-touch.md)、[挂载卸载事件](ts-universal-events-show-hide.md)。 ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-radio.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-radio.md index 76bc6a9a644384009be751b746e26b00df26f6c8..b9438839f0e0d154be97d214fa97d63ce5a29107 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-radio.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-radio.md @@ -16,6 +16,8 @@ Radio(options: {value: string, group: string}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -29,7 +31,8 @@ Radio(options: {value: string, group: string}) | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| checked | boolean | 设置单选框的选中状态。
默认值:false | +| checked | boolean | 设置单选框的选中状态。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| radioStyle10+ | [RadioStyle](#radiostyle对象说明) | 设置单选框选中状态和非选中状态的样式。
从API version 10开始,该接口支持在ArkTS组件中使用。| ## 事件 @@ -37,8 +40,15 @@ Radio(options: {value: string, group: string}) | 名称 | 功能描述 | | -------- | -------- | -| onChange(callback: (isChecked: boolean) => void) | 单选框选中状态改变时触发回调。
-isChecked为true时,代表选中。
-isChecked为false时,代表未选中。 | +| onChange(callback: (isChecked: boolean) => void) | 单选框选中状态改变时触发回调。
- isChecked为true时,表示从未选中变为选中。
- isChecked为false时,表示从选中变为未选中。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | + +## RadioStyle对象说明 +| 名称 | 类型 | 必填 | 默认值 | 描述 | +| ---------------------- | ------------------------------------------ | ---- | ------- | ---------------------- | +| checkedBackgroundColor | [ResourceColor](ts-types.md#resourcecolor) | 否 | #007DFF | 开启状态底板颜色。 | +| uncheckedBorderColor | [ResourceColor](ts-types.md#resourcecolor) | 否 | #182431 | 关闭状态描边颜色。 | +| indicatorColor | [ResourceColor](ts-types.md#resourcecolor) | 否 | #FFFFFF | 开启状态内部圆饼颜色。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-rating.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-rating.md index 458692f9d232176521f0c46d7510abc907ebb9f0..b137ec163412bcc8686b12f1bcf6129d2dff5797 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-rating.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-rating.md @@ -16,28 +16,36 @@ Rating(options?: { rating: number, indicator?: boolean }) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** -| 参数名 | 参数类型 | 必填 | 参数描述 | -| -------- | -------- | -------- | -------- | -| rating | number | 是 | 设置并接收评分值。
默认值:0 | -| indicator | boolean | 否 | 设置评分组件作为指示器使用,不可改变评分。
默认值:false, 可进行评分 | +| 参数名 | 参数类型 | 必填 | 参数描述 | +| --------- | ------- | ---- | ---------------------------------------- | +| rating | number | 是 | 设置并接收评分值。
默认值:0
取值范围: [0, stars]
小于0取0,大于stars取最大值stars。 | +| indicator | boolean | 否 | 设置评分组件作为指示器使用,不可改变评分。
默认值:false, 可进行评分
**说明:**
indicator=true时,默认组件高度height=12.0vp,组件width=height*stars。
indicator=false时,默认组件高度height=28.0vp,组件width=height*stars。 | ## 属性 -| 名称 | 参数类型 | 描述 | -| -------- | -------- | -------- | -| stars | number | 设置评星总数。
默认值:5 | -| stepSize | number | 操作评级的步长。
默认值:0.5 | -| starStyle | {
backgroundUri: string,
foregroundUri: string,
secondaryUri?: string
} | backgroundUri:未选中的星级的图片链接,可由用户自定义或使用系统默认图片,仅支持本地图片。
foregroundUri:选中的星级的图片路径,可由用户自定义或使用系统默认图片,仅支持本地图片。
secondaryUir:部分选中的星级的图片路径,可由用户自定义或使用系统默认图片,仅支持本地图片。 | +| 名称 | 参数类型 | 描述 | +| --------- | ---------------------------------------- | ---------------------------------------- | +| stars | number | 设置评分总数。
默认值:5
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
设置为小于0的值时,按默认值显示。 | +| stepSize | number | 操作评级的步长。
默认值:0.5
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
设置为小于0的值时,按默认值显示。
取值范围为[0.1, stars]。 | +| starStyle | {
backgroundUri: string,
foregroundUri: string,
secondaryUri?: string
} | backgroundUri:未选中的星级的图片链接,可由用户自定义或使用系统默认图片。
foregroundUri:选中的星级的图片路径,可由用户自定义或使用系统默认图片。
secondaryUir:部分选中的星级的图片路径,可由用户自定义或使用系统默认图片。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
startStyle属性所支持的图片类型能力参考[Image](ts-basic-components-image.md)组件。
支持加载本地图片和网络图片,暂不支持PixelMap类型和Resource资源。
默认图片加载方式为异步,暂不支持同步加载。
设置值为undefined或者空字符串时,rating会选择加载系统默认星型图源。 | + +> **说明:** +> +> rating宽高为[width, height]时,单个图片的绘制区域为[width / stars, height]。 +> +> 为了指定绘制区域为方形,建议自定义宽高时采取[height * stars, height], width = height * stars的方式。 ## 事件 -| 名称 | 功能描述 | -| -------- | -------- | -| onChange(callback:(value: number) => void) | 操作评分条的评星发生改变时触发该回调。 | +| 名称 | 功能描述 | +| ---------------------------------------- | ---------------------------------------- | +| onChange(callback:(value: number) => void) | 操作评分条的评星发生改变时触发该回调。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 @@ -78,7 +86,7 @@ struct RatingExample { .fontColor('#182431') .fontWeight(500) Row() { - Rating({ rating: 3.5, indicator: true }).margin({ top: 1, right: 8 }) + Rating({ rating: 3.5, indicator: false }).margin({ top: 1, right: 8 }) Text('2021/06/02') .fontSize(10) .fontColor('#182431') diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-richtext.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-richtext.md index 37311ca3d0420a53c2e41b0f635fdc7eb9c11fd5..504e2cde4f47a553f302dd77f54155121b2cefd1 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-richtext.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-richtext.md @@ -5,7 +5,7 @@ > **说明:** > > 该组件从API Version 8开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 - +> 使用该组件时请设置高度值。 ## 子组件 @@ -31,6 +31,10 @@ RichText(content:string) | onStart(callback: () => void) | 加载网页时触发。 | | onComplete(callback: () => void) | 网页加载结束时触发。 | +## 属性 + +只支持[通用属性](ts-universal-attributes-size.md)中width,height,size,layoutWeight四个属性。由于padding,margin,constraintSize属性使用时与通用属性描述不符,暂不支持。 + ## 支持标签 | 名称 | 描述 | 示例 | @@ -46,7 +50,7 @@ RichText(content:string) | \\ | 定义与常规文本风格不同的文本,像拼写错误的单词或者汉语中的专有名词,应尽量避免使用\为文本加下划线,用户会把它混淆为一个超链接。 | \

\这是带有下划线的段落\\

| | \ | 定义HTML文档的样式信息。 | \ | | style | 属性规定元素的行内样式,写在标签内部,在使用的时候需用引号来进行区分,并以; 间隔样式,style='width: 500px;height: 500px;border: 1px soild;margin: 0 auto;'。 | \

这是一个标题\

\

这是一个段落。\

| -| \ | 用于定义客户端文本,比如JavaScript。 | \ | +| \ | 用于定义客户端脚本,比如JavaScript。 | \ | ## 示例 @@ -78,6 +82,29 @@ struct RichTextExample { .onComplete(() => { console.info('RichText onComplete'); }) + .width(500) + .height(400) + .backgroundColor(0XBDDB69) + RichText('layoutWeight(1)') + .onStart(() => { + console.info('RichText onStart'); + }) + .onComplete(() => { + console.info('RichText onComplete'); + }) + .size({ width: '100%', height: 110 }) + .backgroundColor(0X92D6CC) + .layoutWeight(1) + RichText('layoutWeight(2)') + .onStart(() => { + console.info('RichText onStart'); + }) + .onComplete(() => { + console.info('RichText onComplete'); + }) + .size({ width: '100%', height: 110 }) + .backgroundColor(0X92C48D) + .layoutWeight(2) } } } diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-scrollbar.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-scrollbar.md index fe680d987c2ac0dcea2deba8d22b63c0ba34f4bd..0f9582a81ce84019b6a6ab8703b6079b5cd749b8 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-scrollbar.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-scrollbar.md @@ -46,7 +46,7 @@ ScrollBar(value: { scroller: Scroller, direction?: ScrollBarDirection, state?: B @Component struct ScrollBarExample { private scroller: Scroller = new Scroller() - private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15] build() { Column() { @@ -56,8 +56,8 @@ struct ScrollBarExample { ForEach(this.arr, (item) => { Row() { Text(item.toString()) - .width('90%') - .height(100) + .width('80%') + .height(60) .backgroundColor('#3366CC') .borderRadius(15) .fontSize(16) @@ -65,17 +65,18 @@ struct ScrollBarExample { .margin({ top: 5 }) } }, item => item) - }.margin({ right: 52 }) + }.margin({ right: 15 }) } + .width('90%') .scrollBar(BarState.Off) .scrollable(ScrollDirection.Vertical) ScrollBar({ scroller: this.scroller, direction: ScrollBarDirection.Vertical,state: BarState.Auto }) { Text() - .width(30) + .width(20) .height(100) .borderRadius(10) .backgroundColor('#C0C0C0') - }.width(30).backgroundColor('#ededed') + }.width(20).backgroundColor('#ededed') } } } diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-search.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-search.md index 443f68660dbeb6d1be95c1aa9468828a2db02e98..c49bc417980663ecf354c8569ae6f7b0a2b0d53c 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-search.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-search.md @@ -12,14 +12,14 @@ ## 接口 -Search(options?: { value?: string; placeholder?: string; icon?: string; controller?: SearchController }) +Search(options?: { value?: string; placeholder?: ResourceStr; icon?: string; controller?: SearchController }) **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | | ----------- | ---------------- | ---- | ------------------------------------------------------------ | -| value | string | 否 | 设置当前显示的搜索文本内容。 | -| placeholder | string | 否 | 设置无输入时的提示文本。 | +| value | string | 否 | 设置当前显示的搜索文本内容。 | +| placeholder | [ResourceStr](ts-types.md#resourcestr)10+ | 否 | 设置无输入时的提示文本。 | | icon | string | 否 | 设置搜索图标路径,默认使用系统搜索图标,图标支持的图源格式: svg、jpg和png。 | | controller | SearchController | 否 | 设置Search组件控制器。 | @@ -29,12 +29,46 @@ Search(options?: { value?: string; placeholder?: string; icon?: string; controll | 名称 | 参数类型 | 描述 | | ----------------------- | ------------------------------------------------ | ---------------------------------------------- | -| searchButton | string | 搜索框末尾搜索按钮文本内容,默认无搜索按钮。 | +| searchButton10+ | value: string,
option?: [SearchButtonOption](#searchbuttonoption10对象说明) | 搜索框末尾搜索按钮文本内容,默认无搜索按钮。 | | placeholderColor | [ResourceColor](ts-types.md#resourcecolor) | 设置placeholder文本颜色。 | -| placeholderFont | [Font](ts-types.md#font) | 设置placeholder文本样式。 | -| textFont | [Font](ts-types.md#font) | 设置搜索框内输入文本样式。 | +| placeholderFont | [Font](ts-types.md#font) | 设置placeholder文本样式,包括字体大小,字体粗细,字体族,字体风格。目前仅支持默认字体族。 | +| textFont | [Font](ts-types.md#font) | 设置搜索框内输入文本样式,包括字体大小,字体粗细,字体族,字体风格。目前仅支持默认字体族。 | | textAlign | [TextAlign](ts-appendix-enums.md#textalign) | 设置文本在搜索框中的对齐方式。
默认值:TextAlign.Start | | copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | 设置输入的文本是否可复制。 | +| searchIcon10+ | [IconOptions](#iconoptions10对象说明) | 设置左侧搜索图标样式。 | +| cancelButton10+ | {
style? : [CancelButtonStyle](#cancelbuttonstyle10枚举说明)
icon?: [IconOptions](#iconoptions10对象说明)
} | 设置右侧清除按钮样式。 | +| fontColor10+ | [ResourceColor](ts-types.md#resourcecolor) | 设置输入文本的字体颜色。 | +| caretStyle10+ | [CaretStyle](#caretstyle10对象说明) | 设置光标样式。 | + +## IconOptions10+对象说明 + +| 参数名 | 参数类型 | 必填 | 参数描述 | +| ------ | ------------------------------------------ | ---- | ----------- | +| size | [Length](ts-types.md#length) | 否 | 图标尺寸。 | +| color | [ResourceColor](ts-types.md#resourcecolor) | 否 | 图标颜色。 | +| src | [ResourceStr](ts-types.md#resourcestr) | 否 | 图标/图片源。 | + +## CaretStyle10+对象说明 + +| 参数名 | 参数类型 | 必填 | 参数描述 | +| ------ | ------------------------------------------ | ---- | -------- | +| width | [Length](ts-types.md#length) | 否 | 光标尺寸。 | +| color | [ResourceColor](ts-types.md#resourcecolor) | 否 | 光标颜色。 | + +## SearchButtonOption10+对象说明 + +| 参数名 | 参数类型 | 必填 | 参数描述 | +| --------- | ------------------------------------------ | ---- | ---------------- | +| fontSize | [Length](ts-types.md#length) | 否 | 文本按钮字体大小。 | +| fontColor | [ResourceColor](ts-types.md#resourcecolor) | 否 | 文本按钮字体颜色。 | + +## CancelButtonStyle10+枚举说明 + +| 名称 | 描述 | +| ----------------------- | ---------------- | +| CONSTANT10+ | 清除按钮常显样式。 | +| INVISIBLE10+ | 清除按钮常隐样式。 | +| INPUT10+ | 清除按钮输入样式。 | ## 事件 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-select.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-select.md index ab4d9d7023f1df2500ceaeaadfd592127967c68f..d1a5a97d999faa05df7d5ab6c97a22d46b4b67c6 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-select.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-select.md @@ -23,18 +23,29 @@ Select(options: Array\<[SelectOption](#selectoption对象说明)\>) ## 属性 +除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性: + | 名称 | 参数类型 | 描述 | | ----------------------- | ------------------------------------- | --------------------------------------------- | | selected | number | 设置下拉菜单初始选项的索引,第一项的索引为0。
当不设置selected属性时,默认选择值为-1,菜单项不选中。 | -| value | string | 设置下拉按钮本身的文本内容。 | -| font | [Font](ts-types.md#font) | 设置下拉按钮本身的文本样式。 | -| fontColor | [ResourceColor](ts-types.md#resourcecolor) | 设置下拉按钮本身的文本颜色。 | -| selectedOptionBgColor | [ResourceColor](ts-types.md#resourcecolor) | 设置下拉菜单选中项的背景色。 | -| selectedOptionFont | [Font](ts-types.md#font) | 设置下拉菜单选中项的文本样式。 | -| selectedOptionFontColor | [ResourceColor](ts-types.md#resourcecolor) | 设置下拉菜单选中项的文本颜色。 | -| optionBgColor | [ResourceColor](ts-types.md#resourcecolor) | 设置下拉菜单项的背景色。 | -| optionFont | [Font](ts-types.md#font) | 设置下拉菜单项的文本样式。 | -| optionFontColor | [ResourceColor](ts-types.md#resourcecolor) | 设置下拉菜单项的文本颜色。 | +| value | string | 设置下拉按钮本身的文本内容。当菜单选中时默认会替换为菜单项文本内容。 | +| font | [Font](ts-types.md#font) | 设置下拉按钮本身的文本样式。
默认值:
{
size: '16fp',
weight: FontWeight.Medium
} | +| fontColor | [ResourceColor](ts-types.md#resourcecolor) | 设置下拉按钮本身的文本颜色。
默认值:'\#E6FFFFFF' | +| selectedOptionBgColor | [ResourceColor](ts-types.md#resourcecolor) | 设置下拉菜单选中项的背景色。
默认值:'\#33007DFF' | +| selectedOptionFont | [Font](ts-types.md#font) | 设置下拉菜单选中项的文本样式。
默认值:
{
size: '16fp',
weight: FontWeight.Regular
} | +| selectedOptionFontColor | [ResourceColor](ts-types.md#resourcecolor) | 设置下拉菜单选中项的文本颜色。
默认值:'\#ff007dff' | +| optionBgColor | [ResourceColor](ts-types.md#resourcecolor) | 设置下拉菜单项的背景色。
默认值:'\#ffffffff' | +| optionFont | [Font](ts-types.md#font) | 设置下拉菜单项的文本样式。
默认值:
{
size: '16fp',
weight: FontWeight.Regular
} | +| optionFontColor | [ResourceColor](ts-types.md#resourcecolor) | 设置下拉菜单项的文本颜色。
默认值:'\#ff182431' | +| space10+ | [Length](ts-types.md#length) | 设置下拉菜单项的文本与箭头之间的间距。
**说明:**
不支持设置百分比。 | +| arrowPosition10+ | [ArrowPosition](#arrowposition10枚举说明) | 设置下拉菜单项的文本与箭头之间的对齐方式。
默认值:ArrowPosition.END | + +## ArrowPosition10+枚举说明 + +| 名称 | 描述 | +| ------------------- | ------------------ | +| END10+ | 文字在前,箭头在后。 | +| START10+ | 箭头在前,文字在后。 | ## 事件 @@ -49,20 +60,28 @@ Select(options: Array\<[SelectOption](#selectoption对象说明)\>) @Entry @Component struct SelectExample { + @State text: string = "TTTTT" + @State index: number = 2 + @State space: number = 8 + @State arrowPosition: ArrowPosition = ArrowPosition.END build() { Column() { Select([{ value: 'aaa', icon: "/common/public_icon.svg" }, { value: 'bbb', icon: "/common/public_icon.svg" }, { value: 'ccc', icon: "/common/public_icon.svg" }, { value: 'ddd', icon: "/common/public_icon.svg" }]) - .selected(2) - .value('TTTTT') + .selected(this.index) + .value(this.text) .font({ size: 16, weight: 500 }) .fontColor('#182431') .selectedOptionFont({ size: 16, weight: 400 }) .optionFont({ size: 16, weight: 400 }) - .onSelect((index: number) => { + .space(this.space) + .arrowPosition(this.arrowPosition) + .onSelect((index:number, text: string)=>{ console.info('Select:' + index) + this.index = index; + this.text = text; }) }.width('100%') } diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-slider.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-slider.md index c8d7d5482648345ceedf04c6b5036ed2b6655e6d..5339b622857b7c00c7aed5094a491901416d493d 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-slider.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-slider.md @@ -16,39 +16,66 @@ Slider(options?: {value?: number, min?: number, max?: number, step?: number, style?: SliderStyle, direction?: Axis, reverse?: boolean}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | | -------- | -------- | -------- | -------- | | value | number | 否 | 当前进度值。
默认值:0 | | min | number | 否 | 设置最小值。
默认值:0 | -| max | number | 否 | 设置最大值。
默认值:100 | -| step | number | 否 | 设置Slider滑动步长。
默认值:1
取值范围:[0.01, max] | +| max | number | 否 | 设置最大值。
默认值:100
**说明:**
min >= max异常情况,min取默认值0,max取默认值100。
value不在[min, max]范围之内,取min/max,靠近min取min,靠近max取max。 | +| step | number | 否 | 设置Slider滑动步长。
默认值:1
取值范围:[0.01, max]
**说明:**
设置小于0或百分比的值时,按默认值显示。 | | style | [SliderStyle](#sliderstyle枚举说明) | 否 | 设置Slider的滑块与滑轨显示样式。
默认值:SliderStyle.OutSet | | direction8+ | [Axis](ts-appendix-enums.md#axis) | 否 | 设置滑动条滑动方向为水平或竖直方向。
默认值:Axis.Horizontal | | reverse8+ | boolean | 否 | 设置滑动条取值范围是否反向,横向Slider默认为从左往右滑动,竖向Slider默认为从上往下滑动。
默认值:false | ## SliderStyle枚举说明 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | -------- | -------- | | OutSet | 滑块在滑轨上。 | | InSet | 滑块在滑轨内。 | - -## 属性 - 支持除触摸热区以外的通用属性设置。 | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| blockColor | [ResourceColor](ts-types.md#resourcecolor) | 设置滑块的颜色。 | -| trackColor | [ResourceColor](ts-types.md#resourcecolor) | 设置滑轨的背景颜色。 | -| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | 设置滑轨的已滑动部分颜色。 | -| showSteps | boolean | 设置当前是否显示步长刻度值。
默认值:false | -| showTips | boolean | 设置滑动时是否显示百分比气泡提示。
默认值:false | -| trackThickness | [Length](ts-types.md#length) | 设置滑轨的粗细。 | - +| blockColor | [ResourceColor](ts-types.md#resourcecolor) | 设置滑块的颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| trackColor | [ResourceColor](ts-types.md#resourcecolor) | 设置滑轨的背景颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | 设置滑轨的已滑动部分颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| showSteps | boolean | 设置当前是否显示步长刻度值。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| showTips | boolean | 设置滑动时是否显示百分比气泡提示。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
当direction的属性值为Axis.Horizontal时,tip显示在滑块正上方。值为Axis.Vertical时,tip显示在滑块正左边。
tip的绘制区域为Slider自身节点的overlay。
Slider不设置边距,或者边距比较小时,tip会被截断。 | +| trackThickness | [Length](ts-types.md#length) | 设置滑轨的粗细。
默认值:当参数style的值设置[SliderStyle](#sliderstyle枚举说明).OutSet 时为 4.0vp,[SliderStyle](#sliderstyle枚举说明).InSet时为20.0vp
从APIversion9开始,该接口支持在ArkTS卡片中使用。
**说明:**
设置为小于0的值时,按默认值显示。 | +| blockBorderColor10+ | [ResourceColor](ts-types.md#resourcecolor) | 设置滑块描边颜色。 | +| blockBorderWidth10+ | [Length](ts-types.md#length) | 设置滑块描边粗细。 | +| stepColor10+ | [ResourceColor](ts-types.md#resourcecolor) | 设置刻度颜色。 | +| trackBorderRadius10+ | [Length](ts-types.md#length) | 设置底板圆角半径。 | +| blockSize10+ | [SizeOptions](ts-types.md#sizeoptions) | 设置滑块大小。 | +| blockStyle10+ | [SliderBlockStyle](#sliderblockstyle10) | 设置滑块形状参数。 | +| stepSize10+ | [Length](ts-types.md#length) | 设置刻度大小(直径)。 | + +## SliderBlockStyle10+对象说明 + +Slider组件滑块形状参数。 + +| 名称 | 类型 | 必填 | 说明 | +| ----- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| type | [SliderBlockType](#sliderblocktype10) | 是 | 设置滑块形状。
默认值:SliderBlockType.DEFAULT,使用圆形滑块。 | +| image | [ResourceStr](ts-types.md#resourcestr) | 否 | 设置滑块图片资源。
图片显示区域大小由blockSize属性控制,请勿输入尺寸过大的图片。 | +| shape | [Circle](ts-drawing-components-circle.md) \| [Ellipse](ts-drawing-components-ellipse.md) \| [Path](ts-drawing-components-path.md) \| [Rect](ts-drawing-components-rect.md)  | 否 | 设置滑块使用的自定义形状。 | + +## SliderBlockType10+枚举说明 + +Slier组件滑块形状枚举。 + +| 名称 | 描述 | +| ------- | ---------------------- | +| DEFAULT | 使用默认滑块(圆形)。 | +| IMAGE | 使用图片资源作为滑块。 | +| SHAPE | 使用自定义形状作为滑块。 | ## 事件 @@ -56,15 +83,17 @@ Slider(options?: {value?: number, min?: number, max?: number, step?: number, sty | 名称 | 功能描述 | | -------- | -------- | -| onChange(callback: (value: number, mode: SliderChangeMode) => void) | Slider滑动时触发事件回调。
value:当前滑动进度值。若返回值有小数,可使用Math.toFixed()方法将数据处理为预期的精度。
mode:拖动状态。 | +| onChange(callback: (value: number, mode: SliderChangeMode) => void) | Slider拖到或点击时触发事件回调。
value:当前滑动进度值。若返回值有小数,可使用number.toFixed()方法将数据处理为预期的精度。
mode:事件触发的相关状态值。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
Begin和End状态当手势点击时都会触发,Moving和Click状态当value值发生变换时触发。
当连贯动作为拖动动作时,不触发Click状态。
value值的变化范围为对应步长steps数组。 | ## SliderChangeMode枚举说明 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 值 | 描述 | | -------- | -------- | -------- | -| Begin | 0 | 开始拖动滑块。 | +| Begin | 0 | 手势/鼠标接触或者按下滑块。 | | Moving | 1 | 正在拖动滑块过程中。 | -| End | 2 | 结束拖动滑块。 | +| End | 2 | 手势/鼠标离开滑块。 | | Click | 3 | 点击滑动条使滑块位置移动。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-span.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-span.md index 5e615e7033fbe11e87ff2746df9547684a56f2d9..ebe015253108955d4c0e4f8ad029367a42da08f3 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-span.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-span.md @@ -16,6 +16,8 @@ Span(value: string | Resource) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -29,9 +31,9 @@ Span(value: string | Resource) | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| decoration | {
type: [TextDecorationType](ts-appendix-enums.md#textdecorationtype),
color?: [ResourceColor](ts-types.md#resourcecolor)
} | 设置文本装饰线样式及其颜色。
默认值:{
type: TextDecorationType.None
color:Color.Black
} | -| letterSpacing | number \| string | 设置文本字符间距。取值小于0,字符聚集重叠,取值大于0且随着数值变大,字符间距越来越大,稀疏分布。 | -| textCase | [TextCase](ts-appendix-enums.md#textcase) | 设置文本大小写。
默认值:TextCase.Normal | +| decoration | {
type: [TextDecorationType](ts-appendix-enums.md#textdecorationtype),
color?: [ResourceColor](ts-types.md#resourcecolor)
} | 设置文本装饰线样式及其颜色。
默认值:{
type: TextDecorationType.None
color:Color.Black
}
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| letterSpacing | number \| string | 设置文本字符间距。取值小于0,字符聚集重叠,取值大于0且随着数值变大,字符间距越来越大,稀疏分布。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| textCase | [TextCase](ts-appendix-enums.md#textcase) | 设置文本大小写。
默认值:TextCase.Normal
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 事件 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-text.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-text.md index 5431ce7579ab88a9d4972bd4fde5c47b5ae5179d..863e73e9ef2faf1e3040b62d05a30fcf273d2f36 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-text.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-text.md @@ -9,13 +9,15 @@ ## 子组件 -可以包含[Span](ts-basic-components-span.md)子组件。 +可以包含[Span](ts-basic-components-span.md)和[ImageSpan](ts-basic-components-imagespan.md)子组件。 ## 接口 Text(content?: string | Resource) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -28,21 +30,28 @@ Text(content?: string | Resource) | 名称 | 参数类型 | 描述 | | ----------------------- | ----------------------------------- | ------------------------------------------- | -| textAlign | [TextAlign](ts-appendix-enums.md#textalign) | 设置文本段落在水平方向的对齐方式
默认值:TextAlign.Start
说明:
文本段落宽度占满Text组件宽度;可通过[align](ts-universal-attributes-location.md)属性控制文本段落在垂直方向上的位置。 | -| textOverflow | {overflow: [TextOverflow](ts-appendix-enums.md#textoverflow)} | 设置文本超长时的显示方式。
默认值:{overflow: TextOverflow.Clip}
**说明:**
文本截断是按字截断。例如,英文以单词为最小单位进行截断,若需要以字母为单位进行截断,可在字母间添加零宽空格:\u200B。
需配合`maxLines`使用,单独设置不生效。 | -| maxLines | number | 设置文本的最大行数。
默认值:Infinity
**说明:**
默认情况下,文本是自动折行的,如果指定此参数,则文本最多不会超过指定的行。如果有多余的文本,可以通过 `textOverflow`来指定截断方式。 | -| lineHeight | string \| number \| [Resource](ts-types.md#resource) | 设置文本的文本行高,设置值不大于0时,不限制文本行高,自适应字体大小,Length为number类型时单位为fp。 | -| decoration | {
type: [TextDecorationType](ts-appendix-enums.md#textdecorationtype),
color?: [ResourceColor](ts-types.md#resourcecolor)
} | 设置文本装饰线样式及其颜色。
默认值:{
type: TextDecorationType.None,
color:Color.Black
} | -| baselineOffset | number \| string | 设置文本基线的偏移量,默认值0。 | -| letterSpacing | number \| string | 设置文本字符间距。 | -| minFontSize | number \| string \| [Resource](ts-types.md#resource) | 设置文本最小显示字号。
需配合maxFontSize以及maxline或布局大小限制使用,单独设置不生效。 | -| maxFontSize | number \| string \| [Resource](ts-types.md#resource) | 设置文本最大显示字号。
需配合minFontSize以及maxline或布局大小限制使用,单独设置不生效。 | -| textCase | [TextCase](ts-appendix-enums.md#textcase) | 设置文本大小写。
默认值:TextCase.Normal | -| copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | 组件支持设置文本是否可复制粘贴。
默认值:CopyOptions.None | +| textAlign | [TextAlign](ts-appendix-enums.md#textalign) | 设置文本段落在水平方向的对齐方式
默认值:TextAlign.Start
说明:
文本段落宽度占满Text组件宽度;可通过[align](ts-universal-attributes-location.md)属性控制文本段落在垂直方向上的位置。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| textOverflow | {overflow: [TextOverflow](ts-appendix-enums.md#textoverflow)} | 设置文本超长时的显示方式。
默认值:{overflow: TextOverflow.Clip}
**说明:**
文本截断是按字截断。例如,英文以单词为最小单位进行截断,若需要以字母为单位进行截断,可在字母间添加零宽空格:\u200B。
当`overflow`设置为TextOverflow.None、TextOverflow.Clip、TextOverflow.Ellipsis时,需配合`maxLines`使用,单独设置不生效。当`overflow`设置为TextOverflow.Marquee时,文本在一行内滚动显示,不需要设置`maxLines`属性。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| maxLines | number | 设置文本的最大行数。
默认值:Infinity
**说明:**
默认情况下,文本是自动折行的,如果指定此参数,则文本最多不会超过指定的行。如果有多余的文本,可以通过 `textOverflow`来指定截断方式。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| lineHeight | string \| number \| [Resource](ts-types.md#resource) | 设置文本的文本行高,设置值不大于0时,不限制文本行高,自适应字体大小,Length为number类型时单位为fp。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| decoration | {
type: [TextDecorationType](ts-appendix-enums.md#textdecorationtype),
color?: [ResourceColor](ts-types.md#resourcecolor)
} | 设置文本装饰线样式及其颜色。
默认值:{
type: TextDecorationType.None,
color:Color.Black
}
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| baselineOffset | number \| string | 设置文本基线的偏移量,默认值0。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
设置该值为百分比时,按默认值显示。 | +| letterSpacing | number \| string | 设置文本字符间距。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
设置该值为百分比时,按默认值显示。 | +| minFontSize | number \| string \| [Resource](ts-types.md#resource) | 设置文本最小显示字号。
需配合maxFontSize以及maxline或布局大小限制使用,单独设置不生效。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| maxFontSize | number \| string \| [Resource](ts-types.md#resource) | 设置文本最大显示字号。
需配合minFontSize以及maxline或布局大小限制使用,单独设置不生效。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| textCase | [TextCase](ts-appendix-enums.md#textcase) | 设置文本大小写。
默认值:TextCase.Normal
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | 组件支持设置文本是否可复制粘贴。
默认值:CopyOptions.None
该接口支持在ArkTS卡片中使用。 | +| textShadow10+ | [ShadowOptions](ts-universal-attributes-image-effect.md#shadowoptions对象说明) | 设置文字阴影效果。 | +| heightAdaptivePolicy10+ | [TextHeightAdaptivePolicy](ts-appendix-enums.md#TextHeightAdaptivePolicy10) | 设置文本自适应高度的方式。 | +| textIndent10+ | number \| string | 设置首行文本缩进,默认值0。 | > **说明:** > -> 不支持Text内同时存在文本内容和Span子组件。如果同时存在,只显示Span内的内容。 +> 不支持Text内同时存在文本内容和Span或ImageSpan子组件。如果同时存在,只显示Span或ImageSpan内的内容。 + +## 事件 + +支持[通用事件](ts-universal-events-click.md)。 ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textarea.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textarea.md index 2acf7d3a89ea1d74e5387040fedb05ddd98fe148..f9d875ecc81448a2e8ad0a29515bd32b8bda55d4 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textarea.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textarea.md @@ -20,8 +20,8 @@ TextArea(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: Tex | 参数名 | 参数类型 | 必填 | 参数描述 | | ----------------------- | ---------------------------------------- | ---- | -------------- | -| placeholder | [ResourceStr](ts-types.md#resourcestr) | 否 | 设置无输入时的提示文本。 | -| text | [ResourceStr](ts-types.md#resourcestr) | 否 | 设置输入框当前的文本内容。 | +| placeholder | [ResourceStr](ts-types.md#resourcestr) | 否 | 设置无输入时的提示文本。输入内容后,提示文本不显示。 | +| text | [ResourceStr](ts-types.md#resourcestr) | 否 | 设置输入框当前的文本内容。
当组件设置[stateStyles](ts-universal-attributes-polymorphic-style.md)等刷新属性时,建议通过onChange事件将状态变量与文本实时绑定,
避免组件刷新时TextArea中的文本内容异常。 | | controller8+ | [TextAreaController](#textareacontroller8) | 否 | 设置TextArea控制器。 | @@ -29,14 +29,18 @@ TextArea(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: Tex 除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性: -| 名称 | 参数类型 | 描述 | -| ------------------------ | ---------------------------------------- | ---------------------------------------- | -| placeholderColor | [ResourceColor](ts-types.md#resourcecolor) | 设置placeholder文本颜色。 | -| placeholderFont | [Font](ts-types.md#font) | 设置placeholder文本样式。 | -| textAlign | [TextAlign](ts-appendix-enums.md#textalign) | 设置文本在输入框中的水平对齐式。
默认值:TextAlign.Start | -| caretColor | [ResourceColor](ts-types.md#resourcecolor) | 设置输入框光标颜色。 | +| 名称 | 参数类型 | 描述 | +| ------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| placeholderColor | [ResourceColor](ts-types.md#resourcecolor) | 设置placeholder文本颜色。 | +| placeholderFont | [Font](ts-types.md#font) | 设置placeholder文本样式,包括字体大小,字体粗细,字体族,字体风格。目前仅支持默认字体族。 | +| textAlign | [TextAlign](ts-appendix-enums.md#textalign) | 设置文本在输入框中的水平对齐式。
默认值:TextAlign.Start | +| caretColor | [ResourceColor](ts-types.md#resourcecolor) | 设置输入框光标颜色。 | | inputFilter8+ | {
value: [ResourceStr](ts-types.md#resourcestr),
error?: (value: string) => void
} | 通过正则表达式设置输入过滤器。匹配表达式的输入允许显示,不匹配的输入将被过滤。仅支持单个字符匹配,不支持字符串匹配。
- value:设置正则表达式。
- error:正则匹配失败时,返回被过滤的内容。 | -| copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | 设置输入的文本是否可复制。
设置CopyOptions.None时,当前TextArea中的文字无法被复制或剪切,仅支持粘贴。 | +| copyOption9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | 设置输入的文本是否可复制。
设置CopyOptions.None时,当前TextArea中的文字无法被复制或剪切,仅支持粘贴。 | + +> **说明:** +> +> [通用属性padding](ts-universal-attributes-size.md)的默认值为:
{
 top: 8 vp,
 right: 16 vp,
 bottom: 8 vp,
 left: 16 vp
} ## 事件 @@ -45,7 +49,8 @@ TextArea(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: Tex | 名称 | 功能描述 | | ------------------------------------------------------------ | ------------------------------------------------------------ | -| onChange(callback: (value: string) => void) | 输入内容发生变化时,触发该回调。
- value:当前输入的文本内容。 | +| onChange(callback: (value: string) => void) | 输入内容发生变化时,触发该回调。
- value:当前输入的文本内容。 | +| onEditChange(callback: (isEditing: boolean) => void)10+ | 输入状态变化时,触发该回调。有光标时为编辑态,无光标时为非编辑态。isEditing为true表示正在输入。 | | onCopy8+(callback:(value: string) => void) | 长按输入框内部区域弹出剪贴板后,点击剪切板复制按钮,触发该回调。
- value:复制的文本内容。 | | onCut8+(callback:(value: string) => void) | 长按输入框内部区域弹出剪贴板后,点击剪切板剪切按钮,触发该回调。
- value:剪切的文本内容。 | | onPaste8+(callback:(value: string) => void) | 长按输入框内部区域弹出剪贴板后,点击剪切板粘贴按钮,触发该回调。
- value:粘贴的文本内容。 | @@ -72,6 +77,18 @@ caretPosition(value: number): void | ------ | -------- | ---- | -------------------------------------- | | value | number | 是 | 从字符串开始到光标所在位置的字符长度。 | +### setTextSelection10+ + +setTextSelection(selectionStart: number, selectionEnd: number): void + +设置文本选择范围。 + +**参数:** + +| 参数名 | 参数类型 | 必填 | 参数描述 | +| -------------- | -------- | ---- | ------------------ | +| selectionStart | number | 是 | 选择范围起始位置。 | +| selectionEnd | number | 是 | 选择范围结束位置。 | ## 示例 @@ -86,6 +103,7 @@ struct TextAreaExample { build() { Column() { TextArea({ + text: this.text, placeholder: 'The text area can hold an unlimited amount of text. input your word...', controller: this.controller }) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textinput.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textinput.md index b83500ff338d1136298dc5b085b2dcda8aa391ff..18078cdd83a821c791a67dcbadabe299d08dc693 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textinput.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textinput.md @@ -21,7 +21,7 @@ TextInput(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: Te | 参数名 | 参数类型 | 必填 | 参数描述 | | ----------------------- | ---------------------------------------- | ---- | --------------- | | placeholder | [ResourceStr](ts-types.md#resourcestr) | 否 | 设置无输入时的提示文本。 | -| text | [ResourceStr](ts-types.md#resourcestr) | 否 | 设置输入框当前的文本内容。 | +| text | [ResourceStr](ts-types.md#resourcestr) | 否 | 设置输入框当前的文本内容。
当组件设置[stateStyles](ts-universal-attributes-polymorphic-style.md)等刷新属性时,建议通过onChange事件将状态变量与文本实时绑定,
避免组件刷新时TextInput中的文本内容异常。 | | controller8+ | [TextInputController](#textinputcontroller8) | 否 | 设置TextInput控制器。 | @@ -34,7 +34,7 @@ TextInput(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: Te | type | [InputType](#inputtype枚举说明) | 设置输入框类型。
默认值:InputType.Normal | | placeholderColor | [ResourceColor](ts-types.md#resourcecolor) | 设置placeholder文本颜色。| | placeholderFont | [Font](ts-types.md#font) | 设置placeholder文本样式。 | -| enterKeyType | [EnterKeyType](#enterkeytype枚举说明) | 设置输入法回车键类型,目前OpenHarmony输入法仅支持默认类型显示。
默认值:EnterKeyType.Done | +| enterKeyType | [EnterKeyType](#enterkeytype枚举说明) | 设置输入法回车键类型,目前仅支持默认类型显示。
默认值:EnterKeyType.Done | | caretColor | [ResourceColor](ts-types.md#resourcecolor) | 设置输入框光标颜色。 | | maxLength | number | 设置文本的最大输入字符数。 | | inputFilter8+ | {
value: [ResourceStr](ts-types.md#resourcestr),
error?: (value: string) => void
} | 正则表达式,匹配表达式的输入允许显示,不匹配的输入将被过滤。目前仅支持单个字符匹配,不支持字符串匹配。
- value:设置正则表达式。
- error:正则匹配失败时,返回被过滤的内容。 | @@ -42,6 +42,13 @@ TextInput(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: Te | showPasswordIcon9+ | boolean | 密码输入模式时,输入框末尾的图标是否显示。
默认值:true | | style9+ | [TextInputStyle](#textinputstyle9枚举说明) | 设置输入框为默认风格或内联输入风格。
默认值:TextInputStyle.Default | | textAlign9+ | [TextAlign](ts-appendix-enums.md#textalign) | 设置输入文本在输入框中的对齐方式。
默认值:TextAlign.Start | +| selectedBackgroundColor10+ | [ResourceColor](ts-types.md#resourcecolor) | 设置文本选中底板颜色。 | +| caretStyle10+ | {
width: [Length](ts-types.md#length)
} | 设置光标风格。 | +| caretPosition10+ | number | 设置光标位置。 | + +> **说明:** +> +> [通用属性padding](ts-universal-attributes-size.md)的默认值为:
{
 top: 8 vp,
 right: 16 vp,
 bottom: 8 vp,
 left: 16 vp
} ## EnterKeyType枚举说明 @@ -58,8 +65,8 @@ TextInput(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: Te | 名称 | 描述 | | ------------------ | ------------- | | Normal | 基本输入模式。
支持输入数字、字母、下划线、空格、特殊字符。 | -| Password | 密码输入模式。 | -| Email | 邮箱地址输入模式。 | +| Password | 密码输入模式。支持输入数字、字母、下划线、空格、特殊字符。密码显示小眼睛图标并且默认会将文字变成圆点。 | +| Email | 邮箱地址输入模式。支持数字,字母,下划线,以及@字符(只能存在一个@字符)。 | | Number | 纯数字输入模式。 | | PhoneNumber9+ | 电话号码输入模式。
支持输入数字、+ 、-、*、#,长度不限。 | @@ -76,10 +83,10 @@ TextInput(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: Te | 名称 | 功能描述 | | ------------------------------------------------------------ | ------------------------------------------------------------ | -| onChange(callback: (value: string) => void) | 输入内容发生变化时,触发该回调。
value:输入的文本内容。 | +| onChange(callback: (value: string) => void) | 输入内容发生变化时,触发该回调。
value:输入的文本内容。
触发该事件的条件:
1、键盘输入。
2、粘贴、剪切。
3、键盘快捷键Ctrl+v。 | | onSubmit(callback: (enterKey: EnterKeyType) => void) | 按下输入法回车键触发该回调,返回值为当前输入法回车键的类型。
enterKeyType:输入法回车键类型。具体类型见[EnterKeyType枚举说明](#enterkeytype枚举说明)。 | | onEditChanged(callback: (isEditing: boolean) => void)(deprecated) | 输入状态变化时,触发该回调。从API 8开始,建议使用onEditChange。 | -| onEditChange(callback: (isEditing: boolean) => void)8+ | 输入状态变化时,触发该回调。isEditing为true表示正在输入。 | +| onEditChange(callback: (isEditing: boolean) => void)8+ | 输入状态变化时,触发该回调。有光标时为编辑态,无光标时为非编辑态。isEditing为true表示正在输入。 | | onCopy(callback:(value: string) => void)8+ | 长按输入框内部区域弹出剪贴板后,点击剪切板复制按钮,触发该回调。
value:复制的文本内容。 | | onCut(callback:(value: string) => void)8+ | 长按输入框内部区域弹出剪贴板后,点击剪切板剪切按钮,触发该回调。
value:剪切的文本内容。 | | onPaste(callback:(value: string) => void)8+ | 长按输入框内部区域弹出剪贴板后,点击剪切板粘贴按钮,触发该回调。
value:粘贴的文本内容。 | @@ -103,7 +110,18 @@ caretPosition(value: number): void | 参数名 | 参数类型 | 必填 | 参数描述 | | ------ | -------- | ---- | -------------------------------------- | | value | number | 是 | 从字符串开始到光标所在位置的字符长度。 | +### setTextSelection10+ + +setTextSelection(selectionStart: number, selectionStart: number): void +设置文本选择区域并高亮显示。 + +**参数:** + +| 参数名 | 参数类型 | 必填 | 参数描述 | +| -------------- | -------- | ---- | ---------------------- | +| selectionStart | number | 是 | 文本选择区域起始位置,文本框中文字的起始位置为0。 | +| selectionEnd | number | 是 | 文本选择区域结束位置。 | ## 示例 @@ -117,7 +135,7 @@ struct TextInputExample { build() { Column() { - TextInput({ placeholder: 'input your word...', controller: this.controller }) + TextInput({ text: this.text, placeholder: 'input your word...', controller: this.controller }) .placeholderColor(Color.Grey) .placeholderFont({ size: 14, weight: 400 }) .caretColor(Color.Blue) @@ -126,6 +144,9 @@ struct TextInputExample { .margin(20) .fontSize(14) .fontColor(Color.Black) + .inputFilter('[a-z]', (e) => { + console.log(JSON.stringify(e)) + }) .onChange((value: string) => { this.text = value }) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textpicker.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textpicker.md index 6a85cfa4b5e25080a61ffabfb1bcc05660b802bd..9d0f54ed31280dd0ac07a94793a8653e953ef1f3 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textpicker.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-textpicker.md @@ -14,7 +14,7 @@ ## 接口 -TextPicker(options?: {range: string[]|Resource, selected?: number, value?: string}) +TextPicker(options?: {range: string[]|Resource|TextPickerRangeContent[], selected?: number, value?: string}) 根据range指定的选择范围创建文本选择器。 @@ -22,15 +22,27 @@ TextPicker(options?: {range: string[]|Resource, selected?: number, value?: strin | 参数名 | 参数类型 | 必填 | 参数描述 | | -------- | -------- | -------- | -------- | -| range | string[] \| [Resource](ts-types.md#resource类型) | 是 | 选择器的数据选择列表。 | +| range | string[] \| [Resource](ts-types.md#resource类型)\|[TextPickerRangeContent](#textpickerrangecontent10类型说明)[]10+ | 是 | 选择器的数据选择列表。不可设置为空数组,若设置为空数组,则不显示;若动态变化为空数组,则保持当前正常值显示。 | | selected | number | 否 | 设置默认选中项在数组中的索引值。
默认值:0 | -| value | string | 否 | 设置默认选中项的值,优先级低于selected。
默认值:第一个元素值 | +| value | string | 否 | 设置默认选中项的值,优先级低于selected。
默认值:第一个元素值
**说明**:只有显示文本列表时该值有效。显示图片或图片加文本的列表时,该值无效。 | + +## TextPickerRangeContent10+类型说明 + +| 参数名 | 参数类型 | 必填 | 参数描述 | +| ------ | -------------------------------------------------------- | ---- | ---------- | +| icon | string \| [Resource](ts-types.md#resource) | 是 | 图片资源。 | +| text | string \| [Resource](ts-types.md#resource) | 否 | 文本信息。 | ## 属性 +除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性: + | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | | defaultPickerItemHeight | number \| string | 设置Picker各选择项的高度。 | +| disappearTextStyle10+ | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10类型说明) | 设置所有选项中最上和最下两个选项的文本颜色、字号、字体粗细。 | +| textStyle10+ | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10类型说明) | 设置所有选项中除了最上、最下及选中项以外的文本颜色、字号、字体粗细。 | +| selectedTextStyle10+ | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10类型说明) | 设置选中项的文本颜色、字号、字体粗细。 | ## 事件 @@ -38,7 +50,7 @@ TextPicker(options?: {range: string[]|Resource, selected?: number, value?: strin | 名称 | 描述 | | -------- | -------- | -| onChange(callback: (value: string, index: number) => void) | 滑动选中TextPicker文本内容后,触发该回调。
- value: 当前选中项的文本。
- index: 当前选中项的索引值。 | +| onChange(callback: (value: string, index: number) => void) | 滑动选中TextPicker文本内容后,触发该回调。
- value: 当前选中项的文本。
**说明**:当显示文本或图片加文本列表时,value值为选中项中的文本值,当显示图片列表时,value值为空。
- index: 当前选中项的索引值。 | ## 示例 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 96f6ea4e8d5d0d27c45970c2d4c744fa703d5123..6e0725e30db7e747778055b03d69f113e1030b32 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 @@ -1,6 +1,6 @@ # TimePicker -滑动选择时间的组件。 +时间选择组件,根据指定参数创建选择器,支持选择小时及分钟。 > **说明:** > @@ -20,20 +20,25 @@ TimePicker(options?: {selected?: Date}) **参数:** -| 参数名 | 参数类型 | 必填 | 参数描述 | -| -------- | -------- | -------- | -------- | -| selected | Date | 否 | 设置选中项的时间。
默认值:当前系统时间 | - +| 参数名 | 参数类型 | 必填 | 参数描述 | +| -------- | ---- | ---- | ------------------------ | +| selected | Date | 否 | 设置选中项的时间。
默认值:当前系统时间 | ## 属性 -| 名称 | 参数类型 | 描述 | -| -------- | -------- | -------- | -| useMilitaryTime | boolean | 展示时间是否为24小时制,不支持动态修改。
默认值:false | +除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性: +| 名称 | 参数类型 | 描述 | +| -------------------------------- | ---------------------------------------- | ----------------------------------- | +| useMilitaryTime | boolean | 展示时间是否为24小时制,不支持动态修改。
默认值:false | +| disappearTextStyle10+ | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10类型说明) | 设置所有选项中最上和最下两个选项的文本颜色、字号、字体粗细。 | +| textStyle10+ | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10类型说明) | 设置所有选项中除了最上、最下及选中项以外的文本颜色、字号、字体粗细。 | +| selectedTextStyle10+ | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10类型说明) | 设置选中项的文本颜色、字号、字体粗细。 | ## 事件 +除支持[通用事件](ts-universal-events-click.md)外,还支持以下事件: + | 名称 | 功能描述 | | ---------------------------------------- | ----------- | | onChange(callback: (value: TimePickerResult ) => void) | 选择时间时触发该事件。 | @@ -48,9 +53,6 @@ TimePicker(options?: {selected?: Date}) ## 示例 - -### 时间选择器 - ```ts // xxx.ets @Entry diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-toggle.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-toggle.md index e82389ae717ae5ca876dd07954276f49af52df95..949cd14f77d1311bc4b4bbc10c8e8a16baabe02d 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-toggle.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-components-toggle.md @@ -6,10 +6,6 @@ > > 该组件从API Version 8开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 - - - - ## 子组件 仅当ToggleType为Button时可包含子组件。 @@ -19,35 +15,42 @@ Toggle(options: { type: ToggleType, isOn?: boolean }) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | | ---- | ---------- | -----| -------------- | -| type | [ToggleType](#toggletype枚举说明) | 是 | 开关类型。 | +| type | [ToggleType](#toggletype枚举说明) | 是 | 开关的样式。 | | isOn | boolean | 否 | 开关是否打开,true:打开,false:关闭。
默认值:false | ## ToggleType枚举说明 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | -------- | ---------------- | -| Checkbox | 提供单选框样式。
**说明:**
[通用属性padding](ts-universal-attributes-size.md)的默认值为:
{
 top: 14 vp,
 right: 6 vp,
 bottom: 14 vp,
 left: 6 vp
} | +| Checkbox | 提供单选框样式。
**说明:**
[通用属性margin](ts-universal-attributes-size.md)的默认值为:
{
 top: 12 vp,
 right: 12 vp,
 bottom: 12 vp,
 left: 12 vp
} | | Button | 提供状态按钮样式,如果子组件有文本设置,则相应的文本内容会显示在按钮内部。 | -| Switch | 提供开关样式。
**说明:**
[通用属性padding](ts-universal-attributes-size.md)默认值为:
{
 top: 12 vp,
 right: 12 vp,
 bottom: 12 vp,
 left: 12 vp
} | - +| Switch | 提供开关样式。
**说明:**
[通用属性margin](ts-universal-attributes-size.md)默认值为:
{
 top: 14 vp,
 right:6 vp,
 bottom: 6 vp,
 left: 14 vp
} | ## 属性 +除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性: + | 名称 | 参数 | 参数描述 | | ---------------- | --------------------------- | ---------------------- | -| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | 设置组件打开状态的背景颜色。 | -| switchPointColor | [ResourceColor](ts-types.md#resourcecolor) | 设置Switch类型的圆形滑块颜色。
**说明:**
仅对type为ToggleType.Switch生效。 | - +| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | 设置组件打开状态的背景颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| switchPointColor | [ResourceColor](ts-types.md#resourcecolor) | 设置Switch类型的圆形滑块颜色。
**说明:**
仅对type为ToggleType.Switch生效。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 事件 +除支持[通用事件](ts-universal-events-click.md)外,还支持以下事件: + | 名称 | 功能描述 | | -------- | -------- | -| onChange(callback: (isOn: boolean) => void) | 开关状态切换时触发该事件。 | +| onChange(callback: (isOn: boolean) => void) | 开关状态切换时触发该事件。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
isOn为true时,代表状态从关切换为开。isOn为false时,代表状态从开切换为关。 | ## 示例 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 index dbe81d0fad2e5eb7414e7048e323617297084736..c6243e6affdf3f13cec7b60afb0413db1a35b416 100755 --- 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 @@ -1,6 +1,6 @@ # Web -提供具有网页显示能力的Web组件。 +提供具有网页显示能力的Web组件,[@ohos.web.webview](../apis/js-apis-webview.md)提供web控制能力。 > **说明:** > @@ -27,7 +27,7 @@ Web(options: { src: ResourceStr, controller: WebviewController | WebController}) | 参数名 | 参数类型 | 必填 | 参数描述 | | ---------- | ---------------------------------------- | ---- | ------- | -| src | [ResourceStr](ts-types.md) | 是 | 网页资源地址。如果访问本地资源文件,请使用$rawfile或者resource协议。 | +| src | [ResourceStr](ts-types.md) | 是 | 网页资源地址。如果访问本地资源文件,请使用$rawfile或者resource协议。如果加载应用包外沙箱路径的本地资源文件,请使用file://沙箱文件路径。 | | controller | [WebviewController9+](../apis/js-apis-webview.md#webviewcontroller) \| [WebController](#webcontroller) | 是 | 控制器。从API Version 9开始,WebController不在维护,建议使用WebviewController替代。 | **示例:** @@ -84,6 +84,43 @@ Web(options: { src: ResourceStr, controller: WebviewController | WebController}) } ``` + 加载沙箱路径下的本地资源文件 + + 1.通过[globalthis](../../application-models/uiability-data-sync-with-ui.md#uiability和page之间使用globalthis)获取沙箱路径。 + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview' + let url = 'file://' + globalThis.filesDir + '/xxx.html' + + @Entry + @Component + struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController() + build() { + Column() { + // 加载沙箱路径文件。 + Web({ src: url, controller: this.controller }) + } + } + } + ``` + + 2.修改MainAbility.ts。 + 以filesDir为例,获取沙箱路径。若想获取其他路径,请参考[应用开发路径](../../application-models/application-context-stage.md#获取应用开发路径)。 + ```ts + // xxx.ts + import UIAbility from '@ohos.app.ability.UIAbility'; + import web_webview from '@ohos.web.webview'; + + export default class EntryAbility extends UIAbility { + onCreate(want, launchParam) { + // 通过在globalThis对象上绑定filesDir,可以实现UIAbility组件与UI之间的数据同步。 + globalThis.filesDir = this.context.filesDir + console.log("Sandbox path is " + globalThis.filesDir) + } + } + ``` + ```html @@ -497,6 +534,7 @@ mediaPlayGestureAccess(access: boolean) multiWindowAccess(multiWindow: boolean) 设置是否开启多窗口权限,默认不开启。 +使能多窗口权限时,需要实现onWindowNew事件,示例代码参考[onWindowNew事件](#onwindownew9)。 **参数:** @@ -517,7 +555,7 @@ multiWindowAccess(multiWindow: boolean) build() { Column() { Web({ src: 'www.example.com', controller: this.controller }) - .multiWindowAccess(true) + .multiWindowAccess(false) } } } @@ -1194,7 +1232,7 @@ struct WebComponent { } ``` -### allowWindowOpenMethod9+ +### allowWindowOpenMethod10+ allowWindowOpenMethod(flag: boolean) @@ -1224,19 +1262,89 @@ allowWindowOpenMethod(flag: boolean) ```ts // xxx.ets import web_webview from '@ohos.web.webview' + //在同一page页有两个web组件。在WebComponent新开窗口时,会跳转到NewWebViewComp。 + @CustomDialog + struct NewWebViewComp { + controller: CustomDialogController + webviewController1: web_webview.WebviewController + build() { + Column() { + Web({ src: "", controller: this.webviewController1 }) + .javaScriptAccess(true) + .multiWindowAccess(false) + .onWindowExit(()=> { + console.info("NewWebViewComp onWindowExit") + this.controller.close() + }) + } + } + } + @Entry @Component struct WebComponent { controller: web_webview.WebviewController = new web_webview.WebviewController() - @State access: boolean = true - @State multiWindow: boolean = true - @State flag: boolean = true + dialogController: CustomDialogController = null build() { Column() { Web({ src: 'www.example.com', controller: this.controller }) - .javaScriptAccess(this.access) - .multiWindowAccess(this.multiWindow) - .allowWindowOpenMethod(this.flag) + .javaScriptAccess(true) + //需要使能multiWindowAccess + .multiWindowAccess(true) + .allowWindowOpenMethod(true) + .onWindowNew((event) => { + if (this.dialogController) { + this.dialogController.close() + } + let popController:web_webview.WebviewController = new web_webview.WebviewController() + this.dialogController = new CustomDialogController({ + builder: NewWebViewComp({webviewController1: popController}) + }) + this.dialogController.open() + //将新窗口对应WebviewController返回给Web内核。 + //如果不需要打开新窗口请调用event.handler.setWebController接口设置成null。 + //若不调用event.handler.setWebController接口,会造成render进程阻塞。 + event.handler.setWebController(popController) + }) + } + } + } + ``` + +### mediaOptions10+ + +mediaOptions(options: WebMediaOptions) + +设置Web媒体播放的策略,其中包括:Web中的音频在重新获焦后能够自动续播的有效期、应用内多个Web实例的音频是否独占。 + +> **说明:** +> +> - 同一Web实例中的多个音频均视为同一音频。 +> - 该媒体播放策略将同时管控有声视频。 +> - 属性参数更新后需重新播放音频方可生效。 +> - 建议为所有Web组件设置相同的audioExclusive值。 + +**参数:** + +| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | +| ------ | ----------- | ---- | --------------- | ------------------ | +| options | [WebMediaOptions](#webmediaoptions10) | 是 | {resumeInterval: 0, audioExclusive: true} | 设置Web的媒体策略。其中,resumeInterval的默认值为0表示不自动续播。 | + +**示例:** + + + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry + @Component + struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController() + @State options: WebMediaOptions = {resumeInterval: 10, audioExclusive: true} + build() { + Column() { + Web({ src: 'www.example.com', controller: this.controller }) + .mediaOptions(this.options) } } } @@ -1826,7 +1934,7 @@ onRefreshAccessedHistory(callback: (event?: { url: string, isRefreshed: boolean | 参数名 | 参数类型 | 参数描述 | | ----------- | ------- | ---------------------------------------- | | url | string | 访问的url。 | -| isRefreshed | boolean | true表示该页面是被重新加载的(调用[refresh](#refresh)接口),false表示该页面是新加载的。 | +| isRefreshed | boolean | true表示该页面是被重新加载的(调用[refresh9+](../apis/js-apis-webview.md#refresh)接口),false表示该页面是新加载的。 | **示例:** @@ -2011,11 +2119,12 @@ onScaleChange(callback: (event: {oldScale: number, newScale: number}) => void) } ``` -### onUrlLoadIntercept +### onUrlLoadIntercept(deprecated) onUrlLoadIntercept(callback: (event?: { data:string | WebResourceRequest }) => boolean) 当Web组件加载url之前触发该回调,用于判断是否阻止此次访问。默认允许加载。 +从API version 10开始不在维护,建议使用[onLoadIntercept10+](#onloadintercept10)代替。 **参数:** @@ -2682,7 +2791,9 @@ onFullScreenExit(callback: () => void) onWindowNew(callback: (event: {isAlert: boolean, isUserTrigger: boolean, targetUrl: string, handler: ControllerHandler}) => void) -通知用户新建窗口请求。 +使能multiWindowAccess情况下,通知用户新建窗口请求。 +若不调用event.handler.setWebController接口,会造成render进程阻塞。 +如果不需要打开新窗口,在调用event.handler.setWebController接口时须设置成null。 **参数:** @@ -2698,19 +2809,51 @@ onWindowNew(callback: (event: {isAlert: boolean, isUserTrigger: boolean, targetU ```ts // xxx.ets import web_webview from '@ohos.web.webview' + + //在同一page页有两个web组件。在WebComponent新开窗口时,会跳转到NewWebViewComp。 + @CustomDialog + struct NewWebViewComp { + controller: CustomDialogController + webviewController1: web_webview.WebviewController + build() { + Column() { + Web({ src: "", controller: this.webviewController1 }) + .javaScriptAccess(true) + .multiWindowAccess(false) + .onWindowExit(()=> { + console.info("NewWebViewComp onWindowExit") + this.controller.close() + }) + } + } + } + @Entry @Component struct WebComponent { controller: web_webview.WebviewController = new web_webview.WebviewController() + dialogController: CustomDialogController = null build() { Column() { - Web({ src:'www.example.com', controller: this.controller }) - .multiWindowAccess(true) - .onWindowNew((event) => { - console.log("onWindowNew...") - var popController: web_webview.WebviewController = new web_webview.WebviewController() - event.handler.setWebController(popController) - }) + Web({ src: 'www.example.com', controller: this.controller }) + .javaScriptAccess(true) + //需要使能multiWindowAccess + .multiWindowAccess(true) + .allowWindowOpenMethod(true) + .onWindowNew((event) => { + if (this.dialogController) { + this.dialogController.close() + } + let popController:web_webview.WebviewController = new web_webview.WebviewController() + this.dialogController = new CustomDialogController({ + builder: NewWebViewComp({webviewController1: popController}) + }) + this.dialogController.open() + //将新窗口对应WebviewController返回给Web内核。 + //如果不需要打开新窗口请调用event.handler.setWebController接口设置成null。 + //若不调用event.handler.setWebController接口,会造成render进程阻塞。 + event.handler.setWebController(popController) + }) } } } @@ -2953,7 +3096,7 @@ onFaviconReceived(callback: (event: {favicon: image.PixelMap}) => void) Column() { Web({ src:'www.example.com', controller: this.controller }) .onFaviconReceived((event) => { - console.log('onFaviconReceived:' + JSON.stringify(event)) + console.log('onFaviconReceived'); this.icon = event.favicon; }) } @@ -2995,6 +3138,86 @@ onAudioStateChanged(callback: (event: { playing: boolean }) => void) } ``` +### onFirstContentfulPaint10+ + +onFirstContentfulPaint(callback: (event?: { navigationStartTick: number, firstContentfulPaintMs: number }) => void) + +设置网页首次内容绘制回调函数。 + +**参数:** + +| 参数名 | 参数类型 | 参数描述 | +| -----------------------| -------- | ----------------------------------- | +| navigationStartTick | number | navigation开始的时间,单位以微秒表示。| +| firstContentfulPaintMs | number | 从navigation开始第一次绘制内容的时间,单位是以毫秒表示。| + +**示例:** + + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview' + @Entry + @Component + struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController() + + build() { + Column() { + Web({ src:'www.example.com', controller: this.controller }) + .onFirstContentfulPaint(event => { + console.log("onFirstContentfulPaint:" + "[navigationStartTick]:" + + event.navigationStartTick + ", [firstContentfulPaintMs]:" + + event.firstContentfulPaintMs) + }) + } + } + } + ``` + +### onLoadIntercept10+ + +onLoadIntercept(callback: (event?: { data: WebResourceRequest }) => boolean) + +当Web组件加载url之前触发该回调,用于判断是否阻止此次访问。默认允许加载。 + +**参数:** + +| 参数名 | 参数类型 | 参数描述 | +| ------- | ---------------------------------------- | --------- | +| request | [Webresourcerequest](#webresourcerequest) | url请求的相关信息。 | + +**返回值:** + +| 类型 | 说明 | +| ------- | ------------------------ | +| boolean | 返回true表示阻止此次加载,否则允许此次加载。 | + +**示例:** + + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview' + + @Entry + @Component + struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController() + + build() { + Column() { + Web({ src: 'www.example.com', controller: this.controller }) + .onLoadIntercept((event) => { + console.log('url:' + event.data.getRequestUrl()) + console.log('isMainFrame:' + event.data.isMainFrame()) + console.log('isRedirect:' + event.data.isRedirect()) + console.log('isRequestGesture:' + event.data.isRequestGesture()) + return true + }) + } + } + } + ``` + ## ConsoleMessage Web组件获取控制台信息对象。示例代码参考[onConsole事件](#onconsole)。 @@ -3093,13 +3316,13 @@ exitFullScreen(): void setWebController(controller: WebviewController): void -设置WebviewController对象。 +设置WebviewController对象,如果不需要打开新窗口请设置为null。 **参数:** | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | | ---------- | ------------- | ---- | ---- | ------------------------- | -| controller | [WebviewController](../apis/js-apis-webview.md#webviewcontroller) | 是 | - | 新建web组件的的WebviewController对象。 | +| controller | [WebviewController](../apis/js-apis-webview.md#webviewcontroller) | 是 | - | 新建web组件的WebviewController对象,如果不需要打开新窗口请设置为null。 | ## WebResourceError @@ -3193,6 +3416,18 @@ isRequestGesture(): boolean | ------- | -------------------- | | boolean | 返回资源请求是否与手势(如点击)相关联。 | +### getRequestMethod9+ + +getRequestMethod(): string + +获取请求方法。 + +**返回值:** + +| 类型 | 说明 | +| ------- | -------------------- | +| string | 返回请求方法。 | + ## Header Web组件返回的请求/响应头对象。 @@ -3509,6 +3744,8 @@ confirm(priKeyFile : string, certChainFile : string): void confirm(authUri : string): void +**需要权限:** ohos.permission.ACCESS_CERT_MANAGER + 通知Web组件使用指定的凭据(从证书管理模块获得)。 **参数:** @@ -3899,6 +4136,15 @@ onSslErrorEventReceive接口返回的SSL错误的具体原因。 | On | Web深色模式开启。 | | Auto | Web深色模式跟随系统。 | +## WebMediaOptions10+ + +Web媒体策略的配置。 + +| 名称 | 类型 | 可读 | 可写 | 必填 | 说明 | +| -------------- | --------- | ---- | ---- | --- | ---------------------------- | +| resumeInterval | number | 是 | 是 | 否 |被暂停的Web音频能够自动续播的有效期,单位:秒。最长有效期为60秒。 | +| audioExclusive | boolean | 是 | 是 | 否 | 应用内多个Web实例的音频是否独占。 | + ## DataResubmissionHandler9+ 通过DataResubmissionHandler可以重新提交表单数据或取消提交表单数据。 @@ -3979,7 +4225,7 @@ getCookieManager(): WebCookie | 类型 | 说明 | | --------- | ---------------------------------------- | -| WebCookie | web组件cookie管理对象,参考[WebCookie](#webcookie)定义。 | +| WebCookie | web组件cookie管理对象,参考[WebCookie](#webcookiedeprecated)定义。 | **示例:** @@ -4208,7 +4454,7 @@ forward(): void deleteJavaScriptRegister(name: string) -删除通过registerJavaScriptProxy注册到window上的指定name的应用侧JavaScript对象。删除后立即生效,无须调用[refresh](#refresh)接口。 +删除通过registerJavaScriptProxy注册到window上的指定name的应用侧JavaScript对象。删除后立即生效,无须调用[refresh](#refreshdeprecated)接口。 从API version 9开始不再维护,建议使用[deleteJavaScriptRegister9+](../apis/js-apis-webview.md#deletejavascriptregister)代替。 @@ -4489,7 +4735,7 @@ refresh() registerJavaScriptProxy(options: { object: object, name: string, methodList: Array\ }) -注入JavaScript对象到window对象中,并在window对象中调用该对象的方法。注册后,须调用[refresh](#refresh)接口生效。 +注入JavaScript对象到window对象中,并在window对象中调用该对象的方法。注册后,须调用[refresh](#refreshdeprecated)接口生效。 从API version 9开始不再维护,建议使用[registerJavaScriptProxy9+](../apis/js-apis-webview.md#registerjavascriptproxy)代替。 @@ -4686,7 +4932,7 @@ setCookie(url: string, value: string): boolean | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | | ----- | ------ | ---- | ---- | ----------------- | -| url | string | 是 | - | 要设置的cookie所属的url。 | +| url | string | 是 | - | 要设置的cookie所属的url,建议使用完整的url。 | | value | string | 是 | - | cookie的值。 | **返回值:** diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-gestures-pangesture.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-gestures-pangesture.md index e810ec960e554e29a36275ff78400e3e6da2a499..238a97c6c63944bd1c75906b5ea9f98dc2212d1c 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-gestures-pangesture.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-gestures-pangesture.md @@ -17,7 +17,7 @@ PanGesture(value?: { fingers?: number; direction?: PanDirection; distance?: numb | 参数名称 | 参数类型 | 必填 | 参数描述 | | -------- | -------- | -------- | -------- | -| fingers | number | 否 | 触发拖动的最少手指数,最小为1指, 最大取值为10指。
默认值:1 | +| fingers | number | 否 | 触发拖动的最少手指数,最小为1指, 最大取值为10指。
默认值:1
取值范围:[1,10]
**说明:**
当设置的值小于1或不设置时,会被转化为默认值。 | | direction | PanDirection | 否 | 触发拖动的手势方向,此枚举值支持逻辑与(&)和逻辑或(\|)运算。
默认值:PanDirection.All | | distance | number | 否 | 最小拖动识别距离,单位为vp。
默认值:5
**说明:**
[Tabs组件](ts-container-tabs.md)滑动与该拖动手势事件同时存在时,可将distance值设为1,使拖动更灵敏,避免造成事件错乱。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-basic-gestures-tapgesture.md b/zh-cn/application-dev/reference/arkui-ts/ts-basic-gestures-tapgesture.md index 8abf78ab1d71dbdb0b6d16b3c427f1f984af61de..e8752dc730b6322f37664478b457bbc7291c5f59 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-basic-gestures-tapgesture.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-basic-gestures-tapgesture.md @@ -1,6 +1,6 @@ # TapGesture -支持单次或多次点击识别。 +支持单击、双击和多次点击事件的识别。 > **说明:** > @@ -15,8 +15,8 @@ TapGesture(value?: { count?: number, fingers?: number }) | 参数名称 | 参数类型 | 必填 | 参数描述 | | -------- | -------- | -------- | -------- | -| count | number | 否 | 识别的连续点击次数。如果设置小于1,会被转化为默认值。
默认值:1
**说明:**
如配置多击,上一次抬起和下一次按下的超时时间为300毫秒。 | -| fingers | number | 否 | 触发点击的手指数,最小为1指, 最大为10指。
默认值:1
**说明:**
1. 当配置多指时,第一根手指按下后300毫秒内未有足够的手指数按下,手势识别失败。
2. 实际点击手指数超过配置值,手势识别失败。 | +| count | number | 否 | 识别的连续点击次数。当设置的值小于1或不设置时,会被转化为默认值。
默认值:1
**说明:**
如配置多击,上一次抬起和下一次按下的超时时间为300毫秒。 | +| fingers | number | 否 | 触发点击的手指数,最小为1指, 最大为10指。当设置小于1的值或不设置时,会被转化为默认值。
默认值:1
**说明:**
1. 当配置多指时,第一根手指按下后300毫秒内未有足够的手指数按下,手势识别失败。
2. 实际点击手指数超过配置值,手势识别失败。 | ## 事件 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 1d57e7673a6fc5660667e32b8033429d3ec3df35..a68712f809050a77962d2b6e7c15fe481734b1e0 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md @@ -12,6 +12,8 @@ CanvasRenderingContext2D(setting: RenderingContextSetting) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -25,6 +27,8 @@ RenderingContextSettings(antialias?: boolean) 用来配置CanvasRenderingContext2D对象的参数,包括是否开启抗锯齿。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -36,23 +40,23 @@ RenderingContextSettings(antialias?: boolean) | 名称 | 类型 | 描述 | | ----------------------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | -| [fillStyle](#fillstyle) | string \| [CanvasGradient](ts-components-canvas-canvasgradient.md) \| [CanvasPattern](#canvaspattern) | 指定绘制的填充色。
- 类型为string时,表示设置填充区域的颜色。
- 类型为CanvasGradient时,表示渐变对象,使用[createLinearGradient](#createlineargradient)方法创建。
- 类型为CanvasPattern时,使用[createPattern](#createpattern)方法创建。 | +| [fillStyle](#fillstyle) | string \| [CanvasGradient](ts-components-canvas-canvasgradient.md) \| [CanvasPattern](#canvaspattern) | 指定绘制的填充色。
- 类型为string时,表示设置填充区域的颜色。
- 类型为CanvasGradient时,表示渐变对象,使用[createLinearGradient](#createlineargradient)方法创建。
- 类型为CanvasPattern时,使用[createPattern](#createpattern)方法创建。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | | [lineWidth](#linewidth) | number | 设置绘制线条的宽度。 | -| [strokeStyle](#strokestyle) | string \| [CanvasGradient](ts-components-canvas-canvasgradient.md) \| [CanvasPattern](#canvaspattern) | 设置描边的颜色。
- 类型为string时,表示设置描边使用的颜色。
- 类型为CanvasGradient时,表示渐变对象,使用[createLinearGradient](#createlineargradient)方法创建。
- 类型为CanvasPattern时,使用[createPattern](#createpattern)方法创建。 | -| [lineCap](#linecap) | CanvasLineCap | 指定线端点的样式,可选值为:
- 'butt':线端点以方形结束。
- 'round':线端点以圆形结束。
- 'square':线端点以方形结束,该样式下会增加一个长度和线段厚度相同,宽度是线段厚度一半的矩形。
默认值:'butt' | -| [lineJoin](#linejoin) | CanvasLineJoin | 指定线段间相交的交点样式,可选值为:
- 'round':在线段相连处绘制一个扇形,扇形的圆角半径是线段的宽度。
- 'bevel':在线段相连处使用三角形为底填充, 每个部分矩形拐角独立。
- 'miter':在相连部分的外边缘处进行延伸,使其相交于一点,形成一个菱形区域,该属性可以通过设置miterLimit属性展现效果。
默认值:'miter' | -| [miterLimit](#miterlimit) | number | 设置斜接面限制值,该值指定了线条相交处内角和外角的距离。
默认值:10 | -| [font](#font) | string | 设置文本绘制中的字体样式。
语法:ctx.font='font-size font-family'
- font-size(可选),指定字号和行高,单位只支持px。
- font-family(可选),指定字体系列。
语法:ctx.font='font-style font-weight font-size font-family'
- font-style(可选),用于指定字体样式,支持如下几种样式:'normal','italic'。
- font-weight(可选),用于指定字体的粗细,支持如下几种类型:'normal', 'bold', 'bolder', 'lighter', 100, 200, 300, 400, 500, 600, 700, 800, 900。
- font-size(可选),指定字号和行高,单位只支持px。
- font-family(可选),指定字体系列,支持如下几种类型:'sans-serif', 'serif', 'monospace'。
默认值:'normal normal 14px sans-serif' | -| [textAlign](#textalign) | CanvasTextAlign | 设置文本绘制中的文本对齐方式,可选值为:
- 'left':文本左对齐。
- 'right':文本右对齐。
- 'center':文本居中对齐。
- 'start':文本对齐界线开始的地方。
- 'end':文本对齐界线结束的地方。
ltr布局模式下'start'和'left'一致,rtl布局模式下'start'和'right'一致·。
默认值:'left' | -| [textBaseline](#textbaseline) | CanvasTextBaseline | 设置文本绘制中的水平对齐方式,可选值为:
- 'alphabetic':文本基线是标准的字母基线。
- 'top':文本基线在文本块的顶部。
- 'hanging':文本基线是悬挂基线。
- 'middle':文本基线在文本块的中间。
- 'ideographic':文字基线是表意字基线;如果字符本身超出了alphabetic基线,那么ideograhpic基线位置在字符本身的底部。
- 'bottom':文本基线在文本块的底部。 与ideographic基线的区别在于ideographic基线不需要考虑下行字母。
默认值:'alphabetic' | -| [globalAlpha](#globalalpha) | number | 设置透明度,0.0为完全透明,1.0为完全不透明。 | -| [lineDashOffset](#linedashoffset) | number | 设置画布的虚线偏移量,精度为float。
默认值:0.0 | -| [globalCompositeOperation](#globalcompositeoperation) | string | 设置合成操作的方式。类型字段可选值有'source-over','source-atop','source-in','source-out','destination-over','destination-atop','destination-in','destination-out','lighter','copy','xor'。
默认值:'source-over' | -| [shadowBlur](#shadowblur) | number | 设置绘制阴影时的模糊级别,值越大越模糊,精度为float。
默认值:0.0 | -| [shadowColor](#shadowcolor) | string | 设置绘制阴影时的阴影颜色。 | -| [shadowOffsetX](#shadowoffsetx) | number | 设置绘制阴影时和原有对象的水平偏移值。 | -| [shadowOffsetY](#shadowoffsety) | number | 设置绘制阴影时和原有对象的垂直偏移值。 | -| [imageSmoothingEnabled](#imagesmoothingenabled) | boolean | 用于设置绘制图片时是否进行图像平滑度调整,true为启用,false为不启用。
默认值:true | +| [strokeStyle](#strokestyle) | string \| [CanvasGradient](ts-components-canvas-canvasgradient.md) \| [CanvasPattern](#canvaspattern) | 设置描边的颜色。
- 类型为string时,表示设置描边使用的颜色。
- 类型为CanvasGradient时,表示渐变对象,使用[createLinearGradient](#createlineargradient)方法创建。
- 类型为CanvasPattern时,使用[createPattern](#createpattern)方法创建。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| [lineCap](#linecap) | CanvasLineCap | 指定线端点的样式,可选值为:
- 'butt':线端点以方形结束。
- 'round':线端点以圆形结束。
- 'square':线端点以方形结束,该样式下会增加一个长度和线段厚度相同,宽度是线段厚度一半的矩形。
默认值:'butt'
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| [lineJoin](#linejoin) | CanvasLineJoin | 指定线段间相交的交点样式,可选值为:
- 'round':在线段相连处绘制一个扇形,扇形的圆角半径是线段的宽度。
- 'bevel':在线段相连处使用三角形为底填充, 每个部分矩形拐角独立。
- 'miter':在相连部分的外边缘处进行延伸,使其相交于一点,形成一个菱形区域,该属性可以通过设置miterLimit属性展现效果。
默认值:'miter'
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| [miterLimit](#miterlimit) | number | 设置斜接面限制值,该值指定了线条相交处内角和外角的距离。
默认值:10
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| [font](#font) | string | 设置文本绘制中的字体样式。
语法:ctx.font='font-size font-family'
- font-size(可选),指定字号和行高,单位只支持px。
- font-family(可选),指定字体系列。
语法:ctx.font='font-style font-weight font-size font-family'
- font-style(可选),用于指定字体样式,支持如下几种样式:'normal','italic'。
- font-weight(可选),用于指定字体的粗细,支持如下几种类型:'normal', 'bold', 'bolder', 'lighter', 100, 200, 300, 400, 500, 600, 700, 800, 900。
- font-size(可选),指定字号和行高,单位只支持px。
- font-family(可选),指定字体系列,支持如下几种类型:'sans-serif', 'serif', 'monospace'。
默认值:'normal normal 14px sans-serif'
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| [textAlign](#textalign) | CanvasTextAlign | 设置文本绘制中的文本对齐方式,可选值为:
- 'left':文本左对齐。
- 'right':文本右对齐。
- 'center':文本居中对齐。
- 'start':文本对齐界线开始的地方。
- 'end':文本对齐界线结束的地方。
ltr布局模式下'start'和'left'一致,rtl布局模式下'start'和'right'一致·。
默认值:'left'
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| [textBaseline](#textbaseline) | CanvasTextBaseline | 设置文本绘制中的水平对齐方式,可选值为:
- 'alphabetic':文本基线是标准的字母基线。
- 'top':文本基线在文本块的顶部。
- 'hanging':文本基线是悬挂基线。
- 'middle':文本基线在文本块的中间。
- 'ideographic':文字基线是表意字基线;如果字符本身超出了alphabetic基线,那么ideograhpic基线位置在字符本身的底部。
- 'bottom':文本基线在文本块的底部。 与ideographic基线的区别在于ideographic基线不需要考虑下行字母。
默认值:'alphabetic'
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| [globalAlpha](#globalalpha) | number | 设置透明度,0.0为完全透明,1.0为完全不透明。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| [lineDashOffset](#linedashoffset) | number | 设置画布的虚线偏移量,精度为float。
默认值:0.0
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| [globalCompositeOperation](#globalcompositeoperation) | string | 设置合成操作的方式。类型字段可选值有'source-over','source-atop','source-in','source-out','destination-over','destination-atop','destination-in','destination-out','lighter','copy','xor'。
默认值:'source-over'
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| [shadowBlur](#shadowblur) | number | 设置绘制阴影时的模糊级别,值越大越模糊,精度为float。
默认值:0.0
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| [shadowColor](#shadowcolor) | string | 设置绘制阴影时的阴影颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| [shadowOffsetX](#shadowoffsetx) | number | 设置绘制阴影时和原有对象的水平偏移值。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| [shadowOffsetY](#shadowoffsety) | number | 设置绘制阴影时和原有对象的垂直偏移值。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| [imageSmoothingEnabled](#imagesmoothingenabled) | boolean | 用于设置绘制图片时是否进行图像平滑度调整,true为启用,false为不启用。
默认值:true
从API version 9开始,该接口支持在ArkTS卡片中使用。 | > **说明:** > @@ -77,7 +81,7 @@ struct FillStyleExample { .backgroundColor('#ffff00') .onReady(() =>{ this.context.fillStyle = '#0000ff' - this.context.fillRect(20, 160, 150, 100) + this.context.fillRect(20, 20, 150, 100) }) } .width('100%') @@ -657,6 +661,8 @@ fillRect(x: number, y: number, w: number, h: number): void 填充一个矩形。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 说明 | @@ -683,7 +689,7 @@ fillRect(x: number, y: number, w: number, h: number): void .height('100%') .backgroundColor('#ffff00') .onReady(() =>{ - this.context.fillRect(0,30,100,100) + this.context.fillRect(30,30,100,100) }) } .width('100%') @@ -701,6 +707,8 @@ strokeRect(x: number, y: number, w: number, h: number): void 绘制具有边框的矩形,矩形内部不填充。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 说明 | @@ -745,6 +753,8 @@ clearRect(x: number, y: number, w: number, h: number): void 删除指定区域内的绘制内容。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -791,6 +801,8 @@ fillText(text: string, x: number, y: number, maxWidth?: number): void 绘制填充类文本。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 说明 | @@ -836,6 +848,8 @@ strokeText(text: string, x: number, y: number, maxWidth?:number): void 绘制描边类文本。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -881,6 +895,8 @@ measureText(text: string): TextMetrics 该方法返回一个文本测算的对象,通过该对象可以获取指定文本的宽度值。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 说明 | @@ -889,9 +905,9 @@ measureText(text: string): TextMetrics **返回值:** -| 类型 | 说明 | -| ----------- | ---------------- | -| TextMetrics | 文本的尺寸信息。 | +| 类型 | 说明 | +| ----------- | ------------------------------------------------------------ | +| TextMetrics | 文本的尺寸信息。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | **TextMetrics类型描述:** @@ -951,6 +967,8 @@ stroke(path?: Path2D): void 进行边框绘制操作。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -997,6 +1015,8 @@ beginPath(): void 创建一个新的绘制路径。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **示例:** ```ts @@ -1037,6 +1057,8 @@ moveTo(x: number, y: number): void 路径从当前点移动到指定点。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 说明 | @@ -1082,6 +1104,8 @@ lineTo(x: number, y: number): void 从当前点到指定点进行路径连接。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -1127,6 +1151,8 @@ closePath(): void 结束当前路径形成一个封闭路径。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **示例:** ```ts @@ -1167,12 +1193,14 @@ createPattern(image: ImageBitmap, repetition: string | null): CanvasPattern | nu 通过指定图像和重复方式创建图片填充的模板。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 描述 | | ---------- | -------------------------------------------------- | ---- | ------------------------------------------------------------ | | image | [ImageBitmap](ts-components-canvas-imagebitmap.md) | 是 | 图源对象,具体参考ImageBitmap对象。 | -| repetition | string | 是 | 设置图像重复的方式,取值为:'repeat'、'repeat-x'、 'repeat-y'、'no-repeat'。
默认值:'' | +| repetition | string | 是 | 设置图像重复的方式,取值为:'repeat'、'repeat-x'、 'repeat-y'、'no-repeat'、'clamp'、'mirror'。
默认值:'' | **返回值:**: @@ -1218,6 +1246,8 @@ bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, 创建三次贝赛尔曲线的路径。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -1267,6 +1297,8 @@ quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void 创建二次贝赛尔曲线的路径。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -1314,6 +1346,8 @@ arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, 绘制弧线路径。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -1362,6 +1396,8 @@ arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void 依据圆弧经过的点和圆弧半径创建圆弧路径。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -1409,6 +1445,8 @@ ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number 在规定的矩形区域绘制一个椭圆。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 说明 | @@ -1459,6 +1497,8 @@ rect(x: number, y: number, w: number, h: number): void 创建矩形路径。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -1504,6 +1544,8 @@ fill(fillRule?: CanvasFillRule): void 对封闭路径进行填充。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -1545,6 +1587,8 @@ fill(path: Path2D, fillRule?: CanvasFillRule): void 对封闭路径进行填充。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -1598,6 +1642,8 @@ clip(fillRule?: CanvasFillRule): void 设置当前路径为剪切路径。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -1641,6 +1687,8 @@ clip(path: Path2D, fillRule?: CanvasFillRule): void 设置当前路径为剪切路径 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -1653,35 +1701,35 @@ clip(path: Path2D, fillRule?: CanvasFillRule): void ```ts // xxx.ets -@Entry -@Component -struct Clip { - private settings: RenderingContextSettings = new RenderingContextSettings(true) - private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Canvas(this.context) - .width('100%') - .height('100%') - .backgroundColor('#ffff00') - .onReady(() =>{ - let region = new Path2D() - region.moveTo(30, 90) - region.lineTo(110, 20) - region.lineTo(240, 130) - region.lineTo(60, 130) - region.lineTo(190, 20) - region.lineTo(270, 90) - region.closePath() - this.context.clip(region,"evenodd") - this.context.fillStyle = "rgb(0,255,0)" - this.context.fillRect(0, 0, this.context.width, this.context.height) - }) + @Entry + @Component + struct Clip { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Canvas(this.context) + .width('100%') + .height('100%') + .backgroundColor('#ffff00') + .onReady(() =>{ + let region = new Path2D() + region.moveTo(30, 90) + region.lineTo(110, 20) + region.lineTo(240, 130) + region.lineTo(60, 130) + region.lineTo(190, 20) + region.lineTo(270, 90) + region.closePath() + this.context.clip(region,"evenodd") + this.context.fillStyle = "rgb(0,255,0)" + this.context.fillRect(0, 0, this.context.width, this.context.height) + }) + } + .width('100%') + .height('100%') } - .width('100%') - .height('100%') } -} ``` ![zh-cn_image_000000127777779](figures/zh-cn_image_000000127777779.png) @@ -1693,6 +1741,8 @@ filter(filter: string): void 为Canvas图形设置各类滤镜效果。该接口为空接口。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 说明 | @@ -1706,6 +1756,8 @@ getTransform(): Matrix2D 获取当前被应用到上下文的转换矩阵。该接口为空接口。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + ### resetTransform @@ -1713,6 +1765,8 @@ resetTransform(): void 使用单位矩阵重新设置当前变形。该接口为空接口。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + ### direction @@ -1720,6 +1774,8 @@ direction(direction: CanvasDirection): void 绘制文本时,描述当前文本方向的属性。该接口为空接口。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + ### rotate @@ -1727,6 +1783,8 @@ rotate(angle: number): void 针对当前坐标轴进行顺时针旋转。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -1769,6 +1827,8 @@ scale(x: number, y: number): void 设置canvas画布的缩放变换属性,后续的绘制操作将按照缩放比例进行缩放。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -1814,6 +1874,8 @@ transform(a: number, b: number, c: number, d: number, e: number, f: number): voi transform方法对应一个变换矩阵,想对一个图形进行变化的时候,只要设置此变换矩阵相应的参数,对图形的各个定点的坐标分别乘以这个矩阵,就能得到新的定点的坐标。矩阵变换效果可叠加。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + > **说明:** > 变换后的坐标计算方式(x和y为变换前坐标,x'和y'为变换后坐标): > @@ -1874,6 +1936,8 @@ setTransform(a: number, b: number, c: number, d: number, e: number, f: number): setTransform方法使用的参数和transform()方法相同,但setTransform()方法会重置现有的变换矩阵并创建新的变换矩阵。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -1922,6 +1986,8 @@ setTransform(transform?: Matrix2D): void 以Matrix2D对象为模板重置现有的变换矩阵并创建新的变换矩阵。该接口为空接口。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + ### translate @@ -1929,6 +1995,8 @@ translate(x: number, y: number): void 移动当前坐标系的原点。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -1977,6 +2045,8 @@ drawImage(image: ImageBitmap | PixelMap, sx: number, sy: number, sw: number, sh: 进行图像绘制。 +从API version 9开始,该接口支持在ArkTS卡片中使用,卡片中不支持PixelMap对象。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -2028,6 +2098,8 @@ createImageData(sw: number, sh: number): ImageData 创建新的ImageData 对象,请参考[ImageData](ts-components-canvas-imagedata.md)。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认 | 描述 | @@ -2040,6 +2112,8 @@ createImageData(imageData: ImageData): ImageData 创建新的ImageData 对象,请参考[ImageData](ts-components-canvas-imagedata.md)。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认 | 描述 | @@ -2080,6 +2154,8 @@ getImageData(sx: number, sy: number, sw: number, sh: number): ImageData 以当前canvas指定区域内的像素创建[ImageData](ts-components-canvas-imagedata.md)对象。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -2100,29 +2176,29 @@ getImageData(sx: number, sy: number, sw: number, sh: number): ImageData ```ts // xxx.ets -@Entry -@Component -struct GetImageData { - private settings: RenderingContextSettings = new RenderingContextSettings(true) - private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) - private img:ImageBitmap = new ImageBitmap("/common/images/1234.png") + @Entry + @Component + struct GetImageData { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private img:ImageBitmap = new ImageBitmap("/common/images/1234.png") - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Canvas(this.context) - .width('100%') - .height('100%') - .backgroundColor('#ffff00') - .onReady(() =>{ - this.context.drawImage(this.img,0,0,130,130) - var imagedata = this.context.getImageData(50,50,130,130) - this.context.putImageData(imagedata,150,150) - }) + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Canvas(this.context) + .width('100%') + .height('100%') + .backgroundColor('#ffff00') + .onReady(() =>{ + this.context.drawImage(this.img,0,0,130,130) + var imagedata = this.context.getImageData(50,50,130,130) + this.context.putImageData(imagedata,150,150) + }) + } + .width('100%') + .height('100%') } - .width('100%') - .height('100%') } -} ``` ![zh-cn_image_000000127777780](figures/zh-cn_image_000000127777780.png) @@ -2136,6 +2212,8 @@ putImageData(imageData: ImageData, dx: number, dy: number, dirtyX: number, dirty 使用[ImageData](ts-components-canvas-imagedata.md)数据填充新的矩形区域。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -2190,6 +2268,8 @@ setLineDash(segments: number[]): void 设置画布的虚线样式。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 描述 | @@ -2233,6 +2313,8 @@ getLineDash(): number[] 获得当前画布的虚线样式。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **返回值:** | 类型 | 说明 | @@ -2244,40 +2326,40 @@ getLineDash(): number[] ```ts // xxx.ets -@Entry -@Component -struct CanvasGetLineDash { - @State message: string = 'Hello World' - private settings: RenderingContextSettings = new RenderingContextSettings(true) - private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + @Entry + @Component + struct CanvasGetLineDash { + @State message: string = 'Hello World' + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - .onClick(()=>{ - console.error('before getlinedash clicked') - let res = this.context.getLineDash() - console.error(JSON.stringify(res)) - }) - Canvas(this.context) - .width('100%') - .height('100%') - .backgroundColor('#ffff00') - .onReady(() => { - this.context.arc(100, 75, 50, 0, 6.28) - this.context.setLineDash([10,20]) - this.context.stroke() - let res = this.context.getLineDash() - }) + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + .onClick(()=>{ + console.error('before getlinedash clicked') + let res = this.context.getLineDash() + console.error(JSON.stringify(res)) + }) + Canvas(this.context) + .width('100%') + .height('100%') + .backgroundColor('#ffff00') + .onReady(() => { + this.context.arc(100, 75, 50, 0, 6.28) + this.context.setLineDash([10,20]) + this.context.stroke() + let res = this.context.getLineDash() + }) + } + .width('100%') } - .width('100%') + .height('100%') } - .height('100%') } -} ``` ![zh-cn_image_000000127777778](figures/zh-cn_image_000000127777778.png) @@ -2289,6 +2371,8 @@ imageSmoothingQuality(quality: imageSmoothingQuality) 用于设置图像平滑度。该接口为空接口。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 描述 | @@ -2303,6 +2387,8 @@ transferFromImageBitmap(bitmap: ImageBitmap): void 显示给定的ImageBitmap对象。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 描述 | @@ -2353,6 +2439,8 @@ toDataURL(type?: string, quality?: number): string 生成一个包含图片展示的URL。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 描述 | @@ -2370,26 +2458,26 @@ toDataURL(type?: string, quality?: number): string ```ts // xxx.ets -@Entry -@Component -struct ToDataURL { - private settings: RenderingContextSettings = new RenderingContextSettings(true) - private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + @Entry + @Component + struct ToDataURL { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Canvas(this.context) - .width('100%') - .height('100%') - .backgroundColor('#ffff00') - .onReady(() =>{ - var dataURL = this.context.toDataURL() - }) + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Canvas(this.context) + .width('100%') + .height('100%') + .backgroundColor('#ffff00') + .onReady(() =>{ + var dataURL = this.context.toDataURL() + }) + } + .width('100%') + .height('100%') } - .width('100%') - .height('100%') } -} ``` @@ -2399,6 +2487,8 @@ restore(): void 对保存的绘图上下文进行恢复。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **示例:** ```ts @@ -2437,6 +2527,8 @@ save(): void 将当前状态放入栈中,保存canvas的全部状态,通常在需要保存绘制状态时调用。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **示例:** ```ts @@ -2475,6 +2567,8 @@ createLinearGradient(x0: number, y0: number, x1: number, y1: number): void 创建一个线性渐变色。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -2506,7 +2600,7 @@ createLinearGradient(x0: number, y0: number, x1: number, y1: number): void grad.addColorStop(0.5, '#ffffff') grad.addColorStop(1.0, '#00ff00') this.context.fillStyle = grad - this.context.fillRect(0, 0, 500, 500) + this.context.fillRect(0, 0, 400, 400) }) } .width('100%') @@ -2524,6 +2618,8 @@ createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, 创建一个径向渐变色。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -2557,7 +2653,7 @@ createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, grad.addColorStop(0.5, '#ffffff') grad.addColorStop(1.0, '#00ff00') this.context.fillStyle = grad - this.context.fillRect(0, 0, 500, 500) + this.context.fillRect(0, 0, 440, 440) }) } .width('100%') @@ -2568,7 +2664,55 @@ createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, ![zh-cn_image_0000001239032419](figures/zh-cn_image_0000001239032419.png) +### createConicGradient10+ + +createConicGradient(startAngle: number, x: number, y: number): CanvasGradient + +创建一个圆锥渐变色。 + +**参数:** + +| 参数 | 类型 | 必填 | 默认值 | 描述 | +| ---------- | ------ | ---- | ------ | ------------------------------------------------------------ | +| startAngle | number | 是 | 0 | 开始渐变的角度,以弧度为单位。角度测量从中心右侧水平开始,顺时针移动。 | +| x | number | 是 | 0 | 圆锥渐变的中心x轴坐标。单位:vp | +| y | number | 是 | 0 | 圆锥渐变的中心y轴坐标。单位:vp | + +**示例:** + +```ts +// xxx.ets +@Entry +@Component +struct CanvasExample { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Canvas(this.context) + .width('100%') + .height('100%') + .backgroundColor('#ffffff') + .onReady(() => { + var grad = this.context.createConicGradient(0, 50, 80) + grad.addColorStop(0.0, '#ff0000') + grad.addColorStop(0.5, '#ffffff') + grad.addColorStop(1.0, '#00ff00') + this.context.fillStyle = grad + this.context.fillRect(0, 30, 100, 100) + }) + } + .width('100%') + .height('100%') + } +} +``` + + ![zh-cn_image_0000001239032419](figures/zh-cn_image_0000001239032420.png) ## CanvasPattern 一个Object对象, 通过[createPattern](#createpattern)方法创建。 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-combined-gestures.md b/zh-cn/application-dev/reference/arkui-ts/ts-combined-gestures.md index 7c297ede50ec17263b9a6979cb34e9305941c351..d1355645ece52650e091b68c4572ab20cc0bc6a4 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-combined-gestures.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-combined-gestures.md @@ -4,7 +4,7 @@ > **说明:** > -> 从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 +> 从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 ## 接口 @@ -12,24 +12,24 @@ GestureGroup(mode: GestureMode, ...gesture: GestureType[]) **参数:** -| 参数名 | 参数类型 | 必填 | 参数描述 | -| -------- | -------- | -------- | -------- | -| mode | [GestureMode](#gesturemode枚举说明) | 是 | 设置组合手势识别模式。 | -| gesture | [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) | 是 | 可变长参数,1个或者多个基础手势类型,这些手势会被组合识别。 | +| 参数名 | 参数类型 | 必填 | 参数描述 | +| ------- | ---------------------------------------- | ---- | ------------------------------ | +| mode | [GestureMode](#gesturemode枚举说明) | 是 | 设置组合手势识别模式。 | +| gesture | [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) | 是 | 可变长参数,1个或者多个基础手势类型,这些手势会被组合识别。 | ## GestureMode枚举说明 -| 名称 | 描述 | -| -------- | -------- | -| Sequence | 顺序识别,按照手势的注册顺序识别手势,直到所有手势识别成功。当有一个手势识别失败时,所有手势识别失败。 | -| Parallel | 并发识别,注册的手势同时识别,直到所有手势识别结束,手势识别互相不影响。 | -| Exclusive | 互斥识别,注册的手势同时识别,若有一个手势识别成功,则结束手势识别。 | +| 名称 | 描述 | +| --------- | ---------------------------------------- | +| Sequence | 顺序识别,按照手势的注册顺序识别手势,直到所有手势识别成功。当有一个手势识别失败时,所有手势识别失败。 | +| Parallel | 并发识别,注册的手势同时识别,直到所有手势识别结束,手势识别互相不影响。 | +| Exclusive | 互斥识别,注册的手势同时识别,若有一个手势识别成功,则结束手势识别。 | ## 事件 -| 名称 | 功能描述 | -| -------- | -------- | +| 名称 | 功能描述 | +| ---------------------------------------- | ------------------------------------ | | onCancel(event: () => void) | 顺序组合手势(GestureMode.Sequence)取消后触发回调。 | @@ -50,6 +50,7 @@ struct GestureGroupExample { build() { Column() { Text('sequence gesture\n' + 'LongPress onAction:' + this.count + '\nPanGesture offset:\nX: ' + this.offsetX + '\n' + 'Y: ' + this.offsetY) + .fontSize(15) } .translate({ x: this.offsetX, y: this.offsetY, z: 0 }) .height(150) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-canvas.md b/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-canvas.md index 03ef8e6c7a980e9383e7ed21cb98ad97832ca51d..c36d8e0c8737a4f71dc63f9c8f728b2ce31549ed 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-canvas.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-canvas.md @@ -14,6 +14,8 @@ Canvas(context?: CanvasRenderingContext2D) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | @@ -30,8 +32,7 @@ Canvas(context?: CanvasRenderingContext2D) | 名称 | 参数 | 描述 | | ----------------------------- | ---- | -------------------- | -| onReady(event: () => void) | 无 | Canvas组件初始化完成时的事件回调,该事件之后Canvas组件宽高确定且可获取,可使用Canvas相关API进行绘制。 | - +| onReady(event: () => void) | 无 | Canvas组件初始化完成时或者Canvas组件发生大小变化时的事件回调,当该事件被触发时画布被清空,该事件之后Canvas组件宽高确定且可获取,可使用Canvas相关API进行绘制。当Canvas组件仅发生位置变化时,只触发onAreaChange事件、不触发onReady事件。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | **示例:** @@ -58,4 +59,4 @@ struct CanvasExample { } } ``` - ![zh-cn_image_0000001194032666](figures/zh-cn_image_0000001194032666.png) \ No newline at end of file + ![zh-cn_image_0000001194032666](figures/zh-cn_image_0000001194032666.png) 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 c6efa1ddbbbc323d26afd22179f0ed1cada1e640..bb1ab8f3b2721ea789e51b23ecdb0aa4b3611c80 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 @@ -14,6 +14,8 @@ addColorStop(offset: number, color: string): void 设置渐变断点值,包括偏移和颜色。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** @@ -45,7 +47,7 @@ struct Page45 { grad.addColorStop(0.5, '#ffffff') grad.addColorStop(1.0, '#00ff00') this.context.fillStyle = grad - this.context.fillRect(0, 0, 500, 500) + this.context.fillRect(0, 0, 400, 400) }) } .width('100%') diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-imagebitmap.md b/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-imagebitmap.md index 8785206dcef551053042f745837aa8e664757c5d..2890d2890e202d12c13167f04919af42292dbf9a 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-imagebitmap.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-imagebitmap.md @@ -3,8 +3,20 @@ ImageBitmap对象可以存储canvas渲染的像素数据。 > **说明:** -> -> 从 API Version 8 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 +> +> 从 API Version 8 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + +## 接口 + +ImageBitmap(src: string) + +从API version 9开始,该接口支持在ArkTS卡片中使用。 + +**参数:** + +| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | +| ------ | -------- | ---- | ------ | ------------------------------------------------------------ | +| src | string | 是 | - | 图片的数据源
**说明:**
- ArkTS卡片上不支持`http://`等网络相关路径前缀、`datashare://`路径前缀以及`file://data/storage`路径前缀的字符串 | @@ -12,8 +24,8 @@ ImageBitmap对象可以存储canvas渲染的像素数据。 | 属性 | 类型 | 描述 | | -------- | -------- | -------- | -| width | number | ImageBitmap的像素宽度。 | -| height | number | ImageBitmap的像素高度。 | +| width | number | ImageBitmap的像素宽度。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| height | number | ImageBitmap的像素高度。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | **示例:** @@ -53,4 +65,6 @@ ImageBitmap对象可以存储canvas渲染的像素数据。 close() -释放ImageBitmap对象相关联的所有图形资源。该接口为空接口。 \ No newline at end of file +释放ImageBitmap对象相关联的所有图形资源。该接口为空接口。 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-imagedata.md b/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-imagedata.md index bd1b16a3981851566cb2970203935f439a3c74af..8f7b8da860a909cbbe3730fb8fb47bb393f996af 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-imagedata.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-imagedata.md @@ -12,9 +12,9 @@ ImageData对象可以存储canvas渲染的像素数据。 | 属性 | 类型 | 描述 | | -------- | -------- | -------- | -| width | number | 矩形区域实际像素宽度,单位为px。 | -| height | number | 矩形区域实际像素高度,单位为px。 | -| data | Uint8ClampedArray | 一维数组,保存了相应的颜色数据,数据值范围为0到255。 | +| width | number | 矩形区域实际像素宽度,单位为px。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| height | number | 矩形区域实际像素高度,单位为px。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| data | Uint8ClampedArray | 一维数组,保存了相应的颜色数据,数据值范围为0到255。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | > **说明:** > @@ -24,29 +24,29 @@ ImageData对象可以存储canvas渲染的像素数据。 ```ts // xxx.ets -@Entry -@Component -struct Translate { - private settings: RenderingContextSettings = new RenderingContextSettings(true) - private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) - private img:ImageBitmap = new ImageBitmap("/common/images/1234.png") - - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Canvas(this.context) - .width('100%') - .height('100%') - .backgroundColor('#ffff00') - .onReady(() =>{ - this.context.drawImage(this.img,0,0,130,130) - var imagedata = this.context.getImageData(50,50,130,130) - this.context.putImageData(imagedata,150,150) - }) + @Entry + @Component + struct Translate { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private img:ImageBitmap = new ImageBitmap("common/images/1234.png") + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Canvas(this.context) + .width('100%') + .height('100%') + .backgroundColor('#ffff00') + .onReady(() =>{ + this.context.drawImage(this.img,0,0,130,130) + var imagedata = this.context.getImageData(50,50,130,130) + this.context.putImageData(imagedata,150,150) + }) + } + .width('100%') + .height('100%') } - .width('100%') - .height('100%') } -} ``` ![zh-cn_image_000000127777780](figures/zh-cn_image_000000127777780.png) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-lottie.md b/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-lottie.md index df3de28fed5d376b25533ec9b27f0a0a83b79f89..4960a4ec7f300407af72a9d8a25eb00ab287100a 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-lottie.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-lottie.md @@ -3,7 +3,7 @@ 提供Lottie动画。 > **说明:** -> +> > 从 API Version 8 开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 @@ -16,9 +16,7 @@ import lottie from '@ohos/lottieETS' > **说明:** > -> 在Terminal窗口使用 `npm install @ohos/lottieETS` 命令下载Lottie,下载之前需要配置权限。 -> -> 安装ohos npm 三方包时,需要先执行`npm config set @ohos:registry=https://repo.harmonyos.com/npm/`设置仓库地址。 +> 在第一次使用Lottie之前,需要在Terminal窗口运行 `ohpm install @ohos/lottieETS` 命令下载Lottie。 ## lottie.loadAnimation @@ -31,15 +29,15 @@ path: string, container: object, render: string, loop: boolean, autoplay: boolea **参数:** -| 参数 | 类型 | 必填 | 描述 | -| -------------- | --------------------------- | ---- | ------------------------------------------------------------ | -| path | string | 是 | HAP内动画资源文件路径,仅支持json格式。示例:path: "common/lottie/data.json" | -| container | object | 是 | canvas绘图上下文,声明范式需提前声明CanvasRenderingContext2D。 | -| render | string | 是 | 渲染类型,仅支持“canvas”。 | -| loop | boolean \| number | 否 | 动画播放结束后,是否循环播放,默认值true。值类型为number,且大于等于1时为设置的重复播放的次数。 | -| autoplay | boolean | 否 | 是否自动播放动画,默认值true。 | -| name | string | 否 | 开发者自定义的动画名称,后续支持通过该名称引用控制动画,默认为空。 | -| initialSegment | [number, number] | 否 | 指定动画播放的起始帧号,指定动画播放的结束帧号。 | +| 参数 | 类型 | 必填 | 描述 | +| -------------- | --------------------------- | ---- | ---------------------------------------- | +| path | string | 是 | HAP内动画资源文件路径,仅支持json格式。示例:path: "common/lottie/data.json" | +| container | object | 是 | canvas绘图上下文,声明范式需提前声明CanvasRenderingContext2D。 | +| render | string | 是 | 渲染类型,仅支持“canvas”。 | +| loop | boolean \| number | 否 | 动画播放结束后,是否循环播放,默认值true。值类型为number,且大于等于1时为设置的重复播放的次数。 | +| autoplay | boolean | 否 | 是否自动播放动画,默认值true。 | +| name | string | 否 | 开发者自定义的动画名称,后续支持通过该名称引用控制动画,默认为空。 | +| initialSegment | [number, number] | 否 | 指定动画播放的起始帧号,指定动画播放的结束帧号。 | ## lottie.destroy diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-path2d.md b/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-path2d.md index dbad82b43f93702bc3f7f8a00f5572641a2d8833..b89eb4797b53a1905a2fe91b7740539454587a1d 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-path2d.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-components-canvas-path2d.md @@ -1,6 +1,6 @@ # Path2D对象 -路径对象,支持通过对象的接口进行路径的描述,并通过Canvas的stroke接口进行绘制。 +路径对象,支持通过对象的接口进行路径的描述,并通过Canvas的stroke接口或者fill接口进行绘制。 > **说明:** > @@ -14,6 +14,8 @@ addPath(path: path2D, transform?:Matrix2D): void 将另一个路径添加到当前的路径对象中。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -61,6 +63,8 @@ closePath(): void 将路径的当前点移回到路径的起点,当前点到起点间画一条直线。如果形状已经闭合或只有一个点,则此功能不执行任何操作。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **示例:** ```ts @@ -101,6 +105,8 @@ moveTo(x: number, y: number): void 将路径的当前坐标点移动到目标点,移动过程中不绘制线条。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -148,6 +154,8 @@ lineTo(x: number, y: number): void 从当前点绘制一条直线到目标点。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -196,6 +204,8 @@ bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, 创建三次贝赛尔曲线的路径。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -245,6 +255,8 @@ quadraticCurveTo(cpx: number, cpy: number, x: number ,y: number): void 创建二次贝赛尔曲线的路径。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -292,6 +304,8 @@ arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, 绘制弧线路径。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -340,6 +354,8 @@ arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void 依据圆弧经过的点和圆弧半径创建圆弧路径。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -387,6 +403,8 @@ ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number 在规定的矩形区域绘制一个椭圆。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -437,6 +455,8 @@ rect(x: number, y: number, w: number, h: number): void 创建矩形路径。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-components-summary.md b/zh-cn/application-dev/reference/arkui-ts/ts-components-summary.md index fed857649de4d14d3028fd5b2ab535431f619a29..6504c28f9530a96cc49e936c6f884e7859e12187 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-components-summary.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-components-summary.md @@ -293,7 +293,7 @@ 提供卡片组件,实现卡片的显示功能。 - [Menu](ts-basic-components-menu.md) - 以垂直列表形式显示的菜单,优先用于PC端的菜单开发。 + 以垂直列表形式显示的菜单。 - [MenuItem](ts-basic-components-menuitem.md) 用来展示菜单Menu中具体的item菜单项。 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-alphabet-indexer.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-alphabet-indexer.md index 0f51f9689d3950555c31f283e2f2b87ea998eeaf..84eab79ac1de7d932babff111b590b91df8d0598 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-alphabet-indexer.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-alphabet-indexer.md @@ -27,8 +27,8 @@ AlphabetIndexer(value: {arrayValue: Array<string>, selected: number}) 除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性: -| 名称 | 参数类型 | 描述 | -| ----------------------- | --------------- | ----------------------------------------------------------- | +| 名称 | 参数类型 | 描述 | +| ----------------------- | --------------------| ------------------------------------------------------------------| | color | [ResourceColor](ts-types.md#resourcecolor) | 设置文字颜色。
默认值:0x99000000。 | | selectedColor | [ResourceColor](ts-types.md#resourcecolor) | 设置选中项文字颜色。
默认值:0xFF254FF7。 | | popupColor | [ResourceColor](ts-types.md#resourcecolor) | 设置提示弹窗文字颜色。
默认值:0xFF254FF7。 | @@ -38,10 +38,14 @@ AlphabetIndexer(value: {arrayValue: Array<string>, selected: number}) | selectedFont | [Font](ts-types.md#font) | 设置选中项文字样式。
默认值:
{
size:10,
style:FontStyle.Normal,
weight:FontWeight.Normal,
family:'HarmonyOS Sans'
} | | popupFont | [Font](ts-types.md#font) | 设置提示弹窗字体样式。
默认值:
{
size:10,
style:FontStyle.Normal,
weight:FontWeight.Normal,
family:'HarmonyOS Sans'
} | | font | [Font](ts-types.md#font) | 设置字母索引条默认字体样式。
默认值:
{
size:10,
style:FontStyle.Normal,
weight:FontWeight.Normal,
family:'HarmonyOS Sans'
} | -| itemSize | string \| number | 设置字母索引条字母区域大小,字母区域为正方形,即正方形边长。不支持设置为百分比。
默认值:24.0。 | -| alignStyle | IndexerAlign | 设置字母索引条弹框的对齐样式,支持弹窗显示在索引条右侧和左侧。
默认值:IndexerAlign.Right。 | +| itemSize | string \| number | 设置字母索引条字母区域大小,字母区域为正方形,即正方形边长。不支持设置为百分比。
默认值:24.0
单位:vp | +| alignStyle | value: [IndexerAlign](#indexeralign枚举说明),
offset10+?: [Length](ts-types.md#length) | value:设置字母索引条弹框的对齐样式,支持弹窗显示在索引条右侧和左侧。
默认值: IndexerAlign.Right。
offset:设置提示弹窗与索引条之间间距,大于等于0为有效值,在不设置或设置为小于0的情况下间距与popupPosition.x相同。 | | selected | number | 设置选中项索引值。
默认值:0。 | | popupPosition | [Position](ts-types.md#position8) | 设置弹出窗口相对于索引器条上边框中点的位置。
默认值:{x:96.0, y:48.0}。 | +| popupSelectedColor10+ | [ResourceColor](ts-types.md#resourcecolor) | 设置提示弹窗非字母部分选中文字色。
默认值:#FF182431 | +| popupUnselectedColor10+ | [ResourceColor](ts-types.md#resourcecolor) | 设置提示弹窗非字母部分未选中文字色。
默认值:#FF182431 | +| popupItemFont10+ | [Font](ts-types.md#font) | 设置提示弹窗非字母部分字体样式。
默认值:
{
size:24,
style:FontStyle.Medium
}| +| popupItemBackgroundColor10+ | [ResourceColor](ts-types.md#resourcecolor) | 设置提示弹窗非字母部分背景色。
默认值:#FFFFFF | ## IndexerAlign枚举说明 @@ -52,7 +56,7 @@ AlphabetIndexer(value: {arrayValue: Array<string>, selected: number}) ## 事件 -仅支持以下事件: +除支持[通用事件](ts-universal-events-click.md)外,还支持以下事件: | 名称 | 功能描述 | | -------- | -------- | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-badge.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-badge.md index d26cadcd3f509f6438c97c71d345e5a65413ee64..ed09bfe25387b79da2d31f044431dc9fc05555dc 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-badge.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-badge.md @@ -11,6 +11,10 @@ 支持单个子组件。 +> **说明:** +> +> 子组件类型:系统组件和自定义组件,支持渲染控制类型([if/else](../../quick-start/arkts-rendering-control-ifelse.md)、[ForEach](../../quick-start/arkts-rendering-control-foreach.md)和[LazyForEach](../../quick-start/arkts-rendering-control-lazyforeach.md))。 + ## 接口 @@ -18,19 +22,23 @@ 创建数字标记组件。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** -| 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | -| -------- | -------- | -------- | -------- | -------- | -| count | number | 是 | - | 设置提醒消息数。 | -| position | [BadgePosition](#badgeposition枚举说明) | 否 | BadgePosition.RightTop | 设置提示点显示位置。 | -| maxCount | number | 否 | 99 | 最大消息数,超过最大消息时仅显示maxCount+。 | -| style | [BadgeStyle](#badgestyle对象说明) | 是 | - | Badge组件可设置样式,支持设置文本颜色、尺寸、圆点颜色和尺寸。 | +| 参数名 | 参数类型 | 必填 | 参数描述 | +| -------- | -------- | -------- | -------- | +| count | number | 是 | 设置提醒消息数。
**说明:**
小于等于0时不显示信息标记。 | +| position | [BadgePosition](#badgeposition枚举说明) | 否 | 设置提示点显示位置。
默认值:BadgePosition.RightTop | +| maxCount | number | 否 | 最大消息数,超过最大消息时仅显示maxCount+。
默认值:99 | +| style | [BadgeStyle](#badgestyle对象说明) | 是 | Badge组件可设置样式,支持设置文本颜色、尺寸、圆点颜色和尺寸。 | **方法2:** Badge(value: {value: string, position?: BadgePosition, style: BadgeStyle}) 根据字符串创建标记组件。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | @@ -41,6 +49,8 @@ ## BadgePosition枚举说明 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | -------- | -------- | | RightTop | 圆点显示在右上角。 | @@ -49,12 +59,25 @@ ## BadgeStyle对象说明 -| 名称 | 类型 | 必填 | 默认值 | 描述 | -| ---------- | ------------------------------------------ | ---- | ----------- | ------------------------------------------- | -| color | [ResourceColor](ts-types.md#resourcecolor) | 否 | Color.White | 文本颜色。 | -| fontSize | number \| string | 否 | 10 | 文本大小,单位vp。 | -| badgeSize | number \| string | 否 | 16 | Badge的大小,单位vp。不支持百分比形式设置。当设置为非法值时,按照默认值处理。 | -| badgeColor | [ResourceColor](ts-types.md#resourcecolor) | 否 | Color.Red | Badge的颜色。 | +从API version 9开始,该接口支持在ArkTS卡片中使用。 + +| 名称 | 类型 | 必填 | 描述 | +| ------------------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| color | [ResourceColor](ts-types.md#resourcecolor) | 否 | 文本颜色。
默认值:Color.White | +| fontSize | number \| string | 否 | 文本大小。
默认值:10
单位:vp
**说明:**
不支持设置百分比。 | +| badgeSize | number \| string | 否 | Badge的大小。
默认值:16
单位:vp
**说明:**
不支持设置百分比。当设置为非法值时,按照默认值处理。 | +| badgeColor | [ResourceColor](ts-types.md#resourcecolor) | 否 | Badge的颜色。
默认值:Color.Red | +| fontWeight10+ | number \|[FontWeight](ts-appendix-enums.md#fontweight) \| string | 否 | 设置文本的字体粗细。
默认值:FontWeight.Normal
**说明:**
不支持设置百分比。 | +| borderColor10+ | [ResourceColor](ts-types.md#resourcecolor) | 否 | 底板描边颜色。 | +| borderWidth10+ | [Length](ts-types.md#length) | 否 | 底板描边粗细。
默认值:1
单位:vp
**说明:**
不支持设置百分比。 | + +## 属性 + +支持[通用属性](ts-universal-attributes-size.md)。 + +## 事件 + +支持[通用事件](ts-universal-events-click.md)。 ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-column.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-column.md index c5fbf12f97fbb91edd0c4fd55fedc189826c1dd9..fdc53cc542335c703974b7a40857b004983199d1 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-column.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-column.md @@ -16,11 +16,13 @@ Column(value?: {space?: string | number}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | | -------- | -------- | -------- | -------- | -| space | string \| number | 否 | 纵向布局元素垂直方向间距。
从API version 9开始,space为负数或者justifyContent设置为FlexAlign.SpaceBetween、FlexAlign.SpaceAround、FlexAlign.SpaceEvenly时不生效。
默认值:0 | +| space | string \| number | 否 | 纵向布局元素垂直方向间距。
从API version 9开始,space为负数或者justifyContent设置为FlexAlign.SpaceBetween、FlexAlign.SpaceAround、FlexAlign.SpaceEvenly时不生效。
默认值:0
**说明:**
可选值为大于等于0的数字,或者可以转换为数字的字符串。 | ## 属性 @@ -28,8 +30,8 @@ Column(value?: {space?: string | number}) | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| alignItems | [HorizontalAlign](ts-appendix-enums.md#horizontalalign) | 设置子组件在水平方向上的对齐格式。
默认值:HorizontalAlign.Center | -| justifyContent8+ | [FlexAlign](ts-appendix-enums.md#flexalign) | 设置子组件在垂直方向上的对齐格式。
默认值:FlexAlign.Start | +| alignItems | [HorizontalAlign](ts-appendix-enums.md#horizontalalign) | 设置子组件在水平方向上的对齐格式。
默认值:HorizontalAlign.Center
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| justifyContent8+ | [FlexAlign](ts-appendix-enums.md#flexalign) | 设置子组件在垂直方向上的对齐格式。
默认值:FlexAlign.Start
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-columnsplit.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-columnsplit.md index e035856a4c9b0c71dfad2d881c2e8639061841b7..72b91171c695749c6adc5588e21c68b7beadbec5 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-columnsplit.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-columnsplit.md @@ -29,6 +29,8 @@ ColumnSplit() > 与RowSplit相同,ColumnSplit的分割线最小能拖动到刚好包含子组件。 > > 在真机中查看拖动效果,预览器中不支持拖动。 +> +> 不支持clip、margin通用属性。 ## 示例 @@ -47,6 +49,7 @@ struct ColumnSplitExample { Text('4').width('100%').height(50).backgroundColor(0xD2B48C).textAlign(TextAlign.Center) Text('5').width('100%').height(50).backgroundColor(0xF5DEB3).textAlign(TextAlign.Center) } + .borderWidth(1) .resizeable(true) // 可拖动 .width('90%').height('60%') }.width('100%') @@ -54,4 +57,4 @@ struct ColumnSplitExample { } ``` -![zh-cn_image_0000001219982707](figures/zh-cn_image_0000001219982707.gif) +![zh-cn_image_0000001219982708](figures/zh-cn_image_0000001219982708.gif) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-counter.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-counter.md index bd52cece165bb2ab581da8ae3260032baeb48232..9afa07186103b7452fa3940f77e65c436f4f081b 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-counter.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-counter.md @@ -16,6 +16,16 @@ Counter() +从API version 9开始,该接口支持在ArkTS卡片中使用。 + +## 属性 + +除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性。 + +| 名称 | 参数类型 | 描述 | +| --------------------------- | ---------------------------------------- | ---------------------------------------- | +| enableInc10+ | boolean | 设置增加按钮禁用或使能。
默认值:true | +| enableDec10+ | boolean | 设置减少按钮禁用或使能。
默认值:true | ## 事件 @@ -23,8 +33,8 @@ Counter() | 名称 | 功能描述 | | -------- | -------- | -| onInc(event: () => void) | 监听数值增加事件。 | -| onDec(event: () => void) | 监听数值减少事件。 | +| onInc(event: () => void) | 监听数值增加事件。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| onDec(event: () => void) | 监听数值减少事件。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-flex.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-flex.md index b16e115138d36300c1fddac03c3aa3434a5ce0a0..59c55ba2ebf4fe8faff8f281ab72a09926ef29fb 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-flex.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-flex.md @@ -6,6 +6,7 @@ > > - 该组件从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 > - Flex组件在渲染时存在二次布局过程,因此在对性能有严格要求的场景下建议使用[Column](ts-container-column.md)、[Row](ts-container-row.md)代替。 +> - Flex组件主轴默认不设置时撑满父容器,[Column](ts-container-column.md)、[Row](ts-container-row.md)组件主轴不设置时默认是跟随子节点大小。 ## 子组件 @@ -19,14 +20,16 @@ Flex(value?: { direction?: FlexDirection, wrap?: FlexWrap, justifyContent?: Fle 标准Flex布局容器。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | | -------------- | ---------------------------------------- | ---- | ----------------- | ---------------------------------------- | -| direction | [FlexDirection](ts-appendix-enums.md#flexdirection) | 否 | FlexDirection.Row | 子组件在Flex容器上排列的方向,即主轴的方向。 | -| wrap | [FlexWrap](ts-appendix-enums.md#flexwrap) | 否 | FlexWrap.NoWrap | Flex容器是单行/列还是多行/列排列。 | -| justifyContent | [FlexAlign](ts-appendix-enums.md#flexalign) | 否 | FlexAlign.Start | 子组件在Flex容器主轴上的对齐格式。 | -| alignItems | [ItemAlign](ts-appendix-enums.md#itemalign) | 否 | ItemAlign.Start | 子组件在Flex容器交叉轴上的对齐格式。 | +| direction | [FlexDirection](ts-appendix-enums.md#flexdirection) | 否 | FlexDirection.Row | 子组件在Flex容器上排列的方向,即主轴的方向。 | +| wrap | [FlexWrap](ts-appendix-enums.md#flexwrap) | 否 | FlexWrap.NoWrap | Flex容器是单行/列还是多行/列排列。
**说明:**
在多行布局时,通过交叉轴方向,确认新行堆叠方向。 | +| justifyContent | [FlexAlign](ts-appendix-enums.md#flexalign) | 否 | FlexAlign.Start | 所有子组件在Flex容器主轴上的对齐格式。 | +| alignItems | [ItemAlign](ts-appendix-enums.md#itemalign) | 否 | ItemAlign.Start | 所有子组件在Flex容器交叉轴上的对齐格式。 | | alignContent | [FlexAlign](ts-appendix-enums.md#flexalign) | 否 | FlexAlign.Start | 交叉轴中有额外的空间时,多行内容的对齐方式。仅在wrap为Wrap或WrapReverse下生效。 | @@ -139,7 +142,7 @@ struct FlexExample2 { } ``` -![zh-cn_image_0000001174264366](figures/zh-cn_image_0000001174264366.PNG) +![zh-cn_image_0000001174264366](figures/zh-cn_image_0000001174264366.png) ```ts // xxx.ets @@ -237,7 +240,7 @@ struct FlexExample4 { } ``` -![zh-cn_image_0000001174422904](figures/zh-cn_image_0000001174422904.jpg) +![zh-cn_image_0000001174422904](figures/zh-cn_image_0000001174422904.png) ```ts // xxx.ets diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-grid.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-grid.md index ef8f2337eab6c6962066120ba4f6af42c41c42d0..012fa48e92f303e2dc8aae7ae54e93f23d7a88e9 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-grid.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-grid.md @@ -9,7 +9,23 @@ ## 子组件 -包含[GridItem](ts-container-griditem.md)子组件。 +仅支持[GridItem](ts-container-griditem.md)子组件。 + +> **说明:** +> +> Grid子组件的索引值计算规则: +> +> 按子组件的顺序依次递增。 +> +> if/else语句中,只有条件成立分支内的子组件会参与索引值计算,条件不成立分支内的子组件不计算索引值。 +> +> ForEach/LazyForEach语句中,会计算展开所有子节点索引值。 +> +> [if/else](../../quick-start/arkts-rendering-control-ifelse.md)、[ForEach](../../quick-start/arkts-rendering-control-foreach.md)和[LazyForEach](../../quick-start/arkts-rendering-control-lazyforeach.md)发生变化以后,会更新子节点索引值。 +> +> Grid子组件的visibility属性设置为Hidden或None时依然会计算索引值。 +> +> Grid子组件的visibility属性设置为None时不显示,但依然会占用子组件对应的网格。 ## 接口 @@ -18,9 +34,9 @@ Grid(scroller?: Scroller) **参数:** -| 参数名 | 参数类型 | 必填 | 参数描述 | -| --------- | ---------------------------------------- | ---- | ----------------------- | -| scroller | [Scroller](ts-container-scroll.md#scroller) | 否 | 可滚动组件的控制器。用于与可滚动组件进行绑定。 | +| 参数名 | 参数类型 | 必填 | 参数描述 | +| -------- | ------------------------------------------- | ---- | ------------------------------------------------------------ | +| scroller | [Scroller](ts-container-scroll.md#scroller) | 否 | 可滚动组件的控制器。用于与可滚动组件进行绑定。
**说明:**
不允许和其他[滚动类组件](ts-container-list.md)绑定同一个滚动控制对象。 | ## 属性 @@ -28,41 +44,58 @@ Grid(scroller?: Scroller) | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| columnsTemplate | string | 设置当前网格布局列的数量,不设置时默认1列。
例如, '1fr 1fr 2fr' 是将父组件分3列,将父组件允许的宽分为4等份,第一列占1份,第二列占1份,第三列占2份。| -| rowsTemplate | string | 设置当前网格布局行的数量,不设置时默认1行。
例如, '1fr 1fr 2fr'是将父组件分三行,将父组件允许的高分为4等份,第一行占1份,第二行占一份,第三行占2份。 | -| columnsGap | Length | 设置列与列的间距。
默认值:0 | -| rowsGap | Length | 设置行与行的间距。
默认值:0 | -| scrollBar | [BarState](ts-appendix-enums.md#barstate) | 设置滚动条状态。
默认值:BarState.Off | -| scrollBarColor | string \| number \| Color | 设置滚动条的颜色。 | -| scrollBarWidth | string \| number | 设置滚动条的宽度。 | -| cachedCount | number | 设置预加载的GridItem的数量。具体使用可参考[减少应用白块说明](../../ui/ui-ts-performance-improvement-recommendation.md#减少应用滑动白块)。
默认值:1 | +| columnsTemplate | string | 设置当前网格布局列的数量,不设置时默认1列。
例如, '1fr 1fr 2fr' 是将父组件分3列,将父组件允许的宽分为4等份,第一列占1份,第二列占1份,第三列占2份。
**说明:**
设置为'0fr'时,该列的列宽为0,不显示GridItem。设置为其他非法值时,GridItem显示为固定1列。 | +| rowsTemplate | string | 设置当前网格布局行的数量,不设置时默认1行。
例如, '1fr 1fr 2fr'是将父组件分三行,将父组件允许的高分为4等份,第一行占1份,第二行占一份,第三行占2份。
**说明:**
设置为'0fr',则这一行的行宽为0,这一行GridItem不显示。设置为其他非法值,按固定1行处理。 | +| columnsGap | [Length](ts-types.md#length) | 设置列与列的间距。
默认值:0
**说明:**
设置为小于0的值时,按默认值显示。 | +| rowsGap | [Length](ts-types.md#length) | 设置行与行的间距。
默认值:0
**说明:**
设置为小于0的值时,按默认值显示。 | +| scrollBar | [BarState](ts-appendix-enums.md#barstate) | 设置滚动条状态。
默认值:BarState.Off
**说明:**
API version 9及以下版本默认值为BarState.Off,API version 10的默认值为BarState.Auto。 | +| scrollBarColor | string \| number \| [Color](ts-appendix-enums.md#color) | 设置滚动条的颜色。 | +| scrollBarWidth | string \| number | 设置滚动条的宽度。宽度设置后,滚动条正常状态和按压状态宽度均为滚动条的宽度值。
默认值:4
单位:vp | +| cachedCount | number | 设置预加载的GridItem的数量,只在[LazyForEach](../../quick-start/arkts-rendering-control-lazyforeach.md)中生效。具体使用可参考[减少应用白块说明](../../ui/arkts-performance-improvement-recommendation.md#减少应用滑动白块)。
默认值:1
**说明:**
设置缓存后会在Grid显示区域上下各缓存cachedCount*列数个GridItem。
[LazyForEach](../../quick-start/arkts-rendering-control-lazyforeach.md)超出显示和缓存范围的GridItem会被释放。
设置为小于0的值时,按默认值显示。 | | editMode 8+ | boolean | 设置Grid是否进入编辑模式,进入编辑模式可以拖拽Grid组件内部[GridItem](ts-container-griditem.md)。
默认值:flase | | layoutDirection8+ | [GridDirection](#griddirection8枚举说明) | 设置布局的主轴方向。
默认值:GridDirection.Row | -| maxCount8+ | number | 当layoutDirection是Row/RowReverse时,表示可显示的最大列数
当layoutDirection是Column/ColumnReverse时,表示可显示的最大行数。
默认值:Infinity | -| minCount8+ | number | 当layoutDirection是Row/RowReverse时,表示可显示的最小列数。
当layoutDirection是Column/ColumnReverse时,表示可显示的最小行数。
默认值:1 | +| maxCount8+ | number | 当layoutDirection是Row/RowReverse时,表示可显示的最大列数
当layoutDirection是Column/ColumnReverse时,表示可显示的最大行数。
默认值:Infinity
**说明:**
当maxCount小于minCount时,maxCount和minCount都按默认值处理。
设置为小于0的值时,按默认值显示。 | +| minCount8+ | number | 当layoutDirection是Row/RowReverse时,表示可显示的最小列数。
当layoutDirection是Column/ColumnReverse时,表示可显示的最小行数。
默认值:1
**说明:**
设置为小于0的值时,按默认值显示。 | | cellLength8+ | number | 当layoutDirection是Row/RowReverse时,表示一行的高度。
当layoutDirection是Column/ColumnReverse时,表示一列的宽度。
默认值:第一个元素的大小 | | multiSelectable8+ | boolean | 是否开启鼠标框选。
默认值:false
- false:关闭框选。
- true:开启框选。 | -| supportAnimation8+ | boolean | 是否支持动画。
默认值:false | +| supportAnimation8+ | boolean | 是否支持动画。当前支持GridItem拖拽动画。
默认值:false | +| edgeEffect10+ | [EdgeEffect](ts-appendix-enums.md#edgeeffect) | 设置组件的滑动效果,支持弹簧效果和阴影效果。
默认值:EdgeEffect.None
| Grid组件根据rowsTemplate、columnsTemplate属性的设置情况,可分为以下三种布局模式: 1、rowsTemplate、columnsTemplate同时设置: -Grid只展示固定行列数的元素,其余元素不展示,且Grid不可滚动。例如rowsTemplate、columnsTemplate都设置为"1fr 1fr"时,则仅展示两行两列,共4个元素,其他元素不展示。 - -此模式下以下属性不生效:layoutDirection、maxCount、minCount、cellLength。 +- Grid只展示固定行列数的元素,其余元素不展示,且Grid不可滚动。 +- 此模式下以下属性不生效:layoutDirection、maxCount、minCount、cellLength。 +- Grid的宽高没有设置时,默认适应父组件尺寸。 +- Gird网格列大小按照Gird自身内容区域大小减去所有行列Gap后按各个行列所占比重分配。 +- GridItem默认填满网格大小。 +- 此模式下GridItem同时设置了rowStart、columnStart,会用设置的rowStart、columnStart所在位置摆放GridItem。如果这个位置已经有GridItem则会发生重叠。 +- 如果GridItem设置了rowStart、columnStart其中一个,会从上一个GridItem布局位置开始遍历寻找满足rowStart或columnStart的空闲位置摆放,如果无满足条件的空闲位置,则不布局该GridItem。 +- 如果GridItem的rowStart、columnStart属性都没有设置,会从上一个GridItem布局位置开始遍历寻找空闲位置摆放,如果没有空闲位置,则不布局该GridItem。 +- 如果GridItem的rowEnd有设置,但是rowStart没有设置,当做rowStart已经设置,并且和rowEnd设置为相同值。如果GridItem的columnEnd有设置,但是columnStart没有设置,当做columnStart已经设置,并且和columnEnd设置为相同值。 2、rowsTemplate、columnsTemplate仅设置其中的一个: -元素按照设置的方向进行排布,超出的元素可通过滚动的方式展示。例如Grid有十个元素,且设置columnsTemplate为"1fr 1fr 1fr",则Grid有三列,元素先填满一行,再填充下一行。在Grid区域外的元素,可通过竖直方向的滚动,进行展示。 - -此模式下以下属性不生效:layoutDirection、maxCount、minCount、cellLength。 +- 元素按照设置的方向进行排布,超出Grid显示区域后,Grid可通过滚动的方式展示。 +- 如果设置了columnsTemplate,Gird滚动方向为垂直方向,主轴方向为垂直方向,交叉轴方向为水平方向。 +- 如果设置了rowsTemplate,Gird滚动方向为水平方向,主轴方向为水平方向,交叉轴方向为垂直方向。 +- 此模式下以下属性不生效:layoutDirection、maxCount、minCount、cellLength。 +- 网格交叉轴方向尺寸根据Gird自身内容区域交叉轴尺寸减去交叉轴方向所有Gap后按所占比重分配。 +- 网格主轴方向尺寸取当前网格交叉轴方向所有GridItem高度最大值。 +- 此模式下GridItem同时设置了rowStart、columnStart,会用设置的rowStart、columnStart所在位置摆放GridItem。如果这个位置已经有GridItem则会发生重叠。 +- 如果GridItem设置了rowStart、columnStart其中一个,会从上一个GridItem布局位置开始遍历寻找满足rowStart或columnStart的空闲位置摆放。 +- 如果GridItem的rowStart、columnStart属性都没有设置,会从上一个GridItem布局位置开始遍历寻找空闲位置摆放。 +- 如果GridItem的rowEnd有设置,但是rowStart没有设置,当做rowStart已经设置,并且和rowEnd设置为相同值。如果GridItem的columnEnd有设置,但是columnStart没有设置,当做columnStart已经设置,并且和columnEnd设置为相同值。 3、rowsTemplate、columnsTemplate都不设置: -元素在layoutDirection方向上排布,列数由Grid的宽度、首个元素的宽度、minCount、maxCount、columnsGap共同决定;行数由Grid高度、首个元素高度、cellLength、rowsGap共同决定。超出行列容纳范围的元素不显示,也不能通过滚动进行展示。 - -此模式下仅生效以下属性:layoutDirection、maxCount、minCount、cellLength、editMode、columnsGap、rowsGap。 +- 元素在layoutDirection方向上排布,列数由Grid的宽度、首个元素的宽度、minCount、maxCount、columnsGap共同决定。 +- 行数由Grid高度、首个元素高度、cellLength、rowsGap共同决定。超出行列容纳范围的元素不显示,也不能通过滚动进行展示。 +- 此模式下仅生效以下属性:layoutDirection、maxCount、minCount、cellLength、editMode、columnsGap、rowsGap。 +- 当前layoutDirection设置为Row时,先从左到右排列,排满一行再排一下一列。剩余高度不足时不再布局,整体内容顶部居中。 +- 当前layoutDirection设置为Column时,先从上到下排列,排满一列再排一下一列,剩余宽度度不足时不再。整体内容顶部居中。 +- 此模式下GridItem的rowStart、columnStart不生效。 ## GridDirection8+枚举说明 @@ -73,14 +106,18 @@ Grid只展示固定行列数的元素,其余元素不展示,且Grid不可滚 | RowReverse | 主轴布局方向沿水平方向反向布局,即自右往左先填满一行,再去填下一行。 | | ColumnReverse | 主轴布局方向沿垂直方向反向布局,即自下往上先填满一列,再去填下一列。 | +> **说明:** +> +> Grid组件[通用属性clip](ts-universal-attributes-sharp-clipping.md)的默认值为true。 + ## 事件 除支持[通用事件](ts-universal-events-click.md)外,还支持以下事件: | 名称 | 功能描述 | | -------- | -------- | -| onScrollIndex(event: (first: number) => void) | 当前网格显示的起始位置item发生变化时触发。
- first: 当前显示的网格起始位置的索引值。 | -| onItemDragStart(event: (event: ItemDragInfo, itemIndex: number) => (() => any) \| void) | 开始拖拽网格元素时触发。
- event: 见[ItemDragInfo对象说明](#itemdraginfo对象说明)。
- itemIndex: 被拖拽网格元素索引值。 | +| onScrollIndex(event: (first: number) => void) | 当前网格显示的起始位置item发生变化时触发。列表初始化时会触发一次。
- first: 当前显示的网格起始位置的索引值。
Grid显示区域上第一个子组件的索引值有变化就会触发。 | +| onItemDragStart(event: (event: ItemDragInfo, itemIndex: number) => (() => any) \| void) | 开始拖拽网格元素时触发。
- event: 见[ItemDragInfo对象说明](#itemdraginfo对象说明)。
- itemIndex: 被拖拽网格元素索引值。
**说明:**
返回void表示不能拖拽。
手指长按GridItem时触发该事件。 | | onItemDragEnter(event: (event: ItemDragInfo) => void) | 拖拽进入网格元素范围内时触发。
- event: 见[ItemDragInfo对象说明](#itemdraginfo对象说明)。 | | onItemDragMove(event: (event: ItemDragInfo, itemIndex: number, insertIndex: number) => void) | 拖拽在网格元素范围内移动时触发。
- event: 见[ItemDragInfo对象说明](#itemdraginfo对象说明)。
- itemIndex: 拖拽起始位置。
- insertIndex: 拖拽插入位置。 | | onItemDragLeave(event: (event: ItemDragInfo, itemIndex: number) => void) | 拖拽离开网格元素时触发。
- event: 见[ItemDragInfo对象说明](#itemdraginfo对象说明)。
- itemIndex: 拖拽离开的网格元素索引值。 | @@ -145,6 +182,7 @@ struct GridExample { .columnsTemplate('1fr 1fr 1fr 1fr 1fr') .columnsGap(10) .rowsGap(10) + .edgeEffect(EdgeEffect.Spring) .onScrollIndex((first: number) => { console.info(first.toString()) }) @@ -160,4 +198,4 @@ struct GridExample { } ``` -![zh-cn_image_0000001219744183](figures/zh-cn_image_0000001219744183.gif) \ No newline at end of file +![zh-cn_image_0000001219744183](figures/zh-cn_image_0000001219744183.gif) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-gridcol.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-gridcol.md index 2083ff7d49c7296f09a434ac0d805a775f5530d7..0f44c9893d991f2c30c8d164b745c51ddf2f418b 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-gridcol.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-gridcol.md @@ -13,6 +13,8 @@ GridCol(option?:{span?: number | GridColColumnOption, offset?: number | GridColColumnOption, order?: number | GridColColumnOption}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 类型 | 必填 | 说明 | @@ -25,12 +27,14 @@ GridCol(option?:{span?: number | GridColColumnOption, offset?: number | GridColC | 参数名 | 类型 | 必填 | 说明 | | ------ | ----------------------------- | ---- | ------------------------------------------------------------ | -| span | number \| GridColColumnOption | 否 | 占用列数。span为0,意味着该元素不参与布局计算,即不会被渲染。
默认值:1。 | -| offset | number \| GridColColumnOption | 否 | 相对于前一个栅格子组件偏移的列数。
默认值:0。 | -| order | number \| GridColColumnOption | 否 | 元素的序号,根据栅格子组件的序号,从小到大对栅格子组件做排序。
默认值:0。 | +| span | number \| GridColColumnOption | 否 | 占用列数。span为0,意味着该元素不参与布局计算,即不会被渲染。
默认值:1。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| gridColOffset | number \| GridColColumnOption | 否 | 相对于前一个栅格子组件偏移的列数。
默认值:0。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| order | number \| GridColColumnOption | 否 | 元素的序号,根据栅格子组件的序号,从小到大对栅格子组件做排序。
默认值:0。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## GridColColumnOption +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 参数名 | 参数类型 | 必填 | 参数描述 | | ----- | ------ | ---- | ---------------------------------------- | | xs | number | 否 | 最小宽度类型设备。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-gridrow.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-gridrow.md index 0e48ee9510e55b54917e45abb27f01dad6bac642..83f518f5d2488421e9c17ca7db240ccfee297721 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-gridrow.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-gridrow.md @@ -15,6 +15,8 @@ ## 接口 GridRow(option?: {columns?: number | GridRowColumnOption, gutter?: Length | GutterOption, breakpoints?: BreakPoints, direction?: GridRowDirection}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 |类型|必填|说明| @@ -26,6 +28,8 @@ GridRow(option?: {columns?: number | GridRowColumnOption, gutter?: Length | Gutt ## GutterOption +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 参数名 | 参数类型 | 必填 | 参数描述 | | ----- | ------ | ---- | ---------------------------------------- | | x | Length \| GridRowSizeOption | 否 | 水平gutter option。 | @@ -35,6 +39,8 @@ GridRow(option?: {columns?: number | GridRowColumnOption, gutter?: Length | Gutt 栅格在不同宽度设备类型下,栅格列数。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 参数名 | 参数类型 | 必填 | 参数描述 | | ----- | ------ | ---- | ---------------------------------------- | | xs | number | 否 | 最小宽度类型设备。 | @@ -48,6 +54,8 @@ GridRow(option?: {columns?: number | GridRowColumnOption, gutter?: Length | Gutt 栅格在不同宽度设备类型下,gutter的大小。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 参数名 | 参数类型 | 必填 | 参数描述 | | ----- | ------ | ---- | ---------------------------------------- | | xs | Length | 否 | 最小宽度类型设备。 | @@ -59,6 +67,8 @@ GridRow(option?: {columns?: number | GridRowColumnOption, gutter?: Length | Gutt ## BreakPoints +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 参数名 | 参数类型 | 必填 | 参数描述 | | ----- | ------ | ---- | ---------------------------------------- | | value | Array<string> | 否 | 设置断点位置的单调递增数组。
默认值:["320vp", "600vp", "840vp"] | @@ -73,12 +83,18 @@ GridRow(option?: {columns?: number | GridRowColumnOption, gutter?: Length | Gutt ``` ## BreakpointsReference枚举类型 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 枚举名 | 描述 | | -------- | -------- | | WindowSize | 以窗口为参照。 | | ComponentSize | 以容器为参照。 | ## GridRowDirection枚举类型 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 枚举名 | 描述 | | -------- | -------- | | Row | 栅格元素按照行方向排列。 | @@ -110,7 +126,11 @@ GridRow(option?: {columns?: number | GridRowColumnOption, gutter?: Length | Gutt ## 属性 -支持[通用属性](ts-universal-attributes-size.md)。 +除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性: + +| 名称 | 参数类型 | 描述 | +| ----------------------- | ----------------------------------- | ------------------------------------------- | +| alignItems10+ | [ItemAlign](ts-appendix-enums.md#itemalign) | 设置GridRow中的GridCol垂直主轴方向对齐方式,默认值:ItemAlign.Start
说明:
在ItemAlign中,实际支持的参数枚举值仅为Start、Center、End、Stretch。
GridCol本身也可通过alignSelf([ItemAlign](ts-appendix-enums.md#itemalign))设置自身对齐方式。当上述两种对齐方式都设置时,以GridCol自身设置为准。
从API version 10开始,该接口支持在ArkTS卡片中使用。 | ## 事件 @@ -119,6 +139,8 @@ GridRow(option?: {columns?: number | GridRowColumnOption, gutter?: Length | Gutt onBreakpointChange(callback: (breakpoints: string) => void) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 说明 | 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 a8f0f9b6247b11858d7c291afad7e4a1d7558c4f..b0e404f3c1c0e9e0bfd210526788d7cf134f951f 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 @@ -10,20 +10,40 @@ ## 子组件 -包含[ListItem](ts-container-listitem.md)、[ListItemGroup](ts-container-listitemgroup.md)子组件。 +仅支持[ListItem](ts-container-listitem.md)、[ListItemGroup](ts-container-listitemgroup.md)子组件。 + +> **说明:** +> +> List的子组件的索引值计算规则: +> +> 按子组件的顺序依次递增。 +> +> if/else语句中,只有条件成立的分支内的子组件会参与索引值计算,条件不成立的分支内子组件不计算索引值。 +> +> ForEach/LazyForEach语句中,会计算展开所有子节点索引值。 +> +> [if/else](../../quick-start/arkts-rendering-control-ifelse.md)、[ForEach](../../quick-start/arkts-rendering-control-foreach.md)和[LazyForEach](../../quick-start/arkts-rendering-control-lazyforeach.md)发生变化以后,会更新子节点索引值。 +> +> ListItemGroup作为一个整体计算一个索引值,ListItemGroup内部的ListItem不计算索引值。 +> +> List子组件visibility属性设置为Hidden或None依然会计算索引值。 +> +> List子组件的visibility属性设置为None时不显示,但该子组件上下的space还会生效。 ## 接口 List(value?:{space?: number | string, initialIndex?: number, scroller?: Scroller}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | | -------- | -------- | -------- | -------- | -| space | number \| string | 否 | 列表项间距。
默认值:0 | -| initialIndex | number | 否 | 设置当前List初次加载时视口起始位置显示的item的索引值。如果设置的值超过了当前List最后一个item的索引值,则设置不生效。
默认值:0 | -| scroller | [Scroller](ts-container-scroll.md#scroller) | 否 | 可滚动组件的控制器。用于与可滚动组件进行绑定。 | +| space | number \| string | 否 | 子组件主轴方向的间隔。
默认值:0
**说明:**
设置为除-1外其他负数或百分比时,按默认值显示。
space参数值小于List分割线宽度时,子组件主轴方向的间隔取分割线宽度。 | +| initialIndex | number | 否 | 设置当前List初次加载时视口起始位置显示的item的索引值。
默认值:0
**说明:**
设置为除-1外其他负数或超过了当前List最后一个item的索引值时视为无效取值,无效取值按默认值显示。 | +| scroller | [Scroller](ts-container-scroll.md#scroller) | 否 | 可滚动组件的控制器。用于与可滚动组件进行绑定。
**说明:**
不允许和其他滚动类组件绑定同一个滚动控制对象。 | ## 属性 @@ -31,20 +51,22 @@ List(value?:{space?: number | string, initialIndex?: number, scroller? | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| listDirection | [Axis](ts-appendix-enums.md#axis) | 设置List组件排列方向。
默认值:Axis.Vertical | -| divider | {
strokeWidth: [Length](ts-types.md#length),
color?:[ResourceColor](ts-types.md),
startMargin?: Length,
endMargin?: Length
} \| null | 设置ListItem分割线样式,默认无分割线。
- strokeWidth: 分割线的线宽。
- color: 分割线的颜色。
- startMargin: 分割线与列表侧边起始端的距离。
- endMargin: 分割线与列表侧边结束端的距离。 | -| scrollBar | [BarState](ts-appendix-enums.md#barstate) | 设置滚动条状态。
默认值:BarState.Off | -| cachedCount | number | 设置列表中ListItem/ListItemGroup的预加载数量,其中ListItemGroup将作为一个整体进行计算,ListItemGroup中的所有ListItem会一次性全部加载出来。具体使用可参考[减少应用白块说明](../../ui/ui-ts-performance-improvement-recommendation.md#减少应用滑动白块)。
默认值:1 | +| listDirection | [Axis](ts-appendix-enums.md#axis) | 设置List组件排列方向。
默认值:Axis.Vertical
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| divider | {
strokeWidth: [Length](ts-types.md#length),
color?:[ResourceColor](ts-types.md#resourcecolor),
startMargin?: Length,
endMargin?: Length
} \| null | 设置ListItem分割线样式,不支持设置百分比,默认无分割线。
- strokeWidth: 分割线的线宽。
- color: 分割线的颜色。
- startMargin: 分割线与列表侧边起始端的距离。
- endMargin: 分割线与列表侧边结束端的距离。
从API version 9开始,该接口支持在ArkTS卡片中使用。
endMargin +startMargin 不能超过列宽度。
startMargin和endMargin不支持设置百分比。
List的分割线画在主轴方向两个子组件之间,第一个子组件上方和最后一个子组件下方不会绘制分割线。
多列模式下,ListItem与ListItem之间的分割线起始边距从每一列的交叉轴方向起始边开始计算,其他情况从List交叉轴方向起始边开始计算。 | +| scrollBar | [BarState](ts-appendix-enums.md#barstate) | 设置滚动条状态。
默认值:BarState.Off
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
API version 9及以下版本默认值为BarState.Off,API version 10的默认值为BarState.Auto。 | +| cachedCount | number | 设置列表中ListItem/ListItemGroup的预加载数量,只在[LazyForEach](../../quick-start/arkts-rendering-control-lazyforeach.md)中生效,其中ListItemGroup将作为一个整体进行计算,ListItemGroup中的所有ListItem会一次性全部加载出来。具体使用可参考[减少应用白块说明](../../ui/arkts-performance-improvement-recommendation.md#减少应用滑动白块)。
默认值:1
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
单列模式下,会在List显示的ListItem前后各缓存cachedCount个ListItem。
多列模式下, 会在List显示的ListItem前后各缓存cachedCount*列数个ListItem。 | | editMode(deprecated) | boolean | 声明当前List组件是否处于可编辑模式。
从API version9开始废弃。
默认值:false | -| edgeEffect | [EdgeEffect](ts-appendix-enums.md#edgeeffect) | 设置组件的滑动效果。
默认值:EdgeEffect.Spring | -| chainAnimation | boolean | 设置当前List是否启用链式联动动效,开启后列表滑动以及顶部和底部拖拽时会有链式联动的效果。链式联动效果:List内的list-item间隔一定距离,在基本的滑动交互行为下,主动对象驱动从动对象进行联动,驱动效果遵循弹簧物理动效。
默认值:false
- false:不启用链式联动。
- true:启用链式联动。 | -| multiSelectable8+ | boolean | 是否开启鼠标框选。
默认值:false
- false:关闭框选。
- true:开启框选。 | -| lanes9+ | number \| [LengthConstrain](ts-types.md#lengthconstrain) | 以列模式为例(listDirection为Axis.Vertical):
lanes用于决定List组件在交叉轴方向按几列布局。
默认值:1
规则如下:
- lanes为指定的数量时,根据指定的数量与List组件的交叉轴宽度来决定每列的宽度;
- lane设置了{minLength,maxLength}时,根据List组件的宽度自适应决定lanes数量(即列数),保证缩放过程中lane的宽度符合{minLength,maxLength}的限制。其中,minLength条件会被优先满足,即优先保证符合ListItem的宽度符合最小宽度限制。例如在列模式下,设置了{minLength: 40vp,maxLength: 60vp},则当List组件宽度为70vp时,ListItem为一列,并且根据alignListItem属性做靠左、居中或者靠右布局;当List组件宽度变化至80vp时,符合两倍的minLength,则ListItem自适应为两列。 | -| alignListItem9+ | ListItemAlign | List交叉轴方向宽度大于ListItem交叉轴宽度 * lanes时,ListItem在List交叉轴方向的布局方式,默认为首部对齐。
默认值:ListItemAlign.Start | -| sticky9+ | StickyStyle | 配合[ListItemGroup](ts-container-listitemgroup.md)组件使用,设置ListItemGroup中header和footer是否要吸顶或吸底。
默认值:StickyStyle.None
**说明:**
sticky属性可以设置为 StickyStyle.Header \| StickyStyle.Footer 以同时支持header吸顶和footer吸底。 | +| edgeEffect | [EdgeEffect](ts-appendix-enums.md#edgeeffect) | 设置组件的滑动效果,支持弹簧效果和阴影效果。
默认值:EdgeEffect.Spring
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| chainAnimation | boolean | 设置当前List是否启用链式联动动效,开启后列表滑动以及顶部和底部拖拽时会有链式联动的效果。链式联动效果:List内的list-item间隔一定距离,在基本的滑动交互行为下,主动对象驱动从动对象进行联动,驱动效果遵循弹簧物理动效。
默认值:false
- false:不启用链式联动。
- true:启用链式联动。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| multiSelectable8+ | boolean | 是否开启鼠标框选。
默认值:false
- false:关闭框选。
- true:开启框选。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| lanes9+ | number \| [LengthConstrain](ts-types.md#lengthconstrain) | 以列模式为例(listDirection为Axis.Vertical):
lanes用于决定List组件在交叉轴方向按几列布局。
默认值:1
规则如下:
- lanes为指定的数量时,根据指定的数量与List组件的交叉轴尺寸除以列数作为列的宽度。
- lanes设置了{minLength,maxLength}时,根据List组件的宽度自适应决定lanes数量(即列数),保证缩放过程中lane的宽度符合{minLength,maxLength}的限制。其中,minLength条件会被优先满足,即优先保证符合ListItem的交叉轴尺寸符合最小限制。
- lanes设置了{minLength,maxLength},如果父组件交叉轴方向尺寸约束为无穷大时,固定按一列排列,列宽度按显示区域内最大的ListItem计算
- ListItemGroup在多列模式下也是独占一行,ListItemGroup中的ListItem按照List组件的lanes属性设置值来布局。
- lanes设置了{minLength,maxLength}时,计算列数会按照ListItemGroup的交叉轴尺寸计算。当ListItemGroup交叉轴尺寸与List交叉轴尺寸不一致时ListItemGroup中的列数与List中的列数可能不一样。
该接口支持在ArkTS卡片中使用。 | +| alignListItem9+ | [ListItemAlign](#listitemalign9枚举说明) | List交叉轴方向宽度大于ListItem交叉轴宽度 * lanes时,ListItem在List交叉轴方向的布局方式,默认为首部对齐。
默认值:ListItemAlign.Start
该接口支持在ArkTS卡片中使用。 | +| sticky9+ | [StickyStyle](#stickystyle9枚举说明) | 配合[ListItemGroup](ts-container-listitemgroup.md)组件使用,设置ListItemGroup中header和footer是否要吸顶或吸底。
默认值:StickyStyle.None
该接口支持在ArkTS卡片中使用。
**说明:**
sticky属性可以设置为 StickyStyle.Header \| StickyStyle.Footer 以同时支持header吸顶和footer吸底。 | ## ListItemAlign9+枚举说明 +该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------ | -------------------------------------- | | Start | ListItem在List中,交叉轴方向首部对齐。 | @@ -53,40 +75,46 @@ List(value?:{space?: number | string, initialIndex?: number, scroller? ## StickyStyle9+枚举说明 +该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------ | -------------------------------------- | | None | ListItemGroup的header不吸顶,footer不吸底。 | -| Header | ListItemGroup的header吸顶。 | -| Footer | ListItemGroup的footer吸底。 | - +| Header | ListItemGroup的header吸顶,footer不吸底。 | +| Footer | ListItemGroup的footer吸底,header不吸底。 | +> **说明:** +> +> List组件[通用属性clip](ts-universal-attributes-sharp-clipping.md)的默认值为true。 ## 事件 | 名称 | 功能描述 | | -------- | -------- | | onItemDelete(deprecated)(event: (index: number) => boolean) | 当List组件在编辑模式时,点击ListItem右边出现的删除按钮时触发。
从API version9开始废弃。
- index: 被删除的列表项的索引值。 | -| onScroll(event: (scrollOffset: number, scrollState: ScrollState) => void) | 列表滑动时触发。
- scrollOffset: 滑动偏移量。
- [scrollState](#scrollstate枚举说明): 当前滑动状态。 | -| onScrollIndex(event: (start: number, end: number) => void) | 列表滑动时触发。
计算索引值时,ListItemGroup作为一个整体占一个索引值,不计算ListItemGroup内部ListItem的索引值。
- start: 滑动起始位置索引值。
- end: 滑动结束位置索引值。 | -| onReachStart(event: () => void) | 列表到达起始位置时触发。 | -| onReachEnd(event: () => void) | 列表到底末尾位置时触发。 | -| onScrollFrameBegin9+(event: (offset: number, state: ScrollState) => { offsetRemain }) | 列表开始滑动时触发,事件参数传入即将发生的滑动量,事件处理函数中可根据应用场景计算实际需要的滑动量并作为事件处理函数的返回值返回,列表将按照返回值的实际滑动量进行滑动。
\- offset:即将发生的滑动量。
\- state:当前滑动状态。
- offsetRemain:水平方向实际滑动量。 | -| onScrollStart9+(event: () => void) | 列表滑动开始时触发。手指拖动列表或列表的滚动条触发的滑动开始时,会触发该事件。使用[Scroller](ts-container-scroll.md#scroller)滑动控制器触发的滑动,不会触发该事件。 | -| onScrollStop(event: () => void) | 列表滑动停止时触发。手拖动列表或列表的滚动条触发的滑动,手离开屏幕并且滑动停止时会触发该事件;使用[Scroller](ts-container-scroll.md#scroller)滑动控制器触发的滑动,不会触发该事件。 | +| onScroll(event: (scrollOffset: number, scrollState: ScrollState) => void) | 列表滑动时触发。
- scrollOffset: 每帧滚动的偏移量,List的内容向上滚动时偏移量为正,向下滚动时偏移量为负。
- [scrollState](#scrollstate枚举说明): 当前滑动状态。
使用控制器调用ScrollEdge和ScrollToIndex时不会触发,其余情况有滚动就会触发该事件。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| onScrollIndex(event: (start: number, end: number) => void) | 有子组件划入或划出List显示区域时触发。
计算索引值时,ListItemGroup作为一个整体占一个索引值,不计算ListItemGroup内部ListItem的索引值。
- start: 滑动起始位置索引值。
- end: 滑动结束位置索引值。
触发该事件的条件:列表初始化时会触发一次,List显示区域内第一个子组件的索引值或后一个子组件的索引值有变化时会触发。
List的边缘效果为弹簧效果时,在List划动到边缘继续划动和松手回弹过程不会触发onScrollIndex事件。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| onReachStart(event: () => void) | 列表到达起始位置时触发。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
List初始化时如果initialIndex为0会触发一次,List滚动到起始位置时触发一次。List边缘效果为弹簧效果时,划动经过起始位置时触发一次,回弹回起始位置时再触发一次。 | +| onReachEnd(event: () => void) | 列表到底末尾位置时触发。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
List边缘效果为弹簧效果时,划动经过末尾位置时触发一次,回弹回末尾位置时再触发一次。 | +| onScrollFrameBegin9+(event: (offset: number, state: ScrollState) => { offsetRemain }) | 列表开始滑动时触发,事件参数传入即将发生的滑动量,事件处理函数中可根据应用场景计算实际需要的滑动量并作为事件处理函数的返回值返回,列表将按照返回值的实际滑动量进行滑动。
\- offset:即将发生的滑动量,单位vp。
\- state:当前滑动状态。
- offsetRemain:实际滑动量,单位vp。
触发该事件的条件:手指拖动List、List惯性划动时每帧开始时触发;List超出边缘回弹、使用滚动控制器的滚动不会触发。
该接口支持在ArkTS卡片中使用。
**说明:**
当listDirection的值为Axis.Vertical时,返回垂直方向滑动量,当listDirection的值为Axis.Horizontal时,返回水平方向滑动量。 | +| onScrollStart9+(event: () => void) | 列表滑动开始时触发。手指拖动列表或列表的滚动条触发的滑动开始时,会触发该事件。使用[Scroller](ts-container-scroll.md#scroller)滑动控制器触发的带动画的滑动,动画开始时会触发该事件。
该接口支持在ArkTS卡片中使用。 | +| onScrollStop(event: () => void) | 列表滑动停止时触发。手拖动列表或列表的滚动条触发的滑动,手离开屏幕并且滑动停止时会触发该事件;使用[Scroller](ts-container-scroll.md#scroller)滑动控制器触发的带动画的滑动,动画停止会触发该事件。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | | onItemMove(event: (from: number, to: number) => boolean) | 列表元素发生移动时触发。
- from: 移动前索引值。
- to: 移动后索引值。 | | onItemDragStart(event: (event: ItemDragInfo, itemIndex: number) => ((() => any) \| void) | 开始拖拽列表元素时触发。
- event: 见[ItemDragInfo对象说明](ts-container-grid.md#itemdraginfo对象说明)。
- itemIndex: 被拖拽列表元素索引值。 | | onItemDragEnter(event: (event: ItemDragInfo) => void) | 拖拽进入列表元素范围内时触发。
- event: 见[ItemDragInfo对象说明](ts-container-grid.md#itemdraginfo对象说明)。 | | onItemDragMove(event: (event: ItemDragInfo, itemIndex: number, insertIndex: number) => void) | 拖拽在列表元素范围内移动时触发。
- event: 见[ItemDragInfo对象说明](ts-container-grid.md#itemdraginfo对象说明)。
- itemIndex: 拖拽起始位置。
- insertIndex: 拖拽插入位置。 | | onItemDragLeave(event: (event: ItemDragInfo, itemIndex: number) => void) | 拖拽离开列表元素时触发。
- event: 见[ItemDragInfo对象说明](ts-container-grid.md#itemdraginfo对象说明)。
- itemIndex: 拖拽离开的列表元素索引值。 | -| onItemDrop(event: (event: ItemDragInfo, itemIndex: number, insertIndex: number, isSuccess: boolean) => void) | 绑定该事件的列表元素可作为拖拽释放目标,当在列表元素内停止拖拽时触发。
- event: 见[ItemDragInfo对象说明](ts-container-grid.md#itemdraginfo对象说明)。
- itemIndex: 拖拽起始位置。
- insertIndex: 拖拽插入位置。
- isSuccess: 是否成功释放。 | +| onItemDrop(event: (event: ItemDragInfo, itemIndex: number, insertIndex: number, isSuccess: boolean) => void) | 绑定该事件的列表元素可作为拖拽释放目标,当在列表元素内停止拖拽时触发。
- event: 见[ItemDragInfo对象说明](ts-container-grid.md#itemdraginfo对象说明)。
- itemIndex: 拖拽起始位置。
- insertIndex: 拖拽插入位置。
- isSuccess: 是否成功释放。
**说明:**
跨List拖拽时,当拖拽释放的位置绑定了onItemDrop时会返回true,否则为false。List内部拖拽时,isSuccess为onItemMove事件的返回值。 | ## ScrollState枚举说明 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------ | ------------------------- | -| Idle | 未滑动状态。 | -| Scroll | 手指拖动状态。 | -| Fling | 惯性滑动状态。 | +| Idle | 空闲状态。使用控制器提供的方法滚动、拖动滚动条滚动时触发。 | +| Scroll | 手指拖动状态。使用手指拖动List滚动时触发。 | +| Fling | 惯性滚动状态。快速划动松手后惯性滚动和划动到边缘回弹时触发。 | > **说明:** > @@ -189,4 +217,4 @@ struct ListLanesExample { } ``` -![list](figures/list1.gif) \ No newline at end of file +![list](figures/list1.gif) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-listitem.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-listitem.md index 67ea6de032704abd2d314b8b8a9a040572f39748..7d8671137f9b2af63d2440dd6c9fac951d5fa123 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-listitem.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-listitem.md @@ -16,6 +16,8 @@ ListItem(value?: string) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + ## 属性 除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性: @@ -25,7 +27,7 @@ ListItem(value?: string) | sticky(deprecated) | [Sticky](#stickydeprecated枚举说明) | 设置ListItem吸顶效果。
默认值:Sticky.None
从API version9开始废弃,推荐使用[List组件sticky属性](ts-container-list.md#属性)。 | | editable(deprecated) | boolean \| [EditMode](#editmodedeprecated枚举说明) | 当前ListItem元素是否可编辑,进入编辑模式后可删除或移动列表项。
从API version9开始废弃。
默认值:false | | selectable8+ | boolean | 当前ListItem元素是否可以被鼠标框选。
**说明:**
外层List容器的鼠标框选开启时,ListItem的框选才生效。
默认值:true | -| swipeAction9+ | {
start?: CustomBuilder,
end?:CustomBuilder,
edgeEffect?: [SwipeEdgeEffect](#swipeedgeeffect9枚举说明),
} | 用于设置ListItem的划出组件。
- start: ListItem向右划动时item左边的组件(List垂直布局时)或ListItem向下划动时item上方的组件(List水平布局时)。
- end: ListItem向左划动时item右边的组件(List垂直布局时)或ListItem向上划动时item下方的组件(List水平布局时)。
- edgeEffect: 滑动效果。
| +| swipeAction9+ | {
start?: CustomBuilder,
end?:CustomBuilder,
edgeEffect?: [SwipeEdgeEffect](#swipeedgeeffect9枚举说明),
} | 用于设置ListItem的划出组件。
- start: ListItem向右划动时item左边的组件(List垂直布局时)或ListItem向下划动时item上方的组件(List水平布局时)。
- end: ListItem向左划动时item右边的组件(List垂直布局时)或ListItem向上划动时item下方的组件(List水平布局时)。
- edgeEffect: 滑动效果。
**说明:**
start和end对应的@builder函数中顶层必须是单个组件,不能是if/else、ForEach、LazyForEach语句。 | ## Sticky(deprecated)枚举说明 从API version9开始废弃,推荐使用[List组件stickyStyle枚举](ts-container-list.md#stickystyle9枚举说明)。 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-listitemgroup.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-listitemgroup.md index 29d42b8de0840788b1f4fe13b94986ad3d337790..fb27abb4a2393b4e75fcb533b5bbc387a2061d97 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-listitemgroup.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-listitemgroup.md @@ -35,6 +35,14 @@ ListItemGroup(options?: {header?: CustomBuilder, footer?: CustomBuilder, space?: | -------- | -------- | -------- | | divider | {
strokeWidth: [Length](ts-types.md#length),
color?: [ResourceColor](ts-types.md#resourcecolor),
startMargin?: [Length](ts-types.md#length),
endMargin?: [Length](ts-types.md#length)
} \| null | 用于设置ListItem分割线样式,默认无分割线。
strokeWidth: 分割线的线宽。
color: 分割线的颜色。
startMargin: 分割线距离列表侧边起始端的距离。
endMargin: 分割线距离列表侧边结束端的距离。 | +> **说明:** +> +> ListItemGroup组件不支持设置[通用属性aspectRatio](ts-universal-attributes-layout-constraints.md)。 +> +> ListItemGroup组件如果主轴方向是垂直方向时,设置[通用属性height](ts-universal-attributes-size.md)属性不生效。 +> +> ListItemGroup组件如果主轴方向是水平方向时,设置[通用属性width](ts-universal-attributes-size.md)属性不生效。 + ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-panel.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-panel.md index ec239c8400514c7e41cb3b5f37cbee6afd6a0fb0..5cb298df0918c9bb4539d4215027063b86acd417 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-panel.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-panel.md @@ -11,6 +11,10 @@ 可以包含子组件。 +> **说明:** +> +> 子组件类型:系统组件和自定义组件,支持渲染控制类型([if/else](../../quick-start/arkts-rendering-control-ifelse.md)、[ForEach](../../quick-start/arkts-rendering-control-foreach.md)和[LazyForEach](../../quick-start/arkts-rendering-control-lazyforeach.md))。 + ## 接口 @@ -20,19 +24,20 @@ Panel(show: boolean) | 参数名 | 参数类型 | 必填 | 参数描述 | | -------- | -------- | -------- | -------- | -| show | boolean | 是 | 控制Panel显示或隐藏。 | - +| show | boolean | 是 | 控制Panel显示或隐藏。
**说明:**
如果设置为false时,则不占位隐藏。[Visible.None](ts-universal-attributes-visibility.md)或者show之间有一个生效时,都会生效不占位隐藏。 | ## 属性 +除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性: + | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | | type | [PanelType](#paneltype枚举说明) | 设置可滑动面板的类型。
默认值:PanelType.Foldable | -| mode | [PanelMode](#panelmode枚举说明) | 设置可滑动面板的初始状态。 | +| mode | [PanelMode](#panelmode枚举说明) | 设置可滑动面板的初始状态。
Minibar类型默认值:PanelMode.Mini;其余类型默认值:PanelMode.Half | | dragBar | boolean | 设置是否存在dragbar,true表示存在,false表示不存在。
默认值:true | -| fullHeight | string \| number | 指定PanelMode.Full状态下的高度。 | -| halfHeight | string \| number | 指定PanelMode.Half状态下的高度,默认为屏幕尺寸的一半。 | -| miniHeight | string \| number | 指定PanelMode.Mini状态下的高度。 | +| fullHeight | string \| number | 指定PanelMode.Full状态下的高度。
默认值:当前组件主轴大小减去8vp空白区
**说明:**
不支持设置百分比。 | +| halfHeight | string \| number | 指定PanelMode.Half状态下的高度。
默认值:当前组件主轴大小的一半。
**说明:**
不支持设置百分比。 | +| miniHeight | string \| number | 指定PanelMode.Mini状态下的高度。
默认值:48
单位:vp
**说明:**
不支持设置百分比。 | | show | boolean | 当滑动面板弹出时调用。 | | backgroundMask9+|[ResourceColor](ts-types.md#resourcecolor)|指定Panel的背景蒙层。| @@ -52,9 +57,10 @@ Panel(show: boolean) | Half | 类型为foldable和temporary时,为类半屏状态;类型为minibar,则不生效。 | | Full | 类全屏状态。 | - ## 事件 +除支持[通用事件](ts-universal-events-click.md)外,还支持以下事件: + | 名称 | 功能描述 | | -------- | -------- | | onChange(event: (width: number, height: number, mode: PanelMode) => void) | 当可滑动面板发生状态变化时触发, 返回的height值为内容区高度值,当dragbar属性为true时,panel本身的高度值为dragbar高度加上内容区高度。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-refresh.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-refresh.md index db1c26ddd171304b7301159c4881e229fdd1826c..7b9514a72b78ba90dab69b8202020f628864a085 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-refresh.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-refresh.md @@ -5,6 +5,8 @@ > **说明:** > > 该组件从API Version 8开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 +> +> 当设置自定义组件时,自定义组件的高度限制在64vp之内。 ## 子组件 @@ -12,35 +14,40 @@ ## 接口 -Refresh\(value: \{ refreshing: boolean, offset?: number | string , friction?: number | string \}\) +Refresh\(value: \{ refreshing: boolean, offset?: number | string , friction?: number | string, builder?: Custombuilder\}\) **参数:** -| 参数 | 参数名 | 必填 | 参数描述 | -| -------- | -------- | -------- | -------- | -| refreshing | boolean | 是 | 当前组件是否正在刷新。
该参数支持[$$](../../quick-start/arkts-restrictions-and-extensions.md#变量的双向绑定)双向绑定变量。 | -| offset | string \| number | 否 | 刷新组件静止时距离父组件顶部的距离。
默认值:16,单位vp | -| friction | number \| string | 否 | 下拉摩擦系数,取值范围为0到100。
默认值:62
- 0表示下拉刷新容器不跟随手势下拉而下拉。
- 100表示下拉刷新容器紧紧跟随手势下拉而下拉。
- 数值越大,下拉刷新容器跟随手势下拉的反应越灵敏。 | +| 参数 | 参数名 | 必填 | 参数描述 | +| ---------- | ---------------------------------------- | ---- | ---------------------------------------- | +| refreshing | boolean | 是 | 当前组件是否正在刷新。
该参数支持[$$](../../quick-start/arkts-two-way-sync.md)双向绑定变量。 | +| offset | string \| number | 否 | 下拉起点距离组件顶部的距离。
默认值:16,单位vp
**说明:**
不支持百分比,不支持负数 | +| friction | number \| string | 否 | 下拉摩擦系数,取值范围为0到100。
默认值:62
- 0表示下拉刷新容器不跟随手势下拉而下拉。
- 100表示下拉刷新容器紧紧跟随手势下拉而下拉。
- 数值越大,下拉刷新容器跟随手势下拉的反应越灵敏。 | +| builder | [CustomBuilder](ts-types.md#custombuilder8)10+ | 否 | 下拉时,自定义刷新样式的组件。 | +## 属性 +支持[通用属性](ts-universal-attributes-size.md)。 ## 事件 +除支持[通用事件](ts-universal-events-click.md)外,还支持以下事件: + -| 名称 | 描述 | -| -------- | -------- | -| onStateChange(callback: (state: [RefreshStatus](#refreshstatus枚举说明)) => void)| 当前刷新状态变更时,触发回调。
- state:刷新状态。 | -| onRefreshing(callback: () => void)| 进入刷新状态时触发回调。 | +| 名称 | 描述 | +| ---------------------------------------- | -------------------------------------- | +| onStateChange(callback: (state: [RefreshStatus](#refreshstatus枚举说明)) => void) | 当前刷新状态变更时,触发回调。
- state:刷新状态。 | +| onRefreshing(callback: () => void) | 进入刷新状态时触发回调。 | ## RefreshStatus枚举说明 -| 名称 | 描述 | -| -------- | -------- | -| Inactive | 默认未下拉状态。 | -| Drag | 下拉中,下拉距离小于刷新距离。 | -| OverDrag | 下拉中,下拉距离超过刷新距离。 | -| Refresh | 下拉结束,回弹至刷新距离,进入刷新状态。 | -| Done | 刷新结束,返回初始状态(顶部)。 | +| 名称 | 描述 | +| -------- | -------------------- | +| Inactive | 默认未下拉状态。 | +| Drag | 下拉中,下拉距离小于刷新距离。 | +| OverDrag | 下拉中,下拉距离超过刷新距离。 | +| Refresh | 下拉结束,回弹至刷新距离,进入刷新状态。 | +| Done | 刷新结束,返回初始状态(顶部)。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-relativecontainer.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-relativecontainer.md index 4eb27d9e09e72015a1e7c0c10b6ecbf8d38ec155..6390be6bf5545188807777190731bc67143aab6b 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-relativecontainer.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-relativecontainer.md @@ -31,6 +31,8 @@ RelativeContainer() +从API version 9开始,该接口支持在ArkTS卡片中使用。 + ## 示例 ```ts diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-row.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-row.md index 4942b0cc3ee6ee779530dac83059bb585e9616a8..55793b7218f1dbc5beb6f7557a981331d4311928 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-row.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-row.md @@ -16,19 +16,21 @@ Row(value?:{space?: number | string }) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | | -------- | -------- | -------- | -------- | -| space | string \| number | 否 | 横向布局元素间距。
从API version 9开始,space为负数或者justifyContent设置为FlexAlign.SpaceBetween、FlexAlign.SpaceAround、FlexAlign.SpaceEvenly时不生效。
默认值:0,单位vp | +| space | string \| number | 否 | 横向布局元素间距。
从API version 9开始,space为负数或者justifyContent设置为FlexAlign.SpaceBetween、FlexAlign.SpaceAround、FlexAlign.SpaceEvenly时不生效。
默认值:0,单位vp
**说明:**
可选值为大于等于0的数字,或者可以转换为数字的字符串。 | ## 属性 | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| alignItems | [VerticalAlign](ts-appendix-enums.md#verticalalign) | 设置子组件在垂直方向上的对齐格式。
默认值:VerticalAlign.Center | -| justifyContent8+ | [FlexAlign](ts-appendix-enums.md#flexalign) | 设置子组件在水平方向上的对齐格式。
FlexAlign.Start | +| alignItems | [VerticalAlign](ts-appendix-enums.md#verticalalign) | 设置子组件在垂直方向上的对齐格式。
默认值:VerticalAlign.Center
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| justifyContent8+ | [FlexAlign](ts-appendix-enums.md#flexalign) | 设置子组件在水平方向上的对齐格式。
FlexAlign.Start
从API version 9开始,该接口支持在ArkTS卡片中使用。| ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-rowsplit.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-rowsplit.md index da4043d3bf0612b044344ba91e947b2d52cb80f6..35e7c2907c15ecee2803b71db4e8976e8135bcb6 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-rowsplit.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-rowsplit.md @@ -26,6 +26,8 @@ RowSplit() > RowSplit的分割线最小能拖动到刚好包含子组件。 > > 在真机中查看拖动效果,预览器中不支持拖动。 +> +> 不支持clip、margin通用属性。 ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-scroll.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-scroll.md index 9996564d394d9c646f255a0d132d8c601638c3e3..020b18250a8e110f962a5ebaff367aa640378e90 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-scroll.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-scroll.md @@ -18,6 +18,12 @@ Scroll(scroller?: Scroller) +**参数:** + +| 参数名 | 参数类型 | 必填 | 参数描述 | +| -------- | -------- | -------- | -------- | +| scroller | [Scroller](#scroller) | 否 | 可滚动组件的控制器。用于与可滚动组件进行绑定。 | + ## 属性 除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性: @@ -25,9 +31,9 @@ Scroll(scroller?: Scroller) | 名称 | 参数类型 | 描述 | | -------------- | ---------------------------------------- | --------- | | scrollable | [ScrollDirection](#scrolldirection枚举说明) | 设置滚动方向。
默认值:ScrollDirection.Vertical | -| scrollBar | [BarState](ts-appendix-enums.md#barstate) | 设置滚动条状态。
默认值:BarState.Auto | +| scrollBar | [BarState](ts-appendix-enums.md#barstate) | 设置滚动条状态。
默认值:BarState.Auto
**说明:**
如果容器组件无法滚动,则滚动条不显示。 | | scrollBarColor | string \| number \| [Color](ts-appendix-enums.md#color) | 设置滚动条的颜色。 | -| scrollBarWidth | string \| number | 设置滚动条的宽度。 | +| scrollBarWidth | string \| number | 设置滚动条的宽度,不支持百分比设置。
默认值:4
单位:vp | | edgeEffect | [EdgeEffect](ts-appendix-enums.md#edgeeffect) | 设置滑动效果,目前支持的滑动效果参见EdgeEffect的枚举说明。
默认值:EdgeEffect.None | ## ScrollDirection枚举说明 @@ -42,12 +48,12 @@ Scroll(scroller?: Scroller) | 名称 | 功能描述 | | ------------------------------------------------------------ | ------------------------------------------------------------ | -| onScrollFrameBegin9+(event: (offset: number, state: ScrollState) => { offsetRemain }) | 每帧开始滚动时触发,事件参数传入即将发生的滚动量,事件处理函数中可根据应用场景计算实际需要的滚动量并作为事件处理函数的返回值返回,Scroll将按照返回值的实际滚动量进行滚动。
\- offset:即将发生的滚动量。
\- state:当前滚动状态。
- offsetRemain:水平方向实际滚动量。 | -| onScroll(event: (xOffset: number, yOffset: number) => void) | 滚动事件回调, 返回滚动时水平、竖直方向偏移量。 | -| onScrollEdge(event: (side: Edge) => void) | 滚动到边缘事件回调。 | -| onScrollEnd(event: () => void) | 滚动停止事件回调。
该事件从API9开始废弃,使用onScrollStop事件替代。 | -| onScrollStart9+(event: () => void) | 滚动开始时触发。手指拖动Scroll或拖动Scroll的滚动条触发的滚动开始时,会触发该事件。使用[Scroller](#scroller)滚动控制器触发的滚动,不会触发该事件。 | -| onScrollStop9+(event: () => void) | 滚动停止时触发。手拖动Scroll或拖动Scroll的滚动条触发的滚动,手离开屏幕并且滚动停止时会触发该事件;使用[Scroller](#scroller)滚动控制器触发的滚动,不会触发该事件。 | +| onScrollFrameBegin9+(event: (offset: number, state: ScrollState) => { offsetRemain }) | 每帧开始滚动时触发,事件参数传入即将发生的滚动量,事件处理函数中可根据应用场景计算实际需要的滚动量并作为事件处理函数的返回值返回,Scroll将按照返回值的实际滚动量进行滚动。
\- offset:即将发生的滚动量。
\- state:当前滚动状态。
- offsetRemain:实际滚动量。
触发该事件的条件 :
1、滚动组件触发滚动时触发,包括键鼠操作等其他触发滚动的输入设置。
2、调用控制器接口时不触发。
3、越界回弹不触发。
**说明:**
支持offsetRemain为负值。
若通过onScrollFrameBegine事件和scrollBy方法实现容器嵌套滚动,需设置子滚动节点的EdgeEffect为None。如Scroll嵌套List滚动时,List组件的edgeEffect属性需设置为EdgeEffect.None。 | +| onScroll(event: (xOffset: number, yOffset: number) => void) | 滚动事件回调, 返回滚动时水平、竖直方向偏移量。
触发该事件的条件 :
1、滚动组件触发滚动时触发,支持键鼠操作等其他触发滚动的输入设置。
2、通过滚动控制器API接口调用。
3、越界回弹。 | +| onScrollEdge(event: (side: Edge) => void) | 滚动到边缘事件回调。
触发该事件的条件 :
1、滚动组件滚动到边缘时触发,支持键鼠操作等其他触发滚动的输入设置。
2、通过滚动控制器API接口调用。
3、越界回弹。 | +| onScrollEnd(deprecated) (event: () => void) | 滚动停止事件回调。
该事件从API version 9开始废弃,使用onScrollStop事件替代。
触发该事件的条件 :
1、滚动组件触发滚动后停止,支持键鼠操作等其他触发滚动的输入设置。
2、通过滚动控制器API接口调用后停止,带过渡动效。 | +| onScrollStart9+(event: () => void) | 滚动开始时触发。手指拖动Scroll或拖动Scroll的滚动条触发的滚动开始时,会触发该事件。使用[Scroller](#scroller)滚动控制器触发的带动画的滚动,动画开始时会触发该事件。
触发该事件的条件 :
1、滚动组件开始滚动时触发,支持键鼠操作等其他触发滚动的输入设置。
2、通过滚动控制器API接口调用后开始,带过渡动效。 | +| onScrollStop9+(event: () => void) | 滚动停止时触发。手拖动Scroll或拖动Scroll的滚动条触发的滚动,手离开屏幕并且滚动停止时会触发该事件。使用[Scroller](#scroller)滚动控制器触发的带动画的滚动,动画停止时会触发该事件。
触发该事件的条件 :
1、滚动组件触发滚动后停止,支持键鼠操作等其他触发滚动的输入设置。
2、通过滚动控制器API接口调用后开始,带过渡动效,。 | > **说明:** > @@ -55,7 +61,7 @@ Scroll(scroller?: Scroller) ## Scroller -可滚动容器组件的控制器,可以将此组件绑定至容器组件,然后通过它控制容器组件的滚动,同一个控制器不可以控制多个容器组件,目前支持绑定到List、Scroll、ScrollBar上。 +可滚动容器组件的控制器,可以将此组件绑定至容器组件,然后通过它控制容器组件的滚动,同一个控制器不可以控制多个容器组件,目前支持绑定到List、Scroll、ScrollBar、Grid、WaterFlow上。 ### 导入对象 @@ -76,9 +82,9 @@ scrollTo(value: { xOffset: number | string, yOffset: number | string, animation? | 参数名 | 参数类型 | 必填 | 参数描述 | | --------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | -| xOffset | Length | 是 | 水平滑动偏移。 | -| yOffset | Length | 是 | 竖直滑动偏移。 | -| animation | {
duration: number,
curve: [Curve](ts-appendix-enums.md#curve)
} | 否 | 动画配置:
- duration: 滚动时长设置。
- curve: 滚动曲线设置。 | +| xOffset | number \| string | 是 | 水平滑动偏移。
**说明:**
该参数值不支持设置百分比。
仅滚动轴为x轴时生效。 | +| yOffset | number \| string | 是 | 垂直滑动偏移。
**说明:**
该参数值不支持设置百分比。
仅滚动轴为y轴时生效。 | +| animation | {
duration: number,
curve: [Curve](ts-appendix-enums.md#curve)
} | 否 | 动画配置:
- duration: 滚动时长设置。
- curve: 滚动曲线设置。
默认值:
{
duration: 0,
curve: Curve.Ease
}
**说明:**
设置为小于0的值时,按默认值显示。 | ### scrollEdge @@ -86,7 +92,7 @@ scrollTo(value: { xOffset: number | string, yOffset: number | string, animation? scrollEdge(value: Edge): void -滚动到容器边缘。 +滚动到容器边缘,不区分滚动轴方向,Edge.Top和Edge.Start表现相同,Edge.Bottom和Edge.End表现相同。 **参数:** @@ -111,16 +117,16 @@ scrollPage(value: { next: boolean, direction?: Axis }): void ### currentOffset -currentOffset() +currentOffset(): { xOffset: number, yOffset: number } 返回当前的滚动偏移量。 **返回值** -| 类型 | 描述 | -| ---------------------------------------- | ---------------------------------------- | -| {
xOffset: number,
yOffset: number
} | xOffset: 水平滑动偏移;
yOffset: 竖直滑动偏移。 | +| 类型 | 描述 | +| ---------------------------------------------------------- | ------------------------------------------------------------ | +| {
xOffset: number,
yOffset: number
} | xOffset: 水平滑动偏移;
yOffset: 竖直滑动偏移。
**说明:**
返回值单位为vp。 | ### scrollToIndex @@ -133,7 +139,7 @@ scrollToIndex(value: number): void > **说明:** > -> 仅支持Grid、list组件。 +> 仅支持Grid、List组件。 **参数:** @@ -152,7 +158,7 @@ scrollBy(dx: Length, dy: Length): void > **说明:** > -> 仅支持Scroll组件。 +> 仅支持Scroll、ScrollBar、Grid、List组件。 **参数:** @@ -192,7 +198,7 @@ struct ScrollExample { .scrollable(ScrollDirection.Vertical) // 滚动方向纵向 .scrollBar(BarState.On) // 滚动条常驻显示 .scrollBarColor(Color.Gray) // 滚动条颜色 - .scrollBarWidth(30) // 滚动条宽度 + .scrollBarWidth(10) // 滚动条宽度 .edgeEffect(EdgeEffect.None) .onScroll((xOffset: number, yOffset: number) => { console.info(xOffset + ' ' + yOffset) @@ -205,21 +211,25 @@ struct ScrollExample { }) Button('scroll 150') + .height('5%') .onClick(() => { // 点击后下滑指定距离150.0vp this.scroller.scrollBy(0,150) }) .margin({ top: 10, left: 20 }) Button('scroll 100') + .height('5%') .onClick(() => { // 点击后滑动到指定位置,即下滑100.0vp的距离 this.scroller.scrollTo({ xOffset: 0, yOffset: this.scroller.currentOffset().yOffset + 100 }) }) .margin({ top: 60, left: 20 }) Button('back top') + .height('5%') .onClick(() => { // 点击后回到顶部 this.scroller.scrollEdge(Edge.Top) }) .margin({ top: 110, left: 20 }) Button('next page') + .height('5%') .onClick(() => { // 点击后滑到下一页 this.scroller.scrollPage({ next: true }) }) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-sidebarcontainer.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-sidebarcontainer.md index 1e6a02dd7a8cbd08fb7d8ce6a942123103e9bdfd..dbb2e0c3d4050531c52b1070d1671b3a3b09a41f 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-sidebarcontainer.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-sidebarcontainer.md @@ -11,6 +11,12 @@ 可以包含子组件。 +> **说明:** +> +> - 子组件类型:系统组件和自定义组件,不支持渲染控制类型([if/else](../../quick-start/arkts-rendering-control-ifelse.md)、[ForEach](../../quick-start/arkts-rendering-control-foreach.md)和[LazyForEach](../../quick-start/arkts-rendering-control-lazyforeach.md))。 +> - 子组件个数:必须且仅包含2个子组件。 +> - 子组件个数异常时:3个或以上子组件,显示第一个和第二个。1个子组件,显示侧边栏,内容区为空白。 + ## 接口 @@ -31,26 +37,29 @@ SideBarContainer( type?: SideBarContainerType ) ## 属性 +除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性: + | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | | showSideBar | boolean | 设置是否显示侧边栏。
默认值:true | -| controlButton | ButtonStyle | 设置侧边栏控制按钮的属性。 | +| controlButton | [ButtonStyle](#buttonstyle对象说明) | 设置侧边栏控制按钮的属性。 | | showControlButton | boolean | 设置是否显示控制按钮。
默认值:true | -| sideBarWidth | number \| Length9+ | 设置侧边栏的宽度。
默认值:200,单位vp | -| minSideBarWidth | number \| Length9+ | 设置侧边栏最小宽度。
默认值:200,单位vp | -| maxSideBarWidth | number \| Length9+ | 设置侧边栏最大宽度。
默认值:280,单位vp | -| autoHide9+ | boolean | 设置当侧边栏拖拽到小于最小宽度后,是否自动隐藏。
默认值:true | -| sideBarPosition9+ | SideBarPosition | 设置侧边栏显示位置。
默认值:SideBarPosition.Start | +| sideBarWidth | number \| [Length](ts-types.md#length)9+ | 设置侧边栏的宽度。
默认值:200
单位:vp
**说明:**
设置为小于0的值时按默认值显示。
受最小宽度和最大宽度限制,不在限制区域内取最近的点。
sideBarWidth优先于侧边栏子组件width,sideBarWidth未设置时默认值优先级低于侧边栏子组件width。 | +| minSideBarWidth | number \| [Length](ts-types.md#length)9+ | 设置侧边栏最小宽度。
默认值:200,单位vp
**说明:**
设置为小于0的值时按默认值显示。
值不能超过侧边栏容器本身宽度,超过使用侧边栏容器本身宽度。
minSideBarWidth优先于侧边栏子组件minWidth,minSideBarWidth未设置时默认值优先级低于侧边栏子组件minWidth。 | +| maxSideBarWidth | number \| [Length](ts-types.md#length)9+ | 设置侧边栏最大宽度。
默认值:280,单位vp
**说明:**
设置为小于0的值时按默认值显示。
值不能超过侧边栏容器本身宽度,超过使用侧边栏容器本身宽度。
maxSideBarWidth优先于侧边栏子组件maxWidth,maxSideBarWidth未设置时默认值优先级低于侧边栏子组件maxWidth。 | +| autoHide9+ | boolean | 设置当侧边栏拖拽到小于最小宽度后,是否自动隐藏。
默认值:true
**说明:**
受minSideBarWidth属性方法影响,minSideBarWidth属性方法未设置值使用默认值。
拖拽过程中判断是否要自动隐藏。小于最小宽度时需要阻尼效果触发隐藏(越界一段距离) | +| sideBarPosition9+ | [SideBarPosition](#sidebarposition9枚举说明) | 设置侧边栏显示位置。
默认值:SideBarPosition.Start | +| divider10+ | [DividerStyle](#dividerstyle10对象说明) \| null | 设置分割线的样式。
- 默认为DividerStyle:显示分割线。
- null:不显示分割线。 | ## ButtonStyle对象说明 | 名称 | 参数类型 | 必填 | 描述 | | -------- | -------- | -------- | -------- | -| left | number | 否 | 设置侧边栏控制按钮距离容器左界限的间距。
默认值:16,单位vp | -| top | number | 否 | 设置侧边栏控制按钮距离容器上界限的间距。
默认值:48,单位vp | -| width | number | 否 | 设置侧边栏控制按钮的宽度。
默认值:32,单位vp | -| height | number | 否 | 设置侧边栏控制按钮的高度。
默认值:32,单位vp | -| icons | {
shown: string \| PixelMap \| [Resource](ts-types.md) ,
hidden: string \| PixelMap \| [Resource](ts-types.md) ,
switching?: string \| PixelMap \| [Resource](ts-types.md)
} | 否 | 设置侧边栏控制按钮的图标:

- shown: 设置侧边栏显示时控制按钮的图标。
- hidden: 设置侧边栏隐藏时控制按钮的图标。
- switching:设置侧边栏显示和隐藏状态切换时控制按钮的图标。 | +| left | number | 否 | 设置侧边栏控制按钮距离容器左界限的间距。
默认值:16
单位:vp | +| top | number | 否 | 设置侧边栏控制按钮距离容器上界限的间距。
默认值:48
单位:vp | +| width | number | 否 | 设置侧边栏控制按钮的宽度。
默认值:32
单位:vp | +| height | number | 否 | 设置侧边栏控制按钮的高度。
默认值:32
单位:vp | +| icons | {
shown: string \| PixelMap \| [Resource](ts-types.md) ,
hidden: string \| PixelMap \| [Resource](ts-types.md) ,
switching?: string \| PixelMap \| [Resource](ts-types.md)
} | 否 | 设置侧边栏控制按钮的图标:

- shown: 设置侧边栏显示时控制按钮的图标。
**说明:**
资源获取错误时,使用默认图标。
- hidden: 设置侧边栏隐藏时控制按钮的图标。
- switching:设置侧边栏显示和隐藏状态切换时控制按钮的图标。 | ## SideBarPosition9+枚举说明 @@ -59,11 +68,33 @@ SideBarContainer( type?: SideBarContainerType ) | Start | 侧边栏位于容器左侧。 | | End | 侧边栏位于容器右侧。 | +## DividerStyle10+对象说明 + +| 名称 | 参数类型 | 必填 | 描述 | +| ----------- | ------------- | ---- | ---------------------------------------- | +| strokeWidth | [Length](ts-types.md#length) | 是 | 分割线的线宽。
默认值:1
单位:vp | +| color | [ResourceColor](ts-types.md#resourcecolor) | 否 | 分割线的颜色。
默认值:#000000,3% | +| startMargin | [Length](ts-types.md#length) | 否 | 分割线与侧边栏顶端的距离。
默认值:0 | +| endMargin | [Length](ts-types.md#length) | 否 | 分割线与侧边栏底端的距离。
默认值:0 | +> **说明:** +> +> 针对侧边栏子组件设置[通用属性宽高](ts-universal-attributes-size.md)时,宽生效的前提是侧边栏容器不设置sideBarWidth,高度不生效。 +> 针对侧边栏内容区设置[通用属性宽高](ts-universal-attributes-size.md)时,宽高都不生效,默认占满SideBarContainer的剩余空间。 +> +> 当属性方法未设置时,依据组件大小进行自动显示: +> +> - 小于520vp:默认不显示侧边栏。 +> - 大于等于520vp:默认显示侧边栏。 +> - 小于520vp:不显示侧边栏。 +> - 大于等于520vp:显示侧边栏。 + ## 事件 +除支持[通用事件](ts-universal-events-click.md)外,还支持以下事件: + | 名称 | 功能描述 | | -------- | -------- | -| onChange(callback: (value: boolean) => void) | 当侧边栏的状态在显示和隐藏之间切换时触发回调。

true表示显示,false表示隐藏。 | +| onChange(callback: (value: boolean) => void) | 当侧边栏的状态在显示和隐藏之间切换时触发回调。true表示显示,false表示隐藏。
触发该事件的条件:
1、showSideBar属性值变换时;
2、showSideBar属性自适应行为变化时;
3、分割线拖拽触发autoHide时。 | ## 示例 @@ -73,14 +104,13 @@ SideBarContainer( type?: SideBarContainerType ) @Entry @Component struct SideBarContainerExample { - normalIcon : Resource = $r("app.media.icon") + normalIcon: Resource = $r("app.media.icon") selectedIcon: Resource = $r("app.media.icon") @State arr: number[] = [1, 2, 3] @State current: number = 1 build() { - SideBarContainer(SideBarContainerType.Embed) - { + SideBarContainer(SideBarContainerType.Embed) { Column() { ForEach(this.arr, (item, index) => { Column({ space: 5 }) { @@ -105,6 +135,13 @@ struct SideBarContainerExample { } .margin({ top: 50, left: 20, right: 30 }) } + .controlButton({ + icons: { + hidden: $r('app.media.drawer'), + shown: $r('app.media.drawer'), + switching: $r('app.media.drawer') + } + }) .sideBarWidth(150) .minSideBarWidth(50) .maxSideBarWidth(300) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-stack.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-stack.md index 9b329c79b9806056213a6d191fbfd6d7b2d2486c..271317c99aa2969dde13af52888df634b9d796b0 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-stack.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-stack.md @@ -16,11 +16,21 @@ Stack(value?: { alignContent?: Alignment }) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** -| 参数名 | 参数类型 | 必填 | 参数描述 | -| -------- | -------- | -------- | -------- | -| alignContent | [Alignment](ts-appendix-enums.md#alignment) | 否 | 设置子组件在容器内的对齐方式。
默认值:Alignment.Center | +| 参数名 | 参数类型 | 必填 | 参数描述 | +| ------------ | ------------------------------------------- | ---- | ----------------------------------------------------------- | +| alignContent | [Alignment](ts-appendix-enums.md#alignment) | 否 | 设置子组件在容器内的对齐方式。
默认值:Alignment.Center | + +## 属性 + +除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性: + +| 名称 | 参数类型 | 描述 | +| ------------ | ------------------------------------------- | ------------------------------------------------------------ | +| alignContent | [Alignment](ts-appendix-enums.md#alignment) | 设置子组件在容器内的对齐方式。
默认值:Alignment.Center
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
该属性与[通用属性align](ts-universal-attributes-location.md)同时设置时,只有align属性生效。 | ## 示例 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 e9b00bc26c5a7632c0ad12531130154b0cbdde77..c72e03873014d868e8c6295bf55f26c2448a3dce 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 @@ -11,6 +11,10 @@ 可以包含子组件。 +> **说明:** +> +> 子组件类型:系统组件和自定义组件,支持渲染控制类型([if/else](../../quick-start/arkts-rendering-control-ifelse.md)、[ForEach](../../quick-start/arkts-rendering-control-foreach.md)和[LazyForEach](../../quick-start/arkts-rendering-control-lazyforeach.md))。 + ## 接口 @@ -29,21 +33,23 @@ Swiper(controller?: SwiperController) | 名称 | 参数类型 | 描述 | | --------------------------- | ---------------------------------------- | ---------------------------------------- | -| index | number | 设置当前在容器中显示的子组件的索引值。
默认值:0 | -| autoPlay | boolean | 子组件是否自动播放,自动播放状态下,导航点不可操作。
默认值:false | +| index | number | 设置当前在容器中显示的子组件的索引值。
默认值:0
**说明:**
设置小于0或大于等于子组件数量时,按照默认值0处理。 | +| autoPlay | boolean | 子组件是否自动播放。
默认值:false
**说明:**
loop为false时,自动轮播到最后一页时停止轮播。手势切换后不是最后一页时继续播放。 | | interval | number | 使用自动播放时播放的时间间隔,单位为毫秒。
默认值:3000 | -| indicator | boolean | 是否启用导航点指示器。
默认值:true | +| indicator10+ | [DotIndicator](#dotindicator) \| [DigitIndicator](#digitindicator) \| boolean | 设置可选导航点指示器样式。
\- DotIndicator:圆点指示器样式。
\- DigitIndicator:数字指示器样式。
\- boolean:是否启用导航点指示器。
  默认值:true
  默认类型:DotIndicator | | loop | boolean | 是否开启循环。
设置为true时表示开启循环,在LazyForEach懒循环加载模式下,加载的组件数量建议大于5个。
默认值:true | | duration | number | 子组件切换的动画时长,单位为毫秒。
默认值:400 | | vertical | boolean | 是否为纵向滑动。
默认值:false | -| itemSpace | number \| string | 设置子组件与子组件之间间隙。
默认值:0 | +| itemSpace | number \| string | 设置子组件与子组件之间间隙。
默认值:0
**说明:**
不支持设置百分比。 | | displayMode | SwiperDisplayMode | 主轴方向上元素排列的模式,优先以displayCount设置的个数显示,displayCount未设置时本属性生效。
默认值:SwiperDisplayMode.Stretch | | cachedCount8+ | number | 设置预加载子组件个数。
默认值:1 | | disableSwipe8+ | boolean | 禁用组件滑动切换功能。
默认值:false | | curve8+ | [Curve](ts-appendix-enums.md#curve) \| string | 设置Swiper的动画曲线,默认为淡入淡出曲线,常用曲线参考[Curve枚举说明](ts-appendix-enums.md#curve),也可以通过[插值计算](../apis/js-apis-curve.md)模块提供的接口创建自定义的插值曲线对象。
默认值:Curve.Ease | | indicatorStyle8+ | {
left?: [Length](ts-types.md#length),
top?: [Length](ts-types.md#length),
right?: [Length](ts-types.md#length),
bottom?: [Length](ts-types.md#length),
size?: [Length](ts-types.md#length),
mask?: boolean,
color?: [ResourceColor](ts-types.md),
selectedColor?: [ResourceColor](ts-types.md)
} | 设置导航点样式:
\- left: 设置导航点距离Swiper组件左边的距离。
\- top: 设置导航点距离Swiper组件顶部的距离。
\- right: 设置导航点距离Swiper组件右边的距离。
\- bottom: 设置导航点距离Swiper组件底部的距离。
\- size: 设置导航点的直径。
\- mask: 设置是否显示导航点蒙层样式。
\- color: 设置导航点的颜色。
\- selectedColor: 设置选中的导航点的颜色。 | -| displayCount8+ | number\|string | 设置一页内元素显示个数。
默认值:1 | -| effectMode8+ | [EdgeEffect](ts-appendix-enums.md#edgeeffect) | 滑动效果,目前支持的滑动效果参见EdgeEffect的枚举说明。
默认值:EdgeEffect.Spring | +| displayCount8+ | number\|string | 设置一页内元素显示个数。
默认值:1
**说明:**
字符串类型仅支持设置为'auto',显示效果同SwiperDisplayMode.AutoLinear。
使用number类型时,子组件按照主轴均分Swiper宽度(减去displayCount-1的itemSpace)的方式进行主轴拉伸(收缩)布局。 | +| effectMode8+ | [EdgeEffect](ts-appendix-enums.md#edgeeffect) | 滑动效果,目前支持的滑动效果参见EdgeEffect的枚举说明。
默认值:EdgeEffect.Spring
**说明:**
控制器接口调用时不生效回弹。 | +| nextMargin10+ |
[Length](ts-types.md#length)
| 后边距,用于露出后一项的一小部分。
默认值:0
**说明:**
>仅当SwiperDisplayMode为STRETCH模式时生效。当cachedCount设置值小于等于0时,此时会露出后一项的一小部分,但无法加载子组件。当displayCount设置为1时,此参数设置无效。 | +| prevMargin10+ |
[Length](ts-types.md#length)
| 前边距,用于露出前一项的一小部分。
默认值:0
**说明:**
仅当SwiperDisplayMode为STRETCH模式时生效。当cachedCount设置值小于等于0时,此时会露出前一项的一小部分,但无法加载子组件。当displayCount设置为1时,此参数设置无效。 | ## SwiperDisplayMode枚举说明 @@ -60,13 +66,13 @@ Swiper容器组件的控制器,可以将此对象绑定至Swiper组件,然 showNext(): void -翻至下一页。 +翻至下一页。翻页带动效切换过程,时长通过duration指定。 ### showPrevious showPrevious(): void -翻至上一页。 +翻至上一页。翻页带动效切换过程,时长通过duration指定。 ### finishAnimation @@ -80,22 +86,51 @@ finishAnimation(callback?: () => void): void | --------- | ---------- | ------ | -------- | | callback | () => void | 否 | 动画结束的回调。 | -## 事件 +## Indicator10+对象说明 + +设置导航点距离Swiper组件距离。 -### onChange +| 参数名 | 参数类型 | 必填项 | 参数描述 | +| ------ | -------- | ------ | ------------------------------------ | +| left | [Length](ts-types.md#length) | 否 | 设置导航点距离Swiper组件左边的距离。 | +| top | [Length](ts-types.md#length) | 否 | 设置导航点距离Swiper组件顶部的距离。 | +| right | [Length](ts-types.md#length) | 否 | 设置导航点距离Swiper组件右边的距离。 | +| bottom | [Length](ts-types.md#length) | 否 | 设置导航点距离Swiper组件底部的距离。 | -onChange(event: (index: number) => void) +### DotIndicator -当前显示的子组件索引变化时触发该事件,返回值为当前显示的子组件的索引值。 +圆点指示器属性及功能继承自Indicator。 -**说明**:Swiper组件结合LazyForEach使用时,不能在onChange事件里触发子页面UI的刷新。 +| 参数名 | 参数类型 | 必填项 | 参数描述 | +| ------------------ | ------------- | ------ | ------------------------------------------------------ | +| itemWidth | [Length](ts-types.md#length) | 否 | 设置Swiper组件圆点导航指示器的宽。
默认值:6
单位:vp | +| itemHeight | [Length](ts-types.md#length) | 否 | 设置Swiper组件圆点导航指示器的高。
默认值:6
单位:vp | +| selectedItemWidth | [Length](ts-types.md#length) | 否 | 设置选中Swiper组件圆点导航指示器的宽。
默认值:6
单位:vp | +| selectedItemHeight | [Length](ts-types.md#length) | 否 | 设置选中Swiper组件圆点导航指示器的高。
默认值:6
单位:vp | +| mask | boolean | 否 | 设置是否显示Swiper组件圆点导航指示器的蒙版样式。
默认值:false | +| color | [ResourceColor](ts-types.md#resourcecolor) | 否 | 设置Swiper组件圆点导航指示器的颜色。
默认值:'\#007DFF' | +| selectedColor | [ResourceColor](ts-types.md#resourcecolor) | 否 | 设置选中Swiper组件圆点导航指示器的颜色。
默认值:'\#182431'(10%透明度) | -**返回值:** +### DigitIndicator + +数字指示器属性及功能继承自Indicator。 + +| 参数名 | 参数类型 | 必填项 | 参数描述 | +| ----------------- | ------------------------------------------------------------ | ------ | ------------------------------------------------------------ | +| fontColor | [ResourceColor](ts-types.md#resourcecolor) | 否 | 设置Swiper组件数字导航点的字体颜色。
默认值:'\#ff182431' | +| selectedFontColor | [ResourceColor](ts-types.md#resourcecolor) | 否 | 设置选中Swiper组件数字导航点的字体颜色。
默认值:'\#ff182431' | +| digitFont | {
size?:[Length](ts-types.md#length)
weight?:number \| [FontWeight](ts-appendix-enums.md#fontweight) \| string
} | 否 | 设置Swiper组件数字导航点的字体样式:
\- size:数字导航点指示器的字体大小。
默认值:14vp
\- weight:数字导航点指示器的字重。 | +| selectedDigitFont | {
size?:[Length](ts-types.md#length)
weight?:number \| [FontWeight](ts-appendix-enums.md#fontweight) \| string
} | 否 | 设置选中Swiper组件数字导航点的字体样式:
\- size:数字导航点选中指示器的字体大小。
默认值:14vp
\- weight:数字导航点选中指示器的字重。 | + +## 事件 -| 名称 | 类型 | 参数描述 | -| --------- | ---------- | -------- | -| index | number | 当前显示元素的索引。 | +除支持[通用事件](ts-universal-events-click.md)外,还支持以下事件: +| 名称 | 功能描述 | +| ------------------------------------------------------------ | ------------------------------------------------------------ | +| onChange(event: (index: number) => void) | 当前显示的子组件索引变化时触发该事件,返回值为当前显示的子组件的索引值。
- index:当前显示元素的索引。
**说明:**
Swiper组件结合LazyForEach使用时,不能在onChange事件里触发子页面UI的刷新。 | +| onAnimationStart9+(event: (index: number) => void) | 切换动画开始时触发该回调。
- index:当前显示元素的索引。
**说明:**
参数为动画开始前的index值(不是最终结束动画的index值),多列Swiper时,index为最左侧组件的索引。 | +| onAnimationEnd9+(event: (index: number) => void) | 切换动画结束时触发该回调。
- index:当前显示元素的索引。
**说明:**
当Swiper切换动效结束时触发,包括动画过程中手势中断,通过SwiperController调用finishAnimatio。参数为动画结束后的index值,多列Swiper时,index为最左侧组件的索引。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-tabcontent.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-tabcontent.md index dcd23fcc36c703fc73f6615056b47e9a766fc3eb..f4e8baf6c69a11342e1f8a2c4d4eaad70e9f665a 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-tabcontent.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-tabcontent.md @@ -11,6 +11,10 @@ 支持单个子组件。 +> **说明:** +> +> 可内置系统组件和自定义组件,支持渲染控制类型([if/else](../../quick-start/arkts-rendering-control-ifelse.md)、[ForEach](../../quick-start/arkts-rendering-control-foreach.md)和[LazyForEach](../../quick-start/arkts-rendering-control-lazyforeach.md))。 + ## 接口 @@ -23,18 +27,21 @@ TabContent() | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| tabBar | string \| Resource \| {
icon?: string \| Resource,
text?: string \| Resource
}
\| [CustomBuilder](ts-types.md)8+ | 设置TabBar上显示内容。
CustomBuilder: 构造器,内部可以传入组件(API8版本以上适用)。
>  **说明:**
> 如果icon采用svg格式图源,则要求svg图源删除其自有宽高属性值。如采用带有自有宽高属性的svg图源,icon大小则是svg本身内置的宽高属性值大小。 | -| tabBar9+ | [SubTabBarStyle](#subtabbarstyle) \| [BottomTabBarStyle](#bottomtabbarstyle) | 设置TabBar上显示内容。
SubTabBarStyle: 子页签样式,参数为文字。
BottomTabBarStyle: 底部页签和侧边页签样式,参数为文字和图片。 | +| tabBar | string \| Resource \| {
icon?: string \| Resource,
text?: string \| Resource
}
\| [CustomBuilder](ts-types.md)8+ | 设置TabBar上显示内容。
CustomBuilder: 构造器,内部可以传入组件(API8版本以上适用)。
>  **说明:**
> 如果icon采用svg格式图源,则要求svg图源删除其自有宽高属性值。如采用带有自有宽高属性的svg图源,icon大小则是svg本身内置的宽高属性值大小。
设置的内容超出tabbar页签时进行裁切。 | +| tabBar9+ | [SubTabBarStyle](#subtabbarstyle) \| [BottomTabBarStyle](#bottomtabbarstyle) | 设置TabBar上显示内容。
SubTabBarStyle: 子页签样式,参数为文字。
BottomTabBarStyle: 底部页签和侧边页签样式,参数为文字和图片。
**说明:**
底部样式没有下划线效果。
icon异常时显示灰色图块。 | > **说明:** -> - TabContent组件不支持设置通用宽度属性,其宽度默认撑满Tabs父组件。 -> - TabContent组件不支持设置通用高度属性,其高度由Tabs父组件高度与TabBar组件高度决定。 +> +> - TabContent组件不支持设置通用宽度属性,其宽度默认撑满Tabs父组件。 +> - TabContent组件不支持设置通用高度属性,其高度由Tabs父组件高度与TabBar组件高度决定。 +> - vertical属性为false值,交换上述2个限制。 +> - TabContent组件不支持内容过长时页面的滑动,如需页面滑动,可嵌套List使用。 ## SubTabBarStyle9+ 子页签样式。 -### constructor9+ +### constructor constructor(content: string | Resource) @@ -44,15 +51,71 @@ SubTabBarStyle的构造函数。 | 参数名 | 参数类型 | 必填 | 参数描述 | | -------- | -------- | -------- | -------- | -| content | string \| [Resource](ts-types.md#resource) | 是 | 页签内的文字内容。 | +| content | string \| [Resource](ts-types.md#resource) | 是 | 页签内的文字内容。从API version 10开始,content类型为ResourceStr。 | + +### of10+ + +static of(content: ResourceStr) + +SubTabBarStyle的静态构造函数。 + +**参数:** + +| 参数名 | 参数类型 | 必填 | 参数描述 | +| ------- | ------------------------------------------ | ---- | ------------------ | +| content | [ResourceStr](ts-types.md#resourcestr) | 是 | 页签内的文字内容。 | + +### 属性 + +支持以下属性: + +| 名称 | 参数类型 | 描述 | +| ------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| indicator10+ | [IndicatorStyle](#indicatorstyle10对象说明)| 设置选中子页签的下划线风格。子页签的下划线风格仅在水平模式下有效。
| +| selectedMode10+ | [SelectedMode](#selectedmode10枚举说明) | 设置选中子页签的显示方式。
默认值:SelectedMode.INDICATOR | +| board10+ | [BoardStyle](#boardstyle10对象说明) | 设置选中子页签的背板风格。 | +| labelStyle10+ | [LabelStyle](#labelstyle10对象说明) | 设置选中子页签的label文本和字体的样式。 | + +## IndicatorStyle10+对象说明 + +| 名称 | 参数类型 | 必填 | 描述 | +| -------- | -------- | -------- | -------------------------------- | +| color | [ResourceColor](ts-types.md#resourcecolor) | 否 | 下划线的颜色和背板颜色。
默认值:#FF007DFF | +| height | [Length](ts-types.md#length) | 否 | 下划线的高度。
默认值:2.0
单位:vp | +| width | [Length](ts-types.md#length) | 否 | 下划线的宽度。
默认值:0.0
单位:vp | +| borderRadius | [Length](ts-types.md#length) | 否 | 下划线的圆角半径。
默认值:0.0
单位:vp | +| marginTop | [Length](ts-types.md#length) | 否 | 下划线与文字的间距。
默认值:8.0
单位:vp | + +## SelectedMode10+枚举说明 +| 名称 | 描述 | +| ---------- | ------------------------ | +| INDICATOR | 使用下划线模式。 | +| BOARD | 使用背板模式。 | + +## BoardStyle10+对象说明 + +| 名称 | 参数类型 | 必填 | 描述 | +| -------- | -------- | -------- | ------------------------------------ | +| borderRadius | [Length](ts-types.md#length) | 否 | 下划线的圆角半径。
默认值:8.0
单位:vp | + +## LabelStyle10+对象说明 + +| 名称 | 参数类型 | 必填 | 描述 | +| -------------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| overflow | [TextOverflow](ts-appendix-enums.md#textoverflow) | 否 | 设置Label文本超长时的显示方式。默认值是省略号截断。 | +| maxLines | number | 否 | 设置Label文本的最大行数。如果指定此参数,则文本最多不会超过指定的行。如果有多余的文本,可以通过textOverflow来指定截断方式。默认值是1。 | +| minFontSize | number \| [ResourceStr](ts-types.md#resourcestr) | 否 | 设置Label文本最小显示字号。需配合maxFontSize以及maxLines或布局大小限制使用。自适应文本大小生效后,font.size不生效。默认值是0.0fp。| +| maxFontSize | number \| [ResourceStr](ts-types.md#resourcestr) | 否 | 设置Label文本最大显示字号。需配合minFontSize以及maxLines或布局大小限制使用。自适应文本大小生效后,font.size不生效。默认值是0.0fp。|| +| heightAdaptivePolicy | [TextHeightAdaptivePolicy](ts-appendix-enums.md#textheightadaptivepolicy10) | 否 | 设置Label文本自适应高度的方式。默认值是最大行数优先。 | +| font | [Font](ts-types.md#font) | 否 | 设置Label文本字体样式。默认值是字体大小16.0fp、字体类型HarmonyOS Sans,字体风格正常,字重正常。 | ## BottomTabBarStyle9+ 底部页签和侧边页签样式。 -### constructor9+ +### constructor -constructor(icon: string | Resource, text: string | Resource) +constructor(icon: string | Resource, content: string | Resource) BottomTabBarStyle的构造函数。 @@ -60,8 +123,20 @@ BottomTabBarStyle的构造函数。 | 参数名 | 参数类型 | 必填 | 参数描述 | | -------- | -------- | -------- | -------- | -| icon | string \| [Resource](ts-types.md#resource) | 是 | 页签内的图片内容。 | -| text | string \| [Resource](ts-types.md#resource) | 是 | 页签内的文字内容。 | +| icon | string \| [Resource](ts-types.md#resource) | 是 | 页签内的图片内容。从API version 10开始,icon类型为ResourceStr。 | +| text | string \| [Resource](ts-types.md#resource) | 是 | 页签内的文字内容。从API version 10开始,text类型为ResourceStr。 | + +### of10+ + +static of(icon: ResourceStr, text: ResourceStr) +BottomTabBarStyle的静态构造函数。 + +**参数:** + +| 参数名 | 参数类型 | 必填 | 参数描述 | +| -------- | -------- | -------- | -------- | +| icon | [ResourceStr](ts-types.md#resourcestr) | 是 | 页签内的图片内容。 | +| text | [ResourceStr](ts-types.md#resourcestr) | 是 | 页签内的文字内容。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-tabs.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-tabs.md index 2787e1f58ed4ff75df39d9ce7c16dd5cea6dcd17..9319bb050d04b4d33e444a10e0cefe5ec8bf0e7b 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-tabs.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-tabs.md @@ -18,47 +18,58 @@ Tabs(value?: {barPosition?: BarPosition, index?: number, controller?: [TabsContr **参数:** -| 参数名 | 参数类型 | 必填 | 参数描述 | -| -------- | -------- | -------- | -------- | -| barPosition | BarPosition | 否 | 设置Tabs的页签位置。
默认值:BarPosition.Start | -| index | number | 否 | 设置初始页签索引。
默认值:0 | -| controller | [TabsController](#tabscontroller) | 否 | 设置Tabs控制器。 | +| 参数名 | 参数类型 | 必填 | 参数描述 | +| ----------- | --------------------------------- | ---- | ---------------------------------------- | +| barPosition | BarPosition | 否 | 设置Tabs的页签位置。
默认值:BarPosition.Start | +| index | number | 否 | 设置初始页签索引。
默认值:0
**说明:**
设置为小于0的值时按默认值显示。
可选值为[0, TabContent子节点数量-1]。
设置不同值时,默认生效切换动效,可以设置animationDuration为0关闭动画。 | +| controller | [TabsController](#tabscontroller) | 否 | 设置Tabs控制器。 | ## BarPosition枚举说明 -| 名称 | 描述 | -| -------- | -------- | +| 名称 | 描述 | +| ----- | ---------------------------------------- | | Start | vertical属性方法设置为true时,页签位于容器左侧;vertical属性方法设置为false时,页签位于容器顶部。 | -| End | vertical属性方法设置为true时,页签位于容器右侧;vertical属性方法设置为false时,页签位于容器底部。 | +| End | vertical属性方法设置为true时,页签位于容器右侧;vertical属性方法设置为false时,页签位于容器底部。 | ## 属性 除支持[通用属性](ts-universal-attributes-size.md)外,还支持以下属性: -| 名称 | 参数类型 | 描述 | -| -------- | -------- | -------- | -| vertical | boolean | 设置为false是为横向Tabs,设置为true时为纵向Tabs。
默认值:false | -| scrollable | boolean | 设置为true时可以通过滑动页面进行页面切换,为false时不可滑动切换页面。
默认值:true | -| barMode | BarMode | TabBar布局模式,具体描述见BarMode枚举说明。
默认值:BarMode.Fixed | -| barWidth | number \| Length8+ | TabBar的宽度值。 | -| barHeight | number \| Length8+ | TabBar的高度值。 | -| animationDuration | number | TabContent滑动动画时长。不设置时,点击切换页签无动画,滑动切换有动画;设置时,点击切换和滑动切换都有动画。
默认值:200 | +| 名称 | 参数类型 | 描述 | +| ------------------------ | ---------------------------------------- | ---------------------------------------- | +| vertical | boolean | 设置为false是为横向Tabs,设置为true时为纵向Tabs。
默认值:false | +| scrollable | boolean | 设置为true时可以通过滑动页面进行页面切换,为false时不可滑动切换页面。
默认值:true | +| barMode | BarMode | TabBar布局模式,具体描述见BarMode枚举说明。
默认值:BarMode.Fixed | +| barWidth | number \| Length8+ | TabBar的宽度值。
**说明:**
设置为小于0或大于Tabs宽度值时,按默认值显示。 | +| barHeight | number \| Length8+ | TabBar的高度值。
**说明:**
设置为小于0或大于Tabs宽度值时,按默认值显示。 | +| animationDuration | number | TabContent滑动动画时长。不设置时,点击切换页签无动画,滑动切换有动画;设置时,点击切换和滑动切换都有动画。
默认值:300
**说明:**
设置为小于0或百分比时,按默认值显示。 | +| divider10+ | [DividerStyle](#dividerstyle10对象说明) \| null | 用于设置区分TabBar和TabContent的分割线样式设置分割线样式,默认不显示分割线。
DividerStyle: 分割线的样式;
null: 不显示分割线。 | +| fadingEdge10+ | boolean | 设置页签超过容器宽度时是否渐隐消失
默认值:true | + +## DividerStyle10+对象说明 + +| 名称 | 参数类型 | 必填 | 描述 | +| ----------- | ---------------------------------------- | ---- | ----------------------------------- | +| strokeWidth | [Length](ts-types.md#length) | 是 | 分割线的线宽。 | +| color | [ResourceColor](ts-types.md#resourcecolor) | 否 | 分割线的颜色。
默认值:#33182431 | +| startMargin | [Length](ts-types.md#length) | 否 | 分割线与侧边栏顶端的距离。
默认值:0.0
单位:vp | +| endMargin | [Length](ts-types.md#length) | 否 | 分割线与侧边栏底端的距离。
默认值:0.0
单位:vp | ## BarMode枚举说明 -| 名称 | 描述 | -| -------- | -------- | +| 名称 | 描述 | +| ---------- | ---------------------------------------- | | Scrollable | 每一个TabBar均使用实际布局宽度,超过总长度(横向Tabs的barWidth,纵向Tabs的barHeight)后可滑动。 | -| Fixed | 所有TabBar平均分配barWidth宽度(纵向时平均分配barHeight高度)。 | +| Fixed | 所有TabBar平均分配barWidth宽度(纵向时平均分配barHeight高度)。 | ## 事件 除支持[通用事件](ts-universal-events-click.md)外,还支持以下事件: -| 名称 | 功能描述 | -| -------- | -------- | -| onChange(event: (index: number) => void) | Tab页签切换后触发的事件。 | +| 名称 | 功能描述 | +| ---------------------------------------- | ---------------------------------------- | +| onChange(event: (index: number) => void) | Tab页签切换后触发的事件。
- index:当前显示的index索引,索引从0开始计算。
触发该事件的条件:
1、TabContent支持滑动时,组件触发滑动时触发。
2、通过[控制器](#tabscontroller)API接口调用。
3、通过[状态变量](../../quick-start/arkts-state.md)构造的属性值进行修改。
4、通过页签处点击触发。 | ## TabsController @@ -66,9 +77,8 @@ Tabs组件的控制器,用于控制Tabs组件进行页签切换。不支持一 ### 导入对象 -``` +```ts controller: TabsController = new TabsController() - ``` ### changeIndex @@ -79,9 +89,9 @@ changeIndex(value: number): void **参数:** -| 参数名 | 参数类型 | 必填 | 参数描述 | -| -------- | -------- | -------- | -------- | -| value | number | 是 | 页签在Tabs里的索引值,索引值从0开始。 | +| 参数名 | 参数类型 | 必填 | 参数描述 | +| ----- | ------ | ---- | ---------------------------------------- | +| value | number | 是 | 页签在Tabs里的索引值,索引值从0开始。
**说明:**
设置小于0或大于最大数量的值时,该事件失效。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-container-waterflow.md b/zh-cn/application-dev/reference/arkui-ts/ts-container-waterflow.md index cba3fda2ef1385d851b80935f6b4406aba972f04..a3e993c20b8c12ede8d546f36490c7cad0e3ae2c 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-container-waterflow.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-container-waterflow.md @@ -14,6 +14,9 @@ 包含[FlowItem](ts-container-flowitem.md)子组件。 +> **说明:** +> +> WaterFlow子组件的visibility属性设置为None时不显示,但依然会占用子组件对应的网格。 ## 接口 @@ -250,7 +253,7 @@ struct WaterflowDemo { build() { Column({ space: 2 }) { - WaterFlow({ footer: this.itemFoot, scroller: this.scroller }) { + WaterFlow({ footer: this.itemFoot.bind(this), scroller: this.scroller }) { LazyForEach(this.datasource, (item: number) => { FlowItem() { Column() { diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-custom-component-lifecycle.md b/zh-cn/application-dev/reference/arkui-ts/ts-custom-component-lifecycle.md new file mode 100644 index 0000000000000000000000000000000000000000..477a9ca18f97c53922be2e37237be1577280a582 --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-ts/ts-custom-component-lifecycle.md @@ -0,0 +1,204 @@ +# 自定义组件的生命周期 + + +自定义组件的生命周期回调函数用于通知用户该自定义组件的生命周期,这些回调函数是私有的,在运行时由开发框架在特定的时间进行调用,不能从应用程序中手动调用这些回调函数。 + + +>**说明:** +> +>允许在生命周期函数中使用Promise和异步回调函数,比如网络资源获取,定时器设置等; + + +## aboutToAppear + +aboutToAppear?(): void + +aboutToAppear函数在创建自定义组件的新实例后,在执行其build()函数之前执行。允许在aboutToAppear函数中改变状态变量,更改将在后续执行build()函数中生效。 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 + +## aboutToDisappear + +aboutToDisappear?(): void + +aboutToDisappear函数在自定义组件析构销毁之前执行。不允许在aboutToDisappear函数中改变状态变量,特别是\@Link变量的修改可能会导致应用程序行为不稳定。 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 + +## onPageShow + +onPageShow?(): void + +页面每次显示时触发一次,包括路由过程、应用进入前台等场景,仅\@Entry装饰的自定义组件生效。 + + +## onPageHide + +onPageHide?(): void + +页面每次隐藏时触发一次,包括路由过程、应用进入前后台等场景,仅\@Entry装饰的自定义组件生效。 + + +## onBackPress + +onBackPress?(): void + +当用户点击返回按钮时触发,仅\@Entry装饰的自定义组件生效。返回true表示页面自己处理返回逻辑,不进行页面路由,返回false表示使用默认的路由返回逻辑。不设置返回值按照false处理。 + + +```ts +// xxx.ets +@Entry +@Component +struct IndexComponent { + @State textColor: Color = Color.Black; + + onPageShow() { + this.textColor = Color.Blue; + console.info('IndexComponent onPageShow'); + } + + onPageHide() { + this.textColor = Color.Transparent; + console.info('IndexComponent onPageHide'); + } + + onBackPress() { + this.textColor = Color.Red; + console.info('IndexComponent onBackPress'); + } + + build() { + Column() { + Text('Hello World') + .fontColor(this.textColor) + .fontSize(30) + .margin(30) + }.width('100%') + } +} +``` + +![zh-cn_image_0000001563060749](figures/zh-cn_image_0000001563060749.png) + + +## onLayout9+ + +onLayout?(children: Array<LayoutChild>, constraint: ConstraintSizeOptions): void + +框架会在自定义组件布局时,将该自定义组件的子节点信息和自身的尺寸范围通过onLayout传递给该自定义组件。不允许在onLayout函数中改变状态变量。 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 + +**参数:** + +| 参数名 | 类型 | 说明 | +| ---------- | ---------------------------------------- | ---------------- | +| children | Array<[LayoutChild](#layoutchild9)> | 子组件布局信息。 | +| constraint | [ConstraintSizeOptions](ts-types.md#constraintsizeoptions) | 父组件constraint信息。 | + + +## onMeasure9+ + +onMeasure?(children: Array<LayoutChild>, constraint: ConstraintSizeOptions): void + +框架会在自定义组件确定尺寸时,将该自定义组件的子节点信息和自身的尺寸范围通过onMeasure传递给该自定义组件。不允许在onMeasure函数中改变状态变量。 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 + +**参数:** + +| 参数名 | 类型 | 说明 | +| ---------- | ---------------------------------------- | ---------------- | +| children | Array<[LayoutChild](#layoutchild9)> | 子组件布局信息。 | +| constraint | [ConstraintSizeOptions](ts-types.md#constraintsizeoptions) | 父组件constraint信息。 | + + +## LayoutChild9+ + +子组件布局信息。 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 + +| 参数 | 参数类型 | 描述 | +| ---------- | ---------------------------------------- | ------------------- | +| name | string | 子组件名称。 | +| id | string | 子组件id。 | +| constraint | [ConstraintSizeOptions](ts-types.md#constraintsizeoptions) | 子组件约束尺寸。 | +| borderInfo | [LayoutBorderInfo](#layoutborderinfo9) | 子组件border信息。 | +| position | [Position](ts-types.md#position) | 子组件位置坐标。 | +| measure | (childConstraint:) => void | 调用此方法对子组件的尺寸范围进行限制。 | +| layout | (LayoutInfo: [LayoutInfo](#layoutinfo9)) => void | 调用此方法对子组件的位置信息进行限制。 | + + +## LayoutBorderInfo9+ + +子组件border信息。 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 + +| 参数 | 参数类型 | 描述 | +| ----------- | ------------------------------------ | ----------------------- | +| borderWidth | [EdgeWidths](ts-types.md#edgewidths) | 边框宽度类型,用于描述组件边框不同方向的宽度。 | +| margin | [Margin](ts-types.md#margin) | 外边距类型,用于描述组件不同方向的外边距。 | +| padding | [Padding](ts-types.md#padding) | 内边距类型,用于描述组件不同方向的内边距。 | + + +## LayoutInfo9+ + +子组件layout信息。 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 + +| 参数 | 参数类型 | 描述 | +| ---------- | ---------------------------------------- | -------- | +| position | [Position](ts-types.md#position) | 子组件位置坐标。 | +| constraint | [ConstraintSizeOptions](ts-types.md#constraintsizeoptions) | 子组件约束尺寸。 | + + +```ts +// xxx.ets +@Entry +@Component +struct Index { + build() { + Column() { + CustomLayout() { + ForEach([1, 2, 3], (index) => { + Text('Sub' + index) + .fontSize(30) + .borderWidth(2) + }) + } + } + } +} + + +@Component +struct CustomLayout { + @BuilderParam builder: () => {}; + + onLayout(children: Array, constraint: ConstraintSizeOptions) { + let pos = 0; + children.forEach((child) => { + child.layout({ position: { x: pos, y: pos }, constraint: constraint }) + pos += 100; + }) + } + + onMeasure(children: Array, constraint: ConstraintSizeOptions) { + let size = 100; + children.forEach((child) => { + child.measure({ minHeight: size, minWidth: size, maxWidth: size, maxHeight: size }) + size += 50; + }) + } + + build() { + this.builder() + } +} +``` + +![zh-cn_image_0000001511900496](figures/zh-cn_image_0000001511900496.png) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-circle.md b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-circle.md index db6b7734889a55af7884e2be2de46c619861dbc3..97b87b882f057dd0ba3a8ca0f490ff0e56bb607a 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-circle.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-circle.md @@ -16,6 +16,8 @@ Circle(options?: {width?: string | number, height?: string | number}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -29,17 +31,17 @@ Circle(options?: {width?: string | number, height?: string | number}) | 名称 | 类型 | 描述 | | -------- | -------- | -------- | -| fill | [ResourceColor](ts-types.md) | 设置填充区域颜色。
默认值:Color.Black | -| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 设置填充区域透明度。
默认值:1 | -| stroke | [ResourceColor](ts-types.md) | 设置边框颜色,不设置时,默认没有边框。 | -| strokeDashArray | Array<Length> | 设置边框间隙。
默认值:[] | -| strokeDashOffset | number \| string | 边框绘制起点的偏移量。
默认值:0 | -| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | 设置边框端点绘制样式。
默认值:LineCapStyle.Butt | -| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | 设置边框拐角绘制样式。
默认值:LineJoinStyle.Miter | -| strokeMiterLimit | number \| string | 设置斜接长度与边框宽度比值的极限值。
默认值:4
**说明:**
Circle组件无法设置尖角图形,该属性设置无效。 | -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 设置边框透明度。
默认值:1
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。 | -| strokeWidth | Length | 设置边框宽度。
默认值:1 | -| antiAlias | boolean | 是否开启抗锯齿效果。
默认值:true | +| fill | [ResourceColor](ts-types.md) | 设置填充区域颜色。
默认值:Color.Black
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 设置填充区域透明度。
默认值:1
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| stroke | [ResourceColor](ts-types.md) | 设置边框颜色,不设置时,默认没有边框。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeDashArray | Array<Length> | 设置边框间隙。
默认值:[]
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeDashOffset | number \| string | 边框绘制起点的偏移量。
默认值:0
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | 设置边框端点绘制样式。
默认值:LineCapStyle.Butt
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | 设置边框拐角绘制样式。
默认值:LineJoinStyle.Miter
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
Circle组件无法形成拐角,该属性设置无效。 | +| strokeMiterLimit | number \| string | 设置斜接长度与边框宽度比值的极限值。
默认值:4
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
Circle组件无法设置尖角图形,该属性设置无效。 | +| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 设置边框透明度。
默认值:1
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。 | +| strokeWidth | Length | 设置边框宽度。
默认值:1
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
该属性若为string类型, 暂不支持百分比。 | +| antiAlias | boolean | 是否开启抗锯齿效果。
默认值:true
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-ellipse.md b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-ellipse.md index 559a8791ece5b03ef04af063717555a58427429f..441c147a844da8b1a3a70f08983edef5a03dfd63 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-ellipse.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-ellipse.md @@ -16,6 +16,8 @@ Ellipse(options?: {width?: string | number, height?: string | number}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -29,17 +31,17 @@ Ellipse(options?: {width?: string | number, height?: string | number}) | 名称 | 类型 | 默认值 | 描述 | | -------- | -------- | -------- | -------- | -| fill | [ResourceColor](ts-types.md) | Color.Black | 设置填充区域颜色。 | -| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置填充区域透明度。 | -| stroke | [ResourceColor](ts-types.md) | - |设置边框颜色,不设置时,默认没有边框。 | -| strokeDashArray | Array<Length> | [] | 设置边框间隙。 | -| strokeDashOffset | number \| string | 0 | 边框绘制起点的偏移量。 | -| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | 设置边框端点绘制样式。 | -| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | 设置边框拐角绘制样式。 | -| strokeMiterLimit | number \| string | 4 | 设置斜接长度与边框宽度比值的极限值。
**说明:**
Ellipse组件无法设置尖角图形,该属性设置无效。 | -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置边框透明度。
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。 | -| strokeWidth | Length | 1 | 设置边框宽度。 | -| antiAlias | boolean | true | 是否开启抗锯齿效果。 | +| fill | [ResourceColor](ts-types.md) | Color.Black | 设置填充区域颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置填充区域透明度。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| stroke | [ResourceColor](ts-types.md) | - |设置边框颜色,不设置时,默认没有边框。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeDashArray | Array<Length> | [] | 设置边框间隙。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeDashOffset | number \| string | 0 | 边框绘制起点的偏移量。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | 设置边框端点绘制样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | 设置边框拐角绘制样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
Ellipse组件无法形成拐角,该属性设置无效。 | +| strokeMiterLimit | number \| string | 4 | 设置斜接长度与边框宽度比值的极限值。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
Ellipse组件无法设置尖角图形,该属性设置无效。 | +| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置边框透明度。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。 | +| strokeWidth | Length | 1 | 设置边框宽度。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
该属性若为string类型, 暂不支持百分比。 | +| antiAlias | boolean | true | 是否开启抗锯齿效果。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-line.md b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-line.md index 8cbe017c22667593ddd27d1063489efd3bfcc44f..663bf40b155f99a3ff4e752de047fd4dfd5444d3 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-line.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-line.md @@ -15,6 +15,8 @@ Line(value?: {width?: string | number, height?: string | number}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | @@ -29,19 +31,19 @@ Line(value?: {width?: string | number, height?: string | number}) | 名称 | 类型 | 默认值 | 描述 | | -------- | -------- | -------- | -------- | -| startPoint | Array<Length> | [0, 0] | 直线起点坐标点(相对坐标),单位vp。 | -| endPoint | Array<Length> | [0, 0] | 直线终点坐标点(相对坐标),单位vp。 | -| fill | [ResourceColor](ts-types.md#resourcecolor) | Color.Black | 设置填充区域颜色。
**说明:**
Line组件无法形成闭合区域,该属性设置无效。 | -| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置填充区域透明度。
**说明:**
Line组件无法形成闭合区域,该属性设置无效。 | -| stroke | [ResourceColor](ts-types.md) | - | 设置边框颜色,不设置时,默认没有边框线条。 | -| strokeDashArray | Array<Length> | [] | 设置线条间隙。 | -| strokeDashOffset | number \| string | 0 | 线条绘制起点的偏移量。 | -| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | 设置线条端点绘制样式。 | -| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | 设置线条拐角绘制样式。 | -| strokeMiterLimit | number \| string | 4 | 设置锐角绘制成斜角的极限值。
**说明:**
Line组件无法设置锐角图形,该属性设置无效。 | -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置线条透明度。
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。 | -| strokeWidth | Length | 1 | 设置线条宽度。 | -| antiAlias | boolean | true | 是否开启抗锯齿效果。 | +| startPoint | Array<Length> | [0, 0] | 直线起点坐标点(相对坐标),单位vp。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| endPoint | Array<Length> | [0, 0] | 直线终点坐标点(相对坐标),单位vp。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| fill | [ResourceColor](ts-types.md#resourcecolor) | Color.Black | 设置填充区域颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
Line组件无法形成闭合区域,该属性设置无效。 | +| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置填充区域透明度。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
Line组件无法形成闭合区域,该属性设置无效。 | +| stroke | [ResourceColor](ts-types.md) | - | 设置边框颜色,不设置时,默认没有边框线条。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeDashArray | Array<Length> | [] | 设置线条间隙。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeDashOffset | number \| string | 0 | 线条绘制起点的偏移量。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | 设置线条端点绘制样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | 设置线条拐角绘制样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
Line组件无法形成拐角,该属性设置无效。 | +| strokeMiterLimit | number \| string | 4 | 设置锐角绘制成斜角的极限值。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
Line组件无法设置锐角图形,该属性设置无效。 | +| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置线条透明度。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。 | +| strokeWidth | Length | 1 | 设置线条宽度。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
该属性若为string类型, 暂不支持百分比。| +| antiAlias | boolean | true | 是否开启抗锯齿效果。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 @@ -56,35 +58,41 @@ struct LineExample { Column({ space: 10 }) { // 线条绘制的起止点坐标均是相对于Line组件本身绘制区域的坐标 Line() + .width(200) + .height(150) .startPoint([0, 0]) .endPoint([50, 100]) .stroke(Color.Black) .backgroundColor('#F5F5F5') Line() .width(200) - .height(200) + .height(150) .startPoint([50, 50]) .endPoint([150, 150]) .strokeWidth(5) .stroke(Color.Orange) .strokeOpacity(0.5) .backgroundColor('#F5F5F5') - // 当坐标点设置的值超出Line组件的宽高范围时,线条会画出组件绘制区域 - Line({ width: 50, height: 50 }) + // strokeDashOffset用于定义关联虚线strokeDashArray数组渲染时的偏移 + Line() + .width(200) + .height(150) .startPoint([0, 0]) .endPoint([100, 100]) .stroke(Color.Black) .strokeWidth(3) .strokeDashArray([10, 3]) + .strokeDashOffset(5) .backgroundColor('#F5F5F5') - // strokeDashOffset用于定义关联虚线strokeDashArray数组渲染时的偏移 - Line({ width: 50, height: 50 }) + // 当坐标点设置的值超出Line组件的宽高范围时,线条会画出组件绘制区域 + Line() + .width(50) + .height(50) .startPoint([0, 0]) .endPoint([100, 100]) .stroke(Color.Black) .strokeWidth(3) .strokeDashArray([10, 3]) - .strokeDashOffset(5) .backgroundColor('#F5F5F5') } } @@ -149,12 +157,16 @@ struct LineExample { build() { Column() { Line() + .width(300) + .height(30) .startPoint([50, 30]) .endPoint([300, 30]) .stroke(Color.Black) .strokeWidth(10) // 设置strokeDashArray的数组间隔为 50 Line() + .width(300) + .height(30) .startPoint([50, 20]) .endPoint([300, 20]) .stroke(Color.Black) @@ -162,6 +174,8 @@ struct LineExample { .strokeDashArray([50]) // 设置strokeDashArray的数组间隔为 50, 10 Line() + .width(300) + .height(30) .startPoint([50, 20]) .endPoint([300, 20]) .stroke(Color.Black) @@ -169,6 +183,8 @@ struct LineExample { .strokeDashArray([50, 10]) // 设置strokeDashArray的数组间隔为 50, 10, 20 Line() + .width(300) + .height(30) .startPoint([50, 20]) .endPoint([300, 20]) .stroke(Color.Black) @@ -176,6 +192,8 @@ struct LineExample { .strokeDashArray([50, 10, 20]) // 设置strokeDashArray的数组间隔为 50, 10, 20, 30 Line() + .width(300) + .height(30) .startPoint([50, 20]) .endPoint([300, 20]) .stroke(Color.Black) @@ -187,4 +205,4 @@ struct LineExample { } ``` -![zh-cn_image2_0000001219982725](figures/zh-cn_image2_0000001219982725.PNG) \ No newline at end of file +![zh-cn_image2_0000001219982725](figures/zh-cn_image2_0000001219982725.PNG) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-path.md b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-path.md index 02ccd3b9aaf627be618132b2c023a634fdd004e6..08d670baba94c85bfb0bed37f1ab30561db5c6c5 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-path.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-path.md @@ -15,6 +15,8 @@ Path(value?: { width?: number | string; height?: number | string; commands?: string }) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -29,18 +31,18 @@ Path(value?: { width?: number | string; height?: number | string; commands?: str | 名称 | 类型 | 默认值 | 描述 | | -------- | ----------------------------------- | ---- | ---------------------------------------- | -| commands | string | '' | 路径绘制的命令字符串,单位为px。像素单位转换方法请参考[像素单位转换](ts-pixel-units.md)。 | -| fill | [ResourceColor](ts-types.md) | Color.Black | 设置填充区域颜色。 | -| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置填充区域透明度。 | -| stroke | [ResourceColor](ts-types.md) | - |设置边框颜色,不设置时,默认没有边框。 | -| strokeDashArray | Array<Length> | [] | 设置线条间隙。 | -| strokeDashOffset | number \| string | 0 | 线条绘制起点的偏移量。 | -| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | 设置线条端点绘制样式。 | -| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | 设置线条拐角绘制样式。 | -| strokeMiterLimit | number \| string | 4 | 设置斜接长度与边框宽度比值的极限值。斜接长度表示外边框外边交点到内边交点的距离,边框宽度即strokeWidth属性的值。
**说明:**
该属性取值需大于等于1,且在strokeLineJoin属性取值LineJoinStyle.Miter时生效。 | -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置线条透明度。
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。 | -| strokeWidth | Length | 1 | 设置线条宽度。 | -| antiAlias | boolean | true | 是否开启抗锯齿效果。 | +| commands | string | '' | 路径绘制的命令字符串,单位为px。像素单位转换方法请参考[像素单位转换](ts-pixel-units.md)。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| fill | [ResourceColor](ts-types.md) | Color.Black | 设置填充区域颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置填充区域透明度。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| stroke | [ResourceColor](ts-types.md) | - |设置边框颜色,不设置时,默认没有边框。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeDashArray | Array<Length> | [] | 设置线条间隙。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeDashOffset | number \| string | 0 | 线条绘制起点的偏移量。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | 设置线条端点绘制样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | 设置线条拐角绘制样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeMiterLimit | number \| string | 4 | 设置斜接长度与边框宽度比值的极限值。斜接长度表示外边框外边交点到内边交点的距离,边框宽度即strokeWidth属性的值。
**说明:**
该属性取值需大于等于1,且在strokeLineJoin属性取值LineJoinStyle.Miter时生效。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置线条透明度。
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeWidth | Length | 1 | 设置线条宽度。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
该属性若为string类型, 暂不支持百分比。| +| antiAlias | boolean | true | 是否开启抗锯齿效果。
从API version 9开始,该接口支持在ArkTS卡片中使用。| commands支持的绘制命令如下: @@ -72,9 +74,10 @@ struct PathExample { .fontSize(11) .fontColor(0xCCCCCC) .width('90%') - // 绘制一条长900px,宽3vp的直线 + // 绘制一条长600px,宽3vp的直线 Path() - .height(10) + .width('600px') + .height('10px') .commands('M0 0 L600 0') .stroke(Color.Black) .strokeWidth(3) @@ -86,16 +89,22 @@ struct PathExample { // 绘制直线图形 Flex({ justifyContent: FlexAlign.SpaceBetween }) { Path() + .width('210px') + .height('310px') .commands('M100 0 L200 240 L0 240 Z') .fillOpacity(0) .stroke(Color.Black) .strokeWidth(3) Path() + .width('210px') + .height('310px') .commands('M0 0 H200 V200 H0 Z') .fillOpacity(0) .stroke(Color.Black) .strokeWidth(3) Path() + .width('210px') + .height('310px') .commands('M100 0 L0 100 L50 200 L150 200 L200 100 Z') .fillOpacity(0) .stroke(Color.Black) @@ -106,16 +115,22 @@ struct PathExample { // 绘制弧线图形 Flex({ justifyContent: FlexAlign.SpaceBetween }) { Path() + .width('250px') + .height('310px') .commands("M0 300 S100 0 240 300 Z") .fillOpacity(0) .stroke(Color.Black) .strokeWidth(3) Path() + .width('210px') + .height('310px') .commands('M0 150 C0 100 140 0 200 150 L100 300 Z') .fillOpacity(0) .stroke(Color.Black) .strokeWidth(3) Path() + .width('210px') + .height('310px') .commands('M0 100 A30 20 20 0 0 200 100 Z') .fillOpacity(0) .stroke(Color.Black) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-polygon.md b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-polygon.md index 5ec83e3c362a6b4b9038e353633f9018c256af46..adefdb3b18bdb8c659de833cc953a31c280c0d69 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-polygon.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-polygon.md @@ -16,6 +16,8 @@ Polygon(value?: {width?: string | number, height?: string | number}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | @@ -30,23 +32,25 @@ Polygon(value?: {width?: string | number, height?: string | number}) | 名称 | 类型 | 默认值 | 描述 | | -------- | -------- | -------- | -------- | -| points | Array<Point> | [] | 多边形的顶点坐标列表。 | -| fill | [ResourceColor](ts-types.md) | Color.Black | 设置填充区域颜色。 | -| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置填充区域透明度。 | -| stroke | [ResourceColor](ts-types.md) | - | 设置边框颜色,不设置时,默认没有边框线条。 | -| strokeDashArray | Array<Length> | [] | 设置边框间隙。 | -| strokeDashOffset | number \| string | 0 | 边框绘制起点的偏移量。 | -| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | 设置边框端点绘制样式。 | -| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | 设置边框拐角绘制样式。 | -| strokeMiterLimit | number \| string | 4 | 设置斜接长度与边框宽度比值的极限值。斜接长度表示外边框外边交点到内边交点的距离,边框宽度即strokeWidth属性的值。
**说明:**
该属性取值需大于等于1,且在strokeLineJoin属性取值LineJoinStyle.Miter时生效。 | -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置边框透明度。
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。 | -| strokeWidth | Length | 1 | 设置边框宽度。 | -| antiAlias | boolean | true | 是否开启抗锯齿效果。 | +| points | Array<Point> | [] | 多边形的顶点坐标列表。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| fill | [ResourceColor](ts-types.md) | Color.Black | 设置填充区域颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置填充区域透明度。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| stroke | [ResourceColor](ts-types.md) | - | 设置边框颜色,不设置时,默认没有边框线条。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeDashArray | Array<Length> | [] | 设置边框间隙。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeDashOffset | number \| string | 0 | 边框绘制起点的偏移量。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | 设置边框端点绘制样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | 设置边框拐角绘制样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeMiterLimit | number \| string | 4 | 设置斜接长度与边框宽度比值的极限值。斜接长度表示外边框外边交点到内边交点的距离,边框宽度即strokeWidth属性的值。
**说明:**
该属性取值需大于等于1,且在strokeLineJoin属性取值LineJoinStyle.Miter时生效。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置边框透明度。
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeWidth | Length | 1 | 设置边框宽度。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
该属性若为string类型, 暂不支持百分比。| +| antiAlias | boolean | true | 是否开启抗锯齿效果。
从API version 9开始,该接口支持在ArkTS卡片中使用。| ## Point 点坐标类型。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 类型定义 | 描述 | | --------- | -------------------- | ------------------------------------------------------------ | | Point | [number, number] | 第一个参数为x轴坐标,第二个参数为y轴坐标(相对坐标)。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-polyline.md b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-polyline.md index afa18e7f7af8cf3abb85c65b5fba727e7b40e42d..cfe8a337950e9f2fc577271a0d18da8d5128a5b9 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-polyline.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-polyline.md @@ -16,6 +16,8 @@ Polyline(value?: {width?: string | number, height?: string | number}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | @@ -30,23 +32,25 @@ Polyline(value?: {width?: string | number, height?: string | number}) | 名称 | 类型 | 默认值 | 描述 | | -------- | -------- | -------- | -------- | -| points | Array<Point> | [] | 折线经过坐标点列表。 | -| fill | [ResourceColor](ts-types.md) | Color.Black | 设置填充区域颜色。 | -| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置填充区域透明度。 | -| stroke | [ResourceColor](ts-types.md) | - | 设置边框颜色,不设置时,默认没有边框线条。 | -| strokeDashArray | Array<Length> | [] | 设置线条间隙。 | -| strokeDashOffset | number \| string | 0 | 线条绘制起点的偏移量。 | -| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | 设置线条端点绘制样式。 | -| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | 设置线条拐角绘制样式。 | -| strokeMiterLimit | number \| string | 4 | 设置斜接长度与边框宽度比值的极限值。斜接长度表示外边框外边交点到内边交点的距离,边框宽度即strokeWidth属性的值。
**说明:**
该属性取值需大于等于1,且在strokeLineJoin属性取值LineJoinStyle.Miter时生效。 | -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置线条透明度。
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。 | -| strokeWidth | Length | 1 | 设置线条宽度。 | -| antiAlias | boolean | true | 是否开启抗锯齿效果。 | +| points | Array<Point> | [] | 折线经过坐标点列表。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| fill | [ResourceColor](ts-types.md) | Color.Black | 设置填充区域颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置填充区域透明度。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| stroke | [ResourceColor](ts-types.md) | - | 设置边框颜色,不设置时,默认没有边框线条。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeDashArray | Array<Length> | [] | 设置线条间隙。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeDashOffset | number \| string | 0 | 线条绘制起点的偏移量。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | 设置线条端点绘制样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | 设置线条拐角绘制样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeMiterLimit | number \| string | 4 | 设置斜接长度与边框宽度比值的极限值。斜接长度表示外边框外边交点到内边交点的距离,边框宽度即strokeWidth属性的值。
**说明:**
该属性取值需大于等于1,且在strokeLineJoin属性取值LineJoinStyle.Miter时生效。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置线条透明度。
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeWidth | Length | 1 | 设置线条宽度。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
该属性若为string类型, 暂不支持百分比。 | +| antiAlias | boolean | true | 是否开启抗锯齿效果。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## Point 点坐标类型。 +
从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 类型定义 | 描述 | | --------- | -------------------- | ------------------------------------------------------------ | | Point | [number, number] | 第一个参数为x轴坐标,第二个参数为y轴坐标(相对坐标)。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-rect.md b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-rect.md index fb41d1b6a89b4814bd7a222ed2462b55101b2882..23b4108f2f30db5d7f176ae7d9e870326ae201a3 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-rect.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-rect.md @@ -17,6 +17,8 @@ Rect(value?: {width?: string | number,height?: string | number,radius?: string | number | Array<string | number>} | {width?: string | number,height?: string | number,radiusWidth?: string | number,radiusHeight?: string | number}) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | @@ -34,20 +36,20 @@ Rect(value?: {width?: string | number,height?: string | number,radius?: string | | 名称 | 类型 | 默认值 | 描述 | | -------- | -------- | -------- | -------- | -| radiusWidth | string \| number | 0 | 圆角的宽度,仅设置宽时宽高一致。 | -| radiusHeight | string \| number | 0 | 圆角的高度,仅设置高时宽高一致。 | -| radius | string \| number \| Array<string \| number> | 0 | 圆角半径大小。 | -| fill | [ResourceColor](ts-types.md) | Color.Black | 设置填充区域颜色。 | -| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置填充区域透明度。 | -| stroke | [ResourceColor](ts-types.md) | - | 设置边框颜色,不设置时,默认没有边框。 | -| strokeDashArray | Array<Length> | [] | 设置边框间隙。 | -| strokeDashOffset | number \| string | 0 | 边框绘制起点的偏移量。 | -| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | 设置边框端点绘制样式。 | -| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | 设置边框拐角绘制样式。 | -| strokeMiterLimit | number \| string | 4 | 设置斜接长度与边框宽度比值的极限值。斜接长度表示外边框外边交点到内边交点的距离,边框宽度即strokeWidth属性的值。
**说明:**
该属性取值需大于等于1,且在strokeLineJoin属性取值LineJoinStyle.Miter时生效。 | -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置边框透明度。
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。 | -| strokeWidth | Length | 1 | 设置边框宽度。 | -| antiAlias | boolean | true | 是否开启抗锯齿效果。 | +| radiusWidth | string \| number | 0 | 圆角的宽度,仅设置宽时宽高一致。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| radiusHeight | string \| number | 0 | 圆角的高度,仅设置高时宽高一致。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| radius | string \| number \| Array<string \| number> | 0 | 圆角半径大小。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| fill | [ResourceColor](ts-types.md) | Color.Black | 设置填充区域颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置填充区域透明度。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| stroke | [ResourceColor](ts-types.md) | - | 设置边框颜色,不设置时,默认没有边框。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeDashArray | Array<Length> | [] | 设置边框间隙。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeDashOffset | number \| string | 0 | 边框绘制起点的偏移量。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | 设置边框端点绘制样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | 设置边框拐角绘制样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeMiterLimit | number \| string | 4 | 设置斜接长度与边框宽度比值的极限值。斜接长度表示外边框外边交点到内边交点的距离,边框宽度即strokeWidth属性的值。
**说明:**
该属性取值需大于等于1,且在strokeLineJoin属性取值LineJoinStyle.Miter时生效。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置边框透明度。
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeWidth | Length | 1 | 设置边框宽度。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
该属性若为string类型, 暂不支持百分比。| +| antiAlias | boolean | true | 是否开启抗锯齿效果。
从API version 9开始,该接口支持在ArkTS卡片中使用。| ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-shape.md b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-shape.md index 22231ba443c6382fb645d04b9833424324be8e55..9fad1261232b195662f37b294e2e8c0d0a17b3f3 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-shape.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-drawing-components-shape.md @@ -21,6 +21,8 @@ Shape(value?: PixelMap) +从API version 9开始,该接口支持在ArkTS卡片中使用,卡片中不支持使用PixelMap对象。 + **参数:** | 参数名 | 参数类型 | 必填 | 默认值 | 参数描述 | @@ -34,24 +36,22 @@ Shape(value?: PixelMap) | 名称 | 类型 | 默认值 | 描述 | | -------- | -------- | -------- | -------- | -| viewPort | {
x?: number \| string,
y?: number \| string,
width?: number \| string,
height?: number \| string
} | { x:0, y:0, width:0, height:0 } | 形状的视口。 | -| fill | [ResourceColor](ts-types.md) | Color.Black | 设置填充区域颜色。 | -| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置填充区域透明度。 | -| stroke | [ResourceColor](ts-types.md) | - | 设置边框颜色,不设置时,默认没有边框线条。 | -| strokeDashArray | Array<Length> | [] | 设置边框间隙。 | -| strokeDashOffset | number \| string | 0 | 边框绘制起点的偏移量。 | -| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | 设置边框端点绘制样式。 | -| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | 设置边框拐角绘制样式。 | -| strokeMiterLimit | number \| string | 4 | 设置斜接长度与边框宽度比值的极限值。斜接长度表示外边框外边交点到内边交点的距离,边框宽度即strokeWidth属性的值。
**说明:**
该属性取值需大于等于1,且在strokeLineJoin属性取值LineJoinStyle.Miter时生效。 | -| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置边框透明度。
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。 | -| strokeWidth | number \| string | 1 | 设置边框宽度。 | -| antiAlias | boolean | true | 是否开启抗锯齿效果。 | -| mesh8+ | Array<number>,number,number | [],0,0 | 设置mesh效果。第一个参数为长度(column + 1)* (row + 1)* 2的数组,它记录了扭曲后的位图各个顶点位置,第二个参数为mesh矩阵列数column,第三个参数为mesh矩阵行数row。 | +| viewPort | {
x?: number \| string,
y?: number \| string,
width?: number \| string,
height?: number \| string
} | { x:0, y:0, width:0, height:0 } | 形状的视口。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
该属性若为string类型, 暂不支持百分比。| +| fill | [ResourceColor](ts-types.md) | Color.Black | 设置填充区域颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| fillOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置填充区域透明度。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| stroke | [ResourceColor](ts-types.md) | - | 设置边框颜色,不设置时,默认没有边框线条。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeDashArray | Array<Length> | [] | 设置边框间隙。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeDashOffset | number \| string | 0 | 边框绘制起点的偏移量。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeLineCap | [LineCapStyle](ts-appendix-enums.md#linecapstyle) | LineCapStyle.Butt | 设置边框端点绘制样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeLineJoin | [LineJoinStyle](ts-appendix-enums.md#linejoinstyle) | LineJoinStyle.Miter | 设置边框拐角绘制样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeMiterLimit | number \| string | 4 | 设置斜接长度与边框宽度比值的极限值。斜接长度表示外边框外边交点到内边交点的距离,边框宽度即strokeWidth属性的值。
**说明:**
该属性取值需大于等于1,且在strokeLineJoin属性取值LineJoinStyle.Miter时生效。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeOpacity | number \| string \| [Resource](ts-types.md#resource类型) | 1 | 设置边框透明度。
**说明:**
该属性的取值范围是[0.0, 1.0],若给定值小于0.0,则取值为0.0;若给定值大于1.0,则取值为1.0。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| strokeWidth | number \| string | 1 | 设置边框宽度。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
该属性若为string类型, 暂不支持百分比。| +| antiAlias | boolean | true | 是否开启抗锯齿效果。
从API version 9开始,该接口支持在ArkTS卡片中使用。| +| mesh8+ | Array<number>,number,number | [],0,0 | 设置mesh效果。第一个参数为长度(column + 1)* (row + 1)* 2的数组,它记录了扭曲后的位图各个顶点位置,第二个参数为mesh矩阵列数column,第三个参数为mesh矩阵行数row。
从API version 9开始,该接口支持在ArkTS卡片中使用。| ## 示例 -### 示例1 - ```ts // xxx.ets @Entry @@ -68,6 +68,8 @@ struct ShapeExample { Ellipse().width(300).height(50).offset({ x: 0, y: 60 }) Path().width(300).height(10).commands('M0 0 L900 0').offset({ x: 0, y: 120 }) } + .width(350) + .height(140) .viewPort({ x: -2, y: -2, width: 304, height: 130 }) .fill(0x317AF7) .stroke(Color.Black) @@ -81,6 +83,8 @@ struct ShapeExample { Shape() { Rect().width(300).height(50) } + .width(350) + .height(80) .viewPort({ x: 0, y: 0, width: 320, height: 70 }) .fill(0x317AF7) .stroke(Color.Black) @@ -89,6 +93,8 @@ struct ShapeExample { Shape() { Rect().width(300).height(50) } + .width(350) + .height(80) .viewPort({ x: -5, y: -5, width: 320, height: 70 }) .fill(0x317AF7) .stroke(Color.Black) @@ -99,6 +105,8 @@ struct ShapeExample { Shape() { Path().width(300).height(10).commands('M0 0 L900 0') } + .width(350) + .height(20) .viewPort({ x: 0, y: -5, width: 300, height: 20 }) .stroke(0xEE8443) .strokeWidth(10) @@ -107,6 +115,8 @@ struct ShapeExample { Shape() { Path().width(300).height(10).commands('M0 0 L900 0') } + .width(350) + .height(20) .viewPort({ x: 0, y: -5, width: 300, height: 20 }) .stroke(0xEE8443) .strokeWidth(10) @@ -116,6 +126,8 @@ struct ShapeExample { Shape() { Path().width(300).height(10).commands('M0 0 L900 0') } + .width(350) + .height(20) .viewPort({ x: 0, y: -5, width: 300, height: 20 }) .stroke(0xEE8443) .strokeWidth(10) @@ -124,6 +136,8 @@ struct ShapeExample { Shape() { Path().width(300).height(10).commands('M0 0 L900 0') } + .width(350) + .height(20) .viewPort({ x: 0, y: -5, width: 300, height: 20 }) .stroke(0xEE8443) .strokeWidth(10) @@ -133,7 +147,9 @@ struct ShapeExample { Shape() { Path().width(200).height(60).commands('M0 0 L400 0 L400 150 Z') } - .viewPort({ x: -80, y: -5, width: 310, height: 90 }) + .width(300) + .height(200) + .viewPort({ x: -20, y: -5, width: 310, height: 90 }) .fill(0x317AF7) .stroke(0xEE8443) .strokeWidth(10) @@ -145,3 +161,4 @@ struct ShapeExample { ``` ![zh-cn_image_0000001184628104](figures/zh-cn_image_0000001184628104.png) +、 \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-explicit-animation.md b/zh-cn/application-dev/reference/arkui-ts/ts-explicit-animation.md index e6511abfc7f4e969909655b05594e93df9764542..ca5bc50d38e9bf0b2d2d230c3cff6256239df3be 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-explicit-animation.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-explicit-animation.md @@ -6,9 +6,10 @@ > > 从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 - animateTo(value: AnimateParam, event: () => void): void +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 参数 | 类型 | 是否必填 | 描述 | | ---------------- | ------------ | -------------------- | -------------------- | | value | [AnimateParam](#animateparam对象说明) | 是 | 设置动画效果相关参数。 | @@ -18,13 +19,13 @@ animateTo(value: AnimateParam, event: () => void): void | 名称 | 类型 | 描述 | | -------- | -------- | -------- | -| duration | number | 动画持续时间,单位为毫秒。
默认值:1000 | +| duration | number | 动画持续时间,单位为毫秒。
默认值:1000
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
- 在ArkTS卡片上最大动画持续时间为1000毫秒,若超出则固定为1000毫秒。 | | tempo | number | 动画的播放速度,值越大动画播放越快,值越小播放越慢,为0时无动画效果。
默认值:1.0 | -| curve | [Curve](ts-appendix-enums.md#curve) \| [ICurve](../apis/js-apis-curve.md#icurve) \| string | 动画曲线。
默认值:Curve.Linear | +| curve | [Curve](ts-appendix-enums.md#curve) \| [ICurve](../apis/js-apis-curve.md#icurve) \| string | 动画曲线。
默认值:Curve.Linear
从API version 9开始,该接口支持在ArkTS卡片中使用。 | | delay | number | 单位为ms(毫秒),默认不延时播放。
默认值:0 | | iterations | number | 默认播放一次,设置为-1时表示无限次播放。
默认值:1 | -| playMode | [PlayMode](ts-appendix-enums.md#playmode) | 设置动画播放模式,默认播放完成后重头开始播放。
默认值:PlayMode.Normal | -| onFinish | () => void | 动效播放完成回调。 | +| playMode | [PlayMode](ts-appendix-enums.md#playmode) | 设置动画播放模式,默认播放完成后重头开始播放。
默认值:PlayMode.Normal
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| onFinish | () => void | 动效播放完成回调。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 @@ -41,7 +42,7 @@ struct AnimateToExample { build() { Column() { - Button('change width and height') + Button('change size') .width(this.widthSize) .height(this.heightSize) .margin(30) @@ -56,8 +57,8 @@ struct AnimateToExample { console.info('play end') } }, () => { - this.widthSize = 100 - this.heightSize = 50 + this.widthSize = 150 + this.heightSize = 60 }) } else { animateTo({}, () => { @@ -76,7 +77,7 @@ struct AnimateToExample { curve: Curve.Friction, delay: 500, iterations: -1, // 设置-1表示动画无限循环 - playMode: PlayMode.AlternateReverse, + playMode: PlayMode.Alternate, onFinish: () => { console.info('play end') } @@ -89,10 +90,4 @@ struct AnimateToExample { } ``` -示意图: - -![animation](figures/animation.PNG) - -点击第一个按钮播放改变按钮大小的动画,点击第二个按钮播放按钮顺时针旋转90度的动画。 - -![animation1](figures/animation1.PNG) \ No newline at end of file +![animation1](figures/animation1.gif) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-gesture-settings.md b/zh-cn/application-dev/reference/arkui-ts/ts-gesture-settings.md index ee9d0f394150788b1aea9b45311fb81267cb6ed4..5621f3d58d9bac09a1623628b1f3871403dc908f 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-gesture-settings.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-gesture-settings.md @@ -34,7 +34,7 @@ | 名称 | 描述 | | -------- | -------- | | Normal | 不屏蔽子组件的手势,按照默认手势识别顺序进行识别。 | -| IgnoreInternal | 屏蔽子组件的手势,仅当前容器的手势进行识别。
子组件上系统内置的手势不会被屏蔽,如子组件为List组件时,内置的滑动手势仍然会触发。 | +| IgnoreInternal | 屏蔽子组件的手势,包括子组件上系统内置的手势,如子组件为List组件时,内置的滑动手势同样会被屏蔽。 | ## 响应手势事件 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-media-components-video.md b/zh-cn/application-dev/reference/arkui-ts/ts-media-components-video.md index ba54d01040d4c372cbcab714cd3b7c7e2f8b38f3..60a2352f3cab73db8afd799b52cc2ebce74186c9 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-media-components-video.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-media-components-video.md @@ -118,9 +118,9 @@ requestFullscreen(value: boolean) **参数:** -| 参数名 | 参数类型 | 必填 | 参数描述 | -| ----- | ------- | ---- | --------------------- | -| value | boolean | 是 | 是否全屏播放。
默认值:false | +| 参数名 | 参数类型 | 必填 | 参数描述 | +| ------ | -------- | ---- | -------------------------------------------------- | +| value | boolean | 是 | 是否全屏(填充满应用窗口)播放。
默认值:false | ### exitFullscreen @@ -173,7 +173,7 @@ struct VideoCreateComponent { previewUri: this.previewUri, currentProgressRate: this.curRate, controller: this.controller - }).width(800).height(600) + }).width('100%').height(600) .autoPlay(this.isAutoPlay) .controls(this.showControls) .onStart(() => { @@ -186,7 +186,7 @@ struct VideoCreateComponent { console.info('onFinish') }) .onError(() => { - console.info('onFinish') + console.info('onError') }) .onPrepared((e) => { console.info('onPrepared is ' + e.duration) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-methods-custom-dialog-box.md b/zh-cn/application-dev/reference/arkui-ts/ts-methods-custom-dialog-box.md index 604ebcbaa2793c48bf670705786324483fe094f8..c203bd2371555dddb87e1cc9854660a1187d7d11 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-methods-custom-dialog-box.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-methods-custom-dialog-box.md @@ -11,23 +11,24 @@ ## 接口 -CustomDialogController(value:{builder: CustomDialog, cancel?: () => void, autoCancel?: boolean, alignment?: DialogAlignment, offset?: Offset, customStyle?: boolean, gridCount?: number, maskColor?: ResourceColor, openAnimation?: AnimateParam, closeAniamtion?: AnimateParam}) +CustomDialogController(value:{builder: CustomDialog, cancel?: () => void, autoCancel?: boolean, alignment?: DialogAlignment, offset?: Offset, customStyle?: boolean, gridCount?: number, maskColor?: ResourceColor, openAnimation?: AnimateParam, closeAniamtion?: AnimateParam, showInSubWindow?: boolean}) **参数:** -| 参数名 | 参数类型 | 必填 | 参数描述 | -| ---------------------- | ---------------------------------------- | ------------------------- | ---------------------- | -| builder | [CustomDialog](../../quick-start/arkts-dynamic-ui-elememt-building.md#customdialog) | 是 | 自定义弹窗内容构造器。 | -| cancel | () => void | 否 | 点击遮障层退出时的回调。 | -| autoCancel | boolean | 否 | 是否允许点击遮障层退出。
默认值:true | -| alignment | [DialogAlignment](ts-methods-alert-dialog-box.md#dialogalignment枚举说明) | 否 | 弹窗在竖直方向上的对齐方式。
默认值:DialogAlignment.Default | -| offset | [Offset](ts-types.md#offset) | 否 | 弹窗相对alignment所在位置的偏移量。 | -| customStyle | boolean | 否 | 弹窗容器样式是否自定义。
默认值:false,弹窗容器的宽度根据栅格系统自适应,不跟随子节点;高度自适应子节点,最大为窗口高度的90%;圆角为24vp。 | -| gridCount8+ | number | 否 | 弹窗宽度占[栅格宽度](../../ui/ui-ts-layout-grid-container-new.md)的个数。
默认值为4,异常值按默认值处理,最大栅格数为系统最大栅格数。 | -| maskColor10+ | [ResourceColor](ts-types.md#resourcecolor) | 否 | 自定义蒙层颜色。
默认值: 0x33000000 | -| openAnimation10+ | [AnimateParam](ts-explicit-animation.md#animateparam对象说明) | 否 | 自定义设置弹窗弹出的动画效果相关参数。 | -| closeAniamtion10+| [AnimateParam](ts-explicit-animation.md#animateparam对象说明) | 否 | 自定义设置弹窗关闭的动画效果相关参数。 | +| 参数名 | 参数类型 | 必填 | 参数描述 | +| ----------------------------- | ---------------------------------------- | ---- | ---------------------------------------- | +| builder | CustomDialog | 是 | 自定义弹窗内容构造器。 | +| cancel | () => void | 否 | 点击遮障层退出时的回调。 | +| autoCancel | boolean | 否 | 是否允许点击遮障层退出。
默认值:true | +| alignment | [DialogAlignment](ts-methods-alert-dialog-box.md#dialogalignment枚举说明) | 否 | 弹窗在竖直方向上的对齐方式。
默认值:DialogAlignment.Default | +| offset | [Offset](ts-types.md#offset) | 否 | 弹窗相对alignment所在位置的偏移量。 | +| customStyle | boolean | 否 | 弹窗容器样式是否自定义。
默认值:false,弹窗容器的宽度根据栅格系统自适应,不跟随子节点;高度自适应子节点,最大为窗口高度的90%;圆角为24vp。 | +| gridCount8+ | number | 否 | 弹窗宽度占[栅格宽度](../../ui/arkts-layout-development-grid-layout.md)的个数。
默认值为4,异常值按默认值处理,最大栅格数为系统最大栅格数。 | +| maskColor10+ | [ResourceColor](ts-types.md#resourcecolor) | 否 | 自定义蒙层颜色。
默认值: 0x33000000 | +| openAnimation10+ | [AnimateParam](ts-explicit-animation.md#animateparam对象说明) | 否 | 自定义设置弹窗弹出的动画效果相关参数。
注意:当iterations为奇数,playMode设置为Reverse,动画结束时,弹窗不显示。 | +| closeAniamtion10+ | [AnimateParam](ts-explicit-animation.md#animateparam对象说明) | 否 | 自定义设置弹窗关闭的动画效果相关参数。 | +| showInSubWindow10+ | boolean | 否 | 是否在子窗口显示弹窗。
默认值:false,在子窗口不显示弹窗。
**说明**:showInSubWindow为true的弹窗无法触发显示另一个showInSubWindow为true的弹窗。 | ## CustomDialogController @@ -36,6 +37,7 @@ CustomDialogController(value:{builder: CustomDialog, cancel?: () => void, aut ```ts dialogController : CustomDialogController = new CustomDialogController(value:{builder: CustomDialog, cancel?: () => void, autoCancel?: boolean}) ``` +**说明**:CustomDialogController仅在作为@CustomDialog和@Component struct的成员变量,且在@Component struct内部定义时赋值才有效,具体用法可看下方示例。 ### open() open(): void diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-methods-datepicker-dialog.md b/zh-cn/application-dev/reference/arkui-ts/ts-methods-datepicker-dialog.md index f3bd25442f3d688aec59f9ed2c3fb3a445d8398b..515389849fe32a961fecba1723d9394761d76400 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-methods-datepicker-dialog.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-methods-datepicker-dialog.md @@ -21,6 +21,11 @@ show(options?: DatePickerDialogOptions) | end | Date | 否 | Date('2100-12-31') | 设置选择器的结束日期。 | | selected | Date | 否 | 当前系统日期 | 设置当前选中的日期。 | | lunar | boolean | 否 | false | 日期是否显示为农历。 | +| showTime10+ | boolean | 否 | false | 是否展示时间项。 | +| useMilitaryTime10+ | boolean | 否 | false | 展示时间是否为24小时制。 | +| disappearTextStyle10+ | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10类型说明) | 否 | - | 设置所有选项中最上和最下两个选项的文本颜色、字号、字体粗细。 | +| textStyle10+ | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10类型说明) | 否 | - | 设置所有选项中除了最上、最下及选中项以外的文本颜色、字号、字体粗细。 | +| selectedTextStyle10+ | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10类型说明) | 否 | - | 设置选中项的文本颜色、字号、字体粗细。 | | onAccept | (value: [DatePickerResult](ts-basic-components-datepicker.md#DatePickerResult对象说明)) => void | 否 | - | 点击弹窗中的“确定”按钮时触发该回调。 | | onCancel | () => void | 否 | - | 点击弹窗中的“取消”按钮时触发该回调。 | | onChange | (value: [DatePickerResult](ts-basic-components-datepicker.md#DatePickerResult对象说明)) => void | 否 | - | 滑动弹窗中的滑动选择器使当前选中项改变时触发该回调。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-methods-textpicker-dialog.md b/zh-cn/application-dev/reference/arkui-ts/ts-methods-textpicker-dialog.md index 7bb99f5f46e8bcd2992b36025ca6e3c74a6465fc..ddcc46f2eb5f74f02de54e5d3d07c2f520e29609 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-methods-textpicker-dialog.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-methods-textpicker-dialog.md @@ -17,10 +17,13 @@ show(options?: TextPickerDialogOptions) | 参数名 | 参数类型 | 必填 | 参数描述 | | -------- | -------- | -------- | -------- | -| range | string[] \| [Resource](ts-types.md#resource) | 是 | 设置文本选择器的选择范围。 | +| range | string[] \| [Resource](ts-types.md#resource)\|[TextPickerRangeContent](ts-basic-components-textpicker.md#textpickerrangecontent10类型说明)[]10+ | 是 | 设置文本选择器的选择范围。不可设置为空数组,若设置为空数组,则不弹出弹窗。 | | selected | number | 否 | 设置选中项的索引值。
默认值:0 | | value | string | 否 | 设置选中项的文本内容。当设置了selected参数时,该参数不生效。如果设置的value值不在range范围内,则默认取range第一个元素。| | defaultPickerItemHeight | number \| string | 否 | 设置选择器中选项的高度。 | +| disappearTextStyle10+ | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10类型说明) | 否 | 设置所有选项中最上和最下两个选项的文本颜色、字号、字体粗细。 | +| textStyle10+ | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10类型说明) | 否 | 设置所有选项中除了最上、最下及选中项以外的文本颜色、字号、字体粗细。 | +| selectedTextStyle10+ | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10类型说明) | 否 | 设置选中项的文本颜色、字号、字体粗细。 | | onAccept | (value: [TextPickerResult](#textpickerresult对象说明)) => void | 否 | 点击弹窗中的“确定”按钮时触发该回调。 | | onCancel | () => void | 否 | 点击弹窗中的“取消”按钮时触发该回调。 | | onChange | (value: [TextPickerResult](#textpickerresult对象说明)) => void | 否 | 滑动弹窗中的选择器使当前选中项改变时触发该回调。 | @@ -29,7 +32,7 @@ show(options?: TextPickerDialogOptions) | 名称 | 类型 | 描述 | | -------- | -------- | -------- | -| value | string | 选中项的文本内容。 | +| value | string | 选中项的文本内容。
**说明**:当显示文本或图片加文本列表时,value值为选中项中的文本值,
当显示图片列表时,value值为空。 | | index | number | 选中项在选择范围数组中的索引值。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-methods-timepicker-dialog.md b/zh-cn/application-dev/reference/arkui-ts/ts-methods-timepicker-dialog.md index 97229576c98b61f2d7fb69cf0512adc03e00f8c6..fbd598c3269e88184ad54c1c704cf08b9274c50a 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-methods-timepicker-dialog.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-methods-timepicker-dialog.md @@ -19,6 +19,9 @@ show(options?: TimePickerDialogOptions) | -------- | -------- | -------- | -------- | | selected | Date | 否 | 设置当前选中的时间。
默认值:当前系统时间 | | useMilitaryTime | boolean | 否 | 展示时间是否为24小时制,默认为12小时制。
默认值:false | +| disappearTextStyle10+ | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10类型说明) | 否 | 设置所有选项中最上和最下两个选项的文本颜色、字号、字体粗细。 | +| textStyle10+ | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10类型说明) | 否 | 设置所有选项中除了最上、最下及选中项以外的文本颜色、字号、字体粗细。 | +| selectedTextStyle10+ | [PickerTextStyle](ts-basic-components-datepicker.md#pickertextstyle10类型说明) | 否 | 设置选中项的文本颜色、字号、字体粗细。 | | onAccept | (value: [TimePickerResult](ts-basic-components-timepicker.md#TimePickerResult对象说明)) => void | 否 | 点击弹窗中的“确定”按钮时触发该回调。 | | onCancel | () => void | 否 | 点击弹窗中的“取消”按钮时触发该回调。 | | onChange | (value: [TimePickerResult](ts-basic-components-timepicker.md#TimePickerResult对象说明)) => void | 否 | 滑动弹窗中的选择器使当前选中时间改变时触发该回调。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-motion-path-animation.md b/zh-cn/application-dev/reference/arkui-ts/ts-motion-path-animation.md index adb197b0bff707b0f237933e1b48e21689e1154a..7b7bbcf002c7b6c351e3ef1e0d21f809d1383b14 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-motion-path-animation.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-motion-path-animation.md @@ -11,7 +11,7 @@ | 名称 | 参数类型 | 默认值 | 描述 | | -------- | -------- | -------- | -------- | -| motionPath | {
path: string,
from?: number,
to?: number,
rotatable?: boolean
}
**说明:**
path中支持使用start和end进行起点和终点的替代,如:
'Mstart.x start.y L50 50 Lend.x end.y Z',更多说明请参考[绘制路径](../../ui/ui-js-components-svg-path.md)。 | {
'',
0.0,
1.0,
false
} | 设置组件的运动路径,入参说明如下:
- path:位移动画的运动路径,使用svg路径字符串。
- from:运动路径的起点,默认为0.0。
- to:运动路径的终点,默认为1.0。
- rotatable:是否跟随路径进行旋转。 | +| motionPath | {
path: string,
from?: number,
to?: number,
rotatable?: boolean
}
**说明:**
path中支持使用start和end进行起点和终点的替代,如:
'Mstart.x start.y L50 50 Lend.x end.y Z',更多说明请参考[绘制路径](../../ui/ui-js-components-svg-path.md)。 | {
'',
0.0,
1.0,
false
} | 设置组件的运动路径,入参说明如下:
- path:位移动画的运动路径,使用svg路径字符串。
- from:运动路径的起点。
默认值:0.0
取值范围:[0, 1]
设置小于0的值时,按值为0处理。设置大于1的值时,按值为1处理。
- to:运动路径的终点。
默认值:1.0
取值范围:[0, 1]
设置小于0的值时,按值为0处理。设置大于1的值时,按值为1处理。
- rotatable:是否跟随路径进行旋转。 | ## 示例 @@ -25,7 +25,7 @@ struct MotionPathExample { build() { Column() { - Button('click me') + Button('click me').margin(50) // 执行动画:从起点移动到(300,200),再到(300,500),再到终点 .motionPath({ path: 'Mstart.x start.y L300 200 L300 500 Lend.x end.y', from: 0.0, to: 1.0, rotatable: true }) .onClick(() => { diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md b/zh-cn/application-dev/reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md index 0473859c7008b47b62f869694e13f2be2e545056..98c4bd350c2d8ad1818bb2a25c89be747ff0fac9 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md @@ -12,6 +12,8 @@ OffscreenCanvasRenderingContext2D(width: number, height: number, setting: RenderingContextSettings) +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 参数描述 | @@ -25,23 +27,23 @@ OffscreenCanvasRenderingContext2D(width: number, height: number, setting: Render | 名称 | 类型 | 描述 | | ----------------------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | -| [fillStyle](#fillstyle) | string \| [CanvasGradient](ts-components-canvas-canvasgradient.md) \| [CanvasPattern](#canvaspattern) | 指定绘制的填充色。
- 类型为string时,表示设置填充区域的颜色。
- 类型为CanvasGradient时,表示渐变对象,使用[createLinearGradient](#createlineargradient)方法创建。
- 类型为CanvasPattern时,使用[createPattern](#createpattern)方法创建。 | -| [lineWidth](#linewidth) | number | 设置绘制线条的宽度。 | -| [strokeStyle](#strokestyle) | string \| [CanvasGradient](ts-components-canvas-canvasgradient.md) \| [CanvasPattern](#canvaspattern) | 设置描边的颜色。
- 类型为string时,表示设置描边使用的颜色。
- 类型为CanvasGradient时,表示渐变对象,使用[createLinearGradient](#createlineargradient)方法创建。
- 类型为CanvasPattern时,使用[createPattern](#createpattern)方法创建。 | -| [lineCap](#linecap) | CanvasLineCap | 指定线端点的样式,可选值为:
- 'butt':线端点以方形结束。
- 'round':线端点以圆形结束。
- 'square':线端点以方形结束,该样式下会增加一个长度和线段厚度相同,宽度是线段厚度一半的矩形。
- 默认值:'butt'。 | -| [lineJoin](#linejoin) | CanvasLineJoin | 指定线段间相交的交点样式,可选值为:
- 'round':在线段相连处绘制一个扇形,扇形的圆角半径是线段的宽度。
- 'bevel':在线段相连处使用三角形为底填充, 每个部分矩形拐角独立。
- 'miter':在相连部分的外边缘处进行延伸,使其相交于一点,形成一个菱形区域,该属性可以通过设置miterLimit属性展现效果。
- 默认值:'miter'。 | -| [miterLimit](#miterlimit) | number | 设置斜接面限制值,该值指定了线条相交处内角和外角的距离。
- 默认值:10。 | -| [font](#font) | string | 设置文本绘制中的字体样式。
语法:ctx.font='font-size font-family'
- font-size(可选),指定字号和行高,单位只支持px。
- font-family(可选),指定字体系列。
语法:ctx.font='font-style font-weight font-size font-family'
- font-style(可选),用于指定字体样式,支持如下几种样式:'normal','italic'。
- font-weight(可选),用于指定字体的粗细,支持如下几种类型:'normal', 'bold', 'bolder', 'lighter', 100, 200, 300, 400, 500, 600, 700, 800, 900。
- font-size(可选),指定字号和行高,单位只支持px。
- font-family(可选),指定字体系列,支持如下几种类型:'sans-serif', 'serif', 'monospace'。
- 默认值:'normal normal 14px sans-serif'。 | -| [textAlign](#textalign) | CanvasTextAlign | 设置文本绘制中的文本对齐方式,可选值为:
- 'left':文本左对齐。
- 'right':文本右对齐。
- 'center':文本居中对齐。
- 'start':文本对齐界线开始的地方。
- 'end':文本对齐界线结束的地方。
> **说明:**
> ltr布局模式下'start'和'left'一致,rtl布局模式下'start'和'right'一致·。
- 默认值:'left'。 | -| [textBaseline](#textbaseline) | CanvasTextBaseline | 设置文本绘制中的水平对齐方式,可选值为:
- 'alphabetic':文本基线是标准的字母基线。
- 'top':文本基线在文本块的顶部。
- 'hanging':文本基线是悬挂基线。
- 'middle':文本基线在文本块的中间。
- 'ideographic':文字基线是表意字基线;如果字符本身超出了alphabetic基线,那么ideograhpic基线位置在字符本身的底部。
- 'bottom':文本基线在文本块的底部。 与ideographic基线的区别在于ideographic基线不需要考虑下行字母。
- 默认值:'alphabetic'。 | +| [fillStyle](#fillstyle) | string \| [CanvasGradient](ts-components-canvas-canvasgradient.md) \| [CanvasPattern](#canvaspattern) | 指定绘制的填充色。
- 类型为string时,表示设置填充区域的颜色。
- 类型为CanvasGradient时,表示渐变对象,使用[createLinearGradient](#createlineargradient)方法创建。
- 类型为CanvasPattern时,使用[createPattern](#createpattern)方法创建。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| [lineWidth](#linewidth) | number | 设置绘制线条的宽度。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| [strokeStyle](#strokestyle) | string \| [CanvasGradient](ts-components-canvas-canvasgradient.md) \| [CanvasPattern](#canvaspattern) | 设置描边的颜色。
- 类型为string时,表示设置描边使用的颜色。
- 类型为CanvasGradient时,表示渐变对象,使用[createLinearGradient](#createlineargradient)方法创建。
- 类型为CanvasPattern时,使用[createPattern](#createpattern)方法创建。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| [lineCap](#linecap) | CanvasLineCap | 指定线端点的样式,可选值为:
- 'butt':线端点以方形结束。
- 'round':线端点以圆形结束。
- 'square':线端点以方形结束,该样式下会增加一个长度和线段厚度相同,宽度是线段厚度一半的矩形。
- 默认值:'butt'。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| [lineJoin](#linejoin) | CanvasLineJoin | 指定线段间相交的交点样式,可选值为:
- 'round':在线段相连处绘制一个扇形,扇形的圆角半径是线段的宽度。
- 'bevel':在线段相连处使用三角形为底填充, 每个部分矩形拐角独立。
- 'miter':在相连部分的外边缘处进行延伸,使其相交于一点,形成一个菱形区域,该属性可以通过设置miterLimit属性展现效果。
- 默认值:'miter'。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| [miterLimit](#miterlimit) | number | 设置斜接面限制值,该值指定了线条相交处内角和外角的距离。
- 默认值:10。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| [font](#font) | string | 设置文本绘制中的字体样式。
语法:ctx.font='font-size font-family'
- font-size(可选),指定字号和行高,单位只支持px。
- font-family(可选),指定字体系列。
语法:ctx.font='font-style font-weight font-size font-family'
- font-style(可选),用于指定字体样式,支持如下几种样式:'normal','italic'。
- font-weight(可选),用于指定字体的粗细,支持如下几种类型:'normal', 'bold', 'bolder', 'lighter', 100, 200, 300, 400, 500, 600, 700, 800, 900。
- font-size(可选),指定字号和行高,单位只支持px。
- font-family(可选),指定字体系列,支持如下几种类型:'sans-serif', 'serif', 'monospace'。
- 默认值:'normal normal 14px sans-serif'。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| [textAlign](#textalign) | CanvasTextAlign | 设置文本绘制中的文本对齐方式,可选值为:
- 'left':文本左对齐。
- 'right':文本右对齐。
- 'center':文本居中对齐。
- 'start':文本对齐界线开始的地方。
- 'end':文本对齐界线结束的地方。
> **说明:**
> ltr布局模式下'start'和'left'一致,rtl布局模式下'start'和'right'一致·。
- 默认值:'left'。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| [textBaseline](#textbaseline) | CanvasTextBaseline | 设置文本绘制中的水平对齐方式,可选值为:
- 'alphabetic':文本基线是标准的字母基线。
- 'top':文本基线在文本块的顶部。
- 'hanging':文本基线是悬挂基线。
- 'middle':文本基线在文本块的中间。
- 'ideographic':文字基线是表意字基线;如果字符本身超出了alphabetic基线,那么ideograhpic基线位置在字符本身的底部。
- 'bottom':文本基线在文本块的底部。 与ideographic基线的区别在于ideographic基线不需要考虑下行字母。
- 默认值:'alphabetic'。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | | [globalAlpha](#globalalpha) | number | 设置透明度,0.0为完全透明,1.0为完全不透明。 | -| [lineDashOffset](#linedashoffset) | number | 设置画布的虚线偏移量,精度为float。
- 默认值:0.0。 | -| [globalCompositeOperation](#globalcompositeoperation) | string | 设置合成操作的方式。类型字段可选值有'source-over','source-atop','source-in','source-out','destination-over','destination-atop','destination-in','destination-out','lighter','copy','xor'。
- 默认值:'source-over'。 | -| [shadowBlur](#shadowblur) | number | 设置绘制阴影时的模糊级别,值越大越模糊,精度为float。
- 默认值:0.0。 | -| [shadowColor](#shadowcolor) | string | 设置绘制阴影时的阴影颜色。 | -| [shadowOffsetX](#shadowoffsetx) | number | 设置绘制阴影时和原有对象的水平偏移值。 | -| [shadowOffsetY](#shadowoffsety) | number | 设置绘制阴影时和原有对象的垂直偏移值。 | -| [imageSmoothingEnabled](#imagesmoothingenabled) | boolean | 用于设置绘制图片时是否进行图像平滑度调整,true为启用,false为不启用。
- 默认值:true。 | +| [lineDashOffset](#linedashoffset) | number | 设置画布的虚线偏移量,精度为float。
- 默认值:0.0。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| [globalCompositeOperation](#globalcompositeoperation) | string | 设置合成操作的方式。类型字段可选值有'source-over','source-atop','source-in','source-out','destination-over','destination-atop','destination-in','destination-out','lighter','copy','xor'。
- 默认值:'source-over'。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| [shadowBlur](#shadowblur) | number | 设置绘制阴影时的模糊级别,值越大越模糊,精度为float。
- 默认值:0.0。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| [shadowColor](#shadowcolor) | string | 设置绘制阴影时的阴影颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| [shadowOffsetX](#shadowoffsetx) | number | 设置绘制阴影时和原有对象的水平偏移值。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| [shadowOffsetY](#shadowoffsety) | number | 设置绘制阴影时和原有对象的垂直偏移值。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| [imageSmoothingEnabled](#imagesmoothingenabled) | boolean | 用于设置绘制图片时是否进行图像平滑度调整,true为启用,false为不启用。
- 默认值:true。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | > **说明:** > fillStyle、shadowColor与 strokeStyle 中string类型格式为 'rgb(255, 255, 255)','rgba(255, 255, 255, 1.0)','\#FFFFFF'。 @@ -66,7 +68,7 @@ struct FillStyleExample { .backgroundColor('#ffff00') .onReady(() =>{ this.offContext.fillStyle = '#0000ff' - this.offContext.fillRect(20, 160, 150, 100) + this.offContext.fillRect(20, 20, 150, 100) var image = this.offContext.transferToImageBitmap() this.context.transferFromImageBitmap(image) }) @@ -700,6 +702,8 @@ fillRect(x: number, y: number, w: number, h: number): void 填充一个矩形。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 说明 | @@ -727,7 +731,7 @@ fillRect(x: number, y: number, w: number, h: number): void .height('100%') .backgroundColor('#ffff00') .onReady(() =>{ - this.offContext.fillRect(0,30,100,100) + this.offContext.fillRect(30,30,100,100) var image = this.offContext.transferToImageBitmap() this.context.transferFromImageBitmap(image) }) @@ -747,6 +751,8 @@ strokeRect(x: number, y: number, w: number, h: number): void 绘制具有边框的矩形,矩形内部不填充。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 说明 | @@ -794,6 +800,8 @@ clearRect(x: number, y: number, w: number, h: number): void 删除指定区域内的绘制内容。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -843,6 +851,8 @@ fillText(text: string, x: number, y: number, maxWidth?: number): void 绘制填充类文本。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 说明 | @@ -891,6 +901,8 @@ strokeText(text: string, x: number, y: number): void 绘制描边类文本。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -939,6 +951,8 @@ measureText(text: string): TextMetrics 该方法返回一个文本测算的对象,通过该对象可以获取指定文本的宽度值。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 说明 | @@ -947,9 +961,9 @@ measureText(text: string): TextMetrics **返回值:** -| 类型 | 说明 | -| ----------- | ------- | -| TextMetrics | 文本的尺寸信息 | +| 类型 | 说明 | +| ----------- | ------------------------------------------------------------ | +| TextMetrics | 文本的尺寸信息
从API version 9开始,该接口支持在ArkTS卡片中使用。 | **TextMetrics类型描述:** @@ -1009,6 +1023,8 @@ stroke(path?: Path2D): void 进行边框绘制操作。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -1058,6 +1074,8 @@ beginPath(): void 创建一个新的绘制路径。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **示例:** ```ts @@ -1101,6 +1119,8 @@ moveTo(x: number, y: number): void 路径从当前点移动到指定点。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 说明 | @@ -1149,6 +1169,8 @@ lineTo(x: number, y: number): void 从当前点到指定点进行路径连接。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -1197,6 +1219,8 @@ closePath(): void 结束当前路径形成一个封闭路径。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **示例:** ```ts @@ -1240,12 +1264,14 @@ createPattern(image: ImageBitmap, repetition: string | null): CanvasPattern | nu 通过指定图像和重复方式创建图片填充的模板。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | | ---------- | ---------------------------------------- | ---- | ---- | ---------------------------------------- | | image | [ImageBitmap](ts-components-canvas-imagebitmap.md) | 是 | null | 图源对象,具体参考ImageBitmap对象。 | -| repetition | string | 是 | “” | 设置图像重复的方式,取值为:'repeat'、'repeat-x'、 'repeat-y'、'no-repeat'。 | +| repetition | string | 是 | “” | 设置图像重复的方式,取值为:'repeat'、'repeat-x'、 'repeat-y'、'no-repeat'、'clamp'、'mirror'。 | **返回值:** @@ -1294,6 +1320,8 @@ bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, 创建三次贝赛尔曲线的路径。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -1346,6 +1374,8 @@ quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void 创建二次贝赛尔曲线的路径。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -1396,6 +1426,8 @@ arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, 绘制弧线路径。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -1447,6 +1479,8 @@ arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void 依据圆弧经过的点和圆弧半径创建圆弧路径。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -1497,6 +1531,8 @@ ellipse(x: number, y: number, radiusX: number, radiusY: number, rotation: number 在规定的矩形区域绘制一个椭圆。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 说明 | @@ -1549,6 +1585,8 @@ rect(x: number, y: number, w: number, h: number): void 创建矩形路径。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -1597,6 +1635,8 @@ fill(fillRule?: CanvasFillRule): void 对封闭路径进行填充。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -1638,6 +1678,8 @@ fill(path: Path2D, fillRule?: CanvasFillRule): void 对封闭路径进行填充。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -1695,6 +1737,8 @@ clip(fillRule?: CanvasFillRule): void 设置当前路径为剪切路径。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -1741,6 +1785,8 @@ clip(path:Path2D, fillRule?: CanvasFillRule): void 设置封闭路径为剪切路径。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -1752,39 +1798,39 @@ clip(path:Path2D, fillRule?: CanvasFillRule): void ```ts // xxx.ets -@Entry -@Component -struct Clip { - private settings: RenderingContextSettings = new RenderingContextSettings(true) - private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) - private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings) + @Entry + @Component + struct Clip { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings) - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Canvas(this.context) - .width('100%') - .height('100%') - .backgroundColor('#ffff00') - .onReady(() =>{ - let region = new Path2D() - region.moveTo(30, 90) - region.lineTo(110, 20) - region.lineTo(240, 130) - region.lineTo(60, 130) - region.lineTo(190, 20) - region.lineTo(270, 90) - region.closePath() - this.offContext.clip(region,"evenodd") - this.offContext.fillStyle = "rgb(0,255,0)" - this.offContext.fillRect(0, 0, 600, 600) - var image = this.offContext.transferToImageBitmap() - this.context.transferFromImageBitmap(image) - }) + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Canvas(this.context) + .width('100%') + .height('100%') + .backgroundColor('#ffff00') + .onReady(() =>{ + let region = new Path2D() + region.moveTo(30, 90) + region.lineTo(110, 20) + region.lineTo(240, 130) + region.lineTo(60, 130) + region.lineTo(190, 20) + region.lineTo(270, 90) + region.closePath() + this.offContext.clip(region,"evenodd") + this.offContext.fillStyle = "rgb(0,255,0)" + this.offContext.fillRect(0, 0, 600, 600) + var image = this.offContext.transferToImageBitmap() + this.context.transferFromImageBitmap(image) + }) + } + .width('100%') + .height('100%') } - .width('100%') - .height('100%') } -} ``` ![zh-cn_image_000000127777779](figures/zh-cn_image_000000127777779.png) @@ -1797,6 +1843,8 @@ filter(filter: string): void 为Canvas图形设置各类滤镜效果。该接口为空接口。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 说明 | @@ -1810,6 +1858,8 @@ getTransform(): Matrix2D 获取当前被应用到上下文的转换矩阵。该接口为空接口。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + ### resetTransform @@ -1817,6 +1867,8 @@ resetTransform(): void 使用单位矩阵重新设置当前变形。该接口为空接口。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + ### direction @@ -1824,6 +1876,8 @@ direction(direction: CanvasDirection): void 绘制文本时,描述当前文本方向的属性。该接口为空接口。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + ### rotate @@ -1831,6 +1885,8 @@ rotate(angle: number): void 针对当前坐标轴进行顺时针旋转。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -1876,6 +1932,8 @@ scale(x: number, y: number): void 设置canvas画布的缩放变换属性,后续的绘制操作将按照缩放比例进行缩放。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -1924,6 +1982,8 @@ transform(a: number, b: number, c: number, d: number, e: number, f: number): voi transform方法对应一个变换矩阵,想对一个图形进行变化的时候,只要设置此变换矩阵相应的参数,对图形的各个定点的坐标分别乘以这个矩阵,就能得到新的定点的坐标。矩阵变换效果可叠加。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + > **说明:** > 变换后的坐标计算方式(x和y为变换前坐标,x'和y'为变换后坐标): > @@ -1987,6 +2047,8 @@ setTransform(a: number, b: number, c: number, d: number, e: number, f: number): setTransform方法使用的参数和transform()方法相同,但setTransform()方法会重置现有的变换矩阵并创建新的变换矩阵。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -2040,6 +2102,8 @@ translate(x: number, y: number): void 移动当前坐标系的原点。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -2091,6 +2155,8 @@ drawImage(image: ImageBitmap | PixelMap, sx: number, sy: number, sw: number, sh: 进行图像绘制。 +从API version 9开始,该接口支持在ArkTS卡片中使用,卡片中不支持PixelMap对象。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -2144,6 +2210,8 @@ createImageData(sw: number, sh: number): ImageData 根据宽高创建ImageData对象,请参考[ImageData](ts-components-canvas-imagedata.md)。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认 | 描述 | @@ -2156,6 +2224,8 @@ createImageData(imageData: ImageData): ImageData 根据已创建的ImageData对象创建新的ImageData对象,请参考[ImageData](ts-components-canvas-imagedata.md)。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认 | 描述 | @@ -2189,6 +2259,27 @@ getPixelMap(sx: number, sy: number, sw: number, sh: number): PixelMap | ---------------------------------------- | ------------ | | [PixelMap](../apis/js-apis-image.md#pixelmap7) | 新的PixelMap对象 | +### setPixelMap + +setPixelMap(value?: PixelMap): void + +将当前传入[PixelMap](../apis/js-apis-image.md#pixelmap7)对象绘制在画布上。 + + **参数:** + +| 参数 | 类型 | 必填 | 默认值 | 描述 | +| ---- | ------ | ---- | ---- | --------------- | +| sx | number | 是 | 0 | 需要输出的区域的左上角x坐标。 | +| sy | number | 是 | 0 | 需要输出的区域的左上角y坐标。 | +| sw | number | 是 | 0 | 需要输出的区域的宽度。 | +| sh | number | 是 | 0 | 需要输出的区域的高度。 | + +**返回值:** + +| 类型 | 说明 | +| ---------------------------------------- | ------------ | +| [PixelMap](../apis/js-apis-image.md#pixelmap7) | 新的PixelMap对象 | + ### getImageData @@ -2196,6 +2287,8 @@ getImageData(sx: number, sy: number, sw: number, sh: number): ImageData 以当前canvas指定区域内的像素创建[ImageData](ts-components-canvas-imagedata.md)对象。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -2216,32 +2309,32 @@ getImageData(sx: number, sy: number, sw: number, sh: number): ImageData ```ts // xxx.ets -@Entry -@Component -struct GetImageData { - private settings: RenderingContextSettings = new RenderingContextSettings(true) - private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) - private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings) - private img:ImageBitmap = new ImageBitmap("/common/images/1234.png") + @Entry + @Component + struct GetImageData { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings) + private img:ImageBitmap = new ImageBitmap("/common/images/1234.png") - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Canvas(this.context) - .width('100%') - .height('100%') - .backgroundColor('#ffff00') - .onReady(() =>{ - this.offContext.drawImage(this.img,0,0,130,130) - var imagedata = this.offContext.getImageData(50,50,130,130) - this.offContext.putImageData(imagedata,150,150) - var image = this.offContext.transferToImageBitmap() - this.context.transferFromImageBitmap(image) - }) + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Canvas(this.context) + .width('100%') + .height('100%') + .backgroundColor('#ffff00') + .onReady(() =>{ + this.offContext.drawImage(this.img,0,0,130,130) + var imagedata = this.offContext.getImageData(50,50,130,130) + this.offContext.putImageData(imagedata,150,150) + var image = this.offContext.transferToImageBitmap() + this.context.transferFromImageBitmap(image) + }) + } + .width('100%') + .height('100%') } - .width('100%') - .height('100%') } -} ``` ![zh-cn_image_000000127777780](figures/zh-cn_image_000000127777780.png) @@ -2255,6 +2348,8 @@ putImageData(imageData: Object, dx: number, dy: number, dirtyX: number, dirtyY: 使用[ImageData](ts-components-canvas-imagedata.md)数据填充新的矩形区域。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -2310,6 +2405,8 @@ setLineDash(segments: number[]): void 设置画布的虚线样式。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 描述 | @@ -2319,31 +2416,31 @@ setLineDash(segments: number[]): void **示例:** ```ts -@Entry -@Component -struct SetLineDash { - private settings: RenderingContextSettings = new RenderingContextSettings(true) - private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) - private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings) - - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Canvas(this.context) - .width('100%') - .height('100%') - .backgroundColor('#ffff00') - .onReady(() =>{ - this.offContext.arc(100, 75, 50, 0, 6.28) - this.offContext.setLineDash([10,20]) - this.offContext.stroke() - var image = this.offContext.transferToImageBitmap() - this.context.transferFromImageBitmap(image) - }) + @Entry + @Component + struct SetLineDash { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings) + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Canvas(this.context) + .width('100%') + .height('100%') + .backgroundColor('#ffff00') + .onReady(() =>{ + this.offContext.arc(100, 75, 50, 0, 6.28) + this.offContext.setLineDash([10,20]) + this.offContext.stroke() + var image = this.offContext.transferToImageBitmap() + this.context.transferFromImageBitmap(image) + }) + } + .width('100%') + .height('100%') } - .width('100%') - .height('100%') } -} ``` ![zh-cn_image_000000127777772](figures/zh-cn_image_000000127777772.png) @@ -2354,6 +2451,8 @@ getLineDash(): number[] 获得当前画布的虚线样式。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **返回值:** | 类型 | 说明 | @@ -2364,42 +2463,42 @@ getLineDash(): number[] ```ts // xxx.ets -@Entry -@Component -struct OffscreenCanvasGetLineDash { - @State message: string = 'Hello World' - private settings: RenderingContextSettings = new RenderingContextSettings(true) - private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) - private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings) - build() { - Row() { - Column() { - Text(this.message) - .fontSize(50) - .fontWeight(FontWeight.Bold) - .onClick(()=>{ - console.error('before getlinedash clicked') - let res = this.offContext.getLineDash() - console.error(JSON.stringify(res)) - }) - Canvas(this.context) - .width('100%') - .height('100%') - .backgroundColor('#ffff00') - .onReady(() => { - this.offContext.arc(100, 75, 50, 0, 6.28) - this.offContext.setLineDash([10,20]) - this.offContext.stroke() - let res = this.offContext.getLineDash() - var image = this.offContext.transferToImageBitmap() - this.context.transferFromImageBitmap(image) - }) + @Entry + @Component + struct OffscreenCanvasGetLineDash { + @State message: string = 'Hello World' + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings) + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + .onClick(()=>{ + console.error('before getlinedash clicked') + let res = this.offContext.getLineDash() + console.error(JSON.stringify(res)) + }) + Canvas(this.context) + .width('100%') + .height('100%') + .backgroundColor('#ffff00') + .onReady(() => { + this.offContext.arc(100, 75, 50, 0, 6.28) + this.offContext.setLineDash([10,20]) + this.offContext.stroke() + let res = this.offContext.getLineDash() + var image = this.offContext.transferToImageBitmap() + this.context.transferFromImageBitmap(image) + }) + } + .width('100%') } - .width('100%') + .height('100%') } - .height('100%') } -} ``` ![zh-cn_image_000000127777778](figures/zh-cn_image_000000127777778.png) @@ -2411,6 +2510,8 @@ toDataURL(type?: string, quality?: number): string 生成一个包含图片展示的URL。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数名 | 参数类型 | 必填 | 描述 | @@ -2427,28 +2528,28 @@ toDataURL(type?: string, quality?: number): string **示例:** ```ts -// xxx.ets -@Entry -@Component -struct ToDataURL { - private settings: RenderingContextSettings = new RenderingContextSettings(true) - private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) - private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings) + // xxx.ets + @Entry + @Component + struct ToDataURL { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings) - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Canvas(this.context) - .width('100%') - .height('100%') - .backgroundColor('#ffff00') - .onReady(() =>{ - var dataURL = this.offContext.toDataURL() - }) + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Canvas(this.context) + .width('100%') + .height('100%') + .backgroundColor('#ffff00') + .onReady(() =>{ + var dataURL = this.offContext.toDataURL() + }) + } + .width('100%') + .height('100%') } - .width('100%') - .height('100%') } -} ``` @@ -2458,6 +2559,8 @@ imageSmoothingQuality(quality: imageSmoothingQuality) 用于设置图像平滑度。该接口为空接口。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 描述 | @@ -2521,37 +2624,39 @@ restore(): void 对保存的绘图上下文进行恢复。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **示例:** ```ts // xxx.ets -@Entry -@Component -struct CanvasExample { - private settings: RenderingContextSettings = new RenderingContextSettings(true) - private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) - private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings) - - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Canvas(this.context) - .width('100%') - .height('100%') - .backgroundColor('#ffff00') - .onReady(() =>{ - this.offContext.save() // save the default state - this.offContext.fillStyle = "#00ff00" - this.offContext.fillRect(20, 20, 100, 100) - this.offContext.restore() // restore to the default state - this.offContext.fillRect(150, 75, 100, 100) - var image = this.offContext.transferToImageBitmap() - this.context.transferFromImageBitmap(image) - }) + @Entry + @Component + struct CanvasExample { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings) + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Canvas(this.context) + .width('100%') + .height('100%') + .backgroundColor('#ffff00') + .onReady(() =>{ + this.offContext.save() // save the default state + this.offContext.fillStyle = "#00ff00" + this.offContext.fillRect(20, 20, 100, 100) + this.offContext.restore() // restore to the default state + this.offContext.fillRect(150, 75, 100, 100) + var image = this.offContext.transferToImageBitmap() + this.context.transferFromImageBitmap(image) + }) + } + .width('100%') + .height('100%') } - .width('100%') - .height('100%') } -} ``` ![zh-cn_image_000000127777781](figures/zh-cn_image_000000127777781.png) @@ -2562,37 +2667,39 @@ save(): void 对当前的绘图上下文进行保存。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **示例:** ```ts // xxx.ets -@Entry -@Component -struct CanvasExample { - private settings: RenderingContextSettings = new RenderingContextSettings(true) - private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) - private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings) - - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Canvas(this.context) - .width('100%') - .height('100%') - .backgroundColor('#ffff00') - .onReady(() =>{ - this.offContext.save() // save the default state - this.offContext.fillStyle = "#00ff00" - this.offContext.fillRect(20, 20, 100, 100) - this.offContext.restore() // restore to the default state - this.offContext.fillRect(150, 75, 100, 100) - var image = this.offContext.transferToImageBitmap() - this.context.transferFromImageBitmap(image) - }) + @Entry + @Component + struct CanvasExample { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings) + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Canvas(this.context) + .width('100%') + .height('100%') + .backgroundColor('#ffff00') + .onReady(() =>{ + this.offContext.save() // save the default state + this.offContext.fillStyle = "#00ff00" + this.offContext.fillRect(20, 20, 100, 100) + this.offContext.restore() // restore to the default state + this.offContext.fillRect(150, 75, 100, 100) + var image = this.offContext.transferToImageBitmap() + this.context.transferFromImageBitmap(image) + }) + } + .width('100%') + .height('100%') } - .width('100%') - .height('100%') } -} ``` ![zh-cn_image_000000127777781](figures/zh-cn_image_000000127777781.png) @@ -2603,6 +2710,8 @@ createLinearGradient(x0: number, y0: number, x1: number, y1: number): void 创建一个线性渐变色。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -2635,7 +2744,7 @@ createLinearGradient(x0: number, y0: number, x1: number, y1: number): void grad.addColorStop(0.5, '#ffffff') grad.addColorStop(1.0, '#00ff00') this.offContext.fillStyle = grad - this.offContext.fillRect(0, 0, 500, 500) + this.offContext.fillRect(0, 0, 400, 400) var image = this.offContext.transferToImageBitmap() this.context.transferFromImageBitmap(image) }) @@ -2655,6 +2764,8 @@ createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, 创建一个径向渐变色。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + **参数:** | 参数 | 类型 | 必填 | 默认值 | 描述 | @@ -2689,7 +2800,7 @@ createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, grad.addColorStop(0.5, '#ffffff') grad.addColorStop(1.0, '#00ff00') this.offContext.fillStyle = grad - this.offContext.fillRect(0, 0, 500, 500) + this.offContext.fillRect(0, 0, 440, 440) var image = this.offContext.transferToImageBitmap() this.context.transferFromImageBitmap(image) }) @@ -2702,7 +2813,59 @@ createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, ![zh-cn_image_0000001238952407](figures/zh-cn_image_0000001238952407.png) +### createConicGradient10+ + +createConicGradient(startAngle: number, x: number, y: number): CanvasGradient + +创建一个圆锥渐变色。 + +**参数:** + +| 参数 | 类型 | 必填 | 默认值 | 描述 | +| ---------- | ------ | ---- | ------ | ------------------------------------------------------------ | +| startAngle | number | 是 | 0 | 开始渐变的角度,以弧度为单位。角度测量从中心右侧水平开始,顺时针移动。 | +| x | number | 是 | 0 | 圆锥渐变的中心x轴坐标。单位:vp | +| y | number | 是 | 0 | 圆锥渐变的中心y轴坐标。单位:vp | + +**示例:** + +```ts +// xxx.ets +@Entry +@Component +struct OffscreenCanvasConicGradientPage { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + + private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings) + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Canvas(this.context) + .width('100%') + .height('100%') + .backgroundColor('#ffffff') + .onReady(() =>{ + var grad = this.offContext.createConicGradient(0, 50, 80) + grad.addColorStop(0.0, '#ff0000') + grad.addColorStop(0.5, '#ffffff') + grad.addColorStop(1.0, '#00ff00') + this.offContext.fillStyle = grad + this.offContext.fillRect(0, 30, 100, 100) + var image = this.offContext.transferToImageBitmap() + this.context.transferFromImageBitmap(image) + }) + } + .width('100%') + .height('100%') + } +} +``` + + ![zh-cn_image_0000001239032419](figures/zh-cn_image_0000001239032420.png) ## CanvasPattern 一个Object对象, 通过[createPattern](#createpattern)方法创建。 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-page-transition-animation.md b/zh-cn/application-dev/reference/arkui-ts/ts-page-transition-animation.md index f2331b28049e098d21a064f5f75519e69e9d1075..a9d7d861eb286acef5bfe4c2efc1563a41ae9d1c 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-page-transition-animation.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-page-transition-animation.md @@ -1,6 +1,6 @@ # 页面间转场 -在全局pageTransition方法内配置页面入场和页面退场时的自定义转场动效。 +当路由进行切换时,可以通过 在pageTransition中自定义页面入场和页面退场的转场动效。 > **说明:** > @@ -8,10 +8,10 @@ > -| 名称 | 参数 | 参数描述 | -| ------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | -| PageTransitionEnter | {
type?: RouteType,
duration?: number,
curve?: [Curve](ts-appendix-enums.md#curve) \| string,
delay?: number
} | 设置当前页面的自定义入场动效。
- type:页面转场效果生效的路由类型。
默认值:RouteType.None。
**说明:** 没有匹配时使用系统默认的页面转场效果(根据设备可能会有差异),如需禁用系统默认页面转场效果,可以指定duration为0。
- duration:动画的时长,单位为毫秒。
- curve:动画曲线。string类型的取值支持"ease"、"ease-in"、"ease-out"、"ease-in-out"、"extreme-deceleration"、"fast-out-linear-in"、"fast-out-slow-in"、"friction"、"linear"、"linear-out-slow-in"、"rhythm"、"sharp"、"smooth"。
默认值:Curve.Linear
- delay:动画延迟时长,单位为毫秒,默认不延迟播放。 | -| PageTransitionExit | {
type?: RouteType,
duration?: number,
curve?: [Curve](ts-appendix-enums.md#curve) \| string,
delay?: number
} | 设置当前页面的自定义退场动效。
- type:页面转场效果生效的路由类型。
默认值:RouteType.None。
**说明:** 没有匹配时使用系统默认的页面转场效果(根据设备可能会有差异),如需禁用系统默认页面转场效果,可以指定duration为0。
- duration:动画的时长,单位为毫秒。
- curve:动画曲线,string类型取值与PageTransitionEnter相同。
 默认值:Curve.Linear
- delay:动画延迟时长,单位为毫秒,默认不延迟播放。 | +| 名称 | 参数 | 必填 | 参数描述 | +| ------------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ | +| PageTransitionEnter | {
type?: RouteType,
duration?: number,
curve?: [Curve](ts-appendix-enums.md#curve) \| string,
delay?: number
} | 否 | 设置当前页面的自定义入场动效。
- type:页面转场效果生效的路由类型。
默认值:RouteType.None。
**说明:**
没有匹配时使用系统默认的页面转场效果(根据设备可能会有差异),如需禁用系统默认页面转场效果,可以指定duration为0。
- duration:动画的时长
单位:毫秒
- curve:动画曲线。string类型的取值支持"ease"、"ease-in"、"ease-out"、"ease-in-out"、"extreme-deceleration"、"fast-out-linear-in"、"fast-out-slow-in"、"friction"、"linear"、"linear-out-slow-in"、"rhythm"、"sharp"、"smooth"。
默认值:Curve.Linear
- delay:动画延迟时长。
默认值:0
单位:毫秒 | +| PageTransitionExit | {
type?: RouteType,
duration?: number,
curve?: [Curve](ts-appendix-enums.md#curve) \| string,
delay?: number
} | 否 | 设置当前页面的自定义退场动效。
- type:页面转场效果生效的路由类型。
默认值:RouteType.None。
**说明:**
没有匹配时使用系统默认的页面转场效果(根据设备可能会有差异),如需禁用系统默认页面转场效果,可以指定duration为0。
- duration:动画的时长,单位为毫秒。
- curve:动画曲线,string类型取值与PageTransitionEnter相同。
 默认值:Curve.Linear
- delay:动画延迟时长。
默认值:0
单位:毫秒 | ## RouteType枚举说明 @@ -45,8 +45,8 @@ | 事件 | 功能描述 | | ------------------------------------------------------------ | ------------------------------------------------------------ | -| onEnter(event: (type?: RouteType, progress?: number) => void) | 回调入参为当前入场动画的归一化进度[0 - 1]。
- type:跳转方法。
- progress:当前进度。 | -| onExit(event: (type?: RouteType, progress?: number) => void) | 回调入参为当前退场动画的归一化进度[0 - 1]。
- type:跳转方法。
- progress:当前进度。 | +| onEnter(event: (type?: RouteType, progress?: number) => void) | 回调入参为当前入场动画的归一化进度[0 - 1]。
- type:跳转方法。
- progress:当前进度。
触发该事件的条件:
逐帧回调,直到入场动画结束,progress从0变化到1。 | +| onExit(event: (type?: RouteType, progress?: number) => void) | 回调入参为当前退场动画的归一化进度[0 - 1]。
- type:跳转方法。
- progress:当前进度。
触发该事件的条件:
逐帧回调,直到退场动画结束,progress从0变化到1。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-pixel-units.md b/zh-cn/application-dev/reference/arkui-ts/ts-pixel-units.md index 654b88ab931a8adbfd3f66d67f09ab33e145e817..d2de0f74094efb91025691580bef33c1e9e954b8 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-pixel-units.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-pixel-units.md @@ -15,14 +15,14 @@ 提供其他单位与px单位互相转换的方法。 -| 接口 | 描述 | -| ---------------------------------------- | ---------------------- | -| vp2px(value : number) : number | 将vp单位的数值转换为以px为单位的数值。 | -| px2vp(value : number) : number | 将px单位的数值转换为以vp为单位的数值。 | -| fp2px(value : number) : number | 将fp单位的数值转换为以px为单位的数值。 | -| px2fp(value : number) : number | 将px单位的数值转换为以fp为单位的数值。 | -| lpx2px(value : number) : number | 将lpx单位的数值转换为以px为单位的数值。 | -| px2lpx(value : number) : number | 将px单位的数值转换为以lpx为单位的数值。 | +| 接口 | 描述 | +| --------------------------------------------------- | ------------------------------------------------------------ | +| vp2px(value : number) : number | 将vp单位的数值转换为以px为单位的数值。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| px2vp(value : number) : number | 将px单位的数值转换为以vp为单位的数值。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| fp2px(value : number) : number | 将fp单位的数值转换为以px为单位的数值。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| px2fp(value : number) : number | 将px单位的数值转换为以fp为单位的数值。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| lpx2px(value : number) : number | 将lpx单位的数值转换为以px为单位的数值。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| px2lpx(value : number) : number | 将px单位的数值转换为以lpx为单位的数值。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-state-management.md b/zh-cn/application-dev/reference/arkui-ts/ts-state-management.md index d83c8cffbdd9cc1f05d62075d0a0b10be4481dcd..d097a205da899a01cdeee8b1a914211c6dc42a7f 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-state-management.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-state-management.md @@ -1,238 +1,294 @@ # 应用级变量的状态管理 -状态管理模块提供了应用程序的数据存储能力、持久化数据管理能力、Ability数据存储能力和应用程序需要的环境状态。 -> **说明:** +状态管理模块提供了应用程序的数据存储能力、持久化数据管理能力、UIAbility数据存储能力和应用程序需要的环境状态。 + + +>**说明:** > -> 本模块首批接口从API version 7开始支持,后续版本的新增接口,采用上角标单独标记接口的起始版本。 +>本模块首批接口从API version 7开始支持,后续版本的新增接口,采用上角标单独标记接口的起始版本。 + + +本文中T和S的含义如下: + + +| 类型 | 描述 | +| ---- | -------------------------------------- | +| T | Class,number,boolean,string和这些类型的数组形式。 | +| S | number,boolean,string。 | + ## AppStorage + ### Link -Link(propName: string): any +static Link(propName: string): any + +与AppStorage中对应的propName建立双向数据绑定。如果给定的propName在AppStorage中存在,返回与AppStorage中propName对应属性的双向绑定数据。 + +双向绑定数据的修改会同步回AppStorage中,AppStorage会将变化同步到所有绑定该propName的数据和自定义组件中。 -与localStorage双向数据绑定。 +如果AppStorage中不存在propName,则返回undefined。 **参数:** -| 参数名 | 类型 | 必填 | 参数描述 | -| -------- | ------ | ---- | ----------- | -| propName | string | 是 | 要双向绑定的属性名称。 | +| 参数名 | 类型 | 必填 | 参数描述 | +| -------- | ------ | ---- | ---------------- | +| propName | string | 是 | AppStorage中的属性名。 | **返回值:** -| 类型 | 描述 | -| ----- | ---------------------------------------- | -| @Link | 在具有给定键的数据,则返回到此属性的双向数据绑定,该双向绑定意味着变量或者组件对数据的更改将同步到AppStorage,通过AppStorage对数据的修改将同步到变量或者组件。 | +| 类型 | 描述 | +| ---- | ---------------------------------------- | +| any | 返回双向绑定的数据,如果AppStorage不存在对应的propName,在返回undefined。 | + ```ts -let simple = AppStorage.Link('simpleProp') +AppStorage.SetOrCreate('PropA', 47); +let linkToPropA1 = AppStorage.Link('PropA'); +let linkToPropA2 = AppStorage.Link('PropA'); // linkToPropA2.get() == 47 +linkToPropA1.set(48); // 双向同步: linkToPropA1.get() == linkToPropA2.get() == 48 ``` + ### SetAndLink -SetAndLink\(propName: string, defaultValue: T): SubscribedAbstractProperty\ +static SetAndLink<T>(propName: string, defaultValue: T): SubscribedAbstractProperty<T> -与Link接口类似,如果当前的key保存于AppStorage,则返回该key对应的value。如果该key未被创建,则创建一个对应default值的Link返回。 +与Link接口类似,如果给定的propName在AppStorage中存在,则返回该propName对应的属性的双向绑定数据。如果不存在,则使用defaultValue在AppStorage创建和初始化propName,返回其双向绑定数据。 **参数:** -| 参数名 | 类型 | 必填 | 参数描述 | -| ------------ | ------ | ---- | ----------- | -| propName | string | 是 | 要进行创建的key值。 | -| defaultValue | T | 是 | 要进行设置的默认值。 | +| 参数名 | 类型 | 必填 | 参数描述 | +| ------------ | ------ | ---- | ---------------------------------------- | +| propName | string | 是 | AppStorage中的属性名。 | +| defaultValue | T | 是 | 当propName在AppStorage中不存在,使用defaultValue在AppStorage中初始化对应的propName。 | **返回值:** -| 类型 | 描述 | -| ----- | ---------------------------------------- | -| @Link | 与Link接口类似,如果当前的key保存于AppStorage,返回该key值对应的value值。如果该key值未被创建,则创建一个对应的defaultValue的Link返回。 | +| 类型 | 描述 | +| ----------------------------------- | ---------------------------------------- | +| SubscribedAbstractProperty<T> | SubscribedAbstractProperty<T>的实例,和AppStorage中propName对应属性的双向绑定的数据。 | + ```ts -let simple = AppStorage.SetAndLink('simpleProp', 121) +AppStorage.SetOrCreate('PropA', 47); +let link1: SubscribedAbstractProperty = AppStorage.SetAndLink('PropB', 49); // Create PropB 49 +let link2: SubscribedAbstractProperty = AppStorage.SetAndLink('PropA', 50); // PropA exists, remains 47 ``` + ### Prop -Prop(propName: string): any +static Prop(propName: string): any -单向属性绑定的一种。更新组件的状态。。 +与AppStorage中对应的propName建立单向属性绑定。如果给定的propName在AppStorage中存在,则返回与AppStorage中propName对应属性的单向绑定数据。如果AppStorage中不存在propName,则返回undefined。单向绑定数据的修改不会被同步回AppStorage中。 + +>**说明:** +> Prop仅支持简单类型。 **参数:** -| 参数名 | 类型 | 必填 | 参数描述 | -| -------- | ------ | ---- | ----------- | -| propName | string | 是 | 要进行创建的key值。 | +| 参数名 | 类型 | 必填 | 参数描述 | +| -------- | ------ | ---- | ---------------- | +| propName | string | 是 | AppStorage中的属性名。 | **返回值:** -| 类型 | 描述 | -| ----- | ---------------------------------------- | -| @Prop | 如果存在具有给定键的属性,则返回此属性的单向数据绑定。该单向绑定意味着只能通过AppStorage将属性的更改同步到变量或者组件。该方法返回的变量为不可变变量,适用于可变和不可变的状态属性,如果具有此键的属性不存在则返回undefined。 | +| 类型 | 描述 | +| ---- | ---------------------------------------- | +| any | 返回单向绑定的数据,如果AppStorage不存在对应的propName,在返回undefined。 | + ```ts -let simple = AppStorage.Prop('simpleProp') +AppStorage.SetOrCreate('PropA', 47); +let prop1 = AppStorage.Prop('PropA'); +let prop2 = AppStorage.Prop('PropA'); +prop1.set(1); // one-way sync: prop1.get()=1; but prop2.get() == 47 ``` + ### SetAndProp -SetAndProp\(propName: string, defaultValue: S): SubscribedAbstractProperty\ +static SetAndProp<S>(propName: string, defaultValue: S): SubscribedAbstractProperty<S> -与Prop接口类似,如果当前的key保存于AppStorage,则返回该key对应的value。如果该key未被创建,则创建一个对应default值的Prop返回。 +与Prop接口类似。如果给定的propName在AppStorage存在,则返回该propName对应的属性的单向绑定数据。如果不存在,则使用defaultValue在AppStorage创建和初始化propName对应的属性,返回其单向绑定数据。 **参数:** -| 参数名 | 类型 | 必填 | 参数描述 | -| ------------ | ------ | ---- | --------------- | -| propName | string | 是 | 要保存的的键值对中的key值。 | -| defaultValue | S | 是 | 创建的默认值。 | +| 参数名 | 类型 | 必填 | 参数描述 | +| ------------ | ------ | ---- | ---------------------------------------- | +| propName | string | 是 | AppStorage中的属性名。 | +| defaultValue | S | 是 | 当propName在AppStorage中不存在时,使用default在AppStorage中初始化对应的propName。 | **返回值:** -| 类型 | 描述 | -| ----- | ---------------------------------------- | -| @Prop | 如果当前的key保存与AppStorage,返回该key值对应的value值。如果该key值未被创建,则创建一个对应的defaultValue的Prop返回。 | +| 类型 | 描述 | +| ----------------------------------- | --------------------------------------- | +| SubscribedAbstractProperty<S> | SubscribedAbstractProperty<S>的实例。 | + ```ts -let simple = AppStorage.SetAndProp('simpleProp', 121) +AppStorage.SetOrCreate('PropA', 47); +let prop: SubscribedAbstractProperty = AppStorage.SetAndProp('PropB', 49); // PropA -> 47, PropB -> 49 ``` + ### Has -Has(propName: string): boolean +static Has(propName: string): boolean -判断对应键值的属性是否存在。 +判断propName对应的属性是否在AppStorage中存在。 **参数:** -| 参数名 | 类型 | 必填 | 参数描述 | -| -------- | ------ | ---- | ------- | -| propName | string | 是 | 属性的属性值。 | +| 参数名 | 类型 | 必填 | 参数描述 | +| -------- | ------ | ---- | ---------------- | +| propName | string | 是 | AppStorage中的属性名。 | **返回值:** -| 类型 | 描述 | -| ------- | ------------- | -| boolean | 返回属性的属性值是否存在。 | +| 类型 | 描述 | +| ------- | ---------------------------------------- | +| boolean | 如果propName对应的属性在AppStorage中存在,则返回true。不存在则返回false。 | + ```ts -let simple = AppStorage.Has('simpleProp') +AppStorage.Has('simpleProp'); ``` + ### Get -Get\(propName: string): T | undefined +static Get<T>(propName: string): T | undefined -通过此接口获取对应key值的value。 +获取propName在AppStorage中对应的属性。如果不存在返回undefined。 **参数:** -| 参数名 | 类型 | 必填 | 参数描述 | -| -------- | ------ | ---- | ----------- | -| propName | string | 是 | 要获取对应的key值。 | +| 参数名 | 类型 | 必填 | 参数描述 | +| -------- | ------ | ---- | ---------------- | +| propName | string | 是 | AppStorage中的属性名。 | **返回值:** -| 类型 | 描述 | -| ----------------- | ------------- | -| T或undefined | 属性存在返回属性值,属性不存在返回undefined。 | +| 类型 | 描述 | +| ------------------------ | ---------------------------------------- | +| T \| undefined | AppStorage中propName对应的属性,如果不存在返回undefined。 | + ```ts -let simple = AppStorage.Get('simpleProp') +AppStorage.SetOrCreate('PropA', 47); +let value: number = AppStorage.Get('PropA'); // 47 ``` + ### Set -Set\(propName: string, newValue: T): boolean +static Set<T>(propName: string, newValue: T): boolean -对已保存的key值,替换其value值。 +在AppStorage中设置propName对应属性的值。 **参数:** -| 参数名 | 类型 | 必填 | 参数描述 | -| -------- | ------ | ---- | ----------- | -| propName | string | 是 | 要设置的key值。 | -| newValue | T | 是 | 要设置的value值。 | +| 参数名 | 类型 | 必填 | 参数描述 | +| -------- | ------ | ---- | ---------------------- | +| propName | string | 是 | AppStorage中的属性名。 | +| newValue | T | 是 | 属性值,不能为undefined或null。 | **返回值:** -| 类型 | 描述 | -| ------- | ----------------------------------- | -| boolean | 如果存在key值,设置value值并返回true,否则返回false。 | +| 类型 | 描述 | +| ------- | ---------------------------------------- | +| boolean | 如果AppStorage不存在propName对应的属性,或者设置的newValue是undefined或者null,返回false。设置成功则返回true。 | + ```ts -let simple = AppStorage.Set('simpleProp', 121) +AppStorage.SetOrCreate('PropA', 48); +let res: boolean = AppStorage.Set('PropA', 47) // true +let res1: boolean = AppStorage.Set('PropB', 47) // false ``` + ### SetOrCreate -SetOrCreate\(propName: string, newValue: T): void +static SetOrCreate<T>(propName: string, newValue: T): void -创建或更新setOrCreate内部的值。 +propName如果已经在AppStorage中存在,则设置propName对应是属性的值为newValue。如果不存在,则创建propName属性,值为newValue。 **参数:** -| 参数名 | 类型 | 必填 | 参数描述 | -| -------- | ------ | ---- | --------------- | -| propName | string | 是 | 要更新或者创建的key值。 | -| newValue | T | 是 | 要更新或者创建的value值。 | - -**返回值:** +| 参数名 | 类型 | 必填 | 参数描述 | +| -------- | ------ | ---- | ---------------------- | +| propName | string | 是 | AppStorage中的属性名。 | +| newValue | T | 是 | 属性值,不能为undefined或null。 | -| 类型 | 描述 | -| ------- | ---------------------------------------- | -| boolean | 如果已存在与给定键名字相同的属性,更新其值且返回true。如果不存在具有给定名称的属性,在AppStorage中创建具有给定默认值的新属性,默认值必须是T类型。不允许undefined 或 null 返回true。 | ```ts -let simple = AppStorage.SetOrCreate('simpleProp', 121) +AppStorage.SetOrCreate('simpleProp', 121); ``` + ### Delete -Delete(propName: string): boolean +static Delete(propName: string): boolean + +在AppStorage中删除propName对应的属性。 + +在AppStorage中删除该属性的前提是必须保证该属性没有订阅者。如果有订阅者,则返回false。删除成功返回true。 -删除key指定的键值对。 +属性的订阅者为Link、Prop等接口绑定的propName,以及\@StorageLink('propName')和\@StorageProp('propName')。这就意味着如果自定义组件中使用\@StorageLink('propName')和\@StorageProp('propName')或者SubscribedAbstractProperty实例依旧对propName有同步关系,则该属性不能从AppStorage中删除。 **参数:** -| 参数名 | 类型 | 必填 | 参数描述 | -| -------- | ------ | ---- | ------------ | -| propName | string | 是 | 要删除的属性的key值。 | +| 参数名 | 类型 | 必填 | 参数描述 | +| -------- | ------ | ---- | ---------------- | +| propName | string | 是 | AppStorage中的属性名。 | **返回值:** | 类型 | 描述 | | ------- | ---------------------------------------- | -| boolean | 删除key指定的键值对,如果存在且删除成功返回true,不存在或删除失败返回false。 | +| boolean | 如果AppStorage中有对应的属性,且该属性已经没有订阅者,则删除成功,返回true。如果属性不存在,或者该属性还存在订阅者,则返回false。 | + ```ts -let simple = AppStorage.Delete('simpleProp') +AppStorage.SetOrCreate('PropA', 47); +AppStorage.Link('PropA'); +let res: boolean = AppStorage.Delete('PropA'); // false, PropA still has a subscriber + +AppStorage.SetOrCreate('PropB', 48); +let res1: boolean = AppStorage.Delete('PropB'); // true, PropB is deleted from AppStorage successfully ``` -### keys -keys(): IterableIterator\ +### Keys + +static Keys(): IterableIterator<string> -查找所有键。 +返回AppStorage中所有的属性名。 **返回值:** -| 类型 | 描述 | -| -------------- | -------------- | -| array\ | 返回包含所有键的字符串数组。 | +| 类型 | 描述 | +| ------------------------------ | ------------------ | +| IterableIterator<string> | AppStorage中所有的属性名。 | + ```ts -let simple = AppStorage.Keys() +AppStorage.SetOrCreate('PropB', 48); +let keys: IterableIterator = AppStorage.Keys(); ``` + ### staticClear -staticClear(): boolean +static staticClear(): boolean 删除所有的属性。 -从API version 9开始废弃,推荐使用[Clear](#clear)。 +从API version 9开始废弃,推荐使用[Clear9+](#clear9)。 **返回值:** @@ -240,333 +296,415 @@ staticClear(): boolean | ------- | --------------------------------- | | boolean | 删除所有的属性,如果当前有状态变量依旧引用此属性,返回false。 | + ```ts -let simple = AppStorage.staticClear() +let simple = AppStorage.staticClear(); ``` + ### Clear9+ -Clear(): boolean +static Clear(): boolean -删除所有的属性。 +清除AppStorage的所有的属性。在AppStorage中清除所有属性的前提是,已经没有任何订阅者。如果有,则什么都不做返回false;删除成功返回true。 + +订阅者的含义和参考[Delete](#delete)。 **返回值:** -| 类型 | 描述 | -| ------- | --------------------------------- | -| boolean | 删除所有的属性,如果当前有状态变量依旧引用此属性,返回false。 | +| 类型 | 描述 | +| ------- | ---------------------------------------- | +| boolean | 如果AppStorage中的属性已经没有订阅者,则清除成功,返回true。否则返回false。 | -```ts -let simple = AppStorage.Clear() + +```typescript +AppStorage.SetOrCreate('PropA', 47); +let res: boolean = AppStorage.Clear(); // true, there are no subscribers ``` + ### IsMutable -IsMutable(propName: string): boolean +static IsMutable(propName: string): boolean -查询属性及状态。 +返回AppStorage中propName对应的属性是否是可变的。 **参数:** -| 参数名 | 类型 | 必填 | 参数描述 | -| -------- | ------ | :--- | ------------ | -| propName | string | 是 | 要查询的属性的key值。 | +| 参数名 | 类型 | 必填 | 参数描述 | +| -------- | ------ | ---- | ---------------- | +| propName | string | 是 | AppStorage中的属性名。 | **返回值:** -| 类型 | 描述 | -| ------- | ------------------ | -| boolean | 返回此属性是否存在并且是否可以改变。 | +| 类型 | 描述 | +| ------- | -------------------------------- | +| boolean | 返回AppStorage中propNam对应的属性是否是可变的。 | + ```ts -let simple = AppStorage.IsMutable('simpleProp') +AppStorage.SetOrCreate('PropA', 47); +let res: boolean = AppStorage.IsMutable('simpleProp'); ``` + ### Size -Size(): number +static Size(): number -存在的键值对的个数。 +返回AppStorage中的属性数量。 **返回值:** -| 类型 | 描述 | -| ------ | --------- | -| number | 返回键值对的数量。 | +| 类型 | 描述 | +| ------ | ------------------- | +| number | 返回AppStorage中属性的数量。 | + ```ts -let simple = AppStorage.Size() +AppStorage.SetOrCreate('PropB', 48); +let res: number = AppStorage.Size(); // 1 ``` + ## LocalStorage9+ + ### constructor9+ constructor(initializingProperties?: Object) -创建一个新的LocalStorage对象,并进行初始化。 +创建一个新的LocalStorage实例。使用Object.keys(initializingProperties)返回的属性和其数值,初始化LocalStorage实例。 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 **参数:** | 参数名 | 类型 | 必填 | 参数描述 | | ---------------------- | ------ | ---- | ---------------------------------------- | -| initializingProperties | Object | 否 | object.keys(obj)返回的所有对象属性及其值都将添加到LocalStorage。 | +| initializingProperties | Object | 否 | 用initializingProperties包含的属性和数值初始化LocalStorage。initializingProperties不能为undefined。 | + ```ts -let storage = new LocalStorage() +let storage: LocalStorage = new LocalStorage({ 'PropA': 47 }); ``` + ### GetShared9+ static GetShared(): LocalStorage -获取当前的共享的LocalStorage对象。 +获取当前stage共享的LocalStorage实例。 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 -此接口仅可在Stage模型下使用。 +**模型约束:**此接口仅可在Stage模型下使用。 **返回值:** -| 类型 | 描述 | -| ----------------------------- | ----------------- | -| [LocalStorage](#localstorage) | 返回LocalStorage对象。 | +| 类型 | 描述 | +| ------------------------------ | ----------------- | +| [LocalStorage](#localstorage9) | 返回LocalStorage实例。 | + ```ts -let storage = LocalStorage.GetShared() +let storage: LocalStorage = LocalStorage.GetShared(); ``` + ### has9+ has(propName: string): boolean -判断属性值是否存在。 +判断propName对应的属性是否在LocalStorage中存在。 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 **参数:** -| 参数名 | 类型 | 必填 | 参数描述 | -| -------- | ------ | ---- | ------- | -| propName | string | 是 | 属性的属性值。 | +| 参数名 | 类型 | 必填 | 参数描述 | +| -------- | ------ | ---- | ------------------ | +| propName | string | 是 | LocalStorage中的属性名。 | **返回值:** -| 类型 | 描述 | -| ------- | ------------- | -| boolean | 返回属性的属性值是否存在。 | +| 类型 | 描述 | +| ------- | ---------------------------------------- | +| boolean | 如果propName对应的属性在AppStorage中存在,则返回true。不存在则返回false。 | + -```ts -let storage = new LocalStorage() -storage.has('storageSimpleProp') ``` +let storage: LocalStorage = new LocalStorage({ 'PropA': 47 }); +storage.has('PropA'); // true +``` + ### get9+ -get\(propName: string): T +get<T>(propName: string): T | undefined + +获取propName在LocalStorage中对应的属性。 -获取对应key值的value。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 **参数:** -| 参数名 | 类型 | 必填 | 参数描述 | -| -------- | ------ | ---- | ----------- | -| propName | string | 是 | 要获取对应的key值。 | +| 参数名 | 类型 | 必填 | 参数描述 | +| -------- | ------ | ---- | ------------------ | +| propName | string | 是 | LocalStorage中的属性名。 | **返回值:** -| 类型 | 描述 | -| -------------- | ---------------------------------------- | -| T \| undefined | 当keyvalue存在时,返回keyvalue值。不存在返回undefined。 | +| 类型 | 描述 | +| ------------------------ | ---------------------------------------- | +| T \| undefined | LocalStorage中propName对应的属性,如果不存在返回undefined。 | + ```ts -let storage = new LocalStorage() -let simpleValue = storage.get('storageSimpleProp') +let storage: LocalStorage = new LocalStorage({ 'PropA': 47 }); +let value: number = storage.get('PropA'); // 47 ``` + ### set9+ -set\(propName: string, newValue: T): boolean +set<T>(propName: string, newValue: T): boolean + +在LocalStorage中设置propName对应属性的值。 -存储对象值。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 **参数:** -| 参数名 | 类型 | 必填 | 参数描述 | -| -------- | ------ | ---- | ----------- | -| propName | string | 是 | 要设置的key值。 | -| newValue | T | 是 | 要设置的value值。 | +| 参数名 | 类型 | 必填 | 参数描述 | +| -------- | ------ | ---- | ----------------------- | +| propName | string | 是 | LocalStorage中的属性名。 | +| newValue | T | 是 | 属性值,不能为undefined或者null。 | **返回值:** -| 类型 | 描述 | -| ------- | ----------------------------------- | -| boolean | 如果存在key值,设置value值并返回true,否则返回false。 | +| 类型 | 描述 | +| ------- | ---------------------------------------- | +| boolean | 如果LocalStorage不存在propName对应的属性,或者设置的newValue是undefined或者null,返回false。设置成功返回true。 | + ```ts -let storage = new LocalStorage() -storage.set('storageSimpleProp', 121) +let storage: LocalStorage = new LocalStorage({ 'PropA': 47 }); +let res: boolean = storage.set('PropA', 47); // true +let res1: boolean = storage.set('PropB', 47); // false ``` + ### setOrCreate9+ -setOrCreate\(propName: string, newValue: T): boolean +setOrCreate<T>(propName: string, newValue: T): boolean + +propName如果已经在LocalStorage中存在,则设置propName对应是属性的值为newValue。如果不存在,则创建propName属性,初始化为newValue。 -创建或更新setOrCreate内部的值。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 **参数:** -| 参数名 | 类型 | 必填 | 参数描述 | -| -------- | ------ | :--- | -------------- | -| propName | string | 是 | 要更新或创建的key值。 | -| newValue | T | 是 | 要更新或创建的value值。 | +| 参数名 | 类型 | 必填 | 参数描述 | +| -------- | ------ | ---- | ----------------------- | +| propName | string | 是 | LocalStorage中的属性名。 | +| newValue | T | 是 | 属性值,不能为undefined或者null。 | **返回值:** | 类型 | 描述 | | ------- | ---------------------------------------- | -| boolean | 如果已存在与给定键名字相同的属性,更新其值且返回true。如果不存在具有给定名称的属性,在LocalStorage中创建具有给定默认值的新属性,默认值必须是T类型,不允许undefined 或 null 。 | +| boolean | 如果设置的newValue是undefined或者null,返回false。
如果LocalStorage存在propName,则更新其值为newValue,返回true。
如果LocalStorage不存在propName,则创建propName,并初始化其值为newValue,返回true。 | + ```ts -let storage = new LocalStorage() -storage.setOrCreate('storageSimpleProp', 121) +let storage: LocalStorage = new LocalStorage({ 'PropA': 47 }); +let res: boolean =storage.setOrCreate('PropA', 121); // true +let res1: boolean =storage.setOrCreate('PropB', 111); // true +let res2: boolean =storage.setOrCreate('PropB', undefined); // false ``` + ### link9+ -link\(propName: string): T +link<T>(propName: string): SubscribedAbstractProperty<T> + +如果给定的propName在LocalStorage实例中存在,则返回与LocalStorage中propName对应属性的双向绑定数据。 + +双向绑定数据的修改会被同步回LocalStorage中,LocalStorage会将变化同步到所有绑定该propName的数据和Component中。 -与localStorage双向数据绑定。 +如果LocalStorage中不存在propName,则返回undefined。 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 **参数:** -| 参数名 | 类型 | 必填 | 参数描述 | -| -------- | ------ | ---- | ----------- | -| propName | string | 是 | 要双向绑定的属性名称。 | +| 参数名 | 类型 | 必填 | 参数描述 | +| -------- | ------ | ---- | ------------------ | +| propName | string | 是 | LocalStorage中的属性名。 | **返回值:** -| 类型 | 描述 | -| ---- | ---------------------------------------- | -| T | 如果存在具有给定键的属性,返回到此属性的双向绑定,该双向绑定意味着变量或者组件对数据的更改将同步到LocalStorage,然后通过LocalStorage实例同步到任何变量或组件。如果不存在给定键的属性,返回undefined。 | +| 类型 | 描述 | +| ----------------------------------- | ---------------------------------------- | +| SubscribedAbstractProperty<T> | SubscribedAbstractProperty<T>的实例,如果AppStorage不存在对应的propName,再返回undefined。 | + ```ts -let storage = new LocalStorage() -let localStorage = storage.link('storageSimpleProp') +let storage: LocalStorage = new LocalStorage({ 'PropA': 47 }); +let linkToPropA1: SubscribedAbstractProperty = storage.link('PropA'); +let linkToPropA2: SubscribedAbstractProperty = storage.link('PropA'); // linkToPropA2.get() == 47 +linkToPropA1.set(48); // 双向同步: linkToPropA1.get() == linkToPropA2.get() == 48 ``` + ### setAndLink9+ -setAndLink\(propName: string, defaultValue: T): T +setAndLink<T>(propName: string, defaultValue: T): SubscribedAbstractProperty<T> + +与Link接口类似,如果给定的propName在LocalStorage存在,则返回该propName对应的属性的双向绑定数据。如果不存在,则使用defaultValue在LocalStorage创建和初始化propName,返回其双向绑定数据。 -与link接口类似,双向数据绑定localStorage。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 **参数:** -| 参数名 | 类型 | 必填 | 参数描述 | -| ------------ | ------ | ---- | ----------- | -| propName | string | 是 | 要进行创建的key值。 | -| defaultValue | T | 是 | 要进行设置的默认值。 | +| 参数名 | 类型 | 必填 | 参数描述 | +| ------------ | ------ | ---- | ---------------------------------------- | +| propName | string | 是 | LocalStorage中的属性名。 | +| defaultValue | T | 是 | 当propName在LocalStorage中不存在,使用default在LocalStorage中初始化对应的propName。 | **返回值:** -| 类型 | 描述 | -| ----- | ---------------------------------------- | -| @Link | 与Link接口类似,如果当前的key保存于LocalStorage,返回该key值对应的value值。如果该key值未被创建,则创建一个对应的defaultValue的Link返回。 | +| 类型 | 描述 | +| ----------------------------------- | ---------------------------------------- | +| SubscribedAbstractProperty<T> | SubscribedAbstractProperty<T>的实例,如果AppStorage不存在对应的propName,再返回undefined。 | + ```ts -let storage = new LocalStorage() -let localStorage = storage.setAndLink('storageSimpleProp', 121) +let storage: LocalStorage = new LocalStorage({ 'PropA': 47 }); +let link1: SubscribedAbstractProperty = storage.setAndLink('PropB', 49); // Create PropB 49 +var link2: SubscribedAbstractProperty = storage.setAndLink('PropA', 50); // PropA exists, remains 47 ``` + ### prop9+ -prop\(propName: string): T +prop<S>(propName: string): SubscribedAbstractProperty<S> -单向属性绑定的一种。更新组件的状态。 +如果给定的propName在LocalStorage存在,则返回与LocalStorage中propName对应属性的单向绑定数据。如果LocalStorage中不存在propName,则返回undefined。单向绑定数据的修改不会被同步回LocalStorage中。 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 **参数:** -| 参数名 | 类型 | 必填 | 参数描述 | -| -------- | ------ | ---- | ------------- | -| propName | string | 是 | 要单向数据绑定的key值。 | +| 参数名 | 类型 | 必填 | 参数描述 | +| -------- | ------ | ---- | ------------------ | +| propName | string | 是 | LocalStorage中的属性名。 | **返回值:** -| 类型 | 描述 | -| ----- | ---------------------------------------- | -| @Prop | 如果存在具有给定键的属性,返回此属性的单向数据绑定。该单向绑定意味着只能通过LocalStorage将属性的更改同步到变量或组件。该方法返回的变量为不可变变量,适用于可变和不可变的状态变量。如果此键的属性不存在则返回undefined。 | +| 类型 | 描述 | +| ----------------------------------- | ---------------------------------------- | +| SubscribedAbstractProperty<S> | SubscribedAbstractProperty<S>的实例,如果AppStorage不存在对应的propName,在返回undefined。 | + ```ts -let storage = new LocalStorage() -let localStorage = storage.prop('storageSimpleProp') +let storage: LocalStorage = new LocalStorage({ 'PropA': 47 }); +let prop1: SubscribedAbstractProperty = storage.prop('PropA'); +let prop2: SubscribedAbstractProperty = storage.prop('PropA'); +prop1.set(1); // one-way sync: prop1.get()=1; but prop2.get() == 47 ``` + ### setAndProp9+ -setAndProp\(propName: string, defaultValue: T): T +setAndProp<S>(propName: string, defaultValue: S): SubscribedAbstractProperty<S> + +propName在LocalStorage存在,则返回该propName对应的属性的单向绑定数据。如果不存在,则使用defaultValue在LocalStorage创建和初始化propName对应的属性,返回其单向绑定数据。 -与Prop接口类似,存在localStorage的单向数据绑定prop值。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 **参数:** -| 参数名 | 类型 | 必填 | 参数描述 | -| ------------ | ------ | ---- | -------------- | -| propName | string | 是 | 要保存的键值对中的key值。 | -| defaultValue | T | 是 | 创建的默认值。 | +| 参数名 | 类型 | 必填 | 参数描述 | +| ------------ | ------ | ---- | ---------------------------------------- | +| propName | string | 是 | LocalStorage中的属性名。 | +| defaultValue | S | 是 | 当propName在AppStorage中不存在,使用default在AppStorage中初始化对应的propName。 | **返回值:** -| 类型 | 描述 | -| ----- | ---------------------------------------- | -| @Prop | 如果当前的key保存与LocalStorage,返回该key值对应的value值。如果该key值未被创建,则创建一个对应的defaultValue的Prop返回。 | +| 类型 | 描述 | +| ----------------------------------- | ---------------------------------------- | +| SubscribedAbstractProperty<S> | SubscribedAbstractProperty<S>的实例,和AppStorage中propName对应属性的单向绑定的数据。 | + ```ts -let storage = new LocalStorage() -let localStorage = storage.setAndProp('storageSimpleProp', 121) +let storage: LocalStorage = new LocalStorage({ 'PropA': 47 }); +let prop: SubscribedAbstractProperty = storage.setAndProp('PropB', 49); // PropA -> 47, PropB -> 49 ``` + ### delete9+ delete(propName: string): boolean -删除key指定的键值对。 +在LocalStorage中删除propName对应的属性。删除属性的前提是该属性已经没有订阅者,如果有则返回false。删除成功则返回true。 + +属性的订阅者是link,prop接口绑定的propName,以及\@LocalStorageLink('propName')和\@LocalStorageProp('propName')。如果自定义组件Component中使用或者SubscribedAbstractProperty(link和prop接口的返回类型)依旧有同步关系,则该属性不能从LocalStorage中删除。 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 **参数:** -| 参数名 | 类型 | 必填 | 参数描述 | -| -------- | ------ | :--- | ------------ | -| propName | string | 是 | 要删除的属性的key值。 | +| 参数名 | 类型 | 必填 | 参数描述 | +| -------- | ------ | ---- | ------------------ | +| propName | string | 是 | LocalStorage中的属性名。 | **返回值:** | 类型 | 描述 | | ------- | ---------------------------------------- | -| boolean | 删除key指定的键值对。存在且删除成功,返回true。不存在、删除失败或有状态变量依旧引用propName,返回false。 | +| boolean | 如果LocalStorage中有对应的属性,且该属性已经没有订阅者,则删除成功返回true。如果属性不存在,或者该属性还存在订阅者,则返回false。 | + ```ts -let storage = new LocalStorage() -storage.delete('storageSimpleProp') +let storage: LocalStorage = new LocalStorage({ 'PropA': 47 }); +storage.link('PropA'); +let res: boolean = storage.delete('PropA'); // false, PropA still has a subscriber +let res1: boolean = storage.delete('PropB'); // false, PropB is not in storage +storage.setOrCreate('PropB', 48); +let res2: boolean = storage.delete('PropB'); // true, PropB is deleted from storage successfully ``` + ### keys9+ -keys(): IterableIterator\ +keys(): IterableIterator<string> + +返回AppStorage中所有的属性名。 -查找所有键。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 **返回值:** -| 类型 | 描述 | -| -------------- | ------------------- | -| array\ | 返回包含所有键不可序列化的字符串数组。 | +| 类型 | 描述 | +| ------------------------------ | -------------------- | +| IterableIterator<string> | LocalStorage中所有的属性名。 | + ```ts -let storage = new LocalStorage() -let simple = storage.keys() +let storage: LocalStorage = new LocalStorage({ 'PropA': 47 }); +let keys: IterableIterator = storage.keys(); ``` + ### size9+ size(): number -存在的键值对的个数。 +返回LocalStorage中的属性数量。 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 **返回值:** @@ -574,191 +712,276 @@ size(): number | ------ | --------- | | number | 返回键值对的数量。 | + ```ts -let storage = new LocalStorage() -let simple = storage.size() +let storage: LocalStorage = new LocalStorage({ 'PropA': 47 }); +let res: number = storage.size(); // 1 ``` -### Clear9+ + +### clear9+ clear(): boolean -删除所有的属性。 + +清除LocalStorage的所有的属性。在LocalStorage中清除所有属性的前提是已经没有任何订阅者。如果有则返回false;清除成功返回true。 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 **返回值:** -| 类型 | 描述 | -| ------- | --------------------------------- | -| boolean | 删除所有的属性,如果当前有状态变量依旧引用此属性,返回false。 | + +| 类型 | 描述 | +| ------- | ---------------------------------------- | +| boolean | 如果LocalStorage中的属性已经没有任何订阅者,则清除成功,返回true。否则返回false。 | + + ```ts -let storage = new LocalStorage() -let simple = storage.clear() +let storage: LocalStorage = new LocalStorage({ 'PropA': 47 }); +let res: boolean = storage.clear(); // true, there are no subscribers ``` -## PersistentStorage -### constructor +## SubscribedAbstractProperty + + +### get9+ + +abstract get(): T + +读取从AppStorage/LocalStorage同步属性的数据。 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 + +**返回值:** + +| 类型 | 描述 | +| ---- | ------------------------------- | +| T | AppStorage/LocalStorage同步属性的数据。 | + + +```ts +AppStorage.SetOrCreate('PropA', 47); +let prop1 = AppStorage.Prop('PropA'); +prop1.get(); // prop1.get()=47 +``` + + +### set9+ + +abstract set(newValue: T): void + +设置AppStorage/LocalStorage同步属性的数据。 -constructor(appStorage: AppStorage, storage: Storage) +从API version 9开始,该接口支持在ArkTS卡片中使用。 -创建一个新的persistentstorage对象。 **参数:** -| 参数名 | 类型 | 必填 | 参数描述 | -| ---------- | ---------- | ---- | ---------------- | -| appStorage | AppStorage | 是 | 保存所有属性及属性值的单例对象。 | -| storage | Storage | 是 | Storage实例对象。 | + +| 参数名 | 类型 | 必填 | 参数描述 | +| -------- | ---- | ---- | ------- | +| newValue | T | 是 | 要设置的数据。 | + + + +``` +AppStorage.SetOrCreate('PropA', 47); +let prop1 = AppStorage.Prop('PropA'); +prop1.set(1); // prop1.get()=1 +``` + +### aboutToBeDeleted10+ + +abstract aboutToBeDeleted(): void + +取消SubscribedAbstractProperty实例对AppStorage/LocalStorage单/双向同步关系。 + ```ts -let persistentstorage = new PersistentStorage(AppStorage,Storage) +AppStorage.SetOrCreate('PropA', 47); +let link = AppStorage.SetAndLink('PropB', 49); // PropA -> 47, PropB -> 49 +link.aboutToBeDeleted(); +link.set(50); // PropB -> 49, link.get() --> undefined ``` + +## PersistentStorage + + ### PersistProp -PersistProp(key:string,defaultValue:T): void +static PersistProp<T>(key: string, defaultValue: T): void + +将AppStorage中key对应的属性持久化到文件中。该接口的调用通常在访问AppStorage之前。 + +确定属性的类型和值的顺序如下: + +1. 如果PersistentStorage文件中存在key对应的属性,在AppStorage中创建对应的propName,并用在PersistentStorage中找到的key的属性初始化。 + +2. 如果PersistentStorage文件中没有查询到key对应的属性,则在AppStorage中查找key对应的属性。如果找到key对应的属性,则将该属性持久化。 + +3. 如果AppStorage也没查找到key对应的属性,则在AppStorage中创建key对应的属性。用defaultValue初始化其值,并将该属性持久化。 -关联命名的属性再AppStorage变为持久化数据。 +根据上述的初始化流程,如果AppStorage中有该属性,则会使用其值,覆盖掉PersistentStorage文件中的值。由于AppStorage是内存内数据,该行为会导致数据丧失持久化能力。 **参数:** -| 参数名 | 类型 | 必填 | 参数描述 | -| ------------ | ------ | ---- | -------------- | -| key | string | 是 | 要关联的属性的key值。 | -| defaultValue | T | 是 | 要关联的属性的value值。 | +| 参数名 | 类型 | 必填 | 参数描述 | +| ------------ | ------ | ---- | ---------------------------------------- | +| key | string | 是 | 属性名。 | +| defaultValue | T | 是 | 在PersistentStorage和AppStorage未查询到时,则使用默认值初始化初始化它。不允许为undefined和null。 | + + +**示例:** + + ```ts -PersistentStorage.PersistProp('highScore', '0') +PersistentStorage.PersistProp('highScore', '0'); ``` + ### DeleteProp -DeleteProp(key: string): void +static DeleteProp(key: string): void -取消双向数据绑定,该属性值将从持久存储中删除。 +PersistProp的逆向操作。将key对应的属性从PersistentStorage删除,后续AppStorage的操作,对PersistentStorage不会再有影响。 **参数:** -| 参数名 | 类型 | 必填 | 参数描述 | -| ---- | ------ | ---- | ------------ | -| key | string | 是 | 要取消的属性的key值。 | +| 参数名 | 类型 | 必填 | 参数描述 | +| ---- | ------ | ---- | ----------------------- | +| key | string | 是 | PersistentStorage中的属性名。 | + ```ts -PersistentStorage.DeleteProp('highScore') +PersistentStorage.DeleteProp('highScore'); ``` + ### PersistProps -PersistProps(properties: {key: string, defaultValue: any}[]): void +static PersistProps(properties: {key: string, defaultValue: any;}[]): void -关联多个命名的属性绑定。 +行为和PersistProp类似,不同在于可以一次性持久化多个数据,适合在应用启动的时候初始化。 **参数:** -| 参数名 | 类型 | 必填 | 参数描述 | -| ---- | ---------------------------------- | ---- | --------- | -| key | {key: string, defaultValue: any}[] | 是 | 要关联的属性数组。 | +| 参数名 | 类型 | 必填 | 参数描述 | +| ---------- | ---------------------------------------- | ---- | ---------------------------------------- | +| properties | {key: string, defaultValue: any}[] | 是 | 持久化数组,启动key为属性名,defaultValue为默认值。规则同PersistProp。 | + ```ts -PersistentStorage.PersistProps([{key: 'highScore', defaultValue: '0'},{key: 'wightScore',defaultValue: '1'}]) +PersistentStorage.PersistProps([{ key: 'highScore', defaultValue: '0' }, { key: 'wightScore', defaultValue: '1' }]); ``` + ### Keys -Keys(): Array\ +static Keys(): Array<string> -返回所有持久化属性的标记。 +返回所有持久化属性的key的数组。 **返回值:** -| 类型 | 描述 | -| -------------- | ------------- | -| Array\ | 返回所有持久化属性的标记。 | +| 类型 | 描述 | +| ------------------- | ----------------- | +| Array<string> | 返回所有持久化属性的key的数组。 | + ```ts -let simple = PersistentStorage.Keys() +let keys: Array = PersistentStorage.Keys(); ``` -> **说明:** -> -> - PersistProp接口使用时,需要保证输入对应的key应当在AppStorage存在。 -> -> - DeleteProp接口使用时,只能对本次启动已经link过的数据生效。 ## Environment -### constructor -创建一个environment对象。 +### EnvProp -```ts -let simple = new Environment() -``` +static EnvProp<S>(key: string, value: S): boolean -### EnvProp +将Environment的内置环境变量key存入AppStorage中。如果系统中未查询到Environment环境变量key的值,则使用默认值value,存入成功,返回true。如果AppStorage已经有对应的key,则返回false。 -EnvProp\(key: string, value: S): boolean +所以建议在程序启动的时候调用该接口。 -关联此系统项到AppStorage中,建议在app启动时使用此接口。如果该属性在AppStorage已存在,返回false。请勿使用AppStorage中的变量,在调用此方法关联环境变量。 +在没有调用EnvProp,就使用AppStorage读取环境变量是错误的。 **参数:** -| 参数名 | 类型 | 必填 | 参数描述 | 参数描述 | -| ----- | ------ | ---- | ---------- | ------------------------- | -| key | string | 是 | 要关联的key值 | 要关联的key值,支持的范围详见内置环境变量说明。 | -| value | S | 是 | 要关联的value值 | 要关联的value值。 | +| 参数名 | 类型 | 必填 | 参数描述 | +| ----- | ------ | ---- | --------------------------------------- | +| key | string | 是 | 环境变量名称,支持的范围详见[内置环境变量说明](#内置环境变量说明)。 | +| value | S | 是 | 查询不到环境变量key,则使用value作为默认值存入AppStorage中。 | **返回值:** -| 类型 | 描述 | -| ------- | ---------------------- | -| boolean | 返回该属性在AppStorage中是否存在。 | +| 类型 | 描述 | +| ------- | ---------------------------------------- | +| boolean | 如果key对应的属性在AppStorage中存在,则返回false。不存在则在AppStorage中创建key对应的属性,返回true。 | + +**示例:** + + +```ts +Environment.EnvProp('accessibilityEnabled', 'default'); +``` + -**内置环境变量说明:** +### 内置环境变量说明 | key | 类型 | 说明 | | -------------------- | --------------- | ---------------------------------------- | | accessibilityEnabled | string | 无障碍屏幕朗读是否启用。 | -| colorMode | ColorMode | 深浅色模式,可选值为:
- ColorMode.LIGHT:浅色模式;
- ColorMode.DARK:深色模式。 | +| colorMode | ColorMode | 深浅色模式,可选值为:
- ColorMode.LIGHT:浅色模式;
- ColorMode.DARK:深色模式。 | | fontScale | number | 字体大小比例。 | | fontWeightScale | number | 字重比例。 | -| layoutDirection | LayoutDirection | 布局方向类型,可选值为:
- LayoutDirection.LTR:从左到右;
- LayoutDirection.RTL:从右到左。 | +| layoutDirection | LayoutDirection | 布局方向类型,可选值为:
- LayoutDirection.LTR:从左到右;
- LayoutDirection.RTL:从右到左。 | | languageCode | string | 当前系统语言,小写字母,例如zh。 | -```ts -Environment.EnvProp('accessibilityEnabled', 'default') -``` ### EnvProps -EnvProps(props: {key: string, defaultValue: any}[]): void +static EnvProps(props: {key: string; defaultValue: any;}[]): void -关联此系统项数组到AppStorage中 +和EnvProp类似,不同点在于参数为数组,可以一次性初始化多个数据。建议在应用启动时调用,将系统环境变量批量存入AppStorage中。 **参数:** -| 参数名 | 类型 | 必填 | 参数描述 | 参数描述 | -| ---- | ---------------------------------- | ---- | --------- | --------- | -| key | {key: string, defaultValue: any}[] | 是 | 要关联的属性数组。 | 要关联的属性数组。 | +| 参数名 | 类型 | 必填 | 参数描述 | +| ----- | ---------------------------------------- | ---- | ------------------ | +| props | {key: string, defaultValue: any}[] | 是 | 系统环境变量和默认值的键值对的数组。 | + ```ts -Environment.EnvProps([{key: 'accessibilityEnabled', defaultValue: 'default'},{key: 'accessibilityUnEnabled', defaultValue: 'undefault'}]) +Environment.EnvProps([{ key: 'accessibilityEnabled', defaultValue: 'default' }, { + key: 'languageCode', + defaultValue: 'en' +}, { key: 'prop', defaultValue: 'hhhh' }]); ``` + ### Keys -Keys(): Array\ +static Keys(): Array<string> -返回关联的系统项。 +返回环境变量的属性key的数组。 **返回值:** -| 类型 | 描述 | -| -------------- | ----------- | -| Array\ | 返回关联的系统项数组。 | +| 类型 | 描述 | +| ------------------- | ----------- | +| Array<string> | 返回关联的系统项数组。 | + ```ts -let simple = Environment.Keys() -``` +Environment.EnvProps([{ key: 'accessibilityEnabled', defaultValue: 'default' }, { + key: 'languageCode', + defaultValue: 'en' +}, { key: 'prop', defaultValue: 'hhhh' }]); +let keys: Array = Environment.Keys(); // accessibilityEnabled, languageCode, prop +``` \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-transition-animation-component.md b/zh-cn/application-dev/reference/arkui-ts/ts-transition-animation-component.md index f61a0286729dd0b62396baf06aa74e0269eb811f..27e49abebea9cec1e379b5ff2168fb034e819dff 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-transition-animation-component.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-transition-animation-component.md @@ -12,17 +12,17 @@ | 名称 | 参数类型 | 参数描述 | | -------- | -------- | -------- | -| transition | TransitionOptions | 所有参数均为可选参数,详细描述见TransitionOptions参数说明。 | +| transition | TransitionOptions | 设置组件插入显示和删除隐藏的过渡效果。
默认值:不设置任何过渡效果时,默认有透明度从0到1的过渡效果。若设置了其他过渡效果,以设置的过渡效果为准。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
所有参数均为可选参数,详细描述见TransitionOptions参数说明。 | ## TransitionOptions参数说明 | 参数名称 | 参数类型 | 必填 | 参数描述 | | -------- | -------- | -------- | -------- | -| type | [TransitionType](ts-appendix-enums.md#transitiontype) | 否 | 默认包括组件新增和删除。
默认值:TransitionType.All
**说明:**
不指定Type时说明插入删除使用同一种效果。 | -| opacity | number | 否 | 设置组件转场时的透明度效果,为插入时起点和删除时终点的值。
默认值:1 | -| translate | {
x? : number \| string,
y? : number \| string,
z? : number \| string
} | 否 | 设置组件转场时的平移效果,为插入时起点和删除时终点的值。
-x:横向的平移距离。
-y:纵向的平移距离。
-z:竖向的平移距离。 | -| scale | {
x? : number,
y? : number,
z? : number,
centerX? : number \| string,
centerY? : number \| string
} | 否 | 设置组件转场时的缩放效果,为插入时起点和删除时终点的值。
-x:横向放大倍数(或缩小比例)。
-y:纵向放大倍数(或缩小比例)。
-z:竖向放大倍数(或缩小比例)。
- centerX、centerY指缩放中心点,centerX和centerY默认值是"50%"。
- 中心点为0时,默认的是组件的左上角。
| -| rotate | {
x?: number,
y?: number,
z?: number,
angle?: number \| string,
centerX?: number \| string,
centerY?: number \| string
} | 否 | 设置组件转场时的旋转效果,为插入时起点和删除时终点的值。
-x:横向的旋转向量。
-y:纵向的旋转向量。
-z:竖向的旋转向量。
- centerX,centerY指旋转中心点,centerX和centerY默认值是"50%"。
- 中心点为(0,0)时,默认的是组件的左上角。 | +| type | [TransitionType](ts-appendix-enums.md#transitiontype) | 否 | 默认包括组件新增和删除。
默认值:TransitionType.All
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
不指定Type时说明插入删除使用同一种效果。 | +| opacity | number | 否 | 设置组件转场时的透明度效果,为插入时起点和删除时终点的值。
默认值:1
取值范围: [0, 1]
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
设置小于0的值时,按值为0处理;设置大于1的值时,按值为1处理。 | +| translate | {
x? : number \| string,
y? : number \| string,
z? : number \| string
} | 否 | 设置组件转场时的平移效果,为插入时起点和删除时终点的值。
-x:横向的平移距离。
-y:纵向的平移距离。
-z:竖向的平移距离。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| scale | {
x? : number,
y? : number,
z? : number,
centerX? : number \| string,
centerY? : number \| string
} | 否 | 设置组件转场时的缩放效果,为插入时起点和删除时终点的值。
-x:横向放大倍数(或缩小比例)。
-y:纵向放大倍数(或缩小比例)。
-z:竖向放大倍数(或缩小比例)。
- centerX、centerY指缩放中心点,centerX和centerY默认值是"50%"。
- 中心点为0时,默认的是组件的左上角。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| rotate | {
x?: number,
y?: number,
z?: number,
angle?: number \| string,
centerX?: number \| string,
centerY?: number \| string
} | 否 | 设置组件转场时的旋转效果,为插入时起点和删除时终点的值。
-x:横向的旋转向量。
-y:纵向的旋转向量。
-z:竖向的旋转向量。
- centerX,centerY指旋转中心点,centerX和centerY默认值是"50%"。
- 中心点为(0,0)时,默认的是组件的左上角。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-transition-animation-shared-elements.md b/zh-cn/application-dev/reference/arkui-ts/ts-transition-animation-shared-elements.md index a30820399e7e66b72019e7a5a111b3157308a27f..87c656eecb0d185fa13b2a88577f02faa6e60c34 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-transition-animation-shared-elements.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-transition-animation-shared-elements.md @@ -1,6 +1,6 @@ # 共享元素转场 -设置页面间转场时共享元素的转场动效。 +当路由进行切换时,可以通过设置组件的 sharedTransition 属性将该元素标记为共享元素并设置对应的共享元素转场动效。 > **说明:** > @@ -12,7 +12,7 @@ | 名称 | 参数 | 参数描述 | | ---------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | -| sharedTransition | id: string,
{
 duration?: number,
 curve?: Curve \| string,
 delay?: number,
 motionPath?:
{
 path: string,
 form?: number,
 to?: number,
 rotatable?: boolean
},
zIndex?: number,
type?: [SharedTransitionEffectType](ts-appendix-enums.md#sharedtransitioneffecttype)
} | 两个页面中id值相同且不为空字符串的组件即为共享元素,在页面转场时可显示共享元素转场动效。
- id:设置组件的id。
- duration:单位为毫秒,默认动画时长为1000毫秒。
- curve:默认曲线为Linear,有效值参见[Curve](ts-animatorproperty.md)说明。
- delay:单位为毫秒,默认不延时播放。
- motionPath:运动路径信息,详细说明请参考[路径动画](ts-motion-path-animation.md)。
- path:设置路径。
- from:设置起始值。
- to:设置终止值。
- rotatable:是否旋转。
- zIndex:设置Z轴。
- type:动画类型。 | +| sharedTransition | id: string,
{
 duration?: number,
 curve?: Curve \| string,
 delay?: number,
 motionPath?:
{
 path: string,
 form?: number,
 to?: number,
 rotatable?: boolean
},
zIndex?: number,
type?: [SharedTransitionEffectType](ts-appendix-enums.md#sharedtransitioneffecttype)
} | 两个页面中id值相同且不为空字符串的组件即为共享元素,在页面转场时可显示共享元素转场动效。
- id:设置组件的id。
- duration:描述共享元素转场动效播放时长。
默认值:1000
单位:毫秒
取值范围:[0, +∞)
值为0时表示无动画。设置小于0的值时,按值为0处理。
- curve:默认曲线为Linear,有效值参见[Curve](ts-animatorproperty.md)说明。
- delay:用来描述共享元素转场动效延迟播放的时长。
默认值:0
单位:毫秒
取值范围:[0, +∞)
设置小于0的值时,按值为0处理。
- motionPath:运动路径信息,详细说明请参考[路径动画](ts-motion-path-animation.md)。
- path:设置路径。
- from:设置起始值。
- to:设置终止值。
- rotatable:是否旋转。
- zIndex:设置Z轴。
- type:动画类型。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-types.md b/zh-cn/application-dev/reference/arkui-ts/ts-types.md index 10348a88a641f6aa4ff7cddf686ade9a621b1b46..114b23b9ee5b7ce4da2b93c96cd1da0fce0fee32 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-types.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-types.md @@ -122,8 +122,8 @@ | 类型 | 说明 | | ---------------------------------------- | ------------------------------------------------- | | [Color](ts-appendix-enums.md#color) | 颜色枚举值。 | -| number | HEX格式颜色。 | -| string | rgb或者rgba格式颜色。 | +| number | HEX格式颜色,支持rgb。 | +| string | rgb或者argb格式颜色。 | | [Resource](#resource) | 使用引入资源的方式,引入系统资源或者应用资源中的颜色。 | ## ColoringStrategy @@ -132,7 +132,7 @@ | 名称 | 描述 | | --------- | ------- | -| Invert | 设置前景色为控件背景色的反色。| +| INVERT | 设置前景色为控件背景色的反色。| ## LengthConstrain @@ -224,3 +224,13 @@ | ------------- | ---------------------- | ---------------------------------------- | | CustomBuilder | () => any | 该方法类型必须使用@Builder装饰器修饰。具体用法见[@Builder](../../quick-start/arkts-dynamic-ui-elememt-building.md#builder)。 | +## PixelStretchEffectOptions10+ + +像素扩展属性集合,用于描述像素扩展的信息。 + +| 名称 | 类型 | 必填 | 说明 | +| ----------- | ------ | ---- | ---------- | +| left | [Length](#length) | 否 | 组件图像左边沿扩展距离。 | +| right | [Length](#length) | 否 | 组件图像右边沿像素扩展距离。 | +| top | [Length](#length) | 否 | 组件图像上边沿像素扩展距离。 | +| bottom | [Length](#length) | 否 | 组件图像下边沿像素扩展距离。 | \ No newline at end of file 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 1726ad14146e9f2c4aeb6919e3e031aa661fdfec..4107ebe46ad7c0104ea0500e3121483272197ef4 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 @@ -10,10 +10,10 @@ | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| backgroundColor | [ResourceColor](ts-types.md#resourcecolor) | 设置组件的背景色。 | -| backgroundImage | src: [ResourceStr](ts-types.md#resourcestr),
repeat?: [ImageRepeat](ts-appendix-enums.md#imagerepeat) | src:图片地址,支持网络图片资源和本地图片资源地址(不支持svg类型的图片)。
repeat:设置背景图片的重复样式,默认不重复。 | -| backgroundImageSize | {
width?: [Length](ts-types.md#length),
height?: [Length](ts-types.md#length)
} \| [ImageSize](ts-appendix-enums.md#imagesize) | 设置背景图像的高度和宽度。当输入为{width: Length, height: Length}对象时,如果只设置一个属性,则第二个属性保持图片原始宽高比进行调整。默认保持原图的比例不变。
默认值:ImageSize.Auto | -| backgroundImagePosition | [Position](ts-types.md#position8) \| [Alignment](ts-appendix-enums.md#alignment) | 设置背景图在组件中显示位置,即相对于组件左上角的坐标。
默认值:
{
x: 0,
y: 0
}
x和y值设置百分比时,偏移量是相对组件自身宽高计算的。 | +| backgroundColor | [ResourceColor](ts-types.md#resourcecolor) | 设置组件的背景色。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| backgroundImage | src: [ResourceStr](ts-types.md#resourcestr),
repeat?: [ImageRepeat](ts-appendix-enums.md#imagerepeat) | src:图片地址,支持网络图片资源地址和本地图片资源地址和Base64,不支持svg类型的图片。
repeat:设置背景图片的重复样式,默认不重复。当设置的背景图片为透明底色图片,且同时设置了backgroundColor时,二者叠加显示,背景颜色在最底部。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| backgroundImageSize | {
width?: [Length](ts-types.md#length),
height?: [Length](ts-types.md#length)
} \| [ImageSize](ts-appendix-enums.md#imagesize) | 设置背景图像的高度和宽度。当输入为{width: Length, height: Length}对象时,如果只设置一个属性,则第二个属性保持图片原始宽高比进行调整。默认保持原图的比例不变。
width和height取值范围: [0, +∞)
默认值:ImageSize.Auto
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
设置为小于0的值时,按值为0显示。当设置了height未设置width时,width根据图片原始宽高比进行调整。 | +| backgroundImagePosition | [Position](ts-types.md#position8) \| [Alignment](ts-appendix-enums.md#alignment) | 设置背景图在组件中显示位置,即相对于组件左上角的坐标。
默认值:
{
x: 0,
y: 0
}
x和y值设置百分比时,偏移量是相对组件自身宽高计算的。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-backgroundBlurStyle.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-backgroundBlurStyle.md index cb368b39322eff4969717eafe7fd80cb7b1af116..50b1bc3a158306be1a402a59589116586986d95e 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-backgroundBlurStyle.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-backgroundBlurStyle.md @@ -10,17 +10,16 @@ ## 属性 -| 名称 | 参数类型 | 描述 | +| 名称 | 参数 | 描述 | | -------------------- | ----------------------- | ------------------------ | -| backgroundBlurStyle | [BlurStyle](#blurstyle) | 为当前组件提供一种在背景和内容之间的模糊能力,入参为模糊材质。| +| backgroundBlurStyle | value:[BlurStyle](ts-appendix-enums.md#blurstyle9),
options10+?:[BackgroundBlurStyleOptions](#backgroundblurstyleoptions10对象说明) | 为当前组件提供一种在背景和内容之间的模糊能力。
value: 背景模糊样式。模糊样式中封装了模糊半径、蒙版颜色、蒙版透明度、饱和度四个参数。
options: 可选参数,背景模糊选项。
该接口支持在ArkTS卡片中使用。 | + +## BackgroundBlurStyleOptions10+对象说明 -## BlurStyle - - | 名称 | 描述 | - | ------- | ---------- | - | Thin | 轻薄材质。 | - | Regular | 普通厚度材质。 | - | Thick | 厚材质。 | +| 名称 | 参数类型 | 必填 | 描述 | +| ----------- | ------| ------ | ------ | +| colorMode10+ | [ThemeColorMode](ts-appendix-enums.md#themecolormode10) | 否 | 背景模糊效果使用的深浅色模式。
默认值:ThemeColorMode.System | +| adaptiveColor10+ | [AdaptiveColor](ts-appendix-enums.md#adaptivecolor10) | 否 | 背景模糊效果使用的取色模式。
默认值:AdaptiveColor.Default | ## 示例 @@ -28,16 +27,16 @@ // xxx.ets @Entry @Component -struct Index { +struct BackgroundBlurStyleDemo { build() { Column() { Row() { Text("Thin Material") } - .width(350) - .height(300) - .backgroundBlurStyle(BlurStyle.Thin) - .position({ x: "15%", y: "30%" }) + .width('50%') + .height('50%') + .backgroundBlurStyle(BlurStyle.Thin, { colorMode: ThemeColorMode.Light, adaptiveColor: AdaptiveColor.Default }) + .position({ x: '15%', y: '30%' }) } .height('100%') .width('100%') @@ -46,4 +45,4 @@ struct Index { } } ``` -![zh-cn_image_background_blur_style](figures/zh-cn_image_background_blur_style.png) \ No newline at end of file +![zh-cn_image_background_blur_style](figures/zh-cn_image_background_blur_style.png) 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 b41a408db85dccf042901b5dedcee65367dc18cd..2ade5dcdb6bc59452b253df6a4c73cacd7baae72 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 @@ -10,10 +10,12 @@ | 名称 | 参数类型 | 描述 | | ---------- | ---------------------------------------- | --------------------------------------- | -| borderImage | [BorderImageOption](#borderimageoption对象说明) | 图片边框或者渐变色边框设置接口。 | +| borderImage | [BorderImageOption](#borderimageoption对象说明) | 图片边框或者渐变色边框设置接口。
该接口支持在ArkTS卡片中使用。 | ## BorderImageOption对象说明 +该接口支持在ArkTS卡片中使用。 + | 名称 | 类型 | 描述 | | ---------- | ---------------------------------------- | --------------------------------------- | | source | string \| [Resource](ts-types.md#resource) \| [linearGradient](ts-universal-attributes-gradient-color.md) | 边框图源或者渐变色设置。
**说明:** 边框图源仅适用于容器组件,如Row、Column、Flex,在非容器组件上使用会失效。 | @@ -23,9 +25,10 @@ | repeat | [RepeatMode](#repeatmode枚举说明) | 设置边框图片的重复方式。
默认值:RepeatMode.Stretch | | fill | boolean | 设置边框图片中心填充。
默认值:false | - ## RepeatMode枚举说明 +该接口支持在ArkTS卡片中使用。 + | 名称 | 描述 | | ------- | ----------------------------------- | | Repeat | 被切割图片重复铺平在图片边框上,超出的部分会被剪裁。 | 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 58a64f62891cce602d65efe18cd04ee46c92abb5..e52c019db54f0f0b6bc7c45e1de40bd46aaabb4f 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 @@ -13,11 +13,11 @@ | 名称 | 参数类型 | 描述 | | ------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -| border | {
width?: [Length](ts-types.md#length) \| [EdgeWidths](#edgewidths9对象说明)9+,
color?:  [ResourceColor](ts-types.md#resourcecolor) \| [EdgeColors](#edgecolors9对象说明)9+,
radius?:  [Length](ts-types.md#length) \| [BorderRadiuses](#borderradiuses9对象说明)9+,
style?: [BorderStyle](ts-appendix-enums.md#borderstyle) \| [EdgeStyles](#edgestyles9对象说明)9+
} | 统一边框样式设置接口。
- width:设置边框宽度。
- color:设置边框颜色。
- radius:设置边框圆角半径。
- style:设置边框样式。 | -| borderStyle | [BorderStyle](ts-appendix-enums.md#borderstyle) \| [EdgeStyles](#edgestyles9对象说明)9+ | 设置元素的边框样式。
默认值:BorderStyle.Solid | -| borderWidth | [Length](ts-types.md#length) \| [EdgeWidths](#edgewidths9对象说明)9+ | 设置元素的边框宽度,不支持百分比。 | -| borderColor | [ResourceColor](ts-types.md#resourcecolor) \| [EdgeColors](#edgecolors9对象说明)9+ | 设置元素的边框颜色。
默认值:Color.Black | -| borderRadius | [Length](ts-types.md#length) \| [BorderRadiuses](#borderradiuses9对象说明)9+ | 设置元素的边框圆角半径,不支持百分比。 | +| border | {
width?: [Length](ts-types.md#length) \| [EdgeWidths](#edgewidths9对象说明)9+,
color?:  [ResourceColor](ts-types.md#resourcecolor) \| [EdgeColors](#edgecolors9对象说明)9+,
radius?:  [Length](ts-types.md#length) \| [BorderRadiuses](#borderradiuses9对象说明)9+,
style?: [BorderStyle](ts-appendix-enums.md#borderstyle) \| [EdgeStyles](#edgestyles9对象说明)9+
} | 统一边框样式设置接口。
- width:设置边框宽度。
- color:设置边框颜色。
- radius:设置边框圆角半径。
- style:设置边框样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| borderStyle | [BorderStyle](ts-appendix-enums.md#borderstyle) \| [EdgeStyles](#edgestyles9对象说明)9+ | 设置元素的边框样式。
默认值:BorderStyle.Solid
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| borderWidth | [Length](ts-types.md#length) \| [EdgeWidths](#edgewidths9对象说明)9+ | 设置元素的边框宽度,不支持百分比。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| borderColor | [ResourceColor](ts-types.md#resourcecolor) \| [EdgeColors](#edgecolors9对象说明)9+ | 设置元素的边框颜色。
默认值:Color.Black
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| borderRadius | [Length](ts-types.md#length) \| [BorderRadiuses](#borderradiuses9对象说明)9+ | 设置元素的边框圆角半径,不支持百分比。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## EdgeWidths9+对象说明 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-component-id.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-component-id.md index f56a0c97957064edf50c2f702a1a2f3bbea8c3a9..d4161f28b1303642db2c77ce388c230154a8acd6 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-component-id.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-component-id.md @@ -11,7 +11,7 @@ id为组件的唯一标识,在整个应用内唯一。本模块提供组件标 | 名称 | 参数说明 | 描述 | | -----| -------- | ----------------------------- | -| id | string | 组件的唯一标识,唯一性由使用者保证。
默认值:'' | +| id | string | 组件的唯一标识,唯一性由使用者保证。
默认值:''
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 接口 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-enable.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-enable.md index 794627c66f84c4aa409cc521c13fc25326bb6803..7bf82a4ed78ec0ae71b87cb093ebf782057d77e7 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-enable.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-enable.md @@ -10,9 +10,9 @@ ## 属性 -| 名称 | 参数类型 | 描述 | -| ------- | ------- | ---------------------------------------- | -| enabled | boolean | 值为true表示组件可交互,响应点击等操作。
值为false表示组件不可交互,不响应点击等操作。
默认值:true | +| 名称 | 参数类型 | 描述 | +| ------- | -------- | ------------------------------------------------------------ | +| enabled | boolean | 值为true表示组件可交互,响应点击等操作。
值为false表示组件不可交互,不响应点击等操作。
默认值:true
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-flex-layout.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-flex-layout.md index 176b1d4b04e4ba33d3adca9b8d309f2d3da6c7b8..928f97b47419f53056537d8f24313112ba377a15 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-flex-layout.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-flex-layout.md @@ -3,17 +3,17 @@ > **说明:** > - 从API Version 7开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 > -> - 仅当父组件是 Flex、Column、Row 时生效。 +> - 仅当父组件是 Flex、Column、Row 、GridRow时生效。 ## 属性 -| 名称 | 参数说明 | 描述 | -| ---------- | ---------------------------------------- | ---------------------------------------- | -| flexBasis | number \| string | 设置组件在父容器主轴方向上的基准尺寸。
默认值:'auto'(表示组件在主轴方向上的基准尺寸为组件原本的大小)。
不支持百分比设置。 | -| flexGrow | number | 设置父容器的剩余空间分配给此属性所在组件的比例。
默认值:0 | -| flexShrink | number | 设置父容器压缩尺寸分配给此属性所在组件的比例。
父容器为Row、Column时,默认值:0
父容器为flex时,默认值:1 | -| alignSelf | [ItemAlign](ts-appendix-enums.md#itemalign) | 子组件在父容器交叉轴的对齐格式,会覆盖Flex布局容器中的alignItems设置。
默认值:ItemAlign.Auto | +| 名称 | 参数说明 | 描述 | +| ---------- | ------------------------------------------- | ------------------------------------------------------------ | +| flexBasis | number \| string | 设置组件在父容器主轴方向上的基准尺寸。
默认值:'auto'(表示组件在主轴方向上的基准尺寸为组件原本的大小)。
不支持百分比设置。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| flexGrow | number | 设置父容器的剩余空间分配给此属性所在组件的比例。
默认值:0
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| flexShrink | number | 设置父容器压缩尺寸分配给此属性所在组件的比例。
父容器为Row、Column时,默认值:0
父容器为flex时,默认值:1
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| alignSelf | [ItemAlign](ts-appendix-enums.md#itemalign) | 子组件在父容器交叉轴的对齐格式,会覆盖Flex、Column、Row、GridRow布局容器中的alignItems设置。
GridCol可以绑定alignsSelf属性来改变它自身在交叉轴方向上的布局。
默认值:ItemAlign.Auto
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-foreground-color.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-foreground-color.md index 0495a78c6e22b957c34aa76d550391ceb05b4f7e..f84e074a3f753252303a35494fe0eade922a8476 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-foreground-color.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-foreground-color.md @@ -10,7 +10,7 @@ | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| foregroundColor | [ResourceColor](ts-types.md#resourcecolor) \| [ColoringStrategy](ts-types.md#ColoringStrategy) | 设置组件的前景颜色或者根据智能取色策略设置前景颜色。 | +| foregroundColor | [ResourceColor](ts-types.md#resourcecolor) \| [ColoringStrategy](ts-types.md#coloringstrategy) | 设置组件的前景颜色或者根据智能取色策略设置前景颜色。 | ## 示例 @@ -47,12 +47,11 @@ struct ColoringStrategyExample { // 绘制一个直径为150的圆,设置前景色为组件背景色的反色 Circle({ width: 150, height: 200 }) .backgroundColor(Color.Black) - .foregroungColor(ColoringStrategy.Invert) + .foregroundColor(ColoringStrategy.INVERT) }.width('100%') } } ``` - ![foregroundColor_circle](figures/ColoringStrategy_circle.png) ### 示例3 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 7ff0ab79eb3f9b157c0f98f61607164bbee187fb..bb90448db55d8c50bb909e7f0a549e4d7ee9b478 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 @@ -12,9 +12,9 @@ | 名称 | 参数类型 | 描述 | | -------------- | -------------------------------------------- | ----------------------------------- | -| linearGradient | {
angle?: number \| string,
direction?: [GradientDirection](ts-appendix-enums.md#gradientdirection),
colors: Array<[ColorStop](ts-basic-components-gauge.md#colorstop)>,
repeating?: boolean
} | 线性渐变。
- angle: 线性渐变的起始角度。0点方向顺时针旋转为正向角度。
默认值:180
- direction: 线性渐变的方向,设置angle后不生效。
默认值:GradientDirection.Bottom
- colors: 为渐变的颜色描述。
- repeating: 为渐变的颜色重复着色。
默认值:false | -| sweepGradient | {
center: Point,
start?: number \| string,
end?: number \| string,
rotation?: number\|string,
colors: Array<[ColorStop](ts-basic-components-gauge.md#colorstop)>,
repeating?: boolean
} | 角度渐变,仅绘制0-360度范围内的角度,超出时不绘制渐变色,只绘制纯色。
- center:为角度渐变的中心点,即相对于当前组件左上角的坐标。
- start:角度渐变的起点。
默认值:0
- end:角度渐变的终点。
默认值:0
- rotation: 角度渐变的旋转角度。
默认值:0
- colors: 为渐变的颜色描述。
- repeating: 为渐变的颜色重复着色。
默认值:false | -| radialGradient | {
center: Point,
radius: number \| string,
colors: Array<[ColorStop](ts-basic-components-gauge.md#colorstop)>,
repeating?: boolean
} | 径向渐变。
- center:径向渐变的中心点,即相对于当前组件左上角的坐标。
- radius:径向渐变的半径。
- colors: 为渐变的颜色描述。
- repeating: 为渐变的颜色重复着色。
默认值:false | +| linearGradient | {
angle?: number \| string,
direction?: [GradientDirection](ts-appendix-enums.md#gradientdirection),
colors: Array<[ColorStop](ts-basic-components-gauge.md#colorstop)>,
repeating?: boolean
} | 线性渐变。
- angle: 线性渐变的起始角度。0点方向顺时针旋转为正向角度。
默认值:180
- direction: 线性渐变的方向,设置angle后不生效。
默认值:GradientDirection.Bottom
- colors: 渐变的颜色描述。
- repeating: 为渐变的颜色重复着色。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| sweepGradient | {
center: Point,
start?: number \| string,
end?: number \| string,
rotation?: number\|string,
colors: Array<[ColorStop](ts-basic-components-gauge.md#colorstop)>,
repeating?: boolean
} | 角度渐变,仅绘制0-360度范围内的角度,超出时不绘制渐变色,只绘制纯色。
- center:为角度渐变的中心点,即相对于当前组件左上角的坐标。
- start:角度渐变的起点。
 默认值:0
- end:角度渐变的终点。
 默认值:0
- rotation: 角度渐变的旋转角度。
 默认值:0
- colors: 为渐变的颜色描述。
- repeating: 为渐变的颜色重复着色。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
设置为小于0的值时,按值为0处理,设置为大于360的值时,按值为360处理。
当start、end、rotation的数据类型为string,值为"90"或"90%",与90效果一致 | +| radialGradient | {
center: Point,
radius: number \| string,
colors: Array<[ColorStop](ts-basic-components-gauge.md#colorstop)>,
repeating?: boolean
} | 径向渐变。
- center:径向渐变的中心点,即相对于当前组件左上角的坐标。
- radius:径向渐变的半径。
 取值范围 [0,+∞)
  **说明:**
设置为小于的0值时,按值为0处理。
- colors: 为渐变的颜色描述。
- repeating: 为渐变的颜色重复着色。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-grid.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-grid.md index a81f4e0390a61127903e9ca41168c6b2e8786c1a..1e65c994d71e3e8b7db3c18b160a58aedc6a3374 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-grid.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-grid.md @@ -12,8 +12,8 @@ | 名称 | 参数类型 | 描述 | | ----------- | ------------------------------------------------------------ | ------------------------------------------------------------ | -| useSizeType | {
xs?: number \| { span: number, offset: number },
sm?: number \| { span: number, offset: number },
md?: number \| { span: number, offset: number },
lg?: number \| { span: number, offset: number }
} | 设置在特定设备宽度类型下的占用列数和偏移列数,span: 占用列数; offset: 偏移列数。
当值为number类型时,仅设置列数, 当格式如{"span": 1, "offset": 0}时,指同时设置占用列数与偏移列数。
- xs: 指设备宽度类型为SizeType.XS时的占用列数和偏移列数。
- sm: 指设备宽度类型为SizeType.SM时的占用列数和偏移列数。
- md: 指设备宽度类型为SizeType.MD时的占用列数和偏移列数。
- lg: 指设备宽度类型为SizeType.LG时的占用列数和偏移列数。 | -| gridSpan | number | 默认占用列数,指useSizeType属性没有设置对应尺寸的列数(span)时,占用的栅格列数。
**说明:**
设置了栅格span属性,组件的宽度由栅格布局决定。
默认值:1 | +| useSizeType(deprecated) | {
xs?: number \| { span: number, offset: number },
sm?: number \| { span: number, offset: number },
md?: number \| { span: number, offset: number },
lg?: number \| { span: number, offset: number }
} | 设置在特定设备宽度类型下的占用列数和偏移列数,span: 占用列数; offset: 偏移列数。
当值为number类型时,仅设置列数, 当格式如{"span": 1, "offset": 0}时,指同时设置占用列数与偏移列数。
- xs: 指设备宽度类型为SizeType.XS时的占用列数和偏移列数。
- sm: 指设备宽度类型为SizeType.SM时的占用列数和偏移列数。
- md: 指设备宽度类型为SizeType.MD时的占用列数和偏移列数。
- lg: 指设备宽度类型为SizeType.LG时的占用列数和偏移列数。
该属性从API version 9开始废弃,推荐使用新组件[GridCol](ts-container-gridcol.md)、[GridRow](ts-container-gridrow.md)。 | +| gridSpan | number | 默认占用列数,指useSizeType属性没有设置对应尺寸的列数(span)时,占用的栅格列数。
**说明:**
设置了栅格span属性,组件的宽度由栅格布局决定。
默认值:1 | | gridOffset | number | 默认偏移列数,指useSizeType属性没有设置对应尺寸的偏移(offset)时, 当前组件沿着父组件Start方向,偏移的列数,也就是当前组件位于第n列。
**说明:**
- 配置该属性后,当前组件在父组件水平方向的布局不再跟随父组件原有的布局方式,而是沿着父组件的Start方向偏移一定位移。
- 偏移位移 = (列宽 + 间距)\* 列数。
- 设置了偏移(gridOffset)的组件之后的兄弟组件会根据该组件进行相对布局,类似相对布局。
默认值:0 | 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 be65bcfe889e696a038fc993470e97c6f8897a56..11f0c61a7e44545b0374a82b260187074c633e07 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 @@ -12,26 +12,28 @@ | 名称 | 参数类型 | 默认值 | 描述 | | ----------------------------- | ------------------------------------------------------------ | ------ | ------------------------------------------------------------ | -| blur | number | - | 为当前组件添加内容模糊效果,入参为模糊半径,模糊半径越大越模糊,为0时不模糊。 | -| backdropBlur | number | - | 为当前组件添加背景模糊效果,入参为模糊半径,模糊半径越大越模糊,为0时不模糊。 | -| shadow | [ShadowOptions](#shadowoptions对象说明) \| [ShadowStyle](#shadowstyle10枚举说明) | - | 为当前组件添加阴影效果。
入参类型为ShadowOptions时,可以指定模糊半径、阴影的颜色、X轴和Y轴的偏移量。
入参类型为ShadowStyle时,可指定不同阴影样式。| -| 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则图像无变化。(百分比) | -| sepia | number | 0 | 将图像转换为深褐色。入参为图像反转的比例。值为1则完全是深褐色的,值为0图像无变化。 (百分比) | -| hueRotate | number \| string | '0deg' | 色相旋转效果,输入参数为旋转角度。 | -| colorBlend 8+ | [Color](ts-appendix-enums.md#color) \| string \| [Resource](ts-types.md#resource) | - | 为当前组件添加颜色叠加效果,入参为叠加的颜色。 | +| blur | number | - | 为当前组件添加内容模糊效果,入参为模糊半径,模糊半径越大越模糊,为0时不模糊。
取值范围:[0, +∞)
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| backdropBlur | number | - | 为当前组件添加背景模糊效果,入参为模糊半径,模糊半径越大越模糊,为0时不模糊。
取值范围:[0, +∞)
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| shadow | [ShadowOptions](#shadowoptions对象说明) \| [ShadowStyle](#shadowstyle10枚举说明) | - | 为当前组件添加阴影效果。
入参类型为ShadowOptions时,可以指定模糊半径、阴影的颜色、X轴和Y轴的偏移量。
入参类型为ShadowStyle时,可指定不同阴影样式。
从API version 9开始,该接口支持在ArkTS卡片中使用,ArkTS卡片上不支持参数为 [ShadowStyle](#shadowstyle10枚举说明)类型。 | +| grayscale | number | 0.0 | 为当前组件添加灰度效果。值定义为灰度转换的比例,入参1.0则完全转为灰度图像,入参则0.0图像无变化,入参在0.0和1.0之间时,效果呈线性变化。(百分比)
取值范围:[0, 1]
**说明:**
设置小于0的值时,按值为0处理,设置大于1的值时,按值为1处理。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| brightness | number | 1.0 | 为当前组件添加高光效果,入参为高光比例,值为1时没有效果,小于1时亮度变暗,0为全黑,大于1时亮度增加,数值越大亮度越大。
取值范围:[0, +∞)
**说明:**
设置小于0的值时,按值为0处理。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| saturate | number | 1.0 | 为当前组件添加饱和度效果,饱和度为颜色中的含色成分和消色成分(灰)的比例,入参为1时,显示原图像,大于1时含色成分越大,饱和度越大,小于1时消色成分越大,饱和度越小。(百分比)
取值范围:[0, +∞)
**说明:**
设置小于0的值时,按值为0处理。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| contrast | number | 1.0 | 为当前组件添加对比度效果,入参为对比度的值。值为1时,显示原图,大于1时,值越大对比度越高,图像越清晰醒目,小于1时,值越小对比度越低,当对比度为0时,图像变为全灰。(百分比)
取值范围:[0, +∞)
**说明:**
设置小于0的值时,按值为0处理。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| invert | number | 0 | 反转输入的图像。入参为图像反转的比例,值为1时完全反转,值为0则图像无变化。(百分比)
取值范围:[0, 1]
**说明:**
设置小于0的值时,按值为0处理。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| sepia | number | 0 | 将图像转换为深褐色。入参为图像反转的比例,值为1则完全是深褐色的,值为0图像无变化。 (百分比)
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| hueRotate | number \| string | '0deg' | 色相旋转效果,输入参数为旋转角度。
取值范围:(-∞, +∞)
**说明:**
色调旋转360度会显示原始颜色。先将色调旋转180 度,然后再旋转-180度会显示原始颜色。数据类型为number时,值为90和'90deg'效果一致。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| colorBlend 8+ | [Color](ts-appendix-enums.md#color) \| string \| [Resource](ts-types.md#resource) | - | 为当前组件添加颜色叠加效果,入参为叠加的颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## ShadowOptions对象说明 阴影属性集合,用于设置阴影的模糊半径、阴影的颜色、X轴和Y轴的偏移量。 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 类型 | 必填 | 说明 | | ------ | ------ | ---- | --------------- | -| radius | number \| [Resource](ts-types.md#resource) | 是 | 阴影模糊半径。 | -| color | [Color](ts-appendix-enums.md#color) \| string \| [Resource](ts-types.md#resource) | 否 | 阴影的颜色。
默认为灰色。 | +| radius | number \| [Resource](ts-types.md#resource) | 是 | 阴影模糊半径。
取值范围:[0, +∞)
**说明:**
设置小于0的值时,按值为0处理。 | +| color | [Color](ts-appendix-enums.md#color) \| string \| [Resource](ts-types.md#resource) | 否 | 阴影的颜色。
默认为黑色。 | | offsetX | number \| [Resource](ts-types.md#resource) | 否 | 阴影的X轴偏移量。
默认为0。 | | offsetY | number \| [Resource](ts-types.md#resource) | 否 | 阴影的Y轴偏移量。
默认为0。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-layout-constraints.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-layout-constraints.md index 5fb5468e9a67be8d63c19ce5f20c7057a542527f..7049c1352559952f5c9e3625ae5fcdc001d894e0 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-layout-constraints.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-layout-constraints.md @@ -9,10 +9,10 @@ ## 属性 -| 名称 | 参数说明 | 描述 | -| --------------- | ------ | ---------------------------------------- | -| aspectRatio | number | 指定当前组件的宽高比,aspectRatio = width/height。 | -| displayPriority | number | 设置当前组件在布局容器中显示的优先级,当父容器空间不足时,低优先级的组件会被隐藏。
小数点后的数字不作优先级区分,即区间为[x, x + 1)内的数字视为相同优先级。例如:1.0与1.9为同一优先级。
**说明:**
仅在Row/Column/Flex(单行)容器组件中生效。 | +| 名称 | 参数说明 | 描述 | +| --------------- | -------- | ------------------------------------------------------------ | +| aspectRatio | number | 指定当前组件的宽高比,aspectRatio = width/height。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| displayPriority | number | 设置当前组件在布局容器中显示的优先级,当父容器空间不足时,低优先级的组件会被隐藏。
小数点后的数字不作优先级区分,即区间为[x, x + 1)内的数字视为相同优先级。例如:1.0与1.9为同一优先级。
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
仅在Row/Column/Flex(单行)容器组件中生效。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-lightUpEffect.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-lightUpEffect.md new file mode 100644 index 0000000000000000000000000000000000000000..a9bb7528afe070280842971a5984ad069b6e6fa5 --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-lightUpEffect.md @@ -0,0 +1,80 @@ +# 图像渐亮效果 + +设置组件的图像渐亮效果。 + +> **说明:** +> +> 从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。此接口为系统接口。 + +## 属性 + +| 名称 | 参数类型 | 描述 | +| -------- | -------- | -------- | +| lightUpEffect | [number] | 设置组件图像亮起程度。
取值范围:[0,1]。
如果value等于0则图像为全黑,如果value等于1则图像为全亮效果。0到1之间数值越大,表示图像亮度越高。`value < 0` 或者 `value > 1`为异常情况,`value < 0`按0处理,`value > 1`按1处理。 | + +## 示例 + +### 示例1 +```ts +// xxx.ets +@Entry +@Component +struct LightUpExample { + build() { + Stack() { + Text('This is the text content with letterSpacing 0.') + .letterSpacing(0) + .fontSize(12) + .border({ width: 1 }) + .padding(10) + .width('50%') + .lightUpEffect(0.6) + }.alignContent(Alignment.Center).width("100%").height("100%") + } +} + +``` +效果图如下: + +![textLightUp3](figures/textLightUp3.png) + +修改lightUpEffect参数值为0.2: + +![textLightUp2](figures/textLightUp2.png) + +去掉lightUpEffect的设置,效果如下: + +![textLightUp1](figures/textLightUp1.png) +### 示例2 + +```ts +// xxx.ets +@Entry +@Component +struct LightUpExample { + @State isLunar: boolean = false + private selectedDate: Date = new Date('2028-08-08') + build() { + Stack() { + DatePicker({ + start: new Date('1970-1-1'), + end: new Date('2100-1-1'), + selected: this.selectedDate + }) + .lunar(this.isLunar) + .onChange((value: DatePickerResult) => { + this.selectedDate.setFullYear(value.year, value.month, value.day) + console.info('select current date is: ' + JSON.stringify(value)) + }) + .lightUpEffect(0.6) + + }.alignContent(Alignment.Center).width("100%").height("100%") + } +} +``` + +![datePickerLightUp2](figures/datePickerLightUp2.png) + +去掉lightUpEffect的设置,效果如下: + +![datePickerLightUp1](figures/datePickerLightUp1.png) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-location.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-location.md index 2cd02ad07fdec4be3adf55264fb101d2379e4420..575ec64ce95aaa7084206efff6bde0c8926751f3 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-location.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-location.md @@ -12,12 +12,12 @@ | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| align | [Alignment](ts-appendix-enums.md#alignment) | 设置元素内容在元素绘制区域内的对齐方式。
默认值:Alignment.Center | -| direction | [Direction](ts-appendix-enums.md#direction) | 设置元素水平方向的布局。
默认值:Direction.Auto | -| position | [Position](ts-types.md#position8) | 绝对定位,设置元素左上角相对于父容器左上角偏移位置。在布局容器中,设置该属性不影响父容器布局,仅在绘制时进行位置调整。 | -| markAnchor | [Position](ts-types.md#position8) | 设置元素在位置定位时的锚点,以元素左上角作为基准点进行偏移。通常配合position和offset属性使用,单独使用时,效果类似offset
默认值:
{
x: 0,
y: 0
} | -| offset | [Position](ts-types.md#position8) | 相对定位,设置元素相对于自身的偏移量。设置该属性,不影响父容器布局,仅在绘制时进行位置调整。
默认值:
{
x: 0,
y: 0
} | -| alignRules9+ | {
left?: { anchor: string, align: [HorizontalAlign](ts-appendix-enums.md#horizontalalign) };
right?: { anchor: string, align: [HorizontalAlign](ts-appendix-enums.md#horizontalalign) };
middle?: { anchor: string, align: [HorizontalAlign](ts-appendix-enums.md#horizontalalign) };
top?: { anchor: string, align: [VerticalAlign](ts-appendix-enums.md#verticalalign) };
bottom?: { anchor: string, align: [VerticalAlign](ts-appendix-enums.md#verticalalign) };
center?: { anchor: string, align: [VerticalAlign](ts-appendix-enums.md#verticalalign) }
} | 指定相对容器的对齐规则,仅当父容器为[RelativeContainer](ts-container-relativecontainer.md)时生效。
- left:设置左对齐参数。
- right:设置右对齐参数。
- middle:设置中间对齐的参数。
- top:设置顶部对齐的参数。
- bottom:设置底部对齐的参数。
- center:设置中心对齐的参数。
**说明:**
- anchor:设置作为锚点的组件的id值。
- align:设置相对于锚点组件的对齐方式。 | +| align | [Alignment](ts-appendix-enums.md#alignment) | 设置元素内容在元素绘制区域内的对齐方式。
默认值:Alignment.Center
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| direction | [Direction](ts-appendix-enums.md#direction) | 设置元素水平方向的布局。
默认值:Direction.Auto
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| position | [Position](ts-types.md#position8) | 绝对定位,设置元素左上角相对于父容器左上角偏移位置。在布局容器中,设置该属性不影响父容器布局,仅在绘制时进行位置调整。
适用于置顶显示、悬浮按钮等组件在父容器中位置固定的场景。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| markAnchor | [Position](ts-types.md#position8) | 设置元素在位置定位时的锚点,以元素左上角作为基准点进行偏移。通常配合position和offset属性使用,单独使用时,效果类似offset
默认值:
{
x: 0,
y: 0
}
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| offset | [Position](ts-types.md#position8) | 相对定位,设置元素相对于自身的偏移量。设置该属性,不影响父容器布局,仅在绘制时进行位置调整。
默认值:
{
x: 0,
y: 0
}
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| alignRules9+ | {
left?: { anchor: string, align: [HorizontalAlign](ts-appendix-enums.md#horizontalalign) };
right?: { anchor: string, align: [HorizontalAlign](ts-appendix-enums.md#horizontalalign) };
middle?: { anchor: string, align: [HorizontalAlign](ts-appendix-enums.md#horizontalalign) };
top?: { anchor: string, align: [VerticalAlign](ts-appendix-enums.md#verticalalign) };
bottom?: { anchor: string, align: [VerticalAlign](ts-appendix-enums.md#verticalalign) };
center?: { anchor: string, align: [VerticalAlign](ts-appendix-enums.md#verticalalign) }
} | 指定相对容器的对齐规则,仅当父容器为[RelativeContainer](ts-container-relativecontainer.md)时生效。
- left:设置左对齐参数。
- right:设置右对齐参数。
- middle:设置中间对齐的参数。
- top:设置顶部对齐的参数。
- bottom:设置底部对齐的参数。
- center:设置中心对齐的参数。
该接口支持在ArkTS卡片中使用。
**说明:**
- anchor:设置作为锚点的组件的id值。
- align:设置相对于锚点组件的对齐方式。 | ## 示例 @@ -32,19 +32,15 @@ struct PositionExample1 { Column({ space: 10 }) { // 元素内容<元素宽高,设置内容在与元素内的对齐方式 Text('align').fontSize(9).fontColor(0xCCCCCC).width('90%') - Text('top start') - .align(Alignment.TopStart) - .height(50) - .width('90%') - .fontSize(16) - .backgroundColor(0xFFE4C4) - - Text('Bottom end') - .align(Alignment.BottomEnd) - .height(50) - .width('90%') - .fontSize(16) - .backgroundColor(0xFFE4C4) + Stack() { + Text('First show in bottom end').height('65%').backgroundColor(0xD2B48C) + Text('Second show in bottom end').backgroundColor(0xF5DEB3).opacity(0.9) + }.width('90%').height(50).margin({ top: 5 }).backgroundColor(0xFFE4C4) + .align(Alignment.BottomEnd) + Stack() { + Text('top start') + }.width('90%').height(50).margin({ top: 5 }).backgroundColor(0xFFE4C4) + .align(Alignment.TopStart) // 父容器设置direction为Direction.Ltr,子元素从左到右排列 Text('direction').fontSize(9).fontColor(0xCCCCCC).width('90%') @@ -86,6 +82,7 @@ struct PositionExample2 { Text('position').fontSize(12).fontColor(0xCCCCCC).width('90%') Row() { Text('1').size({ width: '30%', height: '50' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(16) + .textAlign(TextAlign.Center) Text('2 position(30, 10)') .size({ width: '60%', height: '30' }) .backgroundColor(0xbbb2cb) @@ -94,6 +91,7 @@ struct PositionExample2 { .align(Alignment.Start) .position({ x: 30, y: 10 }) Text('3').size({ width: '45%', height: '50' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(16) + .textAlign(TextAlign.Center) Text('4 position(50%, 70%)') .size({ width: '50%', height: '50' }) .backgroundColor(0xbbb2cb) @@ -110,14 +108,20 @@ struct PositionExample2 { .size({ width: '100', height: '100' }) .backgroundColor(0xdeb887) Text('text') + .fontSize('30px') + .textAlign(TextAlign.Center) .size({ width: 25, height: 25 }) .backgroundColor(Color.Green) .markAnchor({ x: 25, y: 25 }) Text('text') + .fontSize('30px') + .textAlign(TextAlign.Center) .size({ width: 25, height: 25 }) .backgroundColor(Color.Green) .markAnchor({ x: -100, y: -25 }) Text('text') + .fontSize('30px') + .textAlign(TextAlign.Center) .size({ width: 25, height: 25 }) .backgroundColor(Color.Green) .markAnchor({ x: 25, y: -25 }) @@ -127,6 +131,7 @@ struct PositionExample2 { Text('offset').fontSize(12).fontColor(0xCCCCCC).width('90%') Row() { Text('1').size({ width: '15%', height: '50' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(16) + .textAlign(TextAlign.Center) Text('2 offset(15, 30)') .size({ width: 120, height: '50' }) .backgroundColor(0xbbb2cb) @@ -135,6 +140,7 @@ struct PositionExample2 { .align(Alignment.Start) .offset({ x: 15, y: 30 }) Text('3').size({ width: '15%', height: '50' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(16) + .textAlign(TextAlign.Center) Text('4 offset(-10%, 20%)') .size({ width: 100, height: '50' }) .backgroundColor(0xbbb2cb) 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 e95f066470d5881d87ab5b2e32b56b9b25a158a7..0368594df8a4a2c21c69d143b24dfbf28605d670 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 @@ -10,18 +10,37 @@ ## 属性 -| 名称 | 参数类型 | 描述 | +| 名称 | 参数类型 | 描述 | | ---------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | -| bindMenu | Array<[MenuItem](#menuitem)> \| [CustomBuilder](ts-types.md#custombuilder8) | 给组件绑定菜单,点击后弹出菜单。弹出菜单项支持文本和自定义两种功能。 | -| bindContextMenu8+ | content: [CustomBuilder](ts-types.md#custombuilder8),
responseType: [ResponseType](ts-appendix-enums.md#responsetype8) | 给组件绑定菜单,触发方式为长按或者右键点击,弹出菜单项需要自定义。 | +| bindMenu | content: Array<[MenuItem](#menuitem)> \| [CustomBuilder](ts-types.md#custombuilder8),
options: [MenuOptions](#menuoptions10) | 给组件绑定菜单,点击后弹出菜单。弹出菜单项支持图标+文本排列和自定义两种功能。
content: 必填,配置菜单项图标和文本的数组,或者自定义组件。
options: 非必填,配置弹出菜单的参数。 | +| bindContextMenu8+ | content: [CustomBuilder](ts-types.md#custombuilder8),
responseType: [ResponseType](ts-appendix-enums.md#responsetype8)
options: [ContextMenuOptions](#contextmenuoptions10) | 给组件绑定菜单,触发方式为长按或者右键点击,弹出菜单项需要自定义。
responseType: 必填。菜单弹出条件,长按或者右键点击。
options: 非必填,配置弹出菜单的参数。 | ## MenuItem -| 名称 | 类型 | 描述 | -| ------ | ----------------------- | ----------- | -| value | string | 菜单项文本。 | -| action | () => void | 点击菜单项的事件回调。 | - +| 名称 | 类型 | 必填 | 描述 | +| ------------------ | -------------------------------------- | ---- | ---------------------- | +| value | string | 是 | 菜单项文本。 | +| icon10+ | [ResourceStr](ts-types.md#resourcestr) | 否 | 菜单项图标。 | +| action | () => void | 是 | 点击菜单项的事件回调。 | + +## MenuOptions10+ + +| 名称 | 类型 | 必填 | 描述 | +| ------ | -------------------------------- | ---- | ------------------------------------------------------ | +| title | string | 否 | 菜单标题。 | +| offset | [Position](ts-types.md#position8) | 否 | 菜单弹出位置的偏移量,不会导致菜单显示超出屏幕范围。 | +| placement | [Placement](ts-appendix-enums.md#placement8) | 否 | 菜单组件优先显示的位置,当前位置显示不下时,会自动调整位置。
默认值:Placement.Bottom | +| onAppear | () => void | 否 | 菜单弹出时的事件回调。 | +| onDisappear | () => void | 否 | 菜单消失时的事件回调。 | + +## ContextMenuOptions10+ + +| 名称 | 类型 | 必填 | 描述 | +| ----------- | -------------------------------------------- | ---- | ------------------------------------------------------------ | +| offset | [Position](ts-types.md#position8) | 否 | 菜单弹出位置的偏移量,不会导致菜单显示超出屏幕范围。 | +| placement | [Placement](ts-appendix-enums.md#placement8) | 否 | 菜单组件优先显示的位置,当前位置显示不下时,会自动调整位置。
默认值:Placement.Bottom | +| onAppear | () => void | 否 | 菜单弹出时的事件回调。 | +| onDisappear | () => void | 否 | 菜单消失时的事件回调。 | ## 示例 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 e0fa17c2e61bab1acc534cb900ab81883deaba8b..5d852b468abaad2b32a99ca16a579add7d73c988 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 @@ -10,9 +10,9 @@ ## 属性 -| 名称 | 参数类型 | 描述 | -| ------- | ---------------------------------------- | ---------------------------------------- | -| opacity | number \| [Resource](ts-types.md#resource) | 元素的不透明度,取值范围为0到1,1表示不透明,0表示完全透明, 达到隐藏组件效果,但是在布局中占位。 默认值:1
**说明:**
子组件会继承父组件的透明度,并与自身的透明度属性叠加。如:父组件透明度为0.1,子组件设置透明度为0.8,则子组件实际透明度为0.1*0.8=0.08。| +| 名称 | 参数类型 | 描述 | +| ------- | ---------------------------------------------------- | ------------------------------------------------------------ | +| opacity | number \| [Resource](ts-types.md#resource) | 元素的不透明度,取值范围为0到1,1表示不透明,0表示完全透明, 达到隐藏组件效果,但是在布局中占位。 默认值:1
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
子组件会继承父组件的透明度,并与自身的透明度属性叠加。如:父组件透明度为0.1,子组件设置透明度为0.8,则子组件实际透明度为0.1*0.8=0.08。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-overlay.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-overlay.md index 153cb7f34463052a855476f22fda8b76ddbb2233..95da98af8a3393950bb33a6a621671cacd1f33a4 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-overlay.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-overlay.md @@ -10,7 +10,7 @@ | 名称 | 参数类型 | 默认值 | 描述 | | -------- | -------- | -------- | -------- | -| overlay | value: string,
options?: {
align?: [Alignment](ts-appendix-enums.md#alignment), 
offset?: {x?: number, y?: number}
} | {
align: Alignment.Center,
offset: {0, 0}
} | 在当前组件上,增加遮罩文本。
value: 遮罩文本内容。
options: 文本定位,align设置文本相对于组件的方位,[offset](ts-universal-attributes-location.md)为文本基于自身左上角的偏移量。文本默认处于组件左上角。
两者都设置时效果重叠,文本相对于组件方位定位后再基于当前位置文本的左上角进行偏移。 | +| overlay | value: string,
options?: {
align?: [Alignment](ts-appendix-enums.md#alignment), 
offset?: {x?: number, y?: number}
} | {
align: Alignment.Center,
offset: {0, 0}
} | 在当前组件上,增加遮罩文本。
value: 遮罩文本内容。
options: 文本定位,align设置文本相对于组件的方位,[offset](ts-universal-attributes-location.md)为文本基于自身左上角的偏移量。文本默认处于组件左上角。
两者都设置时效果重叠,文本相对于组件方位定位后再基于当前位置文本的左上角进行偏移。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-pixelStretchEffect.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-pixelStretchEffect.md new file mode 100644 index 0000000000000000000000000000000000000000..d99b8e9f43e3f86d4831f4341bf72680d14f683b --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-pixelStretchEffect.md @@ -0,0 +1,76 @@ +# 图像边缘像素扩展效果 + +设置组件的图像边缘像素扩展效果。 + +> **说明:** +> +> 从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。此接口为系统接口。 + +## 属性 + +| 名称 | 参数类型 | 描述 | +| -------- | -------- | -------- | +| pixelStretchEffect | [PixelStretchEffectOptions](ts-types.md#PixelStretchEffectOptions) | 设置组件的图像边缘像素扩展距离。
参数`options`包括上下左右四个方向的边缘像素扩展距离。
**说明:**
1、如果距离为正值,表示向外扩展,放大原来图像大小。上下左右四个方向分别用边缘像素填充,填充的距离即为设置的边缘扩展的距离。
2、如果距离为负值,表示内缩,但是最终图像大小不变。内缩方式:1、图像根据`options`的设置缩小,缩小大小为四个方向边缘扩展距离的绝对值。2、图像用边缘像素扩展到原来大小。
3、对`options`的输入约束:1、上下左右四个方向的扩展统一为非正值或者非负值。即四个边同时向外扩或者内缩,方向一致。2、所有方向的输入均为百分比或者具体值,不支持百分比和具体值混用。3、所有异常情况下,显示为{0,0,0,0}效果,即跟原图保持一致。| + +## 示例 + +### 示例1 + +```ts +// xxx.ets +@Entry +@Component +struct PixelStretchExample { + build() { + Stack() { + Text('This is the text content with letterSpacing 0.') + .letterSpacing(0) + .fontSize(12) + .border({ width: 1 }) + .padding(10) + .width('50%') + .pixelStretchEffect({top:10,left:10,right:10,bottom:10 }) + }.alignContent(Alignment.Center).width("100%").height("100%") + } +} + +``` +效果图如下: + +![textPixelStretch1](figures/textPixelStretch1.png) + +去掉pixelStretchEffect的设置,原图效果如下: + +![textPixelStretch2](figures/textPixelStretch2.png) + +对比发现,如果边缘扩展距离设置为正值,图像向外扩展了边缘距离。 + +### 示例2 + +基于示例1,现在把边缘扩展距离改为非正值。 + +```ts +// xxx.ets +@Entry +@Component +struct PixelStretchExample { + build() { + Stack() { + Text('This is the text content with letterSpacing 0.') + .letterSpacing(0) + .fontSize(12) + .border({ width: 1 }) + .padding(10) + .width('50%') + .pixelStretchEffect({top:-10,left:-10,right:-10,bottom:-10 }) + }.alignContent(Alignment.Center).width("100%").height("100%") + } +} +``` +效果图如下: + +![textPixelStretch3](figures/textPixelStretch3.png) + +跟原图对比发现,效果图分两步实现:
1、原图大小缩小,缩小后的大小为原图大小减去像素 +收缩的距离。例如,原图大小为`100*100`,设置了`pixelStretchEffect({top:-10,left:-10, +right:-10,bottom:-10 })`,则缩小后的大小为`(100-10-10)*(100-10-10)`,即`80*80`。
2、使用边缘像素扩展,将图像扩展为原图大小。 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 eebd642335745d02b1f2ed25dd864901462278e7..cefbbec1b1992760edf17069900d024c4ba9a32c 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 @@ -11,10 +11,12 @@ | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| stateStyles | StateStyles | 设置组件不同状态的样式。 | +| stateStyles | StateStyles | 设置组件不同状态的样式。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## StateStyles接口说明 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 类型 | 必填 | 描述 | | -------- | -------- | -------- | -------- | | normal | ()=>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 54de8ab03769624a928d9a1dc3e2fe4fe3b2353a..78d5ef99f809051c57c17570600bc562bb5422fd 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 @@ -10,37 +10,45 @@ ## 接口 -| 名称 | 参数类型 | 描述 | -| ---------- | ------------------------------------- | --------------------------------------- | -| bindPopup | show: boolean,
popup: [PopupOptions](#popupoptions类型说明) \| [CustomPopupOptions](#custompopupoptions8类型说明)8+ | 给组件绑定Popup弹窗,设置参数show为true弹出弹框。
show: 弹窗显示状态,默认值为false,隐藏弹窗。
popup: 配置当前弹窗提示的参数。 | +| 名称 | 参数类型 | 描述 | +| --------- | ---------------------------------------- | ---------------------------------------- | +| bindPopup | show: boolean,
popup: [PopupOptions](#popupoptions类型说明) \| [CustomPopupOptions](#custompopupoptions8类型说明)8+ | 给组件绑定Popup弹窗,设置参数show为true弹出弹框。
show: 弹窗显示状态,默认值为false,隐藏弹窗。
popup: 配置当前弹窗提示的参数。 | ## PopupOptions类型说明 -| 名称 | 类型 | 必填 | 描述 | -| -------------------------| ------------------------------------------------| -----| ----------------------------------------- | -| message | string | 是 | 弹窗信息内容。 | -| placementOnTop | boolean | 否 | 是否在组件上方显示,默认值为false。 | -| primaryButton | {
value: string,
action: () => void
} | 否 | 第一个按钮。
value: 弹窗里主按钮的文本。
action: 点击主按钮的回调函数。 | -| secondaryButton | {
value: string,
action: () => void
} | 否 | 第二个按钮。
value: 弹窗里辅助按钮的文本。
action: 点击辅助按钮的回调函数。 | -| onStateChange | (event: { isVisible: boolean }) => void | 否 | 弹窗状态变化事件回调,参数isVisible为弹窗当前的显示状态。 | -| arrowOffset9+ | [Length](ts-types.md#length) | 否 | popup箭头在弹窗处的偏移。箭头在气泡上下方时,数值为0表示箭头居最左侧,偏移量为箭头至最左侧的距离,默认居中。箭头在气泡左右侧时,偏移量为箭头至最上侧的距离,默认居中。如果显示在屏幕边缘,气泡会自动左右偏移,数值为0时箭头始终指向绑定组件。 | -| showInSubWindow9+ | boolean | 否 | 是否在子窗口显示气泡,默认值为false。 | -| mask10+ | boolean \| [ResourceColor](ts-types.md#resourcecolor) | 否 | 设置气泡是否有遮罩层及遮罩颜色。如果设置为false,则没有遮罩层;如果设置为true,则设置有遮罩层并且颜色为透明色;如果设置为Color,则为遮罩层的颜色。 | - +| 名称 | 类型 | 必填 | 描述 | +| ---------------------------- | ---------------------------------------- | ---- | ---------------------------------------- | +| message | string | 是 | 弹窗信息内容。 | +| placementOnTop | boolean | 否 | 是否在组件上方显示,默认值为false。 | +| primaryButton | {
value: string,
action: () => void
} | 否 | 第一个按钮。
value: 弹窗里主按钮的文本。
action: 点击主按钮的回调函数。 | +| secondaryButton | {
value: string,
action: () => void
} | 否 | 第二个按钮。
value: 弹窗里辅助按钮的文本。
action: 点击辅助按钮的回调函数。 | +| onStateChange | (event: { isVisible: boolean }) => void | 否 | 弹窗状态变化事件回调,参数isVisible为弹窗当前的显示状态。 | +| arrowOffset9+ | [Length](ts-types.md#length) | 否 | popup箭头在弹窗处的偏移。箭头在气泡上下方时,数值为0表示箭头居最左侧,偏移量为箭头至最左侧的距离,默认居中。箭头在气泡左右侧时,偏移量为箭头至最上侧的距离,默认居中。如果显示在屏幕边缘,气泡会自动左右偏移,数值为0时箭头始终指向绑定组件。 | +| showInSubWindow9+ | boolean | 否 | 是否在子窗口显示气泡,默认值为false。 | +| mask10+ | boolean \| [ResourceColor](ts-types.md#resourcecolor) | 否 | 设置气泡是否有遮罩层及遮罩颜色。如果设置为false,则没有遮罩层;如果设置为true,则设置有遮罩层并且颜色为透明色;如果设置为Color,则为遮罩层的颜色。 | +| messageOptions10+ | [PopupMessageOptions](#popupmessageoptions10) | 否 | 设置弹窗信息文本参数。 | +| targetSpace10+ | [Length](ts-types.md#length) | 否 | 设置popup与目标的间隙。 | + +## PopupMessageOptions10+类型说明 + +| 名称 | 类型 | 必填 | 描述 | +| --------- | ---------------------------------------- | ---- | ----------- | +| textColor | [ResourceColor](ts-types.md#resourcecolor) | 否 | 设置弹窗信息文本颜色。 | +| font | [Font](ts-types.md#Font) | 否 | 设置弹窗信息字体属性。 | ## CustomPopupOptions8+类型说明 -| 名称 | 类型 | 必填 | 描述 | -| -------------------------| ------------------------- | ---- | ---------------------------------------------------- | -| builder | [CustomBuilder](ts-types.md#custombuilder8) | 是 | 提示气泡内容的构造器。 | -| placement | [Placement](ts-appendix-enums.md#placement8) | 否 | 气泡组件优先显示的位置,当前位置显示不下时,会自动调整位置。
默认值:Placement.Bottom | -| popupColor | [ResourceColor](ts-types.md#resourcecolor) | 否 | 提示气泡的颜色。 | -| enableArrow | boolean | 否 | 是否显示箭头。
从API Version 9开始,如果箭头所在方位侧的气泡长度不足以显示下箭头,则会默认不显示箭头。比如:placement设置为Left,但气泡高度小于箭头的宽度的两倍(64vp),则实际不会显示箭头。
默认值:true | -| autoCancel | boolean | 否 | 页面有操作时,是否自动关闭气泡。
默认值:true | -| onStateChange | (event: { isVisible: boolean }) => void | 否 | 弹窗状态变化事件回调,参数为弹窗当前的显示状态。 | -| arrowOffset9+ | [Length](ts-types.md#length) | 否 | popup箭头在弹窗处的偏移。箭头在气泡上下方时,数值为0表示箭头居最左侧,偏移量为箭头至最左侧的距离,默认居中。箭头在气泡左右侧时,偏移量为箭头至最上侧的距离,默认居中。如果显示在屏幕边缘,气泡会自动左右偏移,数值为0时箭头始终指向绑定组件。 | -| showInSubWindow9+ | boolean | 否 | 是否在子窗口显示气泡,默认值为false。 | -| mask10+ | boolean \| [ResourceColor](ts-types.md#resourcecolor) | 否 | 设置气泡是否有遮罩层及遮罩颜色。如果设置为false,则没有遮罩层;如果设置为true,则设置有遮罩层并且颜色为透明色;如果设置为Color,则为遮罩层的颜色。 | - +| 名称 | 类型 | 必填 | 描述 | +| ---------------------------- | ---------------------------------------- | ---- | ---------------------------------------- | +| builder | [CustomBuilder](ts-types.md#custombuilder8) | 是 | 提示气泡内容的构造器。 | +| placement | [Placement](ts-appendix-enums.md#placement8) | 否 | 气泡组件优先显示的位置,当前位置显示不下时,会自动调整位置。
默认值:Placement.Bottom | +| popupColor | [ResourceColor](ts-types.md#resourcecolor) | 否 | 提示气泡的颜色。 | +| enableArrow | boolean | 否 | 是否显示箭头。
从API Version 9开始,如果箭头所在方位侧的气泡长度不足以显示下箭头,则会默认不显示箭头。比如:placement设置为Left,此时如果气泡高度小于箭头的宽度(32vp)与气泡圆角两倍(48vp)之和(80vp),则实际不会显示箭头。
默认值:true | +| autoCancel | boolean | 否 | 页面有操作时,是否自动关闭气泡。
默认值:true | +| onStateChange | (event: { isVisible: boolean }) => void | 否 | 弹窗状态变化事件回调,参数为弹窗当前的显示状态。 | +| arrowOffset9+ | [Length](ts-types.md#length) | 否 | popup箭头在弹窗处的偏移。箭头在气泡上下方时,数值为0表示箭头居最左侧,偏移量为箭头至最左侧的距离,默认居中。箭头在气泡左右侧时,偏移量为箭头至最上侧的距离,默认居中。如果显示在屏幕边缘,气泡会自动左右偏移,数值为0时箭头始终指向绑定组件。 | +| showInSubWindow9+ | boolean | 否 | 是否在子窗口显示气泡,默认值为false。 | +| mask10+ | boolean \| [ResourceColor](ts-types.md#resourcecolor) | 否 | 设置气泡是否有遮罩层及遮罩颜色。如果设置为false,则没有遮罩层;如果设置为true,则设置有遮罩层并且颜色为透明色;如果设置为Color,则为遮罩层的颜色。 | +| targetSpace10+ | [Length](ts-types.md#length) | 否 | 设置popup与目标的间隙。 | ## 示例 ```ts @@ -103,7 +111,7 @@ struct PopupExample { .bindPopup(this.customPopup, { builder: this.popupBuilder, placement: Placement.Top, - mask: {color: 0x33000000}, + maskColor: '0x33000000', popupColor: Color.Yellow, enableArrow: true, showInSubWindow: false, 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 00fe83401f13a4feded827a272cdba5dad75f4a9..ec3199756cb5a8540ec57e1fcf176ae937400c60 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 @@ -12,12 +12,57 @@ | 名称 | 参数类型 | 描述 | | -----| ------------------------------------------ | ------------------------------------ | -| clip | [Circle](ts-drawing-components-circle.md) \| [Ellipse](ts-drawing-components-ellipse.md) \| [Path](ts-drawing-components-path.md) \| [Rect](ts-drawing-components-rect.md) \| boolean | 参数为相应类型的组件,按指定的形状对当前组件进行裁剪;参数为boolean类型时,设置是否按照父容器边缘轮廓进行裁剪。
默认值:false | -| mask | [Circle](ts-drawing-components-circle.md) \| [Ellipse](ts-drawing-components-ellipse.md) \| [Path](ts-drawing-components-path.md) \| [Rect](ts-drawing-components-rect.md) | 在当前组件上加上指定形状的遮罩。 | +| clip | [Circle](ts-drawing-components-circle.md) \| [Ellipse](ts-drawing-components-ellipse.md) \| [Path](ts-drawing-components-path.md) \| [Rect](ts-drawing-components-rect.md) \| boolean | 参数为相应类型的组件,按指定的形状对当前组件进行裁剪;参数为boolean类型时,设置是否按照父容器边缘轮廓进行裁剪。
默认值:false
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| mask | [Circle](ts-drawing-components-circle.md) \| [Ellipse](ts-drawing-components-ellipse.md) \| [Path](ts-drawing-components-path.md) \| [Rect](ts-drawing-components-rect.md)\| [ProgressMask](##progressmask10)  | 在当前组件上加上指定形状的遮罩。
从API version 9开始,该接口支持在ArkTS卡片中使用。
从API version 10开始,该接口支持ProgressMask参数。 | + +## ProgressMask10+ + +ProgressMask设置遮罩的进度、最大值和遮罩颜色。 + +### constructor10+ + +constructor(value: number, total: number, color: ResourceColor) + +构造ProgressMask对象。 + +**参数:** + +| 参数名 | 参数类型 | 必填 | 参数描述 | +| ------ | ------------------------------------------ | ---- | ------------------ | +| value | number | 是 | 进度遮罩的当前值。 | +| total | number | 是 | 进度遮罩的最大值。 | +| color | [ResourceColor](ts-types.md#resourcecolor) | 是 | 进度遮罩的颜色。 | + +### updateProgress10+ + +updateProgress(value: number): void + +更新进度遮罩的进度值。 + +**参数:** + +| 参数名 | 参数类型 | 必填 | 参数描述 | +| ------ | -------- | ---- | ------------------ | +| value | number | 是 | 进度遮罩的当前值。 | + +### updateColor10+ + +updateColor(value: ResourceColor): void + +更新进度遮罩的颜色。 + +**参数:** + +| 参数名 | 参数类型 | 必填 | 参数描述 | +| ------ | ------------------------------------------ | ---- | ---------------- | +| value | [ResourceColor](ts-types.md#resourcecolor) | 是 | 进度遮罩的颜色。 | + ## 示例 +### 示例1 + ```ts // xxx.ets @Entry @@ -53,4 +98,62 @@ struct ClipAndMaskExample { } ``` -![clipAndMask](figures/clipAndMask.PNG) \ No newline at end of file +![clipAndMask](figures/clipAndMask.PNG) + +### 示例2 + +```ts +@Entry +@Component +struct ProgressMask { + @State progressflag1: boolean = true; + @State color: Color = 0x01006CDE; + @State value: number = 10.0; + @State progress: ProgressMask = new ProgressMask(10.0, 100.0, Color.Gray); + build() { + Column({ space: 15 }) { + Text('progress mask').fontSize(12).width('75%').fontColor('#DCDCDC') + // 给图片添加了一个280px*280px的进度遮罩 + Image($r('app.media.testImg')) + .width('500px').height('280px') + .mask(this.progress) + .animation({ + duration: 2000, // 动画时长 + curve: Curve.Linear, // 动画曲线 + delay: 0, // 动画延迟 + iterations: 1, // 播放次数 + playMode: PlayMode.Normal // 动画模式 + }) // 对Button组件的宽高属性进行动画配置 + + // 更新进度遮罩的进度值 + Button('updateProgress') + .onClick((event: ClickEvent) => { + this.value += 10; + this.progress.updateProgress(this.value); + }).width(200).height(50).margin(20) + + // 更新进度遮罩的颜色 + Button('updateColor') + .onClick((event: ClickEvent) => { + if (this.progressflag1) { + this.progress.updateColor(0x9fff0000); + } else { + this.progress.updateColor(0x9f0000ff); + } + this.progressflag1 = !this.progressflag1 + }).width(200).height(50).margin(20) + + // 恢复进度遮罩 + Button('click reset!') + .onClick((event: ClickEvent) => { + this.value = 0; + this.progress.updateProgress(this.value); + }).width(200).height(50).margin(20) + } + .width('100%') + .margin({ top: 15 }) + } +} +``` + +![progressMask](figures/progressMask.PNG) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-size.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-size.md index a4e65b50d26c7e4188f3ffc9409c6abf3a1265c5..ae2a96ee9a199d25f891ccb2c566a7d85d8d4495 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-size.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-size.md @@ -10,15 +10,15 @@ ## 属性 -| 名称 | 参数说明 | 描述 | -| -------------- | ---------------------------------------- | ---------------------------------------- | -| width | [Length](ts-types.md#length) | 设置组件自身的宽度,缺省时使用元素自身内容需要的宽度。若子组件的宽大于父组件的宽,则会画出父组件的范围。 | -| height | [Length](ts-types.md#length) | 设置组件自身的高度,缺省时使用元素自身内容需要的高度。若子组件的高大于父组件的高,则会画出父组件的范围。 | -| size | {
width?: [Length](ts-types.md#length),
height?: [Length](ts-types.md#length)
} | 设置高宽尺寸。 | -| padding | [Padding](ts-types.md#padding) \| [Length](ts-types.md#length) | 设置内边距属性。
参数为Length类型时,四个方向内边距同时生效。
默认值:0
padding设置百分比时,上下左右内边距均以父容器的width作为基础值。 | -| margin | [Margin](ts-types.md#margin) \| [Length](ts-types.md#length) | 设置外边距属性。
参数为Length类型时,四个方向外边距同时生效。
默认值:0
margin设置百分比时,上下左右外边距均以父容器的width作为基础值。| -| constraintSize | {
minWidth?: [Length](ts-types.md#length),
maxWidth?: [Length](ts-types.md#length),
minHeight?: [Length](ts-types.md#length),
maxHeight?: [Length](ts-types.md#length)
} | 设置约束尺寸,组件布局时,进行尺寸范围限制。constraintSize的优先级高于Width和Height。若设置的minWidth大于maxWidth,则minWidth生效,minHeight与maxHeight同理。
默认值:
{
minWidth: 0,
maxWidth: Infinity,
minHeight: 0,
maxHeight: Infinity
} | -| layoutWeight | number \| string | 父容器尺寸确定时,设置了layoutWeight属性的子元素与兄弟元素占主轴尺寸按照权重进行分配,忽略元素本身尺寸设置,表示自适应占满剩余空间。
**说明:**
仅在Row/Column/Flex布局中生效。| +| 名称 | 参数说明 | 描述 | +| -------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | +| width | [Length](ts-types.md#length) | 设置组件自身的宽度,缺省时使用元素自身内容需要的宽度。若子组件的宽大于父组件的宽,则会画出父组件的范围。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| height | [Length](ts-types.md#length) | 设置组件自身的高度,缺省时使用元素自身内容需要的高度。若子组件的高大于父组件的高,则会画出父组件的范围。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| size | {
width?: [Length](ts-types.md#length),
height?: [Length](ts-types.md#length)
} | 设置高宽尺寸。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| padding | [Padding](ts-types.md#padding) \| [Length](ts-types.md#length) | 设置内边距属性。
参数为Length类型时,四个方向内边距同时生效。
默认值:0
padding设置百分比时,上下左右内边距均以父容器的width作为基础值。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| margin | [Margin](ts-types.md#margin) \| [Length](ts-types.md#length) | 设置外边距属性。
参数为Length类型时,四个方向外边距同时生效。
默认值:0
margin设置百分比时,上下左右外边距均以父容器的width作为基础值。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| constraintSize | {
minWidth?: [Length](ts-types.md#length),
maxWidth?: [Length](ts-types.md#length),
minHeight?: [Length](ts-types.md#length),
maxHeight?: [Length](ts-types.md#length)
} | 设置约束尺寸,组件布局时,进行尺寸范围限制。constraintSize的优先级高于Width和Height。若设置的minWidth大于maxWidth,则minWidth生效,minHeight与maxHeight同理。
默认值:
{
minWidth: 0,
maxWidth: Infinity,
minHeight: 0,
maxHeight: Infinity
}
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| layoutWeight | number \| string | 父容器尺寸确定时,设置了layoutWeight属性的子元素与兄弟元素占主轴尺寸按照权重进行分配,忽略元素本身尺寸设置,表示自适应占满剩余空间。
默认值:0
从API version 9开始,该接口支持在ArkTS卡片中使用。
**说明:**
仅在Row/Column/Flex布局中生效。
可选值为大于等于0的数字,或者可以转换为数字的字符串。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-sphericalEffect.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-sphericalEffect.md new file mode 100644 index 0000000000000000000000000000000000000000..921a8085250cae49106d0c3c15ff148c747f8045 --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-sphericalEffect.md @@ -0,0 +1,49 @@ +# 图像球面效果 + +设置组件的图像球面效果。 + +> **说明:** +> +> 从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。此接口为系统接口。 + +## 属性 + +| 名称 | 参数类型 | 描述 | +| -------- | -------- | -------- | +| sphericalEffect | [number] | 设置组件的图像球面化程度。
取值范围:[0,1]。
**说明:**
1、如果value等于0则图像保持原样,如果value等于1则图像为完全球面化效果。在0和1之间,数值越大,则球面化程度越高。
`value < 0 `或者` value > 1`为异常情况,`value < 0`按0处理,`value > 1`按1处理。
2、如果组件的图像使用异步加载,则不支持球面效果。例如Image组件默认使用异步加载,如果要使用球面效果,就要设置`syncLoad`为`true`,但是这种做法不推荐。`backgroundImage`也是使用异步加载,所以如果设置了`backgroundImage`,不支持球面效果。
3、如果组件设置了阴影,不支持球面效果。| + +## 示例 + +### 示例1 +```ts +// xxx.ets +@Entry +@Component +struct SphericalEffectExample { + build() { + Stack() { + TextInput({ placeholder: "请输入变化范围百分比([0%,100%])"}) + .width('50%') + .height(35) + .type(InputType.Number) + .enterKeyType(EnterKeyType.Done) + .caretColor(Color.Red) + .placeholderColor(Color.Blue) + .placeholderFont({ + size: 20, + style: FontStyle.Italic, + weight: FontWeight.Bold + }) + .sphericalEffect(0.5) + }.alignContent(Alignment.Center).width("100%").height("100%") + } +} + +``` +效果图如下: + +![textInputSpherical1](figures/textInputSpherical1.png) + +去掉sphericalEffect的设置,效果如下: + +![textInputSpherical2](figures/textInputSpherical2.png) \ No newline at end of file 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 5491d40f9dabbf8166d19255f7e1723d23dae0bc..3cd1617601ff2bd83cc79b17ccb78e05868ab016 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,6 @@ -# 文本样式设置 +# 文本通用属性 -针对包含文本元素的组件,设置文本样式。 +文本通用属性目前只针对包含文本元素的组件,设置文本样式。 > **说明:** > @@ -13,11 +13,13 @@ | 名称 | 参数类型 | 描述 | | -----------| ---------------------------------------- | ------------------------------------ | -| fontColor | [ResourceColor](ts-types.md#resourcecolor) | 设置字体颜色。 | -| fontSize | [Length](ts-types.md#length) | 设置字体大小,Length为number类型时,使用fp单位。字体默认大小16。不支持设置百分比字符串。 | -| fontStyle | [FontStyle](ts-appendix-enums.md#fontstyle) | 设置字体样式。
默认值:FontStyle.Normal | -| fontWeight | number \| [FontWeight](ts-appendix-enums.md#fontweight) \| string | 设置文本的字体粗细,number类型取值[100, 900],取值间隔为100,默认为400,取值越大,字体越粗。string类型仅支持number类型取值的字符串形式,例如"400",以及"bold"、"bolder"、"lighter"、"regular"、"medium",分别对应FontWeight中相应的枚举值。
默认值:FontWeight.Normal | -| fontFamily | string \| [Resource](ts-types.md#resource) | 设置字体列表。默认字体'HarmonyOS Sans',且当前只支持这种字体。| +| fontColor | [ResourceColor](ts-types.md#resourcecolor) | 设置字体颜色。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| fontSize | [Length](ts-types.md#length) | 设置字体大小,Length为number类型时,使用fp单位。字体默认大小16。不支持设置百分比字符串。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| fontStyle | [FontStyle](ts-appendix-enums.md#fontstyle) | 设置字体样式。
默认值:FontStyle.Normal
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| fontWeight | number \| [FontWeight](ts-appendix-enums.md#fontweight) \| string | 设置文本的字体粗细,number类型取值[100, 900],取值间隔为100,默认为400,取值越大,字体越粗。string类型仅支持number类型取值的字符串形式,例如"400",以及"bold"、"bolder"、"lighter"、"regular"、"medium",分别对应FontWeight中相应的枚举值。
默认值:FontWeight.Normal
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| fontFamily | string \| [Resource](ts-types.md#resource) | 设置字体列表。默认字体'HarmonyOS Sans',且当前只支持这种字体。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| lineHeight | string \| number \| [Resource](ts-types.md#resource) | 设置文本的文本行高,设置值不大于0时,不限制文本行高,自适应字体大小,Length为number类型时单位为fp。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| decoration | {
type: [TextDecorationType](ts-appendix-enums.md#textdecorationtype),
color?: [ResourceColor](ts-types.md#resourcecolor)
} | 设置文本装饰线样式及其颜色。
默认值:{
type: TextDecorationType.None,
color:Color.Black
}
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 @@ -58,4 +60,4 @@ struct TextStyleExample { } ``` -![textstyle](figures/textstyle.PNG) +![textstyle](figures/textstyle.png) diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-touch-target.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-touch-target.md index aa8a4903a08a0394c911ef53a797789add582904..6782a448b7d950d0a2d3eee53ebe50a3f0fcbc54 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-touch-target.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-touch-target.md @@ -11,12 +11,15 @@ ## 属性 -| 名称 | 参数类型 | 描述 | -| -------------- | --------------------------------------------- | ----------------------------------------- | -| responseRegion | Array<[Rectangle](#rectangle对象说明)> \| [Rectangle](#rectangle对象说明) | 设置一个或多个触摸热区,包括位置和大小。
默认触摸热区为整个组件,默认值:
{
x:0,
y:0,
width:'100%',
height:'100%'
} | +| 名称 | 参数类型 | 描述 | +| -------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | +| responseRegion | Array<[Rectangle](#rectangle对象说明)> \| [Rectangle](#rectangle对象说明) | 设置一个或多个触摸热区,包括位置和大小。
默认触摸热区为整个组件,默认值:
{
x:0,
y:0,
width:'100%',
height:'100%'
}
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## Rectangle对象说明 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 类型 | 必填 | 描述 | | ------ | ----------------------------- | -----| -------------------------------- | | x | [Length](ts-types.md#length) | 否 | 触摸点相对于组件左上角的x轴坐标。
默认值:0vp | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-transformation.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-transformation.md index 2c9869a9dce1c8dc8f81791848d0a7293b516d43..946e084308de2e15002518ad952f94909022ccf8 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-transformation.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-transformation.md @@ -9,13 +9,16 @@ ## 属性 -| 名称 | 参数类型 | 描述 | -| --------- | ------------------------------------------------------------ | ------------------------------------------------------------ | -| rotate | {
x?: number,
y?: number,
z?: number,
angle?: number \| string,
centerX?: number \| string,
centerY?: number \| string
} | (x, y, z)指定一个矢量,表示旋转轴,正角度为顺时针转动,负角度为逆时针转动,默认值为0,同时可以通过centerX和centerY设置旋转的中心点。
默认值:
{
x: 0,
y: 0,
z: 0,
angle: 0,
centerX: '50%',
centerY: '50%'
} | -| translate | {
x?: number \| string,
y?: number \| string,
z? : number \| string
} | 可以分别设置X轴、Y轴、Z轴的平移距离,距离的正负控制平移的方向。不支持百分比形式的输入。
默认值:
{
x: 0,
y: 0,
z: 0
} | -| scale | {
x?: number,
y?: number,
z?: number,
centerX?: number \| string,
centerY?: number \| string
} | 可以分别设置X轴、Y轴、Z轴的缩放比例,默认值为1,同时可以通过centerX和centerY设置缩放的中心点。
默认值:
{
x: 1,
y: 1,
z: 1,
centerX:'50%',
centerY:'50%'
} | -| transform | [Matrix4Transit](../apis/js-apis-matrix4.md) | 设置当前组件的变换矩阵。 | +| 名称 | 参数类型 | 描述 | +| --------- | ---------------------------------------- | ---------------------------------------- | +| rotate | {
x?: number,
y?: number,
z?: number,
angle: number \| string,
centerX?: number \| string,
centerY?: number \| string
} | 可使组件在以组件左上角为坐标原点的坐标系中进行旋转(坐标系如下图所示)。其中,(x, y, z)指定一个矢量,作为旋转轴。
- angle:旋转角度。取值为正时相对于旋转轴方向顺时针转动,取值为负时相对于旋转轴方向逆时针转动。取值可为string类型,如'90deg'。
- centerX和centerY用于指定旋转的中心点。
旋转轴和旋转中心点都基于坐标系设定,组件发生位移时,坐标系不会随之移动。
默认值:
{
x: 0,
y: 0,
z: 0,
centerX: '50%',
centerY: '50%'
}
![coordinates](figures/coordinates.png)
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| translate | {
x?: number \| string,
y?: number \| string,
z? : number \| string
} | 可使组件在以组件左上角为坐标原点的坐标系中进行移动(坐标系如下图所示)。其中,x,y,z的值分别表示在对应轴移动的距离,值为正时表示向对应轴的正向移动,值为负时表示向对应轴的反向移动。移动距离支持数字和字符串(比如'10px',‘10%’)两种类型。
默认值:
{
x: 0,
y: 0,
z: 0
}
![coordinates](figures/coordinates.png)
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| scale | {
x?: number,
y?: number,
z?: number,
centerX?: number \| string,
centerY?: number \| string
} | 可以分别设置X轴、Y轴、Z轴的缩放比例,默认值为1,同时可以通过centerX和centerY设置缩放的中心点。
默认值:
{
x: 1,
y: 1,
z: 1,
centerX:'50%',
centerY:'50%'
}
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| transform | [Matrix4Transit](../apis/js-apis-matrix4.md) | 设置当前组件的变换矩阵。 | +> **说明:** +> +> 当组件同时设置了rotate和scale属性时,centerX和centerY的取值会发生冲突,此时centerX和centerY的值以后设定属性的值为准。 ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-visibility.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-visibility.md index acb3efd2c503f4f5cc370d2e53c651103b38add4..5b7a87e18a1559e28ac06f63036d8a85de90f15b 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-visibility.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-visibility.md @@ -10,7 +10,7 @@ | 名称 | 参数类型 | 描述 | | ---------- | ---------------------------- | ------------------------------------------ | -| visibility | [Visibility](ts-appendix-enums.md#visibility) | 控制当前组件显示或隐藏。注意,即使组件处于隐藏状态,在页面刷新时仍存在重新创建过程,因此当对性能有严格要求时建议使用[条件渲染](../../quick-start/arkts-rendering-control.md#条件渲染)代替。
默认值:Visibility.Visible| +| visibility | [Visibility](ts-appendix-enums.md#visibility) | 控制当前组件显示或隐藏。注意,即使组件处于隐藏状态,在页面刷新时仍存在重新创建过程,因此当对性能有严格要求时建议使用[条件渲染](../../quick-start/arkts-rendering-control-ifelse.md)代替。
默认值:Visibility.Visible
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-z-order.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-z-order.md index 60f6b667a8060ce86195496e469633dcf958602d..672db61316eb41f45aacc885faa821b8db9996f7 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-z-order.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-attributes-z-order.md @@ -12,7 +12,7 @@ | 名称 | 参数类型 | 描述 | | -------- | -------- | -------- | -| zIndex | number | 同一容器中兄弟组件显示层级关系。zIndex值越大,显示层级越高,即zIndex值大的组件会覆盖在zIndex值小的组件上方。 | +| zIndex | number | 同一容器中兄弟组件显示层级关系。zIndex值越大,显示层级越高,即zIndex值大的组件会覆盖在zIndex值小的组件上方。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-component-visible-area-change-event.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-component-visible-area-change-event.md index ef742a9b6e92db10ca0c52ca5183d30f8318776c..69cfb3c75aa80b389630c4905ac4f41167c683e8 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-component-visible-area-change-event.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-component-visible-area-change-event.md @@ -98,7 +98,7 @@ struct ScrollExample { .scrollable(ScrollDirection.Vertical) .scrollBar(BarState.On) .scrollBarColor(Color.Gray) - .scrollBarWidth(30) + .scrollBarWidth(10) .onScroll((xOffset: number, yOffset: number) => { console.info(xOffset + ' ' + yOffset) }) 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 33f2d964f4432eecd591abb1d4d0992328f2b0ff..2e84bd5c8327546e79e4c4f3150931f3e2c8d857 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 @@ -11,9 +11,12 @@ | 名称 | 支持冒泡 | 功能描述 | | ---------------------------------------- | ---- | --------------------------------- | -| onClick(event: (event?: ClickEvent) => void) | 否 | 点击动作触发该回调,event返回值见ClickEvent对象说明。 | +| onClick(event: (event?: ClickEvent) => void) | 否 | 点击动作触发该回调,event返回值见ClickEvent对象说明。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## ClickEvent对象说明 + +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 类型 | 描述 | | ------------------- | ------------------------------------ | -------------------------------------------------------- | | screenX | number | 点击位置相对于应用窗口左上角的X坐标。 | @@ -26,6 +29,8 @@ ## EventTarget8+对象说明 +从API version 9开始,该接口支持在ArkTS卡片中使用。 + | 名称 | 参数类型 | 描述 | | ---- | ------------------------- | ---------- | | area | [Area](ts-types.md#area8) | 目标元素的区域信息。 | diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-events-drag-drop.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-events-drag-drop.md index 6a8eb04f8e394d7966c6d0180923a81f6f52ab87..ae6cbbb52c75105f43dc6bc864026e0803b4d556 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-events-drag-drop.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-events-drag-drop.md @@ -10,7 +10,7 @@ | 名称 | 支持冒泡 | 功能描述 | | ------------------------------------------------------------ | -------- | ------------------------------------------------------------ | -| onDragStart(event: (event?: [DragEvent](#dragevent说明), extraParams?: string) =>  [CustomBuilder](ts-types.md#custombuilder8) \| [DragItemInfo](#dragiteminfo说明)) | 否 | 第一次拖拽此事件绑定的组件时,触发回调。
- event:拖拽事件信息,包括拖拽点坐标。
- extraParams:拖拽事件额外信息,详见[extraParams](#extraparams说明)说明。
返回值:当前跟手效果所拖拽的对象,用于显示拖拽时的提示组件。
长按150ms可触发拖拽事件。优先级:长按手势配置时间小于等于150ms时,长按手势优先触发,否则拖拽事件优先触发。 | +| onDragStart(event: (event?: [DragEvent](#dragevent说明), extraParams?: string) =>  [CustomBuilder](ts-types.md#custombuilder8) \| [DragItemInfo](#dragiteminfo说明)) | 否 | 第一次拖拽此事件绑定的组件时,触发回调。
- event:拖拽事件信息,包括拖拽点坐标。
- extraParams:拖拽事件额外信息,详见[extraParams](#extraparams说明)说明。
返回值:当前跟手效果所拖拽的对象,用于显示拖拽时的提示组件。
长按500ms可触发拖拽事件。优先级:长按手势配置时间小于等于500ms时,长按手势优先触发,否则拖拽事件优先触发。 | | onDragEnter(event: (event?: [DragEvent](#dragevent说明), extraParams?: string) => void) | 否 | 拖拽进入组件范围内时,触发回调。
- event:拖拽事件信息,包括拖拽点坐标。
- extraParams:拖拽事件额外信息,详见[extraParams](#extraparams说明)说明。
当监听了onDrop事件时,此事件才有效。 | | onDragMove(event: (event?: [DragEvent](#dragevent说明), extraParams?: string) => void) | 否 | 拖拽在组件范围内移动时,触发回调。
- event:拖拽事件信息,包括拖拽点坐标。
- extraParams:拖拽事件额外信息,详见[extraParams](#extraparams说明)说明。
当监听了onDrop事件时,此事件才有效。 | | onDragLeave(event: (event?: [DragEvent](#dragevent说明), extraParams?: string) => void) | 否 | 拖拽离开组件范围内时,触发回调。
- event:拖拽事件信息,包括拖拽点坐标。
- extraParams:拖拽事件额外信息,详见[extraParams](#extraparams说明)说明。
当监听了onDrop事件时,此事件才有效。 | @@ -45,6 +45,113 @@ ## 示例 +### 示例1 + +```ts +@Observed +class ClassA { + public name: string + public bol: boolean + + constructor(name: string, bol: boolean) { + this.name = name + this.bol = bol + } +} + +@Extend(Text) function textStyle() { + .width('25%') + .height(35) + .fontSize(16) + .textAlign(TextAlign.Center) + .backgroundColor(0xAFEEEE) +} + +@Entry +@Component +struct DragExample { + @State arr: ClassA[] = [new ClassA('A', true), new ClassA('B', true), new ClassA('C', true)] + @State dragIndex: number = 0 + + changeIndex(index1: number, index2: number) { // 交换数组位置 + [this.arr[index1], this.arr[index2]] = [this.arr[index2], this.arr[index1]]; + } + + build() { + Column() { + Row({ space: 15 }) { + List({ space: 20 }) { + ForEach(this.arr, (item, index) => { + ListItem() { + Column() { + Child({ a: this.arr[index] }) + } + .onTouch((event: TouchEvent) => { + if (event.type === TouchType.Down) { + this.dragIndex = index // 获取当前拖拽子组件的索引 + console.info('onTouch' + this.dragIndex) + } + }) + } + }) + } + .listDirection(Axis.Horizontal) + .onDrop((event: DragEvent, extraParams: string) => { // 绑定此事件的组件可作为拖拽释放目标,当在本组件范围内停止拖拽行为时,触发回调。 + let jsonString = JSON.parse(extraParams); + this.changeIndex(this.dragIndex, jsonString.insertIndex) + }) + }.padding({ top: 10, bottom: 10 }).margin(10) + + }.width('100%').height('100%').padding({ top: 20 }).margin({ top: 20 }) + } +} + +@Component +struct Child { + @ObjectLink a: ClassA + + @Builder pixelMapBuilder() { + Column() { + Text(this.a.name) + .width('50%') + .height(60) + .fontSize(16) + .borderRadius(10) + .textAlign(TextAlign.Center) + .backgroundColor(Color.Yellow) + } + } + + build() { + Column() { + Text(this.a.name) + .textStyle() + .visibility(this.a.bol ? Visibility.Visible : Visibility.None) + .onDragStart(() => { // 第一次拖拽此事件绑定的组件时,触发回调。 + this.a.bol = false // 控制显隐 + return this.pixelMapBuilder() // 设置拖拽过程中显示的图片。 + }) + .onTouch((event: TouchEvent) => { + if (event.type === TouchType.Up) { + this.a.bol = true + } + }) + Text('') + .width('25%') + .height(35) + .fontSize(16) + .textAlign(TextAlign.Center) + .border({ width: 5, color: 'red' }) + .visibility(!this.a.bol ? Visibility.Visible : Visibility.None) + } + } +} +``` + +![drag-drop](figures/drag-drop.gif) + +### 示例2 + ```ts // xxx.ets @Extend(Text) function textStyle () { @@ -67,7 +174,7 @@ struct DragExample { @State bananaVisible: Visibility = Visibility.Visible private dragList: string[] = ['apple', 'orange', 'banana'] @State fruitVisible: Visibility[] = [Visibility.Visible, Visibility.Visible, Visibility.Visible] - @State index: number = 0 + @State idx: number = 0 // 自定义拖拽过程中显示的内容 @Builder pixelMapBuilder() { @@ -104,7 +211,7 @@ struct DragExample { .onTouch((event: TouchEvent) => { if (event.type === TouchType.Down) { this.eventType = 'Down' - this.index = index + this.idx = index } if (event.type === TouchType.Up) { this.eventType = 'Up' @@ -157,7 +264,7 @@ struct DragExample { this.numbers.splice(jsonString.insertIndex, 0, this.text) this.bool = false } - this.fruitVisible[this.index] = Visibility.None + this.fruitVisible[this.idx] = Visibility.None }) }.width('100%').height('100%').padding({ top: 20 }).margin({ top: 20 }) } diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-events-keyboardshortcut.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-events-keyboardshortcut.md new file mode 100644 index 0000000000000000000000000000000000000000..73d26fdb1666fdd9689e1b453af7a6cccad7f92e --- /dev/null +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-events-keyboardshortcut.md @@ -0,0 +1,121 @@ +# 自定义快捷键 + +开发者可以设置组件的自定义组合键,组合键的行为与click行为一致,组件在未获得焦点状态下也可以响应自定义组合键,每个组件可以设置多个组合键。 + +> **说明:** +> +> 从API Version 10开始支持。后续版本如有新增内容,则采用上角标单独标记该内容的起始版本。 + +## 接口 + +keyboardShortcut(value: string | [FunctionKey], keys: Array<[ModifierKey]>) + +**参数:** + +| 参数名 | 参数类型 | 必填 | 参数描述 | +| ------ | ------------------------------------- | ---- | ------------------------------------------------------------ | +| value | string \| [FunctionKey](#functionkey) | 是 | 热键的单个字符(可以通过键盘输入的字符)或[FunctionKey](#functionkey)。
| +| keys | Array<[ModifierKey](#modifierkey)> | 是 | 热键组合。
| + +## ModifierKey + +| 名称 | 描述 | +| ----- | ------------------- | +| CTRL | 表示键盘上Ctrl键。 | +| SHIFT | 表示键盘上Shift键。 | +| ALT | 表示键盘上Alt键。 | + +## FunctionKey + +| 名称 | 描述 | +| ---- | --------------------- | +| ESC | 表示键盘上ESC功能键。 | +| F1 | 表示键盘上F1功能键。 | +| F2 | 表示键盘上F2功能键。 | +| F3 | 表示键盘上F3功能键。 | +| F4 | 表示键盘上F4功能键。 | +| F5 | 表示键盘上F5功能键。 | +| F6 | 表示键盘上F6功能键。 | +| F7 | 表示键盘上F7功能键。 | +| F8 | 表示键盘上F8功能键。 | +| F9 | 表示键盘上F9功能键。 | +| F10 | 表示键盘上F10功能键。 | +| F11 | 表示键盘上F11功能键。 | +| F12 | 表示键盘上F12功能键。 | + +## 快捷键使用注意事项 + +| 场景 | 快捷键处理逻辑 | 例子 | +| ------------------------------------------------------------ | -------------------------------------------------------- | ------------------------------------------------------------ | +| 所有支持onClick事件的组件 | 支持自定义组合键 | 无 | +| 自定义组合键要求 | 控制键Ctrl,Shift,Alt及它们的组合加上其它可输入字符按键 | Button('button1').keyboardShortcut('a',[ModifierKey.CTRL]) | +| 多个不同组件设置相同组合键 | 只响应结点树上的第一个组件、其它组件不响应快捷键。 | Button('button1').keyboardShortcut('a',[ModifierKey.CTRL])
Button('button2').keyboardShortcut('a',[ModifierKey.CTRL]) | +| 无论组件是否获得焦点 | 只要窗口获焦快捷键就会响应 | 无 | +| 绑定单个快捷键时候,通过keyboardShortcut接口value值或者是keys值或两者都是空的情况下。
绑定多个快捷键的时候无法取消快捷键。 | 取消快捷键的设置 | Button('button1').keyboardShortcut('',[ModifierKey.CTRL])
Button('button2').keyboardShortcut('a',[l])
Button('button3').keyboardShortcut('',[]) | +| 独立pipeline子窗口、主窗口共存的情况下 | 获焦的窗口响应快捷键 | 无 | +| keyboardShortcut接口中的keys命令中ctrl、shift、alt | 不区分左右键都响应 | Button('button1').keyboardShortcut('a',[ModifierKey.CTRL, ModifierKey.ALT]) | +| keyboardShortcut接口中的value单个字符 | 不区分大小写都响应 | Button('button1').keyboardShortcut('a',[ModifierKey.CTRL])
Button('button2').keyboardShortcut('A',[ModifierKey.CTRL]) | +| 快捷键的响应 | 所有快捷键down的状态下响应、且连续响应 | 无 | +| 隐藏组件
| 响应快捷键 | 无 | +| disable状态组件 | 不响应快捷键 | 无 | +| 1. 组件的组合键(包括系统预定义快捷键)相同时。
2. 接口参数value有多个字符时。
3. 接口参数keys有重复的控制键时。 | 这几种情况不绑定组合键, 先前绑定的组合键仍然有效 | Button('button1').keyboardShortcut('c',[ModifierKey.CTRL])
Button('button2').keyboardShortcut('ab',[ModifierKey.CTRL])
Button('button3').keyboardShortcut('ab',[ModifierKey.CTRL,ModifierKey.CTRL]) | + +## 系统已有组合键 + +| 快捷键 | 组件 | +| -------------- | ------------------------------------------------------------ | +| Ctrl + C | [Image](ts-basic-components-image.md)、[TextInput](ts-basic-components-textinput.md)、[TextArea](ts-basic-components-textarea.md) | +| Ctrl+ A | [TextInput](ts-basic-components-textinput.md)、[TextArea](ts-basic-components-textarea.md) | +| Ctrl+ V | [TextInput](ts-basic-components-textinput.md)、[TextArea](ts-basic-components-textarea.md) | +| Ctrl+ X | [TextInput](ts-basic-components-textinput.md)、[TextArea](ts-basic-components-textarea.md) | +| Shift + 方向键 | [TextInput](ts-basic-components-textinput.md)、[TextArea](ts-basic-components-textarea.md) | +| Ctrl+ Shift+ Z | [TextInput](ts-basic-components-textinput.md)、[TextArea](ts-basic-components-textarea.md) | +| Ctrl+ Z | [TextInput](ts-basic-components-textinput.md)、[TextArea](ts-basic-components-textarea.md) | +| Ctrl+ Y | [TextInput](ts-basic-components-textinput.md)、[TextArea](ts-basic-components-textarea.md) | +| 方向键、回车键 | [TextInput](ts-basic-components-textinput.md)、[TextArea](ts-basic-components-textarea.md) | +| TAB键 | [TextInput](ts-basic-components-textinput.md)、[TextArea](ts-basic-components-textarea.md) | + +## 示例 + +设置组件的快捷键,同时按控制键+对应的字符可以触发组件响应快捷键,并触发onClick事件或自定义事件。 + +```ts +// xxx.ets +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + + build() { + Row() { + Column() { + Text(this.message) + Button("Test short cut 1").onClick((event) => { + this.message = "I clicked Button 1"; + console.log("I clicked 1"); + }).keyboardShortcut('.', [ModifierKey.SHIFT, ModifierKey.CTRL, ModifierKey.ALT]) + .onKeyEvent((event)=>{ + console.log("event.keyCode: " + JSON.stringify(event)); + }) + Button("Test short cut 2").onClick((event) => { + this.message = "I clicked Button 2"; + console.log("I clicked 2"); + }).keyboardShortcut('1', [ModifierKey.CTRL]) + Button("Test short cut 3").onClick((event) => { + this.message = "I clicked Button 3"; + console.log("I clicked 3"); + }).keyboardShortcut('A', [ModifierKey.SHIFT]) + Button("Test short cut 4").onClick((event) => { + this.message = "I clicked Button 4"; + console.log("I clicked 4"); + }).keyboardShortcut(FunctionKey.F5, [], () => { + this.message = "I clicked Button 4"; + console.log("I clicked user callback."); + }).keyboardShortcut(FunctionKey.F3, []) + } + .width('100%') + } + .height('100%') + } +} +``` diff --git a/zh-cn/application-dev/reference/arkui-ts/ts-universal-events-show-hide.md b/zh-cn/application-dev/reference/arkui-ts/ts-universal-events-show-hide.md index a84c69fc4393a1065f9678c1193406ebfaa1cc16..e0e2c14eb81d9a56f82e7f23b32b251eedae6493 100644 --- a/zh-cn/application-dev/reference/arkui-ts/ts-universal-events-show-hide.md +++ b/zh-cn/application-dev/reference/arkui-ts/ts-universal-events-show-hide.md @@ -9,10 +9,10 @@ ## 事件 -| 名称 | 支持冒泡 | 功能描述 | -| ------------------------------------------------ | -------- | -------------------------- | -| onAppear(event: () => void) | 否 | 组件挂载显示时触发此回调。 | -| onDisAppear(event: () => void) | 否 | 组件卸载消失时触发此回调。 | +| 名称 | 支持冒泡 | 功能描述 | +| ------------------------------------------------ | -------- | ------------------------------------------------------------ | +| onAppear(event: () => void) | 否 | 组件挂载显示时触发此回调。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | +| onDisAppear(event: () => void) | 否 | 组件卸载消失时触发此回调。
从API version 9开始,该接口支持在ArkTS卡片中使用。 | ## 示例 diff --git a/zh-cn/application-dev/reference/errorcodes/Readme-CN.md b/zh-cn/application-dev/reference/errorcodes/Readme-CN.md index 7e61c5e73bdf16d7bccf4cecdd4cd9045ed69a86..6d2b4759009d19670e0b20ca65cbf31246c8ae97 100644 --- a/zh-cn/application-dev/reference/errorcodes/Readme-CN.md +++ b/zh-cn/application-dev/reference/errorcodes/Readme-CN.md @@ -27,7 +27,7 @@ - 资源管理 - [I18n错误码](errorcode-i18n.md) - [资源管理错误码](errorcode-resource-manager.md) -- 资源调度 +- 后台任务 - [backgroundTaskManager错误码](errorcode-backgroundTaskMgr.md) - [DeviceUsageStatistics错误码](errorcode-DeviceUsageStatistics.md) - [reminderAgentManager错误码](errorcode-reminderAgentManager.md) @@ -43,7 +43,7 @@ - [数据共享错误码](errorcode-datashare.md) - [分布式数据对象错误码](errorcode-distributed-dataObject.md) - [分布式键值数据库错误码](errorcode-distributedKVStore.md) - - [首选项错误码](errorcode-preferences.md) + - [用户首选项错误码](errorcode-preferences.md) - 文件管理 - [文件管理子系统错误码](errorcode-filemanagement.md) - 电话服务 @@ -57,6 +57,7 @@ - [网络共享错误码](errorcode-net-sharing.md) - [策略管理错误码](errorcode-net-policy.md) - 通信与连接 + - [Bluetooth错误码](errorcode-bluetoothManager.md) - [WIFI错误码](errorcode-wifi.md) - [NFC错误码](errorcode-nfc.md) - [RPC错误码](errorcode-rpc.md) diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-CommonEventService.md b/zh-cn/application-dev/reference/errorcodes/errorcode-CommonEventService.md index bcea1a8c6c40325a5878a3c8aa603367b37de806..a48197d1f81a2fec9e12708949dc3f32f88e4084 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-CommonEventService.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-CommonEventService.md @@ -1,127 +1,131 @@ -# 事件错误码 +# 事件错误码 + +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 ## 1500001 want中Action为空 **错误信息** -> Want action is null +The action field in the want parameter is null. **错误描述** -> 发送事件的`want`中的`Action`属性为空时系统会产生此错误码。 +发送事件的`want`中的`Action`属性为空时系统会产生此错误码。 **可能原因** -> 发送事件的`want`中的`Action`属性为空。 +发送事件的`want`中的`Action`属性为空。 **处理步骤** -> 检查传入`want`的`Action`属性是否为空。 +检查传入`want`的`Action`属性是否为空。 ## 1500002 沙箱应用无法发送公共事件 **错误信息** -> sandbox application can not send common event +A sandbox application cannot send common events. **错误描述** -> 沙箱应用无法发送公共事件。 +沙箱应用无法发送公共事件。 **可能原因** -> 事件发送方应用为沙箱应用,发送事件会被拦截。 +事件发送方应用为沙箱应用,发送事件会被拦截。 **处理步骤** -> 沙箱应用无法发送公共事件,发送公共事件前确认是否为沙箱应用。 +沙箱应用无法发送公共事件,发送公共事件前确认是否为沙箱应用。 ## 1500003 事件发送频率过高 **错误信息** -> common event send frequency too high +Too many common events are send in a short period of time. **错误描述** -> 应用发送事件过于频繁。 +应用发送事件过于频繁。 **可能原因** -> 短时间内应用发送过多事件。 +短时间内应用发送过多事件。 **处理步骤** -> 检查应用是否过于频繁地发送事件。 +检查应用是否过于频繁地发送事件。 ## 1500004 无法发送系统公共事件 **错误信息** -> not System services or System app +A third-party application cannot send system common events. **错误描述** -> 当前应用无法发送系统公共事件。 +当前应用无法发送系统公共事件。 **可能原因** -> 非系统应用或非系统服务发送系统公共事件。 +非系统应用或非系统服务发送系统公共事件。 **处理步骤** -> 确认当前应用是否为系统应用,或当前服务是否为系统服务。 +确认当前应用是否为系统应用,或当前服务是否为系统服务。 ## 1500005 未找到订阅者 **错误信息** -> subscriber can not found +The subscriber is not found. **错误描述** -> 找不到订阅者。 +找不到订阅者。 **可能原因** -> 订阅者被删除。 +订阅者被删除。 **处理步骤** -> 检查是否有重复取消订阅。 +检查是否有重复取消订阅。 ## 1500006 无效userId **错误信息** -> userId is invalid +Invalid userId. **错误描述** -> 无效的userId。 +无效的userId。 **可能原因** -> 和系统`userId`不一致或不是系统应用或系统服务进程。 +和系统`userId`不一致或不是系统应用或系统服务进程。 **处理步骤** -> 1. 检查当前`userId`是否和系统`userId`一致。 -> 2. 检查当前应用是否为系统应用或系统服务。 +1. 检查当前`userId`是否和系统`userId`一致。 +2. 检查当前应用是否为系统应用或系统服务。 ## 1500007 IPC请求发送失败 **错误信息** -> message send error +Failed to send the message. **错误描述** -> `IPC`发送请求失败。 +`IPC`发送请求失败。 **可能原因** -> 没有成功创建连接对象。 +没有成功创建连接对象。 **处理步骤** -> 请勿频繁建立链接,稍后重新尝试。 +请勿频繁建立链接,稍后重新尝试。 ## 1500008 读取数据失败 **错误信息** -> CEMS error +Failed to read the data. **错误描述** -> 服务端发生错误。 +服务端发生错误。 **可能原因** -> 服务端处理数据时发现业务异常。 +服务端处理数据时发现业务异常。 **处理步骤** -> 稍后重新尝试。 +稍后重新尝试。 -## 1500009 system error +## 1500009 系统错误 **错误信息** -> system error +System error. **错误描述** -> 处理业务时系统发生异常,如获取系统当前时间失败。 +处理业务时系统发生异常,如获取系统当前时间失败。 **可能原因** -> 系统故障,获取系统当前时间发生异常。 +系统故障,获取系统当前时间发生异常。 **处理步骤** -> 稍后重新尝试。 +稍后重新尝试。 diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-DeviceUsageStatistics.md b/zh-cn/application-dev/reference/errorcodes/errorcode-DeviceUsageStatistics.md index dda2607a4d9de5f979f26ca206313fad3dd84804..dc395884e59bc146ebcfb845bae4452685101fe9 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-DeviceUsageStatistics.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-DeviceUsageStatistics.md @@ -1,5 +1,9 @@ # DeviceUsageStatistics错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 10000001 内存操作失败 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-DistributedNotificationService.md b/zh-cn/application-dev/reference/errorcodes/errorcode-DistributedNotificationService.md index 2049cb646f6a757784bf52f93507e1c078a30e18..b40c48cfed25840c6359f2f17295803668192bf0 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-DistributedNotificationService.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-DistributedNotificationService.md @@ -1,5 +1,9 @@ # DistributedNotificationService错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 1600001 内部错误 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-DistributedSchedule.md b/zh-cn/application-dev/reference/errorcodes/errorcode-DistributedSchedule.md index 49ef0e73a0ec747d6160e18c7885029dbb5f975a..19eeda1a67ea22159d9a48f92f6f91fba608edea 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-DistributedSchedule.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-DistributedSchedule.md @@ -1,5 +1,9 @@ # DistributedSchedule错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 16600001 系统服务工作异常 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-ability.md b/zh-cn/application-dev/reference/errorcodes/errorcode-ability.md index b83f43dd935c55bd5a034a8384b80ab20125bb69..1ef393a59db3a5110c1510b8c4683812917fc0fa 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-ability.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-ability.md @@ -1,5 +1,9 @@ # 元能力子系统错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 16000001 指定的Ability名称不存在 **错误信息** @@ -182,6 +186,24 @@ The context does not exist. 请检查上下文对象是否可用。 +## 16000017 上一个Ability未启动完成,先缓存在队列中等待后续启动。 + +**错误信息** + +The previous ability is starting, wait start later. + +**错误描述** + +需要启动的Ability过多,由于系统处理能力有限,会先将请求缓存在队列中,按照顺序依次处理。 + +**可能原因** + +系统并发大。 + +**处理步骤** + +无需处理,等待启动即可。 + ## 16000050 内部错误 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-access-token.md b/zh-cn/application-dev/reference/errorcodes/errorcode-access-token.md index 16a8cf53764e369e6b3f916063da3c10c5bb4b9c..ea6afd6598b93f5710d75f1fc3859003c051013b 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-access-token.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-access-token.md @@ -1,5 +1,9 @@ # AccessToken错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 12100001 入参错误 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-accessibility.md b/zh-cn/application-dev/reference/errorcodes/errorcode-accessibility.md index e8674f395457d04a6f8f53f5933be94a9082ae5d..c8a8a16424c79da82f63c94a4afbd08e9a45ea9f 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-accessibility.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-accessibility.md @@ -1,5 +1,9 @@ # 无障碍子系统错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 9300001 输入无效的包名称或者Ability名称 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-account.md b/zh-cn/application-dev/reference/errorcodes/errorcode-account.md index 1e74da9b940222ef4764e0074da94c5401ed2415..5ecb53db80372d488d7be6f5a3d388eec685d185 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-account.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-account.md @@ -1,5 +1,9 @@ # 帐号管理错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + 以下错误码包括系统帐号、分布式帐号和应用帐号错误码。 ## 12300001 系统服务异常 diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-animator.md b/zh-cn/application-dev/reference/errorcodes/errorcode-animator.md index b07c42ebb8fee6b564c521d6f431a6f337ce2f9e..f1ae2a1ab9ff8b622ace8950221b03cafe478717 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-animator.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-animator.md @@ -1,5 +1,9 @@ # 动画错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 100001 内部错误 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-audio.md b/zh-cn/application-dev/reference/errorcodes/errorcode-audio.md index 0746dc22f236b5c62a392bbde82dc0db4c318203..254e084d00928573c4c8665e15e0a540b5f37354 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-audio.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-audio.md @@ -1,4 +1,8 @@ -# Audio错误码 +# Audio错误码 + +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 ## 6800101 无效入参 diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-avsession.md b/zh-cn/application-dev/reference/errorcodes/errorcode-avsession.md index 59b93001ecb83570a69f405b8aacfe1444a8bbed..1e14de458aadb4ae7176ad8ec50d3b45b91db12b 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-avsession.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-avsession.md @@ -1,5 +1,9 @@ # 媒体会话管理错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 6600101 会话服务端异常 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-backgroundTaskMgr.md b/zh-cn/application-dev/reference/errorcodes/errorcode-backgroundTaskMgr.md index c876f929ed256d9db9bb5a69d09671d7e335c9ed..687227b21bd5066b9072928924c3de70f26f2c09 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-backgroundTaskMgr.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-backgroundTaskMgr.md @@ -1,5 +1,9 @@ # backgroundTaskManager错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 9800001 内存操作失败 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-batteryStatistics.md b/zh-cn/application-dev/reference/errorcodes/errorcode-batteryStatistics.md index 5787950b7a841ffdefa230e42493180dcc68f29f..77019c1ae94a351935e220060069418e2a4e28ef 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-batteryStatistics.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-batteryStatistics.md @@ -1,5 +1,9 @@ # 耗电统计错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 4600101 连接服务失败 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-bluetoothManager.md b/zh-cn/application-dev/reference/errorcodes/errorcode-bluetoothManager.md new file mode 100644 index 0000000000000000000000000000000000000000..d01e71420fc16ea4480775897f68ac69a8da9d9c --- /dev/null +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-bluetoothManager.md @@ -0,0 +1,132 @@ +# 蓝牙服务子系统错误码 + +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + +## 2900001 + +**错误信息** + +Service stopped. + +**错误描述** + +蓝牙服务已停止,蓝牙服务相关的接口无法调用。 + +**可能原因** + +蓝牙服务启动异常。 + +**处理步骤** + +重新执行打开或关闭蓝牙。 + +## 2900003 + +**错误信息** + +Bluetooth switch is off. + +**错误描述** + +蓝牙开关已关闭。 + +**可能原因** + +蓝牙开关已关闭。 + +**处理步骤** + +重新执行打开蓝牙开关。 + +## 2900004 + +**错误信息** + +Profile is not supported. + +**错误描述** + +配置文件是不支持的。 + +**可能原因** + +该配置文件在当前设备环境不支持。 + +**处理步骤** + +检查设备是否支持该配置文件功能,若不支持则停止调用。 + +## 2900099 + +**错误信息** + +Operation failed. + +**错误描述** + +操作失败。 + +**可能原因** + +该配置文件在当前设备环境不支持。 + +**处理步骤** + +请重试该操作。 + +## 2901000 + +**错误信息** + +Read forbidden. + +**错误描述** + +禁止读操作。 + +**可能原因** + +无读操作权限。 + +**处理步骤** + +检查是否有读操作权限。 + +## 2901001 + +**错误信息** + +Write forbidden. + +**错误描述** + +禁止写操作。 + +**可能原因** + +无写操作权限。 + +**处理步骤** + +检查是否有写操作权限。 + +## 2901054 + +**错误信息** + +IO error. + +**错误描述** + +IO传输失败。 + +**可能原因** + +IO传输异常,造成失败。 + +**处理步骤** + +请重试该操作。 + diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-brightness.md b/zh-cn/application-dev/reference/errorcodes/errorcode-brightness.md index b5d83d90fde5bdf977f6afb76f41d1bed9bab4ed..033036cef4695b2076f9336e854bc021528f0a43 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-brightness.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-brightness.md @@ -1,5 +1,9 @@ # 屏幕亮度错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 4700101 连接服务失败 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-bundle.md b/zh-cn/application-dev/reference/errorcodes/errorcode-bundle.md index b8df64665eb74f2427257730932c8b8e2039ac39..c68152ab39b592fb7c7c4b7abfcf71da535605e7 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-bundle.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-bundle.md @@ -1,397 +1,547 @@ -# 包管理子系统通用错误码 - -## 17700001 指定的bundleName不存在 - -**错误信息**
-The specified bundle name is not found. - -**错误描述**
-调用查询等接口时,传入的bundleName不存在。 - -**可能原因**
- -1. 输入的bundleName有误。 -2. 系统中对应的应用没有安装。 - -**处理步骤**
-1. 检查bundleName拼写是否正确。 -2. 确认对应的应用是否安装。 - -## 17700002 指定的moduleName不存在 - -**错误信息**
-The specified module name is not found. - -**错误描述**
-调用查询或者免安装相关接口时,传入的moduleName不存在。 - -**可能原因**
-1. 输入的moduleName有误。 -2. 系统中对应的应用没有安装该模块。 - -**处理步骤**
-1. 检查moduleName拼写是否正确。 -2. 确认对应的应用是否安装该模块。 - -## 17700003 指定的abilityName不存在 - -**错误信息**
-The specified ability name is not found. - -**错误描述**
-调用查询等接口时,传入的abilityName不存在。 - -**可能原因**
-1. 输入的abilityName有误。 -2. 系统中对应的应用不存在该abilityName对应的ability。 - -**处理步骤**
-1. 检查abilityName拼写是否正确。 -2. 确认对应的应用是否存在该abilityName对应的ability。 - -## 17700004 指定的用户不存在 - -**错误信息**
-The specified user ID is not found. - -**错误描述**
-调用与用户相关接口时,传入的用户不存在。 - -**可能原因**
-1. 输入的用户名有误。 -2. 系统中没有该用户。 - -**处理步骤**
-1. 检查用户名拼写是否正确。 -2. 确认系统中存在该用户。 - -## 17700005 指定的appId为空字符串 - -**错误信息**
-The specified app ID is empty string. - -**错误描述**
-调用appControl模块中的相关接口时,传入的appId为空字符串。 - -**可能原因**
-传入的appId为空字符串。 - -**处理步骤**
-检查appId是否为空字符串。 - -## 17700006 查询的权限不存在 - -**错误信息**
-The specified permission is not found. - -**错误描述**
-调用bundleManager模块中的getPermissionDef接口时,传入的权限不存在。 - -**可能原因**
-1. 传入的permission名称拼写有误。 -2. 系统中不存在对应的权限。 - -**处理步骤**
-1. 检查permission拼写是否正确。 -2. 确认系统中是否有该权限。 - -## 17700007 输入的设备Id有误 - -**错误信息**
-The specified device ID is not found. - -**错误描述**
-调用distributedBundle模块相关接口时,传入的设备id有误。 - -**可能原因**
-1. 传入的deviceId拼写有误。 -2. deviceId不存在。 - -**处理步骤**
-1. 检查deviceId拼写是否正确。 -2. 确认deviceId是否存在。 - -## 17700010 文件解析失败导致应用安装失败 - -**错误信息**
-Failed to install the HAP because the HAP fails to be parsed. - -**错误描述**
-调用installer模块中的install接口时,传入的HAP解析失败。 - -**可能原因**
-1. HAP的格式不是zip格式。 -2. HAP的配置文件不满足json格式。 -3. HAP的配置文件缺少必要的字段。 - -**处理步骤**
-1. 确认hap的格式是zip。 -2. 确认hap的配置文件满足[配置文件json格式](../../quick-start/application-configuration-file-overview-stage.md)。 -3. 检查DevEco Studio编译hap时是否有错误提示,缺省字段时会有相应的报错。 - -## 17700011 签名校验失败导致应用安装失败 - -**错误信息**
-Failed to install the HAP because the HAP signature fails to be verified. - -**错误描述**
-调用installer模块中的install接口时,签名校验失败导致应用安装失败。 - -**可能原因**
- -1. HAP没有签名。 -2. hap签名信息来源不可靠。 -3. 升级的HAP与已安装的HAP签名信息不一致。 -4. 多个hap的签名信息不一致。 - -**处理步骤**
-1. 确认hap包是否签名成功。 -2. 确认hap包的签名证书是从应用市场申请。 -3. 确认多个hap包签名时使用的证书相同。 -4. 确认升级的ha包p签名证书与已安装的hap包相同。 - -## 17700012 安装包路径无效或者文件过大导致应用安装失败 - -**错误信息**
-Failed to install the HAP because the HAP path is invalid or the HAP is too large. - -**错误描述**
-调用installer模块中的install接口时,安装包路径无效或者文件过大导致应用安装失败。 - -**可能原因**
-1. 输入错误,HAP的文件路径不存在。 -2. HAP的路径无法访问。 -3. HAP的大小超过最大限制4G。 - -**处理步骤**
-1. 确认hap是否存在。 -2. 查看hap的可执行权限,是否可读。 -3. 查看HAP的大小是否超过4G。 - -## 17700015 多个HAP配置信息不同导致应用安装失败 - -**错误信息**
-Failed to install the HAPs because they have different configuration information. - -**错误描述**
-调用installer模块中的install接口时,多个HAP配置信息不同导致应用安装失败。 - -**可能原因**
-多个hap包中配置文件中app标签下面的字段信息不一致。 - -**处理步骤**
-确认多个HAP中配置文件app下面的字段是否一致。 - -## 17700016 系统磁盘空间不足导致应用安装失败 - -**错误信息**
-Failed to install the HAP because of insufficient system disk space. - -**错误描述**
-调用installer模块中的install接口时,系统磁盘空间不足导致应用安装失败。 - -**可能原因**
-系统空间不足。 - -**处理步骤**
-确认系统是否有足够的空间。 - -## 17700017 新安装的应用版本号低于已安装的版本号导致应用安装失败 - -**错误信息**
-Failed to install the HAP since the version of the HAP to install is too early. - -**错误描述**
-调用installer模块中的install接口时,新安装的应用版本号低于已安装的版本号导致应用安装失败。 - -**可能原因**
-新安装的应用版本号低于已安装的版本号。 - -**处理步骤**
-确认新安装的应用版本号是否不低于已安装的同应用版本号。 - -## 17700020 预置应用无法卸载 - -**错误信息**
-The preinstalled app cannot be uninstalled. - -**错误描述**
-调用installer模块中的uninstall接口卸载预置应用时,无法卸载。 - -**可能原因**
-1. 传入的bundleName拼写有误。 -2. 对应的预置应用无法卸载。 - -**处理步骤**
-1. 确认bundleName是否拼写正确。 -1. 确认对应的预置应用是否可卸载。 - -## 17700021 指定的uid无效 - -**错误信息**
-The specified uid is invalid. - -**错误描述**
-调用bundleManager模块中的getBundleNameByUid接口时,指定的uid无效。 - -**可能原因**
-1. 传入的uid拼写有误。 -2. 传入的uid在系统中不存在。 - -**处理步骤**
-1. 检查uid的拼写。 -2. 检查系统中是否存在该uid。 - -## 17700022 输入的待解析源文件无效 - -**错误信息**
-The input source file is invalid. - -**错误描述**
-调用bundleManager模块中的getBundleArchiveInfo接口时,传入的HAP路径无效。 - -**可能原因**
-1. 待解析的源文件不存在。 -2. 待解析的源文件不符合zip格式。 - -**处理步骤**
-1. 确认待解析的源文件是否存在。 -2. 确认待解析的源文件符合zip格式。 - -## 17700023 指定的默认应用不存在 - -**错误信息**
-The specified default app does not exist. - -**错误描述**
-调用defaultAppManager模块中的getDefaultApplication接口时,指定的默认应用不存在。 - -**可能原因**
-设备没有设置对应的默认应用。 - -**处理步骤**
-确认设备是否设置了对应的默认应用。 - -## 17700024 没有相应的配置文件 - -**错误信息**
-Failed to get the profile because there is no profile in the HAP. - -**错误描述**
-调用查询profile文件的相关接口时,没有相应的配置文件。 - -**可能原因**
-1. 输入的metadata name在配置文件中不存在。 -2. 配置文件的内容不是json格式。 - -**处理步骤**
-1. 确认要查询的ability或者extensionAbility中的metadata name是否存在。 -2. 确认指定查询的profile文件的内容是否为json格式。 - -## 17700025 输入的type无效 - -**错误信息**
-The specified type is invalid. - -**错误描述**
-调用defaultAppManager模块的相关接口时,输入的type无效。 - -**可能原因**
-1. 输入的type拼写有误。 -2. 输入的type不存在。 - -**处理步骤**
-1. 确认输入的type是否拼写正确。 -2. 确认输入的type是否存在。 - -## 17700026 指定应用被禁用 - -**错误信息**
-The specified bundle is disabled. - -**错误描述**
-当调用查询应用的相关信息接口时,指定应用被禁用。 - -**可能原因**
-设备上对应的应用已经被禁用,无法查询。 - -**处理步骤**
-确认设备上对应的应用是否被禁用。 - -## 17700027 分布式服务未启动 - -**错误信息**
-The distributed service is not running. - -**错误描述**
-当调用distributedBundle模块的相关接口时,分布式服务未启动。 - -**可能原因**
-设备未组网。 - -**处理步骤**
-确认设备是否组网成功。 -## 17700028 输入的ability与type不匹配 - -**错误信息**
-The ability does not match the type. - -**错误描述**
-当调用defaultAppManager模块中的setDefaultApplication接口时,输入的ability与type不匹配。 - -**可能原因**
-输入的ability和type拼写有误。 - -**处理步骤**
-确认输入的ability和type拼写是否正确。 - -## 17700029 指定的ability被禁用 - -**错误信息**
-The specified ability is disabled. - -**错误描述**
-当调用查询ability相关信息的接口时,指定的ability被禁用。 - -**可能原因**
-指定的ability被禁用。 - -**处理步骤**
-确认指定的ability是否被禁用,可以使用[bm工具命令](../../../readme/%E5%8C%85%E7%AE%A1%E7%90%86%E5%AD%90%E7%B3%BB%E7%BB%9F.md%23bm%E5%B7%A5%E5%85%B7%E5%91%BD%E4%BB%A4)查询对应的应用信息。 - -## 17700030 指定的应用不支持清除缓存文件 - -**错误信息**
-The specified bundle does not support clearing of cache files. - -**错误描述**
-当调用bundleManager模块中的cleanBundleCacheFiles接口时,指定的应用不支持清除缓存文件。 - -**可能原因**
-指定的应用为系统应用且在签名证书中配置了不能清除数据(AllowAppDataNotCleared)的字段。 - -**处理步骤**
-1.确认指定的应用是否为系统应用,可以使用[bm工具命令](../../../readme/%E5%8C%85%E7%AE%A1%E7%90%86%E5%AD%90%E7%B3%BB%E7%BB%9F.md%23bm%E5%B7%A5%E5%85%B7%E5%91%BD%E4%BB%A4)查询对应的应用信息,查看isSystemApp是否为true。 -2.确认指定的应用是否配置了能清除缓存(AllowAppDataNotCleared)的字段,可以使用[bm工具命令](../../../readme/%E5%8C%85%E7%AE%A1%E7%90%86%E5%AD%90%E7%B3%BB%E7%BB%9F.md%23bm%E5%B7%A5%E5%85%B7%E5%91%BD%E4%BB%A4)查询对应的应用信息,查看userDataClearable是否为true。 - -## 17700031 Overlay特性校验失败导致HAP安装失败 - -**错误信息**
-Failed to install the HAP because the overlay check of the HAP is failed. - -**错误描述**
-当安装overlay特征的应用时,指定的应用和待安装的overlay特征应用不为预置应用,或者目标应用/目标module是overlay特征的应用/module。 - -**可能原因**
-1. 使用应用间的overlay特性时,overlay特征应用必须为预置应用。 -2. 使用应用间的overlay特性时,目标应用必须为预置应用。 -3. 使用应用间的overlay特性时,目标应用不能是具有overlay特征的应用 -4. 目标module不能是具有overlay特征的module。 - -**处理步骤**
-1. 检查overlay特征应用是否为预置应用。 -2. 检查目标应用是否为预置应用。 -3. 检查目标应用是否不为overlay特征的应用 -4. 检查目标module是否不为overlay特征的module。 - +# 包管理子系统通用错误码 + +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + +## 17700001 指定的bundleName不存在 + +**错误信息**
+The specified bundle name is not found. + +**错误描述**
+调用查询等接口时,传入的bundleName不存在。 + +**可能原因**
+ +1. 输入的bundleName有误。 +2. 系统中对应的应用没有安装。 + +**处理步骤**
+1. 检查bundleName拼写是否正确。 +2. 确认对应的应用是否安装。 + +## 17700002 指定的moduleName不存在 + +**错误信息**
+The specified module name is not found. + +**错误描述**
+调用查询或者免安装相关接口时,传入的moduleName不存在。 + +**可能原因**
+1. 输入的moduleName有误。 +2. 系统中对应的应用没有安装该模块。 + +**处理步骤**
+1. 检查moduleName拼写是否正确。 +2. 确认对应的应用是否安装该模块。 + +## 17700003 指定的abilityName不存在 + +**错误信息**
+The specified ability name is not found. + +**错误描述**
+调用查询等接口时,传入的abilityName不存在。 + +**可能原因**
+1. 输入的abilityName有误。 +2. 系统中对应的应用不存在该abilityName对应的ability。 + +**处理步骤**
+1. 检查abilityName拼写是否正确。 +2. 确认对应的应用是否存在该abilityName对应的ability。 + +## 17700004 指定的用户不存在 + +**错误信息**
+The specified user ID is not found. + +**错误描述**
+调用与用户相关接口时,传入的用户不存在。 + +**可能原因**
+1. 输入的用户名有误。 +2. 系统中没有该用户。 + +**处理步骤**
+1. 检查用户名拼写是否正确。 +2. 确认系统中存在该用户。 + +## 17700005 指定的appId为空字符串 + +**错误信息**
+The specified app ID is empty string. + +**错误描述**
+调用appControl模块中的相关接口时,传入的appId为空字符串。 + +**可能原因**
+传入的appId为空字符串。 + +**处理步骤**
+检查appId是否为空字符串。 + +## 17700006 查询的权限不存在 + +**错误信息**
+The specified permission is not found. + +**错误描述**
+调用bundleManager模块中的getPermissionDef接口时,传入的权限不存在。 + +**可能原因**
+1. 传入的permission名称拼写有误。 +2. 系统中不存在对应的权限。 + +**处理步骤**
+1. 检查permission拼写是否正确。 +2. 确认系统中是否有该权限。 + +## 17700007 输入的设备Id有误 + +**错误信息**
+The specified device ID is not found. + +**错误描述**
+调用distributedBundle模块相关接口时,传入的设备id有误。 + +**可能原因**
+1. 传入的deviceId拼写有误。 +2. deviceId不存在。 + +**处理步骤**
+1. 检查deviceId拼写是否正确。 +2. 确认deviceId是否存在。 + +## 17700010 文件解析失败导致应用安装失败 + +**错误信息**
+Failed to install the HAP because the HAP fails to be parsed. + +**错误描述**
+调用installer模块中的install接口时,传入的HAP解析失败。 + +**可能原因**
+1. HAP的格式不是zip格式。 +2. HAP的配置文件不满足json格式。 +3. HAP的配置文件缺少必要的字段。 + +**处理步骤**
+1. 确认hap的格式是zip。 +2. 确认hap的配置文件满足[配置文件json格式](../../quick-start/application-configuration-file-overview-stage.md)。 +3. 检查DevEco Studio编译hap时是否有错误提示,缺省字段时会有相应的报错。 + +## 17700011 签名校验失败导致应用安装失败 + +**错误信息**
+Failed to install the HAP because the HAP signature fails to be verified. + +**错误描述**
+调用installer模块中的install接口时,签名校验失败导致应用安装失败。 + +**可能原因**
+ +1. HAP没有签名。 +2. hap签名信息来源不可靠。 +3. 升级的HAP与已安装的HAP签名信息不一致。 +4. 多个hap的签名信息不一致。 + +**处理步骤**
+1. 确认hap包是否签名成功。 +2. 确认hap包的签名证书是从应用市场申请。 +3. 确认多个hap包签名时使用的证书相同。 +4. 确认升级的ha包p签名证书与已安装的hap包相同。 + +## 17700012 安装包路径无效或者文件过大导致应用安装失败 + +**错误信息**
+Failed to install the HAP because the HAP path is invalid or the HAP is too large. + +**错误描述**
+调用installer模块中的install接口时,安装包路径无效或者文件过大导致应用安装失败。 + +**可能原因**
+1. 输入错误,HAP的文件路径不存在。 +2. HAP的路径无法访问。 +3. HAP的大小超过最大限制4G。 + +**处理步骤**
+1. 确认hap是否存在。 +2. 查看hap的可执行权限,是否可读。 +3. 查看HAP的大小是否超过4G。 + +## 17700015 多个HAP配置信息不同导致应用安装失败 + +**错误信息**
+Failed to install the HAPs because they have different configuration information. + +**错误描述**
+调用installer模块中的install接口时,多个HAP配置信息不同导致应用安装失败。 + +**可能原因**
+多个hap包中配置文件中app标签下面的字段信息不一致。 + +**处理步骤**
+确认多个HAP中配置文件app下面的字段是否一致。 + +## 17700016 系统磁盘空间不足导致应用安装失败 + +**错误信息**
+Failed to install the HAP because of insufficient system disk space. + +**错误描述**
+调用installer模块中的install接口时,系统磁盘空间不足导致应用安装失败。 + +**可能原因**
+系统空间不足。 + +**处理步骤**
+确认系统是否有足够的空间。 + +## 17700017 新安装的应用版本号低于已安装的版本号导致应用安装失败 + +**错误信息**
+Failed to install the HAP since the version of the HAP to install is too early. + +**错误描述**
+调用installer模块中的install接口时,新安装的应用版本号低于已安装的版本号导致应用安装失败。 + +**可能原因**
+新安装的应用版本号低于已安装的版本号。 + +**处理步骤**
+确认新安装的应用版本号是否不低于已安装的同应用版本号。 + +## 17700018 安装失败,依赖的模块不存在 + +**错误信息**
+Failed to install because the dependent module does not exist. + +**错误描述**
+安装hap或者hsp时,依赖的模块不存在。 + +**可能原因**
+依赖的模块没有安装。 + +**处理步骤**
+先安装依赖的模块。 + +## 17700020 预置应用无法卸载 + +**错误信息**
+The preinstalled app cannot be uninstalled. + +**错误描述**
+调用installer模块中的uninstall接口卸载预置应用时,无法卸载。 + +**可能原因**
+1. 传入的bundleName拼写有误。 +2. 对应的预置应用无法卸载。 + +**处理步骤**
+1. 确认bundleName是否拼写正确。 +1. 确认对应的预置应用是否可卸载。 + +## 17700021 指定的uid无效 + +**错误信息**
+The specified uid is invalid. + +**错误描述**
+调用bundleManager模块中的getBundleNameByUid接口时,指定的uid无效。 + +**可能原因**
+1. 传入的uid拼写有误。 +2. 传入的uid在系统中不存在。 + +**处理步骤**
+1. 检查uid的拼写。 +2. 检查系统中是否存在该uid。 + +## 17700022 输入的待解析源文件无效 + +**错误信息**
+The input source file is invalid. + +**错误描述**
+调用bundleManager模块中的getBundleArchiveInfo接口时,传入的HAP路径无效。 + +**可能原因**
+1. 待解析的源文件不存在。 +2. 待解析的源文件不符合zip格式。 + +**处理步骤**
+1. 确认待解析的源文件是否存在。 +2. 确认待解析的源文件符合zip格式。 + +## 17700023 指定的默认应用不存在 + +**错误信息**
+The specified default app does not exist. + +**错误描述**
+调用defaultAppManager模块中的getDefaultApplication接口时,指定的默认应用不存在。 + +**可能原因**
+设备没有设置对应的默认应用。 + +**处理步骤**
+确认设备是否设置了对应的默认应用。 + +## 17700024 没有相应的配置文件 + +**错误信息**
+Failed to get the profile because there is no profile in the HAP. + +**错误描述**
+调用查询profile文件的相关接口时,没有相应的配置文件。 + +**可能原因**
+1. 输入的metadata name在配置文件中不存在。 +2. 配置文件的内容不是json格式。 + +**处理步骤**
+1. 确认要查询的ability或者extensionAbility中的metadata name是否存在。 +2. 确认指定查询的profile文件的内容是否为json格式。 + +## 17700025 输入的type无效 + +**错误信息**
+The specified type is invalid. + +**错误描述**
+调用defaultAppManager模块的相关接口时,输入的type无效。 + +**可能原因**
+1. 输入的type拼写有误。 +2. 输入的type不存在。 + +**处理步骤**
+1. 确认输入的type是否拼写正确。 +2. 确认输入的type是否存在。 + +## 17700026 指定应用被禁用 + +**错误信息**
+The specified bundle is disabled. + +**错误描述**
+当调用查询应用的相关信息接口时,指定应用被禁用。 + +**可能原因**
+设备上对应的应用已经被禁用,无法查询。 + +**处理步骤**
+确认设备上对应的应用是否被禁用。 + +## 17700027 分布式服务未启动 + +**错误信息**
+The distributed service is not running. + +**错误描述**
+当调用distributedBundle模块的相关接口时,分布式服务未启动。 + +**可能原因**
+设备未组网。 + +**处理步骤**
+确认设备是否组网成功。 +## 17700028 输入的ability与type不匹配 + +**错误信息**
+The ability does not match the type. + +**错误描述**
+当调用defaultAppManager模块中的setDefaultApplication接口时,输入的ability与type不匹配。 + +**可能原因**
+输入的ability和type拼写有误。 + +**处理步骤**
+确认输入的ability和type拼写是否正确。 + +## 17700029 指定的ability被禁用 + +**错误信息**
+The specified ability is disabled. + +**错误描述**
+当调用查询ability相关信息的接口时,指定的ability被禁用。 + +**可能原因**
+指定的ability被禁用。 + +**处理步骤**
+确认指定的ability是否被禁用,可以使用[bm工具命令](../../../readme/%E5%8C%85%E7%AE%A1%E7%90%86%E5%AD%90%E7%B3%BB%E7%BB%9F.md%23bm%E5%B7%A5%E5%85%B7%E5%91%BD%E4%BB%A4)查询对应的应用信息。 + +## 17700030 指定的应用不支持清除缓存文件 + +**错误信息**
+The specified bundle does not support clearing of cache files. + +**错误描述**
+当调用bundleManager模块中的cleanBundleCacheFiles接口时,指定的应用不支持清除缓存文件。 + +**可能原因**
+指定的应用为系统应用且在签名证书中配置了不能清除数据(AllowAppDataNotCleared)的字段。 + +**处理步骤**
+1.确认指定的应用是否为系统应用,可以使用[bm工具命令](../../../readme/%E5%8C%85%E7%AE%A1%E7%90%86%E5%AD%90%E7%B3%BB%E7%BB%9F.md%23bm%E5%B7%A5%E5%85%B7%E5%91%BD%E4%BB%A4)查询对应的应用信息,查看isSystemApp是否为true。 +2.确认指定的应用是否配置了能清除缓存(AllowAppDataNotCleared)的字段,可以使用[bm工具命令](../../../readme/%E5%8C%85%E7%AE%A1%E7%90%86%E5%AD%90%E7%B3%BB%E7%BB%9F.md%23bm%E5%B7%A5%E5%85%B7%E5%91%BD%E4%BB%A4)查询对应的应用信息,查看userDataClearable是否为true。 + +## 17700031 Overlay特性校验失败导致HAP安装失败 + +**错误信息**
+Failed to install the HAP because the overlay check of the HAP is failed. + +**错误描述**
+当安装overlay特征的应用时,指定的应用和待安装的overlay特征应用不为预置应用,或者目标应用/目标module是overlay特征的应用/module。 + +**可能原因**
+1. 使用应用间的overlay特性时,overlay特征应用必须为预置应用。 +2. 使用应用间的overlay特性时,目标应用必须为预置应用。 +3. 使用应用间的overlay特性时,目标应用不能是具有overlay特征的应用 +4. 目标module不能是具有overlay特征的module。 + +**处理步骤**
+1. 检查overlay特征应用是否为预置应用。 +2. 检查目标应用是否为预置应用。 +3. 检查目标应用是否不为overlay特征的应用 +4. 检查目标module是否不为overlay特征的module。 + +## 17700032 指定的应用不包含overlay特征的module + +**错误信息**
+The specified bundle does not contain any overlay module. + +**错误描述**
+查询指定应用中overlay特征module的overlayModuleInfo时, 指定的应用不包含overlay特征module。 + +**可能原因**
+指定的应用不包含overlay特征module。 + +**处理步骤**
+检查指定的应用是否不包含overlay特征module。 + +## 17700033 指定的module不是overlay特征的module + +**错误信息**
+The specified module is not an overlay module. + +**错误描述**
+查询指定的overlay特征module的overlayModuleInfo时, 指定的module不是overlay特征module。 + +**可能原因**
+指定的module不是overlay特征的module。 + +**处理步骤**
+检查指定的module是否不为overlay特征的module。 + +## 17700034 指定的module是overlay特征的module + +**错误信息**
+The specified module is an overlay module. + +**错误描述**
+查询指定的目标module所关联的overlayModuleInfo时, 指定的module是overlay特征module。 + +**可能原因**
+指定的module是overlay特征的module。 + +**处理步骤**
+检查指定的module是否为overlay特征的module。 + +## 17700035 指定的应用只包含overlay特征的module + +**错误信息**
+The specified bundle is an overlay bundle. + +**错误描述**
+查询指定应用的目标module所关联的overlayModuleInfo时, 指定的应用只包含overlay特征的module。 + +**可能原因**
+指定的应用只包含overlay特征的module。 + +**处理步骤**
+检查指定的应用是否只包含overlay特征的module。 + +## 17700036 共享库缺少AllowAppShareLibrary特权导致安装失败 + +**错误信息**
+Failed to install the HSP because lacks appropriate permissions. + +**错误描述**
+共享库未申请配置AllowAppShareLibrary特权,可能存在安全隐私风险,不允许安装。 + +**可能原因**
+发布共享库前,未申请配置AllowAppShareLibrary特权。 + +**处理步骤**
+为共享库申请配置AllowAppShareLibrary特权,重新签名并发布。 + +## 17700037 被卸载的shared library版本被其他应用依赖 + +**错误信息**
+The version of shared bundle is dependent on other applications. + +**错误描述**
+当卸载shared library某一版本时,指定的shared library的版本被其他应用依赖,卸载失败。 + +**可能原因**
+1. 当前卸载的版本是shared library的最高版本,且该shared library被其他应用依赖。 +2. 当前卸载时未指定shared library的版本,会卸载shared library的所有版本,该shared library被其他应用依赖。 + +**处理步骤**
+1. 检查被卸载的shared library是否被其他应用依赖。 +2. 检查被卸载的版本是否为shared library的最高版本。 + +## 17700038 被卸载的shared library不存在 + +**错误信息**
+The specified shared bundle does not exist. + +**错误描述**
+当卸载shared library时,卸载的shared library不存在。 + +**可能原因**
+1. 当前指定卸载的版本不存在与被卸载的shared library中。 +2. 当前指定卸载的shared library不存在与设备中。 + +**处理步骤**
+1. 检查被卸载的shared library是否存在于当前设备中。 +2. 检查被卸载的版本是否存在于被卸载的shared library中。 + +## 17700039 不允许安装应用间共享库 +**错误信息**
+Failed to install because disallow install a shared bundle by hapFilePaths. + +**错误描述**
+安装应用时,传入的安装包为应用间共享库类型。 + +**可能原因**
+1. 通过bm工具安装应用时,-p参数传入了应用间共享库的安装包路径。 +2. 通过install接口安装应用时,hapFilePaths参数传入了应用间共享库的安装包路径。 + +**处理步骤**
+1. 通过-s参数指定应用间共享库的安装包路径。 +2. 通过installParam参数的sharedBundleDirPaths字段指定应用间共享库的安装包路径。 + +## 17700040 不允许卸载应用间共享库 +**错误信息**
+The specified bundle is a shared bundle which cannot be uninstalled. + +**错误描述**
+卸载应用时,传入的是应用间共享库的包名。 + +**可能原因**
+1. 通过bm工具卸载应用时,-n参数传入了应用间共享库的包名。 +2. 通过uninstall接口卸载应用时,bundleName传入的是应用间共享库的包名。 + +**处理步骤**
+1. 通过-s参数指定卸载的应用为共享库应用。 +2. 通过UninstallParam参数的bundleName及versionCode指定卸载的共享库的包名及版本。 + \ No newline at end of file diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-cert.md b/zh-cn/application-dev/reference/errorcodes/errorcode-cert.md index d74648af4d4ad600f10018a4f8aacb195b4d6d0d..cd94931d1547f1ca6ff27da8134d7e185cda70f8 100755 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-cert.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-cert.md @@ -1,4 +1,8 @@ -# cert错误码 +# cert错误码 + +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 ## 19020001 内存错误 diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-colorspace-manager.md b/zh-cn/application-dev/reference/errorcodes/errorcode-colorspace-manager.md index 28fc683cfb07d50038eba50994836a8b2af14b0a..6ec08ccdb426b19a1d8ad01d1063c2897e43d050 100755 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-colorspace-manager.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-colorspace-manager.md @@ -1,5 +1,9 @@ # 色彩管理错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 18600001 参数值异常 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-crypto-framework.md b/zh-cn/application-dev/reference/errorcodes/errorcode-crypto-framework.md index 5795b9b30ebd9de96559da6c73075d4fdeb18a0c..e84ee9283a4f82325c794bf3ab95d02dcd34809e 100755 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-crypto-framework.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-crypto-framework.md @@ -1,4 +1,8 @@ -# crypto framework错误码 +# crypto framework错误码 + +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 ## 17620001 内存错误 diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-data-rdb.md b/zh-cn/application-dev/reference/errorcodes/errorcode-data-rdb.md index 14f6bfc1665c1b6e990f5d5ac610f6a137988032..5fee0c6d8619bee3085668be83cc2450769f7422 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-data-rdb.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-data-rdb.md @@ -1,5 +1,9 @@ # 关系型数据库错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 14800010 数据库名称不合法 **错误信息** @@ -77,3 +81,22 @@ The column value is null or the column type is incompatible. 1. 检查结果集是否为空。 2. 检查结果集当前行号、列号是否超出范围。 3. 检查当前列数据类型是否支持。 + +## 14800047 WAL文件大小超过默认上限 + +**错误信息** + +The WAL file size exceeds the default limit. + +**错误描述** + +WAL文件大小超过默认上限(200M)。 + +**可能原因** + +在开启读事务或者结果集未关闭的情况下,不断执行增删改操作,导致WAL文件大小超过默认上限。 + +**处理步骤** + +1. 检查结果集或者事务是否未关闭。 +2. 关闭所有的结果集或者事务。 diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-datashare.md b/zh-cn/application-dev/reference/errorcodes/errorcode-datashare.md index b4deb99c4328c4e234b1e7a18d014e77da402a6c..4f7446c3eaed0fd052f5f5490c5845c8f1699379 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-datashare.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-datashare.md @@ -1,5 +1,9 @@ # 数据共享错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 15700010 创建DataShareHelper异常 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-device-manager.md b/zh-cn/application-dev/reference/errorcodes/errorcode-device-manager.md index 1884284f55f3636e0b366820dffa7d48a225da72..ae2b8ee9215e52d1d6b2f8033c52a696fe6d0dd2 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-device-manager.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-device-manager.md @@ -1,5 +1,9 @@ # 设备管理错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 11600101 服务调用异常 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-display.md b/zh-cn/application-dev/reference/errorcodes/errorcode-display.md index 2bcfa0750ea9341974bf8dd66388b36353d18ed6..3f45f72ce299fc7fb895fc58dcfef40ed6beac61 100755 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-display.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-display.md @@ -1,5 +1,9 @@ # 屏幕错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 1400001 无效的显示设备 **错误信息**
Invalid display or screen. diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-distributed-dataObject.md b/zh-cn/application-dev/reference/errorcodes/errorcode-distributed-dataObject.md index 1a48200bf58c284f7ba46b257d00d98d3e506904..f2a47b9dfa0e5d3f261671257787182c4df5cd78 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-distributed-dataObject.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-distributed-dataObject.md @@ -1,5 +1,9 @@ # 分布式数据对象错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 15400001 创建内存数据库失败 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-distributedKVStore.md b/zh-cn/application-dev/reference/errorcodes/errorcode-distributedKVStore.md index c387747a3624faee64a3540945112c879c8a073f..2ffa6efbe25f6dab6595c2e9ce93731cd182d02c 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-distributedKVStore.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-distributedKVStore.md @@ -1,22 +1,28 @@ # 分布式键值数据库错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 15100001 超过最大订阅数量 **错误信息** -Over max subscribe limits. +Over max limits. **错误描述** -该错误码表示在调用数据库变化订阅on接口时,订阅数量已超过最大限制。 +超过数据库订阅数目或者打开结果集数目最大支持上限。 **可能原因** -在调用订阅数据库变化接口时,对数据库的订阅数量已超过最大限制。 +1. 在调用订阅数据库变化接口on时,对数据库的订阅数量已超过最大限制数目8。 +2. 调用获取数据库结果集接口getResultSet时, 数据库当前打开的结果集数目超过最大限制数目8。 **处理步骤** -取消对数据库的部分订阅后,再次尝试订阅。 +1. 如果在调用订阅数据库变化接口on时,对数据库的订阅数量已超过最大限制,取消对数据库的部分订阅后,再次尝试订阅。 +2. 如果在调用获取数据库结果集接口getResultSet时数据库当前打开的结果集数目超过最大限制,关闭部分打开的结果集后重试。 ## 15100002 打开已有数据库时参数配置发生变化 @@ -98,4 +104,4 @@ Database or result set already closed. **处理步骤** 1. 在数据库相关操作前,请重新打开数据库之后再重试当前操作。 -2. 在查询结果集相关操作前,请重新查询获取结果集之后再重试当前操作。 \ No newline at end of file +2. 在查询结果集相关操作前,请重新查询获取结果集之后再重试当前操作。 diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-enterpriseDeviceManager.md b/zh-cn/application-dev/reference/errorcodes/errorcode-enterpriseDeviceManager.md index d8437ae84065a31262e8e17003e9a26190cd89a6..d44bae35cadf409fed2557018602e56501329a3a 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-enterpriseDeviceManager.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-enterpriseDeviceManager.md @@ -1,5 +1,9 @@ # 企业设备管理错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 9200001 应用没有激活成设备管理器 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-faultlogger.md b/zh-cn/application-dev/reference/errorcodes/errorcode-faultlogger.md index 3ed4da85c694859065392150c442d49fa7dcab10..e4aa5cf05a44602901040b3f2769cd52d9416962 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-faultlogger.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-faultlogger.md @@ -1,14 +1,18 @@ # Faultlogger 错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 10600001 服务未启动或故障 **错误信息** -The service is not running or broken. +The service is not started or is faulty. **错误描述** -服务未启动/故障。 +服务未启动或者遇到未知错误。 **可能原因** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-filemanagement.md b/zh-cn/application-dev/reference/errorcodes/errorcode-filemanagement.md index d9af0b188582db333768b05a65c43b5a46ca303f..3c68d9eb0a5b0b1f44c4dbf1bb54fd26ea70c24e 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-filemanagement.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-filemanagement.md @@ -1,4 +1,9 @@ -# 文件管理子系统错误码 +# 文件管理错误码 + +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + 文件管理子系统错误码由四部分组成,分别是基础文件IO错误码、用户数据管理错误码、公共文件访问错误码和空间统计错误码组成。 ## 基础文件IO错误码 diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-form.md b/zh-cn/application-dev/reference/errorcodes/errorcode-form.md index e5e05c3d76aeb97993dec9a9f89f3d40880946fb..7b15d808c428e485f3a1b09bddd5b6ba16b4b830 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-form.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-form.md @@ -1,5 +1,9 @@ # 卡片错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 16500001 内部错误 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-geoLocationManager.md b/zh-cn/application-dev/reference/errorcodes/errorcode-geoLocationManager.md index 59e55fbac0939b26f787555c7d46be6bb9158b03..9ce9ce18fed30455f5da33e35a495caf36d01cc6 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-geoLocationManager.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-geoLocationManager.md @@ -1,5 +1,9 @@ # 位置服务子系统错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 3301000 位置服务不可用 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-hiappevent.md b/zh-cn/application-dev/reference/errorcodes/errorcode-hiappevent.md index 5166f78088c57fdce16ca43bc2d54668bdea696e..1249deef43af46f479ec2ba0ac5d3abcff535066 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-hiappevent.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-hiappevent.md @@ -1,4 +1,8 @@ -# 应用事件打点错误码 +# 应用事件打点错误码 + +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 ## 11100001 打点功能被关闭 @@ -15,6 +19,7 @@ Function is disabled. 应用事件打点功能被关闭了。 **处理步骤** + 调用配置接口开启打点功能。 ```js @@ -41,6 +46,7 @@ Invalid event domain. - 事件领域名称非空且长度不超过32个字符。 **处理步骤** + 传入合法的事件领域名称。 ## 11101002 非法的事件名称 diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-hisysevent.md b/zh-cn/application-dev/reference/errorcodes/errorcode-hisysevent.md index 05de6b20d7d83bc1ad752804cba1804a6f3187c3..e09a5899bffca01afe67f3e25107f5b3625acce1 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-hisysevent.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-hisysevent.md @@ -1,5 +1,9 @@ # 系统事件错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 1120001 非法的事件领域 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-hiviewdfx-hidebug.md b/zh-cn/application-dev/reference/errorcodes/errorcode-hiviewdfx-hidebug.md index 4c843b8bbde55cd2fe27b1d4a47c10126a023c0f..2c050a6a237d91985cc50f6ed5f86bd83816d9a1 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-hiviewdfx-hidebug.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-hiviewdfx-hidebug.md @@ -1,5 +1,8 @@ # Hidebug错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 ## 11400101 系统服务获取失败 diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-huks.md b/zh-cn/application-dev/reference/errorcodes/errorcode-huks.md index d7222587ff651d569577e796449b74a011ca34ef..69aad2a6ede66487a6f321dbb0d323b01c16a182 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-huks.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-huks.md @@ -1,5 +1,9 @@ # HUKS错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 12000001 该子功能不支持(特性) **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-i18n.md b/zh-cn/application-dev/reference/errorcodes/errorcode-i18n.md index 3b6ba5548faa1d029b060135bf1990d9e5c02c4b..f0c62b09735560bfe14cf3271f24e6e910276926 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-i18n.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-i18n.md @@ -1,5 +1,9 @@ # I18n错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 890001 参数类型错误 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-inputmethod-framework.md b/zh-cn/application-dev/reference/errorcodes/errorcode-inputmethod-framework.md index 1a1ff6b678814c19bcceb1ec491d27488c6e0477..8da20d94a83b74fdfa869de87ec68d8b27708dac 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-inputmethod-framework.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-inputmethod-framework.md @@ -1,5 +1,9 @@ # 输入法框架错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 12800001 包管理服务异常 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-media.md b/zh-cn/application-dev/reference/errorcodes/errorcode-media.md index afce30c4f0b185f49b2805a17abd1360f25bd77b..9683b5805a3686bc81acc8084d17522a9016a7f5 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-media.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-media.md @@ -1,4 +1,8 @@ -# Media错误码 +# Media错误码 + +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 ## 5400101 内存分配失败 diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-multimodalinput.md b/zh-cn/application-dev/reference/errorcodes/errorcode-multimodalinput.md index d2dff5f5ca02401a4e6037ad82ec8fe3c5e077cb..94683a9fbed9f6eec70f4d2aa26907d7495fecdc 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-multimodalinput.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-multimodalinput.md @@ -1,5 +1,9 @@ # 键鼠穿越管理错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 4400001 目标设备描述符错误 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-net-connection.md b/zh-cn/application-dev/reference/errorcodes/errorcode-net-connection.md index 13a0082b9cfcbbb4d83100d2d8501577d8dce377..d3bd94b8b3ae99c3fe396906c4c48afaee121711 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-net-connection.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-net-connection.md @@ -1,5 +1,9 @@ # 网络连接管理错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 2100001 非法参数值 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-net-ethernet.md b/zh-cn/application-dev/reference/errorcodes/errorcode-net-ethernet.md index 2a262a58a29c022e764ed7149427c27323f32e5c..9da62b519dee086e40edcad453daee5e3c0a41b6 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-net-ethernet.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-net-ethernet.md @@ -1,5 +1,9 @@ # 以太网错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 2200001 非法参数值 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-net-http.md b/zh-cn/application-dev/reference/errorcodes/errorcode-net-http.md index c2b4187289de4cf9454bdb46b6a7fd41c0e7f01a..0dc5c021972ed263bf093d499d3a43d7764e982f 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-net-http.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-net-http.md @@ -1,5 +1,9 @@ # HTTP错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 2300001 不支持的协议 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-net-mdns.md b/zh-cn/application-dev/reference/errorcodes/errorcode-net-mdns.md new file mode 100644 index 0000000000000000000000000000000000000000..3578cc6a5775252a1f3e85f85cb8d52008823782 --- /dev/null +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-net-mdns.md @@ -0,0 +1,117 @@ +# MDNS错误码 + +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + +## 2100002 连接服务失败 + +**错误信息** + +Operation failed. Cannot connect to service. + +**错误描述** + +操作失败,连接系统服务发生异常。 + +**可能原因** + +服务发生异常。 + +**处理步骤** + +检查系统服务运行状态是否正常。 + +## 2100003 系统内部错误 + +**错误信息** + +System internal error. + +**错误描述** + +系统内部错误。 + +**可能原因** + +1.内存异常。 + +2.空指针。 + +**处理步骤** + +1.检查内存空间是否充足,清理内存后重试。 + +2.系统异常,请稍后重试或重启设备。 + +## 2204003 重复注册 + +**错误信息** + +Callback duplicated. + +**错误描述** + +callback 已经存在。 + +**可能原因** + +重复注册相同名称和类型的mDNS服务。 + +**处理步骤** + +检查mDNS服务是否存在。 + +## 2204008 删除服务失败 + +**错误信息** + +Service instance duplicated. + +**错误描述** + +想要移除的服务不存在。 + +**可能原因** + +之前已经把服务删除,二次删除相同服务。 + +**处理步骤** + +检查mDNS服务是否存在。 + +## 2204010 发送消息失败 + +**错误信息** + +Send packet failed. + +**错误描述** + +发送信息失败。 + +**可能原因** + +局域网内不存在该mDNS服务。 + +**处理步骤** + +检查局域网内目标mDNS服务是否存在。 + +## 2204006 解析服务超时 + +**错误信息** + +Request timeout. + +**错误描述** + +解析服务超时。 + +**可能原因** + +局域网内不存在该类型的mDNS服务。 + +**处理步骤** + +检查局域网内目标类型的mDNS服务是否存在。 \ No newline at end of file diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-net-policy.md b/zh-cn/application-dev/reference/errorcodes/errorcode-net-policy.md index 49db93f50b06584933a33ba608eb78db4c9dce90..f296f790cab8a15a81e965b80adeb9cec84833b8 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-net-policy.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-net-policy.md @@ -1,5 +1,9 @@ # 策略管理错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 2100001 非法参数值 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-net-sharing.md b/zh-cn/application-dev/reference/errorcodes/errorcode-net-sharing.md index 45da80ee1357b3ac7adb7c2ded0972ce34c645d6..69f483e09e621dd61764101a4928a814ad8363b0 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-net-sharing.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-net-sharing.md @@ -1,5 +1,9 @@ # 网络共享错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 2200001 非法参数值 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-net-socket.md b/zh-cn/application-dev/reference/errorcodes/errorcode-net-socket.md index f0bb305a18f0dcab466b678a3bf3c2c8e66f0031..dc037fcff3c611ed6ef72867539d1e3f2aef05df 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-net-socket.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-net-socket.md @@ -1,5 +1,9 @@ # Socket 错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 2301001 操作不允许 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-nfc.md b/zh-cn/application-dev/reference/errorcodes/errorcode-nfc.md index 9c73fdd1a51dc669768f88c0488d5d92d60f3ac3..044cb9e7e7c5b0e142bc9a906111c1e5f2c77ad2 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-nfc.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-nfc.md @@ -1,5 +1,9 @@ # NFC错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 3100101 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-notification.md b/zh-cn/application-dev/reference/errorcodes/errorcode-notification.md index cbeb3d3de04f386b31a25d6ae71f9fa195261a8c..901816affc8f5733eb086aecb518612b7846e59e 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-notification.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-notification.md @@ -1,5 +1,9 @@ # 通知错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 1600001 内部错误 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-pasteboard.md b/zh-cn/application-dev/reference/errorcodes/errorcode-pasteboard.md index 03f37480020359c096ad06cbdf9d16d4df32988e..1ee942912743ea69067919d23be7c285e88d2951 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-pasteboard.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-pasteboard.md @@ -1,5 +1,9 @@ # 剪贴板错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 12900001 索引超过范围 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-power.md b/zh-cn/application-dev/reference/errorcodes/errorcode-power.md index 235c30c55270902327d319a843c21d7ea250d0a1..3adeb45e6b0e7aec5e386ab8dd93223a372d4ace 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-power.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-power.md @@ -1,5 +1,9 @@ # 系统电源管理错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 4900101 连接服务失败 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-preferences.md b/zh-cn/application-dev/reference/errorcodes/errorcode-preferences.md index 46326c2abce75072ea3c1f0968743d0d8bed1f70..2a7fca5cc095bc5a4823f9ce587d7487adbb74de 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-preferences.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-preferences.md @@ -1,13 +1,17 @@ -# 首选项错误码 +# 用户首选项错误码 -## 15500010 删除首选项失败 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + +## 15500010 删除用户首选项持久化文件失败 **错误信息** Failed to delete preferences. **错误描述** -删除首选项失败。 +删除用户首选项持久化文件失败。 **可能原因** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-promptAction.md b/zh-cn/application-dev/reference/errorcodes/errorcode-promptAction.md index 193f2fad84401f0064e8ae2b817cf3dd270f9381..2cb583dededc690bd0f7bbf0ae4de3a139b902f3 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-promptAction.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-promptAction.md @@ -1,5 +1,9 @@ # 弹窗错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 100001 内部错误 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-reminderAgentManager.md b/zh-cn/application-dev/reference/errorcodes/errorcode-reminderAgentManager.md index 25ac918c2fc32f984f96e112f860ed122c8152c3..7f981f315f74b5157724617ec8cb1bc236143936 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-reminderAgentManager.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-reminderAgentManager.md @@ -1,5 +1,9 @@ # reminderAgentManager错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 1700001 通知使能未开启 **错误信息** @@ -32,8 +36,8 @@ The number of reminders exceeds the limit. **可能原因** -1. 当前系统提醒超过2000个。 -2. 当前应用提醒超过30个。 +1. 当前系统提醒超过2000个,api10及以后为12000个。 +2. 当前应用提醒超过30个,api10及以后普通应用30个,系统应用10000个。 **处理步骤** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-request.md b/zh-cn/application-dev/reference/errorcodes/errorcode-request.md index de898cb9a20669b61219528368bd5b934a00744e..3788520ef8d782e87703a9f664e0240e8b9df126 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-request.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-request.md @@ -1,5 +1,9 @@ # 上传下载错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 13400001 文件操作异常 **错误信息** @@ -26,11 +30,11 @@ Bad file path. **错误描述** -在调用uploadFile或downloadFile接口时,文件路径不合法。 +在调用uploadFile或downloadFile接口时,文件路径不合法或文件路径下文件已存在。 **可能原因** -该错误码表示文件路径异常,可能原因文件路径错误。 +该错误码表示文件路径异常,可能原因文件路径错误或文件路径下文件已存在。 **处理步骤** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-resource-manager.md b/zh-cn/application-dev/reference/errorcodes/errorcode-resource-manager.md index 93fbc1f8423fc26a45262d7055d77657f98bdb46..b77e345cc9bdb821fde3878c784a90ac56dcf813 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-resource-manager.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-resource-manager.md @@ -1,5 +1,9 @@ # 资源管理错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 9001001 无效的资源id **错误信息** @@ -110,4 +114,48 @@ the resource re-ref too much. **处理步骤** -查看资源$引用的地方,去除循环引用的情况。 \ No newline at end of file +查看资源$引用的地方,去除循环引用的情况。 + +## 9001007 根据当前id获取的资源格式化失败 + +**错误信息** + +The resource obtained by resId formatting error. + +**错误描述** + +resId获取的字符串资源格式化失败。 + +**可能原因** + +1、参数类型不在支持范围内。 + +2、参数与占位符个数不等。 + +3、参数与占位符类型不匹配。 + +**处理步骤** + +查看args参数类型与占位符的个数、类型是否一致。 + +## 9001008 根据当前名称获取的资源格式化失败 + +**错误信息** + +The resource obtained by resName formatting error. + +**错误描述** + +resName获取的字符串资源格式化失败。 + +**可能原因** + +1、参数类型不在支持范围内。 + +2、参数与占位符个数不等。 + +3、参数与占位符类型不匹配。 + +**处理步骤** + +查看args参数类型与占位符的个数、类型是否一致。 \ No newline at end of file diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-router.md b/zh-cn/application-dev/reference/errorcodes/errorcode-router.md index 6c0c856d7b7e6a62fb25f215a5e0d34a0e5d0ca0..474adf54898b3af6e183e6ea6d9621294dc9c54b 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-router.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-router.md @@ -1,5 +1,9 @@ # 页面路由错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 100001 内部错误 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-rpc.md b/zh-cn/application-dev/reference/errorcodes/errorcode-rpc.md index 533764276a46c24626c94a3af7927b92d290c036..b24b45d4a77440c05718b515c55932fab8a09141 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-rpc.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-rpc.md @@ -1,5 +1,9 @@ # RPC错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + 从API version 9起,IPC支持异常返回功能。错误码对应数值及含义如下。 ## 1900001 系统调用mmap失败 diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-runninglock.md b/zh-cn/application-dev/reference/errorcodes/errorcode-runninglock.md index e346d88ec7d26c3d25e0b935ce1d1007b659cd78..27da400a345622ef1a995b28725443fc96f29e69 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-runninglock.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-runninglock.md @@ -1,5 +1,9 @@ # RunningLock锁错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 4900101 连接服务失败 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-screenlock.md b/zh-cn/application-dev/reference/errorcodes/errorcode-screenlock.md index 5f9cf5bbfa52f24a3d2461e2a4b8516127bb9495..e0a90fbd216ae53a72e8abb9bc6ca31949161aae 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-screenlock.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-screenlock.md @@ -1,5 +1,9 @@ # 锁屏服务错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 13200002 锁屏服务异常 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-sensor.md b/zh-cn/application-dev/reference/errorcodes/errorcode-sensor.md index add7b1aa6109a85fab4741bcb205fa4ec2f891fd..954d2b372edff6bc8cbd90005a55ae07e8379485 100755 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-sensor.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-sensor.md @@ -1,5 +1,9 @@ # 传感器错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 14500101 传感器服务异常 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-system-parameterV9.md b/zh-cn/application-dev/reference/errorcodes/errorcode-system-parameterV9.md index 58b8a3e1340479efa4dae169c9f0c7e787654d29..7cd3ae4991f6c9219a7ae1ec7db504d28d2afff9 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-system-parameterV9.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-system-parameterV9.md @@ -1,5 +1,9 @@ # 系统参数错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 14700101 系统参数查找失败 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-telephony.md b/zh-cn/application-dev/reference/errorcodes/errorcode-telephony.md index a80ec138f93e6fad1ab340ee77506a0250ca3642..de54fa37a38ea3ad19d9bac634e09e78f0627ad4 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-telephony.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-telephony.md @@ -1,5 +1,9 @@ # 电话子系统错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 8300001 输入参数不在处理范围内 **错误信息** @@ -165,8 +169,8 @@ UT未连接 **可能原因** -当前运营商不支持从Wifi下发UT请求,但是当前手机Wifi已连上。 +当前运营商不支持从WIFI下发UT请求,但是当前设备WIFI已连上。 **处理步骤** -断开wifi,再重发UT请求。 +断开WIFI,再重发UT请求。 diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-thermal.md b/zh-cn/application-dev/reference/errorcodes/errorcode-thermal.md index e5665089092a315655ceb517e275147af89776b6..3147fa1ea50f89e4e519327835c941bdb3452120 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-thermal.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-thermal.md @@ -1,5 +1,9 @@ # 热管理错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 4800101 连接服务失败 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-time.md b/zh-cn/application-dev/reference/errorcodes/errorcode-time.md index 1ceca485130c9cb34734cd37c23f04b3c6249054..0db7d914609f68b460b55ffd7e5a9b9f57adeb13 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-time.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-time.md @@ -1,5 +1,9 @@ # 时间时区服务错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## -1 锁屏服务异常 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-uitest.md b/zh-cn/application-dev/reference/errorcodes/errorcode-uitest.md index dda3aabebadab92b9937e8f86039344e87329343..f338af3a2c01ba5e32a5b7b3cf3fc9a1aa34a190 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-uitest.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-uitest.md @@ -1,5 +1,9 @@ # uitest错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 17000001 初始化失败 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-update.md b/zh-cn/application-dev/reference/errorcodes/errorcode-update.md index 22ae27375a550ebc47d1ddadd2d9ea843254907c..a524c29cfaa081355fe1d04ac6e65337991139d7 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-update.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-update.md @@ -1,5 +1,9 @@ # 升级错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 11500104 IPC通信异常 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-usb.md b/zh-cn/application-dev/reference/errorcodes/errorcode-usb.md index 4a7910cc0b9a9074c002185ab880e9a3030a91ac..cdd4f5e38be8927562d57490898158220d7f1f7e 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-usb.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-usb.md @@ -1,5 +1,9 @@ # USB服务错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 14400001 连接USB设备被拒绝 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-useriam.md b/zh-cn/application-dev/reference/errorcodes/errorcode-useriam.md index dd75ce307816b83054f586a8ae6b7f2d9b6ac1c4..e4f0730df0c192f96055bff6ccb9de918290f00e 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-useriam.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-useriam.md @@ -1,16 +1,8 @@ -# 用户认证错误码 +# 用户认证错误码 -## 201 权限验证失败 - -具体参见[通用错误码](./errorcode-universal.md) - -## 202 调用方不是一个系统应用 - -具体参见[通用错误码](./errorcode-universal.md) - -## 401 参数不正确 - -具体参见[通用错误码](./errorcode-universal.md) +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 ## 12500001 认证失败 diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-utils.md b/zh-cn/application-dev/reference/errorcodes/errorcode-utils.md index eab38038d22bcd536f7a131261296cb16e652600..a672b1cfb0dadc5470fc9f990e542e64b616a93f 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-utils.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-utils.md @@ -1,5 +1,9 @@ # 语言基础类库错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 10200001 参数范围越界错误 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-vibrator.md b/zh-cn/application-dev/reference/errorcodes/errorcode-vibrator.md index 5787a083a24ecde7ceaa44ff579ade5332064f7f..7a0e2c8b82e836532768f7953e01206222fd5f66 100755 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-vibrator.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-vibrator.md @@ -1,5 +1,9 @@ # 振动错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 14600101 操作设备失败 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-webview.md b/zh-cn/application-dev/reference/errorcodes/errorcode-webview.md index cd26bd77161593095c7773e63c95e74f06a04be4..5f7b09ca0e830ac13f6cb507f5deede60309647f 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-webview.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-webview.md @@ -1,5 +1,8 @@ # Webview错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 ## 17100001 WebviewController没有和具体的Web组件关联 @@ -226,3 +229,41 @@ Invalid web storage origin. 2. 如果已经使用,检查调用失败原因,如databaseAccess开发是否打开。 + +## 17100013 申请内存失败 + +**错误信息** + +New failed, out of memeory. + +**错误描述** + +申请失败,内存不足。 + +**可能原因** + +需要发送的数据过大,导致申请内存失败。 + +**处理步骤** + +检查需要发送的数据的长度。 + + +## 17100014 类型和值不匹配 + +**错误信息** + +The type does not match with the value of the message. + +**错误描述** + +消息的类型和值不匹配。 + +**可能原因** + +获取消息的值和消息本身的类型不匹配。 + +**处理步骤** + +需要根据消息的类型调用相应的接口来获取消息的值。举例:如获取到的类型是BOOLEAN,则需要调用GetBoolean接口来获取布尔值。 + diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-wifi.md b/zh-cn/application-dev/reference/errorcodes/errorcode-wifi.md index 348a833f12c55cf709c9c22c8ec00e516421b27a..6f73f658a0da1b3ecdbdb669a0f59da19bbda93c 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-wifi.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-wifi.md @@ -1,5 +1,9 @@ # WIFI错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 2401000 STA内部异常 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-window.md b/zh-cn/application-dev/reference/errorcodes/errorcode-window.md index ece08787c2d65a1a7b120e6447196d26c8419c86..bb34be2b84169a9a4bbfe28ff63a8c616f1970b2 100755 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-window.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-window.md @@ -1,5 +1,9 @@ # 窗口错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 1300001 重复操作 **错误信息**
Repeated operation. diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-workScheduler.md b/zh-cn/application-dev/reference/errorcodes/errorcode-workScheduler.md index 4177243c2312a4bcef18cd5f74526085e7283d43..4d40e59ea0e42933143358bb8ddf169c81249930 100644 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-workScheduler.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-workScheduler.md @@ -1,5 +1,9 @@ # workScheduler错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 9700001 内存操作失败 **错误信息** diff --git a/zh-cn/application-dev/reference/errorcodes/errorcode-zlib.md b/zh-cn/application-dev/reference/errorcodes/errorcode-zlib.md index 5c70b5f61069f05093c8a53d8aa3e35123c52f38..7702ca82f46d12042a6b187df3cd2cf06b93e861 100755 --- a/zh-cn/application-dev/reference/errorcodes/errorcode-zlib.md +++ b/zh-cn/application-dev/reference/errorcodes/errorcode-zlib.md @@ -1,5 +1,9 @@ # zlib子系统错误码 +> **说明:** +> +> 以下仅介绍本模块特有错误码,通用错误码请参考[通用错误码说明文档](errorcode-universal.md)。 + ## 900001 传入的源文件错误 **错误信息** diff --git a/zh-cn/application-dev/reference/js-service-widget-ui/js-service-widget-basic-span.md b/zh-cn/application-dev/reference/js-service-widget-ui/js-service-widget-basic-span.md index cd221afedbcecb0f1858dc4945c18039b23f4f81..48f95def63cb5744d872baa1860385a8292bb8fd 100644 --- a/zh-cn/application-dev/reference/js-service-widget-ui/js-service-widget-basic-span.md +++ b/zh-cn/application-dev/reference/js-service-widget-ui/js-service-widget-basic-span.md @@ -25,7 +25,7 @@ | 名称 | 类型 | 默认值 | 必填 | 描述 | | -------- | -------- | -------- | -------- | -------- | | color | <color> | - | 否 | 设置文本段落的文本颜色。 | -| font-size | <length> | 30px | 否 | 设置文本段落的文本尺寸。 | +| font-size | <length> | 16px | 否 | 设置文本段落的文本尺寸。 | | font-style | string | normal | 否 | 设置文本段落的字体样式,见[text组件font-style的样式属性](js-service-widget-basic-text.md#样式)。 | | font-weight | number \| string | normal | 否 | 设置文本段落的字体粗细,见[text组件font-weight的样式属性](js-service-widget-basic-text.md#样式)。 | | text-decoration | string | none | 否 | 设置文本段落的文本修饰,见[text组件text-decoration样式属性](js-service-widget-basic-text.md#样式)。 | diff --git a/zh-cn/application-dev/reference/js-service-widget-ui/js-service-widget-basic-text.md b/zh-cn/application-dev/reference/js-service-widget-ui/js-service-widget-basic-text.md index f96d625c8a3f7c98fdbaeb6ef25b43de3f442de4..9c9a92037787fd8ce1be188c987e1b6c1ba225a1 100644 --- a/zh-cn/application-dev/reference/js-service-widget-ui/js-service-widget-basic-text.md +++ b/zh-cn/application-dev/reference/js-service-widget-ui/js-service-widget-basic-text.md @@ -25,7 +25,7 @@ | 名称 | 类型 | 默认值 | 必填 | 描述 | | -------- | -------- | -------- | -------- | -------- | | color | <color> | - | 否 | 设置文本的颜色。 | -| font-size | <length> | 30px | 否 | 设置文本的尺寸。 | +| font-size | <length> | 16px | 否 | 设置文本的尺寸。 | | letter-spacing | <length> | 0px | 否 | 设置文本的字符间距。 | | font-style | string | normal | 否 | 设置文本的字体样式,可选值为:
- normal:标准的字体样式;
- italic:斜体的字体样式。 | | font-weight | number \| string | normal | 否 | 设置文本的字体粗细,number类型取值[100, 900],默认为400,取值越大,字体越粗。
- number取值必须为100的整数倍。
- string类型取值支持如下四个值:lighter、normal、bold、bolder。 | diff --git a/zh-cn/application-dev/reference/js-service-widget-ui/js-service-widget-file.md b/zh-cn/application-dev/reference/js-service-widget-ui/js-service-widget-file.md index f4684f5c8937166c2d1d4425b73a46f7035c8a96..cfe46dcd3b83e79e90b8b4b29479214e3b179932 100644 --- a/zh-cn/application-dev/reference/js-service-widget-ui/js-service-widget-file.md +++ b/zh-cn/application-dev/reference/js-service-widget-ui/js-service-widget-file.md @@ -60,4 +60,4 @@ JS服务卡片(entry/src/main/js/Widget)的典型开发目录结构如下: FA卡片需要在应用配置文件config.json中进行配置。详细的配置内容请参考[FA卡片配置文件说明](../../application-models/widget-development-fa.md#配置卡片配置文件)。 -Stage卡片需要在应用配置文件module.json5中的extensionAbilities标签下,配置ExtensionAbility相关信息。详细的配置内容请参考[Stage卡片配置文件说明](../../application-models/widget-development-stage.md#配置卡片配置文件)。 \ No newline at end of file +Stage卡片需要在应用配置文件module.json5中的extensionAbilities标签下,配置ExtensionAbility相关信息。详细的配置内容请参考[Stage卡片配置文件说明](../../application-models/arkts-ui-widget-configuration.md)。 diff --git a/zh-cn/application-dev/reference/native-apis/_audio_decoder.md b/zh-cn/application-dev/reference/native-apis/_audio_decoder.md index dba176333f7234ad5a5cdb60e543d58c43138df8..bd434a343ca936184a44d9c07b44710b844ff51a 100644 --- a/zh-cn/application-dev/reference/native-apis/_audio_decoder.md +++ b/zh-cn/application-dev/reference/native-apis/_audio_decoder.md @@ -3,7 +3,7 @@ ## 概述 -AudioDecoder模块提供用于音频解码功能的函数。 +AudioDecoder模块提供用于音频解码功能的函数。该模块在部分设备上可能不支持,可以通过[CanIUse](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/syscap.md)接口确认。 @syscap SystemCapability.Multimedia.Media.AudioDecoder diff --git a/zh-cn/application-dev/reference/native-apis/_audio_encoder.md b/zh-cn/application-dev/reference/native-apis/_audio_encoder.md index 088def8941959030ba924013f6a729c998957bc0..3c011bcc363ab52cb91aa0a969d43fcde062b2ba 100644 --- a/zh-cn/application-dev/reference/native-apis/_audio_encoder.md +++ b/zh-cn/application-dev/reference/native-apis/_audio_encoder.md @@ -3,7 +3,7 @@ ## 概述 -AudioEncoder模块提供用于音频编码功能的函数。 +AudioEncoder模块提供用于音频编码功能的函数。该模块在部分设备上可能不支持,可以通过[CanIUse](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/syscap.md)接口确认。 @syscap SystemCapability.Multimedia.Media.AudioEncoder diff --git a/zh-cn/application-dev/reference/native-apis/_codec_base.md b/zh-cn/application-dev/reference/native-apis/_codec_base.md index 8447b567a850200de0311367940e1a6da35ca65e..aa3be62e1ec6e78273ea5fc1316d1f5d18d9eb9f 100644 --- a/zh-cn/application-dev/reference/native-apis/_codec_base.md +++ b/zh-cn/application-dev/reference/native-apis/_codec_base.md @@ -3,7 +3,7 @@ ## 概述 -CodecBase模块提供运行音视频编解码通用的结构体、字符常量、枚举。 +CodecBase模块提供运行音视频编解码通用的结构体、字符常量、枚举。该模块在部分设备上可能不支持,可以通过[CanIUse](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/syscap.md)接口确认。 @syscap SystemCapability.Multimedia.Media.CodecBase diff --git a/zh-cn/application-dev/reference/native-apis/_mind_spore.md b/zh-cn/application-dev/reference/native-apis/_mind_spore.md index 57d24f5758b2a53cee3d86da8e59f3bf07181668..dee9088c444b0a20e691f168170b29b892bd831a 100644 --- a/zh-cn/application-dev/reference/native-apis/_mind_spore.md +++ b/zh-cn/application-dev/reference/native-apis/_mind_spore.md @@ -19,13 +19,13 @@ | 文件名称 | 描述 | | -------- | -------- | -| [context.h](context_8h.md) | 提供了Context相关的接口,可以配置运行时信息。 | -| [data_type.h](data__type_8h.md) | 声明了张量的数据的类型。 | -| [format.h](format_8h.md) | 提供张量数据的排列格式。 | -| [model.h](model_8h.md) | 提供了模型相关接口,可以用于模型创建、模型推理等。 | -| [status.h](status_8h.md) | 提供了Mindspore Lite运行时的状态码。 | -| [tensor.h](tensor_8h.md) | 提供了张量相关的接口,可用于创建和修改张量信息。 | -| [types.h](types_8h.md) | 提供了MindSpore Lite支持的模型文件类型和设备类型。 | +| [context.h](context_8h.md) | 提供了Context相关的接口,可以配置运行时信息。
引用文件:\ | +| [data_type.h](data__type_8h.md) | 声明了张量的数据的类型。
引用文件:\ | +| [format.h](format_8h.md) | 提供张量数据的排列格式。
引用文件:\ | +| [model.h](model_8h.md) | 提供了模型相关接口,可以用于模型创建、模型推理等。
引用文件:\ | +| [status.h](status_8h.md) | 提供了Mindspore Lite运行时的状态码。
引用文件:\ | +| [tensor.h](tensor_8h.md) | 提供了张量相关的接口,可用于创建和修改张量信息。
引用文件:\ | +| [types.h](types_8h.md) | 提供了MindSpore Lite支持的模型文件类型和设备类型。
引用文件:\ | ### 结构体 diff --git a/zh-cn/application-dev/reference/native-apis/_neural_nework_runtime.md b/zh-cn/application-dev/reference/native-apis/_neural_nework_runtime.md index e265384899356daddc00292c13c345bd28152d49..71314462cb1b34f6fb1a4c191d2b089d120c3024 100644 --- a/zh-cn/application-dev/reference/native-apis/_neural_nework_runtime.md +++ b/zh-cn/application-dev/reference/native-apis/_neural_nework_runtime.md @@ -20,8 +20,8 @@ | 文件名称 | 描述 | | -------- | -------- | -| [neural_network_runtime.h](neural__network__runtime_8h.md) | Neural Network Runtime部件接口定义,AI推理框架通过Neural Network Runtime提供的Native接口,完成模型构造与编译,并在加速硬件上执行推理计算。 | -| [neural_network_runtime_type.h](neural__network__runtime__type_8h.md) | Neural Network Runtime定义的结构体和枚举值。 | +| [neural_network_runtime.h](neural__network__runtime_8h.md) | Neural Network Runtime部件接口定义,AI推理框架通过Neural Network Runtime提供的Native接口,完成模型构造与编译,并在加速硬件上执行推理计算。
引用文件:\ | +| [neural_network_runtime_type.h](neural__network__runtime__type_8h.md) | Neural Network Runtime定义的结构体和枚举值。
引用文件:\ | ### 结构体 diff --git a/zh-cn/application-dev/reference/native-apis/_o_h___native_x_component.md b/zh-cn/application-dev/reference/native-apis/_o_h___native_x_component.md index 9e5eee39f76b083fc6480f813e7464b1146f0146..19e47ea2af3730c9f6cd4a8fef73d9693430a909 100644 --- a/zh-cn/application-dev/reference/native-apis/_o_h___native_x_component.md +++ b/zh-cn/application-dev/reference/native-apis/_o_h___native_x_component.md @@ -415,7 +415,7 @@ int32_t OH_NativeXComponent_GetTouchPointTiltX (OH_NativeXComponent * component, | -------- | -------- | | component | 表示指向OH_NativeXComponent实例的指针。 | | pointIndex | 表示触摸点的指针索引。 | -| tiltX | 表示指向Y倾斜度的指针。 | +| tiltY | 表示指向Y倾斜度的指针。 | **返回:** diff --git a/zh-cn/application-dev/reference/native-apis/_ohos_pixel_map_info.md b/zh-cn/application-dev/reference/native-apis/_ohos_pixel_map_info.md index fcce8eaa40a6b08002d09bfdde617cd87d12b167..00e40e5e37abeee7c8e2c84c2d88bd9888bc6bf9 100644 --- a/zh-cn/application-dev/reference/native-apis/_ohos_pixel_map_info.md +++ b/zh-cn/application-dev/reference/native-apis/_ohos_pixel_map_info.md @@ -21,10 +21,10 @@ | 成员变量名称 | 描述 | | -------- | -------- | -| [width](#width) | 图片的高,用pixels表示。 | -| [height](#height) | Pixel的格式。 | +| [width](#width) | 图片的宽,用pixels表示。 | +| [height](#height) | 图片的高,用pixels表示。 | | [rowSize](#rowsize) | 每行的bytes数。 | -| [pixelFormat](#pixelformat) | 图片的宽,用pixels表示。 | +| [pixelFormat](#pixelformat) | Pixel的格式。 | ## 结构体成员变量说明 diff --git a/zh-cn/application-dev/reference/native-apis/_video_decoder.md b/zh-cn/application-dev/reference/native-apis/_video_decoder.md index e14a226d2513e514cf448d2e81772bb452598723..a53a04ceaac7926389522bd400869fefc1859bf3 100644 --- a/zh-cn/application-dev/reference/native-apis/_video_decoder.md +++ b/zh-cn/application-dev/reference/native-apis/_video_decoder.md @@ -3,7 +3,7 @@ ## 概述 -VideoDecoder模块提供用于视频解码功能的函数。 +VideoDecoder模块提供用于视频解码功能的函数。该模块在部分设备上可能不支持,可以通过[CanIUse](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/syscap.md)接口确认。 @syscap SystemCapability.Multimedia.Media.VideoDecoder diff --git a/zh-cn/application-dev/reference/native-apis/_video_encoder.md b/zh-cn/application-dev/reference/native-apis/_video_encoder.md index 1add6078088f5133af03e1e7565e653957364e75..b7bf9abf6a31cdb4201bb87b8b3c2649d2f0f816 100644 --- a/zh-cn/application-dev/reference/native-apis/_video_encoder.md +++ b/zh-cn/application-dev/reference/native-apis/_video_encoder.md @@ -3,7 +3,7 @@ ## 概述 -VideoEncoder模块提供用于视频编码功能的函数和枚举。 +VideoEncoder模块提供用于视频编码功能的函数和枚举。该模块在部分设备上可能不支持,可以通过[CanIUse](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/syscap.md)接口确认。 @syscap SystemCapability.Multimedia.Media.VideoEncoder diff --git a/zh-cn/application-dev/reference/native-apis/log_8h.md b/zh-cn/application-dev/reference/native-apis/log_8h.md index 3ee4fe180aaf65daacf6b41257995f2c50633343..9808600be527d5dc0e90258b6d7878f5ff0f9e7e 100644 --- a/zh-cn/application-dev/reference/native-apis/log_8h.md +++ b/zh-cn/application-dev/reference/native-apis/log_8h.md @@ -65,7 +65,7 @@ HILOG_WARN(LOG_APP, "Failed to visit %{private}s, reason:%{public}d.", url, errn | [OH_LOG_INFO](_hi_log.md#oh_log_info)(type, ...) ((void)[OH_LOG_Print](_hi_log.md#oh_log_print)((type), LOG_INFO, LOG_DOMAIN, LOG_TAG, \_\_VA\_ARGS\_\_)) | INFO级别写日志,宏封装接口。 | | [OH_LOG_WARN](_hi_log.md#oh_log_warn)(type, ...) ((void)[OH_LOG_Print](_hi_log.md#oh_log_print)((type), LOG_WARN, LOG_DOMAIN, LOG_TAG, \_\_VA\_ARGS\_\_)) | WARN级别写日志,宏封装接口。 | | [OH_LOG_ERROR](_hi_log.md#oh_log_error)(type, ...) ((void)[OH_LOG_Print](_hi_log.md#oh_log_print)((type), LOG_ERROR, LOG_DOMAIN, LOG_TAG, \_\_VA\_ARGS\_\_)) | ERROR级别写日志,宏封装接口。 | -| [OH_LOG_FATAL](_hi_log.md#oh_log_fatal)(type, ...) ((void)HiLogPrint((type), LOG_FATAL, LOG_DOMAIN, LOG_TAG, \_\_VA\_ARGS\_\_s)) | FATAL级别写日志,宏封装接口。 | +| [OH_LOG_FATAL](_hi_log.md#oh_log_fatal)(type, ...) ((void)HiLogPrint((type), LOG_FATAL, LOG_DOMAIN, LOG_TAG, \_\_VA\_ARGS\_\_)) | FATAL级别写日志,宏封装接口。 | ### 枚举 @@ -80,5 +80,5 @@ HILOG_WARN(LOG_APP, "Failed to visit %{private}s, reason:%{public}d.", url, errn | 函数名称 | 描述 | | -------- | -------- | -| [OH_LOG_Print](_hi_log.md#oh_log_print) ([LogType](_hi_log.md#logtype) type, [LogLevel](_hi_log.md#loglevel) level, unsigned int domain, const char \*tag, const char \*fmt,...) __attribute__((__format__(os_log | 写日志接口。 | +| [OH_LOG_Print](_hi_log.md#oh_log_print) ([LogType](_hi_log.md#logtype) type, [LogLevel](_hi_log.md#loglevel) level, unsigned int domain, const char \*tag, const char \*fmt,...) \_\_attribute__((\_\_format__(os_log, 5, 6))) | 写日志接口。 | | [OH_LOG_IsLoggable](_hi_log.md#oh_log_isloggable) (unsigned int domain, const char \*tag, [LogLevel](_hi_log.md#loglevel) level) | 检查指定业务领域、TAG、级别的日志是否可以打印。 | diff --git a/zh-cn/application-dev/reference/native-apis/native__avcodec__base_8h.md b/zh-cn/application-dev/reference/native-apis/native__avcodec__base_8h.md index b97542018deb536c968092148abab85c8f06cfa0..457fd4b628f8d8a3968c09ab85409534c8f8b6bd 100644 --- a/zh-cn/application-dev/reference/native-apis/native__avcodec__base_8h.md +++ b/zh-cn/application-dev/reference/native-apis/native__avcodec__base_8h.md @@ -54,23 +54,23 @@ | 名称 | 描述 | | -------- | -------- | -| [OH_AVCODEC_MIMETYPE_VIDEO_AVC](_codec_base.md#oh_avcodec_mimetype_video_avc) | const char \*
AVC视频编解码器的MIME类型。| -| [OH_AVCODEC_MIMETYPE_AUDIO_AAC](_codec_base.md#oh_avcodec_mimetype_audio_aac) | const char \*
AAC音频编解码器的MIME类型。| -| [OH_ED_KEY_TIME_STAMP](_codec_base.md#oh_ed_key_time_stamp) | const char \*
提供统一的surface Buffer附属数据的字符描述符。| -| [OH_ED_KEY_EOS](_codec_base.md#oh_ed_key_eos) | const char \* | -| [OH_MD_KEY_TRACK_TYPE](_codec_base.md#oh_md_key_track_type) | const char \*
为媒体播放框架提供统一的字符描述符。| -| [OH_MD_KEY_CODEC_MIME](_codec_base.md#oh_md_key_codec_mime) | const char \* | -| [OH_MD_KEY_DURATION](_codec_base.md#oh_md_key_duration) | const char \* | -| [OH_MD_KEY_BITRATE](_codec_base.md#oh_md_key_bitrate) | const char \* | -| [OH_MD_KEY_MAX_INPUT_SIZE](_codec_base.md#oh_md_key_max_input_size) | const char \* | -| [OH_MD_KEY_WIDTH](_codec_base.md#oh_md_key_width) | const char \* | -| [OH_MD_KEY_HEIGHT](_codec_base.md#oh_md_key_height) | const char \* | -| [OH_MD_KEY_PIXEL_FORMAT](_codec_base.md#oh_md_key_pixel_format) | const char \* | -| [OH_MD_KEY_AUDIO_SAMPLE_FORMAT](_codec_base.md#oh_md_key_audio_sample_format) | const char \* | -| [OH_MD_KEY_FRAME_RATE](_codec_base.md#oh_md_key_frame_rate) | const char \* | -| [OH_MD_KEY_VIDEO_ENCODE_BITRATE_MODE](_codec_base.md#oh_md_key_video_encode_bitrate_mode) | const char \* | -| [OH_MD_KEY_PROFILE](_codec_base.md#oh_md_key_profile) | const char \* | -| [OH_MD_KEY_AUD_CHANNEL_COUNT](_codec_base.md#oh_md_key_aud_channel_count) | const char \* | -| [OH_MD_KEY_AUD_SAMPLE_RATE](_codec_base.md#oh_md_key_aud_sample_rate) | const char \* | -| [OH_MD_KEY_I_FRAME_INTERVAL](_codec_base.md#oh_md_key_i_frame_interval) | const char \* | -| [OH_MD_KEY_ROTATION](_codec_base.md#oh_md_key_rotation) | const char \* | +| [OH_AVCODEC_MIMETYPE_VIDEO_AVC](_codec_base.md#oh_avcodec_mimetype_video_avc) | AVC视频编解码器的MIME类型。| +| [OH_AVCODEC_MIMETYPE_AUDIO_AAC](_codec_base.md#oh_avcodec_mimetype_audio_aac) | AAC音频编解码器的MIME类型。| +| [OH_ED_KEY_TIME_STAMP](_codec_base.md#oh_ed_key_time_stamp) | 提供统一的surface Buffer附属数据的字符描述符。| +| [OH_ED_KEY_EOS](_codec_base.md#oh_ed_key_eos) | surface附属数据中结束流的字符描述符,值类型为bool。 | +| [OH_MD_KEY_TRACK_TYPE](_codec_base.md#oh_md_key_track_type) | 为媒体播放框架提供统一的字符描述符。| +| [OH_MD_KEY_CODEC_MIME](_codec_base.md#oh_md_key_codec_mime) | MIME类型的字符描述符,值类型为string。 | +| [OH_MD_KEY_DURATION](_codec_base.md#oh_md_key_duration) |duration的字符描述符,值类型为int64_t。| +| [OH_MD_KEY_BITRATE](_codec_base.md#oh_md_key_bitrate) | 比特率的字符描述符,值类型为uint32_t。 | +| [OH_MD_KEY_MAX_INPUT_SIZE](_codec_base.md#oh_md_key_max_input_size) | 最大输入尺寸的字符描述符,值类型为uint32_t。 | +| [OH_MD_KEY_WIDTH](_codec_base.md#oh_md_key_width) | 视频宽度的字符描述符,值类型为uint32_t。 | +| [OH_MD_KEY_HEIGHT](_codec_base.md#oh_md_key_height) | 视频高度的字符描述符,值类型为uint32_t。 | +| [OH_MD_KEY_PIXEL_FORMAT](_codec_base.md#oh_md_key_pixel_format) | 视频像素格式的字符描述符,值类型为int32_t,具体见[OH_AVPixelFormat](_core.md#oh_avpixelformat)。 | +| [OH_MD_KEY_AUDIO_SAMPLE_FORMAT](_codec_base.md#oh_md_key_audio_sample_format) | 音频采样格式的字符描述符,值类型为uint32_t。 | +| [OH_MD_KEY_FRAME_RATE](_codec_base.md#oh_md_key_frame_rate) | 视频帧率的字符描述符,值类型为double。| +| [OH_MD_KEY_VIDEO_ENCODE_BITRATE_MODE](_codec_base.md#oh_md_key_video_encode_bitrate_mode) | 视频编码比特率模式的字符描述符,值类型为int32_t,具体见[OH_VideoEncodeBitrateMode](_video_encoder.md#oh_videoencodebitratemode)。 | +| [OH_MD_KEY_PROFILE](_codec_base.md#oh_md_key_profile) | 音视频编码能力的字符描述符,值类型为int32_t,具体见[OH_AVCProfile](_codec_base.md#oh_avcprofile)或[OH_AACProfile](_codec_base.md#oh_aacprofile)。 | +| [OH_MD_KEY_AUD_CHANNEL_COUNT](_codec_base.md#oh_md_key_aud_channel_count) | 音频声道数的字符描述符,值类型为uint32_t。 | +| [OH_MD_KEY_AUD_SAMPLE_RATE](_codec_base.md#oh_md_key_aud_sample_rate) | 音频采样率的字符描述符,值类型为uint32_t。 | +| [OH_MD_KEY_I_FRAME_INTERVAL](_codec_base.md#oh_md_key_i_frame_interval) | I帧间隔时长的字符描述符,值类型为int32_t,单位是毫秒。| +| [OH_MD_KEY_ROTATION](_codec_base.md#oh_md_key_rotation) | surface旋转角度的字符描述符,值类型为int32_t,限于{0, 90, 180, 270},默认值为0。 | diff --git a/zh-cn/application-dev/reference/native-apis/rawfile.md b/zh-cn/application-dev/reference/native-apis/rawfile.md index c416450e827cde5420c6cda924c0b8c687243fc1..286cbd6f131c777f0681ee362716462f69bbafc9 100644 --- a/zh-cn/application-dev/reference/native-apis/rawfile.md +++ b/zh-cn/application-dev/reference/native-apis/rawfile.md @@ -20,9 +20,9 @@ | 文件名称 | 描述 | | ---------------------------------------- | ------------------ | -| [raw_dir.h](raw__dir_8h.md) | 提供rawfile目录相关功能。 | -| [raw_file.h](raw__file_8h.md) | 提供rawfile文件相关功能。 | -| [raw_file_manager.h](raw__file__manager_8h.md) | 提供资源管理rawfile相关功能。 | +| [raw_dir.h](raw__dir_8h.md) | 提供rawfile目录相关功能。
引用文件:\ | +| [raw_file.h](raw__file_8h.md) | 提供rawfile文件相关功能。
引用文件:\ | +| [raw_file_manager.h](raw__file__manager_8h.md) | 提供资源管理rawfile相关功能。
引用文件:\ | ### 结构体 diff --git a/zh-cn/application-dev/reference/native-lib/Readme-CN.md b/zh-cn/application-dev/reference/native-lib/Readme-CN.md index 6ab376d22cdee59e3d8c3ba5b1c1a702012b1b92..f57483012a11397f554c2a01aad7c0872241faec 100644 --- a/zh-cn/application-dev/reference/native-lib/Readme-CN.md +++ b/zh-cn/application-dev/reference/native-lib/Readme-CN.md @@ -5,4 +5,5 @@ - 附录 - [Native api中没有导出的符号列表](third_party_libc/musl-peculiar-symbol.md) - [Native api中导出的EGL符号列表](third_party_opengl/egl-symbol.md) - - [Native api中导出的OpenGL ES 3.0符号列表](third_party_opengl/openglesv3-symbol.md) \ No newline at end of file + - [Native api中导出的OpenGL ES 3.0符号列表](third_party_opengl/openglesv3-symbol.md) + - [Native api中支持的OpenSL ES接口列表](third_party_opensles/opensles.md) \ No newline at end of file diff --git a/zh-cn/application-dev/reference/native-lib/third_party_libc/musl.md b/zh-cn/application-dev/reference/native-lib/third_party_libc/musl.md index 3fc992e9a9b9a6c2096eec828766d270f4fb829c..611b370f28a5a3251c516bae6eff9aac450a1119 100644 --- a/zh-cn/application-dev/reference/native-lib/third_party_libc/musl.md +++ b/zh-cn/application-dev/reference/native-lib/third_party_libc/musl.md @@ -31,7 +31,7 @@ libdl:dlopen等动态链接器接口。 C标准函数库是在C语言程序设计中,所有符合标准的头文件的集合,以及常用的函数库实现程序(如I/O输入输出和字符串控制)。 -**musl** +**musl** [native api中没有导出的符号列表](musl-peculiar-symbol.md) @@ -53,6 +53,10 @@ C++11、C++14标准已完全支持,C++17和C++20标准正在完善。 [OpenSL ES](https://www.khronos.org/registry/OpenSL-ES/)是一个嵌入式跨平台的音频处理库。 +**支持的能力** + +[Native api中支持的OpenSL ES接口列表](../third_party_opensles/opensles.md) + ## zlib [Zlib](https://zlib.net/)是基于C/C++语言实现的一个通用的数据压缩库。 @@ -75,4 +79,6 @@ OpenGL ES 3.0 **标准库中导出的符号列表** -[native api中导出的OpenGL ES 3.0符号列表](../third_party_opengl/openglesv3-symbol.md) \ No newline at end of file +[native api中导出的OpenGL ES 3.0符号列表](../third_party_opengl/openglesv3-symbol.md) + + \ No newline at end of file diff --git a/zh-cn/application-dev/reference/native-lib/third_party_opensles/opensles.md b/zh-cn/application-dev/reference/native-lib/third_party_opensles/opensles.md new file mode 100644 index 0000000000000000000000000000000000000000..68ee1a999ca8455196707a29e6185af05b3f9cfb --- /dev/null +++ b/zh-cn/application-dev/reference/native-lib/third_party_opensles/opensles.md @@ -0,0 +1,29 @@ +# Native api中支持的OpenSL ES接口列表 + +## 简介 + +OpenSL ES(Open Sound Library for Embedded System)即嵌入式音频加速标准。为开发者提供了标准化、高性能以及低响应时间的音频功能开发的对象和接口。相对于开源免费的OpenSL ES,OpenHarmony基于[OpenSL ES](https://www.khronos.org/opensles/) 1.0.1 API规范实现了部分Native API,相关接口开放情况介绍如下: + +## 支持的API + +|对象 |对外接口 |接口调用详情 |是否支持 |说明 | +| ------------------ | -------------------- | -------------------------------------------------------------------------------------|----------| -------------------- | +|SLEngineItf |CreateAudioPlayer |CreateAudioPlayer(SLEngineItf self, SLObjectItf *pPlayer, SLDataSource *pAudioSrc, SLDataSink *pAudioSnk, SLuint32 numInterfaces, const SLInterfaceID *pInterfaceIds, const SLboolean *pInterfaceRequired) |是 |创建音频播放机。 | +|SLEngineItf |CreateAudioRecorder |reateAudioRecorder(SLEngineItf self, SLObjectItf *pRecorder, SLDataSource *pAudioSrc, SLDataSink *pAudioSnk, SLuint32 numInterfaces, const SLInterfaceID *pInterfaceIds, const SLboolean *pInterfaceRequired)|是 |创建音频录制器。 | +|SLEngineItf |CreateAudioOutputMix |CreateOutputMix(SLEngineItf self, SLObjectItf *pMix, SLuint32 numInterfaces, const SLInterfaceID *pInterfaceIds, const SLboolean *pInterfaceRequired)|是 |创建混音器。 | +|SLObjectItf |Realize |Realize(SLObjectItf self, SLboolean async) |是 |创建音频播放机。 | +|SLObjectItf |getState |GetState(SLObjectItf self, SLuint32 *state) |是 |获取状态。 | +|SLObjectItf |getInterface |GetInterface(SLObjectItf self, const SLInterfaceID iid, void *interface) |是 |获取接口。 | +|SLObjectItf |Destroy |Destroy(SLObjectItf self) |是 |销毁对象。 | +|SLOHBufferQueueItf |Enqueue |Enqueue(SLOHBufferQueueItf self, const void *buffer, SLuint32 size) |是 |将buffer加入实际队列中。| +|SLOHBufferQueueItf |clear |Clear(SLOHBufferQueueItf self) |是 |释放buffer队列 | +|SLOHBufferQueueItf |getState |GetState(SLOHBufferQueueItf self, SLOHBufferQueueState *state) |是 |获取BufferQueue状态。 | +|SLOHBufferQueueItf |getBuffer |GetBuffer(SLOHBufferQueueItf self, SLuint8 **buffer, SLuint32 *size) |是 |获取buffer。 | +|SLOHBufferQueueItf |RegisterCallback |RegisterCallback(SLOHBufferQueueItf self, SlOHBufferQueueCallback callback, void *pContext) |是 |注册回调函数。 | +|SLPlayItf |SetPlayState |SetPlayState(SLPlayItf self, SLuint32 state) |是 |设置播放状态。 | +|SLPlayItf |GetPlayState |GetPlayState(SLPlayItf self, SLuint32 *state) |是 |获取播放状态。 | +|SLRecordItf |SetRecordState |SetRecordState(SLRecordItf self, SLuint32 state) |是 |设置录制状态。 | +|SLRecordItf |GetRecordState |GetRecordState(SLRecordItf self, SLuint32 *pState) |是 |获取录制状态。 | +|SLVolumeItf |SetVolumeLevel |SetVolumeLevel(SLVolumeItf self, SLmillibel *level) |是 |设置音量。 | +|SLVolumeItf |GetVolumeLevel |GetVolumeLevel(SLVolumeItf self, SLmillibel level) |是 |获取音量。 | +|SLVolumeItf |GetMaxVolumeLevel |GetMaxVolumeLevel(SLVolumeItf self, SLmillibel *maxLevel) |是 |获取最大音量。 | \ No newline at end of file diff --git a/zh-cn/application-dev/reference/syscap-list.md b/zh-cn/application-dev/reference/syscap-list.md index e804c0fe96aee8e94f5987424630bc24d6eda966..937ebfdbd333267cb5e78e4e02b43201247dff19 100644 --- a/zh-cn/application-dev/reference/syscap-list.md +++ b/zh-cn/application-dev/reference/syscap-list.md @@ -4,6 +4,8 @@ SysCap,全称SystemCapability,即系统能力,指操作系统中每一个 开发者使用某个接口进行开发前,建议先阅读[SysCap使用指南](syscap.md),了解Syscap的定义和使用指导。再结合下文中的表格判断具体能力集是否支持某个设备,提高开发效率。 +> 说明:default代表了一个功能比较全面的OpenHarmony设备,具有大部分的通用能力。在尚未明确设备具体能力集的情况下,可使用default类型进行开发。 + ## SystemCapability.ArkUI.ArkUI.Full ArKUI标准系统 @@ -172,14 +174,6 @@ WebGL2.0 标准api | ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | | 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | -## SystemCapability.Communication.NetManager.Extension - -网络管理扩展服务 - -| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | -| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | -| 是 | 否 | 否 | 是 | 是 | 是 | 否 | 否 | - ## SystemCapability.Communication.NetStack 基础网络协议栈能力 @@ -315,14 +309,6 @@ GNSS硬件相关能力 | ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | | 是 | 否 | 否 | 是 | 是 | 是 | 否 | 否 | -## SystemCapability.MultimodalInput.Input.RemoteInputDevice - -分布式输入设备管理 - -| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | -| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | -| 是 | 否 | 否 | 是 | 是 | 是 | 否 | 否 | - ## SystemCapability.MultimodalInput.Input.InputMonitor 输入事件监听者 @@ -347,14 +333,6 @@ GNSS硬件相关能力 | ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | | 是 | 否 | 否 | 是 | 是 | 是 | 否 | 否 | -## SystemCapability.MultimodalInput.Input.InputFilter - -输入事件过滤器 - -| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | -| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | -| 是 | 否 | 否 | 是 | 是 | 是 | 否 | 否 | - ## SystemCapability.PowerManager.BatteryManager.Extension 电池服务扩展能力 @@ -1347,7 +1325,7 @@ FA模型 | ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | | 是 | 否 | 是 | 是 | 是 | 否 | 否 | 否 | -## SystemCapability.Applictaions.settings.Core +## SystemCapability.Applications.settings.Core 设置API @@ -1394,3 +1372,300 @@ VAID管理服务 | Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | | ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | | 是 | 是 | 是 | 是 | 是 | 是 | 是 | 是 | + +## SystemCapability.Security.CertificateManager + +证书管理 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 否 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.Security.CryptoFramework + +加解密算法库框架-加解密基础能力 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 否 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.BundleManager.BundleFramework.Core + +包管理核心业务,包含包信息查询、安装卸载的核心能力 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.BundleManager.BundleFramework.FreeInstall + +包管理提供的免安装特性 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.BundleManager.BundleFramework.Resource + +包管理提供的获取图标和label的特性 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.BundleManager.BundleFramework.DefaultApp + +包管理提供的默认应用管理特性 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.BundleManager.BundleFramework.Launcher + +包管理提供给Launcher的查询特性 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.BundleManager.BundleFramework.SandboxApp + +包管理提供的沙箱应用的特性 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.BundleManager.BundleFramework.QuickFix + +包管理提供的快速修复的特性 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.BundleManager.BundleFramework.AppControl + +包管理提供的拦截特性 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.Graphic.Graphic2D.ColorManager.Core + +富设备广色域管理 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 否 | 是 | 否 | 是 | 否 | 否 | + +## SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply + +能效资源申请接口 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.Multimedia.Media.AVPlayer + +媒体音视频播放引擎能力 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.Multimedia.Media.AVRecorder + +媒体音视频录制引擎能力 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.Security.Cert + +加解密算法库框架-证书能力 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 否 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.Security.DataLossPrevention + +数据防泄漏 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 否 | 是 | 否 | 否 | 否 | 否 | + +## SystemCapability.Communication.NFC.Tag + +NFC标签服务 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 否 | 否 | 否 | 否 | 否 | 否 | 否 | 否 | + +## SystemCapability.Communication.NFC.CardEmulation + +NFC卡模拟服务 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 否 | 否 | 否 | 否 | 否 | 否 | 否 | 否 | + +## SystemCapability.Multimedia.Image.ImageCreator + +图像创建能力 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.Developtools.Syscap + +系统能力编解码 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 是 | 是 | 是 | 是 | 是 | 是 | 否 | + +## SystemCapability.Communication.NetManager.Ethernet + +以太网连接 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 否 | 否 | 否 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.Communication.NetManager.NetSharing + +网络共享 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 否 | 是 | 否 | 是 | 否 | 否 | + +## SystemCapability.Communication.NetManager.MDNS + +mDNS服务 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.Communication.NetManager.Vpn + +VPN + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 否 | 是 | 否 | 是 | 否 | 否 | + +## SystemCapability.XTS.DeviceAttest + +设备证明 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.XTS.DeviceAttestLite + +轻量设备证明 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 否 | 是 | 否 | 否 | 否 | 否 | 是 | 是 | + +## SystemCapability.FileManagement.UserFileManager.Core + +公共用户文件管理基础能力 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.FileManagement.UserFileManager.DistributedCore + +公共用户文件管理分布式能力 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.DistributedDataManager.UDMF.Core + +分布式数据管理--统一数据管理框架(UDMF)核心能力 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 否 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.BundleManager.BundleFramework.Overlay + +包管理overlay特性 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.Cloud.Push + +推送管理服务 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 是 | 否 | + +## SystemCapability.Multimedia.SystemSound.Core + +系统声音管理,如铃声,通知,闹钟等 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.Ability.AbilityRuntime.QuickFix + +快速修复 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 是 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.MultimodalInput.Input.Pointer + +Pointer输入增强能力 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 否 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.Communication.SecureElement + +安全单元芯片访问能力 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 否 | 否 | 否 | 否 | 否 | 否 | 否 | 否 | + +## SystemCapability.Msdp.DeviceStatus.Stationarty + +设备状态感知 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 否 | 否 | 是 | 是 | 是 | 否 | 否 | + +## SystemCapability.Base + +通用类型 + +| Default | 运动表 | 智能表 | 平板 | 车机 | 智慧屏 | Smart-Vision | Router | +| ------- | ------ | ------ | ---- | ---- | ------ | ------------ | ------ | +| 是 | 是 | 是 | 是 | 是 | 是 | 是 | 是 | + diff --git a/zh-cn/application-dev/security/accesstoken-guidelines.md b/zh-cn/application-dev/security/accesstoken-guidelines.md index 7e1b4947bfecd9fc8f09281002c720d92b612c1e..98b075a8cd8168f0167124850dfb94e688e40db3 100644 --- a/zh-cn/application-dev/security/accesstoken-guidelines.md +++ b/zh-cn/application-dev/security/accesstoken-guidelines.md @@ -110,7 +110,7 @@ "acls":{ "allowed-acls":[ "ohos.permission.WRITE_AUDIO", - "ohos.permission.CAPTURE_SCREEN" + "ohos.permission.CAPTURE_SCREEN" ] } } @@ -131,7 +131,7 @@ 以允许应用读取日历信息为例进行说明。 -1. 申请`ohos.permission.READ_CALENDAR`权限,配置方式请参见[访问控制授权申请](#配置文件权限声明)。 +1. 申请`ohos.permission.READ_CALENDAR`权限,配置方式请参见[配置文件权限声明](#配置文件权限声明)。 2. 校验当前是否已经授权。 @@ -335,4 +335,4 @@ reqPermissions() { 针对访问控制,有以下相关实例可供参考: - [AbilityAccessCtrl:访问权限控制(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/Security/AbilityAccessCtrl) -- [为应用添加运行时权限(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/codelabs/tree/master/Ability/AccessPermission) \ No newline at end of file +- [为应用添加运行时权限(ArkTS)(Full SDK)(API9)](https://gitee.com/openharmony/codelabs/tree/master/Ability/AccessPermission) diff --git a/zh-cn/application-dev/security/app-provision-structure.md b/zh-cn/application-dev/security/app-provision-structure.md index 0bee0fc5f8540d8026f026da84a17e4ef2eba842..f3103bd235e2e1d8ce1740b9f274f47e7d27d4da 100644 --- a/zh-cn/application-dev/security/app-provision-structure.md +++ b/zh-cn/application-dev/security/app-provision-structure.md @@ -62,7 +62,7 @@ HarmonyAppProvision文件示例: ### bundle-info对象内部结构 -**说明:** HarmonyAppProvision文件中的bundle-info对象中bundle-name需要和所签名应用的包名bundleName(config.js/module.json5)保持一致。为了防止同一个HarmonyAppProvision配置文件任意用于不同应用的签名,在应用安装过程中,系统会校验HAP签名信息的bundleName与HAP的配置文件中的bundleName是否一致,如果不一致,HAP无法安装。 +**说明:** HarmonyAppProvision文件中的bundle-info对象中bundle-name需要和所签名应用的包名bundleName(config.json/module.json5)保持一致。为了防止同一个HarmonyAppProvision配置文件任意用于不同应用的签名,在应用安装过程中,系统会校验HAP签名信息的bundleName与HAP的配置文件中的bundleName是否一致,如果不一致,HAP无法安装。 | 属性名称 | 含义 | 数据类型 | 是否必选 | 是否可缺省 | | ------------------------ | ------------------------------- | ------- | -------- | --------- | diff --git a/zh-cn/application-dev/security/cryptoFramework-guidelines.md b/zh-cn/application-dev/security/cryptoFramework-guidelines.md index 934a986b4b775e0c2b55da87764323584516ca2e..cbfd2ba12b1b336730567bc1aafd45f98c3a45a7 100644 --- a/zh-cn/application-dev/security/cryptoFramework-guidelines.md +++ b/zh-cn/application-dev/security/cryptoFramework-guidelines.md @@ -129,12 +129,14 @@ function convertAsyKey() { 2. 调用convertKey方法,传入公钥二进制和私钥二进制(二者非必选项,可只传入其中一个),转换为KeyPair对象。 ```javascript +import cryptoFramework from "@ohos.security.cryptoFramework" + function convertEccAsyKey() { let pubKeyArray = new Uint8Array([48,89,48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7,3,66,0,4,83,96,142,9,86,214,126,106,247,233,92,125,4,128,138,105,246,162,215,71,81,58,202,121,26,105,211,55,130,45,236,143,55,16,248,75,167,160,167,106,2,152,243,44,68,66,0,167,99,92,235,215,159,239,28,106,124,171,34,145,124,174,57,92]); let priKeyArray = new Uint8Array([48,49,2,1,1,4,32,115,56,137,35,207,0,60,191,90,61,136,105,210,16,27,4,171,57,10,61,123,40,189,28,34,207,236,22,45,223,10,189,160,10,6,8,42,134,72,206,61,3,1,7]); let pubKeyBlob = { data: pubKeyArray }; let priKeyBlob = { data: priKeyArray }; - let generator = cryptoFrameWork.createAsyKeyGenerator("ECC256"); + let generator = cryptoFramework.createAsyKeyGenerator("ECC256"); generator.convertKey(pubKeyBlob, priKeyBlob, (error, data) => { if (error) { AlertDialog.show({message : "Convert keypair fail"}); @@ -1287,41 +1289,51 @@ function LoopMdPromise(algName, loopSize) { **开发步骤** -1. 生成ECC密钥。通过createAsyKeyGenerator接口创建AsyKeyGenerator对象,并生成ECC非对称密钥。 -2. 基于ECC密钥的私钥及公钥执行ECDH操作。 +1. 通过createKeyAgreement接口创建KeyAgreement对象,用于后续的密钥协商操作。 +2. 调用KeyAgreement对象提供的generateSecret方法,传入对端的ECC公钥对象,以及本地生成的ECC私钥对象。 ```javascript import cryptoFramework from "@ohos.security.cryptoFramework" -let globalKeyPair; +let globalSelfPriKey; +let globalPeerPubKey; function ecdhPromise() { + let peerPubKeyArray = new Uint8Array([48,89,48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7,3,66,0,4,83,96,142,9,86,214,126,106,247,233,92,125,4,128,138,105,246,162,215,71,81,58,202,121,26,105,211,55,130,45,236,143,55,16,248,75,167,160,167,106,2,152,243,44,68,66,0,167,99,92,235,215,159,239,28,106,124,171,34,145,124,174,57,92]); + let peerPubKeyBlob = { data: peerPubKeyArray }; let eccGenerator = cryptoFramework.createAsyKeyGenerator("ECC256"); let eccKeyAgreement = cryptoFramework.createKeyAgreement("ECC256"); - let keyGenPromise = eccGenerator.generateKeyPair(); - keyGenPromise.then( keyPair => { - globalKeyPair = keyPair; - return eccKeyAgreement.generateSecret(keyPair.priKey, keyPair.pubKey); + eccGenerator.convertKey(peerPubKeyBlob, null).then((peerKeyPair) => { + globalPeerPubKey = peerKeyPair.pubKey; + return eccGenerator.generateKeyPair(); + }).then((keyPair) => { + globalSelfPriKey = keyPair.priKey; + return eccKeyAgreement.generateSecret(globalSelfPriKey, globalPeerPubKey); }).then((secret) => { - console.info("ecdh output is " + secret.data); + console.info("ecdh promise output is " + secret.data); }).catch((error) => { console.error("ecdh error."); }); } function ecdhCallback() { + let peerPubKeyArray = new Uint8Array([48,89,48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7,3,66,0,4,83,96,142,9,86,214,126,106,247,233,92,125,4,128,138,105,246,162,215,71,81,58,202,121,26,105,211,55,130,45,236,143,55,16,248,75,167,160,167,106,2,152,243,44,68,66,0,167,99,92,235,215,159,239,28,106,124,171,34,145,124,174,57,92]); + let peerPubKeyBlob = { data: peerPubKeyArray }; let eccGenerator = cryptoFramework.createAsyKeyGenerator("ECC256"); let eccKeyAgreement = cryptoFramework.createKeyAgreement("ECC256"); - eccGenerator.generateKeyPair(function (err, keyPair) { - globalKeyPair = keyPair; - eccKeyAgreement.generateSecret(keyPair.priKey, keyPair.pubKey, function (err, secret) { - if (err) { - console.error("ecdh error."); - return; - } - console.info("ecdh output is " + secret.data); + eccGenerator.convertKey(peerPubKeyBlob, null, function (err, peerKeyPair) { + globalPeerPubKey = peerKeyPair.pubKey; + eccGenerator.generateKeyPair(function (err, keyPair) { + globalSelfPriKey = keyPair.priKey; + eccKeyAgreement.generateSecret(globalSelfPriKey, globalPeerPubKey, function (err, secret) { + if (err) { + console.error("ecdh error."); + return; + } + console.info("ecdh callback output is " + secret.data); + }); }); - }); + }) } ``` diff --git a/zh-cn/application-dev/security/huks-appendix.md b/zh-cn/application-dev/security/huks-appendix.md index 317d78b22dd3088f4179a83d62238bdb97048526..c77cb852e8bc0772b0ca03b6f4ce4ae3c9e75c0e 100644 --- a/zh-cn/application-dev/security/huks-appendix.md +++ b/zh-cn/application-dev/security/huks-appendix.md @@ -1,70 +1,90 @@ # 通用密钥库密码算法规格 +## 规格实现范围说明 +本文档将说明密钥管理服务规格全景,面向OpenHarmony的厂商适配密钥管理服务规格分为必选规格和可选规格。必选规格为所有厂商均支持的算法规格。而对于可选规格,厂商将基于实际情况决定是否实现,如需使用,请查阅具体厂商提供的说明,确保规格支持再使用。 +**建议开发者使用必选规格开发应用,可保证全平台兼容。** + ## 支持的算法类型及参数组合 ### 导入\生成密钥规格 -| 算法                    | API级别 | 支持的密钥长度 | -| -------------- | :---------------: | ------------------ | -| AES | 8+ | 128、192、256 | -| RSA | 8+ | 512、768、1024、2048、3072、4096 | -| HMAC | 8+ | 8-1024(含),必须是8的倍数 | -| ECC | 8+ | 224、256、384、521 | -| ED25519 | 8+ | 256 | -| X25519 | 8+ | 256 | -| DSA | 8+ | 8-1024(含),8的倍数 | -| DH | 8+ | 2048、3072、4096 | -| SM2 | 9+ | 256 | -| SM3 | 9+ | 256 | -| SM4 | 9+ | 128 | - -### 加密解密 - -| 算法                    | API级别 | 备注 | -| ----------------------- | :----: | ---------------- | -| AES/CBC/NoPadding
AES/ECB/NoPadding
AES/CTR/NoPadding
AES/GCM/NoPadding
AES/CBC/PKCS7
AES/ECB/PKCS7 | 8+ | 1. CBC\ECB\CTR模式IV参数必选
2. GCM模式下Nonce、AAD、AEAD参数必选 | -| RSA/ECB/NoPadding
RSA/ECB/PKCS1_V1_5
RSA/ECB/OAEP | 8+ | | -| SM4/CTR/NoPadding
SM4/ECB/NoPadding
SM4/CBC/NoPadding
SM4/ECB/PKCS7
SM4/CBC/PKCS7 | 9+ | | - - - -### 签名验签 - - -| 算法 | API级别 | 备注 | -| --------- | :----------: | ----------------- | -| RSA/MD5/PKCS1_V1_5
RSA/SHA1/PKCS1_V1_5
RSA/SHA224/PKCS1_V1_5
RSA/SHA256/PKCS1_V1_5
RSA/SHA384/PKCS1_V1_5
RSA/SHA512/PKCS1_V1_5
RSA/SHA1/PSS
RSA/SHA224/PSS
RSA/SHA256/PSS
RSA/SHA384/PSS | 8+ | | -| RSA/NoDigest/PKCS1_V1_5 | 9+ | | -| DSA/SHA1
DSA/SHA224
DSA/SHA256
DSA/SHA384
DSA/SHA512 | 8+ | | -| DSA/NoDigest | 9+ | | -| ECC/SHA1
ECC/SHA224
ECC/SHA256
ECC/SHA384
ECC/SHA512 | 8+ | | -| ECC/NoDigest | 9+ | | -| ED25519/SHA1
ED25519/SHA224
ED25519/SHA256
ED25519/SHA384
ED25519/SHA512 |8+ | | -| ED25519/NoDigest | 9+ | | -| SM2/SM3
SM2/NoDigest |9+ | | - -### 密钥协商 - -| 算法                    | API级别 | 备注 | -| ------ | :-----------: | ------------------------------ | -| ECDH | 8+ | 协商密钥类型为ECC类型密钥 | -| DH | 8+ | | -| X25519 | 8+ | | - -### 密钥派生 - -| 算法                    |API级别 | 派生密钥及长度 | 备注 | -| ------------------------- | :-----------: | ------------ | ----------------- | -| HKDF/SHA256
HKDF/SHA384
HKDF/SHA512 | 8+ | 算法:AES、HMAC、SM4 长度:256、384、512 | 派生出的密钥可以存储到HUKS或者直接返回明文 | -| PBKDF2/SHA256
PBKDF2/SHA384
PBKDF2/SHA512 | 8+ | 算法:AES、HMAC、SM4 长度:256、384、512 | 派生出的密钥可以存储到HUKS或者直接返回明文 | +| 算法                    | API级别 | 支持的密钥长度 |是否必选规格| +| -------------- | :---------------: | ------------------ |:------------------: | +| AES | 8+ | 128、192、256 | 是 | +| RSA | 8+ | 512、768、1024|否| +| RSA | 8+ | 2048、3072、4096 |是| +| HMAC | 8+ | 8-1024(含),必须是8的倍数 |是| +| ECC | 8+ | 224 |否| +| ECC | 8+ | 256、384、521 |是| +| ED25519 | 8+ | 256 |是| +| X25519 | 8+ | 256 |是| +| DSA | 8+ | 8-1024(含),8的倍数 |否| +| DH | 8+ | 2048 |是| +| DH | 8+ | 3072、4096 |否| +| SM2 | 9+ | 256 |是| +| SM4 | 9+ | 128 |是| + +### 加密&解密流程算法与分组、填充模式的组合规格 + +| 算法/分组模式/填充模式                    | API级别 | 备注 |是否必选规格| +| ----------------------- | :----: | ---------------- | :----------------: | +| AES/ECB/NoPadding
AES/ECB/PKCS7 | 8+ | |否| +| AES/CBC/NoPadding
AES/CBC/PKCS7
AES/CTR/NoPadding| 8+ | IV参数必选 |是| +| AES/GCM/NoPadding | 8+ | Nonce、AAD、AEAD参数必选 |是| +| RSA/ECB/NoPadding
RSA/ECB/PKCS1_V1_5
RSA/ECB/OAEP | 8+ | OAEP填充模式支持的摘要算法:SHA256/SHA384/SHA512 | 是 | +| SM4/ECB/NoPadding
SM4/ECB/PKCS7
SM4/CBC/PKCS7 | 9+ | CBC模式下 IV 参数必选 |否 | +| SM4/CTR/NoPadding
SM4/CBC/NoPadding
| 9+ | IV 参数必选 |是 | + + + +### 签名&验签流程算法与摘要算法、填充模式的组合规格 + + +| 算法/摘要算法/填充模式 | API级别 | 备注 |是否必选规格| +| --------- | :----------: | ---------- | :-----------------: | +| RSA/MD5/PKCS1_V1_5
RSA/SHA1/PKCS1_V1_5
RSA/SHA224/PKCS1_V1_5
RSA/SHA224/PSS| 8+ | |否| +| RSA/SHA256/PKCS1_V1_5
RSA/SHA384/PKCS1_V1_5
RSA/SHA512/PKCS1_V1_5
RSA/SHA256/PSS
RSA/SHA384/PSS
RSA/SHA512/PSS | 8+ | | 是 +| RSA/NoDigest/PKCS1_V1_5 | 9+ |NoDigest 需要指定TAG HuksKeyDigest.HUKS_DIGEST_NONE |否| +| DSA/SHA1
DSA/SHA224
DSA/SHA256
DSA/SHA384
DSA/SHA512 | 8+ | |否| +| DSA/NoDigest | 9+ |NoDigest 需要指定TAG HuksKeyDigest.HUKS_DIGEST_NONE|否| +| ECC/SHA1
ECC/SHA224 | 8+ | |否| +| ECC/SHA256
ECC/SHA384
ECC/SHA512 | 8+ | |是| +| ECC/NoDigest | 9+ |NoDigest 需要指定TAG HuksKeyDigest.HUKS_DIGEST_NONE |否| +| ED25519/NoDigest | 8+ | NoDigest 需要指定TAG HuksKeyDigest.HUKS_DIGEST_NONE |是| +| SM2/SM3|9+ | |是| + +### 密钥协商算法 + +| 算法                    | API级别 | 备注 | 是否必选规格| +| ------ | :-----------: | ------------------------------ |:-----------: | +| ECDH | 8+ | 协商密钥类型为ECC类型密钥 | 是| +| DH | 8+ | |是| +| X25519 | 8+ | |是| + +### HMAC 密钥长度与摘要组合规格 +| 摘要 | 密钥长度 | API级别 | 是否必选规格| +| ------ | :-----------: |:-----------: |:-----------: | +| SHA256 |192-1024(8的倍数)| 8+ | 是| +| SHA384 |256-1024(8的倍数) | 8+ | 是| +| SHA512 |256-1024(8的倍数)| 8+ | 是| +### 派生算法/摘要组合规格 + +| 算法/摘要   | 派生密钥的算法/长度     | 派生结果密钥可用算法/长度 | 备注 |API级别 |是否必选规格| +| ----------------- |-------------------------------- | ----------------------- | :------------: |:---------: |:--:| +| HKDF/SHA256 | AES/192-256 | AES/128/192/256
HMAC/8-1024
SM4/128 | 派生密钥是业务基于三段式得到密钥会话结果,业务可决定派生密钥是否由HUKS管理(即密钥不出TEE)亦或是业务独立管理 |8+|是| +| HKDF/SHA384 | AES/256 | AES/128/192/256
HMAC/8-1024
SM4/128 | 派生密钥是业务基于三段式得到密钥会话结果,业务可决定派生密钥是否由HUKS管理(即密钥不出TEE)亦或是业务独立管理 |8+|是| +|HKDF/SHA512 | AES/256 | AES/128/192/256
HMAC/8-1024
SM4/128 | 派生密钥是业务基于三段式得到密钥会话结果,业务可决定派生密钥是否由HUKS管理(即密钥不出TEE)亦或是业务独立管理 |8+|是| +| PBKDF2/SHA256 | AES/192-256 | AES/128/192/256
HMAC/8-1024
SM4/128 | 派生密钥是业务基于三段式得到密钥会话结果,业务可决定派生密钥是否由HUKS管理(即密钥不出TEE)亦或是业务独立管理 |8+|是| +| PBKDF2/SHA384 |AES/256 | AES/128/192/256
HMAC/8-1024
SM4/128 | 派生密钥是业务基于三段式得到密钥会话结果,业务可决定派生密钥是否由HUKS管理(即密钥不出TEE)亦或是业务独立管理 |8+|是| +| PBKDF2/SHA512 | AES/256 | AES/128/192/256
HMAC/8-1024
SM4/128 | 派生密钥是业务基于三段式得到密钥会话结果,业务可决定派生密钥是否由HUKS管理(即密钥不出TEE)亦或是业务独立管理 |8+|是| ### 密钥证明 -| 算法                    |API级别 | 备注 | -| ------------------ | :-----: | ------------------------------------------------------------ | -| RSA | 9+ | 仅支持Padding为PSS的密钥 | -| ECC | 9+ | | -| X25519 | 9+ | | +| 算法                    |API级别 | 备注 | 是否必选规格| +| ------------------ | :-----: | ----------------------------- | :-------:| +| RSA | 9+ | 支持Padding为 PSS 与 PKCS1_V1_5的密钥 |是| +| ECC | 9+ | |是| +| X25519 | 9+ | |是| ## 密钥材料格式 针对不同密码算法的密钥对、公钥、私钥,HUKS定义了一套密钥材料格式。 diff --git a/zh-cn/application-dev/security/huks-guidelines.md b/zh-cn/application-dev/security/huks-guidelines.md index 1017b119a80ba96bec68f317e138a2b5b8da4efa..793d9cf38adf98302ac0401bf9ff4c1ee784a182 100644 --- a/zh-cn/application-dev/security/huks-guidelines.md +++ b/zh-cn/application-dev/security/huks-guidelines.md @@ -647,728 +647,316 @@ HUKS基于密钥会话来操作数据,使用密钥时基于以下流程: ### 加密解密 ```ts /* - * 以下以SM4 128密钥的Callback操作使用为例 + * 以下以AES 128密钥的Callback操作使用为例 */ import huks from '@ohos.security.huks'; +import promptAction from '@ohos.promptAction'; -/* - * 确定密钥别名和封装密钥属性参数集 - */ -let srcKeyAlias = 'sm4_Key'; -let IV = '0000000000000000'; -let cipherInData = 'Hks_SM4_Cipher_Test_101010101010101010110_string'; -let encryptUpdateResult = new Array(); + +let aesKeyAlias = 'test_aesKeyAlias'; let handle; -let updateResult = new Array(); -let finishOutData; +let plainText = '123456'; +let IV = '001122334455'; +let cipherData:Uint8Array; +let plainData:Uint8Array; -/* 集成生成密钥参数集 & 加密参数集 */ -let properties = new Array(); -properties[0] = { - tag: huks.HuksTag.HUKS_TAG_ALGORITHM, - value: huks.HuksKeyAlg.HUKS_ALG_SM4, -} -properties[1] = { - tag: huks.HuksTag.HUKS_TAG_PURPOSE, - value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT, -} -properties[2] = { - tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, - value: huks.HuksKeySize.HUKS_SM4_KEY_SIZE_128, -} -properties[3] = { - tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE, - value: huks.HuksCipherMode.HUKS_MODE_CBC, -} -properties[4] = { - tag: huks.HuksTag.HUKS_TAG_PADDING, - value: huks.HuksKeyPadding.HUKS_PADDING_NONE, +function StringToUint8Array(str) { + let arr = []; + for (let i = 0, j = str.length; i < j; ++i) { + arr.push(str.charCodeAt(i)); + } + return new Uint8Array(arr); } -let huksOptions = { - properties: properties, - inData: new Uint8Array(new Array()) + +function Uint8ArrayToString(fileData) { + let dataString = ''; + for (let i = 0; i < fileData.length; i++) { + dataString += String.fromCharCode(fileData[i]); + } + return dataString; } -let propertiesEncrypt = new Array(); -propertiesEncrypt[0] = { +function GetAesGenerateProperties() { + var properties = new Array(); + var index = 0; + properties[index++] = { tag: huks.HuksTag.HUKS_TAG_ALGORITHM, - value: huks.HuksKeyAlg.HUKS_ALG_SM4, -} -propertiesEncrypt[1] = { + value: huks.HuksKeyAlg.HUKS_ALG_AES + }; + properties[index++] = { + tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, + value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_128 + }; + properties[index++] = { tag: huks.HuksTag.HUKS_TAG_PURPOSE, - value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT, + value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT | + huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT + } + return properties; } -propertiesEncrypt[2] = { + +function GetAesEncryptProperties() { + var properties = new Array(); + var index = 0; + properties[index++] = { + tag: huks.HuksTag.HUKS_TAG_ALGORITHM, + value: huks.HuksKeyAlg.HUKS_ALG_AES + }; + properties[index++] = { tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, - value: huks.HuksKeySize.HUKS_SM4_KEY_SIZE_128, -} -propertiesEncrypt[3] = { + value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_128 + }; + properties[index++] = { + tag: huks.HuksTag.HUKS_TAG_PURPOSE, + value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_ENCRYPT + } + properties[index++] = { tag: huks.HuksTag.HUKS_TAG_PADDING, - value: huks.HuksKeyPadding.HUKS_PADDING_NONE, -} -propertiesEncrypt[4] = { + value: huks.HuksKeyPadding.HUKS_PADDING_PKCS7 + } + properties[index++] = { tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE, - value: huks.HuksCipherMode.HUKS_MODE_CBC, -} -propertiesEncrypt[5] = { + value: huks.HuksCipherMode.HUKS_MODE_CBC + } + properties[index++] = { tag: huks.HuksTag.HUKS_TAG_IV, - value: StringToUint8Array(IV), -} -let encryptOptions = { - properties: propertiesEncrypt, - inData: new Uint8Array(new Array()) + value: StringToUint8Array(IV) + } + return properties; } -/* 修改加密参数集为解密参数集 */ -propertiesEncrypt.splice(1, 1, { +function GetAesDecryptProperties() { + var properties = new Array(); + var index = 0; + properties[index++] = { + tag: huks.HuksTag.HUKS_TAG_ALGORITHM, + value: huks.HuksKeyAlg.HUKS_ALG_AES + }; + properties[index++] = { + tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, + value: huks.HuksKeySize.HUKS_AES_KEY_SIZE_128 + }; + properties[index++] = { tag: huks.HuksTag.HUKS_TAG_PURPOSE, - value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT, -}); -let decryptOptions = { - properties: propertiesEncrypt, - inData: new Uint8Array(new Array()) + value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_DECRYPT + } + properties[index++] = { + tag: huks.HuksTag.HUKS_TAG_PADDING, + value: huks.HuksKeyPadding.HUKS_PADDING_PKCS7 + } + properties[index++] = { + tag: huks.HuksTag.HUKS_TAG_BLOCK_MODE, + value: huks.HuksCipherMode.HUKS_MODE_CBC + } + properties[index++] = { + tag: huks.HuksTag.HUKS_TAG_IV, + value: StringToUint8Array(IV) + } + return properties; } -function StringToUint8Array(str) { - let arr = []; - for (let i = 0, j = str.length; i < j; ++i) { - arr.push(str.charCodeAt(i)); +async function GenerateAesKey() { + var genProperties = GetAesGenerateProperties(); + var options = { + properties: genProperties + } + await huks.generateKeyItem(aesKeyAlias, options).then((data) => { + promptAction.showToast({ + message: "成功生成了 一个 AES 密钥", + duration: 2500, + }) + }).catch((err)=>{ + promptAction.showToast({ + message: "密钥生成失败,错误码是: " + err.code + " 错误吗信息: " + err.message, + duration: 6500, + }) + }) +} + +async function EncryptData() { + var encryptProperties = GetAesEncryptProperties(); + var options = { + properties:encryptProperties, + inData: StringToUint8Array(plainText) } - return new Uint8Array(arr); -} + await huks.initSession(aesKeyAlias, options).then((data) => { + handle = data.handle; + }).catch((err)=>{ + promptAction.showToast({ + message: "密钥初始化失败,错误码是: " + err.code + " 错误吗信息: " + err.message, + duration: 6500, + }) + }) + await huks.finishSession(handle, options).then((data) => { + promptAction.showToast({ + message: "加密数据成功, 密文是: " + Uint8ArrayToString(data.outData), + duration: 6500, + }) + cipherData = data.outData + }).catch((err)=>{ + promptAction.showToast({ + message: "加密流程捕获了异常,错误码是: " + err.code + " 错误码信息: " + err.message, + duration: 6500, + }) + }) +} + +async function DecryptData() { + var decryptOptions = GetAesDecryptProperties() + var options = { + properties:decryptOptions, + inData: cipherData + } + await huks.initSession(aesKeyAlias, options).then((data) => { + handle = data.handle; + }).catch((err)=>{ + promptAction.showToast({ + message: "密钥初始化失败,错误码是: " + err.code + " 错误吗信息: " + err.message, + duration: 6500, + }) + }) + await huks.finishSession(handle, options).then((data) => { + promptAction.showToast({ + message: "解密成功, 解密的明文是: " + Uint8ArrayToString(data.outData), + duration: 6500, + }) + }).catch((err)=>{ + promptAction.showToast({ + message: "解密流程捕获了异常,错误码是: " + err.code + " 错误码信息: " + err.message, + duration: 6500, + }) + }) +} + +async function DeleteKey() { + let emptyOptions = { + properties:[] + } + await huks.deleteKeyItem(aesKeyAlias, emptyOptions).then((data) => { + promptAction.showToast({ + message: "密钥删除成功!", + duration: 6500, + }) + }).catch((err)=>{ + promptAction.showToast({ + message: "密钥删除失败,错误码是: " + err.code + " 错误吗信息: " + err.message, + duration: 6500, + }) + }) +} + +@Entry +@Component +struct Index { + @State message: string = 'Hello Huks' + controller: TextInputController = new TextInputController(); + build() { + Column() { + Row() { + Text('输入您要加密得内容').fontSize(20).margin({ left: 2, top: 10 }) + } -function Uint8ArrayToString(fileData) { - let dataString = ''; - for (let i = 0; i < fileData.length; i++) { - dataString += String.fromCharCode(fileData[i]); - } - return dataString; -} + Row() { + TextInput({ placeholder: '默认加密123456', controller: this.controller }) + .placeholderColor(Color.Grey) + .placeholderFont({ size: 14, weight: 400 }) + .caretColor(Color.Blue) + .width(400) + .height(40) + .margin(20) + .fontSize(14) + .fontColor(Color.Black) + .type(InputType.Normal) + .onChange((value: string) => { + this.message += '您输入得明文是: ' + value + '\n' + plainText = value + }) + .margin({ top: 10 }) + } -function generateKeyItem(keyAlias:string, huksOptions:huks.HuksOptions, throwObject) { - return new Promise((resolve, reject) => { - try { - huks.generateKeyItem(keyAlias, huksOptions, function (error, data) { - if (error) { - reject(error); - } else { - resolve(data); - } - }); - } catch (error) { - throwObject.isThrow = true; - throw(error); - } - }); -} + Row() { + Text('加密或解密的结果').fontSize(20).margin({ left: 2, top: 10 }) + } -async function publicGenKeyFunc(keyAlias:string, huksOptions:huks.HuksOptions) { - console.info(`enter callback generateKeyItem`); - let throwObject = {isThrow: false}; - try { - await generateKeyItem(keyAlias, huksOptions, throwObject) - .then((data) => { - console.info(`callback: generateKeyItem success, data = ${JSON.stringify(data)}`); - }) - .catch(error => { - if (throwObject.isThrow) { - throw(error); - } else { - console.error(`callback: generateKeyItem failed, code: ${error.code}, msg: ${error.message}`); - } - }); - } catch (error) { - console.error(`callback: generateKeyItem input arg invalid, code: ${error.code}, msg: ${error.message}`); - } -} + Row() { + TextInput({ placeholder: '这里将会显示加解密的结果', controller: this.controller }) + .placeholderColor(Color.Grey) + .placeholderFont({ size: 14, weight: 400 }) + .caretColor(Color.Blue) + .width(400) + .height(40) + .margin(20) + .fontSize(14) + .fontColor(Color.Black) + .type(InputType.Normal) + .onChange((value: string) => { + this.message += '您输入得明文是: ' + value + '\n' + plainText = value + }) + .margin({ top: 10 }) + } -function initSession(keyAlias:string, huksOptions:huks.HuksOptions, throwObject) : Promise { - return new Promise((resolve, reject) => { - try { - huks.initSession(keyAlias, huksOptions, function (error, data) { - if (error) { - reject(error); - } else { - resolve(data); - } - }); - } catch (error) { - throwObject.isThrow = true; - throw(error); + Row() { + Button({ type: ButtonType.Normal, stateEffect: true }) { + Text('generateAesKey') + .fontColor(Color.White) + .fontSize(20) } - }); -} - -async function publicInitFunc(keyAlias:string, huksOptions:huks.HuksOptions) { - console.info(`enter callback doInit`); - let throwObject = {isThrow: false}; - try { - await initSession(keyAlias, huksOptions, throwObject) - .then ((data) => { - console.info(`callback: doInit success, data = ${JSON.stringify(data)}`); - handle = data.handle; - }) - .catch((error) => { - if (throwObject.isThrow) { - throw(error); - } else { - console.error(`callback: doInit failed, code: ${error.code}, msg: ${error.message}`); - } - }); - } catch (error) { - console.error(`callback: doInit input arg invalid, code: ${error.code}, msg: ${error.message}`); - } -} - -function updateSession(handle:number, huksOptions:huks.HuksOptions, throwObject) : Promise { - return new Promise((resolve, reject) => { - try { - huks.updateSession(handle, huksOptions, function (error, data) { - if (error) { - reject(error); - } else { - resolve(data); - } - }); - } catch (error) { - throwObject.isThrow = true; - throw(error); + .borderRadius(8) + .width('45%') + .height('5%') + .backgroundColor(0x317aff) + .onClick(() => { + GenerateAesKey() + }) + .margin(10) + + Button({ type: ButtonType.Normal, stateEffect: true }) { + Text('deleteAesKey') + .fontColor(Color.White) + .fontSize(20) } - }); -} - -async function publicUpdateFunc(handle:number, huksOptions:huks.HuksOptions) { - console.info(`enter callback doUpdate`); - let throwObject = {isThrow: false}; - try { - await updateSession(handle, huksOptions, throwObject) - .then ((data) => { - console.info(`callback: doUpdate success, data = ${JSON.stringify(data)}`); - }) - .catch(error => { - if (throwObject.isThrow) { - throw(error); - } else { - console.error(`callback: doUpdate failed, code: ${error.code}, msg: ${error.message}`); - } - }); - } catch (error) { - console.error(`callback: doUpdate input arg invalid, code: ${error.code}, msg: ${error.message}`); - } -} + .borderRadius(8) + .width('45%') + .height('5%') + .backgroundColor(0x317aff) + .onClick(() => { + DeleteKey() + }) + .margin(10) + } -function finishSession(handle:number, huksOptions:huks.HuksOptions, throwObject) : Promise { - return new Promise((resolve, reject) => { - try { - huks.finishSession(handle, huksOptions, function (error, data) { - if (error) { - reject(error); - } else { - resolve(data); - } - }); - } catch (error) { - throwObject.isThrow = true; - throw(error); + Row() { + Button({ type: ButtonType.Normal, stateEffect: true }) { + Text('EncryptData') + .fontColor(Color.White) + .fontSize(20) } - }); -} - -async function publicFinishFunc(handle:number, huksOptions:huks.HuksOptions) { - console.info(`enter callback doFinish`); - let throwObject = {isThrow: false}; - try { - await finishSession(handle, huksOptions, throwObject) - .then ((data) => { - finishOutData = data.outData; - console.info(`callback: doFinish success, data = ${JSON.stringify(data)}`); - }) - .catch(error => { - if (throwObject.isThrow) { - throw(error); - } else { - console.error(`callback: doFinish failed, code: ${error.code}, msg: ${error.message}`); - } - }); - } catch (error) { - console.error(`callback: doFinish input arg invalid, code: ${error.code}, msg: ${error.message}`); - } -} - -function deleteKeyItem(keyAlias:string, huksOptions:huks.HuksOptions, throwObject) { - return new Promise((resolve, reject) => { - try { - huks.deleteKeyItem(keyAlias, huksOptions, function (error, data) { - if (error) { - reject(error); - } else { - resolve(data); - } - }); - } catch (error) { - throwObject.isThrow = true; - throw(error); + .borderRadius(8) + .width('45%') + .height('5%') + .backgroundColor(0x317aff) + .onClick(() => { + EncryptData() + }) + .margin(10) + + Button({ type: ButtonType.Normal, stateEffect: true }) { + Text('DecryptData') + .fontColor(Color.White) + .fontSize(20) } - }); -} - -async function publicDeleteKeyFunc(keyAlias:string, huksOptions:huks.HuksOptions) { - console.info(`enter callback deleteKeyItem`); - let throwObject = {isThrow: false}; - try { - await deleteKeyItem(keyAlias, huksOptions, throwObject) - .then ((data) => { - console.info(`callback: deleteKeyItem key success, data = ${JSON.stringify(data)}`); - }) - .catch(error => { - if (throwObject.isThrow) { - throw(error); - } else { - console.error(`callback: deleteKeyItem failed, code: ${error.code}, msg: ${error.message}`); - } - }); - } catch (error) { - console.error(`callback: deletKeeyItem input arg invalid, code: ${error.code}, msg: ${error.message}`); - } -} - -async function testSm4Cipher() { - /* 生成密钥 */ - await publicGenKeyFunc(srcKeyAlias, huksOptions); - - /* 进行密钥加密操作 */ - await publicInitFunc(srcKeyAlias, encryptOptions); - - encryptOptions.inData = StringToUint8Array(cipherInData); - await publicUpdateFunc(handle, encryptOptions); - encryptUpdateResult = updateResult; - - encryptOptions.inData = new Uint8Array(new Array()); - await publicFinishFunc(handle, encryptOptions); - if (finishOutData === cipherInData) { - console.info('test finish encrypt err '); - } else { - console.info('test finish encrypt success'); - } - - /* 进行解密操作 */ - await publicInitFunc(srcKeyAlias, decryptOptions); - - decryptOptions.inData = new Uint8Array(encryptUpdateResult); - await publicUpdateFunc(handle, decryptOptions); - - decryptOptions.inData = new Uint8Array(new Array()); - await publicFinishFunc(handle, decryptOptions); - if (finishOutData === cipherInData) { - console.info('test finish decrypt success '); - } else { - console.info('test finish decrypt err'); - } - - await publicDeleteKeyFunc(srcKeyAlias, huksOptions); -} -``` - -### 签名验签 -```ts -/* - * 以下以SM2密钥的Callback操作使用为例 - */ -import huks from '@ohos.security.huks'; - -/* - * 确定密钥别名和封装密钥属性参数集 - */ -let generateKeyAlias = 'sm2_Key'; -let importKeyAlias = 'importKeyAlias'; -let signVerifyInData1 = 'signVerifyInDataForTestFirstText'; -let signVerifyInData2 = 'signVerifyInDataForTestSecondText'; -let signVerifyInData = [signVerifyInData1, signVerifyInData2]; -let handle; -let exportKey; -let finishOutData; - -/* 集成生成密钥参数集 */ -let generateKeyProperties = new Array(); -generateKeyProperties[0] = { - tag: huks.HuksTag.HUKS_TAG_ALGORITHM, - value: huks.HuksKeyAlg.HUKS_ALG_SM2, -} -generateKeyProperties[1] = { - tag: huks.HuksTag.HUKS_TAG_PURPOSE, - value: - huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN | - huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY, -} -generateKeyProperties[2] = { - tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, - value: huks.HuksKeySize.HUKS_SM2_KEY_SIZE_256, -} -generateKeyProperties[3] = { - tag: huks.HuksTag.HUKS_TAG_DIGEST, - value: huks.HuksKeyDigest.HUKS_DIGEST_SM3, -} -let genrateKeyOptions = { - properties: generateKeyProperties, - inData: new Uint8Array(new Array()) -} - -/* 集成签名参数集 */ -let signProperties = new Array(); -signProperties[0] = { - tag: huks.HuksTag.HUKS_TAG_ALGORITHM, - value: huks.HuksKeyAlg.HUKS_ALG_SM2, -} -signProperties[1] = { - tag: huks.HuksTag.HUKS_TAG_PURPOSE, - value: - huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_SIGN -} -signProperties[2] = { - tag: huks.HuksTag.HUKS_TAG_DIGEST, - value: huks.HuksKeyDigest.HUKS_DIGEST_SM3, -} -signProperties[3] = { - tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, - value: huks.HuksKeySize.HUKS_SM2_KEY_SIZE_256, -} -let signOptions = { - properties: signProperties, - inData: new Uint8Array(new Array()) -} - -/* 集成验签参数集 */ -let verifyProperties = new Array(); -verifyProperties[0] = { - tag: huks.HuksTag.HUKS_TAG_ALGORITHM, - value: huks.HuksKeyAlg.HUKS_ALG_SM2, -} -verifyProperties[1] = { - tag: huks.HuksTag.HUKS_TAG_PURPOSE, - value: huks.HuksKeyPurpose.HUKS_KEY_PURPOSE_VERIFY -} -verifyProperties[2] = { - tag: huks.HuksTag.HUKS_TAG_DIGEST, - value: huks.HuksKeyDigest.HUKS_DIGEST_SM3, -} -verifyProperties[3] = { - tag: huks.HuksTag.HUKS_TAG_KEY_SIZE, - value: huks.HuksKeySize.HUKS_SM2_KEY_SIZE_256, -} -let verifyOptions = { - properties: verifyProperties, - inData: new Uint8Array(new Array()) -} - -function StringToUint8Array(str) { - let arr = []; - for (let i = 0, j = str.length; i < j; ++i) { - arr.push(str.charCodeAt(i)); - } - return new Uint8Array(arr); -} - -function generateKeyItem(keyAlias:string, huksOptions:huks.HuksOptions, throwObject) { - return new Promise((resolve, reject) => { - try { - huks.generateKeyItem(keyAlias, huksOptions, function (error, data) { - if (error) { - reject(error); - } else { - resolve(data); - } - }); - } catch (error) { - throwObject.isThrow = true; - throw(error); - } - }); -} - -async function publicGenKeyFunc(keyAlias:string, huksOptions:huks.HuksOptions) { - console.info(`enter callback generateKeyItem`); - let throwObject = {isThrow: false}; - try { - await generateKeyItem(keyAlias, huksOptions, throwObject) - .then((data) => { - console.info(`callback: generateKeyItem success, data = ${JSON.stringify(data)}`); - }) - .catch(error => { - if (throwObject.isThrow) { - throw(error); - } else { - console.error(`callback: generateKeyItem failed, code: ${error.code}, msg: ${error.message}`); - } - }); - } catch (error) { - console.error(`callback: generateKeyItem input arg invalid, code: ${error.code}, msg: ${error.message}`); - } -} - -function initSession(keyAlias:string, huksOptions:huks.HuksOptions, throwObject) : Promise { - return new Promise((resolve, reject) => { - try { - huks.initSession(keyAlias, huksOptions, function (error, data) { - if (error) { - reject(error); - } else { - resolve(data); - } - }); - } catch (error) { - throwObject.isThrow = true; - throw(error); - } - }); -} - -async function publicInitFunc(keyAlias:string, huksOptions:huks.HuksOptions) { - console.info(`enter callback doInit`); - let throwObject = {isThrow: false}; - try { - await initSession(keyAlias, huksOptions, throwObject) - .then ((data) => { - console.info(`callback: doInit success, data = ${JSON.stringify(data)}`); - handle = data.handle; - }) - .catch((error) => { - if (throwObject.isThrow) { - throw(error); - } else { - console.error(`callback: doInit failed, code: ${error.code}, msg: ${error.message}`); - } - }); - } catch (error) { - console.error(`callback: doInit input arg invalid, code: ${error.code}, msg: ${error.message}`); - } -} - -function updateSession(handle:number, huksOptions:huks.HuksOptions, throwObject) : Promise { - return new Promise((resolve, reject) => { - try { - huks.updateSession(handle, huksOptions, function (error, data) { - if (error) { - reject(error); - } else { - resolve(data); - } - }); - } catch (error) { - throwObject.isThrow = true; - throw(error); - } - }); -} - -async function publicUpdateFunc(handle:number, huksOptions:huks.HuksOptions) { - console.info(`enter callback doUpdate`); - let throwObject = {isThrow: false}; - try { - await updateSession(handle, huksOptions, throwObject) - .then ((data) => { - console.info(`callback: doUpdate success, data = ${JSON.stringify(data)}`); - }) - .catch(error => { - if (throwObject.isThrow) { - throw(error); - } else { - console.error(`callback: doUpdate failed, code: ${error.code}, msg: ${error.message}`); - } - }); - } catch (error) { - console.error(`callback: doUpdate input arg invalid, code: ${error.code}, msg: ${error.message}`); - } -} - -function finishSession(handle:number, huksOptions:huks.HuksOptions, throwObject) : Promise { - return new Promise((resolve, reject) => { - try { - huks.finishSession(handle, huksOptions, function (error, data) { - if (error) { - reject(error); - } else { - resolve(data); - } - }); - } catch (error) { - throwObject.isThrow = true; - throw(error); - } - }); -} - -async function publicFinishFunc(handle:number, huksOptions:huks.HuksOptions) { - console.info(`enter callback doFinish`); - let throwObject = {isThrow: false}; - try { - await finishSession(handle, huksOptions, throwObject) - .then ((data) => { - finishOutData = data.outData; - console.info(`callback: doFinish success, data = ${JSON.stringify(data)}`); - }) - .catch(error => { - if (throwObject.isThrow) { - throw(error); - } else { - console.error(`callback: doFinish failed, code: ${error.code}, msg: ${error.message}`); - } - }); - } catch (error) { - console.error(`callback: doFinish input arg invalid, code: ${error.code}, msg: ${error.message}`); - } -} - -function exportKeyItem(keyAlias:string, huksOptions:huks.HuksOptions, throwObject) : Promise { - return new Promise((resolve, reject) => { - try { - huks.exportKeyItem(keyAlias, huksOptions, function (error, data) { - if (error) { - reject(error); - } else { - resolve(data); - } - }); - } catch (error) { - throwObject.isThrow = true; - throw(error); - } - }); -} - -async function publicExportKeyFunc(keyAlias:string, huksOptions:huks.HuksOptions) { - console.info(`enter callback export`); - let throwObject = {isThrow: false}; - try { - await exportKeyItem(keyAlias, huksOptions, throwObject) - .then ((data) => { - console.info(`callback: exportKeyItem success, data = ${JSON.stringify(data)}`); - exportKey = data.outData; - }) - .catch(error => { - if (throwObject.isThrow) { - throw(error); - } else { - console.error(`callback: exportKeyItem failed, code: ${error.code}, msg: ${error.message}`); - } - }); - } catch (error) { - console.error(`callback: exportKeyItem input arg invalid, code: ${error.code}, msg: ${error.message}`); - } -} - -function importKeyItem(keyAlias:string, huksOptions:huks.HuksOptions, throwObject) { - return new Promise((resolve, reject) => { - try { - huks.importKeyItem(keyAlias, huksOptions, function (error, data) { - if (error) { - reject(error); - } else { - resolve(data); - } - }); - } catch (error) { - throwObject.isThrow = true; - throw(error); - } - }); -} - -async function publicImportKeyFunc(keyAlias:string, huksOptions:huks.HuksOptions) { - console.info(`enter promise importKeyItem`); - let throwObject = {isThrow: false}; - try { - await importKeyItem(keyAlias, huksOptions, throwObject) - .then ((data) => { - console.info(`callback: importKeyItem success, data = ${JSON.stringify(data)}`); - }) - .catch(error => { - if (throwObject.isThrow) { - throw(error); - } else { - console.error(`callback: importKeyItem failed, code: ${error.code}, msg: ${error.message}`); - } - }); - } catch (error) { - console.error(`callback: importKeyItem input arg invalid, code: ${error.code}, msg: ${error.message}`); - } -} - -function deleteKeyItem(keyAlias:string, huksOptions:huks.HuksOptions, throwObject) { - return new Promise((resolve, reject) => { - try { - huks.deleteKeyItem(keyAlias, huksOptions, function (error, data) { - if (error) { - reject(error); - } else { - resolve(data); - } - }); - } catch (error) { - throwObject.isThrow = true; - throw(error); - } - }); -} - -async function publicDeleteKeyFunc(keyAlias:string, huksOptions:huks.HuksOptions) { - console.info(`enter callback deleteKeyItem`); - let throwObject = {isThrow: false}; - try { - await deleteKeyItem(keyAlias, huksOptions, throwObject) - .then ((data) => { - console.info(`callback: deleteKeyItem key success, data = ${JSON.stringify(data)}`); - }) - .catch(error => { - if (throwObject.isThrow) { - throw(error); - } else { - console.error(`callback: deleteKeyItem failed, code: ${error.code}, msg: ${error.message}`); - } - }); - } catch (error) { - console.error(`callback: deletKeeyItem input arg invalid, code: ${error.code}, msg: ${error.message}`); - } -} - -async function testSm2SignVerify() { - /* 生成密钥 */ - await publicGenKeyFunc(generateKeyAlias, genrateKeyOptions); - - /* 签名 */ - let signHandle; - let signFinishOutData; - await publicInitFunc(generateKeyAlias, signOptions); - - signHandle = handle; - for (var index = 0; index < signVerifyInData.length; index++) { - signOptions.inData = StringToUint8Array(signVerifyInData[index]); - await publicUpdateFunc(signHandle, signOptions); - } - signOptions.inData = new Uint8Array(new Array()); - await publicFinishFunc(signHandle, signOptions); - signFinishOutData = finishOutData; - - /* 导出密钥 */ - await publicExportKeyFunc(generateKeyAlias, genrateKeyOptions); - - /* 导入密钥 */ - verifyOptions.inData = exportKey; - await publicImportKeyFunc(importKeyAlias, verifyOptions); - - /* 验证签名 */ - let verifyHandle; - await publicInitFunc(importKeyAlias, verifyOptions); - - verifyHandle = handle; - for (var index = 0; index < signVerifyInData.length; index++) { - verifyOptions.inData = StringToUint8Array(signVerifyInData[index]); - await publicUpdateFunc(verifyHandle, verifyOptions); + .borderRadius(8) + .width('45%') + .height('5%') + .backgroundColor(0x317aff) + .onClick(() => { + DecryptData() + }) + .margin(10) + } } - verifyOptions.inData = signFinishOutData; - await publicFinishFunc(verifyHandle, verifyOptions); - - await publicDeleteKeyFunc(generateKeyAlias, genrateKeyOptions); - await publicDeleteKeyFunc(importKeyAlias, genrateKeyOptions); + } } ``` diff --git a/zh-cn/application-dev/security/permission-list.md b/zh-cn/application-dev/security/permission-list.md index 72501e07bb83ea82926ecf9a9c81c5a7bb523bd6..1eaeeb489d5e541dafc91c617b79cb3f8d7108f6 100644 --- a/zh-cn/application-dev/security/permission-list.md +++ b/zh-cn/application-dev/security/permission-list.md @@ -496,7 +496,7 @@ ## ohos.permission.INSTALL_BUNDLE -允许应用安装、卸载其他应用。 +允许应用安装、卸载其他应用(除了企业InHouse应用)。 **权限级别**:system_core @@ -964,6 +964,36 @@ **ACL使能**:TRUE +## ohos.permission.ENTERPRISE_SET_BUNDLE_INSTALL_POLICY + +允许设备管理员设置包安装管理策略。 + +**权限级别**:system_basic + +**授权方式**:system_grant + +**ACL使能**:TRUE + +## ohos.permission.ENTERPRISE_SET_NETWORK + +允许设备管理员设置网络信息。 + +**权限级别**:system_basic + +**授权方式**:system_grant + +**ACL使能**:TRUE + +## ohos.permission.ENTERPRISE_MANAGE_SET_APP_RUNNING_POLICY + +允许设备管理员设置应用运行管理策略。 + +**权限级别**:system_basic + +**授权方式**:system_grant + +**ACL使能**:TRUE + ## ohos.permission.NFC_TAG 允许应用读取Tag卡片。 @@ -1618,6 +1648,26 @@ **ACL使能**:TRUE +## ohos.permission.CLOUDFILE_SYNC_MANAGER + +允许应用获取端云同步管理能力。 + +**权限级别**:system_basic + +**授权方式**:system_grant + +**ACL使能**:TRUE + +## ohos.permission.CLOUDFILE_SYNC + +允许应用使用端云同步能力。 + +**权限级别**:system_basic + +**授权方式**:system_grant + +**ACL使能**:TRUE + ## ohos.permission.FILE_ACCESS_MANAGER 允许文件管理类应用通过FAF框架访问公共数据文件。 @@ -1716,4 +1766,64 @@ **授权方式**:system_grant -**ACL使能**:TRUE \ No newline at end of file +**ACL使能**:TRUE + +## ohos.permission.CONNECT_CELLULAR_CALL_SERVICE + +允许系统服务访问蜂窝通话SA。 + +**权限级别**:system_basic + +**授权方式**:system_grant + +**ACL使能**:FALSE + +## ohos.permission.CONNECT_IMS_SERVICE + +允许系统服务访问IMS SA。 + +**权限级别**:system_basic + +**授权方式**:system_grant + +**ACL使能**:FALSE + +## ohos.permission.ACCESS_SENSING_WITH_ULTRASOUND + +允许应用使用超声波感知。 + +**权限级别**:system_basic + +**授权方式**:system_grant + +**ACL使能**:FALSE + +## ohos.permission.INSTALL_ENTERPRISE_BUNDLE + +允许应用安装、卸载其他企业InHouse应用。 + +**权限级别**:system_core + +**授权方式**:system_grant + +**ACL使能**:TRUE + +## ohos.permission.PROXY_AUTHORIZATION_URI + +允许应用代理授权URI。 + +**权限级别**:system_basic + +**授权方式**:system_grant + +**ACL使能**:FALSE + +## ohos.permission.GET_INSTALLED_BUNDLE_LIST + +允许应用读取已安装应用列表。 + +**权限级别**:system_basic + +**授权方式**:user_grant + +**ACL使能**:TRUE diff --git a/zh-cn/application-dev/security/userauth-guidelines.md b/zh-cn/application-dev/security/userauth-guidelines.md index f6b31bc96ed0635ab85a9294522de3aae7015103..80ccb1974280e59cff6f42c307a63402e6119b0f 100644 --- a/zh-cn/application-dev/security/userauth-guidelines.md +++ b/zh-cn/application-dev/security/userauth-guidelines.md @@ -17,7 +17,6 @@ userIAM_userAuth模块提供了用户认证的相关方法,包括查询认证 | 接口名称 | 功能描述 | | ---------- | ----------------------- | -| getVersion() : number | 获取认证对象的版本信息。 | | getAvailableStatus(authType : UserAuthType, authTrustLevel : AuthTrustLevel): void | 根据指定的认证类型、认证等级,检测当前设备是否支持相应的认证能力。 | | getAuthInstance(challenge : Uint8Array, authType : UserAuthType, authTrustLevel : AuthTrustLevel): AuthInstance | 获取AuthInstance对象,用于执行用户身份认证。 | | on(name : AuthEventKey, callback : AuthEvent) : void | 订阅指定类型的用户认证事件。 | @@ -25,26 +24,6 @@ userIAM_userAuth模块提供了用户认证的相关方法,包括查询认证 | start: void | 执行用户认证。 | | cancel: void | 取消本次认证操作。 | -## 获取认证对象的版本信息 - -### 开发步骤 - -1. 申请权限。调用[getVersion](../reference/apis/js-apis-useriam-userauth.md#useriam_userauthgetversion9)接口,需要在module.json5文件的requestPermissions对象中配置ohos.permission.ACCESS_BIOMETRIC权限。更多配置信息请参考[Stage模型应用程序包结构](../quick-start/module-configuration-file.md)。 - -2. 调用[getVersion](../reference/apis/js-apis-useriam-userauth.md#useriam_userauthgetversion9)接口获取版本信息。 - - ```js - import userIAM_userAuth from '@ohos.userIAM.userAuth'; - - // 获取版本信息 - try { - let version = userIAM_userAuth.getVersion(); - console.info("auth version = " + version); - } catch (error) { - console.info("get version failed, error = " + error); - } - ``` - ## 查询当前设备是否支持相应的认证能力 ### 开发步骤 diff --git a/zh-cn/application-dev/task-management/background-task-overview.md b/zh-cn/application-dev/task-management/background-task-overview.md index 39c936f684643553785fac81dba144c9c206e5c3..e0543c26b61ba49b7d0c9140008b890ffc78bbfe 100644 --- a/zh-cn/application-dev/task-management/background-task-overview.md +++ b/zh-cn/application-dev/task-management/background-task-overview.md @@ -67,7 +67,7 @@ OpenHarmony提供了九种后台模式,供需要在后台做长时任务的业 - 如果任务结束,应用应主动退出后台模式。若在后台运行期间,系统检测到应用并未使用对应后台模式的资源,则会被挂起(Suspend)。 - 避免不合理地申请后台长时任务,长时任务类型要与应用的业务类型匹配。如果执行的任务和申请的类型不匹配,也会被系统检测到并被挂起(Suspend)。 - 长时任务是为了真正在后台长时间执行某个任务,如果一个应用申请了长时任务,但在实际运行过程中,并未真正运行或执行此类任务时,也会被系统检测到并被挂起(Suspend)。 -- 一个Ability同一时刻只能申请运行一个长时任务。 +- 一个Ability同一时刻只能申请运行一个长时任务。如果同一时刻需要申请多个长时任务,需要创建多个Ability,每个Ability申请一个长时任务。 ## 延迟任务 延迟任务调度给应用提供一个机制,允许应用根据系统安排,在系统空闲时执行实时性要求不高的任务,比如设备空闲时候做一次数据学习等场景。当应用申请延迟任务的时候,任务会被放入待调度队列,系统会根据当前状态,如内存、功耗、温度等统一决策最优的调度时机。同时支持任务的持久化,应用退出或者设备重启,设置的任务同样能够被触发。 diff --git a/zh-cn/application-dev/task-management/continuous-task-dev-guide.md b/zh-cn/application-dev/task-management/continuous-task-dev-guide.md index 6cd06d8b478afe22721c288591df4f3050f9ab77..f7f7437bb8285960bf9d986d82cc355456209a2f 100644 --- a/zh-cn/application-dev/task-management/continuous-task-dev-guide.md +++ b/zh-cn/application-dev/task-management/continuous-task-dev-guide.md @@ -210,7 +210,7 @@ function stopContinuousTask() { } } -class MySequenceable { +class MyParcelable { num: number = 0; str: String = ""; @@ -219,23 +219,23 @@ class MySequenceable { this.str = string; } - marshalling(messageParcel) { - messageParcel.writeInt(this.num); - messageParcel.writeString(this.str); + marshalling(messageSequence) { + messageSequence.writeInt(this.num); + messageSequence.writeString(this.str); return true; } - unmarshalling(messageParcel) { - this.num = messageParcel.readInt(); - this.str = messageParcel.readString(); + unmarshalling(messageSequence) { + this.num = messageSequence.readInt(); + this.str = messageSequence.readString(); return true; } } function sendMsgCallback(data) { console.info('BgTaskAbility funcCallBack is called ' + data) - let receivedData = new MySequenceable(0, "") - data.readSequenceable(receivedData) + let receivedData = new MyParcelable(0, "") + data.readParcelable(receivedData) console.info(`receiveData[${receivedData.num}, ${receivedData.str}]`) // 可以根据Caller端发送的序列化数据的str值,执行不同的方法。 if (receivedData.str === 'start_bgtask') { @@ -243,7 +243,7 @@ function sendMsgCallback(data) { } else if (receivedData.str === 'stop_bgtask') { stopContinuousTask(); } - return new MySequenceable(10, "Callee test"); + return new MyParcelable(10, "Callee test"); } export default class BgTaskAbility extends UIAbility { diff --git a/zh-cn/application-dev/task-management/reminder-agent-development.md b/zh-cn/application-dev/task-management/reminder-agent-development.md index cc57f01db881131f73ea7b11392005dd03fc0442..3b4d643ac42657c7b092c0ce47b9ff23da14d4bd 100644 --- a/zh-cn/application-dev/task-management/reminder-agent-development.md +++ b/zh-cn/application-dev/task-management/reminder-agent-development.md @@ -19,7 +19,7 @@ ## 开发步骤 -1. 申请`ohos.permission.PUBLISH_AGENT_REMINDER`权限,配置方式请参见[访问控制授权申请](../security/accesstoken-guidelines.md#配置文件权限声明)。 +1. 需要申请`ohos.permission.PUBLISH_AGENT_REMINDER`权限,配置方式请参见[配置文件权限声明](../security/accesstoken-guidelines.md#配置文件权限声明)。 2. [使能通知开关](../notification/notification-enable.md),获得用户授权后,才能使用代理提醒功能。 @@ -37,7 +37,7 @@ let targetReminderAgent: reminderAgentManager.ReminderRequestTimer = { reminderType: reminderAgentManager.ReminderType.REMINDER_TYPE_TIMER, // 提醒类型为倒计时类型 triggerTimeInSeconds: 10, - actionButton: [ // 设置弹出的提醒通知信息上显示的按钮类型和标题,支持“关闭”和“延迟”两种类型,其中“延迟”按钮类型需要与snoozeTimes和timeInterval参数结合使用 + actionButton: [ // 设置弹出的提醒通知信息上显示的按钮类型和标题 { title: 'close', type: reminderAgentManager.ActionButtonType.ACTION_BUTTON_TYPE_CLOSE @@ -73,7 +73,7 @@ }, repeatMonths: [1], // 指明重复提醒的月份 repeatDays: [1], // 指明重复提醒的日期 - actionButton: [ // 设置弹出的提醒通知信息上显示的按钮类型和标题,支持“关闭”和“延迟”两种类型,其中“延迟”按钮类型需要与snoozeTimes和timeInterval参数结合使用 + actionButton: [ // 设置弹出的提醒通知信息上显示的按钮类型和标题 { title: 'close', type: reminderAgentManager.ActionButtonType.ACTION_BUTTON_TYPE_CLOSE @@ -93,7 +93,7 @@ }, ringDuration: 5, // 指明响铃时长(单位:秒) snoozeTimes: 2, // 指明延迟提醒次数 - timeInterval: 5, // 执行延迟提醒间隔(单位:秒) + timeInterval: 300, // 执行延迟提醒间隔(单位:秒) title: 'this is title', // 指明提醒标题 content: 'this is content', // 指明提醒内容 expiredContent: 'this reminder has expired', // 指明提醒过期后需要显示的内容 @@ -110,7 +110,7 @@ hour: 23, // 指明提醒的目标时刻 minute: 9, // 指明提醒的目标分钟 daysOfWeek: [2], // 指明每周哪几天需要重复提醒 - actionButton: [ // 设置弹出的提醒通知信息上显示的按钮类型和标题,支持“关闭”和“延迟”两种类型,其中“延迟”按钮类型需要与snoozeTimes和timeInterval参数结合使用 + actionButton: [ // 设置弹出的提醒通知信息上显示的按钮类型和标题 { title: 'close', type: reminderAgentManager.ActionButtonType.ACTION_BUTTON_TYPE_CLOSE @@ -130,7 +130,7 @@ }, ringDuration: 5, // 指明响铃时长(单位:秒) snoozeTimes: 2, // 指明延迟提醒次数 - timeInterval: 5, // 执行延迟提醒间隔(单位:秒) + timeInterval: 300, // 执行延迟提醒间隔(单位:秒) title: 'this is title', // 指明提醒标题 content: 'this is content', // 指明提醒内容 expiredContent: 'this reminder has expired', // 指明提醒过期后需要显示的内容 @@ -180,4 +180,4 @@ 基于后台代理提醒的开发,有以下相关实例可供参考: -- [闹钟(ArkTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/CommonEventAndNotification/AlarmClock) \ No newline at end of file +- [闹钟(ArkTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/CommonEventAndNotification/AlarmClock) diff --git a/zh-cn/application-dev/task-management/work-scheduler-dev-guide.md b/zh-cn/application-dev/task-management/work-scheduler-dev-guide.md index f98f682fe5ce9792071103e460adf78129383c3f..d8e227f4c5423214146078003b07b9ba4bbb71fe 100644 --- a/zh-cn/application-dev/task-management/work-scheduler-dev-guide.md +++ b/zh-cn/application-dev/task-management/work-scheduler-dev-guide.md @@ -186,7 +186,7 @@ try{ try{ workScheduler.isLastWorkTimeOut(500, (error, res) =>{ if (error) { - onsole.error(`workschedulerLog isLastWorkTimeOut failed. code is ${error.code} message is ${error.message}`); + console.error(`workschedulerLog isLastWorkTimeOut failed. code is ${error.code} message is ${error.message}`); } else { console.info(`workschedulerLog isLastWorkTimeOut success, data is: ${res}`); } diff --git a/zh-cn/application-dev/task-management/workscheduler-extensionability.md b/zh-cn/application-dev/task-management/workscheduler-extensionability.md index 5f9b24c861275432eb5667180325e2381b01a992..d331a39dad6f0f011468e96294005989835efae4 100644 --- a/zh-cn/application-dev/task-management/workscheduler-extensionability.md +++ b/zh-cn/application-dev/task-management/workscheduler-extensionability.md @@ -9,7 +9,7 @@ WorkSchedulerExtensionAbility提供了延迟任务回调能力,在延迟任务 延迟任务调度运作机制如图1所示。 **图1** 延迟任务调度运作机制  - + ![WorkSchedulerExtensionAbility](figures/WorkSchedulerExtensionAbility.png) 应用通过[延迟任务API](../reference/apis/js-apis-resourceschedule-workScheduler.md)注册、删除、查询任务。 @@ -78,7 +78,7 @@ WorkSchedulerExtensionAbility类拥有如下API接口,具体的API介绍详见 ``` 3. 在工程entry Module对应的ets目录(./entry/src/main/ets)下,新建一个目录并命名为workAbility。 -在workAbility目录下,新建一个ArkTS文件并命名为WorkTest.ets,实现延迟任务回调接口。 + 在workAbility目录下,新建一个ArkTS文件并命名为WorkTest.ets,实现延迟任务回调接口。 导入模块。 @@ -94,7 +94,7 @@ WorkSchedulerExtensionAbility类拥有如下API接口,具体的API介绍详见 console.log(`onWorkStartTest start ${JSON.stringify(workInfo)}`); super.onWorkStart(workInfo); } - + onWorkStopTest(workInfo) { super.onWorkStop(workInfo); console.log(`onWorkStop value`); @@ -177,7 +177,7 @@ WorkSchedulerExtensionAbility类拥有如下API接口,具体的API介绍详见 ### 配置文件 -1. 在工程entry Module对应的[module.json5配置文件](../quick-start/module-configuration-file.md)中注册WorkSchedulerExtensionAbility,type标签需要设置为“workScheduler”,srcEntrance标签表示当前ExtensionAbility组件所对应的代码路径。 +1. 在工程entry Module对应的[module.json5配置文件](../quick-start/module-configuration-file.md)中注册WorkSchedulerExtensionAbility,type标签需要设置为“workScheduler”,srcEntry标签表示当前ExtensionAbility组件所对应的代码路径。 ```json { @@ -185,7 +185,7 @@ WorkSchedulerExtensionAbility类拥有如下API接口,具体的API介绍详见 "extensionAbilities": [ { "name": "WorkTest", - "srcEntrance": "./ets/workAbility/WorkTest.ets", + "srcEntry": "./ets/workAbility/WorkTest.ets", "label": "$string:WorkSchedulerExtensionAbility_label", "description": "$string:WorkSchedulerExtensionAbility_desc", "type": "workScheduler" @@ -195,9 +195,19 @@ WorkSchedulerExtensionAbility类拥有如下API接口,具体的API介绍详见 } ``` +## 限制 + +为了降低WorkSchedulerExtensionAbility能力被三方应用滥用的风险,在WorkSchedulerExtensionAbility中限制以下接口的调用 + +- @ohos.backgroundTaskManager.d.ts +- @ohos.resourceschedule.backgroundTaskManager.d.ts +- @ohos.multimedia.camera.d.ts +- @ohos.multimedia.audio.d.ts +- @ohos.multimedia.media.d.ts + ## 相关实例 针对WorkSchedulerExtensionAbility开发,有以下相关示例可供参考: -[WorkScheduler的创建与使用(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/ResourcesSchedule/WorkScheduler) +- [WorkScheduler的创建与使用(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/TaskManagement/WorkScheduler) diff --git a/zh-cn/application-dev/telephony/telephony-call.md b/zh-cn/application-dev/telephony/telephony-call.md index 0426b1df602827beb3e6b163ecd893241b475545..483a6ecc5dd590f5038d279c8a091f8417467a7a 100644 --- a/zh-cn/application-dev/telephony/telephony-call.md +++ b/zh-cn/application-dev/telephony/telephony-call.md @@ -113,4 +113,4 @@ ohos.permission.PLACE_CALL权限级别为system_basic,在申请权限前,请 拨打电话有以下相关实例可供参考: -- [拨打电话](https://gitee.com/openharmony/applications_app_samples/tree/master/Telephony/Call) +- [拨打电话](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Telephony/Call) diff --git a/zh-cn/application-dev/telephony/telephony-sms.md b/zh-cn/application-dev/telephony/telephony-sms.md index 15050311040ed94a7a8d10cde184e8e512cd8498..ca4f78bcebbdf60d852f19795379df78b05acb24 100644 --- a/zh-cn/application-dev/telephony/telephony-sms.md +++ b/zh-cn/application-dev/telephony/telephony-sms.md @@ -115,4 +115,4 @@ ## 相关实例 针对短信的使用,有以下相关实例可供参考: -- [短信服务](https://gitee.com/openharmony/applications_app_samples/tree/master/Telephony/Message) +- [短信服务](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Telephony/Message) diff --git a/zh-cn/application-dev/tools/aa-tool.md b/zh-cn/application-dev/tools/aa-tool.md index eb3c727c7128072b7d51d3303448fc6ad30b299f..1be35ff10856c4fe4d40d5c8b55e1f3711e77699 100644 --- a/zh-cn/application-dev/tools/aa-tool.md +++ b/zh-cn/application-dev/tools/aa-tool.md @@ -24,7 +24,7 @@ Ability assistant(Ability助手,简称为aa),是实现应用及测试用 - start - 用于启动一个应用组件,目标组件可以是FA模型的PageAbility和ServiceAbility组件,也可以是Stage模型的UIAbility和ServiceExtensionAbility组件,且目标组件相应配置文件中的visible标签不能配置为false。 + 用于启动一个应用组件,目标组件可以是FA模型的PageAbility和ServiceAbility组件,也可以是Stage模型的UIAbility和ServiceExtensionAbility组件,且目标组件相应配置文件中的exported标签不能配置为false。 | 参数 | 参数说明 | | -------- | -------- | @@ -72,7 +72,7 @@ Ability assistant(Ability助手,简称为aa),是实现应用及测试用 | -------- | -------- | -------- | | -h/--help | - | 帮助信息。 | | -a/--all | - | 打印所有mission内的应用组件信息。 | - | -l/--mission-list | type(缺省打印全部) | 服务侧为了方便管理任务链,内部维护了4种类型的任务链。
可取值:
- NORMAL: 正常启动的任务链(比如A拉起B拉起C, 则对应的任务链是A->B->C)
- DEFAULT_STANDARD: 已经被破坏的任务链中的任务, 启动模式为standard的任务被放到该任务链中, 这里面的任务之间没有关联关系
- DEFAULT_SINGLE: 已经被破坏的任务链中的任务, 启动模式为singleton的任务被放到该任务链中, 这里面的任务之间没有关联关系
- LAUNCHER: launcher的任务链 | + | -l/--mission-list | type(缺省打印全部) | 服务侧为了方便管理任务链,内部维护了4种类型的任务链。
可取值:
- NORMAL:正常启动的任务链(比如A拉起B拉起C, 则对应的任务链是A->B->C)
- DEFAULT_STANDARD:已经被破坏的任务链中的任务, 启动模式为`multiton`的任务被放到该任务链中, 这里面的任务之间没有关联关系
- DEFAULT_SINGLE:已经被破坏的任务链中的任务, 启动模式为`singleton`的任务被放到该任务链中, 这里面的任务之间没有关联关系
- LAUNCHER:launcher的任务链 | | -e/--extension | elementName | 打印扩展组件信息。 | | -u/--userId | UserId | 打印指定UserId的栈信息,需要和其他参数组合使用,例如aa dump -a -u 100、aa dump -d -u 100。 | | -d/--data | - | 打印DataAbility相关信息。 | diff --git a/zh-cn/application-dev/tools/bm-tool.md b/zh-cn/application-dev/tools/bm-tool.md index e47fe4ef6bfd98029fd009e47bd326dbeb46b675..f7d9ff64e913212554d419eebfb16f0ec2556e5d 100644 --- a/zh-cn/application-dev/tools/bm-tool.md +++ b/zh-cn/application-dev/tools/bm-tool.md @@ -56,6 +56,7 @@ bm install [-h] [-p path] [-u userId] [-r] [-w waitting-time] | -u | 否,默认安装到当前所有用户上 | 给指定用户安装一个HAP | | -r | 否,默认值为覆盖安装 | 覆盖安装一个HAP | | -w | 否,默认等待5s | 安装HAP时指定bm工具等待时间,最小的等待时长为5s,最大的等待时长为600s, 默认缺省为5s | +| -s | 否 | 安装应用间HSP路径,支持指定多个应用间HSP路径同时安装 | 示例: @@ -64,6 +65,12 @@ bm install [-h] [-p path] [-u userId] [-r] [-w waitting-time] bm install -p /data/app/ohosapp.hap -u 100 -w 5s -r // 执行结果 install bundle successfully. +# 安装一个应用间共享库 +bm install -s xxx.hsp +# 同时安装多个应用间共享库 +bm install -s xxx.hsp yyy.hsp +# 同时安装使用方应用和其依赖的应用间共享库 +bm install -p aaa.hap -s xxx.hsp yyy.hsp ``` @@ -83,6 +90,8 @@ bm uninstall [-h help] [-n bundleName] [-m moduleName] [-u userId] [-k] | -m | 否,默认卸载所有模块 | 指定卸载应用的一个模块 | | -u | 否,默认卸载当前所有用户下该应用 | 指定用户卸载应用 | | -k | 否,默认卸载应用时不保存应用数据 | 卸载应用时保存应用数据 | +| -s | 否 | 安装应用间HSP路径,支持指定多个应用间HSP路径同时安装 | +| -v | 否,默认卸载同包名的所有共享包 | 指示共享包的版本号 | 示例: @@ -91,6 +100,10 @@ bm uninstall [-h help] [-n bundleName] [-m moduleName] [-u userId] [-k] bm uninstall -n com.ohos.app -m com.ohos.app.EntryAbility -u 100 -k // 执行结果 uninstall bundle successfully. +# 卸载一个shared bundle +bm uninstall -s -n com.ohos.example +# 卸载一个shared bundle的指定版本 +bm uninstall -s -n com.ohos.example -v 100001 ``` @@ -286,3 +299,30 @@ bm quickfix -a -f /data/app/ //执行结果 apply quickfix succeed. ``` + +## 共享库查询命令 + +```bash +bm dump-shared [-h help] [-a] [-n bundleName] [-m moudleName] +``` + + **表11** 共享库查询命令列表 + +| 命令 | 描述 | +| ------------------------------------------------ | -------------------------------------- | +| bm dump-shared -h | 显示dump-shared支持的命令信息 | +| bm dump-shared -a | 查询系统中已安装所有共享库 | +| bm dump-shared -n | 查询指定共享库包名的详细信息 | +| bm dump-dependencies -h | 显示bm dump-dependencies支持的命令信息 | +| bm dump-dependencies -n bundleName -m moudleName | 查询指定应用指定模块依赖的共享库信息 | + +示例: + +```bash +# 显示所有已安装共享库包名 +bm dump-shared -a +# 显示该共享库的详细信息 +bm dump-shared -n com.ohos.lib +# 显示指定应用指定模块依赖的共享库信息 +bm dump-dependencies -n com.ohos.app -m entry +``` diff --git a/zh-cn/application-dev/tools/lldb-tool.md b/zh-cn/application-dev/tools/lldb-tool.md new file mode 100644 index 0000000000000000000000000000000000000000..1764dca6756c9520a1272189e4ade6afc08f2581 --- /dev/null +++ b/zh-cn/application-dev/tools/lldb-tool.md @@ -0,0 +1,101 @@ +# LLDB调试器使用指导 +## 概述 +LLDB(Low Lever Debugger)是新一代高性能调试器。 + +当前Openharmony中的LLDB工具是在[llvm15.0.4](https://github.com/llvm/llvm-project/releases/tag/llvmorg-15.0.4)基础上适配演进出来的工具,支持在桌面和Openharmony设备或模拟器上调试。 +## 工具获取 +通过OpenHarmony的SDK获取,从以下链接获取SDK:http://ci.openharmony.cn/dailys/dailybuilds + +lldb工具在SDK中的路径: +``` +\ohos-sdk\[system]\native\llvm +``` +其中system可选windows/linux/darwin。 + +以windows平台为例,解压SDK后,lldb.exe的存放路径为: +``` +\ohos-sdk\windows\native\llvm\bin +``` + +## 支持平台与架构 + +### 本地调试 +#### linux平台调试使用示例 +1.获取到与lldb同一版本的clang编译器生成的带有调试信息的可执行文件filename + +2.指定调试的文件名,终端窗口执行命令: +``` +./lldb filename +``` +3.在代码中main函数处打断点,lldb界面下执行命令: +``` +(lldb) b main +``` +4.运行程序,使程序停在断点处,lldb界面下执行命令: +``` +(lldb) run +``` +5.执行后续调试操作 +### 远程调试 + +> **说明:远程调试时需要lldb-server和lldb配合使用** +- windows平台ohos设备调试(arm架构调试) +- windows平台ohos设备调试(aarch64架构调试) +- windows平台模拟器调试 +- mac(M1)平台ohos设备调试(arm架构调试) +- mac(M1)平台ohos设备调试(aarch64架构调试) +- mac(M1)平台模拟器调试 +- mac(x86)平台ohos设备调试(arm架构调试) +- mac(x86)平台ohos设备调试(aarch64架构调试) +- mac(x86)平台模拟器调试 +- linux平台ohos设备调试(arm架构调试) +- linux平台ohos设备调试(aarch64架构调试) + +#### 远程调试使用示例 + +linux平台连接arm架构ohos设备远程调试 + +1.设备上运行带有调试信息的可执行文件: + +``` +./filename +``` +2.将lldb-server推送到设备,运行lldb-server。 + +命令行窗口1: + +``` +hdc file send lldb-server /data/local/tmp +hdc shell ./data/local/tmp/lldb-server p --server --listen "*:8080" +``` +> **说明:其中/data/local/tmp为设备上指定的目录,8080为监听端口,均可自定义** + +3.在另一窗口启动lldb,选择远端ohos并连接。 + +命令行窗口2: + +``` +./lldb +(lldb) platform select remote-ohos +(lldb) platform connect connect://localhost:8080 +``` +4.打断点,以及后续调试操作。 + +命令行窗口2: + +``` +(lldb) breakpoint set --file --line +(lldb) process attach --name process-name +``` +## lldb调试器提供功能列表 +- 将程序加载到lldb +- 设置断点 +- 设置观察点 +- 启动或attach到程序 +- 控制程序的执行 +- 检查线程状态 +- 检查栈帧状态 + +## 其他更多功能与具体命令请参考 +[LLDB工具使用指导](https://gitee.com/openharmony/third_party_llvm-project/blob/master/lldb/README_zh.md) + diff --git a/zh-cn/application-dev/ui/Readme-CN.md b/zh-cn/application-dev/ui/Readme-CN.md index 8d0e6bba9e21fe19ef53e6fa16068f30cfb73f57..858f35b12b45c3fdbce4e9c35901e149bbc3202c 100755 --- a/zh-cn/application-dev/ui/Readme-CN.md +++ b/zh-cn/application-dev/ui/Readme-CN.md @@ -1,34 +1,66 @@ # UI开发 -- [方舟开发框架(ArkUI)概述](arkui-overview.md) -- 基于ArkTS的声明式开发范式 - - [概述](ui-ts-overview.md) - - [声明式UI开发指导](ui-ts-developing-intro.md) - - 声明式UI开发实例 - - [创建简单视图](ui-ts-creating-simple-page.md) - - 构建完整实例 - - [构建食物数据模型](ui-ts-building-data-model.md) - - [构建食物列表List布局](ui-ts-building-category-list-layout.md) - - [构建食物分类Grid布局](ui-ts-building-category-grid-layout.md) - - [页面跳转与数据传递](ui-ts-page-redirection-data-transmission.md) - - 添加闪屏动画 - - [绘制图像](ui-ts-drawing-feature.md) - - [添加动画效果](ui-ts-animation-feature.md) - - [常用组件说明](ui-ts-components-intro.md) - - 常见布局开发指导 - - 自适应布局 - - [线性布局](ui-ts-layout-linear.md) - - [层叠布局](ui-ts-layout-stack.md) - - [弹性布局](ui-ts-layout-flex.md) - - [网格布局](ui-ts-layout-grid.md) - - 响应式布局 - - [栅格布局](ui-ts-layout-grid-container-new.md) - - [媒体查询](ui-ts-layout-mediaquery.md) - - [自定义组件的生命周期](ui-ts-custom-component-lifecycle-callbacks.md) - - [Web组件开发指导](ui-ts-components-web.md) - - [性能提升的推荐方法](ui-ts-performance-improvement-recommendation.md) -- 兼容JS的类Web开发范式 - - [概述](ui-js-overview.md) +- [方舟开发框架概述](arkui-overview.md) +- UI开发(ArkTS声明式开发范式) + - [UI开发(ArkTS声明式开发范式)概述](arkts-ui-development-overview.md) + - 开发布局 + - [布局概述](arkts-layout-development-overview.md) + - 构建布局 + - [线性布局](arkts-layout-development-linear.md) + - [层叠布局](arkts-layout-development-stack-layout.md) + - [弹性布局](arkts-layout-development-flex-layout.md) + - [相对布局](arkts-layout-development-relative-layout.md) + - [栅格布局](arkts-layout-development-grid-layout.md) + - [媒体查询](arkts-layout-development-media-query.md) + - [创建列表](arkts-layout-development-create-list.md) + - [创建网格](arkts-layout-development-create-grid.md) + - [创建轮播](arkts-layout-development-create-looping.md) + - [改善布局性能](arkts-layout-development-performance-boost.md) + - 添加组件 + - 添加常用组件 + - [按钮](arkts-common-components-button.md) + - [单选框](arkts-common-components-radio-button.md) + - [切换按钮](arkts-common-components-switch.md) + - [进度条](arkts-common-components-progress-indicator.md) + - [文本显示](arkts-common-components-text-display.md) + - [文本输入](arkts-common-components-text-input.md) + - [自定义弹窗](arkts-common-components-custom-dialog.md) + - [视频播放](arkts-common-components-video-player.md) + - [XComponent](arkts-common-components-xcomponent.md) + - 添加气泡和菜单 + - [气泡提示](arkts-popup-and-menu-components-popup.md) + - [菜单](arkts-popup-and-menu-components-menu.md) + - 设置页面路由和组件导航 + - [页面路由](arkts-routing.md) + - 组件导航 + - [Navigation](arkts-navigation-navigation.md) + - [Tabs](arkts-navigation-tabs.md) + - 显示图形 + - [显示图片](arkts-graphics-display.md) + - [绘制几何图形](arkts-geometric-shape-drawing.md) + - [使用画布绘制自定义图形](arkts-drawing-customization-on-canvas.md) + - 使用动画 + - [动画概述](arkts-animation-overview.md) + - 页面内的动画 + - [布局更新动画](arkts-layout-update-animation.md) + - [组件内转场动画](arkts-transition-animation-within-component.md) + - [弹簧曲线动画](arkts-spring-animation.md) + - 页面间的动画 + - [放大缩小视图](arkts-zoom-animation.md) + - [页面转场动画](arkts-page-transition-animation.md) + - 支持交互事件 + - [交互事件概述](arkts-event-overview.md) + - 使用通用事件 + - [触屏事件](arkts-common-events-touch-screen-event.md) + - [键鼠事件](arkts-common-events-device-input-event.md) + - [焦点事件](arkts-common-events-focus-event.md) + - 使用手势事件 + - [绑定手势方法](arkts-gesture-events-binding.md) + - [单一手势](arkts-gesture-events-single-gesture.md) + - [组合手势](arkts-gesture-events-combined-gestures.md) + - [性能提升的推荐方法](arkts-performance-improvement-recommendation.md) +- UI开发(兼容JS的类Web开发范式) + - [UI开发(兼容JS的类Web开发范式)概述](ui-js-overview.md) - 框架说明 - [文件组织](js-framework-file.md) - [js标签配置](js-framework-js-tag.md) diff --git a/zh-cn/application-dev/ui/arkts-animation-overview.md b/zh-cn/application-dev/ui/arkts-animation-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..a26ef6acfe2b0241d0c222e940bdacaa629a6016 --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-animation-overview.md @@ -0,0 +1,27 @@ +# 动画概述 + + +动画的原理是在一个时间段内,多次改变UI外观,由于人眼会产生视觉暂留,所以最终看到的就是一个“连续”的动画。UI的一次改变称为一个动画帧,对应一次屏幕刷新,而决定动画流畅度的一个重要指标就是帧率FPS(Frame Per Second),即每秒的动画帧数,帧率越高则动画就会越流畅。 + + +ArkUI中,产生动画的方式是改变属性值且指定动画参数。动画参数包含了如动画时长、变化规律(即曲线)等参数。当属性值发生变化后,按照动画参数,从原来的状态过渡到新的状态,即形成一个动画。 + + +ArkUI提供的动画能力按照页面的分类方式,可分为页面内的动画和页面间的动画。如下图所示,页面内的动画指在一个页面内即可发生的动画,页面间的动画指两个页面跳转时才会发生的动画。 + + + **图1** 按照页面分类的动画   + +![zh-cn_image_0000001562700385](figures/zh-cn_image_0000001562700385.png) + + +如果按照基础能力分,可分为属性动画、显式动画、转场动画三部分。如下图所示。 + + + **图2** 按照基础能力分类的动画   + + +![zh-cn_image_0000001562820753](figures/zh-cn_image_0000001562820753.png) + + +本文按照页面的分类方式,从使用场景出发,提供各种动画的使用方法和注意事项,使开发者快速学习动画。 diff --git a/zh-cn/application-dev/ui/arkts-common-components-button.md b/zh-cn/application-dev/ui/arkts-common-components-button.md new file mode 100644 index 0000000000000000000000000000000000000000..08a05ae17b2bbe6319e71977ab261e5a60153a5a --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-common-components-button.md @@ -0,0 +1,261 @@ +# 按钮 + + +Button是按钮组件,通常用于响应用户的点击操作,其类型包括胶囊按钮、圆形按钮、普通按钮。Button当做为容器使用时可以通过添加子组件实现包含文字、图片等元素的按钮。具体用法请参考[Button](../reference/arkui-ts/ts-basic-components-button.md)。 + + +## 创建按钮 + +Button通过调用接口来创建,接口调用有以下两种形式: + + +- 创建不包含子组件的按钮。 + + ```ts + Button(label?: string, options?: { type?: ButtonType, stateEffect?: boolean }) + ``` + + 该接口用于创建不包含子组件的按钮,其中label用来设置按钮文字,type用于设置Button类型,stateEffect属性设置Button是否开启点击效果。 + + ```ts + Button('Ok', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(90) + .height(40) + ``` + + ![zh-cn_image_0000001562820757](figures/zh-cn_image_0000001562820757.png) + + +- 创建包含子组件的按钮。 + + ```ts + Button(options?: {type?: ButtonType, stateEffect?: boolean}) + ``` + + 该接口用于创建包含子组件的按钮,只支持包含一个子组件,子组件可以是[基础组件](../reference/arkui-ts/ts-basic-components-blank.md)或者[容器组件](../reference/arkui-ts/ts-container-ability-component.md)。 + + ```ts + Button({ type: ButtonType.Normal, stateEffect: true }) { + Row() { + Image($r('app.media.loading')).width(20).height(40).margin({ left: 12 }) + Text('loading').fontSize(12).fontColor(0xffffff).margin({ left: 5, right: 12 }) + }.alignItems(VerticalAlign.Center) + }.borderRadius(8).backgroundColor(0x317aff).width(90).height(40) + ``` + + ![zh-cn_image_0000001511421216](figures/zh-cn_image_0000001511421216.png) + + +## 设置按钮类型 + +Button有三种可选类型,分别为Capsule(胶囊类型)、Circle(圆形按钮)和Normal(普通按钮),通过type进行设置。 + + +- 胶囊按钮(默认类型) + 此类型按钮的圆角自动设置为高度的一半,不支持通过borderRadius属性重新设置圆角。 + + ```ts + Button('Disable', { type: ButtonType.Capsule, stateEffect: false }) + .backgroundColor(0x317aff) + .width(90) + .height(40) + ``` + + ![zh-cn_image_0000001511421208](figures/zh-cn_image_0000001511421208.png) + + +- 圆形按钮 + 此类型按钮为圆形,不支持通过borderRadius属性重新设置圆角。 + + ```ts + Button('Circle', { type: ButtonType.Circle, stateEffect: false }) + .backgroundColor(0x317aff) + .width(90) + .height(90) + ``` + + ![zh-cn_image_0000001511740428](figures/zh-cn_image_0000001511740428.png) + +- 普通按钮 + 此类型的按钮默认圆角为0,支持通过borderRadius属性重新设置圆角。 + + ```ts + Button('Ok', { type: ButtonType.Normal, stateEffect: true }) + .borderRadius(8) + .backgroundColor(0x317aff) + .width(90) + .height(40) + ``` + + ![zh-cn_image_0000001563060641](figures/zh-cn_image_0000001563060641.png) + + +## 自定义样式 + +- 设置边框弧度。 + 一般使用通用属性来自定义按钮样式。例如通过borderRadius属性设置按钮的边框弧度。 + + ```ts + Button('circle border', { type: ButtonType.Normal }) + .borderRadius(20) + .height(40) + ``` + + ![zh-cn_image_0000001511900392](figures/zh-cn_image_0000001511900392.png) + + +- 设置文本样式。 + 通过添加文本样式设置按钮文本的展示样式。 + + ```ts + Button('font style', { type: ButtonType.Normal }) + .fontSize(20) + .fontColor(Color.Pink) + .fontWeight(800) + ``` + + ![zh-cn_image_0000001511580828](figures/zh-cn_image_0000001511580828.png) + + +- 设置背景颜色。 + 添加backgroundColor属性设置按钮的背景颜色。 + + ```ts + Button('background color').backgroundColor(0xF55A42) + ``` + + ![zh-cn_image_0000001562940477](figures/zh-cn_image_0000001562940477.png) + + +- 用作功能型按钮。 + 为删除操作创建一个按钮。 + + ```ts + Button({ type: ButtonType.Circle, stateEffect: true }) { + Image($r('app.media.ic_public_delete_filled')).width(30).height(30) + }.width(55).height(55).margin({ left: 20 }).backgroundColor(0xF55A42) + ``` + + ![zh-cn_image_0000001511740436](figures/zh-cn_image_0000001511740436.png) + + +## 添加事件 + +Button组件通常用于触发某些操作,可以绑定onClick事件来响应点击操作后的自定义行为。 + +```ts +Button('Ok', { type: ButtonType.Normal, stateEffect: true }) + .onClick(()=>{ + console.info('Button onClick') + }) +``` + + +## 场景示例 + +- 用于启动操作。 + 可以用按钮启动任何用户界面元素,按钮会根据用户的操作触发相应的事件。例如,在List容器里通过点击按钮进行页面跳转。 + + ```ts + // xxx.ets + import router from '@ohos.router'; + @Entry + @Component + struct ButtonCase1 { + build() { + List({ space: 4 }) { + ListItem() { + Button("First").onClick(() => { + router.pushUrl({ url: 'pages/first_page' }) + }) + .width('100%') + } + ListItem() { + Button("Second").onClick(() => { + router.pushUrl({ url: 'pages/second_page' }) + }) + .width('100%') + } + ListItem() { + Button("Third").onClick(() => { + router.pushUrl({ url: 'pages/third_page' }) + }) + .width('100%') + } + } + .listDirection(Axis.Vertical) + .backgroundColor(0xDCDCDC).padding(20) + } + } + ``` + + ![zh-cn_image_0000001562700393](figures/zh-cn_image_0000001562700393.png) + + +- 用于表单的提交。 + 在用户登录/注册页面,使用按钮进行登录或注册操作。 + + ```ts + // xxx.ets + @Entry + @Component + struct ButtonCase2 { + build() { + Column() { + TextInput({ placeholder: 'input your username' }).margin({ top: 20 }) + TextInput({ placeholder: 'input your password' }).type(InputType.Password).margin({ top: 20 }) + Button('Register').width(300).margin({ top: 20 }) + .onClick(() => { + // 需要执行的操作 + }) + }.padding(20) + } + } + ``` + + ![zh-cn_image_0000001562940473](figures/zh-cn_image_0000001562940473.png) + +- 悬浮按钮 + 在可以滑动的界面,滑动时按钮始终保持悬浮状态。 + + ```ts + // xxx.ets + @Entry + @Component + struct HoverButtonExample { + private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] + build() { + Stack() { + List({ space: 20, initialIndex: 0 }) { + ForEach(this.arr, (item) => { + ListItem() { + Text('' + item) + .width('100%').height(100).fontSize(16) + .textAlign(TextAlign.Center).borderRadius(10).backgroundColor(0xFFFFFF) + } + }, item => item) + }.width('90%') + Button() { + Image($r('app.media.ic_public_add')) + .width(50) + .height(50) + } + .width(60) + .height(60) + .position({x: '80%', y: 600}) + .shadow({radius: 10}) + .onClick(() => { + // 需要执行的操作 + }) + } + .width('100%') + .height('100%') + .backgroundColor(0xDCDCDC) + .padding({ top: 5 }) + } + } + ``` + + ![GIF](figures/GIF.gif) diff --git a/zh-cn/application-dev/ui/arkts-common-components-custom-dialog.md b/zh-cn/application-dev/ui/arkts-common-components-custom-dialog.md new file mode 100644 index 0000000000000000000000000000000000000000..94808dff9a47d5157983b4fbcdf8f1b1abb92cf6 --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-common-components-custom-dialog.md @@ -0,0 +1,100 @@ +# 自定义弹窗 + + +自定义弹窗CustomDialog可用于广告、中奖、警告、软件更新等与用户交互响应操作。开发者可以通过CustomDialogController类显示自定义弹窗。具体用法请参考[自定义弹窗](../reference/arkui-ts/ts-methods-custom-dialog-box.md)。 + + +## 创建自定义弹窗 + +1. 使用\@CustomDialog装饰器装饰自定义弹窗。 + +2. \@CustomDialog装饰器用于装饰自定义弹框,此装饰器内进行自定义内容(也就是弹框内容)。 + + ```ts + @CustomDialog + struct CustomDialogExample { + controller: CustomDialogController + build() { + Column() { + Text('我是内容') + .fontSize(20) + .margin({ top: 10, bottom: 10 }) + } + } + } + ``` + +3. 创建构造器,与装饰器呼应相连。 + + ```ts + dialogController: CustomDialogController = new CustomDialogController({ + builder: CustomDialogExample({}), + }) + ``` + +4. 点击与onClick事件绑定的组件使弹窗弹出 + + ```ts + Flex({justifyContent:FlexAlign.Center}){ + Button('click me') + .onClick(() => { + this.dialogController.open() + }) + }.width('100%') + ``` + + ![zh-cn_image_0000001562700493](figures/zh-cn_image_0000001562700493.png) + + +## 弹窗的交互 + +弹窗可用于数据交互,完成用户一系列响应操作。 + + +1. 在\@CustomDialog装饰器内添加按钮操作,同时添加数据函数的创建。 + + ```ts + @CustomDialog + struct CustomDialogExample { + controller: CustomDialogController + cancel: () => void + confirm: () => void + build() { + Column() { + Text('我是内容').fontSize(20).margin({ top: 10, bottom: 10 }) + Flex({ justifyContent: FlexAlign.SpaceAround }) { + Button('cancel') + .onClick(() => { + this.controller.close() + this.cancel() + }).backgroundColor(0xffffff).fontColor(Color.Black) + Button('confirm') + .onClick(() => { + this.controller.close() + this.confirm() + }).backgroundColor(0xffffff).fontColor(Color.Red) + }.margin({ bottom: 10 }) + } + } + } + ``` + +2. 页面内需要在构造器内进行接收,同时创建相应的函数操作。 + + ```ts + dialogController: CustomDialogController = new CustomDialogController({ + builder: CustomDialogExample({ + cancel: this.onCancel, + confirm: this.onAccept, + }), + alignment: DialogAlignment.Default, // 可设置dialog的对齐方式,设定显示在底部或中间等,默认为底部显示 + }) + onCancel() { + console.info('Callback when the first button is clicked') + } + onAccept() { + console.info('Callback when the second button is clicked') + } + ``` + + ![zh-cn_image_0000001511421320](figures/zh-cn_image_0000001511421320.png) diff --git a/zh-cn/application-dev/ui/arkts-common-components-progress-indicator.md b/zh-cn/application-dev/ui/arkts-common-components-progress-indicator.md new file mode 100644 index 0000000000000000000000000000000000000000..70026bd8724058808a26dcbd303ca6a0fdd85367 --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-common-components-progress-indicator.md @@ -0,0 +1,135 @@ +# 进度条 + + +Progress是进度条显示组件,显示内容通常为某次目标操作的当前进度。具体用法请参考[Progress](../reference/arkui-ts/ts-basic-components-progress.md)。 + + +## 创建进度条 + +Progress通过调用接口来创建,接口调用形式如下: + + + +```ts +Progress(options: {value: number, total?: number, type?: ProgressType}) +``` + + +该接口用于创建type样式的进度条,其中value用于设置初始进度值,total用于设置进度总长度,type决定Progress样式。 + + + +```ts +Progress({ value: 24, total: 100, type: ProgressType.Linear }) // 创建一个进度总长为100,初始进度值为24的线性进度条 +``` + + +![create](figures/create.png) + + +## 设置进度条样式 + +Progress有5种可选类型,在创建时通过设置ProgressType枚举类型给type可选项指定Progress类型。其分别为:ProgressType.Linear(线性样式)、 ProgressType.Ring(环形无刻度样式)、ProgressType.ScaleRing(环形有刻度样式)、ProgressType.Eclipse(圆形样式)和ProgressType.Capsule(胶囊样式)。 + + +- 线性样式进度条(默认类型) + >**说明:** + > + > 从API version9开始,组件高度大于宽度的时候自适应垂直显示,相等时仍然保持水平显示。 + + + ```ts + Progress({ value: 20, total: 100, type: ProgressType.Linear }).width(200).height(50) + Progress({ value: 20, total: 100, type: ProgressType.Linear }).width(50).height(200) + ``` + + ![zh-cn_image_0000001562700417](figures/zh-cn_image_0000001562700417.png) + +- 环形无刻度样式进度条 + + ```ts + // 从左往右,1号环形进度条,默认前景色为蓝色,默认strokeWidth进度条宽度为2.0vp + Progress({ value: 40, total: 150, type: ProgressType.Ring }).width(100).height(100) + // 从左往右,2号环形进度条 + Progress({ value: 40, total: 150, type: ProgressType.Ring }).width(100).height(100) + .color(Color.Grey) // 进度条前景色为灰色 + .style({ strokeWidth: 15}) // 设置strokeWidth进度条宽度为15.0vp + ``` + + ![progress_ring](figures/progress_ring.png) + +- 环形有刻度样式进度条 + + ```ts + Progress({ value: 20, total: 150, type: ProgressType.ScaleRing }).width(100).height(100) + .backgroundColor(Color.Black) + .style({ scaleCount: 20, scaleWidth: 5 }) // 设置环形有刻度进度条总刻度数为20,刻度宽度为5vp + Progress({ value: 20, total: 150, type: ProgressType.ScaleRing }).width(100).height(100) + .backgroundColor(Color.Black) + .style({ strokeWidth: 15, scaleCount: 20, scaleWidth: 5 }) // 设置环形有刻度进度条宽度15,总刻度数为20,刻度宽度为5vp + Progress({ value: 20, total: 150, type: ProgressType.ScaleRing }).width(100).height(100) + .backgroundColor(Color.Black) + .style({ strokeWidth: 15, scaleCount: 20, scaleWidth: 3 }) // 设置环形有刻度进度条宽度15,总刻度数为20,刻度宽度为3vp + ``` + + ![progress_scalering](figures/progress_scalering.png) + +- 圆形样式进度条 + + ```ts + // 从左往右,1号圆形进度条,默认前景色为蓝色 + Progress({ value: 10, total: 150, type: ProgressType.Eclipse }).width(100).height(100) + // 从左往右,2号圆形进度条,指定前景色为灰色 + Progress({ value: 20, total: 150, type: ProgressType.Eclipse }).color(Color.Grey).width(100).height(100) + ``` + + ![progress_circle](figures/progress_circle.png) + +- 胶囊样式进度条 + >**说明:** + > + >- 头尾两端圆弧处的进度展示效果与ProgressType.Eclipse样式相同; + >- 中段处的进度展示效果为矩形状长条,与ProgressType.Linear线性样式相似; + > + >- 组件高度大于宽度的时候自适应垂直显示。 + + + ```ts + Progress({ value: 10, total: 150, type: ProgressType.Capsule }).width(100).height(50) + Progress({ value: 20, total: 150, type: ProgressType.Capsule }).width(50).height(100).color(Color.Grey) + Progress({ value: 50, total: 150, type: ProgressType.Capsule }).width(50).height(100).backgroundColor(Color.Black) + ``` + + ![progress_captule](figures/progress_captule.png) + + +## 场景示例 + +更新当前进度值,如应用安装进度条。可通过点击Button增加progressValue,.value()属性将progressValue设置给Progress组件,进度条组件即会触发刷新,更新当前进度。 + +```ts +@Entry +@Component +struct ProgressCase1 { + @State progressValue: number = 0 // 设置进度条初始值为0 + build() { + Column() { + Column() { + Progress({value:0, total:100, type:ProgressType.Capsule}).width(200).height(50) + .style({strokeWidth:50}).value(this.progressValue) + Row().width('100%').height(5) + Button("进度条+5") + .onClick(()=>{ + this.progressValue += 5 + if (this.progressValue > 100){ + this.progressValue = 0 + } + }) + } + }.width('100%').height('100%') + } +} +``` + + +![progress](figures/progress.gif) diff --git a/zh-cn/application-dev/ui/arkts-common-components-radio-button.md b/zh-cn/application-dev/ui/arkts-common-components-radio-button.md new file mode 100644 index 0000000000000000000000000000000000000000..e1c4b45dcb936ba274cb6b47ad2c1cb12468e640 --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-common-components-radio-button.md @@ -0,0 +1,106 @@ +# 单选框 + + +Radio是单选框组件,通常用于提供相应的用户交互选择项,同一组的Radio中只有一个可以被选中。具体用法请参考[Radio](../reference/arkui-ts/ts-basic-components-radio.md)。 + + +## 创建单选框 + +Radio通过调用接口来创建,接口调用形式如下: + + +```ts +Radio(options: {value: string, group: string}) +``` + + 该接口用于创建一个单选框,其中value是单选框的名称,group是单选框的所属群组名称。checked属性可以设置单选框的状态,状态分别为false和true时,设置为true时表示单选框被选中。Radio仅支持选中和未选中两种样式,不支持自定义颜色和形状。 + +```ts +Radio({ value: 'Radio1', group: 'radioGroup' }) + .checked(false) +Radio({ value: 'Radio2', group: 'radioGroup' }) + .checked(true) +``` + + +![zh-cn_image_0000001562820821](figures/zh-cn_image_0000001562820821.png) + + +## 添加事件 + +除支持[通用事件](../reference/arkui-ts/ts-universal-events-click.md)外,Radio通常用于选中后触发某些操作,可以绑定onChange事件来响应选中操作后的自定义行为。 + + + +```ts + Radio({ value: 'Radio1', group: 'radioGroup' }) + .onChange((isChecked: boolean) => { + if(isChecked) { + //需要执行的操作 + } + }) + Radio({ value: 'Radio2', group: 'radioGroup' }) + .onChange((isChecked: boolean) => { + if(isChecked) { + //需要执行的操作 + } + }) +``` + + +## 场景示例 + +通过点击Radio切换声音模式。 + + +```ts +// xxx.ets +import promptAction from '@ohos.promptAction'; +@Entry +@Component +struct RadioExample { + build() { + Row() { + Column() { + Radio({ value: 'Radio1', group: 'radioGroup' }).checked(true) + .height(50) + .width(50) + .onChange((isChecked: boolean) => { + if(isChecked) { + // 切换为响铃模式 + promptAction.showToast({ message: 'Ringing mode.' }) + } + }) + Text('Ringing') + } + Column() { + Radio({ value: 'Radio2', group: 'radioGroup' }) + .height(50) + .width(50) + .onChange((isChecked: boolean) => { + if(isChecked) { + // 切换为振动模式 + promptAction.showToast({ message: 'Vibration mode.' }) + } + }) + Text('Vibration') + } + Column() { + Radio({ value: 'Radio3', group: 'radioGroup' }) + .height(50) + .width(50) + .onChange((isChecked: boolean) => { + if(isChecked) { + // 切换为静音模式 + promptAction.showToast({ message: 'Silent mode.' }) + } + }) + Text('Silent') + } + }.height('100%').width('100%').justifyContent(FlexAlign.Center) + } +} +``` + + +![zh-cn_image_0000001562700457](figures/zh-cn_image_0000001562700457.png) diff --git a/zh-cn/application-dev/ui/arkts-common-components-switch.md b/zh-cn/application-dev/ui/arkts-common-components-switch.md new file mode 100644 index 0000000000000000000000000000000000000000..251dfadc90ed9ef70c81f6187c27f7548a690d86 --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-common-components-switch.md @@ -0,0 +1,153 @@ +# 切换按钮 + + +Toggle组件提供状态按钮样式,勾选框样式及开关样式,一般用于两种状态之间的切换。具体用法请参考[Toggle](../reference/arkui-ts/ts-basic-components-toggle.md)。 + + +## 创建切换按钮 + +Toggle通过调用接口来创建,接口调用形式如下: + + + +```ts +Toggle(options: { type: ToggleType, isOn?: boolean }) +``` + + +该接口用于创建切换按钮,其中ToggleType为开关类型,包括Button、Checkbox和Switch,isOn为切换按钮的状态,接口调用有以下两种形式: + + +- 创建不包含子组件的Toogle。 + 当ToggleType为Checkbox或者Switch时,用于创建不包含子组件的Toggle: + + + ```ts + Toggle({ type: ToggleType.Checkbox, isOn: false }) + Toggle({ type: ToggleType.Checkbox, isOn: true }) + ``` + + ![zh-cn_image_0000001562940485](figures/zh-cn_image_0000001562940485.png) + + + ```ts + Toggle({ type: ToggleType.Switch, isOn: false }) + Toggle({ type: ToggleType.Switch, isOn: true }) + ``` + + ![zh-cn_image_0000001511421228](figures/zh-cn_image_0000001511421228.png) + + +- 创建包含子组件的Toggle。 + 当ToggleType为Button时,如果子组件有文本设置,则相应的文本内容会显示在按钮内部。 + + + ```ts + Toggle({ type: ToggleType.Button, isOn: false }) { + Text('status button') + .fontColor('#182431') + .fontSize(12) + }.width(100) + Toggle({ type: ToggleType.Button, isOn: true }) { + Text('status button') + .fontColor('#182431') + .fontSize(12) + }.width(100) + ``` + + ![zh-cn_image_0000001511900404](figures/zh-cn_image_0000001511900404.png) + + +## 自定义样式 + +- 通过selectedColor属性设置Toggle打开选中后的背景颜色。 + + ```ts + Toggle({ type: ToggleType.Button, isOn: true }) { + Text('status button') + .fontColor('#182431') + .fontSize(12) + }.width(100).selectedColor(Color.Pink) + Toggle({ type: ToggleType.Checkbox, isOn: true }) + .selectedColor(Color.Pink) + Toggle({ type: ToggleType.Switch, isOn: true }) + .selectedColor(Color.Pink) + ``` + + ![zh-cn_image_0000001563060657](figures/zh-cn_image_0000001563060657.png) + +- 通过switchPointColor属性设置Switch类型的圆形滑块颜色,仅对type为ToggleType.Switch生效。 + + ```ts + Toggle({ type: ToggleType.Switch, isOn: false }) + .switchPointColor(Color.Pink) + Toggle({ type: ToggleType.Switch, isOn: true }) + .switchPointColor(Color.Pink) + ``` + + ![zh-cn_image_0000001511421232](figures/zh-cn_image_0000001511421232.png) + + +## 添加事件 + +除支持通用事件外,Toggle通常用于选中和取消选中后触发某些操作,可以绑定onChange事件来响应操作后的自定义行为。 + + +```ts +Toggle({ type: ToggleType.Switch, isOn: false }) + .onChange((isOn: boolean) => { + if(isOn) { + // 需要执行的操作 + } + }) +``` + + +## 场景示例 + +Toggle可用于切换蓝牙开关状态。 + + + +```ts +// xxx.ets +import promptAction from '@ohos.promptAction'; +@Entry +@Component +struct ToggleExample { + build() { + Column() { + Row() { + Text("Bluetooth Mode") + .height(50) + .fontSize(16) + } + Row() { + Text("Bluetooth") + .height(50) + .padding({left: 10}) + .fontSize(16) + .textAlign(TextAlign.Start) + .backgroundColor(0xFFFFFF) + Toggle({ type: ToggleType.Switch }) + .margin({left: 200, right: 10}) + .onChange((isOn: boolean) => { + if(isOn) { + promptAction.showToast({ message: 'Bluetooth is on.' }) + } else { + promptAction.showToast({ message: 'Bluetooth is off.' }) + } + }) + } + .backgroundColor(0xFFFFFF) + } + .padding(10) + .backgroundColor(0xDCDCDC) + .width('100%') + .height('100%') + } +} +``` + + +![zh-cn_image_0000001511740448](figures/zh-cn_image_0000001511740448.png) diff --git a/zh-cn/application-dev/ui/arkts-common-components-text-display.md b/zh-cn/application-dev/ui/arkts-common-components-text-display.md new file mode 100644 index 0000000000000000000000000000000000000000..e91fec8627edf96accc4469e5cc796f309d2a8fe --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-common-components-text-display.md @@ -0,0 +1,421 @@ +# 文本显示 + + +Text是文本组件,通常用于展示用户的视图,如显示文章的文字。具体用法可参考[Text](../reference/arkui-ts/ts-basic-components-text.md)。 + + +## 创建文本 + +Text可通过以下两种方式来创建: + + +- string字符串 + + ```ts + Text('我是一段文本') + ``` + + +![zh-cn_image_0000001563060685](figures/zh-cn_image_0000001563060685.png) + + +- 引用Resource资源 + 资源引用类型可以通过$r创建Resource类型对象,文件位置为/resources/base/element/string.json。 + + + ```ts + Text($r('app.string.module_desc')) + .baselineOffset(0) + .fontSize(30) + .border({ width: 1 }) + .padding(10) + .width(300) + ``` + + ![zh-cn_image_0000001511580872](figures/zh-cn_image_0000001511580872.png) + + +## 添加子组件 + +[Span](../reference/arkui-ts/ts-basic-components-span.md)只能作为Text组件的子组件显示文本内容。可以在一个Text内添加多个Span来显示一段信息,例如产品说明书、承诺书等。 + +- 创建Span。 + Span组件需要写到Text组件内,单独写Span组件不会显示信息,Text与Span同时配置文本内容内容时,Span内容覆盖Text内容。 + + + ```ts + Text('我是Text') { + Span('我是Span') + } + .padding(10) + .borderWidth(1) + ``` + + ![zh-cn_image_0000001562700441](figures/zh-cn_image_0000001562700441.png) + +- 设置文本装饰线及颜色。 + 通过decoration设置文本装饰线及颜色。 + + + ```ts + Text() { + Span('我是Span1,').fontSize(16).fontColor(Color.Grey) + .decoration({ type: TextDecorationType.LineThrough, color: Color.Red }) + Span('我是Span2').fontColor(Color.Blue).fontSize(16) + .fontStyle(FontStyle.Italic) + .decoration({ type: TextDecorationType.Underline, color: Color.Black }) + Span(',我是Span3').fontSize(16).fontColor(Color.Grey) + .decoration({ type: TextDecorationType.Overline, color: Color.Green }) + } + .borderWidth(1) + .padding(10) + ``` + + ![zh-cn_image_0000001562700437](figures/zh-cn_image_0000001562700437.png) + +- 通过textCase设置文字一直保持大写或者小写状态。 + + ```ts + Text() { + Span('I am Upper-span').fontSize(12) + .textCase(TextCase.UpperCase) + } + .borderWidth(1) + .padding(10) + ``` + + ![zh-cn_image_0000001562940525](figures/zh-cn_image_0000001562940525.png) + +- 添加事件。 + 由于Span组件无尺寸信息,事件仅支持点击事件onClick。 + + + ```ts + Text() { + Span('I am Upper-span').fontSize(12) + .textCase(TextCase.UpperCase) + .onClick(()=>{ + console.info('我是Span——onClick') + }) + } + ``` + + +## 自定义文本样式 + +- 通过textAlign属性设置文本对齐样式。 + + ```ts + Text('左对齐') + .width(300) + .textAlign(TextAlign.Start) + .border({ width: 1 }) + .padding(10) + Text('中间对齐') + .width(300) + .textAlign(TextAlign.Center) + .border({ width: 1 }) + .padding(10) + Text('右对齐') + .width(300) + .textAlign(TextAlign.End) + .border({ width: 1 }) + .padding(10) + ``` + + ![zh-cn_image_0000001511421260](figures/zh-cn_image_0000001511421260.png) + +- 通过textOverflow属性控制文本超长处理,textOverflow需配合maxLines一起使用(默认情况下文本自动折行)。 + + ```ts + Text('This is the setting of textOverflow to Clip text content This is the setting of textOverflow to None text content. This is the setting of textOverflow to Clip text content This is the setting of textOverflow to None text content.') + .width(250) + .textOverflow({ overflow: TextOverflow.None }) + .maxLines(1) + .fontSize(12) + .border({ width: 1 }).padding(10) + Text('我是超长文本,超出的部分显示省略号。I am an extra long text, with ellipses displayed for any excess。') + .width(250) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .maxLines(1) + .fontSize(12) + .border({ width: 1 }).padding(10) + ``` + + ![zh-cn_image_0000001563060693](figures/zh-cn_image_0000001563060693.png) + + ![zh-cn_image_0000001563060701](figures/zh-cn_image_0000001563060701.png) + +- 通过lineHeight属性设置文本行高。 + + ```ts + Text('This is the text with the line height set. This is the text with the line height set.') + .width(300).fontSize(12).border({ width: 1 }).padding(10) + Text('This is the text with the line height set. This is the text with the line height set.') + .width(300).fontSize(12).border({ width: 1 }).padding(10) + .lineHeight(20) + ``` + + ![zh-cn_image_0000001511740480](figures/zh-cn_image_0000001511740480.png) + +- 通过decoration属性设置文本装饰线样式及其颜色。 + + ```ts + Text('This is the text') + .decoration({ + type: TextDecorationType.LineThrough, + color: Color.Red + }) + .borderWidth(1).padding(10).margin(5) + Text('This is the text') + .decoration({ + type: TextDecorationType.Overline, + color: Color.Red + }) + .borderWidth(1).padding(10).margin(5) + Text('This is the text') + .decoration({ + type: TextDecorationType.Underline, + color: Color.Red + }) + .borderWidth(1).padding(10).margin(5) + ``` + + ![zh-cn_image_0000001511580888](figures/zh-cn_image_0000001511580888.png) + +- 通过baselineOffset属性设置文本基线的偏移量。 + + ```ts + Text('This is the text content with baselineOffset 0.') + .baselineOffset(0) + .fontSize(12) + .border({ width: 1 }) + .padding(10) + .width('100%') + .margin(5) + Text('This is the text content with baselineOffset 30.') + .baselineOffset(30) + .fontSize(12) + .border({ width: 1 }) + .padding(10) + .width('100%') + .margin(5) + + Text('This is the text content with baselineOffset -20.') + .baselineOffset(-20) + .fontSize(12) + .border({ width: 1 }) + .padding(10) + .width('100%') + .margin(5) + ``` + + ![zh-cn_image_0000001562820789](figures/zh-cn_image_0000001562820789.png) + +- 通过letterSpacing属性设置文本字符间距。 + + ```ts + Text('This is the text content with letterSpacing 0.') + .letterSpacing(0) + .fontSize(12) + .border({ width: 1 }) + .padding(10) + .width('100%') + .margin(5) + Text('This is the text content with letterSpacing 3.') + .letterSpacing(3) + .fontSize(12) + .border({ width: 1 }) + .padding(10) + .width('100%') + .margin(5) + Text('This is the text content with letterSpacing -1.') + .letterSpacing(-1) + .fontSize(12) + .border({ width: 1 }) + .padding(10) + .width('100%') + .margin(5) + ``` + + ![zh-cn_image_0000001562940513](figures/zh-cn_image_0000001562940513.png) + +- 通过minFontSize与maxFontSize自适应字体大小,minFontSize设置文本最小显示字号,maxFontSize设置文本最大显示字号,minFontSize与maxFontSize必须搭配同时使用,以及需配合maxline或布局大小限制一起使用,单独设置不生效。 + + ```ts + Text('我的最大字号为30,最小字号为5,宽度为250,maxLines为1') + .width(250) + .maxLines(1) + .maxFontSize(30) + .minFontSize(5) + .border({ width: 1 }) + .padding(10) + .margin(5) + Text('我的最大字号为30,最小字号为5,宽度为250,maxLines为2') + .width(250) + .maxLines(2) + .maxFontSize(30) + .minFontSize(5) + .border({ width: 1 }) + .padding(10) + .margin(5) + Text('我的最大字号为30,最小字号为15,宽度为250,高度为50') + .width(250) + .height(50) + .maxFontSize(30) + .minFontSize(15) + .border({ width: 1 }) + .padding(10) + .margin(5) + Text('我的最大字号为30,最小字号为15,宽度为250,高度为100') + .width(250) + .height(100) + .maxFontSize(30) + .minFontSize(15) + .border({ width: 1 }) + .padding(10) + .margin(5) + ``` + + ![zh-cn_image_0000001511740472](figures/zh-cn_image_0000001511740472.png) + +- 通过textCase属性设置文本大小写。 + + ```ts + Text('This is the text content with textCase set to Normal.') + .textCase(TextCase.Normal) + .padding(10) + .border({ width: 1 }) + .padding(10) + .margin(5) + + // 文本全小写展示 + Text('This is the text content with textCase set to LowerCase.') + .textCase(TextCase.LowerCase) + .border({ width: 1 }) + .padding(10) + .margin(5) + + // 文本全大写展示 + Text('This is the text content with textCase set to UpperCase.') + .textCase(TextCase.UpperCase) + .border({ width: 1 }) + .padding(10) + .margin(5) + ``` + + ![zh-cn_image_0000001562940529](figures/zh-cn_image_0000001562940529.png) + +- 通过copyOption属性设置文本是否可复制粘贴。 + + ```ts + Text("这是一段可复制文本") + .fontSize(30) + .copyOption(CopyOptions.InApp) + ``` + + ![zh-cn_image_0000001511580868](figures/zh-cn_image_0000001511580868.png) + + +## 添加事件 + +Text组件可以添加通用事件,可以绑定onClick、onTouch等事件来响应操作。 + + +```ts +Text('点我') + .onClick(()=>{ + console.info('我是Text的点击响应事件'); + }) +``` + + +## 场景示例 + + +```ts +// xxx.ets +@Entry +@Component +struct TextExample { + build() { + Column() { + Row() { + Text("1").fontSize(14).fontColor(Color.Red).margin({ left: 10, right: 10 }) + Text("我是热搜词条1") + .fontSize(12) + .fontColor(Color.Blue) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + .fontWeight(300) + Text("爆") + .margin({ left: 6 }) + .textAlign(TextAlign.Center) + .fontSize(10) + .fontColor(Color.White) + .fontWeight(600) + .backgroundColor(0x770100) + .borderRadius(5) + .width(15) + .height(14) + }.width('100%').margin(5) + + Row() { + Text("2").fontSize(14).fontColor(Color.Red).margin({ left: 10, right: 10 }) + Text("我是热搜词条2 我是热搜词条2 我是热搜词条2 我是热搜词条2 我是热搜词条2") + .fontSize(12) + .fontColor(Color.Blue) + .fontWeight(300) + .constraintSize({ maxWidth: 200 }) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + Text("热") + .margin({ left: 6 }) + .textAlign(TextAlign.Center) + .fontSize(10) + .fontColor(Color.White) + .fontWeight(600) + .backgroundColor(0xCC5500) + .borderRadius(5) + .width(15) + .height(14) + }.width('100%').margin(5) + + Row() { + Text("3").fontSize(14).fontColor(Color.Orange).margin({ left: 10, right: 10 }) + Text("我是热搜词条3") + .fontSize(12) + .fontColor(Color.Blue) + .fontWeight(300) + .maxLines(1) + .constraintSize({ maxWidth: 200 }) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + Text("热") + .margin({ left: 6 }) + .textAlign(TextAlign.Center) + .fontSize(10) + .fontColor(Color.White) + .fontWeight(600) + .backgroundColor(0xCC5500) + .borderRadius(5) + .width(15) + .height(14) + }.width('100%').margin(5) + + Row() { + Text("4").fontSize(14).fontColor(Color.Grey).margin({ left: 10, right: 10 }) + Text("我是热搜词条4 我是热搜词条4 我是热搜词条4 我是热搜词条4 我是热搜词条4") + .fontSize(12) + .fontColor(Color.Blue) + .fontWeight(300) + .constraintSize({ maxWidth: 200 }) + .maxLines(1) + .textOverflow({ overflow: TextOverflow.Ellipsis }) + }.width('100%').margin(5) + }.width('100%') + } +} + +``` + +![zh-cn_image_0000001562820805](figures/zh-cn_image_0000001562820805.png) diff --git a/zh-cn/application-dev/ui/arkts-common-components-text-input.md b/zh-cn/application-dev/ui/arkts-common-components-text-input.md new file mode 100644 index 0000000000000000000000000000000000000000..ce8e4c1a2267b9eec504972353f0ea1c11dd51b6 --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-common-components-text-input.md @@ -0,0 +1,151 @@ +# 文本输入 + + +TextInput、TextArea是输入框组件,通常用于响应用户的输入操作,比如评论区的输入、聊天框的输入、表格的输入等,也可以结合其它组件构建功能页面,例如登录注册页面。具体用法参考[TextInput](../reference/arkui-ts/ts-basic-components-textinput.md)、[TextArea](../reference/arkui-ts/ts-basic-components-textarea.md)。 + + +## 创建输入框 + +TextInput为单行输入框、TextArea为多行输入框。通过以下接口来创建。 + + +```ts +TextArea(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: TextAreaController}) +``` + + + +```ts +TextInput(value?:{placeholder?: ResourceStr, text?: ResourceStr, controller?: TextInputController}) +``` + + +- 单行输入框 + + ```ts + TextInput() + ``` + + ![zh-cn_image_0000001511580844](figures/zh-cn_image_0000001511580844.png) + + +- 多行输入框 + + ```ts + TextArea() + ``` + + ![zh-cn_image_0000001562940481](figures/zh-cn_image_0000001562940481.png) + + 多行输入框文字超出一行时会自动折行。 + + + ```ts + TextArea({text:"我是TextArea我是TextArea我是TextArea我是TextArea"}).width(300) + ``` + + ![zh-cn_image_0000001511580836](figures/zh-cn_image_0000001511580836.png) + + +## 设置输入框类型 + +TextInput有5种可选类型,分别为Normal基本输入模式、Password密码输入模式、Email邮箱地址输入模式、Number纯数字输入模式、PhoneNumber电话号码输入模式。通过type属性进行设置: + + +- 基本输入模式(默认类型) + + ```ts + TextInput() + .type(InputType.Normal) + ``` + + ![zh-cn_image_0000001562820765](figures/zh-cn_image_0000001562820765.png) + +- 密码输入模式 + + ```ts + TextInput() + .type(InputType.Password) + ``` + + ![zh-cn_image_0000001511580840](figures/zh-cn_image_0000001511580840.png) + + +## 自定义样式 + +- 设置无输入时的提示文本。 + TextInput({placeholder:'我是提示文本'}) + + + ```ts + TextInput({placeholder:'我是提示文本'}) + ``` + + ![zh-cn_image_0000001511900400](figures/zh-cn_image_0000001511900400.png) + + +- 设置输入框当前的文本内容。 + + ```ts + TextInput({placeholder:'我是提示文本',text:'我是当前文本内容'}) + ``` + + ![zh-cn_image_0000001562820761](figures/zh-cn_image_0000001562820761.png) + +- 添加backgroundColor改变输入框的背景颜色。 + + ```ts + TextInput({placeholder:'我是提示文本',text:'我是当前文本内容'}) + .backgroundColor(Color.Pink) + ``` + + ![zh-cn_image_0000001511740444](figures/zh-cn_image_0000001511740444.png) + + 更丰富的样式可以结合[通用属性](../reference/arkui-ts/ts-universal-attributes-size.md)实现。 + + +## 添加事件 + +文本框主要用于获取用户输入的信息,把信息处理成数据进行上传,绑定onChange事件可以获取输入框内改变的内容。用户也可以使用通用事件来进行相应的交互操作。 + + + +```ts +TextInput() + .onChange((value: string) => { + console.info(value); + }) + .onFocus(() => { + console.info('获取焦点'); + }) +``` + + +## 场景示例 + +用于表单的提交,在用户登录/注册页面,用户的登录或注册的输入操作。 + + + +```ts +@Entry +@Component +struct TextInputSample { + build() { + Column() { + TextInput({ placeholder: 'input your username' }).margin({ top: 20 }) + .onSubmit((EnterKeyType)=>{ + console.info(EnterKeyType+'输入法回车键的类型值') + }) + TextInput({ placeholder: 'input your password' }).type(InputType.Password).margin({ top: 20 }) + .onSubmit((EnterKeyType)=>{ + console.info(EnterKeyType+'输入法回车键的类型值') + }) + Button('Sign in').width(150).margin({ top: 20 }) + }.padding(20) + } +} +``` + + +![zh-cn_image_0000001563060653](figures/zh-cn_image_0000001563060653.png) diff --git a/zh-cn/application-dev/ui/arkts-common-components-video-player.md b/zh-cn/application-dev/ui/arkts-common-components-video-player.md new file mode 100644 index 0000000000000000000000000000000000000000..efc9efde21295e8bc414e546df5e4ffc2bd43eee --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-common-components-video-player.md @@ -0,0 +1,247 @@ +# 视频播放 + + +Video组件用于播放视频文件并控制其播放状态,常用于为短视频应用和应用内部视频的列表页面。当视频完整出现时会自动播放,用户点击视频区域则会暂停播放,同时显示播放进度条,通过拖动播放进度条指定视频播放到具体位置。具体用法请参考[Video](../reference/arkui-ts/ts-media-components-video.md)。 + + +## 创建视频组件 + +Video通过调用接口来创建,接口调用形式如下: + + +```ts +Video(value: {src?: string | Resource, currentProgressRate?: number | string | PlaybackSpeed, previewUri?: string | PixelMap | Resource, controller?: VideoController}) +``` + +该接口用于创建视频播放组件。其中,src指定视频播放源的路径,加载方式请参考[加载视频资源](#加载视频资源),currentProgressRate用于设置视频播放倍速,previewUri指定视频未播放时的预览图片路径,controller设置视频控制器,用于自定义控制视频。 + + +## 加载视频资源 + +Video组件支持加载本地视频和网络视频。 + + +### 加载本地视频 + +- 普通本地视频。 + + 加载本地视频时,首先在本地rawfile目录指定对应的文件,如下图所示。 + + ![zh-cn_image_0000001562700409](figures/zh-cn_image_0000001562700409.png) + + 再使用资源访问符$rawfile()引用视频资源。 + + ```ts + @Component + export struct VideoPlayer{ + private controller:VideoController; + private previewUris: Resource = $r ('app.media.preview'); + private innerResource: Resource = $rawfile('videoTest.mp4'); + build(){ + Column() { + Video({ + src: this.innerResource, + previewUri: this.previewUris, + controller: this.controller + }) + } + } + } + ``` + + +- [Data Ability](../application-models/dataability-overview.md)提供的视频路径带有dataability://前缀,使用时确保对应视频资源存在即可。 + + ```ts + @Component + export struct VideoPlayer{ + private controller:VideoController; + private previewUris: Resource = $r ('app.media.preview'); + private videosrc: string= 'dataability://device_id/com.domainname.dataability.videodata/video/10' + build(){ + Column() { + Video({ + src: this.videosrc, + previewUri: this.previewUris, + controller: this.controller + }) + } + } + } + ``` + + +### 加载网络视频 + +加载网络视频时,需要申请权限ohos.permission.INTERNET,具体申请方式请参考[权限申请声明](../security/accesstoken-guidelines.md)。此时,Video的src属性为网络视频的链接。 + + +```ts +@Component +export struct VideoPlayer{ + private controller:VideoController; + private previewUris: Resource = $r ('app.media.preview'); + private videosrc: string= 'https://www.example.com/example.mp4' // 使用时请替换为实际视频加载网址 + build(){ + Column() { + Video({ + src: this.videosrc, + previewUri: this.previewUris, + controller: this.controller + }) + } + } +} +``` + + +## 添加属性 + +Video组件[属性](../reference/arkui-ts/ts-media-components-video.md#属性)主要用于设置视频的播放形式。例如设置视频播放是否静音、播放时是否显示控制条等。 + + +```ts +@Component +export struct VideoPlayer { + private controller: VideoController; + + build() { + Column() { + Video({ + controller: this.controller + }) + .muted(false) //设置是否静音 + .controls(false) //设置是否显示默认控制条 + .autoPlay(false) //设置是否自动播放 + .loop(false) //设置是否循环播放 + .objectFit(ImageFit.Contain) //设置视频适配模式 + } + } +} +``` + + +## 事件调用 + + Video组件回调事件主要为播放开始、暂停结束、播放失败、视频准备和操作进度条等事件,除此之外,Video组件也支持通用事件的调用,如点击、触摸等事件的调用。详细的事件请参考[事件说明](../reference/arkui-ts/ts-media-components-video.md#事件)。 + +```ts +@Entry +@Component +struct VideoPlayer{ + private controller:VideoController; + private previewUris: Resource = $r ('app.media.preview'); + private innerResource: Resource = $rawfile('videoTest.mp4'); + build(){ + Column() { + Video({ + src: this.innerResource, + previewUri: this.previewUris, + controller: this.controller + }) + .onUpdate((event) => { //更新事件回调 + console.info("Video update."); + }) + .onPrepared((event) => { //准备事件回调 + console.info("Video prepared."); + }) + .onError(() => { //失败事件回调 + console.info("Video error."); + }) + } + } +} +``` + + +## Video控制器使用 + +Video控制器主要用于控制视频的状态,包括播放、暂停、停止以及设置进度等,详细的使用请参考[VideoController使用说明](../reference/arkui-ts/ts-media-components-video.md#videocontroller)。 + +- 默认控制器 + + 默认的控制器支持视频的开始、暂停、进度调整、全屏显示四项基本功能。 + + ```ts + @Entry + @Component + struct VideoGuide { + @State videoSrc: Resource = $rawfile('videoTest.mp4') + @State previewUri: string = 'common/videoIcon.png' + @State curRate: PlaybackSpeed = PlaybackSpeed.Speed_Forward_1_00_X + build() { + Row() { + Column() { + Video({ + src: this.videoSrc, + previewUri: this.previewUri, + currentProgressRate: this.curRate + }) + } + .width('100%') + } + .height('100%') + } + } + ``` + +- 自定义控制器 + + 使用自定义的控制器,先将默认控制器关闭掉,之后可以使用button以及slider等组件进行自定义的控制与显示,适合自定义较强的场景下使用。 + + ```ts + @Entry + @Component + struct VideoGuide { + @State videoSrc: Resource = $rawfile('videoTest.mp4') + @State previewUri: string = 'common/videoIcon.png' + @State curRate: PlaybackSpeed = PlaybackSpeed.Speed_Forward_1_00_X + @State isAutoPlay: boolean = false + @State showControls: boolean = true + @State sliderStartTime: string = ''; + @State currentTime: number = 0; + @State durationTime: number = 0; + @State durationStringTime: string =''; + controller: VideoController = new VideoController() + + build() { + Row() { + Column() { + Video({ + src: this.videoSrc, + previewUri: this.previewUri, + currentProgressRate: this.curRate, + controller: this.controller + }).controls(false).autoPlay(true) + .onPrepared((event)=>{ + this.durationTime = event.duration + }) + .onUpdate((event)=>{ + this.currentTime =event.time + }) + Row() { + Text(JSON.stringify(this.currentTime) + 's') + Slider({ + value: this.currentTime, + min: 0, + max: this.durationTime + }) + .onChange((value: number, mode: SliderChangeMode) => { + this.controller.setCurrentTime(value); + }).width("90%") + Text(JSON.stringify(this.durationTime) + 's') + } + .opacity(0.8) + .width("100%") + } + .width('100%') + } + .height('40%') + } + } + ``` + + +## 其他说明 + +Video组件已经封装好了视频播放的基础能力,开发者无需进行视频实例的创建,视频信息的设置获取,只需要设置数据源以及基础信息即可播放视频,相对扩展能力较弱。如果开发者想自定义视频播放,还请参考[媒体系统播放音视频](../media/video-playback.md)。 diff --git a/zh-cn/application-dev/ui/arkts-common-components-xcomponent.md b/zh-cn/application-dev/ui/arkts-common-components-xcomponent.md new file mode 100644 index 0000000000000000000000000000000000000000..b3fb7674e968e5153a9215a62e9357727bed702d --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-common-components-xcomponent.md @@ -0,0 +1,301 @@ +# XComponent + + +[XComponent](../reference/arkui-ts/ts-basic-components-xcomponent.md)组件作为一种绘制组件,通常用于满足开发者较为复杂的自定义绘制需求,例如相机预览流的显示和游戏画面的绘制。 + + +其可通过指定其type字段来实现不同的功能,主要有两个“surface”和“component”字段可供选择。 + + +对于“surface”类型,开发者可将相关数据传入XComponent单独拥有的“surface”来渲染画面。 + + +对于“component”类型则主要用于实现动态加载显示内容的目的。 + + +## surface类型 + +XComponent设置为surface类型时通常用于EGL/OpenGLES和媒体数据写入,并将其显示在XComponent组件上。 + +设置为“surface“类型时XComponent组件可以和其他组件一起进行布局和渲染。 + +同时XComponent又拥有单独的“surface“,可以为开发者在native侧提供native window用来创建EGL/OpenGLES环境,进而使用标准的OpenGL ES开发。 + +除此之外,媒体相关应用(视频、相机等)也可以将相关数据写入XComponent所提供的surface,从而实现呈现相应画面。 + + +## 使用EGL/OpenGLES渲染 + + +### native侧代码开发要点 + +OpenHarmony的应用如果要通过js来桥接native,一般需要使用napi接口来处理js交互,XComponent同样不例外,具体使用请参考[Native API在应用工程中的使用指导](../napi/napi-guidelines.md)。 + +Native侧处理js逻辑的文件类型为so: + +- 每个模块对应一个so + +- so的命名规则为 lib{模块名}.so + + +对于使用XComponent进行标准OpenGL ES开发的场景,CMAKELists.txt文件内容大致如下: + + + +``` +cmake_minimum_required(VERSION 3.4.1) +project(XComponent) # 项目名称 + +set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}) +# 头文件查找路径 +include_directories(${NATIVERENDER_ROOT_PATH} + ${NATIVERENDER_ROOT_PATH}/include + ) + +# 编译目标so,SHARED表示动态库 +add_library(nativerender SHARED + xxx.cpp + ) + +# 查找相关库 (包括OpenGL ES相关库和XComponent提供的ndk接口) +find_library( EGL-lib + EGL ) + +find_library( GLES-lib + GLESv3 ) + +find_library( libace-lib + ace_ndk.z ) + +# 编译so所需要的依赖 +target_link_libraries(nativerender PUBLIC ${EGL-lib} ${GLES-lib} ${libace-lib} libace_napi.z.so libc++.a) +``` + + +### Napi模块注册 + + +```c++ +static napi_value Init(napi_env env, napi_value exports) +{ + // 定义暴露在模块上的方法 + napi_property_descriptor desc[] ={ + DECLARE_NAPI_FUNCTION("changeColor", PluginRender::NapiChangeColor), + }; + // 通过此接口开发者可在exports上挂载native方法(即上面的PluginRender::NapiChangeColor),exports会通过js引擎绑定到js层的一个js对象 + NAPI_CALL(env, napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc)); + return exports; +} + +static napi_module nativerenderModule = { + .nm_version = 1, + .nm_flags = 0, + .nm_filename = nullptr, + .nm_register_func = Init, // 指定加载对应模块时的回调函数 + .nm_modname = "nativerender", // 指定模块名称,对于XComponent相关开发,这个名称必须和ArkTS侧XComponent中libraryname的值保持一致 + .nm_priv = ((void*)0), + .reserved = { 0 }, +}; + +extern "C" __attribute__((constructor)) void RegisterModule(void) +{ + // 注册so模块 + napi_module_register(&nativerenderModule);c +} +``` + + +### 解析XComponent组件的NativeXComponent实例 + +NativeXComponent为XComponent提供了在native层的实例,可作为js层和native层XComponent绑定的桥梁。XComponent所提供的的NDK接口都依赖于该实例。具体NKD接口可参考[Native XComponent](../reference/native-apis/_o_h___native_x_component.md)。 + + +可以在模块被加载时的回调内(即[Napi模块注册](#napi模块注册)中的Init函数)解析获得NativeXComponent实例 + + + +```c++ +{ + // ... + napi_status status; + napi_value exportInstance = nullptr; + OH_NativeXComponent *nativeXComponent = nullptr; + // 用来解析出被wrap了NativeXComponent指针的属性 + status = napi_get_named_property(env, exports, OH_NATIVE_XCOMPONENT_OBJ, &exportInstance); + if (status != napi_ok) { + return false; + } + // 通过napi_unwrap接口,解析出NativeXComponent的实例指针 + status = napi_unwrap(env, exportInstance, reinterpret_cast(&nativeXComponent)); + // ... +} +``` + + +### 注册XComponent事件回调 + +依赖[解析XComponent组件的NativeXComponent实例](#解析xcomponent组件的nativexcomponent实例)拿到的NativeXComponent指针,通过OH_NativeXComponent_RegisterCallback接口进行回调注册 + + + +```c++ +{ + ... + OH_NativeXComponent *nativeXComponent = nullptr; + // 解析出NativeXComponent实例 + + OH_NativeXComponent_Callback callback; + callback->OnSurfaceCreated = OnSurfaceCreatedCB; // surface创建成功后触发,开发者可以从中获取native window的句柄 + callback->OnSurfaceChanged = OnSurfaceChangedCB; // surface发生变化后触发,开发者可以从中获取native window的句柄以及XComponent的变更信息 + callback->OnSurfaceDestroyed = OnSurfaceDestroyedCB; // surface销毁时触发,开发者可以在此释放资源 + callback->DispatchTouchEvent = DispatchTouchEventCB; // XComponent的touch事件回调接口,开发者可以从中获得此次touch事件的信息 + + OH_NativeXComponent_RegisterCallback(nativeXComponent, callback); + ... +} +``` + + +### 创建EGL/OpenGLES环境 + +在注册的OnSurfaceCreated回调中开发者能拿到native window的句柄(其本质就是XComponent所单独拥有的surface),因此可以在这里创建应用自己的EGL/OpenGLES开发环境,由此开始具体渲染逻辑的开发。 + + +```c++ +EGLCore* eglCore_; // EGLCore为封装了OpenGL相关接口的类 +uint64_t width_; +uint64_t height_; +void OnSurfaceCreatedCB(OH_NativeXComponent* component, void* window) +{ + int32_t ret = OH_NativeXComponent_GetXComponentSize(component, window, &width_, &height_); + if (ret === OH_NATIVEXCOMPONENT_RESULT_SUCCESS) { + eglCore_->GLContextInit(window, width_, height_); // 初始化OpenGL环境 + } +} +``` + + +### ArkTS侧语法介绍 + +开发者在ArkTS侧使用如下代码即可用XComponent组件进行利用EGL/OpenGLES渲染的开发。 + + +```ts +XComponent({ id: 'xcomponentId1', type: 'surface', libraryname: 'nativerender' }) + .onLoad((context) => {}) + .onDestroy(() => {}) +``` + +- id : 与XComponent组件为一一对应关系,不可重复。通常开发者可以在native侧通过OH_NativeXComponent_GetXComponentId接口来获取对应的id从而绑定对应的XComponent。 + +- libraryname:加载模块的名称,必须与在native侧Napi模块注册时nm_modname的名字一致。 + + >**说明:** + > + > 应用加载模块实现跨语言调用有两种方式: + > + > 1. 使用NAPI的import方式加载: + > + > ```ts + > import nativerender from "libnativerender.so" + > ``` + > + > 2. 使用XComponent组件加载,本质也是使用了NAPI机制来加载。 + > 该加载方式和import加载方式的区别在于,在加载动态库是会将XComponent的NativeXComponent实例暴露到应用的native层中,从而让开发者可以使用XComponent的NDK接口。 + +- onLoad事件 + - 触发时刻:XComponent准备好surface后触发。 + - 参数context:其上面挂载了暴露在模块上的native方法,使用方法类似于利用 import context2 from "libnativerender.so" 直接加载模块后获得的context2实例。 + - 时序:onLoad事件的触发和Surface相关,其和native侧的OnSurfaceCreated的时序如下图: + + ![图片2](figures/图片2.png) + +- onDestroy事件 + + 触发时刻:XComponent组件被销毁时触发与一般ArkUI的组件销毁时机一致,其和native侧的OnSurfaceDestroyed的时序如下图: + + ![图片3](figures/图片3.png) + + +### 媒体数据写入 + +XComponent所持有的Surface符合“生产者-消费者”模型 + +OpenHarmony上Camera、VideoPlayer等符合生产者设计的部件都可以将数据写入XComponent持有的surface并通过XComponent显示。 + +![图片1](figures/图片1.png) + +开发者可通过绑定XComponentController获得对应XComponent的surfaceId(该id可以唯一确定一个surface),从而传给相应的部件接口。 + + +```ts +@State surfaceId:string = ""; +mXComponentController: XComponentController = new XComponentController(); +XComponent({ id: '', type: 'surface', controller: this.mXComponentController }) + .onLoad(() => { + this.surfaceId = this.mXComponentController.getXComponentSurfaceId() + }) +``` + +具体部件接口可参考:[AVPlayer](../reference/apis/js-apis-media.md#avplayer9)、[Camera](../reference/apis/js-apis-camera.md) 等。 + + +### component类型 + +XComponent设置为component类型时通常用于在XComponent内部执行非UI逻辑以实现动态加载显示内容的目的。 + + +>**说明:** +> +> type为"component"时,XComponent作为容器,子组件沿垂直方向布局: +> +> - 垂直方向上对齐格式:[FlexAlign](../reference/arkui-ts/ts-appendix-enums.md#flexalign).Start +> +> - 水平方向上对齐格式:[FlexAlign](../reference/arkui-ts/ts-appendix-enums.md#flexalign).Center +> +> 不支持所有的事件响应。 +> +> 布局方式更改和事件响应均可通过挂载子组件来设置。 +> +> 内部所写的非UI逻辑需要封装在一个或多个函数内。 + + +### 场景示例 + + +```ts +@Builder +function addText(label: string): void { + Text(label) + .fontSize(40) +} + +@Entry +@Component +struct Index { + @State message: string = 'Hello XComponent' + @State messageCommon: string = 'Hello World' + build() { + Row() { + Column() { + XComponent({ id: 'xcomponentId-container', type: 'component' }) { + addText(this.message) + Divider() + .margin(4) + .strokeWidth(2) + .color('#F1F3F5') + .width("80%") + Column() { + Text(this.messageCommon) + .fontSize(30) + } + } + } + .width('100%') + } + .height('100%') + } +} +``` + +![zh-cn_image_0000001511900428](figures/zh-cn_image_0000001511900428.png) diff --git a/zh-cn/application-dev/ui/arkts-common-events-device-input-event.md b/zh-cn/application-dev/ui/arkts-common-events-device-input-event.md new file mode 100644 index 0000000000000000000000000000000000000000..ad0276b9766be22514f96d99b0fcbd6d14309f8f --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-common-events-device-input-event.md @@ -0,0 +1,375 @@ +# 键鼠事件 + + +键鼠事件指键盘,鼠标外接设备的输入事件。 + + +## 鼠标事件 + +支持的鼠标事件包含通过外设鼠标、触控板触发的事件。 + +鼠标事件可触发以下回调: + +| 名称 | 描述 | +| ---------------------------------------- | ---------------------------------------- | +| onHover(event: (isHover: boolean) => void) | 鼠标进入或退出组件时触发该回调。
isHover:表示鼠标是否悬浮在组件上,鼠标进入时为true, 退出时为false。 | +| onMouse(event: (event?: MouseEvent) => void) | 当前组件被鼠标按键点击时或者鼠标在组件上悬浮移动时,触发该回调,event返回值包含触发事件时的时间戳、鼠标按键、动作、鼠标位置在整个屏幕上的坐标和相对于当前组件的坐标。 | + +当组件绑定onHover回调时,可以通过[hoverEffect](../reference/arkui-ts/ts-universal-attributes-hover-effect.md)属性设置该组件的鼠标悬浮态显示效果。 + + + **图1** 鼠标事件数据流   + + +![zh-cn_image_0000001511900504](figures/zh-cn_image_0000001511900504.png) + + +鼠标事件传递到ArkUI之后,会先判断鼠标事件是否是左键的按下/抬起/移动,然后做出不同响应: + + +- 是:鼠标事件先转换成相同位置的触摸事件,执行触摸事件的碰撞测试、手势判断和回调响应。接着去执行鼠标事件的碰撞测试和回调响应。 + +- 否:事件仅用于执行鼠标事件的碰撞测试和回调响应。 + + +>**说明:** +> +>所有单指可响应的触摸事件/手势事件,均可通过鼠标左键来操作和响应。例如当我们需要开发单击Button跳转页面的功能、且需要支持手指点击和鼠标左键点击,那么只绑定一个点击事件(onClick)就可以实现该效果。若需要针对手指和鼠标左键的点击实现不一样的效果,可以在onClick回调中,使用回调参数中的source字段即可判断出当前触发事件的来源是手指还是鼠标。 + + +### onHover + + +```ts +onHover(event: (isHover?: boolean) => void) +``` + + +鼠标悬浮事件回调。参数isHover类型为boolean,表示鼠标进入组件或离开组件。该事件不支持自定义冒泡设置,默认父子冒泡。 + + +若组件绑定了该接口,当鼠标指针从组件外部进入到该组件的瞬间会触发事件回调,参数isHover等于true;鼠标指针离开组件的瞬间也会触发该事件回调,参数isHover等于false。 + + +>**说明:** +> +>事件冒泡:在一个树形结构中,当子节点处理完一个事件后,再将该事件交给它的父节点处理。 + + + + +```ts +// xxx.ets +@Entry +@Component +struct MouseExample { + @State isHovered: boolean = false; + + build() { + Column() { + Button(this.isHovered ? 'Hovered!' : 'Not Hover') + .width(200).height(100) + .backgroundColor(this.isHovered ? Color.Green : Color.Gray) + .onHover((isHover: boolean) => { // 使用onHover接口监听鼠标是否悬浮在Button组件上 + this.isHovered = isHover; + }) + }.width('100%').height('100%').justifyContent(FlexAlign.Center) + } +} +``` + + +该示例创建了一个Button组件,初始背景色为灰色,内容为“Not Hover”。示例中的Button组件绑定了onHover回调,在该回调中将this.isHovered变量置为回调参数:isHover。 + + +当鼠标从Button外移动到Button内的瞬间,回调响应,isHover值等于true,isHovered的值变为true,将组件的背景色改成Color.Green,内容变为“Hovered!”。 + + +当鼠标从Button内移动到Button外的瞬间,回调响应,isHover值等于false,又将组件变成了初始的样式。 + + +![onHover](figures/onHover.gif) + + +### onMouse + + +```ts +onMouse(event: (event?: MouseEvent) => void) +``` + + +鼠标事件回调。绑定该API的组件每当鼠标指针在该组件内产生行为(MouseAction)时,触发事件回调,参数为[MouseEvent](../reference/arkui-ts/ts-universal-mouse-key.md)对象,表示触发此次的鼠标事件。该事件支持自定义冒泡设置,默认父子冒泡。常见用于开发者自定义的鼠标行为逻辑处理。 + + +开发者可以通过回调中的MouseEvent对象获取触发事件的坐标(screenX/screenY/x/y)、按键([MouseButton](../reference/arkui-ts/ts-appendix-enums.md#mousebutton))、行为([MouseAction](../reference/arkui-ts/ts-appendix-enums.md#mouseaction))、时间戳(timestamp)、交互组件的区域([EventTarget](../reference/arkui-ts/ts-universal-events-click.md))、事件来源([SourceType](../reference/arkui-ts/ts-gesture-settings.md))等。MouseEvent的回调函数stopPropagation用于设置当前事件是否阻止冒泡。 + + +>**说明:** +> +>按键(MouseButton)的值:Left/Right/Middle/Back/Forward 均对应鼠标上的实体按键,当这些按键被按下或松开时触发这些按键的事件。None表示无按键,会出现在鼠标没有按键按下或松开的状态下,移动鼠标所触发的事件中。 + + + +```ts +// xxx.ets +@Entry +@Component +struct MouseExample { + @State isHovered: boolean = false; + @State buttonText: string = ''; + @State columnText: string = ''; + + build() { + Column() { + Button(this.isHovered ? 'Hovered!' : 'Not Hover') + .width(200) + .height(100) + .backgroundColor(this.isHovered ? Color.Green : Color.Gray) + .onHover((isHover: boolean) => { + this.isHovered = isHover + }) + .onMouse((event: MouseEvent) => { // 给Button组件设置onMouse回调 + this.buttonText = 'Button onMouse:\n' + '' + + 'button = ' + event.button + '\n' + + 'action = ' + event.action + '\n' + + 'x,y = (' + event.x + ',' + event.y + ')' + '\n' + + 'screenXY=(' + event.screenX + ',' + event.screenY + ')'; + }) + Divider() + Text(this.buttonText).fontColor(Color.Green) + Divider() + Text(this.columnText).fontColor(Color.Red) + } + .width('100%') + .height('100%') + .justifyContent(FlexAlign.Center) + .borderWidth(2) + .borderColor(Color.Red) + .onMouse((event: MouseEvent) => { // 给Column组件设置onMouse回调 + this.columnText = 'Column onMouse:\n' + '' + + 'button = ' + event.button + '\n' + + 'action = ' + event.action + '\n' + + 'x,y = (' + event.x + ',' + event.y + ')' + '\n' + + 'screenXY=(' + event.screenX + ',' + event.screenY + ')'; + }) + } +} +``` + + +在onHover示例的基础上,给Button绑定onMouse接口。在回调中,打印出鼠标事件的button/action等回调参数值。同时,在外层的Column容器上,也做相同的设置。整个过程可以分为以下两个动作: + + +1. 移动鼠标:当鼠标从Button外部移入Button的过程中,仅触发了Column的onMouse回调;当鼠标移入到Button内部后,由于onMouse事件默认是冒泡的,所以此时会同时响应Column的onMouse回调和Button的onMouse回调。此过程中,由于鼠标仅有移动动作没有点击动作,因此打印信息中的button均为0(MouseButton.None的枚举值)、action均为3(MouseAction.Move的枚举值)。 + +2. 点击鼠标:鼠标进入Button后进行了2次点击,分别是左键点击和右键点击。 + 左键点击时:button = 1(MouseButton.Left的枚举值),按下时 action = 1(MouseAction.Press的枚举值),抬起时 action = 2(MouseAction.Release的枚举值)。 + + 右键点击时:button = 2(MouseButton.Right的枚举值),按下时 action = 1(MouseAction.Press的枚举值),抬起时 action = 2(MouseAction.Release的枚举值)。 + + +![onMouse1](figures/onMouse1.gif) + + +如果需要阻止鼠标事件冒泡,可以通过调用stopPropagation()方法进行设置。 + + + +```ts +Button(this.isHovered ? 'Hovered!' : 'Not Hover') + .width(200) + .height(100) + .backgroundColor(this.isHovered ? Color.Green : Color.Gray) + .onHover((isHover: boolean) => { + this.isHovered = isHover; + }) + .onMouse((event: MouseEvent) => { + event.stopPropagation(); // 在Button的onMouse事件中设置阻止冒泡 + this.buttonText = 'Button onMouse:\n' + '' + + 'button = ' + event.button + '\n' + + 'action = ' + event.action + '\n' + + 'x,y = (' + event.x + ',' + event.y + ')' + '\n' + + 'screenXY=(' + event.screenX + ',' + event.screenY + ')'; + }) +``` + + +在子组件(Button)的onMouse中,通过回调参数event调用stopPropagation回调方法(如下)即可阻止Button子组件的鼠标事件冒泡到父组件Column上。 + + + +```ts +event.stopPropagation() +``` + + +效果是:当鼠标在Button组件上操作时,仅Button的onMouse回调会响应,Column的onMouse回调不会响应。 + + +### hoverEffect + + +```ts +hoverEffect(value: HoverEffect) +``` + + +鼠标悬浮态效果设置的通用属性。参数类型为HoverEffect,HoverEffect提供的Auto、Scale、Highlight效果均为固定效果,开发者无法自定义设置效果参数。 + + + **表1** HoverEffect说明 + +| HoverEffect枚举值 | 效果说明 | +| -------------- | ---------------------------------------- | +| Auto | 组件默认提供的悬浮态效果,由各组件定义。 | +| Scale | 动画播放方式,鼠标悬浮时:组件大小从100%放大至105%,鼠标离开时:组件大小从105%缩小至100%。 | +| Highlight | 动画播放方式,鼠标悬浮时:组件背景色叠加一个5%透明度的白色,视觉效果是组件的原有背景色变暗,鼠标离开时:组件背景色恢复至原有样式。 | +| None | 禁用悬浮态效果 | + + + +```ts +// xxx.ets +@Entry +@Component +struct HoverExample { + build() { + Column({ space: 10 }) { + Button('Auto') + .width(170).height(70) + Button('Scale') + .width(170).height(70) + .hoverEffect(HoverEffect.Scale) + Button('Highlight') + .width(170).height(70) + .hoverEffect(HoverEffect.Highlight) + Button('None') + .width(170).height(70) + .hoverEffect(HoverEffect.None) + }.width('100%').height('100%').justifyContent(FlexAlign.Center) + } +} +``` + + +![hoverEffect](figures/hoverEffect.gif) + + +Button默认的悬浮态效果就是缩放效果,因此Auto和Scale的效果一样,Highlight会使背板颜色变暗,None会禁用悬浮态效果。 + + +## 按键事件 + + **图2** 按键事件数据流   + +![zh-cn_image_0000001511580944](figures/zh-cn_image_0000001511580944.png) + + +按键事件由外设键盘等设备触发,经驱动和多模处理转换后发送给当前获焦的窗口。窗口获取到事件后,会先给输入法分发(输入法会消费按键用作输入),若输入法未消费该按键事件,才会将事件发给ArkUI框架。因此,当某输入框组件获焦,且打开了输入法,此时大部分按键事件均会被输入法消费,例如字母键会被输入法用来往输入框中输入对应字母字符、方向键会被输入法用来切换选中备选词。 + + +按键事件到ArkUI框架之后,会先找到完整的父子节点获焦链。从叶子节点到根节点,逐一发送按键事件。 + + +### onKeyEvent + + +```ts +onKeyEvent(event: (event?: KeyEvent) => void) +``` + + +按键事件回调,当绑定该方法的组件处于[获焦状态](arkts-common-events-focus-event.md)下,外设键盘的按键事件会触发该API的回调响应,回调参数为[KeyEvent](../reference/arkui-ts/ts-universal-events-key.md),可由该参数获得当前按键事件的按键行为([KeyType](../reference/arkui-ts/ts-appendix-enums.md#keytype))、键码([keyCode](../reference/apis/js-apis-keycode.md))、按键英文名称(keyText)、事件来源设备类型([KeySource](../reference/arkui-ts/ts-appendix-enums.md#keysource))、事件来源设备id(deviceId)、元键按压状态(metaKey)、时间戳(timestamp)、阻止冒泡设置(stopPropagation)。 + + + +```ts +// xxx.ets +@Entry +@Component +struct KeyEventExample { + @State buttonText: string = ''; + @State buttonType: string = ''; + @State columnText: string = ''; + @State columnType: string = ''; + + build() { + Column() { + Button('onKeyEvent') + .width(140).height(70) + .onKeyEvent((event: KeyEvent) => { // 给Button设置onKeyEvent事件 + if (event.type === KeyType.Down) { + this.buttonType = 'Down'; + } + if (event.type === KeyType.Up) { + this.buttonType = 'Up'; + } + this.buttonText = 'Button: \n' + + 'KeyType:' + this.buttonType + '\n' + + 'KeyCode:' + event.keyCode + '\n' + + 'KeyText:' + event.keyText; + }) + + Divider() + Text(this.buttonText).fontColor(Color.Green) + + Divider() + Text(this.columnText).fontColor(Color.Red) + }.width('100%').height('100%').justifyContent(FlexAlign.Center) + .onKeyEvent((event: KeyEvent) => { // 给父组件Column设置onKeyEvent事件 + if (event.type === KeyType.Down) { + this.columnType = 'Down'; + } + if (event.type === KeyType.Up) { + this.columnType = 'Up'; + } + this.columnText = 'Column: \n' + + 'KeyType:' + this.buttonType + '\n' + + 'KeyCode:' + event.keyCode + '\n' + + 'KeyText:' + event.keyText; + }) + } +} +``` + + +上述示例中给组件Button和其父容器Column绑定onKeyEvent。应用打开页面加载后,组件树上第一个可获焦的非容器组件自动获焦,该应用只有一个Button组件,因此该组件会自动获焦,由于Button是Column的子节点,Button获焦也同时意味着Column获焦。获焦机制见[焦点事件](arkts-common-events-focus-event.md)。 + + +![zh-cn_image_0000001511421324](figures/zh-cn_image_0000001511421324.gif) + + +打开应用后,依次在键盘上按这些按键:“空格、回车、左Ctrl、左Shift、字母A、字母Z”。 + + +1. 由于onKeyEvent事件默认是冒泡的,所以Button和Column的onKeyEvent都可以响应。 + +2. 每个按键都有2次回调,分别对应KeyType.Down和KeyType.Up,表示按键被按下、然后抬起。 + + +如果要阻止冒泡,即仅Button响应键盘事件,Column不响应,在Button的onKeyEvent回调中加入event.stopPropagation()方法即可,如下: + + + +```ts +Button('onKeyEvent') + .width(140).height(70) + .onKeyEvent((event: KeyEvent) => { + // 通过stopPropagation阻止事件冒泡 + event.stopPropagation(); + if (event.type === KeyType.Down) { + this.buttonType = 'Down'; + } + if (event.type === KeyType.Up) { + this.buttonType = 'Up'; + } + this.buttonText = 'Button: \n' + + 'KeyType:' + this.buttonType + '\n' + + 'KeyCode:' + event.keyCode + '\n' + + 'KeyText:' + event.keyText; +}) +``` + + +![zh-cn_image_0000001511900508](figures/zh-cn_image_0000001511900508.gif) diff --git a/zh-cn/application-dev/ui/arkts-common-events-focus-event.md b/zh-cn/application-dev/ui/arkts-common-events-focus-event.md new file mode 100644 index 0000000000000000000000000000000000000000..75e94b0f315668f54bb76df57a7040354afbb813 --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-common-events-focus-event.md @@ -0,0 +1,1062 @@ +# 焦点事件 + + +## 基本概念 + +- 焦点 + + 指向当前应用界面上唯一的一个可交互元素,当用户使用键盘、电视遥控器、车机摇杆/旋钮等非指向性输入设备与应用程序进行间接交互时,基于焦点的导航和交互是重要的输入手段。 + +- 默认焦点 + + 应用打开或切换页面后,若当前页上存在可获焦的组件,则树形结构的组件树中第一个可获焦的组件默认获得焦点。可以使用[自定义默认焦点](#自定义默认焦点)进行自定义指定。 + +- 获焦 + + 指组件获得了焦点,同一时刻,应用中最多只有1个末端组件是获焦的,且此时它的所有祖宗组件(整个组件链)均是获焦的。当期望某个组件获焦,须确保该组件及其所有的祖宗节点均是可获焦的([focusable](#设置组件是否获焦)属性为true)。 + +- 失焦 + + 指组件从获焦状态变成了非获焦状态,失去了焦点。组件失焦时,它的所有祖宗组件(失焦组件链)与新的获焦组件链不相同的节点都会失焦。 + +- 走焦 + + 表示焦点在当前应用中转移的过程,走焦会带来原焦点组件的失焦和新焦点组件的获焦。应用中焦点发生变化的方式按行为可分为两类: + + - 主动走焦:指开发者/用户主观的行为导致焦点移动,包含:外接键盘上按下TAB/方向键、使用[requestFocus](#focuscontrolrequestfocus)主动给指定组件申请焦点、组件[focusOnTouch](#focusontouch)属性为true后点击组件。 + - 被动走焦:指组件焦点因其他操作被动的转移焦点,此特性为焦点系统默认行为,无法由开发者自由设定,例如当使用if-else语句将处于获焦的组件删除/将处于获焦的组件(或其父组件)置成不可获焦时、当页面切换时。 + +- 焦点态 + + 获焦组件的样式,不同组件的焦点态样式大同小异,默认情况下焦点态不显示,仅使用外接键盘按下TAB键/方向键时才会触发焦点态样式出现。首次触发焦点态显示的TAB键/方向键不会触发走焦。当应用接收到点击事件时(包括手指触屏的按下事件和鼠标左键的按下事件),自动隐藏焦点态样式。焦点态样式由后端组件定义,开发者无法修改。 + + +## 走焦规则 + +走焦规则是指用户使用“TAB键/SHIFT+TAB键/方向键”主动进行走焦,或焦点系统在执行被动走焦时的顺序规则。组件的走焦规则默认由走焦系统定义,由焦点所在的容器决定。 + +- 线性走焦:常见的容器有Flex、Row、Column、List,这些都是典型的单方向容器,组件在这些容器内的排列都是线性的,那么走焦规则也是线性的。走焦的方向和方向键的方向一致。 + + **图1** 线性走焦示意图   + + ![zh-cn_image_0000001562700537](figures/zh-cn_image_0000001562700537.png) + + 例如Row容器,使用方向键左右(←/→)即可将焦点在相邻的2个可获焦组件之间来回切换。 + +- 十字走焦:使用方向键上(↑)下(↓)左(←)右(→)可以使焦点在相邻的组件上切换。典型的是Grid容器,如下图: + + **图2** Grid组件十字走焦示意图   + + ![zh-cn_image_0000001511740580](figures/zh-cn_image_0000001511740580.png) + + >**说明:** + > + > - TAB/SHIFT+TAB键在以上两种走焦规则上的功能和方向键一致。TAB键等同于“先执行方向键右,若无法走焦,再执行方向键下”,SHIFT+TAB键等同于“先执行方向键左,若无法走焦,再执行方向键上”。 + > + > - 触发走焦的按键是按下的事件(DOWN事件)。 + > + > - 删除组件、设置组件无法获焦后,会使用线性走焦规则,自动先往被删除/Unfocusable组件的前置兄弟组件上走焦,无法走焦的话,再忘后置兄弟组件上走焦。 + +- tabIndex走焦:给组件设置[tabIndex](../reference/arkui-ts/ts-universal-attributes-focus.md)通用属性,自定义组件的TAB键/SHIFT+TAB键的走焦顺序。 + +- 区域走焦:给容器组件设置tabIndex通用属性,再结合[groupDefaultFocus](#groupdefaultfocus)通用属性,自定义容器区域的TAB键/SHIFT+TAB键的走焦顺序和默认获焦组件。 + +- 走焦至容器组件规则:当焦点走焦到容器(该容器没有配置groupDefaultFocus)上时,若该容器组件为首次获焦,则会先计算目标容器组件的子组件的区域位置,得到距离目标容器中心点最近的子组件,焦点会走到目标容器上的该子组件上。若该容器非首次获焦,焦点会自动走焦到上一次目标容器中获焦的子组件。 + +- 焦点交互:当某组件获焦时,该组件的固有点击任务或开发者绑定的onClick回调任务,会自动挂载到空格/回车按键上,当按下按键时,任务就和手指/鼠标点击一样被执行。 + + +>**说明:** +> +>本文涉及到的焦点均为组件焦点,另外一个焦点的概念是:窗口焦点,指向当前获焦的窗口。当窗口失焦时,该窗口应用中的所有获焦组件全部失焦。 + + +## 监听组件的焦点变化 + + +```ts +onFocus(event: () => void) +``` + + +获焦事件回调,绑定该API的组件获焦时,回调响应。 + + + +```ts +onBlur(event:() => void) +``` + + +失焦事件回调,绑定该API的组件失焦时,回调响应。 + + +onFocus和onBlur两个接口通常成对使用,来监听组件的焦点变化。 + + +以下示例代码展示获焦/失焦回调的使用方法: + + + +```ts +// xxx.ets +@Entry +@Component +struct FocusEventExample { + @State oneButtonColor: Color = Color.Gray; + @State twoButtonColor: Color = Color.Gray; + @State threeButtonColor: Color = Color.Gray; + + build() { + Column({ space: 20 }) { + // 通过外接键盘的上下键可以让焦点在三个按钮间移动,按钮获焦时颜色变化,失焦时变回原背景色 + Button('First Button') + .width(260) + .height(70) + .backgroundColor(this.oneButtonColor) + .fontColor(Color.Black) + // 监听第一个组件的获焦事件,获焦后改变颜色 + .onFocus(() => { + this.oneButtonColor = Color.Green; + }) + // 监听第一个组件的失焦事件,失焦后改变颜色 + .onBlur(() => { + this.oneButtonColor = Color.Gray; + }) + + Button('Second Button') + .width(260) + .height(70) + .backgroundColor(this.twoButtonColor) + .fontColor(Color.Black) + // 监听第二个组件的获焦事件,获焦后改变颜色 + .onFocus(() => { + this.twoButtonColor = Color.Green; + }) + // 监听第二个组件的失焦事件,失焦后改变颜色 + .onBlur(() => { + this.twoButtonColor = Color.Grey; + }) + + Button('Third Button') + .width(260) + .height(70) + .backgroundColor(this.threeButtonColor) + .fontColor(Color.Black) + // 监听第三个组件的获焦事件,获焦后改变颜色 + .onFocus(() => { + this.threeButtonColor = Color.Green; + }) + // 监听第三个组件的失焦事件,失焦后改变颜色 + .onBlur(() => { + this.threeButtonColor = Color.Gray ; + }) + }.width('100%').margin({ top: 20 }) + } +} +``` + + +![zh-cn_image_0000001511740584](figures/zh-cn_image_0000001511740584.gif) + + +上述示例包含以下4步: + + +1. 应用打开时,“First Button”默认获取焦点,onFocus回调响应,背景色变成绿色。 + +2. 按下TAB键(或方向键下↓),“First Button”显示焦点态样式:组件外围有一个蓝色的闭合框。不触发走焦,焦点仍然在“First Button”上。 + +3. 按下TAB键(或方向键下↓),触发走焦,“Second Button”获焦,onFocus回调响应,背景色变成绿色;“First Button”失焦、onBlur回调响应,背景色变回灰色。 + +4. 按下TAB键(或方向键下↓),触发走焦,“Third Button”获焦,onFocus回调响应,背景色变成绿色;“Second Button”失焦、onBlur回调响应,背景色变回灰色。 + + +## 设置组件是否获焦 + +通过focusable接口设置组件是否可获焦: + + +```ts +focusable(value: boolean) +``` + +按照组件的获焦能力可大致分为三类: + +- 默认可获焦的组件,通常是有交互行为的组件,例如Button、Checkbox,TextInput组件,此类组件无需设置任何属性,默认即可获焦。 + +- 有获焦能力,但默认不可获焦的组件,典型的是Text、Image组件,此类组件缺省情况下无法获焦,若需要使其获焦,可使用通用属性focusable(true)使能。 + +- 无获焦能力的组件,通常是无任何交互行为的展示类组件,例如Blank、Circle组件,此类组件即使使用focusable属性也无法使其可获焦。 + + +>**说明:** +> - focusable为false表示组件不可获焦,同样可以使组件变成不可获焦的还有通用属性[enabled](../reference/arkui-ts/ts-universal-attributes-enable.md)。 +> +> - 当某组件处于获焦状态时,将其的focusable属性或enabled属性设置为false,会自动使该组件失焦,然后焦点按照[走焦规则](#走焦规则)将焦点转移给其他组件。 + + **表1** 基础组件获焦能力 + +| 基础组件 | 是否有获焦能力 | focusable默认值 | 走焦规则 | +| ---------------------------------------- | ------- | ------------ | -------- | +| [AlphabetIndexer](../reference/arkui-ts/ts-container-alphabet-indexer.md) | 是 | true | 线性走焦 | +| [Blank](../reference/arkui-ts/ts-basic-components-blank.md) | 否 | false | / | +| [Button](../reference/arkui-ts/ts-basic-components-button.md) | 是 | true | / | +| [Checkbox](../reference/arkui-ts/ts-basic-components-checkbox.md) | 是 | true | / | +| [CheckboxGroup](../reference/arkui-ts/ts-basic-components-checkboxgroup.md) | 是 | true | / | +| [DataPanel](../reference/arkui-ts/ts-basic-components-datapanel.md) | 否 | false | / | +| [DatePicker](../reference/arkui-ts/ts-basic-components-datepicker.md) | 是 | true | 线性走焦 | +| [Divider](../reference/arkui-ts/ts-basic-components-divider.md) | 否 | false | / | +| [Formcomponent](../reference/arkui-ts/ts-basic-components-formcomponent.md) | 否 | false | / | +| [Gauge](../reference/arkui-ts/ts-basic-components-gauge.md) | 否 | false | / | +| [Image](../reference/arkui-ts/ts-basic-components-image.md) | 是 | false | / | +| [ImageAnimator](../reference/arkui-ts/ts-basic-components-imageanimator.md) | 是 | false | / | +| [LoadingProgress](../reference/arkui-ts/ts-basic-components-loadingprogress.md) | 否 | false | / | +| [Marquee](../reference/arkui-ts/ts-basic-components-marquee.md) | 否 | false | / | +| [Menu](../reference/arkui-ts/ts-basic-components-menu.md) | 是 | true | 线性走焦 | +| [MenuItem](../reference/arkui-ts/ts-basic-components-menuitem.md) | 是 | true | / | +| [MenuItemGroup](../reference/arkui-ts/ts-basic-components-menuitemgroup.md) | 是 | true | 线性走焦 | +| [Navigation](../reference/arkui-ts/ts-basic-components-navigation.md) | 否 | false | 组件自定义 | +| [NavRouter](../reference/arkui-ts/ts-basic-components-navrouter.md) | 否 | false | 跟随子容器 | +| [NavDestination](../reference/arkui-ts/ts-basic-components-navdestination.md) | 否 | false | 线性走焦 | +| [PatternLock](../reference/arkui-ts/ts-basic-components-patternlock.md) | 否 | false | / | +| [PluginComponent](../reference/arkui-ts/ts-basic-components-plugincomponent.md) | 否 | false | / | +| [Progress](../reference/arkui-ts/ts-basic-components-progress.md) | 否 | false | / | +| [QRCode](../reference/arkui-ts/ts-basic-components-qrcode.md) | 否 | false | / | +| [Radio](../reference/arkui-ts/ts-basic-components-radio.md) | 是 | true | / | +| [Rating](../reference/arkui-ts/ts-basic-components-rating.md) | 是 | true | / | +| [RemoteWindow](../reference/arkui-ts/ts-basic-components-remotewindow.md) | 否 | false | / | +| [RichText](../reference/arkui-ts/ts-basic-components-richtext.md) | 否 | false | / | +| [ScrollBar](../reference/arkui-ts/ts-basic-components-scrollbar.md) | 否 | false | / | +| [Search](../reference/arkui-ts/ts-basic-components-search.md) | 是 | true | / | +| [Select](../reference/arkui-ts/ts-basic-components-select.md) | 是 | true | 线性走焦 | +| [Slider](../reference/arkui-ts/ts-basic-components-slider.md) | 是 | true | / | +| [Span](../reference/arkui-ts/ts-basic-components-span.md) | 否 | false | / | +| [Stepper](../reference/arkui-ts/ts-basic-components-stepper.md) | 是 | true | / | +| [StepperItem](../reference/arkui-ts/ts-basic-components-stepperitem.md) | 是 | true | / | +| [Text](../reference/arkui-ts/ts-basic-components-text.md) | 是 | false | / | +| [TextArea](../reference/arkui-ts/ts-basic-components-textarea.md) | 是 | true | / | +| [TextClock](../reference/arkui-ts/ts-basic-components-textclock.md) | 否 | false | / | +| [TextInput](../reference/arkui-ts/ts-basic-components-textinput.md) | 是 | true | / | +| [TextPicker](../reference/arkui-ts/ts-basic-components-textpicker.md) | 是 | true | 线性走焦 | +| [TextTimer](../reference/arkui-ts/ts-basic-components-texttimer.md) | 否 | false | / | +| [TimePicker](../reference/arkui-ts/ts-basic-components-timepicker.md) | 是 | true | 线性走焦 | +| [Toggle](../reference/arkui-ts/ts-basic-components-toggle.md) | 是 | true | / | +| [Web](../reference/arkui-ts/ts-basic-components-web.md) | 是 | true | Web组件自定义 | +| [XComponent](../reference/arkui-ts/ts-basic-components-xcomponent.md) | 否 | false | / | + + **表2** 容器组件获焦能力 + +| 容器组件 | 是否可获焦 | focusable默认值 | 走焦规则 | +| ---------------------------------------- | ----- | ------------ | -------- | +| [AbilityComponent](../reference/arkui-ts/ts-container-ability-component.md) | 否 | false | / | +| [Badge](../reference/arkui-ts/ts-container-badge.md) | 否 | false | / | +| [Column](../reference/arkui-ts/ts-container-column.md) | 是 | true | 线性走焦 | +| [ColumnSplit](../reference/arkui-ts/ts-container-columnsplit.md) | 是 | true | / | +| [Counter](../reference/arkui-ts/ts-container-counter.md) | 是 | true | 线性走焦 | +| [Flex](../reference/arkui-ts/ts-container-flex.md) | 是 | true | 线性走焦 | +| [GridCol](../reference/arkui-ts/ts-container-gridcol.md) | 是 | true | 容器组件自定义 | +| [GridRow](../reference/arkui-ts/ts-container-gridrow.md) | 是 | true | 容器组件自定义 | +| [Grid](../reference/arkui-ts/ts-container-grid.md) | 是 | true | 容器组件自定义 | +| [GridItem](../reference/arkui-ts/ts-container-griditem.md) | 是 | true | 跟随子组件 | +| [List](../reference/arkui-ts/ts-container-list.md) | 是 | true | 线性走焦 | +| [ListItem](../reference/arkui-ts/ts-container-listitem.md) | 是 | true | 跟随子组件 | +| [ListItemGroup](../reference/arkui-ts/ts-container-listitemgroup.md) | 是 | true | 跟随List组件 | +| [Navigator](../reference/arkui-ts/ts-container-navigator.md) | 否 | true | 容器组件自定义 | +| [Panel](../reference/arkui-ts/ts-container-panel.md) | 否 | true | 跟随子组件 | +| [Refresh](../reference/arkui-ts/ts-container-refresh.md) | 否 | false | / | +| [RelativeContainer](../reference/arkui-ts/ts-container-relativecontainer.md) | 否 | true | 容器组件自定义 | +| [Row](../reference/arkui-ts/ts-container-row.md) | 是 | true | 线性走焦 | +| [RowSplit](../reference/arkui-ts/ts-container-rowsplit.md) | 是 | true | / | +| [Scroll](../reference/arkui-ts/ts-container-scroll.md) | 是 | true | 线性走焦 | +| [SideBarContainer](../reference/arkui-ts/ts-container-sidebarcontainer.md) | 是 | true | 线性走焦 | +| [Stack](../reference/arkui-ts/ts-container-stack.md) | 是 | true | 线性走焦 | +| [Swiper](../reference/arkui-ts/ts-container-swiper.md) | 是 | true | 容器组件自定义 | +| [Tabs](../reference/arkui-ts/ts-container-tabs.md) | 是 | true | 容器组件自定义 | +| [TabContent](../reference/arkui-ts/ts-container-tabcontent.md) | 是 | true | 跟随子组件 | + + **表3** 媒体组件获焦能力 + +| 媒体组件 | 是否可获焦 | focusable默认值 | 走焦规则 | +| ---------------------------------------- | ----- | ------------ | ---- | +| [Video](../reference/arkui-ts/ts-media-components-video.md) | 是 | true | / | + + **表4** 画布组件获焦能力 + +| 画布组件 | 是否可获焦 | focusable默认值 | 走焦规则 | +| ---------------------------------------- | ----- | ------------ | ---- | +| [Canvas](../reference/arkui-ts/ts-components-canvas-canvas.md) | 否 | false | / | + + +以下示例为大家展示focusable接口的使用方法: + + + +```ts +// xxx.ets +@Entry +@Component +struct FocusableExample { + @State textFocusable: boolean = true; + @State color1: Color = Color.Yellow; + @State color2: Color = Color.Yellow; + + build() { + Column({ space: 5 }) { + Text('Default Text') // 第一个Text组件未设置focusable属性,默认不可获焦 + .borderColor(this.color1) + .borderWidth(2) + .width(300) + .height(70) + .onFocus(() => { + this.color1 = Color.Blue; + }) + .onBlur(() => { + this.color1 = Color.Yellow; + }) + Divider() + + Text('focusable: ' + this.textFocusable) // 第二个Text设置了focusable属性,初始值为true + .borderColor(this.color2) + .borderWidth(2) + .width(300) + .height(70) + .focusable(this.textFocusable) + .onFocus(() => { + this.color2 = Color.Blue; + }) + .onBlur(() => { + this.color2 = Color.Yellow; + }) + + Divider() + + Row() { + Button('Button1') + .width(140).height(70) + Button('Button2') + .width(160).height(70) + } + + Divider() + Button('Button3') + .width(300).height(70) + + Divider() + }.width('100%').justifyContent(FlexAlign.Center) + .onKeyEvent((e) => { // 绑定onKeyEvent,在该Column组件获焦时,按下'F'键,可将第二个Text的focusable置反 + if (e.keyCode === 2022 && e.type === KeyType.Down) { + this.textFocusable = !this.textFocusable; + } + }) + } +} +``` + + +运行效果: + + +![zh-cn_image_0000001511900540](figures/zh-cn_image_0000001511900540.gif) + + +上述示例包含默认获焦和主动走焦两部分: + + +**默认获焦:** + + +- 根据默认焦点的说明,该应用打开后,默认第一个可获焦元素获焦: + +- 第一个Text组件没有设置focusable(true)属性,该Text组件无法获焦。 + +- 第二个Text组件的focusable属性显式设置为true,说明该组件可获焦,那么默认焦点将置到它身上。 + + +**主动走焦:** + + +按键盘F键,触发onKeyEvent,focusable置为false,Text组件变成不可获焦,焦点自动转移,按照被动走焦中的说明项,焦点会自动从Text组件先向上寻找下一个可获焦组件,由于上一个组件是一个不可获焦的Text,所以向下寻找下一个可获焦的组件,找到并使焦点转移到Row容器上,根据[走焦至容器规则](#走焦规则),计算Button1和Button2的位置,Button2比Button1更大,因此焦点会自动转移到Button2上。 + + +## 自定义默认焦点 + + +```ts +defaultFocus(value: boolean) +``` + +焦点系统在页面初次构建完成时,会搜索当前页下的所有组件,找到第一个绑定了defaultFocus(true)的组件,然后将该组件置为默认焦点,若无任何组件绑定defaultFocus(true),则将第一个找到的可获焦的组件置为默认焦点。 + +以如下应用为例,应用布局如下: + +![zh-cn_image_0000001563060793](figures/zh-cn_image_0000001563060793.png) + +以下是实现该应用的示例代码,且示例代码中没有设置defaultFocus: + + +```ts +// xxx.ets +import promptAction from '@ohos.promptAction'; + +class MyDataSource implements IDataSource { + private list: number[] = []; + private listener: DataChangeListener; + + constructor(list: number[]) { + this.list = list; + } + + totalCount(): number { + return this.list.length; + } + + getData(index: number): any { + return this.list[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + this.listener = listener; + } + + unregisterDataChangeListener() { + } +} + +@Entry +@Component +struct SwiperExample { + private swiperController: SwiperController = new SwiperController() + private data: MyDataSource = new MyDataSource([]) + + aboutToAppear(): void { + let list = [] + for (let i = 1; i <= 4; i++) { + list.push(i.toString()); + } + this.data = new MyDataSource(list); + } + + build() { + Column({ space: 5 }) { + Swiper(this.swiperController) { + LazyForEach(this.data, (item: string) => { + Row({ space: 20 }) { + Column() { + Button('1').width(200).height(200) + .fontSize(40) + .backgroundColor('#dadbd9') + } + + Column({ space: 20 }) { + Row({ space: 20 }) { + Button('2') + .width(100) + .height(100) + .fontSize(40) + .type(ButtonType.Normal) + .borderRadius(20) + .backgroundColor('#dadbd9') + Button('3') + .width(100) + .height(100) + .fontSize(40) + .type(ButtonType.Normal) + .borderRadius(20) + .backgroundColor('#dadbd9') + } + + Row({ space: 20 }) { + Button('4') + .width(100) + .height(100) + .fontSize(40) + .type(ButtonType.Normal) + .borderRadius(20) + .backgroundColor('#dadbd9') + Button('5') + .width(100) + .height(100) + .fontSize(40) + .type(ButtonType.Normal) + .borderRadius(20) + .backgroundColor('#dadbd9') + } + + Row({ space: 20 }) { + Button('6') + .width(100) + .height(100) + .fontSize(40) + .type(ButtonType.Normal) + .borderRadius(20) + .backgroundColor('#dadbd9') + Button('7') + .width(100) + .height(100) + .fontSize(40) + .type(ButtonType.Normal) + .borderRadius(20) + .backgroundColor('#dadbd9') + } + } + } + .width(480) + .height(380) + .justifyContent(FlexAlign.Center) + .borderWidth(2) + .borderColor(Color.Gray) + .backgroundColor(Color.White) + }, item => item) + } + .cachedCount(2) + .index(0) + .interval(4000) + .indicator(true) + .loop(true) + .duration(1000) + .itemSpace(0) + .curve(Curve.Linear) + .onChange((index: number) => { + console.info(index.toString()); + }) + .margin({ left: 20, top: 20, right: 20 }) + + Row({ space: 40 }) { + Button('←') + .fontSize(40) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Black) + .backgroundColor(Color.Transparent) + .onClick(() => { + this.swiperController.showPrevious(); + }) + Button('→') + .fontSize(40) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Black) + .backgroundColor(Color.Transparent) + .onClick(() => { + this.swiperController.showNext(); + }) + } + .width(480) + .height(50) + .justifyContent(FlexAlign.Center) + .borderWidth(2) + .borderColor(Color.Gray) + .backgroundColor('#f7f6dc') + + Row({ space: 40 }) { + Button('Cancel') + .fontSize(30) + .fontColor('#787878') + .type(ButtonType.Normal) + .width(140) + .height(50) + .backgroundColor('#dadbd9') + + Button('OK') + .fontSize(30) + .fontColor('#787878') + .type(ButtonType.Normal) + .width(140) + .height(50) + .backgroundColor('#dadbd9') + .onClick(() => { + promptAction.showToast({ message: 'Button OK on clicked' }); + }) + } + .width(480) + .height(80) + .justifyContent(FlexAlign.Center) + .borderWidth(2) + .borderColor(Color.Gray) + .backgroundColor('#dff2e4') + .margin({ left: 20, bottom: 20, right: 20 }) + }.backgroundColor('#f2f2f2') + .margin({ left: 50, top: 50, right: 20 }) + } +} +``` + + +当前应用上无任何defaultFocus设置,所以第一个可获焦的组件默认获取焦点,按下TAB键/方向键让获焦的组件显示焦点态样式: + + +![zh-cn_image_0000001511421360](figures/zh-cn_image_0000001511421360.gif) + + +假设开发者想让应用打开的时候,无需执行多余的切换焦点操作,直接点击按键的空格/回车键,就可以执行Button-OK的onClick回调操作,那么就可以给这个Button绑定defaultFocus(true),让它成为该页面上的默认焦点: + + + +```ts +Button('OK') + .defaultFocus(true) // 设置Button-OK为defaultFocus + .fontSize(30) + .fontColor('#787878') + .type(ButtonType.Normal) + .width(140).height(50).backgroundColor('#dadbd9') + .onClick(() => { + promptAction.showToast({ message: 'Button OK on clicked' }); + }) +``` + + +![zh-cn_image_0000001562940617](figures/zh-cn_image_0000001562940617.gif) + + +打开应用后按TAB键,Button-OK显示了焦点态,说明默认焦点变更到了Button-OK上。然后按下空格,响应了Button-OK的onClick事件。 + + +## 自定义TAB键走焦顺序 + + +```ts +tabIndex(index: number) +``` + +tabIndex用于设置自定义TAB键走焦顺序,默认值为0。使用“TAB/Shift+TAB键”走焦时(方向键不影响),系统会自动获取到所有配置了tabIndex大于0的组件,然后按照递增/递减排序进行走焦。 + + +以[defaultFocus](#自定义默认焦点)提供的示例为例,默认情况下的走焦顺序如下: + + +![zh-cn_image_0000001511421364](figures/zh-cn_image_0000001511421364.gif) + + +默认的走焦顺序从第一个获焦组件一路走到最后一个获焦组件,会经历Button1->Button4->Button5->Button7->左箭头->右箭头->ButtonOK。这种走焦队列比较完整,遍历了大部分的组件。但缺点是从第一个走到最后一个所经历的路径较长。 + + +如果想实现快速的从第一个走到最后一个,又不想牺牲太多的遍历完整性,就可以使用tabIndex通用属性。 + + +比如:开发者把白色的区域当为一个整体,黄色的区域当为一个整体,绿色的区域当为一个整体,实现Button1->左箭头->ButtonOK这种队列的走焦顺序,只需要在Button1、左箭头、ButtonOK这三个组件上依次增加tabIndex(1)、tabIndex(2)、tabIndex(3)。tabIndex的参数表示TAB走焦的顺序(从大于0的数字开始,从小到大排列)。 + + + +```ts + Button('1').width(200).height(200) + .fontSize(40) + .backgroundColor('#dadbd9') + .tabIndex(1) // Button-1设置为第一个tabIndex节点 +``` + + + +```ts + Button('←') + .fontSize(40) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Black) + .backgroundColor(Color.Transparent) + .onClick(() => { + this.swiperController.showPrevious(); + }) + .tabIndex(2) // Button-左箭头设置为第二个tabIndex节点 +``` + + + +```ts +Button('OK') + .fontSize(30) + .fontColor('#787878') + .type(ButtonType.Normal) + .width(140).height(50).backgroundColor('#dadbd9') + .onClick(() => { + promptAction.showToast({ message: 'Button OK on clicked' }); + }) + .tabIndex(3) // Button-OK设置为第三个tabIndex节点 +``` + + +![zh-cn_image_0000001511580976](figures/zh-cn_image_0000001511580976.gif) + + +>**说明:** +> - 当焦点处于tabIndex(大于0)节点上时,TAB/ShiftTAB会优先在tabIndex(大于0)的队列中寻找后置/前置的节点,存在则走焦至相应的tabIndex节点。若不存在,则使用默认的走焦逻辑继续往后/往前走焦。 +> +> - 当焦点处于tabIndex(等于0)节点上时,TAB/ShiftTAB使用默认的走焦逻辑走焦,走焦的过程中会跳过tabIndex(大于0)和tabIndex(小于0)的节点。 +> +> - 当焦点处于tabIndex(小于0)节点上时,TAB/ShiftTAB无法走焦。 + + +### groupDefaultFocus + + +```ts +groupDefaultFocus(value: boolean) +``` + +[自定义TAB键走焦顺序](#自定义tab键走焦顺序)中所展示的使用tabIndex完成快速走焦的能力有如下问题: + +每个区域(白色/黄色/绿色三个区域)都设置了某个组件为tabIndex节点(白色-Button1、黄色-左箭头、绿色-ButtonOK),但这样设置之后,只能在这3个组件上按TAB/ShiftTab键走焦时会有快速走焦的效果。 + +解决方案是给每个区域的容器设置tabIndex,但是这样设置的问题是:第一次走焦到容器上时,获焦的子组件是默认的第一个可获焦组件,并不是自己想要的组件(Button1、左箭头、ButtonOK)。 + +这样便引入了groupDefaultFocus通用属性,参数:boolean,默认值:false。 + +用法需和tabIndex组合使用,使用tabIndex给区域(容器)绑定走焦顺序,然后给Button1、左箭头、ButtonOK绑定groupDefaultFocus(true),这样在首次走焦到目标区域(容器)上时,它的绑定了groupDefaultFocus(true)的子组件同时获得焦点。 + + +```ts +// xxx.ets +import promptAction from '@ohos.promptAction'; + +class MyDataSource implements IDataSource { + private list: number[] = []; + private listener: DataChangeListener; + + constructor(list: number[]) { + this.list = list; + } + + totalCount(): number { + return this.list.length; + } + + getData(index: number): any { + return this.list[index]; + } + + registerDataChangeListener(listener: DataChangeListener): void { + this.listener = listener; + } + + unregisterDataChangeListener() { + } +} + +@Entry +@Component +struct SwiperExample { + private swiperController: SwiperController = new SwiperController() + private data: MyDataSource = new MyDataSource([]) + + aboutToAppear(): void { + let list = [] + for (let i = 1; i <= 4; i++) { + list.push(i.toString()); + } + this.data = new MyDataSource(list); + } + + build() { + Column({ space: 5 }) { + Swiper(this.swiperController) { + LazyForEach(this.data, (item: string) => { + Row({ space: 20 }) { // 设置该Row组件为tabIndex的第一个节点 + Column() { + Button('1').width(200).height(200) + .fontSize(40) + .backgroundColor('#dadbd9') + .groupDefaultFocus(true) // 设置Button-1为第一个tabIndex的默认焦点 + } + + Column({ space: 20 }) { + Row({ space: 20 }) { + Button('2') + .width(100) + .height(100) + .fontSize(40) + .type(ButtonType.Normal) + .borderRadius(20) + .backgroundColor('#dadbd9') + Button('3') + .width(100) + .height(100) + .fontSize(40) + .type(ButtonType.Normal) + .borderRadius(20) + .backgroundColor('#dadbd9') + } + + Row({ space: 20 }) { + Button('4') + .width(100) + .height(100) + .fontSize(40) + .type(ButtonType.Normal) + .borderRadius(20) + .backgroundColor('#dadbd9') + Button('5') + .width(100) + .height(100) + .fontSize(40) + .type(ButtonType.Normal) + .borderRadius(20) + .backgroundColor('#dadbd9') + } + + Row({ space: 20 }) { + Button('6') + .width(100) + .height(100) + .fontSize(40) + .type(ButtonType.Normal) + .borderRadius(20) + .backgroundColor('#dadbd9') + Button('7') + .width(100) + .height(100) + .fontSize(40) + .type(ButtonType.Normal) + .borderRadius(20) + .backgroundColor('#dadbd9') + } + } + } + .width(480) + .height(380) + .justifyContent(FlexAlign.Center) + .borderWidth(2) + .borderColor(Color.Gray) + .backgroundColor(Color.White) + .tabIndex(1) + }, item => item) + } + .cachedCount(2) + .index(0) + .interval(4000) + .indicator(true) + .loop(true) + .duration(1000) + .itemSpace(0) + .curve(Curve.Linear) + .onChange((index: number) => { + console.info(index.toString()); + }) + .margin({ left: 20, top: 20, right: 20 }) + + Row({ space: 40 }) { // 设置该Row组件为第二个tabIndex节点 + Button('←') + .fontSize(40) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Black) + .backgroundColor(Color.Transparent) + .onClick(() => { + this.swiperController.showPrevious(); + }) + .groupDefaultFocus(true) // 设置Button-左箭头为第二个tabIndex节点的默认焦点 + Button('→') + .fontSize(40) + .fontWeight(FontWeight.Bold) + .fontColor(Color.Black) + .backgroundColor(Color.Transparent) + .onClick(() => { + this.swiperController.showNext(); + }) + } + .width(480) + .height(50) + .justifyContent(FlexAlign.Center) + .borderWidth(2) + .borderColor(Color.Gray) + .backgroundColor('#f7f6dc') + .tabIndex(2) + + Row({ space: 40 }) { // 设置该Row组件为第三个tabIndex节点 + Button('Cancel') + .fontSize(30) + .fontColor('#787878') + .type(ButtonType.Normal) + .width(140) + .height(50) + .backgroundColor('#dadbd9') + + Button('OK') + .fontSize(30) + .fontColor('#787878') + .type(ButtonType.Normal) + .width(140) + .height(50) + .backgroundColor('#dadbd9') + .defaultFocus(true) + .onClick(() => { + promptAction.showToast({ message: 'Button OK on clicked' }); + }) + .groupDefaultFocus(true) // 设置Button-OK为第三个tabIndex节点的默认焦点 + } + .width(480) + .height(80) + .justifyContent(FlexAlign.Center) + .borderWidth(2) + .borderColor(Color.Gray) + .backgroundColor('#dff2e4') + .margin({ left: 20, bottom: 20, right: 20 }) + .tabIndex(3) + }.backgroundColor('#f2f2f2') + .margin({ left: 50, top: 50, right: 20 }) + } +} +``` + +![zh-cn_image_0000001562700533](figures/zh-cn_image_0000001562700533.gif) + + +### focusOnTouch + + +```ts +focusOnTouch(value: boolean) +``` + +点击获焦能力,参数:boolean,默认值:false(输入类组件:TextInput、TextArea、Search、Web默认值是true)。 + +点击是指使用触屏或鼠标左键进行单击,默认为false的组件,例如Button,不绑定该API时,点击Button不会使其获焦,当给Button绑定focusOnTouch(true)时,点击Button会使Button立即获得焦点。 + +给容器绑定focusOnTouch(true)时,点击容器区域,会立即使容器的第一个可获焦组件获得焦点。 + +示例代码: + + +```ts +// requestFocus.ets +import promptAction from '@ohos.promptAction'; + +@Entry +@Component +struct RequestFocusExample { + @State idList: string[] = ['A', 'B', 'C', 'D', 'E', 'F', 'N'] + + build() { + Column({ space:20 }){ + Button("id: " + this.idList[0] + " focusOnTouch(true) + focusable(false)") + .width(400).height(70).fontColor(Color.White).focusOnTouch(true) + .focusable(false) + Button("id: " + this.idList[1] + " default") + .width(400).height(70).fontColor(Color.White) + Button("id: " + this.idList[2] + " focusOnTouch(false)") + .width(400).height(70).fontColor(Color.White).focusOnTouch(false) + Button("id: " + this.idList[3] + " focusOnTouch(true)") + .width(400).height(70).fontColor(Color.White).focusOnTouch(true) + }.width('100%').margin({ top:20 }) + } +} +``` + + +![zh-cn_image_0000001511580980](figures/zh-cn_image_0000001511580980.gif) + + +解读: + + +Button-A虽然设置了focusOnTouch(true),但是同时也设置了focusable(false),该组件无法获焦,因此点击后也无法获焦; + + +Button-B不设置相关属性,点击后不会获焦; + + +Button-C设置了focusOnTouch(false),同Button-B,点击后也不会获焦; + + +Button-D设置了focusOnTouch(true),点击即可使其获焦; + + +>**说明:** +> +>由于焦点态的阐述的特性,焦点态在屏幕接收点击事件后会立即清除。因此该示例代码在每次点击后,需要再次按下TAB键使焦点态再次显示,才可知道当前焦点所在的组件。 + + +### focusControl.requestFocus + + +```ts +focusControl.requestFocus(id: string) +``` + +主动申请焦点能力的全局方法,参数:string,参数表示被申请组件的id(通用属性id设置的字符串)。 + + +使用方法为:在任意执行语句中调用该API,指定目标组件的id为方法参数,当程序执行到该语句时,会立即给指定的目标组件申请焦点。 + + +代码示例: + + + +```ts +// requestFocus.ets +import promptAction from '@ohos.promptAction'; + +@Entry +@Component +struct RequestFocusExample { + @State idList: string[] = ['A', 'B', 'C', 'D', 'E', 'F', 'N'] + @State requestId: number = 0 + + build() { + Column({ space:20 }){ + Row({space: 5}) { + Button("id: " + this.idList[0] + " focusable(false)") + .width(200).height(70).fontColor(Color.White) + .id(this.idList[0]) + .focusable(false) + Button("id: " + this.idList[1]) + .width(200).height(70).fontColor(Color.White) + .id(this.idList[1]) + } + Row({space: 5}) { + Button("id: " + this.idList[2]) + .width(200).height(70).fontColor(Color.White) + .id(this.idList[2]) + Button("id: " + this.idList[3]) + .width(200).height(70).fontColor(Color.White) + .id(this.idList[3]) + } + Row({space: 5}) { + Button("id: " + this.idList[4]) + .width(200).height(70).fontColor(Color.White) + .id(this.idList[4]) + Button("id: " + this.idList[5]) + .width(200).height(70).fontColor(Color.White) + .id(this.idList[5]) + } + }.width('100%').margin({ top:20 }) + .onKeyEvent((e) => { + if (e.keyCode >= 2017 && e.keyCode <= 2022) { + this.requestId = e.keyCode - 2017; + } else if (e.keyCode === 2030) { + this.requestId = 6; + } else { + return; + } + if (e.type !== KeyType.Down) { + return; + } + let res = focusControl.requestFocus(this.idList[this.requestId]); + if (res) { + promptAction.showToast({message: 'Request success'}); + } else { + promptAction.showToast({message: 'Request failed'}); + } + }) + } +} +``` + + +![zh-cn_image_0000001562820905](figures/zh-cn_image_0000001562820905.gif) + + +解读:页面中共6个Button组件,其中Button-A组件设置了focusable(false),表示其不可获焦,在外部容器的onKeyEvent中,监听按键事件,当按下A ~ F按键时,分别去申请Button A ~ F 的焦点,另外按下N键,是给当前页面上不存在的id的组件去申请焦点。 + + +1. 按下TAB键,由于第一个组件Button-A设置了无法获焦,那么默认第二个组件Button-B获焦,Button-B展示焦点态样式; + +2. 键盘上按下A键,申请Button-A的焦点,气泡显示Request failed,表示无法获取到焦点,焦点位置未改变; + +3. 键盘上按下B键,申请Button-B的焦点,气泡显示Request success,表示获焦到了焦点,焦点位置原本就在Button-B,位置未改变; + +4. 键盘上按下C键,申请Button-C的焦点,气泡显示Request success,表示获焦到了焦点,焦点位置从Button-B变更为Button-C; + +5. 键盘上按下D键,申请Button-D的焦点,气泡显示Request success,表示获焦到了焦点,焦点位置从Button-C变更为Button-D; + +6. 键盘上按下E键,申请Button-E的焦点,气泡显示Request success,表示获焦到了焦点,焦点位置从Button-D变更为Button-E; + +7. 键盘上按下F键,申请Button-F的焦点,气泡显示Request success,表示获焦到了焦点,焦点位置从Button-E变更为Button-F; + +8. 键盘上按下N键,申请未知组件的焦点,气泡显示Request failed,表示无法获取到焦点,焦点位置不变; diff --git a/zh-cn/application-dev/ui/arkts-common-events-touch-screen-event.md b/zh-cn/application-dev/ui/arkts-common-events-touch-screen-event.md new file mode 100644 index 0000000000000000000000000000000000000000..0675d83fb4ae6d558b03081a103019aef39e4ec8 --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-common-events-touch-screen-event.md @@ -0,0 +1,315 @@ +# 触屏事件 + + +触屏事件指当手指/手写笔在组件上按下、滑动、抬起时触发的回调事件。包括[点击事件](#点击事件)、[拖拽事件](#拖拽事件)和[触摸事件](#触摸事件)。 + + +**图1** 触摸事件原理 + + +![zh-cn_image_0000001562700461](figures/zh-cn_image_0000001562700461.png) + + +## 点击事件 + +点击事件是指通过手指或手写笔做出一次完整的按下和抬起动作。当发生点击事件时,会触发以下回调函数: + + + +```ts +onClick(event: (event?: ClickEvent) => void) +``` + + +event参数提供点击事件相对于窗口或组件的坐标位置,以及发生点击的事件源。 + + + 例如通过按钮的点击事件控制图片的显示和隐藏。 + +```ts +@Entry +@Component +struct IfElseTransition { + @State flag: boolean = true; + @State btnMsg: string = 'show'; + + build() { + Column() { + Button(this.btnMsg).width(80).height(30).margin(30) + .onClick(() => { + if (this.flag) { + this.btnMsg = 'hide'; + } else { + this.btnMsg = 'show'; + } + // 点击Button控制Image的显示和消失 + this.flag = !this.flag; + }) + if (this.flag) { + Image($r('app.media.icon')).width(200).height(200) + } + }.height('100%').width('100%') + } +} +``` + + +## 拖拽事件 + +拖拽事件指手指/手写笔长按组件(>=500ms),并拖拽到接收区域释放的事件。拖拽事件触发流程: + + +![zh-cn_image_0000001562820825](figures/zh-cn_image_0000001562820825.png) + + +拖拽事件的触发通过长按、拖动平移判定,手指平移的距离达到5vp即可触发拖拽事件。ArkUI支持应用内、跨应用的拖拽事件。 + + +拖拽事件提供以下[接口](../reference/arkui-ts/ts-universal-events-drag-drop.md): + + +| 接口名称 | 描述 | +| ---------------------------------------- | ---------------------------------------- | +| onDragStart(event: (event?: DragEvent, extraParams?: string) => CustomBuilder \| DragItemInfo) | 拖拽启动接口。当前仅支持自定义pixelmap和自定义组件。 | +| onDragEnter(event: (event?: DragEvent, extraParams?: string) => void) | 拖拽进入组件接口。DragEvent定义拖拽发生位置,extraParmas表示用户自定义信息 | +| onDragLeave(event: (event?: DragEvent, extraParams?: string) => void) | 拖拽离开组件接口。DragEvent定义拖拽发生位置,extraParmas表示拖拽事件额外信息。 | +| onDragMove(event: (event?: DragEvent, extraParams?: string) => void) | 拖拽移动接口。DragEvent定义拖拽发生位置,extraParmas表示拖拽事件额外信息。 | +| onDrop(event: (event?: DragEvent, extraParams?: string) => void) | 拖拽释放组件接口。DragEvent定义拖拽发生位置,extraParmas表示拖拽事件额外信息。 | + + +如下是跨窗口拖拽,拖出窗口示例: + + + +```ts +import image from '@ohos.multimedia.image'; + +@Entry +@Component +struct Index { + @State text: string = '' + @State bool1: boolean = false + @State bool2: boolean = false + @State visible: Visibility = Visibility.Visible + @State pixelMap: PixelMap = undefined + private pixelMapReader = undefined + + aboutToAppear() { + console.info('begin to create pixmap has info message: ') + this.createPixelMap() + } + + createPixelMap() { + let color = new ArrayBuffer(4 * 96 * 96); + var buffer = new Uint8Array(color); + for (var i = 0; i < buffer.length; i++) { + buffer[i] = (i + 1) % 255; + } + let opts = { + alphaType: 0, + editable: true, + pixelFormat: 4, + scaleMode: 1, + size: { height: 96, width: 96 } + } + const promise = image.createPixelMap(color, opts); + promise.then((data) => { + console.info('create pixmap has info message: ' + JSON.stringify(data)) + this.pixelMap = data; + this.pixelMapReader = data; + }) + } + + @Builder pixelMapBuilder() { + Text('drag item') + .width('100%') + .height(100) + .fontSize(16) + .textAlign(TextAlign.Center) + .borderRadius(10) + .backgroundColor(0xFFFFFF) + } + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('App1') + .width('40%') + .height(80) + .fontSize(20) + .margin(30) + .textAlign(TextAlign.Center) + .backgroundColor(Color.Pink) + .visibility(Visibility.Visible) + + Text('Across Window Drag This') + .width('80%') + .height(80) + .fontSize(16) + .margin(30) + .textAlign(TextAlign.Center) + .backgroundColor(Color.Pink) + .visibility(this.visible) + .onDragStart(() => { //启动跨窗口拖拽 + console.info('Text onDrag start') + this.bool1 = true + this.text = 'TextDrag' + return { pixelMap: this.pixelMapReader, extraInfo: 'custom extra info.' } + }) + .onDrop((event: DragEvent, extraParams: string) => { + console.info('Text onDragDrop, ') + this.visible = Visibility.None //拖动结束后,使源不可见 + }) + } + + .width('100%') + .height('100%') + } +} +``` + + +跨窗口拖拽,拖入示例: + + + +```ts + +@Entry +@Component +struct Index { + @State number: string[] = ['drag here'] + @State text: string = '' + @State bool1: boolean = false + @State bool2: boolean = false + @State visible: Visibility = Visibility.Visible + @State visible2: Visibility = Visibility.None + scroller: Scroller = new Scroller() + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Text('App2') + .width('40%') + .height(80) + .fontSize(20) + .margin(30) + .textAlign(TextAlign.Center) + .backgroundColor(Color.Pink) + .visibility(Visibility.Visible) + + List({ space: 20, initialIndex: 0 }) { + ForEach(this.number, (item) => { + ListItem() { + Text('' + item) + .width('100%') + .height(80) + .fontSize(16) + .borderRadius(10) + .textAlign(TextAlign.Center) + .backgroundColor(0xFFFFFF) + } + }, item => item) + + ListItem() { + Text('Across Window Drag This') + .width('80%') + .height(80) + .fontSize(16) + .margin(30) + .textAlign(TextAlign.Center) + .backgroundColor(Color.Pink) + .visibility(this.visible2) + } + } + .height('50%') + .width('90%') + .border({ width: 1 }) + .divider({ strokeWidth: 2, color: 0xFFFFFF, startMargin: 20, endMargin: 20 }) + .onDragEnter((event: DragEvent, extraParams: string) => { //拖拽进去组件 + console.info('List onDragEnter, ' + extraParams) + }) + .onDragMove((event: DragEvent, extraParams: string) => { //拖拽时移动 + console.info('List onDragMove, ' + extraParams) + }) + .onDragLeave((event: DragEvent, extraParams: string) => { //拖拽离开组件 + console.info('List onDragLeave, ' + extraParams) + }) + .onDrop((event: DragEvent, extraParams: string) => { //释放组件 + console.info('List onDragDrop, ' + extraParams) + this.visible2 = Visibility.Visible //拖拽完成使拖入目标可见 + }) + } + .width('100%') + .height('100%') + } +} +``` + + +## 触摸事件 + +当手指或手写笔在组件上触碰时,会触发不同动作所对应的事件响应,包括按下(Down)、滑动(Move)、抬起(Up)事件: + + +```ts +onTouch(event: (event?: TouchEvent) => void) +``` + +- event.type为TouchType.Down:表示手指按下。 + +- event.type为TouchType.Up:表示手指抬起。 + +- event.type为TouchType.Move:表示手指按住移动。 + +触摸事件可以同时多指触发,通过event参数可获取触发的手指位置、手指唯一标志、当前发生变化的手指和输入的设备源等信息。 + + +```ts +// xxx.ets +@Entry +@Component +struct TouchExample { + @State text: string = ''; + @State eventType: string = ''; + + build() { + Column() { + Button('Touch').height(40).width(100) + .onTouch((event: TouchEvent) => { + if (event.type === TouchType.Down) { + this.eventType = 'Down'; + } + if (event.type === TouchType.Up) { + this.eventType = 'Up'; + } + if (event.type === TouchType.Move) { + this.eventType = 'Move'; + } + this.text = 'TouchType:' + this.eventType + '\nDistance between touch point and touch element:\nx: ' + + event.touches[0].x + '\n' + 'y: ' + event.touches[0].y + '\nComponent globalPos:(' + + event.target.area.globalPosition.x + ',' + event.target.area.globalPosition.y + ')\nwidth:' + + event.target.area.width + '\nheight:' + event.target.area.height + }) + Button('Touch').height(50).width(200).margin(20) + .onTouch((event: TouchEvent) => { + if (event.type === TouchType.Down) { + this.eventType = 'Down'; + } + if (event.type === TouchType.Up) { + this.eventType = 'Up'; + } + if (event.type === TouchType.Move) { + this.eventType = 'Move'; + } + this.text = 'TouchType:' + this.eventType + '\nDistance between touch point and touch element:\nx: ' + + event.touches[0].x + '\n' + 'y: ' + event.touches[0].y + '\nComponent globalPos:(' + + event.target.area.globalPosition.x + ',' + event.target.area.globalPosition.y + ')\nwidth:' + + event.target.area.width + '\nheight:' + event.target.area.height + }) + Text(this.text) + }.width('100%').padding(30) + } +} +``` + + +![zh-cn_image_0000001511900468](figures/zh-cn_image_0000001511900468.gif) diff --git a/zh-cn/application-dev/ui/arkts-drawing-customization-on-canvas.md b/zh-cn/application-dev/ui/arkts-drawing-customization-on-canvas.md new file mode 100644 index 0000000000000000000000000000000000000000..bad333289f075b3a30510847345f14230a26ee03 --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-drawing-customization-on-canvas.md @@ -0,0 +1,347 @@ +# 使用画布绘制自定义图形 + + +Canvas提供画布组件,用于自定义绘制图形,开发者使用CanvasRenderingContext2D对象和OffscreenCanvasRenderingContext2D对象在Canvas组件上进行绘制,绘制对象可以是基础形状、文本、图片等。 + + +## 使用画布组件绘制自定义图形 + +可以由以下三种形式在画布绘制自定义图形: + + +- 使用[CanvasRenderingContext2D对象](../reference/arkui-ts/ts-canvasrenderingcontext2d.md)在Canvas画布上绘制。 + + ```ts + @Entry + @Component + struct CanvasExample1 { + //用来配置CanvasRenderingContext2D对象的参数,包括是否开启抗锯齿,true表明开启抗锯齿。 + private settings: RenderingContextSettings = new RenderingContextSettings(true) + //用来创建CanvasRenderingContext2D对象,通过在canvas中调用CanvasRenderingContext2D对象来绘制。 + private context: CanvasRenderingContext2D= new CanvasRenderingContext2D(this.settings) + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + //在canvas中调用CanvasRenderingContext2D对象。 + Canvas(this.context) + .width('100%') + .height('100%') + .backgroundColor('#F5DC62') + .onReady(() =>{ + //可以在这里绘制内容。 + this.context.strokeRect(50, 50, 200, 150); + }) + } + .width('100%') + .height('100%') + } + } + + ``` + + ![2023022793003(1)](figures/2023022793003(1).jpg) + +- 离屏绘制是指将需要绘制的内容先绘制在缓存区,再将其转换成图片,一次性绘制到Canvas上,加快了绘制速度。过程为: + 1. 通过transferToImageBitmap方法将离屏画布最近渲染的图像创建为一个ImageBitmap对象。 + 2. 通过CanvasRenderingContext2D对象的transferFromImageBitmap方法显示给定的ImageBitmap对象。 + + 具体使用参考[OffscreenCanvasRenderingContext2D对象](../reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md)。 + + ```ts + @Entry + @Component + struct CanvasExample2 { + //用来配置CanvasRenderingContext2D对象和OffscreenCanvasRenderingContext2D对象的参数,包括是否开启抗锯齿。true表明开启抗锯齿 + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + //用来创建OffscreenCanvasRenderingContext2D对象,width为离屏画布的宽度,height为离屏画布的高度。通过在canvas中调用OffscreenCanvasRenderingContext2D对象来绘制。 + private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings) + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Canvas(this.context) + .width('100%') + .height('100%') + .backgroundColor('#F5DC62') + .onReady(() =>{ + //可以在这里绘制内容 + this.offContext.strokeRect(50, 50, 200, 150); + //将离屏绘值渲染的图像在普通画布上显示 + let image = this.offContext.transferToImageBitmap(); + this.context.transferFromImageBitmap(image); + }) + } + .width('100%') + .height('100%') + } + } + + ``` + + ![2023022793003(1)](figures/2023022793003(1).jpg) + + >**说明:** + > + >在画布组件中,通过CanvasRenderingContext2D对象和OffscreenCanvasRenderingContext2D对象在Canvas组件上进行绘制时调用的接口相同,另接口参数如无特别说明,单位均为vp。 + +- 在Canvas上加载Lottie动画时,需要先按照如下方式下载Lottie。 + + ```ts + import lottie from '@ohos/lottie' + ``` + + 具体接口参考[Lottie](../reference/arkui-ts/ts-components-canvas-lottie.md),相关实例请参考[Lottie实例](https://gitee.com/openharmony/applications_app_samples/tree/master/code/Solutions/Game/Lottie)。 + + >**说明:** + > + >在第一次使用Lottie之前,需要在Terminal窗口运行ohpm install \@ohos/lottieETS命令下载Lottie。 + + +## 初始化画布组件 + +onReady(event: () => void)是Canvas组件初始化完成时的事件回调,调用该事件后,可获取Canvas组件的确定宽高,进一步使用CanvasRenderingContext2D对象和OffscreenCanvasRenderingContext2D对象调用相关API进行图形绘制。 + +```ts +Canvas(this.context) + .width('100%') + .height('100%') + .backgroundColor('#F5DC62') + .onReady(() => { + this.context.fillStyle = '#0097D4'; + this.context.fillRect(50, 50, 100, 100); + }) + +``` + +![2023022793350(1)](figures/2023022793350(1).jpg) + + +## 画布组件绘制方式 + +在Canvas组件生命周期接口onReady()调用之后,开发者可以直接使用canvas组件进行绘制。或者可以脱离Canvas组件和onready生命周期,单独定义Path2d对象构造理想的路径,并在onready调用之后使用Canvas组件进行绘制。 + +- 通过CanvasRenderingContext2D对象和OffscreenCanvasRenderingContext2D对象直接调用相关API进行绘制。 + + ```ts + Canvas(this.context) + .width('100%') + .height('100%') + .backgroundColor('#F5DC62') + .onReady(() =>{ + this.context.beginPath(); + this.context.moveTo(50, 50); + this.context.lineTo(280, 160); + this.context.stroke(); + }) + ``` + + ![2023022793719(1)](figures/2023022793719(1).jpg) + +- 先单独定义path2d对象构造理想的路径,再通过调用CanvasRenderingContext2D对象和OffscreenCanvasRenderingContext2D对象的stroke接口或者fill接口进行绘制,具体使用可以参考[Path2D对象](../reference/arkui-ts/ts-components-canvas-path2d.md)。 + + ```ts + Canvas(this.context) + .width('100%') + .height('100%') + .backgroundColor('#F5DC62') + .onReady(() =>{ + let region = new Path2D(); + region.arc(100, 75, 50, 0, 6.28); + this.context.stroke(region); + }) + ``` + + ![2023022794031(1)](figures/2023022794031(1).jpg) + + +## 画布组件常用方法 + +OffscreenCanvasRenderingContext2D对象和CanvasRenderingContext2D对象提供了大量的属性和方法,可以用来绘制文本、图形,处理像素等,是Canvas组件的核心。常用接口有[fill](../reference/arkui-ts/ts-canvasrenderingcontext2d.md#fill)(对封闭路径进行填充)、[clip](../reference/arkui-ts/ts-canvasrenderingcontext2d.md#clip)(设置当前路径为剪切路径)、[stroke](../reference/arkui-ts/ts-canvasrenderingcontext2d.md#stroke)(进行边框绘制操作)等等,同时提供了[fillStyle](../reference/arkui-ts/ts-canvasrenderingcontext2d.md#fillstyle)(指定绘制的填充色)、[globalAlpha](../reference/arkui-ts/ts-canvasrenderingcontext2d.md#globalalpha)(设置透明度)与[strokeStyle](../reference/arkui-ts/ts-canvasrenderingcontext2d.md#strokestyle)(设置描边的颜色)等属性修改绘制内容的样式。将通过以下几个方面简单介绍画布组件常见使用方法: + +- 基础形状绘制。 + 可以通过[arc](../reference/arkui-ts/ts-canvasrenderingcontext2d.md#arc)(绘制弧线路径)、 [ellipse](../reference/arkui-ts/ts-canvasrenderingcontext2d.md#ellipse)(绘制一个椭圆)、[rect](../reference/arkui-ts/ts-canvasrenderingcontext2d.md#rect)(创建矩形路径)等接口绘制基础形状。 + + ```ts + Canvas(this.context) + .width('100%') + .height('100%') + .backgroundColor('#F5DC62') + .onReady(() =>{ + //绘制矩形 + this.context.beginPath(); + this.context.rect(100, 50, 100, 100); + this.context.stroke(); + //绘制圆形 + this.context.beginPath(); + this.context.arc(150, 250, 50, 0, 6.28); + this.context.stroke(); + //绘制椭圆 + this.context.beginPath(); + this.context.ellipse(150, 450, 50, 100, Math.PI * 0.25, Math.PI * 0, Math.PI * 2); + this.context.stroke(); + }) + + ``` + + ![2023022794521(1)](figures/2023022794521(1).jpg) + +- 文本绘制。 + + 可以通过[fillText](../reference/arkui-ts/ts-canvasrenderingcontext2d.md#filltext)(绘制填充类文本)、[strokeText](../reference/arkui-ts/ts-canvasrenderingcontext2d.md#stroketext)(绘制描边类文本)等接口进行文本绘制。 + + ```ts + Canvas(this.context) + .width('100%') + .height('100%') + .backgroundColor('#F5DC62') + .onReady(() =>{ + //绘制填充类文本 + this.context.font = '50px sans-serif'; + this.context.fillText("Hello World!", 50, 100); + //绘制描边类文本 + this.context.font = '55px sans-serif'; + this.context.strokeText("Hello World!", 50, 150); + }) + ``` + + ![2023022795105(1)](figures/2023022795105(1).jpg) + +- 绘制图片和图像像素信息处理。 + + 可以通过[drawImage](../reference/arkui-ts/ts-canvasrenderingcontext2d.md#drawimage)(图像绘制)、[putImageData](../reference/arkui-ts/ts-canvasrenderingcontext2d.md#putimagedata)(使用[ImageData](../reference/arkui-ts/ts-components-canvas-imagedata.md)数据填充新的矩形区域)等接口绘制图片,通过[createImageData](../reference/arkui-ts/ts-canvasrenderingcontext2d.md#createimagedata)(创建新的ImageData 对象)、[getPixelMap](../reference/arkui-ts/ts-canvasrenderingcontext2d.md#getpixelmap)(以当前canvas指定区域内的像素创建[PixelMap](../reference/apis/js-apis-image.md#pixelmap7)对象)、[getImageData](../reference/arkui-ts/ts-canvasrenderingcontext2d.md#getimagedata)(以当前canvas指定区域内的像素创建ImageData对象)等接口进行图像像素信息处理。 + + ```ts + @Entry + @Component + struct GetImageData { + private settings: RenderingContextSettings = new RenderingContextSettings(true) + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings) + private offContext: OffscreenCanvasRenderingContext2D = new OffscreenCanvasRenderingContext2D(600, 600, this.settings) + private img:ImageBitmap = new ImageBitmap("/common/images/1234.png") + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Canvas(this.context) + .width('100%') + .height('100%') + .backgroundColor('#F5DC62') + .onReady(() =>{ + // 使用drawImage接口将图片画在(0,0)为起点,宽高130的区域 + this.offContext.drawImage(this.img,0,0,130,130); + // 使用getImageData接口,获得canvas组件区域中,(50,50)为起点,宽高130范围内的绘制内容 + let imagedata = this.offContext.getImageData(50,50,130,130); + // 使用putImageData接口将得到的ImageData画在起点为(150, 150)的区域中 + this.offContext.putImageData(imagedata,150,150); + // 将离屏绘制的内容画到canvas组件上 + let image = this.offContext.transferToImageBitmap(); + this.context.transferFromImageBitmap(image); + }) + } + .width('100%') + .height('100%') + } + } + ``` + + ![drawimage](figures/drawimage.PNG) + +- 其他方法。 + + Canvas中还提供其他类型的方法。渐变([CanvasGradient对象](../reference/arkui-ts/ts-components-canvas-canvasgradient.md))相关的方法:[createLinearGradient](../reference/arkui-ts/ts-canvasrenderingcontext2d.md#createlineargradient)(创建一个线性渐变色)、[createRadialGradient](../reference/arkui-ts/ts-canvasrenderingcontext2d.md#createradialgradient)(创建一个径向渐变色)等。 + + ```ts + Canvas(this.context) + .width('100%') + .height('100%') + .backgroundColor('#F5DC62') + .onReady(() =>{ + //创建一个径向渐变色的CanvasGradient对象 + let grad = this.context.createRadialGradient(200,200,50, 200,200,200) + //为CanvasGradient对象设置渐变断点值,包括偏移和颜色 + grad.addColorStop(0.0, '#E87361'); + grad.addColorStop(0.5, '#FFFFF0'); + grad.addColorStop(1.0, '#BDDB69'); + //用CanvasGradient对象填充矩形 + this.context.fillStyle = grad; + this.context.fillRect(0, 0, 400, 400); + }) + ``` + + ![2023022700701(1)](figures/2023022700701(1).jpg) + + +## 场景示例 + +- 规则基础形状绘制。 + + ```ts + @Entry + @Component + struct ClearRect { + private settings: RenderingContextSettings = new RenderingContextSettings(true); + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings); + + build() { + Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { + Canvas(this.context) + .width('100%') + .height('100%') + .backgroundColor('#F5DC62') + .onReady(() =>{ + // 设定填充样式,填充颜色设为蓝色 + this.context.fillStyle = '#0097D4'; + // 以(50, 50)为左上顶点,画一个宽高200的矩形 + this.context.fillRect(50,50,200,200); + // 以(70, 70)为左上顶点,清除宽150高100的区域 + this.context.clearRect(70,70,150,100); + }) + } + .width('100%') + .height('100%') + } + } + + ``` + + ![2023022701120(1)](figures/2023022701120(1).jpg) + +- 不规则图形绘制。 + + ```ts + @Entry + @Component + struct Path2d { + private settings: RenderingContextSettings = new RenderingContextSettings(true); + private context: CanvasRenderingContext2D = new CanvasRenderingContext2D(this.settings); + + build() { + Row() { + Column() { + Canvas(this.context) + .width('100%') + .height('100%') + .backgroundColor('#F5DC62') + .onReady(() =>{ + // 使用Path2D的接口构造一个五边形 + let path = new Path2D(); + path.moveTo(150, 50); + path.lineTo(50, 150); + path.lineTo(100, 250); + path.lineTo(200, 250); + path.lineTo(250, 150); + path.closePath(); + // 设定填充色为蓝色 + this.context.fillStyle = '#0097D4'; + // 使用填充的方式,将Path2D描述的五边形绘制在canvas组件内部 + this.context.fill(path); + }) + } + .width('100%') + } + .height('100%') + } + } + ``` + + ![2023032422159](figures/2023032422159.jpg) + + ​ \ No newline at end of file diff --git a/zh-cn/application-dev/ui/arkts-event-overview.md b/zh-cn/application-dev/ui/arkts-event-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..c3cee4a8467513a08f6fc898770db72dba0839b1 --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-event-overview.md @@ -0,0 +1,23 @@ +# 概述 + + +交互事件按照触发类型来分类,包括触屏事件、键鼠事件和焦点事件。 + + +- [触屏事件](arkts-common-events-touch-screen-event.md):手指或手写笔在触屏上的单指或单笔操作。 + +- [键鼠事件](arkts-common-events-device-input-event.md):包括外设鼠标或触控板的操作事件和外设键盘的按键事件。 + - 鼠标事件是指通过连接和使用外设鼠标/触控板操作时所响应的事件。 + - 按键事件是指通过连接和使用外设键盘操作时所响应的事件。 + +- [焦点事件](arkts-common-events-focus-event.md):通过以上方式控制组件焦点的能力和响应的事件。 + + +手势事件由绑定手势方法和绑定的手势组成,绑定的手势可以分为单一手势和组合手势两种类型,根据手势的复杂程度进行区分。 + + +- [绑定手势方法](arkts-gesture-events-binding.md):用于在组件上绑定单一手势或组合手势,并声明所绑定的手势的响应优先级。 + +- [单一手势](arkts-gesture-events-single-gesture.md):手势的基本单元,是所有复杂手势的组成部分。 + +- [组合手势](arkts-gesture-events-combined-gestures.md):由多个单一手势组合而成,可以根据声明的类型将多个单一手势按照一定规则组合成组合手势,并进行使用。 diff --git a/zh-cn/application-dev/ui/arkts-geometric-shape-drawing.md b/zh-cn/application-dev/ui/arkts-geometric-shape-drawing.md new file mode 100644 index 0000000000000000000000000000000000000000..f665a9dea4de305774169316400025ba3d89bd74 --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-geometric-shape-drawing.md @@ -0,0 +1,288 @@ +# 绘制几何图形 + + +绘制组件用于在页面绘制图形,Shape组件是绘制组件的父组件,父组件中会描述所有绘制组件均支持的通用属性。具体用法请参考[Shape](../reference/arkui-ts/ts-drawing-components-shape.md)。 + + +## 创建绘制组件 + +绘制组件可以由以下两种形式创建: + +- 绘制组件使用Shape作为父组件,实现类似SVG的效果。接口调用为以下形式: + + ```ts + Shape(value?: PixelMap) + ``` + + 该接口用于创建带有父组件的绘制组件,其中value用于设置绘制目标,可将图形绘制在指定的PixelMap对象中,若未设置,则在当前绘制目标中进行绘制。 + + ```ts + Shape() { + Rect().width(300).height(50) + } + ``` + + +- 绘制组件单独使用,用于在页面上绘制指定的图形。有7种绘制类型,分别为[Circle](../reference/arkui-ts/ts-drawing-components-circle.md)(圆形)、[Ellipse](../reference/arkui-ts/ts-drawing-components-ellipse.md)(椭圆形)、[Line](../reference/arkui-ts/ts-drawing-components-line.md)(直线)、[Polyine](../reference/arkui-ts/ts-drawing-components-polyline.md)(折线)、[Polygon](../reference/arkui-ts/ts-drawing-components-polygon.md)(多边形)、[Path](../reference/arkui-ts/ts-drawing-components-path.md)(路径)、[Rect](../reference/arkui-ts/ts-drawing-components-rect.md)(矩形)。以Circle的接口调用为例: + + ```ts + Circle(options?: {width?: string | number, height?: string | number} + ``` + + 该接口用于在页面绘制圆形,其中width用于设置圆形的宽度,height用于设置圆形的高度,圆形直径由宽高最小值确定。 + + ```ts + Circle({ width: 150, height: 150 }) + ``` + + ![创建2](figures/创建2.jpg) + + +## 形状视口viewport + + +```ts +viewPort{ x?: number | string, y?: number | string, width?: number | string, height?: number | string } +``` + +形状视口viewport指定用户空间中的一个矩形,该矩形映射到为关联的 SVG 元素建立的视区边界。viewport属性的值包含x、y、width和height四个可选参数,x 和 y 表示视区的左上角坐标,width和height表示其尺寸。 + +以下3个示例讲解Viewport具体用法: + +- 通过形状视口对图形进行放大与缩小。 + + ```ts + // 画一个宽高都为150的圆 + Text('原始尺寸Circle组件') + Circle({width: 75, height: 75}).fill('#E87361') + + Row({space:10}) { + Column() { + // 创建一个宽高都为150的shape组件,背景色为黄色,一个宽高都为75的viewport。用一个蓝色的矩形来填充viewport,在viewport中绘制一个直径为75的圆。 + // 绘制结束,viewport会根据组件宽高放大两倍 + Text('shape内放大的Circle组件') + Shape() { + Rect().width('100%').height('100%').fill('#0097D4') + Circle({width: 75, height: 75}).fill('#E87361') + } + .viewPort({x: 0, y: 0, width: 75, height: 75}) + .width(150) + .height(150) + .backgroundColor('#F5DC62') + } + Column() { + // 创建一个宽高都为150的shape组件,背景色为黄色,一个宽高都为300的viewport。用一个绿色的矩形来填充viewport,在viewport中绘制一个直径为75的圆。 + // 绘制结束,viewport会根据组件宽高缩小两倍。 + Text('Shape内缩小的Circle组件') + Shape() { + Rect().width('100%').height('100%').fill('#BDDB69') + Circle({width: 75, height: 75}).fill('#E87361') + } + .viewPort({x: 0, y: 0, width: 300, height: 300}) + .width(150) + .height(150) + .backgroundColor('#F5DC62') + } + } + ``` + + ![2023032401632](figures/2023032401632.jpg) + +- 创建一个宽高都为300的shape组件,背景色为黄色,一个宽高都为300的viewport。用一个蓝色的矩形来填充viewport,在viewport中绘制一个半径为75的圆。 + + ```ts + Shape() { + Rect().width("100%").height("100%").fill("#0097D4") + Circle({ width: 150, height: 150 }).fill("#E87361") + } + .viewPort({ x: 0, y: 0, width: 300, height: 300 }) + .width(300) + .height(300) + .backgroundColor("#F5DC62") + ``` + + ![viewport(2)](figures/viewport(2).jpg) + +- 创建一个宽高都为300的shape组件,背景色为黄色,创建一个宽高都为300的viewport。用一个蓝色的矩形来填充viewport,在viewport中绘制一个半径为75的圆,将viewport向右方和下方各平移150。 + + ```ts + Shape() { + Rect().width("100%").height("100%").fill("#0097D4") + Circle({ width: 150, height: 150 }).fill("#E87361") + } + .viewPort({ x: -150, y: -150, width: 300, height: 300 }) + .width(300) + .height(300) + .backgroundColor("#F5DC62") + + ``` + + ![viewport(3)](figures/viewport(3).jpg) + + +## 自定义样式 + +绘制组件支持通过各种属性对组件样式进行更改。 + +- 通过fill可以设置组件填充区域颜色。 + + ```ts + Path() + .width(100) + .height(100) + .commands('M150 0 L300 300 L0 300 Z') + .fill("#E87361") + ``` + + ![2023022792216(1)](figures/2023022792216(1).jpg) + +- 通过stroke可以设置组件边框颜色。 + + ```ts + Path() + .width(100) + .height(100) + .fillOpacity(0) + .commands('M150 0 L300 300 L0 300 Z') + .stroke(Color.Red) + ``` + + ![stroke](figures/stroke.jpg) + +- 通过strokeOpacity可以设置边框透明度。 + + ```ts + Path() + .width(100) + .height(100) + .fillOpacity(0) + .commands('M150 0 L300 300 L0 300 Z') + .stroke(Color.Red) + .strokeWidth(10) + .strokeOpacity(0.2) + ``` + + ![strokeopacity](figures/strokeopacity.jpg) + +- 通过strokeLineJoin可以设置线条拐角绘制样式。拐角绘制样式分为Bevel(使用斜角连接路径段)、Miter(使用尖角连接路径段)、Round(使用圆角连接路径段)。 + + ```ts + Polyline() + .width(100) + .height(100) + .fillOpacity(0) + .stroke(Color.Red) + .strokeWidth(8) + .points([[20, 0], [0, 100], [100, 90]]) + // 设置折线拐角处为圆弧 + .strokeLineJoin(LineJoinStyle.Round) + ``` + + ![strokeLineJoin](figures/strokeLineJoin.jpg) + +- 通过strokeMiterLimit设置斜接长度与边框宽度比值的极限值。 + 斜接长度表示外边框外边交点到内边交点的距离,边框宽度即strokeWidth属性的值。strokeMiterLimit取值需大于等于1,且在strokeLineJoin属性取值LineJoinStyle.Miter时生效。 + + ```ts + Polyline() + .width(100) + .height(100) + .fillOpacity(0) + .stroke(Color.Red) + .strokeWidth(10) + .points([[20, 0], [20, 100], [100, 100]]) + // 设置折线拐角处为尖角 + .strokeLineJoin(LineJoinStyle.Miter) + // 设置斜接长度与线宽的比值 + .strokeMiterLimit(1/Math.sin(45)) + Polyline() + .width(100) + .height(100) + .fillOpacity(0) + .stroke(Color.Red) + .strokeWidth(10) + .points([[20, 0], [20, 100], [100, 100]]) + .strokeLineJoin(LineJoinStyle.Miter) + .strokeMiterLimit(1.42) + ``` + + ![2023032405917](figures/2023032405917.jpg) + +- 通过antiAlias设置是否开启抗锯齿,默认值为true(开启抗锯齿)。 + + ```ts + //开启抗锯齿 + Circle() + .width(150) + .height(200) + .fillOpacity(0) + .strokeWidth(5) + .stroke(Color.Black) + ``` + + ![无标题](figures/无标题.png) + + ```ts + //关闭抗锯齿 + Circle() + .width(150) + .height(200) + .fillOpacity(0) + .strokeWidth(5) + .stroke(Color.Black) + .antiAlias(false) + ``` + + ![2023032411518](figures/2023032411518.jpg) + + +## 场景示例 + +- 在Shape的(-80, -5)点绘制一个封闭路径,填充颜色0x317AF7,线条宽度10,边框颜色红色,拐角样式锐角(默认值)。 + + ```ts + @Entry + @Component + struct ShapeExample { + build() { + Column({ space: 10 }) { + Shape() { + Path().width(200).height(60).commands('M0 0 L400 0 L400 150 Z') + } + .viewPort({ x: -80, y: -5, width: 500, height: 300 }) + .fill(0x317AF7) + .stroke(Color.Red) + .strokeWidth(3) + .strokeLineJoin(LineJoinStyle.Miter) + .strokeMiterLimit(5) + }.width('100%').margin({ top: 15 }) + } + } + ``` + + ![场景1](figures/场景1.jpg) + +- 绘制一个直径为150的圆,和一个直径为150、线条为红色虚线的圆环(宽高设置不一致时以短边为直径)。 + + ```ts + @Entry + @Component + struct CircleExample { + build() { + Column({ space: 10 }) { + //绘制一个直径为150的圆 + Circle({ width: 150, height: 150 }) + //绘制一个直径为150、线条为红色虚线的圆环 + Circle() + .width(150) + .height(200) + .fillOpacity(0) + .strokeWidth(3) + .stroke(Color.Red) + .strokeDashArray([1, 2]) + }.width('100%') + } + } + ``` + + ![场景2](figures/场景2.jpg) diff --git a/zh-cn/application-dev/ui/arkts-gesture-events-binding.md b/zh-cn/application-dev/ui/arkts-gesture-events-binding.md new file mode 100644 index 0000000000000000000000000000000000000000..54a577e7ca62abad6c5e5db46878c60463fb18d9 --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-gesture-events-binding.md @@ -0,0 +1,125 @@ +# 绑定手势方法 + + +通过给各个组件绑定不同的手势事件,并设计事件的响应方式,当手势识别成功时,ArkUI框架将通过事件回调通知组件手势识别的结果。 + + +## gesture(常规手势绑定方法) + + +```ts +.gesture(gesture: GestureType, mask?: GestureMask) +``` + +gesture为通用的一种手势绑定方法,可以将手势绑定到对应的组件上。 + +例如,可以将点击手势TapGesture通过gesture手势绑定方法绑定到Text组件上。 + + +```ts +// xxx.ets +@Entry +@Component +struct Index { + build() { + Column() { + Text('Gesture').fontSize(28) + // 采用gesture手势绑定方法绑定TapGesture + .gesture( + TapGesture() + .onAction(() => { + console.info('TapGesture is onAction'); + })) + } + .height(200) + .width(250) + } +} +``` + + +## priorityGesture(带优先级的手势绑定方法) + + +```ts +.priorityGesture(gesture: GestureType, mask?: GestureMask) +``` + +priorityGesture是带优先级的手势绑定方法,可以在组件上绑定优先识别的手势。 + +在默认情况下,当父组件和子组件使用gesture绑定同类型的手势时,子组件优先识别通过gesture绑定的手势。当父组件使用priorityGesture绑定与子组件同类型的手势时,父组件优先识别通过priorityGesture绑定的手势。 + +例如,当父组件Column和子组件Text同时绑定TapGesture手势时,父组件以带优先级手势priorityGesture的形式进行绑定时,优先响应父组件绑定的TapGesture。 + + + +```ts +// xxx.ets +@Entry +@Component +struct Index { + build() { + Column() { + Text('Gesture').fontSize(28) + .gesture( + TapGesture() + .onAction(() => { + console.info('Text TapGesture is onAction'); + })) + } + .height(200) + .width(250) + // 设置为priorityGesture时,点击文本区域会忽略Text组件的TapGesture手势事件,优先响应父组件Column的TapGesture手势事件 + .priorityGesture( + TapGesture() + .onAction(() => { + console.info('Column TapGesture is onAction'); + }), GestureMask.IgnoreInternal) + } +} +``` + + +## parallelGesture(并行手势绑定方法) + + +```ts +.parallelGesture(gesture: GestureType, mask?: GestureMask) +``` + +parallelGesture是并行的手势绑定方法,可以在父子组件上绑定可以同时响应的相同手势。 + +在默认情况下,手势事件为非冒泡事件,当父子组件绑定相同的手势时,父子组件绑定的手势事件会发生竞争,最多只有一个组件的手势事件能够获得响应。而当父组件绑定了并行手势parallelGesture时,父子组件相同的手势事件都可以触发,实现类似冒泡效果。 + + + +```ts +// xxx.ets +@Entry +@Component +struct Index { + build() { + Column() { + Text('Gesture').fontSize(28) + .gesture( + TapGesture() + .onAction(() => { + console.info('Text TapGesture is onAction'); + })) + } + .height(200) + .width(250) + // 设置为parallelGesture时,点击文本区域会同时响应父组件Column和子组件Text的TapGesture手势事件 + .parallelGesture( + TapGesture() + .onAction(() => { + console.info('Column TapGesture is onAction'); + }), GestureMask.IgnoreInternal) + } +} +``` + + +>**说明:** +> +>当父组件和子组件同时绑定单击手势事件和双击手势事件时,父组件和子组件均只响应单击手势事件。 diff --git a/zh-cn/application-dev/ui/arkts-gesture-events-combined-gestures.md b/zh-cn/application-dev/ui/arkts-gesture-events-combined-gestures.md new file mode 100644 index 0000000000000000000000000000000000000000..0daac802ab62a4411978ce6b39df04560a8af4c3 --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-gesture-events-combined-gestures.md @@ -0,0 +1,202 @@ +# 组合手势 + + +组合手势由多种单一手势组合而成,通过在GestureGroup中使用不同的GestureMode来声明该组合手势的类型,支持[连续识别](#连续识别)、[并行识别](#并行识别)和[互斥识别](#互斥识别)三种类型。 + + + +```ts +GestureGroup(mode:GestureMode, ...gesture:GestureType[]) +``` + + +- mode:必选参数,为GestureMode枚举类。用于声明该组合手势的类型。 + +- gesture:必选参数,为由多个手势组合而成的数组。用于声明组合成该组合手势的各个手势。 + + +## 连续识别 + +连续识别组合手势对应的GestureMode为Sequence。连续识别组合手势将按照手势的注册顺序识别手势,直到所有的手势识别成功。当连续识别组合手势中有一个手势识别失败时,所有的手势识别失败。 + +以一个由长按手势和拖动手势组合而成的连续手势为例: + +在一个Column组件上绑定了translate属性,通过修改该属性可以设置组件的位置移动。然后在该组件上绑定LongPressGesture和PanGesture组合而成的Sequence组合手势。当触发LongPressGesture时,更新显示的数字。当长按后进行拖动时,根据拖动手势的回调函数,实现组件的拖动。 + + + +```ts +// xxx.ets +@Entry +@Component +struct Index { + @State offsetX: number = 0; + @State offsetY: number = 0; + @State count: number = 0; + @State positionX: number = 0; + @State positionY: number = 0; + @State borderStyles: BorderStyle = BorderStyle.Solid + + build() { + Column() { + Text('sequence gesture\n' + 'LongPress onAction:' + this.count + '\nPanGesture offset:\nX: ' + this.offsetX + '\n' + 'Y: ' + this.offsetY) + .fontSize(28) + } + // 绑定translate属性可以实现组件的位置移动 + .translate({ x: this.offsetX, y: this.offsetY, z: 0 }) + .height(250) + .width(300) + //以下组合手势为顺序识别,当长按手势事件未正常触发时不会触发拖动手势事件 + .gesture( + // 声明该组合手势的类型为Sequence类型 + GestureGroup(GestureMode.Sequence, + // 该组合手势第一个触发的手势为长按手势,且长按手势可多次响应 + LongPressGesture({ repeat: true }) + // 当长按手势识别成功,增加Text组件上显示的count次数 + .onAction((event: GestureEvent) => { + if (event.repeat) { + this.count++; + } + console.info('LongPress onAction'); + }) + .onActionEnd(() => { + console.info('LongPress end'); + }), + // 当长按之后进行拖动,PanGesture手势被触发 + PanGesture() + .onActionStart(() => { + this.borderStyles = BorderStyle.Dashed; + console.info('pan start'); + }) + // 当该手势被触发时,根据回调获得拖动的距离,修改该组件的位移距离从而实现组件的移动 + .onActionUpdate((event: GestureEvent) => { + this.offsetX = this.positionX + event.offsetX; + this.offsetY = this.positionY + event.offsetY; + console.info('pan update'); + }) + .onActionEnd(() => { + this.positionX = this.offsetX; + this.positionY = this.offsetY; + this.borderStyles = BorderStyle.Solid; + }) + ) + ) + } +} +``` + + +![sequence](figures/sequence.gif) + + +>**说明:** +> +>拖拽事件是一种典型的连续识别组合手势事件,由长按手势事件和滑动手势事件组合而成。只有先长按达到长按手势事件预设置的时间后进行滑动才会触发拖拽事件。如果长按事件未达到或者长按后未进行滑动,拖拽事件均识别失败。 + + +## 并行识别 + +并行识别组合手势对应的GestureMode为Parallel。并行识别组合手势中注册的手势将同时进行识别,直到所有手势识别结束。并行识别手势组合中的手势进行识别时互不影响。 + +以在一个Column组件上绑定点击手势和双击手势组成的并行识别手势为例,由于单击手势和双击手势是并行识别,因此两个手势可以同时进行识别,二者互不干涉。 + + + +```ts +// xxx.ets +@Entry +@Component +struct Index { + @State count1: number = 0; + @State count2: number = 0; + + build() { + Column() { + Text('parallel gesture\n' + 'tapGesture count is 1:' + this.count1 + '\ntapGesture count is 2:' + this.count2 + '\n') + .fontSize(28) + } + .height(200) + .width(250) + // 以下组合手势为并行并别,单击手势识别成功后,若在规定时间内再次点击,双击手势也会识别成功 + .gesture( + GestureGroup(GestureMode.Parallel, + TapGesture({ count: 1 }) + .onAction(() => { + this.count1++; + }), + TapGesture({ count: 2 }) + .onAction(() => { + this.count2++; + }) + ) + ) + } +} +``` + + +![parallel](figures/parallel.gif) + + +>**说明:** +> +>当由单击手势和双击手势组成一个并行识别组合手势后,在区域内进行点击时,单击手势和双击手势将同时进行识别。 +> +>当只有单次点击时,单击手势识别成功,双击手势识别失败。 +> +>当有两次点击时,若两次点击相距时间在规定时间内(默认规定时间为300毫秒),触发两次单击事件和一次双击事件。 +> +>当有两次点击时,若两次点击相距时间超出规定时间,触发两次单击事件不触发双击事件。 + + +## 互斥识别 + +互斥识别组合手势对应的GestureMode为Exclusive。互斥识别组合手势中注册的手势将同时进行识别,若有一个手势识别成功,则结束手势识别,其他所有手势识别失败。 + +以在一个Column组件上绑定单击手势和双击手势组合而成的互斥识别组合手势为例,由于单击手势只需要一次点击即可触发而双击手势需要两次,每次的点击事件均被单击手势消费而不能积累成双击手势,所以双击手势无法触发。 + + + +```ts +// xxx.ets +@Entry +@Component +struct Index { + @State count1: number = 0; + @State count2: number = 0; + + build() { + Column() { + Text('parallel gesture\n' + 'tapGesture count is 1:' + this.count1 + '\ntapGesture count is 2:' + this.count2 + '\n') + .fontSize(28) + } + .height(200) + .width(250) + //以下组合手势为互斥并别,单击手势识别成功后,双击手势会识别失败 + .gesture( + GestureGroup(GestureMode.Exclusive, + TapGesture({ count: 1 }) + .onAction(() => { + this.count1++; + }), + TapGesture({ count: 2 }) + .onAction(() => { + this.count2++; + }) + ) + ) + } +} +``` + + +![exclusive](figures/exclusive.gif) + + +>**说明:** +> +>当由单击手势和双击手势组成一个互斥识别组合手势后,在区域内进行点击时,单击手势和双击手势将同时进行识别。 +> +>当只有单次点击时,单击手势识别成功,双击手势识别失败。 +> +>当有两次点击时,单击手势在第一次点击时即宣告识别成功,此时双击手势已经失败。即使在规定时间内进行了第二次点击,双击手势事件也不会进行响应,此时会触发单击手势事件的第二次识别成功。 diff --git a/zh-cn/application-dev/ui/arkts-gesture-events-single-gesture.md b/zh-cn/application-dev/ui/arkts-gesture-events-single-gesture.md new file mode 100644 index 0000000000000000000000000000000000000000..2e270b42c716f67f30fabc4dbcf4c905e70f663e --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-gesture-events-single-gesture.md @@ -0,0 +1,377 @@ +# 单一手势 + + +## 点击手势(TapGesture) + + +```ts +TapGesture(value?:{count?:number; fingers?:number}) +``` + + +点击手势支持单次点击和多次点击,拥有两个可选参数: + + +- count:非必填参数,声明该点击手势识别的连续点击次数。默认值为1,若设置小于1的非法值会被转化为默认值。如果配置多次点击,上一次抬起和下一次按下的超时时间为300毫秒。 + +- fingers:非必填参数,用于声明触发点击的手指数量,最小值为1,最大值为10,默认值为1。当配置多指时,若第一根手指按下300毫秒内未有足够的手指数按下则手势识别失败。当实际点击手指数超过配置值时,手势识别失败。 + 以在Text组件上绑定双击手势(count值为2的点击手势)为例: + + ```ts + // xxx.ets + @Entry + @Component + struct Index { + @State value: string = ""; + + build() { + Column() { + Text('Click twice').fontSize(28) + .gesture( + // 绑定count为2的TapGesture + TapGesture({ count: 2 }) + .onAction((event: GestureEvent) => { + this.value = JSON.stringify(event.fingerList[0]); + })) + Text(this.value) + } + .height(200) + .width(250) + .padding(20) + .border({ width: 3 }) + .margin(30) + } + } + ``` + + ![tap](figures/tap.gif) + + +## 长按手势(LongPressGesture) + + +```ts +LongPressGesture(value?:{fingers?:number; repeat?:boolean; duration?:number}) +``` + + +长按手势用于触发长按手势事件,触发长按手势的最少手指数量为1,最短长按事件为500毫秒,拥有三个可选参数: + + +- fingers:非必选参数,用于声明触发长按手势所需要的最少手指数量,最小值为1,最大值为10,默认值为1。 + +- repeat:非必选参数,用于声明是否连续触发事件回调,默认值为false。 + +- duration:非必选参数,用于声明触发长按所需的最短时间,单位为毫秒,默认值为500。 + + +以在Text组件上绑定可以重复触发的长按手势为例: + + + +```ts +// xxx.ets +@Entry +@Component +struct Index { + @State count: number = 0; + + build() { + Column() { + Text('LongPress OnAction:' + this.count).fontSize(28) + .gesture( + // 绑定可以重复触发的LongPressGesture + LongPressGesture({ repeat: true }) + .onAction((event: GestureEvent) => { + if (event.repeat) { + this.count++; + } + }) + .onActionEnd(() => { + this.count = 0; + }) + ) + } + .height(200) + .width(250) + .padding(20) + .border({ width: 3 }) + .margin(30) + } +} +``` + + +![longPress](figures/longPress.gif) + + +## 拖动手势(PanGesture) + + +```ts +PanGestureOptions(value?:{ fingers?:number; direction?:PanDirection; distance?:number}) +``` + + +拖动手势用于触发拖动手势事件,滑动达到最小滑动距离(默认值为5vp)时拖动手势识别成功,拥有三个可选参数: + + +- fingers:非必选参数,用于声明触发拖动手势所需要的最少手指数量,最小值为1,最大值为10,默认值为1。 + +- direction:非必选参数,用于声明触发拖动的手势方向,此枚举值支持逻辑与(&)和逻辑或(|)运算。默认值为Pandirection.All。 + +- distance:非必选参数,用于声明触发拖动的最小拖动识别距离,单位为vp,默认值为5。 + + +以在Text组件上绑定拖动手势为例,可以通过在拖动手势的回调函数中修改组件的布局位置信息来实现组件的拖动: + + + +```ts +// xxx.ets +@Entry +@Component +struct Index { + @State offsetX: number = 0; + @State offsetY: number = 0; + @State positionX: number = 0; + @State positionY: number = 0; + + build() { + Column() { + Text('PanGesture Offset:\nX: ' + this.offsetX + '\n' + 'Y: ' + this.offsetY) + .fontSize(28) + .height(200) + .width(300) + .padding(20) + .border({ width: 3 }) + // 在组件上绑定布局位置信息 + .translate({ x: this.offsetX, y: this.offsetY, z: 0 }) + .gesture( + // 绑定拖动手势 + PanGesture() + .onActionStart((event: GestureEvent) => { + console.info('Pan start'); + }) + // 当触发拖动手势时,根据回调函数修改组件的布局位置信息 + .onActionUpdate((event: GestureEvent) => { + this.offsetX = this.positionX + event.offsetX; + this.offsetY = this.positionY + event.offsetY; + }) + .onActionEnd(() => { + this.positionX = this.offsetX; + this.positionY = this.offsetY; + }) + ) + } + .height(200) + .width(250) + } +} +``` + + +![pan](figures/pan.gif) + + +>**说明:** +> +>大部分可滑动组件,如List、Grid、Scroll、Tab等组件是通过PanGesture实现滑动,在组件内部的子组件绑定[拖动手势(PanGesture)](#拖动手势pangesture)或者[滑动手势(SwipeGesture)](#滑动手势swipegesture)会导致手势竞争。 +> +>当在子组件绑定PanGesture时,在子组件区域进行滑动仅触发子组件的PanGesture。如果需要父组件响应,需要通过修改手势绑定方法或者子组件向父组件传递消息进行实现,或者通过修改父子组件的PanGesture参数distance使得拖动更灵敏。当子组件绑定SwipeGesture时,由于PanGesture和SwipeGesture触发条件不同,需要修改PanGesture和SwipeGesture的参数以达到所需效果。 + + +## 捏合手势(PinchGesture) + + +```ts +PinchGesture(value?:{fingers?:number; distance?:number}) +``` + + +捏合手势用于触发捏合手势事件,触发捏合手势的最少手指数量为2指,最大为5指,最小识别距离为3vp,拥有两个可选参数: + + +- fingers:非必选参数,用于声明触发捏合手势所需要的最少手指数量,最小值为2,最大值为5,默认值为2。 + +- distance:非必选参数,用于声明触发捏合手势的最小距离,单位为vp,默认值为3。 + + +以在Column组件上绑定三指捏合手势为例,可以通过在捏合手势的函数回调中获取缩放比例,实现对组件的缩小或放大: + + + +```ts +// xxx.ets +@Entry +@Component +struct Index { + @State scaleValue: number = 1; + @State pinchValue: number = 1; + @State pinchX: number = 0; + @State pinchY: number = 0; + + build() { + Column() { + Column() { + Text('PinchGesture scale:\n' + this.scaleValue) + Text('PinchGesture center:\n(' + this.pinchX + ',' + this.pinchY + ')') + } + .height(200) + .width(300) + .border({ width: 3 }) + .margin({ top: 100 }) + // 在组件上绑定缩放比例,可以通过修改缩放比例来实现组件的缩小或者放大 + .scale({ x: this.scaleValue, y: this.scaleValue, z: 1 }) + .gesture( + // 在组件上绑定三指触发的捏合手势 + PinchGesture({ fingers: 3 }) + .onActionStart((event: GestureEvent) => { + console.info('Pinch start'); + }) + // 当捏合手势触发时,可以通过回调函数获取缩放比例,从而修改组件的缩放比例 + .onActionUpdate((event: GestureEvent) => { + this.scaleValue = this.pinchValue * event.scale; + this.pinchX = event.pinchCenterX; + this.pinchY = event.pinchCenterY; + }) + .onActionEnd(() => { + this.pinchValue = this.scaleValue; + console.info('Pinch end'); + }) + ) + } + } +} +``` + + +![pinch](figures/pinch.png) + + +## 旋转手势(RotationGesture) + + +```ts +RotationGesture(value?:{fingers?:number; angle?:number}) +``` + + +旋转手势用于触发旋转手势事件,触发旋转手势的最少手指数量为2指,最大为5指,最小改变度数为1度,拥有两个可选参数: + + +- fingers:非必选参数,用于声明触发旋转手势所需要的最少手指数量,最小值为2,最大值为5,默认值为2。 + +- angle:非必选参数,用于声明触发旋转手势的最小改变度数,单位为deg,默认值为1。 + + +以在Text组件上绑定旋转手势实现组件的旋转为例,可以通过在旋转手势的回调函数中获取旋转角度,从而实现组件的旋转: + + + +```ts +// xxx.ets +@Entry +@Component +struct Index { + @State angle: number = 0; + @State rotateValue: number = 0; + + build() { + Column() { + Text('RotationGesture angle:' + this.angle).fontSize(28) + // 在组件上绑定旋转布局,可以通过修改旋转角度来实现组件的旋转 + .rotate({ angle: this.angle }) + .gesture( + RotationGesture() + .onActionStart((event: GestureEvent) => { + console.info('RotationGesture is onActionStart'); + }) + // 当旋转手势生效时,通过旋转手势的回调函数获取旋转角度,从而修改组件的旋转角度 + .onActionUpdate((event: GestureEvent) => { + this.angle = this.rotateValue + event.angle; + console.info('RotationGesture is onActionEnd'); + }) + // 当旋转结束抬手时,固定组件在旋转结束时的角度 + .onActionEnd(() => { + this.rotateValue = this.angle; + console.info('RotationGesture is onActionEnd'); + }) + .onActionCancel(() => { + console.info('RotationGesture is onActionCancel'); + }) + ) + } + .height(200) + .width(250) + } +} +``` + + +![rotation](figures/rotation.png) + + +## 滑动手势(SwipeGesture) + + +```ts +SwipeGesture(value?:{fingers?:number; direction?:SwipeDirection; speed?:number}) +``` + + +滑动手势用于触发滑动事件,当滑动速度大于100vp/s时可以识别成功,拥有三个可选参数: + + +- fingers:非必选参数,用于声明触发滑动手势所需要的最少手指数量,最小值为1,最大值为10,默认值为1。 + +- direction:非必选参数,用于声明触发滑动手势的方向,此枚举值支持逻辑与(&)和逻辑或(|)运算。默认值为SwipeDirection.All。 + +- speed:非必选参数,用于声明触发滑动的最小滑动识别速度,单位为vp/s,默认值为100。 + + +以在Column组件上绑定滑动手势实现组件的旋转为例: + + + +```ts +// xxx.ets +@Entry +@Component +struct Index { + @State rotateAngle: number = 0; + @State speed: number = 1; + + build() { + Column() { + Column() { + Text("SwipeGesture speed\n" + this.speed) + Text("SwipeGesture angle\n" + this.rotateAngle) + } + .border({ width: 3 }) + .width(300) + .height(200) + .margin(100) + // 在Column组件上绑定旋转,通过滑动手势的滑动速度和角度修改旋转的角度 + .rotate({ angle: this.rotateAngle }) + .gesture( + // 绑定滑动手势且限制仅在竖直方向滑动时触发 + SwipeGesture({ direction: SwipeDirection.Vertical }) + // 当滑动手势触发时,获取滑动的速度和角度,实现对组件的布局参数的修改 + .onAction((event: GestureEvent) => { + this.speed = event.speed; + this.rotateAngle = event.angle; + }) + ) + } + } +} +``` + + +![swipe](figures/swipe.gif) + + +>**说明:** +> +>当SwipeGesture和PanGesture同时绑定时,若二者是以默认方式或者互斥方式进行绑定时,会发生竞争。SwipeGesture的触发条件为滑动速度达到100vp/s,PanGesture的触发条件为滑动距离达到5vp,先达到触发条件的手势触发。可以通过修改SwipeGesture和PanGesture的参数以达到不同的效果。 diff --git a/zh-cn/application-dev/ui/arkts-graphics-display.md b/zh-cn/application-dev/ui/arkts-graphics-display.md new file mode 100644 index 0000000000000000000000000000000000000000..196046e3ff0e846292fbdde4aad88f4d3aa78fbc --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-graphics-display.md @@ -0,0 +1,332 @@ +# 显示图片 + + +开发者经常需要在应用中显示一些图片,例如:按钮中的logo、网络图片、本地图片等。在应用中显示图片需要使用Image组件实现,Image支持多种图片格式,包括png、jpg、bmp、svg和gif,具体用法请参考[Image](../reference/arkui-ts/ts-basic-components-image.md)组件。 + + +Image通过调用接口来创建,接口调用形式如下: + + + +```ts +Image(src: string | Resource | media.PixelMap) +``` + + +该接口通过图片数据源获取图片,支持本地图片和网络图片的渲染展示。其中,src是图片的数据源,加载方式请参考[加载图片资源](#加载图片资源)。 + + +## 加载图片资源 + +Image支持加载存档图、多媒体像素图两种类型。 + + +### 存档图类型数据源 + +存档图类型的数据源可以分为本地资源、网络资源、Resource资源、媒体库datashare资源和base64。 + +- 本地资源 + 创建文件夹,将本地图片放入ets文件夹下的任意位置。 + + Image组件引入本地图片路径,即可显示图片(根目录为ets文件夹)。 + + ```ts + Image('images/view.jpg') + .width(200) + ``` + +- 网络资源 + 引入网络图片需申请权限ohos.permission.INTERNET,具体申请方式请参考[权限申请声明](../security/accesstoken-guidelines.md)。此时,Image组件的src参数为网络图片的链接。 + + ```ts + Image('https://www.example.com/example.JPG') // 实际使用时请替换为真实地址 + ``` + +- Resource资源 + 使用资源格式可以跨包/跨模块引入图片,resources文件夹下的图片都可以通过$r资源接口读 取到并转换到Resource格式。 + + **图1** resouces   + + ![image-resource](figures/image-resource.jpg) + + 调用方式: + + ``` + Image($r('app.media.icon')) + ``` + + 还可以将图片放在rawfile文件夹下。 + + **图2** rawfile   + + ![image-rawfile](figures/image-rawfile.jpg) + + 调用方式: + + ``` + Image($rawfile('snap')) + ``` + +- 媒体库datashare + 支持datashare://路径前缀的字符串,用于访问通过媒体库提供的图片路径。 + + 1. 调用接口获取图库的照片url。 + ​ + ```ts + import picker from '@ohos.file.picker'; + + @Entry + @Component + struct Index { + @State imgDatas: string[] = []; + // 获取照片url集 + getAllImg() { + let photoPicker = new picker.PhotoViewPicker(); + let result = new Array(); + try { + let PhotoSelectOptions = new picker.PhotoSelectOptions(); + PhotoSelectOptions.MIMEType = picker.PhotoViewMIMETypes.IMAGE_TYPE; + PhotoSelectOptions.maxSelectNumber = 5; + let photoPicker = new picker.PhotoViewPicker(); + photoPicker.select(PhotoSelectOptions).then((PhotoSelectResult) => { + this.imgDatas = PhotoSelectResult.photoUris; + console.info('PhotoViewPicker.select successfully, PhotoSelectResult uri: ' + JSON.stringify(PhotoSelectResult)); + }).catch((err) => { + console.error(`PhotoViewPicker.select failed with. Code: ${err.code}, message: ${err.message}`); + }); + } catch (err) { + console.error(`PhotoViewPicker failed with. Code: ${err.code}, message: ${err.message}`); } + } + + // aboutToAppear中调用上述函数,获取图库的所有图片url,存在imgDatas中 + async aboutToAppear() { + this.getAllImg(); + } + // 使用imgDatas的url加载图片。 + build() { + Column() { + Grid() { + ForEach(this.imgDatas, item => { + GridItem() { + Image(item) + .width(200) + } + }, item => JSON.stringify(item)) + } + }.width('100%').height('100%') + } + } + ``` + 2. 从媒体库获取的url格式通常如下。 + ​ + ```ts + Image('datashare:///media/5') + .width(200) + ``` + +- base64 + + 路径格式为data:image/[png|jpeg|bmp|webp];base64,[base64 data],其中[base64 data]为Base64字符串数据。 + + Base64格式字符串可用于存储图片的像素数据,在网页上使用较为广泛。 + + +### 多媒体像素图 + +PixelMap是图片解码后的像素图,具体用法请参考[图片开发指导](../media/image-overview.md)。以下示例将加载的网络图片返回的数据解码成PixelMap格式,再显示在Image组件上, + +1. 创建PixelMap状态变量。 + + ```ts + @State image: PixelMap = undefined; + ``` + +2. 引用多媒体。 + 请求网络图片请求,解码编码PixelMap。 + + 1. 引用网络权限与媒体库权限。 + ​ + ```ts + import http from '@ohos.net.http'; + import ResponseCode from '@ohos.net.http'; + import image from '@ohos.multimedia.image'; + ``` + 2. 填写网络图片地址。 + ​ + ```ts + http.createHttp().request("https://www.example.com/xxx.png", + (error, data) => { + if (error){ + console.error(`http reqeust failed with. Code: ${error.code}, message: ${error.message}`); + } else { + } + } + ) + ``` + 3. 将网络地址成功返回的数据,编码转码成pixelMap的图片格式。 + ​ + ```ts + let code = data.responseCode; + if(ResponseCode.ResponseCode.OK === code) { + let imageSource = image.createImageSource(data.result); + let options = { + alphaType: 0, // 透明度 + editable: false, // 是否可编辑 + pixelFormat: 3, // 像素格式 + scaleMode: 1, // 缩略值 + size: {height: 100, width: 100} + } // 创建图片大小 + imageSource.createPixelMap(options).then((pixelMap) => { + this.image = pixelMap + }) + ``` + 4. 显示图片。 + ​ + ```ts + Button("获取网络图片") + .onClick(() => { + this.httpRequest() + }) + Image(this.image).height(100).width(100) + ``` + + +## 显示矢量图 + +Image组件可显示矢量图(svg格式的图片),支持的svg标签为:svg、rect、circle、ellipse、path、line、polyline、polygon和animate。 + +svg格式的图片可以使用fillColor属性改变图片的绘制颜色。 + + +```ts +Image($r('app.media.cloud')).width(50) +.fillColor(Color.Blue) +``` + + **图3** 原始图片   + +![屏幕截图_20230223_141141](figures/屏幕截图_20230223_141141.png) + + **图4** 设置绘制颜色后的svg图片   + +![屏幕截图_20230223_141404](figures/屏幕截图_20230223_141404.png) + + +## 添加属性 + +给Image组件设置属性可以使图片显示更灵活,达到一些自定义的效果。以下是几个常用属性的使用示例,完整属性信息详见[Image](../reference/arkui-ts/ts-basic-components-image.md)。 + + +### 设置图片缩放类型 + +通过objectFit属性使图片缩放到高度和宽度确定的框内。 + + +```ts +@Entry +@Component +struct MyComponent { + scroller: Scroller = new Scroller() + + build() { + Scroll(this.scroller) { + Row() { + Image($r('app.media.img_2')).width(200).height(150) + .border({ width: 1 }) + .objectFit(ImageFit.Contain).margin(15) // 保持宽高比进行缩小或者放大,使得图片完全显示在显示边界内。 + .overlay('Contain', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) + Image($r('app.media.ic_img_2')).width(200).height(150) + .border({ width: 1 }) + .objectFit(ImageFit.Cover).margin(15) + // 保持宽高比进行缩小或者放大,使得图片两边都大于或等于显示边界。 + .overlay('Cover', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) + Image($r('app.media.img_2')).width(200).height(150) + .border({ width: 1 }) + // 自适应显示。 + .objectFit(ImageFit.Auto).margin(15) + .overlay('Auto', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) + } + Row() { + Image($r('app.media.img_2')).width(200).height(150) + .border({ width: 1 }) + .objectFit(ImageFit.Fill).margin(15) + // 不保持宽高比进行放大缩小,使得图片充满显示边界。 + .overlay('Fill', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) + Image($r('app.media.img_2')).width(200).height(150) + .border({ width: 1 }) + // 保持宽高比显示,图片缩小或者保持不变。 + .objectFit(ImageFit.ScaleDown).margin(15) + .overlay('ScaleDown', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) + Image($r('app.media.img_2')).width(200).height(150) + .border({ width: 1 }) + // 保持原有尺寸显示。 + .objectFit(ImageFit.None).margin(15) + .overlay('None', { align: Alignment.Bottom, offset: { x: 0, y: 20 } }) + } + } + } +} +``` + +![zh-cn_image_0000001511421240](figures/zh-cn_image_0000001511421240.png) + + +### 同步加载图片 + +一般情况下,图片加载流程会异步进行,以避免阻塞主线程,影响UI交互。但是特定情况下,图片刷新时会出现闪烁,这时可以使用syncLoad属性,使图片同步加载,从而避免出现闪烁。不建议图片加载较长时间时使用,会导致页面无法响应。 + + +```ts +Image($r('app.media.icon')) + .syncLoad(true) +``` + + +## 事件调用 + +通过在Image组件上绑定onComplete事件,图片加载成功后可以获取图片的必要信息。如果图片加载失败,也可以通过绑定onError回调来获得结果。 + + +```ts +@Entry +@Component +struct MyComponent { + @State widthValue: number = 0 + @State heightValue: number = 0 + @State componentWidth: number = 0 + @State componentHeight: number = 0 + + build() { + Column() { + Row() { + Image($r('app.media.ic_img_2')) + .width(200) + .height(150) + .margin(15) + .onComplete((msg: { + width: number, + height: number, + componentWidth: number, + componentHeight: number + }) => { + this.widthValue = msg.width + this.heightValue = msg.height + this.componentWidth = msg.componentWidth + this.componentHeight = msg.componentHeight + }) + // 图片获取失败,打印结果 + .onError(() => { + console.info('load image fail') + }) + .overlay('\nwidth: ' + String(this.widthValue) + ', height: ' + String(this.heightValue) + '\ncomponentWidth: ' + String(this.componentWidth) + '\ncomponentHeight: ' + String(this.componentHeight), { + align: Alignment.Bottom, + offset: { x: 0, y: 60 } + }) + } + } + } +} +``` + + +![zh-cn_image_0000001511740460](figures/zh-cn_image_0000001511740460.png) diff --git a/zh-cn/application-dev/ui/arkts-layout-development-create-grid.md b/zh-cn/application-dev/ui/arkts-layout-development-create-grid.md new file mode 100644 index 0000000000000000000000000000000000000000..1547b28a4a8a9695ff1d6235e2b09821d865ad24 --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-layout-development-create-grid.md @@ -0,0 +1,339 @@ +# 创建网格 + + +## 概述 + +网格布局是由“行”和“列”分割的单元格所组成,通过指定“项目”所在的单元格做出各种各样的布局。网格布局具有较强的页面均分能力,子组件占比控制能力,是一种重要自适应布局,其使用场景有九宫格图片展示、日历、计算器等。 + +ArkUI提供了[Grid](../reference/arkui-ts/ts-container-grid.md)容器组件和子组件[GridItem](../reference/arkui-ts/ts-container-griditem.md),用于构建网格布局。Grid用于设置网格布局相关参数,GridItem定义子组件相关特征。Grid组件支持使用条件渲染、循环渲染、[懒加载](../quick-start/arkts-rendering-control-lazyforeach.md)等方式生成子组件。 + + +## 布局与约束 + +Grid组件为网格容器,其中容器内个条目对应一个GridItem组件,如下图所示。 + + **图1** Grid与GridItem组件关系 +![zh-cn_image_0000001511900472](figures/zh-cn_image_0000001511900472.png) + +>**说明:** +> +>Grid的子组件必须是GridItem组件。 + +网格布局是一种二维布局。Grid组件支持自定义行列数和每行每列尺寸占比、设置子组件横跨几行或者几列,同时提供了垂直和水平布局能力。当网格容器组件尺寸发生变化时,所有子组件以及间距会等比例调整,从而实现网格布局的自适应能力。根据Grid的这些布局能力,可以构建出不同样式的网格布局,如下图所示。 + + **图2** 网格布局   +![zh-cn_image_0000001562700473](figures/zh-cn_image_0000001562700473.png) + +如果Grid组件设置了宽高属性,则其尺寸为设置值。如果没有设置宽高属性,Grid组件的尺寸默认适应其父组件的尺寸。 + +Grid组件根据行列数量与占比属性的设置,可以分为三种布局情况: + +- 行、列数量与占比同时设置:Grid只展示固定行列数的元素,其余元素不展示,且Grid不可滚动。 + +- 只设置行、列数量与占比中的一个:元素按照设置的方向进行排布,超出的元素可通过滚动的方式展示。 + +- 行列数量与占比都不设置:元素在布局方向上排布,其行列数由布局方向、单个网格的宽高等多个属性共同决定。超出行列容纳范围的元素不展示,且Grid不可滚动。 + +>**说明:** +> +>推荐优先采用确定的行或列数量占比方式进行布局。 + + +## 设置排列方式 + + +### 设置行列数量与占比 + +通过设置行列数量与尺寸占比可以确定网格布局的整体排列方式。Grid组件提供了rowsTemplate和columnsTemplate属性用于设置网格布局行列数量与尺寸占比。 + +rowsTemplate和columnsTemplate属性值是一个由多个空格和'数字+fr'间隔拼接的字符串,fr的个数即网格布局的行或列数,fr前面的数值大小,用于计算该行或列在网格布局宽度上的占比,最终决定该行或列宽度。 + + **图3** 行列数量占比示例 +![zh-cn_image_0000001562820833](figures/zh-cn_image_0000001562820833.png) + +如上图所示,构建的是一个三行三列的的网格布局,其在垂直方向上分为三等份,每行占一份;在水平方向上分为四等份,第一列占一份,第二列占两份,第三列占一份。 + +只要将rowsTemplate的值为'1fr 1fr 1fr',同时将columnsTemplate的值为'1fr 2fr 1fr',即可实现上述网格布局。 + + +```ts +Grid() { + ... +} +.rowsTemplate('1fr 1fr 1fr') +.columnsTemplate('1fr 2fr 1fr') +``` + +>**说明:** +> +>当Grid组件设置了rowsTemplate或columnsTemplate时,Grid的layoutDirection、maxCount、minCount、cellLength属性不生效,属性说明可参考[Grid-属性](../reference/arkui-ts/ts-container-grid.md#属性)。 + + +### 设置子组件所占行列数 + +除了大小相同的等比例网格布局,由不同大小的网格组成不均匀分布的网格布局场景在实际应用中十分常见,如下图所示。在Grid组件中,通过设置GridItem的rowStart、rowEnd、columnStart和columnEnd可以实现如图所示的单个网格横跨多行或多列的场景。 + + **图4** 不均匀网格布局 + +![zh-cn_image_0000001511900480](figures/zh-cn_image_0000001511900480.png) + +例如计算器的按键布局就是常见的不均匀网格布局场景。如下图,计算器中的按键“0”和“=”,按键“0”横跨第一、二两列,按键“=”横跨第五、六两行。使用Grid构建的网格布局,其行列标号从1开始,依次编号。 + + **图5** 计算器   + +![zh-cn_image_0000001511421292](figures/zh-cn_image_0000001511421292.png) + +在单个网格单元中,rowStart和rowEnd属性表示指定当前元素起始行号和终点行号,columnStart和columnEnd属性表示指定当前元素的起始列号和终点列号。 + +所以“0”按键横跨第一列和第二列,只要将“0”对应GridItem的columnStart和columnEnd设为1和2,将“=”对应GridItem的的rowStart和rowEnd设为5和6即可。 + + +```ts +GridItem() { + Text(key) + ... +} +.columnStart(1) +.columnEnd(2) +``` + +“=”按键横跨第五行和第六行,只要将将“=”对应GridItem的的rowStart和rowEnd设为5和6即可。 + + +```ts +GridItem() { + Text(key) + ... +} +.rowStart(5) +.rowEnd(6) +``` + + +### 设置主轴方向 + +使用Grid构建网格布局时,若没有设置行列数量与占比,可以通过layoutDirection可以设置网格布局的主轴方向,决定子组件的排列方式。此时可以结合minCount和maxCount属性来约束主轴方向上的网格数量。 + + **图6** 主轴方向示意图 + +![zh-cn_image_0000001562700469](figures/zh-cn_image_0000001562700469.png) + +当前layoutDirection设置为Row时,先从左到右排列,排满一行再排一下一行。当前layoutDirection设置为Column时,先从上到下排列,排满一列再排一下一列,如上图所示。此时,将maxCount属性设为3,表示主轴方向上最大显示的网格单元数量为3。 + + +```ts +Grid() { + ... +} +.maxCount(3) +.layoutDirection(GridDirection.Row) +``` + +>**说明:** +> +>- layoutDirection属性仅在不设置rowsTemplate和columnsTemplate时生效,此时元素在layoutDirection方向上排列。 +>- 仅设置rowsTemplate时,Grid主轴为水平方向,交叉轴为垂直方向。 +>- 仅设置columnsTemplate时,Grid主轴为垂直方向,交叉轴为水平方向。 + + +## 在网格布局中显示数据 + +网格布局采用二维布局的方式组织其内部元素,如下图所示。 + +**图7** 通用办公服务   + +![zh-cn_image_0000001563060729](figures/zh-cn_image_0000001563060729.png) + +Grid组件可以通过二维布局的方式显示一组GridItem子组件。 + + +```ts +Grid() { + GridItem() { + Text('会议') + ... + } + + GridItem() { + Text('签到') + ... + } + + GridItem() { + Text('投票') + ... + } + + GridItem() { + Text('打印') + ... + } +} +.rowsTemplate('1fr 1fr') +.rowsTemplate('1fr 1fr') +``` + +对于内容结构相似的多个GridItem,通常更推荐使用ForEach语句中嵌套GridItem的形式,来减少重复代码。 + + +```ts +@Component +struct OfficeService { + @State services: Array = ['会议', '投票', '签到', '打印'] + ... + + build() { + Column() { + Grid() { + ForEach(this.services, service => { + GridItem() { + Text(service) + ... + } + }, service => service) + } + .rowsTemplate('1fr 1fr') + .rowsTemplate('1fr 1fr') + ... + } + ... + } +} +``` + + +## 设置行列间距 + +在两个网格单元之间的网格横向间距称为行间距,网格纵向间距称为列间距,如下图所示。 + +**图8** 网格的行列间距   + +![zh-cn_image_0000001511580908](figures/zh-cn_image_0000001511580908.png) + +通过Grid的rowsGap和columnsGap可以设置网格布局的行列间距。在图5所示的计算器中,行间距为15vp,列间距为10vp。 + + +```ts +Grid() { + ... +} +.columnsGap(10) +.rowsGap(15) +``` + + +## 构建可滚动的网格布局 + +可滚动的网格布局常用在文件管理、购物或视频列表等页面中,如下图所示。在设置Grid的行列数量与占比时,如果仅设置行、列数量与占比中的一个,即仅设置rowsTemplate或仅设置columnsTemplate属性,网格单元按照设置的方向排列,超出Grid显示区域后,Grid拥有可滚动能力。 + +**图9** 横向可滚动网格布局 + +![zh-cn_image_0000001511740512](figures/zh-cn_image_0000001511740512.gif) + +如果设置的是columnsTemplate,Grid的滚动方向为垂直方向;如果设置的是rowsTemplate,Grid的滚动方向为水平方向。 + +如上图所示的横向可滚动网格布局,只要设置rowsTemplate属性的值且不设置columnsTemplate属性,当内容超出Grid组件宽度时,Grid可横向滚动进行内容展示。 + + +```ts +@Component +struct Shopping { + @State services: Array = ['直播', '进口', ...] + ... + + build() { + Column({ space: 5 }) { + Grid() { + ForEach(this.services, (service: string, index) => { + GridItem() { + ... + } + .width('25%') + }, service => service) + } + .rowsTemplate('1fr 1fr') // 只设置rowsTemplate属性,当内容超出Grid区域时,可水平滚动。 + .rowsGap(15) + ... + } + ... + } +} +``` + + +## 控制滚动位置 + +与新闻列表的返回顶部场景类似,控制滚动位置功能在网格布局中也很常用,例如下图所示日历的翻页功能。 + + **图10** 日历翻页   + +![zh-cn_image_0000001562940549](figures/zh-cn_image_0000001562940549.gif) + +Grid组件初始化时,可以绑定一个[Scroller](https://docs.openharmony.cn/pages/v3.2Beta/zh-cn/application-dev/reference/arkui-ts/ts-container-scroll.md/#scroller)对象,用于进行滚动控制,例如通过Scroller对象的[scrollPage](https://docs.openharmony.cn/pages/v3.2Beta/zh-cn/application-dev/reference/arkui-ts/ts-container-scroll.md/#scrollpage)方法进行翻页。 + + +```ts +private scroller: Scroller = new Scroller() +``` + +在日历页面中,用户在点击“下一页”按钮时,应用响应点击事件,通过指定scrollPage方法的参数next为true,滚动到下一页。 + + +```ts +Column({ space: 5 }) { + Grid(this.scroller) { + ... + } + .columnsTemplate('1fr 1fr 1fr 1fr 1fr 1fr 1fr') + ... + + Row({space: 20}) { + Button('上一页') + .onClick(() => { + this.scroller.scrollPage({ + next: false + }) + }) + + Button('下一页') + .onClick(() => { + this.scroller.scrollPage({ + next: true + }) + }) + } +} +... +``` + + +## 性能优化 + +与[长列表的处理](arkts-layout-development-create-list.md#长列表的处理)类似,[循环渲染](../quick-start/arkts-rendering-control-foreach.md)适用于数据量较小的布局场景,当构建具有大量网格项的可滚动网格布局时,推荐使用[数据懒加载](../quick-start/arkts-rendering-control-lazyforeach.md)方式实现按需迭代加载数据,从而提升列表性能。 + +关于按需加载优化的具体实现可参考[数据懒加载](../quick-start/arkts-rendering-control-lazyforeach.md)章节中的示例。 + +当使用懒加载方式渲染网格时,为了更好的滚动体验,减少滑动时出现白块,Grid组件中也可通过cachedCount属性设置GridItem的预加载数量,只在懒加载LazyForEach中生效。 + + 设置预加载数量后,会在Grid显示区域前后各缓存cachedCount\*列数个GridItem,超出显示和缓存范围的GridItem会被释放。 + +```ts +Grid() { + LazyForEach(this.dataSource, item => { + GridItem() { + ... + } + }) +} +.cachedCount(3) +``` + +>**说明:** +> +>cachedCount的增加会增大UI的CPU、内存开销。使用时需要根据实际情况,综合性能和用户体验进行调整。 + +## 相关实例 + +如需详细了解网格布局的实现,请参考以下示例: + +- [分布式计算器](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/DistributedAppDev/ArkTSDistributedCalc) diff --git a/zh-cn/application-dev/ui/arkts-layout-development-create-list.md b/zh-cn/application-dev/ui/arkts-layout-development-create-list.md new file mode 100644 index 0000000000000000000000000000000000000000..af323c8ed5004a221002ce083f0c88d834832938 --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-layout-development-create-list.md @@ -0,0 +1,841 @@ +# 创建列表 + + +## 概述 + +列表是一种复杂的容器,当列表项达到一定数量,内容超过屏幕大小时,可以自动提供滚动功能。它适合用于呈现同类数据类型或数据类型集,例如图片和文本。在列表中显示数据集合是许多应用程序中的常见要求(如通讯录、音乐列表、购物清单等)。 + +使用列表可以轻松高效地显示结构化、可滚动的信息。通过在[List](../reference/arkui-ts/ts-container-list.md)组件中按垂直或者水平方向线性排列子组件[ListItemGroup](../reference/arkui-ts/ts-container-listitemgroup.md)或[ListItem](../reference/arkui-ts/ts-container-listitem.md),为列表中的行或列提供单个视图,或使用[循环渲染](../quick-start/arkts-rendering-control-foreach.md)迭代一组行或列,或混合任意数量的单个视图和ForEach结构,构建一个列表。List组件支持使用条件渲染、循环渲染、懒加载等[渲染控制](../quick-start/arkts-rendering-control-overview.md)方式生成子组件。 + + +## 布局与约束 + +列表作为一种容器,会自动按其滚动方向排列子组件,向列表中添加组件或从列表中移除组件会重新排列子组件。 + +如下图所示,在垂直列表中,List按垂直方向自动排列ListItemGroup或ListItem。 + +ListItemGroup用于列表数据的分组展示,其子组件也是ListItem。ListItem表示单个列表项,可以包含单个子组件。 + + **图1** List、ListItemGroup和ListItem组件关系   + +![zh-cn_image_0000001562940589](figures/zh-cn_image_0000001562940589.png) + +>**说明:** +> +>List的子组件必须是ListItemGroup或ListItem,ListItem和ListItemGroup必须配合List来使用。 + + +### 布局 + +List除了提供垂直和水平布局能力、超出屏幕时可以滚动的自适应[延伸能力](../key-features/multi-device-app-dev/adaptive-layout.md)之外,还提供了自适应交叉轴方向上排列个数的布局能力。 + +利用垂直布局能力可以构建单列或者多列垂直滚动列表,如下图所示。 + + **图2** 垂直滚动列表(左:单列;右:多列)   + +![zh-cn_image_0000001511580940](figures/zh-cn_image_0000001511580940.png) + +利用水平布局能力可以是构建单行或多行水平滚动列表,如下图所示。 + + **图3** 水平滚动列表(左:单行;右:多行)   + +![zh-cn_image_0000001511421344](figures/zh-cn_image_0000001511421344.png) + + +### 约束 + +列表的主轴方向是指子组件列的排列方向,也是列表的滚动方向。垂直于主轴的轴称为交叉轴,其方向与主轴方向相互垂直。 + +如下图所示,垂直列表的主轴是垂直方向,交叉轴是水平方向;水平列表的主轴是水平方向,交叉轴是水平方向。 + + **图4** 列表的主轴与交叉轴   + +![zh-cn_image_0000001562940581](figures/zh-cn_image_0000001562940581.png) + +如果List组件主轴或交叉轴方向设置了尺寸,则其对应方向上的尺寸为设置值。 + +如果List组件主轴方向没有设置尺寸,当List子组件主轴方向总尺寸小于List的父组件尺寸时,List主轴方向尺寸自动适应子组件的总尺寸。 + +如下图所示,一个垂直列表B没有设置高度时,其父组件A高度为200vp,若其所有子组件C的高度总和为150vp,则此时列表B的高度为150vp。 + + **图5** 列表主轴高度约束示例1(**A**: List的父组件; **B**: List组件; **C**: List的所有子组件)   + +![zh-cn_image_0000001511580956](figures/zh-cn_image_0000001511580956.png) + +如果子组件主轴方向总尺寸超过List父组件尺寸时,List主轴方向尺寸适应List的父组件尺寸。 + +如下图所示,同样是没有设置高度的垂直列表B,其父组件A高度为200vp,若其所有子组件C的高度总和为300vp,则此时列表B的高度为200vp。 + + **图6** 列表主轴高度约束示例2(**A**: List的父组件; **B**: List组件; **C**: List的所有子组件)   + +![zh-cn_image_0000001511740548](figures/zh-cn_image_0000001511740548.png) + +List组件交叉轴方向在没有设置尺寸时,其尺寸默认自适应父组件尺寸。 + + +## 开发布局 + + +### 设置主轴方向 + +List组件主轴默认是垂直方向,即默认情况下不需要手动设置List方向,就可以构建一个垂直滚动列表。 + +若是水平滚动列表场景,将List的listDirection属性设置为Axis.Horizontal即可实现。listDirection默认为Axis.Vertical,即主轴默认是垂直方向。 + + +```ts +List() { + ... +} +.listDirection(Axis.Horizontal) +``` + + +### 设置交叉轴布局 + +List组件的交叉轴布局可以通过lanes和alignListItem属性进行设置,lanes属性用于确定交叉轴排列的列表项数量,alignListItem用于设置子组件在交叉轴方向的对齐方式。 + +List组件的lanes属性通常用于在不同尺寸的设备自适应构建不同行数或列数的列表,即一次开发、多端部署的场景,例如[歌单列表](../key-features/multi-device-app-dev/music-album-page.md)。lanes属性的取值类型是"number | [LengthConstrain](../reference/arkui-ts/ts-types.md#lengthconstrain)",即整数或者LengthConstrain类型。以垂直列表为例,如果将lanes属性设为2,表示构建的是一个两列的垂直列表,如图2中右图所示。lanes的默认值为1,即默认情况下,垂直列表的列数是1。 + + +```ts +List() { + ... +} +.lanes(2) +``` + +当其取值为LengthConstrain类型时,表示会根据LengthConstrain与List组件的尺寸自适应决定行或列数。 + + +```ts +List() { + ... +} +.lanes({ minLength: 200, maxLength: 300 }) +``` + +例如,假设在垂直列表中设置了lanes的值为{ minLength: 200, maxLength: 300 }。此时, + +- 当List组件宽度为300vp时,由于minLength为200vp,此时列表为一列。 + +- 当List组件宽度变化至400vp时,符合两倍的minLength,则此时列表自适应为两列。 + +>**说明:** +> +>当lanes为LengthConstrain类型时,仅用于计算当前列表的行或列数,不影响列表项本身的尺寸。 + +同样以垂直列表为例,当alignListItem属性设置为ListItemAlign.Center表示列表项在水平方向上居中对齐。alignListItem的默认值是ListItemAlign.Start,即列表项在列表交叉轴方向上默认按首部对齐。 + + +```ts +List() { + ... +} +.alignListItem(ListItemAlign.Center) +``` + + +## 在列表中显示数据 + +列表视图垂直或水平显示项目集合,在行或列超出屏幕时提供滚动功能,使其适合显示大型数据集合。在最简单的列表形式中,List静态地创建其列表项ListItem的内容。 + + **图7** 城市列表   + +![zh-cn_image_0000001563060761](figures/zh-cn_image_0000001563060761.png) + +```ts +@Component +struct CityList { + build() { + List() { + ListItem() { + Text('北京').fontSize(24) + } + + ListItem() { + Text('杭州').fontSize(24) + } + + ListItem() { + Text('上海').fontSize(24) + } + } + .backgroundColor('#FFF1F3F5') + .alignListItem(ListItemAlign.Center) + } +} +``` + +由于在ListItem中只能有一个根节点组件,不支持以平铺形式使用多个组件。因此,若列表项是由多个组件元素组成的,则需要将这多个元素组合到一个容器组件内或组成一个自定义组件。 + + **图8** 联系人列表项示例   + +![zh-cn_image_0000001511421328](figures/zh-cn_image_0000001511421328.png) + +如上图所示,联系人列表的列表项中,每个联系人都有头像和名称。此时,需要将Image和Text封装到一个Row容器内。 + + +```ts +List() { + ListItem() { + Row() { + Image($r('app.media.iconE')) + .width(40) + .height(40) + .margin(10) + + Text('小明') + .fontSize(20) + } + } + + ListItem() { + Row() { + Image($r('app.media.iconF')) + .width(40) + .height(40) + .margin(10) + + Text('小红') + .fontSize(20) + } + } +} +``` + + +## 迭代列表内容 + +通常更常见的是,应用通过数据集合动态地创建列表。使用[循环渲染](../quick-start/arkts-rendering-control-foreach.md)可从数据源中迭代获取数据,并在每次迭代过程中创建相应的组件,降低代码复杂度。 + +ArkTS通过[ForEach](../quick-start/arkts-rendering-control-foreach.md)提供了组件的循环渲染能力。以简单形式的联系人列表为例,将联系人名称和头像数据以Contact类结构存储到contacts数组,使用ForEach中嵌套ListItem的形式来代替多个平铺的、内容相似的ListItem,从而减少重复代码。 + + +```ts +import util from '@ohos.util'; + +class Contact { + key: string = util.generateRandomUUID(true); + name: string; + icon: Resource; + + constructor(name: string, icon: Resource) { + this.name = name; + this.icon = icon; + } +} + +@Entry +@Component +struct SimpleContacts { + private contacts = [ + new Contact('小明', $r("app.media.iconA")), + new Contact('小红', $r("app.media.iconB")), + ... + ] + + build() { + List() { + ForEach(this.contacts, (item: Contact) => { + ListItem() { + Row() { + Image(item.icon) + .width(40) + .height(40) + .margin(10) + Text(item.name).fontSize(20) + } + .width('100%') + .justifyContent(FlexAlign.Start) + } + }, item => item.key) + } + .width('100%') + } +} +``` + +在List组件中,ForEach除了可以用来循环渲染ListItem,也可以用来循环渲染ListItemGroup。ListItemGroup的循环渲染详细使用请参见[支持分组列表](#支持分组列表)。 + + +## 自定义列表样式 + + +### 设置内容间距 + +在初始化列表时,如需在列表项之间添加间距,可以使用space参数。例如,在每个列表项之间沿主轴方向添加10vp的间距: + + +```ts +List({ space: 10 }) { + ... +} +``` + + +### 添加分隔线 + +分隔线用来将界面元素隔开,使单个元素更加容易识别。如下图所示,当列表项左边有图标(如蓝牙图标),由于图标本身就能很好的区分,此时分隔线从图标之后开始显示即可。 + + **图9** 设置列表分隔线样式   + +![zh-cn_image_0000001511580960](figures/zh-cn_image_0000001511580960.png) + +List提供了divider属性用于给列表项之间添加分隔线。在设置divider属性时,可以通过strokeWidth和color属性设置分隔线的粗细和颜色。 + +startMargin和endMargin属性分别用于设置分隔线距离列表侧边起始端的距离和距离列表侧边结束端的距离。 + + +```ts +List() { + ... +} +.divider({ + strokeWidth: 1, + startMargin: 60, + endMargin: 10, + color: '#ffe9f0f0' +}) +``` + +此示例表示从距离列表侧边起始端60vp开始到距离结束端10vp的位置,画一条粗细为1vp的分割线,可以实现图8设置列表分隔线的样式。 + +>**说明:** +> +>1. 分隔线的宽度会使ListItem之间存在一定间隔,当List设置的内容间距小于分隔线宽度时,ListItem之间的间隔会使用分隔线的宽度。 +> +>2. 当List存在多列时,分割线的startMargin和endMargin作用于每一列上。 +> +>3. List组件的分隔线画在两个ListItem之间,第一个ListItem上方和最后一个ListItem下方不会绘制分隔线。 + + +### 添加滚动条 + +当列表项高度(宽度)超出屏幕高度(宽度)时,列表可以沿垂直(水平)方向滚动。在页面内容很多时,若用户需快速定位,可拖拽滚动条,如下图所示。 + + **图10** 列表的滚动条  + +![zh-cn_image_0000001511740544](figures/zh-cn_image_0000001511740544.gif) + +在使用List组件时,可通过scrollBar属性控制列表滚动条的显示。scrollBar的取值类型为[BarState](../reference/arkui-ts/ts-appendix-enums.md#barstate),当取值为BarState.Auto表示按需显示滚动条。此时,当触摸到滚动条区域时显示控件,可上下拖拽滚动条快速浏览内容,拖拽时会变粗。若不进行任何操作,2秒后滚动条自动消失。 + + +```ts +List() { + ... +} +.scrollBar(BarState.Auto) +``` + + +## 支持分组列表 + +在列表中支持数据的分组展示,可以使列表显示结构清晰,查找方便,从而提高使用效率。分组列表在实际应用中十分常见,如下图所示联系人列表。 + + **图11** 联系人分组列表  + +![zh-cn_image_0000001511580948](figures/zh-cn_image_0000001511580948.png) + +在List组件中使用ListItemGroup对项目进行分组,可以构建二维列表。 + +在List组件中可以直接使用一个或者多个ListItemGroup组件,ListItemGroup的宽度默认充满List组件。在初始化ListItemGroup时,可通过header参数设置列表分组的头部组件。 + + +```ts +@Component +struct ContactsList { + ... + + @Builder itemHead(text: string) { + // 列表分组的头部组件,对应联系人分组A、B等位置的组件 + Text(text) + .fontSize(20) + .backgroundColor('#fff1f3f5') + .width('100%') + .padding(5) + } + + build() { + List() { + ListItemGroup({ header: this.itemHead('A') }) { + // 循环渲染分组A的ListItem + ... + } + ... + + ListItemGroup({ header: this.itemHead('B') }) { + // 循环渲染分组B的ListItem + ... + } + ... + } + } +} +``` + +如果多个ListItemGroup结构类似,可以将多个分组的数据组成数组,然后使用ForEach对多个分组进行循环渲染。例如在联系人列表中,将每个分组的联系人数据contacts(可参考[迭代列表内容](#迭代列表内容)章节)和对应分组的标题title数据进行组合,定义为数组contactsGroups。 + + +```ts +contactsGroups: object[] = [ + { + title: 'A', + contacts: [ + new Contact('艾佳', $r('app.media.iconA')), + new Contact('安安', $r('app.media.iconB')), + new Contact('Angela', $r('app.media.iconC')), + ], + }, + { + title: 'B', + contacts: [ + new Contact('白叶', $r('app.media.iconD')), + new Contact('伯明', $r('app.media.iconE')), + ], + }, + ... +] +``` + +然后在ForEach中对contactsGroups进行循环渲染,即可实现多个分组的联系人列表。 + + +```ts +List() { + // 循环渲染ListItemGroup,contactsGroups为多个分组联系人contacts和标题title的数据集合 + ForEach(this.contactsGroups, item => { + ListItemGroup({ header: this.itemHead(item.title) }) { + // 循环渲染ListItem + ForEach(item.contacts, (contact) => { + ListItem() { + ... + } + }, item => item.key) + } + ... + }) +} +``` + + +## 添加粘性标题 + +粘性标题是一种常见的标题模式,常用于定位字母列表的头部元素。如下图所示,在联系人列表中滚动A部分时,B部分开始的头部元素始终处于A的下方。而在开始滚动B部分时,B的头部会固定在屏幕顶部,直到所有B的项均完成滚动后,才被后面的头部替代。 + +粘性标题不仅有助于阐明列表中数据的表示形式和用途,还可以帮助用户在大量信息中进行数据定位,从而避免用户在标题所在的表的顶部与感兴趣区域之间反复滚动。 + + **图12** 粘性标题   + +![zh-cn_image_0000001511740552](figures/zh-cn_image_0000001511740552.gif) + +List组件的sticky属性配合ListItemGroup组件使用,用于设置ListItemGroup中的头部组件是否呈现吸顶效果或者尾部组件是否呈现吸底效果。 + +通过给List组件设置sticky属性为StickyStyle.Header,即可实现列表的粘性标题效果。如果需要支持吸底效果,可以通过footer参数初始化ListItemGroup的底部组件,并将sticky属性设置为StickyStyle.Footer。 + + +```ts +@Component +struct ContactsList { + // 定义分组联系人数据集合contactsGroups数组 + ... + + @Builder itemHead(text: string) { + // 列表分组的头部组件,对应联系人分组A、B等位置的组件 + Text(text) + .fontSize(20) + .backgroundColor('#fff1f3f5') + .width('100%') + .padding(5) + } + + build() { + List() { + // 循环渲染ListItemGroup,contactsGroups为多个分组联系人contacts和标题title的数据集合 + ForEach(this.contactsGroups, item => { + ListItemGroup({ header: this.itemHead(item.title) }) { + // 循环渲染ListItem + ForEach(item.contacts, (contact) => { + ListItem() { + ... + } + }, item => item.key) + } + ... + }) + } + .sticky(StickyStyle.Header) // 设置吸顶,实现粘性标题效果 + } +} +``` + + +## 控制滚动位置 + +控制滚动位置在实际应用中十分常见,例如当新闻页列表项数量庞大,用户滚动列表到一定位置时,希望快速滚动到列表底部或返回列表顶部。此时,可以通过控制滚动位置来实现列表的快速定位,如下图所示。 + + **图13** 返回列表顶部   + +![zh-cn_image_0000001511900520](figures/zh-cn_image_0000001511900520.gif) + +List组件初始化时,可以通过scroller参数绑定一个[Scroller](../reference/arkui-ts/ts-container-scroll.md#scroller)对象,进行列表的滚动控制。例如,用户在新闻应用中,点击新闻页面底部的返回顶部按钮时,就可以通过Scroller对象的scrollToIndex方法使列表滚动到指定的列表项索引位置。 + +首先,需要创建一个Scroller的对象listScroller。 + + +```ts +private listScroller: Scroller = new Scroller(); +``` + +然后,通过将listScroller用于初始化List组件的scroller参数,完成listScroller与列表的绑定。在需要跳转的位置指定scrollToIndex的参数为0,表示返回列表顶部。 + + +```ts +Stack({ alignContent: Alignment.BottomEnd }) { + // 将listScroller用于初始化List组件的scroller参数,完成listScroller与列表的绑定。 + List({ space: 20, scroller: this.listScroller }) { + ... + } + ... + + Button() { + ... + } + .onClick(() => { + // 点击按钮时,指定跳转位置,返回列表顶部 + this.listScroller.scrollToIndex(0) + }) + ... +} +``` + + +## 响应滚动位置 + +许多应用需要监听列表的滚动位置变化并作出响应。例如,在联系人列表滚动时,如果跨越了不同字母开头的分组,则侧边字母索引栏也需要更新到对应的字母位置。 + +除了字母索引之外,滚动列表结合多级分类索引在应用开发过程中也很常见,例如购物应用的商品分类页面,多级分类也需要监听列表的滚动位置。 + +**图14** 字母索引响应联系人列表滚动   + +![zh-cn_image_0000001563060769](figures/zh-cn_image_0000001563060769.gif) + +如上图所示,当联系人列表从A滚动到B时,右侧索引栏也需要同步从选中A状态变成选中B状态。此场景可以通过监听List组件的onScrollIndex事件来实现,右侧索引栏需要使用字母表索引组件[AlphabetIndexer](../reference/arkui-ts/ts-container-alphabet-indexer.md)。 + +在列表滚动时,根据列表此时所在的索引值位置firstIndex,重新计算字母索引栏对应字母的位置selectedIndex。由于AlphabetIndexer组件通过selected属性设置了选中项索引值,当selectedIndex变化时会触发AlphabetIndexer组件重新渲染,从而显示为选中对应字母的状态。 + + +```ts +... +const alphabets = ['#', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', + 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']; + +@Entry +@Component +struct ContactsList { + @State selectedIndex: number = 0; + private listScroller: Scroller = new Scroller(); + ... + + build() { + Stack({ alignContent: Alignment.End }) { + List({ scroller: this.listScroller }) { + ... + } + .onScrollIndex((firstIndex: number) => { + // 根据列表滚动到的索引值,重新计算对应联系人索引栏的位置this.selectedIndex + ... + }) + ... + + // 字母表索引组件 + AlphabetIndexer({ arrayValue: alphabets, selected: 0 }) + .selected(this.selectedIndex) + ... + } + } +} +``` + +>**说明:** +> +>计算索引值时,ListItemGroup作为一个整体占一个索引值,不计算ListItemGroup内部ListItem的索引值。 + + +## 响应列表项侧滑 + +侧滑菜单在许多应用中都很常见。例如,通讯类应用通常会给消息列表提供侧滑删除功能,即用户可以通过向左侧滑列表的某一项,再点击删除按钮删除消息,如下图所示。 + +**图15** 侧滑删除列表项   + +![zh-cn_image_0000001563060773](figures/zh-cn_image_0000001563060773.gif) + +ListItem的swipeAction属性可用于实现列表项的左右滑动功能。swipeAction属性方法初始化时有必填参数SwipeActionOptions,其中,start参数表示设置列表项右滑时起始端滑出的组件,end参数表示设置列表项左滑时尾端滑出的组件。 + +在消息列表中,end参数表示设置ListItem左滑时尾端划出自定义组件,即删除按钮。在初始化end方法时,将滑动列表项的索引传入删除按钮组件,当用户点击删除按钮时,可以根据索引值来删除列表项对应的数据,从而实现侧滑删除功能。 + + +```ts +@Entry +@Component +struct MessageList { + @State messages: object[] = [ + // 初始化消息列表数据 + ... + ]; + + @Builder itemEnd(index: number) { + // 侧滑后尾端出现的组件 + Button({ type: ButtonType.Circle }) { + Image($r('app.media.ic_public_delete_filled')) + .width(20) + .height(20) + } + .onClick(() => { + this.messages.splice(index, 1); + }) + ... + } + + build() { + ... + List() { + ForEach(this.messages, (item, index) => { + ListItem() { + ... + } + .swipeAction({ end: this.itemEnd.bind(this, index) }) // 设置侧滑属性 + }, item => item.id.toString()) + } + ... + } +} +``` + + +## 给列表项添加标记 + +添加标记是一种无干扰性且直观的方法,用于显示通知或将注意力集中到应用内的某个区域。例如,当消息列表接收到新消息时,通常对应的联系人头像的右上方会出现标记,提示有若干条未读消息,如下图所示。 + + **图16** 给列表项添加标记   + +![zh-cn_image_0000001511580952](figures/zh-cn_image_0000001511580952.png) + +在ListItem中使用[Badge](../reference/arkui-ts/ts-container-badge.md)组件可实现给列表项添加标记功能。Badge是可以附加在单个组件上用于信息标记的容器组件。 + +在消息列表中,若希望在联系人头像右上角添加标记,可在实现消息列表项ListItem的联系人头像时,将头像Image组件作为Badge的子组件。 + +在Badge组件中,count和position参数用于设置需要展示的消息数量和提示点显示位置,还可以通过style参数灵活设置标记的样式。 + + +```ts +Badge({ + count: 1, + position: BadgePosition.RightTop, + style: { badgeSize: 16, badgeColor: '#FA2A2D' } +}) { + // Image组件实现消息联系人头像 + ... +} +... +``` + + +## 下拉刷新与上拉加载 + +页面的下拉刷新与上拉加载功能在移动应用中十分常见,例如,新闻页面的内容刷新和加载。这两种操作的原理都是通过响应用户的[触摸事件](../reference/arkui-ts/ts-universal-events-touch.md),在顶部或者底部显示一个刷新或加载视图,完成后再将此视图隐藏。 + +以下拉刷新为例,其实现主要分成三步: + +1. 监听手指按下事件,记录其初始位置的值。 + +2. 监听手指按压移动事件,记录并计算当前移动的位置与初始值的差值,大于0表示向下移动,同时设置一个允许移动的最大值。 + +3. 监听手指抬起事件,若此时移动达到最大值,则触发数据加载并显示刷新视图,加载完成后将此视图隐藏。 + +下拉刷新与上拉加载的具体实现可参考Codelab:[新闻数据加载](https://gitee.com/openharmony/codelabs/tree/master/NetworkManagement/NewsDataArkTS)。若开发者希望快速实现此功能,也可使用三方组件[PullToRefresh](https://gitee.com/openharmony-sig/PullToRefresh)。 + + +## 编辑列表 + +列表的编辑模式用途十分广泛,常见于待办事项管理、文件管理、备忘录的记录管理等应用场景。在列表的编辑模式下,新增和删除列表项是最基础的功能,其核心是对列表项对应的数据集合进行数据添加和删除。 + +下面以待办事项管理为例,介绍如何快速实现新增和删除列表项功能。 + + +### 新增列表项 + +如下图所示,当用户点击添加按钮时,提供用户新增列表项内容选择或填写的交互界面,用户点击确定后,列表中新增对应的项目。 + + **图17** 新增待办   + +![zh-cn_image_0000001511740556](figures/zh-cn_image_0000001511740556.gif) + +添加列表项功能实现主要流程如下: + +1. 定义列表项数据结构和初始化列表数据,构建列表整体布局和列表项。 + 以待办事项管理为例,首先定义待办数据结构: + + ```ts + import util from '@ohos.util'; + + export class ToDo { + key: string = util.generateRandomUUID(true); + name: string; + + constructor(name: string) { + this.name = name; + } + } + ``` + + 然后,初始化待办列表数据和可选事项: + + ```ts + @State toDoData: ToDo[] = []; + private availableThings: string[] = ['读书', '运动', '旅游', '听音乐', '看电影', '唱歌']; + ``` + + 最后,构建列表布局和列表项: + + ```ts + List({ space: 10 }) { + ForEach(this.toDoData, (toDoItem) => { + ListItem() { + ... + } + }, toDoItem => toDoItem.key) + } + ``` + +2. 提供新增列表项入口,即给新增按钮添加点击事件。 + +3. 响应用户确定新增事件,更新列表数据。 + 待办事项管理示例的步骤2和步骤3功能实现如下: + + ```ts + Text('+') + .onClick(() => { + TextPickerDialog.show({ + range: this.availableThings, + onAccept: (value: TextPickerResult) => { + this.toDoData.push(new ToDo(this.availableThings[value.index])); // 新增列表项数据toDoData + }, + }) + }) + ``` + + +### 删除列表项 + +如下图所示,当用户长按列表项进入删除模式时,提供用户删除列表项选择的交互界面,用户勾选完成后点击删除按钮,列表中删除对应的项目。 + + **图18** 长按删除待办事项   + +![zh-cn_image_0000001562820877](figures/zh-cn_image_0000001562820877.gif) + +删除列表项功能实现主要流程如下: + +1. 列表的删除功能一般进入编辑模式后才可使用,所以需要提供编辑模式的入口。 + 以待办列表为例,通过监听列表项的长按事件,当用户长按列表项时,进入编辑模式。 + + ```ts + // ToDoListItem.ets + + Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + ... + } + .gesture( + GestureGroup(GestureMode.Exclusive, + LongPressGesture() + .onAction(() => { + if (!this.isEditMode) { + this.isEditMode = true; //进入编辑模式 + this.selectedItems.push(this.toDoItem); // 记录长按时选中的列表项 + } + }) + ) + ) + ``` + +2. 需要响应用户的选择交互,记录要删除的列表项数据。 + 在待办列表中,通过勾选框的勾选或取消勾选,响应用户勾选列表项变化,记录所有选择的列表项。 + + ```ts + // ToDoListItem.ets + + if (this.isEditMode) { + Checkbox() + .onChange((isSelected) => { + if (isSelected) { + this.selectedItems.push(this.toDoItem) // 勾选时,记录选中的列表项 + } else { + let index = this.selectedItems.indexOf(this.toDoItem) + if (index !== -1) { + this.selectedItems.splice(index, 1) // 取消勾选时,则将此项从selectedItems中删除 + } + } + }) + ... + } + ``` + +3. 需要响应用户点击删除按钮事件,删除列表中对应的选项。 + + ```ts + // ToDoList.ets + + Button('删除') + .onClick(() => { + // 删除选中的列表项对应的toDoData数据 + let leftData = this.toDoData.filter((item) => { + return this.selectedItems.find((selectedItem) => selectedItem !== item); + }) + + this.toDoData = leftData; + this.isEditMode = false; + }) + ... + ``` + + +## 长列表的处理 + +[循环渲染](../quick-start/arkts-rendering-control-foreach.md)适用于短列表,当构建具有大量列表项的长列表时,如果直接采用循环渲染方式,会一次性加载所有的列表元素,会导致页面启动时间过长,影响用户体验。因此,推荐使用[数据懒加载](../quick-start/arkts-rendering-control-lazyforeach.md)(LazyForEach)方式实现按需迭代加载数据,从而提升列表性能。 + +关于长列表按需加载优化的具体实现可参考[数据懒加载](../quick-start/arkts-rendering-control-lazyforeach.md)章节中的示例。 + +当使用懒加载方式渲染列表时,为了更好的列表滚动体验,减少列表滑动时出现白块,List组件提供了cachedCount参数用于设置列表项缓存数,只在懒加载LazyForEach中生效。 + + +```ts +List() { + LazyForEach(this.dataSource, item => { + ListItem() { + ... + } + }) +}.cachedCount(3) +``` + +以垂直列表为例: + +- 若懒加载是用于ListItem,当列表为单列模式时,会在List显示的ListItem前后各缓存cachedCount个ListItem;若是多列模式下,会在List显示的ListItem前后各缓存cachedCount\*列数个ListItem。 + +- 若懒加载是用于ListItemGroup,无论单列模式还是多列模式,都是在List显示的ListItem前后各缓存cachedCount个ListItemGroup。 + +>**说明:** +> +>1. cachedCount的增加会增大UI的CPU、内存开销。使用时需要根据实际情况,综合性能和用户体验进行调整。 +> +>2. 列表使用数据懒加载时,除了显示区域的列表项和前后缓存的列表项,其他列表项会被销毁。 + +## 相关实例 + +如需详细了解ArkUI中列表的创建与使用,请参考以下示例: + +- [List组件的使用之商品列表](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/List) + +- [新闻数据加载](https://gitee.com/openharmony/codelabs/tree/master/NetworkManagement/NewsDataArkTS) + +- [音乐专辑页](../key-features/multi-device-app-dev/music-album-page.md) diff --git a/zh-cn/application-dev/ui/arkts-layout-development-create-looping.md b/zh-cn/application-dev/ui/arkts-layout-development-create-looping.md new file mode 100644 index 0000000000000000000000000000000000000000..714b7af86eaa66fffc8827b94a7aa7d5ddb43834 --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-layout-development-create-looping.md @@ -0,0 +1,318 @@ +# 创建轮播 + + +[Swiper](../reference/arkui-ts/ts-container-swiper.md)组件提供滑动轮播显示的能力。Swiper本身是一个容器组件,当设置了多个子组件后,可以对这些子组件进行轮播显示。通常,在一些应用首页显示推荐的内容时,需要用到轮播显示的能力。 + + +## 布局与约束 + +Swiper作为一个容器组件,在自身尺寸属性未被设置时,会自动根据子组件的大小设置自身的尺寸。如果开发者对Swiper组件设置了固定的尺寸,则在轮播显示过程中均以该尺寸生效;否则,在轮播过程中,会根据子组件的大小自动调整自身的尺寸。 + + +## 循环播放 + +通过loop属性控制是否循环播放,该属性默认值为true。 + +当loop为true时,在显示第一页或最后一页时,可以继续往前切换到前一页或者往后切换到后一页。如果loop为false,则在第一页或最后一页时,无法继续向前或者向后切换页面。 + + loop为true: + +```ts +... +private swiperController: SwiperController = new SwiperController() +... +Swiper(this.swiperController) { + Text("0") + .width('90%') + .height('100%') + .backgroundColor(Color.Gray) + .textAlign(TextAlign.Center) + .fontSize(30) + + Text("1") + .width('90%') + .height('100%') + .backgroundColor(Color.Green) + .textAlign(TextAlign.Center) + .fontSize(30) + + Text("2") + .width('90%') + .height('100%') + .backgroundColor(Color.Blue) + .textAlign(TextAlign.Center) + .fontSize(30) +} +.loop(true) +``` + +![loop_true](figures/loop_true.gif) + + loop为false: + +```ts +Swiper(this.swiperController) { + Text("0") + .width('90%') + .height('100%') + .backgroundColor(Color.Gray) + .textAlign(TextAlign.Center) + .fontSize(30) + + Text("1") + .width('90%') + .height('100%') + .backgroundColor(Color.Green) + .textAlign(TextAlign.Center) + .fontSize(30) + + Text("2") + .width('90%') + .height('100%') + .backgroundColor(Color.Blue) + .textAlign(TextAlign.Center) + .fontSize(30) +} +.loop(false) +``` + +![loop_false](figures/loop_false.gif) + + +## 自动轮播 + +Swiper通过设置autoPlay属性,控制是否自动轮播子组件。该属性默认值为false。 + +autoPlay为true时,会自动切换播放子组件,子组件与子组件之间的播放间隔通过interval属性设置。interval属性默认值为3000,单位毫秒。 + + autoPlay为true: + +```ts +Swiper(this.swiperController) { + Text("0") + .width('90%') + .height('100%') + .backgroundColor(Color.Gray) + .textAlign(TextAlign.Center) + .fontSize(30) + + Text("1") + .width('90%') + .height('100%') + .backgroundColor(Color.Green) + .textAlign(TextAlign.Center) + .fontSize(30) + + Text("2") + .width('90%') + .height('100%') + .backgroundColor(Color.Pink) + .textAlign(TextAlign.Center) + .fontSize(30) +} +.loop(true) +.autoPlay(true) +.interval(1000) +``` + +![autoPlay](figures/autoPlay.gif) + + +## 导航点样式 + +Swiper提供了默认的导航点样式,导航点默认显示在Swiper下方居中位置,开发者也可以通过indicatorStyle属性自定义导航点的位置和样式。 + +通过indicatorStyle属性,开发者可以设置导航点相对于Swiper组件上下左右四个方位的位置,同时也可以设置每个导航点的尺寸、颜色、蒙层和被选中导航点的颜色。 + + 导航点使用默认样式: + +```ts +Swiper(this.swiperController) { + Text("0") + .width('90%') + .height('100%') + .backgroundColor(Color.Gray) + .textAlign(TextAlign.Center) + .fontSize(30) + + Text("1") + .width('90%') + .height('100%') + .backgroundColor(Color.Green) + .textAlign(TextAlign.Center) + .fontSize(30) + + Text("2") + .width('90%') + .height('100%') + .backgroundColor(Color.Pink) + .textAlign(TextAlign.Center) + .fontSize(30) +} +``` + +![indicator](figures/indicator.PNG) + + 自定义导航点样式(示例:导航点直径设为30VP,左边距为0,导航点颜色设为红色): + +```ts +Swiper(this.swiperController) { + Text("0") + .width('90%') + .height('100%') + .backgroundColor(Color.Gray) + .textAlign(TextAlign.Center) + .fontSize(30) + + Text("1") + .width('90%') + .height('100%') + .backgroundColor(Color.Green) + .textAlign(TextAlign.Center) + .fontSize(30) + + Text("2") + .width('90%') + .height('100%') + .backgroundColor(Color.Pink) + .textAlign(TextAlign.Center) + .fontSize(30) +} +.indicatorStyle({ + size: 30, + left: 0, + color: Color.Red +}) +``` + +![ind](figures/ind.PNG) + + +## 页面切换方式 + +Swiper支持三种页面切换方式:手指滑动、点击导航点和通过控制器。 + + 通过控制器切换页面: + +```ts +@Entry +@Component +struct SwiperDemo { + private swiperController: SwiperController = new SwiperController(); + + build() { + Column({ space: 5 }) { + Swiper(this.swiperController) { + Text("0") + .width(250) + .height(250) + .backgroundColor(Color.Gray) + .textAlign(TextAlign.Center) + .fontSize(30) + Text("1") + .width(250) + .height(250) + .backgroundColor(Color.Green) + .textAlign(TextAlign.Center) + .fontSize(30) + Text("2") + .width(250) + .height(250) + .backgroundColor(Color.Pink) + .textAlign(TextAlign.Center) + .fontSize(30) + } + .indicator(true) + + Row({ space: 12 }) { + Button('showNext') + .onClick(() => { + this.swiperController.showNext(); // 通过controller切换到后一页 + }) + Button('showPrevious') + .onClick(() => { + this.swiperController.showPrevious(); // 通过controller切换到前一页 + }) + }.margin(5) + }.width('100%') + .margin({ top: 5 }) + } +} +``` + +![controll](figures/controll.gif) + + +## 轮播方向 + +Swiper支持水平和垂直方向上进行轮播,主要通过vertical属性控制。 + +当vertical为true时,表示在垂直方向上进行轮播;为false时,表示在水平方向上进行轮播。vertical默认值为false。 + + + 设置水平方向上轮播: + +```ts +Swiper(this.swiperController) { + ... +} +.indicator(true) +.vertical(false) +``` + + +![截图2](figures/截图2.PNG) + + + 设置垂直方向轮播: + +```ts +Swiper(this.swiperController) { + ... +} +.indicator(true) +.vertical(true) +``` + + +![截图3](figures/截图3.PNG) + + +## 每页显示多个子页面 + +Swiper支持在一个页面内同时显示多个子组件,通过[displayCount](../reference/arkui-ts/ts-container-swiper.md#属性)属性设置。 + + 设置一个页面内显示两个子组件: + +```ts +Swiper(this.swiperController) { + Text("0") + .width(250) + .height(250) + .backgroundColor(Color.Gray) + .textAlign(TextAlign.Center) + .fontSize(30) + Text("1") + .width(250) + .height(250) + .backgroundColor(Color.Green) + .textAlign(TextAlign.Center) + .fontSize(30) + Text("2") + .width(250) + .height(250) + .backgroundColor(Color.Pink) + .textAlign(TextAlign.Center) + .fontSize(30) + Text("3") + .width(250) + .height(250) + .backgroundColor(Color.Blue) + .textAlign(TextAlign.Center) + .fontSize(30) +} +.indicator(true) +.displayCount(2) +``` + +![two](figures/two.PNG) diff --git a/zh-cn/application-dev/ui/arkts-layout-development-flex-layout.md b/zh-cn/application-dev/ui/arkts-layout-development-flex-layout.md new file mode 100644 index 0000000000000000000000000000000000000000..b1b551a4a8d1644618e3fa270214892b9a1cf58c --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-layout-development-flex-layout.md @@ -0,0 +1,626 @@ +# 弹性布局 + + +## 概述 + +弹性布局([Flex](../reference/arkui-ts/ts-container-flex.md))提供更加有效的方式对容器中的子元素进行排列、对齐和分配剩余空间。容器默认存在主轴与交叉轴,子元素默认沿主轴排列,子元素在主轴方向的尺寸称为主轴尺寸,在交叉轴方向的尺寸称为交叉轴尺寸。弹性布局在开发场景中用例特别多,比如页面头部导航栏的均匀分布、页面框架的搭建、多行数据的排列等等。 + + + **图1** 主轴为水平方向的Flex容器示意图   + +![flex-layout](figures/flex-layout.png) + + +## 基本概念 + +- 主轴:Flex组件布局方向的轴线,子元素默认沿着主轴排列。主轴开始的位置称为主轴起始端,结束位置称为主轴终点端。 + +- 交叉轴:垂直于主轴方向的轴线。交叉轴起始的位置称为交叉轴首部,结束位置称为交叉轴尾部。 + + +## 布局方向 + +在弹性布局中,容器的子元素可以按照任意方向排列。通过设置参数direction,可以决定主轴的方向,从而控制子组件的排列方向。 + + **图2** 弹性布局方向图   + +![flex-layout-direction](figures/flex-layout-direction.png) + +- FlexDirection.Row(默认值):主轴为水平方向,子组件从起始端沿着水平方向开始排布。 + + + ```ts + Flex({ direction: FlexDirection.Row }) { + Text('1').width('33%').height(50).backgroundColor(0xF5DEB3) + Text('2').width('33%').height(50).backgroundColor(0xD2B48C) + Text('3').width('33%').height(50).backgroundColor(0xF5DEB3) + } + .height(70) + .width('90%') + .padding(10) + .backgroundColor(0xAFEEEE) + ``` + + ![zh-cn_image_0000001562820817](figures/zh-cn_image_0000001562820817.png) + +- FlexDirection.RowReverse:主轴为水平方向,子组件从终点端沿着FlexDirection. Row相反的方向开始排布。 + + + ```ts + Flex({ direction: FlexDirection.RowReverse }) { + Text('1').width('33%').height(50).backgroundColor(0xF5DEB3) + Text('2').width('33%').height(50).backgroundColor(0xD2B48C) + Text('3').width('33%').height(50).backgroundColor(0xF5DEB3) + } + .height(70) + .width('90%') + .padding(10) + .backgroundColor(0xAFEEEE) + ``` + + ![zh-cn_image_0000001511900464](figures/zh-cn_image_0000001511900464.png) + +- FlexDirection.Column:主轴为垂直方向,子组件从起始端沿着垂直方向开始排布。 + + + ```ts + Flex({ direction: FlexDirection.Column }) { + Text('1').width('100%').height(50).backgroundColor(0xF5DEB3) + Text('2').width('100%').height(50).backgroundColor(0xD2B48C) + Text('3').width('100%').height(50).backgroundColor(0xF5DEB3) + } + .height(70) + .width('90%') + .padding(10) + .backgroundColor(0xAFEEEE) + ``` + + ![zh-cn_image_0000001511580884](figures/zh-cn_image_0000001511580884.png) + +- FlexDirection.ColumnReverse:主轴为垂直方向,子组件从终点端沿着FlexDirection. Column相反的方向开始排布。 + + + ```ts + Flex({ direction: FlexDirection.ColumnReverse }) { + Text('1').width('100%').height(50).backgroundColor(0xF5DEB3) + Text('2').width('100%').height(50).backgroundColor(0xD2B48C) + Text('3').width('100%').height(50).backgroundColor(0xF5DEB3) + } + .height(70) + .width('90%') + .padding(10) + .backgroundColor(0xAFEEEE) + ``` + + ![zh-cn_image_0000001562940541](figures/zh-cn_image_0000001562940541.png) + + +## 布局换行 + +弹性布局分为单行布局和多行布局。默认情况下,Flex容器中的子元素都排在一条线(又称“轴线”)上。wrap属性控制当子元素主轴尺寸之和大于容器主轴尺寸时,Flex是单行布局还是多行布局。在多行布局时,通过交叉轴方向,确认新行堆叠方向。 + +- FlexWrap. NoWrap(默认值):不换行。如果子组件的宽度总和大于父元素的宽度,则子组件会被压缩宽度。 + + + ```ts + Flex({ wrap: FlexWrap.NoWrap }) { + Text('1').width('50%').height(50).backgroundColor(0xF5DEB3) + Text('2').width('50%').height(50).backgroundColor(0xD2B48C) + Text('3').width('50%').height(50).backgroundColor(0xF5DEB3) + } + .width('90%') + .padding(10) + .backgroundColor(0xAFEEEE) + ``` + + ![zh-cn_image_0000001562700425](figures/zh-cn_image_0000001562700425.png) + +- FlexWrap. Wrap:换行,每一行子组件按照主轴方向排列。 + + + ```ts + Flex({ wrap: FlexWrap.Wrap }) { + Text('1').width('50%').height(50).backgroundColor(0xF5DEB3) + Text('2').width('50%').height(50).backgroundColor(0xD2B48C) + Text('3').width('50%').height(50).backgroundColor(0xD2B48C) + } + .width('90%') + .padding(10) + .backgroundColor(0xAFEEEE) + ``` + + ![zh-cn_image_0000001511740468](figures/zh-cn_image_0000001511740468.png) + +- FlexWrap. WrapReverse:换行,每一行子组件按照主轴反方向排列。 + + + ```ts + Flex({ wrap: FlexWrap.WrapReverse}) { + Text('1').width('50%').height(50).backgroundColor(0xF5DEB3) + Text('2').width('50%').height(50).backgroundColor(0xD2B48C) + Text('3').width('50%').height(50).backgroundColor(0xF5DEB3) + } + .width('90%') + .padding(10) + .backgroundColor(0xAFEEEE) + ``` + + ![zh-cn_image_0000001562940521](figures/zh-cn_image_0000001562940521.png) + + +## 主轴对齐方式 + +通过justifyContent参数设置在主轴方向的对齐方式。 + +![flex-spindle-alignment](figures/flex-spindle-alignment.png) + + +- FlexAlign.Start(默认值):子组件在主轴方向起始端对齐, 第一个子组件与父元素边沿对齐,其他元素与前一个元素对齐。 + + + ```ts + Flex({ justifyContent: FlexAlign.Start }) { + Text('1').width('20%').height(50).backgroundColor(0xF5DEB3) + Text('2').width('20%').height(50).backgroundColor(0xD2B48C) + Text('3').width('20%').height(50).backgroundColor(0xF5DEB3) + } + .width('90%') + .padding({ top: 10, bottom: 10 }) + .backgroundColor(0xAFEEEE) + ``` + + ![zh-cn_image_0000001511421280](figures/zh-cn_image_0000001511421280.png) + +- FlexAlign.Center:子组件在主轴方向居中对齐。 + + + ```ts + Flex({ justifyContent: FlexAlign.Center }) { + Text('1').width('20%').height(50).backgroundColor(0xF5DEB3) + Text('2').width('20%').height(50).backgroundColor(0xD2B48C) + Text('3').width('20%').height(50).backgroundColor(0xF5DEB3) + } + .width('90%') + .padding({ top: 10, bottom: 10 }) + .backgroundColor(0xAFEEEE) + ``` + + ![zh-cn_image_0000001563060681](figures/zh-cn_image_0000001563060681.png) + +- FlexAlign.End:子组件在主轴方向终点端对齐, 最后一个子组件与父元素边沿对齐,其他元素与后一个元素对齐。 + + + ```ts + Flex({ justifyContent: FlexAlign.End }) { + Text('1').width('20%').height(50).backgroundColor(0xF5DEB3) + Text('2').width('20%').height(50).backgroundColor(0xD2B48C) + Text('3').width('20%').height(50).backgroundColor(0xF5DEB3) + } + .width('90%') + .padding({ top: 10, bottom: 10 }) + .backgroundColor(0xAFEEEE) + ``` + + ![zh-cn_image_0000001562820809](figures/zh-cn_image_0000001562820809.png) + +- FlexAlign.SpaceBetween:Flex主轴方向均匀分配弹性元素,相邻子组件之间距离相同。第一个子组件和最后一个子组件与父元素边沿对齐。 + + + ```ts + Flex({ justifyContent: FlexAlign.SpaceBetween }) { + Text('1').width('20%').height(50).backgroundColor(0xF5DEB3) + Text('2').width('20%').height(50).backgroundColor(0xD2B48C) + Text('3').width('20%').height(50).backgroundColor(0xF5DEB3) + } + .width('90%') + .padding({ top: 10, bottom: 10 }) + .backgroundColor(0xAFEEEE) + ``` + + ![zh-cn_image_0000001511421288](figures/zh-cn_image_0000001511421288.png) + +- FlexAlign.SpaceAround:Flex主轴方向均匀分配弹性元素,相邻子组件之间距离相同。第一个子组件到主轴起始端的距离和最后一个子组件到主轴终点端的距离是相邻元素之间距离的一半。 + + + ```ts + Flex({ justifyContent: FlexAlign.SpaceAround }) { + Text('1').width('20%').height(50).backgroundColor(0xF5DEB3) + Text('2').width('20%').height(50).backgroundColor(0xD2B48C) + Text('3').width('20%').height(50).backgroundColor(0xF5DEB3) + } + .width('90%') + .padding({ top: 10, bottom: 10 }) + .backgroundColor(0xAFEEEE) + ``` + + ![zh-cn_image_0000001511900436](figures/zh-cn_image_0000001511900436.png) + +- FlexAlign.SpaceEvenly:Flex主轴方向元素等间距布局,相邻子组件之间的间距、第一个子组件与主轴起始端的间距、最后一个子组件到主轴终点端的间距均相等。 + + + ```ts + Flex({ justifyContent: FlexAlign.SpaceEvenly }) { + Text('1').width('20%').height(50).backgroundColor(0xF5DEB3) + Text('2').width('20%').height(50).backgroundColor(0xD2B48C) + Text('3').width('20%').height(50).backgroundColor(0xF5DEB3) + } + .width('90%') + .padding({ top: 10, bottom: 10 }) + .backgroundColor(0xAFEEEE) + ``` + + ![zh-cn_image_0000001563060713](figures/zh-cn_image_0000001563060713.png) + + +## 交叉轴对齐方式 + +容器和子元素都可以设置交叉轴对齐方式,且子元素设置的对齐方式优先级较高。 + + +### 容器组件设置交叉轴对齐 + +可以通过Flex组件的alignItems参数设置子组件在交叉轴的对齐方式。 + + +- ItemAlign.Auto:使用Flex容器中默认配置。 + + + ```ts + Flex({ alignItems: ItemAlign.Auto }) { + Text('1').width('33%').height(30).backgroundColor(0xF5DEB3) + Text('2').width('33%').height(40).backgroundColor(0xD2B48C) + Text('3').width('33%').height(50).backgroundColor(0xF5DEB3) + } + .size({ width: '90%', height: 80 }) + .padding(10) + .backgroundColor(0xAFEEEE) + ``` + + ![zh-cn_image_0000001563060677](figures/zh-cn_image_0000001563060677.png) + +- ItemAlign.Start:交叉轴方向首部对齐。 + + + ```ts + Flex({ alignItems: ItemAlign.Start }) { + Text('1').width('33%').height(30).backgroundColor(0xF5DEB3) + Text('2').width('33%').height(40).backgroundColor(0xD2B48C) + Text('3').width('33%').height(50).backgroundColor(0xF5DEB3) + } + .size({ width: '90%', height: 80 }) + .padding(10) + .backgroundColor(0xAFEEEE) + ``` + + ![zh-cn_image_0000001562700453](figures/zh-cn_image_0000001562700453.png) + +- ItemAlign.Center:交叉轴方向居中对齐。 + + + ```ts + Flex({ alignItems: ItemAlign.Center }) { + Text('1').width('33%').height(30).backgroundColor(0xF5DEB3) + Text('2').width('33%').height(40).backgroundColor(0xD2B48C) + Text('3').width('33%').height(50).backgroundColor(0xF5DEB3) + } + .size({ width: '90%', height: 80 }) + .padding(10) + .backgroundColor(0xAFEEEE) + ``` + + ![zh-cn_image_0000001511740484](figures/zh-cn_image_0000001511740484.png) + +- ItemAlign.End:交叉轴方向底部对齐。 + + + ```ts + Flex({ alignItems: ItemAlign.End }) { + Text('1').width('33%').height(30).backgroundColor(0xF5DEB3) + Text('2').width('33%').height(40).backgroundColor(0xD2B48C) + Text('3').width('33%').height(50).backgroundColor(0xF5DEB3) + } + .size({ width: '90%', height: 80 }) + .padding(10) + .backgroundColor(0xAFEEEE) + ``` + + ![zh-cn_image_0000001511580876](figures/zh-cn_image_0000001511580876.png) + +- ItemAlign.Stretch:交叉轴方向拉伸填充,在未设置尺寸时,拉伸到容器尺寸。 + + + ```ts + Flex({ alignItems: ItemAlign.Stretch }) { + Text('1').width('33%').height(30).backgroundColor(0xF5DEB3) + Text('2').width('33%').height(40).backgroundColor(0xD2B48C) + Text('3').width('33%').height(50).backgroundColor(0xF5DEB3) + } + .size({ width: '90%', height: 80 }) + .padding(10) + .backgroundColor(0xAFEEEE) + ``` + + ![zh-cn_image_0000001511421252](figures/zh-cn_image_0000001511421252.png) + +- ItemAlign. Baseline:交叉轴方向文本基线对齐。 + + + ```ts + Flex({ alignItems: ItemAlign.Baseline }) { + Text('1').width('33%').height(30).backgroundColor(0xF5DEB3) + Text('2').width('33%').height(40).backgroundColor(0xD2B48C) + Text('3').width('33%').height(50).backgroundColor(0xF5DEB3) + } + .size({ width: '90%', height: 80 }) + .padding(10) + .backgroundColor(0xAFEEEE) + ``` + + ![zh-cn_image_0000001511900440](figures/zh-cn_image_0000001511900440.png) + + +### 子组件设置交叉轴对齐 + +子组件的[alignSelf](../reference/arkui-ts/ts-universal-attributes-flex-layout.md)属性也可以设置子组件在父容器交叉轴的对齐格式,且会覆盖Flex布局容器中alignItems配置。如下例所示: + + + +```ts +Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) { // 容器组件设置子组件居中 + Text('alignSelf Start').width('25%').height(80) + .alignSelf(ItemAlign.Start) + .backgroundColor(0xF5DEB3) + Text('alignSelf Baseline') + .alignSelf(ItemAlign.Baseline) + .width('25%') + .height(80) + .backgroundColor(0xD2B48C) + Text('alignSelf Baseline').width('25%').height(100) + .backgroundColor(0xF5DEB3) + .alignSelf(ItemAlign.Baseline) + Text('no alignSelf').width('25%').height(100) + .backgroundColor(0xD2B48C) + Text('no alignSelf').width('25%').height(100) + .backgroundColor(0xF5DEB3) + +}.width('90%').height(220).backgroundColor(0xAFEEEE) +``` + + +![zh-cn_image_0000001562940533](figures/zh-cn_image_0000001562940533.png) + + +上例中,Flex容器中alignItems设置交叉轴子组件的对齐方式为居中,子组件自身设置了alignSelf属性的情况,覆盖父组件的alignItems值,表现为alignSelf的定义。 + + +### 内容对齐 + +可以通过[alignContent](../reference/arkui-ts/ts-container-flex.md)参数设置子组件各行在交叉轴剩余空间内的对齐方式,只在多行的flex布局中生效,可选值有: + +- FlexAlign.Start:子组件各行与交叉轴起点对齐。 + + + ```ts + Flex({ justifyContent: FlexAlign.SpaceBetween, wrap: FlexWrap.Wrap, alignContent: FlexAlign.Start }) { + Text('1').width('30%').height(20).backgroundColor(0xF5DEB3) + Text('2').width('60%').height(20).backgroundColor(0xD2B48C) + Text('3').width('40%').height(20).backgroundColor(0xD2B48C) + Text('4').width('30%').height(20).backgroundColor(0xF5DEB3) + Text('5').width('20%').height(20).backgroundColor(0xD2B48C) + } + .width('90%') + .height(100) + .backgroundColor(0xAFEEEE) + ``` + + ![zh-cn_image_0000001511900460](figures/zh-cn_image_0000001511900460.png) + +- FlexAlign.Center:子组件各行在交叉轴方向居中对齐。 + + + ```ts + Flex({ justifyContent: FlexAlign.SpaceBetween, wrap: FlexWrap.Wrap, alignContent: FlexAlign.Center }) { + Text('1').width('30%').height(20).backgroundColor(0xF5DEB3) + Text('2').width('60%').height(20).backgroundColor(0xD2B48C) + Text('3').width('40%').height(20).backgroundColor(0xD2B48C) + Text('4').width('30%').height(20).backgroundColor(0xF5DEB3) + Text('5').width('20%').height(20).backgroundColor(0xD2B48C) + } + .width('90%') + .height(100) + .backgroundColor(0xAFEEEE) + ``` + + ![zh-cn_image_0000001511421256](figures/zh-cn_image_0000001511421256.png) + +- FlexAlign.End:子组件各行与交叉轴终点对齐。 + + + ```ts + Flex({ justifyContent: FlexAlign.SpaceBetween, wrap: FlexWrap.Wrap, alignContent: FlexAlign.End }) { + Text('1').width('30%').height(20).backgroundColor(0xF5DEB3) + Text('2').width('60%').height(20).backgroundColor(0xD2B48C) + Text('3').width('40%').height(20).backgroundColor(0xD2B48C) + Text('4').width('30%').height(20).backgroundColor(0xF5DEB3) + Text('5').width('20%').height(20).backgroundColor(0xD2B48C) + } + .width('90%') + .height(100) + .backgroundColor(0xAFEEEE) + ``` + + ![zh-cn_image_0000001562820801](figures/zh-cn_image_0000001562820801.png) + +- FlexAlign.SpaceBetween:子组件各行与交叉轴两端对齐,各行间垂直间距平均分布。 + + + ```ts + Flex({ justifyContent: FlexAlign.SpaceBetween, wrap: FlexWrap.Wrap, alignContent: FlexAlign.SpaceBetween }) { + Text('1').width('30%').height(20).backgroundColor(0xF5DEB3) + Text('2').width('60%').height(20).backgroundColor(0xD2B48C) + Text('3').width('40%').height(20).backgroundColor(0xD2B48C) + Text('4').width('30%').height(20).backgroundColor(0xF5DEB3) + Text('5').width('20%').height(20).backgroundColor(0xD2B48C) + } + .width('90%') + .height(100) + .backgroundColor(0xAFEEEE) + ``` + + ![zh-cn_image_0000001511900448](figures/zh-cn_image_0000001511900448.png) + +- FlexAlign.SpaceAround:子组件各行间距相等,是元素首尾行与交叉轴两端距离的两倍。 + + + ```ts + Flex({ justifyContent: FlexAlign.SpaceBetween, wrap: FlexWrap.Wrap, alignContent: FlexAlign.SpaceAround }) { + Text('1').width('30%').height(20).backgroundColor(0xF5DEB3) + Text('2').width('60%').height(20).backgroundColor(0xD2B48C) + Text('3').width('40%').height(20).backgroundColor(0xD2B48C) + Text('4').width('30%').height(20).backgroundColor(0xF5DEB3) + Text('5').width('20%').height(20).backgroundColor(0xD2B48C) + } + .width('90%') + .height(100) + .backgroundColor(0xAFEEEE) + ``` + + ![zh-cn_image_0000001562700445](figures/zh-cn_image_0000001562700445.png) + +- FlexAlign.SpaceEvenly: 子组件各行间距,子组件首尾行与交叉轴两端距离都相等。 + + + ```ts + Flex({ justifyContent: FlexAlign.SpaceBetween, wrap: FlexWrap.Wrap, alignContent: FlexAlign.SpaceEvenly }) { + Text('1').width('30%').height(20).backgroundColor(0xF5DEB3) + Text('2').width('60%').height(20).backgroundColor(0xD2B48C) + Text('3').width('40%').height(20).backgroundColor(0xD2B48C) + Text('4').width('30%').height(20).backgroundColor(0xF5DEB3) + Text('5').width('20%').height(20).backgroundColor(0xD2B48C) + } + .width('90%') + .height(100) + .backgroundColor(0xAFEEEE) + ``` + + ![zh-cn_image_0000001511580864](figures/zh-cn_image_0000001511580864.png) + + +## 自适应拉伸 + +在弹性布局父组件尺寸不够大的时候,通过子组件的下面几个属性设置其在父容器的占比,达到自适应布局能力。 + +- flexBasis:设置子组件在父容器主轴方向上的基准尺寸。如果设置了该值,则子项占用的空间为设置的值;如果没设置该属性,那子项的空间为width/height的值。 + + + ```ts + Flex() { + Text('flexBasis("auto")') + .flexBasis('auto') // 未设置width以及flexBasis值为auto,内容自身宽松 + .height(100) + .backgroundColor(0xF5DEB3) + Text('flexBasis("auto")'+' width("40%")') + .width('40%') + .flexBasis('auto') //设置width以及flexBasis值auto,使用width的值 + .height(100) + .backgroundColor(0xD2B48C) + + Text('flexBasis(100)') // 未设置width以及flexBasis值为100,宽度为100vp + .flexBasis(100) + .height(100) + .backgroundColor(0xF5DEB3) + + Text('flexBasis(100)') + .flexBasis(100) + .width(200) // flexBasis值为100,覆盖width的设置值,宽度为100vp + .height(100) + .backgroundColor(0xD2B48C) + }.width('90%').height(120).padding(10).backgroundColor(0xAFEEEE) + ``` + + ![zh-cn_image_0000001562940505](figures/zh-cn_image_0000001562940505.png) + +- flexGrow:设置父容器的剩余空间分配给此属性所在组件的比例。用于“瓜分”父组件的剩余空间。 + + + ```ts + Flex() { + Text('flexGrow(1)') + .flexGrow(2) + .width(100) + .height(100) + .backgroundColor(0xF5DEB3) + + Text('flexGrow(2)') + .flexGrow(2) + .width(100) + .height(100) + .backgroundColor(0xD2B48C) + + Text('no flexGrow') + .width(100) + .height(100) + .backgroundColor(0xF5DEB3) + }.width(400).height(120).padding(10).backgroundColor(0xAFEEEE) + ``` + + ![zh-cn_image_0000001562700449](figures/zh-cn_image_0000001562700449.png) + + 父容器宽度400vp,三个子组件原始宽度为100vp,总和300vp,剩余空间100vp根据flexGrow值的占比分配给子组件,未设置flexGrow的子组件不参与“瓜分”。 + + 第一个元素以及第二个元素以2:3分配剩下的100vp。第一个元素为100vp+100vp2/5=140vp,第二个元素为100vp+100vp3/5=160vp。 + +- flexShrink: 当父容器空间不足时,子组件的压缩比例。 + + + ```ts + Flex({ direction: FlexDirection.Row }) { + Text('flexShrink(3)') + .flexShrink(3) + .width(200) + .height(100) + .backgroundColor(0xF5DEB3) + + Text('no flexShrink') + .width(200) + .height(100) + .backgroundColor(0xD2B48C) + + Text('flexShrink(2)') + .flexShrink(2) + .width(200) + .height(100) + .backgroundColor(0xF5DEB3) + }.width(400).height(120).padding(10).backgroundColor(0xAFEEEE) + ``` + + ![zh-cn_image_0000001562820813](figures/zh-cn_image_0000001562820813.png) + + +## 相关实例 + +使用弹性布局,可以实现子组件沿水平方向排列,两端对齐,子组件间距平分,竖直方向上子组件居中的效果。 + + +```ts +@Entry +@Component +struct FlexExample { + build() { + Column() { + Column({ space: 5 }) { + Flex({ direction: FlexDirection.Row, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { + Text('1').width('30%').height(50).backgroundColor(0xF5DEB3) + Text('2').width('30%').height(50).backgroundColor(0xD2B48C) + Text('3').width('30%').height(50).backgroundColor(0xF5DEB3) + } + .height(70) + .width('90%') + .backgroundColor(0xAFEEEE) + }.width('100%').margin({ top: 5 }) + }.width('100%') + } +} +``` + +![zh-cn_image_0000001511900452](figures/zh-cn_image_0000001511900452.png) diff --git a/zh-cn/application-dev/ui/arkts-layout-development-grid-layout.md b/zh-cn/application-dev/ui/arkts-layout-development-grid-layout.md new file mode 100644 index 0000000000000000000000000000000000000000..b148fb8cdd1e8dd939475199d8abda32772d1a6a --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-layout-development-grid-layout.md @@ -0,0 +1,481 @@ +# 栅格布局 + + +## 概述 + +栅格布局是一种通用的辅助定位工具,对移动设备的界面设计有较好的借鉴作用。主要优势包括: + +1. 提供可循的规律:栅格布局可以为布局提供规律性的结构,解决多尺寸多设备的动态布局问题。通过将页面划分为等宽的列数和行数,可以方便地对页面元素进行定位和排版。 + +2. 统一的定位标注:栅格布局可以为系统提供一种统一的定位标注,保证不同设备上各个模块的布局一致性。这可以减少设计和开发的复杂度,提高工作效率。 + +3. 灵活的间距调整方法:栅格布局可以提供一种灵活的间距调整方法,满足特殊场景布局调整的需求。通过调整列与列之间和行与行之间的间距,可以控制整个页面的排版效果。 + +4. 自动换行和自适应:栅格布局可以完成一对多布局的自动换行和自适应。当页面元素的数量超出了一行或一列的容量时,他们会自动换到下一行或下一列,并且在不同的设备上自适应排版,使得页面布局更加灵活和适应性强。 + +[GridRow](../reference/arkui-ts/ts-container-gridrow.md)为栅格容器组件,需与栅格子组件[GridCol](../reference/arkui-ts/ts-container-gridcol.md)在栅格布局场景中联合使用。 + + +## 栅格容器GridRow + + +### 栅格系统断点 + +栅格系统以设备的水平宽度(屏幕密度像素值,单位vp)作为断点依据,定义设备的宽度类型,形成了一套断点规则。开发者可根据需求在不同的断点区间实现不同的页面布局效果。 + +栅格系统默认断点将设备宽度分为xs、sm、md、lg四类,尺寸范围如下: + +| 断点名称 | 取值范围(vp) | 设备描述 | +| ---- | --------------- | --------- | +| xs | [0, 320) | 最小宽度类型设备。 | +| sm | [320, 520) | 小宽度类型设备。 | +| md | [520, 840) | 中等宽度类型设备。 | +| lg | [840, +∞) | 大宽度类型设备。 | + +在GridRow栅格组件中,允许开发者使用breakpoints自定义修改断点的取值范围,最多支持6个断点,除了默认的四个断点外,还可以启用xl,xxl两个断点,支持六种不同尺寸(xs, sm, md, lg, xl, xxl)设备的布局设置。 + +| 断点名称 | 设备描述 | +| ---- | --------- | +| xs | 最小宽度类型设备。 | +| sm | 小宽度类型设备。 | +| md | 中等宽度类型设备。 | +| lg | 大宽度类型设备。 | +| xl | 特大宽度类型设备。 | +| xxl | 超大宽度类型设备。 | + +- 针对断点位置,开发者根据实际使用场景,通过一个单调递增数组设置。由于breakpoints最多支持六个断点,单调递增数组长度最大为5。 + + + ```ts + breakpoints: {value: ['100vp', '200vp']} + ``` + + 表示启用xs、sm、md共3个断点,小于100vp为xs,100vp-200vp为sm,大于200vp为md。 + + + ```ts + breakpoints: {value: ['320vp', '520vp', '840vp', '1080vp']} + ``` + + 表示启用xs、sm、md、lg、xl共5个断点,小于320vp为xs,320vp-520vp为sm,520vp-840vp为md,840vp-1080vp为lg,大于1080vp为xl。 + +- 栅格系统通过监听窗口或容器的尺寸变化进行断点,通过reference设置断点切换参考物。 考虑到应用可能以非全屏窗口的形式显示,以应用窗口宽度为参照物更为通用。 + +例如,使用栅格的默认列数12列,通过断点设置将应用宽度分成六个区间,在各区间中,每个栅格子元素占用的列数均不同。 + + +```ts +@State bgColors: Color[] = [Color.Red, Color.Orange, Color.Yellow, Color.Green, Color.Pink, Color.Grey, Color.Blue, Color.Brown]; +... +GridRow({ + breakpoints: { + value: ['200vp', '300vp', '400vp', '500vp', '600vp'], + reference: BreakpointsReference.WindowSize + } +}) { + ForEach(this.bgColors, (color, index) => { + GridCol({ + span: { + xs: 2, + sm: 3, + md: 4, + lg: 6, + xl: 8, + xxl: 12 + } + }) { + Row() { + Text(`${index}`) + }.width("100%").height('50vp') + }.backgroundColor(color) + }) +} +``` + +![zh-cn_image_0000001511421272](figures/zh-cn_image_0000001511421272.gif) + + +### 布局的总列数 + +GridRow中通过columns设置栅格布局的总列数。 + +- columns默认值为12,即在未设置columns时,任何断点下,栅格布局被分成12列。 + + + ```ts + @State bgColors: Color[] = [Color.Red, Color.Orange, Color.Yellow, Color.Green, Color.Pink, Color.Grey, Color.Blue, Color.Brown]; + ... + GridRow() { + ForEach(this.bgColors, (item, index) => { + GridCol() { + Row() { + Text(`${index + 1}`) + }.width('100%').height('50') + }.backgroundColor(item) + }) + } + ``` + + ![zh-cn_image_0000001563060709](figures/zh-cn_image_0000001563060709.png) + +- 当columns为自定义值,栅格布局在任何尺寸设备下都被分为columns列。下面分别设置栅格布局列数为4和8,子元素默认占一列,效果如下: + + + ```ts + @State bgColors: Color[] = [Color.Red, Color.Orange, Color.Yellow, Color.Green, Color.Pink, Color.Grey, Color.Blue, Color.Brown]; + @State currentBp: string = 'unknown'; + ... + Row() { + GridRow({ columns: 4 }) { + ForEach(this.bgColors, (item, index) => { + GridCol() { + Row() { + Text(`${index + 1}`) + }.width('100%').height('50') + }.backgroundColor(item) + }) + } + .width('100%').height('100%') + .onBreakpointChange((breakpoint) => { + this.currentBp = breakpoint + }) + } + .height(160) + .border({ color: Color.Blue, width: 2 }) + .width('90%') + + Row() { + GridRow({ columns: 8 }) { + ForEach(this.bgColors, (item, index) => { + GridCol() { + Row() { + Text(`${index + 1}`) + }.width('100%').height('50') + }.backgroundColor(item) + }) + } + .width('100%').height('100%') + .onBreakpointChange((breakpoint) => { + this.currentBp = breakpoint + }) + } + .height(160) + .border({ color: Color.Blue, width: 2 }) + .width('90%') + ``` + + ![zh-cn_image_0000001511421268](figures/zh-cn_image_0000001511421268.png) + +- 当columns类型为GridRowColumnOption时,支持下面六种不同尺寸(xs, sm, md, lg, xl, xxl)设备的总列数设置,各个尺寸下数值可不同。 + + + ```ts + @State bgColors: Color[] = [Color.Red, Color.Orange, Color.Yellow, Color.Green, Color.Pink, Color.Grey, Color.Blue, Color.Brown] + GridRow({ columns: { sm: 4, md: 8 }, breakpoints: { value: ['200vp', '300vp', '400vp', '500vp', '600vp'] } }) { + ForEach(this.bgColors, (item, index) => { + GridCol() { + Row() { + Text(`${index + 1}`) + }.width('100%').height('50') + }.backgroundColor(item) + }) + } + ``` + + ![zh-cn_image_0000001563060689](figures/zh-cn_image_0000001563060689.gif) + + 若只设置sm, md的栅格总列数,则较小的尺寸使用默认columns值12,较大的尺寸使用前一个尺寸的columns。这里只设置sm:8, md:10,则较小尺寸的xs:12,较大尺寸的参照md的设置,lg:10, xl:10, xxl:10 + + +### 排列方向 + +栅格布局中,可以通过设置GridRow的direction属性来指定栅格子组件在栅格容器中的排列方向。该属性可以设置为GridRowDirection.Row(从左往右排列)或GridRowDirection.RowReverse(从右往左排列),以满足不同的布局需求。通过合理的direction属性设置,可以使得页面布局更加灵活和符合设计要求。 + +- 子组件默认从左往右排列。 + + + ```ts + GridRow({ direction: GridRowDirection.Row }){} + ``` + + ![zh-cn_image_0000001511740488](figures/zh-cn_image_0000001511740488.png) + +- 子组件从右往左排列。 + + + ```ts + GridRow({ direction: GridRowDirection.RowReverse }){} + ``` + + ![zh-cn_image_0000001562940517](figures/zh-cn_image_0000001562940517.png) + + +### 子组件间距 + +GridRow中通过gutter属性设置子元素在水平和垂直方向的间距。 + +- 当gutter类型为number时,同时设置栅格子组件间水平和垂直方向边距且相等。下例中,设置子组件水平与垂直方向距离相邻元素的间距为10。 + + + ```ts + GridRow({ gutter: 10 }){} + ``` + + ![zh-cn_image_0000001511740476](figures/zh-cn_image_0000001511740476.png) + +- 当gutter类型为GutterOption时,单独设置栅格子组件水平垂直边距,x属性为水平方向间距,y为垂直方向间距。 + + + ```ts + GridRow({ gutter: { x: 20, y: 50 } }){} + ``` + + ![zh-cn_image_0000001511900456](figures/zh-cn_image_0000001511900456.png) + + +## 子组件GridCol + +GridCol组件作为GridRow组件的子组件,通过给GridCol传参或者设置属性两种方式,设置span(占用列数),offset(偏移列数),order(元素序号)的值。 + +- 设置span。 + + + ```ts + GridCol({ span: 2 }){} + GridCol({ span: { xs: 1, sm: 2, md: 3, lg: 4 } }){} + GridCol(){}.span(2) + GridCol(){}.span({ xs: 1, sm: 2, md: 3, lg: 4 }) + ``` + +- 设置offset。 + + + ```ts + GridCol({ offset: 2 }){} + GridCol({ offset: { xs: 2, sm: 2, md: 2, lg: 2 } }){} + GridCol(){}.offset(2) + GridCol(){}.offset({ xs: 1, sm: 2, md: 3, lg: 4 }) + ``` + +- 设置order。 + + + ```ts + GridCol({ order: 2 }){} + GridCol({ order: { xs: 1, sm: 2, md: 3, lg: 4 } }){} + GridCol(){}.order(2) + GridCol(){}.order({ xs: 1, sm: 2, md: 3, lg: 4 }) + ``` + + +### span + +子组件占栅格布局的列数,决定了子组件的宽度,默认为1。 + +- 当类型为number时,子组件在所有尺寸设备下占用的列数相同。 + + + ```ts + @State bgColors: Color[] = [Color.Red, Color.Orange, Color.Yellow, Color.Green, Color.Pink, Color.Grey, Color.Blue, Color.Brown]; + ... + GridRow({ columns: 8 }) { + ForEach(this.bgColors, (color, index) => { + GridCol({ span: 2 }) { + Row() { + Text(`${index}`) + }.width('100%').height('50vp') + } + .backgroundColor(color) + }) + } + ``` + + ![zh-cn_image_0000001511421264](figures/zh-cn_image_0000001511421264.png) + +- 当类型为GridColColumnOption时,支持六种不同尺寸(xs, sm, md, lg, xl, xxl)设备中子组件所占列数设置,各个尺寸下数值可不同。 + + + ```ts + @State bgColors: Color[] = [Color.Red, Color.Orange, Color.Yellow, Color.Green, Color.Pink, Color.Grey, Color.Blue, Color.Brown]; + ... + GridRow({ columns: 8 }) { + ForEach(this.bgColors, (color, index) => { + GridCol({ span: { xs: 1, sm: 2, md: 3, lg: 4 } }) { + Row() { + Text(`${index}`) + }.width('100%').height('50vp') + } + .backgroundColor(color) + }) + } + ``` + + ![zh-cn_image_0000001511740492](figures/zh-cn_image_0000001511740492.gif) + + +### offset + +栅格子组件相对于前一个子组件的偏移列数,默认为0。 + +- 当类型为number时,子组件偏移相同列数。 + + + ```ts + @State bgColors: Color[] = [Color.Red, Color.Orange, Color.Yellow, Color.Green, Color.Pink, Color.Grey, Color.Blue, Color.Brown]; + ... + GridRow() { + ForEach(this.bgColors, (color, index) => { + GridCol({ offset: 2 }) { + Row() { + Text('' + index) + }.width('100%').height('50vp') + } + .backgroundColor(color) + }) + } + ``` + + ![zh-cn_image_0000001563060705](figures/zh-cn_image_0000001563060705.png) + + 栅格默认分成12列,每一个子组件默认占1列,偏移2列,每个子组件及间距共占3列,一行放四个子组件。 + +- 当类型为GridColColumnOption时,支持六种不同尺寸(xs, sm, md, lg, xl, xxl)设备中子组件所占列数设置,各个尺寸下数值可不同。 + + + ```ts + @State bgColors: Color[] = [Color.Red, Color.Orange, Color.Yellow, Color.Green, Color.Pink, Color.Grey, Color.Blue, Color.Brown]; + ... + + GridRow() { + ForEach(this.bgColors, (color, index) => { + GridCol({ offset: { xs: 1, sm: 2, md: 3, lg: 4 } }) { + Row() { + Text('' + index) + }.width('100%').height('50vp') + } + .backgroundColor(color) + }) + } + ``` + + ![zh-cn_image_0000001562700433](figures/zh-cn_image_0000001562700433.gif) + + +### order + +栅格子组件的序号,决定子组件排列次序。当子组件不设置order或者设置相同的order, 子组件按照代码顺序展示。当子组件设置不同的order时,order较小的组件在前,较大的在后。 + +当子组件部分设置order,部分不设置order时,未设置order的子组件依次排序靠前,设置了order的子组件按照数值从小到大排列。 + +- 当类型为number时,子组件在任何尺寸下排序次序一致。 + + + ```ts + GridRow() { + GridCol({ order: 4 }) { + Row() { + Text('1') + }.width('100%').height('50vp') + }.backgroundColor(Color.Red) + GridCol({ order: 3 }) { + Row() { + Text('2') + }.width('100%').height('50vp') + }.backgroundColor(Color.Orange) + GridCol({ order: 2 }) { + Row() { + Text('3') + }.width('100%').height('50vp') + }.backgroundColor(Color.Yellow) + GridCol({ order: 1 }) { + Row() { + Text('4') + }.width('100%').height('50vp') + }.backgroundColor(Color.Green) + } + ``` + + ![zh-cn_image_0000001511580892](figures/zh-cn_image_0000001511580892.png) + +- 当类型为GridColColumnOption时,支持六种不同尺寸(xs, sm, md, lg, xl, xxl)设备中子组件排序次序设置。在xs设备中,子组件排列顺序为1234;sm为2341,md为3412,lg为2431。 + + + ```ts + GridRow() { + GridCol({ order: { xs:1, sm:5, md:3, lg:7}}) { + Row() { + Text('1') + }.width('100%').height('50vp') + }.backgroundColor(Color.Red) + GridCol({ order: { xs:2, sm:2, md:6, lg:1} }) { + Row() { + Text('2') + }.width('100%').height('50vp') + }.backgroundColor(Color.Orange) + GridCol({ order: { xs:3, sm:3, md:1, lg:6} }) { + Row() { + Text('3') + }.width('100%').height('50vp') + }.backgroundColor(Color.Yellow) + GridCol({ order: { xs:4, sm:4, md:2, lg:5} }) { + Row() { + Text('4') + }.width('100%').height('50vp') + }.backgroundColor(Color.Green) + } + ``` + + ![zh-cn_image_0000001511900444](figures/zh-cn_image_0000001511900444.gif) + + +## 栅格组件的嵌套使用 + +栅格组件也可以嵌套使用,完成一些复杂的布局。 + +以下示例中,栅格把整个空间分为12份。第一层GridRow嵌套GridCol,分为中间大区域以及“footer”区域。第二层GridRow嵌套GridCol,分为“left”和“right”区域。子组件空间按照上一层父组件的空间划分,粉色的区域是屏幕空间的12列,绿色和蓝色的区域是父组件GridCol的12列,依次进行空间的划分。 + + + +```ts +@Entry +@Component +struct GridRowExample { + build() { + GridRow() { + GridCol({ span: { sm: 12 } }) { + GridRow() { + GridCol({ span: { sm: 2 } }) { + Row() { + Text('left').fontSize(24) + } + .justifyContent(FlexAlign.Center) + .height('90%') + }.backgroundColor('#ff41dbaa') + + GridCol({ span: { sm: 10 } }) { + Row() { + Text('right').fontSize(24) + } + .justifyContent(FlexAlign.Center) + .height('90%') + }.backgroundColor('#ff4168db') + } + .backgroundColor('#19000000') + .height('100%') + } + + GridCol({ span: { sm: 12 } }) { + Row() { + Text('footer').width('100%').textAlign(TextAlign.Center) + }.width('100%').height('10%').backgroundColor(Color.Pink) + } + }.width('100%').height(300) + } +} +``` + + +![zh-cn_image_0000001563060697](figures/zh-cn_image_0000001563060697.png) + + +综上所述,栅格组件提供了丰富的自定义能力,功能异常灵活和强大。只需要明确栅格在不同断点下的Columns、Margin、Gutter及span等参数,即可确定最终布局,无需关心具体的设备类型及设备状态(如横竖屏)等。 diff --git a/zh-cn/application-dev/ui/arkts-layout-development-linear.md b/zh-cn/application-dev/ui/arkts-layout-development-linear.md new file mode 100644 index 0000000000000000000000000000000000000000..1dee7a3963c2ec6f14636b6f3fda5e5d94820f9a --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-layout-development-linear.md @@ -0,0 +1,629 @@ +# 线性布局 + + +## 概述 + +线性布局(LinearLayout)是开发中最常用的布局,通过线性容器[Row](../reference/arkui-ts/ts-container-row.md)和[Column](../reference/arkui-ts/ts-container-column.md)构建。线性布局是其他布局的基础,其子元素在线性方向上(水平方向和垂直方向)依次排列。线性布局的排列方向由所选容器组件决定,Column容器内子元素按照垂直方向排列,Row容器内子元素按照水平方向排列。根据不同的排列方向,开发者可选择使用Row或Column容器创建线性布局。 + + + **图1** Column容器内子元素排列示意图   + +![arrangement-child-elements-column](figures/arrangement-child-elements-column.png) + + + **图2** Row容器内子元素排列示意图   + +![arrangement-child-elements-row](figures/arrangement-child-elements-row.png) + + +## 基本概念 + +- 布局容器:具有布局能力的容器组件,可以承载其他元素作为其子元素,布局容器会对其子元素进行尺寸计算和布局排列。 + +- 布局子元素:布局容器内部的元素。 + +- 主轴:线性布局容器在布局方向上的轴线,子元素默认沿主轴排列。Row容器主轴为横向,Column容器主轴为纵向。 + +- 交叉轴:垂直于主轴方向的轴线。Row容器交叉轴为纵向,Column容器交叉轴为横向。 + +- 间距:布局子元素的纵向间距。 + + +## 布局子元素在排列方向上的间距 + +在布局容器内,可以通过space属性设置排列方向上子元素的间距,使各子元素在排列方向上有等间距效果。 + + +### Column容器内排列方向上的间距 + + **图3** Column容器内排列方向的间距图   + +![arrangement-direction-column](figures/arrangement-direction-column.png) + +```ts +Column({ space: 20 }) { + Text('space: 20').fontSize(15).fontColor(Color.Gray).width('90%') + Row().width('90%').height(50).backgroundColor(0xF5DEB3) + Row().width('90%').height(50).backgroundColor(0xD2B48C) + Row().width('90%').height(50).backgroundColor(0xF5DEB3) +}.width('100%') +``` + + +![arrangement-direction-column-sample](figures/arrangement-direction-column-sample.png) + + +### Row容器内排列方向上的间距 + + **图4** Row容器内排列方向的间距图   + +![arrangement-direction-row](figures/arrangement-direction-row.png) + + +```ts +Row({ space: 35 }) { + Text('space: 35').fontSize(15).fontColor(Color.Gray) + Row().width('10%').height(150).backgroundColor(0xF5DEB3) + Row().width('10%').height(150).backgroundColor(0xD2B48C) + Row().width('10%').height(150).backgroundColor(0xF5DEB3) +}.width('90%') +``` + +![zh-cn_image_0000001562700509](figures/zh-cn_image_0000001562700509.png) + + +## 布局子元素在交叉轴上的对齐方式 + +在布局容器内,可以通过alignItems属性设置子元素在交叉轴(排列方向的垂直方向)上的对齐方式。且在各类尺寸屏幕中,表现一致。其中,交叉轴为垂直方向时,取值为[VerticalAlign类型](../reference/arkui-ts/ts-appendix-enums.md#verticalalign),水平方向取值为[HorizontalAlign](../reference/arkui-ts/ts-appendix-enums.md#horizontalalign)。 + +alignSelf属性用于控制单个子元素在容器主轴上的对齐方式,其优先级高于alignItems属性,如果设置了alignSelf属性,则在单个子元素上会覆盖alignItems属性。 + + +### Column容器内子元素在水平方向上的排列 + + **图5** Column容器内子元素在水平方向上的排列图   + +![horizontal-arrangement-child-column](figures/horizontal-arrangement-child-column.png) + +- HorizontalAlign.Start:子元素在水平方向左对齐。 + + ```ts + Column({}) { + Column() { + }.width('80%').height(50).backgroundColor(0xF5DEB3) + + Column() { + }.width('80%').height(50).backgroundColor(0xD2B48C) + + Column() { + }.width('80%').height(50).backgroundColor(0xF5DEB3) + }.width('100%').alignItems(HorizontalAlign.Start).backgroundColor('rgb(242,242,242)') + ``` + + ![zh-cn_image_0000001511580964](figures/zh-cn_image_0000001511580964.png) + +- HorizontalAlign.Center:子元素在水平方向居中对齐。 + + ```ts + Column({}) { + Column() { + }.width('80%').height(50).backgroundColor(0xF5DEB3) + + Column() { + }.width('80%').height(50).backgroundColor(0xD2B48C) + + Column() { + }.width('80%').height(50).backgroundColor(0xF5DEB3) + }.width('100%').alignItems(HorizontalAlign.Center).backgroundColor('rgb(242,242,242)') + ``` + + ![zh-cn_image_0000001562820897](figures/zh-cn_image_0000001562820897.png) + +- HorizontalAlign.End:子元素在水平方向右对齐。 + + ```ts + Column({}) { + Column() { + }.width('80%').height(50).backgroundColor(0xF5DEB3) + + Column() { + }.width('80%').height(50).backgroundColor(0xD2B48C) + + Column() { + }.width('80%').height(50).backgroundColor(0xF5DEB3) + }.width('100%').alignItems(HorizontalAlign.End).backgroundColor('rgb(242,242,242)') + ``` + + ![zh-cn_image_0000001511421348](figures/zh-cn_image_0000001511421348.png) + + +### Row容器内子元素在垂直方向上的排列 + + **图6** Row容器内子元素在垂直方向上的排列图   + +![horizontal-arrangement-child-row](figures/horizontal-arrangement-child-row.png) + +- VerticalAlign.Top:子元素在垂直方向顶部对齐。 + + ```ts + Row({}) { + Column() { + }.width('20%').height(30).backgroundColor(0xF5DEB3) + + Column() { + }.width('20%').height(30).backgroundColor(0xD2B48C) + + Column() { + }.width('20%').height(30).backgroundColor(0xF5DEB3) + }.width('100%').height(200).alignItems(VerticalAlign.Top).backgroundColor('rgb(242,242,242)') + ``` + + ![zh-cn_image_0000001563060765](figures/zh-cn_image_0000001563060765.png) + +- VerticalAlign.Center:子元素在垂直方向居中对齐。 + + ```ts + Row({}) { + Column() { + }.width('20%').height(30).backgroundColor(0xF5DEB3) + + Column() { + }.width('20%').height(30).backgroundColor(0xD2B48C) + + Column() { + }.width('20%').height(30).backgroundColor(0xF5DEB3) + }.width('100%').height(200).alignItems(VerticalAlign.Center).backgroundColor('rgb(242,242,242)') + ``` + + ![zh-cn_image_0000001562700505](figures/zh-cn_image_0000001562700505.png) + +- VerticalAlign.Bottom:子元素在垂直方向底部对齐。 + + ```ts + Row({}) { + Column() { + }.width('20%').height(30).backgroundColor(0xF5DEB3) + + Column() { + }.width('20%').height(30).backgroundColor(0xD2B48C) + + Column() { + }.width('20%').height(30).backgroundColor(0xF5DEB3) + }.width('100%').height(200).alignItems(VerticalAlign.Bottom).backgroundColor('rgb(242,242,242)') + ``` + + ![zh-cn_image_0000001563060781](figures/zh-cn_image_0000001563060781.png) + + +## 布局子元素在主轴上的排列方式 + +在布局容器内,可以通过justifyContent属性设置子元素在容器主轴上的排列方式。可以从主轴起始位置开始排布,也可以从主轴结束位置开始排布,或者均匀分割主轴的空间。 + + +### Column容器内子元素在主轴上的排列 + + **图7** Column容器内子元素在主轴上的排列图  + +![vertial-arrangement-child-column](figures/vertial-arrangement-child-column.png) + +- justifyContent(FlexAlign.Start):元素在主轴方向首端对齐,第一个元素与行首对齐,同时后续的元素与前一个对齐。 + + ```ts + Column({}) { + Column() { + }.width('80%').height(50).backgroundColor(0xF5DEB3) + + Column() { + }.width('80%').height(50).backgroundColor(0xD2B48C) + + Column() { + }.width('80%').height(50).backgroundColor(0xF5DEB3) + }.width('100%').height(300).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.Start) + ``` + + ![zh-cn_image_0000001562700501](figures/zh-cn_image_0000001562700501.png) + +- justifyContent(FlexAlign.Center):元素在主轴方向中心对齐,第一个元素与行首的距离与最后一个元素与行尾距离相同。 + + ```ts + Column({}) { + Column() { + }.width('80%').height(50).backgroundColor(0xF5DEB3) + + Column() { + }.width('80%').height(50).backgroundColor(0xD2B48C) + + Column() { + }.width('80%').height(50).backgroundColor(0xF5DEB3) + }.width('100%').height(300).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.Center) + ``` + + ![zh-cn_image_0000001562700517](figures/zh-cn_image_0000001562700517.png) + +- justifyContent(FlexAlign.End):元素在主轴方向尾部对齐,最后一个元素与行尾对齐,其他元素与后一个对齐。 + + ```ts + Column({}) { + Column() { + }.width('80%').height(50).backgroundColor(0xF5DEB3) + + Column() { + }.width('80%').height(50).backgroundColor(0xD2B48C) + + Column() { + }.width('80%').height(50).backgroundColor(0xF5DEB3) + }.width('100%').height(300).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.End) + ``` + + ![zh-cn_image_0000001562940585](figures/zh-cn_image_0000001562940585.png) + +- justifyContent(FlexAlign.Spacebetween):主轴方向均匀分配元素,相邻元素之间距离相同。第一个元素与行首对齐,最后一个元素与行尾对齐。 + + ```ts + Column({}) { + Column() { + }.width('80%').height(50).backgroundColor(0xF5DEB3) + + Column() { + }.width('80%').height(50).backgroundColor(0xD2B48C) + + Column() { + }.width('80%').height(50).backgroundColor(0xF5DEB3) + }.width('100%').height(300).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.SpaceBetween) + ``` + + ![zh-cn_image_0000001511900532](figures/zh-cn_image_0000001511900532.png) + +- justifyContent(FlexAlign.SpaceAround):主轴方向均匀分配元素,相邻元素之间距离相同。第一个元素到行首的距离和最后一个元素到行尾的距离是相邻元素之间距离的一半。 + + ```ts + Column({}) { + Column() { + }.width('80%').height(50).backgroundColor(0xF5DEB3) + + Column() { + }.width('80%').height(50).backgroundColor(0xD2B48C) + + Column() { + }.width('80%').height(50).backgroundColor(0xF5DEB3) + }.width('100%').height(300).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.SpaceAround) + ``` + + ![zh-cn_image_0000001562700525](figures/zh-cn_image_0000001562700525.png) + +- justifyContent(FlexAlign.SpaceEvenly):主轴方向均匀分配元素,相邻元素之间的距离、第一个元素与行首的间距、最后一个元素到行尾的间距都完全一样。 + + ```ts + Column({}) { + Column() { + }.width('80%').height(50).backgroundColor(0xF5DEB3) + + Column() { + }.width('80%').height(50).backgroundColor(0xD2B48C) + + Column() { + }.width('80%').height(50).backgroundColor(0xF5DEB3) + }.width('100%').height(300).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.SpaceEvenly) + ``` + + ![zh-cn_image_0000001563060785](figures/zh-cn_image_0000001563060785.png) + + +### Row容器内子元素在主轴上的排列 + + **图8** Row容器内子元素在主轴上的排列图   + +![vertial-arrangement-child-row](figures/vertial-arrangement-child-row.png) + +- justifyContent(FlexAlign.Start):元素在主轴方向首端对齐,第一个元素与行首对齐,同时后续的元素与前一个对齐。 + + ```ts + Row({}) { + Column() { + }.width('20%').height(30).backgroundColor(0xF5DEB3) + + Column() { + }.width('20%').height(30).backgroundColor(0xD2B48C) + + Column() { + }.width('20%').height(30).backgroundColor(0xF5DEB3) + }.width('100%').height(200).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.Start) + ``` + + ![zh-cn_image_0000001511421356](figures/zh-cn_image_0000001511421356.png) + +- justifyContent(FlexAlign.Center):元素在主轴方向中心对齐,第一个元素与行首的距离与最后一个元素与行尾距离相同。 + + ```ts + Row({}) { + Column() { + }.width('20%').height(30).backgroundColor(0xF5DEB3) + + Column() { + }.width('20%').height(30).backgroundColor(0xD2B48C) + + Column() { + }.width('20%').height(30).backgroundColor(0xF5DEB3) + }.width('100%').height(200).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.Center) + ``` + + ![zh-cn_image_0000001511900516](figures/zh-cn_image_0000001511900516.png) + +- justifyContent(FlexAlign.End):元素在主轴方向尾部对齐,最后一个元素与行尾对齐,其他元素与后一个对齐。 + + ```ts + Row({}) { + Column() { + }.width('20%').height(30).backgroundColor(0xF5DEB3) + + Column() { + }.width('20%').height(30).backgroundColor(0xD2B48C) + + Column() { + }.width('20%').height(30).backgroundColor(0xF5DEB3) + }.width('100%').height(200).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.End) + ``` + + ![zh-cn_image_0000001562940601](figures/zh-cn_image_0000001562940601.png) + +- justifyContent(FlexAlign.Spacebetween):主轴方向均匀分配元素,相邻元素之间距离相同。第一个元素与行首对齐,最后一个元素与行尾对齐。 + + ```ts + Row({}) { + Column() { + }.width('20%').height(30).backgroundColor(0xF5DEB3) + + Column() { + }.width('20%').height(30).backgroundColor(0xD2B48C) + + Column() { + }.width('20%').height(30).backgroundColor(0xF5DEB3) + }.width('100%').height(200).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.SpaceBetween) + ``` + + ![zh-cn_image_0000001562700521](figures/zh-cn_image_0000001562700521.png) + +- justifyContent(FlexAlign.SpaceAround):主轴方向均匀分配元素,相邻元素之间距离相同。第一个元素到行首的距离和最后一个元素到行尾的距离是相邻元素之间距离的一半。 + + ```ts + Row({}) { + Column() { + }.width('20%').height(30).backgroundColor(0xF5DEB3) + + Column() { + }.width('20%').height(30).backgroundColor(0xD2B48C) + + Column() { + }.width('20%').height(30).backgroundColor(0xF5DEB3) + }.width('100%').height(200).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.SpaceAround) + ``` + + ![zh-cn_image_0000001562820893](figures/zh-cn_image_0000001562820893.png) + +- justifyContent(FlexAlign.SpaceEvenly):主轴方向均匀分配元素,相邻元素之间的距离、第一个元素与行首的间距、最后一个元素到行尾的间距都完全一样。 + + ```ts + Row({}) { + Column() { + }.width('20%').height(30).backgroundColor(0xF5DEB3) + + Column() { + }.width('20%').height(30).backgroundColor(0xD2B48C) + + Column() { + }.width('20%').height(30).backgroundColor(0xF5DEB3) + }.width('100%').height(200).backgroundColor('rgb(242,242,242)').justifyContent(FlexAlign.SpaceEvenly) + ``` + + ![zh-cn_image_0000001511421352](figures/zh-cn_image_0000001511421352.png) + + +## 自适应拉伸 + +在线性布局下,常用空白填充组件[Blank](../reference/arkui-ts/ts-basic-components-blank.md),在容器主轴方向自动填充空白空间,达到自适应拉伸效果。Row和Column作为容器,只需要添加宽高为百分比,当屏幕宽高发生变化时,会产生自适应效果。 + + +```ts +@Entry +@Component +struct BlankExample { + build() { + Column() { + Row() { + Text('Bluetooth').fontSize(18) + Blank() + Toggle({ type: ToggleType.Switch, isOn: true }) + }.backgroundColor(0xFFFFFF).borderRadius(15).padding({ left: 12 }).width('100%') + }.backgroundColor(0xEFEFEF).padding(20).width('100%') + } +} +``` + + **图9** 竖屏   + +![zh-cn_image_0000001562820881](figures/zh-cn_image_0000001562820881.png) + + **图10** 横屏   + +![zh-cn_image_0000001511421332](figures/zh-cn_image_0000001511421332.png) + + +## 自适应缩放 + +自适应缩放是指子组件随容器尺寸的变化而按照预设的比例自动调整尺寸,适应各种不同大小的设备。在线性布局中,可以使用以下两种方法实现自适应缩放。 + + +- 父容器尺寸确定时,使用layoutWeight属性设置子组件和兄弟元素在主轴上的权重,忽略元素本身尺寸设置,使它们在任意尺寸的设备下自适应占满剩余空间。 + + ```ts + @Entry + @Component + struct layoutWeightExample { + build() { + Column() { + Text('1:2:3').width('100%') + Row() { + Column() { + Text('layoutWeight(1)') + .textAlign(TextAlign.Center) + }.layoutWeight(2).backgroundColor(0xF5DEB3).height('100%') + + Column() { + Text('layoutWeight(2)') + .textAlign(TextAlign.Center) + }.layoutWeight(4).backgroundColor(0xD2B48C).height('100%') + + Column() { + Text('layoutWeight(6)') + .textAlign(TextAlign.Center) + }.layoutWeight(6).backgroundColor(0xF5DEB3).height('100%') + + }.backgroundColor(0xffd306).height('30%') + + Text('2:5:3').width('100%') + Row() { + Column() { + Text('layoutWeight(2)') + .textAlign(TextAlign.Center) + }.layoutWeight(2).backgroundColor(0xF5DEB3).height('100%') + + Column() { + Text('layoutWeight(5)') + .textAlign(TextAlign.Center) + }.layoutWeight(5).backgroundColor(0xD2B48C).height('100%') + + Column() { + Text('layoutWeight(3)') + .textAlign(TextAlign.Center) + }.layoutWeight(3).backgroundColor(0xF5DEB3).height('100%') + }.backgroundColor(0xffd306).height('30%') + } + } + } + ``` + + **图11** 横屏   + + ![zh-cn_image_0000001511421336](figures/zh-cn_image_0000001511421336.png) + + **图12** 竖屏   + + ![zh-cn_image_0000001511580968](figures/zh-cn_image_0000001511580968.png) + +- 父容器尺寸确定时,使用百分比设置子组件和兄弟元素的宽度,使他们在任意尺寸的设备下保持固定的自适应占比。 + + ```ts + @Entry + @Component + struct WidthExample { + build() { + Column() { + Row() { + Column() { + Text('left width 20%') + .textAlign(TextAlign.Center) + }.width('20%').backgroundColor(0xF5DEB3).height('100%') + + Column() { + Text('center width 50%') + .textAlign(TextAlign.Center) + }.width('50%').backgroundColor(0xD2B48C).height('100%') + + Column() { + Text('right width 30%') + .textAlign(TextAlign.Center) + }.width('30%').backgroundColor(0xF5DEB3).height('100%') + }.backgroundColor(0xffd306).height('30%') + } + } + } + ``` + + **图13** 横屏   + + ![zh-cn_image_0000001563060777](figures/zh-cn_image_0000001563060777.png) + + **图14** 竖屏   + + ![zh-cn_image_0000001511740564](figures/zh-cn_image_0000001511740564.png) + + +## 自适应延伸 + +自适应延伸是指在不同尺寸设备下,当页面的内容超出屏幕大小而无法完全显示时,可以通过滚动条进行拖动展示。这种方法适用于线性布局中内容无法一屏展示的场景。通常有以下两种实现方式。 + +- [在List中添加滚动条](arkts-layout-development-create-list.md#添加滚动条):当List子项过多一屏放不下时,可以将每一项子元素放置在不同的组件中,通过滚动条进行拖动展示。可以通过scrollBar属性设置滚动条的常驻状态,edgeEffect属性设置拖动到内容最末端的回弹效果。 + +- 使用Scroll组件:在线性布局中,开发者可以进行竖向或者横向的布局。当一屏无法完全显示时,可以在Column或Row组件的外层包裹一个可滚动的容器组件Scroll来实现可滑动的线性布局。 + 竖向布局中使用Scroll组件: + + ```ts + @Entry + @Component + struct ScrollExample { + scroller: Scroller = new Scroller(); + private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; + + build() { + Scroll(this.scroller) { + Column() { + ForEach(this.arr, (item) => { + Text(item.toString()) + .width('90%') + .height(150) + .backgroundColor(0xFFFFFF) + .borderRadius(15) + .fontSize(16) + .textAlign(TextAlign.Center) + .margin({ top: 10 }) + }, item => item) + }.width('100%') + } + .backgroundColor(0xDCDCDC) + .scrollable(ScrollDirection.Vertical) // 滚动方向纵向 + .scrollBar(BarState.On) // 滚动条常驻显示 + .scrollBarColor(Color.Gray) // 滚动条颜色 + .scrollBarWidth(10) // 滚动条宽度 + .edgeEffect(EdgeEffect.Spring) // 滚动到边沿后回弹 + } + } + ``` + + ![zh-cn_image_0000001511900524](figures/zh-cn_image_0000001511900524.gif) + + 横向布局中使用Scroll组件: + + + ```ts + @Entry + @Component + struct ScrollExample { + scroller: Scroller = new Scroller(); + private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; + + build() { + Scroll(this.scroller) { + Row() { + ForEach(this.arr, (item) => { + Text(item.toString()) + .height('90%') + .width(150) + .backgroundColor(0xFFFFFF) + .borderRadius(15) + .fontSize(16) + .textAlign(TextAlign.Center) + .margin({ left: 10 }) + }) + }.height('100%') + } + .backgroundColor(0xDCDCDC) + .scrollable(ScrollDirection.Horizontal) // 滚动方向横向 + .scrollBar(BarState.On) // 滚动条常驻显示 + .scrollBarColor(Color.Gray) // 滚动条颜色 + .scrollBarWidth(10) // 滚动条宽度 + .edgeEffect(EdgeEffect.Spring) // 滚动到边沿后回弹 + } + } + ``` + + ![zh-cn_image_0000001562940609](figures/zh-cn_image_0000001562940609.gif) diff --git a/zh-cn/application-dev/ui/arkts-layout-development-media-query.md b/zh-cn/application-dev/ui/arkts-layout-development-media-query.md new file mode 100644 index 0000000000000000000000000000000000000000..513f2b77efe02908cd6d40005847fd918a41e993 --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-layout-development-media-query.md @@ -0,0 +1,263 @@ +# 媒体查询 + + +## 概述 + +[媒体查询](https://docs.openharmony.cn/pages/v3.2Beta/zh-cn/application-dev/reference/apis/js-apis-mediaquery.md/)作为响应式设计的核心,在移动设备上应用十分广泛。媒体查询可根据不同设备类型或同设备不同状态修改应用的样式。媒体查询常用于下面两种场景: + +1. 针对设备和应用的属性信息(比如显示区域、深浅色、分辨率),设计出相匹配的布局。 + +2. 当屏幕发生动态改变时(比如分屏、横竖屏切换),同步更新应用的页面布局。 + + +## 引入与使用流程 + +媒体查询通过mediaquery模块接口,设置查询条件并绑定回调函数,在对应的条件的回调函数里更改页面布局或者实现业务逻辑,实现页面的响应式设计。具体步骤如下: + +首先导入媒体查询模块。 + + +```ts +import mediaquery from '@ohos.mediaquery'; +``` + +通过matchMediaSync接口设置媒体查询条件,保存返回的条件监听句柄listener。例如监听横屏事件: + + +```ts +let listener = mediaquery.matchMediaSync('(orientation: landscape)'); +``` + +给条件监听句柄listener绑定回调函数onPortrait,当listener检测设备状态变化时执行回调函数。在回调函数内,根据不同设备状态更改页面布局或者实现业务逻辑。 + + +```ts +onPortrait(mediaQueryResult) { + if (mediaQueryResult.matches) { + // do something here + } else { + // do something here + } +} + +listener.on('change', onPortrait); +``` + + +## 媒体查询条件 + +媒体查询条件由媒体类型、逻辑操作符、媒体特征组成,其中媒体类型可省略,逻辑操作符用于连接不同媒体类型与媒体特征,其中,媒体特征要使用“()”包裹且可以有多个。具体规则如下: + + +### 语法规则 + +语法规则包括[媒体类型(media-type)](#媒体类型media-type)、[媒体逻辑操作(media-logic-operations)](#媒体逻辑操作media-logic-operations)和[媒体特征(media-feature)](#媒体特征media-feature)。 + + +```ts +[media-type] [media-logic-operations] [(media-feature)] +``` + +例如: + +- screen and (round-screen: true) :表示当设备屏幕是圆形时条件成立。 + +- (max-height: 800) :表示当高度小于等于800时条件成立。 + +- (height <= 800) :表示当高度小于等于800时条件成立。 + +- screen and (device-type: tv) or (resolution < 2) :表示包含多个媒体特征的多条件复杂语句查询,当设备类型为tv或设备分辨率小于2时条件成立。 + + +### 媒体类型(media-type) + +| **类型** | **说明** | +| ------ | -------------- | +| screen | 按屏幕相关参数进行媒体查询。 | + + +### 媒体逻辑操作(media-logic-operations) + +媒体逻辑操作符:and、or、not、only用于构成复杂媒体查询,也可以通过comma(, )将其组合起来,详细解释说明如下表。 + + **表1** 媒体逻辑操作符 + +| 类型 | 说明 | +| -------------- | ---------------------------------------- | +| and | 将多个媒体特征(Media Feature)以“与”的方式连接成一个媒体查询,只有当所有媒体特征都为true,查询条件成立。另外,它还可以将媒体类型和媒体功能结合起来。例如:screen and (device-type: wearable) and (max-height: 600) 表示当设备类型是智能穿戴且应用的最大高度小于等于600个像素单位时成立。 | +| or | 将多个媒体特征以“或”的方式连接成一个媒体查询,如果存在结果为true的媒体特征,则查询条件成立。例如:screen and (max-height: 1000) or (round-screen: true) 表示当应用高度小于等于1000个像素单位或者设备屏幕是圆形时,条件成立。 | +| not | 取反媒体查询结果,媒体查询结果不成立时返回true,否则返回false。例如:not screen and (min-height: 50) and (max-height: 600) 表示当应用高度小于50个像素单位或者大于600个像素单位时成立。
使用not运算符时必须指定媒体类型。 | +| only | 当整个表达式都匹配时,才会应用选择的样式,可以应用在防止某些较早的版本的浏览器上产生歧义的场景。一些较早版本的浏览器对于同时包含了媒体类型和媒体特征的语句会产生歧义,比如:screen and (min-height: 50)。老版本浏览器会将这句话理解成screen,从而导致仅仅匹配到媒体类型(screen),就应用了指定样式,使用only可以很好地规避这种情况。
使用only时必须指定媒体类型。 | +| comma(, ) | 将多个媒体特征以“或”的方式连接成一个媒体查询,如果存在结果为true的媒体特征,则查询条件成立。其效果等同于or运算符。例如:screen and (min-height: 1000), (round-screen: true) 表示当应用高度大于等于1000个像素单位或者设备屏幕是圆形时,条件成立。 | + +媒体范围操作符包括<=,>=,<,>,详细解释说明如下表。 + + **表2** 媒体逻辑范围操作符 + +| 类型 | 说明 | +| ----- | ---------------------------------------- | +| <= | 小于等于,例如:screen and (height <= 50)。 | +| >= | 大于等于,例如:screen and (height >= 600)。 | +| < | 小于,例如:screen and (height < 50)。 | +| > | 大于,例如:screen and (height > 600)。 | + + +### 媒体特征(media-feature) + +媒体特征包括应用显示区域的宽高、设备分辨率以及设备的宽高等属性,详细说明如下表。 + + **表3** 媒体特征说明表 + +| 类型 | 说明 | +| ----------------- | ---------------------------------------- | +| height | 应用页面可绘制区域的高度。 | +| min-height | 应用页面可绘制区域的最小高度。 | +| max-height | 应用页面可绘制区域的最大高度。 | +| width | 应用页面可绘制区域的宽度。 | +| min-width | 应用页面可绘制区域的最小宽度。 | +| max-width | 应用页面可绘制区域的最大宽度。 | +| resolution | 设备的分辨率,支持dpi,dppx和dpcm单位。其中:
- dpi表示每英寸中物理像素个数,1dpi ≈ 0.39dpcm;
- dpcm表示每厘米上的物理像素个数,1dpcm ≈ 2.54dpi;
- dppx表示每个px中的物理像素数(此单位按96px = 1英寸为基准,与页面中的px单位计算方式不同),1dppx = 96dpi。 | +| min-resolution | 设备的最小分辨率。 | +| max-resolution | 设备的最大分辨率。 | +| orientation | 屏幕的方向。
可选值:
-  orientation:  portrait(设备竖屏);
-  orientation:  landscape(设备横屏)。 | +| device-height | 设备的高度。 | +| min-device-height | 设备的最小高度。 | +| max-device-height | 设备的最大高度。 | +| device-width | 设备的宽度。 | +| device-type | 设备的类型。
可选值:default、tablet。 | +| min-device-width | 设备的最小宽度。 | +| max-device-width | 设备的最大宽度。 | +| round-screen | 屏幕类型,圆形屏幕为true,非圆形屏幕为false。 | +| dark-mode | 系统为深色模式时为true,否则为false。 | + + +## 场景示例 + +下例中使用媒体查询,实现屏幕横竖屏切换时,给页面文本应用添加不同的内容和样式。 + +Stage模型下的示例: + + +```ts +import mediaquery from '@ohos.mediaquery'; +import window from '@ohos.window'; +import common from '@ohos.app.ability.common'; + +let portraitFunc = null; + +@Entry +@Component +struct MediaQueryExample { + @State color: string = '#DB7093'; + @State text: string = 'Portrait'; + // 当设备横屏时条件成立 + listener = mediaquery.matchMediaSync('(orientation: landscape)'); + + // 当满足媒体查询条件时,触发回调 + onPortrait(mediaQueryResult) { + if (mediaQueryResult.matches) { // 若设备为横屏状态,更改相应的页面布局 + this.color = '#FFD700'; + this.text = 'Landscape'; + } else { + this.color = '#DB7093'; + this.text = 'Portrait'; + } + } + + aboutToAppear() { + // 绑定当前应用实例 + portraitFunc = this.onPortrait.bind(this); + // 绑定回调函数 + this.listener.on('change', portraitFunc); + } + + // 改变设备横竖屏状态函数 + private changeOrientation(isLandscape: boolean) { + // 获取UIAbility实例的上下文信息 + let context = getContext(this) as common.UIAbilityContext; + // 调用该接口手动改变设备横竖屏状态 + window.getLastWindow(context).then((lastWindow) => { + lastWindow.setPreferredOrientation(isLandscape ? window.Orientation.LANDSCAPE : window.Orientation.PORTRAIT) + }); + } + + build() { + Column({ space: 50 }) { + Text(this.text).fontSize(50).fontColor(this.color) + Text('Landscape').fontSize(50).fontColor(this.color).backgroundColor(Color.Orange) + .onClick(() => { + this.changeOrientation(true); + }) + Text('Portrait').fontSize(50).fontColor(this.color).backgroundColor(Color.Orange) + .onClick(() => { + this.changeOrientation(false); + }) + } + .width('100%').height('100%') + } +} +``` + +FA模型下的示例: + + +```ts +import mediaquery from '@ohos.mediaquery'; +import featureAbility from '@ohos.ability.featureAbility'; + +let portraitFunc = null; + +@Entry +@Component +struct MediaQueryExample { + @State color: string = '#DB7093'; + @State text: string = 'Portrait'; + listener = mediaquery.matchMediaSync('(orientation: landscape)'); // 当设备横屏时条件成立 + + onPortrait(mediaQueryResult) { // 当满足媒体查询条件时,触发回调 + if (mediaQueryResult.matches) { // 若设备为横屏状态,更改相应的页面布局 + this.color = '#FFD700'; + this.text = 'Landscape'; + } else { + this.color = '#DB7093'; + this.text = 'Portrait'; + } + } + + aboutToAppear() { + portraitFunc = this.onPortrait.bind(this); // 绑定当前应用实例 + this.listener.on('change', portraitFunc); //绑定回调函数 + } + + build() { + Column({ space: 50 }) { + Text(this.text).fontSize(50).fontColor(this.color) + Text('Landscape').fontSize(50).fontColor(this.color).backgroundColor(Color.Orange) + .onClick(() => { + let context = featureAbility.getContext(); + context.setDisplayOrientation(0); //调用该接口手动改变设备横竖屏状态 + }) + Text('Portrait').fontSize(50).fontColor(this.color).backgroundColor(Color.Orange) + .onClick(() => { + let context = featureAbility.getContext(); + context.setDisplayOrientation(1); //调用该接口手动改变设备横竖屏状态 + }) + } + .width('100%').height('100%') + } +} +``` + + **图1** 竖屏   + +![portralit](figures/portralit.jpg) + + **图2** 横屏   + +![landscape](figures/landscape.jpg) + +## 相关实例 + +基于媒体查询,可参考以下实例: + +[媒体查询](https://gitee.com/openharmony/applications_app_samples/tree/master/code/UI/ArkTsComponentClollection/MediaQuery):使用媒体查询,完成在不同设备上显示不同的界面效果。 diff --git a/zh-cn/application-dev/ui/arkts-layout-development-overview.md b/zh-cn/application-dev/ui/arkts-layout-development-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..93398ca32fe0078e09fa2c19bcdf8da5fc425c47 --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-layout-development-overview.md @@ -0,0 +1,79 @@ +# 布局概述 + + +组件按照布局的要求依次排列,构成应用的页面。在声明式UI中,所有的页面都是由自定义组件构成,开发者可以根据自己的需求,选择合适的布局进行页面开发。 + + +布局指用特定的组件或者属性来管理用户页面所放置UI组件的大小和位置。在实际的开发过程中,需要遵守以下流程保证整体的布局效果: + + +- 确定页面的布局结构。 + +- 分析页面中的元素构成。 + +- 选用适合的布局容器组件或属性控制页面中各个元素的位置和大小约束。 + + +## 布局结构 + +布局的结构通常是分层级的,代表了用户界面中的整体架构。一个常见的页面结构如下所示: + + **图1** 常见页面结构图   + +![common-page-structure](figures/common-page-structure.png) + +为实现上述效果,开发者需要在页面中声明对应的元素。其中,Page表示页面的根节点,Column/Row等元素为系统组件。针对不同的页面结构,ArkUI提供了不同的布局组件来帮助开发者实现对应布局的效果,例如Row用于实现线性布局。 + + +## 布局元素的组成 + +布局相关的容器组件可形成对应的布局效果。例如,List组件可构成线性布局。 + + **图2** 布局元素组成图   + +![layout-element-omposition](figures/layout-element-omposition.png) + +- 组件区域(蓝区方块):组件区域表明组件的大小,width、height属性设置该区域的大小。 + +- 组件内容区(黄色方块):组件区域大小减去组件的Padding值,组件内容区大小会作为组件内容(或者子组件)进行大小测算时的布局测算限制。 + +- 组件内容(绿色方块):组件内容本身占用的大小,比如文本内容占用的大小。组件内容和组件内容区不一定匹配,比如设置了固定的width和height,此时组件内容区大小就是设置的width和height减去Padding值,但文本内容则是通过文本布局引擎测算后得到的大小,可能出现文本真实大小小于设置的组件内容区大小。当组件内容和组件内容区大小不一致时,align属性生效,定义组件内容在组件内容区的对齐方式,如居中对齐。 + +- 组件布局边界(虚线部分):组件通过Margin属性设置外边距时,组件布局边界就是组件区域加上Margin的大小。 + + +## 如何选择布局 + +声明式UI提供了以下8种常见布局,开发者可根据实际应用场景选择合适的布局进行页面开发。 + +| 布局 | 应用场景 | +| ---------------------------------------- | ---------------------------------------- | +| [线性布局](arkts-layout-development-linear.md)(Row、Column) | 如果布局内子元素为复数个,且能够以某种方式线性排列时优先考虑此布局。 | +| [层叠布局](arkts-layout-development-stack-layout.md)(Stack) | 组件需要有堆叠效果时优先考虑此布局,层叠布局的堆叠效果不会占用或影响其他同容器内子组件的布局空间。例如[Panel](../reference/arkui-ts/ts-container-panel.md)作为子组件弹出时将其他组件覆盖更为合理,则优先考虑在外层使用堆叠布局。 | +| [弹性布局](arkts-layout-development-flex-layout.md)(Flex) | 弹性布局是与线性布局类似的布局方式。区别在于弹性布局默认能够使子组件压缩或拉伸。在子组件需要计算拉伸或压缩比例时优先使用此布局,可使得多个容器内子组件能有更好的视觉上的填充容器效果。 | +| [相对布局](arkts-layout-development-relative-layout.md)(RelativeContainer) | 相对布局是在二维空间中的布局方式,不需要遵循线性布局的规则,布局方式更为自由。通过在子组件上设置锚点规则(AlignRules)使子组件能够将自己在横轴、纵轴中的位置与容器或容器内其他子组件的位置对齐。设置的锚点规则可以天然支持子元素压缩、拉伸,堆叠或形成多行效果。在页面元素分布复杂或通过线性布局会使容器嵌套层数过深时推荐使用。 | +| [栅格布局](arkts-layout-development-grid-layout.md)(GridRow、GridCol) | 栅格是多设备场景下通用的辅助定位工具,通过将空间分割为有规律的栅格。栅格不同于网格布局固定的空间划分,可以实现不同设备下不同的布局,空间划分更随心所欲,从而显著降低适配不同屏幕尺寸的设计及开发成本,使得整体设计和开发流程更有秩序和节奏感,同时也保证多设备上应用显示的协调性和一致性,提升用户体验。推荐内容相同但布局不同时使用。 | +| [媒体查询](arkts-layout-development-media-query.md)(\@ohos.mediaquery) | 媒体查询可根据不同设备类型或同设备不同状态修改应用的样式。例如根据设备和应用的不同属性信息设计不同的布局,以及屏幕发生动态改变时更新应用的页面布局。 | +| [列表](arkts-layout-development-create-list.md)(List) | 使用列表可以轻松高效地显示结构化、可滚动的信息。在ArkUI中,列表具有垂直和水平布局能力和自适应交叉轴方向上排列个数的布局能力,超出屏幕时可以滚动。列表适合用于呈现同类数据类型或数据类型集,例如图片和文本。 | +| [网格](arkts-layout-development-create-grid.md)(Grid) | 网格布局具有较强的页面均分能力,子组件占比控制能力,是一种重要自适应布局。网格布局可以控制元素所占的网格数量、设置子组件横跨几行或者几列,当网格容器尺寸发生变化时,所有子组件以及间距等比例调整。推荐在需要按照固定比例或者均匀分配空间的布局场景下使用,例如计算器、相册、日历等。 | +| [轮播](arkts-layout-development-create-looping.md)(Swiper) | 轮播组件通常用于实现广告轮播、图片预览、可滚动应用等。 | + + +## 布局位置 + +position、offset等属性影响了布局容器相对于自身或其他组件的位置。 + +| 定位能力 | 使用场景 | 实现方式 | +| ---- | ---------------------------------------- | ---------------------------------------- | +| 绝对定位 | 对于不同尺寸的设备,使用绝对定位的适应性会比较差,在屏幕的适配上有缺陷。 | 使用[position](../reference/arkui-ts/ts-universal-attributes-location.md)实现绝对定位,设置元素左上角相对于父容器左上角偏移位置。在布局容器中,设置该属性不影响父容器布局,仅在绘制时进行位置调整。 | +| 相对定位 | 相对定位不脱离文档流,即原位置依然保留,不影响元素本身的特性,仅相对于原位置进行偏移。 | 使用[offset](../reference/arkui-ts/ts-universal-attributes-location.md)可以实现相对定位,设置元素相对于自身的偏移量。设置该属性,不影响父容器布局,仅在绘制时进行位置调整。 | + + +## 对子元素的约束 + +| 对子元素的约束能力 | 使用场景 | 实现方式 | +| --------- | ---------------------------------------- | ---------------------------------------- | +| 拉伸 | 容器组件尺寸发生变化时,增加或减小的空间全部分配给容器组件内指定区域。 | [flexGrow](../reference/arkui-ts/ts-universal-attributes-flex-layout.md)和[flexShrink](../reference/arkui-ts/ts-universal-attributes-flex-layout.md)属性:
1. flexGrow基于父容器的剩余空间分配来控制组件拉伸。
2. flexShrink设置父容器的压缩尺寸来控制组件拉伸。 | +| 缩放 | 子组件的宽高按照预设的比例,随容器组件发生变化,且变化过程中子组件的宽高比不变。 | [aspectRatio](../reference/arkui-ts/ts-universal-attributes-layout-constraints.md)属性指定当前组件的宽高比来控制缩放,公式为:aspectRatio=width/height。 | +| 占比 | 占比能力是指子组件的宽高按照预设的比例,随父容器组件发生变化。 | 基于通用属性的两种实现方式:
1. 将子组件的宽高设置为父组件宽高的百分比。
2. [layoutWeight](../reference/arkui-ts/ts-universal-attributes-size.md)属性,使得子元素自适应占满剩余空间。 | +| 隐藏 | 隐藏能力是指容器组件内的子组件,按照其预设的显示优先级,随容器组件尺寸变化显示或隐藏,其中相同显示优先级的子组件同时显示或隐藏。 | 通过[displayPriority](../reference/arkui-ts/ts-universal-attributes-layout-constraints.md)属性来控制页面的显示和隐藏。 | diff --git a/zh-cn/application-dev/ui/arkts-layout-development-performance-boost.md b/zh-cn/application-dev/ui/arkts-layout-development-performance-boost.md new file mode 100644 index 0000000000000000000000000000000000000000..cace34193f8de687b16d743ce8238aea0cdd3961 --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-layout-development-performance-boost.md @@ -0,0 +1,62 @@ +# 改善布局性能 + + +Flex为采用弹性布局的容器。容器内部的所有子元素,会自动参与弹性布局。子元素默认沿主轴排列,子元素在主轴方向的尺寸称为主轴尺寸。 + + +在单行布局场景下,子组件的主轴尺寸长度和可能存在不等于容器主轴尺寸长度的情况,部分子组件会被布局两次来填充容器,即需要二次布局,导致布局效率下降。 + + +## 场景一 + +所有子组件未设置DisplayPriority属性(或DisplayPriority设置为默认值1)和LayoutWeight属性(或LayoutWeight设置为默认值0)时,所有子组件先按序布局一次。 + + +- 第一次布局子组件主轴尺寸长度总和等于容器主轴尺寸长度,不需要二次布局。 + ![layout-performance-1](figures/layout-performance-1.png) + +- 第一次布局子组件主轴尺寸长度总和小于容器主轴尺寸长度,且包含设置有效的flexGrow属性的子组件,设置有效的flexGrow属性的子组件会触发二次布局,拉伸布局填满容器。 + ![layout-performace-2](figures/layout-performace-2.gif) + +- 第一次布局子组件主轴尺寸长度总和大于容器主轴尺寸长度,且包含设置有效的flexShrink属性(flex子组件默认值为1,为有效值)的子组件,设置有效的flexShrink属性的子组件会触发二次布局,压缩布局填满容器。 + ![layout-performace-3](figures/layout-performace-3.gif) + + +## 场景二 + +子组件存在设置DisplayPriority属性,不存在设置LayoutWeight属性。 + + +根据DisplayPriority从大到小顺序,布局每组同DisplayPriority值的子组件,直到子组件主轴尺寸长度总和最大且不超过容器主轴尺寸长度,舍弃未布局的低优先级DisplayPriority(可能存在一组临界DisplayPriority值的子组件布局但未使用的情况)。 + + +- 第一次布局子组件主轴尺寸长度总和等于容器主轴尺寸长度,不需要二次布局。 + ![layout-performance-4](figures/layout-performance-4.png) + +- 第一次布局子组件主轴尺寸长度总和小于容器主轴尺寸长度,且包含设置有效的flexGrow属性的子组件,设置有效的flexGrow属性的子组件会触发二次布局,拉伸布局填满容器。 + ![layout-performace-5](figures/layout-performace-5.gif) + + +## 场景三 + +子组件中存在设置LayoutWeight属性。 + +根据DisplayPriority从大到小顺序,布局每组DisplayPriority值相同且不设置LayoutWeight属性的子组件,直到子组件主轴尺寸长度总和最大且不超过容器主轴尺寸长度,舍弃未布局的低优先级DisplayPriority,可能存在一组临界DisplayPriority值的子组件布局但未使用的情况。 + + +剩余空间按设置LayoutWeight属性的子组件的LayoutWeight比例填满容器。 + + +- 两次遍历都只布局一次组件,不会触发二次布局。 + ![layout-performace-6](figures/layout-performace-6.gif) + + +## 如何优化Flex的布局性能 + +- 使用Column/Row代替Flex。 + +- 大小不需要变更的子组件主动设置flexShrink属性值为0。 + +- 优先使用LayoutWeight属性替代flexGrow属性和flexShrink属性。 + +- 子组件主轴长度分配设置为最常用场景的布局结果,使子组件主轴长度总和等于Flex容器主轴长度。 diff --git a/zh-cn/application-dev/ui/arkts-layout-development-relative-layout.md b/zh-cn/application-dev/ui/arkts-layout-development-relative-layout.md new file mode 100644 index 0000000000000000000000000000000000000000..6f61183dd9b41e91eec078222b2c5e8928f3414a --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-layout-development-relative-layout.md @@ -0,0 +1,158 @@ +# 相对布局 + + +## 概述 + +[RelativeContainer](../reference/arkui-ts/ts-container-relativecontainer.md)为采用相对布局的容器,支持容器内部的子元素设置相对位置关系。子元素支持指定兄弟元素作为锚点,也支持指定父容器作为锚点,基于锚点做相对位置布局。下图是一个RelativeContainer的概念图,图中的虚线表示位置的依赖关系。 + + + **图1** 相对布局示意图   + +![relative-layout](figures/relative-layout.png) + + +子元素并不完全是上图中的依赖关系。比如,Item4可以以Item2为依赖锚点,也可以以RelativeContainer父容器为依赖锚点。 + + +## 基本概念 + +- 锚点:通过锚点设置当前元素基于哪个元素确定位置。 + +- 对齐方式:通过对齐方式,设置当前元素是基于锚点的上中下对齐,还是基于锚点的左中右对齐。 + + +## 设置依赖关系 + + +### 锚点设置 + +锚点设置是指设置子元素相对于父元素或兄弟元素的位置依赖关系。在水平方向上,可以设置left、middle、right的锚点。在竖直方向上,可以设置top、center、bottom的锚点。为了明确定义锚点,必须为RelativeContainer及其子元素设置ID,用于指定锚点信息。ID默认为“container”,其余子元素的ID通过id属性设置。未设置ID的子元素在RelativeContainer中不会显示。 + +>**说明:** +> +>在使用锚点时要注意子元素的相对位置关系,避免出现错位或遮挡的情况。 + +- RelativeContainer父组件为锚点,__container__代表父容器的id。 + + ```ts + RelativeContainer() { + Row() + // 添加其他属性 + .alignRules({ + top: { anchor: '__container__', align: VerticalAlign.Top }, + left: { anchor: '__container__', align: HorizontalAlign.Start } + }) + .id("row1") + + Row() + ... + .alignRules({ + top: { anchor: '__container__', align: VerticalAlign.Top }, + right: { anchor: '__container__', align: HorizontalAlign.End } + }) + .id("row2") + } + ... + ``` + + ![zh-cn_image_0000001562820901](figures/zh-cn_image_0000001562820901.png) + +- 以子元素为锚点。 + + ```ts + RelativeContainer() { + ... + top: { anchor: 'row1', align: VerticalAlign.Bottom }, + ... + } + .width(300).height(300) + .margin({ left: 20 }) + .border({ width: 2, color: '#6699FF' }) + ``` + + ![zh-cn_image_0000001562940613](figures/zh-cn_image_0000001562940613.png) + + +### 设置相对于锚点的对齐位置 + +设置了锚点之后,可以通过align设置相对于锚点的对齐位置。 + +在水平方向上,对齐位置可以设置为HorizontalAlign.Start、HorizontalAlign.Center、HorizontalAlign.End。 + +![alignment-relative-anchor-horizontal](figures/alignment-relative-anchor-horizontal.png) + +在竖直方向上,对齐位置可以设置为VerticalAlign.Top、VerticalAlign.Center、VerticalAlign.Bottom。 + +![alignment-relative-anchor-vertical](figures/alignment-relative-anchor-vertical.png) + + +## 场景实例 + +相对布局内的子元素相对灵活,只要在RelativeContainer容器内,均可以通过alignRules进行相应相应的位置移动。 + + +```ts +@Entry +@Component +struct Index { + build() { + Row() { + RelativeContainer() { + Row() + .width(100) + .height(100) + .backgroundColor('#FF3333') + .alignRules({ + top: { anchor: '__container__', align: VerticalAlign.Top }, //以父容器为锚点,竖直方向顶头对齐 + middle: { anchor: '__container__', align: HorizontalAlign.Center } //以父容器为锚点,水平方向居中对齐 + }) + .id('row1') //设置锚点为row1 + + Row() { + Image($r('app.media.icon')) + } + .height(100).width(100) + .alignRules({ + top: { anchor: 'row1', align: VerticalAlign.Bottom }, //以row1组件为锚点,竖直方向低端对齐 + left: { anchor: 'row1', align: HorizontalAlign.Start } //以row1组件为锚点,水平方向开头对齐 + }) + .id('row2') //设置锚点为row2 + + Row() + .width(100) + .height(100) + .backgroundColor('#FFCC00') + .alignRules({ + top: { anchor: 'row2', align: VerticalAlign.Top } + }) + .id('row3') //设置锚点为row3 + + Row() + .width(100) + .height(100) + .backgroundColor('#FF9966') + .alignRules({ + top: { anchor: 'row2', align: VerticalAlign.Top }, + left: { anchor: 'row2', align: HorizontalAlign.End }, + }) + .id('row4') //设置锚点为row4 + + Row() + .width(100) + .height(100) + .backgroundColor('#FF66FF') + .alignRules({ + top: { anchor: 'row2', align: VerticalAlign.Bottom }, + middle: { anchor: 'row2', align: HorizontalAlign.Center } + }) + .id('row5') //设置锚点为row5 + } + .width(300).height(300) + .border({ width: 2, color: '#6699FF' }) + } + .height('100%').margin({ left: 30 }) + } +} +``` + +![zh-cn_image_0000001562700529](figures/zh-cn_image_0000001562700529.png) diff --git a/zh-cn/application-dev/ui/arkts-layout-development-stack-layout.md b/zh-cn/application-dev/ui/arkts-layout-development-stack-layout.md new file mode 100644 index 0000000000000000000000000000000000000000..73b4fc615c9b71112b9b245b5cdcaa593616a7bf --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-layout-development-stack-layout.md @@ -0,0 +1,135 @@ +# 层叠布局 + + +## 概述 + +层叠布局(StackLayout)用于在屏幕上预留一块区域来显示组件中的元素,提供元素可以重叠的布局。层叠布局通过[Stack](https://docs.openharmony.cn/pages/v3.2Beta/zh-cn/application-dev/reference/arkui-ts/ts-container-stack.md/)容器组件实现位置的固定定位与层叠,容器中的子元素(子组件)依次入栈,后一个子元素覆盖前一个子元素,子元素可以叠加,也可以设置位置。 + +层叠布局具有较强的页面层叠、位置定位能力,其使用场景有广告、卡片层叠效果等。 + +如图1,Stack作为容器,容器内的子元素(子组件)的顺序为Item1->Item2->Item3。 + + + **图1** 层叠布局   + +![stack-layout](figures/stack-layout.png) + + +## 开发布局 + +Stack组件为容器组件,容器内可包含各种子组件。其中的子组件根据自己的大小默认进行居中堆叠。子元素被约束在Stack下,进行自己的样式定义以及排列。 + + + +```ts +Column(){ + Stack({ }) { + Column(){}.width('90%').height('100%').backgroundColor('#ff58b87c') + Text('text').width('60%').height('60%').backgroundColor('#ffc3f6aa') + Button('button').width('30%').height('30%').backgroundColor('#ff8ff3eb').fontColor('#000') + }.width('100%').height(150).margin({ top: 50 }) +} +``` + + +![stack-layout-sample](figures/stack-layout-sample.png) + + +## 对齐方式 + +Stack组件通过[alignContent参数](../reference/arkui-ts/ts-appendix-enums.md#alignment)实现位置的相对移动。如图2所示,支持九种对齐方式。 + + **图2** Stack容器内元素的对齐方式   + +![zh-cn_image_0000001562940621](figures/zh-cn_image_0000001562940621.png) + + +## Z序控制 + +Stack容器中兄弟组件显示层级关系可以通过[Z序控制](../reference/arkui-ts/ts-universal-attributes-z-order.md)的zIndex属性改变。zIndex值越大,显示层级越高,即zIndex值大的组件会覆盖在zIndex值小的组件上方。 + + 在层叠布局中,如果后面子元素尺寸大于前面子元素尺寸,则前面子元素完全隐藏。 + +```ts +Stack({ alignContent: Alignment.BottomStart }) { + Column() { + Text('Stack子元素1').textAlign(TextAlign.End).fontSize(20) + }.width(100).height(100).backgroundColor(0xffd306) + + Column() { + Text('Stack子元素2').fontSize(20) + }.width(150).height(150).backgroundColor(Color.Pink) + + Column() { + Text('Stack子元素3').fontSize(20) + }.width(200).height(200).backgroundColor(Color.Grey) +}.margin({ top: 100 }).width(350).height(350).backgroundColor(0xe0e0e0) +``` + +![zh-cn_image_0000001511900544](figures/zh-cn_image_0000001511900544.png) + +下图中,最后的子元素3的尺寸大于前面的所有子元素,所以,前面两个元素完全隐藏。改变子元素1,子元素2的zIndex属性后,可以将元素展示出来。 + + +```ts +Stack({ alignContent: Alignment.BottomStart }) { + Column() { + Text('Stack子元素1').fontSize(20) + }.width(100).height(100).backgroundColor(0xffd306).zIndex(2) + + Column() { + Text('Stack子元素2').fontSize(20) + }.width(150).height(150).backgroundColor(Color.Pink).zIndex(1) + + Column() { + Text('Stack子元素3').fontSize(20) + }.width(200).height(200).backgroundColor(Color.Grey) +}.margin({ top: 100 }).width(350).height(350).backgroundColor(0xe0e0e0) +``` + +![zh-cn_image_0000001563060797](figures/zh-cn_image_0000001563060797.png) + + +## 场景示例 + +使用层叠布局快速搭建页面显示模型。 + + +```ts +@Entry +@Component +struct StackSample { + private arr: string[] = ['APP1', 'APP2', 'APP3', 'APP4', 'APP5', 'APP6', 'APP7', 'APP8']; + + build() { + Stack({ alignContent: Alignment.Bottom }) { + Flex({ wrap: FlexWrap.Wrap }) { + ForEach(this.arr, (item) => { + Text(item) + .width(100) + .height(100) + .fontSize(16) + .margin(10) + .textAlign(TextAlign.Center) + .borderRadius(10) + .backgroundColor(0xFFFFFF) + }, item => item) + }.width('100%').height('100%') + + Flex({ justifyContent: FlexAlign.SpaceAround, alignItems: ItemAlign.Center }) { + Text('联系人').fontSize(16) + Text('设置').fontSize(16) + Text('短信').fontSize(16) + } + .width('50%') + .height(50) + .backgroundColor('#16302e2e') + .margin({ bottom: 15 }) + .borderRadius(15) + }.width('100%').height('100%').backgroundColor('#CFD0CF') + } +} +``` + + +![zh-cn_image_0000001511421368](figures/zh-cn_image_0000001511421368.png) diff --git a/zh-cn/application-dev/ui/arkts-layout-update-animation.md b/zh-cn/application-dev/ui/arkts-layout-update-animation.md new file mode 100644 index 0000000000000000000000000000000000000000..afe25945bd95adb73e448adb55848626a6b9be65 --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-layout-update-animation.md @@ -0,0 +1,270 @@ +# 布局更新动画 + + +[显式动画](../reference/arkui-ts/ts-explicit-animation.md)(animateTo)和[属性动画](../reference/arkui-ts/ts-animatorproperty.md)(animation)是ArkUI提供的最基础和常用的动画功能。在布局属性(如[尺寸属性](../reference/arkui-ts/ts-universal-attributes-size.md)、[位置属性](../reference/arkui-ts/ts-universal-attributes-location.md))发生变化时,可以通过属性动画或显式动画,按照动画参数过渡到新的布局参数状态。 + + +| 动画类型 | 特点 | +| ---- | ---------------------------------------- | +| 显式动画 | 闭包内的变化均会触发动画,包括由数据变化引起的组件的增删、组件属性的变化等,可以做较为复杂的动画。 | 较复杂的动画场景 | +| 属性动画 | 动画设置简单,属性变化时自动触发动画。 | + + +## 使用显式动画产生布局更新动画 + +显式动画的接口为: + + +```ts +animateTo(value: AnimateParam, event: () => void): void +``` + +第一个参数指定动画参数,第二个参数为动画的闭包函数。 + +以下是使用显式动画产生布局更新动画的示例。示例中,当Column组件的alignItems属性改变后,其子组件的布局位置结果发生变化。只要该属性是在animateTo的闭包函数中修改的,那么由其引起的所有变化都会按照animateTo的动画参数执行动画过渡到终点值。 + + +```ts +@Entry +@Component +struct LayoutChange { + // 用于控制Column的alignItems属性 + @State itemAlign: HorizontalAlign = HorizontalAlign.Start; + allAlign: HorizontalAlign[] = [HorizontalAlign.Start, HorizontalAlign.Center, HorizontalAlign.End]; + alignIndex: number = 0; + + build() { + Column() { + Column({ space: 10 }) { + Button("1").width(100).height(50) + Button("2").width(100).height(50) + Button("3").width(100).height(50) + } + .margin(20) + .alignItems(this.itemAlign) + .borderWidth(2) + .width("90%") + .height(200) + + Button("click").onClick(() => { + // 动画时长为1000ms,曲线为EaseInOut + animateTo({ duration: 1000, curve: Curve.EaseInOut }, () => { + this.alignIndex = (this.alignIndex + 1) % this.allAlign.length; + // 在闭包函数中修改this.itemAlign参数,使Column容器内部孩子的布局方式变化,使用动画过渡到新位置 + this.itemAlign = this.allAlign[this.alignIndex]; + }); + }) + } + .width("100%") + .height("100%") + } +} +``` + + +![layoutChange1](figures/layoutChange1.gif) + + +除直接改变布局方式外,也可直接修改组件的宽、高、位置。 + + + +```ts +@Entry +@Component +struct LayoutChange2 { + @State myWidth: number = 100; + @State myHeight: number = 50; + // 标志位,true和false分别对应一组myWidth、myHeight值 + @State flag: boolean = false; + + build() { + Column({ space: 10 }) { + Button("text") + .type(ButtonType.Normal) + .width(this.myWidth) + .height(this.myHeight) + .margin(20) + Button("area: click me") + .fontSize(12) + .margin(20) + .onClick(() => { + animateTo({ duration: 1000, curve: Curve.Ease }, () => { + // 动画闭包中根据标志位改变控制第一个Button宽高的状态变量,使第一个Button做宽高动画 + if (this.flag) { + this.myWidth = 100; + this.myHeight = 50; + } else { + this.myWidth = 200; + this.myHeight = 100; + } + this.flag = !this.flag; + }); + }) + } + .width("100%") + .height("100%") + } +} +``` + + +在第二个Button的点击事件中,使用animateTo函数,在闭包中修改this.myWidth和this.myHeight状态变量,而这两个状态变量分别为第一个Button的宽、高属性值,所以第一个Button做了宽高动画。效果如下图。 + + +![layoutChange2_animateTo](figures/layoutChange2_animateTo.gif) + + +与此同时,第二个Button也产生了一个位置动画。这是由于第一个Button的宽高变化后,引起了Column内部其他组件的布局结果也发生了变化,第二个Button的布局发生变化也是由于闭包内改变第一个Button的宽高造成的。 + + +如果不希望第二个Button有动画效果,有两种方式可以实现。一种是给做第一个Button外面再加一个容器,使其动画前后的大小都在容器的范围内,这样第二个Button的位置不会被第一个Button的位置所影响。修改后的核心代码如下。 + + + +```ts +Column({ space: 10 }) { + Column() { + // Button放在足够大的容器内,使其不影响更外层的组件位置 + Button("text") + .type(ButtonType.Normal) + .width(this.myWidth) + .height(this.myHeight) + } + .margin(20) + .width(200) + .height(100) + + Button("area: click me") + .fontSize(12) + .onClick(() => { + animateTo({ duration: 1000, curve: Curve.Ease }, () => { + // 动画闭包中根据标志位改变控制第一个Button宽高的状态变量,使第一个Button做宽高动画 + if (this.flag) { + this.myWidth = 100; + this.myHeight = 50; + } else { + this.myWidth = 200; + this.myHeight = 100; + } + this.flag = !this.flag; + }); + }) +} +.width("100%") +.height("100%") +``` + + +![layoutChange2_animateTo_change](figures/layoutChange2_animateTo_change.gif) + + +另一种方式是给第二个Button添加布局约束,如position的位置约束,使其位置不被第一个Button的宽高影响。核心代码如下: + + + +```ts +Column({ space: 10 }) { + Button("text") + .type(ButtonType.Normal) + .width(this.myWidth) + .height(this.myHeight) + .margin(20) + + Button("area: click me") + .fontSize(12) + // 配置position属性固定,使自己的布局位置不被第一个Button的宽高影响 + .position({ x: "30%", y: 200 }) + .onClick(() => { + animateTo({ duration: 1000, curve: Curve.Ease }, () => { + // 动画闭包中根据标志位改变控制第一个Button宽高的状态变量,使第一个Button做宽高动画 + if (this.flag) { + this.myWidth = 100; + this.myHeight = 50; + } else { + this.myWidth = 200; + this.myHeight = 100; + } + this.flag = !this.flag; + }); + }) +} +.width("100%") +.height("100%") +``` + + +## 使用属性动画产生布局更新动画 + +显式动画把要执行动画的属性的修改放在闭包函数中触发动画,而属性动画则无需使用闭包,把animation属性加在要做属性动画的组件的属性后即可。 + +属性动画的接口为: + + +```ts +animation(value: AnimateParam) +``` + +其入参为动画参数。想要组件随某个属性值的变化而产生动画,此属性需要加在animation属性之前。有的属性变化不希望通过animation产生属性动画,可以放在animation之后。上面显式动画的示例很容易改为用属性动画实现。例如: + + + +```ts +@Entry +@Component +struct LayoutChange2 { + @State myWidth: number = 100; + @State myHeight: number = 50; + @State flag: boolean = false; + @State myColor: Color = Color.Blue; + + build() { + Column({ space: 10 }) { + Button("text") + .type(ButtonType.Normal) + .width(this.myWidth) + .height(this.myHeight) + // animation只对其上面的type、width、height属性生效,时长为1000ms,曲线为Ease + .animation({ duration: 1000, curve: Curve.Ease }) + .backgroundColor(this.myColor) + .margin(20) + // animation对下面的backgroundColor、margin属性不生效 + + Button("area: click me") + .fontSize(12) + .onClick(() => { + // 改变属性值,配置了属性动画的属性会进行动画过渡 + if (this.flag) { + this.myWidth = 100; + this.myHeight = 50; + this.myColor = Color.Blue; + } else { + this.myWidth = 200; + this.myHeight = 100; + this.myColor = Color.Pink; + } + this.flag = !this.flag; + }) + } + } +} +``` + + +上述示例中,第一个button上的animation属性,只对写在animation之前的type、width、height属性生效,而对写在animation之后的backgroundColor、margin属性无效。运行结果是width、height属性会按照animation的动画参数执行动画,而backgroundColor会直接跳变,不会产生动画。效果如下图: + + + + + + +![size-change-animation](figures/size-change-animation.gif) + + +>**说明:** +> +> 1. 使用属性动画时,会按照指定的属性动画参数执行动画。每个组件可为自己的属性配置不同参数的属性动画。 +> +> 2. 显式动画会对动画闭包前后造成的所有界面差异执行动画,且使用同一动画参数,适用于统一执行的场景。此外,显式动画也可以用于一些非属性变量造成的动画,如if/else的条件,ForEach使用的数组元素的删减。 +> +> 3. 如果一个属性配置了属性动画,且在显式动画闭包中改变该属性值,属性动画优先生效,会使用属性动画的动画参数。 diff --git a/zh-cn/application-dev/ui/arkts-navigation-navigation.md b/zh-cn/application-dev/ui/arkts-navigation-navigation.md new file mode 100644 index 0000000000000000000000000000000000000000..c809d04fade19c6f9aa6be28fd9c183d7947127b --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-navigation-navigation.md @@ -0,0 +1,203 @@ +# Navigation + + +[Navigation](../reference/arkui-ts/ts-basic-components-navigation.md)组件一般作为页面的根容器,包括单页面、分栏和自适应三种显示模式。同时,Navigation提供了属性来设置页面的标题栏、工具栏、导航栏等。 + + +Navigation组件的页面包含主页和内容页。主页由标题栏、内容区和工具栏组成,可在内容区中使用[NavRouter](../reference/arkui-ts/ts-basic-components-navrouter.md)子组件实现导航栏功能。内容页主要显示[NavDestination](../reference/arkui-ts/ts-basic-components-navdestination.md)子组件中的内容。 + + +NavRouter是和Navigation搭配使用的特殊子组件,默认提供点击响应处理,不需要开发者自定义点击事件逻辑。NavRouter有且仅有两个根节点,第二个根节点是NavDestination。NavDestination是和NavRouter搭配使用的特殊子组件,用于显示Navigation组件的内容页。当开发者点击NavRouter组件时,会跳转到对应的NavDestination内容区。 + + +## 设置页面显示模式 + +Navigation组件通过mode属性设置页面的显示模式。 + +- 自适应模式 + + Navigation组件默认为自适应模式,此时mode属性为NavigationMode.Auto。自适应模式下,当设备宽度大于520vp时,Navigation组件采用分栏模式,反之采用单页面模式。 + + + ``` + Navigation() { + ... + } + .mode(NavigationMode.Auto) + ``` + +- 单页面模式 + + **图1** 单页面布局示意图   + + ![zh-cn_image_0000001511740532](figures/zh-cn_image_0000001511740532.png) + + 将mode属性设置为NavigationMode.Stack,Navigation组件即可设置为单页面显示模式。 + + + ```ts + Navigation() { + ... + } + .mode(NavigationMode.Stack) + ``` + + ![单页面1](figures/单页面1.jpg) + +- 分栏模式 + + **图2** 分栏布局示意图 + + ![zh-cn_image_0000001562820845](figures/zh-cn_image_0000001562820845.png) + + 将mode属性设置为NavigationMode.Split,Navigation组件即可设置为分栏显示模式。 + + + ```ts + @Entry + @Component + struct NavigationExample { + private arr: number[] = [1, 2, 3]; + + build() { + Column() { + Navigation() { + TextInput({ placeholder: 'search...' }) + .width("90%") + .height(40) + .backgroundColor('#FFFFFF') + + List({ space: 12 }) { + ForEach(this.arr, (item) => { + ListItem() { + NavRouter() { + Text("NavRouter" + item) + .width("100%") + .height(72) + .backgroundColor('#FFFFFF') + .borderRadius(24) + .fontSize(16) + .fontWeight(500) + .textAlign(TextAlign.Center) + NavDestination() { + Text("NavDestinationContent" + item) + } + .title("NavDestinationTitle" + item) + } + } + }, item => item) + } + .width("90%") + .margin({ top: 12 }) + } + .title("主标题") + .mode(NavigationMode.Split) + .menus([ + {value: "", icon: "./image/ic_public_search.svg", action: ()=> {}}, + {value: "", icon: "./image/ic_public_add.svg", action: ()=> {}}, + {value: "", icon: "./image/ic_public_add.svg", action: ()=> {}}, + {value: "", icon: "./image/ic_public_add.svg", action: ()=> {}}, + {value: "", icon: "./image/ic_public_add.svg", action: ()=> {}} + ]) + .toolBar({items: [ + {value: "func", icon: "./image/ic_public_highlights.svg", action: ()=> {}}, + {value: "func", icon: "./image/ic_public_highlights.svg", action: ()=> {}}, + {value: "func", icon: "./image/ic_public_highlights.svg", action: ()=> {}} + ]}) + } + .height('100%') + .width('100%') + .backgroundColor('#F1F3F5') + } + } + ``` + + ![分栏](figures/分栏.jpg) + + +## 设置标题栏模式 + +标题栏在界面顶部,用于呈现界面名称和操作入口,Navigation组件通过titleMode属性设置标题栏模式。 + +- Mini模式 + 普通型标题栏,用于一级页面不需要突出标题的场景。 + + **图3** Mini模式标题栏   + + ![mini](figures/mini.jpg) + + + ```ts + Navigation() { + ... + } + .titleMode(NavigationTitleMode.Mini) + ``` + + +- Full模式 + 强调型标题栏,用于一级页面需要突出标题的场景。 + + **图4** Full模式标题栏   + + ![free1](figures/free1.jpg) + + + ```ts + Navigation() { + ... + } + .titleMode(NavigationTitleMode.Full) + ``` + + +## 设置菜单栏 + +菜单栏位于Navigation组件的右上角,开发者可以通过menus属性进行设置。menus支持Array<[NavigationMenuItem](../reference/arkui-ts/ts-basic-components-navigation.md#navigationmenuitem)>和CustomBuilder两种参数类型。使用Array<NavigationMenuItem>类型时,竖屏最多支持显示3个图标,横屏最多支持显示5个图标,多余的图标会被放入自动生成的更多图标。 + +**图5** 设置了3个图标的菜单栏   + +![菜单栏2](figures/菜单栏2.jpg) + +```ts +Navigation() { + ... +} +.menus([{value: "", icon: "./image/ic_public_search.svg", action: ()=>{}}, + {value: "", icon: "./image/ic_public_add.svg", action: ()=>{}}, + {value: "", icon: "./image/ic_public_add.svg", action: ()=>{}}]) +``` + +**图6** 设置了4个图标的菜单栏   + +![菜单栏](figures/菜单栏.jpg) + +```ts +Navigation() { + ... +} +.menus([{value: "", icon: "./image/ic_public_search.svg", action: ()=>{}}, + {value: "", icon: "./image/ic_public_add.svg", action: ()=>{}}, + {value: "", icon: "./image/ic_public_add.svg", action: ()=>{}}, + {value: "", icon: "./image/ic_public_add.svg", action: ()=>{}}]) +``` + + +## 设置工具栏 + +工具栏位于Navigation组件的底部,开发者可以通过toolBar属性进行设置。 + + + **图7** 工具栏   + +![free3](figures/free3.jpg) + +```ts +Navigation() { + ... +} +.toolBar({items:[ + {value: "func", icon: "./image/ic_public_highlights.svg", action: ()=>{}}, + {value: "func", icon: "./image/ic_public_highlights.svg", action: ()=>{}}, + {value: "func", icon: "./image/ic_public_highlights.svg", action: ()=>{}}]}) +``` diff --git a/zh-cn/application-dev/ui/arkts-navigation-tabs.md b/zh-cn/application-dev/ui/arkts-navigation-tabs.md new file mode 100644 index 0000000000000000000000000000000000000000..1d732ea01b80ec985723661fc828ee7a611435b8 --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-navigation-tabs.md @@ -0,0 +1,376 @@ +# Tabs + + +当页面信息较多时,为了让用户能够聚焦于当前显示的内容,需要对页面内容进行分类,提高页面空间利用率。[Tabs](../reference/arkui-ts/ts-container-tabs.md)组件可以在一个页面内快速实现视图内容的切换,一方面提升查找信息的效率,另一方面精简用户单次获取到的信息量。 + + +## 基本布局 + + Tabs组件的页面组成包含两个部分,分别是TabContent和TabBar。TabContent是内容页,TabBar是导航页签栏,页面结构如下图所示,根据不同的导航类型,布局会有区别,可以分为底部导航、顶部导航、侧边导航,其导航栏分别位于底部、顶部和侧边。 + **图1** Tabs组件布局示意图 + +![tabs-layout](figures/tabs-layout.png) + + +>**说明:** +> +> - TabContent组件不支持设置通用宽度属性,其宽度默认撑满Tabs父组件。 +> +> - TabContent组件不支持设置通用高度属性,其高度由Tabs父组件高度与TabBar组件高度决定。 + + +Tabs使用花括号包裹TabContent,如图2,其中TabContent显示相应的内容页。 + + + **图2** Tabs与TabContent使用   + +![tabs-tabscontent](figures/tabs-tabscontent.png) + + +每一个TabContent对应的内容需要有一个页签,可以通过TabContent的tabBar属性进行配置。在如下TabContent组件上设置属性tabBar,可以设置其对应页签中的内容,tabBar作为内容的页签。 + + + +```ts + TabContent() { + Text('首页的内容').fontSize(30) + } +.tabBar('首页') +``` + + +设置多个内容时,需在Tabs内按照顺序放置。 + + + +```ts +Tabs() { + TabContent() { + Text('首页的内容').fontSize(30) + } + .tabBar('首页') + + TabContent() { + Text('推荐的内容').fontSize(30) + } + .tabBar('推荐') + + TabContent() { + Text('发现的内容').fontSize(30) + } + .tabBar('发现') + + TabContent() { + Text('我的内容').fontSize(30) + } + .tabBar("我的") +} +``` + + +## 底部导航 + +底部导航是应用中最常见的一种导航方式。底部导航位于应用一级页面的底部,用户打开应用,能够分清整个应用的功能分类,以及页签对应的内容,并且其位于底部更加方便用户单手操作。底部导航一般作为应用的主导航形式存在,其作用是将用户关心的内容按照功能进行分类,迎合用户使用习惯,方便在不同模块间的内容切换。 + + + **图3** 底部导航栏   + +![底部导航](figures/底部导航.gif) + + +导航栏位置使用Tabs的参数barPosition进行设置,默认情况下,导航栏位于顶部,参数默认值为Start。设置为底部导航需要在Tabs传递参数,设置barPosition为End。 + + +```ts +Tabs({ barPosition: BarPosition.End }) { + // TabContent的内容:首页、发现、推荐、我的 + ... +} +``` + + +## 顶部导航 + +当内容分类较多,用户对不同内容的浏览概率相差不大,需要经常快速切换时,一般采用顶部导航模式进行设计,作为对底部导航内容的进一步划分,常见一些资讯类应用对内容的分类为关注、视频、数码,或者主题应用中对主题进行进一步划分为图片、视频、字体等。 + + **图4** 顶部导航栏   + +![顶部导航](figures/顶部导航.gif) + +Tabs组件默认的barPosition参数为Start,即顶部导航模式。 + + +```ts +Tabs({ barPosition: BarPosition.Start }) { + // TabContent的内容:关注、视频、游戏、数码、科技、体育、影视 + ... +} +``` + + +## 侧边导航 + +侧边导航是应用较为少见的一种导航模式,更多适用于横屏界面,用于对应用进行导航操作,由于用户的视觉习惯是从左到右,侧边导航栏默认为左侧侧边栏。 + + + **图5** 侧边导航栏   + +![侧边导航](figures/侧边导航.png) + + +实现侧边导航栏需要设置Tabs的属性vertical为true。在底部导航和顶部导航实现中,其默认值为false,表明内容页和导航栏垂直方向排列。 + + + +```ts +Tabs({ barPosition: BarPosition.Start }) { + // TabContent的内容:首页、发现、推荐、我的 + ... +} +.vertical(true) +.barWidth(100) +.barHeight(200) +``` + + +>**说明:** +> +> - vertical为true时,tabbar宽度会默认撑满屏幕的宽度,需要设置barWidth为合适值。 +> +> - vertical为true时,tabbar的高度会默认实际内容高度,需要设置barHeight为合适值。 + + +## 限制导航栏的滑动切换 + + 默认情况下,导航栏都支持滑动切换,在一些内容信息量需要进行多级分类的页面,如支持底部导航+顶部导航组合的情况下,底部导航栏的滑动效果与顶部导航出现冲突,此时需要限制底部导航的滑动,避免引起不好的用户体验。 + **图6** 限制底部导航栏滑动   + +![限制导航](figures/限制导航.gif) + + +控制滑动切换的属性为scrollable,默认值为true,表示可以滑动,若要限制滑动切换页签则需要设置为false。 + + + +```ts +Tabs({ barPosition: BarPosition.End }) { + TabContent(){ + Column(){ + Tabs(){ + // 顶部导航栏内容 + ... + } + } + .backgroundColor('#ff08a8f1') + .width('100%') + } + .tabBar('首页') + + // 其他TabContent内容:发现、推荐、我的 + ... +} +.scrollable(false) +``` + + +## 固定导航栏 + +当内容分类较为固定且不具有拓展性时,例如底部导航内容分类一般固定,分类数量一般在3-5个,此时使用固定导航栏。固定导航栏不可滚动,无法被拖拽滚动,内容均分tabBar的宽度。 + + + **图7** 固定导航栏  + +![固定导航](figures/固定导航.gif) + + +Tabs的属性barMode是控制导航栏是否可以滚动,默认值为Fixed。 + + + +```ts +Tabs({ barPosition: BarPosition.End }) { + // TabContent的内容:首页、发现、推荐、我的 + ... +} +.barMode(BarMode.Fixed) +``` + + +## 滚动导航栏 + +滚动导航栏可以用于顶部导航栏或者侧边导航栏的设置,内容分类较多,屏幕宽度无法容纳所有分类页签的情况下,需要使用可滚动的导航栏,支持用户点击和滑动来加载隐藏的页签内容。 + + + **图8** 可滚动导航栏   + +![滚动导航](figures/滚动导航.gif) + + +滚动导航栏需要设置Tabs组件的barMode属性,默认情况下其值为Fixed,表示为固定导航栏,设置为Scrollable即可设置为可滚动导航栏。 + + + +```ts +Tabs({ barPosition: BarPosition.Start }) { + // TabContent的内容:关注、视频、游戏、数码、科技、体育、影视、人文、艺术、自然、军事 + ... +} +.barMode(BarMode.Scrollable) +``` + + +## 自定义导航栏 + +对于底部导航栏,一般作为应用主页面功能区分,为了更好的用户体验,会组合文字以及对应语义图标表示页签内容,这种情况下,需要自定义导航页签的样式。 + + + **图9** 自定义导航栏图   + +![custom-navigation-bar](figures/custom-navigation-bar.png) + + +系统默认情况下采用了下划线标志当前活跃的页签,而自定义导航栏需要自行实现相应的样式,用于区分当前活跃页签和未活跃页签。 + + +设置自定义导航栏需要使用tabBar的参数,以其支持的CustomBuilder的方式传入自定义的函数组件样式。例如这里声明TabBuilder的自定义函数组件,传入参数包括页签文字title,对应位置index,以及选中状态和未选中状态的图片资源。通过当前活跃的currentIndex和页签对应的targetIndex匹配与否,决定UI显示的样式。 + + + +```ts +@Builder TabBuilder(title: string, targetIndex: number, selectedImg: Resource, normalImg: Resource) { + Column() { + Image(this.currentIndex === targetIndex ? selectedImg : normalImg) + .size({ width: 25, height: 25 }) + Text(title) + .fontColor(this.currentIndex === targetIndex ? '#1698CE' : '#6B6B6B') + } + .width('100%') + .height(50) + .justifyContent(FlexAlign.Center) +} +``` + + +在TabContent对应tabBar属性中传入自定义函数组件,并传递相应的参数。 + + + +```ts +TabContent() { + Column(){ + Text('我的内容') + } + .width('100%') + .height('100%') + .backgroundColor('#007DFF') +} +.tabBar(this.TabBuilder('我的', 0, $r('app.media.mine_selected'), $r('app.media.mine_normal'))) +``` + + +## 切换至指定页签 + +在不使用自定义导航栏时,系统默认的Tabs会实现切换逻辑。在使用了自定义导航栏后,切换页签的逻辑需要手动实现。即用户点击对应页签时,屏幕需要显示相应的内容页。 + + + **图10** 使用自定义导航栏实现切换指定页签   + +![切换指定页签](figures/切换指定页签.gif) + + +切换指定页签需要使用TabsController,TabsController是Tabs组件的控制器,用于控制Tabs组件进行页签切换。通过TabsController的changeIndex方法来实现跳转至指定索引值对应的TabContent内容。 + + + +```ts +private tabsController : TabsController = new TabsController() +@State currentIndex:number = 0; + +@Builder TabBuilder(title: string, targetIndex: number) { + Column() { + Text(title) + .fontColor(this.currentIndex === targetIndex ? '#1698CE' : '#6B6B6B') + } + ... + .onClick(() => { + this.currentIndex = targetIndex; + this.tabsController.changeIndex(this.currentIndex); + }) +} +``` + + +使用自定义导航栏时,在tabBar属性中传入对应的\@Builder,并传入相应的参数。 + + + +```ts +Tabs({ barPosition: BarPosition.End, controller: this.tabsController }) { + TabContent(){ + ... + }.tabBar(this.TabBuilder('首页',0)) + + TabContent(){ + ... + }.tabBar(this.TabBuilder('发现',1)) + + TabContent(){ + ... + }.tabBar(this.TabBuilder('推荐',2)) + + TabContent(){ + ... + } + .tabBar(this.TabBuilder('我的',3)) +} +``` + + +## 滑动切换导航栏 + +在不使用自定义导航栏的情况下,Tabs默认会实现tabBar与TabContent的切换联动。但在使用了自定义导航栏后,使用TabsController可以实现点击页签与页面内容的联动,但不能实现滑动页面时,页面内容对应页签的联动。即用户在使用滑动屏幕切换页面内容时,页签栏需要同步切换至内容对应的页签。 + + + **图11** 滑动切换时页签内容不联动   + +![最终效果11](figures/最终效果11.gif) + + +此时需要使用Tabs提供的onChange事件方法,监听索引index的变化,并将其当前活跃的index值传递给currentIndex,实现页签内容的切换。 + + + + +```ts +Tabs({ barPosition: BarPosition.End, controller: this.tabsController }) { + TabContent() { + ... + }.tabBar(this.TabBuilder('首页', 0)) + + TabContent() { + ... + }.tabBar(this.TabBuilder('发现', 1)) + + TabContent() { + ... + }.tabBar(this.TabBuilder('推荐', 2)) + + TabContent() { + ... + } + .tabBar(this.TabBuilder('我的', 3)) +}.onChange((index) => { + this.currentIndex = index +}) +``` + + + **图12** 内容与页签联动  + +![最终效果](figures/最终效果.gif) + +## 相关实例 + +如需详细了解Tabs的更多实现,请参考以下示例: + +- [常用组件与布局](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/ArkTSComponents) diff --git a/zh-cn/application-dev/ui/arkts-page-transition-animation.md b/zh-cn/application-dev/ui/arkts-page-transition-animation.md new file mode 100644 index 0000000000000000000000000000000000000000..31b996ce9952b8fea4ebdfecf53320bdca18e9ba --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-page-transition-animation.md @@ -0,0 +1,361 @@ +# 页面转场动画 + + +两个页面间发生跳转,一个页面消失,另一个页面出现,这时可以配置各自页面的页面转场参数实现自定义的页面转场效果。[页面转场](../reference/arkui-ts/ts-page-transition-animation.md)效果写在pageTransition函数中,通过PageTransitionEnter和PageTransitionExit指定页面进入和退出的动画效果。 + + +PageTransitionEnter的接口为: + + + +```ts +PageTransitionEnter({type?: RouteType,duration?: number,curve?: Curve | string,delay?: number}) +``` + + +PageTransitionExit的接口为: + + + +```ts +PageTransitionExit({type?: RouteType,duration?: number,curve?: Curve | string,delay?: number}) +``` + + +上述接口定义了PageTransitionEnter和PageTransitionExit组件,可通过slide、translate、scale、opacity属性定义不同的页面转场效果。对于PageTransitionEnter而言,这些效果表示入场时起点值,对于PageTransitionExit而言,这些效果表示退场的终点值,这一点与组件转场transition配置方法类似。此外,PageTransitionEnter提供了onEnter接口进行自定义页面入场动画的回调,PageTransitionExit提供了onExit接口进行自定义页面退场动画的回调。 + + +上述接口中的参数type,表示路由生效的类型,这一点开发者容易混淆其含义。页面转场的两个页面,必定有一个页面退出,一个页面进入。如果通过router.pushUrl操作从页面A跳转到页面B,则页面A退出,做页面退场动画,页面B进入,做页面入场动画。如果通过router.back操作从页面B返回到页面A,则页面B退出,做页面退场动画,页面A进入,做页面入场动画。即页面的PageTransitionEnter既可能是由于新增页面(push,入栈)引起的新页面的入场动画,也可能是由于页面返回(back,或pop,出栈)引起的页面栈中老页面的入场动画,为了能区分这两种形式的入场动画,提供了type参数,这样开发者能完全定义所有类型的页面转场效果。 + + +## type配置为RouteType.None + +type为RouteType.None表示对页面栈的push、pop操作均生效,type的默认值为RouteType.None。 + + +```ts +// page A +pageTransition() { + // 定义页面进入时的效果,从左侧滑入,时长为1200ms,无论页面栈发生push还是pop操作均可生效 + PageTransitionEnter({ type: RouteType.None, duration: 1200 }) + .slide(SlideEffect.Left) + // 定义页面退出时的效果,向左侧滑出,时长为1000ms,无论页面栈发生push还是pop操作均可生效 + PageTransitionExit({ type: RouteType.None, duration: 1000 }) + .slide(SlideEffect.Left) +} +``` + + + +```ts +// page B +pageTransition() { + // 定义页面进入时的效果,从右侧滑入,时长为1000ms,无论页面栈发生push还是pop操作均可生效 + PageTransitionEnter({ type: RouteType.None, duration: 1000 }) + .slide(SlideEffect.Right) + // 定义页面退出时的效果,向右侧滑出,时长为1200ms,无论页面栈发生push还是pop操作均可生效 + PageTransitionExit({ type: RouteType.None, duration: 1200 }) + .slide(SlideEffect.Right) +} +``` + + +假设页面栈为多实例模式,即页面栈中允许存在重复的页面。可能会有4种场景,对应的页面转场效果如下表。 + + +| 路由操作 | 页面A转场效果 | 页面B转场效果 | +| ---------------------------- | ---------------------------------- | ---------------------------------- | +| router.pushUrl,从页面A跳转到新增的页面B | 页面退出,PageTransitionExit生效,向左侧滑出屏幕 | 页面进入,PageTransitionEnter生效,从右侧滑入屏幕 | +| router.back,从页面B返回到页面A | 页面进入,PageTransitionEnter生效,从左侧滑入屏幕 | 页面退出,PageTransitionExit生效,向右侧滑出屏幕 | +| router.pushUrl,从页面B跳转到新增的页面A | 页面进入,PageTransitionEnter生效,从左侧滑入屏幕 | 页面退出,PageTransitionExit生效,向右侧滑出屏幕 | +| router.back,从页面A返回到页面B | 页面退出,PageTransitionExit生效,向左侧滑出屏幕 | 页面进入,PageTransitionEnter生效,从右侧滑入屏幕 | + + +如果希望pushUrl进入的页面总是从右侧滑入,back时退出的页面总是从右侧滑出,则上表中的第3、4种情况不满足要求,那么需要完整的定义4个页面转场效果。 + + +## type配置为RouteType.Push或RouteType.Pop + +type为RouteType.Push表示仅对页面栈的push操作生效,type为RouteType.Pop表示仅对页面栈的pop操作生效。 + + +```ts +// page A +pageTransition() { + // 定义页面进入时的效果,从右侧滑入,时长为1200ms,页面栈发生push操作时该效果才生效 + PageTransitionEnter({ type: RouteType.Push, duration: 1200 }) + .slide(SlideEffect.Right) + // 定义页面进入时的效果,从左侧滑入,时长为1200ms,页面栈发生pop操作时该效果才生效 + PageTransitionEnter({ type: RouteType.Pop, duration: 1200 }) + .slide(SlideEffect.Left) + // 定义页面退出时的效果,向左侧滑出,时长为1000ms,页面栈发生push操作时该效果才生效 + PageTransitionExit({ type: RouteType.Push, duration: 1000 }) + .slide(SlideEffect.Left) + // 定义页面退出时的效果,向右侧滑出,时长为1000ms,页面栈发生pop操作时该效果才生效 + PageTransitionExit({ type: RouteType.Pop, duration: 1000 }) + .slide(SlideEffect.Right) +} +``` + + + +```ts +// page B +pageTransition() { + // 定义页面进入时的效果,从右侧滑入,时长为1000ms,页面栈发生push操作时该效果才生效 + PageTransitionEnter({ type: RouteType.Push, duration: 1000 }) + .slide(SlideEffect.Right) + // 定义页面进入时的效果,从左侧滑入,时长为1000ms,页面栈发生pop操作时该效果才生效 + PageTransitionEnter({ type: RouteType.Pop, duration: 1000 }) + .slide(SlideEffect.Left) + // 定义页面退出时的效果,向左侧滑出,时长为1200ms,页面栈发生push操作时该效果才生效 + PageTransitionExit({ type: RouteType.Push, duration: 1200 }) + .slide(SlideEffect.Left) + // 定义页面退出时的效果,向右侧滑出,时长为1200ms,页面栈发生pop操作时该效果才生效 + PageTransitionExit({ type: RouteType.Pop, duration: 1200 }) + .slide(SlideEffect.Right) +} +``` + + +以上代码则完整的定义了所有可能的页面转场样式。假设页面跳转配置为多实例模式,即页面栈中允许存在重复的页面。可能会有4种场景,对应的页面转场效果如下表。 + + +| 路由操作 | 页面A转场效果 | 页面B转场效果 | +| ---------------------------- | ---------------------------------------- | ---------------------------------------- | +| router.pushUrl,从页面A跳转到新增的页面B | 页面退出,PageTransitionExit且type为RouteType.Push的转场样式生效,向左侧滑出屏幕 | 页面进入,PageTransitionEnter且type为RouteType.Push的转场样式生效,从右侧滑入屏幕 | +| router.back,从页面B返回到页面A | 页面进入,PageTransitionEnter且type为RouteType.Pop的转场样式生效,从左侧滑入屏幕 | 页面退出,PageTransitionExit且type为RouteType.Pop的转场样式生效,向右侧滑出屏幕 | +| router.pushUrl,从页面B跳转到新增的页面A | 页面进入,PageTransitionEnter且type为RouteType.Push的转场样式生效,从右侧滑入屏幕 | 页面退出,PageTransitionExit且type为RouteType.Push的转场样式生效,向左侧滑出屏幕 | +| router.back,从页面A返回到页面B | 页面退出,PageTransitionExit且type为RouteType.Pop的转场样式生效,向右侧滑出屏幕 | 页面进入,PageTransitionEnter且type为RouteType.Pop的转场样式生效,从左侧滑入屏幕 | + + +>**说明:** +> +> 1. 由于每个页面的页面转场样式都可由开发者独立配置,而页面转场涉及到两个页面,开发者应考虑两个页面的页面转场效果的衔接,如时长尽量保持一致。 +> +> 2. 如果没有定义匹配的页面转场样式,则该页面使用系统默认的页面转场样式。 + + +## 禁用某页面的页面转场 + + +```ts +pageTransition() { + PageTransitionEnter({ type: RouteType.None, duration: 0 }) + PageTransitionExit({ type: RouteType.None, duration: 0 }) +} +``` + + +通过设置页面转场的时长为0,可使该页面无页面转场动画。 + + +## 场景示例 + +下面介绍定义了所有的四种页面转场样式的页面转场动画示例。 + + + +```ts +// page A +import router from '@ohos.router'; +@Entry +@Component +struct PageTransitionSrc1 { + build() { + Column() { + Image($r('app.media.mountain')) + .width('90%') + .height('80%') + .objectFit(ImageFit.Fill) + .syncLoad(true) // 同步加载图片,使页面出现时图片已经加载完成 + .margin(30) + + Row({ space: 10 }) { + Button("pushUrl") + .onClick(() => { + // 路由到下一个页面,push操作 + router.pushUrl({ url: 'pages/myTest/pageTransitionDst1' }); + }) + Button("back") + .onClick(() => { + // 返回到上一页面,相当于pop操作 + router.back(); + }) + }.justifyContent(FlexAlign.Center) + } + .width("100%").height("100%") + .alignItems(HorizontalAlign.Center) + } + + pageTransition() { + // 定义页面进入时的效果,从右侧滑入,时长为1000ms,页面栈发生push操作时该效果才生效 + PageTransitionEnter({ type: RouteType.Push, duration: 1000 }) + .slide(SlideEffect.Right) + // 定义页面进入时的效果,从左侧滑入,时长为1000ms,页面栈发生pop操作时该效果才生效 + PageTransitionEnter({ type: RouteType.Pop, duration: 1000 }) + .slide(SlideEffect.Left) + // 定义页面退出时的效果,向左侧滑出,时长为1000ms,页面栈发生push操作时该效果才生效 + PageTransitionExit({ type: RouteType.Push, duration: 1000 }) + .slide(SlideEffect.Left) + // 定义页面退出时的效果,向右侧滑出,时长为1000ms,页面栈发生pop操作时该效果才生效 + PageTransitionExit({ type: RouteType.Pop, duration: 1000 }) + .slide(SlideEffect.Right) + } +} +``` + + + + +```ts +// page B +import router from '@ohos.router'; +@Entry +@Component +struct PageTransitionDst1 { + build() { + Column() { + Image($r('app.media.forest')) + .width('90%') + .height('80%') + .objectFit(ImageFit.Fill) + .syncLoad(true) // 同步加载图片,使页面出现时图片已经加载完成 + .margin(30) + + Row({ space: 10 }) { + Button("pushUrl") + .onClick(() => { + // 路由到下一页面,push操作 + router.pushUrl({ url: 'pages/myTest/pageTransitionSrc1' }); + }) + Button("back") + .onClick(() => { + // 返回到上一页面,相当于pop操作 + router.back(); + }) + }.justifyContent(FlexAlign.Center) + } + .width("100%").height("100%") + .alignItems(HorizontalAlign.Center) + } + + pageTransition() { + // 定义页面进入时的效果,从右侧滑入,时长为1000ms,页面栈发生push操作时该效果才生效 + PageTransitionEnter({ type: RouteType.Push, duration: 1000 }) + .slide(SlideEffect.Right) + // 定义页面进入时的效果,从左侧滑入,时长为1000ms,页面栈发生pop操作时该效果才生效 + PageTransitionEnter({ type: RouteType.Pop, duration: 1000 }) + .slide(SlideEffect.Left) + // 定义页面退出时的效果,向左侧滑出,时长为1000ms,页面栈发生push操作时该效果才生效 + PageTransitionExit({ type: RouteType.Push, duration: 1000 }) + .slide(SlideEffect.Left) + // 定义页面退出时的效果,向右侧滑出,时长为1000ms,页面栈发生pop操作时该效果才生效 + PageTransitionExit({ type: RouteType.Pop, duration: 1000 }) + .slide(SlideEffect.Right) + } +} +``` + + + +![pageTransition_PushPop](figures/pageTransition_PushPop.gif) + + +下面介绍使用了type为None的页面转场动画示例。 + + + +```ts +// page A +import router from '@ohos.router'; +@Entry +@Component +struct PageTransitionSrc2 { + build() { + Column() { + Image($r('app.media.mountain')) + .width('90%') + .height('80%') + .objectFit(ImageFit.Fill) + .syncLoad(true) // 同步加载图片,使页面出现时图片已经加载完成 + .margin(30) + + Row({ space: 10 }) { + Button("pushUrl") + .onClick(() => { + // 路由到下一页面,push操作 + router.pushUrl({ url: 'pages/myTest/pageTransitionDst2' }); + }) + Button("back") + .onClick(() => { + // 返回到上一页面,相当于pop操作 + router.back(); + }) + }.justifyContent(FlexAlign.Center) + } + .width("100%").height("100%") + .alignItems(HorizontalAlign.Center) + } + + pageTransition() { + // 定义页面进入时的效果,从左侧滑入,时长为1000ms,无论页面栈发生push还是pop操作均可生效 + PageTransitionEnter({ duration: 1000 }) + .slide(SlideEffect.Left) + // 定义页面退出时的效果,相对于正常页面位置x方向平移100vp,y方向平移100vp,透明度变为0,时长为1200ms,无论页面栈发生push还是pop操作均可生效 + PageTransitionExit({ duration: 1200 }) + .translate({ x: 100.0, y: 100.0 }) + .opacity(0) + } +} +``` + + + +```ts +// page B +import router from '@ohos.router'; +@Entry +@Component +struct PageTransitionDst2 { + build() { + Column() { + Image($r('app.media.forest')) + .width('90%') + .height('80%') + .objectFit(ImageFit.Fill) + .syncLoad(true) // 同步加载图片,使页面出现时图片已经加载完成 + .margin(30) + + Row({ space: 10 }) { + Button("pushUrl") + .onClick(() => { + // 路由到下一页面,push操作 + router.pushUrl({ url: 'pages/myTest/pageTransitionSrc2' }); + }) + Button("back") + .onClick(() => { + // 返回到上一页面,相当于pop操作 + router.back(); + }) + }.justifyContent(FlexAlign.Center) + } + .width("100%").height("100%") + .alignItems(HorizontalAlign.Center) + } + + pageTransition() { + // 定义页面进入时的效果,从左侧滑入,时长为1200ms,无论页面栈发生push还是pop操作均可生效 + PageTransitionEnter({ duration: 1200 }) + .slide(SlideEffect.Left) + // 定义页面退出时的效果,相对于正常页面位置x方向平移100vp,y方向平移100vp,透明度变为0,时长为1000ms,无论页面栈发生push还是pop操作均可生效 + PageTransitionExit({ duration: 1000 }) + .translate({ x: 100.0, y: 100.0 }) + .opacity(0) + } +} +``` + + + +![pageTransition_None](figures/pageTransition_None.gif) diff --git a/zh-cn/application-dev/ui/ui-ts-performance-improvement-recommendation.md b/zh-cn/application-dev/ui/arkts-performance-improvement-recommendation.md similarity index 100% rename from zh-cn/application-dev/ui/ui-ts-performance-improvement-recommendation.md rename to zh-cn/application-dev/ui/arkts-performance-improvement-recommendation.md diff --git a/zh-cn/application-dev/ui/arkts-popup-and-menu-components-menu.md b/zh-cn/application-dev/ui/arkts-popup-and-menu-components-menu.md new file mode 100644 index 0000000000000000000000000000000000000000..1431af7662a57ee4f796a40a459b7f67279965e6 --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-popup-and-menu-components-menu.md @@ -0,0 +1,111 @@ +# 菜单 + + +Menu是菜单接口,一般用于鼠标右键弹窗、点击弹窗等。具体用法请参考[Menu控制](../reference/arkui-ts/ts-universal-attributes-menu.md)。 + + +## 创建默认样式的菜单 + +菜单需要调用bindMenu接口来实现。bindMenu响应绑定组件的点击事件,绑定组件后手势点击对应组件后即可弹出。 + + + +```ts +Button('click for Menu') + .bindMenu([ + { + value: 'Menu1', + action: () => { + console.info('handle Menu1 select') + } + } +]) +``` + + +![zh-cn_image_0000001562940565](figures/zh-cn_image_0000001562940565.png) + + +## 创建自定义样式的菜单 + +当默认样式不满足开发需求时,可使用\@CustomBuilder自定义菜单内容。可通过bindContextMenu接口进行菜单的自定义。 + + +### \@Builder开发菜单内的内容 + + +```ts +@State select: boolean = true +private iconStr: ResourceStr = $r("app.media.view_list_filled") +private iconStr2: ResourceStr = $r("app.media.view_list_filled") +@Builder +SubMenu() { + Menu() { + MenuItem({ content: "复制", labelInfo: "Ctrl+C" }) + MenuItem({ content: "粘贴", labelInfo: "Ctrl+V" }) + } +} + +@Builder +MyMenu(){ + Menu() { + MenuItem({ startIcon: $r("app.media.icon"), content: "菜单选项" }) + MenuItem({ startIcon: $r("app.media.icon"), content: "菜单选项" }).enabled(false) + MenuItem({ + startIcon: this.iconStr, + content: "菜单选项", + endIcon: $r("app.media.arrow_right_filled"), + // 当builder参数进行配置时,表示与menuItem项绑定了子菜单。鼠标hover在该菜单项时,会显示子菜单。 + builder: this.SubMenu.bind(this), + }) + MenuItemGroup({ header: '小标题' }) { + MenuItem({ content: "菜单选项" }) + .selectIcon(true) + .selected(this.select) + .onChange((selected) => { + console.info("menuItem select" + selected); + this.iconStr2 = $r("app.media.icon"); + }) + MenuItem({ + startIcon: $r("app.media.view_list_filled"), + content: "菜单选项", + endIcon: $r("app.media.arrow_right_filled"), + builder: this.SubMenu.bind(this)\ + }) + } + MenuItem({ + startIcon: this.iconStr2, + content: "菜单选项", + endIcon: $r("app.media.arrow_right_filled") + }) + } +} + +``` + + +### bindMenu属性绑定组件 + + +```ts +Button('click for Menu') + .bindMenu(this.MyMenu) +``` + + +![zh-cn_image_0000001511580924](figures/zh-cn_image_0000001511580924.png) + + +## 创建支持右键或长按的菜单 + +通过bindContextMenu接口进行菜单的自定义及菜单弹出的触发方式:右键或长按。使用bindContextMenu弹出的菜单项是在独立子窗口内的,可显示在应用窗口外部。 + + +- [@Builder开发菜单内的内容](#builder开发菜单内的内容)与上文写法相同。 + +- 确认菜单的弹出方式,使用bindContextMenu属性绑定组件。示例中为右键弹出菜单。 + + ```ts + Button('click for Menu') + .bindContextMenu(this.MyMenu, ResponseType.RightClick) + ``` diff --git a/zh-cn/application-dev/ui/arkts-popup-and-menu-components-popup.md b/zh-cn/application-dev/ui/arkts-popup-and-menu-components-popup.md new file mode 100644 index 0000000000000000000000000000000000000000..6c2712d95d2c8ccee73972d2aa6da6942e73adc1 --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-popup-and-menu-components-popup.md @@ -0,0 +1,158 @@ +# 气泡提示 + + +Popup属性可绑定在组件上显示气泡弹窗提示,设置弹窗内容、交互逻辑和显示状态。主要用于屏幕录制、信息弹出提醒等显示状态。 + + +气泡分为两种类型,一种是系统提供的气泡[PopupOptions](../reference/arkui-ts/ts-universal-attributes-popup.md#popupoptions类型说明),一种是开发者可以自定义的气泡[CustomPopupOptions](../reference/arkui-ts/ts-universal-attributes-popup.md#custompopupoptions8类型说明)。其中PopupOptions为系统提供的气泡,通过配置primaryButton、secondaryButton来设置带按钮的气泡。CustomPopupOptions通过配置[builder](../quick-start/arkts-builder.md)参数来设置自定义的气泡。 + + +## 文本提示气泡 + +文本提示气泡常用于只展示带有文本的信息提示,不带有任何交互的场景。Popup属性需绑定组件,当bindPopup属性中参数show为true的时候会弹出气泡提示。 + +在Button组件上绑定Popup属性,每次点击Button按钮,handlePopup会切换布尔值,当其为true时,触发bindPopup弹出气泡。 + + + +```ts +@Entry +@Component +struct PopupExample { + @State handlePopup: boolean = false + + build() { + Column() { + Button('PopupOptions') + .onClick(() => { + this.handlePopup = !this.handlePopup + }) + .bindPopup(this.handlePopup, { + message: 'This is a popup with PopupOptions', + }) + }.width('100%').padding({ top: 5 }) + } +} +``` + + +![zh-cn_image_0000001511740524](figures/zh-cn_image_0000001511740524.png) + + +## 带按钮的提示气泡 + +通过primaryButton、secondaryButton属性为气泡最多设置两个Button按钮,通过此按钮进行简单的交互;开发者可以通过配置action参数来设置想要触发的操作。 + + + +```ts +@Entry +@Component +struct PopupExample22 { + @State handlePopup: boolean = false + build() { + Column() { + Button('PopupOptions').margin({top:200}) + .onClick(() => { + this.handlePopup = !this.handlePopup + }) + .bindPopup(this.handlePopup, { + message: 'This is a popup with PopupOptions', + primaryButton:{ + value:'Confirm', + action: () => { + this.handlePopup = !this.handlePopup + console.info('confirm Button click') + } + }, + secondaryButton: { + value: 'Cancel', + action: () => { + this.handlePopup = !this.handlePopup + } + }, + }) + }.width('100%').padding({ top: 5 }) + } +} +``` + + +![zh-cn_other_0000001500740342](figures/zh-cn_other_0000001500740342.jpeg) + + +## 自定义气泡 + +开发者可以使用构建器CustomPopupOptions创建自定义气泡,\@Builder中可以放自定义的内容。除此之外,还可以通过popupColor等参数控制气泡样式。 + + + +```ts +@Entry +@Component +struct Index { + @State customPopup: boolean = false + // popup构造器定义弹框内容 + @Builder popupBuilder() { + Row({ space: 2 }) { + Image($r("app.media.icon")).width(24).height(24).margin({ left: 5 }) + Text('This is Custom Popup').fontSize(15) + }.width(200).height(50).padding(5) + } + build() { + Column() { + Button('CustomPopupOptions') + .position({x:100,y:200}) + .onClick(() => { + this.customPopup = !this.customPopup + }) + .bindPopup(this.customPopup, { + builder: this.popupBuilder, // 气泡的内容 + placement:Placement.Bottom, // 气泡的弹出位置 + popupColor:Color.Pink // 气泡的背景色 + }) + } + .height('100%') + } +} +``` + + +使用者通过配置placement参数将弹出的气泡放到需要提示的位置。弹窗构造器会触发弹出提示信息,来引导使用者完成操作,也让使用者有更好的UI体验。 + + +![zh-cn_other_0000001500900234](figures/zh-cn_other_0000001500900234.jpeg) + + + +```ts +@Entry +@Component +struct Index { + @State customPopup: boolean = false + // popup构造器定义弹框内容 + @Builder popupBuilder() { + Row({ space: 2 }) { + Image('/images/shengWhite.png').width(30).objectFit(ImageFit.Contain) + Column(){ + Text('控制人生').fontSize(14).fontWeight(900).fontColor(Color.White).width('100%') + Text('想要跟唱时,数千万歌曲任你选择,人声随心调整。').fontSize(12).fontColor('#ffeeeeee').width('100%') + } + }.width(230).height(80).padding(5) + } + build() { + Row() { + Text('我要K歌') + Image('/images/sheng.png').width(35).objectFit(ImageFit.Contain) + .onClick(() => { + this.customPopup = !this.customPopup + }) + .bindPopup(this.customPopup, { + builder: this.popupBuilder, + }) + } + .margin(20) + .height('100%') + } +} +``` diff --git a/zh-cn/application-dev/ui/arkts-routing.md b/zh-cn/application-dev/ui/arkts-routing.md new file mode 100644 index 0000000000000000000000000000000000000000..9b429f754dc95927a022da333200c0ca09e7f6fd --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-routing.md @@ -0,0 +1,325 @@ +# 页面路由 + + +页面路由指在应用程序中实现不同页面之间的跳转和数据传递。OpenHarmony提供了Router模块,通过不同的url地址,可以方便地进行页面路由,轻松地访问不同的页面。本文将从[页面跳转](#页面跳转)、[页面返回](#页面返回)和[页面返回前增加一个询问框](#页面返回前增加一个询问框)几个方面介绍Router模块提供的功能。 + + +## 页面跳转 + +页面跳转是开发过程中的一个重要组成部分。在使用应用程序时,通常需要在不同的页面之间跳转,有时还需要将数据从一个页面传递到另一个页面。 + + **图1** 页面跳转 +![router-jump-to-detail](figures/router-jump-to-detail.gif) + +Router模块提供了两种跳转模式,分别是[router.pushUrl()](../reference/apis/js-apis-router.md#routerpushurl9)和[router.replaceUrl()](../reference/apis/js-apis-router.md#routerreplaceurl9)。这两种模式决定了目标页面是否会替换当前页。 + +- router.pushUrl():目标页面不会替换当前页,而是压入[页面栈](../application-models/page-mission-stack.md)。这样可以保留当前页的状态,并且可以通过返回键或者调用[router.back()](../reference/apis/js-apis-router.md#routerback)方法返回到当前页。 + +- router.replaceUrl():目标页面会替换当前页,并销毁当前页。这样可以释放当前页的资源,并且无法返回到当前页。 + +>**说明:** +> +>页面栈的最大容量为32个页面。如果超过这个限制,可以调用[router.clear()](../reference/apis/js-apis-router.md#routerclear)方法清空历史页面栈,释放内存空间。 + +同时,Router模块提供了两种实例模式,分别是Standard和Single。这两种模式决定了目标url是否会对应多个实例。 + +- Standard:多实例模式,也是默认情况下的跳转模式。目标页面会被添加到页面栈顶,无论栈中是否存在相同url的页面。 + +- Single:单实例模式。如果目标页面的url已经存在于页面栈中,则会将离栈顶最近的同url页面移动到栈顶,该页面成为新建页。如果目标页面的url在页面栈中不存在同url页面,则按照默认的多实例模式进行跳转。 + +在使用页面路由Router相关功能之前,需要在代码中先导入Router模块。 + + +```ts +import router from '@ohos.router'; +``` + +- 场景一:有一个主页(Home)和一个详情页(Detail),希望从主页点击一个商品,跳转到详情页。同时,需要保留主页在页面栈中,以便返回时恢复状态。这种场景下,可以使用pushUrl()方法,并且使用Standard实例模式(或者省略)。 + + + ```ts + // 在Home页面中 + function onJumpClick(): void { + router.pushUrl({ + url: 'pages/Detail' // 目标url + }, router.RouterMode.Standard, (err) => { + if (err) { + console.error(`Invoke pushUrl failed, code is ${err.code}, message is ${err.message}`); + return; + } + console.info('Invoke pushUrl succeeded.'); + }); + } + ``` + + >**说明:** + > + >多实例模式下,router.RouterMode.Standard参数可以省略。 + +- 场景二:有一个登录页(Login)和一个个人中心页(Profile),希望从登录页成功登录后,跳转到个人中心页。同时,销毁登录页,在返回时直接退出应用。这种场景下,可以使用replaceUrl()方法,并且使用Standard实例模式(或者省略)。 + + + ```ts + // 在Login页面中 + function onJumpClick(): void { + router.replaceUrl({ + url: 'pages/Profile' // 目标url + }, router.RouterMode.Standard, (err) => { + if (err) { + console.error(`Invoke replaceUrl failed, code is ${err.code}, message is ${err.message}`); + return; + } + console.info('Invoke replaceUrl succeeded.'); + }) + } + ``` + + >**说明:** + > + >多实例模式下,router.RouterMode.Standard参数可以省略。 + +- 场景三:有一个设置页(Setting)和一个主题切换页(Theme),希望从设置页点击主题选项,跳转到主题切换页。同时,需要保证每次只有一个主题切换页存在于页面栈中,在返回时直接回到设置页。这种场景下,可以使用pushUrl()方法,并且使用Single实例模式。 + + + ```ts + // 在Setting页面中 + function onJumpClick(): void { + router.pushUrl({ + url: 'pages/Theme' // 目标url + }, router.RouterMode.Single, (err) => { + if (err) { + console.error(`Invoke pushUrl failed, code is ${err.code}, message is ${err.message}`); + return; + } + console.info('Invoke pushUrl succeeded.'); + }); + } + ``` + +- 场景四:有一个搜索结果列表页(SearchResult)和一个搜索结果详情页(SearchDetail),希望从搜索结果列表页点击某一项结果,跳转到搜索结果详情页。同时,如果该结果已经被查看过,则不需要再新建一个详情页,而是直接跳转到已经存在的详情页。这种场景下,可以使用replaceUrl()方法,并且使用Single实例模式。 + + + ```ts + // 在SearchResult页面中 + function onJumpClick(): void { + router.replaceUrl({ + url: 'pages/SearchDetail' // 目标url + }, router.RouterMode.Single, (err) => { + if (err) { + console.error(`Invoke replaceUrl failed, code is ${err.code}, message is ${err.message}`); + return; + } + console.info('Invoke replaceUrl succeeded.');}) + } + ``` + +以上是不带参数传递的场景。 + +如果需要在跳转时传递一些数据给目标页面,则可以在调用Router模块的方法时,添加一个params属性,并指定一个对象作为参数。例如: + + +```ts +class DataModelInfo { + age: number; +} + +class DataModel { + id: number; + info: DataModelInfo; +} + +function onJumpClick(): void { + // 在Home页面中 + let paramsInfo: DataModel = { + id: 123, + info: { + age: 20 + } + }; + + router.pushUrl({ + url: 'pages/Detail', // 目标url + params: paramsInfo // 添加params属性,传递自定义参数 + }, (err) => { + if (err) { + console.error(`Invoke pushUrl failed, code is ${err.code}, message is ${err.message}`); + return; + } + console.info('Invoke pushUrl succeeded.'); + }) +} +``` + +在目标页面中,可以通过调用Router模块的[getParams()](../reference/apis/js-apis-router.md#routergetparams)方法来获取传递过来的参数。例如: + + +```ts +const params = router.getParams(); // 获取传递过来的参数对象 +const id = params['id']; // 获取id属性的值 +const age = params['info'].age; // 获取age属性的值 +``` + + +## 页面返回 + +当用户在一个页面完成操作后,通常需要返回到上一个页面或者指定页面,这就需要用到页面返回功能。在返回的过程中,可能需要将数据传递给目标页面,这就需要用到数据传递功能。 + + **图2** 页面返回   + +![router-back-to-home](figures/router-back-to-home.gif) + +在使用页面路由Router相关功能之前,需要在代码中先导入Router模块。 + + +```ts +import router from '@ohos.router'; +``` + +可以使用以下几种方式进行页面返回: + +- 方式一:返回到上一个页面。 + + + ```ts + router.back(); + ``` + + 这种方式会返回到上一个页面,即上一个页面在页面栈中的位置。但是,上一个页面必须存在于页面栈中才能够返回,否则该方法将无效。 + +- 方式二:返回到指定页面。 + + + ```ts + router.back({ + url: 'pages/Home' + }); + ``` + + 这种方式可以返回到指定页面,需要指定目标页面的路径。目标页面必须存在于页面栈中才能够返回。 + +- 方式三:返回到指定页面,并传递自定义参数信息。 + + + ```ts + router.back({ + url: 'pages/Home', + params: { + info: '来自Home页' + } + }); + ``` + + 这种方式不仅可以返回到指定页面,还可以在返回的同时传递自定义参数信息。这些参数信息可以在目标页面中通过调用router.getParams()方法进行获取和解析。 + +在目标页面中,在需要获取参数的位置调用router.getParams()方法即可,例如在onPageShow()生命周期回调中: + + +```ts +onPageShow() { + const params = router.getParams(); // 获取传递过来的参数对象 + const info = params['info']; // 获取info属性的值 +} +``` + +>**说明:** +> +>当使用router.back()方法返回到指定页面时,该页面会被重新压入栈顶,而原栈顶页面(包括)到指定页面(不包括)之间的所有页面栈都将被销毁。 +> +> 另外,如果使用router.back()方法返回到原来的页面,原页面不会被重复创建,因此使用\@State声明的变量不会重复声明,也不会触发页面的aboutToAppear()生命周期回调。如果需要在原页面中使用返回页面传递的自定义参数,可以在需要的位置进行参数解析。例如,在onPageShow()生命周期回调中进行参数解析。 + + +## 页面返回前增加一个询问框 + +在开发应用时,为了避免用户误操作或者丢失数据,有时候需要在用户从一个页面返回到另一个页面之前,弹出一个询问框,让用户确认是否要执行这个操作。 + +本文将从[系统默认询问框](#系统默认询问框)和[自定义询问框](#自定义询问框)两个方面来介绍如何实现页面返回前增加一个询问框的功能。 + + **图3** 页面返回前增加一个询问框   + +![router-add-query-box-before-back](figures/router-add-query-box-before-back.gif) + + +### 系统默认询问框 + +为了实现这个功能,可以使用页面路由Router模块提供的两个方法:[router.showAlertBeforeBackPage()](../reference/apis/js-apis-router.md#routershowalertbeforebackpage9)和[router.back()](../reference/apis/js-apis-router.md#routerback)来实现这个功能。 + +在使用页面路由Router相关功能之前,需要在代码中先导入Router模块。 + + +```ts +import router from '@ohos.router'; +``` + +如果想要在目标界面开启页面返回询问框,需要在调用[router.back()](../reference/apis/js-apis-router.md#routerback)方法之前,通过调用[router.showAlertBeforeBackPage()](../reference/apis/js-apis-router.md#routershowalertbeforebackpage9)方法设置返回询问框的信息。例如,在支付页面中定义一个返回按钮的点击事件处理函数: + + +```ts +// 定义一个返回按钮的点击事件处理函数 +function onBackClick(): void { + // 调用router.showAlertBeforeBackPage()方法,设置返回询问框的信息 + try { + router.showAlertBeforeBackPage({ + message: '您还没有完成支付,确定要返回吗?' // 设置询问框的内容 + }); + } catch (err) { + console.error(`Invoke showAlertBeforeBackPage failed, code is ${err.code}, message is ${err.message}`); + } + + // 调用router.back()方法,返回上一个页面 + router.back(); +} +``` + +其中,router.showAlertBeforeBackPage()方法接收一个对象作为参数,该对象包含以下属性: + +message:string类型,表示询问框的内容。 +如果调用成功,则会在目标界面开启页面返回询问框;如果调用失败,则会抛出异常,并通过err.code和err.message获取错误码和错误信息。 + +当用户点击“返回”按钮时,会弹出确认对话框,询问用户是否确认返回。选择“取消”将停留在当前页目标页面;选择“确认”将触发router.back()方法,并根据参数决定如何执行跳转。 + +### 自定义询问框 + +自定义询问框的方式,可以使用[弹窗](../reference/apis/js-apis-promptAction.md#promptactionshowdialog)或者自定义弹窗实现。这样可以让应用界面与系统默认询问框有所区别,提高应用的用户体验度。本文以弹窗为例,介绍如何实现自定义询问框。 + +在使用页面路由Router相关功能之前,需要在代码中先导入Router模块。 + + +```ts +import router from '@ohos.router'; +``` + +在事件回调中,调用弹窗的[promptAction.showDialog()](../reference/apis/js-apis-promptAction.md#promptactionshowdialog)方法: + + +```ts +function onBackClick() { + // 弹出自定义的询问框 + promptAction.showDialog({ + message: '您还没有完成支付,确定要返回吗?', + buttons: [ + { + text: '取消', + color: '#FF0000' + }, + { + text: '确认', + color: '#0099FF' + } + ] + }).then((result) => { + if (result.index === 0) { + // 用户点击了“取消”按钮 + console.info('User canceled the operation.'); + } else if (result.index === 1) { + // 用户点击了“确认”按钮 + console.info('User confirmed the operation.'); + // 调用router.back()方法,返回上一个页面 + router.back(); + } + }).catch((err) => { + console.error(`Invoke showDialog failed, code is ${err.code}, message is ${err.message}`); + }) +} +``` + +当用户点击“返回”按钮时,会弹出自定义的询问框,询问用户是否确认返回。选择“取消”将停留在当前页目标页面;选择“确认”将触发router.back()方法,并根据参数决定如何执行跳转。 diff --git a/zh-cn/application-dev/ui/arkts-spring-animation.md b/zh-cn/application-dev/ui/arkts-spring-animation.md new file mode 100644 index 0000000000000000000000000000000000000000..6ad3d408a7a3ab018a6ac6e5be1ab7672b528a68 --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-spring-animation.md @@ -0,0 +1,166 @@ +# 弹簧曲线动画 + + +ArkUI提供了[预置动画曲线](../reference/arkui-ts/ts-appendix-enums.md#curve),指定了动画属性从起始值到终止值的变化规律,如Linear、Ease、EaseIn等。同时,ArkUI也提供了由弹簧振子物理模型产生的弹簧曲线。通过弹簧曲线,开发者可以设置超过设置的终止值,在终止值附近震荡,直至最终停下来的效果。弹簧曲线的动画效果比其他曲线具有更强的互动性、可玩性。 + + +弹簧曲线的接口包括两类,一类是[springCurve](../reference/apis/js-apis-curve.md#curvesspringcurve9),另一类是[springMotion](../reference/apis/js-apis-curve.md#curvesspringmotion9)和[responsiveSpringMotion](../reference/apis/js-apis-curve.md#curvesresponsivespringmotion9),这两种方式都可以产生弹簧曲线。 + + +## 使用springCurve + +springCurve的接口为: + + +```ts +springCurve(velocity: number, mass: number, stiffness: number, damping: number) +``` + +构造参数包括初速度,弹簧系统的质量、刚度、阻尼。构建springCurve时,可指定质量为1,根据springCurve中的参数说明,调节刚度、阻尼两个参数,达到想要的震荡效果。 + + + +```ts +import curves from '@ohos.curves'; +@Entry +@Component +struct SpringTest { + @State translateX: number = 0; + + private jumpWithSpeed(speed: number) { + this.translateX = -1; + animateTo({ duration: 2000, curve: curves.springCurve(speed, 1, 1, 1.2) }, () => { + // 以指定初速度进行x方向的平移的弹簧动画 + this.translateX = 0; + }) + } + + build() { + Column() { + Button("button") + .fontSize(14) + .width(100) + .height(50) + .margin(30) + .translate({ x: this.translateX }) + Row({space:50}) { + Button("jump 50").fontSize(14) + .onClick(() => { + // 以初速度50的弹簧曲线进行平移 + this.jumpWithSpeed(50); + }) + Button("jump 200").fontSize(14) + .onClick(() => { + // 以初速度200的弹簧曲线进行平移 + this.jumpWithSpeed(200); + }) + }.margin(30) + }.height('100%').width('100%') + } +} +``` + + +![springCurve](figures/springCurve.gif) + + +以上示例中,点击不同的按钮,给定springCurve的不同初速度,button会有“弹性”的到达指定位置,且button的振幅随着速度的增大而变大。另外也可以修改springCurve的质量、刚度、阻尼参数,达到想要的弹性的程度。 + + +>**说明:** +> +>速度只是放大了振荡的效果,但系统能否产生振荡的效果,取决于弹簧振子本身的物理参数,即质量、刚度、阻尼三个参数。刚度越小、阻尼越大,springCurve的“弹性”越弱,振荡效果越弱。随着刚度减小或阻尼变大,达到过阻尼状态后,无论速度为多大,都不会有在终点值附近振荡的效果。 + + +## 使用springMotion和responsiveSpringMotion + +[springMotion](../reference/apis/js-apis-curve.md#curvesspringmotion9)的接口为: + + +```ts +springMotion(response?: number, dampingFraction?: number, overlapDuration?: number) +``` + +[responsiveSpringMotion](../reference/apis/js-apis-curve.md#curvesresponsivespringmotion9)的接口为: + + +```ts +responsiveSpringMotion(response?: number, dampingFraction?: number, overlapDuration?: number) +``` + +它们的构造参数包括弹簧自然振动周期、阻尼系数、弹性动画衔接时长这三个可选参数,参数的含义请参考其文档。 + + +使用springMotion和responsiveSpringMotion曲线时,duration不生效,适合于跟手动画。 + + + +```ts +import curves from '@ohos.curves'; + +@Entry +@Component +struct SpringMotionTest { + @State positionX: number = 100; + @State positionY: number = 100; + diameter: number = 50; + + build() { + Column() { + Row() { + Circle({ width: this.diameter, height: this.diameter }) + .fill(Color.Blue) + .position({ x: this.positionX, y: this.positionY }) + .onTouch((event: TouchEvent) => { + if (event.type === TouchType.Move) { + // 跟手过程,使用responsiveSpringMotion曲线 + animateTo({ curve: curves.responsiveSpringMotion() }, () => { + // 减去半径,以使球的中心运动到手指位置 + this.positionX = event.touches[0].screenX - this.diameter / 2; + this.positionY = event.touches[0].screenY - this.diameter / 2; + console.info(`move, animateTo x:${this.positionX}, y:${this.positionY}`); + }) + } else if (event.type === TouchType.Up) { + // 离手时,使用springMotion曲线 + animateTo({ curve: curves.springMotion() }, () => { + this.positionX = 100; + this.positionY = 100; + console.info(`touchUp, animateTo x:100, y:100`); + }) + } + }) + } + .width("100%").height("80%") + .clip(true) // 如果球超出父组件范围,使球不可见 + .backgroundColor(Color.Orange) + + Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Start, justifyContent: FlexAlign.Center }) { + Text("拖动小球").fontSize(16) + } + .width("100%") + + Row() { + Text('点击位置: [x: ' + Math.round(this.positionX) + ', y:' + Math.round(this.positionY) + ']').fontSize(16) + } + .padding(10) + .width("100%") + }.height('100%').width('100%') + } +} +``` + + +以上代码是跟手动画的一个示例。通过在onTouch事件中,捕捉触摸的位置,改变组件的translate或者position属性,使其在跟手过程中运动到触摸位置,松手后回到原位置。跟手动画的效果如下: + + +![springMotion](figures/springMotion.gif) + + +跟手过程推荐使用responsiveSpringMotion曲线,松手过程推荐使用springMotion曲线。跟手过程随着手的位置变化会被多次触发,所以会接连启动多次responsiveSpringMotion动画,松手时启动一次springMotion动画。跟手、松手过程在对同一对象的同一属性上执行动画,且使用了springMotion或responsiveSpringMotion曲线,每次新启动的动画会继承上次动画使用的速度,实现平滑过渡。 + + +>**说明:** +> +> 1. springCurve可以设置初速度,单一属性存在多个动画时不会互相影响,观察到的是多个动画效果的叠加。 +> +> 2. springMotion虽然内部有速度机制,但不可由开发者设置。在单一属性存在多个动画时,后一动画会取代前一动画,并继承前一动画的速度。 diff --git a/zh-cn/application-dev/ui/arkts-transition-animation-within-component.md b/zh-cn/application-dev/ui/arkts-transition-animation-within-component.md new file mode 100644 index 0000000000000000000000000000000000000000..00a8f08c31241b96158750a39f92b581618f0bfb --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-transition-animation-within-component.md @@ -0,0 +1,256 @@ +# 组件内转场动画 + + +组件的插入、删除过程即为组件本身的转场过程,组件的插入、删除动画称为组件内转场动画。通过组件内转场动画,可定义组件出现、消失的效果。 + + +组件内转场动画的接口为: + + + +```ts +transition(value: TransitionOptions) +``` + + +[transition](../reference/arkui-ts/ts-transition-animation-component.md)函数的入参为组件内转场的效果,可以定义平移、透明度、旋转、缩放这几种转场样式的单个或者组合的转场效果,必须和[animateTo](arkts-layout-update-animation.md#使用显式动画产生布局更新动画)一起使用才能产生组件转场效果。 + + +## transition常见用法 + +type用于指定当前的transition动效生效在组件的变化场景,类型为[TransitionType](../reference/arkui-ts/ts-appendix-enums.md#transitiontype)。 + +- 组件的插入、删除使用同一个动画效果 + + ```ts + Button() + .transition({ type: TransitionType.All, scale: { x: 0, y: 0 } }) + ``` + + 当type属性为TransitionType.All时,表示指定转场动效生效在组件的所有变化(插入和删除)场景。此时,删除动画和插入动画是相反的过程,删除动画是插入动画的逆播。例如,以上代码定义了一个Button控件。在插入时,组件从scale的x、y均为0的状态,变化到scale的x、y均为1(即完整显示)的默认状态,以逐渐放大的方式出现。在删除时,组件从scale的x、y均为1的默认状态,变化到指定的scale的x、y均为0的状态,逐渐缩小至尺寸为0。 + + +- 组件的插入、删除使用不同的动画效果 + + ```ts + Button() + .transition({ type: TransitionType.Insert, translate: { x: 200, y: -200 }, opacity: 0 }) + .transition({ type: TransitionType.Delete, rotate: { x: 0, y: 0, z: 1, angle: 360 } }) + ``` + + 当组件的插入和删除需要实现不同的转场动画效果时,可以调用两次transition函数,分别设置type属性为TransitionType.Insert和TransitionType.Delete。例如,以上代码定义了一个Button控件。在插入时,组件从相对于组件正常布局位置x方向平移200vp、y方向平移-200vp的位置、透明度为0的初始状态,变化到x、y方向平移量为0、透明度为1的默认状态,插入动画为平移动画和透明度动画的组合。在删除时,组件从旋转角为0的默认状态,变化到绕z轴旋转360度的终止状态,即绕z轴旋转一周。 + + +- 只定义组件的插入或删除其中一种动画效果。 + + ```ts + Button() + .transition({ type: TransitionType.Delete, translate: { x: 200, y: -200 } }) + ``` + + 当只需要组件的插入或删除的转场动画效果时,仅需设置type属性为TransitionType.Insert或TransitionType.Delete的transition效果。例如,以上代码定义了一个Button控件。删除时,组件从正常位置、没有平移的默认状态,变化到从相对于正常布局位置x方向平移200vp、y方向平移-200vp的位置的状态。插入该组件并不会产生该组件的转场动画。 + + +## if/else产生组件内转场动画 + +if/else语句可以控制组件的插入和删除。如下代码即可通过Button的点击事件,控制if的条件是否满足,来控制if下的Image组件是否显示。 + + + +```ts +@Entry +@Component +struct IfElseTransition { + @State flag: boolean = true; + @State show: string = 'show'; + + build() { + Column() { + Button(this.show).width(80).height(30).margin(30) + .onClick(() => { + if (this.flag) { + this.show = 'hide'; + } else { + this.show = 'show'; + } + // 点击Button控制Image的显示和消失 + this.flag = !this.flag; + }) + if (this.flag) { + Image($r('app.media.mountain')).width(200).height(200) + } + }.height('100%').width('100%') + } +} +``` + + +以上代码没有配置任何动画。接下来,我们将给以上代码加入组件内转场的效果。首先Image组件是由if控制的组件,需要给其加上transition的参数,以指定组件内转场的具体效果。例如,可以如以下代码,给其插入时加上平移效果,删除时加上缩放和透明度效果。 + + + +```ts +if (this.flag) { + Image($r('app.media.mountain')).width(200).height(200) + .transition({ type: TransitionType.Insert, translate: { x: 200, y: -200 } }) + .transition({ type: TransitionType.Delete, opacity: 0, scale: { x: 0, y: 0 } }) +} +``` + + +以上代码虽然指定了动画的样式,但是未指定动画参数,尚不知道需要用多长时间、怎样的曲线完成该动画。transition必须配合animateTo一起使用,并在animateTo的闭包中,控制组件的插入、删除。对于以上示例代码,即为在animateTo闭包中改变flag的值,该部分代码如下所示。指定动画时长为1000ms,曲线使用animateTo函数默认的曲线,改变flag的值。则由flag变化所引起的一切变化,都会按照该动画参数,产生动画。在这里,flag会影响Image的出现和消失。 + + + +```ts +animateTo({ duration: 1000 }, () => { + this.flag = !this.flag; +}) +``` + + +经过以上过程,当animateTo和transition一起使用时,即产生了组件内转场动画。完整示例代码如下: + + + +```ts +@Entry +@Component +struct IfElseTransition { + @State flag: boolean = true; + @State show: string = 'show'; + + build() { + Column() { + Button(this.show).width(80).height(30).margin(30) + .onClick(() => { + if (this.flag) { + this.show = 'hide'; + } else { + this.show = 'show'; + } + + animateTo({ duration: 1000 }, () => { + // 动画闭包内控制Image组件的出现和消失 + this.flag = !this.flag; + }) + }) + if (this.flag) { + // Image的出现和消失配置为不同的过渡效果 + Image($r('app.media.mountain')).width(200).height(200) + .transition({ type: TransitionType.Insert, translate: { x: 200, y: -200 } }) + .transition({ type: TransitionType.Delete, opacity: 0, scale: { x: 0, y: 0 } }) + } + }.height('100%').width('100%') + } +} +``` + + +![ifElseTransition](figures/ifElseTransition.gif) + + +>**说明:** +> +>当配置transition的效果为translate或scale时,本身位置叠加上平移或放大倍数后,动画过程中有可能超过父组件的范围。如果超出父组件的范围时,希望子组件完整的显示,那么可以设置父组件的clip属性为false,使父组件不对子组件产生裁剪。如果超出父组件的范围时,希望超出的子组件部分不显示,那么可以设置父组件的clip属性为true,裁剪掉子组件超出的部分。 + + +## ForEach产生组件内转场动画 + +和if/else类似,ForEach可以通过控制数组中的元素个数,来控制组件的插入和删除。通过ForEach来产生组件内转场动画,仍然需要两个条件: + +- ForEach里的组件配置了transition效果。 + +- 在animateTo的闭包中控制组件的插入或删除,即控制数组的元素添加和删除。 + + +以下代码是使用ForEach产生组件内转场动画的一个示例。 + + + +```ts +@Entry +@Component +struct ForEachTransition { + @State numbers: string[] = ["1", "2", "3", "4", "5"] + startNumber: number = 6; + + build() { + Column({ space: 10 }) { + Column() { + ForEach(this.numbers, (item) => { + // ForEach下的直接组件需配置transition效果 + Text(item) + .width(240) + .height(60) + .fontSize(18) + .borderWidth(1) + .backgroundColor(Color.Orange) + .textAlign(TextAlign.Center) + .transition({ type: TransitionType.All, translate: { x: 200 }, scale: { x: 0, y: 0 } }) + }, item => item) + } + .margin(10) + .justifyContent(FlexAlign.Start) + .alignItems(HorizontalAlign.Center) + .width("90%") + .height("70%") + + Button('向头部添加元素') + .fontSize(16) + .width(160) + .onClick(() => { + animateTo({ duration: 1000 }, () => { + // 往数组头部插入一个元素,导致ForEach在头部增加对应的组件 + this.numbers.unshift(this.startNumber.toString()); + this.startNumber++; + }) + }) + Button('向尾部添加元素') + .width(160) + .fontSize(16) + .onClick(() => { + animateTo({ duration: 1000 }, () => { + // 往数组尾部插入一个元素,导致ForEach在尾部增加对应的组件 + this.numbers.push(this.startNumber.toString()); + this.startNumber++; + }) + }) + Button('删除头部元素') + .width(160) + .fontSize(16) + .onClick(() => { + animateTo({ duration: 1000 }, () => { + // 删除数组的头部元素,导致ForEach删除头部的组件 + this.numbers.shift(); + }) + }) + Button('删除尾部元素') + .width(160) + .fontSize(16) + .onClick(() => { + animateTo({ duration: 1000 }, () => { + // 删除数组的尾部元素,导致ForEach删除头部的组件 + this.numbers.pop(); + }) + }) + } + .width('100%') + .height('100%') + } +} +``` + + +效果如下图: + + +![forEachTransition2](figures/forEachTransition2.gif) + + +由于Column布局方式设为了FlexAlign.Start,即竖直方向从头部开始布局。所以往数组末尾添加元素时,并不会对数组中现存元素对应的组件位置造成影响,只会触发新增组件的插入动画。而往数组头部添加元素时,原来数组中的所有元素的下标都增加了,虽然不会触发其添加或者删除,但是会影响到对应组件的位置。所以除新增的组件会做transition动画以外,之前存在于ForEach中组件也会做位置动画。 + + +>**说明:** +> +>if/else、ForEach为语法节点,配置组件内转场效果的组件应直接作为语法节点的孩子。由语法节点的增删引起的组件增删,只能触发其直接孩子组件的组件内转场动画,开发者不应期望其对更深层次的组件产生组件转场动画。 diff --git a/zh-cn/application-dev/ui/arkts-ui-development-overview.md b/zh-cn/application-dev/ui/arkts-ui-development-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..92edc4d7d6d2b39efe1608ab6ad996169fd5c1b4 --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-ui-development-overview.md @@ -0,0 +1,95 @@ +# UI开发(ArkTS声明式开发范式)概述 + + +基于ArkTS的声明式开发范式的方舟开发框架是一套开发极简、高性能、支持跨设备的UI开发框架,提供了构建OpenHarmony应用UI所必需的能力,主要包括: + + +- **ArkTS** + + ArkTS是UI开发语言,基于TypeScript(简称TS)语言扩展而来,是TS的超集。扩展能力包含各种装饰器、自定义组件、UI描述机制。状态数据管理作为基于ArkTS的声明式开发范式的特色,通过功能不同的装饰器给开发者提供了清晰的页面更新渲染流程和管道。状态管理包括UI组件状态和应用程序状态,两者协作可以使开发者完整地构建整个应用的数据更新和UI渲染。ArkTS语言的基础知识请参考[学习ArkTS语言](../quick-start/arkts-get-started.md)。 + +- **布局** + + 布局是UI的必要元素,它定义了组件在界面中的位置。ArkUI框架提供了多种布局方式,除了基础的线性布局、层叠布局、弹性布局、相对布局、栅格布局外,也提供了相对复杂的列表、宫格、轮播。 + +- **组件** + + 组件是UI的必要元素,形成了在界面中的样子,由框架直接提供的称为**系统组件**,由开发者定义的称为**自定义组件**。系统内置组件包括按钮、单选框、进度条、文本等。开发者可以通过链式调用的方式设置系统内置组件的渲染效果。开发者可以将系统内置组件组合为自定义组件,通过这种方式将页面组件化为一个个独立的UI单元,实现页面不同单元的独立创建、开发和复用,具有更强的工程性。 + +- **页面路由和组件导航** + + 应用可能包含多个页面,可通过页面路由实现页面间的跳转。一个页面内可能存在组件间的导航如典型的分栏,可通过导航组件实现组件间的导航。 + +- **图形** + + 方舟开发框架提供了多种类型图片的显示能力和多种自定义绘制的能力,以满足开发者的自定义绘图需求,支持绘制形状、填充颜色、绘制文本、变形与裁剪、嵌入图片等。 + +- **动画** + + 动画是UI的重要元素之一。优秀的动画设计能够极大地提升用户体验,框架提供了丰富的动画能力,除了组件内置动画效果外,还包括属性动画、显式动画、自定义转场动画以及动画API等,开发者可以通过封装的物理模型或者调用动画能力API来实现自定义动画轨迹。 + +- **交互事件** + + 交互事件是UI和用户交互的必要元素。方舟开发框架提供了多种交互事件,除了触摸事件、鼠标事件、键盘按键事件、焦点事件等通用事件外,还包括基于通用事件进行进一步识别的手势事件。手势事件有单一手势如点击手势、长按手势、拖动手势、捏合手势、旋转手势、滑动手势,以及通过单一手势事件进行组合的组合手势事件。 + + +## 特点 + +- 开发效率高,开发体验好 + - 代码简洁:通过接近自然语义的方式描述UI,不必关心框架如何实现UI绘制和渲染。 + - 数据驱动UI变化:让开发者更专注自身业务逻辑的处理。当UI发生变化时,开发者无需编写在不同的UI之间进行切换的UI代码, 开发人员仅需要编写引起界面变化的数据,具体UI如何变化交给框架。 + - 开发体验好:界面也是代码,让开发者的编程体验得到提升。 + +- 性能优越 + - 声明式UI前端和UI后端分层:UI后端采用C++语言构建,提供对应前端的基础组件、布局、动效、交互事件、组件状态管理和渲染管线。 + - 语言编译器和运行时的优化:统一字节码、高效FFI-Foreign Function Interface、AOT-Ahead Of Time、引擎极小化、类型优化等。 + +- 生态容易快速推进 + 能够借力主流语言生态快速推进,语言相对中立友好,有相应的标准组织可以逐步演进。 + + +## 整体架构 + + **图1** 整体架构图   + +![arkui-arkts-framework](figures/arkui-arkts-framework.png) + + + + +- **声明式UI前端** + 提供了UI开发范式的基础语言规范,并提供内置的UI组件、布局和动画,提供了多种状态管理机制,为应用开发者提供一系列接口支持。 + +- **语言运行时** + 选用方舟语言运行时,提供了针对UI范式语法的解析能力、跨语言调用支持的能力和TS语言高性能运行环境。 + +- **声明式UI后端引擎** + 后端引擎提供了兼容不同开发范式的UI渲染管线,提供多种基础组件、布局计算、动效、交互事件,提供了状态管理和绘制能力。 + +- **渲染引擎** + 提供了高效的绘制能力,将渲染管线收集的渲染指令,绘制到屏幕的能力。 + +- **平台适配层** + 提供了对系统平台的抽象接口,具备接入不同系统的能力,如系统渲染管线、生命周期调度等。 + + +## 开发流程 + +使用UI开发框架开发应用时,主要涉及如下开发过程。开发者可以先通过[第一个入门](../quick-start/start-with-ets-stage.md)实例了解整个应用的UI开发过程。 + + +| 任务 | 简介 | 相关指导 | +| ----------- | ----------------------------------- | ---------------------------------------- | +| 学习ArkTS | 介绍了ArkTS的基本语法、状态管理和渲染控制的场景。 | - [基本语法](../quick-start/arkts-basic-syntax-overview.md)
- [状态管理](../quick-start/arkts-state-management-overview.md)
- [渲染控制](../quick-start/arkts-rendering-control-overview.md) | +| 开发布局 | 介绍了几种常用的布局方式以及如何提升布局性能。 | - [常用布局](arkts-layout-development-overview.md)
- [布局性能](arkts-layout-development-performance-boost.md) | +| 添加组件 | 介绍了几种常用的内置组件、自定义组件以及通过API方式支持的界面元素。 | - [常用组件](arkts-common-components-button.md)
- [自定义组件](../quick-start/arkts-create-custom-components.md)
- [气泡和菜单](arkts-popup-and-menu-components-popup.md) | +| 设置页面路由和组件导航 | 介绍了如何设置页面路由以及组件间的导航。 | - [页面路由](arkts-routing.md)
- [组件导航](arkts-navigation-navigation.md) | +| 显示图形 | 介绍了如何显示图片、绘制自定义几何图形以及使用画布绘制自定义图形。 | - [图片](arkts-graphics-display.md)
- [几何图形](arkts-geometric-shape-drawing.md)
- [画布](arkts-drawing-customization-on-canvas.md) | +| 使用动画 | 介绍了组件和页面使用动画的典型场景。 | - [页面内的动画](arkts-layout-update-animation.md)
- [页面间的动画](arkts-zoom-animation.md) | +| 绑定事件 | 介绍了事件的基本概念和如何使用通用事件和手势事件。 | - [通用事件](arkts-common-events-touch-screen-event.md)
- [手势事件](arkts-gesture-events-binding.md) | + +## 相关实例 + +基于ArkTS的声明式开发范式,可参考以下实例: + +[ArkTS组件集](https://gitee.com/openharmony/applications_app_samples/tree/master/code/UI/ArkTsComponentClollection/ComponentCollection):组件、通用方法、动画、全局方法的集合。 diff --git a/zh-cn/application-dev/ui/arkts-zoom-animation.md b/zh-cn/application-dev/ui/arkts-zoom-animation.md new file mode 100644 index 0000000000000000000000000000000000000000..59decbcb3f8d566eca5715a758a3045164f60721 --- /dev/null +++ b/zh-cn/application-dev/ui/arkts-zoom-animation.md @@ -0,0 +1,98 @@ +# 放大缩小视图 + + +在不同页面间,有使用相同的元素(例如同一幅图)的场景,可以使用[共享元素转场](../reference/arkui-ts/ts-transition-animation-shared-elements.md)动画衔接。为了突出不同页面间相同元素的关联性,可为它们添加共享元素转场动画。如果相同元素在不同页面间的大小有明显差异,即可达到放大缩小视图的效果。 + + +共享元素转场的接口为: + + + +```ts +sharedTransition(id: string, options?: sharedTransitionOptions) +``` + + +其中根据sharedTransitionOptions中的type参数,共享元素转场分为Exchange类型的共享元素转场和Static类型的共享元素转场。 + + +## Exchange类型的共享元素转场 + +交换型的共享元素转场,需要两个页面中,存在通过sharedTransition函数配置为相同id的组件,它们称为共享元素。这种类型的共享元素转场适用于两个页面间相同元素的衔接,会从起始页共享元素的位置、大小过渡到目标页的共享元素的位置、大小。如果不指定type,默认为Exchange类型的共享元素转场,这也是最常见的共享元素转场的方式。使用Exchange类型的共享元素转场时,共享元素转场的动画参数由目标页options中的动画参数决定。 + + +## Static类型的共享元素转场 + +静态型的共享元素转场通常用于页面跳转时,标题逐渐出现或隐藏的场景,只需要在一个页面中有Static的共享元素,不能在两个页面中出现相同id的Static类型的共享元素。在跳转到该页面(即目标页)时,配置Static类型sharedTransition的组件做透明度从0到该组件设定的透明度的动画,位置保持不变。在该页面(即起始页)消失时,做透明度逐渐变为0的动画,位置保持不变。 + +共享元素转场的动画参数由该组件sharedTransition属性中的动画参数决定。 + + +## 场景示例 + +下面介绍使用共享元素转场进行放大缩小图片的示例。 + + +```ts +// src page +import router from '@ohos.router'; + +@Entry +@Component +struct SharedTransitionSrc { + build() { + Column() { + // 配置Exchange类型的共享元素转场,共享元素id为"sharedImage1" + Image($r('app.media.mountain')).width(50).height(50) + .sharedTransition('sharedImage1', { duration: 1000, curve: Curve.Linear }) + .onClick(() => { + // 点击小图时路由跳转至下一页面 + router.pushUrl({ url: 'pages/myTest/sharedTransitionDst' }); + }) + } + .padding(10) + .width("100%") + .alignItems(HorizontalAlign.Start) + } +} +``` + + + + +```ts +// dest page +import router from '@ohos.router'; +@Entry +@Component +struct SharedTransitionDest { + build() { + Column() { + // 配置Static类型的共享元素转场 + Text("SharedTransition dest page") + .fontSize(16) + .sharedTransition('text', { duration: 500, curve: Curve.Linear, type: SharedTransitionEffectType.Static }) + .margin({ top: 10 }) + + // 配置Exchange类型的共享元素转场,共享元素id为"sharedImage1" + Image($r('app.media.mountain')) + .width(150) + .height(150) + .sharedTransition('sharedImage1', { duration: 500, curve: Curve.Linear }) + .onClick(() => { + // 点击图片时路由返回至上一页面 + router.back(); + }) + } + .width("100%") + .alignItems(HorizontalAlign.Center) + } +} +``` + + +上述示例中,第一个页面(src page)和第二个页面(dest page)都配置了id为"sharedImage1"的共享元素转场,使两个页面能匹配到这一组共享元素。从第一个页面跳转到第二个页面时,第一个页面为起始页,第二个页面为目标页。配置id为"sharedImage1"的组件按照目标页中500ms的时长进行共享元素转场,达到放大视图的效果,id为"text"的组件按照配置的Static类型sharedTransition参数中的500ms的时长进行共享元素转场,标题逐渐出现。从第二个页面返回到第一个页面时,第二个页面为起始页,第一个页面为目标页。配置id为"sharedImage1"的组件按照目标页中1000ms的时长进行共享元素转场,缩小为原始视图,id为"text"的组件按照配置的Static类型sharedTransition参数中的500ms的时长进行共享元素转场,标题逐渐隐藏。 + + + +![sharedTransition](figures/sharedTransition.gif) diff --git a/zh-cn/application-dev/ui/arkui-overview.md b/zh-cn/application-dev/ui/arkui-overview.md index f788b416e46528ccebe5a5c8f84693ee74cbb619..086e10fd36686346794581b1f3d0934f01550785 100644 --- a/zh-cn/application-dev/ui/arkui-overview.md +++ b/zh-cn/application-dev/ui/arkui-overview.md @@ -1,59 +1,46 @@ # 方舟开发框架概述 -方舟开发框架(简称:ArkUI),是一套构建OpenHarmony应用界面的UI开发框架,它提供了极简的UI语法与包括UI组件、动画机制、事件交互等在内的UI开发基础设施,以满足应用开发者的可视化界面开发需求。 -## 基本概念 - -- **组件:** 组件是界面搭建与显示的最小单位。开发者通过多种组件的组合,构建出满足自身应用诉求的完整界面。 +方舟开发框架(简称ArkUI)为OpenHarmony应用的UI开发提供了完整的基础设施,包括简洁的UI语法、丰富的UI功能(组件、布局、动画以及交互事件),以及实时界面预览工具等,可以支持开发者进行可视化界面开发。 -- **页面:** page页面是方舟开发框架最小的调度分割单位。开发者可以将应用设计为多个功能页面,每个页面进行单独的文件管理,并通过[页面路由](../reference/apis/js-apis-router.md)API完成页面间的调度管理,以实现应用内功能的解耦。 -## 主要特征 +## 基本概念 -- **UI组件:** 方舟开发框架内置了丰富的多态组件,包括文本、图片、按钮等基础组件,可包含一个或多个子组件的容器组件,满足开发者自定义绘图需求的绘制组件,以及提供视频播放能力的媒体组件等。其中“多态”是指组件针对不同类型设备进行了设计,提供了在不同平台上的样式适配能力。 +- **UI:** 即用户界面。开发者可以将应用的用户界面设计为多个功能页面,每个页面进行单独的文件管理,并通过[页面路由](arkts-routing.md)API完成页面间的调度管理如跳转、回退等操作,以实现应用内的功能解耦。 -- **布局:** UI界面设计离不开布局的参与。方舟开发框架提供了多种布局方式,除了基础的线性布局、弹性布局外,也提供了相对复杂的列表、宫格、栅格布局,以及自适应多分辨率场景开发的原子布局能力。 +- **组件:** UI构建与显示的最小单位,如列表、网格、按钮、单选框、进度条、文本等。开发者通过多种组件的组合,构建出满足自身应用诉求的完整界面。 -- **动画:** 动画是UI界面的重要元素之一,优秀的动画设计能够极大地提升用户体验,方舟开发框架提供了丰富的动画能力,除了组件内置动画效果外,还包括属性动画、自定义转场动画以及动画API等。 -- **绘制:** 方舟开发框架提供了多种绘制能力,以满足开发者的自定义绘图需求,支持绘制形状、颜色填充、绘制文本、变形与裁剪、嵌入图片等。 +## 两种开发范式 -- **交互事件:** 方舟开发框架提供了多种交互能力,以满足应用在不同平台通过不同输入设备进行UI交互响应的需求,默认适配了触摸手势、遥控器按键输入、键鼠输入,同时提供了相应的事件回调以便开发者添加交互逻辑。 +针对不用的应用场景及技术背景,方舟开发框架提供了两种开发范式,分别是[基于ArkTS的声明式开发范式](arkts-ui-development-overview.md)(简称“声明式开发范式”)和[兼容JS的类Web开发范式](../ui/ui-js-overview.md)(简称“类Web开发范式”)。 -- **平台API通道:** 方舟开发框架提供了API扩展机制,可通过该机制对平台能力进行封装,提供风格统一的JS接口。 +- **声明式开发范式**:采用基于TypeScript声明式UI语法扩展而来的[ArkTS语言](../quick-start/arkts-get-started.md),从组件、动画和状态管理三个维度提供UI绘制能力。 -- **两种开发范式:** 方舟开发框架针对不同的应用场景以及不同技术背景的开发者提供了两种开发范式,分别是[基于ArkTS的声明式开发范式](./ui-ts-overview.md)(简称“声明式开发范式”)和[兼容JS的类Web开发范式](./ui-js-overview.md)(简称“类Web开发范式”)。 +- **类Web开发范式**:采用经典的HML、CSS、JavaScript三段式开发方式,即使用HML标签文件搭建布局、使用CSS文件描述样式、使用JavaScript文件处理逻辑。该范式更符合于Web前端开发者的使用习惯,便于快速将已有的Web应用改造成方舟开发框架应用。 - | 开发范式名称 | 简介 | 适用场景 | 适用人群 | - | -------- | ---------------------------------------- | ---------------- | ------------------- | - | 声明式开发范式 | 采用基于TypeScript进行声明式UI语法扩展而来的[ArkTS语言](../quick-start/arkts-get-started.md),从组件、动画和状态管理三个维度提供了UI绘制能力。声明式开发范式更接近自然语义的编程方式,让开发者直观地描述UI界面,不必关心框架如何实现UI绘制和渲染,实现极简高效开发。 | 复杂度较大、团队合作度较高的应用 | 移动系统应用开发人员、系统应用开发人员 | - | 类Web开发范式 | 采用经典的HML、CSS、JavaScript三段式开发方式,使用HML标签文件进行布局搭建,使用CSS文件进行样式描述,使用JavaScript文件进行逻辑处理。UI组件与数据之间通过单向数据绑定的方式建立关联,当数据发生变化时,UI界面自动触发刷新。该开发方式更接近Web前端开发者的使用习惯,便于快速将已有的Web应用改造成方舟开发框架应用。 | 界面较简单的中小型应用和卡片 | Web前端开发人员 | +在开发一款新应用时,推荐采用声明式开发范式来构建UI,主要基于以下几点考虑: -## 框架结构 +- **开发效率:** 声明式开发范式更接近自然语义的编程方式,开发者可以直观地描述UI,无需关心如何实现UI绘制和渲染,开发高效简洁。 -![zh-cn_image_0000001183709904](figures/zh-cn_image_0000001183709904.png) +- **应用性能:** 如下图所示,两种开发范式的UI后端引擎和语言运行时是共用的,但是相比类Web开发范式,声明式开发范式无需JS框架进行页面DOM管理,渲染更新链路更为精简,占用内存更少,应用性能更佳。 -从上图可以看出,类Web开发范式与声明式开发范式的UI后端引擎和语言运行时是共用的,其中,UI后端引擎实现了方舟开发框架的六种基本能力。声明式开发范式无需JS Framework进行页面DOM管理,渲染更新链路更为精简,占用内存更少,因此更推荐开发者选用声明式开发范式来搭建应用UI界面。 +- **发展趋势**:声明式开发范式后续会作为主推的开发范式持续演进,为开发者提供更丰富、更强大的能力。 -## UI与Ability框架的关系 + **图1** 方舟开发框架示意图   -OpenHarmony提供了FA模型与Stage模型两种[应用模型](../application-models/application-model-description.md)。下表给出了两种模型分别与方舟开发框架的两种开发范式的关系。 + ![arkui-framework](figures/arkui-framework.png) - **FA模型:** -| 类型 | UI开发范式 | 说明 | -| ---- | -------- | ---------------------------------------- | -| 应用 | 类web开发范式 | UI开发语言:使用hml/css/js
业务入口:使用固定文件名app.ets(Page类型Ability)/service.ts(Service类型Ability)/data.ts(Data类型Ability)
业务逻辑语言:js/ts | -| | 声明式开发范式 | UI开发语言:ArkTS
业务入口:使用固定文件名app.ets(Page类型Ability)/service.ts(Service类型Ability)/data.ts(Data类型Ability)
业务逻辑语言:js/ts | -| 服务卡片 | 类web开发范式 | UI开发语言:卡片显示使用hml+css+json(action)
业务入口:form.ts
卡片业务逻辑语言:js/ts | -| | 声明式开发范式 | 当前不支持 | +## 不同应用类型支持的开发范式 - **Stage模型:** +根据所选用OpenHarmony[应用模型](../application-models/application-model-composition.md)(Stage模型、FA模型)和页面形态(应用或服务的普通页面、卡片)的不同,对应支持的UI开发范式也有所差异,详见下表。 -| 类型 | UI开发范式 | 说明 | -| -------- | -------------- | ------------------------------------------------------------ | -| 应用 | 类web开发范式 | 当前不支持 | -| | 声明式开发范式 | UI开发语言:ArkTS
业务入口:应用模型基于ohos.app.ability.UIAbility/ExtensionAbility等派生
业务逻辑语言:ts | -| 服务卡片 | 类web开发范式 | UI开发语言:卡片显示使用hml+css+json(action)
业务入口:从FormExtensionAbility派生
业务逻辑语言:ts | -| | 声明式开发范式 | 当前不支持 | + **表1** 支持的UI开发范式 +| 应用模型 | 页面形态 | 支持的UI开发范式 | +| ----------- | -------- | ------------------------ | +| Stage模型(推荐) | 应用或服务的页面 | 声明式开发范式(推荐) | +| | 卡片 | 声明式开发范式(推荐)
类Web开发范式 | +| FA模型 | 应用或服务的页面 | 声明式开发范式
类Web开发范式 | +| | 卡片 | 类Web开发范式 | diff --git a/zh-cn/application-dev/ui/figures/2023022700701(1).jpg b/zh-cn/application-dev/ui/figures/2023022700701(1).jpg new file mode 100644 index 0000000000000000000000000000000000000000..53a5dba3a495af6562da8e2bee506c88b0c7d7ba Binary files /dev/null and b/zh-cn/application-dev/ui/figures/2023022700701(1).jpg differ diff --git a/zh-cn/application-dev/ui/figures/2023022701120(1).jpg b/zh-cn/application-dev/ui/figures/2023022701120(1).jpg new file mode 100644 index 0000000000000000000000000000000000000000..950c2ea49f2407f07277f319ec8099cf1e2ce5dd Binary files /dev/null and b/zh-cn/application-dev/ui/figures/2023022701120(1).jpg differ diff --git a/zh-cn/application-dev/ui/figures/2023022792216(1).jpg b/zh-cn/application-dev/ui/figures/2023022792216(1).jpg new file mode 100644 index 0000000000000000000000000000000000000000..41d92c28e660fffdfa518982ef633416941fbb9d Binary files /dev/null and b/zh-cn/application-dev/ui/figures/2023022792216(1).jpg differ diff --git a/zh-cn/application-dev/ui/figures/2023022793003(1).jpg b/zh-cn/application-dev/ui/figures/2023022793003(1).jpg new file mode 100644 index 0000000000000000000000000000000000000000..5f89a57ecd79bf7f46cc19eb49acf9dbbaaa1edd Binary files /dev/null and b/zh-cn/application-dev/ui/figures/2023022793003(1).jpg differ diff --git a/zh-cn/application-dev/ui/figures/2023022793350(1).jpg b/zh-cn/application-dev/ui/figures/2023022793350(1).jpg new file mode 100644 index 0000000000000000000000000000000000000000..74205f7d264efc72ccac31d2aeb9af7da0255d55 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/2023022793350(1).jpg differ diff --git a/zh-cn/application-dev/ui/figures/2023022793719(1).jpg b/zh-cn/application-dev/ui/figures/2023022793719(1).jpg new file mode 100644 index 0000000000000000000000000000000000000000..328ea27be52901f0aa1e2a77764840c7e14f3e80 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/2023022793719(1).jpg differ diff --git a/zh-cn/application-dev/ui/figures/2023022794031(1).jpg b/zh-cn/application-dev/ui/figures/2023022794031(1).jpg new file mode 100644 index 0000000000000000000000000000000000000000..67104a5b1dfc638e56e7ce322d68e555b009c8a7 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/2023022794031(1).jpg differ diff --git a/zh-cn/application-dev/ui/figures/2023022794521(1).jpg b/zh-cn/application-dev/ui/figures/2023022794521(1).jpg new file mode 100644 index 0000000000000000000000000000000000000000..fef7086bd78fdccf2833994a0824613d8519466a Binary files /dev/null and b/zh-cn/application-dev/ui/figures/2023022794521(1).jpg differ diff --git a/zh-cn/application-dev/ui/figures/2023022795105(1).jpg b/zh-cn/application-dev/ui/figures/2023022795105(1).jpg new file mode 100644 index 0000000000000000000000000000000000000000..e729f45969660af14b82ed8c8e5f3c0b1af0e00c Binary files /dev/null and b/zh-cn/application-dev/ui/figures/2023022795105(1).jpg differ diff --git a/zh-cn/application-dev/ui/figures/2023032401632.jpg b/zh-cn/application-dev/ui/figures/2023032401632.jpg new file mode 100644 index 0000000000000000000000000000000000000000..6fff6151134082a6c575aa728c1ff9dee6d2c2e9 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/2023032401632.jpg differ diff --git a/zh-cn/application-dev/ui/figures/2023032405917.jpg b/zh-cn/application-dev/ui/figures/2023032405917.jpg new file mode 100644 index 0000000000000000000000000000000000000000..aafc6a07236e00055dcd7eb7e1264c930c28ecff Binary files /dev/null and b/zh-cn/application-dev/ui/figures/2023032405917.jpg differ diff --git a/zh-cn/application-dev/ui/figures/2023032411518.jpg b/zh-cn/application-dev/ui/figures/2023032411518.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f9dba940013d9662c93ea5b1174aab8c49d590b6 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/2023032411518.jpg differ diff --git a/zh-cn/application-dev/ui/figures/2023032422159.jpg b/zh-cn/application-dev/ui/figures/2023032422159.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f9fb080dee7e023179932a79b1d5421f0d91824e Binary files /dev/null and b/zh-cn/application-dev/ui/figures/2023032422159.jpg differ diff --git a/zh-cn/application-dev/ui/figures/GIF.gif b/zh-cn/application-dev/ui/figures/GIF.gif new file mode 100644 index 0000000000000000000000000000000000000000..d350b220ebc2646c5aafdc845cce92ba1142853b Binary files /dev/null and b/zh-cn/application-dev/ui/figures/GIF.gif differ diff --git a/zh-cn/application-dev/ui/figures/alignment-relative-anchor-horizontal.png b/zh-cn/application-dev/ui/figures/alignment-relative-anchor-horizontal.png new file mode 100644 index 0000000000000000000000000000000000000000..8e5b4a9d14c2fc9ad97f8c068587761db693fecc Binary files /dev/null and b/zh-cn/application-dev/ui/figures/alignment-relative-anchor-horizontal.png differ diff --git a/zh-cn/application-dev/ui/figures/alignment-relative-anchor-vertical.png b/zh-cn/application-dev/ui/figures/alignment-relative-anchor-vertical.png new file mode 100644 index 0000000000000000000000000000000000000000..cc03160dda45d12be4cd52593390ab0905d552df Binary files /dev/null and b/zh-cn/application-dev/ui/figures/alignment-relative-anchor-vertical.png differ diff --git a/zh-cn/application-dev/ui/figures/alignself.png b/zh-cn/application-dev/ui/figures/alignself.png deleted file mode 100644 index 6ab6ba66e53bf7dc3edd72d44727fe40c7ff0fb9..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/alignself.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/arkui-arkts-framework.png b/zh-cn/application-dev/ui/figures/arkui-arkts-framework.png new file mode 100644 index 0000000000000000000000000000000000000000..f687e6060ed772638c29637dd23dc808d0e3ce61 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/arkui-arkts-framework.png differ diff --git a/zh-cn/application-dev/ui/figures/arkui-framework.png b/zh-cn/application-dev/ui/figures/arkui-framework.png new file mode 100644 index 0000000000000000000000000000000000000000..8dd724a13408cf0f2f8086f961c8a900cf4a23df Binary files /dev/null and b/zh-cn/application-dev/ui/figures/arkui-framework.png differ diff --git a/zh-cn/application-dev/ui/figures/arrangement-child-elements-column.png b/zh-cn/application-dev/ui/figures/arrangement-child-elements-column.png new file mode 100644 index 0000000000000000000000000000000000000000..049559f1910fd074ceba79d17c50aea1b71d7916 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/arrangement-child-elements-column.png differ diff --git a/zh-cn/application-dev/ui/figures/arrangement-child-elements-row.png b/zh-cn/application-dev/ui/figures/arrangement-child-elements-row.png new file mode 100644 index 0000000000000000000000000000000000000000..d9c027339002e35b3a880fd45fc8e6cf5ea9a3aa Binary files /dev/null and b/zh-cn/application-dev/ui/figures/arrangement-child-elements-row.png differ diff --git a/zh-cn/application-dev/ui/figures/arrangement-direction-column-sample.png b/zh-cn/application-dev/ui/figures/arrangement-direction-column-sample.png new file mode 100644 index 0000000000000000000000000000000000000000..88ed20fb601f1106e5015d94edd2ea8a9aa01826 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/arrangement-direction-column-sample.png differ diff --git a/zh-cn/application-dev/ui/figures/arrangement-direction-column.png b/zh-cn/application-dev/ui/figures/arrangement-direction-column.png new file mode 100644 index 0000000000000000000000000000000000000000..2d0d772e2f36c4e822d56565bfbbfa7e840b042b Binary files /dev/null and b/zh-cn/application-dev/ui/figures/arrangement-direction-column.png differ diff --git a/zh-cn/application-dev/ui/figures/arrangement-direction-row.png b/zh-cn/application-dev/ui/figures/arrangement-direction-row.png new file mode 100644 index 0000000000000000000000000000000000000000..d2cd9037542c7700c127a8a4f4631e1e51a080a2 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/arrangement-direction-row.png differ diff --git a/zh-cn/application-dev/ui/figures/autoPlay.gif b/zh-cn/application-dev/ui/figures/autoPlay.gif new file mode 100644 index 0000000000000000000000000000000000000000..bc75b78ba2bd3bf34f76a351779af874598c33d3 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/autoPlay.gif differ diff --git a/zh-cn/application-dev/ui/figures/columnGap.png b/zh-cn/application-dev/ui/figures/columnGap.png deleted file mode 100644 index 1b7017a280158e88baabca3dfd1e77c6068c4655..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/columnGap.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/columnTemplate.png b/zh-cn/application-dev/ui/figures/columnTemplate.png deleted file mode 100644 index 730abeccaffa22f88e916fb199cbc1e44a982789..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/columnTemplate.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/columnalign.png b/zh-cn/application-dev/ui/figures/columnalign.png deleted file mode 100644 index a73a28a23c3719aee5379e0c8b3f9cc3627ca3e2..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/columnalign.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/columnjustify.png b/zh-cn/application-dev/ui/figures/columnjustify.png deleted file mode 100644 index 34e68343a8b621f4a0567ea9424169f6a7e5ef1b..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/columnjustify.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/columnspace.png b/zh-cn/application-dev/ui/figures/columnspace.png deleted file mode 100644 index 6af047e34c3e1e2ecd8d3d1d99af17ca01c5b58b..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/columnspace.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/common-page-structure.png b/zh-cn/application-dev/ui/figures/common-page-structure.png new file mode 100644 index 0000000000000000000000000000000000000000..789ff18aa63910adf675b09786cf3909195f04d7 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/common-page-structure.png differ diff --git a/zh-cn/application-dev/ui/figures/controll.gif b/zh-cn/application-dev/ui/figures/controll.gif new file mode 100644 index 0000000000000000000000000000000000000000..583ea20ede42d5201c523d5b0f3dba2af879de85 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/controll.gif differ diff --git a/zh-cn/application-dev/ui/figures/create.png b/zh-cn/application-dev/ui/figures/create.png new file mode 100644 index 0000000000000000000000000000000000000000..25aee7530420ef2a5463e92fd79891472e6829af Binary files /dev/null and b/zh-cn/application-dev/ui/figures/create.png differ diff --git a/zh-cn/application-dev/ui/figures/custom-navigation-bar.png b/zh-cn/application-dev/ui/figures/custom-navigation-bar.png new file mode 100644 index 0000000000000000000000000000000000000000..67a15c0d9b94b1b3e5824a71738113504817bcb1 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/custom-navigation-bar.png differ diff --git a/zh-cn/application-dev/ui/figures/direction.png b/zh-cn/application-dev/ui/figures/direction.png deleted file mode 100644 index 702c9b07fa00b8685415bb83879ead774001ee56..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/direction.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/drawimage.PNG b/zh-cn/application-dev/ui/figures/drawimage.PNG new file mode 100644 index 0000000000000000000000000000000000000000..f5061126ce9c48cea3cffcef05ecf5ea994735bd Binary files /dev/null and b/zh-cn/application-dev/ui/figures/drawimage.PNG differ diff --git a/zh-cn/application-dev/ui/figures/drawing-feature.png b/zh-cn/application-dev/ui/figures/drawing-feature.png deleted file mode 100644 index c1468667bdf74b80629c1eaa32cbef935ea5048c..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/drawing-feature.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/drawing-feature1.png b/zh-cn/application-dev/ui/figures/drawing-feature1.png deleted file mode 100644 index 6b3ca4fa90e25b5906bdadcdcbf134bd00b7b34b..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/drawing-feature1.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/drawing-feature2.png b/zh-cn/application-dev/ui/figures/drawing-feature2.png deleted file mode 100644 index 42fc7cdf9436680a30413c5bb07e02fd3230ec0c..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/drawing-feature2.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/drawing-feature3.png b/zh-cn/application-dev/ui/figures/drawing-feature3.png deleted file mode 100644 index c090ff948d7333f3dea17dd7ec54488638788c0c..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/drawing-feature3.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/drawing-feature4.png b/zh-cn/application-dev/ui/figures/drawing-feature4.png deleted file mode 100644 index bcfee4728b4d5fc9bfc57e6bb743e708ad0b2379..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/drawing-feature4.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/drawing-feature5.png b/zh-cn/application-dev/ui/figures/drawing-feature5.png deleted file mode 100644 index e70c63ed2f601cf4cd30f319dc6ebd74f216c909..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/drawing-feature5.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/drawing-feature6.png b/zh-cn/application-dev/ui/figures/drawing-feature6.png deleted file mode 100644 index 772bd122cd1ecb252625f59af5ea3e5ff61689fc..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/drawing-feature6.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/drawing-feature7.png b/zh-cn/application-dev/ui/figures/drawing-feature7.png deleted file mode 100644 index c77366f46008f173bc117f95bed6bc7827af11cd..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/drawing-feature7.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/drawing-feature8.png b/zh-cn/application-dev/ui/figures/drawing-feature8.png deleted file mode 100644 index 17cdf2ba3b6e3eeabbe93ed3115c34801634ba8e..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/drawing-feature8.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/exclusive.gif b/zh-cn/application-dev/ui/figures/exclusive.gif new file mode 100644 index 0000000000000000000000000000000000000000..2899db3f8340a309d8542af9d067e1a8cc5c4df7 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/exclusive.gif differ diff --git a/zh-cn/application-dev/ui/figures/flex-layout-direction.png b/zh-cn/application-dev/ui/figures/flex-layout-direction.png new file mode 100644 index 0000000000000000000000000000000000000000..c1ccffc523c28e9886213f8a63adf0a454e73ac1 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/flex-layout-direction.png differ diff --git a/zh-cn/application-dev/ui/figures/flex-layout.png b/zh-cn/application-dev/ui/figures/flex-layout.png new file mode 100644 index 0000000000000000000000000000000000000000..e38b472351f36d22098c20c473d4ff9702689792 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/flex-layout.png differ diff --git a/zh-cn/application-dev/ui/figures/flex-spindle-alignment.png b/zh-cn/application-dev/ui/figures/flex-spindle-alignment.png new file mode 100644 index 0000000000000000000000000000000000000000..160cde8b8a463a3f320764030371baebefbae872 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/flex-spindle-alignment.png differ diff --git a/zh-cn/application-dev/ui/figures/flex.png b/zh-cn/application-dev/ui/figures/flex.png deleted file mode 100644 index 848ceef3873ed6f83466d9ab42f6aa68cb341fe9..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/flex.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/flexbasis.png b/zh-cn/application-dev/ui/figures/flexbasis.png deleted file mode 100644 index df26a3272410052e3df94b2c4207015d5d23b613..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/flexbasis.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/forEachTransition2.gif b/zh-cn/application-dev/ui/figures/forEachTransition2.gif new file mode 100644 index 0000000000000000000000000000000000000000..c4c467902536f0daca7a43aadcc96b685267a2b8 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/forEachTransition2.gif differ diff --git a/zh-cn/application-dev/ui/figures/free1.jpg b/zh-cn/application-dev/ui/figures/free1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..04588b20c976426ea54add478198ae42935830a0 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/free1.jpg differ diff --git a/zh-cn/application-dev/ui/figures/free3.jpg b/zh-cn/application-dev/ui/figures/free3.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f4cdd38b6e3ddf67c49af564075b61ce88c8f3dd Binary files /dev/null and b/zh-cn/application-dev/ui/figures/free3.jpg differ diff --git a/zh-cn/application-dev/ui/figures/gridExp1.png b/zh-cn/application-dev/ui/figures/gridExp1.png deleted file mode 100644 index 6767d92cee335418b9c82aa842359dfce1d887c9..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/gridExp1.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/gridExp2.png b/zh-cn/application-dev/ui/figures/gridExp2.png deleted file mode 100644 index c484c27c079f3490b32d7e6c2c8e3f0b84a0151a..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/gridExp2.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/griditem.png b/zh-cn/application-dev/ui/figures/griditem.png deleted file mode 100644 index 9560e2291add8a9117be6a5ccb90033b960190d5..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/griditem.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/gridlayout.png b/zh-cn/application-dev/ui/figures/gridlayout.png deleted file mode 100644 index cc0db8ce530d60191adf8ffaefdbf11b97305067..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/gridlayout.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/horizontal-arrangement-child-column.png b/zh-cn/application-dev/ui/figures/horizontal-arrangement-child-column.png new file mode 100644 index 0000000000000000000000000000000000000000..2cc5e50cb9bc992ef155af9d8a8456cc1193b6d8 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/horizontal-arrangement-child-column.png differ diff --git a/zh-cn/application-dev/ui/figures/horizontal-arrangement-child-row.png b/zh-cn/application-dev/ui/figures/horizontal-arrangement-child-row.png new file mode 100644 index 0000000000000000000000000000000000000000..b2c1d11e2694a576e4a1cfb19919cb49aafa63c4 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/horizontal-arrangement-child-row.png differ diff --git a/zh-cn/application-dev/ui/figures/hoverEffect.gif b/zh-cn/application-dev/ui/figures/hoverEffect.gif new file mode 100644 index 0000000000000000000000000000000000000000..5b8d3816fd803a3a7ba65e8e0f65c9f546ad1657 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/hoverEffect.gif differ diff --git a/zh-cn/application-dev/ui/figures/ifElseTransition.gif b/zh-cn/application-dev/ui/figures/ifElseTransition.gif new file mode 100644 index 0000000000000000000000000000000000000000..516475ccf8f95815b1f92de9fb9c1355564cdce9 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/ifElseTransition.gif differ diff --git a/zh-cn/application-dev/ui/figures/image-rawfile.jpg b/zh-cn/application-dev/ui/figures/image-rawfile.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1629225e1db6c261156615de42a3ea00d2537f32 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/image-rawfile.jpg differ diff --git a/zh-cn/application-dev/ui/figures/image-resource.jpg b/zh-cn/application-dev/ui/figures/image-resource.jpg new file mode 100644 index 0000000000000000000000000000000000000000..3256f3792813e1c34f978f290630cca92485d5d8 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/image-resource.jpg differ diff --git a/zh-cn/application-dev/ui/figures/ind.PNG b/zh-cn/application-dev/ui/figures/ind.PNG new file mode 100644 index 0000000000000000000000000000000000000000..4bc8211932e96bf6dd1c806cbd7a4b88e3414084 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/ind.PNG differ diff --git a/zh-cn/application-dev/ui/figures/indicator.PNG b/zh-cn/application-dev/ui/figures/indicator.PNG new file mode 100644 index 0000000000000000000000000000000000000000..6ff8a073e6fb1414628c75641097de248e0873f5 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/indicator.PNG differ diff --git a/zh-cn/application-dev/ui/figures/justifyContent.png b/zh-cn/application-dev/ui/figures/justifyContent.png deleted file mode 100644 index 2e997f9cba6ce5c2ad93c1f2e33728b7db17bdd3..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/justifyContent.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/landscape.jpg b/zh-cn/application-dev/ui/figures/landscape.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f82c49f882a9cc7b7f0398d9a4ccdf2fe8a3a92a Binary files /dev/null and b/zh-cn/application-dev/ui/figures/landscape.jpg differ diff --git a/zh-cn/application-dev/ui/figures/layout-element-omposition.png b/zh-cn/application-dev/ui/figures/layout-element-omposition.png new file mode 100644 index 0000000000000000000000000000000000000000..c428929b2e171504d94cf5aef99772d517e226ba Binary files /dev/null and b/zh-cn/application-dev/ui/figures/layout-element-omposition.png differ diff --git a/zh-cn/application-dev/ui/figures/layout-performace-2.gif b/zh-cn/application-dev/ui/figures/layout-performace-2.gif new file mode 100644 index 0000000000000000000000000000000000000000..59c81dd976a8a48d3b1d77c1a787a62b053c82e7 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/layout-performace-2.gif differ diff --git a/zh-cn/application-dev/ui/figures/layout-performace-3.gif b/zh-cn/application-dev/ui/figures/layout-performace-3.gif new file mode 100644 index 0000000000000000000000000000000000000000..7c0973e179375d8ada5b3a5ff5f59d356d7c0768 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/layout-performace-3.gif differ diff --git a/zh-cn/application-dev/ui/figures/layout-performace-5.gif b/zh-cn/application-dev/ui/figures/layout-performace-5.gif new file mode 100644 index 0000000000000000000000000000000000000000..0b31f4a2428146a01ab85f764dc14523136451f5 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/layout-performace-5.gif differ diff --git a/zh-cn/application-dev/ui/figures/layout-performace-6.gif b/zh-cn/application-dev/ui/figures/layout-performace-6.gif new file mode 100644 index 0000000000000000000000000000000000000000..47abbed7d245d4add5cd81a685aece4f0b96b958 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/layout-performace-6.gif differ diff --git a/zh-cn/application-dev/ui/figures/layout-performance-1.png b/zh-cn/application-dev/ui/figures/layout-performance-1.png new file mode 100644 index 0000000000000000000000000000000000000000..e364b396eecea9b0abf6b990e024d3011ca0866c Binary files /dev/null and b/zh-cn/application-dev/ui/figures/layout-performance-1.png differ diff --git a/zh-cn/application-dev/ui/figures/layout-performance-4.png b/zh-cn/application-dev/ui/figures/layout-performance-4.png new file mode 100644 index 0000000000000000000000000000000000000000..5d0361b9f86af2adac1d0bafe04a19ca5a99b4f8 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/layout-performance-4.png differ diff --git a/zh-cn/application-dev/ui/figures/layoutChange1.gif b/zh-cn/application-dev/ui/figures/layoutChange1.gif new file mode 100644 index 0000000000000000000000000000000000000000..3e03ce67601e2c8b1b4702ede58a7b95c9c65414 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/layoutChange1.gif differ diff --git a/zh-cn/application-dev/ui/figures/layoutChange2_animateTo.gif b/zh-cn/application-dev/ui/figures/layoutChange2_animateTo.gif new file mode 100644 index 0000000000000000000000000000000000000000..ad94cb26c2874bc45ca84a2aaf5d58bbcd864685 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/layoutChange2_animateTo.gif differ diff --git a/zh-cn/application-dev/ui/figures/layoutChange2_animateTo_change.gif b/zh-cn/application-dev/ui/figures/layoutChange2_animateTo_change.gif new file mode 100644 index 0000000000000000000000000000000000000000..14d804c7a0f1e843f218b2551af6f8b51dc421bb Binary files /dev/null and b/zh-cn/application-dev/ui/figures/layoutChange2_animateTo_change.gif differ diff --git a/zh-cn/application-dev/ui/figures/longPress.gif b/zh-cn/application-dev/ui/figures/longPress.gif new file mode 100644 index 0000000000000000000000000000000000000000..5e5ba5d0083a1ec7599927efa0ff2005c8eef6fb Binary files /dev/null and b/zh-cn/application-dev/ui/figures/longPress.gif differ diff --git a/zh-cn/application-dev/ui/figures/loop_false.gif b/zh-cn/application-dev/ui/figures/loop_false.gif new file mode 100644 index 0000000000000000000000000000000000000000..29da104b99cad5fedbe41ea99593741497596b90 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/loop_false.gif differ diff --git a/zh-cn/application-dev/ui/figures/loop_true.gif b/zh-cn/application-dev/ui/figures/loop_true.gif new file mode 100644 index 0000000000000000000000000000000000000000..1c999814a654ef2a1fc55c096c616350abe058ee Binary files /dev/null and b/zh-cn/application-dev/ui/figures/loop_true.gif differ diff --git a/zh-cn/application-dev/ui/figures/mini.jpg b/zh-cn/application-dev/ui/figures/mini.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a409cb45f780202d179afd726b28487be1a2ce70 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/mini.jpg differ diff --git a/zh-cn/application-dev/ui/figures/onHover.gif b/zh-cn/application-dev/ui/figures/onHover.gif new file mode 100644 index 0000000000000000000000000000000000000000..beb62cb06bfe22b071ff02760fddeb99df7d43ce Binary files /dev/null and b/zh-cn/application-dev/ui/figures/onHover.gif differ diff --git a/zh-cn/application-dev/ui/figures/onMouse1.gif b/zh-cn/application-dev/ui/figures/onMouse1.gif new file mode 100644 index 0000000000000000000000000000000000000000..b92b55b094f1daf97cfd92d0192d24977e28d410 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/onMouse1.gif differ diff --git a/zh-cn/application-dev/ui/figures/pageTransition_None.gif b/zh-cn/application-dev/ui/figures/pageTransition_None.gif new file mode 100644 index 0000000000000000000000000000000000000000..7f5fb82f2c6c54151218faa7f843c466a3c6ddd5 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/pageTransition_None.gif differ diff --git a/zh-cn/application-dev/ui/figures/pageTransition_PushPop.gif b/zh-cn/application-dev/ui/figures/pageTransition_PushPop.gif new file mode 100644 index 0000000000000000000000000000000000000000..3b446b948717f1eeb543bd4352664353a1560b16 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/pageTransition_PushPop.gif differ diff --git a/zh-cn/application-dev/ui/figures/pan.gif b/zh-cn/application-dev/ui/figures/pan.gif new file mode 100644 index 0000000000000000000000000000000000000000..2e0c4212e1d3bab9e63f517061c4e25ca2c1ce2d Binary files /dev/null and b/zh-cn/application-dev/ui/figures/pan.gif differ diff --git a/zh-cn/application-dev/ui/figures/parallel.gif b/zh-cn/application-dev/ui/figures/parallel.gif new file mode 100644 index 0000000000000000000000000000000000000000..d56438e38f732801e8502c16354552085b525f36 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/parallel.gif differ diff --git a/zh-cn/application-dev/ui/figures/pinch.png b/zh-cn/application-dev/ui/figures/pinch.png new file mode 100644 index 0000000000000000000000000000000000000000..d2978b1a8c243e8de2942f2c290c3888c908051a Binary files /dev/null and b/zh-cn/application-dev/ui/figures/pinch.png differ diff --git a/zh-cn/application-dev/ui/figures/portralit.jpg b/zh-cn/application-dev/ui/figures/portralit.jpg new file mode 100644 index 0000000000000000000000000000000000000000..f656f49433be7787f9d0fbd9106cf6c9d366f25c Binary files /dev/null and b/zh-cn/application-dev/ui/figures/portralit.jpg differ diff --git a/zh-cn/application-dev/ui/figures/progress.gif b/zh-cn/application-dev/ui/figures/progress.gif new file mode 100644 index 0000000000000000000000000000000000000000..a89a731a3413fa7af964b372682120e84b7e5cab Binary files /dev/null and b/zh-cn/application-dev/ui/figures/progress.gif differ diff --git a/zh-cn/application-dev/ui/figures/progress_captule.png b/zh-cn/application-dev/ui/figures/progress_captule.png new file mode 100644 index 0000000000000000000000000000000000000000..83362165297f7ddc073d4eb63a7ad643614a8bab Binary files /dev/null and b/zh-cn/application-dev/ui/figures/progress_captule.png differ diff --git a/zh-cn/application-dev/ui/figures/progress_circle.png b/zh-cn/application-dev/ui/figures/progress_circle.png new file mode 100644 index 0000000000000000000000000000000000000000..727793807b679b1668d39a95adbe530fefa32aa7 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/progress_circle.png differ diff --git a/zh-cn/application-dev/ui/figures/progress_ring.png b/zh-cn/application-dev/ui/figures/progress_ring.png new file mode 100644 index 0000000000000000000000000000000000000000..4d9555c12ae981f36d118ac93452aaccaf9edf65 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/progress_ring.png differ diff --git a/zh-cn/application-dev/ui/figures/progress_scalering.png b/zh-cn/application-dev/ui/figures/progress_scalering.png new file mode 100644 index 0000000000000000000000000000000000000000..3f38cd740d4400ce423ea01f13dc0a5871270339 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/progress_scalering.png differ diff --git a/zh-cn/application-dev/ui/figures/relative-layout.png b/zh-cn/application-dev/ui/figures/relative-layout.png new file mode 100644 index 0000000000000000000000000000000000000000..a790ca8d5e78d1f659b61175a4e2d424522dec51 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/relative-layout.png differ diff --git a/zh-cn/application-dev/ui/figures/rotation.png b/zh-cn/application-dev/ui/figures/rotation.png new file mode 100644 index 0000000000000000000000000000000000000000..8ea5e0fba794e6d1b5e77f58bd8b0b91599b53cd Binary files /dev/null and b/zh-cn/application-dev/ui/figures/rotation.png differ diff --git a/zh-cn/application-dev/ui/figures/router-add-query-box-before-back.gif b/zh-cn/application-dev/ui/figures/router-add-query-box-before-back.gif new file mode 100644 index 0000000000000000000000000000000000000000..3e24d2d902e480f994f14b603cb41a602ce08426 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/router-add-query-box-before-back.gif differ diff --git a/zh-cn/application-dev/ui/figures/router-back-to-home.gif b/zh-cn/application-dev/ui/figures/router-back-to-home.gif new file mode 100644 index 0000000000000000000000000000000000000000..8cf1e3ec5d3686045a00a618db95f5b0a61d28e5 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/router-back-to-home.gif differ diff --git a/zh-cn/application-dev/ui/figures/router-jump-to-detail.gif b/zh-cn/application-dev/ui/figures/router-jump-to-detail.gif new file mode 100644 index 0000000000000000000000000000000000000000..51b251d485d1fc02cce5dbdab46a8bde02ef149e Binary files /dev/null and b/zh-cn/application-dev/ui/figures/router-jump-to-detail.gif differ diff --git a/zh-cn/application-dev/ui/figures/rowalign.png b/zh-cn/application-dev/ui/figures/rowalign.png deleted file mode 100644 index 1f87579bb75ea031951dc073f0cd0a3a65698ee6..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/rowalign.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/rowjustify.png b/zh-cn/application-dev/ui/figures/rowjustify.png deleted file mode 100644 index 7ed6dfc34d5c3dee1202925b373d5c7b7928c248..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/rowjustify.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/rowspace.png b/zh-cn/application-dev/ui/figures/rowspace.png deleted file mode 100644 index 9bf2d2da0b1634d8051214908b83bc5e41f1702d..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/rowspace.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/sequence.gif b/zh-cn/application-dev/ui/figures/sequence.gif new file mode 100644 index 0000000000000000000000000000000000000000..7e1982fa74f7f477ae5fcf92230e70b46baa0928 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/sequence.gif differ diff --git a/zh-cn/application-dev/ui/figures/sharedTransition.gif b/zh-cn/application-dev/ui/figures/sharedTransition.gif new file mode 100644 index 0000000000000000000000000000000000000000..34a47f871af170c17700052e24dd2e9c55b4215d Binary files /dev/null and b/zh-cn/application-dev/ui/figures/sharedTransition.gif differ diff --git a/zh-cn/application-dev/ui/figures/size-change-animation.gif b/zh-cn/application-dev/ui/figures/size-change-animation.gif new file mode 100644 index 0000000000000000000000000000000000000000..fe95f4162af64d2f5cbf4c71645a0317a8fff019 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/size-change-animation.gif differ diff --git a/zh-cn/application-dev/ui/figures/springCurve.gif b/zh-cn/application-dev/ui/figures/springCurve.gif new file mode 100644 index 0000000000000000000000000000000000000000..9d4ba21e93b3b7138ec4484fbedc8c3d663384b6 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/springCurve.gif differ diff --git a/zh-cn/application-dev/ui/figures/springMotion.gif b/zh-cn/application-dev/ui/figures/springMotion.gif new file mode 100644 index 0000000000000000000000000000000000000000..906d982c4932f0d3d84601de4dce86d97f4d8478 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/springMotion.gif differ diff --git a/zh-cn/application-dev/ui/figures/stack-layout-sample.png b/zh-cn/application-dev/ui/figures/stack-layout-sample.png new file mode 100644 index 0000000000000000000000000000000000000000..d6b9af36a604d05e79e77bef184dfea42341d261 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/stack-layout-sample.png differ diff --git a/zh-cn/application-dev/ui/figures/stack-layout.png b/zh-cn/application-dev/ui/figures/stack-layout.png new file mode 100644 index 0000000000000000000000000000000000000000..2e01796a7e972c0b0279ad239768a15632df8b1e Binary files /dev/null and b/zh-cn/application-dev/ui/figures/stack-layout.png differ diff --git a/zh-cn/application-dev/ui/figures/stackbottom.png b/zh-cn/application-dev/ui/figures/stackbottom.png deleted file mode 100644 index d4a1d76611bb608becded581f24b69b48185d96d..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/stackbottom.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/stackbottomend.png b/zh-cn/application-dev/ui/figures/stackbottomend.png deleted file mode 100644 index 6f34877f2ed88390eca31bab2370c187d012fd73..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/stackbottomend.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/stackbottomstart.png b/zh-cn/application-dev/ui/figures/stackbottomstart.png deleted file mode 100644 index d6539785544de70d20ce382465974cfb24d955c7..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/stackbottomstart.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/stackcenter.png b/zh-cn/application-dev/ui/figures/stackcenter.png deleted file mode 100644 index 0ba76abeba693ae3d1654b6b3fbde91661669237..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/stackcenter.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/stackend.png b/zh-cn/application-dev/ui/figures/stackend.png deleted file mode 100644 index 2bf91c717a94ce47a2f3c9ca766eb89fae513a71..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/stackend.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/stackstart.png b/zh-cn/application-dev/ui/figures/stackstart.png deleted file mode 100644 index 3936627a8d4134acd3e02833cb2c3c593f52c66e..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/stackstart.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/stacktop.png b/zh-cn/application-dev/ui/figures/stacktop.png deleted file mode 100644 index 01a649049c24df96510727918689455ad9898559..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/stacktop.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/stacktopend.png b/zh-cn/application-dev/ui/figures/stacktopend.png deleted file mode 100644 index 95e8fef4f2c2a6905ed0efc00e9cacd14852c5de..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/stacktopend.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/stacktopstart.png b/zh-cn/application-dev/ui/figures/stacktopstart.png deleted file mode 100644 index 7b742984076e7066cca56a5647bfa3c096b317f2..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/stacktopstart.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/stroke.jpg b/zh-cn/application-dev/ui/figures/stroke.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ac49df0c160480cc83360cba49a1e02ced97c687 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/stroke.jpg differ diff --git a/zh-cn/application-dev/ui/figures/strokeLineJoin.jpg b/zh-cn/application-dev/ui/figures/strokeLineJoin.jpg new file mode 100644 index 0000000000000000000000000000000000000000..6611794bd75d7037a4e01f1c9caea96d6c1f8d0d Binary files /dev/null and b/zh-cn/application-dev/ui/figures/strokeLineJoin.jpg differ diff --git a/zh-cn/application-dev/ui/figures/strokeopacity.jpg b/zh-cn/application-dev/ui/figures/strokeopacity.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7c131ebabbd41fcd331d903da9d0aaf2ccbacfb7 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/strokeopacity.jpg differ diff --git a/zh-cn/application-dev/ui/figures/swipe.gif b/zh-cn/application-dev/ui/figures/swipe.gif new file mode 100644 index 0000000000000000000000000000000000000000..d368f149d8a61a94ef29a4bf5c60da5ab2a17d28 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/swipe.gif differ diff --git a/zh-cn/application-dev/ui/figures/tabs-layout.png b/zh-cn/application-dev/ui/figures/tabs-layout.png new file mode 100644 index 0000000000000000000000000000000000000000..48bc04e38fcd0a09b2956420c3a3b795c9a2c7bc Binary files /dev/null and b/zh-cn/application-dev/ui/figures/tabs-layout.png differ diff --git a/zh-cn/application-dev/ui/figures/tabs-tabscontent.png b/zh-cn/application-dev/ui/figures/tabs-tabscontent.png new file mode 100644 index 0000000000000000000000000000000000000000..58abb27682abd5aaa93827efb5d23b873873daa8 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/tabs-tabscontent.png differ diff --git a/zh-cn/application-dev/ui/figures/tap.gif b/zh-cn/application-dev/ui/figures/tap.gif new file mode 100644 index 0000000000000000000000000000000000000000..bee782263d059fe48a71766b0f607f2ad581209d Binary files /dev/null and b/zh-cn/application-dev/ui/figures/tap.gif differ diff --git a/zh-cn/application-dev/ui/figures/two.PNG b/zh-cn/application-dev/ui/figures/two.PNG new file mode 100644 index 0000000000000000000000000000000000000000..c692643e6b500ec305d9cab801a40f5dbc2fcbca Binary files /dev/null and b/zh-cn/application-dev/ui/figures/two.PNG differ diff --git a/zh-cn/application-dev/ui/figures/vertial-arrangement-child-column.png b/zh-cn/application-dev/ui/figures/vertial-arrangement-child-column.png new file mode 100644 index 0000000000000000000000000000000000000000..dd4e9106e882055dc637bb110508a66b783f7c9d Binary files /dev/null and b/zh-cn/application-dev/ui/figures/vertial-arrangement-child-column.png differ diff --git a/zh-cn/application-dev/ui/figures/vertial-arrangement-child-row.png b/zh-cn/application-dev/ui/figures/vertial-arrangement-child-row.png new file mode 100644 index 0000000000000000000000000000000000000000..160cde8b8a463a3f320764030371baebefbae872 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/vertial-arrangement-child-row.png differ diff --git "a/zh-cn/application-dev/ui/figures/viewport\357\274\2102\357\274\211.jpg" "b/zh-cn/application-dev/ui/figures/viewport\357\274\2102\357\274\211.jpg" new file mode 100644 index 0000000000000000000000000000000000000000..eeca7909de92b85a73e5552567c9ae485ff2f47a Binary files /dev/null and "b/zh-cn/application-dev/ui/figures/viewport\357\274\2102\357\274\211.jpg" differ diff --git "a/zh-cn/application-dev/ui/figures/viewport\357\274\2103\357\274\211.jpg" "b/zh-cn/application-dev/ui/figures/viewport\357\274\2103\357\274\211.jpg" new file mode 100644 index 0000000000000000000000000000000000000000..a5ec30f22410b7e7d9b467738e7fdd0cd9cace49 Binary files /dev/null and "b/zh-cn/application-dev/ui/figures/viewport\357\274\2103\357\274\211.jpg" differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image1_0000001204776353.png b/zh-cn/application-dev/ui/figures/zh-cn_image1_0000001204776353.png deleted file mode 100644 index 25330d63162d9999d2c57d3c33bcc20731df7851..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image1_0000001204776353.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001163531210.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001163531210.gif index 47730f745cfd341cd6f11c9a3d4ce71d4b2795fb..a645566ffd6152e073bda387a61468d05d0a93da 100644 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001163531210.gif and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001163531210.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001168410342.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001168410342.png deleted file mode 100644 index 67b8d1571853fe13079a13ed32aff66bc2fc4452..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001168410342.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001168728872.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001168728872.png deleted file mode 100644 index ddf24cd804055371cbd8a753089263f6bcc32b79..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001168728872.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001168888224.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001168888224.png deleted file mode 100644 index 81f79df7d05de05704fdbe9565d4078e026efd60..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001168888224.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001169532276.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001169532276.png deleted file mode 100644 index eca2b53342a2bf63d089c835bfdae16b2608e70f..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001169532276.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001169599582.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001169599582.png deleted file mode 100644 index a4eb400dcd217074d6e76902723e9fffd34fd4bd..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001169599582.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001169678922.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001169678922.png deleted file mode 100644 index 9c89860f26331dc11cf8104711be1ad3be918111..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001169678922.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001169759552.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001169759552.png deleted file mode 100644 index f910230ebfab9c5315eb1c2bc99f0ca35b3cbe23..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001169759552.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001169918548.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001169918548.gif deleted file mode 100644 index b59ae3d79b2bc926634a50c1f3f6aecce247763c..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001169918548.gif and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001170008198.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001170008198.gif deleted file mode 100644 index c88150c77afccf736d42fe7253df27f2b1d27cd5..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001170008198.gif and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001170167520.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001170167520.gif deleted file mode 100644 index fb5399a47b281cb586dbc4460fc0db6381d1e4ab..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001170167520.gif and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001170167520.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001170167520.png deleted file mode 100644 index 2441a46f00b3083dfaa8ec2dcdb1760aa7e2aeb7..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001170167520.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001170411978.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001170411978.gif deleted file mode 100644 index a7d9b572abb833cc7cd52e63d25c4c261a10af65..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001170411978.gif and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001174756580.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001174756580.gif index 5a297661641d1714ebc95116592a97a693293e0a..d3ad5d5ccc9d68f3f822a20b7fde31b05d4b2892 100644 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001174756580.gif and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001174756580.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001175075286.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001175075286.gif deleted file mode 100644 index 90898288928277467db40c5eb11b4ff7ae082e6e..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001175075286.gif and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001178685854.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001178685854.gif index abec4486ad5f444b32aa20b88a3a6d1975254cd0..7f8c79eb23a72da310d2769746d0a8bde4519bcd 100644 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001178685854.gif and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001178685854.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001181655292.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001181655292.gif index 5813dfac315791a87d9bd9c70a9587e6b779614c..24dba7afc4830bb8da86f31fe7a2d25092bc4987 100644 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001181655292.gif and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001181655292.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001181823160.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001181823160.gif index 5d4ed8967a4f4d4d163c560536ee537feddef49a..cf8a2ba1b016283dc59117bc853d1348b5016bbe 100644 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001181823160.gif and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001181823160.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001183709904.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001183709904.png deleted file mode 100644 index fb34869ae9a78d655a30e62e1936840d0aa6bb4d..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001183709904.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001189089950.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001189089950.gif index 903db10d6d7916f42ae2100403e02da2b2cf0fa2..c91f56f31a49756556d6ff61cccda166b33c6371 100644 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001189089950.gif and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001189089950.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001189249862.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001189249862.gif index a1839308d0fdde50aefd4c818d30ea82c49b6ca6..f541dcffbfdc3712ccb6aaddaa5ab0b5a904f6d9 100644 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001189249862.gif and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001189249862.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001195119619.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001195119619.png deleted file mode 100644 index d5bed5e4ae3a322db0e4f05482913fdbd828cbed..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001195119619.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001204538065.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001204538065.png deleted file mode 100644 index b775a2bf408dd710861afa0dfa9f756d5181e811..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001204538065.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001204776353.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001204776353.png deleted file mode 100644 index b27a7f5358c954fe7e1bd912358d29d456870c2a..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001204776353.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001213968747.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001213968747.png deleted file mode 100644 index b60416b59cb77e096d615ba1b25d2b14056abe00..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001213968747.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001214128687.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001214128687.png deleted file mode 100644 index 3f2f15792563ec89015abce1fcf30248b3c0288e..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001214128687.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001214210217.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001214210217.png deleted file mode 100644 index 18abb7b725fcf0172f189c0f1cf70e9c5ae31642..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001214210217.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001214998349.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001214998349.png deleted file mode 100644 index 6a845d64a542809c05f008eef5d1e1ed9d1c22a5..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001214998349.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001215079443.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001215079443.png deleted file mode 100644 index 0a53a5742ac5fda3501a93f576b945e21bd2addf..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001215079443.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001215113569.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001215113569.png deleted file mode 100644 index c7b4a7dfc70a6ee3ce7a837d1e8e91acc7d05d22..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001215113569.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001215199399.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001215199399.png deleted file mode 100644 index c508bb8764c28f228e2c0a33dd6ee97e48dfe682..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001215199399.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001215433095.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001215433095.png deleted file mode 100644 index d015869874aecf7235aa892993d3d872a4cfe9df..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001215433095.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001218279600.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001218279600.gif index b5bce1b8e09e0c47231c11250c6d676806bcd53c..af0d82673874b844d27059447b73c5eeff622156 100644 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001218279600.gif and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001218279600.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001220316305.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001220316305.gif index 365dbc42e583335f32de863120fd80ae0e7d59e5..52486eead5a5d005c46e0eb445954bb41fbc186e 100644 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001220316305.gif and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001220316305.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001220396251.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001220396251.gif index b7808565202cf12474f1282e67fde3a9c85d0e9c..e7d53872aa36d55697d3fa917ba9ab655c91984e 100644 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001220396251.gif and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001220396251.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001220554911.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001220554911.gif index 3fe0cd60d60a0c5d29c2625ebade3d8b0bd0cdf8..f6c0806abfb1bdc742b69592300bc333c590407b 100644 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001220554911.gif and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001220554911.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001220635011.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001220635011.gif deleted file mode 100644 index 0be34d5b9598c7e03132b08e030fd71d977886b5..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001220635011.gif and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001224086459.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001224086459.gif index 8158121587531a6ab754316d6379c016be803128..0257ac0a97c7bb8af3431962f41c8d0a62a5351e 100644 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001224086459.gif and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001224086459.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001226815403.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001226815403.gif index 28b2a163673a71e95a40284d2b045005594623e6..ca4ecc21fe0596f0a644dd619b2d889949d339d1 100644 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001226815403.gif and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001226815403.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001226896657.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001226896657.gif index ab6d5e3bde1e3218eaa1156137c7fd6ffc298882..5caa616a4867ff14b496363ed522739ed470f873 100644 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001226896657.gif and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001226896657.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001227135613.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001227135613.gif index f7f05ac39da2bd2f04a7257e1c36eb87ad811783..25967987fbbada2f179f029578d8f28dfc523d8a 100644 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001227135613.gif and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001227135613.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001227422709.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001227422709.gif index 260966e4fe59e4e6f80b501251f478bbb7126dce..a89f97cdb43f6527836575768e306a594a76a221 100644 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001227422709.gif and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001227422709.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001227701031.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001227701031.gif index d6a46140a41a112790210c58502fbc3df6e65f20..74e527d7842dcd825a0baf93dbe49cdcc3933a97 100644 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001227701031.gif and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001227701031.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001227701867.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001227701867.gif index 0cbcaa3ff368a2a2ad63c8729acc0f66ae874437..fac38d519b9b817e2a7dfdc7f26c46b61a7bdb3e 100644 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001227701867.gif and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001227701867.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001234011019.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001234011019.gif index ab13d6f819a666ded9ffffac99168beafacd97ae..f7defcdb55deec4749d8af503dd8314bf6b1521a 100644 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001234011019.gif and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001234011019.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001234289455.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001234289455.gif index 960772dc9536a9e103125503bbb7d4723a6f8c49..47df31181d867cc93ccbe8ee01a254f569ab50b3 100644 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001234289455.gif and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001234289455.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001262954829.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001262954829.png deleted file mode 100644 index a606cbe3c297f267e77a71816d21def7e3d51d2d..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001262954829.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001263074739.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001263074739.png deleted file mode 100644 index e2f0ff5761d3c5a19a300f7c891a717e13c2374d..0000000000000000000000000000000000000000 Binary files a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001263074739.png and /dev/null differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421208.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421208.png new file mode 100644 index 0000000000000000000000000000000000000000..681843c65ae68e47ce4a0e95bee06e01d349c512 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421208.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421216.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421216.png new file mode 100644 index 0000000000000000000000000000000000000000..9b683fdb6849cb3dc5119732a0452f7b9be7a4cb Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421216.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421228.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421228.png new file mode 100644 index 0000000000000000000000000000000000000000..c8ea36c478eb3992fb59aa5337cb283e550b3204 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421228.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421232.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421232.png new file mode 100644 index 0000000000000000000000000000000000000000..97637fd86371c50d5cbacfaa24343fb0b1d71306 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421232.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421240.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421240.png new file mode 100644 index 0000000000000000000000000000000000000000..1dcef5d17c1a081235b1ce2fb61878675a1c15ab Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421240.png differ diff --git a/zh-cn/application-dev/ui/figures/itemalignstretch.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421252.png similarity index 100% rename from zh-cn/application-dev/ui/figures/itemalignstretch.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421252.png diff --git a/zh-cn/application-dev/ui/figures/crossCenter.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421256.png similarity index 100% rename from zh-cn/application-dev/ui/figures/crossCenter.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421256.png diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421260.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421260.png new file mode 100644 index 0000000000000000000000000000000000000000..0042aa4d4875e6a688d1974e2a036c90a83d3f58 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421260.png differ diff --git a/zh-cn/application-dev/ui/figures/span1.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421264.png similarity index 100% rename from zh-cn/application-dev/ui/figures/span1.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421264.png diff --git a/zh-cn/application-dev/ui/figures/columns2.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421268.png similarity index 100% rename from zh-cn/application-dev/ui/figures/columns2.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421268.png diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421272.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421272.gif new file mode 100644 index 0000000000000000000000000000000000000000..f2e18ecafe8202705a34e6c76b4fdc59d5cca8d6 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421272.gif differ diff --git a/zh-cn/application-dev/ui/figures/mainStart.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421280.png similarity index 100% rename from zh-cn/application-dev/ui/figures/mainStart.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421280.png diff --git a/zh-cn/application-dev/ui/figures/mainSpacebetween.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421288.png similarity index 100% rename from zh-cn/application-dev/ui/figures/mainSpacebetween.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421288.png diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421292.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421292.png new file mode 100644 index 0000000000000000000000000000000000000000..76555811ed1be6b8409475b36fbafcdfaf31bb42 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421292.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421320.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421320.png new file mode 100644 index 0000000000000000000000000000000000000000..4114d18a2268916d7181f08a27966d46d642b36b Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421320.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421324.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421324.gif new file mode 100644 index 0000000000000000000000000000000000000000..7501a89d11ac180095f623426b58c3e1f9aa0657 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421324.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421328.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421328.png new file mode 100644 index 0000000000000000000000000000000000000000..a3ca83d7cfd5e9fb14cf67e504edd75a3008864c Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421328.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421332.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421332.png new file mode 100644 index 0000000000000000000000000000000000000000..6d8fe648cee5e8677c5a58cd699a831c8d504975 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421332.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421336.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421336.png new file mode 100644 index 0000000000000000000000000000000000000000..eadeec34e24156f33ff55a84c633009ed00ab341 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421336.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421344.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421344.png new file mode 100644 index 0000000000000000000000000000000000000000..4d97b954671fce83fa8e0728a197c00b0cfb8b16 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421344.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421348.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421348.png new file mode 100644 index 0000000000000000000000000000000000000000..3dccdeed9c73a367170d4ba028adac0533329514 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421348.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421352.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421352.png new file mode 100644 index 0000000000000000000000000000000000000000..3e9c6ec747da89479ec2938e66628d515874d2b4 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421352.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421356.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421356.png new file mode 100644 index 0000000000000000000000000000000000000000..fc6d0fa33e614c536f7f46296becd248e226ed88 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421356.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421360.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421360.gif new file mode 100644 index 0000000000000000000000000000000000000000..e29eee8769672e03926070e651b7d771565f3a70 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421360.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421364.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421364.gif new file mode 100644 index 0000000000000000000000000000000000000000..1194ed8cd42f00c1eeef7062a736149eb0caae14 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421364.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421368.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421368.png new file mode 100644 index 0000000000000000000000000000000000000000..1f4fc5b9cb8e8970dddc77fa38f0e71b4f27f104 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511421368.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580828.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580828.png new file mode 100644 index 0000000000000000000000000000000000000000..96c1d74e3c387c8953602591e33c537749a3a32b Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580828.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580836.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580836.png new file mode 100644 index 0000000000000000000000000000000000000000..4ca2c4f59778b7bed8f1b6c8d9d8e8e69fadb646 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580836.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580840.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580840.png new file mode 100644 index 0000000000000000000000000000000000000000..8fcf5f4902f4e139dc99bdb8fe581da79acf2554 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580840.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580844.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580844.png new file mode 100644 index 0000000000000000000000000000000000000000..8c4263b7748f2c35765a0d0334ba5349ec5fa783 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580844.png differ diff --git a/zh-cn/application-dev/ui/figures/crossSpaceevenly.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580864.png similarity index 100% rename from zh-cn/application-dev/ui/figures/crossSpaceevenly.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580864.png diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580868.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580868.png new file mode 100644 index 0000000000000000000000000000000000000000..e13be6136ef180b21e736e73668af3637fd90a24 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580868.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580872.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580872.png new file mode 100644 index 0000000000000000000000000000000000000000..7ce85b7535836ddd5a651fa49aad94cf86718690 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580872.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001218579610.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580876.png similarity index 100% rename from zh-cn/application-dev/ui/figures/zh-cn_image_0000001218579610.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580876.png diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001263019457.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580884.png similarity index 100% rename from zh-cn/application-dev/ui/figures/zh-cn_image_0000001263019457.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580884.png diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580888.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580888.png new file mode 100644 index 0000000000000000000000000000000000000000..6496f585a1c53c9f8bf09ad9e875229333fba3d2 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580888.png differ diff --git a/zh-cn/application-dev/ui/figures/order1.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580892.png similarity index 100% rename from zh-cn/application-dev/ui/figures/order1.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580892.png diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580908.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580908.png new file mode 100644 index 0000000000000000000000000000000000000000..490ed3e8c0760fb756e9b4bad1adb54539e6d09d Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580908.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580924.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580924.png new file mode 100644 index 0000000000000000000000000000000000000000..e4e90982652f27353f43ce7e596a512d31141f6c Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580924.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580940.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580940.png new file mode 100644 index 0000000000000000000000000000000000000000..9a13e9c6cb2940aac6cddc9e7130d1af77ba0845 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580940.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580944.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580944.png new file mode 100644 index 0000000000000000000000000000000000000000..369ccf1ed914bd33b689654012d9aedbc70ef6ed Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580944.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580948.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580948.png new file mode 100644 index 0000000000000000000000000000000000000000..0dab803fce687b5a39ba9cf464bb4238974d0a28 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580948.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580952.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580952.png new file mode 100644 index 0000000000000000000000000000000000000000..e7a1c32317e56abc77b8a73f86e477c6d11be827 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580952.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580956.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580956.png new file mode 100644 index 0000000000000000000000000000000000000000..f74edf41b4a0bd995d4121af61672308ff473226 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580956.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580960.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580960.png new file mode 100644 index 0000000000000000000000000000000000000000..1bca1c658300a14fa458bd9223829a0946c31ac5 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580960.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580964.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580964.png new file mode 100644 index 0000000000000000000000000000000000000000..99b123c307de1a6eae2bdc7e8bb410c4b42bf300 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580964.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580968.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580968.png new file mode 100644 index 0000000000000000000000000000000000000000..a584b0bdff74f412dc2d219d99e9bbf5d78bf85a Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580968.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580976.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580976.gif new file mode 100644 index 0000000000000000000000000000000000000000..e1e255edeeb4ac6e8a7300275269b9c6364c3bbe Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580976.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580980.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580980.gif new file mode 100644 index 0000000000000000000000000000000000000000..c4bd0b6d77ec21b4de1e71e3c7977fb452777293 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511580980.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740428.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740428.png new file mode 100644 index 0000000000000000000000000000000000000000..e75b4784102291f479f2aa8573464d08c076d041 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740428.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740436.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740436.png new file mode 100644 index 0000000000000000000000000000000000000000..9f2a2cec4b631aa360635c995623b3dd15f65f68 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740436.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740444.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740444.png new file mode 100644 index 0000000000000000000000000000000000000000..9a5dac961e72d473881548b6d90ea5fd61cb14df Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740444.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740448.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740448.png new file mode 100644 index 0000000000000000000000000000000000000000..ce34734cc84091cc2daa1a1f82d18a8819d6f163 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740448.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740460.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740460.png new file mode 100644 index 0000000000000000000000000000000000000000..ae0a8c18848c94a7a271a0c0b9424a3fa8ffb930 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740460.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001218419614.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740468.png similarity index 100% rename from zh-cn/application-dev/ui/figures/zh-cn_image_0000001218419614.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740468.png diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740472.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740472.png new file mode 100644 index 0000000000000000000000000000000000000000..785f83000d3f4708dfdfa22a0885a55e1a5eaa8b Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740472.png differ diff --git a/zh-cn/application-dev/ui/figures/gutter1.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740476.png similarity index 100% rename from zh-cn/application-dev/ui/figures/gutter1.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740476.png diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740480.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740480.png new file mode 100644 index 0000000000000000000000000000000000000000..fde8f90b8439f9dde3ec79a69c417738588df80a Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740480.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001218259636.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740484.png similarity index 100% rename from zh-cn/application-dev/ui/figures/zh-cn_image_0000001218259636.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740484.png diff --git a/zh-cn/application-dev/ui/figures/direction1.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740488.png similarity index 100% rename from zh-cn/application-dev/ui/figures/direction1.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740488.png diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740492.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740492.gif new file mode 100644 index 0000000000000000000000000000000000000000..eba3ab4a41c44642c47f1864858094771043dcc7 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740492.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740512.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740512.gif new file mode 100644 index 0000000000000000000000000000000000000000..a2f6d3594d09441d235e7c95334fc221e6104d78 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740512.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740524.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740524.png new file mode 100644 index 0000000000000000000000000000000000000000..4d6634a697640a8c0a3d390e0e3e9e300162fff2 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740524.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740532.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740532.png new file mode 100644 index 0000000000000000000000000000000000000000..1baea34fedac1c14f5a9662a3b3e5fb9153d2bca Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740532.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740544.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740544.gif new file mode 100644 index 0000000000000000000000000000000000000000..d86e426dcffcd60213f37faf7c9209ca5a45233f Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740544.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740548.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740548.png new file mode 100644 index 0000000000000000000000000000000000000000..69a1ffe2c68de589e134b7c552a896184b4d7889 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740548.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740552.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740552.gif new file mode 100644 index 0000000000000000000000000000000000000000..f6fc004144fec36d4c94abc65ae9e553c859a135 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740552.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740556.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740556.gif new file mode 100644 index 0000000000000000000000000000000000000000..6df8e5a53ef683d8a6889b0a447497c7e87f056b Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740556.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740564.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740564.png new file mode 100644 index 0000000000000000000000000000000000000000..a08497fe9d7337e09524fd998dee304c0d4712dd Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740564.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740580.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740580.png new file mode 100644 index 0000000000000000000000000000000000000000..35008963fd6d055be6f1f1e50676fe4b7862850c Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740580.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740584.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740584.gif new file mode 100644 index 0000000000000000000000000000000000000000..56da31d78f38871ae7d752e0eeb1938699502aa2 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511740584.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900392.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900392.png new file mode 100644 index 0000000000000000000000000000000000000000..26e369d5782e67701f7fba342225dcbdf5a0dbf1 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900392.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900400.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900400.png new file mode 100644 index 0000000000000000000000000000000000000000..734be949251f4d187fc20b24496f17cbd7263a6f Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900400.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900404.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900404.png new file mode 100644 index 0000000000000000000000000000000000000000..4449c175df2c61ff6c0af6ddcf4e598cf79f3842 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900404.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900428.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900428.png new file mode 100644 index 0000000000000000000000000000000000000000..53fb84e3c75c85055eb4e7a0797dc4600f9dd304 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900428.png differ diff --git a/zh-cn/application-dev/ui/figures/mainSpacearound.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900436.png similarity index 100% rename from zh-cn/application-dev/ui/figures/mainSpacearound.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900436.png diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001263019463.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900440.png similarity index 100% rename from zh-cn/application-dev/ui/figures/zh-cn_image_0000001263019463.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900440.png diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900444.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900444.gif new file mode 100644 index 0000000000000000000000000000000000000000..315c82e417d240d0624a8206c9adf47c4c0a3ec3 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900444.gif differ diff --git a/zh-cn/application-dev/ui/figures/crossSpacebetween.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900448.png similarity index 100% rename from zh-cn/application-dev/ui/figures/crossSpacebetween.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900448.png diff --git a/zh-cn/application-dev/ui/figures/flexExample.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900452.png similarity index 100% rename from zh-cn/application-dev/ui/figures/flexExample.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900452.png diff --git a/zh-cn/application-dev/ui/figures/gutter2.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900456.png similarity index 100% rename from zh-cn/application-dev/ui/figures/gutter2.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900456.png diff --git a/zh-cn/application-dev/ui/figures/crossStart.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900460.png similarity index 100% rename from zh-cn/application-dev/ui/figures/crossStart.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900460.png diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001218739566.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900464.png similarity index 100% rename from zh-cn/application-dev/ui/figures/zh-cn_image_0000001218739566.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900464.png diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900468.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900468.gif new file mode 100644 index 0000000000000000000000000000000000000000..69f9763394cc6406b29ba8710b73c6441df29048 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900468.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900472.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900472.png new file mode 100644 index 0000000000000000000000000000000000000000..10a9d3f4a7cc753be677f7c02ca3114c893f15c3 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900472.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900480.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900480.png new file mode 100644 index 0000000000000000000000000000000000000000..5bd5e147555a2fdf7c68afe4e1ed54cd65d55d09 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900480.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900504.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900504.png new file mode 100644 index 0000000000000000000000000000000000000000..44b17e42fd2fd4808317ef56e4de54dbced91a4a Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900504.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900508.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900508.gif new file mode 100644 index 0000000000000000000000000000000000000000..60ff6784556d71eeb466fde4399746c32fbdd12b Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900508.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900516.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900516.png new file mode 100644 index 0000000000000000000000000000000000000000..136fbcbb5192d5c935f64b4723e72e909c96e4a3 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900516.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900520.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900520.gif new file mode 100644 index 0000000000000000000000000000000000000000..875d53e13f92ab953b13ae666c92170afc4fc142 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900520.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900524.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900524.gif new file mode 100644 index 0000000000000000000000000000000000000000..80ee68958c80502be31ddcecc22f198c14a4c335 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900524.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900532.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900532.png new file mode 100644 index 0000000000000000000000000000000000000000..77dcb681451df58a99e4b8572f6573e12a39d6aa Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900532.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900540.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900540.gif new file mode 100644 index 0000000000000000000000000000000000000000..d78bd919f391ed021e3d305eef05097c561598ee Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900540.gif differ diff --git a/zh-cn/application-dev/ui/figures/stack2.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900544.png similarity index 100% rename from zh-cn/application-dev/ui/figures/stack2.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001511900544.png diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700385.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700385.png new file mode 100644 index 0000000000000000000000000000000000000000..01f4454576ee74897e623ff833908644752d615c Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700385.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700393.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700393.png new file mode 100644 index 0000000000000000000000000000000000000000..3e41f2230432d26c9bf8e4cfd8bf94d724da499c Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700393.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700409.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700409.png new file mode 100644 index 0000000000000000000000000000000000000000..11fc91eef9cb70678f014fe1f7266179d24dd152 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700409.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700417.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700417.png new file mode 100644 index 0000000000000000000000000000000000000000..c89c7b8750b89903b21d57c080d4d2028ac50227 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700417.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001263139409.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700425.png similarity index 100% rename from zh-cn/application-dev/ui/figures/zh-cn_image_0000001263139409.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700425.png diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700433.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700433.gif new file mode 100644 index 0000000000000000000000000000000000000000..b517e892ed6ff4ad337e57d044aa518ff78a8792 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700433.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700437.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700437.png new file mode 100644 index 0000000000000000000000000000000000000000..6eb044c77e05e06b6a3ce3c1b987c4bb23d07906 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700437.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700441.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700441.png new file mode 100644 index 0000000000000000000000000000000000000000..358484503f09f1948815e71550295b92da37656b Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700441.png differ diff --git a/zh-cn/application-dev/ui/figures/crossSpacearound.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700445.png similarity index 100% rename from zh-cn/application-dev/ui/figures/crossSpacearound.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700445.png diff --git a/zh-cn/application-dev/ui/figures/flexgrow.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700449.png similarity index 100% rename from zh-cn/application-dev/ui/figures/flexgrow.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700449.png diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001263259401.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700453.png similarity index 100% rename from zh-cn/application-dev/ui/figures/zh-cn_image_0000001263259401.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700453.png diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700457.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700457.png new file mode 100644 index 0000000000000000000000000000000000000000..76675d3c8549a0258e3509230dea17339adb6185 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700457.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700461.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700461.png new file mode 100644 index 0000000000000000000000000000000000000000..60f5a816dffbf2c76ff208420e592d3fbe84ed44 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700461.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700469.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700469.png new file mode 100644 index 0000000000000000000000000000000000000000..afd3964aa6c5a351cb570fd2f0822df0b1e71242 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700469.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700473.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700473.png new file mode 100644 index 0000000000000000000000000000000000000000..ba85d89f29fd165f8ee0cd8ca05ec81bf7fd3e64 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700473.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700493.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700493.png new file mode 100644 index 0000000000000000000000000000000000000000..7db4a60fbc2e6ae31184a9ae40586d25f7e467f7 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700493.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700501.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700501.png new file mode 100644 index 0000000000000000000000000000000000000000..ee24968f7a63f08dba9c6eb7b71bdcfe2bf8c736 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700501.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700505.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700505.png new file mode 100644 index 0000000000000000000000000000000000000000..937a2584e24522a7c38e274cb8031cb796e08b4c Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700505.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700509.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700509.png new file mode 100644 index 0000000000000000000000000000000000000000..a23476d1a84a709d41ce9a19d17216baae2cfbf2 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700509.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700517.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700517.png new file mode 100644 index 0000000000000000000000000000000000000000..d830f303086d7ab27244f88cffa7a359ec62f92a Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700517.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700521.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700521.png new file mode 100644 index 0000000000000000000000000000000000000000..f2a737c020c5ea9c1a9bf4ac73cafe677c73917c Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700521.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700525.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700525.png new file mode 100644 index 0000000000000000000000000000000000000000..88552579e7181155498b23934ff4707317b1e84e Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700525.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700529.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700529.png new file mode 100644 index 0000000000000000000000000000000000000000..b503f477aaed9b842cd66dd82c5ad35e72ab5624 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700529.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700533.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700533.gif new file mode 100644 index 0000000000000000000000000000000000000000..fade44c6342ec3a6051877d3d0ea059781769548 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700533.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700537.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700537.png new file mode 100644 index 0000000000000000000000000000000000000000..e1b3e263c9da5e80a05d417797f7d4aed2b0ad80 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562700537.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820753.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820753.png new file mode 100644 index 0000000000000000000000000000000000000000..8fc23c8ad1a94fe0e9644e5deb0e04a54b3c10cb Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820753.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820757.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820757.png new file mode 100644 index 0000000000000000000000000000000000000000..ee7966d0a498dd541acc578ed31174fc310e75f6 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820757.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820761.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820761.png new file mode 100644 index 0000000000000000000000000000000000000000..772d4b70447cb63cdbec8dd965cc8b5ac3af9a8a Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820761.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820765.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820765.png new file mode 100644 index 0000000000000000000000000000000000000000..08bc3637c5c3429e7606aff8fbba5db49be13b98 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820765.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820789.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820789.png new file mode 100644 index 0000000000000000000000000000000000000000..2ca89265b2c00d4d502302bf3b40cd1443af8cbf Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820789.png differ diff --git a/zh-cn/application-dev/ui/figures/crossEnd.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820801.png similarity index 100% rename from zh-cn/application-dev/ui/figures/crossEnd.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820801.png diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820805.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820805.png new file mode 100644 index 0000000000000000000000000000000000000000..235d1fbbf20dc80dc72db1e867c83ebe0de796ec Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820805.png differ diff --git a/zh-cn/application-dev/ui/figures/mainEnd.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820809.png similarity index 100% rename from zh-cn/application-dev/ui/figures/mainEnd.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820809.png diff --git a/zh-cn/application-dev/ui/figures/flexshrink.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820813.png similarity index 100% rename from zh-cn/application-dev/ui/figures/flexshrink.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820813.png diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001218579606.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820817.png similarity index 100% rename from zh-cn/application-dev/ui/figures/zh-cn_image_0000001218579606.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820817.png diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820821.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820821.png new file mode 100644 index 0000000000000000000000000000000000000000..d37cbb478a454650c64e19349967d1bcc8a3355e Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820821.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820825.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820825.png new file mode 100644 index 0000000000000000000000000000000000000000..b5c1c900b3fe25b86c6c991a0b30a5cf849f4f9b Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820825.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820833.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820833.png new file mode 100644 index 0000000000000000000000000000000000000000..2ed408f55ee20c0a8b3790c72088b5a6c297933f Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820833.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820845.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820845.png new file mode 100644 index 0000000000000000000000000000000000000000..0e7e1f84a9668303f33a057f4f79de48f1c51ba3 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820845.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820877.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820877.gif new file mode 100644 index 0000000000000000000000000000000000000000..2241c494257d51062dcb4b47911430d49bbadb7b Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820877.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820881.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820881.png new file mode 100644 index 0000000000000000000000000000000000000000..592e6591f61e6e9d62023849cbcf1a651bb1691c Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820881.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820893.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820893.png new file mode 100644 index 0000000000000000000000000000000000000000..804c9f6958b6a58b2fad943bcab3149f31820fe0 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820893.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820897.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820897.png new file mode 100644 index 0000000000000000000000000000000000000000..e3b670e7d9cb1fff6d373323d4ec73740370c052 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820897.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820901.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820901.png new file mode 100644 index 0000000000000000000000000000000000000000..a7d1be0ea679f662413ff186cd9504e58b7066a5 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820901.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820905.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820905.gif new file mode 100644 index 0000000000000000000000000000000000000000..f5ce4c339333e842d46f0ea3b447ef68c8d877cd Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562820905.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940473.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940473.png new file mode 100644 index 0000000000000000000000000000000000000000..39794977697ae7ab57855b1dabeff5e61da579c7 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940473.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940477.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940477.png new file mode 100644 index 0000000000000000000000000000000000000000..ac00e7ec5859d6dfa03e2ffc1fbba073d7be5775 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940477.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940481.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940481.png new file mode 100644 index 0000000000000000000000000000000000000000..6cf037607ea99e4b99738d9a9d610939a881f980 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940481.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940485.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940485.png new file mode 100644 index 0000000000000000000000000000000000000000..45196f697e4718ef99ca175bb6c0f1526e2a580d Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940485.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940505.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940505.png new file mode 100644 index 0000000000000000000000000000000000000000..3fc091e4e68bf1ef8c57ad082549e88b31d94caf Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940505.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940513.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940513.png new file mode 100644 index 0000000000000000000000000000000000000000..7527389d971a173f8e5e8b20ef5db4a881a2cd56 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940513.png differ diff --git a/zh-cn/application-dev/ui/figures/direction2.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940517.png similarity index 100% rename from zh-cn/application-dev/ui/figures/direction2.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940517.png diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001263259399.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940521.png similarity index 100% rename from zh-cn/application-dev/ui/figures/zh-cn_image_0000001263259399.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940521.png diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940525.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940525.png new file mode 100644 index 0000000000000000000000000000000000000000..c194dadaaa7b411ea1173a063f525d68e5484d49 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940525.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940529.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940529.png new file mode 100644 index 0000000000000000000000000000000000000000..58c643d4925935bf771835147aaf8296088b32ae Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940529.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940533.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940533.png new file mode 100644 index 0000000000000000000000000000000000000000..f81f60b5d9e3f4eb15535f97c7ba439fc285d149 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940533.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001263339459.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940541.png similarity index 100% rename from zh-cn/application-dev/ui/figures/zh-cn_image_0000001263339459.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940541.png diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940549.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940549.gif new file mode 100644 index 0000000000000000000000000000000000000000..a7d9f0af6d583cdc4eaf4ad867033bdaeb1e1611 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940549.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940565.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940565.png new file mode 100644 index 0000000000000000000000000000000000000000..8753b55548c79ce2730235bc0ad0e97b0a0f3669 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940565.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940581.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940581.png new file mode 100644 index 0000000000000000000000000000000000000000..313f2a2944175d63307b31540ce1ec17b08f1670 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940581.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940585.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940585.png new file mode 100644 index 0000000000000000000000000000000000000000..f6a9c832826019ed0d831c8b513954c87264d3c6 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940585.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940589.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940589.png new file mode 100644 index 0000000000000000000000000000000000000000..d01c3595f202b50050ff1763293cd7cedba234b6 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940589.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940601.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940601.png new file mode 100644 index 0000000000000000000000000000000000000000..5631f463b0e3860ddf113c32b138550f765cb0c8 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940601.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940609.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940609.gif new file mode 100644 index 0000000000000000000000000000000000000000..14f3d25cbf137366ce3c2bb93f683d75a9297597 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940609.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940613.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940613.png new file mode 100644 index 0000000000000000000000000000000000000000..121d50a895a8ad99813b9fc9d440e4cd90779fb8 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940613.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940617.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940617.gif new file mode 100644 index 0000000000000000000000000000000000000000..a1772959dbfa036adfd304632e612b21f1e8c850 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940617.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940621.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940621.png new file mode 100644 index 0000000000000000000000000000000000000000..38c5abece8a9bb2a73552aebcd2bfb626e4ee3e3 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001562940621.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060641.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060641.png new file mode 100644 index 0000000000000000000000000000000000000000..ee7966d0a498dd541acc578ed31174fc310e75f6 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060641.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060653.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060653.png new file mode 100644 index 0000000000000000000000000000000000000000..71b01bc206f9432451fa91e99f3f46283649634a Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060653.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060657.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060657.png new file mode 100644 index 0000000000000000000000000000000000000000..8fbc741238652bae53bac247643954eb1aafc697 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060657.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001218419616.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060677.png similarity index 100% rename from zh-cn/application-dev/ui/figures/zh-cn_image_0000001218419616.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060677.png diff --git a/zh-cn/application-dev/ui/figures/mainCenter.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060681.png similarity index 100% rename from zh-cn/application-dev/ui/figures/mainCenter.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060681.png diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060685.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060685.png new file mode 100644 index 0000000000000000000000000000000000000000..9ca9fa88b2239304a0986e43240697373ec2bf6a Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060685.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060689.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060689.gif new file mode 100644 index 0000000000000000000000000000000000000000..e44df1b36066095ed6e8741e26d9f04a4c9a2b0b Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060689.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060693.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060693.png new file mode 100644 index 0000000000000000000000000000000000000000..d6da72706ca73f16aef40108a374325f0b5f7de4 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060693.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060697.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060697.png new file mode 100644 index 0000000000000000000000000000000000000000..b46c1ea016b3f018d9729499e3df2b98e10467f9 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060697.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060701.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060701.png new file mode 100644 index 0000000000000000000000000000000000000000..7511094aeee8e6c854f7271a5118fb6a1df99328 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060701.png differ diff --git a/zh-cn/application-dev/ui/figures/offset1.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060705.png similarity index 100% rename from zh-cn/application-dev/ui/figures/offset1.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060705.png diff --git a/zh-cn/application-dev/ui/figures/columns1.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060709.png similarity index 100% rename from zh-cn/application-dev/ui/figures/columns1.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060709.png diff --git a/zh-cn/application-dev/ui/figures/mainSpaceevenly.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060713.png similarity index 100% rename from zh-cn/application-dev/ui/figures/mainSpaceevenly.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060713.png diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060729.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060729.png new file mode 100644 index 0000000000000000000000000000000000000000..65e3505a934bab1de3779b89737279e670f9ac33 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060729.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060761.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060761.png new file mode 100644 index 0000000000000000000000000000000000000000..907e3ff12b33dbdcaff72ff4d5fc45236de04e79 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060761.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060765.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060765.png new file mode 100644 index 0000000000000000000000000000000000000000..de4848b9c7750dcef6e9216e9f68604203b1620a Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060765.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060769.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060769.gif new file mode 100644 index 0000000000000000000000000000000000000000..bb1ac0f266c1e2eaa4756496832bb28beed4bf39 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060769.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060773.gif b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060773.gif new file mode 100644 index 0000000000000000000000000000000000000000..b1760403750123b2f3c589d0f20697c57080966d Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060773.gif differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060777.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060777.png new file mode 100644 index 0000000000000000000000000000000000000000..bfb4159928f562004b4551d36b4b13e495a4e3c0 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060777.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060781.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060781.png new file mode 100644 index 0000000000000000000000000000000000000000..1216da4afc8b43ab12b27993c33a8078c6a2e44c Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060781.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060785.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060785.png new file mode 100644 index 0000000000000000000000000000000000000000..fc052ef293a27904248d7d6af2a7e13da3be666a Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060785.png differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060793.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060793.png new file mode 100644 index 0000000000000000000000000000000000000000..eab5b1b3b240a8a80f913684ae892b7b775f3e66 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060793.png differ diff --git a/zh-cn/application-dev/ui/figures/stack1.png b/zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060797.png similarity index 100% rename from zh-cn/application-dev/ui/figures/stack1.png rename to zh-cn/application-dev/ui/figures/zh-cn_image_0000001563060797.png diff --git a/zh-cn/application-dev/ui/figures/zh-cn_other_0000001500740342.jpeg b/zh-cn/application-dev/ui/figures/zh-cn_other_0000001500740342.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..ace71361eb29956ec0f80cab785122b546b64bc1 Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_other_0000001500740342.jpeg differ diff --git a/zh-cn/application-dev/ui/figures/zh-cn_other_0000001500900234.jpeg b/zh-cn/application-dev/ui/figures/zh-cn_other_0000001500900234.jpeg new file mode 100644 index 0000000000000000000000000000000000000000..5741b5407f11587de9f927dd29d5e1a199fe65bd Binary files /dev/null and b/zh-cn/application-dev/ui/figures/zh-cn_other_0000001500900234.jpeg differ diff --git "a/zh-cn/application-dev/ui/figures/\344\276\247\350\276\271\345\257\274\350\210\252.png" "b/zh-cn/application-dev/ui/figures/\344\276\247\350\276\271\345\257\274\350\210\252.png" new file mode 100644 index 0000000000000000000000000000000000000000..93a4a782c696b2bf5d15133264bfa9d04d775e9f Binary files /dev/null and "b/zh-cn/application-dev/ui/figures/\344\276\247\350\276\271\345\257\274\350\210\252.png" differ diff --git "a/zh-cn/application-dev/ui/figures/\345\210\206\346\240\217.jpg" "b/zh-cn/application-dev/ui/figures/\345\210\206\346\240\217.jpg" new file mode 100644 index 0000000000000000000000000000000000000000..316cd89a45e277376921833dfd992a33a38412c7 Binary files /dev/null and "b/zh-cn/application-dev/ui/figures/\345\210\206\346\240\217.jpg" differ diff --git "a/zh-cn/application-dev/ui/figures/\345\210\207\346\215\242\346\214\207\345\256\232\351\241\265\347\255\276.gif" "b/zh-cn/application-dev/ui/figures/\345\210\207\346\215\242\346\214\207\345\256\232\351\241\265\347\255\276.gif" new file mode 100644 index 0000000000000000000000000000000000000000..824c0b29c31d1d21767f602f00ba49e8652dee4f Binary files /dev/null and "b/zh-cn/application-dev/ui/figures/\345\210\207\346\215\242\346\214\207\345\256\232\351\241\265\347\255\276.gif" differ diff --git "a/zh-cn/application-dev/ui/figures/\345\210\233\345\273\2722.jpg" "b/zh-cn/application-dev/ui/figures/\345\210\233\345\273\2722.jpg" new file mode 100644 index 0000000000000000000000000000000000000000..183bc320533bc991e38655ea2f4ab441238c9ec7 Binary files /dev/null and "b/zh-cn/application-dev/ui/figures/\345\210\233\345\273\2722.jpg" differ diff --git "a/zh-cn/application-dev/ui/figures/\345\215\225\351\241\265\351\235\2421.jpg" "b/zh-cn/application-dev/ui/figures/\345\215\225\351\241\265\351\235\2421.jpg" new file mode 100644 index 0000000000000000000000000000000000000000..93bef8378ac6f275a1d244743d1ddf832f8c2c01 Binary files /dev/null and "b/zh-cn/application-dev/ui/figures/\345\215\225\351\241\265\351\235\2421.jpg" differ diff --git "a/zh-cn/application-dev/ui/figures/\345\233\272\345\256\232\345\257\274\350\210\252.gif" "b/zh-cn/application-dev/ui/figures/\345\233\272\345\256\232\345\257\274\350\210\252.gif" new file mode 100644 index 0000000000000000000000000000000000000000..21e0aaf7ee9c2a6a3c5311c183bbaa72189056fb Binary files /dev/null and "b/zh-cn/application-dev/ui/figures/\345\233\272\345\256\232\345\257\274\350\210\252.gif" differ diff --git "a/zh-cn/application-dev/ui/figures/\345\233\276\347\211\2071.png" "b/zh-cn/application-dev/ui/figures/\345\233\276\347\211\2071.png" new file mode 100644 index 0000000000000000000000000000000000000000..47750ee238fc411f26ed86d99d2f554d3f185b64 Binary files /dev/null and "b/zh-cn/application-dev/ui/figures/\345\233\276\347\211\2071.png" differ diff --git "a/zh-cn/application-dev/ui/figures/\345\233\276\347\211\2072.png" "b/zh-cn/application-dev/ui/figures/\345\233\276\347\211\2072.png" new file mode 100644 index 0000000000000000000000000000000000000000..869998f78209dd5a29b8b1f276299f3d18aef9b0 Binary files /dev/null and "b/zh-cn/application-dev/ui/figures/\345\233\276\347\211\2072.png" differ diff --git "a/zh-cn/application-dev/ui/figures/\345\233\276\347\211\2073.png" "b/zh-cn/application-dev/ui/figures/\345\233\276\347\211\2073.png" new file mode 100644 index 0000000000000000000000000000000000000000..ff32cdae3e35bd9b05e0f676fd3774fd357036ff Binary files /dev/null and "b/zh-cn/application-dev/ui/figures/\345\233\276\347\211\2073.png" differ diff --git "a/zh-cn/application-dev/ui/figures/\345\234\272\346\231\2571.jpg" "b/zh-cn/application-dev/ui/figures/\345\234\272\346\231\2571.jpg" new file mode 100644 index 0000000000000000000000000000000000000000..04c5ef7e1ed61e42419ec4d40efd44e096df28a3 Binary files /dev/null and "b/zh-cn/application-dev/ui/figures/\345\234\272\346\231\2571.jpg" differ diff --git "a/zh-cn/application-dev/ui/figures/\345\234\272\346\231\2572.jpg" "b/zh-cn/application-dev/ui/figures/\345\234\272\346\231\2572.jpg" new file mode 100644 index 0000000000000000000000000000000000000000..76b5c6d464e74460a9e3c74ff4a29d351225984a Binary files /dev/null and "b/zh-cn/application-dev/ui/figures/\345\234\272\346\231\2572.jpg" differ diff --git "a/zh-cn/application-dev/ui/figures/\345\261\217\345\271\225\346\210\252\345\233\276_20230223_141141.png" "b/zh-cn/application-dev/ui/figures/\345\261\217\345\271\225\346\210\252\345\233\276_20230223_141141.png" new file mode 100644 index 0000000000000000000000000000000000000000..ea5491bcfc21ba653f88100b0d4796152dc9f203 Binary files /dev/null and "b/zh-cn/application-dev/ui/figures/\345\261\217\345\271\225\346\210\252\345\233\276_20230223_141141.png" differ diff --git "a/zh-cn/application-dev/ui/figures/\345\261\217\345\271\225\346\210\252\345\233\276_20230223_141404.png" "b/zh-cn/application-dev/ui/figures/\345\261\217\345\271\225\346\210\252\345\233\276_20230223_141404.png" new file mode 100644 index 0000000000000000000000000000000000000000..040d48397ab11cb433043ce0b50e8e46cc94476a Binary files /dev/null and "b/zh-cn/application-dev/ui/figures/\345\261\217\345\271\225\346\210\252\345\233\276_20230223_141404.png" differ diff --git "a/zh-cn/application-dev/ui/figures/\345\272\225\351\203\250\345\257\274\350\210\252.gif" "b/zh-cn/application-dev/ui/figures/\345\272\225\351\203\250\345\257\274\350\210\252.gif" new file mode 100644 index 0000000000000000000000000000000000000000..19347f2d6324e7e86e0d4ac5e9a5143588526589 Binary files /dev/null and "b/zh-cn/application-dev/ui/figures/\345\272\225\351\203\250\345\257\274\350\210\252.gif" differ diff --git "a/zh-cn/application-dev/ui/figures/\346\210\252\345\233\2762.PNG" "b/zh-cn/application-dev/ui/figures/\346\210\252\345\233\2762.PNG" new file mode 100644 index 0000000000000000000000000000000000000000..1a9ff7709260b87c724834631bb5723b2ccaaba8 Binary files /dev/null and "b/zh-cn/application-dev/ui/figures/\346\210\252\345\233\2762.PNG" differ diff --git "a/zh-cn/application-dev/ui/figures/\346\210\252\345\233\2763.PNG" "b/zh-cn/application-dev/ui/figures/\346\210\252\345\233\2763.PNG" new file mode 100644 index 0000000000000000000000000000000000000000..07e1c228c93ccc4f45d88a82f6b2e5773bc4629a Binary files /dev/null and "b/zh-cn/application-dev/ui/figures/\346\210\252\345\233\2763.PNG" differ diff --git "a/zh-cn/application-dev/ui/figures/\346\227\240\346\240\207\351\242\230.png" "b/zh-cn/application-dev/ui/figures/\346\227\240\346\240\207\351\242\230.png" new file mode 100644 index 0000000000000000000000000000000000000000..00e1533c790c45f83781b2657e94dcc17e3ff8b2 Binary files /dev/null and "b/zh-cn/application-dev/ui/figures/\346\227\240\346\240\207\351\242\230.png" differ diff --git "a/zh-cn/application-dev/ui/figures/\346\234\200\347\273\210\346\225\210\346\236\234.gif" "b/zh-cn/application-dev/ui/figures/\346\234\200\347\273\210\346\225\210\346\236\234.gif" new file mode 100644 index 0000000000000000000000000000000000000000..e530e58a239d0c76893046f0b73b061f5550820b Binary files /dev/null and "b/zh-cn/application-dev/ui/figures/\346\234\200\347\273\210\346\225\210\346\236\234.gif" differ diff --git "a/zh-cn/application-dev/ui/figures/\346\234\200\347\273\210\346\225\210\346\236\23411.gif" "b/zh-cn/application-dev/ui/figures/\346\234\200\347\273\210\346\225\210\346\236\23411.gif" new file mode 100644 index 0000000000000000000000000000000000000000..c0dde5b1ef76e44606de04a979c5e62cf4464438 Binary files /dev/null and "b/zh-cn/application-dev/ui/figures/\346\234\200\347\273\210\346\225\210\346\236\23411.gif" differ diff --git "a/zh-cn/application-dev/ui/figures/\346\273\232\345\212\250\345\257\274\350\210\252.gif" "b/zh-cn/application-dev/ui/figures/\346\273\232\345\212\250\345\257\274\350\210\252.gif" new file mode 100644 index 0000000000000000000000000000000000000000..7699d8659a5a9b288c4d9bfd9f8f6ee9a6d17adb Binary files /dev/null and "b/zh-cn/application-dev/ui/figures/\346\273\232\345\212\250\345\257\274\350\210\252.gif" differ diff --git "a/zh-cn/application-dev/ui/figures/\350\217\234\345\215\225\346\240\217.jpg" "b/zh-cn/application-dev/ui/figures/\350\217\234\345\215\225\346\240\217.jpg" new file mode 100644 index 0000000000000000000000000000000000000000..931156abc1f61123f6e8b8dbfe91397e03b05450 Binary files /dev/null and "b/zh-cn/application-dev/ui/figures/\350\217\234\345\215\225\346\240\217.jpg" differ diff --git "a/zh-cn/application-dev/ui/figures/\350\217\234\345\215\225\346\240\2172.jpg" "b/zh-cn/application-dev/ui/figures/\350\217\234\345\215\225\346\240\2172.jpg" new file mode 100644 index 0000000000000000000000000000000000000000..6d288203ebed2067587cf7ebec77fe7d27a69e1c Binary files /dev/null and "b/zh-cn/application-dev/ui/figures/\350\217\234\345\215\225\346\240\2172.jpg" differ diff --git "a/zh-cn/application-dev/ui/figures/\351\231\220\345\210\266\345\257\274\350\210\252.gif" "b/zh-cn/application-dev/ui/figures/\351\231\220\345\210\266\345\257\274\350\210\252.gif" new file mode 100644 index 0000000000000000000000000000000000000000..43ea4148ee3e5fdcb9497481a230fb7da8de9d7e Binary files /dev/null and "b/zh-cn/application-dev/ui/figures/\351\231\220\345\210\266\345\257\274\350\210\252.gif" differ diff --git "a/zh-cn/application-dev/ui/figures/\351\241\266\351\203\250\345\257\274\350\210\252.gif" "b/zh-cn/application-dev/ui/figures/\351\241\266\351\203\250\345\257\274\350\210\252.gif" new file mode 100644 index 0000000000000000000000000000000000000000..8526ec78f67b77db19fb4e59bf827cfa5fa53135 Binary files /dev/null and "b/zh-cn/application-dev/ui/figures/\351\241\266\351\203\250\345\257\274\350\210\252.gif" differ diff --git a/zh-cn/application-dev/ui/ui-js-animate-component.md b/zh-cn/application-dev/ui/ui-js-animate-component.md index 07cabbfc8758decdf6694748551014c58cd86921..e8c9b70d71569c9640ae2e92fc901feb5031549e 100644 --- a/zh-cn/application-dev/ui/ui-js-animate-component.md +++ b/zh-cn/application-dev/ui/ui-js-animate-component.md @@ -219,248 +219,3 @@ export default { > alternate-reverse:动画反向交替循环播放,奇数次反向播放,偶数次正向播放。 -## 添加事件和调用方法 - -animation对象支持动画事件和动画方法。可以通过添加开始和取消事件,调用播放、暂停、倒放和结束方法实现预期动画。 - -```html - -

-
-
-
- - -
-
- - -
-
-``` - -```css -/* xxx.css */ -.container { - flex-direction: column; - align-items: center; - justify-content: center; - width: 100%; - height: 100%; -} -button{ - width: 200px; -} -.row{ - width: 65%; - height: 100px; - align-items: center; - justify-content: space-between; - margin-top: 40px; - position: fixed; - top: 65%; - left: 120px; -} -.row1{ - width: 65%; - height: 100px; - align-items: center; - justify-content: space-between; - margin-top: 30px; - position: fixed; - top: 75%; - left: 120px; -} -``` - -```js -// xxx.js -export default { - data: { - animation: '', - }, - onShow() { - var options = { - duration: 1500, - easing:'ease-in', - delay:5, - direction:'normal', - iterations:2 - }; - var frames = [ - { - transform: { - translate: '-150px -0px' - }, - opacity: 0.1, - offset: 0.0, - width: 200, - height: 200, - }, - { - transform: { - translate: '150px 0px' - }, - opacity: 1.0, - offset: 1.0, - width: 300, - height: 300, - } - ]; - this.animation = this.$element('content').animate(frames, options); - this.animation.onstart = function() { - console.info('animation start') - } // 添加开始事件 - this.animation.onrepeat = function() { - console.info('animation repeated') - } // 添加重播事件 - this.animation.oncancel = function() { - console.info('animation canceled') - } // 添加取消事件 - this.animation.onfinish = function() { - console.info('animation finish') - } // 添加完成事件 - }, - playAnimation() { - this.animation.play() // 调用播放开始的方法 - }, - pauseAnimation() { - this.animation.pause() // 调用播放暂停的方法 - }, - reverseAnimation() { - this.animation.reverse() // 调用播放倒放的方法 - }, - cancelAnimation() { - this.animation.cancel() // 调用播放取消的方法 - } -} -``` - -![zh-cn_image_0000001220635011](figures/zh-cn_image_0000001220635011.gif) - -通过改变playState的值实现动画状态的改变。 - -```html - -
-
-
-
- -
-
- -
-
-``` - -```css -/* xxx.css */ -.container { - flex-direction: column; - align-items: center; - justify-content: center; -} -button{ - width: 200px; -} -.row{ - width: 65%; - height: 100px; - align-items: center; - justify-content: space-between; - margin-top: 50px; - margin-left: 260px; - position: fixed; - top: 65%; -} -.row1{ - width: 65%; - height: 100px; - align-items: center; - justify-content: space-between; - margin-top: 50px; - margin-left: 260px; - position: fixed; - top: 75%; -} -``` - -```js -// xxx.js -import promptAction from '@ohos.promptAction'; -export default { - data: { - animation: '', - state:'play', - state1:'play' - }, - onInit() { - }, - onShow() { - var options = { - duration: 1500, - easing:'ease-in', - elay:5, - direction:'normal', - iterations:2, - }; - var frames = [ - { - transform: { - translate: '-150px -0px' - }, - opacity: 0.1, - offset: 0.0, - width: 200, - height: 200, - }, - { - transform: { - translate: '150px 0px' - }, - opacity: 1.0, - offset: 1.0, - width: 300, - height: 300, - } - ]; - this.animation = this.$element('content').animate(frames, options); - this.animation.onstart = function(){ - promptAction.showToast({ - message: "start" - }); - }; - this.animation.onrepeat = function(){ - promptAction.showToast({ - message: " repeated" - }); - }; - this.animation.onfinish = function(){ - promptAction.showToast({ - message: " finished" - }); - }; - }, - playStateClick(){ - if(this.animation.playState != 'running'){ - this.animation.playState = 'running';//设置playState为running,动画运行。 - this.state = 'pause' - }else{ - this.animation.playState = 'paused';//设置playState为paused,动画暂停。 - this.state = 'play' - } - }, - playStateClick1(){ - if(this.animation.playState != 'running'){ - this.animation.playState = 'running'; - this.state1 = 'finish' - }else{ - this.animation.playState = 'finished';//设置playState为finished,动画结束。 - this.state1 = 'play' - } - } -} -``` - -![zh-cn_image_0000001175075286](figures/zh-cn_image_0000001175075286.gif) 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 b8ca82ad3af4e0bf80706585433c3f791410c0a4..7ba400aa5f6d063d93380c4eeb5816be0f9cfe70 100644 --- a/zh-cn/application-dev/ui/ui-js-animate-transform.md +++ b/zh-cn/application-dev/ui/ui-js-animate-transform.md @@ -38,8 +38,8 @@ height: 428px; background-color: #860303; transform: rotate(45deg); - margin-top: 290px; - margin-left: 145px; + margin-top: 284px; + margin-left: 148px; } .content{ margin-top: 500px; @@ -50,9 +50,9 @@ } .door{ width: 100px; - height: 150px; + height: 135px; background-color: #1033d9; - transform: translate(150px,-152px); + transform: translate(150px,-137px); } .window{ z-index: 1; @@ -85,7 +85,7 @@ height: 100px; border-radius: 15px; background-color: #9a7404; - transform: translate(200px,-700px) skewX(-5deg); + transform: translate(200px,-710px) skewX(-5deg); } ``` @@ -197,107 +197,107 @@ ```css /* xxx.css */ .container { - flex-direction: column; - background-color:#F1F3F5; - display: flex; - align-items: center; - justify-content: center; - width: 100%; - height: 100%; + flex-direction: column; + background-color:#F1F3F5; + display: flex; + align-items: center; + justify-content: center; + width: 100%; + height: 100%; } .rect { - width: 100px; - height: 100px; - animation: rotate 3s infinite; - margin-left: 100px; + width: 100px; + height: 100px; + animation: rotate 3s infinite; + margin-left: 30px; } .rect1 { - background-color: #f76160; + background-color: #f76160; } .rect2 { - background-color: #60f76f; - /* 改变原点位置*/ - transform-origin: 10% 10px; + background-color: #60f76f; +/* 改变原点位置*/ + transform-origin: 10% 10px; } .rect3 { - background-color: #6081f7; - /* 改变原点位置*/ - transform-origin: right bottom; + background-color: #6081f7; +/* 改变原点位置*/ + transform-origin: right bottom; } @keyframes rotate { - from { - transform: rotate(0deg) - } - to { - transform: rotate(360deg); - } + from { + transform: rotate(0deg) + } + to { + transform: rotate(360deg); + } } /* 3d示例样式 */ .rotate3d { - margin-top: 150px; - flex-direction: column; - background-color:#F1F3F5; - display: flex; - align-items: center; - width: 80%; - height: 600px; - border-radius: 300px; - border: 1px solid #ec0808; + margin-top: 150px; + flex-direction: column; + background-color:#F1F3F5; + display: flex; + align-items: center; + width: 80%; + height: 600px; + border-radius: 300px; + border: 1px solid #ec0808; } .content { - padding-top: 150px; - display: flex; - align-items: center; - justify-content: center; + padding-top: 150px; + display: flex; + align-items: center; + justify-content: center; } /* react4 react5 翻转形成眼睛 */ .rect4 { - width: 100px; - height: 100px; - animation: rotate3d1 1000ms infinite; - background: linear-gradient(#e6c4ec, #be15d9) + width: 100px; + height: 100px; + animation: rotate3d1 1000ms infinite; + background-color: darkmagenta; } .rect5 { - width: 100px; - height: 100px; - animation: rotate3d1 1000ms infinite; - margin-left: 100px; - background: linear-gradient(#e6c4ec, #be15d9) + width: 100px; + height: 100px; + animation: rotate3d1 1000ms infinite; + margin-left: 100px; + background-color: darkmagenta; } .mouse { - margin-top: 150px; - width: 200px; - height: 100px; - border-radius: 50px; - border: 1px solid #e70303; - animation: rotate3d2 1000ms infinite; + margin-top: 150px; + width: 200px; + height: 100px; + border-radius: 50px; + border: 1px solid #e70303; + animation: rotate3d2 1000ms infinite; } /* 眼睛的动效 */ @keyframes rotate3d1 { - 0% { - transform:rotate3d(0,0,0,0deg) - } - 50% { - transform:rotate3d(20,20,20,360deg); - } - 100% { - transform:rotate3d(0,0,0,0deg); - } + 0% { + transform:rotate3d(0,0,0,0deg) + } + 50% { + transform:rotate3d(20,20,20,360deg); + } + 100% { + transform:rotate3d(0,0,0,0deg); + } } /* 嘴的动效 */ @keyframes rotate3d2 { - 0% { - transform:rotate3d(0,0,0,0deg) - } - 33% { - transform:rotate3d(0,0,10,30deg); - } - 66% { - transform:rotate3d(0,0,10,-30deg); - } - 100% { - transform:rotate3d(0,0,0,0deg); - } + 0% { + transform:rotate3d(0,0,0,0deg) + } + 33% { + transform:rotate3d(0,0,10,30deg); + } + 66% { + transform:rotate3d(0,0,10,-30deg); + } + 100% { + transform:rotate3d(0,0,0,0deg); + } } ``` @@ -331,86 +331,85 @@ ```css /* xxx.css */ .container { - flex-direction: column; - background-color:#F1F3F5; - width: 100%; - position: relative; + flex-direction: column; + background-color:#F1F3F5; + width: 100%; + position: relative; } .circle{ - margin-top: 400px; - margin-left: 40%; - width: 100px; - height: 100px; - border-radius: 50px; - background:linear-gradient(#dcaec1, #d3a8e3); - z-index: 1; position: absolute; + margin-top: 400px; + margin-left: 40%; + width: 100px; + height: 100px; + border-radius: 50px; + background-color: mediumpurple; + z-index: 1; position: absolute; } .ripple{ - margin-top: 400px; - margin-left: 40%; - position: absolute; z-index: 0; - width: 100px; - height: 100px; - border-radius: 50px; - background:linear-gradient(#dcaec1,#d3a8e3); - animation: ripple 5s infinite; + margin-top: 400px; + margin-left: 40%; + position: absolute; z-index: 0; + width: 100px; + height: 100px; + border-radius: 50px; + background-color: blueviolet; + animation: ripple 5s infinite; } /* 设置不同的动画时间 */ .ripple2{ - animation-duration: 2.5s; + animation-duration: 2.5s; } @keyframes ripple{ - 0%{ - transform: scale(1); - opacity: 0.5; - } - 50%{ - transform: scale(3); - opacity: 0; - } - 100%{ - transform: scale(1); - opacity: 0.5; - } + 0%{ + transform: scale(1); + opacity: 0.5; + } + 50%{ + transform: scale(3); + opacity: 0; + } + 100%{ + transform: scale(1); + opacity: 0.5; + } } text{ - color: white; - text-align: center; - height: 100%; - width: 100%; + color: white; + text-align: center; + height: 100%; + width: 100%; } .content { - margin-top: 700px; - margin-left: 33%; - width: 200px; - height: 100px; - animation:rubberBand 1s infinite; - /* 设置渐变色 */ - background:linear-gradient(#e276aa,#ec0d66); - position: absolute; + margin-top: 700px; + margin-left: 33%; + width: 200px; + height: 100px; + animation:rubberBand 1s infinite; + background-color: darkmagenta; + position: absolute; } @keyframes rubberBand { - 0% { - transform: scale3d(1, 1, 1); - } - 30% { - transform: scale3d(1.25, 0.75, 1.1); - } - 40% { - transform: scale3d(0.75, 1.25, 1.2); - } - 50% { - transform: scale3d(1.15, 0.85, 1.3); - } - 65% { - transform: scale3d(.95, 1.05, 1.2); - } - 75% { - transform: scale3d(1.05, .95, 1.1); - } - 100%{ - transform: scale3d(1, 1, 1); - } + 0% { + transform: scale3d(1, 1, 1); + } + 30% { + transform: scale3d(1.25, 0.75, 1.1); + } + 40% { + transform: scale3d(0.75, 1.25, 1.2); + } + 50% { + transform: scale3d(1.15, 0.85, 1.3); + } + 65% { + transform: scale3d(.95, 1.05, 1.2); + } + 75% { + transform: scale3d(1.05, .95, 1.1); + } + 100%{ + transform: scale3d(1, 1, 1); + } } ``` @@ -483,92 +482,92 @@ transform可以设置多个值并且多个值可同时设置,下面案例中 ```css /* xxx.css */ .container{ - width: 100%; - height: 100%; - flex-direction:column; - background-color:#F1F3F5; - padding:50px; + width: 100%; + height: 100%; + flex-direction:column; + background-color:#F1F3F5; + padding:50px; } .rect1{ - width: 100px; - height: 100px; - background:linear-gradient(#e77070,#ee0202); - animation: change1 3s infinite forwards; + width: 100px; + height: 100px; + background-color: red; + animation: change1 3s infinite forwards; } .rect2{ - margin-top: 50px; - width: 100px; - height: 100px; - background:linear-gradient(#95a6e8, #2739de); - animation: change2 3s infinite forwards; + margin-top: 50px; + width: 100px; + height: 100px; + background-color: darkblue; + animation: change2 3s infinite forwards; } .rect3{ - margin-top: 50px; - width: 100px; - height: 100px; - background:linear-gradient(#142ee2, #8cb1e5); - animation: change3 3s infinite; + margin-top: 50px; + width: 100px; + height: 100px; + background-color: darkblue; + animation: change3 3s infinite; } .rect4{ - align-self: center; - margin-left: 50px; - margin-top: 200px; - width: 100px; - height: 100px; - background:linear-gradient(#e2a8df, #9c67d4,#8245d9,#e251c3); - animation: change4 3s infinite; + align-self: center; + margin-left: 50px; + margin-top: 200px; + width: 100px; + height: 100px; + background-color: darkmagenta; + animation: change4 3s infinite; } .rect5{ - margin-top: 300px; - width: 100px; - height: 100px; - background:linear-gradient(#e7ded7, #486ccd, #94b4d2); - animation: change5 3s infinite; + margin-top: 300px; + width: 100px; + height: 100px; + background-color: cadetblue; + animation: change5 3s infinite; } /* change1 change2 对比 */ @keyframes change1{ - 0%{ - transform: translate(0,0); transform: rotate(0deg) - } - 100%{ - transform: translate(0,500px); - transform: rotate(360deg) - } + 0%{ + transform: translate(0,0); transform: rotate(0deg) + } + 100%{ + transform: translate(0,500px); + transform: rotate(360deg) + } } /* change2 change3 对比属性顺序不同的动画效果 */ @keyframes change2{ - 0%{ - transform:translate(0,0) rotate(0deg) ; - } - 100%{ - transform: translate(300px,0) rotate(360deg); - } + 0%{ + transform:translate(0,0) rotate(0deg) ; + } + 100%{ + transform: translate(300px,0) rotate(360deg); + } } @keyframes change3{ - 0%{ - transform:rotate(0deg) translate(0,0); - } - 100%{ - transform:rotate(360deg) translate(300px,0); - } + 0%{ + transform:rotate(0deg) translate(0,0); + } + 100%{ + transform:rotate(360deg) translate(300px,0); + } } /* 属性值不对应的情况 */ @keyframes change4{ - 0%{ - transform: scale(0.5); - } - 100%{ - transform:scale(2) rotate(45deg); - } + 0%{ + transform: scale(0.5); + } + 100%{ + transform:scale(2) rotate(45deg); + } } /* 多属性的写法 */ @keyframes change5{ - 0%{ - transform:scale(0) translate(0,0) rotate(0); - } - 100%{ - transform: scale(1.5) rotate(360deg) translate(200px,0); - } + 0%{ + transform:scale(0) translate(0,0) rotate(0); + } + 100%{ + transform: scale(1.5) rotate(360deg) translate(200px,0); + } } ``` @@ -590,8 +589,6 @@ transform可以设置多个值并且多个值可同时设置,下面案例中 - [`JsClock`:时钟(JS)(API10)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/Solutions/Tools/JsClock) -- [`JsAnimator`:动画(JS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/UI/JsAnimation) - - [动画样式(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 253c9d0ebcc83f969753fe2d3a7585b22e863b20..2fe99304ed549e7916092ea6dac57fb9d339aaeb 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 @@ -27,12 +27,6 @@ - [`JsComponentCollection`:组件集合(JS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/UI/JsComponentClollection/JsComponentCollection) -- [`JsPanel`:内容展示面板(JS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/UI/JsPanel) - -- [`Popup`:气泡(JS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/UI/Popup) - -- [`JsUserRegistration`:用户注册(JS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/UI/JsUserRegistration) - - [`MediaCollections`:媒体管理合集(eTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/FileManagement/MediaCollections) - [rating(JS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/JSUI/RatingApplication) diff --git a/zh-cn/application-dev/ui/ui-js-building-ui-routes.md b/zh-cn/application-dev/ui/ui-js-building-ui-routes.md index 0c1f7da4095e6caaf12416a2aaac76aa03a7fbb8..206cd433560c9cf46dd19ee49d162061211cca3c 100644 --- a/zh-cn/application-dev/ui/ui-js-building-ui-routes.md +++ b/zh-cn/application-dev/ui/ui-js-building-ui-routes.md @@ -91,4 +91,4 @@ export default { 针对页面路由开发,有以下相关实例可供参考: -- [`JsRouter`:页面路由(JS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/UI/JsRouter) +- [`JsComponentCollection`:JS组件集合(JS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/UI/JsComponentClollection/JsComponentCollection) diff --git a/zh-cn/application-dev/ui/ui-js-component-tabs.md b/zh-cn/application-dev/ui/ui-js-component-tabs.md index 667645da64cda09a34f3464a5cce62b135512010..64e10a67772c10819d0cafbbaac93d85c41361c5 100644 --- a/zh-cn/application-dev/ui/ui-js-component-tabs.md +++ b/zh-cn/application-dev/ui/ui-js-component-tabs.md @@ -50,57 +50,6 @@ tabs是一种常见的界面导航结构。通过页签容器,用户可以快 ![zh-cn_image_0000001165191390](figures/zh-cn_image_0000001165191390.gif) -## 设置tabs方向 - -tabs默认展示索引为index的标签及内容。通过设置vertical属性使组件纵向展示。 - -```html - -
- - - item1 - item2 - - -
- -
-
- -
-
-
-
-``` - -![zh-cn_image_0000001208908643](figures/zh-cn_image_0000001208908643.gif) - -设置mode属性使tab-bar的子组件均分,设置scrollable属性使tab-content不可进行左右滑动切换内容。 - -```html - -
- - - item1 - item2 - - -
- -
-
- -
-
-
-
-``` - -![zh-cn_image_0000001209028575](figures/zh-cn_image_0000001209028575.gif) - - ## 设置样式 设置tabs背景色及边框和tab-content布局。 @@ -319,4 +268,4 @@ export default { 针对tabs开发,有以下相关实例可供参考: -- [`Tabs`:页签容器(JS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/UI/Tabs) \ No newline at end of file +- [`JsComponentCollection`:JS组件集合(JS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/UI/JsComponentClollection/JsComponentCollection) \ No newline at end of file diff --git a/zh-cn/application-dev/ui/ui-js-components-canvas.md b/zh-cn/application-dev/ui/ui-js-components-canvas.md index cda2e7854144a919dc8a3b687a07adc84b136e8b..e27cea75647cec20b0ccfcdf3658fc6c07431808 100644 --- a/zh-cn/application-dev/ui/ui-js-components-canvas.md +++ b/zh-cn/application-dev/ui/ui-js-components-canvas.md @@ -146,4 +146,4 @@ export default { 针对Canvas开发,有以下相关实例可供参考: -- [`JsCanvas`:画布组件(JS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/UI/JsCanvas) +- [`JsComponentCollection`:JS组件集合(JS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/UI/JsComponentClollection/JsComponentCollection) 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 c00ce4dfb6a9acac1f460df1bd6d8a5420a06425..c6096a78174b3caf5a204094b33b79f034875214 100644 --- a/zh-cn/application-dev/ui/ui-js-components-chart.md +++ b/zh-cn/application-dev/ui/ui-js-components-chart.md @@ -624,6 +624,4 @@ export default { 针对chart开发,有以下相关实例可供参考: -- [`chart`:图表组件(JS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/UI/chart) - -- [chart(JS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/JSUI/SwitchApplication) +- [`JsComponentCollection`:JS组件集合(JS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/UI/JsComponentClollection/JsComponentCollection) diff --git a/zh-cn/application-dev/ui/ui-js-components-grid.md b/zh-cn/application-dev/ui/ui-js-components-grid.md index 4786eb03b1f3f9b4b95c44a7249e2222dc04cd3c..a25c4465a7b9da69f88186a47667704f9b82c9d7 100644 --- a/zh-cn/application-dev/ui/ui-js-components-grid.md +++ b/zh-cn/application-dev/ui/ui-js-components-grid.md @@ -12,9 +12,9 @@ ```html
- + + 10%;"> @@ -27,8 +27,7 @@ .container{ flex-direction: column; background-color: #F1F3F5; - width: 100%; - height: 100%; + margin-top: 500px; justify-content: center; align-items: center; } @@ -48,14 +47,14 @@ grid-container点击组件调用getColumns、getColumnWidth、getGutterWidth方 ```html
- + 40%;"> + 25%;"> + 10%;">
@@ -67,8 +66,7 @@ grid-container点击组件调用getColumns、getColumnWidth、getGutterWidth方 .container{ flex-direction: column; background-color: #F1F3F5; - width: 100%; - height: 100%; + margin-top: 400px; justify-content: center; align-items: center; } @@ -163,7 +161,7 @@ export default { text{ color: white; font-size: 40px; - +} ``` ![zh-cn_image_0000001227135731](figures/zh-cn_image_0000001227135731.png) @@ -252,4 +250,4 @@ export default { 针对Grid开发,有以下相关实例可供参考: -- [`JsGrid`:栅格组件(JS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/UI/JsGrid) +- [`JsComponentCollection`:JS组件集合(JS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/UI/JsComponentClollection/JsComponentCollection) diff --git a/zh-cn/application-dev/ui/ui-js-components-list.md b/zh-cn/application-dev/ui/ui-js-components-list.md index eb4dfa73618046665a2a5314369b968d63c30928..bbb2d35c2c4ac53e081164e04e85a25c2f5de8a6 100644 --- a/zh-cn/application-dev/ui/ui-js-components-list.md +++ b/zh-cn/application-dev/ui/ui-js-components-list.md @@ -314,4 +314,4 @@ export default { 针对list开发,有以下相关实例可供参考: -- [`JsList`:商品列表(JS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/UI/JsList) \ No newline at end of file +- [`JsComponentCollection`:JS组件集合(JS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/UI/JsComponentClollection/JsComponentCollection) \ No newline at end of file diff --git a/zh-cn/application-dev/ui/ui-js-components-marquee.md b/zh-cn/application-dev/ui/ui-js-components-marquee.md index f755e9807c056a25788fb999e9826f9c80f8bf67..280fdb86c494efeece578119069ffaacef0b4803 100644 --- a/zh-cn/application-dev/ui/ui-js-components-marquee.md +++ b/zh-cn/application-dev/ui/ui-js-components-marquee.md @@ -12,7 +12,7 @@ marquee为跑马灯组件,用于展示一段单行滚动的文字。具体用 ```html
- This is a marquee. + It's a racing lamp.
``` diff --git a/zh-cn/application-dev/ui/ui-js-components-menu.md b/zh-cn/application-dev/ui/ui-js-components-menu.md index 710007a5d1edc6fcb2be0d55e420b74c71812865..b71b3d19a460d5a12667f49265ab02eb8af76aa0 100644 --- a/zh-cn/application-dev/ui/ui-js-components-menu.md +++ b/zh-cn/application-dev/ui/ui-js-components-menu.md @@ -179,15 +179,15 @@ export default { ```html
-
- {{item.name}} -
- width:{{width}},height:{{height}} -
- change size - - - +
+ {{item.name}} +
+ width:{{width}},height:{{height}} +
+ change size + + +
``` @@ -242,7 +242,6 @@ option{ ```js // xxx.js -import promptAction from '@ohos.promptAction'; export default { data:{ fresh: false, @@ -283,4 +282,4 @@ export default { 针对menu开发,有以下相关实例可供参考: -- [`JSMenu`:菜单(JS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/UI/JSMenu) +- [`JsComponentCollection`:JS组件集合(JS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/UI/JsComponentClollection/JsComponentCollection) diff --git a/zh-cn/application-dev/ui/ui-js-components-picker.md b/zh-cn/application-dev/ui/ui-js-components-picker.md index f0f0818a3f4e2bc59334d87782cd3e69ed16b880..7a9af47249ea769bb4fea644a0de598f15229387 100644 --- a/zh-cn/application-dev/ui/ui-js-components-picker.md +++ b/zh-cn/application-dev/ui/ui-js-components-picker.md @@ -301,4 +301,4 @@ export default { 针对picker开发,有以下相关实例可供参考: -- [`Picker`:滑动选择器(JS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/UI/Picker) +- [`JsComponentCollection`:JS组件集合(JS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/UI/JsComponentClollection/JsComponentCollection) diff --git a/zh-cn/application-dev/ui/ui-js-components-stepper.md b/zh-cn/application-dev/ui/ui-js-components-stepper.md index bc2fbb91c69af6215bbe86cdaced35b78190e631..1720cd4cee88bd8c28f15abbca8f12e952d42707 100644 --- a/zh-cn/application-dev/ui/ui-js-components-stepper.md +++ b/zh-cn/application-dev/ui/ui-js-components-stepper.md @@ -186,7 +186,7 @@ text{ } ``` -![zh-cn_image_0000001234130975](figures/zh-cn_image_0000001234130975.PNG) +![zh-cn_image_0000001234130975](figures/zh-cn_image_0000001234130975.png) ## 添加事件 @@ -410,4 +410,4 @@ export default { 针对stepper开发,有以下相关实例可供参考: -- [`StepNavigator`:步骤导航器(JS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/UI/StepNavigator) +- [`JsComponentCollection`:JS组件集合(JS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/UI/JsComponentClollection/JsComponentCollection) diff --git a/zh-cn/application-dev/ui/ui-js-components-svg-overview.md b/zh-cn/application-dev/ui/ui-js-components-svg-overview.md index f3ee0f5ce2ab3bd80222e8f8bc8bdc65dfa4e965..ae32dcf6a7120e85454cdbd81077d21d9c463bf9 100644 --- a/zh-cn/application-dev/ui/ui-js-components-svg-overview.md +++ b/zh-cn/application-dev/ui/ui-js-components-svg-overview.md @@ -87,4 +87,4 @@ svg{ 针对Svg开发,有以下相关实例可供参考: -- [`JsSvg`:可缩放矢量图形(JS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/UI/JsSvg) +- [`JsComponentCollection`:JS组件集合(JS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/UI/JsComponentClollection/JsComponentCollection) \ No newline at end of file diff --git a/zh-cn/application-dev/ui/ui-js-components-swiper.md b/zh-cn/application-dev/ui/ui-js-components-swiper.md index 6941ec9b7e2f72963bac34f059df24a65b1f4b9f..3568e0be6c664d73cd8fc95d9842930c6caef204 100644 --- a/zh-cn/application-dev/ui/ui-js-components-swiper.md +++ b/zh-cn/application-dev/ui/ui-js-components-swiper.md @@ -131,17 +131,17 @@ text{ ```html
- -
- item1 -
-
- item2 -
-
- item3 -
-
+ +
+ item1 +
+
+ item2 +
+
+ item3 +
+
``` @@ -370,4 +370,4 @@ export default { 针对swiper开发,有以下相关实例可供参考: -- [`Swiper`:内容滑动容器(JS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/UI/Swiper) +- [`JsComponentCollection`:JS组件集合(JS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/UI/JsComponentClollection/JsComponentCollection) diff --git a/zh-cn/application-dev/ui/ui-js-components-text.md b/zh-cn/application-dev/ui/ui-js-components-text.md index 61686969aa4028ad97b40ac11545386e61a55494..29d9960107bb4ecb71244c4efe169a2b2a4a3859 100644 --- a/zh-cn/application-dev/ui/ui-js-components-text.md +++ b/zh-cn/application-dev/ui/ui-js-components-text.md @@ -276,4 +276,4 @@ export default { 针对text开发,有以下相关实例可供参考: -- [`JstextComponents`:基础组件(JS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/UI/JsBasicComponents) +- [`JsComponentCollection`:JS组件集合(JS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/UI/JsComponentClollection/JsComponentCollection) diff --git a/zh-cn/application-dev/ui/ui-js-components-toolbar.md b/zh-cn/application-dev/ui/ui-js-components-toolbar.md index 00503fa7277a1dba1559ac048d809bcd2a802669..bcad8ae027af6690c263714cdbb82fa14869b035 100644 --- a/zh-cn/application-dev/ui/ui-js-components-toolbar.md +++ b/zh-cn/application-dev/ui/ui-js-components-toolbar.md @@ -108,10 +108,6 @@ toolbar-item{ toolbar-item{ font-size: 35px; } -.toolbarActive{ - color: red; - background-color: #daebef; -} ``` @@ -186,9 +182,8 @@ export default {
- - + +
``` @@ -234,4 +229,4 @@ export default { 针对toolbar开发,有以下相关实例可供参考: -- [`Toolbar`:工具栏(JS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/UI/Toolbar) +- [`JsComponentCollection`:JS组件集合(JS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/UI/JsComponentClollection/JsComponentCollection) diff --git a/zh-cn/application-dev/ui/ui-js-overview.md b/zh-cn/application-dev/ui/ui-js-overview.md index af7b69cf513ac896ce2218c0e4553a3f213f7718..e422e642c5bf40d09d5f4dc8b224de479058834f 100755 --- a/zh-cn/application-dev/ui/ui-js-overview.md +++ b/zh-cn/application-dev/ui/ui-js-overview.md @@ -34,14 +34,6 @@ 兼容JS的类Web开发范式的方舟开发框架,有以下相关实例可供参考: -- [`AtomicLayout`:原子布局(JS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/UI/AtomicLayout) - -- [`FaModel`:FA示例应用(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/ApplicationModels/FaModel) - -- [`JsShopping`:购物示例应用(JS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/UI/JsShopping) - -- [`Stack`:堆叠容器(JS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/UI/Stack) - - [`JsComponentCollection`:JS组件集合(JS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/UI/JsComponentClollection/JsComponentCollection) - [购物应用(JS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/JSUI/ShoppingOpenHarmony) diff --git a/zh-cn/application-dev/ui/ui-ts-animation-feature.md b/zh-cn/application-dev/ui/ui-ts-animation-feature.md deleted file mode 100644 index beaa8f4ac9087a663203422d16d6ee7710ca27c3..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/ui/ui-ts-animation-feature.md +++ /dev/null @@ -1,346 +0,0 @@ -# 添加动画效果 - -动画主要包含了组件动画和页面间动画,并提供了[插值计算](../reference/apis/js-apis-curve.md)和[矩阵变换](../reference/apis/js-apis-matrix4.md)的动画能力接口,让开发者极大程度的自主设计动画效果。 - -在本节主要完成两个动画效果: - -1. 启动页的闪屏动画,即Logo图标的渐出和放大效果; -2. 食物列表页和食物详情页的共享元素转场动画效果。 - -## animateTo实现闪屏动画 - -组件动画包括属性动画和animateTo显式动画: - -1. 属性动画:设置组件通用属性变化的动画效果。 -2. 显式动画:设置组件从状态A到状态B的变化动画效果,包括样式、位置信息和节点的增加删除等,开发者无需关注变化过程,只需指定起点和终点的状态。animateTo还提供播放状态的回调接口,是对属性动画的增强与封装。 - -闪屏页面的动画效果是Logo图标的渐出和放大,动画结束后跳转到食物分类列表页面。接下来,我们就使用animateTo来实现启动页动画的闪屏效果。 - -1. 动画效果自动播放。闪屏动画的预期效果是,进入Logo页面后,animateTo动画效果自动开始播放,可以借助于组件显隐事件的回调接口来实现。调用Shape的onAppear方法,设置其显式动画。 - - ```ts - Shape() { - ... - } - .onAppear(() => { - animateTo() - }) - ``` - -2. 创建opacity和scale数值的成员变量,用装饰器@State修饰。表示其为有状态的数据,即改变会触发页面的刷新。 - - ```ts - @Entry - @Component - struct Logo { - @State private opacityValue: number = 0 - @State private scaleValue: number = 0 - build() { - Shape() { - ... - } - .scale({ x: this.scaleValue, y: this.scaleValue }) - .opacity(this.opacityValue) - .onAppear(() => { - animateTo() - }) - } - } - ``` - -3. 设置animateTo的动画曲线curve。Logo的加速曲线为先慢后快,使用贝塞尔曲线cubicBezier,cubicBezier(0.4, 0, 1, 1)。 - - 需要使用动画能力接口中的插值计算,首先要导入curves模块。 - - ```ts - import Curves from '@ohos.curves' - ``` - - @ohos.curves模块提供了线性Curve. Linear、阶梯step、三阶贝塞尔(cubicBezier)和弹簧(spring)插值曲线的初始化函数,可以根据入参创建一个插值曲线对象。 - - ```ts - @Entry - @Component - struct Logo { - @State private opacityValue: number = 0 - @State private scaleValue: number = 0 - private curve1 = Curves.cubicBezier(0.4, 0, 1, 1) - - build() { - Shape() { - ... - } - .scale({ x: this.scaleValue, y: this.scaleValue }) - .opacity(this.opacityValue) - .onAppear(() => { - animateTo({ - curve: this.curve1 - }) - }) - } - } - ``` - -4. 设置动画时长为1s,延时0.1s开始播放,设置显示动效event的闭包函数,即起点状态到终点状态为透明度opacityValue和大小scaleValue从0到1,实现Logo的渐出和放大效果。 - - ```ts - @Entry - @Component - struct Logo { - @State private opacityValue: number = 0 - @State private scaleValue: number = 0 - private curve1 = Curves.cubicBezier(0.4, 0, 1, 1) - - build() { - Shape() { - ... - } - .scale({ x: this.scaleValue, y: this.scaleValue }) - .opacity(this.opacityValue) - .onAppear(() => { - animateTo({ - duration: 1000, - curve: this.curve1, - delay: 100, - }, () => { - this.opacityValue = 1 - this.scaleValue = 1 - }) - }) - } - } - ``` - -5. 闪屏动画播放结束后定格1s,进入FoodCategoryList页面。设置animateTo的onFinish回调接口,调用定时器Timer的setTimeout接口延时1s后,调用router.replaceUrl,显示FoodCategoryList页面。 - - ```ts - import router from '@ohos.router' - - @Entry - @Component - struct Logo { - @State private opacityValue: number = 0 - @State private scaleValue: number = 0 - private curve1 = Curves.cubicBezier(0.4, 0, 1, 1) - - build() { - Shape() { - ... - } - .scale({ x: this.scaleValue, y: this.scaleValue }) - .opacity(this.opacityValue) - .onAppear(() => { - - animateTo({ - duration: 2000, - curve: this.curve1, - delay: 100, - onFinish: () => { - setTimeout(() => { - router.replaceUrl({ url: "pages/FoodCategoryList" }) - }, 1000); - } - }, () => { - this.opacityValue = 1 - this.scaleValue = 1 - }) - }) - } - } - ``` - - 整体代码如下。 - - ```ts - import Curves from '@ohos.curves' - import router from '@ohos.router' - - @Entry - @Component - struct Logo { - @State private opacityValue: number = 0 - @State private scaleValue: number = 0 - private curve1 = Curves.cubicBezier(0.4, 0, 1, 1) - private pathCommands1: string = 'M319.5 128.1 c103.5 0 187.5 84 187.5 187.5 v15 a172.5 172.5 0 0 3 -172.5 172.5 H198 a36 36 0 0 3 -13.8 -1 207 207 0 0 0 87 -372 h48.3 z' - private pathCommands2: string = 'M270.6 128.1 h48.6 c51.6 0 98.4 21 132.3 54.6 a411 411 0 0 3 -45.6 123 c-25.2 45.6 -56.4 84 -87.6 110.4 a206.1 206.1 0 0 0 -47.7 -288 z' - - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Shape() { - Path() - .commands('M162 128.7 a222 222 0 0 1 100.8 374.4 H198 a36 36 0 0 3 -36 -36') - .fill(Color.White) - .stroke(Color.Transparent) - Path() - .commands(this.pathCommands1) - .fill('none') - .stroke(Color.Transparent) - .linearGradient( - { - angle: 30, - colors: [["#C4FFA0", 0], ["#ffffff", 1]] - }) - .clip(new Path().commands(this.pathCommands1)) - - Path() - .commands(this.pathCommands2) - .fill('none') - .stroke(Color.Transparent) - .linearGradient( - { - angle: 50, - colors: [['#8CC36A', 0.1], ["#B3EB90", 0.4], ["#ffffff", 0.7]] - }) - .clip(new Path().commands(this.pathCommands2)) - } - .height('630px') - .width('630px') - .scale({ x: this.scaleValue, y: this.scaleValue }) - .opacity(this.opacityValue) - .onAppear(() => { - animateTo({ - duration: 2000, - curve: this.curve1, - delay: 100, - onFinish: () => { - setTimeout(() => { - router.replaceUrl({ url: "pages/FoodCategoryList" }) - }, 1000); - } - }, () => { - this.opacityValue = 1 - this.scaleValue = 1 - }) - }) - - Text('Healthy Diet') - .fontSize(26) - .fontColor(Color.White) - .margin({ top: 300 }) - - Text('Healthy life comes from a balanced diet') - .fontSize(17) - .fontColor(Color.White) - .margin({ top: 4 }) - } - .width('100%') - .height('100%') - .linearGradient( - { - angle: 180, - colors: [['#BDE895', 0.1], ["#95DE7F", 0.6], ["#7AB967", 1]] - }) - } - } - ``` - - ![animation-feature](figures/animation-feature.gif) - -## 页面转场动画 - -食物分类列表页和食物详情页之间的共享元素转场,即点击FoodListItem/FoodGridItem后,食物缩略图会放大,随着页面跳转,到食物详情页的大图。 - -1. 设置FoodListItem和FoodGridItem的Image组件的共享元素转场方法(sharedTransition)。转场id为foodItem.id,转场动画时长为1s,延时0.1s播放,变化曲线为贝塞尔曲线Curves.cubicBezier(0.2, 0.2, 0.1, 1.0) ,需引入curves模块。 - - 共享转场时会携带当前元素的被设置的属性,所以创建Row组件,使其作为Image的父组件,设置背景颜色在Row上。 - - 在FoodListItem的Image组件上设置autoResize为false,因为image组件默认会根据最终展示的区域,去调整图源的大小,以优化图片渲染性能。在转场动画中,图片在放大的过程中会被重新加载,所以为了转场动画的流畅,autoResize设置为false。 - - ```ts - // FoodList.ets - import Curves from '@ohos.curves' - - @Component - struct FoodListItem { - private foodItem: FoodData - build() { - Navigator({ target: 'pages/FoodDetail' }) { - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { - Row() { - Image(this.foodItem.image) - .objectFit(ImageFit.Contain) - .autoResize(false) - .height(40) - .width(40) - .sharedTransition(this.foodItem.id, { duration: 1000, curve: Curves.cubicBezier(0.2, 0.2, 0.1, 1.0), delay: 100 }) - } - - .margin({ right: 16 }) - Text(this.foodItem.name) - .fontSize(14) - .flexGrow(1) - Text(this.foodItem.calories + ' kcal') - .fontSize(14) - } - .height(64) - } - .params({ foodData: this.foodItem }) - .margin({ right: 24, left:32 }) - } - } - - @Component - struct FoodGridItem { - private foodItem: FoodData - build() { - Column() { - Row() { - Image(this.foodItem.image) - .objectFit(ImageFit.Contain) - .autoResize(false) - .height(152) - .width('100%') - .sharedTransition(this.foodItem.id, { duration: 1000, curve: Curves.cubicBezier(0.2, 0.2, 0.1, 1.0), delay: 100 }) - } - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { - Text(this.foodItem.name) - .fontSize(14) - .flexGrow(1) - .padding({ left: 8 }) - Text(this.foodItem.calories + 'kcal') - .fontSize(14) - .margin({ right: 6 }) - } - .height(32) - .width('100%') - .backgroundColor('#FFe5e5e5') - } - .height(184) - .width('100%') - .onClick(() => { - router.pushUrl({ url: 'pages/FoodDetail', params: { foodData: this.foodItem } }) - }) - } - } - - - ``` - -2. 设置FoodDetail页面的FoodImageDisplay的Image组件的共享元素转场方法(sharedTransition)。设置方法同上。 - - ```ts - import Curves from '@ohos.curves' - - @Component - struct FoodImageDisplay { - private foodItem: FoodData - build() { - Stack({ alignContent: Alignment.BottomStart }) { - Image(this.foodItem.image) - .objectFit(ImageFit.Contain) - .sharedTransition(this.foodItem.id, { duration: 1000, curve: Curves.cubicBezier(0.2, 0.2, 0.1, 1.0), delay: 100 }) - Text(this.foodItem.name) - .fontSize(26) - .fontWeight(500) - .margin({ left: 26, bottom: 17.4 }) - } - .height(357) - } - } - ``` - - ![animation-feature1](figures/animation-feature1.gif) - - 通过对绘制组件和动画的学习,我们已完成了启动Logo的绘制、启动页动画和页面间的转场动画,声明式UI框架提供了丰富的动效接口,合理地应用和组合可以让应用更具有设计感。 - - diff --git a/zh-cn/application-dev/ui/ui-ts-building-category-grid-layout.md b/zh-cn/application-dev/ui/ui-ts-building-category-grid-layout.md deleted file mode 100644 index 8df2f7bd9c6d81a5fe9778a3cfeca9185e19f19c..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/ui/ui-ts-building-category-grid-layout.md +++ /dev/null @@ -1,371 +0,0 @@ -# 构建食物分类Grid布局 - -健康饮食应用在主页提供给用户两种食物显示方式:列表显示和网格显示。开发者将实现通过页签切换不同食物分类的网格布局。 - - -1. 将Category枚举类型引入FoodCategoryList页面。 - - ```ts - import { Category, FoodData } from '../model/FoodData' - ``` - -2. 创建FoodCategoryList和FoodCategory组件,其中FoodCategoryList作为新的页面入口组件,在入口组件调用initializeOnStartup方法。 - - ```ts - @Component - struct FoodList { - private foodItems: FoodData[] - build() { - ...... - } - } - - @Component - struct FoodCategory { - private foodItems: FoodData[] - build() { - ...... - } - } - - @Entry - @Component - struct FoodCategoryList { - private foodItems: FoodData[] = initializeOnStartup() - build() { - ...... - } - } - ``` - -3. 在FoodCategoryList组件内创建showList成员变量,用于控制List布局和Grid布局的渲染切换。需要用到条件渲染语句if...else...。 - - ```ts - @Entry - @Component - struct FoodCategoryList { - private foodItems: FoodData[] = initializeOnStartup() - private showList: boolean = false - - build() { - Stack() { - if (this.showList) { - FoodList({ foodItems: this.foodItems }) - } else { - FoodCategory({ foodItems: this.foodItems }) - } - } - } - } - ``` - -4. 在页面右上角创建切换List/Grid布局的图标。设置Stack对齐方式为顶部尾部对齐TopEnd,创建Image组件,设置其点击事件,即showList取反。 - - ```ts - @Entry - @Component - struct FoodCategoryList { - private foodItems: FoodData[] = initializeOnStartup() - private showList: boolean = false - - build() { - Stack({ alignContent: Alignment.TopEnd }) { - if (this.showList) { - FoodList({ foodItems: this.foodItems }) - } else { - FoodCategory({ foodItems: this.foodItems }) - } - Image($r('app.media.Switch')) - .height(24) - .width(24) - .margin({ top: 15, right: 10 }) - .onClick(() => { - this.showList = !this.showList - }) - }.height('100%') - } - } - ``` - -5. 添加@State装饰器。点击右上角的switch标签后,页面没有任何变化,这是因为showList不是有状态数据,它的改变不会触发页面的刷新。需要为其添加\@State装饰器,使其成为状态数据,它的改变会引起其所在组件的重新渲染。 - - ```ts - @Entry - @Component - struct FoodCategoryList { - private foodItems: FoodData[] = initializeOnStartup() - @State private showList: boolean = false - - build() { - Stack({ alignContent: Alignment.TopEnd }) { - if (this.showList) { - FoodList({ foodItems: this.foodItems }) - } else { - FoodCategory({ foodItems: this.foodItems }) - } - Image($r('app.media.Switch')) - .height(24) - .width(24) - .margin({ top: 15, right: 10 }) - .onClick(() => { - this.showList = !this.showList - }) - }.height('100%') - } - } - - ``` - - 点击切换图标,FoodList组件出现,再次点击,FoodList组件消失。 - - ![zh-cn_image_0000001170411978](figures/zh-cn_image_0000001170411978.gif) - -6. 创建显示所有食物的页签(All)。在FoodCategory组件内创建Tabs组件和其子组件TabContent,设置tabBar为All。设置TabBars的宽度为280,布局模式为Scrollable,即超过总长度后可以滑动。Tabs是一种可以通过页签进行内容视图切换的容器组件,每个页签对应一个内容视图TabContent。 - - ```ts - @Component - struct FoodCategory { - private foodItems: FoodData[] - build() { - Stack() { - Tabs() { - TabContent() {}.tabBar('All') - } - .barWidth(280) - .barMode(BarMode.Scrollable) - } - } - } - ``` - - ![zh-cn_image_0000001204538065](figures/zh-cn_image_0000001204538065.png) - -7. 创建FoodGrid组件,作为TabContent的子组件。 - - ```ts - @Component - struct FoodGrid { - private foodItems: FoodData[] - build() {} - } - - @Component - struct FoodCategory { - private foodItems: FoodData[] - build() { - Stack() { - Tabs() { - TabContent() { - FoodGrid({ foodItems: this.foodItems }) - }.tabBar('All') - } - .barWidth(280) - .barMode(BarMode.Scrollable) - } - } - } - ``` - -8. 实现2 \* 6的网格布局(一共12个食物数据资源)。创建Grid组件,设置列数columnsTemplate('1fr 1fr'),行数rowsTemplate('1fr 1fr 1fr 1fr 1fr 1fr'),行间距和列间距rowsGap和columnsGap为8。创建Scroll组件,使其可以滑动。 - - ```ts - @Component - struct FoodGrid { - private foodItems: FoodData[] - build() { - Scroll() { - Grid() { - ForEach(this.foodItems, (item: FoodData) => { - GridItem() {} - }, (item: FoodData) => item.id.toString()) - } - .rowsTemplate('1fr 1fr 1fr 1fr 1fr 1fr') - .columnsTemplate('1fr 1fr') - .columnsGap(8) - .rowsGap(8) - } - .scrollBar(BarState.Off) - .padding({left: 16, right: 16}) - } - } - ``` - -9. 创建FoodGridItem组件,展示食物图片、名称和卡路里,实现其UI布局,为GridItem的子组件。每个FoodGridItem高度为184,行间距为8,设置Grid总高度为(184 + 8) \* 6 - 8 = 1144。 - - ```ts - @Component - struct FoodGridItem { - private foodItem: FoodData - build() { - Column() { - Row() { - Image(this.foodItem.image) - .objectFit(ImageFit.Contain) - .height(152) - .width('100%') - } - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { - Text(this.foodItem.name) - .fontSize(14) - .flexGrow(1) - .padding({ left: 8 }) - Text(this.foodItem.calories + 'kcal') - .fontSize(14) - .margin({ right: 6 }) - } - .height(32) - .width('100%') - .backgroundColor('#FFe5e5e5') - } - .height(184) - .width('100%') - } - } - - @Component - struct FoodGrid { - private foodItems: FoodData[] - build() { - Scroll() { - Grid() { - ForEach(this.foodItems, (item: FoodData) => { - GridItem() { - FoodGridItem({foodItem: item}) - } - }, (item: FoodData) => item.id.toString()) - } - .rowsTemplate('1fr 1fr 1fr 1fr 1fr 1fr') - .columnsTemplate('1fr 1fr') - .columnsGap(8) - .rowsGap(8) - .height(1144) - } - .scrollBar(BarState.Off) - .padding({ left: 16, right: 16 }) - } - } - ``` - - ![zh-cn_image_0000001170167520](figures/zh-cn_image_0000001170167520.png) - -10. 创建展示蔬菜(Category.Vegetable)、水果(Category.Fruit)、坚果(Category.Nut)、海鲜(Category.SeaFood)和甜品(Category.Dessert)分类的页签。 - - ```ts - @Component - struct FoodCategory { - private foodItems: FoodData[] - - build() { - Stack() { - Tabs() { - TabContent() { - FoodGrid({ foodItems: this.foodItems }) - }.tabBar('All') - - TabContent() { - FoodGrid({ foodItems: this.foodItems.filter(item => (item.category === Category.Vegetable)) }) - }.tabBar('Vegetable') - - TabContent() { - FoodGrid({ foodItems: this.foodItems.filter(item => (item.category === Category.Fruit)) }) - }.tabBar('Fruit') - - TabContent() { - FoodGrid({ foodItems: this.foodItems.filter(item => (item.category === Category.Nut)) }) - }.tabBar('Nut') - - TabContent() { - FoodGrid({ foodItems: this.foodItems.filter(item => (item.category === Category.Seafood)) }) - }.tabBar('Seafood') - - TabContent() { - FoodGrid({ foodItems: this.foodItems.filter(item => (item.category === Category.Dessert)) }) - }.tabBar('Dessert') - } - .barWidth(280) - .barMode(BarMode.Scrollable) - } - } - } - ``` - -11. 设置不同食物分类的Grid的行数和高度。因为不同分类的食物数量不同,所以不能用'1fr 1fr 1fr 1fr 1fr 1fr '常量来统一设置成6行。 - 创建gridRowTemplate和HeightValue成员变量,通过成员变量设置Grid行数和高度。 - - ```ts - @Component - struct FoodGrid { - private foodItems: FoodData[] - private gridRowTemplate: string = '' - private heightValue: number - - build() { - Scroll() { - Grid() { - ForEach(this.foodItems, (item: FoodData) => { - GridItem() { - FoodGridItem({ foodItem: item }) - } - }, (item: FoodData) => item.id.toString()) - } - .rowsTemplate(this.gridRowTemplate) - .columnsTemplate('1fr 1fr') - .columnsGap(8) - .rowsGap(8) - .height(this.heightValue) - } - .scrollBar(BarState.Off) - .padding({ left: 16, right: 16 }) - } - } - ``` - - 调用aboutToAppear接口计算行数(gridRowTemplate )和高度(heightValue)。 - - ```ts - aboutToAppear() { - var rows = Math.round(this.foodItems.length / 2); - this.gridRowTemplate = '1fr '.repeat(rows); - this.heightValue = rows * 192 - 8; - } - ``` - - 自定义组件提供了两个生命周期的回调接口aboutToAppear和aboutToDisappear。aboutToAppear的执行时机在创建自定义组件后,执行自定义组件build方法之前。aboutToDisappear在自定义组件销毁之前的时机执行。 - - ![zh-cn_image_0000001215113569](figures/zh-cn_image_0000001215113569.png) - - ```ts - @Component - struct FoodGrid { - private foodItems: FoodData[] - private gridRowTemplate: string = '' - private heightValue: number - - aboutToAppear() { - var rows = Math.round(this.foodItems.length / 2); - this.gridRowTemplate = '1fr '.repeat(rows); - this.heightValue = rows * 192 - 8; - } - - build() { - Scroll() { - Grid() { - ForEach(this.foodItems, (item: FoodData) => { - GridItem() { - FoodGridItem({ foodItem: item }) - } - }, (item: FoodData) => item.id.toString()) - } - .rowsTemplate(this.gridRowTemplate) - .columnsTemplate('1fr 1fr') - .columnsGap(8) - .rowsGap(8) - .height(this.heightValue) - } - .scrollBar(BarState.Off) - .padding({ left: 16, right: 16 }) - } - } - ``` - - ![zh-cn_image_0000001170008198](figures/zh-cn_image_0000001170008198.gif) \ No newline at end of file diff --git a/zh-cn/application-dev/ui/ui-ts-building-category-list-layout.md b/zh-cn/application-dev/ui/ui-ts-building-category-list-layout.md deleted file mode 100644 index 24516e9220bbf5015abff68f1306507ec5e6ded6..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/ui/ui-ts-building-category-list-layout.md +++ /dev/null @@ -1,232 +0,0 @@ -# 构建食物列表List布局 - -使用List组件和ForEach循环渲染,构建食物列表布局。 - - -1. 在pages目录新建页面FoodCategoryList.ets,将index.ets改名为FoodDetail.ets。 - -2. 新建FoodList组件作为页面入口组件,FoodListItem为其子组件。List组件是列表组件,适用于重复同类数据的展示,其子组件为ListItem,适用于展示列表中的单元。 - ```ts - @Component - struct FoodListItem { - build() {} - } - - @Entry - @Component - struct FoodList { - build() { - List() { - ListItem() { - FoodListItem() - } - } - } - } - ``` - -3. 引入FoodData类和initializeOnStartup方法。 - -应用代码中文件访问方法主要有下面两种: -- **相对路径**:使用相对路径引用代码文件,以"../"访问上一级目录,以"./"访问当前目录,也可以省略不写。 -- **绝对路径**:使用当前模块根路径引用代码文件,比如:common/utils/utils。 -这里使用相对路径访问: - - ``` - import { FoodData } from '../model/FoodData' - import { initializeOnStartup } from '../model/FoodDataModels' - ``` - -4. FoodList和FoodListItem组件数值传递。在FoodList组件内创建类型为FoodData[]成员变量foodItems,调用initializeOnStartup方法为其赋值。在FoodListItem组件内创建类型为FoodData的成员变量foodItem。将父组件foodItems数组的第一个元素的foodItems[0]作为参数传递给FoodListItem。 - ```ts - import { FoodData } from '../model/FoodData' - import { initializeOnStartup } from '../model/FoodDataModels' - - @Component - struct FoodListItem { - private foodItem: FoodData - build() {} - } - - @Entry - @Component - struct FoodList { - private foodItems: FoodData[] = initializeOnStartup() - build() { - List() { - ListItem() { - FoodListItem({ foodItem: this.foodItems[0] }) - } - } - } - } - ``` - -5. 声明子组件FoodListItem 的UI布局。创建Flex组件,包含食物图片缩略图,食物名称,和食物对应的卡路里。 - ```ts - import { FoodData } from '../model/FoodData' - import { initializeOnStartup } from '../model/FoodDataModels' - - @Component - struct FoodListItem { - private foodItem: FoodData - build() { - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { - Image(this.foodItem.image) - .objectFit(ImageFit.Contain) - .height(40) - .width(40) - .margin({ right: 16 }) - Text(this.foodItem.name) - .fontSize(14) - .flexGrow(1) - Text(this.foodItem.calories + ' kcal') - .fontSize(14) - } - .height(64) - .margin({ right: 24, left:32 }) - } - } - - @Entry - @Component - struct FoodList { - private foodItems: FoodData[] = initializeOnStartup() - build() { - List() { - ListItem() { - FoodListItem({ foodItem: this.foodItems[0] }) - } - } - } - } - ``` - - - ![zh-cn_image_0000001204776353](figures/zh-cn_image_0000001204776353.png) - -6. 创建两个FoodListItem。在List组件创建两个FoodListItem,分别给FoodListItem传递foodItems数组的第一个元素this.foodItems[0]和第二个元素foodItem: this.foodItems[1]。 - - ```ts - import { FoodData } from '../model/FoodData' - import { initializeOnStartup } from '../model/FoodDataModels' - - @Component - struct FoodListItem { - private foodItem: FoodData - - build() { - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { - Image(this.foodItem.image) - .objectFit(ImageFit.Contain) - .height(40) - .width(40) - .margin({ right: 16 }) - Text(this.foodItem.name) - .fontSize(14) - .flexGrow(1) - Text(this.foodItem.calories + ' kcal') - .fontSize(14) - } - .height(64) - .margin({ right: 24, left: 32 }) - } - } - - @Entry - @Component - struct FoodList { - private foodItems: FoodData[] = initializeOnStartup() - - build() { - List() { - ListItem() { - FoodListItem({ foodItem: this.foodItems[0] }) - } - - ListItem() { - FoodListItem({ foodItem: this.foodItems[1] }) - } - } - } - } - ``` - - - ![zh-cn_image1_0000001204776353](figures/zh-cn_image1_0000001204776353.png) - -7. 单独创建每一个FoodListItem肯定是不合理的,这就需要引入[ForEach循环渲染](../quick-start/arkts-rendering-control.md#循环渲染)。 - - ```ts - import { FoodData } from '../model/FoodData' - import { initializeOnStartup } from '../model/FoodDataModels' - - @Component - struct FoodListItem { - private foodItem: FoodData - build() { - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { - Image(this.foodItem.image) - .objectFit(ImageFit.Contain) - .height(40) - .width(40) - .margin({ right: 16 }) - Text(this.foodItem.name) - .fontSize(14) - .flexGrow(1) - Text(this.foodItem.calories + ' kcal') - .fontSize(14) - } - .height(64) - .margin({ right: 24, left:32 }) - } - } - - @Entry - @Component - struct FoodList { - private foodItems: FoodData[] = initializeOnStartup() - build() { - List() { - ForEach(this.foodItems, item => { - ListItem() { - FoodListItem({ foodItem: item }) - } - }, item => item.id.toString()) - } - } - } - ``` - -8. 添加FoodList标题。 - - ``` - @Entry - @Component - struct FoodList { - private foodItems: FoodData[] = initializeOnStartup() - - build() { - Column() { - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { - Text('Food List') - .fontSize(20) - .margin({ left: 20 }) - } - .height('7%') - .backgroundColor('#FFf1f3f5') - - List() { - ForEach(this.foodItems, item => { - ListItem() { - FoodListItem({ foodItem: item }) - } - }, item => item.id.toString()) - } - .height('93%') - } - } - } - ``` - - ![zh-cn_image_0000001169678922](figures/zh-cn_image_0000001169678922.png) \ No newline at end of file diff --git a/zh-cn/application-dev/ui/ui-ts-building-data-model.md b/zh-cn/application-dev/ui/ui-ts-building-data-model.md deleted file mode 100644 index c2fe6aa7c739a19db3a450a17f055150cf5d28b9..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/ui/ui-ts-building-data-model.md +++ /dev/null @@ -1,90 +0,0 @@ -# 构建食物数据模型 - -在创建视图中,我们逐一去表述食物的各个信息,如食物名称、卡路里、蛋白质、脂肪、碳水和维生素C。这样的编码形式在实际的开发中肯定是不切实际的,所以要创建食物数据模型来统一存储和管理数据。 - - -![zh-cn_image_0000001215433095](figures/zh-cn_image_0000001215433095.png) - - -1. 新建model文件夹,在model目录下创建FoodData.ets。 - - ![zh-cn_image_0000001195119619](figures/zh-cn_image_0000001195119619.png) - -2. 定义食物数据的存储模型FoodData和枚举变量Category,FoodData类包含食物id、名称(name)、分类(category)、图片(image)、热量(calories)、蛋白质(protein)、脂肪(fat)、碳水(carbohydrates)和维生素C(vitaminC)属性。 - ArkTS语言是在ts语言的基础上的扩展,同样支持ts语法。 - - ```ts - enum Category { - Fruit, - Vegetable, - Nut, - Seafood, - Dessert - } - - let NextId = 0; - class FoodData { - id: string; - name: string; - image: Resource; - category: Category; - calories: number; - protein: number; - fat: number; - carbohydrates: number; - vitaminC: number; - - constructor(name: string, image: Resource, category: Category, calories: number, protein: number, fat: number, carbohydrates: number, vitaminC: number) { - this.id = `${ NextId++ }`; - this.name = name; - this.image = image; - this.category = category; - this.calories = calories; - this.protein = protein; - this.fat = fat; - this.carbohydrates = carbohydrates; - this.vitaminC = vitaminC; - } - } - ``` - -3. 存入食物图片资源。在resources >base> media目录下存入食物图片资源,图片名称为食物名称。 - -4. 创建食物资源数据。在model文件夹下创建FoodDataModels.ets,在该页面中声明食物成分数组FoodComposition。以下示例创建了两个食物数据。 - - ```ts - const FoodComposition: any[] = [ - { 'name': 'Tomato', 'image': $r('app.media.Tomato'), 'category': Category.Vegetable, 'calories': 17, 'protein': 0.9, 'fat': 0.2, 'carbohydrates': 3.9, 'vitaminC': 17.8 }, - { 'name': 'Walnut', 'image': $r('app.media.Walnut'), 'category': Category.Nut, 'calories': 654 , 'protein': 15, 'fat': 65, 'carbohydrates': 14, 'vitaminC': 1.3 } - ] - ``` - - 实际开发中,开发者可以自定义更多的数据资源,当食物资源很多时,建议使用[数据懒加载LazyForEach](../quick-start/arkts-rendering-control.md#数据懒加载)。 - -5. 创建initializeOnStartUp方法来初始化FoodData的数组。在FoodDataModels.ets中使用了定义在FoodData.ets的FoodData和Category,所以要将FoodData.ets的FoodData类export,在FoodDataModels.ets内import FoodData和Category。 - ```ts - // FoodData.ets - export enum Category { - ...... - } - export class FoodData { - ...... - } - // FoodDataModels.ets - import { Category, FoodData } from './FoodData' - - export function initializeOnStartup(): Array { - let FoodDataArray: Array = [] - FoodComposition.forEach(item => { - FoodDataArray.push(new FoodData(item.name, item.image, item.category, item.calories, item.protein, item.fat, item.carbohydrates, item.vitaminC )); - }) - return FoodDataArray; - } - ``` - - -已完成好健康饮食应用的数据资源准备,接下来将通过加载这些数据来创建食物列表页面。 - -## 相关实例 -针对构建食物分类列表页面和食物详情页,有以下相关实例可供参考: -- [DefiningPageLayoutAndConnection:页面布局和连接(ArkTS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/DefiningPageLayoutAndConnection) diff --git a/zh-cn/application-dev/ui/ui-ts-components-intro.md b/zh-cn/application-dev/ui/ui-ts-components-intro.md deleted file mode 100644 index 5994b890582b097ae73d3cc706b8cb0a8878f4c2..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/ui/ui-ts-components-intro.md +++ /dev/null @@ -1,36 +0,0 @@ -# 常用组件说明 - -组件是构建页面的核心,每个组件通过对数据和方法的简单封装,实现独立的可视、可交互功能单元。组件之间相互独立,随取随用,也可以在需求相同的地方重复使用。 - -声明式开发范式目前可供选择的组件如下表所示。 - -| 组件类型 | 主要组件 | -| ---------------------------- | ---------------------------------------------------------- | -| [基础组件](../reference/arkui-ts/ts-basic-components-blank.md) | Blank、Button、Checkbox、CheckboxGroup、DataPanel、DatePicker、Divider、Gauge、Image、ImageAnimator、LoadingProgress、Marquee、Navigation、PatternLock、PluginComponent、Progress、QRCode、Radio、Rating、RemoteWindow、RichText、ScrollBar、Search、Select、Slider、Span、Stepper、StepperItem、Text、TextArea、TextClock、TextInput、TextPicker、TextTimer、TimePicker、Toggle、Web、XComponent | -| [容器组件](../reference/arkui-ts/ts-container-ability-component.md) | AbilityComponent、AlphabetIndexer、Badge、Column、ColumnSplit、Counter、Flex、FlowItem、GridContainer、GridCol、GridRow、Grid、GridItem、List、ListItem、ListItemGroup、Navigator、Panel、Refresh、RelativeContainer、Row、RowSplit、Scroll、SideBarContainer、Stack、Swiper、Tabs、TabContent、WaterFlow | -| [媒体组件](../reference/arkui-ts/ts-media-components-video.md) | Video | -| [绘制组件](../reference/arkui-ts/ts-drawing-components-circle.md) | Circle、Ellipse、Line、Polyline、Polygon、Path、Rect、Shape | -| [画布组件](../reference/arkui-ts/ts-components-canvas-canvas.md) | Canvas | - - -## 相关实例 - -基于ArkTS的常用组件开发,有以下相关实例可供参考: - -- [`ComponentCollection`:组件集合(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/UI/ArkTsComponentClollection/ComponentCollection) - -- [`OrangeShopping`:购物示例应用(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/Solutions/Shopping/OrangeShopping) - -- [`Canvas`:画布组件(ArkTS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/Canvas) - -- [`ArkTSClock`:简单时钟(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/Solutions/Tools/ArkTSClock) - -- [`PatternLock`:图案密码锁组件(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/Solutions/Tools/PatternLock) - -- [`Search`:Search组件(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/Search) - -- [`Gallery`:组件集合(ArkTS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/Gallery) - -- [List组件的使用之商品列表(ArkTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/List_HDC) - -- [List组件的使用之设置项(ArkTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/List_HDC) \ 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 deleted file mode 100644 index a23282f45dd6564051bcd1043cd0c578fda415b2..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/ui/ui-ts-components-web.md +++ /dev/null @@ -1,273 +0,0 @@ -# Web - -Web是提供网页显示能力的组件,具体用法请参考 [Web API](../reference/arkui-ts/ts-basic-components-web.md)。 - -## 创建组件 - -在main/ets/entryability/pages目录下的ets文件中创建一个Web组件。在web组件中通过src指定引用的网页路径,controller为组件的控制器,通过controller绑定Web组件,用于调用Web组件的方法。 - - ```ts - // xxx.ets - import web_webview from '@ohos.web.webview'; - - @Entry - @Component - struct WebComponent { - controller: web_webview.WebviewController = new web_webview.WebviewController(); - build() { - Column() { - Web({ src: 'https://www.example.com', controller: this.controller }) - } - } - } - ``` - -## 设置样式和属性 - -Web组件的使用需要添加丰富的页面样式和功能属性。设置height、padding样式可为Web组件添加高和内边距,设置fileAccess属性可为Web组件添加文件访问权限,设置javaScriptAccess属性为true使Web组件具有执行JavaScript代码的能力。 - -```ts -// xxx.ets -import web_webview from '@ohos.web.webview'; - -@Entry -@Component -struct WebComponent { - fileAccess: boolean = true; - controller: web_webview.WebviewController = new web_webview.WebviewController(); - build() { - Column() { - Text('Hello world!') - .fontSize(20) - Web({ src: 'https://www.example.com', controller: this.controller }) - // 设置高和内边距 - .height(500) - .padding(20) - // 设置文件访问权限和脚本执行权限 - .fileAccess(this.fileAccess) - .javaScriptAccess(true) - Text('End') - .fontSize(20) - } - } -} -``` -## 添加事件和方法 - -为Web组件添加onProgressChange事件,该事件回调Web引擎加载页面的进度值。将该进度值赋值给Progress组件的value,控制Progress组件的状态。当进度为100%时隐藏Progress组件,Web页面加载完成。 - -```ts -// xxx.ets -import web_webview from '@ohos.web.webview'; - -@Entry -@Component -struct WebComponent { - @State progress: number = 0; - @State hideProgress: boolean = true; - fileAccess: boolean = true; - controller: web_webview.WebviewController = new web_webview.WebviewController(); - build() { - Column() { - Text('Hello world!') - .fontSize(20) - Progress({value: this.progress, total: 100}) - .color('#0000ff') - .visibility(this.hideProgress ? Visibility.None : Visibility.Visible) - Web({ src: 'https://www.example.com', controller: this.controller }) - .fileAccess(this.fileAccess) - .javaScriptAccess(true) - .height(500) - .padding(20) - // 添加onProgressChange事件 - .onProgressChange(e => { - this.progress = e.newProgress; - // 当进度100%时,进度条消失 - if (this.progress === 100) { - this.hideProgress = true; - } else { - this.hideProgress = false; - } - }) - Text('End') - .fontSize(20) - } - } -} -``` -在onPageEnd事件中添加runJavaScript方法。onPageEnd事件是网页加载完成时的回调,runJavaScript方法可以执行HTML中的JavaScript脚本。当页面加载完成时,触发onPageEnd事件,调用HTML文件中的test方法,在控制台打印信息。 - -```ts -// xxx.ets -import web_webview from '@ohos.web.webview'; - -@Entry -@Component -struct WebComponent { - @State progress: number = 0; - @State hideProgress: boolean = true; - @State webResult: string = '' - fileAccess: boolean = true; - // 定义Web组件的控制器controller - controller: web_webview.WebviewController = new web_webview.WebviewController(); - build() { - Column() { - Text('Hello world!') - .fontSize(20) - Progress({value: this.progress, total: 100}) - .color('#0000ff') - .visibility(this.hideProgress ? Visibility.None : Visibility.Visible) - // 初始化Web组件,并绑定controller - Web({ src: $rawfile('index.html'), controller: this.controller }) - .fileAccess(this.fileAccess) - .javaScriptAccess(true) - .height(500) - .padding(20) - .onProgressChange(e => { - this.progress = e.newProgress; - if (this.progress === 100) { - this.hideProgress = true; - } else { - this.hideProgress = false; - } - }) - .onPageEnd(e => { - // test()在index.html中定义 - try { - this.controller.runJavaScript( - 'test()', - (error, result) => { - if (error) { - console.info(`run JavaScript error: ` + JSON.stringify(error)) - return; - } - if (result) { - this.webResult = result - console.info(`The test() return value is: ${result}`) - } - }); - console.info('url: ', e.url); - } catch (error) { - console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); - } - }) - Text('End') - .fontSize(20) - } - } -} -``` - -在main/resources/rawfile目录下创建一个HTML文件。 - -```html - - - - - - Hello world! - - - -``` - -## 开启网页调试 -在PC上启用端口转发,以及设置Web组件属性webDebuggingAccess为true后,便可以在PC上调试通过USB连接的开发设备上的Web组件里的网页。 - -设置步骤如下: - -1、首先设置Web组件属性webDebuggingAccess为true。 - ```ts - // xxx.ets - import web_webview from '@ohos.web.webview'; - - @Entry - @Component - struct WebComponent { - controller: web_webview.WebviewController = new web_webview.WebviewController(); - build() { - Column() { - Web({ src: 'www.example.com', controller: this.controller }) - .webDebuggingAccess(true) // true表示启用调试功能 - } - } - } - ``` - -2、PC上启用端口转发功能,添加TCP端口9222映射。 - ```ts - hdc fport tcp:9222 tcp:9222 - ``` - 添加是否成功可以通过如下命令来查看已存在的映射关系表。 - ```ts - hdc fport ls - ``` -如上设置完成后,首先打开应用Web组件、访问要调试的网页,然后在PC上使用chrome浏览器访问:http://localhost:9222, 就可以在PC上调试开发设备刚才访问的网页。 - -## 场景示例 - -该场景实现了Web组件中视频的动态播放。首先在HTML页面内嵌入视频资源,再使用Web组件的控制器调用onActive和onInactive方法激活和暂停页面渲染。点击onInactive按钮,Web页面停止渲染,视频暂停播放;点击onActive按钮,激活Web组件,视频继续播放。 - - ```ts - // xxx.ets -import web_webview from '@ohos.web.webview'; - -@Entry -@Component -struct WebComponent { - controller: web_webview.WebviewController = new web_webview.WebviewController(); - build() { - Column() { - Row() { - Button('onActive').onClick(() => { - console.info("Web Component onActive"); - try { - this.controller.onActive(); - } catch (error) { - console.error(`Errorcode: ${error.code}, Message: ${error.message}`); - } - }) - Button('onInactive').onClick(() => { - console.info("Web Component onInactive"); - try { - this.controller.onInactive(); - } catch (error) { - console.error(`Errorcode: ${error.code}, Message: ${error.message}`); - } - }) - } - Web({ src: $rawfile('index.html'), controller: this.controller }) - .fileAccess(true) - } - } -} - ``` - - ```html - - - - - - - - - ``` - -## 相关实例 - -针对Web开发,有以下相关实例可供参考: - -- [`Browser`:浏览器(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Web/Browser) - -- [Web组件的使用(ArkTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/WebCookie) - -- [Web组件抽奖案例(ArkTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/WebComponent) 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 deleted file mode 100644 index 9d97b81f9cdf635bdf9abd14c6389c6fbd3f1b99..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/ui/ui-ts-creating-simple-page.md +++ /dev/null @@ -1,519 +0,0 @@ -# 创建简单视图 - -在这一小节中,我们将开始食物详情页的开发,学习如何通过容器组件Stack、Flex和基础组件Image、Text,构建用户自定义组件,完成图文并茂的食物介绍。 - -在创建页面前,请先创建ArkTS工程,Stage模型请参考[创建Stage模型的ArkTS工程](../quick-start/start-with-ets-stage.md#创建arkts工程),FA模型请参考[创建FA模型的ArkTS工程](../quick-start/start-with-ets-fa.md#创建arkts工程)。 - - -## 构建Stack布局 - -1. 创建食物名称。 - - 在index.ets文件中,创建Stack组件,将Text组件放进Stack组件的花括号中,使其成为Stack组件的子组件。Stack组件为堆叠组件,可以包含一个或多个子组件,其特点是后一个子组件覆盖前一个子组件。 - - ```ts - @Entry - @Component - struct MyComponent { - build() { - Stack() { - Text('Tomato') - .fontSize(26) - .fontWeight(500) - } - } - } - ``` - - ![zh-cn_image_0000001214128687](figures/zh-cn_image_0000001214128687.png) - -2. 食物图片展示。 - 创建Image组件,指定Image组件的url,Image组件是必选构造参数组件。为了让Text组件在Image组件上方显示,所以要先声明Image组件。图片资源放在resources下的rawfile文件夹内,引用rawfile下资源时使用`$rawfile('filename')`的形式,filename为rawfile目录下的文件相对路径。当前`$rawfile`仅支持Image控件引用图片资源。 - - ```ts - @Entry - @Component - struct MyComponent { - build() { - Stack() { - Image($rawfile('Tomato.png')) - Text('Tomato') - .fontSize(26) - .fontWeight(500) - } - } - } - ``` - - - ![zh-cn_image_0000001168410342](figures/zh-cn_image_0000001168410342.png) - -3. 通过资源访问图片。 - 除指定图片路径外,也可以使用引用媒体资源符$r引用资源,需要遵循resources文件夹的资源限定词的规则。右键resources文件夹,点击New>Resource Directory,选择Resource Type为Media(图片资源)。 - - 将Tomato.png放入media文件夹内。就可以通过`$r('app.type.name')`的形式引用应用资源,即`$r('app.media.Tomato')`。 - - ```ts - @Entry - @Component - struct MyComponent { - build() { - Stack() { - Image($r('app.media.Tomato')) - .objectFit(ImageFit.Contain) - .height(357) - Text('Tomato') - .fontSize(26) - .fontWeight(500) - } - } - } - ``` - -4. 设置Image宽高,并且将image的objectFit属性设置为ImageFit.Contain,即保持图片长宽比的情况下,使得图片完整地显示在边界内。 - 如果Image填满了整个屏幕,原因如下: - 1. Image没有设置宽高。 - - 2. Image的objectFit默认属性是ImageFit.Cover,即在保持长宽比的情况下放大或缩小,使其填满整个显示边界。 - - ```ts - @Entry - @Component - struct MyComponent { - build() { - Stack() { - Image($r('app.media.Tomato')) - .objectFit(ImageFit.Contain) - .height(357) - Text('Tomato') - .fontSize(26) - .fontWeight(500) - } - } - } - ``` - - ![zh-cn_image_0000001214210217](figures/zh-cn_image_0000001214210217.png) - -5. 设置食物图片和名称布局。设置Stack的对齐方式为底部起始端对齐,Stack默认为居中对齐。设置Stack构造参数alignContent为Alignment.BottomStart。其中Alignment和FontWeight一样,都是框架提供的内置枚举类型。 - - ```ts - @Entry - @Component - struct MyComponent { - build() { - Stack({ alignContent: Alignment.BottomStart }) { - Image($r('app.media.Tomato')) - .objectFit(ImageFit.Contain) - .height(357) - Text('Tomato') - .fontSize(26) - .fontWeight(500) - } - } - } - ``` - - ![zh-cn_image_0000001168728872](figures/zh-cn_image_0000001168728872.png) - -6. 调整Text组件的外边距margin,使其距离左侧和底部有一定的距离。margin是简写属性,可以统一指定四个边的外边距,也可以分别指定。具体设置方式如下: - - 1. 参数为Length时,即统一指定四个边的外边距,比如margin(20),即上、右、下、左四个边的外边距都是20。 - 2. 参数为{top?: Length, right?: Length, bottom?: Length, left?:Length},即分别指定四个边的边距,比如margin({ left: 26, bottom: 17.4 }),即左边距为26,下边距为17.4。 - - ```ts - @Entry - @Component - struct MyComponent { - build() { - Stack({ alignContent: Alignment.BottomStart }) { - Image($r('app.media.Tomato')) - .objectFit(ImageFit.Contain) - .height(357) - Text('Tomato') - .fontSize(26) - .fontWeight(500) - .margin({left: 26, bottom: 17.4}) - } - } - } - ``` - - ![zh-cn_image_0000001213968747](figures/zh-cn_image_0000001213968747.png) - -7. 调整组件间的结构,语义化组件名称。创建页面入口组件为FoodDetail,在FoodDetail中创建Column,设置水平方向上居中对齐 alignItems(HorizontalAlign.Center)。MyComponent组件名改为FoodImageDisplay,为FoodDetail的子组件。 - - Column是子组件竖直排列的容器组件,本质为线性布局,所以只能设置交叉轴方向的对齐。 - - ```ts - @Component - struct FoodImageDisplay { - build() { - Stack({ alignContent: Alignment.BottomStart }) { - Image($r('app.media.Tomato')) - .objectFit(ImageFit.Contain) - Text('Tomato') - .fontSize(26) - .fontWeight(500) - .margin({ left: 26, bottom: 17.4 }) - } - .height(357) - } - } - - @Entry - @Component - struct FoodDetail { - build() { - Column() { - FoodImageDisplay() - } - .alignItems(HorizontalAlign.Center) - } - } - ``` - -## 构建Flex布局 - -开发者可以使用Flex弹性布局来构建食物的食物成分表,弹性布局在本场景的优势在于可以免去多余的宽高计算,通过比例来设置不同单元格的大小,更加灵活。 - -1. 创建ContentTable组件,使其成为页面入口组件FoodDetail的子组件。 - - ```ts - @Component - struct FoodImageDisplay { - build() { - Stack({ alignContent: Alignment.BottomStart }) { - Image($r('app.media.Tomato')) - .objectFit(ImageFit.Contain) - .height(357) - Text('Tomato') - .fontSize(26) - .fontWeight(500) - .margin({ left: 26, bottom: 17.4 }) - } - } - } - - @Component - struct ContentTable { - build() { - } - } - - @Entry - @Component - struct FoodDetail { - build() { - Column() { - FoodImageDisplay() - ContentTable() - } - .alignItems(HorizontalAlign.Center) - } - } - ``` - -2. 创建Flex组件展示Tomato两类成分。 - 一类是热量Calories,包含卡路里(Calories);一类是营养成分Nutrition,包含蛋白质(Protein)、脂肪(Fat)、碳水化合物(Carbohydrates)和维生素C(VitaminC)。 - - 先创建热量这一类。创建Flex组件,高度为280,上、右、左内边距为30,包含三个Text子组件分别代表类别名(Calories),含量名称(Calories)和含量数值(17kcal)。Flex组件默认为水平排列方式。 - - 已省略FoodImageDisplay代码,只针对ContentTable进行扩展。 - - ```ts - @Component - struct ContentTable { - build() { - Flex() { - Text('Calories') - .fontSize(17.4) - .fontWeight(FontWeight.Bold) - Text('Calories') - .fontSize(17.4) - Text('17kcal') - .fontSize(17.4) - } - .height(280) - .padding({ top: 30, right: 30, left: 30 }) - } - } - - @Entry - @Component - struct FoodDetail { - build() { - Column() { - FoodImageDisplay() - ContentTable() - } - .alignItems(HorizontalAlign.Center) - } - } - ``` - - - ![zh-cn_image_0000001169759552](figures/zh-cn_image_0000001169759552.png) - -3. 调整布局,设置各部分占比。分类名占比(layoutWeight)为1,成分名和成分含量一共占比(layoutWeight)2。成分名和成分含量位于同一个Flex中,成分名占据所有剩余空间flexGrow(1)。 - - ```ts - @Component - struct FoodImageDisplay { - build() { - Stack({ alignContent: Alignment.BottomStart }) { - Image($r('app.media.Tomato')) - .objectFit(ImageFit.Contain) - .height(357) - Text('Tomato') - .fontSize(26) - .fontWeight(500) - .margin({ left: 26, bottom: 17.4 }) - } - } - } - - @Component - struct ContentTable { - build() { - Flex() { - Text('Calories') - .fontSize(17.4) - .fontWeight(FontWeight.Bold) - .layoutWeight(1) - Flex() { - Text('Calories') - .fontSize(17.4) - .flexGrow(1) - Text('17kcal') - .fontSize(17.4) - } - .layoutWeight(2) - } - .height(280) - .padding({ top: 30, right: 30, left: 30 }) - } - } - - @Entry - @Component - struct FoodDetail { - build() { - Column() { - FoodImageDisplay() - ContentTable() - } - .alignItems(HorizontalAlign.Center) - } - } - ``` - - ![zh-cn_image_0000001215079443](figures/zh-cn_image_0000001215079443.png) - -4. 仿照热量分类创建营养成分分类。营养成分部分(Nutrition)包含:蛋白质(Protein)、脂肪(Fat)、碳水化合物(Carbohydrates)和维生素C(VitaminC)四个成分,后三个成分在表格中省略分类名,用空格代替。 - 设置外层Flex为竖直排列FlexDirection.Column, 在主轴方向(竖直方向)上等距排列FlexAlign.SpaceBetween,在交叉轴方向(水平轴方向)上首部对齐排列ItemAlign.Start。 - - ```ts - @Component - struct ContentTable { - build() { - Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Start }) { - Flex() { - Text('Calories') - .fontSize(17.4) - .fontWeight(FontWeight.Bold) - .layoutWeight(1) - Flex() { - Text('Calories') - .fontSize(17.4) - .flexGrow(1) - Text('17kcal') - .fontSize(17.4) - } - .layoutWeight(2) - } - Flex() { - Text('Nutrition') - .fontSize(17.4) - .fontWeight(FontWeight.Bold) - .layoutWeight(1) - Flex() { - Text('Protein') - .fontSize(17.4) - .flexGrow(1) - Text('0.9g') - .fontSize(17.4) - } - .layoutWeight(2) - } - Flex() { - Text(' ') - .fontSize(17.4) - .fontWeight(FontWeight.Bold) - .layoutWeight(1) - Flex() { - Text('Fat') - .fontSize(17.4) - .flexGrow(1) - Text('0.2g') - .fontSize(17.4) - } - .layoutWeight(2) - } - Flex() { - Text(' ') - .fontSize(17.4) - .fontWeight(FontWeight.Bold) - .layoutWeight(1) - Flex() { - Text('Carbohydrates') - .fontSize(17.4) - .flexGrow(1) - Text('3.9g') - .fontSize(17.4) - } - .layoutWeight(2) - } - Flex() { - Text(' ') - .fontSize(17.4) - .fontWeight(FontWeight.Bold) - .layoutWeight(1) - Flex() { - Text('vitaminC') - .fontSize(17.4) - .flexGrow(1) - Text('17.8mg') - .fontSize(17.4) - } - .layoutWeight(2) - } - } - .height(280) - .padding({ top: 30, right: 30, left: 30 }) - } - } - - @Entry - @Component - struct FoodDetail { - build() { - Column() { - FoodImageDisplay() - ContentTable() - } - .alignItems(HorizontalAlign.Center) - } - } - ``` - - ![zh-cn_image_0000001215199399](figures/zh-cn_image_0000001215199399.png) - -5. 使用自定义构造函数\@Builder简化代码。可以发现,每个成分表中的成分单元其实都是一样的UI结构。 - ![zh-cn_image_0000001169599582](figures/zh-cn_image_0000001169599582.png) - - 当前对每个成分单元都进行了声明,造成了代码的重复和冗余。可以使用\@Builder来构建自定义方法,抽象出相同的UI结构声明。\@Builder修饰的方法和Component的build方法都是为了声明一些UI渲染结构,遵循一样的ArkTS语法。开发者可以定义一个或者多个\@Builder修饰的方法,但Component的build方法必须只有一个。 - - 在ContentTable内声明\@Builder修饰的IngredientItem方法,用于声明分类名、成分名称和成分含量UI描述。 - - ```ts - @Component - struct ContentTable { - @Builder IngredientItem(title:string, name: string, value: string) { - Flex() { - Text(title) - .fontSize(17.4) - .fontWeight(FontWeight.Bold) - .layoutWeight(1) - Flex({ alignItems: ItemAlign.Center }) { - Text(name) - .fontSize(17.4) - .flexGrow(1) - Text(value) - .fontSize(17.4) - } - .layoutWeight(2) - } - } - } - ``` - - 在ContentTable的build方法内调用IngredientItem接口,需要用this去调用该Component作用域内的方法,以此来区分全局的方法调用。 - - ```ts - @Component - struct ContentTable { - ...... - build() { - Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Start }) { - this.IngredientItem('Calories', 'Calories', '17kcal') - this.IngredientItem('Nutrition', 'Protein', '0.9g') - this.IngredientItem('', 'Fat', '0.2g') - this.IngredientItem('', 'Carbohydrates', '3.9g') - this.IngredientItem('', 'VitaminC', '17.8mg') - } - .height(280) - .padding({ top: 30, right: 30, left: 30 }) - } - } - ``` - - ContentTable组件整体代码如下。 - - ```ts - @Component - struct ContentTable { - @Builder IngredientItem(title:string, name: string, value: string) { - Flex() { - Text(title) - .fontSize(17.4) - .fontWeight(FontWeight.Bold) - .layoutWeight(1) - Flex() { - Text(name) - .fontSize(17.4) - .flexGrow(1) - Text(value) - .fontSize(17.4) - } - .layoutWeight(2) - } - } - - build() { - Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Start }) { - this.IngredientItem('Calories', 'Calories', '17kcal') - this.IngredientItem('Nutrition', 'Protein', '0.9g') - this.IngredientItem('', 'Fat', '0.2g') - this.IngredientItem('', 'Carbohydrates', '3.9g') - this.IngredientItem('', 'VitaminC', '17.8mg') - } - .height(280) - .padding({ top: 30, right: 30, left: 30 }) - } - } - - @Entry - @Component - struct FoodDetail { - build() { - Column() { - FoodImageDisplay() - ContentTable() - } - .alignItems(HorizontalAlign.Center) - } - } - ``` - - ![zh-cn_image_0000001215199399](figures/zh-cn_image_0000001215199399.png) - -通过学习Stack布局和Flex布局已完成食物的图文展示和营养成分表,构建出第一个普通视图的食物详情页。在下一个章节中,将开发食物分类列表页,并完成食物分类列表页面和食物详情页面的跳转和数据传递,现在我们就进入下一个章节的学习吧。 - -## 相关实例 - -针对创建简单视图,有以下示例工程可供参考: - -- [`BuildCommonView`:创建简单视图(ArkTS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/BuildCommonView) - - 本示例为构建了简单页面展示食物番茄的图片和营养信息,主要为了展示简单页面的Stack布局和Flex布局。 diff --git a/zh-cn/application-dev/ui/ui-ts-custom-component-lifecycle-callbacks.md b/zh-cn/application-dev/ui/ui-ts-custom-component-lifecycle-callbacks.md deleted file mode 100644 index 4b465482de1abb9ee8be2a5a5357714b9b806f29..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/ui/ui-ts-custom-component-lifecycle-callbacks.md +++ /dev/null @@ -1,225 +0,0 @@ -# 自定义组件的生命周期 - -自定义组件的生命周期回调函数用于通知用户该自定义组件的生命周期,这些回调函数是私有的,在运行时由开发框架在特定的时间进行调用,不能从应用程序中手动调用这些回调函数。 - -> **说明:** -> -> - 允许在生命周期函数中使用Promise和异步回调函数,比如网络资源获取,定时器设置等; -> -> - 不允许在生命周期函数中使用async await。 - - -## aboutToAppear - -aboutToAppear?(): void - -aboutToAppear函数在创建自定义组件的新实例后,在执行其build函数之前执行。允许在aboutToAppear函数中改变状态变量,更改将在后续执行build函数中生效。 - -## aboutToDisappear - -aboutToDisappear?(): void - -aboutToDisappear函数在自定义组件析构销毁之前执行。不允许在aboutToDisappear函数中改变状态变量,特别是@Link变量的修改可能会导致应用程序行为不稳定。 - -**示例1:** - -```ts -// xxx.ets -@Entry -@Component -struct CountDownTimerComponent { - @State countDownFrom: number = 10 - private timerId: number = -1 - - aboutToAppear(): void { - this.timerId = setInterval(() => { - if (this.countDownFrom <= 1) { - clearTimeout(this.timerId) // countDownFrom小于等于1时清除计时器 - } - this.countDownFrom -= 1 - }, 1000) // countDownFrom每1s减1 - } - - aboutToDisappear(): void { - if (this.timerId > 0) { - clearTimeout(this.timerId) - this.timerId = -1 - } - } - - build() { - Column() { - Text(`${this.countDownFrom} sec left`) - .fontSize(30) - .margin(30) - }.width('100%') - } -} -``` - -![aboutToAppear](figures/aboutToAppear.gif) - -上述示例表明,生命周期函数对于允许CountDownTimerComponent管理其计时器资源至关重要,类似的函数也包括异步从网络请求加载资源。 - -## onPageShow - -onPageShow?(): void - -页面每次显示时触发一次,包括路由过程、应用进入前后台等场景,仅@Entry修饰的自定义组件生效。 - -## onPageHide - -onPageHide?(): void - -页面每次隐藏时触发一次,包括路由过程、应用进入前后台等场景,仅@Entry修饰的自定义组件生效。 - -## onBackPress - -onBackPress?(): void - -当用户点击返回按钮时触发,仅@Entry修饰的自定义组件生效。 - -**示例2:** - -```ts -// xxx.ets -@Entry -@Component -struct IndexComponent { - @State textColor: Color = Color.Black - - onPageShow() { - this.textColor = Color.Blue - console.info('IndexComponent onPageShow') - } - - onPageHide() { - this.textColor = Color.Transparent - console.info('IndexComponent onPageHide') - } - - onBackPress() { - this.textColor = Color.Red - console.info('IndexComponent onBackPress') - } - - build() { - Column() { - Text('Hello World') - .fontColor(this.textColor) - .fontSize(30) - .margin(30) - }.width('100%') - } -} -``` - -![lifecycle](figures/lifecycle.PNG) - -## onLayout9+ - -onLayout?(children: Array\, constraint: ConstraintSizeOptions): void - -框架会在自定义组件布局时,将该自定义组件的子节点信息和自身的尺寸范围通过onLayout传递给该自定义组件。不允许在onLayout函数中改变状态变量。 - -**参数:** - -| 参数名 | 类型 | 说明 | -| ---------- | -------------------------------------------------------------------------------- | ---------------------- | -| children | Array\<[LayoutChild](#layoutchild9)\> | 子组件布局信息。 | -| constraint | [ConstraintSizeOptions](../reference/arkui-ts/ts-types.md#constraintsizeoptions) | 父组件constraint信息。 | - -## onMeasure9+ - -onMeasure?(children: Array\, constraint: ConstraintSizeOptions): void - -框架会在自定义组件确定尺寸时,将该自定义组件的子节点信息和自身的尺寸范围通过onMeasure传递给该自定义组件。不允许在onMeasure函数中改变状态变量。 - -**参数:** - -| 参数名 | 类型 | 说明 | -| ---------- | -------------------------------------------------------------------------------- | ---------------------- | -| children | Array\<[LayoutChild](#layoutchild9)\> | 子组件布局信息。 | -| constraint | [ConstraintSizeOptions](../reference/arkui-ts/ts-types.md#constraintsizeoptions) | 父组件constraint信息。 | - -## LayoutChild9+ - -子组件布局信息。 - -| 参数 | 参数类型 | 描述 | -| ---------- | ----------------------------------------------------------------------------------------------------------- | -------------------------------------- | -| name | string | 子组件名称。 | -| id | string | 子组件id。 | -| constraint | [ConstraintSizeOptions](../reference/arkui-ts/ts-types.md#constraintsizeoptions) | 子组件约束尺寸。 | -| borderInfo | [LayoutBorderInfo](#layoutborderinfo9) | 子组件border信息。 | -| position | [Position](../reference/arkui-ts/ts-types.md#position) | 子组件位置坐标。 | -| measure | (childConstraint: [ConstraintSizeOptions](../reference/arkui-ts/ts-types.md#constraintsizeoptions)) => void | 调用此方法对子组件的尺寸范围进行限制。 | -| layout | (LayoutInfo: [LayoutInfo](#layoutinfo9)) => void | 调用此方法对子组件的位置信息进行限制。 | - -## LayoutBorderInfo9+ - -子组件border信息。 - -| 参数 | 参数类型 | 描述 | -| ----------- | ---------------------------------------------------------- | ---------------------------------------------- | -| borderWidth | [EdgeWidths](../reference/arkui-ts/ts-types.md#edgewidths) | 边框宽度类型,用于描述组件边框不同方向的宽度。 | -| margin | [Margin](../reference/arkui-ts/ts-types.md#margin) | 外边距类型,用于描述组件不同方向的外边距。 | -| padding | [Padding](../reference/arkui-ts/ts-types.md#padding) | 内边距类型,用于描述组件不同方向的内边距。 | - -## LayoutInfo9+ - -子组件layout信息。 - -| 参数 | 参数类型 | 描述 | -| ---------- | -------------------------------------------------------------------------------- | ---------------- | -| position | [Position](../reference/arkui-ts/ts-types.md#position) | 子组件位置坐标。 | -| constraint | [ConstraintSizeOptions](../reference/arkui-ts/ts-types.md#constraintsizeoptions) | 子组件约束尺寸。 | - -**示例3:** - -```ts -// xxx.ets -@Entry -@Component -struct Index { - build() { - Column() { - CustomLayout() { - ForEach([1, 2, 3], (index) => { - Text('Sub' + index) - .fontSize(30) - .borderWidth(2) - }) - } - } - } -} - - -@Component -struct CustomLayout { - @BuilderParam builder: () => {} - - onLayout(children: Array, constraint: ConstraintSizeOptions) { - let pos = 0 - children.forEach((child) => { - child.layout({ position: { x: pos, y: pos }, constraint: constraint }) - pos += 100 - }) - } - - onMeasure(children: Array, constraint: ConstraintSizeOptions) { - let size = 100 - children.forEach((child) => { - child.measure({ minHeight: size, minWidth: size, maxWidth: size, maxHeight: size }) - size += 50 - }) - } - - build() { - this.builder() - } -} -``` - -![customlayout](figures/customLayout.png) diff --git a/zh-cn/application-dev/ui/ui-ts-developing-intro.md b/zh-cn/application-dev/ui/ui-ts-developing-intro.md deleted file mode 100644 index db7e9da5930a56d406c7b376cd31563d863a5bdc..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/ui/ui-ts-developing-intro.md +++ /dev/null @@ -1,158 +0,0 @@ -# 声明式UI开发指导 - -## 开发说明 - -| 任务 | 简介 | 相关资源 | -| ----------- | ---------------------------------------- | ---------------------------------------- | -| 准备开发环境 | 了解声明式UI的工程结构。
了解资源分类与访问。 | [OpenHarmony工程介绍](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-project-overview-0000001218440650)
[资源分类与访问](../quick-start/resource-categories-and-access.md) | -| 学习ArkTS语言 | ArkTS是OpenHarmony优选的主力应用开发语言,当前,ArkTS在TS基础上主要扩展了声明式UI能力。 | [学习ArkTS语言](../quick-start/arkts-get-started.md) | -| 开发页面 | 根据页面的使用场景,选择合适的布局。
根据页面需要实现的内容,添加系统内置组件,并修改组件样式。
更新页面内容,丰富页面展现形式。 | [创建页面](#创建页面)
  [常见布局开发指导](ui-ts-layout-linear.md)
  [常见组件说明](ui-ts-components-intro.md)
[修改组件样式](#修改组件样式)
[更新页面内容](#更新页面内容) | -| (可选)页面多样化 | 绘图和动画。 | [绘图组件](../reference/arkui-ts/ts-drawing-components-circle.md)
[画布组件](../reference/arkui-ts/ts-components-canvas-canvas.md)
[动画](../reference/arkui-ts/ts-animatorproperty.md) | -| (可选)页面之间的跳转 | 使用页面路由实现多个页面之前的跳转。 | [页面路由](../reference/apis/js-apis-router.md) | -| (可选)性能提升 | 避免低性能代码对应用的性能造成负面影响。 | [性能提升的推荐方法](ui-ts-performance-improvement-recommendation.md) | - -## 创建页面 - -请先根据页面预期效果选择布局结构创建页面,并在页面中添加基础的系统内置组件。下述示例采用了[弹性布局(Flex)](ui-ts-layout-flex.md),对页面中的Text组件进行横纵向居中布局显示。 - - ```ts - // xxx.ets - @Entry - @Component - struct MyComponent { - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Hello') - } - .width('100%') - .height('100%') - } - } - ``` - -## 修改组件样式 - -在页面中添加系统内置组件时,若不设置属性方法,则会显示其默认样式。通过更改组件的属性样式或者组件支持的[通用属性](../reference/arkui-ts/ts-universal-attributes-size.md)样式,改变组件的UI显示。 - -1. 通过修改Text组件的构造参数,将Text组件的显示内容修改为“Tomato”。 -2. 修改Text组件的fontSize属性更改组件的字体大小,将字体大小设置为26,通过fontWeight属性更改字体粗细,将其设置为500。 - - ```ts - // xxx.ets - @Entry - @Component - struct MyComponent { - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text('Tomato') - .fontSize(26) - .fontWeight(500) - } - .width('100%') - .height('100%') - } - } - ``` - - ![zh-cn_image_0000001168888224](figures/zh-cn_image_0000001168888224.png) - -## 更新页面内容 - -在创建基本的页面之后,可根据组件的状态来更新页面内容。以下示例展示了简单的更新页面方法。 - -> **说明:** -> -> 更新组件的状态之前,请先初始化组件的成员变量。自定义组件的成员变量可以通过[本地初始化](../quick-start/arkts-restrictions-and-extensions.md#自定义组件成员变量初始化的方式与约束)和[在构造组件时通过构造参数初始化](../quick-start/arkts-restrictions-and-extensions.md#自定义组件成员变量初始化的方式与约束)两种方式实现,具体允许哪种方式取决于该变量所使用的装饰器。 - -**示例:** - -```ts -// xxx.ets -@Entry -@Component -struct ParentComp { - @State isCountDown: boolean = true - - build() { - Column() { - Text(this.isCountDown ? 'Count Down' : 'Stopwatch').fontSize(20).margin(20) - if (this.isCountDown) { - // 图片资源放在media目录下 - Image($r("app.media.countdown")).width(120).height(120) - TimerComponent({ counter: 10, changePerSec: -1, showInColor: Color.Red }) - } else { - // 图片资源放在media目录下 - Image($r("app.media.stopwatch")).width(120).height(120) - TimerComponent({ counter: 0, changePerSec: +1, showInColor: Color.Black }) - } - Button(this.isCountDown ? 'Switch to Stopwatch' : 'Switch to Count Down') - .onClick(() => { - this.isCountDown = !this.isCountDown - }) - }.width('100%') - } -} - -// 自定义计时器/倒计时组件 -@Component -struct TimerComponent { - @State counter: number = 0 - private changePerSec: number = -1 - private showInColor: Color = Color.Black - private timerId: number = -1 - - build() { - Text(`${this.counter}sec`) - .fontColor(this.showInColor) - .fontSize(20) - .margin(20) - } - - aboutToAppear() { - this.timerId = setInterval(() => { - this.counter += this.changePerSec - }, 1000) - } - - aboutToDisappear() { - if (this.timerId > 0) { - clearTimeout(this.timerId) - this.timerId = -1 - } - } -} -``` - -![component](figures/component.gif) - -**初始创建和渲染:** - -1. 创建父组件ParentComp; - -2. 本地初始化ParentComp的状态变量isCountDown; - -3. 执行ParentComp的build函数; - -4. 创建Column组件; - 1. 创建Text组件,设置其文本展示内容,并将Text组件实例添加到Column中; - 2. 判断if条件,创建true条件下的元素; - 1. 创建Image组件,并设置其图片源地址; - 2. 使用给定的构造函数创建TimerComponent; - 3. 创建Button内置组件,设置相应的内容。 - -**状态更新:** - -用户单击按钮时: - -1. ParentComp的isCountDown状态变量的值更改为false; - -2. 执行ParentComp的build函数; - -3. Column组件被重用并执行重新初始化; - -4. Column的子组件会重用内存中的对象,但会进行重新初始化; - 1. Text组件会被重用,但使用新的文本内容进行重新初始化; - 2. 判断if条件,使用false条件下的元素; - 1. 原来true条件的组件不再使用,将这些组件销毁; - 2. 创建false条件下的组件; - 3. 重用Button组件,使用新的图片源地址。 \ No newline at end of file diff --git a/zh-cn/application-dev/ui/ui-ts-drawing-feature.md b/zh-cn/application-dev/ui/ui-ts-drawing-feature.md deleted file mode 100644 index 909dcf6cd812a7ef61d84de7ddb96847871e04a1..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/ui/ui-ts-drawing-feature.md +++ /dev/null @@ -1,415 +0,0 @@ -# 绘制图形 - -绘制能力主要是通过框架提供的绘制组件来支撑,支持svg标准绘制命令。 - -本节主要学习如何使用绘制组件,绘制详情页食物成分标签(基本几何图形)和应用Logo(自定义图形)。 - -## 绘制基本几何图形 - -绘制组件封装了一些常见的基本几何图形,比如矩形Rect、圆形Circle、椭圆形Ellipse等,为开发者省去了路线计算的过程。 - -FoodDetail页面的食物成分表里,给每一项成分名称前都加上一个圆形的图标作为成分标签。 - -1. 创建Circle组件,在每一项含量成分前增加一个圆形图标作为标签。设置Circle的直径为 6vp。修改FoodDetail页面的ContentTable组件里的IngredientItem方法,在成分名称前添加Circle。 - - ```ts - // FoodDetail.ets - @Component - struct ContentTable { - private foodItem: FoodData - - @Builder IngredientItem(title:string, colorValue: string, name: string, value: string) { - Flex() { - Text(title) - .fontSize(17.4) - .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) - Text(value) - .fontSize(17.4) - } - .layoutWeight(2) - } - } - - build() { - ...... - } - } - ``` - -2. 每个成分的标签颜色不一样,所以我们在build方法中,调用IngredientItem,给每个Circle填充不一样的颜色。 - - ```ts - // FoodDetail.ets - @Component - struct ContentTable { - private foodItem: FoodData - - @Builder IngredientItem(title:string, colorValue: string, name: string, value: string) { - Flex() { - Text(title) - .fontSize(17.4) - .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) - Text(value) - .fontSize(17.4) - } - .layoutWeight(2) - } - } - - build() { - Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Start }) { - this.IngredientItem('Calories', '#FFf54040', 'Calories', this.foodItem.calories + 'kcal') - this.IngredientItem('Nutrition', '#FFcccccc', 'Protein', this.foodItem.protein + 'g') - this.IngredientItem(' ', '#FFf5d640', 'Fat', this.foodItem.fat + 'g') - this.IngredientItem(' ', '#FF9e9eff', 'Carbohydrates', this.foodItem.carbohydrates + 'g') - this.IngredientItem(' ', '#FF53f540', 'VitaminC', this.foodItem.vitaminC + 'mg') - } - .height(280) - .padding({ top: 30, right: 30, left: 30 }) - } - } - ``` - - ![drawing-feature](figures/drawing-feature.png) - -## 绘制自定义几何图形 - -除绘制基础几何图形,开发者还可以使用Path组件来绘制自定义的路线,下面进行绘制应用的Logo图案。 - -1. 在pages文件夹下创建新的页面Logo.ets。 - - ![drawing-feature1](figures/drawing-feature1.png) - -2. Logo.ets中删掉模板代码,创建Logo Component。 - - ```ts - @Entry - @Component - struct Logo { - build() { - } - } - ``` - -3. 创建Flex组件为根节点,宽高设置为100%,设置其在主轴方向和交叉轴方向的对齐方式都为Center,创建Shape组件为Flex子组件。 - - Shape组件是所有绘制组件的父组件。如果需要组合多个绘制组件成为一个整体,需要创建Shape作为其父组件。 - - 我们要绘制的Logo的大小630px * 630px。声明式UI范式支持多种长度单位的设置,在前面的章节中,我们直接使用number作为参数,即采用了默认长度单位vp,虚拟像素单位。vp和设备分辨率以及屏幕密度有关。比如设备分辨率为1176 * 2400,屏幕基准密度(resolution)为3,vp = px / resolution,则该设备屏幕宽度是392vp。 - - 但是绘制组件采用svg标准,默认采取px为单位的,为方便统一,在这绘制Logo这一部分,统一采取px为单位。声明式UI框架同样也支持px单位,入参类型为string,设置宽度为630px,即210vp,设置方式为width('630px')或者width(210)。 - - ```ts - @Entry - @Component - struct Logo { - build() { - Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Shape() { - - } - .height('630px') - .width('630px') - } - .width('100%') - .height('100%') - } - } - ``` - -4. 给页面填充渐变色。设置为线性渐变,偏移角度为180deg,三段渐变 #BDE895 -->95DE7F --> #7AB967,其区间分别为[0, 0.1], (0.1, 0.6], (0.6, 1]。 - - ```ts - .linearGradient( - { - angle: 180, - colors: [['#BDE895', 0.1], ["#95DE7F", 0.6], ["#7AB967", 1]] - }) - ``` - - ![drawing-feature2](figures/drawing-feature2.png) - - ```ts - @Entry - @Component - struct Logo { - build() { - Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Shape() { - - } - .height('630px') - .width('630px') - } - .width('100%') - .height('100%') - .linearGradient( - { - angle: 180, - colors: [['#BDE895', 0.1], ["#95DE7F", 0.6], ["#7AB967", 1]] - }) - } - } - ``` - - ![drawing-feature3](figures/drawing-feature3.png) - -5. 绘制第一条路线Path,设置其绘制命令。 - - ```ts - Path() - .commands('M162 128.7 a222 222 0 0 1 100.8 374.4 H198 a36 36 0 0 3 -36 -36') - ``` - - Path的绘制命令采用svg标准,上述命令可分解为: - - ```ts - M162 128.7 - ``` - - 将笔触移动到(Moveto)坐标点(162, 128.7)。 - - ```ts - a222 222 0 0 1 100.8 374.4 - ``` - - 画圆弧线(elliptical arc)半径rx,ry为222,x轴旋转角度x-axis-rotation为0,角度大小large-arc-flag为0,即小弧度角,弧线方向(sweep-flag)为1,即逆时针画弧线,小写a为相对位置,即终点坐标为(162 + 100.8 = 262.8, 128.7 + 374.4 = 503.1)。 - - ```ts - H198 - ``` - - 画水平线(horizontal lineto)到198,即画(262.8, 503.1)到(198, 503.1)的水平线。 - - ```ts - a36 36 0 0 3 -36 -36 - ``` - - 画圆弧线(elliptical arc),含义同上,结束点为(198 - 36 = 162, 503.1 - 36 = 467.1)。 - - ```ts - V128.7 - ``` - - 画垂直线(vertical lineto)到128.7,即画(162, 467.1)到(162, 128.7)的垂直线。 - - ```ts - z - ``` - - 关闭路径(closepath)。 - - ![drawing-feature4](figures/drawing-feature4.png) - - 填充颜色为白色,线条颜色为透明。 - - ```ts - .fill(Color.White) - .stroke(Color.Transparent) - ``` - - ```ts - @Entry - @Component - struct Logo { - build() { - Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Shape() { - Path() - .commands('M162 128.7 a222 222 0 0 1 100.8 374.4 H198 a36 36 0 0 3 -36 -36') - .fill(Color.White) - .stroke(Color.Transparent) - } - .height('630px') - .width('630px') - } - .width('100%') - .height('100%') - .linearGradient( - { - angle: 180, - colors: [['#BDE895', 0.1], ["#95DE7F", 0.6], ["#7AB967", 1]] - }) - } - } - ``` - - ![drawing-feature5](figures/drawing-feature5.png) - -6. 在Shape组件内绘制第二个Path。第二条Path的背景色为渐变色,但是渐变色的填充是其整体的box,所以需要clip将其裁剪,入参为Shape,即按照Shape的形状进行裁剪。 - - ```ts - Path() - .commands('M319.5 128.1 c103.5 0 187.5 84 187.5 187.5 v15 a172.5 172.5 0 0 3 -172.5 172.5 H198 a36 36 0 0 3 -13.8 -1 207 207 0 0 0 87 -372 h48.3 z') - .fill('none') - .stroke(Corlor.Transparent) - .linearGradient( - { - angle: 30, - colors: [["#C4FFA0", 0], ["#ffffff", 1]] - }) - .clip(new Path().commands('M319.5 128.1 c103.5 0 187.5 84 187.5 187.5 v15 a172.5 172.5 0 0 3 -172.5 172.5 H198 a36 36 0 0 3 -13.8 -1 207 207 0 0 0 87 -372 h48.3 z')) - ``` - - Path的绘制命令比较长,可以将其作为组件的成员变量,通过this调用。 - - ```ts - @Entry - @Component - struct Logo { - private pathCommands1:string = 'M319.5 128.1 c103.5 0 187.5 84 187.5 187.5 v15 a172.5 172.5 0 0 3 -172.5 172.5 H198 a36 36 0 0 3 -13.8 -1 207 207 0 0 0 87 -372 h48.3 z' - build() { - ...... - Path() - .commands(this.pathCommands1) - .fill('none') - .stroke(Color.Transparent) - .linearGradient( - { - angle: 30, - colors: [["#C4FFA0", 0], ["#ffffff", 1]] - }) - .clip(new Path().commands(this.pathCommands1)) - ...... - } - } - ``` - - ![drawing-feature6](figures/drawing-feature6.png) - -7. 在Shape组件内绘制第二个Path。 - - ```ts - @Entry - @Component - struct Logo { - private pathCommands1:string = 'M319.5 128.1 c103.5 0 187.5 84 187.5 187.5 v15 a172.5 172.5 0 0 3 -172.5 172.5 H198 a36 36 0 0 3 -13.8 -1 207 207 0 0 0 87 -372 h48.3 z' - private pathCommands2:string = 'M270.6 128.1 h48.6 c51.6 0 98.4 21 132.3 54.6 a411 411 0 0 3 -45.6 123 c-25.2 45.6 -56.4 84 -87.6 110.4 a206.1 206.1 0 0 0 -47.7 -288 z' - build() { - Flex({ alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Shape() { - Path() - .commands('M162 128.7 a222 222 0 0 1 100.8 374.4 H198 a36 36 0 0 3 -36 -36') - .fill(Color.White) - .stroke(Color.Transparent) - - Path() - .commands(this.pathCommands1) - .fill('none') - .stroke(Color.Transparent) - .linearGradient( - { - angle: 30, - colors: [["#C4FFA0", 0], ["#ffffff", 1]] - }) - .clip(new Path().commands(this.pathCommands1)) - - Path() - .commands(this.pathCommands2) - .fill('none') - .stroke(Color.Transparent) - .linearGradient( - { - angle: 50, - colors: [['#8CC36A', 0.1], ["#B3EB90", 0.4], ["#ffffff", 0.7]] - }) - .clip(new Path().commands(this.pathCommands2)) - } - .height('630px') - .width('630px') - } - .width('100%') - .height('100%') - .linearGradient( - { - angle: 180, - colors: [['#BDE895', 0.1], ["#95DE7F", 0.6], ["#7AB967", 1]] - }) - } - } - ``` - - ![drawing-feature7](figures/drawing-feature7.png) - - 完成应用Logo的绘制。Shape组合了三个Path组件,通过svg命令绘制出一个艺术的叶子,寓意绿色健康饮食方式。 - -8. 添加应用的标题和slogan。 - - ```ts - @Entry - @Component - struct Logo { - private pathCommands1: string = 'M319.5 128.1 c103.5 0 187.5 84 187.5 187.5 v15 a172.5 172.5 0 0 3 -172.5 172.5 H198 a36 36 0 0 3 -13.8 -1 207 207 0 0 0 87 -372 h48.3 z' - private pathCommands2: string = 'M270.6 128.1 h48.6 c51.6 0 98.4 21 132.3 54.6 a411 411 0 0 3 -45.6 123 c-25.2 45.6 -56.4 84 -87.6 110.4 a206.1 206.1 0 0 0 -47.7 -288 z' - - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Shape() { - Path() - .commands('M162 128.7 a222 222 0 0 1 100.8 374.4 H198 a36 36 0 0 3 -36 -36') - .fill(Color.White) - .stroke(Color.Transparent) - - Path() - .commands(this.pathCommands1) - .fill('none') - .stroke(Color.Transparent) - .linearGradient( - { - angle: 30, - colors: [["#C4FFA0", 0], ["#ffffff", 1]] - }) - .clip(new Path().commands(this.pathCommands1)) - - Path() - .commands(this.pathCommands2) - .fill('none') - .stroke(Color.Transparent) - .linearGradient( - { - angle: 50, - colors: [['#8CC36A', 0.1], ["#B3EB90", 0.4], ["#ffffff", 0.7]] - }) - .clip(new Path().commands(this.pathCommands2)) - } - .height('630px') - .width('630px') - - Text('Healthy Diet') - .fontSize(26) - .fontColor(Color.White) - .margin({ top: 300 }) - - Text('Healthy life comes from a balanced diet') - .fontSize(17) - .fontColor(Color.White) - .margin({ top: 4 }) - } - .width('100%') - .height('100%') - .linearGradient( - { - angle: 180, - colors: [['#BDE895', 0.1], ["#95DE7F", 0.6], ["#7AB967", 1]] - }) - } - } - ``` - - ![drawing-feature8](figures/drawing-feature8.png) \ No newline at end of file diff --git a/zh-cn/application-dev/ui/ui-ts-layout-flex.md b/zh-cn/application-dev/ui/ui-ts-layout-flex.md deleted file mode 100644 index bf3f2929bdeb2ec2d670edab09f3eb4482aeb55f..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/ui/ui-ts-layout-flex.md +++ /dev/null @@ -1,586 +0,0 @@ -# 弹性布局 - -弹性布局(Flex布局)是自适应布局中使用最为灵活的布局。弹性布局提供一种更加有效的方式来对容器中的子组件进行排列、对齐和分配空白空间。弹性布局 - - -- 容器: [Flex组件](../reference/arkui-ts/ts-container-flex.md)作为Flex布局的容器,用于设置布局相关属性。 -- 子组件: Flex组件内的子组件自动成为布局的子组件。 -- 主轴: Flex组件布局方向的轴线,子组件默认沿着主轴排列。主轴开始的位置称为主轴起始端,结束位置称为主轴终点端。 -- 交叉轴: 垂直于主轴方向的轴线。交叉轴起始的位置称为交叉轴首部,结束位置称为交叉轴尾部。 - -以FlexDirection.Row的Flex为例: - -![](figures/flex.png) - -## 容器组件属性 - -通过Flex组件提供的Flex接口创建弹性布局。如下: - -`Flex(options?: { direction?: FlexDirection, wrap?: FlexWrap, justifyContent?: FlexAlign, alignItems?: ItemAlign, alignContent?: FlexAlign })` - - - -### 弹性布局方向 -参数direction决定主轴的方向,即子组件的排列方向。可选值有: - -![](figures/direction.png) - -- FlexDirection.Row(默认值):主轴为水平方向,子组件从起始端沿着水平方向开始排布。 - - ```ts - Flex({ direction: FlexDirection.Row }) { - Text('1').width('33%').height(50).backgroundColor(0xF5DEB3) - Text('2').width('33%').height(50).backgroundColor(0xD2B48C) - Text('3').width('33%').height(50).backgroundColor(0xF5DEB3) - } - .height(70) - .width('90%') - .padding(10) - .backgroundColor(0xAFEEEE) - ``` - ![zh-cn_image_0000001218579606](figures/zh-cn_image_0000001218579606.PNG) - -- FlexDirection.RowReverse:主轴为水平方向,子组件从终点端沿着FlexDirection. Row相反的方向开始排布。 - - ```ts - Flex({ direction: FlexDirection.RowReverse }) { - Text('1').width('33%').height(50).backgroundColor(0xF5DEB3) - Text('2').width('33%').height(50).backgroundColor(0xD2B48C) - Text('3').width('33%').height(50).backgroundColor(0xF5DEB3) - } - .height(70) - .width('90%') - .padding(10) - .backgroundColor(0xAFEEEE) - ``` - - ![zh-cn_image_0000001218739566](figures/zh-cn_image_0000001218739566.PNG) - -- FlexDirection.Column:主轴为垂直方向,子组件从起始端沿着垂直方向开始排布。 - - ```ts - Flex({ direction: FlexDirection.Column }) { - Text('1').width('100%').height(50).backgroundColor(0xF5DEB3) - Text('2').width('100%').height(50).backgroundColor(0xD2B48C) - Text('3').width('100%').height(50).backgroundColor(0xF5DEB3) - } - .height(70) - .width('90%') - .padding(10) - .backgroundColor(0xAFEEEE) - ``` - - ![zh-cn_image_0000001263019457](figures/zh-cn_image_0000001263019457.PNG) - -- FlexDirection.ColumnReverse:主轴为垂直方向,子组件从终点端沿着FlexDirection. Column相反的方向开始排布。 - - ```ts - Flex({ direction: FlexDirection.ColumnReverse }) { - Text('1').width('100%').height(50).backgroundColor(0xF5DEB3) - Text('2').width('100%').height(50).backgroundColor(0xD2B48C) - Text('3').width('100%').height(50).backgroundColor(0xF5DEB3) - } - .height(70) - .width('90%') - .padding(10) - .backgroundColor(0xAFEEEE) - ``` - - ![zh-cn_image_0000001263339459](figures/zh-cn_image_0000001263339459.PNG) - -### 弹性布局换行 - -默认情况下,子组件在Flex容器中都排在一条线(又称"轴线")上。通过wrap参数设置子组件换行方式。可选值有: - -- FlexWrap. NoWrap(默认值): 不换行。如果子组件的宽度总和大于父元素的宽度,则子组件会被压缩宽度。 - - ```ts - Flex({ wrap: FlexWrap.NoWrap }) { - Text('1').width('50%').height(50).backgroundColor(0xF5DEB3) - Text('2').width('50%').height(50).backgroundColor(0xD2B48C) - Text('3').width('50%').height(50).backgroundColor(0xF5DEB3) - } - .width('90%') - .padding(10) - .backgroundColor(0xAFEEEE) - ``` - - ![zh-cn_image_0000001263139409](figures/zh-cn_image_0000001263139409.PNG) - -- FlexWrap. Wrap:换行,每一行子组件按照主轴方向排列。 - - ```ts - Flex({ wrap: FlexWrap.Wrap }) { - Text('1').width('50%').height(50).backgroundColor(0xF5DEB3) - Text('2').width('50%').height(50).backgroundColor(0xD2B48C) - Text('3').width('50%').height(50).backgroundColor(0xD2B48C) - } - .width('90%') - .padding(10) - .backgroundColor(0xAFEEEE) - ``` - - ![zh-cn_image_0000001218419614](figures/zh-cn_image_0000001218419614.PNG) - -- FlexWrap. WrapReverse:换行,每一行子组件按照主轴反方向排列。 - - ```ts - Flex({ wrap: FlexWrap.WrapReverse}) { - Text('1').width('50%').height(50).backgroundColor(0xF5DEB3) - Text('2').width('50%').height(50).backgroundColor(0xD2B48C) - Text('3').width('50%').height(50).backgroundColor(0xF5DEB3) - } - .width('90%') - .padding(10) - .backgroundColor(0xAFEEEE) - ``` - - ![zh-cn_image_0000001263259399](figures/zh-cn_image_0000001263259399.PNG) - -### 弹性布局对齐方式 - -#### 主轴对齐 - -通过justifyContent参数设置在主轴方向的对齐方式,存在下面六种情况: - -![](figures/justifyContent.png) - -- FlexAlign.Start(默认值): 子组件在主轴方向起始端对齐, 第一个子组件与父元素边沿对齐,其他元素与前一个元素对齐。 - - ```ts - Flex({ justifyContent: FlexAlign.Start }) { - Text('1').width('20%').height(50).backgroundColor(0xF5DEB3) - Text('2').width('20%').height(50).backgroundColor(0xD2B48C) - Text('3').width('20%').height(50).backgroundColor(0xF5DEB3) - } - .width('90%') - .padding({ top: 10, bottom: 10 }) - .backgroundColor(0xAFEEEE) - ``` - - ![zh-cn_image_0000001218259634](figures/mainStart.png) - -- FlexAlign.Center: 子组件在主轴方向居中对齐。 - - ```ts - Flex({ justifyContent: FlexAlign.Center }) { - Text('1').width('20%').height(50).backgroundColor(0xF5DEB3) - Text('2').width('20%').height(50).backgroundColor(0xD2B48C) - Text('3').width('20%').height(50).backgroundColor(0xF5DEB3) - } - .width('90%') - .padding({ top: 10, bottom: 10 }) - .backgroundColor(0xAFEEEE) - ``` - - ![zh-cn_image_0000001218579608](figures/mainCenter.png) - -- FlexAlign.End: 子组件在主轴方向终点端对齐, 最后一个子组件与父元素边沿对齐,其他元素与后一个元素对齐。 - - ```ts - Flex({ justifyContent: FlexAlign.End }) { - Text('1').width('20%').height(50).backgroundColor(0xF5DEB3) - Text('2').width('20%').height(50).backgroundColor(0xD2B48C) - Text('3').width('20%').height(50).backgroundColor(0xF5DEB3) - } - .width('90%') - .padding({ top: 10, bottom: 10 }) - .backgroundColor(0xAFEEEE) - ``` - - ![zh-cn_image_0000001218739568](figures/mainEnd.png) - -- FlexAlign.SpaceBetween: Flex主轴方向均匀分配弹性元素,相邻子组件之间距离相同。第一个子组件和最后一个子组件与父元素边沿对齐。 - - ```ts - Flex({ justifyContent: FlexAlign.SpaceBetween }) { - Text('1').width('20%').height(50).backgroundColor(0xF5DEB3) - Text('2').width('20%').height(50).backgroundColor(0xD2B48C) - Text('3').width('20%').height(50).backgroundColor(0xF5DEB3) - } - .width('90%') - .padding({ top: 10, bottom: 10 }) - .backgroundColor(0xAFEEEE) - ``` - - ![zh-cn_image_0000001263019461](figures/mainSpacebetween.png) - -- FlexAlign.SpaceAround: Flex主轴方向均匀分配弹性元素,相邻子组件之间距离相同。第一个子组件到主轴起始端的距离和最后一个子组件到主轴终点端的距离是相邻元素之间距离的一半。 - - ```ts - Flex({ justifyContent: FlexAlign.SpaceAround }) { - Text('1').width('20%').height(50).backgroundColor(0xF5DEB3) - Text('2').width('20%').height(50).backgroundColor(0xD2B48C) - Text('3').width('20%').height(50).backgroundColor(0xF5DEB3) - } - .width('90%') - .padding({ top: 10, bottom: 10 }) - .backgroundColor(0xAFEEEE) - ``` - - ![zh-cn_image_0000001263339461](figures/mainSpacearound.png) - -- FlexAlign.SpaceEvenly: Flex主轴方向元素等间距布局,相邻子组件之间的间距、第一个子组件与主轴起始端的间距、最后一个子组件到主轴终点端的间距均相等。 - - ```ts - Flex({ justifyContent: FlexAlign.SpaceEvenly }) { - Text('1').width('20%').height(50).backgroundColor(0xF5DEB3) - Text('2').width('20%').height(50).backgroundColor(0xD2B48C) - Text('3').width('20%').height(50).backgroundColor(0xF5DEB3) - } - .width('90%') - .padding({ top: 10, bottom: 10 }) - .backgroundColor(0xAFEEEE) - ``` - - ![zh-cn_image_0000001263139411](figures/mainSpaceevenly.png) - -#### 交叉轴对齐 - -容器和子组件都可以设置交叉轴对齐方式,且子组件设置的对齐方式优先级较高。 - -##### 容器组件设置交叉轴对齐 -可以通过Flex组件的alignItems参数设置子组件在交叉轴的对齐方式,可选值有: - -- ItemAlign.Auto: 使用Flex容器中默认配置。 - - ```ts - Flex({ alignItems: ItemAlign.Auto }) { - Text('1').width('33%').height(30).backgroundColor(0xF5DEB3) - Text('2').width('33%').height(40).backgroundColor(0xD2B48C) - Text('3').width('33%').height(50).backgroundColor(0xF5DEB3) - } - .size({width: '90%', height: 80}) - .padding(10) - .backgroundColor(0xAFEEEE) - ``` - - ![zh-cn_image_0000001218419616](figures/zh-cn_image_0000001218419616.png) - -- ItemAlign.Start: 交叉轴方向首部对齐。 - - ```ts - Flex({ alignItems: ItemAlign.Start }) { - Text('1').width('33%').height(30).backgroundColor(0xF5DEB3) - Text('2').width('33%').height(40).backgroundColor(0xD2B48C) - Text('3').width('33%').height(50).backgroundColor(0xF5DEB3) - } - .size({width: '90%', height: 80}) - .padding(10) - .backgroundColor(0xAFEEEE) - ``` - - ![zh-cn_image_0000001263259401](figures/zh-cn_image_0000001263259401.png) - -- ItemAlign.Center: 交叉轴方向居中对齐。 - - ```ts - Flex({ alignItems: ItemAlign.Center }) { - Text('1').width('33%').height(30).backgroundColor(0xF5DEB3) - Text('2').width('33%').height(40).backgroundColor(0xD2B48C) - Text('3').width('33%').height(50).backgroundColor(0xF5DEB3) - } - .size({width: '90%', height: 80}) - .padding(10) - .backgroundColor(0xAFEEEE) - ``` - - ![zh-cn_image_0000001218259636](figures/zh-cn_image_0000001218259636.png) - -- ItemAlign.End:交叉轴方向底部对齐。 - - ```ts - Flex({ alignItems: ItemAlign.End }) { - Text('1').width('33%').height(30).backgroundColor(0xF5DEB3) - Text('2').width('33%').height(40).backgroundColor(0xD2B48C) - Text('3').width('33%').height(50).backgroundColor(0xF5DEB3) - } - .size({width: '90%', height: 80}) - .padding(10) - .backgroundColor(0xAFEEEE) - ``` - - ![zh-cn_image_0000001218579610](figures/zh-cn_image_0000001218579610.png) - -- ItemAlign.Stretch:交叉轴方向拉伸填充,在未设置尺寸时,拉伸到容器尺寸。 - - ```ts - Flex({ alignItems: ItemAlign.Stretch }) { - Text('1').width('33%').height(30).backgroundColor(0xF5DEB3) - Text('2').width('33%').height(40).backgroundColor(0xD2B48C) - Text('3').width('33%').height(50).backgroundColor(0xF5DEB3) - } - .size({width: '90%', height: 80}) - .padding(10) - .backgroundColor(0xAFEEEE) - ``` - - ![zh-cn_image_0000001218739570](figures/itemalignstretch.png) - -- ItemAlign. Baseline:交叉轴方向文本基线对齐。 - - ```ts - Flex({ alignItems: ItemAlign.Baseline }) { - Text('1').width('33%').height(30).backgroundColor(0xF5DEB3) - Text('2').width('33%').height(40).backgroundColor(0xD2B48C) - Text('3').width('33%').height(50).backgroundColor(0xF5DEB3) - } - .size({width: '90%', height: 80}) - .padding(10) - .backgroundColor(0xAFEEEE) - ``` - - ![zh-cn_image_0000001263019463](figures/zh-cn_image_0000001263019463.png) - -##### 子组件设置交叉轴对齐 -子组件的alignSelf属性也可以设置子组件在父容器交叉轴的对齐格式,且会覆盖Flex布局容器中alignItems默认配置。如下例所示: - -```ts -Flex({ direction: FlexDirection.Row, alignItems: ItemAlign.Center }) { //容器组件设置子组件居中 - Text('alignSelf Start').width('25%').height(80) - .alignSelf(ItemAlign.Start) - .backgroundColor(0xF5DEB3) - Text('alignSelf Baseline') - .alignSelf(ItemAlign.Baseline) - .width('25%') - .height(80) - .backgroundColor(0xD2B48C) - Text('alignSelf Baseline').width('25%').height(100) - .backgroundColor(0xF5DEB3) - .alignSelf(ItemAlign.Baseline) - Text('no alignSelf').width('25%').height(100) - .backgroundColor(0xD2B48C) - Text('no alignSelf').width('25%').height(100) - .backgroundColor(0xF5DEB3) - -}.width('90%').height(220).backgroundColor(0xAFEEEE) -``` - -![alignself](figures/alignself.png) - -上例中,Flex容器中alignItems设置交叉轴子组件的对齐方式为居中,子组件自身设置了alignSelf属性的情况,覆盖父组件的alignItem值,表现为alignSelf的定义。 - -#### 内容对齐 - -可以通过alignContent参数设置子组件各行在交叉轴剩余空间内的对齐方式,只在多行的flex布局中生效,可选值有: - -- FlexAlign.Start: 子组件各行与交叉轴起点对齐。 - - ```ts - Flex({ justifyContent: FlexAlign.SpaceBetween, wrap: FlexWrap.Wrap, alignContent: FlexAlign.Start }) { - Text('1').width('30%').height(20).backgroundColor(0xF5DEB3) - Text('2').width('60%').height(20).backgroundColor(0xD2B48C) - Text('3').width('40%').height(20).backgroundColor(0xD2B48C) - Text('4').width('30%').height(20).backgroundColor(0xF5DEB3) - Text('5').width('20%').height(20).backgroundColor(0xD2B48C) - } - .width('90%') - .height(100) - .backgroundColor(0xAFEEEE) - ``` - - ![crossStart.png](figures/crossStart.png) - -- FlexAlign.Center: 子组件各行在交叉轴方向居中对齐。 - - ```ts - Flex({ justifyContent: FlexAlign.SpaceBetween, wrap: FlexWrap.Wrap, alignContent: FlexAlign.Center }) { - Text('1').width('30%').height(20).backgroundColor(0xF5DEB3) - Text('2').width('60%').height(20).backgroundColor(0xD2B48C) - Text('3').width('40%').height(20).backgroundColor(0xD2B48C) - Text('4').width('30%').height(20).backgroundColor(0xF5DEB3) - Text('5').width('20%').height(20).backgroundColor(0xD2B48C) - } - .width('90%') - .height(100) - .backgroundColor(0xAFEEEE) - ``` - - ![crossCenter.png](figures/crossCenter.png) - -- FlexAlign.End: 子组件各行与交叉轴终点对齐。 - - ```ts - Flex({ justifyContent: FlexAlign.SpaceBetween, wrap: FlexWrap.Wrap, alignContent: FlexAlign.End }) { - Text('1').width('30%').height(20).backgroundColor(0xF5DEB3) - Text('2').width('60%').height(20).backgroundColor(0xD2B48C) - Text('3').width('40%').height(20).backgroundColor(0xD2B48C) - Text('4').width('30%').height(20).backgroundColor(0xF5DEB3) - Text('5').width('20%').height(20).backgroundColor(0xD2B48C) - } - .width('90%') - .height(100) - .backgroundColor(0xAFEEEE) - ``` - - ![crossEnd.png](figures/crossEnd.png) - -- FlexAlign.SpaceBetween: 子组件各行与交叉轴两端对齐,各行间垂直间距平均分布。 - - ```ts - Flex({ justifyContent: FlexAlign.SpaceBetween, wrap: FlexWrap.Wrap, alignContent: FlexAlign.SpaceBetween }) { - Text('1').width('30%').height(20).backgroundColor(0xF5DEB3) - Text('2').width('60%').height(20).backgroundColor(0xD2B48C) - Text('3').width('40%').height(20).backgroundColor(0xD2B48C) - Text('4').width('30%').height(20).backgroundColor(0xF5DEB3) - Text('5').width('20%').height(20).backgroundColor(0xD2B48C) - } - .width('90%') - .height(100) - .backgroundColor(0xAFEEEE) - ``` - - ![crossSpacebetween.png](figures/crossSpacebetween.png) - -- FlexAlign.SpaceAround: 子组件各行间距相等,是元素首尾行与交叉轴两端距离的两倍。 - - ```ts - Flex({ justifyContent: FlexAlign.SpaceBetween, wrap: FlexWrap.Wrap, alignContent: FlexAlign.SpaceAround }) { - Text('1').width('30%').height(20).backgroundColor(0xF5DEB3) - Text('2').width('60%').height(20).backgroundColor(0xD2B48C) - Text('3').width('40%').height(20).backgroundColor(0xD2B48C) - Text('4').width('30%').height(20).backgroundColor(0xF5DEB3) - Text('5').width('20%').height(20).backgroundColor(0xD2B48C) - } - .width('90%') - .height(100) - .backgroundColor(0xAFEEEE) - ``` - - ![crossSpacearound.png](figures/crossSpacearound.png) - -- FlexAlign.SpaceEvenly: 子组件各行间距,子组件首尾行与交叉轴两端距离都相等。 - - ```ts - Flex({ justifyContent: FlexAlign.SpaceBetween, wrap: FlexWrap.Wrap, alignContent: FlexAlign.SpaceEvenly }) { - Text('1').width('30%').height(20).backgroundColor(0xF5DEB3) - Text('2').width('60%').height(20).backgroundColor(0xD2B48C) - Text('3').width('40%').height(20).backgroundColor(0xD2B48C) - Text('4').width('30%').height(20).backgroundColor(0xF5DEB3) - Text('5').width('20%').height(20).backgroundColor(0xD2B48C) - } - .width('90%') - .height(100) - .backgroundColor(0xAFEEEE) - ``` - - ![crossSpaceevenly.png](figures/crossSpaceevenly.png) - -### 弹性布局的自适应拉伸 - -在弹性布局父组件尺寸不够大的时候,通过子组件的下面几个属性设置其再父容器的占比,达到自适应布局能力。 -- flexBasis: 设置子组件在父容器主轴方向上的基准尺寸。如果设置了该值,则子项占用的空间为设置的值;如果没设置或者为auto,那子项的空间为width/height的值。 - - ```ts - Flex() { - Text('flexBasis("auto")') - .flexBasis('auto') // 未设置width以及flexBasis值为auto,内容自身宽松 - .height(100) - .backgroundColor(0xF5DEB3) - Text('flexBasis("auto")'+' width("40%")') - .width('40%') - .flexBasis('auto') //设置width以及flexBasis值auto,使用width的值 - .height(100) - .backgroundColor(0xD2B48C) - - Text('flexBasis(100)') // 未设置width以及flexBasis值为100,宽度为100vp - .flexBasis(100) - .height(100) - .backgroundColor(0xF5DEB3) - - Text('flexBasis(100)') - .flexBasis(100) - .width(200) // flexBasis值为100,覆盖width的设置值,宽度为100vp - .height(100) - .backgroundColor(0xD2B48C) - }.width('90%').height(120).padding(10).backgroundColor(0xAFEEEE) - ``` - - ![flexbasis](figures/flexbasis.png) - -- flexGrow: 设置父容器的剩余空间分配给此属性所在组件的比例。用于"瓜分"父组件的剩余空间。 - - ```ts - Flex() { - Text('flexGrow(1)') - .flexGrow(2) - .width(100) - .height(100) - .backgroundColor(0xF5DEB3) - - Text('flexGrow(2)') - .flexGrow(2) - .width(100) - .height(100) - .backgroundColor(0xD2B48C) - - Text('no flexGrow') - .width(100) - .height(100) - .backgroundColor(0xF5DEB3) - }.width(400).height(120).padding(10).backgroundColor(0xAFEEEE) - ``` - - ![flexgrow](figures/flexgrow.png) - -上图中,父容器宽度400vp, 三个子组件原始宽度为100vp,综合300vp,剩余空间100vp根据flexGrow值的占比分配给子组件,未设置flexGrow的子组件不参与“瓜分”。 -第一个元素以及第二个元素以2:3分配剩下的100vp。第一个元素为100vp+100vp*2/5=140vp,第二个元素为100vp+100vp*3/5=160vp。 - -- flexShrink: 当父容器空间不足时,子组件的压缩比例。 - - ```ts - Flex({ direction: FlexDirection.Row }) { - Text('flexShrink(3)') - .flexShrink(3) - .width(200) - .height(100) - .backgroundColor(0xF5DEB3) - - Text('no flexShrink') - .width(200) - .height(100) - .backgroundColor(0xD2B48C) - - Text('flexShrink(2)') - .flexShrink(2) - .width(200) - .height(100) - .backgroundColor(0xF5DEB3) - }.width(400).height(120).padding(10).backgroundColor(0xAFEEEE) - ``` - - ![flexshrink](figures/flexshrink.png) - -## 场景示例 - -使用弹性布局,可以实现子组件沿水平方向排列,两端对齐,子组件间距平分,竖直方向上子组件居中的效果。示例如下: - -```ts -@Entry -@Component -struct FlexExample { - build() { - Column() { - Column({ space: 5 }) { - Flex({ direction: FlexDirection.Row, wrap: FlexWrap.NoWrap, justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { - Text('1').width('30%').height(50).backgroundColor(0xF5DEB3) - Text('2').width('30%').height(50).backgroundColor(0xD2B48C) - Text('3').width('30%').height(50).backgroundColor(0xF5DEB3) - } - .height(70) - .width('90%') - .backgroundColor(0xAFEEEE) - }.width('100%').margin({ top: 5 }) - }.width('100%') - } -} -``` - -![zh-cn_image_0000001261605867](figures/flexExample.png) - -## 相关实例 - -针对弹性布局开发,有以下相关实例可供参考: - -- [弹性布局(ArkTS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/FlowLayoutEts) - diff --git a/zh-cn/application-dev/ui/ui-ts-layout-grid-container-new.md b/zh-cn/application-dev/ui/ui-ts-layout-grid-container-new.md deleted file mode 100644 index 0e87a6bcab413b2ffcf1281cfbb808579a4a6ced..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/ui/ui-ts-layout-grid-container-new.md +++ /dev/null @@ -1,397 +0,0 @@ -# 栅格布局 - -栅格系统作为一种辅助布局的定位工具,在平面设计和网站设计都起到了很好的作用,对移动设备的界面设计有较好的借鉴作用。总结栅格系统对于移动设备的优势主要有: - -1. 给布局提供一种可循的规律,解决多尺寸多设备的动态布局问题。 -2. 给系统提供一种统一的定位标注,保证各模块各设备的布局一致性。 -3. 给应用提供一种灵活的间距调整方法,满足特殊场景布局调整的可能性。 - -推荐使用栅格组件[GridRow](../reference/arkui-ts/ts-container-gridrow.md)和[GridCol](../reference/arkui-ts/ts-container-gridcol.md)来实现栅格布局效果, -相对于目前已废弃的[GridContainer](../reference/arkui-ts/ts-container-gridcontainer.md)组件,GridRow和GridCol提供了更灵活、更全面的栅格系统实现方案。GridRow为栅格容器组件,只能与栅格子组件GridCol在栅格布局场景中使用。 - - -## 栅格容器GridRow - - -栅格容器有columns、gutter、direction、breakpoints四个属性。 -- columns: 栅格布局的主要定位工具,设置栅格布局的总列数。 -- gutter: 设置元素之间的距离,决定内容间的紧密程度。 -- direction: 设置栅格子组件在栅格容器中的排列方向。 -- breakpoints:以设备宽度为基准,将应用宽度分成了几个不同的区间,即不同的断点。开发者可根据需要在不同的区间下实现不同的页面布局效果。 - - -首先通过设置断点,得到一系列断点区间;然后,借助栅格组件能力监听应用窗口大小的变化,判断应用当前处于哪个断点区间,最后调整应用的布局。 - -### 栅格系统断点 - -栅格系统以设备的水平宽度(屏幕密度像素值,单位vp)作为断点依据,定义设备的宽度类型,形成了一套断点规则。开发者可根据需求在不同的断点区间实现不同的页面布局效果。 -栅格系统默认断点将设备宽度分为xs、sm、md、lg四类,尺寸范围如下: - -| 断点名称 | 取值范围(vp)| -| --------| ------ | -| xs | [0, 320) | -| sm | [320, 600) | -| md | [600, 840) | -| lg | [840, +∞) | - -在GridRow新栅格组件中,允许开发者使用breakpoints自定义修改断点的取值范围,最多支持6个断点,除了默认的四个断点外, -还可以启用xl,xxl两个断点,支持六种不同尺寸(xs, sm, md, lg, xl, xxl)设备的布局设置。 - -| 断点名称 | 设备描述 | -| ----- | ---------------------------------------- | -| xs | 最小宽度类型设备。 | -| sm | 小宽度类型设备。 | -| md | 中等宽度类型设备。 | -| lg | 大宽度类型设备。 | -| xl | 特大宽度类型设备。 | -| xxl | 超大宽度类型设备。 | - -- 针对断点位置,开发者根据实际使用场景,通过一个单调递增数组设置。由于breakpoints最多支持六个断点,单调递增数组长度最大为5。 - - ```ts - breakpoints: {value: ["100vp", "200vp"]} - ``` - - 表示启用xs、sm、md共3个断点,小于100vp为xs,100vp-200vp为sm,大于200vp为md。 - - ```ts - breakpoints: {value: ["320vp", "600vp", "840vp", "1080vp"]} - ``` - - 表示启用xs、sm、md、lg、xl共5个断点,小于320vp为xs,320vp-600vp为sm,600vp-840vp为md,840vp-1080vp为lg,大于1080vp为xl。 - - -- 栅格系统通过监听窗口或容器的尺寸变化进行断点,通过reference设置断点切换参考物。 考虑到应用可能以非全屏窗口的形式显示,以应用窗口宽度为参照物更为通用。 - -下例中,使用栅格的默认列数12列,通过断点设置将应用宽度分成六个区间,在各区间中,每个栅格子元素占用的列数均不同。效果如图: - ```ts -GridRow({ - breakpoints: { - value: ['200vp', '300vp', '400vp', '500vp', '600vp'], - reference: BreakpointsReference.WindowSize - } -}) { - ForEach(this.bgColors, (color, index) => { - GridCol({ - span: { - xs: 2, - sm: 3, - md: 4, - lg: 6, - xl: 8, - xxl: 12 - } - }) { - Row() { - Text(`${index}`) - }.width("100%").height("50vp") - }.backgroundColor(color) - }) -} - ``` - -![](figures/breakpoints.gif) - - - -### 栅格布局的总列数 - -GridRow中通过columns设置栅格布局的总列数。 - -- columns默认值为12,当未设置columns时,在任何断点下,栅格布局被分成12列。 - ```ts - GridRow() { - ForEach(this.bgColors, (item, index) => { - GridCol() { - Row() { - Text(`${index + 1}`) - }.width("100%").height("50") - }.backgroundColor(item) - }) - } - ``` - - ![](figures/columns1.png) - -- 当columns类型为number时,栅格布局在任何尺寸设备下都被分为columns列。下面分别设置栅格布局列数为4和8,子元素默认占一列,效果如下: - - ```ts - Row() { - GridRow({ columns: 4 }) { - ForEach(this.bgColors, (item, index) => { - GridCol() { - Row() { - Text(`${index + 1}`) - }.width("100%").height("50") - }.backgroundColor(item) - }) - } - .width("100%").height("100%") - .onBreakpointChange((breakpoint) => { - this.currentBp = breakpoint - }) - } - .height(160) - .border({ color: Color.Blue, width: 2 }) - .width('90%') - - Row() { - GridRow({ columns: 8 }) { - ForEach(this.bgColors, (item, index) => { - GridCol() { - Row() { - Text(`${index + 1}`) - }.width("100%").height("50") - }.backgroundColor(item) - }) - } - .width("100%").height("100%") - .onBreakpointChange((breakpoint) => { - this.currentBp = breakpoint - }) - } - .height(160) - .border({ color: Color.Blue, width: 2 }) - .width('90%') - ``` - - ![](figures/columns2.png) - - -- 当columns类型为GridRowColumnOption时,支持下面六种不同尺寸(xs, sm, md, lg, xl, xxl)设备的总列数设置,各个尺寸下数值可不同。 - - ```ts - GridRow({ columns: { sm: 4, md: 8 }, breakpoints: { value: ['200vp', '300vp', '400vp', '500vp', '600vp'] } }) { - ForEach(this.bgColors, (item, index) => { - GridCol() { - Row() { - Text(`${index + 1}`) - }.width("100%").height("50") - }.backgroundColor(item) - }) - } - ``` - ![](figures/columns3.gif) - - 如上,若只设置sm, md的栅格总列数,则较小的尺寸使用默认columns值12,较大的尺寸使用前一个尺寸的columns。这里只设置sm:8, md:10,则较小尺寸的xs:12,较大尺寸的参照md的设置,lg:10, xl:10, xxl:10。 - -### 栅格子组件间距 - -GridRow中通过gutter设置子元素在水平和垂直方向的间距。 - -- 当gutter类型为number时,同时设置栅格子组件间水平和垂直方向边距且相等。下例中,设置子组件水平与垂直方向距离相邻元素的间距为10。 - - ```ts - GridRow({ gutter: 10 }){} - ``` - - ![](figures/gutter1.png) - - - -- 当gutter类型为GutterOption时,单独设置栅格子组件水平垂直边距,x属性为水平方向间距,y为垂直方向间距。 - - ```ts - GridRow({ gutter: { x: 20, y: 50 } }){} - ``` - - ![](figures/gutter2.png) - - - -### 排列方向 - -通过GridRow的direction属性设置栅格子组件在栅格容器中的排列方向。 - -- 子组件默认从左往右排列。 - - ```ts - GridRow({ direction: GridRowDirection.Row }){} - ``` - ![](figures/direction1.png) - -- 子组件从右往左排列。 - - ```ts - GridRow({ direction: GridRowDirection.RowReverse }){} - ``` - - ![](figures/direction2.png) - - - -## 栅格子组件GridCol - -GridCol组件作为GridRow组件的子组件,通过给GridCol传参或者设置属性两种方式,设置span,offset,order的值。 - -- span的设置 - - ```ts - GridCol({ span: 2 }){} - GridCol({ span: { xs: 1, sm: 2, md: 3, lg: 4 } }){} - GridCol(){}.span(2) - GridCol(){}.span({ xs: 1, sm: 2, md: 3, lg: 4 }) - ``` - -- offset的设置 - - ```ts - GridCol({ offset: 2 }){} - GridCol({ offset: { xs: 2, sm: 2, md: 2, lg: 2 } }){} - GridCol(){}.offset(2) - GridCol(){}.offset({ xs: 1, sm: 2, md: 3, lg: 4 }) - ``` - -- order的设置 - - ```ts - GridCol({ order: 2 }){} - GridCol({ order: { xs: 1, sm: 2, md: 3, lg: 4 } }){} - GridCol(){}.order(2) - GridCol(){}.order({ xs: 1, sm: 2, md: 3, lg: 4 }) - ``` - - 下面使用传参的方式演示各属性的使用。 - -### span - -子组件占栅格布局的列数,决定了子组件的宽度,默认为1。 - -- 当类型为number时,子组件在所有尺寸设备下占用的列数相同。 - - ```ts - GridRow({ columns: 8 }) { - ForEach(this.bgColors, (color, index) => { - GridCol({ span: 2 }) { - Row() { - Text(`${index}`) - }.width("100%").height("50vp") - } - .backgroundColor(color) - }) - } - ``` - - ![](figures/span1.png) - -- 当类型为GridColColumnOption时,支持六种不同尺寸(xs, sm, md, lg, xl, xxl)设备中子组件所占列数设置,各个尺寸下数值可不同。 - - ```ts - GridRow({ columns: 8 }) { - ForEach(this.bgColors, (color, index) => { - GridCol({ span: { xs: 1, sm: 2, md: 3, lg: 4 } }) { - Row() { - Text(`${index}`) - }.width("100%").height("50vp") - } - .backgroundColor(color) - }) - } - ``` - - ![](figures/span2.gif) - -### offset - -栅格子组件相对于前一个子组件的偏移列数,默认为0。 -- 当类型为number时,子组件偏移相同列数。 - - ```ts - GridRow() { - ForEach(this.bgColors, (color, index) => { - GridCol({ offset: 2 }) { - Row() { - Text("" + index) - }.width("100%").height("50vp") - } - .backgroundColor(color) - }) - } - ``` - - ![](figures/offset1.png) - - 栅格默认分成12列,每一个子组件默认占1列,偏移2列,每个子组件及间距共占3列,一行放四个子组件。 - - -- 当类型为GridColColumnOption时,支持六种不同尺寸(xs, sm, md, lg, xl, xxl)设备中子组件所占列数设置,各个尺寸下数值可不同。 - - ```ts - GridRow() { - ForEach(this.bgColors, (color, index) => { - GridCol({ offset: { xs: 1, sm: 2, md: 3, lg: 4 } }) { - Row() { - Text("" + index) - }.width("100%").height("50vp") - } - .backgroundColor(color) - }) - } - ``` - - ![](figures/offset2.gif) - -### order - - 栅格子组件的序号,决定子组件排列次序。当子组件不设置order或者设置相同的order, 子组件按照代码顺序展示。当子组件设置不同的order时,order较小的组件在前,较大的在后。 - 当子组件部分设置order,部分不设置order时,未设置order的子组件依次排序靠前,设置了order的子组件按照数值从小到大排列。 - - -- 当类型为number时,子组件在任何尺寸下排序次序一致。 - - ```ts - GridRow() { - GridCol({ order: 5 }) { - Row() { - Text("1") - }.width("100%").height("50vp") - }.backgroundColor(Color.Red) - GridCol({ order: 4 }) { - Row() { - Text("2") - }.width("100%").height("50vp") - }.backgroundColor(Color.Orange) - GridCol({ order: 3 }) { - Row() { - Text("3") - }.width("100%").height("50vp") - }.backgroundColor(Color.Yellow) - GridCol({ order: 2 }) { - Row() { - Text("4") - }.width("100%").height("50vp") - }.backgroundColor(Color.Green) - } - ``` - - ![](figures/order1.png) -- 当类型为GridColColumnOption时,支持六种不同尺寸(xs, sm, md, lg, xl, xxl)设备中子组件排序次序设置。 - - ```ts - GridRow() { - GridCol({ order: { xs:1, sm:5, md:3, lg:7}}) { - Row() { - Text("1") - }.width("100%").height("50vp") - }.backgroundColor(Color.Red) - GridCol({ order: { xs:2, sm:2, md:6, lg:1} }) { - Row() { - Text("2") - }.width("100%").height("50vp") - }.backgroundColor(Color.Orange) - GridCol({ order: { xs:3, sm:3, md:1, lg:6} }) { - Row() { - Text("3") - }.width("100%").height("50vp") - }.backgroundColor(Color.Yellow) - GridCol({ order: { xs:4, sm:4, md:2, lg:5} }) { - Row() { - Text("4") - }.width("100%").height("50vp") - }.backgroundColor(Color.Green) - } - ``` - - ![](figures/order2.gif) - - diff --git a/zh-cn/application-dev/ui/ui-ts-layout-grid.md b/zh-cn/application-dev/ui/ui-ts-layout-grid.md deleted file mode 100644 index 28099d42680db276c42ad1f1de0441fa02bca1ea..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/ui/ui-ts-layout-grid.md +++ /dev/null @@ -1,273 +0,0 @@ -# 网格布局 - -网格布局(GridLayout)是自适应布局中一种重要的布局,具备较强的页面均分能力,子组件占比控制能力。 -通过[Grid](../reference/arkui-ts/ts-container-grid.md)容器组件和子组件[GridItem](../reference/arkui-ts/ts-container-griditem.md)实现, -Grid用于设置网格布局相关参数,GridItem定义子组件相关特征。优势如下: - -1. 容器组件尺寸发生变化时,所有子组件以及间距等比例调整,实现布局的自适应能力。 -2. 支持自定义网格布局行数和列数,以及每行每列尺寸占比。 -3. 支持设置网格布局中子组件的行列间距。 -4. 支持设置子组件横跨几行或者几列。 - - - -## 容器组件Grid设置 - -### 行列数量占比 -通过Grid的组件的columnsTemplate和rowTemplate属性设置网格布局行列数量与尺寸占比。 - -下面以columnsTemplate为例,介绍该属性的设置,该属性值是一个由多个空格和'数字+fr'间隔拼接的字符串,fr的个数即网格布局的列数,fr前面的数值大小,用于计算该列在网格布局宽度上的占比,最终决定该列的宽度。 - -```ts -struct GridExample { - @State Number: Array = ['1', '2', '3', '4'] - - build() { - Column({ space: 5 }) { - Grid() { - ForEach(this.Number, (num: string) => { - GridItem() { - Text(`列${num}`) - .fontSize(16) - .textAlign(TextAlign.Center) - .backgroundColor(0xd0d0d0) - .width('100%') - .height('100%') - .borderRadius(5) - } - }) - } - .columnsTemplate('1fr 1fr 1fr 1fr') - .rowsTemplate('1fr') - .columnsGap(10) - .rowsGap(20) - .width('90%') - .backgroundColor(0xF0F0F0) - .height(100) - }.width('100%') - } -} -``` - -定义了四个等分的列,每列宽度相等。 - -```ts -struct GridExample { - @State Number: Array = ['1', '2', '3', '4'] - - build() { - Column({ space: 5 }) { - Grid() { - ForEach(this.Number, (num: string) => { - GridItem() { - Text(`列${num}`) - .fontSize(16) - .textAlign(TextAlign.Center) - .backgroundColor(0xd0d0d0) - .width('100%') - .height('100%') - .borderRadius(5) - } - }) - } - .columnsTemplate('1fr 2fr 3fr 4fr') - .rowsTemplate('1fr') - .columnsGap(10) - .rowsGap(20) - .width('90%') - .backgroundColor(0xF0F0F0) - .height(100) - }.width('100%') - } -} -``` - -定义了四列,每列宽度比值为1:2:3:4。 - -```ts -struct GridExample { - @State Number: Array = ['1', '2', '3'] - - build() { - Column({ space: 5 }) { - Grid() { - ForEach(this.Number, (num: string) => { - GridItem() { - Text(`列${num}`) - .fontSize(16) - .textAlign(TextAlign.Center) - .backgroundColor(0xd0d0d0) - .width('100%') - .height('100%') - .borderRadius(5) - } - }) - } - .columnsTemplate('4fr 2fr 3fr') - .rowsTemplate('1fr') - .columnsGap(10) - .rowsGap(20) - .width('90%') - .backgroundColor(0xF0F0F0) - .height(100) - }.width('100%') - } -} -``` - -定义了三列,每列宽度比值为4:2:3。 - -效果如下: - -![](figures/columnTemplate.png) - -### 排列方式 - -通过layoutDirection可以设置网格布局的主轴方向,决定子组件的排列方式。 -可选值包括Row,RowReverse, Column, ColumnReverse四种情况。 -效果如下: - -![](figures/gridlayout.png) - -### 行列间距 - -columnsGap用于设置网格子组件GridItem垂直方向的间距,rowsGap用于设置GridItem水平方向的间距。 - -```ts -Grid() -.columnsTemplate('1fr 1fr 1fr 1fr') -.columnsGap(10) -.rowsGap(20) -``` - -![](figures/columnGap.png) - -上图中,设置网格布局子组件间的垂直间距为20,水平间距为10。 - -## 网格子组件GridItem设置 - -### 设置子组件占的行列数 - -网格布局的行列标号从1开始,依次编号。 - -子组件横跨多行时,通过rowStart设置子组件起始行编号,rowEnd设置终点行编号。当rowStart值与rowEnd值相同时,子组件只占一个网格。示例如下: - -```ts -Grid() { - GridItem() { - Text('5') - .fontSize(16) - .textAlign(TextAlign.Center) - .textStyle() - }.rowStart(2).rowEnd(3) // 5子组件从第二行到第三行 - - GridItem() { - Text('4') - .fontSize(16) - .textAlign(TextAlign.Center) - .textStyle() - }.columnStart(4).columnEnd(5) // 4从第四列到第五列 - - GridItem() { - Text('6') - .fontSize(16) - .textAlign(TextAlign.Center) - .textStyle() - }.columnStart(2).columnEnd(4) // 6从第二列到第四列 - - GridItem() { - Text('9') - .fontSize(16) - .textAlign(TextAlign.Center) - .textStyle() - }.columnStart(3).columnEnd(4) // 从第三列到第四列 -} -.columnsTemplate('1fr 1fr 1fr 1fr 1fr') -.rowsTemplate('1fr 1fr 1fr') -.columnsGap(10) -.rowsGap(20) -.width('90%') -.backgroundColor(0xF0F0F0) -.height('200vp') -.layoutDirection(GridDirection.Column) -``` - -![](figures/griditem.png) - -## 场景示例 - -使用grid布局实现一个计算器的排布效果,代码如下: - -```ts -@Entry -@Component -struct GridExample { - @State Number: Array = ['1', '2', '3', '+', '4', '5', '6', '-', '7', '8', '9', '*', '0', '.', '/'] - - @Styles textStyle(){ - .backgroundColor(0xd0d0d0) - .width('100%') - .height('100%') - .borderRadius(5) - } - - build() { - Column({ space: 5 }) { - Grid() { - GridItem() { - Text('0') - .fontSize(30) - .textStyle() - }.columnStart(1).columnEnd(4) - - GridItem() { - Text('清空') - .fontSize(16) - .textAlign(TextAlign.Center) - .textStyle() - }.columnStart(1).columnEnd(2) - - GridItem() { - Text('回退') - .fontSize(16) - .textAlign(TextAlign.Center) - .textStyle() - }.columnStart(3).columnEnd(4) - - ForEach(this.Number, (day: string) => { - if (day === '0') { - GridItem() { - Text(day) - .fontSize(16) - .textAlign(TextAlign.Center) - .textStyle() - }.columnStart(1).columnEnd(2) - } else { - GridItem() { - Text(day) - .fontSize(16) - .textAlign(TextAlign.Center) - .textStyle() - } - } - }) - } - .columnsTemplate('1fr 1fr 1fr 1fr') - .rowsTemplate('2fr 1fr 1fr 1fr 1fr 1fr') - .columnsGap(10) - .rowsGap(15) - .width('90%') - .backgroundColor(0xF0F0F0) - .height('70%') - }.width('100%').margin({ top: 5 }) - } -} -``` - -在大屏设备上展示效果如下: - -![](figures/gridExp1.png) - -在小屏设备下展示效果如下: - -![](figures/gridExp2.png) diff --git a/zh-cn/application-dev/ui/ui-ts-layout-linear.md b/zh-cn/application-dev/ui/ui-ts-layout-linear.md deleted file mode 100644 index 0e89b56ad71bb008cae24b6b3151ea7464cd7862..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/ui/ui-ts-layout-linear.md +++ /dev/null @@ -1,370 +0,0 @@ -# 线性布局 - -线性布局(LinearLayout)是开发中最常用的布局。线性布局的子组件在线性方向上(水平方向和垂直方向)依次排列。 - -通过线性容器[Row](../reference/arkui-ts/ts-container-row.md)和[Column](../reference/arkui-ts/ts-container-column.md)实现线性布局。Column容器内子组件按照垂直方向排列,Row组件中,子组件按照水平方向排列。 - -## 线性布局的排列 - -线性布局的排列方向由所选容器组件决定。根据不同的排列方向,选择使用Row或Column容器创建线性布局,通过调整space,alignItems,justifyContent属性调整子组件的间距,水平垂直方向的对齐方式。 -1. 通过space参数设置主轴(排列方向)上子组件的间距。达到各子组件在排列方向上的等间距效果。 -2. 通过alignItems属性设置子组件在交叉轴(排列方向的垂直方向)的对齐方式。且在各类尺寸屏幕中,表现一致。其中,交叉轴为垂直方向时,取值为[VerticalAlign类型](../reference/arkui-ts/ts-appendix-enums.md#verticalalign),水平方向取值为[HorizontalAlign类型](../reference/arkui-ts/ts-appendix-enums.md#horizontalalign)。 -3. 通过justifyContent属性设置子组件在主轴(排列方向)上的对齐方式。实现布局的自适应均分能力。取值为[FlexAlign类型](../reference/arkui-ts/ts-appendix-enums.md#flexalign)。 - -具体使用以及效果如下表所示: - -|属性名|描述|Row效果图|Column效果图| -|------|---------------------------|----------------------------|---------------------------| -|space |- 横向布局中各子组件的在水平方向的间距
- 纵向布局中个子组件垂直方向间距| ![](figures/rowspace.png) | ![](figures/columnspace.png) | -|alignItems |容器排列方向的垂直方向上,子组件在父容器中的对齐方式|![](figures/rowalign.png) |![](figures/columnalign.png)| -|justifyContent |容器排列方向上,子组件在父容器中的对齐方式 |![](figures/rowjustify.png) |![](figures/columnjustify.png)| - -## 自适应拉伸 - -在线性布局下,常用空白填充组件[Blank](../reference/arkui-ts/ts-basic-components-blank.md),在容器主轴方向自动填充空白空间,达到自适应拉伸效果。 - -```ts -@Entry -@Component -struct BlankExample { - build() { - Column() { - Row() { - Text('Bluetooth').fontSize(18) - Blank() - Toggle({ type: ToggleType.Switch, isOn: true }) - }.backgroundColor(0xFFFFFF).borderRadius(15).padding({ left: 12 }).width('100%') - }.backgroundColor(0xEFEFEF).padding(20).width('100%') - } -} -``` - -![](figures/blank.gif) - -## 自适应缩放 - -自适应缩放是指在各种不同大小设备中,子组件按照预设的比例,尺寸随容器尺寸的变化而变化。在线性布局中有下列方法实现: - -1. 父容器尺寸确定时,设置了layoutWeight属性的子组件与兄弟元素占主轴尺寸按照权重进行分配,忽略元素本身尺寸设置,在任意尺寸设备下,自适应占满剩余空间。 - - ```ts - @Entry - @Component - struct layoutWeightExample { - build() { - Column() { - Text('1:2:3').width('100%') - Row() { - Column() { - Text('layoutWeight(1)') - .textAlign(TextAlign.Center) - }.layoutWeight(2).backgroundColor(0xffd306).height('100%') - - Column() { - Text('layoutWeight(2)') - .textAlign(TextAlign.Center) - }.layoutWeight(4).backgroundColor(0xffed97).height('100%') - - Column() { - Text('layoutWeight(6)') - .textAlign(TextAlign.Center) - }.layoutWeight(6).backgroundColor(0xffd306).height('100%') - - }.backgroundColor(0xffd306).height('30%') - - Text('2:5:3').width('100%') - Row() { - Column() { - Text('layoutWeight(2)') - .textAlign(TextAlign.Center) - }.layoutWeight(2).backgroundColor(0xffd306).height('100%') - - Column() { - Text('layoutWeight(5)') - .textAlign(TextAlign.Center) - }.layoutWeight(5).backgroundColor(0xffed97).height('100%') - - Column() { - Text('layoutWeight(3)') - .textAlign(TextAlign.Center) - }.layoutWeight(3).backgroundColor(0xffd306).height('100%') - }.backgroundColor(0xffd306).height('30%') - } - } - } - ``` - - ![](figures/layoutWeight.gif) - - -3. 父容器尺寸确定时,使用百分比设置子组件以及兄弟组件的width宽度,可以保证各自元素在任意尺寸下的自适应占比。 - - ```ts - @Entry - @Component - struct WidthExample { - build() { - Column() { - Row() { - Column() { - Text('left width 20%') - .textAlign(TextAlign.Center) - }.width('20%').backgroundColor(0xffd306).height('100%') - - Column() { - Text('center width 50%') - .textAlign(TextAlign.Center) - }.width('50%').backgroundColor(0xffed97).height('100%') - - Column() { - Text('right width 30%') - .textAlign(TextAlign.Center) - }.width('30%').backgroundColor(0xffd306).height('100%') - }.backgroundColor(0xffd306).height('30%') - } - } - } - ``` - - ![](figures/width.gif) - - 上例中,在任意大小的设备中,子组件的宽度占比固定。 - -## 定位能力 -- 相对定位 - - 使用组件的[offset属性](../reference/arkui-ts/ts-universal-attributes-location.md)可以实现相对定位,设置元素相对于自身的偏移量。设置该属性,不影响父容器布局,仅在绘制时进行位置调整。使用线性布局和offset可以实现大部分布局的开发。 - - ```ts - @Entry - @Component - struct OffsetExample { - @Styles eleStyle() { - .size({ width: 120, height: '50' }) - .backgroundColor(0xbbb2cb) - .border({ width: 1 }) - } - - build() { - Column({ space: 20 }) { - Row() { - Text('1').size({ width: '15%', height: '50' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(16) - Text('2 offset(15, 30)') - .eleStyle() - .fontSize(16) - .align(Alignment.Start) - .offset({ x: 15, y: 30 }) - Text('3').size({ width: '15%', height: '50' }).backgroundColor(0xdeb887).border({ width: 1 }).fontSize(16) - Text('4 offset(-10%, 20%)') - .eleStyle() - .fontSize(16) - .offset({ x: '-5%', y: '20%' }) - }.width('90%').height(150).border({ width: 1, style: BorderStyle.Dashed }) - } - .width('100%') - .margin({ top: 25 }) - } - } - ``` - - ![](figures/offset.gif) - - -- 绝对定位 - - 线性布局中可以使用组件的[positon属性](../reference/arkui-ts/ts-universal-attributes-location.md)实现绝对布局(AbsoluteLayout),设置元素左上角相对于父容器左上角偏移位置。对于不同尺寸的设备,使用绝对定位的适应性会比较差,在屏幕的适配上有缺陷。 - - ```ts - @Entry - @Component - struct PositionExample { - @Styles eleStyle(){ - .backgroundColor(0xbbb2cb) - .border({ width: 1 }) - .size({ width: 120, height: 50 }) - } - - build() { - Column({ space: 20 }) { - // 设置子组件左上角相对于父组件左上角的偏移位置 - Row() { - Text('position(30, 10)') - .eleStyle() - .fontSize(16) - .position({ x: 10, y: 10 }) - - Text('position(50%, 70%)') - .eleStyle() - .fontSize(16) - .position({ x: '50%', y: '70%' }) - - Text('position(10%, 90%)') - .eleStyle() - .fontSize(16) - .position({ x: '10%', y: '80%' }) - }.width('90%').height('100%').border({ width: 1, style: BorderStyle.Dashed }) - } - .width('90%').margin(25) - } - } - ``` - - ![](figures/position.gif) - - -## 自适应延伸 - -自适应延伸是在不同尺寸设备下,当页面显示内容个数不一并延伸到屏幕外时,可通过滚动条拖动展示。适用于线性布局中内容无法一屏展示的场景。常见以下两类实现方法。 - - -- List组件 - - List子项过多一屏放不下时,未展示的子项通过滚动条拖动显示。通过scrollBar属性设置滚动条的常驻状态,edgeEffect属性设置拖动到极限的回弹效果。 - - - 纵向List: - ```ts - @Entry - @Component - struct ListExample1 { - @State arr: string[] = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15"] - @State alignListItem: ListItemAlign = ListItemAlign.Start - - build() { - Column() { - List({ space: 20, initialIndex: 0 }) { - ForEach(this.arr, (item) => { - ListItem() { - Text('' + item) - .width('100%') - .height(100) - .fontSize(16) - .textAlign(TextAlign.Center) - .borderRadius(10) - .backgroundColor(0xFFFFFF) - } - .border({ width: 2, color: Color.Green }) - }, item => item) - } - .border({ width: 2, color: Color.Red, style: BorderStyle.Dashed }) - .scrollBar(BarState.On) // 滚动条常驻 - .edgeEffect(EdgeEffect.Spring) // 滚动到边缘再拖动回弹效果 - - }.width('100%').height('100%').backgroundColor(0xDCDCDC).padding(20) - } - } - ``` - - ![](figures/listcolumn.gif) - - - 横向List: - - ```ts - @Entry - @Component - struct ListExample2 { - @State arr: string[] = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15"] - @State alignListItem: ListItemAlign = ListItemAlign.Start - - build() { - Column() { - List({ space: 20, initialIndex: 0 }) { - ForEach(this.arr, (item) => { - ListItem() { - Text('' + item) - .height('100%') - .width(100) - .fontSize(16) - .textAlign(TextAlign.Center) - .borderRadius(10) - .backgroundColor(0xFFFFFF) - } - .border({ width: 2, color: Color.Green }) - }, item => item) - } - .border({ width: 2, color: Color.Red, style: BorderStyle.Dashed }) - .scrollBar(BarState.On) // 滚动条常驻 - .edgeEffect(EdgeEffect.Spring) // 滚动到边缘再拖动回弹效果 - .listDirection(Axis.Horizontal) // 列表水平排列 - }.width('100%').height('100%').backgroundColor(0xDCDCDC).padding(20) - } - } - ``` - - ![](figures/listrow.gif) - -- Scroll组件 - - 线性布局中,当子组件的布局尺寸超过父组件的尺寸时,内容可以滚动。在Column或者Row外层包裹一个可滚动的容器组件Scroll实现。 - - 纵向Scroll: - - ```ts - @Entry - @Component - struct ScrollExample { - scroller: Scroller = new Scroller(); - private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; - - build() { - Scroll(this.scroller) { - Column() { - ForEach(this.arr, (item) => { - Text(item.toString()) - .width('90%') - .height(150) - .backgroundColor(0xFFFFFF) - .borderRadius(15) - .fontSize(16) - .textAlign(TextAlign.Center) - .margin({ top: 10 }) - }, item => item) - }.width('100%') - } - .backgroundColor(0xDCDCDC) - .scrollable(ScrollDirection.Vertical) // 滚动方向纵向 - .scrollBar(BarState.On) // 滚动条常驻显示 - .scrollBarColor(Color.Gray) // 滚动条颜色 - .scrollBarWidth(30) // 滚动条宽度 - .edgeEffect(EdgeEffect.Spring) // 滚动到边沿后回弹 - } - } - ``` - - ![](figures/scrollcolumn.gif) - - 横向Scroll: - - ```ts - @Entry - @Component - struct ScrollExample { - scroller: Scroller = new Scroller(); - private arr: number[] = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]; - - build() { - Scroll(this.scroller) { - Row() { - ForEach(this.arr, (item) => { - Text(item.toString()) - .height('90%') - .width(150) - .backgroundColor(0xFFFFFF) - .borderRadius(15) - .fontSize(16) - .textAlign(TextAlign.Center) - .margin({ left: 10 }) - }, item => item) - }.height('100%') - } - .backgroundColor(0xDCDCDC) - .scrollable(ScrollDirection.Horizontal) // 滚动方向横向 - .scrollBar(BarState.On) // 滚动条常驻显示 - .scrollBarColor(Color.Gray) // 滚动条颜色 - .scrollBarWidth(30) // 滚动条宽度 - .edgeEffect(EdgeEffect.Spring) // 滚动到边沿后回弹 - } - } - ``` - ![](figures/scrollrow.gif) diff --git a/zh-cn/application-dev/ui/ui-ts-layout-mediaquery.md b/zh-cn/application-dev/ui/ui-ts-layout-mediaquery.md deleted file mode 100644 index 6da6959c439004112f76ed51d92439306fb64edc..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/ui/ui-ts-layout-mediaquery.md +++ /dev/null @@ -1,168 +0,0 @@ -# 媒体查询 - -[媒体查询(Media Query)](../reference/apis/js-apis-mediaquery.md)作为响应式设计的核心,在移动设备上应用十分广泛。它根据不同设备类型或同设备不同状态修改应用的样式。媒体查询的优势有: - -1. 提供丰富的媒体特征监听能力,针对设备和应用的属性信息(比如显示区域、深浅色、分辨率),设计出相匹配的布局。 - -2. 当屏幕发生动态改变时(比如分屏、横竖屏切换),同步更新应用的页面布局。 - - - -## 媒体查询引入与使用流程 - -媒体查询通过媒体查询接口,设置查询条件并绑定回调函数,在对应的条件的回调函数里更改页面布局或者实现业务逻辑,实现页面的响应式设计。具体步骤如下: - -首先导入媒体查询模块。 - -```ts -import mediaquery from '@ohos.mediaquery' -``` - -通过matchMediaSync接口设置媒体查询条件,保存返回的条件监听句柄listener。 - -```ts -listener = mediaquery.matchMediaSync('(orientation: landscape)') -``` - -给条件监听句柄listener绑定回调函数onPortrait,当listener检测设备状态变化时执行回调函数。在回调函数内,根据不同设备状态更改页面布局或者实现业务逻辑。 - -```ts -onPortrait(mediaQueryResult) { - if (mediaQueryResult.matches) { - // do something here - } else { - // do something here - } -} -listener.on('change', onPortrait) -``` - -## 媒体查询条件 - -媒体查询条件由媒体类型,逻辑操作符,媒体特征组成,其中媒体类型可省略,逻辑操作符用于连接不同媒体类型与媒体特征,其中,媒体特征要使用()包裹且可以有多个。具体规则如下: - -### 语法规则 - -``` -[media-type] [and|not|only] [(media-feature)] -``` - -例如: - -`screen and (round-screen: true)` :当设备屏幕是圆形时条件成立。 - -`(max-height: 800)` :当高度小于等于800时条件成立。 - -`(height <= 800) ` :当高度小于等于800时条件成立。 - -`screen and (device-type: tv) or (resolution < 2)` :包含多个媒体特征的多条件复杂语句查询,当设备类型为tv或设备分辨率小于2时条件成立。 - -### 媒体类型(media-type) - -| 类型 | 说明 | -| ------ | -------------- | -| screen | 按屏幕相关参数进行媒体查询。 | - -### 媒体逻辑操作(and|or|not|only) - -媒体逻辑操作符:and、or、not、only用于构成复杂媒体查询,也可以通过comma(, )将其组合起来,详细解释说明如下表。 - - **表1** 媒体逻辑操作符 - -| 类型 | 说明 | -| -------- | ---------------------------------------- | -| and | 将多个媒体特征(Media  Feature)以“与”的方式连接成一个媒体查询,只有当所有媒体特征都为true,查询条件成立。另外,它还可以将媒体类型和媒体功能结合起来。
例如:screen  and  (device-type:  wearable)  and  (max-height:  600)  表示当设备类型是智能穿戴且应用的最大高度小于等于600个像素单位时成立。 | -| or | 将多个媒体特征以“或”的方式连接成一个媒体查询,如果存在结果为true的媒体特征,则查询条件成立。
例如:screen  and  (max-height:  1000)  or  (round-screen:true)表示当应用高度小于等于1000个像素单位或者设备屏幕是圆形时,条件成立。 | -| not | 取反媒体查询结果,媒体查询结果不成立时返回true,否则返回false。
例如:not  screen  and  (min-height:  50)  and  (max-height:  600)  表示当应用高度小于50个像素单位或者大于600个像素单位时成立。
使用not运算符时必须指定媒体类型。 | -| only | 当整个表达式都匹配时,才会应用选择的样式,可以应用在防止某些较早的版本的浏览器上产生歧义的场景。一些较早版本的浏览器对于同时包含了媒体类型和媒体特征的语句会产生歧义,比如:
screen  and  (min-height:  50)
老版本浏览器会将这句话理解成screen,从而导致仅仅匹配到媒体类型(screen),就应用了指定样式,使用only可以很好地规避这种情况。
使用only时必须指定媒体类型。 | -| , (comma) | 将多个媒体特征以“或”的方式连接成一个媒体查询,如果存在结果为true的媒体特征,则查询条件成立。其效果等同于or运算符。
例如:screen  and  (min-height:  1000),     (round-screen:true)  表示当应用高度大于等于1000个像素单位或者设备屏幕是圆形时,条件成立。 | - -在MediaQuery Level 4中引入了范围查询,使其能够使用max-,min-的同时,也支持了< =,> =,< ,> 操作符。 - - **表2** 媒体逻辑范围操作符 - -| 类型 | 说明 | -| ----- | ---------------------------------------- | -| < = | 小于等于,例如:screen  and  (height  < =  50)。 | -| > = | 大于等于,例如:screen  and  (height  > =  600)。 | -| < | 小于,例如:screen  and  (height  <   50)。 | -| > | 大于,例如:screen  and  (height  >   600)。 | - -### 媒体特征(media-feature) - -| 类型 | 说明 | -| ----------------- | ------------------------------------------------------------ | -| height | 应用页面显示区域的高度。 | -| min-height | 应用页面显示区域的最小高度。 | -| max-height | 应用页面显示区域的最大高度。 | -| width | 应用页面显示区域的宽度。 | -| min-width | 应用页面显示区域的最小宽度。 | -| max-width | 应用页面显示区域的最大宽度。 | -| resolution | 设备的分辨率,支持dpi,dppx和dpcm单位。其中:
-  dpi表示每英寸中物理像素个数,1dpi≈0.39dpcm;
-  dpcm表示每厘米上的物理像素个数,1dpcm  ≈  2.54dpi;
-  dppx表示每个px中的物理像素数(此单位按96px=1英寸为基准,与页面中的px单位计算方式不同),1dppx  =  96dpi。 | -| min-resolution | 设备的最小分辨率。 | -| max-resolution | 设备的最大分辨率。 | -| orientation | 屏幕的方向。
可选值:
-  orientation:  portrait(设备竖屏)
-  orientation:  landscape(设备横屏) | -| device-height | 设备的高度。 | -| min-device-height | 设备的最小高度。 | -| max-device-height | 设备的最大高度。 | -| device-width | 设备的宽度。 | -| device-type | 设备的类型。
可选值:default | -| min-device-width | 设备的最小宽度。 | -| max-device-width | 设备的最大宽度。 | -| round-screen | 屏幕类型,圆形屏幕为true,  非圆形屏幕为  false。 | -| dark-mode | 系统为深色模式时为true,否则为false。 | - -## 场景示例 - -下例中使用媒体查询,实现屏幕横竖屏切换时给页面文本应用不同的内容和样式的效果。 - -```ts -import mediaquery from '@ohos.mediaquery' - -let portraitFunc = null - -@Entry -@Component -struct MediaQueryExample { - @State color: string = '#DB7093' - @State text: string = 'Portrait' - listener = mediaquery.matchMediaSync('(orientation: landscape)') // 当设备横屏时条件成立 - - onPortrait(mediaQueryResult) { - if (mediaQueryResult.matches) { - this.color = '#FFD700' - this.text = 'Landscape' - } else { - this.color = '#DB7093' - this.text = 'Portrait' - } - } - - aboutToAppear() { - portraitFunc = this.onPortrait.bind(this) // 绑定当前应用实例 - this.listener.on('change', portraitFunc) - } - - build() { - Flex({ direction: FlexDirection.Column, alignItems: ItemAlign.Center, justifyContent: FlexAlign.Center }) { - Text(this.text).fontSize(50).fontColor(this.color) - } - .width('100%').height('100%') - } -} -``` - -横屏下文本内容为Landscape,颜色为#FFD700。 - -![zh-cn_image_0000001262954829](figures/zh-cn_image_0000001262954829.png) - -非横屏下文本内容为Portrait,颜色为#DB7093。 - -![zh-cn_image_0000001263074739](figures/zh-cn_image_0000001263074739.png) - -## 相关实例 - -使用媒体查询的自适应布局开发,有以下相关实例可供参考: - -- [`MediaQuery`:媒体查询(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/UI/ArkTsComponentClollection/MediaQuery) - diff --git a/zh-cn/application-dev/ui/ui-ts-layout-stack.md b/zh-cn/application-dev/ui/ui-ts-layout-stack.md deleted file mode 100644 index 19f7026c6f9868826fb716afeaaf0bf37e715b57..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/ui/ui-ts-layout-stack.md +++ /dev/null @@ -1,61 +0,0 @@ -# 层叠布局 - -层叠布局(StackLayout)用于在屏幕上预留一块区域来显示组件中的元素,提供元素可以重叠的布局。 -通过层叠容器[Stack](../reference/arkui-ts/ts-container-stack.md)实现,容器中的子元素依次入栈,后一个子元素覆盖前一个子元素显示。 - -## 对齐方式 - -设置子元素在容器内的对齐方式。支持左上,上中,右上,左,中,右,右下,中下,右下九种对齐方式,如下表所示: - -|名称| 描述| 图示 | -|---| ---|---| -|TopStart| 顶部起始端 |![](figures/stacktopstart.png)| -Top |顶部横向居中 |![](figures/stacktop.png)| -TopEnd| 顶部尾端 |![](figures/stacktopend.png)| -Start| 起始端纵向居中 |![](figures/stackstart.png)| -Center| 横向和纵向居中 |![](figures/stackcenter.png)| -End| 尾端纵向居中 |![](figures/stackend.png)| -BottomStart |底部起始端 |![](figures/stackbottomstart.png)| -Bottom| 底部横向居中 |![](figures/stackbottom.png)| -BottomEnd| 底部尾端 |![](figures/stackbottomend.png)| - -## Z序控制 - -Stack容器中兄弟组件显示层级关系可以通过[zIndex](../reference/arkui-ts/ts-universal-attributes-z-order.md) -属性改变。zIndex值越大,显示层级越高,即zIndex值大的组件会覆盖在zIndex值小的组件上方。 - -- 在层叠布局中,如果后面子元素尺寸大于前面子元素尺寸,则前面子元素完全隐藏。 - - ```ts - Stack({ alignContent: Alignment.BottomStart }) { - Column() { - Text('Stack子元素1').textAlign(TextAlign.End).fontSize(20) - }.width(100).height(100).backgroundColor(0xffd306) - Column() { - Text('Stack子元素2').fontSize(20) - }.width(150).height(150).backgroundColor(Color.Pink) - Column() { - Text('Stack子元素3').fontSize(20) - }.width(200).height(200).backgroundColor(Color.Grey) - }.margin({ top: 100 }).width(350).height(350).backgroundColor(0xe0e0e0) - ``` - - ![](figures/stack2.png) - - 上图中,最后的子元素3的尺寸大于前面的所有子元素,所以,前面两个元素完全隐藏。改变子元素1,子元素2的zIndex属性后,可以将元素展示出来。 - - ```ts - Stack({ alignContent: Alignment.BottomStart }) { - Column() { - Text('Stack子元素1').fontSize(20) - }.width(100).height(100).backgroundColor(0xffd306).zIndex(2) - Column() { - Text('Stack子元素2').fontSize(20) - }.width(150).height(150).backgroundColor(Color.Pink).zIndex(1) - Column() { - Text('Stack子元素3').fontSize(20) - }.width(200).height(200).backgroundColor(Color.Grey) - }.margin({ top: 100 }).width(350).height(350).backgroundColor(0xe0e0e0) - ``` - - ![](figures/stack1.png) diff --git a/zh-cn/application-dev/ui/ui-ts-overview.md b/zh-cn/application-dev/ui/ui-ts-overview.md deleted file mode 100644 index 2ea4568505d0858da89a57ad21687a034763a525..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/ui/ui-ts-overview.md +++ /dev/null @@ -1,89 +0,0 @@ -# 概述 - - -基于ArkTS的声明式开发范式的方舟开发框架是一套开发极简、高性能、支持跨设备的UI开发框架,支持开发者高效地构建OpenHarmony应用UI界面。 - -## 基础能力 - -使用基于ArkTS的声明式开发范式的方舟开发框架,采用更接近自然语义的编程方式,让开发者可以直观地描述UI界面,不必关心框架如何实现UI绘制和渲染,实现极简高效开发。开发框架不仅从组件、动画和状态管理三个维度来提供UI能力,还提供了系统能力接口以实现系统能力的极简调用。 -ArkTS语言的基础知识请参考[学习ArkTS语言](../quick-start/arkts-get-started.md)文档;此外,请参考[基于ArkTS的声明式开发范式API](../reference/arkui-ts/ts-universal-events-click.md)文档,全面地了解内置组件,更好地开发应用。 - -- **开箱即用的组件** - - 框架提供丰富的系统内置组件,可以通过链式调用的方式设置系统组件的渲染效果。开发者可以组合系统组件为自定义组件,通过这种方式将页面组件化为一个个独立的UI单元,实现页面不同单元的独立创建、开发和复用,使页面具有更强的工程性。 - -- **丰富的动效接口** - - 提供svg标准的绘制图形能力,同时开放了丰富的动效接口,开发者可以通过封装的物理模型或者调用动画能力接口来实现自定义动画轨迹。 - -- **状态与数据管理** - - 状态数据管理作为基于ArkTS的声明式开发范式的特色,通过功能不同的装饰器给开发者提供了清晰的页面更新渲染流程和管道。状态管理包括UI组件状态和应用程序状态,两者协作可以使开发者完整地构建整个应用的数据更新和UI渲染。 - -- **系统能力接口** - - 使用基于ArkTS的声明式开发范式的方舟开发框架,还封装了丰富的系统能力接口,开发者可以通过简单的接口调用,实现从UI设计到系统能力调用的极简开发。 - - -## 整体架构 - -![zh-cn_image_0000001169532276](figures/zh-cn_image_0000001169532276.png) - -- **声明式UI前端** - - 提供了UI开发范式的基础语言规范,并提供内置的UI组件、布局和动画,提供了多种状态管理机制,为应用开发者提供一系列接口支持。 - -- **语言运行时** - - 选用方舟语言运行时,提供了针对UI范式语法的解析能力、跨语言调用支持的能力和TS语言高性能运行环境。 - -- **声明式UI后端引擎** - - 后端引擎提供了兼容不同开发范式的UI渲染管线,提供多种基础组件、布局计算、动效、交互事件,提供了状态管理和绘制能力。 - -- **渲染引擎** - - 提供了高效的绘制能力,将渲染管线收集的渲染指令,绘制到屏幕的能力。 - -- **平台适配层** - - 提供了对系统平台的抽象接口,具备接入不同系统的能力,如系统渲染管线、生命周期调度等。 - - -## 相关实例 - -基于ArkTS的声明式开发范式的方舟开发框架,有以下相关实例可供参考: - -- [`Drag`:拖拽事件(ArkTS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/Drag) - -- [`ArkUIAnimation`:动画(ArkTS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/ArkUIAnimation) - -- [`MouseEvent`:鼠标事件(ArkTS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/MouseEvent) - -- [`Chat`:聊天示例应用(ArkTS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/Solutions/IM/Chat) - -- [`Shopping`:购物示例应用(ArkTS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/AppSample/Shopping) - -- [`Lottie`:Lottie(ArkTS)(API9)(Full SDK)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/Solutions/Game/Lottie) - -- [`Flybird`:小鸟避障游戏(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/TaskManagement/Flybird) - -- [`AdaptiveCapabilities`:多设备自适应能力(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/MultiDeviceAppDev/AdaptiveCapabilities) - -- [`Game2048`:2048游戏(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/Solutions/Game/Game2048) - -- [`TransitionAnimation`:转场动画(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/TransitionAnimation) - -- [基础组件Slider的使用(ArkTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/SliderExample) - -- [转场动画的使用(ArkTS)(API9)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/TransitionAnimation) - -- [极简声明式UI范式(ArkTS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/SimpleGalleryEts) - -- [购物应用(ArkTS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/ShoppingEts) - -- [弹窗(ArkTS)(API8)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/CustomDialogEts) - -- [`UpgradePopup`:自定义弹窗(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/UpgradePopup) - -- [ComponentCollection:组件集合(ArkTS)(API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/UI/ArkTsComponentClollection/ComponentCollection) diff --git a/zh-cn/application-dev/ui/ui-ts-page-redirection-data-transmission.md b/zh-cn/application-dev/ui/ui-ts-page-redirection-data-transmission.md deleted file mode 100644 index c5701a8e1470f112a8c9c36bae7efd9aac02f8be..0000000000000000000000000000000000000000 --- a/zh-cn/application-dev/ui/ui-ts-page-redirection-data-transmission.md +++ /dev/null @@ -1,272 +0,0 @@ -# 页面跳转与数据传递 - -本节将学习页面跳转和数据传递,实现: - - -1. 页面跳转:点击食物分类列表页面的食物条目后,跳转到食物详情页;点击食物详情页的返回按钮,返回到食物列表页。 - -2. 页面间数据传递:点击不同的食物条目后,FoodDetail接受前一个页面的数据,渲染对应的食物详情页。 - - -## 页面跳转 - -声明式UI范式提供了两种机制来实现页面间的跳转: - -1. 路由容器组件Navigator,包装了页面路由的能力,指定页面target后,使其包裹的子组件都具有路由能力。 - -2. 路由RouterAPI接口,通过在页面上引入router,可以调用router的各种接口,从而实现页面路由的各种操作。 - -下面我们就分别学习这两种跳转机制来实现食物分类列表页面和食物详情页的链接。 - -1. 点击FoodListItem后跳转到FoodDetail页面。在FoodListItem内创建Navigator组件,使其子组件都具有路由功能,目标页面target为'pages/FoodDetail'。 - ```ts - @Component - struct FoodListItem { - private foodItem: FoodData - build() { - Navigator({ target: 'pages/FoodDetail' }) { - Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { - Image(this.foodItem.image) - .objectFit(ImageFit.Contain) - .height(40) - .width(40) - .backgroundColor('#FFf1f3f5') - .margin({ right: 16 }) - Text(this.foodItem.name) - .fontSize(14) - .flexGrow(1) - Text(this.foodItem.calories + ' kcal') - .fontSize(14) - } - .height(64) - } - .margin({ right: 24, left:32 }) - } - } - ``` - - ![zh-cn_image_0000001215318403](figures/zh-cn_image_0000001215318403.gif) - -2. 点击FoodGridItem后跳转到FoodDetail页面。调用页面路由router模块的push接口,将FoodDetail页面推到路由栈中,实现页面跳转。使用router路由API接口,需要先引入router。 - ```ts - import router from '@ohos.router' - - @Component - struct FoodGridItem { - private foodItem: FoodData - build() { - Column() { - ...... - } - .height(184) - .width('100%') - .onClick(() => { - router.pushUrl({ url: 'pages/FoodDetail' }) - }) - } - } - ``` - - ![zh-cn_image_0000001169918548](figures/zh-cn_image_0000001169918548.gif) - -3. 在FoodDetail页面增加回到食物列表页面的图标。在resources > base > media文件夹下存入回退图标Back.png。新建自定义组件PageTitle,包含后退的图标和Food Detail的文本,调用路由的router.back()接口,弹出路由栈最上面的页面,即返回上一级页面。 - ```ts - // FoodDetail.ets - import router from '@ohos.router' - - @Component - struct PageTitle { - build() { - Flex({ alignItems: ItemAlign.Start }) { - Image($r('app.media.Back')) - .width(21.8) - .height(19.6) - Text('Food Detail') - .fontSize(21.8) - .margin({left: 17.4}) - } - .height(61) - .backgroundColor('#FFedf2f5') - .padding({ top: 13, bottom: 15, left: 28.3 }) - .onClick(() => { - router.back() - }) - } - } - ``` - -4. 在FoodDetail组件内创建Stack组件,包含子组件FoodImageDisplay和PageTitle子组件,设置其对齐方式为左上对齐TopStart。 - ```ts - @Entry - @Component - struct FoodDetail { - build() { - Column() { - Stack( { alignContent: Alignment.TopStart }) { - FoodImageDisplay() - PageTitle() - } - ContentTable() - } - .alignItems(HorizontalAlign.Center) - } - } - ``` - - ![zh-cn_image_0000001214998349](figures/zh-cn_image_0000001214998349.png) - - -## 页面间数据传递 - -我们已经完成了FoodCategoryList页面和FoodDetail页面的跳转和回退,但是点击不同的FoodListItem/FoodGridItem,跳转的FoodDetail页面都是西红柿Tomato的详细介绍,这是因为没有构建起两个页面的数据传递,需要用到携带参数(parameter)路由。 - -1. 在FoodListItem组件的Navigator设置其params属性,params属性接受key-value的Object。 - ```ts - // FoodList.ets - @Component - struct FoodListItem { - private foodItem: FoodData - build() { - Navigator({ target: 'pages/FoodDetail' }) { - ...... - } - .params({ foodData: this.foodItem }) - } - } - ``` - - FoodGridItem调用的routerAPI同样有携带参数跳转的能力,使用方法和Navigator类似。 - - ```ts - router.pushUrl({ - url: 'pages/FoodDetail', - params: { foodData: this.foodItem } - }) - ``` - -2. FoodDetail页面引入FoodData类,在FoodDetail组件内添加foodItem成员变量。 - ```ts - // FoodDetail.ets - import { FoodData } from '../model/FoodData' - - @Entry - @Component - struct FoodDetail { - private foodItem: FoodData - build() { - ...... - } - } - ``` - -3. 获取foodData对应的value。调用router.getParams()['foodData']来获取到FoodCategoryList页面跳转来时携带的foodData对应的数据。 - ```ts - @Entry - @Component - struct FoodDetail { - private foodItem: FoodData = router.getParams()['foodData'] - - build() { - ...... - } - } - ``` - -4. 重构FoodDetail页面的组件。在构建视图时,FoodDetail页面的食物信息都是直接声明的常量,现在要用传递来的FoodData数据来对其进行重新赋值。整体的FoodDetail.ets代码如下。 - ```ts - @Component - struct PageTitle { - build() { - Flex({ alignItems: ItemAlign.Start }) { - Image($r('app.media.Back')) - .width(21.8) - .height(19.6) - Text('Food Detail') - .fontSize(21.8) - .margin({left: 17.4}) - } - .height(61) - .backgroundColor('#FFedf2f5') - .padding({ top: 13, bottom: 15, left: 28.3 }) - .onClick(() => { - router.back() - }) - } - } - - @Component - struct FoodImageDisplay { - private foodItem: FoodData - build() { - Stack({ alignContent: Alignment.BottomStart }) { - Image(this.foodItem.image) - .objectFit(ImageFit.Contain) - Text(this.foodItem.name) - .fontSize(26) - .fontWeight(500) - .margin({ left: 26, bottom: 17.4 }) - } - .height(357) - .backgroundColor('#FFedf2f5') - } - } - - @Component - struct ContentTable { - private foodItem: FoodData - - @Builder IngredientItem(title:string, name: string, value: string) { - Flex() { - Text(title) - .fontSize(17.4) - .fontWeight(FontWeight.Bold) - .layoutWeight(1) - Flex() { - Text(name) - .fontSize(17.4) - .flexGrow(1) - Text(value) - .fontSize(17.4) - } - .layoutWeight(2) - } - } - - build() { - Flex({ direction: FlexDirection.Column, justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Start }) { - this.IngredientItem('Calories', 'Calories', this.foodItem.calories + 'kcal') - this.IngredientItem('Nutrition', 'Protein', this.foodItem.protein + 'g') - this.IngredientItem('', 'Fat', this.foodItem.fat + 'g') - this.IngredientItem('', 'Carbohydrates', this.foodItem.carbohydrates + 'g') - this.IngredientItem('', 'VitaminC', this.foodItem.vitaminC + 'mg') - } - .height(280) - .padding({ top: 30, right: 30, left: 30 }) - } - } - - @Entry - @Component - struct FoodDetail { - private foodItem: FoodData = router.getParams()['foodData'] - - build() { - Column() { - Stack( { alignContent: Alignment.TopStart }) { - FoodImageDisplay({ foodItem: this.foodItem }) - PageTitle() - } - ContentTable({ foodItem: this.foodItem }) - } - .alignItems(HorizontalAlign.Center) - } - } - ``` - -## 相关实例 - -针对页面布局与连接,有以下示例工程可供参考: - -- [`DefiningPageLayoutAndConnection`:页面布局和连接(ArkTS)(API8)](https://gitee.com/openharmony/app_samples/tree/master/ETSUI/DefiningPageLayoutAndConnection) - - 本示例构建了食物分类列表页面和食物详情页,向开发者展示了List布局、Grid布局以及页面路由的基本用法。 diff --git a/zh-cn/application-dev/web/Readme-CN.md b/zh-cn/application-dev/web/Readme-CN.md new file mode 100644 index 0000000000000000000000000000000000000000..cda5e7768fb95460aace66271408b7677fe6d67d --- /dev/null +++ b/zh-cn/application-dev/web/Readme-CN.md @@ -0,0 +1,17 @@ +# Web + +- [Web组件概述](web-component-overview.md) +- [使用Web组件加载页面](web-page-loading-with-web-components.md) +- 设置基本属性和事件 + - [设置深色模式](web-set-dark-mode.md) + - [上传文件](web-file-upload.md) + - [在新窗口中打开页面](web-open-in-new-window.md) + - [管理位置权限](web-geolocation-permission.md) +- 在应用中使用前端页面JavaScript + - [应用侧调用前端页面函数](web-in-app-frontend-page-function-invoking.md) + - [前端页面调用应用侧函数](web-in-page-app-function-invoking.md) + - [建立应用侧与前端页面数据通道](web-app-page-data-channel.md) +- [管理页面跳转及浏览记录导航](web-redirection-and-browsing-history-mgmt.md) +- [管理Cookie及数据存储](web-cookie-and-data-storage-mgmt.md) +- [自定义页面请求响应](web-resource-interception-request-mgmt.md) +- [使用Devtools工具调试前端页面](web-debugging-with-devtools.md) \ No newline at end of file diff --git a/zh-cn/application-dev/web/figures/debug-effect.png b/zh-cn/application-dev/web/figures/debug-effect.png new file mode 100644 index 0000000000000000000000000000000000000000..32c46cadbb99a6623532f50d14fa0750854c9a5d Binary files /dev/null and b/zh-cn/application-dev/web/figures/debug-effect.png differ diff --git a/zh-cn/application-dev/web/figures/resource-path.png b/zh-cn/application-dev/web/figures/resource-path.png new file mode 100644 index 0000000000000000000000000000000000000000..602c750894581e13296cb7cb77e9714f143983f9 Binary files /dev/null and b/zh-cn/application-dev/web/figures/resource-path.png differ diff --git a/zh-cn/application-dev/web/web-app-page-data-channel.md b/zh-cn/application-dev/web/web-app-page-data-channel.md new file mode 100644 index 0000000000000000000000000000000000000000..27e2ee162c7b4476dce38f650b29273d9a46fc0a --- /dev/null +++ b/zh-cn/application-dev/web/web-app-page-data-channel.md @@ -0,0 +1,143 @@ +# 建立应用侧与前端页面数据通道 + + +前端页面和应用侧之间可以用[createWebMessagePorts()](../reference/apis/js-apis-webview.md#createwebmessageports)接口创建消息端口来实现两端的通信。 + + +在下面的示例中,用侧页面中通过createWebMessagePorts方法创建消息端口,再把其中一个端口通过[postMessage()](../reference/apis/js-apis-webview.md#postmessage)接口发送到前端页面,便可以在前端页面和应用侧之间互相发送消息。 + + +- 应用侧代码。 + + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview'; + + @Entry + @Component + struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController(); + ports: web_webview.WebMessagePort[]; + @State sendFromEts: string = 'Send this message from ets to HTML'; + @State receivedFromHtml: string = 'Display received message send from HTML'; + + build() { + Column() { + // 展示接收到的来自HTML的内容 + Text(this.receivedFromHtml) + // 输入框的内容发送到html + TextInput({placeholder: 'Send this message from ets to HTML'}) + .onChange((value: string) => { + this.sendFromEts = value; + }) + + Button('postMessage') + .onClick(() => { + try { + // 1、创建两个消息端口。 + this.ports = this.controller.createWebMessagePorts(); + // 2、在应用侧的消息端口(如端口1)上注册回调事件。 + this.ports[1].onMessageEvent((result: web_webview.WebMessage) => { + let msg = 'Got msg from HTML:'; + if (typeof(result) === 'string') { + console.info(`received string message from html5, string is: ${result}`); + msg = msg + result; + } else if (typeof(result) === 'object') { + if (result instanceof ArrayBuffer) { + console.info(`received arraybuffer from html5, length is: ${result.byteLength}`); + msg = msg + 'lenght is ' + result.byteLength; + } else { + console.info('not support'); + } + } else { + console.info('not support'); + } + this.receivedFromHtml = msg; + }) + // 3、将另一个消息端口(如端口0)发送到HTML侧,由HTML侧保存并使用。 + this.controller.postMessage('__init_port__', [this.ports[0]], '*'); + } catch (error) { + console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); + } + }) + + // 4、使用应用侧的端口给另一个已经发送到html的端口发送消息。 + Button('SendDataToHTML') + .onClick(() => { + try { + if (this.ports && this.ports[1]) { + this.ports[1].postMessageEvent(this.sendFromEts); + } else { + console.error(`ports is null, Please initialize first`); + } + } catch (error) { + console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); + } + }) + Web({ src: $rawfile('xxx.html'), controller: this.controller }) + } + } + } + ``` + +- 前端页面代码。 + + ```html + + + + + + WebView Message Port Demo + + + + + +

WebView Message Port Demo

+
+
+
+
+

display received message send from ets

+ + + ``` diff --git a/zh-cn/application-dev/web/web-component-overview.md b/zh-cn/application-dev/web/web-component-overview.md new file mode 100644 index 0000000000000000000000000000000000000000..194d99267c2ab27725aa78565530dd785ca7b224 --- /dev/null +++ b/zh-cn/application-dev/web/web-component-overview.md @@ -0,0 +1,14 @@ +# Web组件概述 + + +Web组件用于在应用程序中显示Web页面内容,为开发者提供页面加载、页面交互、页面调试等能力。 + + +- 页面加载:Web组件提供基础的前端页面加载的能力,包括加载网络页面、本地页面、Html格式文本数据。 + +- 页面交互:Web组件提供丰富的页面交互的方式,包括:设置前端页面深色模式,新窗口中加载页面,位置权限管理,Cookie管理,应用侧使用前端页面JavaScript等能力。 + +- 页面调试:Web组件支持使用Devtools工具调试前端页面。 + + +下面通过常见使用场景举例,来具体介绍Web组件功能特性。 diff --git a/zh-cn/application-dev/web/web-cookie-and-data-storage-mgmt.md b/zh-cn/application-dev/web/web-cookie-and-data-storage-mgmt.md new file mode 100644 index 0000000000000000000000000000000000000000..7734b404fe3dc4906676ce7eacfe8eecd1940ec4 --- /dev/null +++ b/zh-cn/application-dev/web/web-cookie-and-data-storage-mgmt.md @@ -0,0 +1,131 @@ +# 管理Cookie及数据存储 + + +## Cookie管理 + +Cookie是网络访问过程中,由服务端发送给客户端的一小段数据。客户端可持有该数据,并在后续访问该服务端时,方便服务端快速对客户端身份、状态等进行识别。 + +Web组件提供了WebCookieManager类,用于管理Web组件的Cookie信息。Cookie信息保存在应用沙箱路径下/proc/{pid}/root/data/storage/el2/base/cache/web/Cookiesd的文件中。 + +下面以[setCookie()](../reference/apis/js-apis-webview.md#setcookie)接口举例,为“www.example.com”设置单个Cookie的值“value=test”。其他Cookie的相关功能及使用,请参考[WebCookieManager()](../reference/apis/js-apis-webview.md#webcookiemanager)接口文档。 + + +```ts +// xxx.ets +import web_webview from '@ohos.web.webview'; + +@Entry +@Component +struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController(); + + build() { + Column() { + Button('setCookie') + .onClick(() => { + try { + web_webview.WebCookieManager.setCookie('https://www.example.com', 'value=test'); + } catch (error) { + console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); + } + }) + Web({ src: 'www.example.com', controller: this.controller }) + } + } +} +``` + + +## 缓存与存储管理 + +在访问网站时,网络资源请求是相对比较耗时的。开发者可以通过Cache、Dom Storage等手段将资源保持至本地,以提升访问同一网站的速度。 + + +### Cache + +使用[cacheMode()](../reference/arkui-ts/ts-basic-components-web.md#cachemode)配置页面资源的缓存模式,Web组件为开发者提供四种缓存模式,分别为: + +- Default : 优先使用未过期的缓存,如果缓存不存在,则从网络获取。 + +- None : 加载资源使用cache,如果cache中无该资源则从网络中获取。 + +- Online : 加载资源不使用cache,全部从网络中获取。 + +- Only :只从cache中加载资源。 + + +在下面的示例中,选用缓存设置为None模式。 + + + +```ts +// xxx.ets +import web_webview from '@ohos.web.webview'; + +@Entry +@Component +struct WebComponent { + @State mode: CacheMode = CacheMode.None; + controller: web_webview.WebviewController = new web_webview.WebviewController(); + build() { + Column() { + Web({ src: 'www.example.com', controller: this.controller }) + .cacheMode(this.mode) + } + } +} +``` + + + 同时,为了获取最新资源,开发者可以通过[removeCache()](../reference/apis/js-apis-webview.md#removecache)接口清除已经缓存的资源,示例代码如下: + +```ts +// xxx.ets +import web_webview from '@ohos.web.webview'; + +@Entry +@Component +struct WebComponent { + @State mode: CacheMode = CacheMode.None; + controller: web_webview.WebviewController = new web_webview.WebviewController(); + build() { + Column() { + Button('removeCache') + .onClick(() => { + try { + // 设置为true时同时清除rom和ram中的缓存,设置为false时只清除ram中的缓存 + this.controller.removeCache(true); + } catch (error) { + console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); + } + }) + Web({ src: 'www.example.com', controller: this.controller }) + .cacheMode(this.mode) + } + } +} +``` + + +### Dom Storage + +Dom Storage包含了Session Storage和Local Storage两类。前者为临时数据,其存储与释放跟随会话生命周期;后者为可持久化数据,落盘在应用目录下。两者的数据均通过Key-Value的形式存储,通常在访问需要客户端存储的页面时使用。开发者可以通过Web组件的属性接口[domStorageAccess()](../reference/arkui-ts/ts-basic-components-web.md#domstorageaccess)进行使能配置,示例如下: + + + +```ts +// xxx.ets +import web_webview from '@ohos.web.webview'; + +@Entry +@Component +struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController(); + build() { + Column() { + Web({ src: 'www.example.com', controller: this.controller }) + .domStorageAccess(true) + } + } +} +``` diff --git a/zh-cn/application-dev/web/web-debugging-with-devtools.md b/zh-cn/application-dev/web/web-debugging-with-devtools.md new file mode 100644 index 0000000000000000000000000000000000000000..2917bca7bb527dd54af497783ad06faf2bb802f7 --- /dev/null +++ b/zh-cn/application-dev/web/web-debugging-with-devtools.md @@ -0,0 +1,45 @@ +# 使用Devtools工具调试前端页面 + + +Web组件支持使用DevTools工具调试前端页面。DevTools是一个 Web前端开发调试工具,提供了电脑上调试移动设备前端页面的能力。开发者通过[setWebDebuggingAccess()](../reference/apis/js-apis-webview.md#setwebdebuggingaccess)接口开启Web组件前端页面调试能力,利用DevTools工具可以在电脑上调试移动设备上的前端网页。 + + +使用DevTools工具,可以执行以下步骤: + + +1. 在应用代码中开启Web调试开关,具体如下: + + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview'; + + @Entry + @Component + struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController(); + aboutToAppear() { + // 配置web开启调试模式 + web_webview.WebviewController.setWebDebuggingAccess(true); + } + build() { + Column() { + Web({ src: 'www.example.com', controller: this.controller }) + } + } + } + ``` + +2. 将设备连接上电脑,在电脑端配置端口映射,配置方法如下: + + ``` + // 添加映射 + hdc fport tcp:9222 tcp:9222 + // 查看映射 + hdc fport ls + ``` + +3. 在电脑端chrome浏览器地址栏中输入chrome://inspect/\#devices,页面识别到设备后,就可以开始页面调试。调试效果如下: + + **图1** 页面调试效果图 + + ![debug-effect](figures/debug-effect.png) diff --git a/zh-cn/application-dev/web/web-file-upload.md b/zh-cn/application-dev/web/web-file-upload.md new file mode 100644 index 0000000000000000000000000000000000000000..d2d37e6734fabb5f8dabd3a1df04a0ed62c20c89 --- /dev/null +++ b/zh-cn/application-dev/web/web-file-upload.md @@ -0,0 +1,52 @@ +# 上传文件 + + +Web组件支持前端页面选择文件上传功能,应用开发者可以使用[onShowFileSelector()](../reference/arkui-ts/ts-basic-components-web.md#onshowfileselector9)接口来处理前端页面文件上传的请求。 + + +下面的示例中,当用户在前端页面点击文件上传按钮,应用侧在[onShowFileSelector()](../reference/arkui-ts/ts-basic-components-web.md#onshowfileselector9)接口中收到文件上传请求,在此接口中开发者将上传的本地文件路径设置给前端页面。 + + +- 应用侧代码。 + + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview'; + @Entry + @Component + struct WebComponent { + controller: WebController = new WebController() + build() { + Column() { + // 加载本地local.html页面 + Web({ src: $rawfile('local.html'), controller: this.controller }) + .onShowFileSelector((event) => { + // 开发者设置要上传的文件路径 + let fileList: Array = [ + 'xxx/test.png', + ] + event.result.handleFileList(fileList) + return true; + }) + } + } + } + ``` + + +- local.html页面代码。 + + ```html + + + + + Document + + + + +
+ + + ``` diff --git a/zh-cn/application-dev/web/web-geolocation-permission.md b/zh-cn/application-dev/web/web-geolocation-permission.md new file mode 100644 index 0000000000000000000000000000000000000000..82866d3ecd6f058d95b354e4c5d788f03b2a21ef --- /dev/null +++ b/zh-cn/application-dev/web/web-geolocation-permission.md @@ -0,0 +1,73 @@ +# 管理位置权限 + + +Web组件提供位置权限管理能力。开发者可以通过[onGeolocationShow()](../reference/arkui-ts/ts-basic-components-web.md#ongeolocationshow)接口对某个网站进行位置权限管理。Web组件根据接口响应结果,决定是否赋予前端页面权限。获取设备位置,需要开发者配置[ohos.permission.LOCATION](../security/accesstoken-guidelines.md)权限。 + + +在下面的示例中,用户点击前端页面"获取位置"按钮,Web组件通过弹窗的形式通知应用侧位置权限请求消息。 + + +- 前端页面代码。 + + ```html + + + +

位置信息

+ + + + + ``` + + +- 应用代码。 + + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview'; + + @Entry + @Component + struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController(); + build() { + Column() { + Web({ src:$rawfile('getLocation.html'), controller:this.controller }) + .geolocationAccess(true) + .onGeolocationShow((event) => { // 地理位置权限申请通知 + AlertDialog.show({ + title: '位置权限请求', + message: '是否允许获取位置信息', + primaryButton: { + value: 'cancel', + action: () => { + event.geolocation.invoke(event.origin, false, false); // 不允许此站点地理位置权限请求 + } + }, + secondaryButton: { + value: 'ok', + action: () => { + event.geolocation.invoke(event.origin, true, false); // 允许此站点地理位置权限请求 + } + }, + cancel: () => { + event.geolocation.invoke(event.origin, false, false); // 不允许此站点地理位置权限请求 + } + }) + }) + } + } + } + ``` diff --git a/zh-cn/application-dev/web/web-in-app-frontend-page-function-invoking.md b/zh-cn/application-dev/web/web-in-app-frontend-page-function-invoking.md new file mode 100644 index 0000000000000000000000000000000000000000..2a490281b417a51f408e09acf18b3e62c66a917e --- /dev/null +++ b/zh-cn/application-dev/web/web-in-app-frontend-page-function-invoking.md @@ -0,0 +1,48 @@ +# 应用侧调用前端页面函数 + + +应用侧可以通过[runJavaScript()](../reference/apis/js-apis-webview.md#runjavascript)方法调用前端页面的JavaScript相关函数。 + + +在下面的示例中,点击应用侧的“runJavaScript”按钮时,来触发前端页面的htmlTest()方法。 + + +- 前端页面代码。 + + ```html + + + + + + + + ``` + + +- 应用侧代码。 + + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview'; + + @Entry + @Component + struct WebComponent { + webviewController: web_webview.WebviewController = new web_webview.WebviewController(); + + build() { + Column() { + Web({ src: $rawfile('index.html'), controller: this.webviewController}) + Button('runJavaScript') + .onClick(() => { + this.webviewController.runJavaScript('htmlTest()'); + }) + } + } + } + ``` diff --git a/zh-cn/application-dev/web/web-in-page-app-function-invoking.md b/zh-cn/application-dev/web/web-in-page-app-function-invoking.md new file mode 100644 index 0000000000000000000000000000000000000000..caffe3d2cc2a18efae36fd67650113202e5e4d2d --- /dev/null +++ b/zh-cn/application-dev/web/web-in-page-app-function-invoking.md @@ -0,0 +1,113 @@ +# 前端页面调用应用侧函数 + + +开发者使用Web组件将应用侧代码注册到前端页面中,注册完成之后,前端页面中使用注册的对象名称就可以调用应用侧的函数,实现在前端页面中调用应用侧方法。 + + +注册应用侧代码有两种方式,一种在Web组件初始化使用调用,使用[javaScriptProxy()](../reference/arkui-ts/ts-basic-components-web.md#javascriptproxy)接口。另外一种在Web组件初始化完成后调用,使用[registerJavaScriptProxy()](../reference/apis/js-apis-webview.md#registerjavascriptproxy)接口。 + + +在下面的示例中,将test()方法注册在前端页面中, 该函数可以在前端页面触发运行。 + + +- [javaScriptProxy()](../reference/arkui-ts/ts-basic-components-web.md#javascriptproxy)接口使用示例如下。 + + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview'; + + @Entry + @Component + struct WebComponent { + webviewController: web_webview.WebviewController = new web_webview.WebviewController(); + // 声明需要注册的对象 + testObj = { + test: () => { + return 'ArkTS Hello World!'; + } + } + + build() { + Column() { + // web组件加载本地index.html页面 + Web({ src: $rawfile('index.html'), controller: this.webviewController}) + // 将对象注入到web端 + .javaScriptProxy({ + object: this.testObj, + name: "testObjName", + methodList: ["test"], + controller: this.webviewController + }) + } + } + } + ``` + + +- 应用侧使用registerJavaScriptProxy()接口注册。 + + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview'; + + @Entry + @Component + struct Index { + webviewController: web_webview.WebviewController = new web_webview.WebviewController(); + testObj = { + test: (data) => { + return "ArkUI Web Component"; + }, + toString: () => { + console.info('Web Component toString'); + } + } + + build() { + Column() { + Button('refresh') + .onClick(() => { + try { + this.webviewController.refresh(); + } catch (error) { + console.error(`Errorcode: ${error.code}, Message: ${error.message}`); + } + }) + Button('Register JavaScript To Window') + .onClick(() => { + try { + this.webviewController.registerJavaScriptProxy(this.testObj, "objName", ["test", "toString"]); + } catch (error) { + console.error(`Errorcode: ${error.code}, Message: ${error.message}`); + } + }) + Web({ src: $rawfile('index.html'), controller: this.webviewController }) + } + } + } + ``` + + > **说明:** + > + > 使用[registerJavaScriptProxy()](../reference/apis/js-apis-webview.md#registerjavascriptproxy)接口注册方法时,注册后需调用[refresh()](../reference/apis/js-apis-webview.md#refresh)接口生效。 + + +- index.htm前端页面触发应用侧代码。 + + ```html + + + + + +

+ + + + ``` diff --git a/zh-cn/application-dev/web/web-open-in-new-window.md b/zh-cn/application-dev/web/web-open-in-new-window.md new file mode 100644 index 0000000000000000000000000000000000000000..b05a96ffeccbf763fb557dcb04f09ae60104de4e --- /dev/null +++ b/zh-cn/application-dev/web/web-open-in-new-window.md @@ -0,0 +1,69 @@ +# 在新窗口中打开页面 + + +Web组件提供了在新窗口打开页面的能力,开发者可以通过[multiWindowAccess()](../reference/arkui-ts/ts-basic-components-web.md#multiwindowaccess9)接口来设置是否允许网页在新窗口打开。当有新窗口打开时,应用侧会在[onWindowNew()](../reference/arkui-ts/ts-basic-components-web.md#onwindownew9)接口中收到Web组件新窗口事件,开发者需要在此接口事件中,新建窗口来处理Web组件窗口请求。 + + +> **说明:** +> +> - [allowWindowOpenMethod()](../reference/arkui-ts/ts-basic-components-web.md#allowwindowopenmethod10)接口设置为true时,前端页面通过JavaScript函数调用的方式打开新窗口。 +> +> - 如果开发者在[onWindowNew()](../reference/arkui-ts/ts-basic-components-web.md#onwindownew9)接口通知中不需要打开新窗口,需要将[ControllerHandler.setWebController()](../reference/arkui-ts/ts-basic-components-web.md#setwebcontroller9)接口返回值设置成null。 + + +如下面的本地示例,当用户点击“新窗口中打开网页”按钮时,应用侧会在[onWindowNew()](../reference/arkui-ts/ts-basic-components-web.md#onwindownew9)接口中收到Web组件新窗口事件。 + + +- 应用侧代码。 + + 创建新窗口的方法可参考[Web开发相关例子](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Web/Browser)。 + + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview'; + @Entry + @Component + struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController(); + build() { + Column() { + Web({ src:$rawfile("window.html"), controller: this.controller }) + .multiWindowAccess(true) + .onWindowNew((event) => { + console.info("onWindowNew..."); + var popController: web_webview.WebviewController = new web_webview.WebviewController(); + // 开发者需要在此处新建窗口,跟popController关联,并且将popController返回给Web组件。如果不需要打开新窗口请将返回值设置为event.handler.setWebController(null); + event.handler.setWebController(popController); + }) + } + } + } + ``` + + +- window.html页面代码。 + + ```html + + + + + WindowEvent + + + + + + + + ``` diff --git a/zh-cn/application-dev/web/web-page-loading-with-web-components.md b/zh-cn/application-dev/web/web-page-loading-with-web-components.md new file mode 100644 index 0000000000000000000000000000000000000000..98a7ea1360330dd20be8fcfc3afe6e3f9de01922 --- /dev/null +++ b/zh-cn/application-dev/web/web-page-loading-with-web-components.md @@ -0,0 +1,140 @@ +# 使用Web组件加载页面 + + +页面加载是Web组件的基本功能。根据页面加载数据来源可以分为三种常用场景,包括加载网络页面、加载本地页面、加载HTML格式的富文本数据。 + + +页面加载过程中,若涉及网络资源获取,需要配置[ohos.permission.INTERNET](../security/accesstoken-guidelines.md)网络访问权限。 + + +## 加载网络页面 + +开发者可以在Web组件创建的时候指定默认加载的网络页面 。在默认页面加载完成后,如果开发者需要变更此Web组件显示的网络页面,可以通过调用[loadUrl()](../reference/apis/js-apis-webview.md#loadurl)接口加载指定网络网页。 + + +在下面的示例中,在Web组件加载完“www.example.com”页面后,开发者可通过loadUrl接口将此Web组件显示页面变更为“www.example1.com”。 + + + +```ts +// xxx.ets +import web_webview from '@ohos.web.webview'; + +@Entry +@Component +struct WebComponent { + webviewController: web_webview.WebviewController = new web_webview.WebviewController(); + + build() { + Column() { + Button('loadUrl') + .onClick(() => { + try { + // 点击按钮时,通过loadUrl,跳转到www.example1.com + this.webviewController.loadUrl('www.example1.com'); + } catch (error) { + console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); + } + }) + // 组件创建时,加载www.example.com + Web({ src: 'www.example.com', controller: this.webviewController}) + } + } +} +``` + + +## 加载本地页面 + +将本地页面文件放在应用的rawfile目录下,开发者可以在Web组件创建的时候指定默认加载的本地页面 ,并且加载完成后可通过调用[loadUrl()](../reference/apis/js-apis-webview.md#loadurl)接口变更当前Web组件的页面。 + + +在下面的示例中展示加载本地页面文件的方法: + + +- 将资源文件放置在应用的resources/rawfile目录下。 + + **图1** 资源文件路径   + + ![resource-path](figures/resource-path.png) + + +- 应用侧代码。 + + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview'; + + @Entry + @Component + struct WebComponent { + webviewController: web_webview.WebviewController = new web_webview.WebviewController(); + + build() { + Column() { + Button('loadUrl') + .onClick(() => { + try { + // 点击按钮时,通过loadUrl,跳转到local1.html + this.webviewController.loadUrl($rawfile("local1.html")); + } catch (error) { + console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); + } + }) + // 组件创建时,通过$rawfile加载本地文件local.html + Web({ src: $rawfile("local.html"), controller: this.webviewController }) + } + } + } + ``` + + +- local.html页面代码。 + + ```html + + + + +

Hello World

+ + + ``` + + +## 加载HTML格式的文本数据 + +Web组件可以通过[loadData()](../reference/apis/js-apis-webview.md#loaddata)接口实现加载HTML格式的文本数据。当开发者不需要加载整个页面,只需要显示一些页面片段时,可通过此功能来快速加载页面。 + + + +```ts +// xxx.ets +import web_webview from '@ohos.web.webview'; + +@Entry +@Component +struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController(); + + build() { + Column() { + Button('loadData') + .onClick(() => { + try { + // 点击按钮时,通过loadData,加载HTML格式的文本数据 + this.controller.loadData( + 'Source:
source
', + 'text/html', + 'UTF-8' + ); + } catch (error) { + console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); + } + }) + // 组件创建时,加载www.example.com + Web({ src: 'www.example.com', controller: this.controller }) + } + } +} +``` diff --git a/zh-cn/application-dev/web/web-redirection-and-browsing-history-mgmt.md b/zh-cn/application-dev/web/web-redirection-and-browsing-history-mgmt.md new file mode 100644 index 0000000000000000000000000000000000000000..4d64482bf4e2ed1751e2e1f120064d481fa670cf --- /dev/null +++ b/zh-cn/application-dev/web/web-redirection-and-browsing-history-mgmt.md @@ -0,0 +1,157 @@ +# 管理页面跳转及浏览记录导航 + + +## 历史记录导航 + +使用者在前端页面点击网页中的链接时,Web组件默认会自动打开并加载目标网址。当前端页面替换为新的加载链接时,会自动记录已经访问的网页地址。可以通过[forward()](../reference/apis/js-apis-webview.md#forward)和[backward()](../reference/apis/js-apis-webview.md#backward)接口向前/向后浏览上一个/下一个历史记录。 + + 在下面的示例中,点击应用的按钮来触发前端页面的后退操作。 + +```ts +// xxx.ets +import web_webview from '@ohos.web.webview'; + +@Entry +@Component +struct WebComponent { + webviewController: web_webview.WebviewController = new web_webview.WebviewController(); + build() { + Column() { + Button('loadData') + .onClick(() => { + if (this.webviewController.accessBackward()) { + this.webviewController.backward(); + return true; + } + }) + Web({ src: 'https://www.example.com/cn/', controller: this.webviewController}) + } + } +} +``` + + +如果存在历史记录,[accessBackward()](../reference/apis/js-apis-webview.md#accessbackward)接口会返回true。同样,您可以使用[accessForward()](../reference/apis/js-apis-webview.md#accessforward)接口检查是否存在前进的历史记录。如果您不执行检查,那么当用户浏览到历史记录的末尾时,调用[forward()](../reference/apis/js-apis-webview.md#forward)和[backward()](../reference/apis/js-apis-webview.md#backward)接口时将不执行任何操作。 + + +## 页面跳转 + +当点击网页中的链接需要跳转到应用内其他页面时,可以通过使用Web组件的[onUrlLoadIntercept()](../reference/arkui-ts/ts-basic-components-web.md#onurlloadintercept)接口来实现。 + +在下面的示例中,应用首页Index.ets加载前端页面route.html,在前端route.html页面点击超链接,可跳转到应用的ProfilePage.ets页面。 + +- 应用首页index.ets页面代码。 + + ```ts + // index.ets + import web_webview from '@ohos.web.webview'; + import router from '@ohos.router'; + @Entry + @Component + struct WebComponent { + webviewController: web_webview.WebviewController = new web_webview.WebviewController(); + + build() { + Column() { + Web({ src: $rawfile('route.html'), controller: this.webviewController }) + .onUrlLoadIntercept((event) => { + let url: string = event.data as string; + if (url.indexOf('native://') === 0) { + // 跳转其他界面 + router.pushUrl({ url:url.substring(9) }) + return true; + } + return false; + }) + } + } + } + ``` + +- route.html前端页面代码。 + + ```html + + + + + + + + ``` + +- 跳转页面ProfilePage.ets代码。 + + ```ts + @Entry + @Component + struct ProfilePage { + @State message: string = 'Hello World'; + + build() { + Column() { + Text(this.message) + .fontSize(20) + } + } + } + ``` + + +## 跨应用跳转 + +Web组件可以实现点击前端页面超链接跳转到其他应用。 + +在下面的示例中,点击call.html前端页面中的超连接,跳转到电话应用的拨号界面。 + +- 应用侧代码。 + + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview'; + import call from '@ohos.telephony.call'; + + @Entry + @Component + struct WebComponent { + webviewController: web_webview.WebviewController = new web_webview.WebviewController(); + + build() { + Column() { + Web({ src: $rawfile('xxx.html'), controller: this.webviewController}) + .onUrlLoadIntercept((event) => { + let url: string = event.data as string; + // 判断链接是否为拨号链接 + if (url.indexOf('tel://') === 0) { + // 跳转拨号界面 + call.makeCall(url.substring(6), (err) => { + if (!err) { + console.info('make call succeeded.'); + } else { + console.info('make call fail, err is:' + JSON.stringify(err)); + } + }); + return true; + } + return false; + }) + } + } + } + ``` + +- 前端页面call.html代码。 + + ```html + + + + + + + + ``` diff --git a/zh-cn/application-dev/web/web-resource-interception-request-mgmt.md b/zh-cn/application-dev/web/web-resource-interception-request-mgmt.md new file mode 100644 index 0000000000000000000000000000000000000000..6a01c946eaed3e56c21827337484bb105334390c --- /dev/null +++ b/zh-cn/application-dev/web/web-resource-interception-request-mgmt.md @@ -0,0 +1,70 @@ +# 自定义页面请求响应 + + +Web组件支持在应用拦截到页面请求后自定义响应请求能力。开发者通过[onInterceptRequest()](../reference/arkui-ts/ts-basic-components-web.md#oninterceptrequest9)接口来实现自定义资源请求响应 。自定义请求能力可以用于开发者自定义Web页面响应、自定义文件资源响应等场景。 + + +Web网页上发起资源加载请求,应用层收到资源请求消息。应用层构造本地资源响应消息发送给Web内核。Web内核解析应用层响应信息,根据此响应信息进行页面资源加载。 + + +在下面的示例中,Web组件通过拦截页面请求“https://www.intercept.com/test.html”, 在应用侧代码构建响应资源,实现自定义页面响应场景。 + + +- 前端页面example.html代码。 + + ```html + + + + + example + + + + intercept test! + + + ``` + +- 应用侧代码。 + + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview'; + + @Entry + @Component + struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController() + responseResource: WebResourceResponse = new WebResourceResponse() + // 开发者自定义响应数据 + @State webData: string = '\n' + + '\n'+ + '\n'+ + 'intercept test\n'+ + '\n'+ + '\n'+ + '

intercept ok

\n'+ + '\n'+ + '' + build() { + Column() { + Web({ src: $rawfile('example.html'), controller: this.controller }) + .onInterceptRequest((event) => { + console.info('url:' + event.request.getRequestUrl()); + // 拦截页面请求 + if (event.request.getRequestUrl() !== 'https://www.intercept.com/test.html') { + return null; + } + // 构造响应数据 + this.responseResource.setResponseData(this.webData); + this.responseResource.setResponseEncoding('utf-8'); + this.responseResource.setResponseMimeType('text/html'); + this.responseResource.setResponseCode(200); + this.responseResource.setReasonMessage('OK'); + return this.responseResource; + }) + } + } + } + ``` diff --git a/zh-cn/application-dev/web/web-set-dark-mode.md b/zh-cn/application-dev/web/web-set-dark-mode.md new file mode 100644 index 0000000000000000000000000000000000000000..bf58deae9205ff34a6d9e6a40df5d01433c67d8e --- /dev/null +++ b/zh-cn/application-dev/web/web-set-dark-mode.md @@ -0,0 +1,50 @@ +# 设置深色模式 + + +Web组件支持对前端页面进行深色模式配置。 + + +- 通过[darkMode()](../reference/arkui-ts/ts-basic-components-web.md#darkmode9)接口可以配置不同的深色模式,[WebDarkMode.Off](../reference/arkui-ts/ts-basic-components-web.md#webdarkmode9)模式表示关闭深色模式。[WebDarkMode.On](../reference/arkui-ts/ts-basic-components-web.md#webdarkmode9)表示开启深色模式,并且深色模式跟随前端页面。[WebDarkMode.Auto](../reference/arkui-ts/ts-basic-components-web.md#webdarkmode9)表示开启深色模式,并且深色模式跟随系统。 + 在下面的示例中, 通过[darkMode()](../reference/arkui-ts/ts-basic-components-web.md#darkmode9)接口将页面深色模式配置为跟随系统。 + + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview'; + + @Entry + @Component + struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController(); + @State mode: WebDarkMode = WebDarkMode.Auto; + build() { + Column() { + Web({ src: 'www.example.com', controller: this.controller }) + .darkMode(this.mode) + } + } + } + ``` + + +- 通过[forceDarkAccess()](../reference/arkui-ts/ts-basic-components-web.md#forcedarkaccess9)接口可将前端页面强制配置深色模式,且深色模式不跟随前端页面和系统。配置该模式时候,需要将深色模式配置成WebDarkMode.On。 + 在下面的示例中, 通过[forceDarkAccess()](../reference/arkui-ts/ts-basic-components-web.md#forcedarkaccess9)接口将页面强制配置为深色模式。 + + ```ts + // xxx.ets + import web_webview from '@ohos.web.webview'; + + @Entry + @Component + struct WebComponent { + controller: web_webview.WebviewController = new web_webview.WebviewController(); + @State mode: WebDarkMode = WebDarkMode.On; + @State access: boolean = true; + build() { + Column() { + Web({ src: 'www.example.com', controller: this.controller }) + .darkMode(this.mode) + .forceDarkAccess(this.access) + } + } + } + ``` diff --git a/zh-cn/application-dev/webgl/webgl-guidelines.md b/zh-cn/application-dev/webgl/webgl-guidelines.md index 644fe8b172683880599c370f49292b3e3afbc99a..fe2ecf6799008fe3d4fa0bca6048d54daf9d77cf 100644 --- a/zh-cn/application-dev/webgl/webgl-guidelines.md +++ b/zh-cn/application-dev/webgl/webgl-guidelines.md @@ -703,9 +703,3 @@ WebGL主要帮助开发者在前端开发中完成图形图像的相关处理, **图2** 点击按钮绘制彩色三角形的效果图 ![zh-cn_image_0000001192429306](figures/zh-cn_image_0000001192429306.gif) - -## 相关实例 - -针对WebGL开发,有以下相关实例可供参考: - -- [`JsWbgGL`:WebGL(JS)(API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/Graphics/JsWebGL) \ No newline at end of file diff --git a/zh-cn/application-dev/website.md b/zh-cn/application-dev/website.md index d10a1bd6d103518624f07c3bfacd69599a2a2f5d..7a2a9d493ef65ac69a09f5b28613b6a11baf00ec 100644 --- a/zh-cn/application-dev/website.md +++ b/zh-cn/application-dev/website.md @@ -377,7 +377,7 @@ - 文件访问框架 - [用户公共文件访问框架概述](file-management/file-access-framework-overview.md) - [文件选择器使用指导](file-management/filepicker-guidelines.md) - - 任务管理 + - 后台任务管理 - 后台任务 - [后台任务概述](task-management/background-task-overview.md) - [短时任务开发指导](task-management/transient-task-dev-guide.md) @@ -667,7 +667,7 @@ - [类型说明](reference/arkui-ts/ts-types.md) - 已停止维护的组件 - [GridContainer](reference/arkui-ts/ts-container-gridcontainer.md) - - 组件参考(兼容JS的类Web开发范式) + - 组件参考(兼容JS的类Web开发范式-ArkUI.Full) - 组件通用信息 - [通用属性](reference/arkui-js/js-components-common-attributes.md) - [通用样式](reference/arkui-js/js-components-common-styles.md) @@ -768,6 +768,41 @@ - [生命周期定义](reference/arkui-js/js-components-custom-lifecycle.md) - [动态创建组件](reference/arkui-js/js-components-create-elements.md) - [数据类型说明](reference/arkui-js/js-appendix-types.md) + - 组件参考(兼容JS的类Web开发范式-ArkUI.Lite) + - 框架说明 + - [文件组织](js-framework-file.md) + - [js标签配置](js-framework-js-tag.md) + - [app.js](js-framework-js-file.md) + - 语法 + - [HML语法参考](js-framework-syntax-hml.md) + - [CSS语法参考](js-framework-syntax-css.md) + - [JS语法参考](js-framework-syntax-js.md) + - 组件通用信息 + - [通用事件](js-common-events.md) + - [通用属性](js-common-attributes.md) + - [通用样式](js-common-styles.md) + - [动画样式](js-components-common-animation.md) + - 容器组件 + - [div](js-components-container-div.md) + - [list](js-components-container-list.md) + - [list-item](js-components-container-list-item.md) + - [stack](js-components-container-stack.md) + - [swiper](js-components-container-swiper.md) + - 基础组件 + - [chart](js-components-basic-chart.md) + - [image](js-components-basic-image.md) + - [image-animator](js-components-basic-image-animator.md) + - [input](js-components-basic-input.md) + - [marquee](js-components-basic-marquee.md) + - [picker-view](js-components-basic-picker-view.md) + - [progress](js-components-basic-progress.md) + - [qrcode](js-components-basic-qrcode.md) + - [slider](js-components-basic-slider.md) + - [switch](js-components-basic-switch.md) + - [text](js-components-basic-text.md) + - 画布组件 + - [canvas组件](js-components-canvas-canvas.md) + - [CanvasRenderingContext2D对象](js-components-canvas-canvasrenderingcontext2d.md) - JS服务卡片UI组件参考 - JS服务卡片UI框架说明 - [文件组织](reference/js-service-widget-ui/js-service-widget-file.md) @@ -927,6 +962,20 @@ - [@ohos.notification (Notification模块)(待停用)](reference/apis/js-apis-notification.md) - application - [EventHub](reference/apis/js-apis-inner-application-eventHub.md) + - commonEvent + - [CommonEventData](reference/apis/js-apis-inner-commonEvent-commonEventData.md) + - [CommonEventPublishData](reference/apis/js-apis-inner-commonEvent-commonEventPublishData.md) + - [CommonEventSubscriber](reference/apis/js-apis-inner-commonEvent-commonEventSubscriber.md) + - [CommonEventSubscribeInfo](reference/apis/js-apis-inner-commonEvent-commonEventSubscribeInfo.md) + - notification + - [NotificationActionButton](reference/apis/js-apis-inner-notification-notificationActionButton.md) + - [NotificationCommonDef](reference/apis/js-apis-inner-notification-notificationCommonDef.md) + - [NotificationContent](reference/apis/js-apis-inner-notification-notificationContent.md) + - [NotificationFlags](reference/apis/js-apis-inner-notification-notificationFlags.md) + - [NotificationRequest](reference/apis/js-apis-inner-notification-notificationRequest.md) + - [NotificationSlot](reference/apis/js-apis-inner-notification-notificationSlot.md) + - [NotificationTemplate](reference/apis/js-apis-inner-notification-notificationTemplate.md) + - [NotificationUserInput](reference/apis/js-apis-inner-notification-notificationUserInput.md) - 包管理 - [@ohos.bundle.appControl (appControl模块)](reference/apis/js-apis-appControl.md) - [@ohos.bundle.bundleManager (bundleManager模块)](reference/apis/js-apis-bundleManager.md) @@ -981,7 +1030,7 @@ - [@ohos.i18n (国际化-I18n)](reference/apis/js-apis-i18n.md) - [@ohos.intl (国际化-Intl)](reference/apis/js-apis-intl.md) - [@ohos.resourceManager (资源管理)](reference/apis/js-apis-resource-manager.md) - - 资源调度 + - 后台任务 - [@ohos.distributedMissionManager (分布式任务管理)](reference/apis/js-apis-distributedMissionManager.md) - [@ohos.reminderAgentManager (后台代理提醒)](reference/apis/js-apis-reminderAgentManager.md) - [@ohos.resourceschedule.backgroundTaskManager (后台任务管理)](reference/apis/js-apis-resourceschedule-backgroundTaskManager.md) @@ -1229,8 +1278,9 @@ - 资源管理 - [I18n错误码](reference/errorcodes/errorcode-i18n.md) - [资源管理错误码](reference/errorcodes/errorcode-resource-manager.md) - - 资源调度 + - 后台任务 - [backgroundTaskManager错误码](reference/errorcodes/errorcode-backgroundTaskMgr.md) + - [DeviceUsageStatistics错误码](reference/errorcodes/errorcode-DeviceUsageStatistics.md) - [reminderAgentManager错误码](reference/errorcodes/errorcode-reminderAgentManager.md) - [workScheduler错误码](reference/errorcodes/errorcode-workScheduler.md) - 安全 @@ -1280,7 +1330,6 @@ - [系统参数错误码](reference/errorcodes/errorcode-system-parameterV9.md) - [USB服务错误码](reference/errorcodes/errorcode-usb.md) - [升级错误码](reference/errorcodes/errorcode-update.md) - - [DeviceUsageStatistics错误码](reference/errorcodes/errorcode-DeviceUsageStatistics.md) - 定制管理 - [企业设备管理错误码](reference/errorcodes/errorcode-enterpriseDeviceManager.md) - 语言基础类库 @@ -1416,3 +1465,4 @@ - [IDE使用常见问题](faqs/faqs-ide.md) - [hdc_std命令使用常见问题](faqs/faqs-hdc-std.md) - [开发板使用常见问题](faqs/faqs-development-board.md) + diff --git a/zh-cn/application-dev/windowmanager/application-window-stage.md b/zh-cn/application-dev/windowmanager/application-window-stage.md index 6a8c67a9c395620bd8660db34559e795ab2f31c7..209481afbeb2873152d3e096d620ba99bdce3e66 100644 --- a/zh-cn/application-dev/windowmanager/application-window-stage.md +++ b/zh-cn/application-dev/windowmanager/application-window-stage.md @@ -320,7 +320,6 @@ export default class EntryAbility extends UIAbility { ```ts import UIAbility from '@ohos.app.ability.UIAbility'; - import ExtensionContext from '@ohos.app.ability.ServiceExtensionAbility'; import window from '@ohos.window'; export default class EntryAbility extends UIAbility { diff --git a/zh-cn/contribute/FAQ.md b/zh-cn/contribute/FAQ.md index 4c75f95e3a738c36a6287dc5faa7c3c649d65646..297545c0bddfa863f8e0e2102fc59724c43074b8 100755 --- a/zh-cn/contribute/FAQ.md +++ b/zh-cn/contribute/FAQ.md @@ -44,7 +44,7 @@ OS\(操作系统\)开发时,经常会遇到多个代码仓的修改具有编 **解决办法**: - 点击[这里](https://dco.openharmony.io/sign/Z2l0ZWUlMkZvcGVuX2hhcm1vbnk=)签署、查看签署状态。 + 点击[这里](https://dco.openharmony.cn/sign)签署、查看签署状态。 在PR的评论框输入`check dco`后,单击”评论”,系统将再次进行DCO校验。 diff --git a/zh-cn/contribute/OpenHarmony-JavaScript-coding-style-guide.md b/zh-cn/contribute/OpenHarmony-JavaScript-coding-style-guide.md index 168183261dd57cf172ff0a2b4e5211051d0b16b5..e42c06b89114b1fb2749f151c00e0b293eef6358 100755 --- a/zh-cn/contribute/OpenHarmony-JavaScript-coding-style-guide.md +++ b/zh-cn/contribute/OpenHarmony-JavaScript-coding-style-guide.md @@ -169,13 +169,13 @@ function render(container, dataSource) { **例外:** 如果一行注释包含了超过120 个字符的命令或URL,则可以保持一行,以方便复制、粘贴和通过grep查找; 预处理的 error 信息在一行便于阅读和理解,即使超过 120 个字符。 -#### 规则3.3 大括号的使用须遵循约定: +#### 规则2.3 大括号的使用须遵循约定: 1. 如果大括号内为空,则允许简写成`{}`,且无需换行; 2. 左大括号前不换行,括号后换行; 3. 右大括号前换行,括号后还有`else`、`catch`等情况下不换行,其他情况都换行。 -#### 规则3.4 条件语句和循环语句的实现必须使用大括号包裹,即使只有一条语句。 +#### 规则2.4 条件语句和循环语句的实现必须使用大括号包裹,即使只有一条语句。 **反例:** diff --git a/zh-cn/contribute/OpenHarmony-security-test-guide.md b/zh-cn/contribute/OpenHarmony-security-test-guide.md index baea8ed9d108a6a673813a8260aa2d418f052a96..b019f6e0f1d1e2c595f8f51b2aa792478f56a130 100644 --- a/zh-cn/contribute/OpenHarmony-security-test-guide.md +++ b/zh-cn/contribute/OpenHarmony-security-test-guide.md @@ -8,7 +8,7 @@ 2、通过OpenHarmony代码门禁安全扫描工具测试,扫描告警结果清零。 -3、依据[OpenHarmony编译规范](https://gitee.com/openharmony/community/blob/master/sig/sig-buildsystem/编译规范.md),使用编译选项扫描工具检查二进制文件编译选项开启情况,二进制文件编译选项均需要符合规范要求。 +3、依据[OpenHarmony编译规范](https://gitee.com/openharmony/community/blob/master/sig/sig_buildsystem/%E7%BC%96%E8%AF%91%E8%A7%84%E8%8C%83.md),使用编译选项扫描工具检查二进制文件编译选项开启情况,二进制文件编译选项均需要符合规范要求。 4、针对接收并处理用户态参数模块,开发人员需依据[Fuzz测试框架](https://gitee.com/openharmony/test_developertest/tree/master/libs/fuzzlib)开发灰白盒Fuzz测试套,并完成灰白盒Fuzz测试验证。 diff --git a/zh-cn/contribute/Readme-CN.md b/zh-cn/contribute/Readme-CN.md index 80bb091bd1b7b305298629aaefdf3e41dcc4ff71..eecb0dc72b0c3cbd7db4cd5603eb2f3ad087a80b 100755 --- a/zh-cn/contribute/Readme-CN.md +++ b/zh-cn/contribute/Readme-CN.md @@ -6,7 +6,7 @@ - [贡献流程](贡献流程.md) - [自测试验证](../readme/测试子系统.md) - [贡献文档](贡献文档.md) -- [写作规范](写作规范.md) +- [文档风格](style-guide/Readme-CN.md) - [社区沟通与交流](社区沟通与交流.md) - [FAQ](FAQ.md) diff --git a/zh-cn/contribute/template/README-template.md b/zh-cn/contribute/template/README-template.md index ffb8814a0f56b1056d25e88412b25b23ddc8b36a..963058a78cdcdd3f4ca884727c35743c217f1fc6 100644 --- a/zh-cn/contribute/template/README-template.md +++ b/zh-cn/contribute/template/README-template.md @@ -146,7 +146,7 @@ 示例: -[内核子系统](https://gitee.com/openharmony/docs/blob/master/zh-cn/readme/%E5%86%85%E6%A0%B8%E5%AD%90%E7%B3%BB%E7%BB%9F.md) +[内核子系统](../../readme/内核子系统.md) [drivers\_liteos](https://gitee.com/openharmony/drivers_liteos/blob/master/README_zh.md) diff --git a/zh-cn/contribute/template/guide-template.md b/zh-cn/contribute/template/guide-template.md index fefe1359814200857ff975c45e75bde193658251..077ce9af0c00758fbefb51d3eddb71ff1535948a 100644 --- a/zh-cn/contribute/template/guide-template.md +++ b/zh-cn/contribute/template/guide-template.md @@ -181,7 +181,7 @@ _已发布的Sample code、Codelabs、Demo工程包,请在此处提供链接 针对Ability开发,有以下相关实例可供参考: -- [Page内和Page间导航跳转](https://gitee.com/openharmony/codelabs/tree/master/Ability/PageAbility) +- [UIAbility内和UIAbility间页面的跳转(ArkTS)](https://gitee.com/openharmony/codelabs/tree/master/Ability/StageAbility ## 环境准备 diff --git a/zh-cn/contribute/template/xxboard-template.md b/zh-cn/contribute/template/xxboard-template.md index dbd31d13e225d47946acdfbc834aaf0e4157a788..a7bdd0db96b8877dd1dc495f6e3ee1e6831f06b8 100644 --- a/zh-cn/contribute/template/xxboard-template.md +++ b/zh-cn/contribute/template/xxboard-template.md @@ -15,7 +15,7 @@ **图片名称以开发板名称命名。* -*参考文档:https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-introduction-hi3861.md* +*参考文档:[Hi3861开发板介绍](../../device-dev/quick-start/quickstart-appendix-hi3861.md)* ******** ## 开发板规格 diff --git "a/zh-cn/contribute/\345\206\231\344\275\234\350\247\204\350\214\203.md" "b/zh-cn/contribute/\345\206\231\344\275\234\350\247\204\350\214\203.md" index 556baff875baa8ee7927e5fc035885d4c4a61dfa..d8ee9fef5ee8aaca3c189d141ec85a59c096da6f 100755 --- "a/zh-cn/contribute/\345\206\231\344\275\234\350\247\204\350\214\203.md" +++ "b/zh-cn/contribute/\345\206\231\344\275\234\350\247\204\350\214\203.md" @@ -67,7 +67,7 @@ - 中文用中文图,英文用英文图形。 - 图片建议根据内容命名,只用数字序列不利于后续图片的继承。 ->![](public_sys-resources/icon-note.gif) **说明**: +>**说明**: >引用方式: >!\[\]\(./pic/pic-standard.png\) diff --git "a/zh-cn/contribute/\347\254\254\344\270\211\346\226\271\345\274\200\346\272\220\350\275\257\344\273\266\345\217\212\350\256\270\345\217\257\350\257\201\350\257\264\346\230\216.md" "b/zh-cn/contribute/\347\254\254\344\270\211\346\226\271\345\274\200\346\272\220\350\275\257\344\273\266\345\217\212\350\256\270\345\217\257\350\257\201\350\257\264\346\230\216.md" index 672f0adbdd911217e22fa1cf49c448a4dfa8bd33..e0f3c4710340b3db20827d58481228f4b65788b0 100755 --- "a/zh-cn/contribute/\347\254\254\344\270\211\346\226\271\345\274\200\346\272\220\350\275\257\344\273\266\345\217\212\350\256\270\345\217\257\350\257\201\350\257\264\346\230\216.md" +++ "b/zh-cn/contribute/\347\254\254\344\270\211\346\226\271\345\274\200\346\272\220\350\275\257\344\273\266\345\217\212\350\256\270\345\217\257\350\257\201\350\257\264\346\230\216.md" @@ -90,8 +90,8 @@ OpenHarmony使用了如下第三方开源软件,下表对各开源软件采用 | third_party_mksh | MirOS License | 该License无强制开放源码义务条款。 | | third_party_toybox | Public Domain License | 该License无强制开放源码义务条款。 | | third_party_optimized_routines | MIT License | 该License无强制开放源码义务条款。 | -| third_party_libsnd | LGPL v2.1 | 该License无强制开放源码义务条款。部分测试代码使用GPL-3.0-or-later协议,部分测试代码使用GPL-2.0-or-later协议 | -| third_party_pulseaudio | LGPL v2.1 | 该License无强制开放源码义务条款。 | +| third_party_libsnd | LGPL v2.1 | 采用动态链接调用,OpenHarmony进程不受LGPL影响。部分测试代码使用GPL-3.0-or-later协议,部分测试代码使用GPL-2.0-or-later协议 | +| third_party_pulseaudio | LGPL v2.1 | 采用动态链接调用,OpenHarmony进程不受LGPL影响。| | third_party_ffmpeg | LGPL v2.1 | OpenHarmony采用动态链接方式使用LGPL许可证下的ffmpeg库,不会导致该项目其它代码受到LGPL许可证的影响。 | | third_party_quickjs | MIT licence | 该License无强制开放源码义务条款。| | third_party_icu | BSD 3-Clause License, ICU License, UNICODE INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE | License无强制开放源码义务条款。 | diff --git "a/zh-cn/contribute/\347\254\254\344\270\211\346\226\271\345\274\200\346\272\220\350\275\257\344\273\266\345\274\225\345\205\245\346\214\207\345\257\274.md" "b/zh-cn/contribute/\347\254\254\344\270\211\346\226\271\345\274\200\346\272\220\350\275\257\344\273\266\345\274\225\345\205\245\346\214\207\345\257\274.md" index 8092b528d1960f5a83df17416cded1c565b37c32..aabb1c27b3f7db08261f54dbc3deee10d90d4bfa 100755 --- "a/zh-cn/contribute/\347\254\254\344\270\211\346\226\271\345\274\200\346\272\220\350\275\257\344\273\266\345\274\225\345\205\245\346\214\207\345\257\274.md" +++ "b/zh-cn/contribute/\347\254\254\344\270\211\346\226\271\345\274\200\346\272\220\350\275\257\344\273\266\345\274\225\345\205\245\346\214\207\345\257\274.md" @@ -36,7 +36,7 @@ OpenHarmony遵从 [Open Source Definition](https://opensource.org/docs/osd) , 8. 不能引入有高危漏洞且无解决方案的版本。 9. 若需针对引入的开源软件进行修改,请将修改的代码放在该开源软件仓中,并确保满足该开源软件的许可证要求,修改的文件应当保持其原始许可证条款,新增的文件也建议采用相同的许可证条款。 10. 新引入的开源软件必须在其根目录提供README.OpenSource文件,在该文件中准确描述其软件名、许可证、许可文件位置、版本、对应版本的上游社区地址、软件的维护Owner、功能描述以及引入的原因。 -11. 引入新软件到OpenHarmony时必须有对应的SIG负责管理,原则上如果没有SIG-Compliance以及相应SIG的确认,SIG-Architecture不批准相应软件的引入。当要批量引入多个软件时,可以求助SIG-Architecture主持发起SIG间的临时评审会议,提升协调效率。如因特殊原因不能满足上述要求但又需要引入,请请联系邮箱:oh-legal@openatom.io。 +11. 引入新软件到OpenHarmony时必须有对应的SIG负责管理,原则上如果没有SIG-Compliance以及相应SIG的确认,SIG-Architecture不批准相应软件的引入。当要批量引入多个软件时,可以求助SIG-Architecture主持发起SIG间的临时评审会议,提升协调效率。如因特殊原因不能满足上述要求但又需要引入,请联系邮箱:oh-legal@openatom.io。 12. 引入新的开源软件存在依赖其他开源软件时,不允许将被动依赖软件嵌套在引入的新的开源软件子目录中,必须剥离所有依赖软件项,并将其分别放置到单独的代码仓,命名统一为third_party_依赖软件名称,原因是嵌套放置依赖软件可能导致多同一款软件多版本、旧版本安全漏洞无法及时修复、开源义务履行合规的风险问题。 - 依赖软件在编译构建部件命名,将新引入的主软件名作为依赖软件部件前缀命名,例如 part_name = "新引入主软件名_依赖软件名" - 新引入软件和依赖软件分别独立构建,通过external_deps来解决部件间依赖。 @@ -139,7 +139,7 @@ third_party_abcde/doc/ LICENSEFILE LICENSE Apache-2.0 #### 新增三方开源软件评审 -参考[SIG-Architecture](https://gitee.com/openharmony/community/blob/master/sig/sig-architecture/sig-architecture_cn.md),SIG-Architecture会统一安排建仓评审。 +参考[SIG-Architecture](https://gitee.com/openharmony/community/blob/master/sig/sig_architecture/sig_architecture_cn.md),SIG-Architecture会统一安排建仓评审。 ### 第三方开源软件许可证要求 diff --git "a/zh-cn/contribute/\350\256\270\345\217\257\350\257\201\344\270\216\347\211\271\346\256\212\350\256\270\345\217\257\350\257\201\350\257\204\345\256\241\346\214\207\345\257\274.md" "b/zh-cn/contribute/\350\256\270\345\217\257\350\257\201\344\270\216\347\211\271\346\256\212\350\256\270\345\217\257\350\257\201\350\257\204\345\256\241\346\214\207\345\257\274.md" index d37f6a6a8311efac5aa2e1319f6bf4b0540c6b23..7387ff8b62281f449ec91f4c9ebf4a59b096c164 100644 --- "a/zh-cn/contribute/\350\256\270\345\217\257\350\257\201\344\270\216\347\211\271\346\256\212\350\256\270\345\217\257\350\257\201\350\257\204\345\256\241\346\214\207\345\257\274.md" +++ "b/zh-cn/contribute/\350\256\270\345\217\257\350\257\201\344\270\216\347\211\271\346\256\212\350\256\270\345\217\257\350\257\201\350\257\204\345\256\241\346\214\207\345\257\274.md" @@ -26,9 +26,9 @@ OpenHarmony项目第三方依赖:OpenHarmony项目依赖的第三方开源代 OpenHarmony项目贡献代码许可证白名单包括: -- [Apache License 2.0 (Apache-2.0)](https://opensource.org/licenses/Apache-2.0)(适用于用户态代码) -- [3-clause BSD License (BSD-3-Clause)](https://opensource.org/licenses/BSD-3-Clause) (适用于LiteOS Kernel代码) -- [GNU General Public License version 2 (GPL-2.0)](https://opensource.org/licenses/GPL-2.0)(适用于Linux Kernel代码) +- Apache License 2.0 (Apache-2.0)(适用于用户态代码) +- 3-clause BSD License (BSD-3-Clause)(适用于LiteOS Kernel代码) +- GNU General Public License version 2 (GPL-2.0)(适用于Linux Kernel代码) ## OpenHarmony项目第三方依赖可接纳和不可接纳的许可证名单 @@ -38,43 +38,43 @@ OpenHarmony项目还可能引入或依赖不同的第三方开源软件,这些 与Apache-2.0许可证相兼容的许可证可以被接纳,OpenHarmony项目建议可优先接纳采用如下许可证的第三方依赖: -- [Academic Free License 3.0 (AFL-3.0)](https://opensource.org/licenses/AFL-3.0) +- Academic Free License 3.0 (AFL-3.0) -- [Apache License 2.0 (Apache-2.0)](https://opensource.org/licenses/Apache-2.0) +- Apache License 2.0 (Apache-2.0) -- [Apache Software License 1.1](https://www.apache.org/licenses/LICENSE-1.1). Including variants: +- Apache Software License 1.1. Including variants: - - [PHP License 3.01](http://www.php.net/license/3_01.txt) - - [MX4J License](http://mx4j.sourceforge.net/docs/ch01s06.html) + - PHP License 3.01 + - MX4J License -- [Boost Software License (BSL-1.0)](https://opensource.org/licenses/BSL-1.0) +- Boost Software License (BSL-1.0) - BSD License: - - [3-clause BSD License](https://opensource.org/licenses/BSD-3-Clause) - - [2-clause BSD License](https://opensource.org/licenses/BSD-2-Clause) + - 3-clause BSD License + - 2-clause BSD License - DOM4J License - - [PostgreSQL License](http://opensource.org/licenses/postgresql) + - PostgreSQL License -- [ISC](https://opensource.org/licenses/ISC) +- ISC - ICU -- [MIT License (MIT)](https://opensource.org/licenses/MIT) / X11 +- MIT License (MIT) / X11 -- [MIT No Attribution License (MIT-0)](https://opensource.org/licenses/MIT-0) +- MIT No Attribution License (MIT-0) -- [Mulan Permissive Software License v2 (MulanPSL-2.0)](https://opensource.org/licenses/MulanPSL-2.0) +- Mulan Permissive Software License v2 (MulanPSL-2.0) -- [The Unlicense](https://opensource.org/licenses/unlicense) +- The Unlicense -- [W3C License (W3C)](https://opensource.org/licenses/W3C) +- W3C License (W3C) -- [University of Illinois/NCSA](http://opensource.org/licenses/UoI-NCSA.php) +- University of Illinois/NCSA -- [X.Net](http://opensource.org/licenses/xnet.php) +- X.Net -- [zlib/libpng](http://opensource.org/licenses/zlib-license.php) +- zlib/libpng - FSF autoconf license @@ -82,57 +82,57 @@ OpenHarmony项目还可能引入或依赖不同的第三方开源软件,这些 - OOXML XSD ECMA License -- [Microsoft Public License (MsPL)](http://www.opensource.org/licenses/ms-pl.html) +- Microsoft Public License (MsPL) -- [Python Software Foundation License](http://www.opensource.org/licenses/PythonSoftFoundation.php) +- Python Software Foundation License -- [Python Imaging Library Software License](https://github.com/python-pillow/Pillow/blob/master/LICENSE) +- Python Imaging Library Software License -- [Adobe Postcript(R) AFM files](https://spdx.org/licenses/APAFML.html) +- Adobe Postcript(R) AFM files -- [Boost Software License Version 1.0](http://www.opensource.org/licenses/BSL-1.0) +- Boost Software License Version 1.0 -- [WTF Public License](http://www.wtfpl.net/) +- WTF Public License -- [The Romantic WTF public license](https://github.com/pygy/gosub/blob/master/LICENSE) +- The Romantic WTF public license -- [UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE](http://www.unicode.org/copyright.html#Exhibit1) +- UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE -- [Zope Public License 2.0](https://opensource.org/licenses/ZPL-2.0) +- Zope Public License 2.0 - ACE license -- [Oracle Universal Permissive License (UPL) Version 1.0](https://oss.oracle.com/licenses/upl/) +- Oracle Universal Permissive License (UPL) Version 1.0 -- [Open Grid Forum License](https://www.ogf.org/ogf/doku.php/about/copyright) +- Open Grid Forum License - Google "Additional IP Rights Grant (Patents)" file -- [Historical Permission Notice and Disclaimer](https://opensource.org/licenses/HPND) +- Historical Permission Notice and Disclaimer ### 不建议接纳的第三方依赖的许可证名单 原则上,不支持商用的许可证,以及其它包含不合理限制或义务的许可证不建议被接纳,OpenHarmony项目不建议接纳采用如下许可证的第三方依赖: - Intel Simplified Software License -- [JSR-275 License](https://github.com/unitsofmeasurement/jsr-275/blob/0.9.3/LICENSE.txt) -- [Microsoft Limited Public License](https://www.openhub.net/licenses/mslpl) -- [Amazon Software License (ASL)](https://aws.amazon.com/asl/) +- JSR-275 License +- Microsoft Limited Public License +- Amazon Software License (ASL) - Java SDK for Satori RTM license -- [Redis Source Available License (RSAL)](https://redislabs.com/community/licenses/) +- Redis Source Available License (RSAL) - Booz Allen Public License -- [Confluent Community License Version 1.0](https://www.confluent.io/confluent-community-license/) -- [Any license including the Commons Clause License Condition v1.0](https://commonsclause.com/) +- Confluent Community License Version 1.0 +- Any license including the Commons Clause License Condition v1.0 - Creative Commons Non-Commercial variants -- [Sun Community Source License 3.0](http://jcp.org/aboutJava/communityprocess/SCSL3.0.rtf) -- [GNU GPL 3](http://www.opensource.org/licenses/gpl-license.php) -- [GNU Affero GPL 3](http://www.opensource.org/licenses/agpl-v3.html) -- [BSD-4-Clause](https://spdx.org/licenses/BSD-4-Clause.html)/[BSD-4-Clause (University of California-Specific)](https://spdx.org/licenses/BSD-4-Clause-UC.html) +- Sun Community Source License 3.0 +- GNU GPL 3 +- GNU Affero GPL 3 +- BSD-4-Clause/BSD-4-Clause (University of California-Specific) - Facebook BSD+Patents license -- [NPL 1.0](https://spdx.org/licenses/NPL-1.0.html)/[NPL 1.1](https://spdx.org/licenses/NPL-1.1.html) +- NPL 1.0/NPL 1.1 - The Solipsistic Eclipse Public License -- [The "Don't Be A Dick" Public License](https://dbad-license.org/) -- [JSON License](http://www.json.org/license.html) +- The "Don't Be A Dick" Public License +- JSON License ## 引入特殊许可证的规则 diff --git "a/zh-cn/contribute/\350\264\241\347\214\256\344\273\243\347\240\201.md" "b/zh-cn/contribute/\350\264\241\347\214\256\344\273\243\347\240\201.md" index 7c88515d1be29f7211403c4ead878da940d6755f..9c915ea4f67eb0ac3f127cad6c77743c6aed6a98 100755 --- "a/zh-cn/contribute/\350\264\241\347\214\256\344\273\243\347\240\201.md" +++ "b/zh-cn/contribute/\350\264\241\347\214\256\344\273\243\347\240\201.md" @@ -4,13 +4,13 @@ ### 设计规范 -[OpenHarmony架构设计原则](https://gitee.com/openharmony/community/blob/master/sig/sig-QA/%E6%9E%B6%E6%9E%84%E8%AE%BE%E8%AE%A1%E5%8E%9F%E5%88%99.md) +[OpenHarmony架构设计原则](https://gitee.com/openharmony/community/blob/master/sig/sig_qa/%E6%9E%B6%E6%9E%84%E8%AE%BE%E8%AE%A1%E5%8E%9F%E5%88%99.md) [OpenHarmony API治理章程](../design/OpenHarmony-API-governance.md) [OpenHarmony安全设计规范](OpenHarmony-security-design-guide.md) -[OpenHarmony编译规范](https://gitee.com/openharmony/community/blob/master/sig/sig-buildsystem/%E7%BC%96%E8%AF%91%E8%A7%84%E8%8C%83.md) +[OpenHarmony编译规范](https://gitee.com/openharmony/community/blob/master/sig/sig_buildsystem/%E7%BC%96%E8%AF%91%E8%A7%84%E8%8C%83.md) ### 代码风格 @@ -38,11 +38,11 @@ 有关详细信息,请参考[贡献流程](贡献流程.md)。 -[代码门禁详细质量要求](https://gitee.com/openharmony/community/blob/master/sig/sig-QA/%E4%BB%A3%E7%A0%81%E9%97%A8%E7%A6%81%E8%A6%81%E6%B1%82.md)。 +[代码门禁详细质量要求](https://gitee.com/openharmony/community/blob/master/sig/sig_qa/%E4%BB%A3%E7%A0%81%E9%97%A8%E7%A6%81%E8%A6%81%E6%B1%82.md)。 -[需求类Issue处理指导](https://gitee.com/openharmony/community/blob/master/sig/sig-QA/issue%EF%BC%88%E9%9C%80%E6%B1%82%E7%B1%BB%EF%BC%89%E5%A4%84%E7%90%86%E6%8C%87%E5%AF%BC.md) +[需求类Issue处理指导](https://gitee.com/openharmony/community/blob/master/sig/sig_qa/issue%EF%BC%88%E9%9C%80%E6%B1%82%E7%B1%BB%EF%BC%89%E5%A4%84%E7%90%86%E6%8C%87%E5%AF%BC.md) -[缺陷类Issue处理指导](https://gitee.com/openharmony/community/blob/master/sig/sig-QA/issue-%E7%BC%BA%E9%99%B7%E7%B1%BB-%E5%A4%84%E7%90%86%E6%8C%87%E5%AF%BC.md) +[缺陷类Issue处理指导](https://gitee.com/openharmony/community/blob/master/sig/sig_qa/issue_%E7%BC%BA%E9%99%B7%E7%B1%BB_%E5%A4%84%E7%90%86%E6%8C%87%E5%AF%BC.md) ## 社区安全问题披露 diff --git "a/zh-cn/contribute/\350\264\241\347\214\256\346\226\207\346\241\243.md" "b/zh-cn/contribute/\350\264\241\347\214\256\346\226\207\346\241\243.md" index a5a9bd99d8f20247f68efa03b5e067ee65f2f76c..6743b12052f5ba6dcb4b4a05e60f01c0dbc39c71 100755 --- "a/zh-cn/contribute/\350\264\241\347\214\256\346\226\207\346\241\243.md" +++ "b/zh-cn/contribute/\350\264\241\347\214\256\346\226\207\346\241\243.md" @@ -2,10 +2,8 @@ 非常欢迎您贡献文档,我们鼓励开发者以各种方式参与文档反馈和贡献。您可以对现有文档进行评价、简单更改、反馈文档质量问题、贡献您的原创内容。 -卓越贡献者将会在开发者社区文档贡献专栏表彰公示。 - - [贡献方式](#贡献方式) -- [写作规范](写作规范.md) +- [文档风格](style-guide/Readme-CN.md) ## 内容版权 @@ -15,7 +13,7 @@ ## License -[Creative Commons License version 4.0](https://creativecommons.org/licenses/by/4.0/legalcode) +Creative Commons License version 4.0 ## 贡献方式 @@ -26,7 +24,7 @@ 1. 在Gitee页面中,“Issue”页签中单击“新建Issue”,在标题栏中描述问题,在编辑框中添加详细问题描述。 2. 单击“创建”按钮,提交Issue,耐心等待文档团队成员确认您的问题。 ->![](public_sys-resources/icon-note.gif) **说明**: +>**说明**: >**如何反馈一个高质量的问题**? > >- 提供问题的清晰描述,描述具体缺失、过时、错误的内容或者需要改进的文字。 diff --git "a/zh-cn/contribute/\350\264\241\347\214\256\346\265\201\347\250\213.md" "b/zh-cn/contribute/\350\264\241\347\214\256\346\265\201\347\250\213.md" index c874beef6347925bcbf81456add00264b4cb8c4f..9f0c341e9e61fa8cf3888795c75e488f57044ff0 100755 --- "a/zh-cn/contribute/\350\264\241\347\214\256\346\265\201\347\250\213.md" +++ "b/zh-cn/contribute/\350\264\241\347\214\256\346\265\201\347\250\213.md" @@ -225,7 +225,7 @@ repo push --br="20200903" --d="master" --content="#I1TVV4" 如果门禁通过,该Issue关联的所有PR均会自动标记“测试通过”。 -详细参考[代码门禁质量要求](https://gitee.com/openharmony/community/blob/master/sig/sig-QA/%E4%BB%A3%E7%A0%81%E9%97%A8%E7%A6%81%E8%A6%81%E6%B1%82.md)。 +详细参考[代码门禁质量要求](https://gitee.com/openharmony/community/blob/master/sig/sig_qa/%E4%BB%A3%E7%A0%81%E9%97%A8%E7%A6%81%E8%A6%81%E6%B1%82.md)。 ## CI门户 diff --git a/zh-cn/design/OpenHarmony-API-quality.md b/zh-cn/design/OpenHarmony-API-quality.md index 21d0ca4e81dd6e15ebd7247439bd1953e5e09aef..8249c8dbd374d2046213fde7e5f296bc31730fcd 100644 --- a/zh-cn/design/OpenHarmony-API-quality.md +++ b/zh-cn/design/OpenHarmony-API-quality.md @@ -23,7 +23,7 @@ OpenHarmony API主要包含了对应用开放的外部API,以及系统实现 * OpenHarmony Public API * OpenHarmony System API -关于OpenHarmony API的分类,请参见[《 OpenHarmony API治理章程》](https://gitee.com/openharmony/docs/blob/master/zh-cn/design/OpenHarmony-API-governance.md)。 +关于OpenHarmony API的分类,请参见[《OpenHarmony API治理章程》](https://gitee.com/openharmony/docs/blob/master/zh-cn/design/OpenHarmony-API-governance.md)。 ## 接口设计目标 @@ -379,7 +379,7 @@ doSomethingThird() 还有一些情况下,大家在做某件事的时候,会本能的以为别人也有同样的背景认识。但事实往往并不是这样。在编程时也是一样。 -例如,对于一个描述编程语言的字段,可能会将其命名为`language`。这是因为大家默认认为已经在讨论编程语言了,但是`language`到底是编程语言还是国际化语言?是不是叫做`programmingLanuage`更好一些呢? +例如,对于一个描述编程语言的字段,可能会将其命名为`language`。这是因为大家默认认为已经在讨论编程语言了,但是`language`到底是编程语言还是国际化语言?是不是叫做`programmingLanguage`更好一些呢? 当然,对于这一条还是要举一个反例,不要走到另外一个极端:如果类名或者namespace名称中已经明确带了一个前缀,在函数中就没必要再重复一遍了。毫无信息量的冗余是没有必要的。 @@ -500,7 +500,7 @@ OpenHarmony是为多种不同类型设备设计的统一操作系统。 * 健康类传感器只在穿戴设备上有 * 车控类接口只在车机设备上有 -这种情况,请参考[《 SysCap使用指南》](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/quick-start/syscap.md),来标定API的适用范围。 +这种情况,请参考[《SysCap使用指南》](../application-dev/reference/syscap.md),来标定API的适用范围。 ### 一致性 diff --git a/zh-cn/design/hdi-design-specifications.md b/zh-cn/design/hdi-design-specifications.md index 5b20dd0799214d46a45197f8a4eb3b87b6628c3c..43833f5b29977d9bc94555cd2ba54a273fd6d5a3 100644 --- a/zh-cn/design/hdi-design-specifications.md +++ b/zh-cn/design/hdi-design-specifications.md @@ -3,7 +3,7 @@ ## 总览 硬件设备接口(以下简称为设备接口)作为连通驱动程序和系统服务进行数据流通的桥梁,直接影响着系统的高效性、稳定性、兼容性、可靠性以及数据的正确性、完整性。本文档的目的是规范OpenHarmony设备接口的设计和开发,保证接口的风格一致、功能完备,提升设备接口的设计质量。 -本章程由[Driver SIG](https://gitee.com/openharmony/community/blob/master/sig/sig-driver/sig_driver_cn.md)制定,经[PMC](https://gitee.com/link?target=https%3A%2F%2Fwww.openharmony.cn%2Fcommunity%2Fpmc%2F)批准发布;对本章程的修订必须经由Driver SIG评审后,由PMC批准发布。 +本章程由[Driver SIG](https://gitee.com/openharmony/community/blob/master/sig/sig_driver/sig_driver_cn.md)制定,经[PMC](https://gitee.com/link?target=https%3A%2F%2Fwww.openharmony.cn%2Fcommunity%2Fpmc%2F)批准发布;对本章程的修订必须经由Driver SIG评审后,由PMC批准发布。 **术语和定义:** diff --git a/zh-cn/device-dev/Readme-CN.md b/zh-cn/device-dev/Readme-CN.md index 75f58ab4228925d2c57096ed3d2d29cff2e28314..0ee0a90d465c6b126a4baeca742ce2cec4cd1882 100644 --- a/zh-cn/device-dev/Readme-CN.md +++ b/zh-cn/device-dev/Readme-CN.md @@ -38,10 +38,8 @@ - [图形图像](subsystems/subsys-graphics-overview.md) - [媒体](subsystems/subsys-multimedia-camera-overview.md) - [公共基础](subsystems/subsys-utils-guide.md) - - [AI框架](subsystems/subsys-ai-aiframework-devguide.md) - - [数据管理](subsystems/subsys-data-relational-database-overview.md) + - [AI框架](subsystems/subsys-ai-aiframework-devguide.md) - [Sensor服务](subsystems/subsys-sensor-overview.md) - - [USB服务](subsystems/subsys-usbservice-overview.md) - [用户程序框架](subsystems/subsys-application-framework-overview.md) - [OTA升级](subsystems/subsys-ota-guide.md) - [电话服务](subsystems/subsys-tel-overview.md) diff --git a/zh-cn/device-dev/driver/driver-hdf-load.md b/zh-cn/device-dev/driver/driver-hdf-load.md index 7ce200f248442dc6df054a5b70bee0c3ad612809..68205c18e15d495b41bf61ae817999ef5f697115 100644 --- a/zh-cn/device-dev/driver/driver-hdf-load.md +++ b/zh-cn/device-dev/driver/driver-hdf-load.md @@ -28,3 +28,8 @@ typedef enum { ### 按序加载(默认加载策略) 配置文件中的priority(取值范围为整数0到200)是用来表示host(驱动容器)和驱动的优先级。不同的host内的驱动,host的priority值越小,驱动加载优先级越高;同一个host内驱动的priority值越小,加载优先级越高。 + +### 异常恢复(用户态驱动) +当驱动服务异常退出时,恢复策略如下: +- preload字段配置为0(DEVICE_PRELOAD_ENABLE)或1(DEVICE_PRELOAD_ENABLE_STEP2)的驱动服务,由启动模块拉起host并重新加载服务。 +- preload字段配置为2(DEVICE_PRELOAD_DISABLE)的驱动服务,需业务模块注册HDF的服务状态监听器,当收到服务退出消息时,业务模块调用LoadDevice重新加载服务。 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 d817ef48a6a1796bdf5dd9e33743d23d84d2a6d6..bf3ac64033d3c3135dbf7fe4fca54faf03174060 100755 --- a/zh-cn/device-dev/driver/driver-peripherals-camera-des.md +++ b/zh-cn/device-dev/driver/driver-peripherals-camera-des.md @@ -633,7 +633,7 @@ Camera驱动的开发过程主要包含以下步骤: ### 开发实例 -在/drivers/peripheral/camera/hal/init目录下有一个关于Camera的demo,开机后会在/vendor/bin下生成可执行文件ohos_camera_demo,该demo可以完成Camera的预览,拍照等基础功能。下面我们就以此demo为例讲述怎样用HDI接口去编写预览PreviewOn()和拍照CaptureON()的用例,可参考[ohos_camera_demo](https://gitee.com/openharmony/drivers_peripheral/tree/master/camera/hal/init)。 +在/drivers/peripheral/camera/hal/test/demo目录下有一个关于Camera的demo,开机后会在/vendor/bin下生成可执行文件ohos_camera_demo,该demo可以完成Camera的预览,拍照等基础功能。下面我们就以此demo为例讲述怎样用HDI接口去编写预览PreviewOn()和拍照CaptureON()的用例,可参考[ohos_camera_demo](https://gitee.com/openharmony/drivers_peripheral/tree/master/camera/hal/test/demo)。 1. 在main函数中构造一个CameraDemo 对象,该对象中有对Camera初始化、启停流、释放等控制的方法。下面mainDemo->InitSensors()函数为初始化CameraHost,mainDemo->InitCameraDevice()函数为初始化CameraDevice。 diff --git a/zh-cn/device-dev/get-code/sourcecode-acquire.md b/zh-cn/device-dev/get-code/sourcecode-acquire.md index 6c0370b4548b0c4a8fb75bcd55cdd6fcf379f5fc..62ebd318f569460d30034e454f6dff926f9e8a70 100644 --- a/zh-cn/device-dev/get-code/sourcecode-acquire.md +++ b/zh-cn/device-dev/get-code/sourcecode-acquire.md @@ -198,12 +198,12 @@ OpenHarmony是由开放原子开源基金会(OpenAtom Foundation)孵化及 | Hi3516解决方案-Linux(二进制) | 3.0 | [站点](https://repo.huaweicloud.com/openharmony/os/3.0/hispark_taurus_linux.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.0/hispark_taurus_linux.tar.gz.sha256) | 418.1 MB | | RELEASE-NOTES | 3.0 | [站点](https://gitee.com/openharmony/docs/blob/OpenHarmony-3.0-LTS/zh-cn/release-notes/OpenHarmony-v3.0-LTS.md) | - | - | | **最新发布版本源码** | **版本信息** | **下载站点** | **SHA256校验码** | **软件包容量** | -| 全量代码Beta版本(标准、轻量和小型系统) | 3.2 Beta5 | [站点](https://repo.huaweicloud.com/harmonyos/os/3.2-Beta5/code-v3.2-Beta5.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/harmonyos/os/3.2-Beta5/code-v3.2-Beta5.tar.gz.sha256) | 21.3 GB | -| Hi3861解决方案(二进制) | 3.2 Beta5 | [站点](https://repo.huaweicloud.com/harmonyos/os/3.2-Beta5/hispark_pegasus.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/harmonyos/os/3.2-Beta5/hispark_pegasus.tar.gz.sha256) | 22.9 MB | -| Hi3516解决方案-LiteOS(二进制) | 3.2 Beta5 | [站点](https://repo.huaweicloud.com/openharmony/os/3.2-Beta5/hispark_taurus_LiteOS.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.2-Beta5/hispark_taurus_LiteOS.tar.gz.sha256) | 293.6 MB | -| Hi3516解决方案-Linux(二进制) | 3.2 Beta5 | [站点](hispark_taurus_Linux.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.2-Beta5/hispark_taurus_Linux.tar.gz.sha256) | 174.3 MB | -| RK3568标准系统解决方案(二进制) | 3.2 Beta5 | [站点](https://repo.huaweicloud.com/harmonyos/os/3.2-Beta5/dayu200_standard_arm32_20230201.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/harmonyos/os/3.2-Beta5/dayu200_standard_arm32_20230201.tar.gz.sha256) | 3.9 GB | -| RELEASE-NOTES | 3.2 Beta5 | [站点](../../release-notes/OpenHarmony-v3.2-beta5.md) | - | - | +| 全量代码Beta版本(标准、轻量和小型系统) | 3.2 Release | [站点](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/code-v3.2-Release.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/code-v3.2-Release.tar.gz.sha256) | 21.8 GB | +| Hi3861解决方案(二进制) | 3.2 Release| [站点](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/hispark_pegasus.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/harmonyos/os/3.2-Release/hispark_pegasus.tar.gz.sha256) | 22.9 MB | +| Hi3516解决方案-LiteOS(二进制) | 3.2 Release| [站点](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_LiteOS.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_LiteOS.tar.gz.sha256) | 294.3 MB | +| Hi3516解决方案-Linux(二进制) | 3.2 Release| [站点](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_Linux.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_Linux.tar.gz.sha256) | 174.3 MB | +| RK3568标准系统解决方案(二进制) | 3.2 Release| [站点](https://repo.huaweicloud.com/harmonyos/os/3.2-Release//dayu200_standard_arm32.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/harmonyos/os/3.2-Release//dayu200_standard_arm32.tar.gz.sha256) | 3.9 GB | +| RELEASE-NOTES | 3.2 Release| [站点](../../release-notes/OpenHarmony-v3.2-release.md) | - | - | | **编译工具链** | **版本信息** | **下载站点** | **SHA256校验码** | **软件包容量** | | 编译工具链获取清单 | - | [站点](https://repo.huaweicloud.com/openharmony/os/2.0/tool_chain/) | - | - | diff --git a/zh-cn/device-dev/kernel/Readme-CN.md b/zh-cn/device-dev/kernel/Readme-CN.md index 6830f1c25d24f603a0a5d78a2123bca96ea98c9d..4334e426a66c53801fb1b9f044eaad0426f5a57c 100755 --- a/zh-cn/device-dev/kernel/Readme-CN.md +++ b/zh-cn/device-dev/kernel/Readme-CN.md @@ -62,6 +62,7 @@ - [动态加载与链接](kernel-small-bundles-linking.md) - [虚拟动态共享库](kernel-small-bundles-share.md) - [轻量级进程间通信](kernel-small-bundles-ipc.md) + - [容器隔离](kernel-small-bundles-container.md) - 文件系统 - [虚拟文件系统](kernel-small-bundles-fs-virtual.md) - [支持的文件系统](kernel-small-bundles-fs-support.md) diff --git a/zh-cn/device-dev/kernel/figures/container-001.png b/zh-cn/device-dev/kernel/figures/container-001.png new file mode 100644 index 0000000000000000000000000000000000000000..70fa4f4c421e863bdc6f1e897d46f5a22f28091a Binary files /dev/null and b/zh-cn/device-dev/kernel/figures/container-001.png differ diff --git a/zh-cn/device-dev/kernel/figures/container-002.png b/zh-cn/device-dev/kernel/figures/container-002.png new file mode 100644 index 0000000000000000000000000000000000000000..fac8e06cb9498e5d08df9f11cf9da20f65848ff6 Binary files /dev/null and b/zh-cn/device-dev/kernel/figures/container-002.png differ diff --git a/zh-cn/device-dev/kernel/figures/container-003.png b/zh-cn/device-dev/kernel/figures/container-003.png new file mode 100644 index 0000000000000000000000000000000000000000..41761baa328686aadf90ea31a62ea8ea8d455754 Binary files /dev/null and b/zh-cn/device-dev/kernel/figures/container-003.png differ diff --git a/zh-cn/device-dev/kernel/kernel-small-bundles-container.md b/zh-cn/device-dev/kernel/kernel-small-bundles-container.md new file mode 100644 index 0000000000000000000000000000000000000000..00d8733ec7050f78f25db4c1e80c65db816635dd --- /dev/null +++ b/zh-cn/device-dev/kernel/kernel-small-bundles-container.md @@ -0,0 +1,363 @@ +# 容器隔离 + +## 概述 + +容器(Container)提供了一种资源隔离的解决方案。系统中许多资源是全局管理的。例如进程PID、主机信息、用户信息等,容器机制是对这种全局资源的隔离,使得处于不同容器的进程拥有独立的全局系统资源,改变一个容器中的系统资源只会影响当前容器里的进程,对其他容器中的进程没有影响。 + +LiteOS-A内核容器隔离功能包含7个容器:UTS容器、PID容器、Mount容器、Network容器、TIME容器、IPC容器、User容器。通过所在进程ProcessCB的Container和Credentials保存。 + +隔离的容器如下表。 + +| 编号 | 名称 | 宏定义/flag | 隔离资源 | 数据结构定义位置 | +| :-------- | :------------- | :------------------- | :----------------------- | :----------------------- | +| 1 | UTS | CLONE_NEWUTS | 主机名,域名,版本信息 |struct Container | +| 2 | PID | CLONE_NEWPID | 进程ID |struct Container | +| 3 | Mount | CLONE_NEWNS | 文件系统挂载点 |struct Container | +| 4 | Network | CLONE_NEWNET | 网络系统资源 |struct Container | +| 5 | TIME | CLONE_NEWTIME | 时钟资源 |struct Container | +| 6 | IPC | CLONE_NEWIPC | 进程间通信资源 |struct Container | +| 7 | User | CLONE_NEWUSER | 用户和用户组 |struct Credentials | + +容器之间的资源隔离,细分为两种: + + - 全局隔离:属于平行关系(无继承关系)的容器,所有容器之间的容器类资源彼此不可见。 + + - 非全局隔离:属于有父子继承关系的容器,同一层的各容器之间资源不可见,但上层容器仍然可以访问下层容器资源。 + +PID容器通过 unshare/setns 切换时,切换子进程的容器,而本进程容器不变。 + +通过在子进程ProcessCB中添加对应容器集合Container和用户容器,完成对容器功能的支持,并通过编译开关控制特性的开启和关闭。 + + - 每个进程ProcessCB包含一个Container指针,该指针指向真正分配的Container结构。通过这种方式,进程可单独拥有一个Container结构,也可共享同一个Container结构。 进一步分解,在Container结构中,包含各容器指针,分别指向UTS容器、PID容器、Network容器、Mount容器、TIME容器、IPC容器。 + + - 每个进程ProcessCB对应一个Credentials结构,单独管理User容器,便于模块化、单独处理User容器的特有逻辑。 + + + +![总体设计-总体结构-1](figures/container-001.png) + +### 各容器简介 + +#### **UTS容器** + +UTS 容器用于对主机名和域名进行隔离。 + +每一个进程对应有一个自己的UTS Container,用来隔离容器的内核名称、版本等信息,不同容器查看到的都是属于自己的信息,相互间不能查看。 + +#### **Mount容器** + +用于隔离文件挂载点。在一个容器里挂载、卸载的动作不会影响到其他容器。 + +通过文件挂载容器,实现各进程间相互独立的使用文件挂载系统,子进程在独立的文件挂载容器里面进行挂载操作,可以建立自身的文件挂载结构: + +- 文件挂载容器的基础实现,创建进程时根据clone传入的参数flag在各自进程创建文件挂载容器,将挂载信息从全局更改为与文件挂载容器相关联。 + +- 创建容器后,修改获取当前挂载信息的实现,将从全局或者更改为当前文件挂载容器中获取,使进程挂载、卸载或者访问挂载文件操作不会对其他进程挂载信息产生影响或者访问到其他进程的文件挂载信息。 + +#### **PID容器** + +用于隔离进程号,不同容器的进程可以使用相同的虚拟进程号。 + + 进程容器主要用于进程的隔离,特点如下: + +- 容器间的进程ID相互独立。 +- 父容器可以看到子容器中的进程,且同一个进程在父容器中的进程ID和子容器中的进程ID相互独立。 +- 子容器无法看到父容器中的进程。 +- 在根容器下可以看到系统的所有进程。 + +#### **Network容器** + +用于隔离系统网络设备和网络栈。 + +Network容器对TCP/IP协议栈和网络设备资源进行隔离,以达到隔离目的。 + + - 传输层隔离:对端口号进行隔离,Network容器内的可用端口号范围是0~65535,进程绑定的是自己所属容器的端口号,所以不同Network容器的进程可以对同一个TCP/UDP端口号进行绑定,且互相之间没有影响。 + - IP层隔离:对IP资源进行隔离,每个容器都有属于自己的IP资源,在一个Network容器内修改IP对其他Network容器没有影响。 + - 网络设备隔离:对网卡进行隔离,每个容器都有属于自己的网卡,不同Network容器内的网卡设备之间相互隔离无法通信,用户可以通过配置veth-pair解决不同容器间的通信问题。 + +#### **User容器** + +用于隔离用户和用户组。 + +User Container是用来隔离和分割管理权限的,管理权限实质分为两部分uid/gid和Capability。 + +- UID/GID + + User Container是对资源的一种隔离,主要隔离uid/gid,处于不同的User Container具有不同的uid/gid,每个User container拥有独立的从0开始的uid/gid。这样容器中的进程可以拥有root权限,但是它的root权限会被限制在一小块范围之内。改变一个User Container中的值只会影响当前User Container,对其他User Container中的进程无影响。 + +- Capability + + User Container通过设置Capability来实现能力隔离。 + + 每个进程在进程初始化的时候调用OsInitCapability对权限进行初始化,对用户提供修改和获取(SysCapSet/SysCapGet)权限的系统调用,用于修改进程的权限。 + +Capabilities的类型如下表: + +| 名称 | 描述 | +| --------------------- | ---------------------------------------------- | +| CAP_CHOWN | 修改文件所有者的权限 | +| CAP_DAC_EXECUTE | 忽略文件执行的 DAC 访问限制 | +| CAP_DAC_WRITE | 忽略文件写的 DAC 访问限制 | +| CAP_DAC_READ_SEARCH | 忽略文件读及目录搜索的 DAC 访问限制 | +| CAP_FOWNER | 忽略文件属主 ID 必须和进程用户 ID 相匹配的限制 | +| CAP_KILL | 允许对不属于自己的进程发送信号 | +| CAP_SETGID | 允许改变进程的GID | +| CAP_SETUID | 允许改变进程的UID | +| CAP_NET_BIND_SERVICE | 允许绑定到小于 1024 的端口 | +| CAP_NET_BROADCAST | 允许网络广播和多播访问 | +| CAP_NET_ADMIN | 允许执行网络管理任务 | +| CAP_NET_RAW | 允许使用原始套接字 | +| CAP_FS_MOUNT | 允许使用 chroot() 系统调用 | +| CAP_FS_FORMAT | 允许使用文件格式 | +| CAP_SCHED_SETPRIORITY | 允许设置优先级 | +| CAP_SET_TIMEOFDAY | 允许设置系统时间 | +| CAP_CLOCK_SETTIME | 允许改变系统时钟 | +| CAP_CAPSET | 允许设置任意的 capabilities | +| CAP_REBOOT | 允许重新启动系统 | +| CAP_SHELL_EXEC | 允许执行shell | + +#### **TIME容器** + +用于隔离系统的时间维护信息。 + +每一个进程对应有一个自己的TIME Container,用来隔离`CLOCK_MONOTONIC`和`CLOCK_MONOTONIC_RAW`对应的时钟,不同容器中的进程在对`CLOCK_MONOTONIC`和`CLOCK_MONOTONIC_RAW`时钟进行对应的时间操作调用时,彼此之间时钟的数值相对独立,实现安全容器间系统时钟的隔离。 + +容器(当前进程的time_for_children容器)中时钟的偏移量记录在`/proc/PID/timens_offsets`文件中,通过修改该文件,可以对应修改TIME容器的偏移信息。这些偏移是相对于初始时间容器中的时钟值表示的。 + +当前,创建TIME Container的唯一方法是通过使用`CLONE_NEWTIME`标志调用`unshare`。该调用将创建一个新的TIME Container,但不会将调用过程放在新的容器中。而是调用进程的随后创建的子级将放置在新的容器中。 + +这允许时钟偏移,用于新的容器的第一进程被放置在容器之前进行设置`/proc/PID/timens_offsets`文件。 + +#### **IPC容器** + +用于隔离进程间通信对象(IPC对象),包括消息队列和共享内存。 + +每一个进程对应有一个自己的IPC Container,用来隔离如下全局资源:消息队列、共享内存。 + +不同容器中的进程在对消息队列、共享内存进行对应的时间操作调用时,彼此之间是独立的。 + +- 消息队列隔离:把用于消息队列的全局变量结构LosQueueCB修改为IPC Container中的局部变量保存,从而实现在各自进程中的容器内可见,达到相互隔离的效果。 + +- 共享内存隔离:把用于共享内存的全局变量shmInfo,sysvShmMux,shmSegs,shmUsedPageCount修改为IPC Container中的局部变量保存,从而实现在各自进程中的容器内可见,达到相互隔离的效果。 + +### 运作机制 + +#### 新建容器流程 + +在系统初始化时,需要为初始进程(0号、1号、2号进程)创建同一个根容器,根容器类型包括所有7种类型:UTS容器、PID容器、User容器、Network容器、Mount容器、TIME容器、IPC容器。 + +后续可通过clone等接口为子进程新建容器(指定容器FLAG),未指定容器FLAG的情况下clone的子进程复用父进程容器。 + +![容器节点公共定义部分ContainerBase](figures/container-002.png) + + + +#### 切换容器流程 + +通过 unshare接口,将当前进程脱离当前所属容器,并转移到一个新建的容器。以IPC容器为例。 + +容器节点公共定义部分ContainerBase + +## 开发指导 + +应用层可基于容器隔离功能,进行如下场景的使用,新建容器、切换容器、销毁容器。 + +### 新建容器 + +创建子进程时可以完成新建容器。接口如下: + +**clone接口** + +通过clone()创建新进程的同时创建容器,是新建容器的一种常见做法,函数原型: + +``` +int clone(int (*fn)(void *), void *stack, int flags, void *arg, ... + /* pid_t *parent_tid, void *tls, pid_t *child_tid */ ); +``` + + - clone时可以指定新建的子进程通过容器隔离资源,使得资源(如UTS信息)获取和修改只限于容器范围内,不影响其他容器。 + + - 若调用clone接口不指定容器相关FLAG,则会将子进程也放到父进程所在容器中,即复用/共享父进程的容器。 + +### 切换容器 + + 转移/切换容器是调整已有进程的容器。包括2种情况: + +- **unshare 接口** + + 通过 unshare接口,将当前进程脱离当前所属容器,并转移到一个新建的容器。函数原型: + ``` + int unshare(int flags); + ``` + + 参考其他内核的实现,PID容器特殊处理,PID容器通过 unshare/setns 切换时, 是切换子进程的容器,而本进程容器仍然保持不变。 + + 方法是,本进程将新建的容器记录下来,创建子进程时再根据记录信息进行容器归属。 + + 这一点上,与其他容器(如Network容器)有区别,其他容器的setns、unshare操作是直接对已有进程生效。 + + 可以一句话总结为: PID容器的setns和unshare操作,是针对后代进程的PID容器。 + +- **setns接口** + + 通过 setns接口,将当前进程脱离当前所属容器,并转移到一个已有的容器。便于灵活切换进程容器。 + + PID容器通过 setns 转移时, 是切换子进程的容器,而本进程容器仍然保持不变。同上文。函数原型: + + ``` + int setns(int fd, int nstype); + ``` + +### 销毁容器 + +进程终止时会退出所属容器,并对引用计数进行递减。引用计数减为0的对象,需要进行销毁。 + +通过kill接口,可向指定进程发送指定信号,通知进程执行关闭/退出动作。函数原型: + +``` +int kill(pid_t pid, int sig); +``` + +### 查询容器信息 + +容器隔离之后,系统用户可使用 ls 命令访问 /proc/[pid]/container/ 目录进行查看和确认。 + +``` +ls -l /proc/[pid]/container +``` + +| 属性 | 所属用户 | 所属用户组 | 文件名 | 说明 | +| :--------- | :------- | :--------- | :--------------------------------------- | :--------------------- | +| lr--r--r-- | u:0 | g:0 | net -> 'net:[4026531847]' | 链接对象为容器唯一编号 | +| lr--r--r-- | u:0 | g:0 | user -> 'user:[4026531841]' | 同上 | +| lr--r--r-- | u:0 | u:0 | time_for_children -> 'time:[4026531846]' | 同上 | +| lr--r--r-- | u:0 | g:0 | time -> 'time:[4026531846]' | 同上 | +| lr--r--r-- | u:0 | g:0 | ipc -> 'ipc:[4026531845]' | 同上 | +| lr--r--r-- | u:0 | g:0 | mnt -> 'mnt:[4026531844]' | 同上 | +| lr--r--r-- | u:0 | g:0 | uts -> 'uts:[4026531843]' | 同上 | +| lr--r--r-- | u:0 | g:0 | pid_for_children -> 'pid:[4026531842]' | 同上 | +| lr--r--r-- | u:0 | g:0 | pid -> 'pid:[4026531842]' | 同上 | + +### 容器配额 + +容器配额(plimits)的主要功能是限制进程组可以使用的资源,/proc/plimits 目录作为容器配额根目录。 + +- plimits文件系统为伪文件系统,需要实现文件与plimits控制变量的映射;通过文件操作,达到修改内核变量的目的。例如:memory限制器中,通过用户修改memory.limit文件内容,即可修改相应的内核变量值,进而限制内存分配。 +- plimits文件系统中,文件能够被读写,目录能够被增删。 +- plimits的目录,映射的是plimits的分组,所以需要在创建目录的时候,自动创建目录下的文件(这些文件映射为限制器的控制变量)。 +- 创建限制器的文件是以组为单位创建的,例如:创建memory限制器,在增加一个memory限制器的时候,会全量创建所需的文件,而不是单独创建单个文件。 + +采用编译宏“LOSCFG_PROCESS_LIMITS”进行开关控制,y打开,n关闭,默认关闭 + +打开编译开关,查看 /proc/plimits目录, 主要包含下列文件: + +| 权限 | 用户 | 用户组 | 文件名 | 描述 | 备注 | +| ---------- | ---- | ------ | ---------------- | --------------------------------- | ------------------------------------------------------------ | +| -r--r--r-- | u:0 | g:0 | sched.stat | 调度统计信息 | 输出格式:[PID runTime] | +| -r--r--r-- | u:0 | g:0 | sched.period | 调度周期配置 | 单位:us | +| -r--r--r-- | u:0 | g:0 | sched.quota | 调度配额配置 | 单位:us | +| -r--r--r-- | u:0 | g:0 | devices.list | 报告plimits中的进程访问的设备 | 输出格式:[type name access] | +| -r--r--r-- | u:0 | g:0 | devices.deny | 指定plimits中的进程可以访问的设备 | 写入格式:["type name access" >> device.deny] | +| -r--r--r-- | u:0 | g:0 | devices.allow | 报告plimits中的进程不能访问的设备 | 写入格式:["type name access" >> device.allow] | +| -r--r--r-- | u:0 | g:0 | ipc.stat | ipc对象申请统计信息 | 输出格式:[mq count: mq failed count:
shm size: shm failed count: ] | +| -r--r--r-- | u:0 | g:0 | ipc.shm_limit | 共享内存大小上限 | 单位:byte | +| -r--r--r-- | u:0 | g:0 | ipc.mq_limit | 消息个数上限 | 0~最大64位正整数 | +| -r--r--r-- | u:0 | g:0 | memory.stat | 内存统计信息 | 单位:byte | +| -r--r--r-- | u:0 | g:0 | memory.limit | 组内进程占用内存总量配额 | 单位:byte | +| -r--r--r-- | u:0 | g:0 | pids.max | 组内包括的最大进程个数 | / | +| -r--r--r-- | u:0 | g:0 | pids.priority | 组内包括的最高进程优先级 | / | +| -r--r--r-- | u:0 | g:0 | plimits.procs | 组内包含的所有进程的pid | / | +| -r--r--r-- | u:0 | g:0 | plimits.limiters | plimits组内包含的限制器 | / | + +其中devices参数说明: + +| type (设备类型) | name (设备名字) | access (相应的权限) | +| -------------------------------------------- | ----------------- | ---------------------------------- | +| a - 所有设备,可以是字符设备,也可以是块设备 | / | r - 允许进程读取指定设备 | +| b- 块设备 | / | w - 允许进程写入指定设备 | +| c - 字符设备 | / | m - 允许进程生成还不存在的设备文件 | + +## 参考 + +### 规格说明 + +#### 参数设定 + +内核支持每一种容器最大数默认为LOSCFG_KERNEL_CONTAINER_DEFAULT_LIMIT。 + +内核初始化proc/sys/user目录,生成文件max_net_container,max_ipc_container,max_time_container,max_uts_container,max_user_container,max_pid_container,max_mnt_container并且将伪文件与内核参数绑定。用户配置伪文件即会修改对应的内核参数。当前容器数量如果小于上限,则可创建新的容器,否则返回NULL表示失败。 + +#### 容器唯一编号 + +各容器的全局唯一编号,统一基于一个固定值进行编号。 + +``` +#define CONTAINER_IDEX_BASE (0xF0000000) +inum = CONTAINER_IDEX_BASE + (unsigned int)i; +``` + +#### 规则设定 + +- PID容器和User容器,具有分层关系,最大支持3层;其他的UTS、Mount、Network容器无分层关系。 + +- 通过上述接口clone创建容器、setns切换容器、unshare切换容器时,需传入符合POSIX标准的FLAG,如下: + +| FLAG | clone | setns | unshare | +| ------------- | ---------------------------- | -------------------------------- | -------------------------------- | +| CLONE_NEWNS | 为子进程新建文件系统容器 | 将当前进程转移到指定文件系统容器 | 为本进程新建文件系统容器 | +| CLONE_NEWPID | 为子进程新建PID容器 | 将当前进程转移到指定PID容器 | 为本进程新建的子进程新建PID容器 | +| CLONE_NEWIPC | 为子进程新建IPC容器 | 将当前进程转移到指定IPC容器 | 为本进程新建IPC容器 | +| CLONE_NEWTIME | 为进程所属父进程新建TIME容器 | 暂不支持 | 为本进程新建的子进程新建TIME容器 | +| CLONE_NEWUSER | 为子进程新建User容器 | 将当前进程转移到指定User容器 | 为本进程新建User容器 | +| CLONE_NEWUTS | 为子进程新建UTSNAME容器 | 将当前进程转移到指定UTSNAME容器 | 为本进程新建UTSNAME容器 | +| CLONE_NEWNET | 为子进程新建Network容器 | 将当前进程转移到指定Network容器 | 为本进程新建Network容器 | + +- 容器功能采用编译宏、编译脚本中参数结合,完成特性的开关控制。 + + - 容器编译宏定义: + + ``` + // 容器功能总编译宏 + LOSCFG_CONTAINER + // 各容器编译宏 + LOSCFG_UTS_CONTAINER + LOSCFG_MNT_CONTAINER + LOSCFG_PID_CONTAINER + LOSCFG_NET_CONTAINER + LOSCFG_USER_CONTAINER + LOSCFG_TIME_CONTAINER + LOSCFG_IPC_CONTAINER + ``` + + - 测试用例编译宏定义: enable打开,disable关闭,默认关闭。 + ``` + LOSCFG_USER_TEST_MNT_CONTAINER + LOSCFG_USER_TEST_PID_CONTAINER + LOSCFG_USER_TEST_NET_CONTAINER + LOSCFG_USER_TEST_USER_CONTAINER + LOSCFG_USER_TEST_TIME_CONTAINER + LOSCFG_USER_TEST_IPC_CONTAINER + ``` + +### 开发实例 + +当前LiteOS-A冒烟用例中已包含对应接口的使用示例,请开发者自行编译验证,推荐用例路径如下: + +[创建UTS容器](https://gitee.com/openharmony/kernel_liteos_a/blob/master/testsuites/unittest/container/smoke/It_uts_container_001.cpp) + +[Unshare 切换当前进程的UTS容器至一个新容器](https://gitee.com/openharmony/kernel_liteos_a/blob/master/testsuites/unittest/container/smoke/It_uts_container_004.cpp) + +[setns切换,将当前进程的UTS容器切换至子进程的UTS容器](https://gitee.com/openharmony/kernel_liteos_a/blob/master/testsuites/unittest/container/smoke/It_uts_container_005.cpp) + +[创建Network容器](https://gitee.com/openharmony/kernel_liteos_a/blob/master/testsuites/unittest/container/smoke/It_net_container_001.cpp) + +[创建User容器](https://gitee.com/openharmony/kernel_liteos_a/blob/master/testsuites/unittest/container/smoke/It_user_container_001.cpp) + +[创建PID容器](https://gitee.com/openharmony/kernel_liteos_a/blob/master/testsuites/unittest/container/smoke/It_pid_container_023.cpp) + +[创建Mount容器](https://gitee.com/openharmony/kernel_liteos_a/blob/master/testsuites/unittest/container/smoke/It_mnt_container_001.cpp) + +[创建IPC容器](https://gitee.com/openharmony/kernel_liteos_a/blob/master/testsuites/unittest/container/smoke/It_ipc_container_001.cpp) + +[创建TIME容器](https://gitee.com/openharmony/kernel_liteos_a/blob/master/testsuites/unittest/container/smoke/It_time_container_001.cpp) + diff --git a/zh-cn/device-dev/porting/Readme-CN.md b/zh-cn/device-dev/porting/Readme-CN.md index ce5b474e48144b84d7b14854c3920359c1141ea0..1eeb819b8b7688d8d2bfee1eceb446ca9ea73190 100644 --- a/zh-cn/device-dev/porting/Readme-CN.md +++ b/zh-cn/device-dev/porting/Readme-CN.md @@ -1,5 +1,5 @@ ## 概述 -目前OpenHarmony已经成立了SIG组[sig-devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard_cn.md)。该SIG组以支持更多第三方开发板为目标,提供开发板移植的支撑。 +目前OpenHarmony已经成立了SIG组[sig_devboard](https://gitee.com/openharmony/community/blob/master/sig/sig_devboard/sig_devboard_cn.md)。该SIG组以支持更多第三方开发板为目标,提供开发板移植的支撑。 在了解开发板移植前,需要先了解一下OpenHarmony对设备的分类。不同设备类型的移植方法会有较大差异。 diff --git a/zh-cn/device-dev/porting/porting-minichip-prepare.md b/zh-cn/device-dev/porting/porting-minichip-prepare.md index 17b0298bf7957d83985bfc25a44454eae00c63c6..d5c216be37f456906cf52f05efa74c88ec4920a8 100644 --- a/zh-cn/device-dev/porting/porting-minichip-prepare.md +++ b/zh-cn/device-dev/porting/porting-minichip-prepare.md @@ -6,7 +6,7 @@ ## 搭建编译环境 -开展移植前请参考[开发环境准备](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/quick-start/quickstart-lite-env-setup.md)完成环境搭建工作。 +开展移植前请参考[开发环境准备](../quick-start/quickstart-ide-env-win.md)完成环境搭建工作。 ## 获取源码 @@ -14,7 +14,7 @@ ### 获取操作 -请参考[获取源码](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/sourcecode-acquire.md)完成源码下载并进行编译。 +请参考[获取源码](../get-code/sourcecode-acquire.md)完成源码下载并进行编译。 > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > 本文档仅适用于OpenHarmony LTS 3.0.1及之前版本,所以请获取对应版本的源码。 diff --git a/zh-cn/device-dev/porting/porting-smallchip-driver-plat.md b/zh-cn/device-dev/porting/porting-smallchip-driver-plat.md index d30d6c469b472703847e4bda2a8e0bd7f10f9795..5ba5c7ed9d3ccf8b8482cee0319a6037546cfa25 100644 --- a/zh-cn/device-dev/porting/porting-smallchip-driver-plat.md +++ b/zh-cn/device-dev/porting/porting-smallchip-driver-plat.md @@ -1,7 +1,7 @@ # 平台驱动移植 -在这一步,我们会在源码目录//device/vendor_name/soc_name/drivers 目录下创建平台驱动,如果你要移植的SOC的厂商还没有创建仓库的话,请联系[sig-devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard_cn.md)创建。 +在这一步,我们会在源码目录//device/vendor_name/soc_name/drivers 目录下创建平台驱动,如果你要移植的SOC的厂商还没有创建仓库的话,请联系[sig_devboard](https://gitee.com/openharmony/community/blob/master/sig/sig_devboard/sig_devboard_cn.md)创建。 建议的目录结构: diff --git a/zh-cn/device-dev/subsystems/Readme-CN.md b/zh-cn/device-dev/subsystems/Readme-CN.md index 15c23f13f1d0ab86dbf5a241ed87471a456f5b10..26f02d5000a01fa6623e9a308e8e103b84b63059 100644 --- a/zh-cn/device-dev/subsystems/Readme-CN.md +++ b/zh-cn/device-dev/subsystems/Readme-CN.md @@ -18,6 +18,10 @@ - [加快本地编译的一些参数](subsys-build-reference.md) - [查看NinjaTrace](subsys-build-reference.md) - [HAP编译构建指导](subsys-build-gn-hap-compilation-guide.md) + - Rust编译构建指导 + - [Rust模块配置规则和指导](subsys-build-rust-compilation.md) + - [交互工具使用指导](subsys-build-bindgen-cxx-guide.md) + - [Cargo2gn工具操作指导](subsys-build-cargo2gn-guide.md) - [ 常见问题](subsys-build-FAQ.md) - [ArkCompiler](subsys-arkcompiler-guide.md) - [分布式远程启动](subsys-remote-start.md) @@ -38,22 +42,13 @@ - [音视频播放开发指导](subsys-multimedia-video-play-guide.md) - [音视频录制开发指导](subsys-multimedia-video-record-guide.md) - [公共基础库开发指导](subsys-utils-guide.md) -- [AI框架开发指导](subsys-ai-aiframework-devguide.md) -- 数据管理 - - 关系型数据库 - - [关系型数据库概述](subsys-data-relational-database-overview.md) - - [关系型数据库开发指导](subsys-data-relational-database-guide.md) - - 轻量级数据存储 - - [轻量级数据存储概述](subsys-data-storage-overview.md) - - [轻量级数据存储开发指导](subsys-data-storage-guide.md) +- AI服务 + - [AI框架开发指导](subsys-ai-aiframework-devguide.md) + - [NNRt开发指导](subsys-ai-nnrt-guide.md) - Sensor服务 - [Sensor服务概述](subsys-sensor-overview.md) - [Sensor服务使用指导](subsys-sensor-guide.md) - [Sensor服务使用实例](subsys-sensor-demo.md) -- USB服务 - - [USB服务概述](subsys-usbservice-overview.md) - - [USB服务使用指导](subsys-usbservice-guide.md) - - [USB服务使用实例](subsys-usbservice-demo.md) - 用户程序框架 - [概述](subsys-application-framework-overview.md) - [搭建环境](subsys-application-framework-envbuild.md) @@ -101,7 +96,6 @@ - [HiSysEvent订阅指导](subsys-dfx-hisysevent-listening.md) - [HiSysEvent查询指导](subsys-dfx-hisysevent-query.md) - [HiSysEvent工具使用指导](subsys-dfx-hisysevent-tool.md) - - [HiDumper开发指导](subsys-dfx-hidumper.md) - [HiChecker开发指导](subsys-dfx-hichecker.md) - [Faultlogger开发指导](subsys-dfx-faultlogger.md) - [Hiview开发指导](subsys-dfx-hiview.md) @@ -109,3 +103,26 @@ - [bytrace使用指导](subsys-toolchain-bytrace-guide.md) - [hdc使用指导](subsys-toolchain-hdc-guide.md) - [hiperf使用指导](subsys-toolchain-hiperf.md) + - [HiDumper使用指导](subsys-dfx-hidumper.md) +- 电源 + - 显示管理 + - [系统亮度范围定制开发指导](subsys-power-brightness-customization.md) + - 电池管理 + - [电量与LED灯颜色的定制开发指导](subsys-power-level-LED-color.md) + - [电池温度保护定制开发指导](subsys-power-temperature-protection.md) + - [电量等级定制开发指导](subsys-power-battery-level-customization.md) + - [充电限流限压定制开发指导](subsys-power-charge-current-voltage-limit.md) + - [充电类型定制开发指导](subsys-power-charge-type-customization.md) + - [关机充电动画开发指导](subsys-power-poweroff-charge-animation.md) + - 耗电统计 + - [耗电统计定制开发指导](subsys-power-stats-power-average-customization.md) + - 热管理 + - [充电空闲状态定制开发指导](subsys-thermal_charging_idle_state.md) + - [热管控定制开发指导](subsys-thermal_control.md) + - [热检测定制开发指导](subsys-thermal_detection.md) + - [热等级定制开发指导](subsys-thermal_level.md) + - [热日志定制开发指导](subsys-thermal_log.md) + - [热策略定制开发指导](subsys-thermal_policy.md) + - [热场景定制开发指导](subsys-thermal_scene.md) + - 电源管理 + - [电源模式定制开发指导](subsys-power-mode-customization.md) diff --git a/zh-cn/device-dev/subsystems/figures/animation_charging_power2.jpg b/zh-cn/device-dev/subsystems/figures/animation_charging_power2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..4ddfc92f26d3fede4a878e449a2364140085d745 Binary files /dev/null and b/zh-cn/device-dev/subsystems/figures/animation_charging_power2.jpg differ diff --git a/zh-cn/device-dev/subsystems/figures/animation_charing_power.jpg b/zh-cn/device-dev/subsystems/figures/animation_charing_power.jpg new file mode 100644 index 0000000000000000000000000000000000000000..6da51e0ee4e353007f2c78b0a6a47a79c2771907 Binary files /dev/null and b/zh-cn/device-dev/subsystems/figures/animation_charing_power.jpg differ diff --git a/zh-cn/device-dev/subsystems/figures/animation_initial_power.jpg b/zh-cn/device-dev/subsystems/figures/animation_initial_power.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c1417a4cc98fe5a413bba5facf5998ed48310f48 Binary files /dev/null and b/zh-cn/device-dev/subsystems/figures/animation_initial_power.jpg differ diff --git a/zh-cn/device-dev/subsystems/figures/animation_initial_power2.jpg b/zh-cn/device-dev/subsystems/figures/animation_initial_power2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..72e77043f06ac4298604b7798ca79597c2b30153 Binary files /dev/null and b/zh-cn/device-dev/subsystems/figures/animation_initial_power2.jpg differ diff --git a/zh-cn/device-dev/subsystems/figures/animation_low_power.jpg b/zh-cn/device-dev/subsystems/figures/animation_low_power.jpg new file mode 100644 index 0000000000000000000000000000000000000000..64d03fe47d45deab0e8a40c99142e9fa0c47b6f8 Binary files /dev/null and b/zh-cn/device-dev/subsystems/figures/animation_low_power.jpg differ diff --git a/zh-cn/device-dev/subsystems/figures/animation_low_power2.jpg b/zh-cn/device-dev/subsystems/figures/animation_low_power2.jpg new file mode 100644 index 0000000000000000000000000000000000000000..d3ff1ba4e6b715cce3a0a9263726b86ad8b18ddd Binary files /dev/null and b/zh-cn/device-dev/subsystems/figures/animation_low_power2.jpg differ diff --git a/zh-cn/device-dev/subsystems/figures/battery_limit_current_test_report.jpg b/zh-cn/device-dev/subsystems/figures/battery_limit_current_test_report.jpg new file mode 100644 index 0000000000000000000000000000000000000000..fa16e626dfa1aef0609d14a6cb073fe87a15a02c Binary files /dev/null and b/zh-cn/device-dev/subsystems/figures/battery_limit_current_test_report.jpg differ diff --git a/zh-cn/device-dev/subsystems/figures/bindgen_and_cxx_tools.png b/zh-cn/device-dev/subsystems/figures/bindgen_and_cxx_tools.png new file mode 100644 index 0000000000000000000000000000000000000000..637f6cfaaacb832f544a16c8be11c1b29642ac7d Binary files /dev/null and b/zh-cn/device-dev/subsystems/figures/bindgen_and_cxx_tools.png differ diff --git a/zh-cn/device-dev/subsystems/figures/bindgen_test.png b/zh-cn/device-dev/subsystems/figures/bindgen_test.png new file mode 100644 index 0000000000000000000000000000000000000000..4c4d01b567e35fd07ce7a8a90256281cd9fcc165 Binary files /dev/null and b/zh-cn/device-dev/subsystems/figures/bindgen_test.png differ diff --git a/zh-cn/device-dev/subsystems/figures/charger_type1.jpg b/zh-cn/device-dev/subsystems/figures/charger_type1.jpg new file mode 100644 index 0000000000000000000000000000000000000000..a9ef478f0f8f04b6e32787729bfbe5276dc121cf Binary files /dev/null and b/zh-cn/device-dev/subsystems/figures/charger_type1.jpg differ diff --git a/zh-cn/device-dev/subsystems/figures/cpp_call_rust.png b/zh-cn/device-dev/subsystems/figures/cpp_call_rust.png new file mode 100644 index 0000000000000000000000000000000000000000..49503982f893fb6c24d1e41c24ae54aa9681e2c6 Binary files /dev/null and b/zh-cn/device-dev/subsystems/figures/cpp_call_rust.png differ diff --git a/zh-cn/device-dev/subsystems/figures/dfx-overview.png b/zh-cn/device-dev/subsystems/figures/dfx-overview.png new file mode 100644 index 0000000000000000000000000000000000000000..42ee515131dbf60c56c5eb4abafbc0603e027f0e Binary files /dev/null and b/zh-cn/device-dev/subsystems/figures/dfx-overview.png differ diff --git a/zh-cn/device-dev/subsystems/figures/high_power_led.jpg b/zh-cn/device-dev/subsystems/figures/high_power_led.jpg new file mode 100644 index 0000000000000000000000000000000000000000..e9dbb9c347d0a0c05d286257a29ffbb940964e9b Binary files /dev/null and b/zh-cn/device-dev/subsystems/figures/high_power_led.jpg differ diff --git a/zh-cn/device-dev/subsystems/figures/high_power_led_alter.jpg b/zh-cn/device-dev/subsystems/figures/high_power_led_alter.jpg new file mode 100644 index 0000000000000000000000000000000000000000..6557a55c7dc7c502bd9c37011d9cab7e6005504d Binary files /dev/null and b/zh-cn/device-dev/subsystems/figures/high_power_led_alter.jpg differ diff --git a/zh-cn/device-dev/subsystems/figures/low_power_led.jpg b/zh-cn/device-dev/subsystems/figures/low_power_led.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ce9f005ef08061fb4475ced34983cb9a3df82cb0 Binary files /dev/null and b/zh-cn/device-dev/subsystems/figures/low_power_led.jpg differ diff --git a/zh-cn/device-dev/subsystems/figures/low_power_led_alter.jpg b/zh-cn/device-dev/subsystems/figures/low_power_led_alter.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7156f28712106629be96177ef654c4820cb9b189 Binary files /dev/null and b/zh-cn/device-dev/subsystems/figures/low_power_led_alter.jpg differ diff --git a/zh-cn/device-dev/subsystems/figures/nnrt_arch_diagram.png b/zh-cn/device-dev/subsystems/figures/nnrt_arch_diagram.png new file mode 100644 index 0000000000000000000000000000000000000000..d0a721c2156ddb3c0df79feec763a8dfe6680c5d Binary files /dev/null and b/zh-cn/device-dev/subsystems/figures/nnrt_arch_diagram.png differ diff --git a/zh-cn/device-dev/subsystems/figures/nnrt_dev_flow.png b/zh-cn/device-dev/subsystems/figures/nnrt_dev_flow.png new file mode 100644 index 0000000000000000000000000000000000000000..ca50b6ac1800e972a5a5f5dcb116771ac8730360 Binary files /dev/null and b/zh-cn/device-dev/subsystems/figures/nnrt_dev_flow.png differ diff --git a/zh-cn/device-dev/subsystems/figures/normal_power_led.jpg b/zh-cn/device-dev/subsystems/figures/normal_power_led.jpg new file mode 100644 index 0000000000000000000000000000000000000000..dacb5083b679885d1ab786291b081114b883c57b Binary files /dev/null and b/zh-cn/device-dev/subsystems/figures/normal_power_led.jpg differ diff --git a/zh-cn/device-dev/subsystems/figures/normal_power_led_alter.jpg b/zh-cn/device-dev/subsystems/figures/normal_power_led_alter.jpg new file mode 100644 index 0000000000000000000000000000000000000000..c0b974a1b70dd4f455de48775a9bf607e835c44c Binary files /dev/null and b/zh-cn/device-dev/subsystems/figures/normal_power_led_alter.jpg differ diff --git a/zh-cn/device-dev/subsystems/figures/rust_call_cpp.png b/zh-cn/device-dev/subsystems/figures/rust_call_cpp.png new file mode 100644 index 0000000000000000000000000000000000000000..eba899d0b111c71420b43c36c21e519228a06d54 Binary files /dev/null and b/zh-cn/device-dev/subsystems/figures/rust_call_cpp.png differ diff --git a/zh-cn/device-dev/subsystems/figures/test_rlib_cargo_crate.png b/zh-cn/device-dev/subsystems/figures/test_rlib_cargo_crate.png new file mode 100644 index 0000000000000000000000000000000000000000..86ade8272f625e6aa4336c713d52ee537918531c Binary files /dev/null and b/zh-cn/device-dev/subsystems/figures/test_rlib_cargo_crate.png differ diff --git a/zh-cn/device-dev/subsystems/figures/test_rlib_crate.png b/zh-cn/device-dev/subsystems/figures/test_rlib_crate.png new file mode 100644 index 0000000000000000000000000000000000000000..3df5877b7a3f583513527de1adcdabb80755961a Binary files /dev/null and b/zh-cn/device-dev/subsystems/figures/test_rlib_crate.png differ diff --git a/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001261812333.png b/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001261812333.png deleted file mode 100644 index 76fd15e43b8ccf8566ed55cc0592d3f3e6580319..0000000000000000000000000000000000000000 Binary files a/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001261812333.png and /dev/null differ diff --git a/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001261812334.png b/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001261812334.png new file mode 100644 index 0000000000000000000000000000000000000000..0a91177b3004ff030d3ff86b79e2193f52725f87 Binary files /dev/null and b/zh-cn/device-dev/subsystems/figures/zh-cn_image_0000001261812334.png differ diff --git a/zh-cn/device-dev/subsystems/subsys-ai-nnrt-guide.md b/zh-cn/device-dev/subsystems/subsys-ai-nnrt-guide.md new file mode 100644 index 0000000000000000000000000000000000000000..02d436659491564874cd32956c6afbc33466369b --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-ai-nnrt-guide.md @@ -0,0 +1,404 @@ +# NNRt设备开发指导 + +## 概述 + +### 功能简介 + +NNRt(Neural Network Runtime,神经网络运行时)是面向AI领域的跨芯片推理计算运行时,作为中间桥梁连通上层AI推理框架和底层加速芯片,实现AI模型的跨芯片推理计算。 + +NNRt开放了设备接口,芯片厂商通过设备接口将专有加速芯片接入NNRt,实现接入OpenHarmony的社区生态,以下将介绍芯片如何接入NNRt。 + +### 基本概念 +在开发前,开发者需要先了解以下概念,以便更好地理解全文内容: + +- HDI(Hardware Device Interface):OpenHarmony硬件设备接口,定义系统中跨进程通信的接口,实现服务间的跨进程通信。 +- IDL(Interface Description Language):接口描述语言,是HDI接口的语言格式。 + +### 约束与限制 +- 系统版本:OpenHarmony主干版本。 +- 开发环境:Ubuntu 18.04及以上。 +- 接入设备:具备AI计算能力的芯片。 + +### 运作机制 +NNRt通过HDI接口实现与设备芯片的对接,由HDI接口实现跨进程通信。 + +**图1** NNRt架构图 + +![架构图](./figures/nnrt_arch_diagram.png) + +整个架构主要分为三层,AI应用在应用层,AI推理框架和NNRt在系统层,设备服务在芯片层。AI应用如要使用专用加速芯片模型推理,需要经过AI推理框架和NNRt才能调用到底层专用加速芯片,而NNRt就是负责适配底层各种专用加速芯片,它开放了标准统一的设备接口,众多的第三方芯片设备都可以通过HDI接口接入OpenHarmony。 + +程序运行时,AI应用、AI推理框架、NNRt都在用户进程中,底层设备服务在服务进程中,NNRt根据HDI接口实现了HDI Client,服务端也需要根据HDI接口实现HDI Service,使得两个进程间能够跨进程通信。 + +## 开发指导 + +### 场景介绍 +当需要将一款AI加速芯片接入NNRt的时候,可以参考下文。下文以RK3568芯片为例,展示RK3568 CPU如何通过HDI接口接入NNRt,并完成AI模型推理。 +> 依赖说明:该教程展示的RK3568 CPU接入NNRt并没有实际去写CPU的驱动,而是借用了MindSpore Lite的CPU算子,故会依赖MindSpore Lite的动态库以及头文件,实际开发时并不需要依赖MindSpore Lite的任何库或者头文件。 + +### 开发流程 +专用加速芯片接入NNRt的整体流程如下: + +**图2** 专用加速芯片接入NNRt流程 + +![开发流程](./figures/nnrt_dev_flow.png) + +### 开发步骤 +开发者具体可通过以下步骤实现芯片对接NNRt: +#### 生成HDI头文件 +开源社区下载OpenHarmony的代码,编译drivers_interface部件,生成HDI接口的头文件。 + +1. [下载源码](../get-code/sourcecode-acquire.md)。 + +2. 编译接口IDL文件。 + ```shell + ./build.sh --product-name productname –ccache --build-target drivers_interface_nnrt + ``` + > productname为产品名称,此处为RK3568。 + + 编译完成后,在```out/rk3568/gen/drivers/interface/nnrt```目录下生成HDI头文件,默认语言类型为C++。若需要生成C类型的头文件,请在编译之前使用如下命令对```drivers/interface/nnrt/v1_0/BUILD.gn```文件中的```language```配置项进行设置。 + + ```shell + language = "c" + ``` + + 生成头文件目录如下所示: + ```text + out/rk3568/gen/drivers/interface/nnrt + └── v1_0 + ├── drivers_interface_nnrt__libnnrt_proxy_1.0_external_deps_temp.json + ├── drivers_interface_nnrt__libnnrt_stub_1.0_external_deps_temp.json + ├── innrt_device.h # 设备接口头文件 + ├── iprepared_model.h # 编译AI模型对象头文件 + ├── libnnrt_proxy_1.0__notice.d + ├── libnnrt_stub_1.0__notice.d + ├── model_types.cpp # AI模型结构定义实现文件 + ├── model_types.h # AI模型结构定义头文件 + ├── nnrt_device_driver.cpp # 设备驱动实现参考样例 + ├── nnrt_device_proxy.cpp + ├── nnrt_device_proxy.h + ├── nnrt_device_service.cpp # 设备服务端实现参考样例 + ├── nnrt_device_service.h # 设备服务端头文件 + ├── nnrt_device_stub.cpp + ├── nnrt_device_stub.h + ├── nnrt_types.cpp # 数据类型定义实现文件 + ├── nnrt_types.h # 数据类型定义头文件 + ├── node_attr_types.cpp # AI模型算子属性定义实现文件 + ├── node_attr_types.h # AI模型算子属性定义 + ├── prepared_model_proxy.cpp + ├── prepared_model_proxy.h + ├── prepared_model_service.cpp # 编译AI模型对象服务端实现参考样例 + ├── prepared_model_service.h # 编译AI模型对象服务端头文件 + ├── prepared_model_stub.cpp + └── prepared_model_stub.h + ``` + +#### 实现HDI服务 + +1. 在drivers/peripheral目录下新建开发目录,用于HDI服务开发,开发目录结构如下所示: + ```text + drivers/peripheral/nnrt + ├── BUILD.gn # 代码编译脚本文件 + ├── bundle.json + └── hdi_cpu_service # 自定义目录 + ├── BUILD.gn # 代码编译脚本文件 + ├── include + │   ├── nnrt_device_service.h # 设备服务端头文件 + │   ├── node_functions.h # 非必须,由具体实现决定 + │   ├── node_registry.h # 非必须,由具体实现决定 + │   └── prepared_model_service.h # 编译AI模型对象服务端头文件 + └── src + ├── nnrt_device_driver.cpp # 设备驱动实现文件 + ├── nnrt_device_service.cpp # 设备服务端实现文件 + ├── nnrt_device_stub.cpp # 非必须,由具体实现决定 + ├── node_attr_types.cpp # 非必须,由具体实现决定 + ├── node_functions.cpp # 非必须,由具体实现决定 + ├── node_registry.cpp # 非必须,由具体实现决定 + └── prepared_model_service.cpp # 编译AI模型对象服务端实现文件 + ``` + +2. 实现设备驱动,无特殊需求可直接使用步骤1中生成的nnrt_device_driver.cpp文件,否则根据具体驱动开发。 + +3. 实现服务接口,可参考nnrt_device_service.cpp和prepared_model_service.cpp实现文件,接口定义可以参考[NNRt的HDI接口定义](https://gitee.com/openharmony/drivers_interface/tree/master/nnrt)。 + +4. 编译驱动和服务的实现文件为共享库。 + + 在```drivers/peripheral/nnrt/hdi_cpu_service/```下新建```BUILD.gn```文件,文件内容如下所示,相关参数配置内容可参考[Build教程](https://gitee.com/openharmony/build)。 + + ```shell + import("//build/ohos.gni") + import("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") + + ohos_shared_library("libnnrt_service_1.0") { + include_dirs = [] + sources = [ + "src/nnrt_device_service.cpp", + "src/prepared_model_service.cpp", + "src/node_registry.cpp", + "src/node_functions.cpp", + "src/node_attr_types.cpp" + ] + public_deps = [ "//drivers/interface/nnrt/v1_0:nnrt_idl_headers" ] + external_deps = [ + "hdf_core:libhdf_utils", + "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_single", + "c_utils:utils", + ] + + install_images = [ chipset_base_dir ] + subsystem_name = "hdf" + part_name = "drivers_peripheral_nnrt" + } + + ohos_shared_library("libnnrt_driver") { + include_dirs = [] + sources = [ "src/nnr_device_driver.cpp" ] + deps = [ "//drivers/peripheral/nnrt/hdi_cpu_service:libnnrt_service_1.0" ] + + external_deps = [ + "hdf_core:libhdf_host", + "hdf_core:libhdf_ipc_adapter", + "hdf_core:libhdf_utils", + "hiviewdfx_hilog_native:libhilog", + "ipc:ipc_single", + "c_utils:utils", + ] + + install_images = [ chipset_base_dir ] + subsystem_name = "hdf" + part_name = "drivers_peripheral_nnrt" + } + + group("hdf_nnrt_service") { + deps = [ + ":libnnrt_driver", + ":libnnrt_service_1.0", + ] + } + ``` + + 将```group("hdf_nnrt_service")```添加到```drivers/peripheral/nnrt/BUILD.gn```文件中,以便在更上目录层级就能引用。 + ```shell + if (defined(ohos_lite)) { + group("nnrt_entry") { + deps = [ ] + } + } else { + group("nnrt_entry") { + deps = [ + "./hdi_cpu_service:hdf_nnrt_service", + ] + } + } + ``` + + 新建```drivers/peripheral/nnrt/bundle.json```用于定义新增的```drivers_peripheral_nnrt```部件。 + ```json + { + "name": "drivers_peripheral_nnrt", + "description": "Neural network runtime device driver", + "version": "3.2", + "license": "Apache License 2.0", + "component": { + "name": "drivers_peripheral_nnrt", + "subsystem": "hdf", + "syscap": [""], + "adapter_system_type": ["standard"], + "rom": "1024KB", + "ram": "2048KB", + "deps": { + "components": [ + "ipc", + "hdf_core", + "hiviewdfx_hilog_native", + "c_utils" + ], + "third_part": [ + "bounds_checking_function" + ] + }, + "build": { + "sub_component": [ + "//drivers/peripheral/nnrt:nnrt_entry" + ], + "test": [ + ], + "inner_kits": [ + ] + } + } + } + ``` + +#### 声明HDI服务 + + 在对应产品的uhdf hcs配置文件中声明用户态驱动与服务,例如针对RK3568服务需要在```vendor/hihope/rk3568/hdf_config/uhdf/device_info.hcs```文件中新增如下配置: + ```text + nnrt :: host { + hostName = "nnrt_host"; + priority = 50; + uid = ""; + gid = ""; + caps = ["DAC_OVERRIDE", "DAC_READ_SEARCH"]; + nnrt_device :: device { + device0 :: deviceNode { + policy = 2; + priority = 100; + moduleName = "libnnrt_driver.z.so"; + serviceName = "nnrt_device_service"; + } + } + } + ``` +> 注意:修改hcs文件需要删除out目录重新编译,才能生效。 + +#### 配置host进程用户ID和组ID + 对于新增的nnrt_host进程的场景,需要配置对应进程的用户ID和组ID。 进程的用户ID在文件```base/startup/init/services/etc/passwd```中配置,进程的组ID在文件```base/startup/init/services/etc/group```中配置。 + ```text + # 在base/startup/init/services/etc/passwd新增 + nnrt_host:x:3311:3311:::/bin/false + + # 在base/startup/init/services/etc/group新增 + nnrt_host:x:3311: + ``` + +#### 配置SELinux + +OpenHarmony已经开启SELinux特性,需要对新增的进程和服务配置相应的SELinux规则,用于运行host进程启动访问某些资源、发布HDI服务。 + +1. 在```base/security/selinux/sepolicy/ohos_policy/drivers/adapter/vendor/type.te```文件中配置nnrt_host进程安全上下文,新增配置如下: + ```text + # 新增配置 + type nnrt_host, hdfdomain, domain; + ``` + > nnrt_host为上文配置的进程名称。 + +2. 由于SeLinux是白名单访问的权限机制,需要根据实际权限需求配置。将服务启动之后,可通过以下dmesg命令查看avc告警, +avc告警会给出缺少的权限。SeLinux的配置也可以参考[OpenHarmony SeLinux子系统的说明](https://gitee.com/openharmony/security_selinux/blob/master/README.md)。 + ```shell + hdc_std shell + dmesg | grep nnrt + ``` + +3. 新建nnrt_host.te配置文件,将权限配置到nnrt_host.te文件中。 + ```shell + # 创建nnrt文件夹 + mkdir base/security/selinux/sepolicy/ohos_policy/drivers/peripheral/nnrt + + # 创建vendor文件夹 + mkdir base/security/selinux/sepolicy/ohos_policy/drivers/peripheral/nnrt/vendor + + # 创建nnrt_host.te文件 + touch base/security/selinux/sepolicy/ohos_policy/drivers/peripheral/nnrt/vendor/nnrt_host.te + ``` + +4. 将所需的权限写入nnrt_host.te文件中,比如: + ```text + allow nnrt_host dev_hdf_kevent:chr_file { ioctl }; + allow nnrt_host hilog_param:file { read }; + allow nnrt_host sh:binder { transfer }; + allow nnrt_host dev_ashmem_file:chr_file { open }; + allow sh nnrt_host:fd { use }; + ``` + +#### 配置部件编译入口 +以RK3568产品为例: +```shell +vim //productdefine/common/inherit/chipset_common.json +``` +在"subsystems", "subsystem":"hdf", "components"中添加: +```shell +{ + "component": "drivers_peripheral_foo", + "features": [] +} +``` + +#### 删除out目录并编译整个系统 +```shell +# 删除out目录 +rm -rf ./out + +# 编译 +./build.sh --product-name rk3568 –ccache --jobs=4 +``` + + +### 调测验证 +服务开发完成后,可以使用XTS用例验证基本功能和兼容性,开发者可通过以下步骤进行验证: + +1. 编译NNRt的hats用例,用例在```test/xts/hats/hdf/nnrt```目录下。 + ```shell + # 进入hats目录 + cd test/xts/hats + + # 编译hats测试用例 + ./build.sh suite=hats system_size=standard --product-name rk3568 + + # 回到代码根目录 + cd - + ``` + 编译好的测试用例会输出到相对代码根目录的```out/rk3568/suites/hats/testcases/HatsHdfNnrtFunctionTest```路径下。 + +2. 将测试用例push到设备上。 + ```shell + # 将测试用例可执行文件推送到设备上,HatsHdfNnrtFunctionTest是测试用例可执行文件。 + hdc_std file send out/rk3568/suites/hats/testcases/HartsHdfNnrtFunctionTest /data/local/tmp/ + + # 给测试用例可执行文件加上权限。 + hdc_std shell "chmod +x /data/local/tmp/HatsHdfNnrtFunctionTest" + ``` + +3. 执行用例并查看结果。 + ```shell + # 执行测试用例 + hdc_std shell "/data/local/tmp/HatsHdfNnrtFunctionTest" + ``` + + 所有hats用例执行成功,可以看到测试报告显示已通过47个用例,说明服务通过了兼容性测试。 + ```text + ... + [----------] Global test environment tear-down + Gtest xml output finished + [==========] 47 tests from 3 test suites ran. (515 ms total) + [ PASSED ] 47 tests. + ``` + +### 开发实例 +完整Demo代码可以参考[社区实现](https://gitee.com/openharmony/ai_neural_network_runtime/tree/master/example/drivers)。 + +1. 拷贝```example/driver/nnrt```目录到```drivers/peripheral```路径下。 + ```shell + cp -r example/driver/nnrt drivers/peripheral + ``` + +2. 补充bundle.json文件到```drivers/peripheral/nnrt```,bundle.json参考本教程上面的[开发步骤](#开发步骤)章节。 + +3. 由于Demo依赖MindSpore Lite CPU算子,故需要添加MindSpore Lite依赖文件。 + - 下载MindSpore Lite的头文件,[MindSpore Lite 1.5.0](https://ms-release.obs.cn-north-4.myhuaweicloud.com/1.5.0/MindSpore/lite/release/linux/mindspore-lite-1.5.0-linux-x64.tar.gz)。 + - 在```drivers/peripheral/nnrt```目录下新建mindspore目录,用于存放mindspore依赖库和头文件。 + ```shell + mkdir drivers/peripheral/nnrt/mindspore + ``` + - 解压mindspore-lite-1.5.0-linux-x64.tar.gz文件,将```runtime/include```目录拷贝到```drivers/peripheral/nnrt/mindspore```目录下。 + - Demo还依赖mindspore的schema文件。 + ```shell + # 创建mindspore_schema目录 + mkdir drivers/peripheral/nnrt/hdi_cpu_service/include/mindspore_schema + + # 拷贝mindspore schema文件 + cp third_party/mindspore/mindspore/lite/schema/* drivers/peripheral/nnrt/hdi_cpu_service/include/mindspore_schema/ + ``` + - 编译MindSpore Lite的动态库,并将动态库放到mindspore目录下。 + ```shell + # 编译mindspore动态库 + ./build.sh --product-name rk3568 -ccaache --jobs 4 --build-target mindspore_lib + + # 将mindspore动态库 + mkdir drivers/peripheral/nnrt/mindspore/mindspore + + # 将mindspore动态拷贝到drivers/peripheral/nnrt/mindspore/mindspore。 + cp out/rk3568/package/phone/system/lib/libmindspore-lite.huawei.so drivers/peripheral/nnrt/mindspore/mindspore/ + ``` +4. 其他配置请参考本教程上面的[开发步骤](#开发步骤)章节。 \ No newline at end of file diff --git a/zh-cn/device-dev/subsystems/subsys-app-privilege-config-guide.md b/zh-cn/device-dev/subsystems/subsys-app-privilege-config-guide.md index c1bd5906e9b3b09a0bb798d9ff7e3f0153160f86..d419e97908206ae61b47aaacbe0ecae625f56db9 100755 --- a/zh-cn/device-dev/subsystems/subsys-app-privilege-config-guide.md +++ b/zh-cn/device-dev/subsystems/subsys-app-privilege-config-guide.md @@ -63,6 +63,7 @@ OpenHarmony提供通用的应用特权和可由设备厂商针对不同设备单 | allowAbilityExcludeFromMissions | bool | false| 是否允许Ability不在任务栈中显示。 | | allowAppUsePrivilegeExtension | bool | false|是否允许应用使用ServiceExtension、DataExtension。 | | allowFormVisibleNotify | bool | false| 是否允许桌面卡片可见。 | +| allowAppShareLibrary | bool | false | 是否允许为其它应用提供[应用间`HSP`](../../application-dev/quick-start/cross-app-hsp.md)能力。 ### 配置方式 @@ -90,6 +91,7 @@ OpenHarmony提供通用的应用特权和可由设备厂商针对不同设备单 "allowAbilityExcludeFromMissions": true, // 允许Ability不在任务栈中显示 "allowAppUsePrivilegeExtension": true, // 允许应用使用ServiceExtension、DataExtension "allowFormVisibleNotify": true // 允许桌面卡片可见 + "allowAppShareLibrary": true // 允许应用提供应用间HSP能力 }, } ``` diff --git a/zh-cn/device-dev/subsystems/subsys-build-all.md b/zh-cn/device-dev/subsystems/subsys-build-all.md index 442f7ba0091615cad7e19198a088c192721418c4..b6bddb7fb95fef31be91e2c937ec6692e78eb1bc 100644 --- a/zh-cn/device-dev/subsystems/subsys-build-all.md +++ b/zh-cn/device-dev/subsystems/subsys-build-all.md @@ -353,4 +353,4 @@ optional arguments: - [开源软件Notice收集策略说明](subsys-build-reference.md#开源软件notice收集策略说明) - [加快本地编译的一些参数](subsys-build-reference.md#加快本地编译的一些参数) - [查看NinjaTrace](subsys-build-reference.md#查看ninjatrace) - +- [定制打包chip_prod镜像使用说明](subsys-build-reference.md#定制打包chip_prod镜像使用说明) diff --git a/zh-cn/device-dev/subsystems/subsys-build-bindgen-cxx-guide.md b/zh-cn/device-dev/subsystems/subsys-build-bindgen-cxx-guide.md new file mode 100644 index 0000000000000000000000000000000000000000..21d8a83a6cf10af2162b5dcb637fcdf4eeb9486c --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-build-bindgen-cxx-guide.md @@ -0,0 +1,421 @@ +# 交互工具使用指导 + +## 概述 + +Bindgen和CXX工具的主要功能是实现Rust和C/C++之间的交互。其中,Bindgen通过将C接口转换为Rust接口来实现Rust对C的调用,CXX可以通过建立C接口和Rust接口的映射关系来实现C++和Rust的相互调用。 + +![bindgen_and_cxx_tools](./figures/bindgen_and_cxx_tools.png) + +## Bindgen工具使用指导 + +### 操作步骤 +下面是一个使用bindgen实现Rust调用C的示例。 + +1. 在C代码侧,使用头文件lib.h定义两个接口,接口FuncAAddB用来实现两数求和,接口SayHello用来打印字符串。 + + ```c + #ifndef BUILD_RUST_TESTS_BINDGEN_TEST_LIB_H_ + #define BUILD_RUST_TESTS_BINDGEN_TEST_LIB_H_ + #include + #include "build/rust/tests/test_bindgen_test/test_for_hello_world/lib2.h" + + uint32_t FuncAAddB(uint32_t a, uint32_t b); + void SayHello(const char *message); + + #endif // BUILD_RUST_TESTS_BINDGEN_TEST_LIB_H_ + ``` + + +2. 在lib.c中添加对两个接口的对应实现。 + + ```c + #include "build/rust/tests/test_bindgen_test/test_for_hello_world/lib.h" + #include + #include + + void SayHello(const char *message) + { + printf("This is a test for bindgen hello world:\n"); + printf("%s\n", message); + } + + uint32_t FuncAAddB(uint32_t a, uint32_t b) + { + printf("This is a test for bindgen of a + b:\n"); + return a + b; + } + ``` + +3. 添加文件main.rs,就可以在Rust侧通过c_ffi实现对C侧的接口调用。注意Rust侧调用的不安全接口需要使用unsafe封装。 + + ```rust + //! bindgen test for hello world + #![allow(clippy::approx_constant)] + mod c_ffi { + #![allow(dead_code)] + #![allow(non_upper_case_globals)] + #![allow(non_camel_case_types)] + include!(env!("BINDGEN_RS_FILE")); + } + /// pub fn add_two_numbers_in_c + pub fn add_two_numbers_in_c(a: u32, b: u32) -> u32 { + unsafe { c_ffi::FuncAAddB(a, b) } + } + + use std::ffi::c_char; + use std::ffi::CString; + + /// fn main() + fn main() { + println!("{} + {} = {}", 3, 7, add_two_numbers_in_c(3, 7)); + let c_str = CString::new("This is a message from C").unwrap(); + let c_world: *const c_char = c_str.as_ptr() as *const c_char; + unsafe { + c_ffi::SayHello(c_world); + } + } + + ``` + +4. 添加构建文件BUILD.gn,建立Rust模块对C模块的依赖。 + + ```GN + import("//build/ohos.gni") + + ohos_shared_library("c_lib") { + sources = [ "lib.c" ] + defines = [ "COMPONENT_IMPLEMENTATION" ] + } + + rust_bindgen("c_lib_bindgen") { + header = "lib.h" + } + + ohos_rust_executable("bindgen_test") { + deps = [ ":c_lib" ] + deps += [ ":c_lib_bindgen" ] + sources = [ "main.rs" ] + bindgen_output = get_target_outputs(":c_lib_bindgen") + inputs = bindgen_output + rustenv = [ "BINDGEN_RS_FILE=" + rebase_path(bindgen_output[0]) ] + crate_root = "main.rs" + } + ``` + +**调测验证** + +![bindgen_test](./figures/bindgen_test.png) + + +## CXX工具使用指导 + +### C++调用Rust接口 + +1. 在Rust侧文件lib.rs里mod ffi写清楚需要调用的C++接口,并将接口包含在extern "Rust"里面,暴露给C++侧使用。 + + ```rust + //! #[cxx::bridge] + #[cxx::bridge] + mod ffi{ + #![allow(dead_code)] + #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] + struct Shared { + z: usize, + } + extern "Rust"{ + fn print_message_in_rust(); + fn r_return_primitive() -> usize; + fn r_return_shared() -> Shared; + fn r_return_rust_string() -> String; + fn r_return_sum(_: usize, _: usize) -> usize; + } + } + + fn print_message_in_rust(){ + println!("Here is a test for cpp call Rust."); + } + fn r_return_shared() -> ffi::Shared { + println!("Here is a message from Rust,test for ffi::Shared:"); + ffi::Shared { z: 1996 } + } + fn r_return_primitive() -> usize { + println!("Here is a message from Rust,test for usize:"); + 1997 + } + fn r_return_rust_string() -> String { + println!("Here is a message from Rust,test for String"); + "Hello World!".to_owned() + } + fn r_return_sum(n1: usize, n2: usize) -> usize { + println!("Here is a message from Rust,test for {} + {} is:",n1 ,n2); + n1 + n2 + } + + ``` + +2. C++侧将cxx工具转换出来的lib.rs.h包含进来,就可以使用C++侧的接口。 + + ```c++ + #include + #include "build/rust/tests/test_cxx/src/lib.rs.h" + + int main(int argc, const char* argv[]) + { + int a = 2021; + int b = 4; + print_message_in_rust(); + std::cout << r_return_primitive() << std::endl; + std::cout << r_return_shared().z << std::endl; + std::cout << std::string(r_return_rust_string()) << std::endl; + std::cout << r_return_sum(a, b) << std::endl; + return 0; + } + ``` + +3. 添加构建文件BUILD.gn。rust_cxx底层调用CXX工具将lib.rs文件转换成lib.rs.h和lib.rs.cc文件,ohos_rust_static_ffi实现Rust侧源码的编译,ohos_executable实现C++侧代码的编译。 + + ``` + import("//build/ohos.gni") + import("//build/templates/rust/rust_cxx.gni") + + rust_cxx("test_cxx_exe_gen") { + sources = [ "src/lib.rs" ] + } + + ohos_rust_static_ffi("test_cxx_examp_rust") { + sources = [ "src/lib.rs" ] + deps = [ "//build/rust:cxx_rustdeps" ] + } + + ohos_executable("test_cxx_exe") { + sources = [ "main.cpp" ] + sources += get_target_outputs(":test_cxx_exe_gen") + + include_dirs = [ "${target_gen_dir}" ] + deps = [ + ":test_cxx_examp_rust", + ":test_cxx_exe_gen", + "//build/rust:cxx_cppdeps", + ] + } + ``` + +**调测验证** +![cpp_call_rust](./figures/cpp_call_rust.png) + + +### Rust调用C++ + +1. 添加头文件client_blobstore.h。 + + ```c++ + #ifndef BUILD_RUST_TESTS_CLIENT_BLOBSTORE_H + #define BUILD_RUST_TESTS_CLIENT_BLOBSTORE_H + #include + #include "third_party/rust/cxx/include/cxx.h" + + namespace nsp_org { + namespace nsp_blobstore { + struct MultiBufs; + struct Metadata_Blob; + + class client_blobstore { + public: + client_blobstore(); + uint64_t put_buf(MultiBufs &buf) const; + void add_tag(uint64_t blobid, rust::Str add_tag) const; + Metadata_Blob get_metadata(uint64_t blobid) const; + + private: + class impl; + std::shared_ptr impl; + }; + + std::unique_ptr blobstore_client_new(); + } // namespace nsp_blobstore + } // namespace nsp_org + #endif + ``` + +2. 添加cpp文件client_blobstore.cpp。 + + ```c++ + #include + #include + #include + #include + #include + #include "src/main.rs.h" + #include "build/rust/tests/test_cxx_rust/include/client_blobstore.h" + + namespace nsp_org { + namespace nsp_blobstore { + // Toy implementation of an in-memory nsp_blobstore. + // + // In reality the implementation of client_blobstore could be a large complex C++ + // library. + class client_blobstore::impl { + friend client_blobstore; + using Blob = struct { + std::string data; + std::set tags; + }; + std::unordered_map blobs; + }; + + client_blobstore::client_blobstore() : impl(new class client_blobstore::impl) {} + + // Upload a new blob and return a blobid that serves as a handle to the blob. + uint64_t client_blobstore::put_buf(MultiBufs &buf) const + { + std::string contents; + + // Traverse the caller's res_chunk iterator. + // + // In reality there might be sophisticated batching of chunks and/or parallel + // upload implemented by the nsp_blobstore's C++ client. + while (true) { + auto res_chunk = next_chunk(buf); + if (res_chunk.size() == 0) { + break; + } + contents.append(reinterpret_cast(res_chunk.data()), res_chunk.size()); + } + + // Insert into map and provide caller the handle. + auto res = std::hash {} (contents); + impl->blobs[res] = {std::move(contents), {}}; + return res; + } + + // Add add_tag to an existing blob. + void client_blobstore::add_tag(uint64_t blobid, rust::Str add_tag) const + { + impl->blobs[blobid].tags.emplace(add_tag); + } + + // Retrieve get_metadata about a blob. + Metadata_Blob client_blobstore::get_metadata(uint64_t blobid) const + { + Metadata_Blob get_metadata {}; + auto blob = impl->blobs.find(blobid); + if (blob != impl->blobs.end()) { + get_metadata.size = blob->second.data.size(); + std::for_each(blob->second.tags.cbegin(), blob->second.tags.cend(), + [&](auto &t) { get_metadata.tags.emplace_back(t); }); + } + return get_metadata; + } + + std::unique_ptr blobstore_client_new() + { + return std::make_unique(); + } + } // namespace nsp_blobstore + } // namespace nsp_org + + ``` + +3. main.rs文件,在main.rs文件的ffi里面,通过宏include!将头文件client_blobstore.h引入进来,从而在Rust的main函数里面就可以通过ffi的方式调用C++的接口。 + + ```rust + //! test_cxx_rust + #[cxx::bridge(namespace = "nsp_org::nsp_blobstore")] + mod ffi { + // Shared structs with fields visible to both languages. + struct Metadata_Blob { + size: usize, + tags: Vec, + } + + // Rust types and signatures exposed to C++. + extern "Rust" { + type MultiBufs; + + fn next_chunk(buf: &mut MultiBufs) -> &[u8]; + } + + // C++ types and signatures exposed to Rust. + unsafe extern "C++" { + include!("build/rust/tests/test_cxx_rust/include/client_blobstore.h"); + + type client_blobstore; + + fn blobstore_client_new() -> UniquePtr; + fn put_buf(&self, parts: &mut MultiBufs) -> u64; + fn add_tag(&self, blobid: u64, add_tag: &str); + fn get_metadata(&self, blobid: u64) -> Metadata_Blob; + } + } + + // An iterator over contiguous chunks of a discontiguous file object. + // + // Toy implementation uses a Vec> but in reality this might be iterating + // over some more complex Rust data structure like a rope, or maybe loading + // chunks lazily from somewhere. + /// pub struct MultiBufs + pub struct MultiBufs { + chunks: Vec>, + pos: usize, + } + /// pub fn next_chunk + pub fn next_chunk(buf: &mut MultiBufs) -> &[u8] { + let next = buf.chunks.get(buf.pos); + buf.pos += 1; + next.map_or(&[], Vec::as_slice) + } + + /// fn main() + fn main() { + let client = ffi::blobstore_client_new(); + + // Upload a blob. + let chunks = vec![b"fearless".to_vec(), b"concurrency".to_vec()]; + let mut buf = MultiBufs { chunks, pos: 0 }; + let blobid = client.put_buf(&mut buf); + println!("This is a test for Rust call cpp:"); + println!("blobid = {}", blobid); + + // Add a add_tag. + client.add_tag(blobid, "rust"); + + // Read back the tags. + let get_metadata = client.get_metadata(blobid); + println!("tags = {:?}", get_metadata.tags); + } + ``` + +4. 添加构建文件BUILD.gn。使用CXX将main.rs转换成lib.rs.h和lib.rs.cc,同时将产物作为test_cxx_rust_staticlib的源码,编译Rust源码main.rs并将test_cxx_rust_staticlib依赖进来。 + + ``` + import("//build/ohos.gni") + + rust_cxx("test_cxx_rust_gen") { + sources = [ "src/main.rs" ] + } + + ohos_static_library("test_cxx_rust_staticlib") { + sources = [ "src/client_blobstore.cpp" ] + sources += get_target_outputs(":test_cxx_rust_gen") + include_dirs = [ + "${target_gen_dir}", + "//third_party/rust/cxx/v1/crate/include", + "include", + ] + deps = [ + ":test_cxx_rust_gen", + "//build/rust:cxx_cppdeps", + ] + } + + ohos_rust_executable("test_cxx_rust") { + sources = [ "src/main.rs" ] + deps = [ + ":test_cxx_rust_staticlib", + "//build/rust:cxx_rustdeps", + ] + } + ``` + +**调测验证** +![rust_call_cpp](./figures/rust_call_cpp.png) \ No newline at end of file diff --git a/zh-cn/device-dev/subsystems/subsys-build-cargo2gn-guide.md b/zh-cn/device-dev/subsystems/subsys-build-cargo2gn-guide.md new file mode 100644 index 0000000000000000000000000000000000000000..1bd28164b41007f94187a2ab7459bfd79aeec40b --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-build-cargo2gn-guide.md @@ -0,0 +1,94 @@ +# Cargo2gn工具操作指导 +## 概述 + +rust三方库使用cargo编译,配置为Cargo.toml。集成到OpenHarmony上需要转换成BUILD.gn规则。为了满足这个需求,需要提供一个cargo2gn转换工具。当需要引入rust三方crate时使用cargo2gn转换工具来把三方库的Cargo.toml转换成BUILD.gn规则。cargo2gn可以单个库进行转换,也可以多个库进行批量转换。 + +## 单个库转换操作步骤 +1. 进入到需要转化的rust三方库的目录下,比如需要转化bindgen。 + + ``` + cd openharmony/third_party/rust/bindgen + ``` + +2. 创建配置文件cargo2gn.json,可以参考如下配置。 + + ``` + { + "copy-out": true, + "run": true, + "add-workspace": true, + "cargo-bin": "/mnt/xxx/openharmony/prebuilts/rustc/linux-x86_64/current/bin" + } + ``` + +3. 执行以下命令进行转换。 + + ``` + python /mnt/xxx/openharmony/build/scripts/cargo2gn.py --config cargo2gn.json + ``` + + 转换结果 + + ``` + import("//build/templates/rust/ohos_cargo_crate.gni") + + ohos_cargo_crate("lib") { + crate_name = "bindgen" + crate_type = "rlib" + crate_root = "./lib.rs" + + sources = ["./lib.rs"] + edition = "2018" + cargo_pkg_version = "0.64.0" + cargo_pkg_authors = "Jyun-Yan You , Emilio Cobos Álvarez , Nick Fitzgerald , The Servo project developers" + cargo_pkg_name = "bindgen" + cargo_pkg_description = "Automatically generates Rust FFI bindings to C and C++ libraries." + deps = [ + "//third_party/rust/bitflags:lib", + "//third_party/rust/cexpr:lib", + "//third_party/rust/clang-sys:lib", + "//third_party/rust/lazy_static:lib", + "//third_party/rust/lazycell:lib", + "//third_party/rust/log:lib", + "//third_party/rust/peeking_take_while:lib", + "//third_party/rust/proc-macro2:lib", + "//third_party/rust/quote:lib", + "//third_party/rust/regex:lib", + "//third_party/rust/rustc-hash:lib", + "//third_party/rust/shlex:lib", + "//third_party/rust/syn:lib", + "//third_party/rust/which:lib", + ] + features = [ + "default", + "log", + "logging", + "static", + "which", + "which-rustfmt", + ] + build_root = "build.rs" + build_sources = ["build.rs"] + build_script_outputs = ["host-target.txt"] + } + ``` + + + +## 多个库批量转换操作步骤 +1. 进入到rust目录下。 + + ``` + cd openharmony/third_party/rust + ``` +2. 把所有需要转换的rust三方库添加到rust目录下的Cargo.toml的[workspace]里,如下所示。 + + ``` + [workspace] + members = [ + "aho-corasick", + "memchr", + ] + ``` +3. 执行单个库转换操作步骤的2和3。 + diff --git a/zh-cn/device-dev/subsystems/subsys-build-component-building-rules.md b/zh-cn/device-dev/subsystems/subsys-build-component-building-rules.md index 7b4c0ea74e43d12e29c0eefe31bd87274e6ac047..e7333059216749fcd6cac36e31d4e7e3da3b8448 100644 --- a/zh-cn/device-dev/subsystems/subsys-build-component-building-rules.md +++ b/zh-cn/device-dev/subsystems/subsys-build-component-building-rules.md @@ -105,7 +105,7 @@ bundle.json是定义部件的描述文件,包含了部件的根目录、名称 | 字段 | 类型 | 看护手段 | |---|---|---| -|name|string。部件的HPM(鸿蒙包管理器)包名称,必填。命名规则:@{organization}/{component_name}。"component_name"为部件的名称,须满足规则1.1。|静态检查| +|name|string。部件的HPM(OpenHarmony包管理器)包名称,必填。命名规则:@{organization}/{component_name}。"component_name"为部件的名称,须满足规则1.1。|静态检查| |version|string。部件版本号,必填,命名和升级跟随OpenHarmony版本号。|静态检查| |destPath|string。部件源码的根目录,必填。部件的根目录须独立唯一,不允许存在多个根目录。|静态检查| |component:name|string。部件名,必填。须满足规则1.1。|静态检查| diff --git a/zh-cn/device-dev/subsystems/subsys-build-module.md b/zh-cn/device-dev/subsystems/subsys-build-module.md index 80a692a54f836cff2b0bbaaec9969a7e9bad06b9..b5e2555d32cea8a34f7dbf4e691aab6d79d85a2a 100644 --- a/zh-cn/device-dev/subsystems/subsys-build-module.md +++ b/zh-cn/device-dev/subsystems/subsys-build-module.md @@ -23,6 +23,17 @@ ohos_app_scope ohos_js_assets ohos_resources +#rust模板 +ohos_rust_executable +ohos_rust_shared_library +ohos_rust_static_library +ohos_rust_proc_macro +ohos_rust_shared_ffi +ohos_rust_static_ffi +ohos_rust_cargo_crate +ohos_rust_systemtest +ohos_rust_unittest + #其他常用模板 #配置文件 ohos_prebuilt_etc @@ -315,9 +326,11 @@ ohos_prebuilt_static_library("helloworld") { ### Hap模板 -hap模板详见:[ HAP编译构建指导](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/subsystems/subsys-build-gn-hap-compilation-guide.md) +hap模板详见:[ HAP编译构建指导](subsys-build-gn-hap-compilation-guide.md) +### Rust模板 +rust模板详见:[ Rust模块配置规则和指导](subsys-build-rust-compilation.md) ### 其他常用模板 diff --git a/zh-cn/device-dev/subsystems/subsys-build-reference.md b/zh-cn/device-dev/subsystems/subsys-build-reference.md index bd1fee97a1b26f4cbd837ce200ef00302bd87a66..528439c06450441ab481ebb66e85b6ef4e0685f0 100644 --- a/zh-cn/device-dev/subsystems/subsys-build-reference.md +++ b/zh-cn/device-dev/subsystems/subsys-build-reference.md @@ -192,3 +192,61 @@ out/rk3568/.ninja_log文件记录了每个模块编译的开始和结束时间(m 1. 点击静态检查下的“成功”; 2. 点击输出列的“输出”即可在左侧的build_trace列看到build.trace.html文件,单击该文件即可打开。 + +## 定制打包chip_prod镜像使用说明 + +### 背景 + +针对同一个芯片解决方案下的子产品的定制能力,将差异能力放到 chip_prod 分区,因此需要支持对不同子产品生成对应的 chip_prod.img。 + +### 使用步骤 +1. 产品解决方案配置:
+ 产品解决方案配置文件config.json中添加`"chipprod_config_path"`配置选项,即`"chipprod_config_path":"子产品定义文件所在的路径"`。 + 其中子产品定义文件的文件名为`chip_product_list.gni`,文件格式为:`chip_product_list = ["productA", "productB", ...]` 。
+ 示例:
+ 以MyProduct产品定制chipprod镜像为例,//vendor/产品厂商/MyProduct/config.json配置如下: + ```shell + { + "product_name": "MyProduct", # 产品名称 + "version": "3.0", # config.json的版本号, 固定"3.0" + "chipprod_config_path": "", # 存放chipprod配置文件路径,可选项 + "subsystems": [ + { + "subsystem": "arkui", # 选择的子系统 + "components": [ + { + "component": "ace_engine", + "features":[ "ace_engine_feature_enable_web = true", + "ace_engine_feature_enable_accessibility = true" ] } + ] + }, + { + ...... + } + ...... + 更多子系统和部件 + } + } + ``` + +2. 模块编译配置:
+ 某个配置文件在不同的子产品中有差异,比如要打包到productA对应的chip_prod.img中,则模块编译需要配置`install_images`和`module_install_dir`。
+ 以`ohos_prebuilt_executable`示例: + ```shell + ohos_prebuilt_executable("moduleXXX"){ + install_images = [ "chip_prod" ] + module_install_dir = "productA/etc/***" # module_install_dir指定的路径需要以productA开始。 + } + ``` + +3.编译命令 +```shell +./build.sh --product-name {product_name} --build-target chip_prod_image +``` + +4. 打包结果:
+ 如果定义了子产品productA和productB,即`chip_product_list = ["productA", "productB"],`并且有模块安装到了该产品下,则打包后镜像输出路径如下: + ``` + images/productA/chip_prod.img + images/productB/chip_prod.img + ``` \ No newline at end of file diff --git a/zh-cn/device-dev/subsystems/subsys-build-rust-compilation.md b/zh-cn/device-dev/subsystems/subsys-build-rust-compilation.md new file mode 100644 index 0000000000000000000000000000000000000000..1fc2e56d6d6f306e3ce279b4e1fc460afd3ee577 --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-build-rust-compilation.md @@ -0,0 +1,360 @@ +# Rust模块配置规则和指导 + +## 概述 + +Rust是一门静态强类型语言,具有更安全的内存管理、更好的运行性能、原生支持多线程开发等优势。Rust官方也使用Cargo工具来专门为Rust代码创建工程和构建编译。 +OpenHarmony为了集成C/C++代码和提升编译速度,使用了GN + Ninja的编译构建系统。GN的构建语言简洁易读,Ninja的汇编级编译规则直接高效。 +为了在OpenHarmony中集成Rust代码,并最大程度发挥Rust和OpenHarmony中原有C/C++代码的交互性,采用GN作为统一构建工具,即通过GN构建Rust源码文件(xxx.rs),并增加与C/C++互操作、编译时lint、测试、IDL转换、三方库集成、IDE等功能。同时扩展gn框架,支持接口自动化转换,最大程度简化开发。 + +### 基本概念 + +| 术语 | 描述 | +| ----- | ------------------------------------------------------------ | +| Cargo | Cargo是Rust官方使用的构建工具,允许Rust项目声明其各种依赖项,并确保您始终获得可重复的构建。 | +| crate | crate是一个独立的可编译单元。 | +| lints | lints 是指出常见编程错误、错误、样式错误和可疑结构的工具。可以对程序进行更加广泛的错误分析。 | + + + +## 配置规则 +OpenHarmony提供了用于Rust代码编译构建的各类型GN模板,可以用于编译Rust可执行文件,动态库和静态库等。各类型模板说明如下: + +| GN模板 | 功能 | 输出 | +| ------------------------ | ----------------- | ----------------------------------------------- | +| ohos_rust_executable | rust可执行文件 | rust可执行文件,不带后缀 | +| ohos_rust_shared_library | rust动态库 | rust dylib动态库,默认后缀.dylib.so | +| ohos_rust_static_library | rust静态库 | rust rlib静态库,默认后缀.rlib | +| ohos_rust_proc_macro | rust proc_macro | rust proc_macro库, 默认后缀.so | +| ohos_rust_shared_ffi | rust FFI动态库 | rust cdylib动态库,给C/C++模块调用,默认后缀.so | +| ohos_rust_static_ffi | rust FFI静态库 | rust staticlib库,给C/C++模块调用,默认后缀.a | +| ohos_rust_cargo_crate | 三方包Cargo crate | rust三方crate,支持rlib、dylib、bin | +| ohos_rust_systemtest | rust系统测试用例 | rust可执行系统测试用例,不带后缀 | +| ohos_rust_unittest | rust单元测试用例 | rust可执行单元测试用例,不带后缀 | + + + +## 配置指导 +配置Rust模块与C/C++模块类似,参考[模块配置规则](subsys-build-module.md)。下面是使用不同模板的示例。 +### 配置Rust静态库示例 +该示例用于测试Rust可执行bin文件和静态库rlib文件的编译,以及可执行文件对静态库的依赖,使用模板ohos_rust_executable和ohos_rust_static_library。操作步骤如下: + +1. 创建build/rust/tests/test_rlib_crate/src/simple_printer.rs,如下所示: + + ```rust + //! simple_printer + + /// struct RustLogMessage + + pub struct RustLogMessage { + /// i32: id + pub id: i32, + /// String: msg + pub msg: String, + } + + /// function rust_log_rlib + pub fn rust_log_rlib(msg: RustLogMessage) { + println!("id:{} message:{:?}", msg.id, msg.msg) + } + ``` + +2. 创建build/rust/tests/test_rlib_crate/src/main.rs,如下所示: + + ```rust + //! rlib_crate example for Rust. + + extern crate simple_printer_rlib; + + use simple_printer_rlib::rust_log_rlib; + use simple_printer_rlib::RustLogMessage; + + fn main() { + let msg: RustLogMessage = RustLogMessage { + id: 0, + msg: "string in rlib crate".to_string(), + }; + rust_log_rlib(msg); + } + ``` + +3. 配置gn脚本build/rust/tests/test_rlib_crate/BUILD.gn,如下所示: + + ``` + import("//build/ohos.gni") + + ohos_rust_executable("test_rlib_crate") { + sources = [ "src/main.rs" ] + deps = [ ":simple_printer_rlib" ] + } + + ohos_rust_static_library("simple_printer_rlib") { + sources = [ "src/simple_printer.rs" ] + crate_name = "simple_printer_rlib" + crate_type = "rlib" + features = [ "std" ] + } + ``` + +4. 执行编译得到的可执行文件,运行结果如下: + + ![test_rlib_crate](./figures/test_rlib_crate.png) + +### 配置三方库示例 +该示例用于测试包含预编译文件build.rs的三方静态库rlib文件的编译,使用了模板ohos_rust_executable和ohos_rust_cargo_crate。操作步骤如下: + +1. 创建build/rust/tests/test_rlib_cargo_crate/crate/src/lib.rs,如下所示: + + ```rust + include!(concat!(env!("OUT_DIR"), "/generated/generated.rs")); + + pub fn say_hello_from_crate() { + assert_eq!(run_some_generated_code(), 45); + #[cfg(is_new_rustc)] + println!("Is new rustc"); + #[cfg(is_old_rustc)] + println!("Is old rustc"); + #[cfg(is_ohos)] + println!("Is ohos"); + #[cfg(is_mac)] + println!("Is darwin"); + #[cfg(has_feature_a)] + println!("Has feature_a"); + #[cfg(not(has_feature_a))] + panic!("Wasn't passed feature_a"); + #[cfg(not(has_feature_b))] + #[cfg(test_a_and_b)] + panic!("feature_b wasn't passed"); + #[cfg(has_feature_b)] + #[cfg(not(test_a_and_b))] + panic!("feature_b was passed"); + } + + #[cfg(test)] + mod tests { + /// Test features are passed through from BUILD.gn correctly. This test is the target configuration. + #[test] + #[cfg(test_a_and_b)] + fn test_features_passed_target1() { + #[cfg(not(has_feature_a))] + panic!("feature a was not passed"); + #[cfg(not(has_feature_b))] + panic!("feature b was not passed"); + } + + #[test] + fn test_generated_code_works() { + assert_eq!(crate::run_some_generated_code(), 45); + } + } + ``` + +2. 创建build/rust/tests/test_rlib_cargo_crate/crate/src/main.rs,如下所示: + + ```rust + pub fn main() { + test_rlib_crate::say_hello_from_crate(); + } + ``` + +3. 创建build/rust/tests/test_rlib_cargo_crate/crate/build.rs,如下所示: + + ```rust + use std::env; + use std::path::Path; + use std::io::Write; + use std::process::Command; + use std::str::{self, FromStr}; + + fn main() { + println!("cargo:rustc-cfg=build_script_ran"); + let my_minor = match rustc_minor_version() { + Some(my_minor) => my_minor, + None => return, + }; + + if my_minor >= 34 { + println!("cargo:rustc-cfg=is_new_rustc"); + } else { + println!("cargo:rustc-cfg=is_old_rustc"); + } + + let target = env::var("TARGET").unwrap(); + + if target.contains("ohos") { + println!("cargo:rustc-cfg=is_ohos"); + } + if target.contains("darwin") { + println!("cargo:rustc-cfg=is_mac"); + } + + let feature_a = env::var_os("CARGO_FEATURE_MY_FEATURE_A").is_some(); + if feature_a { + println!("cargo:rustc-cfg=has_feature_a"); + } + let feature_b = env::var_os("CARGO_FEATURE_MY_FEATURE_B").is_some(); + if feature_b { + println!("cargo:rustc-cfg=has_feature_b"); + } + + // Some tests as to whether we're properly emulating various cargo features. + assert!(Path::new("build.rs").exists()); + assert!(Path::new(&env::var_os("CARGO_MANIFEST_DIR").unwrap()).join("build.rs").exists()); + assert!(Path::new(&env::var_os("OUT_DIR").unwrap()).exists()); + + // Confirm the following env var is set + env::var_os("CARGO_CFG_TARGET_ARCH").unwrap(); + + generate_some_code().unwrap(); + } + + fn generate_some_code() -> std::io::Result<()> { + let test_output_dir = Path::new(&env::var_os("OUT_DIR").unwrap()).join("generated"); + let _ = std::fs::create_dir_all(&test_output_dir); + // Test that environment variables from .gn files are passed to build scripts + let preferred_number = env::var("ENV_VAR_FOR_BUILD_SCRIPT").unwrap(); + let mut file = std::fs::File::create(test_output_dir.join("generated.rs"))?; + write!(file, "fn run_some_generated_code() -> u32 {{ {} }}", preferred_number)?; + Ok(()) + } + + fn rustc_minor_version() -> Option { + let rustc_bin = match env::var_os("RUSTC") { + Some(rustc_bin) => rustc_bin, + None => return None, + }; + + let output = match Command::new(rustc_bin).arg("--version").output() { + Ok(output) => output, + Err(_) => return None, + }; + + let rustc_version = match str::from_utf8(&output.stdout) { + Ok(rustc_version) => rustc_version, + Err(_) => return None, + }; + + let mut pieces = rustc_version.split('.'); + if pieces.next() != Some("rustc 1") { + return None; + } + + let next_var = match pieces.next() { + Some(next_var) => next_var, + None => return None, + }; + + u32::from_str(next_var).ok() + } + ``` + +4. 配置gn脚本build/rust/tests/test_rlib_cargo_crate/BUILD.gn,如下所示: + + ``` + import("//build/templates/rust/ohos_cargo_crate.gni") + + ohos_cargo_crate("target") { + crate_name = "test_rlib_crate" + crate_root = "crate/src/lib.rs" + sources = [ "crate/src/lib.rs" ] + + #To generate the build_script binary + build_root = "crate/build.rs" + build_sources = [ "crate/build.rs" ] + build_script_outputs = [ "generated/generated.rs" ] + + features = [ + "my-feature_a", + "my-feature_b", + "std", + ] + rustflags = [ + "--cfg", + "test_a_and_b", + ] + rustenv = [ "ENV_VAR_FOR_BUILD_SCRIPT=45" ] + } + + # Exists to test the case that a single crate has both a library and a binary + ohos_cargo_crate("test_rlib_crate_associated_bin") { + crate_root = "crate/src/main.rs" + crate_type = "bin" + sources = [ "crate/src/main.rs" ] + + #To generate the build_script binary + build_root = "crate/build.rs" + build_sources = [ "crate/build.rs" ] + features = [ + "my-feature_a", + "my-feature_b", + "std", + ] + rustenv = [ "ENV_VAR_FOR_BUILD_SCRIPT=45" ] + deps = [ ":target" ] + } + ``` + +5. 执行编译得到的可执行文件,运行结果如下: + + ![test_rlib_cargo_crate](./figures/test_rlib_cargo_crate.png) + +### 其他源码实例 +在build/rust/tests目录下有Rust各类型模块的配置实例可供参考: +| 用例目录 | 测试功能 | +| -------------------------------------------- | ------------------------------------------------------------ | +| build/rust/tests/test_bin_crate | 测试ohos_rust_executable的host和target编译链接及运行 | +| build/rust/tests/test_static_link | 测试ohos_rust_executable对libstd.rlib进行静态链接 | +| build/rust/tests/test_dylib_crate | 测试ohos_rust_executable对ohos_rust_shared_library的编译依赖和运行 | +| build/rust/tests/test_rlib_crate | 测试ohos_rust_executable对ohos_rust_static_library的编译依赖和运行 | +| build/rust/tests/test_proc_macro_crate | 测试ohos_rust_executable对ohos_rust_proc_macro的编译依赖和运行,对不同类型都有用例覆盖 | +| build/rust/tests/test_cdylib_crate | 测试ohos_rust_executable对ohos_rust_shared_ffi的编译依赖和运行 | +| build/rust/tests/test_staticlib_crate | 测试ohos_rust_executable对ohos_rust_static_ffi的编译依赖和运行 | +| build/rust/tests/test_rust_ut | 测试ohos_rust_unittest,用例代码与特性代码在同一个文件中 | +| build/rust/tests/test_rust_st | 测试ohos_rust_systemtest,用例代码在独立的test目录中 | +| build/rust/tests/test_bin_cargo_crate | 测试ohos_cargo_crate对拥有build.rs预编译的可执行文件编译链接和运行,适用于rust三方crate编译依赖 | +| build/rust/tests/test_rlib_cargo_crate | 测试ohos_cargo_crate对拥有build.rs预编译的静态库文件编译链接和运行,适用于rust三方crate编译依赖 | +| build/rust/tests/test_proc_macro_cargo_crate | 测试ohos_cargo_crate对拥有build.rs预编译的过程宏编译链接和运行,适用于rust三方crate编译依赖 | + +## 参考 + +### 特性点实例 + +#### Rust源码依赖调用C/C++库 +OpenHarmony上C/C++模块动态库默认用.z.so后缀,但是Rust的编译命令通过-l链接时,默认只会链接.so后缀的动态库。因此如果要依赖一个C/C++动态库编译模块,需要在该动态库的GN构建文件中添加output_externsion = "so"的声明,这样编译得到的动态库将会以".so"作为后缀,而不是".z.so"。 +在Rust源码中如果直接链接动态库,后缀也需要使用".so",这时使用动态库的中间名,不需要添加lib前缀。例如Rust源码中链接libhilog.so: +```rust +#[link(name = "hilog")] +``` +#### externs使用 +某个模块如果依赖二进制的rlib库,可以使用externs属性: +``` +executable("foo") { + sources = [ "main.rs" ] + externs = [{ # 编译时会转成`--extern bar=path/to/bar.rlib` + crate_name = "bar" + path = "path/to/bar.rlib" + }] +} +``` +### lints规则 +OpenHarmony框架支持rustc lints和clippy lints两种lints,每种lints划为三个等级的标准:"openharmony"、"vendor"和"none",严格程度按照"openharmony" -> "vendor" -> "none"逐级递减。 +配置Rust模块时可以通过rustc_lints和clippy_lints来指定使用lints的等级。 +模块中没有配置rustc_lints或者clippy_lints时会根据模块所在路径来匹配lints等级。不同路径下的Rust代码的语法规范会有不同程度地约束,因此用户在OpenHarmony配置Rust代码编译模块时还应关注模块所在路径。 +#### rustc lints和clippy lints的各等级标志 +| **lints类型** | **模块属性** | **lints等级** | **lints等级标志** | **lints内容** | +| ------------- | ------------ | ------------- | ----------------- | ------------------------------------------------------------ | +| rustc_lints | rustc_lints | openharmony | RustOhosLints | "-A deprecated", "-D missing-docs", "-D warnigngs" | +| rustc_lints | rustc_lints | vendor | RustcVendorLints | "-A deprecated", "-D warnigs" | +| rustc_lints | rustc_lints | none | allowAllLints | "-cap-lints allow" | +| clippy lints | clippy lints | openharmony | ClippyOhosLints | "-A clippy::type-complexity", "-A clippy::unnecessary-wraps", "-A clippy::unusual-byte-groupings", "-A clippy::upper-case-acronyms" | +| clippy lints | clippy lints | vendor | ClippyVendorLints | "-A clippy::complexity", "-A Clippy::perf", "-A clippy::style" | +| clippy lints | clippy lints | none | allowAllLints | "--cap-lints allow" | + +#### 代码路径与lints等级的对应关系 +| 路径 | Lints等级 | +| ---------- | ----------- | +| thirdparty | none | +| prebuilts | none | +| vendor | vendor | +| device | vendor | +| others | openharmony | + 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 deleted file mode 100644 index 888c1d09552d9b77beaaf73dd3912f892e42b2df..0000000000000000000000000000000000000000 --- a/zh-cn/device-dev/subsystems/subsys-data-relational-database-guide.md +++ /dev/null @@ -1,346 +0,0 @@ -# 关系型数据库开发指导 - -## 场景介绍 - -关系型数据库是在SQLite基础上实现的本地数据操作机制,提供给用户无需编写原生SQL语句就能进行数据增删改查的方法,同时也支持原生SQL语句操作。 - -## 接口说明 -### 数据库的创建和删除 - -关系型数据库提供了数据库创建方式,以及对应的删除接口,涉及的API如下所示。 - -表1 数据库创建和删除API - -| 类名 | 接口名 | 描述 | -| ---- | ---- | ---- | -| 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 = "") | 对数据库进行配置,包括设置数据库名、存储模式、日志模式、同步模式,是否为只读,及数据库加密。
  • path:数据库路径;
  • readOnly:是否只读;
  • storageMode:存储模式;
  • encryptKey:加密密钥;
  • journalMode:日志模式;
  • syncMode:同步模式;
  • databaseFileType:数据库类型;
  • databaseFileSecurityLevel:安全等级
| -| RdbOpenCallback | int OnCreate(RdbStore &rdbStore) | 数据库创建时被回调,开发者可以在该方法中初始化表结构,并添加一些应用使用到的初始化数据。 | -| RdbOpenCallback | int OnUpgrade(RdbStore &rdbStore, int currentVersion, int targetVersion) | 数据库升级时被回调。 | -| RdbOpenCallback | int OnDowngrade(RdbStore &rdbStore, int currentVersion, int targetVersion) | 数据库降级时被回调。 | -| RdbHelper | std::shared_ptr\ GetRdbStore(const RdbStoreConfig &config, int version, RdbOpenCallback &openCallback, int &errCode) | 根据配置创建或打开数据库。 | -| RdbHelper | int DeleteRdbStore(const std::string &path) | 删除指定的数据库。 | - -### 数据库谓词的使用 - -关系型数据库提供了用于设置数据库操作条件的谓词AbsRdbPredicates,其中包括两个实现子类RdbPredicates和RawRdbPredicates: - -- RdbPredicates:开发者无需编写复杂的SQL语句,仅通过调用该类中条件相关的方法,如equalTo、notEqualTo、groupBy、orderByAsc、beginsWith等,就可自动完成SQL语句拼接,方便用户聚焦业务操作。 -- RawRdbPredicates:可满足复杂SQL语句的场景,支持开发者自己设置where条件子句和whereArgs参数。不支持equalTo等条件接口的使用。 - - 表2 数据库谓词API - | 类名 | 接口名 | 描述 | - | ---- | ---- | ---- | - | RdbPredicates | AbsPredicates *EqualTo(std::string field, std::string value) | 设置谓词条件,满足field字段与value值相等。 | - | RdbPredicates | AbsPredicates *NotEqualTo(std::string field, std::string value) | 设置谓词条件,满足field字段与value值不相等。 | - | RdbPredicates | AbsPredicates *BeginsWith(std::string field, std::string value) | 设置谓词条件,满足field字段以value值开头。 | - | RdbPredicates | AbsPredicates *Between(std::string field, std::string low, std::string high) | 设置谓词条件,满足field字段在最小值low和最大值high之间。 | - | RdbPredicates | AbsPredicates *OrderByAsc(std::string field) | 设置谓词条件,根据field字段升序排列。 | - | RdbPredicates | void SetWhereClause(std::string whereClause) | 设置where条件子句。 | - | RdbPredicates | void SetWhereArgs(std::vector\ whereArgs) | 设置whereArgs参数,该值表示where子句中占位符的值。 | - | RdbPredicates | AbsRdbPredicates *InDevices(std::vector& devices) | 设置谓词条件,同步分布式数据库时指定组网内的远程设备。 | - | RdbPredicates | AbsRdbPredicates *InAllDevices() | 设置谓词条件,同步分布式数据库时连接到组网内的所有远程设备。| - - -### 数据表的增删改查 - -关系型数据库提供对本地数据增删改查操作的能力,相关API如下所示。 - -- 新增 - - 关系型数据库提供了插入数据的接口,通过ValuesBucket输入要存储的数据,通过返回值判断是否插入成功,插入成功时返回最新插入数据所在的行号,失败时则返回-1。 - - 表3 数据表插入API - - | 类名 | 接口名 | 描述 | - | ---- | ---- | ---- | - | RdbStore | int Insert(int64_t &outRowId, const std::string &table, const ValuesBucket &initialValues) | 向数据库插入数据。
  • table:待添加数据的表名。
  • initialValues:以ValuesBucket存储的待插入的数据。它提供一系列put方法,如PutString(const std::string &columnName, const std::string &value),PutDouble(const std::string &columnName, double value),用于向ValuesBucket中添加数据。
| - -- 删除 - - 调用删除接口,通过AbsRdbPredicates指定删除条件。该接口的返回值表示删除的数据行数,可根据此值判断是否删除成功。如果删除失败,则返回0。 - - 表4 数据表删除API - | 类名 | 接口名 | 描述 | - | ---- | ---- | ---- | - | RdbStore | int Delete(int &deletedRows, const AbsRdbPredicates &predicates) | 删除数据。
  • deletedRows:删除的记录条数。
  • predicates:Rdb谓词,指定了删除操作的表名和条件。AbsRdbPredicates的实现类有两个:RdbPredicates和RawRdbPredicates。
    • RdbPredicates:支持调用谓词提供的equalTo等接口,设置删除条件。
    • RawRdbPredicates:仅支持设置表名、where条件子句、whereArgs三个参数,不支持equalTo等接口调用。
| - -- 更新 - - 调用更新接口,传入要更新的数据,并通过AbsRdbPredicates指定更新条件。该接口的返回值表示更新操作影响的行数。如果更新失败,则返回0。 - - 表5 数据表更新API - | 类名 | 接口名 | 描述 | - | ---- | ---- | ---- | - | RdbStore | int Update(int &changedRows, const ValuesBucket &values, const AbsRdbPredicates &predicates) | 更新数据库表中符合谓词指定条件的数据。
  • changedRows:更新的记录条数。
  • values:以ValuesBucket存储的要更新的数据。
  • predicates:指定了更新操作的表名和条件。AbsRdbPredicates的实现类有两个:RdbPredicates和RawRdbPredicates。
    • RdbPredicates:支持调用谓词提供的equalTo等接口,设置更新条件。
    • RawRdbPredicates:仅支持设置表名、where条件子句、whereArgs三个参数,不支持equalTo等接口调用。
| - -- 查询 - - 关系型数据库提供了两种查询数据的方式: - - - 直接调用查询接口。使用该接口,会将包含查询条件的谓词自动拼接成完整的SQL语句进行查询操作,无需用户传入原生的SQL语句。 - - 执行原生的SQL语句进行查询操作。 - - 表6 数据表查询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 QuerySql(const std::string &sql, const std::vector\ &selectionArgs = std::vector\()) | 执行原生的用于查询操作的SQL语句。
  • sql:原生用于查询的sql语句。
  • selectionArgs:sql语句中占位符参数的值,若select语句中没有使用占位符,该参数可以设置为null。
| - -### 查询结果集的使用 - -关系型数据库提供了查询返回的结果集ResultSet,其指向查询结果中的一行数据,供用户对查询结果进行遍历和访问。ResultSet对外API如下所示。 - -表7 结果集API -| 类名 | 接口名 | 描述 | -| ---- | ---- | ---- | -| ResultSet | int GoTo(int offset) | 从结果集当前位置移动指定偏移量。 | -| ResultSet | int GoToRow(int position) | 将结果集移动到指定位置。 | -| ResultSet | int GoToNextRow() | 将结果集向后移动一行。 | -| ResultSet | int GoToPreviousRow() | 将结果集向前移动一行。 | -| ResultSet | int IsStarted(bool &result) | 判断结果集是否被移动过。 | -| ResultSet | int IsEnded(bool &result) | 判断结果集是否被移动到最后一行之后。 | -| ResultSet | int IsAtFirstRow(bool &result) | 判断结果集当前位置是否在第一行。 | -| ResultSet | int IsAtLastRow(bool &result) | 判断结果集当前位置是否在最后一行。 | -| ResultSet | int GetRowCount(int &count) | 获取当前结果集中的记录条数。 | -| ResultSet | int GetColumnCount(int &count) | 获取结果集中的列数。 | -| ResultSet | int GetString(int columnIndex, std::string &value) | 获取当前行指定列的值,以String类型返回。 | -| ResultSet | int GetBlob(int columnIndex, std::vector\ &blob) | 获取当前行指定列的值,以字节数组形式返回。 | -| ResultSet | int GetDouble(int columnIndex, double &value) | 获取当前行指定列的值,以double型返回。 | - -### 设置分布式列表 - -用户可以对当前数据库中的列表设置为分布式列表。 - -表8 设置分布式列表 -| 类名 | 接口名 | 描述 | -| ---- | ---- | ---- | -| RdbStore | bool SetDistributedTables(const std::vector& tables) | 设置分布式列表。
  • tables:要设置的分布式列表表名
- -### 根据本地表名获取指定远程设备的分布式表名 - -用户根据本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名。 - -表9 根据本地表名获取指定远程设备的分布式表名 -| 类名 | 接口名 | 描述 | -| ---- | ---- | ---- | -| RdbStore | std::string ObtainDistributedTableName(const std::string& device, const std::string& table) | 根据本地表名获取指定远程设备的分布式表名。在查询远程设备数据库时,需要使用分布式表名。
  • device:远程设备ID
  • table:本地表名
- -### 在设备之间同步数据 - -表10 在设备之间同步数据 -| 类名 | 接口名 | 描述 | -| ---- | ---- | ---- | -| RdbStore | bool Sync(const SyncOption& option, const AbsRdbPredicates& predicate, const SyncCallback& callback) | 在设备之间同步数据。
  • option:同步选项;mode:同步模式(PUSH表示数据从本地设备推送到远程设备/PULL表示数据从远程设备拉至本地设备);isBlock:是否阻塞
  • callback:指定的callback回调函数
- -### 注册数据库的观察者 - -表11 注册数据库的观察者 -| 类名 | 接口名 | 描述 | -| ---- | ---- | ---- | -| RdbStore | bool Subscribe(const SubscribeOption& option, RdbStoreObserver *observer) | 注册数据库的观察者。当分布式数据库中的数据发生更改时,将调用回调。
  • option:订阅类型;
  • observer:指分布式数据库中数据更改事件的观察者
- -### 从数据库中删除指定类型的指定观察者 - -表12 从数据库中删除指定类型的指定观察者 -| 类名 | 接口名 | 描述 | -| ---- | ---- | ---- | -| RdbStore | bool UnSubscribe(const SubscribeOption& option, RdbStoreObserver *observer) | 从数据库中删除指定类型的指定观察者。
  • option:订阅类型;
  • observer:指已注册的数据更改观察者
- -### 数据库的备份和恢复 - -关系型数据库提供对本地数据库文件的备份和恢复能力,相关API如下所示。 - -- 备份 - - 关系型数据库提供了备份数据库文件的接口,通过databasePath指定的备份文件名(支持路径)备份当前数据库文件。通过返回值判断是否备份成功,成功时返回0,失败时则返回相应的错误码。 - - 表13 数据库备份API - - | 类名 | 接口名 | 描述 | - | ---- | ---- | ---- | - | RdbStore | int Backup(const std::string databasePath, const std::vector<uint8_t> destEncryptKey) | 备份数据库文件。
  • databasePath:指定的备份文件名。
  • destEncryptKey:数据库的加密密钥。注意:当前只支持非加密数据库的备份。
| - -- 恢复 - - 关系型数据库提供了恢复数据库文件的接口,通过backupPath指定的备份文件名(支持路径)恢复当前数据库文件。通过返回值判断是否恢复成功,成功时返回0,失败时则返回相应的错误码。 - - 表14 数据库恢复API - - | 类名 | 接口名 | 描述 | - | ---- | ---- | ---- | - | RdbStore | int Restore(const std::string backupPath, const std::vector<uint8_t> &newKey) | 恢复数据库文件。
  • backupPath:指定的备份文件名。
  • newKey:数据库的加密密钥。注意:当前只支持非加密数据库的恢复。
| - -### 事务 - - 事务(Transaction)是一个对数据库执行工作单元。通过返回值判断事务是否成功,成功时返回0,失败时则返回相应的错误码。 - - 表15 事务API - - | 类名 | 接口名 | 描述 | - | ---- | ---- | ---- | - | RdbStore | int BeginTransaction() | 开启一个事务。 | - | RdbStore | int Commit() | 保存更改。 | - | RdbStore | int RollBack() | 回滚所做的更改。 | - -## 约束与限制 - -无。 - -## 开发步骤 - -1. 创建数据库。 - - a. 配置数据库相关信息,包括数据库的名称、存储模式、是否为只读模式等。 - - b. 初始化数据库表结构和相关数据。 - - c. 创建数据库。 - - 示例代码如下: - ```c++ - const std::string DATABASE_NAME = RDB_TEST_PATH + "RdbStoreTest.db"; - const std::string CREATE_TABLE_TEST = "CREATE TABLE IF NOT EXISTS test (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, salary REAL, blobType BLOB)"; - - class OpenCallback : public RdbOpenCallback { - public: - int OnCreate(RdbStore &rdbStore) override; - int OnUpgrade(RdbStore &rdbStore, int oldVersion, int newVersion) override; - }; - - int OpenCallback::OnCreate(RdbStore &store) - { - return store.ExecuteSql(CREATE_TABLE_TEST); - } - - RdbStoreConfig config(DATABASE_NAME); - OpenCallback callback; - - std::shared_ptr store = RdbHelper::GetRdbStore(config, 1, callback, 0); - ``` - -2. 插入数据。 - - a. 构造要插入的数据,以ValuesBucket形式存储。 - - b. 调用关系型数据库提供的插入接口。 - - c. 创建数据库。 - - 示例代码如下: - ```c++ - ValuesBucket values; - - values.PutInt("id", 1); - values.PutString("name", std::string("Tom")); - values.PutInt("age", 18); - values.PutDouble("salary", 100.5); - values.PutBlob("blobType", std::vector{ 1, 2, 3 }); - store->Insert(id, "test", values); - ``` - -3. 查询数据。 - - a. 构造用于查询的谓词对象,设置查询条件。 - - b. 指定查询返回的数据列。 - - c. 调用查询接口查询数据。 - - d. 调用结果集接口,遍历返回结果。 - - 示例代码如下: - ```c++ - std::vector columns = {"id", "name", "age", "salary"}; - - RdbPredicates predicates("test"); - predicates.EqualTo("age", "25")->OrderByAsc("salary"); - std::unique_ptr resultSet = store->Query(predicates, columns) - resultSet.goToNextRow(); - ``` - -4. 设置分布式同步表 - - a. 调用接口设置分布式同步表。 - - 示例代码如下: - - ```c++ - store->SetDistributedTables("test"); - ``` - -5. 分布式数据同步 - - a. 定义同步模式和阻塞状态。 - - b. 构造用于同步分布式表的谓词对象,指定组网内的远程设备。 - - c. 调用接口同步数据。 - - 示例代码如下: - - ```c++ - SyncOption option; - option.mode = PUSH; - option.isBlock = true; - AbsRdbPredicates predicate("test"); - predicate.InAllDevices(); - store->Sync(option, predicate, [](const SyncResult& result) { - for (const auto& [device, status] : result) { - LogI("device=%s status=%d", device.c_str(), status); - } - }); - ``` - -6. 分布式数据订阅 - - a. 重写数据更改观察者OnChange()函数。 - - b. 定义分布式数据订阅类型。 - - c. 调用接口实现分布式数据订阅,或取消订阅。 - - 示例代码如下: - - ```c++ - class MyObserver : public RdbStoreObserver { - public: - void OnChange(const std::vector& devices) override { - for (const auto& device : devices) { - LOGI("device=%s data change", device.c_str()); - } - } - }; - - SubscribeOption option; - option.mode = SubscribeMode::REMOTE; - MyObserver observer; - store->Subscribe(option, &observer); // 分布式数据订阅 - - store->UnSubscribe(option, &observer); // 取消订阅 - ``` - -7. 跨设备查询 - - a. 根据本地表名获取指定远程设备的分布式表名。 - - b. 根据指定SQL语句查询数据库中的数据。 - - 示例代码如下: - ```c++ - std::string tableName = store->ObtainDistributedTableName("123456789abcd", "test"); - auto resultSet = store->QuerySql("SELECT * from ?;", tableName); - ``` - -8. 数据库的备份和恢复 - - a. 根据指定的数据库备份文件名备份当前数据库。 - - b. 根据指定的数据库备份文件恢复当前数据库。 - - 示例代码如下: - ```c++ - std::string backupName = "backup.db"; // 指定数据库的备份文件名 - std::vector key; // 数据库的加密密钥 - int errno = store->Backup(backupName, key); - errno = store->Restore(backupName, key); - ``` \ No newline at end of file diff --git a/zh-cn/device-dev/subsystems/subsys-data-relational-database-overview.md b/zh-cn/device-dev/subsystems/subsys-data-relational-database-overview.md deleted file mode 100644 index 90ef4efc82a04fd03a0083f9ecc92c54f3fec8f6..0000000000000000000000000000000000000000 --- a/zh-cn/device-dev/subsystems/subsys-data-relational-database-overview.md +++ /dev/null @@ -1,39 +0,0 @@ -# 关系型数据库概述 - -关系型数据库(Relational Database,RDB)是一种基于关系模型来管理数据的数据库。OpenHarmony关系型数据库基于SQLite组件提供了一套完整的对本地数据库进行管理的机制,对外提供了一系列的增、删、改、查等接口,也可以直接运行用户输入的SQL语句来满足复杂的场景需要。 - -## 基本概念 - -- 关系型数据库 - - 基于关系模型来管理数据的数据库,以行和列的形式存储数据。 - -- 谓词 - - 数据库中用来代表数据实体的性质、特征或者数据实体之间关系的词项,主要用来定义数据库的操作条件。 - -- 结果集 - - 指用户查询之后的结果集合,可以对数据进行访问。结果集提供了灵活的数据访问方式,可以更方便的拿到用户想要的数据。 - -- SQLite数据库 - - 一款遵守ACID的轻型开源关系型数据库管理系统。 - -## 运作机制 -OpenHarmony关系型数据库对外提供通用的操作接口(即Rdb Store接口),底层使用第三方开源组件SQLite作为持久化存储引擎,支持SQLite具有的所有数据库特性。 - -**图1** 关系型数据库运作机制 - -![](figures/zh-cn_image_0000001115980740.png) - -## 默认配置 -- 如果不指定数据库的日志模式,那么系统默认日志方式是WAL(Write Ahead Log)模式。 -- 如果不指定数据库的落盘模式,那么系统默认落盘方式是FULL模式。 -- OpenHarmony数据库使用的共享内存默认大小是8MB,单次查询使用的共享内存默认大小是2MB。 - -## 约束与限制 -- 数据库中连接池的最大数量是4个,用以管理用户的读操作。 -- 为保证数据的准确性,数据库同一时间只能支持一个写操作。 - - diff --git a/zh-cn/device-dev/subsystems/subsys-data-storage-guide.md b/zh-cn/device-dev/subsystems/subsys-data-storage-guide.md deleted file mode 100755 index edadbed8f145320327af3d3f1cdb158df1428ae4..0000000000000000000000000000000000000000 --- a/zh-cn/device-dev/subsystems/subsys-data-storage-guide.md +++ /dev/null @@ -1,193 +0,0 @@ -# 轻量级数据存储开发指导 - -## 场景介绍 - -轻量级数据存储功能通常用于保存应用的一些常用配置信息,并不适合需要存储大量数据和频繁改变数据的场景。应用的数据保存在文件中,这些文件可以持久化地存储在设备上。需要注意的是,应用访问的实例包含文件所有数据,这些数据会一直加载在设备的内存中,直到应用主动从内存中将其移除前,应用可以通过Preferences的API进行数据操作。 - -## 接口说明 - -轻量级存储为应用提供key-value键值型的文件数据处理能力,支持应用对数据进行轻量级存储及查询。数据存储形式为键值对,键的类型为字符串型,值的存储数据类型包括字符串型、布尔型、整数型、长整型、浮点型、双精度类型和字符串数组。 - -**创建存储实例** - -读取指定文件,将数据加载到Preferences实例,即可创建一个存储实例,用于数据操作。 - -**表 1** 轻量级数据存储实例创建接口 - -| 类名 | 方法名 | 描述 | -| --- | ----- | ----| -| PreferencesHelper | static std::shared_ptr GetPreferences(const std::string &path, int &errCode); | path:应用程序内部数据存储路径。
errCode:错误码。
返回值:轻量级存储实例。 | - -**存入数据** - -通过Put系列方法,可以增加或修改Preferences实例中的数据。 - -**表 2** 轻量级偏好数据库存入接口 - -| 类名 | 方法名 | 描述 | -| --- | ----- | ----| -| Preferences | int PutInt(const std::string &key, int value); | key:将要存储的key名称,不能为空。
value:将要存储的value。
返回值:错误码。 | -| Preferences | int PutString(const std::string &key, const std::string &value); | key:将要存储的key名称,不能为空。
value:将要存储的value。
返回值:错误码。 | -| Preferences | int PutBool(const std::string &key, bool value); | key:将要存储的key名称,不能为空。
value:将要存储的value。
返回值:错误码。 | -| Preferences | int PutLong(const std::string &key, int64_t value); | key:将要存储的key名称,不能为空。
value:将要存储的value。
返回值:错误码。 | -| Preferences | int PutFloat(const std::string &key, float value); | key:将要存储的key名称,不能为空。
value:将要存储的value。
返回值:错误码。 | -| Preferences | int PutDouble(const std::string &key, double value); | key:将要存储的key名称,不能为空。
value:将要存储的value。
返回值:错误码。 | -| Preferences | int PutStringSet(const std::string &key, const std::set\ &value); | key:将要存储的key名称,不能为空。
value:将要存储的。
返回值:错误码。 | - -**读取数据** - -通过调用Get系列方法,可以读取Preferences中的数据。 - -**表 3** 轻量级数据读取接口 - -| 类名 | 方法名 | 描述 | -| --- | ----- | ----| -| Preferences | int GetInt(const std::string &key, const int defValue = 0); | key:要获取的存储key名称,不能为空。
defValue:若获取失败或value不存在返回此默认值。
返回值:value。 | -| Preferences | std::string GetString(const std::string &key, const std::string &defValue = {}); | key:要获取的存储key名称,不能为空。
defValue:若获取失败或value不存在返回此默认值。
返回值:value。 | -| Preferences | bool GetBool(const std::string &key, const bool defValue = false); | key:要获取的存储key名称,不能为空。
defValue:若获取失败或value不存在返回此默认值。
返回值:value。 | -| Preferences | float GetFloat(const std::string &key, const float defValue = 0); | key:要获取的存储key名称,不能为空。
defValue:若获取失败或value不存在返回此默认值。
返回值:value。 | -| Preferences | double GetDouble(const std::string &key, const double defValue = 0); | key:要获取的存储key名称,不能为空。
defValue:若获取失败或value不存在返回此默认值。
返回值:value。 | -| Preferences | int64_t GetLong(const std::string &key, const int64_t defValue = 0); | key:要获取的存储key名称,不能为空。
defValue:若获取失败或value不存在返回此默认值。
返回值:value。 | -| Preferences | std::set\ GetStringSet(const std::string &key, const std::set\ &defValue = {}); | key:要获取的存储key名称,不能为空。
defValue:若获取失败或value不存在返回此默认值。
返回值:value。 | - -**数据持久化** - -通过执行Flush()或者FlushSync()方法,应用可以将缓存的数据再次写回文本文件中进行持久化存储。 - -**表 5** 轻量级数据数据持久化接口 - -| 类名 | 方法名 | 描述 | -| --- | ----- | ----| -| Preferences | void Flush(); | 将Preferences实例通过异步线程回写入文件中。 | -| Preferences | int FlushSync(); | 将Preferences实例通过同步线程回写入文件中,并返回错误码。 | - -**订阅数据变化** - -订阅数据变化需要指定PreferencesObserver作为回调方法。订阅的key的值发生变更后,当执行flush方法时,PreferencesObserver被回调。 - -**表 5** 轻量级数据变化订阅接口 - -| 类名 | 方法名 | 描述 | -| --- | ----- | ----| -| Preferences | void RegisterObserver(std::shared_ptr preferencesObserver); | preferencesObserver:需要订阅的回调对象实例。 | -| Preferences | void UnRegisterObserver(std::shared_ptr preferencesObserver); | preferencesObserver:需要注销订阅的回调对象实例。 | - -**删除数据文件** - -通过调用以下两种接口,可以删除数据实例或对应的文件。 - -**表 6** 轻量级数据存储删除接口 - -| 类名 | 方法名 | 描述 | -| --- | ----- | ----| -| PreferencesHelper | int DeletePreferences(const std::string &path); | 将Preferences实例从内存中移除,同时删除其在设备上的持久化文件。path:应用程序内部数据存储路径。
返回值:错误码。 | -| PreferencesHelper | int RemovePreferencesFromCache(const std::string &path); | 仅将Preferences实例从内存中移除。path:应用程序内部数据存储路径。
返回值:错误码。 | - -## 开发步骤 - -1. 准备工作,引入preferences以及相关的头文件到开发环境。 - - ``` C++ - 头文件路径://distributeddatamgr_appdatamgr/interfaces/innerkits/native_preferences/include - ``` - -2. 获取Preferences实例。 - - 读取指定文件,将数据加载到Preferences实例,用于数据操作。 - - ``` C++ - int errCode = E_OK; - Preferences pref = PreferencesHelper::GetPreferences(PREF_TEST_PATH + "test.xml", errCode); // PREF_TEST_PATH须为应用沙箱路径。 - EXPECT_EQ(errCode, E_OK); - ``` - - -3. 存入数据。 - - 使用Preferences put方法保存数据到缓存的实例中。 - - ```C++ - pref->PutString("test", "remove"); - ``` - -4. 读取数据。 - - 使用Preferences get方法读取数据。 - - ``` C++ - std::string ret = pref->GetString("test", "defaultValue"); - EXPECT_EQ(ret, "remove"); - ``` - - -5. 数据持久化。 - - 应用存入数据到Preferences实例后,可以通过Flush()或者FlushSync()方法将Preferences实例回写到文件中。 - - ```C++ - int err = pref->FlushSync(); - EXPECT_EQ(ret, E_OK); - ``` - -6. 订阅数据变化。 - - 应用订阅数据变化需要指定PreferencesObserver作为回调方法。订阅的key的值发生变更后,当执行flush或者flushSync方法时,PreferencesObserver被触发回调。不再需要PreferencesObserver时请注销。 - - 自定义类,实现PreferencesObserver接口: - ``` C++ - class PreferencesObserverCounter : public PreferencesObserver { - public: - virtual ~PreferencesObserverCounter(); - void OnChange(Preferences &preferences, const std::string &key) override; - - std::atomic_int notifyTimes; - static const std::vector NOTIFY_KEYS_VECTOR; - }; - - PreferencesObserverCounter::~PreferencesObserverCounter() {} - - void PreferencesObserverCounter::OnChange(Preferences &preferences, const std::string &key) - { - for (auto it = NOTIFY_KEYS_VECTOR.cbegin(); it != NOTIFY_KEYS_VECTOR.cend(); it++) { - if (key.compare(*it)) { - notifyTimes++; - break; - } - } - } - - 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 }; - ``` - - 订阅数据变化,并触发执行回调方法: - ``` C++ - std::shared_ptr counter = - std::make_shared(); - pref->RegisterObserver(counter); // 注册数据变化的回调。 - - pref->PutString(PreferencesTest::KEY_TEST_STRING_ELEMENT, "test"); - pref->Flush(); // 触发执行counter的onChanged回调方法。 - 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); // 注销注册数据变化的回调。 - ``` - - -7. 删除指定文件。 - - 从使用PreferencesHelper内存中移除指定文件对应的Preferences单实例,并删除指定文件及其备份文件、损坏文件。删除指定文件时,应用不允许再使用该实例进行数据操作,否则会出现数据一致性问题。删除后,数据及文件将不可恢复。 - - ``` C++ - pref = nullptr; - int ret = PreferencesHelper::DeletePreferences("/data/test/test"); - EXPECT_EQ(ret, E_OK); - ``` - diff --git a/zh-cn/device-dev/subsystems/subsys-data-storage-overview.md b/zh-cn/device-dev/subsystems/subsys-data-storage-overview.md deleted file mode 100755 index 67dfa96b86233202ae94f46c0492377fcd87ccb3..0000000000000000000000000000000000000000 --- a/zh-cn/device-dev/subsystems/subsys-data-storage-overview.md +++ /dev/null @@ -1,31 +0,0 @@ -# 轻量级数据存储概述 - -轻量级数据存储适用于对Key-Value结构的数据进行存取和持久化操作。应用获取某个轻量级存储对象后,该存储对象中的数据将会被缓存在内存中,以便应用获得更快的数据存取速度。应用也可以将缓存的数据再次写回文本文件中进行持久化存储,由于文件读写将产生不可避免的系统资源开销,建议应用减少对持久化文件的读写频率。 - -## 基本概念 - -- **Key-Value数据结构** - - 一种键值结构数据类型。Key是不重复的关键字,Value是数据值。 - -- **非关系型数据库** - - 区别于关系数据库,不保证遵循ACID(Atomic、Consistency、Isolation及Durability)特性,不采用关系模型来组织数据,数据之间无关系。 - - -## 运作机制 - -1. 应用通过指定Preferences文件将其中的数据加载到Preferences实例,系统会通过静态容器将该实例存储在内存中,同一应用或进程中每个文件仅存在一个Preferences实例,直到应用主动从内存中移除该实例或者删除该Preferences文件。 -2. 应用获取到Preferences文件对应的实例后,可以从Preferences实例中读取数据,或者将数据存入Preferences实例中。通过调用flush或者flushSync方法可以将Preferences实例中的数据回写到文件里。 - -**图 1** 轻量级数据存储运作机制 - - -![](figures/zh-cn_image_0000001192123772.png) - -## 约束与限制 - -- 因Preferences实例会加载到内存中,建议存储的数据不超过一万条,并及时清理不再使用的实例,以便减少非内存开销。 -- 数据中的key为string类型,要求非空且字符长度不超过80个。 -- 当数据中的value为string类型时,允许为空,字符长度不超过8192个。 - diff --git a/zh-cn/device-dev/subsystems/subsys-dfx-faultlogger.md b/zh-cn/device-dev/subsystems/subsys-dfx-faultlogger.md index b290303ffdac4b6f3fb877e0436e793f7f365f4a..06e91d7b7f0a19ee6418efcce03cfd9222bc3a15 100644 --- a/zh-cn/device-dev/subsystems/subsys-dfx-faultlogger.md +++ b/zh-cn/device-dev/subsystems/subsys-dfx-faultlogger.md @@ -18,15 +18,15 @@ FaultLogger承载OpenHarmony系统上的故障记录功能,按照服务对象 **图1** 进程崩溃处理流程图 -![zh-cn_image_0000001261812333](figures/zh-cn_image_0000001261812333.png) +![zh-cn_image_0000001261812333](figures/zh-cn_image_0000001261812334.png) -1. 进程安装信号处理器后,通过DFX_SignalHandler函数检测并响应进程崩溃异常信号; +1. 进程安装信号处理器后,通过DFX_SignalHandler函数检测并响应由Kernel抛出的进程崩溃异常信号; 2. SignalHandler检测到异常信号后Fork出子进程,并运行ProcessDump程序开始dump崩溃进程和线程的堆栈信息; -3. ProcessDump程序在读取异常堆栈信息后将日志写入到Faultloggerd中的临时存储目录,进而生成完整的崩溃日志; +3. ProcessDump程序向Faultloggerd服务申请用于存储故障日志的文件句柄,在读取到异常堆栈信息后写入到该文件中,进而生成完整的崩溃日志; -4. Faultloggerd根据需要将故障通过Hiview提供的AddFaultLog()接口进行上报,hiview将处理生成简化的崩溃日志,并上报Hisysevent事件。 +4. ProcessDump完成崩溃日志收集后,根据需要将故障通过Hiview提供的AddFaultLog()接口进行上报,hiview将处理生成简化的崩溃日志,并上报Hisysevent事件。 基于这样的设计,在资源有限的小型系统上可只部署Faultloggerd,也依然可以获取用于定位崩溃问题的日志。 @@ -39,14 +39,14 @@ Faultloggerd意在为开发者在开发测试过程中遇到的崩溃或卡死 **表1** Faultloggerd模块应用场景 -| 场景描述 | 使用工具 | 使用方式 | +| 场景描述 | 使用工具 | 使用方式 | | -------- | -------- | -------- | -| 了解函数的调用顺序 | DumpCatcher API | 参见:[使用DumpCatcher获取调用栈](#使用dumpcatcher获取调用栈) | -| 应用卡死/CPU占用高 | ProcessDump | 参见:[使用ProcessDump获取调用栈](#使用processdump获取调用栈) | -| 进程未处理信号崩溃 | 崩溃日志和addr2line工具 | 参见:[基于崩溃日志对问题进行定位](#基于崩溃日志对问题进行定位) | +| 了解函数的调用顺序 | DumpCatcher API | 参见:[使用DumpCatcher接口获取调用栈](#使用dumpcatcher接口获取调用栈) | +| 应用卡死/CPU占用高 | DumpCatcher Command Tool | 参见:[使用DumpCatcher命令获取调用栈](#使用dumpcatcher命令获取调用栈) | +| 崩溃问题定位 | 崩溃日志和addr2line工具 | 参见:[基于崩溃日志定位问题](#基于崩溃日志定位问题) | -## 使用DumpCatcher获取调用栈 +## 使用DumpCatcher接口获取调用栈 ### 接口说明 @@ -55,57 +55,70 @@ DumpCatcher可以抓取OpenHarmony指定进程(线程)的调用栈。 **表2** DumpCatcher接口说明 -| 类 | 方法 | 描述 | +| 类 | 方法 | 描述 | | -------- | -------- | -------- | -| DfxDumpCatcher | bool DumpCatch(const int pid, const int tid, std::string& msg) |   接口返回值:
- true:回栈成功,回栈信息存储在msg字符串对象中;
- false:回栈失败。
  输入参数:
- pid:目标进程号;
- tid:目标线程号,如果需要回栈进程中的所有线程,则tid设定为0;
  输出参数:
- msg:如果回栈成功,则通过msg返回调用栈信息。 | +| DfxDumpCatcher | bool DumpCatch(const int pid, const int tid, std::string& msg) | 接口返回值:
- true:回栈成功,回栈信息存储在msg字符串对象中;
- false:回栈失败。
输入参数:
- pid:目标进程号;
- tid:目标线程号,如果需要回栈进程中的所有线程,则tid设定为0;
输出参数:
- msg:如果回栈成功,则通过msg返回调用栈信息。 | +| DfxDumpCatcher | bool DumpCatchMix(const int pid, const int tid, std::string& msg) | 接口返回值:
- true:回栈成功,回栈信息存储在msg字符串对象中;
- false:回栈失败。
输入参数:
- pid:目标进程号;
- tid:目标线程号,如果需要回栈进程中的所有线程,则tid设定为0;
输出参数:
- msg:如果回栈成功,则通过msg返回混合栈信息。 | +| DfxDumpCatcher | bool DumpCatchFd(const int pid, const int tid, std::string& msg, int fd) | 接口返回值:
- true:回栈成功,回栈信息存储在msg字符串对象中;
- false:回栈失败。
输入参数:
- pid:目标进程号;
- tid:目标线程号,如果需要回栈进程中的所有线程,则tid设定为0;
- fd:指定写入的文件句柄号;
输出参数:
- msg:如果回栈成功,则通过msg返回调用栈信息。 | +| DfxDumpCatcher | bool DumpCatchMultiPid(const std::vector\ pidV, std::string& msg) | 接口返回值:
- true:回栈成功,回栈信息存储在msg字符串对象中;
- false:回栈失败。
输入参数:
- pidV:目标进程号列表;
输出参数:
- msg:如果回栈成功,则通过msg返回调用栈信息。 | > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> 当调用此接口的进程id与目标pid不一致时需要调用者是管理员(system,root)用户。当抓取非本用户组进程调用栈时还需具备读取对方/proc/pid/maps及ptrace到对方进程的权限。 +> 当调用此接口的进程id与目标pid不一致时需要调用者是管理员(system,root)用户。 ### 开发实例 -系统应用开发者可以用DumpCatcher在自己的应用中获取指定进程(线程)的调用栈。下文以dumpcatcherdemo模块使用DumpCatcher接口获取调用栈作为实例进行讲解。 +系统应用开发者可以用DumpCatcher在自己的应用中获取指定进程(线程)的调用栈。下文以dumpcatcherdemo模块使用DumpCatcher基础接口获取调用栈作为实例进行讲解。 1. 编译构建文件添加dumpcatcher依赖:以/base/hiviewdfx/faultloggerd/example/BUILD.gn为例,在include_dirs中添加DfxDumpCatcher头文件路径,并在deps中添加“//base/hiviewdfx/faultloggerd/interfaces/innerkits/dump_catcher:lib_dfx_dump_catcher”模块依赖。 - + ``` import("//base/hiviewdfx/faultloggerd/faultloggerd.gni") import("//build/ohos.gni") - + config("dumpcatcherdemo_config") { visibility = [ ":*" ] - + include_dirs = [ ".", "//utils/native/base/include", "//base/hiviewdfx/faultloggerd/interfaces/innerkits/dump_catcher/include/", # 添加dumpcatcher头文件路径 ] } - - ohos_executable("dumpcatcherdemo") { sources = [ "dump_catcher_demo.cpp" ] configs = [ ":dumpcatcherdemo_config" ] deps = [ "//base/hiviewdfx/faultloggerd/interfaces/innerkits/dump_catcher:lib_dfx_dump_catcher", # 添加dumpcathcer模块依赖 "//utils/native/base:utils", ] external_deps = [ "hilog_native:libhilog" ] install_enable = true part_name = "faultloggerd" subsystem_name = "hiviewdfx" + + ohos_executable("dumpcatcherdemo") { + sources = [ "dump_catcher_demo.cpp" ] + configs = [ ":dumpcatcherdemo_config" ] + deps = [ + "//base/hiviewdfx/faultloggerd/interfaces/innerkits/dump_catcher:lib_dfx_dump_catcher", # 添加dumpcathcer模块依赖 + "//utils/native/base:utils", + ] + external_deps = [ "hilog_native:libhilog" ] + install_enable = true + part_name = "faultloggerd" + subsystem_name = "hiviewdfx" } ``` 2. 头文件定义用到的函数:以/base/hiviewdfx/faultloggerd/example/dump_catcher_demo.h为例,本样例代码中,通过调用栈深度测试的测试函数来构造一个指定深度的调用栈。 - + ``` #ifndef DUMP_CATCHER_DEMO_H #define DUMP_CATCHER_DEMO_H - + #include - + #define NOINLINE __attribute__((noinline)) - + // 定义该宏函数用于自动生成函数调用链 #define GEN_TEST_FUNCTION(FuncNumA, FuncNumB) \ __attribute__((noinline)) int TestFunc##FuncNumA() \ { \ return TestFunc##FuncNumB(); \ } - + // 调用栈深度测试的测试函数 int TestFunc0(void); int TestFunc1(void); @@ -118,22 +131,22 @@ DumpCatcher可以抓取OpenHarmony指定进程(线程)的调用栈。 int TestFunc8(void); int TestFunc9(void); int TestFunc10(void); - + #endif // DUMP_CATCHER_DEMO_H ``` 3. 在源文件中调用DumpCatch接口:以/base/hiviewdfx/faultloggerd/example/dump_catcher_demo.cpp为例,引用dfx_dump_catcher.h头文件,声明DfxDumpCatcher对象,通过宏函数构造函数调用链,并最后调用DumpCatch接口方法,传入需要抓取调用栈的进程号、线程号。 - + ``` #include "dump_catcher_demo.h" - + #include #include #include // dfx_dump_catcher.h头文件引入 #include "dfx_dump_catcher.h" using namespace std; - + NOINLINE int TestFunc10(void) { OHOS::HiviewDFX::DfxDumpCatcher dumplog; @@ -144,7 +157,7 @@ DumpCatcher可以抓取OpenHarmony指定进程(线程)的调用栈。 } return 0; } - + // 通过宏函数自动生成函数调用链 GEN_TEST_FUNCTION(0, 1) GEN_TEST_FUNCTION(1, 2) @@ -156,7 +169,7 @@ DumpCatcher可以抓取OpenHarmony指定进程(线程)的调用栈。 GEN_TEST_FUNCTION(7, 8) GEN_TEST_FUNCTION(8, 9) GEN_TEST_FUNCTION(9, 10) - + int main(int argc, char *argv[]) { TestFunc0(); @@ -165,55 +178,57 @@ DumpCatcher可以抓取OpenHarmony指定进程(线程)的调用栈。 ``` -## 使用ProcessDump获取调用栈 +## 使用DumpCatcher命令获取调用栈 ### 工具说明 -ProcessDump是一个抓取调用栈的命令行工具,在OpenHarmony系统中可直接使用,该工具通过-p、-t参数指定进程和线程,命令执行后在命令行窗口打印指定进程的线程栈信息。 +DumpCatcher Command Tool是一个抓取调用栈的命令行工具,在OpenHarmony系统中可直接使用,该工具通过-p、-t参数指定进程和线程,命令执行后在命令行窗口打印指定进程的线程栈信息。还可通过添加-m参数来抓取应用进程的JS Native混合栈。 - **表3** ProcessDump命令行工具使用说明 + **表3** DumpCatcher Command Tool使用说明 -| 工具名称 | 命令行工具路径 | 执行命令 | 描述 | +| 工具名称 | 命令行工具路径 | 执行命令 | 描述 | | -------- | -------- | -------- | -------- | -| processdump | /system/bin | - processdump -p [pid]
- processdump -p [pid] -t [tid] | **参数说明:**
- -p [pid]:打印指定进程下面的所有线程栈信息。
- -p [pid] -t [tid]:打印指定进程下面的指定线程信息。
**返回值说明:**
如果栈信息解析成功,则将信息显示到标准输出;失败则打印错误信息。 | - - -> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** -> 此工具需要在root下使用,或调用者有权限ptrace到目标进程,并读取目标进程的smaps。 +| dumpcatcher | /system/bin | - dumpcatcher -p [pid]
- dumpcatcher -p [pid] -t [tid]
- dumpcatcher -m -p [pid]
- dumpcatcher -m -p [pid] -t [tid]
| **参数说明:**
- -p [pid]:打印指定进程下面的所有线程栈信息。
- -p [pid] -t [tid]:打印指定进程下面的指定线程信息。
- -m -p [pid]:打印指定进程下面的所有线程混合栈信息。
- -m -p [pid] -t [tid]:打印指定进程下面的指定线程混合栈信息。
**返回值说明:**
如果栈信息解析成功,则将信息显示到标准输出;失败则打印错误信息。 | ### 使用实例 -通过processdump命令行工具打印hiview进程的调用栈。 +通过dumpcatcher命令打印hiview进程的调用栈。 + - ``` -# ps -A | grep hiview - 114 ? 00:00:00 hiview -# processdump -p 114 -t 114 -Tid:114, Name:hiview -#00 pc 0000000000089824(00000000b6f44824) /system/lib/ld-musl-arm.so.1(ioctl+68) -#01 pc 000000000002a709(00000000b6c56709) /system/lib/libipc_core.z.so(_ZN4OHOS15BinderConnector11WriteBinderEmPv+16) -#02 pc 000000000002ba75(00000000b6c57a75) /system/lib/libipc_core.z.so(_ZN4OHOS13BinderInvoker18TransactWithDriverEb+224) -#03 pc 000000000002bb37(00000000b6c57b37) /system/lib/libipc_core.z.so(_ZN4OHOS13BinderInvoker13StartWorkLoopEv+22) -#04 pc 000000000002c211(00000000b6c58211) /system/lib/libipc_core.z.so(_ZN4OHOS13BinderInvoker10JoinThreadEb+36) -#05 pc 0000000000038d07(00000000004bcd07) /system/bin/hiview(_ZNSt3__h6vectorINS_9sub_matchINS_11__wrap_iterIPKcEEEENS_9allocatorIS6_EEE8__appendEj+596) -#06 pc 0000000000028655(00000000004ac655) /system/bin/hiview -#07 pc 00000000000c2b08(00000000b6f7db08) /system/lib/ld-musl-arm.so.1(__libc_start_main+116) -#08 pc 00000000000285f4(00000000004ac5f4) /system/bin/hiview -#09 pc 0000000000028580(00000000004ac580) /system/bin/hiview +# ps -ef |grep hiview +hiview 240 1 0 17:01:49 ? 00:00:14 hiview +root 1822 1560 7 20:56:36 pts/0 00:00:00 grep hiview +# dumpcatcher -p 240 -t 240 +Result: 0 ( no error ) +Timestamp:2017-08-05 20:56:43.000 +Pid:240 +Uid:1201 +Process name:/system/bin/hiview +Tid:240, Name:hiview +#00 pc 00098f8c /system/lib/ld-musl-arm.so.1(ioctl+68) +#01 pc 0000e2a1 /system/lib/chipset-pub-sdk/libipc_single.z.so +#02 pc 0000ed59 /system/lib/chipset-pub-sdk/libipc_single.z.so +#03 pc 0000ee1f /system/lib/chipset-pub-sdk/libipc_single.z.so +#04 pc 0000f745 /system/lib/chipset-pub-sdk/libipc_single.z.so +#05 pc 00037577 /system/bin/hiview +#06 pc 00025973 /system/bin/hiview +#07 pc 000db210 /system/lib/ld-musl-arm.so.1 +#08 pc 000258d8 /system/bin/hiview +#09 pc 0002587c /system/bin/hiview ``` -## 基于崩溃日志对问题进行定位 +## 基于崩溃日志定位问题 开发者可以通过faultloggerd生成的崩溃堆栈日志进行问题定位。本章节将主要介绍如何利用addr2line工具进行崩溃问题定位。 1. 程序自崩溃或构造崩溃。 例如将如下代码植入自己的代码中,调用触发一个无效内存访问故障(SIGSEGV)。 - + ``` NOINLINE int TriggerSegmentFaultException() { @@ -226,42 +241,43 @@ Tid:114, Name:hiview ``` 2. 获取崩溃函数调用栈日志。 - 因为存在未处理的异常,进程会在 /data/log/faultlog/temp路径下生成临时的日志文件,其命名规则为: + 因为存在未处理的异常,进程会在/data/log/faultlog/temp路径下生成临时的日志文件,其命名规则为: + - ``` cppcrash-pid-time ``` 获取其生成的调用栈如下: - + ``` + Timestamp:2017-08-05 17:35:03.000 Pid:816 Uid:0 - Process name:./crasher + Process name:./crasher_c Reason:Signal:SIGSEGV(SEGV_ACCERR)@0x0042d33d Fault thread Info: Tid:816, Name:crasher + #00 pc 0000332c /data/crasher(TriggerSegmentFaultException+15)(8bc37ceb8d6169e919d178fdc7f5449e) + #01 pc 000035c7 /data/crasher(ParseAndDoCrash+277)(8bc37ceb8d6169e919d178fdc7f5449e) + #02 pc 00003689 /data/crasher(main+39)(8bc37ceb8d6169e919d178fdc7f5449e) + #03 pc 000c3b08 /system/lib/ld-musl-arm.so.1(__libc_start_main+116) + #04 pc 000032f8 /data/crasher(_start_c+112)(8bc37ceb8d6169e919d178fdc7f5449e) + #05 pc 00003284 /data/crasher(_start+32)(8bc37ceb8d6169e919d178fdc7f5449e) + Registers: r0:0042d33d r1:0000000b r2:1725d4c4 r3:b6f9fa84 r4:bec97e69 r5:b6fc0268 r6:0042d661 r7:bec97d60 r8:00000000 r9:00000000 r10:00000000 fp:bec97d20 ip:00000020 sp:bec97cd0 lr:b6f9fae4 pc:0042d32c - - #00 pc 000000000000332c(000000000042d32c) /data/crasher(TriggerSegmentFaultException+15) - #01 pc 00000000000035c7(000000000042d5c7) /data/crasher(ParseAndDoCrash+277) - #02 pc 0000000000003689(000000000042d689) /data/crasher(main+39) - #03 pc 00000000000c3b08(00000000b6fbbb08) /system/lib/ld-musl-arm.so.1(__libc_start_main+116) - #04 pc 00000000000032f8(000000000042d2f8) /data/crasher(_start_c+112) - #05 pc 0000000000003284(000000000042d284) /data/crasher(_start+32) ``` 3. 利用addr2line工具进行调用栈分析。 使用addr2line工具根据偏移地址解析行号: - + ``` - root:~/OpenHarmony/out/hi3516dv300/exe.unstripped/hiviewdfx/faultloggerd$ addr2line -e crasher 000332c + root:~/OpenHarmony/out/hi3516dv300/exe.unstripped/hiviewdfx/faultloggerd$ addr2line -e crasher 0000332c base/hiviewdfx/faultloggerd/tools/crasher/dfx_crasher.c:57 ``` diff --git a/zh-cn/device-dev/subsystems/subsys-dfx-hicollie.md b/zh-cn/device-dev/subsystems/subsys-dfx-hicollie.md index fa0a13a42b766da47c2071970e7613576099be21..b3c51302cea94d9360ec3877828091e1059790fc 100644 --- a/zh-cn/device-dev/subsystems/subsys-dfx-hicollie.md +++ b/zh-cn/device-dev/subsystems/subsys-dfx-hicollie.md @@ -8,45 +8,28 @@ HiCollie提供了软件看门狗功能。针对系统服务死锁、应用主线 ## 接口说明 - **表1** C++接口功能描述表 + **表1** XCollieChecker接口 -| 所属类 | 接口定义 | 描述 | -| -------- | -------- | -------- | -| XCollieChecker类接口 | virtual void CheckBlock() | 接口功能:卡死检测回调函数。
输入参数:无。
输出参数:无。
返回值:无。 | -| XCollieChecker类接口 | virtual void CheckThreadBlock() | 接口功能:线程卡死检测回调函数。
输入参数:无。
输出参数:无。
返回值:无。 | -| XCollie类接口 | void RegisterXCollieChecker(const sptr&lt;XCollieChecker&gt; &checker, unsigned int type) | 接口功能:线程卡死检测回调函数注册。
输入参数:
- checker:XCollieChecker实例指针。
- type:卡死检测类型,取值设置为XCOLLIE_THREAD。
输出参数:无。
返回值:无。 | -| XCollie类接口 | int SetTimer(const std::string &name, unsigned int timeout, std::function&lt;void (void _)&gt; func, void _arg, unsigned int flag) | 接口功能:添加定时器。
输入参数:
- name:定时器名称。
- timeout:超时时间,单位为秒。
- func:超时回调函数。
- arg:超时回调函数参数指针。
- flag:定时器操作类型。
  XCOLLIE_FLAG_DEFAULT  // 其他三个选项功能之和
  XCOLLIE_FLAG_NOOP // 仅调用超时回调函数
  XCOLLIE_FLAG_LOG //  生成超时故障日志
  XCOLLIE_FLAG_RECOVERY //  进程退出
输出参数:无。
返回值:成功返回定时器标识,失败返回-1。 | -| XCollie类接口 | bool UpdateTimer(int id, unsigned int timeout) | 接口功能:更新定时器。
输入参数:
- id:定时器标识。
- timeout:超时时间,单位为秒。
输出参数:无。
返回值:成功返回true,失败返回false。 | -| XCollie类接口 | void CancelTimer(int id) | 接口功能:取消定时器。
输入参数:定时器标识。
输出参数:无。
返回值:无。 | +| 接口名称 | 描述 | +| -------- | -------- | +| virtual void CheckBlock() | 接口功能:卡死检测回调函数。
输入参数:无。
输出参数:无。
返回值:无。 | +| virtual void CheckThreadBlock() | 接口功能:线程卡死检测回调函数。
输入参数:无。
输出参数:无。
返回值:无。 | -## 效果 + **表2** XCollie接口 -日志打印: - - -``` -timeout: TimeoutTimer start at 1611040305 to check 1s ago - -----------StacktraceCatcher CurrentTime:2021-01-19 15:11:45 Unexecuted(-1)(LogType:Stacktrace Pid:27689 Process:XCollieTimeoutModuleTest)---------- - - ------ pid 27689 at 2021-01-19 15:11:45 ----- -Cmd line: ./XCollieTimeoutModuleTest -ABI: 'arm64' - -"XCollieTimeoutM" sysTid=27689 - #01 pc 00000000000174cc /data/test/XCollieTimeoutModuleTest -``` +| 接口名称 | 描述 | +| -------- | -------- | +| void RegisterXCollieChecker(const sptr<XCollieChecker> &checker, unsigned int type) | 接口功能:线程卡死检测回调函数注册。
输入参数:
- **checker**:XCollieChecker实例指针。
- **type**:卡死检测类型,取值设置为**XCOLLIE_THREAD**。
输出参数:无。
返回值:无。 | +| int SetTimer(const std::string &name, unsigned int timeout, std::function<void(void*)> func, void *arg, unsigned int flag) | 接口功能:添加定时器。
输入参数:
- **name**:定时器名称。
- **timeout**:超时时间,单位为秒。
- **func**:超时回调函数。
- **arg**:超时回调函数参数指针。
- **flag**:定时器操作类型。
XCOLLIE_FLAG_DEFAULT:其他三个选项功能之和
XCOLLIE_FLAG_NOOP:仅调用超时回调函数
XCOLLIE_FLAG_LOG:生成超时故障日志
XCOLLIE_FLAG_RECOVERY:进程退出
输出参数:无。
返回值:成功返回定时器标识,失败返回 **-1**。 | +| bool UpdateTimer(int id, unsigned int timeout) | 接口功能:更新定时器。
输入参数:
- **id**:定时器标识。
- **timeout**:超时时间,单位为秒。
输出参数:无。
返回值:成功返回**true**,失败返回**false**。 | +| void CancelTimer(int id) | 接口功能:取消定时器。
输入参数:
- **id**:定时器标识。
输出参数:无。
返回值:无。 | ## 开发实例 -### C++接口开发实例 - - -### 线程卡死监控 +### 线程卡死监控开发实例 线程卡死监控功能需要开发者实现两个卡死检测回调函数,XCollieChecker类的CheckBlock和CheckThreadBlock接口函数。实现了该回调函数之后,开发者还需要通过XCollie类的RegisterXCollieChecker函数,将该回调函数的类实例成功注册。卡死监控线程会定时执行全部已成功注册的回调函数,检查线程逻辑完成标志位,判定已经成功注册的线程逻辑是否被卡死。 @@ -59,7 +42,7 @@ ABI: 'arm64' 在业务代码中使用: - + ``` void MyXCollieChecker::CheckLock() { @@ -78,13 +61,13 @@ ABI: 'arm64' ``` 2. 编译设置,在BUILD.gn里增加子系统SDK依赖: - + ``` external_deps = [ "hiviewdfx:libxcollie" ] ``` -### 超时监控 +### 超时监控开发实例 单个进程通过SetTimer接口函数添加定时器最多可以设置128个,超过上限则添加定时器操作会失败。 @@ -96,7 +79,7 @@ ABI: 'arm64' ``` 在业务代码中使用(添加/更新/取消): - + ``` std::function callback = [](void *args) { @@ -112,7 +95,7 @@ ABI: 'arm64' ``` 2. 编译设置,在BUILD.gn里增加子系统SDK依赖: - + ``` external_deps = [ "hiviewdfx:libxcollie" ] ``` diff --git a/zh-cn/device-dev/subsystems/subsys-dfx-hidumper.md b/zh-cn/device-dev/subsystems/subsys-dfx-hidumper.md index 5128f267e6f92b73f2dd768482a36f6855ee62ef..7112238681fcb2a2ac40c4e8892f5f824621eb22 100644 --- a/zh-cn/device-dev/subsystems/subsys-dfx-hidumper.md +++ b/zh-cn/device-dev/subsystems/subsys-dfx-hidumper.md @@ -1,14 +1,11 @@ -# HiDumper开发指导 +# HiDumper概述 -## 概述 - - -### 功能简介 +## 功能简介 HiDumper是OpenHarmony为开发、测试人员、IDE工具提供的系统信息获取工具,帮助开发者分析、定位问题。本章节内容适用于标准系统。 -### 源码目录说明 +## 源码目录说明 ``` @@ -34,10 +31,10 @@ HiDumper是OpenHarmony为开发、测试人员、IDE工具提供的系统信息 ``` -## 使用指导 +# HiDumper使用指导 -### 命令参数说明 +## 命令参数说明 **表1** HiDumper命令参数说明 @@ -63,7 +60,7 @@ HiDumper是OpenHarmony为开发、测试人员、IDE工具提供的系统信息 | --zip | 将导出信息压缩到固定文件夹下。 | -### 使用实例 +## 使用实例 HiDumper可以为开发者导出系统当前基本信息,通过这些基本信息可以定位分析问题。给子服务和元能力传递复杂参数时,参数需要加双引号。 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 285a917f36d6e4491b333cb619c81e572acb3497..175b49816ea59a74ed28651cdca2b607fc8f1c7d 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.json文件中[配置yaml文件的路径](subsys-dfx-hisysevent-logging-config.md#配置yaml文件路径)。OpenHarmony编译框架在编译过程中则会通过python编译脚本解析校验bundle.json文件指定的所有yaml文件。在解析校验之后,编译框架会将这些yaml文件中配置的信息汇总转换成名为hisysevent.def的json文件。最后,将此json文件打包到系统指定路径下,用作HiSysEvent事件落盘的判断依据。 +组件若有HiSysEvent事件的打点需求,则需要先定义yaml文件并在bundle.json文件中[配置yaml文件的路径](subsys-dfx-hisysevent-logging-config.md#验证yaml文件)。OpenHarmony编译框架在编译过程中则会通过python编译脚本解析校验bundle.json文件指定的所有yaml文件。在解析校验之后,编译框架会将这些yaml文件中配置的信息汇总转换成名为hisysevent.def的json文件。最后,将此json文件打包到系统指定路径下,用作HiSysEvent事件落盘的判断依据。 ### 基本概念 在配置HiSysEvent打点之前,开发者应了解以下基本概念: -- 事件领域 用于标识事件所属的领域,在yaml文件中以domain为键值指定,可参考yaml文件样例中的[domain](subsys-dfx-hisysevent-logging-config.md#编写样例)。 +- 事件领域 用于标识事件所属的领域,在yaml文件中以domain为键值指定,可参考yaml文件样例中的[domain](subsys-dfx-hisysevent-logging-config.md#编写yaml文件)。 -- 事件名称 用于指定事件领域包含的所有事件,可参考yaml文件样例中的[EVENT_NAMEA/EVENT_NAMEB](subsys-dfx-hisysevent-logging-config.md#编写样例)。 +- 事件名称 用于指定事件领域包含的所有事件,可参考yaml文件样例中的[EVENT_NAMEA/EVENT_NAMEB](subsys-dfx-hisysevent-logging-config.md#编写yaml文件)。 -- 参数 用于定义某个事件名称包含的所有键值,可参考yaml文件样例中的[__BASE/NAME1/NAME2](subsys-dfx-hisysevent-logging-config.md#编写样例)。 +- 参数 用于定义某个事件名称包含的所有键值,可参考yaml文件样例中的[__BASE/NAME1/NAME2](subsys-dfx-hisysevent-logging-config.md#编写yaml文件)。 ### 约束与限制 @@ -47,10 +47,13 @@ | desc | 字段作用:必选字段,用来对该参数进行描述。
定义规则:
- 至少包含3个字符,最多包含128个字符,字符范围[a-zA-Z0-9 _] | -## 编写yaml文件 +## 开发步骤 -### 编写规则 +### 编写yaml文件 + + +**编写规则** - 事件领域命名规则: - 字母开头,且只能由大写字母/数字/下划线组成; @@ -63,11 +66,11 @@ - 参数命名规则: - 字母开头,且只能由大写字母/数字/下划线组成; - - 字符串长度取值范围1~32; + - 字符串长度取值范围1~48; - 单个事件名称内包含的参数的个数不能超过128个。 -### 编写样例 +**编写样例** - yaml文件样例指定的事件领域名称为MODULEA,该事件领域包含两个事件,名称分别是EVENT_NAMEA和EVENT_NAMEB。 @@ -95,10 +98,10 @@ ``` -## 验证yaml文件 +### 验证yaml文件 -### 配置yaml文件路径 +**配置yaml文件路径** 在bundle.json文件中通过hisysevent_config属性完成yaml文件的路径指定: @@ -149,7 +152,7 @@ > yaml文件可根据实际需求置于组件工程的任意目录下,只要在bundle.json文件指定即可。 -### 编译yaml文件 +**编译yaml文件** - 全量编译: - 全量编译整个系统,会将所有组件配置的yaml文件中的配置进行汇总,正常完成系统编译后,指定目录下就会生成hisysevent.def文件。 diff --git a/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-overview.md b/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-overview.md index 65f825ea1bacf5f9c8bdf59897e74a2023ba4852..ce9d2adb2545c64a6ce3437208bf57601f3e10bb 100644 --- a/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-overview.md +++ b/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-overview.md @@ -1,7 +1,7 @@ # HiSysEvent概述 -## 概述 +## 简介 HiSysEvent是面向OpenHarmony系统开发者提供的系统打点功能,通过在关键路径埋点来记录系统在运行过程中的重要信息,辅助开发者定位问题,此外还支持开发者将打点数据上传到云进行大数据质量度量。 diff --git a/zh-cn/device-dev/subsystems/subsys-dfx-hitracechain.md b/zh-cn/device-dev/subsystems/subsys-dfx-hitracechain.md index 1c2cdf491de1474253287ada866d2de343d83553..1941e1a7db0f0bc7c091fb3a08703f41310dc6fd 100644 --- a/zh-cn/device-dev/subsystems/subsys-dfx-hitracechain.md +++ b/zh-cn/device-dev/subsystems/subsys-dfx-hitracechain.md @@ -51,61 +51,93 @@ HiTraceChain实现在C层,主要原理是在一次业务调用流程中,利 | | **C++** | **C** | | -------- | -------- | -------- | | **类** | **函数** | **函数** | -| HiTraceChain | HiTraceId Begin(const std::string& name, int flags) | HiTraceIdStruct HiTraceChainBegin(const char\* name, int flags) | -| | void End(const HiTraceId& id) | void HiTraceChainEnd(const HiTraceIdStruct\* pId) | -| | HiTraceId GetId(); | HiTraceIdStruct HiTraceChainGetId() | -| | void SetId(const HiTraceId& id) | void HiTraceChainSetId(const HiTraceIdStruct\* pId) | -| | void ClearId() | void HiTraceChainClearId() | -| | HiTraceId CreateSpan() | HiTraceIdStruct HiTraceChainCreateSpan() | -| | void Tracepoint(HiTraceTracepointType type, const HiTraceId& id, const char\* fmt, ...) | void HiTraceChainTracepoint(HiTraceTracepointType type, const HiTraceIdStruct_ pId, const char_ fmt, ...) | -| | void Tracepoint(HiTraceCommunicationMode mode, HiTraceTracepointType type, const HiTraceId& id, const char\* fmt, ...) | void HiTraceChainTracepointEx(HiTraceCommunicationMode mode, HiTraceTracepointType type, const HiTraceIdStruct_ pId, const char_ fmt, ...) | -| HiTraceId | HiTraceId(); | void HiTraceChainInitId(HiTraceIdStruct\* pId) | -| | HiTraceId(const uint8_t\* pIdArray, int len) | HiTraceIdStruct HiTraceChainBytesToId(const uint8_t\* pIdArray, int len) | -| | bool IsValid() | int HiTraceChainIsValid(const HiTraceIdStruct\* pId) | -| | bool IsFlagEnabled(HiTraceFlag flag) | int HiTraceChainIsFlagEnabled(const HiTraceIdStruct\* pId, HiTraceFlag flag) | -| | void EnableFlag(HiTraceFlag flag) | void HiTraceChainEnableFlag(HiTraceIdStruct\* pId, HiTraceFlag flag) | -| | int GetFlags() | int HiTraceChainGetFlags(const HiTraceIdStruct\* pId) | -| | void SetFlags(int flags) | void HiTraceChainSetFlags(HiTraceIdStruct\* pId, int flags) | -| | uint64_t GetChainId() | uint64_t HiTraceChainGetChainId(const HiTraceIdStruct\* pId) | -| | void SetChainId(uint64_t chainId) | void HiTraceChainSetChainId(HiTraceIdStruct\* pId, uint64_t chainId) | -| | uint64_t GetSpanId() | uint64_t HiTraceChainGetSpanId(const HiTraceIdStruct\* pId) | -| | void SetSpanId(uint64_t spanId) | void HiTraceChainSetSpanId(HiTraceIdStruct\* pId, uint64_t spanId) | -| | uint64_t GetParentSpanId() | uint64_t HiTraceChainGetParentSpanId(const HiTraceIdStruct\* pId) | -| | void SetParentSpanId(uint64_t parentSpanId) | void HiTraceChainSetParentSpanId(HiTraceIdStruct\* pId, uint64_t parentSpanId) | -| | int ToBytes(uint8_t\* pIdArray, int len) | int HiTraceChainIdToBytes(const HiTraceIdStruct_ pId, uint8_t_ pIdArray, int len) | +| HiTraceChain | HiTraceId Begin(const std::string& name, int flags) | HiTraceIdStruct HiTraceChainBegin(const char* name, int flags) | +| | void End(const HiTraceId& id) | void HiTraceChainEnd(const HiTraceIdStruct* pId) | +| | HiTraceId GetId(); | HiTraceIdStruct HiTraceChainGetId() | +| | void SetId(const HiTraceId& id) | void HiTraceChainSetId(const HiTraceIdStruct* pId) | +| | void ClearId() | void HiTraceChainClearId() | +| | HiTraceId CreateSpan() | HiTraceIdStruct HiTraceChainCreateSpan() | +| | void Tracepoint(HiTraceTracepointType type, const HiTraceId& id, const char* fmt, ...) | void HiTraceChainTracepoint(HiTraceTracepointType type, const HiTraceIdStruct* pId, const char* fmt, ...) | +| | void Tracepoint(HiTraceCommunicationMode mode, HiTraceTracepointType type, const HiTraceId& id, const char* fmt, ...) | void HiTraceChainTracepointEx(HiTraceCommunicationMode mode, HiTraceTracepointType type, const HiTraceIdStruct* pId, const char* fmt, ...) | +| HiTraceId | HiTraceId(); | void HiTraceChainInitId(HiTraceIdStruct* pId) | +| | HiTraceId(const uint8_t* pIdArray, int len) | HiTraceIdStruct HiTraceChainBytesToId(const uint8_t* pIdArray, int len) | +| | bool IsValid() | int HiTraceChainIsValid(const HiTraceIdStruct* pId) | +| | bool IsFlagEnabled(HiTraceFlag flag) | int HiTraceChainIsFlagEnabled(const HiTraceIdStruct* pId, HiTraceFlag flag) | +| | void EnableFlag(HiTraceFlag flag) | void HiTraceChainEnableFlag(HiTraceIdStruct* pId, HiTraceFlag flag) | +| | int GetFlags() | int HiTraceChainGetFlags(const HiTraceIdStruct* pId) | +| | void SetFlags(int flags) | void HiTraceChainSetFlags(HiTraceIdStruct* pId, int flags) | +| | uint64_t GetChainId() | uint64_t HiTraceChainGetChainId(const HiTraceIdStruct* pId) | +| | void SetChainId(uint64_t chainId) | void HiTraceChainSetChainId(HiTraceIdStruct* pId, uint64_t chainId) | +| | uint64_t GetSpanId() | uint64_t HiTraceChainGetSpanId(const HiTraceIdStruct* pId) | +| | void SetSpanId(uint64_t spanId) | void HiTraceChainSetSpanId(HiTraceIdStruct* pId, uint64_t spanId) | +| | uint64_t GetParentSpanId() | uint64_t HiTraceChainGetParentSpanId(const HiTraceIdStruct* pId) | +| | void SetParentSpanId(uint64_t parentSpanId) | void HiTraceChainSetParentSpanId(HiTraceIdStruct* pId, uint64_t parentSpanId) | +| | int ToBytes(uint8_t* pIdArray, int len) | int HiTraceChainIdToBytes(const HiTraceIdStruct_ pId, uint8_t* pIdArray, int len) | ### 接口功能参数 - **表2** C++接口说明函数参数和功能 + **表2** 跟踪标志组合类型枚举 + +| **名称** | **值** | **说明** | +| -------- | -------- | -------- | +| HITRACE_FLAG_DEFAULT | 0 | 缺省标志。 | +| HITRACE_FLAG_INCLUDE_ASYNC | 1 | 异步调用标志。启动跟踪时,缺省只跟踪同步调用。设置该标志,同时跟踪同步、异步调用。 | +| HITRACE_FLAG_DONOT_CREATE_SPAN | 1 << 1 | 无分支标志。启动跟踪时,在同步、异步调用时缺省自动创建分支信息。设置该标志,指示不创建分支。 | +| HITRACE_FLAG_TP_INFO | 1 << 2 | 埋点标志。启动跟踪式时,缺省不进行埋点。调试场景下设置该标志,在同步、异步调用的收发侧自动埋点,输出埋点信息和时间戳。收发埋点按照client、server分为client send(CS)、server receive(SR)、server send(SS)、client receive(CR)四类信息。一次同步调用输出CS/SR/SS/CR,一次异步调用输出CS/SR/SS三个埋点信息。 | +| HITRACE_FLAG_NO_BE_INFO | 1 << 3 | 无起始结束标志。启动跟踪时,缺省打印启动及结束跟踪信息。设置该标志,指示不打印启动及结束跟踪信息。 | +| HITRACE_FLAG_DONOT_ENABLE_LOG | 1 << 4 | 日志关联标志。设置该标志,指示隐藏日志中的跟踪信息。 | +| HITRACE_FLAG_FAULT_TRIGGER | 1 << 5 | 故障触发标志。预置标志,暂时没有作用。 | +| HITRACE_FLAG_D2D_TP_INFO | 1 << 6 | 设备间埋点标志。TP_INFO的一个子集,设置该标志,只进行设备间的调用埋点。 | + + **表3** 跟踪埋点类型枚举 + +| **名称** | **值** | **说明** | +| -------- | -------- | -------- | +| HITRACE_TP_CS | 0 | 客户端发送类型,标识client侧的发送埋点。 | +| HITRACE_TP_CR | 1 | 客户端接收类型,标识client侧的接收埋点。 | +| HITRACE_TP_SS | 2 | 服务端发送类型,标识server侧的发送埋点。 | +| HITRACE_TP_SR | 3 | 服务端接收类型,标识server侧的接收埋点。 | +| HITRACE_TP_GENERAL | 4 | 一般类型,标识CS、CR、SS、SR四种场景之外的埋点。| + + **表4** 跟踪通信类型枚举 + +| **名称** | **值** | **说明** | +| -------- | -------- | -------- | +| HITRACE_CM_DEFAULT | 0 | 缺省通信类型 | +| HITRACE_CM_THREAD | 1 | 线程间通信类型 | +| HITRACE_CM_PROCESS | 2 | 进程间通信类型 | +| HITRACE_CM_DEVICE | 3 | 设备间通信类型 | + + **表5** C++接口说明函数参数和功能 | **类** | **方法** | **描述** | | -------- | -------- | -------- | -| HiTraceChain | HiTraceId Begin(const std::string& name, int flags) | 功能:启动HiTraceChain跟踪、生成HiTraceId对象并设置到当前线程TLS中。
输入参数:
- name:业务流程名称。
- flags:跟踪指示位,可以组合使用,具体含义为:
  - HITRACE_FLAG_INCLUDE_ASYNC:同时跟踪同步调用和异步调用,缺省只跟踪同步调用。
  - HITRACE_FLAG_DONOT_CREATE_SPAN:不创建子分支,缺省创建子分支。
  - HITRACE_FLAG_TP_INFO:输出tracepoint信息,缺省不输出。
  - HITRACE_FLAG_NO_BE_INFO:不输出起始、结束信息,缺省输出。
  - HITRACE_FLAG_DONOT_ENABLE_LOG:不与日志关联输出,缺省关联。
  - HITRACE_FLAG_FAULT_TRIGGER:故障触发的跟踪,缺省为正常启动的。
  - HITRACE_FLAG_D2D_TP_INFO:输出设备间tracepoint信息,缺省不输出。
  - HITRACE_FLAG_DEFAULT: 缺省标志。
- 输出参数:无
- 返回值:启动跟踪超过返回有效HiTraceId对象,否则返回无效对象。
注意:嵌套启动跟踪时,内层启动调用返回无效对象。 | -| | void End(const HiTraceId& id) | 功能:根据Begin返回的HiTraceId停止HiTraceChain跟踪;清除当前线程TLS中HiTraceId内容。
输入参数:
- id:HiTraceId对象。
输出参数:无。
返回值:无。 | -| | HiTraceId GetId(); | 功能:从当前线程TLS中获取HiTraceId对象。
输入参数:无。
输出参数:无。
返回值:当前线程上下文的HiTraceId对象。 | -| | void SetId(const HiTraceId& id) | 功能:设置HiTraceId对象内容到当前线程TLS中。
输入参数:
- id:HiTraceId对象。
输出参数:无。
返回值:无。 | -| | void ClearId() | 功能:清除当前线程TLS中的HiTraceId对象。
输入参数:无。
输出参数:无。
返回值:无。 | -| | HiTraceId CreateSpan() | 接口功能:获取当前HiTraceId对象中的分支ID。
输入参数:无。
输出参数:无。
返回值:当前分支ID。 | -| | void Tracepoint(HiTraceTracepointType type, const HiTraceId& id, const char\* fmt, ...) | 功能:根据埋点信息类型输出HiTraceChain埋点信息,包括时间戳、子分支HiTraceId对象信息。
输入参数:
- type:埋点信息类型,具体为
  - HITRACE_TP_CS:Client Send,同步/异步通信客户端发送信息。
  - HITRACE_TP_SR:Server Receive, 同步/异步通信服务端接收信息。
  - HITRACE_TP_SS:Server Send,同步通信服务端发送响应信息。
  - HITRACE_TP_CR:Client Receive,同步通信客户端接收响应信息。
  - HITRACE_TP_GENERAL:普通输出信息。
- id:当前子分支id。
- fmt:格式化变参描述字符串。
- args:变参。
输出参数:无。
返回值:无。 | -| | void Tracepoint(HiTraceCommunicationMode mode, HiTraceTracepointType type, const HiTraceId& id, const char\* fmt, ...) | 功能:根据通信模式、埋点信息类型输出HiTraceChain埋点信息,包括时间戳、子分支HiTraceId对象信息。
输入参数:
- mode:通信模式,具体为
  - HITRACE_CM_DEFAULT:未指定通信模式。
  - HITRACE_CM_THREAD:线程间通信。
  - HITRACE_CM_PROCESS:进程间通信。
  - HITRACE_CM_DEVICE:设备间通信。
- type:埋点信息类型,具体为
  - HITRACE_TP_CS:Client Send,同步/异步通信客户端发送信息。
  - HITRACE_TP_SR:Server Receive, 同步/异步通信服务端接收信息。
  - HITRACE_TP_SS:Server Send,同步通信服务端发送响应信息。
  - HITRACE_TP_CR:Client Receive,同步通信客户端接收响应信息。
  - HITRACE_TP_GENERAL:普通输出信息。
- id:当前子分支id。
- fmt:格式化变参描述字符串。
- args:变参。
输出参数:无。
返回值:无。 | +| HiTraceChain | HiTraceId Begin(const std::string& name, int flags) | 功能:启动HiTraceChain跟踪、生成HiTraceId对象并设置到当前线程TLS中。
输入参数:
- name:业务流程名称。
- flags:跟踪指示位,可以组合使用,具体说明请参考**表2** 跟踪标志组合类型枚举。
- 输出参数:无
- 返回值:启动跟踪超过返回有效HiTraceId对象,否则返回无效对象。
注意:嵌套启动跟踪时,内层启动调用返回无效对象。 | +| | void End(const HiTraceId& id) | 功能:根据Begin返回的HiTraceId停止HiTraceChain跟踪;清除当前线程TLS中HiTraceId内容。
输入参数:
- id:HiTraceId对象。
输出参数:无。
返回值:无。 | +| | HiTraceId GetId(); | 功能:从当前线程TLS中获取HiTraceId对象。
输入参数:无。
输出参数:无。
返回值:当前线程上下文的HiTraceId对象。 | +| | void SetId(const HiTraceId& id) | 功能:设置HiTraceId对象内容到当前线程TLS中。
输入参数:
- id:HiTraceId对象。
输出参数:无。
返回值:无。 | +| | void ClearId() | 功能:清除当前线程TLS中的HiTraceId对象。
输入参数:无。
输出参数:无。
返回值:无。 | +| | HiTraceId CreateSpan() | 接口功能:获取当前HiTraceId对象中的分支ID。
输入参数:无。
输出参数:无。
返回值:当前分支ID。 | +| | void Tracepoint(HiTraceTracepointType type, const HiTraceId& id, const char* fmt, ...) | 功能:根据埋点信息类型输出HiTraceChain埋点信息,包括时间戳、子分支HiTraceId对象信息。
输入参数:
- type:埋点信息类型,具体说明请参考**表3** 跟踪埋点类型枚举。
- id:当前子分支id。
- fmt:格式化变参描述字符串。
- args:变参。
输出参数:无。
返回值:无。 | +| | void Tracepoint(HiTraceCommunicationMode mode, HiTraceTracepointType type, const HiTraceId& id, const char* fmt, ...) | 功能:根据通信模式、埋点信息类型输出HiTraceChain埋点信息,包括时间戳、子分支HiTraceId对象信息。
输入参数:
- mode:通信模式,具体说明请参考**表4** 跟踪通信类型枚举。
- type:埋点信息类型,具体说明请参考**表3** 跟踪埋点类型枚举。
- id:当前子分支id。
- fmt:格式化变参描述字符串。
- args:变参。
输出参数:无。
返回值:无。 | | HiTraceId | HiTraceId(); | 功能:缺省构造函数,生成无效HiTraceId对象。
输入参数:无。
输出参数:无。
返回值:无。 | -| | HiTraceId(const uint8_t\* pIdArray, int len) | 功能:构造函数,根据字节数组创建跟踪HiTraceId对象。
输入参数:
- pIdArray:字节数组指针。
- len:字节数组长度。
输出参数:无。
返回值:无。 | -| | bool IsValid() | 功能:HiTraceId对象是否有效。
输入参数:无。
输出参数:无。
返回值:true 有效;false 无效。 | -| | bool IsFlagEnabled(HiTraceFlag flag) | 功能:HiTraceId对象的某标志是否置位。
输入参数:
- flag:跟踪指示位,具体含义见Begin函数中的定义。
输出参数:无。
返回值:true 该标志置位;false 该标志未置位。 | -| | void EnableFlag(HiTraceFlag flag) | 功能:设置某跟踪标志位到HiTraceId对象中。
输入参数:
- flag:跟踪指示位,具体含义见Begin函数中的定义。
输出参数:无。
返回值:无。 | -| | int GetFlags() | 功能:获取HiTraceId对象中设置的标志位。
输入参数:无。
输出参数:无。
返回值:跟踪指示位组合,具体含义见Begin函数中的定义。 | -| | void SetFlags(int flags) | 功能:设置跟踪标志位到HiTraceId对象中。
输入参数:
- flags:跟踪指示位组合,具体含义见Begin函数中的定义。
输出参数:无。
返回值:无。 | -| | uint64_t GetChainId() | 功能:获取跟踪链ID。
输入参数:无。
输出参数:无。
返回值:跟踪链ID。 | -| | void SetChainId(uint64_t chainId) | 功能:设置跟踪链ID到HiTraceId对象中。
输入参数:
- chainId:跟踪链ID。
输出参数:无。
返回值:无。 | -| | uint64_t GetSpanId() | 接口功能:获取当前HiTraceId对象中的分支ID。
输入参数:无。
输出参数:无。
返回值:当前分支ID。 | -| | void SetSpanId(uint64_t spanId) | 功能:设置分支ID到HiTraceId对象中。
输入参数:
- spanId:分支ID。
输出参数:无。
返回值:无。 | -| | uint64_t GetParentSpanId() | 功能:获取当前HiTraceId对象中的父分支ID。
输入参数:无。
输出参数:无。
返回值:父分支ID。 | -| | void SetParentSpanId(uint64_t parentSpanId) | 功能:设置父分支ID到HiTraceId对象中。
输入参数:
- parentSpanId:父分支ID。
输出参数:无。
返回值:无。 | -| | int ToBytes(uint8_t\* pIdArray, int len) | 功能:将HiTraceId对象转换为字节数组,便于缓存或者通信传递。
输入参数:
- pIdArray:字节数组指针,数组长度至少为HITRACE_ID_LEN。
- len: 字节数组长度
输出参数:
- pIdArray:字节数组指针,对象有效时存储转换后的对象数据。
返回值:0 转换失败; &gt;0 有效对象转换数组长度。 | - - -## 通信调用处理 +| | HiTraceId(const uint8_t* pIdArray, int len) | 功能:构造函数,根据字节数组创建跟踪HiTraceId对象。
输入参数:
- pIdArray:字节数组指针。
- len:字节数组长度。
输出参数:无。
返回值:无。 | +| | bool IsValid() | 功能:HiTraceId对象是否有效。
输入参数:无。
输出参数:无。
返回值:true 有效;false 无效。 | +| | bool IsFlagEnabled(HiTraceFlag flag) | 功能:HiTraceId对象的某标志是否置位。
输入参数:
- flag:跟踪指示位,具体含义见Begin函数中的定义。
输出参数:无。
返回值:true 该标志置位;false 该标志未置位。 | +| | void EnableFlag(HiTraceFlag flag) | 功能:设置某跟踪标志位到HiTraceId对象中。
输入参数:
- flag:跟踪指示位,具体含义见Begin函数中的定义。
输出参数:无。
返回值:无。 | +| | int GetFlags() | 功能:获取HiTraceId对象中设置的标志位。
输入参数:无。
输出参数:无。
返回值:跟踪指示位组合,具体含义见Begin函数中的定义。 | +| | void SetFlags(int flags) | 功能:设置跟踪标志位到HiTraceId对象中。
输入参数:
- flags:跟踪指示位组合,具体含义见Begin函数中的定义。
输出参数:无。
返回值:无。 | +| | uint64_t GetChainId() | 功能:获取跟踪链ID。
输入参数:无。
输出参数:无。
返回值:跟踪链ID。 | +| | void SetChainId(uint64_t chainId) | 功能:设置跟踪链ID到HiTraceId对象中。
输入参数:
- chainId:跟踪链ID。
输出参数:无。
返回值:无。 | +| | uint64_t GetSpanId() | 接口功能:获取当前HiTraceId对象中的分支ID。
输入参数:无。
输出参数:无。
返回值:当前分支ID。 | +| | void SetSpanId(uint64_t spanId) | 功能:设置分支ID到HiTraceId对象中。
输入参数:
- spanId:分支ID。
输出参数:无。
返回值:无。 | +| | uint64_t GetParentSpanId() | 功能:获取当前HiTraceId对象中的父分支ID。
输入参数:无。
输出参数:无。
返回值:父分支ID。 | +| | void SetParentSpanId(uint64_t parentSpanId) | 功能:设置父分支ID到HiTraceId对象中。
输入参数:
- parentSpanId:父分支ID。
输出参数:无。
返回值:无。 | +| | int ToBytes(uint8_t* pIdArray, int len) | 功能:将HiTraceId对象转换为字节数组,便于缓存或者通信传递。
输入参数:
- pIdArray:字节数组指针,数组长度至少为HITRACE_ID_LEN。
- len: 字节数组长度
输出参数:
- pIdArray:字节数组指针,对象有效时存储转换后的对象数据。
返回值:0 转换失败; &gt;0 有效对象转换数组长度。 | + + +### 通信调用处理 业务使用时跨设备/跨进程/跨线程的调用是通过通信机制实现的,HiTraceChain需要通信机制传递traceid。 diff --git a/zh-cn/device-dev/subsystems/subsys-dfx-hitracemeter.md b/zh-cn/device-dev/subsystems/subsys-dfx-hitracemeter.md index c4ac1bf5503818d94237cf12de8f3ce7fe91ce63..58a4e82fea85f151a2101dd586adec0c520bed21 100644 --- a/zh-cn/device-dev/subsystems/subsys-dfx-hitracemeter.md +++ b/zh-cn/device-dev/subsystems/subsys-dfx-hitracemeter.md @@ -1,359 +1,353 @@ -# HiTraceMeter概述 - -## 简介 - -HiTraceMeter在OpenHarmony中,为开发者提供业务流程调用链跟踪的维测接口。通过使用该接口所提供的功能,可以帮助开发者迅速获取指定业务流程调用链的运行日志、定位跨设备/跨进程/跨线程的故障问题。HiTraceMeter用来支持用户态的打点,采集用户态和内核态的trace数据,从而进行性能跟踪与分析的系统。 - -## 基本概念 - -HiTraceMeter系统主要分为三部分: -- JS/C++应用打点API; -- Trace数据采集命令行工具; -- Trace数据图形分析工具。 - -其中,前两者运行在设备端侧,图形工具运行在PC主机侧。打点API部分提供了C++和JS接口,供开发过程中打点使用,打点用于产生Trace数据流,是抓Trace数据的基础条件。 - -命令行工具用于采集Trace数据,用来抓取Trace数据流并保存到文本文件。 - -Trace数据分析可以在图形工具中人工分析,也可以使用分析脚本自动化分析,Trace分析工具以Trace命令行工具的采集结果数据文件为输入。 - - HiTraceMeter跟踪数据使用类别分类,类别分类称作Trace Tag或Trace Category,一般一个端侧软件子系统对应一个Tag。该Tag在打点API中以类别Tag参数传入。Trace命令行工具采集跟踪数据时,只采集Tag类别选项指定的跟踪数据。应用程序跟踪数据标签都是属于APP Tag,从而JS接口不需要输入tag参数。目前HiTraceMeter支持的Trace Tag表如下(可在hitrace_meter.h [hitrace_meter.h](https://gitee.com/openharmony/hiviewdfx_hitrace/blob/master/interfaces/native/innerkits/include/hitrace_meter/hitrace_meter.h) 中查看): - -```cpp -constexpr uint64_t HITRACE_TAG_NEVER = 0; // This tag is never enabled. -constexpr uint64_t HITRACE_TAG_ALWAYS = (1ULL << 0); // This tag is always enabled. -constexpr uint64_t HITRACE_TAG_DLP_CREDENTIAL = (1ULL << 21); // This tag is dlp credential service. -constexpr uint64_t HITRACE_TAG_ACCESS_CONTROL = (1ULL << 22); // This tag is access control tag. -constexpr uint64_t HITRACE_TAG_NET = (1ULL << 23); // Net tag. -constexpr uint64_t HITRACE_TAG_NWEB = (1ULL << 24); // NWeb tag. -constexpr uint64_t HITRACE_TAG_HUKS = (1ULL << 25); // This tag is huks. -constexpr uint64_t HITRACE_TAG_USERIAM = (1ULL << 26); // This tag is useriam. -constexpr uint64_t HITRACE_TAG_DISTRIBUTED_AUDIO = (1ULL << 27); // Distributed audio tag. -constexpr uint64_t HITRACE_TAG_DLSM = (1ULL << 28); // device security level tag. -constexpr uint64_t HITRACE_TAG_FILEMANAGEMENT = (1ULL << 29); // filemanagement tag. -constexpr uint64_t HITRACE_TAG_OHOS = (1ULL << 30); // OHOS generic tag. -constexpr uint64_t HITRACE_TAG_ABILITY_MANAGER = (1ULL << 31); // Ability Manager tag. -constexpr uint64_t HITRACE_TAG_ZCAMERA = (1ULL << 32); // Camera module tag. -constexpr uint64_t HITRACE_TAG_ZMEDIA = (1ULL << 33); // Media module tag. -constexpr uint64_t HITRACE_TAG_ZIMAGE = (1ULL << 34); // Image module tag. -constexpr uint64_t HITRACE_TAG_ZAUDIO = (1ULL << 35); // Audio module tag. -constexpr uint64_t HITRACE_TAG_DISTRIBUTEDDATA = (1ULL << 36); // Distributeddata manager module tag. -constexpr uint64_t HITRACE_TAG_MDFS = (1ULL << 37); // Mobile distributed file system tag. -constexpr uint64_t HITRACE_TAG_GRAPHIC_AGP = (1ULL << 38); // Graphic module tag. -constexpr uint64_t HITRACE_TAG_ACE = (1ULL << 39); // ACE development framework tag. -constexpr uint64_t HITRACE_TAG_NOTIFICATION = (1ULL << 40); // Notification module tag. -constexpr uint64_t HITRACE_TAG_MISC = (1ULL << 41); // Notification module tag. -constexpr uint64_t HITRACE_TAG_MULTIMODALINPUT = (1ULL << 42); // Multi modal module tag. -constexpr uint64_t HITRACE_TAG_SENSORS = (1ULL << 43); // Sensors mudule tag. -constexpr uint64_t HITRACE_TAG_MSDP = (1ULL << 44); // Multimodal Sensor Data Platform module tag. -constexpr uint64_t HITRACE_TAG_DSOFTBUS = (1ULL << 45); // Distributed Softbus tag. -constexpr uint64_t HITRACE_TAG_RPC = (1ULL << 46); // RPC and IPC tag. -constexpr uint64_t HITRACE_TAG_ARK = (1ULL << 47); // ARK tag. -constexpr uint64_t HITRACE_TAG_WINDOW_MANAGER = (1ULL << 48); // window manager tag. -constexpr uint64_t HITRACE_TAG_ACCOUNT_MANAGER = (1ULL << 49); // account manager tag. -constexpr uint64_t HITRACE_TAG_DISTRIBUTED_SCREEN = (1ULL << 50); // Distributed screen tag. -constexpr uint64_t HITRACE_TAG_DISTRIBUTED_CAMERA = (1ULL << 51); // Distributed camera tag. -constexpr uint64_t HITRACE_TAG_DISTRIBUTED_HARDWARE_FWK = (1ULL << 52); // Distributed hardware fwk tag. -constexpr uint64_t HITRACE_TAG_GLOBAL_RESMGR = (1ULL << 53); // Global resource manager tag. -constexpr uint64_t HITRACE_TAG_DEVICE_MANAGER = (1ULL << 54); // Distributed hardware devicemanager tag. -constexpr uint64_t HITRACE_TAG_SAMGR = (1ULL << 55); // SA tag. -constexpr uint64_t HITRACE_TAG_POWER = (1ULL << 56); // power manager tag. -constexpr uint64_t HITRACE_TAG_DISTRIBUTED_SCHEDULE = (1ULL << 57); // Distributed schedule tag. -constexpr uint64_t HITRACE_TAG_DEVICE_PROFILE = (1ULL << 58); // device profile tag. -constexpr uint64_t HITRACE_TAG_DISTRIBUTED_INPUT = (1ULL << 59); // Distributed input tag. -constexpr uint64_t HITRACE_TAG_BLUETOOTH = (1ULL << 60); // bluetooth tag. -constexpr uint64_t HITRACE_TAG_ACCESSIBILITY_MANAGER = (1ULL << 61); // accessibility manager tag. -constexpr uint64_t HITRACE_TAG_APP = (1ULL << 62); // App tag. - -constexpr uint64_t HITRACE_TAG_LAST = HITRACE_TAG_APP; -constexpr uint64_t HITRACE_TAG_NOT_READY = (1ULL << 63); // Reserved for initialization. -constexpr uint64_t HITRACE_TAG_VALID_MASK = ((HITRACE_TAG_LAST - 1) | HITRACE_TAG_LAST); -``` - -## 实现原理 - -HiTraceMeter主要提供抓取用户态和内核态Trace数据的命令行工具,提供用户态打点的innerkits接口(c++)和kits接口(js),HiTraceMeter基于内核ftrace提供的用户态打点的扩展,利用ftrace的trace_marker节点,将用户空间通过打点接口写入的数据写进内核循环buffer缓冲区。其基本架构图如下: - - - -![输入图片说明](figures/HiTraceMeter.png) - - - - -## 约束与限制 - -- HiTraceMeter所有功能与接口的实现都依赖于内核提供的ftrace功能,ftrace 是内核提供的一个 framework,采用 plugin 的方式支持开发人员添加更多种类的 trace 功能,因此使用HiTraceMeter之前要使能 ftrace,否则HiTraceMeter的功能无法使用(目前大部分Linux内核默认使能了ftrace,关于ftrace的详细介绍可查看内核ftrace相关资料 - [ftrace相关资料](https://blog.csdn.net/Luckiers/article/details/124646205) )。 -- HiTraceMeter仅限小型系统、标准系统下使用。 - - - -# HiTraceMeter开发指导 - -HiTraceMeter分为JS/C++应用打点API与数据采集命令行工具hitrace,下面分别介绍接口和命令行工具。 - - - - -## 场景介绍 - -在实际开发过程中,开发者可能会遇到app卡顿或者在代码调试过程中需要查看代码调用流程,HiTraceMeter接口提供了相应的接口来跟踪程序延时和代码调用流程,分析性能问题。 - -## 接口说明 - -C++接口仅系统开发者使用,JS(目前暂未开放js接口)应用开发者可以略过本节。标准系统上接口描述如下(hitrace_meter.h [hitrace_meter.h](https://gitee.com/openharmony/hiviewdfx_hitrace/blob/master/interfaces/native/innerkits/include/hitrace_meter/hitrace_meter.h) ): - -**表 1** 同步接口 - -| Sync trace | 功能描述 |参数说明 | -| :----------------------------------------------------------- | ------------- |------------- | -| void StartTrace(uint64_t label, const std::string& value, float limit = -1); | 启动同步trace |label: Trace category。
value: Trace携带的信息,表明当前的某种状态,例如内存大小,队列长短等。 | -| void FinishTrace(uint64_t label); | 关闭同步trace |label: Trace category。 | - - -同步接口StartTrace和FinishTrace必须配对使用,FinishTrace和前面最近的StartTrace进行匹配。StartTrace和FinishTrace函数对可以嵌套模式使用,跟踪数据解析时使用栈式数据结构进行匹配。接口中的limit参数用于限流,使用默认值即可。 - -**表 2** 异步接口 - -| Async trace | 功能描述 |参数说明 | -| ------------------------------------------------------------ | ------------- |------------- | -| void StartAsyncTrace(uint64_t label, const std::string& value, int32_t taskId, float limit = -1); | 开启异步trace | label: Trace category。
value: Trace携带的信息,表明当前的某种状态,例如内存大小,队列长短等。
taskId:异步Trace中用来表示关联的ID。 | -| void FinishAsyncTrace(uint64_t label, const std::string& value, int32_t taskId); | 关闭异步trace | label: Trace category。
value: Trace携带的信息,表明当前的某种状态,例如内存大小,队列长短等。
taskId:异步Trace中用来表示关联的ID。 | - - - -异步接口StartAsyncTrace和FinishAsyncTrace的跟踪数据匹配时,使用参数中的value和taskId配对匹配,可以不按顺序使用,主要用于异步场景。在C++程序中,使用异步跟踪的场景很少。 - -**表 3** 计数器接口 - -| Counter Trace | 功能描述 |参数说明 | -| ------------------------------------------------------------ | --------- |--------- | -| void CountTrace(uint64_t label, const std::string& name, int64_t); | 计数trace |label: Trace category。
name: Trace的名称,IDE中会以此字段展示这段Trace。 | - - -## 开发步骤 -1. 编译依赖添加,需要修改的编译配置文件base\hiviewdfx\hitrace\cmd\BUILD.gn 。 - - ``` - external_deps = [ "hitrace_native:hitrace_meter"] - ``` -2. 头文件依赖添加。 - - ```cpp - #include "hitrace_meter.h"//接口函数定义头文件 - ``` - -3. 接口调用,将需要跟踪的Trace value传入参数,在shell中执行hitrace命令后会自动抓取Trace数据,抓到的Trace数据中包括了函数调用过程以及调用过程消耗的内存和时间,可用于分析代码调用流程,代码性能问题。 - - - ```cpp - - CountTrace(label, "count number", 2000); // 整数跟踪 - - StartTrace(label, "func1Trace", -1); // func1Start的跟踪起始点 - - FinishTrace(label); // func1Trace的结束点 - - StartAsyncTrace(label, "asyncTrace1", 1234); // 异步asyncTrace1的开始点 - - FinishAsyncTrace(label, "asyncTrace2", 3456); // 异步asyncTrace2的结束点 - ``` - -4. 使用方法,打点编译部署完成后,运行下面命令行来抓取Trace。然后在端侧shell里运行应用,可以抓取到Trace数据。 - - ``` - hdc_std shell hitrace -t 10 ohos > .\myapp_demo.ftrace - ``` - - 抓取之后的数据可以在smartperf中"Open trace file"或者直接拖入图形区打开,关于smartperf的详细介绍可查看 [smartperf](https://toscode.gitee.com/openharmony-sig/smartperf) 。 - -## 开发示例 - -目前HiTraceMeter支持的Trace Tag在基本概念hitrace_meter.h中都已列出,我们以OHOS这个Tag为例,假设我们需要获取func1,func2函数的Trace数据,则一个使用示例如下: - -```cpp -#include "hitrace_meter.h" // 包含hitrace_meter.h -using namespace std; - -int main() -{ - uint64_t label = BYTRACE_TAG_OHOS; - sleep(1); - CountTrace(label, "count number", 2000); // 整数跟踪 - - StartTrace(label, "func1Trace", -1); // func1Start的跟踪起始点 - sleep(1); - StartTrace(label, "func2Trace", -1); // func2Start的跟踪起始点 - sleep(2); - FinishTrace(label); // func2Trace的结束点 - sleep(1); - FinishTrace(label); // func1Trace的结束点 - - return 0; - } -``` - - - -## 调测验证 - -以下为一个demo调试过程,该demo使用了同步接口中的StartTrace和FinishTrace。 - -1. 编写测试代码hitrace_example.cpp( [hitrace_example.cpp](https://gitee.com/openharmony/hiviewdfx_hitrace/blob/master/cmd/example/hitrace_example.cpp) ),将使用到的接口加入代码: - - ```cpp - int main() - { - thread t1(ThreadFunc1); - t1.join(); - - StartTrace(LABEL, "testStart"); - sleep(SLEEP_ONE_SECOND); - - StartTrace(LABEL, "funcAStart", SLEEP_ONE_SECOND); // 打印起始点 - FuncA(); - FinishTrace(LABEL); - sleep(SLEEP_TWO_SECOND); - - thread t2(ThreadFunc2); - t2.join(); - - StartTrace(LABEL, "funcBStart", SLEEP_TWO_SECOND); - FuncB(); - FinishTrace(LABEL);// 打印结束点 - sleep(SLEEP_TWO_SECOND); - - sleep(SLEEP_ONE_SECOND); - FinishTrace(LABEL); - FuncC(); - - return 0; - } - ``` - -2. 修改gn编译文件并编译,编译配置文件路径base\hiviewdfx\hitrace\cmd\BUILD.gn 。 - - ``` - ohos_executable("hitrace_example") { - sources = [ "example/hitrace_example.cpp" ] - - external_deps = [ "hitrace_native:hitrace_meter" ] - - subsystem_name = "hiviewdfx" - part_name = "hitrace_native" - } - - group("hitrace_target") { - deps = [ - ":hitrace", - ":hitrace_example", - ] - } - ``` - -3. 将编译出来的hitrace_example可执行文件放到设备中的/system/bin目录下,在shell中执行依次执行如下命令: - - ```shell - hitrace --trace_begin ohos - hitrace_exampe - hitrace --trace_dump - ``` - - 当我们看到Trace数据中有我们需要的Trace value时,说明成功抓取Trace,成功的数据如下所示: - - ``` - <...>-1651 (-------) [002] .... 327.194136: tracing_mark_write: S|1650|H:testAsync 111 - <...>-1650 (-------) [001] .... 332.197640: tracing_mark_write: B|1650|H:testStart - <...>-1650 (-------) [001] .... 333.198018: tracing_mark_write: B|1650|H:funcAStart - <...>-1650 (-------) [001] .... 334.198507: tracing_mark_write: E|1650| - <...>-1654 (-------) [003] .... 341.201673: tracing_mark_write: F|1650|H:testAsync 111 - <...>-1650 (-------) [001] .... 341.202168: tracing_mark_write: B|1650|H:funcBStart - <...>-1650 (-------) [001] .... 343.202557: tracing_mark_write: E|1650| - <...>-1650 (-------) [001] .... 346.203178: tracing_mark_write: E|1650| - <...>-1650 (-------) [001] .... 346.203457: tracing_mark_write: C|1650|H:count number 1 - <...>-1650 (-------) [001] .... 347.203818: tracing_mark_write: C|1650|H:count number 2 - <...>-1650 (-------) [001] .... 348.204207: tracing_mark_write: C|1650|H:count number 3 - <...>-1650 (-------) [001] .... 349.204473: tracing_mark_write: C|1650|H:count number 4 - <...>-1650 (-------) [001] .... 350.204851: tracing_mark_write: C|1650|H:count number 5 - <...>-1655 (-------) [001] .... 365.944658: tracing_mark_write: trace_event_clock_sync: realtime_ts=1502021460925 - <...>-1655 (-------) [001] .... 365.944686: tracing_mark_write: trace_event_clock_sync: parent_ts=365.944641 - ``` - - - -# HiTraceMeter命令行工具使用指导 - -HiTraceMeter提供了可执行的二进制程序hitrace,设备刷openharmony后直接在shell中运行以下命令,抓取内核运行的数据,当前支持的操作如下: - -**表 4** 命令行列表 - -| Option | Description | -| ------------------------------ | ------------------------------------------------------------ | -| -h,--help | 查看option帮助 | -| -b n,--buffer_size n | 指定n(KB)内存大小用于存取trace日志,默认2048KB | -| -t n,--time n | 用来指定trace运行的时间(单位:s),取决于需要分析过程的时间 | -| --trace_clock clock | trace输出的时钟类型,一般设备支持boot、global、mono、uptime、perf等,默认为boot | -| --trace_begin | 启动抓trace | -| --trace_dump | 将数据输出到指定位置(默认控制台) | -| --trace_finish | 停止抓trace,并将数据输出到指定位置(默认控制台) | -| -l,--list_categories | 输出手机能支持的trace模块 | -| --overwrite | 当缓冲区满的时候,将丢弃最新的信息。(默认丢弃最老的日志) | -| -o filename,--output filename | 指定输出的目标文件名称 | -| -z | 抓取trace后进行压缩 | - -以下是常用hitrace命令示例,供开发者参考: - -- 查询支持的label。 - - ``` - hitrace -l - ``` - - 或者 - - ``` - hitrace --list_categories - ``` - - -- 设置4M缓存,抓取10秒,抓取label为ability的trace信息。 - - ``` - hitrace -b 4096 -t 10 --overwrite ability > /data/log/mytrace.ftrace - ``` - - -- 设置trace的输出时钟为mono。 - - ``` - hitrace --trace_clock mono -b 4096 -t 10 --overwrite ability > /data/log/mytrace.ftrace - ``` - - -- 抓取trace后进行压缩。 - - ``` - hitrace -z -b 4096 -t 10 --overwrite ability > /data/log/mytrace.ftrace - ``` - - - -# 常见问题 - -### hitrace抓数据不全或者没抓到数据 - -#### 现象描述 - - 执行hitrace命令抓数据不全或者没抓到数据。 - -#### 解决方法 - - 参数-t 时间设置过小或者-b缓冲区buffer设置过小导致数据丢失,可设置-t 60,-b 204800扩大抓trace时间和缓冲区buffer解决。 - - - -# 参考 - -更多关于HiTraceMeter的详细内容请参考:[hiviewdfx_hitrace: A Lightweight Distributed Tracing | 轻量级的分布式调用链跟踪 (gitee.com)](https://gitee.com/openharmony/hiviewdfx_hitrace) 。 - +# HiTraceMeter概述 + +## 简介 + +HiTraceMeter在OpenHarmony中,为开发者提供业务流程调用链跟踪的维测接口。通过使用该接口所提供的功能,可以帮助开发者迅速获取指定业务流程调用链的运行日志、定位跨设备/跨进程/跨线程的故障问题。HiTraceMeter用来支持用户态的打点,采集用户态和内核态的trace数据,从而进行性能跟踪与分析的系统。 + +## 基本概念 + +HiTraceMeter系统主要分为三部分: + +- JS/C++应用打点API; +- Trace数据采集命令行工具; +- Trace数据图形分析工具。 + +其中,前两者运行在设备端侧,图形工具运行在PC主机侧。打点API部分提供了C++和JS接口,供开发过程中打点使用,打点用于产生Trace数据流,是抓Trace数据的基础条件。 + +命令行工具用于采集Trace数据,用来抓取Trace数据流并保存到文本文件。 + +Trace数据分析可以在图形工具中人工分析,也可以使用分析脚本自动化分析,Trace分析工具以Trace命令行工具的采集结果数据文件为输入。 + + HiTraceMeter跟踪数据使用类别分类,类别分类称作Trace Tag或Trace Category,一般一个端侧软件子系统对应一个Tag。该Tag在打点API中以类别Tag参数传入。Trace命令行工具采集跟踪数据时,只采集Tag类别选项指定的跟踪数据。应用程序跟踪数据标签都是属于APP Tag,从而JS接口不需要输入tag参数。目前HiTraceMeter支持的Trace Tag表如下(可在hitrace_meter.h [hitrace_meter.h](https://gitee.com/openharmony/hiviewdfx_hitrace/blob/master/interfaces/native/innerkits/include/hitrace_meter/hitrace_meter.h) 中查看): + +```cpp +constexpr uint64_t HITRACE_TAG_NEVER = 0; // This tag is never enabled. +constexpr uint64_t HITRACE_TAG_ALWAYS = (1ULL << 0); // This tag is always enabled. +constexpr uint64_t HITRACE_TAG_DLP_CREDENTIAL = (1ULL << 21); // This tag is dlp credential service. +constexpr uint64_t HITRACE_TAG_ACCESS_CONTROL = (1ULL << 22); // This tag is access control tag. +constexpr uint64_t HITRACE_TAG_NET = (1ULL << 23); // Net tag. +constexpr uint64_t HITRACE_TAG_NWEB = (1ULL << 24); // NWeb tag. +constexpr uint64_t HITRACE_TAG_HUKS = (1ULL << 25); // This tag is huks. +constexpr uint64_t HITRACE_TAG_USERIAM = (1ULL << 26); // This tag is useriam. +constexpr uint64_t HITRACE_TAG_DISTRIBUTED_AUDIO = (1ULL << 27); // Distributed audio tag. +constexpr uint64_t HITRACE_TAG_DLSM = (1ULL << 28); // device security level tag. +constexpr uint64_t HITRACE_TAG_FILEMANAGEMENT = (1ULL << 29); // filemanagement tag. +constexpr uint64_t HITRACE_TAG_OHOS = (1ULL << 30); // OHOS generic tag. +constexpr uint64_t HITRACE_TAG_ABILITY_MANAGER = (1ULL << 31); // Ability Manager tag. +constexpr uint64_t HITRACE_TAG_ZCAMERA = (1ULL << 32); // Camera module tag. +constexpr uint64_t HITRACE_TAG_ZMEDIA = (1ULL << 33); // Media module tag. +constexpr uint64_t HITRACE_TAG_ZIMAGE = (1ULL << 34); // Image module tag. +constexpr uint64_t HITRACE_TAG_ZAUDIO = (1ULL << 35); // Audio module tag. +constexpr uint64_t HITRACE_TAG_DISTRIBUTEDDATA = (1ULL << 36); // Distributeddata manager module tag. +constexpr uint64_t HITRACE_TAG_MDFS = (1ULL << 37); // Mobile distributed file system tag. +constexpr uint64_t HITRACE_TAG_GRAPHIC_AGP = (1ULL << 38); // Graphic module tag. +constexpr uint64_t HITRACE_TAG_ACE = (1ULL << 39); // ACE development framework tag. +constexpr uint64_t HITRACE_TAG_NOTIFICATION = (1ULL << 40); // Notification module tag. +constexpr uint64_t HITRACE_TAG_MISC = (1ULL << 41); // Notification module tag. +constexpr uint64_t HITRACE_TAG_MULTIMODALINPUT = (1ULL << 42); // Multi modal module tag. +constexpr uint64_t HITRACE_TAG_SENSORS = (1ULL << 43); // Sensors mudule tag. +constexpr uint64_t HITRACE_TAG_MSDP = (1ULL << 44); // Multimodal Sensor Data Platform module tag. +constexpr uint64_t HITRACE_TAG_DSOFTBUS = (1ULL << 45); // Distributed Softbus tag. +constexpr uint64_t HITRACE_TAG_RPC = (1ULL << 46); // RPC and IPC tag. +constexpr uint64_t HITRACE_TAG_ARK = (1ULL << 47); // ARK tag. +constexpr uint64_t HITRACE_TAG_WINDOW_MANAGER = (1ULL << 48); // window manager tag. +constexpr uint64_t HITRACE_TAG_ACCOUNT_MANAGER = (1ULL << 49); // account manager tag. +constexpr uint64_t HITRACE_TAG_DISTRIBUTED_SCREEN = (1ULL << 50); // Distributed screen tag. +constexpr uint64_t HITRACE_TAG_DISTRIBUTED_CAMERA = (1ULL << 51); // Distributed camera tag. +constexpr uint64_t HITRACE_TAG_DISTRIBUTED_HARDWARE_FWK = (1ULL << 52); // Distributed hardware fwk tag. +constexpr uint64_t HITRACE_TAG_GLOBAL_RESMGR = (1ULL << 53); // Global resource manager tag. +constexpr uint64_t HITRACE_TAG_DEVICE_MANAGER = (1ULL << 54); // Distributed hardware devicemanager tag. +constexpr uint64_t HITRACE_TAG_SAMGR = (1ULL << 55); // SA tag. +constexpr uint64_t HITRACE_TAG_POWER = (1ULL << 56); // power manager tag. +constexpr uint64_t HITRACE_TAG_DISTRIBUTED_SCHEDULE = (1ULL << 57); // Distributed schedule tag. +constexpr uint64_t HITRACE_TAG_DEVICE_PROFILE = (1ULL << 58); // device profile tag. +constexpr uint64_t HITRACE_TAG_DISTRIBUTED_INPUT = (1ULL << 59); // Distributed input tag. +constexpr uint64_t HITRACE_TAG_BLUETOOTH = (1ULL << 60); // bluetooth tag. +constexpr uint64_t HITRACE_TAG_ACCESSIBILITY_MANAGER = (1ULL << 61); // accessibility manager tag. +constexpr uint64_t HITRACE_TAG_APP = (1ULL << 62); // App tag. + +constexpr uint64_t HITRACE_TAG_LAST = HITRACE_TAG_APP; +constexpr uint64_t HITRACE_TAG_NOT_READY = (1ULL << 63); // Reserved for initialization. +constexpr uint64_t HITRACE_TAG_VALID_MASK = ((HITRACE_TAG_LAST - 1) | HITRACE_TAG_LAST); +``` + +## 实现原理 + +HiTraceMeter主要提供抓取用户态和内核态Trace数据的命令行工具,提供用户态打点的innerkits接口(c++)和kits接口(js),HiTraceMeter基于内核ftrace提供的用户态打点的扩展,利用ftrace的trace_marker节点,将用户空间通过打点接口写入的数据写进内核循环buffer缓冲区。其基本架构图如下: + + + +![输入图片说明](figures/HiTraceMeter.png) + + + +## 约束与限制 + +- HiTraceMeter所有功能与接口的实现都依赖于内核提供的ftrace功能,ftrace 是内核提供的一个 framework,采用 plugin 的方式支持开发人员添加更多种类的 trace 功能,因此使用HiTraceMeter之前要使能 ftrace,否则HiTraceMeter的功能无法使用(目前大部分Linux内核默认使能了ftrace,关于ftrace的详细介绍可查看内核ftrace相关资料 + [ftrace相关资料](https://blog.csdn.net/Luckiers/article/details/124646205) )。 +- HiTraceMeter仅限小型系统、标准系统下使用。 + + + +# HiTraceMeter开发指导 + +HiTraceMeter分为JS/C++应用打点API与数据采集命令行工具hitrace,下面分别介绍接口和命令行工具。 + + + +## 场景介绍 + +在实际开发过程中,开发者可能会遇到app卡顿或者在代码调试过程中需要查看代码调用流程,HiTraceMeter接口提供了相应的接口来跟踪程序延时和代码调用流程,分析性能问题。 + +## 接口说明 + +C++接口仅系统开发者使用,JS(目前暂未开放js接口)应用开发者可以略过本节。标准系统上接口描述如下(hitrace_meter.h [hitrace_meter.h](https://gitee.com/openharmony/hiviewdfx_hitrace/blob/master/interfaces/native/innerkits/include/hitrace_meter/hitrace_meter.h) ): + +**表 1** 同步接口 + +| Sync trace | 功能描述 | 参数说明 | +|:---------------------------------------------------------------------------- | --------- | --------------------------------------------------------------------- | +| void StartTrace(uint64_t label, const std::string& value, float limit = -1); | 启动同步trace | label: Trace category。
value: Trace携带的信息,表明当前的某种状态,例如内存大小,队列长短等。 | +| void FinishTrace(uint64_t label); | 关闭同步trace | label: Trace category。 | + +同步接口StartTrace和FinishTrace必须配对使用,FinishTrace和前面最近的StartTrace进行匹配。StartTrace和FinishTrace函数对可以嵌套模式使用,跟踪数据解析时使用栈式数据结构进行匹配。接口中的limit参数用于限流,使用默认值即可。 + +**表 2** 异步接口 + +| Async trace | 功能描述 | 参数说明 | +| ------------------------------------------------------------------------------------------------- | --------- | ---------------------------------------------------------------------------------------------------- | +| void StartAsyncTrace(uint64_t label, const std::string& value, int32_t taskId, float limit = -1); | 开启异步trace | label: Trace category。
value: Trace携带的信息,表明当前的某种状态,例如内存大小,队列长短等。
taskId:异步Trace中用来表示关联的ID。 | +| void FinishAsyncTrace(uint64_t label, const std::string& value, int32_t taskId); | 关闭异步trace | label: Trace category。
value: Trace携带的信息,表明当前的某种状态,例如内存大小,队列长短等。
taskId:异步Trace中用来表示关联的ID。 | + + + +异步接口StartAsyncTrace和FinishAsyncTrace的跟踪数据匹配时,使用参数中的value和taskId配对匹配,可以不按顺序使用,主要用于异步场景。在C++程序中,使用异步跟踪的场景很少。 + +**表 3** 计数器接口 + +| Counter Trace | 功能描述 | 参数说明 | +| ------------------------------------------------------------------ | ------- | -------------------------------------------------------------- | +| void CountTrace(uint64_t label, const std::string& name, int64_t); | 计数trace | label: Trace category。
name: Trace的名称,IDE中会以此字段展示这段Trace。 | + +## 开发步骤 + +1. 编译依赖添加,需要修改的编译配置文件base\hiviewdfx\hitrace\cmd\BUILD.gn 。 + + ``` + external_deps = [ "hitrace_native:hitrace_meter"] + ``` + +2. 头文件依赖添加。 + + ```cpp + #include "hitrace_meter.h"//接口函数定义头文件 + ``` + +3. 接口调用,将需要跟踪的Trace value传入参数,目前HiTraceMeter支持的Trace Tag在基本概念hitrace_meter.h中都已列出,我们以OHOS这个Tag为例,假设我们需要获取func1,func2函数的Trace数据,参考下面实例,在shell中执行hitrace命令后会自动抓取Trace数据,抓到的Trace数据中包括了函数调用过程以及调用过程消耗的内存和时间,可用于分析代码调用流程,代码性能问题。 + + ```cpp + #include "hitrace_meter.h" // 包含hitrace_meter.h + using namespace std; + + int main() + { + uint64_t label = BYTRACE_TAG_OHOS; + sleep(1); + CountTrace(label, "count number", 2000); // 整数跟踪 + + StartTrace(label, "func1Trace", -1); // func1Start的跟踪起始点 + sleep(1); + StartTrace(label, "func2Trace", -1); // func2Start的跟踪起始点 + sleep(2); + FinishTrace(label); // func2Trace的结束点 + sleep(1); + FinishTrace(label); // func1Trace的结束点 + + StartAsyncTrace(label, "asyncTrace1", 1234); // 异步asyncTrace1的开始点 + FinishAsyncTrace(label, "asyncTrace1", 1234); // 异步asyncTrace1的结束点 + + return 0; + } + ``` + +4. 使用方法,打点编译部署完成后,运行下面命令行来抓取Trace。然后在端侧shell里运行应用,可以抓取到Trace数据。 + + ``` + hdc_std shell hitrace -t 10 ohos > .\myapp_demo.ftrace + ``` + + 抓取之后的数据可以在smartperf中"Open trace file"或者直接拖入图形区打开,关于smartperf的详细介绍可查看 [smartperf](https://toscode.gitee.com/openharmony-sig/smartperf) 。 + +## 调测验证 + +以下为一个demo调试过程,该demo使用了同步接口中的StartTrace和FinishTrace。 + +1. 编写测试代码hitrace_example.cpp( [hitrace_example.cpp](https://gitee.com/openharmony/hiviewdfx_hitrace/blob/master/cmd/example/hitrace_example.cpp) ),将使用到的接口加入代码: + + ```cpp + int main() + { + thread t1(ThreadFunc1); + t1.join(); + + StartTrace(LABEL, "testStart"); + sleep(SLEEP_ONE_SECOND); + + StartTrace(LABEL, "funcAStart", SLEEP_ONE_SECOND); // 打印起始点 + FuncA(); + FinishTrace(LABEL); + sleep(SLEEP_TWO_SECOND); + + thread t2(ThreadFunc2); + t2.join(); + + StartTrace(LABEL, "funcBStart", SLEEP_TWO_SECOND); + FuncB(); + FinishTrace(LABEL);// 打印结束点 + sleep(SLEEP_TWO_SECOND); + + sleep(SLEEP_ONE_SECOND); + FinishTrace(LABEL); + FuncC(); + + return 0; + } + ``` + +2. 修改gn编译文件并编译,编译配置文件路径base\hiviewdfx\hitrace\cmd\BUILD.gn 。 + + ``` + ohos_executable("hitrace_example") { + sources = [ "example/hitrace_example.cpp" ] + + external_deps = [ "hitrace_native:hitrace_meter" ] + + subsystem_name = "hiviewdfx" + part_name = "hitrace_native" + } + + group("hitrace_target") { + deps = [ + ":hitrace", + ":hitrace_example", + ] + } + ``` + +3. 将编译出来的hitrace_example可执行文件放到设备中的/system/bin目录下,在shell中执行依次执行如下命令: + + ```shell + hitrace --trace_begin ohos + hitrace_exampe + hitrace --trace_dump + ``` + + 当我们看到Trace数据中有我们需要的Trace value时,说明成功抓取Trace,成功的数据如下所示: + + ``` + <...>-1651 (-------) [002] .... 327.194136: tracing_mark_write: S|1650|H:testAsync 111 + <...>-1650 (-------) [001] .... 332.197640: tracing_mark_write: B|1650|H:testStart + <...>-1650 (-------) [001] .... 333.198018: tracing_mark_write: B|1650|H:funcAStart + <...>-1650 (-------) [001] .... 334.198507: tracing_mark_write: E|1650| + <...>-1654 (-------) [003] .... 341.201673: tracing_mark_write: F|1650|H:testAsync 111 + <...>-1650 (-------) [001] .... 341.202168: tracing_mark_write: B|1650|H:funcBStart + <...>-1650 (-------) [001] .... 343.202557: tracing_mark_write: E|1650| + <...>-1650 (-------) [001] .... 346.203178: tracing_mark_write: E|1650| + <...>-1650 (-------) [001] .... 346.203457: tracing_mark_write: C|1650|H:count number 1 + <...>-1650 (-------) [001] .... 347.203818: tracing_mark_write: C|1650|H:count number 2 + <...>-1650 (-------) [001] .... 348.204207: tracing_mark_write: C|1650|H:count number 3 + <...>-1650 (-------) [001] .... 349.204473: tracing_mark_write: C|1650|H:count number 4 + <...>-1650 (-------) [001] .... 350.204851: tracing_mark_write: C|1650|H:count number 5 + <...>-1655 (-------) [001] .... 365.944658: tracing_mark_write: trace_event_clock_sync: realtime_ts=1502021460925 + <...>-1655 (-------) [001] .... 365.944686: tracing_mark_write: trace_event_clock_sync: parent_ts=365.944641 + ``` + + + +# HiTraceMeter命令行工具使用指导 + +HiTraceMeter提供了可执行的二进制程序hitrace,设备刷openharmony后直接在shell中运行以下命令,抓取内核运行的数据,当前支持的操作如下: + +**表 4** 命令行列表 + +| Option | Description | +| ----------------------------- | -------------------------------------------------------- | +| -h,--help | 查看option帮助 | +| -b n,--buffer_size n | 指定n(KB)内存大小用于存取trace日志,默认2048KB | +| -t n,--time n | 用来指定trace运行的时间(单位:s),取决于需要分析过程的时间 | +| --trace_clock clock | trace输出的时钟类型,一般设备支持boot、global、mono、uptime、perf等,默认为boot | +| --trace_begin | 启动抓trace | +| --trace_dump | 将数据输出到指定位置(默认控制台) | +| --trace_finish | 停止抓trace,并将数据输出到指定位置(默认控制台) | +| -l,--list_categories | 输出手机能支持的trace模块 | +| --overwrite | 当缓冲区满的时候,将丢弃最新的信息。(默认丢弃最老的日志) | +| -o filename,--output filename | 指定输出的目标文件名称 | +| -z | 抓取trace后进行压缩 | + +以下是常用hitrace命令示例,供开发者参考: + +- 查询支持的label。 + + ``` + + hitrace -l + + ``` + + 或者 + + ``` + + hitrace --list_categories + + ``` + +- 设置4M缓存,抓取10秒,抓取label为ability的trace信息。 + + ``` + + hitrace -b 4096 -t 10 --overwrite ability > /data/log/mytrace.ftrace + + ``` + +- 设置trace的输出时钟为mono。 + + ``` + + hitrace --trace_clock mono -b 4096 -t 10 --overwrite ability > /data/log/mytrace.ftrace + + ``` + +- 抓取trace后进行压缩。 + + ``` + + hitrace -z -b 4096 -t 10 --overwrite ability > /data/log/mytrace.ftrace + + ``` + + + +# 常见问题 + +### hitrace抓数据不全或者没抓到数据 + +#### 现象描述 + +执行hitrace命令抓数据不全或者没抓到数据。 + +#### 根因分析 + +参数-t 时间设置过小或者-b缓冲区buffer设置过小导致数据丢失。 + +#### 解决方法 + +可设置-t 60,-b 204800扩大抓trace时间和缓冲区buffer解决。 + + + +# 参考 + +更多关于HiTraceMeter的详细内容请参考:[轻量级的分布式调用链跟踪](https://gitee.com/openharmony/hiviewdfx_hitrace) 。 + + diff --git a/zh-cn/device-dev/subsystems/subsys-dfx-overview.md b/zh-cn/device-dev/subsystems/subsys-dfx-overview.md index f1c06a3c423a210fc491f7fe9c994ff242146cc9..bc4c9e8a6c4de388101d6b8824cf3a7df641a3e1 100644 --- a/zh-cn/device-dev/subsystems/subsys-dfx-overview.md +++ b/zh-cn/device-dev/subsystems/subsys-dfx-overview.md @@ -7,22 +7,25 @@ 提供以下功能: -- HiLog流水日志,轻量系统类设备(参考内存≥128KiB)、小型系统类设备(参考内存≥1MiB)、标准系统类设备(参考内存≥128MB)适用。 +- HiLog流水日志,标准系统类设备(参考内存≥128MB)适用、HiLog_Lite轻量流水日志,轻量系统类设备(参考内存≥128KiB),小型系统类设备(参考内存≥1MiB)适用。 - HiTraceChain分布式跟踪,标准系统类设备(参考内存≥128MiB)适用。 +- HiTraceMeter性能跟踪,标准系统类设备(参考内存≥128MiB)适用。 + - HiCollie卡死故障检测,标准系统类设备(参考内存≥128MiB)适用。 - HiSysEvent系统事件埋点,标准系统类设备(参考内存≥128MiB)适用。 -- HiChecker缺陷扫描,标准系统类设备(参考内存≥128MB)适用。 - - HiDumper信息导出,标准系统类设备(参考内存≥128MB)适用。 - Faultlogger崩溃故障检测,标准系统类设备(参考内存≥128MB)适用。 - Hiview插件平台,标准系统类设备(参考内存≥128MB)适用。 +- HiAppEvent应用事件及HiChecker缺陷扫描仅供应用开发者使用。 + +![dfx特性概览](figures/dfx-overview.png) ## 基本概念 diff --git a/zh-cn/device-dev/subsystems/subsys-power-battery-level-customization.md b/zh-cn/device-dev/subsystems/subsys-power-battery-level-customization.md new file mode 100644 index 0000000000000000000000000000000000000000..907d4d25356c87e142b3b3c2146e34ef92646f73 --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-power-battery-level-customization.md @@ -0,0 +1,312 @@ +# 电量等级定制开发指导 + +## 概述 + +### 简介 + +OpenHarmony默认提供了电量等级,根据当前的电量来定义系统统一的电量等级,如满电量、高电量、低电量、极低电量等。系统可以根据当前的电量等级对用户进行提示或处理相关业务。但是电量等级对应的电量值在不同的产品上规格是不同的,产品希望根据产品的设计规格来定制此特性。为此OpenHarmony提供了电量等级的定制方式,产品定制开发者可根据设计规格来定制此特性。 + +### 约束与限制 + +配置策略: +产品定制的配置路径,需要根据[配置策略](https://gitee.com/openharmony/customization_config_policy)决定。本开发指导中的定制路径以/vendor进行举例,请开发者根据具体的产品配置策略,修改定制路径。 + +## 开发指导 + +### 搭建环境 + +设备要求: + +标准系统开发板,如DAYU200/Hi3516DV300开源套件。 + +环境要求: + +Linux调测环境,相关要求和配置可参考《[快速入门](../quick-start/quickstart-overview.md)》 + +### 开发步骤 + +本文以[DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568)为例介绍电池温度保护机制的定制方法。 + +1. 在产品目录[(/vendor/hihope/rk3568)](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568)下创建battery文件夹。 + +2. 参考[默认电量等级配置文件夹](https://gitee.com/openharmony/powermgr_battery_manager/tree/master/services/native/profile)创建目标文件夹,并安装到`//vendor/hihope/rk3568/battery`目录下,文件格式如下: + + ```text + profile + ├── BUILD.gn + ├── battery_config.json + ``` + +3. 参考[默认电量等级的配置文件夹中的battery_config.json](https://gitee.com/openharmony/powermgr_battery_manager/blob/master/services/native/profile/battery_config.json)编写定制的battery_config.json,包含定制后的电量等级配置如下: + + ```json + { + "soc": { + "shutdown": 5, + "critical": 10, + "warning": 15, + "low": 30, + "normal": 60, + "high": 90, + "full": 100 + } + } + ``` + + **表1** 电量等级配置说明 + + | 电量等级 | 电量 | 说明 | + | -------- | -------- | -------- | + | shutdown | 5 | 关机电量 | + | critical | 10 | 极低电量 | + | warning | 15 | 告警电量 | + | low | 30 | 低电量 | + | normal | 60 | 正常电量 | + | high | 90 | 高电量 | + | full | 100 | 满电量 | + + +4. 参考[默认电量等级的配置文件夹中的BUILD.gn](https://gitee.com/openharmony/powermgr_battery_manager/blob/master/services/native/profile/BUILD.gn)编写BUILD.gn文件,将battery_config.json打包到`//vendor/etc/battery`目录下,配置如下: + + ```shell + import("//build/ohos.gni") #引用build/ohos.gni + + ohos_prebuilt_etc("battery_config") { + source = "battery_config.json" + relative_install_dir = "battery" + install_images = [ chipset_base_dir ] #安装到vendor目录下的必要配置 + part_name = "product_rk3568" #part_name为product_rk3568,以实现后续编译 + } + ``` + +5. 将编译目标添加到`/vendor/hihope/rk3568`目录下[ohos.build](https://gitee.com/openharmony/vendor_hihope/blob/master/rk3568/ohos.build)的"module_list"中,例如: + + ```json + { + "parts": { + "product_rk3568": { + "module_list": [ + "//vendor/hihope/rk3568/default_app_config:default_app_config", + "//vendor/hihope/rk3568/image_conf:custom_image_conf", + "//vendor/hihope/rk3568/preinstall-config:preinstall-config", + "//vendor/hihope/rk3568/resourceschedule:resourceschedule", + "//vendor/hihope/rk3568/etc:product_etc_conf", + "//vendor/hihope/rk3568/battery/profile:battery_config" #添加battery_config的编译 + ] + } + }, + "subsystem": "product_hihope" + } + ``` + “//vendor/hihope/rk3568/battery/”为文件夹路径,“profile”为创建的文件夹名字,“battery_config”为编译目标。 + +6. 参考《[快速入门](../quick-start/quickstart-overview.md)》编译定制版本,编译命令如下: + + ```shell + ./build.sh --product-name rk3568 --ccache + ``` + +7. 将定制版本烧录到DAYU200开发板中。 + +### 调测验证 + +1. 开机后,进入shell命令行: + ``` + hdc shell + ``` + +2. 进入电池电量的节点路径(以当前DAYU开发版路径为例)。 + ``` + cd /data/service/el0/battery/battery/ + ``` + +3. 默认充电类型的映射配置数据为例,修改充电状态,模拟电池信息上报,观察发送是否发送对应充电类型广播。 + + 1. 修改电量信息。 + ``` + echo 100 > capacity + ``` + 2. 上报电量信息改变,获取当前电量等级。 + ``` + hidumper -s 3302 -a -i + ``` + 3. 成功获取电量等级如下: + + ``` + -------------------------------[ability]------------------------------- + + + ----------------------------------BatteryService--------------------------------- + Current time: 2017-08-05 17:22:48.589 + + ······(省略其他,只显示batteryLevel的配置) + + batteryLevel: 1 + + ······ + ``` + + 4. 修改电量信息。 + ``` + echo 90 > capacity + ``` + 5. 上报电量信息改变,获取当前电量等级。 + ``` + hidumper -s 3302 -a -i + ``` + 6. 成功获取电量等级如下: + + ``` + -------------------------------[ability]------------------------------- + + + ----------------------------------BatteryService--------------------------------- + Current time: 2017-08-05 17:24:29.716 + + ······(省略其他,只显示batteryLevel的配置) + + batteryLevel: 2 + + ······ + ``` + + 7. 修改电量信息。 + ``` + echo 60 > capacity + ``` + 8. 上报电量信息改变,获取当前电量等级。 + ``` + hidumper -s 3302 -a -i + ``` + 9. 成功获取电量等级如下: + + ``` + -------------------------------[ability]------------------------------- + + + ----------------------------------BatteryService--------------------------------- + Current time: 2017-08-05 17:25:09.837 + + ······(省略其他,只显示batteryLevel的配置) + + batteryLevel: 3 + + ······ + ``` + + 10. 修改电量信息。 + ``` + echo 30 > capacity + ``` + 11. 上报电量信息改变,获取当前电量等级。 + ``` + hidumper -s 3302 -a -i + ``` + 12. 成功获取电量等级如下: + + ``` + -------------------------------[ability]------------------------------- + + + ----------------------------------BatteryService--------------------------------- + Current time: 2017-08-05 17:26:20.495 + + ······(省略其他,只显示batteryLevel的配置) + + batteryLevel: 4 + + ······ + ``` + + 13. 修改电量信息。 + ``` + echo 15 > capacity + ``` + 14. 上报电量信息改变,获取当前电量等级。 + ``` + hidumper -s 3302 -a -i + ``` + 15. 成功获取电量等级如下: + + ``` + -------------------------------[ability]------------------------------- + + + ----------------------------------BatteryService--------------------------------- + Current time: 2017-08-05 17:27:05.312 + + ······(省略其他,只显示batteryLevel的配置) + + batteryLevel: 5 + + ······ + ``` + + 16. 修改电量信息。 + ``` + echo 10 > capacity + ``` + 17. 上报电量信息改变,获取当前电量等级。 + ``` + hidumper -s 3302 -a -i + ``` + 18. 成功获取电量等级如下: + + ``` + -------------------------------[ability]------------------------------- + + + ----------------------------------BatteryService--------------------------------- + Current time: 2017-08-05 17:27:56.270 + + ······(省略其他,只显示batteryLevel的配置) + + batteryLevel: 6 + + ······ + ``` + + 19. 修改电量信息。 + ``` + echo 5 > capacity + ``` + 20. 上报电量信息改变,获取当前电量等级。 + ``` + hidumper -s 3302 -a -i + ``` + 21. 成功获取电量等级如下: + + ``` + -------------------------------[ability]------------------------------- + + + ----------------------------------BatteryService--------------------------------- + Current time: 2017-08-05 17:28:38.066 + + ······(省略其他,只显示batteryLevel的配置) + + batteryLevel: 7 + + ······ + ``` + +## 参考 +开发过程中可参考的配置文件路径:[电量等级配置源码路径](https://gitee.com/openharmony/powermgr_battery_manager/tree/master/services/native/profile/) + +默认配置: + +```json +{ + "soc": { + "shutdown": 1, + "critical": 5, + "warning": 10, + "low": 20, + "normal": 90, + "high": 99, + "full": 100 + } +} +``` + +打包路径:/system/etc/battery diff --git a/zh-cn/device-dev/subsystems/subsys-power-brightness-customization.md b/zh-cn/device-dev/subsystems/subsys-power-brightness-customization.md new file mode 100644 index 0000000000000000000000000000000000000000..2bc3a430672cab658d556d5a5c1425c66cf6cd07 --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-power-brightness-customization.md @@ -0,0 +1,191 @@ +# 系统亮度范围定制开发指导 + +## 概述 + +### 简介 + +OpenHarmony默认的亮度范围为0 ~ 255(0代表最小亮度,255代表最大亮度),是系统和所有应用窗口的亮度调节范围。部分显示设备受到其硬件约束,亮度调节范围无法达到0 ~ 255,即无法达到默认的亮度调节范围。为此OpenHarmony提供了系统亮度范围定制方式,在与不同显示设备适配时,产品定制开发者可根据显示设备自身硬件条件灵活调整系统亮度范围。 + +### 基本概念 + +系统亮度: +OpenHarmony系统全局的亮度,调节后会使所有应用窗口亮度范围更改为定制的系统亮度范围。 + +窗口亮度: +某个应用窗口的亮度,调节后只影响此窗口,窗口退出后,恢复为系统亮度。当设置窗口亮度后,此窗口的亮度不受系统亮度的影响。 + +### 约束与限制 + +[OpenHarmony系统参数](./subsys-boot-init-sysparam.md)为各系统服务提供简单易用的键值对访问接口,使得各个系统服务可以通过各自的系统参数来进行业务功能的配置。系统亮度范围的定制基于此特性实现。 + +## 开发指导 + +### 搭建环境 + +设备要求: + +标准系统开发板,如DAYU200/Hi3516DV300开源套件。 + +环境要求: + +Linux调测环境,相关要求和配置可参考《[快速入门](../quick-start/Readme-CN.md)》。 + +### 开发步骤 + +1. 参考[默认亮度范围配置文件夹](https://gitee.com/openharmony/powermgr_display_manager/tree/master/service/etc)创建目标文件夹,并安装到相应目录,文件格式如下: + + ```text + etc + ├── BUILD.gn + ├── display.para + ├── display.para.dac + ``` + +2. 参考[默认亮度范围配置文件夹中的display.para](https://gitee.com/openharmony/powermgr_display_manager/blob/master/service/etc/display.para)编写定制的display.para。包含定制后的亮度阈值,以max=150,default=75,min=50为例: + + ```shell + # Brightness limits is 0-255. + const.display.brightness.min=50 + const.display.brightness.default=75 + const.display.brightness.max=150 + ``` + +3. 参考[默认亮度范围配置文件夹中的display.para.dac](https://gitee.com/openharmony/powermgr_display_manager/blob/master/service/etc/display.para.dac)编写display.para.dac数据访问控制文件,保证有权限解析定制后的配置: + + ```shell + const.display.brightness.="foundation:foundation:444" + ``` + +4. 参考[默认亮度范围配置文件夹中的BUILD.gn](https://gitee.com/openharmony/powermgr_display_manager/blob/master/service/etc/BUILD.gn)编写BUILD.gn文件,将display.para和display.para.dac打包到/vendor/etc/param目录下,例如: + + ```shell + import("//base/powermgr/display_manager/displaymgr.gni") + import("//build/ohos.gni") + + ## Install display.para to /vendor/etc/param/display.para + ohos_prebuilt_etc("display.para") { + source = "display.para" + relative_install_dir = "param" + install_images = [ chipset_base_dir ] + part_name = "${displaymgr_part_name}" + subsystem_name = "powermgr" + } + + ohos_prebuilt_etc("display.para.dac") { + source = "display.para.dac" + relative_install_dir = "param" + install_images = [ chipset_base_dir ] + part_name = "${displaymgr_part_name}" + subsystem_name = "powermgr" + } + + group("param_files") { + deps = [ + ":display.para", + ":display.para.dac", + ] + } + ``` + +5. 参考[默认亮度范围配置bundle.json](https://gitee.com/openharmony/powermgr_display_manager/blob/master/bundle.json)编写bundle.json文件,使BUILD.gn文件进行编译,例如: + + ```shell + "service_group": [ "//base/powermgr/display_manager/service/etc:param_files" ] + ``` + “//base/powermgr/display_manager/service”为文件夹路径,“etc”为创建的文件夹名字。 + +6. 参考《[快速入门](../quick-start/Readme-CN.md)》编译定制版本,以编译DAYU200为例,编译命令如下: + + ```shell + ./build.sh --product-name rk3568 --ccache + ``` + +7. 将定制版本烧录到DAYU200开发板中。 + +### 调测验证 + +1. 开机后,先进入shell命令行: + + ```shell + hdc shell + ``` + +2. 执行下列命令,观察console输出。 + + ```shell + hidumper -s 3308 -a -a + ``` + +3. console输出的是定制后的系统亮度阈值,如: + + 定制系统亮度阈值之前,默认为: + + ```shell + ----------------------------------DisplayPowerManagerService--------------------------------- + DISPLAY POWER MANAGER DUMP: + Display Id=0 State=2 Discount=1.000000 Brightness=102 + DeviceBrightness=102 + Support Ambient Light: FALSE + Auto Adjust Brightness: OFF + Brightness Limits: Max=255 Min=5 Default=102 + + ``` + + 本节以Max=150 Min=50 Default=75为例,更改之后: + + ```shell + # cd vendor/etc/param + # ls + display.para thermal.para usb.para.dac + display.para.dac thermal.para.dac + # cat display.para + # Copyright (C) 2022 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. + + # Brightness limits is 0-255. + const.display.brightness.min=50 + const.display.brightness.default=75 + const.display.brightness.max=150# + # + # cd + # hidumper -s 3308 -a -a + + -------------------------------[ability]------------------------------- + + + ----------------------------------DisplayPowerManagerService--------------------------------- + DISPLAY POWER MANAGER DUMP: + Display Id=0 State=0 Discount=1.000000 Brightness=75 + DeviceBrightness=75 + Support Ambient Light: FALSE + Auto Adjust Brightness: OFF + Brightness Limits: Max=150 Min=50 Default=75 + + ``` + +4. 系统全局的亮度阈值统一为定制后的,如设置中的亮度调节。 + +## 参考 + +开发过程中可参考的配置文件路径:[系统默认亮度范围配置源码路径](https://gitee.com/openharmony/powermgr_display_manager/tree/master/service/etc) + +默认配置: + +```shell +# Brightness limits is 0-255. +const.display.brightness.min=5 +const.display.brightness.default=102 +const.display.brightness.max=255 +``` + +打包路径:/system/etc/param \ No newline at end of file diff --git a/zh-cn/device-dev/subsystems/subsys-power-charge-current-voltage-limit.md b/zh-cn/device-dev/subsystems/subsys-power-charge-current-voltage-limit.md new file mode 100644 index 0000000000000000000000000000000000000000..990a97e3660d31cfe09e51ea8530143c32212566 --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-power-charge-current-voltage-limit.md @@ -0,0 +1,124 @@ +# 充电限流限压定制开发指导 + +## 概述 + +### 简介 + +OpenHarmony默认提供了充电限流限压的特性。在对终端设备进行充电时,由于环境影响,可能会导致电池温度过高,因此需要对充电电流或电压进行限制,从而保证终端设备使用的安全性。但是充电时的电流电压对安全性的影响在不同的产品上规格是不同的,产品希望根据产品的设计规格来定制此特性。为此OpenHarmony提供了充电限流限压的定制方式,产品定制开发者可根据产品的设计规格来定制此特性。 + +### 约束与限制 + +配置策略: +产品定制的配置路径,需要根据[配置策略](https://gitee.com/openharmony/customization_config_policy)决定。本开发指导中的定制路径以/vendor进行举例,请开发者根据具体的产品配置策略,修改定制路径。 + +## 开发指导 + +### 搭建环境 + +设备要求: + +标准系统开发板,如DAYU200/Hi3516DV300开源套件。 + +环境要求: + +Linux调测环境,相关要求和配置可参考《[快速入门](../quick-start/quickstart-overview.md)》。 + +### 开发步骤 + +本文以[DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568)为例介绍电池温度保护机制的定制方法。 + +1. 在产品目录[(/vendor/hihope/rk3568)](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568)下创建battery文件夹。 + +2. 参考[默认充电限流限压配置文件夹](https://gitee.com/openharmony/powermgr_battery_manager/tree/master/services/native/profile)创建目标文件夹,并安装到`//vendor/hihope/rk3568/battery`目录下,文件格式如下: + + ```text + profile + ├── BUILD.gn + ├── battery_config.json + ``` + +3. 参考[默认充电限流限压的配置文件夹中的battery_config.json](https://gitee.com/openharmony/powermgr_battery_manager/blob/master/services/native/profile/battery_config.json)编写定制的battery_config.json,包含定制后的充电限流限压配置如下: + + ```json + { + "charger": { + "current_limit":{ + "path": "/data/service/el0/battery/current_limit" + }, + "voltage_limit":{ + "path": "/data/service/el0/battery/voltage_limit" + } + } + } + ``` + +4. 参考[默认充电限流限压的配置文件夹中的BUILD.gn](https://gitee.com/openharmony/powermgr_battery_manager/blob/master/services/native/profile/BUILD.gn)编写BUILD.gn文件,将battery_config.json打包到`//vendor/etc/battery`目录下,配置如下: + + ```shell + import("//build/ohos.gni") #引用build/ohos.gni + + ohos_prebuilt_etc("battery_config") { + source = "battery_config.json" + relative_install_dir = "battery" + install_images = [ chipset_base_dir ] #安装到vendor目录下的必要配置 + part_name = "product_rk3568" #part_name为product_rk3568,以实现后续编译 + } + ``` + +5. 将编译目标添加到`/vendor/hihope/rk3568`目录下[ohos.build](https://gitee.com/openharmony/vendor_hihope/blob/master/rk3568/ohos.build)的"module_list"中,例如: + + ```json + { + "parts": { + "product_rk3568": { + "module_list": [ + "//vendor/hihope/rk3568/default_app_config:default_app_config", + "//vendor/hihope/rk3568/image_conf:custom_image_conf", + "//vendor/hihope/rk3568/preinstall-config:preinstall-config", + "//vendor/hihope/rk3568/resourceschedule:resourceschedule", + "//vendor/hihope/rk3568/etc:product_etc_conf", + "//vendor/hihope/rk3568/battery/profile:battery_config" #添加battery_config的编译 + ] + } + }, + "subsystem": "product_hihope" + } + ``` + “//vendor/hihope/rk3568/battery/”为文件夹路径,“profile”为创建的文件夹名字,“battery_config”为编译目标。 + +6. 参考《[快速入门](../quick-start/quickstart-overview.md)》编译定制版本,编译命令如下: + + ```shell + ./build.sh --product-name rk3568 --ccache + ``` + +7. 将定制版本烧录到DAYU200开发板中。 + +### 调测验证 + +1. 编译battery对应的hats测试用例,编译命令与框架搭建参考[XTS子系统](https://gitee.com/openharmony/xts_hats)。 + +2. 用框架执行测试,输出测试报告。 + + ![battery_limit_current_test_report](figures/battery_limit_current_test_report.jpg) + +## 参考 + +开发过程中可参考[默认充电限流限压的配置文件夹中的battery_config.json](https://gitee.com/openharmony/powermgr_battery_manager/blob/master/services/native/profile/battery_config.json) + +默认配置: + +```json +{ + "charger": { + "current_limit":{ + "path": "/data/service/el0/battery/current_limit" + }, + "voltage_limit":{ + "path": "/data/service/el0/battery/voltage_limit" + } + } +} +``` + +打包路径:/system/etc/battery \ No newline at end of file diff --git a/zh-cn/device-dev/subsystems/subsys-power-charge-type-customization.md b/zh-cn/device-dev/subsystems/subsys-power-charge-type-customization.md new file mode 100644 index 0000000000000000000000000000000000000000..2d533347e869c4bb114fa69d0e0939d428d58013 --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-power-charge-type-customization.md @@ -0,0 +1,157 @@ +# 充电类型定制开发指导 + +## 概述 + +### 简介 + +OpenHarmony默认提供了充电类型的特性。在对终端设备进行充电时,可以使用不同的充电器类型,如有线快充、无线快充等。系统可以根据当前的充电类型展示相应的动画或处理相关业务,但是不同产品支持的充电类型不同,需要根据产品的设计规格来定制此特性。为此OpenHarmony提供了充电类型的定制方式,产品定制开发者可根据产品的设计规格来定制此特性。 + +### 约束与限制 + +配置策略: +产品定制的配置路径,需要根据[配置策略](https://gitee.com/openharmony/customization_config_policy)决定。本开发指导中的定制路径以/vendor进行举例,请开发者根据具体的产品配置策略,修改定制路径。 + +## 开发指导 + +### 搭建环境 + +设备要求: + +标准系统开发板,如DAYU200/Hi3516DV300开源套件。 + +环境要求: + +Linux调测环境,相关要求和配置可参考《[快速入门](../quick-start/quickstart-overview.md)》。 + +### 开发步骤 + +本文以[DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568)为例介绍电池温度保护机制的定制方法。 + +1. 在产品目录[(/vendor/hihope/rk3568)](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568)下创建battery文件夹。 + +2. 参考[默认充电类型配置文件夹](https://gitee.com/openharmony/powermgr_battery_manager/tree/master/services/native/profile)创建目标文件夹,并安装到`//vendor/hihope/rk3568/battery`目录下,文件格式如下: + + ```text + profile + ├── BUILD.gn + ├── battery_config.json + ``` + +3. 参考[默认充电类型的配置文件夹中的battery_config.json](https://gitee.com/openharmony/powermgr_battery_manager/blob/master/services/native/profile/battery_config.json)编写定制的battery_config.json,包含定制后的充电类型配置如下: + + ```shell + { + "charger": { + "type": { + "path": "/data/service/el0/battery/charger_type" + } + } + } + ``` + +4. 参考[默认充电类型的配置文件夹中的BUILD.gn](https://gitee.com/openharmony/powermgr_battery_manager/blob/master/services/native/profile/BUILD.gn)编写BUILD.gn文件,将battery_config.json打包到`//vendor/etc/battery`目录下,配置如下: + + ```shell + import("//build/ohos.gni") #引用build/ohos.gni + + ohos_prebuilt_etc("battery_config") { + source = "battery_config.json" + relative_install_dir = "battery" + install_images = [ chipset_base_dir ] #安装到vendor目录下的必要配置 + part_name = "product_rk3568" #part_name为product_rk3568,以实现后续编译 + } + ``` + +5. 将编译目标添加到`/vendor/hihope/rk3568`目录下[ohos.build](https://gitee.com/openharmony/vendor_hihope/blob/master/rk3568/ohos.build)的"module_list"中,例如: + + ```json + { + "parts": { + "product_rk3568": { + "module_list": [ + "//vendor/hihope/rk3568/default_app_config:default_app_config", + "//vendor/hihope/rk3568/image_conf:custom_image_conf", + "//vendor/hihope/rk3568/preinstall-config:preinstall-config", + "//vendor/hihope/rk3568/resourceschedule:resourceschedule", + "//vendor/hihope/rk3568/etc:product_etc_conf", + "//vendor/hihope/rk3568/battery/profile:battery_config" #添加battery_config的编译 + ] + } + }, + "subsystem": "product_hihope" + } + ``` + “//vendor/hihope/rk3568/battery/”为文件夹路径,“profile”为创建的文件夹名字,“battery_config”为编译目标。 + +6. 参考《[快速入门](../quick-start/quickstart-overview.md)》编译定制版本,编译命令如下: + + ```shell + ./build.sh --product-name rk3568 --ccache + ``` + +7. 将定制版本烧录到DAYU200开发板中。 + +### 调测验证 + + +1. 开机后,进入shell命令行: + ``` + hdc shell + ``` + +2. 进入电池电量的节点路径(以当前DAYU开发版路径为例)。 + ``` + cd /data/service/el0/battery/ + ``` + +3. 默认充电类型的映射配置数据为例,修改充电状态,模拟电池信息上报,观察发送是否发送对应充电类型广播。 + 1. 修改充电类型 + ``` + echo 1 > charger_type + ``` + 2. 上报改变充电状态,触发映射 + ``` + hidumper -s 3302 -a -r + ``` + 3. 输出定制后的充电类型 + ``` + hidumper -s 3302 -a -i + ``` + ``` + -------------------------------[ability]---------------------------- + ------------------------------BatteryService------------------------ + capacity: 11 + batteryLevel: 4 + chargingStatus: 1 + healthState: 1 + pluggedType: 2 + voltage: 4123456 + present: 0 + technology: Li-ion + nowCurrent: 1000 + currentAverage: 1000 + totalEnergy: 4000000 + remainingEnergy: 4000000 + remainingChargeTime: 0 + temperature: 222 + chargeType: 1 + ``` + ![charger_type1](figures/charger_type1.jpg) + + +## 参考 +开发过程中可参考的配置文件路径:[充电类型的配置bundle.json](https://gitee.com/openharmony/powermgr_battery_manager/tree/master/services/native/profile/) + +默认配置 + + ```shell + { + "charger": { + "type": { + "path": "/data/service/el0/battery/charger_type" + } + } + } + ``` + +打包路径:/system/etc/battery diff --git a/zh-cn/device-dev/subsystems/subsys-power-level-LED-color.md b/zh-cn/device-dev/subsystems/subsys-power-level-LED-color.md new file mode 100644 index 0000000000000000000000000000000000000000..b20548fbae050749788b8c54f97cd30623d049b2 --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-power-level-LED-color.md @@ -0,0 +1,237 @@ +# 电量与LED灯颜色的定制开发指导 + +## 概述 + +### 简介 + +OpenHarmony默认提供了电量与LED灯颜色的映射关系。对于部分产品形态(如Pad),会使用LED灯的颜色来展示当前设备充电时的电量信息,如高电量使用绿色、低电量黄色、极低电量使用红色。这种电量与LED灯颜色的映射关系,需要根据产品进行自定义。为此OpenHarmony提供了电量与LED灯颜色映射的定制方式,产品定制开发者可根据产品的设计规格来定制此特性。 + +### 约束与限制 + +配置策略: +产品定制的配置路径,需要根据[配置策略](https://gitee.com/openharmony/customization_config_policy)决定。本开发指导中的定制路径以/vendor进行举例,请开发者根据具体的产品配置策略,修改定制路径。 + +## 开发指导 + +### 搭建环境 + +设备要求: + +标准系统开发板,如DAYU200/Hi3516DV300开源套件。 + +环境要求: + +Linux调测环境,相关要求和配置可参考《[快速入门](../quick-start/quickstart-overview.md)》。 + +### 开发步骤 + +本文以[DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568)为例介绍电池温度保护机制的定制方法。 + +1. 在产品目录[(/vendor/hihope/rk3568)](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568)下创建battery文件夹。 + +2. 参考[默认电量与LED灯颜色映射的配置文件夹](https://gitee.com/openharmony/powermgr_battery_manager/tree/master/services/native/profile)创建目标文件夹,并安装到`//vendor/hihope/rk3568/battery`目录下,文件格式如下: + + ```text + profile + ├── BUILD.gn + ├── battery_config.json + ``` + +3. 参考[默认电量与LED灯颜色映射的配置文件夹中的battery_config.json](https://gitee.com/openharmony/powermgr_battery_manager/blob/master/services/native/profile/battery_config.json)编写定制的battery_config.json。包含定制后的电量与LED灯颜色映射配置如下: + + ```json + { + "light": { + "low": { + "soc": [0, 20], + "rgb": [255, 192, 203] + }, + "normal": { + "soc": [20, 95], + "rgb": [255, 0, 255] + }, + "high": { + "soc": [95, 100], + "rgb": [0, 0, 255] + } + } + } + ``` + + **表1** 电量等级说明 + + | 电量等级 | 描述 | + | -------- | -------- | + | low | 低电量 | + | normal | 正常电量 | + | high | 高电量 | + + **表2** 电量区间与LED灯颜色映射配置说明 + + | 配置项 | 描述 | + | -------- | -------- | + | soc | 电量区间 | + | rgb | LED灯RGB组合 | + + +4. 参考[默认电量与LED灯颜色映射的配置文件夹中的BUILD.gn](https://gitee.com/openharmony/powermgr_battery_manager/blob/master/services/native/profile/BUILD.gn)编写BUILD.gn文件,将battery_config.json打包到`//vendor/etc/battery`目录下,配置如下: + + ```shell + import("//build/ohos.gni") #引用build/ohos.gni + + ohos_prebuilt_etc("battery_config") { + source = "battery_config.json" + relative_install_dir = "battery" + install_images = [ chipset_base_dir ] #安装到vendor目录下的必要配置 + part_name = "product_rk3568" #part_name为product_rk3568,以实现后续编译 + } + ``` + +5. 将编译目标添加到`/vendor/hihope/rk3568`目录下[ohos.build](https://gitee.com/openharmony/vendor_hihope/blob/master/rk3568/ohos.build)的"module_list"中,例如: + + ```json + { + "parts": { + "product_rk3568": { + "module_list": [ + "//vendor/hihope/rk3568/default_app_config:default_app_config", + "//vendor/hihope/rk3568/image_conf:custom_image_conf", + "//vendor/hihope/rk3568/preinstall-config:preinstall-config", + "//vendor/hihope/rk3568/resourceschedule:resourceschedule", + "//vendor/hihope/rk3568/etc:product_etc_conf", + "//vendor/hihope/rk3568/battery/profile:battery_config" #添加battery_config的编译 + ] + } + }, + "subsystem": "product_hihope" + } + ``` + “//vendor/hihope/rk3568/battery/”为文件夹路径,“profile”为创建的文件夹名字,“battery_config”为编译目标。 + +6. 参考《[快速入门](../quick-start/quickstart-overview.md)》编译定制版本,编译命令如下: + + ```shell + ./build.sh --product-name rk3568 --ccache + ``` + +7. 将定制版本烧录到DAYU200开发板中。 + +### 调测验证 + +1. 开机后,进入shell命令行。 + ``` + hdc shell + ``` + +2. 进入电池电量的节点路径(以当前DAYU开发版路径为例)。 + ``` + cd /data/service/el0/battery/battery + ``` + +3. 以默认的电量与LED灯颜色的映射配置数据为例,修改电量数值,模拟电池信息上报,并观察LED亮灯颜色变化。 + + 1. 修改电量数值 + ``` + echo 5 > capacity + ``` + 2. 上报电量信息改变,触发LED灯映射 + ``` + hidumper -s 3302 -a -r + ``` + ![low_power_led](figures/low_power_led.jpg) + + 3. 修改电量数值 + ``` + echo 50 > capacity + ``` + 4. 上报电量信息改变,触发LED灯映射 + ``` + hidumper -s 3302 -a -r + ``` + ![normal_power_led](figures/normal_power_led.jpg) + + 5. 修改电量数值 + ``` + echo 100 > capacity + ``` + 6. 上报电量信息改变,触发LED灯映射 + ``` + hidumper -s 3302 -a -r + ``` + ![high_power_led](figures/high_power_led.jpg) + +4. 以新的电量与LED灯颜色的映射配置数据为例,更改之后: + ```json + { + "light": { + "low": { + "soc": [0, 20], + "rgb": [255, 192, 203] + }, + "normal": { + "soc": [20, 95], + "rgb": [255, 0, 255] + }, + "high": { + "soc": [95, 100], + "rgb": [0, 0, 255] + } + } + } + ``` + + 1. 修改电量数值 + ``` + echo 15 > capacity + ``` + 2. 上报电量信息改变,触发LED灯映射 + ``` + hidumper -s 3302 -a -r + ``` + ![low_power_led_alter](figures/low_power_led_alter.jpg) + + 3. 修改电量数值 + ``` + echo 95 > capacity + ``` + 4. 上报电量信息改变,触发LED灯映射 + ``` + hidumper -s 3302 -a -r + ``` + ![normal_power_led_alter](figures/normal_power_led_alter.jpg) + + 5. 修改电量数值 + ``` + echo 99 > capacity + ``` + 6. 上报电量信息改变,触发LED灯映射 + ``` + hidumper -s 3302 -a -r + ``` + ![high_power_led_alter](figures/high_power_led_alter.jpg) + +## 参考 +开发过程中可参考的配置文件路径:[系统默认亮度范围配置源码路径](https://gitee.com/openharmony/powermgr_battery_manager/tree/master/services/native/profile/) + +默认配置: + +```json +{ + "light": { + "low": { + "soc": [0, 10], + "rgb": [255, 0, 0] + }, + "normal": { + "soc": [10, 90], + "rgb": [255, 255, 0] + }, + "high": { + "soc": [90, 100], + "rgb": [0, 255, 0] + } + } +} +``` + +打包路径:/system/etc/battery diff --git a/zh-cn/device-dev/subsystems/subsys-power-mode-customization.md b/zh-cn/device-dev/subsystems/subsys-power-mode-customization.md new file mode 100644 index 0000000000000000000000000000000000000000..855f74755fd99bf721172fcef462fc8c0be2a2ba --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-power-mode-customization.md @@ -0,0 +1,285 @@ +# 电源模式定制开发指导 + +## 概述 + +### 简介 + +OpenHarmony默认提供了电源模式(如正常模式、性能模式、省电模式、极致省电模式)的特性。但由于不同产品的部件存在差异,导致在同样场景下电源模式的配置需要也存在差异,为此,OpenHarmony提供了电源管理的定制方式,产品定制开发者可根据产品的设计规格来定制这些特性。 + +### 基本概念 + +OpenHarmony支持的可定制的电源模式如下,每种模式对应了不同的电源和性能策略模式。 + +- 正常模式:默认的电源模式,无特殊需求的情况下,此模式下的系统亮度、灭屏时间,进入睡眠时间等均适合大部分用户的需要。 + +- 性能模式:强调性能表现的电源模式,如增加系统亮度、关闭灭屏时间、防止进入睡眠等。 + +- 省电模式:强调省电表现的电源模式,如降低系统亮度、缩短灭屏时间、缩短进入睡眠时间等。 + +- 极致省电模式:强调极致省电表现的电源模式,如大幅降低系统亮度、大幅缩短灭屏时间,大幅缩短进入睡眠时间等。 + + +### 约束与限制 + +产品定制的配置路径,需要根据[配置策略](https://gitee.com/openharmony/customization_config_policy)决定。本开发指导中的定制路径以`/vendor`进行举例,请开发者根据具体的产品配置策略,修改定制路径。 + +## 开发指导 + +### 搭建环境 + +设备要求: + +标准系统开发板,如DAYU200/Hi3516DV300开源套件。 + +环境要求: + +Linux调测环境,相关要求和配置可参考《[快速入门](../quick-start/quickstart-overview.md)》。 + +### 开发步骤 + +本文以定制[DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568)的电源模式为例介绍电源模式的定制方法: + +1. 在[vendor/hihope/rk3568](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568)下创建power_manager文件夹。 + +2. 参考[默认电源模式配置文件夹](https://gitee.com/openharmony/powermgr_power_manager/tree/master/services/native/profile)创建目标文件夹,并安装到//vendor/hihope/rk3568/power_manager,文件格式如下: + + ```text + profile + ├── BUILD.gn + ├── power_mode_config.xml + ``` + +3. 参考[默认电源模式配置文件夹中的power_mode_config.xml](https://gitee.com/openharmony/powermgr_power_manager/blob/master/services/native/profile/power_mode_config.xml)编写定制的power_mode_config.xml: + + proxy节点的说明是电源模式: + + **表1** proxy节点说明 + | 电源模式 | ID | + | :------ | --- | + | 正常模式 | 600 | + | 省电模式 | 601 | + | 性能模式 | 602 | + | 极致省电模式 | 603 | + + switch节点的说明是配置项: + + **表2** switch节点说明 + | 配置项 | ID | 取值范围 | + | :------ | ----- | ----- | + | 灭屏时间 | 101 | value是时长,为整数,value>=-1, 单位为毫秒(ms),-1为关闭灭屏功能。 | + | 系统自动睡眠时间 | 102 | value是时长,为整数,value>=-1, 单位为毫秒(ms),-1为关闭系统自动睡眠功能。 | + | 自动调节亮度 | 103 | value为是否开启,取值范围:
-1为关闭自动调节亮度功能,
1为开启开启自动调节亮度功能。 | + | 自动调节屏幕旋转 | 107 | value为是否开启,取值范围:
-1为关闭自动调节屏幕旋转,
1为开启自动调节屏幕旋转。 | + | 系统亮度 | 115 | value是亮度,为整数,取值范围:0~255。 | + | 震动开关 | 120 | value为是否开启,取值范围:
-1为关闭震动,
1为开启震动。 | + + 以正常模式为例: + + ```xml + + + + + + + + + + ``` + +4. 参考[默认电源模式配置文件夹中的BUILD.gn](https://gitee.com/openharmony/powermgr_power_manager/blob/master/services/native/profile/BUILD.gn)编写BUILD.gn文件,将power_mode_config.xml打包到 `/vendor/etc/power_config`目录下,例如: + + ```shell + import("//base/powermgr/power_manager/powermgr.gni") + import("//build/ohos.gni") + + ## Install vendor power_mode_config.xml to /vendor/etc/power_config/power_mode_config.xml + ohos_prebuilt_etc("power_mode_config_vendor") { # 自定义名称,例子中用名:power_mode_config_vendor + source = "power_mode_config.xml" + relative_install_dir = "power_config" + install_images = [ chipset_base_dir ] # 安装到vendor目录下的必要配置,chipset_base_dir = "vendor", 如果不配置,默认安装到system目录 + part_name = "${product_rk3568}" # part_name为product_rk3568,以实现后续编译 + } + + group("power_service_config") { + deps = [ ":power_mode_config_vendor" ] + } + + ``` + +5. 将编译目标添加到[rk3568默认的ohos.build](https://gitee.com/openharmony/vendor_hihope/blob/master/rk3568/ohos.build)的"module_list"中,例如: + + ```json + { + "parts": { + "product_rk3568": { + "module_list": [ + "//vendor/hihope/rk3568/default_app_config:default_app_config", + "//vendor/hihope/rk3568/image_conf:custom_image_conf", + "//vendor/hihope/rk3568/power_manager/profile:power_mode_config_vendor", # 添加power_mode_config_vendor的编译。 + "//vendor/hihope/rk3568/preinstall-config:preinstall-config", + "//vendor/hihope/rk3568/resourceschedule:resourceschedule", + "//vendor/hihope/rk3568/etc:product_etc_conf" + ] + } + }, + "subsystem": "product_hihope" + } + ``` + + +6. 参考《[快速入门](../quick-start/Readme-CN.md)》编译定制版本,编译命令如下: + + ```shell + ./build.sh --product-name rk3568 --ccache + ``` + +7. 将定制版本烧录到DAYU200开发板中。 + +### 调测验证 + +1. 开机后,先进入shell命令行: + + ```shell + hdc shell + ``` + +2. 设置电源模式为正常模式,并验证。 + + 1. 执行下列命令,更改电源模式,使设备进入正常模式: + + ```shell + power-shell setmode 600 + ``` + + 2. 成功进入正常模式: + + ```shell + Set Mode: 600 + Set Mode Success! + + ``` + 3. 执行下列命令,获取当前系统自动睡眠时间: + + ```shell + hidumper -s 3301 -a -a + + -------------------------------[ability]------------------------------- + + + ----------------------------------PowerManagerService--------------------------------- + POWER STATE DUMP: + Current State: INACTIVE Reason: 1 Time: 33227 + ScreenOffTime: Timeout=10000ms + ······(省略其他,只显示系统自动睡眠时间的配置) + + ``` + + 4. 点亮屏幕,观察设备屏幕,10秒后灭屏,设置成功。 + +3. 设置电源模式为省电模式,并验证。 + + 1. 执行下列命令,更改电源模式,使设备进入省电模式: + + ```shell + power-shell setmode 601 + ``` + + 2. 成功进入省电模式: + + ```shell + Set Mode: 601 + Set Mode Success! + + ``` + 3. 执行下列命令,获取当前系统自动睡眠时间: + + ```shell + hidumper -s 3301 -a -a + + -------------------------------[ability]------------------------------- + + + ----------------------------------PowerManagerService--------------------------------- + POWER STATE DUMP: + Current State: INACTIVE Reason: 1 Time: 33227 + ScreenOffTime: Timeout=20000ms + ······(省略其他,只显示系统自动睡眠时间的配置) + + ``` + + 4. 点亮屏幕,观察设备屏幕,20秒后灭屏,设置成功。 + +4. 设置电源模式为性能模式,并验证。 + + 1. 执行下列命令,更改电源模式,使设备进入性能模式: + + ```shell + power-shell setmode 602 + ``` + + 2. 成功进入性能模式: + + ```shell + Set Mode: 602 + Set Mode Success! + + ``` + 3. 执行下列命令,获取当前系统自动睡眠时间: + + ```shell + hidumper -s 3301 -a -a + + -------------------------------[ability]------------------------------- + + + ----------------------------------PowerManagerService--------------------------------- + POWER STATE DUMP: + Current State: INACTIVE Reason: 1 Time: 33227 + ScreenOffTime: Timeout=30000ms + ······(省略其他,只显示系统自动睡眠时间的配置) + + ``` + + 4. 点亮屏幕,观察设备屏幕,30秒后灭屏,设置成功。 + +5. 设置电源模式为致省电模式,并验证。 + + 1. 执行下列命令,更改电源模式,使设备进入极致省电模式: + + ```shell + power-shell setmode 603 + ``` + + 2. 成功进入极致省电模式: + + ```shell + Set Mode: 603 + Set Mode Success! + + ``` + 3. 执行下列命令,获取当前系统自动睡眠时间: + + ```shell + hidumper -s 3301 -a -a + + -------------------------------[ability]------------------------------- + + + ----------------------------------PowerManagerService--------------------------------- + POWER STATE DUMP: + Current State: INACTIVE Reason: 1 Time: 33227 + ScreenOffTime: Timeout=40000ms + ······(省略其他,只显示系统自动睡眠时间的配置) + + ``` + + 4. 点亮屏幕,观察设备屏幕,40秒后灭屏,设置成功。 + +## 参考 + +开发过程中可参考的配置文件路径:[系统默认电源模式配置源码路径](https://gitee.com/openharmony/powermgr_power_manager/tree/master/services/native/profile) + +[默认配置](https://gitee.com/openharmony/powermgr_power_manager/blob/master/services/native/profile/power_mode_config.xml) + +打包路径:`/system/etc/power_config/power_mode_config.xml` diff --git a/zh-cn/device-dev/subsystems/subsys-power-poweroff-charge-animation.md b/zh-cn/device-dev/subsystems/subsys-power-poweroff-charge-animation.md new file mode 100644 index 0000000000000000000000000000000000000000..927a6141a84431451005bc046223303800278e7c --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-power-poweroff-charge-animation.md @@ -0,0 +1,435 @@ +# 关机充电动画开发指导 + +## 概述 + +### 简介 + +OpenHarmony默认提供了关机充电动画的特性,展示关机状态下的充电电量、充电动画等信息。由于定制厂商希望定制符合自身规则和特点的显示样式,希望根据产品的设计规格来定制此特性。为此OpenHarmony提供了关机充电动画的定制方式,产品定制开发者可根据产品的设计规格来定制此特性。 + +### 约束与限制 + +配置策略: +产品定制的配置路径,需要根据[配置策略](https://gitee.com/openharmony/customization_config_policy)决定。本开发指导中的定制路径以/vendor进行举例,请开发者根据具体的产品配置策略,修改定制路径。 + +## 开发指导 + +### 搭建环境 + +设备要求: + +标准系统开发板,如DAYU200/Hi3516DV300开源套件。 + +环境要求: + +Linux调测环境,相关要求和配置可参考《[快速入门](../quick-start/quickstart-overview.md)》。 + +### 开发步骤 + +本文以[DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568)为例介绍电池温度保护机制的定制方法。 + +1. 在产品目录[(/vendor/hihope/rk3568)](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568)下创建animation文件夹。 + +2. 参考[默认关机充电动画配置文件夹](https://gitee.com/openharmony/powermgr_battery_manager/tree/master/charger/sa_profile)创建目标文件夹,并安装到`//vendor/hihope/rk3568/animation`目录下,文件格式如下: + + ```text + profile + ├── BUILD.gn + ├── animation.json + ``` + +3. 参考[关机充电动画图片资源](https://gitee.com/openharmony/powermgr_battery_manager/tree/master/charger/resources)创建resources文件夹放置构成动画的图片文件,并安装到`//vendor/hihope/rk3568/animation`目录下,文件格式如下: + + ```text + animation + ├── resources + ├── profile + ``` + +4. 参考[关机充电动画图片资源中的BUILD.gn](https://gitee.com/openharmony/powermgr_battery_manager/blob/master/charger/resources/BUILD.gn)编写BUILD.gn文件,放入`//vendor/hihope/rk3568/animation/resource`目录下,例如: + ```shell + import("//build/ohos.gni") + + ohos_prebuilt_etc("resources_config0") { + source = "loop00000.png" #图片资源 + relative_install_dir = "poweroff_charger_animation/resources" + install_images = [ chipset_base_dir ] #安装到vendor目录下的必要配置 + part_name = "product_rk3568" + } + +5. 参考[默认关机充电动画的配置文件夹中的animation.json](https://gitee.com/openharmony/powermgr_battery_manager/blob/master/charger/sa_profile/animation.json)编写定制的animation.json。包含定制后的关机充电动画配置如下: + + ```json + { + "id": "Charger", + "screenWidth": 720, + "screenHeight": 1280, + "dir": "/vendor/etc/charger/resources", + "bgColor": "#000000ff", + "subpages": [ + { + "id": "Animation", + "coms": [ + "Charging_Animation_Image", + "Charging_Percent_Label" + ], + "bgColor": "#000000ff" + }, + { + "id": "Lackpower_Charging_Prompt", + "coms": [ + "LackPower_Charging_Label" + ], + "bgColor": "#000000ff" + }, + { + "id": "Lackpower_Not_Charging_Prompt", + "coms": [ + "LackPower_Not_Charging_Label" + ], + "bgColor": "#000000ff" + } + ], + "default": { + "Common": { + "visible": false + }, + "UILabel": { + "bgColor": "#00000000", + "fontColor": "#ffffffe6", + "align": "center" + }, + "UIImageView": { + "imgCnt": 1, + "updInterval": 0, + "filePrefix": "" + } + }, + "coms": [ + { + "type": "UIImageView", + "id": "Charging_Animation_Image", + "x": 180, + "y": 410, + "w": 400, + "h": 400, + "resPath": "/vendor/etc/charger/resources/", + "imgCnt": 62, + "updInterval": 60, + "filePrefix": "loop" + }, + { + "type": "UILabel", + "id": "Charging_Percent_Label", + "text": "", + "x": 365, + "y": 580, + "w": 65, + "h": 43, + "fontSize": 32 + }, + { + "type": "UILabel", + "id": "LackPower_Charging_Label", + "text": "电池电量低", + "x": 229, + "y": 1037, + "w": 250, + "h": 45, + "fontSize": 42, + "fontColor": "#ff0000ff" + }, + { + "type": "UILabel", + "id": "LackPower_Not_Charging_Label", + "text": "电池电量低,请连接电源", + "x": 110, + "y": 1037, + "w": 500, + "h": 45, + "fontSize": 42, + "fontColor": "#ff0000ff" + } + ] + } + ``` + + **表1** 关机充电动画配置说明 + | 节点名称 | 作用 | + | -------- | -------- | + | id | 充电界面的唯一标识符 | + | screenWidth | 充电界面的屏幕宽度(像素点) | + | screenHeight | 充电界面的屏幕高度(像素点) | + | dir | 资源路径 | + | bgColor | 充电界面的背景颜色 | + | subpages | 充电界面的子页面 | + | coms | 充电界面的所有组件 | + | visible | 元素是否可见 | + | text | 组件的文本内容 | + | x | 组件的X轴坐标 | + | y | 组件的Y轴坐标 | + | w | 组件的宽度(像素点) | + | h | 组件的高度(像素点) | + | fontSize | 组件的字体大小 | + | fontColor | 文本的字体颜色 | + | align | 文本对齐方式 | + | imgCnt | 图片数量 | + | updInterval | 图片更新的时间间隔(毫秒) | + | filePrefix | 图片文件名的前缀 | + | type | 组件的类型 | + | resPath | 组件的资源文件路径 | + + + +6. 参考[默认关机充电动画的配置文件夹中的BUILD.gn](https://gitee.com/openharmony/powermgr_battery_manager/blob/master/charger/sa_profile/BUILD.gn)编写BUILD.gn文件,将animation.json打包到`/vendor/etc/charger`目录下,配置如下: + + ```shell + import("//build/ohos.gni") + + ohos_prebuilt_etc("animation_config") { + source = "animation.json" #引用build/ohos.gni + relative_install_dir = "animation/resources" + install_images = [ chipset_base_dir ] #安装到vendor目录下的必要配置 + part_name = "product_rk3568" #part_name为product_rk3568,以实现后续编译 + } + ``` + +7. 将编译目标添加到`/vendor/hihope/rk3568`目录下[ohos.build](https://gitee.com/openharmony/vendor_hihope/blob/master/rk3568/ohos.build)的"module_list"中,例如: + + ```json + { + "parts": { + "product_rk3568": { + "module_list": [ + "//vendor/hihope/rk3568/default_app_config:default_app_config", + "//vendor/hihope/rk3568/image_conf:custom_image_conf", + "//vendor/hihope/rk3568/preinstall-config:preinstall-config", + "//vendor/hihope/rk3568/resourceschedule:resourceschedule", + "//vendor/hihope/rk3568/etc:product_etc_conf", + "//vendor/hihope/rk3568/battery/profile:battery_config", + "//vendor/hihope/rk3568/animation/profile:animation_config" #添加animation_config的编译 + "//vendor/hihope/rk3568/animation/resource/resources_config0" #添加图片资源的编译 + ] + } + }, + "subsystem": "product_hihope" + } + ``` + “//vendor/hihope/rk3568/animation/”为文件夹路径,“profile”为创建的文件夹名字,“animation_config”为编译目标。 + +8. 参考《[快速入门](../quick-start/quickstart-overview.md)》编译定制版本,编译命令如下: + + ```shell + ./build.sh --product-name rk3568 --ccache + ``` + +9. 将定制版本烧录到DAYU200开发板中。 + +### 调测验证 + +1. 修改代码配置: + + 修改代码路径:base/startup/init/services/init/init_config.c + + 修改函数:ReadConfig + ``` + 修改后: + void ReadConfig(void) + { + // parse cfg + char buffer[32] = {0}; // 32 reason max leb + uint32_t len = sizeof(buffer); + SystemReadParam("ohos.boot.reboot_reason", buffer, &len); + INIT_LOGV("ohos.boot.reboot_reason %s", buffer); + ParseInitCfg(INIT_CONFIGURATION_FILE, NULL); //新增代码 + ReadFileInDir(OTHER_CHARGE_PATH, ".cfg", ParseInitCfg, NULL); //新增代码 + if (strcmp(buffer, "poweroff_charge") == 0) { + ParseInitCfg(INIT_CONFIGURATION_FILE, NULL); + ReadFileInDir(OTHER_CHARGE_PATH, ".cfg", ParseInitCfg, NULL); + } else if (InUpdaterMode() == 0) { + ParseInitCfg(INIT_CONFIGURATION_FILE, NULL); + ParseInitCfgByPriority(); + } else { + ReadFileInDir("/etc", ".cfg", ParseInitCfg, NULL); + } + } + ``` + +2. 使用hdc执行如下命令,使开发板进入关机充电状态。 + ``` + hdc shell + reboot charger + ``` + + ![animation_initial_power](figures/animation_initial_power.jpg) + +3. 进入电池电量的节点路径(以当前DAYU开发版路径为例)。 + ``` + cd /data/service/el0/battery/battery + ``` + +4. 修改电量数值,并观察充电动画数值变化。 + ``` + cat capacity + ``` + 修改当前电量为3 + ``` + echo 3 > capacity + ``` + ![animation_charing_power](figures/animation_charing_power.jpg) + +5. 在极低电量时(此处默认1%)修改充电状态,不同的充电状态对应显示动画或关机。 + + 1. 进入电池电量的节点路径。 + ``` + cd /data/service/el0/battery/battery + ``` + ``` + cat capacity + ``` + 2. 修改当前电量为1。 + ``` + echo 1 > capacity + ``` + 3. 查看当前状态。 + ``` + cat status + ``` + 当前状态为Charging + + ![animation_low_power](figures/animation_low_power.jpg) + + 4. 改变当前状态,为未连接电源状态。 + ``` + echo Not charging > status + ``` + ![animation_low_power2](figures/animation_low_power2.jpg) + + 5. 切为Discharging状态,直接进入关机状态。 + ``` + echo Discharging > status + ``` + +6. 以下对关机动画的图片进行可定制化的测试修改,步骤与上方相同,只是图片作出替换。 + + 1. 初始状态。 + + ![animation_charging_power2](figures/animation_charging_power2.jpg) + + 2. %3电量状态。 + + ![animation_initial_power2](figures/animation_initial_power2.jpg) + + 3. 1%电量,充电状态。 + + ![animation_low_power](figures/animation_low_power.jpg) + + 4. 1%电量,未充电状态。 + + ![animation_low_power2](figures/animation_low_power2.jpg) + + 5. 1%电量,Discharing状态。 + + 设备进入关机状态 + + + +## 参考 +开发过程中可参考的配置文件路径:[默认关机充电动画配置源码路径](https://gitee.com/openharmony/powermgr_battery_manager/blob/master/charger/sa_profile/animation.json) + +默认配置: +```json + { + "id": "Charger", + "screenWidth": 720, + "screenHeight": 1280, + "dir": "/vendor/etc/charger/resources", + "bgColor": "#000000ff", + "subpages": [ + { + "id": "Animation", + "coms": [ + "Charging_Animation_Image", + "Charging_Percent_Label" + ], + "bgColor": "#000000ff" + }, + { + "id": "Lackpower_Charging_Prompt", + "coms": [ + "LackPower_Charging_Label" + ], + "bgColor": "#000000ff" + }, + { + "id": "Lackpower_Not_Charging_Prompt", + "coms": [ + "LackPower_Not_Charging_Label" + ], + "bgColor": "#000000ff" + } + ], + "default": { + "Common": { + "visible": false + }, + "UILabel": { + "bgColor": "#00000000", + "fontColor": "#ffffffe6", + "align": "center" + }, + "UIImageView": { + "imgCnt": 1, + "updInterval": 0, + "filePrefix": "" + } + }, + "coms": [ + { + "type": "UIImageView", + "id": "Charging_Animation_Image", + "x": 180, + "y": 410, + "w": 400, + "h": 400, + "resPath": "/vendor/etc/charger/resources/", + "imgCnt": 62, + "updInterval": 60, + "filePrefix": "loop" + }, + { + "type": "UILabel", + "id": "Charging_Percent_Label", + "text": "", + "x": 365, + "y": 580, + "w": 65, + "h": 43, + "fontSize": 32 + }, + { + "type": "UILabel", + "id": "LackPower_Charging_Label", + "text": "电池电量低", + "x": 229, + "y": 1037, + "w": 250, + "h": 45, + "fontSize": 42, + "fontColor": "#ff0000ff" + }, + { + "type": "UILabel", + "id": "LackPower_Not_Charging_Label", + "text": "电池电量低,请连接电源", + "x": 110, + "y": 1037, + "w": 500, + "h": 45, + "fontSize": 42, + "fontColor": "#ff0000ff" + } + ] + } +``` + +打包路径:/system/etc/charger/resource diff --git a/zh-cn/device-dev/subsystems/subsys-power-stats-power-average-customization.md b/zh-cn/device-dev/subsystems/subsys-power-stats-power-average-customization.md new file mode 100644 index 0000000000000000000000000000000000000000..7669407897e490766665d41ca82e2fc08b708f80 --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-power-stats-power-average-customization.md @@ -0,0 +1,202 @@ +# 耗电统计定制开发指导 + +## 概述 + +### 简介 + +OpenHarmony默认提供了耗电统计的特性。由于不同产品的硬件规格是不同的,各个硬件的耗电基准也不同。产品希望根据产品的设计规格来定制耗电基准。OpenHarmony提供了耗电基准的定制方式,产品定制开发者可根据产品的设计规格来定制。 + +### 基本概念 + +耗电统计:在用户使用设备的过程中,各种软硬件服务会通过[HiSysEvent](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/subsystems/subsys-dfx-hisysevent-overview.md)上报软硬件的使用事件,根据这些事件可以计算软硬件的使用时长,然后基于硬件的耗电基准,统计所得软硬件的耗电量。 + +耗电基准:产品硬件在各种状态下的基准耗电量(单位:毫安时),如相机打开时的基准耗电量,CPU在各种频率下的基准耗电量等。 + +### 约束与限制 + +按照[配置策略组件介绍](https://gitee.com/openharmony/customization_config_policy)的说明,设定产品定制的配置路径,需要根据配置策略决定。本开发指南中的定制路径以`/vendor`进行举例,请开发者根据具体的产品配置策略,修改定制路径。 + +## 开发指导 + +### 搭建环境 + +设备要求: + +标准系统开发板,如DAYU200/Hi3516DV300开源套件。 + +环境要求: + +Linux调测环境,相关要求和配置可参考《[快速入门](../quick-start/quickstart-overview.md)》。 + +### 开发步骤 + +本文以[DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568)为例介绍耗电统计的定制方法。 + +1. 在产品目录[(vendor/hihope/rk3568)](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568)下创建battery_statistics文件夹。 + + +2. 参考[默认耗电统计配置文件夹](https://gitee.com/openharmony/powermgr_battery_statistics/tree/master/services/profile)创建目标文件夹,并安装到`vendor/hihope/rk3568/battery_statistics`目录,文件格式如下: + + ```shell + profile + ├── BUILD.gn # BUILD.gn文件 + └── power_average.json # 耗电统计配置文件,包含硬件的耗电基准 + ``` + +3. 参考[默认耗电统计配置文件夹中的power_average.json](https://gitee.com/openharmony/powermgr_battery_statistics/blob/master/services/profile/power_average.json)编写定制的power_average.json,包含定制后的耗电基准。详细说明如下: + + **表1** 耗电基准配置项说明 + | 配置项 | 硬件类型 | 数据类型 | 描述 | + |----------|------|---------|-------------------------------------------------------------------------| + | alarm_on | - | Double | 定时器Timer触发一次耗电量,即基准耗电量,用于计算系统或者应用对Timer使用的功耗。
- 功耗类型:软件功耗
- 统计方法:耗电量 = 触发次数 * 耗电基准 | + | bluetooth_br_on | Bluetooth | Double | 蓝牙开启时的基准耗电量,用于计算蓝牙开启过程中的功耗。
- 功耗类型:硬件功耗
- 统计方法:耗电量 = 持续时间 * 耗电基准 | + | bluetooth_br_scan | Bluetooth | Double | 蓝牙扫描状态的基准耗电量,用于计算蓝牙扫描过程中的功耗。
- 功耗类型:软件功耗
- 统计方法:耗电量 = 持续时间 * 耗电基准 | + | bluetooth_ble_on | Bluetooth | Double | 低功耗蓝牙开启时的基准耗电量,用于计算蓝牙开启过程中的功耗。
- 功耗类型:硬件功耗
- 统计方法:耗电量 = 持续时间 * 耗电基准 | + | bluetooth_ble_scan | Bluetooth | Double | 低功耗蓝牙扫描状态的基准耗电量,用于计算蓝牙扫描过程中的功耗。
- 功耗类型:软件功耗
- 统计方法:耗电量 = 持续时间 * 耗电基准 | + | wifi_on | WIFI | Double | WIFI开启时的基准耗电量,用于计算WIFI开启过程中的功耗。
- 功耗类型:硬件功耗
- 统计方法:耗电量 = 持续时间 * 耗电基准 | + | wifi_scan | WIFI | Double | WIFI扫描一次耗电量,用于计算WIFI扫描时的功耗。
- 功耗类型:硬件功耗
- 统计方法:耗电量 = 触发次数 * 耗电基准 | + | radio_on | Phone | Double数组 | 通话开启时的基准耗电量,数组形式,用于配置不同等级信号强度的基准耗电量。默认配置包括4个信号等级的基准耗电信息。
- 功耗类型:硬件功耗
- 统计方法:耗电量 = 持续时间 * 耗电基准 | + | radio_data | Phone | Double数组 | 网络开启时的基准耗电量,数组形式,用于配置不同等级信号强度的基准耗电量。默认配置包括4个信号等级的基准耗电信息。
- 功耗类型:硬件功耗
- 统计方法:耗电量 = 持续时间 * 耗电基准 | + | camera_on | Camera | Double | 相机开启时的基准耗电量,用于计算相机开启过程中的功耗。
- 功耗类型:软件功耗
- 统计方法:耗电量 = 持续时间 * 耗电基准 | + | flashlight_on | Flashlight | Double | 闪光灯开启时的基准耗电量,用于计算闪光灯开启过程中的功耗。
- 功耗类型:软件功耗
- 统计方法:耗电量 = 持续时间 * 耗电基准 | + | gnss_on | GNSS | Double | GNSS(Global Navigation Satellite System)开启时的基准耗电量,用于计算GNSS开启过程中的功耗。
- 功耗类型:软件功耗
- 统计方法:耗电量 = 持续时间 * 耗电基准 | + | sensor_gravity_on | Gravity Sensor | Double | 重力传感器开启时的基准耗电量,用于计算重力传感器开启过程中的功耗。
- 功耗类型:软件功耗
- 统计方法:耗电量 = 持续时间 * 耗电基准 | + | sensor_proximity_on | Proximity Sensor | Double | 接近传感器开启时的基准耗电量,用于计算接近传感器开启过程中的功耗。
- 功耗类型:软件功耗
- 统计方法:耗电量 = 持续时间 * 耗电基准 | + | audio_on | Audio | Double | 音响开启时的基准耗电量,用于计算音响开启过程中的功耗。
- 功耗类型:软件功耗
- 统计方法:耗电量 = 持续时间 * 耗电基准 | + | screen_on
screen_brightness | Screen | Double | screen_on:屏幕的基础状态下的基准耗电量(不包括屏幕亮度产生的耗电量);
screen_brightness:屏幕亮度每提升一个等级,需要额外增加的基准耗电量;
例如:假定条件,screen_on = 90,screen_brightness = 2,屏幕亮度为100,屏幕亮度100时的基准耗电量:90 + 2 * 100 = 290
- 功耗类型:硬件功耗
- 统计方法:耗电量 = 持续时间 * 耗电基准 | + | cpu_awake | CPU | Double | CPU唤醒锁持锁状态时的基准耗电量,用于计算CPU唤醒锁持锁状态时的功耗。
- 功耗类型:软件功耗
- 统计方法:耗电量 = 持续时间 * 耗电基准 | + | cpu_idle | CPU | Double | CPU空闲状态时的基准耗电量,用于计算CPU空闲状态的功耗。
- 功耗类型:软件功耗
- 统计方法:耗电量 = 持续时间 * 耗电基准 | + | cpu_suspend | CPU | Double | CPU休眠状态时的基准耗电量,用于计算CPU休眠状态的功耗。
- 功耗类型:软件功耗
- 统计方法:耗电量 = 持续时间 * 耗电基准 | + | cpu_active | CPU | Double | CPU活动状态时的基准耗电量,用于计算CPU活动状态的功耗。
- 功耗类型:软件功耗
- 统计方法:耗电量 = 持续时间 * 耗电基准 | + | cpu_clusters
cpu_speed_clusterX | CPU | Double数组 | cpu_clusters:cpu cluster的基准耗电量,数组形式,用于配置不同cpu cluster基准耗电量。默认配置包括3个不同cpu cluster基准耗电信息。
cpu_speed_clusterX:cpu cluster不同频率的基准耗电量,数组形式。X代表序号,默认配置中X的范围0~2,对应cpu_clusters数组大小。例如:默认配置cpu_clusters的数组大小为3,顺序对应配置项cpu_speed_cluster0、cpu_speed_cluster1、cpu_speed_cluster2。
- 扩展性:可扩展
- 功耗类型:软件功耗
- 统计方法:耗电量 = 持续时间 * 耗电基准 | + + >说明:表格中描述的硬件类型为真实硬件名称,不代表耗电统计类型,具体的耗电统计类型,请参考[ConsumptionType](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-batteryStatistics.md#consumptiontype)定义。 + +4. 参考[默认耗电统计配置文件夹中的BUILD.gn](https://gitee.com/openharmony/powermgr_battery_statistics/blob/master/services/profile/BUILD.gn)编写BUILD.gn文件,将power_average.json打包安装到`/vendor/etc/profile`目录下,例如: + + ```shell + import("//build/ohos.gni") # 引用build/ohos.gni + + # Install power_average.json to /vendor/etc/profile/power_average.json + ohos_prebuilt_etc("power_average_config") { # 自定义名称,例子中用名:power_average_config + source = "power_average.json" + relative_install_dir = "profile" + install_images = [ chipset_base_dir ] # 安装到vendor目录下的必要配置,chipset_base_dir = “vendor”, 如果不配置,默认安装到system目录 + part_name = "product_rk3568" # part_name为product_rk3568,以实现后续编译 + } + ``` + +5. 将编译目标添加到`/vendor/hihope/rk3568`目录下[ohos.build](https://gitee.com/openharmony/vendor_hihope/blob/master/rk3568/ohos.build)的“module_list”中,例如: + + ```json + { + "parts": { + "product_rk3568": { + "module_list": [ + "//vendor/hihope/rk3568/default_app_config:default_app_config", + "//vendor/hihope/rk3568/image_conf:custom_image_conf", + "//vendor/hihope/rk3568/battery_statistics/profile:power_average_config", # 添加power_average_config的编译 + "//vendor/hihope/rk3568/preinstall-config:preinstall-config", + "//vendor/hihope/rk3568/resourceschedule:resourceschedule", + "//vendor/hihope/rk3568/etc:product_etc_conf" + ] + } + }, + "subsystem": "product_hihope" + } + ``` + + “//vendor/hihope/rk3568/power/battery_statistics/”为文件夹路径,“profile”为创建的文件夹名字,“power_average_config”为编译目标。 + +6. 参考《[快速入门](../quick-start/quickstart-overview.md)》编译定制版本,编译命令如下: + + ```shell + ./build.sh --product-name rk3568 --ccache + ``` + +7. 将定制版本烧录到DAYU200开发板中。 + +### 调测验证 + +1. 开机后,先进入shell命令行。 + + ```shell + hdc shell + ``` + +2. 执行下列命令,观察vendor目录下power_average.json是否创建成功。 + + ```shell + ls -l /vendor/etc/profile/ + ``` + + 创建成功,在/vendor/etc/profile/存在配置文件power_average.json。 + + ```shell + # ls -l /vendor/etc/profile/ + total 4 + -rw-r--r-- 1 root root 1446 2023-03-26 16:47 power_average.json + # + ``` + +3. 如果创建成功,执行下列命令,观察vendor目录下power_average.json中的信息是否与定制信息一致。 + + ```shell + cat /vendor/etc/profile/power_average.json + ``` + +4. 如果信息一致,执行执行下列命令,观察console输出。 + + ```shell + hidumper -s 3304 -a -poweraverage + ``` + +5. console输出的是定制后的耗电基准信息,如: + + 定制耗电统计之前,使用默认耗电基准为: + + ```shell + # hidumper -s 3304 -a -poweraverage + + -------------------------------[ability]------------------------------- + + + ----------------------------------BatteryStatisticsService--------------------------------- + POWER AVERAGE CONFIGATION DUMP: + + ······(省略其他,只显示camera的配置) + + camera_on : 810.000000 + + ······ + ``` + + 本节以“camera_on”:3000为例(默认值为810),更改之后: + + ```shell + # hidumper -s 3304 -a -poweraverage + + -------------------------------[ability]------------------------------- + + + ----------------------------------BatteryStatisticsService--------------------------------- + POWER AVERAGE CONFIGATION DUMP: + + ······(省略其他,只显示camera的配置) + + camera_on : 3000.000000 # 修改后,“camera_on”:3000 + + ······ + ``` + +6. 耗电统计配置文件定制成功后,耗电统计会根据定制的耗电基准进行计算。 + +7. 通过batterystatistics模块提供的[JS API](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.batteryStatistics.d.ts)或[Inner API](https://gitee.com/openharmony/powermgr_battery_statistics/blob/master/interfaces/inner_api/include/battery_stats_client.h)可以获得详细的耗电信息,验证定制的耗电基准。 + +## 参考 + +开发过程中可参考的配置文件路径:[系统默认耗电统计配置源码路径](https://gitee.com/openharmony/powermgr_battery_statistics/tree/master/services/profile) + +默认打包路径:/system/etc/profile + +定制路径:/vendor/etc/profile diff --git a/zh-cn/device-dev/subsystems/subsys-power-temperature-protection.md b/zh-cn/device-dev/subsystems/subsys-power-temperature-protection.md new file mode 100644 index 0000000000000000000000000000000000000000..32e9ca73439657e6c5fc9f83660ac40f61b92696 --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-power-temperature-protection.md @@ -0,0 +1,178 @@ +# 电池温度保护定制开发指导 + +## 概述 + +### 简介 + +OpenHarmony默认提供了电池温度保护的特性。终端设备会在不同的温度环境中使用,当温度过高或过低时,都会影响到电池的安全性,因此需要进行一定的温度保护措施,如当温度过高或过低时,将设备关机。但是不同的电池设备支持的温度范围不同,需要根据产品的设计规格来定制此特性。为此OpenHarmony提供了电池温度保护的定制方式,产品定制开发者可根据产品的设计规格来定制此特性。 + +### 约束与限制 + +配置策略: +产品定制的配置路径,需要根据[配置策略](https://gitee.com/openharmony/customization_config_policy)决定。本开发指导中的定制路径以/vendor进行举例,请开发者根据具体的产品配置策略,修改定制路径。 + +## 开发指导 + +### 搭建环境 + +设备要求: + +标准系统开发板,如DAYU200/Hi3516DV300开源套件。 + +环境要求: + +Linux调测环境,相关要求和配置可参考《[快速入门](../quick-start/quickstart-overview.md)》。 + +### 开发步骤 +本文以[DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568)为例介绍电池温度保护机制的定制方法。 + +1. 在产品目录[(/vendor/hihope/rk3568)](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568)下创建battery文件夹。 + +2. 参考[默认电池温度保护配置文件夹](https://gitee.com/openharmony/powermgr_battery_manager/tree/master/services/native/profile)创建目标文件夹,并安装到`//vendor/hihope/rk3568/battery`目录下,文件格式如下: + + ```text + profile + ├── BUILD.gn + ├── battery_config.json + ``` + +3. 参考[默认电池温度保护的配置文件夹中的battery_config.json](https://gitee.com/openharmony/powermgr_battery_manager/blob/master/services/native/profile/battery_config.json)编写定制的battery_config.json,包含定制后的电池温度保护配置如下: + + ```json + { + "temperature": { + "high": 500, + "low": -400 + } + } + ``` + + **表1** 温度保护参数说明 + | 温度保护机制阈值 | 温度(摄氏度)| + | -------- | -------- | + | high | 600 | + | low | -500 | + + +4. 参考[默认电池温度保护的配置文件夹中的BUILD.gn](https://gitee.com/openharmony/powermgr_battery_manager/blob/master/services/native/profile/BUILD.gn)编写BUILD.gn文件,将battery_config.json打包到`//vendor/etc/battery`目录下,配置如下: + + ```shell + import("//build/ohos.gni") #引用build/ohos.gni + + ohos_prebuilt_etc("battery_config") { + source = "battery_config.json" + relative_install_dir = "battery" + install_images = [ chipset_base_dir ] #安装到vendor目录下的必要配置 + part_name = "product_rk3568" #part_name为product_rk3568,以实现后续编译 + } + ``` + +5. 将编译目标添加到`/vendor/hihope/rk3568`目录下[ohos.build](https://gitee.com/openharmony/vendor_hihope/blob/master/rk3568/ohos.build)的"module_list"中,例如: + + ```json + { + "parts": { + "product_rk3568": { + "module_list": [ + "//vendor/hihope/rk3568/default_app_config:default_app_config", + "//vendor/hihope/rk3568/image_conf:custom_image_conf", + "//vendor/hihope/rk3568/preinstall-config:preinstall-config", + "//vendor/hihope/rk3568/resourceschedule:resourceschedule", + "//vendor/hihope/rk3568/etc:product_etc_conf", + "//vendor/hihope/rk3568/battery/profile:battery_config" #添加battery_config的编译 + ] + } + }, + "subsystem": "product_hihope" + } + ``` + “//vendor/hihope/rk3568/battery/”为文件夹路径,“profile”为创建的文件夹名字,“battery_config”为编译目标。 + +6. 参考《[快速入门](../quick-start/quickstart-overview.md)》编译定制版本,编译命令如下: + + ```shell + ./build.sh --product-name rk3568 --ccache + ``` + +7. 将定制版本烧录到DAYU200开发板中。 + +### 调测验证 + +1. 开机后,进入shell命令行。 + ``` + hdc shell + ``` + +2. 进入电源温度的节点路径(以当前DAYU开发版路径为例)。 + ``` + cd /data/service/el0/battery/battery + ``` + +3. 以默认的电源温度保护配置数据为例,修改电池温度的模拟节点数值。 + + ``` + echo 700 > temp + ``` +4. 上报电池信息改变,触发温度保护。 + ``` + hidumper -s 3302 -a -r + ``` + 设备进入关机状态 + +5. 重新开机进入shell命令行,进入电源温度的节点路径。 + ``` + echo -600 > temp + ``` +6. 上报电池信息改变,触发温度保护。 + ``` + hidumper -s 3302 -a -r + ``` + 设备进入关机状态 + +7. 以新的电源温度保护配置数据为例,更改之后: + + ```json + { + "temperature": { + "high": 500, + "low": -400 + } + } + ``` + +8. 修改电池温度的模拟节点数值。 + ``` + echo 550 > temp + ``` + +9. 上报电池信息改变,触发温度保护。 + ``` + hidumper -s 3302 -a -r + ``` + 设备进入关机状态 + +10. 重新开机进入shell命令行,进入电源温度的节点路径。 + ``` + echo -450 > temp + ``` + +11. 上报电池信息改变,触发温度保护。 + ``` + hidumper -s 3302 -a -r + ``` + 设备进入关机状态 + +## 参考 +开发过程中可参考的配置文件路径:[系统默认电源温度保护范围配置源码路径](https://gitee.com/openharmony/powermgr_battery_manager/tree/master/services/native/profile/) + +默认配置: +```json +{ + "temperature": { + "high": 600, + "low": -500 + } +} +``` +打包路径:/system/etc/battery + diff --git a/zh-cn/device-dev/subsystems/subsys-security-devicesecuritylevel.md b/zh-cn/device-dev/subsystems/subsys-security-devicesecuritylevel.md index c01af8520e18340a0db72842ab7b328fda1f7f1d..1ac256d5d8db38e4a21a2b65ce57eb7b784ee416 100644 --- a/zh-cn/device-dev/subsystems/subsys-security-devicesecuritylevel.md +++ b/zh-cn/device-dev/subsystems/subsys-security-devicesecuritylevel.md @@ -418,7 +418,7 @@ eyJ0eXAiOiAiRFNMIn0=.eyJ0eXBlIjogImRlYnVnIiwgIm1hbnVmYWN0dXJlIjogIm9ob3MiLCAiYnJ ### 工具使用介绍 -为方便开发者对于“凭据文件”的进一步理解,设备安全等级管理模块提供了[凭据工具](https://gitee.com/openharmony/security_device_security_level/blob/master/oem_property/ohos/dslm_cred_tool.py),该工具是一个python脚本,基于OPENSSL命令行的简单封装,可以便捷的提供凭据文件的签发和验证功能。 +为方便开发者对于“凭据文件”的进一步理解,设备安全等级管理模块提供了[凭据工具](https://gitee.com/openharmony/security_device_security_level/blob/master/oem_property/ohos/standard/dslm_cred_tool.py),该工具是一个python脚本,基于OPENSSL命令行的简单封装,可以便捷的提供凭据文件的签发和验证功能。 其使用方法如下: 1. 签名密钥初始化: diff --git a/zh-cn/device-dev/subsystems/subsys-security-huks-guide.md b/zh-cn/device-dev/subsystems/subsys-security-huks-guide.md index e019d626238f9516e78fc512228e79b7facdd9ff..606c7df8fa0bcce378ca4e234d4df3b622f7e665 100644 --- a/zh-cn/device-dev/subsystems/subsys-security-huks-guide.md +++ b/zh-cn/device-dev/subsystems/subsys-security-huks-guide.md @@ -84,6 +84,7 @@ HUKS Core作为向应用提供密钥库能力的基础,包括密钥管理及 | [HuksHdiGetKeyProperties()](#hukshdigetkeyproperties) | 获取密钥属性。 |无 | getKeyProperties(keyAlias: string, options: HuksOptions)| | [HuksHdiAttestKey()](#hukshdiattestkey) | 获取密钥证书。 |出参要遵循certChain格式 | attestKey(keyAlias: string, options: HuksOptions)| | [HuksHdiExportChipsetPlatformPublicKey()](#hukshdiexportchipsetplatformpublickey) | 导出芯片平台级密钥对的公钥。 | 出参为ECC P256的x y轴值裸数据,各32字节 | 无 | +| [HuksHdiUpgradeKey()](#hukshdiupgradekey) | 升级密钥文件。 | 无 | 无 | - - - @@ -602,6 +603,40 @@ HUKS Core的初始化,包括锁,加密算法库,authtoken key和根密钥 - - - +#### HuksHdiUpgradeKey + +**接口描述** + +升级密钥文件。当密钥文件版本号小于最新版本号时,触发该升级能力。 + +**接口原型** +
int32_t (*HuksHdiUpgradeKey)(const struct HksBlob *oldKey, const struct HksParamSet *paramSet, struct HksBlob *newKey);
+ +
+ 参数说明 +
+  const struct HksBlob *oldKey
+  待升级的密钥文件数据
+  

+ const struct HksParamSet *paramSet + 升级密钥文件数据的参数 +

+ struct HksBlob *newKey + 出参,升级后的密钥文件数据 +
+
+

+ +
+ 返回值 + + - HKS_SUCCESS:成功 + + - 其他:失败 +
+ +- - - + ### 开发步骤 HDI接口到HUKS Core的适配在以下目录中: diff --git a/zh-cn/device-dev/subsystems/subsys-thermal_charging_idle_state.md b/zh-cn/device-dev/subsystems/subsys-thermal_charging_idle_state.md new file mode 100644 index 0000000000000000000000000000000000000000..63947c9f3442a75e8b9b5c3e7eeb3f3aa91df9ca --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-thermal_charging_idle_state.md @@ -0,0 +1,131 @@ +# 充电空闲状态定制开发指导 + +## 概述 + +### 简介 + +OpenHarmony默认提供了充电空闲状态的特性。根据设备的热等级、电量、充电状态和充电电流,来决策当前设备是否处于空闲状态,处于此种状态的设备可以执行一些重度的后台任务。但是各设备达到充电空闲状态的条件在不同的产品上规格是不同的,产品希望根据产品的设计规格来定制此特性。OpenHarmony提供了充电空闲状态的定制方式,产品定制开发者可根据产品的设计规格来定制这些特性。 + +### 约束与限制 + +产品定制的配置路径,需要根据[配置策略](https://gitee.com/openharmony/customization_config_policy)决定。本开发指导中的定制路径以`/vendor`进行举例,请开发者根据具体的产品配置策略,修改定制路径。 + +## 开发指导 + +### 搭建环境 + +设备要求: + +标准系统开发板,如DAYU200/Hi3516DV300开源套件。 + +环境要求: + +Linux调测环境,相关要求和配置可参考《[快速入门](../quick-start/quickstart-overview.md)》。 + +### 开发步骤 + +本文以[DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568)为例介绍充电空闲状态的定制方法。 + +1. 在产品目录[(/vendor/hihope/rk3568)](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568)下创建thermal文件夹。 + +2. 参考[默认充电空闲状态的配置文件夹](https://gitee.com/openharmony/powermgr_thermal_manager/tree/master/services/native/profile)创建目标文件夹,并安装到`//vendor/hihope/rk3568/thermal`,文件格式如下: + + ```text + profile + ├── BUILD.gn + ├── thermal_service_config.xml + ``` + +3. 参考[默认充电空闲状态的配置文件夹中的thermal_service_config.xml](https://gitee.com/openharmony/powermgr_thermal_manager/blob/master/services/native/profile/thermal_service_config.xml)编写定制的thermal_service_config.xml。包含充电空闲状态配置说明及定制后的充电空闲状态配置如下: + + **表1** 充电空闲状态配置说明 + + | 配置项 | 描述 | 数据类型 | 取值范围 | + | -------- | -------- | -------- | -------- | + | thermallevel | 热等级阈值 | int | 根据产品的热等级进行定义,当设备热等级小于等于该阈值时,其状态为充电空闲状态。 | + | soc | 电池电量阈值 | int | 0~100,当设备电量大于等于该阈值时,其状态为充电空闲状态。 | + | charging | 电池是否在充电 | int | 1为正在充电,0为不在充电。 | + | current | 电池充电电流阈值 | int | 单位为mA,当电池充电电流大于等于该阈值时,其状态为充电空闲状态。 | + + ```shell + + 1 + 90 + 1 + 1000 + + ``` + +4. 参考[默认充电空闲状态配置文件夹中的BUILD.gn](https://gitee.com/openharmony/powermgr_thermal_manager/blob/master/services/native/profile/BUILD.gn)编写BUILD.gn文件,将thermal_service_config.xml打包到`/vendor/etc/thermal_config`目录下 + + ```shell + import("//build/ohos.gni") # 引用build/ohos.gni + + ohos_prebuilt_etc("thermal_service_config") { + source = "thermal_service_config.xml" + relative_install_dir = "thermal_config" + install_images = [ chipset_base_dir ] # 安装到vendor目录下的必要配置 + part_name = "product_rk3568" # part_name暂定为product_rk3568,以实现后续编译,产品定制根据需要自行修改 + } + ``` + +5. 将编译目标添加到[ohos.build](https://gitee.com/openharmony/vendor_hihope/blob/master/rk3568/ohos.build)的"module_list"中,例如: + + ```json + { + "parts": { + "product_rk3568": { + "module_list": [ + "//vendor/hihope/rk3568/default_app_config:default_app_config", + "//vendor/hihope/rk3568/image_conf:custom_image_conf", + "//vendor/hihope/rk3568/preinstall-config:preinstall-config", + "//vendor/hihope/rk3568/resourceschedule:resourceschedule", + "//vendor/hihope/rk3568/etc:product_etc_conf", + "//vendor/hihope/rk3568/thermal/profile:thermal_service_config", // 添加thermal_service_config的编译 + ] + } + }, + "subsystem": "product_hihope" + } + ``` + “//vendor/hihope/rk3568/thermal/”为文件夹路径,“profile”为创建的文件夹名字,“thermal_hdf_config”为编译目标。 + +6. 参考《[快速入门](../quick-start/quickstart-overview.md)》编译定制版本,编译命令如下: + + ```shell + ./build.sh --product-name rk3568 --ccache + ``` + +7. 将定制版本烧录到DAYU200开发板中。 + +### 调测验证 + +1. 开机后,进入shell命令行: + ```shell + hdc shell + ``` + +2. 获取当前充电空闲状态。 + ```shell + hidumper -s 3303 -a -i + ``` + + 查看定制后的充电空闲状态结果如下: + ```shell + -------------------------------[ability]------------------------------- + + + ----------------------------------ThermalService--------------------------------- + thermallevel: 1 + soc: 100 + charging: 1 + current: 1000 + ``` + +## 参考 +开发过程中可参考的配置文件路径:[默认充电空闲状态源码路径](https://gitee.com/openharmony/powermgr_thermal_manager/blob/master/services/native/profile/thermal_service_config.xml) + +打包路径:`/vendor/etc/thermal_config/hdf` + + + diff --git a/zh-cn/device-dev/subsystems/subsys-thermal_control.md b/zh-cn/device-dev/subsystems/subsys-thermal_control.md new file mode 100644 index 0000000000000000000000000000000000000000..f4d8cb528bd2091706e5d36d2eb5678f8f7b695e --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-thermal_control.md @@ -0,0 +1,156 @@ +# 热管控定制开发指导 + +## 概述 + +### 简介 + +OpenHarmony默认提供了热管控的特性。设备在使用的过程中如果发热过多,则需要对发热的器件进行管控,如充电时电池温度过高,则需要对充电进行限制。但是管控动作在不同的产品上规格是不同的,产品希望根据产品的设计规格来定制此特性。为此OpenHarmony提供了热管控的定制方式,产品定制开发者可根据产品的设计规格来定制这些特性。 + +### 约束与限制 + +产品定制的配置路径,需要根据[配置策略](https://gitee.com/openharmony/customization_config_policy)决定。本开发指导中的定制路径以`/vendor`进行举例,请开发者根据具体的产品配置策略,修改定制路径。 + +## 开发指导 + +### 搭建环境 + +设备要求: + +标准系统开发板,如DAYU200/Hi3516DV300开源套件。 + +环境要求: + +Linux调测环境,相关要求和配置可参考《[快速入门](../quick-start/quickstart-overview.md)》。 + +### 开发步骤 + +本文以[DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568)为例介绍热管控的定制方法。 + +1. 在产品目录[(/vendor/hihope/rk3568)](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568)下创建thermal文件夹。 + +2. 参考[默认热管控的配置文件夹](https://gitee.com/openharmony/powermgr_thermal_manager/tree/master/services/native/profile)创建目标profile文件夹,并安装到`//vendor/hihope/rk3568/thermal`,文件格式如下: + + ```text + profile + ├── BUILD.gn + ├── thermal_service_config.xml + ``` + +3. 参考[默认热管控的配置文件夹中的thermal_service_config.xml](https://gitee.com/openharmony/powermgr_thermal_manager/blob/master/services/native/profile/thermal_service_config.xml)编写定制的thermal_service_config.xml。包含热管控配置说明及定制后的热管控配置如下: + + **表1** 热管控配置说明 + + | 管控动作配置项名称 | 管控动作配置项描述 | 管控动作配置项参数 | 管控动作配置项参数描述 | 数据类型 |取值范围 | + | -------- | -------- | -------- | -------- | -------- | -------- | + | name="cpu_big" | 大核CPU管控动作(控制大核CPU频率) | 无 | 无 | 无 | 无 | + | name="cpu_med" | 中核CPU管控动作(控制中核CPU频率) | 无 | 无 | 无 | 无 | + | name="cpu_lit" | 小核CPU管控动作(控制小核CPU频率) | 无 | 无 | 无 | 无 | + | name="gpu" | GPU管控动作(控制GPU频率) | 无 | 无 | 无 | 无 | + | name="lcd" | LCD管控动作(控制屏幕亮度) | 无 | 无 | 无 | 无 | + | name="volume" | 声音管控动作(控制音量大小) | uid | 用户id | int | 根据产品定义 | + | name="current" | 充电电流管控动作(控制快充和慢充时的充电电流大小) | protocol | 支持的充电协议,快充(sc)和慢充(buck) | string | sc,buck | + | name="current" | 充电电流管控动作 | event | 为1时发送事件,为0时不发送事件 | int | 0,1 | + | name="voltage" | 充电电压管控动作(控制快充和慢充时的充电电压大小) | protocol | 支持的充电协议,快充(sc)和慢充(buck) | string | sc,buck | + | name="voltage" | 充电电压管控动作 | event | 为1时发送事件,为0时不发送事件 | int | 0,1 | + | name="process_ctrl" | 进程管控动作(控制前台和后台进程存活状态) | event | 为1时发送事件,为0时不发送事件 | int | 0,1 | + | name="shut_down" | 关机管控动作(控制是否关机) | event | 为1时发送事件,为0时不发送事件 | int | 0,1 | + | name="thermallevel" | 热等级管控动作(控制热等级上报) | event | 为1时发送事件,为0时不发送事件 | int | 0,1 | + | name="popup" | 弹窗管控动作(控制是否弹窗) | 无 | 无 | 无 | 无 | + + ```shell + + + + + + + + + + + + + + + ``` + +4. 参考[默认热管控配置文件夹中的BUILD.gn](https://gitee.com/openharmony/powermgr_thermal_manager/blob/master/services/native/profile/BUILD.gn)编写BUILD.gn文件,将thermal_service_config.xml打包到`/vendor/etc/thermal_config`目录下 + + ```shell + import("//build/ohos.gni") # 引用build/ohos.gni + + ohos_prebuilt_etc("thermal_service_config") { + source = "thermal_service_config.xml" + relative_install_dir = "thermal_config" + install_images = [ chipset_base_dir ] # 安装到vendor目录下的必要配置 + part_name = "product_rk3568" # part_name暂定为product_rk3568,以实现后续编译,产品定制根据需要自行修改 + } + ``` + +5. 将编译目标添加到[ohos.build](https://gitee.com/openharmony/vendor_hihope/blob/master/rk3568/ohos.build)的"module_list"中,例如: + + ```json + { + "parts": { + "product_rk3568": { + "module_list": [ + "//vendor/hihope/rk3568/default_app_config:default_app_config", + "//vendor/hihope/rk3568/image_conf:custom_image_conf", + "//vendor/hihope/rk3568/preinstall-config:preinstall-config", + "//vendor/hihope/rk3568/resourceschedule:resourceschedule", + "//vendor/hihope/rk3568/etc:product_etc_conf", + "//vendor/hihope/rk3568/thermal/profile:thermal_service_config", // 添加thermal_service_config的编译 + ] + } + }, + "subsystem": "product_hihope" + } + ``` + “//vendor/hihope/rk3568/thermal/”为文件夹路径,“profile”为创建的文件夹名字,“thermal_hdf_config”为编译目标。 + +6. 参考《[快速入门](../quick-start/quickstart-overview.md)》编译定制版本,编译命令如下: + + ```shell + ./build.sh --product-name rk3568 --ccache + ``` + +7. 将定制版本烧录到DAYU200开发板中。 + +### 调测验证 + +1. 开机后,进入shell命令行: + ```shell + hdc shell + ``` + +2. 获取当前热管控信息。 + ```shell + hidumper -s 3303 -a -a + ``` + + 查看定制后的热管控结果如下: + ```shell + -------------------------------[ability]------------------------------- + + + ----------------------------------ThermalService--------------------------------- + name: cpu_big strict: 0 enableEvent: 0 + name: cpu_med strict: 0 enableEvent: 0 + name: cpu_lit strict: 0 enableEvent: 0 + name: gpu strict: 0 enableEvent: 0 + name: boost strict: 0 enableEvent: 0 + name: lcd strict: 0 enableEvent: 0 + name: volume uid: 2001,2002 strict: 0 enableEvent: 0 + name: current protocol: sc,buck strict: 0 enableEvent: 1 + name: voltage protocol: sc,buck strict: 0 enableEvent: 1 + name: process_ctrl params: 32,64,128,256 strict: 0 enableEvent: 0 + name: shut_down strict: 0 enableEvent: 0 + name: thermallevel strict: 0 enableEvent: 0 + name: popup strict: 0 enableEvent: 0 + ``` + +## 参考 +开发过程中可参考的配置文件路径:[默认热管控源码路径](https://gitee.com/openharmony/powermgr_thermal_manager/blob/master/services/native/profile/thermal_service_config.xml) + +打包路径:`/vendor/etc/thermal_config/hdf` + diff --git a/zh-cn/device-dev/subsystems/subsys-thermal_detection.md b/zh-cn/device-dev/subsystems/subsys-thermal_detection.md new file mode 100644 index 0000000000000000000000000000000000000000..f71ea6fa8a90d8d8277134747e4643c1edf6ae2b --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-thermal_detection.md @@ -0,0 +1,150 @@ +# 热检测定制开发指导 + +## 概述 + +### 简介 + +OpenHarmony默认提供了热检测的特性。设备在运行过程中会产生热量,如CPU发热、电池发热等,此时器件会通过相应的温度传感器,将其温度进行实时上报。热检测特性是实时检测器件的温度,为热管理模块提供温度输入。但是在不同产品中,对不同器件进行热检测的规格是不同的,针对此种情况,OpenHarmony提供了热检测的定制方式,产品定制开发者可根据产品的设计规格来定制这些特性。 + +### 约束与限制 + +产品定制的配置路径,需要根据[配置策略](https://gitee.com/openharmony/customization_config_policy)决定。本开发指导中的定制路径以`/vendor`进行举例,请开发者根据具体的产品配置策略,修改定制路径。 + +## 开发指导 + +### 搭建环境 + +设备要求: + +标准系统开发板,如DAYU200/Hi3516DV300开源套件。 + +环境要求: + +Linux调测环境,相关要求和配置可参考《[快速入门](../quick-start/quickstart-overview.md)》。 + +### 开发步骤 + +本文以[DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568)为例介绍热检测的定制方法。 + +1. 在产品目录[(/vendor/hihope/rk3568)](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568)下创建thermal文件夹。 + +2. 参考[默认热检测的配置文件夹](https://gitee.com/openharmony/drivers_peripheral/tree/master/thermal/interfaces/hdi_service/profile)创建目标文件夹,并安装到`//vendor/hihope/rk3568/thermal`,文件格式如下: + + ```text + profile + ├── BUILD.gn + ├── thermal_hdi_config.xml + ``` + +3. 参考[默认热检测的配置文件夹中的thermal_hdi_config.xml](https://gitee.com/openharmony/drivers_peripheral/blob/master/thermal/interfaces/hdi_service/profile/thermal_hdi_config.xml)编写定制的thermal_hdi_config.xml。包含热检测配置说明及定制后的热检测配置如下: + + **表1** 热检测配置说明 + + |节点名称| 配置项名称 | 配置项描述 | 值的类型 | + | -------- | -------- | -------- | -------- | + | item | tag | 获取真实节点或模拟节点温度值标志位的名称 | string | + | item | value | 为1时获取模拟节点温度值,为0时获取真实节点温度值 | int | + | group | name | 真实节点组(actual)或模拟节点组(sim)的名称 | string | + | group | interval | 轮询时间间隔(默认单位为ms) | int | + | thermal_zone | type | thermal zone名称 | string | + | thermal_zone | path | 获取真实节点thermal zone温度值的路径 | string | + | thermal_node | type | thermal node名称 | string | + | thermal_node | path | 获取模拟节点thermal node温度值的路径 | string | + + ```shell + + + + + + + + + + + + + + + + + + + + + ``` + 获取真实节点温度的路径参考[热日志文档](../subsystems/subsys-thermal_log.md)中获取thermal zone温度的路径,获取模拟节点温度的路径参考[热检测的默认配置](https://gitee.com/openharmony/drivers_peripheral/blob/master/thermal/interfaces/hdi_service/profile/thermal_hdi_config.xml)。 + +5. 参考[默认热检测配置文件夹中的BUILD.gn](https://gitee.com/openharmony/drivers_peripheral/blob/master/thermal/interfaces/hdi_service/profile/BUILD.gn)编写BUILD.gn文件,将thermal_hdi_config.xml打包到`//vendor/etc/thermal_config/hdf`目录下: + + ```shell + import("//build/ohos.gni") + + ohos_prebuilt_etc("thermal_hdf_config") { + source = "thermal_hdi_config.xml" + relative_install_dir = "thermal_config/hdf" + install_images = [ chipset_base_dir ] # 安装到vendor目录下的必要配置 + part_name = "product_rk3568" # part_name暂定为product_rk3568,以实现后续编译,产品定制根据需要自行修改 + } + ``` + +6. 将编译目标添加到[ohos.build](https://gitee.com/openharmony/vendor_hihope/blob/master/rk3568/ohos.build)的"module_list"中,例如: + + ```json + { + "parts": { + "product_rk3568": { + "module_list": [ + "//vendor/hihope/rk3568/default_app_config:default_app_config", + "//vendor/hihope/rk3568/image_conf:custom_image_conf", + "//vendor/hihope/rk3568/preinstall-config:preinstall-config", + "//vendor/hihope/rk3568/resourceschedule:resourceschedule", + "//vendor/hihope/rk3568/etc:product_etc_conf", + "//vendor/hihope/rk3568/thermal/profile:thermal_hdf_config", // 添加thermal_hdf_config的编译 + ] + } + }, + "subsystem": "product_hihope" + } + ``` + “//vendor/hihope/rk3568/thermal/”为文件夹路径,“profile”为创建的文件夹名字,“thermal_hdf_config”为编译目标。 + +7. 参考《[快速入门](../quick-start/quickstart-overview.md)》编译定制版本,编译命令如下: + + ```shell + ./build.sh --product-name rk3568 --ccache + ``` + +8. 将定制版本烧录到DAYU200开发板中。 + +### 调测验证 + +1. 开机后,进入shell命令行: + ```shell + hdc shell + ``` + +2. 获取thermal zone的热检测结果: + ```shell + hidumper -s 3303 -a -t + ``` + + 成功获取thermal zone的热检测结果如下,其中Temperature的默认温度单位为0.001摄氏度: + ```shell + -------------------------------[ability]------------------------------- + + + ----------------------------------ThermalService--------------------------------- + ······(省略其他,只显示定制后的热检测结果) + Type: gpu-thermal + Temperature: 35555 + Type: soc-thermal + Temperature: 35000 + ······ + ``` + +## 参考 +开发过程中可参考的配置文件路径:[默认热检测的配置源码路径](https://gitee.com/openharmony/drivers_peripheral/tree/master/thermal/interfaces/hdi_service/profile/) + +打包路径:`/vendor/etc/thermal_config/hdf` + diff --git a/zh-cn/device-dev/subsystems/subsys-thermal_level.md b/zh-cn/device-dev/subsystems/subsys-thermal_level.md new file mode 100644 index 0000000000000000000000000000000000000000..284d2444ad7823ddbf3738cd4364a243c337aef0 --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-thermal_level.md @@ -0,0 +1,163 @@ +# 热等级定制开发指导 + +## 概述 + +### 简介 + +OpenHarmony默认提供了热等级的特性。不同的硬件设备发热量和所能承受的最大温度都不相同,因此需要根据不同器件的温度,来定义系统的热等级标准,从而清晰的表明当前设备的发热状态,给热策略提供输入。但是器件在不同温度下对应的热等级在不同的产品上规格是不同的,产品希望根据产品的设计规格来定制此特性。OpenHarmony提供了热等级的定制方式,产品定制开发者可根据产品的设计规格来定制这些特性。 + +### 约束与限制 + +产品定制的配置路径,需要根据[配置策略](https://gitee.com/openharmony/customization_config_policy)决定。本开发指导中的定制路径以`/vendor`进行举例,请开发者根据具体的产品配置策略,修改定制路径。 + +## 开发指导 + +### 搭建环境 + +设备要求: + +标准系统开发板,如DAYU200/Hi3516DV300开源套件。 + +环境要求: + +Linux调测环境,相关要求和配置可参考《[快速入门](../quick-start/quickstart-overview.md)》。 + +### 开发步骤 + +本文以[DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568)为例介绍热等级的定制方法。 + +1. 在产品目录[(/vendor/hihope/rk3568)](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568)下创建thermal文件夹。 + +2. 参考[默认热等级的配置文件夹](https://gitee.com/openharmony/powermgr_thermal_manager/tree/master/services/native/profile)创建目标文件夹,并安装到`//vendor/hihope/rk3568/thermal`,文件格式如下: + + ```text + profile + ├── BUILD.gn + ├── thermal_service_config.xml + ``` + +3. 参考[默认热等级的配置文件夹中的thermal_service_config.xml](https://gitee.com/openharmony/powermgr_thermal_manager/blob/master/services/native/profile/thermal_service_config.xml)编写定制的thermal_service_config.xml。包含热等级配置说明及定制后的热等级配置如下: + + **表1** base配置说明 + | 配置项 | 配置项描述 | 配置项参数 | 配置项参数描述 | 参数类型 | 参数取值范围 | + | -------- | -------- | -------- | -------- | -------- | -------- | + | tag="history_temp_count" | 历史上报温度次数标签的名称 | value | 历史上报温度次数 | int | >0 | + | tag="temperature_query_enum" | 获取温度的设备列表的标签名称 | value | 要获取温度的设备列表 | enum | soc,battery,shell,cpu,charger,ambient,ap,pa | + + + **表2** sensor_cluster配置说明 + + | 配置项名称 | 配置项描述 | 数据类型 | 取值范围 | + | -------- | -------- | -------- | -------- | + | name | 传感器集合名称 | string | 无 | + | sensor | 集合内的传感器 | string | soc,battery,shell,cpu,charger,ambient,ap,pa | + | aux_sensor | 集合内的辅助传感器 | string | soc,battery,shell,cpu,charger,ambient,ap,pa | + + **表3** item配置说明 + + | 配置项名称 | 配置项描述 | 数据类型 | 取值范围 | + | -------- | -------- | -------- | -------- | + | level | 各传感器集合下定义的热等级 | int | >0 | + | threshold | 集合内每个传感器达到对应热等级的温度阈值(默认单位0.001摄氏度,开发者可定制) | int | 根据产品定制 | + | threshold_clr | 集合内每个传感器回退到上一热等级的温度阈值 | int | 根据产品定制 | + | temp_rise_rate | 温度升高频率 | double | 根据产品定制 | + + ```shell + + + + + + + + + + + + + + + ``` + +4. 参考[默认热等级配置文件夹中的BUILD.gn](https://gitee.com/openharmony/powermgr_thermal_manager/blob/master/services/native/profile/BUILD.gn)编写BUILD.gn文件,将thermal_service_config.xml打包到`/vendor/etc/thermal_config`目录下 + + ```shell + import("//build/ohos.gni") # 引用build/ohos.gni + + ohos_prebuilt_etc("thermal_service_config") { + source = "thermal_service_config.xml" + relative_install_dir = "thermal_config" + install_images = [ chipset_base_dir ] # 安装到vendor目录下的必要配置 + part_name = "product_rk3568" # part_name暂定为product_rk3568,以实现后续编译,产品定制根据需要自行修改 + } + ``` + +5. 将编译目标添加到[ohos.build](https://gitee.com/openharmony/vendor_hihope/blob/master/rk3568/ohos.build)的"module_list"中,例如: + + ```json + { + "parts": { + "product_rk3568": { + "module_list": [ + "//vendor/hihope/rk3568/default_app_config:default_app_config", + "//vendor/hihope/rk3568/image_conf:custom_image_conf", + "//vendor/hihope/rk3568/preinstall-config:preinstall-config", + "//vendor/hihope/rk3568/resourceschedule:resourceschedule", + "//vendor/hihope/rk3568/etc:product_etc_conf", + "//vendor/hihope/rk3568/thermal/profile:thermal_service_config", // 添加thermal_service_config的编译 + ] + } + }, + "subsystem": "product_hihope" + } + ``` + “//vendor/hihope/rk3568/thermal/”为文件夹路径,“profile”为创建的文件夹名字,“thermal_hdf_config”为编译目标。 + +6. 参考《[快速入门](../quick-start/quickstart-overview.md)》编译定制版本,编译命令如下: + + ```shell + ./build.sh --product-name rk3568 --ccache + ``` + +7. 将定制版本烧录到DAYU200开发板中。 + +### 调测验证 + +1. 开机后,进入shell命令行: + ```shell + hdc shell + ``` + +2. 进入`data/service/el0/thermal/sensor/soc/`路径: + ```shell + cd data/service/el0/thermal/sensor/soc + ``` + +3. 修改soc的温度: + ```shell + echo 42000 > temp + ``` + +4. 获取当前热等级信息: + ```shell + hidumper -s 3303 -a -l + ``` + + 成功获取热等级信息如下: + ```shell + -------------------------------[ability]------------------------------- + + + ----------------------------------ThermalService--------------------------------- + name: base_safe level: 2 + name: cold_safe level: 0 + name: high_safe level: 0 + name: warm_5G level: 0 + name: warm_safe level: 1 + ``` + +## 参考 +开发过程中可参考的配置文件路径:[默认热等级源码路径](https://gitee.com/openharmony/powermgr_thermal_manager/blob/master/services/native/profile/thermal_service_config.xml) + +打包路径:`/vendor/etc/thermal_config/hdf` + diff --git a/zh-cn/device-dev/subsystems/subsys-thermal_log.md b/zh-cn/device-dev/subsystems/subsys-thermal_log.md new file mode 100644 index 0000000000000000000000000000000000000000..062890c973dd2b985849ba93b6439ed0867838d4 --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-thermal_log.md @@ -0,0 +1,202 @@ +# 热日志定制开发指导 + +## 概述 + +### 简介 + +OpenHarmony默认提供了热日志的特性。热日志是设备器件在使用过程中温度的流水日志。由于热日志输出的内容和路径在不同的产品上规格是不同的,产品希望根据产品的设计规格来定制此特性。OpenHarmony提供了热日志的定制方式,产品定制开发者可根据产品的设计规格来定制这些特性。 + +### 约束与限制 + +产品定制的配置路径,需要根据[配置策略](https://gitee.com/openharmony/customization_config_policy)决定。本开发指导中的定制路径以`/vendor`进行举例,请开发者根据具体的产品配置策略,修改定制路径。 + +## 开发指导 + +### 搭建环境 + +设备要求: + +标准系统开发板,如DAYU200/Hi3516DV300开源套件。 + +环境要求: + +Linux调测环境,相关要求和配置可参考《[快速入门](../quick-start/quickstart-overview.md)》。 + +### 开发步骤 + +本文以[DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568)为例介绍热日志的定制方法。 + +1. 在产品目录[(/vendor/hihope/rk3568)](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568)下创建thermal文件夹。 + +2. 参考[默认热日志的配置文件夹](https://gitee.com/openharmony/drivers_peripheral/tree/master/thermal/interfaces/hdi_service/profile)创建目标文件夹,并安装到`//vendor/hihope/rk3568/thermal`,文件格式如下: + + ```text + profile + ├── BUILD.gn + ├── thermal_hdi_config.xml + ``` + +3. 参考[默认热日志的参数配置文件夹](https://gitee.com/openharmony/drivers_peripheral/tree/master/thermal/etc)创建目标文件夹,并安装到`//vendor/hihope/rk3568/thermal`,文件格式如下: + ```text + etc + ├── BUILD.gn + ├── thermal.para + ├── thermal.para.dac + ``` + +4. 参考[默认热日志的配置文件夹中的thermal_hdi_config.xml](https://gitee.com/openharmony/drivers_peripheral/blob/master/thermal/interfaces/hdi_service/profile/thermal_hdi_config.xml)编写定制的thermal_hdi_config.xml。包含热日志配置说明及定制后的热日志配置如下: + + **表1** tracing配置说明 + + | 配置项名称 | 配置项描述 | 数据类型 | 取值范围 | + | -------- | -------- | -------- | -------- | + | interval | 温度跟踪日志的时间间隔,单位为毫秒 | int | >0 | + | width | 温度跟踪日志的宽度,单位为字符 | int | >0 | + | outpath | 温度跟踪日志输出的路径 | string | 无 | + + **表2** node配置说明 + + | 节点名称 | 配置项名称 | 配置项描述 | + | -------- | -------- | -------- | + | title | path | 获取thermal zone名称的路径 | + | title | name | thermal zone名称 | + | value | path | 获取thermal zone温度的路径 | + + ```shell + + + + <value path="sys/class/thermal/thermal_zone0/temp"/> + </node> + <node> + <title name="gpu-thermal"/> + <value path="sys/class/thermal/thermal_zone1/temp"/> + </node> + </tracing> + ``` + +5. 参考默认热日志的参数配置文件夹中的[thermal.para](https://gitee.com/openharmony/drivers_peripheral/blob/master/thermal/etc/thermal.para)和[thermal.para.dac](https://gitee.com/openharmony/drivers_peripheral/blob/master/thermal/etc/thermal.para.dac)编写定制的thermal.para和thermal.para.dac。包含定制后的配置如下: + + thermal.para: + ```text + persist.thermal.log.enable=true # 打开thermal log + persist.thermal.log.interval=5000 # 温度跟踪日志的时间间隔,单位为毫秒 + persist.thermal.log.width=20 # 温度跟踪日志的宽度,单位为字符 + ``` + + thermal.para.dac: + ```text + persist.thermal.log.="power_host:power_host:600" # 控制访问权限 + ``` + +6. 参考[默认热日志配置文件夹中的BUILD.gn](https://gitee.com/openharmony/drivers_peripheral/blob/master/thermal/interfaces/hdi_service/profile/BUILD.gn)编写BUILD.gn文件,将thermal_hdi_config.xml打包到`//vendor/etc/thermal_config/hdf`目录下: + + ```shell + import("//build/ohos.gni") + + ohos_prebuilt_etc("thermal_hdf_config") { + source = "thermal_hdi_config.xml" + relative_install_dir = "thermal_config/hdf" + install_images = [ chipset_base_dir ] # 安装到vendor目录下的必要配置 + part_name = "product_rk3568" # part_name暂定为product_rk3568,以实现后续编译,产品定制根据需要自行修改 + } + ``` + +7. 参考[默认热日志的参数配置文件夹的BUILD.gn](https://gitee.com/openharmony/drivers_peripheral/blob/master/thermal/etc/BUILD.gn)编写BUILD.gn文件,将thermal.para和thermal.para.dac打包到`//vendor/etc/param/thermal.para`目录下 + + ```shell + import("//build/ohos.gni") + + ## Install thermal.para to /vendor/etc/param/thermal.para + + ohos_prebuilt_etc("thermal.para") { + source = "thermal.para" + relative_install_dir = "param" + install_images = [ chipset_base_dir ] + part_name = "product_rk3568" + } + + ohos_prebuilt_etc("thermal.para.dac") { + source = "thermal.para.dac" + relative_install_dir = "param" + install_images = [ chipset_base_dir ] + part_name = "product_rk3568" + } + + group("param_files") { + deps = [ + ":thermal.para", + ":thermal.para.dac", + ] + } + ``` + +8. 将编译目标添加到[ohos.build](https://gitee.com/openharmony/vendor_hihope/blob/master/rk3568/ohos.build)的"module_list"中,例如: + + ```json + { + "parts": { + "product_rk3568": { + "module_list": [ + "//vendor/hihope/rk3568/default_app_config:default_app_config", + "//vendor/hihope/rk3568/image_conf:custom_image_conf", + "//vendor/hihope/rk3568/preinstall-config:preinstall-config", + "//vendor/hihope/rk3568/resourceschedule:resourceschedule", + "//vendor/hihope/rk3568/etc:product_etc_conf", + "//vendor/hihope/rk3568/thermal/profile:thermal_hdf_config", // 添加thermal_hdf_config的编译 + "//vendor/hihope/rk3568/thermal/etc:param_files" // 添加thermal.para和thermal.para.dac的编译 + ] + } + }, + "subsystem": "product_hihope" + } + ``` + “//vendor/hihope/rk3568/thermal/”为文件夹路径,“profile”、“etc”为创建的文件夹名字,“thermal_hdf_config”、“param_files”为编译目标。 + +9. 参考《[快速入门](../quick-start/quickstart-overview.md)》编译定制版本,编译命令如下: + + ```shell + ./build.sh --product-name rk3568 --ccache + ``` + +10. 将定制版本烧录到DAYU200开发板中。 + +### 调测验证 + +1. 开机后,进入shell命令行: + ```shell + hdc shell + ``` + +2. 进入定制后的目录。 + ```shell + cd /data/log/thermal/ + ``` + + 查看热日志。 + ```shell + cat thermal.000.20170805-175756 + ``` + + 成功获取热日志内容 + ```shell + timestamp soc-thermal gpu-thermal + 2017-08-05 17:57:56 37777 37222 + 2017-08-05 17:58:01 38333 37777 + 2017-08-05 17:58:06 36666 37222 + 2017-08-05 17:58:11 36666 37222 + 2017-08-05 17:58:16 36666 37222 + 2017-08-05 17:58:21 36111 37222 + 2017-08-05 17:58:26 36111 37222 + 2017-08-05 17:58:31 36666 37222 + 2017-08-05 17:58:36 36111 37222 + 2017-08-05 17:58:41 36111 37222 + 2017-08-05 17:58:46 36666 36666 + ``` + +## 参考 +开发过程中可参考的配置文件路径:[默认热日志的配置源码路径](https://gitee.com/openharmony/drivers_peripheral/tree/master/thermal/interfaces/hdi_service/profile/) 和[默认热日志的参数配置源码路径](https://gitee.com/openharmony/drivers_peripheral/tree/master/thermal/etc) + +打包路径:`/vendor/etc/thermal_config/hdf` + + diff --git a/zh-cn/device-dev/subsystems/subsys-thermal_policy.md b/zh-cn/device-dev/subsystems/subsys-thermal_policy.md new file mode 100644 index 0000000000000000000000000000000000000000..a3821f82777f9c780e8c4436122288f8c978359a --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-thermal_policy.md @@ -0,0 +1,230 @@ +# 热策略定制开发指导 + +## 概述 + +### 简介 + +OpenHarmony默认提供了热策略的特性。设备上发热的器件种类繁多,因此需要结合热等级和热场景,针对各类发热器件定制统一的管控策略。但是不同热等级下的管控动作在不同的产品上规格是不同的,产品希望根据产品的设计规格来定制此特性。OpenHarmony提供了热策略的定制方式,产品定制开发者可根据产品的设计规格来定制这些特性。 + +### 约束与限制 + +产品定制的配置路径,需要根据[配置策略](https://gitee.com/openharmony/customization_config_policy)决定。本开发指导中的定制路径以`/vendor`进行举例,请开发者根据具体的产品配置策略,修改定制路径。 + +## 开发指导 + +### 搭建环境 + +设备要求: + +标准系统开发板,如DAYU200/Hi3516DV300开源套件。 + +环境要求: + +Linux调测环境,相关要求和配置可参考《[快速入门](../quick-start/quickstart-overview.md)》。 + +### 开发步骤 + +本文以[DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568)为例介绍热策略的定制方法。 + +1. 在产品目录[(/vendor/hihope/rk3568)](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568)下创建thermal文件夹。 + +2. 参考[默认热策略的配置文件夹](https://gitee.com/openharmony/powermgr_thermal_manager/tree/master/services/native/profile)创建目标文件夹,并安装到`//vendor/hihope/rk3568/thermal`,文件格式如下: + + ```text + profile + ├── BUILD.gn + ├── thermal_service_config.xml + ``` + +3. 参考[默认热策略的配置文件夹中的thermal_service_config.xml](https://gitee.com/openharmony/powermgr_thermal_manager/blob/master/services/native/profile/thermal_service_config.xml)编写定制的thermal_service_config.xml。包含热策略配置说明及定制后的热策略配置如下,以其中两个热等级为例: + + **表1** config配置说明 + + | 配置项名称 | 配置项描述 | 配置项类型 | 配置项范围 | + | -------- | -------- | -------- | -------- | + | name | 定义热策略对应的传感器集合名称 | string | 对应[热等级文档](../subsystems/subsys-thermal_level.md)中定义的传感器集合名称 | + | level | 定义热策略对应的热等级 | int | 对应[热等级文档](../subsystems/subsys-thermal_level.md)中传感器集合下定义的热等级 | + + **表2** 配置项说明 + + | 配置项名称 | 配置项描述 | 配置项类型 | 配置项范围 | + | -------- | -------- | -------- | -------- | + | scene | 使用场景 | string | 对应[热场景文档](../subsystems/subsys-thermal_scene.md)中定义的使用场景 | + | charge | 是否在充电 | int | 0(不在充电),1(正在充电) | + | screen | 是否亮屏 | int | 0(灭屏),1(亮屏) | + + **表3** 节点配置说明 + + | 节点名称 | 节点值类型 | 节点值范围 | 节点描述 | + | -------- | -------- | -------- | -------- | + | lcd | double | 0.00~1.00 | 屏幕亮度的百分比(用浮点数表示) | + | cpu_big | int | 根据产品定义 | CPU大核频率 | + | cpu_med | int | 根据产品定义 | CPU中核频率 | + | cpu_lit | int | 根据产品定义 | CPU小核频率 | + | process_ctrl | enum | 1:KILL_FG_PROCESS_APP<br>2:KILL_BG_PROCESS_APP<br>3:KILL_ALL_PROCESS_APP | 进程控制 | + | gpu | int | 根据产品定义 | GPU频率 | + | thermallevel | int | 对应config节点中的level | 热等级 | + | current_sc | int | 根据产品定义 | 快充电流 | + | current_buck | int | 根据产品定义 | 慢充电流 | + | voltage_sc | int | 根据产品定义 | 快充电压 | + | voltage_buck | int | 根据产品定义 | 慢充电压 | + | volume | double | 0.00~1.00 | 音量百分比(用浮点数表示) | + + ```shell + <policy> + <config name="base_safe" level="1"> + <lcd>1.00</lcd> + <lcd scene="cam">0.99</lcd> + <lcd scene="call">0.98</lcd> + <lcd scene="game">0.95</lcd> + <cpu_big>1992000</cpu_big> + <cpu_med>1991500</cpu_med> + <cpu_lit>1991200</cpu_lit> + <process_ctrl>3</process_ctrl> + <cpu_big scene="cam" charge="1">1991800</cpu_big> + <cpu_big scene="cam" charge="0">1991600</cpu_big> + <gpu screen="0">524288</gpu> + <gpu screen="1">512000</gpu> + <thermallevel>1</thermallevel> + <current_sc>1800</current_sc> + <current_sc scene="cam">1200</current_sc> + <current_buck>1200</current_buck> + <voltage_sc>4000</voltage_sc> + <voltage_buck>3000</voltage_buck> + <volume>1.0</volume> + </config> + <policy> + <config name="base_safe" level="2"> + <lcd>0.90</lcd> + <lcd scene="cam">0.89</lcd> + <lcd scene="call">0.88</lcd> + <lcd scene="game">0.87</lcd> + <cpu_big>1991000</cpu_big> + <cpu_med>1990500</cpu_med> + <cpu_lit>1990200</cpu_lit> + <process_ctrl>2</process_ctrl> + <cpu_big scene="cam" charge="1">1990800</cpu_big> + <cpu_big scene="cam" charge="0">1990600</cpu_big> + <gpu screen="0">499712</gpu> + <gpu screen="1">487424</gpu> + <thermallevel>2</thermallevel> + <current_sc>1500</current_sc> + <current_sc scene="cam">1000</current_sc> + <current_buck>1000</current_buck> + <voltage_sc>3000</voltage_sc> + <voltage_buck>2000</voltage_buck> + <volume>0.8</volume> + </config> + </policy> + ``` + +4. 参考[默认热策略配置文件夹中的BUILD.gn](https://gitee.com/openharmony/powermgr_thermal_manager/blob/master/services/native/profile/BUILD.gn)编写BUILD.gn文件,将thermal_service_config.xml打包到`/vendor/etc/thermal_config`目录下 + + ```shell + import("//build/ohos.gni") # 引用build/ohos.gni + + ohos_prebuilt_etc("thermal_service_config") { + source = "thermal_service_config.xml" + relative_install_dir = "thermal_config" + install_images = [ chipset_base_dir ] # 安装到vendor目录下的必要配置 + part_name = "product_rk3568" # part_name暂定为product_rk3568,以实现后续编译,产品定制根据需要自行修改 + } + ``` + +5. 将编译目标添加到[ohos.build](https://gitee.com/openharmony/vendor_hihope/blob/master/rk3568/ohos.build)的"module_list"中,例如: + + ```json + { + "parts": { + "product_rk3568": { + "module_list": [ + "//vendor/hihope/rk3568/default_app_config:default_app_config", + "//vendor/hihope/rk3568/image_conf:custom_image_conf", + "//vendor/hihope/rk3568/preinstall-config:preinstall-config", + "//vendor/hihope/rk3568/resourceschedule:resourceschedule", + "//vendor/hihope/rk3568/etc:product_etc_conf", + "//vendor/hihope/rk3568/thermal/profile:thermal_service_config", // 添加thermal_service_config的编译 + ] + } + }, + "subsystem": "product_hihope" + } + ``` + “//vendor/hihope/rk3568/thermal/”为文件夹路径,“profile”为创建的文件夹名字,“thermal_hdf_config”为编译目标。 + +6. 参考《[快速入门](../quick-start/quickstart-overview.md)》编译定制版本,编译命令如下: + + ```shell + ./build.sh --product-name rk3568 --ccache + ``` + +7. 将定制版本烧录到DAYU200开发板中。 + +### 调测验证 + +1. 开机后,进入shell命令行: + ```shell + hdc shell + ``` + +2. 获取当前热策略信息。 + ```shell + hidumper -s 3303 -a -p + ``` + + 查看定制后的热策略结果如下: + ```shell + -------------------------------[ability]------------------------------- + + + ----------------------------------ThermalService--------------------------------- + name: base_safe level: 1 + actionName: lcd actionValue: 1.00 isProp: 0 + actionName: lcd actionValue: 0.99 scene: cam isProp: 1 + actionName: lcd actionValue: 0.98 scene: call isProp: 1 + actionName: lcd actionValue: 0.95 scene: game isProp: 1 + actionName: cpu_big actionValue: 1992000 isProp: 0 + actionName: cpu_med actionValue: 1991500 isProp: 0 + actionName: cpu_lit actionValue: 1991200 isProp: 0 + actionName: process_ctrl actionValue: 3 isProp: 0 + actionName: cpu_big actionValue: 1991800 charge: 1 scene: cam isProp: 1 + actionName: cpu_big actionValue: 1991600 charge: 0 scene: cam isProp: 1 + actionName: gpu actionValue: 524288 screen: 0 isProp: 1 + actionName: gpu actionValue: 512000 screen: 1 isProp: 1 + actionName: thermallevel actionValue: 1 isProp: 0 + actionName: current_sc actionValue: 1800 isProp: 0 + actionName: current_sc actionValue: 1200 scene: cam isProp: 1 + actionName: current_buck actionValue: 1200 isProp: 0 + actionName: voltage_sc actionValue: 4000 isProp: 0 + actionName: voltage_buck actionValue: 3000 isProp: 0 + actionName: volume actionValue: 1.0 isProp: 0 + actionName: boost actionValue: 1 isProp: 0 + + level: 2 + actionName: lcd actionValue: 0.90 isProp: 0 + actionName: lcd actionValue: 0.89 scene: cam isProp: 1 + actionName: lcd actionValue: 0.88 scene: call isProp: 1 + actionName: lcd actionValue: 0.87 scene: game isProp: 1 + actionName: cpu_big actionValue: 1991000 isProp: 0 + actionName: cpu_med actionValue: 1990500 isProp: 0 + actionName: cpu_lit actionValue: 1990200 isProp: 0 + actionName: process_ctrl actionValue: 2 isProp: 0 + actionName: cpu_big actionValue: 1990800 charge: 1 scene: cam isProp: 1 + actionName: cpu_big actionValue: 1990600 charge: 0 scene: cam isProp: 1 + actionName: gpu actionValue: 499712 screen: 0 isProp: 1 + actionName: gpu actionValue: 487424 screen: 1 isProp: 1 + actionName: thermallevel actionValue: 2 isProp: 0 + actionName: current_sc actionValue: 1500 isProp: 0 + actionName: current_sc actionValue: 1000 scene: cam isProp: 1 + actionName: current_buck actionValue: 1000 isProp: 0 + actionName: voltage_sc actionValue: 3000 isProp: 0 + actionName: voltage_buck actionValue: 2000 isProp: 0 + actionName: volume actionValue: 0.8 isProp: 0 + actionName: boost actionValue: 1 isProp: 0 + ``` + +## 参考 +开发过程中可参考的配置文件路径:[默认热策略源码路径](https://gitee.com/openharmony/powermgr_thermal_manager/blob/master/services/native/profile/thermal_service_config.xml) + +打包路径:`/vendor/etc/thermal_config/hdf` + diff --git a/zh-cn/device-dev/subsystems/subsys-thermal_scene.md b/zh-cn/device-dev/subsystems/subsys-thermal_scene.md new file mode 100644 index 0000000000000000000000000000000000000000..4325eb439a16eab9ac481519048a5d7284c0037e --- /dev/null +++ b/zh-cn/device-dev/subsystems/subsys-thermal_scene.md @@ -0,0 +1,126 @@ +# 热场景定制开发指导 + +## 概述 + +### 简介 + +OpenHarmony默认提供了热场景的特性。在设备使用过程中,比如游戏、拍照、通话时需要保证性能、温度和功耗的平衡。在不同场景下,热管理的策略会有所不同,如游戏场景下不会降低屏幕亮度,但是在不同的产品上对热场景的定义是不同的,产品希望根据产品的设计规格来定制此特性。OpenHarmony提供了热场景的定制方式,产品定制开发者可根据产品的设计规格来定制这些特性。 + +### 约束与限制 + +产品定制的配置路径,需要根据[配置策略](https://gitee.com/openharmony/customization_config_policy)决定。本开发指导中的定制路径以`/vendor`进行举例,请开发者根据具体的产品配置策略,修改定制路径。 + +## 开发指导 + +### 搭建环境 + +设备要求: + +标准系统开发板,如DAYU200/Hi3516DV300开源套件。 + +环境要求: + +Linux调测环境,相关要求和配置可参考《[快速入门](../quick-start/quickstart-overview.md)》。 + +### 开发步骤 + +本文以[DAYU200](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568)为例介绍热场景的定制方法。 + +1. 在产品目录[(/vendor/hihope/rk3568)](https://gitee.com/openharmony/vendor_hihope/tree/master/rk3568)下创建thermal文件夹。 + +2. 参考[默认热场景的配置文件夹](https://gitee.com/openharmony/powermgr_thermal_manager/tree/master/services/native/profile)创建目标文件夹,并安装到`//vendor/hihope/rk3568/thermal`,文件格式如下: + + ```text + profile + ├── BUILD.gn + ├── thermal_service_config.xml + ``` + +3. 参考[默认热场景的配置文件夹中的thermal_service_config.xml](https://gitee.com/openharmony/powermgr_thermal_manager/blob/master/services/native/profile/thermal_service_config.xml)编写定制的thermal_service_config.xml。包含热场景配置说明及定制后的热场景配置如下: + + **表1** 热场景配置说明 + + | 配置项 | 配置项描述 | 配置项参数 | 配置项参数描述 | 配置项参数类型 | 配置项参数取值范围 | + | -------- | -------- | -------- | -------- | -------- | -------- | + | name="scene" | 配置一种或多种使用场景,可以在枚举中任选 | param | 具体的使用场景:拍照、电话、游戏 | enum | cam,call,game | + + screen和charge是配置的使用场景的状态,分别为是否亮屏和是否充电。 + + ```shell + <state> + <item name="scene" param="cam,call,game"/> + <item name="screen"/> + <item name="charge"/> + </state> + ``` + +4. 参考[默认热场景配置文件夹中的BUILD.gn](https://gitee.com/openharmony/powermgr_thermal_manager/blob/master/services/native/profile/BUILD.gn)编写BUILD.gn文件,将thermal_service_config.xml打包到`/vendor/etc/thermal_config`目录下 + + ```shell + import("//build/ohos.gni") # 引用build/ohos.gni + + ohos_prebuilt_etc("thermal_service_config") { + source = "thermal_service_config.xml" + relative_install_dir = "thermal_config" + install_images = [ chipset_base_dir ] # 安装到vendor目录下的必要配置 + part_name = "product_rk3568" # part_name暂定为product_rk3568,以实现后续编译,产品定制根据需要自行修改 + } + ``` + +5. 将编译目标添加到[ohos.build](https://gitee.com/openharmony/vendor_hihope/blob/master/rk3568/ohos.build)的"module_list"中,例如: + + ```json + { + "parts": { + "product_rk3568": { + "module_list": [ + "//vendor/hihope/rk3568/default_app_config:default_app_config", + "//vendor/hihope/rk3568/image_conf:custom_image_conf", + "//vendor/hihope/rk3568/preinstall-config:preinstall-config", + "//vendor/hihope/rk3568/resourceschedule:resourceschedule", + "//vendor/hihope/rk3568/etc:product_etc_conf", + "//vendor/hihope/rk3568/thermal/profile:thermal_service_config", // 添加thermal_service_config的编译 + ] + } + }, + "subsystem": "product_hihope" + } + ``` + “//vendor/hihope/rk3568/thermal/”为文件夹路径,“profile”为创建的文件夹名字,“thermal_hdf_config”为编译目标。 + +6. 参考《[快速入门](../quick-start/quickstart-overview.md)》编译定制版本,编译命令如下: + + ```shell + ./build.sh --product-name rk3568 --ccache + ``` + +7. 将定制版本烧录到DAYU200开发板中。 + +### 调测验证 + +1. 开机后,进入shell命令行: + ```shell + hdc shell + ``` + +2. 获取当前热场景信息。 + ```shell + hidumper -s 3303 -a -s + ``` + + 查看定制后的热场景结果如下: + ```shell + -------------------------------[ability]------------------------------- + + + ----------------------------------ThermalService--------------------------------- + name: scene params: cam,call,game + name: screen + name: charge + ``` + +## 参考 +开发过程中可参考的配置文件路径:[默认热场景源码路径](https://gitee.com/openharmony/powermgr_thermal_manager/blob/master/services/native/profile/thermal_service_config.xml) + +打包路径:`/vendor/etc/thermal_config/hdf` + diff --git a/zh-cn/device-dev/subsystems/subsys-toolchain-hiperf.md b/zh-cn/device-dev/subsystems/subsys-toolchain-hiperf.md index 461e3f1dcd4036741d1bf5721c86789c0098262f..7dfe5ae62c8564df7a0cd77c9e4bf4ad23bc1b24 100644 --- a/zh-cn/device-dev/subsystems/subsys-toolchain-hiperf.md +++ b/zh-cn/device-dev/subsystems/subsys-toolchain-hiperf.md @@ -207,6 +207,9 @@ Usage: hiperf record [options] ## report 命令 + +### 参数说明 + 此命令主要用于展示record中抓取的采样数据 @@ -230,7 +233,7 @@ Usage: hiperf report [option] | -o <_filename_> | 指定输出的报告文件名。 | -## 使用示例 +### 使用示例 - 输出采样数据的报告,默认读取perf.data文件 diff --git a/zh-cn/device-dev/subsystems/subsys-usbservice-demo.md b/zh-cn/device-dev/subsystems/subsys-usbservice-demo.md deleted file mode 100644 index ad6e84ec1ce098166779ea978ed39345448eda09..0000000000000000000000000000000000000000 --- a/zh-cn/device-dev/subsystems/subsys-usbservice-demo.md +++ /dev/null @@ -1,187 +0,0 @@ -# USB服务子系统使用实例<a name="ZH-CN_TOPIC_0000001092792986"></a> - - -```cpp -#include <cstdio> -#include <iostream> -#include <map> -#include <mutex> -#include <sstream> -#include <sys/time.h> -#include "if_system_ability_manager.h" -#include "ipc_skeleton.h" -#include "iremote_object.h" -#include "iservice_registry.h" -#include "iusb_srv.h" -#include "string_ex.h" -#include "system_ability_definition.h" -#include "usb_common.h" -#include "usb_device.h" -#include "usb_errors.h" -#include "usb_request.h" -#include "usb_server_proxy.h" -#include "usb_srv_client.h" - -const int32_t REQUESTYPE = ((1 << 7) | (0 << 5) | (0 & 0x1f)); -const int32_t REQUESTCMD = 6; -const int32_t VALUE = (2 << 8) + 0; -const int32_t TIMEOUT = 5000; -const int32_t ITFCLASS = 10; -const int32_t PRAMATYPE = 2; -const int32_t BUFFERLENGTH = 21; - -void GetType(OHOS::USB::USBEndpoint &tep, OHOS::USB::USBEndpoint &outEp, bool &outEpFlg) -{ - if ((tep.GetType() == PRAMATYPE)) { - if (tep.GetDirection() == 0) { - outEp = tep; - outEpFlg = true; - } - } -} - -bool SelectEndpoint(OHOS::USB::USBConfig config, - std::vector<OHOS::USB::UsbInterface> interfaces, - OHOS::USB::UsbInterface &interface, - OHOS::USB::USBEndpoint &outEp, - bool &outEpFlg) -{ - for (int32_t i = 0; i < config.GetInterfaceCount(); ++i) { - OHOS::USB::UsbInterface tif = interfaces[i]; - std::vector<OHOS::USB::USBEndpoint> mEndpoints = tif.GetEndpoints(); - for (int32_t j = 0; j < tif.GetEndpointCount(); ++j) { - OHOS::USB::USBEndpoint tep = mEndpoints[j]; - if ((tif.GetClass() == ITFCLASS) && (tif.GetSubClass() == 0) && (tif.GetProtocol() == PRAMATYPE)) { - GetType(tep, outEp, outEpFlg); - } - } - if (outEpFlg) { - interface = interfaces[i]; - return true; - } - std::cout << std::endl; - } - return false; -} - -int OpenDeviceTest(OHOS::USB::UsbSrvClient &Instran, OHOS::USB::UsbDevice device, OHOS::USB::USBDevicePipe &pip) -{ - int ret = Instran.RequestRight(device.GetName()); - std::cout << "device RequestRight ret = " << ret << std::endl; - if (0 != ret) { - std::cout << "device RequestRight failed = " << ret << std::endl; - } - ret = Instran.OpenDevice(device, pip); - return ret; -} - -int CtrTransferTest(OHOS::USB::UsbSrvClient &Instran, OHOS::USB::USBDevicePipe &pip) -{ - std::cout << "usb_device_test : << Control Transfer >> " << std::endl; - std::vector<uint8_t> vData; - const OHOS::USB::UsbCtrlTransfer tctrl = {REQUESTYPE, REQUESTCMD, VALUE, 0, TIMEOUT}; - int ret = Instran.ControlTransfer(pip, tctrl, vData); - if (ret != 0) { - std::cout << "control message read failed width ret = " << ret << std::endl; - } else { - } - std::cout << "control message read success" << std::endl; - - return ret; -} - -int ClaimTest(OHOS::USB::UsbSrvClient &Instran, - OHOS::USB::USBDevicePipe &pip, - OHOS::USB::UsbInterface &interface, - bool interfaceFlg) -{ - if (interfaceFlg) { - std::cout << "ClaimInterface InterfaceInfo:" << interface.ToString() << std::endl; - int ret = Instran.ClaimInterface(pip, interface, true); - if (ret != 0) { - std::cout << "ClaimInterface failed width ret = " << ret << std::endl; - } else { - std::cout << "ClaimInterface success" << std::endl; - } - } - return 0; -} - -int BulkTransferTest(OHOS::USB::UsbSrvClient &Instran, - OHOS::USB::USBDevicePipe &pip, - OHOS::USB::USBEndpoint &outEp, - bool interfaceFlg, - bool outEpFlg) -{ - if (interfaceFlg) { - std::cout << "usb_device_test : << Bulk transfer start >> " << std::endl; - if (outEpFlg) { - uint8_t buffer[50] = "hello world 123456789"; - std::vector<uint8_t> vData(buffer, buffer + BUFFERLENGTH); - int ret = Instran.BulkTransfer(pip, outEp, vData, TIMEOUT); - if (ret != 0) { - std::cout << "Bulk transfer write failed width ret = " << ret << std::endl; - } else { - std::cout << "Bulk transfer write success" << std::endl; - } - return ret; - } - } - return 0; -} - -int main(int argc, char **argv) -{ - std::cout << "usb_device_test " << std::endl; - static OHOS::USB::UsbSrvClient &Instran = OHOS::USB::UsbSrvClient::GetInstance(); - // GetDevices - std::vector<OHOS::USB::UsbDevice> deviceList; - int32_t ret = Instran.GetDevices(deviceList); - if (ret != 0) { - return OHOS::USB::UEC_SERVICE_INVALID_VALUE; - } - if (deviceList.empty()) { - return OHOS::USB::UEC_SERVICE_INVALID_VALUE; - } - - OHOS::USB::UsbDevice device = deviceList[0]; - std::vector<OHOS::USB::USBConfig> configs = device.GetConfigs(); - OHOS::USB::USBConfig config = configs[0]; - std::vector<OHOS::USB::UsbInterface> interfaces = config.GetInterfaces(); - OHOS::USB::UsbInterface interface; - OHOS::USB::USBEndpoint outEp; - bool interfaceFlg = false; - bool outEpFlg = false; - interfaceFlg = SelectEndpoint(config, interfaces, interface, outEp, outEpFlg); - - // OpenDevice - std::cout << "usb_device_test : << OpenDevice >> test begin -> " << std::endl; - OHOS::USB::USBDevicePipe pip; - ret = OpenDeviceTest(Instran, device, pip); - if (ret != 0) { - return OHOS::USB::UEC_SERVICE_INVALID_VALUE; - } - - // ControlTransfer - CtrTransferTest(Instran, pip); - - // ClaimInterface - ClaimTest(Instran, pip, interface, interfaceFlg); - - // BulkTransferWrite - BulkTransferTest(Instran, pip, outEp, interfaceFlg, outEpFlg); - - // CloseDevice - std::cout << "usb_device_test : << Close Device >> " << std::endl; - ret = Instran.Close(pip); - if (ret == 0) { - std::cout << "Close device failed width ret = " << ret << std::endl; - return OHOS::USB::UEC_SERVICE_INVALID_VALUE; - } else { - std::cout << "Close Device success" << std::endl; - } - return 0; -} -``` - - diff --git a/zh-cn/device-dev/subsystems/subsys-usbservice-guide.md b/zh-cn/device-dev/subsystems/subsys-usbservice-guide.md deleted file mode 100644 index ea46f8f7e445897feb58684f702ef578e466a8f8..0000000000000000000000000000000000000000 --- a/zh-cn/device-dev/subsystems/subsys-usbservice-guide.md +++ /dev/null @@ -1,51 +0,0 @@ -# USB服务子系统使用指导<a name="ZH-CN_TOPIC_0000001077367159"></a> - - -下面使用步骤以bulktransfer为例。 - -使用步骤<a name="section18816105182315"></a> - -1. 获取usb service实例 - - ```cpp - static OHOS::USB::UsbSrvClient &g_usbClient = OHOS::USB::UsbSrvClient::GetInstance(); - ``` - -2. 获取usb设备列表 - - ```cpp - std::vector<OHOS::USB::UsbDevice> deviceList; - int32_t ret = g_usbClient.GetDevices(deviceList); - ``` - -3. 申请设备权限 - - ```cpp - int32_t ret = g_usbClient.RequestRight(device.GetName()); - ``` - -4. 打开设备 - - ```cpp - USBDevicePipe pip; - int32_t et = g_usbClient.OpenDevice(device, pip); - ``` - -5. 配置设备接口 - - ```cpp - ret = g_usbClient.ClaimInterface(pip, interface, true); //interface为deviceList中device的interface。 - ``` - -6. 数据传输 - - ```cpp - srvClient.BulkTransfer(pipe, endpoint, vdata, timeout); - ``` - pipe为打开设备后的数据传输通道,endpoint为device中数据传输的端点,vdata是需要传输或读取的二进制数据块,timeout为传输超时时长。 - -7. 关闭设备 - - ```cpp - ret = g_usbClient.Close(pip); - ``` diff --git a/zh-cn/device-dev/subsystems/subsys-usbservice-overview.md b/zh-cn/device-dev/subsystems/subsys-usbservice-overview.md deleted file mode 100644 index d3bf8b07e67ce76f23a2b66a6add3887cbe522cf..0000000000000000000000000000000000000000 --- a/zh-cn/device-dev/subsystems/subsys-usbservice-overview.md +++ /dev/null @@ -1,338 +0,0 @@ -# USB服务 - -## 概述 - -### 功能简介 - -USB设备分为Host设备(主机设备)和Device设备(从设备)。用户可通过Port Service来根据实际业务把运行OpenHarmony的设备切换为Host设备或者Device设备。目前在Host模式下,支持获取USB设备列表,USB设备权限管理,控制传输、批量传输的同异步数据传输等,在Device模式下,支持HDC(调试)、ACM(串口)、ECM(网口)等功能的切换。 - -### 基本概念 - -- USB服务 - - USB服务是应用访问底层的一种设备抽象概念。开发者根据提供的USB API,可以获取设备列表、控制设备访问权限、以及与连接的设备进行数据传输、控制命令传输等。 - -- USB API - - 基于USB Service服务,使用NAPI技术,向上提供JS接口。提供USB的基础API,主要包含查询USB设备的列表、设备插拔通知、USB HOST/DEVICE 功能切换、批量数据传输、控制命令传输、USB设备打开的权限控制及USB device模式下的function功能切换等。 - -- USB Service - - 使用C++代码实现,包含Host、Device、Port、Right四个模块。基于HDI接口,主要实现USB设备列表管理、Function 管理、Port管理、USB设备权限管理等功能。主要实现HAL层数据接收、解析、分发,前后台的策略管控,对该设备USB的管理,USB权限管控等。 - -- USB HAL - - 使用C代码实现,基于Host DDK(Driver Develop Kit)和Device DDK,封装了对USB设备的基本操作,向上提供C++接口,同时通过HDF框架接收内核上报的信息。 - -### 运作机制 - -USB服务系统包含USB API、USB Service、USB HAL。 - - **图1** USB服务架构图 - ![zh-cn_image_0000001267088285](figures/zh-cn_image_0000001267088285.png) - -- USB API:提供USB的基础API,主要包含查询USB设备列表、批量数据传输、控制命令传输、权限控制等。 - -- USB Service:主要实现HAL层数据的接收、解析、分发,前后台的策略管控以及对设备的管理等。 - -- USB HAL层:提供给用户态可直接调用的驱动能力接口。 - -## 使用指导 - -### 场景介绍 - -Host模式下,可以获取到已经连接的设备列表,并根据需要打开和关闭设备、控制设备权限、进行数据传输等。 - -### 接口说明 - - **表1** Host部分 - -| 接口名称 | 功能描述 | -| ------------------------------------------------------------ | ------------------------------------------------------------ | -| int32_t OpenDevice(const UsbDevice &device, USBDevicePipe &pip); | 打开USB设备,建立连接 | -| bool HasRight(std::string deviceName); | 判断是否有权访问设备 | -| int32_t RequestRight(std::string deviceName); | 请求给定软件包的临时权限以访问设备 | -| int32_t GetDevices(std::vector &deviceList); | 获取USB设备列表 | -| int32_t ClaimInterface(USBDevicePipe &pip, const UsbInterface &interface, bool force); | 打开接口,并申明独占接口,必须在数据传输前执行 | -| int32_t ReleaseInterface(USBDevicePipe &pip, const UsbInterface &interface); | 关闭接口,释放接口的占用,在停止数据传输后执行 | -| int32_t BulkTransfer(USBDevicePipe &pip, const USBEndpoint &endpoint, std::vector &vdata, int32_t timeout); | 在给定端点上执行批量数据传输, 返回读取或发送的数据长度,通过端点方向确定读取或发送数据 | -| int32_t ControlTransfer(USBDevicePipe &pip, const UsbCtrlTransfer &ctrl, std::vector &vdata); | 对此设备执行端点零的控制事务,传输方向由请求类型决定 | -| int32_t SetConfiguration(USBDevicePipe &pip, const USBConfig &config); | 设置设备当前使用的配置,通过配置值进行指定 | -| int32_t SetInterface(USBDevicePipe &pipe, const UsbInterface &interface); | 设置指定接口的备选设置,用于在具有相同ID但不同备用设置的两个接口之间进行选择 | -| int32_t GetRawDescriptors(std::vector &vdata); | 获取原始的USB描述符 | -| int32_t GetFileDescriptor(); | 获取文件描述符 | -| bool Close(const USBDevicePipe &pip); | 关闭设备,释放与设备相关的所有系统资源 | -| int32_t PipeRequestWait(USBDevicePipe &pip, int64_t timeout, UsbRequest &req); | 获取异步传输结果 | -| int32_t RequestInitialize(UsbRequest &request); | 初始化异步数据传输request | -| int32_t RequestFree(UsbRequest &request); | 释放异步数据传输request | -| int32_t RequestAbort(UsbRequest &request); | 取消待处理的数据请求 | -| int32_t RequestQueue(UsbRequest &request); | 将指定的端点进行异步数据发送或者接收请求,数据传输方向由端点方向决定 | -| int32_t RegBulkCallback(USBDevicePipe &pip, const USBEndpoint &endpoint, const sptr<IRemoteObject> &cb); | 注册批量传输异步回调函数 | -| int32_t UnRegBulkCallback(USBDevicePipe &pip, const USBEndpoint &endpoint); | 注销批量传输异步回调函 | -| int32_t BulkRead(USBDevicePipe &pip, const USBEndpoint &endpoint, sptr<Ashmem> &ashmem); | 批量传输异步读数据 | -| int32_t BulkWrite(USBDevicePipe &pip, const USBEndpoint &endpoint, sptr<Ashmem> &ashmem); | 批量传输异步写 | -| int32_t BulkCancel(USBDevicePipe &pip, const USBEndpoint &endpoint); | 批量传输异步取消接口,用于取消当前接口的异步批量读写操作 | - - **表2** Device部分 - -| 接口名称 | 功能描述 | -| -------------------------------------------------- | ------------------------------------------------------ | -| int32_t GetCurrentFunctions(int32_t &funcs); | 获取设备模式下的当前USB功能列表的数字组合掩码 | -| int32_t SetCurrentFunctions(int32_t funcs); | 在设备模式下设置当前的USB功能列表 | -| int32_t UsbFunctionsFromString(std::string funcs); | 将给定的功能列表描述字符串转换为功能列表的数字组合掩码 | -| std::string UsbFunctionsToString(int32_t funcs); | 将给定的功能列表的数字组合掩码转换为功能列表描述字符串 | - - **表3** Port部分 - -| 接口名称 | 功能描述 | -| ------------------------------------------------------------ | -------------------------------------------------------- | -| int32_t GetSupportedModes(int32_t portId, int32_t &supportedModes); | 获取指定的端口支持的模式列表的组合掩码 | -| int32_t SetPortRole(int32_t portId, int32_t powerRole, int32_t dataRole); | 设置指定的端口支持的角色模式,包含充电角色、数据传输角色 | -| int32_t GetPorts(std::vector &usbPorts); | 获取物理USB端口描述信息列表 | - -### USB服务子系统使用步骤 - -以bulktransfer为例。 - -1. 获取usb service实例。 - - ```cpp - static OHOS::USB::UsbSrvClient &g_usbClient = OHOS::USB::UsbSrvClient::GetInstance(); - ``` - -2. 获取usb设备列表。 - - ```cpp - std::vector<OHOS::USB::UsbDevice> deviceList; - int32_t ret = g_usbClient.GetDevices(deviceList); - ``` - -3. 申请设备权限。 - - ```cpp - int32_t ret = g_usbClient.RequestRight(device.GetName()); - ``` - -4. 打开设备。 - - ```cpp - USBDevicePipe pip; - int32_t et = g_usbClient.OpenDevice(device, pip); - ``` - -5. 配置设备接口。 - - ```cpp - //interface为deviceList中device的interface。 - ret = g_usbClient.ClaimInterface(pip, interface, true); - ``` - -6. 数据传输。 - - ```cpp - // pipe为打开设备后的数据传输通道,endpoint为device中数据传输的端点,vdata是需要传输或读取的二进制数据块,timeout为传输超时时长。 - srvClient.BulkTransfer(pipe, endpoint, vdata, timeout); - ``` - -7. 关闭设备。 - - ```cpp - ret = g_usbClient.Close(pip); - ``` - -### USB服务子系统使用实例 - -```cpp -#include <cstdio> -#include <iostream> -#include <map> -#include <mutex> -#include <sstream> -#include <sys/time.h> -#include "if_system_ability_manager.h" -#include "ipc_skeleton.h" -#include "iremote_object.h" -#include "iservice_registry.h" -#include "iusb_srv.h" -#include "string_ex.h" -#include "system_ability_definition.h" -#include "usb_common.h" -#include "usb_device.h" -#include "usb_errors.h" -#include "usb_request.h" -#include "usb_server_proxy.h" -#include "usb_srv_client.h" - -const int32_t REQUESTYPE = ((1 << 7) | (0 << 5) | (0 & 0x1f)); -const int32_t REQUESTCMD = 6; -const int32_t VALUE = (2 << 8) + 0; -const int32_t TIMEOUT = 5000; -const int32_t ITFCLASS = 10; -const int32_t PRAMATYPE = 2; -const int32_t BUFFERLENGTH = 21; - -void GetType(OHOS::USB::USBEndpoint &tep, OHOS::USB::USBEndpoint &outEp, bool &outEpFlg) -{ - if ((tep.GetType() == PRAMATYPE)) { - if (tep.GetDirection() == 0) { - outEp = tep; - outEpFlg = true; - } - } -} - -bool SelectEndpoint(OHOS::USB::USBConfig config, - std::vector<OHOS::USB::UsbInterface> interfaces, - OHOS::USB::UsbInterface &interface, - OHOS::USB::USBEndpoint &outEp, - bool &outEpFlg) -{ - for (int32_t i = 0; i < config.GetInterfaceCount(); ++i) { - OHOS::USB::UsbInterface tif = interfaces[i]; - std::vector<OHOS::USB::USBEndpoint> mEndpoints = tif.GetEndpoints(); - for (int32_t j = 0; j < tif.GetEndpointCount(); ++j) { - OHOS::USB::USBEndpoint tep = mEndpoints[j]; - if ((tif.GetClass() == ITFCLASS) && (tif.GetSubClass() == 0) && (tif.GetProtocol() == PRAMATYPE)) { - GetType(tep, outEp, outEpFlg); - } - } - if (outEpFlg) { - interface = interfaces[i]; - return true; - } - std::cout << std::endl; - } - return false; -} - -int OpenDeviceTest(OHOS::USB::UsbSrvClient &Instran, OHOS::USB::UsbDevice device, OHOS::USB::USBDevicePipe &pip) -{ - int ret = Instran.RequestRight(device.GetName()); - std::cout << "device RequestRight ret = " << ret << std::endl; - if (0 != ret) { - std::cout << "device RequestRight failed = " << ret << std::endl; - } - ret = Instran.OpenDevice(device, pip); - return ret; -} - -int CtrTransferTest(OHOS::USB::UsbSrvClient &Instran, OHOS::USB::USBDevicePipe &pip) -{ - std::cout << "usb_device_test : << Control Transfer >> " << std::endl; - std::vector<uint8_t> vData; - const OHOS::USB::UsbCtrlTransfer tctrl = {REQUESTYPE, REQUESTCMD, VALUE, 0, TIMEOUT}; - int ret = Instran.ControlTransfer(pip, tctrl, vData); - if (ret != 0) { - std::cout << "control message read failed width ret = " << ret << std::endl; - } else { - } - std::cout << "control message read success" << std::endl; - - return ret; -} - -int ClaimTest(OHOS::USB::UsbSrvClient &Instran, - OHOS::USB::USBDevicePipe &pip, - OHOS::USB::UsbInterface &interface, - bool interfaceFlg) -{ - if (interfaceFlg) { - std::cout << "ClaimInterface InterfaceInfo:" << interface.ToString() << std::endl; - int ret = Instran.ClaimInterface(pip, interface, true); - if (ret != 0) { - std::cout << "ClaimInterface failed width ret = " << ret << std::endl; - } else { - std::cout << "ClaimInterface success" << std::endl; - } - } - return 0; -} - -int BulkTransferTest(OHOS::USB::UsbSrvClient &Instran, - OHOS::USB::USBDevicePipe &pip, - OHOS::USB::USBEndpoint &outEp, - bool interfaceFlg, - bool outEpFlg) -{ - if (interfaceFlg) { - std::cout << "usb_device_test : << Bulk transfer start >> " << std::endl; - if (outEpFlg) { - uint8_t buffer[50] = "hello world 123456789"; - std::vector<uint8_t> vData(buffer, buffer + BUFFERLENGTH); - int ret = Instran.BulkTransfer(pip, outEp, vData, TIMEOUT); - if (ret != 0) { - std::cout << "Bulk transfer write failed width ret = " << ret << std::endl; - } else { - std::cout << "Bulk transfer write success" << std::endl; - } - return ret; - } - } - return 0; -} - -int main(int argc, char **argv) -{ - std::cout << "usb_device_test " << std::endl; - static OHOS::USB::UsbSrvClient &Instran = OHOS::USB::UsbSrvClient::GetInstance(); - // GetDevices - std::vector<OHOS::USB::UsbDevice> deviceList; - int32_t ret = Instran.GetDevices(deviceList); - if (ret != 0) { - return OHOS::USB::UEC_SERVICE_INVALID_VALUE; - } - if (deviceList.empty()) { - return OHOS::USB::UEC_SERVICE_INVALID_VALUE; - } - - OHOS::USB::UsbDevice device = deviceList[0]; - std::vector<OHOS::USB::USBConfig> configs = device.GetConfigs(); - OHOS::USB::USBConfig config = configs[0]; - std::vector<OHOS::USB::UsbInterface> interfaces = config.GetInterfaces(); - OHOS::USB::UsbInterface interface; - OHOS::USB::USBEndpoint outEp; - bool interfaceFlg = false; - bool outEpFlg = false; - interfaceFlg = SelectEndpoint(config, interfaces, interface, outEp, outEpFlg); - - // OpenDevice - std::cout << "usb_device_test : << OpenDevice >> test begin -> " << std::endl; - OHOS::USB::USBDevicePipe pip; - ret = OpenDeviceTest(Instran, device, pip); - if (ret != 0) { - return OHOS::USB::UEC_SERVICE_INVALID_VALUE; - } - - // ControlTransfer - CtrTransferTest(Instran, pip); - - // ClaimInterface - ClaimTest(Instran, pip, interface, interfaceFlg); - - // BulkTransferWrite - BulkTransferTest(Instran, pip, outEp, interfaceFlg, outEpFlg); - - // CloseDevice - std::cout << "usb_device_test : << Close Device >> " << std::endl; - ret = Instran.Close(pip); - if (ret == 0) { - std::cout << "Close device failed width ret = " << ret << std::endl; - return OHOS::USB::UEC_SERVICE_INVALID_VALUE; - } else { - std::cout << "Close Device success" << std::endl; - } - return 0; -} -``` - -### 参考手册 - -[驱动子系统](https://gitee.com/openharmony/docs/blob/master/zh-cn/readme/%E9%A9%B1%E5%8A%A8%E5%AD%90%E7%B3%BB%E7%BB%9F.md) - -[drivers\_peripheral](https://gitee.com/openharmony/drivers_peripheral/blob/master/README_zh.md) - -[drivers\_framework](https://gitee.com/openharmony/drivers_framework/blob/master/README_zh.md) - -[drivers\_adapter](https://gitee.com/openharmony/drivers_adapter/blob/master/README_zh.md) - -[drivers\_adapter\_khdf\_linux](https://gitee.com/openharmony/drivers_adapter_khdf_linux/blob/master/README_zh.md) \ No newline at end of file diff --git a/zh-cn/device-dev/website.md b/zh-cn/device-dev/website.md index 221a960eb6e41f361cddaf2663aefb7afdb61026..26cbf9bbe2345509f7e9f83c475174b92c5b779a 100644 --- a/zh-cn/device-dev/website.md +++ b/zh-cn/device-dev/website.md @@ -216,6 +216,7 @@ - [动态加载与链接](kernel/kernel-small-bundles-linking.md) - [虚拟动态共享库](kernel/kernel-small-bundles-share.md) - [轻量级进程间通信](kernel/kernel-small-bundles-ipc.md) + - [容器隔离](kernel/kernel-small-bundles-container.md) - 文件系统 - [虚拟文件系统](kernel/kernel-small-bundles-fs-virtual.md) - [支持的文件系统](kernel/kernel-small-bundles-fs-support.md) @@ -417,22 +418,13 @@ - [音视频播放开发指导](subsystems/subsys-multimedia-video-play-guide.md) - [音视频录制开发指导](subsystems/subsys-multimedia-video-record-guide.md) - [公共基础库开发指导](subsystems/subsys-utils-guide.md) - - [AI框架开发指导](subsystems/subsys-ai-aiframework-devguide.md) - - 数据管理 - - 关系型数据库 - - [关系型数据库概述](subsystems/subsys-data-relational-database-overview.md) - - [关系型数据库开发指导](subsystems/subsys-data-relational-database-guide.md) - - 轻量级数据存储 - - [轻量级数据存储概述](subsystems/subsys-data-storage-overview.md) - - [轻量级数据存储开发指导](subsystems/subsys-data-storage-guide.md) + - AI服务 + - [AI框架开发指导](subsystems/subsys-ai-aiframework-devguide.md) + - [NNRt开发指导](subsystems/subsys-ai-nnrt-guide.md) - Sensor服务 - [Sensor服务概述](subsystems/subsys-sensor-overview.md) - [Sensor服务使用指导](subsystems/subsys-sensor-guide.md) - [Sensor服务使用实例](subsystems/subsys-sensor-demo.md) - - USB服务 - - [USB服务概述](subsystems/subsys-usbservice-overview.md) - - [USB服务使用指导](subsystems/subsys-usbservice-guide.md) - - [USB服务使用实例](subsystems/subsys-usbservice-demo.md) - 用户程序框架 - [概述](subsystems/subsys-application-framework-overview.md) - [搭建环境](subsystems/subsys-application-framework-envbuild.md) @@ -484,6 +476,28 @@ - [HiChecker开发指导](subsystems/subsys-dfx-hichecker.md) - [Faultlogger开发指导](subsystems/subsys-dfx-faultlogger.md) - [Hiview开发指导](subsystems/subsys-dfx-hiview.md) + - 电源 + - 显示管理 + - [系统亮度范围定制开发指导](subsystems/subsys-power-brightness-customization.md) + - 电池管理 + - [电量与LED灯颜色的定制开发指导](subsystems/subsys-power-level-LED-color.md) + - [电池温度保护定制开发指导](subsystems/subsys-power-temperature-protection.md) + - [电量等级定制开发指导](subsystems/subsys-power-battery-level-customization.md) + - [充电限流限压定制开发指导](subsystems/subsys-power-charge-current-voltage-limit.md) + - [充电类型定制开发指导](subsystems/subsys-power-charge-type-customization.md) + - [关机充电动画开发指导](subsystems/subsys-power-poweroff-charge-animation.md) + - 耗电统计 + - [耗电统计定制开发指导](subsystems/subsys-power-stats-power-average-customization.md) + - 热管理 + - [充电空闲状态定制开发指导](subsystems/subsys-thermal_charging_idle_state.md) + - [热管控定制开发指导](subsystems/subsys-thermal_control.md) + - [热检测定制开发指导](subsystems/subsys-thermal_detection.md) + - [热等级定制开发指导](subsystems/subsys-thermal_level.md) + - [热日志定制开发指导](subsystems/subsys-thermal_log.md) + - [热策略定制开发指导](subsystems/subsys-thermal_policy.md) + - [热场景定制开发指导](subsystems/subsys-thermal_scene.md) + - 电源管理 + - [电源模式定制开发指导](subsystems/subsys-power-mode-customization.md) - 专题 - HPM Part @@ -527,7 +541,7 @@ - [xdevice测试调度框架使用指导](device-test/xdevice.md) - 调测工具 - [bytrace使用指导](subsystems/subsys-toolchain-bytrace-guide.md) - - [hdc 使用指导](subsystems/subsys-toolchain-hdc-guide.md) + - [hdc使用指导](subsystems/subsys-toolchain-hdc-guide.md) - [hiperf 使用指南](subsystems/subsys-toolchain-hiperf.md) - [XTS认证](device-test/xts.md) - 工具 @@ -835,5 +849,3 @@ - [osThreadAttr_t](reference/kernel/cmsis/os_thread_attr__t.md) - [osTimerAttr_t](reference/kernel/cmsis/os_timer_attr__t.md) - [osVersion_t](reference/kernel/cmsis/os_version__t.md) - - \ No newline at end of file diff --git a/zh-cn/readme/ARK-Runtime-Subsystem-zh.md b/zh-cn/readme/ARK-Runtime-Subsystem-zh.md index 514bbb14842b9aa7846e18e4aa209d2b699f86bd..109c85f387afb3bf745110d453911ed7e8442452 100644 --- a/zh-cn/readme/ARK-Runtime-Subsystem-zh.md +++ b/zh-cn/readme/ARK-Runtime-Subsystem-zh.md @@ -8,7 +8,7 @@ ## 简介<a name="section11660541593"></a> -方舟编译器\(ArkCompiler\)是为支持多种编程语言、多种芯片平台的联合编译、运行而设计的统一编译运行时平台。它支持包括动态类型和静态类型语言在内的多种编程语言,如JS、TS、ArkTS;它是支撑鸿蒙系统成为打通手机、PC、平板、电视、车机和智能穿戴等多种设备的操作系统的编译运行时底座。 +方舟编译器\(ArkCompiler\)是为支持多种编程语言、多种芯片平台的联合编译、运行而设计的统一编译运行时平台。它支持包括动态类型和静态类型语言在内的多种编程语言,如JS、TS、ArkTS;它是支撑OpenHarmony系统成为打通手机、PC、平板、电视、车机和智能穿戴等多种设备的操作系统的编译运行时底座。 ArkCompiler主要分成两个部分:编译工具链与运行时. @@ -57,7 +57,7 @@ ArkCompiler运行时直接运行字节码文件,实现对应语言规范的语 - 原生支持TypeScript: ECMAScript规范没有提供并发语义表述;业界引擎,如浏览器或者Node.js,通常会提供基于Actor并发模型的Worker API来支持多线程开发。Actor模型下执行体之间不共享任何数据对象,通过消息机制进行通信。因此Web引擎或者Node.js引擎的Worker都有启动速度慢、内存占用高这些缺陷。 针对这些缺陷,ArkCompiler的运行时已经实现了Actor实例中的不可变或者不易变的对象(方法和字节码)的共享,较大程度地优化了Actor的启动性能和启动内存。 - 方舟编译运行时不只提供了业界通用的Worker API,还提供了TaskPool作为并发API的增强。TaskPool是一个支持优先级调度、工作线程自动扩缩容的任务池功能库。开发者无需关心并发实例的生命周期,也无需关心任务负载变化时需要创建或者销毁并发实例,极大地简化了高性能多线程鸿蒙应用的开发。 + 方舟编译运行时不只提供了业界通用的Worker API,还提供了TaskPool作为并发API的增强。TaskPool是一个支持优先级调度、工作线程自动扩缩容的任务池功能库。开发者无需关心并发实例的生命周期,也无需关心任务负载变化时需要创建或者销毁并发实例,极大地简化了高性能多线程OpenHarmony应用的开发。 - 安全 @@ -75,7 +75,7 @@ ArkCompiler运行时直接运行字节码文件,实现对应语言规范的语 ## 使用指南<a name="section18393638195820"></a> -[方舟运行时使用指南](https://gitee.com/openharmony/arkcompiler_ets_runtime/blob/master/docs/ARK-Runtime-Usage-Guide-zh.md) +[方舟运行时使用指南](https://gitee.com/openharmony/arkcompiler_ets_runtime/blob/master/docs/README_zh.md) ## 相关仓<a name="section1371113476307"></a> diff --git "a/zh-cn/readme/ArkUI\346\241\206\346\236\266\345\255\220\347\263\273\347\273\237.md" "b/zh-cn/readme/ArkUI\346\241\206\346\236\266\345\255\220\347\263\273\347\273\237.md" index dc1ff40e771617f3c30c7de963431eb4625064fa..df00ec731a169af21ee6bf8026dfa2844a7907ef 100644 --- "a/zh-cn/readme/ArkUI\346\241\206\346\236\266\345\255\220\347\263\273\347\273\237.md" +++ "b/zh-cn/readme/ArkUI\346\241\206\346\236\266\345\255\220\347\263\273\347\273\237.md" @@ -6,7 +6,7 @@ ## 简介<a name="section11660541593"></a> -ArkUI框架是OpenHarmony UI开发框架,提供开发者进行应用UI开发时所必需的能力,包括UI组件、动画、绘制、交互事件、JS API扩展机制等。ArkUI框架提供了两种开发范式,分别是基于eTS的声明式开发范式(简称“声明式开发范式”)和兼容JS的类Web开发范式(简称“类Web开发范式”)。 +ArkUI框架是OpenHarmony UI开发框架,提供开发者进行应用UI开发时所必需的能力,包括UI组件、动画、绘制、交互事件、JS API扩展机制等。ArkUI框架提供了两种开发范式,分别是基于ArkTS的声明式开发范式(简称“声明式开发范式”)和兼容JS的类Web开发范式(简称“类Web开发范式”)。 **框架结构** diff --git "a/zh-cn/readme/XTS\345\255\220\347\263\273\347\273\237.md" "b/zh-cn/readme/XTS\345\255\220\347\263\273\347\273\237.md" index 5823bbe96cf62a4e1fb6f9b5fec6f30d0055a425..35ef584fb9476f59d9a445e60e40de231296f29e 100755 --- "a/zh-cn/readme/XTS\345\255\220\347\263\273\347\273\237.md" +++ "b/zh-cn/readme/XTS\345\255\220\347\263\273\347\273\237.md" @@ -347,7 +347,7 @@ OpenHarmony支持如下几种系统类型: 随版本编译,debug版本编译时会同步编译acts测试套件 - >![](public_sys-resources/icon-note.gif) **说明:** + >**说明:** >acts测试套件编译中间件为静态库,最终链接到版本镜像中 。 @@ -480,7 +480,7 @@ OpenHarmony支持如下几种系统类型: 随版本编译,debug版本编译时会同步编译acts测试套件 - >![](public_sys-resources/icon-note.gif) **说明:** + >**说明:** >小型系统acts独立编译成可执行文件(bin格式), 在编译产物的suites\\acts目录下归档。 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" index 6f9c571461072ad5b20c7131570c3848b8046d17..f8ce7de1145bfd293d218a1546675ef1114b54e7 100644 --- "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" @@ -230,6 +230,4 @@ Linux: [kernel\_linux\_build](https://gitee.com/openharmony/kernel_linux_build/blob/master/README_zh.md) -[kernel\_linux\_4.19](https://gitee.com/openharmony/kernel_linux_4.19/blob/master/README) - [kernel\_linux\_5.10](https://gitee.com/openharmony/kernel_linux_5.10/blob/master/README) diff --git "a/zh-cn/readme/\345\214\205\347\256\241\347\220\206\345\255\220\347\263\273\347\273\237.md" "b/zh-cn/readme/\345\214\205\347\256\241\347\220\206\345\255\220\347\263\273\347\273\237.md" index 6e03c53b4051934c2b75bd342be154f6e0153c5b..cef954a720be1813449838a97ecbed052b4ff74d 100755 --- "a/zh-cn/readme/\345\214\205\347\256\241\347\220\206\345\255\220\347\263\273\347\273\237.md" +++ "b/zh-cn/readme/\345\214\205\347\256\241\347\220\206\345\255\220\347\263\273\347\273\237.md" @@ -179,6 +179,8 @@ bm get -u 包管理子系统 -[**appexecfwk_standard**](https://gitee.com/openharmony/appexecfwk_standard) +[**bundlemanager_bundle_framework**](https://gitee.com/openharmony/bundlemanager_bundle_framework) + +[**bundlemanager_bundle_framework_lite**](https://gitee.com/openharmony/bundlemanager_bundle_framework_lite) [developtools_packing_tool](https://gitee.com/openharmony/developtools_packing_tool) diff --git "a/zh-cn/readme/\345\233\276\345\275\242\345\255\220\347\263\273\347\273\237.md" "b/zh-cn/readme/\345\233\276\345\275\242\345\255\220\347\263\273\347\273\237.md" index f8497b863dc38fe4ebc66f62db2131c1a97ec2ee..080320478a8afbeb377f74a07522fe0bd77da36e 100644 --- "a/zh-cn/readme/\345\233\276\345\275\242\345\255\220\347\263\273\347\273\237.md" +++ "b/zh-cn/readme/\345\233\276\345\275\242\345\255\220\347\263\273\347\273\237.md" @@ -123,7 +123,7 @@ foundation/graphic/standard/ **图形子系统** -- [**graphic_graphic_2d**](https://gitee.com/abbuu_openharmony/graphic_graphic_2d) +- [**graphic_graphic_2d**](https://gitee.com/openharmony/graphic_graphic_2d) - [arkui_ace_engine](https://gitee.com/openharmony/arkui_ace_engine) - [ability_ability_runtime](https://gitee.com/openharmony/ability_ability_runtime) - [multimedia_player_framework](https://gitee.com/openharmony/multimedia_player_framework) diff --git "a/zh-cn/readme/\345\252\222\344\275\223\345\255\220\347\263\273\347\273\237.md" "b/zh-cn/readme/\345\252\222\344\275\223\345\255\220\347\263\273\347\273\237.md" index 5ecc31d2e210e10e6f51d7e0cc2619bb854343ca..85e807f08555075188d6a3e23c84e64775648ca0 100755 --- "a/zh-cn/readme/\345\252\222\344\275\223\345\255\220\347\263\273\347\273\237.md" +++ "b/zh-cn/readme/\345\252\222\344\275\223\345\255\220\347\263\273\347\273\237.md" @@ -26,7 +26,7 @@ - **Media**: 为应用提供播放、录制等接口,通过跨进程调用或直接调用方式,调用媒体引擎Gstreamer、Histreamer或其它引擎。 - mini设备上,Media部件调用Histreamer支持音频播放等功能。 - - small设备上,Media部件调用recorder_lite支持音视频录制,默认调用player_lite支持音视频播放,通过设置系统属性变量debug.media_service.histreamer为1使用histreamer。详细设置方法参见[syspara系统属性组件使用说明](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/subsystems/subsys-boot-syspara.md)或者参见[syspara模块代码](https://gitee.com/openharmony/startup_syspara_lite)。 + - small设备上,Media部件调用recorder_lite支持音视频录制,默认调用player_lite支持音视频播放,通过设置系统属性变量debug.media_service.histreamer为1使用histreamer。详细设置方法参见[syspara系统属性组件使用说明](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/subsystems/subsys-boot-init-sysparam.md)或者参见[syspara模块代码](https://gitee.com/openharmony/startup_syspara_lite)。 - standard设备上,Media部件调用Gstreamer支持音视频播放、音视频录制。 - **Audio**: Audio部件支持音频输入输出、策略管理、音频焦点管理等功能。 - **Camera**: Camera部件提供相机操作接口,支持预览、拍照、录像。 @@ -91,7 +91,7 @@ 如架构图示意,媒体提供了三大类功能接口,开发者可以根据使用诉求,综合使用一类或多类接口: -- 应用开发者使用媒体接口实现录像、预览和播放音视频,使用可以参考[多媒体开发指南](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/subsystems/subsys-multimedia.md)。 +- 应用开发者使用媒体接口实现录像、预览和播放音视频,使用可以参考[多媒体开发指南](../application-dev/media)。 - 当使用简单播放录制功能时,可以使用Player和Recorder快速完成播放和录制功能。 - 提供了一组控制相机的有效接口,可以让用户方便开发使用相机。 - 开发者先创建camerakit组件对象,注册各种事件回调,这些事件回调是用来响应多媒体模块中事件响应的,之后调用创建camera就可以创建一个操作camera资源的对象,使用这个对象可以启动预览、录像或抓拍取流,及设置取流的相关参数。 diff --git a/zh-cn/release-notes/OpenHarmony-1-0.md b/zh-cn/release-notes/OpenHarmony-1-0.md index 10935823396f1044c333f60e313b6c7f965eccb6..a9f5e60b8a285f77957135220da52eb4dc736307 100755 --- a/zh-cn/release-notes/OpenHarmony-1-0.md +++ b/zh-cn/release-notes/OpenHarmony-1-0.md @@ -1,4 +1,4 @@ -# OpenHarmony 1.0(2020-09-10) +# OpenHarmony 1.0(2020-09-10)(停止维护) ## 版本概述 @@ -35,4 +35,4 @@ repo sync -c ```shell git clone https://gitee.com/openharmony/manifest.git -b master -``` \ No newline at end of file +``` diff --git a/zh-cn/release-notes/OpenHarmony-1-1-0-LTS.md b/zh-cn/release-notes/OpenHarmony-1-1-0-LTS.md index 3c26f84f6e6b535c0b41f40abfa65467a9c1c9cf..88f2ac06e7f41279dad244c994b9362f2012ee5f 100755 --- a/zh-cn/release-notes/OpenHarmony-1-1-0-LTS.md +++ b/zh-cn/release-notes/OpenHarmony-1-1-0-LTS.md @@ -1,4 +1,4 @@ -# OpenHarmony 1.1.0 LTS(2021-04-01) +# OpenHarmony 1.1.0 LTS(2021-04-01)(停止维护) ## 版本概述 diff --git a/zh-cn/release-notes/OpenHarmony-1-1-1-LTS.md b/zh-cn/release-notes/OpenHarmony-1-1-1-LTS.md index 31eeea9bde4d857f6f9ad4a0c515ee2051cecb18..2a8ab607f2e7c5e204dd947784064496cfb4e1ea 100755 --- a/zh-cn/release-notes/OpenHarmony-1-1-1-LTS.md +++ b/zh-cn/release-notes/OpenHarmony-1-1-1-LTS.md @@ -1,4 +1,4 @@ -# OpenHarmony 1.1.1 LTS(2021-06-22) +# OpenHarmony 1.1.1 LTS(2021-06-22)(停止维护) ## 版本概述 diff --git a/zh-cn/release-notes/OpenHarmony-v1-1-3-LTS.md b/zh-cn/release-notes/OpenHarmony-v1-1-3-LTS.md index 06220f8a394909e0599b45be324bea2416c0c3b8..acab8de1d8383896cd57a26873ecc879047fc739 100644 --- a/zh-cn/release-notes/OpenHarmony-v1-1-3-LTS.md +++ b/zh-cn/release-notes/OpenHarmony-v1-1-3-LTS.md @@ -1,4 +1,4 @@ -# OpenHarmony v1.1.3 LTS +# OpenHarmony v1.1.3 LTS (停止维护) ## 版本概述 diff --git a/zh-cn/release-notes/OpenHarmony-v1-1-4-LTS.md b/zh-cn/release-notes/OpenHarmony-v1-1-4-LTS.md index f12df131aa6cec6c96bdc526ea47f89dffd65386..879fa99eb707bdcf1f870357c4568baec12f29d3 100644 --- a/zh-cn/release-notes/OpenHarmony-v1-1-4-LTS.md +++ b/zh-cn/release-notes/OpenHarmony-v1-1-4-LTS.md @@ -1,4 +1,4 @@ -# OpenHarmony 1.1.4 LTS +# OpenHarmony 1.1.4 LTS (停止维护) ## 版本概述 @@ -66,7 +66,7 @@ repo forall -c 'git lfs pull' ### 芯片及开发板适配 -芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard_cn.md)信息。 +芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig_devboard/sig_devboard_cn.md)信息。 ## 修复缺陷列表 diff --git a/zh-cn/release-notes/OpenHarmony-v1.1.2-LTS.md b/zh-cn/release-notes/OpenHarmony-v1.1.2-LTS.md index 69048b3421fe3c5b6e2740135534e1e338a17e71..ca3c8d336f2c17ee3b0f6cff7316df2190ef0801 100644 --- a/zh-cn/release-notes/OpenHarmony-v1.1.2-LTS.md +++ b/zh-cn/release-notes/OpenHarmony-v1.1.2-LTS.md @@ -1,4 +1,4 @@ -# OpenHarmony v1.1.2 LTS +# OpenHarmony v1.1.2 LTS (停止维护) ## 版本概述 diff --git a/zh-cn/release-notes/OpenHarmony-v1.1.5-LTS.md b/zh-cn/release-notes/OpenHarmony-v1.1.5-LTS.md index 0dfc9e23fa0c16514f8f74c9b214a371b4c4e66c..1bf13687086eca5505c12a77cfdb86b1491d9b32 100644 --- a/zh-cn/release-notes/OpenHarmony-v1.1.5-LTS.md +++ b/zh-cn/release-notes/OpenHarmony-v1.1.5-LTS.md @@ -1,4 +1,4 @@ -# OpenHarmony 1.1.5 LTS +# OpenHarmony 1.1.5 LTS (停止维护) ## 版本概述 @@ -69,7 +69,7 @@ repo forall -c 'git lfs pull' ### 芯片及开发板适配 -芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard_cn.md)信息。 +芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig_devboard/sig_devboard_cn.md)信息。 ## 修复缺陷列表 diff --git a/zh-cn/release-notes/OpenHarmony-v3.0-LTS.md b/zh-cn/release-notes/OpenHarmony-v3.0-LTS.md index 3d02a0031e96527af22b5eea6485e2afd81c2f55..017f75dc57bb696fc531564560a42f511559cefe 100644 --- a/zh-cn/release-notes/OpenHarmony-v3.0-LTS.md +++ b/zh-cn/release-notes/OpenHarmony-v3.0-LTS.md @@ -132,7 +132,7 @@ API变更请参考:[JS API 差异报告](api-diff/v3.0-LTS/js-apidiff-v3.0-lts ### 芯片及开发板适配 -芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard_cn.md)信息。 +芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig_devboard/sig_devboard_cn.md)信息。 ## 修复缺陷列表 diff --git a/zh-cn/release-notes/OpenHarmony-v3.0.1-LTS.md b/zh-cn/release-notes/OpenHarmony-v3.0.1-LTS.md index 5a165d4d67a45933981e830498fd248dbdb8b904..02443e1d8f5ecd95f65f6a84461df9ffe8a52c33 100644 --- a/zh-cn/release-notes/OpenHarmony-v3.0.1-LTS.md +++ b/zh-cn/release-notes/OpenHarmony-v3.0.1-LTS.md @@ -71,7 +71,7 @@ repo forall -c 'git lfs pull' ### 芯片及开发板适配 -芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard_cn.md)信息。 +芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig_devboard/sig_devboard_cn.md)信息。 ## 修复缺陷列表 diff --git a/zh-cn/release-notes/OpenHarmony-v3.0.2-LTS.md b/zh-cn/release-notes/OpenHarmony-v3.0.2-LTS.md index 6dd84fdfeac418e6c8fb957d68205dbe65d3cf55..fe4b8f89a79062568bf9a629bd5b21898eeafbb1 100644 --- a/zh-cn/release-notes/OpenHarmony-v3.0.2-LTS.md +++ b/zh-cn/release-notes/OpenHarmony-v3.0.2-LTS.md @@ -72,7 +72,7 @@ repo forall -c 'git lfs pull' ### 芯片及开发板适配 -芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard_cn.md)信息。 +芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig_devboard/sig_devboard_cn.md)信息。 ## 修复缺陷列表 diff --git a/zh-cn/release-notes/OpenHarmony-v3.0.3-LTS.md b/zh-cn/release-notes/OpenHarmony-v3.0.3-LTS.md index abf23f7d3675fc90e1c0b70213ce773c4e1726ee..de6c92504636765986d09defb39c2ac12a171116 100644 --- a/zh-cn/release-notes/OpenHarmony-v3.0.3-LTS.md +++ b/zh-cn/release-notes/OpenHarmony-v3.0.3-LTS.md @@ -72,7 +72,7 @@ repo forall -c 'git lfs pull' ### 芯片及开发板适配 -芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard_cn.md)信息。 +芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig_devboard/sig_devboard_cn.md)信息。 ## 修复缺陷列表 diff --git a/zh-cn/release-notes/OpenHarmony-v3.0.5-LTS.md b/zh-cn/release-notes/OpenHarmony-v3.0.5-LTS.md index 8d577c913225e56646a90f16a8c4d9d12a1a6163..1df0ea339d055ae974a18c9c47ea613e9e2816e5 100644 --- a/zh-cn/release-notes/OpenHarmony-v3.0.5-LTS.md +++ b/zh-cn/release-notes/OpenHarmony-v3.0.5-LTS.md @@ -100,7 +100,7 @@ repo forall -c 'git lfs pull' ### 芯片及开发板适配 -芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard_cn.md)信息。 +芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig_devboard/sig_devboard_cn.md)信息。 ## <sup>修复缺陷列表</sup> diff --git a/zh-cn/release-notes/OpenHarmony-v3.0.6-LTS.md b/zh-cn/release-notes/OpenHarmony-v3.0.6-LTS.md index a2fa9bf54bb06e639c06b8b6ba31b1d5a64b1da9..e8f4653934e3fe6ee0e54785cdebad75dd35da26 100644 --- a/zh-cn/release-notes/OpenHarmony-v3.0.6-LTS.md +++ b/zh-cn/release-notes/OpenHarmony-v3.0.6-LTS.md @@ -91,7 +91,7 @@ repo forall -c 'git lfs pull' ### 芯片及开发板适配 -芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard_cn.md)信息。 +芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig_devboard/sig_devboard_cn.md)信息。 ## <sup>修复安全漏洞列表</sup> diff --git a/zh-cn/release-notes/OpenHarmony-v3.0.7-LTS.md b/zh-cn/release-notes/OpenHarmony-v3.0.7-LTS.md index e88c57ae3db39fb0e7f25eb69c4a73b7f8ff9950..b666952881b0d8501ae8180eb7633296857d1ce1 100644 --- a/zh-cn/release-notes/OpenHarmony-v3.0.7-LTS.md +++ b/zh-cn/release-notes/OpenHarmony-v3.0.7-LTS.md @@ -91,7 +91,7 @@ repo forall -c 'git lfs pull' ### 芯片及开发板适配 -芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard_cn.md)信息。 +芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig_devboard/sig_devboard_cn.md)信息。 ## <sup>修复安全漏洞列表</sup> diff --git a/zh-cn/release-notes/OpenHarmony-v3.0.8-LTS.md b/zh-cn/release-notes/OpenHarmony-v3.0.8-LTS.md new file mode 100644 index 0000000000000000000000000000000000000000..4b08e7efbc79a1365f70e75b9aaaa40cb7b66cb6 --- /dev/null +++ b/zh-cn/release-notes/OpenHarmony-v3.0.8-LTS.md @@ -0,0 +1,122 @@ +# OpenHarmony 3.0.8 LTS + + +## 版本概述 + +此版本为OpenHarmony-3.0-LTS分支上的维护版本,基于OpenHarmony-v3.0.7-LTS版本修复一些安全问题。 + + +## 配套关系 + + **表1** 版本软件和工具配套关系 + +| 软件 | 版本 | 备注 | +| -------- | -------- | -------- | +| OpenHarmony | 3.0.8 LTS | NA | +| HUAWEI DevEco Studio(可选) | 3.0 Beta3 for OpenHarmony | OpenHarmony应用开发推荐使用。 | +| HUAWEI DevEco Device Tool(可选) | 3.0 Release | 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.8-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.8-LTS --no-repo-verify +repo sync -c +repo forall -c 'git lfs pull' +``` + + +### 从镜像站点获取 + + **表2** 获取源码路径 + +| **LTS版本源码** | **版本信息** | **下载站点** | **SHA256校验码** | +| -------- | -------- | -------- | -------- | +| 全量代码(标准、轻量和小型系统) | 3.0.8 | [站点](https://mirrors.huaweicloud.com/harmonyos/os/3.0.8/code-v3.0.8-LTS.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/harmonyos/os/3.0.8/code-v3.0.8-LTS.tar.gz.sha256) | +| 标准系统Hi3516解决方案(二进制) | 3.0.8 | [站点](https://mirrors.huaweicloud.com/harmonyos/os/3.0.8/standard.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/harmonyos/os/3.0.8/standard.tar.gz.sha256) | +| 轻量系统Hi3861解决方案(二进制) | 3.0.8 | [站点](https://mirrors.huaweicloud.com/harmonyos/os/3.0.8/hispark_pegasus.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/harmonyos/os/3.0.8/hispark_pegasus.tar.gz.sha256) | +| 小型系统Hi3516解决方案-LiteOS(二进制) | 3.0.8 | [站点](https://mirrors.huaweicloud.com/harmonyos/os/3.0.8/hispark_taurus.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/harmonyos/os/3.0.8/hispark_taurus.tar.gz.sha256) | +| 小型系统Hi3516解决方案-Linux(二进制) | 3.0.8 | [站点](https://mirrors.huaweicloud.com/harmonyos/os/3.0.8/hispark_taurus_linux.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/harmonyos/os/3.0.8/hispark_taurus_linux.tar.gz.sha256) | + + +## 更新说明 + + +### 特性变更 + +此版本不涉及特性变更。 + + +### API变更 + +此版本不涉及API变更。 + + +### 芯片及开发板适配 + +芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig_devboard/sig_devboard_cn.md)信息。 + + +## <sup>修复安全漏洞列表</sup> + + **表3** 修复的安全漏洞列表 + +| issue编号 | 描述 | 合入链接 | +| -------- | -------- | -------- | +| I5UHRW | 修复组件Kernel_linux_5.10上的CVE-2022-41218、CVE-2022-3424、CVE-2022-42328、CVE-2022-3643、CVE-2022-47946安全漏洞 | [PR](https://gitee.com/openharmony/kernel_linux_5.10/pulls/647) | +| I648XK | 修复组件Kernel_linux_5.10上的CVE-2022-3169安全漏洞 | [PR](https://gitee.com/openharmony/kernel_linux_5.10/pulls/561) | +| I5QBIA | 修复组件Kernel_linux_5.10上的CVE-2022-1184安全漏洞 | [PR](https://gitee.com/openharmony/kernel_linux_5.10/pulls/475) | +| I62G8K | 修复组件Kernel_linux_5.10上的CVE-2022-42895、CVE-2022-42896安全漏洞 | [PR](https://gitee.com/openharmony/kernel_linux_5.10/pulls/545) | +| I63VI6 | 修复组件Kernel_linux_5.10上的CVE-2022-41858安全漏洞 | [PR](https://gitee.com/openharmony/kernel_linux_5.10/pulls/570) | +| I63VID | 修复组件Kernel_linux_5.10上的CVE-2022-45934、CVE-2022-4129、CVE-2022-4378、CVE-2022-3108、CVE-2022-47518、CVE-2022-47521、CVE-2022-47519、CVE-2022-47520安全漏洞 | [PR](https://gitee.com/openharmony/kernel_linux_5.10/pulls/587) | +| I65INV | 修复组件Kernel_linux_5.10上的CVE-2022-4139安全漏洞 | [PR](https://gitee.com/openharmony/kernel_linux_5.10/pulls/568) | +| I66Y94 | 修复组件Kernel_linux_5.10上的CVE-2022-3105、CVE-2022-3104、CVE-2022-3115、CVE-2022-3113、CVE-2022-3112安全漏洞 | [PR](https://gitee.com/openharmony/kernel_linux_5.10/pulls/580) | +| I66Y9Y | 修复组件Kernel_linux_5.10上的CVE-2022-3106安全漏洞 | [PR](https://gitee.com/openharmony/kernel_linux_5.10/pulls/593) | +| I66YAD | 修复组件Kernel_linux_5.10上的CVE-2022-3107安全漏洞 | [PR](https://gitee.com/openharmony/kernel_linux_5.10/pulls/591) | +| I6A4HN | 修复组件Kernel_linux_5.10上的CVE-2022-20568安全漏洞 | [PR](https://gitee.com/openharmony/kernel_linux_5.10/pulls/630) | +| I6A4IZ | 修复组件Kernel_linux_5.10上的CVE-2023-20928安全漏洞 | [PR](https://gitee.com/openharmony/kernel_linux_5.10/pulls/654) | +| I6B0AN | 修复组件Kernel_linux_5.10上的CVE-2022-4696安全漏洞 | [PR](https://gitee.com/openharmony/kernel_linux_5.10/pulls/664) | +| I6B0B4 | 修复组件Kernel_linux_5.10上的CVE-2023-23559、CVE-2023-0179、CVE-2023-23454、CVE-2023-23455安全漏洞 | [PR](https://gitee.com/openharmony/kernel_linux_5.10/pulls/662) | +| I65R5Q | 修复组件third_party_python上的CVE-2022-45061安全漏洞 | [PR](https://gitee.com/openharmony/third_party_python/pulls/40) | +| I6494T | 修复组件third_party_libxml2上的CVE-2022-40303、CVE-2022-40304安全漏洞 | [PR](https://gitee.com/openharmony/third_party_libxml2/pulls/32) | +| I5ZYY3 | 修复组件third_party_pixman上的CVE-2022-44638安全漏洞 | [PR](https://gitee.com/openharmony/third_party_pixman/pulls/12) | +| I5UHVA | 修复组件third_party_u-boot上的CVE-2022-2347安全漏洞 | [PR](https://gitee.com/openharmony/third_party_u-boot/pulls/63) | + + diff --git a/zh-cn/release-notes/OpenHarmony-v3.1-beta.md b/zh-cn/release-notes/OpenHarmony-v3.1-beta.md index 8637f3003d785e70ac0c03fdfdb663368a3139be..b9c359af741f32e7d1997b10549a66058afe5be3 100644 --- a/zh-cn/release-notes/OpenHarmony-v3.1-beta.md +++ b/zh-cn/release-notes/OpenHarmony-v3.1-beta.md @@ -139,7 +139,7 @@ _[Changelog](api-diff/v3.1-beta/changelog-v3.1-beta.md)_ ### 芯片及开发板适配 -芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard_cn.md)信息。 +芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig_devboard/sig_devboard_cn.md)信息。 ### Samples & Codelabs @@ -151,17 +151,17 @@ _[Changelog](api-diff/v3.1-beta/changelog-v3.1-beta.md)_ | 名称 | 简介 | 开发语言 | | -------- | -------- | -------- | -| [Ets公共事件](https://gitee.com/openharmony/app_samples/tree/master/Notification/CommonEvent) | 本示例展示了在eTS中如何使用CommonEvent的接口完成创建订阅者、订阅公共事件、发布公共事件、取消订阅的功能。 | eTS | +| [Ets公共事件](https://gitee.com/openharmony/app_samples/tree/master/Notification/CommonEvent) | 本示例展示了在ArkTS中如何使用CommonEvent的接口完成创建订阅者、订阅公共事件、发布公共事件、取消订阅的功能。 | ArkTS | | [空气质量](https://gitee.com/openharmony/app_samples/tree/master/common/AirQuality) | 本示例使用JS实现了一个简单空气质量应用,使用折行显示能力显示空气质量信息,使用柱形图展示历史记录。 | JS | | [分布式计算器](https://gitee.com/openharmony/app_samples/tree/master/common/DistributeCalc) | 本示例使用JS分布式能力实现了一个简单的计算器应用,可以进行简单的数值计算,支持远程拉起另一个计算器FA,两个FA进行协同计算。 | JS | -| [EtsNotification](https://gitee.com/openharmony/app_samples/tree/master/common/Notification) | 本示例展示了在eTS中如何创建和删除Slot通道,如何发布和取消通知。 | eTS | -| [Ets资源管理](https://gitee.com/openharmony/app_samples/tree/master/common/ResourceManager) | 本示例展示了在eTS中如何调用资源管理的API接口实现字符串和图片资源信息的获取。 | eTS | +| [EtsNotification](https://gitee.com/openharmony/app_samples/tree/master/common/Notification) | 本示例展示了在ArkTS中如何创建和删除Slot通道,如何发布和取消通知。 | ArkTS | +| [Ets资源管理](https://gitee.com/openharmony/app_samples/tree/master/common/ResourceManager) | 本示例展示了在ArkTS中如何调用资源管理的API接口实现字符串和图片资源信息的获取。 | ArkTS | | [kikainput](https://gitee.com/openharmony/app_samples/tree/master/CompleteApps/KikaInput) | kikainput是一个轻量级的输入法应用,支持在运行OpenHarmony OS的智能终端上。 | JS | -| [eTS分布式数据管理](https://gitee.com/openharmony/app_samples/tree/master/data/Kvstore) | 本示例展示了在eTS中分布式数据管理的使用,包括KVManager对象实例的创建和KVStore数据流转的使用。 | eTS | -| [轻量级数据存储](https://gitee.com/openharmony/app_samples/tree/master/data/LiteStorage) | 轻量级数据存储主要提供轻量级Key-Value操作,支持本地应用存储少量数据。本示例通过对购物车商品的添加和删除并保存退出的操作,使得再次打开应用时依然可以保留退出前的购物车信息,体现了轻量级存储在保存轻量级数据时的作用。 | eTS | -| [Ets进程信息](https://gitee.com/openharmony/app_samples/tree/master/ETSUI/Process) | 本示例展示了在eTS中如何获取进程信息和启动一个子进程运行一段shell,包括当前系统运行时间、获取进程当前工作目录、更改进程当前工作目录、发送signal到指定的进程、启动一个子进程、关闭子进程、退出当前系统的功能。 | eTS | -| [Ets运行锁](https://gitee.com/openharmony/app_samples/tree/master/common/Runninglock) | 本示例展示了阻止系统休眠的运行锁功能,通过黑白色壁纸模拟息屏、亮屏状态,来展示系统的休眠状态,从而对运行锁的功能进行测试,使得该运行锁在打开后可以阻止系统休眠。 | eTS | -| [字符串编解码](https://gitee.com/openharmony/app_samples/tree/master/Util/UtilStringCodec) | 本示例对字符串进行了特定格式的输出,对错误码的内容进行了文本输出,对字符串的编码和解码做了演示结果。 | eTS | +| [ArkTS分布式数据管理](https://gitee.com/openharmony/app_samples/tree/master/data/Kvstore) | 本示例展示了在ArkTS中分布式数据管理的使用,包括KVManager对象实例的创建和KVStore数据流转的使用。 | ArkTS | +| [轻量级数据存储](https://gitee.com/openharmony/app_samples/tree/master/data/LiteStorage) | 轻量级数据存储主要提供轻量级Key-Value操作,支持本地应用存储少量数据。本示例通过对购物车商品的添加和删除并保存退出的操作,使得再次打开应用时依然可以保留退出前的购物车信息,体现了轻量级存储在保存轻量级数据时的作用。 | ArkTS | +| [Ets进程信息](https://gitee.com/openharmony/app_samples/tree/master/ETSUI/Process) | 本示例展示了在ArkTS中如何获取进程信息和启动一个子进程运行一段shell,包括当前系统运行时间、获取进程当前工作目录、更改进程当前工作目录、发送signal到指定的进程、启动一个子进程、关闭子进程、退出当前系统的功能。 | ArkTS | +| [Ets运行锁](https://gitee.com/openharmony/app_samples/tree/master/common/Runninglock) | 本示例展示了阻止系统休眠的运行锁功能,通过黑白色壁纸模拟息屏、亮屏状态,来展示系统的休眠状态,从而对运行锁的功能进行测试,使得该运行锁在打开后可以阻止系统休眠。 | ArkTS | +| [字符串编解码](https://gitee.com/openharmony/app_samples/tree/master/Util/UtilStringCodec) | 本示例对字符串进行了特定格式的输出,对错误码的内容进行了文本输出,对字符串的编码和解码做了演示结果。 | ArkTS | | [Js音频播放和管理](https://gitee.com/openharmony/app_samples/tree/master/media/JsAudioPlayer) | 本示例展示了JS音频播放的使用方法,以及音频的音量大小设置。 | JS | | [JsVideo](https://gitee.com/openharmony/app_samples/tree/master/media/JsVideo) | 本示例使用JS UI中的<video/>组件,实现视频播放。可以通过video自带的控制栏进行播放、暂停等操作。 | JS | | [测试打点](https://gitee.com/openharmony/app_samples/tree/master/DFX/JsDotTest) | 本示例展示了测试打点功能,包括应用打点与性能打点两部分。 | JS | @@ -180,17 +180,16 @@ _[Changelog](api-diff/v3.1-beta/changelog-v3.1-beta.md)_ | 名称 | 简介 | 开发语言 | | -------- | -------- | -------- | -| [分布式手写板(eTS)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/DistributeDatabaseDrawEts) | 基于分布式能力,实现多设备同步书写互动。 | eTS | +| [分布式手写板(ArkTS)](https://gitee.com/openharmony/codelabs/tree/master/Distributed/DistributeDatabaseDrawEts) | 基于分布式能力,实现多设备同步书写互动。 | ArkTS | | [分布式数据库](https://gitee.com/openharmony/codelabs/tree/master/Data/JsDistributedData) | 基于分布式数据接口,实现多种设备上一致的数据访问体验。 | JS | | [关系型数据库](https://gitee.com/openharmony/codelabs/tree/master/Data/JSRelationshipData) | 基于关系型数据库和数据管理能力,实现数据库相关应用服务的快速开发。 | JS | -| [极简声明式UI范式(eTS)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/SimpleGalleryEts) | 基于OpenHarmony eTS UI,实现一个图库应用。 | eTS | -| [一次开发多端部署(eTS)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/MultiDeploymentEts) | 基于OpenHarmony eTS UI,实现一次布局,多端部署。 | eTS | -| [购物应用(eTS)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/ShoppingEts) | 基于OpenHarmony eTS UI丰富的组件实现购物商城应用。 | eTS | -| [Page内和Page间导航跳转](https://gitee.com/openharmony/codelabs/tree/master/Ability/PageAbility) | 入门教程,学习如何完成Page内和Page间的页面导航跳转。 | eTS | -| [转场动画的使用(eTS)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/TransitionAnimtaionEts) | 基于OpenHarmony eTS UI转场动画,实现了页面间转场、组件内转场以及共享元素转场。 | eTS | -| [基础组件Slider的使用(eTS)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/SliderApplicationEts) | 基于OpenHarmony eTS UI,使用slider组件,实现可调节风车大小和转速的动画效果。 | eTS | -| [流式布局(eTS)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/FlowLayoutEts) | 基于OpenHarmony eTS UI,实现流式布局效果。 | eTS | -| [弹窗(eTS)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/CustomDialogEts) | 基于OpenHarmony eTS UI,实现警告弹窗和自定义弹窗。 | eTS | +| [极简声明式UI范式(ArkTS)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/SimpleGalleryEts) | 基于OpenHarmony ArkUI,实现一个图库应用。 | ArkTS | +| [一次开发多端部署(ArkTS)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/Multi_device) | 基于OpenHarmony ArkUI,实现一次布局,多端部署。 | ArkTS | +| [购物应用(ArkTS)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/ShoppingEts) | 基于OpenHarmony ArkUI丰富的组件实现购物商城应用。 | ArkTS | +| [转场动画的使用(ArkTS)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/TransitionAnimation) | 基于OpenHarmony ArkUI转场动画,实现了页面间转场、组件内转场以及共享元素转场。 | ArkTS | +| [基础组件Slider的使用(ArkTS)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/SliderExample) | 基于OpenHarmony eTS UI,使用slider组件,实现可调节风车大小和转速的动画效果。 | ArkTS | +| [流式布局(ArkTS)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/FlowLayoutEts) | 基于OpenHarmony ArkUI,实现流式布局效果。 | ArkTS | +| [弹窗(ArkTS)](https://gitee.com/openharmony/codelabs/tree/master/ETSUI/CustomDialogEts) | 基于OpenHarmony ArkUI,实现警告弹窗和自定义弹窗。 | ArkTS | ## 修复缺陷列表 diff --git a/zh-cn/release-notes/OpenHarmony-v3.1-release.md b/zh-cn/release-notes/OpenHarmony-v3.1-release.md index 4be25e2a100c4aac21fa82a474fbf84fdda649d0..21732e03288469bccac9c5dfce8eafbf59216d33 100755 --- a/zh-cn/release-notes/OpenHarmony-v3.1-release.md +++ b/zh-cn/release-notes/OpenHarmony-v3.1-release.md @@ -195,7 +195,7 @@ _[API差异报告](api-diff/v3.1-Release/Readme-CN.md)_ ### 芯片及开发板适配 -芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard_cn.md)信息。 +芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig_devboard/sig_devboard_cn.md)信息。 ### Samples & Codelabs @@ -205,23 +205,23 @@ _[API差异报告](api-diff/v3.1-Release/Readme-CN.md)_ | 子系统 | 名称 | 简介 | 开发语言 | | -------- | -------- | -------- | -------- | -| 电话服务 | [短信服务](https://gitee.com/openharmony/app_samples/tree/master/Telephony/Message) | 本示例展示了电话服务中发送短信的功能。 | eTS | -| 电话服务 | [网络搜索](https://gitee.com/openharmony/app_samples/tree/master/Telephony/RadioTech) | 本示例通过eTS来展示电话服务中网络搜索功能,包含无线接入技术、网络状态、选网模式、ISO国家码、信号强度信息列表及Radio是否打开。 | eTS | -| 设备管理 | [系统电源管理](https://gitee.com/openharmony/app_samples/tree/master/common/PowerManager) | 本示例展示了关机、重启以及检测亮灭屏状态的功能。 | eTS | -| 设备管理 | [传感器](https://gitee.com/openharmony/app_samples/tree/master/device/Sensor) | 本示例采用了传感器接口中的方向传感器,实现了指南针的效果。 | eTS | -| 设备管理 | [设备管理](https://gitee.com/openharmony/app_samples/tree/master/device/DeviceManager) | 本示例展示了在eTS中DeviceManager接口的使用,包括获取授信设备列表,设备扫描,设备认证,设备状态订阅。 | eTS | -| 帐号管理 | [应用帐号管理](https://gitee.com/openharmony/app_samples/tree/master/Account/AppAccountManager) | 本示例选择应用进行注册/登录,并设置帐号相关信息,简要说明应用帐号管理相关功能。 | eTS | -| ArkUI | [web](https://gitee.com/openharmony/app_samples/tree/master/ETSUI/Web) | 本示例主要展示了web的功能页面。 | eTS | -| ArkUI | [拖拽](https://gitee.com/openharmony/app_samples/tree/master/ETSUI/Drag) | 本示例主要展示了拖拽操作的功能。 | eTS | -| ArkUI | [动画](https://gitee.com/openharmony/app_samples/tree/master/ETSUI/ArkUIAnimation) | 本示例通过点击按钮触发动画,向用户展示属性动画与显示动画的效果。 | eTS | -| 数据管理 | [分布式数据库-结果集和谓词查询](https://gitee.com/openharmony/app_samples/tree/master/data/DDMQuery) | 本示例展示了分布式数据管理中,如何通过构建query对象, 查询kvstore中的数据,获取结果集。 | eTS | -| 数据管理 | [关系型数据库](https://gitee.com/openharmony/app_samples/tree/master/data/DistributedRdb) | 本示例展示了在eTS中关系型数据库的使用,包括增、删、改、查等操作。 | eTS | -| 事件 | [后台代理提醒](https://gitee.com/openharmony/app_samples/tree/master/Notification/AlarmClock) | 本示例通过模拟闹钟来展示后台代理提醒的使用方法。 | eTS | -| 事件 | [事件通知](https://gitee.com/openharmony/app_samples/tree/master/Notification/Emitter) | 本示例主要展示进程内事件通知,用户通过选择对应商品并提交订单后在订单列表显示所选商品。 | eTS | -| 通信与连接 | [RPC通信](https://gitee.com/openharmony/app_samples/tree/master/Communication/RPC) | 本示例展示了同一设备中前后台的数据交互,用户前台选择相应的商品与数目,后台计算出结果,回传给前台展示。 | eTS | -| 通信与连接 | [WLAN](https://gitee.com/openharmony/app_samples/tree/master/Communication/Wlan) | 本示例展示了在eTS中WLAN的基本使用,包括禁用和启用WLAN、WLAN扫描和获取扫描结果、WLAN状态监听、WiFi连接状态监听、获取IP信息、获取国家码、判断设备是否支持WLAN相关特性。 | eTS | -| 媒体服务 | [录音机Demo](https://gitee.com/openharmony/app_samples/tree/master/media/Recorder) | 本示例展示媒体服务中音频录制和播放功能的使用。 | eTS | -| 媒体服务 | [多媒体Demo](https://gitee.com/openharmony/app_samples/tree/master/media/MultiMedia) | 本示例展示如何在eTS中调用相机拍照,以及如何使用媒体库接口进行媒体文件的增、删、改、查操作。 | eTS | +| 电话服务 | [短信服务](https://gitee.com/openharmony/app_samples/tree/master/Telephony/Message) | 本示例展示了电话服务中发送短信的功能。 | ArkTS | +| 电话服务 | [网络搜索](https://gitee.com/openharmony/app_samples/tree/master/Telephony/RadioTech) | 本示例通过ArkTS来展示电话服务中网络搜索功能,包含无线接入技术、网络状态、选网模式、ISO国家码、信号强度信息列表及Radio是否打开。 | ArkTS | +| 设备管理 | [系统电源管理](https://gitee.com/openharmony/app_samples/tree/master/common/PowerManager) | 本示例展示了关机、重启以及检测亮灭屏状态的功能。 | ArkTS | +| 设备管理 | [传感器](https://gitee.com/openharmony/app_samples/tree/master/device/Sensor) | 本示例采用了传感器接口中的方向传感器,实现了指南针的效果。 | ArkTS | +| 设备管理 | [设备管理](https://gitee.com/openharmony/app_samples/tree/master/device/DeviceManager) | 本示例展示了在ArkTS中DeviceManager接口的使用,包括获取授信设备列表,设备扫描,设备认证,设备状态订阅。 | ArkTS | +| 帐号管理 | [应用帐号管理](https://gitee.com/openharmony/app_samples/tree/master/Account/AppAccountManager) | 本示例选择应用进行注册/登录,并设置帐号相关信息,简要说明应用帐号管理相关功能。 | ArkTS | +| ArkUI | [web](https://gitee.com/openharmony/app_samples/tree/master/ETSUI/Web) | 本示例主要展示了web的功能页面。 | ArkTS | +| ArkUI | [拖拽](https://gitee.com/openharmony/app_samples/tree/master/ETSUI/Drag) | 本示例主要展示了拖拽操作的功能。 | ArkTS | +| ArkUI | [动画](https://gitee.com/openharmony/app_samples/tree/master/ETSUI/ArkUIAnimation) | 本示例通过点击按钮触发动画,向用户展示属性动画与显示动画的效果。 | ArkTS | +| 数据管理 | [分布式数据库-结果集和谓词查询](https://gitee.com/openharmony/app_samples/tree/master/data/DDMQuery) | 本示例展示了分布式数据管理中,如何通过构建query对象, 查询kvstore中的数据,获取结果集。 | ArkTS | +| 数据管理 | [关系型数据库](https://gitee.com/openharmony/app_samples/tree/master/data/DistributedRdb) | 本示例展示了在ArkTS中关系型数据库的使用,包括增、删、改、查等操作。 | ArkTS | +| 事件 | [后台代理提醒](https://gitee.com/openharmony/app_samples/tree/master/Notification/AlarmClock) | 本示例通过模拟闹钟来展示后台代理提醒的使用方法。 | ArkTS | +| 事件 | [事件通知](https://gitee.com/openharmony/app_samples/tree/master/Notification/Emitter) | 本示例主要展示进程内事件通知,用户通过选择对应商品并提交订单后在订单列表显示所选商品。 | ArkTS | +| 通信与连接 | [RPC通信](https://gitee.com/openharmony/app_samples/tree/master/Communication/RPC) | 本示例展示了同一设备中前后台的数据交互,用户前台选择相应的商品与数目,后台计算出结果,回传给前台展示。 | ArkTS | +| 通信与连接 | [WLAN](https://gitee.com/openharmony/app_samples/tree/master/Communication/Wlan) | 本示例展示了在ArkTS中WLAN的基本使用,包括禁用和启用WLAN、WLAN扫描和获取扫描结果、WLAN状态监听、WiFi连接状态监听、获取IP信息、获取国家码、判断设备是否支持WLAN相关特性。 | ArkTS | +| 媒体服务 | [录音机Demo](https://gitee.com/openharmony/app_samples/tree/master/media/Recorder) | 本示例展示媒体服务中音频录制和播放功能的使用。 | ArkTS | +| 媒体服务 | [多媒体Demo](https://gitee.com/openharmony/app_samples/tree/master/media/MultiMedia) | 本示例展示如何在ArkTS中调用相机拍照,以及如何使用媒体库接口进行媒体文件的增、删、改、查操作。 | ArkTS | 请访问[Samples](https://gitee.com/openharmony/app_samples)仓了解更多信息。 @@ -232,13 +232,13 @@ _[API差异报告](api-diff/v3.1-Release/Readme-CN.md)_ | 项目名称 | 简介 | 开发语言 | | ------------------------------------------------------------ | ------------------------------------------------------------ | -------- | | [分布式鉴权](https://gitee.com/openharmony/codelabs/tree/master/Distributed/GameAuthOpenH) | 使用JS开发一个分布式游戏鉴权应用,介绍分布式拉起,设备管理器对象、显示设备属性接口能力的使用。 | JS | -| [分布式游戏手柄](https://gitee.com/openharmony/codelabs/tree/master/Distributed/HandleGameApplication) | 使用eTS开发一个手柄游戏,利用分布式能力,一个开发板作为手柄,一个开发板作为游戏端。 | eTS | -| [分布式亲子教育](https://gitee.com/openharmony/codelabs/tree/master/Distributed/OpenHarmonyPictureGame) | 使用RPC实现跨设备通讯,以及CommonEvent实现ServiceAbility与FA之间通讯,完成分布式拼图游戏。 | eTS | -| [分布式遥控器](https://gitee.com/openharmony/codelabs/tree/master/Distributed/RemoteControllerETS) | 使用eTS开发一个分布式遥控器,利用分布式能力,一个开发板作为TV端,一个开发板作为遥控器端。 | eTS | -| [音频录制应用](https://gitee.com/openharmony/codelabs/tree/master/Media/Audio_OH_ETS) | 使用媒体组件AudioRecorder收录当前音频、使用AudioPlayer播放录音的方法。 | eTS | -| [备忘录](https://gitee.com/openharmony/codelabs/tree/master/Data/NotePad_OH_ETS) | 使用eTS开发一个简易备忘录,支持新建、删除和收藏笔记功能,轻量级数据库持久化存储数据。 | eTS | -| [分布式邮件编辑](https://gitee.com/openharmony/codelabs/tree/master/Distributed/OHMailETS) | 使用eTS开发分布式邮件,利用分布式的能力,在相同局域网及帐号下,拉起另一个设备,实现邮件在不同设备下的编辑流转。 | eTS | -| [三方库](https://gitee.com/openharmony/codelabs/tree/master/ThirdPartyComponents/VCardDemo) | 介绍openHarmony中三方库vcard库使用:一款写入和读取特定格式的联系人数据(后缀名为vcard的文件)的OpenHarmony组件。 | eTS | +| [分布式游戏手柄](https://gitee.com/openharmony/codelabs/tree/master/Distributed/HandleGameApplication) | 使用ArkTS开发一个手柄游戏,利用分布式能力,一个开发板作为手柄,一个开发板作为游戏端。 | ArkTS | +| [分布式亲子教育](https://gitee.com/openharmony/codelabs/tree/master/Distributed/OpenHarmonyPictureGame) | 使用RPC实现跨设备通讯,以及CommonEvent实现ServiceAbility与FA之间通讯,完成分布式拼图游戏。 | ArkTS | +| [分布式遥控器](https://gitee.com/openharmony/codelabs/tree/master/Distributed/RemoteControllerETS) | 使用ArkTS开发一个分布式遥控器,利用分布式能力,一个开发板作为TV端,一个开发板作为遥控器端。 | ArkTS | +| [音频录制应用](https://gitee.com/openharmony/codelabs/tree/master/Media/Audio_OH_ETS) | 使用媒体组件AudioRecorder收录当前音频、使用AudioPlayer播放录音的方法。 | ArkTS | +| [备忘录](https://gitee.com/openharmony/codelabs/tree/master/Data/NotePad_OH_ETS) | 使用ArkTS开发一个简易备忘录,支持新建、删除和收藏笔记功能,轻量级数据库持久化存储数据。 | ArkTS | +| [分布式邮件编辑](https://gitee.com/openharmony/codelabs/tree/master/Distributed/OHMailETS) | 使用ArkTS开发分布式邮件,利用分布式的能力,在相同局域网及帐号下,拉起另一个设备,实现邮件在不同设备下的编辑流转。 | ArkTS | +| [三方库](https://gitee.com/openharmony/codelabs/tree/master/ThirdPartyComponents/VCardDemo) | 介绍openHarmony中三方库vcard库使用:一款写入和读取特定格式的联系人数据(后缀名为vcard的文件)的OpenHarmony组件。 | ArkTS | ## 修复缺陷列表 diff --git a/zh-cn/release-notes/OpenHarmony-v3.1.1-release.md b/zh-cn/release-notes/OpenHarmony-v3.1.1-release.md index 695fb424302d0db3cae0c99475b6f71a7ce0db9b..f8103db7b38002e72de1771bb972a85a130bf18d 100644 --- a/zh-cn/release-notes/OpenHarmony-v3.1.1-release.md +++ b/zh-cn/release-notes/OpenHarmony-v3.1.1-release.md @@ -142,7 +142,7 @@ repo forall -c 'git lfs pull' ### 芯片及开发板适配 -芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard_cn.md)信息。 +芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig_devboard/sig_devboard_cn.md)信息。 ## 修复缺陷列表 @@ -151,7 +151,7 @@ repo forall -c 'git lfs pull' | ISSUE单 | 问题描述 | | ------------------------------------------------------------ | ------------------------------------------------------------ | | [I4UUFR](https://gitee.com/openharmony/third_party_e2fsprogs/issues/I4UUFR) | 本地编译构建Hi3516开发板版本镜像 | -| [I4WDD3](https://gitee.com/openharmony/multimedia_camera_standard/issues/I4WDD3) | 【RK3568】录像后无法查看视频 | +| I4WDD3 | 【RK3568】录像后无法查看视频 | | [I50EBB](https://gitee.com/openharmony/docs/issues/I50EBB) | 【Hi3516烧录】标准系统Hi3516镜像无法通过IDE烧录 | diff --git a/zh-cn/release-notes/OpenHarmony-v3.1.2-release.md b/zh-cn/release-notes/OpenHarmony-v3.1.2-release.md index c65099937519384a18c9911814ad5b5d5149635e..10544eea754b7b6a6e54d64f2eb9d0b6cec39015 100644 --- a/zh-cn/release-notes/OpenHarmony-v3.1.2-release.md +++ b/zh-cn/release-notes/OpenHarmony-v3.1.2-release.md @@ -87,8 +87,8 @@ repo forall -c 'git lfs pull' | Hi3516标准系统解决方案(二进制) | 3.1.2 Release | [站点](https://mirrors.huaweicloud.com/harmonyos/os/3.1.2/standard_hi3516.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/harmonyos/os/3.1.2/standard_hi3516.tar.gz.sha256) | | RK3568标准系统解决方案(二进制) | 3.1.2 Release | [站点](https://mirrors.huaweicloud.com/harmonyos/os/3.1.2/standard_rk3568.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/harmonyos/os/3.1.2/standard_rk3568.tar.gz.sha256) | | Hi3861轻量系统解决方案(二进制) | 3.1.2 Release | [站点](https://mirrors.huaweicloud.com/harmonyos/os/3.1.2/hispark_pegasus.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/harmonyos/os/3.1.2/hispark_pegasus.tar.gz.sha256) | -| Hi3516轻量系统解决方案-LiteOS(二进制) | 3.1.2 Release | [站点](https://mirrors.huaweicloud.com/harmonyos/os/3.1.2/hispark_taurus.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/harmonyos/os/3.1.2/hispark_taurus.tar.gz.sha256) | -| Hi3516轻量系统解决方案-Linux(二进制) | 3.1.2 Release | [站点](https://mirrors.huaweicloud.com/harmonyos/os/3.1.2/hispark_taurus_linux.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/harmonyos/os/3.1.2/hispark_taurus_linux.tar.gz.sha256) | +| Hi3516小型系统解决方案-LiteOS(二进制) | 3.1.2 Release | [站点](https://mirrors.huaweicloud.com/harmonyos/os/3.1.2/hispark_taurus.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/harmonyos/os/3.1.2/hispark_taurus.tar.gz.sha256) | +| Hi3516小型系统解决方案-Linux(二进制) | 3.1.2 Release | [站点](https://mirrors.huaweicloud.com/harmonyos/os/3.1.2/hispark_taurus_linux.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/harmonyos/os/3.1.2/hispark_taurus_linux.tar.gz.sha256) | | 标准系统Full SDK包(Mac) | 3.1.7.5 | [站点](https://mirrors.huaweicloud.com/harmonyos/os/3.1.2/ohos-sdk-mac-full.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/harmonyos/os/3.1.2/ohos-sdk-mac-full.tar.gz.sha256) | | 标准系统Full SDK包(Windows\Linux) | 3.1.7.5 | [站点](https://mirrors.huaweicloud.com/harmonyos/os/3.1.2/ohos-sdk-full.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/harmonyos/os/3.1.2/ohos-sdk-full.tar.gz.sha256) | | 标准系统Public SDK包(Mac) | 3.1.7.5 | [站点](https://mirrors.huaweicloud.com/harmonyos/os/3.1.2/ohos-sdk-mac-public.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/harmonyos/os/3.1.2/ohos-sdk-mac-public.tar.gz.sha256) | @@ -117,7 +117,7 @@ API变更 ### 芯片及开发板适配 -芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard_cn.md)信息。 +芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig_devboard/sig_devboard_cn.md)信息。 ## 修复缺陷列表 diff --git a/zh-cn/release-notes/OpenHarmony-v3.1.3-release.md b/zh-cn/release-notes/OpenHarmony-v3.1.3-release.md index 493b77b534ac0e867c7cd417067022a983b1df0c..4bbe03317dd3da8339cc1102f7cd86f310c7b6ca 100644 --- a/zh-cn/release-notes/OpenHarmony-v3.1.3-release.md +++ b/zh-cn/release-notes/OpenHarmony-v3.1.3-release.md @@ -13,7 +13,7 @@ | 软件 | 版本 | 备注 | | -------- | -------- | -------- | | OpenHarmony | 3.1.3 Release | NA | -| Full SDK | Ohos_sdk_full 3.1.7.7 (API Version 8 Relese) | 面向OEM厂商提供,包含了需要使用系统权限的系统接口。<br/>使用Full SDK时需要手动从镜像站点获取,并在DevEco Studio中替换,具体操作可参考[替换指南](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/quick-start/full-sdk-switch-guide.md)。 | +| Full SDK | Ohos_sdk_full 3.1.7.7 (API Version 8 Release) | 面向OEM厂商提供,包含了需要使用系统权限的系统接口。<br/>使用Full SDK时需要手动从镜像站点获取,并在DevEco Studio中替换,具体操作可参考[替换指南](../application-dev/quick-start/full-sdk-switch-guide.md)。 | | Public SDK | Ohos_sdk_public 3.1.7.7 (API Version 8 Release) | 面向应用开发者提供,不包含需要使用系统权限的系统接口。<br/>DevEco Studio 3.0 Beta4版本起,通过DevEco Studio获取的SDK默认为Public SDK。 | | HUAWEI DevEco Studio(可选) | 3.0 Release for OpenHarmony | OpenHarmony应用开发推荐使用。 | | HUAWEI DevEco Device Tool(可选) | 3.0 Release | OpenHarmony智能设备集成开发环境推荐使用。 | @@ -77,7 +77,7 @@ repo forall -c 'git lfs pull' | -------- | -------- | -------- | -------- | | 全量代码(标准、轻量和小型系统) | 3.1.3 Release | [站点](https://mirrors.huaweicloud.com/openharmony/os/3.1.3/code-v3.1.3-Release.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/openharmony/os/3.1.3/code-v3.1.3-Release.tar.gz.sha256) | | Hi3516标准系统解决方案(二进制) | 3.1.3 Release | [站点](https://mirrors.huaweicloud.com/openharmony/os/3.1.3/standard_hi3516.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/openharmony/os/3.1.3/standard_hi3516.tar.gz.sha256) | -| RK3568标准系统解决方案(二进制) | 3.1.3 Release | [站点](https://mirrors.huaweicloud.com/openharmony/os/3.1.3/code-v3.1.3-Release.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/openharmony/os/3.1.3/standard_rk3568.tar.gz.sha256) | +| RK3568标准系统解决方案(二进制) | 3.1.3 Release | [站点](https://mirrors.huaweicloud.com/harmonyos/os/3.1.3/standard_rk3568.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/openharmony/os/3.1.3/standard_rk3568.tar.gz.sha256) | | Hi3861轻量系统解决方案(二进制) | 3.1.3 Release | [站点](https://mirrors.huaweicloud.com/openharmony/os/3.1.3/hispark_pegasus.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/openharmony/os/3.1.3/hispark_pegasus.tar.gz.sha256) | | Hi3516小型系统解决方案-LiteOS(二进制) | 3.1.3 Release | [站点](https://mirrors.huaweicloud.com/openharmony/os/3.1.3/hispark_taurus.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/openharmony/os/3.1.3/hispark_taurus.tar.gz.sha256) | | Hi3516小型系统解决方案-Linux(二进制) | 3.1.3 Release | [站点](https://mirrors.huaweicloud.com/openharmony/os/3.1.3/hispark_taurus_linux.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/openharmony/os/3.1.3/hispark_taurus_linux.tar.gz.sha256) | @@ -105,7 +105,7 @@ API变更 ### 芯片及开发板适配 -芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard_cn.md)信息。 +芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig_devboard/sig_devboard_cn.md)信息。 ## 修复缺陷列表 diff --git a/zh-cn/release-notes/OpenHarmony-v3.1.4-release.md b/zh-cn/release-notes/OpenHarmony-v3.1.4-release.md index 19a944c269bda58dbd0495fe7c92d0cb4812d301..f56f8e1469f74728a1ce6a9a62e85d35879ac20e 100644 --- a/zh-cn/release-notes/OpenHarmony-v3.1.4-release.md +++ b/zh-cn/release-notes/OpenHarmony-v3.1.4-release.md @@ -104,7 +104,7 @@ repo forall -c 'git lfs pull' ### 芯片及开发板适配 -芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard_cn.md)信息。 +芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig_devboard/sig_devboard_cn.md)信息。 ### 修复缺陷列表 diff --git a/zh-cn/release-notes/OpenHarmony-v3.1.5-release.md b/zh-cn/release-notes/OpenHarmony-v3.1.5-release.md index 9bafd21ac6fb7ae6c2c408565476ece681a45c4d..a0a014e45f22a93fa462bc70512c13551af4d64b 100644 --- a/zh-cn/release-notes/OpenHarmony-v3.1.5-release.md +++ b/zh-cn/release-notes/OpenHarmony-v3.1.5-release.md @@ -104,7 +104,7 @@ repo forall -c 'git lfs pull' ### 芯片及开发板适配 -芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard_cn.md)信息。 +芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig_devboard/sig_devboard_cn.md)信息。 ### 修复缺陷列表 diff --git a/zh-cn/release-notes/OpenHarmony-v3.1.6-release.md b/zh-cn/release-notes/OpenHarmony-v3.1.6-release.md index da1e6c71bbac5c508443b019c81efa6a8048c240..70dbf6794d2b9b5661afeae9d07e64c1e4d95c9b 100644 --- a/zh-cn/release-notes/OpenHarmony-v3.1.6-release.md +++ b/zh-cn/release-notes/OpenHarmony-v3.1.6-release.md @@ -104,7 +104,7 @@ repo forall -c 'git lfs pull' ### 芯片及开发板适配 -芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard_cn.md)信息。 +芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig_devboard/sig_devboard_cn.md)信息。 ### 修复缺陷列表 diff --git a/zh-cn/release-notes/OpenHarmony-v3.1.7-release.md b/zh-cn/release-notes/OpenHarmony-v3.1.7-release.md new file mode 100644 index 0000000000000000000000000000000000000000..fbab3c400837ea3592304bdd1e6ff8828eb83ff0 --- /dev/null +++ b/zh-cn/release-notes/OpenHarmony-v3.1.7-release.md @@ -0,0 +1,156 @@ +# OpenHarmony 3.1.7 Release + + +## 版本概述 + +当前版本在OpenHarmony 3.1.6 Release的基础上,修复了内存泄漏及linux kernel等开源组件的安全漏洞,增强了系统安全性。修复了部分系统稳定性的issue,增强了系统稳定性。更新配套的SDK版本。 + + +## 配套关系 + + **表1** 版本软件和工具配套关系 + +| 软件 | 版本 | 备注 | +| ------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| OpenHarmony | 3.1.7 Release | NA | +| Full SDK | Ohos_sdk_full 3.1.13.5 (API Version 8 Relese) | 面向OEM厂商提供,包含了需要使用系统权限的系统接口。<br/>使用Full SDK时需要手动从镜像站点获取,并在DevEco Studio中替换,具体操作可参考[替换指南](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/quick-start/full-sdk-switch-guide.md)。 | +| Public SDK | Ohos_sdk_public 3.1.13.5 (API Version 8 Release) | 面向应用开发者提供,不包含需要使用系统权限的系统接口。<br/>DevEco Studio 3.0 Beta4版本起,通过DevEco Studio获取的SDK默认为Public SDK。 | +| HUAWEI DevEco Studio(可选) | 3.1 Preview for OpenHarmony | OpenHarmony应用开发推荐使用。 | +| HUAWEI DevEco Device Tool(可选) | 3.0 Release | 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.1.7-Release --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.1.7-Release --no-repo-verify +repo sync -c +repo forall -c 'git lfs pull' +``` + + +### 从镜像站点获取 + +**表2** 获取源码路径 + +| 版本源码 | **版本信息** | **下载站点** | **SHA256校验码** | +| ------------------------------------------ | ------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| 全量代码(标准、轻量和小型系统) | 3.1.7 Release | [站点](https://mirrors.huaweicloud.com/openharmony/os/3.1.7/code-v3.1.7-Release.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/openharmony/os/3.1.7/code-v3.1.7-Release.tar.gz.sha256) | +| Hi3516标准系统解决方案(二进制) | 3.1.7 Release | [站点](https://mirrors.huaweicloud.com/openharmony/os/3.1.7/standard_hi3516.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/openharmony/os/3.1.7/standard_hi3516.tar.gz.sha256) | +| RK3568标准系统解决方案(二进制) | 3.1.7 Release | [站点](https://mirrors.huaweicloud.com/openharmony/os/3.1.7/standard_rk3568.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/openharmony/os/3.1.7/standard_rk3568.tar.gz.sha256) | +| Hi3861轻量系统解决方案(二进制) | 3.1.7 Release | [站点](https://mirrors.huaweicloud.com/openharmony/os/3.1.7/hispark_pegasus.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/openharmony/os/3.1.7/hispark_pegasus.tar.gz.sha256) | +| Hi3516小型系统解决方案-LiteOS(二进制) | 3.1.7 Release | [站点](https://mirrors.huaweicloud.com/openharmony/os/3.1.7/hispark_taurus.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/openharmony/os/3.1.7/hispark_taurus.tar.gz.sha256) | +| Hi3516小型系统解决方案-Linux(二进制) | 3.1.7 Release | [站点](https://mirrors.huaweicloud.com/openharmony/os/3.1.7/hispark_taurus_linux.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/openharmony/os/3.1.7/hispark_taurus_linux.tar.gz.sha256) | +| 标准系统Full SDK包(Mac) | 3.1.13.5 | [站点](https://mirrors.huaweicloud.com/openharmony/os/3.1.7/ohos-sdk-mac-full.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/openharmony/os/3.1.7/ohos-sdk-mac-full.tar.gz.sha256) | +| 标准系统Full SDK包(Windows\Linux) | 3.1.13.5 | [站点](https://mirrors.huaweicloud.com/openharmony/os/3.1.7/ohos-sdk-full.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/openharmony/os/3.1.7/ohos-sdk-full.tar.gz.sha256) | +| 标准系统Public SDK包(Mac) | 3.1.13.5 | [站点](https://mirrors.huaweicloud.com/openharmony/os/3.1.7/ohos-sdk-mac-public.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/openharmony/os/3.1.7/ohos-sdk-mac-public.tar.gz.sha256) | +| 标准系统Public SDK包(Windows\Linux) | 3.1.13.5 | [站点](https://mirrors.huaweicloud.com/openharmony/os/3.1.7/ohos-sdk-public.tar.gz) | [SHA256校验码](https://mirrors.huaweicloud.com/openharmony/os/3.1.7/ohos-sdk-public.tar.gz.sha256) | + + +## 更新说明 + +本版本在OpenHarmony 3.1.7 Release的基础上有如下变更。 + + +### 特性变更 + +本次版本无新增特性及变更。 + +### API变更 + +3.1.7 Release对比3.1.6 Release API接口无变更。 + + + +### 芯片及开发板适配 + +芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig_devboard/sig_devboard_cn.md)信息。 + + +### 修复缺陷列表 + +**表3** 修复缺陷issue列表 + +| 子系统 | 问题描述 | +| ------------ | ------------------------------------------------------------ | +| 应用子系统 | 进入联系人页面时“无联系人”默认页面一闪而过,进入联系人列表([I5ET9R](https://gitee.com/openharmony/applications_contacts/issues/I5ET9R))<br/>新建卡片推包到rk版,将卡片添加到桌面,长按桌面卡片,弹出服务卡片和移除按钮的同时也打开了应用([I5YB1O](https://gitee.com/openharmony/applications_hap/issues/I5YB1O))<br/>通过工具测出CPPCrash问题([I65H83](https://gitee.com/openharmony/applications_permission_manager/issues/I65H83))<br/>通过工具测出CPPCrash问题([I65TVW](https://gitee.com/openharmony/applications_permission_manager/issues/I65TVW))<br/>Launcher 反复点击recent 按钮会出现内存泄漏([I67SRG](https://gitee.com/openharmony/xts_acts/issues/I67SRG)) | +| 媒体子系统 | 打开图库应用,选择相册页签,点击相机,高概率闪退值桌面([I5QUSZ](https://gitee.com/openharmony/applications_hap/issues/I5QUSZ))<br/>通过工具测出CPPCrash问题([I65GZ1](https://gitee.com/openharmony/multimedia_medialibrary_standard/issues/I65GZ1)) | +| 全球化子系统 | 通过工具测出CPPCrash问题([I65GR8](https://gitee.com/openharmony/global_resmgr_standard/issues/I65GR8)) | +| 无障碍子系统 | 安全注入攻击测试,测试报告中存在服务接口ohos.accessibility.IAccessibleAbilityManagerServiceClient存在注入异常([I65PHE](https://gitee.com/openharmony/accessibility/issues/I65PHE)) | +| ArkUI子系统 | 图像效果功能失效([I65UID](https://gitee.com/openharmony/arkui_ace_engine/issues/I65UID)) | +| 元能力子系统 | 两个窗口分屏配对后,关闭B窗口另一个窗口也会关闭([I6AF0Y](https://gitee.com/openharmony/ability_ability_runtime/issues/I6AF0Y)) | +| DFX子系统 | ohos.samples.distributedmusicplayer出现libhilog.z.so崩溃([I6DCSL](https://gitee.com/openharmony/hiviewdfx_hilog/issues/I6DCSL)) | + + + + +### 修复安全漏洞列表 + +**表4** 修复安全问题列表 + +| ISSUE | 问题描述 | 修复链接 | +| ------ | ------------------------------------------------------------ | ------------------------------------------------------------ | +| I67XCL | 修复组件kernel_linux_5.10上的CVE-2022-3640安全漏洞 | [PR](https://gitee.com/openharmony/kernel_linux_5.10/pulls/659) | +| I6A56Q | 修复组件kernel_linux_5.10上的CVE-2023-20928安全漏洞 | [PR](https://gitee.com/openharmony/kernel_linux_5.10/pulls/653) | +| I6B0K7 | 修复组件kernel_linux_5.10上的CVE-2022-4696安全漏洞 | [PR](https://gitee.com/openharmony/kernel_linux_5.10/pulls/663) | +| I6BNVW | 修复组件mbedtls上的CVE-2021-44732、CVE-2021-45450安全漏洞 | [PR](https://gitee.com/openharmony/third_party_mbedtls/pulls/78) | +| I6BTZM | 修复组件flutter上的CVE-2022-37434安全漏洞 | [PR](https://gitee.com/openharmony/third_party_flutter/pulls/247) | +| I6BXT0 | 修复组件kernel_linux_5.10上的CVE-2023-23559、CVE-2023-0179、CVE-2023-23454、CVE-2023-23455安全漏洞 | [PR](https://gitee.com/openharmony/kernel_linux_5.10/pulls/661) | +| I6DQAH | 修复组件kernel_linux_5.10上的CVE-2023-0590、CVE-2022-3707安全漏洞 | [PR](https://gitee.com/openharmony/kernel_linux_5.10/pulls/687) | +| I6DTV8 | 修复组件libexif上的CVE-2019-9278安全漏洞 | [PR](https://github.com/libexif/libexif/commit/75aa73267fdb1e0ebfbc00369e7312bac43d0566) | +| I6E5KA | 修复组件openssl上的CVE-2023-0286安全漏洞 | [PR](https://gitee.com/openharmony/third_party_openssl/pulls/83) | +| I6FFUV | 修复组件kernel_linux_5.10上的CVE-2023-20938、CVE-2023-0045、CVE-2023-0615安全漏洞 | [PR](https://gitee.com/openharmony/kernel_linux_5.10/pulls/696) | +| I6FZ3A | 修复组件cares上的CVE-2022-4904安全漏洞 | [PR](https://gitee.com/openharmony/third_party_cares/pulls/12) | +| I6HYRO | 修复组件kernel_linux_4.19上的CVE-2022-3028安全漏洞 | [PR](https://gitee.com/openharmony/kernel_linux_4.19/pulls/98) | +| I6JH1I | 修复组件kernel_linux_5.10上的CVE-2023-0461、CVE-2023-23004、CVE-2023-23000、CVE-2023-1078、CVE-2023-1076、CVE-2023-1118、CVE-2023-22995、CVE-2023-26545安全漏洞 | [PR](https://gitee.com/openharmony/kernel_linux_5.10/pulls/725) | +| I6JH1L | 修复组件kernel_linux_4.19上的CVE-2023-0461、CVE-2023-26545、CVE-2022-0480、CVE-2023-1118、CVE-2022-1652、CVE-2021-3760安全漏洞 | [PR](https://gitee.com/openharmony/kernel_linux_4.19/pulls/107) | +| I6JH2L | 修复组件kernel_linux_4.19上的CVE-2023-23559、CVE-2022-47929、CVE-2022-2873、CVE-2023-23455安全漏洞 | [PR](https://gitee.com/openharmony/kernel_linux_4.19/pulls/103) | +| I6LCHO | 修复组件kernel_linux_4.19上的CVE-2023-0030安全漏洞 | [PR](https://gitee.com/openharmony/kernel_linux_4.19/pulls/111) | + +## + +**表5** 遗留缺陷列表 + +| issue | 问题描述 | 影响 | 计划解决日期 | +| ------------------------------------------------------------ | -------------------------------------- | -------------- | ------------ | +| [I6HAUC](https://gitee.com/openharmony/xts_acts/issues/I6HAUC) | 【3.1】调用Windows接口横竖屏鼠标会变形 | 影响开发者体验 | 2023-04-28 | \ No newline at end of file diff --git a/zh-cn/release-notes/OpenHarmony-v3.2-beta1.md b/zh-cn/release-notes/OpenHarmony-v3.2-beta1.md index 4f329dcae95cf542c92673b43dae00eb75c04274..10ad73f5301f0372aa240040a84d2b058c273cd6 100644 --- a/zh-cn/release-notes/OpenHarmony-v3.2-beta1.md +++ b/zh-cn/release-notes/OpenHarmony-v3.2-beta1.md @@ -177,7 +177,7 @@ _[API差异报告](api-diff/v3.2-beta1/Readme-CN.md)_ ### 芯片及开发板适配 -芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard_cn.md)信息。 +芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig_devboard/sig_devboard_cn.md)信息。 ### Samples @@ -186,14 +186,12 @@ _[API差异报告](api-diff/v3.2-beta1/Readme-CN.md)_ | 子系统 | 名称 | 简介 | 开发语言 | | -------- | -------- | -------- | -------- | -| ArkUI | [MouseEvent](https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/MouseEvent) | 本示例模拟了简单的扫雷游戏调用了鼠标事件的相关接口 | ArkTS | | ArkUI | [Vibrator](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/DeviceManagement/Vibrator) | 本示例模拟倒计时场景,展示振动接口的使用方法。 | ArkTS | | DFX | [FaultLogger](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/DFX/FaultLogger) | 本示例展示了在ArkTS中如何获取应用故障相关信息。 | ArkTS | -| ArkUI | [Gallery](https://gitee.com/openharmony/applications_app_samples/tree/master/ETSUI/Gallery) | 本Demo通过不同示例向用户介绍通用事件、通用属性、手势处理等不同组件的功能。 | ArkTS | -| 图形 | [JsWebGL](https://gitee.com/openharmony/applications_app_samples/tree/master/Graphics/JsWebGL) | 本示例调用GPU资源绘制了五角星和矩形,展示WebGL相关接口的使用方法。 | JS | +| ArkUI | [ComponentCollection](https://gitee.com/openharmony/applications_app_samples/tree/master/code/UI/ArkTsComponentClollection/ComponentCollection) | 本示例为ArkUI中组件、通用、动画、全局方法的集合 | ArkTS | | ArkUI | [ArkTSClock](https://gitee.com/openharmony/applications_app_samples/tree/master/code/Solutions/Tools/ArkTSClock) | 本示例使用ArkTS UI能力实现一个简单的时钟应用。 | ArkTS | | 网络管理 | [Http](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Connectivity/Http) | 本示例仿postman输入API接口地址,获取相应数据,介绍数据请求接口的用法。 | ArkTS | -| 网络管理 | [Socket](https://gitee.com/openharmony/applications_app_samples/tree/master/Network/Socket) | 本示例主要演示了Socket在网络通信方面的应用,展示了Socket在两端设备的连接验证、聊天通信方面的应用。 | ArkTS | +| 网络管理 | [Socket](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Connectivity/Socket) | 本示例主要演示了Socket在网络通信方面的应用,展示了Socket在两端设备的连接验证、聊天通信方面的应用。 | ArkTS | | 分布式数据管理 | [DistributedRdb](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/DistributedAppDev/DistributedRdb) | 本示例展示了在ArkTS中分布式关系型数据库的使用,在增、删、改、查的基本操作外,还包括分布式数据库的数据同步能力。 | ArkTS | | 元能力 | [WorkScheduler](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/TaskManagement/WorkScheduler) | 本示例模拟下载更新包 、保存更新包、发送通知 、安装更新包实现升级,将下载任务通过后台任务管理进行处理,实现退出应用后任务仍能够执行,直至任务结束。 | ArkTS | | 元能力 | [AbilityStartMode](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/ApplicationModels/AbilityStartMode) | 本示例展示了在一个Stage模型中,实现standard、singleton、specified多种模式场景。 | ArkTS | @@ -205,7 +203,6 @@ _[API差异报告](api-diff/v3.2-beta1/Readme-CN.md)_ | ArkUI | [Game2048](https://gitee.com/openharmony/applications_app_samples/tree/master/code/Solutions/Game/Game2048) | 2048是一款比较流行的数字游戏,此游戏demo是grid组件基础上进行开发完成的。 | ArkTS | | 一多设置典型页面 | [Settings](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/MultiDeviceAppDev/Settings) | 本示例展示了设置应用的典型页面,其在小窗口和大窗口有不同的显示效果,体现一次开发、多端部署的能力。 | ArkTS | | 分布式数据管理 | [Preference](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/DataManagement/Preferences) | 本示例主要展示了首选项在主题切换方面的功能。 | ArkTS | -| ArkUI | [NativeAPI](https://gitee.com/openharmony/app_samples/tree/master/Native/NativeAPI) | 本示例展示了在ArkTS中如何调用C++的接口以及C++如何回调JS,完成了一个简单的五子棋游戏,在native层完成计算逻辑,ArkTS完成界面绘制和刷新。 | ArkTS/C++ | | 全球化 | [International](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/Internationalnation/International) | 本示例展示了i18n,intl,resourceManager在ArkTS中的使用,使用相关api实现系统语言和地区设置、时间和时区设置,展示了区域格式化示例。 | ArkTS | 请访问[Samples](https://gitee.com/openharmony/applications_app_samples)仓了解更多信息。 diff --git a/zh-cn/release-notes/OpenHarmony-v3.2-beta2.md b/zh-cn/release-notes/OpenHarmony-v3.2-beta2.md index 0499b185f8884b8ab15519c383f579609da1c8b1..93ed6c57df706d1f03612bfba6e3403a5a6efd93 100644 --- a/zh-cn/release-notes/OpenHarmony-v3.2-beta2.md +++ b/zh-cn/release-notes/OpenHarmony-v3.2-beta2.md @@ -162,7 +162,7 @@ ### 芯片及开发板适配 -芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard_cn.md)信息。 +芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig_devboard/sig_devboard_cn.md)信息。 ### Samples diff --git a/zh-cn/release-notes/OpenHarmony-v3.2-beta3.md b/zh-cn/release-notes/OpenHarmony-v3.2-beta3.md index baf256f286cf0bae5da653354f11dc60f73c18d5..1cf5cace6f9b2aa29a6012aa382299608713cb63 100644 --- a/zh-cn/release-notes/OpenHarmony-v3.2-beta3.md +++ b/zh-cn/release-notes/OpenHarmony-v3.2-beta3.md @@ -181,7 +181,7 @@ API变更请参考: ### 芯片及开发板适配 -芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard_cn.md)信息。 +芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig_devboard/sig_devboard_cn.md)信息。 ### Samples @@ -193,7 +193,7 @@ API变更请参考: | ArkUI | [HealthyDiet:健康饮食](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/MultiDeviceAppDev/HealthyDiet) | 这是一个记录饮食和查看食物信息的应用,主要用于管理饮食健康。可以添加饮食信息,包括食物的种类、重量以及用餐时间,如早餐、 午餐、晚餐和夜宵,并能统计得到相应用餐时间的总热量值、总蛋白质、总脂肪和总碳水值,并且用柱状图的形式展示出来。 | ArkTS | | ArkUI | [MusicAlbum:一多音乐专辑主页](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/MultiDeviceAppDev/MusicAlbum) | 本示例展示了音乐专辑主页,使用一次开发多端部署中介绍的自适应布局能力和响应式布局能力进行多设备(或多窗口尺寸)适配,保证应用在不同设备或不同窗口尺寸下可以正常显示。 | ArkTS | | 元能力、文件管理 | [CustomShare:自定义分享](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/ApplicationModels/CustomShare) | 分享的主要工作是实现:发送方将文本,链接,图片文件三种类型分享给三方应用,同时能够在三方应用中分别呈现出来。 | ArkTS | -| 元能力 | [GalleryForm:图库卡片](https://gitee.com/openharmony/applications_app_samples/tree/master/ability/GalleryForm) | 本示例是模拟图库卡片,实现对图库中的照片在卡片中显示,定时刷新卡片内容等功能。 | ArkTS | +| 元能力 | [FormExtAbility:Stage模型卡片](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/Widget/FormExtAbility) | 本示例展示了Stage模型卡片提供方的创建与使用。 | ArkTS | | ArkUI | [AppMarket:一多应用市场首页](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/MultiDeviceAppDev/AppMarket) | 本示例展示了应用市场首页,页面中包括Tab栏、运营横幅、精品应用、精品游戏等。 | ArkTS | | ArkUI | [Weather:一多天气](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SuperFeature/MultiDeviceAppDev/Weather) | 本示例展示一个天气应用界面,包括首页、城市管理、添加城市、更新时间弹窗,体现一次开发,多端部署的能力。 | ArkTS | | 媒体 | [MediaCollections:媒体管理合集](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/FileManagement/MediaCollections) | 本示例展示了网络流播放能力、音视频播控能力、音量调节能力等。 | ArkTS | diff --git a/zh-cn/release-notes/OpenHarmony-v3.2-beta4.md b/zh-cn/release-notes/OpenHarmony-v3.2-beta4.md index f8c47fbcd6b580d6062ee46fa7582fdd15f3f923..51a4584ae45e3d58d26c28718f70744c1586224d 100644 --- a/zh-cn/release-notes/OpenHarmony-v3.2-beta4.md +++ b/zh-cn/release-notes/OpenHarmony-v3.2-beta4.md @@ -193,7 +193,7 @@ API变更请参考: ### 芯片及开发板适配 -芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard_cn.md)信息。 +芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig_devboard/sig_devboard_cn.md)信息。 ### Samples diff --git a/zh-cn/release-notes/OpenHarmony-v3.2-beta5.md b/zh-cn/release-notes/OpenHarmony-v3.2-beta5.md index 448a7025881dcdd6deecdf146058ddc056b0c97a..e156dad5e3cdca1dd967da9fbed7127f27d05e71 100644 --- a/zh-cn/release-notes/OpenHarmony-v3.2-beta5.md +++ b/zh-cn/release-notes/OpenHarmony-v3.2-beta5.md @@ -45,9 +45,9 @@ ArkUI适配了根据资源名称获取资源的能力。 | 软件 | 版本 | 备注 | | -------- | -------- | -------- | | OpenHarmony | 3.2 Beta5 | NA | -| Public SDK | Ohos_sdk_public 3.2.10.6 (API Version 9 Beta5) | 面向应用开发者提供,不包含需要使用系统权限的系统接口。通过DevEco Studio默认获取的SDK为Public SDK。 | -| HUAWEI DevEco Studio(可选) | *待发布* | OpenHarmony应用开发推荐使用。 | -| HUAWEI DevEco Device Tool(可选) | *待发布* | OpenHarmony智能设备集成开发环境推荐使用。 | +| Public SDK | Ohos_sdk_public 3.2.10.6 (API Version 9 Beta5) | 面向应用开发者提供,不包含需要使用系统权限的系统接口。<br />通过DevEco Studio默认获取的SDK为Public SDK。 | +| HUAWEI DevEco Studio(可选) | 3.1 Beta1 | OpenHarmony应用开发推荐使用。 <br />[请点击此处获取](https://developer.harmonyos.com/cn/develop/deveco-studio#download) | +| HUAWEI DevEco Device Tool(可选) | 3.1 Beta2 | OpenHarmony智能设备集成开发环境推荐使用。 <br />[请点击此处获取](https://device.harmonyos.com/cn/develop/ide#download) | ## 源码获取 @@ -137,9 +137,9 @@ ArkUI适配了根据资源名称获取资源的能力。 ### SDK变更 -从本版本起,SDK仅发布提供Public SDK,也可通过DevEcoStudio下载使用。 +从本版本起,仅发布Public SDK,开发者可从镜像站点获取或通过DevEco Studio下载Public SDK用于应用开发。 -Full SDK需下载源码编译构建并替换使用,源码编译指导见[full-SDK编译指南](../application-dev/quick-start/full-sdk-compile-guide.md) +包含系统接口的全量SDK(Full SDK)需下载全量代码后编译构建出SDK文件,并在DevEco Studio中替换。通过源码编译Full SDK的指导请参见[Full-SDK编译指南](../application-dev/quick-start/full-sdk-compile-guide.md)。 ### 特性变更 @@ -162,10 +162,15 @@ Full SDK需下载源码编译构建并替换使用,源码编译指导见[full- | 文件存储 | - 新增应用文件统一URI处理能力。<br/>- 新增支持公共数据的临时授权和统一的打开入口。<br/>主要涉及以下需求:<br/>I687C8【新增能力】支持应用文件统一URI处理能力<br/>I64U8W【基础能力】支持公共数据的临时授权和统一open入口 | NA | | 元能力 | - 新增常驻进程重启优化。<br/>- 支持卡片数据库切换。<br/>- 支持异步onConnected等能力。<br/>主要涉及以下需求:<br/>I65M3F 【基础能力】执行ShellCommand命令管控<br/>I65V83 【基础能力】ServiceExtensionAbility支持异步onConnected生命周期<br/>I61H21 【基础能力】卡片本地数据库切换<br/>I63UJ5 【元能力】【ability_runtime】API8及以前API 支持异常处理<br/>I6BDCW 【基础能力】应用加载禁止加载data目录下的代码<br/>I6BDDU 【基础能力】FA模型默认启动方式为Standard<br/>I6BDE2 【基础能力】常驻应用异常频繁重启保护 | NA | +API变更清单请参考:[API差异报告](api-change/v3.2-beta5/Readme.md) + +各子系统API详细变更说明请参考:[变更说明](changelogs/v3.2-beta5/Readme.md) + + ### 芯片及开发板适配 -芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig-devboard/sig_devboard_cn.md)信息。 +芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig_devboard/sig_devboard_cn.md)信息。 ### Samples @@ -174,16 +179,13 @@ Full SDK需下载源码编译构建并替换使用,源码编译指导见[full- | 子系统 | 名称 | 简介 | 开发语言 | | -------- | -------- | -------- | -------- | -| web | [JS注入与执行](https://gitee.com/openharmony/applications_app_samples/tree/master/Web/RunJsInWeb) | 本示例基于H5游戏,通过ArkUI的button实现对游戏实现基本控制,展示webview的JS注入与执行能力,及native应用与H5的通信能力。 | ArkTs | -| 媒体子系统 | [二维码扫描](https://gitee.com/openharmony/applications_app_samples/tree/master/media/QRCodeScan) | 本示例展示二维码扫描,从文件中选择二维码图片进行解析和读取,识别二维码信息。 | ArkTs | -| ArkUI | [一多设置典型页面](https://gitee.com/openharmony/applications_app_samples/tree/master/MultiDeviceAppDev/Settings) | 本示例展示了设置应用的典型页面,其在小窗口和大窗口有不同的显示效果,体现一次开发、多端部署的能力。 | ArkTs | -| 文件管理 | [文件管理](https://gitee.com/openharmony/applications_app_samples/tree/master/FileManager/FileManager) | 本示例主要展示了文件管理相关的功能,使用[mediaLibrary](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-medialibrary.md)、[userFileManager](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-userfilemanager.md)、[fileio](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-fileio.md)等接口,实现了媒体库文件、应用沙箱内文件的添加和访问等功能。 | ArkTs | -| 媒体子系统 | [录屏](https://gitee.com/openharmony/applications_app_samples/tree/master/media/ScreenRecorder) | 该示例展示设备屏幕(含音频)录制功能。屏幕录制的主要工作是通过创建一个虚拟屏,捕获屏幕显示图形帧,完成视频编码并保存到文件中,帮助OEM设备厂家系统应用实现屏幕录制功能,也可以通过此应用抓取屏幕帧用于问题复现录制。 | ArkTs | -| 窗口子系统 | [屏幕探测](https://gitee.com/openharmony/applications_app_samples/tree/master/device/ScreenDetector) | 本示例实时监测连接的屏幕数量状态,支持创建至多5个虚拟屏幕,点击对应的屏幕矩形能显示该屏幕的相关属性。 | ArkTs | -| 元能力 | [Stage模型卡片小游戏](https://gitee.com/openharmony/applications_app_samples/tree/master/ability/FormGame) | 本示例展示了如何通过Stage模型实现一个简单的游戏卡片。 | ArkTs | +| 媒体子系统 | [二维码扫描](https://gitee.com/openharmony/applications_app_samples/tree/OpenHarmony-3.2-Beta5/media/Scan) | 本示例展示二维码扫描,从文件中选择二维码图片进行解析和读取,识别二维码信息。 | ArkTs | +| ArkUI | [一多应用市场首页](https://gitee.com/openharmony/applications_app_samples/tree/OpenHarmony-3.2-Beta5/MultiDeviceAppDev/AppMarket) | 本示例展示了应用市场首页,其在小窗口和大窗口有不同的显示效果,体现一次开发、多端部署的能力。 | ArkTs | +| 文件管理 | [文件管理](https://gitee.com/openharmony/applications_app_samples/tree/OpenHarmony-3.2-Beta5/FileManager/FileIo) | 本示例主要展示了文件管理相关的功能,使用[mediaLibrary](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-medialibrary.md)、[userFileManager](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-userFileManager.md)、[fileio](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-fileio.md)等接口,实现了媒体库文件、应用沙箱内文件的添加和访问等功能。 | ArkTs | +| 元能力 | [图库卡片](https://gitee.com/openharmony/applications_app_samples/tree/OpenHarmony-3.2-Beta5/ability/GalleryForm) | 本示例是模拟图库卡片,实现对图库中的照片在卡片中显示,定时刷新卡片内容等功能。 | ArkTs | -请访问[Samples](https://gitee.com/openharmony/app_samples)仓了解更多信息。 +请访问[Samples](https://gitee.com/openharmony/applications_app_samples)仓了解更多信息。 ## 修复缺陷列表 diff --git a/zh-cn/release-notes/OpenHarmony-v3.2-release.md b/zh-cn/release-notes/OpenHarmony-v3.2-release.md new file mode 100644 index 0000000000000000000000000000000000000000..0f6c9b02850e52100dc6243b10ec4288ebfa4be9 --- /dev/null +++ b/zh-cn/release-notes/OpenHarmony-v3.2-release.md @@ -0,0 +1,643 @@ +# OpenHarmony 3.2 Release + +## 版本概述 +OpenHarmony 3.2版本标准系统能力进一步完善,支持采用ArkTS语言+Stage应用模型进行大型应用、原子化服务开发。[ArkCompiler](#arkcompiler)的优化、Taskpool机制提升应用运行性能;ArkUI组件能力增强,强化图形渲染能力和系统安全能力,丰富分布式业务开发;OpenHarmony 3.2 Release版本提供API Level 9稳定接口,在OpenHarmony 3.1 Release版本的基础上,进一步提升系统的整体性能、稳定性和安全性。 + + +OpenHarmony 3.2版本完整里程碑如下图所示,阅读本文档了解更多关键特性及能力。 + + + **图1** OpenHarmony 3.2社区版本里程碑   +![release](figures/release.png) + +## 特性更新 +### ArkUI + + + **组件能力增强** + +- 支持XComponent控件,可用于EGL/OpenGL ES和媒体数据写入,并在XComponent组件显示;通过XComponent组件,配合NDK能力,构建C++/ArkTS混合开发能力,支持游戏、媒体应用开发 +- 支持AbilityComponent控件,支持嵌入其他应用作为控件(Component)显示。 +- 增加基础的ArkTS卡片开发能力:支持卡片交互、能动态更新内容;统一卡片和页面的开发范式,页面的布局可以直接复用到卡片布局中,提升卡片开发体验和开发效率。 +- 系统默认支持纯文本、纯图片复制、粘贴、拖拽,无需开发者处理复制、粘贴、拖拽事件。 +- 支持多级菜单和分组菜单。 + + **UI界面开发支持一次开发适配多屏幕规格** + +- 交互归一能力增强,交互归一事件对接TP、鼠标、键盘、触摸板、手写笔,ArkUI原生组件支持归一化的操作方式。 +- 响应式布局能力优化,增强了媒体查询能力,栅格系统重构且对接自由窗口。 +- 走焦能力增强,支持Tab键和方向键走焦,支持配置组件是否可获焦。 +- 支持增强分栏与侧边栏组件能力,支持拖拽自动隐藏等能力。 + +详细内容请参考[ArkUI指南](../application-dev/ui/arkui-overview.md)。 + + +### 应用框架 + +- Stage模型,OpenHarmony API 9新增模型,提供了应用程序必备的组件和运行机制。开发者可以基于该模型进行复杂应用开发,使应用开发更简单、高效。 + - 以类形式提供组件开发,方便开发者基于类扩展。 + - 进程内共享虚拟机实例,减少应用内存占用。 + - 支持在进程内共享数据对象,方便开发者在多模块间共享状态。 + - Ability生命周期和窗口显示/焦点事件分离,统一了多设备形态下组件的生命周期,有利于多设备应用开发。 + - Ability与UI职责分离且具备RPC调用能力,原生支持组件级的跨设备迁移与协同,有利于分布式应用开发。 + +- 提供Extension机制,借助Extension,应用在与其他应用或系统进行交互时向他们提供自定义功能和内容,例如:应用可以作为卡片显示在系统桌面或者系统闲时执行后台任务等。当前支持的常用Extension有:FormExtensionAbility、WorkSchedulerExtensionAbility、InputMethodExtensionAbility、AccessibilityExtensionAbility等。 + +- 原子化服务支持分包预加载,提升服务首次加载性能。 + +- 支持HSP(Harmony Shared Package)动态共享包,支持应用内代码和资源的共享。 + + +详细内容请参考[应用模型指南](../application-dev/application-models/application-model-composition.md)。 + + +### 应用包管理 + +- 支持选择默认应用,例如用户使用应用程序打开文件或url地址时选择了默认程序,后续将自动打开该应用程序操作文件。 + +- 支持对部分预置应用如Launcher、SystemUI、Settings等,系统事先授予权限(如定位、电话联系人等权限)、简化设备开箱后的授权过程,提升用户体验。详细请参考[user_grant权限预授权](../application-dev/security/accesstoken-guidelines.md)。 + +- 支持预置应用配置是否可常驻、是否可以多进程,是否允许使用Service类型的ExtensionAbility等能力,加强对预置应用的权限管控。详细请参考[应用特权配置指南](../device-dev/subsystems/subsys-app-privilege-config-guide.md)。 + +- 支持动态修改和更新应用程序的代码,提供快速修复程序包便于应用快速响应需求和修复问题(此能力依赖设备厂商构建应用市场并提供分发能力)。详细请参考[快速修复介绍](../application-dev/quick-start/quickfix-principles.md)。 + +- 支持so基于hap包的隔离,方便开发者在不同的模块中部署so文件,避免了不同模块so重名的问题。 + + +### 系统应用 + + **Launcher应用增强** + +提供长按应用图标添加服务卡片的能力(当前支持相机、图库应用)。 + + + **SystemUI应用增强** + +- 支持控制中心打开和退出。 + +- 支持通知中心打开和退出;通知显示、删除、组展开与收起;横幅通知的显示与隐藏。 + + + **Settings应用增强** + +- 提供在隐私设置菜单设置权限的能力。 + +- 开发者选项增加布局边界调试、过渡动画调试、过渡绘制调试开关。 + + + **Photos应用增强** + +- 新增PhotoPicker能力。PhotoPicker是系统向用户提供图片和视频文件选择的统一入口,避免用户向应用授权文件权限,图片文件使用权限最小化控制提升应用安全。 + +- 支持相册服务卡片,提供相册浏览能力。 + +- 支持图片编辑能力,如自由裁剪图片、旋转图片等操作。 + 详细请参考[Application Photos](https://gitee.com/openharmony/applications_photos)。 + + + **FilePicker** + +新增FilePicker能力。FilePicker是系统向用户提供文件(媒体文件除外)选择的统一入口,避免用户向应用授权文件权限,确保文件使用权限最小化控制提升应用安全。 + + + **浏览器** + +当前版本未内置浏览器应用。可手动安装[浏览器应用示例](https://gitee.com/openharmony/applications_app_samples/tree/samples_3.2_Release/code/BasicFeature/Web/Browser)后进行网络内容浏览等场景的体验。 + + + +### 分布式技术 + +支持元服务和卡片跨设备流转,包括:跨设备查询、添加、刷新、删除等。 + + +#### 分布式软总线 + +- 提供基于蓝牙链路的文件传输能力,蓝牙数据传输通道相比OpenHarmony 3.1版本性能提升约10%。 + +- 通过为每个进程分别建立Message和Byte高低优先级队列,确保在Message和Byte并发的情况下,优先保障消息队列的数据发送,同时也能保障Byte得到有效传输,解决了在字节数据拥塞的情况下,消息数据不能及时传输的问题。 + +- 在支持RAW流的基础上,新增COMMON流传输能力,将未加密音视频流交由软总线进行加解密,调用者只需要把原始的音视频流数据传递给软总线,软总线保障数据的安全传输。 + +- 支持传输链路(WLAN/WiFi P2P/蓝牙BR)动态选择。根据双端设备支持的传输链路以及业务调用软总线传输接口(SendFile、SendStream、SendMessage、SendBytes)进行链路选择。例如当需要传输流数据时,优先选择WLAN(5G频段)进行传输,如果WLAN不可用,则选择其它链路(例如WiFi P2P)进行传输。 + + + +#### 分布式硬件 + +- 分布式相机拍照支持设置拍摄地理位置信息和照片质量级别(影响照片的压缩比和画质清晰度)。 + +- 分布式相机支持录像功能。 + +- 设备管理支持将帐号认证信息导入到设备安全认证系统中,相同帐号的设备可以自动完成设备认证和组网。 + + +#### 分布式数据管理 + + **跨应用数据访问** + +- 通过代理方式实现同设备内跨应用数据访问,避免频繁拉起数据源应用。 + +- 支持同设备内关系型数据库、键值型数据库的跨应用数据访问。 + + **本地数据库** + +- 支持键值型数据库和关系型数据库。 + +- 支持对数据库文件的加密保存。 + +- 支持数据库的异常损坏检测以及异常重建。 + +- 支持应用通过客户端进行备份和恢复数据库。 + +- 支持自动备份键值型数据库。 + +- 支持同应用跨设备对关系型数据库远程查询。 + +- 支持元数据库异常损坏检测和自动重建。 + +- 键值型数据库从统一的系统沙箱切换到各应用沙箱,缩小应用数据的访问权限,提升了应用数据的安全性。 + + **数据同步** + +- 支持按条件(时间段、时间排序、同步时长)同步键值型数据,实现高能效、精准数据同步。 + +- 设备上线优先同步系统数据,缩短设备唤醒时间。 + +- 支持多用户场景下的跨设备数据同步。 + + **分布式对象:** 支持对象数据持久化。 + + **沙箱应用:** 支持键值型数据库、关系型数据库、分布式对象的持久化。 + + +#### 分布式调度 + +增强Ability流转能力,通过支持数据结构自动序列化降低应用程序适配复杂度;支持使用分布式对象传输流转的业务数据;在流转过程中可自动免安装原子化服务。 + + +### 文件管理 + +- 增强文件加密特性,支持用户级文件加密。 + +- 新增按应用空间统计接口,支持获取应用各级目录空间大小。 + +- 增强应用文件共享能力,提供跨应用文件打开能力。 + +- 支持应用文件备份恢复能力。 + +- 支持文件系统外置存储挂载卸载、格式化等能力,支持外置存储读写访问能力。 + +- 增强文件管理IO接口能力,新增list file接口提供目录遍历能力。 + + +### 图形显示 & 窗口 + +- 提升多窗口场景的显示帧率。 + +- 增强属性动画,支持动画自定义属性。 + +- 增强Native层图形开发能力,SurfaceImage接口支持buffer管理、内容更新、变换矩阵等接口能力;Vsync支持请求下一帧、回调等接口能力;Hardwarebuffer接口支持申请、释放、获取、访问等接口能力 ,NativeWindow接口支持设置缩放模式。 + +- 构建EGL层,增强南向GPU适配能力。 + +- 提供窗口阴影、模糊、圆角等视觉效果的能力。 + +- 提供一镜到底、输入法切换、应用切换、转屏等转场动效能力。 + +- 支持窗口属性设置,窗口隐私图层避免截屏、录屏时泄露用户隐私。 + + +### 媒体 + + + **音频** + +- 提供选择蓝牙设备进行音频播放和通话的能力。 + +- 支持生成DTMF拨号音并进行播放。 + +- 支持OpenSL ES基础录音接口。 + +- 支持应用查询当前可用的音频设备列表,并携带具体设备信息,比如设备采样率、通道数、通道掩码。 + +- 支持查询系统中已建立的播放流和录音流信息。 + + + **播放** + +- 媒体播放支持fd格式输入的本地播放、支持HTTPS、HLS协议网络点播功能。媒体播放支持基于HDI的H264硬解播放能力。 + +- 提供音视频编解码能力,基于HDI codec接口的视频硬编码/硬解码能力。 + + + **相机** + +- 支持相机拍照配置:格式、分辨率、质量(影响照片的压缩比和画质清晰度)、地理位置等。支持录像和录像中抓拍。 + +- 支持相机精准隐私保护策略,仅允许前台使用(包含相机悬浮窗场景);支持系统服务后台使用相机,不允许第三方APP后台静默使用相机。提供系统接口,供相机全局开关开启、禁用调用。 + + + **图片** :增加支持raw、Webp图片格式。 + + + + +### 事件通知 + +- 支持应用设置显示在桌面上的角标数量。 + +- 支持系统应用移除粘性事件,某个粘性事件移除后,新的订阅者将不再收到对应的事件。 + +- 支持系统应用使能/去使能静态订阅,静态订阅事件去使能后,StaticSubscriberExtensionAbility不再被关联拉起。 + +- 补齐静态订阅Extension上下文的能力,StaticSubscriberExtensionAbility运行时可以通过上下文获取安装包的静态信息(如包路径、包名等)。 + +### Web + +- 支持配置Web组件,包括网络加载拦截配置、字体管理配置、滚动条配置、fetch自定义拦截配置。 + +- 支持网页操作,包括获取历史记录和前进后退列表、获取源URL、支持滚动、判断页面中是否有图片。 + +- 支持网页事件处理,支持页面加载各类事件上报、支持原始输入事件上报。 + +- 支持处理网页与应用的互通,消息互通支持ArrayBuffer类型。 + +- 增强Web性能,支持渲染进程的只读数据段共享节省内存、支持预读动态库加速网页加载。 + + +### 通信与连接 + +- 支持NFC卡读写能力。 + +- 支持蓝牙音频通话和蓝牙视频播放。 + +- 提供网络管理多网并发、网络协议栈http/https增强及TLSSocket ArkTS API能力。 + - 多网并发: + - 支持基于socket的路由绑定。 + - 支持基于网卡的路由绑定。 + - http/https: + - 支持http2.0。 + - 支持http缓存。 + - 支持http并发框架。 + - 支持gzip压缩、指定数据返回格式。 + - TLSSocket: + - 支持客户端指定证书、密钥、CA等安全传输选项,向服务器发起连接,建立TLSSocket连接。 + - 支持TLSv1.2和TLSv1.3。 + - WebSocket。 + - 以太网连接、网络热点。 + +- 蜂窝通信框架能力(如需提供完整蜂窝通信能力需芯片厂商适配支持HDI接口): + - 支持双卡管理,双卡通话、短信、搜网等基础能力接口和框架。 + - 支持VoLTE语音通话接口和框架。(需要芯片厂商实现IMS服务(含HDI)) + - 支持IMS短信收发接口和框架。(需要芯片厂商实现IMS服务(含HDI)) + - 支持蜂窝数据漫游,蜂窝数据自愈接口和框架。 + - 支持双卡数据切换接口和框架。 + + +### 设备管理 + +位置服务支持模糊位置、后台定位显性化等隐私增强特性。 + + + **DeviceProfile** + +开放基础系统服务的KV数据的保存、查询、端端同步的能力。 + + + **电源** + +- 支持从系统参数中读取系统的最大、最小和默认亮度值。 + +- 支持进入挂起状态和从挂起状态唤醒的系统接口。 + +- 支持电池的电量等级接口。 + +- 支持预估充电剩余时间、瞬时电流、剩余电量和总电量的系统接口。 + +- 支持相机、音频、通话和短距等软硬件特性的耗电统计。 + +- 支持设备发热时,对CPU频率、音量和系统亮度的管控动作。 + + +### 安全 + +- 提供系统级的证书管理能力,支撑OpenHarmony生态应用和系统应用,实现证书管理全生命周期(生成,存储,使用,销毁)的管理和安全使用。 + +- 提供加解密算法库框架,实现对openssl加解密库对应能力的封装,提供统一的加解密算法库相关的ArkTS接口。 + +- HUKS支持国密SM2/SM3/SM4的部分算法。 + +- 提供基于帐号管理的分布式设备互信认证能力。 + + +### 程序访问控制 + +- 实现应用和系统进程的权限管理框架,提供如下应用权限的操作接口: + - 提供权限的校验、权限的授予、权限的撤销功能。 + - 提供权限的授权变化监听功能。 + - 提供拉起权限弹窗的接口,应用可以通过该接口拉起弹窗,向用户申请授权。 + +- 提供权限弹窗应用以及Setting应用的隐私权限管理功能。 + +- 提供隐私报告功能,支持添加/查询权限访问记录、监听权限使用状态变化接口。 + +- 提供隐私保护增强特性,提升用户的隐私保护体验,包括: + - 相机使用提醒,在相机使用时,通知systemUI在右上角显示小圆点,提示用户。 + - 一键开关功能,提供用户一键开关,管控设备麦克风/相机敏感资源的使用。 + +- 提供SELinux功能的permissive模式。 + + +### ArkCompiler + + **语言特性增强:** 支持严格模式的Ecma2021规范。 + + **编译器运行时功能** + +- 提供es2abc编译器,优化字节码编译性能、缩短编译时间。 + +- 提供汇编解释器提升应用高级语言运行性能。 + +- 提供基于PGO配置文件的Host AOT优化编译器,提升应用高级语言高负载性能。 + +- 支持模块化能力,更好、更规范的支持复杂应用工程开发。 + +- 支持热补丁机制,提供应用热修复运行时技术底座。 + +- 调试增强,支持多实例调试、热重载调试,提升开发者开发效率。 + +- 支持基于CDP协议的CPU Profiler/Heap Profiler调优能力,提供应用性能调优和内存调优能力。 + + **语言基础库** + +- utils功能增强,支持uuid提供通用统一标识符功能,支持Buffer提供缓冲区读写比较查找功能。 + +- Concurrent并发库增加并发API TaskPool基础版,提供并发任务接口。任务池(Taskpool)作用是为应用程序提供一个多线程的运行环境,降低整体资源的消耗、提高系统的整体性能。 + + **C/C++工具链** + +- 工具链升级:LLVM升级到12.0.0,支持MIPS架构、RISC-V架构。 + +- 功能增强:支持stack pageguard保护,地址随机化,namespace隔离,CFI功能,Fortify功能,时区数据更新等,提升C/C++库安全。 + +- 性能优化:实现高频函数性能优化提升c库基础性能,实现linker优化提升库加载性能。 + +- 支持locale提供时区设置刷新功能。 + + +### 内核 + +- 支持ASLR内核地址随机化、KASAN地址检测能力、CFI等,减少系统攻击面,提升内核安全性。 + +- 提升musl内存分配器安全,提高堆内存安全性,有效避免堆溢出、double-free、UAF等危险。 + +- 支持内存管理精细化管控,OnMemoryLevel特性针对不同内存压力进行通知,应用根据不同压力场景进行相应回调处理;同时对系统资源进行系统化、集中化管理,对应用资源占用及时监控与管理。 + +- 本地存储增强,F2FS特性优化末端性能,通过存储空闲时自动碎片回收、分级SSR等手段降低系统碎片,恢复系统性能。 + +### 驱动 + + **HDF驱动框架能力** + + - 支持内核态驱动动态加载、外接设备即插即用事件上报、驱动安全策略配置,为开发者提供更稳定、安全的驱动平台底座。 + + - HDI接口支持IPC调用和直通调用两种通路模式,开发者可根据实际业务灵活使用,提升业务性能。 + + - 支持HDI服务化代码自动生成能力、模板化驱动代码生成能力、HCS宏式解析及配置可视化编辑等能力,降低驱动开发门槛,提高开发效率。 + + - Platform平台驱动支持用户态中断、新增CAN总线HDF驱动框架、MMC驱动实现优化等。 + + **外设驱动模型能力** + + - Camera驱动模型支持自拍镜像、镜头控制、JPEG位置信息添加、Sensor捕获角查询、人脸识别Meta流支持,简化相机驱动开发难度。 + + - Audio的ADM模型增加耳机接入、听筒和喇叭切换控制、通话音量设置、通话静音等关键控制能力,支撑音频硬件生态拓展。 + + - Display驱动模型支持多屏管理、软件Vsync机制、兼容FrameBuffer架构,支持不同显示架构高效接入。 + + - 支持标准系统的Codec硬件编解码驱动模型、提供Codec HDI 2.0接口及参考实现,支持更完备的硬件编解码能力。 + + - 支持马达驱动模型,包括马达振动启停、基础马达效果控制,为用户提供丰富的振感体验。 + + - 支持手势驱动模型,包括状态事件、设备状态事件上报;支持手势启停、功能状态配置。 + + - USB驱动模型支持设备模式和主机模式,新增支持设备模式下RNDIS网络驱动等DDK能力。 + + - 支持WLAN驱动能力抗干扰能力,提供最优P2P信道选择能力,持续提升WLAN信号质量。 + +### 工具提升 + + **DevEco Studio代码开发** + +- 支持应用/服务开发环境的诊断功能,能够检测开发环境是否完备,确保开发者拥有良好的开发体验。若检查结果中存在不满足的检查项,建议您根据修复建议进行调整。 + +- 提供基础模板和卡片模板,支持在基于Stage模型的应用中添加ArkTS卡片。 + +- 支持OpenHarmony工程添加Extension Ability模板,具体请参考在模块中添加Ability。 + +- 支持按照ArkUI新语法和新规范,检查代码提示错误;新增Code Linter代码检查功能,支持配置检查规则,修复检查结果。 + +- 支持C++代码Quick Fix基础能力,具体请参考代码Quick Fix快速修复。 + +- 提供全新的OHPM CLI(OpenHarmony Package Manager Command-line Interface) 生态三方库包管理工具,支持OpenHarmony共享包发布、安装和依赖管理。支持API 9的历史工程迁移为OHPM工程,详细参考历史工程手动迁移。 + +- 支持构建闭源HAR,并支持配置HAR的混淆能力。 + +- 支持AOT编译模式,提供高负载TS性能选择和构建能力,提升应用运行性能,具体请参考开启AOT编译模式。 + +- API 9的Stage工程默认开启模块化编译,可有效缩短增量编译时间、减小编译后的包体积。 + +- 支持并发编译提升编译速度。 + + **DevEco Studio应用调试调优** + +- 支持ArkTS/JS与C/C++跨语言调试特性,在C/C++工程中,采用ArkTS/JS与C/C++进行混合开发,能够在ArkTS或JS调用C/C++方法处,直接进入C/C++代码中进行调试,方便开发者快速发现并解决跨语言调用相关代码问题。具体请参考ArkTS/JS与C/C++工程跨语言调试。 + +- 支持Hot Reload热重载,支持保存代码后在真机上使用最新的代码而无需重启应用。 + +- 支持OpenHarmony多包推送和多实例调试功能。 + +- 支持OpenHarmony API 9 C/C++工程的内存错误检测。 + +- OpenHarmony日志功能支持打印FaultLog,便于应用开发者快速查询、定位、导出应用故障信息。 + +- 测试框架能力增强,针对JS/ArkTS API Version 8和9的工程,测试框架的执行效率显著提升;同时优化了测试框架模板,提升模板代码的可读性。 + +详细内容请参考[DevEco Studio版本说明](https://developer.harmonyos.com/cn/docs/documentation/doc-releases/release_notes-0000001057597449)及[使用指南](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ide_versions_overview-0000001356521213)。 + + + **调试工具** + +- hdc文件传输支持目录接收发送、权限同步、同网段CS文件发送,提升调试调优、自动化测试效率。 + + +### 测试能力 + +- 新增测试用例筛选执行能力,支持在用例中配置指定字段如用例类型、级别等参数,通过命令执行筛选后的用例,帮助开发者提升测试执行效率,详细请参考[指导](https://gitee.com/openharmony/testfwk_arkxtest#%E5%9F%BA%E7%A1%80%E6%B5%81%E7%A8%8B)。 + +- 新增测试用例驱动执行能力,可将相似测试逻辑的不同输入输出数据配置到辅助文件中使用,帮助开发者减少测试代码量,详细请参考[指导](https://gitee.com/openharmony/testfwk_arkxtest#%E6%95%B0%E6%8D%AE%E9%A9%B1%E5%8A%A8)。 + +- 新增多窗口、双指捏合、抛滑等UI场景模拟操作能力,提升UI自动化支持范围,详细请参考[API说明](../application-dev/reference/apis/js-apis-uitest.md)。 + +- 新增OpenHarmony应用质量要求兼容性测试规范,涵盖UX、性能、功耗、稳定性、兼容性和安全六大方面,规范OpenHarmony应用基础质量要求,详细请参考[官网说明](https://www.openharmony.cn/certification/moreStandard)。 + +- [SmartPerf-Host](https://gitee.com/openharmony-sig/smartperf/tree/master)性能功耗调试调优工具,为开发者提供一套性能调优平台,支持GUI(图形用户界面)操作进行详细数据分析。3.2版本新增: + - 支持功耗分析能力,展示应用各子类别功耗占比信息、资源申请使用记录、功耗异常事件、功耗与系统状态关联信息,详细请参考HiSystemEvent[指导](https://gitee.com/openharmony-sig/smartperf/blob/master/host/doc/quickstart_hisystemevent.md)。 + - 支持Web端抓取trace,详细请参考[指导](https://gitee.com/openharmony-sig/smartperf/blob/master/host/doc/quickstart_web_record.md)。 + - 支持SQL查询和Metrics说明,详细请参考[指导](https://gitee.com/openharmony-sig/smartperf/blob/master/host/doc/quickstart_sql_metrics.md)。 + - 支持内核内存事件分析,详细请参考[指导](https://gitee.com/openharmony-sig/smartperf/blob/master/host/doc/quickstart_page_fault.md)。 + +- [wukong](https://gitee.com/openharmony/ostest_wukong)软件稳定性工具能力增强: + - 支持注入滑动、鼠标、字符、系统按键、控件事件,模拟用户多样化随机操作,覆盖真实用户操作场景,挖掘更多稳定性问题。 + - 支持设置运行总时长、应用黑白名单,实现个性化测试。 + - 支持控件顺序遍历测试,测试过程中支持界面截图;支持休眠唤醒测试。 + +## 配套关系 + + **表1** 版本软件和工具配套关系 + +| 软件 | 版本 | 备注 | +| -------- | -------- | -------- | +| OpenHarmony | 3.2 Release | NA | +| Public SDK | Ohos_sdk_public 3.2.11.9 (API Version 9 Release) | 面向应用开发者提供,不包含需要使用系统权限的系统接口。通过DevEco Studio默认获取的SDK为Public SDK。 | +| HUAWEI DevEco Studio(可选) | 3.1 Beta2 | OpenHarmony应用开发推荐使用。获取方式:<br /> [Windows(64-bit)](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_package_901_9/f3/v3/uJyuq3syQ2ak4hE1QZmAug/devecostudio-windows-3.1.0.400.zip?HW-CC-KV=V1&HW-CC-Date=20230408T013335Z&HW-CC-Expire=315360000&HW-CC-Sign=96262721EDC9B34E6F62E66884AB7AE2A94C2A7B8C28D6F7FC891F46EB211A70) <br />[Mac(X86)](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_package_901_9/b7/v3/4z3mLQPCQR-g5KlC56SC1w/devecostudio-mac-3.1.0.400.zip?HW-CC-KV=V1&HW-CC-Date=20230408T013430Z&HW-CC-Expire=315360000&HW-CC-Sign=93E83FD1F1CE504EF8F098E08955A938FDA4E4926A2555CF1E02DC8D57210D76) <br />[Mac(ARM)](https://contentcenter-vali-drcn.dbankcdn.cn/pvt_2/DeveloperAlliance_package_901_9/2e/v3/Fl9IY6PiQxqc3tnI2cftiw/devecostudio-mac-arm-3.1.0.400.zip?HW-CC-KV=V1&HW-CC-Date=20230408T013540Z&HW-CC-Expire=315360000&HW-CC-Sign=0906243123734033AAD34A7A005ED7671F00CAA693B6E674F81A094A0159ECCE) | +| HUAWEI DevEco Device Tool(可选) | 3.1 Release | OpenHarmony智能设备集成开发环境推荐使用。<br />[点击此处获取](https://device.harmonyos.com/cn/develop/ide/) | + +## 源码获取 + + +### 前提条件 + +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 OpenHarmony-3.2-Release --no-repo-verify + repo sync -c + repo forall -c 'git lfs pull' + ``` + +- 从版本发布Tag节点获取源码。可获取与版本发布时完全一致的源码。 + ``` + repo init -u git@gitee.com:openharmony/manifest.git -b refs/tags/OpenHarmony-v3.2-Release --no-repo-verify + repo sync -c + repo forall -c 'git lfs pull' + ``` + +**方式二** + +通过repo + https 下载。 + +- 从版本分支获取源码。可获取该版本分支的最新源码,包括版本发布后在该分支的合入。 + ``` + repo init -u https://gitee.com/openharmony/manifest -b OpenHarmony-3.2-Release --no-repo-verify + repo sync -c + repo forall -c 'git lfs pull' + ``` + +- 从版本发布Tag节点获取源码。可获取与版本发布时完全一致的源码。 + ``` + repo init -u https://gitee.com/openharmony/manifest -b refs/tags/OpenHarmony-v3.2-Release --no-repo-verify + repo sync -c + repo forall -c 'git lfs pull' + ``` + + +### 从镜像站点获取 + + **表2** 获取源码路径 + +| 版本源码 | **版本信息** | **下载站点** | **SHA256校验码** | **软件包容量** | +| --------------------------------------- | ------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -------- | +| 全量代码(标准、轻量和小型系统) | 3.2 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.2-Release/code-v3.2-Release.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.2-Release/code-v3.2-Release.tar.gz.sha256) | 21.8 GB | +| Hi3861解决方案(二进制) | 3.2 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_pegasus.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_pegasus.tar.gz.sha256) | 22.9 MB | +| Hi3516解决方案-LiteOS(二进制) | 3.2 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_LiteOS.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_LiteOS.tar.gz.sha256) | 294.3 MB | +| Hi3516解决方案-Linux(二进制) | 3.2 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_Linux.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.2-Release/hispark_taurus_Linux.tar.gz.sha256) | 174.3 MB | +| RK3568标准系统解决方案(二进制) | 3.2 Release | [站点](https://repo.huaweicloud.com/openharmony/os/3.2-Release/dayu200_standard_arm32.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.2-Release/dayu200_standard_arm32.tar.gz.sha256) | 3.9 GB | +| 标准系统Public SDK包(Mac) | 3.2.11.9 | [站点](https://repo.huaweicloud.com/openharmony/os/3.2-Release/ohos-sdk-mac-public.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.2-Release/ohos-sdk-mac-public.tar.gz.sha256) | 712.7 MB | +| 标准系统Public SDK包(Mac-M1) | 3.2.11.9 | [站点](https://repo.huaweicloud.com/openharmony/os/3.2-Release/L2-SDK-MAC-M1-PUBLIC.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.2-Release/L2-SDK-MAC-M1-PUBLIC.tar.gz.sha256) | 671.1 MB | +| 标准系统Public SDK包(Windows/Linux) | 3.2.11.9 | [站点](https://repo.huaweicloud.com/openharmony/os/3.2-Release/ohos-sdk-windows_linux-public.tar.gz) | [SHA256校验码](https://repo.huaweicloud.com/openharmony/os/3.2-Release/ohos-sdk-windows_linux-public.tar.gz.sha256) | 1.6 GB | + +## 更新说明 + +本版本在OpenHarmony 3.2 Beta5的基础上有如下变更: + +### API + +API变更请参考: +- [*OpenHarmony 3.2 Release相比3.2 Beta5的API差异报告*](api-diff/Beta5%20to%20v3.2-Release) +- [*OpenHarmony 3.2 Release相比3.1 Release的API差异报告*](api-diff/v3.2-Release) + +### 芯片及开发板适配 + +芯片及开发板适配状态请参考[SIG-Devboard](https://gitee.com/openharmony/community/blob/master/sig/sig_devboard/sig_devboard_cn.md)信息。 + +### Samples + + **表3** 新增Samples + +| 子系统 | 名称 | 简介 | 开发语言 | +| -------- | -------- | -------- | -------- | +| 无障碍 | [AccessibilityExtensionAbility示例](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/ApplicationModels/AccessibilityExtAbility) | 本示例展示了AccessibilityExtensionAbility的简单应用,使用多个辅助功能接口实现了一些快捷的交互方式。 | ArkTS | +| 企业管理 | [企业设备管理ExtensionAbility](https://gitee.com/openharmony/applications_app_samples/tree/master/code/SystemFeature/ApplicationModels/EnterpriseAdminExtensionAbility) | 企业设备管理扩展能力,是MDM应用必备组件。当开发者为企业开发MDM(Mobile Device Management)应用时,需继承EnterpriseAdminExtensionAbility,在EnterpriseAdminExtensionAbility实例中实现MDM业务逻辑,EnterpriseAdminExtensionAbility实现了系统管理状态变化通知功能,并定义了管理应用激活、去激活、应用安装、卸载事件等回调接口。 | ArkTS | +| 任务管理 | [任务延时调度](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/TaskManagement/WorkScheduler) | 本示例使用\@ohos.WorkSchedulerExtensionAbility 、\@ohos.net.http 、\@ohos.notification 、\@ohos.bundle 、\@ohos.fileio 等接口,实现了设置后台任务、下载更新包 、保存更新包、发送通知 、安装更新包实现升级的功能。 | ArkTS | + + +请访问[Samples](https://gitee.com/openharmony/applications_app_samples)仓了解更多信息。 + + +## 修复缺陷列表 + + **表4** 修复缺陷ISSUE列表 + +| ISSUE单 | 问题描述 | +| -------- | -------- | +| I6ATXO | 【RK3568】XTS执行测试,OpenGL测试套执行结果存在失败项 | +| I6BJ9Z<br/>I6BJ82 | alloc_file_pseudo 内存泄漏问题跟踪 | +| I6BRTS | 调用rdb::executeSql接口会引起内存泄漏风险 | +| I6AZ4T | 带textinput输入框组件的应用存在内存泄漏风险 | + + +## 遗留缺陷列表 + + **表5** 遗留缺陷列表 + +| ISSUE | 问题描述 | 影响 | 计划解决日期 | +| -------- | -------- | -------- | -------- | +| I6AB3T | 首次启动联系人应用的用时超出预期基线。 | 设备启动后,联系人进程为非常驻进程,启动联系人应用时需要拉启联系人数据库进程导致有时延偏长。 | 遗留挂起 | +| I6SMQA | 浏览器加载微博,滑动过程中出现抖动。 | 通过浏览器加载微博web网页后,快速滑动时,内容会闪现未加载,然后很快能加载出来,影响滑动体验。 | 2023年5月15日 | +| I6TRE6 | 进程com.ohos.contacts下的com.ohos.contacts线程导致libdatashare_consumer.z.so低概率出现crash。 | 联系人应用快速启动和退出场景,发现在启动后600ms内退出,联系人进程低概率出现crash,出现crash后联系人进程会被重新拉起,影响可控。 | 2023年4月30日 | +| I6SXBI | wukong的ohos.samples.distributedcalc进程下的libdistributeddata.z.so低概率出现cppcrash。 | 计算器应用快速启动和退出场景,启动后1秒内退出,计算器应用低概率出现cppcrash,出现crash后计算器进程会被重新拉起,影响可控。 | 2023年4月30日 | +| I6U00Q | RK3568使用3.5mm耳机播放音频文件,存在pop音。 | 影响设备使用体验,影响可控。 | 2023年5月30日 | +| I6TNY9 | 通话记录处于充满记录的状态时,向上滑动时拨号键盘无法隐藏。 | 影响拨号键盘的隐藏体验。 | 2023年4月30日 | +| I6TOTV | tabs组件中tabs_animation在反复切换过程中,两种颜色同时显示在界面。 | tabs_animation在反复切换场景下,影响tabs组件的颜色显示。 | 2023年4月30日 | +| I6TOV2 <br/>I6TOYV <br/>I6TOQO <br/>I6TOK5 | WiFi或BLE组网引导P2P循环发送100次linktype为stream的通路,会概率性失败。 | WiFi组网引导P2P压测100次,成功率大于80%。而在低概率P2P组网失败后,重新触发组网时高概率能成功,影响可控。 | 2023年5月30日 | +| I6TMP3 | 长按应用进入图片预览,向后滑动150张卡片左右,点击添加卡片,桌面不显示卡片。 | 图片较多的场景下,进入图形预览,添加卡片,桌面概率不显示卡片,影响使用体验,影响可控。 | 2023年4月30日 | +| I6B4U3 | 压力测试出现进程com.ohos.launcher出现appfreeze。 | 安装应用较多(测试场景安装超过40个应用),且内存较小的设备场景下,低概率出现appfreeze,但桌面功能正常,不影响整体功能和使用。 | 2023年5月30日 | +| I64726 <br/>I641A2 | 蓝牙功能接口bluetooth.pairDevice在与其他设备配对时无配对提示,与其他设备静默配对后通过蓝牙键盘、鼠标完全可控制设备。 | 无配对弹窗提示,但能配对成功,不影响软总线的配对组网功能,已在新版本规划需求完成对此功能的支持。 | 2023年6月30日日 | +| I6U1H9 | GridCol的属性 gridColOffset 在预览器未包含。 | 影响预览inspector的属性显示,不影响预览器整体效果。 | 2023年4月30日 | diff --git a/zh-cn/release-notes/Readme.md b/zh-cn/release-notes/Readme.md index de2478b990ec99ec4eeb16ad5117796ad1baee82..283ec3179453f7d8f542c706628f9d02ecd9cea8 100644 --- a/zh-cn/release-notes/Readme.md +++ b/zh-cn/release-notes/Readme.md @@ -1,12 +1,16 @@ # OpenHarmony Release Notes ## OpenHarmony 3.x Releases +- [OpenHarmony v3.2 Release (2023-04-09)](OpenHarmony-v3.2-release.md) - [OpenHarmony v3.2 Beta5 (2023-01-31)](OpenHarmony-v3.2-beta5.md) - [OpenHarmony v3.2 Beta4 (2022-11-30)](OpenHarmony-v3.2-beta4.md) - [OpenHarmony v3.2 Beta3 (2022-09-30)](OpenHarmony-v3.2-beta3.md) - [OpenHarmony v3.2 Beta2 (2022-07-30)](OpenHarmony-v3.2-beta2.md) - [OpenHarmony v3.2 Beta1 (2022-05-31)](OpenHarmony-v3.2-beta1.md) - [OpenHarmony v3.1 Release (2022-03-30)](OpenHarmony-v3.1-release.md) +- [OpenHarmony v3.1.7 Release (2023-03-22)](OpenHarmony-v3.1.7-release.md) +- [OpenHarmony v3.1.6 Release (2023-01-30)](OpenHarmony-v3.1.6-release.md) +- [OpenHarmony v3.1.5 Release (2022-12-30)](OpenHarmony-v3.1.5-release.md) - [OpenHarmony v3.1.4 Release (2022-11-02)](OpenHarmony-v3.1.4-release.md) - [OpenHarmony v3.1.3 Release (2022-09-30)](OpenHarmony-v3.1.3-release.md) - [OpenHarmony v3.1.2 Release (2022-08-24)](OpenHarmony-v3.1.2-release.md) @@ -25,7 +29,7 @@ - [OpenHarmony v2.2 beta2 (2021-08-04)](OpenHarmony-v2.2-beta2.md) - [OpenHarmony 2.0 Canary (2021-06-01)](OpenHarmony-2-0-Canary.md) -## OpenHarmony 1.x Releases +## OpenHarmony 1.x Releases(停止维护) - [OpenHarmony v1.0 (2020-09-10)](OpenHarmony-1-0.md) - [OpenHarmony v1.1.5 LTS (2022-08-24)](OpenHarmony-v1.1.5-LTS.md) diff --git a/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/Readme-CN.md b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/Readme-CN.md new file mode 100644 index 0000000000000000000000000000000000000000..655f26f623bcf6418a99b254cdbe66c7886b0308 --- /dev/null +++ b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/Readme-CN.md @@ -0,0 +1,27 @@ +# JS API差异报告 + +- [元能力](js-apidiff-ability.md) +- [帐号](js-apidiff-account.md) +- [应用](js-apidiff-application.md) +- [ArkUI](js-apidiff-arkui.md) +- [电源服务](js-apidiff-battery.md) +- [包管理](js-apidiff-bundle.md) +- [网络及通信](js-apidiff-communication.md) +- [语言编译器运行时](js-apidiff-compiler-and-runtime.md) +- [DFX](js-apidiff-dfx.md) +- [分布式数据](js-apidiff-distributed-data.md) +- [文件管理](js-apidiff-file-management.md) +- [Misc软件](js-apidiff-misc.md) +- [媒体服务](js-apidiff-multimedia.md) +- [事件与通知](js-apidiff-notification.md) +- [资源调度](js-apidiff-resource-scheduler.md) +- [安全](js-apidiff-security.md) +- [泛Sensor](js-apidiff-sensor.md) +- [启动](js-apidiff-start-up.md) +- [电话服务](js-apidiff-telephony.md) +- [测试服务](js-apidiff-unitest.md) +- [升级](js-apidiff-update.md) +- [USB服务](js-apidiff-usb.md) +- [用户IAM](js-apidiff-user-iam.md) +- [Web](js-apidiff-web.md) +- [窗口](js-apidiff-window.md) diff --git a/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-ability.md b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-ability.md new file mode 100644 index 0000000000000000000000000000000000000000..cf031c5dc0cac65e5ad23d85e92c470cc50a718b --- /dev/null +++ b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-ability.md @@ -0,0 +1,260 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.app.ability.abilityManager<br>类名: AbilityState<br>方法 or 属性: FOCUS = 2|@ohos.app.ability.abilityManager.d.ts| +|新增|NA|类名:appManager<br>方法or属性:function getRunningProcessInformation(): Promise\<Array\<ProcessInformation>>;|@ohos.app.ability.appManager.d.ts| +|新增|NA|类名:appManager<br>方法or属性:function getRunningProcessInformation(callback: AsyncCallback\<Array\<ProcessInformation>>): void;|@ohos.app.ability.appManager.d.ts| +|新增|NA|类名:RestartFlag<br>方法or属性:RESTART_WHEN_JS_CRASH = 0x0001|@ohos.app.ability.appRecovery.d.ts| +|新增|NA|类名:RestartFlag<br>方法or属性:RESTART_WHEN_APP_FREEZE = 0x0002|@ohos.app.ability.appRecovery.d.ts| +|新增|NA|模块名: ohos.app.ability.dialogRequest<br>类名: dialogRequest|@ohos.app.ability.dialogRequest.d.ts| +|新增|NA|模块名: ohos.app.ability.dialogRequest<br>类名: RequestInfo|@ohos.app.ability.dialogRequest.d.ts| +|新增|NA|模块名: ohos.app.ability.dialogRequest<br>类名: ResultCode|@ohos.app.ability.dialogRequest.d.ts| +|新增|NA|模块名: ohos.app.ability.dialogRequest<br>类名: ResultCode<br>方法 or 属性: RESULT_OK = 0|@ohos.app.ability.dialogRequest.d.ts| +|新增|NA|模块名: ohos.app.ability.dialogRequest<br>类名: ResultCode<br>方法 or 属性: RESULT_CANCEL = 1|@ohos.app.ability.dialogRequest.d.ts| +|新增|NA|模块名: ohos.app.ability.dialogRequest<br>类名: RequestResult|@ohos.app.ability.dialogRequest.d.ts| +|新增|NA|模块名: ohos.app.ability.dialogRequest<br>类名: RequestResult<br>方法 or 属性: result: ResultCode;|@ohos.app.ability.dialogRequest.d.ts| +|新增|NA|模块名: ohos.app.ability.dialogRequest<br>类名: RequestCallback|@ohos.app.ability.dialogRequest.d.ts| +|新增|NA|模块名: ohos.app.ability.dialogRequest<br>类名: RequestCallback<br>方法 or 属性: setRequestResult(result: RequestResult): void;|@ohos.app.ability.dialogRequest.d.ts| +|新增|NA|模块名: ohos.app.ability.dialogRequest<br>类名: dialogRequest<br>方法 or 属性: function getRequestInfo(want: Want): RequestInfo;|@ohos.app.ability.dialogRequest.d.ts| +|新增|NA|模块名: ohos.app.ability.dialogRequest<br>类名: dialogRequest<br>方法 or 属性: function getRequestCallback(want: Want): RequestCallback;|@ohos.app.ability.dialogRequest.d.ts| +|新增|NA|类名:Want<br>方法or属性:parameters?: {[key: string]: Object};|@ohos.app.ability.Want.d.ts| +|新增|NA|类名:CompleteData<br>方法or属性:extraInfo?: { [key: string]: Object };|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantConstant<br>类名: Params|@ohos.app.ability.wantConstant.d.ts| +|新增|NA|类名:Params<br>方法or属性:|@ohos.app.ability.wantConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.wantConstant<br>类名: Params<br>方法 or 属性:DLP_PARAMS_SANDBOX = "ohos.dlp.params.sandbox"|@ohos.app.ability.wantConstant.d.ts| +|新增|NA|类名:Params<br>方法or属性:DLP_PARAMS_SANDBOX = "ohos.dlp.params.sandbox"|@ohos.app.ability.wantConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.wantConstant<br>类名: Params<br>方法 or 属性:DLP_PARAMS_BUNDLE_NAME = "ohos.dlp.params.bundleName"|@ohos.app.ability.wantConstant.d.ts| +|新增|NA|类名:Params<br>方法or属性:DLP_PARAMS_BUNDLE_NAME = "ohos.dlp.params.bundleName"|@ohos.app.ability.wantConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.wantConstant<br>类名: Params<br>方法 or 属性:DLP_PARAMS_MODULE_NAME = "ohos.dlp.params.moduleName"|@ohos.app.ability.wantConstant.d.ts| +|新增|NA|类名:Params<br>方法or属性:DLP_PARAMS_MODULE_NAME = "ohos.dlp.params.moduleName"|@ohos.app.ability.wantConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.wantConstant<br>类名: Params<br>方法 or 属性:DLP_PARAMS_ABILITY_NAME = "ohos.dlp.params.abilityName"|@ohos.app.ability.wantConstant.d.ts| +|新增|NA|类名:Params<br>方法or属性:DLP_PARAMS_ABILITY_NAME = "ohos.dlp.params.abilityName"|@ohos.app.ability.wantConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.wantConstant<br>类名: Params<br>方法 or 属性:DLP_PARAMS_INDEX = "ohos.dlp.params.index"|@ohos.app.ability.wantConstant.d.ts| +|新增|NA|类名:Params<br>方法or属性:DLP_PARAMS_INDEX = "ohos.dlp.params.index"|@ohos.app.ability.wantConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.wantConstant<br>类名: Params<br>方法 or 属性:ABILITY_BACK_TO_OTHER_MISSION_STACK = "ability.params.backToOtherMissionStack"|@ohos.app.ability.wantConstant.d.ts| +|新增|NA|类名:Params<br>方法or属性:ABILITY_BACK_TO_OTHER_MISSION_STACK = "ability.params.backToOtherMissionStack"|@ohos.app.ability.wantConstant.d.ts| +|新增|NA|类名:continuationManager<br>方法or属性:function on(type: "deviceSelected", token: number, callback: Callback\<Array\<ContinuationResult>>): void;|@ohos.continuation.continuationManager.d.ts| +|新增|NA|类名:continuationManager<br>方法or属性:function off(type: "deviceSelected", token: number): void;|@ohos.continuation.continuationManager.d.ts| +|新增|NA|类名:continuationManager<br>方法or属性:function on(type: "deviceUnselected", token: number, callback: Callback\<Array\<ContinuationResult>>): void;|@ohos.continuation.continuationManager.d.ts| +|新增|NA|类名:continuationManager<br>方法or属性:function off(type: "deviceUnselected", token: number): void;|@ohos.continuation.continuationManager.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: addAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback\<void>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: addAbilityMonitor(monitor: AbilityMonitor): Promise\<void>;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: addAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback\<void>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: addAbilityStageMonitor(monitor: AbilityStageMonitor): Promise\<void>;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: removeAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback\<void>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: removeAbilityMonitor(monitor: AbilityMonitor): Promise\<void>;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: removeAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback\<void>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: removeAbilityStageMonitor(monitor: AbilityStageMonitor): Promise\<void>;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: waitAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback\<UIAbility>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: waitAbilityMonitor(monitor: AbilityMonitor, timeout: number, callback: AsyncCallback\<UIAbility>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: waitAbilityMonitor(monitor: AbilityMonitor, timeout?: number): Promise\<UIAbility>;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: waitAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback\<AbilityStage>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout: number, callback: AsyncCallback\<AbilityStage>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout?: number): Promise\<AbilityStage>;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: getAppContext(): Context;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: getAbilityState(ability: UIAbility): number;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: getCurrentTopAbility(callback: AsyncCallback\<UIAbility>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: getCurrentTopAbility(): Promise\<UIAbility>|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: startAbility(want: Want, callback: AsyncCallback\<void>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: startAbility(want: Want): Promise\<void>;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: doAbilityForeground(ability: UIAbility, callback: AsyncCallback\<void>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: doAbilityForeground(ability: UIAbility): Promise\<void>;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: doAbilityBackground(ability: UIAbility, callback: AsyncCallback\<void>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: doAbilityBackground(ability: UIAbility): Promise\<void>;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: print(msg: string, callback: AsyncCallback\<void>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: print(msg: string): Promise\<void>;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: printSync(msg: string): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: executeShellCommand(cmd: string, callback: AsyncCallback\<ShellCmdResult>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: executeShellCommand(cmd: string, timeoutSecs: number, callback: AsyncCallback\<ShellCmdResult>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: executeShellCommand(cmd: string, timeoutSecs?: number): Promise\<ShellCmdResult>;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: finishTest(msg: string, code: number, callback: AsyncCallback\<void>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: finishTest(msg: string, code: number): Promise\<void>;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityMonitor<br>类名: AbilityMonitor|AbilityMonitor.d.ts| +|新增|NA|模块名: AbilityMonitor<br>类名: AbilityMonitor<br>方法 or 属性: abilityName: string;|AbilityMonitor.d.ts| +|新增|NA|模块名: AbilityMonitor<br>类名: AbilityMonitor<br>方法 or 属性: moduleName?: string;|AbilityMonitor.d.ts| +|新增|NA|模块名: AbilityMonitor<br>类名: AbilityMonitor<br>方法 or 属性: onAbilityCreate?:(ability: UIAbility) => void;|AbilityMonitor.d.ts| +|新增|NA|模块名: AbilityMonitor<br>类名: AbilityMonitor<br>方法 or 属性: onAbilityForeground?:(ability: UIAbility) => void;|AbilityMonitor.d.ts| +|新增|NA|模块名: AbilityMonitor<br>类名: AbilityMonitor<br>方法 or 属性: onAbilityBackground?:(ability: UIAbility) => void;|AbilityMonitor.d.ts| +|新增|NA|模块名: AbilityMonitor<br>类名: AbilityMonitor<br>方法 or 属性: onAbilityDestroy?:(ability: UIAbility) => void;|AbilityMonitor.d.ts| +|新增|NA|模块名: AbilityMonitor<br>类名: AbilityMonitor<br>方法 or 属性: onWindowStageCreate?:(ability: UIAbility) => void;|AbilityMonitor.d.ts| +|新增|NA|模块名: AbilityMonitor<br>类名: AbilityMonitor<br>方法 or 属性: onWindowStageRestore?:(ability: UIAbility) => void;|AbilityMonitor.d.ts| +|新增|NA|模块名: AbilityMonitor<br>类名: AbilityMonitor<br>方法 or 属性: onWindowStageDestroy?:(ability: UIAbility) => void;|AbilityMonitor.d.ts| +|新增|NA|模块名: AbilityStageMonitor<br>类名: AbilityStageMonitor|AbilityStageMonitor.d.ts| +|新增|NA|模块名: AbilityStageMonitor<br>类名: AbilityStageMonitor<br>方法 or 属性: moduleName: string;|AbilityStageMonitor.d.ts| +|新增|NA|模块名: AbilityStageMonitor<br>类名: AbilityStageMonitor<br>方法 or 属性: srcEntrance: string;|AbilityStageMonitor.d.ts| +|新增|NA|类名:ApplicationContext<br>方法or属性:getRunningProcessInformation(): Promise\<Array\<ProcessInformation>>;|ApplicationContext.d.ts| +|新增|NA|类名:ApplicationContext<br>方法or属性:getRunningProcessInformation(callback: AsyncCallback\<Array\<ProcessInformation>>): void;|ApplicationContext.d.ts| +|新增|NA|类名:ApplicationContext<br>方法or属性:killAllProcesses(): Promise\<void>;|ApplicationContext.d.ts| +|新增|NA|类名:ApplicationContext<br>方法or属性:killAllProcesses(callback: AsyncCallback\<void>);|ApplicationContext.d.ts| +|新增|NA|类名:Context<br>方法or属性:area: contextConstant.AreaMode;|Context.d.ts| +|新增|NA|模块名: ProcessInformation<br>类名: ProcessInformation|ProcessInformation.d.ts| +|新增|NA|模块名: ProcessInformation<br>类名: ProcessInformation<br>方法 or 属性: pid: number;|ProcessInformation.d.ts| +|新增|NA|模块名: ProcessInformation<br>类名: ProcessInformation<br>方法 or 属性: uid: number;|ProcessInformation.d.ts| +|新增|NA|模块名: ProcessInformation<br>类名: ProcessInformation<br>方法 or 属性: processName: string;|ProcessInformation.d.ts| +|新增|NA|模块名: ProcessInformation<br>类名: ProcessInformation<br>方法 or 属性: bundleNames: Array\<string>;|ProcessInformation.d.ts| +|新增|NA|类名:ServiceExtensionContext<br>方法or属性:startRecentAbility(want: Want, callback: AsyncCallback\<void>): void;|ServiceExtensionContext.d.ts| +|新增|NA|类名:ServiceExtensionContext<br>方法or属性:startRecentAbility(want: Want, options: StartOptions, callback: AsyncCallback\<void>): void;|ServiceExtensionContext.d.ts| +|新增|NA|类名:ServiceExtensionContext<br>方法or属性:startRecentAbility(want: Want, options?: StartOptions): Promise\<void>;|ServiceExtensionContext.d.ts| +|新增|NA|类名:UIAbilityContext<br>方法or属性:startRecentAbility(want: Want, callback: AsyncCallback\<void>): void;|UIAbilityContext.d.ts| +|新增|NA|类名:UIAbilityContext<br>方法or属性:startRecentAbility(want: Want, options: StartOptions, callback: AsyncCallback\<void>): void;|UIAbilityContext.d.ts| +|新增|NA|类名:UIAbilityContext<br>方法or属性:startRecentAbility(want: Want, options?: StartOptions): Promise\<void>;|UIAbilityContext.d.ts| +|新增|NA|类名:UIAbilityContext<br>方法or属性:requestDialogService(want: Want, result: AsyncCallback\<dialogRequest.RequestResult>): void;|UIAbilityContext.d.ts| +|新增|NA|类名:UIAbilityContext<br>方法or属性:requestDialogService(want: Want): Promise\<dialogRequest.RequestResult>;|UIAbilityContext.d.ts| +|删除|模块名: ohos.ability.wantConstant<br>类名: Action<br>方法 or 属性:ACTION_APP_ACCOUNT_AUTH = "ohos.appAccount.action.auth"|NA|@ohos.ability.wantConstant.d.ts| +|删除|模块名: ohos.ability.wantConstant<br>类名: Action<br>方法 or 属性:ACTION_MARKET_DOWNLOAD = "ohos.want.action.marketDownload"|NA|@ohos.ability.wantConstant.d.ts| +|删除|模块名: ohos.ability.wantConstant<br>类名: Action<br>方法 or 属性:ACTION_MARKET_CROWDTEST = "ohos.want.action.marketCrowdTest"|NA|@ohos.ability.wantConstant.d.ts| +|删除|模块名: ohos.ability.wantConstant<br>类名: Action<br>方法 or 属性:DLP_PARAMS_SANDBOX = "ohos.dlp.params.sandbox"|NA|@ohos.ability.wantConstant.d.ts| +|删除|模块名: ohos.ability.wantConstant<br>类名: Action<br>方法 or 属性:DLP_PARAMS_BUNDLE_NAME = "ohos.dlp.params.bundleName"|NA|@ohos.ability.wantConstant.d.ts| +|删除|模块名: ohos.ability.wantConstant<br>类名: Action<br>方法 or 属性:DLP_PARAMS_MODULE_NAME = "ohos.dlp.params.moduleName"|NA|@ohos.ability.wantConstant.d.ts| +|删除|模块名: ohos.ability.wantConstant<br>类名: Action<br>方法 or 属性:DLP_PARAMS_ABILITY_NAME = "ohos.dlp.params.abilityName"|NA|@ohos.ability.wantConstant.d.ts| +|删除|模块名: ohos.ability.wantConstant<br>类名: Action<br>方法 or 属性:DLP_PARAMS_INDEX = "ohos.dlp.params.index"|NA|@ohos.ability.wantConstant.d.ts| +|删除|模块名:ohos.app.ability.appManager<br>类名:appManager<br>方法 or 属性:function getProcessRunningInformation(): Promise\<Array\<ProcessRunningInformation>>;|NA|@ohos.app.ability.appManager.d.ts| +|删除|模块名:ohos.app.ability.appManager<br>类名:appManager<br>方法 or 属性:function getProcessRunningInformation(callback: AsyncCallback\<Array\<ProcessRunningInformation>>): void;|NA|@ohos.app.ability.appManager.d.ts| +|删除|模块名:ohos.app.ability.appRecovery<br>类名:RestartFlag<br>方法 or 属性:CPP_CRASH_NO_RESTART = 0x0001|NA|@ohos.app.ability.appRecovery.d.ts| +|删除|模块名:ohos.app.ability.appRecovery<br>类名:RestartFlag<br>方法 or 属性:JS_CRASH_NO_RESTART = 0x0002|NA|@ohos.app.ability.appRecovery.d.ts| +|删除|模块名:ohos.app.ability.appRecovery<br>类名:RestartFlag<br>方法 or 属性:APP_FREEZE_NO_RESTART = 0x0004|NA|@ohos.app.ability.appRecovery.d.ts| +|删除|模块名: ohos.app.ability.common<br>类名: AreaMode|NA|@ohos.app.ability.common.d.ts| +|删除|模块名: ohos.app.ability.common<br>类名: AreaMode<br>方法 or 属性:EL1 = 0|NA|@ohos.app.ability.common.d.ts| +|删除|模块名: ohos.app.ability.common<br>类名: AreaMode<br>方法 or 属性:EL2 = 1|NA|@ohos.app.ability.common.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:ACTION_HOME = "ohos.want.action.home"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:ACTION_DIAL = "ohos.want.action.dial"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:ACTION_SEARCH = "ohos.want.action.search"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:ACTION_WIRELESS_SETTINGS = "ohos.settings.wireless"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:ACTION_MANAGE_APPLICATIONS_SETTINGS = "ohos.settings.manage.applications"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:ACTION_APPLICATION_DETAILS_SETTINGS = "ohos.settings.application.details"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:ACTION_SET_ALARM = "ohos.want.action.setAlarm"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:ACTION_SHOW_ALARMS = "ohos.want.action.showAlarms"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:ACTION_SNOOZE_ALARM = "ohos.want.action.snoozeAlarm"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:ACTION_DISMISS_ALARM = "ohos.want.action.dismissAlarm"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:ACTION_DISMISS_TIMER = "ohos.want.action.dismissTimer"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:ACTION_SEND_SMS = "ohos.want.action.sendSms"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:ACTION_CHOOSE = "ohos.want.action.choose"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:ACTION_IMAGE_CAPTURE = "ohos.want.action.imageCapture"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:ACTION_VIDEO_CAPTURE = "ohos.want.action.videoCapture"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:ACTION_SELECT = "ohos.want.action.select"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:ACTION_SEND_DATA = "ohos.want.action.sendData"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:ACTION_SEND_MULTIPLE_DATA = "ohos.want.action.sendMultipleData"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:ACTION_SCAN_MEDIA_FILE = "ohos.want.action.scanMediaFile"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:ACTION_VIEW_DATA = "ohos.want.action.viewData"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:ACTION_EDIT_DATA = "ohos.want.action.editData"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:INTENT_PARAMS_INTENT = "ability.want.params.INTENT"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:INTENT_PARAMS_TITLE = "ability.want.params.TITLE"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:ACTION_FILE_SELECT = "ohos.action.fileSelect"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:PARAMS_STREAM = "ability.params.stream"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:ACTION_APP_ACCOUNT_AUTH = "ohos.appAccount.action.auth"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:ACTION_MARKET_DOWNLOAD = "ohos.want.action.marketDownload"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:ACTION_MARKET_CROWDTEST = "ohos.want.action.marketCrowdTest"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:DLP_PARAMS_SANDBOX = "ohos.dlp.params.sandbox"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:DLP_PARAMS_BUNDLE_NAME = "ohos.dlp.params.bundleName"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:DLP_PARAMS_MODULE_NAME = "ohos.dlp.params.moduleName"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:DLP_PARAMS_ABILITY_NAME = "ohos.dlp.params.abilityName"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Action<br>方法 or 属性:DLP_PARAMS_INDEX = "ohos.dlp.params.index"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Entity|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Entity<br>方法 or 属性:ENTITY_DEFAULT = "entity.system.default"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Entity<br>方法 or 属性:ENTITY_HOME = "entity.system.home"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Entity<br>方法 or 属性:ENTITY_VOICE = "entity.system.voice"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Entity<br>方法 or 属性:ENTITY_BROWSABLE = "entity.system.browsable"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Entity<br>方法 or 属性:ENTITY_VIDEO = "entity.system.video"|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Flags<br>方法 or 属性:FLAG_ABILITY_FORWARD_RESULT = 0x00000004|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Flags<br>方法 or 属性:FLAG_ABILITY_CONTINUATION = 0x00000008|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Flags<br>方法 or 属性:FLAG_NOT_OHOS_COMPONENT = 0x00000010|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Flags<br>方法 or 属性:FLAG_ABILITY_FORM_ENABLED = 0x00000020|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Flags<br>方法 or 属性:FLAG_AUTH_PERSISTABLE_URI_PERMISSION = 0x00000040|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Flags<br>方法 or 属性:FLAG_AUTH_PREFIX_URI_PERMISSION = 0x00000080|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Flags<br>方法 or 属性:FLAG_ABILITYSLICE_MULTI_DEVICE = 0x00000100|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Flags<br>方法 or 属性:FLAG_START_FOREGROUND_ABILITY = 0x00000200|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Flags<br>方法 or 属性:FLAG_ABILITY_CONTINUATION_REVERSIBLE = 0x00000400|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Flags<br>方法 or 属性:FLAG_INSTALL_WITH_BACKGROUND_MODE = 0x80000000|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Flags<br>方法 or 属性:FLAG_ABILITY_CLEAR_MISSION = 0x00008000|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Flags<br>方法 or 属性:FLAG_ABILITY_NEW_MISSION = 0x10000000|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.ability.wantConstant<br>类名: Flags<br>方法 or 属性:FLAG_ABILITY_MISSION_TOP = 0x20000000|NA|@ohos.app.ability.wantConstant.d.ts| +|删除|模块名: ohos.app.form.formInfo<br>类名: FormInfo<br>方法 or 属性:relatedBundleName: string;|NA|@ohos.app.form.formInfo.d.ts| +|删除|模块名:ohos.continuation.continuationManager<br>类名:continuationManager<br>方法 or 属性:function on(type: "deviceConnect", token: number, callback: Callback\<Array\<ContinuationResult>>): void;|NA|@ohos.continuation.continuationManager.d.ts| +|删除|模块名:ohos.continuation.continuationManager<br>类名:continuationManager<br>方法 or 属性:function off(type: "deviceConnect", token: number): void;|NA|@ohos.continuation.continuationManager.d.ts| +|删除|模块名:ohos.continuation.continuationManager<br>类名:continuationManager<br>方法 or 属性:function on(type: "deviceDisconnect", token: number, callback: Callback\<Array\<string>>): void;|NA|@ohos.continuation.continuationManager.d.ts| +|删除|模块名:ohos.continuation.continuationManager<br>类名:continuationManager<br>方法 or 属性:function off(type: "deviceDisconnect", token: number): void;|NA|@ohos.continuation.continuationManager.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:addAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback\<void>): void;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:addAbilityMonitor(monitor: AbilityMonitor): Promise\<void>;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:addAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback\<void>): void;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:addAbilityStageMonitor(monitor: AbilityStageMonitor): Promise\<void>;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:removeAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback\<void>): void;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:removeAbilityMonitor(monitor: AbilityMonitor): Promise\<void>;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:removeAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback\<void>): void;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:removeAbilityStageMonitor(monitor: AbilityStageMonitor): Promise\<void>;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:waitAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback\<UIAbility>): void;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:waitAbilityMonitor(monitor: AbilityMonitor, timeout: number, callback: AsyncCallback\<UIAbility>): void;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:waitAbilityMonitor(monitor: AbilityMonitor, timeout?: number): Promise\<UIAbility>;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:waitAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback\<AbilityStage>): void;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout: number, callback: AsyncCallback\<AbilityStage>): void;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout?: number): Promise\<AbilityStage>;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:getAppContext(): Context;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:getAbilityState(ability: UIAbility): number;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:getCurrentTopAbility(callback: AsyncCallback\<UIAbility>): void;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:getCurrentTopAbility(): Promise\<UIAbility>|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:startAbility(want: Want, callback: AsyncCallback\<void>): void;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:startAbility(want: Want): Promise\<void>;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:doAbilityForeground(ability: UIAbility, callback: AsyncCallback\<void>): void;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:doAbilityForeground(ability: UIAbility): Promise\<void>;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:doAbilityBackground(ability: UIAbility, callback: AsyncCallback\<void>): void;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:doAbilityBackground(ability: UIAbility): Promise\<void>;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:print(msg: string, callback: AsyncCallback\<void>): void;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:print(msg: string): Promise\<void>;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:printSync(msg: string): void;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:executeShellCommand(cmd: string, callback: AsyncCallback\<ShellCmdResult>): void;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:executeShellCommand(cmd: string, timeoutSecs: number, callback: AsyncCallback\<ShellCmdResult>): void;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:executeShellCommand(cmd: string, timeoutSecs?: number): Promise\<ShellCmdResult>;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:finishTest(msg: string, code: number, callback: AsyncCallback\<void>): void;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:finishTest(msg: string, code: number): Promise\<void>;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityMonitor<br>类名: AbilityMonitor|NA|abilityMonitor.d.ts| +|删除|模块名: abilityMonitor<br>类名: AbilityMonitor<br>方法 or 属性:abilityName: string;|NA|abilityMonitor.d.ts| +|删除|模块名: abilityMonitor<br>类名: AbilityMonitor<br>方法 or 属性:moduleName?: string;|NA|abilityMonitor.d.ts| +|删除|模块名: abilityMonitor<br>类名: AbilityMonitor<br>方法 or 属性:onAbilityCreate?:(ability: UIAbility) => void;|NA|abilityMonitor.d.ts| +|删除|模块名: abilityMonitor<br>类名: AbilityMonitor<br>方法 or 属性:onAbilityForeground?:(ability: UIAbility) => void;|NA|abilityMonitor.d.ts| +|删除|模块名: abilityMonitor<br>类名: AbilityMonitor<br>方法 or 属性:onAbilityBackground?:(ability: UIAbility) => void;|NA|abilityMonitor.d.ts| +|删除|模块名: abilityMonitor<br>类名: AbilityMonitor<br>方法 or 属性:onAbilityDestroy?:(ability: UIAbility) => void;|NA|abilityMonitor.d.ts| +|删除|模块名: abilityMonitor<br>类名: AbilityMonitor<br>方法 or 属性:onWindowStageCreate?:(ability: UIAbility) => void;|NA|abilityMonitor.d.ts| +|删除|模块名: abilityMonitor<br>类名: AbilityMonitor<br>方法 or 属性:onWindowStageRestore?:(ability: UIAbility) => void;|NA|abilityMonitor.d.ts| +|删除|模块名: abilityMonitor<br>类名: AbilityMonitor<br>方法 or 属性:onWindowStageDestroy?:(ability: UIAbility) => void;|NA|abilityMonitor.d.ts| +|删除|模块名: abilityStageMonitor<br>类名: AbilityStageMonitor|NA|abilityStageMonitor.d.ts| +|删除|模块名: abilityStageMonitor<br>类名: AbilityStageMonitor<br>方法 or 属性:moduleName: string;|NA|abilityStageMonitor.d.ts| +|删除|模块名: abilityStageMonitor<br>类名: AbilityStageMonitor<br>方法 or 属性:srcEntrance: string;|NA|abilityStageMonitor.d.ts| +|删除|模块名:ApplicationContext<br>类名:ApplicationContext<br>方法 or 属性:getProcessRunningInformation(): Promise\<Array\<ProcessRunningInformation>>;|NA|ApplicationContext.d.ts| +|删除|模块名:ApplicationContext<br>类名:ApplicationContext<br>方法 or 属性:getProcessRunningInformation(callback: AsyncCallback\<Array\<ProcessRunningInformation>>): void;|NA|ApplicationContext.d.ts| +|删除|模块名:ApplicationContext<br>类名:ApplicationContext<br>方法 or 属性:killProcessesBySelf(): Promise\<void>;|NA|ApplicationContext.d.ts| +|删除|模块名:ApplicationContext<br>类名:ApplicationContext<br>方法 or 属性:killProcessesBySelf(callback: AsyncCallback\<void>);|NA|ApplicationContext.d.ts| +|删除|模块名: Context<br>类名: AreaMode|NA|Context.d.ts| +|删除|模块名: Context<br>类名: AreaMode<br>方法 or 属性:EL1 = 0|NA|Context.d.ts| +|删除|模块名: Context<br>类名: AreaMode<br>方法 or 属性:EL2 = 1|NA|Context.d.ts| +|删除|模块名: ProcessRunningInformation<br>类名: ProcessRunningInformation|NA|ProcessRunningInformation.d.ts| +|删除|模块名: ProcessRunningInformation<br>类名: ProcessRunningInformation<br>方法 or 属性:pid: number;|NA|ProcessRunningInformation.d.ts| +|删除|模块名: ProcessRunningInformation<br>类名: ProcessRunningInformation<br>方法 or 属性:uid: number;|NA|ProcessRunningInformation.d.ts| +|删除|模块名: ProcessRunningInformation<br>类名: ProcessRunningInformation<br>方法 or 属性:processName: string;|NA|ProcessRunningInformation.d.ts| +|删除|模块名: ProcessRunningInformation<br>类名: ProcessRunningInformation<br>方法 or 属性:bundleNames: Array\<string>;|NA|ProcessRunningInformation.d.ts| +|访问级别有变化|类名:WindowMode<br>访问级别:公开API|类名:WindowMode<br>访问级别:系统API|@ohos.app.ability.AbilityConstant.d.ts| +|访问级别有变化|类名:StartOptions<br>方法 or 属性:windowMode?: number;<br>访问级别:公开API|类名:StartOptions<br>方法 or 属性:windowMode?: number;<br>访问级别:系统API|@ohos.app.ability.StartOptions.d.ts| +|访问级别有变化|类名:ServiceExtensionContext<br>方法 or 属性:startAbility(want: Want, callback: AsyncCallback\<void>): void;<br>访问级别:系统API|类名:ServiceExtensionContext<br>方法 or 属性:startAbility(want: Want, callback: AsyncCallback\<void>): void;<br>访问级别:公开API|ServiceExtensionContext.d.ts| +|访问级别有变化|类名:ServiceExtensionContext<br>方法 or 属性:startAbility(want: Want, options: StartOptions, callback: AsyncCallback\<void>): void;<br>访问级别:系统API|类名:ServiceExtensionContext<br>方法 or 属性:startAbility(want: Want, options: StartOptions, callback: AsyncCallback\<void>): void;<br>访问级别:公开API|ServiceExtensionContext.d.ts| +|访问级别有变化|类名:ServiceExtensionContext<br>方法 or 属性:startAbility(want: Want, options?: StartOptions): Promise\<void>;<br>访问级别:系统API|类名:ServiceExtensionContext<br>方法 or 属性:startAbility(want: Want, options?: StartOptions): Promise\<void>;<br>访问级别:公开API|ServiceExtensionContext.d.ts| +|访问级别有变化|类名:ServiceExtensionContext<br>方法 or 属性:terminateSelf(callback: AsyncCallback\<void>): void;<br>访问级别:系统API|类名:ServiceExtensionContext<br>方法 or 属性:terminateSelf(callback: AsyncCallback\<void>): void;<br>访问级别:公开API|ServiceExtensionContext.d.ts| +|访问级别有变化|类名:ServiceExtensionContext<br>方法 or 属性:terminateSelf(): Promise\<void>;<br>访问级别:系统API|类名:ServiceExtensionContext<br>方法 or 属性:terminateSelf(): Promise\<void>;<br>访问级别:公开API|ServiceExtensionContext.d.ts| +|访问级别有变化|类名:UIAbilityContext<br>方法 or 属性:startAbilityByCall(want: Want): Promise\<Caller>;<br>访问级别:系统API|类名:UIAbilityContext<br>方法 or 属性:startAbilityByCall(want: Want): Promise\<Caller>;<br>访问级别:公开API|UIAbilityContext.d.ts| +|权限有变化|类名:distributedMissionManager<br>方法 or 属性:function continueMission(parameter: ContinueDeviceInfo, options: ContinueCallback, callback: AsyncCallback\<void>): void;<br>权限:ohos.permission.MANAGE_MISSIONS|类名:distributedMissionManager<br>方法 or 属性:function continueMission(parameter: ContinueDeviceInfo, options: ContinueCallback, callback: AsyncCallback\<void>): void;<br>权限:ohos.permission.MANAGE_MISSIONS and ohos.permission.DISTRIBUTED_DATASYNC|@ohos.distributedMissionManager.d.ts| +|权限有变化|类名:distributedMissionManager<br>方法 or 属性:function continueMission(parameter: ContinueDeviceInfo, options: ContinueCallback): Promise\<void>;<br>权限:ohos.permission.MANAGE_MISSIONS|类名:distributedMissionManager<br>方法 or 属性:function continueMission(parameter: ContinueDeviceInfo, options: ContinueCallback): Promise\<void>;<br>权限:ohos.permission.MANAGE_MISSIONS and ohos.permission.DISTRIBUTED_DATASYNC|@ohos.distributedMissionManager.d.ts| +|新增(权限)|类名:continuationManager<br>方法 or 属性:function registerContinuation(callback: AsyncCallback\<number>): void;<br>权限:N/A|类名:continuationManager<br>方法 or 属性:function registerContinuation(callback: AsyncCallback\<number>): void;<br>权限:ohos.permission.DISTRIBUTED_DATASYNC|@ohos.continuation.continuationManager.d.ts| +|新增(权限)|类名:continuationManager<br>方法 or 属性:function registerContinuation(options: ContinuationExtraParams, callback: AsyncCallback\<number>): void;<br>权限:N/A|类名:continuationManager<br>方法 or 属性:function registerContinuation(options: ContinuationExtraParams, callback: AsyncCallback\<number>): void;<br>权限:ohos.permission.DISTRIBUTED_DATASYNC|@ohos.continuation.continuationManager.d.ts| +|新增(权限)|类名:continuationManager<br>方法 or 属性:function registerContinuation(options?: ContinuationExtraParams): Promise\<number>;<br>权限:N/A|类名:continuationManager<br>方法 or 属性:function registerContinuation(options?: ContinuationExtraParams): Promise\<number>;<br>权限:ohos.permission.DISTRIBUTED_DATASYNC|@ohos.continuation.continuationManager.d.ts| +|新增(权限)|类名:continuationManager<br>方法 or 属性:function unregisterContinuation(token: number, callback: AsyncCallback\<void>): void;<br>权限:N/A|类名:continuationManager<br>方法 or 属性:function unregisterContinuation(token: number, callback: AsyncCallback\<void>): void;<br>权限:ohos.permission.DISTRIBUTED_DATASYNC|@ohos.continuation.continuationManager.d.ts| +|新增(权限)|类名:continuationManager<br>方法 or 属性:function unregisterContinuation(token: number): Promise\<void>;<br>权限:N/A|类名:continuationManager<br>方法 or 属性:function unregisterContinuation(token: number): Promise\<void>;<br>权限:ohos.permission.DISTRIBUTED_DATASYNC|@ohos.continuation.continuationManager.d.ts| +|新增(权限)|类名:continuationManager<br>方法 or 属性:function updateContinuationState(token: number, deviceId: string, status: DeviceConnectState, callback: AsyncCallback\<void>): void;<br>权限:N/A|类名:continuationManager<br>方法 or 属性:function updateContinuationState(token: number, deviceId: string, status: DeviceConnectState, callback: AsyncCallback\<void>): void;<br>权限:ohos.permission.DISTRIBUTED_DATASYNC|@ohos.continuation.continuationManager.d.ts| +|新增(权限)|类名:continuationManager<br>方法 or 属性:function updateContinuationState(token: number, deviceId: string, status: DeviceConnectState): Promise\<void>;<br>权限:N/A|类名:continuationManager<br>方法 or 属性:function updateContinuationState(token: number, deviceId: string, status: DeviceConnectState): Promise\<void>;<br>权限:ohos.permission.DISTRIBUTED_DATASYNC|@ohos.continuation.continuationManager.d.ts| +|新增(权限)|类名:continuationManager<br>方法 or 属性:function startContinuationDeviceManager(token: number, callback: AsyncCallback\<void>): void;<br>权限:N/A|类名:continuationManager<br>方法 or 属性:function startContinuationDeviceManager(token: number, callback: AsyncCallback\<void>): void;<br>权限:ohos.permission.DISTRIBUTED_DATASYNC|@ohos.continuation.continuationManager.d.ts| +|新增(权限)|类名:continuationManager<br>方法 or 属性:function startContinuationDeviceManager(token: number, options: ContinuationExtraParams, callback: AsyncCallback\<void>): void;<br>权限:N/A|类名:continuationManager<br>方法 or 属性:function startContinuationDeviceManager(token: number, options: ContinuationExtraParams, callback: AsyncCallback\<void>): void;<br>权限:ohos.permission.DISTRIBUTED_DATASYNC|@ohos.continuation.continuationManager.d.ts| +|新增(权限)|类名:continuationManager<br>方法 or 属性:function startContinuationDeviceManager(token: number, options?: ContinuationExtraParams): Promise\<void>;<br>权限:N/A|类名:continuationManager<br>方法 or 属性:function startContinuationDeviceManager(token: number, options?: ContinuationExtraParams): Promise\<void>;<br>权限:ohos.permission.DISTRIBUTED_DATASYNC|@ohos.continuation.continuationManager.d.ts| +|函数有变化|类名:CalleeCallback<br>方法 or 属性:(indata: rpc.MessageParcel): rpc.Sequenceable;<br>|类名:CalleeCallback<br>方法 or 属性:(indata: rpc.MessageSequence): rpc.Parcelable;<br>|@ohos.app.ability.UIAbility.d.ts| +|函数有变化|类名:Caller<br>方法 or 属性:call(method: string, data: rpc.Sequenceable): Promise\<void>;<br>|类名:Caller<br>方法 or 属性:call(method: string, data: rpc.Parcelable): Promise\<void>;<br>|@ohos.app.ability.UIAbility.d.ts| +|函数有变化|类名:Caller<br>方法 or 属性:callWithResult(method: string, data: rpc.Sequenceable): Promise\<rpc.MessageParcel>;<br>|类名:Caller<br>方法 or 属性:callWithResult(method: string, data: rpc.Parcelable): Promise\<rpc.MessageSequence>;<br>|@ohos.app.ability.UIAbility.d.ts| +|函数有变化|类名:UIAbility<br>方法 or 属性:onContinue(wantParam: { [key: string]: any }): AbilityConstant.OnContinueResult;<br>|类名:UIAbility<br>方法 or 属性:onContinue(wantParam: { [key: string]: Object }): AbilityConstant.OnContinueResult;<br>|@ohos.app.ability.UIAbility.d.ts| +|函数有变化|类名:UIAbility<br>方法 or 属性:onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: any}): AbilityConstant.OnSaveResult;<br>|类名:UIAbility<br>方法 or 属性:onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: Object}): AbilityConstant.OnSaveResult;<br>|@ohos.app.ability.UIAbility.d.ts| +|函数有变化|类名:FormExtensionAbility<br>方法 or 属性:onShareForm?(formId: string): { [key: string]: any };<br>|类名:FormExtensionAbility<br>方法 or 属性:onShareForm?(formId: string): { [key: string]: Object };<br>|@ohos.app.form.FormExtensionAbility.d.ts| diff --git a/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-account.md b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-account.md new file mode 100644 index 0000000000000000000000000000000000000000..1554a18346dd53b275e99792447aac4c481fd1b5 --- /dev/null +++ b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-account.md @@ -0,0 +1,55 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|类名:Authenticator<br>方法or属性:checkAccountRemovable(name: string, callback: AuthCallback): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback\<boolean>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise\<boolean>;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getOsAccountLocalId(callback: AsyncCallback\<number>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getOsAccountLocalId(): Promise\<number>;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getOsAccountLocalIdForUid(uid: number, callback: AsyncCallback\<number>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getOsAccountLocalIdForUid(uid: number): Promise\<number>;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback\<number>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo): Promise\<number>;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getActivatedOsAccountLocalIds(callback: AsyncCallback\<Array\<number>>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getActivatedOsAccountLocalIds(): Promise\<Array\<number>>;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getOsAccountLocalIdForSerialNumber(serialNumber: number, callback: AsyncCallback\<number>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getOsAccountLocalIdForSerialNumber(serialNumber: number): Promise\<number>;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getSerialNumberForOsAccountLocalId(localId: number, callback: AsyncCallback\<number>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getSerialNumberForOsAccountLocalId(localId: number): Promise\<number>;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getBundleIdForUid(uid: number, callback: AsyncCallback\<number>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getBundleIdForUid(uid: number): Promise\<number>;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getOsAccountConstraintSourceTypes(localId: number, constraint: string, callback: AsyncCallback\<Array\<ConstraintSourceTypeInfo>>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise\<Array\<ConstraintSourceTypeInfo>>;|@ohos.account.osAccount.d.ts| +|删除|模块名: ohos.account.appAccount<br>类名: OAuthTokenInfo<br>方法 or 属性:account?: AppAccountInfo;|NA|@ohos.account.appAccount.d.ts| +|删除|模块名: ohos.account.appAccount<br>类名: AuthenticatorCallback<br>方法 or 属性:onRequestContinued?: () => void;|NA|@ohos.account.appAccount.d.ts| +|删除|模块名:ohos.account.appAccount<br>类名:Authenticator<br>方法 or 属性:isAccountRemovable(name: string, callback: AuthCallback): void;|NA|@ohos.account.appAccount.d.ts| +|删除|模块名:ohos.account.osAccount<br>类名:AccountManager<br>方法 or 属性:checkConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback\<boolean>): void;|NA|@ohos.account.osAccount.d.ts| +|删除|模块名:ohos.account.osAccount<br>类名:AccountManager<br>方法 or 属性:checkConstraintEnabled(localId: number, constraint: string): Promise\<boolean>;|NA|@ohos.account.osAccount.d.ts| +|删除|模块名:ohos.account.osAccount<br>类名:AccountManager<br>方法 or 属性:queryOsAccountLocalIdFromProcess(callback: AsyncCallback\<number>): void;|NA|@ohos.account.osAccount.d.ts| +|删除|模块名:ohos.account.osAccount<br>类名:AccountManager<br>方法 or 属性:queryOsAccountLocalIdFromProcess(): Promise\<number>;|NA|@ohos.account.osAccount.d.ts| +|删除|模块名:ohos.account.osAccount<br>类名:AccountManager<br>方法 or 属性:queryOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback\<number>): void;|NA|@ohos.account.osAccount.d.ts| +|删除|模块名:ohos.account.osAccount<br>类名:AccountManager<br>方法 or 属性:queryOsAccountLocalIdFromUid(uid: number): Promise\<number>;|NA|@ohos.account.osAccount.d.ts| +|删除|模块名:ohos.account.osAccount<br>类名:AccountManager<br>方法 or 属性:queryOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback\<number>): void;|NA|@ohos.account.osAccount.d.ts| +|删除|模块名:ohos.account.osAccount<br>类名:AccountManager<br>方法 or 属性:queryOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise\<number>;|NA|@ohos.account.osAccount.d.ts| +|删除|模块名:ohos.account.osAccount<br>类名:AccountManager<br>方法 or 属性:getActivatedOsAccountIds(callback: AsyncCallback\<Array\<number>>): void;|NA|@ohos.account.osAccount.d.ts| +|删除|模块名:ohos.account.osAccount<br>类名:AccountManager<br>方法 or 属性:getActivatedOsAccountIds(): Promise\<Array\<number>>;|NA|@ohos.account.osAccount.d.ts| +|删除|模块名:ohos.account.osAccount<br>类名:AccountManager<br>方法 or 属性:queryOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback\<number>): void;|NA|@ohos.account.osAccount.d.ts| +|删除|模块名:ohos.account.osAccount<br>类名:AccountManager<br>方法 or 属性:queryOsAccountLocalIdBySerialNumber(serialNumber: number): Promise\<number>;|NA|@ohos.account.osAccount.d.ts| +|删除|模块名:ohos.account.osAccount<br>类名:AccountManager<br>方法 or 属性:querySerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback\<number>): void;|NA|@ohos.account.osAccount.d.ts| +|删除|模块名:ohos.account.osAccount<br>类名:AccountManager<br>方法 or 属性:querySerialNumberByOsAccountLocalId(localId: number): Promise\<number>;|NA|@ohos.account.osAccount.d.ts| +|删除|模块名:ohos.account.osAccount<br>类名:AccountManager<br>方法 or 属性:getBundleIdFromUid(uid: number, callback: AsyncCallback\<number>): void;|NA|@ohos.account.osAccount.d.ts| +|删除|模块名:ohos.account.osAccount<br>类名:AccountManager<br>方法 or 属性:getBundleIdFromUid(uid: number): Promise\<number>;|NA|@ohos.account.osAccount.d.ts| +|删除|模块名:ohos.account.osAccount<br>类名:AccountManager<br>方法 or 属性:queryOsAccountConstraintSourceTypes(localId: number, constraint: string, callback: AsyncCallback\<Array\<ConstraintSourceTypeInfo>>): void;|NA|@ohos.account.osAccount.d.ts| +|删除|模块名:ohos.account.osAccount<br>类名:AccountManager<br>方法 or 属性:queryOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise\<Array\<ConstraintSourceTypeInfo>>;|NA|@ohos.account.osAccount.d.ts| +|起始版本有变化|类名:ConstraintSourceType<br>方法 or 属性:CONSTRAINT_NOT_EXIST = 0<br>起始版本:N/A|类名:ConstraintSourceType<br>方法 or 属性:CONSTRAINT_NOT_EXIST = 0<br>起始版本:9|@ohos.account.osAccount.d.ts| +|起始版本有变化|类名:ConstraintSourceType<br>方法 or 属性:CONSTRAINT_TYPE_BASE = 1<br>起始版本:N/A|类名:ConstraintSourceType<br>方法 or 属性:CONSTRAINT_TYPE_BASE = 1<br>起始版本:9|@ohos.account.osAccount.d.ts| +|起始版本有变化|类名:ConstraintSourceType<br>方法 or 属性:CONSTRAINT_TYPE_DEVICE_OWNER = 2<br>起始版本:N/A|类名:ConstraintSourceType<br>方法 or 属性:CONSTRAINT_TYPE_DEVICE_OWNER = 2<br>起始版本:9|@ohos.account.osAccount.d.ts| +|起始版本有变化|类名:ConstraintSourceType<br>方法 or 属性:CONSTRAINT_TYPE_PROFILE_OWNER = 3<br>起始版本:N/A|类名:ConstraintSourceType<br>方法 or 属性:CONSTRAINT_TYPE_PROFILE_OWNER = 3<br>起始版本:9|@ohos.account.osAccount.d.ts| +|起始版本有变化|类名:ConstraintSourceTypeInfo<br>方法 or 属性:localId: number;<br>起始版本:N/A|类名:ConstraintSourceTypeInfo<br>方法 or 属性:localId: number;<br>起始版本:9|@ohos.account.osAccount.d.ts| +|起始版本有变化|类名:ConstraintSourceTypeInfo<br>方法 or 属性:type: ConstraintSourceType;<br>起始版本:N/A|类名:ConstraintSourceTypeInfo<br>方法 or 属性:type: ConstraintSourceType;<br>起始版本:9|@ohos.account.osAccount.d.ts| +|删除(权限)|类名:AccountManager<br>方法 or 属性:checkOsAccountVerified(callback: AsyncCallback\<boolean>): void;<br>权限:ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS|类名:AccountManager<br>方法 or 属性:checkOsAccountVerified(callback: AsyncCallback\<boolean>): void;<br>权限:N/A|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:PINAuth<br>方法 or 属性:unregisterInputer(): void;<br>错误码内容: 201|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:UserIdentityManager<br>方法 or 属性:closeSession(): void;<br>错误码内容: 201|@ohos.account.osAccount.d.ts| +|函数有变化|类名:AccountManager<br>方法 or 属性:checkOsAccountVerified(localId?: number): Promise\<boolean>;<br>|类名:AccountManager<br>方法 or 属性:checkOsAccountVerified(): Promise\<boolean>;<br>|@ohos.account.osAccount.d.ts| +|函数有变化|类名:AccountManager<br>方法 or 属性:checkOsAccountVerified(localId?: number): Promise\<boolean>;<br>|类名:AccountManager<br>方法 or 属性:checkOsAccountVerified(localId: number): Promise\<boolean>;<br>|@ohos.account.osAccount.d.ts| +|函数有变化|类名:IInputData<br>方法 or 属性:onSetData: (pinSubType: AuthSubType, data: Uint8Array) => void;<br>|类名:IInputData<br>方法 or 属性:onSetData: (authSubType: AuthSubType, data: Uint8Array) => void;<br>|@ohos.account.osAccount.d.ts| +|函数有变化|类名:IInputer<br>方法 or 属性:onGetData: (pinSubType: AuthSubType, callback: IInputData) => void;<br>|类名:IInputer<br>方法 or 属性:onGetData: (authSubType: AuthSubType, callback: IInputData) => void;<br>|@ohos.account.osAccount.d.ts| diff --git a/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-application.md b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-application.md new file mode 100644 index 0000000000000000000000000000000000000000..7a13694e554b8cba70412e6bfb14b1035a907607 --- /dev/null +++ b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-application.md @@ -0,0 +1,4 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增(错误码)|NA|类名:call<br>方法 or 属性:function makeCall(phoneNumber: string, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function makeCall(phoneNumber: string): Promise\<void>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| diff --git a/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-arkui.md b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-arkui.md new file mode 100644 index 0000000000000000000000000000000000000000..650285b5020b56c0fc8aaf4a992dbc32d5d0389d --- /dev/null +++ b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-arkui.md @@ -0,0 +1,1231 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.font<br>类名: font|@ohos.font.d.ts| +|新增|NA|模块名: ohos.font<br>类名: FontOptions|@ohos.font.d.ts| +|新增|NA|模块名: ohos.font<br>类名: FontOptions<br>方法 or 属性: familyName: string;|@ohos.font.d.ts| +|新增|NA|模块名: ohos.font<br>类名: FontOptions<br>方法 or 属性: familySrc: string;|@ohos.font.d.ts| +|新增|NA|模块名: ohos.font<br>类名: font<br>方法 or 属性: function registerFont(options: FontOptions):void;|@ohos.font.d.ts| +|新增|NA|模块名: ohos.measure<br>类名: MeasureOptions|@ohos.measure.d.ts| +|新增|NA|模块名: ohos.measure<br>类名: MeasureOptions<br>方法 or 属性: textContent: string;|@ohos.measure.d.ts| +|新增|NA|模块名: ohos.measure<br>类名: MeasureOptions<br>方法 or 属性: fontSize?: number \| string \| Resource;|@ohos.measure.d.ts| +|新增|NA|模块名: ohos.measure<br>类名: MeasureOptions<br>方法 or 属性: fontStyle?: number \| FontStyle;|@ohos.measure.d.ts| +|新增|NA|模块名: ohos.measure<br>类名: MeasureOptions<br>方法 or 属性: fontWeight?: number \| string \| FontWeight;|@ohos.measure.d.ts| +|新增|NA|模块名: ohos.measure<br>类名: MeasureOptions<br>方法 or 属性: fontFamily?: string \| Resource;|@ohos.measure.d.ts| +|新增|NA|模块名: ohos.measure<br>类名: MeasureOptions<br>方法 or 属性: letterSpacing?: number \| string;|@ohos.measure.d.ts| +|新增|NA|模块名: ohos.measure<br>类名: MeasureText|@ohos.measure.d.ts| +|新增|NA|模块名: ohos.measure<br>类名: MeasureText<br>方法 or 属性: static measureText(options: MeasureOptions): number;|@ohos.measure.d.ts| +|新增|NA|类名:PushParameterForStage<br>方法or属性:target: Want;|@ohos.pluginComponent.d.ts| +|新增|NA|类名:RequestParameterForStage<br>方法or属性:target: Want;|@ohos.pluginComponent.d.ts| +|新增|NA|类名:ShowToastOptions<br>方法or属性:message: string;|@ohos.prompt.d.ts| +|新增|NA|类名:Button<br>方法or属性:text: string;|@ohos.prompt.d.ts| +|新增|NA|类名:Button<br>方法or属性:color: string;|@ohos.prompt.d.ts| +|新增|NA|类名:ShowDialogOptions<br>方法or属性:title?: string;|@ohos.prompt.d.ts| +|新增|NA|类名:ShowDialogOptions<br>方法or属性:message?: string;|@ohos.prompt.d.ts| +|新增|NA|类名:ActionMenuOptions<br>方法or属性:title?: string;|@ohos.prompt.d.ts| +|新增|NA|类名:router<br>方法or属性:function showAlertBeforeBackPage(options: EnableAlertOptions):void;|@ohos.router.d.ts| +|新增|NA|类名:router<br>方法or属性:function hideAlertBeforeBackPage():void;|@ohos.router.d.ts| +|新增|NA|类名:CanvasRenderer<br>方法or属性:filter: string;|canvas.d.ts| +|新增|NA|类名:CanvasRenderer<br>方法or属性:imageSmoothingQuality: ImageSmoothingQuality;|canvas.d.ts| +|新增|NA|类名:CanvasRenderer<br>方法or属性:direction: CanvasDirection;|canvas.d.ts| +|新增|NA|类名:global<br>方法or属性:declare const Concurrent: MethodDecorator;|common.d.ts| +|新增|NA|类名:BorderImageOption<br>方法or属性:source?: string \| Resource \| LinearGradient,|common.d.ts| +|新增|NA|模块名: common<br>类名: LinearGradient|common.d.ts| +|新增|NA|类名:LinearGradient<br>方法or属性:|common.d.ts| +|新增|NA|模块名: common<br>类名: LinearGradient<br>方法 or 属性:angle?: number \| string;|common.d.ts| +|新增|NA|类名:LinearGradient<br>方法or属性:angle?: number \| string;|common.d.ts| +|新增|NA|模块名: common<br>类名: LinearGradient<br>方法 or 属性:direction?: GradientDirection;|common.d.ts| +|新增|NA|类名:LinearGradient<br>方法or属性:direction?: GradientDirection;|common.d.ts| +|新增|NA|模块名: common<br>类名: LinearGradient<br>方法 or 属性:colors: Array\<any>;|common.d.ts| +|新增|NA|类名:LinearGradient<br>方法or属性:colors: Array\<any>;|common.d.ts| +|新增|NA|模块名: common<br>类名: LinearGradient<br>方法 or 属性:repeating?: boolean;|common.d.ts| +|新增|NA|类名:LinearGradient<br>方法or属性:repeating?: boolean;|common.d.ts| +|新增|NA|类名:ImageAttribute<br>方法or属性:draggable(value: boolean): ImageAttribute;|image.d.ts| +|新增|NA|类名:ListAttribute<br>方法or属性:onScrollStart(event: () => void): ListAttribute;|list.d.ts| +|新增|NA|类名:ListAttribute<br>方法or属性:onScrollFrameBegin(event: (offset: number, state: ScrollState) => { offsetRemain: number }): ListAttribute;|list.d.ts| +|新增|NA|模块名: menu<br>类名: MenuInterface|menu.d.ts| +|新增|NA|模块名: menu<br>类名: MenuInterface<br>方法 or 属性: (): MenuAttribute;|menu.d.ts| +|新增|NA|模块名: menu<br>类名: MenuAttribute|menu.d.ts| +|新增|NA|模块名: menu<br>类名: MenuAttribute<br>方法 or 属性: fontSize(value: Length): MenuAttribute;|menu.d.ts| +|新增|NA|模块名: menu<br>类名: global<br>方法 or 属性: declare const Menu: MenuInterface;|menu.d.ts| +|新增|NA|模块名: menu<br>类名: global<br>方法 or 属性: declare const MenuInstance: MenuAttribute;|menu.d.ts| +|新增|NA|模块名: menu_item<br>类名: MenuItemOptions|menu_item.d.ts| +|新增|NA|模块名: menu_item<br>类名: MenuItemOptions<br>方法 or 属性: startIcon?: ResourceStr;|menu_item.d.ts| +|新增|NA|模块名: menu_item<br>类名: MenuItemOptions<br>方法 or 属性: content?: ResourceStr;|menu_item.d.ts| +|新增|NA|模块名: menu_item<br>类名: MenuItemOptions<br>方法 or 属性: endIcon?: ResourceStr;|menu_item.d.ts| +|新增|NA|模块名: menu_item<br>类名: MenuItemOptions<br>方法 or 属性: labelInfo?: ResourceStr;|menu_item.d.ts| +|新增|NA|模块名: menu_item<br>类名: MenuItemOptions<br>方法 or 属性: builder?: CustomBuilder;|menu_item.d.ts| +|新增|NA|模块名: menu_item<br>类名: MenuItemInterface|menu_item.d.ts| +|新增|NA|模块名: menu_item<br>类名: MenuItemInterface<br>方法 or 属性: (value?: MenuItemOptions \| CustomBuilder): MenuItemAttribute;|menu_item.d.ts| +|新增|NA|模块名: menu_item<br>类名: MenuItemAttribute|menu_item.d.ts| +|新增|NA|模块名: menu_item<br>类名: MenuItemAttribute<br>方法 or 属性: selected(value: boolean): MenuItemAttribute;|menu_item.d.ts| +|新增|NA|模块名: menu_item<br>类名: MenuItemAttribute<br>方法 or 属性: selectIcon(value: boolean): MenuItemAttribute;|menu_item.d.ts| +|新增|NA|模块名: menu_item<br>类名: MenuItemAttribute<br>方法 or 属性: onChange(callback: (selected: boolean) => void): MenuItemAttribute;|menu_item.d.ts| +|新增|NA|模块名: menu_item<br>类名: global<br>方法 or 属性: declare const MenuItem: MenuItemInterface;|menu_item.d.ts| +|新增|NA|模块名: menu_item<br>类名: global<br>方法 or 属性: declare const MenuItemInstance: MenuItemAttribute;|menu_item.d.ts| +|新增|NA|模块名: menu_item_group<br>类名: MenuItemGroupOptions|menu_item_group.d.ts| +|新增|NA|模块名: menu_item_group<br>类名: MenuItemGroupOptions<br>方法 or 属性: header?: ResourceStr \| CustomBuilder;|menu_item_group.d.ts| +|新增|NA|模块名: menu_item_group<br>类名: MenuItemGroupOptions<br>方法 or 属性: footer?: ResourceStr \| CustomBuilder;|menu_item_group.d.ts| +|新增|NA|模块名: menu_item_group<br>类名: MenuItemGroupInterface|menu_item_group.d.ts| +|新增|NA|模块名: menu_item_group<br>类名: MenuItemGroupInterface<br>方法 or 属性: (value?: MenuItemGroupOptions): MenuItemGroupAttribute;|menu_item_group.d.ts| +|新增|NA|模块名: menu_item_group<br>类名: MenuItemGroupAttribute|menu_item_group.d.ts| +|新增|NA|模块名: menu_item_group<br>类名: global<br>方法 or 属性: declare const MenuItemGroup: MenuItemGroupInterface;|menu_item_group.d.ts| +|新增|NA|模块名: menu_item_group<br>类名: global<br>方法 or 属性: declare const MenuItemGroupInstance: MenuItemGroupAttribute;|menu_item_group.d.ts| +|新增|NA|类名:PluginComponentTemplate<br>方法or属性:bundleName: string;|plugin_component.d.ts| +|新增|NA|类名:ScrollAttribute<br>方法or属性:onScrollStart(event: () => void): ScrollAttribute;|scroll.d.ts| +|新增|NA|类名:ScrollAttribute<br>方法or属性:onScrollStop(event: () => void): ScrollAttribute;|scroll.d.ts| +|新增|NA|类名:ScrollAttribute<br>方法or属性:onScrollFrameBegin(event: (offset: number, state: ScrollState) => { offsetRemain: number }): ScrollAttribute;|scroll.d.ts| +|新增|NA|类名:ShapeInterface<br>方法or属性:(value: PixelMap): ShapeAttribute;|shape.d.ts| +|新增|NA|类名:ShapeInterface<br>方法or属性:(): ShapeAttribute;|shape.d.ts| +|新增|NA|模块名: tab_content<br>类名: SubTabBarStyle|tab_content.d.ts| +|新增|NA|类名:SubTabBarStyle<br>方法or属性:|tab_content.d.ts| +|新增|NA|模块名: tab_content<br>类名: SubTabBarStyle<br>方法 or 属性:constructor(content: string \| Resource);|tab_content.d.ts| +|新增|NA|类名:SubTabBarStyle<br>方法or属性:constructor(content: string \| Resource);|tab_content.d.ts| +|新增|NA|模块名: tab_content<br>类名: BottomTabBarStyle|tab_content.d.ts| +|新增|NA|类名:BottomTabBarStyle<br>方法or属性:|tab_content.d.ts| +|新增|NA|模块名: tab_content<br>类名: BottomTabBarStyle<br>方法 or 属性:constructor(icon: string \| Resource, text: string \| Resource);|tab_content.d.ts| +|新增|NA|类名:BottomTabBarStyle<br>方法or属性:constructor(icon: string \| Resource, text: string \| Resource);|tab_content.d.ts| +|新增|NA|类名:TabContentAttribute<br>方法or属性:tabBar(value: SubTabBarStyle \| BottomTabBarStyle): TabContentAttribute;|tab_content.d.ts| +|删除|模块名:ohos.pluginComponent<br>类名:PushParameterForStage<br>方法 or 属性:want: Want;|NA|@ohos.pluginComponent.d.ts| +|删除|模块名:ohos.pluginComponent<br>类名:RequestParameterForStage<br>方法 or 属性:want: Want;|NA|@ohos.pluginComponent.d.ts| +|删除|模块名:ohos.router<br>类名:router<br>方法 or 属性:function enableBackPageAlert(options: EnableAlertOptions):void;|NA|@ohos.router.d.ts| +|删除|模块名:canvas<br>类名:CanvasRenderer<br>方法 or 属性:filter(filter: string): void;|NA|canvas.d.ts| +|删除|模块名:canvas<br>类名:CanvasRenderer<br>方法 or 属性:imageSmoothingQuality(quality: ImageSmoothingQuality): void;|NA|canvas.d.ts| +|删除|模块名:canvas<br>类名:CanvasRenderer<br>方法 or 属性:direction(direction: CanvasDirection): void;|NA|canvas.d.ts| +|删除|模块名:list<br>类名:ListAttribute<br>方法 or 属性:onScrollBegin(event: (dx: number, dy: number) => { dxRemain: number, dyRemain: number }): ListAttribute;|NA|list.d.ts| +|删除|模块名:plugin_component<br>类名:PluginComponentTemplate<br>方法 or 属性:ability: string;|NA|plugin_component.d.ts| +|删除|模块名:scroll<br>类名:ScrollAttribute<br>方法 or 属性:onScrollBegin(event: (dx: number, dy: number) => { dxRemain: number, dyRemain: number }): ScrollAttribute;|NA|scroll.d.ts| +|删除|模块名: web<br>类名: WebMessagePort|NA|web.d.ts| +|删除|模块名: web<br>类名: WebMessagePort<br>方法 or 属性:constructor();|NA|web.d.ts| +|删除|模块名: web<br>类名: WebMessagePort<br>方法 or 属性:close(): void;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebMessagePort<br>方法 or 属性:postMessageEvent(message: WebMessageEvent): void;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebMessagePort<br>方法 or 属性:onMessageEvent(callback: (result: string) => void): void;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebMessageEvent|NA|web.d.ts| +|删除|模块名: web<br>类名: WebMessageEvent<br>方法 or 属性:constructor();|NA|web.d.ts| +|删除|模块名: web<br>类名: WebMessageEvent<br>方法 or 属性:getData(): string;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebMessageEvent<br>方法 or 属性:setData(data: string): void;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebMessageEvent<br>方法 or 属性:getPorts(): Array\<WebMessagePort>;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebMessageEvent<br>方法 or 属性:setPorts(ports: Array\<WebMessagePort>): void;|NA|web.d.ts| +|删除|模块名: web<br>类名: HitTestValue|NA|web.d.ts| +|删除|模块名: web<br>类名: HitTestValue<br>方法 or 属性:constructor();|NA|web.d.ts| +|删除|模块名: web<br>类名: HitTestValue<br>方法 or 属性:getType(): HitTestType;|NA|web.d.ts| +|删除|模块名: web<br>类名: HitTestValue<br>方法 or 属性:getExtra(): string;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebCookie<br>方法 or 属性:isCookieAllowed(): boolean;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebCookie<br>方法 or 属性:isThirdPartyCookieAllowed(): boolean;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebCookie<br>方法 or 属性:isFileURICookieAllowed(): boolean;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebCookie<br>方法 or 属性:putAcceptCookieEnabled(accept: boolean): void;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebCookie<br>方法 or 属性:putAcceptThirdPartyCookieEnabled(accept: boolean): void;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebCookie<br>方法 or 属性:putAcceptFileURICookieEnabled(accept: boolean): void;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebCookie<br>方法 or 属性:setCookie(url: string, value: string): boolean;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebCookie<br>方法 or 属性:saveCookieSync(): boolean;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebCookie<br>方法 or 属性:getCookie(url: string): string;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebCookie<br>方法 or 属性:existCookie(): boolean;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebCookie<br>方法 or 属性:deleteEntireCookie(): void;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebCookie<br>方法 or 属性:deleteSessionCookie(): void;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebCookie<br>方法 or 属性:deleteExpiredCookie(): void;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebController<br>方法 or 属性:zoomIn(): boolean;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebController<br>方法 or 属性:zoomOut(): boolean;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebController<br>方法 or 属性:createWebMessagePorts(): Array\<WebMessagePort>;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebController<br>方法 or 属性:postMessage(options: { message: WebMessageEvent, uri: string}): void;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebController<br>方法 or 属性:getHitTestValue(): HitTestValue;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebController<br>方法 or 属性:getWebId(): number;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebController<br>方法 or 属性:getDefaultUserAgent(): string;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebController<br>方法 or 属性:getTitle(): string;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebController<br>方法 or 属性:getPageHeight(): number;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebController<br>方法 or 属性:backOrForward(step: number): void;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebController<br>方法 or 属性:searchAllAsync(searchString: string): void;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebController<br>方法 or 属性:clearMatches(): void;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebController<br>方法 or 属性:searchNext(forward: boolean): void;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebController<br>方法 or 属性:clearSslCache(): void;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebController<br>方法 or 属性:clearClientAuthenticationCache(): void;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebController<br>方法 or 属性:getUrl(): string;|NA|web.d.ts| +|删除|模块名: web<br>类名: WebAttribute<br>方法 or 属性:webDebuggingAccess(webDebuggingAccess: boolean): WebAttribute;|NA|web.d.ts| +|访问级别有变化|类名:curves<br>方法 or 属性:function springMotion(response?: number, dampingFraction?: number, overlapDuration?: number): ICurve;<br>访问级别:系统API|类名:curves<br>方法 or 属性:function springMotion(response?: number, dampingFraction?: number, overlapDuration?: number): ICurve;<br>访问级别:公开API|@ohos.curves.d.ts| +|访问级别有变化|类名:curves<br>方法 or 属性:function responsiveSpringMotion(response?: number, dampingFraction?: number, overlapDuration?: number): ICurve;<br>访问级别:系统API|类名:curves<br>方法 or 属性:function responsiveSpringMotion(response?: number, dampingFraction?: number, overlapDuration?: number): ICurve;<br>访问级别:公开API|@ohos.curves.d.ts| +|访问级别有变化|类名:global<br>方法 or 属性:declare const Animator: AnimatorInterface;<br>访问级别:公开API|类名:global<br>方法 or 属性:declare const Animator: AnimatorInterface;<br>访问级别:系统API|animator.d.ts| +|访问级别有变化|类名:global<br>方法 or 属性:declare const AnimatorInstance: AnimatorAttribute;<br>访问级别:公开API|类名:global<br>方法 or 属性:declare const AnimatorInstance: AnimatorAttribute;<br>访问级别:系统API|animator.d.ts| +|访问级别有变化|类名:global<br>方法 or 属性:declare const Calendar: CalendarInterface;<br>访问级别:公开API|类名:global<br>方法 or 属性:declare const Calendar: CalendarInterface;<br>访问级别:系统API|calendar.d.ts| +|访问级别有变化|类名:global<br>方法 or 属性:declare const CalendarInstance: CalendarAttribute;<br>访问级别:公开API|类名:global<br>方法 or 属性:declare const CalendarInstance: CalendarAttribute;<br>访问级别:系统API|calendar.d.ts| +|访问级别有变化|类名:<br>方法 or 属性:function postCardAction(component: Object, action: Object): void;<br>访问级别:系统API|类名:<br>方法 or 属性:function postCardAction(component: Object, action: Object): void;<br>访问级别:公开API|common.d.ts| +|访问级别有变化|类名:BlurStyle<br>方法 or 属性:Thin<br>访问级别:系统API|类名:BlurStyle<br>方法 or 属性:Thin<br>访问级别:公开API|common.d.ts| +|访问级别有变化|类名:BlurStyle<br>方法 or 属性:Regular<br>访问级别:系统API|类名:BlurStyle<br>方法 or 属性:Regular<br>访问级别:公开API|common.d.ts| +|访问级别有变化|类名:BlurStyle<br>方法 or 属性:Thick<br>访问级别:系统API|类名:BlurStyle<br>方法 or 属性:Thick<br>访问级别:公开API|common.d.ts| +|访问级别有变化|类名:CommonMethod<br>方法 or 属性:backgroundBlurStyle(value: BlurStyle): T;<br>访问级别:系统API|类名:CommonMethod<br>方法 or 属性:backgroundBlurStyle(value: BlurStyle): T;<br>访问级别:公开API|common.d.ts| +|访问级别有变化|类名:global<br>方法 or 属性:declare const FormComponent: FormComponentInterface;<br>访问级别:公开API|类名:global<br>方法 or 属性:declare const FormComponent: FormComponentInterface;<br>访问级别:系统API|form_component.d.ts| +|访问级别有变化|类名:global<br>方法 or 属性:declare const FormComponentInstance: FormComponentAttribute;<br>访问级别:公开API|类名:global<br>方法 or 属性:declare const FormComponentInstance: FormComponentAttribute;<br>访问级别:系统API|form_component.d.ts| +|访问级别有变化|类名:global<br>方法 or 属性:declare const PluginComponent: PluginComponentInterface;<br>访问级别:公开API|类名:global<br>方法 or 属性:declare const PluginComponent: PluginComponentInterface;<br>访问级别:系统API|plugin_component.d.ts| +|访问级别有变化|类名:global<br>方法 or 属性:declare const PluginComponentInstance: PluginComponentAttribute;<br>访问级别:公开API|类名:global<br>方法 or 属性:declare const PluginComponentInstance: PluginComponentAttribute;<br>访问级别:系统API|plugin_component.d.ts| +|访问级别有变化|类名:global<br>方法 or 属性:declare const RemoteWindow: RemoteWindowInterface;<br>访问级别:公开API|类名:global<br>方法 or 属性:declare const RemoteWindow: RemoteWindowInterface;<br>访问级别:系统API|remote_window.d.ts| +|访问级别有变化|类名:global<br>方法 or 属性:declare const RemoteWindowInstance: RemoteWindowAttribute;<br>访问级别:公开API|类名:global<br>方法 or 属性:declare const RemoteWindowInstance: RemoteWindowAttribute;<br>访问级别:系统API|remote_window.d.ts| +|废弃版本有变化|类名:router<br>方法 or 属性:function disableAlertBeforeBackPage():void;<br>废弃版本:N/A|类名:router<br>方法 or 属性:function disableAlertBeforeBackPage():void;<br>废弃版本:9<br>代替接口:ohos.router.router|@ohos.router.d.ts| +|废弃版本有变化|类名:GridItemAttribute<br>方法 or 属性:forceRebuild(value: boolean): GridItemAttribute;<br>废弃版本:N/A|类名:GridItemAttribute<br>方法 or 属性:forceRebuild(value: boolean): GridItemAttribute;<br>废弃版本:9<br>代替接口:N/A|gridItem.d.ts| +|废弃版本有变化|类名:global<br>方法 or 属性:declare const GridContainer: GridContainerInterface<br>废弃版本:N/A|类名:global<br>方法 or 属性:declare const GridContainer: GridContainerInterface<br>废弃版本:9<br>代替接口:grid_col/|grid_container.d.ts| +|废弃版本有变化|类名:global<br>方法 or 属性:declare const GridContainerInstance: GridContainerAttribute;<br>废弃版本:N/A|类名:global<br>方法 or 属性:declare const GridContainerInstance: GridContainerAttribute;<br>废弃版本:9<br>代替接口:grid_col/|grid_container.d.ts| +|废弃版本有变化|类名:ScrollAttribute<br>方法 or 属性:onScrollEnd(event: () => void): ScrollAttribute;<br>废弃版本:N/A|类名:ScrollAttribute<br>方法 or 属性:onScrollEnd(event: () => void): ScrollAttribute;<br>废弃版本:9<br>代替接口:scroll/Scroll|scroll.d.ts| +|起始版本有变化|类名:CanvasPattern<br>起始版本:8|类名:CanvasPattern<br>起始版本:9|canvaspattern.d.ts| +|起始版本有变化|类名:CanvasPattern<br>方法 or 属性:setTransform(transform?: Matrix2D): void;<br>起始版本:8|类名:CanvasPattern<br>方法 or 属性:setTransform(transform?: Matrix2D): void;<br>起始版本:9|canvaspattern.d.ts| +|起始版本有变化|类名:Matrix2D<br>起始版本:8|类名:Matrix2D<br>起始版本:9|canvaspattern.d.ts| +|起始版本有变化|类名:Matrix2D<br>方法 or 属性:scaleX?: number;<br>起始版本:8|类名:Matrix2D<br>方法 or 属性:scaleX?: number;<br>起始版本:9|canvaspattern.d.ts| +|起始版本有变化|类名:Matrix2D<br>方法 or 属性:rotateY?: number;<br>起始版本:8|类名:Matrix2D<br>方法 or 属性:rotateY?: number;<br>起始版本:9|canvaspattern.d.ts| +|起始版本有变化|类名:Matrix2D<br>方法 or 属性:rotateX?: number;<br>起始版本:8|类名:Matrix2D<br>方法 or 属性:rotateX?: number;<br>起始版本:9|canvaspattern.d.ts| +|起始版本有变化|类名:Matrix2D<br>方法 or 属性:scaleY?: number;<br>起始版本:8|类名:Matrix2D<br>方法 or 属性:scaleY?: number;<br>起始版本:9|canvaspattern.d.ts| +|起始版本有变化|类名:Matrix2D<br>方法 or 属性:translateX?: number;<br>起始版本:8|类名:Matrix2D<br>方法 or 属性:translateX?: number;<br>起始版本:9|canvaspattern.d.ts| +|起始版本有变化|类名:Matrix2D<br>方法 or 属性:translateY?: number;<br>起始版本:8|类名:Matrix2D<br>方法 or 属性:translateY?: number;<br>起始版本:9|canvaspattern.d.ts| +|起始版本有变化|类名:Matrix2D<br>方法 or 属性:identity(): Matrix2D;<br>起始版本:8|类名:Matrix2D<br>方法 or 属性:identity(): Matrix2D;<br>起始版本:9|canvaspattern.d.ts| +|起始版本有变化|类名:Matrix2D<br>方法 or 属性:invert(): Matrix2D;<br>起始版本:8|类名:Matrix2D<br>方法 or 属性:invert(): Matrix2D;<br>起始版本:9|canvaspattern.d.ts| +|起始版本有变化|类名:Matrix2D<br>方法 or 属性:multiply(other?: Matrix2D): Matrix2D;<br>起始版本:8|类名:Matrix2D<br>方法 or 属性:multiply(other?: Matrix2D): Matrix2D;<br>起始版本:9|canvaspattern.d.ts| +|起始版本有变化|类名:Matrix2D<br>方法 or 属性:rotate(rx?: number, ry?: number): Matrix2D;<br>起始版本:8|类名:Matrix2D<br>方法 or 属性:rotate(rx?: number, ry?: number): Matrix2D;<br>起始版本:9|canvaspattern.d.ts| +|起始版本有变化|类名:Matrix2D<br>方法 or 属性:translate(tx?: number, ty?: number): Matrix2D;<br>起始版本:8|类名:Matrix2D<br>方法 or 属性:translate(tx?: number, ty?: number): Matrix2D;<br>起始版本:9|canvaspattern.d.ts| +|起始版本有变化|类名:Matrix2D<br>方法 or 属性:scale(sx?: number, sy?: number): Matrix2D;<br>起始版本:8|类名:Matrix2D<br>方法 or 属性:scale(sx?: number, sy?: number): Matrix2D;<br>起始版本:9|canvaspattern.d.ts| +|起始版本有变化|类名:Matrix2D<br>方法 or 属性:constructor();<br>起始版本:8|类名:Matrix2D<br>方法 or 属性:constructor();<br>起始版本:9|canvaspattern.d.ts| +|起始版本有变化|类名:console<br>起始版本:7|类名:console<br>起始版本:9|global.d.ts| +|起始版本有变化|类名:console<br>方法 or 属性:static debug(message: string, ...arguments: any[]): void;<br>起始版本:7|类名:console<br>方法 or 属性:static debug(message: string, ...arguments: any[]): void;<br>起始版本:9|global.d.ts| +|起始版本有变化|类名:console<br>方法 or 属性:static log(message: string, ...arguments: any[]): void;<br>起始版本:7|类名:console<br>方法 or 属性:static log(message: string, ...arguments: any[]): void;<br>起始版本:9|global.d.ts| +|起始版本有变化|类名:console<br>方法 or 属性:static info(message: string, ...arguments: any[]): void;<br>起始版本:7|类名:console<br>方法 or 属性:static info(message: string, ...arguments: any[]): void;<br>起始版本:9|global.d.ts| +|起始版本有变化|类名:console<br>方法 or 属性:static warn(message: string, ...arguments: any[]): void;<br>起始版本:7|类名:console<br>方法 or 属性:static warn(message: string, ...arguments: any[]): void;<br>起始版本:9|global.d.ts| +|起始版本有变化|类名:console<br>方法 or 属性:static error(message: string, ...arguments: any[]): void;<br>起始版本:7|类名:console<br>方法 or 属性:static error(message: string, ...arguments: any[]): void;<br>起始版本:9|global.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const AbilityComponent: AbilityComponentInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const AbilityComponent: AbilityComponentInterface;<br>起始版本:9|ability_component.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const AbilityComponentInstance: AbilityComponentAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const AbilityComponentInstance: AbilityComponentAttribute;<br>起始版本:9|ability_component.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const AlphabetIndexer: AlphabetIndexerInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const AlphabetIndexer: AlphabetIndexerInterface;<br>起始版本:7|alphabet_indexer.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const AlphabetIndexerInstance: AlphabetIndexerAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const AlphabetIndexerInstance: AlphabetIndexerAttribute;<br>起始版本:7|alphabet_indexer.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Animator: AnimatorInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Animator: AnimatorInterface;<br>起始版本:7|animator.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const AnimatorInstance: AnimatorAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const AnimatorInstance: AnimatorAttribute;<br>起始版本:7|animator.d.ts| +|起始版本有变化|类名:BadgePosition<br>起始版本:7|类名:BadgePosition<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgePosition<br>方法 or 属性:RightTop<br>起始版本:7|类名:BadgePosition<br>方法 or 属性:RightTop<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgePosition<br>方法 or 属性:Right<br>起始版本:7|类名:BadgePosition<br>方法 or 属性:Right<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgePosition<br>方法 or 属性:Left<br>起始版本:7|类名:BadgePosition<br>方法 or 属性:Left<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeStyle<br>起始版本:7|类名:BadgeStyle<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeStyle<br>方法 or 属性:color?: ResourceColor;<br>起始版本:7|类名:BadgeStyle<br>方法 or 属性:color?: ResourceColor;<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeStyle<br>方法 or 属性:fontSize?: number \| string;<br>起始版本:7|类名:BadgeStyle<br>方法 or 属性:fontSize?: number \| string;<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeStyle<br>方法 or 属性:badgeSize?: number \| string;<br>起始版本:7|类名:BadgeStyle<br>方法 or 属性:badgeSize?: number \| string;<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeStyle<br>方法 or 属性:badgeColor?: ResourceColor;<br>起始版本:7|类名:BadgeStyle<br>方法 or 属性:badgeColor?: ResourceColor;<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeParam<br>起始版本:7|类名:BadgeParam<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeParam<br>方法 or 属性:position?: BadgePosition;<br>起始版本:7|类名:BadgeParam<br>方法 or 属性:position?: BadgePosition;<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeParam<br>方法 or 属性:style: BadgeStyle;<br>起始版本:7|类名:BadgeParam<br>方法 or 属性:style: BadgeStyle;<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeParamWithNumber<br>起始版本:7|类名:BadgeParamWithNumber<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeParamWithNumber<br>方法 or 属性:count: number;<br>起始版本:7|类名:BadgeParamWithNumber<br>方法 or 属性:count: number;<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeParamWithNumber<br>方法 or 属性:maxCount?: number;<br>起始版本:7|类名:BadgeParamWithNumber<br>方法 or 属性:maxCount?: number;<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeParamWithString<br>起始版本:7|类名:BadgeParamWithString<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeParamWithString<br>方法 or 属性:value: string;<br>起始版本:7|类名:BadgeParamWithString<br>方法 or 属性:value: string;<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeInterface<br>起始版本:7|类名:BadgeInterface<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeInterface<br>方法 or 属性:(value: BadgeParamWithNumber): BadgeAttribute;<br>起始版本:7|类名:BadgeInterface<br>方法 or 属性:(value: BadgeParamWithNumber): BadgeAttribute;<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeInterface<br>方法 or 属性:(value: BadgeParamWithString): BadgeAttribute;<br>起始版本:7|类名:BadgeInterface<br>方法 or 属性:(value: BadgeParamWithString): BadgeAttribute;<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeAttribute<br>起始版本:7|类名:BadgeAttribute<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Badge: BadgeInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Badge: BadgeInterface;<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const BadgeInstance: BadgeAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const BadgeInstance: BadgeAttribute;<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BlankInterface<br>起始版本:7|类名:BlankInterface<br>起始版本:9|blank.d.ts| +|起始版本有变化|类名:BlankInterface<br>方法 or 属性:(min?: number \| string): BlankAttribute;<br>起始版本:7|类名:BlankInterface<br>方法 or 属性:(min?: number \| string): BlankAttribute;<br>起始版本:9|blank.d.ts| +|起始版本有变化|类名:BlankAttribute<br>起始版本:7|类名:BlankAttribute<br>起始版本:9|blank.d.ts| +|起始版本有变化|类名:BlankAttribute<br>方法 or 属性:color(value: ResourceColor): BlankAttribute;<br>起始版本:7|类名:BlankAttribute<br>方法 or 属性:color(value: ResourceColor): BlankAttribute;<br>起始版本:9|blank.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Blank: BlankInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Blank: BlankInterface;<br>起始版本:9|blank.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const BlankInstance: BlankAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const BlankInstance: BlankAttribute;<br>起始版本:9|blank.d.ts| +|起始版本有变化|类名:ButtonType<br>起始版本:7|类名:ButtonType<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonType<br>方法 or 属性:Capsule<br>起始版本:7|类名:ButtonType<br>方法 or 属性:Capsule<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonType<br>方法 or 属性:Circle<br>起始版本:7|类名:ButtonType<br>方法 or 属性:Circle<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonType<br>方法 or 属性:Normal<br>起始版本:7|类名:ButtonType<br>方法 or 属性:Normal<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonOptions<br>起始版本:7|类名:ButtonOptions<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonOptions<br>方法 or 属性:type?: ButtonType;<br>起始版本:7|类名:ButtonOptions<br>方法 or 属性:type?: ButtonType;<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonOptions<br>方法 or 属性:stateEffect?: boolean;<br>起始版本:7|类名:ButtonOptions<br>方法 or 属性:stateEffect?: boolean;<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonInterface<br>起始版本:7|类名:ButtonInterface<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonInterface<br>方法 or 属性:(): ButtonAttribute;<br>起始版本:7|类名:ButtonInterface<br>方法 or 属性:(): ButtonAttribute;<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonInterface<br>方法 or 属性:(options: ButtonOptions): ButtonAttribute;<br>起始版本:7|类名:ButtonInterface<br>方法 or 属性:(options: ButtonOptions): ButtonAttribute;<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonInterface<br>方法 or 属性:(label: ResourceStr, options?: ButtonOptions): ButtonAttribute;<br>起始版本:7|类名:ButtonInterface<br>方法 or 属性:(label: ResourceStr, options?: ButtonOptions): ButtonAttribute;<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonAttribute<br>起始版本:7|类名:ButtonAttribute<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonAttribute<br>方法 or 属性:type(value: ButtonType): ButtonAttribute;<br>起始版本:7|类名:ButtonAttribute<br>方法 or 属性:type(value: ButtonType): ButtonAttribute;<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonAttribute<br>方法 or 属性:stateEffect(value: boolean): ButtonAttribute;<br>起始版本:7|类名:ButtonAttribute<br>方法 or 属性:stateEffect(value: boolean): ButtonAttribute;<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonAttribute<br>方法 or 属性:fontColor(value: ResourceColor): ButtonAttribute;<br>起始版本:7|类名:ButtonAttribute<br>方法 or 属性:fontColor(value: ResourceColor): ButtonAttribute;<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonAttribute<br>方法 or 属性:fontSize(value: Length): ButtonAttribute;<br>起始版本:7|类名:ButtonAttribute<br>方法 or 属性:fontSize(value: Length): ButtonAttribute;<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonAttribute<br>方法 or 属性:fontWeight(value: number \| FontWeight \| string): ButtonAttribute;<br>起始版本:7|类名:ButtonAttribute<br>方法 or 属性:fontWeight(value: number \| FontWeight \| string): ButtonAttribute;<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonAttribute<br>方法 or 属性:fontStyle(value: FontStyle): ButtonAttribute;<br>起始版本:8|类名:ButtonAttribute<br>方法 or 属性:fontStyle(value: FontStyle): ButtonAttribute;<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonAttribute<br>方法 or 属性:fontFamily(value: string \| Resource): ButtonAttribute;<br>起始版本:8|类名:ButtonAttribute<br>方法 or 属性:fontFamily(value: string \| Resource): ButtonAttribute;<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Button: ButtonInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Button: ButtonInterface;<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ButtonInstance: ButtonAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ButtonInstance: ButtonAttribute;<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Calendar: CalendarInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Calendar: CalendarInterface;<br>起始版本:7|calendar.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const CalendarInstance: CalendarAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const CalendarInstance: CalendarAttribute;<br>起始版本:7|calendar.d.ts| +|起始版本有变化|类名:CanvasGradient<br>起始版本:8|类名:CanvasGradient<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasGradient<br>方法 or 属性:addColorStop(offset: number, color: string): void;<br>起始版本:8|类名:CanvasGradient<br>方法 or 属性:addColorStop(offset: number, color: string): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasPath<br>起始版本:8|类名:CanvasPath<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasPath<br>方法 or 属性:arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void;<br>起始版本:8|类名:CanvasPath<br>方法 or 属性:arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasPath<br>方法 or 属性:arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;<br>起始版本:8|类名:CanvasPath<br>方法 or 属性:arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasPath<br>方法 or 属性:bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void;<br>起始版本:8|类名:CanvasPath<br>方法 or 属性:bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasPath<br>方法 or 属性:closePath(): void;<br>起始版本:8|类名:CanvasPath<br>方法 or 属性:closePath(): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasPath<br>方法 or 属性:ellipse(<br> x: number,<br> y: number,<br> radiusX: number,<br> radiusY: number,<br> rotation: number,<br> startAngle: number,<br> endAngle: number,<br> counterclockwise?: boolean,<br> ): void;<br>起始版本:8|类名:CanvasPath<br>方法 or 属性:ellipse(<br> x: number,<br> y: number,<br> radiusX: number,<br> radiusY: number,<br> rotation: number,<br> startAngle: number,<br> endAngle: number,<br> counterclockwise?: boolean,<br> ): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasPath<br>方法 or 属性:lineTo(x: number, y: number): void;<br>起始版本:8|类名:CanvasPath<br>方法 or 属性:lineTo(x: number, y: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasPath<br>方法 or 属性:moveTo(x: number, y: number): void;<br>起始版本:8|类名:CanvasPath<br>方法 or 属性:moveTo(x: number, y: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasPath<br>方法 or 属性:quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;<br>起始版本:8|类名:CanvasPath<br>方法 or 属性:quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasPath<br>方法 or 属性:rect(x: number, y: number, w: number, h: number): void;<br>起始版本:8|类名:CanvasPath<br>方法 or 属性:rect(x: number, y: number, w: number, h: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:Path2D<br>起始版本:8|类名:Path2D<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:Path2D<br>方法 or 属性:addPath(path: Path2D, transform?: Matrix2D): void;<br>起始版本:8|类名:Path2D<br>方法 or 属性:addPath(path: Path2D, transform?: Matrix2D): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:Path2D<br>方法 or 属性:constructor();<br>起始版本:8|类名:Path2D<br>方法 or 属性:constructor();<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:Path2D<br>方法 or 属性:constructor(path: Path2D);<br>起始版本:8|类名:Path2D<br>方法 or 属性:constructor(path: Path2D);<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:Path2D<br>方法 or 属性:constructor(d: string);<br>起始版本:8|类名:Path2D<br>方法 or 属性:constructor(d: string);<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:TextMetrics<br>起始版本:8|类名:TextMetrics<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:TextMetrics<br>方法 or 属性:readonly actualBoundingBoxAscent: number;<br>起始版本:8|类名:TextMetrics<br>方法 or 属性:readonly actualBoundingBoxAscent: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:TextMetrics<br>方法 or 属性:readonly actualBoundingBoxDescent: number;<br>起始版本:8|类名:TextMetrics<br>方法 or 属性:readonly actualBoundingBoxDescent: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:TextMetrics<br>方法 or 属性:readonly actualBoundingBoxLeft: number;<br>起始版本:8|类名:TextMetrics<br>方法 or 属性:readonly actualBoundingBoxLeft: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:TextMetrics<br>方法 or 属性:readonly actualBoundingBoxRight: number;<br>起始版本:8|类名:TextMetrics<br>方法 or 属性:readonly actualBoundingBoxRight: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:TextMetrics<br>方法 or 属性:readonly alphabeticBaseline: number;<br>起始版本:8|类名:TextMetrics<br>方法 or 属性:readonly alphabeticBaseline: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:TextMetrics<br>方法 or 属性:readonly emHeightAscent: number;<br>起始版本:8|类名:TextMetrics<br>方法 or 属性:readonly emHeightAscent: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:TextMetrics<br>方法 or 属性:readonly emHeightDescent: number;<br>起始版本:8|类名:TextMetrics<br>方法 or 属性:readonly emHeightDescent: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:TextMetrics<br>方法 or 属性:readonly fontBoundingBoxAscent: number;<br>起始版本:8|类名:TextMetrics<br>方法 or 属性:readonly fontBoundingBoxAscent: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:TextMetrics<br>方法 or 属性:readonly fontBoundingBoxDescent: number;<br>起始版本:8|类名:TextMetrics<br>方法 or 属性:readonly fontBoundingBoxDescent: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:TextMetrics<br>方法 or 属性:readonly hangingBaseline: number;<br>起始版本:8|类名:TextMetrics<br>方法 or 属性:readonly hangingBaseline: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:TextMetrics<br>方法 or 属性:readonly ideographicBaseline: number;<br>起始版本:8|类名:TextMetrics<br>方法 or 属性:readonly ideographicBaseline: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:TextMetrics<br>方法 or 属性:readonly width: number;<br>起始版本:8|类名:TextMetrics<br>方法 or 属性:readonly width: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:TextMetrics<br>方法 or 属性:readonly height: number;<br>起始版本:8|类名:TextMetrics<br>方法 or 属性:readonly height: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:ImageBitmap<br>起始版本:8|类名:ImageBitmap<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:ImageBitmap<br>方法 or 属性:readonly height: number;<br>起始版本:8|类名:ImageBitmap<br>方法 or 属性:readonly height: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:ImageBitmap<br>方法 or 属性:readonly width: number;<br>起始版本:8|类名:ImageBitmap<br>方法 or 属性:readonly width: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:ImageBitmap<br>方法 or 属性:close(): void;<br>起始版本:8|类名:ImageBitmap<br>方法 or 属性:close(): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:ImageBitmap<br>方法 or 属性:constructor(src: string);<br>起始版本:8|类名:ImageBitmap<br>方法 or 属性:constructor(src: string);<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:ImageData<br>起始版本:8|类名:ImageData<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:ImageData<br>方法 or 属性:readonly data: Uint8ClampedArray;<br>起始版本:8|类名:ImageData<br>方法 or 属性:readonly data: Uint8ClampedArray;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:ImageData<br>方法 or 属性:readonly height: number;<br>起始版本:8|类名:ImageData<br>方法 or 属性:readonly height: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:ImageData<br>方法 or 属性:readonly width: number;<br>起始版本:8|类名:ImageData<br>方法 or 属性:readonly width: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:ImageData<br>方法 or 属性:constructor(width: number, height: number, data?: Uint8ClampedArray);<br>起始版本:8|类名:ImageData<br>方法 or 属性:constructor(width: number, height: number, data?: Uint8ClampedArray);<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:RenderingContextSettings<br>起始版本:8|类名:RenderingContextSettings<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:RenderingContextSettings<br>方法 or 属性:antialias?: boolean;<br>起始版本:8|类名:RenderingContextSettings<br>方法 or 属性:antialias?: boolean;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:RenderingContextSettings<br>方法 or 属性:constructor(antialias?: boolean);<br>起始版本:8|类名:RenderingContextSettings<br>方法 or 属性:constructor(antialias?: boolean);<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>起始版本:8|类名:CanvasRenderer<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:globalAlpha: number;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:globalAlpha: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:globalCompositeOperation: string;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:globalCompositeOperation: string;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:drawImage(image: ImageBitmap \| PixelMap, dx: number, dy: number): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:drawImage(image: ImageBitmap \| PixelMap, dx: number, dy: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:drawImage(image: ImageBitmap \| PixelMap, dx: number, dy: number, dw: number, dh: number): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:drawImage(image: ImageBitmap \| PixelMap, dx: number, dy: number, dw: number, dh: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:drawImage(<br> image: ImageBitmap \| PixelMap,<br> sx: number,<br> sy: number,<br> sw: number,<br> sh: number,<br> dx: number,<br> dy: number,<br> dw: number,<br> dh: number,<br> ): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:drawImage(<br> image: ImageBitmap \| PixelMap,<br> sx: number,<br> sy: number,<br> sw: number,<br> sh: number,<br> dx: number,<br> dy: number,<br> dw: number,<br> dh: number,<br> ): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:beginPath(): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:beginPath(): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:clip(fillRule?: CanvasFillRule): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:clip(fillRule?: CanvasFillRule): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:clip(path: Path2D, fillRule?: CanvasFillRule): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:clip(path: Path2D, fillRule?: CanvasFillRule): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:fill(fillRule?: CanvasFillRule): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:fill(fillRule?: CanvasFillRule): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:fill(path: Path2D, fillRule?: CanvasFillRule): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:fill(path: Path2D, fillRule?: CanvasFillRule): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:stroke(): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:stroke(): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:stroke(path: Path2D): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:stroke(path: Path2D): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:fillStyle: string \| CanvasGradient \| CanvasPattern;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:fillStyle: string \| CanvasGradient \| CanvasPattern;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:strokeStyle: string \| CanvasGradient \| CanvasPattern;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:strokeStyle: string \| CanvasGradient \| CanvasPattern;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:createPattern(image: ImageBitmap, repetition: string \| null): CanvasPattern \| null;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:createPattern(image: ImageBitmap, repetition: string \| null): CanvasPattern \| null;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:createImageData(sw: number, sh: number): ImageData;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:createImageData(sw: number, sh: number): ImageData;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:createImageData(imagedata: ImageData): ImageData;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:createImageData(imagedata: ImageData): ImageData;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:getImageData(sx: number, sy: number, sw: number, sh: number): ImageData;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:getImageData(sx: number, sy: number, sw: number, sh: number): ImageData;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:putImageData(imagedata: ImageData, dx: number, dy: number): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:putImageData(imagedata: ImageData, dx: number, dy: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:putImageData(<br> imagedata: ImageData,<br> dx: number,<br> dy: number,<br> dirtyX: number,<br> dirtyY: number,<br> dirtyWidth: number,<br> dirtyHeight: number,<br> ): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:putImageData(<br> imagedata: ImageData,<br> dx: number,<br> dy: number,<br> dirtyX: number,<br> dirtyY: number,<br> dirtyWidth: number,<br> dirtyHeight: number,<br> ): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:imageSmoothingEnabled: boolean;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:imageSmoothingEnabled: boolean;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:lineCap: CanvasLineCap;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:lineCap: CanvasLineCap;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:lineDashOffset: number;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:lineDashOffset: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:lineJoin: CanvasLineJoin;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:lineJoin: CanvasLineJoin;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:lineWidth: number;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:lineWidth: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:miterLimit: number;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:miterLimit: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:getLineDash(): number[];<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:getLineDash(): number[];<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:setLineDash(segments: number[]): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:setLineDash(segments: number[]): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:clearRect(x: number, y: number, w: number, h: number): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:clearRect(x: number, y: number, w: number, h: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:fillRect(x: number, y: number, w: number, h: number): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:fillRect(x: number, y: number, w: number, h: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:strokeRect(x: number, y: number, w: number, h: number): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:strokeRect(x: number, y: number, w: number, h: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:shadowBlur: number;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:shadowBlur: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:shadowColor: string;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:shadowColor: string;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:shadowOffsetX: number;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:shadowOffsetX: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:shadowOffsetY: number;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:shadowOffsetY: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:restore(): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:restore(): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:save(): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:save(): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:fillText(text: string, x: number, y: number, maxWidth?: number): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:fillText(text: string, x: number, y: number, maxWidth?: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:measureText(text: string): TextMetrics;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:measureText(text: string): TextMetrics;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:strokeText(text: string, x: number, y: number, maxWidth?: number): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:strokeText(text: string, x: number, y: number, maxWidth?: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:font: string;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:font: string;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:textAlign: CanvasTextAlign;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:textAlign: CanvasTextAlign;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:textBaseline: CanvasTextBaseline;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:textBaseline: CanvasTextBaseline;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:getTransform(): Matrix2D;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:getTransform(): Matrix2D;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:resetTransform(): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:resetTransform(): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:rotate(angle: number): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:rotate(angle: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:scale(x: number, y: number): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:scale(x: number, y: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:setTransform(a: number, b: number, c: number, d: number, e: number, f: number): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:setTransform(a: number, b: number, c: number, d: number, e: number, f: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:setTransform(transform?: Matrix2D): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:setTransform(transform?: Matrix2D): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:transform(a: number, b: number, c: number, d: number, e: number, f: number): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:transform(a: number, b: number, c: number, d: number, e: number, f: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:translate(x: number, y: number): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:translate(x: number, y: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:transferFromImageBitmap(bitmap: ImageBitmap): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:transferFromImageBitmap(bitmap: ImageBitmap): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderingContext2D<br>起始版本:8|类名:CanvasRenderingContext2D<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderingContext2D<br>方法 or 属性:readonly height: number;<br>起始版本:8|类名:CanvasRenderingContext2D<br>方法 or 属性:readonly height: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderingContext2D<br>方法 or 属性:readonly width: number;<br>起始版本:8|类名:CanvasRenderingContext2D<br>方法 or 属性:readonly width: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderingContext2D<br>方法 or 属性:toDataURL(type?: string, quality?: any): string;<br>起始版本:8|类名:CanvasRenderingContext2D<br>方法 or 属性:toDataURL(type?: string, quality?: any): string;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderingContext2D<br>方法 or 属性:constructor(settings?: RenderingContextSettings);<br>起始版本:8|类名:CanvasRenderingContext2D<br>方法 or 属性:constructor(settings?: RenderingContextSettings);<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:OffscreenCanvasRenderingContext2D<br>起始版本:8|类名:OffscreenCanvasRenderingContext2D<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:OffscreenCanvasRenderingContext2D<br>方法 or 属性:toDataURL(type?: string, quality?: any): string;<br>起始版本:8|类名:OffscreenCanvasRenderingContext2D<br>方法 or 属性:toDataURL(type?: string, quality?: any): string;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:OffscreenCanvasRenderingContext2D<br>方法 or 属性:transferToImageBitmap(): ImageBitmap;<br>起始版本:8|类名:OffscreenCanvasRenderingContext2D<br>方法 or 属性:transferToImageBitmap(): ImageBitmap;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:OffscreenCanvasRenderingContext2D<br>方法 or 属性:constructor(width: number, height: number, settings?: RenderingContextSettings);<br>起始版本:8|类名:OffscreenCanvasRenderingContext2D<br>方法 or 属性:constructor(width: number, height: number, settings?: RenderingContextSettings);<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:OffscreenCanvas<br>起始版本:8|类名:OffscreenCanvas<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:OffscreenCanvas<br>方法 or 属性:height: number;<br>起始版本:8|类名:OffscreenCanvas<br>方法 or 属性:height: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:OffscreenCanvas<br>方法 or 属性:width: number;<br>起始版本:8|类名:OffscreenCanvas<br>方法 or 属性:width: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:OffscreenCanvas<br>方法 or 属性:transferToImageBitmap(): ImageBitmap;<br>起始版本:8|类名:OffscreenCanvas<br>方法 or 属性:transferToImageBitmap(): ImageBitmap;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:OffscreenCanvas<br>方法 or 属性:constructor(width: number, height: number);<br>起始版本:8|类名:OffscreenCanvas<br>方法 or 属性:constructor(width: number, height: number);<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasInterface<br>起始版本:8|类名:CanvasInterface<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasInterface<br>方法 or 属性:(context?: CanvasRenderingContext2D): CanvasAttribute;<br>起始版本:8|类名:CanvasInterface<br>方法 or 属性:(context?: CanvasRenderingContext2D): CanvasAttribute;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasAttribute<br>方法 or 属性:onReady(event: () => void): CanvasAttribute;<br>起始版本:8|类名:CanvasAttribute<br>方法 or 属性:onReady(event: () => void): CanvasAttribute;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Canvas: CanvasInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Canvas: CanvasInterface;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const CanvasInstance: CanvasAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const CanvasInstance: CanvasAttribute;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CheckboxOptions<br>起始版本:8|类名:CheckboxOptions<br>起始版本:9|checkbox.d.ts| +|起始版本有变化|类名:CheckboxOptions<br>方法 or 属性:name?: string;<br>起始版本:8|类名:CheckboxOptions<br>方法 or 属性:name?: string;<br>起始版本:9|checkbox.d.ts| +|起始版本有变化|类名:CheckboxOptions<br>方法 or 属性:group?: string;<br>起始版本:8|类名:CheckboxOptions<br>方法 or 属性:group?: string;<br>起始版本:9|checkbox.d.ts| +|起始版本有变化|类名:CheckboxInterface<br>起始版本:8|类名:CheckboxInterface<br>起始版本:9|checkbox.d.ts| +|起始版本有变化|类名:CheckboxInterface<br>方法 or 属性:(options?: CheckboxOptions): CheckboxAttribute;<br>起始版本:8|类名:CheckboxInterface<br>方法 or 属性:(options?: CheckboxOptions): CheckboxAttribute;<br>起始版本:9|checkbox.d.ts| +|起始版本有变化|类名:CheckboxAttribute<br>起始版本:8|类名:CheckboxAttribute<br>起始版本:9|checkbox.d.ts| +|起始版本有变化|类名:CheckboxAttribute<br>方法 or 属性:select(value: boolean): CheckboxAttribute;<br>起始版本:8|类名:CheckboxAttribute<br>方法 or 属性:select(value: boolean): CheckboxAttribute;<br>起始版本:9|checkbox.d.ts| +|起始版本有变化|类名:CheckboxAttribute<br>方法 or 属性:selectedColor(value: ResourceColor): CheckboxAttribute;<br>起始版本:8|类名:CheckboxAttribute<br>方法 or 属性:selectedColor(value: ResourceColor): CheckboxAttribute;<br>起始版本:9|checkbox.d.ts| +|起始版本有变化|类名:CheckboxAttribute<br>方法 or 属性:onChange(callback: (value: boolean) => void): CheckboxAttribute;<br>起始版本:8|类名:CheckboxAttribute<br>方法 or 属性:onChange(callback: (value: boolean) => void): CheckboxAttribute;<br>起始版本:9|checkbox.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Checkbox: CheckboxInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Checkbox: CheckboxInterface;<br>起始版本:9|checkbox.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const CheckboxInstance: CheckboxAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const CheckboxInstance: CheckboxAttribute;<br>起始版本:9|checkbox.d.ts| +|起始版本有变化|类名:SelectStatus<br>起始版本:8|类名:SelectStatus<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:SelectStatus<br>方法 or 属性:All<br>起始版本:8|类名:SelectStatus<br>方法 or 属性:All<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:SelectStatus<br>方法 or 属性:Part<br>起始版本:8|类名:SelectStatus<br>方法 or 属性:Part<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:SelectStatus<br>方法 or 属性:None<br>起始版本:8|类名:SelectStatus<br>方法 or 属性:None<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:CheckboxGroupOptions<br>起始版本:8|类名:CheckboxGroupOptions<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:CheckboxGroupOptions<br>方法 or 属性:group?: string;<br>起始版本:8|类名:CheckboxGroupOptions<br>方法 or 属性:group?: string;<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:CheckboxGroupResult<br>起始版本:8|类名:CheckboxGroupResult<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:CheckboxGroupResult<br>方法 or 属性:name: Array\<string>;<br>起始版本:8|类名:CheckboxGroupResult<br>方法 or 属性:name: Array\<string>;<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:CheckboxGroupResult<br>方法 or 属性:status: SelectStatus;<br>起始版本:8|类名:CheckboxGroupResult<br>方法 or 属性:status: SelectStatus;<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:CheckboxGroupInterface<br>起始版本:8|类名:CheckboxGroupInterface<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:CheckboxGroupInterface<br>方法 or 属性:(options?: CheckboxGroupOptions): CheckboxGroupAttribute;<br>起始版本:8|类名:CheckboxGroupInterface<br>方法 or 属性:(options?: CheckboxGroupOptions): CheckboxGroupAttribute;<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:CheckboxGroupAttribute<br>起始版本:8|类名:CheckboxGroupAttribute<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:CheckboxGroupAttribute<br>方法 or 属性:selectAll(value: boolean): CheckboxGroupAttribute;<br>起始版本:8|类名:CheckboxGroupAttribute<br>方法 or 属性:selectAll(value: boolean): CheckboxGroupAttribute;<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:CheckboxGroupAttribute<br>方法 or 属性:selectedColor(value: ResourceColor): CheckboxGroupAttribute;<br>起始版本:8|类名:CheckboxGroupAttribute<br>方法 or 属性:selectedColor(value: ResourceColor): CheckboxGroupAttribute;<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:CheckboxGroupAttribute<br>方法 or 属性:onChange(callback: (event: CheckboxGroupResult) => void): CheckboxGroupAttribute;<br>起始版本:8|类名:CheckboxGroupAttribute<br>方法 or 属性:onChange(callback: (event: CheckboxGroupResult) => void): CheckboxGroupAttribute;<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const CheckboxGroup: CheckboxGroupInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const CheckboxGroup: CheckboxGroupInterface;<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const CheckboxGroupInstance: CheckboxGroupAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const CheckboxGroupInstance: CheckboxGroupAttribute;<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:CircleOptions<br>起始版本:7|类名:CircleOptions<br>起始版本:9|circle.d.ts| +|起始版本有变化|类名:CircleOptions<br>方法 or 属性:width?: string \| number;<br>起始版本:7|类名:CircleOptions<br>方法 or 属性:width?: string \| number;<br>起始版本:9|circle.d.ts| +|起始版本有变化|类名:CircleOptions<br>方法 or 属性:height?: string \| number;<br>起始版本:7|类名:CircleOptions<br>方法 or 属性:height?: string \| number;<br>起始版本:9|circle.d.ts| +|起始版本有变化|类名:CircleInterface<br>起始版本:7|类名:CircleInterface<br>起始版本:9|circle.d.ts| +|起始版本有变化|类名:CircleInterface<br>方法 or 属性:new (value?: CircleOptions): CircleAttribute;<br>起始版本:7|类名:CircleInterface<br>方法 or 属性:new (value?: CircleOptions): CircleAttribute;<br>起始版本:9|circle.d.ts| +|起始版本有变化|类名:CircleInterface<br>方法 or 属性:(value?: CircleOptions): CircleAttribute;<br>起始版本:7|类名:CircleInterface<br>方法 or 属性:(value?: CircleOptions): CircleAttribute;<br>起始版本:9|circle.d.ts| +|起始版本有变化|类名:CircleAttribute<br>起始版本:7|类名:CircleAttribute<br>起始版本:9|circle.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Circle: CircleInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Circle: CircleInterface;<br>起始版本:9|circle.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const CircleInstance: CircleAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const CircleInstance: CircleAttribute;<br>起始版本:9|circle.d.ts| +|起始版本有变化|类名:ColumnInterface<br>起始版本:7|类名:ColumnInterface<br>起始版本:9|column.d.ts| +|起始版本有变化|类名:ColumnInterface<br>方法 or 属性:(value?: { space?: string \| number }): ColumnAttribute;<br>起始版本:7|类名:ColumnInterface<br>方法 or 属性:(value?: { space?: string \| number }): ColumnAttribute;<br>起始版本:9|column.d.ts| +|起始版本有变化|类名:ColumnAttribute<br>起始版本:7|类名:ColumnAttribute<br>起始版本:9|column.d.ts| +|起始版本有变化|类名:ColumnAttribute<br>方法 or 属性:alignItems(value: HorizontalAlign): ColumnAttribute;<br>起始版本:7|类名:ColumnAttribute<br>方法 or 属性:alignItems(value: HorizontalAlign): ColumnAttribute;<br>起始版本:9|column.d.ts| +|起始版本有变化|类名:ColumnAttribute<br>方法 or 属性:justifyContent(value: FlexAlign): ColumnAttribute;<br>起始版本:8|类名:ColumnAttribute<br>方法 or 属性:justifyContent(value: FlexAlign): ColumnAttribute;<br>起始版本:9|column.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Column: ColumnInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Column: ColumnInterface;<br>起始版本:9|column.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ColumnInstance: ColumnAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ColumnInstance: ColumnAttribute;<br>起始版本:9|column.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ColumnSplitInstance: ColumnSplitAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ColumnSplitInstance: ColumnSplitAttribute;<br>起始版本:7|column_split.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ColumnSplit: ColumnSplitInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ColumnSplit: ColumnSplitInterface;<br>起始版本:7|column_split.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Component: ClassDecorator;<br>起始版本:7|类名:global<br>方法 or 属性:declare const Component: ClassDecorator;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Observed: ClassDecorator;<br>起始版本:7|类名:global<br>方法 or 属性:declare const Observed: ClassDecorator;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Preview: ClassDecorator & ((value: PreviewParams) => ClassDecorator);<br>起始版本:7|类名:global<br>方法 or 属性:declare const Preview: ClassDecorator & ((value: PreviewParams) => ClassDecorator);<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const BuilderParam: PropertyDecorator;<br>起始版本:7|类名:global<br>方法 or 属性:declare const BuilderParam: PropertyDecorator;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const State: PropertyDecorator;<br>起始版本:7|类名:global<br>方法 or 属性:declare const State: PropertyDecorator;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Prop: PropertyDecorator;<br>起始版本:7|类名:global<br>方法 or 属性:declare const Prop: PropertyDecorator;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Link: PropertyDecorator;<br>起始版本:7|类名:global<br>方法 or 属性:declare const Link: PropertyDecorator;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ObjectLink: PropertyDecorator;<br>起始版本:7|类名:global<br>方法 or 属性:declare const ObjectLink: PropertyDecorator;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Provide: PropertyDecorator & ((value: string) => PropertyDecorator);<br>起始版本:7|类名:global<br>方法 or 属性:declare const Provide: PropertyDecorator & ((value: string) => PropertyDecorator);<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Consume: PropertyDecorator & ((value: string) => PropertyDecorator);<br>起始版本:7|类名:global<br>方法 or 属性:declare const Consume: PropertyDecorator & ((value: string) => PropertyDecorator);<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Watch: (value: string) => PropertyDecorator;<br>起始版本:7|类名:global<br>方法 or 属性:declare const Watch: (value: string) => PropertyDecorator;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Builder: MethodDecorator;<br>起始版本:7|类名:global<br>方法 or 属性:declare const Builder: MethodDecorator;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Styles: MethodDecorator;<br>起始版本:8|类名:global<br>方法 or 属性:declare const Styles: MethodDecorator;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Extend: MethodDecorator & ((value: any) => MethodDecorator);<br>起始版本:7|类名:global<br>方法 or 属性:declare const Extend: MethodDecorator & ((value: any) => MethodDecorator);<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:Configuration<br>起始版本:7|类名:Configuration<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:Configuration<br>方法 or 属性:readonly colorMode: string;<br>起始版本:7|类名:Configuration<br>方法 or 属性:readonly colorMode: string;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:Configuration<br>方法 or 属性:readonly fontScale: number;<br>起始版本:7|类名:Configuration<br>方法 or 属性:readonly fontScale: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:Rectangle<br>起始版本:8|类名:Rectangle<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:Rectangle<br>方法 or 属性:x?: Length;<br>起始版本:8|类名:Rectangle<br>方法 or 属性:x?: Length;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:Rectangle<br>方法 or 属性:y?: Length;<br>起始版本:8|类名:Rectangle<br>方法 or 属性:y?: Length;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:Rectangle<br>方法 or 属性:width?: Length;<br>起始版本:8|类名:Rectangle<br>方法 or 属性:width?: Length;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:Rectangle<br>方法 or 属性:height?: Length;<br>起始版本:8|类名:Rectangle<br>方法 or 属性:height?: Length;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:<br>方法 or 属性:function $r(value: string, ...params: any[]): Resource;<br>起始版本:7|类名:<br>方法 or 属性:function $r(value: string, ...params: any[]): Resource;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:<br>方法 or 属性:function $rawfile(value: string): Resource;<br>起始版本:7|类名:<br>方法 or 属性:function $rawfile(value: string): Resource;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:AnimateParam<br>起始版本:7|类名:AnimateParam<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:AnimateParam<br>方法 or 属性:duration?: number;<br>起始版本:7|类名:AnimateParam<br>方法 or 属性:duration?: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:AnimateParam<br>方法 or 属性:playMode?: PlayMode;<br>起始版本:7|类名:AnimateParam<br>方法 or 属性:playMode?: PlayMode;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:AnimateParam<br>方法 or 属性:onFinish?: () => void;<br>起始版本:7|类名:AnimateParam<br>方法 or 属性:onFinish?: () => void;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:TranslateOptions<br>起始版本:7|类名:TranslateOptions<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:TranslateOptions<br>方法 or 属性:x?: number \| string;<br>起始版本:7|类名:TranslateOptions<br>方法 or 属性:x?: number \| string;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:TranslateOptions<br>方法 or 属性:y?: number \| string;<br>起始版本:7|类名:TranslateOptions<br>方法 or 属性:y?: number \| string;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:TranslateOptions<br>方法 or 属性:z?: number \| string;<br>起始版本:7|类名:TranslateOptions<br>方法 or 属性:z?: number \| string;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:ScaleOptions<br>起始版本:7|类名:ScaleOptions<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:ScaleOptions<br>方法 or 属性:x?: number;<br>起始版本:7|类名:ScaleOptions<br>方法 or 属性:x?: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:ScaleOptions<br>方法 or 属性:y?: number;<br>起始版本:7|类名:ScaleOptions<br>方法 or 属性:y?: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:ScaleOptions<br>方法 or 属性:z?: number;<br>起始版本:7|类名:ScaleOptions<br>方法 or 属性:z?: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:ScaleOptions<br>方法 or 属性:centerX?: number \| string;<br>起始版本:7|类名:ScaleOptions<br>方法 or 属性:centerX?: number \| string;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:ScaleOptions<br>方法 or 属性:centerY?: number \| string;<br>起始版本:7|类名:ScaleOptions<br>方法 or 属性:centerY?: number \| string;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:RotateOptions<br>方法 or 属性:x?: number;<br>起始版本:7|类名:RotateOptions<br>方法 or 属性:x?: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:RotateOptions<br>方法 or 属性:y?: number;<br>起始版本:7|类名:RotateOptions<br>方法 or 属性:y?: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:RotateOptions<br>方法 or 属性:z?: number;<br>起始版本:7|类名:RotateOptions<br>方法 or 属性:z?: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:RotateOptions<br>方法 or 属性:centerX?: number \| string;<br>起始版本:7|类名:RotateOptions<br>方法 or 属性:centerX?: number \| string;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:RotateOptions<br>方法 or 属性:centerY?: number \| string;<br>起始版本:7|类名:RotateOptions<br>方法 or 属性:centerY?: number \| string;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:RotateOptions<br>方法 or 属性:angle: number \| string;<br>起始版本:7|类名:RotateOptions<br>方法 or 属性:angle: number \| string;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:TransitionOptions<br>起始版本:7|类名:TransitionOptions<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:TransitionOptions<br>方法 or 属性:type?: TransitionType;<br>起始版本:7|类名:TransitionOptions<br>方法 or 属性:type?: TransitionType;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:TransitionOptions<br>方法 or 属性:opacity?: number;<br>起始版本:7|类名:TransitionOptions<br>方法 or 属性:opacity?: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:TransitionOptions<br>方法 or 属性:translate?: TranslateOptions;<br>起始版本:7|类名:TransitionOptions<br>方法 or 属性:translate?: TranslateOptions;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:TransitionOptions<br>方法 or 属性:scale?: ScaleOptions;<br>起始版本:7|类名:TransitionOptions<br>方法 or 属性:scale?: ScaleOptions;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:TransitionOptions<br>方法 or 属性:rotate?: RotateOptions;<br>起始版本:7|类名:TransitionOptions<br>方法 or 属性:rotate?: RotateOptions;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:<br>方法 or 属性:function animateTo(value: AnimateParam, event: () => void): void;<br>起始版本:7|类名:<br>方法 or 属性:function animateTo(value: AnimateParam, event: () => void): void;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:<br>方法 or 属性:function vp2px(value: number): number;<br>起始版本:7|类名:<br>方法 or 属性:function vp2px(value: number): number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:<br>方法 or 属性:function px2vp(value: number): number;<br>起始版本:7|类名:<br>方法 or 属性:function px2vp(value: number): number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:<br>方法 or 属性:function fp2px(value: number): number;<br>起始版本:7|类名:<br>方法 or 属性:function fp2px(value: number): number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:<br>方法 or 属性:function px2fp(value: number): number;<br>起始版本:7|类名:<br>方法 or 属性:function px2fp(value: number): number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:<br>方法 or 属性:function lpx2px(value: number): number;<br>起始版本:7|类名:<br>方法 or 属性:function lpx2px(value: number): number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:<br>方法 or 属性:function px2lpx(value: number): number;<br>起始版本:7|类名:<br>方法 or 属性:function px2lpx(value: number): number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:EventTarget<br>起始版本:8|类名:EventTarget<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:EventTarget<br>方法 or 属性:area: Area;<br>起始版本:8|类名:EventTarget<br>方法 or 属性:area: Area;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:BaseEvent<br>起始版本:8|类名:BaseEvent<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:BaseEvent<br>方法 or 属性:target: EventTarget;<br>起始版本:8|类名:BaseEvent<br>方法 or 属性:target: EventTarget;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:BaseEvent<br>方法 or 属性:timestamp: number;<br>起始版本:8|类名:BaseEvent<br>方法 or 属性:timestamp: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:BaseEvent<br>方法 or 属性:source: SourceType;<br>起始版本:8|类名:BaseEvent<br>方法 or 属性:source: SourceType;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:ClickEvent<br>起始版本:7|类名:ClickEvent<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:ClickEvent<br>方法 or 属性:screenX: number;<br>起始版本:7|类名:ClickEvent<br>方法 or 属性:screenX: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:ClickEvent<br>方法 or 属性:screenY: number;<br>起始版本:7|类名:ClickEvent<br>方法 or 属性:screenY: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:ClickEvent<br>方法 or 属性:x: number;<br>起始版本:7|类名:ClickEvent<br>方法 or 属性:x: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:ClickEvent<br>方法 or 属性:y: number;<br>起始版本:7|类名:ClickEvent<br>方法 or 属性:y: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:StateStyles<br>起始版本:8|类名:StateStyles<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:StateStyles<br>方法 or 属性:normal?: any;<br>起始版本:8|类名:StateStyles<br>方法 or 属性:normal?: any;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:StateStyles<br>方法 or 属性:pressed?: any;<br>起始版本:8|类名:StateStyles<br>方法 or 属性:pressed?: any;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:StateStyles<br>方法 or 属性:disabled?: any;<br>起始版本:8|类名:StateStyles<br>方法 or 属性:disabled?: any;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:StateStyles<br>方法 or 属性:focused?: any;<br>起始版本:8|类名:StateStyles<br>方法 or 属性:focused?: any;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:StateStyles<br>方法 or 属性:clicked?: any;<br>起始版本:8|类名:StateStyles<br>方法 or 属性:clicked?: any;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>起始版本:7|类名:CommonMethod<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:constructor();<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:constructor();<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:width(value: Length): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:width(value: Length): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:height(value: Length): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:height(value: Length): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:responseRegion(value: Array\<Rectangle> \| Rectangle): T;<br>起始版本:8|类名:CommonMethod<br>方法 or 属性:responseRegion(value: Array\<Rectangle> \| Rectangle): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:size(value: SizeOptions): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:size(value: SizeOptions): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:constraintSize(value: ConstraintSizeOptions): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:constraintSize(value: ConstraintSizeOptions): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:layoutWeight(value: number \| string): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:layoutWeight(value: number \| string): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:padding(value: Padding \| Length): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:padding(value: Padding \| Length): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:margin(value: Margin \| Length): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:margin(value: Margin \| Length): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:backgroundColor(value: ResourceColor): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:backgroundColor(value: ResourceColor): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:backgroundImage(src: ResourceStr, repeat?: ImageRepeat): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:backgroundImage(src: ResourceStr, repeat?: ImageRepeat): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:backgroundImageSize(value: SizeOptions \| ImageSize): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:backgroundImageSize(value: SizeOptions \| ImageSize): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:backgroundImagePosition(value: Position \| Alignment): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:backgroundImagePosition(value: Position \| Alignment): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:opacity(value: number \| Resource): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:opacity(value: number \| Resource): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:border(value: BorderOptions): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:border(value: BorderOptions): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:borderStyle(value: BorderStyle): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:borderStyle(value: BorderStyle): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:borderWidth(value: Length): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:borderWidth(value: Length): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:borderColor(value: ResourceColor): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:borderColor(value: ResourceColor): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:borderRadius(value: Length): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:borderRadius(value: Length): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:onClick(event: (event?: ClickEvent) => void): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:onClick(event: (event?: ClickEvent) => void): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:animation(value: AnimateParam): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:animation(value: AnimateParam): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:transition(value: TransitionOptions): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:transition(value: TransitionOptions): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:blur(value: number): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:blur(value: number): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:brightness(value: number): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:brightness(value: number): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:contrast(value: number): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:contrast(value: number): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:grayscale(value: number): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:grayscale(value: number): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:colorBlend(value: Color \| string \| Resource): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:colorBlend(value: Color \| string \| Resource): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:saturate(value: number): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:saturate(value: number): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:sepia(value: number): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:sepia(value: number): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:invert(value: number): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:invert(value: number): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:hueRotate(value: number \| string): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:hueRotate(value: number \| string): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:backdropBlur(value: number): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:backdropBlur(value: number): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:translate(value: TranslateOptions): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:translate(value: TranslateOptions): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:scale(value: ScaleOptions): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:scale(value: ScaleOptions): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:rotate(value: RotateOptions): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:rotate(value: RotateOptions): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:onAppear(event: () => void): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:onAppear(event: () => void): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:onDisAppear(event: () => void): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:onDisAppear(event: () => void): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:visibility(value: Visibility): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:visibility(value: Visibility): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:flexGrow(value: number): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:flexGrow(value: number): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:flexShrink(value: number): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:flexShrink(value: number): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:flexBasis(value: number \| string): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:flexBasis(value: number \| string): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:alignSelf(value: ItemAlign): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:alignSelf(value: ItemAlign): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:displayPriority(value: number): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:displayPriority(value: number): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:zIndex(value: number): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:zIndex(value: number): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:direction(value: Direction): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:direction(value: Direction): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:align(value: Alignment): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:align(value: Alignment): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:position(value: Position): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:position(value: Position): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:markAnchor(value: Position): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:markAnchor(value: Position): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:offset(value: Position): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:offset(value: Position): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:enabled(value: boolean): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:enabled(value: boolean): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:aspectRatio(value: number): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:aspectRatio(value: number): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:overlay(value: string, options?: { align?: Alignment; offset?: { x?: number; y?: number } }): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:overlay(value: string, options?: { align?: Alignment; offset?: { x?: number; y?: number } }): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:linearGradient(value: {<br> angle?: number \| string;<br> direction?: GradientDirection;<br> colors: Array\<any>;<br> repeating?: boolean;<br> }): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:linearGradient(value: {<br> angle?: number \| string;<br> direction?: GradientDirection;<br> colors: Array\<any>;<br> repeating?: boolean;<br> }): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:sweepGradient(value: {<br> center: Array\<any>;<br> start?: number \| string;<br> end?: number \| string;<br> rotation?: number \| string;<br> colors: Array\<any>;<br> repeating?: boolean;<br> }): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:sweepGradient(value: {<br> center: Array\<any>;<br> start?: number \| string;<br> end?: number \| string;<br> rotation?: number \| string;<br> colors: Array\<any>;<br> repeating?: boolean;<br> }): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:radialGradient(value: { center: Array\<any>; radius: number \| string; colors: Array\<any>; repeating?: boolean }): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:radialGradient(value: { center: Array\<any>; radius: number \| string; colors: Array\<any>; repeating?: boolean }): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:shadow(value: {<br> radius: number \| Resource;<br> color?: Color \| string \| Resource;<br> offsetX?: number \| Resource;<br> offsetY?: number \| Resource;<br> }): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:shadow(value: {<br> radius: number \| Resource;<br> color?: Color \| string \| Resource;<br> offsetX?: number \| Resource;<br> offsetY?: number \| Resource;<br> }): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:clip(value: boolean \| CircleAttribute \| EllipseAttribute \| PathAttribute \| RectAttribute): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:clip(value: boolean \| CircleAttribute \| EllipseAttribute \| PathAttribute \| RectAttribute): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:mask(value: CircleAttribute \| EllipseAttribute \| PathAttribute \| RectAttribute): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:mask(value: CircleAttribute \| EllipseAttribute \| PathAttribute \| RectAttribute): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:id(value: string): T;<br>起始版本:8|类名:CommonMethod<br>方法 or 属性:id(value: string): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:stateStyles(value: StateStyles): T;<br>起始版本:8|类名:CommonMethod<br>方法 or 属性:stateStyles(value: StateStyles): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonAttribute<br>起始版本:7|类名:CommonAttribute<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonInterface<br>起始版本:7|类名:CommonInterface<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const CommonInstance: CommonAttribute;<br>起始版本:7|类名:global<br>方法 or 属性:declare const CommonInstance: CommonAttribute;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Common: CommonInterface;<br>起始版本:7|类名:global<br>方法 or 属性:declare const Common: CommonInterface;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonShapeMethod<br>起始版本:7|类名:CommonShapeMethod<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonShapeMethod<br>方法 or 属性:constructor();<br>起始版本:7|类名:CommonShapeMethod<br>方法 or 属性:constructor();<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonShapeMethod<br>方法 or 属性:stroke(value: ResourceColor): T;<br>起始版本:7|类名:CommonShapeMethod<br>方法 or 属性:stroke(value: ResourceColor): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonShapeMethod<br>方法 or 属性:fill(value: ResourceColor): T;<br>起始版本:7|类名:CommonShapeMethod<br>方法 or 属性:fill(value: ResourceColor): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonShapeMethod<br>方法 or 属性:strokeDashOffset(value: number \| string): T;<br>起始版本:7|类名:CommonShapeMethod<br>方法 or 属性:strokeDashOffset(value: number \| string): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonShapeMethod<br>方法 or 属性:strokeLineCap(value: LineCapStyle): T;<br>起始版本:7|类名:CommonShapeMethod<br>方法 or 属性:strokeLineCap(value: LineCapStyle): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonShapeMethod<br>方法 or 属性:strokeLineJoin(value: LineJoinStyle): T;<br>起始版本:7|类名:CommonShapeMethod<br>方法 or 属性:strokeLineJoin(value: LineJoinStyle): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonShapeMethod<br>方法 or 属性:strokeMiterLimit(value: number \| string): T;<br>起始版本:7|类名:CommonShapeMethod<br>方法 or 属性:strokeMiterLimit(value: number \| string): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonShapeMethod<br>方法 or 属性:strokeOpacity(value: number \| string \| Resource): T;<br>起始版本:7|类名:CommonShapeMethod<br>方法 or 属性:strokeOpacity(value: number \| string \| Resource): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonShapeMethod<br>方法 or 属性:fillOpacity(value: number \| string \| Resource): T;<br>起始版本:7|类名:CommonShapeMethod<br>方法 or 属性:fillOpacity(value: number \| string \| Resource): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonShapeMethod<br>方法 or 属性:strokeWidth(value: Length): T;<br>起始版本:7|类名:CommonShapeMethod<br>方法 or 属性:strokeWidth(value: Length): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonShapeMethod<br>方法 or 属性:antiAlias(value: boolean): T;<br>起始版本:7|类名:CommonShapeMethod<br>方法 or 属性:antiAlias(value: boolean): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonShapeMethod<br>方法 or 属性:strokeDashArray(value: Array\<any>): T;<br>起始版本:7|类名:CommonShapeMethod<br>方法 or 属性:strokeDashArray(value: Array\<any>): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CustomComponent<br>方法 or 属性:build(): void;<br>起始版本:7|类名:CustomComponent<br>方法 or 属性:build(): void;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CustomComponent<br>方法 or 属性:aboutToAppear?(): void;<br>起始版本:7|类名:CustomComponent<br>方法 or 属性:aboutToAppear?(): void;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CustomComponent<br>方法 or 属性:aboutToDisappear?(): void;<br>起始版本:7|类名:CustomComponent<br>方法 or 属性:aboutToDisappear?(): void;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:View<br>起始版本:7|类名:View<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CounterInterface<br>起始版本:7|类名:CounterInterface<br>起始版本:9|counter.d.ts| +|起始版本有变化|类名:CounterInterface<br>方法 or 属性:(): CounterAttribute;<br>起始版本:7|类名:CounterInterface<br>方法 or 属性:(): CounterAttribute;<br>起始版本:9|counter.d.ts| +|起始版本有变化|类名:CounterAttribute<br>起始版本:7|类名:CounterAttribute<br>起始版本:9|counter.d.ts| +|起始版本有变化|类名:CounterAttribute<br>方法 or 属性:onInc(event: () => void): CounterAttribute;<br>起始版本:7|类名:CounterAttribute<br>方法 or 属性:onInc(event: () => void): CounterAttribute;<br>起始版本:9|counter.d.ts| +|起始版本有变化|类名:CounterAttribute<br>方法 or 属性:onDec(event: () => void): CounterAttribute;<br>起始版本:7|类名:CounterAttribute<br>方法 or 属性:onDec(event: () => void): CounterAttribute;<br>起始版本:9|counter.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const CounterInstance: CounterAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const CounterInstance: CounterAttribute;<br>起始版本:9|counter.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Counter: CounterInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Counter: CounterInterface;<br>起始版本:9|counter.d.ts| +|起始版本有变化|类名:DataPanelType<br>起始版本:8|类名:DataPanelType<br>起始版本:9|data_panel.d.ts| +|起始版本有变化|类名:DataPanelType<br>方法 or 属性:Line<br>起始版本:8|类名:DataPanelType<br>方法 or 属性:Line<br>起始版本:9|data_panel.d.ts| +|起始版本有变化|类名:DataPanelType<br>方法 or 属性:Circle<br>起始版本:8|类名:DataPanelType<br>方法 or 属性:Circle<br>起始版本:9|data_panel.d.ts| +|起始版本有变化|类名:DataPanelOptions<br>起始版本:7|类名:DataPanelOptions<br>起始版本:9|data_panel.d.ts| +|起始版本有变化|类名:DataPanelOptions<br>方法 or 属性:values: number[];<br>起始版本:7|类名:DataPanelOptions<br>方法 or 属性:values: number[];<br>起始版本:9|data_panel.d.ts| +|起始版本有变化|类名:DataPanelOptions<br>方法 or 属性:max?: number;<br>起始版本:7|类名:DataPanelOptions<br>方法 or 属性:max?: number;<br>起始版本:9|data_panel.d.ts| +|起始版本有变化|类名:DataPanelOptions<br>方法 or 属性:type?: DataPanelType;<br>起始版本:8|类名:DataPanelOptions<br>方法 or 属性:type?: DataPanelType;<br>起始版本:9|data_panel.d.ts| +|起始版本有变化|类名:DataPanelInterface<br>起始版本:7|类名:DataPanelInterface<br>起始版本:9|data_panel.d.ts| +|起始版本有变化|类名:DataPanelInterface<br>方法 or 属性:(options: DataPanelOptions): DataPanelAttribute;<br>起始版本:7|类名:DataPanelInterface<br>方法 or 属性:(options: DataPanelOptions): DataPanelAttribute;<br>起始版本:9|data_panel.d.ts| +|起始版本有变化|类名:DataPanelAttribute<br>起始版本:7|类名:DataPanelAttribute<br>起始版本:9|data_panel.d.ts| +|起始版本有变化|类名:DataPanelAttribute<br>方法 or 属性:closeEffect(value: boolean): DataPanelAttribute;<br>起始版本:7|类名:DataPanelAttribute<br>方法 or 属性:closeEffect(value: boolean): DataPanelAttribute;<br>起始版本:9|data_panel.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const DataPanel: DataPanelInterface<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const DataPanel: DataPanelInterface<br>起始版本:9|data_panel.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const DataPanelInstance: DataPanelAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const DataPanelInstance: DataPanelAttribute;<br>起始版本:9|data_panel.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const DatePicker: DatePickerInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const DatePicker: DatePickerInterface;<br>起始版本:8|date_picker.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const DatePickerInstance: DatePickerAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const DatePickerInstance: DatePickerAttribute;<br>起始版本:8|date_picker.d.ts| +|起始版本有变化|类名:DividerInterface<br>起始版本:7|类名:DividerInterface<br>起始版本:9|divider.d.ts| +|起始版本有变化|类名:DividerInterface<br>方法 or 属性:(): DividerAttribute;<br>起始版本:7|类名:DividerInterface<br>方法 or 属性:(): DividerAttribute;<br>起始版本:9|divider.d.ts| +|起始版本有变化|类名:DividerAttribute<br>起始版本:7|类名:DividerAttribute<br>起始版本:9|divider.d.ts| +|起始版本有变化|类名:DividerAttribute<br>方法 or 属性:vertical(value: boolean): DividerAttribute;<br>起始版本:7|类名:DividerAttribute<br>方法 or 属性:vertical(value: boolean): DividerAttribute;<br>起始版本:9|divider.d.ts| +|起始版本有变化|类名:DividerAttribute<br>方法 or 属性:color(value: ResourceColor): DividerAttribute;<br>起始版本:7|类名:DividerAttribute<br>方法 or 属性:color(value: ResourceColor): DividerAttribute;<br>起始版本:9|divider.d.ts| +|起始版本有变化|类名:DividerAttribute<br>方法 or 属性:strokeWidth(value: number \| string): DividerAttribute;<br>起始版本:7|类名:DividerAttribute<br>方法 or 属性:strokeWidth(value: number \| string): DividerAttribute;<br>起始版本:9|divider.d.ts| +|起始版本有变化|类名:DividerAttribute<br>方法 or 属性:lineCap(value: LineCapStyle): DividerAttribute;<br>起始版本:7|类名:DividerAttribute<br>方法 or 属性:lineCap(value: LineCapStyle): DividerAttribute;<br>起始版本:9|divider.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Divider: DividerInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Divider: DividerInterface;<br>起始版本:9|divider.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const DividerInstance: DividerAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const DividerInstance: DividerAttribute;<br>起始版本:9|divider.d.ts| +|起始版本有变化|类名:EllipseInterface<br>起始版本:7|类名:EllipseInterface<br>起始版本:9|ellipse.d.ts| +|起始版本有变化|类名:EllipseInterface<br>方法 or 属性:new (value?: { width?: string \| number; height?: string \| number }): EllipseAttribute;<br>起始版本:7|类名:EllipseInterface<br>方法 or 属性:new (value?: { width?: string \| number; height?: string \| number }): EllipseAttribute;<br>起始版本:9|ellipse.d.ts| +|起始版本有变化|类名:EllipseInterface<br>方法 or 属性:(value?: { width?: string \| number; height?: string \| number }): EllipseAttribute;<br>起始版本:7|类名:EllipseInterface<br>方法 or 属性:(value?: { width?: string \| number; height?: string \| number }): EllipseAttribute;<br>起始版本:9|ellipse.d.ts| +|起始版本有变化|类名:EllipseAttribute<br>起始版本:7|类名:EllipseAttribute<br>起始版本:9|ellipse.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Ellipse: EllipseInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Ellipse: EllipseInterface;<br>起始版本:9|ellipse.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const EllipseInstance: EllipseAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const EllipseInstance: EllipseAttribute;<br>起始版本:9|ellipse.d.ts| +|起始版本有变化|类名:Color<br>起始版本:7|类名:Color<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Color<br>方法 or 属性:White<br>起始版本:7|类名:Color<br>方法 or 属性:White<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Color<br>方法 or 属性:Black<br>起始版本:7|类名:Color<br>方法 or 属性:Black<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Color<br>方法 or 属性:Blue<br>起始版本:7|类名:Color<br>方法 or 属性:Blue<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Color<br>方法 or 属性:Brown<br>起始版本:7|类名:Color<br>方法 or 属性:Brown<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Color<br>方法 or 属性:Gray<br>起始版本:7|类名:Color<br>方法 or 属性:Gray<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Color<br>方法 or 属性:Green<br>起始版本:7|类名:Color<br>方法 or 属性:Green<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Color<br>方法 or 属性:Grey<br>起始版本:7|类名:Color<br>方法 or 属性:Grey<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Color<br>方法 or 属性:Orange<br>起始版本:7|类名:Color<br>方法 or 属性:Orange<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Color<br>方法 or 属性:Pink<br>起始版本:7|类名:Color<br>方法 or 属性:Pink<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Color<br>方法 or 属性:Red<br>起始版本:7|类名:Color<br>方法 or 属性:Red<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Color<br>方法 or 属性:Yellow<br>起始版本:7|类名:Color<br>方法 or 属性:Yellow<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageFit<br>起始版本:7|类名:ImageFit<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageFit<br>方法 or 属性:Contain<br>起始版本:7|类名:ImageFit<br>方法 or 属性:Contain<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageFit<br>方法 or 属性:Cover<br>起始版本:7|类名:ImageFit<br>方法 or 属性:Cover<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageFit<br>方法 or 属性:Auto<br>起始版本:7|类名:ImageFit<br>方法 or 属性:Auto<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageFit<br>方法 or 属性:Fill<br>起始版本:7|类名:ImageFit<br>方法 or 属性:Fill<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageFit<br>方法 or 属性:ScaleDown<br>起始版本:7|类名:ImageFit<br>方法 or 属性:ScaleDown<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageFit<br>方法 or 属性:None<br>起始版本:7|类名:ImageFit<br>方法 or 属性:None<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:BorderStyle<br>起始版本:7|类名:BorderStyle<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:BorderStyle<br>方法 or 属性:Dotted<br>起始版本:7|类名:BorderStyle<br>方法 or 属性:Dotted<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:BorderStyle<br>方法 or 属性:Dashed<br>起始版本:7|类名:BorderStyle<br>方法 or 属性:Dashed<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:BorderStyle<br>方法 or 属性:Solid<br>起始版本:7|类名:BorderStyle<br>方法 or 属性:Solid<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:LineJoinStyle<br>起始版本:7|类名:LineJoinStyle<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:LineJoinStyle<br>方法 or 属性:Miter<br>起始版本:7|类名:LineJoinStyle<br>方法 or 属性:Miter<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:LineJoinStyle<br>方法 or 属性:Round<br>起始版本:7|类名:LineJoinStyle<br>方法 or 属性:Round<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:LineJoinStyle<br>方法 or 属性:Bevel<br>起始版本:7|类名:LineJoinStyle<br>方法 or 属性:Bevel<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TouchType<br>起始版本:7|类名:TouchType<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TouchType<br>方法 or 属性:Down<br>起始版本:7|类名:TouchType<br>方法 or 属性:Down<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TouchType<br>方法 or 属性:Up<br>起始版本:7|类名:TouchType<br>方法 or 属性:Up<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TouchType<br>方法 or 属性:Move<br>起始版本:7|类名:TouchType<br>方法 or 属性:Move<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TouchType<br>方法 or 属性:Cancel<br>起始版本:7|类名:TouchType<br>方法 or 属性:Cancel<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:MouseButton<br>起始版本:8|类名:MouseButton<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:MouseButton<br>方法 or 属性:Left<br>起始版本:8|类名:MouseButton<br>方法 or 属性:Left<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:MouseButton<br>方法 or 属性:Right<br>起始版本:8|类名:MouseButton<br>方法 or 属性:Right<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:MouseButton<br>方法 or 属性:Middle<br>起始版本:8|类名:MouseButton<br>方法 or 属性:Middle<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:MouseButton<br>方法 or 属性:Back<br>起始版本:8|类名:MouseButton<br>方法 or 属性:Back<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:MouseButton<br>方法 or 属性:Forward<br>起始版本:8|类名:MouseButton<br>方法 or 属性:Forward<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:MouseButton<br>方法 or 属性:None<br>起始版本:8|类名:MouseButton<br>方法 or 属性:None<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:MouseAction<br>起始版本:8|类名:MouseAction<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:MouseAction<br>方法 or 属性:Press<br>起始版本:8|类名:MouseAction<br>方法 or 属性:Press<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:MouseAction<br>方法 or 属性:Release<br>起始版本:8|类名:MouseAction<br>方法 or 属性:Release<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:MouseAction<br>方法 or 属性:Move<br>起始版本:8|类名:MouseAction<br>方法 or 属性:Move<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:MouseAction<br>方法 or 属性:Hover<br>起始版本:8|类名:MouseAction<br>方法 or 属性:Hover<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:AnimationStatus<br>起始版本:7|类名:AnimationStatus<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:AnimationStatus<br>方法 or 属性:Initial<br>起始版本:7|类名:AnimationStatus<br>方法 or 属性:Initial<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:AnimationStatus<br>方法 or 属性:Running<br>起始版本:7|类名:AnimationStatus<br>方法 or 属性:Running<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:AnimationStatus<br>方法 or 属性:Paused<br>起始版本:7|类名:AnimationStatus<br>方法 or 属性:Paused<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:AnimationStatus<br>方法 or 属性:Stopped<br>起始版本:7|类名:AnimationStatus<br>方法 or 属性:Stopped<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Curve<br>起始版本:7|类名:Curve<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Curve<br>方法 or 属性:Linear<br>起始版本:7|类名:Curve<br>方法 or 属性:Linear<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Curve<br>方法 or 属性:Ease<br>起始版本:7|类名:Curve<br>方法 or 属性:Ease<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Curve<br>方法 or 属性:EaseIn<br>起始版本:7|类名:Curve<br>方法 or 属性:EaseIn<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Curve<br>方法 or 属性:EaseOut<br>起始版本:7|类名:Curve<br>方法 or 属性:EaseOut<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Curve<br>方法 or 属性:EaseInOut<br>起始版本:7|类名:Curve<br>方法 or 属性:EaseInOut<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Curve<br>方法 or 属性:FastOutSlowIn<br>起始版本:7|类名:Curve<br>方法 or 属性:FastOutSlowIn<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Curve<br>方法 or 属性:LinearOutSlowIn<br>起始版本:7|类名:Curve<br>方法 or 属性:LinearOutSlowIn<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Curve<br>方法 or 属性:FastOutLinearIn<br>起始版本:7|类名:Curve<br>方法 or 属性:FastOutLinearIn<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Curve<br>方法 or 属性:ExtremeDeceleration<br>起始版本:7|类名:Curve<br>方法 or 属性:ExtremeDeceleration<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Curve<br>方法 or 属性:Sharp<br>起始版本:7|类名:Curve<br>方法 or 属性:Sharp<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Curve<br>方法 or 属性:Rhythm<br>起始版本:7|类名:Curve<br>方法 or 属性:Rhythm<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Curve<br>方法 or 属性:Smooth<br>起始版本:7|类名:Curve<br>方法 or 属性:Smooth<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Curve<br>方法 or 属性:Friction<br>起始版本:7|类名:Curve<br>方法 or 属性:Friction<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FillMode<br>起始版本:7|类名:FillMode<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FillMode<br>方法 or 属性:None<br>起始版本:7|类名:FillMode<br>方法 or 属性:None<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FillMode<br>方法 or 属性:Forwards<br>起始版本:7|类名:FillMode<br>方法 or 属性:Forwards<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FillMode<br>方法 or 属性:Backwards<br>起始版本:7|类名:FillMode<br>方法 or 属性:Backwards<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FillMode<br>方法 or 属性:Both<br>起始版本:7|类名:FillMode<br>方法 or 属性:Both<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:PlayMode<br>起始版本:7|类名:PlayMode<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:PlayMode<br>方法 or 属性:Normal<br>起始版本:7|类名:PlayMode<br>方法 or 属性:Normal<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:PlayMode<br>方法 or 属性:Reverse<br>起始版本:7|类名:PlayMode<br>方法 or 属性:Reverse<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:PlayMode<br>方法 or 属性:Alternate<br>起始版本:7|类名:PlayMode<br>方法 or 属性:Alternate<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:PlayMode<br>方法 or 属性:AlternateReverse<br>起始版本:7|类名:PlayMode<br>方法 or 属性:AlternateReverse<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:KeyType<br>起始版本:7|类名:KeyType<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:KeyType<br>方法 or 属性:Down<br>起始版本:7|类名:KeyType<br>方法 or 属性:Down<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:KeyType<br>方法 or 属性:Up<br>起始版本:7|类名:KeyType<br>方法 or 属性:Up<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:KeySource<br>起始版本:7|类名:KeySource<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:KeySource<br>方法 or 属性:Unknown<br>起始版本:7|类名:KeySource<br>方法 or 属性:Unknown<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:KeySource<br>方法 or 属性:Keyboard<br>起始版本:7|类名:KeySource<br>方法 or 属性:Keyboard<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Edge<br>起始版本:7|类名:Edge<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Edge<br>方法 or 属性:Top<br>起始版本:7|类名:Edge<br>方法 or 属性:Top<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Edge<br>方法 or 属性:Bottom<br>起始版本:7|类名:Edge<br>方法 or 属性:Bottom<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Edge<br>方法 or 属性:Start<br>起始版本:7|类名:Edge<br>方法 or 属性:Start<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Edge<br>方法 or 属性:End<br>起始版本:7|类名:Edge<br>方法 or 属性:End<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Week<br>起始版本:7|类名:Week<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Week<br>方法 or 属性:Mon<br>起始版本:7|类名:Week<br>方法 or 属性:Mon<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Week<br>方法 or 属性:Tue<br>起始版本:7|类名:Week<br>方法 or 属性:Tue<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Week<br>方法 or 属性:Wed<br>起始版本:7|类名:Week<br>方法 or 属性:Wed<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Week<br>方法 or 属性:Thur<br>起始版本:7|类名:Week<br>方法 or 属性:Thur<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Week<br>方法 or 属性:Fri<br>起始版本:7|类名:Week<br>方法 or 属性:Fri<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Week<br>方法 or 属性:Sat<br>起始版本:7|类名:Week<br>方法 or 属性:Sat<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Week<br>方法 or 属性:Sun<br>起始版本:7|类名:Week<br>方法 or 属性:Sun<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Direction<br>起始版本:7|类名:Direction<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Direction<br>方法 or 属性:Ltr<br>起始版本:7|类名:Direction<br>方法 or 属性:Ltr<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Direction<br>方法 or 属性:Rtl<br>起始版本:7|类名:Direction<br>方法 or 属性:Rtl<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Direction<br>方法 or 属性:Auto<br>起始版本:7|类名:Direction<br>方法 or 属性:Auto<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:BarState<br>起始版本:7|类名:BarState<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:BarState<br>方法 or 属性:Off<br>起始版本:7|类名:BarState<br>方法 or 属性:Off<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:BarState<br>方法 or 属性:Auto<br>起始版本:7|类名:BarState<br>方法 or 属性:Auto<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:BarState<br>方法 or 属性:On<br>起始版本:7|类名:BarState<br>方法 or 属性:On<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:EdgeEffect<br>起始版本:7|类名:EdgeEffect<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:EdgeEffect<br>方法 or 属性:Spring<br>起始版本:7|类名:EdgeEffect<br>方法 or 属性:Spring<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:EdgeEffect<br>方法 or 属性:Fade<br>起始版本:7|类名:EdgeEffect<br>方法 or 属性:Fade<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:EdgeEffect<br>方法 or 属性:None<br>起始版本:7|类名:EdgeEffect<br>方法 or 属性:None<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Alignment<br>起始版本:7|类名:Alignment<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Alignment<br>方法 or 属性:TopStart<br>起始版本:7|类名:Alignment<br>方法 or 属性:TopStart<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Alignment<br>方法 or 属性:Top<br>起始版本:7|类名:Alignment<br>方法 or 属性:Top<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Alignment<br>方法 or 属性:TopEnd<br>起始版本:7|类名:Alignment<br>方法 or 属性:TopEnd<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Alignment<br>方法 or 属性:Start<br>起始版本:7|类名:Alignment<br>方法 or 属性:Start<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Alignment<br>方法 or 属性:Center<br>起始版本:7|类名:Alignment<br>方法 or 属性:Center<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Alignment<br>方法 or 属性:End<br>起始版本:7|类名:Alignment<br>方法 or 属性:End<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Alignment<br>方法 or 属性:BottomStart<br>起始版本:7|类名:Alignment<br>方法 or 属性:BottomStart<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Alignment<br>方法 or 属性:Bottom<br>起始版本:7|类名:Alignment<br>方法 or 属性:Bottom<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Alignment<br>方法 or 属性:BottomEnd<br>起始版本:7|类名:Alignment<br>方法 or 属性:BottomEnd<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TransitionType<br>起始版本:7|类名:TransitionType<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TransitionType<br>方法 or 属性:All<br>起始版本:7|类名:TransitionType<br>方法 or 属性:All<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TransitionType<br>方法 or 属性:Insert<br>起始版本:7|类名:TransitionType<br>方法 or 属性:Insert<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TransitionType<br>方法 or 属性:Delete<br>起始版本:7|类名:TransitionType<br>方法 or 属性:Delete<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:RelateType<br>起始版本:7|类名:RelateType<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:RelateType<br>方法 or 属性:FILL<br>起始版本:7|类名:RelateType<br>方法 or 属性:FILL<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:RelateType<br>方法 or 属性:FIT<br>起始版本:7|类名:RelateType<br>方法 or 属性:FIT<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Visibility<br>起始版本:7|类名:Visibility<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Visibility<br>方法 or 属性:Visible<br>起始版本:7|类名:Visibility<br>方法 or 属性:Visible<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Visibility<br>方法 or 属性:Hidden<br>起始版本:7|类名:Visibility<br>方法 or 属性:Hidden<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Visibility<br>方法 or 属性:None<br>起始版本:7|类名:Visibility<br>方法 or 属性:None<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:LineCapStyle<br>起始版本:7|类名:LineCapStyle<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:LineCapStyle<br>方法 or 属性:Butt<br>起始版本:7|类名:LineCapStyle<br>方法 or 属性:Butt<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:LineCapStyle<br>方法 or 属性:Round<br>起始版本:7|类名:LineCapStyle<br>方法 or 属性:Round<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:LineCapStyle<br>方法 or 属性:Square<br>起始版本:7|类名:LineCapStyle<br>方法 or 属性:Square<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Axis<br>起始版本:7|类名:Axis<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Axis<br>方法 or 属性:Vertical<br>起始版本:7|类名:Axis<br>方法 or 属性:Vertical<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Axis<br>方法 or 属性:Horizontal<br>起始版本:7|类名:Axis<br>方法 or 属性:Horizontal<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:HorizontalAlign<br>起始版本:7|类名:HorizontalAlign<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:HorizontalAlign<br>方法 or 属性:Start<br>起始版本:7|类名:HorizontalAlign<br>方法 or 属性:Start<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:HorizontalAlign<br>方法 or 属性:Center<br>起始版本:7|类名:HorizontalAlign<br>方法 or 属性:Center<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:HorizontalAlign<br>方法 or 属性:End<br>起始版本:7|类名:HorizontalAlign<br>方法 or 属性:End<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexAlign<br>起始版本:7|类名:FlexAlign<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexAlign<br>方法 or 属性:Start<br>起始版本:7|类名:FlexAlign<br>方法 or 属性:Start<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexAlign<br>方法 or 属性:Center<br>起始版本:7|类名:FlexAlign<br>方法 or 属性:Center<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexAlign<br>方法 or 属性:End<br>起始版本:7|类名:FlexAlign<br>方法 or 属性:End<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexAlign<br>方法 or 属性:SpaceBetween<br>起始版本:7|类名:FlexAlign<br>方法 or 属性:SpaceBetween<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexAlign<br>方法 or 属性:SpaceAround<br>起始版本:7|类名:FlexAlign<br>方法 or 属性:SpaceAround<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexAlign<br>方法 or 属性:SpaceEvenly<br>起始版本:7|类名:FlexAlign<br>方法 or 属性:SpaceEvenly<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ItemAlign<br>起始版本:7|类名:ItemAlign<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ItemAlign<br>方法 or 属性:Auto<br>起始版本:7|类名:ItemAlign<br>方法 or 属性:Auto<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ItemAlign<br>方法 or 属性:Start<br>起始版本:7|类名:ItemAlign<br>方法 or 属性:Start<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ItemAlign<br>方法 or 属性:Center<br>起始版本:7|类名:ItemAlign<br>方法 or 属性:Center<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ItemAlign<br>方法 or 属性:End<br>起始版本:7|类名:ItemAlign<br>方法 or 属性:End<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ItemAlign<br>方法 or 属性:Baseline<br>起始版本:7|类名:ItemAlign<br>方法 or 属性:Baseline<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ItemAlign<br>方法 or 属性:Stretch<br>起始版本:7|类名:ItemAlign<br>方法 or 属性:Stretch<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexDirection<br>起始版本:7|类名:FlexDirection<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexDirection<br>方法 or 属性:Row<br>起始版本:7|类名:FlexDirection<br>方法 or 属性:Row<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexDirection<br>方法 or 属性:Column<br>起始版本:7|类名:FlexDirection<br>方法 or 属性:Column<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexDirection<br>方法 or 属性:RowReverse<br>起始版本:7|类名:FlexDirection<br>方法 or 属性:RowReverse<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexDirection<br>方法 or 属性:ColumnReverse<br>起始版本:7|类名:FlexDirection<br>方法 or 属性:ColumnReverse<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexWrap<br>起始版本:7|类名:FlexWrap<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexWrap<br>方法 or 属性:NoWrap<br>起始版本:7|类名:FlexWrap<br>方法 or 属性:NoWrap<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexWrap<br>方法 or 属性:Wrap<br>起始版本:7|类名:FlexWrap<br>方法 or 属性:Wrap<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexWrap<br>方法 or 属性:WrapReverse<br>起始版本:7|类名:FlexWrap<br>方法 or 属性:WrapReverse<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:VerticalAlign<br>起始版本:7|类名:VerticalAlign<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:VerticalAlign<br>方法 or 属性:Top<br>起始版本:7|类名:VerticalAlign<br>方法 or 属性:Top<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:VerticalAlign<br>方法 or 属性:Center<br>起始版本:7|类名:VerticalAlign<br>方法 or 属性:Center<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:VerticalAlign<br>方法 or 属性:Bottom<br>起始版本:7|类名:VerticalAlign<br>方法 or 属性:Bottom<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageRepeat<br>起始版本:7|类名:ImageRepeat<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageRepeat<br>方法 or 属性:NoRepeat<br>起始版本:7|类名:ImageRepeat<br>方法 or 属性:NoRepeat<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageRepeat<br>方法 or 属性:X<br>起始版本:7|类名:ImageRepeat<br>方法 or 属性:X<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageRepeat<br>方法 or 属性:Y<br>起始版本:7|类名:ImageRepeat<br>方法 or 属性:Y<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageRepeat<br>方法 or 属性:XY<br>起始版本:7|类名:ImageRepeat<br>方法 or 属性:XY<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageSize<br>起始版本:7|类名:ImageSize<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageSize<br>方法 or 属性:Auto<br>起始版本:7|类名:ImageSize<br>方法 or 属性:Auto<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageSize<br>方法 or 属性:Cover<br>起始版本:7|类名:ImageSize<br>方法 or 属性:Cover<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageSize<br>方法 or 属性:Contain<br>起始版本:7|类名:ImageSize<br>方法 or 属性:Contain<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:GradientDirection<br>起始版本:7|类名:GradientDirection<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:GradientDirection<br>方法 or 属性:Left<br>起始版本:7|类名:GradientDirection<br>方法 or 属性:Left<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:GradientDirection<br>方法 or 属性:Top<br>起始版本:7|类名:GradientDirection<br>方法 or 属性:Top<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:GradientDirection<br>方法 or 属性:Right<br>起始版本:7|类名:GradientDirection<br>方法 or 属性:Right<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:GradientDirection<br>方法 or 属性:Bottom<br>起始版本:7|类名:GradientDirection<br>方法 or 属性:Bottom<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:GradientDirection<br>方法 or 属性:LeftTop<br>起始版本:7|类名:GradientDirection<br>方法 or 属性:LeftTop<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:GradientDirection<br>方法 or 属性:LeftBottom<br>起始版本:7|类名:GradientDirection<br>方法 or 属性:LeftBottom<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:GradientDirection<br>方法 or 属性:RightTop<br>起始版本:7|类名:GradientDirection<br>方法 or 属性:RightTop<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:GradientDirection<br>方法 or 属性:RightBottom<br>起始版本:7|类名:GradientDirection<br>方法 or 属性:RightBottom<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:GradientDirection<br>方法 or 属性:None<br>起始版本:7|类名:GradientDirection<br>方法 or 属性:None<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:SharedTransitionEffectType<br>起始版本:7|类名:SharedTransitionEffectType<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:SharedTransitionEffectType<br>方法 or 属性:Static<br>起始版本:7|类名:SharedTransitionEffectType<br>方法 or 属性:Static<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:SharedTransitionEffectType<br>方法 or 属性:Exchange<br>起始版本:7|类名:SharedTransitionEffectType<br>方法 or 属性:Exchange<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FontStyle<br>起始版本:7|类名:FontStyle<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FontStyle<br>方法 or 属性:Normal<br>起始版本:7|类名:FontStyle<br>方法 or 属性:Normal<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FontStyle<br>方法 or 属性:Italic<br>起始版本:7|类名:FontStyle<br>方法 or 属性:Italic<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FontWeight<br>起始版本:7|类名:FontWeight<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FontWeight<br>方法 or 属性:Lighter<br>起始版本:7|类名:FontWeight<br>方法 or 属性:Lighter<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FontWeight<br>方法 or 属性:Normal<br>起始版本:7|类名:FontWeight<br>方法 or 属性:Normal<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FontWeight<br>方法 or 属性:Regular<br>起始版本:7|类名:FontWeight<br>方法 or 属性:Regular<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FontWeight<br>方法 or 属性:Medium<br>起始版本:7|类名:FontWeight<br>方法 or 属性:Medium<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FontWeight<br>方法 or 属性:Bold<br>起始版本:7|类名:FontWeight<br>方法 or 属性:Bold<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FontWeight<br>方法 or 属性:Bolder<br>起始版本:7|类名:FontWeight<br>方法 or 属性:Bolder<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextAlign<br>起始版本:7|类名:TextAlign<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextAlign<br>方法 or 属性:Center<br>起始版本:7|类名:TextAlign<br>方法 or 属性:Center<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextAlign<br>方法 or 属性:Start<br>起始版本:7|类名:TextAlign<br>方法 or 属性:Start<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextAlign<br>方法 or 属性:End<br>起始版本:7|类名:TextAlign<br>方法 or 属性:End<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextOverflow<br>起始版本:7|类名:TextOverflow<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextOverflow<br>方法 or 属性:Clip<br>起始版本:7|类名:TextOverflow<br>方法 or 属性:Clip<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextOverflow<br>方法 or 属性:Ellipsis<br>起始版本:7|类名:TextOverflow<br>方法 or 属性:Ellipsis<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextOverflow<br>方法 or 属性:None<br>起始版本:7|类名:TextOverflow<br>方法 or 属性:None<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextDecorationType<br>起始版本:7|类名:TextDecorationType<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextDecorationType<br>方法 or 属性:None<br>起始版本:7|类名:TextDecorationType<br>方法 or 属性:None<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextDecorationType<br>方法 or 属性:Underline<br>起始版本:7|类名:TextDecorationType<br>方法 or 属性:Underline<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextDecorationType<br>方法 or 属性:Overline<br>起始版本:7|类名:TextDecorationType<br>方法 or 属性:Overline<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextDecorationType<br>方法 or 属性:LineThrough<br>起始版本:7|类名:TextDecorationType<br>方法 or 属性:LineThrough<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextCase<br>起始版本:7|类名:TextCase<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextCase<br>方法 or 属性:Normal<br>起始版本:7|类名:TextCase<br>方法 or 属性:Normal<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextCase<br>方法 or 属性:LowerCase<br>起始版本:7|类名:TextCase<br>方法 or 属性:LowerCase<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextCase<br>方法 or 属性:UpperCase<br>起始版本:7|类名:TextCase<br>方法 or 属性:UpperCase<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ResponseType<br>起始版本:8|类名:ResponseType<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ResponseType<br>方法 or 属性:RightClick<br>起始版本:8|类名:ResponseType<br>方法 or 属性:RightClick<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ResponseType<br>方法 or 属性:LongPress<br>起始版本:8|类名:ResponseType<br>方法 or 属性:LongPress<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:HoverEffect<br>起始版本:8|类名:HoverEffect<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:HoverEffect<br>方法 or 属性:Auto<br>起始版本:8|类名:HoverEffect<br>方法 or 属性:Auto<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:HoverEffect<br>方法 or 属性:Scale<br>起始版本:8|类名:HoverEffect<br>方法 or 属性:Scale<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:HoverEffect<br>方法 or 属性:Highlight<br>起始版本:8|类名:HoverEffect<br>方法 or 属性:Highlight<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:HoverEffect<br>方法 or 属性:None<br>起始版本:8|类名:HoverEffect<br>方法 or 属性:None<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Placement<br>起始版本:8|类名:Placement<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Placement<br>方法 or 属性:Left<br>起始版本:8|类名:Placement<br>方法 or 属性:Left<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Placement<br>方法 or 属性:Right<br>起始版本:8|类名:Placement<br>方法 or 属性:Right<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Placement<br>方法 or 属性:Top<br>起始版本:8|类名:Placement<br>方法 or 属性:Top<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Placement<br>方法 or 属性:Bottom<br>起始版本:8|类名:Placement<br>方法 or 属性:Bottom<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Placement<br>方法 or 属性:TopLeft<br>起始版本:8|类名:Placement<br>方法 or 属性:TopLeft<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Placement<br>方法 or 属性:TopRight<br>起始版本:8|类名:Placement<br>方法 or 属性:TopRight<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Placement<br>方法 or 属性:BottomLeft<br>起始版本:8|类名:Placement<br>方法 or 属性:BottomLeft<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Placement<br>方法 or 属性:BottomRight<br>起始版本:8|类名:Placement<br>方法 or 属性:BottomRight<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexOptions<br>起始版本:7|类名:FlexOptions<br>起始版本:9|flex.d.ts| +|起始版本有变化|类名:FlexOptions<br>方法 or 属性:direction?: FlexDirection;<br>起始版本:7|类名:FlexOptions<br>方法 or 属性:direction?: FlexDirection;<br>起始版本:9|flex.d.ts| +|起始版本有变化|类名:FlexOptions<br>方法 or 属性:wrap?: FlexWrap;<br>起始版本:7|类名:FlexOptions<br>方法 or 属性:wrap?: FlexWrap;<br>起始版本:9|flex.d.ts| +|起始版本有变化|类名:FlexOptions<br>方法 or 属性:justifyContent?: FlexAlign;<br>起始版本:7|类名:FlexOptions<br>方法 or 属性:justifyContent?: FlexAlign;<br>起始版本:9|flex.d.ts| +|起始版本有变化|类名:FlexOptions<br>方法 or 属性:alignItems?: ItemAlign;<br>起始版本:7|类名:FlexOptions<br>方法 or 属性:alignItems?: ItemAlign;<br>起始版本:9|flex.d.ts| +|起始版本有变化|类名:FlexOptions<br>方法 or 属性:alignContent?: FlexAlign;<br>起始版本:7|类名:FlexOptions<br>方法 or 属性:alignContent?: FlexAlign;<br>起始版本:9|flex.d.ts| +|起始版本有变化|类名:FlexInterface<br>起始版本:7|类名:FlexInterface<br>起始版本:9|flex.d.ts| +|起始版本有变化|类名:FlexInterface<br>方法 or 属性:(value?: FlexOptions): FlexAttribute;<br>起始版本:7|类名:FlexInterface<br>方法 or 属性:(value?: FlexOptions): FlexAttribute;<br>起始版本:9|flex.d.ts| +|起始版本有变化|类名:FlexAttribute<br>起始版本:7|类名:FlexAttribute<br>起始版本:9|flex.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Flex: FlexInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Flex: FlexInterface;<br>起始版本:9|flex.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const FlexInstance: FlexAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const FlexInstance: FlexAttribute;<br>起始版本:9|flex.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const FlowItem: FlowItemInterface<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const FlowItem: FlowItemInterface<br>起始版本:9|flow_item.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const FlowItemInstance: FlowItemAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const FlowItemInstance: FlowItemAttribute;<br>起始版本:9|flow_item.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const FormComponent: FormComponentInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const FormComponent: FormComponentInterface;<br>起始版本:7|form_component.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const FormComponentInstance: FormComponentAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const FormComponentInstance: FormComponentAttribute;<br>起始版本:7|form_component.d.ts| +|起始版本有变化|类名:ForEachInterface<br>起始版本:7|类名:ForEachInterface<br>起始版本:9|for_each.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ForEach: ForEachInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ForEach: ForEachInterface;<br>起始版本:9|for_each.d.ts| +|起始版本有变化|类名:GaugeInterface<br>起始版本:8|类名:GaugeInterface<br>起始版本:9|gauge.d.ts| +|起始版本有变化|类名:GaugeInterface<br>方法 or 属性:(options: { value: number; min?: number; max?: number }): GaugeAttribute;<br>起始版本:8|类名:GaugeInterface<br>方法 or 属性:(options: { value: number; min?: number; max?: number }): GaugeAttribute;<br>起始版本:9|gauge.d.ts| +|起始版本有变化|类名:GaugeAttribute<br>起始版本:8|类名:GaugeAttribute<br>起始版本:9|gauge.d.ts| +|起始版本有变化|类名:GaugeAttribute<br>方法 or 属性:value(value: number): GaugeAttribute;<br>起始版本:8|类名:GaugeAttribute<br>方法 or 属性:value(value: number): GaugeAttribute;<br>起始版本:9|gauge.d.ts| +|起始版本有变化|类名:GaugeAttribute<br>方法 or 属性:startAngle(angle: number): GaugeAttribute;<br>起始版本:8|类名:GaugeAttribute<br>方法 or 属性:startAngle(angle: number): GaugeAttribute;<br>起始版本:9|gauge.d.ts| +|起始版本有变化|类名:GaugeAttribute<br>方法 or 属性:endAngle(angle: number): GaugeAttribute;<br>起始版本:8|类名:GaugeAttribute<br>方法 or 属性:endAngle(angle: number): GaugeAttribute;<br>起始版本:9|gauge.d.ts| +|起始版本有变化|类名:GaugeAttribute<br>方法 or 属性:colors(colors: Array\<any>): GaugeAttribute;<br>起始版本:8|类名:GaugeAttribute<br>方法 or 属性:colors(colors: Array\<any>): GaugeAttribute;<br>起始版本:9|gauge.d.ts| +|起始版本有变化|类名:GaugeAttribute<br>方法 or 属性:strokeWidth(length: Length): GaugeAttribute;<br>起始版本:8|类名:GaugeAttribute<br>方法 or 属性:strokeWidth(length: Length): GaugeAttribute;<br>起始版本:9|gauge.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Gauge: GaugeInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Gauge: GaugeInterface;<br>起始版本:9|gauge.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const GaugeInstance: GaugeAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const GaugeInstance: GaugeAttribute;<br>起始版本:9|gauge.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TapGesture: TapGestureInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TapGesture: TapGestureInterface;<br>起始版本:7|gesture.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const LongPressGesture: LongPressGestureInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const LongPressGesture: LongPressGestureInterface;<br>起始版本:7|gesture.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const PanGesture: PanGestureInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const PanGesture: PanGestureInterface;<br>起始版本:7|gesture.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const SwipeGesture: SwipeGestureInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const SwipeGesture: SwipeGestureInterface;<br>起始版本:7|gesture.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const PinchGesture: PinchGestureInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const PinchGesture: PinchGestureInterface;<br>起始版本:7|gesture.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const RotationGesture: RotationGestureInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const RotationGesture: RotationGestureInterface;<br>起始版本:7|gesture.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const GestureGroup: GestureGroupInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const GestureGroup: GestureGroupInterface;<br>起始版本:7|gesture.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Grid: GridInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Grid: GridInterface;<br>起始版本:7|grid.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const GridInstance: GridAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const GridInstance: GridAttribute;<br>起始版本:7|grid.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const GridItem: GridItemInterface<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const GridItem: GridItemInterface<br>起始版本:7|gridItem.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const GridItemInstance: GridItemAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const GridItemInstance: GridItemAttribute;<br>起始版本:7|gridItem.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const GridCol: GridColInterface<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const GridCol: GridColInterface<br>起始版本:9|grid_col.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const GridColInstance: GridColAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const GridColInstance: GridColAttribute;<br>起始版本:9|grid_col.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const GridContainer: GridContainerInterface<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const GridContainer: GridContainerInterface<br>起始版本:7|grid_container.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const GridContainerInstance: GridContainerAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const GridContainerInstance: GridContainerAttribute;<br>起始版本:7|grid_container.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const GridRow: GridRowInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const GridRow: GridRowInterface;<br>起始版本:9|grid_row.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const GridRowInstance: GridRowAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const GridRowInstance: GridRowAttribute;<br>起始版本:9|grid_row.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Hyperlink: HyperlinkInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Hyperlink: HyperlinkInterface;<br>起始版本:7|hyperlink.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const HyperlinkInterface: HyperlinkAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const HyperlinkInterface: HyperlinkAttribute;<br>起始版本:7|hyperlink.d.ts| +|起始版本有变化|类名:ImageRenderMode<br>起始版本:7|类名:ImageRenderMode<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageRenderMode<br>方法 or 属性:Original<br>起始版本:7|类名:ImageRenderMode<br>方法 or 属性:Original<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageRenderMode<br>方法 or 属性:Template<br>起始版本:7|类名:ImageRenderMode<br>方法 or 属性:Template<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageInterpolation<br>起始版本:7|类名:ImageInterpolation<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageInterpolation<br>方法 or 属性:None<br>起始版本:7|类名:ImageInterpolation<br>方法 or 属性:None<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageInterpolation<br>方法 or 属性:Low<br>起始版本:7|类名:ImageInterpolation<br>方法 or 属性:Low<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageInterpolation<br>方法 or 属性:Medium<br>起始版本:7|类名:ImageInterpolation<br>方法 or 属性:Medium<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageInterpolation<br>方法 or 属性:High<br>起始版本:7|类名:ImageInterpolation<br>方法 or 属性:High<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageInterface<br>起始版本:7|类名:ImageInterface<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageInterface<br>方法 or 属性:(src: string \| PixelMap \| Resource): ImageAttribute;<br>起始版本:7|类名:ImageInterface<br>方法 or 属性:(src: string \| PixelMap \| Resource): ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageAttribute<br>起始版本:7|类名:ImageAttribute<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageAttribute<br>方法 or 属性:alt(value: string \| Resource): ImageAttribute;<br>起始版本:7|类名:ImageAttribute<br>方法 or 属性:alt(value: string \| Resource): ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageAttribute<br>方法 or 属性:matchTextDirection(value: boolean): ImageAttribute;<br>起始版本:7|类名:ImageAttribute<br>方法 or 属性:matchTextDirection(value: boolean): ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageAttribute<br>方法 or 属性:fitOriginalSize(value: boolean): ImageAttribute;<br>起始版本:7|类名:ImageAttribute<br>方法 or 属性:fitOriginalSize(value: boolean): ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageAttribute<br>方法 or 属性:fillColor(value: ResourceColor): ImageAttribute;<br>起始版本:7|类名:ImageAttribute<br>方法 or 属性:fillColor(value: ResourceColor): ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageAttribute<br>方法 or 属性:objectFit(value: ImageFit): ImageAttribute;<br>起始版本:7|类名:ImageAttribute<br>方法 or 属性:objectFit(value: ImageFit): ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageAttribute<br>方法 or 属性:objectRepeat(value: ImageRepeat): ImageAttribute;<br>起始版本:7|类名:ImageAttribute<br>方法 or 属性:objectRepeat(value: ImageRepeat): ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageAttribute<br>方法 or 属性:autoResize(value: boolean): ImageAttribute;<br>起始版本:7|类名:ImageAttribute<br>方法 or 属性:autoResize(value: boolean): ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageAttribute<br>方法 or 属性:renderMode(value: ImageRenderMode): ImageAttribute;<br>起始版本:7|类名:ImageAttribute<br>方法 or 属性:renderMode(value: ImageRenderMode): ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageAttribute<br>方法 or 属性:interpolation(value: ImageInterpolation): ImageAttribute;<br>起始版本:7|类名:ImageAttribute<br>方法 or 属性:interpolation(value: ImageInterpolation): ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageAttribute<br>方法 or 属性:sourceSize(value: { width: number; height: number }): ImageAttribute;<br>起始版本:7|类名:ImageAttribute<br>方法 or 属性:sourceSize(value: { width: number; height: number }): ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageAttribute<br>方法 or 属性:syncLoad(value: boolean): ImageAttribute;<br>起始版本:8|类名:ImageAttribute<br>方法 or 属性:syncLoad(value: boolean): ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageAttribute<br>方法 or 属性:onComplete(<br> callback: (event?: {<br> width: number;<br> height: number;<br> componentWidth: number;<br> componentHeight: number;<br> loadingStatus: number;<br> }) => void,<br> ): ImageAttribute;<br>起始版本:7|类名:ImageAttribute<br>方法 or 属性:onComplete(<br> callback: (event?: {<br> width: number;<br> height: number;<br> componentWidth: number;<br> componentHeight: number;<br> loadingStatus: number;<br> }) => void,<br> ): ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageAttribute<br>方法 or 属性:onError(callback: (event?: { componentWidth: number; componentHeight: number }) => void): ImageAttribute;<br>起始版本:7|类名:ImageAttribute<br>方法 or 属性:onError(callback: (event?: { componentWidth: number; componentHeight: number }) => void): ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageAttribute<br>方法 or 属性:onFinish(event: () => void): ImageAttribute;<br>起始版本:7|类名:ImageAttribute<br>方法 or 属性:onFinish(event: () => void): ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Image: ImageInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Image: ImageInterface;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ImageInstance: ImageAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ImageInstance: ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ImageAnimator: ImageAnimatorInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ImageAnimator: ImageAnimatorInterface;<br>起始版本:7|image_animator.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ImageAnimatorInstance: ImageAnimatorAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ImageAnimatorInstance: ImageAnimatorAttribute;<br>起始版本:7|image_animator.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const LazyForEach: LazyForEachInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const LazyForEach: LazyForEachInterface;<br>起始版本:7|lazy_for_each.d.ts| +|起始版本有变化|类名:LineInterface<br>起始版本:7|类名:LineInterface<br>起始版本:9|line.d.ts| +|起始版本有变化|类名:LineInterface<br>方法 or 属性:new (value?: { width?: string \| number; height?: string \| number }): LineAttribute;<br>起始版本:7|类名:LineInterface<br>方法 or 属性:new (value?: { width?: string \| number; height?: string \| number }): LineAttribute;<br>起始版本:9|line.d.ts| +|起始版本有变化|类名:LineInterface<br>方法 or 属性:(value?: { width?: string \| number; height?: string \| number }): LineAttribute;<br>起始版本:7|类名:LineInterface<br>方法 or 属性:(value?: { width?: string \| number; height?: string \| number }): LineAttribute;<br>起始版本:9|line.d.ts| +|起始版本有变化|类名:LineAttribute<br>起始版本:7|类名:LineAttribute<br>起始版本:9|line.d.ts| +|起始版本有变化|类名:LineAttribute<br>方法 or 属性:startPoint(value: Array\<any>): LineAttribute;<br>起始版本:7|类名:LineAttribute<br>方法 or 属性:startPoint(value: Array\<any>): LineAttribute;<br>起始版本:9|line.d.ts| +|起始版本有变化|类名:LineAttribute<br>方法 or 属性:endPoint(value: Array\<any>): LineAttribute;<br>起始版本:7|类名:LineAttribute<br>方法 or 属性:endPoint(value: Array\<any>): LineAttribute;<br>起始版本:9|line.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Line: LineInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Line: LineInterface;<br>起始版本:9|line.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const LineInstance: LineAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const LineInstance: LineAttribute;<br>起始版本:9|line.d.ts| +|起始版本有变化|类名:ScrollState<br>起始版本:7|类名:ScrollState<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ScrollState<br>方法 or 属性:Idle<br>起始版本:7|类名:ScrollState<br>方法 or 属性:Idle<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ScrollState<br>方法 or 属性:Scroll<br>起始版本:7|类名:ScrollState<br>方法 or 属性:Scroll<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ScrollState<br>方法 or 属性:Fling<br>起始版本:7|类名:ScrollState<br>方法 or 属性:Fling<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListInterface<br>起始版本:7|类名:ListInterface<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListInterface<br>方法 or 属性:(value?: { initialIndex?: number; space?: number \| string; scroller?: Scroller }): ListAttribute;<br>起始版本:7|类名:ListInterface<br>方法 or 属性:(value?: { initialIndex?: number; space?: number \| string; scroller?: Scroller }): ListAttribute;<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListAttribute<br>起始版本:7|类名:ListAttribute<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListAttribute<br>方法 or 属性:listDirection(value: Axis): ListAttribute;<br>起始版本:7|类名:ListAttribute<br>方法 or 属性:listDirection(value: Axis): ListAttribute;<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListAttribute<br>方法 or 属性:scrollBar(value: BarState): ListAttribute;<br>起始版本:7|类名:ListAttribute<br>方法 or 属性:scrollBar(value: BarState): ListAttribute;<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListAttribute<br>方法 or 属性:edgeEffect(value: EdgeEffect): ListAttribute;<br>起始版本:7|类名:ListAttribute<br>方法 or 属性:edgeEffect(value: EdgeEffect): ListAttribute;<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListAttribute<br>方法 or 属性:divider(<br> value: {<br> strokeWidth: Length;<br> color?: ResourceColor;<br> startMargin?: Length;<br> endMargin?: Length;<br> } \| null,<br> ): ListAttribute;<br>起始版本:7|类名:ListAttribute<br>方法 or 属性:divider(<br> value: {<br> strokeWidth: Length;<br> color?: ResourceColor;<br> startMargin?: Length;<br> endMargin?: Length;<br> } \| null,<br> ): ListAttribute;<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListAttribute<br>方法 or 属性:multiSelectable(value: boolean): ListAttribute;<br>起始版本:8|类名:ListAttribute<br>方法 or 属性:multiSelectable(value: boolean): ListAttribute;<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListAttribute<br>方法 or 属性:cachedCount(value: number): ListAttribute;<br>起始版本:7|类名:ListAttribute<br>方法 or 属性:cachedCount(value: number): ListAttribute;<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListAttribute<br>方法 or 属性:chainAnimation(value: boolean): ListAttribute;<br>起始版本:7|类名:ListAttribute<br>方法 or 属性:chainAnimation(value: boolean): ListAttribute;<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListAttribute<br>方法 or 属性:onScroll(event: (scrollOffset: number, scrollState: ScrollState) => void): ListAttribute;<br>起始版本:7|类名:ListAttribute<br>方法 or 属性:onScroll(event: (scrollOffset: number, scrollState: ScrollState) => void): ListAttribute;<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListAttribute<br>方法 or 属性:onScrollIndex(event: (start: number, end: number) => void): ListAttribute;<br>起始版本:7|类名:ListAttribute<br>方法 or 属性:onScrollIndex(event: (start: number, end: number) => void): ListAttribute;<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListAttribute<br>方法 or 属性:onReachStart(event: () => void): ListAttribute;<br>起始版本:7|类名:ListAttribute<br>方法 or 属性:onReachStart(event: () => void): ListAttribute;<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListAttribute<br>方法 or 属性:onReachEnd(event: () => void): ListAttribute;<br>起始版本:7|类名:ListAttribute<br>方法 or 属性:onReachEnd(event: () => void): ListAttribute;<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListAttribute<br>方法 or 属性:onScrollStop(event: () => void): ListAttribute;<br>起始版本:7|类名:ListAttribute<br>方法 or 属性:onScrollStop(event: () => void): ListAttribute;<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const List: ListInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const List: ListInterface;<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ListInstance: ListAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ListInstance: ListAttribute;<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListItemInterface<br>起始版本:7|类名:ListItemInterface<br>起始版本:9|list_item.d.ts| +|起始版本有变化|类名:ListItemInterface<br>方法 or 属性:(value?: string): ListItemAttribute;<br>起始版本:7|类名:ListItemInterface<br>方法 or 属性:(value?: string): ListItemAttribute;<br>起始版本:9|list_item.d.ts| +|起始版本有变化|类名:ListItemAttribute<br>起始版本:7|类名:ListItemAttribute<br>起始版本:9|list_item.d.ts| +|起始版本有变化|类名:ListItemAttribute<br>方法 or 属性:onSelect(event: (isSelected: boolean) => void): ListItemAttribute;<br>起始版本:8|类名:ListItemAttribute<br>方法 or 属性:onSelect(event: (isSelected: boolean) => void): ListItemAttribute;<br>起始版本:9|list_item.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ListItemInstance: ListItemAttribute;<br>起始版本:7|类名:global<br>方法 or 属性:declare const ListItemInstance: ListItemAttribute;<br>起始版本:9|list_item.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ListItem: ListItemInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ListItem: ListItemInterface;<br>起始版本:9|list_item.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ListItemGroup: ListItemGroupInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ListItemGroup: ListItemGroupInterface;<br>起始版本:9|list_item_group.d.ts| +|起始版本有变化|类名:LoadingProgressStyle<br>起始版本:8|类名:LoadingProgressStyle<br>起始版本:9|loading_progress.d.ts| +|起始版本有变化|类名:LoadingProgressStyle<br>方法 or 属性:Default<br>起始版本:8|类名:LoadingProgressStyle<br>方法 or 属性:Default<br>起始版本:9|loading_progress.d.ts| +|起始版本有变化|类名:LoadingProgressStyle<br>方法 or 属性:Circular<br>起始版本:8|类名:LoadingProgressStyle<br>方法 or 属性:Circular<br>起始版本:9|loading_progress.d.ts| +|起始版本有变化|类名:LoadingProgressStyle<br>方法 or 属性:Orbital<br>起始版本:8|类名:LoadingProgressStyle<br>方法 or 属性:Orbital<br>起始版本:9|loading_progress.d.ts| +|起始版本有变化|类名:LoadingProgressInterface<br>起始版本:8|类名:LoadingProgressInterface<br>起始版本:9|loading_progress.d.ts| +|起始版本有变化|类名:LoadingProgressInterface<br>方法 or 属性:(): LoadingProgressAttribute;<br>起始版本:8|类名:LoadingProgressInterface<br>方法 or 属性:(): LoadingProgressAttribute;<br>起始版本:9|loading_progress.d.ts| +|起始版本有变化|类名:LoadingProgressAttribute<br>起始版本:8|类名:LoadingProgressAttribute<br>起始版本:9|loading_progress.d.ts| +|起始版本有变化|类名:LoadingProgressAttribute<br>方法 or 属性:color(value: ResourceColor): LoadingProgressAttribute;<br>起始版本:8|类名:LoadingProgressAttribute<br>方法 or 属性:color(value: ResourceColor): LoadingProgressAttribute;<br>起始版本:9|loading_progress.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const LoadingProgress: LoadingProgressInterface;<br>起始版本:8|类名:global<br>方法 or 属性:declare const LoadingProgress: LoadingProgressInterface;<br>起始版本:9|loading_progress.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const LoadingProgressInstance: LoadingProgressAttribute;<br>起始版本:8|类名:global<br>方法 or 属性:declare const LoadingProgressInstance: LoadingProgressAttribute;<br>起始版本:9|loading_progress.d.ts| +|起始版本有变化|类名:MarqueeInterface<br>起始版本:8|类名:MarqueeInterface<br>起始版本:9|marquee.d.ts| +|起始版本有变化|类名:MarqueeInterface<br>方法 or 属性:(value: { start: boolean; step?: number; loop?: number; fromStart?: boolean; src: string }): MarqueeAttribute;<br>起始版本:8|类名:MarqueeInterface<br>方法 or 属性:(value: { start: boolean; step?: number; loop?: number; fromStart?: boolean; src: string }): MarqueeAttribute;<br>起始版本:9|marquee.d.ts| +|起始版本有变化|类名:MarqueeAttribute<br>起始版本:8|类名:MarqueeAttribute<br>起始版本:9|marquee.d.ts| +|起始版本有变化|类名:MarqueeAttribute<br>方法 or 属性:fontColor(value: ResourceColor): MarqueeAttribute;<br>起始版本:8|类名:MarqueeAttribute<br>方法 or 属性:fontColor(value: ResourceColor): MarqueeAttribute;<br>起始版本:9|marquee.d.ts| +|起始版本有变化|类名:MarqueeAttribute<br>方法 or 属性:fontSize(value: Length): MarqueeAttribute;<br>起始版本:8|类名:MarqueeAttribute<br>方法 or 属性:fontSize(value: Length): MarqueeAttribute;<br>起始版本:9|marquee.d.ts| +|起始版本有变化|类名:MarqueeAttribute<br>方法 or 属性:allowScale(value: boolean): MarqueeAttribute;<br>起始版本:8|类名:MarqueeAttribute<br>方法 or 属性:allowScale(value: boolean): MarqueeAttribute;<br>起始版本:9|marquee.d.ts| +|起始版本有变化|类名:MarqueeAttribute<br>方法 or 属性:fontWeight(value: number \| FontWeight \| string): MarqueeAttribute;<br>起始版本:8|类名:MarqueeAttribute<br>方法 or 属性:fontWeight(value: number \| FontWeight \| string): MarqueeAttribute;<br>起始版本:9|marquee.d.ts| +|起始版本有变化|类名:MarqueeAttribute<br>方法 or 属性:fontFamily(value: string \| Resource): MarqueeAttribute;<br>起始版本:8|类名:MarqueeAttribute<br>方法 or 属性:fontFamily(value: string \| Resource): MarqueeAttribute;<br>起始版本:9|marquee.d.ts| +|起始版本有变化|类名:MarqueeAttribute<br>方法 or 属性:onStart(event: () => void): MarqueeAttribute;<br>起始版本:8|类名:MarqueeAttribute<br>方法 or 属性:onStart(event: () => void): MarqueeAttribute;<br>起始版本:9|marquee.d.ts| +|起始版本有变化|类名:MarqueeAttribute<br>方法 or 属性:onBounce(event: () => void): MarqueeAttribute;<br>起始版本:8|类名:MarqueeAttribute<br>方法 or 属性:onBounce(event: () => void): MarqueeAttribute;<br>起始版本:9|marquee.d.ts| +|起始版本有变化|类名:MarqueeAttribute<br>方法 or 属性:onFinish(event: () => void): MarqueeAttribute;<br>起始版本:8|类名:MarqueeAttribute<br>方法 or 属性:onFinish(event: () => void): MarqueeAttribute;<br>起始版本:9|marquee.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Marquee: MarqueeInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Marquee: MarqueeInterface;<br>起始版本:9|marquee.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const MarqueeInstance: MarqueeAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const MarqueeInstance: MarqueeAttribute;<br>起始版本:9|marquee.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Navigation: NavigationInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Navigation: NavigationInterface;<br>起始版本:8|navigation.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const NavigationInstance: NavigationAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const NavigationInstance: NavigationAttribute;<br>起始版本:8|navigation.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Navigator: NavigatorInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Navigator: NavigatorInterface;<br>起始版本:7|navigator.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const NavigatorInstance: NavigatorAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const NavigatorInstance: NavigatorAttribute;<br>起始版本:7|navigator.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const NavDestination: NavDestinationInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const NavDestination: NavDestinationInterface;<br>起始版本:9|nav_destination.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const NavDestinationInstance: NavDestinationAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const NavDestinationInstance: NavDestinationAttribute;<br>起始版本:9|nav_destination.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const NavRouter: NavRouterInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const NavRouter: NavRouterInterface;<br>起始版本:9|nav_router.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const NavRouterInstance: NavRouterAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const NavRouterInstance: NavRouterAttribute;<br>起始版本:9|nav_router.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const PageTransitionEnter: PageTransitionEnterInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const PageTransitionEnter: PageTransitionEnterInterface;<br>起始版本:7|page_transition.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const PageTransitionExit: PageTransitionExitInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const PageTransitionExit: PageTransitionExitInterface;<br>起始版本:7|page_transition.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Panel: PanelInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Panel: PanelInterface;<br>起始版本:7|panel.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const PanelInstance: PanelAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const PanelInstance: PanelAttribute;<br>起始版本:7|panel.d.ts| +|起始版本有变化|类名:PathInterface<br>起始版本:7|类名:PathInterface<br>起始版本:9|path.d.ts| +|起始版本有变化|类名:PathInterface<br>方法 or 属性:new (value?: { width?: number \| string; height?: number \| string; commands?: string }): PathAttribute;<br>起始版本:7|类名:PathInterface<br>方法 or 属性:new (value?: { width?: number \| string; height?: number \| string; commands?: string }): PathAttribute;<br>起始版本:9|path.d.ts| +|起始版本有变化|类名:PathInterface<br>方法 or 属性:(value?: { width?: number \| string; height?: number \| string; commands?: string }): PathAttribute;<br>起始版本:7|类名:PathInterface<br>方法 or 属性:(value?: { width?: number \| string; height?: number \| string; commands?: string }): PathAttribute;<br>起始版本:9|path.d.ts| +|起始版本有变化|类名:PathAttribute<br>起始版本:7|类名:PathAttribute<br>起始版本:9|path.d.ts| +|起始版本有变化|类名:PathAttribute<br>方法 or 属性:commands(value: string): PathAttribute;<br>起始版本:7|类名:PathAttribute<br>方法 or 属性:commands(value: string): PathAttribute;<br>起始版本:9|path.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Path: PathInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Path: PathInterface;<br>起始版本:9|path.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const PathInstance: PathAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const PathInstance: PathAttribute;<br>起始版本:9|path.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const PatternLock: PatternLockInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const PatternLock: PatternLockInterface;<br>起始版本:9|pattern_lock.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const PatternLockInstance: PatternLockAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const PatternLockInstance: PatternLockAttribute;<br>起始版本:9|pattern_lock.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const PluginComponent: PluginComponentInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const PluginComponent: PluginComponentInterface;<br>起始版本:9|plugin_component.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const PluginComponentInstance: PluginComponentAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const PluginComponentInstance: PluginComponentAttribute;<br>起始版本:9|plugin_component.d.ts| +|起始版本有变化|类名:PolygonInterface<br>起始版本:7|类名:PolygonInterface<br>起始版本:9|polygon.d.ts| +|起始版本有变化|类名:PolygonInterface<br>方法 or 属性:new (value?: { width?: string \| number; height?: string \| number }): PolygonAttribute;<br>起始版本:7|类名:PolygonInterface<br>方法 or 属性:new (value?: { width?: string \| number; height?: string \| number }): PolygonAttribute;<br>起始版本:9|polygon.d.ts| +|起始版本有变化|类名:PolygonInterface<br>方法 or 属性:(value?: { width?: string \| number; height?: string \| number }): PolygonAttribute;<br>起始版本:7|类名:PolygonInterface<br>方法 or 属性:(value?: { width?: string \| number; height?: string \| number }): PolygonAttribute;<br>起始版本:9|polygon.d.ts| +|起始版本有变化|类名:PolygonAttribute<br>方法 or 属性:points(value: Array\<any>): PolygonAttribute;<br>起始版本:7|类名:PolygonAttribute<br>方法 or 属性:points(value: Array\<any>): PolygonAttribute;<br>起始版本:9|polygon.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Polygon: PolygonInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Polygon: PolygonInterface;<br>起始版本:9|polygon.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const PolygonInstance: PolygonAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const PolygonInstance: PolygonAttribute;<br>起始版本:9|polygon.d.ts| +|起始版本有变化|类名:PolylineInterface<br>起始版本:7|类名:PolylineInterface<br>起始版本:9|polyline.d.ts| +|起始版本有变化|类名:PolylineInterface<br>方法 or 属性:new (value?: { width?: string \| number; height?: string \| number }): PolylineAttribute;<br>起始版本:7|类名:PolylineInterface<br>方法 or 属性:new (value?: { width?: string \| number; height?: string \| number }): PolylineAttribute;<br>起始版本:9|polyline.d.ts| +|起始版本有变化|类名:PolylineInterface<br>方法 or 属性:(value?: { width?: string \| number; height?: string \| number }): PolylineAttribute;<br>起始版本:7|类名:PolylineInterface<br>方法 or 属性:(value?: { width?: string \| number; height?: string \| number }): PolylineAttribute;<br>起始版本:9|polyline.d.ts| +|起始版本有变化|类名:PolylineAttribute<br>起始版本:7|类名:PolylineAttribute<br>起始版本:9|polyline.d.ts| +|起始版本有变化|类名:PolylineAttribute<br>方法 or 属性:points(value: Array\<any>): PolylineAttribute;<br>起始版本:7|类名:PolylineAttribute<br>方法 or 属性:points(value: Array\<any>): PolylineAttribute;<br>起始版本:9|polyline.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Polyline: PolylineInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Polyline: PolylineInterface;<br>起始版本:9|polyline.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const PolylineInstance: PolylineAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const PolylineInstance: PolylineAttribute;<br>起始版本:9|polyline.d.ts| +|起始版本有变化|类名:ProgressOptions<br>起始版本:7|类名:ProgressOptions<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressOptions<br>方法 or 属性:value: number;<br>起始版本:7|类名:ProgressOptions<br>方法 or 属性:value: number;<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressOptions<br>方法 or 属性:total?: number;<br>起始版本:7|类名:ProgressOptions<br>方法 or 属性:total?: number;<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressOptions<br>方法 or 属性:type?: ProgressType<br>起始版本:8|类名:ProgressOptions<br>方法 or 属性:type?: ProgressType<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressType<br>起始版本:8|类名:ProgressType<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressType<br>方法 or 属性:Linear<br>起始版本:8|类名:ProgressType<br>方法 or 属性:Linear<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressType<br>方法 or 属性:Ring<br>起始版本:8|类名:ProgressType<br>方法 or 属性:Ring<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressType<br>方法 or 属性:Eclipse<br>起始版本:8|类名:ProgressType<br>方法 or 属性:Eclipse<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressType<br>方法 or 属性:ScaleRing<br>起始版本:8|类名:ProgressType<br>方法 or 属性:ScaleRing<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressType<br>方法 or 属性:Capsule<br>起始版本:8|类名:ProgressType<br>方法 or 属性:Capsule<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressStyleOptions<br>起始版本:8|类名:ProgressStyleOptions<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressStyleOptions<br>方法 or 属性:strokeWidth?: Length;<br>起始版本:8|类名:ProgressStyleOptions<br>方法 or 属性:strokeWidth?: Length;<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressStyleOptions<br>方法 or 属性:scaleCount?: number;<br>起始版本:8|类名:ProgressStyleOptions<br>方法 or 属性:scaleCount?: number;<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressStyleOptions<br>方法 or 属性:scaleWidth?: Length;<br>起始版本:8|类名:ProgressStyleOptions<br>方法 or 属性:scaleWidth?: Length;<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressStyle<br>起始版本:7|类名:ProgressStyle<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressStyle<br>方法 or 属性:Linear<br>起始版本:7|类名:ProgressStyle<br>方法 or 属性:Linear<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressStyle<br>方法 or 属性:Ring<br>起始版本:8|类名:ProgressStyle<br>方法 or 属性:Ring<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressStyle<br>方法 or 属性:Eclipse<br>起始版本:7|类名:ProgressStyle<br>方法 or 属性:Eclipse<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressStyle<br>方法 or 属性:ScaleRing<br>起始版本:8|类名:ProgressStyle<br>方法 or 属性:ScaleRing<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressStyle<br>方法 or 属性:Capsule<br>起始版本:8|类名:ProgressStyle<br>方法 or 属性:Capsule<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressInterface<br>起始版本:7|类名:ProgressInterface<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressInterface<br>方法 or 属性:(options: ProgressOptions): ProgressAttribute;<br>起始版本:7|类名:ProgressInterface<br>方法 or 属性:(options: ProgressOptions): ProgressAttribute;<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressAttribute<br>起始版本:7|类名:ProgressAttribute<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressAttribute<br>方法 or 属性:value(value: number): ProgressAttribute;<br>起始版本:7|类名:ProgressAttribute<br>方法 or 属性:value(value: number): ProgressAttribute;<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressAttribute<br>方法 or 属性:color(value: ResourceColor): ProgressAttribute;<br>起始版本:7|类名:ProgressAttribute<br>方法 or 属性:color(value: ResourceColor): ProgressAttribute;<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressAttribute<br>方法 or 属性:style(value: ProgressStyleOptions): ProgressAttribute;<br>起始版本:8|类名:ProgressAttribute<br>方法 or 属性:style(value: ProgressStyleOptions): ProgressAttribute;<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Progress: ProgressInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Progress: ProgressInterface;<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ProgressInstance: ProgressAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ProgressInstance: ProgressAttribute;<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:QRCodeInterface<br>起始版本:7|类名:QRCodeInterface<br>起始版本:9|qrcode.d.ts| +|起始版本有变化|类名:QRCodeInterface<br>方法 or 属性:(value: string): QRCodeAttribute;<br>起始版本:7|类名:QRCodeInterface<br>方法 or 属性:(value: string): QRCodeAttribute;<br>起始版本:9|qrcode.d.ts| +|起始版本有变化|类名:QRCodeAttribute<br>起始版本:7|类名:QRCodeAttribute<br>起始版本:9|qrcode.d.ts| +|起始版本有变化|类名:QRCodeAttribute<br>方法 or 属性:color(value: ResourceColor): QRCodeAttribute;<br>起始版本:7|类名:QRCodeAttribute<br>方法 or 属性:color(value: ResourceColor): QRCodeAttribute;<br>起始版本:9|qrcode.d.ts| +|起始版本有变化|类名:QRCodeAttribute<br>方法 or 属性:backgroundColor(value: ResourceColor): QRCodeAttribute;<br>起始版本:7|类名:QRCodeAttribute<br>方法 or 属性:backgroundColor(value: ResourceColor): QRCodeAttribute;<br>起始版本:9|qrcode.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const QRCode: QRCodeInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const QRCode: QRCodeInterface;<br>起始版本:9|qrcode.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const QRCodeInstance: QRCodeAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const QRCodeInstance: QRCodeAttribute;<br>起始版本:9|qrcode.d.ts| +|起始版本有变化|类名:RadioOptions<br>起始版本:8|类名:RadioOptions<br>起始版本:9|radio.d.ts| +|起始版本有变化|类名:RadioOptions<br>方法 or 属性:group: string;<br>起始版本:8|类名:RadioOptions<br>方法 or 属性:group: string;<br>起始版本:9|radio.d.ts| +|起始版本有变化|类名:RadioOptions<br>方法 or 属性:value: string;<br>起始版本:8|类名:RadioOptions<br>方法 or 属性:value: string;<br>起始版本:9|radio.d.ts| +|起始版本有变化|类名:RadioInterface<br>起始版本:8|类名:RadioInterface<br>起始版本:9|radio.d.ts| +|起始版本有变化|类名:RadioInterface<br>方法 or 属性:(options: RadioOptions): RadioAttribute;<br>起始版本:8|类名:RadioInterface<br>方法 or 属性:(options: RadioOptions): RadioAttribute;<br>起始版本:9|radio.d.ts| +|起始版本有变化|类名:RadioAttribute<br>起始版本:8|类名:RadioAttribute<br>起始版本:9|radio.d.ts| +|起始版本有变化|类名:RadioAttribute<br>方法 or 属性:checked(value: boolean): RadioAttribute;<br>起始版本:8|类名:RadioAttribute<br>方法 or 属性:checked(value: boolean): RadioAttribute;<br>起始版本:9|radio.d.ts| +|起始版本有变化|类名:RadioAttribute<br>方法 or 属性:onChange(callback: (isChecked: boolean) => void): RadioAttribute;<br>起始版本:8|类名:RadioAttribute<br>方法 or 属性:onChange(callback: (isChecked: boolean) => void): RadioAttribute;<br>起始版本:9|radio.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Radio: RadioInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Radio: RadioInterface;<br>起始版本:9|radio.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const RadioInstance: RadioAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const RadioInstance: RadioAttribute;<br>起始版本:9|radio.d.ts| +|起始版本有变化|类名:RatingInterface<br>起始版本:7|类名:RatingInterface<br>起始版本:9|rating.d.ts| +|起始版本有变化|类名:RatingInterface<br>方法 or 属性:(options?: { rating: number; indicator?: boolean }): RatingAttribute;<br>起始版本:7|类名:RatingInterface<br>方法 or 属性:(options?: { rating: number; indicator?: boolean }): RatingAttribute;<br>起始版本:9|rating.d.ts| +|起始版本有变化|类名:RatingAttribute<br>起始版本:7|类名:RatingAttribute<br>起始版本:9|rating.d.ts| +|起始版本有变化|类名:RatingAttribute<br>方法 or 属性:stars(value: number): RatingAttribute;<br>起始版本:7|类名:RatingAttribute<br>方法 or 属性:stars(value: number): RatingAttribute;<br>起始版本:9|rating.d.ts| +|起始版本有变化|类名:RatingAttribute<br>方法 or 属性:stepSize(value: number): RatingAttribute;<br>起始版本:7|类名:RatingAttribute<br>方法 or 属性:stepSize(value: number): RatingAttribute;<br>起始版本:9|rating.d.ts| +|起始版本有变化|类名:RatingAttribute<br>方法 or 属性:starStyle(value: { backgroundUri: string; foregroundUri: string; secondaryUri?: string }): RatingAttribute;<br>起始版本:7|类名:RatingAttribute<br>方法 or 属性:starStyle(value: { backgroundUri: string; foregroundUri: string; secondaryUri?: string }): RatingAttribute;<br>起始版本:9|rating.d.ts| +|起始版本有变化|类名:RatingAttribute<br>方法 or 属性:onChange(callback: (value: number) => void): RatingAttribute;<br>起始版本:7|类名:RatingAttribute<br>方法 or 属性:onChange(callback: (value: number) => void): RatingAttribute;<br>起始版本:9|rating.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Rating: RatingInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Rating: RatingInterface;<br>起始版本:9|rating.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const RatingInstance: RatingAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const RatingInstance: RatingAttribute;<br>起始版本:9|rating.d.ts| +|起始版本有变化|类名:RectInterface<br>起始版本:7|类名:RectInterface<br>起始版本:9|rect.d.ts| +|起始版本有变化|类名:RectInterface<br>方法 or 属性:new (<br> value?:<br> {<br> width?: number \| string;<br> height?: number \| string;<br> radius?: number \| string \| Array\<any>;<br> }<br> \| {<br> width?: number \| string;<br> height?: number \| string;<br> radiusWidth?: number \| string;<br> radiusHeight?: number \| string;<br> },<br> ): RectAttribute;<br>起始版本:7|类名:RectInterface<br>方法 or 属性:new (<br> value?:<br> {<br> width?: number \| string;<br> height?: number \| string;<br> radius?: number \| string \| Array\<any>;<br> }<br> \| {<br> width?: number \| string;<br> height?: number \| string;<br> radiusWidth?: number \| string;<br> radiusHeight?: number \| string;<br> },<br> ): RectAttribute;<br>起始版本:9|rect.d.ts| +|起始版本有变化|类名:RectInterface<br>方法 or 属性:(<br> value?:<br> {<br> width?: number \| string;<br> height?: number \| string;<br> radius?: number \| string \| Array\<any>;<br> }<br> \| {<br> width?: number \| string;<br> height?: number \| string;<br> radiusWidth?: number \| string;<br> radiusHeight?: number \| string;<br> },<br> ): RectAttribute;<br>起始版本:7|类名:RectInterface<br>方法 or 属性:(<br> value?:<br> {<br> width?: number \| string;<br> height?: number \| string;<br> radius?: number \| string \| Array\<any>;<br> }<br> \| {<br> width?: number \| string;<br> height?: number \| string;<br> radiusWidth?: number \| string;<br> radiusHeight?: number \| string;<br> },<br> ): RectAttribute;<br>起始版本:9|rect.d.ts| +|起始版本有变化|类名:RectAttribute<br>起始版本:7|类名:RectAttribute<br>起始版本:9|rect.d.ts| +|起始版本有变化|类名:RectAttribute<br>方法 or 属性:radiusWidth(value: number \| string): RectAttribute;<br>起始版本:7|类名:RectAttribute<br>方法 or 属性:radiusWidth(value: number \| string): RectAttribute;<br>起始版本:9|rect.d.ts| +|起始版本有变化|类名:RectAttribute<br>方法 or 属性:radiusHeight(value: number \| string): RectAttribute;<br>起始版本:7|类名:RectAttribute<br>方法 or 属性:radiusHeight(value: number \| string): RectAttribute;<br>起始版本:9|rect.d.ts| +|起始版本有变化|类名:RectAttribute<br>方法 or 属性:radius(value: number \| string \| Array\<any>): RectAttribute;<br>起始版本:7|类名:RectAttribute<br>方法 or 属性:radius(value: number \| string \| Array\<any>): RectAttribute;<br>起始版本:9|rect.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Rect: RectInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Rect: RectInterface;<br>起始版本:9|rect.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Refresh: RefreshInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Refresh: RefreshInterface;<br>起始版本:8|refresh.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const RefreshInstance: RefreshAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const RefreshInstance: RefreshAttribute;<br>起始版本:8|refresh.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const RemoteWindow: RemoteWindowInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const RemoteWindow: RemoteWindowInterface;<br>起始版本:9|remote_window.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const RemoteWindowInstance: RemoteWindowAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const RemoteWindowInstance: RemoteWindowAttribute;<br>起始版本:9|remote_window.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const RichText: RichTextInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const RichText: RichTextInterface;<br>起始版本:8|rich_text.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const RichTextInstance: RichTextAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const RichTextInstance: RichTextAttribute;<br>起始版本:8|rich_text.d.ts| +|起始版本有变化|类名:RowInterface<br>起始版本:7|类名:RowInterface<br>起始版本:9|row.d.ts| +|起始版本有变化|类名:RowInterface<br>方法 or 属性:(value?: { space?: string \| number }): RowAttribute;<br>起始版本:7|类名:RowInterface<br>方法 or 属性:(value?: { space?: string \| number }): RowAttribute;<br>起始版本:9|row.d.ts| +|起始版本有变化|类名:RowAttribute<br>起始版本:7|类名:RowAttribute<br>起始版本:9|row.d.ts| +|起始版本有变化|类名:RowAttribute<br>方法 or 属性:alignItems(value: VerticalAlign): RowAttribute;<br>起始版本:7|类名:RowAttribute<br>方法 or 属性:alignItems(value: VerticalAlign): RowAttribute;<br>起始版本:9|row.d.ts| +|起始版本有变化|类名:RowAttribute<br>方法 or 属性:justifyContent(value: FlexAlign): RowAttribute;<br>起始版本:8|类名:RowAttribute<br>方法 or 属性:justifyContent(value: FlexAlign): RowAttribute;<br>起始版本:9|row.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Row: RowInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Row: RowInterface;<br>起始版本:9|row.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const RowInstance: RowAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const RowInstance: RowAttribute;<br>起始版本:9|row.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const RowSplit: RowSplitInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const RowSplit: RowSplitInterface;<br>起始版本:7|row_split.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const RowSplitInstance: RowSplitAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const RowSplitInstance: RowSplitAttribute;<br>起始版本:7|row_split.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Scroll: ScrollInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Scroll: ScrollInterface;<br>起始版本:7|scroll.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ScrollInstance: ScrollAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ScrollInstance: ScrollAttribute;<br>起始版本:7|scroll.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ScrollBar: ScrollBarInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ScrollBar: ScrollBarInterface;<br>起始版本:8|scroll_bar.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ScrollBarInstance: ScrollBarAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ScrollBarInstance: ScrollBarAttribute;<br>起始版本:8|scroll_bar.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Search: SearchInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Search: SearchInterface;<br>起始版本:8|search.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const SearchInstance: SearchAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const SearchInstance: SearchAttribute;<br>起始版本:8|search.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Select: SelectInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Select: SelectInterface;<br>起始版本:8|select.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const SelectInstance: SelectAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const SelectInstance: SelectAttribute;<br>起始版本:8|select.d.ts| +|起始版本有变化|类名:ShapeInterface<br>起始版本:7|类名:ShapeInterface<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:ShapeAttribute<br>起始版本:7|类名:ShapeAttribute<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:ShapeAttribute<br>方法 or 属性:viewPort(value: { x?: number \| string; y?: number \| string; width?: number \| string; height?: number \| string }): ShapeAttribute;<br>起始版本:7|类名:ShapeAttribute<br>方法 or 属性:viewPort(value: { x?: number \| string; y?: number \| string; width?: number \| string; height?: number \| string }): ShapeAttribute;<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:ShapeAttribute<br>方法 or 属性:stroke(value: ResourceColor): ShapeAttribute;<br>起始版本:7|类名:ShapeAttribute<br>方法 or 属性:stroke(value: ResourceColor): ShapeAttribute;<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:ShapeAttribute<br>方法 or 属性:fill(value: ResourceColor): ShapeAttribute;<br>起始版本:7|类名:ShapeAttribute<br>方法 or 属性:fill(value: ResourceColor): ShapeAttribute;<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:ShapeAttribute<br>方法 or 属性:strokeDashOffset(value: number \| string): ShapeAttribute;<br>起始版本:7|类名:ShapeAttribute<br>方法 or 属性:strokeDashOffset(value: number \| string): ShapeAttribute;<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:ShapeAttribute<br>方法 or 属性:strokeDashArray(value: Array\<any>): ShapeAttribute;<br>起始版本:7|类名:ShapeAttribute<br>方法 or 属性:strokeDashArray(value: Array\<any>): ShapeAttribute;<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:ShapeAttribute<br>方法 or 属性:strokeLineCap(value: LineCapStyle): ShapeAttribute;<br>起始版本:7|类名:ShapeAttribute<br>方法 or 属性:strokeLineCap(value: LineCapStyle): ShapeAttribute;<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:ShapeAttribute<br>方法 or 属性:strokeLineJoin(value: LineJoinStyle): ShapeAttribute;<br>起始版本:7|类名:ShapeAttribute<br>方法 or 属性:strokeLineJoin(value: LineJoinStyle): ShapeAttribute;<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:ShapeAttribute<br>方法 or 属性:strokeMiterLimit(value: number \| string): ShapeAttribute;<br>起始版本:7|类名:ShapeAttribute<br>方法 or 属性:strokeMiterLimit(value: number \| string): ShapeAttribute;<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:ShapeAttribute<br>方法 or 属性:strokeOpacity(value: number \| string \| Resource): ShapeAttribute;<br>起始版本:7|类名:ShapeAttribute<br>方法 or 属性:strokeOpacity(value: number \| string \| Resource): ShapeAttribute;<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:ShapeAttribute<br>方法 or 属性:fillOpacity(value: number \| string \| Resource): ShapeAttribute;<br>起始版本:7|类名:ShapeAttribute<br>方法 or 属性:fillOpacity(value: number \| string \| Resource): ShapeAttribute;<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:ShapeAttribute<br>方法 or 属性:strokeWidth(value: number \| string): ShapeAttribute;<br>起始版本:7|类名:ShapeAttribute<br>方法 or 属性:strokeWidth(value: number \| string): ShapeAttribute;<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:ShapeAttribute<br>方法 or 属性:antiAlias(value: boolean): ShapeAttribute;<br>起始版本:7|类名:ShapeAttribute<br>方法 or 属性:antiAlias(value: boolean): ShapeAttribute;<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:ShapeAttribute<br>方法 or 属性:mesh(value: Array\<any>, column: number, row: number): ShapeAttribute;<br>起始版本:8|类名:ShapeAttribute<br>方法 or 属性:mesh(value: Array\<any>, column: number, row: number): ShapeAttribute;<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Shape: ShapeInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Shape: ShapeInterface;<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ShapeInstance: ShapeAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ShapeInstance: ShapeAttribute;<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const SideBarContainer: SideBarContainerInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const SideBarContainer: SideBarContainerInterface;<br>起始版本:8|sidebar.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const SideBarContainerInstance: SideBarContainerAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const SideBarContainerInstance: SideBarContainerAttribute;<br>起始版本:8|sidebar.d.ts| +|起始版本有变化|类名:SliderStyle<br>起始版本:7|类名:SliderStyle<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderStyle<br>方法 or 属性:OutSet<br>起始版本:7|类名:SliderStyle<br>方法 or 属性:OutSet<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderStyle<br>方法 or 属性:InSet<br>起始版本:7|类名:SliderStyle<br>方法 or 属性:InSet<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderChangeMode<br>起始版本:7|类名:SliderChangeMode<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderChangeMode<br>方法 or 属性:Begin<br>起始版本:7|类名:SliderChangeMode<br>方法 or 属性:Begin<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderChangeMode<br>方法 or 属性:Moving<br>起始版本:7|类名:SliderChangeMode<br>方法 or 属性:Moving<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderChangeMode<br>方法 or 属性:End<br>起始版本:7|类名:SliderChangeMode<br>方法 or 属性:End<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderChangeMode<br>方法 or 属性:Click<br>起始版本:8|类名:SliderChangeMode<br>方法 or 属性:Click<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderOptions<br>起始版本:7|类名:SliderOptions<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderOptions<br>方法 or 属性:value?: number;<br>起始版本:7|类名:SliderOptions<br>方法 or 属性:value?: number;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderOptions<br>方法 or 属性:min?: number;<br>起始版本:7|类名:SliderOptions<br>方法 or 属性:min?: number;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderOptions<br>方法 or 属性:max?: number;<br>起始版本:7|类名:SliderOptions<br>方法 or 属性:max?: number;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderOptions<br>方法 or 属性:step?: number;<br>起始版本:7|类名:SliderOptions<br>方法 or 属性:step?: number;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderOptions<br>方法 or 属性:style?: SliderStyle;<br>起始版本:7|类名:SliderOptions<br>方法 or 属性:style?: SliderStyle;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderOptions<br>方法 or 属性:direction?: Axis;<br>起始版本:8|类名:SliderOptions<br>方法 or 属性:direction?: Axis;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderOptions<br>方法 or 属性:reverse?: boolean;<br>起始版本:8|类名:SliderOptions<br>方法 or 属性:reverse?: boolean;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderInterface<br>起始版本:7|类名:SliderInterface<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderInterface<br>方法 or 属性:(options?: SliderOptions): SliderAttribute;<br>起始版本:7|类名:SliderInterface<br>方法 or 属性:(options?: SliderOptions): SliderAttribute;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderAttribute<br>起始版本:7|类名:SliderAttribute<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderAttribute<br>方法 or 属性:blockColor(value: ResourceColor): SliderAttribute;<br>起始版本:7|类名:SliderAttribute<br>方法 or 属性:blockColor(value: ResourceColor): SliderAttribute;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderAttribute<br>方法 or 属性:trackColor(value: ResourceColor): SliderAttribute;<br>起始版本:7|类名:SliderAttribute<br>方法 or 属性:trackColor(value: ResourceColor): SliderAttribute;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderAttribute<br>方法 or 属性:selectedColor(value: ResourceColor): SliderAttribute;<br>起始版本:7|类名:SliderAttribute<br>方法 or 属性:selectedColor(value: ResourceColor): SliderAttribute;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderAttribute<br>方法 or 属性:showSteps(value: boolean): SliderAttribute;<br>起始版本:7|类名:SliderAttribute<br>方法 or 属性:showSteps(value: boolean): SliderAttribute;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderAttribute<br>方法 or 属性:showTips(value: boolean): SliderAttribute;<br>起始版本:7|类名:SliderAttribute<br>方法 or 属性:showTips(value: boolean): SliderAttribute;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderAttribute<br>方法 or 属性:trackThickness(value: Length): SliderAttribute;<br>起始版本:8|类名:SliderAttribute<br>方法 or 属性:trackThickness(value: Length): SliderAttribute;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderAttribute<br>方法 or 属性:onChange(callback: (value: number, mode: SliderChangeMode) => void): SliderAttribute;<br>起始版本:7|类名:SliderAttribute<br>方法 or 属性:onChange(callback: (value: number, mode: SliderChangeMode) => void): SliderAttribute;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Slider: SliderInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Slider: SliderInterface;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const SliderInstance: SliderAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const SliderInstance: SliderAttribute;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SpanInterface<br>起始版本:7|类名:SpanInterface<br>起始版本:9|span.d.ts| +|起始版本有变化|类名:SpanInterface<br>方法 or 属性:(value: string \| Resource): SpanAttribute;<br>起始版本:7|类名:SpanInterface<br>方法 or 属性:(value: string \| Resource): SpanAttribute;<br>起始版本:9|span.d.ts| +|起始版本有变化|类名:SpanAttribute<br>起始版本:7|类名:SpanAttribute<br>起始版本:9|span.d.ts| +|起始版本有变化|类名:SpanAttribute<br>方法 or 属性:fontColor(value: ResourceColor): SpanAttribute;<br>起始版本:7|类名:SpanAttribute<br>方法 or 属性:fontColor(value: ResourceColor): SpanAttribute;<br>起始版本:9|span.d.ts| +|起始版本有变化|类名:SpanAttribute<br>方法 or 属性:fontSize(value: number \| string \| Resource): SpanAttribute;<br>起始版本:7|类名:SpanAttribute<br>方法 or 属性:fontSize(value: number \| string \| Resource): SpanAttribute;<br>起始版本:9|span.d.ts| +|起始版本有变化|类名:SpanAttribute<br>方法 or 属性:fontStyle(value: FontStyle): SpanAttribute;<br>起始版本:7|类名:SpanAttribute<br>方法 or 属性:fontStyle(value: FontStyle): SpanAttribute;<br>起始版本:9|span.d.ts| +|起始版本有变化|类名:SpanAttribute<br>方法 or 属性:fontWeight(value: number \| FontWeight \| string): SpanAttribute;<br>起始版本:7|类名:SpanAttribute<br>方法 or 属性:fontWeight(value: number \| FontWeight \| string): SpanAttribute;<br>起始版本:9|span.d.ts| +|起始版本有变化|类名:SpanAttribute<br>方法 or 属性:fontFamily(value: string \| Resource): SpanAttribute;<br>起始版本:7|类名:SpanAttribute<br>方法 or 属性:fontFamily(value: string \| Resource): SpanAttribute;<br>起始版本:9|span.d.ts| +|起始版本有变化|类名:SpanAttribute<br>方法 or 属性:decoration(value: { type: TextDecorationType; color?: ResourceColor }): SpanAttribute;<br>起始版本:7|类名:SpanAttribute<br>方法 or 属性:decoration(value: { type: TextDecorationType; color?: ResourceColor }): SpanAttribute;<br>起始版本:9|span.d.ts| +|起始版本有变化|类名:SpanAttribute<br>方法 or 属性:letterSpacing(value: number \| string): SpanAttribute;<br>起始版本:7|类名:SpanAttribute<br>方法 or 属性:letterSpacing(value: number \| string): SpanAttribute;<br>起始版本:9|span.d.ts| +|起始版本有变化|类名:SpanAttribute<br>方法 or 属性:textCase(value: TextCase): SpanAttribute;<br>起始版本:N/A|类名:SpanAttribute<br>方法 or 属性:textCase(value: TextCase): SpanAttribute;<br>起始版本:9|span.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Span: SpanInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Span: SpanInterface;<br>起始版本:9|span.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const SpanInstance: SpanAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const SpanInstance: SpanAttribute;<br>起始版本:9|span.d.ts| +|起始版本有变化|类名:StackInterface<br>起始版本:7|类名:StackInterface<br>起始版本:9|stack.d.ts| +|起始版本有变化|类名:StackInterface<br>方法 or 属性:(value?: { alignContent?: Alignment }): StackAttribute;<br>起始版本:7|类名:StackInterface<br>方法 or 属性:(value?: { alignContent?: Alignment }): StackAttribute;<br>起始版本:9|stack.d.ts| +|起始版本有变化|类名:StackAttribute<br>起始版本:7|类名:StackAttribute<br>起始版本:9|stack.d.ts| +|起始版本有变化|类名:StackAttribute<br>方法 or 属性:alignContent(value: Alignment): StackAttribute;<br>起始版本:7|类名:StackAttribute<br>方法 or 属性:alignContent(value: Alignment): StackAttribute;<br>起始版本:9|stack.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Stack: StackInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Stack: StackInterface;<br>起始版本:9|stack.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const StackInstance: StackAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const StackInstance: StackAttribute;<br>起始版本:9|stack.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Stepper: StepperInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Stepper: StepperInterface;<br>起始版本:8|stepper.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const StepperInstance: StepperAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const StepperInstance: StepperAttribute;<br>起始版本:8|stepper.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const StepperItemInstance: StepperItemAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const StepperItemInstance: StepperItemAttribute;<br>起始版本:8|stepper_item.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const StepperItem: StepperItemInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const StepperItem: StepperItemInterface;<br>起始版本:8|stepper_item.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Swiper: SwiperInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Swiper: SwiperInterface;<br>起始版本:7|swiper.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const SwiperInstance: SwiperAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const SwiperInstance: SwiperAttribute;<br>起始版本:7|swiper.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Tabs: TabsInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Tabs: TabsInterface;<br>起始版本:7|tabs.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TabsInstance: TabsAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TabsInstance: TabsAttribute;<br>起始版本:7|tabs.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TabContent: TabContentInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TabContent: TabContentInterface;<br>起始版本:7|tab_content.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TabContentInstance: TabContentAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TabContentInstance: TabContentAttribute;<br>起始版本:7|tab_content.d.ts| +|起始版本有变化|类名:TextInterface<br>起始版本:7|类名:TextInterface<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextInterface<br>方法 or 属性:(content?: string \| Resource): TextAttribute;<br>起始版本:7|类名:TextInterface<br>方法 or 属性:(content?: string \| Resource): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>起始版本:7|类名:TextAttribute<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>方法 or 属性:fontColor(value: ResourceColor): TextAttribute;<br>起始版本:7|类名:TextAttribute<br>方法 or 属性:fontColor(value: ResourceColor): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>方法 or 属性:fontSize(value: number \| string \| Resource): TextAttribute;<br>起始版本:7|类名:TextAttribute<br>方法 or 属性:fontSize(value: number \| string \| Resource): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>方法 or 属性:minFontSize(value: number \| string \| Resource): TextAttribute;<br>起始版本:7|类名:TextAttribute<br>方法 or 属性:minFontSize(value: number \| string \| Resource): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>方法 or 属性:maxFontSize(value: number \| string \| Resource): TextAttribute;<br>起始版本:7|类名:TextAttribute<br>方法 or 属性:maxFontSize(value: number \| string \| Resource): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>方法 or 属性:fontStyle(value: FontStyle): TextAttribute;<br>起始版本:7|类名:TextAttribute<br>方法 or 属性:fontStyle(value: FontStyle): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>方法 or 属性:fontWeight(value: number \| FontWeight \| string): TextAttribute;<br>起始版本:7|类名:TextAttribute<br>方法 or 属性:fontWeight(value: number \| FontWeight \| string): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>方法 or 属性:textAlign(value: TextAlign): TextAttribute;<br>起始版本:7|类名:TextAttribute<br>方法 or 属性:textAlign(value: TextAlign): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>方法 or 属性:lineHeight(value: number \| string \| Resource): TextAttribute;<br>起始版本:7|类名:TextAttribute<br>方法 or 属性:lineHeight(value: number \| string \| Resource): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>方法 or 属性:textOverflow(value: { overflow: TextOverflow }): TextAttribute;<br>起始版本:7|类名:TextAttribute<br>方法 or 属性:textOverflow(value: { overflow: TextOverflow }): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>方法 or 属性:fontFamily(value: string \| Resource): TextAttribute;<br>起始版本:7|类名:TextAttribute<br>方法 or 属性:fontFamily(value: string \| Resource): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>方法 or 属性:maxLines(value: number): TextAttribute;<br>起始版本:7|类名:TextAttribute<br>方法 or 属性:maxLines(value: number): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>方法 or 属性:decoration(value: { type: TextDecorationType; color?: ResourceColor }): TextAttribute;<br>起始版本:7|类名:TextAttribute<br>方法 or 属性:decoration(value: { type: TextDecorationType; color?: ResourceColor }): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>方法 or 属性:letterSpacing(value: number \| string): TextAttribute;<br>起始版本:7|类名:TextAttribute<br>方法 or 属性:letterSpacing(value: number \| string): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>方法 or 属性:textCase(value: TextCase): TextAttribute;<br>起始版本:7|类名:TextAttribute<br>方法 or 属性:textCase(value: TextCase): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>方法 or 属性:baselineOffset(value: number \| string): TextAttribute;<br>起始版本:7|类名:TextAttribute<br>方法 or 属性:baselineOffset(value: number \| string): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TextInstance: TextAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TextInstance: TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Text: TextInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Text: TextInterface;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TextArea: TextAreaInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TextArea: TextAreaInterface;<br>起始版本:7|text_area.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TextAreaInstance: TextAreaAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TextAreaInstance: TextAreaAttribute;<br>起始版本:7|text_area.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TextClock: TextClockInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TextClock: TextClockInterface;<br>起始版本:8|text_clock.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TextClockInstance: TextClockAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TextClockInstance: TextClockAttribute;<br>起始版本:8|text_clock.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TextInput: TextInputInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TextInput: TextInputInterface;<br>起始版本:7|text_input.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TextInputInstance: TextInputAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TextInputInstance: TextInputAttribute;<br>起始版本:7|text_input.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TextPicker: TextPickerInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TextPicker: TextPickerInterface;<br>起始版本:8|text_picker.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TextPickerInstance: TextPickerAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TextPickerInstance: TextPickerAttribute;<br>起始版本:8|text_picker.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TextTimer: TextTimerInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TextTimer: TextTimerInterface;<br>起始版本:8|text_timer.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TextTimerInstance: TextTimerAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TextTimerInstance: TextTimerAttribute;<br>起始版本:8|text_timer.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TimePicker: TimePickerInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TimePicker: TimePickerInterface;<br>起始版本:8|time_picker.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TimePickerInstance: TimePickerAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TimePickerInstance: TimePickerAttribute;<br>起始版本:8|time_picker.d.ts| +|起始版本有变化|类名:ToggleType<br>起始版本:8|类名:ToggleType<br>起始版本:9|toggle.d.ts| +|起始版本有变化|类名:ToggleType<br>方法 or 属性:Checkbox<br>起始版本:8|类名:ToggleType<br>方法 or 属性:Checkbox<br>起始版本:9|toggle.d.ts| +|起始版本有变化|类名:ToggleType<br>方法 or 属性:Switch<br>起始版本:8|类名:ToggleType<br>方法 or 属性:Switch<br>起始版本:9|toggle.d.ts| +|起始版本有变化|类名:ToggleType<br>方法 or 属性:Button<br>起始版本:8|类名:ToggleType<br>方法 or 属性:Button<br>起始版本:9|toggle.d.ts| +|起始版本有变化|类名:ToggleInterface<br>起始版本:8|类名:ToggleInterface<br>起始版本:9|toggle.d.ts| +|起始版本有变化|类名:ToggleInterface<br>方法 or 属性:(options: { type: ToggleType; isOn?: boolean }): ToggleAttribute;<br>起始版本:8|类名:ToggleInterface<br>方法 or 属性:(options: { type: ToggleType; isOn?: boolean }): ToggleAttribute;<br>起始版本:9|toggle.d.ts| +|起始版本有变化|类名:ToggleAttribute<br>起始版本:8|类名:ToggleAttribute<br>起始版本:9|toggle.d.ts| +|起始版本有变化|类名:ToggleAttribute<br>方法 or 属性:onChange(callback: (isOn: boolean) => void): ToggleAttribute;<br>起始版本:8|类名:ToggleAttribute<br>方法 or 属性:onChange(callback: (isOn: boolean) => void): ToggleAttribute;<br>起始版本:9|toggle.d.ts| +|起始版本有变化|类名:ToggleAttribute<br>方法 or 属性:selectedColor(value: ResourceColor): ToggleAttribute;<br>起始版本:8|类名:ToggleAttribute<br>方法 or 属性:selectedColor(value: ResourceColor): ToggleAttribute;<br>起始版本:9|toggle.d.ts| +|起始版本有变化|类名:ToggleAttribute<br>方法 or 属性:switchPointColor(color: ResourceColor): ToggleAttribute;<br>起始版本:8|类名:ToggleAttribute<br>方法 or 属性:switchPointColor(color: ResourceColor): ToggleAttribute;<br>起始版本:9|toggle.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Toggle: ToggleInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Toggle: ToggleInterface;<br>起始版本:9|toggle.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ToggleInstance: ToggleAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ToggleInstance: ToggleAttribute;<br>起始版本:9|toggle.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Video: VideoInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Video: VideoInterface;<br>起始版本:7|video.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const VideoInstance: VideoAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const VideoInstance: VideoAttribute;<br>起始版本:7|video.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const WaterFlow: WaterFlowInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const WaterFlow: WaterFlowInterface;<br>起始版本:9|water_flow.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const WaterFlowInstance: WaterFlowAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const WaterFlowInstance: WaterFlowAttribute;<br>起始版本:9|water_flow.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Web: WebInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Web: WebInterface;<br>起始版本:8|web.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const WebInstance: WebAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const WebInstance: WebAttribute;<br>起始版本:8|web.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const XComponent: XComponentInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const XComponent: XComponentInterface;<br>起始版本:8|xcomponent.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const XComponentInstance: XComponentAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const XComponentInstance: XComponentAttribute;<br>起始版本:8|xcomponent.d.ts| +|SysCap有变化|类名:console<br>方法 or 属性:static debug(message: string, ...arguments: any[]): void;<br>SysCap:SystemCapability.ArkUI.ArkUI.Full|类名:console<br>方法 or 属性:static debug(message: string, ...arguments: any[]): void;<br>SysCap:N/A|global.d.ts| +|SysCap有变化|类名:console<br>方法 or 属性:static log(message: string, ...arguments: any[]): void;<br>SysCap:SystemCapability.ArkUI.ArkUI.Full|类名:console<br>方法 or 属性:static log(message: string, ...arguments: any[]): void;<br>SysCap:N/A|global.d.ts| +|SysCap有变化|类名:console<br>方法 or 属性:static info(message: string, ...arguments: any[]): void;<br>SysCap:SystemCapability.ArkUI.ArkUI.Full|类名:console<br>方法 or 属性:static info(message: string, ...arguments: any[]): void;<br>SysCap:N/A|global.d.ts| +|SysCap有变化|类名:console<br>方法 or 属性:static warn(message: string, ...arguments: any[]): void;<br>SysCap:SystemCapability.ArkUI.ArkUI.Full|类名:console<br>方法 or 属性:static warn(message: string, ...arguments: any[]): void;<br>SysCap:N/A|global.d.ts| +|SysCap有变化|类名:console<br>方法 or 属性:static error(message: string, ...arguments: any[]): void;<br>SysCap:SystemCapability.ArkUI.ArkUI.Full|类名:console<br>方法 or 属性:static error(message: string, ...arguments: any[]): void;<br>SysCap:N/A|global.d.ts| +|SysCap有变化|类名:TabContentInterface<br>SysCap:N/A|类名:TabContentInterface<br>SysCap:SystemCapability.ArkUI.ArkUI.Full|tab_content.d.ts| +|SysCap有变化|类名:TabContentInterface<br>方法 or 属性:(): TabContentAttribute;<br>SysCap:N/A|类名:TabContentInterface<br>方法 or 属性:(): TabContentAttribute;<br>SysCap:SystemCapability.ArkUI.ArkUI.Full|tab_content.d.ts| +|SysCap有变化|类名:TabContentAttribute<br>SysCap:N/A|类名:TabContentAttribute<br>SysCap:SystemCapability.ArkUI.ArkUI.Full|tab_content.d.ts| +|SysCap有变化|类名:TabContentAttribute<br>方法 or 属性:tabBar(value: string \| Resource \| CustomBuilder \|<br> { icon?: string \| Resource; text?: string \| Resource }): TabContentAttribute;<br>SysCap:N/A|类名:TabContentAttribute<br>方法 or 属性:tabBar(value: string \| Resource \| CustomBuilder \|<br> { icon?: string \| Resource; text?: string \| Resource }): TabContentAttribute;<br>SysCap:SystemCapability.ArkUI.ArkUI.Full|tab_content.d.ts| +|SysCap有变化|类名:global<br>方法 or 属性:declare const TabContent: TabContentInterface;<br>SysCap:N/A|类名:global<br>方法 or 属性:declare const TabContent: TabContentInterface;<br>SysCap:SystemCapability.ArkUI.ArkUI.Full|tab_content.d.ts| +|SysCap有变化|类名:global<br>方法 or 属性:declare const TabContentInstance: TabContentAttribute;<br>SysCap:N/A|类名:global<br>方法 or 属性:declare const TabContentInstance: TabContentAttribute;<br>SysCap:SystemCapability.ArkUI.ArkUI.Full|tab_content.d.ts| +|函数有变化|类名:<br>方法 or 属性: function getInspectorTree(): string;<br>|类名:<br>方法 or 属性: function getInspectorTree(): Object;<br>|global.d.ts| +|函数有变化|类名:LocalStorage<br>方法 or 属性:get\<T>(propName: string): T;<br>|类名:LocalStorage<br>方法 or 属性:get\<T>(propName: string): T \| undefined;<br>|common_ts_ets_api.d.ts| +|函数有变化|类名:LocalStorage<br>方法 or 属性:setOrCreate\<T>(propName: string, newValue?: T): boolean;<br>|类名:LocalStorage<br>方法 or 属性:setOrCreate\<T>(propName: string, newValue: T): boolean;<br>|common_ts_ets_api.d.ts| +|函数有变化|类名:LocalStorage<br>方法 or 属性:link\<T>(propName: string, linkUser?: T, subscribersName?: string): T;<br>|类名:LocalStorage<br>方法 or 属性:link\<T>(propName: string): SubscribedAbstractProperty\<T>;<br>|common_ts_ets_api.d.ts| +|函数有变化|类名:LocalStorage<br>方法 or 属性:setAndLink\<T>(propName: string, defaultValue: T, linkUser?: T, subscribersName?: string): T;<br>|类名:LocalStorage<br>方法 or 属性:setAndLink\<T>(propName: string, defaultValue: T): SubscribedAbstractProperty\<T>;<br>|common_ts_ets_api.d.ts| +|函数有变化|类名:LocalStorage<br>方法 or 属性:prop\<T>(propName: string, propUser?: T, subscribersName?: string): T;<br>|类名:LocalStorage<br>方法 or 属性:prop\<S>(propName: string): SubscribedAbstractProperty\<S>;<br>|common_ts_ets_api.d.ts| +|函数有变化|类名:LocalStorage<br>方法 or 属性:setAndProp\<T>(propName: string, defaultValue: T, propUser?: T, subscribersName?: string): T;<br>|类名:LocalStorage<br>方法 or 属性:setAndProp\<S>(propName: string, defaultValue: S): SubscribedAbstractProperty\<S>;<br>|common_ts_ets_api.d.ts| diff --git a/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-battery.md b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-battery.md new file mode 100644 index 0000000000000000000000000000000000000000..8ea014b7b3c716bcf205c3ef49f426a64d1544d0 --- /dev/null +++ b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-battery.md @@ -0,0 +1,38 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|类名:BatteryCapacityLevel<br>方法or属性:LEVEL_WARNING|@ohos.batteryInfo.d.ts| +|新增|NA|类名:BatteryCapacityLevel<br>方法or属性:LEVEL_SHUTDOWN|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedKey|@ohos.batteryInfo.d.ts| +|新增|NA|类名:CommonEventBatteryChangedKey<br>方法or属性:|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedKey<br>方法 or 属性:EXTRA_SOC = "soc"|@ohos.batteryInfo.d.ts| +|新增|NA|类名:CommonEventBatteryChangedKey<br>方法or属性:EXTRA_SOC = "soc"|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedKey<br>方法 or 属性:EXTRA_CHARGE_STATE = "chargeState"|@ohos.batteryInfo.d.ts| +|新增|NA|类名:CommonEventBatteryChangedKey<br>方法or属性:EXTRA_CHARGE_STATE = "chargeState"|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedKey<br>方法 or 属性:EXTRA_HEALTH_STATE = "healthState"|@ohos.batteryInfo.d.ts| +|新增|NA|类名:CommonEventBatteryChangedKey<br>方法or属性:EXTRA_HEALTH_STATE = "healthState"|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedKey<br>方法 or 属性:EXTRA_PLUGGED_TYPE = "pluggedType"|@ohos.batteryInfo.d.ts| +|新增|NA|类名:CommonEventBatteryChangedKey<br>方法or属性:EXTRA_PLUGGED_TYPE = "pluggedType"|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedKey<br>方法 or 属性:EXTRA_VOLTAGE = "voltage"|@ohos.batteryInfo.d.ts| +|新增|NA|类名:CommonEventBatteryChangedKey<br>方法or属性:EXTRA_VOLTAGE = "voltage"|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedKey<br>方法 or 属性:EXTRA_TECHNOLOGY = "technology"|@ohos.batteryInfo.d.ts| +|新增|NA|类名:CommonEventBatteryChangedKey<br>方法or属性:EXTRA_TECHNOLOGY = "technology"|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedKey<br>方法 or 属性:EXTRA_TEMPERATURE = "temperature"|@ohos.batteryInfo.d.ts| +|新增|NA|类名:CommonEventBatteryChangedKey<br>方法or属性:EXTRA_TEMPERATURE = "temperature"|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedKey<br>方法 or 属性:EXTRA_PRESENT = "present"|@ohos.batteryInfo.d.ts| +|新增|NA|类名:CommonEventBatteryChangedKey<br>方法or属性:EXTRA_PRESENT = "present"|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedKey<br>方法 or 属性:EXTRA_CAPACITY_LEVEL = "capacityLevel"|@ohos.batteryInfo.d.ts| +|新增|NA|类名:CommonEventBatteryChangedKey<br>方法or属性:EXTRA_CAPACITY_LEVEL = "capacityLevel"|@ohos.batteryInfo.d.ts| +|删除|模块名:ohos.batteryInfo<br>类名:BatteryCapacityLevel<br>方法 or 属性:LEVEL_NONE|NA|@ohos.batteryInfo.d.ts| +|删除|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedCode|NA|@ohos.batteryInfo.d.ts| +|删除|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedCode<br>方法 or 属性:EXTRA_SOC = 0|NA|@ohos.batteryInfo.d.ts| +|删除|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedCode<br>方法 or 属性:EXTRA_VOLTAGE|NA|@ohos.batteryInfo.d.ts| +|删除|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedCode<br>方法 or 属性:EXTRA_TEMPERATURE|NA|@ohos.batteryInfo.d.ts| +|删除|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedCode<br>方法 or 属性:EXTRA_HEALTH_STATE|NA|@ohos.batteryInfo.d.ts| +|删除|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedCode<br>方法 or 属性:EXTRA_PLUGGED_TYPE|NA|@ohos.batteryInfo.d.ts| +|删除|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedCode<br>方法 or 属性:EXTRA_MAX_CURRENT|NA|@ohos.batteryInfo.d.ts| +|删除|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedCode<br>方法 or 属性:EXTRA_MAX_VOLTAGE|NA|@ohos.batteryInfo.d.ts| +|删除|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedCode<br>方法 or 属性:EXTRA_CHARGE_STATE|NA|@ohos.batteryInfo.d.ts| +|删除|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedCode<br>方法 or 属性:EXTRA_CHARGE_COUNTER|NA|@ohos.batteryInfo.d.ts| +|删除|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedCode<br>方法 or 属性:EXTRA_PRESENT|NA|@ohos.batteryInfo.d.ts| +|删除|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedCode<br>方法 or 属性:EXTRA_TECHNOLOGY|NA|@ohos.batteryInfo.d.ts| +|访问级别有变化|类名:batteryInfo<br>方法 or 属性:const estimatedRemainingChargeTime: number;<br>访问级别:公开API|类名:batteryInfo<br>方法 or 属性:const estimatedRemainingChargeTime: number;<br>访问级别:系统API|@ohos.batteryInfo.d.ts| diff --git a/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-bundle.md b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-bundle.md new file mode 100644 index 0000000000000000000000000000000000000000..80e6361ca7b6a55649b3dd5b05cca56d26449fa6 --- /dev/null +++ b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-bundle.md @@ -0,0 +1,351 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|类名:LaunchType<br>方法or属性:MULTITON = 1|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ModuleType|@ohos.bundle.bundleManager.d.ts| +|新增|NA|类名:ModuleType<br>方法or属性:|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ModuleType<br>方法 or 属性:ENTRY = 1|@ohos.bundle.bundleManager.d.ts| +|新增|NA|类名:ModuleType<br>方法or属性:ENTRY = 1|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ModuleType<br>方法 or 属性:FEATURE = 2|@ohos.bundle.bundleManager.d.ts| +|新增|NA|类名:ModuleType<br>方法or属性:FEATURE = 2|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ModuleType<br>方法 or 属性:SHARED = 3|@ohos.bundle.bundleManager.d.ts| +|新增|NA|类名:ModuleType<br>方法or属性:SHARED = 3|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: BundleType|@ohos.bundle.bundleManager.d.ts| +|新增|NA|类名:BundleType<br>方法or属性:|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: BundleType<br>方法 or 属性:APP = 0|@ohos.bundle.bundleManager.d.ts| +|新增|NA|类名:BundleType<br>方法or属性:APP = 0|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: BundleType<br>方法 or 属性:ATOMIC_SERVICE = 1|@ohos.bundle.bundleManager.d.ts| +|新增|NA|类名:BundleType<br>方法or属性:ATOMIC_SERVICE = 1|@ohos.bundle.bundleManager.d.ts| +|新增|NA|类名:BundleInstaller<br>方法or属性:install(hapFilePaths: Array\<string>, callback: AsyncCallback\<void>) : void;|@ohos.bundle.installer.d.ts| +|新增|NA|类名:BundleInstaller<br>方法or属性:recover(bundleName: string, callback: AsyncCallback\<void>): void;|@ohos.bundle.installer.d.ts| +|新增|NA|类名:InstallParam<br>方法or属性:userId?: number;|@ohos.bundle.installer.d.ts| +|新增|NA|类名:InstallParam<br>方法or属性:installFlag?: number;|@ohos.bundle.installer.d.ts| +|新增|NA|类名:InstallParam<br>方法or属性:isKeepData?: boolean;|@ohos.bundle.installer.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly bundleName: string;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly moduleName: string;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly name: string;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly label: string;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly labelId: number;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly description: string;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly descriptionId: number;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly icon: string;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly iconId: number;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly process: string;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly exported: boolean;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly type: bundleManager.AbilityType;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly orientation: bundleManager.DisplayOrientation;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly launchType: bundleManager.LaunchType;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly permissions: Array\<string>;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly readPermission: string;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly writePermission: string;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly uri: string;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly deviceTypes: Array\<string>;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly applicationInfo: ApplicationInfo;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly metadata: Array\<Metadata>;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly enabled: boolean;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly supportWindowModes: Array\<bundleManager.SupportWindowMode>;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly windowSize: WindowSize;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: WindowSize|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: WindowSize<br>方法 or 属性: readonly maxWindowRatio: number;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: WindowSize<br>方法 or 属性: readonly minWindowRatio: number;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: WindowSize<br>方法 or 属性: readonly maxWindowWidth: number;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: WindowSize<br>方法 or 属性: readonly minWindowWidth: number;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: WindowSize<br>方法 or 属性: readonly maxWindowHeight: number;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: WindowSize<br>方法 or 属性: readonly minWindowHeight: number;|AbilityInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly name: string;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly description: string;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly descriptionId: number;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly enabled: boolean;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly label: string;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly labelId: number;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly icon: string;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly iconId: number;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly process: string;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly permissions: Array\<string>;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly codePath: string;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly metadata: Map\<string, Array\<Metadata>>;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly removable: boolean;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly accessTokenId: number;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly uid: number;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly iconResource: Resource;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly labelResource: Resource;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly descriptionResource: Resource;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly appDistributionType: string;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly appProvisionType: string;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly systemApp: boolean;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly bundleType: bundleManager.BundleType;|ApplicationInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: BundleInfo|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: BundleInfo<br>方法 or 属性: readonly name: string;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: BundleInfo<br>方法 or 属性: readonly vendor: string;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: BundleInfo<br>方法 or 属性: readonly versionCode: number;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: BundleInfo<br>方法 or 属性: readonly versionName: string;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: BundleInfo<br>方法 or 属性: readonly minCompatibleVersionCode: number;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: BundleInfo<br>方法 or 属性: readonly targetVersion: number;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: BundleInfo<br>方法 or 属性: readonly appInfo: ApplicationInfo;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: BundleInfo<br>方法 or 属性: readonly hapModulesInfo: Array\<HapModuleInfo>;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: BundleInfo<br>方法 or 属性: readonly reqPermissionDetails: Array\<ReqPermissionDetail>;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: BundleInfo<br>方法 or 属性: readonly permissionGrantStates: Array\<bundleManager.PermissionGrantState>;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: BundleInfo<br>方法 or 属性: readonly signatureInfo: SignatureInfo;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: BundleInfo<br>方法 or 属性: readonly installTime: number;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: BundleInfo<br>方法 or 属性: readonly updateTime: number;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: ReqPermissionDetail|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: ReqPermissionDetail<br>方法 or 属性: name: string;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: ReqPermissionDetail<br>方法 or 属性: reason: string;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: ReqPermissionDetail<br>方法 or 属性: reasonId: number;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: ReqPermissionDetail<br>方法 or 属性: usedScene: UsedScene;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: UsedScene|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: UsedScene<br>方法 or 属性: abilities: Array\<string>;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: UsedScene<br>方法 or 属性: when: string;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: SignatureInfo|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: SignatureInfo<br>方法 or 属性: readonly appId: string;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: SignatureInfo<br>方法 or 属性: readonly fingerprint: string;|BundleInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: BundlePackInfo|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: BundlePackInfo<br>方法 or 属性: readonly packages: Array\<PackageConfig>;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: BundlePackInfo<br>方法 or 属性: readonly summary: PackageSummary;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: PackageConfig|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: PackageConfig<br>方法 or 属性: readonly deviceTypes: Array\<string>;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: PackageConfig<br>方法 or 属性: readonly name: string;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: PackageConfig<br>方法 or 属性: readonly moduleType: string;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: PackageConfig<br>方法 or 属性: readonly deliveryWithInstall: boolean;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: PackageSummary|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: PackageSummary<br>方法 or 属性: readonly app: BundleConfigInfo;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: PackageSummary<br>方法 or 属性: readonly modules: Array\<ModuleConfigInfo>;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: BundleConfigInfo|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: BundleConfigInfo<br>方法 or 属性: readonly bundleName: string;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: BundleConfigInfo<br>方法 or 属性: readonly version: Version;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ExtensionAbility|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ExtensionAbility<br>方法 or 属性: readonly name: string;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ExtensionAbility<br>方法 or 属性: readonly forms: Array\<AbilityFormInfo>;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleConfigInfo|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleConfigInfo<br>方法 or 属性: readonly mainAbility: string;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleConfigInfo<br>方法 or 属性: readonly apiVersion: ApiVersion;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleConfigInfo<br>方法 or 属性: readonly deviceTypes: Array\<string>;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleConfigInfo<br>方法 or 属性: readonly distro: ModuleDistroInfo;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleConfigInfo<br>方法 or 属性: readonly abilities: Array\<ModuleAbilityInfo>;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleConfigInfo<br>方法 or 属性: readonly extensionAbilities: Array\<ExtensionAbility>;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleDistroInfo|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleDistroInfo<br>方法 or 属性: readonly deliveryWithInstall: boolean;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleDistroInfo<br>方法 or 属性: readonly installationFree: boolean;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleDistroInfo<br>方法 or 属性: readonly moduleName: string;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleDistroInfo<br>方法 or 属性: readonly moduleType: string;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleAbilityInfo|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleAbilityInfo<br>方法 or 属性: readonly name: string;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleAbilityInfo<br>方法 or 属性: readonly label: string;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleAbilityInfo<br>方法 or 属性: readonly exported: boolean;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleAbilityInfo<br>方法 or 属性: readonly forms: Array\<AbilityFormInfo>;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: AbilityFormInfo|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: AbilityFormInfo<br>方法 or 属性: readonly name: string;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: AbilityFormInfo<br>方法 or 属性: readonly type: string;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: AbilityFormInfo<br>方法 or 属性: readonly updateEnabled: boolean;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: AbilityFormInfo<br>方法 or 属性: readonly scheduledUpdateTime: string;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: AbilityFormInfo<br>方法 or 属性: readonly updateDuration: number;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: AbilityFormInfo<br>方法 or 属性: readonly supportDimensions: Array\<string>;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: AbilityFormInfo<br>方法 or 属性: readonly defaultDimension: string;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: Version|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: Version<br>方法 or 属性: readonly minCompatibleVersionCode: number;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: Version<br>方法 or 属性: readonly name: string;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: Version<br>方法 or 属性: readonly code: number;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ApiVersion|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ApiVersion<br>方法 or 属性: readonly releaseType: string;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ApiVersion<br>方法 or 属性: readonly compatible: number;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ApiVersion<br>方法 or 属性: readonly target: number;|BundlePackInfo.d.ts| +|新增|NA|模块名: DispatchInfo<br>类名: DispatchInfo|DispatchInfo.d.ts| +|新增|NA|模块名: DispatchInfo<br>类名: DispatchInfo<br>方法 or 属性: readonly version: string;|DispatchInfo.d.ts| +|新增|NA|模块名: DispatchInfo<br>类名: DispatchInfo<br>方法 or 属性: readonly dispatchAPIVersion: string;|DispatchInfo.d.ts| +|新增|NA|模块名: ElementName<br>类名: ElementName|ElementName.d.ts| +|新增|NA|模块名: ElementName<br>类名: ElementName<br>方法 or 属性: deviceId?: string;|ElementName.d.ts| +|新增|NA|模块名: ElementName<br>类名: ElementName<br>方法 or 属性: bundleName: string;|ElementName.d.ts| +|新增|NA|模块名: ElementName<br>类名: ElementName<br>方法 or 属性: moduleName?: string;|ElementName.d.ts| +|新增|NA|模块名: ElementName<br>类名: ElementName<br>方法 or 属性: abilityName: string;|ElementName.d.ts| +|新增|NA|模块名: ElementName<br>类名: ElementName<br>方法 or 属性: uri?: string;|ElementName.d.ts| +|新增|NA|模块名: ElementName<br>类名: ElementName<br>方法 or 属性: shortName?: string;|ElementName.d.ts| +|新增|NA|模块名: ExtensionAbilityInfo<br>类名: ExtensionAbilityInfo|ExtensionAbilityInfo.d.ts| +|新增|NA|模块名: ExtensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性: readonly bundleName: string;|ExtensionAbilityInfo.d.ts| +|新增|NA|模块名: ExtensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性: readonly moduleName: string;|ExtensionAbilityInfo.d.ts| +|新增|NA|模块名: ExtensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性: readonly name: string;|ExtensionAbilityInfo.d.ts| +|新增|NA|模块名: ExtensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性: readonly labelId: number;|ExtensionAbilityInfo.d.ts| +|新增|NA|模块名: ExtensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性: readonly descriptionId: number;|ExtensionAbilityInfo.d.ts| +|新增|NA|模块名: ExtensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性: readonly iconId: number;|ExtensionAbilityInfo.d.ts| +|新增|NA|模块名: ExtensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性: readonly exported: boolean;|ExtensionAbilityInfo.d.ts| +|新增|NA|模块名: ExtensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性: readonly extensionAbilityType: bundleManager.ExtensionAbilityType;|ExtensionAbilityInfo.d.ts| +|新增|NA|模块名: ExtensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性: readonly permissions: Array\<string>;|ExtensionAbilityInfo.d.ts| +|新增|NA|模块名: ExtensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性: readonly applicationInfo: ApplicationInfo;|ExtensionAbilityInfo.d.ts| +|新增|NA|模块名: ExtensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性: readonly metadata: Array\<Metadata>;|ExtensionAbilityInfo.d.ts| +|新增|NA|模块名: ExtensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性: readonly enabled: boolean;|ExtensionAbilityInfo.d.ts| +|新增|NA|模块名: ExtensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性: readonly readPermission: string;|ExtensionAbilityInfo.d.ts| +|新增|NA|模块名: ExtensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性: readonly writePermission: string;|ExtensionAbilityInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly name: string;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly icon: string;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly iconId: number;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly label: string;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly labelId: number;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly description: string;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly descriptionId: number;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly mainElementName: string;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly abilitiesInfo: Array\<AbilityInfo>;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly extensionAbilitiesInfo: Array\<ExtensionAbilityInfo>;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly metadata: Array\<Metadata>;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly deviceTypes: Array\<string>;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly installationFree: boolean;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly hashValue: string;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly type: bundleManager.ModuleType;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly dependencies: Array\<Dependency>;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly preloads: Array\<PreloadItem>;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: Dependency|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: Dependency<br>方法 or 属性: readonly moduleName: string;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: PreloadItem|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: PreloadItem<br>方法 or 属性: readonly moduleName: string;|HapModuleInfo.d.ts| +|新增|NA|模块名: LauncherAbilityInfo<br>类名: LauncherAbilityInfo|LauncherAbilityInfo.d.ts| +|新增|NA|模块名: LauncherAbilityInfo<br>类名: LauncherAbilityInfo<br>方法 or 属性: readonly applicationInfo: ApplicationInfo;|LauncherAbilityInfo.d.ts| +|新增|NA|模块名: LauncherAbilityInfo<br>类名: LauncherAbilityInfo<br>方法 or 属性: readonly elementName : ElementName;|LauncherAbilityInfo.d.ts| +|新增|NA|模块名: LauncherAbilityInfo<br>类名: LauncherAbilityInfo<br>方法 or 属性: readonly labelId: number;|LauncherAbilityInfo.d.ts| +|新增|NA|模块名: LauncherAbilityInfo<br>类名: LauncherAbilityInfo<br>方法 or 属性: readonly iconId: number;|LauncherAbilityInfo.d.ts| +|新增|NA|模块名: LauncherAbilityInfo<br>类名: LauncherAbilityInfo<br>方法 or 属性: readonly userId: number;|LauncherAbilityInfo.d.ts| +|新增|NA|模块名: LauncherAbilityInfo<br>类名: LauncherAbilityInfo<br>方法 or 属性: readonly installTime : number;|LauncherAbilityInfo.d.ts| +|新增|NA|模块名: Metadata<br>类名: Metadata|Metadata.d.ts| +|新增|NA|模块名: Metadata<br>类名: Metadata<br>方法 or 属性: name: string;|Metadata.d.ts| +|新增|NA|模块名: Metadata<br>类名: Metadata<br>方法 or 属性: value: string;|Metadata.d.ts| +|新增|NA|模块名: Metadata<br>类名: Metadata<br>方法 or 属性: resource: string;|Metadata.d.ts| +|新增|NA|模块名: PermissionDef<br>类名: PermissionDef<br>方法 or 属性: readonly permissionName: string;|PermissionDef.d.ts| +|新增|NA|模块名: PermissionDef<br>类名: PermissionDef<br>方法 or 属性: readonly grantMode: number;|PermissionDef.d.ts| +|新增|NA|模块名: PermissionDef<br>类名: PermissionDef<br>方法 or 属性: readonly labelId: number;|PermissionDef.d.ts| +|新增|NA|模块名: PermissionDef<br>类名: PermissionDef<br>方法 or 属性: readonly descriptionId: number;|PermissionDef.d.ts| +|新增|NA|模块名: RemoteAbilityInfo<br>类名: RemoteAbilityInfo|RemoteAbilityInfo.d.ts| +|新增|NA|模块名: RemoteAbilityInfo<br>类名: RemoteAbilityInfo<br>方法 or 属性: readonly elementName: ElementName;|RemoteAbilityInfo.d.ts| +|新增|NA|模块名: RemoteAbilityInfo<br>类名: RemoteAbilityInfo<br>方法 or 属性: readonly label: string;|RemoteAbilityInfo.d.ts| +|新增|NA|模块名: RemoteAbilityInfo<br>类名: RemoteAbilityInfo<br>方法 or 属性: readonly icon: string;|RemoteAbilityInfo.d.ts| +|新增|NA|模块名: ShortcutInfo<br>类名: ShortcutInfo|ShortcutInfo.d.ts| +|新增|NA|模块名: ShortcutInfo<br>类名: ShortcutInfo<br>方法 or 属性: readonly id: string;|ShortcutInfo.d.ts| +|新增|NA|模块名: ShortcutInfo<br>类名: ShortcutInfo<br>方法 or 属性: readonly bundleName: string;|ShortcutInfo.d.ts| +|新增|NA|模块名: ShortcutInfo<br>类名: ShortcutInfo<br>方法 or 属性: readonly moduleName: string;|ShortcutInfo.d.ts| +|新增|NA|模块名: ShortcutInfo<br>类名: ShortcutInfo<br>方法 or 属性: readonly hostAbility: string;|ShortcutInfo.d.ts| +|新增|NA|模块名: ShortcutInfo<br>类名: ShortcutInfo<br>方法 or 属性: readonly icon: string;|ShortcutInfo.d.ts| +|新增|NA|模块名: ShortcutInfo<br>类名: ShortcutInfo<br>方法 or 属性: readonly iconId: number;|ShortcutInfo.d.ts| +|新增|NA|模块名: ShortcutInfo<br>类名: ShortcutInfo<br>方法 or 属性: readonly label: string;|ShortcutInfo.d.ts| +|新增|NA|模块名: ShortcutInfo<br>类名: ShortcutInfo<br>方法 or 属性: readonly labelId: number;|ShortcutInfo.d.ts| +|新增|NA|模块名: ShortcutInfo<br>类名: ShortcutInfo<br>方法 or 属性: readonly wants: Array\<ShortcutWant>;|ShortcutInfo.d.ts| +|新增|NA|模块名: ShortcutInfo<br>类名: ShortcutWant|ShortcutInfo.d.ts| +|新增|NA|模块名: ShortcutInfo<br>类名: ShortcutWant<br>方法 or 属性: readonly targetBundle: string;|ShortcutInfo.d.ts| +|新增|NA|模块名: ShortcutInfo<br>类名: ShortcutWant<br>方法 or 属性: readonly targetModule: string;|ShortcutInfo.d.ts| +|新增|NA|模块名: ShortcutInfo<br>类名: ShortcutWant<br>方法 or 属性: readonly targetAbility: string;|ShortcutInfo.d.ts| +|删除|模块名:ohos.bundle.bundleManager<br>类名:LaunchType<br>方法 or 属性:STANDARD = 1|NA|@ohos.bundle.bundleManager.d.ts| +|删除|模块名:ohos.bundle.bundleManager<br>类名:bundleManager<br>方法 or 属性:function getAbilityIcon(bundleName: string, moduleName: string, abilityName: string, callback: AsyncCallback\<image.PixelMap>): void;|NA|@ohos.bundle.bundleManager.d.ts| +|删除|模块名:ohos.bundle.bundleManager<br>类名:bundleManager<br>方法 or 属性:function getAbilityIcon(bundleName: string, moduleName: string, abilityName: string): Promise\<image.PixelMap>;|NA|@ohos.bundle.bundleManager.d.ts| +|删除|模块名: abilityInfo<br>类名: AbilityInfo<br>方法 or 属性:readonly type: bundleManager.AbilityType;|NA|abilityInfo.d.ts| +|删除|模块名: abilityInfo<br>类名: AbilityInfo<br>方法 or 属性:readonly orientation: bundleManager.DisplayOrientation;|NA|abilityInfo.d.ts| +|删除|模块名: abilityInfo<br>类名: AbilityInfo<br>方法 or 属性:readonly launchType: bundleManager.LaunchType;|NA|abilityInfo.d.ts| +|删除|模块名: abilityInfo<br>类名: AbilityInfo<br>方法 or 属性:readonly metadata: Array\<Metadata>;|NA|abilityInfo.d.ts| +|删除|模块名: abilityInfo<br>类名: AbilityInfo<br>方法 or 属性:readonly supportWindowModes: Array\<bundleManager.SupportWindowMode>;|NA|abilityInfo.d.ts| +|删除|模块名: abilityInfo<br>类名: AbilityInfo<br>方法 or 属性:readonly windowSize: WindowSize;|NA|abilityInfo.d.ts| +|删除|模块名: abilityInfo<br>类名: WindowSize|NA|abilityInfo.d.ts| +|删除|模块名: abilityInfo<br>类名: WindowSize<br>方法 or 属性:readonly maxWindowRatio: number;|NA|abilityInfo.d.ts| +|删除|模块名: abilityInfo<br>类名: WindowSize<br>方法 or 属性:readonly minWindowRatio: number;|NA|abilityInfo.d.ts| +|删除|模块名: abilityInfo<br>类名: WindowSize<br>方法 or 属性:readonly maxWindowWidth: number;|NA|abilityInfo.d.ts| +|删除|模块名: abilityInfo<br>类名: WindowSize<br>方法 or 属性:readonly minWindowWidth: number;|NA|abilityInfo.d.ts| +|删除|模块名: abilityInfo<br>类名: WindowSize<br>方法 or 属性:readonly maxWindowHeight: number;|NA|abilityInfo.d.ts| +|删除|模块名: abilityInfo<br>类名: WindowSize<br>方法 or 属性:readonly minWindowHeight: number;|NA|abilityInfo.d.ts| +|删除|模块名: applicationInfo<br>类名: ApplicationInfo<br>方法 or 属性:readonly labelId: number;|NA|applicationInfo.d.ts| +|删除|模块名: applicationInfo<br>类名: ApplicationInfo<br>方法 or 属性:readonly iconId: number;|NA|applicationInfo.d.ts| +|删除|模块名: applicationInfo<br>类名: ApplicationInfo<br>方法 or 属性:readonly metadata: Map\<string, Array\<Metadata>>;|NA|applicationInfo.d.ts| +|删除|模块名: applicationInfo<br>类名: ApplicationInfo<br>方法 or 属性:readonly iconResource: Resource;|NA|applicationInfo.d.ts| +|删除|模块名: applicationInfo<br>类名: ApplicationInfo<br>方法 or 属性:readonly labelResource: Resource;|NA|applicationInfo.d.ts| +|删除|模块名: applicationInfo<br>类名: ApplicationInfo<br>方法 or 属性:readonly descriptionResource: Resource;|NA|applicationInfo.d.ts| +|删除|模块名: applicationInfo<br>类名: ApplicationInfo<br>方法 or 属性:readonly appDistributionType: string;|NA|applicationInfo.d.ts| +|删除|模块名: applicationInfo<br>类名: ApplicationInfo<br>方法 or 属性:readonly appProvisionType: string;|NA|applicationInfo.d.ts| +|删除|模块名: bundleInfo<br>类名: BundleInfo<br>方法 or 属性:readonly hapModulesInfo: Array\<HapModuleInfo>;|NA|bundleInfo.d.ts| +|删除|模块名: bundleInfo<br>类名: BundleInfo<br>方法 or 属性:readonly permissionGrantStates: Array\<bundleManager.PermissionGrantState>;|NA|bundleInfo.d.ts| +|删除|模块名: bundleInfo<br>类名: BundleInfo<br>方法 or 属性:readonly signatureInfo: SignatureInfo;|NA|bundleInfo.d.ts| +|删除|模块名: bundleInfo<br>类名: ReqPermissionDetail<br>方法 or 属性:reasonId: number;|NA|bundleInfo.d.ts| +|删除|模块名: bundleInfo<br>类名: SignatureInfo|NA|bundleInfo.d.ts| +|删除|模块名: bundleInfo<br>类名: SignatureInfo<br>方法 or 属性:readonly appId: string;|NA|bundleInfo.d.ts| +|删除|模块名: bundleInfo<br>类名: SignatureInfo<br>方法 or 属性:readonly fingerprint: string;|NA|bundleInfo.d.ts| +|删除|模块名: dispatchInfo<br>类名: DispatchInfo|NA|dispatchInfo.d.ts| +|删除|模块名: dispatchInfo<br>类名: DispatchInfo<br>方法 or 属性:readonly version: string;|NA|dispatchInfo.d.ts| +|删除|模块名: dispatchInfo<br>类名: DispatchInfo<br>方法 or 属性:readonly dispatchAPIVersion: string;|NA|dispatchInfo.d.ts| +|删除|模块名: elementName<br>类名: ElementName<br>方法 or 属性:moduleName?: string;|NA|elementName.d.ts| +|删除|模块名: extensionAbilityInfo<br>类名: ExtensionAbilityInfo|NA|extensionAbilityInfo.d.ts| +|删除|模块名: extensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性:readonly bundleName: string;|NA|extensionAbilityInfo.d.ts| +|删除|模块名: extensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性:readonly moduleName: string;|NA|extensionAbilityInfo.d.ts| +|删除|模块名: extensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性:readonly name: string;|NA|extensionAbilityInfo.d.ts| +|删除|模块名: extensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性:readonly labelId: number;|NA|extensionAbilityInfo.d.ts| +|删除|模块名: extensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性:readonly descriptionId: number;|NA|extensionAbilityInfo.d.ts| +|删除|模块名: extensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性:readonly iconId: number;|NA|extensionAbilityInfo.d.ts| +|删除|模块名: extensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性:readonly isVisible: boolean;|NA|extensionAbilityInfo.d.ts| +|删除|模块名: extensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性:readonly extensionAbilityType: bundleManager.ExtensionAbilityType;|NA|extensionAbilityInfo.d.ts| +|删除|模块名: extensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性:readonly permissions: Array\<string>;|NA|extensionAbilityInfo.d.ts| +|删除|模块名: extensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性:readonly applicationInfo: ApplicationInfo;|NA|extensionAbilityInfo.d.ts| +|删除|模块名: extensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性:readonly metadata: Array\<Metadata>;|NA|extensionAbilityInfo.d.ts| +|删除|模块名: extensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性:readonly enabled: boolean;|NA|extensionAbilityInfo.d.ts| +|删除|模块名: extensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性:readonly readPermission: string;|NA|extensionAbilityInfo.d.ts| +|删除|模块名: extensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性:readonly writePermission: string;|NA|extensionAbilityInfo.d.ts| +|删除|模块名: hapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性:readonly mainElementName: string;|NA|hapModuleInfo.d.ts| +|删除|模块名: hapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性:readonly abilitiesInfo: Array\<AbilityInfo>;|NA|hapModuleInfo.d.ts| +|删除|模块名: hapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性:readonly extensionAbilitiesInfo: Array\<ExtensionAbilityInfo>;|NA|hapModuleInfo.d.ts| +|删除|模块名: hapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性:readonly metadata: Array\<Metadata>;|NA|hapModuleInfo.d.ts| +|删除|模块名: hapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性:readonly hashValue: string;|NA|hapModuleInfo.d.ts| +|删除|模块名: metadata<br>类名: Metadata|NA|metadata.d.ts| +|删除|模块名: metadata<br>类名: Metadata<br>方法 or 属性:name: string;|NA|metadata.d.ts| +|删除|模块名: metadata<br>类名: Metadata<br>方法 or 属性:value: string;|NA|metadata.d.ts| +|删除|模块名: metadata<br>类名: Metadata<br>方法 or 属性:resource: string;|NA|metadata.d.ts| +|删除|模块名: packInfo<br>类名: BundlePackInfo|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: BundlePackInfo<br>方法 or 属性:readonly packages: Array\<PackageConfig>;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: BundlePackInfo<br>方法 or 属性:readonly summary: PackageSummary;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: PackageConfig|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: PackageConfig<br>方法 or 属性:readonly deviceTypes: Array\<string>;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: PackageConfig<br>方法 or 属性:readonly name: string;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: PackageConfig<br>方法 or 属性:readonly moduleType: string;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: PackageConfig<br>方法 or 属性:readonly deliveryWithInstall: boolean;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: PackageSummary|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: PackageSummary<br>方法 or 属性:readonly app: BundleConfigInfo;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: PackageSummary<br>方法 or 属性:readonly modules: Array\<ModuleConfigInfo>;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: BundleConfigInfo|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: BundleConfigInfo<br>方法 or 属性:readonly bundleName: string;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: BundleConfigInfo<br>方法 or 属性:readonly version: Version;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: ExtensionAbility|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: ExtensionAbility<br>方法 or 属性:readonly name: string;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: ExtensionAbility<br>方法 or 属性:readonly forms: Array\<AbilityFormInfo>;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: ModuleConfigInfo|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: ModuleConfigInfo<br>方法 or 属性:readonly mainAbility: string;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: ModuleConfigInfo<br>方法 or 属性:readonly apiVersion: ApiVersion;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: ModuleConfigInfo<br>方法 or 属性:readonly deviceTypes: Array\<string>;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: ModuleConfigInfo<br>方法 or 属性:readonly distro: ModuleDistroInfo;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: ModuleConfigInfo<br>方法 or 属性:readonly abilities: Array\<ModuleAbilityInfo>;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: ModuleConfigInfo<br>方法 or 属性:readonly extensionAbilities: Array\<ExtensionAbility>;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: ModuleDistroInfo|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: ModuleDistroInfo<br>方法 or 属性:readonly deliveryWithInstall: boolean;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: ModuleDistroInfo<br>方法 or 属性:readonly installationFree: boolean;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: ModuleDistroInfo<br>方法 or 属性:readonly moduleName: string;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: ModuleDistroInfo<br>方法 or 属性:readonly moduleType: string;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: ModuleAbilityInfo|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: ModuleAbilityInfo<br>方法 or 属性:readonly name: string;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: ModuleAbilityInfo<br>方法 or 属性:readonly label: string;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: ModuleAbilityInfo<br>方法 or 属性:readonly visible: boolean;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: ModuleAbilityInfo<br>方法 or 属性:readonly forms: Array\<AbilityFormInfo>;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: AbilityFormInfo|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: AbilityFormInfo<br>方法 or 属性:readonly name: string;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: AbilityFormInfo<br>方法 or 属性:readonly type: string;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: AbilityFormInfo<br>方法 or 属性:readonly updateEnabled: boolean;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: AbilityFormInfo<br>方法 or 属性:readonly scheduledUpdateTime: string;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: AbilityFormInfo<br>方法 or 属性:readonly updateDuration: number;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: AbilityFormInfo<br>方法 or 属性:readonly supportDimensions: Array\<string>;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: AbilityFormInfo<br>方法 or 属性:readonly defaultDimension: string;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: Version|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: Version<br>方法 or 属性:readonly minCompatibleVersionCode: number;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: Version<br>方法 or 属性:readonly name: string;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: Version<br>方法 or 属性:readonly code: number;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: ApiVersion|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: ApiVersion<br>方法 or 属性:readonly releaseType: string;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: ApiVersion<br>方法 or 属性:readonly compatible: number;|NA|packInfo.d.ts| +|删除|模块名: packInfo<br>类名: ApiVersion<br>方法 or 属性:readonly target: number;|NA|packInfo.d.ts| +|删除|模块名: permissionDef<br>类名: PermissionDef|NA|permissionDef.d.ts| +|删除|模块名: permissionDef<br>类名: PermissionDef<br>方法 or 属性:readonly permissionName: string;|NA|permissionDef.d.ts| +|删除|模块名: permissionDef<br>类名: PermissionDef<br>方法 or 属性:readonly grantMode: number;|NA|permissionDef.d.ts| +|删除|模块名: permissionDef<br>类名: PermissionDef<br>方法 or 属性:readonly labelId: number;|NA|permissionDef.d.ts| +|删除|模块名: permissionDef<br>类名: PermissionDef<br>方法 or 属性:readonly descriptionId: number;|NA|permissionDef.d.ts| +|删除|模块名: shortcutInfo<br>类名: ShortcutInfo<br>方法 or 属性:readonly moduleName: string;|NA|shortcutInfo.d.ts| +|删除|模块名: shortcutInfo<br>类名: ShortcutWant<br>方法 or 属性:readonly targetModule: string;|NA|shortcutInfo.d.ts| +|删除|模块名: shortcutInfo<br>类名: ShortcutWant<br>方法 or 属性:readonly targetAbility: string;|NA|shortcutInfo.d.ts| +|函数有变化|类名:BundleInstaller<br>方法 or 属性:uninstall(bundleName: string, installParam: InstallParam, callback : AsyncCallback\<void>) : void;<br>|类名:BundleInstaller<br>方法 or 属性:uninstall(bundleName: string, installParam: InstallParam, callback : AsyncCallback\<void>) : void;<br>|@ohos.bundle.installer.d.ts| +|函数有变化|类名:BundleInstaller<br>方法 or 属性:uninstall(bundleName: string, installParam: InstallParam, callback : AsyncCallback\<void>) : void;<br>|类名:BundleInstaller<br>方法 or 属性:uninstall(bundleName: string, callback : AsyncCallback\<void>) : void;<br>|@ohos.bundle.installer.d.ts| diff --git a/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-communication.md b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-communication.md new file mode 100644 index 0000000000000000000000000000000000000000..05cd6614d396215fe85d02cb50ffd6cd367dc71b --- /dev/null +++ b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-communication.md @@ -0,0 +1,641 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function getState(): BluetoothState;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function getBtConnectionState(): ProfileConnectionState;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function pairDevice(deviceId: string): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function cancelPairedDevice(deviceId: string): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function getRemoteDeviceName(deviceId: string): string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function getRemoteDeviceClass(deviceId: string): DeviceClass;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function enableBluetooth(): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function disableBluetooth(): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function getLocalName(): string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function getPairedDevices(): Array\<string>;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function getProfileConnectionState(profileId: ProfileId): ProfileConnectionState;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function setDevicePairingConfirmation(device: string, accept: boolean): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function setLocalName(name: string): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function setBluetoothScanMode(mode: ScanMode, duration: number): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function getBluetoothScanMode(): ScanMode;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function startBluetoothDiscovery(): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function stopBluetoothDiscovery(): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function on(type: "bluetoothDeviceFind", callback: Callback\<Array\<string>>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function off(type: "bluetoothDeviceFind", callback?: Callback\<Array\<string>>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function on(type: "bondStateChange", callback: Callback\<BondStateParam>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function off(type: "bondStateChange", callback?: Callback\<BondStateParam>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function on(type: "pinRequired", callback: Callback\<PinRequiredParam>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function off(type: "pinRequired", callback?: Callback\<PinRequiredParam>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function on(type: "stateChange", callback: Callback\<BluetoothState>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function off(type: "stateChange", callback?: Callback\<BluetoothState>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function sppListen(name: string, option: SppOption, callback: AsyncCallback\<number>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function sppAccept(serverSocket: number, callback: AsyncCallback\<number>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function sppConnect(device: string, option: SppOption, callback: AsyncCallback\<number>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function sppCloseServerSocket(socket: number): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function sppCloseClientSocket(socket: number): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function sppWrite(clientSocket: number, data: ArrayBuffer): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function on(type: "sppRead", clientSocket: number, callback: Callback\<ArrayBuffer>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function off(type: "sppRead", clientSocket: number, callback?: Callback\<ArrayBuffer>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function getProfileInstance(profileId: ProfileId): A2dpSourceProfile \| HandsFreeAudioGatewayProfile \| HidHostProfile \| PanProfile;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BaseProfile|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BaseProfile<br>方法 or 属性: getConnectionDevices(): Array\<string>;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BaseProfile<br>方法 or 属性: getDeviceState(device: string): ProfileConnectionState;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: A2dpSourceProfile|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: A2dpSourceProfile<br>方法 or 属性: connect(device: string): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: A2dpSourceProfile<br>方法 or 属性: disconnect(device: string): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: A2dpSourceProfile<br>方法 or 属性: on(type: "connectionStateChange", callback: Callback\<StateChangeParam>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: A2dpSourceProfile<br>方法 or 属性: off(type: "connectionStateChange", callback?: Callback\<StateChangeParam>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: A2dpSourceProfile<br>方法 or 属性: getPlayingState(device: string): PlayingState;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: HandsFreeAudioGatewayProfile|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: HandsFreeAudioGatewayProfile<br>方法 or 属性: connect(device: string): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: HandsFreeAudioGatewayProfile<br>方法 or 属性: disconnect(device: string): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: HandsFreeAudioGatewayProfile<br>方法 or 属性: on(type: "connectionStateChange", callback: Callback\<StateChangeParam>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: HandsFreeAudioGatewayProfile<br>方法 or 属性: off(type: "connectionStateChange", callback?: Callback\<StateChangeParam>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: HidHostProfile|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: HidHostProfile<br>方法 or 属性: connect(device: string): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: HidHostProfile<br>方法 or 属性: disconnect(device: string): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: HidHostProfile<br>方法 or 属性: on(type: "connectionStateChange", callback: Callback\<StateChangeParam>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: HidHostProfile<br>方法 or 属性: off(type: "connectionStateChange", callback?: Callback\<StateChangeParam>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: PanProfile|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: PanProfile<br>方法 or 属性: disconnect(device: string): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: PanProfile<br>方法 or 属性: on(type: "connectionStateChange", callback: Callback\<StateChangeParam>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: PanProfile<br>方法 or 属性: off(type: "connectionStateChange", callback?: Callback\<StateChangeParam>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: PanProfile<br>方法 or 属性: setTethering(enable: boolean): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: PanProfile<br>方法 or 属性: isTetheringOn(): boolean;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLE|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLE<br>方法 or 属性: function createGattServer(): GattServer;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLE<br>方法 or 属性: function createGattClientDevice(deviceId: string): GattClientDevice;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLE<br>方法 or 属性: function getConnectedBLEDevices(): Array\<string>;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLE<br>方法 or 属性: function startBLEScan(filters: Array\<ScanFilter>, options?: ScanOptions): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLE<br>方法 or 属性: function stopBLEScan(): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLE<br>方法 or 属性: function on(type: "BLEDeviceFind", callback: Callback\<Array\<ScanResult>>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLE<br>方法 or 属性: function off(type: "BLEDeviceFind", callback?: Callback\<Array\<ScanResult>>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: startAdvertising(setting: AdvertiseSetting, advData: AdvertiseData, advResponse?: AdvertiseData): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: stopAdvertising(): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: addService(service: GattService): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: removeService(serviceUuid: string): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: close(): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: notifyCharacteristicChanged(deviceId: string, notifyCharacteristic: NotifyCharacteristic): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: sendResponse(serverResponse: ServerResponse): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: on(type: "characteristicRead", callback: Callback\<CharacteristicReadRequest>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: off(type: "characteristicRead", callback?: Callback\<CharacteristicReadRequest>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: on(type: "characteristicWrite", callback: Callback\<CharacteristicWriteRequest>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: off(type: "characteristicWrite", callback?: Callback\<CharacteristicWriteRequest>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: on(type: "descriptorRead", callback: Callback\<DescriptorReadRequest>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: off(type: "descriptorRead", callback?: Callback\<DescriptorReadRequest>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: on(type: "descriptorWrite", callback: Callback\<DescriptorWriteRequest>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: off(type: "descriptorWrite", callback?: Callback\<DescriptorWriteRequest>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: on(type: "connectStateChange", callback: Callback\<BLEConnectChangedState>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: off(type: "connectStateChange", callback?: Callback\<BLEConnectChangedState>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: connect(): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: disconnect(): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: close(): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: getDeviceName(callback: AsyncCallback\<string>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: getDeviceName(): Promise\<string>;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: getServices(callback: AsyncCallback\<Array\<GattService>>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: getServices(): Promise\<Array\<GattService>>;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: readCharacteristicValue(characteristic: BLECharacteristic, callback: AsyncCallback\<BLECharacteristic>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: readCharacteristicValue(characteristic: BLECharacteristic): Promise\<BLECharacteristic>;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: readDescriptorValue(descriptor: BLEDescriptor, callback: AsyncCallback\<BLEDescriptor>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: readDescriptorValue(descriptor: BLEDescriptor): Promise\<BLEDescriptor>;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: writeCharacteristicValue(characteristic: BLECharacteristic): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: writeDescriptorValue(descriptor: BLEDescriptor): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: getRssiValue(callback: AsyncCallback\<number>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: getRssiValue(): Promise\<number>;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: setBLEMtuSize(mtu: number): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: setNotifyCharacteristicChanged(characteristic: BLECharacteristic, enable: boolean): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: on(type: "BLECharacteristicChange", callback: Callback\<BLECharacteristic>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: off(type: "BLECharacteristicChange", callback?: Callback\<BLECharacteristic>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: on(type: "BLEConnectionStateChange", callback: Callback\<BLEConnectChangedState>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: off(type: "BLEConnectionStateChange", callback?: Callback\<BLEConnectChangedState>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattService|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattService<br>方法 or 属性: serviceUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattService<br>方法 or 属性: isPrimary: boolean;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattService<br>方法 or 属性: characteristics: Array\<BLECharacteristic>;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattService<br>方法 or 属性: includeServices?: Array\<GattService>;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLECharacteristic|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLECharacteristic<br>方法 or 属性: serviceUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLECharacteristic<br>方法 or 属性: characteristicUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLECharacteristic<br>方法 or 属性: characteristicValue: ArrayBuffer;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLECharacteristic<br>方法 or 属性: descriptors: Array\<BLEDescriptor>;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLEDescriptor|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLEDescriptor<br>方法 or 属性: serviceUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLEDescriptor<br>方法 or 属性: characteristicUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLEDescriptor<br>方法 or 属性: descriptorUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLEDescriptor<br>方法 or 属性: descriptorValue: ArrayBuffer;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: NotifyCharacteristic|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: NotifyCharacteristic<br>方法 or 属性: serviceUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: NotifyCharacteristic<br>方法 or 属性: characteristicUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: NotifyCharacteristic<br>方法 or 属性: characteristicValue: ArrayBuffer;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: NotifyCharacteristic<br>方法 or 属性: confirm: boolean;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: CharacteristicReadRequest|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: CharacteristicReadRequest<br>方法 or 属性: deviceId: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: CharacteristicReadRequest<br>方法 or 属性: transId: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: CharacteristicReadRequest<br>方法 or 属性: offset: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: CharacteristicReadRequest<br>方法 or 属性: characteristicUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: CharacteristicReadRequest<br>方法 or 属性: serviceUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: CharacteristicWriteRequest|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: CharacteristicWriteRequest<br>方法 or 属性: deviceId: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: CharacteristicWriteRequest<br>方法 or 属性: transId: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: CharacteristicWriteRequest<br>方法 or 属性: offset: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: CharacteristicWriteRequest<br>方法 or 属性: isPrep: boolean;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: CharacteristicWriteRequest<br>方法 or 属性: needRsp: boolean;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: CharacteristicWriteRequest<br>方法 or 属性: value: ArrayBuffer;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: CharacteristicWriteRequest<br>方法 or 属性: characteristicUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: CharacteristicWriteRequest<br>方法 or 属性: serviceUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorReadRequest|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorReadRequest<br>方法 or 属性: deviceId: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorReadRequest<br>方法 or 属性: transId: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorReadRequest<br>方法 or 属性: offset: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorReadRequest<br>方法 or 属性: descriptorUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorReadRequest<br>方法 or 属性: characteristicUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorReadRequest<br>方法 or 属性: serviceUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorWriteRequest|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorWriteRequest<br>方法 or 属性: deviceId: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorWriteRequest<br>方法 or 属性: transId: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorWriteRequest<br>方法 or 属性: offset: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorWriteRequest<br>方法 or 属性: isPrep: boolean;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorWriteRequest<br>方法 or 属性: needRsp: boolean;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorWriteRequest<br>方法 or 属性: value: ArrayBuffer;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorWriteRequest<br>方法 or 属性: descriptorUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorWriteRequest<br>方法 or 属性: characteristicUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorWriteRequest<br>方法 or 属性: serviceUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ServerResponse|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ServerResponse<br>方法 or 属性: deviceId: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ServerResponse<br>方法 or 属性: transId: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ServerResponse<br>方法 or 属性: status: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ServerResponse<br>方法 or 属性: offset: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ServerResponse<br>方法 or 属性: value: ArrayBuffer;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLEConnectChangedState|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLEConnectChangedState<br>方法 or 属性: deviceId: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLEConnectChangedState<br>方法 or 属性: state: ProfileConnectionState;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanResult|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanResult<br>方法 or 属性: deviceId: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanResult<br>方法 or 属性: rssi: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanResult<br>方法 or 属性: data: ArrayBuffer;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: AdvertiseSetting|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: AdvertiseSetting<br>方法 or 属性: interval?: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: AdvertiseSetting<br>方法 or 属性: txPower?: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: AdvertiseSetting<br>方法 or 属性: connectable?: boolean;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: AdvertiseData|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: AdvertiseData<br>方法 or 属性: serviceUuids: Array\<string>;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: AdvertiseData<br>方法 or 属性: manufactureData: Array\<ManufactureData>;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: AdvertiseData<br>方法 or 属性: serviceData: Array\<ServiceData>;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ManufactureData|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ManufactureData<br>方法 or 属性: manufactureId: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ManufactureData<br>方法 or 属性: manufactureValue: ArrayBuffer;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ServiceData|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ServiceData<br>方法 or 属性: serviceUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ServiceData<br>方法 or 属性: serviceValue: ArrayBuffer;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanFilter|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanFilter<br>方法 or 属性: deviceId?: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanFilter<br>方法 or 属性: name?: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanFilter<br>方法 or 属性: serviceUuid?: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanFilter<br>方法 or 属性: serviceUuidMask?: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanFilter<br>方法 or 属性: serviceSolicitationUuid?: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanFilter<br>方法 or 属性: serviceSolicitationUuidMask?: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanFilter<br>方法 or 属性: serviceData?: ArrayBuffer;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanFilter<br>方法 or 属性: serviceDataMask?: ArrayBuffer;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanFilter<br>方法 or 属性: manufactureId?: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanFilter<br>方法 or 属性: manufactureData?: ArrayBuffer;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanFilter<br>方法 or 属性: manufactureDataMask?: ArrayBuffer;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanOptions|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanOptions<br>方法 or 属性: interval?: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanOptions<br>方法 or 属性: dutyMode?: ScanDuty;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanOptions<br>方法 or 属性: matchMode?: MatchMode;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: SppOption|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: SppOption<br>方法 or 属性: uuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: SppOption<br>方法 or 属性: secure: boolean;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: SppOption<br>方法 or 属性: type: SppType;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: PinRequiredParam|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: PinRequiredParam<br>方法 or 属性: deviceId: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: PinRequiredParam<br>方法 or 属性: pinCode: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DeviceClass|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DeviceClass<br>方法 or 属性: majorClass: MajorClass;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DeviceClass<br>方法 or 属性: majorMinorClass: MajorMinorClass;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DeviceClass<br>方法 or 属性: classOfDevice: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BondStateParam|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BondStateParam<br>方法 or 属性: deviceId: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BondStateParam<br>方法 or 属性: state: BondState;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: StateChangeParam|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: StateChangeParam<br>方法 or 属性: deviceId: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: StateChangeParam<br>方法 or 属性: state: ProfileConnectionState;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanDuty|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanDuty<br>方法 or 属性: SCAN_MODE_LOW_POWER = 0|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanDuty<br>方法 or 属性: SCAN_MODE_BALANCED = 1|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanDuty<br>方法 or 属性: SCAN_MODE_LOW_LATENCY = 2|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MatchMode|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MatchMode<br>方法 or 属性: MATCH_MODE_AGGRESSIVE = 1|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MatchMode<br>方法 or 属性: MATCH_MODE_STICKY = 2|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ProfileConnectionState|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ProfileConnectionState<br>方法 or 属性: STATE_DISCONNECTED = 0|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ProfileConnectionState<br>方法 or 属性: STATE_CONNECTING = 1|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ProfileConnectionState<br>方法 or 属性: STATE_CONNECTED = 2|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ProfileConnectionState<br>方法 or 属性: STATE_DISCONNECTING = 3|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BluetoothState|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BluetoothState<br>方法 or 属性: STATE_OFF = 0|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BluetoothState<br>方法 or 属性: STATE_TURNING_ON = 1|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BluetoothState<br>方法 or 属性: STATE_ON = 2|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BluetoothState<br>方法 or 属性: STATE_TURNING_OFF = 3|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BluetoothState<br>方法 or 属性: STATE_BLE_TURNING_ON = 4|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BluetoothState<br>方法 or 属性: STATE_BLE_ON = 5|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BluetoothState<br>方法 or 属性: STATE_BLE_TURNING_OFF = 6|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: SppType|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: SppType<br>方法 or 属性: SPP_RFCOMM|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanMode|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanMode<br>方法 or 属性: SCAN_MODE_NONE = 0|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanMode<br>方法 or 属性: SCAN_MODE_CONNECTABLE = 1|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanMode<br>方法 or 属性: SCAN_MODE_GENERAL_DISCOVERABLE = 2|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanMode<br>方法 or 属性: SCAN_MODE_LIMITED_DISCOVERABLE = 3|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanMode<br>方法 or 属性: SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE = 4|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanMode<br>方法 or 属性: SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE = 5|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BondState|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BondState<br>方法 or 属性: BOND_STATE_INVALID = 0|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BondState<br>方法 or 属性: BOND_STATE_BONDING = 1|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BondState<br>方法 or 属性: BOND_STATE_BONDED = 2|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorClass|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorClass<br>方法 or 属性: MAJOR_MISC = 0x0000|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorClass<br>方法 or 属性: MAJOR_COMPUTER = 0x0100|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorClass<br>方法 or 属性: MAJOR_PHONE = 0x0200|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorClass<br>方法 or 属性: MAJOR_NETWORKING = 0x0300|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorClass<br>方法 or 属性: MAJOR_AUDIO_VIDEO = 0x0400|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorClass<br>方法 or 属性: MAJOR_PERIPHERAL = 0x0500|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorClass<br>方法 or 属性: MAJOR_IMAGING = 0x0600|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorClass<br>方法 or 属性: MAJOR_WEARABLE = 0x0700|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorClass<br>方法 or 属性: MAJOR_TOY = 0x0800|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorClass<br>方法 or 属性: MAJOR_HEALTH = 0x0900|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorClass<br>方法 or 属性: MAJOR_UNCATEGORIZED = 0x1F00|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: COMPUTER_UNCATEGORIZED = 0x0100|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: COMPUTER_DESKTOP = 0x0104|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: COMPUTER_SERVER = 0x0108|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: COMPUTER_LAPTOP = 0x010C|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: COMPUTER_HANDHELD_PC_PDA = 0x0110|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: COMPUTER_PALM_SIZE_PC_PDA = 0x0114|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: COMPUTER_WEARABLE = 0x0118|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: COMPUTER_TABLET = 0x011C|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PHONE_UNCATEGORIZED = 0x0200|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PHONE_CELLULAR = 0x0204|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PHONE_CORDLESS = 0x0208|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PHONE_SMART = 0x020C|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PHONE_MODEM_OR_GATEWAY = 0x0210|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PHONE_ISDN = 0x0214|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: NETWORK_FULLY_AVAILABLE = 0x0300|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: NETWORK_1_TO_17_UTILIZED = 0x0320|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: NETWORK_17_TO_33_UTILIZED = 0x0340|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: NETWORK_33_TO_50_UTILIZED = 0x0360|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: NETWORK_60_TO_67_UTILIZED = 0x0380|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: NETWORK_67_TO_83_UTILIZED = 0x03A0|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: NETWORK_83_TO_99_UTILIZED = 0x03C0|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: NETWORK_NO_SERVICE = 0x03E0|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_UNCATEGORIZED = 0x0400|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_WEARABLE_HEADSET = 0x0404|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_HANDSFREE = 0x0408|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_MICROPHONE = 0x0410|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_LOUDSPEAKER = 0x0414|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_HEADPHONES = 0x0418|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_PORTABLE_AUDIO = 0x041C|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_CAR_AUDIO = 0x0420|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_SET_TOP_BOX = 0x0424|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_HIFI_AUDIO = 0x0428|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_VCR = 0x042C|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_VIDEO_CAMERA = 0x0430|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_CAMCORDER = 0x0434|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_VIDEO_MONITOR = 0x0438|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER = 0x043C|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_VIDEO_CONFERENCING = 0x0440|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_VIDEO_GAMING_TOY = 0x0448|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PERIPHERAL_NON_KEYBOARD_NON_POINTING = 0x0500|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PERIPHERAL_KEYBOARD = 0x0540|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PERIPHERAL_POINTING_DEVICE = 0x0580|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PERIPHERAL_KEYBOARD_POINTING = 0x05C0|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PERIPHERAL_UNCATEGORIZED = 0x0500|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PERIPHERAL_JOYSTICK = 0x0504|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PERIPHERAL_GAMEPAD = 0x0508|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PERIPHERAL_REMOTE_CONTROL = 0x05C0|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PERIPHERAL_SENSING_DEVICE = 0x0510|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PERIPHERAL_DIGITIZER_TABLET = 0x0514|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PERIPHERAL_CARD_READER = 0x0518|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PERIPHERAL_DIGITAL_PEN = 0x051C|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PERIPHERAL_SCANNER_RFID = 0x0520|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PERIPHERAL_GESTURAL_INPUT = 0x0522|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: IMAGING_UNCATEGORIZED = 0x0600|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: IMAGING_DISPLAY = 0x0610|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: IMAGING_CAMERA = 0x0620|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: IMAGING_SCANNER = 0x0640|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: IMAGING_PRINTER = 0x0680|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: WEARABLE_UNCATEGORIZED = 0x0700|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: WEARABLE_WRIST_WATCH = 0x0704|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: WEARABLE_PAGER = 0x0708|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: WEARABLE_JACKET = 0x070C|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: WEARABLE_HELMET = 0x0710|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: WEARABLE_GLASSES = 0x0714|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: TOY_UNCATEGORIZED = 0x0800|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: TOY_ROBOT = 0x0804|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: TOY_VEHICLE = 0x0808|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: TOY_DOLL_ACTION_FIGURE = 0x080C|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: TOY_CONTROLLER = 0x0810|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: TOY_GAME = 0x0814|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_UNCATEGORIZED = 0x0900|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_BLOOD_PRESSURE = 0x0904|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_THERMOMETER = 0x0908|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_WEIGHING = 0x090C|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_GLUCOSE = 0x0910|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_PULSE_OXIMETER = 0x0914|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_PULSE_RATE = 0x0918|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_DATA_DISPLAY = 0x091C|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_STEP_COUNTER = 0x0920|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_BODY_COMPOSITION_ANALYZER = 0x0924|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_PEAK_FLOW_MONITOR = 0x0928|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_MEDICATION_MONITOR = 0x092C|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_KNEE_PROSTHESIS = 0x0930|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_ANKLE_PROSTHESIS = 0x0934|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_GENERIC_HEALTH_MANAGER = 0x0938|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_PERSONAL_MOBILITY_DEVICE = 0x093C|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: PlayingState|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: PlayingState<br>方法 or 属性: STATE_NOT_PLAYING|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: PlayingState<br>方法 or 属性: STATE_PLAYING|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ProfileId|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ProfileId<br>方法 or 属性: PROFILE_A2DP_SOURCE = 1|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ProfileId<br>方法 or 属性: PROFILE_HANDS_FREE_AUDIO_GATEWAY = 4|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ProfileId<br>方法 or 属性: PROFILE_HID_HOST = 6|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ProfileId<br>方法 or 属性: PROFILE_PAN_NETWORK = 7|@ohos.bluetoothManager.d.ts| +|新增|NA|类名:connection<br>方法or属性:function getAppNet(callback: AsyncCallback\<NetHandle>): void;|@ohos.net.connection.d.ts| +|新增|NA|类名:connection<br>方法or属性:function getAppNet(): Promise\<NetHandle>;|@ohos.net.connection.d.ts| +|新增|NA|类名:connection<br>方法or属性:function setAppNet(netHandle: NetHandle, callback: AsyncCallback\<void>): void;|@ohos.net.connection.d.ts| +|新增|NA|类名:connection<br>方法or属性:function setAppNet(netHandle: NetHandle): Promise\<void>;|@ohos.net.connection.d.ts| +|新增|NA|类名:TLSSecureOptions<br>方法or属性:password?: string;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiEapConfig<br>方法 or 属性:certEntry: Uint8Array;|@ohos.wifiManager.d.ts| +|新增|NA|类名:WifiEapConfig<br>方法or属性:certEntry: Uint8Array;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiEapConfig<br>方法 or 属性:certPassword: string;|@ohos.wifiManager.d.ts| +|新增|NA|类名:WifiEapConfig<br>方法or属性:certPassword: string;|@ohos.wifiManager.d.ts| +|新增|NA|类名:WifiDeviceConfig<br>方法or属性:bssid?: string;|@ohos.wifiManager.d.ts| +|新增|NA|类名:WifiDeviceConfig<br>方法or属性:isHiddenSsid?: boolean;|@ohos.wifiManager.d.ts| +|新增|NA|类名:WifiDeviceConfig<br>方法or属性:creatorUid?: number;|@ohos.wifiManager.d.ts| +|新增|NA|类名:WifiDeviceConfig<br>方法or属性:disableReason?: number;|@ohos.wifiManager.d.ts| +|新增|NA|类名:WifiDeviceConfig<br>方法or属性:netId?: number;|@ohos.wifiManager.d.ts| +|新增|NA|类名:WifiDeviceConfig<br>方法or属性:randomMacType?: number;|@ohos.wifiManager.d.ts| +|新增|NA|类名:WifiDeviceConfig<br>方法or属性:randomMacAddr?: string;|@ohos.wifiManager.d.ts| +|新增|NA|类名:WifiDeviceConfig<br>方法or属性:ipType?: IpType;|@ohos.wifiManager.d.ts| +|新增|NA|类名:WifiDeviceConfig<br>方法or属性:staticIp?: IpConfig;|@ohos.wifiManager.d.ts| +|新增|NA|类名:WifiDeviceConfig<br>方法or属性:eapConfig?: WifiEapConfig;|@ohos.wifiManager.d.ts| +|删除|模块名:ohos.bluetooth<br>类名:bluetooth<br>方法 or 属性:function getProfileInst(profileId: ProfileId): A2dpSourceProfile \| HandsFreeAudioGatewayProfile \| HidHostProfile \| PanProfile;|NA|@ohos.bluetooth.d.ts| +|删除|模块名: ohos.bluetooth<br>类名: HidHostProfile|NA|@ohos.bluetooth.d.ts| +|删除|模块名: ohos.bluetooth<br>类名: HidHostProfile<br>方法 or 属性:connect(device: string): boolean;|NA|@ohos.bluetooth.d.ts| +|删除|模块名: ohos.bluetooth<br>类名: HidHostProfile<br>方法 or 属性:disconnect(device: string): boolean;|NA|@ohos.bluetooth.d.ts| +|删除|模块名: ohos.bluetooth<br>类名: HidHostProfile<br>方法 or 属性:on(type: "connectionStateChange", callback: Callback\<StateChangeParam>): void;|NA|@ohos.bluetooth.d.ts| +|删除|模块名: ohos.bluetooth<br>类名: HidHostProfile<br>方法 or 属性:off(type: "connectionStateChange", callback?: Callback\<StateChangeParam>): void;|NA|@ohos.bluetooth.d.ts| +|删除|模块名: ohos.bluetooth<br>类名: PanProfile|NA|@ohos.bluetooth.d.ts| +|删除|模块名: ohos.bluetooth<br>类名: PanProfile<br>方法 or 属性:disconnect(device: string): boolean;|NA|@ohos.bluetooth.d.ts| +|删除|模块名: ohos.bluetooth<br>类名: PanProfile<br>方法 or 属性:on(type: "connectionStateChange", callback: Callback\<StateChangeParam>): void;|NA|@ohos.bluetooth.d.ts| +|删除|模块名: ohos.bluetooth<br>类名: PanProfile<br>方法 or 属性:off(type: "connectionStateChange", callback?: Callback\<StateChangeParam>): void;|NA|@ohos.bluetooth.d.ts| +|删除|模块名: ohos.bluetooth<br>类名: PanProfile<br>方法 or 属性:setTethering(enable: boolean): void;|NA|@ohos.bluetooth.d.ts| +|删除|模块名: ohos.bluetooth<br>类名: PanProfile<br>方法 or 属性:isTetheringOn(): boolean;|NA|@ohos.bluetooth.d.ts| +|删除|模块名:ohos.bluetooth<br>类名:ScanFilter<br>方法 or 属性:serviceUuidMask?: string;|NA|@ohos.bluetooth.d.ts| +|删除|模块名:ohos.bluetooth<br>类名:ScanFilter<br>方法 or 属性:serviceSolicitationUuid?: string;|NA|@ohos.bluetooth.d.ts| +|删除|模块名:ohos.bluetooth<br>类名:ScanFilter<br>方法 or 属性:serviceSolicitationUuidMask?: string;|NA|@ohos.bluetooth.d.ts| +|删除|模块名:ohos.bluetooth<br>类名:ScanFilter<br>方法 or 属性:serviceData?: ArrayBuffer;|NA|@ohos.bluetooth.d.ts| +|删除|模块名:ohos.bluetooth<br>类名:ScanFilter<br>方法 or 属性:serviceDataMask?: ArrayBuffer;|NA|@ohos.bluetooth.d.ts| +|删除|模块名:ohos.bluetooth<br>类名:ScanFilter<br>方法 or 属性:manufactureId?: number;|NA|@ohos.bluetooth.d.ts| +|删除|模块名:ohos.bluetooth<br>类名:ScanFilter<br>方法 or 属性:manufactureData?: ArrayBuffer;|NA|@ohos.bluetooth.d.ts| +|删除|模块名:ohos.bluetooth<br>类名:ScanFilter<br>方法 or 属性:manufactureDataMask?: ArrayBuffer;|NA|@ohos.bluetooth.d.ts| +|删除|模块名:ohos.bluetooth<br>类名:ProfileId<br>方法 or 属性:PROFILE_HID_HOST = 6|NA|@ohos.bluetooth.d.ts| +|删除|模块名:ohos.bluetooth<br>类名:ProfileId<br>方法 or 属性:PROFILE_PAN_NETWORK = 7|NA|@ohos.bluetooth.d.ts| +|删除|模块名:ohos.net.socket<br>类名:TLSSecureOptions<br>方法 or 属性:passwd?: string;|NA|@ohos.net.socket.d.ts| +|废弃版本有变化|类名:bluetooth<br>废弃版本:N/A|类名:bluetooth<br>废弃版本:9<br>代替接口:ohos.bluetoothManager |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function getState(): BluetoothState;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function getState(): BluetoothState;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.getState |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function getBtConnectionState(): ProfileConnectionState;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function getBtConnectionState(): ProfileConnectionState;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.getBtConnectionState |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function pairDevice(deviceId: string): boolean;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function pairDevice(deviceId: string): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.pairDevice |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function cancelPairedDevice(deviceId: string): boolean;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function cancelPairedDevice(deviceId: string): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.cancelPairedDevice |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function getRemoteDeviceName(deviceId: string): string;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function getRemoteDeviceName(deviceId: string): string;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.getRemoteDeviceName |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function getRemoteDeviceClass(deviceId: string): DeviceClass;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function getRemoteDeviceClass(deviceId: string): DeviceClass;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.getRemoteDeviceClass |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function enableBluetooth(): boolean;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function enableBluetooth(): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.enableBluetooth |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function disableBluetooth(): boolean;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function disableBluetooth(): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.disableBluetooth |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function getLocalName(): string;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function getLocalName(): string;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.getLocalName |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function getPairedDevices(): Array\<string>;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function getPairedDevices(): Array\<string>;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.getPairedDevices |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function getProfileConnState(profileId: ProfileId): ProfileConnectionState;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function getProfileConnState(profileId: ProfileId): ProfileConnectionState;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.getProfileConnectionState |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function setDevicePairingConfirmation(device: string, accept: boolean): boolean;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function setDevicePairingConfirmation(device: string, accept: boolean): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.setDevicePairingConfirmation |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function setLocalName(name: string): boolean;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function setLocalName(name: string): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.setLocalName |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function setBluetoothScanMode(mode: ScanMode, duration: number): boolean;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function setBluetoothScanMode(mode: ScanMode, duration: number): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.setBluetoothScanMode |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function getBluetoothScanMode(): ScanMode;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function getBluetoothScanMode(): ScanMode;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.getBluetoothScanMode |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function startBluetoothDiscovery(): boolean;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function startBluetoothDiscovery(): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.startBluetoothDiscovery |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function stopBluetoothDiscovery(): boolean;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function stopBluetoothDiscovery(): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.stopBluetoothDiscovery |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function on(type: "bluetoothDeviceFind", callback: Callback\<Array\<string>>): void;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function on(type: "bluetoothDeviceFind", callback: Callback\<Array\<string>>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.on|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function off(type: "bluetoothDeviceFind", callback?: Callback\<Array\<string>>): void;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function off(type: "bluetoothDeviceFind", callback?: Callback\<Array\<string>>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.off|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function on(type: "bondStateChange", callback: Callback\<BondStateParam>): void;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function on(type: "bondStateChange", callback: Callback\<BondStateParam>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.on|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function off(type: "bondStateChange", callback?: Callback\<BondStateParam>): void;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function off(type: "bondStateChange", callback?: Callback\<BondStateParam>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.off|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function on(type: "pinRequired", callback: Callback\<PinRequiredParam>): void;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function on(type: "pinRequired", callback: Callback\<PinRequiredParam>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.on|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function off(type: "pinRequired", callback?: Callback\<PinRequiredParam>): void;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function off(type: "pinRequired", callback?: Callback\<PinRequiredParam>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.off|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function on(type: "stateChange", callback: Callback\<BluetoothState>): void;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function on(type: "stateChange", callback: Callback\<BluetoothState>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.on|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function off(type: "stateChange", callback?: Callback\<BluetoothState>): void;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function off(type: "stateChange", callback?: Callback\<BluetoothState>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.off|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function sppListen(name: string, option: SppOption, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function sppListen(name: string, option: SppOption, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.sppListen |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function sppAccept(serverSocket: number, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function sppAccept(serverSocket: number, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.sppAccept |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function sppConnect(device: string, option: SppOption, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function sppConnect(device: string, option: SppOption, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.sppConnect |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function sppCloseServerSocket(socket: number): void;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function sppCloseServerSocket(socket: number): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.sppCloseServerSocket |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function sppCloseClientSocket(socket: number): void;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function sppCloseClientSocket(socket: number): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.sppCloseClientSocket |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function sppWrite(clientSocket: number, data: ArrayBuffer): boolean;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function sppWrite(clientSocket: number, data: ArrayBuffer): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.sppWrite |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function on(type: "sppRead", clientSocket: number, callback: Callback\<ArrayBuffer>): void;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function on(type: "sppRead", clientSocket: number, callback: Callback\<ArrayBuffer>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.on|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function off(type: "sppRead", clientSocket: number, callback?: Callback\<ArrayBuffer>): void;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function off(type: "sppRead", clientSocket: number, callback?: Callback\<ArrayBuffer>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.off|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function getProfile(profileId: ProfileId): A2dpSourceProfile \| HandsFreeAudioGatewayProfile;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function getProfile(profileId: ProfileId): A2dpSourceProfile \| HandsFreeAudioGatewayProfile;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.getProfileInstance |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BaseProfile<br>废弃版本:N/A|类名:BaseProfile<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BaseProfile |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BaseProfile<br>方法 or 属性:getConnectionDevices(): Array\<string>;<br>废弃版本:N/A|类名:BaseProfile<br>方法 or 属性:getConnectionDevices(): Array\<string>;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BaseProfile|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BaseProfile<br>方法 or 属性:getDeviceState(device: string): ProfileConnectionState;<br>废弃版本:N/A|类名:BaseProfile<br>方法 or 属性:getDeviceState(device: string): ProfileConnectionState;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BaseProfile|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:A2dpSourceProfile<br>废弃版本:N/A|类名:A2dpSourceProfile<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.A2dpSourceProfile |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:A2dpSourceProfile<br>方法 or 属性:connect(device: string): boolean;<br>废弃版本:N/A|类名:A2dpSourceProfile<br>方法 or 属性:connect(device: string): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.A2dpSourceProfile|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:A2dpSourceProfile<br>方法 or 属性:disconnect(device: string): boolean;<br>废弃版本:N/A|类名:A2dpSourceProfile<br>方法 or 属性:disconnect(device: string): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.A2dpSourceProfile|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:A2dpSourceProfile<br>方法 or 属性:on(type: "connectionStateChange", callback: Callback\<StateChangeParam>): void;<br>废弃版本:N/A|类名:A2dpSourceProfile<br>方法 or 属性:on(type: "connectionStateChange", callback: Callback\<StateChangeParam>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.A2dpSourceProfile.on|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:A2dpSourceProfile<br>方法 or 属性:off(type: "connectionStateChange", callback?: Callback\<StateChangeParam>): void;<br>废弃版本:N/A|类名:A2dpSourceProfile<br>方法 or 属性:off(type: "connectionStateChange", callback?: Callback\<StateChangeParam>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.A2dpSourceProfile.off|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:A2dpSourceProfile<br>方法 or 属性:getPlayingState(device: string): PlayingState;<br>废弃版本:N/A|类名:A2dpSourceProfile<br>方法 or 属性:getPlayingState(device: string): PlayingState;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.A2dpSourceProfile|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:HandsFreeAudioGatewayProfile<br>废弃版本:N/A|类名:HandsFreeAudioGatewayProfile<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.HandsFreeAudioGatewayProfile |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:HandsFreeAudioGatewayProfile<br>方法 or 属性:connect(device: string): boolean;<br>废弃版本:N/A|类名:HandsFreeAudioGatewayProfile<br>方法 or 属性:connect(device: string): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.HandsFreeAudioGatewayProfile|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:HandsFreeAudioGatewayProfile<br>方法 or 属性:disconnect(device: string): boolean;<br>废弃版本:N/A|类名:HandsFreeAudioGatewayProfile<br>方法 or 属性:disconnect(device: string): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.HandsFreeAudioGatewayProfile|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:HandsFreeAudioGatewayProfile<br>方法 or 属性:on(type: "connectionStateChange", callback: Callback\<StateChangeParam>): void;<br>废弃版本:N/A|类名:HandsFreeAudioGatewayProfile<br>方法 or 属性:on(type: "connectionStateChange", callback: Callback\<StateChangeParam>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.HandsFreeAudioGatewayProfile.on|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:HandsFreeAudioGatewayProfile<br>方法 or 属性:off(type: "connectionStateChange", callback?: Callback\<StateChangeParam>): void;<br>废弃版本:N/A|类名:HandsFreeAudioGatewayProfile<br>方法 or 属性:off(type: "connectionStateChange", callback?: Callback\<StateChangeParam>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.HandsFreeAudioGatewayProfile.off|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BLE<br>方法 or 属性:function createGattServer(): GattServer;<br>废弃版本:N/A|类名:BLE<br>方法 or 属性:function createGattServer(): GattServer;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BLE.createGattServer |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BLE<br>方法 or 属性:function createGattClientDevice(deviceId: string): GattClientDevice;<br>废弃版本:N/A|类名:BLE<br>方法 or 属性:function createGattClientDevice(deviceId: string): GattClientDevice;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BLE.createGattClientDevice |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BLE<br>方法 or 属性:function getConnectedBLEDevices(): Array\<string>;<br>废弃版本:N/A|类名:BLE<br>方法 or 属性:function getConnectedBLEDevices(): Array\<string>;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BLE.getConnectedBLEDevices |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BLE<br>方法 or 属性:function startBLEScan(filters: Array\<ScanFilter>, options?: ScanOptions): void;<br>废弃版本:N/A|类名:BLE<br>方法 or 属性:function startBLEScan(filters: Array\<ScanFilter>, options?: ScanOptions): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BLE.startBLEScan |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BLE<br>方法 or 属性:function stopBLEScan(): void;<br>废弃版本:N/A|类名:BLE<br>方法 or 属性:function stopBLEScan(): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BLE.stopBLEScan |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BLE<br>方法 or 属性:function on(type: "BLEDeviceFind", callback: Callback\<Array\<ScanResult>>): void;<br>废弃版本:N/A|类名:BLE<br>方法 or 属性:function on(type: "BLEDeviceFind", callback: Callback\<Array\<ScanResult>>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BLE.on|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BLE<br>方法 or 属性:function off(type: "BLEDeviceFind", callback?: Callback\<Array\<ScanResult>>): void;<br>废弃版本:N/A|类名:BLE<br>方法 or 属性:function off(type: "BLEDeviceFind", callback?: Callback\<Array\<ScanResult>>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BLE.off|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>废弃版本:N/A|类名:GattServer<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:startAdvertising(setting: AdvertiseSetting, advData: AdvertiseData, advResponse?: AdvertiseData): void;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:startAdvertising(setting: AdvertiseSetting, advData: AdvertiseData, advResponse?: AdvertiseData): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:stopAdvertising(): void;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:stopAdvertising(): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:addService(service: GattService): boolean;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:addService(service: GattService): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:removeService(serviceUuid: string): boolean;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:removeService(serviceUuid: string): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:close(): void;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:close(): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:notifyCharacteristicChanged(deviceId: string, notifyCharacteristic: NotifyCharacteristic): boolean;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:notifyCharacteristicChanged(deviceId: string, notifyCharacteristic: NotifyCharacteristic): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:sendResponse(serverResponse: ServerResponse): boolean;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:sendResponse(serverResponse: ServerResponse): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:on(type: "characteristicRead", callback: Callback\<CharacteristicReadReq>): void;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:on(type: "characteristicRead", callback: Callback\<CharacteristicReadReq>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:off(type: "characteristicRead", callback?: Callback\<CharacteristicReadReq>): void;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:off(type: "characteristicRead", callback?: Callback\<CharacteristicReadReq>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:on(type: "characteristicWrite", callback: Callback\<CharacteristicWriteReq>): void;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:on(type: "characteristicWrite", callback: Callback\<CharacteristicWriteReq>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:off(type: "characteristicWrite", callback?: Callback\<CharacteristicWriteReq>): void;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:off(type: "characteristicWrite", callback?: Callback\<CharacteristicWriteReq>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:on(type: "descriptorRead", callback: Callback\<DescriptorReadReq>): void;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:on(type: "descriptorRead", callback: Callback\<DescriptorReadReq>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:off(type: "descriptorRead", callback?: Callback\<DescriptorReadReq>): void;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:off(type: "descriptorRead", callback?: Callback\<DescriptorReadReq>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:on(type: "descriptorWrite", callback: Callback\<DescriptorWriteReq>): void;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:on(type: "descriptorWrite", callback: Callback\<DescriptorWriteReq>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:off(type: "descriptorWrite", callback?: Callback\<DescriptorWriteReq>): void;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:off(type: "descriptorWrite", callback?: Callback\<DescriptorWriteReq>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:on(type: "connectStateChange", callback: Callback\<BLEConnectChangedState>): void;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:on(type: "connectStateChange", callback: Callback\<BLEConnectChangedState>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:off(type: "connectStateChange", callback?: Callback\<BLEConnectChangedState>): void;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:off(type: "connectStateChange", callback?: Callback\<BLEConnectChangedState>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>废弃版本:N/A|类名:GattClientDevice<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:connect(): boolean;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:connect(): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:disconnect(): boolean;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:disconnect(): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:close(): boolean;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:close(): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:getDeviceName(callback: AsyncCallback\<string>): void;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:getDeviceName(callback: AsyncCallback\<string>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:getDeviceName(): Promise\<string>;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:getDeviceName(): Promise\<string>;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:getServices(callback: AsyncCallback\<Array\<GattService>>): void;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:getServices(callback: AsyncCallback\<Array\<GattService>>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:getServices(): Promise\<Array\<GattService>>;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:getServices(): Promise\<Array\<GattService>>;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:readCharacteristicValue(characteristic: BLECharacteristic, callback: AsyncCallback\<BLECharacteristic>): void;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:readCharacteristicValue(characteristic: BLECharacteristic, callback: AsyncCallback\<BLECharacteristic>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:readCharacteristicValue(characteristic: BLECharacteristic): Promise\<BLECharacteristic>;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:readCharacteristicValue(characteristic: BLECharacteristic): Promise\<BLECharacteristic>;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:readDescriptorValue(descriptor: BLEDescriptor, callback: AsyncCallback\<BLEDescriptor>): void;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:readDescriptorValue(descriptor: BLEDescriptor, callback: AsyncCallback\<BLEDescriptor>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:readDescriptorValue(descriptor: BLEDescriptor): Promise\<BLEDescriptor>;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:readDescriptorValue(descriptor: BLEDescriptor): Promise\<BLEDescriptor>;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:writeCharacteristicValue(characteristic: BLECharacteristic): boolean;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:writeCharacteristicValue(characteristic: BLECharacteristic): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:writeDescriptorValue(descriptor: BLEDescriptor): boolean;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:writeDescriptorValue(descriptor: BLEDescriptor): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:getRssiValue(callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:getRssiValue(callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:getRssiValue(): Promise\<number>;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:getRssiValue(): Promise\<number>;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:setBLEMtuSize(mtu: number): boolean;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:setBLEMtuSize(mtu: number): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:setNotifyCharacteristicChanged(characteristic: BLECharacteristic, enable: boolean): boolean;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:setNotifyCharacteristicChanged(characteristic: BLECharacteristic, enable: boolean): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:on(type: "BLECharacteristicChange", callback: Callback\<BLECharacteristic>): void;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:on(type: "BLECharacteristicChange", callback: Callback\<BLECharacteristic>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:off(type: "BLECharacteristicChange", callback?: Callback\<BLECharacteristic>): void;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:off(type: "BLECharacteristicChange", callback?: Callback\<BLECharacteristic>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:on(type: "BLEConnectionStateChange", callback: Callback\<BLEConnectChangedState>): void;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:on(type: "BLEConnectionStateChange", callback: Callback\<BLEConnectChangedState>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:off(type: "BLEConnectionStateChange", callback?: Callback\<BLEConnectChangedState>): void;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:off(type: "BLEConnectionStateChange", callback?: Callback\<BLEConnectChangedState>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattService<br>废弃版本:N/A|类名:GattService<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattService |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BLECharacteristic<br>废弃版本:N/A|类名:BLECharacteristic<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BLECharacteristic |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BLEDescriptor<br>废弃版本:N/A|类名:BLEDescriptor<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BLEDescriptor |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:NotifyCharacteristic<br>废弃版本:N/A|类名:NotifyCharacteristic<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.NotifyCharacteristic |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:CharacteristicReadReq<br>废弃版本:N/A|类名:CharacteristicReadReq<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.CharacteristicReadRequest |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:CharacteristicWriteReq<br>废弃版本:N/A|类名:CharacteristicWriteReq<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.CharacteristicWriteRequest |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:DescriptorReadReq<br>废弃版本:N/A|类名:DescriptorReadReq<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.DescriptorReadRequest |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:DescriptorWriteReq<br>废弃版本:N/A|类名:DescriptorWriteReq<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.DescriptorWriteRequest |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:ServerResponse<br>废弃版本:N/A|类名:ServerResponse<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.ServerResponse |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BLEConnectChangedState<br>废弃版本:N/A|类名:BLEConnectChangedState<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BLEConnectChangedState |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:ScanResult<br>废弃版本:N/A|类名:ScanResult<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.ScanResult |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:AdvertiseSetting<br>废弃版本:N/A|类名:AdvertiseSetting<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.AdvertiseSetting |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:AdvertiseData<br>废弃版本:N/A|类名:AdvertiseData<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.AdvertiseData |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:ManufactureData<br>废弃版本:N/A|类名:ManufactureData<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.ManufactureData |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:ServiceData<br>废弃版本:N/A|类名:ServiceData<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.ServiceData |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:ScanFilter<br>废弃版本:N/A|类名:ScanFilter<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.ScanFilter |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:ScanOptions<br>废弃版本:N/A|类名:ScanOptions<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.ScanOptions |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:SppOption<br>废弃版本:N/A|类名:SppOption<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.SppOption |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:PinRequiredParam<br>废弃版本:N/A|类名:PinRequiredParam<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.PinRequiredParam |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:DeviceClass<br>废弃版本:N/A|类名:DeviceClass<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.DeviceClass |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BondStateParam<br>废弃版本:N/A|类名:BondStateParam<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BondStateParam |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:ScanDuty<br>废弃版本:N/A|类名:ScanDuty<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.ScanDuty |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:MatchMode<br>废弃版本:N/A|类名:MatchMode<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.MatchMode |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:ProfileConnectionState<br>废弃版本:N/A|类名:ProfileConnectionState<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.ProfileConnectionState |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BluetoothState<br>废弃版本:N/A|类名:BluetoothState<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BluetoothState |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:SppType<br>废弃版本:N/A|类名:SppType<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.SppType |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:ScanMode<br>废弃版本:N/A|类名:ScanMode<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.ScanMode |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BondState<br>废弃版本:N/A|类名:BondState<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BondState |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:MajorClass<br>废弃版本:N/A|类名:MajorClass<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.MajorClass |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:MajorMinorClass<br>废弃版本:N/A|类名:MajorMinorClass<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.MajorMinorClass |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:StateChangeParam<br>废弃版本:N/A|类名:StateChangeParam<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.StateChangeParam |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:PlayingState<br>废弃版本:N/A|类名:PlayingState<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.PlayingState |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:ProfileId<br>废弃版本:N/A|类名:ProfileId<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.ProfileId |@ohos.bluetooth.d.ts| +|权限有变化|类名:connection<br>方法 or 属性:function getAddressesByName(host: string, callback: AsyncCallback\<Array\<NetAddress>>): void;<br>权限:ohos.permission.GET_NETWORK_INFO|类名:connection<br>方法 or 属性:function getAddressesByName(host: string, callback: AsyncCallback\<Array\<NetAddress>>): void;<br>权限:ohos.permission.INTERNET|@ohos.net.connection.d.ts| +|权限有变化|类名:connection<br>方法 or 属性:function getAddressesByName(host: string): Promise\<Array\<NetAddress>>;<br>权限:ohos.permission.GET_NETWORK_INFO|类名:connection<br>方法 or 属性:function getAddressesByName(host: string): Promise\<Array\<NetAddress>>;<br>权限:ohos.permission.INTERNET|@ohos.net.connection.d.ts| +|权限有变化|类名:NetHandle<br>方法 or 属性:getAddressesByName(host: string, callback: AsyncCallback\<Array\<NetAddress>>): void;<br>权限:ohos.permission.GET_NETWORK_INFO|类名:NetHandle<br>方法 or 属性:getAddressesByName(host: string, callback: AsyncCallback\<Array\<NetAddress>>): void;<br>权限:ohos.permission.INTERNET|@ohos.net.connection.d.ts| +|权限有变化|类名:NetHandle<br>方法 or 属性:getAddressesByName(host: string): Promise\<Array\<NetAddress>>;<br>权限:ohos.permission.GET_NETWORK_INFO|类名:NetHandle<br>方法 or 属性:getAddressesByName(host: string): Promise\<Array\<NetAddress>>;<br>权限:ohos.permission.INTERNET|@ohos.net.connection.d.ts| +|权限有变化|类名:NetHandle<br>方法 or 属性:getAddressByName(host: string, callback: AsyncCallback\<NetAddress>): void;<br>权限:ohos.permission.GET_NETWORK_INFO|类名:NetHandle<br>方法 or 属性:getAddressByName(host: string, callback: AsyncCallback\<NetAddress>): void;<br>权限:ohos.permission.INTERNET|@ohos.net.connection.d.ts| +|权限有变化|类名:NetHandle<br>方法 or 属性:getAddressByName(host: string): Promise\<NetAddress>;<br>权限:ohos.permission.GET_NETWORK_INFO|类名:NetHandle<br>方法 or 属性:getAddressByName(host: string): Promise\<NetAddress>;<br>权限:ohos.permission.INTERNET|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function getDefaultNet(callback: AsyncCallback\<NetHandle>): void;<br>错误码内容: 201, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function getDefaultNet(): Promise\<NetHandle>;<br>错误码内容: 201, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function getAllNets(callback: AsyncCallback\<Array\<NetHandle>>): void;<br>错误码内容: 201, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function getAllNets(): Promise\<Array\<NetHandle>>;<br>错误码内容: 201, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function getConnectionProperties(netHandle: NetHandle, callback: AsyncCallback\<ConnectionProperties>): void;<br>错误码内容: 201, 401, 2100001, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function getConnectionProperties(netHandle: NetHandle): Promise\<ConnectionProperties>;<br>错误码内容: 201, 401, 2100001, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function getNetCapabilities(netHandle: NetHandle, callback: AsyncCallback\<NetCapabilities>): void;<br>错误码内容: 201, 401, 2100001, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function getNetCapabilities(netHandle: NetHandle): Promise\<NetCapabilities>;<br>错误码内容: 201, 401, 2100001, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function hasDefaultNet(callback: AsyncCallback\<boolean>): void;<br>错误码内容: 201, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function hasDefaultNet(): Promise\<boolean>;<br>错误码内容: 201, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function enableAirplaneMode(callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function enableAirplaneMode(): Promise\<void>;<br>错误码内容: 201, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function disableAirplaneMode(callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function disableAirplaneMode(): Promise\<void>;<br>错误码内容: 201, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function reportNetConnected(netHandle: NetHandle, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 2100001, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function reportNetConnected(netHandle: NetHandle): Promise\<void>;<br>错误码内容: 201, 401, 2100001, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function reportNetDisconnected(netHandle: NetHandle, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 2100001, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function reportNetDisconnected(netHandle: NetHandle): Promise\<void>;<br>错误码内容: 201, 401, 2100001, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function getAddressesByName(host: string, callback: AsyncCallback\<Array\<NetAddress>>): void;<br>错误码内容: 201, 401, 2100001, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function getAddressesByName(host: string): Promise\<Array\<NetAddress>>;<br>错误码内容: 201, 401, 2100001, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:NetConnection<br>方法 or 属性:register(callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 2100002, 2100003, 2101008, 2101022|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:NetConnection<br>方法 or 属性:unregister(callback: AsyncCallback\<void>): void;<br>错误码内容: 2100002, 2100003, 2101007|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:NetHandle<br>方法 or 属性:bindSocket(socketParam: TCPSocket \| UDPSocket, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 2100001, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:NetHandle<br>方法 or 属性:bindSocket(socketParam: TCPSocket \| UDPSocket): Promise\<void>;<br>错误码内容: 401, 2100001, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:NetHandle<br>方法 or 属性:getAddressesByName(host: string, callback: AsyncCallback\<Array\<NetAddress>>): void;<br>错误码内容: 201, 401, 2100001, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:NetHandle<br>方法 or 属性:getAddressesByName(host: string): Promise\<Array\<NetAddress>>;<br>错误码内容: 201, 401, 2100001, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:NetHandle<br>方法 or 属性:getAddressByName(host: string, callback: AsyncCallback\<NetAddress>): void;<br>错误码内容: 201, 401, 2100001, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:NetHandle<br>方法 or 属性:getAddressByName(host: string): Promise\<NetAddress>;<br>错误码内容: 201, 401, 2100001, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:ethernet<br>方法 or 属性:function getIfaceConfig(iface: string, callback: AsyncCallback\<InterfaceConfiguration>): void;<br>错误码内容: 201, 401, 2200001, 2200002, 2200003, 2201005|@ohos.net.ethernet.d.ts| +|新增(错误码)|NA|类名:ethernet<br>方法 or 属性:function getIfaceConfig(iface: string): Promise\<InterfaceConfiguration>;<br>错误码内容: 201, 401, 2200001, 2200002, 2200003, 2201005|@ohos.net.ethernet.d.ts| +|新增(错误码)|NA|类名:ethernet<br>方法 or 属性:function setIfaceConfig(iface: string, ic: InterfaceConfiguration, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 2200001, 2200002, 2200003, 2201004, 2201005, 2201006, 2201007|@ohos.net.ethernet.d.ts| +|新增(错误码)|NA|类名:ethernet<br>方法 or 属性:function setIfaceConfig(iface: string, ic: InterfaceConfiguration): Promise\<void>;<br>错误码内容: 201, 401, 2200001, 2200002, 2200003, 2201004, 2201005, 2201006, 2201007|@ohos.net.ethernet.d.ts| +|新增(错误码)|NA|类名:ethernet<br>方法 or 属性:function isIfaceActive(iface: string, callback: AsyncCallback\<number>): void;<br>错误码内容: 201, 401, 2200001, 2200002, 2200003, 2201005|@ohos.net.ethernet.d.ts| +|新增(错误码)|NA|类名:ethernet<br>方法 or 属性:function isIfaceActive(iface: string): Promise\<number>;<br>错误码内容: 201, 401, 2200001, 2200002, 2200003, 2201005|@ohos.net.ethernet.d.ts| +|新增(错误码)|NA|类名:ethernet<br>方法 or 属性:function getAllActiveIfaces(callback: AsyncCallback\<Array\<string>>): void;<br>错误码内容: 201, 2200002, 2200003|@ohos.net.ethernet.d.ts| +|新增(错误码)|NA|类名:ethernet<br>方法 or 属性:function getAllActiveIfaces(): Promise\<Array\<string>>;<br>错误码内容: 201, 2200002, 2200003|@ohos.net.ethernet.d.ts| +|新增(错误码)|NA|类名:HttpRequest<br>方法 or 属性:request(url: string, callback: AsyncCallback\<HttpResponse>): void;<br>错误码内容: 401, 201, 2300001, 2300003, 2300005, 2300006, 2300007, 2300008, 2300009, 2300016, 2300018, 2300023, 2300025, 2300026, 2300027, 2300028, 2300047, 2300052, 2300055, 2300056, 2300058, 2300059, 2300060, 2300061, 2300063, 2300070, 2300073, 2300077, 2300078, 2300094, 2300999|@ohos.net.http.d.ts| +|新增(错误码)|NA|类名:HttpRequest<br>方法 or 属性:request(url: string, options: HttpRequestOptions, callback: AsyncCallback\<HttpResponse>): void;<br>错误码内容: 401, 201, 2300001, 2300003, 2300005, 2300006, 2300007, 2300008, 2300009, 2300016, 2300018, 2300023, 2300025, 2300026, 2300027, 2300028, 2300047, 2300052, 2300055, 2300056, 2300058, 2300059, 2300060, 2300061, 2300063, 2300070, 2300073, 2300077, 2300078, 2300094, 2300999|@ohos.net.http.d.ts| +|新增(错误码)|NA|类名:HttpRequest<br>方法 or 属性:request(url: string, options?: HttpRequestOptions): Promise\<HttpResponse>;<br>错误码内容: 401, 201, 2300001, 2300003, 2300005, 2300006, 2300007, 2300008, 2300009, 2300016, 2300018, 2300023, 2300025, 2300026, 2300027, 2300028, 2300047, 2300052, 2300055, 2300056, 2300058, 2300059, 2300060, 2300061, 2300063, 2300070, 2300073, 2300077, 2300078, 2300094, 2300999|@ohos.net.http.d.ts| +|新增(错误码)|NA|类名:sharing<br>方法 or 属性:function isSharingSupported(callback: AsyncCallback\<boolean>): void;<br>错误码内容: 201, 2200002, 2200003, 2202011|@ohos.net.sharing.d.ts| +|新增(错误码)|NA|类名:sharing<br>方法 or 属性:function isSharingSupported(): Promise\<boolean>;<br>错误码内容: 201, 2200002, 2200003, 2202011|@ohos.net.sharing.d.ts| +|新增(错误码)|NA|类名:sharing<br>方法 or 属性:function isSharing(callback: AsyncCallback\<boolean>): void;<br>错误码内容: 201, 2200002, 2200003, 2202011|@ohos.net.sharing.d.ts| +|新增(错误码)|NA|类名:sharing<br>方法 or 属性:function isSharing(): Promise\<boolean>;<br>错误码内容: 201, 2200002, 2200003, 2202011|@ohos.net.sharing.d.ts| +|新增(错误码)|NA|类名:sharing<br>方法 or 属性:function startSharing(type: SharingIfaceType, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 2200001, 2200002, 2200003, 2202004, 2202005, 2202006, 2202009, 2202011|@ohos.net.sharing.d.ts| +|新增(错误码)|NA|类名:sharing<br>方法 or 属性:function startSharing(type: SharingIfaceType): Promise\<void>;<br>错误码内容: 201, 401, 2200001, 2200002, 2200003, 2202004, 2202005, 2202006, 2202009, 2202011|@ohos.net.sharing.d.ts| +|新增(错误码)|NA|类名:sharing<br>方法 or 属性:function stopSharing(type: SharingIfaceType, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 2200001, 2200002, 2200003, 2202004, 2202005, 2202006, 2202011|@ohos.net.sharing.d.ts| +|新增(错误码)|NA|类名:sharing<br>方法 or 属性:function stopSharing(type: SharingIfaceType): Promise\<void>;<br>错误码内容: 201, 401, 2200001, 2200002, 2200003, 2202004, 2202005, 2202006, 2202011|@ohos.net.sharing.d.ts| +|新增(错误码)|NA|类名:sharing<br>方法 or 属性:function getStatsRxBytes(callback: AsyncCallback\<number>): void;<br>错误码内容: 201, 2200002, 2200003|@ohos.net.sharing.d.ts| +|新增(错误码)|NA|类名:sharing<br>方法 or 属性:function getStatsRxBytes(): Promise\<number>;<br>错误码内容: 201, 2200002, 2200003|@ohos.net.sharing.d.ts| +|新增(错误码)|NA|类名:sharing<br>方法 or 属性:function getStatsTxBytes(callback: AsyncCallback\<number>): void;<br>错误码内容: 201, 2200002, 2200003|@ohos.net.sharing.d.ts| +|新增(错误码)|NA|类名:sharing<br>方法 or 属性:function getStatsTxBytes(): Promise\<number>;<br>错误码内容: 201, 2200002, 2200003|@ohos.net.sharing.d.ts| +|新增(错误码)|NA|类名:sharing<br>方法 or 属性:function getStatsTotalBytes(callback: AsyncCallback\<number>): void;<br>错误码内容: 201, 2200002, 2200003|@ohos.net.sharing.d.ts| +|新增(错误码)|NA|类名:sharing<br>方法 or 属性:function getStatsTotalBytes(): Promise\<number>;<br>错误码内容: 201, 2200002, 2200003|@ohos.net.sharing.d.ts| +|新增(错误码)|NA|类名:sharing<br>方法 or 属性:function getSharingIfaces(state: SharingIfaceState, callback: AsyncCallback\<Array\<string>>): void;<br>错误码内容: 201, 401, 2200001, 2200002, 2200003|@ohos.net.sharing.d.ts| +|新增(错误码)|NA|类名:sharing<br>方法 or 属性:function getSharingIfaces(state: SharingIfaceState): Promise\<Array\<string>>;<br>错误码内容: 201, 401, 2200001, 2200002, 2200003|@ohos.net.sharing.d.ts| +|新增(错误码)|NA|类名:sharing<br>方法 or 属性:function getSharingState(type: SharingIfaceType, callback: AsyncCallback\<SharingIfaceState>): void;<br>错误码内容: 201, 401, 2200001, 2200002, 2200003|@ohos.net.sharing.d.ts| +|新增(错误码)|NA|类名:sharing<br>方法 or 属性:function getSharingState(type: SharingIfaceType): Promise\<SharingIfaceState>;<br>错误码内容: 201, 401, 2200001, 2200002, 2200003|@ohos.net.sharing.d.ts| +|新增(错误码)|NA|类名:sharing<br>方法 or 属性:function getSharableRegexes(type: SharingIfaceType, callback: AsyncCallback\<Array\<string>>): void;<br>错误码内容: 201, 401, 2200001, 2200002, 2200003|@ohos.net.sharing.d.ts| +|新增(错误码)|NA|类名:sharing<br>方法 or 属性:function getSharableRegexes(type: SharingIfaceType): Promise\<Array\<string>>;<br>错误码内容: 201, 401, 2200001, 2200002, 2200003|@ohos.net.sharing.d.ts| +|新增(错误码)|NA|类名:sharing<br>方法 or 属性:function on(type: 'sharingStateChange', callback: Callback\<boolean>): void;<br>错误码内容: 201, 401|@ohos.net.sharing.d.ts| +|新增(错误码)|NA|类名:sharing<br>方法 or 属性:function off(type: 'sharingStateChange', callback?: Callback\<boolean>): void;<br>错误码内容: 201, 401|@ohos.net.sharing.d.ts| +|新增(错误码)|NA|类名:sharing<br>方法 or 属性:function on(type: 'interfaceSharingStateChange', callback: Callback\<{ type: SharingIfaceType, iface: string, state: SharingIfaceState }>): void;<br>错误码内容: 201, 401|@ohos.net.sharing.d.ts| +|新增(错误码)|NA|类名:sharing<br>方法 or 属性:function off(type: 'interfaceSharingStateChange', callback?: Callback\<{ type: SharingIfaceType, iface: string, state: SharingIfaceState }>): void;<br>错误码内容: 201, 401|@ohos.net.sharing.d.ts| +|新增(错误码)|NA|类名:sharing<br>方法 or 属性:function on(type: 'sharingUpstreamChange', callback: Callback\<NetHandle>): void;<br>错误码内容: 201, 401|@ohos.net.sharing.d.ts| +|新增(错误码)|NA|类名:sharing<br>方法 or 属性:function off(type: 'sharingUpstreamChange', callback?: Callback\<NetHandle>): void;<br>错误码内容: 201, 401|@ohos.net.sharing.d.ts| +|新增(错误码)|NA|类名:UDPSocket<br>方法 or 属性:bind(address: NetAddress, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:UDPSocket<br>方法 or 属性:bind(address: NetAddress): Promise\<void>;<br>错误码内容: 401, 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:UDPSocket<br>方法 or 属性:send(options: UDPSendOptions, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:UDPSocket<br>方法 or 属性:send(options: UDPSendOptions): Promise\<void>;<br>错误码内容: 401, 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:UDPSocket<br>方法 or 属性:close(callback: AsyncCallback\<void>): void;<br>错误码内容: 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:UDPSocket<br>方法 or 属性:close(): Promise\<void>;<br>错误码内容: 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:UDPSocket<br>方法 or 属性:getState(callback: AsyncCallback\<SocketStateBase>): void;<br>错误码内容: 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:UDPSocket<br>方法 or 属性:getState(): Promise\<SocketStateBase>;<br>错误码内容: 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:UDPSocket<br>方法 or 属性:setExtraOptions(options: UDPExtraOptions, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:UDPSocket<br>方法 or 属性:setExtraOptions(options: UDPExtraOptions): Promise\<void>;<br>错误码内容: 401, 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:TCPSocket<br>方法 or 属性:bind(address: NetAddress, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:TCPSocket<br>方法 or 属性:bind(address: NetAddress): Promise\<void>;<br>错误码内容: 401, 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:TCPSocket<br>方法 or 属性:connect(options: TCPConnectOptions, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:TCPSocket<br>方法 or 属性:connect(options: TCPConnectOptions): Promise\<void>;<br>错误码内容: 401, 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:TCPSocket<br>方法 or 属性:send(options: TCPSendOptions, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:TCPSocket<br>方法 or 属性:send(options: TCPSendOptions): Promise\<void>;<br>错误码内容: 401, 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:TCPSocket<br>方法 or 属性:close(callback: AsyncCallback\<void>): void;<br>错误码内容: 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:TCPSocket<br>方法 or 属性:close(): Promise\<void>;<br>错误码内容: 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:TCPSocket<br>方法 or 属性:getRemoteAddress(callback: AsyncCallback\<NetAddress>): void;<br>错误码内容: 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:TCPSocket<br>方法 or 属性:getRemoteAddress(): Promise\<NetAddress>;<br>错误码内容: 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:TCPSocket<br>方法 or 属性:getState(callback: AsyncCallback\<SocketStateBase>): void;<br>错误码内容: 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:TCPSocket<br>方法 or 属性:getState(): Promise\<SocketStateBase>;<br>错误码内容: 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:TCPSocket<br>方法 or 属性:setExtraOptions(options: TCPExtraOptions, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:TCPSocket<br>方法 or 属性:setExtraOptions(options: TCPExtraOptions): Promise\<void>;<br>错误码内容: 401, 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:WebSocket<br>方法 or 属性:connect(url: string, callback: AsyncCallback\<boolean>): void;<br>错误码内容: 401, 201|@ohos.net.webSocket.d.ts| +|新增(错误码)|NA|类名:WebSocket<br>方法 or 属性:connect(url: string, options: WebSocketRequestOptions, callback: AsyncCallback\<boolean>): void;<br>错误码内容: 401, 201|@ohos.net.webSocket.d.ts| +|新增(错误码)|NA|类名:WebSocket<br>方法 or 属性:connect(url: string, options?: WebSocketRequestOptions): Promise\<boolean>;<br>错误码内容: 401, 201|@ohos.net.webSocket.d.ts| +|新增(错误码)|NA|类名:WebSocket<br>方法 or 属性:send(data: string \| ArrayBuffer, callback: AsyncCallback\<boolean>): void;<br>错误码内容: 401, 201|@ohos.net.webSocket.d.ts| +|新增(错误码)|NA|类名:WebSocket<br>方法 or 属性:send(data: string \| ArrayBuffer): Promise\<boolean>;<br>错误码内容: 401, 201|@ohos.net.webSocket.d.ts| +|新增(错误码)|NA|类名:WebSocket<br>方法 or 属性:close(callback: AsyncCallback\<boolean>): void;<br>错误码内容: 401, 201|@ohos.net.webSocket.d.ts| +|新增(错误码)|NA|类名:WebSocket<br>方法 or 属性:close(options: WebSocketCloseOptions, callback: AsyncCallback\<boolean>): void;<br>错误码内容: 401, 201|@ohos.net.webSocket.d.ts| +|新增(错误码)|NA|类名:WebSocket<br>方法 or 属性:close(options?: WebSocketCloseOptions): Promise\<boolean>;<br>错误码内容: 401, 201|@ohos.net.webSocket.d.ts| +|新增(权限)|类名:connection<br>方法 or 属性:function enableAirplaneMode(callback: AsyncCallback\<void>): void;<br>权限:N/A|类名:connection<br>方法 or 属性:function enableAirplaneMode(callback: AsyncCallback\<void>): void;<br>权限:ohos.permission.CONNECTIVITY_INTERNAL|@ohos.net.connection.d.ts| +|新增(权限)|类名:connection<br>方法 or 属性:function enableAirplaneMode(): Promise\<void>;<br>权限:N/A|类名:connection<br>方法 or 属性:function enableAirplaneMode(): Promise\<void>;<br>权限:ohos.permission.CONNECTIVITY_INTERNAL|@ohos.net.connection.d.ts| +|新增(权限)|类名:connection<br>方法 or 属性:function disableAirplaneMode(callback: AsyncCallback\<void>): void;<br>权限:N/A|类名:connection<br>方法 or 属性:function disableAirplaneMode(callback: AsyncCallback\<void>): void;<br>权限:ohos.permission.CONNECTIVITY_INTERNAL|@ohos.net.connection.d.ts| +|新增(权限)|类名:connection<br>方法 or 属性:function disableAirplaneMode(): Promise\<void>;<br>权限:N/A|类名:connection<br>方法 or 属性:function disableAirplaneMode(): Promise\<void>;<br>权限:ohos.permission.CONNECTIVITY_INTERNAL|@ohos.net.connection.d.ts| +|函数有变化|类名:RemoteProxy<br>方法 or 属性:unregisterDeathRecipient(recipient: DeathRecipient, flags: number): boolean;<br>|类名:RemoteProxy<br>方法 or 属性:unregisterDeathRecipient(recipient: DeathRecipient, flags: number): void;<br>|@ohos.rpc.d.ts| diff --git a/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-compiler-and-runtime.md b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-compiler-and-runtime.md new file mode 100644 index 0000000000000000000000000000000000000000..cc204e2d9a8d902aec842fe5e7074e77e155818d --- /dev/null +++ b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-compiler-and-runtime.md @@ -0,0 +1,7 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|类名:util<br>方法or属性:function generateRandomUUID(entropyCache?: boolean): string;|@ohos.util.d.ts| +|新增|NA|类名:util<br>方法or属性:function generateRandomBinaryUUID(entropyCache?: boolean): Uint8Array;|@ohos.util.d.ts| +|删除|模块名:ohos.util<br>类名:util<br>方法 or 属性:function randomUUID(entropyCache?: boolean): string;|NA|@ohos.util.d.ts| +|删除|模块名:ohos.util<br>类名:util<br>方法 or 属性:function randomBinaryUUID(entropyCache?: boolean): Uint8Array;|NA|@ohos.util.d.ts| +|函数有变化|类名:LRUCache<br>方法 or 属性:contains(key: object): boolean;<br>|类名:LRUCache<br>方法 or 属性:contains(key: K): boolean;<br>|@ohos.util.d.ts| diff --git a/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-dfx.md b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-dfx.md new file mode 100644 index 0000000000000000000000000000000000000000..129a0e0594cabec6c01fca13c3a518b5a184cc00 --- /dev/null +++ b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-dfx.md @@ -0,0 +1,26 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: event|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|类名:event<br>方法or属性:|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: event<br>方法 or 属性:const USER_LOGIN: string;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|类名:event<br>方法or属性:const USER_LOGIN: string;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: event<br>方法 or 属性:const USER_LOGOUT: string;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|类名:event<br>方法or属性:const USER_LOGOUT: string;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: event<br>方法 or 属性:const DISTRIBUTED_SERVICE_START: string;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|类名:event<br>方法or属性:const DISTRIBUTED_SERVICE_START: string;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: param|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|类名:param<br>方法or属性:|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: param<br>方法 or 属性:const USER_ID: string;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|类名:param<br>方法or属性:const USER_ID: string;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: param<br>方法 or 属性:const DISTRIBUTED_SERVICE_NAME: string;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|类名:param<br>方法or属性:const DISTRIBUTED_SERVICE_NAME: string;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: param<br>方法 or 属性:const DISTRIBUTED_SERVICE_INSTANCE_ID: string;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|类名:param<br>方法or属性:const DISTRIBUTED_SERVICE_INSTANCE_ID: string;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|删除|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: Event|NA|@ohos.hiviewdfx.hiAppEvent.d.ts| +|删除|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: Event<br>方法 or 属性:const USER_LOGIN: string;|NA|@ohos.hiviewdfx.hiAppEvent.d.ts| +|删除|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: Event<br>方法 or 属性:const USER_LOGOUT: string;|NA|@ohos.hiviewdfx.hiAppEvent.d.ts| +|删除|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: Event<br>方法 or 属性:const DISTRIBUTED_SERVICE_START: string;|NA|@ohos.hiviewdfx.hiAppEvent.d.ts| +|删除|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: Param|NA|@ohos.hiviewdfx.hiAppEvent.d.ts| +|删除|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: Param<br>方法 or 属性:const USER_ID: string;|NA|@ohos.hiviewdfx.hiAppEvent.d.ts| +|删除|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: Param<br>方法 or 属性:const DISTRIBUTED_SERVICE_NAME: string;|NA|@ohos.hiviewdfx.hiAppEvent.d.ts| +|删除|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: Param<br>方法 or 属性:const DISTRIBUTED_SERVICE_INSTANCE_ID: string;|NA|@ohos.hiviewdfx.hiAppEvent.d.ts| diff --git a/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-distributed-data.md b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-distributed-data.md new file mode 100644 index 0000000000000000000000000000000000000000..7fec4a15c3a55b150170e2aa65d3280a7fa209fe --- /dev/null +++ b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-distributed-data.md @@ -0,0 +1,162 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.data.distributedDataObject<br>类名: DataObject|@ohos.data.distributedDataObject.d.ts| +|新增|NA|类名:DataObject<br>方法or属性:|@ohos.data.distributedDataObject.d.ts| +|新增|NA|模块名: ohos.data.distributedDataObject<br>类名: DataObject<br>方法 or 属性:setSessionId(sessionId: string, callback: AsyncCallback\<void>): void;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|类名:DataObject<br>方法or属性:setSessionId(sessionId: string, callback: AsyncCallback\<void>): void;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|模块名: ohos.data.distributedDataObject<br>类名: DataObject<br>方法 or 属性:setSessionId(callback: AsyncCallback\<void>): void;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|类名:DataObject<br>方法or属性:setSessionId(callback: AsyncCallback\<void>): void;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|模块名: ohos.data.distributedDataObject<br>类名: DataObject<br>方法 or 属性:setSessionId(sessionId?: string): Promise\<void>;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|类名:DataObject<br>方法or属性:setSessionId(sessionId?: string): Promise\<void>;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|模块名: ohos.data.distributedDataObject<br>类名: DataObject<br>方法 or 属性:on(type: 'change', callback: Callback\<{ sessionId: string, fields: Array\<string> }>): void;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|类名:DataObject<br>方法or属性:on(type: 'change', callback: Callback\<{ sessionId: string, fields: Array\<string> }>): void;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|模块名: ohos.data.distributedDataObject<br>类名: DataObject<br>方法 or 属性:off(type: 'change', callback?: Callback\<{ sessionId: string, fields: Array\<string> }>): void;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|类名:DataObject<br>方法or属性:off(type: 'change', callback?: Callback\<{ sessionId: string, fields: Array\<string> }>): void;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|模块名: ohos.data.distributedDataObject<br>类名: DataObject<br>方法 or 属性:on(type: 'status',<br><br> callback: Callback\<{ sessionId: string, networkId: string, status: 'online' \| 'offline' }>): void;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|类名:DataObject<br>方法or属性:on(type: 'status',<br><br> callback: Callback\<{ sessionId: string, networkId: string, status: 'online' \| 'offline' }>): void;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|模块名: ohos.data.distributedDataObject<br>类名: DataObject<br>方法 or 属性:off(type: 'status',<br><br> callback?: Callback\<{ sessionId: string, deviceId: string, status: 'online' \| 'offline' }>): void;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|类名:DataObject<br>方法or属性:off(type: 'status',<br><br> callback?: Callback\<{ sessionId: string, deviceId: string, status: 'online' \| 'offline' }>): void;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|模块名: ohos.data.distributedDataObject<br>类名: DataObject<br>方法 or 属性:save(deviceId: string, callback: AsyncCallback\<SaveSuccessResponse>): void;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|类名:DataObject<br>方法or属性:save(deviceId: string, callback: AsyncCallback\<SaveSuccessResponse>): void;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|模块名: ohos.data.distributedDataObject<br>类名: DataObject<br>方法 or 属性:save(deviceId: string): Promise\<SaveSuccessResponse>;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|类名:DataObject<br>方法or属性:save(deviceId: string): Promise\<SaveSuccessResponse>;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|模块名: ohos.data.distributedDataObject<br>类名: DataObject<br>方法 or 属性:revokeSave(callback: AsyncCallback\<RevokeSaveSuccessResponse>): void;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|类名:DataObject<br>方法or属性:revokeSave(callback: AsyncCallback\<RevokeSaveSuccessResponse>): void;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|模块名: ohos.data.distributedDataObject<br>类名: DataObject<br>方法 or 属性:revokeSave(): Promise\<RevokeSaveSuccessResponse>;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|类名:DataObject<br>方法or属性:revokeSave(): Promise\<RevokeSaveSuccessResponse>;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|类名:Constants<br>方法or属性:readonly MAX_KEY_LENGTH: number;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|类名:Constants<br>方法or属性:readonly MAX_VALUE_LENGTH: number;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|类名:Constants<br>方法or属性:readonly MAX_KEY_LENGTH_DEVICE: number;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|类名:Constants<br>方法or属性:readonly MAX_STORE_ID_LENGTH: number;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|类名:Constants<br>方法or属性:readonly MAX_QUERY_LENGTH: number;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|类名:Constants<br>方法or属性:readonly MAX_BATCH_SIZE: number;|@ohos.data.distributedKVStore.d.ts| +|删除|模块名: ohos.data.distributedDataObject<br>类名: DistributedObjectV9|NA|@ohos.data.distributedDataObject.d.ts| +|删除|模块名: ohos.data.distributedDataObject<br>类名: DistributedObjectV9<br>方法 or 属性:setSessionId(sessionId: string, callback: AsyncCallback\<void>): void;|NA|@ohos.data.distributedDataObject.d.ts| +|删除|模块名: ohos.data.distributedDataObject<br>类名: DistributedObjectV9<br>方法 or 属性:setSessionId(callback: AsyncCallback\<void>): void;|NA|@ohos.data.distributedDataObject.d.ts| +|删除|模块名: ohos.data.distributedDataObject<br>类名: DistributedObjectV9<br>方法 or 属性:setSessionId(sessionId?: string): Promise\<void>;|NA|@ohos.data.distributedDataObject.d.ts| +|删除|模块名: ohos.data.distributedDataObject<br>类名: DistributedObjectV9<br>方法 or 属性:on(type: 'change', callback: Callback\<{ sessionId: string, fields: Array\<string> }>): void;|NA|@ohos.data.distributedDataObject.d.ts| +|删除|模块名: ohos.data.distributedDataObject<br>类名: DistributedObjectV9<br>方法 or 属性:off(type: 'change', callback?: Callback\<{ sessionId: string, fields: Array\<string> }>): void;|NA|@ohos.data.distributedDataObject.d.ts| +|删除|模块名: ohos.data.distributedDataObject<br>类名: DistributedObjectV9<br>方法 or 属性:on(type: 'status',<br><br> callback: Callback\<{ sessionId: string, networkId: string, status: 'online' \| 'offline' }>): void;|NA|@ohos.data.distributedDataObject.d.ts| +|删除|模块名: ohos.data.distributedDataObject<br>类名: DistributedObjectV9<br>方法 or 属性:off(type: 'status',<br><br> callback?: Callback\<{ sessionId: string, deviceId: string, status: 'online' \| 'offline' }>): void;|NA|@ohos.data.distributedDataObject.d.ts| +|删除|模块名: ohos.data.distributedDataObject<br>类名: DistributedObjectV9<br>方法 or 属性:save(deviceId: string, callback: AsyncCallback\<SaveSuccessResponse>): void;|NA|@ohos.data.distributedDataObject.d.ts| +|删除|模块名: ohos.data.distributedDataObject<br>类名: DistributedObjectV9<br>方法 or 属性:save(deviceId: string): Promise\<SaveSuccessResponse>;|NA|@ohos.data.distributedDataObject.d.ts| +|删除|模块名: ohos.data.distributedDataObject<br>类名: DistributedObjectV9<br>方法 or 属性:revokeSave(callback: AsyncCallback\<RevokeSaveSuccessResponse>): void;|NA|@ohos.data.distributedDataObject.d.ts| +|删除|模块名: ohos.data.distributedDataObject<br>类名: DistributedObjectV9<br>方法 or 属性:revokeSave(): Promise\<RevokeSaveSuccessResponse>;|NA|@ohos.data.distributedDataObject.d.ts| +|删除|模块名:ohos.data.distributedKVStore<br>类名:Constants|NA|@ohos.data.distributedKVStore.d.ts| +|删除|模块名:ohos.data.distributedKVStore<br>类名:Constants<br>方法 or 属性:const MAX_KEY_LENGTH = 1024;|NA|@ohos.data.distributedKVStore.d.ts| +|删除|模块名:ohos.data.distributedKVStore<br>类名:Constants<br>方法 or 属性:const MAX_VALUE_LENGTH = 4194303;|NA|@ohos.data.distributedKVStore.d.ts| +|删除|模块名:ohos.data.distributedKVStore<br>类名:Constants<br>方法 or 属性:const MAX_KEY_LENGTH_DEVICE = 896;|NA|@ohos.data.distributedKVStore.d.ts| +|删除|模块名:ohos.data.distributedKVStore<br>类名:Constants<br>方法 or 属性:const MAX_STORE_ID_LENGTH = 128;|NA|@ohos.data.distributedKVStore.d.ts| +|删除|模块名:ohos.data.distributedKVStore<br>类名:Constants<br>方法 or 属性:const MAX_QUERY_LENGTH = 512000;|NA|@ohos.data.distributedKVStore.d.ts| +|删除|模块名:ohos.data.distributedKVStore<br>类名:Constants<br>方法 or 属性:const MAX_BATCH_SIZE = 128;|NA|@ohos.data.distributedKVStore.d.ts| +|删除|模块名:ohos.data.rdb<br>类名:rdb<br>方法 or 属性:function getRdbStoreV9(context: Context, config: StoreConfigV9, version: number, callback: AsyncCallback\<RdbStoreV9>): void;|NA|@ohos.data.rdb.d.ts| +|删除|模块名:ohos.data.rdb<br>类名:rdb<br>方法 or 属性:function getRdbStoreV9(context: Context, config: StoreConfigV9, version: number): Promise\<RdbStoreV9>;|NA|@ohos.data.rdb.d.ts| +|删除|模块名:ohos.data.rdb<br>类名:rdb<br>方法 or 属性:function deleteRdbStoreV9(context: Context, name: string, callback: AsyncCallback\<void>): void;|NA|@ohos.data.rdb.d.ts| +|删除|模块名:ohos.data.rdb<br>类名:rdb<br>方法 or 属性:function deleteRdbStoreV9(context: Context, name: string): Promise\<void>;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: SecurityLevel|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: SecurityLevel<br>方法 or 属性:S1 = 1|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: SecurityLevel<br>方法 or 属性:S2 = 2|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: SecurityLevel<br>方法 or 属性:S3 = 3|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: SecurityLevel<br>方法 or 属性:S4 = 4|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:insert(table: string, values: ValuesBucket, callback: AsyncCallback\<number>): void;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:insert(table: string, values: ValuesBucket): Promise\<number>;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:batchInsert(table: string, values: Array\<ValuesBucket>, callback: AsyncCallback\<number>): void;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:batchInsert(table: string, values: Array\<ValuesBucket>): Promise\<number>;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:update(values: ValuesBucket, predicates: RdbPredicatesV9, callback: AsyncCallback\<number>): void;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:update(values: ValuesBucket, predicates: RdbPredicatesV9): Promise\<number>;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback\<number>): void;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates): Promise\<number>;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:delete(predicates: RdbPredicatesV9, callback: AsyncCallback\<number>): void;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:delete(predicates: RdbPredicatesV9): Promise\<number>;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:delete(table: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback\<number>): void;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:delete(table: string, predicates: dataSharePredicates.DataSharePredicates): Promise\<number>;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:query(predicates: RdbPredicatesV9, columns: Array\<string>, callback: AsyncCallback\<ResultSetV9>): void;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:query(predicates: RdbPredicatesV9, columns ?: Array\<string>): Promise\<ResultSetV9>;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array\<string>, callback: AsyncCallback\<ResultSetV9>): void;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns ?: Array\<string>): Promise\<ResultSetV9>;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:remoteQuery(device: string, table: string, predicates: RdbPredicatesV9, columns: Array\<string>, callback: AsyncCallback\<ResultSetV9>): void;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:remoteQuery(device: string, table: string, predicates: RdbPredicatesV9, columns: Array\<string>): Promise\<ResultSetV9>;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:querySql(sql: string, bindArgs: Array\<ValueType>, callback: AsyncCallback\<ResultSetV9>): void;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:querySql(sql: string, bindArgs ?: Array\<ValueType>): Promise\<ResultSetV9>;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:executeSql(sql: string, bindArgs: Array\<ValueType>, callback: AsyncCallback\<void>): void;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:executeSql(sql: string, bindArgs ?: Array\<ValueType>): Promise\<void>;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:beginTransaction(): void;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:commit(): void;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:rollBack(): void;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:backup(destName: string, callback: AsyncCallback\<void>): void;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:backup(destName: string): Promise\<void>;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:restore(srcName: string, callback: AsyncCallback\<void>): void;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:restore(srcName: string): Promise\<void>;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:setDistributedTables(tables: Array\<string>, callback: AsyncCallback\<void>): void;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:setDistributedTables(tables: Array\<string>): Promise\<void>;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:obtainDistributedTableName(device: string, table: string, callback: AsyncCallback\<string>): void;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:obtainDistributedTableName(device: string, table: string): Promise\<string>;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:sync(mode: SyncMode, predicates: RdbPredicatesV9, callback: AsyncCallback\<Array\<[ string, number ]>>): void;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:sync(mode: SyncMode, predicates: RdbPredicatesV9): Promise\<Array\<[ string, number ]>>;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:on(event: 'dataChange', type: SubscribeType, observer: Callback\<Array\<string>>): void;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbStoreV9<br>方法 or 属性:off(event: 'dataChange', type: SubscribeType, observer: Callback\<Array\<string>>): void;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: StoreConfigV9|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: StoreConfigV9<br>方法 or 属性:name: string;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: StoreConfigV9<br>方法 or 属性:securityLevel: SecurityLevel;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: StoreConfigV9<br>方法 or 属性:encrypt ?: boolean;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:constructor(name: string)|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:inDevices(devices: Array\<string>): RdbPredicatesV9;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:inAllDevices(): RdbPredicatesV9;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:equalTo(field: string, value: ValueType): RdbPredicatesV9;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:notEqualTo(field: string, value: ValueType): RdbPredicatesV9;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:beginWrap(): RdbPredicatesV9;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:endWrap(): RdbPredicatesV9;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:or(): RdbPredicatesV9;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:and(): RdbPredicatesV9;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:contains(field: string, value: string): RdbPredicatesV9;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:beginsWith(field: string, value: string): RdbPredicatesV9;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:endsWith(field: string, value: string): RdbPredicatesV9;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:isNull(field: string): RdbPredicatesV9;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:isNotNull(field: string): RdbPredicatesV9;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:like(field: string, value: string): RdbPredicatesV9;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:glob(field: string, value: string): RdbPredicatesV9;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:between(field: string, low: ValueType, high: ValueType): RdbPredicatesV9;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:notBetween(field: string, low: ValueType, high: ValueType): RdbPredicatesV9;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:greaterThan(field: string, value: ValueType): RdbPredicatesV9;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:lessThan(field: string, value: ValueType): RdbPredicatesV9;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:greaterThanOrEqualTo(field: string, value: ValueType): RdbPredicatesV9;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:lessThanOrEqualTo(field: string, value: ValueType): RdbPredicatesV9;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:orderByAsc(field: string): RdbPredicatesV9;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:orderByDesc(field: string): RdbPredicatesV9;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:distinct(): RdbPredicatesV9;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:limitAs(value: number): RdbPredicatesV9;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:offsetAs(rowOffset: number): RdbPredicatesV9;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:groupBy(fields: Array\<string>): RdbPredicatesV9;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:indexedBy(field: string): RdbPredicatesV9;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:in(field: string, value: Array\<ValueType>): RdbPredicatesV9;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: ohos.data.rdb<br>类名: RdbPredicatesV9<br>方法 or 属性:notIn(field: string, value: Array\<ValueType>): RdbPredicatesV9;|NA|@ohos.data.rdb.d.ts| +|删除|模块名: resultSet<br>类名: ResultSetV9|NA|resultSet.d.ts| +|删除|模块名: resultSet<br>类名: ResultSetV9<br>方法 or 属性:columnNames: Array\<string>;|NA|resultSet.d.ts| +|删除|模块名: resultSet<br>类名: ResultSetV9<br>方法 or 属性:columnCount: number;|NA|resultSet.d.ts| +|删除|模块名: resultSet<br>类名: ResultSetV9<br>方法 or 属性:rowCount: number;|NA|resultSet.d.ts| +|删除|模块名: resultSet<br>类名: ResultSetV9<br>方法 or 属性:rowIndex: number;|NA|resultSet.d.ts| +|删除|模块名: resultSet<br>类名: ResultSetV9<br>方法 or 属性:isAtFirstRow: boolean;|NA|resultSet.d.ts| +|删除|模块名: resultSet<br>类名: ResultSetV9<br>方法 or 属性:isAtLastRow: boolean;|NA|resultSet.d.ts| +|删除|模块名: resultSet<br>类名: ResultSetV9<br>方法 or 属性:isEnded: boolean;|NA|resultSet.d.ts| +|删除|模块名: resultSet<br>类名: ResultSetV9<br>方法 or 属性:isStarted: boolean;|NA|resultSet.d.ts| +|删除|模块名: resultSet<br>类名: ResultSetV9<br>方法 or 属性:isClosed: boolean;|NA|resultSet.d.ts| +|删除|模块名: resultSet<br>类名: ResultSetV9<br>方法 or 属性:getColumnIndex(columnName: string): number;|NA|resultSet.d.ts| +|删除|模块名: resultSet<br>类名: ResultSetV9<br>方法 or 属性:getColumnName(columnIndex: number): string;|NA|resultSet.d.ts| +|删除|模块名: resultSet<br>类名: ResultSetV9<br>方法 or 属性:goTo(offset: number): boolean;|NA|resultSet.d.ts| +|删除|模块名: resultSet<br>类名: ResultSetV9<br>方法 or 属性:goToRow(position: number): boolean;|NA|resultSet.d.ts| +|删除|模块名: resultSet<br>类名: ResultSetV9<br>方法 or 属性:goToFirstRow(): boolean;|NA|resultSet.d.ts| +|删除|模块名: resultSet<br>类名: ResultSetV9<br>方法 or 属性:goToLastRow(): boolean;|NA|resultSet.d.ts| +|删除|模块名: resultSet<br>类名: ResultSetV9<br>方法 or 属性:goToNextRow(): boolean;|NA|resultSet.d.ts| +|删除|模块名: resultSet<br>类名: ResultSetV9<br>方法 or 属性:goToPreviousRow(): boolean;|NA|resultSet.d.ts| +|删除|模块名: resultSet<br>类名: ResultSetV9<br>方法 or 属性:getBlob(columnIndex: number): Uint8Array;|NA|resultSet.d.ts| +|删除|模块名: resultSet<br>类名: ResultSetV9<br>方法 or 属性:getString(columnIndex: number): string;|NA|resultSet.d.ts| +|删除|模块名: resultSet<br>类名: ResultSetV9<br>方法 or 属性:getLong(columnIndex: number): number;|NA|resultSet.d.ts| +|删除|模块名: resultSet<br>类名: ResultSetV9<br>方法 or 属性:getDouble(columnIndex: number): number;|NA|resultSet.d.ts| +|删除|模块名: resultSet<br>类名: ResultSetV9<br>方法 or 属性:isColumnNull(columnIndex: number): boolean;|NA|resultSet.d.ts| +|删除|模块名: resultSet<br>类名: ResultSetV9<br>方法 or 属性:close(): void;|NA|resultSet.d.ts| +|废弃版本有变化|类名:rdb<br>废弃版本:N/A|类名:rdb<br>废弃版本:9<br>代替接口:ohos.data.relationalStore |@ohos.data.rdb.d.ts| +|新增(权限)|类名:SubscribeType<br>权限:N/A|类名:SubscribeType<br>权限:ohos.permission.DISTRIBUTED_DATASYNC|@ohos.data.rdb.d.ts| +|新增(权限)|类名:SubscribeType<br>权限:N/A|类名:SubscribeType<br>权限:ohos.permission.DISTRIBUTED_DATASYNC|@ohos.data.relationalStore.d.ts| +|函数有变化|类名:distributedDataObject<br>方法 or 属性:function create(context: Context, source: object): DistributedObjectV9;<br>|类名:distributedDataObject<br>方法 or 属性:function create(context: Context, source: object): DataObject;<br>|@ohos.data.distributedDataObject.d.ts| diff --git a/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-file-management.md b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-file-management.md new file mode 100644 index 0000000000000000000000000000000000000000..5a3dcf0f48f88d531c5953284fe283065b5c2e63 --- /dev/null +++ b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-file-management.md @@ -0,0 +1,225 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function listFile(path: string, options?: {<br> recursion?: boolean;<br> listNum?: number;<br> filter?: Filter;<br>}): Promise\<string[]>;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function listFile(path: string, callback: AsyncCallback\<string[]>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function listFile(path: string, options: {<br> recursion?: boolean;<br> listNum?: number;<br> filter?: Filter;<br>}, callback: AsyncCallback\<string[]>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function listFileSync(path: string, options?: {<br> recursion?: boolean;<br> listNum?: number;<br> filter?: Filter;<br>}): string[];|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function moveFile(src: string, dest: string, mode?: number): Promise\<void>;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function moveFile(src: string, dest: string, callback: AsyncCallback\<void>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function moveFile(src: string, dest: string, mode: number, callback: AsyncCallback\<void>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function moveFileSync(src: string, dest: string, mode?: number): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: File<br>方法 or 属性: lock(exclusive?: boolean): Promise\<void>;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: File<br>方法 or 属性: lock(callback: AsyncCallback\<void>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: File<br>方法 or 属性: lock(exclusive: boolean, callback: AsyncCallback\<void>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: File<br>方法 or 属性: tryLock(exclusive?: boolean): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: File<br>方法 or 属性: unlock(): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.hash<br>类名: hash|@ohos.file.hash.d.ts| +|新增|NA|类名:hash<br>方法or属性:|@ohos.file.hash.d.ts| +|新增|NA|模块名: ohos.file.hash<br>类名: hash<br>方法 or 属性:function hash(path: string, algorithm: string): Promise\<string>;|@ohos.file.hash.d.ts| +|新增|NA|类名:hash<br>方法or属性:function hash(path: string, algorithm: string): Promise\<string>;|@ohos.file.hash.d.ts| +|新增|NA|模块名: ohos.file.hash<br>类名: hash<br>方法 or 属性:function hash(path: string, algorithm: string, callback: AsyncCallback\<string>): void;|@ohos.file.hash.d.ts| +|新增|NA|类名:hash<br>方法or属性:function hash(path: string, algorithm: string, callback: AsyncCallback\<string>): void;|@ohos.file.hash.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: picker|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoViewMIMETypes|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoViewMIMETypes<br>方法 or 属性: IMAGE_TYPE = "image/*"|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoViewMIMETypes<br>方法 or 属性: VIDEO_TYPE = "video/*"|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoViewMIMETypes<br>方法 or 属性: IMAGE_VIDEO_TYPE = "*/*"|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoSelectOptions|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoSelectOptions<br>方法 or 属性: MIMEType?: PhotoViewMIMETypes;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoSelectOptions<br>方法 or 属性: maxSelectNumber?: number;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoSelectResult|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoSelectResult<br>方法 or 属性: photoUris: Array\<string>;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoSelectResult<br>方法 or 属性: isOriginalPhoto: boolean;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoSaveOptions|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoSaveOptions<br>方法 or 属性: newFileNames?: Array\<string>;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoViewPicker|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoViewPicker<br>方法 or 属性: select(option?: PhotoSelectOptions) : Promise\<PhotoSelectResult>;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoViewPicker<br>方法 or 属性: select(option: PhotoSelectOptions, callback: AsyncCallback\<PhotoSelectResult>) : void;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoViewPicker<br>方法 or 属性: select(callback: AsyncCallback\<PhotoSelectResult>) : void;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoViewPicker<br>方法 or 属性: save(option?: PhotoSaveOptions) : Promise\<Array\<string>>;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoViewPicker<br>方法 or 属性: save(option: PhotoSaveOptions, callback: AsyncCallback\<Array\<string>>) : void;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoViewPicker<br>方法 or 属性: save(callback: AsyncCallback\<Array\<string>>) : void;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: DocumentSelectOptions|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: DocumentSaveOptions|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: DocumentSaveOptions<br>方法 or 属性: newFileNames?: Array\<string>;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: DocumentViewPicker|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: DocumentViewPicker<br>方法 or 属性: select(option?: DocumentSelectOptions) : Promise\<Array\<string>>;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: DocumentViewPicker<br>方法 or 属性: select(option: DocumentSelectOptions, callback: AsyncCallback\<Array\<string>>) : void;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: DocumentViewPicker<br>方法 or 属性: select(callback: AsyncCallback\<Array\<string>>) : void;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: DocumentViewPicker<br>方法 or 属性: save(option?: DocumentSaveOptions) : Promise\<Array\<string>>;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: DocumentViewPicker<br>方法 or 属性: save(option: DocumentSaveOptions, callback: AsyncCallback\<Array\<string>>) : void;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: DocumentViewPicker<br>方法 or 属性: save(callback: AsyncCallback\<Array\<string>>) : void;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: AudioSelectOptions|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: AudioSaveOptions|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: AudioSaveOptions<br>方法 or 属性: newFileNames?: Array\<string>;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: AudioViewPicker|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: AudioViewPicker<br>方法 or 属性: select(option?: AudioSelectOptions) : Promise\<Array\<string>>;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: AudioViewPicker<br>方法 or 属性: select(option: AudioSelectOptions, callback: AsyncCallback\<Array\<string>>) : void;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: AudioViewPicker<br>方法 or 属性: select(callback: AsyncCallback\<Array\<string>>) : void;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: AudioViewPicker<br>方法 or 属性: save(option?: AudioSaveOptions) : Promise\<Array\<string>>;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: AudioViewPicker<br>方法 or 属性: save(option: AudioSaveOptions, callback: AsyncCallback\<Array\<string>>) : void;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: AudioViewPicker<br>方法 or 属性: save(callback: AsyncCallback\<Array\<string>>) : void;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.securityLabel<br>类名: DataLevel<br>方法 or 属性:type DataLevel = 's0'\|'s1'\|'s2'\|'s3'\|'s4';|@ohos.file.securityLabel.d.ts| +|新增|NA|类名:DataLevel<br>方法or属性:type DataLevel = 's0'\|'s1'\|'s2'\|'s3'\|'s4';|@ohos.file.securityLabel.d.ts| +|新增|NA|模块名: ohos.file.securityLabel<br>类名: DataLevel<br>方法 or 属性:type DataLevel = 's0'\|'s1'\|'s2'\|'s3'\|'s4';|@ohos.file.securityLabel.d.ts| +|新增|NA|类名:DataLevel<br>方法or属性:type DataLevel = 's0'\|'s1'\|'s2'\|'s3'\|'s4';|@ohos.file.securityLabel.d.ts| +|新增|NA|模块名: ohos.file.securityLabel<br>类名: DataLevel<br>方法 or 属性:type DataLevel = 's0'\|'s1'\|'s2'\|'s3'\|'s4';|@ohos.file.securityLabel.d.ts| +|新增|NA|类名:DataLevel<br>方法or属性:type DataLevel = 's0'\|'s1'\|'s2'\|'s3'\|'s4';|@ohos.file.securityLabel.d.ts| +|新增|NA|模块名: ohos.file.securityLabel<br>类名: DataLevel<br>方法 or 属性:type DataLevel = 's0'\|'s1'\|'s2'\|'s3'\|'s4';|@ohos.file.securityLabel.d.ts| +|新增|NA|类名:DataLevel<br>方法or属性:type DataLevel = 's0'\|'s1'\|'s2'\|'s3'\|'s4';|@ohos.file.securityLabel.d.ts| +|新增|NA|模块名: ohos.file.securityLabel<br>类名: DataLevel<br>方法 or 属性:type DataLevel = 's0'\|'s1'\|'s2'\|'s3'\|'s4';|@ohos.file.securityLabel.d.ts| +|新增|NA|类名:DataLevel<br>方法or属性:type DataLevel = 's0'\|'s1'\|'s2'\|'s3'\|'s4';|@ohos.file.securityLabel.d.ts| +|新增|NA|模块名: ohos.file.statvfs<br>类名: statfs|@ohos.file.statvfs.d.ts| +|新增|NA|类名:statfs<br>方法or属性:|@ohos.file.statvfs.d.ts| +|新增|NA|模块名: ohos.file.statvfs<br>类名: statfs<br>方法 or 属性:function getFreeSize(path: string): Promise\<number>;|@ohos.file.statvfs.d.ts| +|新增|NA|类名:statfs<br>方法or属性:function getFreeSize(path: string): Promise\<number>;|@ohos.file.statvfs.d.ts| +|新增|NA|模块名: ohos.file.statvfs<br>类名: statfs<br>方法 or 属性:function getFreeSize(path: string, callback: AsyncCallback\<number>): void;|@ohos.file.statvfs.d.ts| +|新增|NA|类名:statfs<br>方法or属性:function getFreeSize(path: string, callback: AsyncCallback\<number>): void;|@ohos.file.statvfs.d.ts| +|新增|NA|模块名: ohos.file.statvfs<br>类名: statfs<br>方法 or 属性:function getTotalSize(path: string): Promise\<number>;|@ohos.file.statvfs.d.ts| +|新增|NA|类名:statfs<br>方法or属性:function getTotalSize(path: string): Promise\<number>;|@ohos.file.statvfs.d.ts| +|新增|NA|模块名: ohos.file.statvfs<br>类名: statfs<br>方法 or 属性:function getTotalSize(path: string, callback: AsyncCallback\<number>): void;|@ohos.file.statvfs.d.ts| +|新增|NA|类名:statfs<br>方法or属性:function getTotalSize(path: string, callback: AsyncCallback\<number>): void;|@ohos.file.statvfs.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getTotalSizeOfVolume(volumeUuid: string, callback: AsyncCallback\<number>): void;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getTotalSizeOfVolume(volumeUuid: string): Promise\<number>;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getFreeSizeOfVolume(volumeUuid: string, callback: AsyncCallback\<number>): void;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getFreeSizeOfVolume(volumeUuid: string): Promise\<number>;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: BundleStats|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: BundleStats<br>方法 or 属性: appSize: number;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: BundleStats<br>方法 or 属性: cacheSize: number;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: BundleStats<br>方法 or 属性: dataSize: number;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getBundleStats(packageName: string, callback: AsyncCallback\<BundleStats>): void;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getBundleStats(packageName: string): Promise\<BundleStats>;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getCurrentBundleStats(callback: AsyncCallback\<BundleStats>): void;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getCurrentBundleStats(): Promise\<BundleStats>;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getSystemSize(callback: AsyncCallback\<number>): void;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getSystemSize(): Promise\<number>;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: StorageStats|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: StorageStats<br>方法 or 属性: total: number;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: StorageStats<br>方法 or 属性: audio: number;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: StorageStats<br>方法 or 属性: video: number;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: StorageStats<br>方法 or 属性: image: number;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: StorageStats<br>方法 or 属性: file: number;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: StorageStats<br>方法 or 属性: app: number;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getUserStorageStats(): Promise\<StorageStats>;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getUserStorageStats(callback: AsyncCallback\<StorageStats>): void;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getUserStorageStats(userId: number): Promise\<StorageStats>;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getUserStorageStats(userId: number, callback: AsyncCallback\<StorageStats>): void;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getTotalSize(callback: AsyncCallback\<number>): void;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getTotalSize(): Promise\<number>;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getFreeSize(callback: AsyncCallback\<number>): void;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getFreeSize(): Promise\<number>;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: Volume|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: Volume<br>方法 or 属性: id: string;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: Volume<br>方法 or 属性: uuid: string;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: Volume<br>方法 or 属性: diskId: string;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: Volume<br>方法 or 属性: description: string;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: Volume<br>方法 or 属性: removable: boolean;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: Volume<br>方法 or 属性: state: number;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: Volume<br>方法 or 属性: path: string;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function getAllVolumes(callback: AsyncCallback\<Array\<Volume>>): void;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function getAllVolumes(): Promise\<Array\<Volume>>;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function mount(volumeId: string, callback: AsyncCallback\<void>): void;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function mount(volumeId: string): Promise\<void>;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function unmount(volumeId: string, callback: AsyncCallback\<void>): void;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function unmount(volumeId: string): Promise\<void>;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function getVolumeByUuid(uuid: string, callback: AsyncCallback\<Volume>): void;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function getVolumeByUuid(uuid: string): Promise\<Volume>;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function getVolumeById(volumeId: string, callback: AsyncCallback\<Volume>): void;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function getVolumeById(volumeId: string): Promise\<Volume>;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function setVolumeDescription(uuid: string, description: string, callback: AsyncCallback\<void>): void;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function setVolumeDescription(uuid: string, description: string): Promise\<void>;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function format(volumeId: string, fsType: string, callback: AsyncCallback\<void>): void;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function format(volumeId: string, fsType: string): Promise\<void>;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function partition(diskId: string, type: number, callback: AsyncCallback\<void>): void;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function partition(diskId: string, type: number): Promise\<void>;|@ohos.file.volumeManager.d.ts| +|删除|模块名: ohos.file.hash<br>类名: Hash|NA|@ohos.file.hash.d.ts| +|删除|模块名: ohos.file.hash<br>类名: Hash<br>方法 or 属性:function hash(path: string, algorithm: string): Promise\<string>;|NA|@ohos.file.hash.d.ts| +|删除|模块名: ohos.file.hash<br>类名: Hash<br>方法 or 属性:function hash(path: string, algorithm: string, callback: AsyncCallback\<string>): void;|NA|@ohos.file.hash.d.ts| +|删除|模块名: ohos.file.securityLabel<br>类名: dataLevel<br>方法 or 属性:type dataLevel = 's0'\|'s1'\|'s2'\|'s3'\|'s4';|NA|@ohos.file.securityLabel.d.ts| +|删除|模块名: ohos.file.securityLabel<br>类名: dataLevel<br>方法 or 属性:type dataLevel = 's0'\|'s1'\|'s2'\|'s3'\|'s4';|NA|@ohos.file.securityLabel.d.ts| +|删除|模块名: ohos.file.securityLabel<br>类名: dataLevel<br>方法 or 属性:type dataLevel = 's0'\|'s1'\|'s2'\|'s3'\|'s4';|NA|@ohos.file.securityLabel.d.ts| +|删除|模块名: ohos.file.securityLabel<br>类名: dataLevel<br>方法 or 属性:type dataLevel = 's0'\|'s1'\|'s2'\|'s3'\|'s4';|NA|@ohos.file.securityLabel.d.ts| +|删除|模块名: ohos.file.securityLabel<br>类名: dataLevel<br>方法 or 属性:type dataLevel = 's0'\|'s1'\|'s2'\|'s3'\|'s4';|NA|@ohos.file.securityLabel.d.ts| +|删除|模块名: ohos.file.statvfs<br>类名: Statfs|NA|@ohos.file.statvfs.d.ts| +|删除|模块名: ohos.file.statvfs<br>类名: Statfs<br>方法 or 属性:function getFreeSize(path: string): Promise\<number>;|NA|@ohos.file.statvfs.d.ts| +|删除|模块名: ohos.file.statvfs<br>类名: Statfs<br>方法 or 属性:function getFreeSize(path: string, callback: AsyncCallback\<number>): void;|NA|@ohos.file.statvfs.d.ts| +|删除|模块名: ohos.file.statvfs<br>类名: Statfs<br>方法 or 属性:function getTotalSize(path: string): Promise\<number>;|NA|@ohos.file.statvfs.d.ts| +|删除|模块名: ohos.file.statvfs<br>类名: Statfs<br>方法 or 属性:function getTotalSize(path: string, callback: AsyncCallback\<number>): void;|NA|@ohos.file.statvfs.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: storageStatistics|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: storageStatistics<br>方法 or 属性:function getTotalSizeOfVolume(volumeUuid: string, callback: AsyncCallback\<number>): void;|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: storageStatistics<br>方法 or 属性:function getTotalSizeOfVolume(volumeUuid: string): Promise\<number>;|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: storageStatistics<br>方法 or 属性:function getFreeSizeOfVolume(volumeUuid: string, callback: AsyncCallback\<number>): void;|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: storageStatistics<br>方法 or 属性:function getFreeSizeOfVolume(volumeUuid: string): Promise\<number>;|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: BundleStats|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: BundleStats<br>方法 or 属性:appSize: number;|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: BundleStats<br>方法 or 属性:cacheSize: number;|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: BundleStats<br>方法 or 属性:dataSize: number;|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: storageStatistics<br>方法 or 属性:function getBundleStats(packageName: string, callback: AsyncCallback\<BundleStats>): void;|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: storageStatistics<br>方法 or 属性:function getBundleStats(packageName: string): Promise\<BundleStats>;|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: storageStatistics<br>方法 or 属性:function getCurrentBundleStats(callback: AsyncCallback\<BundleStats>): void;|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: storageStatistics<br>方法 or 属性:function getCurrentBundleStats(): Promise\<BundleStats>;|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: storageStatistics<br>方法 or 属性:function getSystemSize(callback: AsyncCallback\<number>): void;|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: storageStatistics<br>方法 or 属性:function getSystemSize(): Promise\<number>;|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: StorageStats|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: StorageStats<br>方法 or 属性:total: number;|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: StorageStats<br>方法 or 属性:audio: number;|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: StorageStats<br>方法 or 属性:video: number;|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: StorageStats<br>方法 or 属性:image: number;|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: StorageStats<br>方法 or 属性:file: number;|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: StorageStats<br>方法 or 属性:app: number;|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: storageStatistics<br>方法 or 属性:function getUserStorageStats(userId?: number): Promise\<StorageStats>;|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: storageStatistics<br>方法 or 属性:function getUserStorageStats(callback: AsyncCallback\<StorageStats>): void;|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: storageStatistics<br>方法 or 属性:function getUserStorageStats(userId: number, callback: AsyncCallback\<StorageStats>): void;|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: storageStatistics<br>方法 or 属性:function getTotalSize(callback: AsyncCallback\<number>): void;|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: storageStatistics<br>方法 or 属性:function getTotalSize(): Promise\<number>;|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: storageStatistics<br>方法 or 属性:function getFreeSize(callback: AsyncCallback\<number>): void;|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: storageStatistics<br>方法 or 属性:function getFreeSize(): Promise\<number>;|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.volumeManager<br>类名: volumeManager|NA|@ohos.volumeManager.d.ts| +|删除|模块名: ohos.volumeManager<br>类名: Volume|NA|@ohos.volumeManager.d.ts| +|删除|模块名: ohos.volumeManager<br>类名: Volume<br>方法 or 属性:id: string;|NA|@ohos.volumeManager.d.ts| +|删除|模块名: ohos.volumeManager<br>类名: Volume<br>方法 or 属性:uuid: string;|NA|@ohos.volumeManager.d.ts| +|删除|模块名: ohos.volumeManager<br>类名: Volume<br>方法 or 属性:diskId: string;|NA|@ohos.volumeManager.d.ts| +|删除|模块名: ohos.volumeManager<br>类名: Volume<br>方法 or 属性:description: string;|NA|@ohos.volumeManager.d.ts| +|删除|模块名: ohos.volumeManager<br>类名: Volume<br>方法 or 属性:removable: boolean;|NA|@ohos.volumeManager.d.ts| +|删除|模块名: ohos.volumeManager<br>类名: Volume<br>方法 or 属性:state: number;|NA|@ohos.volumeManager.d.ts| +|删除|模块名: ohos.volumeManager<br>类名: Volume<br>方法 or 属性:path: string;|NA|@ohos.volumeManager.d.ts| +|删除|模块名: ohos.volumeManager<br>类名: volumeManager<br>方法 or 属性:function getAllVolumes(callback: AsyncCallback\<Array\<Volume>>): void;|NA|@ohos.volumeManager.d.ts| +|删除|模块名: ohos.volumeManager<br>类名: volumeManager<br>方法 or 属性:function getAllVolumes(): Promise\<Array\<Volume>>;|NA|@ohos.volumeManager.d.ts| +|删除|模块名: ohos.volumeManager<br>类名: volumeManager<br>方法 or 属性:function mount(volumeId: string, callback: AsyncCallback\<boolean>): void;|NA|@ohos.volumeManager.d.ts| +|删除|模块名: ohos.volumeManager<br>类名: volumeManager<br>方法 or 属性:function mount(volumeId: string): Promise\<boolean>;|NA|@ohos.volumeManager.d.ts| +|删除|模块名: ohos.volumeManager<br>类名: volumeManager<br>方法 or 属性:function unmount(volumeId: string, callback: AsyncCallback\<boolean>): void;|NA|@ohos.volumeManager.d.ts| +|删除|模块名: ohos.volumeManager<br>类名: volumeManager<br>方法 or 属性:function unmount(volumeId: string): Promise\<boolean>;|NA|@ohos.volumeManager.d.ts| +|删除|模块名: ohos.volumeManager<br>类名: volumeManager<br>方法 or 属性:function getVolumeByUuid(uuid: string, callback: AsyncCallback\<Volume>): void;|NA|@ohos.volumeManager.d.ts| +|删除|模块名: ohos.volumeManager<br>类名: volumeManager<br>方法 or 属性:function getVolumeByUuid(uuid: string): Promise\<Volume>;|NA|@ohos.volumeManager.d.ts| +|删除|模块名: ohos.volumeManager<br>类名: volumeManager<br>方法 or 属性:function getVolumeById(volumeId: string, callback: AsyncCallback\<Volume>): void;|NA|@ohos.volumeManager.d.ts| +|删除|模块名: ohos.volumeManager<br>类名: volumeManager<br>方法 or 属性:function getVolumeById(volumeId: string): Promise\<Volume>;|NA|@ohos.volumeManager.d.ts| +|删除|模块名: ohos.volumeManager<br>类名: volumeManager<br>方法 or 属性:function setVolumeDescription(uuid: string, description: string, callback: AsyncCallback\<void>): void;|NA|@ohos.volumeManager.d.ts| +|删除|模块名: ohos.volumeManager<br>类名: volumeManager<br>方法 or 属性:function setVolumeDescription(uuid: string, description: string): Promise\<void>;|NA|@ohos.volumeManager.d.ts| +|删除|模块名: ohos.volumeManager<br>类名: volumeManager<br>方法 or 属性:function format(volumeId: string, fsType: string, callback: AsyncCallback\<void>): void;|NA|@ohos.volumeManager.d.ts| +|删除|模块名: ohos.volumeManager<br>类名: volumeManager<br>方法 or 属性:function format(volumeId: string, fsType: string): Promise\<void>;|NA|@ohos.volumeManager.d.ts| +|删除|模块名: ohos.volumeManager<br>类名: volumeManager<br>方法 or 属性:function partition(diskId: string, type: number, callback: AsyncCallback\<void>): void;|NA|@ohos.volumeManager.d.ts| +|删除|模块名: ohos.volumeManager<br>类名: volumeManager<br>方法 or 属性:function partition(diskId: string, type: number): Promise\<void>;|NA|@ohos.volumeManager.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function opendir(path: string): Promise\<Dir>;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function opendir(path: string): Promise\<Dir>;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function opendir(path: string, callback: AsyncCallback\<Dir>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function opendir(path: string, callback: AsyncCallback\<Dir>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function opendirSync(path: string): Dir;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function opendirSync(path: string): Dir;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Dir<br>方法 or 属性:read(): Promise\<Dirent>;<br>废弃版本:N/A|类名:Dir<br>方法 or 属性:read(): Promise\<Dirent>;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Dir<br>方法 or 属性:read(callback: AsyncCallback\<Dirent>): void;<br>废弃版本:N/A|类名:Dir<br>方法 or 属性:read(callback: AsyncCallback\<Dirent>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Dir<br>方法 or 属性:readSync(): Dirent;<br>废弃版本:N/A|类名:Dir<br>方法 or 属性:readSync(): Dirent;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Dir<br>方法 or 属性:close(): Promise\<void>;<br>废弃版本:N/A|类名:Dir<br>方法 or 属性:close(): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Dir<br>方法 or 属性:close(callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:Dir<br>方法 or 属性:close(callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Dir<br>方法 or 属性:closeSync(): void;<br>废弃版本:N/A|类名:Dir<br>方法 or 属性:closeSync(): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Dirent<br>废弃版本:N/A|类名:Dirent<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Dirent<br>方法 or 属性:readonly name: string;<br>废弃版本:N/A|类名:Dirent<br>方法 or 属性:readonly name: string;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Dirent<br>方法 or 属性:isBlockDevice(): boolean;<br>废弃版本:N/A|类名:Dirent<br>方法 or 属性:isBlockDevice(): boolean;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Dirent<br>方法 or 属性:isCharacterDevice(): boolean;<br>废弃版本:N/A|类名:Dirent<br>方法 or 属性:isCharacterDevice(): boolean;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Dirent<br>方法 or 属性:isDirectory(): boolean;<br>废弃版本:N/A|类名:Dirent<br>方法 or 属性:isDirectory(): boolean;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Dirent<br>方法 or 属性:isFIFO(): boolean;<br>废弃版本:N/A|类名:Dirent<br>方法 or 属性:isFIFO(): boolean;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Dirent<br>方法 or 属性:isFile(): boolean;<br>废弃版本:N/A|类名:Dirent<br>方法 or 属性:isFile(): boolean;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Dirent<br>方法 or 属性:isSocket(): boolean;<br>废弃版本:N/A|类名:Dirent<br>方法 or 属性:isSocket(): boolean;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Dirent<br>方法 or 属性:isSymbolicLink(): boolean;<br>废弃版本:N/A|类名:Dirent<br>方法 or 属性:isSymbolicLink(): boolean;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|起始版本有变化|类名:fileIO<br>方法 or 属性:function opendirSync(path: string): Dir;<br>起始版本:N/A|类名:fileIO<br>方法 or 属性:function opendirSync(path: string): Dir;<br>起始版本:6|@ohos.fileio.d.ts| +|函数有变化|类名:securityLabel<br>方法 or 属性:function setSecurityLabel(path: string, type: dataLevel): Promise\<void>;<br>|类名:securityLabel<br>方法 or 属性:function setSecurityLabel(path: string, type: DataLevel): Promise\<void>;<br>|@ohos.file.securityLabel.d.ts| +|函数有变化|类名:securityLabel<br>方法 or 属性:function setSecurityLabel(path: string, type: dataLevel, callback: AsyncCallback\<void>): void;<br>|类名:securityLabel<br>方法 or 属性:function setSecurityLabel(path: string, type: DataLevel, callback: AsyncCallback\<void>): void;<br>|@ohos.file.securityLabel.d.ts| +|函数有变化|类名:securityLabel<br>方法 or 属性:function setSecurityLabelSync(path: string, type: dataLevel): void;<br>|类名:securityLabel<br>方法 or 属性:function setSecurityLabelSync(path: string, type: DataLevel): void;<br>|@ohos.file.securityLabel.d.ts| diff --git a/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-misc.md b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-misc.md new file mode 100644 index 0000000000000000000000000000000000000000..f800f29ef555e468856cb6dcae704821a78de79e --- /dev/null +++ b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-misc.md @@ -0,0 +1,73 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|类名:ShareOption<br>方法or属性:INAPP|@ohos.pasteboard.d.ts| +|新增|NA|类名:ShareOption<br>方法or属性:LOCALDEVICE|@ohos.pasteboard.d.ts| +|新增|NA|类名:ShareOption<br>方法or属性:CROSSDEVICE|@ohos.pasteboard.d.ts| +|新增|NA|类名:PasteDataRecord<br>方法or属性:toPlainText(): string;|@ohos.pasteboard.d.ts| +|删除|模块名:ohos.pasteboard<br>类名:ShareOption<br>方法 or 属性:InApp|NA|@ohos.pasteboard.d.ts| +|删除|模块名:ohos.pasteboard<br>类名:ShareOption<br>方法 or 属性:LocalDevice|NA|@ohos.pasteboard.d.ts| +|删除|模块名:ohos.pasteboard<br>类名:ShareOption<br>方法 or 属性:CrossDevice|NA|@ohos.pasteboard.d.ts| +|删除|模块名:ohos.pasteboard<br>类名:PasteDataRecord<br>方法 or 属性:convertToTextV9(callback: AsyncCallback\<string>): void;|NA|@ohos.pasteboard.d.ts| +|删除|模块名:ohos.pasteboard<br>类名:PasteDataRecord<br>方法 or 属性:convertToTextV9(): Promise\<string>;|NA|@ohos.pasteboard.d.ts| +|删除|模块名:ohos.request<br>类名:request<br>方法 or 属性:function download(context: BaseContext, config: DownloadConfig, callback: AsyncCallback\<DownloadTask>): void;|NA|@ohos.request.d.ts| +|删除|模块名:ohos.request<br>类名:request<br>方法 or 属性:function download(context: BaseContext, config: DownloadConfig): Promise\<DownloadTask>;|NA|@ohos.request.d.ts| +|删除|模块名:ohos.request<br>类名:request<br>方法 or 属性:function upload(context: BaseContext, config: UploadConfig, callback: AsyncCallback\<UploadTask>): void;|NA|@ohos.request.d.ts| +|删除|模块名:ohos.request<br>类名:request<br>方法 or 属性:function upload(context: BaseContext, config: UploadConfig): Promise\<UploadTask>;|NA|@ohos.request.d.ts| +|删除|模块名:ohos.screenLock<br>类名:screenLock<br>方法 or 属性:function isSecure(): boolean;|NA|@ohos.screenLock.d.ts| +|删除|模块名:ohos.wallpaper<br>类名:wallpaper<br>方法 or 属性:function getIdSync(wallpaperType: WallpaperType): number;|NA|@ohos.wallpaper.d.ts| +|删除|模块名:ohos.wallpaper<br>类名:wallpaper<br>方法 or 属性:function getFileSync(wallpaperType: WallpaperType): number;|NA|@ohos.wallpaper.d.ts| +|删除|模块名:ohos.wallpaper<br>类名:wallpaper<br>方法 or 属性:function isChangeAllowed(): boolean;|NA|@ohos.wallpaper.d.ts| +|删除|模块名:ohos.wallpaper<br>类名:wallpaper<br>方法 or 属性:function isUserChangeAllowed(): boolean;|NA|@ohos.wallpaper.d.ts| +|model有变化|类名:InputMethodExtensionAbility<br>model:N/A|类名:InputMethodExtensionAbility<br>model:@StageModelOnly|@ohos.InputMethodExtensionAbility.d.ts| +|model有变化|类名:InputMethodExtensionAbility<br>方法 or 属性:context: InputMethodExtensionContext;<br>model:N/A|类名:InputMethodExtensionAbility<br>方法 or 属性:context: InputMethodExtensionContext;<br>model:@StageModelOnly|@ohos.InputMethodExtensionAbility.d.ts| +|model有变化|类名:InputMethodExtensionAbility<br>方法 or 属性:onCreate(want: Want): void;<br>model:N/A|类名:InputMethodExtensionAbility<br>方法 or 属性:onCreate(want: Want): void;<br>model:@StageModelOnly|@ohos.InputMethodExtensionAbility.d.ts| +|model有变化|类名:InputMethodExtensionAbility<br>方法 or 属性:onDestroy(): void;<br>model:N/A|类名:InputMethodExtensionAbility<br>方法 or 属性:onDestroy(): void;<br>model:@StageModelOnly|@ohos.InputMethodExtensionAbility.d.ts| +|model有变化|类名:InputMethodExtensionContext<br>model:N/A|类名:InputMethodExtensionContext<br>model:@StageModelOnly|@ohos.InputMethodExtensionContext.d.ts| +|model有变化|类名:InputMethodExtensionContext<br>方法 or 属性:destroy(callback: AsyncCallback\<void>): void;<br>model:N/A|类名:InputMethodExtensionContext<br>方法 or 属性:destroy(callback: AsyncCallback\<void>): void;<br>model:@StageModelOnly|@ohos.InputMethodExtensionContext.d.ts| +|model有变化|类名:InputMethodExtensionContext<br>方法 or 属性:destroy(): Promise\<void>;<br>model:N/A|类名:InputMethodExtensionContext<br>方法 or 属性:destroy(): Promise\<void>;<br>model:@StageModelOnly|@ohos.InputMethodExtensionContext.d.ts| +|访问级别有变化|类名:screenLock<br>方法 or 属性:function isLocked(): boolean;<br>访问级别:公开API|类名:screenLock<br>方法 or 属性:function isLocked(): boolean;<br>访问级别:系统API|@ohos.screenLock.d.ts| +|访问级别有变化|类名:screenLock<br>方法 or 属性:function unlock(callback: AsyncCallback\<boolean>): void;<br>访问级别:公开API|类名:screenLock<br>方法 or 属性:function unlock(callback: AsyncCallback\<boolean>): void;<br>访问级别:系统API|@ohos.screenLock.d.ts| +|访问级别有变化|类名:screenLock<br>方法 or 属性:function unlock():Promise\<boolean>;<br>访问级别:公开API|类名:screenLock<br>方法 or 属性:function unlock():Promise\<boolean>;<br>访问级别:系统API|@ohos.screenLock.d.ts| +|访问级别有变化|类名:wallpaper<br>方法 or 属性:function getColorsSync(wallpaperType: WallpaperType): Array\<RgbaColor>;<br>访问级别:公开API|类名:wallpaper<br>方法 or 属性:function getColorsSync(wallpaperType: WallpaperType): Array\<RgbaColor>;<br>访问级别:系统API|@ohos.wallpaper.d.ts| +|访问级别有变化|类名:wallpaper<br>方法 or 属性:function getMinHeightSync(): number;<br>访问级别:公开API|类名:wallpaper<br>方法 or 属性:function getMinHeightSync(): number;<br>访问级别:系统API|@ohos.wallpaper.d.ts| +|访问级别有变化|类名:wallpaper<br>方法 or 属性:function getMinWidthSync(): number;<br>访问级别:公开API|类名:wallpaper<br>方法 or 属性:function getMinWidthSync(): number;<br>访问级别:系统API|@ohos.wallpaper.d.ts| +|访问级别有变化|类名:wallpaper<br>方法 or 属性:function restore(wallpaperType: WallpaperType, callback: AsyncCallback\<void>): void;<br>访问级别:公开API|类名:wallpaper<br>方法 or 属性:function restore(wallpaperType: WallpaperType, callback: AsyncCallback\<void>): void;<br>访问级别:系统API|@ohos.wallpaper.d.ts| +|访问级别有变化|类名:wallpaper<br>方法 or 属性:function restore(wallpaperType: WallpaperType): Promise\<void>;<br>访问级别:公开API|类名:wallpaper<br>方法 or 属性:function restore(wallpaperType: WallpaperType): Promise\<void>;<br>访问级别:系统API|@ohos.wallpaper.d.ts| +|访问级别有变化|类名:wallpaper<br>方法 or 属性:function setImage(source: string \| image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback\<void>): void;<br>访问级别:公开API|类名:wallpaper<br>方法 or 属性:function setImage(source: string \| image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback\<void>): void;<br>访问级别:系统API|@ohos.wallpaper.d.ts| +|访问级别有变化|类名:wallpaper<br>方法 or 属性:function setImage(source: string \| image.PixelMap, wallpaperType: WallpaperType): Promise\<void>;<br>访问级别:公开API|类名:wallpaper<br>方法 or 属性:function setImage(source: string \| image.PixelMap, wallpaperType: WallpaperType): Promise\<void>;<br>访问级别:系统API|@ohos.wallpaper.d.ts| +|废弃版本有变化|类名:RgbaColor<br>废弃版本:N/A|类名:RgbaColor<br>废弃版本:9<br>代替接口:N/A|@ohos.wallpaper.d.ts| +|废弃版本有变化|类名:wallpaper<br>方法 or 属性:function on(type: 'colorChange', callback: (colors: Array\<RgbaColor>, wallpaperType: WallpaperType) => void): void;<br>废弃版本:N/A|类名:wallpaper<br>方法 or 属性:function on(type: 'colorChange', callback: (colors: Array\<RgbaColor>, wallpaperType: WallpaperType) => void): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.wallpaper.d.ts| +|废弃版本有变化|类名:wallpaper<br>方法 or 属性:function off(type: 'colorChange', callback?: (colors: Array\<RgbaColor>, wallpaperType: WallpaperType) => void): void;<br>废弃版本:N/A|类名:wallpaper<br>方法 or 属性:function off(type: 'colorChange', callback?: (colors: Array\<RgbaColor>, wallpaperType: WallpaperType) => void): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:RgbaColor<br>起始版本:N/A|类名:RgbaColor<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:WallpaperType<br>起始版本:N/A|类名:WallpaperType<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function getColors(wallpaperType: WallpaperType, callback: AsyncCallback\<Array\<RgbaColor>>): void;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function getColors(wallpaperType: WallpaperType, callback: AsyncCallback\<Array\<RgbaColor>>): void;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function getColors(wallpaperType: WallpaperType): Promise\<Array\<RgbaColor>>;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function getColors(wallpaperType: WallpaperType): Promise\<Array\<RgbaColor>>;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function getId(wallpaperType: WallpaperType, callback: AsyncCallback\<number>): void;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function getId(wallpaperType: WallpaperType, callback: AsyncCallback\<number>): void;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function getId(wallpaperType: WallpaperType): Promise\<number>;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function getId(wallpaperType: WallpaperType): Promise\<number>;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function getMinHeight(callback: AsyncCallback\<number>): void;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function getMinHeight(callback: AsyncCallback\<number>): void;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function getMinHeight(): Promise\<number>;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function getMinHeight(): Promise\<number>;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function getMinWidth(callback: AsyncCallback\<number>): void;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function getMinWidth(callback: AsyncCallback\<number>): void;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function getMinWidth(): Promise\<number>;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function getMinWidth(): Promise\<number>;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function isChangePermitted(callback: AsyncCallback\<boolean>): void;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function isChangePermitted(callback: AsyncCallback\<boolean>): void;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function isChangePermitted(): Promise\<boolean>;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function isChangePermitted(): Promise\<boolean>;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function isOperationAllowed(callback: AsyncCallback\<boolean>): void;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function isOperationAllowed(callback: AsyncCallback\<boolean>): void;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function isOperationAllowed(): Promise\<boolean>;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function isOperationAllowed(): Promise\<boolean>;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function reset(wallpaperType: WallpaperType, callback: AsyncCallback\<void>): void;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function reset(wallpaperType: WallpaperType, callback: AsyncCallback\<void>): void;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function reset(wallpaperType: WallpaperType): Promise\<void>;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function reset(wallpaperType: WallpaperType): Promise\<void>;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function setWallpaper(source: string \| image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback\<void>): void;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function setWallpaper(source: string \| image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback\<void>): void;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function setWallpaper(source: string \| image.PixelMap, wallpaperType: WallpaperType): Promise\<void>;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function setWallpaper(source: string \| image.PixelMap, wallpaperType: WallpaperType): Promise\<void>;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function getPixelMap(wallpaperType: WallpaperType, callback: AsyncCallback\<image.PixelMap>): void;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function getPixelMap(wallpaperType: WallpaperType, callback: AsyncCallback\<image.PixelMap>): void;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function getPixelMap(wallpaperType: WallpaperType): Promise\<image.PixelMap>;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function getPixelMap(wallpaperType: WallpaperType): Promise\<image.PixelMap>;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function on(type: 'colorChange', callback: (colors: Array\<RgbaColor>, wallpaperType: WallpaperType) => void): void;<br>起始版本:9|类名:wallpaper<br>方法 or 属性:function on(type: 'colorChange', callback: (colors: Array\<RgbaColor>, wallpaperType: WallpaperType) => void): void;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function off(type: 'colorChange', callback?: (colors: Array\<RgbaColor>, wallpaperType: WallpaperType) => void): void;<br>起始版本:9|类名:wallpaper<br>方法 or 属性:function off(type: 'colorChange', callback?: (colors: Array\<RgbaColor>, wallpaperType: WallpaperType) => void): void;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:Request<br>方法 or 属性:static upload(options: UploadRequestOptions): void;<br>起始版本:N/A|类名:Request<br>方法 or 属性:static upload(options: UploadRequestOptions): void;<br>起始版本:3|@system.request.d.ts| +|起始版本有变化|类名:Request<br>方法 or 属性:static download(options: DownloadRequestOptions): void;<br>起始版本:N/A|类名:Request<br>方法 or 属性:static download(options: DownloadRequestOptions): void;<br>起始版本:3|@system.request.d.ts| +|起始版本有变化|类名:Request<br>方法 or 属性:static onDownloadComplete(options: OnDownloadCompleteOptions): void;<br>起始版本:N/A|类名:Request<br>方法 or 属性:static onDownloadComplete(options: OnDownloadCompleteOptions): void;<br>起始版本:3|@system.request.d.ts| +|删除(权限)|类名:InputMethodSetting<br>方法 or 属性:showOptionalInputMethods(callback: AsyncCallback\<boolean>): void;<br>权限:ohos.permission.CONNECT_IME_ABILITY|类名:InputMethodSetting<br>方法 or 属性:showOptionalInputMethods(callback: AsyncCallback\<boolean>): void;<br>权限:N/A|@ohos.inputMethod.d.ts| +|删除(权限)|类名:InputMethodSetting<br>方法 or 属性:showOptionalInputMethods(): Promise\<boolean>;<br>权限:ohos.permission.CONNECT_IME_ABILITY|类名:InputMethodSetting<br>方法 or 属性:showOptionalInputMethods(): Promise\<boolean>;<br>权限:N/A|@ohos.inputMethod.d.ts| +|新增(错误码)|NA|类名:screenLock<br>方法 or 属性:function isLocked(): boolean;<br>错误码内容: 202|@ohos.screenLock.d.ts| +|新增(错误码)|NA|类名:wallpaper<br>方法 or 属性:function getMinHeightSync(): number;<br>错误码内容: 202|@ohos.wallpaper.d.ts| +|新增(错误码)|NA|类名:wallpaper<br>方法 or 属性:function getMinWidthSync(): number;<br>错误码内容: 202|@ohos.wallpaper.d.ts| +|新增(权限)|类名:request<br>方法 or 属性:function uploadFile(context: BaseContext, config: UploadConfig, callback: AsyncCallback\<UploadTask>): void;<br>权限:N/A|类名:request<br>方法 or 属性:function uploadFile(context: BaseContext, config: UploadConfig, callback: AsyncCallback\<UploadTask>): void;<br>权限:ohos.permission.INTERNET|@ohos.request.d.ts| +|SysCap有变化|类名:wallpaper<br>方法 or 属性:function on(type: 'colorChange', callback: (colors: Array\<RgbaColor>, wallpaperType: WallpaperType) => void): void;<br>SysCap:N/A|类名:wallpaper<br>方法 or 属性:function on(type: 'colorChange', callback: (colors: Array\<RgbaColor>, wallpaperType: WallpaperType) => void): void;<br>SysCap:SystemCapability.MiscServices.Wallpaper|@ohos.wallpaper.d.ts| +|SysCap有变化|类名:wallpaper<br>方法 or 属性:function off(type: 'colorChange', callback?: (colors: Array\<RgbaColor>, wallpaperType: WallpaperType) => void): void;<br>SysCap:N/A|类名:wallpaper<br>方法 or 属性:function off(type: 'colorChange', callback?: (colors: Array\<RgbaColor>, wallpaperType: WallpaperType) => void): void;<br>SysCap:SystemCapability.MiscServices.Wallpaper|@ohos.wallpaper.d.ts| diff --git a/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-multimedia.md b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-multimedia.md new file mode 100644 index 0000000000000000000000000000000000000000..03c224360c9de1a457596b69569adcaa8ee8c689 --- /dev/null +++ b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-multimedia.md @@ -0,0 +1,245 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|访问级别有变化|类名:VolumeEvent<br>访问级别:系统API|类名:VolumeEvent<br>访问级别:公开API|@ohos.multimedia.audio.d.ts| +|访问级别有变化|类名:VolumeEvent<br>方法 or 属性:volumeGroupId: number;<br>访问级别:公开API|类名:VolumeEvent<br>方法 or 属性:volumeGroupId: number;<br>访问级别:系统API|@ohos.multimedia.audio.d.ts| +|访问级别有变化|类名:VolumeEvent<br>方法 or 属性:networkId: string;<br>访问级别:公开API|类名:VolumeEvent<br>方法 or 属性:networkId: string;<br>访问级别:系统API|@ohos.multimedia.audio.d.ts| +|访问级别有变化|类名:avSession<br>方法 or 属性:function off(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;<br>访问级别:公开API|类名:avSession<br>方法 or 属性:function off(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;<br>访问级别:系统API|@ohos.multimedia.avsession.d.ts| +|访问级别有变化|类名:avSession<br>方法 or 属性:function off(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;<br>访问级别:公开API|类名:avSession<br>方法 or 属性:function off(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;<br>访问级别:系统API|@ohos.multimedia.avsession.d.ts| +|访问级别有变化|类名:avSession<br>方法 or 属性:function off(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;<br>访问级别:公开API|类名:avSession<br>方法 or 属性:function off(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;<br>访问级别:系统API|@ohos.multimedia.avsession.d.ts| +|访问级别有变化|类名:avSession<br>方法 or 属性:function off(type: 'sessionServiceDie', callback?: () => void): void;<br>访问级别:公开API|类名:avSession<br>方法 or 属性:function off(type: 'sessionServiceDie', callback?: () => void): void;<br>访问级别:系统API|@ohos.multimedia.avsession.d.ts| +|访问级别有变化|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>访问级别:公开API|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>访问级别:系统API|@ohos.multimedia.avsession.d.ts| +|访问级别有变化|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>访问级别:公开API|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>访问级别:系统API|@ohos.multimedia.avsession.d.ts| +|访问级别有变化|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>访问级别:公开API|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>访问级别:系统API|@ohos.multimedia.avsession.d.ts| +|访问级别有变化|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>访问级别:公开API|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>访问级别:系统API|@ohos.multimedia.avsession.d.ts| +|访问级别有变化|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>访问级别:公开API|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>访问级别:系统API|@ohos.multimedia.avsession.d.ts| +|访问级别有变化|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>访问级别:公开API|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>访问级别:系统API|@ohos.multimedia.avsession.d.ts| +|访问级别有变化|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>访问级别:公开API|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>访问级别:系统API|@ohos.multimedia.avsession.d.ts| +|访问级别有变化|类名:AVSession<br>方法 or 属性:off(type: 'seek', callback?: (time: number) => void): void;<br>访问级别:公开API|类名:AVSession<br>方法 or 属性:off(type: 'seek', callback?: (time: number) => void): void;<br>访问级别:系统API|@ohos.multimedia.avsession.d.ts| +|访问级别有变化|类名:AVSession<br>方法 or 属性:off(type: 'setSpeed', callback?: (speed: number) => void): void;<br>访问级别:公开API|类名:AVSession<br>方法 or 属性:off(type: 'setSpeed', callback?: (speed: number) => void): void;<br>访问级别:系统API|@ohos.multimedia.avsession.d.ts| +|访问级别有变化|类名:AVSession<br>方法 or 属性:off(type: 'setLoopMode', callback?: (mode: LoopMode) => void): void;<br>访问级别:公开API|类名:AVSession<br>方法 or 属性:off(type: 'setLoopMode', callback?: (mode: LoopMode) => void): void;<br>访问级别:系统API|@ohos.multimedia.avsession.d.ts| +|访问级别有变化|类名:AVSession<br>方法 or 属性:off(type: 'toggleFavorite', callback?: (assetId: string) => void): void;<br>访问级别:公开API|类名:AVSession<br>方法 or 属性:off(type: 'toggleFavorite', callback?: (assetId: string) => void): void;<br>访问级别:系统API|@ohos.multimedia.avsession.d.ts| +|访问级别有变化|类名:AVSession<br>方法 or 属性:off(type: 'handleKeyEvent', callback?: (event: KeyEvent) => void): void;<br>访问级别:公开API|类名:AVSession<br>方法 or 属性:off(type: 'handleKeyEvent', callback?: (event: KeyEvent) => void): void;<br>访问级别:系统API|@ohos.multimedia.avsession.d.ts| +|访问级别有变化|类名:AVSession<br>方法 or 属性:off(type: 'outputDeviceChange', callback?: (device: OutputDeviceInfo) => void): void;<br>访问级别:公开API|类名:AVSession<br>方法 or 属性:off(type: 'outputDeviceChange', callback?: (device: OutputDeviceInfo) => void): void;<br>访问级别:系统API|@ohos.multimedia.avsession.d.ts| +|访问级别有变化|类名:AVSessionController<br>方法 or 属性:off(type: 'metadataChange', callback?: (data: AVMetadata) => void);<br>访问级别:公开API|类名:AVSessionController<br>方法 or 属性:off(type: 'metadataChange', callback?: (data: AVMetadata) => void);<br>访问级别:系统API|@ohos.multimedia.avsession.d.ts| +|访问级别有变化|类名:AVSessionController<br>方法 or 属性:off(type: 'playbackStateChange', callback?: (state: AVPlaybackState) => void);<br>访问级别:公开API|类名:AVSessionController<br>方法 or 属性:off(type: 'playbackStateChange', callback?: (state: AVPlaybackState) => void);<br>访问级别:系统API|@ohos.multimedia.avsession.d.ts| +|访问级别有变化|类名:AVSessionController<br>方法 or 属性:off(type: 'sessionDestroy', callback?: () => void);<br>访问级别:公开API|类名:AVSessionController<br>方法 or 属性:off(type: 'sessionDestroy', callback?: () => void);<br>访问级别:系统API|@ohos.multimedia.avsession.d.ts| +|访问级别有变化|类名:AVSessionController<br>方法 or 属性:off(type: 'activeStateChange', callback?: (isActive: boolean) => void);<br>访问级别:公开API|类名:AVSessionController<br>方法 or 属性:off(type: 'activeStateChange', callback?: (isActive: boolean) => void);<br>访问级别:系统API|@ohos.multimedia.avsession.d.ts| +|访问级别有变化|类名:AVSessionController<br>方法 or 属性:off(type: 'validCommandChange', callback?: (commands: Array\<AVControlCommandType>) => void);<br>访问级别:公开API|类名:AVSessionController<br>方法 or 属性:off(type: 'validCommandChange', callback?: (commands: Array\<AVControlCommandType>) => void);<br>访问级别:系统API|@ohos.multimedia.avsession.d.ts| +|访问级别有变化|类名:AVSessionController<br>方法 or 属性:off(type: 'outputDeviceChange', callback?: (device: OutputDeviceInfo) => void): void;<br>访问级别:公开API|类名:AVSessionController<br>方法 or 属性:off(type: 'outputDeviceChange', callback?: (device: OutputDeviceInfo) => void): void;<br>访问级别:系统API|@ohos.multimedia.avsession.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:on(type: 'volumeChange', callback: Callback\<VolumeEvent>): void;<br>废弃版本:9|类名:AudioManager<br>方法 or 属性:on(type: 'volumeChange', callback: Callback\<VolumeEvent>): void;<br>废弃版本:N/A<br>代替接口:ohos.multimedia.audio.AudioVolumeManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:mediaLibrary<br>废弃版本:N/A|类名:mediaLibrary<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:mediaLibrary<br>方法 or 属性:function getMediaLibrary(): MediaLibrary;<br>废弃版本:N/A|类名:mediaLibrary<br>方法 or 属性:function getMediaLibrary(): MediaLibrary;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:mediaLibrary<br>方法 or 属性:function getMediaLibrary(context: Context): MediaLibrary;<br>废弃版本:N/A|类名:mediaLibrary<br>方法 or 属性:function getMediaLibrary(context: Context): MediaLibrary;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaType<br>废弃版本:N/A|类名:MediaType<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaType<br>方法 or 属性:FILE = 0<br>废弃版本:N/A|类名:MediaType<br>方法 or 属性:FILE = 0<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaType<br>方法 or 属性:IMAGE<br>废弃版本:N/A|类名:MediaType<br>方法 or 属性:IMAGE<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaType<br>方法 or 属性:VIDEO<br>废弃版本:N/A|类名:MediaType<br>方法 or 属性:VIDEO<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaType<br>方法 or 属性:AUDIO<br>废弃版本:N/A|类名:MediaType<br>方法 or 属性:AUDIO<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>废弃版本:N/A|类名:FileAsset<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly id: number;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly id: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly uri: string;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly uri: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly mimeType: string;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly mimeType: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly mediaType: MediaType;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly mediaType: MediaType;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:displayName: string;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:displayName: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:title: string;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:title: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:relativePath: string;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:relativePath: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly parent: number;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly parent: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly size: number;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly size: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly dateAdded: number;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly dateAdded: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly dateModified: number;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly dateModified: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly dateTaken: number;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly dateTaken: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly artist: string;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly artist: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly audioAlbum: string;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly audioAlbum: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly width: number;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly width: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly height: number;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly height: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:orientation: number;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:orientation: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly duration: number;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly duration: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly albumId: number;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly albumId: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly albumUri: string;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly albumUri: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly albumName: string;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly albumName: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:isDirectory(callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:isDirectory(callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:isDirectory():Promise\<boolean>;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:isDirectory():Promise\<boolean>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:commitModify(callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:commitModify(callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:commitModify(): Promise\<void>;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:commitModify(): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:open(mode: string, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:open(mode: string, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:open(mode: string): Promise\<number>;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:open(mode: string): Promise\<number>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:close(fd: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:close(fd: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:close(fd: number): Promise\<void>;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:close(fd: number): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:getThumbnail(callback: AsyncCallback\<image.PixelMap>): void;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:getThumbnail(callback: AsyncCallback\<image.PixelMap>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:getThumbnail(size: Size, callback: AsyncCallback\<image.PixelMap>): void;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:getThumbnail(size: Size, callback: AsyncCallback\<image.PixelMap>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:getThumbnail(size?: Size): Promise\<image.PixelMap>;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:getThumbnail(size?: Size): Promise\<image.PixelMap>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:favorite(isFavorite: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:favorite(isFavorite: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:favorite(isFavorite: boolean): Promise\<void>;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:favorite(isFavorite: boolean): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:isFavorite(callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:isFavorite(callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:isFavorite():Promise\<boolean>;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:isFavorite():Promise\<boolean>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:trash(isTrash: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:trash(isTrash: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:trash(isTrash: boolean): Promise\<void>;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:trash(isTrash: boolean): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:isTrash(callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:isTrash(callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:isTrash():Promise\<boolean>;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:isTrash():Promise\<boolean>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>废弃版本:N/A|类名:FileKey<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:ID = "file_id"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:ID = "file_id"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:RELATIVE_PATH = "relative_path"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:RELATIVE_PATH = "relative_path"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:DISPLAY_NAME = "display_name"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:DISPLAY_NAME = "display_name"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:PARENT = "parent"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:PARENT = "parent"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:MIME_TYPE = "mime_type"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:MIME_TYPE = "mime_type"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:MEDIA_TYPE = "media_type"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:MEDIA_TYPE = "media_type"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:SIZE = "size"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:SIZE = "size"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:DATE_ADDED = "date_added"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:DATE_ADDED = "date_added"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:DATE_MODIFIED = "date_modified"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:DATE_MODIFIED = "date_modified"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:DATE_TAKEN = "date_taken"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:DATE_TAKEN = "date_taken"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:TITLE = "title"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:TITLE = "title"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:ARTIST = "artist"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:ARTIST = "artist"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:AUDIOALBUM = "audio_album"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:AUDIOALBUM = "audio_album"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:DURATION = "duration"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:DURATION = "duration"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:WIDTH = "width"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:WIDTH = "width"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:HEIGHT = "height"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:HEIGHT = "height"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:ORIENTATION = "orientation"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:ORIENTATION = "orientation"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:ALBUM_ID = "bucket_id"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:ALBUM_ID = "bucket_id"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:ALBUM_NAME = "bucket_display_name"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:ALBUM_NAME = "bucket_display_name"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaFetchOptions<br>废弃版本:N/A|类名:MediaFetchOptions<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaFetchOptions<br>方法 or 属性:selections: string;<br>废弃版本:N/A|类名:MediaFetchOptions<br>方法 or 属性:selections: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaFetchOptions<br>方法 or 属性:selectionArgs: Array\<string>;<br>废弃版本:N/A|类名:MediaFetchOptions<br>方法 or 属性:selectionArgs: Array\<string>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaFetchOptions<br>方法 or 属性:order?: string;<br>废弃版本:N/A|类名:MediaFetchOptions<br>方法 or 属性:order?: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaFetchOptions<br>方法 or 属性:uri?: string;<br>废弃版本:N/A|类名:MediaFetchOptions<br>方法 or 属性:uri?: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaFetchOptions<br>方法 or 属性:networkId?: string;<br>废弃版本:N/A|类名:MediaFetchOptions<br>方法 or 属性:networkId?: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaFetchOptions<br>方法 or 属性:extendArgs?: string;<br>废弃版本:N/A|类名:MediaFetchOptions<br>方法 or 属性:extendArgs?: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FetchFileResult<br>废弃版本:N/A|类名:FetchFileResult<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FetchFileResult<br>方法 or 属性:getCount(): number;<br>废弃版本:N/A|类名:FetchFileResult<br>方法 or 属性:getCount(): number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FetchFileResult<br>方法 or 属性:isAfterLast(): boolean;<br>废弃版本:N/A|类名:FetchFileResult<br>方法 or 属性:isAfterLast(): boolean;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FetchFileResult<br>方法 or 属性:close(): void;<br>废弃版本:N/A|类名:FetchFileResult<br>方法 or 属性:close(): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FetchFileResult<br>方法 or 属性:getFirstObject(callback: AsyncCallback\<FileAsset>): void;<br>废弃版本:N/A|类名:FetchFileResult<br>方法 or 属性:getFirstObject(callback: AsyncCallback\<FileAsset>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FetchFileResult<br>方法 or 属性:getFirstObject(): Promise\<FileAsset>;<br>废弃版本:N/A|类名:FetchFileResult<br>方法 or 属性:getFirstObject(): Promise\<FileAsset>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FetchFileResult<br>方法 or 属性:getNextObject(callback: AsyncCallback\<FileAsset>): void;<br>废弃版本:N/A|类名:FetchFileResult<br>方法 or 属性:getNextObject(callback: AsyncCallback\<FileAsset>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FetchFileResult<br>方法 or 属性:getNextObject(): Promise\<FileAsset>;<br>废弃版本:N/A|类名:FetchFileResult<br>方法 or 属性:getNextObject(): Promise\<FileAsset>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FetchFileResult<br>方法 or 属性:getLastObject(callback: AsyncCallback\<FileAsset>): void;<br>废弃版本:N/A|类名:FetchFileResult<br>方法 or 属性:getLastObject(callback: AsyncCallback\<FileAsset>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FetchFileResult<br>方法 or 属性:getLastObject(): Promise\<FileAsset>;<br>废弃版本:N/A|类名:FetchFileResult<br>方法 or 属性:getLastObject(): Promise\<FileAsset>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FetchFileResult<br>方法 or 属性:getPositionObject(index: number, callback: AsyncCallback\<FileAsset>): void;<br>废弃版本:N/A|类名:FetchFileResult<br>方法 or 属性:getPositionObject(index: number, callback: AsyncCallback\<FileAsset>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FetchFileResult<br>方法 or 属性:getPositionObject(index: number): Promise\<FileAsset>;<br>废弃版本:N/A|类名:FetchFileResult<br>方法 or 属性:getPositionObject(index: number): Promise\<FileAsset>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FetchFileResult<br>方法 or 属性:getAllObject(callback: AsyncCallback\<Array\<FileAsset>>): void;<br>废弃版本:N/A|类名:FetchFileResult<br>方法 or 属性:getAllObject(callback: AsyncCallback\<Array\<FileAsset>>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FetchFileResult<br>方法 or 属性:getAllObject(): Promise\<Array\<FileAsset>>;<br>废弃版本:N/A|类名:FetchFileResult<br>方法 or 属性:getAllObject(): Promise\<Array\<FileAsset>>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Album<br>废弃版本:N/A|类名:Album<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Album<br>方法 or 属性:readonly albumId: number;<br>废弃版本:N/A|类名:Album<br>方法 or 属性:readonly albumId: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Album<br>方法 or 属性:albumName: string;<br>废弃版本:N/A|类名:Album<br>方法 or 属性:albumName: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Album<br>方法 or 属性:readonly albumUri: string;<br>废弃版本:N/A|类名:Album<br>方法 or 属性:readonly albumUri: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Album<br>方法 or 属性:readonly dateModified: number;<br>废弃版本:N/A|类名:Album<br>方法 or 属性:readonly dateModified: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Album<br>方法 or 属性:readonly count: number;<br>废弃版本:N/A|类名:Album<br>方法 or 属性:readonly count: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Album<br>方法 or 属性:readonly relativePath: string;<br>废弃版本:N/A|类名:Album<br>方法 or 属性:readonly relativePath: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Album<br>方法 or 属性:readonly coverUri: string;<br>废弃版本:N/A|类名:Album<br>方法 or 属性:readonly coverUri: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Album<br>方法 or 属性:commitModify(callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:Album<br>方法 or 属性:commitModify(callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Album<br>方法 or 属性:commitModify(): Promise\<void>;<br>废弃版本:N/A|类名:Album<br>方法 or 属性:commitModify(): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Album<br>方法 or 属性:getFileAssets(callback: AsyncCallback\<FetchFileResult>): void;<br>废弃版本:N/A|类名:Album<br>方法 or 属性:getFileAssets(callback: AsyncCallback\<FetchFileResult>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Album<br>方法 or 属性:getFileAssets(options: MediaFetchOptions, callback: AsyncCallback\<FetchFileResult>): void;<br>废弃版本:N/A|类名:Album<br>方法 or 属性:getFileAssets(options: MediaFetchOptions, callback: AsyncCallback\<FetchFileResult>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Album<br>方法 or 属性:getFileAssets(options?: MediaFetchOptions): Promise\<FetchFileResult>;<br>废弃版本:N/A|类名:Album<br>方法 or 属性:getFileAssets(options?: MediaFetchOptions): Promise\<FetchFileResult>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:DirectoryType<br>废弃版本:N/A|类名:DirectoryType<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:DirectoryType<br>方法 or 属性:DIR_CAMERA = 0<br>废弃版本:N/A|类名:DirectoryType<br>方法 or 属性:DIR_CAMERA = 0<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:DirectoryType<br>方法 or 属性:DIR_VIDEO<br>废弃版本:N/A|类名:DirectoryType<br>方法 or 属性:DIR_VIDEO<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:DirectoryType<br>方法 or 属性:DIR_IMAGE<br>废弃版本:N/A|类名:DirectoryType<br>方法 or 属性:DIR_IMAGE<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:DirectoryType<br>方法 or 属性:DIR_AUDIO<br>废弃版本:N/A|类名:DirectoryType<br>方法 or 属性:DIR_AUDIO<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:DirectoryType<br>方法 or 属性:DIR_DOCUMENTS<br>废弃版本:N/A|类名:DirectoryType<br>方法 or 属性:DIR_DOCUMENTS<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:DirectoryType<br>方法 or 属性:DIR_DOWNLOAD<br>废弃版本:N/A|类名:DirectoryType<br>方法 or 属性:DIR_DOWNLOAD<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>废弃版本:N/A|类名:MediaLibrary<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:getPublicDirectory(type: DirectoryType, callback: AsyncCallback\<string>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:getPublicDirectory(type: DirectoryType, callback: AsyncCallback\<string>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:getPublicDirectory(type: DirectoryType): Promise\<string>;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:getPublicDirectory(type: DirectoryType): Promise\<string>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:getFileAssets(options: MediaFetchOptions, callback: AsyncCallback\<FetchFileResult>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:getFileAssets(options: MediaFetchOptions, callback: AsyncCallback\<FetchFileResult>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:getFileAssets(options: MediaFetchOptions): Promise\<FetchFileResult>;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:getFileAssets(options: MediaFetchOptions): Promise\<FetchFileResult>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:createAsset(mediaType: MediaType, displayName: string, relativePath: string, callback: AsyncCallback\<FileAsset>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:createAsset(mediaType: MediaType, displayName: string, relativePath: string, callback: AsyncCallback\<FileAsset>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:createAsset(mediaType: MediaType, displayName: string, relativePath: string): Promise\<FileAsset>;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:createAsset(mediaType: MediaType, displayName: string, relativePath: string): Promise\<FileAsset>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:deleteAsset(uri: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:deleteAsset(uri: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:deleteAsset(uri: string): Promise\<void>;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:deleteAsset(uri: string): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:getAlbums(options: MediaFetchOptions, callback: AsyncCallback\<Array\<Album>>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:getAlbums(options: MediaFetchOptions, callback: AsyncCallback\<Array\<Album>>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:getAlbums(options: MediaFetchOptions): Promise\<Array\<Album>>;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:getAlbums(options: MediaFetchOptions): Promise\<Array\<Album>>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:getActivePeers(callback: AsyncCallback\<Array\<PeerInfo>>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:getActivePeers(callback: AsyncCallback\<Array\<PeerInfo>>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:getActivePeers(): Promise\<Array\<PeerInfo>>;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:getActivePeers(): Promise\<Array\<PeerInfo>>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:getAllPeers(callback: AsyncCallback\<Array\<PeerInfo>>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:getAllPeers(callback: AsyncCallback\<Array\<PeerInfo>>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:getAllPeers(): Promise\<Array\<PeerInfo>>;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:getAllPeers(): Promise\<Array\<PeerInfo>>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:release(callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:release(callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:release(): Promise\<void>;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:release(): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Size<br>废弃版本:N/A|类名:Size<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Size<br>方法 or 属性:width: number;<br>废弃版本:N/A|类名:Size<br>方法 or 属性:width: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Size<br>方法 or 属性:height: number;<br>废弃版本:N/A|类名:Size<br>方法 or 属性:height: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:PeerInfo<br>废弃版本:N/A|类名:PeerInfo<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:PeerInfo<br>方法 or 属性:readonly deviceName: string;<br>废弃版本:N/A|类名:PeerInfo<br>方法 or 属性:readonly deviceName: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:PeerInfo<br>方法 or 属性:readonly networkId: string;<br>废弃版本:N/A|类名:PeerInfo<br>方法 or 属性:readonly networkId: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:PeerInfo<br>方法 or 属性:readonly deviceType: DeviceType;<br>废弃版本:N/A|类名:PeerInfo<br>方法 or 属性:readonly deviceType: DeviceType;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:PeerInfo<br>方法 or 属性:readonly isOnline: boolean;<br>废弃版本:N/A|类名:PeerInfo<br>方法 or 属性:readonly isOnline: boolean;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:DeviceType<br>废弃版本:N/A|类名:DeviceType<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:DeviceType<br>方法 or 属性:TYPE_UNKNOWN = 0<br>废弃版本:N/A|类名:DeviceType<br>方法 or 属性:TYPE_UNKNOWN = 0<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:DeviceType<br>方法 or 属性:TYPE_LAPTOP<br>废弃版本:N/A|类名:DeviceType<br>方法 or 属性:TYPE_LAPTOP<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:DeviceType<br>方法 or 属性:TYPE_PHONE<br>废弃版本:N/A|类名:DeviceType<br>方法 or 属性:TYPE_PHONE<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:DeviceType<br>方法 or 属性:TYPE_TABLET<br>废弃版本:N/A|类名:DeviceType<br>方法 or 属性:TYPE_TABLET<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:DeviceType<br>方法 or 属性:TYPE_WATCH<br>废弃版本:N/A|类名:DeviceType<br>方法 or 属性:TYPE_WATCH<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:DeviceType<br>方法 or 属性:TYPE_CAR<br>废弃版本:N/A|类名:DeviceType<br>方法 or 属性:TYPE_CAR<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:DeviceType<br>方法 or 属性:TYPE_TV<br>废弃版本:N/A|类名:DeviceType<br>方法 or 属性:TYPE_TV<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|起始版本有变化|类名:AudioManager<br>方法 or 属性:on(type: 'volumeChange', callback: Callback\<VolumeEvent>): void;<br>起始版本:8|类名:AudioManager<br>方法 or 属性:on(type: 'volumeChange', callback: Callback\<VolumeEvent>): void;<br>起始版本:9|@ohos.multimedia.audio.d.ts| +|起始版本有变化|类名:VolumeEvent<br>起始版本:8|类名:VolumeEvent<br>起始版本:9|@ohos.multimedia.audio.d.ts| +|起始版本有变化|类名:VolumeEvent<br>方法 or 属性:volumeType: AudioVolumeType;<br>起始版本:8|类名:VolumeEvent<br>方法 or 属性:volumeType: AudioVolumeType;<br>起始版本:9|@ohos.multimedia.audio.d.ts| +|起始版本有变化|类名:VolumeEvent<br>方法 or 属性:volume: number;<br>起始版本:8|类名:VolumeEvent<br>方法 or 属性:volume: number;<br>起始版本:9|@ohos.multimedia.audio.d.ts| +|起始版本有变化|类名:VolumeEvent<br>方法 or 属性:updateUi: boolean;<br>起始版本:8|类名:VolumeEvent<br>方法 or 属性:updateUi: boolean;<br>起始版本:9|@ohos.multimedia.audio.d.ts| +|起始版本有变化|类名:avSession<br>方法 or 属性:function off(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;<br>起始版本:N/A|类名:avSession<br>方法 or 属性:function off(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;<br>起始版本:9|@ohos.multimedia.avsession.d.ts| +|起始版本有变化|类名:avSession<br>方法 or 属性:function off(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;<br>起始版本:N/A|类名:avSession<br>方法 or 属性:function off(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;<br>起始版本:9|@ohos.multimedia.avsession.d.ts| +|起始版本有变化|类名:avSession<br>方法 or 属性:function off(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;<br>起始版本:N/A|类名:avSession<br>方法 or 属性:function off(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;<br>起始版本:9|@ohos.multimedia.avsession.d.ts| +|起始版本有变化|类名:avSession<br>方法 or 属性:function off(type: 'sessionServiceDie', callback?: () => void): void;<br>起始版本:N/A|类名:avSession<br>方法 or 属性:function off(type: 'sessionServiceDie', callback?: () => void): void;<br>起始版本:9|@ohos.multimedia.avsession.d.ts| +|起始版本有变化|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>起始版本:N/A|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>起始版本:9|@ohos.multimedia.avsession.d.ts| +|起始版本有变化|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>起始版本:N/A|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>起始版本:9|@ohos.multimedia.avsession.d.ts| +|起始版本有变化|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>起始版本:N/A|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>起始版本:9|@ohos.multimedia.avsession.d.ts| +|起始版本有变化|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>起始版本:N/A|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>起始版本:9|@ohos.multimedia.avsession.d.ts| +|起始版本有变化|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>起始版本:N/A|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>起始版本:9|@ohos.multimedia.avsession.d.ts| +|起始版本有变化|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>起始版本:N/A|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>起始版本:9|@ohos.multimedia.avsession.d.ts| +|起始版本有变化|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>起始版本:N/A|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>起始版本:9|@ohos.multimedia.avsession.d.ts| +|起始版本有变化|类名:AVSession<br>方法 or 属性:off(type: 'seek', callback?: (time: number) => void): void;<br>起始版本:N/A|类名:AVSession<br>方法 or 属性:off(type: 'seek', callback?: (time: number) => void): void;<br>起始版本:9|@ohos.multimedia.avsession.d.ts| +|起始版本有变化|类名:AVSession<br>方法 or 属性:off(type: 'setSpeed', callback?: (speed: number) => void): void;<br>起始版本:N/A|类名:AVSession<br>方法 or 属性:off(type: 'setSpeed', callback?: (speed: number) => void): void;<br>起始版本:9|@ohos.multimedia.avsession.d.ts| +|起始版本有变化|类名:AVSession<br>方法 or 属性:off(type: 'setLoopMode', callback?: (mode: LoopMode) => void): void;<br>起始版本:N/A|类名:AVSession<br>方法 or 属性:off(type: 'setLoopMode', callback?: (mode: LoopMode) => void): void;<br>起始版本:9|@ohos.multimedia.avsession.d.ts| +|起始版本有变化|类名:AVSession<br>方法 or 属性:off(type: 'toggleFavorite', callback?: (assetId: string) => void): void;<br>起始版本:N/A|类名:AVSession<br>方法 or 属性:off(type: 'toggleFavorite', callback?: (assetId: string) => void): void;<br>起始版本:9|@ohos.multimedia.avsession.d.ts| +|起始版本有变化|类名:AVSession<br>方法 or 属性:off(type: 'handleKeyEvent', callback?: (event: KeyEvent) => void): void;<br>起始版本:N/A|类名:AVSession<br>方法 or 属性:off(type: 'handleKeyEvent', callback?: (event: KeyEvent) => void): void;<br>起始版本:9|@ohos.multimedia.avsession.d.ts| +|起始版本有变化|类名:AVSession<br>方法 or 属性:off(type: 'outputDeviceChange', callback?: (device: OutputDeviceInfo) => void): void;<br>起始版本:N/A|类名:AVSession<br>方法 or 属性:off(type: 'outputDeviceChange', callback?: (device: OutputDeviceInfo) => void): void;<br>起始版本:9|@ohos.multimedia.avsession.d.ts| +|起始版本有变化|类名:AVSessionController<br>方法 or 属性:off(type: 'metadataChange', callback?: (data: AVMetadata) => void);<br>起始版本:N/A|类名:AVSessionController<br>方法 or 属性:off(type: 'metadataChange', callback?: (data: AVMetadata) => void);<br>起始版本:9|@ohos.multimedia.avsession.d.ts| +|起始版本有变化|类名:AVSessionController<br>方法 or 属性:off(type: 'playbackStateChange', callback?: (state: AVPlaybackState) => void);<br>起始版本:N/A|类名:AVSessionController<br>方法 or 属性:off(type: 'playbackStateChange', callback?: (state: AVPlaybackState) => void);<br>起始版本:9|@ohos.multimedia.avsession.d.ts| +|起始版本有变化|类名:AVSessionController<br>方法 or 属性:off(type: 'sessionDestroy', callback?: () => void);<br>起始版本:N/A|类名:AVSessionController<br>方法 or 属性:off(type: 'sessionDestroy', callback?: () => void);<br>起始版本:9|@ohos.multimedia.avsession.d.ts| +|起始版本有变化|类名:AVSessionController<br>方法 or 属性:off(type: 'activeStateChange', callback?: (isActive: boolean) => void);<br>起始版本:N/A|类名:AVSessionController<br>方法 or 属性:off(type: 'activeStateChange', callback?: (isActive: boolean) => void);<br>起始版本:9|@ohos.multimedia.avsession.d.ts| +|起始版本有变化|类名:AVSessionController<br>方法 or 属性:off(type: 'validCommandChange', callback?: (commands: Array\<AVControlCommandType>) => void);<br>起始版本:N/A|类名:AVSessionController<br>方法 or 属性:off(type: 'validCommandChange', callback?: (commands: Array\<AVControlCommandType>) => void);<br>起始版本:9|@ohos.multimedia.avsession.d.ts| +|起始版本有变化|类名:AVSessionController<br>方法 or 属性:off(type: 'outputDeviceChange', callback?: (device: OutputDeviceInfo) => void): void;<br>起始版本:N/A|类名:AVSessionController<br>方法 or 属性:off(type: 'outputDeviceChange', callback?: (device: OutputDeviceInfo) => void): void;<br>起始版本:9|@ohos.multimedia.avsession.d.ts| +|起始版本有变化|类名:AVFileDescriptor<br>起始版本:N/A|类名:AVFileDescriptor<br>起始版本:9|@ohos.multimedia.media.d.ts| +|新增(错误码)|NA|类名:avSession<br>方法 or 属性:function off(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;<br>错误码内容: 201, 401|@ohos.multimedia.avsession.d.ts| +|新增(错误码)|NA|类名:avSession<br>方法 or 属性:function off(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;<br>错误码内容: 201, 401|@ohos.multimedia.avsession.d.ts| +|新增(错误码)|NA|类名:avSession<br>方法 or 属性:function off(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;<br>错误码内容: 201, 401|@ohos.multimedia.avsession.d.ts| +|新增(错误码)|NA|类名:avSession<br>方法 or 属性:function off(type: 'sessionServiceDie', callback?: () => void): void;<br>错误码内容: 201, 401|@ohos.multimedia.avsession.d.ts| +|新增(错误码)|NA|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>错误码内容: 401|@ohos.multimedia.avsession.d.ts| +|新增(错误码)|NA|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>错误码内容: 401|@ohos.multimedia.avsession.d.ts| +|新增(错误码)|NA|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>错误码内容: 401|@ohos.multimedia.avsession.d.ts| +|新增(错误码)|NA|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>错误码内容: 401|@ohos.multimedia.avsession.d.ts| +|新增(错误码)|NA|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>错误码内容: 401|@ohos.multimedia.avsession.d.ts| +|新增(错误码)|NA|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>错误码内容: 401|@ohos.multimedia.avsession.d.ts| +|新增(错误码)|NA|类名:AVSession<br>方法 or 属性:off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;<br>错误码内容: 401|@ohos.multimedia.avsession.d.ts| +|新增(错误码)|NA|类名:AVSession<br>方法 or 属性:off(type: 'seek', callback?: (time: number) => void): void;<br>错误码内容: 401|@ohos.multimedia.avsession.d.ts| +|新增(错误码)|NA|类名:AVSession<br>方法 or 属性:off(type: 'setSpeed', callback?: (speed: number) => void): void;<br>错误码内容: 401|@ohos.multimedia.avsession.d.ts| +|新增(错误码)|NA|类名:AVSession<br>方法 or 属性:off(type: 'setLoopMode', callback?: (mode: LoopMode) => void): void;<br>错误码内容: 401|@ohos.multimedia.avsession.d.ts| +|新增(错误码)|NA|类名:AVSession<br>方法 or 属性:off(type: 'toggleFavorite', callback?: (assetId: string) => void): void;<br>错误码内容: 401|@ohos.multimedia.avsession.d.ts| +|新增(错误码)|NA|类名:AVSession<br>方法 or 属性:off(type: 'handleKeyEvent', callback?: (event: KeyEvent) => void): void;<br>错误码内容: 401|@ohos.multimedia.avsession.d.ts| +|新增(错误码)|NA|类名:AVSession<br>方法 or 属性:off(type: 'outputDeviceChange', callback?: (device: OutputDeviceInfo) => void): void;<br>错误码内容: 401|@ohos.multimedia.avsession.d.ts| +|新增(错误码)|NA|类名:AVSessionController<br>方法 or 属性:off(type: 'metadataChange', callback?: (data: AVMetadata) => void);<br>错误码内容: 401|@ohos.multimedia.avsession.d.ts| +|新增(错误码)|NA|类名:AVSessionController<br>方法 or 属性:off(type: 'playbackStateChange', callback?: (state: AVPlaybackState) => void);<br>错误码内容: 401|@ohos.multimedia.avsession.d.ts| +|新增(错误码)|NA|类名:AVSessionController<br>方法 or 属性:off(type: 'sessionDestroy', callback?: () => void);<br>错误码内容: 401|@ohos.multimedia.avsession.d.ts| +|新增(错误码)|NA|类名:AVSessionController<br>方法 or 属性:off(type: 'activeStateChange', callback?: (isActive: boolean) => void);<br>错误码内容: 401|@ohos.multimedia.avsession.d.ts| +|新增(错误码)|NA|类名:AVSessionController<br>方法 or 属性:off(type: 'validCommandChange', callback?: (commands: Array\<AVControlCommandType>) => void);<br>错误码内容: 401|@ohos.multimedia.avsession.d.ts| +|新增(错误码)|NA|类名:AVSessionController<br>方法 or 属性:off(type: 'outputDeviceChange', callback?: (device: OutputDeviceInfo) => void): void;<br>错误码内容: 401|@ohos.multimedia.avsession.d.ts| +|新增(权限)|类名:avSession<br>方法 or 属性:function off(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;<br>权限:N/A|类名:avSession<br>方法 or 属性:function off(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;<br>权限:ohos.permission.MANAGE_MEDIA_RESOURCES|@ohos.multimedia.avsession.d.ts| +|新增(权限)|类名:avSession<br>方法 or 属性:function off(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;<br>权限:N/A|类名:avSession<br>方法 or 属性:function off(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;<br>权限:ohos.permission.MANAGE_MEDIA_RESOURCES|@ohos.multimedia.avsession.d.ts| +|新增(权限)|类名:avSession<br>方法 or 属性:function off(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;<br>权限:N/A|类名:avSession<br>方法 or 属性:function off(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;<br>权限:ohos.permission.MANAGE_MEDIA_RESOURCES|@ohos.multimedia.avsession.d.ts| +|SysCap有变化|类名:avSession<br>方法 or 属性:function off(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;<br>SysCap:SystemCapability.Multimedia.AVSession.Core|类名:avSession<br>方法 or 属性:function off(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;<br>SysCap:SystemCapability.Multimedia.AVSession.Manager|@ohos.multimedia.avsession.d.ts| +|SysCap有变化|类名:avSession<br>方法 or 属性:function off(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;<br>SysCap:SystemCapability.Multimedia.AVSession.Core|类名:avSession<br>方法 or 属性:function off(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;<br>SysCap:SystemCapability.Multimedia.AVSession.Manager|@ohos.multimedia.avsession.d.ts| +|SysCap有变化|类名:avSession<br>方法 or 属性:function off(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;<br>SysCap:SystemCapability.Multimedia.AVSession.Core|类名:avSession<br>方法 or 属性:function off(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;<br>SysCap:SystemCapability.Multimedia.AVSession.Manager|@ohos.multimedia.avsession.d.ts| +|SysCap有变化|类名:AVFileDescriptor<br>SysCap:N/A|类名:AVFileDescriptor<br>SysCap:SystemCapability.Multimedia.Media.Core|@ohos.multimedia.media.d.ts| diff --git a/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-notification.md b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-notification.md new file mode 100644 index 0000000000000000000000000000000000000000..2113ba0e3f8da744fe948766e98cc4683f6e3599 --- /dev/null +++ b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-notification.md @@ -0,0 +1,26 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|类名:notificationManager<br>方法or属性:function isSupportDoNotDisturbMode(callback: AsyncCallback\<boolean>): void;|@ohos.notificationManager.d.ts| +|新增|NA|类名:notificationManager<br>方法or属性:function isSupportDoNotDisturbMode(): Promise\<boolean>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: NotificationCommonDef<br>类名: BundleOption|NotificationCommonDef.d.ts| +|新增|NA|模块名: NotificationCommonDef<br>类名: BundleOption<br>方法 or 属性: bundle: string;|NotificationCommonDef.d.ts| +|新增|NA|模块名: NotificationCommonDef<br>类名: BundleOption<br>方法 or 属性: uid?: number;|NotificationCommonDef.d.ts| +|删除|模块名: ohos.commonEvent<br>类名: Support<br>方法 or 属性:COMMON_EVENT_PACKAGE_CACHE_CLEARED = "usual.event.PACKAGE_CACHE_CLEARED"|NA|@ohos.commonEvent.d.ts| +|删除|模块名: ohos.commonEvent<br>类名: Support<br>方法 or 属性:COMMON_EVENT_USB_STATE = "usual.event.hardware.usb.action.USB_STATE"|NA|@ohos.commonEvent.d.ts| +|删除|模块名: ohos.commonEvent<br>类名: Support<br>方法 or 属性:COMMON_EVENT_USB_PORT_CHANGED = "usual.event.hardware.usb.action.USB_PORT_CHANGED"|NA|@ohos.commonEvent.d.ts| +|删除|模块名: ohos.commonEvent<br>类名: Support<br>方法 or 属性:COMMON_EVENT_VOLUME_REMOVED = "usual.event.data.VOLUME_REMOVED"|NA|@ohos.commonEvent.d.ts| +|删除|模块名: ohos.commonEvent<br>类名: Support<br>方法 or 属性:COMMON_EVENT_VOLUME_UNMOUNTED = "usual.event.data.VOLUME_UNMOUNTED"|NA|@ohos.commonEvent.d.ts| +|删除|模块名: ohos.commonEvent<br>类名: Support<br>方法 or 属性:COMMON_EVENT_VOLUME_MOUNTED = "usual.event.data.VOLUME_MOUNTED"|NA|@ohos.commonEvent.d.ts| +|删除|模块名: ohos.commonEvent<br>类名: Support<br>方法 or 属性:COMMON_EVENT_VOLUME_BAD_REMOVAL = "usual.event.data.VOLUME_BAD_REMOVAL"|NA|@ohos.commonEvent.d.ts| +|删除|模块名: ohos.commonEvent<br>类名: Support<br>方法 or 属性:COMMON_EVENT_VOLUME_EJECT = "usual.event.data.VOLUME_EJECT"|NA|@ohos.commonEvent.d.ts| +|删除|模块名: ohos.commonEvent<br>类名: Support<br>方法 or 属性:COMMON_EVENT_SLOT_CHANGE = "usual.event.SLOT_CHANGE"|NA|@ohos.commonEvent.d.ts| +|删除|模块名: ohos.commonEvent<br>类名: Support<br>方法 or 属性:COMMON_EVENT_SPN_INFO_CHANGED = "usual.event.SPN_INFO_CHANGED"|NA|@ohos.commonEvent.d.ts| +|删除|模块名: ohos.commonEvent<br>类名: Support<br>方法 or 属性:COMMON_EVENT_QUICK_FIX_APPLY_RESULT = "usual.event.QUICK_FIX_APPLY_RESULT"|NA|@ohos.commonEvent.d.ts| +|删除|模块名:ohos.notificationManager<br>类名:notificationManager<br>方法 or 属性:function supportDoNotDisturbMode(callback: AsyncCallback\<boolean>): void;|NA|@ohos.notificationManager.d.ts| +|删除|模块名:ohos.notificationManager<br>类名:notificationManager<br>方法 or 属性:function supportDoNotDisturbMode(): Promise\<boolean>;|NA|@ohos.notificationManager.d.ts| +|删除|模块名: ohos.notificationManager<br>类名: BundleOption|NA|@ohos.notificationManager.d.ts| +|删除|模块名: ohos.notificationManager<br>类名: BundleOption<br>方法 or 属性:bundle: string;|NA|@ohos.notificationManager.d.ts| +|删除|模块名: ohos.notificationManager<br>类名: BundleOption<br>方法 or 属性:uid?: number;|NA|@ohos.notificationManager.d.ts| +|删除|模块名: ohos.notificationSubscribe<br>类名: BundleOption|NA|@ohos.notificationSubscribe.d.ts| +|删除|模块名: ohos.notificationSubscribe<br>类名: BundleOption<br>方法 or 属性:bundle: string;|NA|@ohos.notificationSubscribe.d.ts| +|删除|模块名: ohos.notificationSubscribe<br>类名: BundleOption<br>方法 or 属性:uid?: number;|NA|@ohos.notificationSubscribe.d.ts| diff --git a/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-resource-scheduler.md b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-resource-scheduler.md new file mode 100644 index 0000000000000000000000000000000000000000..c9d767e5a42781c21e19c913e884bb4078cca129 --- /dev/null +++ b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-resource-scheduler.md @@ -0,0 +1,14 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|类名:WorkInfo<br>方法or属性:parameters?: {[key: string]: number \| string \| boolean};|@ohos.resourceschedule.workScheduler.d.ts| +|访问级别有变化|类名:BundleEvents<br>访问级别:公开API|类名:BundleEvents<br>访问级别:系统API|@ohos.resourceschedule.usageStatistics.d.ts| +|访问级别有变化|类名:usageStatistics<br>方法 or 属性:function isIdleState(bundleName: string, callback: AsyncCallback\<boolean>): void;<br>访问级别:公开API|类名:usageStatistics<br>方法 or 属性:function isIdleState(bundleName: string, callback: AsyncCallback\<boolean>): void;<br>访问级别:系统API|@ohos.resourceschedule.usageStatistics.d.ts| +|访问级别有变化|类名:usageStatistics<br>方法 or 属性:function isIdleState(bundleName: string): Promise\<boolean>;<br>访问级别:公开API|类名:usageStatistics<br>方法 or 属性:function isIdleState(bundleName: string): Promise\<boolean>;<br>访问级别:系统API|@ohos.resourceschedule.usageStatistics.d.ts| +|访问级别有变化|类名:usageStatistics<br>方法 or 属性:function queryAppGroup(callback: AsyncCallback\<number>): void;<br>访问级别:公开API|类名:usageStatistics<br>方法 or 属性:function queryAppGroup(callback: AsyncCallback\<number>): void;<br>访问级别:系统API|@ohos.resourceschedule.usageStatistics.d.ts| +|访问级别有变化|类名:usageStatistics<br>方法 or 属性:function queryAppGroup(): Promise\<number>;<br>访问级别:公开API|类名:usageStatistics<br>方法 or 属性:function queryAppGroup(): Promise\<number>;<br>访问级别:系统API|@ohos.resourceschedule.usageStatistics.d.ts| +|访问级别有变化|类名:usageStatistics<br>方法 or 属性:function queryCurrentBundleEvents(begin: number, end: number, callback: AsyncCallback\<Array\<BundleEvents>>): void;<br>访问级别:公开API|类名:usageStatistics<br>方法 or 属性:function queryCurrentBundleEvents(begin: number, end: number, callback: AsyncCallback\<Array\<BundleEvents>>): void;<br>访问级别:系统API|@ohos.resourceschedule.usageStatistics.d.ts| +|访问级别有变化|类名:usageStatistics<br>方法 or 属性:function queryCurrentBundleEvents(begin: number, end: number): Promise\<Array\<BundleEvents>>;<br>访问级别:公开API|类名:usageStatistics<br>方法 or 属性:function queryCurrentBundleEvents(begin: number, end: number): Promise\<Array\<BundleEvents>>;<br>访问级别:系统API|@ohos.resourceschedule.usageStatistics.d.ts| +|新增(权限)|类名:usageStatistics<br>方法 or 属性:function isIdleState(bundleName: string, callback: AsyncCallback\<boolean>): void;<br>权限:N/A|类名:usageStatistics<br>方法 or 属性:function isIdleState(bundleName: string, callback: AsyncCallback\<boolean>): void;<br>权限:ohos.permission.BUNDLE_ACTIVE_INFO|@ohos.resourceschedule.usageStatistics.d.ts| +|新增(权限)|类名:usageStatistics<br>方法 or 属性:function isIdleState(bundleName: string): Promise\<boolean>;<br>权限:N/A|类名:usageStatistics<br>方法 or 属性:function isIdleState(bundleName: string): Promise\<boolean>;<br>权限:ohos.permission.BUNDLE_ACTIVE_INFO|@ohos.resourceschedule.usageStatistics.d.ts| +|SysCap有变化|类名:backgroundTaskManager<br>SysCap:SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask|类名:backgroundTaskManager<br>SysCap:N/A|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|SysCap有变化|类名:workScheduler<br>SysCap:SystemCapability.ResourceSchedule.WorkScheduler|类名:workScheduler<br>SysCap:N/A|@ohos.resourceschedule.workScheduler.d.ts| diff --git a/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-security.md b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-security.md new file mode 100644 index 0000000000000000000000000000000000000000..f81eb4f72870bb481aa551f003c7829e8bc881a3 --- /dev/null +++ b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-security.md @@ -0,0 +1,25 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|类名:privacyManager<br>方法or属性:function getPermissionUsedRecord(request: PermissionUsedRequest): Promise\<PermissionUsedResponse>;|@ohos.privacyManager.d.ts| +|新增|NA|类名:privacyManager<br>方法or属性:function getPermissionUsedRecord(request: PermissionUsedRequest, callback: AsyncCallback\<PermissionUsedResponse>): void;|@ohos.privacyManager.d.ts| +|新增|NA|类名:ParamsSpec<br>方法or属性:algName : string;|@ohos.security.cryptoFramework.d.ts| +|删除|模块名:ohos.privacyManager<br>类名:privacyManager<br>方法 or 属性:function getPermissionUsedRecords(request: PermissionUsedRequest): Promise\<PermissionUsedResponse>;|NA|@ohos.privacyManager.d.ts| +|删除|模块名:ohos.privacyManager<br>类名:privacyManager<br>方法 or 属性:function getPermissionUsedRecords(request: PermissionUsedRequest, callback: AsyncCallback\<PermissionUsedResponse>): void;|NA|@ohos.privacyManager.d.ts| +|删除|模块名:ohos.security.cryptoFramework<br>类名:ParamsSpec<br>方法 or 属性:algoName : string;|NA|@ohos.security.cryptoFramework.d.ts| +|删除|模块名: ohos.security.huks<br>类名: HuksErrorCode<br>方法 or 属性:HUKS_ERROR_GET_USERIAM_SECINFO_FAILED = -40|NA|@ohos.security.huks.d.ts| +|删除|模块名: ohos.security.huks<br>类名: HuksErrorCode<br>方法 or 属性:HUKS_ERROR_GET_USERIAM_AUTHINFO_FAILED = -41|NA|@ohos.security.huks.d.ts| +|删除|模块名: ohos.security.huks<br>类名: HuksErrorCode<br>方法 or 属性:HUKS_ERROR_USER_AUTH_TYPE_NOT_SUPPORT = -42|NA|@ohos.security.huks.d.ts| +|删除|模块名: ohos.security.huks<br>类名: HuksErrorCode<br>方法 or 属性:HUKS_ERROR_KEY_AUTH_FAILED = -43|NA|@ohos.security.huks.d.ts| +|删除|模块名: ohos.security.huks<br>类名: HuksErrorCode<br>方法 or 属性:HUKS_ERROR_DEVICE_NO_CREDENTIAL = -44|NA|@ohos.security.huks.d.ts| +|删除|模块名: ohos.security.huks<br>类名: HuksErrorCode<br>方法 or 属性:HUKS_ERROR_INVALID_WRAPPED_FORMAT = -126|NA|@ohos.security.huks.d.ts| +|删除|模块名: ohos.security.huks<br>类名: HuksErrorCode<br>方法 or 属性:HUKS_ERROR_INVALID_USAGE_OF_KEY = -127|NA|@ohos.security.huks.d.ts| +|函数有变化|类名:AtManager<br>方法 or 属性:requestPermissionsFromUser(context: Context, permissions: Array\<Permissions>, requestCallback: AsyncCallback\<PermissionRequestResult>) : void;<br>|类名:AtManager<br>方法 or 属性:requestPermissionsFromUser(context: Context, permissionList: Array\<Permissions>, requestCallback: AsyncCallback\<PermissionRequestResult>) : void;<br>|@ohos.abilityAccessCtrl.d.ts| +|函数有变化|类名:AtManager<br>方法 or 属性:requestPermissionsFromUser(context: Context, permissions: Array\<Permissions>) : Promise\<PermissionRequestResult>;<br>|类名:AtManager<br>方法 or 属性:requestPermissionsFromUser(context: Context, permissionList: Array\<Permissions>) : Promise\<PermissionRequestResult>;<br>|@ohos.abilityAccessCtrl.d.ts| +|函数有变化|类名:AtManager<br>方法 or 属性:grantUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlag: number): Promise\<void>;<br>|类名:AtManager<br>方法 or 属性:grantUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlags: number): Promise\<void>;<br>|@ohos.abilityAccessCtrl.d.ts| +|函数有变化|类名:AtManager<br>方法 or 属性:grantUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlag: number, callback: AsyncCallback\<void>): void;<br>|类名:AtManager<br>方法 or 属性:grantUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlags: number, callback: AsyncCallback\<void>): void;<br>|@ohos.abilityAccessCtrl.d.ts| +|函数有变化|类名:AtManager<br>方法 or 属性:revokeUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlag: number): Promise\<void>;<br>|类名:AtManager<br>方法 or 属性:revokeUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlags: number): Promise\<void>;<br>|@ohos.abilityAccessCtrl.d.ts| +|函数有变化|类名:AtManager<br>方法 or 属性:revokeUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlag: number, callback: AsyncCallback\<void>): void;<br>|类名:AtManager<br>方法 or 属性:revokeUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlags: number, callback: AsyncCallback\<void>): void;<br>|@ohos.abilityAccessCtrl.d.ts| +|函数有变化|类名:AtManager<br>方法 or 属性:on(type: 'permissionStateChange', tokenIDList: Array\<number>, permissionNameList: Array\<Permissions>, callback: Callback\<PermissionStateChangeInfo>): void;<br>|类名:AtManager<br>方法 or 属性:on(type: 'permissionStateChange', tokenIDList: Array\<number>, permissionList: Array\<Permissions>, callback: Callback\<PermissionStateChangeInfo>): void;<br>|@ohos.abilityAccessCtrl.d.ts| +|函数有变化|类名:AtManager<br>方法 or 属性:off(type: 'permissionStateChange', tokenIDList: Array\<number>, permissionNameList: Array\<Permissions>, callback?: Callback\<PermissionStateChangeInfo>): void;<br>|类名:AtManager<br>方法 or 属性:off(type: 'permissionStateChange', tokenIDList: Array\<number>, permissionList: Array\<Permissions>, callback?: Callback\<PermissionStateChangeInfo>): void;<br>|@ohos.abilityAccessCtrl.d.ts| +|函数有变化|类名:privacyManager<br>方法 or 属性:function on(type: 'activeStateChange', permissionNameList: Array\<Permissions>, callback: Callback\<ActiveChangeResponse>): void;<br>|类名:privacyManager<br>方法 or 属性:function on(type: 'activeStateChange', permissionList: Array\<Permissions>, callback: Callback\<ActiveChangeResponse>): void;<br>|@ohos.privacyManager.d.ts| +|函数有变化|类名:privacyManager<br>方法 or 属性:function off(type: 'activeStateChange', permissionNameList: Array\<Permissions>, callback?: Callback\<ActiveChangeResponse>): void;<br>|类名:privacyManager<br>方法 or 属性:function off(type: 'activeStateChange', permissionList: Array\<Permissions>, callback?: Callback\<ActiveChangeResponse>): void;<br>|@ohos.privacyManager.d.ts| diff --git a/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-sensor.md b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-sensor.md new file mode 100644 index 0000000000000000000000000000000000000000..ece2068c3f84dcdb587aca229ef6b392202e3002 --- /dev/null +++ b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-sensor.md @@ -0,0 +1,4 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|类名:Sensor<br>方法or属性:vendorName:string;|@ohos.sensor.d.ts| +|删除|模块名:ohos.sensor<br>类名:Sensor<br>方法 or 属性:venderName:string;|NA|@ohos.sensor.d.ts| diff --git a/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-start-up.md b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-start-up.md new file mode 100644 index 0000000000000000000000000000000000000000..ee4a88c29cfef9a0806cfd6b8f842a9519877bdc --- /dev/null +++ b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-start-up.md @@ -0,0 +1,20 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.systemParameterEnhance<br>类名: systemParameterEnhance|@ohos.systemParameterEnhance.d.ts| +|新增|NA|模块名: ohos.systemParameterEnhance<br>类名: systemParameterEnhance<br>方法 or 属性: function getSync(key: string, def?: string): string;|@ohos.systemParameterEnhance.d.ts| +|新增|NA|模块名: ohos.systemParameterEnhance<br>类名: systemParameterEnhance<br>方法 or 属性: function get(key: string, callback: AsyncCallback\<string>): void;|@ohos.systemParameterEnhance.d.ts| +|新增|NA|模块名: ohos.systemParameterEnhance<br>类名: systemParameterEnhance<br>方法 or 属性: function get(key: string, def: string, callback: AsyncCallback\<string>): void;|@ohos.systemParameterEnhance.d.ts| +|新增|NA|模块名: ohos.systemParameterEnhance<br>类名: systemParameterEnhance<br>方法 or 属性: function get(key: string, def?: string): Promise\<string>;|@ohos.systemParameterEnhance.d.ts| +|新增|NA|模块名: ohos.systemParameterEnhance<br>类名: systemParameterEnhance<br>方法 or 属性: function setSync(key: string, value: string): void;|@ohos.systemParameterEnhance.d.ts| +|新增|NA|模块名: ohos.systemParameterEnhance<br>类名: systemParameterEnhance<br>方法 or 属性: function set(key: string, value: string, callback: AsyncCallback\<void>): void;|@ohos.systemParameterEnhance.d.ts| +|新增|NA|模块名: ohos.systemParameterEnhance<br>类名: systemParameterEnhance<br>方法 or 属性: function set(key: string, value: string): Promise\<void>;|@ohos.systemParameterEnhance.d.ts| +|删除|模块名: ohos.systemParameterV9<br>类名: systemParameterV9|NA|@ohos.systemParameterV9.d.ts| +|删除|模块名: ohos.systemParameterV9<br>类名: systemParameterV9<br>方法 or 属性:function getSync(key: string, def?: string): string;|NA|@ohos.systemParameterV9.d.ts| +|删除|模块名: ohos.systemParameterV9<br>类名: systemParameterV9<br>方法 or 属性:function get(key: string, callback: AsyncCallback\<string>): void;|NA|@ohos.systemParameterV9.d.ts| +|删除|模块名: ohos.systemParameterV9<br>类名: systemParameterV9<br>方法 or 属性:function get(key: string, def: string, callback: AsyncCallback\<string>): void;|NA|@ohos.systemParameterV9.d.ts| +|删除|模块名: ohos.systemParameterV9<br>类名: systemParameterV9<br>方法 or 属性:function get(key: string, def?: string): Promise\<string>;|NA|@ohos.systemParameterV9.d.ts| +|删除|模块名: ohos.systemParameterV9<br>类名: systemParameterV9<br>方法 or 属性:function setSync(key: string, value: string): void;|NA|@ohos.systemParameterV9.d.ts| +|删除|模块名: ohos.systemParameterV9<br>类名: systemParameterV9<br>方法 or 属性:function set(key: string, value: string, callback: AsyncCallback\<void>): void;|NA|@ohos.systemParameterV9.d.ts| +|删除|模块名: ohos.systemParameterV9<br>类名: systemParameterV9<br>方法 or 属性:function set(key: string, value: string): Promise\<void>;|NA|@ohos.systemParameterV9.d.ts| +|废弃版本有变化|类名:deviceInfo<br>方法 or 属性:const hardwareProfile: string;<br>废弃版本:N/A|类名:deviceInfo<br>方法 or 属性:const hardwareProfile: string;<br>废弃版本:9<br>代替接口:N/A|@ohos.deviceInfo.d.ts| +|废弃版本有变化|类名:Device<br>方法 or 属性:static getInfo(options?: GetDeviceOptions): void;<br>废弃版本:N/A|类名:Device<br>方法 or 属性:static getInfo(options?: GetDeviceOptions): void;<br>废弃版本:6<br>代替接口:N/A|@system.device.d.ts| diff --git a/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-telephony.md b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-telephony.md new file mode 100644 index 0000000000000000000000000000000000000000..aea5aec7bb3feb94bda24e4757261aeb793ffdf8 --- /dev/null +++ b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-telephony.md @@ -0,0 +1,315 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|类名:call<br>方法or属性:function dialCall(phoneNumber: string, callback: AsyncCallback\<void>): void;|@ohos.telephony.call.d.ts| +|新增|NA|类名:call<br>方法or属性:function dialCall(phoneNumber: string, options: DialCallOptions, callback: AsyncCallback\<void>): void;|@ohos.telephony.call.d.ts| +|新增|NA|类名:call<br>方法or属性:function dialCall(phoneNumber: string, options?: DialCallOptions): Promise\<void>;|@ohos.telephony.call.d.ts| +|新增|NA|类名:call<br>方法or属性:function answerCall(callId: number, callback: AsyncCallback\<void>): void;|@ohos.telephony.call.d.ts| +|新增|NA|类名:call<br>方法or属性:function answerCall(callId?: number): Promise\<void>;|@ohos.telephony.call.d.ts| +|新增|NA|类名:call<br>方法or属性:function answerCall(callback: AsyncCallback\<void>): void;|@ohos.telephony.call.d.ts| +|新增|NA|类名:call<br>方法or属性:function hangUpCall(callId: number, callback: AsyncCallback\<void>): void;|@ohos.telephony.call.d.ts| +|新增|NA|类名:call<br>方法or属性:function hangUpCall(callId?: number): Promise\<void>;|@ohos.telephony.call.d.ts| +|新增|NA|类名:call<br>方法or属性:function hangUpCall(callback: AsyncCallback\<void>): void;|@ohos.telephony.call.d.ts| +|新增|NA|类名:call<br>方法or属性:function rejectCall(callId: number, callback: AsyncCallback\<void>): void;|@ohos.telephony.call.d.ts| +|新增|NA|类名:call<br>方法or属性:function rejectCall(callId: number, options: RejectMessageOptions, callback: AsyncCallback\<void>): void;|@ohos.telephony.call.d.ts| +|新增|NA|类名:call<br>方法or属性:function rejectCall(callId?: number, options?: RejectMessageOptions): Promise\<void>;|@ohos.telephony.call.d.ts| +|新增|NA|类名:call<br>方法or属性:function rejectCall(callback: AsyncCallback\<void>): void;|@ohos.telephony.call.d.ts| +|新增|NA|类名:call<br>方法or属性:function rejectCall(options: RejectMessageOptions, callback: AsyncCallback\<void>): void;|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DialCallOptions|@ohos.telephony.call.d.ts| +|新增|NA|类名:DialCallOptions<br>方法or属性:|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DialCallOptions<br>方法 or 属性:accountId?: number;|@ohos.telephony.call.d.ts| +|新增|NA|类名:DialCallOptions<br>方法or属性:accountId?: number;|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DialCallOptions<br>方法 or 属性:videoState?: VideoStateType;|@ohos.telephony.call.d.ts| +|新增|NA|类名:DialCallOptions<br>方法or属性:videoState?: VideoStateType;|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DialCallOptions<br>方法 or 属性:dialScene?: DialScene;|@ohos.telephony.call.d.ts| +|新增|NA|类名:DialCallOptions<br>方法or属性:dialScene?: DialScene;|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DialCallOptions<br>方法 or 属性:dialType?: DialType;|@ohos.telephony.call.d.ts| +|新增|NA|类名:DialCallOptions<br>方法or属性:dialType?: DialType;|@ohos.telephony.call.d.ts| +|新增|NA|类名:radio<br>方法or属性:function isNRSupported(): boolean;|@ohos.telephony.radio.d.ts| +|新增|NA|类名:radio<br>方法or属性:function isNRSupported(slotId: number): boolean;|@ohos.telephony.radio.d.ts| +|新增|NA|模块名: ohos.telephony.radio<br>类名: SignalInformation<br>方法 or 属性:dBm: number;|@ohos.telephony.radio.d.ts| +|新增|NA|类名:SignalInformation<br>方法or属性:dBm: number;|@ohos.telephony.radio.d.ts| +|新增|NA|类名:OperatorConfigKey<br>方法or属性:KEY_IMS_CALL_DISCONNECT_REASON_INFO_MAPPING_STRING_ARRAY = "ims_call_disconnect_reason_info_mapping_string_array"|@ohos.telephony.sim.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:call<br>方法 or 属性:function answer(callId: number, callback: AsyncCallback\<void>): void;|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:call<br>方法 or 属性:function answer(callId?: number): Promise\<void>;|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:call<br>方法 or 属性:function answer(callback: AsyncCallback\<void>): void;|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:call<br>方法 or 属性:function hangup(callId: number, callback: AsyncCallback\<void>): void;|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:call<br>方法 or 属性:function hangup(callId?: number): Promise\<void>;|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:call<br>方法 or 属性:function hangup(callback: AsyncCallback\<void>): void;|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:call<br>方法 or 属性:function reject(callId: number, callback: AsyncCallback\<void>): void;|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:call<br>方法 or 属性:function reject(callId: number, options: RejectMessageOptions, callback: AsyncCallback\<void>): void;|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:call<br>方法 or 属性:function reject(callId?: number, options?: RejectMessageOptions): Promise\<void>;|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:call<br>方法 or 属性:function reject(callback: AsyncCallback\<void>): void;|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:call<br>方法 or 属性:function reject(options: RejectMessageOptions, callback: AsyncCallback\<void>): void;|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.sim<br>类名:OperatorConfigKey<br>方法 or 属性:KEY_IMS_CALL_DISCONNECT_REASONINFO_MAPPING_STRING_ARRAY = "ims_call_disconnect_reasoninfo_mapping_string_array"|NA|@ohos.telephony.sim.d.ts| +|废弃版本有变化|类名:call<br>方法 or 属性:function dial(phoneNumber: string, callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:call<br>方法 or 属性:function dial(phoneNumber: string, callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:telephony.call|@ohos.telephony.call.d.ts| +|废弃版本有变化|类名:call<br>方法 or 属性:function dial(phoneNumber: string, options: DialOptions, callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:call<br>方法 or 属性:function dial(phoneNumber: string, options: DialOptions, callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:telephony.call|@ohos.telephony.call.d.ts| +|废弃版本有变化|类名:call<br>方法 or 属性:function dial(phoneNumber: string, options?: DialOptions): Promise\<boolean>;<br>废弃版本:N/A|类名:call<br>方法 or 属性:function dial(phoneNumber: string, options?: DialOptions): Promise\<boolean>;<br>废弃版本:9<br>代替接口:telephony.call|@ohos.telephony.call.d.ts| +|废弃版本有变化|类名:radio<br>方法 or 属性:function isNrSupported(): boolean;<br>废弃版本:N/A|类名:radio<br>方法 or 属性:function isNrSupported(): boolean;<br>废弃版本:9<br>代替接口:telephony.radio|@ohos.telephony.radio.d.ts| +|废弃版本有变化|类名:radio<br>方法 or 属性:function isNrSupported(slotId: number): boolean;<br>废弃版本:N/A|类名:radio<br>方法 or 属性:function isNrSupported(slotId: number): boolean;<br>废弃版本:9<br>代替接口:telephony.radio|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function muteRinger(callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function muteRinger(): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function isEmergencyPhoneNumber(phoneNumber: string, callback: AsyncCallback\<boolean>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function isEmergencyPhoneNumber(phoneNumber: string, options: EmergencyNumberOptions, callback: AsyncCallback\<boolean>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function isEmergencyPhoneNumber(phoneNumber: string, options?: EmergencyNumberOptions): Promise\<boolean>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function formatPhoneNumber(phoneNumber: string, callback: AsyncCallback\<string>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function formatPhoneNumber(phoneNumber: string, options: NumberFormatOptions, callback: AsyncCallback\<string>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function formatPhoneNumber(phoneNumber: string, options?: NumberFormatOptions): Promise\<string>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function formatPhoneNumberToE164(phoneNumber: string, countryCode: string, callback: AsyncCallback\<string>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function formatPhoneNumberToE164(phoneNumber: string, countryCode: string): Promise\<string>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function holdCall(callId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function holdCall(callId: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function unHoldCall(callId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function unHoldCall(callId: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function switchCall(callId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function switchCall(callId: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function combineConference(callId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function combineConference(callId: number): Promise\<void>;<br>错误码内容: 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function getMainCallId(callId: number, callback: AsyncCallback\<number>): void;<br>错误码内容: 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function getMainCallId(callId: number): Promise\<number>;<br>错误码内容: 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function getSubCallIdList(callId: number, callback: AsyncCallback\<Array\<string>>): void;<br>错误码内容: 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function getSubCallIdList(callId: number): Promise\<Array\<string>>;<br>错误码内容: 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function getCallIdListForConference(callId: number, callback: AsyncCallback\<Array\<string>>): void;<br>错误码内容: 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function getCallIdListForConference(callId: number): Promise\<Array\<string>>;<br>错误码内容: 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function getCallWaitingStatus(slotId: number, callback: AsyncCallback\<CallWaitingStatus>): void;<br>错误码内容: 201, 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function getCallWaitingStatus(slotId: number): Promise\<CallWaitingStatus>;<br>错误码内容: 201, 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function setCallWaiting(slotId: number, activate: boolean, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function setCallWaiting(slotId: number, activate: boolean): Promise\<void>;<br>错误码内容: 201, 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function startDTMF(callId: number, character: string, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function startDTMF(callId: number, character: string): Promise\<void>;<br>错误码内容: 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function stopDTMF(callId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function stopDTMF(callId: number): Promise\<void>;<br>错误码内容: 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function isInEmergencyCall(callback: AsyncCallback\<boolean>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function isInEmergencyCall(): Promise\<boolean>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function on(type: 'callDetailsChange', callback: Callback\<CallAttributeOptions>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function off(type: 'callDetailsChange', callback?: Callback\<CallAttributeOptions>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function on(type: 'callEventChange', callback: Callback\<CallEventOptions>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function off(type: 'callEventChange', callback?: Callback\<CallEventOptions>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function on(type: 'callDisconnectedCause', callback: Callback\<DisconnectedDetails>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function off(type: 'callDisconnectedCause', callback?: Callback\<DisconnectedDetails>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function isNewCallAllowed(callback: AsyncCallback\<boolean>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function isNewCallAllowed(): Promise\<boolean>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function separateConference(callId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function separateConference(callId: number): Promise\<void>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function getCallRestrictionStatus(slotId: number, type: CallRestrictionType, callback: AsyncCallback\<RestrictionStatus>): void;<br>错误码内容: 201, 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function getCallRestrictionStatus(slotId: number, type: CallRestrictionType): Promise\<RestrictionStatus>;<br>错误码内容: 201, 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function setCallRestriction(slotId: number, info: CallRestrictionInfo, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function setCallRestriction(slotId: number, info: CallRestrictionInfo): Promise\<void>;<br>错误码内容: 201, 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function getCallTransferInfo(slotId: number, type: CallTransferType, callback: AsyncCallback\<CallTransferResult>): void;<br>错误码内容: 201, 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function getCallTransferInfo(slotId: number, type: CallTransferType): Promise\<CallTransferResult>;<br>错误码内容: 201, 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function setCallTransfer(slotId: number, info: CallTransferInfo, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function setCallTransfer(slotId: number, info: CallTransferInfo): Promise\<void>;<br>错误码内容: 201, 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function isRinging(callback: AsyncCallback\<boolean>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function isRinging(): Promise\<boolean>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function setMuted(callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function setMuted(): Promise\<void>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function cancelMuted(callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function cancelMuted(): Promise\<void>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function setAudioDevice(device: AudioDevice, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function setAudioDevice(device: AudioDevice, options: AudioDeviceOptions, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function setAudioDevice(device: AudioDevice, options?: AudioDeviceOptions): Promise\<void>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function joinConference(mainCallId: number, callNumberList: Array\<string>, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function joinConference(mainCallId: number, callNumberList: Array\<string>): Promise\<void>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function updateImsCallMode(callId: number, mode: ImsCallMode, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function updateImsCallMode(callId: number, mode: ImsCallMode): Promise\<void>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function enableImsSwitch(slotId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function enableImsSwitch(slotId: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function disableImsSwitch(slotId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function disableImsSwitch(slotId: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function isImsSwitchEnabled(slotId: number, callback: AsyncCallback\<boolean>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function isImsSwitchEnabled(slotId: number): Promise\<boolean>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:data<br>方法 or 属性:function setDefaultCellularDataSlotId(slotId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301001|@ohos.telephony.data.d.ts| +|新增(错误码)|NA|类名:data<br>方法 or 属性:function setDefaultCellularDataSlotId(slotId: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301001|@ohos.telephony.data.d.ts| +|新增(错误码)|NA|类名:data<br>方法 or 属性:function isCellularDataEnabled(callback: AsyncCallback\<boolean>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.data.d.ts| +|新增(错误码)|NA|类名:data<br>方法 or 属性:function isCellularDataEnabled(): Promise\<boolean>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.data.d.ts| +|新增(错误码)|NA|类名:data<br>方法 or 属性:function enableCellularData(callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.data.d.ts| +|新增(错误码)|NA|类名:data<br>方法 or 属性:function enableCellularData(): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.data.d.ts| +|新增(错误码)|NA|类名:data<br>方法 or 属性:function disableCellularData(callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.data.d.ts| +|新增(错误码)|NA|类名:data<br>方法 or 属性:function disableCellularData(): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.data.d.ts| +|新增(错误码)|NA|类名:data<br>方法 or 属性:function isCellularDataRoamingEnabled(slotId: number, callback: AsyncCallback\<boolean>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.data.d.ts| +|新增(错误码)|NA|类名:data<br>方法 or 属性:function isCellularDataRoamingEnabled(slotId: number): Promise\<boolean>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.data.d.ts| +|新增(错误码)|NA|类名:data<br>方法 or 属性:function enableCellularDataRoaming(slotId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.data.d.ts| +|新增(错误码)|NA|类名:data<br>方法 or 属性:function enableCellularDataRoaming(slotId: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.data.d.ts| +|新增(错误码)|NA|类名:data<br>方法 or 属性:function disableCellularDataRoaming(slotId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.data.d.ts| +|新增(错误码)|NA|类名:data<br>方法 or 属性:function disableCellularDataRoaming(slotId: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.data.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function on(type: 'networkStateChange', callback: Callback\<NetworkState>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function on(type: 'networkStateChange', options: { slotId: number }, callback: Callback\<NetworkState>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function off(type: 'networkStateChange', callback?: Callback\<NetworkState>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function on(type: 'signalInfoChange', callback: Callback\<Array\<SignalInformation>>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function on(type: 'signalInfoChange', options: { slotId: number },<br> callback: Callback\<Array\<SignalInformation>>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function off(type: 'signalInfoChange', callback?: Callback\<Array\<SignalInformation>>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function on(type: 'cellInfoChange', callback: Callback\<Array\<CellInformation>>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function on(type: 'cellInfoChange', options: { slotId: number },<br> callback: Callback\<Array\<CellInformation>>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function off(type: 'cellInfoChange', callback?: Callback\<Array\<CellInformation>>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function on(type: 'cellularDataConnectionStateChange',<br> callback: Callback\<{ state: DataConnectState, network: RatType }>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function on(type: 'cellularDataConnectionStateChange', options: { slotId: number },<br> callback: Callback\<{ state: DataConnectState, network: RatType }>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function off(type: 'cellularDataConnectionStateChange',<br> callback?: Callback\<{ state: DataConnectState, network: RatType }>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function on(type: 'cellularDataFlowChange', callback: Callback\<DataFlowType>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function on(type: 'cellularDataFlowChange', options: { slotId: number },<br> callback: Callback\<DataFlowType>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function off(type: 'cellularDataFlowChange', callback?: Callback\<DataFlowType>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function on(type: 'callStateChange', callback: Callback\<{ state: CallState, number: string }>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function on(type: 'callStateChange', options: { slotId: number },<br> callback: Callback\<{ state: CallState, number: string }>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function off(type: 'callStateChange', callback?: Callback\<{ state: CallState, number: string }>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function on(type: 'simStateChange', callback: Callback\<SimStateData>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function on(type: 'simStateChange', options: { slotId: number }, callback: Callback\<SimStateData>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function off(type: 'simStateChange', callback?: Callback\<SimStateData>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getRadioTech(slotId: number,<br> callback: AsyncCallback\<{psRadioTech: RadioTechnology, csRadioTech: RadioTechnology}>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getRadioTech(slotId: number): Promise\<{psRadioTech: RadioTechnology, csRadioTech: RadioTechnology}>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getNetworkState(callback: AsyncCallback\<NetworkState>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getNetworkState(slotId: number, callback: AsyncCallback\<NetworkState>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getNetworkState(slotId?: number): Promise\<NetworkState>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function sendUpdateCellLocationRequest(callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function sendUpdateCellLocationRequest(slotId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function sendUpdateCellLocationRequest(slotId?: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getCellInformation(callback: AsyncCallback\<Array\<CellInformation>>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getCellInformation(slotId: number, callback: AsyncCallback\<Array\<CellInformation>>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getCellInformation(slotId?: number): Promise\<Array\<CellInformation>>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getNetworkSelectionMode(slotId: number, callback: AsyncCallback\<NetworkSelectionMode>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getNetworkSelectionMode(slotId: number): Promise\<NetworkSelectionMode>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function setNetworkSelectionMode(options: NetworkSelectionModeOptions, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function setNetworkSelectionMode(options: NetworkSelectionModeOptions): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getNetworkSearchInformation(slotId: number, callback: AsyncCallback\<NetworkSearchResult>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getNetworkSearchInformation(slotId: number): Promise\<NetworkSearchResult>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getISOCountryCodeForNetwork(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getISOCountryCodeForNetwork(slotId: number): Promise\<string>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getNrOptionMode(callback: AsyncCallback\<NrOptionMode>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getNrOptionMode(slotId: number, callback: AsyncCallback\<NrOptionMode>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getNrOptionMode(slotId?: number): Promise\<NrOptionMode>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getIMEI(callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getIMEI(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getIMEI(slotId?: number): Promise\<string>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getMEID(callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getMEID(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getMEID(slotId?: number): Promise\<string>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getUniqueDeviceId(callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getUniqueDeviceId(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getUniqueDeviceId(slotId?: number): Promise\<string>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getPrimarySlotId(callback: AsyncCallback\<number>): void;<br>错误码内容: 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getPrimarySlotId(): Promise\<number>;<br>错误码内容: 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function setPrimarySlotId(slotId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function setPrimarySlotId(slotId: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getSignalInformation(slotId: number, callback: AsyncCallback\<Array\<SignalInformation>>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getSignalInformation(slotId: number): Promise\<Array\<SignalInformation>>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function isRadioOn(callback: AsyncCallback\<boolean>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function isRadioOn(slotId: number, callback: AsyncCallback\<boolean>): void<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function isRadioOn(slotId?: number): Promise\<boolean>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function turnOnRadio(callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function turnOnRadio(slotId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function turnOnRadio(slotId?: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function turnOffRadio(callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function turnOffRadio(slotId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function turnOffRadio(slotId?: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getOperatorName(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getOperatorName(slotId: number): Promise\<string>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function setPreferredNetwork(slotId: number, networkMode: PreferredNetworkMode, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function setPreferredNetwork(slotId: number, networkMode: PreferredNetworkMode): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getPreferredNetwork(slotId: number, callback: AsyncCallback\<PreferredNetworkMode>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getPreferredNetwork(slotId: number): Promise\<PreferredNetworkMode>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function hasOperatorPrivileges(slotId: number, callback: AsyncCallback\<boolean>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function hasOperatorPrivileges(slotId: number): Promise\<boolean>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getISOCountryCodeForSim(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getISOCountryCodeForSim(slotId: number): Promise\<string>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getSimOperatorNumeric(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getSimOperatorNumeric(slotId: number): Promise\<string>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getSimSpn(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getSimSpn(slotId: number): Promise\<string>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getSimState(slotId: number, callback: AsyncCallback\<SimState>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getSimState(slotId: number): Promise\<SimState>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getCardType(slotId: number, callback: AsyncCallback\<CardType>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getCardType(slotId: number): Promise\<CardType>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getSimIccId(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getSimIccId(slotId: number): Promise\<string>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getVoiceMailIdentifier(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getVoiceMailIdentifier(slotId: number): Promise\<string>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getVoiceMailNumber(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getVoiceMailNumber(slotId: number): Promise\<string>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function setVoiceMailInfo(slotId: number, mailName: string, mailNumber: string, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function setVoiceMailInfo(slotId: number, mailName: string, mailNumber: string): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getSimTelephoneNumber(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getSimTelephoneNumber(slotId: number): Promise\<string>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getSimGid1(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getSimGid1(slotId: number): Promise\<string>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getIMSI(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getIMSI(slotId: number): Promise\<string>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function hasSimCard(slotId: number, callback: AsyncCallback\<boolean>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function hasSimCard(slotId: number): Promise\<boolean>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getSimAccountInfo(slotId: number, callback: AsyncCallback\<IccAccountInfo>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getSimAccountInfo(slotId: number): Promise\<IccAccountInfo>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getActiveSimAccountInfoList(callback: AsyncCallback\<Array\<IccAccountInfo>>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getActiveSimAccountInfoList(): Promise\<Array\<IccAccountInfo>>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function setDefaultVoiceSlotId(slotId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301001|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function setDefaultVoiceSlotId(slotId: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301001|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function activateSim(slotId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function activateSim(slotId: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function deactivateSim(slotId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function deactivateSim(slotId: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function setShowName(slotId: number, name: string, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function setShowName(slotId: number, name: string): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getShowName(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getShowName(slotId: number): Promise\<string>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function setShowNumber(slotId: number, number: string, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function setShowNumber(slotId: number, number: string): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getShowNumber(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getShowNumber(slotId: number): Promise\<string>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getOperatorConfigs(slotId: number, callback: AsyncCallback\<Array\<OperatorConfig>>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getOperatorConfigs(slotId: number): Promise\<Array\<OperatorConfig>>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function unlockPin(slotId: number, pin: string, callback: AsyncCallback\<LockStatusResponse>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function unlockPin(slotId: number, pin: string): Promise\<LockStatusResponse>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function unlockPuk(slotId: number, newPin: string, puk: string, callback: AsyncCallback\<LockStatusResponse>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function unlockPuk(slotId: number, newPin: string, puk: string): Promise\<LockStatusResponse>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function alterPin(slotId: number, newPin: string, oldPin: string, callback: AsyncCallback\<LockStatusResponse>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function alterPin(slotId: number, newPin: string, oldPin: string): Promise\<LockStatusResponse>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function setLockState(slotId: number, options: LockInfo, callback: AsyncCallback\<LockStatusResponse>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function setLockState(slotId: number, options: LockInfo): Promise\<LockStatusResponse>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function unlockPin2(slotId: number, pin2: string, callback: AsyncCallback\<LockStatusResponse>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function unlockPin2(slotId: number, pin2: string): Promise\<LockStatusResponse>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function unlockPuk2(slotId: number, newPin2: string, puk2: string, callback: AsyncCallback\<LockStatusResponse>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function unlockPuk2(slotId: number, newPin2: string, puk2: string): Promise\<LockStatusResponse>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function alterPin2(slotId: number, newPin2: string, oldPin2: string, callback: AsyncCallback\<LockStatusResponse>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function alterPin2(slotId: number, newPin2: string, oldPin2: string): Promise\<LockStatusResponse>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function queryIccDiallingNumbers(slotId: number, type: ContactType, callback: AsyncCallback\<Array\<DiallingNumbersInfo>>): void<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function queryIccDiallingNumbers(slotId: number, type: ContactType): Promise\<Array\<DiallingNumbersInfo>>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function addIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function addIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function delIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function delIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function updateIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function updateIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getLockState(slotId: number, lockType: LockType, callback: AsyncCallback\<LockState>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getLockState(slotId: number, lockType: LockType): Promise\<LockState>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function sendEnvelopeCmd(slotId: number, cmd: string, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function sendEnvelopeCmd(slotId: number, cmd: string): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function sendTerminalResponseCmd(slotId: number, cmd: string, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function sendTerminalResponseCmd(slotId: number, cmd: string): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function unlockSimLock(slotId: number, lockInfo: PersoLockInfo, callback: AsyncCallback\<LockStatusResponse>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function unlockSimLock(slotId: number, lockInfo: PersoLockInfo): Promise\<LockStatusResponse>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function splitMessage(content: string, callback: AsyncCallback\<Array\<string>>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function splitMessage(content: string): Promise\<Array\<string>>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function createMessage(pdu: Array\<number>, specification: string, callback: AsyncCallback\<ShortMessage>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function createMessage(pdu: Array\<number>, specification: string): Promise\<ShortMessage>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function sendMessage(options: SendMessageOptions): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function setDefaultSmsSlotId(slotId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function setDefaultSmsSlotId(slotId: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function setSmscAddr(slotId: number, smscAddr: string, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function setSmscAddr(slotId: number, smscAddr: string): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function getSmscAddr(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function getSmscAddr(slotId: number): Promise\<string>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function addSimMessage(options: SimMessageOptions, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function addSimMessage(options: SimMessageOptions): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function delSimMessage(slotId: number, msgIndex: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function delSimMessage(slotId: number, msgIndex: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function updateSimMessage(options: UpdateSimMessageOptions, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function updateSimMessage(options: UpdateSimMessageOptions): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function getAllSimMessages(slotId: number, callback: AsyncCallback\<Array\<SimShortMessage>>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function getAllSimMessages(slotId: number): Promise\<Array\<SimShortMessage>>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function setCBConfig(options: CBConfigOptions, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function setCBConfig(options: CBConfigOptions): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function getSmsSegmentsInfo(slotId: number, message: string, force7bit: boolean, callback: AsyncCallback\<SmsSegmentsInfo>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function getSmsSegmentsInfo(slotId: number, message: string, force7bit: boolean): Promise\<SmsSegmentsInfo>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function isImsSmsSupported(slotId: number, callback: AsyncCallback\<boolean>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function isImsSmsSupported(slotId: number): Promise\<boolean>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function getImsShortMessageFormat(callback: AsyncCallback\<string>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function getImsShortMessageFormat(): Promise\<string>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function decodeMms(mmsFilePathName: string \| Array\<number>, callback: AsyncCallback\<MmsInformation>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function decodeMms(mmsFilePathName: string \| Array\<number>): Promise\<MmsInformation>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function encodeMms(mms: MmsInformation, callback: AsyncCallback\<Array\<number>>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function encodeMms(mms: MmsInformation): Promise\<Array\<number>>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| diff --git a/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-unitest.md b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-unitest.md new file mode 100644 index 0000000000000000000000000000000000000000..a2d55913fbf4930d37e2bfb13cda8c287849611f --- /dev/null +++ b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-unitest.md @@ -0,0 +1,328 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.UiTest<br>类名: MatchPattern|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: MatchPattern<br>方法 or 属性: EQUALS = 0|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: MatchPattern<br>方法 or 属性: CONTAINS = 1|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: MatchPattern<br>方法 or 属性: STARTS_WITH = 2|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: MatchPattern<br>方法 or 属性: ENDS_WITH = 3|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: By|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: By<br>方法 or 属性: text(txt: string, pattern?: MatchPattern): By;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: By<br>方法 or 属性: key(key: string): By;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: By<br>方法 or 属性: id(id: number): By;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: By<br>方法 or 属性: type(tp: string): By;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: By<br>方法 or 属性: clickable(b?: boolean): By;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: By<br>方法 or 属性: scrollable(b?: boolean): By;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: By<br>方法 or 属性: enabled(b?: boolean): By;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: By<br>方法 or 属性: focused(b?: boolean): By;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: By<br>方法 or 属性: selected(b?: boolean): By;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: By<br>方法 or 属性: isBefore(by: By): By;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: By<br>方法 or 属性: isAfter(by: By): By;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiComponent|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiComponent<br>方法 or 属性: click(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiComponent<br>方法 or 属性: doubleClick(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiComponent<br>方法 or 属性: longClick(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiComponent<br>方法 or 属性: getId(): Promise\<number>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiComponent<br>方法 or 属性: getKey(): Promise\<string>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiComponent<br>方法 or 属性: getText(): Promise\<string>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiComponent<br>方法 or 属性: getType(): Promise\<string>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiComponent<br>方法 or 属性: isClickable(): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiComponent<br>方法 or 属性: isScrollable(): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiComponent<br>方法 or 属性: isEnabled(): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiComponent<br>方法 or 属性: isFocused(): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiComponent<br>方法 or 属性: isSelected(): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiComponent<br>方法 or 属性: inputText(text: string): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiComponent<br>方法 or 属性: scrollSearch(by: By): Promise\<UiComponent>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiDriver|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiDriver<br>方法 or 属性: static create(): UiDriver;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiDriver<br>方法 or 属性: delayMs(duration: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiDriver<br>方法 or 属性: findComponent(by: By): Promise\<UiComponent>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiDriver<br>方法 or 属性: findComponents(by: By): Promise\<Array\<UiComponent>>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiDriver<br>方法 or 属性: assertComponentExist(by: By): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiDriver<br>方法 or 属性: pressBack(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiDriver<br>方法 or 属性: triggerKey(keyCode: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiDriver<br>方法 or 属性: click(x: number, y: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiDriver<br>方法 or 属性: doubleClick(x: number, y: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiDriver<br>方法 or 属性: longClick(x: number, y: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiDriver<br>方法 or 属性: swipe(startx: number, starty: number, endx: number, endy: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiDriver<br>方法 or 属性: screenCap(savePath: string): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: WindowMode|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: WindowMode<br>方法 or 属性: FULLSCREEN = 0|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: WindowMode<br>方法 or 属性: PRIMARY = 1|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: WindowMode<br>方法 or 属性: SECONDARY = 2|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: WindowMode<br>方法 or 属性: FLOATING = 3|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: ResizeDirection|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: ResizeDirection<br>方法 or 属性: LEFT = 0|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: ResizeDirection<br>方法 or 属性: RIGHT = 1|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: ResizeDirection<br>方法 or 属性: UP = 2|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: ResizeDirection<br>方法 or 属性: DOWN = 3|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: ResizeDirection<br>方法 or 属性: LEFT_UP = 4|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: ResizeDirection<br>方法 or 属性: LEFT_DOWN = 5|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: ResizeDirection<br>方法 or 属性: RIGHT_UP = 6|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: ResizeDirection<br>方法 or 属性: RIGHT_DOWN = 7|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: DisplayRotation|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: DisplayRotation<br>方法 or 属性: ROTATION_0 = 0|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: DisplayRotation<br>方法 or 属性: ROTATION_90 = 1|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: DisplayRotation<br>方法 or 属性: ROTATION_180 = 2|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: DisplayRotation<br>方法 or 属性: ROTATION_270 = 3|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Point|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Point<br>方法 or 属性: readonly x: number;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Point<br>方法 or 属性: readonly y: number;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Rect|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Rect<br>方法 or 属性: readonly left: number;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Rect<br>方法 or 属性: readonly top: number;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Rect<br>方法 or 属性: readonly right: number;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Rect<br>方法 or 属性: readonly bottom: number;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: WindowFilter|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: WindowFilter<br>方法 or 属性: bundleName?: string;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: WindowFilter<br>方法 or 属性: title?: string;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: WindowFilter<br>方法 or 属性: focused?: boolean;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: WindowFilter<br>方法 or 属性: actived?: boolean;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: On|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: On<br>方法 or 属性: text(txt: string, pattern?: MatchPattern): On;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: On<br>方法 or 属性: id(id: string): On;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: On<br>方法 or 属性: type(tp: string): On;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: On<br>方法 or 属性: clickable(b?: boolean): On;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: On<br>方法 or 属性: longClickable(b?: boolean): On;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: On<br>方法 or 属性: scrollable(b?: boolean): On;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: On<br>方法 or 属性: enabled(b?: boolean): On;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: On<br>方法 or 属性: focused(b?: boolean): On;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: On<br>方法 or 属性: selected(b?: boolean): On;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: On<br>方法 or 属性: checked(b?: boolean): On;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: On<br>方法 or 属性: checkable(b?: boolean): On;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: On<br>方法 or 属性: isBefore(on: On): On;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: On<br>方法 or 属性: isAfter(on: On): On;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: click(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: doubleClick(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: longClick(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: getId(): Promise\<string>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: getText(): Promise\<string>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: getType(): Promise\<string>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: isClickable(): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: isLongClickable(): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: isScrollable(): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: isEnabled(): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: isFocused(): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: isSelected(): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: isChecked(): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: isCheckable(): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: inputText(text: string): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: clearText(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: scrollToTop(speed?: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: scrollToBottom(speed?: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: scrollSearch(on: On): Promise\<Component>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: getBounds(): Promise\<Rect>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: getBoundsCenter(): Promise\<Point>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: dragTo(target: Component): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: pinchOut(scale: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: pinchIn(scale: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: static create(): Driver;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: delayMs(duration: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: findComponent(on: On): Promise\<Component>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: findWindow(filter: WindowFilter): Promise\<UiWindow>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: waitForComponent(on: On, time: number): Promise\<Component>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: findComponents(on: On): Promise\<Array\<Component>>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: assertComponentExist(on: On): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: pressBack(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: triggerKey(keyCode: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: triggerCombineKeys(key0: number, key1: number, key2?: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: click(x: number, y: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: doubleClick(x: number, y: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: longClick(x: number, y: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: swipe(startx: number, starty: number, endx: number, endy: number, speed?: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: drag(startx: number, starty: number, endx: number, endy: number, speed?: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: screenCap(savePath: string): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: setDisplayRotation(rotation: DisplayRotation): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: getDisplayRotation(): Promise\<DisplayRotation>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: setDisplayRotationEnabled(enabled: boolean): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: getDisplaySize(): Promise\<Point>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: getDisplayDensity(): Promise\<Point>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: wakeUpDisplay(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: pressHome(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: waitForIdle(idleTime: number, timeout: number): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: fling(from: Point, to: Point, stepLen: number, speed: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: injectMultiPointerAction(pointers: PointerMatrix, speed?: number): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiWindow|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiWindow<br>方法 or 属性: getBundleName(): Promise\<string>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiWindow<br>方法 or 属性: getBounds(): Promise\<Rect>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiWindow<br>方法 or 属性: getTitle(): Promise\<string>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiWindow<br>方法 or 属性: getWindowMode(): Promise\<WindowMode>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiWindow<br>方法 or 属性: isFocused(): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiWindow<br>方法 or 属性: isActived(): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiWindow<br>方法 or 属性: focus(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiWindow<br>方法 or 属性: moveTo(x: number, y: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiWindow<br>方法 or 属性: resize(wide: number, height: number, direction: ResizeDirection): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiWindow<br>方法 or 属性: split(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiWindow<br>方法 or 属性: maximize(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiWindow<br>方法 or 属性: minimize(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiWindow<br>方法 or 属性: resume(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiWindow<br>方法 or 属性: close(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: PointerMatrix|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: PointerMatrix<br>方法 or 属性: static create(fingers: number, steps: number): PointerMatrix;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: PointerMatrix<br>方法 or 属性: setPoint(finger: number, step: number, point: Point): void;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: global<br>方法 or 属性: declare const BY: By;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: global<br>方法 or 属性: declare const ON: On;|@ohos.UiTest.d.ts| +|删除|模块名: ohos.uitest<br>类名: MatchPattern|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: MatchPattern<br>方法 or 属性:EQUALS = 0|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: MatchPattern<br>方法 or 属性:CONTAINS = 1|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: MatchPattern<br>方法 or 属性:STARTS_WITH = 2|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: MatchPattern<br>方法 or 属性:ENDS_WITH = 3|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: By|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: By<br>方法 or 属性:text(txt: string, pattern?: MatchPattern): By;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: By<br>方法 or 属性:key(key: string): By;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: By<br>方法 or 属性:id(id: number): By;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: By<br>方法 or 属性:type(tp: string): By;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: By<br>方法 or 属性:clickable(b?: boolean): By;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: By<br>方法 or 属性:scrollable(b?: boolean): By;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: By<br>方法 or 属性:enabled(b?: boolean): By;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: By<br>方法 or 属性:focused(b?: boolean): By;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: By<br>方法 or 属性:selected(b?: boolean): By;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: By<br>方法 or 属性:isBefore(by: By): By;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: By<br>方法 or 属性:isAfter(by: By): By;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiComponent|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiComponent<br>方法 or 属性:click(): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiComponent<br>方法 or 属性:doubleClick(): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiComponent<br>方法 or 属性:longClick(): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiComponent<br>方法 or 属性:getId(): Promise\<number>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiComponent<br>方法 or 属性:getKey(): Promise\<string>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiComponent<br>方法 or 属性:getText(): Promise\<string>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiComponent<br>方法 or 属性:getType(): Promise\<string>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiComponent<br>方法 or 属性:isClickable(): Promise\<boolean>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiComponent<br>方法 or 属性:isScrollable(): Promise\<boolean>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiComponent<br>方法 or 属性:isEnabled(): Promise\<boolean>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiComponent<br>方法 or 属性:isFocused(): Promise\<boolean>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiComponent<br>方法 or 属性:isSelected(): Promise\<boolean>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiComponent<br>方法 or 属性:inputText(text: string): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiComponent<br>方法 or 属性:scrollSearch(by: By): Promise\<UiComponent>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiDriver|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiDriver<br>方法 or 属性:static create(): UiDriver;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiDriver<br>方法 or 属性:delayMs(duration: number): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiDriver<br>方法 or 属性:findComponent(by: By): Promise\<UiComponent>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiDriver<br>方法 or 属性:findComponents(by: By): Promise\<Array\<UiComponent>>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiDriver<br>方法 or 属性:assertComponentExist(by: By): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiDriver<br>方法 or 属性:pressBack(): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiDriver<br>方法 or 属性:triggerKey(keyCode: number): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiDriver<br>方法 or 属性:click(x: number, y: number): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiDriver<br>方法 or 属性:doubleClick(x: number, y: number): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiDriver<br>方法 or 属性:longClick(x: number, y: number): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiDriver<br>方法 or 属性:swipe(startx: number, starty: number, endx: number, endy: number): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiDriver<br>方法 or 属性:screenCap(savePath: string): Promise\<boolean>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: WindowMode|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: WindowMode<br>方法 or 属性:FULLSCREEN|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: WindowMode<br>方法 or 属性:PRIMARY|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: WindowMode<br>方法 or 属性:SECONDARY|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: WindowMode<br>方法 or 属性:FLOATING|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: ResizeDirection|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: ResizeDirection<br>方法 or 属性:LEFT|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: ResizeDirection<br>方法 or 属性:RIGHT|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: ResizeDirection<br>方法 or 属性:UP|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: ResizeDirection<br>方法 or 属性:DOWN|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: ResizeDirection<br>方法 or 属性:LEFT_UP|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: ResizeDirection<br>方法 or 属性:LEFT_DOWN|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: ResizeDirection<br>方法 or 属性:RIGHT_UP|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: ResizeDirection<br>方法 or 属性:RIGHT_DOWN|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: DisplayRotation|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: DisplayRotation<br>方法 or 属性:ROTATION_0|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: DisplayRotation<br>方法 or 属性:ROTATION_90|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: DisplayRotation<br>方法 or 属性:ROTATION_180|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: DisplayRotation<br>方法 or 属性:ROTATION_270|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Point|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Point<br>方法 or 属性:readonly X: number;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Point<br>方法 or 属性:readonly Y: number;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Rect|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Rect<br>方法 or 属性:readonly left: number;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Rect<br>方法 or 属性:readonly top: number;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Rect<br>方法 or 属性:readonly right: number;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Rect<br>方法 or 属性:readonly bottom: number;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: WindowFilter|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: WindowFilter<br>方法 or 属性:bundleName?: string;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: WindowFilter<br>方法 or 属性:title?: string;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: WindowFilter<br>方法 or 属性:focused?: boolean;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: WindowFilter<br>方法 or 属性:actived?: boolean;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: On|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: On<br>方法 or 属性:text(txt: string, pattern?: MatchPattern): On;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: On<br>方法 or 属性:id(id: string): On;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: On<br>方法 or 属性:type(tp: string): On;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: On<br>方法 or 属性:clickable(b?: boolean): On;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: On<br>方法 or 属性:longClickable(b?: boolean): On;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: On<br>方法 or 属性:scrollable(b?: boolean): On;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: On<br>方法 or 属性:enabled(b?: boolean): On;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: On<br>方法 or 属性:focused(b?: boolean): On;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: On<br>方法 or 属性:selected(b?: boolean): On;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: On<br>方法 or 属性:checked(b?: boolean): On;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: On<br>方法 or 属性:checkable(b?: boolean): On;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: On<br>方法 or 属性:isBefore(on: On): On;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: On<br>方法 or 属性:isAfter(on: On): On;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Component|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Component<br>方法 or 属性:click(): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Component<br>方法 or 属性:doubleClick(): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Component<br>方法 or 属性:longClick(): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Component<br>方法 or 属性:getId(): Promise\<string>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Component<br>方法 or 属性:getText(): Promise\<string>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Component<br>方法 or 属性:getType(): Promise\<string>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Component<br>方法 or 属性:isClickable(): Promise\<boolean>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Component<br>方法 or 属性:isLongClickable(): Promise\<boolean>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Component<br>方法 or 属性:isScrollable(): Promise\<boolean>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Component<br>方法 or 属性:isEnabled(): Promise\<boolean>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Component<br>方法 or 属性:isFocused(): Promise\<boolean>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Component<br>方法 or 属性:isSelected(): Promise\<boolean>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Component<br>方法 or 属性:isChecked(): Promise\<boolean>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Component<br>方法 or 属性:isCheckable(): Promise\<boolean>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Component<br>方法 or 属性:inputText(text: string): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Component<br>方法 or 属性:clearText(): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Component<br>方法 or 属性:scrollToTop(speed?: number): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Component<br>方法 or 属性:scrollToBottom(speed?: number): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Component<br>方法 or 属性:scrollSearch(on: On): Promise\<Component>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Component<br>方法 or 属性:getBounds(): Promise\<Rect>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Component<br>方法 or 属性:getBoundsCenter(): Promise\<Point>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Component<br>方法 or 属性:dragTo(target: Component): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Component<br>方法 or 属性:pinchOut(scale: number): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Component<br>方法 or 属性:pinchIn(scale: number): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Driver|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Driver<br>方法 or 属性:static create(): Driver;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Driver<br>方法 or 属性:delayMs(duration: number): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Driver<br>方法 or 属性:findComponent(on: On): Promise\<Component>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Driver<br>方法 or 属性:findWindow(filter: WindowFilter): Promise\<UiWindow>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Driver<br>方法 or 属性:waitForComponent(on: On, time: number): Promise\<Component>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Driver<br>方法 or 属性:findComponents(on: On): Promise\<Array\<Component>>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Driver<br>方法 or 属性:assertComponentExist(on: On): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Driver<br>方法 or 属性:pressBack(): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Driver<br>方法 or 属性:triggerKey(keyCode: number): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Driver<br>方法 or 属性:triggerCombineKeys(key0: number, key1: number, key2?: number): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Driver<br>方法 or 属性:click(x: number, y: number): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Driver<br>方法 or 属性:doubleClick(x: number, y: number): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Driver<br>方法 or 属性:longClick(x: number, y: number): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Driver<br>方法 or 属性:swipe(startx: number, starty: number, endx: number, endy: number, speed?: number): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Driver<br>方法 or 属性:drag(startx: number, starty: number, endx: number, endy: number, speed?: number): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Driver<br>方法 or 属性:screenCap(savePath: string): Promise\<boolean>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Driver<br>方法 or 属性:setDisplayRotation(rotation: DisplayRotation): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Driver<br>方法 or 属性:getDisplayRotation(): Promise\<DisplayRotation>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Driver<br>方法 or 属性:setDisplayRotationEnabled(enabled: boolean): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Driver<br>方法 or 属性:getDisplaySize(): Promise\<Point>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Driver<br>方法 or 属性:getDisplayDensity(): Promise\<Point>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Driver<br>方法 or 属性:wakeUpDisplay(): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Driver<br>方法 or 属性:pressHome(): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Driver<br>方法 or 属性:waitForIdle(idleTime: number, timeout: number): Promise\<boolean>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Driver<br>方法 or 属性:fling(from: Point, to: Point, stepLen: number, speed: number): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: Driver<br>方法 or 属性:injectMultiPointerAction(pointers: PointerMatrix, speed?: number): Promise\<boolean>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiWindow|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiWindow<br>方法 or 属性:getBundleName(): Promise\<string>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiWindow<br>方法 or 属性:getBounds(): Promise\<Rect>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiWindow<br>方法 or 属性:getTitle(): Promise\<string>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiWindow<br>方法 or 属性:getWindowMode(): Promise\<WindowMode>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiWindow<br>方法 or 属性:isFocused(): Promise\<boolean>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiWindow<br>方法 or 属性:isActived(): Promise\<boolean>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiWindow<br>方法 or 属性:focus(): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiWindow<br>方法 or 属性:moveTo(x: number, y: number): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiWindow<br>方法 or 属性:resize(wide: number, height: number, direction: ResizeDirection): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiWindow<br>方法 or 属性:split(): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiWindow<br>方法 or 属性:maximize(): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiWindow<br>方法 or 属性:minimize(): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiWindow<br>方法 or 属性:resume(): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiWindow<br>方法 or 属性:close(): Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: PointerMatrix|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: PointerMatrix<br>方法 or 属性:static create(fingers: number, steps: number): PointerMatrix;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: PointerMatrix<br>方法 or 属性:setPoint(finger: number, step: number, point: Point): void;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: global<br>方法 or 属性:declare const BY: By;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: global<br>方法 or 属性:declare const ON: On;|NA|@ohos.uitest.d.ts| diff --git a/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-update.md b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-update.md new file mode 100644 index 0000000000000000000000000000000000000000..aae4e5cc528ffac2d6ce318ff52b44551d9e81ef --- /dev/null +++ b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-update.md @@ -0,0 +1,53 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|起始版本有变化|类名:UpgradeTaskCallback<br>方法 or 属性:(eventInfo: EventInfo): void;<br>起始版本:N/A|类名:UpgradeTaskCallback<br>方法 or 属性:(eventInfo: EventInfo): void;<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:BusinessVendor<br>方法 or 属性:PUBLIC = "public"<br>起始版本:N/A|类名:BusinessVendor<br>方法 or 属性:PUBLIC = "public"<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:BusinessSubType<br>方法 or 属性:FIRMWARE = 1<br>起始版本:N/A|类名:BusinessSubType<br>方法 or 属性:FIRMWARE = 1<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:ComponentType<br>方法 or 属性:OTA = 1<br>起始版本:N/A|类名:ComponentType<br>方法 or 属性:OTA = 1<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:UpgradeAction<br>方法 or 属性:UPGRADE = "upgrade"<br>起始版本:N/A|类名:UpgradeAction<br>方法 or 属性:UPGRADE = "upgrade"<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:UpgradeAction<br>方法 or 属性:RECOVERY = "recovery"<br>起始版本:N/A|类名:UpgradeAction<br>方法 or 属性:RECOVERY = "recovery"<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:EffectiveMode<br>方法 or 属性:COLD = 1<br>起始版本:N/A|类名:EffectiveMode<br>方法 or 属性:COLD = 1<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:EffectiveMode<br>方法 or 属性:LIVE = 2<br>起始版本:N/A|类名:EffectiveMode<br>方法 or 属性:LIVE = 2<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:EffectiveMode<br>方法 or 属性:LIVE_AND_COLD = 3<br>起始版本:N/A|类名:EffectiveMode<br>方法 or 属性:LIVE_AND_COLD = 3<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:DescriptionType<br>方法 or 属性:CONTENT = 0<br>起始版本:N/A|类名:DescriptionType<br>方法 or 属性:CONTENT = 0<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:DescriptionType<br>方法 or 属性:URI = 1<br>起始版本:N/A|类名:DescriptionType<br>方法 or 属性:URI = 1<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:DescriptionFormat<br>方法 or 属性:STANDARD = 0<br>起始版本:N/A|类名:DescriptionFormat<br>方法 or 属性:STANDARD = 0<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:DescriptionFormat<br>方法 or 属性:SIMPLIFIED = 1<br>起始版本:N/A|类名:DescriptionFormat<br>方法 or 属性:SIMPLIFIED = 1<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:NetType<br>方法 or 属性:CELLULAR = 1<br>起始版本:N/A|类名:NetType<br>方法 or 属性:CELLULAR = 1<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:NetType<br>方法 or 属性:METERED_WIFI = 2<br>起始版本:N/A|类名:NetType<br>方法 or 属性:METERED_WIFI = 2<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:NetType<br>方法 or 属性:NOT_METERED_WIFI = 4<br>起始版本:N/A|类名:NetType<br>方法 or 属性:NOT_METERED_WIFI = 4<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:NetType<br>方法 or 属性:WIFI = 6<br>起始版本:N/A|类名:NetType<br>方法 or 属性:WIFI = 6<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:NetType<br>方法 or 属性:CELLULAR_AND_WIFI = 7<br>起始版本:N/A|类名:NetType<br>方法 or 属性:CELLULAR_AND_WIFI = 7<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:Order<br>方法 or 属性:DOWNLOAD = 1<br>起始版本:N/A|类名:Order<br>方法 or 属性:DOWNLOAD = 1<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:Order<br>方法 or 属性:INSTALL = 2<br>起始版本:N/A|类名:Order<br>方法 or 属性:INSTALL = 2<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:Order<br>方法 or 属性:DOWNLOAD_AND_INSTALL = 3<br>起始版本:N/A|类名:Order<br>方法 or 属性:DOWNLOAD_AND_INSTALL = 3<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:Order<br>方法 or 属性:APPLY = 4<br>起始版本:N/A|类名:Order<br>方法 or 属性:APPLY = 4<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:Order<br>方法 or 属性:INSTALL_AND_APPLY = 6<br>起始版本:N/A|类名:Order<br>方法 or 属性:INSTALL_AND_APPLY = 6<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:UpgradeStatus<br>方法 or 属性:WAITING_DOWNLOAD = 20<br>起始版本:N/A|类名:UpgradeStatus<br>方法 or 属性:WAITING_DOWNLOAD = 20<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:UpgradeStatus<br>方法 or 属性:DOWNLOADING = 21<br>起始版本:N/A|类名:UpgradeStatus<br>方法 or 属性:DOWNLOADING = 21<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:UpgradeStatus<br>方法 or 属性:DOWNLOAD_PAUSED = 22<br>起始版本:N/A|类名:UpgradeStatus<br>方法 or 属性:DOWNLOAD_PAUSED = 22<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:UpgradeStatus<br>方法 or 属性:DOWNLOAD_FAIL = 23<br>起始版本:N/A|类名:UpgradeStatus<br>方法 or 属性:DOWNLOAD_FAIL = 23<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:UpgradeStatus<br>方法 or 属性:WAITING_INSTALL = 30<br>起始版本:N/A|类名:UpgradeStatus<br>方法 or 属性:WAITING_INSTALL = 30<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:UpgradeStatus<br>方法 or 属性:UPDATING = 31<br>起始版本:N/A|类名:UpgradeStatus<br>方法 or 属性:UPDATING = 31<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:UpgradeStatus<br>方法 or 属性:WAITING_APPLY = 40<br>起始版本:N/A|类名:UpgradeStatus<br>方法 or 属性:WAITING_APPLY = 40<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:UpgradeStatus<br>方法 or 属性:APPLYING = 41<br>起始版本:N/A|类名:UpgradeStatus<br>方法 or 属性:APPLYING = 41<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:UpgradeStatus<br>方法 or 属性:UPGRADE_SUCCESS = 50<br>起始版本:N/A|类名:UpgradeStatus<br>方法 or 属性:UPGRADE_SUCCESS = 50<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:UpgradeStatus<br>方法 or 属性:UPGRADE_FAIL = 51<br>起始版本:N/A|类名:UpgradeStatus<br>方法 or 属性:UPGRADE_FAIL = 51<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:EventClassify<br>方法 or 属性:TASK = 0x01000000<br>起始版本:N/A|类名:EventClassify<br>方法 or 属性:TASK = 0x01000000<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:EventId<br>方法 or 属性:EVENT_TASK_BASE = EventClassify.TASK<br>起始版本:N/A|类名:EventId<br>方法 or 属性:EVENT_TASK_BASE = EventClassify.TASK<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:EventId<br>方法 or 属性:EVENT_TASK_RECEIVE<br>起始版本:N/A|类名:EventId<br>方法 or 属性:EVENT_TASK_RECEIVE<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:EventId<br>方法 or 属性:EVENT_TASK_CANCEL<br>起始版本:N/A|类名:EventId<br>方法 or 属性:EVENT_TASK_CANCEL<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:EventId<br>方法 or 属性:EVENT_DOWNLOAD_WAIT<br>起始版本:N/A|类名:EventId<br>方法 or 属性:EVENT_DOWNLOAD_WAIT<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:EventId<br>方法 or 属性:EVENT_DOWNLOAD_START<br>起始版本:N/A|类名:EventId<br>方法 or 属性:EVENT_DOWNLOAD_START<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:EventId<br>方法 or 属性:EVENT_DOWNLOAD_UPDATE<br>起始版本:N/A|类名:EventId<br>方法 or 属性:EVENT_DOWNLOAD_UPDATE<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:EventId<br>方法 or 属性:EVENT_DOWNLOAD_PAUSE<br>起始版本:N/A|类名:EventId<br>方法 or 属性:EVENT_DOWNLOAD_PAUSE<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:EventId<br>方法 or 属性:EVENT_DOWNLOAD_RESUME<br>起始版本:N/A|类名:EventId<br>方法 or 属性:EVENT_DOWNLOAD_RESUME<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:EventId<br>方法 or 属性:EVENT_DOWNLOAD_SUCCESS<br>起始版本:N/A|类名:EventId<br>方法 or 属性:EVENT_DOWNLOAD_SUCCESS<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:EventId<br>方法 or 属性:EVENT_DOWNLOAD_FAIL<br>起始版本:N/A|类名:EventId<br>方法 or 属性:EVENT_DOWNLOAD_FAIL<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:EventId<br>方法 or 属性:EVENT_UPGRADE_WAIT<br>起始版本:N/A|类名:EventId<br>方法 or 属性:EVENT_UPGRADE_WAIT<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:EventId<br>方法 or 属性:EVENT_UPGRADE_START<br>起始版本:N/A|类名:EventId<br>方法 or 属性:EVENT_UPGRADE_START<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:EventId<br>方法 or 属性:EVENT_UPGRADE_UPDATE<br>起始版本:N/A|类名:EventId<br>方法 or 属性:EVENT_UPGRADE_UPDATE<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:EventId<br>方法 or 属性:EVENT_APPLY_WAIT<br>起始版本:N/A|类名:EventId<br>方法 or 属性:EVENT_APPLY_WAIT<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:EventId<br>方法 or 属性:EVENT_APPLY_START<br>起始版本:N/A|类名:EventId<br>方法 or 属性:EVENT_APPLY_START<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:EventId<br>方法 or 属性:EVENT_UPGRADE_SUCCESS<br>起始版本:N/A|类名:EventId<br>方法 or 属性:EVENT_UPGRADE_SUCCESS<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:EventId<br>方法 or 属性:EVENT_UPGRADE_FAIL<br>起始版本:N/A|类名:EventId<br>方法 or 属性:EVENT_UPGRADE_FAIL<br>起始版本:9|@ohos.update.d.ts| diff --git a/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-usb.md b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-usb.md new file mode 100644 index 0000000000000000000000000000000000000000..c33faf227957b41c2898834c7cfe4309d9a7e2a9 --- /dev/null +++ b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-usb.md @@ -0,0 +1,236 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function getDevices(): Array\<Readonly\<USBDevice>>;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function connectDevice(device: USBDevice): Readonly\<USBDevicePipe>;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function hasRight(deviceName: string): boolean;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function requestRight(deviceName: string): Promise\<boolean>;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function removeRight(deviceName: string): boolean;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function addRight(bundleName: string, deviceName: string): boolean;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function usbFunctionsFromString(funcs: string): number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function usbFunctionsToString(funcs: FunctionType): string;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function setCurrentFunctions(funcs: FunctionType): Promise\<void>;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function getCurrentFunctions(): FunctionType;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function getPorts(): Array\<USBPort>;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function getSupportedModes(portId: number): PortModeType;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function setPortRoles(portId: number, powerRole: PowerRoleType, dataRole: DataRoleType): Promise\<void>;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function claimInterface(pipe: USBDevicePipe, iface: USBInterface, force?: boolean): number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function releaseInterface(pipe: USBDevicePipe, iface: USBInterface): number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function setConfiguration(pipe: USBDevicePipe, config: USBConfiguration): number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function setInterface(pipe: USBDevicePipe, iface: USBInterface): number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function getRawDescriptor(pipe: USBDevicePipe): Uint8Array;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function getFileDescriptor(pipe: USBDevicePipe): number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function controlTransfer(pipe: USBDevicePipe, controlparam: USBControlParams, timeout?: number): Promise\<number>;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function bulkTransfer(pipe: USBDevicePipe, endpoint: USBEndpoint, buffer: Uint8Array,<br><br> timeout?: number): Promise\<number>;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function closePipe(pipe: USBDevicePipe): number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBEndpoint|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBEndpoint<br>方法 or 属性: address: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBEndpoint<br>方法 or 属性: attributes: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBEndpoint<br>方法 or 属性: interval: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBEndpoint<br>方法 or 属性: maxPacketSize: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBEndpoint<br>方法 or 属性: direction: USBRequestDirection;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBEndpoint<br>方法 or 属性: number: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBEndpoint<br>方法 or 属性: type: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBEndpoint<br>方法 or 属性: interfaceId: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBInterface|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBInterface<br>方法 or 属性: id: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBInterface<br>方法 or 属性: protocol: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBInterface<br>方法 or 属性: clazz: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBInterface<br>方法 or 属性: subClass: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBInterface<br>方法 or 属性: alternateSetting: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBInterface<br>方法 or 属性: name: string;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBInterface<br>方法 or 属性: endpoints: Array\<USBEndpoint>;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBConfiguration|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBConfiguration<br>方法 or 属性: id: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBConfiguration<br>方法 or 属性: attributes: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBConfiguration<br>方法 or 属性: maxPower: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBConfiguration<br>方法 or 属性: name: string;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBConfiguration<br>方法 or 属性: isRemoteWakeup: boolean;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBConfiguration<br>方法 or 属性: isSelfPowered: boolean;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBConfiguration<br>方法 or 属性: interfaces: Array\<USBInterface>;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevice|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevice<br>方法 or 属性: busNum: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevice<br>方法 or 属性: devAddress: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevice<br>方法 or 属性: serial: string;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevice<br>方法 or 属性: name: string;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevice<br>方法 or 属性: manufacturerName: string;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevice<br>方法 or 属性: productName: string;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevice<br>方法 or 属性: version: string;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevice<br>方法 or 属性: vendorId: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevice<br>方法 or 属性: productId: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevice<br>方法 or 属性: clazz: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevice<br>方法 or 属性: subClass: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevice<br>方法 or 属性: protocol: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevice<br>方法 or 属性: configs: Array\<USBConfiguration>;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevicePipe|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevicePipe<br>方法 or 属性: busNum: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevicePipe<br>方法 or 属性: devAddress: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: PowerRoleType|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: PowerRoleType<br>方法 or 属性: NONE = 0|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: PowerRoleType<br>方法 or 属性: SOURCE = 1|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: PowerRoleType<br>方法 or 属性: SINK = 2|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: DataRoleType|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: DataRoleType<br>方法 or 属性: NONE = 0|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: DataRoleType<br>方法 or 属性: HOST = 1|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: DataRoleType<br>方法 or 属性: DEVICE = 2|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: PortModeType|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: PortModeType<br>方法 or 属性: NONE = 0|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: PortModeType<br>方法 or 属性: UFP = 1|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: PortModeType<br>方法 or 属性: DFP = 2|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: PortModeType<br>方法 or 属性: DRP = 3|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: PortModeType<br>方法 or 属性: NUM_MODES = 4|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBPortStatus|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBPortStatus<br>方法 or 属性: currentMode: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBPortStatus<br>方法 or 属性: currentPowerRole: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBPortStatus<br>方法 or 属性: currentDataRole: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBPort|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBPort<br>方法 or 属性: id: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBPort<br>方法 or 属性: supportedModes: PortModeType;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBPort<br>方法 or 属性: status: USBPortStatus;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBControlParams|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBControlParams<br>方法 or 属性: request: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBControlParams<br>方法 or 属性: target: USBRequestTargetType;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBControlParams<br>方法 or 属性: reqType: USBControlRequestType;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBControlParams<br>方法 or 属性: value: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBControlParams<br>方法 or 属性: index: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBControlParams<br>方法 or 属性: data: Uint8Array;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBRequestTargetType|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBRequestTargetType<br>方法 or 属性: USB_REQUEST_TARGET_DEVICE = 0|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBRequestTargetType<br>方法 or 属性: USB_REQUEST_TARGET_INTERFACE = 1|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBRequestTargetType<br>方法 or 属性: USB_REQUEST_TARGET_ENDPOINT = 2|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBRequestTargetType<br>方法 or 属性: USB_REQUEST_TARGET_OTHER = 3|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBControlRequestType|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBControlRequestType<br>方法 or 属性: USB_REQUEST_TYPE_STANDARD = 0|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBControlRequestType<br>方法 or 属性: USB_REQUEST_TYPE_CLASS = 1|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBControlRequestType<br>方法 or 属性: USB_REQUEST_TYPE_VENDOR = 2|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBRequestDirection|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBRequestDirection<br>方法 or 属性: USB_REQUEST_DIR_TO_DEVICE = 0|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBRequestDirection<br>方法 or 属性: USB_REQUEST_DIR_FROM_DEVICE = 0x80|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: FunctionType|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: FunctionType<br>方法 or 属性: NONE = 0|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: FunctionType<br>方法 or 属性: ACM = 1|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: FunctionType<br>方法 or 属性: ECM = 2|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: FunctionType<br>方法 or 属性: HDC = 4|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: FunctionType<br>方法 or 属性: MTP = 8|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: FunctionType<br>方法 or 属性: PTP = 16|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: FunctionType<br>方法 or 属性: RNDIS = 32|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: FunctionType<br>方法 or 属性: MIDI = 64|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: FunctionType<br>方法 or 属性: AUDIO_SOURCE = 128|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: FunctionType<br>方法 or 属性: NCM = 256|@ohos.usbManager.d.ts| +|删除|模块名: ohos.usbV9<br>类名: usbV9|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: usbV9<br>方法 or 属性:function getDevices(): Array\<Readonly\<USBDevice>>;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: usbV9<br>方法 or 属性:function connectDevice(device: USBDevice): Readonly\<USBDevicePipe>;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: usbV9<br>方法 or 属性:function hasRight(deviceName: string): boolean;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: usbV9<br>方法 or 属性:function requestRight(deviceName: string): Promise\<boolean>;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: usbV9<br>方法 or 属性:function removeRight(deviceName: string): boolean;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: usbV9<br>方法 or 属性:function addRight(bundleName: string, deviceName: string): boolean;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: usbV9<br>方法 or 属性:function usbFunctionsFromString(funcs: string): number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: usbV9<br>方法 or 属性:function usbFunctionsToString(funcs: FunctionType): string;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: usbV9<br>方法 or 属性:function setCurrentFunctions(funcs: FunctionType): Promise\<boolean>;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: usbV9<br>方法 or 属性:function getCurrentFunctions(): FunctionType;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: usbV9<br>方法 or 属性:function getPorts(): Array\<USBPort>;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: usbV9<br>方法 or 属性:function getSupportedModes(portId: number): PortModeType;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: usbV9<br>方法 or 属性:function setPortRoles(portId: number, powerRole: PowerRoleType, dataRole: DataRoleType): Promise\<boolean>;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: usbV9<br>方法 or 属性:function claimInterface(pipe: USBDevicePipe, iface: USBInterface, force?: boolean): number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: usbV9<br>方法 or 属性:function releaseInterface(pipe: USBDevicePipe, iface: USBInterface): number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: usbV9<br>方法 or 属性:function setConfiguration(pipe: USBDevicePipe, config: USBConfig): number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: usbV9<br>方法 or 属性:function setInterface(pipe: USBDevicePipe, iface: USBInterface): number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: usbV9<br>方法 or 属性:function getRawDescriptor(pipe: USBDevicePipe): Uint8Array;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: usbV9<br>方法 or 属性:function getFileDescriptor(pipe: USBDevicePipe): number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: usbV9<br>方法 or 属性:function controlTransfer(pipe: USBDevicePipe, controlparam: USBControlParams, timeout?: number): Promise\<number>;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: usbV9<br>方法 or 属性:function bulkTransfer(pipe: USBDevicePipe, endpoint: USBEndpoint, buffer: Uint8Array,<br><br> timeout?: number): Promise\<number>;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: usbV9<br>方法 or 属性:function closePipe(pipe: USBDevicePipe): number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBEndpoint|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBEndpoint<br>方法 or 属性:address: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBEndpoint<br>方法 or 属性:attributes: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBEndpoint<br>方法 or 属性:interval: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBEndpoint<br>方法 or 属性:maxPacketSize: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBEndpoint<br>方法 or 属性:direction: USBRequestDirection;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBEndpoint<br>方法 or 属性:number: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBEndpoint<br>方法 or 属性:type: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBEndpoint<br>方法 or 属性:interfaceId: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBInterface|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBInterface<br>方法 or 属性:id: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBInterface<br>方法 or 属性:protocol: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBInterface<br>方法 or 属性:clazz: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBInterface<br>方法 or 属性:subClass: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBInterface<br>方法 or 属性:alternateSetting: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBInterface<br>方法 or 属性:name: string;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBInterface<br>方法 or 属性:endpoints: Array\<USBEndpoint>;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBConfig|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBConfig<br>方法 or 属性:id: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBConfig<br>方法 or 属性:attributes: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBConfig<br>方法 or 属性:maxPower: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBConfig<br>方法 or 属性:name: string;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBConfig<br>方法 or 属性:isRemoteWakeup: boolean;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBConfig<br>方法 or 属性:isSelfPowered: boolean;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBConfig<br>方法 or 属性:interfaces: Array\<USBInterface>;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBDevice|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBDevice<br>方法 or 属性:busNum: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBDevice<br>方法 or 属性:devAddress: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBDevice<br>方法 or 属性:serial: string;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBDevice<br>方法 or 属性:name: string;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBDevice<br>方法 or 属性:manufacturerName: string;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBDevice<br>方法 or 属性:productName: string;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBDevice<br>方法 or 属性:version: string;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBDevice<br>方法 or 属性:vendorId: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBDevice<br>方法 or 属性:productId: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBDevice<br>方法 or 属性:clazz: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBDevice<br>方法 or 属性:subClass: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBDevice<br>方法 or 属性:protocol: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBDevice<br>方法 or 属性:configs: Array\<USBConfig>;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBDevicePipe|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBDevicePipe<br>方法 or 属性:busNum: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBDevicePipe<br>方法 or 属性:devAddress: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: PowerRoleType|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: PowerRoleType<br>方法 or 属性:NONE = 0|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: PowerRoleType<br>方法 or 属性:SOURCE = 1|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: PowerRoleType<br>方法 or 属性:SINK = 2|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: DataRoleType|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: DataRoleType<br>方法 or 属性:NONE = 0|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: DataRoleType<br>方法 or 属性:HOST = 1|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: DataRoleType<br>方法 or 属性:DEVICE = 2|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: PortModeType|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: PortModeType<br>方法 or 属性:NONE = 0|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: PortModeType<br>方法 or 属性:UFP = 1|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: PortModeType<br>方法 or 属性:DFP = 2|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: PortModeType<br>方法 or 属性:DRP = 3|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: PortModeType<br>方法 or 属性:NUM_MODES = 4|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBPortStatus|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBPortStatus<br>方法 or 属性:currentMode: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBPortStatus<br>方法 or 属性:currentPowerRole: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBPortStatus<br>方法 or 属性:currentDataRole: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBPort|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBPort<br>方法 or 属性:id: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBPort<br>方法 or 属性:supportedModes: PortModeType;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBPort<br>方法 or 属性:status: USBPortStatus;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBControlParams|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBControlParams<br>方法 or 属性:request: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBControlParams<br>方法 or 属性:target: USBRequestTargetType;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBControlParams<br>方法 or 属性:reqType: USBControlRequestType;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBControlParams<br>方法 or 属性:value: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBControlParams<br>方法 or 属性:index: number;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBControlParams<br>方法 or 属性:data: Uint8Array;|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBRequestTargetType|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBRequestTargetType<br>方法 or 属性:USB_REQUEST_TARGET_DEVICE = 0|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBRequestTargetType<br>方法 or 属性:USB_REQUEST_TARGET_INTERFACE = 1|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBRequestTargetType<br>方法 or 属性:USB_REQUEST_TARGET_ENDPOINT = 2|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBRequestTargetType<br>方法 or 属性:USB_REQUEST_TARGET_OTHER = 3|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBControlRequestType|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBControlRequestType<br>方法 or 属性:USB_REQUEST_TYPE_STANDARD = 0|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBControlRequestType<br>方法 or 属性:USB_REQUEST_TYPE_CLASS = 1|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBControlRequestType<br>方法 or 属性:USB_REQUEST_TYPE_VENDOR = 2|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBRequestDirection|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBRequestDirection<br>方法 or 属性:USB_REQUEST_DIR_TO_DEVICE = 0|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: USBRequestDirection<br>方法 or 属性:USB_REQUEST_DIR_FROM_DEVICE = 0x80|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: FunctionType|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: FunctionType<br>方法 or 属性:NONE = 0|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: FunctionType<br>方法 or 属性:ACM = 1|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: FunctionType<br>方法 or 属性:ECM = 2|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: FunctionType<br>方法 or 属性:HDC = 4|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: FunctionType<br>方法 or 属性:MTP = 8|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: FunctionType<br>方法 or 属性:PTP = 16|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: FunctionType<br>方法 or 属性:RNDIS = 32|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: FunctionType<br>方法 or 属性:MIDI = 64|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: FunctionType<br>方法 or 属性:AUDIO_SOURCE = 128|NA|@ohos.usbV9.d.ts| +|删除|模块名: ohos.usbV9<br>类名: FunctionType<br>方法 or 属性:NCM = 256|NA|@ohos.usbV9.d.ts| diff --git a/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-user-iam.md b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-user-iam.md new file mode 100644 index 0000000000000000000000000000000000000000..fa3ebd3a7fd4be8fc837d4d942b970f5c0edc201 --- /dev/null +++ b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-user-iam.md @@ -0,0 +1,3 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|删除|模块名:ohos.userIAM.userAuth<br>类名:userAuth<br>方法 or 属性:function getVersion(): number;|NA|@ohos.userIAM.userAuth.d.ts| diff --git a/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-web.md b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-web.md new file mode 100644 index 0000000000000000000000000000000000000000..9cb9d30249e211523bfc1af3c7a2c4ddc59e8446 --- /dev/null +++ b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-web.md @@ -0,0 +1,46 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.web.webview<br>类名: WebHeader|@ohos.web.webview.d.ts| +|新增|NA|类名:WebHeader<br>方法or属性:|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebHeader<br>方法 or 属性:headerKey: string;|@ohos.web.webview.d.ts| +|新增|NA|类名:WebHeader<br>方法or属性:headerKey: string;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebHeader<br>方法 or 属性:headerValue: string;|@ohos.web.webview.d.ts| +|新增|NA|类名:WebHeader<br>方法or属性:headerValue: string;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebHitTestType|@ohos.web.webview.d.ts| +|新增|NA|类名:WebHitTestType<br>方法or属性:|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebHitTestType<br>方法 or 属性:EditText|@ohos.web.webview.d.ts| +|新增|NA|类名:WebHitTestType<br>方法or属性:EditText|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebHitTestType<br>方法 or 属性:Email|@ohos.web.webview.d.ts| +|新增|NA|类名:WebHitTestType<br>方法or属性:Email|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebHitTestType<br>方法 or 属性:HttpAnchor|@ohos.web.webview.d.ts| +|新增|NA|类名:WebHitTestType<br>方法or属性:HttpAnchor|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebHitTestType<br>方法 or 属性:HttpAnchorImg|@ohos.web.webview.d.ts| +|新增|NA|类名:WebHitTestType<br>方法or属性:HttpAnchorImg|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebHitTestType<br>方法 or 属性:Img|@ohos.web.webview.d.ts| +|新增|NA|类名:WebHitTestType<br>方法or属性:Img|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebHitTestType<br>方法 or 属性:Map|@ohos.web.webview.d.ts| +|新增|NA|类名:WebHitTestType<br>方法or属性:Map|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebHitTestType<br>方法 or 属性:Phone|@ohos.web.webview.d.ts| +|新增|NA|类名:WebHitTestType<br>方法or属性:Phone|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebHitTestType<br>方法 or 属性:Unknown|@ohos.web.webview.d.ts| +|新增|NA|类名:WebHitTestType<br>方法or属性:Unknown|@ohos.web.webview.d.ts| +|新增|NA|类名:HitTestValue<br>方法or属性:type: WebHitTestType;|@ohos.web.webview.d.ts| +|新增|NA|类名:WebviewController<br>方法or属性:static setWebDebuggingAccess(webDebuggingAccess: boolean): void;|@ohos.web.webview.d.ts| +|删除|模块名: ohos.web.webview<br>类名: HeaderV9|NA|@ohos.web.webview.d.ts| +|删除|模块名: ohos.web.webview<br>类名: HeaderV9<br>方法 or 属性:headerKey: string;|NA|@ohos.web.webview.d.ts| +|删除|模块名: ohos.web.webview<br>类名: HeaderV9<br>方法 or 属性:headerValue: string;|NA|@ohos.web.webview.d.ts| +|删除|模块名: ohos.web.webview<br>类名: HitTestTypeV9|NA|@ohos.web.webview.d.ts| +|删除|模块名: ohos.web.webview<br>类名: HitTestTypeV9<br>方法 or 属性:EditText|NA|@ohos.web.webview.d.ts| +|删除|模块名: ohos.web.webview<br>类名: HitTestTypeV9<br>方法 or 属性:Email|NA|@ohos.web.webview.d.ts| +|删除|模块名: ohos.web.webview<br>类名: HitTestTypeV9<br>方法 or 属性:HttpAnchor|NA|@ohos.web.webview.d.ts| +|删除|模块名: ohos.web.webview<br>类名: HitTestTypeV9<br>方法 or 属性:HttpAnchorImg|NA|@ohos.web.webview.d.ts| +|删除|模块名: ohos.web.webview<br>类名: HitTestTypeV9<br>方法 or 属性:Img|NA|@ohos.web.webview.d.ts| +|删除|模块名: ohos.web.webview<br>类名: HitTestTypeV9<br>方法 or 属性:Map|NA|@ohos.web.webview.d.ts| +|删除|模块名: ohos.web.webview<br>类名: HitTestTypeV9<br>方法 or 属性:Phone|NA|@ohos.web.webview.d.ts| +|删除|模块名: ohos.web.webview<br>类名: HitTestTypeV9<br>方法 or 属性:Unknown|NA|@ohos.web.webview.d.ts| +|删除|模块名: ohos.web.webview<br>类名: WebAsyncController|NA|@ohos.web.webview.d.ts| +|删除|模块名: ohos.web.webview<br>类名: WebAsyncController<br>方法 or 属性:constructor(controller: WebController);|NA|@ohos.web.webview.d.ts| +|删除|模块名: ohos.web.webview<br>类名: WebAsyncController<br>方法 or 属性:storeWebArchive(baseName: string, autoName: boolean): Promise\<string>;|NA|@ohos.web.webview.d.ts| +|删除|模块名: ohos.web.webview<br>类名: WebAsyncController<br>方法 or 属性:storeWebArchive(baseName: string, autoName: boolean, callback : AsyncCallback\<string>): void;|NA|@ohos.web.webview.d.ts| +|函数有变化|类名:WebviewController<br>方法 or 属性:loadUrl(url: string \| Resource, headers?: Array\<HeaderV9>): void;<br>|类名:WebviewController<br>方法 or 属性:loadUrl(url: string \| Resource, headers?: Array\<WebHeader>): void;<br>|@ohos.web.webview.d.ts| +|函数有变化|类名:WebviewController<br>方法 or 属性:getHitTest(): HitTestTypeV9;<br>|类名:WebviewController<br>方法 or 属性:getHitTest(): WebHitTestType;<br>|@ohos.web.webview.d.ts| diff --git a/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-window.md b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-window.md new file mode 100644 index 0000000000000000000000000000000000000000..5987e436840e5ea83f9ff1f1850e9e86c720bc01 --- /dev/null +++ b/zh-cn/release-notes/api-diff/Beta5 to v3.2-Release/js-apidiff-window.md @@ -0,0 +1,74 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|类名:WindowExtensionAbility<br>方法or属性:context: WindowExtensionContext;|@ohos.application.WindowExtensionAbility.d.ts| +|新增|NA|类名:Window<br>方法or属性:bindDialogTarget(requestInfo: dialogRequest.RequestInfo, deathCallback: Callback\<void>): Promise\<void>;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:bindDialogTarget(requestInfo: dialogRequest.RequestInfo, deathCallback: Callback\<void>, callback: AsyncCallback\<void>): void;|@ohos.window.d.ts| +|新增|NA|模块名: WindowExtensionContext<br>类名: WindowExtensionContext|WindowExtensionContext.d.ts| +|新增|NA|模块名: WindowExtensionContext<br>类名: WindowExtensionContext<br>方法 or 属性: startAbility(want: Want, options: StartOptions, callback: AsyncCallback\<void>): void;|WindowExtensionContext.d.ts| +|新增|NA|模块名: WindowExtensionContext<br>类名: WindowExtensionContext<br>方法 or 属性: startAbility(want: Want, options?: StartOptions): Promise\<void>;|WindowExtensionContext.d.ts| +|删除|模块名:ohos.window<br>类名:Window<br>方法 or 属性:on(type: 'dialogTargetTouch', callback: Callback\<void>): void;|NA|@ohos.window.d.ts| +|删除|模块名:ohos.window<br>类名:Window<br>方法 or 属性:off(type: 'dialogTargetTouch', callback?: Callback\<void>): void;|NA|@ohos.window.d.ts| +|访问级别有变化|类名:WindowAnimationFinishedCallback<br>方法 or 属性:onAnimationFinish(): void;<br>访问级别:公开API|类名:WindowAnimationFinishedCallback<br>方法 or 属性:onAnimationFinish(): void;<br>访问级别:系统API|@ohos.animation.windowAnimationManager.d.ts| +|访问级别有变化|类名:WindowType<br>方法 or 属性:TYPE_FLOAT_CAMERA<br>访问级别:公开API|类名:WindowType<br>方法 or 属性:TYPE_FLOAT_CAMERA<br>访问级别:系统API|@ohos.window.d.ts| +|起始版本有变化|类名:RRect<br>方法 or 属性:left: number;<br>起始版本:N/A|类名:RRect<br>方法 or 属性:left: number;<br>起始版本:9|@ohos.animation.windowAnimationManager.d.ts| +|起始版本有变化|类名:RRect<br>方法 or 属性:top: number;<br>起始版本:N/A|类名:RRect<br>方法 or 属性:top: number;<br>起始版本:9|@ohos.animation.windowAnimationManager.d.ts| +|起始版本有变化|类名:RRect<br>方法 or 属性:width: number;<br>起始版本:N/A|类名:RRect<br>方法 or 属性:width: number;<br>起始版本:9|@ohos.animation.windowAnimationManager.d.ts| +|起始版本有变化|类名:RRect<br>方法 or 属性:height: number;<br>起始版本:N/A|类名:RRect<br>方法 or 属性:height: number;<br>起始版本:9|@ohos.animation.windowAnimationManager.d.ts| +|起始版本有变化|类名:RRect<br>方法 or 属性:radius: number;<br>起始版本:N/A|类名:RRect<br>方法 or 属性:radius: number;<br>起始版本:9|@ohos.animation.windowAnimationManager.d.ts| +|起始版本有变化|类名:WindowAnimationTarget<br>方法 or 属性:readonly bundleName: string;<br>起始版本:N/A|类名:WindowAnimationTarget<br>方法 or 属性:readonly bundleName: string;<br>起始版本:9|@ohos.animation.windowAnimationManager.d.ts| +|起始版本有变化|类名:WindowAnimationTarget<br>方法 or 属性:readonly abilityName: string;<br>起始版本:N/A|类名:WindowAnimationTarget<br>方法 or 属性:readonly abilityName: string;<br>起始版本:9|@ohos.animation.windowAnimationManager.d.ts| +|起始版本有变化|类名:WindowAnimationTarget<br>方法 or 属性:readonly windowBounds: RRect;<br>起始版本:N/A|类名:WindowAnimationTarget<br>方法 or 属性:readonly windowBounds: RRect;<br>起始版本:9|@ohos.animation.windowAnimationManager.d.ts| +|起始版本有变化|类名:WindowAnimationTarget<br>方法 or 属性:readonly missionId: number;<br>起始版本:N/A|类名:WindowAnimationTarget<br>方法 or 属性:readonly missionId: number;<br>起始版本:9|@ohos.animation.windowAnimationManager.d.ts| +|起始版本有变化|类名:WindowAnimationFinishedCallback<br>方法 or 属性:onAnimationFinish(): void;<br>起始版本:N/A|类名:WindowAnimationFinishedCallback<br>方法 or 属性:onAnimationFinish(): void;<br>起始版本:9|@ohos.animation.windowAnimationManager.d.ts| +|起始版本有变化|类名:Rect<br>方法 or 属性:left: number;<br>起始版本:N/A|类名:Rect<br>方法 or 属性:left: number;<br>起始版本:9|@ohos.display.d.ts| +|起始版本有变化|类名:Rect<br>方法 or 属性:top: number;<br>起始版本:N/A|类名:Rect<br>方法 or 属性:top: number;<br>起始版本:9|@ohos.display.d.ts| +|起始版本有变化|类名:Rect<br>方法 or 属性:width: number;<br>起始版本:N/A|类名:Rect<br>方法 or 属性:width: number;<br>起始版本:9|@ohos.display.d.ts| +|起始版本有变化|类名:Rect<br>方法 or 属性:height: number;<br>起始版本:N/A|类名:Rect<br>方法 or 属性:height: number;<br>起始版本:9|@ohos.display.d.ts| +|起始版本有变化|类名:WaterfallDisplayAreaRects<br>方法 or 属性:readonly left: Rect;<br>起始版本:N/A|类名:WaterfallDisplayAreaRects<br>方法 or 属性:readonly left: Rect;<br>起始版本:9|@ohos.display.d.ts| +|起始版本有变化|类名:WaterfallDisplayAreaRects<br>方法 or 属性:readonly right: Rect;<br>起始版本:N/A|类名:WaterfallDisplayAreaRects<br>方法 or 属性:readonly right: Rect;<br>起始版本:9|@ohos.display.d.ts| +|起始版本有变化|类名:WaterfallDisplayAreaRects<br>方法 or 属性:readonly top: Rect;<br>起始版本:N/A|类名:WaterfallDisplayAreaRects<br>方法 or 属性:readonly top: Rect;<br>起始版本:9|@ohos.display.d.ts| +|起始版本有变化|类名:WaterfallDisplayAreaRects<br>方法 or 属性:readonly bottom: Rect;<br>起始版本:N/A|类名:WaterfallDisplayAreaRects<br>方法 or 属性:readonly bottom: Rect;<br>起始版本:9|@ohos.display.d.ts| +|起始版本有变化|类名:CutoutInfo<br>方法 or 属性:readonly boundingRects: Array\<Rect>;<br>起始版本:N/A|类名:CutoutInfo<br>方法 or 属性:readonly boundingRects: Array\<Rect>;<br>起始版本:9|@ohos.display.d.ts| +|起始版本有变化|类名:CutoutInfo<br>方法 or 属性:readonly waterfallDisplayAreaRects: WaterfallDisplayAreaRects;<br>起始版本:N/A|类名:CutoutInfo<br>方法 or 属性:readonly waterfallDisplayAreaRects: WaterfallDisplayAreaRects;<br>起始版本:9|@ohos.display.d.ts| +|起始版本有变化|类名:ScaleOptions<br>方法 or 属性:x?: number;<br>起始版本:N/A|类名:ScaleOptions<br>方法 or 属性:x?: number;<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:ScaleOptions<br>方法 or 属性:y?: number;<br>起始版本:N/A|类名:ScaleOptions<br>方法 or 属性:y?: number;<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:ScaleOptions<br>方法 or 属性:pivotX?: number;<br>起始版本:N/A|类名:ScaleOptions<br>方法 or 属性:pivotX?: number;<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:ScaleOptions<br>方法 or 属性:pivotY?: number;<br>起始版本:N/A|类名:ScaleOptions<br>方法 or 属性:pivotY?: number;<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:RotateOptions<br>方法 or 属性:x?: number;<br>起始版本:N/A|类名:RotateOptions<br>方法 or 属性:x?: number;<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:RotateOptions<br>方法 or 属性:y?: number;<br>起始版本:N/A|类名:RotateOptions<br>方法 or 属性:y?: number;<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:RotateOptions<br>方法 or 属性:z?: number;<br>起始版本:N/A|类名:RotateOptions<br>方法 or 属性:z?: number;<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:RotateOptions<br>方法 or 属性:pivotX?: number;<br>起始版本:N/A|类名:RotateOptions<br>方法 or 属性:pivotX?: number;<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:RotateOptions<br>方法 or 属性:pivotY?: number;<br>起始版本:N/A|类名:RotateOptions<br>方法 or 属性:pivotY?: number;<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:TranslateOptions<br>方法 or 属性:x?: number;<br>起始版本:N/A|类名:TranslateOptions<br>方法 or 属性:x?: number;<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:TranslateOptions<br>方法 or 属性:y?: number;<br>起始版本:N/A|类名:TranslateOptions<br>方法 or 属性:y?: number;<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:TranslateOptions<br>方法 or 属性:z?: number;<br>起始版本:N/A|类名:TranslateOptions<br>方法 or 属性:z?: number;<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:TransitionContext<br>方法 or 属性:toWindow: Window<br>起始版本:N/A|类名:TransitionContext<br>方法 or 属性:toWindow: Window<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:TransitionContext<br>方法 or 属性:completeTransition(isCompleted: boolean): void;<br>起始版本:N/A|类名:TransitionContext<br>方法 or 属性:completeTransition(isCompleted: boolean): void;<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:TransitionController<br>方法 or 属性:animationForShown(context: TransitionContext): void;<br>起始版本:N/A|类名:TransitionController<br>方法 or 属性:animationForShown(context: TransitionContext): void;<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:TransitionController<br>方法 or 属性:animationForHidden(context: TransitionContext): void;<br>起始版本:N/A|类名:TransitionController<br>方法 or 属性:animationForHidden(context: TransitionContext): void;<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:Configuration<br>方法 or 属性:name: string<br>起始版本:N/A|类名:Configuration<br>方法 or 属性:name: string<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:Configuration<br>方法 or 属性:windowType: WindowType<br>起始版本:N/A|类名:Configuration<br>方法 or 属性:windowType: WindowType<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:Configuration<br>方法 or 属性:ctx?: BaseContext<br>起始版本:N/A|类名:Configuration<br>方法 or 属性:ctx?: BaseContext<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:Configuration<br>方法 or 属性:displayId?: number<br>起始版本:N/A|类名:Configuration<br>方法 or 属性:displayId?: number<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:Configuration<br>方法 or 属性:parentId?: number<br>起始版本:N/A|类名:Configuration<br>方法 or 属性:parentId?: number<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:Orientation<br>方法 or 属性:UNSPECIFIED = 0<br>起始版本:N/A|类名:Orientation<br>方法 or 属性:UNSPECIFIED = 0<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:Orientation<br>方法 or 属性:PORTRAIT = 1<br>起始版本:N/A|类名:Orientation<br>方法 or 属性:PORTRAIT = 1<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:Orientation<br>方法 or 属性:LANDSCAPE = 2<br>起始版本:N/A|类名:Orientation<br>方法 or 属性:LANDSCAPE = 2<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:Orientation<br>方法 or 属性:PORTRAIT_INVERTED = 3<br>起始版本:N/A|类名:Orientation<br>方法 or 属性:PORTRAIT_INVERTED = 3<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:Orientation<br>方法 or 属性:LANDSCAPE_INVERTED = 4<br>起始版本:N/A|类名:Orientation<br>方法 or 属性:LANDSCAPE_INVERTED = 4<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:Orientation<br>方法 or 属性:AUTO_ROTATION = 5<br>起始版本:N/A|类名:Orientation<br>方法 or 属性:AUTO_ROTATION = 5<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:Orientation<br>方法 or 属性:AUTO_ROTATION_PORTRAIT = 6<br>起始版本:N/A|类名:Orientation<br>方法 or 属性:AUTO_ROTATION_PORTRAIT = 6<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:Orientation<br>方法 or 属性:AUTO_ROTATION_LANDSCAPE = 7<br>起始版本:N/A|类名:Orientation<br>方法 or 属性:AUTO_ROTATION_LANDSCAPE = 7<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:Orientation<br>方法 or 属性:AUTO_ROTATION_RESTRICTED = 8<br>起始版本:N/A|类名:Orientation<br>方法 or 属性:AUTO_ROTATION_RESTRICTED = 8<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:Orientation<br>方法 or 属性:AUTO_ROTATION_PORTRAIT_RESTRICTED = 9<br>起始版本:N/A|类名:Orientation<br>方法 or 属性:AUTO_ROTATION_PORTRAIT_RESTRICTED = 9<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:Orientation<br>方法 or 属性:AUTO_ROTATION_LANDSCAPE_RESTRICTED = 10<br>起始版本:N/A|类名:Orientation<br>方法 or 属性:AUTO_ROTATION_LANDSCAPE_RESTRICTED = 10<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:Orientation<br>方法 or 属性:LOCKED = 11<br>起始版本:N/A|类名:Orientation<br>方法 or 属性:LOCKED = 11<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:BlurStyle<br>方法 or 属性:OFF<br>起始版本:N/A|类名:BlurStyle<br>方法 or 属性:OFF<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:BlurStyle<br>方法 or 属性:THIN<br>起始版本:N/A|类名:BlurStyle<br>方法 or 属性:THIN<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:BlurStyle<br>方法 or 属性:REGULAR<br>起始版本:N/A|类名:BlurStyle<br>方法 or 属性:REGULAR<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:BlurStyle<br>方法 or 属性:THICK<br>起始版本:N/A|类名:BlurStyle<br>方法 or 属性:THICK<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:WindowStageEventType<br>方法 or 属性:SHOWN = 1<br>起始版本:N/A|类名:WindowStageEventType<br>方法 or 属性:SHOWN = 1<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:WindowStageEventType<br>方法 or 属性:ACTIVE<br>起始版本:N/A|类名:WindowStageEventType<br>方法 or 属性:ACTIVE<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:WindowStageEventType<br>方法 or 属性:INACTIVE<br>起始版本:N/A|类名:WindowStageEventType<br>方法 or 属性:INACTIVE<br>起始版本:9|@ohos.window.d.ts| +|起始版本有变化|类名:WindowStageEventType<br>方法 or 属性:HIDDEN<br>起始版本:N/A|类名:WindowStageEventType<br>方法 or 属性:HIDDEN<br>起始版本:9|@ohos.window.d.ts| +|删除(权限)|类名:WindowType<br>方法 or 属性:TYPE_FLOAT_CAMERA<br>权限:ohos.permission.SYSTEM_FLOAT_WINDOW|类名:WindowType<br>方法 or 属性:TYPE_FLOAT_CAMERA<br>权限:N/A|@ohos.window.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/Readme-CN.md b/zh-cn/release-notes/api-diff/v3.2-Release/Readme-CN.md new file mode 100644 index 0000000000000000000000000000000000000000..604908992c5a3550f7169927359539d3d89705b4 --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/Readme-CN.md @@ -0,0 +1,35 @@ +# JS API差异报告 + +- [元能力](js-apidiff-ability.md) +- [无障碍](js-apidiff-accessibility.md) +- [帐号](js-apidiff-account.md) +- [应用](js-apidiff-application.md) +- [ArkUI](js-apidiff-arkui.md) +- [电源服务](js-apidiff-battery.md) +- [包管理](js-apidiff-bundle.md) +- [网络及通信](js-apidiff-communication.md) +- [语言编译器运行时](js-apidiff-compiler-and-runtime.md) +- [定制](js-apidiff-customization.md) +- [DFX](js-apidiff-dfx.md) +- [分布式数据](js-apidiff-distributed-data.md) +- [分布式硬件](js-apidiff-distributed-hardware.md) +- [文件管理](js-apidiff-file-management.md) +- [位置服务](js-apidiff-geolocation.md) +- [全球化](js-apidiff-global.md) +- [图形图像](js-apidiff-graphic.md) +- [Misc软件](js-apidiff-misc.md) +- [MSDP](js-apidiff-msdp.md) +- [多模输入](js-apidiff-multi-modal-input.md) +- [媒体服务](js-apidiff-multimedia.md) +- [事件与通知](js-apidiff-notification.md) +- [资源调度](js-apidiff-resource-scheduler.md) +- [安全](js-apidiff-security.md) +- [泛Sensor](js-apidiff-sensor.md) +- [启动](js-apidiff-start-up.md) +- [电话服务](js-apidiff-telephony.md) +- [测试服务](js-apidiff-unitest.md) +- [升级](js-apidiff-update.md) +- [USB服务](js-apidiff-usb.md) +- [用户IAM](js-apidiff-user-iam.md) +- [Web](js-apidiff-web.md) +- [窗口](js-apidiff-window.md) diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-ability.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-ability.md new file mode 100644 index 0000000000000000000000000000000000000000..b2bfdb1d382f643ec5f8edfebd03d585f4ca0802 --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-ability.md @@ -0,0 +1,734 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: lifecycle<br>类名: LifecycleForm<br>方法 or 属性: onShare?(formId: string): {[key: string]: any};|lifecycle.d.ts| +|新增|NA|模块名: ohos.ability.ability<br>类名: ability|@ohos.ability.ability.d.ts| +|新增|NA|模块名: ohos.app.ability.Ability<br>类名: Ability|@ohos.app.ability.Ability.d.ts| +|新增|NA|模块名: ohos.app.ability.Ability<br>类名: Ability<br>方法 or 属性: onConfigurationUpdate(newConfig: Configuration): void;|@ohos.app.ability.Ability.d.ts| +|新增|NA|模块名: ohos.app.ability.Ability<br>类名: Ability<br>方法 or 属性: onMemoryLevel(level: AbilityConstant.MemoryLevel): void;|@ohos.app.ability.Ability.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: AbilityConstant|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: LaunchParam|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: LaunchParam<br>方法 or 属性: launchReason: LaunchReason;|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: LaunchParam<br>方法 or 属性: lastExitReason: LastExitReason;|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: LaunchReason|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: LaunchReason<br>方法 or 属性: UNKNOWN = 0|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: LaunchReason<br>方法 or 属性: START_ABILITY = 1|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: LaunchReason<br>方法 or 属性: CALL = 2|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: LaunchReason<br>方法 or 属性: CONTINUATION = 3|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: LaunchReason<br>方法 or 属性: APP_RECOVERY = 4|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: LastExitReason|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: LastExitReason<br>方法 or 属性: UNKNOWN = 0|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: LastExitReason<br>方法 or 属性: ABILITY_NOT_RESPONDING = 1|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: LastExitReason<br>方法 or 属性: NORMAL = 2|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: OnContinueResult|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: OnContinueResult<br>方法 or 属性: AGREE = 0|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: OnContinueResult<br>方法 or 属性: REJECT = 1|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: OnContinueResult<br>方法 or 属性: MISMATCH = 2|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: MemoryLevel|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: MemoryLevel<br>方法 or 属性: MEMORY_LEVEL_MODERATE = 0|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: MemoryLevel<br>方法 or 属性: MEMORY_LEVEL_LOW = 1|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: MemoryLevel<br>方法 or 属性: MEMORY_LEVEL_CRITICAL = 2|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: WindowMode|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: WindowMode<br>方法 or 属性: WINDOW_MODE_UNDEFINED = 0|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: WindowMode<br>方法 or 属性: WINDOW_MODE_FULLSCREEN = 1|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: WindowMode<br>方法 or 属性: WINDOW_MODE_SPLIT_PRIMARY = 100|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: WindowMode<br>方法 or 属性: WINDOW_MODE_SPLIT_SECONDARY = 101|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: WindowMode<br>方法 or 属性: WINDOW_MODE_FLOATING = 102|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: OnSaveResult|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: OnSaveResult<br>方法 or 属性: ALL_AGREE = 0|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: OnSaveResult<br>方法 or 属性: CONTINUATION_REJECT = 1|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: OnSaveResult<br>方法 or 属性: CONTINUATION_MISMATCH = 2|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: OnSaveResult<br>方法 or 属性: RECOVERY_AGREE = 3|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: OnSaveResult<br>方法 or 属性: RECOVERY_REJECT = 4|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: OnSaveResult<br>方法 or 属性: ALL_REJECT|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: StateType|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: StateType<br>方法 or 属性: CONTINUATION = 0|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityConstant<br>类名: StateType<br>方法 or 属性: APP_RECOVERY = 1|@ohos.app.ability.AbilityConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.abilityDelegatorRegistry<br>类名: abilityDelegatorRegistry|@ohos.app.ability.abilityDelegatorRegistry.d.ts| +|新增|NA|模块名: ohos.app.ability.abilityDelegatorRegistry<br>类名: abilityDelegatorRegistry<br>方法 or 属性: function getAbilityDelegator(): AbilityDelegator;|@ohos.app.ability.abilityDelegatorRegistry.d.ts| +|新增|NA|模块名: ohos.app.ability.abilityDelegatorRegistry<br>类名: abilityDelegatorRegistry<br>方法 or 属性: function getArguments(): AbilityDelegatorArgs;|@ohos.app.ability.abilityDelegatorRegistry.d.ts| +|新增|NA|模块名: ohos.app.ability.abilityDelegatorRegistry<br>类名: AbilityLifecycleState|@ohos.app.ability.abilityDelegatorRegistry.d.ts| +|新增|NA|模块名: ohos.app.ability.abilityDelegatorRegistry<br>类名: AbilityLifecycleState<br>方法 or 属性: UNINITIALIZED|@ohos.app.ability.abilityDelegatorRegistry.d.ts| +|新增|NA|模块名: ohos.app.ability.abilityDelegatorRegistry<br>类名: AbilityLifecycleState<br>方法 or 属性: CREATE|@ohos.app.ability.abilityDelegatorRegistry.d.ts| +|新增|NA|模块名: ohos.app.ability.abilityDelegatorRegistry<br>类名: AbilityLifecycleState<br>方法 or 属性: FOREGROUND|@ohos.app.ability.abilityDelegatorRegistry.d.ts| +|新增|NA|模块名: ohos.app.ability.abilityDelegatorRegistry<br>类名: AbilityLifecycleState<br>方法 or 属性: BACKGROUND|@ohos.app.ability.abilityDelegatorRegistry.d.ts| +|新增|NA|模块名: ohos.app.ability.abilityDelegatorRegistry<br>类名: AbilityLifecycleState<br>方法 or 属性: DESTROY|@ohos.app.ability.abilityDelegatorRegistry.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityLifecycleCallback<br>类名: AbilityLifecycleCallback|@ohos.app.ability.AbilityLifecycleCallback.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityLifecycleCallback<br>类名: AbilityLifecycleCallback<br>方法 or 属性: onAbilityCreate(ability: UIAbility): void;|@ohos.app.ability.AbilityLifecycleCallback.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityLifecycleCallback<br>类名: AbilityLifecycleCallback<br>方法 or 属性: onWindowStageCreate(ability: UIAbility, windowStage: window.WindowStage): void;|@ohos.app.ability.AbilityLifecycleCallback.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityLifecycleCallback<br>类名: AbilityLifecycleCallback<br>方法 or 属性: onWindowStageActive(ability: UIAbility, windowStage: window.WindowStage): void;|@ohos.app.ability.AbilityLifecycleCallback.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityLifecycleCallback<br>类名: AbilityLifecycleCallback<br>方法 or 属性: onWindowStageInactive(ability: UIAbility, windowStage: window.WindowStage): void;|@ohos.app.ability.AbilityLifecycleCallback.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityLifecycleCallback<br>类名: AbilityLifecycleCallback<br>方法 or 属性: onWindowStageDestroy(ability: UIAbility, windowStage: window.WindowStage): void;|@ohos.app.ability.AbilityLifecycleCallback.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityLifecycleCallback<br>类名: AbilityLifecycleCallback<br>方法 or 属性: onAbilityDestroy(ability: UIAbility): void;|@ohos.app.ability.AbilityLifecycleCallback.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityLifecycleCallback<br>类名: AbilityLifecycleCallback<br>方法 or 属性: onAbilityForeground(ability: UIAbility): void;|@ohos.app.ability.AbilityLifecycleCallback.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityLifecycleCallback<br>类名: AbilityLifecycleCallback<br>方法 or 属性: onAbilityBackground(ability: UIAbility): void;|@ohos.app.ability.AbilityLifecycleCallback.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityLifecycleCallback<br>类名: AbilityLifecycleCallback<br>方法 or 属性: onAbilityContinue(ability: UIAbility): void;|@ohos.app.ability.AbilityLifecycleCallback.d.ts| +|新增|NA|模块名: ohos.app.ability.abilityManager<br>类名: abilityManager|@ohos.app.ability.abilityManager.d.ts| +|新增|NA|模块名: ohos.app.ability.abilityManager<br>类名: AbilityState|@ohos.app.ability.abilityManager.d.ts| +|新增|NA|模块名: ohos.app.ability.abilityManager<br>类名: AbilityState<br>方法 or 属性: INITIAL = 0|@ohos.app.ability.abilityManager.d.ts| +|新增|NA|模块名: ohos.app.ability.abilityManager<br>类名: AbilityState<br>方法 or 属性: FOCUS = 2|@ohos.app.ability.abilityManager.d.ts| +|新增|NA|模块名: ohos.app.ability.abilityManager<br>类名: AbilityState<br>方法 or 属性: FOREGROUND = 9|@ohos.app.ability.abilityManager.d.ts| +|新增|NA|模块名: ohos.app.ability.abilityManager<br>类名: AbilityState<br>方法 or 属性: BACKGROUND = 10|@ohos.app.ability.abilityManager.d.ts| +|新增|NA|模块名: ohos.app.ability.abilityManager<br>类名: AbilityState<br>方法 or 属性: FOREGROUNDING = 11|@ohos.app.ability.abilityManager.d.ts| +|新增|NA|模块名: ohos.app.ability.abilityManager<br>类名: AbilityState<br>方法 or 属性: BACKGROUNDING = 12|@ohos.app.ability.abilityManager.d.ts| +|新增|NA|模块名: ohos.app.ability.abilityManager<br>类名: abilityManager<br>方法 or 属性: function updateConfiguration(config: Configuration, callback: AsyncCallback\<void>): void;|@ohos.app.ability.abilityManager.d.ts| +|新增|NA|模块名: ohos.app.ability.abilityManager<br>类名: abilityManager<br>方法 or 属性: function updateConfiguration(config: Configuration): Promise\<void>;|@ohos.app.ability.abilityManager.d.ts| +|新增|NA|模块名: ohos.app.ability.abilityManager<br>类名: abilityManager<br>方法 or 属性: function getAbilityRunningInfos(): Promise\<Array\<AbilityRunningInfo>>;|@ohos.app.ability.abilityManager.d.ts| +|新增|NA|模块名: ohos.app.ability.abilityManager<br>类名: abilityManager<br>方法 or 属性: function getAbilityRunningInfos(callback: AsyncCallback\<Array\<AbilityRunningInfo>>): void;|@ohos.app.ability.abilityManager.d.ts| +|新增|NA|模块名: ohos.app.ability.abilityManager<br>类名: abilityManager<br>方法 or 属性: function getExtensionRunningInfos(upperLimit: number): Promise\<Array\<ExtensionRunningInfo>>;|@ohos.app.ability.abilityManager.d.ts| +|新增|NA|模块名: ohos.app.ability.abilityManager<br>类名: abilityManager<br>方法 or 属性: function getExtensionRunningInfos(upperLimit: number, callback: AsyncCallback\<Array\<ExtensionRunningInfo>>): void;|@ohos.app.ability.abilityManager.d.ts| +|新增|NA|模块名: ohos.app.ability.abilityManager<br>类名: abilityManager<br>方法 or 属性: function getTopAbility(): Promise\<ElementName>;|@ohos.app.ability.abilityManager.d.ts| +|新增|NA|模块名: ohos.app.ability.abilityManager<br>类名: abilityManager<br>方法 or 属性: function getTopAbility(callback: AsyncCallback\<ElementName>): void;|@ohos.app.ability.abilityManager.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityStage<br>类名: AbilityStage|@ohos.app.ability.AbilityStage.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityStage<br>类名: AbilityStage<br>方法 or 属性: context: AbilityStageContext;|@ohos.app.ability.AbilityStage.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityStage<br>类名: AbilityStage<br>方法 or 属性: onCreate(): void;|@ohos.app.ability.AbilityStage.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityStage<br>类名: AbilityStage<br>方法 or 属性: onAcceptWant(want: Want): string;|@ohos.app.ability.AbilityStage.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityStage<br>类名: AbilityStage<br>方法 or 属性: onConfigurationUpdate(newConfig: Configuration): void;|@ohos.app.ability.AbilityStage.d.ts| +|新增|NA|模块名: ohos.app.ability.AbilityStage<br>类名: AbilityStage<br>方法 or 属性: onMemoryLevel(level: AbilityConstant.MemoryLevel): void;|@ohos.app.ability.AbilityStage.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: appManager|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: ApplicationState|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: ApplicationState<br>方法 or 属性: STATE_CREATE|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: ApplicationState<br>方法 or 属性: STATE_FOREGROUND|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: ApplicationState<br>方法 or 属性: STATE_ACTIVE|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: ApplicationState<br>方法 or 属性: STATE_BACKGROUND|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: ApplicationState<br>方法 or 属性: STATE_DESTROY|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: ProcessState|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: ProcessState<br>方法 or 属性: STATE_CREATE|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: ProcessState<br>方法 or 属性: STATE_FOREGROUND|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: ProcessState<br>方法 or 属性: STATE_ACTIVE|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: ProcessState<br>方法 or 属性: STATE_BACKGROUND|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: ProcessState<br>方法 or 属性: STATE_DESTROY|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: appManager<br>方法 or 属性: function on(type: "applicationState", observer: ApplicationStateObserver): number;|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: appManager<br>方法 or 属性: function on(type: "applicationState", observer: ApplicationStateObserver, bundleNameList: Array\<string>): number;|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: appManager<br>方法 or 属性: function off(type: "applicationState", observerId: number, callback: AsyncCallback\<void>): void;|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: appManager<br>方法 or 属性: function off(type: "applicationState", observerId: number): Promise\<void>;|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: appManager<br>方法 or 属性: function getForegroundApplications(callback: AsyncCallback\<Array\<AppStateData>>): void;|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: appManager<br>方法 or 属性: function getForegroundApplications(): Promise\<Array\<AppStateData>>;|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: appManager<br>方法 or 属性: function killProcessWithAccount(bundleName: string, accountId: number): Promise\<void>;|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: appManager<br>方法 or 属性: function killProcessWithAccount(bundleName: string, accountId: number, callback: AsyncCallback\<void>): void;|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: appManager<br>方法 or 属性: function isRunningInStabilityTest(callback: AsyncCallback\<boolean>): void;|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: appManager<br>方法 or 属性: function isRunningInStabilityTest(): Promise\<boolean>;|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: appManager<br>方法 or 属性: function killProcessesByBundleName(bundleName: string): Promise\<void>;|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: appManager<br>方法 or 属性: function killProcessesByBundleName(bundleName: string, callback: AsyncCallback\<void>);|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: appManager<br>方法 or 属性: function clearUpApplicationData(bundleName: string): Promise\<void>;|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: appManager<br>方法 or 属性: function clearUpApplicationData(bundleName: string, callback: AsyncCallback\<void>);|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: appManager<br>方法 or 属性: function isRamConstrainedDevice(): Promise\<boolean>;|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: appManager<br>方法 or 属性: function isRamConstrainedDevice(callback: AsyncCallback\<boolean>): void;|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: appManager<br>方法 or 属性: function getAppMemorySize(): Promise\<number>;|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: appManager<br>方法 or 属性: function getAppMemorySize(callback: AsyncCallback\<number>): void;|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: appManager<br>方法 or 属性: function getRunningProcessInformation(): Promise\<Array\<ProcessInformation>>;|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appManager<br>类名: appManager<br>方法 or 属性: function getRunningProcessInformation(callback: AsyncCallback\<Array\<ProcessInformation>>): void;|@ohos.app.ability.appManager.d.ts| +|新增|NA|模块名: ohos.app.ability.appRecovery<br>类名: appRecovery|@ohos.app.ability.appRecovery.d.ts| +|新增|NA|模块名: ohos.app.ability.appRecovery<br>类名: RestartFlag|@ohos.app.ability.appRecovery.d.ts| +|新增|NA|模块名: ohos.app.ability.appRecovery<br>类名: RestartFlag<br>方法 or 属性: ALWAYS_RESTART = 0|@ohos.app.ability.appRecovery.d.ts| +|新增|NA|模块名: ohos.app.ability.appRecovery<br>类名: RestartFlag<br>方法 or 属性: RESTART_WHEN_JS_CRASH = 0x0001|@ohos.app.ability.appRecovery.d.ts| +|新增|NA|模块名: ohos.app.ability.appRecovery<br>类名: RestartFlag<br>方法 or 属性: RESTART_WHEN_APP_FREEZE = 0x0002|@ohos.app.ability.appRecovery.d.ts| +|新增|NA|模块名: ohos.app.ability.appRecovery<br>类名: RestartFlag<br>方法 or 属性: NO_RESTART = 0xFFFF|@ohos.app.ability.appRecovery.d.ts| +|新增|NA|模块名: ohos.app.ability.appRecovery<br>类名: SaveOccasionFlag|@ohos.app.ability.appRecovery.d.ts| +|新增|NA|模块名: ohos.app.ability.appRecovery<br>类名: SaveOccasionFlag<br>方法 or 属性: SAVE_WHEN_ERROR = 0x0001|@ohos.app.ability.appRecovery.d.ts| +|新增|NA|模块名: ohos.app.ability.appRecovery<br>类名: SaveOccasionFlag<br>方法 or 属性: SAVE_WHEN_BACKGROUND = 0x0002|@ohos.app.ability.appRecovery.d.ts| +|新增|NA|模块名: ohos.app.ability.appRecovery<br>类名: SaveModeFlag|@ohos.app.ability.appRecovery.d.ts| +|新增|NA|模块名: ohos.app.ability.appRecovery<br>类名: SaveModeFlag<br>方法 or 属性: SAVE_WITH_FILE = 0x0001|@ohos.app.ability.appRecovery.d.ts| +|新增|NA|模块名: ohos.app.ability.appRecovery<br>类名: SaveModeFlag<br>方法 or 属性: SAVE_WITH_SHARED_MEMORY = 0x0002|@ohos.app.ability.appRecovery.d.ts| +|新增|NA|模块名: ohos.app.ability.appRecovery<br>类名: appRecovery<br>方法 or 属性: function enableAppRecovery(restart?: RestartFlag, saveOccasion?: SaveOccasionFlag, saveMode?: SaveModeFlag) : void;|@ohos.app.ability.appRecovery.d.ts| +|新增|NA|模块名: ohos.app.ability.appRecovery<br>类名: appRecovery<br>方法 or 属性: function restartApp(): void;|@ohos.app.ability.appRecovery.d.ts| +|新增|NA|模块名: ohos.app.ability.appRecovery<br>类名: appRecovery<br>方法 or 属性: function saveAppState(): boolean;|@ohos.app.ability.appRecovery.d.ts| +|新增|NA|模块名: ohos.app.ability.common<br>类名: common|@ohos.app.ability.common.d.ts| +|新增|NA|模块名: ohos.app.ability.Configuration<br>类名: Configuration|@ohos.app.ability.Configuration.d.ts| +|新增|NA|模块名: ohos.app.ability.Configuration<br>类名: Configuration<br>方法 or 属性: language?: string;|@ohos.app.ability.Configuration.d.ts| +|新增|NA|模块名: ohos.app.ability.Configuration<br>类名: Configuration<br>方法 or 属性: colorMode?: ConfigurationConstant.ColorMode;|@ohos.app.ability.Configuration.d.ts| +|新增|NA|模块名: ohos.app.ability.Configuration<br>类名: Configuration<br>方法 or 属性: direction?: ConfigurationConstant.Direction;|@ohos.app.ability.Configuration.d.ts| +|新增|NA|模块名: ohos.app.ability.Configuration<br>类名: Configuration<br>方法 or 属性: screenDensity?: ConfigurationConstant.ScreenDensity;|@ohos.app.ability.Configuration.d.ts| +|新增|NA|模块名: ohos.app.ability.Configuration<br>类名: Configuration<br>方法 or 属性: displayId?: number;|@ohos.app.ability.Configuration.d.ts| +|新增|NA|模块名: ohos.app.ability.Configuration<br>类名: Configuration<br>方法 or 属性: hasPointerDevice?: boolean;|@ohos.app.ability.Configuration.d.ts| +|新增|NA|模块名: ohos.app.ability.ConfigurationConstant<br>类名: ConfigurationConstant|@ohos.app.ability.ConfigurationConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.ConfigurationConstant<br>类名: ColorMode|@ohos.app.ability.ConfigurationConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.ConfigurationConstant<br>类名: ColorMode<br>方法 or 属性: COLOR_MODE_NOT_SET = -1|@ohos.app.ability.ConfigurationConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.ConfigurationConstant<br>类名: ColorMode<br>方法 or 属性: COLOR_MODE_DARK = 0|@ohos.app.ability.ConfigurationConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.ConfigurationConstant<br>类名: ColorMode<br>方法 or 属性: COLOR_MODE_LIGHT = 1|@ohos.app.ability.ConfigurationConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.ConfigurationConstant<br>类名: Direction|@ohos.app.ability.ConfigurationConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.ConfigurationConstant<br>类名: Direction<br>方法 or 属性: DIRECTION_NOT_SET = -1|@ohos.app.ability.ConfigurationConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.ConfigurationConstant<br>类名: Direction<br>方法 or 属性: DIRECTION_VERTICAL = 0|@ohos.app.ability.ConfigurationConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.ConfigurationConstant<br>类名: Direction<br>方法 or 属性: DIRECTION_HORIZONTAL = 1|@ohos.app.ability.ConfigurationConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.ConfigurationConstant<br>类名: ScreenDensity|@ohos.app.ability.ConfigurationConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.ConfigurationConstant<br>类名: ScreenDensity<br>方法 or 属性: SCREEN_DENSITY_NOT_SET = 0|@ohos.app.ability.ConfigurationConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.ConfigurationConstant<br>类名: ScreenDensity<br>方法 or 属性: SCREEN_DENSITY_SDPI = 120|@ohos.app.ability.ConfigurationConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.ConfigurationConstant<br>类名: ScreenDensity<br>方法 or 属性: SCREEN_DENSITY_MDPI = 160|@ohos.app.ability.ConfigurationConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.ConfigurationConstant<br>类名: ScreenDensity<br>方法 or 属性: SCREEN_DENSITY_LDPI = 240|@ohos.app.ability.ConfigurationConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.ConfigurationConstant<br>类名: ScreenDensity<br>方法 or 属性: SCREEN_DENSITY_XLDPI = 320|@ohos.app.ability.ConfigurationConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.ConfigurationConstant<br>类名: ScreenDensity<br>方法 or 属性: SCREEN_DENSITY_XXLDPI = 480|@ohos.app.ability.ConfigurationConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.ConfigurationConstant<br>类名: ScreenDensity<br>方法 or 属性: SCREEN_DENSITY_XXXLDPI = 640|@ohos.app.ability.ConfigurationConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.contextConstant<br>类名: contextConstant|@ohos.app.ability.contextConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.contextConstant<br>类名: AreaMode|@ohos.app.ability.contextConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.contextConstant<br>类名: AreaMode<br>方法 or 属性: EL1 = 0|@ohos.app.ability.contextConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.contextConstant<br>类名: AreaMode<br>方法 or 属性: EL2 = 1|@ohos.app.ability.contextConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.dataUriUtils<br>类名: dataUriUtils|@ohos.app.ability.dataUriUtils.d.ts| +|新增|NA|模块名: ohos.app.ability.dataUriUtils<br>类名: dataUriUtils<br>方法 or 属性: function getId(uri: string): number|@ohos.app.ability.dataUriUtils.d.ts| +|新增|NA|模块名: ohos.app.ability.dataUriUtils<br>类名: dataUriUtils<br>方法 or 属性: function attachId(uri: string, id: number): string|@ohos.app.ability.dataUriUtils.d.ts| +|新增|NA|模块名: ohos.app.ability.dataUriUtils<br>类名: dataUriUtils<br>方法 or 属性: function deleteId(uri: string): string|@ohos.app.ability.dataUriUtils.d.ts| +|新增|NA|模块名: ohos.app.ability.dataUriUtils<br>类名: dataUriUtils<br>方法 or 属性: function updateId(uri: string, id: number): string|@ohos.app.ability.dataUriUtils.d.ts| +|新增|NA|模块名: ohos.app.ability.dialogRequest<br>类名: dialogRequest|@ohos.app.ability.dialogRequest.d.ts| +|新增|NA|模块名: ohos.app.ability.dialogRequest<br>类名: RequestInfo|@ohos.app.ability.dialogRequest.d.ts| +|新增|NA|模块名: ohos.app.ability.dialogRequest<br>类名: ResultCode|@ohos.app.ability.dialogRequest.d.ts| +|新增|NA|模块名: ohos.app.ability.dialogRequest<br>类名: ResultCode<br>方法 or 属性: RESULT_OK = 0|@ohos.app.ability.dialogRequest.d.ts| +|新增|NA|模块名: ohos.app.ability.dialogRequest<br>类名: ResultCode<br>方法 or 属性: RESULT_CANCEL = 1|@ohos.app.ability.dialogRequest.d.ts| +|新增|NA|模块名: ohos.app.ability.dialogRequest<br>类名: RequestResult|@ohos.app.ability.dialogRequest.d.ts| +|新增|NA|模块名: ohos.app.ability.dialogRequest<br>类名: RequestResult<br>方法 or 属性: result: ResultCode;|@ohos.app.ability.dialogRequest.d.ts| +|新增|NA|模块名: ohos.app.ability.dialogRequest<br>类名: RequestCallback|@ohos.app.ability.dialogRequest.d.ts| +|新增|NA|模块名: ohos.app.ability.dialogRequest<br>类名: RequestCallback<br>方法 or 属性: setRequestResult(result: RequestResult): void;|@ohos.app.ability.dialogRequest.d.ts| +|新增|NA|模块名: ohos.app.ability.dialogRequest<br>类名: dialogRequest<br>方法 or 属性: function getRequestInfo(want: Want): RequestInfo;|@ohos.app.ability.dialogRequest.d.ts| +|新增|NA|模块名: ohos.app.ability.dialogRequest<br>类名: dialogRequest<br>方法 or 属性: function getRequestCallback(want: Want): RequestCallback;|@ohos.app.ability.dialogRequest.d.ts| +|新增|NA|模块名: ohos.app.ability.EnvironmentCallback<br>类名: EnvironmentCallback|@ohos.app.ability.EnvironmentCallback.d.ts| +|新增|NA|模块名: ohos.app.ability.EnvironmentCallback<br>类名: EnvironmentCallback<br>方法 or 属性: onConfigurationUpdated(config: Configuration): void;|@ohos.app.ability.EnvironmentCallback.d.ts| +|新增|NA|模块名: ohos.app.ability.EnvironmentCallback<br>类名: EnvironmentCallback<br>方法 or 属性: onMemoryLevel(level: AbilityConstant.MemoryLevel): void;|@ohos.app.ability.EnvironmentCallback.d.ts| +|新增|NA|模块名: ohos.app.ability.errorManager<br>类名: errorManager|@ohos.app.ability.errorManager.d.ts| +|新增|NA|模块名: ohos.app.ability.errorManager<br>类名: errorManager<br>方法 or 属性: function on(type: "error", observer: ErrorObserver): number;|@ohos.app.ability.errorManager.d.ts| +|新增|NA|模块名: ohos.app.ability.errorManager<br>类名: errorManager<br>方法 or 属性: function off(type: "error", observerId: number, callback: AsyncCallback\<void>): void;|@ohos.app.ability.errorManager.d.ts| +|新增|NA|模块名: ohos.app.ability.errorManager<br>类名: errorManager<br>方法 or 属性: function off(type: "error", observerId: number): Promise\<void>;|@ohos.app.ability.errorManager.d.ts| +|新增|NA|模块名: ohos.app.ability.ExtensionAbility<br>类名: ExtensionAbility|@ohos.app.ability.ExtensionAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.missionManager<br>类名: missionManager|@ohos.app.ability.missionManager.d.ts| +|新增|NA|模块名: ohos.app.ability.missionManager<br>类名: missionManager<br>方法 or 属性: function on(type: "mission", listener: MissionListener): number;|@ohos.app.ability.missionManager.d.ts| +|新增|NA|模块名: ohos.app.ability.missionManager<br>类名: missionManager<br>方法 or 属性: function off(type: "mission", listenerId: number, callback: AsyncCallback\<void>): void;|@ohos.app.ability.missionManager.d.ts| +|新增|NA|模块名: ohos.app.ability.missionManager<br>类名: missionManager<br>方法 or 属性: function off(type: "mission", listenerId: number): Promise\<void>;|@ohos.app.ability.missionManager.d.ts| +|新增|NA|模块名: ohos.app.ability.missionManager<br>类名: missionManager<br>方法 or 属性: function getMissionInfo(deviceId: string, missionId: number, callback: AsyncCallback\<MissionInfo>): void;|@ohos.app.ability.missionManager.d.ts| +|新增|NA|模块名: ohos.app.ability.missionManager<br>类名: missionManager<br>方法 or 属性: function getMissionInfo(deviceId: string, missionId: number): Promise\<MissionInfo>;|@ohos.app.ability.missionManager.d.ts| +|新增|NA|模块名: ohos.app.ability.missionManager<br>类名: missionManager<br>方法 or 属性: function getMissionInfos(deviceId: string, numMax: number, callback: AsyncCallback\<Array\<MissionInfo>>): void;|@ohos.app.ability.missionManager.d.ts| +|新增|NA|模块名: ohos.app.ability.missionManager<br>类名: missionManager<br>方法 or 属性: function getMissionInfos(deviceId: string, numMax: number): Promise\<Array\<MissionInfo>>;|@ohos.app.ability.missionManager.d.ts| +|新增|NA|模块名: ohos.app.ability.missionManager<br>类名: missionManager<br>方法 or 属性: function getMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback\<MissionSnapshot>): void;|@ohos.app.ability.missionManager.d.ts| +|新增|NA|模块名: ohos.app.ability.missionManager<br>类名: missionManager<br>方法 or 属性: function getMissionSnapShot(deviceId: string, missionId: number): Promise\<MissionSnapshot>;|@ohos.app.ability.missionManager.d.ts| +|新增|NA|模块名: ohos.app.ability.missionManager<br>类名: missionManager<br>方法 or 属性: function getLowResolutionMissionSnapShot(deviceId: string, missionId: number, callback: AsyncCallback\<MissionSnapshot>): void;|@ohos.app.ability.missionManager.d.ts| +|新增|NA|模块名: ohos.app.ability.missionManager<br>类名: missionManager<br>方法 or 属性: function getLowResolutionMissionSnapShot(deviceId: string, missionId: number): Promise\<MissionSnapshot>;|@ohos.app.ability.missionManager.d.ts| +|新增|NA|模块名: ohos.app.ability.missionManager<br>类名: missionManager<br>方法 or 属性: function lockMission(missionId: number, callback: AsyncCallback\<void>): void;|@ohos.app.ability.missionManager.d.ts| +|新增|NA|模块名: ohos.app.ability.missionManager<br>类名: missionManager<br>方法 or 属性: function lockMission(missionId: number): Promise\<void>;|@ohos.app.ability.missionManager.d.ts| +|新增|NA|模块名: ohos.app.ability.missionManager<br>类名: missionManager<br>方法 or 属性: function unlockMission(missionId: number, callback: AsyncCallback\<void>): void;|@ohos.app.ability.missionManager.d.ts| +|新增|NA|模块名: ohos.app.ability.missionManager<br>类名: missionManager<br>方法 or 属性: function unlockMission(missionId: number): Promise\<void>;|@ohos.app.ability.missionManager.d.ts| +|新增|NA|模块名: ohos.app.ability.missionManager<br>类名: missionManager<br>方法 or 属性: function clearMission(missionId: number, callback: AsyncCallback\<void>): void;|@ohos.app.ability.missionManager.d.ts| +|新增|NA|模块名: ohos.app.ability.missionManager<br>类名: missionManager<br>方法 or 属性: function clearMission(missionId: number): Promise\<void>;|@ohos.app.ability.missionManager.d.ts| +|新增|NA|模块名: ohos.app.ability.missionManager<br>类名: missionManager<br>方法 or 属性: function clearAllMissions(callback: AsyncCallback\<void>): void;|@ohos.app.ability.missionManager.d.ts| +|新增|NA|模块名: ohos.app.ability.missionManager<br>类名: missionManager<br>方法 or 属性: function clearAllMissions(): Promise\<void>;|@ohos.app.ability.missionManager.d.ts| +|新增|NA|模块名: ohos.app.ability.missionManager<br>类名: missionManager<br>方法 or 属性: function moveMissionToFront(missionId: number, callback: AsyncCallback\<void>): void;|@ohos.app.ability.missionManager.d.ts| +|新增|NA|模块名: ohos.app.ability.missionManager<br>类名: missionManager<br>方法 or 属性: function moveMissionToFront(missionId: number, options: StartOptions, callback: AsyncCallback\<void>): void;|@ohos.app.ability.missionManager.d.ts| +|新增|NA|模块名: ohos.app.ability.missionManager<br>类名: missionManager<br>方法 or 属性: function moveMissionToFront(missionId: number, options?: StartOptions): Promise\<void>;|@ohos.app.ability.missionManager.d.ts| +|新增|NA|模块名: ohos.app.ability.quickFixManager<br>类名: quickFixManager|@ohos.app.ability.quickFixManager.d.ts| +|新增|NA|模块名: ohos.app.ability.quickFixManager<br>类名: HapModuleQuickFixInfo|@ohos.app.ability.quickFixManager.d.ts| +|新增|NA|模块名: ohos.app.ability.quickFixManager<br>类名: HapModuleQuickFixInfo<br>方法 or 属性: readonly moduleName: string;|@ohos.app.ability.quickFixManager.d.ts| +|新增|NA|模块名: ohos.app.ability.quickFixManager<br>类名: HapModuleQuickFixInfo<br>方法 or 属性: readonly originHapHash: string;|@ohos.app.ability.quickFixManager.d.ts| +|新增|NA|模块名: ohos.app.ability.quickFixManager<br>类名: HapModuleQuickFixInfo<br>方法 or 属性: readonly quickFixFilePath: string;|@ohos.app.ability.quickFixManager.d.ts| +|新增|NA|模块名: ohos.app.ability.quickFixManager<br>类名: ApplicationQuickFixInfo|@ohos.app.ability.quickFixManager.d.ts| +|新增|NA|模块名: ohos.app.ability.quickFixManager<br>类名: ApplicationQuickFixInfo<br>方法 or 属性: readonly bundleName: string;|@ohos.app.ability.quickFixManager.d.ts| +|新增|NA|模块名: ohos.app.ability.quickFixManager<br>类名: ApplicationQuickFixInfo<br>方法 or 属性: readonly bundleVersionCode: number;|@ohos.app.ability.quickFixManager.d.ts| +|新增|NA|模块名: ohos.app.ability.quickFixManager<br>类名: ApplicationQuickFixInfo<br>方法 or 属性: readonly bundleVersionName: string;|@ohos.app.ability.quickFixManager.d.ts| +|新增|NA|模块名: ohos.app.ability.quickFixManager<br>类名: ApplicationQuickFixInfo<br>方法 or 属性: readonly quickFixVersionCode: number;|@ohos.app.ability.quickFixManager.d.ts| +|新增|NA|模块名: ohos.app.ability.quickFixManager<br>类名: ApplicationQuickFixInfo<br>方法 or 属性: readonly quickFixVersionName: string;|@ohos.app.ability.quickFixManager.d.ts| +|新增|NA|模块名: ohos.app.ability.quickFixManager<br>类名: ApplicationQuickFixInfo<br>方法 or 属性: readonly hapModuleQuickFixInfo: Array\<HapModuleQuickFixInfo>;|@ohos.app.ability.quickFixManager.d.ts| +|新增|NA|模块名: ohos.app.ability.quickFixManager<br>类名: quickFixManager<br>方法 or 属性: function applyQuickFix(hapModuleQuickFixFiles: Array\<string>, callback: AsyncCallback\<void>): void;|@ohos.app.ability.quickFixManager.d.ts| +|新增|NA|模块名: ohos.app.ability.quickFixManager<br>类名: quickFixManager<br>方法 or 属性: function applyQuickFix(hapModuleQuickFixFiles: Array\<string>): Promise\<void>;|@ohos.app.ability.quickFixManager.d.ts| +|新增|NA|模块名: ohos.app.ability.quickFixManager<br>类名: quickFixManager<br>方法 or 属性: function getApplicationQuickFixInfo(bundleName: string, callback: AsyncCallback\<ApplicationQuickFixInfo>): void;|@ohos.app.ability.quickFixManager.d.ts| +|新增|NA|模块名: ohos.app.ability.quickFixManager<br>类名: quickFixManager<br>方法 or 属性: function getApplicationQuickFixInfo(bundleName: string): Promise\<ApplicationQuickFixInfo>;|@ohos.app.ability.quickFixManager.d.ts| +|新增|NA|模块名: ohos.app.ability.ServiceExtensionAbility<br>类名: ServiceExtensionAbility|@ohos.app.ability.ServiceExtensionAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.ServiceExtensionAbility<br>类名: ServiceExtensionAbility<br>方法 or 属性: context: ServiceExtensionContext;|@ohos.app.ability.ServiceExtensionAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.ServiceExtensionAbility<br>类名: ServiceExtensionAbility<br>方法 or 属性: onCreate(want: Want): void;|@ohos.app.ability.ServiceExtensionAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.ServiceExtensionAbility<br>类名: ServiceExtensionAbility<br>方法 or 属性: onDestroy(): void;|@ohos.app.ability.ServiceExtensionAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.ServiceExtensionAbility<br>类名: ServiceExtensionAbility<br>方法 or 属性: onRequest(want: Want, startId: number): void;|@ohos.app.ability.ServiceExtensionAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.ServiceExtensionAbility<br>类名: ServiceExtensionAbility<br>方法 or 属性: onConnect(want: Want): rpc.RemoteObject \| Promise\<rpc.RemoteObject>;|@ohos.app.ability.ServiceExtensionAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.ServiceExtensionAbility<br>类名: ServiceExtensionAbility<br>方法 or 属性: onDisconnect(want: Want): void \| Promise\<void>;|@ohos.app.ability.ServiceExtensionAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.ServiceExtensionAbility<br>类名: ServiceExtensionAbility<br>方法 or 属性: onReconnect(want: Want): void;|@ohos.app.ability.ServiceExtensionAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.ServiceExtensionAbility<br>类名: ServiceExtensionAbility<br>方法 or 属性: onConfigurationUpdate(newConfig: Configuration): void;|@ohos.app.ability.ServiceExtensionAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.ServiceExtensionAbility<br>类名: ServiceExtensionAbility<br>方法 or 属性: onDump(params: Array\<string>): Array\<string>;|@ohos.app.ability.ServiceExtensionAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.StartOptions<br>类名: StartOptions|@ohos.app.ability.StartOptions.d.ts| +|新增|NA|模块名: ohos.app.ability.StartOptions<br>类名: StartOptions<br>方法 or 属性: windowMode?: number;|@ohos.app.ability.StartOptions.d.ts| +|新增|NA|模块名: ohos.app.ability.StartOptions<br>类名: StartOptions<br>方法 or 属性: displayId?: number;|@ohos.app.ability.StartOptions.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: OnReleaseCallback|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: OnReleaseCallback<br>方法 or 属性: (msg: string): void;|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: CalleeCallback|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: CalleeCallback<br>方法 or 属性: (indata: rpc.MessageSequence): rpc.Parcelable;|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: Caller|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: Caller<br>方法 or 属性: call(method: string, data: rpc.Parcelable): Promise\<void>;|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: Caller<br>方法 or 属性: callWithResult(method: string, data: rpc.Parcelable): Promise\<rpc.MessageSequence>;|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: Caller<br>方法 or 属性: release(): void;|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: Caller<br>方法 or 属性: onRelease(callback: OnReleaseCallback): void;|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: Caller<br>方法 or 属性: on(type: "release", callback: OnReleaseCallback): void;|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: Caller<br>方法 or 属性: off(type: "release", callback: OnReleaseCallback): void;|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: Caller<br>方法 or 属性: off(type: "release"): void;|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: Callee|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: Callee<br>方法 or 属性: on(method: string, callback: CalleeCallback): void;|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: Callee<br>方法 or 属性: off(method: string): void;|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: UIAbility|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: UIAbility<br>方法 or 属性: context: UIAbilityContext;|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: UIAbility<br>方法 or 属性: launchWant: Want;|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: UIAbility<br>方法 or 属性: lastRequestWant: Want;|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: UIAbility<br>方法 or 属性: callee: Callee;|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: UIAbility<br>方法 or 属性: onCreate(want: Want, param: AbilityConstant.LaunchParam): void;|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: UIAbility<br>方法 or 属性: onWindowStageCreate(windowStage: window.WindowStage): void;|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: UIAbility<br>方法 or 属性: onWindowStageDestroy(): void;|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: UIAbility<br>方法 or 属性: onWindowStageRestore(windowStage: window.WindowStage): void;|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: UIAbility<br>方法 or 属性: onDestroy(): void \| Promise\<void>;|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: UIAbility<br>方法 or 属性: onForeground(): void;|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: UIAbility<br>方法 or 属性: onBackground(): void;|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: UIAbility<br>方法 or 属性: onContinue(wantParam: { [key: string]: Object }): AbilityConstant.OnContinueResult;|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: UIAbility<br>方法 or 属性: onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void;|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: UIAbility<br>方法 or 属性: onDump(params: Array\<string>): Array\<string>;|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.UIAbility<br>类名: UIAbility<br>方法 or 属性: onSaveState(reason: AbilityConstant.StateType, wantParam : {[key: string]: Object}): AbilityConstant.OnSaveResult;|@ohos.app.ability.UIAbility.d.ts| +|新增|NA|模块名: ohos.app.ability.Want<br>类名: Want|@ohos.app.ability.Want.d.ts| +|新增|NA|模块名: ohos.app.ability.Want<br>类名: Want<br>方法 or 属性: bundleName?: string;|@ohos.app.ability.Want.d.ts| +|新增|NA|模块名: ohos.app.ability.Want<br>类名: Want<br>方法 or 属性: abilityName?: string;|@ohos.app.ability.Want.d.ts| +|新增|NA|模块名: ohos.app.ability.Want<br>类名: Want<br>方法 or 属性: deviceId?: string;|@ohos.app.ability.Want.d.ts| +|新增|NA|模块名: ohos.app.ability.Want<br>类名: Want<br>方法 or 属性: uri?: string;|@ohos.app.ability.Want.d.ts| +|新增|NA|模块名: ohos.app.ability.Want<br>类名: Want<br>方法 or 属性: type?: string;|@ohos.app.ability.Want.d.ts| +|新增|NA|模块名: ohos.app.ability.Want<br>类名: Want<br>方法 or 属性: flags?: number;|@ohos.app.ability.Want.d.ts| +|新增|NA|模块名: ohos.app.ability.Want<br>类名: Want<br>方法 or 属性: action?: string;|@ohos.app.ability.Want.d.ts| +|新增|NA|模块名: ohos.app.ability.Want<br>类名: Want<br>方法 or 属性: parameters?: {[key: string]: Object};|@ohos.app.ability.Want.d.ts| +|新增|NA|模块名: ohos.app.ability.Want<br>类名: Want<br>方法 or 属性: entities?: Array\<string>;|@ohos.app.ability.Want.d.ts| +|新增|NA|模块名: ohos.app.ability.Want<br>类名: Want<br>方法 or 属性: moduleName?: string;|@ohos.app.ability.Want.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: wantAgent|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: wantAgent<br>方法 or 属性: function getBundleName(agent: WantAgent, callback: AsyncCallback\<string>): void;|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: wantAgent<br>方法 or 属性: function getBundleName(agent: WantAgent): Promise\<string>;|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: wantAgent<br>方法 or 属性: function getUid(agent: WantAgent, callback: AsyncCallback\<number>): void;|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: wantAgent<br>方法 or 属性: function getUid(agent: WantAgent): Promise\<number>;|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: wantAgent<br>方法 or 属性: function getWant(agent: WantAgent, callback: AsyncCallback\<Want>): void;|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: wantAgent<br>方法 or 属性: function getWant(agent: WantAgent): Promise\<Want>;|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: wantAgent<br>方法 or 属性: function cancel(agent: WantAgent, callback: AsyncCallback\<void>): void;|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: wantAgent<br>方法 or 属性: function cancel(agent: WantAgent): Promise\<void>;|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: wantAgent<br>方法 or 属性: function trigger(agent: WantAgent, triggerInfo: TriggerInfo, callback?: AsyncCallback\<CompleteData>): void;|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: wantAgent<br>方法 or 属性: function equal(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback\<boolean>): void;|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: wantAgent<br>方法 or 属性: function equal(agent: WantAgent, otherAgent: WantAgent): Promise\<boolean>;|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: wantAgent<br>方法 or 属性: function getWantAgent(info: WantAgentInfo, callback: AsyncCallback\<WantAgent>): void;|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: wantAgent<br>方法 or 属性: function getWantAgent(info: WantAgentInfo): Promise\<WantAgent>;|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: wantAgent<br>方法 or 属性: function getOperationType(agent: WantAgent, callback: AsyncCallback\<number>): void;|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: wantAgent<br>方法 or 属性: function getOperationType(agent: WantAgent): Promise\<number>;|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: WantAgentFlags|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: WantAgentFlags<br>方法 or 属性: ONE_TIME_FLAG = 0|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: WantAgentFlags<br>方法 or 属性: NO_BUILD_FLAG|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: WantAgentFlags<br>方法 or 属性: CANCEL_PRESENT_FLAG|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: WantAgentFlags<br>方法 or 属性: UPDATE_PRESENT_FLAG|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: WantAgentFlags<br>方法 or 属性: CONSTANT_FLAG|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: WantAgentFlags<br>方法 or 属性: REPLACE_ELEMENT|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: WantAgentFlags<br>方法 or 属性: REPLACE_ACTION|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: WantAgentFlags<br>方法 or 属性: REPLACE_URI|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: WantAgentFlags<br>方法 or 属性: REPLACE_ENTITIES|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: WantAgentFlags<br>方法 or 属性: REPLACE_BUNDLE|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: OperationType|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: OperationType<br>方法 or 属性: UNKNOWN_TYPE = 0|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: OperationType<br>方法 or 属性: START_ABILITY|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: OperationType<br>方法 or 属性: START_ABILITIES|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: OperationType<br>方法 or 属性: START_SERVICE|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: OperationType<br>方法 or 属性: SEND_COMMON_EVENT|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: CompleteData|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: CompleteData<br>方法 or 属性: info: WantAgent;|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: CompleteData<br>方法 or 属性: want: Want;|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: CompleteData<br>方法 or 属性: finalCode: number;|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: CompleteData<br>方法 or 属性: finalData: string;|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantAgent<br>类名: CompleteData<br>方法 or 属性: extraInfo?: { [key: string]: Object };|@ohos.app.ability.wantAgent.d.ts| +|新增|NA|模块名: ohos.app.ability.wantConstant<br>类名: wantConstant|@ohos.app.ability.wantConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.wantConstant<br>类名: Params|@ohos.app.ability.wantConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.wantConstant<br>类名: Params<br>方法 or 属性: DLP_PARAMS_SANDBOX = "ohos.dlp.params.sandbox"|@ohos.app.ability.wantConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.wantConstant<br>类名: Params<br>方法 or 属性: DLP_PARAMS_BUNDLE_NAME = "ohos.dlp.params.bundleName"|@ohos.app.ability.wantConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.wantConstant<br>类名: Params<br>方法 or 属性: DLP_PARAMS_MODULE_NAME = "ohos.dlp.params.moduleName"|@ohos.app.ability.wantConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.wantConstant<br>类名: Params<br>方法 or 属性: DLP_PARAMS_ABILITY_NAME = "ohos.dlp.params.abilityName"|@ohos.app.ability.wantConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.wantConstant<br>类名: Params<br>方法 or 属性: DLP_PARAMS_INDEX = "ohos.dlp.params.index"|@ohos.app.ability.wantConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.wantConstant<br>类名: Params<br>方法 or 属性: ABILITY_BACK_TO_OTHER_MISSION_STACK = "ability.params.backToOtherMissionStack"|@ohos.app.ability.wantConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.wantConstant<br>类名: Flags|@ohos.app.ability.wantConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.wantConstant<br>类名: Flags<br>方法 or 属性: FLAG_AUTH_READ_URI_PERMISSION = 0x00000001|@ohos.app.ability.wantConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.wantConstant<br>类名: Flags<br>方法 or 属性: FLAG_AUTH_WRITE_URI_PERMISSION = 0x00000002|@ohos.app.ability.wantConstant.d.ts| +|新增|NA|模块名: ohos.app.ability.wantConstant<br>类名: Flags<br>方法 or 属性: FLAG_INSTALL_ON_DEMAND = 0x00000800|@ohos.app.ability.wantConstant.d.ts| +|新增|NA|模块名: ohos.app.form.formBindingData<br>类名: formBindingData|@ohos.app.form.formBindingData.d.ts| +|新增|NA|模块名: ohos.app.form.formBindingData<br>类名: formBindingData<br>方法 or 属性: function createFormBindingData(obj?: Object \| string): FormBindingData;|@ohos.app.form.formBindingData.d.ts| +|新增|NA|模块名: ohos.app.form.formBindingData<br>类名: FormBindingData|@ohos.app.form.formBindingData.d.ts| +|新增|NA|模块名: ohos.app.form.formBindingData<br>类名: FormBindingData<br>方法 or 属性: data: Object|@ohos.app.form.formBindingData.d.ts| +|新增|NA|模块名: ohos.app.form.FormExtensionAbility<br>类名: FormExtensionAbility|@ohos.app.form.FormExtensionAbility.d.ts| +|新增|NA|模块名: ohos.app.form.FormExtensionAbility<br>类名: FormExtensionAbility<br>方法 or 属性: context: FormExtensionContext;|@ohos.app.form.FormExtensionAbility.d.ts| +|新增|NA|模块名: ohos.app.form.FormExtensionAbility<br>类名: FormExtensionAbility<br>方法 or 属性: onAddForm(want: Want): formBindingData.FormBindingData;|@ohos.app.form.FormExtensionAbility.d.ts| +|新增|NA|模块名: ohos.app.form.FormExtensionAbility<br>类名: FormExtensionAbility<br>方法 or 属性: onCastToNormalForm(formId: string): void;|@ohos.app.form.FormExtensionAbility.d.ts| +|新增|NA|模块名: ohos.app.form.FormExtensionAbility<br>类名: FormExtensionAbility<br>方法 or 属性: onUpdateForm(formId: string): void;|@ohos.app.form.FormExtensionAbility.d.ts| +|新增|NA|模块名: ohos.app.form.FormExtensionAbility<br>类名: FormExtensionAbility<br>方法 or 属性: onChangeFormVisibility(newStatus: { [key: string]: number }): void;|@ohos.app.form.FormExtensionAbility.d.ts| +|新增|NA|模块名: ohos.app.form.FormExtensionAbility<br>类名: FormExtensionAbility<br>方法 or 属性: onFormEvent(formId: string, message: string): void;|@ohos.app.form.FormExtensionAbility.d.ts| +|新增|NA|模块名: ohos.app.form.FormExtensionAbility<br>类名: FormExtensionAbility<br>方法 or 属性: onRemoveForm(formId: string): void;|@ohos.app.form.FormExtensionAbility.d.ts| +|新增|NA|模块名: ohos.app.form.FormExtensionAbility<br>类名: FormExtensionAbility<br>方法 or 属性: onConfigurationUpdate(newConfig: Configuration): void;|@ohos.app.form.FormExtensionAbility.d.ts| +|新增|NA|模块名: ohos.app.form.FormExtensionAbility<br>类名: FormExtensionAbility<br>方法 or 属性: onAcquireFormState?(want: Want): formInfo.FormState;|@ohos.app.form.FormExtensionAbility.d.ts| +|新增|NA|模块名: ohos.app.form.FormExtensionAbility<br>类名: FormExtensionAbility<br>方法 or 属性: onShareForm?(formId: string): { [key: string]: Object };|@ohos.app.form.FormExtensionAbility.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function deleteForm(formId: string, callback: AsyncCallback\<void>): void;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function deleteForm(formId: string): Promise\<void>;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function releaseForm(formId: string, callback: AsyncCallback\<void>): void;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function releaseForm(formId: string, isReleaseCache: boolean, callback: AsyncCallback\<void>): void;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function releaseForm(formId: string, isReleaseCache?: boolean): Promise\<void>;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function requestForm(formId: string, callback: AsyncCallback\<void>): void;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function requestForm(formId: string): Promise\<void>;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function castToNormalForm(formId: string, callback: AsyncCallback\<void>): void;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function castToNormalForm(formId: string): Promise\<void>;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function notifyVisibleForms(formIds: Array\<string>, callback: AsyncCallback\<void>): void;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function notifyVisibleForms(formIds: Array\<string>): Promise\<void>;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function notifyInvisibleForms(formIds: Array\<string>, callback: AsyncCallback\<void>): void;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function notifyInvisibleForms(formIds: Array\<string>): Promise\<void>;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function enableFormsUpdate(formIds: Array\<string>, callback: AsyncCallback\<void>): void;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function enableFormsUpdate(formIds: Array\<string>): Promise\<void>;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function disableFormsUpdate(formIds: Array\<string>, callback: AsyncCallback\<void>): void;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function disableFormsUpdate(formIds: Array\<string>): Promise\<void>;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function isSystemReady(callback: AsyncCallback\<void>): void;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function isSystemReady(): Promise\<void>;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function getAllFormsInfo(callback: AsyncCallback\<Array\<formInfo.FormInfo>>): void;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function getAllFormsInfo(): Promise\<Array\<formInfo.FormInfo>>;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function getFormsInfo(bundleName: string, callback: AsyncCallback\<Array\<formInfo.FormInfo>>): void;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function getFormsInfo(bundleName: string, moduleName: string, callback: AsyncCallback\<Array\<formInfo.FormInfo>>): void;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function getFormsInfo(bundleName: string, moduleName?: string): Promise\<Array\<formInfo.FormInfo>>;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function deleteInvalidForms(formIds: Array\<string>, callback: AsyncCallback\<number>): void;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function deleteInvalidForms(formIds: Array\<string>): Promise\<number>;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function acquireFormState(want: Want, callback: AsyncCallback\<formInfo.FormStateInfo>): void;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function acquireFormState(want: Want): Promise\<formInfo.FormStateInfo>;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function on(type: "formUninstall", callback: Callback\<string>): void;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function off(type: "formUninstall", callback?: Callback\<string>): void;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function notifyFormsVisible(formIds: Array\<string>, isVisible: boolean, callback: AsyncCallback\<void>): void;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function notifyFormsVisible(formIds: Array\<string>, isVisible: boolean): Promise\<void>;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function notifyFormsEnableUpdate(formIds: Array\<string>, isEnableUpdate: boolean, callback: AsyncCallback\<void>): void;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function notifyFormsEnableUpdate(formIds: Array\<string>, isEnableUpdate: boolean): Promise\<void>;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function shareForm(formId: string, deviceId: string, callback: AsyncCallback\<void>): void;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function shareForm(formId: string, deviceId: string): Promise\<void>;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function notifyFormsPrivacyProtected(formIds: Array\<string>, isProtected: boolean, callback: AsyncCallback\<void>): void;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formHost<br>类名: formHost<br>方法 or 属性: function notifyFormsPrivacyProtected(formIds: Array\<string>, isProtected: boolean): Promise\<void>;|@ohos.app.form.formHost.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: formInfo|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormInfo|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormInfo<br>方法 or 属性: bundleName: string;|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormInfo<br>方法 or 属性: moduleName: string;|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormInfo<br>方法 or 属性: abilityName: string;|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormInfo<br>方法 or 属性: name: string;|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormInfo<br>方法 or 属性: description: string;|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormInfo<br>方法 or 属性: type: FormType;|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormInfo<br>方法 or 属性: jsComponentName: string;|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormInfo<br>方法 or 属性: colorMode: ColorMode;|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormInfo<br>方法 or 属性: isDefault: boolean;|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormInfo<br>方法 or 属性: updateEnabled: boolean;|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormInfo<br>方法 or 属性: formVisibleNotify: boolean;|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormInfo<br>方法 or 属性: scheduledUpdateTime: string;|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormInfo<br>方法 or 属性: formConfigAbility: string;|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormInfo<br>方法 or 属性: updateDuration: number;|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormInfo<br>方法 or 属性: defaultDimension: number;|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormInfo<br>方法 or 属性: supportDimensions: Array\<number>;|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormInfo<br>方法 or 属性: customizeData: {[key: string]: [value: string]};|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormType|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormType<br>方法 or 属性: JS = 1|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormType<br>方法 or 属性: eTS = 2|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: ColorMode|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: ColorMode<br>方法 or 属性: MODE_AUTO = -1|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: ColorMode<br>方法 or 属性: MODE_DARK = 0|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: ColorMode<br>方法 or 属性: MODE_LIGHT = 1|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormStateInfo|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormStateInfo<br>方法 or 属性: formState: FormState;|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormStateInfo<br>方法 or 属性: want: Want;|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormState|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormState<br>方法 or 属性: UNKNOWN = -1|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormState<br>方法 or 属性: DEFAULT = 0|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormState<br>方法 or 属性: READY = 1|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormParam|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormParam<br>方法 or 属性: IDENTITY_KEY = "ohos.extra.param.key.form_identity"|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormParam<br>方法 or 属性: DIMENSION_KEY = "ohos.extra.param.key.form_dimension"|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormParam<br>方法 or 属性: NAME_KEY = "ohos.extra.param.key.form_name"|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormParam<br>方法 or 属性: MODULE_NAME_KEY = "ohos.extra.param.key.module_name"|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormParam<br>方法 or 属性: WIDTH_KEY = "ohos.extra.param.key.form_width"|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormParam<br>方法 or 属性: HEIGHT_KEY = "ohos.extra.param.key.form_height"|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormParam<br>方法 or 属性: TEMPORARY_KEY = "ohos.extra.param.key.form_temporary"|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormParam<br>方法 or 属性: BUNDLE_NAME_KEY = "ohos.extra.param.key.bundle_name"|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormParam<br>方法 or 属性: ABILITY_NAME_KEY = "ohos.extra.param.key.ability_name"|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormParam<br>方法 or 属性: DEVICE_ID_KEY = "ohos.extra.param.key.device_id"|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormInfoFilter|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormInfoFilter<br>方法 or 属性: moduleName?: string;|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormDimension|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormDimension<br>方法 or 属性: Dimension_1_2 = 1|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormDimension<br>方法 or 属性: Dimension_2_2|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormDimension<br>方法 or 属性: Dimension_2_4|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormDimension<br>方法 or 属性: Dimension_4_4|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: FormDimension<br>方法 or 属性: Dimension_2_1|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: VisibilityType|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: VisibilityType<br>方法 or 属性: FORM_VISIBLE = 1|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formInfo<br>类名: VisibilityType<br>方法 or 属性: FORM_INVISIBLE|@ohos.app.form.formInfo.d.ts| +|新增|NA|模块名: ohos.app.form.formProvider<br>类名: formProvider|@ohos.app.form.formProvider.d.ts| +|新增|NA|模块名: ohos.app.form.formProvider<br>类名: formProvider<br>方法 or 属性: function setFormNextRefreshTime(formId: string, minute: number, callback: AsyncCallback\<void>): void;|@ohos.app.form.formProvider.d.ts| +|新增|NA|模块名: ohos.app.form.formProvider<br>类名: formProvider<br>方法 or 属性: function setFormNextRefreshTime(formId: string, minute: number): Promise\<void>;|@ohos.app.form.formProvider.d.ts| +|新增|NA|模块名: ohos.app.form.formProvider<br>类名: formProvider<br>方法 or 属性: function updateForm(formId: string, formBindingData: formBindingData.FormBindingData, callback: AsyncCallback\<void>): void;|@ohos.app.form.formProvider.d.ts| +|新增|NA|模块名: ohos.app.form.formProvider<br>类名: formProvider<br>方法 or 属性: function updateForm(formId: string, formBindingData: formBindingData.FormBindingData): Promise\<void>;|@ohos.app.form.formProvider.d.ts| +|新增|NA|模块名: ohos.app.form.formProvider<br>类名: formProvider<br>方法 or 属性: function getFormsInfo(filter: formInfo.FormInfoFilter, callback: AsyncCallback\<Array\<formInfo.FormInfo>>): void;|@ohos.app.form.formProvider.d.ts| +|新增|NA|模块名: ohos.app.form.formProvider<br>类名: formProvider<br>方法 or 属性: function getFormsInfo(callback: AsyncCallback\<Array\<formInfo.FormInfo>>): void;|@ohos.app.form.formProvider.d.ts| +|新增|NA|模块名: ohos.app.form.formProvider<br>类名: formProvider<br>方法 or 属性: function getFormsInfo(filter?: formInfo.FormInfoFilter): Promise\<Array\<formInfo.FormInfo>>;|@ohos.app.form.formProvider.d.ts| +|新增|NA|模块名: ohos.app.form.formProvider<br>类名: formProvider<br>方法 or 属性: function requestPublishForm(want: Want, formBindingData: formBindingData.FormBindingData, callback: AsyncCallback\<string>): void;|@ohos.app.form.formProvider.d.ts| +|新增|NA|模块名: ohos.app.form.formProvider<br>类名: formProvider<br>方法 or 属性: function requestPublishForm(want: Want, callback: AsyncCallback\<string>): void;|@ohos.app.form.formProvider.d.ts| +|新增|NA|模块名: ohos.app.form.formProvider<br>类名: formProvider<br>方法 or 属性: function requestPublishForm(want: Want, formBindingData?: formBindingData.FormBindingData): Promise\<string>;|@ohos.app.form.formProvider.d.ts| +|新增|NA|模块名: ohos.app.form.formProvider<br>类名: formProvider<br>方法 or 属性: function isRequestPublishFormSupported(callback: AsyncCallback\<boolean>): void;|@ohos.app.form.formProvider.d.ts| +|新增|NA|模块名: ohos.app.form.formProvider<br>类名: formProvider<br>方法 or 属性: function isRequestPublishFormSupported(): Promise\<boolean>;|@ohos.app.form.formProvider.d.ts| +|新增|NA|模块名: ohos.application.formError<br>类名: FormError<br>方法 or 属性: ERR_DISTRIBUTED_SCHEDULE_FAILED = 37|@ohos.application.formError.d.ts| +|新增|NA|模块名: ohos.application.StaticSubscriberExtensionAbility<br>类名: StaticSubscriberExtensionAbility|@ohos.application.StaticSubscriberExtensionAbility.d.ts| +|新增|NA|模块名: ohos.application.StaticSubscriberExtensionAbility<br>类名: StaticSubscriberExtensionAbility<br>方法 or 属性: onReceiveEvent(event: CommonEventData): void;|@ohos.application.StaticSubscriberExtensionAbility.d.ts| +|新增|NA|类名:continuationManager<br>方法or属性:function on(type: "deviceSelected", token: number, callback: Callback\<Array\<ContinuationResult>>): void;|@ohos.continuation.continuationManager.d.ts| +|新增|NA|类名:continuationManager<br>方法or属性:function off(type: "deviceSelected", token: number): void;|@ohos.continuation.continuationManager.d.ts| +|新增|NA|类名:continuationManager<br>方法or属性:function on(type: "deviceUnselected", token: number, callback: Callback\<Array\<ContinuationResult>>): void;|@ohos.continuation.continuationManager.d.ts| +|新增|NA|类名:continuationManager<br>方法or属性:function off(type: "deviceUnselected", token: number): void;|@ohos.continuation.continuationManager.d.ts| +|新增|NA|类名:continuationManager<br>方法or属性:function registerContinuation(callback: AsyncCallback\<number>): void;|@ohos.continuation.continuationManager.d.ts| +|新增|NA|类名:continuationManager<br>方法or属性:function registerContinuation(options: ContinuationExtraParams, callback: AsyncCallback\<number>): void;|@ohos.continuation.continuationManager.d.ts| +|新增|NA|类名:continuationManager<br>方法or属性:function registerContinuation(options?: ContinuationExtraParams): Promise\<number>;|@ohos.continuation.continuationManager.d.ts| +|新增|NA|类名:continuationManager<br>方法or属性:function unregisterContinuation(token: number, callback: AsyncCallback\<void>): void;|@ohos.continuation.continuationManager.d.ts| +|新增|NA|类名:continuationManager<br>方法or属性:function unregisterContinuation(token: number): Promise\<void>;|@ohos.continuation.continuationManager.d.ts| +|新增|NA|类名:continuationManager<br>方法or属性:function updateContinuationState(token: number, deviceId: string, status: DeviceConnectState, callback: AsyncCallback\<void>): void;|@ohos.continuation.continuationManager.d.ts| +|新增|NA|类名:continuationManager<br>方法or属性:function updateContinuationState(token: number, deviceId: string, status: DeviceConnectState): Promise\<void>;|@ohos.continuation.continuationManager.d.ts| +|新增|NA|类名:continuationManager<br>方法or属性:function startContinuationDeviceManager(token: number, callback: AsyncCallback\<void>): void;|@ohos.continuation.continuationManager.d.ts| +|新增|NA|类名:continuationManager<br>方法or属性:function startContinuationDeviceManager(token: number, options: ContinuationExtraParams, callback: AsyncCallback\<void>): void;|@ohos.continuation.continuationManager.d.ts| +|新增|NA|类名:continuationManager<br>方法or属性:function startContinuationDeviceManager(token: number, options?: ContinuationExtraParams): Promise\<void>;|@ohos.continuation.continuationManager.d.ts| +|新增|NA|模块名: ohos.distributedMissionManager<br>类名: distributedMissionManager|@ohos.distributedMissionManager.d.ts| +|新增|NA|模块名: ohos.distributedMissionManager<br>类名: distributedMissionManager<br>方法 or 属性: function startSyncRemoteMissions(parameter: MissionParameter, callback: AsyncCallback\<void>): void;|@ohos.distributedMissionManager.d.ts| +|新增|NA|模块名: ohos.distributedMissionManager<br>类名: distributedMissionManager<br>方法 or 属性: function startSyncRemoteMissions(parameter: MissionParameter): Promise\<void>;|@ohos.distributedMissionManager.d.ts| +|新增|NA|模块名: ohos.distributedMissionManager<br>类名: distributedMissionManager<br>方法 or 属性: function stopSyncRemoteMissions(parameter: MissionDeviceInfo, callback: AsyncCallback\<void>): void;|@ohos.distributedMissionManager.d.ts| +|新增|NA|模块名: ohos.distributedMissionManager<br>类名: distributedMissionManager<br>方法 or 属性: function stopSyncRemoteMissions(parameter: MissionDeviceInfo): Promise\<void>;|@ohos.distributedMissionManager.d.ts| +|新增|NA|模块名: ohos.distributedMissionManager<br>类名: distributedMissionManager<br>方法 or 属性: function registerMissionListener(parameter: MissionDeviceInfo, options: MissionCallback, callback: AsyncCallback\<void>): void;|@ohos.distributedMissionManager.d.ts| +|新增|NA|模块名: ohos.distributedMissionManager<br>类名: distributedMissionManager<br>方法 or 属性: function registerMissionListener(parameter: MissionDeviceInfo, options: MissionCallback): Promise\<void>;|@ohos.distributedMissionManager.d.ts| +|新增|NA|模块名: ohos.distributedMissionManager<br>类名: distributedMissionManager<br>方法 or 属性: function unRegisterMissionListener(parameter: MissionDeviceInfo, callback: AsyncCallback\<void>): void;|@ohos.distributedMissionManager.d.ts| +|新增|NA|模块名: ohos.distributedMissionManager<br>类名: distributedMissionManager<br>方法 or 属性: function unRegisterMissionListener(parameter: MissionDeviceInfo): Promise\<void>;|@ohos.distributedMissionManager.d.ts| +|新增|NA|模块名: ohos.distributedMissionManager<br>类名: distributedMissionManager<br>方法 or 属性: function continueMission(parameter: ContinueDeviceInfo, options: ContinueCallback, callback: AsyncCallback\<void>): void;|@ohos.distributedMissionManager.d.ts| +|新增|NA|模块名: ohos.distributedMissionManager<br>类名: distributedMissionManager<br>方法 or 属性: function continueMission(parameter: ContinueDeviceInfo, options: ContinueCallback): Promise\<void>;|@ohos.distributedMissionManager.d.ts| +|新增|NA|类名:Context<br>方法or属性:getExternalCacheDir(callback: AsyncCallback\<string>): void|context.d.ts| +|新增|NA|类名:Context<br>方法or属性:getExternalCacheDir(): Promise\<string>;|context.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: addAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback\<void>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: addAbilityMonitor(monitor: AbilityMonitor): Promise\<void>;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: addAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback\<void>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: addAbilityStageMonitor(monitor: AbilityStageMonitor): Promise\<void>;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: removeAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback\<void>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: removeAbilityMonitor(monitor: AbilityMonitor): Promise\<void>;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: removeAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback\<void>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: removeAbilityStageMonitor(monitor: AbilityStageMonitor): Promise\<void>;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: waitAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback\<UIAbility>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: waitAbilityMonitor(monitor: AbilityMonitor, timeout: number, callback: AsyncCallback\<UIAbility>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: waitAbilityMonitor(monitor: AbilityMonitor, timeout?: number): Promise\<UIAbility>;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: waitAbilityStageMonitor(monitor: AbilityStageMonitor, callback: AsyncCallback\<AbilityStage>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout: number, callback: AsyncCallback\<AbilityStage>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout?: number): Promise\<AbilityStage>;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: getAppContext(): Context;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: getAbilityState(ability: UIAbility): number;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: getCurrentTopAbility(callback: AsyncCallback\<UIAbility>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: getCurrentTopAbility(): Promise\<UIAbility>|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: startAbility(want: Want, callback: AsyncCallback\<void>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: startAbility(want: Want): Promise\<void>;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: doAbilityForeground(ability: UIAbility, callback: AsyncCallback\<void>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: doAbilityForeground(ability: UIAbility): Promise\<void>;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: doAbilityBackground(ability: UIAbility, callback: AsyncCallback\<void>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: doAbilityBackground(ability: UIAbility): Promise\<void>;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: print(msg: string, callback: AsyncCallback\<void>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: print(msg: string): Promise\<void>;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: printSync(msg: string): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: executeShellCommand(cmd: string, callback: AsyncCallback\<ShellCmdResult>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: executeShellCommand(cmd: string, timeoutSecs: number, callback: AsyncCallback\<ShellCmdResult>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: executeShellCommand(cmd: string, timeoutSecs?: number): Promise\<ShellCmdResult>;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: finishTest(msg: string, code: number, callback: AsyncCallback\<void>): void;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性: finishTest(msg: string, code: number): Promise\<void>;|AbilityDelegator.d.ts| +|新增|NA|模块名: AbilityMonitor<br>类名: AbilityMonitor|AbilityMonitor.d.ts| +|新增|NA|模块名: AbilityMonitor<br>类名: AbilityMonitor<br>方法 or 属性: abilityName: string;|AbilityMonitor.d.ts| +|新增|NA|模块名: AbilityMonitor<br>类名: AbilityMonitor<br>方法 or 属性: moduleName?: string;|AbilityMonitor.d.ts| +|新增|NA|模块名: AbilityMonitor<br>类名: AbilityMonitor<br>方法 or 属性: onAbilityCreate?:(ability: UIAbility) => void;|AbilityMonitor.d.ts| +|新增|NA|模块名: AbilityMonitor<br>类名: AbilityMonitor<br>方法 or 属性: onAbilityForeground?:(ability: UIAbility) => void;|AbilityMonitor.d.ts| +|新增|NA|模块名: AbilityMonitor<br>类名: AbilityMonitor<br>方法 or 属性: onAbilityBackground?:(ability: UIAbility) => void;|AbilityMonitor.d.ts| +|新增|NA|模块名: AbilityMonitor<br>类名: AbilityMonitor<br>方法 or 属性: onAbilityDestroy?:(ability: UIAbility) => void;|AbilityMonitor.d.ts| +|新增|NA|模块名: AbilityMonitor<br>类名: AbilityMonitor<br>方法 or 属性: onWindowStageCreate?:(ability: UIAbility) => void;|AbilityMonitor.d.ts| +|新增|NA|模块名: AbilityMonitor<br>类名: AbilityMonitor<br>方法 or 属性: onWindowStageRestore?:(ability: UIAbility) => void;|AbilityMonitor.d.ts| +|新增|NA|模块名: AbilityMonitor<br>类名: AbilityMonitor<br>方法 or 属性: onWindowStageDestroy?:(ability: UIAbility) => void;|AbilityMonitor.d.ts| +|新增|NA|模块名: AbilityStageContext<br>类名: AbilityStageContext|AbilityStageContext.d.ts| +|新增|NA|模块名: AbilityStageContext<br>类名: AbilityStageContext<br>方法 or 属性: currentHapModuleInfo: HapModuleInfo;|AbilityStageContext.d.ts| +|新增|NA|模块名: AbilityStageContext<br>类名: AbilityStageContext<br>方法 or 属性: config: Configuration;|AbilityStageContext.d.ts| +|新增|NA|模块名: AbilityStageMonitor<br>类名: AbilityStageMonitor|AbilityStageMonitor.d.ts| +|新增|NA|模块名: AbilityStageMonitor<br>类名: AbilityStageMonitor<br>方法 or 属性: moduleName: string;|AbilityStageMonitor.d.ts| +|新增|NA|模块名: AbilityStageMonitor<br>类名: AbilityStageMonitor<br>方法 or 属性: srcEntrance: string;|AbilityStageMonitor.d.ts| +|新增|NA|模块名: AbilityStateData<br>类名: AbilityStateData<br>方法 or 属性: moduleName: string;|AbilityStateData.d.ts| +|新增|NA|模块名: ApplicationContext<br>类名: ApplicationContext|ApplicationContext.d.ts| +|新增|NA|模块名: ApplicationContext<br>类名: ApplicationContext<br>方法 or 属性: on(type: "abilityLifecycle", callback: AbilityLifecycleCallback): number;|ApplicationContext.d.ts| +|新增|NA|模块名: ApplicationContext<br>类名: ApplicationContext<br>方法 or 属性: off(type: "abilityLifecycle", callbackId: number, callback: AsyncCallback\<void>): void;|ApplicationContext.d.ts| +|新增|NA|模块名: ApplicationContext<br>类名: ApplicationContext<br>方法 or 属性: off(type: "abilityLifecycle", callbackId: number): Promise\<void>;|ApplicationContext.d.ts| +|新增|NA|模块名: ApplicationContext<br>类名: ApplicationContext<br>方法 or 属性: on(type: "environment", callback: EnvironmentCallback): number;|ApplicationContext.d.ts| +|新增|NA|模块名: ApplicationContext<br>类名: ApplicationContext<br>方法 or 属性: off(type: "environment", callbackId: number, callback: AsyncCallback\<void>): void;|ApplicationContext.d.ts| +|新增|NA|模块名: ApplicationContext<br>类名: ApplicationContext<br>方法 or 属性: off(type: "environment", callbackId: number): Promise\<void>;|ApplicationContext.d.ts| +|新增|NA|模块名: ApplicationContext<br>类名: ApplicationContext<br>方法 or 属性: getRunningProcessInformation(): Promise\<Array\<ProcessInformation>>;|ApplicationContext.d.ts| +|新增|NA|模块名: ApplicationContext<br>类名: ApplicationContext<br>方法 or 属性: getRunningProcessInformation(callback: AsyncCallback\<Array\<ProcessInformation>>): void;|ApplicationContext.d.ts| +|新增|NA|模块名: ApplicationContext<br>类名: ApplicationContext<br>方法 or 属性: killAllProcesses(): Promise\<void>;|ApplicationContext.d.ts| +|新增|NA|模块名: ApplicationContext<br>类名: ApplicationContext<br>方法 or 属性: killAllProcesses(callback: AsyncCallback\<void>);|ApplicationContext.d.ts| +|新增|NA|模块名: ApplicationStateObserver<br>类名: ApplicationStateObserver<br>方法 or 属性: onProcessStateChanged(processData: ProcessData): void;|ApplicationStateObserver.d.ts| +|新增|NA|模块名: Context<br>类名: Context|Context.d.ts| +|新增|NA|模块名: Context<br>类名: Context<br>方法 or 属性: resourceManager: resmgr.ResourceManager;|Context.d.ts| +|新增|NA|模块名: Context<br>类名: Context<br>方法 or 属性: applicationInfo: ApplicationInfo;|Context.d.ts| +|新增|NA|模块名: Context<br>类名: Context<br>方法 or 属性: cacheDir: string;|Context.d.ts| +|新增|NA|模块名: Context<br>类名: Context<br>方法 or 属性: tempDir: string;|Context.d.ts| +|新增|NA|模块名: Context<br>类名: Context<br>方法 or 属性: filesDir: string;|Context.d.ts| +|新增|NA|模块名: Context<br>类名: Context<br>方法 or 属性: databaseDir: string;|Context.d.ts| +|新增|NA|模块名: Context<br>类名: Context<br>方法 or 属性: preferencesDir: string;|Context.d.ts| +|新增|NA|模块名: Context<br>类名: Context<br>方法 or 属性: bundleCodeDir: string;|Context.d.ts| +|新增|NA|模块名: Context<br>类名: Context<br>方法 or 属性: distributedFilesDir: string;|Context.d.ts| +|新增|NA|模块名: Context<br>类名: Context<br>方法 or 属性: eventHub: EventHub;|Context.d.ts| +|新增|NA|模块名: Context<br>类名: Context<br>方法 or 属性: area: contextConstant.AreaMode;|Context.d.ts| +|新增|NA|模块名: Context<br>类名: Context<br>方法 or 属性: createBundleContext(bundleName: string): Context;|Context.d.ts| +|新增|NA|模块名: Context<br>类名: Context<br>方法 or 属性: createModuleContext(moduleName: string): Context;|Context.d.ts| +|新增|NA|模块名: Context<br>类名: Context<br>方法 or 属性: createModuleContext(bundleName: string, moduleName: string): Context;|Context.d.ts| +|新增|NA|模块名: Context<br>类名: Context<br>方法 or 属性: getApplicationContext(): ApplicationContext;|Context.d.ts| +|新增|NA|模块名: ContinueCallback<br>类名: ContinueCallback|ContinueCallback.d.ts| +|新增|NA|模块名: ContinueCallback<br>类名: ContinueCallback<br>方法 or 属性: onContinueDone(result: number): void;|ContinueCallback.d.ts| +|新增|NA|模块名: ContinueDeviceInfo<br>类名: ContinueDeviceInfo|ContinueDeviceInfo.d.ts| +|新增|NA|模块名: ContinueDeviceInfo<br>类名: ContinueDeviceInfo<br>方法 or 属性: srcDeviceId: string;|ContinueDeviceInfo.d.ts| +|新增|NA|模块名: ContinueDeviceInfo<br>类名: ContinueDeviceInfo<br>方法 or 属性: dstDeviceId: string;|ContinueDeviceInfo.d.ts| +|新增|NA|模块名: ContinueDeviceInfo<br>类名: ContinueDeviceInfo<br>方法 or 属性: missionId: number;|ContinueDeviceInfo.d.ts| +|新增|NA|模块名: ContinueDeviceInfo<br>类名: ContinueDeviceInfo<br>方法 or 属性: wantParam: {[key: string]: any};|ContinueDeviceInfo.d.ts| +|新增|NA|模块名: ErrorObserver<br>类名: ErrorObserver|ErrorObserver.d.ts| +|新增|NA|模块名: ErrorObserver<br>类名: ErrorObserver<br>方法 or 属性: onUnhandledException(errMsg: string): void;|ErrorObserver.d.ts| +|新增|NA|模块名: EventHub<br>类名: EventHub|EventHub.d.ts| +|新增|NA|模块名: EventHub<br>类名: EventHub<br>方法 or 属性: on(event: string, callback: Function): void|EventHub.d.ts| +|新增|NA|模块名: EventHub<br>类名: EventHub<br>方法 or 属性: off(event: string, callback?: Function): void|EventHub.d.ts| +|新增|NA|模块名: EventHub<br>类名: EventHub<br>方法 or 属性: emit(event: string, ...args: Object[]): void|EventHub.d.ts| +|新增|NA|模块名: ExtensionContext<br>类名: ExtensionContext|ExtensionContext.d.ts| +|新增|NA|模块名: ExtensionContext<br>类名: ExtensionContext<br>方法 or 属性: currentHapModuleInfo: HapModuleInfo;|ExtensionContext.d.ts| +|新增|NA|模块名: ExtensionContext<br>类名: ExtensionContext<br>方法 or 属性: config: Configuration;|ExtensionContext.d.ts| +|新增|NA|模块名: ExtensionContext<br>类名: ExtensionContext<br>方法 or 属性: extensionAbilityInfo: ExtensionAbilityInfo;|ExtensionContext.d.ts| +|新增|NA|模块名: ExtensionRunningInfo<br>类名: ExtensionRunningInfo|ExtensionRunningInfo.d.ts| +|新增|NA|模块名: ExtensionRunningInfo<br>类名: ExtensionRunningInfo<br>方法 or 属性: extension: ElementName;|ExtensionRunningInfo.d.ts| +|新增|NA|模块名: ExtensionRunningInfo<br>类名: ExtensionRunningInfo<br>方法 or 属性: pid: number;|ExtensionRunningInfo.d.ts| +|新增|NA|模块名: ExtensionRunningInfo<br>类名: ExtensionRunningInfo<br>方法 or 属性: uid: number;|ExtensionRunningInfo.d.ts| +|新增|NA|模块名: ExtensionRunningInfo<br>类名: ExtensionRunningInfo<br>方法 or 属性: processName: string;|ExtensionRunningInfo.d.ts| +|新增|NA|模块名: ExtensionRunningInfo<br>类名: ExtensionRunningInfo<br>方法 or 属性: startTime: number;|ExtensionRunningInfo.d.ts| +|新增|NA|模块名: ExtensionRunningInfo<br>类名: ExtensionRunningInfo<br>方法 or 属性: clientPackage: Array\<String>;|ExtensionRunningInfo.d.ts| +|新增|NA|模块名: ExtensionRunningInfo<br>类名: ExtensionRunningInfo<br>方法 or 属性: type: bundle.ExtensionAbilityType;|ExtensionRunningInfo.d.ts| +|新增|NA|模块名: FormExtensionContext<br>类名: FormExtensionContext|FormExtensionContext.d.ts| +|新增|NA|模块名: FormExtensionContext<br>类名: FormExtensionContext<br>方法 or 属性: startAbility(want: Want, callback: AsyncCallback\<void>): void;|FormExtensionContext.d.ts| +|新增|NA|模块名: FormExtensionContext<br>类名: FormExtensionContext<br>方法 or 属性: startAbility(want: Want): Promise\<void>;|FormExtensionContext.d.ts| +|新增|NA|模块名: MissionCallbacks<br>类名: MissionCallback|MissionCallbacks.d.ts| +|新增|NA|模块名: MissionCallbacks<br>类名: MissionCallback<br>方法 or 属性: notifyMissionsChanged(deviceId: string): void;|MissionCallbacks.d.ts| +|新增|NA|模块名: MissionCallbacks<br>类名: MissionCallback<br>方法 or 属性: notifySnapshot(deviceId: string, mission: number): void;|MissionCallbacks.d.ts| +|新增|NA|模块名: MissionCallbacks<br>类名: MissionCallback<br>方法 or 属性: notifyNetDisconnect(deviceId: string, state: number): void;|MissionCallbacks.d.ts| +|新增|NA|模块名: MissionDeviceInfo<br>类名: MissionDeviceInfo|MissionDeviceInfo.d.ts| +|新增|NA|模块名: MissionDeviceInfo<br>类名: MissionDeviceInfo<br>方法 or 属性: deviceId: string;|MissionDeviceInfo.d.ts| +|新增|NA|模块名: MissionListener<br>类名: MissionListener<br>方法 or 属性: onMissionLabelUpdated(mission: number): void;|MissionListener.d.ts| +|新增|NA|模块名: MissionListener<br>类名: MissionListener<br>方法 or 属性: onMissionIconUpdated(mission: number, icon: image.PixelMap): void;|MissionListener.d.ts| +|新增|NA|模块名: MissionListener<br>类名: MissionListener<br>方法 or 属性: onMissionClosed(mission: number): void;|MissionListener.d.ts| +|新增|NA|模块名: MissionParameter<br>类名: MissionParameter|MissionParameter.d.ts| +|新增|NA|模块名: MissionParameter<br>类名: MissionParameter<br>方法 or 属性: deviceId: string;|MissionParameter.d.ts| +|新增|NA|模块名: MissionParameter<br>类名: MissionParameter<br>方法 or 属性: fixConflict: boolean;|MissionParameter.d.ts| +|新增|NA|模块名: MissionParameter<br>类名: MissionParameter<br>方法 or 属性: tag: number;|MissionParameter.d.ts| +|新增|NA|类名:ProcessData<br>方法or属性:state: number;|ProcessData.d.ts| +|新增|NA|类名:ProcessData<br>方法or属性:isContinuousTask: boolean;|ProcessData.d.ts| +|新增|NA|类名:ProcessData<br>方法or属性:isKeepAlive: boolean;|ProcessData.d.ts| +|新增|NA|模块名: ProcessInformation<br>类名: ProcessInformation|ProcessInformation.d.ts| +|新增|NA|模块名: ProcessInformation<br>类名: ProcessInformation<br>方法 or 属性: pid: number;|ProcessInformation.d.ts| +|新增|NA|模块名: ProcessInformation<br>类名: ProcessInformation<br>方法 or 属性: uid: number;|ProcessInformation.d.ts| +|新增|NA|模块名: ProcessInformation<br>类名: ProcessInformation<br>方法 or 属性: processName: string;|ProcessInformation.d.ts| +|新增|NA|模块名: ProcessInformation<br>类名: ProcessInformation<br>方法 or 属性: bundleNames: Array\<string>;|ProcessInformation.d.ts| +|新增|NA|模块名: ServiceExtensionContext<br>类名: ServiceExtensionContext|ServiceExtensionContext.d.ts| +|新增|NA|模块名: ServiceExtensionContext<br>类名: ServiceExtensionContext<br>方法 or 属性: startAbility(want: Want, callback: AsyncCallback\<void>): void;|ServiceExtensionContext.d.ts| +|新增|NA|模块名: ServiceExtensionContext<br>类名: ServiceExtensionContext<br>方法 or 属性: startAbility(want: Want, options: StartOptions, callback: AsyncCallback\<void>): void;|ServiceExtensionContext.d.ts| +|新增|NA|模块名: ServiceExtensionContext<br>类名: ServiceExtensionContext<br>方法 or 属性: startAbility(want: Want, options?: StartOptions): Promise\<void>;|ServiceExtensionContext.d.ts| +|新增|NA|模块名: ServiceExtensionContext<br>类名: ServiceExtensionContext<br>方法 or 属性: startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\<void>): void;|ServiceExtensionContext.d.ts| +|新增|NA|模块名: ServiceExtensionContext<br>类名: ServiceExtensionContext<br>方法 or 属性: startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback\<void>): void;|ServiceExtensionContext.d.ts| +|新增|NA|模块名: ServiceExtensionContext<br>类名: ServiceExtensionContext<br>方法 or 属性: startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise\<void>;|ServiceExtensionContext.d.ts| +|新增|NA|模块名: ServiceExtensionContext<br>类名: ServiceExtensionContext<br>方法 or 属性: startServiceExtensionAbility(want: Want, callback: AsyncCallback\<void>): void;|ServiceExtensionContext.d.ts| +|新增|NA|模块名: ServiceExtensionContext<br>类名: ServiceExtensionContext<br>方法 or 属性: startServiceExtensionAbility(want: Want): Promise\<void>;|ServiceExtensionContext.d.ts| +|新增|NA|模块名: ServiceExtensionContext<br>类名: ServiceExtensionContext<br>方法 or 属性: startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\<void>): void;|ServiceExtensionContext.d.ts| +|新增|NA|模块名: ServiceExtensionContext<br>类名: ServiceExtensionContext<br>方法 or 属性: startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\<void>;|ServiceExtensionContext.d.ts| +|新增|NA|模块名: ServiceExtensionContext<br>类名: ServiceExtensionContext<br>方法 or 属性: stopServiceExtensionAbility(want: Want, callback: AsyncCallback\<void>): void;|ServiceExtensionContext.d.ts| +|新增|NA|模块名: ServiceExtensionContext<br>类名: ServiceExtensionContext<br>方法 or 属性: stopServiceExtensionAbility(want: Want): Promise\<void>;|ServiceExtensionContext.d.ts| +|新增|NA|模块名: ServiceExtensionContext<br>类名: ServiceExtensionContext<br>方法 or 属性: stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\<void>): void;|ServiceExtensionContext.d.ts| +|新增|NA|模块名: ServiceExtensionContext<br>类名: ServiceExtensionContext<br>方法 or 属性: stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\<void>;|ServiceExtensionContext.d.ts| +|新增|NA|模块名: ServiceExtensionContext<br>类名: ServiceExtensionContext<br>方法 or 属性: terminateSelf(callback: AsyncCallback\<void>): void;|ServiceExtensionContext.d.ts| +|新增|NA|模块名: ServiceExtensionContext<br>类名: ServiceExtensionContext<br>方法 or 属性: terminateSelf(): Promise\<void>;|ServiceExtensionContext.d.ts| +|新增|NA|模块名: ServiceExtensionContext<br>类名: ServiceExtensionContext<br>方法 or 属性: connectServiceExtensionAbility(want: Want, options: ConnectOptions): number;|ServiceExtensionContext.d.ts| +|新增|NA|模块名: ServiceExtensionContext<br>类名: ServiceExtensionContext<br>方法 or 属性: connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number;|ServiceExtensionContext.d.ts| +|新增|NA|模块名: ServiceExtensionContext<br>类名: ServiceExtensionContext<br>方法 or 属性: disconnectServiceExtensionAbility(connection: number, callback: AsyncCallback\<void>): void;|ServiceExtensionContext.d.ts| +|新增|NA|模块名: ServiceExtensionContext<br>类名: ServiceExtensionContext<br>方法 or 属性: disconnectServiceExtensionAbility(connection: number): Promise\<void>;|ServiceExtensionContext.d.ts| +|新增|NA|模块名: ServiceExtensionContext<br>类名: ServiceExtensionContext<br>方法 or 属性: startAbilityByCall(want: Want): Promise\<Caller>;|ServiceExtensionContext.d.ts| +|新增|NA|模块名: ServiceExtensionContext<br>类名: ServiceExtensionContext<br>方法 or 属性: startRecentAbility(want: Want, callback: AsyncCallback\<void>): void;|ServiceExtensionContext.d.ts| +|新增|NA|模块名: ServiceExtensionContext<br>类名: ServiceExtensionContext<br>方法 or 属性: startRecentAbility(want: Want, options: StartOptions, callback: AsyncCallback\<void>): void;|ServiceExtensionContext.d.ts| +|新增|NA|模块名: ServiceExtensionContext<br>类名: ServiceExtensionContext<br>方法 or 属性: startRecentAbility(want: Want, options?: StartOptions): Promise\<void>;|ServiceExtensionContext.d.ts| +|新增|NA|类名:ShellCmdResult<br>方法or属性:stdResult: string;|shellCmdResult.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: abilityInfo: AbilityInfo;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: currentHapModuleInfo: HapModuleInfo;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: config: Configuration;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: startAbility(want: Want, callback: AsyncCallback\<void>): void;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: startAbility(want: Want, options: StartOptions, callback: AsyncCallback\<void>): void;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: startAbility(want: Want, options?: StartOptions): Promise\<void>;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: startAbilityByCall(want: Want): Promise\<Caller>;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\<void>): void;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback\<void>): void;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise\<void>;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: startAbilityForResult(want: Want, callback: AsyncCallback\<AbilityResult>): void;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback\<AbilityResult>): void;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: startAbilityForResult(want: Want, options?: StartOptions): Promise\<AbilityResult>;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: startAbilityForResultWithAccount(want: Want, accountId: number, callback: AsyncCallback\<AbilityResult>): void;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: startAbilityForResultWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback\<void>): void;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartOptions): Promise\<AbilityResult>;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: startServiceExtensionAbility(want: Want, callback: AsyncCallback\<void>): void;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: startServiceExtensionAbility(want: Want): Promise\<void>;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\<void>): void;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\<void>;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: stopServiceExtensionAbility(want: Want, callback: AsyncCallback\<void>): void;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: stopServiceExtensionAbility(want: Want): Promise\<void>;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\<void>): void;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\<void>;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: terminateSelf(callback: AsyncCallback\<void>): void;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: terminateSelf(): Promise\<void>;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback\<void>): void;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: terminateSelfWithResult(parameter: AbilityResult): Promise\<void>;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: connectServiceExtensionAbility(want: Want, options: ConnectOptions): number;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: disconnectServiceExtensionAbility(connection: number, callback: AsyncCallback\<void>): void;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: disconnectServiceExtensionAbility(connection: number): Promise\<void>;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: setMissionLabel(label: string, callback: AsyncCallback\<void>): void;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: setMissionLabel(label: string): Promise\<void>;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: setMissionIcon(icon: image.PixelMap, callback: AsyncCallback\<void>): void;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: setMissionIcon(icon: image.PixelMap): Promise\<void>;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: restoreWindowStage(localStorage: LocalStorage): void;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: isTerminating(): boolean;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: startRecentAbility(want: Want, callback: AsyncCallback\<void>): void;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: startRecentAbility(want: Want, options: StartOptions, callback: AsyncCallback\<void>): void;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: startRecentAbility(want: Want, options?: StartOptions): Promise\<void>;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: requestDialogService(want: Want, result: AsyncCallback\<dialogRequest.RequestResult>): void;|UIAbilityContext.d.ts| +|新增|NA|模块名: UIAbilityContext<br>类名: UIAbilityContext<br>方法 or 属性: requestDialogService(want: Want): Promise\<dialogRequest.RequestResult>;|UIAbilityContext.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:print(msg: string, callback: AsyncCallback\<void>): void;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:print(msg: string): Promise\<void>;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:executeShellCommand(cmd: string, callback: AsyncCallback\<ShellCmdResult>): void;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:executeShellCommand(cmd: string, timeoutSecs: number, callback: AsyncCallback\<ShellCmdResult>): void;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:executeShellCommand(cmd: string, timeoutSecs?: number): Promise\<ShellCmdResult>;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:finishTest(msg: string, code: number, callback: AsyncCallback\<void>): void;|NA|abilityDelegator.d.ts| +|删除|模块名: abilityDelegator<br>类名: AbilityDelegator<br>方法 or 属性:finishTest(msg: string, code: number): Promise\<void>;|NA|abilityDelegator.d.ts| +|删除|模块名:BaseContext<br>类名:BaseContext|NA|BaseContext.d.ts| +|访问级别有变化|类名:abilityManager<br>访问级别:公开API|类名:abilityManager<br>访问级别:系统API|@ohos.application.abilityManager.d.ts| +|废弃版本有变化|类名:dataUriUtils<br>废弃版本:N/A|类名:dataUriUtils<br>废弃版本:9<br>代替接口:@ohos.app.ability.dataUriUtils.d.ts |@ohos.ability.dataUriUtils.d.ts| +|废弃版本有变化|类名:wantConstant<br>废弃版本:N/A|类名:wantConstant<br>废弃版本:9<br>代替接口:ohos.app.ability.wantConstant |@ohos.ability.wantConstant.d.ts| +|废弃版本有变化|类名:Action<br>方法 or 属性:ACTION_APP_ACCOUNT_OAUTH = "ohos.account.appAccount.action.oauth"<br>废弃版本:N/A|类名:Action<br>方法 or 属性:ACTION_APP_ACCOUNT_OAUTH = "ohos.account.appAccount.action.oauth"<br>废弃版本:9<br>代替接口:wantConstant.Action|@ohos.ability.wantConstant.d.ts| +|废弃版本有变化|类名:abilityDelegatorRegistry<br>废弃版本:N/A|类名:abilityDelegatorRegistry<br>废弃版本:9<br>代替接口:ohos.app.ability.abilityDelegatorRegistry |@ohos.application.abilityDelegatorRegistry.d.ts| +|废弃版本有变化|类名:abilityManager<br>废弃版本:N/A|类名:abilityManager<br>废弃版本:9<br>代替接口:ohos.app.ability.abilityManager |@ohos.application.abilityManager.d.ts| +|废弃版本有变化|类名:appManager<br>废弃版本:N/A|类名:appManager<br>废弃版本:9<br>代替接口:ohos.app.ability.appManager |@ohos.application.appManager.d.ts| +|废弃版本有变化|类名:appManager<br>方法 or 属性:function getProcessRunningInfos(): Promise\<Array\<ProcessRunningInfo>>;<br>废弃版本:N/A|类名:appManager<br>方法 or 属性:function getProcessRunningInfos(): Promise\<Array\<ProcessRunningInfo>>;<br>废弃版本:9<br>代替接口:ohos.app.ability.appManager|@ohos.application.appManager.d.ts| +|废弃版本有变化|类名:appManager<br>方法 or 属性:function getProcessRunningInfos(callback: AsyncCallback\<Array\<ProcessRunningInfo>>): void;<br>废弃版本:N/A|类名:appManager<br>方法 or 属性:function getProcessRunningInfos(callback: AsyncCallback\<Array\<ProcessRunningInfo>>): void;<br>废弃版本:9<br>代替接口:ohos.app.ability.appManager|@ohos.application.appManager.d.ts| +|废弃版本有变化|类名:Configuration<br>废弃版本:N/A|类名:Configuration<br>废弃版本:9<br>代替接口:ohos.app.ability.Configuration |@ohos.application.Configuration.d.ts| +|废弃版本有变化|类名:ConfigurationConstant<br>废弃版本:N/A|类名:ConfigurationConstant<br>废弃版本:9<br>代替接口:ohos.app.ability.ConfigurationConstant |@ohos.application.ConfigurationConstant.d.ts| +|废弃版本有变化|类名:formBindingData<br>废弃版本:N/A|类名:formBindingData<br>废弃版本:9<br>代替接口:ohos.app.form.formBindingData |@ohos.application.formBindingData.d.ts| +|废弃版本有变化|类名:formHost<br>废弃版本:N/A|类名:formHost<br>废弃版本:9<br>代替接口:ohos.app.form.formHost |@ohos.application.formHost.d.ts| +|废弃版本有变化|类名:formInfo<br>废弃版本:N/A|类名:formInfo<br>废弃版本:9<br>代替接口:ohos.app.form.formInfo |@ohos.application.formInfo.d.ts| +|废弃版本有变化|类名:formProvider<br>废弃版本:N/A|类名:formProvider<br>废弃版本:9<br>代替接口:ohos.app.form.formProvider |@ohos.application.formProvider.d.ts| +|废弃版本有变化|类名:missionManager<br>废弃版本:N/A|类名:missionManager<br>废弃版本:9<br>代替接口:ohos.app.ability.missionManager |@ohos.application.missionManager.d.ts| +|废弃版本有变化|类名:Want<br>废弃版本:N/A|类名:Want<br>废弃版本:9<br>代替接口:ohos.app.ability.Want |@ohos.application.Want.d.ts| +|废弃版本有变化|类名:continuationManager<br>方法 or 属性:function on(type: "deviceConnect", callback: Callback\<ContinuationResult>): void;<br>废弃版本:N/A|类名:continuationManager<br>方法 or 属性:function on(type: "deviceConnect", callback: Callback\<ContinuationResult>): void;<br>废弃版本:9<br>代替接口:ohos.continuation.continuationManager.continuationManager|@ohos.continuation.continuationManager.d.ts| +|废弃版本有变化|类名:continuationManager<br>方法 or 属性:function on(type: "deviceDisconnect", callback: Callback\<string>): void;<br>废弃版本:N/A|类名:continuationManager<br>方法 or 属性:function on(type: "deviceDisconnect", callback: Callback\<string>): void;<br>废弃版本:9<br>代替接口:ohos.continuation.continuationManager.continuationManager|@ohos.continuation.continuationManager.d.ts| +|废弃版本有变化|类名:continuationManager<br>方法 or 属性:function register(callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:continuationManager<br>方法 or 属性:function register(callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.continuation.continuationManager.continuationManager|@ohos.continuation.continuationManager.d.ts| +|废弃版本有变化|类名:continuationManager<br>方法 or 属性:function register(options: ContinuationExtraParams, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:continuationManager<br>方法 or 属性:function register(options: ContinuationExtraParams, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.continuation.continuationManager.continuationManager|@ohos.continuation.continuationManager.d.ts| +|废弃版本有变化|类名:continuationManager<br>方法 or 属性:function register(options?: ContinuationExtraParams): Promise\<number>;<br>废弃版本:N/A|类名:continuationManager<br>方法 or 属性:function register(options?: ContinuationExtraParams): Promise\<number>;<br>废弃版本:9<br>代替接口:ohos.continuation.continuationManager.continuationManager|@ohos.continuation.continuationManager.d.ts| +|废弃版本有变化|类名:continuationManager<br>方法 or 属性:function unregister(token: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:continuationManager<br>方法 or 属性:function unregister(token: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.continuation.continuationManager.continuationManager|@ohos.continuation.continuationManager.d.ts| +|废弃版本有变化|类名:continuationManager<br>方法 or 属性:function unregister(token: number): Promise\<void>;<br>废弃版本:N/A|类名:continuationManager<br>方法 or 属性:function unregister(token: number): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.continuation.continuationManager.continuationManager|@ohos.continuation.continuationManager.d.ts| +|废弃版本有变化|类名:continuationManager<br>方法 or 属性:function updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:continuationManager<br>方法 or 属性:function updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.continuation.continuationManager.continuationManager|@ohos.continuation.continuationManager.d.ts| +|废弃版本有变化|类名:continuationManager<br>方法 or 属性:function updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState): Promise\<void>;<br>废弃版本:N/A|类名:continuationManager<br>方法 or 属性:function updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.continuation.continuationManager.continuationManager|@ohos.continuation.continuationManager.d.ts| +|废弃版本有变化|类名:continuationManager<br>方法 or 属性:function startDeviceManager(token: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:continuationManager<br>方法 or 属性:function startDeviceManager(token: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.continuation.continuationManager.continuationManager|@ohos.continuation.continuationManager.d.ts| +|废弃版本有变化|类名:continuationManager<br>方法 or 属性:function startDeviceManager(token: number, options: ContinuationExtraParams, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:continuationManager<br>方法 or 属性:function startDeviceManager(token: number, options: ContinuationExtraParams, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.continuation.continuationManager.continuationManager|@ohos.continuation.continuationManager.d.ts| +|废弃版本有变化|类名:continuationManager<br>方法 or 属性:function startDeviceManager(token: number, options?: ContinuationExtraParams): Promise\<void>;<br>废弃版本:N/A|类名:continuationManager<br>方法 or 属性:function startDeviceManager(token: number, options?: ContinuationExtraParams): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.continuation.continuationManager.continuationManager|@ohos.continuation.continuationManager.d.ts| +|废弃版本有变化|类名:wantAgent<br>废弃版本:N/A|类名:wantAgent<br>废弃版本:9<br>代替接口:ohos.app.ability.wantAgent |@ohos.wantAgent.d.ts| +|废弃版本有变化|类名:Want<br>废弃版本:N/A|类名:Want<br>废弃版本:9<br>代替接口:ohos.app.ability.Want |want.d.ts| +|废弃版本有变化|类名:Context<br>方法 or 属性:setShowOnLockScreen(show: boolean, callback: AsyncCallback\<void>): void<br>废弃版本:N/A|类名:Context<br>方法 or 属性:setShowOnLockScreen(show: boolean, callback: AsyncCallback\<void>): void<br>废弃版本:9<br>代替接口:ohos.window|context.d.ts| +|废弃版本有变化|类名:Context<br>方法 or 属性:setShowOnLockScreen(show: boolean): Promise\<void>;<br>废弃版本:N/A|类名:Context<br>方法 or 属性:setShowOnLockScreen(show: boolean): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.window|context.d.ts| +|废弃版本有变化|类名:ProcessRunningInfo<br>废弃版本:N/A|类名:ProcessRunningInfo<br>废弃版本:9<br>代替接口:ProcessInformation |ProcessRunningInfo.d.ts| +|废弃版本有变化|类名:ProcessRunningInfo<br>方法 or 属性:pid: number;<br>废弃版本:N/A|类名:ProcessRunningInfo<br>方法 or 属性:pid: number;<br>废弃版本:9<br>代替接口:ProcessInformation.pid |ProcessRunningInfo.d.ts| +|废弃版本有变化|类名:ProcessRunningInfo<br>方法 or 属性:uid: number;<br>废弃版本:N/A|类名:ProcessRunningInfo<br>方法 or 属性:uid: number;<br>废弃版本:9<br>代替接口:ProcessInformation.uid |ProcessRunningInfo.d.ts| +|废弃版本有变化|类名:ProcessRunningInfo<br>方法 or 属性:processName: string;<br>废弃版本:N/A|类名:ProcessRunningInfo<br>方法 or 属性:processName: string;<br>废弃版本:9<br>代替接口:ProcessInformation.processName |ProcessRunningInfo.d.ts| +|废弃版本有变化|类名:ProcessRunningInfo<br>方法 or 属性:bundleNames: Array\<string>;<br>废弃版本:N/A|类名:ProcessRunningInfo<br>方法 or 属性:bundleNames: Array\<string>;<br>废弃版本:9<br>代替接口:ProcessInformation.bundleNames |ProcessRunningInfo.d.ts| +|权限有变化|类名:formHost<br>方法 or 属性:function acquireFormState(want: Want, callback: AsyncCallback\<formInfo.FormStateInfo>): void;<br>权限:ohos.permission.GET_BUNDLE_INFO and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED.|类名:formHost<br>方法 or 属性:function acquireFormState(want: Want, callback: AsyncCallback\<formInfo.FormStateInfo>): void;<br>权限:ohos.permission.REQUIRE_FORM and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED|@ohos.application.formHost.d.ts| +|权限有变化|类名:formHost<br>方法 or 属性:function acquireFormState(want: Want): Promise\<formInfo.FormStateInfo>;<br>权限:ohos.permission.GET_BUNDLE_INFO and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED.|类名:formHost<br>方法 or 属性:function acquireFormState(want: Want): Promise\<formInfo.FormStateInfo>;<br>权限:ohos.permission.REQUIRE_FORM and ohos.permission.GET_BUNDLE_INFO_PRIVILEGED|@ohos.application.formHost.d.ts| +|SysCap有变化|类名:ProcessData<br>SysCap:SystemCapability.Ability.AbilityRuntime.Mission|类名:ProcessData<br>SysCap:SystemCapability.Ability.AbilityRuntime.Core|ProcessData.d.ts| +|SysCap有变化|类名:ProcessData<br>方法 or 属性:bundleName: string;<br>SysCap:SystemCapability.Ability.AbilityRuntime.Mission|类名:ProcessData<br>方法 or 属性:bundleName: string;<br>SysCap:SystemCapability.Ability.AbilityRuntime.Core|ProcessData.d.ts| +|SysCap有变化|类名:ProcessData<br>方法 or 属性:pid: number;<br>SysCap:SystemCapability.Ability.AbilityRuntime.Mission|类名:ProcessData<br>方法 or 属性:pid: number;<br>SysCap:SystemCapability.Ability.AbilityRuntime.Core|ProcessData.d.ts| +|SysCap有变化|类名:ProcessData<br>方法 or 属性:uid: number;<br>SysCap:SystemCapability.Ability.AbilityRuntime.Mission|类名:ProcessData<br>方法 or 属性:uid: number;<br>SysCap:SystemCapability.Ability.AbilityRuntime.Core|ProcessData.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-accessibility.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-accessibility.md new file mode 100644 index 0000000000000000000000000000000000000000..36579874a03825d4869364af92b23969f6a45964 --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-accessibility.md @@ -0,0 +1,109 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.accessibility.config<br>类名: config|@ohos.accessibility.config.d.ts| +|新增|NA|模块名: ohos.accessibility.config<br>类名: DaltonizationColorFilter<br>方法 or 属性: type DaltonizationColorFilter = 'Normal' \| 'Protanomaly' \| 'Deuteranomaly' \| 'Tritanomaly';|@ohos.accessibility.config.d.ts| +|新增|NA|模块名: ohos.accessibility.config<br>类名: DaltonizationColorFilter<br>方法 or 属性: type DaltonizationColorFilter = 'Normal' \| 'Protanomaly' \| 'Deuteranomaly' \| 'Tritanomaly';|@ohos.accessibility.config.d.ts| +|新增|NA|模块名: ohos.accessibility.config<br>类名: DaltonizationColorFilter<br>方法 or 属性: type DaltonizationColorFilter = 'Normal' \| 'Protanomaly' \| 'Deuteranomaly' \| 'Tritanomaly';|@ohos.accessibility.config.d.ts| +|新增|NA|模块名: ohos.accessibility.config<br>类名: DaltonizationColorFilter<br>方法 or 属性: type DaltonizationColorFilter = 'Normal' \| 'Protanomaly' \| 'Deuteranomaly' \| 'Tritanomaly';|@ohos.accessibility.config.d.ts| +|新增|NA|模块名: ohos.accessibility.config<br>类名: config<br>方法 or 属性: var highContrastText: Config\<boolean>;|@ohos.accessibility.config.d.ts| +|新增|NA|模块名: ohos.accessibility.config<br>类名: config<br>方法 or 属性: var invertColor: Config\<boolean>;|@ohos.accessibility.config.d.ts| +|新增|NA|模块名: ohos.accessibility.config<br>类名: config<br>方法 or 属性: var daltonizationColorFilter: Config\<DaltonizationColorFilter>;|@ohos.accessibility.config.d.ts| +|新增|NA|模块名: ohos.accessibility.config<br>类名: config<br>方法 or 属性: var contentTimeout: Config\<number>;|@ohos.accessibility.config.d.ts| +|新增|NA|模块名: ohos.accessibility.config<br>类名: config<br>方法 or 属性: var animationOff: Config\<boolean>;|@ohos.accessibility.config.d.ts| +|新增|NA|模块名: ohos.accessibility.config<br>类名: config<br>方法 or 属性: var brightnessDiscount: Config\<number>;|@ohos.accessibility.config.d.ts| +|新增|NA|模块名: ohos.accessibility.config<br>类名: config<br>方法 or 属性: var mouseKey: Config\<boolean>;|@ohos.accessibility.config.d.ts| +|新增|NA|模块名: ohos.accessibility.config<br>类名: config<br>方法 or 属性: var mouseAutoClick: Config\<number>;|@ohos.accessibility.config.d.ts| +|新增|NA|模块名: ohos.accessibility.config<br>类名: config<br>方法 or 属性: var shortkey: Config\<boolean>;|@ohos.accessibility.config.d.ts| +|新增|NA|模块名: ohos.accessibility.config<br>类名: config<br>方法 or 属性: var shortkeyTarget: Config\<string>;|@ohos.accessibility.config.d.ts| +|新增|NA|模块名: ohos.accessibility.config<br>类名: config<br>方法 or 属性: var captions: Config\<boolean>;|@ohos.accessibility.config.d.ts| +|新增|NA|模块名: ohos.accessibility.config<br>类名: config<br>方法 or 属性: var captionsStyle: Config\<accessibility.CaptionsStyle>;|@ohos.accessibility.config.d.ts| +|新增|NA|模块名: ohos.accessibility.config<br>类名: config<br>方法 or 属性: function enableAbility(name: string, capability: Array\<accessibility.Capability>): Promise\<void>;|@ohos.accessibility.config.d.ts| +|新增|NA|模块名: ohos.accessibility.config<br>类名: config<br>方法 or 属性: function enableAbility(name: string, capability: Array\<accessibility.Capability>, callback: AsyncCallback\<void>): void;|@ohos.accessibility.config.d.ts| +|新增|NA|模块名: ohos.accessibility.config<br>类名: config<br>方法 or 属性: function disableAbility(name: string): Promise\<void>;|@ohos.accessibility.config.d.ts| +|新增|NA|模块名: ohos.accessibility.config<br>类名: config<br>方法 or 属性: function disableAbility(name: string, callback: AsyncCallback\<void>): void;|@ohos.accessibility.config.d.ts| +|新增|NA|模块名: ohos.accessibility.config<br>类名: config<br>方法 or 属性: function on(type: 'enabledAccessibilityExtensionListChange', callback: Callback\<void>): void;|@ohos.accessibility.config.d.ts| +|新增|NA|模块名: ohos.accessibility.config<br>类名: config<br>方法 or 属性: function off(type: 'enabledAccessibilityExtensionListChange', callback?: Callback\<void>): void;|@ohos.accessibility.config.d.ts| +|新增|NA|模块名: ohos.accessibility.config<br>类名: Config|@ohos.accessibility.config.d.ts| +|新增|NA|模块名: ohos.accessibility.config<br>类名: Config<br>方法 or 属性: set(value: T): Promise\<void>;|@ohos.accessibility.config.d.ts| +|新增|NA|模块名: ohos.accessibility.config<br>类名: Config<br>方法 or 属性: set(value: T, callback: AsyncCallback\<void>): void;|@ohos.accessibility.config.d.ts| +|新增|NA|模块名: ohos.accessibility.config<br>类名: Config<br>方法 or 属性: get(): Promise\<T>;|@ohos.accessibility.config.d.ts| +|新增|NA|模块名: ohos.accessibility.config<br>类名: Config<br>方法 or 属性: get(callback: AsyncCallback\<T>): void;|@ohos.accessibility.config.d.ts| +|新增|NA|模块名: ohos.accessibility.config<br>类名: Config<br>方法 or 属性: on(callback: Callback\<T>): void;|@ohos.accessibility.config.d.ts| +|新增|NA|模块名: ohos.accessibility.config<br>类名: Config<br>方法 or 属性: off(callback?: Callback\<T>): void;|@ohos.accessibility.config.d.ts| +|新增|NA|类名:AbilityType<br>方法or属性:type AbilityType = 'audible' \| 'generic' \| 'haptic' \| 'spoken' \| 'visual' \| 'all';|@ohos.accessibility.d.ts| +|新增|NA|类名:AbilityType<br>方法or属性:type AbilityType = 'audible' \| 'generic' \| 'haptic' \| 'spoken' \| 'visual' \| 'all';|@ohos.accessibility.d.ts| +|新增|NA|类名:AbilityType<br>方法or属性:type AbilityType = 'audible' \| 'generic' \| 'haptic' \| 'spoken' \| 'visual' \| 'all';|@ohos.accessibility.d.ts| +|新增|NA|类名:AbilityType<br>方法or属性:type AbilityType = 'audible' \| 'generic' \| 'haptic' \| 'spoken' \| 'visual' \| 'all';|@ohos.accessibility.d.ts| +|新增|NA|类名:AbilityType<br>方法or属性:type AbilityType = 'audible' \| 'generic' \| 'haptic' \| 'spoken' \| 'visual' \| 'all';|@ohos.accessibility.d.ts| +|新增|NA|类名:AbilityType<br>方法or属性:type AbilityType = 'audible' \| 'generic' \| 'haptic' \| 'spoken' \| 'visual' \| 'all';|@ohos.accessibility.d.ts| +|新增|NA|类名:accessibility<br>方法or属性:function getAccessibilityExtensionList(abilityType: AbilityType, stateType: AbilityState): Promise\<Array\<AccessibilityAbilityInfo>>;|@ohos.accessibility.d.ts| +|新增|NA|类名:accessibility<br>方法or属性:function getAccessibilityExtensionList(abilityType: AbilityType, stateType: AbilityState, callback: AsyncCallback\<Array\<AccessibilityAbilityInfo>>): void;|@ohos.accessibility.d.ts| +|新增|NA|类名:accessibility<br>方法or属性:function sendAccessibilityEvent(event: EventInfo, callback: AsyncCallback\<void>): void;|@ohos.accessibility.d.ts| +|新增|NA|类名:accessibility<br>方法or属性:function sendAccessibilityEvent(event: EventInfo): Promise\<void>;|@ohos.accessibility.d.ts| +|新增|NA|模块名: ohos.accessibility<br>类名: AccessibilityAbilityInfo<br>方法 or 属性:readonly targetBundleNames: Array\<string>;|@ohos.accessibility.d.ts| +|新增|NA|类名:AccessibilityAbilityInfo<br>方法or属性:readonly targetBundleNames: Array\<string>;|@ohos.accessibility.d.ts| +|新增|NA|模块名: ohos.accessibility.GesturePath<br>类名: GesturePath|@ohos.accessibility.GesturePath.d.ts| +|新增|NA|模块名: ohos.accessibility.GesturePath<br>类名: GesturePath<br>方法 or 属性: constructor(durationTime: number);|@ohos.accessibility.GesturePath.d.ts| +|新增|NA|模块名: ohos.accessibility.GesturePath<br>类名: GesturePath<br>方法 or 属性: points: Array\<GesturePoint>;|@ohos.accessibility.GesturePath.d.ts| +|新增|NA|模块名: ohos.accessibility.GesturePath<br>类名: GesturePath<br>方法 or 属性: durationTime: number;|@ohos.accessibility.GesturePath.d.ts| +|新增|NA|模块名: ohos.accessibility.GesturePoint<br>类名: GesturePoint|@ohos.accessibility.GesturePoint.d.ts| +|新增|NA|模块名: ohos.accessibility.GesturePoint<br>类名: GesturePoint<br>方法 or 属性: constructor(positionX: number, positionY: number);|@ohos.accessibility.GesturePoint.d.ts| +|新增|NA|模块名: ohos.accessibility.GesturePoint<br>类名: GesturePoint<br>方法 or 属性: positionX: number;|@ohos.accessibility.GesturePoint.d.ts| +|新增|NA|模块名: ohos.accessibility.GesturePoint<br>类名: GesturePoint<br>方法 or 属性: positionY: number;|@ohos.accessibility.GesturePoint.d.ts| +|新增|NA|模块名: ohos.application.AccessibilityExtensionAbility<br>类名: AccessibilityExtensionAbility|@ohos.application.AccessibilityExtensionAbility.d.ts| +|新增|NA|模块名: ohos.application.AccessibilityExtensionAbility<br>类名: AccessibilityExtensionAbility<br>方法 or 属性: context: AccessibilityExtensionContext;|@ohos.application.AccessibilityExtensionAbility.d.ts| +|新增|NA|模块名: ohos.application.AccessibilityExtensionAbility<br>类名: AccessibilityExtensionAbility<br>方法 or 属性: onConnect(): void;|@ohos.application.AccessibilityExtensionAbility.d.ts| +|新增|NA|模块名: ohos.application.AccessibilityExtensionAbility<br>类名: AccessibilityExtensionAbility<br>方法 or 属性: onDisconnect(): void;|@ohos.application.AccessibilityExtensionAbility.d.ts| +|新增|NA|模块名: ohos.application.AccessibilityExtensionAbility<br>类名: AccessibilityExtensionAbility<br>方法 or 属性: onAccessibilityEvent(event: AccessibilityEvent): void;|@ohos.application.AccessibilityExtensionAbility.d.ts| +|新增|NA|模块名: ohos.application.AccessibilityExtensionAbility<br>类名: AccessibilityExtensionAbility<br>方法 or 属性: onKeyEvent(keyEvent: KeyEvent): boolean;|@ohos.application.AccessibilityExtensionAbility.d.ts| +|新增|NA|模块名: ohos.application.AccessibilityExtensionAbility<br>类名: AccessibilityEvent|@ohos.application.AccessibilityExtensionAbility.d.ts| +|新增|NA|模块名: ohos.application.AccessibilityExtensionAbility<br>类名: AccessibilityEvent<br>方法 or 属性: eventType: accessibility.EventType \| accessibility.WindowUpdateType \|<br> TouchGuideType \| GestureType \| PageUpdateType;|@ohos.application.AccessibilityExtensionAbility.d.ts| +|新增|NA|模块名: ohos.application.AccessibilityExtensionAbility<br>类名: AccessibilityEvent<br>方法 or 属性: target?: AccessibilityElement;|@ohos.application.AccessibilityExtensionAbility.d.ts| +|新增|NA|模块名: ohos.application.AccessibilityExtensionAbility<br>类名: AccessibilityEvent<br>方法 or 属性: timeStamp?: number;|@ohos.application.AccessibilityExtensionAbility.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: AccessibilityExtensionContext|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: AccessibilityExtensionContext<br>方法 or 属性: setTargetBundleName(targetNames: Array\<string>): Promise\<void>;|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: AccessibilityExtensionContext<br>方法 or 属性: setTargetBundleName(targetNames: Array\<string>, callback: AsyncCallback\<void>): void;|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: AccessibilityExtensionContext<br>方法 or 属性: getFocusElement(isAccessibilityFocus?: boolean): Promise\<AccessibilityElement>;|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: AccessibilityExtensionContext<br>方法 or 属性: getFocusElement(callback: AsyncCallback\<AccessibilityElement>): void;|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: AccessibilityExtensionContext<br>方法 or 属性: getFocusElement(isAccessibilityFocus: boolean, callback: AsyncCallback\<AccessibilityElement>): void;|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: AccessibilityExtensionContext<br>方法 or 属性: getWindowRootElement(windowId?: number): Promise\<AccessibilityElement>;|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: AccessibilityExtensionContext<br>方法 or 属性: getWindowRootElement(callback: AsyncCallback\<AccessibilityElement>): void;|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: AccessibilityExtensionContext<br>方法 or 属性: getWindowRootElement(windowId: number, callback: AsyncCallback\<AccessibilityElement>): void;|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: AccessibilityExtensionContext<br>方法 or 属性: getWindows(displayId?: number): Promise\<Array\<AccessibilityElement>>;|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: AccessibilityExtensionContext<br>方法 or 属性: getWindows(callback: AsyncCallback\<Array\<AccessibilityElement>>): void;|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: AccessibilityExtensionContext<br>方法 or 属性: getWindows(displayId: number, callback: AsyncCallback\<Array\<AccessibilityElement>>): void;|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: AccessibilityExtensionContext<br>方法 or 属性: injectGesture(gesturePath: GesturePath): Promise\<void>;|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: AccessibilityExtensionContext<br>方法 or 属性: injectGesture(gesturePath: GesturePath, callback: AsyncCallback\<void>): void;|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: AccessibilityElement|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: AccessibilityElement<br>方法 or 属性: attributeNames\<T extends keyof ElementAttributeValues>(): Promise\<Array\<T>>;|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: AccessibilityElement<br>方法 or 属性: attributeNames\<T extends keyof ElementAttributeValues>(callback: AsyncCallback\<Array\<T>>): void;|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: AccessibilityElement<br>方法 or 属性: attributeValue\<T extends keyof ElementAttributeValues>(attributeName: T): Promise\<ElementAttributeValues[T]>;|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: AccessibilityElement<br>方法 or 属性: attributeValue\<T extends keyof ElementAttributeValues>(attributeName: T,<br> callback: AsyncCallback\<ElementAttributeValues[T]>): void;|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: AccessibilityElement<br>方法 or 属性: actionNames(): Promise\<Array\<string>>;|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: AccessibilityElement<br>方法 or 属性: actionNames(callback: AsyncCallback\<Array\<string>>): void;|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: AccessibilityElement<br>方法 or 属性: performAction(actionName: string, parameters?: object): Promise\<void>;|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: AccessibilityElement<br>方法 or 属性: performAction(actionName: string, callback: AsyncCallback\<void>): void;|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: AccessibilityElement<br>方法 or 属性: performAction(actionName: string, parameters: object, callback: AsyncCallback\<void>): void;|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: AccessibilityElement<br>方法 or 属性: findElement(type: 'content', condition: string): Promise\<Array\<AccessibilityElement>>;|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: AccessibilityElement<br>方法 or 属性: findElement(type: 'content', condition: string, callback: AsyncCallback\<Array\<AccessibilityElement>>): void|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: AccessibilityElement<br>方法 or 属性: findElement(type: 'focusType', condition: FocusType): Promise\<AccessibilityElement>;|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: AccessibilityElement<br>方法 or 属性: findElement(type: 'focusType', condition: FocusType, callback: AsyncCallback\<AccessibilityElement>): void|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: AccessibilityElement<br>方法 or 属性: findElement(type: 'focusDirection', condition: FocusDirection): Promise\<AccessibilityElement>;|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: AccessibilityElement<br>方法 or 属性: findElement(type: 'focusDirection', condition: FocusDirection, callback: AsyncCallback\<AccessibilityElement>): void|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: Rect|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: Rect<br>方法 or 属性: left: number;|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: Rect<br>方法 or 属性: top: number;|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: Rect<br>方法 or 属性: width: number;|AccessibilityExtensionContext.d.ts| +|新增|NA|模块名: AccessibilityExtensionContext<br>类名: Rect<br>方法 or 属性: height: number;|AccessibilityExtensionContext.d.ts| +|废弃版本有变化|类名:accessibility<br>方法 or 属性:function getAbilityLists(abilityType: AbilityType, stateType: AbilityState,<br><br> callback: AsyncCallback\<Array\<AccessibilityAbilityInfo>>): void;<br>废弃版本:N/A|类名:accessibility<br>方法 or 属性:function getAbilityLists(abilityType: AbilityType, stateType: AbilityState,<br><br> callback: AsyncCallback\<Array\<AccessibilityAbilityInfo>>): void;<br>废弃版本:9<br>代替接口:ohos.accessibility|@ohos.accessibility.d.ts| +|废弃版本有变化|类名:accessibility<br>方法 or 属性:function getAbilityLists(abilityType: AbilityType,<br><br> stateType: AbilityState): Promise\<Array\<AccessibilityAbilityInfo>>;<br>废弃版本:N/A|类名:accessibility<br>方法 or 属性:function getAbilityLists(abilityType: AbilityType,<br><br> stateType: AbilityState): Promise\<Array\<AccessibilityAbilityInfo>>;<br>废弃版本:9<br>代替接口:ohos.accessibility|@ohos.accessibility.d.ts| +|废弃版本有变化|类名:accessibility<br>方法 or 属性:function sendEvent(event: EventInfo, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:accessibility<br>方法 or 属性:function sendEvent(event: EventInfo, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.accessibility|@ohos.accessibility.d.ts| +|废弃版本有变化|类名:accessibility<br>方法 or 属性:function sendEvent(event: EventInfo): Promise\<void>;<br>废弃版本:N/A|类名:accessibility<br>方法 or 属性:function sendEvent(event: EventInfo): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.accessibility|@ohos.accessibility.d.ts| +|新增(错误码)|NA|类名:accessibility<br>方法 or 属性:function on(type: 'accessibilityStateChange', callback: Callback\<boolean>): void;<br>错误码内容: 401|@ohos.accessibility.d.ts| +|新增(错误码)|NA|类名:accessibility<br>方法 or 属性:function on(type: 'touchGuideStateChange', callback: Callback\<boolean>): void;<br>错误码内容: 401|@ohos.accessibility.d.ts| +|新增(错误码)|NA|类名:accessibility<br>方法 or 属性:function off(type: 'accessibilityStateChange', callback?: Callback\<boolean>): void;<br>错误码内容: 401|@ohos.accessibility.d.ts| +|新增(错误码)|NA|类名:accessibility<br>方法 or 属性:function off(type: 'touchGuideStateChange', callback?: Callback\<boolean>): void;<br>错误码内容: 401|@ohos.accessibility.d.ts| +|新增(错误码)|NA|类名:CaptionsManager<br>方法 or 属性:on(type: 'enableChange', callback: Callback\<boolean>): void;<br>错误码内容: 401|@ohos.accessibility.d.ts| +|新增(错误码)|NA|类名:CaptionsManager<br>方法 or 属性:on(type: 'styleChange', callback: Callback\<CaptionsStyle>): void;<br>错误码内容: 401|@ohos.accessibility.d.ts| +|新增(错误码)|NA|类名:CaptionsManager<br>方法 or 属性:off(type: 'enableChange', callback?: Callback\<boolean>): void;<br>错误码内容: 401|@ohos.accessibility.d.ts| +|新增(错误码)|NA|类名:CaptionsManager<br>方法 or 属性:off(type: 'styleChange', callback?: Callback\<CaptionsStyle>): void;<br>错误码内容: 401|@ohos.accessibility.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-account.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-account.md new file mode 100644 index 0000000000000000000000000000000000000000..037ed74a011908317b5efefa2a085321e646b93c --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-account.md @@ -0,0 +1,378 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|类名:AppAccountManager<br>方法or属性:createAccount(name: string, callback: AsyncCallback\<void>): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:createAccount(name: string, options: CreateAccountOptions, callback: AsyncCallback\<void>): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:createAccount(name: string, options?: CreateAccountOptions): Promise\<void>;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:createAccountImplicitly(owner: string, callback: AuthCallback): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:createAccountImplicitly(owner: string, options: CreateAccountImplicitlyOptions, callback: AuthCallback): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:removeAccount(name: string, callback: AsyncCallback\<void>): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:removeAccount(name: string): Promise\<void>;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:setAppAccess(name: string, bundleName: string, isAccessible: boolean, callback: AsyncCallback\<void>): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:setAppAccess(name: string, bundleName: string, isAccessible: boolean): Promise\<void>;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:checkAppAccess(name: string, bundleName: string, callback: AsyncCallback\<boolean>): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:checkAppAccess(name: string, bundleName: string): Promise\<boolean>;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:checkDataSyncEnabled(name: string, callback: AsyncCallback\<boolean>): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:checkDataSyncEnabled(name: string): Promise\<boolean>;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:setCredential(name: string, credentialType: string, credential: string,<br> callback: AsyncCallback\<void>): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:setCredential(name: string, credentialType: string, credential: string): Promise\<void>;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:setDataSyncEnabled(name: string, isEnabled: boolean, callback: AsyncCallback\<void>): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:setDataSyncEnabled(name: string, isEnabled: boolean): Promise\<void>;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:setCustomData(name: string, key: string, value: string, callback: AsyncCallback\<void>): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:setCustomData(name: string, key: string, value: string): Promise\<void>;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:getAccountsByOwner(owner: string, callback: AsyncCallback\<Array\<AppAccountInfo>>): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:getAccountsByOwner(owner: string): Promise\<Array\<AppAccountInfo>>;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:getCredential(name: string, credentialType: string, callback: AsyncCallback\<string>): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:getCredential(name: string, credentialType: string): Promise\<string>;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:getCustomData(name: string, key: string, callback: AsyncCallback\<string>): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:getCustomData(name: string, key: string): Promise\<string>;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:getCustomDataSync(name: string, key: string): string;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:on(type: 'accountChange', owners: Array\<string>, callback: Callback\<Array\<AppAccountInfo>>): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:off(type: 'accountChange', callback?: Callback\<Array\<AppAccountInfo>>): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:auth(name: string, owner: string, authType: string, callback: AuthCallback): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:auth(name: string, owner: string, authType: string, options: {[key:string]: Object}, callback: AuthCallback): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:getAuthToken(name: string, owner: string, authType: string, callback: AsyncCallback\<string>): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:getAuthToken(name: string, owner: string, authType: string): Promise\<string>;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:setAuthToken(name: string, authType: string, token: string, callback: AsyncCallback\<void>): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:setAuthToken(name: string, authType: string, token: string): Promise\<void>;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:deleteAuthToken(name: string, owner: string, authType: string, token: string, callback: AsyncCallback\<void>): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:deleteAuthToken(name: string, owner: string, authType: string, token: string): Promise\<void>;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:setAuthTokenVisibility(name: string, authType: string, bundleName: string, isVisible: boolean, callback: AsyncCallback\<void>): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:setAuthTokenVisibility(name: string, authType: string, bundleName: string, isVisible: boolean): Promise\<void>;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:checkAuthTokenVisibility(name: string, authType: string, bundleName: string, callback: AsyncCallback\<boolean>): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:checkAuthTokenVisibility(name: string, authType: string, bundleName: string): Promise\<boolean>;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:getAllAuthTokens(name: string, owner: string, callback: AsyncCallback\<Array\<AuthTokenInfo>>): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:getAllAuthTokens(name: string, owner: string): Promise\<Array\<AuthTokenInfo>>;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:getAuthList(name: string, authType: string, callback: AsyncCallback\<Array\<string>>): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:getAuthList(name: string, authType: string): Promise\<Array\<string>>;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:getAuthCallback(sessionId: string, callback: AsyncCallback\<AuthCallback>): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:getAuthCallback(sessionId: string): Promise\<AuthCallback>;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:queryAuthenticatorInfo(owner: string, callback: AsyncCallback\<AuthenticatorInfo>): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:queryAuthenticatorInfo(owner: string): Promise\<AuthenticatorInfo>;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:checkAccountLabels(name: string, owner: string, labels: Array\<string>, callback: AsyncCallback\<boolean>): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:checkAccountLabels(name: string, owner: string, labels: Array\<string>): Promise\<boolean>;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:deleteCredential(name: string, credentialType: string, callback: AsyncCallback\<void>): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:deleteCredential(name: string, credentialType: string): Promise\<void>;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:selectAccountsByOptions(options: SelectAccountsOptions, callback: AsyncCallback\<Array\<AppAccountInfo>>): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:selectAccountsByOptions(options: SelectAccountsOptions): Promise\<Array\<AppAccountInfo>>;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:verifyCredential(name: string, owner: string, callback: AuthCallback): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:verifyCredential(name: string, owner: string, options: VerifyCredentialOptions, callback: AuthCallback): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:setAuthenticatorProperties(owner: string, callback: AuthCallback): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AppAccountManager<br>方法or属性:setAuthenticatorProperties(owner: string, options: SetPropertiesOptions, callback: AuthCallback): void;|@ohos.account.appAccount.d.ts| +|新增|NA|模块名: ohos.account.appAccount<br>类名: AuthTokenInfo|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AuthTokenInfo<br>方法or属性:|@ohos.account.appAccount.d.ts| +|新增|NA|模块名: ohos.account.appAccount<br>类名: AuthTokenInfo<br>方法 or 属性:authType: string;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AuthTokenInfo<br>方法or属性:authType: string;|@ohos.account.appAccount.d.ts| +|新增|NA|模块名: ohos.account.appAccount<br>类名: AuthTokenInfo<br>方法 or 属性:token: string;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AuthTokenInfo<br>方法or属性:token: string;|@ohos.account.appAccount.d.ts| +|新增|NA|模块名: ohos.account.appAccount<br>类名: AuthTokenInfo<br>方法 or 属性:account?: AppAccountInfo;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AuthTokenInfo<br>方法or属性:account?: AppAccountInfo;|@ohos.account.appAccount.d.ts| +|新增|NA|模块名: ohos.account.appAccount<br>类名: AuthResult|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AuthResult<br>方法or属性:|@ohos.account.appAccount.d.ts| +|新增|NA|模块名: ohos.account.appAccount<br>类名: AuthResult<br>方法 or 属性:account?: AppAccountInfo;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AuthResult<br>方法or属性:account?: AppAccountInfo;|@ohos.account.appAccount.d.ts| +|新增|NA|模块名: ohos.account.appAccount<br>类名: AuthResult<br>方法 or 属性:tokenInfo?: AuthTokenInfo;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AuthResult<br>方法or属性:tokenInfo?: AuthTokenInfo;|@ohos.account.appAccount.d.ts| +|新增|NA|模块名: ohos.account.appAccount<br>类名: CreateAccountOptions|@ohos.account.appAccount.d.ts| +|新增|NA|类名:CreateAccountOptions<br>方法or属性:|@ohos.account.appAccount.d.ts| +|新增|NA|模块名: ohos.account.appAccount<br>类名: CreateAccountOptions<br>方法 or 属性:customData?: {[key: string]: string};|@ohos.account.appAccount.d.ts| +|新增|NA|类名:CreateAccountOptions<br>方法or属性:customData?: {[key: string]: string};|@ohos.account.appAccount.d.ts| +|新增|NA|模块名: ohos.account.appAccount<br>类名: CreateAccountImplicitlyOptions|@ohos.account.appAccount.d.ts| +|新增|NA|类名:CreateAccountImplicitlyOptions<br>方法or属性:|@ohos.account.appAccount.d.ts| +|新增|NA|模块名: ohos.account.appAccount<br>类名: CreateAccountImplicitlyOptions<br>方法 or 属性:requiredLabels?: Array\<string>;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:CreateAccountImplicitlyOptions<br>方法or属性:requiredLabels?: Array\<string>;|@ohos.account.appAccount.d.ts| +|新增|NA|模块名: ohos.account.appAccount<br>类名: CreateAccountImplicitlyOptions<br>方法 or 属性:authType?: string;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:CreateAccountImplicitlyOptions<br>方法or属性:authType?: string;|@ohos.account.appAccount.d.ts| +|新增|NA|模块名: ohos.account.appAccount<br>类名: CreateAccountImplicitlyOptions<br>方法 or 属性:parameters?: {[key:string]: Object};|@ohos.account.appAccount.d.ts| +|新增|NA|类名:CreateAccountImplicitlyOptions<br>方法or属性:parameters?: {[key:string]: Object};|@ohos.account.appAccount.d.ts| +|新增|NA|模块名: ohos.account.appAccount<br>类名: SelectAccountsOptions|@ohos.account.appAccount.d.ts| +|新增|NA|类名:SelectAccountsOptions<br>方法or属性:|@ohos.account.appAccount.d.ts| +|新增|NA|模块名: ohos.account.appAccount<br>类名: SelectAccountsOptions<br>方法 or 属性:allowedAccounts?: Array\<AppAccountInfo>;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:SelectAccountsOptions<br>方法or属性:allowedAccounts?: Array\<AppAccountInfo>;|@ohos.account.appAccount.d.ts| +|新增|NA|模块名: ohos.account.appAccount<br>类名: SelectAccountsOptions<br>方法 or 属性:allowedOwners?: Array\<string>;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:SelectAccountsOptions<br>方法or属性:allowedOwners?: Array\<string>;|@ohos.account.appAccount.d.ts| +|新增|NA|模块名: ohos.account.appAccount<br>类名: SelectAccountsOptions<br>方法 or 属性:requiredLabels?: Array\<string>;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:SelectAccountsOptions<br>方法or属性:requiredLabels?: Array\<string>;|@ohos.account.appAccount.d.ts| +|新增|NA|模块名: ohos.account.appAccount<br>类名: VerifyCredentialOptions|@ohos.account.appAccount.d.ts| +|新增|NA|类名:VerifyCredentialOptions<br>方法or属性:|@ohos.account.appAccount.d.ts| +|新增|NA|模块名: ohos.account.appAccount<br>类名: VerifyCredentialOptions<br>方法 or 属性:credentialType?: string;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:VerifyCredentialOptions<br>方法or属性:credentialType?: string;|@ohos.account.appAccount.d.ts| +|新增|NA|模块名: ohos.account.appAccount<br>类名: VerifyCredentialOptions<br>方法 or 属性:credential?: string;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:VerifyCredentialOptions<br>方法or属性:credential?: string;|@ohos.account.appAccount.d.ts| +|新增|NA|模块名: ohos.account.appAccount<br>类名: VerifyCredentialOptions<br>方法 or 属性:parameters?: {[key:string]: Object};|@ohos.account.appAccount.d.ts| +|新增|NA|类名:VerifyCredentialOptions<br>方法or属性:parameters?: {[key:string]: Object};|@ohos.account.appAccount.d.ts| +|新增|NA|模块名: ohos.account.appAccount<br>类名: SetPropertiesOptions|@ohos.account.appAccount.d.ts| +|新增|NA|类名:SetPropertiesOptions<br>方法or属性:|@ohos.account.appAccount.d.ts| +|新增|NA|模块名: ohos.account.appAccount<br>类名: SetPropertiesOptions<br>方法 or 属性:properties?: {[key: string]: Object};|@ohos.account.appAccount.d.ts| +|新增|NA|类名:SetPropertiesOptions<br>方法or属性:properties?: {[key: string]: Object};|@ohos.account.appAccount.d.ts| +|新增|NA|模块名: ohos.account.appAccount<br>类名: SetPropertiesOptions<br>方法 or 属性:parameters?: {[key: string]: Object};|@ohos.account.appAccount.d.ts| +|新增|NA|类名:SetPropertiesOptions<br>方法or属性:parameters?: {[key: string]: Object};|@ohos.account.appAccount.d.ts| +|新增|NA|类名:Constants<br>方法or属性:ACTION_CREATE_ACCOUNT_IMPLICITLY = "createAccountImplicitly"|@ohos.account.appAccount.d.ts| +|新增|NA|类名:Constants<br>方法or属性:ACTION_AUTH = "auth"|@ohos.account.appAccount.d.ts| +|新增|NA|类名:Constants<br>方法or属性:ACTION_VERIFY_CREDENTIAL = "verifyCredential"|@ohos.account.appAccount.d.ts| +|新增|NA|类名:Constants<br>方法or属性:ACTION_SET_AUTHENTICATOR_PROPERTIES = "setAuthenticatorProperties"|@ohos.account.appAccount.d.ts| +|新增|NA|类名:Constants<br>方法or属性:KEY_REQUIRED_LABELS = "requiredLabels"|@ohos.account.appAccount.d.ts| +|新增|NA|类名:Constants<br>方法or属性:KEY_BOOLEAN_RESULT = "booleanResult"|@ohos.account.appAccount.d.ts| +|新增|NA|模块名: ohos.account.appAccount<br>类名: AuthCallback|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AuthCallback<br>方法or属性:|@ohos.account.appAccount.d.ts| +|新增|NA|模块名: ohos.account.appAccount<br>类名: AuthCallback<br>方法 or 属性:onResult: (code: number, result?: AuthResult) => void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AuthCallback<br>方法or属性:onResult: (code: number, result?: AuthResult) => void;|@ohos.account.appAccount.d.ts| +|新增|NA|模块名: ohos.account.appAccount<br>类名: AuthCallback<br>方法 or 属性:onRequestRedirected: (request: Want) => void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AuthCallback<br>方法or属性:onRequestRedirected: (request: Want) => void;|@ohos.account.appAccount.d.ts| +|新增|NA|模块名: ohos.account.appAccount<br>类名: AuthCallback<br>方法 or 属性:onRequestContinued?: () => void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:AuthCallback<br>方法or属性:onRequestContinued?: () => void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:Authenticator<br>方法or属性:createAccountImplicitly(options: CreateAccountImplicitlyOptions, callback: AuthCallback): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:Authenticator<br>方法or属性:auth(name: string, authType: string, options: {[key:string]: Object}, callback: AuthCallback): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:Authenticator<br>方法or属性:verifyCredential(name: string, options: VerifyCredentialOptions, callback: AuthCallback): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:Authenticator<br>方法or属性:setProperties(options: SetPropertiesOptions, callback: AuthCallback): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:Authenticator<br>方法or属性:checkAccountLabels(name: string, labels: Array\<string>, callback: AuthCallback): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:Authenticator<br>方法or属性:checkAccountRemovable(name: string, callback: AuthCallback): void;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:Authenticator<br>方法or属性:getRemoteObject(): rpc.RemoteObject;|@ohos.account.appAccount.d.ts| +|新增|NA|类名:DistributedAccountAbility<br>方法or属性:getOsAccountDistributedInfo(callback: AsyncCallback\<DistributedInfo>): void;|@ohos.account.distributedAccount.d.ts| +|新增|NA|类名:DistributedAccountAbility<br>方法or属性:getOsAccountDistributedInfo(): Promise\<DistributedInfo>;|@ohos.account.distributedAccount.d.ts| +|新增|NA|类名:DistributedAccountAbility<br>方法or属性:setOsAccountDistributedInfo(accountInfo: DistributedInfo, callback: AsyncCallback\<void>): void;|@ohos.account.distributedAccount.d.ts| +|新增|NA|类名:DistributedAccountAbility<br>方法or属性:setOsAccountDistributedInfo(accountInfo: DistributedInfo): Promise\<void>;|@ohos.account.distributedAccount.d.ts| +|新增|NA|类名:DistributedInfo<br>方法or属性:nickname?: string;|@ohos.account.distributedAccount.d.ts| +|新增|NA|类名:DistributedInfo<br>方法or属性:avatar?: string;|@ohos.account.distributedAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:checkMultiOsAccountEnabled(callback: AsyncCallback\<boolean>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:checkMultiOsAccountEnabled(): Promise\<boolean>;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:checkOsAccountActivated(localId: number, callback: AsyncCallback\<boolean>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:checkOsAccountActivated(localId: number): Promise\<boolean>;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:checkOsAccountConstraintEnabled(localId: number, constraint: string, callback: AsyncCallback\<boolean>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:checkOsAccountConstraintEnabled(localId: number, constraint: string): Promise\<boolean>;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:checkOsAccountTestable(callback: AsyncCallback\<boolean>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:checkOsAccountTestable(): Promise\<boolean>;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:checkOsAccountVerified(callback: AsyncCallback\<boolean>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:checkOsAccountVerified(): Promise\<boolean>;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:checkOsAccountVerified(localId: number, callback: AsyncCallback\<boolean>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:checkOsAccountVerified(localId: number): Promise\<boolean>;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getOsAccountCount(callback: AsyncCallback\<number>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getOsAccountCount(): Promise\<number>;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getOsAccountLocalId(callback: AsyncCallback\<number>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getOsAccountLocalId(): Promise\<number>;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getOsAccountLocalIdForUid(uid: number, callback: AsyncCallback\<number>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getOsAccountLocalIdForUid(uid: number): Promise\<number>;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback\<number>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getOsAccountLocalIdForDomain(domainInfo: DomainAccountInfo): Promise\<number>;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getOsAccountConstraints(localId: number, callback: AsyncCallback\<Array\<string>>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getOsAccountConstraints(localId: number): Promise\<Array\<string>>;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getActivatedOsAccountLocalIds(callback: AsyncCallback\<Array\<number>>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getActivatedOsAccountLocalIds(): Promise\<Array\<number>>;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getCurrentOsAccount(callback: AsyncCallback\<OsAccountInfo>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getCurrentOsAccount(): Promise\<OsAccountInfo>;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getOsAccountType(callback: AsyncCallback\<OsAccountType>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getOsAccountType(): Promise\<OsAccountType>;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:queryDistributedVirtualDeviceId(callback: AsyncCallback\<string>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:queryDistributedVirtualDeviceId(): Promise\<string>;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getOsAccountLocalIdForSerialNumber(serialNumber: number, callback: AsyncCallback\<number>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getOsAccountLocalIdForSerialNumber(serialNumber: number): Promise\<number>;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getSerialNumberForOsAccountLocalId(localId: number, callback: AsyncCallback\<number>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getSerialNumberForOsAccountLocalId(localId: number): Promise\<number>;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getBundleIdForUid(uid: number, callback: AsyncCallback\<number>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getBundleIdForUid(uid: number): Promise\<number>;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:isMainOsAccount(callback: AsyncCallback\<boolean>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:isMainOsAccount(): Promise\<boolean>;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getOsAccountConstraintSourceTypes(localId: number, constraint: string, callback: AsyncCallback\<Array\<ConstraintSourceTypeInfo>>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AccountManager<br>方法or属性:getOsAccountConstraintSourceTypes(localId: number, constraint: string): Promise\<Array\<ConstraintSourceTypeInfo>>;|@ohos.account.osAccount.d.ts| +|新增|NA|模块名: ohos.account.osAccount<br>类名: InputerManager|@ohos.account.osAccount.d.ts| +|新增|NA|类名:InputerManager<br>方法or属性:|@ohos.account.osAccount.d.ts| +|新增|NA|模块名: ohos.account.osAccount<br>类名: InputerManager<br>方法 or 属性:static registerInputer(authType: AuthType, inputer: IInputer): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:InputerManager<br>方法or属性:static registerInputer(authType: AuthType, inputer: IInputer): void;|@ohos.account.osAccount.d.ts| +|新增|NA|模块名: ohos.account.osAccount<br>类名: InputerManager<br>方法 or 属性:static unregisterInputer(authType: AuthType): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:InputerManager<br>方法or属性:static unregisterInputer(authType: AuthType): void;|@ohos.account.osAccount.d.ts| +|新增|NA|模块名: ohos.account.osAccount<br>类名: DomainPlugin|@ohos.account.osAccount.d.ts| +|新增|NA|类名:DomainPlugin<br>方法or属性:|@ohos.account.osAccount.d.ts| +|新增|NA|模块名: ohos.account.osAccount<br>类名: DomainPlugin<br>方法 or 属性:auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUserAuthCallback): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:DomainPlugin<br>方法or属性:auth(domainAccountInfo: DomainAccountInfo, credential: Uint8Array, callback: IUserAuthCallback): void;|@ohos.account.osAccount.d.ts| +|新增|NA|模块名: ohos.account.osAccount<br>类名: DomainAccountManager|@ohos.account.osAccount.d.ts| +|新增|NA|类名:DomainAccountManager<br>方法or属性:|@ohos.account.osAccount.d.ts| +|新增|NA|模块名: ohos.account.osAccount<br>类名: DomainAccountManager<br>方法 or 属性:static registerPlugin(plugin: DomainPlugin): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:DomainAccountManager<br>方法or属性:static registerPlugin(plugin: DomainPlugin): void;|@ohos.account.osAccount.d.ts| +|新增|NA|模块名: ohos.account.osAccount<br>类名: DomainAccountManager<br>方法 or 属性:static unregisterPlugin(): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:DomainAccountManager<br>方法or属性:static unregisterPlugin(): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:UserIdentityManager<br>方法or属性:getAuthInfo(callback: AsyncCallback\<Array\<EnrolledCredInfo>>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:UserIdentityManager<br>方法or属性:getAuthInfo(authType: AuthType, callback: AsyncCallback\<Array\<EnrolledCredInfo>>): void;|@ohos.account.osAccount.d.ts| +|新增|NA|模块名: ohos.account.osAccount<br>类名: AuthType<br>方法 or 属性:DOMAIN = 1024|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AuthType<br>方法or属性:DOMAIN = 1024|@ohos.account.osAccount.d.ts| +|新增|NA|模块名: ohos.account.osAccount<br>类名: AuthSubType<br>方法 or 属性:DOMAIN_MIXED = 10240001|@ohos.account.osAccount.d.ts| +|新增|NA|类名:AuthSubType<br>方法or属性:DOMAIN_MIXED = 10240001|@ohos.account.osAccount.d.ts| +|新增|NA|模块名: ohos.account.osAccount<br>类名: ConstraintSourceType|@ohos.account.osAccount.d.ts| +|新增|NA|类名:ConstraintSourceType<br>方法or属性:|@ohos.account.osAccount.d.ts| +|新增|NA|模块名: ohos.account.osAccount<br>类名: ConstraintSourceType<br>方法 or 属性:CONSTRAINT_NOT_EXIST = 0|@ohos.account.osAccount.d.ts| +|新增|NA|类名:ConstraintSourceType<br>方法or属性:CONSTRAINT_NOT_EXIST = 0|@ohos.account.osAccount.d.ts| +|新增|NA|模块名: ohos.account.osAccount<br>类名: ConstraintSourceType<br>方法 or 属性:CONSTRAINT_TYPE_BASE = 1|@ohos.account.osAccount.d.ts| +|新增|NA|类名:ConstraintSourceType<br>方法or属性:CONSTRAINT_TYPE_BASE = 1|@ohos.account.osAccount.d.ts| +|新增|NA|模块名: ohos.account.osAccount<br>类名: ConstraintSourceType<br>方法 or 属性:CONSTRAINT_TYPE_DEVICE_OWNER = 2|@ohos.account.osAccount.d.ts| +|新增|NA|类名:ConstraintSourceType<br>方法or属性:CONSTRAINT_TYPE_DEVICE_OWNER = 2|@ohos.account.osAccount.d.ts| +|新增|NA|模块名: ohos.account.osAccount<br>类名: ConstraintSourceType<br>方法 or 属性:CONSTRAINT_TYPE_PROFILE_OWNER = 3|@ohos.account.osAccount.d.ts| +|新增|NA|类名:ConstraintSourceType<br>方法or属性:CONSTRAINT_TYPE_PROFILE_OWNER = 3|@ohos.account.osAccount.d.ts| +|新增|NA|模块名: ohos.account.osAccount<br>类名: ConstraintSourceTypeInfo|@ohos.account.osAccount.d.ts| +|新增|NA|类名:ConstraintSourceTypeInfo<br>方法or属性:|@ohos.account.osAccount.d.ts| +|新增|NA|模块名: ohos.account.osAccount<br>类名: ConstraintSourceTypeInfo<br>方法 or 属性:localId: number;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:ConstraintSourceTypeInfo<br>方法or属性:localId: number;|@ohos.account.osAccount.d.ts| +|新增|NA|模块名: ohos.account.osAccount<br>类名: ConstraintSourceTypeInfo<br>方法 or 属性:type: ConstraintSourceType;|@ohos.account.osAccount.d.ts| +|新增|NA|类名:ConstraintSourceTypeInfo<br>方法or属性:type: ConstraintSourceType;|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:addAccount(name: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:addAccount(name: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:addAccount(name: string, extraInfo: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:addAccount(name: string, extraInfo: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:addAccount(name: string, extraInfo?: string): Promise\<void>;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:addAccount(name: string, extraInfo?: string): Promise\<void>;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:addAccountImplicitly(owner: string, authType: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:addAccountImplicitly(owner: string, authType: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:deleteAccount(name: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:deleteAccount(name: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:deleteAccount(name: string): Promise\<void>;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:deleteAccount(name: string): Promise\<void>;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:disableAppAccess(name: string, bundleName: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:disableAppAccess(name: string, bundleName: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:disableAppAccess(name: string, bundleName: string): Promise\<void>;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:disableAppAccess(name: string, bundleName: string): Promise\<void>;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:enableAppAccess(name: string, bundleName: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:enableAppAccess(name: string, bundleName: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:enableAppAccess(name: string, bundleName: string): Promise\<void>;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:enableAppAccess(name: string, bundleName: string): Promise\<void>;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:checkAppAccountSyncEnable(name: string, callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:checkAppAccountSyncEnable(name: string, callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:checkAppAccountSyncEnable(name: string): Promise\<boolean>;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:checkAppAccountSyncEnable(name: string): Promise\<boolean>;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:setAccountCredential(name: string, credentialType: string, credential: string,<br> callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:setAccountCredential(name: string, credentialType: string, credential: string,<br> callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:setAccountCredential(name: string, credentialType: string, credential: string): Promise\<void>;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:setAccountCredential(name: string, credentialType: string, credential: string): Promise\<void>;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:setAccountExtraInfo(name: string, extraInfo: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:setAccountExtraInfo(name: string, extraInfo: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:setAccountExtraInfo(name: string, extraInfo: string): Promise\<void>;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:setAccountExtraInfo(name: string, extraInfo: string): Promise\<void>;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:setAppAccountSyncEnable(name: string, isEnable: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:setAppAccountSyncEnable(name: string, isEnable: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:setAppAccountSyncEnable(name: string, isEnable: boolean): Promise\<void>;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:setAppAccountSyncEnable(name: string, isEnable: boolean): Promise\<void>;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:setAssociatedData(name: string, key: string, value: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:setAssociatedData(name: string, key: string, value: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:setAssociatedData(name: string, key: string, value: string): Promise\<void>;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:setAssociatedData(name: string, key: string, value: string): Promise\<void>;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:getAllAccessibleAccounts(callback: AsyncCallback\<Array\<AppAccountInfo>>): void;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:getAllAccessibleAccounts(callback: AsyncCallback\<Array\<AppAccountInfo>>): void;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:getAllAccessibleAccounts(): Promise\<Array\<AppAccountInfo>>;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:getAllAccessibleAccounts(): Promise\<Array\<AppAccountInfo>>;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:getAllAccounts(owner: string, callback: AsyncCallback\<Array\<AppAccountInfo>>): void;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:getAllAccounts(owner: string, callback: AsyncCallback\<Array\<AppAccountInfo>>): void;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:getAllAccounts(owner: string): Promise\<Array\<AppAccountInfo>>;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:getAllAccounts(owner: string): Promise\<Array\<AppAccountInfo>>;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:getAccountCredential(name: string, credentialType: string, callback: AsyncCallback\<string>): void;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:getAccountCredential(name: string, credentialType: string, callback: AsyncCallback\<string>): void;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:getAccountCredential(name: string, credentialType: string): Promise\<string>;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:getAccountCredential(name: string, credentialType: string): Promise\<string>;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:getAccountExtraInfo(name: string, callback: AsyncCallback\<string>): void;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:getAccountExtraInfo(name: string, callback: AsyncCallback\<string>): void;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:getAccountExtraInfo(name: string): Promise\<string>;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:getAccountExtraInfo(name: string): Promise\<string>;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:getAssociatedData(name: string, key: string, callback: AsyncCallback\<string>): void;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:getAssociatedData(name: string, key: string, callback: AsyncCallback\<string>): void;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:getAssociatedData(name: string, key: string): Promise\<string>;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:getAssociatedData(name: string, key: string): Promise\<string>;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:on(type: 'change', owners: Array\<string>, callback: Callback\<Array\<AppAccountInfo>>): void;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:on(type: 'change', owners: Array\<string>, callback: Callback\<Array\<AppAccountInfo>>): void;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:off(type: 'change', callback?: Callback\<Array\<AppAccountInfo>>): void;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:off(type: 'change', callback?: Callback\<Array\<AppAccountInfo>>): void;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:authenticate(name: string, owner: string, authType: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:authenticate(name: string, owner: string, authType: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:getOAuthToken(name: string, owner: string, authType: string, callback: AsyncCallback\<string>): void;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:getOAuthToken(name: string, owner: string, authType: string, callback: AsyncCallback\<string>): void;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:getOAuthToken(name: string, owner: string, authType: string): Promise\<string>;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:getOAuthToken(name: string, owner: string, authType: string): Promise\<string>;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:setOAuthToken(name: string, authType: string, token: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:setOAuthToken(name: string, authType: string, token: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:setOAuthToken(name: string, authType: string, token: string): Promise\<void>;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:setOAuthToken(name: string, authType: string, token: string): Promise\<void>;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:deleteOAuthToken(name: string, owner: string, authType: string, token: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:deleteOAuthToken(name: string, owner: string, authType: string, token: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:deleteOAuthToken(name: string, owner: string, authType: string, token: string): Promise\<void>;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:deleteOAuthToken(name: string, owner: string, authType: string, token: string): Promise\<void>;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVisible: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVisible: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVisible: boolean): Promise\<void>;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVisible: boolean): Promise\<void>;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:checkOAuthTokenVisibility(name: string, authType: string, bundleName: string, callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:checkOAuthTokenVisibility(name: string, authType: string, bundleName: string, callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:checkOAuthTokenVisibility(name: string, authType: string, bundleName: string): Promise\<boolean>;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:checkOAuthTokenVisibility(name: string, authType: string, bundleName: string): Promise\<boolean>;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:getAllOAuthTokens(name: string, owner: string, callback: AsyncCallback\<Array\<OAuthTokenInfo>>): void;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:getAllOAuthTokens(name: string, owner: string, callback: AsyncCallback\<Array\<OAuthTokenInfo>>): void;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:getAllOAuthTokens(name: string, owner: string): Promise\<Array\<OAuthTokenInfo>>;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:getAllOAuthTokens(name: string, owner: string): Promise\<Array\<OAuthTokenInfo>>;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:getOAuthList(name: string, authType: string, callback: AsyncCallback\<Array\<string>>): void;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:getOAuthList(name: string, authType: string, callback: AsyncCallback\<Array\<string>>): void;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:getOAuthList(name: string, authType: string): Promise\<Array\<string>>;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:getOAuthList(name: string, authType: string): Promise\<Array\<string>>;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:getAuthenticatorCallback(sessionId: string, callback: AsyncCallback\<AuthenticatorCallback>): void;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:getAuthenticatorCallback(sessionId: string, callback: AsyncCallback\<AuthenticatorCallback>): void;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:getAuthenticatorCallback(sessionId: string): Promise\<AuthenticatorCallback>;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:getAuthenticatorCallback(sessionId: string): Promise\<AuthenticatorCallback>;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:getAuthenticatorInfo(owner: string, callback: AsyncCallback\<AuthenticatorInfo>): void;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:getAuthenticatorInfo(owner: string, callback: AsyncCallback\<AuthenticatorInfo>): void;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AppAccountManager<br>方法 or 属性:getAuthenticatorInfo(owner: string): Promise\<AuthenticatorInfo>;<br>废弃版本:N/A|类名:AppAccountManager<br>方法 or 属性:getAuthenticatorInfo(owner: string): Promise\<AuthenticatorInfo>;<br>废弃版本:9<br>代替接口:appAccount.AppAccountManager|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:OAuthTokenInfo<br>废弃版本:N/A|类名:OAuthTokenInfo<br>废弃版本:9<br>代替接口:appAccount.AuthTokenInfo |@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:Constants<br>方法 or 属性:ACTION_ADD_ACCOUNT_IMPLICITLY = "addAccountImplicitly"<br>废弃版本:N/A|类名:Constants<br>方法 or 属性:ACTION_ADD_ACCOUNT_IMPLICITLY = "addAccountImplicitly"<br>废弃版本:9<br>代替接口:appAccount.Constants|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:Constants<br>方法 or 属性:ACTION_AUTHENTICATE = "authenticate"<br>废弃版本:N/A|类名:Constants<br>方法 or 属性:ACTION_AUTHENTICATE = "authenticate"<br>废弃版本:9<br>代替接口:appAccount.Constants|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:ResultCode<br>废弃版本:N/A|类名:ResultCode<br>废弃版本:9<br>代替接口:N/A|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:AuthenticatorCallback<br>废弃版本:N/A|类名:AuthenticatorCallback<br>废弃版本:9<br>代替接口:AppAccount.AuthCallback |@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:Authenticator<br>方法 or 属性:addAccountImplicitly(authType: string, callerBundleName: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void;<br>废弃版本:N/A|类名:Authenticator<br>方法 or 属性:addAccountImplicitly(authType: string, callerBundleName: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void;<br>废弃版本:9<br>代替接口:appAccount.Authenticator|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:Authenticator<br>方法 or 属性:authenticate(name: string, authType: string, callerBundleName: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void;<br>废弃版本:N/A|类名:Authenticator<br>方法 or 属性:authenticate(name: string, authType: string, callerBundleName: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void;<br>废弃版本:9<br>代替接口:appAccount.Authenticator|@ohos.account.appAccount.d.ts| +|废弃版本有变化|类名:DistributedAccountAbility<br>方法 or 属性:queryOsAccountDistributedInfo(callback: AsyncCallback\<DistributedInfo>): void;<br>废弃版本:N/A|类名:DistributedAccountAbility<br>方法 or 属性:queryOsAccountDistributedInfo(callback: AsyncCallback\<DistributedInfo>): void;<br>废弃版本:9<br>代替接口:distributedAccount.DistributedAccountAbility|@ohos.account.distributedAccount.d.ts| +|废弃版本有变化|类名:DistributedAccountAbility<br>方法 or 属性:queryOsAccountDistributedInfo(): Promise\<DistributedInfo>;<br>废弃版本:N/A|类名:DistributedAccountAbility<br>方法 or 属性:queryOsAccountDistributedInfo(): Promise\<DistributedInfo>;<br>废弃版本:9<br>代替接口:distributedAccount.DistributedAccountAbility|@ohos.account.distributedAccount.d.ts| +|废弃版本有变化|类名:DistributedAccountAbility<br>方法 or 属性:updateOsAccountDistributedInfo(accountInfo: DistributedInfo, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:DistributedAccountAbility<br>方法 or 属性:updateOsAccountDistributedInfo(accountInfo: DistributedInfo, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:distributedAccount.DistributedAccountAbility|@ohos.account.distributedAccount.d.ts| +|废弃版本有变化|类名:DistributedAccountAbility<br>方法 or 属性:updateOsAccountDistributedInfo(accountInfo: DistributedInfo): Promise\<void>;<br>废弃版本:N/A|类名:DistributedAccountAbility<br>方法 or 属性:updateOsAccountDistributedInfo(accountInfo: DistributedInfo): Promise\<void>;<br>废弃版本:9<br>代替接口:distributedAccount.DistributedAccountAbility|@ohos.account.distributedAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:isMultiOsAccountEnable(callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:isMultiOsAccountEnable(callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:isMultiOsAccountEnable(): Promise\<boolean>;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:isMultiOsAccountEnable(): Promise\<boolean>;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:isOsAccountActived(localId: number, callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:isOsAccountActived(localId: number, callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:isOsAccountActived(localId: number): Promise\<boolean>;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:isOsAccountActived(localId: number): Promise\<boolean>;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:isOsAccountConstraintEnable(localId: number, constraint: string, callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:isOsAccountConstraintEnable(localId: number, constraint: string, callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:isOsAccountConstraintEnable(localId: number, constraint: string): Promise\<boolean>;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:isOsAccountConstraintEnable(localId: number, constraint: string): Promise\<boolean>;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:isTestOsAccount(callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:isTestOsAccount(callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:isTestOsAccount(): Promise\<boolean>;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:isTestOsAccount(): Promise\<boolean>;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:isOsAccountVerified(callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:isOsAccountVerified(callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:isOsAccountVerified(localId: number, callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:isOsAccountVerified(localId: number, callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:isOsAccountVerified(localId?: number): Promise\<boolean>;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:isOsAccountVerified(localId?: number): Promise\<boolean>;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:getCreatedOsAccountsCount(callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:getCreatedOsAccountsCount(callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:getCreatedOsAccountsCount(): Promise\<number>;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:getCreatedOsAccountsCount(): Promise\<number>;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:getOsAccountLocalIdFromProcess(callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:getOsAccountLocalIdFromProcess(callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:getOsAccountLocalIdFromProcess(): Promise\<number>;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:getOsAccountLocalIdFromProcess(): Promise\<number>;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:getOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:getOsAccountLocalIdFromUid(uid: number, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:getOsAccountLocalIdFromUid(uid: number): Promise\<number>;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:getOsAccountLocalIdFromUid(uid: number): Promise\<number>;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise\<number>;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:getOsAccountLocalIdFromDomain(domainInfo: DomainAccountInfo): Promise\<number>;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:getOsAccountAllConstraints(localId: number, callback: AsyncCallback\<Array\<string>>): void;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:getOsAccountAllConstraints(localId: number, callback: AsyncCallback\<Array\<string>>): void;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:getOsAccountAllConstraints(localId: number): Promise\<Array\<string>>;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:getOsAccountAllConstraints(localId: number): Promise\<Array\<string>>;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:queryActivatedOsAccountIds(callback: AsyncCallback\<Array\<number>>): void;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:queryActivatedOsAccountIds(callback: AsyncCallback\<Array\<number>>): void;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:queryActivatedOsAccountIds(): Promise\<Array\<number>>;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:queryActivatedOsAccountIds(): Promise\<Array\<number>>;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:queryCurrentOsAccount(callback: AsyncCallback\<OsAccountInfo>): void;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:queryCurrentOsAccount(callback: AsyncCallback\<OsAccountInfo>): void;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:queryCurrentOsAccount(): Promise\<OsAccountInfo>;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:queryCurrentOsAccount(): Promise\<OsAccountInfo>;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:getOsAccountTypeFromProcess(callback: AsyncCallback\<OsAccountType>): void;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:getOsAccountTypeFromProcess(callback: AsyncCallback\<OsAccountType>): void;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:getOsAccountTypeFromProcess(): Promise\<OsAccountType>;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:getOsAccountTypeFromProcess(): Promise\<OsAccountType>;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:getDistributedVirtualDeviceId(callback: AsyncCallback\<string>): void;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:getDistributedVirtualDeviceId(callback: AsyncCallback\<string>): void;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:getDistributedVirtualDeviceId(): Promise\<string>;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:getDistributedVirtualDeviceId(): Promise\<string>;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:getOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:getOsAccountLocalIdBySerialNumber(serialNumber: number, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:getOsAccountLocalIdBySerialNumber(serialNumber: number): Promise\<number>;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:getOsAccountLocalIdBySerialNumber(serialNumber: number): Promise\<number>;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:getSerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:getSerialNumberByOsAccountLocalId(localId: number, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|废弃版本有变化|类名:AccountManager<br>方法 or 属性:getSerialNumberByOsAccountLocalId(localId: number): Promise\<number>;<br>废弃版本:N/A|类名:AccountManager<br>方法 or 属性:getSerialNumberByOsAccountLocalId(localId: number): Promise\<number>;<br>废弃版本:9<br>代替接口:osAccount.AccountManager|@ohos.account.osAccount.d.ts| +|起始版本有变化|类名:OAuthTokenInfo<br>方法 or 属性:authType: string;<br>起始版本:N/A|类名:OAuthTokenInfo<br>方法 or 属性:authType: string;<br>起始版本:8|@ohos.account.appAccount.d.ts| +|起始版本有变化|类名:OAuthTokenInfo<br>方法 or 属性:token: string;<br>起始版本:N/A|类名:OAuthTokenInfo<br>方法 or 属性:token: string;<br>起始版本:8|@ohos.account.appAccount.d.ts| +|起始版本有变化|类名:Constants<br>方法 or 属性:ACTION_ADD_ACCOUNT_IMPLICITLY = "addAccountImplicitly"<br>起始版本:N/A|类名:Constants<br>方法 or 属性:ACTION_ADD_ACCOUNT_IMPLICITLY = "addAccountImplicitly"<br>起始版本:8|@ohos.account.appAccount.d.ts| +|起始版本有变化|类名:Constants<br>方法 or 属性:ACTION_AUTHENTICATE = "authenticate"<br>起始版本:N/A|类名:Constants<br>方法 or 属性:ACTION_AUTHENTICATE = "authenticate"<br>起始版本:8|@ohos.account.appAccount.d.ts| +|起始版本有变化|类名:Constants<br>方法 or 属性:KEY_NAME = "name"<br>起始版本:N/A|类名:Constants<br>方法 or 属性:KEY_NAME = "name"<br>起始版本:8|@ohos.account.appAccount.d.ts| +|起始版本有变化|类名:Constants<br>方法 or 属性:KEY_OWNER = "owner"<br>起始版本:N/A|类名:Constants<br>方法 or 属性:KEY_OWNER = "owner"<br>起始版本:8|@ohos.account.appAccount.d.ts| +|起始版本有变化|类名:Constants<br>方法 or 属性:KEY_TOKEN = "token"<br>起始版本:N/A|类名:Constants<br>方法 or 属性:KEY_TOKEN = "token"<br>起始版本:8|@ohos.account.appAccount.d.ts| +|起始版本有变化|类名:Constants<br>方法 or 属性:KEY_ACTION = "action"<br>起始版本:N/A|类名:Constants<br>方法 or 属性:KEY_ACTION = "action"<br>起始版本:8|@ohos.account.appAccount.d.ts| +|起始版本有变化|类名:Constants<br>方法 or 属性:KEY_AUTH_TYPE = "authType"<br>起始版本:N/A|类名:Constants<br>方法 or 属性:KEY_AUTH_TYPE = "authType"<br>起始版本:8|@ohos.account.appAccount.d.ts| +|起始版本有变化|类名:Constants<br>方法 or 属性:KEY_SESSION_ID = "sessionId"<br>起始版本:N/A|类名:Constants<br>方法 or 属性:KEY_SESSION_ID = "sessionId"<br>起始版本:8|@ohos.account.appAccount.d.ts| +|起始版本有变化|类名:Constants<br>方法 or 属性:KEY_CALLER_PID = "callerPid"<br>起始版本:N/A|类名:Constants<br>方法 or 属性:KEY_CALLER_PID = "callerPid"<br>起始版本:8|@ohos.account.appAccount.d.ts| +|起始版本有变化|类名:Constants<br>方法 or 属性:KEY_CALLER_UID = "callerUid"<br>起始版本:N/A|类名:Constants<br>方法 or 属性:KEY_CALLER_UID = "callerUid"<br>起始版本:8|@ohos.account.appAccount.d.ts| +|起始版本有变化|类名:Constants<br>方法 or 属性:KEY_CALLER_BUNDLE_NAME = "callerBundleName"<br>起始版本:N/A|类名:Constants<br>方法 or 属性:KEY_CALLER_BUNDLE_NAME = "callerBundleName"<br>起始版本:8|@ohos.account.appAccount.d.ts| +|起始版本有变化|类名:DistributedInfo<br>方法 or 属性:name: string;<br>起始版本:N/A|类名:DistributedInfo<br>方法 or 属性:name: string;<br>起始版本:7|@ohos.account.distributedAccount.d.ts| +|起始版本有变化|类名:DistributedInfo<br>方法 or 属性:id: string;<br>起始版本:N/A|类名:DistributedInfo<br>方法 or 属性:id: string;<br>起始版本:7|@ohos.account.distributedAccount.d.ts| +|起始版本有变化|类名:DistributedInfo<br>方法 or 属性:event: string;<br>起始版本:N/A|类名:DistributedInfo<br>方法 or 属性:event: string;<br>起始版本:7|@ohos.account.distributedAccount.d.ts| +|起始版本有变化|类名:PINAuth<br>方法 or 属性:unregisterInputer(): void;<br>起始版本:N/A|类名:PINAuth<br>方法 or 属性:unregisterInputer(): void;<br>起始版本:8|@ohos.account.osAccount.d.ts| +|权限有变化|类名:UserIdentityManager<br>方法 or 属性:getAuthInfo(authType?: AuthType): Promise\<Array\<EnrolledCredInfo>>;<br>权限:ohos.permission.ACCESS_USER_IDM|类名:UserIdentityManager<br>方法 or 属性:getAuthInfo(authType?: AuthType): Promise\<Array\<EnrolledCredInfo>>;<br>权限:ohos.permission.USE_USER_IDM|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:AccountManager<br>方法 or 属性:activateOsAccount(localId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 12300001, 12300002, 12300003, 12300008, 12300009|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:AccountManager<br>方法 or 属性:activateOsAccount(localId: number): Promise\<void>;<br>错误码内容: 201, 401, 12300001, 12300002, 12300003, 12300008, 12300009|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:AccountManager<br>方法 or 属性:removeOsAccount(localId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 12300001, 12300002, 12300003, 12300008|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:AccountManager<br>方法 or 属性:removeOsAccount(localId: number): Promise\<void>;<br>错误码内容: 201, 401, 12300001, 12300002, 12300003, 12300008|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:AccountManager<br>方法 or 属性:setOsAccountConstraints(localId: number, constraints: Array\<string>, enable: boolean,<br> callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 12300001, 12300002, 12300003, 12300008|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:AccountManager<br>方法 or 属性:setOsAccountConstraints(localId: number, constraints: Array\<string>, enable: boolean): Promise\<void>;<br>错误码内容: 201, 401, 12300001, 12300002, 12300003, 12300008|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:AccountManager<br>方法 or 属性:setOsAccountName(localId: number, localName: string, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 12300001, 12300002, 12300003, 12300008|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:AccountManager<br>方法 or 属性:setOsAccountName(localId: number, localName: string): Promise\<void>;<br>错误码内容: 201, 401, 12300001, 12300002, 12300003, 12300008|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:AccountManager<br>方法 or 属性:queryMaxOsAccountNumber(callback: AsyncCallback\<number>): void;<br>错误码内容: 401, 12300001|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:AccountManager<br>方法 or 属性:queryMaxOsAccountNumber(): Promise\<number>;<br>错误码内容: 401, 12300001|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:AccountManager<br>方法 or 属性:queryAllCreatedOsAccounts(callback: AsyncCallback\<Array\<OsAccountInfo>>): void;<br>错误码内容: 201, 401, 12300001|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:AccountManager<br>方法 or 属性:queryAllCreatedOsAccounts(): Promise\<Array\<OsAccountInfo>>;<br>错误码内容: 201, 401, 12300001|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:AccountManager<br>方法 or 属性:createOsAccount(localName: string, type: OsAccountType, callback: AsyncCallback\<OsAccountInfo>): void;<br>错误码内容: 201, 401, 12300001, 12300002, 12300005, 12300006, 12300007|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:AccountManager<br>方法 or 属性:createOsAccount(localName: string, type: OsAccountType): Promise\<OsAccountInfo>;<br>错误码内容: 201, 401, 12300001, 12300002, 12300005, 12300006, 12300007|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:AccountManager<br>方法 or 属性:createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo, callback: AsyncCallback\<OsAccountInfo>): void;<br>错误码内容: 201, 401, 12300001, 12300002, 12300005, 12300006, 12300007|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:AccountManager<br>方法 or 属性:createOsAccountForDomain(type: OsAccountType, domainInfo: DomainAccountInfo): Promise\<OsAccountInfo>;<br>错误码内容: 201, 401, 12300001, 12300002, 12300005, 12300006, 12300007|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:AccountManager<br>方法 or 属性:queryOsAccountById(localId: number, callback: AsyncCallback\<OsAccountInfo>): void;<br>错误码内容: 201, 401, 12300001, 12300002, 12300003|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:AccountManager<br>方法 or 属性:queryOsAccountById(localId: number): Promise\<OsAccountInfo>;<br>错误码内容: 201, 401, 12300001, 12300002, 12300003|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:AccountManager<br>方法 or 属性:getOsAccountProfilePhoto(localId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 12300001, 12300002, 12300003|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:AccountManager<br>方法 or 属性:getOsAccountProfilePhoto(localId: number): Promise\<string>;<br>错误码内容: 201, 401, 12300001, 12300002, 12300003|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:AccountManager<br>方法 or 属性:setOsAccountProfilePhoto(localId: number, photo: string, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 12300001, 12300002, 12300003, 12300008|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:AccountManager<br>方法 or 属性:setOsAccountProfilePhoto(localId: number, photo: string): Promise\<void>;<br>错误码内容: 201, 401, 12300001, 12300002, 12300003, 12300008|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:AccountManager<br>方法 or 属性:on(type: 'activate' \| 'activating', name: string, callback: Callback\<number>): void;<br>错误码内容: 201, 401, 12300001, 12300002, 12300011|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:AccountManager<br>方法 or 属性:on(type: 'activate' \| 'activating', name: string, callback: Callback\<number>): void;<br>错误码内容: 201, 401, 12300001, 12300002, 12300011|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:AccountManager<br>方法 or 属性:off(type: 'activate' \| 'activating', name: string, callback?: Callback\<number>): void;<br>错误码内容: 201, 401, 12300001, 12300002, 12300012|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:AccountManager<br>方法 or 属性:off(type: 'activate' \| 'activating', name: string, callback?: Callback\<number>): void;<br>错误码内容: 201, 401, 12300001, 12300002, 12300012|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:UserAuth<br>方法 or 属性:getAvailableStatus(authType: AuthType, authTrustLevel: AuthTrustLevel): number;<br>错误码内容: 201, 401, 12300001, 12300002|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:UserAuth<br>方法 or 属性:getProperty(request: GetPropertyRequest, callback: AsyncCallback\<ExecutorProperty>): void;<br>错误码内容: 201, 401, 12300001, 12300002|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:UserAuth<br>方法 or 属性:getProperty(request: GetPropertyRequest): Promise\<ExecutorProperty>;<br>错误码内容: 201, 401, 12300001, 12300002|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:UserAuth<br>方法 or 属性:auth(challenge: Uint8Array, authType: AuthType, authTrustLevel: AuthTrustLevel, callback: IUserAuthCallback): Uint8Array;<br>错误码内容: 201, 401, 12300001, 12300002, 12300101, 12300105, 12300106, 12300110, 12300111, 12300112|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:UserAuth<br>方法 or 属性:authUser(userId: number, challenge: Uint8Array, authType: AuthType, authTrustLevel: AuthTrustLevel, callback: IUserAuthCallback): Uint8Array;<br>错误码内容: 201, 401, 12300001, 12300002, 12300101, 12300105, 12300106, 12300110, 12300111, 12300112|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:PINAuth<br>方法 or 属性:unregisterInputer(): void;<br>错误码内容: 201|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:UserIdentityManager<br>方法 or 属性:openSession(callback: AsyncCallback\<Uint8Array>): void;<br>错误码内容: 201, 401, 12300001|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:UserIdentityManager<br>方法 or 属性:openSession(): Promise\<Uint8Array>;<br>错误码内容: 201, 401, 12300001|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:UserIdentityManager<br>方法 or 属性:addCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;<br>错误码内容: 201, 401, 12300001, 12300002, 12300101, 12300106|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:UserIdentityManager<br>方法 or 属性:updateCredential(credentialInfo: CredentialInfo, callback: IIdmCallback): void;<br>错误码内容: 201, 401, 12300001, 12300002, 12300101, 12300106|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:UserIdentityManager<br>方法 or 属性:closeSession(): void;<br>错误码内容: 201|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:UserIdentityManager<br>方法 or 属性:delUser(token: Uint8Array, callback: IIdmCallback): void;<br>错误码内容: 201, 401, 12300001, 12300101|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:UserIdentityManager<br>方法 or 属性:delCred(credentialId: Uint8Array, token: Uint8Array, callback: IIdmCallback): void;<br>错误码内容: 201, 401, 12300001, 12300002, 12300101, 12300102|@ohos.account.osAccount.d.ts| +|新增(错误码)|NA|类名:UserIdentityManager<br>方法 or 属性:getAuthInfo(authType?: AuthType): Promise\<Array\<EnrolledCredInfo>>;<br>错误码内容: 201, 401, 12300001, 12300002, 12300102|@ohos.account.osAccount.d.ts| +|新增(权限)|类名:AccountManager<br>方法 or 属性:isOsAccountVerified(callback: AsyncCallback\<boolean>): void;<br>权限:N/A|类名:AccountManager<br>方法 or 属性:isOsAccountVerified(callback: AsyncCallback\<boolean>): void;<br>权限:ohos.permission.MANAGE_LOCAL_ACCOUNTS or ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS|@ohos.account.osAccount.d.ts| +|函数有变化|类名:AppAccountManager<br>方法 or 属性:getAllAccounts(owner: string, callback: AsyncCallback\<Array\<AppAccountInfo>>): void;<br>|类名:AppAccountManager<br>方法 or 属性:getAllAccounts(callback: AsyncCallback\<Array\<AppAccountInfo>>): void;<br>|@ohos.account.appAccount.d.ts| +|函数有变化|类名:AppAccountManager<br>方法 or 属性:getAllAccounts(owner: string): Promise\<Array\<AppAccountInfo>>;<br>|类名:AppAccountManager<br>方法 or 属性:getAllAccounts(): Promise\<Array\<AppAccountInfo>>;<br>|@ohos.account.appAccount.d.ts| +|函数有变化|类名:AppAccountManager<br>方法 or 属性:getAllAccounts(owner: string, callback: AsyncCallback\<Array\<AppAccountInfo>>): void;<br>|类名:AppAccountManager<br>方法 or 属性:getAllAccounts(owner: string, callback: AsyncCallback\<Array\<AppAccountInfo>>): void;<br>|@ohos.account.appAccount.d.ts| +|函数有变化|类名:AppAccountManager<br>方法 or 属性:getAllAccounts(owner: string): Promise\<Array\<AppAccountInfo>>;<br>|类名:AppAccountManager<br>方法 or 属性:getAllAccounts(owner: string): Promise\<Array\<AppAccountInfo>>;<br>|@ohos.account.appAccount.d.ts| +|函数有变化|类名:UserAuth<br>方法 or 属性:setProperty(request: SetPropertyRequest, callback: AsyncCallback\<number>): void;<br>|类名:UserAuth<br>方法 or 属性:setProperty(request: SetPropertyRequest, callback: AsyncCallback\<void>): void;<br>|@ohos.account.osAccount.d.ts| +|函数有变化|类名:UserAuth<br>方法 or 属性:setProperty(request: SetPropertyRequest): Promise\<number>;<br>|类名:UserAuth<br>方法 or 属性:setProperty(request: SetPropertyRequest): Promise\<void>;<br>|@ohos.account.osAccount.d.ts| +|函数有变化|类名:UserAuth<br>方法 or 属性:cancelAuth(contextID: Uint8Array): number;<br>|类名:UserAuth<br>方法 or 属性:cancelAuth(contextID: Uint8Array): void;<br>|@ohos.account.osAccount.d.ts| +|函数有变化|类名:PINAuth<br>方法 or 属性:registerInputer(inputer: IInputer): boolean;<br>|类名:PINAuth<br>方法 or 属性:registerInputer(inputer: IInputer): void;<br>|@ohos.account.osAccount.d.ts| +|函数有变化|类名:UserIdentityManager<br>方法 or 属性:cancel(challenge: Uint8Array): number;<br>|类名:UserIdentityManager<br>方法 or 属性:cancel(challenge: Uint8Array): void;<br>|@ohos.account.osAccount.d.ts| +|函数有变化|类名:IInputData<br>方法 or 属性:onSetData: (pinSubType: AuthSubType, data: Uint8Array) => void;<br>|类名:IInputData<br>方法 or 属性:onSetData: (authSubType: AuthSubType, data: Uint8Array) => void;<br>|@ohos.account.osAccount.d.ts| +|函数有变化|类名:IInputer<br>方法 or 属性:onGetData: (callback: IInputData) => void;<br>|类名:IInputer<br>方法 or 属性:onGetData: (authSubType: AuthSubType, callback: IInputData) => void;<br>|@ohos.account.osAccount.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-application.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-application.md new file mode 100644 index 0000000000000000000000000000000000000000..943e6f09c10353ebf29825097e650f504682aecc --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-application.md @@ -0,0 +1,79 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|类名:Contact<br>方法or属性:readonly id?: number|@ohos.contact.d.ts| +|新增|NA|类名:Contact<br>方法or属性:readonly key?: string|@ohos.contact.d.ts| +|新增|NA|类名:Contact<br>方法or属性:contactAttributes?: ContactAttributes|@ohos.contact.d.ts| +|新增|NA|类名:Contact<br>方法or属性:emails?: Email[]|@ohos.contact.d.ts| +|新增|NA|类名:Contact<br>方法or属性:events?: Event[]|@ohos.contact.d.ts| +|新增|NA|类名:Contact<br>方法or属性:groups?: Group[]|@ohos.contact.d.ts| +|新增|NA|类名:Contact<br>方法or属性:imAddresses?: ImAddress[]|@ohos.contact.d.ts| +|新增|NA|类名:Contact<br>方法or属性:phoneNumbers?: PhoneNumber[]|@ohos.contact.d.ts| +|新增|NA|类名:Contact<br>方法or属性:portrait?: Portrait|@ohos.contact.d.ts| +|新增|NA|类名:Contact<br>方法or属性:postalAddresses?: PostalAddress[]|@ohos.contact.d.ts| +|新增|NA|类名:Contact<br>方法or属性:relations?: Relation[]|@ohos.contact.d.ts| +|新增|NA|类名:Contact<br>方法or属性:sipAddresses?: SipAddress[]|@ohos.contact.d.ts| +|新增|NA|类名:Contact<br>方法or属性:websites?: Website[]|@ohos.contact.d.ts| +|新增|NA|类名:Contact<br>方法or属性:name?: Name|@ohos.contact.d.ts| +|新增|NA|类名:Contact<br>方法or属性:nickName?: NickName|@ohos.contact.d.ts| +|新增|NA|类名:Contact<br>方法or属性:note?: Note|@ohos.contact.d.ts| +|新增|NA|类名:Contact<br>方法or属性:organization?: Organization|@ohos.contact.d.ts| +|新增|NA|类名:Email<br>方法or属性:labelName?: string|@ohos.contact.d.ts| +|新增|NA|类名:Email<br>方法or属性:displayName?: string|@ohos.contact.d.ts| +|新增|NA|类名:Email<br>方法or属性:labelId?: number|@ohos.contact.d.ts| +|新增|NA|类名:Event<br>方法or属性:labelName?: string|@ohos.contact.d.ts| +|新增|NA|类名:Event<br>方法or属性:labelId?: number|@ohos.contact.d.ts| +|新增|NA|类名:Group<br>方法or属性:groupId?: number|@ohos.contact.d.ts| +|新增|NA|类名:Holder<br>方法or属性:readonly displayName?: string|@ohos.contact.d.ts| +|新增|NA|类名:Holder<br>方法or属性:holderId?: number|@ohos.contact.d.ts| +|新增|NA|类名:ImAddress<br>方法or属性:labelName?: string|@ohos.contact.d.ts| +|新增|NA|类名:ImAddress<br>方法or属性:labelId?: number|@ohos.contact.d.ts| +|新增|NA|类名:Name<br>方法or属性:familyName?: string|@ohos.contact.d.ts| +|新增|NA|类名:Name<br>方法or属性:familyNamePhonetic?: string|@ohos.contact.d.ts| +|新增|NA|类名:Name<br>方法or属性:givenName?: string|@ohos.contact.d.ts| +|新增|NA|类名:Name<br>方法or属性:givenNamePhonetic?: string|@ohos.contact.d.ts| +|新增|NA|类名:Name<br>方法or属性:middleName?: string|@ohos.contact.d.ts| +|新增|NA|类名:Name<br>方法or属性:middleNamePhonetic?: string|@ohos.contact.d.ts| +|新增|NA|类名:Name<br>方法or属性:namePrefix?: string|@ohos.contact.d.ts| +|新增|NA|类名:Name<br>方法or属性:nameSuffix?: string|@ohos.contact.d.ts| +|新增|NA|类名:Organization<br>方法or属性:title?: string|@ohos.contact.d.ts| +|新增|NA|类名:PhoneNumber<br>方法or属性:labelName?: string|@ohos.contact.d.ts| +|新增|NA|类名:PhoneNumber<br>方法or属性:labelId?: number|@ohos.contact.d.ts| +|新增|NA|类名:PostalAddress<br>方法or属性:city?: string|@ohos.contact.d.ts| +|新增|NA|类名:PostalAddress<br>方法or属性:country?: string|@ohos.contact.d.ts| +|新增|NA|类名:PostalAddress<br>方法or属性:labelName?: string|@ohos.contact.d.ts| +|新增|NA|类名:PostalAddress<br>方法or属性:neighborhood?: string|@ohos.contact.d.ts| +|新增|NA|类名:PostalAddress<br>方法or属性:pobox?: string|@ohos.contact.d.ts| +|新增|NA|类名:PostalAddress<br>方法or属性:postcode?: string|@ohos.contact.d.ts| +|新增|NA|类名:PostalAddress<br>方法or属性:region?: string|@ohos.contact.d.ts| +|新增|NA|类名:PostalAddress<br>方法or属性:street?: string|@ohos.contact.d.ts| +|新增|NA|类名:PostalAddress<br>方法or属性:labelId?: number|@ohos.contact.d.ts| +|新增|NA|类名:Relation<br>方法or属性:labelName?: string|@ohos.contact.d.ts| +|新增|NA|类名:Relation<br>方法or属性:labelId?: number|@ohos.contact.d.ts| +|新增|NA|类名:SipAddress<br>方法or属性:labelName?: string|@ohos.contact.d.ts| +|新增|NA|类名:SipAddress<br>方法or属性:labelId?: number|@ohos.contact.d.ts| +|model有变化|类名:settings<br>方法 or 属性:function getValue(dataAbilityHelper: DataAbilityHelper, name: string, callback: AsyncCallback\<object>): void;<br>model:N/A|类名:settings<br>方法 or 属性:function getValue(dataAbilityHelper: DataAbilityHelper, name: string, callback: AsyncCallback\<object>): void;<br>model:@FAModelOnly|@ohos.settings.d.ts| +|model有变化|类名:settings<br>方法 or 属性:function getValue(dataAbilityHelper: DataAbilityHelper, name: string): Promise\<object>;<br>model:N/A|类名:settings<br>方法 or 属性:function getValue(dataAbilityHelper: DataAbilityHelper, name: string): Promise\<object>;<br>model:@FAModelOnly|@ohos.settings.d.ts| +|model有变化|类名:settings<br>方法 or 属性:function setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: object, callback: AsyncCallback\<boolean>): void;<br>model:N/A|类名:settings<br>方法 or 属性:function setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: object, callback: AsyncCallback\<boolean>): void;<br>model:@FAModelOnly|@ohos.settings.d.ts| +|model有变化|类名:settings<br>方法 or 属性:function setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: object): Promise\<boolean>;<br>model:N/A|类名:settings<br>方法 or 属性:function setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: object): Promise\<boolean>;<br>model:@FAModelOnly|@ohos.settings.d.ts| +|model有变化|类名:settings<br>方法 or 属性:function getValueSync(dataAbilityHelper: DataAbilityHelper, name: string, defValue: string): string;<br>model:N/A|类名:settings<br>方法 or 属性:function getValueSync(dataAbilityHelper: DataAbilityHelper, name: string, defValue: string): string;<br>model:@FAModelOnly|@ohos.settings.d.ts| +|model有变化|类名:settings<br>方法 or 属性:function setValueSync(dataAbilityHelper: DataAbilityHelper, name: string, value: string): boolean;<br>model:N/A|类名:settings<br>方法 or 属性:function setValueSync(dataAbilityHelper: DataAbilityHelper, name: string, value: string): boolean;<br>model:@FAModelOnly|@ohos.settings.d.ts| +|废弃版本有变化|类名:settings<br>方法 or 属性:function getURI(name: string, callback: AsyncCallback\<object>): void;<br>废弃版本:N/A|类名:settings<br>方法 or 属性:function getURI(name: string, callback: AsyncCallback\<object>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.settings.d.ts| +|废弃版本有变化|类名:settings<br>方法 or 属性:function getURI(name: string): Promise\<object>;<br>废弃版本:N/A|类名:settings<br>方法 or 属性:function getURI(name: string): Promise\<object>;<br>废弃版本:9<br>代替接口:N/A|@ohos.settings.d.ts| +|废弃版本有变化|类名:settings<br>方法 or 属性:function getValue(dataAbilityHelper: DataAbilityHelper, name: string, callback: AsyncCallback\<object>): void;<br>废弃版本:N/A|类名:settings<br>方法 or 属性:function getValue(dataAbilityHelper: DataAbilityHelper, name: string, callback: AsyncCallback\<object>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.settings.d.ts| +|废弃版本有变化|类名:settings<br>方法 or 属性:function getValue(dataAbilityHelper: DataAbilityHelper, name: string): Promise\<object>;<br>废弃版本:N/A|类名:settings<br>方法 or 属性:function getValue(dataAbilityHelper: DataAbilityHelper, name: string): Promise\<object>;<br>废弃版本:9<br>代替接口:N/A|@ohos.settings.d.ts| +|废弃版本有变化|类名:settings<br>方法 or 属性:function setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: object, callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:settings<br>方法 or 属性:function setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: object, callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.settings.d.ts| +|废弃版本有变化|类名:settings<br>方法 or 属性:function setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: object): Promise\<boolean>;<br>废弃版本:N/A|类名:settings<br>方法 or 属性:function setValue(dataAbilityHelper: DataAbilityHelper, name: string, value: object): Promise\<boolean>;<br>废弃版本:9<br>代替接口:N/A|@ohos.settings.d.ts| +|废弃版本有变化|类名:settings<br>方法 or 属性:function getValueSync(dataAbilityHelper: DataAbilityHelper, name: string, defValue: string): string;<br>废弃版本:N/A|类名:settings<br>方法 or 属性:function getValueSync(dataAbilityHelper: DataAbilityHelper, name: string, defValue: string): string;<br>废弃版本:9<br>代替接口:N/A|@ohos.settings.d.ts| +|废弃版本有变化|类名:settings<br>方法 or 属性:function setValueSync(dataAbilityHelper: DataAbilityHelper, name: string, value: string): boolean;<br>废弃版本:N/A|类名:settings<br>方法 or 属性:function setValueSync(dataAbilityHelper: DataAbilityHelper, name: string, value: string): boolean;<br>废弃版本:9<br>代替接口:N/A|@ohos.settings.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function makeCall(phoneNumber: string, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function makeCall(phoneNumber: string): Promise\<void>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(权限)|类名:contact<br>方法 or 属性:function addContact(contact: Contact, callback: AsyncCallback\<number>): void;<br>权限:N/A|类名:contact<br>方法 or 属性:function addContact(contact: Contact, callback: AsyncCallback\<number>): void;<br>权限:ohos.permission.WRITE_CONTACTS|@ohos.contact.d.ts| +|新增(权限)|类名:contact<br>方法 or 属性:function addContact(contact: Contact): Promise\<number>;<br>权限:N/A|类名:contact<br>方法 or 属性:function addContact(contact: Contact): Promise\<number>;<br>权限:ohos.permission.WRITE_CONTACTS|@ohos.contact.d.ts| +|新增(权限)|类名:contact<br>方法 or 属性:function deleteContact(key: string, callback: AsyncCallback\<void>): void;<br>权限:N/A|类名:contact<br>方法 or 属性:function deleteContact(key: string, callback: AsyncCallback\<void>): void;<br>权限:ohos.permission.WRITE_CONTACTS|@ohos.contact.d.ts| +|新增(权限)|类名:contact<br>方法 or 属性:function deleteContact(key: string): Promise\<void>;<br>权限:N/A|类名:contact<br>方法 or 属性:function deleteContact(key: string): Promise\<void>;<br>权限:ohos.permission.WRITE_CONTACTS|@ohos.contact.d.ts| +|新增(权限)|类名:contact<br>方法 or 属性:function updateContact(contact: Contact, callback: AsyncCallback\<void>): void;<br>权限:N/A|类名:contact<br>方法 or 属性:function updateContact(contact: Contact, callback: AsyncCallback\<void>): void;<br>权限:ohos.permission.WRITE_CONTACTS|@ohos.contact.d.ts| +|新增(权限)|类名:contact<br>方法 or 属性:function updateContact(contact: Contact, attrs: ContactAttributes, callback: AsyncCallback\<void>): void;<br>权限:N/A|类名:contact<br>方法 or 属性:function updateContact(contact: Contact, attrs: ContactAttributes, callback: AsyncCallback\<void>): void;<br>权限:ohos.permission.WRITE_CONTACTS|@ohos.contact.d.ts| +|新增(权限)|类名:contact<br>方法 or 属性:function updateContact(contact: Contact, attrs?: ContactAttributes): Promise\<void>;<br>权限:N/A|类名:contact<br>方法 or 属性:function updateContact(contact: Contact, attrs?: ContactAttributes): Promise\<void>;<br>权限:ohos.permission.WRITE_CONTACTS|@ohos.contact.d.ts| +|新增(权限)|类名:settings<br>方法 or 属性:function setValueSync(dataAbilityHelper: DataAbilityHelper, name: string, value: string): boolean;<br>权限:N/A|类名:settings<br>方法 or 属性:function setValueSync(dataAbilityHelper: DataAbilityHelper, name: string, value: string): boolean;<br>权限:ohos.permission.MANAGE_SECURE_SETTINGS|@ohos.settings.d.ts| +|SysCap有变化|类名:contact<br>方法 or 属性:function selectContact(callback: AsyncCallback\<Array\<Contact>>): void;<br>SysCap:SystemCapability.Applications.ContactsData|类名:contact<br>方法 or 属性:function selectContact(callback: AsyncCallback\<Array\<Contact>>): void;<br>SysCap:SystemCapability.Applications.Contacts|@ohos.contact.d.ts| +|SysCap有变化|类名:contact<br>方法 or 属性:function selectContact(): Promise\<Array\<Contact>>;<br>SysCap:SystemCapability.Applications.ContactsData|类名:contact<br>方法 or 属性:function selectContact(): Promise\<Array\<Contact>>;<br>SysCap:SystemCapability.Applications.Contacts|@ohos.contact.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-arkui.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-arkui.md new file mode 100644 index 0000000000000000000000000000000000000000..810b0fc4d72bbc2816961d70640476a7aee64ab3 --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-arkui.md @@ -0,0 +1,2213 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: canvaspattern<br>类名: CanvasPattern|canvaspattern.d.ts| +|新增|NA|模块名: canvaspattern<br>类名: CanvasPattern<br>方法 or 属性: setTransform(transform?: Matrix2D): void;|canvaspattern.d.ts| +|新增|NA|模块名: canvaspattern<br>类名: Matrix2D|canvaspattern.d.ts| +|新增|NA|模块名: canvaspattern<br>类名: Matrix2D<br>方法 or 属性: scaleX?: number;|canvaspattern.d.ts| +|新增|NA|模块名: canvaspattern<br>类名: Matrix2D<br>方法 or 属性: rotateY?: number;|canvaspattern.d.ts| +|新增|NA|模块名: canvaspattern<br>类名: Matrix2D<br>方法 or 属性: rotateX?: number;|canvaspattern.d.ts| +|新增|NA|模块名: canvaspattern<br>类名: Matrix2D<br>方法 or 属性: scaleY?: number;|canvaspattern.d.ts| +|新增|NA|模块名: canvaspattern<br>类名: Matrix2D<br>方法 or 属性: translateX?: number;|canvaspattern.d.ts| +|新增|NA|模块名: canvaspattern<br>类名: Matrix2D<br>方法 or 属性: translateY?: number;|canvaspattern.d.ts| +|新增|NA|模块名: canvaspattern<br>类名: Matrix2D<br>方法 or 属性: identity(): Matrix2D;|canvaspattern.d.ts| +|新增|NA|模块名: canvaspattern<br>类名: Matrix2D<br>方法 or 属性: invert(): Matrix2D;|canvaspattern.d.ts| +|新增|NA|模块名: canvaspattern<br>类名: Matrix2D<br>方法 or 属性: multiply(other?: Matrix2D): Matrix2D;|canvaspattern.d.ts| +|新增|NA|模块名: canvaspattern<br>类名: Matrix2D<br>方法 or 属性: rotate(rx?: number, ry?: number): Matrix2D;|canvaspattern.d.ts| +|新增|NA|模块名: canvaspattern<br>类名: Matrix2D<br>方法 or 属性: translate(tx?: number, ty?: number): Matrix2D;|canvaspattern.d.ts| +|新增|NA|模块名: canvaspattern<br>类名: Matrix2D<br>方法 or 属性: scale(sx?: number, sy?: number): Matrix2D;|canvaspattern.d.ts| +|新增|NA|模块名: canvaspattern<br>类名: Matrix2D<br>方法 or 属性: constructor();|canvaspattern.d.ts| +|新增|NA|类名:AnimatorResult<br>方法or属性:reset(options: AnimatorOptions): void;|@ohos.animator.d.ts| +|新增|NA|类名:Animator<br>方法or属性:static create(options: AnimatorOptions): AnimatorResult;|@ohos.animator.d.ts| +|新增|NA|模块名: ohos.curves<br>类名: ICurve|@ohos.curves.d.ts| +|新增|NA|类名:ICurve<br>方法or属性:|@ohos.curves.d.ts| +|新增|NA|模块名: ohos.curves<br>类名: ICurve<br>方法 or 属性:interpolate(fraction : number) : number;|@ohos.curves.d.ts| +|新增|NA|类名:ICurve<br>方法or属性:interpolate(fraction : number) : number;|@ohos.curves.d.ts| +|新增|NA|类名:curves<br>方法or属性:function initCurve(curve?: Curve): ICurve;|@ohos.curves.d.ts| +|新增|NA|类名:curves<br>方法or属性:function stepsCurve(count: number, end: boolean): ICurve;|@ohos.curves.d.ts| +|新增|NA|类名:curves<br>方法or属性:function cubicBezierCurve(x1: number, y1: number, x2: number, y2: number): ICurve;|@ohos.curves.d.ts| +|新增|NA|类名:curves<br>方法or属性:function springCurve(velocity: number, mass: number, stiffness: number, damping: number): ICurve;|@ohos.curves.d.ts| +|新增|NA|类名:curves<br>方法or属性:function springMotion(response?: number, dampingFraction?: number, overlapDuration?: number): ICurve;|@ohos.curves.d.ts| +|新增|NA|类名:curves<br>方法or属性:function responsiveSpringMotion(response?: number, dampingFraction?: number, overlapDuration?: number): ICurve;|@ohos.curves.d.ts| +|新增|NA|模块名: ohos.font<br>类名: font|@ohos.font.d.ts| +|新增|NA|模块名: ohos.font<br>类名: FontOptions|@ohos.font.d.ts| +|新增|NA|模块名: ohos.font<br>类名: FontOptions<br>方法 or 属性: familyName: string;|@ohos.font.d.ts| +|新增|NA|模块名: ohos.font<br>类名: FontOptions<br>方法 or 属性: familySrc: string;|@ohos.font.d.ts| +|新增|NA|模块名: ohos.font<br>类名: font<br>方法 or 属性: function registerFont(options: FontOptions):void;|@ohos.font.d.ts| +|新增|NA|模块名: ohos.measure<br>类名: MeasureOptions|@ohos.measure.d.ts| +|新增|NA|模块名: ohos.measure<br>类名: MeasureOptions<br>方法 or 属性: textContent: string;|@ohos.measure.d.ts| +|新增|NA|模块名: ohos.measure<br>类名: MeasureOptions<br>方法 or 属性: fontSize?: number \| string \| Resource;|@ohos.measure.d.ts| +|新增|NA|模块名: ohos.measure<br>类名: MeasureOptions<br>方法 or 属性: fontStyle?: number \| FontStyle;|@ohos.measure.d.ts| +|新增|NA|模块名: ohos.measure<br>类名: MeasureOptions<br>方法 or 属性: fontWeight?: number \| string \| FontWeight;|@ohos.measure.d.ts| +|新增|NA|模块名: ohos.measure<br>类名: MeasureOptions<br>方法 or 属性: fontFamily?: string \| Resource;|@ohos.measure.d.ts| +|新增|NA|模块名: ohos.measure<br>类名: MeasureOptions<br>方法 or 属性: letterSpacing?: number \| string;|@ohos.measure.d.ts| +|新增|NA|模块名: ohos.measure<br>类名: MeasureText|@ohos.measure.d.ts| +|新增|NA|模块名: ohos.measure<br>类名: MeasureText<br>方法 or 属性: static measureText(options: MeasureOptions): number;|@ohos.measure.d.ts| +|新增|NA|模块名: ohos.pluginComponent<br>类名: PushParameterForStage|@ohos.pluginComponent.d.ts| +|新增|NA|类名:PushParameterForStage<br>方法or属性:|@ohos.pluginComponent.d.ts| +|新增|NA|模块名: ohos.pluginComponent<br>类名: PushParameterForStage<br>方法 or 属性:owner: Want;|@ohos.pluginComponent.d.ts| +|新增|NA|类名:PushParameterForStage<br>方法or属性:owner: Want;|@ohos.pluginComponent.d.ts| +|新增|NA|模块名: ohos.pluginComponent<br>类名: PushParameterForStage<br>方法 or 属性:target: Want;|@ohos.pluginComponent.d.ts| +|新增|NA|类名:PushParameterForStage<br>方法or属性:target: Want;|@ohos.pluginComponent.d.ts| +|新增|NA|模块名: ohos.pluginComponent<br>类名: PushParameterForStage<br>方法 or 属性:name: string;|@ohos.pluginComponent.d.ts| +|新增|NA|类名:PushParameterForStage<br>方法or属性:name: string;|@ohos.pluginComponent.d.ts| +|新增|NA|模块名: ohos.pluginComponent<br>类名: PushParameterForStage<br>方法 or 属性:data: KVObject;|@ohos.pluginComponent.d.ts| +|新增|NA|类名:PushParameterForStage<br>方法or属性:data: KVObject;|@ohos.pluginComponent.d.ts| +|新增|NA|模块名: ohos.pluginComponent<br>类名: PushParameterForStage<br>方法 or 属性:extraData: KVObject;|@ohos.pluginComponent.d.ts| +|新增|NA|类名:PushParameterForStage<br>方法or属性:extraData: KVObject;|@ohos.pluginComponent.d.ts| +|新增|NA|模块名: ohos.pluginComponent<br>类名: PushParameterForStage<br>方法 or 属性:jsonPath?: string;|@ohos.pluginComponent.d.ts| +|新增|NA|类名:PushParameterForStage<br>方法or属性:jsonPath?: string;|@ohos.pluginComponent.d.ts| +|新增|NA|模块名: ohos.pluginComponent<br>类名: RequestParameterForStage|@ohos.pluginComponent.d.ts| +|新增|NA|类名:RequestParameterForStage<br>方法or属性:|@ohos.pluginComponent.d.ts| +|新增|NA|模块名: ohos.pluginComponent<br>类名: RequestParameterForStage<br>方法 or 属性:owner: Want;|@ohos.pluginComponent.d.ts| +|新增|NA|类名:RequestParameterForStage<br>方法or属性:owner: Want;|@ohos.pluginComponent.d.ts| +|新增|NA|模块名: ohos.pluginComponent<br>类名: RequestParameterForStage<br>方法 or 属性:target: Want;|@ohos.pluginComponent.d.ts| +|新增|NA|类名:RequestParameterForStage<br>方法or属性:target: Want;|@ohos.pluginComponent.d.ts| +|新增|NA|模块名: ohos.pluginComponent<br>类名: RequestParameterForStage<br>方法 or 属性:name: string;|@ohos.pluginComponent.d.ts| +|新增|NA|类名:RequestParameterForStage<br>方法or属性:name: string;|@ohos.pluginComponent.d.ts| +|新增|NA|模块名: ohos.pluginComponent<br>类名: RequestParameterForStage<br>方法 or 属性:data: KVObject;|@ohos.pluginComponent.d.ts| +|新增|NA|类名:RequestParameterForStage<br>方法or属性:data: KVObject;|@ohos.pluginComponent.d.ts| +|新增|NA|模块名: ohos.pluginComponent<br>类名: RequestParameterForStage<br>方法 or 属性:jsonPath?: string;|@ohos.pluginComponent.d.ts| +|新增|NA|类名:RequestParameterForStage<br>方法or属性:jsonPath?: string;|@ohos.pluginComponent.d.ts| +|新增|NA|类名:pluginComponentManager<br>方法or属性:function push(param: PushParameterForStage, callback: AsyncCallback\<void>): void;|@ohos.pluginComponent.d.ts| +|新增|NA|类名:pluginComponentManager<br>方法or属性:function request(param: RequestParameterForStage, callback: AsyncCallback\<RequestCallbackParameters>): void;|@ohos.pluginComponent.d.ts| +|新增|NA|模块名: ohos.promptAction<br>类名: promptAction|@ohos.promptAction.d.ts| +|新增|NA|模块名: ohos.promptAction<br>类名: ShowToastOptions|@ohos.promptAction.d.ts| +|新增|NA|模块名: ohos.promptAction<br>类名: ShowToastOptions<br>方法 or 属性: message: string \| Resource;|@ohos.promptAction.d.ts| +|新增|NA|模块名: ohos.promptAction<br>类名: ShowToastOptions<br>方法 or 属性: duration?: number;|@ohos.promptAction.d.ts| +|新增|NA|模块名: ohos.promptAction<br>类名: ShowToastOptions<br>方法 or 属性: bottom?: string \| number;|@ohos.promptAction.d.ts| +|新增|NA|模块名: ohos.promptAction<br>类名: Button|@ohos.promptAction.d.ts| +|新增|NA|模块名: ohos.promptAction<br>类名: Button<br>方法 or 属性: text: string \| Resource;|@ohos.promptAction.d.ts| +|新增|NA|模块名: ohos.promptAction<br>类名: Button<br>方法 or 属性: color: string \| Resource;|@ohos.promptAction.d.ts| +|新增|NA|模块名: ohos.promptAction<br>类名: ShowDialogSuccessResponse|@ohos.promptAction.d.ts| +|新增|NA|模块名: ohos.promptAction<br>类名: ShowDialogSuccessResponse<br>方法 or 属性: index: number;|@ohos.promptAction.d.ts| +|新增|NA|模块名: ohos.promptAction<br>类名: ShowDialogOptions|@ohos.promptAction.d.ts| +|新增|NA|模块名: ohos.promptAction<br>类名: ShowDialogOptions<br>方法 or 属性: title?: string \| Resource;|@ohos.promptAction.d.ts| +|新增|NA|模块名: ohos.promptAction<br>类名: ShowDialogOptions<br>方法 or 属性: message?: string \| Resource;|@ohos.promptAction.d.ts| +|新增|NA|模块名: ohos.promptAction<br>类名: ShowDialogOptions<br>方法 or 属性: buttons?: [Button, Button?, Button?];|@ohos.promptAction.d.ts| +|新增|NA|模块名: ohos.promptAction<br>类名: ActionMenuSuccessResponse|@ohos.promptAction.d.ts| +|新增|NA|模块名: ohos.promptAction<br>类名: ActionMenuSuccessResponse<br>方法 or 属性: index: number;|@ohos.promptAction.d.ts| +|新增|NA|模块名: ohos.promptAction<br>类名: ActionMenuOptions|@ohos.promptAction.d.ts| +|新增|NA|模块名: ohos.promptAction<br>类名: ActionMenuOptions<br>方法 or 属性: title?: string \| Resource;|@ohos.promptAction.d.ts| +|新增|NA|模块名: ohos.promptAction<br>类名: ActionMenuOptions<br>方法 or 属性: buttons: [Button, Button?, Button?, Button?, Button?, Button?];|@ohos.promptAction.d.ts| +|新增|NA|模块名: ohos.promptAction<br>类名: promptAction<br>方法 or 属性: function showToast(options: ShowToastOptions):void;|@ohos.promptAction.d.ts| +|新增|NA|模块名: ohos.promptAction<br>类名: promptAction<br>方法 or 属性: function showDialog(options: ShowDialogOptions, callback: AsyncCallback\<ShowDialogSuccessResponse>):void;|@ohos.promptAction.d.ts| +|新增|NA|模块名: ohos.promptAction<br>类名: promptAction<br>方法 or 属性: function showDialog(options: ShowDialogOptions): Promise\<ShowDialogSuccessResponse>;|@ohos.promptAction.d.ts| +|新增|NA|模块名: ohos.promptAction<br>类名: promptAction<br>方法 or 属性: function showActionMenu(options: ActionMenuOptions, callback: AsyncCallback\<ActionMenuSuccessResponse>):void;|@ohos.promptAction.d.ts| +|新增|NA|模块名: ohos.promptAction<br>类名: promptAction<br>方法 or 属性: function showActionMenu(options: ActionMenuOptions): Promise\<ActionMenuSuccessResponse>;|@ohos.promptAction.d.ts| +|新增|NA|模块名: ohos.router<br>类名: RouterMode|@ohos.router.d.ts| +|新增|NA|类名:RouterMode<br>方法or属性:|@ohos.router.d.ts| +|新增|NA|模块名: ohos.router<br>类名: RouterMode<br>方法 or 属性:Standard|@ohos.router.d.ts| +|新增|NA|类名:RouterMode<br>方法or属性:Standard|@ohos.router.d.ts| +|新增|NA|模块名: ohos.router<br>类名: RouterMode<br>方法 or 属性:Single|@ohos.router.d.ts| +|新增|NA|类名:RouterMode<br>方法or属性:Single|@ohos.router.d.ts| +|新增|NA|类名:router<br>方法or属性:function pushUrl(options: RouterOptions, callback: AsyncCallback\<void>):void;|@ohos.router.d.ts| +|新增|NA|类名:router<br>方法or属性:function pushUrl(options: RouterOptions): Promise\<void>;|@ohos.router.d.ts| +|新增|NA|类名:router<br>方法or属性:function pushUrl(options: RouterOptions, mode: RouterMode, callback: AsyncCallback\<void>):void;|@ohos.router.d.ts| +|新增|NA|类名:router<br>方法or属性:function pushUrl(options: RouterOptions, mode: RouterMode): Promise\<void>;|@ohos.router.d.ts| +|新增|NA|类名:router<br>方法or属性:function replaceUrl(options: RouterOptions, callback: AsyncCallback\<void>):void;|@ohos.router.d.ts| +|新增|NA|类名:router<br>方法or属性:function replaceUrl(options: RouterOptions): Promise\<void>;|@ohos.router.d.ts| +|新增|NA|类名:router<br>方法or属性:function replaceUrl(options: RouterOptions, mode: RouterMode, callback: AsyncCallback\<void>):void;|@ohos.router.d.ts| +|新增|NA|类名:router<br>方法or属性:function replaceUrl(options: RouterOptions, mode: RouterMode): Promise\<void>;|@ohos.router.d.ts| +|新增|NA|类名:router<br>方法or属性:function showAlertBeforeBackPage(options: EnableAlertOptions):void;|@ohos.router.d.ts| +|新增|NA|类名:router<br>方法or属性:function hideAlertBeforeBackPage():void;|@ohos.router.d.ts| +|新增|NA|模块名: ability_component<br>类名: AbilityComponentInterface|ability_component.d.ts| +|新增|NA|模块名: ability_component<br>类名: AbilityComponentInterface<br>方法 or 属性: (value: {want: import('../api/@ohos.app.ability.Want').default}): AbilityComponentAttribute;|ability_component.d.ts| +|新增|NA|模块名: ability_component<br>类名: AbilityComponentAttribute|ability_component.d.ts| +|新增|NA|模块名: ability_component<br>类名: AbilityComponentAttribute<br>方法 or 属性: onConnect(callback: () => void): AbilityComponentAttribute;|ability_component.d.ts| +|新增|NA|模块名: ability_component<br>类名: AbilityComponentAttribute<br>方法 or 属性: onDisconnect(callback: () => void): AbilityComponentAttribute;|ability_component.d.ts| +|新增|NA|模块名: ability_component<br>类名: global<br>方法 or 属性: declare const AbilityComponent: AbilityComponentInterface;|ability_component.d.ts| +|新增|NA|模块名: ability_component<br>类名: global<br>方法 or 属性: declare const AbilityComponentInstance: AbilityComponentAttribute;|ability_component.d.ts| +|新增|NA|类名:CanvasRenderer<br>方法or属性:filter: string;|canvas.d.ts| +|新增|NA|类名:CanvasRenderer<br>方法or属性:imageSmoothingQuality: ImageSmoothingQuality;|canvas.d.ts| +|新增|NA|类名:CanvasRenderer<br>方法or属性:direction: CanvasDirection;|canvas.d.ts| +|新增|NA|类名:global<br>方法or属性:declare const Entry: ClassDecorator & ((storage?: LocalStorage) => ClassDecorator);|common.d.ts| +|新增|NA|类名:global<br>方法or属性:declare const Concurrent: MethodDecorator;|common.d.ts| +|新增|NA|类名:global<br>方法or属性:declare const LocalStorageLink: (value: string) => PropertyDecorator;|common.d.ts| +|新增|NA|类名:global<br>方法or属性:declare const LocalStorageProp: (value: string) => PropertyDecorator;|common.d.ts| +|新增|NA|类名:<br>方法or属性:function getContext(component?: Object): Context;|common.d.ts| +|新增|NA|类名:<br>方法or属性:function postCardAction(component: Object, action: Object): void;|common.d.ts| +|新增|NA|类名:AnimateParam<br>方法or属性:curve?: Curve \| string \| ICurve;|common.d.ts| +|新增|NA|模块名: common<br>类名: ICurve|common.d.ts| +|新增|NA|类名:ICurve<br>方法or属性:|common.d.ts| +|新增|NA|模块名: common<br>类名: ICurve<br>方法 or 属性:interpolate(fraction : number) : number;|common.d.ts| +|新增|NA|类名:ICurve<br>方法or属性:interpolate(fraction : number) : number;|common.d.ts| +|新增|NA|模块名: common<br>类名: AlignRuleOption|common.d.ts| +|新增|NA|类名:AlignRuleOption<br>方法or属性:|common.d.ts| +|新增|NA|模块名: common<br>类名: AlignRuleOption<br>方法 or 属性:left?: { anchor: string, align: HorizontalAlign };|common.d.ts| +|新增|NA|类名:AlignRuleOption<br>方法or属性:left?: { anchor: string, align: HorizontalAlign };|common.d.ts| +|新增|NA|模块名: common<br>类名: AlignRuleOption<br>方法 or 属性:right?: { anchor: string, align: HorizontalAlign };|common.d.ts| +|新增|NA|类名:AlignRuleOption<br>方法or属性:right?: { anchor: string, align: HorizontalAlign };|common.d.ts| +|新增|NA|模块名: common<br>类名: AlignRuleOption<br>方法 or 属性:middle?: { anchor: string, align: HorizontalAlign };|common.d.ts| +|新增|NA|类名:AlignRuleOption<br>方法or属性:middle?: { anchor: string, align: HorizontalAlign };|common.d.ts| +|新增|NA|模块名: common<br>类名: AlignRuleOption<br>方法 or 属性:top?: { anchor: string, align: VerticalAlign };|common.d.ts| +|新增|NA|类名:AlignRuleOption<br>方法or属性:top?: { anchor: string, align: VerticalAlign };|common.d.ts| +|新增|NA|模块名: common<br>类名: AlignRuleOption<br>方法 or 属性:bottom?: { anchor: string, align: VerticalAlign };|common.d.ts| +|新增|NA|类名:AlignRuleOption<br>方法or属性:bottom?: { anchor: string, align: VerticalAlign };|common.d.ts| +|新增|NA|模块名: common<br>类名: AlignRuleOption<br>方法 or 属性:center?: { anchor: string, align: VerticalAlign };|common.d.ts| +|新增|NA|类名:AlignRuleOption<br>方法or属性:center?: { anchor: string, align: VerticalAlign };|common.d.ts| +|新增|NA|模块名: common<br>类名: focusControl|common.d.ts| +|新增|NA|类名:focusControl<br>方法or属性:|common.d.ts| +|新增|NA|模块名: common<br>类名: focusControl<br>方法 or 属性:function requestFocus(value: string): boolean;|common.d.ts| +|新增|NA|类名:focusControl<br>方法or属性:function requestFocus(value: string): boolean;|common.d.ts| +|新增|NA|模块名: common<br>类名: SourceTool|common.d.ts| +|新增|NA|类名:SourceTool<br>方法or属性:|common.d.ts| +|新增|NA|模块名: common<br>类名: SourceTool<br>方法 or 属性:Unknown|common.d.ts| +|新增|NA|类名:SourceTool<br>方法or属性:Unknown|common.d.ts| +|新增|NA|模块名: common<br>类名: SourceTool<br>方法 or 属性:FINGER|common.d.ts| +|新增|NA|类名:SourceTool<br>方法or属性:FINGER|common.d.ts| +|新增|NA|模块名: common<br>类名: SourceTool<br>方法 or 属性:PEN|common.d.ts| +|新增|NA|类名:SourceTool<br>方法or属性:PEN|common.d.ts| +|新增|NA|模块名: common<br>类名: RepeatMode|common.d.ts| +|新增|NA|类名:RepeatMode<br>方法or属性:|common.d.ts| +|新增|NA|模块名: common<br>类名: RepeatMode<br>方法 or 属性:Repeat|common.d.ts| +|新增|NA|类名:RepeatMode<br>方法or属性:Repeat|common.d.ts| +|新增|NA|模块名: common<br>类名: RepeatMode<br>方法 or 属性:Stretch|common.d.ts| +|新增|NA|类名:RepeatMode<br>方法or属性:Stretch|common.d.ts| +|新增|NA|模块名: common<br>类名: RepeatMode<br>方法 or 属性:Round|common.d.ts| +|新增|NA|类名:RepeatMode<br>方法or属性:Round|common.d.ts| +|新增|NA|模块名: common<br>类名: RepeatMode<br>方法 or 属性:Space|common.d.ts| +|新增|NA|类名:RepeatMode<br>方法or属性:Space|common.d.ts| +|新增|NA|模块名: common<br>类名: BlurStyle|common.d.ts| +|新增|NA|类名:BlurStyle<br>方法or属性:|common.d.ts| +|新增|NA|模块名: common<br>类名: BlurStyle<br>方法 or 属性:Thin|common.d.ts| +|新增|NA|类名:BlurStyle<br>方法or属性:Thin|common.d.ts| +|新增|NA|模块名: common<br>类名: BlurStyle<br>方法 or 属性:Regular|common.d.ts| +|新增|NA|类名:BlurStyle<br>方法or属性:Regular|common.d.ts| +|新增|NA|模块名: common<br>类名: BlurStyle<br>方法 or 属性:Thick|common.d.ts| +|新增|NA|类名:BlurStyle<br>方法or属性:Thick|common.d.ts| +|新增|NA|类名:BaseEvent<br>方法or属性:pressure: number;|common.d.ts| +|新增|NA|类名:BaseEvent<br>方法or属性:tiltX: number;|common.d.ts| +|新增|NA|类名:BaseEvent<br>方法or属性:tiltY: number;|common.d.ts| +|新增|NA|类名:BaseEvent<br>方法or属性:sourceTool: SourceTool;|common.d.ts| +|新增|NA|模块名: common<br>类名: BorderImageOption|common.d.ts| +|新增|NA|类名:BorderImageOption<br>方法or属性:|common.d.ts| +|新增|NA|模块名: common<br>类名: BorderImageOption<br>方法 or 属性:slice?: Length \| EdgeWidths,|common.d.ts| +|新增|NA|类名:BorderImageOption<br>方法or属性:slice?: Length \| EdgeWidths,|common.d.ts| +|新增|NA|模块名: common<br>类名: BorderImageOption<br>方法 or 属性:repeat?: RepeatMode,|common.d.ts| +|新增|NA|类名:BorderImageOption<br>方法or属性:repeat?: RepeatMode,|common.d.ts| +|新增|NA|模块名: common<br>类名: BorderImageOption<br>方法 or 属性:source?: string \| Resource \| LinearGradient,|common.d.ts| +|新增|NA|类名:BorderImageOption<br>方法or属性:source?: string \| Resource \| LinearGradient,|common.d.ts| +|新增|NA|模块名: common<br>类名: BorderImageOption<br>方法 or 属性:width?: Length \| EdgeWidths,|common.d.ts| +|新增|NA|类名:BorderImageOption<br>方法or属性:width?: Length \| EdgeWidths,|common.d.ts| +|新增|NA|模块名: common<br>类名: BorderImageOption<br>方法 or 属性:outset?: Length \| EdgeWidths,|common.d.ts| +|新增|NA|类名:BorderImageOption<br>方法or属性:outset?: Length \| EdgeWidths,|common.d.ts| +|新增|NA|模块名: common<br>类名: BorderImageOption<br>方法 or 属性:fill?: boolean|common.d.ts| +|新增|NA|类名:BorderImageOption<br>方法or属性:fill?: boolean|common.d.ts| +|新增|NA|模块名: common<br>类名: PopupOptions<br>方法 or 属性:arrowOffset?: Length;|common.d.ts| +|新增|NA|类名:PopupOptions<br>方法or属性:arrowOffset?: Length;|common.d.ts| +|新增|NA|模块名: common<br>类名: PopupOptions<br>方法 or 属性:showInSubWindow?: boolean;|common.d.ts| +|新增|NA|类名:PopupOptions<br>方法or属性:showInSubWindow?: boolean;|common.d.ts| +|新增|NA|模块名: common<br>类名: CustomPopupOptions<br>方法 or 属性:arrowOffset?: Length;|common.d.ts| +|新增|NA|类名:CustomPopupOptions<br>方法or属性:arrowOffset?: Length;|common.d.ts| +|新增|NA|模块名: common<br>类名: CustomPopupOptions<br>方法 or 属性:showInSubWindow?: boolean;|common.d.ts| +|新增|NA|类名:CustomPopupOptions<br>方法or属性:showInSubWindow?: boolean;|common.d.ts| +|新增|NA|类名:CommonMethod<br>方法or属性:hitTestBehavior(value: HitTestMode): T;|common.d.ts| +|新增|NA|类名:CommonMethod<br>方法or属性:backgroundBlurStyle(value: BlurStyle): T;|common.d.ts| +|新增|NA|类名:CommonMethod<br>方法or属性:borderStyle(value: EdgeStyles): T;|common.d.ts| +|新增|NA|类名:CommonMethod<br>方法or属性:borderWidth(value: EdgeWidths): T;|common.d.ts| +|新增|NA|类名:CommonMethod<br>方法or属性:borderColor(value: EdgeColors): T;|common.d.ts| +|新增|NA|类名:CommonMethod<br>方法or属性:borderRadius(value: BorderRadiuses): T;|common.d.ts| +|新增|NA|类名:CommonMethod<br>方法or属性:borderImage(value: BorderImageOption): T;|common.d.ts| +|新增|NA|类名:CommonMethod<br>方法or属性:tabIndex(index: number): T;|common.d.ts| +|新增|NA|类名:CommonMethod<br>方法or属性:defaultFocus(value: boolean): T;|common.d.ts| +|新增|NA|类名:CommonMethod<br>方法or属性:groupDefaultFocus(value: boolean): T;|common.d.ts| +|新增|NA|类名:CommonMethod<br>方法or属性:focusOnTouch(value: boolean): T;|common.d.ts| +|新增|NA|类名:CommonMethod<br>方法or属性:alignRules(value: AlignRuleOption): T;|common.d.ts| +|新增|NA|类名:CommonMethod<br>方法or属性:onVisibleAreaChange(ratios: Array\<number>, event: (isVisible: boolean, currentRatio: number) => void): T;|common.d.ts| +|新增|NA|模块名: common<br>类名: LinearGradient|common.d.ts| +|新增|NA|类名:LinearGradient<br>方法or属性:|common.d.ts| +|新增|NA|模块名: common<br>类名: LinearGradient<br>方法 or 属性:angle?: number \| string;|common.d.ts| +|新增|NA|类名:LinearGradient<br>方法or属性:angle?: number \| string;|common.d.ts| +|新增|NA|模块名: common<br>类名: LinearGradient<br>方法 or 属性:direction?: GradientDirection;|common.d.ts| +|新增|NA|类名:LinearGradient<br>方法or属性:direction?: GradientDirection;|common.d.ts| +|新增|NA|模块名: common<br>类名: LinearGradient<br>方法 or 属性:colors: Array\<any>;|common.d.ts| +|新增|NA|类名:LinearGradient<br>方法or属性:colors: Array\<any>;|common.d.ts| +|新增|NA|模块名: common<br>类名: LinearGradient<br>方法 or 属性:repeating?: boolean;|common.d.ts| +|新增|NA|类名:LinearGradient<br>方法or属性:repeating?: boolean;|common.d.ts| +|新增|NA|模块名: common<br>类名: LayoutBorderInfo|common.d.ts| +|新增|NA|类名:LayoutBorderInfo<br>方法or属性:|common.d.ts| +|新增|NA|模块名: common<br>类名: LayoutBorderInfo<br>方法 or 属性:borderWidth: EdgeWidths,|common.d.ts| +|新增|NA|类名:LayoutBorderInfo<br>方法or属性:borderWidth: EdgeWidths,|common.d.ts| +|新增|NA|模块名: common<br>类名: LayoutBorderInfo<br>方法 or 属性:margin: Margin,|common.d.ts| +|新增|NA|类名:LayoutBorderInfo<br>方法or属性:margin: Margin,|common.d.ts| +|新增|NA|模块名: common<br>类名: LayoutBorderInfo<br>方法 or 属性:padding: Padding,|common.d.ts| +|新增|NA|类名:LayoutBorderInfo<br>方法or属性:padding: Padding,|common.d.ts| +|新增|NA|模块名: common<br>类名: LayoutInfo|common.d.ts| +|新增|NA|类名:LayoutInfo<br>方法or属性:|common.d.ts| +|新增|NA|模块名: common<br>类名: LayoutInfo<br>方法 or 属性:position: Position,|common.d.ts| +|新增|NA|类名:LayoutInfo<br>方法or属性:position: Position,|common.d.ts| +|新增|NA|模块名: common<br>类名: LayoutInfo<br>方法 or 属性:constraint: ConstraintSizeOptions,|common.d.ts| +|新增|NA|类名:LayoutInfo<br>方法or属性:constraint: ConstraintSizeOptions,|common.d.ts| +|新增|NA|模块名: common<br>类名: LayoutChild|common.d.ts| +|新增|NA|类名:LayoutChild<br>方法or属性:|common.d.ts| +|新增|NA|模块名: common<br>类名: LayoutChild<br>方法 or 属性:name: string,|common.d.ts| +|新增|NA|类名:LayoutChild<br>方法or属性:name: string,|common.d.ts| +|新增|NA|模块名: common<br>类名: LayoutChild<br>方法 or 属性:id: string,|common.d.ts| +|新增|NA|类名:LayoutChild<br>方法or属性:id: string,|common.d.ts| +|新增|NA|模块名: common<br>类名: LayoutChild<br>方法 or 属性:constraint: ConstraintSizeOptions,|common.d.ts| +|新增|NA|类名:LayoutChild<br>方法or属性:constraint: ConstraintSizeOptions,|common.d.ts| +|新增|NA|模块名: common<br>类名: LayoutChild<br>方法 or 属性:borderInfo: LayoutBorderInfo,|common.d.ts| +|新增|NA|类名:LayoutChild<br>方法or属性:borderInfo: LayoutBorderInfo,|common.d.ts| +|新增|NA|模块名: common<br>类名: LayoutChild<br>方法 or 属性:position: Position,|common.d.ts| +|新增|NA|类名:LayoutChild<br>方法or属性:position: Position,|common.d.ts| +|新增|NA|模块名: common<br>类名: LayoutChild<br>方法 or 属性:measure(childConstraint: ConstraintSizeOptions),|common.d.ts| +|新增|NA|类名:LayoutChild<br>方法or属性:measure(childConstraint: ConstraintSizeOptions),|common.d.ts| +|新增|NA|模块名: common<br>类名: LayoutChild<br>方法 or 属性:layout(childLayoutInfo: LayoutInfo)|common.d.ts| +|新增|NA|类名:LayoutChild<br>方法or属性:layout(childLayoutInfo: LayoutInfo)|common.d.ts| +|新增|NA|类名:CustomComponent<br>方法or属性:onLayout?(children: Array\<LayoutChild>, constraint: ConstraintSizeOptions): void;|common.d.ts| +|新增|NA|类名:CustomComponent<br>方法or属性:onMeasure?(children: Array\<LayoutChild>, constraint: ConstraintSizeOptions): void;|common.d.ts| +|新增|NA|类名:CustomComponent<br>方法or属性:pageTransition?(): void;|common.d.ts| +|新增|NA|模块名: common<br>类名: SpecialEvent|common.d.ts| +|新增|NA|类名:SpecialEvent<br>方法or属性:|common.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: AppStorage|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: AppStorage<br>方法 or 属性: static Link(propName: string): any;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: AppStorage<br>方法 or 属性: static SetAndLink\<T>(propName: string, defaultValue: T): SubscribedAbstractProperty\<T>;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: AppStorage<br>方法 or 属性: static Prop(propName: string): any;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: AppStorage<br>方法 or 属性: static SetAndProp\<S>(propName: string, defaultValue: S): SubscribedAbstractProperty\<S>;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: AppStorage<br>方法 or 属性: static Has(propName: string): boolean;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: AppStorage<br>方法 or 属性: static Get\<T>(propName: string): T \| undefined;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: AppStorage<br>方法 or 属性: static Set\<T>(propName: string, newValue: T): boolean;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: AppStorage<br>方法 or 属性: static SetOrCreate\<T>(propName: string, newValue: T): void;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: AppStorage<br>方法 or 属性: static Delete(propName: string): boolean;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: AppStorage<br>方法 or 属性: static Keys(): IterableIterator\<string>;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: AppStorage<br>方法 or 属性: static staticClear(): boolean;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: AppStorage<br>方法 or 属性: static Clear(): boolean;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: AppStorage<br>方法 or 属性: static IsMutable(propName: string): boolean;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: AppStorage<br>方法 or 属性: static Size(): number;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SubscribedAbstractProperty|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SubscribedAbstractProperty<br>方法 or 属性: protected subscribers_: Set\<number>;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SubscribedAbstractProperty<br>方法 or 属性: private id_;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SubscribedAbstractProperty<br>方法 or 属性: private info_?;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SubscribedAbstractProperty<br>方法 or 属性: constructor(<br> /**<br> * Subscriber IPropertySubscriber.<br> * @since 7<br> * @systemapi<br> */<br> subscribeMe?: IPropertySubscriber,<br> /**<br> * Subscriber info.<br> * @since 7<br> * @systemapi<br> */<br> info?: string,<br> );|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SubscribedAbstractProperty<br>方法 or 属性: id(): number;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SubscribedAbstractProperty<br>方法 or 属性: info(): string;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SubscribedAbstractProperty<br>方法 or 属性: abstract get(): T;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SubscribedAbstractProperty<br>方法 or 属性: abstract set(newValue: T): void;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SubscribedAbstractProperty<br>方法 or 属性: createTwoWaySync(subscribeMe?: IPropertySubscriber, info?: string): SyncedPropertyTwoWay\<T>;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SubscribedAbstractProperty<br>方法 or 属性: createOneWaySync(subscribeMe?: IPropertySubscriber, info?: string): SyncedPropertyOneWay\<T>;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SubscribedAbstractProperty<br>方法 or 属性: unlinkSuscriber(subscriberId: number): void;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SubscribedAbstractProperty<br>方法 or 属性: protected notifyHasChanged(newValue: T): void;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SubscribedAbstractProperty<br>方法 or 属性: protected notifyPropertyRead(): void;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SubscribedAbstractProperty<br>方法 or 属性: numberOfSubscrbers(): number;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: IPropertySubscriber|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: IPropertySubscriber<br>方法 or 属性: id(): number;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: IPropertySubscriber<br>方法 or 属性: aboutToBeDeleted(owningView?: IPropertySubscriber): void;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SyncedPropertyTwoWay|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SyncedPropertyTwoWay<br>方法 or 属性: private source_;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SyncedPropertyTwoWay<br>方法 or 属性: constructor(source: SubscribedAbstractProperty\<T>, subscribeMe?: IPropertySubscriber, info?: string);|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SyncedPropertyTwoWay<br>方法 or 属性: aboutToBeDeleted(unsubscribeMe?: IPropertySubscriber): void;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SyncedPropertyTwoWay<br>方法 or 属性: hasChanged(newValue: T): void;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SyncedPropertyTwoWay<br>方法 or 属性: get(): T;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SyncedPropertyTwoWay<br>方法 or 属性: set(newValue: T): void;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SyncedPropertyOneWay|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SyncedPropertyOneWay<br>方法 or 属性: private wrappedValue_;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SyncedPropertyOneWay<br>方法 or 属性: private source_;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SyncedPropertyOneWay<br>方法 or 属性: constructor(source: SubscribedAbstractProperty\<T>, subscribeMe?: IPropertySubscriber, info?: string);|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SyncedPropertyOneWay<br>方法 or 属性: aboutToBeDeleted(unsubscribeMe?: IPropertySubscriber): void;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SyncedPropertyOneWay<br>方法 or 属性: hasChanged(newValue: T): void;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SyncedPropertyOneWay<br>方法 or 属性: get(): T;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SyncedPropertyOneWay<br>方法 or 属性: set(newValue: T): void;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: ISinglePropertyChangeSubscriber|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: ISinglePropertyChangeSubscriber<br>方法 or 属性: hasChanged(newValue: T): void;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SubscribaleAbstract|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SubscribaleAbstract<br>方法 or 属性: private owningProperties_: Set\<number>;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SubscribaleAbstract<br>方法 or 属性: constructor();|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SubscribaleAbstract<br>方法 or 属性: protected notifyPropertyHasChanged(propName: string, newValue: any): void;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SubscribaleAbstract<br>方法 or 属性: public addOwningProperty(subscriber: IPropertySubscriber): void;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SubscribaleAbstract<br>方法 or 属性: public removeOwningProperty(property: IPropertySubscriber): void;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: SubscribaleAbstract<br>方法 or 属性: public removeOwningPropertyById(subscriberId: number): void;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: Environment|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: Environment<br>方法 or 属性: constructor();|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: Environment<br>方法 or 属性: static EnvProp\<S>(key: string, value: S): boolean;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: Environment<br>方法 or 属性: static EnvProps(<br> props: {<br> key: string;<br> defaultValue: any;<br> }[],<br> ): void;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: Environment<br>方法 or 属性: static Keys(): Array\<string>;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: PersistentStorage|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: PersistentStorage<br>方法 or 属性: constructor(appStorage: AppStorage, storage: Storage);|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: PersistentStorage<br>方法 or 属性: static PersistProp\<T>(key: string, defaultValue: T): void;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: PersistentStorage<br>方法 or 属性: static DeleteProp(key: string): void;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: PersistentStorage<br>方法 or 属性: static PersistProps(<br> properties: {<br> key: string;<br> defaultValue: any;<br> }[],<br> ): void;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: PersistentStorage<br>方法 or 属性: static Keys(): Array\<string>;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: global<br>方法 or 属性: declare const appStorage: AppStorage;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: LocalStorage|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: LocalStorage<br>方法 or 属性: constructor(initializingProperties?: Object);|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: LocalStorage<br>方法 or 属性: static GetShared(): LocalStorage;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: LocalStorage<br>方法 or 属性: has(propName: string): boolean;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: LocalStorage<br>方法 or 属性: keys(): IterableIterator\<string>;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: LocalStorage<br>方法 or 属性: size(): number;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: LocalStorage<br>方法 or 属性: get\<T>(propName: string): T \| undefined;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: LocalStorage<br>方法 or 属性: set\<T>(propName: string, newValue: T): boolean;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: LocalStorage<br>方法 or 属性: setOrCreate\<T>(propName: string, newValue: T): boolean;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: LocalStorage<br>方法 or 属性: link\<T>(propName: string): SubscribedAbstractProperty\<T>;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: LocalStorage<br>方法 or 属性: setAndLink\<T>(propName: string, defaultValue: T): SubscribedAbstractProperty\<T>;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: LocalStorage<br>方法 or 属性: prop\<S>(propName: string): SubscribedAbstractProperty\<S>;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: LocalStorage<br>方法 or 属性: setAndProp\<S>(propName: string, defaultValue: S): SubscribedAbstractProperty\<S>;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: LocalStorage<br>方法 or 属性: delete(propName: string): boolean;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: LocalStorage<br>方法 or 属性: clear(): boolean;|common_ts_ets_api.d.ts| +|新增|NA|模块名: common_ts_ets_api<br>类名: StateManagement|common_ts_ets_api.d.ts| +|新增|NA|类名:Color<br>方法or属性:Transparent|enums.d.ts| +|新增|NA|类名:Placement<br>方法or属性:LeftTop|enums.d.ts| +|新增|NA|类名:Placement<br>方法or属性:LeftBottom|enums.d.ts| +|新增|NA|类名:Placement<br>方法or属性:RightTop|enums.d.ts| +|新增|NA|类名:Placement<br>方法or属性:RightBottom|enums.d.ts| +|新增|NA|模块名: enums<br>类名: CopyOptions|enums.d.ts| +|新增|NA|类名:CopyOptions<br>方法or属性:|enums.d.ts| +|新增|NA|模块名: enums<br>类名: CopyOptions<br>方法 or 属性:None = 0|enums.d.ts| +|新增|NA|类名:CopyOptions<br>方法or属性:None = 0|enums.d.ts| +|新增|NA|模块名: enums<br>类名: CopyOptions<br>方法 or 属性:InApp = 1|enums.d.ts| +|新增|NA|类名:CopyOptions<br>方法or属性:InApp = 1|enums.d.ts| +|新增|NA|模块名: enums<br>类名: CopyOptions<br>方法 or 属性:LocalDevice = 2|enums.d.ts| +|新增|NA|类名:CopyOptions<br>方法or属性:LocalDevice = 2|enums.d.ts| +|新增|NA|模块名: enums<br>类名: HitTestMode|enums.d.ts| +|新增|NA|类名:HitTestMode<br>方法or属性:|enums.d.ts| +|新增|NA|模块名: enums<br>类名: HitTestMode<br>方法 or 属性:Default|enums.d.ts| +|新增|NA|类名:HitTestMode<br>方法or属性:Default|enums.d.ts| +|新增|NA|模块名: enums<br>类名: HitTestMode<br>方法 or 属性:Block|enums.d.ts| +|新增|NA|类名:HitTestMode<br>方法or属性:Block|enums.d.ts| +|新增|NA|模块名: enums<br>类名: HitTestMode<br>方法 or 属性:Transparent|enums.d.ts| +|新增|NA|类名:HitTestMode<br>方法or属性:Transparent|enums.d.ts| +|新增|NA|模块名: enums<br>类名: HitTestMode<br>方法 or 属性:None|enums.d.ts| +|新增|NA|类名:HitTestMode<br>方法or属性:None|enums.d.ts| +|新增|NA|模块名: enums<br>类名: TitleHeight|enums.d.ts| +|新增|NA|类名:TitleHeight<br>方法or属性:|enums.d.ts| +|新增|NA|模块名: enums<br>类名: TitleHeight<br>方法 or 属性:MainOnly|enums.d.ts| +|新增|NA|类名:TitleHeight<br>方法or属性:MainOnly|enums.d.ts| +|新增|NA|模块名: enums<br>类名: TitleHeight<br>方法 or 属性:MainWithSub|enums.d.ts| +|新增|NA|类名:TitleHeight<br>方法or属性:MainWithSub|enums.d.ts| +|新增|NA|模块名: flow_item<br>类名: FlowItemInterface|flow_item.d.ts| +|新增|NA|模块名: flow_item<br>类名: FlowItemInterface<br>方法 or 属性: (): FlowItemAttribute;|flow_item.d.ts| +|新增|NA|模块名: flow_item<br>类名: FlowItemAttribute|flow_item.d.ts| +|新增|NA|模块名: flow_item<br>类名: global<br>方法 or 属性: declare const FlowItem: FlowItemInterface|flow_item.d.ts| +|新增|NA|模块名: flow_item<br>类名: global<br>方法 or 属性: declare const FlowItemInstance: FlowItemAttribute;|flow_item.d.ts| +|新增|NA|模块名: form_component<br>类名: FormDimension<br>方法 or 属性:Dimension_2_1|form_component.d.ts| +|新增|NA|类名:FormDimension<br>方法or属性:Dimension_2_1|form_component.d.ts| +|新增|NA|模块名: grid_col<br>类名: GridColColumnOption|grid_col.d.ts| +|新增|NA|模块名: grid_col<br>类名: GridColColumnOption<br>方法 or 属性: xs?: number,|grid_col.d.ts| +|新增|NA|模块名: grid_col<br>类名: GridColColumnOption<br>方法 or 属性: sm?: number,|grid_col.d.ts| +|新增|NA|模块名: grid_col<br>类名: GridColColumnOption<br>方法 or 属性: md?: number,|grid_col.d.ts| +|新增|NA|模块名: grid_col<br>类名: GridColColumnOption<br>方法 or 属性: lg?: number,|grid_col.d.ts| +|新增|NA|模块名: grid_col<br>类名: GridColColumnOption<br>方法 or 属性: xl?: number,|grid_col.d.ts| +|新增|NA|模块名: grid_col<br>类名: GridColColumnOption<br>方法 or 属性: xxl?: number,|grid_col.d.ts| +|新增|NA|模块名: grid_col<br>类名: GridColOptions|grid_col.d.ts| +|新增|NA|模块名: grid_col<br>类名: GridColOptions<br>方法 or 属性: span?: number \| GridColColumnOption;|grid_col.d.ts| +|新增|NA|模块名: grid_col<br>类名: GridColOptions<br>方法 or 属性: offset?: number \| GridColColumnOption;|grid_col.d.ts| +|新增|NA|模块名: grid_col<br>类名: GridColOptions<br>方法 or 属性: order?: number \| GridColColumnOption;|grid_col.d.ts| +|新增|NA|模块名: grid_col<br>类名: GridColInterface|grid_col.d.ts| +|新增|NA|模块名: grid_col<br>类名: GridColInterface<br>方法 or 属性: (option?: GridColOptions): GridColAttribute;|grid_col.d.ts| +|新增|NA|模块名: grid_col<br>类名: GridColAttribute|grid_col.d.ts| +|新增|NA|模块名: grid_col<br>类名: GridColAttribute<br>方法 or 属性: span(value: number \| GridColColumnOption): GridRowAttribute;|grid_col.d.ts| +|新增|NA|模块名: grid_col<br>类名: GridColAttribute<br>方法 or 属性: offset(value: number \| GridColColumnOption): GridRowAttribute;|grid_col.d.ts| +|新增|NA|模块名: grid_col<br>类名: GridColAttribute<br>方法 or 属性: order(value: number \| GridColColumnOption): GridRowAttribute;|grid_col.d.ts| +|新增|NA|模块名: grid_col<br>类名: global<br>方法 or 属性: declare const GridCol: GridColInterface|grid_col.d.ts| +|新增|NA|模块名: grid_col<br>类名: global<br>方法 or 属性: declare const GridColInstance: GridColAttribute;|grid_col.d.ts| +|新增|NA|模块名: grid_row<br>类名: GridRowSizeOption|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: GridRowSizeOption<br>方法 or 属性: xs?: Length,|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: GridRowSizeOption<br>方法 or 属性: sm?: Length,|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: GridRowSizeOption<br>方法 or 属性: md?: Length,|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: GridRowSizeOption<br>方法 or 属性: lg?: Length,|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: GridRowSizeOption<br>方法 or 属性: xl?: Length,|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: GridRowSizeOption<br>方法 or 属性: xxl?: Length,|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: GridRowColumnOption|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: GridRowColumnOption<br>方法 or 属性: xs?: number,|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: GridRowColumnOption<br>方法 or 属性: sm?: number,|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: GridRowColumnOption<br>方法 or 属性: md?: number,|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: GridRowColumnOption<br>方法 or 属性: lg?: number,|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: GridRowColumnOption<br>方法 or 属性: xl?: number,|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: GridRowColumnOption<br>方法 or 属性: xxl?: number,|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: GutterOption|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: GutterOption<br>方法 or 属性: x?: Length \| GridRowSizeOption,|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: GutterOption<br>方法 or 属性: y?: Length \| GridRowSizeOption|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: BreakpointsReference|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: BreakpointsReference<br>方法 or 属性: WindowSize|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: BreakpointsReference<br>方法 or 属性: ComponentSize|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: GridRowDirection|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: GridRowDirection<br>方法 or 属性: Row|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: GridRowDirection<br>方法 or 属性: RowReverse|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: BreakPoints|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: BreakPoints<br>方法 or 属性: value?: Array\<string>,|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: BreakPoints<br>方法 or 属性: reference?: BreakpointsReference,|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: GridRowOptions|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: GridRowOptions<br>方法 or 属性: gutter?: Length \| GutterOption;|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: GridRowOptions<br>方法 or 属性: columns?: number \| GridRowColumnOption;|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: GridRowOptions<br>方法 or 属性: breakpoints?: BreakPoints;|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: GridRowOptions<br>方法 or 属性: direction?: GridRowDirection;|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: GridRowInterface|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: GridRowInterface<br>方法 or 属性: (option?: GridRowOptions): GridRowAttribute;|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: GridRowAttribute|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: GridRowAttribute<br>方法 or 属性: onBreakpointChange(callback: (breakpoints: string) => void): GridRowAttribute;|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: global<br>方法 or 属性: declare const GridRow: GridRowInterface;|grid_row.d.ts| +|新增|NA|模块名: grid_row<br>类名: global<br>方法 or 属性: declare const GridRowInstance: GridRowAttribute;|grid_row.d.ts| +|新增|NA|类名:ImageAttribute<br>方法or属性:colorFilter(value: ColorFilter): ImageAttribute;|image.d.ts| +|新增|NA|类名:ImageAttribute<br>方法or属性:copyOption(value: CopyOptions): ImageAttribute;|image.d.ts| +|新增|NA|类名:ImageAttribute<br>方法or属性:draggable(value: boolean): ImageAttribute;|image.d.ts| +|新增|NA|类名:ImageAttribute<br>方法or属性:onError(callback: (event?: { componentWidth: number; componentHeight: number; message: string }) => void): ImageAttribute;|image.d.ts| +|新增|NA|模块名: image_animator<br>类名: ImageFrameInfo|image_animator.d.ts| +|新增|NA|类名:ImageFrameInfo<br>方法or属性:|image_animator.d.ts| +|新增|NA|模块名: image_animator<br>类名: ImageFrameInfo<br>方法 or 属性:src: string \| Resource;|image_animator.d.ts| +|新增|NA|类名:ImageFrameInfo<br>方法or属性:src: string \| Resource;|image_animator.d.ts| +|新增|NA|模块名: image_animator<br>类名: ImageFrameInfo<br>方法 or 属性:width?: number \| string;|image_animator.d.ts| +|新增|NA|类名:ImageFrameInfo<br>方法or属性:width?: number \| string;|image_animator.d.ts| +|新增|NA|模块名: image_animator<br>类名: ImageFrameInfo<br>方法 or 属性:height?: number \| string;|image_animator.d.ts| +|新增|NA|类名:ImageFrameInfo<br>方法or属性:height?: number \| string;|image_animator.d.ts| +|新增|NA|模块名: image_animator<br>类名: ImageFrameInfo<br>方法 or 属性:top?: number \| string;|image_animator.d.ts| +|新增|NA|类名:ImageFrameInfo<br>方法or属性:top?: number \| string;|image_animator.d.ts| +|新增|NA|模块名: image_animator<br>类名: ImageFrameInfo<br>方法 or 属性:left?: number \| string;|image_animator.d.ts| +|新增|NA|类名:ImageFrameInfo<br>方法or属性:left?: number \| string;|image_animator.d.ts| +|新增|NA|模块名: image_animator<br>类名: ImageFrameInfo<br>方法 or 属性:duration?: number;|image_animator.d.ts| +|新增|NA|类名:ImageFrameInfo<br>方法or属性:duration?: number;|image_animator.d.ts| +|新增|NA|模块名: list<br>类名: ListItemAlign|list.d.ts| +|新增|NA|类名:ListItemAlign<br>方法or属性:|list.d.ts| +|新增|NA|模块名: list<br>类名: ListItemAlign<br>方法 or 属性:Start|list.d.ts| +|新增|NA|类名:ListItemAlign<br>方法or属性:Start|list.d.ts| +|新增|NA|模块名: list<br>类名: ListItemAlign<br>方法 or 属性:Center|list.d.ts| +|新增|NA|类名:ListItemAlign<br>方法or属性:Center|list.d.ts| +|新增|NA|模块名: list<br>类名: ListItemAlign<br>方法 or 属性:End|list.d.ts| +|新增|NA|类名:ListItemAlign<br>方法or属性:End|list.d.ts| +|新增|NA|模块名: list<br>类名: StickyStyle|list.d.ts| +|新增|NA|类名:StickyStyle<br>方法or属性:|list.d.ts| +|新增|NA|模块名: list<br>类名: StickyStyle<br>方法 or 属性:None = 0|list.d.ts| +|新增|NA|类名:StickyStyle<br>方法or属性:None = 0|list.d.ts| +|新增|NA|模块名: list<br>类名: StickyStyle<br>方法 or 属性:Header = 1|list.d.ts| +|新增|NA|类名:StickyStyle<br>方法or属性:Header = 1|list.d.ts| +|新增|NA|模块名: list<br>类名: StickyStyle<br>方法 or 属性:Footer = 2|list.d.ts| +|新增|NA|类名:StickyStyle<br>方法or属性:Footer = 2|list.d.ts| +|新增|NA|类名:ListAttribute<br>方法or属性:lanes(value: number \| LengthConstrain): ListAttribute;|list.d.ts| +|新增|NA|类名:ListAttribute<br>方法or属性:alignListItem(value: ListItemAlign): ListAttribute;|list.d.ts| +|新增|NA|类名:ListAttribute<br>方法or属性:sticky(value: StickyStyle): ListAttribute;|list.d.ts| +|新增|NA|类名:ListAttribute<br>方法or属性:onScrollStart(event: () => void): ListAttribute;|list.d.ts| +|新增|NA|类名:ListAttribute<br>方法or属性:onScrollFrameBegin(event: (offset: number, state: ScrollState) => { offsetRemain: number }): ListAttribute;|list.d.ts| +|新增|NA|模块名: list_item<br>类名: SwipeEdgeEffect|list_item.d.ts| +|新增|NA|类名:SwipeEdgeEffect<br>方法or属性:|list_item.d.ts| +|新增|NA|模块名: list_item<br>类名: SwipeEdgeEffect<br>方法 or 属性:Spring|list_item.d.ts| +|新增|NA|类名:SwipeEdgeEffect<br>方法or属性:Spring|list_item.d.ts| +|新增|NA|模块名: list_item<br>类名: SwipeEdgeEffect<br>方法 or 属性:None|list_item.d.ts| +|新增|NA|类名:SwipeEdgeEffect<br>方法or属性:None|list_item.d.ts| +|新增|NA|模块名: list_item<br>类名: SwipeActionOptions|list_item.d.ts| +|新增|NA|类名:SwipeActionOptions<br>方法or属性:|list_item.d.ts| +|新增|NA|模块名: list_item<br>类名: SwipeActionOptions<br>方法 or 属性:start?: CustomBuilder;|list_item.d.ts| +|新增|NA|类名:SwipeActionOptions<br>方法or属性:start?: CustomBuilder;|list_item.d.ts| +|新增|NA|模块名: list_item<br>类名: SwipeActionOptions<br>方法 or 属性:end?: CustomBuilder;|list_item.d.ts| +|新增|NA|类名:SwipeActionOptions<br>方法or属性:end?: CustomBuilder;|list_item.d.ts| +|新增|NA|模块名: list_item<br>类名: SwipeActionOptions<br>方法 or 属性:edgeEffect?: SwipeEdgeEffect;|list_item.d.ts| +|新增|NA|类名:SwipeActionOptions<br>方法or属性:edgeEffect?: SwipeEdgeEffect;|list_item.d.ts| +|新增|NA|类名:ListItemAttribute<br>方法or属性:swipeAction(value: SwipeActionOptions): ListItemAttribute;|list_item.d.ts| +|新增|NA|模块名: list_item_group<br>类名: ListItemGroupOptions|list_item_group.d.ts| +|新增|NA|模块名: list_item_group<br>类名: ListItemGroupOptions<br>方法 or 属性: header?: CustomBuilder;|list_item_group.d.ts| +|新增|NA|模块名: list_item_group<br>类名: ListItemGroupOptions<br>方法 or 属性: footer?: CustomBuilder;|list_item_group.d.ts| +|新增|NA|模块名: list_item_group<br>类名: ListItemGroupOptions<br>方法 or 属性: space?: number \| string;|list_item_group.d.ts| +|新增|NA|模块名: list_item_group<br>类名: ListItemGroupInterface|list_item_group.d.ts| +|新增|NA|模块名: list_item_group<br>类名: ListItemGroupInterface<br>方法 or 属性: (options?: ListItemGroupOptions): ListItemGroupAttribute;|list_item_group.d.ts| +|新增|NA|模块名: list_item_group<br>类名: ListItemGroupAttribute|list_item_group.d.ts| +|新增|NA|模块名: list_item_group<br>类名: ListItemGroupAttribute<br>方法 or 属性: divider(<br> value: {<br> strokeWidth: Length;<br> color?: ResourceColor;<br> startMargin?: Length;<br> endMargin?: Length;<br> } \| null,<br> ): ListItemGroupAttribute;|list_item_group.d.ts| +|新增|NA|模块名: list_item_group<br>类名: global<br>方法 or 属性: declare const ListItemGroupInstance: ListItemGroupAttribute;|list_item_group.d.ts| +|新增|NA|模块名: list_item_group<br>类名: global<br>方法 or 属性: declare const ListItemGroup: ListItemGroupInterface;|list_item_group.d.ts| +|新增|NA|模块名: menu<br>类名: MenuInterface|menu.d.ts| +|新增|NA|模块名: menu<br>类名: MenuInterface<br>方法 or 属性: (): MenuAttribute;|menu.d.ts| +|新增|NA|模块名: menu<br>类名: MenuAttribute|menu.d.ts| +|新增|NA|模块名: menu<br>类名: MenuAttribute<br>方法 or 属性: fontSize(value: Length): MenuAttribute;|menu.d.ts| +|新增|NA|模块名: menu<br>类名: global<br>方法 or 属性: declare const Menu: MenuInterface;|menu.d.ts| +|新增|NA|模块名: menu<br>类名: global<br>方法 or 属性: declare const MenuInstance: MenuAttribute;|menu.d.ts| +|新增|NA|模块名: menu_item<br>类名: MenuItemOptions|menu_item.d.ts| +|新增|NA|模块名: menu_item<br>类名: MenuItemOptions<br>方法 or 属性: startIcon?: ResourceStr;|menu_item.d.ts| +|新增|NA|模块名: menu_item<br>类名: MenuItemOptions<br>方法 or 属性: content?: ResourceStr;|menu_item.d.ts| +|新增|NA|模块名: menu_item<br>类名: MenuItemOptions<br>方法 or 属性: endIcon?: ResourceStr;|menu_item.d.ts| +|新增|NA|模块名: menu_item<br>类名: MenuItemOptions<br>方法 or 属性: labelInfo?: ResourceStr;|menu_item.d.ts| +|新增|NA|模块名: menu_item<br>类名: MenuItemOptions<br>方法 or 属性: builder?: CustomBuilder;|menu_item.d.ts| +|新增|NA|模块名: menu_item<br>类名: MenuItemInterface|menu_item.d.ts| +|新增|NA|模块名: menu_item<br>类名: MenuItemInterface<br>方法 or 属性: (value?: MenuItemOptions \| CustomBuilder): MenuItemAttribute;|menu_item.d.ts| +|新增|NA|模块名: menu_item<br>类名: MenuItemAttribute|menu_item.d.ts| +|新增|NA|模块名: menu_item<br>类名: MenuItemAttribute<br>方法 or 属性: selected(value: boolean): MenuItemAttribute;|menu_item.d.ts| +|新增|NA|模块名: menu_item<br>类名: MenuItemAttribute<br>方法 or 属性: selectIcon(value: boolean): MenuItemAttribute;|menu_item.d.ts| +|新增|NA|模块名: menu_item<br>类名: MenuItemAttribute<br>方法 or 属性: onChange(callback: (selected: boolean) => void): MenuItemAttribute;|menu_item.d.ts| +|新增|NA|模块名: menu_item<br>类名: global<br>方法 or 属性: declare const MenuItem: MenuItemInterface;|menu_item.d.ts| +|新增|NA|模块名: menu_item<br>类名: global<br>方法 or 属性: declare const MenuItemInstance: MenuItemAttribute;|menu_item.d.ts| +|新增|NA|模块名: menu_item_group<br>类名: MenuItemGroupOptions|menu_item_group.d.ts| +|新增|NA|模块名: menu_item_group<br>类名: MenuItemGroupOptions<br>方法 or 属性: header?: ResourceStr \| CustomBuilder;|menu_item_group.d.ts| +|新增|NA|模块名: menu_item_group<br>类名: MenuItemGroupOptions<br>方法 or 属性: footer?: ResourceStr \| CustomBuilder;|menu_item_group.d.ts| +|新增|NA|模块名: menu_item_group<br>类名: MenuItemGroupInterface|menu_item_group.d.ts| +|新增|NA|模块名: menu_item_group<br>类名: MenuItemGroupInterface<br>方法 or 属性: (value?: MenuItemGroupOptions): MenuItemGroupAttribute;|menu_item_group.d.ts| +|新增|NA|模块名: menu_item_group<br>类名: MenuItemGroupAttribute|menu_item_group.d.ts| +|新增|NA|模块名: menu_item_group<br>类名: global<br>方法 or 属性: declare const MenuItemGroup: MenuItemGroupInterface;|menu_item_group.d.ts| +|新增|NA|模块名: menu_item_group<br>类名: global<br>方法 or 属性: declare const MenuItemGroupInstance: MenuItemGroupAttribute;|menu_item_group.d.ts| +|新增|NA|模块名: navigation<br>类名: NavigationCommonTitle|navigation.d.ts| +|新增|NA|类名:NavigationCommonTitle<br>方法or属性:|navigation.d.ts| +|新增|NA|模块名: navigation<br>类名: NavigationCommonTitle<br>方法 or 属性:main: string;|navigation.d.ts| +|新增|NA|类名:NavigationCommonTitle<br>方法or属性:main: string;|navigation.d.ts| +|新增|NA|模块名: navigation<br>类名: NavigationCommonTitle<br>方法 or 属性:sub: string;|navigation.d.ts| +|新增|NA|类名:NavigationCommonTitle<br>方法or属性:sub: string;|navigation.d.ts| +|新增|NA|模块名: navigation<br>类名: NavigationCustomTitle|navigation.d.ts| +|新增|NA|类名:NavigationCustomTitle<br>方法or属性:|navigation.d.ts| +|新增|NA|模块名: navigation<br>类名: NavigationCustomTitle<br>方法 or 属性:builder: CustomBuilder;|navigation.d.ts| +|新增|NA|类名:NavigationCustomTitle<br>方法or属性:builder: CustomBuilder;|navigation.d.ts| +|新增|NA|模块名: navigation<br>类名: NavigationCustomTitle<br>方法 or 属性:height: TitleHeight \| Length;|navigation.d.ts| +|新增|NA|类名:NavigationCustomTitle<br>方法or属性:height: TitleHeight \| Length;|navigation.d.ts| +|新增|NA|模块名: navigation<br>类名: NavigationMode|navigation.d.ts| +|新增|NA|类名:NavigationMode<br>方法or属性:|navigation.d.ts| +|新增|NA|模块名: navigation<br>类名: NavigationMode<br>方法 or 属性:Stack|navigation.d.ts| +|新增|NA|类名:NavigationMode<br>方法or属性:Stack|navigation.d.ts| +|新增|NA|模块名: navigation<br>类名: NavigationMode<br>方法 or 属性:Split|navigation.d.ts| +|新增|NA|类名:NavigationMode<br>方法or属性:Split|navigation.d.ts| +|新增|NA|模块名: navigation<br>类名: NavigationMode<br>方法 or 属性:Auto|navigation.d.ts| +|新增|NA|类名:NavigationMode<br>方法or属性:Auto|navigation.d.ts| +|新增|NA|模块名: navigation<br>类名: NavBarPosition|navigation.d.ts| +|新增|NA|类名:NavBarPosition<br>方法or属性:|navigation.d.ts| +|新增|NA|模块名: navigation<br>类名: NavBarPosition<br>方法 or 属性:Start|navigation.d.ts| +|新增|NA|类名:NavBarPosition<br>方法or属性:Start|navigation.d.ts| +|新增|NA|模块名: navigation<br>类名: NavBarPosition<br>方法 or 属性:End|navigation.d.ts| +|新增|NA|类名:NavBarPosition<br>方法or属性:End|navigation.d.ts| +|新增|NA|类名:NavigationAttribute<br>方法or属性:navBarWidth(value: Length): NavigationAttribute;|navigation.d.ts| +|新增|NA|类名:NavigationAttribute<br>方法or属性:navBarPosition(value: NavBarPosition): NavigationAttribute;|navigation.d.ts| +|新增|NA|类名:NavigationAttribute<br>方法or属性:mode(value: NavigationMode): NavigationAttribute;|navigation.d.ts| +|新增|NA|类名:NavigationAttribute<br>方法or属性:backButtonIcon(value: string \| PixelMap \| Resource): NavigationAttribute;|navigation.d.ts| +|新增|NA|类名:NavigationAttribute<br>方法or属性:hideNavBar(value: boolean): NavigationAttribute;|navigation.d.ts| +|新增|NA|类名:NavigationAttribute<br>方法or属性:onNavBarStateChange(callback: (isVisible: boolean) => void): NavigationAttribute;|navigation.d.ts| +|新增|NA|模块名: nav_destination<br>类名: NavDestinationCommonTitle|nav_destination.d.ts| +|新增|NA|模块名: nav_destination<br>类名: NavDestinationCommonTitle<br>方法 or 属性: main: string;|nav_destination.d.ts| +|新增|NA|模块名: nav_destination<br>类名: NavDestinationCommonTitle<br>方法 or 属性: sub: string;|nav_destination.d.ts| +|新增|NA|模块名: nav_destination<br>类名: NavDestinationCustomTitle|nav_destination.d.ts| +|新增|NA|模块名: nav_destination<br>类名: NavDestinationCustomTitle<br>方法 or 属性: builder: CustomBuilder;|nav_destination.d.ts| +|新增|NA|模块名: nav_destination<br>类名: NavDestinationCustomTitle<br>方法 or 属性: height: TitleHeight \| Length;|nav_destination.d.ts| +|新增|NA|模块名: nav_destination<br>类名: NavDestinationInterface|nav_destination.d.ts| +|新增|NA|模块名: nav_destination<br>类名: NavDestinationInterface<br>方法 or 属性: (): NavDestinationAttribute;|nav_destination.d.ts| +|新增|NA|模块名: nav_destination<br>类名: NavDestinationAttribute|nav_destination.d.ts| +|新增|NA|模块名: nav_destination<br>类名: NavDestinationAttribute<br>方法 or 属性: title(value: string \| CustomBuilder \| NavDestinationCommonTitle \| NavDestinationCustomTitle): NavDestinationAttribute;|nav_destination.d.ts| +|新增|NA|模块名: nav_destination<br>类名: NavDestinationAttribute<br>方法 or 属性: hideTitleBar(value: boolean): NavDestinationAttribute;|nav_destination.d.ts| +|新增|NA|模块名: nav_destination<br>类名: global<br>方法 or 属性: declare const NavDestination: NavDestinationInterface;|nav_destination.d.ts| +|新增|NA|模块名: nav_destination<br>类名: global<br>方法 or 属性: declare const NavDestinationInstance: NavDestinationAttribute;|nav_destination.d.ts| +|新增|NA|模块名: nav_router<br>类名: NavRouterInterface|nav_router.d.ts| +|新增|NA|模块名: nav_router<br>类名: NavRouterInterface<br>方法 or 属性: (): NavRouterAttribute;|nav_router.d.ts| +|新增|NA|模块名: nav_router<br>类名: NavRouterAttribute|nav_router.d.ts| +|新增|NA|模块名: nav_router<br>类名: NavRouterAttribute<br>方法 or 属性: onStateChange(callback: (isActivated: boolean) => void): NavRouterAttribute;|nav_router.d.ts| +|新增|NA|模块名: nav_router<br>类名: global<br>方法 or 属性: declare const NavRouter: NavRouterInterface;|nav_router.d.ts| +|新增|NA|模块名: nav_router<br>类名: global<br>方法 or 属性: declare const NavRouterInstance: NavRouterAttribute;|nav_router.d.ts| +|新增|NA|模块名: panel<br>类名: PanelAttribute<br>方法 or 属性:backgroundMask(color: ResourceColor): PanelAttribute;|panel.d.ts| +|新增|NA|类名:PanelAttribute<br>方法or属性:backgroundMask(color: ResourceColor): PanelAttribute;|panel.d.ts| +|新增|NA|模块名: panel<br>类名: PanelAttribute<br>方法 or 属性:onHeightChange(callback: (value: number) => void): PanelAttribute;|panel.d.ts| +|新增|NA|类名:PanelAttribute<br>方法or属性:onHeightChange(callback: (value: number) => void): PanelAttribute;|panel.d.ts| +|新增|NA|模块名: pattern_lock<br>类名: PatternLockController|pattern_lock.d.ts| +|新增|NA|模块名: pattern_lock<br>类名: PatternLockController<br>方法 or 属性: constructor();|pattern_lock.d.ts| +|新增|NA|模块名: pattern_lock<br>类名: PatternLockController<br>方法 or 属性: reset();|pattern_lock.d.ts| +|新增|NA|模块名: pattern_lock<br>类名: PatternLockInterface|pattern_lock.d.ts| +|新增|NA|模块名: pattern_lock<br>类名: PatternLockInterface<br>方法 or 属性: (controller?: PatternLockController): PatternLockAttribute;|pattern_lock.d.ts| +|新增|NA|模块名: pattern_lock<br>类名: PatternLockAttribute|pattern_lock.d.ts| +|新增|NA|模块名: pattern_lock<br>类名: PatternLockAttribute<br>方法 or 属性: sideLength(value: Length): PatternLockAttribute;|pattern_lock.d.ts| +|新增|NA|模块名: pattern_lock<br>类名: PatternLockAttribute<br>方法 or 属性: circleRadius(value: Length): PatternLockAttribute;|pattern_lock.d.ts| +|新增|NA|模块名: pattern_lock<br>类名: PatternLockAttribute<br>方法 or 属性: backgroundColor(value: ResourceColor): PatternLockAttribute;|pattern_lock.d.ts| +|新增|NA|模块名: pattern_lock<br>类名: PatternLockAttribute<br>方法 or 属性: regularColor(value: ResourceColor): PatternLockAttribute;|pattern_lock.d.ts| +|新增|NA|模块名: pattern_lock<br>类名: PatternLockAttribute<br>方法 or 属性: selectedColor(value: ResourceColor): PatternLockAttribute;|pattern_lock.d.ts| +|新增|NA|模块名: pattern_lock<br>类名: PatternLockAttribute<br>方法 or 属性: activeColor(value: ResourceColor): PatternLockAttribute;|pattern_lock.d.ts| +|新增|NA|模块名: pattern_lock<br>类名: PatternLockAttribute<br>方法 or 属性: pathColor(value: ResourceColor): PatternLockAttribute;|pattern_lock.d.ts| +|新增|NA|模块名: pattern_lock<br>类名: PatternLockAttribute<br>方法 or 属性: pathStrokeWidth(value: number \| string): PatternLockAttribute;|pattern_lock.d.ts| +|新增|NA|模块名: pattern_lock<br>类名: PatternLockAttribute<br>方法 or 属性: onPatternComplete(callback: (input: Array\<number>) => void): PatternLockAttribute;|pattern_lock.d.ts| +|新增|NA|模块名: pattern_lock<br>类名: PatternLockAttribute<br>方法 or 属性: autoReset(value: boolean): PatternLockAttribute;|pattern_lock.d.ts| +|新增|NA|模块名: pattern_lock<br>类名: global<br>方法 or 属性: declare const PatternLock: PatternLockInterface;|pattern_lock.d.ts| +|新增|NA|模块名: pattern_lock<br>类名: global<br>方法 or 属性: declare const PatternLockInstance: PatternLockAttribute;|pattern_lock.d.ts| +|新增|NA|模块名: plugin_component<br>类名: PluginComponentTemplate|plugin_component.d.ts| +|新增|NA|模块名: plugin_component<br>类名: PluginComponentTemplate<br>方法 or 属性: source: string;|plugin_component.d.ts| +|新增|NA|模块名: plugin_component<br>类名: PluginComponentTemplate<br>方法 or 属性: bundleName: string;|plugin_component.d.ts| +|新增|NA|模块名: plugin_component<br>类名: PluginComponentInterface|plugin_component.d.ts| +|新增|NA|模块名: plugin_component<br>类名: PluginComponentInterface<br>方法 or 属性: (value: { template: PluginComponentTemplate; data: any }): PluginComponentAttribute;|plugin_component.d.ts| +|新增|NA|模块名: plugin_component<br>类名: PluginComponentAttribute|plugin_component.d.ts| +|新增|NA|模块名: plugin_component<br>类名: PluginComponentAttribute<br>方法 or 属性: onComplete(callback: () => void): PluginComponentAttribute;|plugin_component.d.ts| +|新增|NA|模块名: plugin_component<br>类名: PluginComponentAttribute<br>方法 or 属性: onError(callback: (info: { errcode: number; msg: string }) => void): PluginComponentAttribute;|plugin_component.d.ts| +|新增|NA|模块名: plugin_component<br>类名: global<br>方法 or 属性: declare const PluginComponent: PluginComponentInterface;|plugin_component.d.ts| +|新增|NA|模块名: plugin_component<br>类名: global<br>方法 or 属性: declare const PluginComponentInstance: PluginComponentAttribute;|plugin_component.d.ts| +|新增|NA|类名:global<br>方法or属性:declare const RectInstance: RectAttribute;|rect.d.ts| +|新增|NA|模块名: relative_container<br>类名: RelativeContainerInterface|relative_container.d.ts| +|新增|NA|模块名: relative_container<br>类名: RelativeContainerInterface<br>方法 or 属性: (): RelativeContainerAttribute;|relative_container.d.ts| +|新增|NA|模块名: relative_container<br>类名: RelativeContainerAttribute|relative_container.d.ts| +|新增|NA|模块名: relative_container<br>类名: global<br>方法 or 属性: declare const RelativeContainer : RelativeContainerInterface;|relative_container.d.ts| +|新增|NA|模块名: relative_container<br>类名: global<br>方法 or 属性: declare const RelativeContainerInstance: RelativeContainerAttribute;|relative_container.d.ts| +|新增|NA|模块名: remote_window<br>类名: RRect|remote_window.d.ts| +|新增|NA|模块名: remote_window<br>类名: RRect<br>方法 or 属性: left: number;|remote_window.d.ts| +|新增|NA|模块名: remote_window<br>类名: RRect<br>方法 or 属性: top: number;|remote_window.d.ts| +|新增|NA|模块名: remote_window<br>类名: RRect<br>方法 or 属性: width: number;|remote_window.d.ts| +|新增|NA|模块名: remote_window<br>类名: RRect<br>方法 or 属性: height: number;|remote_window.d.ts| +|新增|NA|模块名: remote_window<br>类名: RRect<br>方法 or 属性: radius: number;|remote_window.d.ts| +|新增|NA|模块名: remote_window<br>类名: WindowAnimationTarget|remote_window.d.ts| +|新增|NA|模块名: remote_window<br>类名: WindowAnimationTarget<br>方法 or 属性: readonly bundleName: string;|remote_window.d.ts| +|新增|NA|模块名: remote_window<br>类名: WindowAnimationTarget<br>方法 or 属性: readonly abilityName: string;|remote_window.d.ts| +|新增|NA|模块名: remote_window<br>类名: WindowAnimationTarget<br>方法 or 属性: readonly windowBounds: RRect;|remote_window.d.ts| +|新增|NA|模块名: remote_window<br>类名: WindowAnimationTarget<br>方法 or 属性: readonly missionId: number;|remote_window.d.ts| +|新增|NA|模块名: remote_window<br>类名: RemoteWindowInterface|remote_window.d.ts| +|新增|NA|模块名: remote_window<br>类名: RemoteWindowInterface<br>方法 or 属性: (target: WindowAnimationTarget): RemoteWindowAttribute;|remote_window.d.ts| +|新增|NA|模块名: remote_window<br>类名: RemoteWindowAttribute|remote_window.d.ts| +|新增|NA|模块名: remote_window<br>类名: global<br>方法 or 属性: declare const RemoteWindow: RemoteWindowInterface;|remote_window.d.ts| +|新增|NA|模块名: remote_window<br>类名: global<br>方法 or 属性: declare const RemoteWindowInstance: RemoteWindowAttribute;|remote_window.d.ts| +|新增|NA|类名:Scroller<br>方法or属性:scrollPage(value: { next: boolean });|scroll.d.ts| +|新增|NA|类名:Scroller<br>方法or属性:scrollBy(dx: Length, dy: Length);|scroll.d.ts| +|新增|NA|类名:ScrollAttribute<br>方法or属性:onScrollStart(event: () => void): ScrollAttribute;|scroll.d.ts| +|新增|NA|类名:ScrollAttribute<br>方法or属性:onScrollStop(event: () => void): ScrollAttribute;|scroll.d.ts| +|新增|NA|类名:ScrollAttribute<br>方法or属性:onScrollFrameBegin(event: (offset: number, state: ScrollState) => { offsetRemain: number }): ScrollAttribute;|scroll.d.ts| +|新增|NA|模块名: search<br>类名: SearchAttribute<br>方法 or 属性:copyOption(value: CopyOptions): SearchAttribute;|search.d.ts| +|新增|NA|类名:SearchAttribute<br>方法or属性:copyOption(value: CopyOptions): SearchAttribute;|search.d.ts| +|新增|NA|模块名: search<br>类名: SearchAttribute<br>方法 or 属性:textAlign(value: TextAlign): SearchAttribute;|search.d.ts| +|新增|NA|类名:SearchAttribute<br>方法or属性:textAlign(value: TextAlign): SearchAttribute;|search.d.ts| +|新增|NA|类名:ShapeInterface<br>方法or属性:(value: PixelMap): ShapeAttribute;|shape.d.ts| +|新增|NA|类名:ShapeInterface<br>方法or属性:(): ShapeAttribute;|shape.d.ts| +|新增|NA|模块名: sidebar<br>类名: SideBarPosition|sidebar.d.ts| +|新增|NA|类名:SideBarPosition<br>方法or属性:|sidebar.d.ts| +|新增|NA|模块名: sidebar<br>类名: SideBarPosition<br>方法 or 属性:Start|sidebar.d.ts| +|新增|NA|类名:SideBarPosition<br>方法or属性:Start|sidebar.d.ts| +|新增|NA|模块名: sidebar<br>类名: SideBarPosition<br>方法 or 属性:End|sidebar.d.ts| +|新增|NA|类名:SideBarPosition<br>方法or属性:End|sidebar.d.ts| +|新增|NA|模块名: sidebar<br>类名: SideBarContainerAttribute<br>方法 or 属性:sideBarWidth(value: Length): SideBarContainerAttribute;|sidebar.d.ts| +|新增|NA|类名:SideBarContainerAttribute<br>方法or属性:sideBarWidth(value: Length): SideBarContainerAttribute;|sidebar.d.ts| +|新增|NA|模块名: sidebar<br>类名: SideBarContainerAttribute<br>方法 or 属性:minSideBarWidth(value: Length): SideBarContainerAttribute;|sidebar.d.ts| +|新增|NA|类名:SideBarContainerAttribute<br>方法or属性:minSideBarWidth(value: Length): SideBarContainerAttribute;|sidebar.d.ts| +|新增|NA|模块名: sidebar<br>类名: SideBarContainerAttribute<br>方法 or 属性:maxSideBarWidth(value: Length): SideBarContainerAttribute;|sidebar.d.ts| +|新增|NA|类名:SideBarContainerAttribute<br>方法or属性:maxSideBarWidth(value: Length): SideBarContainerAttribute;|sidebar.d.ts| +|新增|NA|模块名: sidebar<br>类名: SideBarContainerAttribute<br>方法 or 属性:autoHide(value: boolean): SideBarContainerAttribute;|sidebar.d.ts| +|新增|NA|类名:SideBarContainerAttribute<br>方法or属性:autoHide(value: boolean): SideBarContainerAttribute;|sidebar.d.ts| +|新增|NA|模块名: sidebar<br>类名: SideBarContainerAttribute<br>方法 or 属性:sideBarPosition(value: SideBarPosition): SideBarContainerAttribute;|sidebar.d.ts| +|新增|NA|类名:SideBarContainerAttribute<br>方法or属性:sideBarPosition(value: SideBarPosition): SideBarContainerAttribute;|sidebar.d.ts| +|新增|NA|模块名: swiper<br>类名: SwiperAttribute<br>方法 or 属性:onAnimationStart(event: (index: number) => void): SwiperAttribute;|swiper.d.ts| +|新增|NA|类名:SwiperAttribute<br>方法or属性:onAnimationStart(event: (index: number) => void): SwiperAttribute;|swiper.d.ts| +|新增|NA|模块名: swiper<br>类名: SwiperAttribute<br>方法 or 属性:onAnimationEnd(event: (index: number) => void): SwiperAttribute;|swiper.d.ts| +|新增|NA|类名:SwiperAttribute<br>方法or属性:onAnimationEnd(event: (index: number) => void): SwiperAttribute;|swiper.d.ts| +|新增|NA|模块名: tabs<br>类名: TabsAttribute<br>方法 or 属性:barPosition(value: BarPosition): TabsAttribute;|tabs.d.ts| +|新增|NA|类名:TabsAttribute<br>方法or属性:barPosition(value: BarPosition): TabsAttribute;|tabs.d.ts| +|新增|NA|模块名: tab_content<br>类名: SubTabBarStyle|tab_content.d.ts| +|新增|NA|类名:SubTabBarStyle<br>方法or属性:|tab_content.d.ts| +|新增|NA|模块名: tab_content<br>类名: SubTabBarStyle<br>方法 or 属性:constructor(content: string \| Resource);|tab_content.d.ts| +|新增|NA|类名:SubTabBarStyle<br>方法or属性:constructor(content: string \| Resource);|tab_content.d.ts| +|新增|NA|模块名: tab_content<br>类名: BottomTabBarStyle|tab_content.d.ts| +|新增|NA|类名:BottomTabBarStyle<br>方法or属性:|tab_content.d.ts| +|新增|NA|模块名: tab_content<br>类名: BottomTabBarStyle<br>方法 or 属性:constructor(icon: string \| Resource, text: string \| Resource);|tab_content.d.ts| +|新增|NA|类名:BottomTabBarStyle<br>方法or属性:constructor(icon: string \| Resource, text: string \| Resource);|tab_content.d.ts| +|新增|NA|类名:TabContentAttribute<br>方法or属性:tabBar(value: SubTabBarStyle \| BottomTabBarStyle): TabContentAttribute;|tab_content.d.ts| +|新增|NA|类名:TextAttribute<br>方法or属性:copyOption(value: CopyOptions): TextAttribute;|text.d.ts| +|新增|NA|模块名: text_area<br>类名: TextAreaAttribute<br>方法 or 属性:copyOption(value: CopyOptions): TextAreaAttribute;|text_area.d.ts| +|新增|NA|类名:TextAreaAttribute<br>方法or属性:copyOption(value: CopyOptions): TextAreaAttribute;|text_area.d.ts| +|新增|NA|模块名: text_input<br>类名: InputType<br>方法 or 属性:PhoneNumber|text_input.d.ts| +|新增|NA|类名:InputType<br>方法or属性:PhoneNumber|text_input.d.ts| +|新增|NA|模块名: text_input<br>类名: TextInputStyle|text_input.d.ts| +|新增|NA|类名:TextInputStyle<br>方法or属性:|text_input.d.ts| +|新增|NA|模块名: text_input<br>类名: TextInputStyle<br>方法 or 属性:Default|text_input.d.ts| +|新增|NA|类名:TextInputStyle<br>方法or属性:Default|text_input.d.ts| +|新增|NA|模块名: text_input<br>类名: TextInputStyle<br>方法 or 属性:Inline|text_input.d.ts| +|新增|NA|类名:TextInputStyle<br>方法or属性:Inline|text_input.d.ts| +|新增|NA|模块名: text_input<br>类名: TextInputAttribute<br>方法 or 属性:copyOption(value: CopyOptions): TextInputAttribute;|text_input.d.ts| +|新增|NA|类名:TextInputAttribute<br>方法or属性:copyOption(value: CopyOptions): TextInputAttribute;|text_input.d.ts| +|新增|NA|模块名: text_input<br>类名: TextInputAttribute<br>方法 or 属性:showPasswordIcon(value: boolean): TextInputAttribute;|text_input.d.ts| +|新增|NA|类名:TextInputAttribute<br>方法or属性:showPasswordIcon(value: boolean): TextInputAttribute;|text_input.d.ts| +|新增|NA|模块名: text_input<br>类名: TextInputAttribute<br>方法 or 属性:textAlign(value: TextAlign): TextInputAttribute;|text_input.d.ts| +|新增|NA|类名:TextInputAttribute<br>方法or属性:textAlign(value: TextAlign): TextInputAttribute;|text_input.d.ts| +|新增|NA|模块名: text_input<br>类名: TextInputAttribute<br>方法 or 属性:style(value: TextInputStyle): TextInputAttribute;|text_input.d.ts| +|新增|NA|类名:TextInputAttribute<br>方法or属性:style(value: TextInputStyle): TextInputAttribute;|text_input.d.ts| +|新增|NA|模块名: units<br>类名: Resource<br>方法 or 属性:readonly bundleName: string;|units.d.ts| +|新增|NA|类名:Resource<br>方法or属性:readonly bundleName: string;|units.d.ts| +|新增|NA|模块名: units<br>类名: Resource<br>方法 or 属性:readonly moduleName: string;|units.d.ts| +|新增|NA|类名:Resource<br>方法or属性:readonly moduleName: string;|units.d.ts| +|新增|NA|类名:BorderOptions<br>方法or属性:width?: EdgeWidths \| Length;|units.d.ts| +|新增|NA|类名:BorderOptions<br>方法or属性:color?: EdgeColors \| ResourceColor;|units.d.ts| +|新增|NA|类名:BorderOptions<br>方法or属性:radius?: BorderRadiuses \| Length;|units.d.ts| +|新增|NA|类名:BorderOptions<br>方法or属性:style?: EdgeStyles \| BorderStyle;|units.d.ts| +|新增|NA|模块名: units<br>类名: ColorFilter|units.d.ts| +|新增|NA|类名:ColorFilter<br>方法or属性:|units.d.ts| +|新增|NA|模块名: units<br>类名: ColorFilter<br>方法 or 属性:constructor(value: number[]);|units.d.ts| +|新增|NA|类名:ColorFilter<br>方法or属性:constructor(value: number[]);|units.d.ts| +|新增|NA|模块名: units<br>类名: GlobalResource|units.d.ts| +|新增|NA|类名:GlobalResource<br>方法or属性:|units.d.ts| +|新增|NA|模块名: water_flow<br>类名: WaterFlowOptions|water_flow.d.ts| +|新增|NA|模块名: water_flow<br>类名: WaterFlowOptions<br>方法 or 属性: footer?: CustomBuilder;|water_flow.d.ts| +|新增|NA|模块名: water_flow<br>类名: WaterFlowOptions<br>方法 or 属性: scroller?: Scroller;|water_flow.d.ts| +|新增|NA|模块名: water_flow<br>类名: WaterFlowInterface|water_flow.d.ts| +|新增|NA|模块名: water_flow<br>类名: WaterFlowInterface<br>方法 or 属性: (options?: WaterFlowOptions): WaterFlowAttribute;|water_flow.d.ts| +|新增|NA|模块名: water_flow<br>类名: WaterFlowAttribute|water_flow.d.ts| +|新增|NA|模块名: water_flow<br>类名: WaterFlowAttribute<br>方法 or 属性: columnsTemplate(value: string): WaterFlowAttribute;|water_flow.d.ts| +|新增|NA|模块名: water_flow<br>类名: WaterFlowAttribute<br>方法 or 属性: itemConstraintSize(value: ConstraintSizeOptions): WaterFlowAttribute;|water_flow.d.ts| +|新增|NA|模块名: water_flow<br>类名: WaterFlowAttribute<br>方法 or 属性: rowsTemplate(value: string): WaterFlowAttribute;|water_flow.d.ts| +|新增|NA|模块名: water_flow<br>类名: WaterFlowAttribute<br>方法 or 属性: columnsGap(value: Length): WaterFlowAttribute;|water_flow.d.ts| +|新增|NA|模块名: water_flow<br>类名: WaterFlowAttribute<br>方法 or 属性: rowsGap(value: Length): WaterFlowAttribute;|water_flow.d.ts| +|新增|NA|模块名: water_flow<br>类名: WaterFlowAttribute<br>方法 or 属性: layoutDirection(value: FlexDirection): WaterFlowAttribute;|water_flow.d.ts| +|新增|NA|模块名: water_flow<br>类名: WaterFlowAttribute<br>方法 or 属性: onReachStart(event: () => void): WaterFlowAttribute;|water_flow.d.ts| +|新增|NA|模块名: water_flow<br>类名: WaterFlowAttribute<br>方法 or 属性: onReachEnd(event: () => void): WaterFlowAttribute;|water_flow.d.ts| +|新增|NA|模块名: water_flow<br>类名: global<br>方法 or 属性: declare const WaterFlow: WaterFlowInterface;|water_flow.d.ts| +|新增|NA|模块名: water_flow<br>类名: global<br>方法 or 属性: declare const WaterFlowInstance: WaterFlowAttribute;|water_flow.d.ts| +|新增|NA|模块名: web<br>类名: CacheMode<br>方法 or 属性:Default|web.d.ts| +|新增|NA|类名:CacheMode<br>方法or属性:Default|web.d.ts| +|新增|NA|模块名: web<br>类名: WebDarkMode|web.d.ts| +|新增|NA|类名:WebDarkMode<br>方法or属性:|web.d.ts| +|新增|NA|模块名: web<br>类名: WebDarkMode<br>方法 or 属性:Off|web.d.ts| +|新增|NA|类名:WebDarkMode<br>方法or属性:Off|web.d.ts| +|新增|NA|模块名: web<br>类名: WebDarkMode<br>方法 or 属性:On|web.d.ts| +|新增|NA|类名:WebDarkMode<br>方法or属性:On|web.d.ts| +|新增|NA|模块名: web<br>类名: WebDarkMode<br>方法 or 属性:Auto|web.d.ts| +|新增|NA|类名:WebDarkMode<br>方法or属性:Auto|web.d.ts| +|新增|NA|模块名: web<br>类名: FullScreenExitHandler|web.d.ts| +|新增|NA|类名:FullScreenExitHandler<br>方法or属性:|web.d.ts| +|新增|NA|模块名: web<br>类名: FullScreenExitHandler<br>方法 or 属性:constructor();|web.d.ts| +|新增|NA|类名:FullScreenExitHandler<br>方法or属性:constructor();|web.d.ts| +|新增|NA|模块名: web<br>类名: FullScreenExitHandler<br>方法 or 属性:exitFullScreen(): void;|web.d.ts| +|新增|NA|类名:FullScreenExitHandler<br>方法or属性:exitFullScreen(): void;|web.d.ts| +|新增|NA|模块名: web<br>类名: RenderExitReason|web.d.ts| +|新增|NA|类名:RenderExitReason<br>方法or属性:|web.d.ts| +|新增|NA|模块名: web<br>类名: RenderExitReason<br>方法 or 属性:ProcessAbnormalTermination|web.d.ts| +|新增|NA|类名:RenderExitReason<br>方法or属性:ProcessAbnormalTermination|web.d.ts| +|新增|NA|模块名: web<br>类名: RenderExitReason<br>方法 or 属性:ProcessWasKilled|web.d.ts| +|新增|NA|类名:RenderExitReason<br>方法or属性:ProcessWasKilled|web.d.ts| +|新增|NA|模块名: web<br>类名: RenderExitReason<br>方法 or 属性:ProcessCrashed|web.d.ts| +|新增|NA|类名:RenderExitReason<br>方法or属性:ProcessCrashed|web.d.ts| +|新增|NA|模块名: web<br>类名: RenderExitReason<br>方法 or 属性:ProcessOom|web.d.ts| +|新增|NA|类名:RenderExitReason<br>方法or属性:ProcessOom|web.d.ts| +|新增|NA|模块名: web<br>类名: RenderExitReason<br>方法 or 属性:ProcessExitUnknown|web.d.ts| +|新增|NA|类名:RenderExitReason<br>方法or属性:ProcessExitUnknown|web.d.ts| +|新增|NA|模块名: web<br>类名: SslError|web.d.ts| +|新增|NA|类名:SslError<br>方法or属性:|web.d.ts| +|新增|NA|模块名: web<br>类名: SslError<br>方法 or 属性:Invalid|web.d.ts| +|新增|NA|类名:SslError<br>方法or属性:Invalid|web.d.ts| +|新增|NA|模块名: web<br>类名: SslError<br>方法 or 属性:HostMismatch|web.d.ts| +|新增|NA|类名:SslError<br>方法or属性:HostMismatch|web.d.ts| +|新增|NA|模块名: web<br>类名: SslError<br>方法 or 属性:DateInvalid|web.d.ts| +|新增|NA|类名:SslError<br>方法or属性:DateInvalid|web.d.ts| +|新增|NA|模块名: web<br>类名: SslError<br>方法 or 属性:Untrusted|web.d.ts| +|新增|NA|类名:SslError<br>方法or属性:Untrusted|web.d.ts| +|新增|NA|模块名: web<br>类名: FileSelectorMode|web.d.ts| +|新增|NA|类名:FileSelectorMode<br>方法or属性:|web.d.ts| +|新增|NA|模块名: web<br>类名: FileSelectorMode<br>方法 or 属性:FileOpenMode|web.d.ts| +|新增|NA|类名:FileSelectorMode<br>方法or属性:FileOpenMode|web.d.ts| +|新增|NA|模块名: web<br>类名: FileSelectorMode<br>方法 or 属性:FileOpenMultipleMode|web.d.ts| +|新增|NA|类名:FileSelectorMode<br>方法or属性:FileOpenMultipleMode|web.d.ts| +|新增|NA|模块名: web<br>类名: FileSelectorMode<br>方法 or 属性:FileOpenFolderMode|web.d.ts| +|新增|NA|类名:FileSelectorMode<br>方法or属性:FileOpenFolderMode|web.d.ts| +|新增|NA|模块名: web<br>类名: FileSelectorMode<br>方法 or 属性:FileSaveMode|web.d.ts| +|新增|NA|类名:FileSelectorMode<br>方法or属性:FileSaveMode|web.d.ts| +|新增|NA|模块名: web<br>类名: FileSelectorParam|web.d.ts| +|新增|NA|类名:FileSelectorParam<br>方法or属性:|web.d.ts| +|新增|NA|模块名: web<br>类名: FileSelectorParam<br>方法 or 属性:constructor();|web.d.ts| +|新增|NA|类名:FileSelectorParam<br>方法or属性:constructor();|web.d.ts| +|新增|NA|模块名: web<br>类名: FileSelectorParam<br>方法 or 属性:getTitle(): string;|web.d.ts| +|新增|NA|类名:FileSelectorParam<br>方法or属性:getTitle(): string;|web.d.ts| +|新增|NA|模块名: web<br>类名: FileSelectorParam<br>方法 or 属性:getMode(): FileSelectorMode;|web.d.ts| +|新增|NA|类名:FileSelectorParam<br>方法or属性:getMode(): FileSelectorMode;|web.d.ts| +|新增|NA|模块名: web<br>类名: FileSelectorParam<br>方法 or 属性:getAcceptType(): Array\<string>;|web.d.ts| +|新增|NA|类名:FileSelectorParam<br>方法or属性:getAcceptType(): Array\<string>;|web.d.ts| +|新增|NA|模块名: web<br>类名: FileSelectorParam<br>方法 or 属性:isCapture(): boolean;|web.d.ts| +|新增|NA|类名:FileSelectorParam<br>方法or属性:isCapture(): boolean;|web.d.ts| +|新增|NA|模块名: web<br>类名: JsResult<br>方法 or 属性:handlePromptConfirm(result: string): void;|web.d.ts| +|新增|NA|类名:JsResult<br>方法or属性:handlePromptConfirm(result: string): void;|web.d.ts| +|新增|NA|模块名: web<br>类名: FileSelectorResult|web.d.ts| +|新增|NA|类名:FileSelectorResult<br>方法or属性:|web.d.ts| +|新增|NA|模块名: web<br>类名: FileSelectorResult<br>方法 or 属性:constructor();|web.d.ts| +|新增|NA|类名:FileSelectorResult<br>方法or属性:constructor();|web.d.ts| +|新增|NA|模块名: web<br>类名: FileSelectorResult<br>方法 or 属性:handleFileList(fileList: Array\<string>): void;|web.d.ts| +|新增|NA|类名:FileSelectorResult<br>方法or属性:handleFileList(fileList: Array\<string>): void;|web.d.ts| +|新增|NA|模块名: web<br>类名: HttpAuthHandler|web.d.ts| +|新增|NA|类名:HttpAuthHandler<br>方法or属性:|web.d.ts| +|新增|NA|模块名: web<br>类名: HttpAuthHandler<br>方法 or 属性:constructor();|web.d.ts| +|新增|NA|类名:HttpAuthHandler<br>方法or属性:constructor();|web.d.ts| +|新增|NA|模块名: web<br>类名: HttpAuthHandler<br>方法 or 属性:confirm(userName: string, password: string): boolean;|web.d.ts| +|新增|NA|类名:HttpAuthHandler<br>方法or属性:confirm(userName: string, password: string): boolean;|web.d.ts| +|新增|NA|模块名: web<br>类名: HttpAuthHandler<br>方法 or 属性:cancel(): void;|web.d.ts| +|新增|NA|类名:HttpAuthHandler<br>方法or属性:cancel(): void;|web.d.ts| +|新增|NA|模块名: web<br>类名: HttpAuthHandler<br>方法 or 属性:isHttpAuthInfoSaved(): boolean;|web.d.ts| +|新增|NA|类名:HttpAuthHandler<br>方法or属性:isHttpAuthInfoSaved(): boolean;|web.d.ts| +|新增|NA|模块名: web<br>类名: SslErrorHandler|web.d.ts| +|新增|NA|类名:SslErrorHandler<br>方法or属性:|web.d.ts| +|新增|NA|模块名: web<br>类名: SslErrorHandler<br>方法 or 属性:constructor();|web.d.ts| +|新增|NA|类名:SslErrorHandler<br>方法or属性:constructor();|web.d.ts| +|新增|NA|模块名: web<br>类名: SslErrorHandler<br>方法 or 属性:handleConfirm(): void;|web.d.ts| +|新增|NA|类名:SslErrorHandler<br>方法or属性:handleConfirm(): void;|web.d.ts| +|新增|NA|模块名: web<br>类名: SslErrorHandler<br>方法 or 属性:handleCancel(): void;|web.d.ts| +|新增|NA|类名:SslErrorHandler<br>方法or属性:handleCancel(): void;|web.d.ts| +|新增|NA|模块名: web<br>类名: ClientAuthenticationHandler|web.d.ts| +|新增|NA|类名:ClientAuthenticationHandler<br>方法or属性:|web.d.ts| +|新增|NA|模块名: web<br>类名: ClientAuthenticationHandler<br>方法 or 属性:constructor();|web.d.ts| +|新增|NA|类名:ClientAuthenticationHandler<br>方法or属性:constructor();|web.d.ts| +|新增|NA|模块名: web<br>类名: ClientAuthenticationHandler<br>方法 or 属性:confirm(priKeyFile : string, certChainFile : string): void;|web.d.ts| +|新增|NA|类名:ClientAuthenticationHandler<br>方法or属性:confirm(priKeyFile : string, certChainFile : string): void;|web.d.ts| +|新增|NA|模块名: web<br>类名: ClientAuthenticationHandler<br>方法 or 属性:cancel(): void;|web.d.ts| +|新增|NA|类名:ClientAuthenticationHandler<br>方法or属性:cancel(): void;|web.d.ts| +|新增|NA|模块名: web<br>类名: ClientAuthenticationHandler<br>方法 or 属性:ignore(): void;|web.d.ts| +|新增|NA|类名:ClientAuthenticationHandler<br>方法or属性:ignore(): void;|web.d.ts| +|新增|NA|模块名: web<br>类名: ProtectedResourceType|web.d.ts| +|新增|NA|类名:ProtectedResourceType<br>方法or属性:|web.d.ts| +|新增|NA|模块名: web<br>类名: ProtectedResourceType<br>方法 or 属性:MidiSysex = "TYPE_MIDI_SYSEX"|web.d.ts| +|新增|NA|类名:ProtectedResourceType<br>方法or属性:MidiSysex = "TYPE_MIDI_SYSEX"|web.d.ts| +|新增|NA|模块名: web<br>类名: PermissionRequest|web.d.ts| +|新增|NA|类名:PermissionRequest<br>方法or属性:|web.d.ts| +|新增|NA|模块名: web<br>类名: PermissionRequest<br>方法 or 属性:constructor();|web.d.ts| +|新增|NA|类名:PermissionRequest<br>方法or属性:constructor();|web.d.ts| +|新增|NA|模块名: web<br>类名: PermissionRequest<br>方法 or 属性:deny(): void;|web.d.ts| +|新增|NA|类名:PermissionRequest<br>方法or属性:deny(): void;|web.d.ts| +|新增|NA|模块名: web<br>类名: PermissionRequest<br>方法 or 属性:getOrigin(): string;|web.d.ts| +|新增|NA|类名:PermissionRequest<br>方法or属性:getOrigin(): string;|web.d.ts| +|新增|NA|模块名: web<br>类名: PermissionRequest<br>方法 or 属性:getAccessibleResource(): Array\<string>;|web.d.ts| +|新增|NA|类名:PermissionRequest<br>方法or属性:getAccessibleResource(): Array\<string>;|web.d.ts| +|新增|NA|模块名: web<br>类名: PermissionRequest<br>方法 or 属性:grant(resources: Array\<string>): void;|web.d.ts| +|新增|NA|类名:PermissionRequest<br>方法or属性:grant(resources: Array\<string>): void;|web.d.ts| +|新增|NA|模块名: web<br>类名: DataResubmissionHandler|web.d.ts| +|新增|NA|类名:DataResubmissionHandler<br>方法or属性:|web.d.ts| +|新增|NA|模块名: web<br>类名: DataResubmissionHandler<br>方法 or 属性:constructor();|web.d.ts| +|新增|NA|类名:DataResubmissionHandler<br>方法or属性:constructor();|web.d.ts| +|新增|NA|模块名: web<br>类名: DataResubmissionHandler<br>方法 or 属性:resend(): void;|web.d.ts| +|新增|NA|类名:DataResubmissionHandler<br>方法or属性:resend(): void;|web.d.ts| +|新增|NA|模块名: web<br>类名: DataResubmissionHandler<br>方法 or 属性:cancel(): void;|web.d.ts| +|新增|NA|类名:DataResubmissionHandler<br>方法or属性:cancel(): void;|web.d.ts| +|新增|NA|模块名: web<br>类名: ControllerHandler|web.d.ts| +|新增|NA|类名:ControllerHandler<br>方法or属性:|web.d.ts| +|新增|NA|模块名: web<br>类名: ControllerHandler<br>方法 or 属性:constructor();|web.d.ts| +|新增|NA|类名:ControllerHandler<br>方法or属性:constructor();|web.d.ts| +|新增|NA|模块名: web<br>类名: ControllerHandler<br>方法 or 属性:setWebController(controller: WebviewController): void;|web.d.ts| +|新增|NA|类名:ControllerHandler<br>方法or属性:setWebController(controller: WebviewController): void;|web.d.ts| +|新增|NA|模块名: web<br>类名: ContextMenuSourceType|web.d.ts| +|新增|NA|类名:ContextMenuSourceType<br>方法or属性:|web.d.ts| +|新增|NA|模块名: web<br>类名: ContextMenuSourceType<br>方法 or 属性:None|web.d.ts| +|新增|NA|类名:ContextMenuSourceType<br>方法or属性:None|web.d.ts| +|新增|NA|模块名: web<br>类名: ContextMenuSourceType<br>方法 or 属性:Mouse|web.d.ts| +|新增|NA|类名:ContextMenuSourceType<br>方法or属性:Mouse|web.d.ts| +|新增|NA|模块名: web<br>类名: ContextMenuSourceType<br>方法 or 属性:LongPress|web.d.ts| +|新增|NA|类名:ContextMenuSourceType<br>方法or属性:LongPress|web.d.ts| +|新增|NA|模块名: web<br>类名: ContextMenuMediaType|web.d.ts| +|新增|NA|类名:ContextMenuMediaType<br>方法or属性:|web.d.ts| +|新增|NA|模块名: web<br>类名: ContextMenuMediaType<br>方法 or 属性:None|web.d.ts| +|新增|NA|类名:ContextMenuMediaType<br>方法or属性:None|web.d.ts| +|新增|NA|模块名: web<br>类名: ContextMenuMediaType<br>方法 or 属性:Image|web.d.ts| +|新增|NA|类名:ContextMenuMediaType<br>方法or属性:Image|web.d.ts| +|新增|NA|模块名: web<br>类名: ContextMenuInputFieldType|web.d.ts| +|新增|NA|类名:ContextMenuInputFieldType<br>方法or属性:|web.d.ts| +|新增|NA|模块名: web<br>类名: ContextMenuInputFieldType<br>方法 or 属性:None|web.d.ts| +|新增|NA|类名:ContextMenuInputFieldType<br>方法or属性:None|web.d.ts| +|新增|NA|模块名: web<br>类名: ContextMenuInputFieldType<br>方法 or 属性:PlainText|web.d.ts| +|新增|NA|类名:ContextMenuInputFieldType<br>方法or属性:PlainText|web.d.ts| +|新增|NA|模块名: web<br>类名: ContextMenuInputFieldType<br>方法 or 属性:Password|web.d.ts| +|新增|NA|类名:ContextMenuInputFieldType<br>方法or属性:Password|web.d.ts| +|新增|NA|模块名: web<br>类名: ContextMenuInputFieldType<br>方法 or 属性:Number|web.d.ts| +|新增|NA|类名:ContextMenuInputFieldType<br>方法or属性:Number|web.d.ts| +|新增|NA|模块名: web<br>类名: ContextMenuInputFieldType<br>方法 or 属性:Telephone|web.d.ts| +|新增|NA|类名:ContextMenuInputFieldType<br>方法or属性:Telephone|web.d.ts| +|新增|NA|模块名: web<br>类名: ContextMenuInputFieldType<br>方法 or 属性:Other|web.d.ts| +|新增|NA|类名:ContextMenuInputFieldType<br>方法or属性:Other|web.d.ts| +|新增|NA|模块名: web<br>类名: ContextMenuEditStateFlags|web.d.ts| +|新增|NA|类名:ContextMenuEditStateFlags<br>方法or属性:|web.d.ts| +|新增|NA|模块名: web<br>类名: ContextMenuEditStateFlags<br>方法 or 属性:NONE = 0|web.d.ts| +|新增|NA|类名:ContextMenuEditStateFlags<br>方法or属性:NONE = 0|web.d.ts| +|新增|NA|模块名: web<br>类名: ContextMenuEditStateFlags<br>方法 or 属性:CAN_CUT = 1 \<\< 0|web.d.ts| +|新增|NA|类名:ContextMenuEditStateFlags<br>方法or属性:CAN_CUT = 1 \<\< 0|web.d.ts| +|新增|NA|模块名: web<br>类名: ContextMenuEditStateFlags<br>方法 or 属性:CAN_COPY = 1 \<\< 1|web.d.ts| +|新增|NA|类名:ContextMenuEditStateFlags<br>方法or属性:CAN_COPY = 1 \<\< 1|web.d.ts| +|新增|NA|模块名: web<br>类名: ContextMenuEditStateFlags<br>方法 or 属性:CAN_PASTE = 1 \<\< 2|web.d.ts| +|新增|NA|类名:ContextMenuEditStateFlags<br>方法or属性:CAN_PASTE = 1 \<\< 2|web.d.ts| +|新增|NA|模块名: web<br>类名: ContextMenuEditStateFlags<br>方法 or 属性:CAN_SELECT_ALL = 1 \<\< 3|web.d.ts| +|新增|NA|类名:ContextMenuEditStateFlags<br>方法or属性:CAN_SELECT_ALL = 1 \<\< 3|web.d.ts| +|新增|NA|模块名: web<br>类名: WebContextMenuParam|web.d.ts| +|新增|NA|类名:WebContextMenuParam<br>方法or属性:|web.d.ts| +|新增|NA|模块名: web<br>类名: WebContextMenuParam<br>方法 or 属性:constructor();|web.d.ts| +|新增|NA|类名:WebContextMenuParam<br>方法or属性:constructor();|web.d.ts| +|新增|NA|模块名: web<br>类名: WebContextMenuParam<br>方法 or 属性:x(): number;|web.d.ts| +|新增|NA|类名:WebContextMenuParam<br>方法or属性:x(): number;|web.d.ts| +|新增|NA|模块名: web<br>类名: WebContextMenuParam<br>方法 or 属性:y(): number;|web.d.ts| +|新增|NA|类名:WebContextMenuParam<br>方法or属性:y(): number;|web.d.ts| +|新增|NA|模块名: web<br>类名: WebContextMenuParam<br>方法 or 属性:getLinkUrl(): string;|web.d.ts| +|新增|NA|类名:WebContextMenuParam<br>方法or属性:getLinkUrl(): string;|web.d.ts| +|新增|NA|模块名: web<br>类名: WebContextMenuParam<br>方法 or 属性:getUnfilteredLinkUrl(): string;|web.d.ts| +|新增|NA|类名:WebContextMenuParam<br>方法or属性:getUnfilteredLinkUrl(): string;|web.d.ts| +|新增|NA|模块名: web<br>类名: WebContextMenuParam<br>方法 or 属性:getSourceUrl(): string;|web.d.ts| +|新增|NA|类名:WebContextMenuParam<br>方法or属性:getSourceUrl(): string;|web.d.ts| +|新增|NA|模块名: web<br>类名: WebContextMenuParam<br>方法 or 属性:existsImageContents(): boolean;|web.d.ts| +|新增|NA|类名:WebContextMenuParam<br>方法or属性:existsImageContents(): boolean;|web.d.ts| +|新增|NA|模块名: web<br>类名: WebContextMenuParam<br>方法 or 属性:getMediaType(): ContextMenuMediaType;|web.d.ts| +|新增|NA|类名:WebContextMenuParam<br>方法or属性:getMediaType(): ContextMenuMediaType;|web.d.ts| +|新增|NA|模块名: web<br>类名: WebContextMenuParam<br>方法 or 属性:getSelectionText(): string;|web.d.ts| +|新增|NA|类名:WebContextMenuParam<br>方法or属性:getSelectionText(): string;|web.d.ts| +|新增|NA|模块名: web<br>类名: WebContextMenuParam<br>方法 or 属性:getSourceType(): ContextMenuSourceType;|web.d.ts| +|新增|NA|类名:WebContextMenuParam<br>方法or属性:getSourceType(): ContextMenuSourceType;|web.d.ts| +|新增|NA|模块名: web<br>类名: WebContextMenuParam<br>方法 or 属性:getInputFieldType(): ContextMenuInputFieldType;|web.d.ts| +|新增|NA|类名:WebContextMenuParam<br>方法or属性:getInputFieldType(): ContextMenuInputFieldType;|web.d.ts| +|新增|NA|模块名: web<br>类名: WebContextMenuParam<br>方法 or 属性:isEditable(): boolean;|web.d.ts| +|新增|NA|类名:WebContextMenuParam<br>方法or属性:isEditable(): boolean;|web.d.ts| +|新增|NA|模块名: web<br>类名: WebContextMenuParam<br>方法 or 属性:getEditStateFlags(): number;|web.d.ts| +|新增|NA|类名:WebContextMenuParam<br>方法or属性:getEditStateFlags(): number;|web.d.ts| +|新增|NA|模块名: web<br>类名: WebContextMenuResult|web.d.ts| +|新增|NA|类名:WebContextMenuResult<br>方法or属性:|web.d.ts| +|新增|NA|模块名: web<br>类名: WebContextMenuResult<br>方法 or 属性:constructor();|web.d.ts| +|新增|NA|类名:WebContextMenuResult<br>方法or属性:constructor();|web.d.ts| +|新增|NA|模块名: web<br>类名: WebContextMenuResult<br>方法 or 属性:closeContextMenu(): void;|web.d.ts| +|新增|NA|类名:WebContextMenuResult<br>方法or属性:closeContextMenu(): void;|web.d.ts| +|新增|NA|模块名: web<br>类名: WebContextMenuResult<br>方法 or 属性:copyImage(): void;|web.d.ts| +|新增|NA|类名:WebContextMenuResult<br>方法or属性:copyImage(): void;|web.d.ts| +|新增|NA|模块名: web<br>类名: WebContextMenuResult<br>方法 or 属性:copy(): void;|web.d.ts| +|新增|NA|类名:WebContextMenuResult<br>方法or属性:copy(): void;|web.d.ts| +|新增|NA|模块名: web<br>类名: WebContextMenuResult<br>方法 or 属性:paste(): void;|web.d.ts| +|新增|NA|类名:WebContextMenuResult<br>方法or属性:paste(): void;|web.d.ts| +|新增|NA|模块名: web<br>类名: WebContextMenuResult<br>方法 or 属性:cut(): void;|web.d.ts| +|新增|NA|类名:WebContextMenuResult<br>方法or属性:cut(): void;|web.d.ts| +|新增|NA|模块名: web<br>类名: WebContextMenuResult<br>方法 or 属性:selectAll(): void;|web.d.ts| +|新增|NA|类名:WebContextMenuResult<br>方法or属性:selectAll(): void;|web.d.ts| +|新增|NA|类名:ConsoleMessage<br>方法or属性:constructor();|web.d.ts| +|新增|NA|模块名: web<br>类名: WebResourceRequest<br>方法 or 属性:getRequestMethod(): string;|web.d.ts| +|新增|NA|类名:WebResourceRequest<br>方法or属性:getRequestMethod(): string;|web.d.ts| +|新增|NA|模块名: web<br>类名: WebResourceResponse<br>方法 or 属性:setResponseData(data: string \| number);|web.d.ts| +|新增|NA|类名:WebResourceResponse<br>方法or属性:setResponseData(data: string \| number);|web.d.ts| +|新增|NA|模块名: web<br>类名: WebResourceResponse<br>方法 or 属性:setResponseEncoding(encoding: string);|web.d.ts| +|新增|NA|类名:WebResourceResponse<br>方法or属性:setResponseEncoding(encoding: string);|web.d.ts| +|新增|NA|模块名: web<br>类名: WebResourceResponse<br>方法 or 属性:setResponseMimeType(mimeType: string);|web.d.ts| +|新增|NA|类名:WebResourceResponse<br>方法or属性:setResponseMimeType(mimeType: string);|web.d.ts| +|新增|NA|模块名: web<br>类名: WebResourceResponse<br>方法 or 属性:setReasonMessage(reason: string);|web.d.ts| +|新增|NA|类名:WebResourceResponse<br>方法or属性:setReasonMessage(reason: string);|web.d.ts| +|新增|NA|模块名: web<br>类名: WebResourceResponse<br>方法 or 属性:setResponseHeader(header: Array\<Header>);|web.d.ts| +|新增|NA|类名:WebResourceResponse<br>方法or属性:setResponseHeader(header: Array\<Header>);|web.d.ts| +|新增|NA|模块名: web<br>类名: WebResourceResponse<br>方法 or 属性:setResponseCode(code: number);|web.d.ts| +|新增|NA|类名:WebResourceResponse<br>方法or属性:setResponseCode(code: number);|web.d.ts| +|新增|NA|模块名: web<br>类名: WebResourceResponse<br>方法 or 属性:setResponseIsReady(IsReady: boolean);|web.d.ts| +|新增|NA|类名:WebResourceResponse<br>方法or属性:setResponseIsReady(IsReady: boolean);|web.d.ts| +|新增|NA|类名:WebController<br>方法or属性:getCookieManager() : WebCookie|web.d.ts| +|新增|NA|类名:WebOptions<br>方法or属性:controller: WebController \| WebviewController;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:darkMode(mode: WebDarkMode): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:forceDarkAccess(access: boolean): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:textZoomRatio(textZoomRatio: number): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:initialScale(percent: number): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:onPrompt(callback: (event?: {url: string, message: string, value: string, result: JsResult }) => boolean): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:onRenderExited(callback: (event?: { renderExitReason: RenderExitReason }) => void): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:onShowFileSelector(callback: (event?: { result: FileSelectorResult,<br> fileSelector: FileSelectorParam }) => boolean): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:onResourceLoad(callback: (event: {url: string}) => void): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:onFullScreenExit(callback: () => void): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:onFullScreenEnter(callback: (event: { handler: FullScreenExitHandler}) => void): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:onScaleChange(callback: (event: {oldScale: number, newScale: number}) => void): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:onHttpAuthRequest(callback: (event?: { handler: HttpAuthHandler, host: string, realm: string }) => boolean): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:onInterceptRequest(callback: (event?: { request: WebResourceRequest}) => WebResourceResponse): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:onPermissionRequest(callback: (event?: { request: PermissionRequest }) => void): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:onContextMenuShow(callback: (event?: { param: WebContextMenuParam, result: WebContextMenuResult }) => boolean): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:mediaPlayGestureAccess(access: boolean): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:onSearchResultReceive(callback: (event?: {activeMatchOrdinal: number, numberOfMatches: number, isDoneCounting: boolean}) => void): WebAttribute|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:onScroll(callback: (event: {xOffset: number, yOffset: number}) => void): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:onSslErrorEventReceive(callback: (event: { handler: SslErrorHandler, error: SslError }) => void): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:onClientAuthenticationRequest(callback: (event: {handler : ClientAuthenticationHandler, host : string, port : number,<br> keyTypes : Array\<string>, issuers : Array\<string>}) => void): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:onWindowNew(callback: (event: {isAlert: boolean, isUserTrigger: boolean, targetUrl: string,<br> handler: ControllerHandler}) => void): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:onWindowExit(callback: () => void): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:multiWindowAccess(multiWindow: boolean): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:onInterceptKeyEvent(callback: (event: KeyEvent) => boolean): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:webStandardFont(family: string): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:webSerifFont(family: string): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:webSansSerifFont(family: string): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:webFixedFont(family: string): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:webFantasyFont(family: string): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:webCursiveFont(family: string): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:defaultFixedFontSize(size: number): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:defaultFontSize(size: number): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:minFontSize(size: number): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:minLogicalFontSize(size: number): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:blockNetwork(block: boolean): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:horizontalScrollBarAccess(horizontalScrollBar: boolean): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:verticalScrollBarAccess(verticalScrollBar: boolean): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:onTouchIconUrlReceived(callback: (event: {url: string,<br> precomposed: boolean}) => void): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:onFaviconReceived(callback: (event: {favicon: PixelMap}) => void): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:onPageVisible(callback: (event: {url: string}) => void): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:onDataResubmitted(callback: (event: {handler: DataResubmissionHandler}) => void): WebAttribute;|web.d.ts| +|新增|NA|类名:WebAttribute<br>方法or属性:pinchSmooth(isEnabled: boolean): WebAttribute;|web.d.ts| +|新增|NA|模块名: viewmodel<br>类名: OffscreenCanvasRenderingContext2D<br>方法 or 属性: drawImage(image: image.PixelMap, dx: number, dy: number, dw: number, dh: number): void;|viewmodel.d.ts| +|新增|NA|模块名: viewmodel<br>类名: OffscreenCanvasRenderingContext2D<br>方法 or 属性: drawImage(<br> image: image.PixelMap,<br> sx: number,<br> sy: number,<br> sw: number,<br> sh: number,<br> dx: number,<br> dy: number,<br> dw: number,<br> dh: number,<br> ): void;|viewmodel.d.ts| +|新增|NA|模块名: viewmodel<br>类名: OffscreenCanvasRenderingContext2D<br>方法 or 属性: getPixelMap(sx: number, sy: number, sw: number, sh: number): image.PixelMap|viewmodel.d.ts| +|新增|NA|模块名: viewmodel<br>类名: CanvasRenderingContext2D<br>方法 or 属性: drawImage(image: image.PixelMap, dx: number, dy: number, dWidth: number, dHeight: number): void;|viewmodel.d.ts| +|新增|NA|模块名: viewmodel<br>类名: CanvasRenderingContext2D<br>方法 or 属性: drawImage(<br> image: image.PixelMap,<br> sx: number,<br> sy: number,<br> sWidth: number,<br> sHeight: number,<br> dx: number,<br> dy: number,<br> dWidth: number,<br> dHeight: number,<br> ): void;|viewmodel.d.ts| +|新增|NA|模块名: viewmodel<br>类名: CanvasRenderingContext2D<br>方法 or 属性: getPixelMap(sx: number, sy: number, sw: number, sh: number): image.PixelMap|viewmodel.d.ts| +|删除|模块名: canvas<br>类名: CanvasPattern|NA|canvas.d.ts| +|删除|模块名: canvas<br>类名: CanvasPattern<br>方法 or 属性:setTransform(transform?: Matrix2D): void;|NA|canvas.d.ts| +|删除|模块名:canvas<br>类名:CanvasRenderer<br>方法 or 属性:filter(filter: string): void;|NA|canvas.d.ts| +|删除|模块名:canvas<br>类名:CanvasRenderer<br>方法 or 属性:imageSmoothingQuality(quality: ImageSmoothingQuality): void;|NA|canvas.d.ts| +|删除|模块名:canvas<br>类名:CanvasRenderer<br>方法 or 属性:direction(direction: CanvasDirection): void;|NA|canvas.d.ts| +|删除|模块名:common<br>类名:global<br>方法 or 属性:declare const isSystemplugin: (...args: string[]) => any;|NA|common.d.ts| +|删除|模块名: state_management<br>类名: IPropertySubscriber|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: IPropertySubscriber<br>方法 or 属性:id(): number;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: IPropertySubscriber<br>方法 or 属性:aboutToBeDeleted(owningView?: IPropertySubscriber): void;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: ISinglePropertyChangeSubscriber|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: ISinglePropertyChangeSubscriber<br>方法 or 属性:hasChanged(newValue: T): void;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SubscribedAbstractProperty|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SubscribedAbstractProperty<br>方法 or 属性:protected subscribers_: Set\<number>;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SubscribedAbstractProperty<br>方法 or 属性:private id_;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SubscribedAbstractProperty<br>方法 or 属性:private info_?;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SubscribedAbstractProperty<br>方法 or 属性:constructor(<br> /**<br> * Subscriber IPropertySubscriber.<br> * @since 7<br> * @systemapi<br> */<br> subscribeMe?: IPropertySubscriber,<br> /**<br> * Subscriber info.<br> * @since 7<br> * @systemapi<br> */<br> info?: string,<br> );|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SubscribedAbstractProperty<br>方法 or 属性:id(): number;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SubscribedAbstractProperty<br>方法 or 属性:info(): string;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SubscribedAbstractProperty<br>方法 or 属性:abstract get(): T;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SubscribedAbstractProperty<br>方法 or 属性:abstract set(newValue: T): void;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SubscribedAbstractProperty<br>方法 or 属性:createTwoWaySync(subscribeMe?: IPropertySubscriber, info?: string): SyncedPropertyTwoWay\<T>;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SubscribedAbstractProperty<br>方法 or 属性:createOneWaySync(subscribeMe?: IPropertySubscriber, info?: string): SyncedPropertyOneWay\<T>;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SubscribedAbstractProperty<br>方法 or 属性:unlinkSuscriber(subscriberId: number): void;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SubscribedAbstractProperty<br>方法 or 属性:protected notifyHasChanged(newValue: T): void;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SubscribedAbstractProperty<br>方法 or 属性:protected notifyPropertyRead(): void;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SubscribedAbstractProperty<br>方法 or 属性:numberOfSubscrbers(): number;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SyncedPropertyTwoWay|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SyncedPropertyTwoWay<br>方法 or 属性:private source_;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SyncedPropertyTwoWay<br>方法 or 属性:constructor(source: SubscribedAbstractProperty\<T>, subscribeMe?: IPropertySubscriber, info?: string);|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SyncedPropertyTwoWay<br>方法 or 属性:aboutToBeDeleted(unsubscribeMe?: IPropertySubscriber): void;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SyncedPropertyTwoWay<br>方法 or 属性:hasChanged(newValue: T): void;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SyncedPropertyTwoWay<br>方法 or 属性:get(): T;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SyncedPropertyTwoWay<br>方法 or 属性:set(newValue: T): void;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SyncedPropertyOneWay|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SyncedPropertyOneWay<br>方法 or 属性:private wrappedValue_;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SyncedPropertyOneWay<br>方法 or 属性:private source_;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SyncedPropertyOneWay<br>方法 or 属性:constructor(source: SubscribedAbstractProperty\<T>, subscribeMe?: IPropertySubscriber, info?: string);|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SyncedPropertyOneWay<br>方法 or 属性:aboutToBeDeleted(unsubscribeMe?: IPropertySubscriber): void;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SyncedPropertyOneWay<br>方法 or 属性:hasChanged(newValue: T): void;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SyncedPropertyOneWay<br>方法 or 属性:get(): T;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SyncedPropertyOneWay<br>方法 or 属性:set(newValue: T): void;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: AppStorage|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: AppStorage<br>方法 or 属性:static Link(propName: string): any;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: AppStorage<br>方法 or 属性:static SetAndLink\<T>(propName: string, defaultValue: T): SubscribedAbstractProperty\<T>;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: AppStorage<br>方法 or 属性:static Prop(propName: string): any;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: AppStorage<br>方法 or 属性:static SetAndProp\<S>(propName: string, defaultValue: S): SubscribedAbstractProperty\<S>;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: AppStorage<br>方法 or 属性:static Has(propName: string): boolean;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: AppStorage<br>方法 or 属性:static Get\<T>(propName: string): T \| undefined;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: AppStorage<br>方法 or 属性:static Set\<T>(propName: string, newValue: T): boolean;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: AppStorage<br>方法 or 属性:static SetOrCreate\<T>(propName: string, newValue: T): void;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: AppStorage<br>方法 or 属性:static Delete(propName: string): boolean;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: AppStorage<br>方法 or 属性:static Keys(): IterableIterator\<string>;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: AppStorage<br>方法 or 属性:static staticClear(): boolean;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: AppStorage<br>方法 or 属性:static IsMutable(propName: string): boolean;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: AppStorage<br>方法 or 属性:static Size(): number;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: Environment|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: Environment<br>方法 or 属性:constructor();|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: Environment<br>方法 or 属性:static EnvProp\<S>(key: string, value: S): boolean;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: Environment<br>方法 or 属性:static EnvProps(<br> props: {<br> key: string;<br> defaultValue: any;<br> }[],<br> ): void;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: Environment<br>方法 or 属性:static Keys(): Array\<string>;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: PersistentStorage|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: PersistentStorage<br>方法 or 属性:constructor(appStorage: AppStorage, storage: Storage);|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: PersistentStorage<br>方法 or 属性:static PersistProp\<T>(key: string, defaultValue: T): void;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: PersistentStorage<br>方法 or 属性:static DeleteProp(key: string): void;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: PersistentStorage<br>方法 or 属性:static PersistProps(<br> properties: {<br> key: string;<br> defaultValue: any;<br> }[],<br> ): void;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: PersistentStorage<br>方法 or 属性:static Keys(): Array\<string>;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SubscribaleAbstract|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SubscribaleAbstract<br>方法 or 属性:private owningProperties_: Set\<number>;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SubscribaleAbstract<br>方法 or 属性:constructor();|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SubscribaleAbstract<br>方法 or 属性:protected notifyPropertyHasChanged(propName: string, newValue: any): void;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SubscribaleAbstract<br>方法 or 属性:public addOwningProperty(subscriber: IPropertySubscriber): void;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SubscribaleAbstract<br>方法 or 属性:public removeOwningProperty(property: IPropertySubscriber): void;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: SubscribaleAbstract<br>方法 or 属性:public removeOwningPropertyById(subscriberId: number): void;|NA|state_management.d.ts| +|删除|模块名: state_management<br>类名: global<br>方法 or 属性:declare const appStorage: AppStorage;|NA|state_management.d.ts| +|访问级别有变化|类名:<br>方法 or 属性: function getInspectorByKey(id: string): string;<br>访问级别:系统API|类名:<br>方法 or 属性: function getInspectorByKey(id: string): string;<br>访问级别:公开API|global.d.ts| +|访问级别有变化|类名:<br>方法 or 属性: function sendEventByKey(id: string, action: number, params: string): boolean;<br>访问级别:系统API|类名:<br>方法 or 属性: function sendEventByKey(id: string, action: number, params: string): boolean;<br>访问级别:公开API|global.d.ts| +|访问级别有变化|类名:<br>方法 or 属性: function sendTouchEvent(event: TouchObject): boolean;<br>访问级别:系统API|类名:<br>方法 or 属性: function sendTouchEvent(event: TouchObject): boolean;<br>访问级别:公开API|global.d.ts| +|访问级别有变化|类名:<br>方法 or 属性: function sendKeyEvent(event: KeyEvent): boolean;<br>访问级别:系统API|类名:<br>方法 or 属性: function sendKeyEvent(event: KeyEvent): boolean;<br>访问级别:公开API|global.d.ts| +|访问级别有变化|类名:<br>方法 or 属性: function sendMouseEvent(event: MouseEvent): boolean;<br>访问级别:系统API|类名:<br>方法 or 属性: function sendMouseEvent(event: MouseEvent): boolean;<br>访问级别:公开API|global.d.ts| +|访问级别有变化|类名:global<br>方法 or 属性:declare const Animator: AnimatorInterface;<br>访问级别:公开API|类名:global<br>方法 or 属性:declare const Animator: AnimatorInterface;<br>访问级别:系统API|animator.d.ts| +|访问级别有变化|类名:global<br>方法 or 属性:declare const AnimatorInstance: AnimatorAttribute;<br>访问级别:公开API|类名:global<br>方法 or 属性:declare const AnimatorInstance: AnimatorAttribute;<br>访问级别:系统API|animator.d.ts| +|访问级别有变化|类名:global<br>方法 or 属性:declare const Calendar: CalendarInterface;<br>访问级别:公开API|类名:global<br>方法 or 属性:declare const Calendar: CalendarInterface;<br>访问级别:系统API|calendar.d.ts| +|访问级别有变化|类名:global<br>方法 or 属性:declare const CalendarInstance: CalendarAttribute;<br>访问级别:公开API|类名:global<br>方法 or 属性:declare const CalendarInstance: CalendarAttribute;<br>访问级别:系统API|calendar.d.ts| +|访问级别有变化|类名:PreviewParams<br>访问级别:系统API|类名:PreviewParams<br>访问级别:公开API|common.d.ts| +|访问级别有变化|类名:PreviewParams<br>方法 or 属性:title?: string;<br>访问级别:系统API|类名:PreviewParams<br>方法 or 属性:title?: string;<br>访问级别:公开API|common.d.ts| +|访问级别有变化|类名:PreviewParams<br>方法 or 属性:width?: number;<br>访问级别:系统API|类名:PreviewParams<br>方法 or 属性:width?: number;<br>访问级别:公开API|common.d.ts| +|访问级别有变化|类名:PreviewParams<br>方法 or 属性:height?: number;<br>访问级别:系统API|类名:PreviewParams<br>方法 or 属性:height?: number;<br>访问级别:公开API|common.d.ts| +|访问级别有变化|类名:PreviewParams<br>方法 or 属性:locale?: string;<br>访问级别:系统API|类名:PreviewParams<br>方法 or 属性:locale?: string;<br>访问级别:公开API|common.d.ts| +|访问级别有变化|类名:PreviewParams<br>方法 or 属性:colorMode?: string;<br>访问级别:系统API|类名:PreviewParams<br>方法 or 属性:colorMode?: string;<br>访问级别:公开API|common.d.ts| +|访问级别有变化|类名:PreviewParams<br>方法 or 属性:deviceType?: string;<br>访问级别:系统API|类名:PreviewParams<br>方法 or 属性:deviceType?: string;<br>访问级别:公开API|common.d.ts| +|访问级别有变化|类名:PreviewParams<br>方法 or 属性:dpi?: number;<br>访问级别:系统API|类名:PreviewParams<br>方法 or 属性:dpi?: number;<br>访问级别:公开API|common.d.ts| +|访问级别有变化|类名:PreviewParams<br>方法 or 属性:orientation?: string;<br>访问级别:系统API|类名:PreviewParams<br>方法 or 属性:orientation?: string;<br>访问级别:公开API|common.d.ts| +|访问级别有变化|类名:PreviewParams<br>方法 or 属性:roundScreen?: boolean;<br>访问级别:系统API|类名:PreviewParams<br>方法 or 属性:roundScreen?: boolean;<br>访问级别:公开API|common.d.ts| +|访问级别有变化|类名:CommonShapeMethod<br>方法 or 属性:constructor();<br>访问级别:公开API|类名:CommonShapeMethod<br>方法 or 属性:constructor();<br>访问级别:系统API|common.d.ts| +|访问级别有变化|类名:global<br>方法 or 属性:declare const FormComponent: FormComponentInterface;<br>访问级别:公开API|类名:global<br>方法 or 属性:declare const FormComponent: FormComponentInterface;<br>访问级别:系统API|form_component.d.ts| +|访问级别有变化|类名:global<br>方法 or 属性:declare const FormComponentInstance: FormComponentAttribute;<br>访问级别:公开API|类名:global<br>方法 or 属性:declare const FormComponentInstance: FormComponentAttribute;<br>访问级别:系统API|form_component.d.ts| +|废弃版本有变化|类名:AnimatorResult<br>方法 or 属性:update(options: AnimatorOptions): void;<br>废弃版本:N/A|类名:AnimatorResult<br>方法 or 属性:update(options: AnimatorOptions): void;<br>废弃版本:9<br>代替接口:ohos.animator.reset |@ohos.animator.d.ts| +|废弃版本有变化|类名:Animator<br>方法 or 属性:static createAnimator(options: AnimatorOptions): AnimatorResult;<br>废弃版本:N/A|类名:Animator<br>方法 or 属性:static createAnimator(options: AnimatorOptions): AnimatorResult;<br>废弃版本:9<br>代替接口:ohos.animator.create |@ohos.animator.d.ts| +|废弃版本有变化|类名:curves<br>方法 or 属性:function init(curve?: Curve): string;<br>废弃版本:N/A|类名:curves<br>方法 or 属性:function init(curve?: Curve): string;<br>废弃版本:9<br>代替接口:initCurve |@ohos.curves.d.ts| +|废弃版本有变化|类名:curves<br>方法 or 属性:function steps(count: number, end: boolean): string;<br>废弃版本:N/A|类名:curves<br>方法 or 属性:function steps(count: number, end: boolean): string;<br>废弃版本:9<br>代替接口:stepsCurve |@ohos.curves.d.ts| +|废弃版本有变化|类名:curves<br>方法 or 属性:function cubicBezier(x1: number, y1: number, x2: number, y2: number): string;<br>废弃版本:N/A|类名:curves<br>方法 or 属性:function cubicBezier(x1: number, y1: number, x2: number, y2: number): string;<br>废弃版本:9<br>代替接口:cubicBezierCurve |@ohos.curves.d.ts| +|废弃版本有变化|类名:curves<br>方法 or 属性:function spring(velocity: number, mass: number, stiffness: number, damping: number): string;<br>废弃版本:N/A|类名:curves<br>方法 or 属性:function spring(velocity: number, mass: number, stiffness: number, damping: number): string;<br>废弃版本:9<br>代替接口:springCurve |@ohos.curves.d.ts| +|废弃版本有变化|类名:prompt<br>废弃版本:N/A|类名:prompt<br>废弃版本:9<br>代替接口:ohos.promptAction |@ohos.prompt.d.ts| +|废弃版本有变化|类名:router<br>方法 or 属性:function push(options: RouterOptions):void;<br>废弃版本:N/A|类名:router<br>方法 or 属性:function push(options: RouterOptions):void;<br>废弃版本:9<br>代替接口:ohos.router.router|@ohos.router.d.ts| +|废弃版本有变化|类名:router<br>方法 or 属性:function replace(options: RouterOptions):void;<br>废弃版本:N/A|类名:router<br>方法 or 属性:function replace(options: RouterOptions):void;<br>废弃版本:9<br>代替接口:ohos.router.router|@ohos.router.d.ts| +|废弃版本有变化|类名:router<br>方法 or 属性:function enableAlertBeforeBackPage(options: EnableAlertOptions):void;<br>废弃版本:N/A|类名:router<br>方法 or 属性:function enableAlertBeforeBackPage(options: EnableAlertOptions):void;<br>废弃版本:9<br>代替接口:ohos.router.router|@ohos.router.d.ts| +|废弃版本有变化|类名:router<br>方法 or 属性:function disableAlertBeforeBackPage():void;<br>废弃版本:N/A|类名:router<br>方法 or 属性:function disableAlertBeforeBackPage():void;<br>废弃版本:9<br>代替接口:ohos.router.router|@ohos.router.d.ts| +|废弃版本有变化|类名:CommonMethod<br>方法 or 属性:touchable(value: boolean): T;<br>废弃版本:N/A|类名:CommonMethod<br>方法 or 属性:touchable(value: boolean): T;<br>废弃版本:9<br>代替接口:hitTestBehavior |common.d.ts| +|废弃版本有变化|类名:Edge<br>方法 or 属性:Center<br>废弃版本:N/A|类名:Edge<br>方法 or 属性:Center<br>废弃版本:9<br>代替接口:N/A|enums.d.ts| +|废弃版本有变化|类名:Edge<br>方法 or 属性:Baseline<br>废弃版本:N/A|类名:Edge<br>方法 or 属性:Baseline<br>废弃版本:9<br>代替接口:N/A|enums.d.ts| +|废弃版本有变化|类名:Edge<br>方法 or 属性:Middle<br>废弃版本:N/A|类名:Edge<br>方法 or 属性:Middle<br>废弃版本:9<br>代替接口:N/A|enums.d.ts| +|废弃版本有变化|类名:GridItemAttribute<br>方法 or 属性:forceRebuild(value: boolean): GridItemAttribute;<br>废弃版本:N/A|类名:GridItemAttribute<br>方法 or 属性:forceRebuild(value: boolean): GridItemAttribute;<br>废弃版本:9<br>代替接口:N/A|gridItem.d.ts| +|废弃版本有变化|类名:global<br>方法 or 属性:declare const GridContainer: GridContainerInterface<br>废弃版本:N/A|类名:global<br>方法 or 属性:declare const GridContainer: GridContainerInterface<br>废弃版本:9<br>代替接口:grid_col/|grid_container.d.ts| +|废弃版本有变化|类名:global<br>方法 or 属性:declare const GridContainerInstance: GridContainerAttribute;<br>废弃版本:N/A|类名:global<br>方法 or 属性:declare const GridContainerInstance: GridContainerAttribute;<br>废弃版本:9<br>代替接口:grid_col/|grid_container.d.ts| +|废弃版本有变化|类名:ImageAnimatorAttribute<br>方法 or 属性:preDecode(value: number): ImageAnimatorAttribute;<br>废弃版本:N/A|类名:ImageAnimatorAttribute<br>方法 or 属性:preDecode(value: number): ImageAnimatorAttribute;<br>废弃版本:9<br>代替接口:N/A|image_animator.d.ts| +|废弃版本有变化|类名:ListAttribute<br>方法 or 属性:editMode(value: boolean): ListAttribute;<br>废弃版本:N/A|类名:ListAttribute<br>方法 or 属性:editMode(value: boolean): ListAttribute;<br>废弃版本:9<br>代替接口:N/A|list.d.ts| +|废弃版本有变化|类名:ListAttribute<br>方法 or 属性:onItemDelete(event: (index: number) => boolean): ListAttribute;<br>废弃版本:N/A|类名:ListAttribute<br>方法 or 属性:onItemDelete(event: (index: number) => boolean): ListAttribute;<br>废弃版本:9<br>代替接口:N/A|list.d.ts| +|废弃版本有变化|类名:EditMode<br>废弃版本:N/A|类名:EditMode<br>废弃版本:9<br>代替接口:N/A|list_item.d.ts| +|废弃版本有变化|类名:ListItemAttribute<br>方法 or 属性:editable(value: boolean \| EditMode): ListItemAttribute;<br>废弃版本:N/A|类名:ListItemAttribute<br>方法 or 属性:editable(value: boolean \| EditMode): ListItemAttribute;<br>废弃版本:9<br>代替接口:N/A|list_item.d.ts| +|废弃版本有变化|类名:NavigationAttribute<br>方法 or 属性:subTitle(value: string): NavigationAttribute;<br>废弃版本:N/A|类名:NavigationAttribute<br>方法 or 属性:subTitle(value: string): NavigationAttribute;<br>废弃版本:9<br>代替接口:title |navigation.d.ts| +|废弃版本有变化|类名:global<br>方法 or 属性:declare const RectInStance: RectAttribute;<br>废弃版本:N/A|类名:global<br>方法 or 属性:declare const RectInStance: RectAttribute;<br>废弃版本:9<br>代替接口:N/A|rect.d.ts| +|废弃版本有变化|类名:ScrollDirection<br>方法 or 属性:Free<br>废弃版本:N/A|类名:ScrollDirection<br>方法 or 属性:Free<br>废弃版本:9<br>代替接口:N/A|scroll.d.ts| +|废弃版本有变化|类名:Scroller<br>方法 or 属性:scrollPage(value: { next: boolean; direction?: Axis });<br>废弃版本:N/A|类名:Scroller<br>方法 or 属性:scrollPage(value: { next: boolean; direction?: Axis });<br>废弃版本:9<br>代替接口:N/A|scroll.d.ts| +|废弃版本有变化|类名:ScrollAttribute<br>方法 or 属性:onScrollEnd(event: () => void): ScrollAttribute;<br>废弃版本:N/A|类名:ScrollAttribute<br>方法 or 属性:onScrollEnd(event: () => void): ScrollAttribute;<br>废弃版本:9<br>代替接口:scroll/Scroll|scroll.d.ts| +|废弃版本有变化|类名:SliderAttribute<br>方法 or 属性:minLabel(value: string): SliderAttribute;<br>废弃版本:N/A|类名:SliderAttribute<br>方法 or 属性:minLabel(value: string): SliderAttribute;<br>废弃版本:9<br>代替接口:min |slider.d.ts| +|废弃版本有变化|类名:SliderAttribute<br>方法 or 属性:maxLabel(value: string): SliderAttribute;<br>废弃版本:N/A|类名:SliderAttribute<br>方法 or 属性:maxLabel(value: string): SliderAttribute;<br>废弃版本:9<br>代替接口:max |slider.d.ts| +|废弃版本有变化|类名:ConsoleMessage<br>方法 or 属性:constructor(message: string, sourceId: string, lineNumber: number, messageLevel: MessageLevel);<br>废弃版本:N/A|类名:ConsoleMessage<br>方法 or 属性:constructor(message: string, sourceId: string, lineNumber: number, messageLevel: MessageLevel);<br>废弃版本:9<br>代替接口:ohos.web.ConsoleMessage|web.d.ts| +|废弃版本有变化|类名:WebCookie<br>方法 or 属性:setCookie();<br>废弃版本:N/A|类名:WebCookie<br>方法 or 属性:setCookie();<br>废弃版本:9<br>代替接口:ohos.web.webview.webview.WebCookieManager|web.d.ts| +|废弃版本有变化|类名:WebCookie<br>方法 or 属性:saveCookie();<br>废弃版本:N/A|类名:WebCookie<br>方法 or 属性:saveCookie();<br>废弃版本:9<br>代替接口:ohos.web.webview.webview.WebCookieManager|web.d.ts| +|废弃版本有变化|类名:WebController<br>废弃版本:N/A|类名:WebController<br>废弃版本:9<br>代替接口:ohos.web.webview.webview.WebviewController |web.d.ts| +|废弃版本有变化|类名:WebController<br>方法 or 属性:constructor();<br>废弃版本:N/A|类名:WebController<br>方法 or 属性:constructor();<br>废弃版本:9<br>代替接口:N/A|web.d.ts| +|废弃版本有变化|类名:WebController<br>方法 or 属性:onInactive(): void;<br>废弃版本:N/A|类名:WebController<br>方法 or 属性:onInactive(): void;<br>废弃版本:9<br>代替接口:ohos.web.webview.webview.WebviewController|web.d.ts| +|废弃版本有变化|类名:WebController<br>方法 or 属性:onActive(): void;<br>废弃版本:N/A|类名:WebController<br>方法 or 属性:onActive(): void;<br>废弃版本:9<br>代替接口:ohos.web.webview.webview.WebviewController|web.d.ts| +|废弃版本有变化|类名:WebController<br>方法 or 属性:zoom(factor: number): void;<br>废弃版本:N/A|类名:WebController<br>方法 or 属性:zoom(factor: number): void;<br>废弃版本:9<br>代替接口:ohos.web.webview.webview.WebviewController|web.d.ts| +|废弃版本有变化|类名:WebController<br>方法 or 属性:clearHistory(): void;<br>废弃版本:N/A|类名:WebController<br>方法 or 属性:clearHistory(): void;<br>废弃版本:9<br>代替接口:ohos.web.webview.webview.WebviewController|web.d.ts| +|废弃版本有变化|类名:WebController<br>方法 or 属性:runJavaScript(options: { script: string, callback?: (result: string) => void });<br>废弃版本:N/A|类名:WebController<br>方法 or 属性:runJavaScript(options: { script: string, callback?: (result: string) => void });<br>废弃版本:9<br>代替接口:ohos.web.webview.webview.WebviewController|web.d.ts| +|废弃版本有变化|类名:WebController<br>方法 or 属性:loadData(options: { data: string, mimeType: string, encoding: string, baseUrl?: string, historyUrl?: string });<br>废弃版本:N/A|类名:WebController<br>方法 or 属性:loadData(options: { data: string, mimeType: string, encoding: string, baseUrl?: string, historyUrl?: string });<br>废弃版本:9<br>代替接口:ohos.web.webview.webview.WebviewController|web.d.ts| +|废弃版本有变化|类名:WebController<br>方法 or 属性:loadUrl(options: { url: string \| Resource, headers?: Array\<Header> });<br>废弃版本:N/A|类名:WebController<br>方法 or 属性:loadUrl(options: { url: string \| Resource, headers?: Array\<Header> });<br>废弃版本:9<br>代替接口:ohos.web.webview.webview.WebviewController|web.d.ts| +|废弃版本有变化|类名:WebController<br>方法 or 属性:refresh();<br>废弃版本:N/A|类名:WebController<br>方法 or 属性:refresh();<br>废弃版本:9<br>代替接口:ohos.web.webview.webview.WebviewController|web.d.ts| +|废弃版本有变化|类名:WebController<br>方法 or 属性:stop();<br>废弃版本:N/A|类名:WebController<br>方法 or 属性:stop();<br>废弃版本:9<br>代替接口:ohos.web.webview.webview.WebviewController|web.d.ts| +|废弃版本有变化|类名:WebController<br>方法 or 属性:registerJavaScriptProxy(options: { object: object, name: string, methodList: Array\<string> });<br>废弃版本:N/A|类名:WebController<br>方法 or 属性:registerJavaScriptProxy(options: { object: object, name: string, methodList: Array\<string> });<br>废弃版本:9<br>代替接口:ohos.web.webview.webview.WebviewController|web.d.ts| +|废弃版本有变化|类名:WebController<br>方法 or 属性:deleteJavaScriptRegister(name: string);<br>废弃版本:N/A|类名:WebController<br>方法 or 属性:deleteJavaScriptRegister(name: string);<br>废弃版本:9<br>代替接口:ohos.web.webview.webview.WebviewController|web.d.ts| +|废弃版本有变化|类名:WebController<br>方法 or 属性:getHitTest(): HitTestType;<br>废弃版本:N/A|类名:WebController<br>方法 or 属性:getHitTest(): HitTestType;<br>废弃版本:9<br>代替接口:ohos.web.webview.webview.WebviewController|web.d.ts| +|废弃版本有变化|类名:WebController<br>方法 or 属性:requestFocus();<br>废弃版本:N/A|类名:WebController<br>方法 or 属性:requestFocus();<br>废弃版本:9<br>代替接口:ohos.web.webview.webview.WebviewController|web.d.ts| +|废弃版本有变化|类名:WebController<br>方法 or 属性:accessBackward(): boolean;<br>废弃版本:N/A|类名:WebController<br>方法 or 属性:accessBackward(): boolean;<br>废弃版本:9<br>代替接口:ohos.web.webview.webview.WebviewController|web.d.ts| +|废弃版本有变化|类名:WebController<br>方法 or 属性:accessForward(): boolean;<br>废弃版本:N/A|类名:WebController<br>方法 or 属性:accessForward(): boolean;<br>废弃版本:9<br>代替接口:ohos.web.webview.webview.WebviewController|web.d.ts| +|废弃版本有变化|类名:WebController<br>方法 or 属性:accessStep(step: number): boolean;<br>废弃版本:N/A|类名:WebController<br>方法 or 属性:accessStep(step: number): boolean;<br>废弃版本:9<br>代替接口:ohos.web.webview.webview.WebviewController|web.d.ts| +|废弃版本有变化|类名:WebController<br>方法 or 属性:backward();<br>废弃版本:N/A|类名:WebController<br>方法 or 属性:backward();<br>废弃版本:9<br>代替接口:ohos.web.webview.webview.WebviewController|web.d.ts| +|废弃版本有变化|类名:WebController<br>方法 or 属性:forward();<br>废弃版本:N/A|类名:WebController<br>方法 or 属性:forward();<br>废弃版本:9<br>代替接口:ohos.web.webview.webview.WebviewController|web.d.ts| +|废弃版本有变化|类名:WebAttribute<br>方法 or 属性:textZoomAtio(textZoomAtio: number): WebAttribute;<br>废弃版本:N/A|类名:WebAttribute<br>方法 or 属性:textZoomAtio(textZoomAtio: number): WebAttribute;<br>废弃版本:9<br>代替接口:ohos.web.WebAttribute|web.d.ts| +|废弃版本有变化|类名:WebAttribute<br>方法 or 属性:onSslErrorReceive(callback: (event?: { handler: Function, error: object }) => void): WebAttribute;<br>废弃版本:N/A|类名:WebAttribute<br>方法 or 属性:onSslErrorReceive(callback: (event?: { handler: Function, error: object }) => void): WebAttribute;<br>废弃版本:9<br>代替接口:ohos.web.WebAttribute|web.d.ts| +|废弃版本有变化|类名:WebAttribute<br>方法 or 属性:onRenderExited(callback: (event?: { detail: object }) => boolean): WebAttribute;<br>废弃版本:N/A|类名:WebAttribute<br>方法 or 属性:onRenderExited(callback: (event?: { detail: object }) => boolean): WebAttribute;<br>废弃版本:9<br>代替接口:ohos.web.WebAttribute|web.d.ts| +|废弃版本有变化|类名:WebAttribute<br>方法 or 属性:onFileSelectorShow(callback: (event?: { callback: Function, fileSelector: object }) => void): WebAttribute;<br>废弃版本:N/A|类名:WebAttribute<br>方法 or 属性:onFileSelectorShow(callback: (event?: { callback: Function, fileSelector: object }) => void): WebAttribute;<br>废弃版本:9<br>代替接口:ohos.web.WebAttribute|web.d.ts| +|起始版本有变化|类名:console<br>起始版本:7|类名:console<br>起始版本:9|global.d.ts| +|起始版本有变化|类名:console<br>方法 or 属性:static debug(message: string, ...arguments: any[]): void;<br>起始版本:7|类名:console<br>方法 or 属性:static debug(message: string, ...arguments: any[]): void;<br>起始版本:9|global.d.ts| +|起始版本有变化|类名:console<br>方法 or 属性:static log(message: string, ...arguments: any[]): void;<br>起始版本:7|类名:console<br>方法 or 属性:static log(message: string, ...arguments: any[]): void;<br>起始版本:9|global.d.ts| +|起始版本有变化|类名:console<br>方法 or 属性:static info(message: string, ...arguments: any[]): void;<br>起始版本:7|类名:console<br>方法 or 属性:static info(message: string, ...arguments: any[]): void;<br>起始版本:9|global.d.ts| +|起始版本有变化|类名:console<br>方法 or 属性:static warn(message: string, ...arguments: any[]): void;<br>起始版本:7|类名:console<br>方法 or 属性:static warn(message: string, ...arguments: any[]): void;<br>起始版本:9|global.d.ts| +|起始版本有变化|类名:console<br>方法 or 属性:static error(message: string, ...arguments: any[]): void;<br>起始版本:7|类名:console<br>方法 or 属性:static error(message: string, ...arguments: any[]): void;<br>起始版本:9|global.d.ts| +|起始版本有变化|类名:<br>方法 or 属性: function getInspectorByKey(id: string): string;<br>起始版本:8|类名:<br>方法 or 属性: function getInspectorByKey(id: string): string;<br>起始版本:9|global.d.ts| +|起始版本有变化|类名:<br>方法 or 属性: function sendEventByKey(id: string, action: number, params: string): boolean;<br>起始版本:8|类名:<br>方法 or 属性: function sendEventByKey(id: string, action: number, params: string): boolean;<br>起始版本:9|global.d.ts| +|起始版本有变化|类名:<br>方法 or 属性: function sendTouchEvent(event: TouchObject): boolean;<br>起始版本:8|类名:<br>方法 or 属性: function sendTouchEvent(event: TouchObject): boolean;<br>起始版本:9|global.d.ts| +|起始版本有变化|类名:<br>方法 or 属性: function sendKeyEvent(event: KeyEvent): boolean;<br>起始版本:8|类名:<br>方法 or 属性: function sendKeyEvent(event: KeyEvent): boolean;<br>起始版本:9|global.d.ts| +|起始版本有变化|类名:<br>方法 or 属性: function sendMouseEvent(event: MouseEvent): boolean;<br>起始版本:8|类名:<br>方法 or 属性: function sendMouseEvent(event: MouseEvent): boolean;<br>起始版本:9|global.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const AlphabetIndexer: AlphabetIndexerInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const AlphabetIndexer: AlphabetIndexerInterface;<br>起始版本:7|alphabet_indexer.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const AlphabetIndexerInstance: AlphabetIndexerAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const AlphabetIndexerInstance: AlphabetIndexerAttribute;<br>起始版本:7|alphabet_indexer.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Animator: AnimatorInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Animator: AnimatorInterface;<br>起始版本:7|animator.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const AnimatorInstance: AnimatorAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const AnimatorInstance: AnimatorAttribute;<br>起始版本:7|animator.d.ts| +|起始版本有变化|类名:BadgePosition<br>起始版本:7|类名:BadgePosition<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgePosition<br>方法 or 属性:RightTop<br>起始版本:7|类名:BadgePosition<br>方法 or 属性:RightTop<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgePosition<br>方法 or 属性:Right<br>起始版本:7|类名:BadgePosition<br>方法 or 属性:Right<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgePosition<br>方法 or 属性:Left<br>起始版本:7|类名:BadgePosition<br>方法 or 属性:Left<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeStyle<br>起始版本:7|类名:BadgeStyle<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeStyle<br>方法 or 属性:color?: ResourceColor;<br>起始版本:7|类名:BadgeStyle<br>方法 or 属性:color?: ResourceColor;<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeStyle<br>方法 or 属性:fontSize?: number \| string;<br>起始版本:7|类名:BadgeStyle<br>方法 or 属性:fontSize?: number \| string;<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeStyle<br>方法 or 属性:badgeSize?: number \| string;<br>起始版本:7|类名:BadgeStyle<br>方法 or 属性:badgeSize?: number \| string;<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeStyle<br>方法 or 属性:badgeColor?: ResourceColor;<br>起始版本:7|类名:BadgeStyle<br>方法 or 属性:badgeColor?: ResourceColor;<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeParam<br>起始版本:7|类名:BadgeParam<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeParam<br>方法 or 属性:position?: BadgePosition;<br>起始版本:7|类名:BadgeParam<br>方法 or 属性:position?: BadgePosition;<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeParam<br>方法 or 属性:style: BadgeStyle;<br>起始版本:7|类名:BadgeParam<br>方法 or 属性:style: BadgeStyle;<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeParamWithNumber<br>起始版本:7|类名:BadgeParamWithNumber<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeParamWithNumber<br>方法 or 属性:count: number;<br>起始版本:7|类名:BadgeParamWithNumber<br>方法 or 属性:count: number;<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeParamWithNumber<br>方法 or 属性:maxCount?: number;<br>起始版本:7|类名:BadgeParamWithNumber<br>方法 or 属性:maxCount?: number;<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeParamWithString<br>起始版本:7|类名:BadgeParamWithString<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeParamWithString<br>方法 or 属性:value: string;<br>起始版本:7|类名:BadgeParamWithString<br>方法 or 属性:value: string;<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeInterface<br>起始版本:7|类名:BadgeInterface<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeInterface<br>方法 or 属性:(value: BadgeParamWithNumber): BadgeAttribute;<br>起始版本:7|类名:BadgeInterface<br>方法 or 属性:(value: BadgeParamWithNumber): BadgeAttribute;<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeInterface<br>方法 or 属性:(value: BadgeParamWithString): BadgeAttribute;<br>起始版本:7|类名:BadgeInterface<br>方法 or 属性:(value: BadgeParamWithString): BadgeAttribute;<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BadgeAttribute<br>起始版本:7|类名:BadgeAttribute<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Badge: BadgeInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Badge: BadgeInterface;<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const BadgeInstance: BadgeAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const BadgeInstance: BadgeAttribute;<br>起始版本:9|badge.d.ts| +|起始版本有变化|类名:BlankInterface<br>起始版本:7|类名:BlankInterface<br>起始版本:9|blank.d.ts| +|起始版本有变化|类名:BlankInterface<br>方法 or 属性:(min?: number \| string): BlankAttribute;<br>起始版本:7|类名:BlankInterface<br>方法 or 属性:(min?: number \| string): BlankAttribute;<br>起始版本:9|blank.d.ts| +|起始版本有变化|类名:BlankAttribute<br>起始版本:7|类名:BlankAttribute<br>起始版本:9|blank.d.ts| +|起始版本有变化|类名:BlankAttribute<br>方法 or 属性:color(value: ResourceColor): BlankAttribute;<br>起始版本:7|类名:BlankAttribute<br>方法 or 属性:color(value: ResourceColor): BlankAttribute;<br>起始版本:9|blank.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Blank: BlankInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Blank: BlankInterface;<br>起始版本:9|blank.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const BlankInstance: BlankAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const BlankInstance: BlankAttribute;<br>起始版本:9|blank.d.ts| +|起始版本有变化|类名:ButtonType<br>起始版本:7|类名:ButtonType<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonType<br>方法 or 属性:Capsule<br>起始版本:7|类名:ButtonType<br>方法 or 属性:Capsule<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonType<br>方法 or 属性:Circle<br>起始版本:7|类名:ButtonType<br>方法 or 属性:Circle<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonType<br>方法 or 属性:Normal<br>起始版本:7|类名:ButtonType<br>方法 or 属性:Normal<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonOptions<br>起始版本:7|类名:ButtonOptions<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonOptions<br>方法 or 属性:type?: ButtonType;<br>起始版本:7|类名:ButtonOptions<br>方法 or 属性:type?: ButtonType;<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonOptions<br>方法 or 属性:stateEffect?: boolean;<br>起始版本:7|类名:ButtonOptions<br>方法 or 属性:stateEffect?: boolean;<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonInterface<br>起始版本:7|类名:ButtonInterface<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonInterface<br>方法 or 属性:(): ButtonAttribute;<br>起始版本:7|类名:ButtonInterface<br>方法 or 属性:(): ButtonAttribute;<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonInterface<br>方法 or 属性:(options: ButtonOptions): ButtonAttribute;<br>起始版本:7|类名:ButtonInterface<br>方法 or 属性:(options: ButtonOptions): ButtonAttribute;<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonInterface<br>方法 or 属性:(label: ResourceStr, options?: ButtonOptions): ButtonAttribute;<br>起始版本:7|类名:ButtonInterface<br>方法 or 属性:(label: ResourceStr, options?: ButtonOptions): ButtonAttribute;<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonAttribute<br>起始版本:7|类名:ButtonAttribute<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonAttribute<br>方法 or 属性:type(value: ButtonType): ButtonAttribute;<br>起始版本:7|类名:ButtonAttribute<br>方法 or 属性:type(value: ButtonType): ButtonAttribute;<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonAttribute<br>方法 or 属性:stateEffect(value: boolean): ButtonAttribute;<br>起始版本:7|类名:ButtonAttribute<br>方法 or 属性:stateEffect(value: boolean): ButtonAttribute;<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonAttribute<br>方法 or 属性:fontColor(value: ResourceColor): ButtonAttribute;<br>起始版本:7|类名:ButtonAttribute<br>方法 or 属性:fontColor(value: ResourceColor): ButtonAttribute;<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonAttribute<br>方法 or 属性:fontSize(value: Length): ButtonAttribute;<br>起始版本:7|类名:ButtonAttribute<br>方法 or 属性:fontSize(value: Length): ButtonAttribute;<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonAttribute<br>方法 or 属性:fontWeight(value: number \| FontWeight \| string): ButtonAttribute;<br>起始版本:7|类名:ButtonAttribute<br>方法 or 属性:fontWeight(value: number \| FontWeight \| string): ButtonAttribute;<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonAttribute<br>方法 or 属性:fontStyle(value: FontStyle): ButtonAttribute;<br>起始版本:8|类名:ButtonAttribute<br>方法 or 属性:fontStyle(value: FontStyle): ButtonAttribute;<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:ButtonAttribute<br>方法 or 属性:fontFamily(value: string \| Resource): ButtonAttribute;<br>起始版本:8|类名:ButtonAttribute<br>方法 or 属性:fontFamily(value: string \| Resource): ButtonAttribute;<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Button: ButtonInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Button: ButtonInterface;<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ButtonInstance: ButtonAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ButtonInstance: ButtonAttribute;<br>起始版本:9|button.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Calendar: CalendarInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Calendar: CalendarInterface;<br>起始版本:7|calendar.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const CalendarInstance: CalendarAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const CalendarInstance: CalendarAttribute;<br>起始版本:7|calendar.d.ts| +|起始版本有变化|类名:CanvasGradient<br>起始版本:8|类名:CanvasGradient<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasGradient<br>方法 or 属性:addColorStop(offset: number, color: string): void;<br>起始版本:8|类名:CanvasGradient<br>方法 or 属性:addColorStop(offset: number, color: string): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasPath<br>起始版本:8|类名:CanvasPath<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasPath<br>方法 or 属性:arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void;<br>起始版本:8|类名:CanvasPath<br>方法 or 属性:arc(x: number, y: number, radius: number, startAngle: number, endAngle: number, counterclockwise?: boolean): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasPath<br>方法 or 属性:arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;<br>起始版本:8|类名:CanvasPath<br>方法 or 属性:arcTo(x1: number, y1: number, x2: number, y2: number, radius: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasPath<br>方法 or 属性:bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void;<br>起始版本:8|类名:CanvasPath<br>方法 or 属性:bezierCurveTo(cp1x: number, cp1y: number, cp2x: number, cp2y: number, x: number, y: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasPath<br>方法 or 属性:closePath(): void;<br>起始版本:8|类名:CanvasPath<br>方法 or 属性:closePath(): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasPath<br>方法 or 属性:ellipse(<br> x: number,<br> y: number,<br> radiusX: number,<br> radiusY: number,<br> rotation: number,<br> startAngle: number,<br> endAngle: number,<br> counterclockwise?: boolean,<br> ): void;<br>起始版本:8|类名:CanvasPath<br>方法 or 属性:ellipse(<br> x: number,<br> y: number,<br> radiusX: number,<br> radiusY: number,<br> rotation: number,<br> startAngle: number,<br> endAngle: number,<br> counterclockwise?: boolean,<br> ): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasPath<br>方法 or 属性:lineTo(x: number, y: number): void;<br>起始版本:8|类名:CanvasPath<br>方法 or 属性:lineTo(x: number, y: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasPath<br>方法 or 属性:moveTo(x: number, y: number): void;<br>起始版本:8|类名:CanvasPath<br>方法 or 属性:moveTo(x: number, y: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasPath<br>方法 or 属性:quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;<br>起始版本:8|类名:CanvasPath<br>方法 or 属性:quadraticCurveTo(cpx: number, cpy: number, x: number, y: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasPath<br>方法 or 属性:rect(x: number, y: number, w: number, h: number): void;<br>起始版本:8|类名:CanvasPath<br>方法 or 属性:rect(x: number, y: number, w: number, h: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:Path2D<br>起始版本:8|类名:Path2D<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:Path2D<br>方法 or 属性:addPath(path: Path2D, transform?: Matrix2D): void;<br>起始版本:8|类名:Path2D<br>方法 or 属性:addPath(path: Path2D, transform?: Matrix2D): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:Path2D<br>方法 or 属性:constructor();<br>起始版本:8|类名:Path2D<br>方法 or 属性:constructor();<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:Path2D<br>方法 or 属性:constructor(path: Path2D);<br>起始版本:8|类名:Path2D<br>方法 or 属性:constructor(path: Path2D);<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:Path2D<br>方法 or 属性:constructor(d: string);<br>起始版本:8|类名:Path2D<br>方法 or 属性:constructor(d: string);<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:TextMetrics<br>起始版本:8|类名:TextMetrics<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:TextMetrics<br>方法 or 属性:readonly actualBoundingBoxAscent: number;<br>起始版本:8|类名:TextMetrics<br>方法 or 属性:readonly actualBoundingBoxAscent: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:TextMetrics<br>方法 or 属性:readonly actualBoundingBoxDescent: number;<br>起始版本:8|类名:TextMetrics<br>方法 or 属性:readonly actualBoundingBoxDescent: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:TextMetrics<br>方法 or 属性:readonly actualBoundingBoxLeft: number;<br>起始版本:8|类名:TextMetrics<br>方法 or 属性:readonly actualBoundingBoxLeft: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:TextMetrics<br>方法 or 属性:readonly actualBoundingBoxRight: number;<br>起始版本:8|类名:TextMetrics<br>方法 or 属性:readonly actualBoundingBoxRight: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:TextMetrics<br>方法 or 属性:readonly alphabeticBaseline: number;<br>起始版本:8|类名:TextMetrics<br>方法 or 属性:readonly alphabeticBaseline: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:TextMetrics<br>方法 or 属性:readonly emHeightAscent: number;<br>起始版本:8|类名:TextMetrics<br>方法 or 属性:readonly emHeightAscent: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:TextMetrics<br>方法 or 属性:readonly emHeightDescent: number;<br>起始版本:8|类名:TextMetrics<br>方法 or 属性:readonly emHeightDescent: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:TextMetrics<br>方法 or 属性:readonly fontBoundingBoxAscent: number;<br>起始版本:8|类名:TextMetrics<br>方法 or 属性:readonly fontBoundingBoxAscent: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:TextMetrics<br>方法 or 属性:readonly fontBoundingBoxDescent: number;<br>起始版本:8|类名:TextMetrics<br>方法 or 属性:readonly fontBoundingBoxDescent: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:TextMetrics<br>方法 or 属性:readonly hangingBaseline: number;<br>起始版本:8|类名:TextMetrics<br>方法 or 属性:readonly hangingBaseline: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:TextMetrics<br>方法 or 属性:readonly ideographicBaseline: number;<br>起始版本:8|类名:TextMetrics<br>方法 or 属性:readonly ideographicBaseline: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:TextMetrics<br>方法 or 属性:readonly width: number;<br>起始版本:8|类名:TextMetrics<br>方法 or 属性:readonly width: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:TextMetrics<br>方法 or 属性:readonly height: number;<br>起始版本:8|类名:TextMetrics<br>方法 or 属性:readonly height: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:ImageBitmap<br>起始版本:8|类名:ImageBitmap<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:ImageBitmap<br>方法 or 属性:readonly height: number;<br>起始版本:8|类名:ImageBitmap<br>方法 or 属性:readonly height: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:ImageBitmap<br>方法 or 属性:readonly width: number;<br>起始版本:8|类名:ImageBitmap<br>方法 or 属性:readonly width: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:ImageBitmap<br>方法 or 属性:close(): void;<br>起始版本:8|类名:ImageBitmap<br>方法 or 属性:close(): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:ImageBitmap<br>方法 or 属性:constructor(src: string);<br>起始版本:8|类名:ImageBitmap<br>方法 or 属性:constructor(src: string);<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:ImageData<br>起始版本:8|类名:ImageData<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:ImageData<br>方法 or 属性:readonly data: Uint8ClampedArray;<br>起始版本:8|类名:ImageData<br>方法 or 属性:readonly data: Uint8ClampedArray;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:ImageData<br>方法 or 属性:readonly height: number;<br>起始版本:8|类名:ImageData<br>方法 or 属性:readonly height: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:ImageData<br>方法 or 属性:readonly width: number;<br>起始版本:8|类名:ImageData<br>方法 or 属性:readonly width: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:ImageData<br>方法 or 属性:constructor(width: number, height: number, data?: Uint8ClampedArray);<br>起始版本:8|类名:ImageData<br>方法 or 属性:constructor(width: number, height: number, data?: Uint8ClampedArray);<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:RenderingContextSettings<br>起始版本:8|类名:RenderingContextSettings<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:RenderingContextSettings<br>方法 or 属性:antialias?: boolean;<br>起始版本:8|类名:RenderingContextSettings<br>方法 or 属性:antialias?: boolean;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:RenderingContextSettings<br>方法 or 属性:constructor(antialias?: boolean);<br>起始版本:8|类名:RenderingContextSettings<br>方法 or 属性:constructor(antialias?: boolean);<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>起始版本:8|类名:CanvasRenderer<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:globalAlpha: number;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:globalAlpha: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:globalCompositeOperation: string;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:globalCompositeOperation: string;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:drawImage(image: ImageBitmap \| PixelMap, dx: number, dy: number): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:drawImage(image: ImageBitmap \| PixelMap, dx: number, dy: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:drawImage(image: ImageBitmap \| PixelMap, dx: number, dy: number, dw: number, dh: number): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:drawImage(image: ImageBitmap \| PixelMap, dx: number, dy: number, dw: number, dh: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:drawImage(<br> image: ImageBitmap \| PixelMap,<br> sx: number,<br> sy: number,<br> sw: number,<br> sh: number,<br> dx: number,<br> dy: number,<br> dw: number,<br> dh: number,<br> ): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:drawImage(<br> image: ImageBitmap \| PixelMap,<br> sx: number,<br> sy: number,<br> sw: number,<br> sh: number,<br> dx: number,<br> dy: number,<br> dw: number,<br> dh: number,<br> ): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:beginPath(): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:beginPath(): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:clip(fillRule?: CanvasFillRule): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:clip(fillRule?: CanvasFillRule): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:clip(path: Path2D, fillRule?: CanvasFillRule): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:clip(path: Path2D, fillRule?: CanvasFillRule): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:fill(fillRule?: CanvasFillRule): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:fill(fillRule?: CanvasFillRule): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:fill(path: Path2D, fillRule?: CanvasFillRule): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:fill(path: Path2D, fillRule?: CanvasFillRule): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:stroke(): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:stroke(): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:stroke(path: Path2D): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:stroke(path: Path2D): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:fillStyle: string \| CanvasGradient \| CanvasPattern;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:fillStyle: string \| CanvasGradient \| CanvasPattern;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:strokeStyle: string \| CanvasGradient \| CanvasPattern;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:strokeStyle: string \| CanvasGradient \| CanvasPattern;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:createLinearGradient(x0: number, y0: number, x1: number, y1: number): CanvasGradient;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:createPattern(image: ImageBitmap, repetition: string \| null): CanvasPattern \| null;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:createPattern(image: ImageBitmap, repetition: string \| null): CanvasPattern \| null;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:createRadialGradient(x0: number, y0: number, r0: number, x1: number, y1: number, r1: number): CanvasGradient;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:createImageData(sw: number, sh: number): ImageData;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:createImageData(sw: number, sh: number): ImageData;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:createImageData(imagedata: ImageData): ImageData;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:createImageData(imagedata: ImageData): ImageData;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:getImageData(sx: number, sy: number, sw: number, sh: number): ImageData;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:getImageData(sx: number, sy: number, sw: number, sh: number): ImageData;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:putImageData(imagedata: ImageData, dx: number, dy: number): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:putImageData(imagedata: ImageData, dx: number, dy: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:putImageData(<br> imagedata: ImageData,<br> dx: number,<br> dy: number,<br> dirtyX: number,<br> dirtyY: number,<br> dirtyWidth: number,<br> dirtyHeight: number,<br> ): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:putImageData(<br> imagedata: ImageData,<br> dx: number,<br> dy: number,<br> dirtyX: number,<br> dirtyY: number,<br> dirtyWidth: number,<br> dirtyHeight: number,<br> ): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:imageSmoothingEnabled: boolean;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:imageSmoothingEnabled: boolean;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:lineCap: CanvasLineCap;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:lineCap: CanvasLineCap;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:lineDashOffset: number;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:lineDashOffset: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:lineJoin: CanvasLineJoin;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:lineJoin: CanvasLineJoin;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:lineWidth: number;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:lineWidth: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:miterLimit: number;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:miterLimit: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:getLineDash(): number[];<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:getLineDash(): number[];<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:setLineDash(segments: number[]): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:setLineDash(segments: number[]): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:clearRect(x: number, y: number, w: number, h: number): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:clearRect(x: number, y: number, w: number, h: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:fillRect(x: number, y: number, w: number, h: number): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:fillRect(x: number, y: number, w: number, h: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:strokeRect(x: number, y: number, w: number, h: number): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:strokeRect(x: number, y: number, w: number, h: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:shadowBlur: number;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:shadowBlur: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:shadowColor: string;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:shadowColor: string;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:shadowOffsetX: number;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:shadowOffsetX: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:shadowOffsetY: number;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:shadowOffsetY: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:restore(): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:restore(): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:save(): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:save(): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:fillText(text: string, x: number, y: number, maxWidth?: number): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:fillText(text: string, x: number, y: number, maxWidth?: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:measureText(text: string): TextMetrics;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:measureText(text: string): TextMetrics;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:strokeText(text: string, x: number, y: number, maxWidth?: number): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:strokeText(text: string, x: number, y: number, maxWidth?: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:font: string;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:font: string;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:textAlign: CanvasTextAlign;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:textAlign: CanvasTextAlign;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:textBaseline: CanvasTextBaseline;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:textBaseline: CanvasTextBaseline;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:getTransform(): Matrix2D;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:getTransform(): Matrix2D;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:resetTransform(): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:resetTransform(): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:rotate(angle: number): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:rotate(angle: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:scale(x: number, y: number): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:scale(x: number, y: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:setTransform(a: number, b: number, c: number, d: number, e: number, f: number): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:setTransform(a: number, b: number, c: number, d: number, e: number, f: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:setTransform(transform?: Matrix2D): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:setTransform(transform?: Matrix2D): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:transform(a: number, b: number, c: number, d: number, e: number, f: number): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:transform(a: number, b: number, c: number, d: number, e: number, f: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:translate(x: number, y: number): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:translate(x: number, y: number): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderer<br>方法 or 属性:transferFromImageBitmap(bitmap: ImageBitmap): void;<br>起始版本:8|类名:CanvasRenderer<br>方法 or 属性:transferFromImageBitmap(bitmap: ImageBitmap): void;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderingContext2D<br>起始版本:8|类名:CanvasRenderingContext2D<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderingContext2D<br>方法 or 属性:readonly height: number;<br>起始版本:8|类名:CanvasRenderingContext2D<br>方法 or 属性:readonly height: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderingContext2D<br>方法 or 属性:readonly width: number;<br>起始版本:8|类名:CanvasRenderingContext2D<br>方法 or 属性:readonly width: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderingContext2D<br>方法 or 属性:toDataURL(type?: string, quality?: any): string;<br>起始版本:8|类名:CanvasRenderingContext2D<br>方法 or 属性:toDataURL(type?: string, quality?: any): string;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasRenderingContext2D<br>方法 or 属性:constructor(settings?: RenderingContextSettings);<br>起始版本:8|类名:CanvasRenderingContext2D<br>方法 or 属性:constructor(settings?: RenderingContextSettings);<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:OffscreenCanvasRenderingContext2D<br>起始版本:8|类名:OffscreenCanvasRenderingContext2D<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:OffscreenCanvasRenderingContext2D<br>方法 or 属性:toDataURL(type?: string, quality?: any): string;<br>起始版本:8|类名:OffscreenCanvasRenderingContext2D<br>方法 or 属性:toDataURL(type?: string, quality?: any): string;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:OffscreenCanvasRenderingContext2D<br>方法 or 属性:transferToImageBitmap(): ImageBitmap;<br>起始版本:8|类名:OffscreenCanvasRenderingContext2D<br>方法 or 属性:transferToImageBitmap(): ImageBitmap;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:OffscreenCanvasRenderingContext2D<br>方法 or 属性:constructor(width: number, height: number, settings?: RenderingContextSettings);<br>起始版本:8|类名:OffscreenCanvasRenderingContext2D<br>方法 or 属性:constructor(width: number, height: number, settings?: RenderingContextSettings);<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:OffscreenCanvas<br>起始版本:8|类名:OffscreenCanvas<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:OffscreenCanvas<br>方法 or 属性:height: number;<br>起始版本:8|类名:OffscreenCanvas<br>方法 or 属性:height: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:OffscreenCanvas<br>方法 or 属性:width: number;<br>起始版本:8|类名:OffscreenCanvas<br>方法 or 属性:width: number;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:OffscreenCanvas<br>方法 or 属性:transferToImageBitmap(): ImageBitmap;<br>起始版本:8|类名:OffscreenCanvas<br>方法 or 属性:transferToImageBitmap(): ImageBitmap;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:OffscreenCanvas<br>方法 or 属性:constructor(width: number, height: number);<br>起始版本:8|类名:OffscreenCanvas<br>方法 or 属性:constructor(width: number, height: number);<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasInterface<br>起始版本:8|类名:CanvasInterface<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasInterface<br>方法 or 属性:(context?: CanvasRenderingContext2D): CanvasAttribute;<br>起始版本:8|类名:CanvasInterface<br>方法 or 属性:(context?: CanvasRenderingContext2D): CanvasAttribute;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CanvasAttribute<br>方法 or 属性:onReady(event: () => void): CanvasAttribute;<br>起始版本:8|类名:CanvasAttribute<br>方法 or 属性:onReady(event: () => void): CanvasAttribute;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Canvas: CanvasInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Canvas: CanvasInterface;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const CanvasInstance: CanvasAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const CanvasInstance: CanvasAttribute;<br>起始版本:9|canvas.d.ts| +|起始版本有变化|类名:CheckboxOptions<br>起始版本:8|类名:CheckboxOptions<br>起始版本:9|checkbox.d.ts| +|起始版本有变化|类名:CheckboxOptions<br>方法 or 属性:name?: string;<br>起始版本:8|类名:CheckboxOptions<br>方法 or 属性:name?: string;<br>起始版本:9|checkbox.d.ts| +|起始版本有变化|类名:CheckboxOptions<br>方法 or 属性:group?: string;<br>起始版本:8|类名:CheckboxOptions<br>方法 or 属性:group?: string;<br>起始版本:9|checkbox.d.ts| +|起始版本有变化|类名:CheckboxInterface<br>起始版本:8|类名:CheckboxInterface<br>起始版本:9|checkbox.d.ts| +|起始版本有变化|类名:CheckboxInterface<br>方法 or 属性:(options?: CheckboxOptions): CheckboxAttribute;<br>起始版本:8|类名:CheckboxInterface<br>方法 or 属性:(options?: CheckboxOptions): CheckboxAttribute;<br>起始版本:9|checkbox.d.ts| +|起始版本有变化|类名:CheckboxAttribute<br>起始版本:8|类名:CheckboxAttribute<br>起始版本:9|checkbox.d.ts| +|起始版本有变化|类名:CheckboxAttribute<br>方法 or 属性:select(value: boolean): CheckboxAttribute;<br>起始版本:8|类名:CheckboxAttribute<br>方法 or 属性:select(value: boolean): CheckboxAttribute;<br>起始版本:9|checkbox.d.ts| +|起始版本有变化|类名:CheckboxAttribute<br>方法 or 属性:selectedColor(value: ResourceColor): CheckboxAttribute;<br>起始版本:8|类名:CheckboxAttribute<br>方法 or 属性:selectedColor(value: ResourceColor): CheckboxAttribute;<br>起始版本:9|checkbox.d.ts| +|起始版本有变化|类名:CheckboxAttribute<br>方法 or 属性:onChange(callback: (value: boolean) => void): CheckboxAttribute;<br>起始版本:8|类名:CheckboxAttribute<br>方法 or 属性:onChange(callback: (value: boolean) => void): CheckboxAttribute;<br>起始版本:9|checkbox.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Checkbox: CheckboxInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Checkbox: CheckboxInterface;<br>起始版本:9|checkbox.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const CheckboxInstance: CheckboxAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const CheckboxInstance: CheckboxAttribute;<br>起始版本:9|checkbox.d.ts| +|起始版本有变化|类名:SelectStatus<br>起始版本:8|类名:SelectStatus<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:SelectStatus<br>方法 or 属性:All<br>起始版本:8|类名:SelectStatus<br>方法 or 属性:All<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:SelectStatus<br>方法 or 属性:Part<br>起始版本:8|类名:SelectStatus<br>方法 or 属性:Part<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:SelectStatus<br>方法 or 属性:None<br>起始版本:8|类名:SelectStatus<br>方法 or 属性:None<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:CheckboxGroupOptions<br>起始版本:8|类名:CheckboxGroupOptions<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:CheckboxGroupOptions<br>方法 or 属性:group?: string;<br>起始版本:8|类名:CheckboxGroupOptions<br>方法 or 属性:group?: string;<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:CheckboxGroupResult<br>起始版本:8|类名:CheckboxGroupResult<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:CheckboxGroupResult<br>方法 or 属性:name: Array\<string>;<br>起始版本:8|类名:CheckboxGroupResult<br>方法 or 属性:name: Array\<string>;<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:CheckboxGroupResult<br>方法 or 属性:status: SelectStatus;<br>起始版本:8|类名:CheckboxGroupResult<br>方法 or 属性:status: SelectStatus;<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:CheckboxGroupInterface<br>起始版本:8|类名:CheckboxGroupInterface<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:CheckboxGroupInterface<br>方法 or 属性:(options?: CheckboxGroupOptions): CheckboxGroupAttribute;<br>起始版本:8|类名:CheckboxGroupInterface<br>方法 or 属性:(options?: CheckboxGroupOptions): CheckboxGroupAttribute;<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:CheckboxGroupAttribute<br>起始版本:8|类名:CheckboxGroupAttribute<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:CheckboxGroupAttribute<br>方法 or 属性:selectAll(value: boolean): CheckboxGroupAttribute;<br>起始版本:8|类名:CheckboxGroupAttribute<br>方法 or 属性:selectAll(value: boolean): CheckboxGroupAttribute;<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:CheckboxGroupAttribute<br>方法 or 属性:selectedColor(value: ResourceColor): CheckboxGroupAttribute;<br>起始版本:8|类名:CheckboxGroupAttribute<br>方法 or 属性:selectedColor(value: ResourceColor): CheckboxGroupAttribute;<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:CheckboxGroupAttribute<br>方法 or 属性:onChange(callback: (event: CheckboxGroupResult) => void): CheckboxGroupAttribute;<br>起始版本:8|类名:CheckboxGroupAttribute<br>方法 or 属性:onChange(callback: (event: CheckboxGroupResult) => void): CheckboxGroupAttribute;<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const CheckboxGroup: CheckboxGroupInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const CheckboxGroup: CheckboxGroupInterface;<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const CheckboxGroupInstance: CheckboxGroupAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const CheckboxGroupInstance: CheckboxGroupAttribute;<br>起始版本:9|checkboxgroup.d.ts| +|起始版本有变化|类名:CircleOptions<br>起始版本:7|类名:CircleOptions<br>起始版本:9|circle.d.ts| +|起始版本有变化|类名:CircleOptions<br>方法 or 属性:width?: string \| number;<br>起始版本:7|类名:CircleOptions<br>方法 or 属性:width?: string \| number;<br>起始版本:9|circle.d.ts| +|起始版本有变化|类名:CircleOptions<br>方法 or 属性:height?: string \| number;<br>起始版本:7|类名:CircleOptions<br>方法 or 属性:height?: string \| number;<br>起始版本:9|circle.d.ts| +|起始版本有变化|类名:CircleInterface<br>起始版本:7|类名:CircleInterface<br>起始版本:9|circle.d.ts| +|起始版本有变化|类名:CircleInterface<br>方法 or 属性:new (value?: CircleOptions): CircleAttribute;<br>起始版本:7|类名:CircleInterface<br>方法 or 属性:new (value?: CircleOptions): CircleAttribute;<br>起始版本:9|circle.d.ts| +|起始版本有变化|类名:CircleInterface<br>方法 or 属性:(value?: CircleOptions): CircleAttribute;<br>起始版本:7|类名:CircleInterface<br>方法 or 属性:(value?: CircleOptions): CircleAttribute;<br>起始版本:9|circle.d.ts| +|起始版本有变化|类名:CircleAttribute<br>起始版本:7|类名:CircleAttribute<br>起始版本:9|circle.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Circle: CircleInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Circle: CircleInterface;<br>起始版本:9|circle.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const CircleInstance: CircleAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const CircleInstance: CircleAttribute;<br>起始版本:9|circle.d.ts| +|起始版本有变化|类名:ColumnInterface<br>起始版本:7|类名:ColumnInterface<br>起始版本:9|column.d.ts| +|起始版本有变化|类名:ColumnInterface<br>方法 or 属性:(value?: { space?: string \| number }): ColumnAttribute;<br>起始版本:7|类名:ColumnInterface<br>方法 or 属性:(value?: { space?: string \| number }): ColumnAttribute;<br>起始版本:9|column.d.ts| +|起始版本有变化|类名:ColumnAttribute<br>起始版本:7|类名:ColumnAttribute<br>起始版本:9|column.d.ts| +|起始版本有变化|类名:ColumnAttribute<br>方法 or 属性:alignItems(value: HorizontalAlign): ColumnAttribute;<br>起始版本:7|类名:ColumnAttribute<br>方法 or 属性:alignItems(value: HorizontalAlign): ColumnAttribute;<br>起始版本:9|column.d.ts| +|起始版本有变化|类名:ColumnAttribute<br>方法 or 属性:justifyContent(value: FlexAlign): ColumnAttribute;<br>起始版本:8|类名:ColumnAttribute<br>方法 or 属性:justifyContent(value: FlexAlign): ColumnAttribute;<br>起始版本:9|column.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Column: ColumnInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Column: ColumnInterface;<br>起始版本:9|column.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ColumnInstance: ColumnAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ColumnInstance: ColumnAttribute;<br>起始版本:9|column.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ColumnSplitInstance: ColumnSplitAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ColumnSplitInstance: ColumnSplitAttribute;<br>起始版本:7|column_split.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ColumnSplit: ColumnSplitInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ColumnSplit: ColumnSplitInterface;<br>起始版本:7|column_split.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Component: ClassDecorator;<br>起始版本:7|类名:global<br>方法 or 属性:declare const Component: ClassDecorator;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Observed: ClassDecorator;<br>起始版本:7|类名:global<br>方法 or 属性:declare const Observed: ClassDecorator;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Preview: ClassDecorator & ((value: PreviewParams) => ClassDecorator);<br>起始版本:7|类名:global<br>方法 or 属性:declare const Preview: ClassDecorator & ((value: PreviewParams) => ClassDecorator);<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const BuilderParam: PropertyDecorator;<br>起始版本:7|类名:global<br>方法 or 属性:declare const BuilderParam: PropertyDecorator;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const State: PropertyDecorator;<br>起始版本:7|类名:global<br>方法 or 属性:declare const State: PropertyDecorator;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Prop: PropertyDecorator;<br>起始版本:7|类名:global<br>方法 or 属性:declare const Prop: PropertyDecorator;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Link: PropertyDecorator;<br>起始版本:7|类名:global<br>方法 or 属性:declare const Link: PropertyDecorator;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ObjectLink: PropertyDecorator;<br>起始版本:7|类名:global<br>方法 or 属性:declare const ObjectLink: PropertyDecorator;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Provide: PropertyDecorator & ((value: string) => PropertyDecorator);<br>起始版本:7|类名:global<br>方法 or 属性:declare const Provide: PropertyDecorator & ((value: string) => PropertyDecorator);<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Consume: PropertyDecorator & ((value: string) => PropertyDecorator);<br>起始版本:7|类名:global<br>方法 or 属性:declare const Consume: PropertyDecorator & ((value: string) => PropertyDecorator);<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Watch: (value: string) => PropertyDecorator;<br>起始版本:7|类名:global<br>方法 or 属性:declare const Watch: (value: string) => PropertyDecorator;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Builder: MethodDecorator;<br>起始版本:7|类名:global<br>方法 or 属性:declare const Builder: MethodDecorator;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Styles: MethodDecorator;<br>起始版本:8|类名:global<br>方法 or 属性:declare const Styles: MethodDecorator;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Extend: MethodDecorator & ((value: any) => MethodDecorator);<br>起始版本:7|类名:global<br>方法 or 属性:declare const Extend: MethodDecorator & ((value: any) => MethodDecorator);<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:Configuration<br>起始版本:7|类名:Configuration<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:Configuration<br>方法 or 属性:readonly colorMode: string;<br>起始版本:7|类名:Configuration<br>方法 or 属性:readonly colorMode: string;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:Configuration<br>方法 or 属性:readonly fontScale: number;<br>起始版本:7|类名:Configuration<br>方法 or 属性:readonly fontScale: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:Rectangle<br>起始版本:8|类名:Rectangle<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:Rectangle<br>方法 or 属性:x?: Length;<br>起始版本:8|类名:Rectangle<br>方法 or 属性:x?: Length;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:Rectangle<br>方法 or 属性:y?: Length;<br>起始版本:8|类名:Rectangle<br>方法 or 属性:y?: Length;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:Rectangle<br>方法 or 属性:width?: Length;<br>起始版本:8|类名:Rectangle<br>方法 or 属性:width?: Length;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:Rectangle<br>方法 or 属性:height?: Length;<br>起始版本:8|类名:Rectangle<br>方法 or 属性:height?: Length;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:<br>方法 or 属性:function $r(value: string, ...params: any[]): Resource;<br>起始版本:7|类名:<br>方法 or 属性:function $r(value: string, ...params: any[]): Resource;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:<br>方法 or 属性:function $rawfile(value: string): Resource;<br>起始版本:7|类名:<br>方法 or 属性:function $rawfile(value: string): Resource;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:AnimateParam<br>起始版本:7|类名:AnimateParam<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:AnimateParam<br>方法 or 属性:duration?: number;<br>起始版本:7|类名:AnimateParam<br>方法 or 属性:duration?: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:AnimateParam<br>方法 or 属性:playMode?: PlayMode;<br>起始版本:7|类名:AnimateParam<br>方法 or 属性:playMode?: PlayMode;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:AnimateParam<br>方法 or 属性:onFinish?: () => void;<br>起始版本:7|类名:AnimateParam<br>方法 or 属性:onFinish?: () => void;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:TranslateOptions<br>起始版本:7|类名:TranslateOptions<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:TranslateOptions<br>方法 or 属性:x?: number \| string;<br>起始版本:7|类名:TranslateOptions<br>方法 or 属性:x?: number \| string;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:TranslateOptions<br>方法 or 属性:y?: number \| string;<br>起始版本:7|类名:TranslateOptions<br>方法 or 属性:y?: number \| string;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:TranslateOptions<br>方法 or 属性:z?: number \| string;<br>起始版本:7|类名:TranslateOptions<br>方法 or 属性:z?: number \| string;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:ScaleOptions<br>起始版本:7|类名:ScaleOptions<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:ScaleOptions<br>方法 or 属性:x?: number;<br>起始版本:7|类名:ScaleOptions<br>方法 or 属性:x?: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:ScaleOptions<br>方法 or 属性:y?: number;<br>起始版本:7|类名:ScaleOptions<br>方法 or 属性:y?: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:ScaleOptions<br>方法 or 属性:z?: number;<br>起始版本:7|类名:ScaleOptions<br>方法 or 属性:z?: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:ScaleOptions<br>方法 or 属性:centerX?: number \| string;<br>起始版本:7|类名:ScaleOptions<br>方法 or 属性:centerX?: number \| string;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:ScaleOptions<br>方法 or 属性:centerY?: number \| string;<br>起始版本:7|类名:ScaleOptions<br>方法 or 属性:centerY?: number \| string;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:RotateOptions<br>方法 or 属性:x?: number;<br>起始版本:7|类名:RotateOptions<br>方法 or 属性:x?: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:RotateOptions<br>方法 or 属性:y?: number;<br>起始版本:7|类名:RotateOptions<br>方法 or 属性:y?: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:RotateOptions<br>方法 or 属性:z?: number;<br>起始版本:7|类名:RotateOptions<br>方法 or 属性:z?: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:RotateOptions<br>方法 or 属性:centerX?: number \| string;<br>起始版本:7|类名:RotateOptions<br>方法 or 属性:centerX?: number \| string;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:RotateOptions<br>方法 or 属性:centerY?: number \| string;<br>起始版本:7|类名:RotateOptions<br>方法 or 属性:centerY?: number \| string;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:RotateOptions<br>方法 or 属性:angle: number \| string;<br>起始版本:7|类名:RotateOptions<br>方法 or 属性:angle: number \| string;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:TransitionOptions<br>起始版本:7|类名:TransitionOptions<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:TransitionOptions<br>方法 or 属性:type?: TransitionType;<br>起始版本:7|类名:TransitionOptions<br>方法 or 属性:type?: TransitionType;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:TransitionOptions<br>方法 or 属性:opacity?: number;<br>起始版本:7|类名:TransitionOptions<br>方法 or 属性:opacity?: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:TransitionOptions<br>方法 or 属性:translate?: TranslateOptions;<br>起始版本:7|类名:TransitionOptions<br>方法 or 属性:translate?: TranslateOptions;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:TransitionOptions<br>方法 or 属性:scale?: ScaleOptions;<br>起始版本:7|类名:TransitionOptions<br>方法 or 属性:scale?: ScaleOptions;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:TransitionOptions<br>方法 or 属性:rotate?: RotateOptions;<br>起始版本:7|类名:TransitionOptions<br>方法 or 属性:rotate?: RotateOptions;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:PreviewParams<br>起始版本:8|类名:PreviewParams<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:PreviewParams<br>方法 or 属性:title?: string;<br>起始版本:8|类名:PreviewParams<br>方法 or 属性:title?: string;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:PreviewParams<br>方法 or 属性:width?: number;<br>起始版本:8|类名:PreviewParams<br>方法 or 属性:width?: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:PreviewParams<br>方法 or 属性:height?: number;<br>起始版本:8|类名:PreviewParams<br>方法 or 属性:height?: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:PreviewParams<br>方法 or 属性:locale?: string;<br>起始版本:8|类名:PreviewParams<br>方法 or 属性:locale?: string;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:PreviewParams<br>方法 or 属性:colorMode?: string;<br>起始版本:8|类名:PreviewParams<br>方法 or 属性:colorMode?: string;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:PreviewParams<br>方法 or 属性:deviceType?: string;<br>起始版本:8|类名:PreviewParams<br>方法 or 属性:deviceType?: string;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:PreviewParams<br>方法 or 属性:dpi?: number;<br>起始版本:8|类名:PreviewParams<br>方法 or 属性:dpi?: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:PreviewParams<br>方法 or 属性:orientation?: string;<br>起始版本:8|类名:PreviewParams<br>方法 or 属性:orientation?: string;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:PreviewParams<br>方法 or 属性:roundScreen?: boolean;<br>起始版本:8|类名:PreviewParams<br>方法 or 属性:roundScreen?: boolean;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:<br>方法 or 属性:function animateTo(value: AnimateParam, event: () => void): void;<br>起始版本:7|类名:<br>方法 or 属性:function animateTo(value: AnimateParam, event: () => void): void;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:<br>方法 or 属性:function vp2px(value: number): number;<br>起始版本:7|类名:<br>方法 or 属性:function vp2px(value: number): number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:<br>方法 or 属性:function px2vp(value: number): number;<br>起始版本:7|类名:<br>方法 or 属性:function px2vp(value: number): number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:<br>方法 or 属性:function fp2px(value: number): number;<br>起始版本:7|类名:<br>方法 or 属性:function fp2px(value: number): number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:<br>方法 or 属性:function px2fp(value: number): number;<br>起始版本:7|类名:<br>方法 or 属性:function px2fp(value: number): number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:<br>方法 or 属性:function lpx2px(value: number): number;<br>起始版本:7|类名:<br>方法 or 属性:function lpx2px(value: number): number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:<br>方法 or 属性:function px2lpx(value: number): number;<br>起始版本:7|类名:<br>方法 or 属性:function px2lpx(value: number): number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:EventTarget<br>起始版本:8|类名:EventTarget<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:EventTarget<br>方法 or 属性:area: Area;<br>起始版本:8|类名:EventTarget<br>方法 or 属性:area: Area;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:BaseEvent<br>起始版本:8|类名:BaseEvent<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:BaseEvent<br>方法 or 属性:target: EventTarget;<br>起始版本:8|类名:BaseEvent<br>方法 or 属性:target: EventTarget;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:BaseEvent<br>方法 or 属性:timestamp: number;<br>起始版本:8|类名:BaseEvent<br>方法 or 属性:timestamp: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:BaseEvent<br>方法 or 属性:source: SourceType;<br>起始版本:8|类名:BaseEvent<br>方法 or 属性:source: SourceType;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:ClickEvent<br>起始版本:7|类名:ClickEvent<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:ClickEvent<br>方法 or 属性:screenX: number;<br>起始版本:7|类名:ClickEvent<br>方法 or 属性:screenX: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:ClickEvent<br>方法 or 属性:screenY: number;<br>起始版本:7|类名:ClickEvent<br>方法 or 属性:screenY: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:ClickEvent<br>方法 or 属性:x: number;<br>起始版本:7|类名:ClickEvent<br>方法 or 属性:x: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:ClickEvent<br>方法 or 属性:y: number;<br>起始版本:7|类名:ClickEvent<br>方法 or 属性:y: number;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:StateStyles<br>起始版本:8|类名:StateStyles<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:StateStyles<br>方法 or 属性:normal?: any;<br>起始版本:8|类名:StateStyles<br>方法 or 属性:normal?: any;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:StateStyles<br>方法 or 属性:pressed?: any;<br>起始版本:8|类名:StateStyles<br>方法 or 属性:pressed?: any;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:StateStyles<br>方法 or 属性:disabled?: any;<br>起始版本:8|类名:StateStyles<br>方法 or 属性:disabled?: any;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:StateStyles<br>方法 or 属性:focused?: any;<br>起始版本:8|类名:StateStyles<br>方法 or 属性:focused?: any;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:StateStyles<br>方法 or 属性:clicked?: any;<br>起始版本:8|类名:StateStyles<br>方法 or 属性:clicked?: any;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>起始版本:7|类名:CommonMethod<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:constructor();<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:constructor();<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:width(value: Length): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:width(value: Length): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:height(value: Length): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:height(value: Length): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:responseRegion(value: Array\<Rectangle> \| Rectangle): T;<br>起始版本:8|类名:CommonMethod<br>方法 or 属性:responseRegion(value: Array\<Rectangle> \| Rectangle): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:size(value: SizeOptions): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:size(value: SizeOptions): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:constraintSize(value: ConstraintSizeOptions): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:constraintSize(value: ConstraintSizeOptions): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:layoutWeight(value: number \| string): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:layoutWeight(value: number \| string): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:padding(value: Padding \| Length): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:padding(value: Padding \| Length): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:margin(value: Margin \| Length): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:margin(value: Margin \| Length): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:backgroundColor(value: ResourceColor): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:backgroundColor(value: ResourceColor): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:backgroundImage(src: ResourceStr, repeat?: ImageRepeat): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:backgroundImage(src: ResourceStr, repeat?: ImageRepeat): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:backgroundImageSize(value: SizeOptions \| ImageSize): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:backgroundImageSize(value: SizeOptions \| ImageSize): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:backgroundImagePosition(value: Position \| Alignment): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:backgroundImagePosition(value: Position \| Alignment): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:opacity(value: number \| Resource): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:opacity(value: number \| Resource): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:border(value: BorderOptions): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:border(value: BorderOptions): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:borderStyle(value: BorderStyle): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:borderStyle(value: BorderStyle): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:borderWidth(value: Length): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:borderWidth(value: Length): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:borderColor(value: ResourceColor): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:borderColor(value: ResourceColor): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:borderRadius(value: Length): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:borderRadius(value: Length): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:onClick(event: (event?: ClickEvent) => void): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:onClick(event: (event?: ClickEvent) => void): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:animation(value: AnimateParam): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:animation(value: AnimateParam): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:transition(value: TransitionOptions): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:transition(value: TransitionOptions): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:blur(value: number): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:blur(value: number): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:brightness(value: number): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:brightness(value: number): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:contrast(value: number): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:contrast(value: number): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:grayscale(value: number): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:grayscale(value: number): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:colorBlend(value: Color \| string \| Resource): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:colorBlend(value: Color \| string \| Resource): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:saturate(value: number): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:saturate(value: number): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:sepia(value: number): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:sepia(value: number): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:invert(value: number): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:invert(value: number): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:hueRotate(value: number \| string): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:hueRotate(value: number \| string): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:backdropBlur(value: number): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:backdropBlur(value: number): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:translate(value: TranslateOptions): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:translate(value: TranslateOptions): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:scale(value: ScaleOptions): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:scale(value: ScaleOptions): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:rotate(value: RotateOptions): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:rotate(value: RotateOptions): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:onAppear(event: () => void): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:onAppear(event: () => void): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:onDisAppear(event: () => void): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:onDisAppear(event: () => void): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:visibility(value: Visibility): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:visibility(value: Visibility): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:flexGrow(value: number): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:flexGrow(value: number): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:flexShrink(value: number): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:flexShrink(value: number): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:flexBasis(value: number \| string): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:flexBasis(value: number \| string): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:alignSelf(value: ItemAlign): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:alignSelf(value: ItemAlign): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:displayPriority(value: number): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:displayPriority(value: number): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:zIndex(value: number): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:zIndex(value: number): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:direction(value: Direction): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:direction(value: Direction): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:align(value: Alignment): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:align(value: Alignment): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:position(value: Position): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:position(value: Position): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:markAnchor(value: Position): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:markAnchor(value: Position): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:offset(value: Position): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:offset(value: Position): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:enabled(value: boolean): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:enabled(value: boolean): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:aspectRatio(value: number): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:aspectRatio(value: number): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:overlay(value: string, options?: { align?: Alignment; offset?: { x?: number; y?: number } }): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:overlay(value: string, options?: { align?: Alignment; offset?: { x?: number; y?: number } }): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:linearGradient(value: {<br> angle?: number \| string;<br> direction?: GradientDirection;<br> colors: Array\<any>;<br> repeating?: boolean;<br> }): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:linearGradient(value: {<br> angle?: number \| string;<br> direction?: GradientDirection;<br> colors: Array\<any>;<br> repeating?: boolean;<br> }): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:sweepGradient(value: {<br> center: Array\<any>;<br> start?: number \| string;<br> end?: number \| string;<br> rotation?: number \| string;<br> colors: Array\<any>;<br> repeating?: boolean;<br> }): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:sweepGradient(value: {<br> center: Array\<any>;<br> start?: number \| string;<br> end?: number \| string;<br> rotation?: number \| string;<br> colors: Array\<any>;<br> repeating?: boolean;<br> }): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:radialGradient(value: { center: Array\<any>; radius: number \| string; colors: Array\<any>; repeating?: boolean }): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:radialGradient(value: { center: Array\<any>; radius: number \| string; colors: Array\<any>; repeating?: boolean }): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:shadow(value: {<br> radius: number \| Resource;<br> color?: Color \| string \| Resource;<br> offsetX?: number \| Resource;<br> offsetY?: number \| Resource;<br> }): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:shadow(value: {<br> radius: number \| Resource;<br> color?: Color \| string \| Resource;<br> offsetX?: number \| Resource;<br> offsetY?: number \| Resource;<br> }): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:clip(value: boolean \| CircleAttribute \| EllipseAttribute \| PathAttribute \| RectAttribute): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:clip(value: boolean \| CircleAttribute \| EllipseAttribute \| PathAttribute \| RectAttribute): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:mask(value: CircleAttribute \| EllipseAttribute \| PathAttribute \| RectAttribute): T;<br>起始版本:7|类名:CommonMethod<br>方法 or 属性:mask(value: CircleAttribute \| EllipseAttribute \| PathAttribute \| RectAttribute): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:id(value: string): T;<br>起始版本:8|类名:CommonMethod<br>方法 or 属性:id(value: string): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonMethod<br>方法 or 属性:stateStyles(value: StateStyles): T;<br>起始版本:8|类名:CommonMethod<br>方法 or 属性:stateStyles(value: StateStyles): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonAttribute<br>起始版本:7|类名:CommonAttribute<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonInterface<br>起始版本:7|类名:CommonInterface<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const CommonInstance: CommonAttribute;<br>起始版本:7|类名:global<br>方法 or 属性:declare const CommonInstance: CommonAttribute;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Common: CommonInterface;<br>起始版本:7|类名:global<br>方法 or 属性:declare const Common: CommonInterface;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonShapeMethod<br>起始版本:7|类名:CommonShapeMethod<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonShapeMethod<br>方法 or 属性:constructor();<br>起始版本:7|类名:CommonShapeMethod<br>方法 or 属性:constructor();<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonShapeMethod<br>方法 or 属性:stroke(value: ResourceColor): T;<br>起始版本:7|类名:CommonShapeMethod<br>方法 or 属性:stroke(value: ResourceColor): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonShapeMethod<br>方法 or 属性:fill(value: ResourceColor): T;<br>起始版本:7|类名:CommonShapeMethod<br>方法 or 属性:fill(value: ResourceColor): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonShapeMethod<br>方法 or 属性:strokeDashOffset(value: number \| string): T;<br>起始版本:7|类名:CommonShapeMethod<br>方法 or 属性:strokeDashOffset(value: number \| string): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonShapeMethod<br>方法 or 属性:strokeLineCap(value: LineCapStyle): T;<br>起始版本:7|类名:CommonShapeMethod<br>方法 or 属性:strokeLineCap(value: LineCapStyle): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonShapeMethod<br>方法 or 属性:strokeLineJoin(value: LineJoinStyle): T;<br>起始版本:7|类名:CommonShapeMethod<br>方法 or 属性:strokeLineJoin(value: LineJoinStyle): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonShapeMethod<br>方法 or 属性:strokeMiterLimit(value: number \| string): T;<br>起始版本:7|类名:CommonShapeMethod<br>方法 or 属性:strokeMiterLimit(value: number \| string): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonShapeMethod<br>方法 or 属性:strokeOpacity(value: number \| string \| Resource): T;<br>起始版本:7|类名:CommonShapeMethod<br>方法 or 属性:strokeOpacity(value: number \| string \| Resource): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonShapeMethod<br>方法 or 属性:fillOpacity(value: number \| string \| Resource): T;<br>起始版本:7|类名:CommonShapeMethod<br>方法 or 属性:fillOpacity(value: number \| string \| Resource): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonShapeMethod<br>方法 or 属性:strokeWidth(value: Length): T;<br>起始版本:7|类名:CommonShapeMethod<br>方法 or 属性:strokeWidth(value: Length): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonShapeMethod<br>方法 or 属性:antiAlias(value: boolean): T;<br>起始版本:7|类名:CommonShapeMethod<br>方法 or 属性:antiAlias(value: boolean): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CommonShapeMethod<br>方法 or 属性:strokeDashArray(value: Array\<any>): T;<br>起始版本:7|类名:CommonShapeMethod<br>方法 or 属性:strokeDashArray(value: Array\<any>): T;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CustomComponent<br>起始版本:7|类名:CustomComponent<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CustomComponent<br>方法 or 属性:build(): void;<br>起始版本:7|类名:CustomComponent<br>方法 or 属性:build(): void;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CustomComponent<br>方法 or 属性:aboutToAppear?(): void;<br>起始版本:7|类名:CustomComponent<br>方法 or 属性:aboutToAppear?(): void;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CustomComponent<br>方法 or 属性:aboutToDisappear?(): void;<br>起始版本:7|类名:CustomComponent<br>方法 or 属性:aboutToDisappear?(): void;<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:View<br>起始版本:7|类名:View<br>起始版本:9|common.d.ts| +|起始版本有变化|类名:CounterInterface<br>起始版本:7|类名:CounterInterface<br>起始版本:9|counter.d.ts| +|起始版本有变化|类名:CounterInterface<br>方法 or 属性:(): CounterAttribute;<br>起始版本:7|类名:CounterInterface<br>方法 or 属性:(): CounterAttribute;<br>起始版本:9|counter.d.ts| +|起始版本有变化|类名:CounterAttribute<br>起始版本:7|类名:CounterAttribute<br>起始版本:9|counter.d.ts| +|起始版本有变化|类名:CounterAttribute<br>方法 or 属性:onInc(event: () => void): CounterAttribute;<br>起始版本:7|类名:CounterAttribute<br>方法 or 属性:onInc(event: () => void): CounterAttribute;<br>起始版本:9|counter.d.ts| +|起始版本有变化|类名:CounterAttribute<br>方法 or 属性:onDec(event: () => void): CounterAttribute;<br>起始版本:7|类名:CounterAttribute<br>方法 or 属性:onDec(event: () => void): CounterAttribute;<br>起始版本:9|counter.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const CounterInstance: CounterAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const CounterInstance: CounterAttribute;<br>起始版本:9|counter.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Counter: CounterInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Counter: CounterInterface;<br>起始版本:9|counter.d.ts| +|起始版本有变化|类名:DataPanelType<br>起始版本:8|类名:DataPanelType<br>起始版本:9|data_panel.d.ts| +|起始版本有变化|类名:DataPanelType<br>方法 or 属性:Line<br>起始版本:8|类名:DataPanelType<br>方法 or 属性:Line<br>起始版本:9|data_panel.d.ts| +|起始版本有变化|类名:DataPanelType<br>方法 or 属性:Circle<br>起始版本:8|类名:DataPanelType<br>方法 or 属性:Circle<br>起始版本:9|data_panel.d.ts| +|起始版本有变化|类名:DataPanelOptions<br>起始版本:7|类名:DataPanelOptions<br>起始版本:9|data_panel.d.ts| +|起始版本有变化|类名:DataPanelOptions<br>方法 or 属性:values: number[];<br>起始版本:7|类名:DataPanelOptions<br>方法 or 属性:values: number[];<br>起始版本:9|data_panel.d.ts| +|起始版本有变化|类名:DataPanelOptions<br>方法 or 属性:max?: number;<br>起始版本:7|类名:DataPanelOptions<br>方法 or 属性:max?: number;<br>起始版本:9|data_panel.d.ts| +|起始版本有变化|类名:DataPanelOptions<br>方法 or 属性:type?: DataPanelType;<br>起始版本:8|类名:DataPanelOptions<br>方法 or 属性:type?: DataPanelType;<br>起始版本:9|data_panel.d.ts| +|起始版本有变化|类名:DataPanelInterface<br>起始版本:7|类名:DataPanelInterface<br>起始版本:9|data_panel.d.ts| +|起始版本有变化|类名:DataPanelInterface<br>方法 or 属性:(options: DataPanelOptions): DataPanelAttribute;<br>起始版本:7|类名:DataPanelInterface<br>方法 or 属性:(options: DataPanelOptions): DataPanelAttribute;<br>起始版本:9|data_panel.d.ts| +|起始版本有变化|类名:DataPanelAttribute<br>起始版本:7|类名:DataPanelAttribute<br>起始版本:9|data_panel.d.ts| +|起始版本有变化|类名:DataPanelAttribute<br>方法 or 属性:closeEffect(value: boolean): DataPanelAttribute;<br>起始版本:7|类名:DataPanelAttribute<br>方法 or 属性:closeEffect(value: boolean): DataPanelAttribute;<br>起始版本:9|data_panel.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const DataPanel: DataPanelInterface<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const DataPanel: DataPanelInterface<br>起始版本:9|data_panel.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const DataPanelInstance: DataPanelAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const DataPanelInstance: DataPanelAttribute;<br>起始版本:9|data_panel.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const DatePicker: DatePickerInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const DatePicker: DatePickerInterface;<br>起始版本:8|date_picker.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const DatePickerInstance: DatePickerAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const DatePickerInstance: DatePickerAttribute;<br>起始版本:8|date_picker.d.ts| +|起始版本有变化|类名:DividerInterface<br>起始版本:7|类名:DividerInterface<br>起始版本:9|divider.d.ts| +|起始版本有变化|类名:DividerInterface<br>方法 or 属性:(): DividerAttribute;<br>起始版本:7|类名:DividerInterface<br>方法 or 属性:(): DividerAttribute;<br>起始版本:9|divider.d.ts| +|起始版本有变化|类名:DividerAttribute<br>起始版本:7|类名:DividerAttribute<br>起始版本:9|divider.d.ts| +|起始版本有变化|类名:DividerAttribute<br>方法 or 属性:vertical(value: boolean): DividerAttribute;<br>起始版本:7|类名:DividerAttribute<br>方法 or 属性:vertical(value: boolean): DividerAttribute;<br>起始版本:9|divider.d.ts| +|起始版本有变化|类名:DividerAttribute<br>方法 or 属性:color(value: ResourceColor): DividerAttribute;<br>起始版本:7|类名:DividerAttribute<br>方法 or 属性:color(value: ResourceColor): DividerAttribute;<br>起始版本:9|divider.d.ts| +|起始版本有变化|类名:DividerAttribute<br>方法 or 属性:strokeWidth(value: number \| string): DividerAttribute;<br>起始版本:7|类名:DividerAttribute<br>方法 or 属性:strokeWidth(value: number \| string): DividerAttribute;<br>起始版本:9|divider.d.ts| +|起始版本有变化|类名:DividerAttribute<br>方法 or 属性:lineCap(value: LineCapStyle): DividerAttribute;<br>起始版本:7|类名:DividerAttribute<br>方法 or 属性:lineCap(value: LineCapStyle): DividerAttribute;<br>起始版本:9|divider.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Divider: DividerInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Divider: DividerInterface;<br>起始版本:9|divider.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const DividerInstance: DividerAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const DividerInstance: DividerAttribute;<br>起始版本:9|divider.d.ts| +|起始版本有变化|类名:EllipseInterface<br>起始版本:7|类名:EllipseInterface<br>起始版本:9|ellipse.d.ts| +|起始版本有变化|类名:EllipseInterface<br>方法 or 属性:new (value?: { width?: string \| number; height?: string \| number }): EllipseAttribute;<br>起始版本:7|类名:EllipseInterface<br>方法 or 属性:new (value?: { width?: string \| number; height?: string \| number }): EllipseAttribute;<br>起始版本:9|ellipse.d.ts| +|起始版本有变化|类名:EllipseInterface<br>方法 or 属性:(value?: { width?: string \| number; height?: string \| number }): EllipseAttribute;<br>起始版本:7|类名:EllipseInterface<br>方法 or 属性:(value?: { width?: string \| number; height?: string \| number }): EllipseAttribute;<br>起始版本:9|ellipse.d.ts| +|起始版本有变化|类名:EllipseAttribute<br>起始版本:7|类名:EllipseAttribute<br>起始版本:9|ellipse.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Ellipse: EllipseInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Ellipse: EllipseInterface;<br>起始版本:9|ellipse.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const EllipseInstance: EllipseAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const EllipseInstance: EllipseAttribute;<br>起始版本:9|ellipse.d.ts| +|起始版本有变化|类名:Color<br>起始版本:7|类名:Color<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Color<br>方法 or 属性:White<br>起始版本:7|类名:Color<br>方法 or 属性:White<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Color<br>方法 or 属性:Black<br>起始版本:7|类名:Color<br>方法 or 属性:Black<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Color<br>方法 or 属性:Blue<br>起始版本:7|类名:Color<br>方法 or 属性:Blue<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Color<br>方法 or 属性:Brown<br>起始版本:7|类名:Color<br>方法 or 属性:Brown<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Color<br>方法 or 属性:Gray<br>起始版本:7|类名:Color<br>方法 or 属性:Gray<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Color<br>方法 or 属性:Green<br>起始版本:7|类名:Color<br>方法 or 属性:Green<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Color<br>方法 or 属性:Grey<br>起始版本:7|类名:Color<br>方法 or 属性:Grey<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Color<br>方法 or 属性:Orange<br>起始版本:7|类名:Color<br>方法 or 属性:Orange<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Color<br>方法 or 属性:Pink<br>起始版本:7|类名:Color<br>方法 or 属性:Pink<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Color<br>方法 or 属性:Red<br>起始版本:7|类名:Color<br>方法 or 属性:Red<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Color<br>方法 or 属性:Yellow<br>起始版本:7|类名:Color<br>方法 or 属性:Yellow<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageFit<br>起始版本:7|类名:ImageFit<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageFit<br>方法 or 属性:Contain<br>起始版本:7|类名:ImageFit<br>方法 or 属性:Contain<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageFit<br>方法 or 属性:Cover<br>起始版本:7|类名:ImageFit<br>方法 or 属性:Cover<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageFit<br>方法 or 属性:Auto<br>起始版本:7|类名:ImageFit<br>方法 or 属性:Auto<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageFit<br>方法 or 属性:Fill<br>起始版本:7|类名:ImageFit<br>方法 or 属性:Fill<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageFit<br>方法 or 属性:ScaleDown<br>起始版本:7|类名:ImageFit<br>方法 or 属性:ScaleDown<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageFit<br>方法 or 属性:None<br>起始版本:7|类名:ImageFit<br>方法 or 属性:None<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:BorderStyle<br>起始版本:7|类名:BorderStyle<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:BorderStyle<br>方法 or 属性:Dotted<br>起始版本:7|类名:BorderStyle<br>方法 or 属性:Dotted<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:BorderStyle<br>方法 or 属性:Dashed<br>起始版本:7|类名:BorderStyle<br>方法 or 属性:Dashed<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:BorderStyle<br>方法 or 属性:Solid<br>起始版本:7|类名:BorderStyle<br>方法 or 属性:Solid<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:LineJoinStyle<br>起始版本:7|类名:LineJoinStyle<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:LineJoinStyle<br>方法 or 属性:Miter<br>起始版本:7|类名:LineJoinStyle<br>方法 or 属性:Miter<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:LineJoinStyle<br>方法 or 属性:Round<br>起始版本:7|类名:LineJoinStyle<br>方法 or 属性:Round<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:LineJoinStyle<br>方法 or 属性:Bevel<br>起始版本:7|类名:LineJoinStyle<br>方法 or 属性:Bevel<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TouchType<br>起始版本:7|类名:TouchType<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TouchType<br>方法 or 属性:Down<br>起始版本:7|类名:TouchType<br>方法 or 属性:Down<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TouchType<br>方法 or 属性:Up<br>起始版本:7|类名:TouchType<br>方法 or 属性:Up<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TouchType<br>方法 or 属性:Move<br>起始版本:7|类名:TouchType<br>方法 or 属性:Move<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TouchType<br>方法 or 属性:Cancel<br>起始版本:7|类名:TouchType<br>方法 or 属性:Cancel<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:MouseButton<br>起始版本:8|类名:MouseButton<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:MouseButton<br>方法 or 属性:Left<br>起始版本:8|类名:MouseButton<br>方法 or 属性:Left<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:MouseButton<br>方法 or 属性:Right<br>起始版本:8|类名:MouseButton<br>方法 or 属性:Right<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:MouseButton<br>方法 or 属性:Middle<br>起始版本:8|类名:MouseButton<br>方法 or 属性:Middle<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:MouseButton<br>方法 or 属性:Back<br>起始版本:8|类名:MouseButton<br>方法 or 属性:Back<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:MouseButton<br>方法 or 属性:Forward<br>起始版本:8|类名:MouseButton<br>方法 or 属性:Forward<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:MouseButton<br>方法 or 属性:None<br>起始版本:8|类名:MouseButton<br>方法 or 属性:None<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:MouseAction<br>起始版本:8|类名:MouseAction<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:MouseAction<br>方法 or 属性:Press<br>起始版本:8|类名:MouseAction<br>方法 or 属性:Press<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:MouseAction<br>方法 or 属性:Release<br>起始版本:8|类名:MouseAction<br>方法 or 属性:Release<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:MouseAction<br>方法 or 属性:Move<br>起始版本:8|类名:MouseAction<br>方法 or 属性:Move<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:MouseAction<br>方法 or 属性:Hover<br>起始版本:8|类名:MouseAction<br>方法 or 属性:Hover<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:AnimationStatus<br>起始版本:7|类名:AnimationStatus<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:AnimationStatus<br>方法 or 属性:Initial<br>起始版本:7|类名:AnimationStatus<br>方法 or 属性:Initial<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:AnimationStatus<br>方法 or 属性:Running<br>起始版本:7|类名:AnimationStatus<br>方法 or 属性:Running<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:AnimationStatus<br>方法 or 属性:Paused<br>起始版本:7|类名:AnimationStatus<br>方法 or 属性:Paused<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:AnimationStatus<br>方法 or 属性:Stopped<br>起始版本:7|类名:AnimationStatus<br>方法 or 属性:Stopped<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Curve<br>起始版本:7|类名:Curve<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Curve<br>方法 or 属性:Linear<br>起始版本:7|类名:Curve<br>方法 or 属性:Linear<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Curve<br>方法 or 属性:Ease<br>起始版本:7|类名:Curve<br>方法 or 属性:Ease<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Curve<br>方法 or 属性:EaseIn<br>起始版本:7|类名:Curve<br>方法 or 属性:EaseIn<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Curve<br>方法 or 属性:EaseOut<br>起始版本:7|类名:Curve<br>方法 or 属性:EaseOut<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Curve<br>方法 or 属性:EaseInOut<br>起始版本:7|类名:Curve<br>方法 or 属性:EaseInOut<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Curve<br>方法 or 属性:FastOutSlowIn<br>起始版本:7|类名:Curve<br>方法 or 属性:FastOutSlowIn<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Curve<br>方法 or 属性:LinearOutSlowIn<br>起始版本:7|类名:Curve<br>方法 or 属性:LinearOutSlowIn<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Curve<br>方法 or 属性:FastOutLinearIn<br>起始版本:7|类名:Curve<br>方法 or 属性:FastOutLinearIn<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Curve<br>方法 or 属性:ExtremeDeceleration<br>起始版本:7|类名:Curve<br>方法 or 属性:ExtremeDeceleration<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Curve<br>方法 or 属性:Sharp<br>起始版本:7|类名:Curve<br>方法 or 属性:Sharp<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Curve<br>方法 or 属性:Rhythm<br>起始版本:7|类名:Curve<br>方法 or 属性:Rhythm<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Curve<br>方法 or 属性:Smooth<br>起始版本:7|类名:Curve<br>方法 or 属性:Smooth<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Curve<br>方法 or 属性:Friction<br>起始版本:7|类名:Curve<br>方法 or 属性:Friction<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FillMode<br>起始版本:7|类名:FillMode<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FillMode<br>方法 or 属性:None<br>起始版本:7|类名:FillMode<br>方法 or 属性:None<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FillMode<br>方法 or 属性:Forwards<br>起始版本:7|类名:FillMode<br>方法 or 属性:Forwards<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FillMode<br>方法 or 属性:Backwards<br>起始版本:7|类名:FillMode<br>方法 or 属性:Backwards<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FillMode<br>方法 or 属性:Both<br>起始版本:7|类名:FillMode<br>方法 or 属性:Both<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:PlayMode<br>起始版本:7|类名:PlayMode<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:PlayMode<br>方法 or 属性:Normal<br>起始版本:7|类名:PlayMode<br>方法 or 属性:Normal<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:PlayMode<br>方法 or 属性:Reverse<br>起始版本:7|类名:PlayMode<br>方法 or 属性:Reverse<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:PlayMode<br>方法 or 属性:Alternate<br>起始版本:7|类名:PlayMode<br>方法 or 属性:Alternate<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:PlayMode<br>方法 or 属性:AlternateReverse<br>起始版本:7|类名:PlayMode<br>方法 or 属性:AlternateReverse<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:KeyType<br>起始版本:7|类名:KeyType<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:KeyType<br>方法 or 属性:Down<br>起始版本:7|类名:KeyType<br>方法 or 属性:Down<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:KeyType<br>方法 or 属性:Up<br>起始版本:7|类名:KeyType<br>方法 or 属性:Up<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:KeySource<br>起始版本:7|类名:KeySource<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:KeySource<br>方法 or 属性:Unknown<br>起始版本:7|类名:KeySource<br>方法 or 属性:Unknown<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:KeySource<br>方法 or 属性:Keyboard<br>起始版本:7|类名:KeySource<br>方法 or 属性:Keyboard<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Edge<br>起始版本:7|类名:Edge<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Edge<br>方法 or 属性:Top<br>起始版本:7|类名:Edge<br>方法 or 属性:Top<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Edge<br>方法 or 属性:Bottom<br>起始版本:7|类名:Edge<br>方法 or 属性:Bottom<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Edge<br>方法 or 属性:Start<br>起始版本:7|类名:Edge<br>方法 or 属性:Start<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Edge<br>方法 or 属性:End<br>起始版本:7|类名:Edge<br>方法 or 属性:End<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Week<br>起始版本:7|类名:Week<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Week<br>方法 or 属性:Mon<br>起始版本:7|类名:Week<br>方法 or 属性:Mon<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Week<br>方法 or 属性:Tue<br>起始版本:7|类名:Week<br>方法 or 属性:Tue<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Week<br>方法 or 属性:Wed<br>起始版本:7|类名:Week<br>方法 or 属性:Wed<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Week<br>方法 or 属性:Thur<br>起始版本:7|类名:Week<br>方法 or 属性:Thur<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Week<br>方法 or 属性:Fri<br>起始版本:7|类名:Week<br>方法 or 属性:Fri<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Week<br>方法 or 属性:Sat<br>起始版本:7|类名:Week<br>方法 or 属性:Sat<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Week<br>方法 or 属性:Sun<br>起始版本:7|类名:Week<br>方法 or 属性:Sun<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Direction<br>起始版本:7|类名:Direction<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Direction<br>方法 or 属性:Ltr<br>起始版本:7|类名:Direction<br>方法 or 属性:Ltr<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Direction<br>方法 or 属性:Rtl<br>起始版本:7|类名:Direction<br>方法 or 属性:Rtl<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Direction<br>方法 or 属性:Auto<br>起始版本:7|类名:Direction<br>方法 or 属性:Auto<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:BarState<br>起始版本:7|类名:BarState<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:BarState<br>方法 or 属性:Off<br>起始版本:7|类名:BarState<br>方法 or 属性:Off<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:BarState<br>方法 or 属性:Auto<br>起始版本:7|类名:BarState<br>方法 or 属性:Auto<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:BarState<br>方法 or 属性:On<br>起始版本:7|类名:BarState<br>方法 or 属性:On<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:EdgeEffect<br>起始版本:7|类名:EdgeEffect<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:EdgeEffect<br>方法 or 属性:Spring<br>起始版本:7|类名:EdgeEffect<br>方法 or 属性:Spring<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:EdgeEffect<br>方法 or 属性:Fade<br>起始版本:7|类名:EdgeEffect<br>方法 or 属性:Fade<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:EdgeEffect<br>方法 or 属性:None<br>起始版本:7|类名:EdgeEffect<br>方法 or 属性:None<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Alignment<br>起始版本:7|类名:Alignment<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Alignment<br>方法 or 属性:TopStart<br>起始版本:7|类名:Alignment<br>方法 or 属性:TopStart<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Alignment<br>方法 or 属性:Top<br>起始版本:7|类名:Alignment<br>方法 or 属性:Top<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Alignment<br>方法 or 属性:TopEnd<br>起始版本:7|类名:Alignment<br>方法 or 属性:TopEnd<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Alignment<br>方法 or 属性:Start<br>起始版本:7|类名:Alignment<br>方法 or 属性:Start<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Alignment<br>方法 or 属性:Center<br>起始版本:7|类名:Alignment<br>方法 or 属性:Center<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Alignment<br>方法 or 属性:End<br>起始版本:7|类名:Alignment<br>方法 or 属性:End<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Alignment<br>方法 or 属性:BottomStart<br>起始版本:7|类名:Alignment<br>方法 or 属性:BottomStart<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Alignment<br>方法 or 属性:Bottom<br>起始版本:7|类名:Alignment<br>方法 or 属性:Bottom<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Alignment<br>方法 or 属性:BottomEnd<br>起始版本:7|类名:Alignment<br>方法 or 属性:BottomEnd<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TransitionType<br>起始版本:7|类名:TransitionType<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TransitionType<br>方法 or 属性:All<br>起始版本:7|类名:TransitionType<br>方法 or 属性:All<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TransitionType<br>方法 or 属性:Insert<br>起始版本:7|类名:TransitionType<br>方法 or 属性:Insert<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TransitionType<br>方法 or 属性:Delete<br>起始版本:7|类名:TransitionType<br>方法 or 属性:Delete<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:RelateType<br>起始版本:7|类名:RelateType<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:RelateType<br>方法 or 属性:FILL<br>起始版本:7|类名:RelateType<br>方法 or 属性:FILL<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:RelateType<br>方法 or 属性:FIT<br>起始版本:7|类名:RelateType<br>方法 or 属性:FIT<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Visibility<br>起始版本:7|类名:Visibility<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Visibility<br>方法 or 属性:Visible<br>起始版本:7|类名:Visibility<br>方法 or 属性:Visible<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Visibility<br>方法 or 属性:Hidden<br>起始版本:7|类名:Visibility<br>方法 or 属性:Hidden<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Visibility<br>方法 or 属性:None<br>起始版本:7|类名:Visibility<br>方法 or 属性:None<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:LineCapStyle<br>起始版本:7|类名:LineCapStyle<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:LineCapStyle<br>方法 or 属性:Butt<br>起始版本:7|类名:LineCapStyle<br>方法 or 属性:Butt<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:LineCapStyle<br>方法 or 属性:Round<br>起始版本:7|类名:LineCapStyle<br>方法 or 属性:Round<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:LineCapStyle<br>方法 or 属性:Square<br>起始版本:7|类名:LineCapStyle<br>方法 or 属性:Square<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Axis<br>起始版本:7|类名:Axis<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Axis<br>方法 or 属性:Vertical<br>起始版本:7|类名:Axis<br>方法 or 属性:Vertical<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Axis<br>方法 or 属性:Horizontal<br>起始版本:7|类名:Axis<br>方法 or 属性:Horizontal<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:HorizontalAlign<br>起始版本:7|类名:HorizontalAlign<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:HorizontalAlign<br>方法 or 属性:Start<br>起始版本:7|类名:HorizontalAlign<br>方法 or 属性:Start<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:HorizontalAlign<br>方法 or 属性:Center<br>起始版本:7|类名:HorizontalAlign<br>方法 or 属性:Center<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:HorizontalAlign<br>方法 or 属性:End<br>起始版本:7|类名:HorizontalAlign<br>方法 or 属性:End<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexAlign<br>起始版本:7|类名:FlexAlign<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexAlign<br>方法 or 属性:Start<br>起始版本:7|类名:FlexAlign<br>方法 or 属性:Start<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexAlign<br>方法 or 属性:Center<br>起始版本:7|类名:FlexAlign<br>方法 or 属性:Center<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexAlign<br>方法 or 属性:End<br>起始版本:7|类名:FlexAlign<br>方法 or 属性:End<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexAlign<br>方法 or 属性:SpaceBetween<br>起始版本:7|类名:FlexAlign<br>方法 or 属性:SpaceBetween<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexAlign<br>方法 or 属性:SpaceAround<br>起始版本:7|类名:FlexAlign<br>方法 or 属性:SpaceAround<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexAlign<br>方法 or 属性:SpaceEvenly<br>起始版本:7|类名:FlexAlign<br>方法 or 属性:SpaceEvenly<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ItemAlign<br>起始版本:7|类名:ItemAlign<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ItemAlign<br>方法 or 属性:Auto<br>起始版本:7|类名:ItemAlign<br>方法 or 属性:Auto<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ItemAlign<br>方法 or 属性:Start<br>起始版本:7|类名:ItemAlign<br>方法 or 属性:Start<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ItemAlign<br>方法 or 属性:Center<br>起始版本:7|类名:ItemAlign<br>方法 or 属性:Center<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ItemAlign<br>方法 or 属性:End<br>起始版本:7|类名:ItemAlign<br>方法 or 属性:End<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ItemAlign<br>方法 or 属性:Baseline<br>起始版本:7|类名:ItemAlign<br>方法 or 属性:Baseline<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ItemAlign<br>方法 or 属性:Stretch<br>起始版本:7|类名:ItemAlign<br>方法 or 属性:Stretch<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexDirection<br>起始版本:7|类名:FlexDirection<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexDirection<br>方法 or 属性:Row<br>起始版本:7|类名:FlexDirection<br>方法 or 属性:Row<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexDirection<br>方法 or 属性:Column<br>起始版本:7|类名:FlexDirection<br>方法 or 属性:Column<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexDirection<br>方法 or 属性:RowReverse<br>起始版本:7|类名:FlexDirection<br>方法 or 属性:RowReverse<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexDirection<br>方法 or 属性:ColumnReverse<br>起始版本:7|类名:FlexDirection<br>方法 or 属性:ColumnReverse<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexWrap<br>起始版本:7|类名:FlexWrap<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexWrap<br>方法 or 属性:NoWrap<br>起始版本:7|类名:FlexWrap<br>方法 or 属性:NoWrap<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexWrap<br>方法 or 属性:Wrap<br>起始版本:7|类名:FlexWrap<br>方法 or 属性:Wrap<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexWrap<br>方法 or 属性:WrapReverse<br>起始版本:7|类名:FlexWrap<br>方法 or 属性:WrapReverse<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:VerticalAlign<br>起始版本:7|类名:VerticalAlign<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:VerticalAlign<br>方法 or 属性:Top<br>起始版本:7|类名:VerticalAlign<br>方法 or 属性:Top<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:VerticalAlign<br>方法 or 属性:Center<br>起始版本:7|类名:VerticalAlign<br>方法 or 属性:Center<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:VerticalAlign<br>方法 or 属性:Bottom<br>起始版本:7|类名:VerticalAlign<br>方法 or 属性:Bottom<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageRepeat<br>起始版本:7|类名:ImageRepeat<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageRepeat<br>方法 or 属性:NoRepeat<br>起始版本:7|类名:ImageRepeat<br>方法 or 属性:NoRepeat<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageRepeat<br>方法 or 属性:X<br>起始版本:7|类名:ImageRepeat<br>方法 or 属性:X<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageRepeat<br>方法 or 属性:Y<br>起始版本:7|类名:ImageRepeat<br>方法 or 属性:Y<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageRepeat<br>方法 or 属性:XY<br>起始版本:7|类名:ImageRepeat<br>方法 or 属性:XY<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageSize<br>起始版本:7|类名:ImageSize<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageSize<br>方法 or 属性:Auto<br>起始版本:7|类名:ImageSize<br>方法 or 属性:Auto<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageSize<br>方法 or 属性:Cover<br>起始版本:7|类名:ImageSize<br>方法 or 属性:Cover<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ImageSize<br>方法 or 属性:Contain<br>起始版本:7|类名:ImageSize<br>方法 or 属性:Contain<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:GradientDirection<br>起始版本:7|类名:GradientDirection<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:GradientDirection<br>方法 or 属性:Left<br>起始版本:7|类名:GradientDirection<br>方法 or 属性:Left<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:GradientDirection<br>方法 or 属性:Top<br>起始版本:7|类名:GradientDirection<br>方法 or 属性:Top<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:GradientDirection<br>方法 or 属性:Right<br>起始版本:7|类名:GradientDirection<br>方法 or 属性:Right<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:GradientDirection<br>方法 or 属性:Bottom<br>起始版本:7|类名:GradientDirection<br>方法 or 属性:Bottom<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:GradientDirection<br>方法 or 属性:LeftTop<br>起始版本:7|类名:GradientDirection<br>方法 or 属性:LeftTop<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:GradientDirection<br>方法 or 属性:LeftBottom<br>起始版本:7|类名:GradientDirection<br>方法 or 属性:LeftBottom<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:GradientDirection<br>方法 or 属性:RightTop<br>起始版本:7|类名:GradientDirection<br>方法 or 属性:RightTop<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:GradientDirection<br>方法 or 属性:RightBottom<br>起始版本:7|类名:GradientDirection<br>方法 or 属性:RightBottom<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:GradientDirection<br>方法 or 属性:None<br>起始版本:7|类名:GradientDirection<br>方法 or 属性:None<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:SharedTransitionEffectType<br>起始版本:7|类名:SharedTransitionEffectType<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:SharedTransitionEffectType<br>方法 or 属性:Static<br>起始版本:7|类名:SharedTransitionEffectType<br>方法 or 属性:Static<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:SharedTransitionEffectType<br>方法 or 属性:Exchange<br>起始版本:7|类名:SharedTransitionEffectType<br>方法 or 属性:Exchange<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FontStyle<br>起始版本:7|类名:FontStyle<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FontStyle<br>方法 or 属性:Normal<br>起始版本:7|类名:FontStyle<br>方法 or 属性:Normal<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FontStyle<br>方法 or 属性:Italic<br>起始版本:7|类名:FontStyle<br>方法 or 属性:Italic<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FontWeight<br>起始版本:7|类名:FontWeight<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FontWeight<br>方法 or 属性:Lighter<br>起始版本:7|类名:FontWeight<br>方法 or 属性:Lighter<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FontWeight<br>方法 or 属性:Normal<br>起始版本:7|类名:FontWeight<br>方法 or 属性:Normal<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FontWeight<br>方法 or 属性:Regular<br>起始版本:7|类名:FontWeight<br>方法 or 属性:Regular<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FontWeight<br>方法 or 属性:Medium<br>起始版本:7|类名:FontWeight<br>方法 or 属性:Medium<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FontWeight<br>方法 or 属性:Bold<br>起始版本:7|类名:FontWeight<br>方法 or 属性:Bold<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FontWeight<br>方法 or 属性:Bolder<br>起始版本:7|类名:FontWeight<br>方法 or 属性:Bolder<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextAlign<br>起始版本:7|类名:TextAlign<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextAlign<br>方法 or 属性:Center<br>起始版本:7|类名:TextAlign<br>方法 or 属性:Center<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextAlign<br>方法 or 属性:Start<br>起始版本:7|类名:TextAlign<br>方法 or 属性:Start<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextAlign<br>方法 or 属性:End<br>起始版本:7|类名:TextAlign<br>方法 or 属性:End<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextOverflow<br>起始版本:7|类名:TextOverflow<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextOverflow<br>方法 or 属性:Clip<br>起始版本:7|类名:TextOverflow<br>方法 or 属性:Clip<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextOverflow<br>方法 or 属性:Ellipsis<br>起始版本:7|类名:TextOverflow<br>方法 or 属性:Ellipsis<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextOverflow<br>方法 or 属性:None<br>起始版本:7|类名:TextOverflow<br>方法 or 属性:None<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextDecorationType<br>起始版本:7|类名:TextDecorationType<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextDecorationType<br>方法 or 属性:None<br>起始版本:7|类名:TextDecorationType<br>方法 or 属性:None<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextDecorationType<br>方法 or 属性:Underline<br>起始版本:7|类名:TextDecorationType<br>方法 or 属性:Underline<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextDecorationType<br>方法 or 属性:Overline<br>起始版本:7|类名:TextDecorationType<br>方法 or 属性:Overline<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextDecorationType<br>方法 or 属性:LineThrough<br>起始版本:7|类名:TextDecorationType<br>方法 or 属性:LineThrough<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextCase<br>起始版本:7|类名:TextCase<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextCase<br>方法 or 属性:Normal<br>起始版本:7|类名:TextCase<br>方法 or 属性:Normal<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextCase<br>方法 or 属性:LowerCase<br>起始版本:7|类名:TextCase<br>方法 or 属性:LowerCase<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:TextCase<br>方法 or 属性:UpperCase<br>起始版本:7|类名:TextCase<br>方法 or 属性:UpperCase<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ResponseType<br>起始版本:8|类名:ResponseType<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ResponseType<br>方法 or 属性:RightClick<br>起始版本:8|类名:ResponseType<br>方法 or 属性:RightClick<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:ResponseType<br>方法 or 属性:LongPress<br>起始版本:8|类名:ResponseType<br>方法 or 属性:LongPress<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:HoverEffect<br>起始版本:8|类名:HoverEffect<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:HoverEffect<br>方法 or 属性:Auto<br>起始版本:8|类名:HoverEffect<br>方法 or 属性:Auto<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:HoverEffect<br>方法 or 属性:Scale<br>起始版本:8|类名:HoverEffect<br>方法 or 属性:Scale<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:HoverEffect<br>方法 or 属性:Highlight<br>起始版本:8|类名:HoverEffect<br>方法 or 属性:Highlight<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:HoverEffect<br>方法 or 属性:None<br>起始版本:8|类名:HoverEffect<br>方法 or 属性:None<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Placement<br>起始版本:8|类名:Placement<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Placement<br>方法 or 属性:Left<br>起始版本:8|类名:Placement<br>方法 or 属性:Left<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Placement<br>方法 or 属性:Right<br>起始版本:8|类名:Placement<br>方法 or 属性:Right<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Placement<br>方法 or 属性:Top<br>起始版本:8|类名:Placement<br>方法 or 属性:Top<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Placement<br>方法 or 属性:Bottom<br>起始版本:8|类名:Placement<br>方法 or 属性:Bottom<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Placement<br>方法 or 属性:TopLeft<br>起始版本:8|类名:Placement<br>方法 or 属性:TopLeft<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Placement<br>方法 or 属性:TopRight<br>起始版本:8|类名:Placement<br>方法 or 属性:TopRight<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Placement<br>方法 or 属性:BottomLeft<br>起始版本:8|类名:Placement<br>方法 or 属性:BottomLeft<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:Placement<br>方法 or 属性:BottomRight<br>起始版本:8|类名:Placement<br>方法 or 属性:BottomRight<br>起始版本:9|enums.d.ts| +|起始版本有变化|类名:FlexOptions<br>起始版本:7|类名:FlexOptions<br>起始版本:9|flex.d.ts| +|起始版本有变化|类名:FlexOptions<br>方法 or 属性:direction?: FlexDirection;<br>起始版本:7|类名:FlexOptions<br>方法 or 属性:direction?: FlexDirection;<br>起始版本:9|flex.d.ts| +|起始版本有变化|类名:FlexOptions<br>方法 or 属性:wrap?: FlexWrap;<br>起始版本:7|类名:FlexOptions<br>方法 or 属性:wrap?: FlexWrap;<br>起始版本:9|flex.d.ts| +|起始版本有变化|类名:FlexOptions<br>方法 or 属性:justifyContent?: FlexAlign;<br>起始版本:7|类名:FlexOptions<br>方法 or 属性:justifyContent?: FlexAlign;<br>起始版本:9|flex.d.ts| +|起始版本有变化|类名:FlexOptions<br>方法 or 属性:alignItems?: ItemAlign;<br>起始版本:7|类名:FlexOptions<br>方法 or 属性:alignItems?: ItemAlign;<br>起始版本:9|flex.d.ts| +|起始版本有变化|类名:FlexOptions<br>方法 or 属性:alignContent?: FlexAlign;<br>起始版本:7|类名:FlexOptions<br>方法 or 属性:alignContent?: FlexAlign;<br>起始版本:9|flex.d.ts| +|起始版本有变化|类名:FlexInterface<br>起始版本:7|类名:FlexInterface<br>起始版本:9|flex.d.ts| +|起始版本有变化|类名:FlexInterface<br>方法 or 属性:(value?: FlexOptions): FlexAttribute;<br>起始版本:7|类名:FlexInterface<br>方法 or 属性:(value?: FlexOptions): FlexAttribute;<br>起始版本:9|flex.d.ts| +|起始版本有变化|类名:FlexAttribute<br>起始版本:7|类名:FlexAttribute<br>起始版本:9|flex.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Flex: FlexInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Flex: FlexInterface;<br>起始版本:9|flex.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const FlexInstance: FlexAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const FlexInstance: FlexAttribute;<br>起始版本:9|flex.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const FormComponent: FormComponentInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const FormComponent: FormComponentInterface;<br>起始版本:7|form_component.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const FormComponentInstance: FormComponentAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const FormComponentInstance: FormComponentAttribute;<br>起始版本:7|form_component.d.ts| +|起始版本有变化|类名:ForEachInterface<br>起始版本:7|类名:ForEachInterface<br>起始版本:9|for_each.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ForEach: ForEachInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ForEach: ForEachInterface;<br>起始版本:9|for_each.d.ts| +|起始版本有变化|类名:GaugeInterface<br>起始版本:8|类名:GaugeInterface<br>起始版本:9|gauge.d.ts| +|起始版本有变化|类名:GaugeInterface<br>方法 or 属性:(options: { value: number; min?: number; max?: number }): GaugeAttribute;<br>起始版本:8|类名:GaugeInterface<br>方法 or 属性:(options: { value: number; min?: number; max?: number }): GaugeAttribute;<br>起始版本:9|gauge.d.ts| +|起始版本有变化|类名:GaugeAttribute<br>起始版本:8|类名:GaugeAttribute<br>起始版本:9|gauge.d.ts| +|起始版本有变化|类名:GaugeAttribute<br>方法 or 属性:value(value: number): GaugeAttribute;<br>起始版本:8|类名:GaugeAttribute<br>方法 or 属性:value(value: number): GaugeAttribute;<br>起始版本:9|gauge.d.ts| +|起始版本有变化|类名:GaugeAttribute<br>方法 or 属性:startAngle(angle: number): GaugeAttribute;<br>起始版本:8|类名:GaugeAttribute<br>方法 or 属性:startAngle(angle: number): GaugeAttribute;<br>起始版本:9|gauge.d.ts| +|起始版本有变化|类名:GaugeAttribute<br>方法 or 属性:endAngle(angle: number): GaugeAttribute;<br>起始版本:8|类名:GaugeAttribute<br>方法 or 属性:endAngle(angle: number): GaugeAttribute;<br>起始版本:9|gauge.d.ts| +|起始版本有变化|类名:GaugeAttribute<br>方法 or 属性:colors(colors: Array\<any>): GaugeAttribute;<br>起始版本:8|类名:GaugeAttribute<br>方法 or 属性:colors(colors: Array\<any>): GaugeAttribute;<br>起始版本:9|gauge.d.ts| +|起始版本有变化|类名:GaugeAttribute<br>方法 or 属性:strokeWidth(length: Length): GaugeAttribute;<br>起始版本:8|类名:GaugeAttribute<br>方法 or 属性:strokeWidth(length: Length): GaugeAttribute;<br>起始版本:9|gauge.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Gauge: GaugeInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Gauge: GaugeInterface;<br>起始版本:9|gauge.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const GaugeInstance: GaugeAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const GaugeInstance: GaugeAttribute;<br>起始版本:9|gauge.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TapGesture: TapGestureInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TapGesture: TapGestureInterface;<br>起始版本:7|gesture.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const LongPressGesture: LongPressGestureInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const LongPressGesture: LongPressGestureInterface;<br>起始版本:7|gesture.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const PanGesture: PanGestureInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const PanGesture: PanGestureInterface;<br>起始版本:7|gesture.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const SwipeGesture: SwipeGestureInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const SwipeGesture: SwipeGestureInterface;<br>起始版本:7|gesture.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const PinchGesture: PinchGestureInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const PinchGesture: PinchGestureInterface;<br>起始版本:7|gesture.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const RotationGesture: RotationGestureInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const RotationGesture: RotationGestureInterface;<br>起始版本:7|gesture.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const GestureGroup: GestureGroupInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const GestureGroup: GestureGroupInterface;<br>起始版本:7|gesture.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Grid: GridInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Grid: GridInterface;<br>起始版本:7|grid.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const GridInstance: GridAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const GridInstance: GridAttribute;<br>起始版本:7|grid.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const GridItem: GridItemInterface<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const GridItem: GridItemInterface<br>起始版本:7|gridItem.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const GridItemInstance: GridItemAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const GridItemInstance: GridItemAttribute;<br>起始版本:7|gridItem.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const GridContainer: GridContainerInterface<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const GridContainer: GridContainerInterface<br>起始版本:7|grid_container.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const GridContainerInstance: GridContainerAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const GridContainerInstance: GridContainerAttribute;<br>起始版本:7|grid_container.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Hyperlink: HyperlinkInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Hyperlink: HyperlinkInterface;<br>起始版本:7|hyperlink.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const HyperlinkInterface: HyperlinkAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const HyperlinkInterface: HyperlinkAttribute;<br>起始版本:7|hyperlink.d.ts| +|起始版本有变化|类名:ImageRenderMode<br>起始版本:7|类名:ImageRenderMode<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageRenderMode<br>方法 or 属性:Original<br>起始版本:7|类名:ImageRenderMode<br>方法 or 属性:Original<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageRenderMode<br>方法 or 属性:Template<br>起始版本:7|类名:ImageRenderMode<br>方法 or 属性:Template<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageInterpolation<br>起始版本:7|类名:ImageInterpolation<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageInterpolation<br>方法 or 属性:None<br>起始版本:7|类名:ImageInterpolation<br>方法 or 属性:None<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageInterpolation<br>方法 or 属性:Low<br>起始版本:7|类名:ImageInterpolation<br>方法 or 属性:Low<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageInterpolation<br>方法 or 属性:Medium<br>起始版本:7|类名:ImageInterpolation<br>方法 or 属性:Medium<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageInterpolation<br>方法 or 属性:High<br>起始版本:7|类名:ImageInterpolation<br>方法 or 属性:High<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageInterface<br>起始版本:7|类名:ImageInterface<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageInterface<br>方法 or 属性:(src: string \| PixelMap \| Resource): ImageAttribute;<br>起始版本:7|类名:ImageInterface<br>方法 or 属性:(src: string \| PixelMap \| Resource): ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageAttribute<br>起始版本:7|类名:ImageAttribute<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageAttribute<br>方法 or 属性:alt(value: string \| Resource): ImageAttribute;<br>起始版本:7|类名:ImageAttribute<br>方法 or 属性:alt(value: string \| Resource): ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageAttribute<br>方法 or 属性:matchTextDirection(value: boolean): ImageAttribute;<br>起始版本:7|类名:ImageAttribute<br>方法 or 属性:matchTextDirection(value: boolean): ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageAttribute<br>方法 or 属性:fitOriginalSize(value: boolean): ImageAttribute;<br>起始版本:7|类名:ImageAttribute<br>方法 or 属性:fitOriginalSize(value: boolean): ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageAttribute<br>方法 or 属性:fillColor(value: ResourceColor): ImageAttribute;<br>起始版本:7|类名:ImageAttribute<br>方法 or 属性:fillColor(value: ResourceColor): ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageAttribute<br>方法 or 属性:objectFit(value: ImageFit): ImageAttribute;<br>起始版本:7|类名:ImageAttribute<br>方法 or 属性:objectFit(value: ImageFit): ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageAttribute<br>方法 or 属性:objectRepeat(value: ImageRepeat): ImageAttribute;<br>起始版本:7|类名:ImageAttribute<br>方法 or 属性:objectRepeat(value: ImageRepeat): ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageAttribute<br>方法 or 属性:autoResize(value: boolean): ImageAttribute;<br>起始版本:7|类名:ImageAttribute<br>方法 or 属性:autoResize(value: boolean): ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageAttribute<br>方法 or 属性:renderMode(value: ImageRenderMode): ImageAttribute;<br>起始版本:7|类名:ImageAttribute<br>方法 or 属性:renderMode(value: ImageRenderMode): ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageAttribute<br>方法 or 属性:interpolation(value: ImageInterpolation): ImageAttribute;<br>起始版本:7|类名:ImageAttribute<br>方法 or 属性:interpolation(value: ImageInterpolation): ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageAttribute<br>方法 or 属性:sourceSize(value: { width: number; height: number }): ImageAttribute;<br>起始版本:7|类名:ImageAttribute<br>方法 or 属性:sourceSize(value: { width: number; height: number }): ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageAttribute<br>方法 or 属性:syncLoad(value: boolean): ImageAttribute;<br>起始版本:8|类名:ImageAttribute<br>方法 or 属性:syncLoad(value: boolean): ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageAttribute<br>方法 or 属性:onComplete(<br> callback: (event?: {<br> width: number;<br> height: number;<br> componentWidth: number;<br> componentHeight: number;<br> loadingStatus: number;<br> }) => void,<br> ): ImageAttribute;<br>起始版本:7|类名:ImageAttribute<br>方法 or 属性:onComplete(<br> callback: (event?: {<br> width: number;<br> height: number;<br> componentWidth: number;<br> componentHeight: number;<br> loadingStatus: number;<br> }) => void,<br> ): ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageAttribute<br>方法 or 属性:onError(callback: (event?: { componentWidth: number; componentHeight: number }) => void): ImageAttribute;<br>起始版本:7|类名:ImageAttribute<br>方法 or 属性:onError(callback: (event?: { componentWidth: number; componentHeight: number }) => void): ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:ImageAttribute<br>方法 or 属性:onFinish(event: () => void): ImageAttribute;<br>起始版本:7|类名:ImageAttribute<br>方法 or 属性:onFinish(event: () => void): ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Image: ImageInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Image: ImageInterface;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ImageInstance: ImageAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ImageInstance: ImageAttribute;<br>起始版本:9|image.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ImageAnimator: ImageAnimatorInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ImageAnimator: ImageAnimatorInterface;<br>起始版本:7|image_animator.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ImageAnimatorInstance: ImageAnimatorAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ImageAnimatorInstance: ImageAnimatorAttribute;<br>起始版本:7|image_animator.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const LazyForEach: LazyForEachInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const LazyForEach: LazyForEachInterface;<br>起始版本:7|lazy_for_each.d.ts| +|起始版本有变化|类名:LineInterface<br>起始版本:7|类名:LineInterface<br>起始版本:9|line.d.ts| +|起始版本有变化|类名:LineInterface<br>方法 or 属性:new (value?: { width?: string \| number; height?: string \| number }): LineAttribute;<br>起始版本:7|类名:LineInterface<br>方法 or 属性:new (value?: { width?: string \| number; height?: string \| number }): LineAttribute;<br>起始版本:9|line.d.ts| +|起始版本有变化|类名:LineInterface<br>方法 or 属性:(value?: { width?: string \| number; height?: string \| number }): LineAttribute;<br>起始版本:7|类名:LineInterface<br>方法 or 属性:(value?: { width?: string \| number; height?: string \| number }): LineAttribute;<br>起始版本:9|line.d.ts| +|起始版本有变化|类名:LineAttribute<br>起始版本:7|类名:LineAttribute<br>起始版本:9|line.d.ts| +|起始版本有变化|类名:LineAttribute<br>方法 or 属性:startPoint(value: Array\<any>): LineAttribute;<br>起始版本:7|类名:LineAttribute<br>方法 or 属性:startPoint(value: Array\<any>): LineAttribute;<br>起始版本:9|line.d.ts| +|起始版本有变化|类名:LineAttribute<br>方法 or 属性:endPoint(value: Array\<any>): LineAttribute;<br>起始版本:7|类名:LineAttribute<br>方法 or 属性:endPoint(value: Array\<any>): LineAttribute;<br>起始版本:9|line.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Line: LineInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Line: LineInterface;<br>起始版本:9|line.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const LineInstance: LineAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const LineInstance: LineAttribute;<br>起始版本:9|line.d.ts| +|起始版本有变化|类名:ScrollState<br>起始版本:7|类名:ScrollState<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ScrollState<br>方法 or 属性:Idle<br>起始版本:7|类名:ScrollState<br>方法 or 属性:Idle<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ScrollState<br>方法 or 属性:Scroll<br>起始版本:7|类名:ScrollState<br>方法 or 属性:Scroll<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ScrollState<br>方法 or 属性:Fling<br>起始版本:7|类名:ScrollState<br>方法 or 属性:Fling<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListInterface<br>起始版本:7|类名:ListInterface<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListInterface<br>方法 or 属性:(value?: { initialIndex?: number; space?: number \| string; scroller?: Scroller }): ListAttribute;<br>起始版本:7|类名:ListInterface<br>方法 or 属性:(value?: { initialIndex?: number; space?: number \| string; scroller?: Scroller }): ListAttribute;<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListAttribute<br>起始版本:7|类名:ListAttribute<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListAttribute<br>方法 or 属性:listDirection(value: Axis): ListAttribute;<br>起始版本:7|类名:ListAttribute<br>方法 or 属性:listDirection(value: Axis): ListAttribute;<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListAttribute<br>方法 or 属性:scrollBar(value: BarState): ListAttribute;<br>起始版本:7|类名:ListAttribute<br>方法 or 属性:scrollBar(value: BarState): ListAttribute;<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListAttribute<br>方法 or 属性:edgeEffect(value: EdgeEffect): ListAttribute;<br>起始版本:7|类名:ListAttribute<br>方法 or 属性:edgeEffect(value: EdgeEffect): ListAttribute;<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListAttribute<br>方法 or 属性:divider(<br> value: {<br> strokeWidth: Length;<br> color?: ResourceColor;<br> startMargin?: Length;<br> endMargin?: Length;<br> } \| null,<br> ): ListAttribute;<br>起始版本:7|类名:ListAttribute<br>方法 or 属性:divider(<br> value: {<br> strokeWidth: Length;<br> color?: ResourceColor;<br> startMargin?: Length;<br> endMargin?: Length;<br> } \| null,<br> ): ListAttribute;<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListAttribute<br>方法 or 属性:multiSelectable(value: boolean): ListAttribute;<br>起始版本:8|类名:ListAttribute<br>方法 or 属性:multiSelectable(value: boolean): ListAttribute;<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListAttribute<br>方法 or 属性:cachedCount(value: number): ListAttribute;<br>起始版本:7|类名:ListAttribute<br>方法 or 属性:cachedCount(value: number): ListAttribute;<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListAttribute<br>方法 or 属性:chainAnimation(value: boolean): ListAttribute;<br>起始版本:7|类名:ListAttribute<br>方法 or 属性:chainAnimation(value: boolean): ListAttribute;<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListAttribute<br>方法 or 属性:onScroll(event: (scrollOffset: number, scrollState: ScrollState) => void): ListAttribute;<br>起始版本:7|类名:ListAttribute<br>方法 or 属性:onScroll(event: (scrollOffset: number, scrollState: ScrollState) => void): ListAttribute;<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListAttribute<br>方法 or 属性:onScrollIndex(event: (start: number, end: number) => void): ListAttribute;<br>起始版本:7|类名:ListAttribute<br>方法 or 属性:onScrollIndex(event: (start: number, end: number) => void): ListAttribute;<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListAttribute<br>方法 or 属性:onReachStart(event: () => void): ListAttribute;<br>起始版本:7|类名:ListAttribute<br>方法 or 属性:onReachStart(event: () => void): ListAttribute;<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListAttribute<br>方法 or 属性:onReachEnd(event: () => void): ListAttribute;<br>起始版本:7|类名:ListAttribute<br>方法 or 属性:onReachEnd(event: () => void): ListAttribute;<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListAttribute<br>方法 or 属性:onScrollStop(event: () => void): ListAttribute;<br>起始版本:7|类名:ListAttribute<br>方法 or 属性:onScrollStop(event: () => void): ListAttribute;<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const List: ListInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const List: ListInterface;<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ListInstance: ListAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ListInstance: ListAttribute;<br>起始版本:9|list.d.ts| +|起始版本有变化|类名:ListItemInterface<br>起始版本:7|类名:ListItemInterface<br>起始版本:9|list_item.d.ts| +|起始版本有变化|类名:ListItemInterface<br>方法 or 属性:(value?: string): ListItemAttribute;<br>起始版本:7|类名:ListItemInterface<br>方法 or 属性:(value?: string): ListItemAttribute;<br>起始版本:9|list_item.d.ts| +|起始版本有变化|类名:ListItemAttribute<br>起始版本:7|类名:ListItemAttribute<br>起始版本:9|list_item.d.ts| +|起始版本有变化|类名:ListItemAttribute<br>方法 or 属性:onSelect(event: (isSelected: boolean) => void): ListItemAttribute;<br>起始版本:8|类名:ListItemAttribute<br>方法 or 属性:onSelect(event: (isSelected: boolean) => void): ListItemAttribute;<br>起始版本:9|list_item.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ListItemInstance: ListItemAttribute;<br>起始版本:7|类名:global<br>方法 or 属性:declare const ListItemInstance: ListItemAttribute;<br>起始版本:9|list_item.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ListItem: ListItemInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ListItem: ListItemInterface;<br>起始版本:9|list_item.d.ts| +|起始版本有变化|类名:LoadingProgressStyle<br>起始版本:8|类名:LoadingProgressStyle<br>起始版本:9|loading_progress.d.ts| +|起始版本有变化|类名:LoadingProgressStyle<br>方法 or 属性:Default<br>起始版本:8|类名:LoadingProgressStyle<br>方法 or 属性:Default<br>起始版本:9|loading_progress.d.ts| +|起始版本有变化|类名:LoadingProgressStyle<br>方法 or 属性:Circular<br>起始版本:8|类名:LoadingProgressStyle<br>方法 or 属性:Circular<br>起始版本:9|loading_progress.d.ts| +|起始版本有变化|类名:LoadingProgressStyle<br>方法 or 属性:Orbital<br>起始版本:8|类名:LoadingProgressStyle<br>方法 or 属性:Orbital<br>起始版本:9|loading_progress.d.ts| +|起始版本有变化|类名:LoadingProgressInterface<br>起始版本:8|类名:LoadingProgressInterface<br>起始版本:9|loading_progress.d.ts| +|起始版本有变化|类名:LoadingProgressInterface<br>方法 or 属性:(): LoadingProgressAttribute;<br>起始版本:8|类名:LoadingProgressInterface<br>方法 or 属性:(): LoadingProgressAttribute;<br>起始版本:9|loading_progress.d.ts| +|起始版本有变化|类名:LoadingProgressAttribute<br>起始版本:8|类名:LoadingProgressAttribute<br>起始版本:9|loading_progress.d.ts| +|起始版本有变化|类名:LoadingProgressAttribute<br>方法 or 属性:color(value: ResourceColor): LoadingProgressAttribute;<br>起始版本:8|类名:LoadingProgressAttribute<br>方法 or 属性:color(value: ResourceColor): LoadingProgressAttribute;<br>起始版本:9|loading_progress.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const LoadingProgress: LoadingProgressInterface;<br>起始版本:8|类名:global<br>方法 or 属性:declare const LoadingProgress: LoadingProgressInterface;<br>起始版本:9|loading_progress.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const LoadingProgressInstance: LoadingProgressAttribute;<br>起始版本:8|类名:global<br>方法 or 属性:declare const LoadingProgressInstance: LoadingProgressAttribute;<br>起始版本:9|loading_progress.d.ts| +|起始版本有变化|类名:MarqueeInterface<br>起始版本:8|类名:MarqueeInterface<br>起始版本:9|marquee.d.ts| +|起始版本有变化|类名:MarqueeInterface<br>方法 or 属性:(value: { start: boolean; step?: number; loop?: number; fromStart?: boolean; src: string }): MarqueeAttribute;<br>起始版本:8|类名:MarqueeInterface<br>方法 or 属性:(value: { start: boolean; step?: number; loop?: number; fromStart?: boolean; src: string }): MarqueeAttribute;<br>起始版本:9|marquee.d.ts| +|起始版本有变化|类名:MarqueeAttribute<br>起始版本:8|类名:MarqueeAttribute<br>起始版本:9|marquee.d.ts| +|起始版本有变化|类名:MarqueeAttribute<br>方法 or 属性:fontColor(value: ResourceColor): MarqueeAttribute;<br>起始版本:8|类名:MarqueeAttribute<br>方法 or 属性:fontColor(value: ResourceColor): MarqueeAttribute;<br>起始版本:9|marquee.d.ts| +|起始版本有变化|类名:MarqueeAttribute<br>方法 or 属性:fontSize(value: Length): MarqueeAttribute;<br>起始版本:8|类名:MarqueeAttribute<br>方法 or 属性:fontSize(value: Length): MarqueeAttribute;<br>起始版本:9|marquee.d.ts| +|起始版本有变化|类名:MarqueeAttribute<br>方法 or 属性:allowScale(value: boolean): MarqueeAttribute;<br>起始版本:8|类名:MarqueeAttribute<br>方法 or 属性:allowScale(value: boolean): MarqueeAttribute;<br>起始版本:9|marquee.d.ts| +|起始版本有变化|类名:MarqueeAttribute<br>方法 or 属性:fontWeight(value: number \| FontWeight \| string): MarqueeAttribute;<br>起始版本:8|类名:MarqueeAttribute<br>方法 or 属性:fontWeight(value: number \| FontWeight \| string): MarqueeAttribute;<br>起始版本:9|marquee.d.ts| +|起始版本有变化|类名:MarqueeAttribute<br>方法 or 属性:fontFamily(value: string \| Resource): MarqueeAttribute;<br>起始版本:8|类名:MarqueeAttribute<br>方法 or 属性:fontFamily(value: string \| Resource): MarqueeAttribute;<br>起始版本:9|marquee.d.ts| +|起始版本有变化|类名:MarqueeAttribute<br>方法 or 属性:onStart(event: () => void): MarqueeAttribute;<br>起始版本:8|类名:MarqueeAttribute<br>方法 or 属性:onStart(event: () => void): MarqueeAttribute;<br>起始版本:9|marquee.d.ts| +|起始版本有变化|类名:MarqueeAttribute<br>方法 or 属性:onBounce(event: () => void): MarqueeAttribute;<br>起始版本:8|类名:MarqueeAttribute<br>方法 or 属性:onBounce(event: () => void): MarqueeAttribute;<br>起始版本:9|marquee.d.ts| +|起始版本有变化|类名:MarqueeAttribute<br>方法 or 属性:onFinish(event: () => void): MarqueeAttribute;<br>起始版本:8|类名:MarqueeAttribute<br>方法 or 属性:onFinish(event: () => void): MarqueeAttribute;<br>起始版本:9|marquee.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Marquee: MarqueeInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Marquee: MarqueeInterface;<br>起始版本:9|marquee.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const MarqueeInstance: MarqueeAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const MarqueeInstance: MarqueeAttribute;<br>起始版本:9|marquee.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Navigation: NavigationInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Navigation: NavigationInterface;<br>起始版本:8|navigation.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const NavigationInstance: NavigationAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const NavigationInstance: NavigationAttribute;<br>起始版本:8|navigation.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Navigator: NavigatorInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Navigator: NavigatorInterface;<br>起始版本:7|navigator.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const NavigatorInstance: NavigatorAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const NavigatorInstance: NavigatorAttribute;<br>起始版本:7|navigator.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const PageTransitionEnter: PageTransitionEnterInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const PageTransitionEnter: PageTransitionEnterInterface;<br>起始版本:7|page_transition.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const PageTransitionExit: PageTransitionExitInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const PageTransitionExit: PageTransitionExitInterface;<br>起始版本:7|page_transition.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Panel: PanelInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Panel: PanelInterface;<br>起始版本:7|panel.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const PanelInstance: PanelAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const PanelInstance: PanelAttribute;<br>起始版本:7|panel.d.ts| +|起始版本有变化|类名:PathInterface<br>起始版本:7|类名:PathInterface<br>起始版本:9|path.d.ts| +|起始版本有变化|类名:PathInterface<br>方法 or 属性:new (value?: { width?: number \| string; height?: number \| string; commands?: string }): PathAttribute;<br>起始版本:7|类名:PathInterface<br>方法 or 属性:new (value?: { width?: number \| string; height?: number \| string; commands?: string }): PathAttribute;<br>起始版本:9|path.d.ts| +|起始版本有变化|类名:PathInterface<br>方法 or 属性:(value?: { width?: number \| string; height?: number \| string; commands?: string }): PathAttribute;<br>起始版本:7|类名:PathInterface<br>方法 or 属性:(value?: { width?: number \| string; height?: number \| string; commands?: string }): PathAttribute;<br>起始版本:9|path.d.ts| +|起始版本有变化|类名:PathAttribute<br>起始版本:7|类名:PathAttribute<br>起始版本:9|path.d.ts| +|起始版本有变化|类名:PathAttribute<br>方法 or 属性:commands(value: string): PathAttribute;<br>起始版本:7|类名:PathAttribute<br>方法 or 属性:commands(value: string): PathAttribute;<br>起始版本:9|path.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Path: PathInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Path: PathInterface;<br>起始版本:9|path.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const PathInstance: PathAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const PathInstance: PathAttribute;<br>起始版本:9|path.d.ts| +|起始版本有变化|类名:PolygonInterface<br>起始版本:7|类名:PolygonInterface<br>起始版本:9|polygon.d.ts| +|起始版本有变化|类名:PolygonInterface<br>方法 or 属性:new (value?: { width?: string \| number; height?: string \| number }): PolygonAttribute;<br>起始版本:7|类名:PolygonInterface<br>方法 or 属性:new (value?: { width?: string \| number; height?: string \| number }): PolygonAttribute;<br>起始版本:9|polygon.d.ts| +|起始版本有变化|类名:PolygonInterface<br>方法 or 属性:(value?: { width?: string \| number; height?: string \| number }): PolygonAttribute;<br>起始版本:7|类名:PolygonInterface<br>方法 or 属性:(value?: { width?: string \| number; height?: string \| number }): PolygonAttribute;<br>起始版本:9|polygon.d.ts| +|起始版本有变化|类名:PolygonAttribute<br>方法 or 属性:points(value: Array\<any>): PolygonAttribute;<br>起始版本:7|类名:PolygonAttribute<br>方法 or 属性:points(value: Array\<any>): PolygonAttribute;<br>起始版本:9|polygon.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Polygon: PolygonInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Polygon: PolygonInterface;<br>起始版本:9|polygon.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const PolygonInstance: PolygonAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const PolygonInstance: PolygonAttribute;<br>起始版本:9|polygon.d.ts| +|起始版本有变化|类名:PolylineInterface<br>起始版本:7|类名:PolylineInterface<br>起始版本:9|polyline.d.ts| +|起始版本有变化|类名:PolylineInterface<br>方法 or 属性:new (value?: { width?: string \| number; height?: string \| number }): PolylineAttribute;<br>起始版本:7|类名:PolylineInterface<br>方法 or 属性:new (value?: { width?: string \| number; height?: string \| number }): PolylineAttribute;<br>起始版本:9|polyline.d.ts| +|起始版本有变化|类名:PolylineInterface<br>方法 or 属性:(value?: { width?: string \| number; height?: string \| number }): PolylineAttribute;<br>起始版本:7|类名:PolylineInterface<br>方法 or 属性:(value?: { width?: string \| number; height?: string \| number }): PolylineAttribute;<br>起始版本:9|polyline.d.ts| +|起始版本有变化|类名:PolylineAttribute<br>起始版本:7|类名:PolylineAttribute<br>起始版本:9|polyline.d.ts| +|起始版本有变化|类名:PolylineAttribute<br>方法 or 属性:points(value: Array\<any>): PolylineAttribute;<br>起始版本:7|类名:PolylineAttribute<br>方法 or 属性:points(value: Array\<any>): PolylineAttribute;<br>起始版本:9|polyline.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Polyline: PolylineInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Polyline: PolylineInterface;<br>起始版本:9|polyline.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const PolylineInstance: PolylineAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const PolylineInstance: PolylineAttribute;<br>起始版本:9|polyline.d.ts| +|起始版本有变化|类名:ProgressOptions<br>起始版本:7|类名:ProgressOptions<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressOptions<br>方法 or 属性:value: number;<br>起始版本:7|类名:ProgressOptions<br>方法 or 属性:value: number;<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressOptions<br>方法 or 属性:total?: number;<br>起始版本:7|类名:ProgressOptions<br>方法 or 属性:total?: number;<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressOptions<br>方法 or 属性:type?: ProgressType<br>起始版本:8|类名:ProgressOptions<br>方法 or 属性:type?: ProgressType<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressType<br>起始版本:8|类名:ProgressType<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressType<br>方法 or 属性:Linear<br>起始版本:8|类名:ProgressType<br>方法 or 属性:Linear<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressType<br>方法 or 属性:Ring<br>起始版本:8|类名:ProgressType<br>方法 or 属性:Ring<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressType<br>方法 or 属性:Eclipse<br>起始版本:8|类名:ProgressType<br>方法 or 属性:Eclipse<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressType<br>方法 or 属性:ScaleRing<br>起始版本:8|类名:ProgressType<br>方法 or 属性:ScaleRing<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressType<br>方法 or 属性:Capsule<br>起始版本:8|类名:ProgressType<br>方法 or 属性:Capsule<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressStyleOptions<br>起始版本:8|类名:ProgressStyleOptions<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressStyleOptions<br>方法 or 属性:strokeWidth?: Length;<br>起始版本:8|类名:ProgressStyleOptions<br>方法 or 属性:strokeWidth?: Length;<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressStyleOptions<br>方法 or 属性:scaleCount?: number;<br>起始版本:8|类名:ProgressStyleOptions<br>方法 or 属性:scaleCount?: number;<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressStyleOptions<br>方法 or 属性:scaleWidth?: Length;<br>起始版本:8|类名:ProgressStyleOptions<br>方法 or 属性:scaleWidth?: Length;<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressStyle<br>起始版本:7|类名:ProgressStyle<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressStyle<br>方法 or 属性:Linear<br>起始版本:7|类名:ProgressStyle<br>方法 or 属性:Linear<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressStyle<br>方法 or 属性:Ring<br>起始版本:8|类名:ProgressStyle<br>方法 or 属性:Ring<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressStyle<br>方法 or 属性:Eclipse<br>起始版本:7|类名:ProgressStyle<br>方法 or 属性:Eclipse<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressStyle<br>方法 or 属性:ScaleRing<br>起始版本:8|类名:ProgressStyle<br>方法 or 属性:ScaleRing<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressStyle<br>方法 or 属性:Capsule<br>起始版本:8|类名:ProgressStyle<br>方法 or 属性:Capsule<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressInterface<br>起始版本:7|类名:ProgressInterface<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressInterface<br>方法 or 属性:(options: ProgressOptions): ProgressAttribute;<br>起始版本:7|类名:ProgressInterface<br>方法 or 属性:(options: ProgressOptions): ProgressAttribute;<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressAttribute<br>起始版本:7|类名:ProgressAttribute<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressAttribute<br>方法 or 属性:value(value: number): ProgressAttribute;<br>起始版本:7|类名:ProgressAttribute<br>方法 or 属性:value(value: number): ProgressAttribute;<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressAttribute<br>方法 or 属性:color(value: ResourceColor): ProgressAttribute;<br>起始版本:7|类名:ProgressAttribute<br>方法 or 属性:color(value: ResourceColor): ProgressAttribute;<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:ProgressAttribute<br>方法 or 属性:style(value: ProgressStyleOptions): ProgressAttribute;<br>起始版本:8|类名:ProgressAttribute<br>方法 or 属性:style(value: ProgressStyleOptions): ProgressAttribute;<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Progress: ProgressInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Progress: ProgressInterface;<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ProgressInstance: ProgressAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ProgressInstance: ProgressAttribute;<br>起始版本:9|progress.d.ts| +|起始版本有变化|类名:QRCodeInterface<br>起始版本:7|类名:QRCodeInterface<br>起始版本:9|qrcode.d.ts| +|起始版本有变化|类名:QRCodeInterface<br>方法 or 属性:(value: string): QRCodeAttribute;<br>起始版本:7|类名:QRCodeInterface<br>方法 or 属性:(value: string): QRCodeAttribute;<br>起始版本:9|qrcode.d.ts| +|起始版本有变化|类名:QRCodeAttribute<br>起始版本:7|类名:QRCodeAttribute<br>起始版本:9|qrcode.d.ts| +|起始版本有变化|类名:QRCodeAttribute<br>方法 or 属性:color(value: ResourceColor): QRCodeAttribute;<br>起始版本:7|类名:QRCodeAttribute<br>方法 or 属性:color(value: ResourceColor): QRCodeAttribute;<br>起始版本:9|qrcode.d.ts| +|起始版本有变化|类名:QRCodeAttribute<br>方法 or 属性:backgroundColor(value: ResourceColor): QRCodeAttribute;<br>起始版本:7|类名:QRCodeAttribute<br>方法 or 属性:backgroundColor(value: ResourceColor): QRCodeAttribute;<br>起始版本:9|qrcode.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const QRCode: QRCodeInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const QRCode: QRCodeInterface;<br>起始版本:9|qrcode.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const QRCodeInstance: QRCodeAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const QRCodeInstance: QRCodeAttribute;<br>起始版本:9|qrcode.d.ts| +|起始版本有变化|类名:RadioOptions<br>起始版本:8|类名:RadioOptions<br>起始版本:9|radio.d.ts| +|起始版本有变化|类名:RadioOptions<br>方法 or 属性:group: string;<br>起始版本:8|类名:RadioOptions<br>方法 or 属性:group: string;<br>起始版本:9|radio.d.ts| +|起始版本有变化|类名:RadioOptions<br>方法 or 属性:value: string;<br>起始版本:8|类名:RadioOptions<br>方法 or 属性:value: string;<br>起始版本:9|radio.d.ts| +|起始版本有变化|类名:RadioInterface<br>起始版本:8|类名:RadioInterface<br>起始版本:9|radio.d.ts| +|起始版本有变化|类名:RadioInterface<br>方法 or 属性:(options: RadioOptions): RadioAttribute;<br>起始版本:8|类名:RadioInterface<br>方法 or 属性:(options: RadioOptions): RadioAttribute;<br>起始版本:9|radio.d.ts| +|起始版本有变化|类名:RadioAttribute<br>起始版本:8|类名:RadioAttribute<br>起始版本:9|radio.d.ts| +|起始版本有变化|类名:RadioAttribute<br>方法 or 属性:checked(value: boolean): RadioAttribute;<br>起始版本:8|类名:RadioAttribute<br>方法 or 属性:checked(value: boolean): RadioAttribute;<br>起始版本:9|radio.d.ts| +|起始版本有变化|类名:RadioAttribute<br>方法 or 属性:onChange(callback: (isChecked: boolean) => void): RadioAttribute;<br>起始版本:8|类名:RadioAttribute<br>方法 or 属性:onChange(callback: (isChecked: boolean) => void): RadioAttribute;<br>起始版本:9|radio.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Radio: RadioInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Radio: RadioInterface;<br>起始版本:9|radio.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const RadioInstance: RadioAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const RadioInstance: RadioAttribute;<br>起始版本:9|radio.d.ts| +|起始版本有变化|类名:RatingInterface<br>起始版本:7|类名:RatingInterface<br>起始版本:9|rating.d.ts| +|起始版本有变化|类名:RatingInterface<br>方法 or 属性:(options?: { rating: number; indicator?: boolean }): RatingAttribute;<br>起始版本:7|类名:RatingInterface<br>方法 or 属性:(options?: { rating: number; indicator?: boolean }): RatingAttribute;<br>起始版本:9|rating.d.ts| +|起始版本有变化|类名:RatingAttribute<br>起始版本:7|类名:RatingAttribute<br>起始版本:9|rating.d.ts| +|起始版本有变化|类名:RatingAttribute<br>方法 or 属性:stars(value: number): RatingAttribute;<br>起始版本:7|类名:RatingAttribute<br>方法 or 属性:stars(value: number): RatingAttribute;<br>起始版本:9|rating.d.ts| +|起始版本有变化|类名:RatingAttribute<br>方法 or 属性:stepSize(value: number): RatingAttribute;<br>起始版本:7|类名:RatingAttribute<br>方法 or 属性:stepSize(value: number): RatingAttribute;<br>起始版本:9|rating.d.ts| +|起始版本有变化|类名:RatingAttribute<br>方法 or 属性:starStyle(value: { backgroundUri: string; foregroundUri: string; secondaryUri?: string }): RatingAttribute;<br>起始版本:7|类名:RatingAttribute<br>方法 or 属性:starStyle(value: { backgroundUri: string; foregroundUri: string; secondaryUri?: string }): RatingAttribute;<br>起始版本:9|rating.d.ts| +|起始版本有变化|类名:RatingAttribute<br>方法 or 属性:onChange(callback: (value: number) => void): RatingAttribute;<br>起始版本:7|类名:RatingAttribute<br>方法 or 属性:onChange(callback: (value: number) => void): RatingAttribute;<br>起始版本:9|rating.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Rating: RatingInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Rating: RatingInterface;<br>起始版本:9|rating.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const RatingInstance: RatingAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const RatingInstance: RatingAttribute;<br>起始版本:9|rating.d.ts| +|起始版本有变化|类名:RectInterface<br>起始版本:7|类名:RectInterface<br>起始版本:9|rect.d.ts| +|起始版本有变化|类名:RectInterface<br>方法 or 属性:new (<br> value?:<br> {<br> width?: number \| string;<br> height?: number \| string;<br> radius?: number \| string \| Array\<any>;<br> }<br> \| {<br> width?: number \| string;<br> height?: number \| string;<br> radiusWidth?: number \| string;<br> radiusHeight?: number \| string;<br> },<br> ): RectAttribute;<br>起始版本:7|类名:RectInterface<br>方法 or 属性:new (<br> value?:<br> {<br> width?: number \| string;<br> height?: number \| string;<br> radius?: number \| string \| Array\<any>;<br> }<br> \| {<br> width?: number \| string;<br> height?: number \| string;<br> radiusWidth?: number \| string;<br> radiusHeight?: number \| string;<br> },<br> ): RectAttribute;<br>起始版本:9|rect.d.ts| +|起始版本有变化|类名:RectInterface<br>方法 or 属性:(<br> value?:<br> {<br> width?: number \| string;<br> height?: number \| string;<br> radius?: number \| string \| Array\<any>;<br> }<br> \| {<br> width?: number \| string;<br> height?: number \| string;<br> radiusWidth?: number \| string;<br> radiusHeight?: number \| string;<br> },<br> ): RectAttribute;<br>起始版本:7|类名:RectInterface<br>方法 or 属性:(<br> value?:<br> {<br> width?: number \| string;<br> height?: number \| string;<br> radius?: number \| string \| Array\<any>;<br> }<br> \| {<br> width?: number \| string;<br> height?: number \| string;<br> radiusWidth?: number \| string;<br> radiusHeight?: number \| string;<br> },<br> ): RectAttribute;<br>起始版本:9|rect.d.ts| +|起始版本有变化|类名:RectAttribute<br>起始版本:7|类名:RectAttribute<br>起始版本:9|rect.d.ts| +|起始版本有变化|类名:RectAttribute<br>方法 or 属性:radiusWidth(value: number \| string): RectAttribute;<br>起始版本:7|类名:RectAttribute<br>方法 or 属性:radiusWidth(value: number \| string): RectAttribute;<br>起始版本:9|rect.d.ts| +|起始版本有变化|类名:RectAttribute<br>方法 or 属性:radiusHeight(value: number \| string): RectAttribute;<br>起始版本:7|类名:RectAttribute<br>方法 or 属性:radiusHeight(value: number \| string): RectAttribute;<br>起始版本:9|rect.d.ts| +|起始版本有变化|类名:RectAttribute<br>方法 or 属性:radius(value: number \| string \| Array\<any>): RectAttribute;<br>起始版本:7|类名:RectAttribute<br>方法 or 属性:radius(value: number \| string \| Array\<any>): RectAttribute;<br>起始版本:9|rect.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Rect: RectInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Rect: RectInterface;<br>起始版本:9|rect.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Refresh: RefreshInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Refresh: RefreshInterface;<br>起始版本:8|refresh.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const RefreshInstance: RefreshAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const RefreshInstance: RefreshAttribute;<br>起始版本:8|refresh.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const RichText: RichTextInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const RichText: RichTextInterface;<br>起始版本:8|rich_text.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const RichTextInstance: RichTextAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const RichTextInstance: RichTextAttribute;<br>起始版本:8|rich_text.d.ts| +|起始版本有变化|类名:RowInterface<br>起始版本:7|类名:RowInterface<br>起始版本:9|row.d.ts| +|起始版本有变化|类名:RowInterface<br>方法 or 属性:(value?: { space?: string \| number }): RowAttribute;<br>起始版本:7|类名:RowInterface<br>方法 or 属性:(value?: { space?: string \| number }): RowAttribute;<br>起始版本:9|row.d.ts| +|起始版本有变化|类名:RowAttribute<br>起始版本:7|类名:RowAttribute<br>起始版本:9|row.d.ts| +|起始版本有变化|类名:RowAttribute<br>方法 or 属性:alignItems(value: VerticalAlign): RowAttribute;<br>起始版本:7|类名:RowAttribute<br>方法 or 属性:alignItems(value: VerticalAlign): RowAttribute;<br>起始版本:9|row.d.ts| +|起始版本有变化|类名:RowAttribute<br>方法 or 属性:justifyContent(value: FlexAlign): RowAttribute;<br>起始版本:8|类名:RowAttribute<br>方法 or 属性:justifyContent(value: FlexAlign): RowAttribute;<br>起始版本:9|row.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Row: RowInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Row: RowInterface;<br>起始版本:9|row.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const RowInstance: RowAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const RowInstance: RowAttribute;<br>起始版本:9|row.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const RowSplit: RowSplitInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const RowSplit: RowSplitInterface;<br>起始版本:7|row_split.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const RowSplitInstance: RowSplitAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const RowSplitInstance: RowSplitAttribute;<br>起始版本:7|row_split.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Scroll: ScrollInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Scroll: ScrollInterface;<br>起始版本:7|scroll.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ScrollInstance: ScrollAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ScrollInstance: ScrollAttribute;<br>起始版本:7|scroll.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ScrollBar: ScrollBarInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ScrollBar: ScrollBarInterface;<br>起始版本:8|scroll_bar.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ScrollBarInstance: ScrollBarAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ScrollBarInstance: ScrollBarAttribute;<br>起始版本:8|scroll_bar.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Search: SearchInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Search: SearchInterface;<br>起始版本:8|search.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const SearchInstance: SearchAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const SearchInstance: SearchAttribute;<br>起始版本:8|search.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Select: SelectInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Select: SelectInterface;<br>起始版本:8|select.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const SelectInstance: SelectAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const SelectInstance: SelectAttribute;<br>起始版本:8|select.d.ts| +|起始版本有变化|类名:ShapeInterface<br>起始版本:7|类名:ShapeInterface<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:ShapeAttribute<br>起始版本:7|类名:ShapeAttribute<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:ShapeAttribute<br>方法 or 属性:viewPort(value: { x?: number \| string; y?: number \| string; width?: number \| string; height?: number \| string }): ShapeAttribute;<br>起始版本:7|类名:ShapeAttribute<br>方法 or 属性:viewPort(value: { x?: number \| string; y?: number \| string; width?: number \| string; height?: number \| string }): ShapeAttribute;<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:ShapeAttribute<br>方法 or 属性:stroke(value: ResourceColor): ShapeAttribute;<br>起始版本:7|类名:ShapeAttribute<br>方法 or 属性:stroke(value: ResourceColor): ShapeAttribute;<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:ShapeAttribute<br>方法 or 属性:fill(value: ResourceColor): ShapeAttribute;<br>起始版本:7|类名:ShapeAttribute<br>方法 or 属性:fill(value: ResourceColor): ShapeAttribute;<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:ShapeAttribute<br>方法 or 属性:strokeDashOffset(value: number \| string): ShapeAttribute;<br>起始版本:7|类名:ShapeAttribute<br>方法 or 属性:strokeDashOffset(value: number \| string): ShapeAttribute;<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:ShapeAttribute<br>方法 or 属性:strokeDashArray(value: Array\<any>): ShapeAttribute;<br>起始版本:7|类名:ShapeAttribute<br>方法 or 属性:strokeDashArray(value: Array\<any>): ShapeAttribute;<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:ShapeAttribute<br>方法 or 属性:strokeLineCap(value: LineCapStyle): ShapeAttribute;<br>起始版本:7|类名:ShapeAttribute<br>方法 or 属性:strokeLineCap(value: LineCapStyle): ShapeAttribute;<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:ShapeAttribute<br>方法 or 属性:strokeLineJoin(value: LineJoinStyle): ShapeAttribute;<br>起始版本:7|类名:ShapeAttribute<br>方法 or 属性:strokeLineJoin(value: LineJoinStyle): ShapeAttribute;<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:ShapeAttribute<br>方法 or 属性:strokeMiterLimit(value: number \| string): ShapeAttribute;<br>起始版本:7|类名:ShapeAttribute<br>方法 or 属性:strokeMiterLimit(value: number \| string): ShapeAttribute;<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:ShapeAttribute<br>方法 or 属性:strokeOpacity(value: number \| string \| Resource): ShapeAttribute;<br>起始版本:7|类名:ShapeAttribute<br>方法 or 属性:strokeOpacity(value: number \| string \| Resource): ShapeAttribute;<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:ShapeAttribute<br>方法 or 属性:fillOpacity(value: number \| string \| Resource): ShapeAttribute;<br>起始版本:7|类名:ShapeAttribute<br>方法 or 属性:fillOpacity(value: number \| string \| Resource): ShapeAttribute;<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:ShapeAttribute<br>方法 or 属性:strokeWidth(value: number \| string): ShapeAttribute;<br>起始版本:7|类名:ShapeAttribute<br>方法 or 属性:strokeWidth(value: number \| string): ShapeAttribute;<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:ShapeAttribute<br>方法 or 属性:antiAlias(value: boolean): ShapeAttribute;<br>起始版本:7|类名:ShapeAttribute<br>方法 or 属性:antiAlias(value: boolean): ShapeAttribute;<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:ShapeAttribute<br>方法 or 属性:mesh(value: Array\<any>, column: number, row: number): ShapeAttribute;<br>起始版本:8|类名:ShapeAttribute<br>方法 or 属性:mesh(value: Array\<any>, column: number, row: number): ShapeAttribute;<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Shape: ShapeInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Shape: ShapeInterface;<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ShapeInstance: ShapeAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ShapeInstance: ShapeAttribute;<br>起始版本:9|shape.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const SideBarContainer: SideBarContainerInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const SideBarContainer: SideBarContainerInterface;<br>起始版本:8|sidebar.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const SideBarContainerInstance: SideBarContainerAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const SideBarContainerInstance: SideBarContainerAttribute;<br>起始版本:8|sidebar.d.ts| +|起始版本有变化|类名:SliderStyle<br>起始版本:7|类名:SliderStyle<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderStyle<br>方法 or 属性:OutSet<br>起始版本:7|类名:SliderStyle<br>方法 or 属性:OutSet<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderStyle<br>方法 or 属性:InSet<br>起始版本:7|类名:SliderStyle<br>方法 or 属性:InSet<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderChangeMode<br>起始版本:7|类名:SliderChangeMode<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderChangeMode<br>方法 or 属性:Begin<br>起始版本:7|类名:SliderChangeMode<br>方法 or 属性:Begin<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderChangeMode<br>方法 or 属性:Moving<br>起始版本:7|类名:SliderChangeMode<br>方法 or 属性:Moving<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderChangeMode<br>方法 or 属性:End<br>起始版本:7|类名:SliderChangeMode<br>方法 or 属性:End<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderChangeMode<br>方法 or 属性:Click<br>起始版本:8|类名:SliderChangeMode<br>方法 or 属性:Click<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderOptions<br>起始版本:7|类名:SliderOptions<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderOptions<br>方法 or 属性:value?: number;<br>起始版本:7|类名:SliderOptions<br>方法 or 属性:value?: number;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderOptions<br>方法 or 属性:min?: number;<br>起始版本:7|类名:SliderOptions<br>方法 or 属性:min?: number;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderOptions<br>方法 or 属性:max?: number;<br>起始版本:7|类名:SliderOptions<br>方法 or 属性:max?: number;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderOptions<br>方法 or 属性:step?: number;<br>起始版本:7|类名:SliderOptions<br>方法 or 属性:step?: number;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderOptions<br>方法 or 属性:style?: SliderStyle;<br>起始版本:7|类名:SliderOptions<br>方法 or 属性:style?: SliderStyle;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderOptions<br>方法 or 属性:direction?: Axis;<br>起始版本:8|类名:SliderOptions<br>方法 or 属性:direction?: Axis;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderOptions<br>方法 or 属性:reverse?: boolean;<br>起始版本:8|类名:SliderOptions<br>方法 or 属性:reverse?: boolean;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderInterface<br>起始版本:7|类名:SliderInterface<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderInterface<br>方法 or 属性:(options?: SliderOptions): SliderAttribute;<br>起始版本:7|类名:SliderInterface<br>方法 or 属性:(options?: SliderOptions): SliderAttribute;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderAttribute<br>起始版本:7|类名:SliderAttribute<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderAttribute<br>方法 or 属性:blockColor(value: ResourceColor): SliderAttribute;<br>起始版本:7|类名:SliderAttribute<br>方法 or 属性:blockColor(value: ResourceColor): SliderAttribute;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderAttribute<br>方法 or 属性:trackColor(value: ResourceColor): SliderAttribute;<br>起始版本:7|类名:SliderAttribute<br>方法 or 属性:trackColor(value: ResourceColor): SliderAttribute;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderAttribute<br>方法 or 属性:selectedColor(value: ResourceColor): SliderAttribute;<br>起始版本:7|类名:SliderAttribute<br>方法 or 属性:selectedColor(value: ResourceColor): SliderAttribute;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderAttribute<br>方法 or 属性:showSteps(value: boolean): SliderAttribute;<br>起始版本:7|类名:SliderAttribute<br>方法 or 属性:showSteps(value: boolean): SliderAttribute;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderAttribute<br>方法 or 属性:showTips(value: boolean): SliderAttribute;<br>起始版本:7|类名:SliderAttribute<br>方法 or 属性:showTips(value: boolean): SliderAttribute;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderAttribute<br>方法 or 属性:trackThickness(value: Length): SliderAttribute;<br>起始版本:8|类名:SliderAttribute<br>方法 or 属性:trackThickness(value: Length): SliderAttribute;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SliderAttribute<br>方法 or 属性:onChange(callback: (value: number, mode: SliderChangeMode) => void): SliderAttribute;<br>起始版本:7|类名:SliderAttribute<br>方法 or 属性:onChange(callback: (value: number, mode: SliderChangeMode) => void): SliderAttribute;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Slider: SliderInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Slider: SliderInterface;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const SliderInstance: SliderAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const SliderInstance: SliderAttribute;<br>起始版本:9|slider.d.ts| +|起始版本有变化|类名:SpanInterface<br>起始版本:7|类名:SpanInterface<br>起始版本:9|span.d.ts| +|起始版本有变化|类名:SpanInterface<br>方法 or 属性:(value: string \| Resource): SpanAttribute;<br>起始版本:7|类名:SpanInterface<br>方法 or 属性:(value: string \| Resource): SpanAttribute;<br>起始版本:9|span.d.ts| +|起始版本有变化|类名:SpanAttribute<br>起始版本:7|类名:SpanAttribute<br>起始版本:9|span.d.ts| +|起始版本有变化|类名:SpanAttribute<br>方法 or 属性:fontColor(value: ResourceColor): SpanAttribute;<br>起始版本:7|类名:SpanAttribute<br>方法 or 属性:fontColor(value: ResourceColor): SpanAttribute;<br>起始版本:9|span.d.ts| +|起始版本有变化|类名:SpanAttribute<br>方法 or 属性:fontSize(value: number \| string \| Resource): SpanAttribute;<br>起始版本:7|类名:SpanAttribute<br>方法 or 属性:fontSize(value: number \| string \| Resource): SpanAttribute;<br>起始版本:9|span.d.ts| +|起始版本有变化|类名:SpanAttribute<br>方法 or 属性:fontStyle(value: FontStyle): SpanAttribute;<br>起始版本:7|类名:SpanAttribute<br>方法 or 属性:fontStyle(value: FontStyle): SpanAttribute;<br>起始版本:9|span.d.ts| +|起始版本有变化|类名:SpanAttribute<br>方法 or 属性:fontWeight(value: number \| FontWeight \| string): SpanAttribute;<br>起始版本:7|类名:SpanAttribute<br>方法 or 属性:fontWeight(value: number \| FontWeight \| string): SpanAttribute;<br>起始版本:9|span.d.ts| +|起始版本有变化|类名:SpanAttribute<br>方法 or 属性:fontFamily(value: string \| Resource): SpanAttribute;<br>起始版本:7|类名:SpanAttribute<br>方法 or 属性:fontFamily(value: string \| Resource): SpanAttribute;<br>起始版本:9|span.d.ts| +|起始版本有变化|类名:SpanAttribute<br>方法 or 属性:decoration(value: { type: TextDecorationType; color?: ResourceColor }): SpanAttribute;<br>起始版本:7|类名:SpanAttribute<br>方法 or 属性:decoration(value: { type: TextDecorationType; color?: ResourceColor }): SpanAttribute;<br>起始版本:9|span.d.ts| +|起始版本有变化|类名:SpanAttribute<br>方法 or 属性:letterSpacing(value: number \| string): SpanAttribute;<br>起始版本:7|类名:SpanAttribute<br>方法 or 属性:letterSpacing(value: number \| string): SpanAttribute;<br>起始版本:9|span.d.ts| +|起始版本有变化|类名:SpanAttribute<br>方法 or 属性:textCase(value: TextCase): SpanAttribute;<br>起始版本:N/A|类名:SpanAttribute<br>方法 or 属性:textCase(value: TextCase): SpanAttribute;<br>起始版本:9|span.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Span: SpanInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Span: SpanInterface;<br>起始版本:9|span.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const SpanInstance: SpanAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const SpanInstance: SpanAttribute;<br>起始版本:9|span.d.ts| +|起始版本有变化|类名:StackInterface<br>起始版本:7|类名:StackInterface<br>起始版本:9|stack.d.ts| +|起始版本有变化|类名:StackInterface<br>方法 or 属性:(value?: { alignContent?: Alignment }): StackAttribute;<br>起始版本:7|类名:StackInterface<br>方法 or 属性:(value?: { alignContent?: Alignment }): StackAttribute;<br>起始版本:9|stack.d.ts| +|起始版本有变化|类名:StackAttribute<br>起始版本:7|类名:StackAttribute<br>起始版本:9|stack.d.ts| +|起始版本有变化|类名:StackAttribute<br>方法 or 属性:alignContent(value: Alignment): StackAttribute;<br>起始版本:7|类名:StackAttribute<br>方法 or 属性:alignContent(value: Alignment): StackAttribute;<br>起始版本:9|stack.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Stack: StackInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Stack: StackInterface;<br>起始版本:9|stack.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const StackInstance: StackAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const StackInstance: StackAttribute;<br>起始版本:9|stack.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Stepper: StepperInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Stepper: StepperInterface;<br>起始版本:8|stepper.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const StepperInstance: StepperAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const StepperInstance: StepperAttribute;<br>起始版本:8|stepper.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const StepperItemInstance: StepperItemAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const StepperItemInstance: StepperItemAttribute;<br>起始版本:8|stepper_item.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const StepperItem: StepperItemInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const StepperItem: StepperItemInterface;<br>起始版本:8|stepper_item.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Swiper: SwiperInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Swiper: SwiperInterface;<br>起始版本:7|swiper.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const SwiperInstance: SwiperAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const SwiperInstance: SwiperAttribute;<br>起始版本:7|swiper.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Tabs: TabsInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Tabs: TabsInterface;<br>起始版本:7|tabs.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TabsInstance: TabsAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TabsInstance: TabsAttribute;<br>起始版本:7|tabs.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TabContent: TabContentInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TabContent: TabContentInterface;<br>起始版本:7|tab_content.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TabContentInstance: TabContentAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TabContentInstance: TabContentAttribute;<br>起始版本:7|tab_content.d.ts| +|起始版本有变化|类名:TextInterface<br>起始版本:7|类名:TextInterface<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextInterface<br>方法 or 属性:(content?: string \| Resource): TextAttribute;<br>起始版本:7|类名:TextInterface<br>方法 or 属性:(content?: string \| Resource): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>起始版本:7|类名:TextAttribute<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>方法 or 属性:fontColor(value: ResourceColor): TextAttribute;<br>起始版本:7|类名:TextAttribute<br>方法 or 属性:fontColor(value: ResourceColor): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>方法 or 属性:fontSize(value: number \| string \| Resource): TextAttribute;<br>起始版本:7|类名:TextAttribute<br>方法 or 属性:fontSize(value: number \| string \| Resource): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>方法 or 属性:minFontSize(value: number \| string \| Resource): TextAttribute;<br>起始版本:7|类名:TextAttribute<br>方法 or 属性:minFontSize(value: number \| string \| Resource): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>方法 or 属性:maxFontSize(value: number \| string \| Resource): TextAttribute;<br>起始版本:7|类名:TextAttribute<br>方法 or 属性:maxFontSize(value: number \| string \| Resource): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>方法 or 属性:fontStyle(value: FontStyle): TextAttribute;<br>起始版本:7|类名:TextAttribute<br>方法 or 属性:fontStyle(value: FontStyle): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>方法 or 属性:fontWeight(value: number \| FontWeight \| string): TextAttribute;<br>起始版本:7|类名:TextAttribute<br>方法 or 属性:fontWeight(value: number \| FontWeight \| string): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>方法 or 属性:textAlign(value: TextAlign): TextAttribute;<br>起始版本:7|类名:TextAttribute<br>方法 or 属性:textAlign(value: TextAlign): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>方法 or 属性:lineHeight(value: number \| string \| Resource): TextAttribute;<br>起始版本:7|类名:TextAttribute<br>方法 or 属性:lineHeight(value: number \| string \| Resource): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>方法 or 属性:textOverflow(value: { overflow: TextOverflow }): TextAttribute;<br>起始版本:7|类名:TextAttribute<br>方法 or 属性:textOverflow(value: { overflow: TextOverflow }): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>方法 or 属性:fontFamily(value: string \| Resource): TextAttribute;<br>起始版本:7|类名:TextAttribute<br>方法 or 属性:fontFamily(value: string \| Resource): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>方法 or 属性:maxLines(value: number): TextAttribute;<br>起始版本:7|类名:TextAttribute<br>方法 or 属性:maxLines(value: number): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>方法 or 属性:decoration(value: { type: TextDecorationType; color?: ResourceColor }): TextAttribute;<br>起始版本:7|类名:TextAttribute<br>方法 or 属性:decoration(value: { type: TextDecorationType; color?: ResourceColor }): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>方法 or 属性:letterSpacing(value: number \| string): TextAttribute;<br>起始版本:7|类名:TextAttribute<br>方法 or 属性:letterSpacing(value: number \| string): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>方法 or 属性:textCase(value: TextCase): TextAttribute;<br>起始版本:7|类名:TextAttribute<br>方法 or 属性:textCase(value: TextCase): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:TextAttribute<br>方法 or 属性:baselineOffset(value: number \| string): TextAttribute;<br>起始版本:7|类名:TextAttribute<br>方法 or 属性:baselineOffset(value: number \| string): TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TextInstance: TextAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TextInstance: TextAttribute;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Text: TextInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Text: TextInterface;<br>起始版本:9|text.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TextArea: TextAreaInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TextArea: TextAreaInterface;<br>起始版本:7|text_area.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TextAreaInstance: TextAreaAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TextAreaInstance: TextAreaAttribute;<br>起始版本:7|text_area.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TextClock: TextClockInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TextClock: TextClockInterface;<br>起始版本:8|text_clock.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TextClockInstance: TextClockAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TextClockInstance: TextClockAttribute;<br>起始版本:8|text_clock.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TextInput: TextInputInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TextInput: TextInputInterface;<br>起始版本:7|text_input.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TextInputInstance: TextInputAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TextInputInstance: TextInputAttribute;<br>起始版本:7|text_input.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TextPicker: TextPickerInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TextPicker: TextPickerInterface;<br>起始版本:8|text_picker.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TextPickerInstance: TextPickerAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TextPickerInstance: TextPickerAttribute;<br>起始版本:8|text_picker.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TextTimer: TextTimerInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TextTimer: TextTimerInterface;<br>起始版本:8|text_timer.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TextTimerInstance: TextTimerAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TextTimerInstance: TextTimerAttribute;<br>起始版本:8|text_timer.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TimePicker: TimePickerInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TimePicker: TimePickerInterface;<br>起始版本:8|time_picker.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const TimePickerInstance: TimePickerAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const TimePickerInstance: TimePickerAttribute;<br>起始版本:8|time_picker.d.ts| +|起始版本有变化|类名:ToggleType<br>起始版本:8|类名:ToggleType<br>起始版本:9|toggle.d.ts| +|起始版本有变化|类名:ToggleType<br>方法 or 属性:Checkbox<br>起始版本:8|类名:ToggleType<br>方法 or 属性:Checkbox<br>起始版本:9|toggle.d.ts| +|起始版本有变化|类名:ToggleType<br>方法 or 属性:Switch<br>起始版本:8|类名:ToggleType<br>方法 or 属性:Switch<br>起始版本:9|toggle.d.ts| +|起始版本有变化|类名:ToggleType<br>方法 or 属性:Button<br>起始版本:8|类名:ToggleType<br>方法 or 属性:Button<br>起始版本:9|toggle.d.ts| +|起始版本有变化|类名:ToggleInterface<br>起始版本:8|类名:ToggleInterface<br>起始版本:9|toggle.d.ts| +|起始版本有变化|类名:ToggleInterface<br>方法 or 属性:(options: { type: ToggleType; isOn?: boolean }): ToggleAttribute;<br>起始版本:8|类名:ToggleInterface<br>方法 or 属性:(options: { type: ToggleType; isOn?: boolean }): ToggleAttribute;<br>起始版本:9|toggle.d.ts| +|起始版本有变化|类名:ToggleAttribute<br>起始版本:8|类名:ToggleAttribute<br>起始版本:9|toggle.d.ts| +|起始版本有变化|类名:ToggleAttribute<br>方法 or 属性:onChange(callback: (isOn: boolean) => void): ToggleAttribute;<br>起始版本:8|类名:ToggleAttribute<br>方法 or 属性:onChange(callback: (isOn: boolean) => void): ToggleAttribute;<br>起始版本:9|toggle.d.ts| +|起始版本有变化|类名:ToggleAttribute<br>方法 or 属性:selectedColor(value: ResourceColor): ToggleAttribute;<br>起始版本:8|类名:ToggleAttribute<br>方法 or 属性:selectedColor(value: ResourceColor): ToggleAttribute;<br>起始版本:9|toggle.d.ts| +|起始版本有变化|类名:ToggleAttribute<br>方法 or 属性:switchPointColor(color: ResourceColor): ToggleAttribute;<br>起始版本:8|类名:ToggleAttribute<br>方法 or 属性:switchPointColor(color: ResourceColor): ToggleAttribute;<br>起始版本:9|toggle.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Toggle: ToggleInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Toggle: ToggleInterface;<br>起始版本:9|toggle.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const ToggleInstance: ToggleAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const ToggleInstance: ToggleAttribute;<br>起始版本:9|toggle.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Video: VideoInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Video: VideoInterface;<br>起始版本:7|video.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const VideoInstance: VideoAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const VideoInstance: VideoAttribute;<br>起始版本:7|video.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const Web: WebInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const Web: WebInterface;<br>起始版本:8|web.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const WebInstance: WebAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const WebInstance: WebAttribute;<br>起始版本:8|web.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const XComponent: XComponentInterface;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const XComponent: XComponentInterface;<br>起始版本:8|xcomponent.d.ts| +|起始版本有变化|类名:global<br>方法 or 属性:declare const XComponentInstance: XComponentAttribute;<br>起始版本:N/A|类名:global<br>方法 or 属性:declare const XComponentInstance: XComponentAttribute;<br>起始版本:8|xcomponent.d.ts| +|SysCap有变化|类名:console<br>方法 or 属性:static debug(message: string, ...arguments: any[]): void;<br>SysCap:SystemCapability.ArkUI.ArkUI.Full|类名:console<br>方法 or 属性:static debug(message: string, ...arguments: any[]): void;<br>SysCap:N/A|global.d.ts| +|SysCap有变化|类名:console<br>方法 or 属性:static log(message: string, ...arguments: any[]): void;<br>SysCap:SystemCapability.ArkUI.ArkUI.Full|类名:console<br>方法 or 属性:static log(message: string, ...arguments: any[]): void;<br>SysCap:N/A|global.d.ts| +|SysCap有变化|类名:console<br>方法 or 属性:static info(message: string, ...arguments: any[]): void;<br>SysCap:SystemCapability.ArkUI.ArkUI.Full|类名:console<br>方法 or 属性:static info(message: string, ...arguments: any[]): void;<br>SysCap:N/A|global.d.ts| +|SysCap有变化|类名:console<br>方法 or 属性:static warn(message: string, ...arguments: any[]): void;<br>SysCap:SystemCapability.ArkUI.ArkUI.Full|类名:console<br>方法 or 属性:static warn(message: string, ...arguments: any[]): void;<br>SysCap:N/A|global.d.ts| +|SysCap有变化|类名:console<br>方法 or 属性:static error(message: string, ...arguments: any[]): void;<br>SysCap:SystemCapability.ArkUI.ArkUI.Full|类名:console<br>方法 or 属性:static error(message: string, ...arguments: any[]): void;<br>SysCap:N/A|global.d.ts| +|SysCap有变化|类名:<br>方法 or 属性: function getInspectorByKey(id: string): string;<br>SysCap:SystemCapability.ArkUI.ArkUI.Full|类名:<br>方法 or 属性: function getInspectorByKey(id: string): string;<br>SysCap:N/A|global.d.ts| +|SysCap有变化|类名:<br>方法 or 属性: function sendEventByKey(id: string, action: number, params: string): boolean;<br>SysCap:SystemCapability.ArkUI.ArkUI.Full|类名:<br>方法 or 属性: function sendEventByKey(id: string, action: number, params: string): boolean;<br>SysCap:N/A|global.d.ts| +|SysCap有变化|类名:<br>方法 or 属性: function sendTouchEvent(event: TouchObject): boolean;<br>SysCap:SystemCapability.ArkUI.ArkUI.Full|类名:<br>方法 or 属性: function sendTouchEvent(event: TouchObject): boolean;<br>SysCap:N/A|global.d.ts| +|SysCap有变化|类名:<br>方法 or 属性: function sendKeyEvent(event: KeyEvent): boolean;<br>SysCap:SystemCapability.ArkUI.ArkUI.Full|类名:<br>方法 or 属性: function sendKeyEvent(event: KeyEvent): boolean;<br>SysCap:N/A|global.d.ts| +|SysCap有变化|类名:<br>方法 or 属性: function sendMouseEvent(event: MouseEvent): boolean;<br>SysCap:SystemCapability.ArkUI.ArkUI.Full|类名:<br>方法 or 属性: function sendMouseEvent(event: MouseEvent): boolean;<br>SysCap:N/A|global.d.ts| +|SysCap有变化|类名:RouterOptions<br>SysCap:SystemCapability.ArkUI.ArkUI.Full|类名:RouterOptions<br>SysCap:SystemCapability.ArkUI.ArkUI.Lite|@ohos.router.d.ts| +|SysCap有变化|类名:router<br>方法 or 属性:function replace(options: RouterOptions):void;<br>SysCap:SystemCapability.ArkUI.ArkUI.Full|类名:router<br>方法 or 属性:function replace(options: RouterOptions):void;<br>SysCap:SystemCapability.ArkUI.ArkUI.Lite|@ohos.router.d.ts| +|SysCap有变化|类名:TabContentInterface<br>SysCap:N/A|类名:TabContentInterface<br>SysCap:SystemCapability.ArkUI.ArkUI.Full|tab_content.d.ts| +|SysCap有变化|类名:TabContentInterface<br>方法 or 属性:(): TabContentAttribute;<br>SysCap:N/A|类名:TabContentInterface<br>方法 or 属性:(): TabContentAttribute;<br>SysCap:SystemCapability.ArkUI.ArkUI.Full|tab_content.d.ts| +|SysCap有变化|类名:TabContentAttribute<br>SysCap:N/A|类名:TabContentAttribute<br>SysCap:SystemCapability.ArkUI.ArkUI.Full|tab_content.d.ts| +|SysCap有变化|类名:TabContentAttribute<br>方法 or 属性:tabBar(value: string \| Resource \| CustomBuilder \|<br> { icon?: string \| Resource; text?: string \| Resource }): TabContentAttribute;<br>SysCap:N/A|类名:TabContentAttribute<br>方法 or 属性:tabBar(value: string \| Resource \| CustomBuilder \|<br> { icon?: string \| Resource; text?: string \| Resource }): TabContentAttribute;<br>SysCap:SystemCapability.ArkUI.ArkUI.Full|tab_content.d.ts| +|SysCap有变化|类名:global<br>方法 or 属性:declare const TabContent: TabContentInterface;<br>SysCap:N/A|类名:global<br>方法 or 属性:declare const TabContent: TabContentInterface;<br>SysCap:SystemCapability.ArkUI.ArkUI.Full|tab_content.d.ts| +|SysCap有变化|类名:global<br>方法 or 属性:declare const TabContentInstance: TabContentAttribute;<br>SysCap:N/A|类名:global<br>方法 or 属性:declare const TabContentInstance: TabContentAttribute;<br>SysCap:SystemCapability.ArkUI.ArkUI.Full|tab_content.d.ts| +|SysCap有变化|类名:<br>方法 or 属性: function createLocalParticleAbility(name?: string): any;<br>SysCap:SystemCapability.ArkUI.ArkUI.Full|类名:<br>方法 or 属性: function createLocalParticleAbility(name?: string): any;<br>SysCap:N/A|global.d.ts| +|函数有变化|类名:<br>方法 or 属性: function getInspectorTree(): string;<br>|类名:<br>方法 or 属性: function getInspectorTree(): Object;<br>|global.d.ts| +|函数有变化|类名:FormComponentInterface<br>方法 or 属性:(value: {<br> id: number;<br> name: string;<br> bundle: string;<br> ability: string;<br> module: string;<br> dimension?: FormDimension;<br> temporary?: boolean;<br> }): FormComponentAttribute;<br>|类名:FormComponentInterface<br>方法 or 属性:(value: {<br> id: number;<br> name: string;<br> bundle: string;<br> ability: string;<br> module: string;<br> dimension?: FormDimension;<br> temporary?: boolean;<br> want?: import('../api/@ohos.app.ability.Want').default;<br> }): FormComponentAttribute;<br>|form_component.d.ts| +|函数有变化|类名:ImageAnimatorAttribute<br>方法 or 属性:images(<br> value: Array\<{<br> src: string;<br> width?: number \| string;<br> height?: number \| string;<br> top?: number \| string;<br> left?: number \| string;<br> duration?: number;<br> }>,<br> ): ImageAnimatorAttribute;<br>|类名:ImageAnimatorAttribute<br>方法 or 属性:images(value: Array\<ImageFrameInfo>): ImageAnimatorAttribute;<br>|image_animator.d.ts| +|函数有变化|类名:NavigationAttribute<br>方法 or 属性:title(value: string \| CustomBuilder): NavigationAttribute;<br>|类名:NavigationAttribute<br>方法 or 属性:title(value: string \| CustomBuilder \| NavigationCommonTitle \| NavigationCustomTitle): NavigationAttribute;<br>|navigation.d.ts| +|函数有变化|类名:WebAttribute<br>方法 or 属性:javaScriptProxy(javaScriptProxy: { object: object, name: string, methodList: Array\<string>,<br> controller: WebController }): WebAttribute;<br>|类名:WebAttribute<br>方法 or 属性:javaScriptProxy(javaScriptProxy: { object: object, name: string, methodList: Array\<string>,<br> controller: WebController \| WebviewController }): WebAttribute;<br>|web.d.ts| +|函数有变化|类名:WebAttribute<br>方法 or 属性:onRefreshAccessedHistory(callback: (event?: { url: string, refreshed: boolean }) => void): WebAttribute;<br>|类名:WebAttribute<br>方法 or 属性:onRefreshAccessedHistory(callback: (event?: { url: string, isRefreshed: boolean }) => void): WebAttribute;<br>|web.d.ts| +|函数有变化|类名:XComponentController<br>方法 or 属性:getXComponentSurfaceId();<br>|类名:XComponentController<br>方法 or 属性:getXComponentSurfaceId(): string;<br>|xcomponent.d.ts| +|函数有变化|类名:XComponentController<br>方法 or 属性:getXComponentContext();<br>|类名:XComponentController<br>方法 or 属性:getXComponentContext(): Object;<br>|xcomponent.d.ts| +|函数有变化|类名:XComponentController<br>方法 or 属性:setXComponentSurfaceSize(value: {<br> surfaceWidth: number;<br> surfaceHeight: number;<br> });<br>|类名:XComponentController<br>方法 or 属性:setXComponentSurfaceSize(value: {<br> surfaceWidth: number;<br> surfaceHeight: number;<br> }): void;<br>|xcomponent.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-battery.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-battery.md new file mode 100644 index 0000000000000000000000000000000000000000..ffe747302a62d35e974d78e95e522cabbef56131 --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-battery.md @@ -0,0 +1,115 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.batteryInfo<br>类名: batteryInfo<br>方法 or 属性: const batteryCapacityLevel: BatteryCapacityLevel;|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: batteryInfo<br>方法 or 属性: const estimatedRemainingChargeTime: number;|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: batteryInfo<br>方法 or 属性: const totalEnergy: number;|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: batteryInfo<br>方法 or 属性: const nowCurrent: number;|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: batteryInfo<br>方法 or 属性: const remainingEnergy: number;|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: BatteryCapacityLevel|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: BatteryCapacityLevel<br>方法 or 属性: LEVEL_FULL|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: BatteryCapacityLevel<br>方法 or 属性: LEVEL_HIGH|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: BatteryCapacityLevel<br>方法 or 属性: LEVEL_NORMAL|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: BatteryCapacityLevel<br>方法 or 属性: LEVEL_LOW|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: BatteryCapacityLevel<br>方法 or 属性: LEVEL_WARNING|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: BatteryCapacityLevel<br>方法 or 属性: LEVEL_CRITICAL|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: BatteryCapacityLevel<br>方法 or 属性: LEVEL_SHUTDOWN|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedKey|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedKey<br>方法 or 属性: EXTRA_SOC = "soc"|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedKey<br>方法 or 属性: EXTRA_CHARGE_STATE = "chargeState"|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedKey<br>方法 or 属性: EXTRA_HEALTH_STATE = "healthState"|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedKey<br>方法 or 属性: EXTRA_PLUGGED_TYPE = "pluggedType"|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedKey<br>方法 or 属性: EXTRA_VOLTAGE = "voltage"|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedKey<br>方法 or 属性: EXTRA_TECHNOLOGY = "technology"|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedKey<br>方法 or 属性: EXTRA_TEMPERATURE = "temperature"|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedKey<br>方法 or 属性: EXTRA_PRESENT = "present"|@ohos.batteryInfo.d.ts| +|新增|NA|模块名: ohos.batteryInfo<br>类名: CommonEventBatteryChangedKey<br>方法 or 属性: EXTRA_CAPACITY_LEVEL = "capacityLevel"|@ohos.batteryInfo.d.ts| +|新增|NA|类名:power<br>方法or属性:function shutdown(reason: string): void;|@ohos.power.d.ts| +|新增|NA|类名:power<br>方法or属性:function reboot(reason: string): void;|@ohos.power.d.ts| +|新增|NA|类名:power<br>方法or属性:function isActive(): boolean;|@ohos.power.d.ts| +|新增|NA|类名:power<br>方法or属性:function wakeup(detail: string): void;|@ohos.power.d.ts| +|新增|NA|类名:power<br>方法or属性:function suspend(): void;|@ohos.power.d.ts| +|新增|NA|类名:power<br>方法or属性:function getPowerMode(): DevicePowerMode;|@ohos.power.d.ts| +|新增|NA|类名:power<br>方法or属性:function setPowerMode(mode: DevicePowerMode, callback: AsyncCallback\<void>): void;|@ohos.power.d.ts| +|新增|NA|类名:power<br>方法or属性:function setPowerMode(mode: DevicePowerMode): Promise\<void>;|@ohos.power.d.ts| +|新增|NA|模块名: ohos.power<br>类名: DevicePowerMode|@ohos.power.d.ts| +|新增|NA|类名:DevicePowerMode<br>方法or属性:|@ohos.power.d.ts| +|新增|NA|模块名: ohos.power<br>类名: DevicePowerMode<br>方法 or 属性:MODE_NORMAL = 600|@ohos.power.d.ts| +|新增|NA|类名:DevicePowerMode<br>方法or属性:MODE_NORMAL = 600|@ohos.power.d.ts| +|新增|NA|模块名: ohos.power<br>类名: DevicePowerMode<br>方法 or 属性:MODE_POWER_SAVE|@ohos.power.d.ts| +|新增|NA|类名:DevicePowerMode<br>方法or属性:MODE_POWER_SAVE|@ohos.power.d.ts| +|新增|NA|模块名: ohos.power<br>类名: DevicePowerMode<br>方法 or 属性:MODE_PERFORMANCE|@ohos.power.d.ts| +|新增|NA|类名:DevicePowerMode<br>方法or属性:MODE_PERFORMANCE|@ohos.power.d.ts| +|新增|NA|模块名: ohos.power<br>类名: DevicePowerMode<br>方法 or 属性:MODE_EXTREME_POWER_SAVE|@ohos.power.d.ts| +|新增|NA|类名:DevicePowerMode<br>方法or属性:MODE_EXTREME_POWER_SAVE|@ohos.power.d.ts| +|新增|NA|类名:RunningLock<br>方法or属性:hold(timeout: number): void;|@ohos.runningLock.d.ts| +|新增|NA|类名:RunningLock<br>方法or属性:isHolding(): boolean;|@ohos.runningLock.d.ts| +|新增|NA|类名:RunningLock<br>方法or属性:unhold(): void;|@ohos.runningLock.d.ts| +|新增|NA|类名:runningLock<br>方法or属性:function isSupported(type: RunningLockType): boolean;|@ohos.runningLock.d.ts| +|新增|NA|类名:runningLock<br>方法or属性:function create(name: string, type: RunningLockType, callback: AsyncCallback\<RunningLock>): void;|@ohos.runningLock.d.ts| +|新增|NA|类名:runningLock<br>方法or属性:function create(name: string, type: RunningLockType): Promise\<RunningLock>;|@ohos.runningLock.d.ts| +|新增|NA|类名:thermal<br>方法or属性:function registerThermalLevelCallback(callback: Callback\<ThermalLevel>): void;|@ohos.thermal.d.ts| +|新增|NA|类名:thermal<br>方法or属性:function unregisterThermalLevelCallback(callback?: Callback\<void>): void;|@ohos.thermal.d.ts| +|新增|NA|类名:thermal<br>方法or属性:function getLevel(): ThermalLevel;|@ohos.thermal.d.ts| +|删除|模块名:ohos.power<br>类名:power<br>方法 or 属性:function shutdownDevice(reason: string): void;|NA|@ohos.power.d.ts| +|访问级别有变化|类名:brightness<br>访问级别:公开API|类名:brightness<br>访问级别:系统API|@ohos.brightness.d.ts| +|废弃版本有变化|类名:power<br>方法 or 属性:function rebootDevice(reason: string): void;<br>废弃版本:N/A|类名:power<br>方法 or 属性:function rebootDevice(reason: string): void;<br>废弃版本:9<br>代替接口:{@link power|@ohos.power.d.ts| +|废弃版本有变化|类名:power<br>方法 or 属性:function isScreenOn(callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:power<br>方法 or 属性:function isScreenOn(callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:{@link power|@ohos.power.d.ts| +|废弃版本有变化|类名:power<br>方法 or 属性:function isScreenOn(): Promise\<boolean>;<br>废弃版本:N/A|类名:power<br>方法 or 属性:function isScreenOn(): Promise\<boolean>;<br>废弃版本:9<br>代替接口:{@link power|@ohos.power.d.ts| +|废弃版本有变化|类名:RunningLock<br>方法 or 属性:lock(timeout: number): void;<br>废弃版本:N/A|类名:RunningLock<br>方法 or 属性:lock(timeout: number): void;<br>废弃版本:9<br>代替接口:{@link RunningLock|@ohos.runningLock.d.ts| +|废弃版本有变化|类名:RunningLock<br>方法 or 属性:isUsed(): boolean;<br>废弃版本:N/A|类名:RunningLock<br>方法 or 属性:isUsed(): boolean;<br>废弃版本:9<br>代替接口:{@link RunningLock|@ohos.runningLock.d.ts| +|废弃版本有变化|类名:RunningLock<br>方法 or 属性:unlock(): void;<br>废弃版本:N/A|类名:RunningLock<br>方法 or 属性:unlock(): void;<br>废弃版本:9<br>代替接口:{@link RunningLock|@ohos.runningLock.d.ts| +|废弃版本有变化|类名:runningLock<br>方法 or 属性:function isRunningLockTypeSupported(type: RunningLockType, callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:runningLock<br>方法 or 属性:function isRunningLockTypeSupported(type: RunningLockType, callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:{@link RunningLock|@ohos.runningLock.d.ts| +|废弃版本有变化|类名:runningLock<br>方法 or 属性:function isRunningLockTypeSupported(type: RunningLockType): Promise\<boolean>;<br>废弃版本:N/A|类名:runningLock<br>方法 or 属性:function isRunningLockTypeSupported(type: RunningLockType): Promise\<boolean>;<br>废弃版本:9<br>代替接口:{@link RunningLock|@ohos.runningLock.d.ts| +|废弃版本有变化|类名:runningLock<br>方法 or 属性:function createRunningLock(name: string, type: RunningLockType, callback: AsyncCallback\<RunningLock>): void;<br>废弃版本:N/A|类名:runningLock<br>方法 or 属性:function createRunningLock(name: string, type: RunningLockType, callback: AsyncCallback\<RunningLock>): void;<br>废弃版本:9<br>代替接口:{@link RunningLock|@ohos.runningLock.d.ts| +|废弃版本有变化|类名:runningLock<br>方法 or 属性:function createRunningLock(name: string, type: RunningLockType): Promise\<RunningLock>;<br>废弃版本:N/A|类名:runningLock<br>方法 or 属性:function createRunningLock(name: string, type: RunningLockType): Promise\<RunningLock>;<br>废弃版本:9<br>代替接口:{@link RunningLock|@ohos.runningLock.d.ts| +|废弃版本有变化|类名:thermal<br>方法 or 属性:function subscribeThermalLevel(callback: AsyncCallback\<ThermalLevel>): void;<br>废弃版本:N/A|类名:thermal<br>方法 or 属性:function subscribeThermalLevel(callback: AsyncCallback\<ThermalLevel>): void;<br>废弃版本:9<br>代替接口:{@link thermal|@ohos.thermal.d.ts| +|废弃版本有变化|类名:thermal<br>方法 or 属性:function unsubscribeThermalLevel(callback?: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:thermal<br>方法 or 属性:function unsubscribeThermalLevel(callback?: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:{@link thermal|@ohos.thermal.d.ts| +|废弃版本有变化|类名:thermal<br>方法 or 属性:function getThermalLevel(): ThermalLevel;<br>废弃版本:N/A|类名:thermal<br>方法 or 属性:function getThermalLevel(): ThermalLevel;<br>废弃版本:9<br>代替接口:{@link thermal|@ohos.thermal.d.ts| +|废弃版本有变化|类名:BatteryResponse<br>废弃版本:N/A|类名:BatteryResponse<br>废弃版本:6<br>代替接口:N/A|@system.battery.d.ts| +|废弃版本有变化|类名:BatteryResponse<br>方法 or 属性:charging: boolean;<br>废弃版本:N/A|类名:BatteryResponse<br>方法 or 属性:charging: boolean;<br>废弃版本:6<br>代替接口:N/A|@system.battery.d.ts| +|废弃版本有变化|类名:BatteryResponse<br>方法 or 属性:level: number;<br>废弃版本:N/A|类名:BatteryResponse<br>方法 or 属性:level: number;<br>废弃版本:6<br>代替接口:N/A|@system.battery.d.ts| +|废弃版本有变化|类名:GetStatusOptions<br>废弃版本:N/A|类名:GetStatusOptions<br>废弃版本:6<br>代替接口:N/A|@system.battery.d.ts| +|废弃版本有变化|类名:GetStatusOptions<br>方法 or 属性:success?: (data: BatteryResponse) => void;<br>废弃版本:N/A|类名:GetStatusOptions<br>方法 or 属性:success?: (data: BatteryResponse) => void;<br>废弃版本:6<br>代替接口:N/A|@system.battery.d.ts| +|废弃版本有变化|类名:GetStatusOptions<br>方法 or 属性:fail?: (data: string, code: number) => void;<br>废弃版本:N/A|类名:GetStatusOptions<br>方法 or 属性:fail?: (data: string, code: number) => void;<br>废弃版本:6<br>代替接口:N/A|@system.battery.d.ts| +|废弃版本有变化|类名:GetStatusOptions<br>方法 or 属性:complete?: () => void;<br>废弃版本:N/A|类名:GetStatusOptions<br>方法 or 属性:complete?: () => void;<br>废弃版本:6<br>代替接口:N/A|@system.battery.d.ts| +|废弃版本有变化|类名:Battery<br>废弃版本:N/A|类名:Battery<br>废弃版本:6<br>代替接口:N/A|@system.battery.d.ts| +|废弃版本有变化|类名:Battery<br>方法 or 属性:static getStatus(options?: GetStatusOptions): void;<br>废弃版本:N/A|类名:Battery<br>方法 or 属性:static getStatus(options?: GetStatusOptions): void;<br>废弃版本:6<br>代替接口:N/A|@system.battery.d.ts| +|废弃版本有变化|类名:BrightnessResponse<br>废弃版本:N/A|类名:BrightnessResponse<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:BrightnessResponse<br>方法 or 属性:value: number;<br>废弃版本:N/A|类名:BrightnessResponse<br>方法 or 属性:value: number;<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:GetBrightnessOptions<br>废弃版本:N/A|类名:GetBrightnessOptions<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:GetBrightnessOptions<br>方法 or 属性:success?: (data: BrightnessResponse) => void;<br>废弃版本:N/A|类名:GetBrightnessOptions<br>方法 or 属性:success?: (data: BrightnessResponse) => void;<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:GetBrightnessOptions<br>方法 or 属性:fail?: (data: string, code: number) => void;<br>废弃版本:N/A|类名:GetBrightnessOptions<br>方法 or 属性:fail?: (data: string, code: number) => void;<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:GetBrightnessOptions<br>方法 or 属性:complete?: () => void;<br>废弃版本:N/A|类名:GetBrightnessOptions<br>方法 or 属性:complete?: () => void;<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:SetBrightnessOptions<br>废弃版本:N/A|类名:SetBrightnessOptions<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:SetBrightnessOptions<br>方法 or 属性:value: number;<br>废弃版本:N/A|类名:SetBrightnessOptions<br>方法 or 属性:value: number;<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:SetBrightnessOptions<br>方法 or 属性:success?: () => void;<br>废弃版本:N/A|类名:SetBrightnessOptions<br>方法 or 属性:success?: () => void;<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:SetBrightnessOptions<br>方法 or 属性:fail?: (data: string, code: number) => void;<br>废弃版本:N/A|类名:SetBrightnessOptions<br>方法 or 属性:fail?: (data: string, code: number) => void;<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:SetBrightnessOptions<br>方法 or 属性:complete?: () => void<br>废弃版本:N/A|类名:SetBrightnessOptions<br>方法 or 属性:complete?: () => void<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:BrightnessModeResponse<br>废弃版本:N/A|类名:BrightnessModeResponse<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:BrightnessModeResponse<br>方法 or 属性:mode: number;<br>废弃版本:N/A|类名:BrightnessModeResponse<br>方法 or 属性:mode: number;<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:GetBrightnessModeOptions<br>废弃版本:N/A|类名:GetBrightnessModeOptions<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:GetBrightnessModeOptions<br>方法 or 属性:success?: (data: BrightnessModeResponse) => void;<br>废弃版本:N/A|类名:GetBrightnessModeOptions<br>方法 or 属性:success?: (data: BrightnessModeResponse) => void;<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:GetBrightnessModeOptions<br>方法 or 属性:fail?: (data: string, code: number) => void;<br>废弃版本:N/A|类名:GetBrightnessModeOptions<br>方法 or 属性:fail?: (data: string, code: number) => void;<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:GetBrightnessModeOptions<br>方法 or 属性:complete?: () => void;<br>废弃版本:N/A|类名:GetBrightnessModeOptions<br>方法 or 属性:complete?: () => void;<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:SetBrightnessModeOptions<br>废弃版本:N/A|类名:SetBrightnessModeOptions<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:SetBrightnessModeOptions<br>方法 or 属性:mode: number;<br>废弃版本:N/A|类名:SetBrightnessModeOptions<br>方法 or 属性:mode: number;<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:SetBrightnessModeOptions<br>方法 or 属性:success?: () => void;<br>废弃版本:N/A|类名:SetBrightnessModeOptions<br>方法 or 属性:success?: () => void;<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:SetBrightnessModeOptions<br>方法 or 属性:fail?: (data: string, code: number) => void;<br>废弃版本:N/A|类名:SetBrightnessModeOptions<br>方法 or 属性:fail?: (data: string, code: number) => void;<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:SetBrightnessModeOptions<br>方法 or 属性:complete?: () => void<br>废弃版本:N/A|类名:SetBrightnessModeOptions<br>方法 or 属性:complete?: () => void<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:SetKeepScreenOnOptions<br>废弃版本:N/A|类名:SetKeepScreenOnOptions<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:SetKeepScreenOnOptions<br>方法 or 属性:keepScreenOn: boolean;<br>废弃版本:N/A|类名:SetKeepScreenOnOptions<br>方法 or 属性:keepScreenOn: boolean;<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:SetKeepScreenOnOptions<br>方法 or 属性:success?: () => void;<br>废弃版本:N/A|类名:SetKeepScreenOnOptions<br>方法 or 属性:success?: () => void;<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:SetKeepScreenOnOptions<br>方法 or 属性:fail?: (data: string, code: number) => void;<br>废弃版本:N/A|类名:SetKeepScreenOnOptions<br>方法 or 属性:fail?: (data: string, code: number) => void;<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:SetKeepScreenOnOptions<br>方法 or 属性:complete?: () => void<br>废弃版本:N/A|类名:SetKeepScreenOnOptions<br>方法 or 属性:complete?: () => void<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:Brightness<br>废弃版本:N/A|类名:Brightness<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:Brightness<br>方法 or 属性:static getValue(options?: GetBrightnessOptions): void;<br>废弃版本:N/A|类名:Brightness<br>方法 or 属性:static getValue(options?: GetBrightnessOptions): void;<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:Brightness<br>方法 or 属性:static setValue(options?: SetBrightnessOptions): void;<br>废弃版本:N/A|类名:Brightness<br>方法 or 属性:static setValue(options?: SetBrightnessOptions): void;<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:Brightness<br>方法 or 属性:static getMode(options?: GetBrightnessModeOptions): void;<br>废弃版本:N/A|类名:Brightness<br>方法 or 属性:static getMode(options?: GetBrightnessModeOptions): void;<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:Brightness<br>方法 or 属性:static setMode(options?: SetBrightnessModeOptions): void;<br>废弃版本:N/A|类名:Brightness<br>方法 or 属性:static setMode(options?: SetBrightnessModeOptions): void;<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|废弃版本有变化|类名:Brightness<br>方法 or 属性:static setKeepScreenOn(options?: SetKeepScreenOnOptions): void;<br>废弃版本:N/A|类名:Brightness<br>方法 or 属性:static setKeepScreenOn(options?: SetKeepScreenOnOptions): void;<br>废弃版本:7<br>代替接口:N/A|@system.brightness.d.ts| +|新增(错误码)|NA|类名:batteryStats<br>方法 or 属性:function getBatteryStats(callback: AsyncCallback\<Array\<BatteryStatsInfo>>): void;<br>错误码内容: 401|@ohos.batteryStatistics.d.ts| +|新增(错误码)|NA|类名:batteryStats<br>方法 or 属性:function getAppPowerValue(uid: number): number;<br>错误码内容: 4600101|@ohos.batteryStatistics.d.ts| +|新增(错误码)|NA|类名:batteryStats<br>方法 or 属性:function getAppPowerPercent(uid: number): number;<br>错误码内容: 4600101|@ohos.batteryStatistics.d.ts| +|新增(错误码)|NA|类名:batteryStats<br>方法 or 属性:function getHardwareUnitPowerValue(type: ConsumptionType): number;<br>错误码内容: 401, 4600101|@ohos.batteryStatistics.d.ts| +|新增(错误码)|NA|类名:batteryStats<br>方法 or 属性:function getHardwareUnitPowerPercent(type: ConsumptionType): number;<br>错误码内容: 401, 4600101|@ohos.batteryStatistics.d.ts| +|新增(错误码)|NA|类名:brightness<br>方法 or 属性:function setValue(value: number): void;<br>错误码内容: 401, 4700101|@ohos.brightness.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-bundle.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-bundle.md new file mode 100644 index 0000000000000000000000000000000000000000..befebbdffd9f14965bf30c81779de193cf2ac9bb --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-bundle.md @@ -0,0 +1,547 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.bundle.appControl<br>类名: appControl|@ohos.bundle.appControl.d.ts| +|新增|NA|模块名: ohos.bundle.appControl<br>类名: appControl<br>方法 or 属性: function setDisposedStatus(appId: string, disposedWant: Want, callback: AsyncCallback\<void>): void;|@ohos.bundle.appControl.d.ts| +|新增|NA|模块名: ohos.bundle.appControl<br>类名: appControl<br>方法 or 属性: function setDisposedStatus(appId: string, disposedWant: Want): Promise\<void>;|@ohos.bundle.appControl.d.ts| +|新增|NA|模块名: ohos.bundle.appControl<br>类名: appControl<br>方法 or 属性: function getDisposedStatus(appId: string, callback: AsyncCallback\<Want>): void;|@ohos.bundle.appControl.d.ts| +|新增|NA|模块名: ohos.bundle.appControl<br>类名: appControl<br>方法 or 属性: function getDisposedStatus(appId: string): Promise\<Want>;|@ohos.bundle.appControl.d.ts| +|新增|NA|模块名: ohos.bundle.appControl<br>类名: appControl<br>方法 or 属性: function deleteDisposedStatus(appId: string, callback: AsyncCallback\<void>): void;|@ohos.bundle.appControl.d.ts| +|新增|NA|模块名: ohos.bundle.appControl<br>类名: appControl<br>方法 or 属性: function deleteDisposedStatus(appId: string): Promise\<void>;|@ohos.bundle.appControl.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: BundleFlag|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: BundleFlag<br>方法 or 属性: GET_BUNDLE_INFO_DEFAULT = 0x00000000|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: BundleFlag<br>方法 or 属性: GET_BUNDLE_INFO_WITH_APPLICATION = 0x00000001|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: BundleFlag<br>方法 or 属性: GET_BUNDLE_INFO_WITH_HAP_MODULE = 0x00000002|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: BundleFlag<br>方法 or 属性: GET_BUNDLE_INFO_WITH_ABILITY = 0x00000004|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: BundleFlag<br>方法 or 属性: GET_BUNDLE_INFO_WITH_EXTENSION_ABILITY = 0x00000008|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: BundleFlag<br>方法 or 属性: GET_BUNDLE_INFO_WITH_REQUESTED_PERMISSION = 0x00000010|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: BundleFlag<br>方法 or 属性: GET_BUNDLE_INFO_WITH_METADATA = 0x00000020|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: BundleFlag<br>方法 or 属性: GET_BUNDLE_INFO_WITH_DISABLE = 0x00000040|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: BundleFlag<br>方法 or 属性: GET_BUNDLE_INFO_WITH_SIGNATURE_INFO = 0x00000080|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ApplicationFlag|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ApplicationFlag<br>方法 or 属性: GET_APPLICATION_INFO_DEFAULT = 0x00000000|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ApplicationFlag<br>方法 or 属性: GET_APPLICATION_INFO_WITH_PERMISSION = 0x00000001|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ApplicationFlag<br>方法 or 属性: GET_APPLICATION_INFO_WITH_METADATA = 0x00000002|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ApplicationFlag<br>方法 or 属性: GET_APPLICATION_INFO_WITH_DISABLE = 0x00000004|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: AbilityFlag|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: AbilityFlag<br>方法 or 属性: GET_ABILITY_INFO_DEFAULT = 0x00000000|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: AbilityFlag<br>方法 or 属性: GET_ABILITY_INFO_WITH_PERMISSION = 0x00000001|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: AbilityFlag<br>方法 or 属性: GET_ABILITY_INFO_WITH_APPLICATION = 0x00000002|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: AbilityFlag<br>方法 or 属性: GET_ABILITY_INFO_WITH_METADATA = 0x00000004|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: AbilityFlag<br>方法 or 属性: GET_ABILITY_INFO_WITH_DISABLE = 0x00000008|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: AbilityFlag<br>方法 or 属性: GET_ABILITY_INFO_ONLY_SYSTEM_APP = 0x00000010|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ExtensionAbilityFlag|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ExtensionAbilityFlag<br>方法 or 属性: GET_EXTENSION_ABILITY_INFO_DEFAULT = 0x00000000|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ExtensionAbilityFlag<br>方法 or 属性: GET_EXTENSION_ABILITY_INFO_WITH_PERMISSION = 0x00000001|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ExtensionAbilityFlag<br>方法 or 属性: GET_EXTENSION_ABILITY_INFO_WITH_APPLICATION = 0x00000002|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ExtensionAbilityFlag<br>方法 or 属性: GET_EXTENSION_ABILITY_INFO_WITH_METADATA = 0x00000004|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ExtensionAbilityType|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ExtensionAbilityType<br>方法 or 属性: FORM = 0|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ExtensionAbilityType<br>方法 or 属性: WORK_SCHEDULER = 1|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ExtensionAbilityType<br>方法 or 属性: INPUT_METHOD = 2|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ExtensionAbilityType<br>方法 or 属性: SERVICE = 3|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ExtensionAbilityType<br>方法 or 属性: ACCESSIBILITY = 4|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ExtensionAbilityType<br>方法 or 属性: DATA_SHARE = 5|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ExtensionAbilityType<br>方法 or 属性: FILE_SHARE = 6|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ExtensionAbilityType<br>方法 or 属性: STATIC_SUBSCRIBER = 7|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ExtensionAbilityType<br>方法 or 属性: WALLPAPER = 8|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ExtensionAbilityType<br>方法 or 属性: BACKUP = 9|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ExtensionAbilityType<br>方法 or 属性: WINDOW = 10|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ExtensionAbilityType<br>方法 or 属性: ENTERPRISE_ADMIN = 11|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ExtensionAbilityType<br>方法 or 属性: THUMBNAIL = 13|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ExtensionAbilityType<br>方法 or 属性: PREVIEW = 14|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ExtensionAbilityType<br>方法 or 属性: UNSPECIFIED = 255|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: PermissionGrantState|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: PermissionGrantState<br>方法 or 属性: PERMISSION_DENIED = -1|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: PermissionGrantState<br>方法 or 属性: PERMISSION_GRANTED = 0|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: SupportWindowMode|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: SupportWindowMode<br>方法 or 属性: FULL_SCREEN = 0|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: SupportWindowMode<br>方法 or 属性: SPLIT = 1|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: SupportWindowMode<br>方法 or 属性: FLOATING = 2|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: LaunchType|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: LaunchType<br>方法 or 属性: SINGLETON = 0|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: LaunchType<br>方法 or 属性: MULTITON = 1|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: LaunchType<br>方法 or 属性: SPECIFIED = 2|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: AbilityType|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: AbilityType<br>方法 or 属性: PAGE = 1|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: AbilityType<br>方法 or 属性: SERVICE = 2|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: AbilityType<br>方法 or 属性: DATA = 3|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: DisplayOrientation|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: DisplayOrientation<br>方法 or 属性: UNSPECIFIED|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: DisplayOrientation<br>方法 or 属性: LANDSCAPE|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: DisplayOrientation<br>方法 or 属性: PORTRAIT|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: DisplayOrientation<br>方法 or 属性: FOLLOW_RECENT|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: DisplayOrientation<br>方法 or 属性: LANDSCAPE_INVERTED|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: DisplayOrientation<br>方法 or 属性: PORTRAIT_INVERTED|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: DisplayOrientation<br>方法 or 属性: AUTO_ROTATION|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: DisplayOrientation<br>方法 or 属性: AUTO_ROTATION_LANDSCAPE|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: DisplayOrientation<br>方法 or 属性: AUTO_ROTATION_PORTRAIT|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: DisplayOrientation<br>方法 or 属性: AUTO_ROTATION_RESTRICTED|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: DisplayOrientation<br>方法 or 属性: AUTO_ROTATION_LANDSCAPE_RESTRICTED|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: DisplayOrientation<br>方法 or 属性: AUTO_ROTATION_PORTRAIT_RESTRICTED|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: DisplayOrientation<br>方法 or 属性: LOCKED|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ModuleType|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ModuleType<br>方法 or 属性: ENTRY = 1|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ModuleType<br>方法 or 属性: FEATURE = 2|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: ModuleType<br>方法 or 属性: SHARED = 3|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: BundleType|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: BundleType<br>方法 or 属性: APP = 0|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: BundleType<br>方法 or 属性: ATOMIC_SERVICE = 1|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getBundleInfoForSelf(bundleFlags: number): Promise\<BundleInfo>;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getBundleInfoForSelf(bundleFlags: number, callback: AsyncCallback\<BundleInfo>): void;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback\<BundleInfo>): void;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getBundleInfo(bundleName: string, bundleFlags: number, userId: number, callback: AsyncCallback\<BundleInfo>): void;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getBundleInfo(bundleName: string, bundleFlags: number, userId?: number): Promise\<BundleInfo>;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getApplicationInfo(bundleName: string, appFlags: number, callback: AsyncCallback\<ApplicationInfo>): void;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getApplicationInfo(bundleName: string, appFlags: number, userId: number, callback: AsyncCallback\<ApplicationInfo>): void;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getApplicationInfo(bundleName: string, appFlags: number, userId?: number): Promise\<ApplicationInfo>;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getAllBundleInfo(bundleFlags: number, callback: AsyncCallback\<Array\<BundleInfo>>): void;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getAllBundleInfo(bundleFlags: number, userId: number, callback: AsyncCallback\<Array\<BundleInfo>>): void;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getAllBundleInfo(bundleFlags: number, userId?: number): Promise\<Array\<BundleInfo>>;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getAllApplicationInfo(appFlags: number, callback: AsyncCallback\<Array\<ApplicationInfo>>): void;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getAllApplicationInfo(appFlags: number, userId: number, callback: AsyncCallback\<Array\<ApplicationInfo>>): void;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getAllApplicationInfo(appFlags: number, userId?: number): Promise\<Array\<ApplicationInfo>>;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function queryAbilityInfo(want: Want, abilityFlags: number, callback: AsyncCallback\<Array\<AbilityInfo>>): void;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function queryAbilityInfo(want: Want, abilityFlags: number, userId: number, callback: AsyncCallback\<Array\<AbilityInfo>>): void;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function queryAbilityInfo(want: Want, abilityFlags: number, userId?: number): Promise\<Array\<AbilityInfo>>;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function queryExtensionAbilityInfo(want: Want, extensionAbilityType: ExtensionAbilityType, extensionAbilityFlags: number, callback: AsyncCallback\<Array\<ExtensionAbilityInfo>>): void;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function queryExtensionAbilityInfo(want: Want, extensionAbilityType: ExtensionAbilityType, extensionAbilityFlags: number, userId: number, callback: AsyncCallback\<Array\<ExtensionAbilityInfo>>): void;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function queryExtensionAbilityInfo(want: Want, extensionAbilityType: ExtensionAbilityType, extensionAbilityFlags: number, userId?: number): Promise\<Array\<ExtensionAbilityInfo>>;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getBundleNameByUid(uid: number, callback: AsyncCallback\<string>): void|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getBundleNameByUid(uid: number): Promise\<string>;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number, callback: AsyncCallback\<BundleInfo>): void|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number): Promise\<BundleInfo>;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function cleanBundleCacheFiles(bundleName: string, callback: AsyncCallback\<void>): void;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function cleanBundleCacheFiles(bundleName: string): Promise\<void>;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function setApplicationEnabled(bundleName: string, isEnabled: boolean, callback: AsyncCallback\<void>): void;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function setApplicationEnabled(bundleName: string, isEnabled: boolean): Promise\<void>;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function setAbilityEnabled(info: AbilityInfo, isEnabled: boolean, callback: AsyncCallback\<void>): void;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function setAbilityEnabled(info: AbilityInfo, isEnabled: boolean): Promise\<void>;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function isApplicationEnabled(bundleName: string, callback: AsyncCallback\<boolean>): void;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function isApplicationEnabled(bundleName: string): Promise\<boolean>;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function isAbilityEnabled(info: AbilityInfo, callback: AsyncCallback\<boolean>): void;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function isAbilityEnabled(info: AbilityInfo): Promise\<boolean>;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getLaunchWantForBundle(bundleName: string, userId: number, callback: AsyncCallback\<Want>): void;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getLaunchWantForBundle(bundleName: string, callback: AsyncCallback\<Want>): void;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getLaunchWantForBundle(bundleName: string, userId?: number): Promise\<Want>;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getProfileByAbility(moduleName: string, abilityName: string, metadataName: string, callback: AsyncCallback\<Array\<string>>): void;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getProfileByAbility(moduleName: string, abilityName: string, metadataName?: string): Promise\<Array\<string>>;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName: string, callback: AsyncCallback\<Array\<string>>): void;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getProfileByExtensionAbility(moduleName: string, extensionAbilityName: string, metadataName?: string): Promise\<Array\<string>>;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getPermissionDef(permissionName: string, callback: AsyncCallback\<PermissionDef>): void;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getPermissionDef(permissionName: string): Promise\<PermissionDef>;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getAbilityLabel(bundleName: string, moduleName: string, abilityName: string, callback: AsyncCallback\<string>): void;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getAbilityLabel(bundleName: string, moduleName: string, abilityName: string): Promise\<string>;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getApplicationInfoSync(bundleName: string, applicationFlags: number, userId: number) : ApplicationInfo;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getApplicationInfoSync(bundleName: string, applicationFlags: number) : ApplicationInfo;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getBundleInfoSync(bundleName: string, bundleFlags: number, userId: number): BundleInfo;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleManager<br>类名: bundleManager<br>方法 or 属性: function getBundleInfoSync(bundleName: string, bundleFlags: number): BundleInfo;|@ohos.bundle.bundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.bundleMonitor<br>类名: bundleMonitor|@ohos.bundle.bundleMonitor.d.ts| +|新增|NA|模块名: ohos.bundle.bundleMonitor<br>类名: BundleChangedEvent<br>方法 or 属性: type BundleChangedEvent = 'add' \| 'update' \| 'remove';|@ohos.bundle.bundleMonitor.d.ts| +|新增|NA|模块名: ohos.bundle.bundleMonitor<br>类名: BundleChangedEvent<br>方法 or 属性: type BundleChangedEvent = 'add' \| 'update' \| 'remove';|@ohos.bundle.bundleMonitor.d.ts| +|新增|NA|模块名: ohos.bundle.bundleMonitor<br>类名: BundleChangedEvent<br>方法 or 属性: type BundleChangedEvent = 'add' \| 'update' \| 'remove';|@ohos.bundle.bundleMonitor.d.ts| +|新增|NA|模块名: ohos.bundle.bundleMonitor<br>类名: BundleChangedInfo|@ohos.bundle.bundleMonitor.d.ts| +|新增|NA|模块名: ohos.bundle.bundleMonitor<br>类名: BundleChangedInfo<br>方法 or 属性: readonly bundleName: string;|@ohos.bundle.bundleMonitor.d.ts| +|新增|NA|模块名: ohos.bundle.bundleMonitor<br>类名: BundleChangedInfo<br>方法 or 属性: readonly userId: number;|@ohos.bundle.bundleMonitor.d.ts| +|新增|NA|模块名: ohos.bundle.bundleMonitor<br>类名: bundleMonitor<br>方法 or 属性: function on(type: BundleChangedEvent, callback: Callback\<BundleChangedInfo>): void;|@ohos.bundle.bundleMonitor.d.ts| +|新增|NA|模块名: ohos.bundle.bundleMonitor<br>类名: bundleMonitor<br>方法 or 属性: function on(type: BundleChangedEvent, callback: Callback\<BundleChangedInfo>): void;|@ohos.bundle.bundleMonitor.d.ts| +|新增|NA|模块名: ohos.bundle.bundleMonitor<br>类名: bundleMonitor<br>方法 or 属性: function on(type: BundleChangedEvent, callback: Callback\<BundleChangedInfo>): void;|@ohos.bundle.bundleMonitor.d.ts| +|新增|NA|模块名: ohos.bundle.bundleMonitor<br>类名: bundleMonitor<br>方法 or 属性: function off(type: BundleChangedEvent, callback?: Callback\<BundleChangedInfo>): void;|@ohos.bundle.bundleMonitor.d.ts| +|新增|NA|模块名: ohos.bundle.bundleMonitor<br>类名: bundleMonitor<br>方法 or 属性: function off(type: BundleChangedEvent, callback?: Callback\<BundleChangedInfo>): void;|@ohos.bundle.bundleMonitor.d.ts| +|新增|NA|模块名: ohos.bundle.bundleMonitor<br>类名: bundleMonitor<br>方法 or 属性: function off(type: BundleChangedEvent, callback?: Callback\<BundleChangedInfo>): void;|@ohos.bundle.bundleMonitor.d.ts| +|新增|NA|模块名: ohos.bundle.defaultAppManager<br>类名: defaultAppManager|@ohos.bundle.defaultAppManager.d.ts| +|新增|NA|模块名: ohos.bundle.defaultAppManager<br>类名: ApplicationType|@ohos.bundle.defaultAppManager.d.ts| +|新增|NA|模块名: ohos.bundle.defaultAppManager<br>类名: ApplicationType<br>方法 or 属性: BROWSER = "Web Browser"|@ohos.bundle.defaultAppManager.d.ts| +|新增|NA|模块名: ohos.bundle.defaultAppManager<br>类名: ApplicationType<br>方法 or 属性: IMAGE = "Image Gallery"|@ohos.bundle.defaultAppManager.d.ts| +|新增|NA|模块名: ohos.bundle.defaultAppManager<br>类名: ApplicationType<br>方法 or 属性: AUDIO = "Audio Player"|@ohos.bundle.defaultAppManager.d.ts| +|新增|NA|模块名: ohos.bundle.defaultAppManager<br>类名: ApplicationType<br>方法 or 属性: VIDEO = "Video Player"|@ohos.bundle.defaultAppManager.d.ts| +|新增|NA|模块名: ohos.bundle.defaultAppManager<br>类名: ApplicationType<br>方法 or 属性: PDF = "PDF Viewer"|@ohos.bundle.defaultAppManager.d.ts| +|新增|NA|模块名: ohos.bundle.defaultAppManager<br>类名: ApplicationType<br>方法 or 属性: WORD = "Word Viewer"|@ohos.bundle.defaultAppManager.d.ts| +|新增|NA|模块名: ohos.bundle.defaultAppManager<br>类名: ApplicationType<br>方法 or 属性: EXCEL = "Excel Viewer"|@ohos.bundle.defaultAppManager.d.ts| +|新增|NA|模块名: ohos.bundle.defaultAppManager<br>类名: ApplicationType<br>方法 or 属性: PPT = "PPT Viewer"|@ohos.bundle.defaultAppManager.d.ts| +|新增|NA|模块名: ohos.bundle.defaultAppManager<br>类名: defaultAppManager<br>方法 or 属性: function isDefaultApplication(type: string, callback: AsyncCallback\<boolean>) : void;|@ohos.bundle.defaultAppManager.d.ts| +|新增|NA|模块名: ohos.bundle.defaultAppManager<br>类名: defaultAppManager<br>方法 or 属性: function isDefaultApplication(type: string) : Promise\<boolean>;|@ohos.bundle.defaultAppManager.d.ts| +|新增|NA|模块名: ohos.bundle.defaultAppManager<br>类名: defaultAppManager<br>方法 or 属性: function getDefaultApplication(type: string, userId: number, callback: AsyncCallback\<BundleInfo>) : void;|@ohos.bundle.defaultAppManager.d.ts| +|新增|NA|模块名: ohos.bundle.defaultAppManager<br>类名: defaultAppManager<br>方法 or 属性: function getDefaultApplication(type: string, callback: AsyncCallback\<BundleInfo>) : void;|@ohos.bundle.defaultAppManager.d.ts| +|新增|NA|模块名: ohos.bundle.defaultAppManager<br>类名: defaultAppManager<br>方法 or 属性: function getDefaultApplication(type: string, userId?: number) : Promise\<BundleInfo>;|@ohos.bundle.defaultAppManager.d.ts| +|新增|NA|模块名: ohos.bundle.defaultAppManager<br>类名: defaultAppManager<br>方法 or 属性: function setDefaultApplication(type: string, elementName: ElementName, userId: number, callback: AsyncCallback\<void>) : void;|@ohos.bundle.defaultAppManager.d.ts| +|新增|NA|模块名: ohos.bundle.defaultAppManager<br>类名: defaultAppManager<br>方法 or 属性: function setDefaultApplication(type: string, elementName: ElementName, callback: AsyncCallback\<void>) : void;|@ohos.bundle.defaultAppManager.d.ts| +|新增|NA|模块名: ohos.bundle.defaultAppManager<br>类名: defaultAppManager<br>方法 or 属性: function setDefaultApplication(type: string, elementName: ElementName, userId?: number) : Promise\<void>;|@ohos.bundle.defaultAppManager.d.ts| +|新增|NA|模块名: ohos.bundle.defaultAppManager<br>类名: defaultAppManager<br>方法 or 属性: function resetDefaultApplication(type: string, userId: number, callback: AsyncCallback\<void>) : void;|@ohos.bundle.defaultAppManager.d.ts| +|新增|NA|模块名: ohos.bundle.defaultAppManager<br>类名: defaultAppManager<br>方法 or 属性: function resetDefaultApplication(type: string, callback: AsyncCallback\<void>) : void;|@ohos.bundle.defaultAppManager.d.ts| +|新增|NA|模块名: ohos.bundle.defaultAppManager<br>类名: defaultAppManager<br>方法 or 属性: function resetDefaultApplication(type: string, userId?: number) : Promise\<void>;|@ohos.bundle.defaultAppManager.d.ts| +|新增|NA|模块名: ohos.bundle.distributedBundleManager<br>类名: distributedBundleManager|@ohos.bundle.distributedBundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.distributedBundleManager<br>类名: distributedBundleManager<br>方法 or 属性: function getRemoteAbilityInfo(elementName: ElementName, callback: AsyncCallback\<RemoteAbilityInfo>): void;|@ohos.bundle.distributedBundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.distributedBundleManager<br>类名: distributedBundleManager<br>方法 or 属性: function getRemoteAbilityInfo(elementName: ElementName): Promise\<RemoteAbilityInfo>;|@ohos.bundle.distributedBundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.distributedBundleManager<br>类名: distributedBundleManager<br>方法 or 属性: function getRemoteAbilityInfo(elementNames: Array\<ElementName>, callback: AsyncCallback\<Array\<RemoteAbilityInfo>>): void;|@ohos.bundle.distributedBundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.distributedBundleManager<br>类名: distributedBundleManager<br>方法 or 属性: function getRemoteAbilityInfo(elementNames: Array\<ElementName>): Promise\<Array\<RemoteAbilityInfo>>;|@ohos.bundle.distributedBundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.distributedBundleManager<br>类名: distributedBundleManager<br>方法 or 属性: function getRemoteAbilityInfo(elementName: ElementName, locale: string, callback: AsyncCallback\<RemoteAbilityInfo>): void;|@ohos.bundle.distributedBundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.distributedBundleManager<br>类名: distributedBundleManager<br>方法 or 属性: function getRemoteAbilityInfo(elementName: ElementName, locale: string): Promise\<RemoteAbilityInfo>;|@ohos.bundle.distributedBundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.distributedBundleManager<br>类名: distributedBundleManager<br>方法 or 属性: function getRemoteAbilityInfo(elementNames: Array\<ElementName>, locale: string, callback: AsyncCallback\<Array\<RemoteAbilityInfo>>): void;|@ohos.bundle.distributedBundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.distributedBundleManager<br>类名: distributedBundleManager<br>方法 or 属性: function getRemoteAbilityInfo(elementNames: Array\<ElementName>, locale: string): Promise\<Array\<RemoteAbilityInfo>>;|@ohos.bundle.distributedBundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.freeInstall<br>类名: freeInstall|@ohos.bundle.freeInstall.d.ts| +|新增|NA|模块名: ohos.bundle.freeInstall<br>类名: UpgradeFlag|@ohos.bundle.freeInstall.d.ts| +|新增|NA|模块名: ohos.bundle.freeInstall<br>类名: UpgradeFlag<br>方法 or 属性: NOT_UPGRADE = 0|@ohos.bundle.freeInstall.d.ts| +|新增|NA|模块名: ohos.bundle.freeInstall<br>类名: UpgradeFlag<br>方法 or 属性: SINGLE_UPGRADE = 1|@ohos.bundle.freeInstall.d.ts| +|新增|NA|模块名: ohos.bundle.freeInstall<br>类名: UpgradeFlag<br>方法 or 属性: RELATION_UPGRADE = 2|@ohos.bundle.freeInstall.d.ts| +|新增|NA|模块名: ohos.bundle.freeInstall<br>类名: BundlePackFlag|@ohos.bundle.freeInstall.d.ts| +|新增|NA|模块名: ohos.bundle.freeInstall<br>类名: BundlePackFlag<br>方法 or 属性: GET_PACK_INFO_ALL = 0x00000000|@ohos.bundle.freeInstall.d.ts| +|新增|NA|模块名: ohos.bundle.freeInstall<br>类名: BundlePackFlag<br>方法 or 属性: GET_PACKAGES = 0x00000001|@ohos.bundle.freeInstall.d.ts| +|新增|NA|模块名: ohos.bundle.freeInstall<br>类名: BundlePackFlag<br>方法 or 属性: GET_BUNDLE_SUMMARY = 0x00000002|@ohos.bundle.freeInstall.d.ts| +|新增|NA|模块名: ohos.bundle.freeInstall<br>类名: BundlePackFlag<br>方法 or 属性: GET_MODULE_SUMMARY = 0x00000004|@ohos.bundle.freeInstall.d.ts| +|新增|NA|模块名: ohos.bundle.freeInstall<br>类名: freeInstall<br>方法 or 属性: function setHapModuleUpgradeFlag(bundleName: string, moduleName: string, upgradeFlag: UpgradeFlag, callback: AsyncCallback\<void>) : void;|@ohos.bundle.freeInstall.d.ts| +|新增|NA|模块名: ohos.bundle.freeInstall<br>类名: freeInstall<br>方法 or 属性: function setHapModuleUpgradeFlag(bundleName: string, moduleName: string, upgradeFlag: UpgradeFlag): Promise\<void>;|@ohos.bundle.freeInstall.d.ts| +|新增|NA|模块名: ohos.bundle.freeInstall<br>类名: freeInstall<br>方法 or 属性: function isHapModuleRemovable(bundleName: string, moduleName: string, callback: AsyncCallback\<boolean>): void;|@ohos.bundle.freeInstall.d.ts| +|新增|NA|模块名: ohos.bundle.freeInstall<br>类名: freeInstall<br>方法 or 属性: function isHapModuleRemovable(bundleName: string, moduleName: string): Promise\<boolean>;|@ohos.bundle.freeInstall.d.ts| +|新增|NA|模块名: ohos.bundle.freeInstall<br>类名: freeInstall<br>方法 or 属性: function getBundlePackInfo(bundleName: string, bundlePackFlag : BundlePackFlag, callback: AsyncCallback\<BundlePackInfo>): void;|@ohos.bundle.freeInstall.d.ts| +|新增|NA|模块名: ohos.bundle.freeInstall<br>类名: freeInstall<br>方法 or 属性: function getBundlePackInfo(bundleName: string, bundlePackFlag : BundlePackFlag): Promise\<BundlePackInfo>;|@ohos.bundle.freeInstall.d.ts| +|新增|NA|模块名: ohos.bundle.freeInstall<br>类名: freeInstall<br>方法 or 属性: function getDispatchInfo(callback: AsyncCallback\<DispatchInfo>): void;|@ohos.bundle.freeInstall.d.ts| +|新增|NA|模块名: ohos.bundle.freeInstall<br>类名: freeInstall<br>方法 or 属性: function getDispatchInfo(): Promise\<DispatchInfo>;|@ohos.bundle.freeInstall.d.ts| +|新增|NA|模块名: ohos.bundle.installer<br>类名: installer|@ohos.bundle.installer.d.ts| +|新增|NA|模块名: ohos.bundle.installer<br>类名: installer<br>方法 or 属性: function getBundleInstaller(callback: AsyncCallback\<BundleInstaller>): void|@ohos.bundle.installer.d.ts| +|新增|NA|模块名: ohos.bundle.installer<br>类名: installer<br>方法 or 属性: function getBundleInstaller(): Promise\<BundleInstaller>;|@ohos.bundle.installer.d.ts| +|新增|NA|模块名: ohos.bundle.installer<br>类名: BundleInstaller|@ohos.bundle.installer.d.ts| +|新增|NA|模块名: ohos.bundle.installer<br>类名: BundleInstaller<br>方法 or 属性: install(hapFilePaths: Array\<string>, installParam: InstallParam, callback: AsyncCallback\<void>) : void;|@ohos.bundle.installer.d.ts| +|新增|NA|模块名: ohos.bundle.installer<br>类名: BundleInstaller<br>方法 or 属性: install(hapFilePaths: Array\<string>, callback: AsyncCallback\<void>) : void;|@ohos.bundle.installer.d.ts| +|新增|NA|模块名: ohos.bundle.installer<br>类名: BundleInstaller<br>方法 or 属性: install(hapFilePaths: Array\<string>, installParam?: InstallParam) : Promise\<void>;|@ohos.bundle.installer.d.ts| +|新增|NA|模块名: ohos.bundle.installer<br>类名: BundleInstaller<br>方法 or 属性: uninstall(bundleName: string, installParam: InstallParam, callback : AsyncCallback\<void>) : void;|@ohos.bundle.installer.d.ts| +|新增|NA|模块名: ohos.bundle.installer<br>类名: BundleInstaller<br>方法 or 属性: uninstall(bundleName: string, callback : AsyncCallback\<void>) : void;|@ohos.bundle.installer.d.ts| +|新增|NA|模块名: ohos.bundle.installer<br>类名: BundleInstaller<br>方法 or 属性: uninstall(bundleName: string, installParam?: InstallParam) : Promise\<void>;|@ohos.bundle.installer.d.ts| +|新增|NA|模块名: ohos.bundle.installer<br>类名: BundleInstaller<br>方法 or 属性: recover(bundleName: string, installParam: InstallParam, callback: AsyncCallback\<void>): void;|@ohos.bundle.installer.d.ts| +|新增|NA|模块名: ohos.bundle.installer<br>类名: BundleInstaller<br>方法 or 属性: recover(bundleName: string, callback: AsyncCallback\<void>): void;|@ohos.bundle.installer.d.ts| +|新增|NA|模块名: ohos.bundle.installer<br>类名: BundleInstaller<br>方法 or 属性: recover(bundleName: string, installParam?: InstallParam) : Promise\<void>;|@ohos.bundle.installer.d.ts| +|新增|NA|模块名: ohos.bundle.installer<br>类名: HashParam|@ohos.bundle.installer.d.ts| +|新增|NA|模块名: ohos.bundle.installer<br>类名: HashParam<br>方法 or 属性: moduleName: string;|@ohos.bundle.installer.d.ts| +|新增|NA|模块名: ohos.bundle.installer<br>类名: HashParam<br>方法 or 属性: hashValue: string;|@ohos.bundle.installer.d.ts| +|新增|NA|模块名: ohos.bundle.installer<br>类名: InstallParam|@ohos.bundle.installer.d.ts| +|新增|NA|模块名: ohos.bundle.installer<br>类名: InstallParam<br>方法 or 属性: userId?: number;|@ohos.bundle.installer.d.ts| +|新增|NA|模块名: ohos.bundle.installer<br>类名: InstallParam<br>方法 or 属性: installFlag?: number;|@ohos.bundle.installer.d.ts| +|新增|NA|模块名: ohos.bundle.installer<br>类名: InstallParam<br>方法 or 属性: isKeepData?: boolean;|@ohos.bundle.installer.d.ts| +|新增|NA|模块名: ohos.bundle.installer<br>类名: InstallParam<br>方法 or 属性: hashParams?: Array\<HashParam>;|@ohos.bundle.installer.d.ts| +|新增|NA|模块名: ohos.bundle.installer<br>类名: InstallParam<br>方法 or 属性: crowdtestDeadline?: number;|@ohos.bundle.installer.d.ts| +|新增|NA|模块名: ohos.bundle.launcherBundleManager<br>类名: launcherBundleManager|@ohos.bundle.launcherBundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.launcherBundleManager<br>类名: launcherBundleManager<br>方法 or 属性: function getLauncherAbilityInfo(bundleName: string, userId: number, callback: AsyncCallback\<Array\<LauncherAbilityInfo>>) : void;|@ohos.bundle.launcherBundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.launcherBundleManager<br>类名: launcherBundleManager<br>方法 or 属性: function getLauncherAbilityInfo(bundleName: string, userId: number) : Promise\<Array\<LauncherAbilityInfo>>;|@ohos.bundle.launcherBundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.launcherBundleManager<br>类名: launcherBundleManager<br>方法 or 属性: function getAllLauncherAbilityInfo(userId: number, callback: AsyncCallback\<Array\<LauncherAbilityInfo>>) : void;|@ohos.bundle.launcherBundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.launcherBundleManager<br>类名: launcherBundleManager<br>方法 or 属性: function getAllLauncherAbilityInfo(userId: number) : Promise\<Array\<LauncherAbilityInfo>>;|@ohos.bundle.launcherBundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.launcherBundleManager<br>类名: launcherBundleManager<br>方法 or 属性: function getShortcutInfo(bundleName :string, callback: AsyncCallback\<Array\<ShortcutInfo>>) : void;|@ohos.bundle.launcherBundleManager.d.ts| +|新增|NA|模块名: ohos.bundle.launcherBundleManager<br>类名: launcherBundleManager<br>方法 or 属性: function getShortcutInfo(bundleName : string) : Promise\<Array\<ShortcutInfo>>;|@ohos.bundle.launcherBundleManager.d.ts| +|新增|NA|类名:zlib<br>方法or属性:function compressFile(inFile: string, outFile: string, options: Options, callback: AsyncCallback\<void>): void;|@ohos.zlib.d.ts| +|新增|NA|类名:zlib<br>方法or属性:function compressFile(inFile:string, outFile:string, options: Options): Promise\<void>;|@ohos.zlib.d.ts| +|新增|NA|类名:zlib<br>方法or属性:function decompressFile(inFile: string, outFile: string, options: Options, callback: AsyncCallback\<void>): void;|@ohos.zlib.d.ts| +|新增|NA|类名:zlib<br>方法or属性:function decompressFile(inFile: string, outFile: string, options: Options): Promise\<void>;|@ohos.zlib.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly bundleName: string;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly moduleName: string;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly name: string;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly label: string;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly labelId: number;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly description: string;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly descriptionId: number;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly icon: string;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly iconId: number;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly process: string;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly exported: boolean;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly type: bundleManager.AbilityType;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly orientation: bundleManager.DisplayOrientation;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly launchType: bundleManager.LaunchType;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly permissions: Array\<string>;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly readPermission: string;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly writePermission: string;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly uri: string;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly deviceTypes: Array\<string>;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly applicationInfo: ApplicationInfo;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly metadata: Array\<Metadata>;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly enabled: boolean;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly supportWindowModes: Array\<bundleManager.SupportWindowMode>;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: AbilityInfo<br>方法 or 属性: readonly windowSize: WindowSize;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: WindowSize|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: WindowSize<br>方法 or 属性: readonly maxWindowRatio: number;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: WindowSize<br>方法 or 属性: readonly minWindowRatio: number;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: WindowSize<br>方法 or 属性: readonly maxWindowWidth: number;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: WindowSize<br>方法 or 属性: readonly minWindowWidth: number;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: WindowSize<br>方法 or 属性: readonly maxWindowHeight: number;|AbilityInfo.d.ts| +|新增|NA|模块名: AbilityInfo<br>类名: WindowSize<br>方法 or 属性: readonly minWindowHeight: number;|AbilityInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly name: string;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly description: string;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly descriptionId: number;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly enabled: boolean;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly label: string;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly labelId: number;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly icon: string;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly iconId: number;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly process: string;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly permissions: Array\<string>;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly codePath: string;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly metadata: Map\<string, Array\<Metadata>>;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly removable: boolean;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly accessTokenId: number;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly uid: number;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly iconResource: Resource;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly labelResource: Resource;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly descriptionResource: Resource;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly appDistributionType: string;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly appProvisionType: string;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly systemApp: boolean;|ApplicationInfo.d.ts| +|新增|NA|模块名: ApplicationInfo<br>类名: ApplicationInfo<br>方法 or 属性: readonly bundleType: bundleManager.BundleType;|ApplicationInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: BundleInfo|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: BundleInfo<br>方法 or 属性: readonly name: string;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: BundleInfo<br>方法 or 属性: readonly vendor: string;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: BundleInfo<br>方法 or 属性: readonly versionCode: number;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: BundleInfo<br>方法 or 属性: readonly versionName: string;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: BundleInfo<br>方法 or 属性: readonly minCompatibleVersionCode: number;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: BundleInfo<br>方法 or 属性: readonly targetVersion: number;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: BundleInfo<br>方法 or 属性: readonly appInfo: ApplicationInfo;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: BundleInfo<br>方法 or 属性: readonly hapModulesInfo: Array\<HapModuleInfo>;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: BundleInfo<br>方法 or 属性: readonly reqPermissionDetails: Array\<ReqPermissionDetail>;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: BundleInfo<br>方法 or 属性: readonly permissionGrantStates: Array\<bundleManager.PermissionGrantState>;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: BundleInfo<br>方法 or 属性: readonly signatureInfo: SignatureInfo;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: BundleInfo<br>方法 or 属性: readonly installTime: number;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: BundleInfo<br>方法 or 属性: readonly updateTime: number;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: ReqPermissionDetail|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: ReqPermissionDetail<br>方法 or 属性: name: string;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: ReqPermissionDetail<br>方法 or 属性: reason: string;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: ReqPermissionDetail<br>方法 or 属性: reasonId: number;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: ReqPermissionDetail<br>方法 or 属性: usedScene: UsedScene;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: UsedScene|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: UsedScene<br>方法 or 属性: abilities: Array\<string>;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: UsedScene<br>方法 or 属性: when: string;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: SignatureInfo|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: SignatureInfo<br>方法 or 属性: readonly appId: string;|BundleInfo.d.ts| +|新增|NA|模块名: BundleInfo<br>类名: SignatureInfo<br>方法 or 属性: readonly fingerprint: string;|BundleInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: BundlePackInfo|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: BundlePackInfo<br>方法 or 属性: readonly packages: Array\<PackageConfig>;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: BundlePackInfo<br>方法 or 属性: readonly summary: PackageSummary;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: PackageConfig|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: PackageConfig<br>方法 or 属性: readonly deviceTypes: Array\<string>;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: PackageConfig<br>方法 or 属性: readonly name: string;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: PackageConfig<br>方法 or 属性: readonly moduleType: string;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: PackageConfig<br>方法 or 属性: readonly deliveryWithInstall: boolean;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: PackageSummary|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: PackageSummary<br>方法 or 属性: readonly app: BundleConfigInfo;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: PackageSummary<br>方法 or 属性: readonly modules: Array\<ModuleConfigInfo>;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: BundleConfigInfo|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: BundleConfigInfo<br>方法 or 属性: readonly bundleName: string;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: BundleConfigInfo<br>方法 or 属性: readonly version: Version;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ExtensionAbility|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ExtensionAbility<br>方法 or 属性: readonly name: string;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ExtensionAbility<br>方法 or 属性: readonly forms: Array\<AbilityFormInfo>;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleConfigInfo|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleConfigInfo<br>方法 or 属性: readonly mainAbility: string;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleConfigInfo<br>方法 or 属性: readonly apiVersion: ApiVersion;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleConfigInfo<br>方法 or 属性: readonly deviceTypes: Array\<string>;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleConfigInfo<br>方法 or 属性: readonly distro: ModuleDistroInfo;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleConfigInfo<br>方法 or 属性: readonly abilities: Array\<ModuleAbilityInfo>;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleConfigInfo<br>方法 or 属性: readonly extensionAbilities: Array\<ExtensionAbility>;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleDistroInfo|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleDistroInfo<br>方法 or 属性: readonly deliveryWithInstall: boolean;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleDistroInfo<br>方法 or 属性: readonly installationFree: boolean;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleDistroInfo<br>方法 or 属性: readonly moduleName: string;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleDistroInfo<br>方法 or 属性: readonly moduleType: string;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleAbilityInfo|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleAbilityInfo<br>方法 or 属性: readonly name: string;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleAbilityInfo<br>方法 or 属性: readonly label: string;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleAbilityInfo<br>方法 or 属性: readonly exported: boolean;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ModuleAbilityInfo<br>方法 or 属性: readonly forms: Array\<AbilityFormInfo>;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: AbilityFormInfo|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: AbilityFormInfo<br>方法 or 属性: readonly name: string;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: AbilityFormInfo<br>方法 or 属性: readonly type: string;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: AbilityFormInfo<br>方法 or 属性: readonly updateEnabled: boolean;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: AbilityFormInfo<br>方法 or 属性: readonly scheduledUpdateTime: string;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: AbilityFormInfo<br>方法 or 属性: readonly updateDuration: number;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: AbilityFormInfo<br>方法 or 属性: readonly supportDimensions: Array\<string>;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: AbilityFormInfo<br>方法 or 属性: readonly defaultDimension: string;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: Version|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: Version<br>方法 or 属性: readonly minCompatibleVersionCode: number;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: Version<br>方法 or 属性: readonly name: string;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: Version<br>方法 or 属性: readonly code: number;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ApiVersion|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ApiVersion<br>方法 or 属性: readonly releaseType: string;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ApiVersion<br>方法 or 属性: readonly compatible: number;|BundlePackInfo.d.ts| +|新增|NA|模块名: BundlePackInfo<br>类名: ApiVersion<br>方法 or 属性: readonly target: number;|BundlePackInfo.d.ts| +|新增|NA|模块名: DispatchInfo<br>类名: DispatchInfo|DispatchInfo.d.ts| +|新增|NA|模块名: DispatchInfo<br>类名: DispatchInfo<br>方法 or 属性: readonly version: string;|DispatchInfo.d.ts| +|新增|NA|模块名: DispatchInfo<br>类名: DispatchInfo<br>方法 or 属性: readonly dispatchAPIVersion: string;|DispatchInfo.d.ts| +|新增|NA|模块名: ElementName<br>类名: ElementName|ElementName.d.ts| +|新增|NA|模块名: ElementName<br>类名: ElementName<br>方法 or 属性: deviceId?: string;|ElementName.d.ts| +|新增|NA|模块名: ElementName<br>类名: ElementName<br>方法 or 属性: bundleName: string;|ElementName.d.ts| +|新增|NA|模块名: ElementName<br>类名: ElementName<br>方法 or 属性: moduleName?: string;|ElementName.d.ts| +|新增|NA|模块名: ElementName<br>类名: ElementName<br>方法 or 属性: abilityName: string;|ElementName.d.ts| +|新增|NA|模块名: ElementName<br>类名: ElementName<br>方法 or 属性: uri?: string;|ElementName.d.ts| +|新增|NA|模块名: ElementName<br>类名: ElementName<br>方法 or 属性: shortName?: string;|ElementName.d.ts| +|新增|NA|模块名: ExtensionAbilityInfo<br>类名: ExtensionAbilityInfo|ExtensionAbilityInfo.d.ts| +|新增|NA|模块名: ExtensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性: readonly bundleName: string;|ExtensionAbilityInfo.d.ts| +|新增|NA|模块名: ExtensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性: readonly moduleName: string;|ExtensionAbilityInfo.d.ts| +|新增|NA|模块名: ExtensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性: readonly name: string;|ExtensionAbilityInfo.d.ts| +|新增|NA|模块名: ExtensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性: readonly labelId: number;|ExtensionAbilityInfo.d.ts| +|新增|NA|模块名: ExtensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性: readonly descriptionId: number;|ExtensionAbilityInfo.d.ts| +|新增|NA|模块名: ExtensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性: readonly iconId: number;|ExtensionAbilityInfo.d.ts| +|新增|NA|模块名: ExtensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性: readonly exported: boolean;|ExtensionAbilityInfo.d.ts| +|新增|NA|模块名: ExtensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性: readonly extensionAbilityType: bundleManager.ExtensionAbilityType;|ExtensionAbilityInfo.d.ts| +|新增|NA|模块名: ExtensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性: readonly permissions: Array\<string>;|ExtensionAbilityInfo.d.ts| +|新增|NA|模块名: ExtensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性: readonly applicationInfo: ApplicationInfo;|ExtensionAbilityInfo.d.ts| +|新增|NA|模块名: ExtensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性: readonly metadata: Array\<Metadata>;|ExtensionAbilityInfo.d.ts| +|新增|NA|模块名: ExtensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性: readonly enabled: boolean;|ExtensionAbilityInfo.d.ts| +|新增|NA|模块名: ExtensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性: readonly readPermission: string;|ExtensionAbilityInfo.d.ts| +|新增|NA|模块名: ExtensionAbilityInfo<br>类名: ExtensionAbilityInfo<br>方法 or 属性: readonly writePermission: string;|ExtensionAbilityInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly name: string;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly icon: string;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly iconId: number;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly label: string;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly labelId: number;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly description: string;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly descriptionId: number;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly mainElementName: string;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly abilitiesInfo: Array\<AbilityInfo>;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly extensionAbilitiesInfo: Array\<ExtensionAbilityInfo>;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly metadata: Array\<Metadata>;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly deviceTypes: Array\<string>;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly installationFree: boolean;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly hashValue: string;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly type: bundleManager.ModuleType;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly dependencies: Array\<Dependency>;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: HapModuleInfo<br>方法 or 属性: readonly preloads: Array\<PreloadItem>;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: Dependency|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: Dependency<br>方法 or 属性: readonly moduleName: string;|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: PreloadItem|HapModuleInfo.d.ts| +|新增|NA|模块名: HapModuleInfo<br>类名: PreloadItem<br>方法 or 属性: readonly moduleName: string;|HapModuleInfo.d.ts| +|新增|NA|模块名: LauncherAbilityInfo<br>类名: LauncherAbilityInfo|LauncherAbilityInfo.d.ts| +|新增|NA|模块名: LauncherAbilityInfo<br>类名: LauncherAbilityInfo<br>方法 or 属性: readonly applicationInfo: ApplicationInfo;|LauncherAbilityInfo.d.ts| +|新增|NA|模块名: LauncherAbilityInfo<br>类名: LauncherAbilityInfo<br>方法 or 属性: readonly elementName : ElementName;|LauncherAbilityInfo.d.ts| +|新增|NA|模块名: LauncherAbilityInfo<br>类名: LauncherAbilityInfo<br>方法 or 属性: readonly labelId: number;|LauncherAbilityInfo.d.ts| +|新增|NA|模块名: LauncherAbilityInfo<br>类名: LauncherAbilityInfo<br>方法 or 属性: readonly iconId: number;|LauncherAbilityInfo.d.ts| +|新增|NA|模块名: LauncherAbilityInfo<br>类名: LauncherAbilityInfo<br>方法 or 属性: readonly userId: number;|LauncherAbilityInfo.d.ts| +|新增|NA|模块名: LauncherAbilityInfo<br>类名: LauncherAbilityInfo<br>方法 or 属性: readonly installTime : number;|LauncherAbilityInfo.d.ts| +|新增|NA|模块名: Metadata<br>类名: Metadata|Metadata.d.ts| +|新增|NA|模块名: Metadata<br>类名: Metadata<br>方法 or 属性: name: string;|Metadata.d.ts| +|新增|NA|模块名: Metadata<br>类名: Metadata<br>方法 or 属性: value: string;|Metadata.d.ts| +|新增|NA|模块名: Metadata<br>类名: Metadata<br>方法 or 属性: resource: string;|Metadata.d.ts| +|新增|NA|模块名: PermissionDef<br>类名: PermissionDef<br>方法 or 属性: readonly permissionName: string;|PermissionDef.d.ts| +|新增|NA|模块名: PermissionDef<br>类名: PermissionDef<br>方法 or 属性: readonly grantMode: number;|PermissionDef.d.ts| +|新增|NA|模块名: PermissionDef<br>类名: PermissionDef<br>方法 or 属性: readonly labelId: number;|PermissionDef.d.ts| +|新增|NA|模块名: PermissionDef<br>类名: PermissionDef<br>方法 or 属性: readonly descriptionId: number;|PermissionDef.d.ts| +|新增|NA|模块名: RemoteAbilityInfo<br>类名: RemoteAbilityInfo|RemoteAbilityInfo.d.ts| +|新增|NA|模块名: RemoteAbilityInfo<br>类名: RemoteAbilityInfo<br>方法 or 属性: readonly elementName: ElementName;|RemoteAbilityInfo.d.ts| +|新增|NA|模块名: RemoteAbilityInfo<br>类名: RemoteAbilityInfo<br>方法 or 属性: readonly label: string;|RemoteAbilityInfo.d.ts| +|新增|NA|模块名: RemoteAbilityInfo<br>类名: RemoteAbilityInfo<br>方法 or 属性: readonly icon: string;|RemoteAbilityInfo.d.ts| +|新增|NA|模块名: ShortcutInfo<br>类名: ShortcutInfo|ShortcutInfo.d.ts| +|新增|NA|模块名: ShortcutInfo<br>类名: ShortcutInfo<br>方法 or 属性: readonly id: string;|ShortcutInfo.d.ts| +|新增|NA|模块名: ShortcutInfo<br>类名: ShortcutInfo<br>方法 or 属性: readonly bundleName: string;|ShortcutInfo.d.ts| +|新增|NA|模块名: ShortcutInfo<br>类名: ShortcutInfo<br>方法 or 属性: readonly moduleName: string;|ShortcutInfo.d.ts| +|新增|NA|模块名: ShortcutInfo<br>类名: ShortcutInfo<br>方法 or 属性: readonly hostAbility: string;|ShortcutInfo.d.ts| +|新增|NA|模块名: ShortcutInfo<br>类名: ShortcutInfo<br>方法 or 属性: readonly icon: string;|ShortcutInfo.d.ts| +|新增|NA|模块名: ShortcutInfo<br>类名: ShortcutInfo<br>方法 or 属性: readonly iconId: number;|ShortcutInfo.d.ts| +|新增|NA|模块名: ShortcutInfo<br>类名: ShortcutInfo<br>方法 or 属性: readonly label: string;|ShortcutInfo.d.ts| +|新增|NA|模块名: ShortcutInfo<br>类名: ShortcutInfo<br>方法 or 属性: readonly labelId: number;|ShortcutInfo.d.ts| +|新增|NA|模块名: ShortcutInfo<br>类名: ShortcutInfo<br>方法 or 属性: readonly wants: Array\<ShortcutWant>;|ShortcutInfo.d.ts| +|新增|NA|模块名: ShortcutInfo<br>类名: ShortcutWant|ShortcutInfo.d.ts| +|新增|NA|模块名: ShortcutInfo<br>类名: ShortcutWant<br>方法 or 属性: readonly targetBundle: string;|ShortcutInfo.d.ts| +|新增|NA|模块名: ShortcutInfo<br>类名: ShortcutWant<br>方法 or 属性: readonly targetModule: string;|ShortcutInfo.d.ts| +|新增|NA|模块名: ShortcutInfo<br>类名: ShortcutWant<br>方法 or 属性: readonly targetAbility: string;|ShortcutInfo.d.ts| +|model有变化|类名:AbilityInfo<br>方法 or 属性:readonly orientation: bundle.DisplayOrientation;<br>model:@FAModelOnly|类名:AbilityInfo<br>方法 or 属性:readonly orientation: bundle.DisplayOrientation;<br>model:N/A|abilityInfo.d.ts| +|访问级别有变化|类名:LauncherAbilityInfo<br>访问级别:公开API|类名:LauncherAbilityInfo<br>访问级别:系统API|launcherAbilityInfo.d.ts| +|废弃版本有变化|类名:bundle<br>废弃版本:N/A|类名:bundle<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager |@ohos.bundle.d.ts| +|废弃版本有变化|类名:BundleFlag<br>废弃版本:N/A|类名:BundleFlag<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager.BundleFlag|@ohos.bundle.d.ts| +|废弃版本有变化|类名:ColorMode<br>废弃版本:N/A|类名:ColorMode<br>废弃版本:9<br>代替接口:N/A|@ohos.bundle.d.ts| +|废弃版本有变化|类名:GrantStatus<br>废弃版本:N/A|类名:GrantStatus<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager.PermissionGrantState |@ohos.bundle.d.ts| +|废弃版本有变化|类名:AbilityType<br>废弃版本:N/A|类名:AbilityType<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager.AbilityType |@ohos.bundle.d.ts| +|废弃版本有变化|类名:AbilitySubType<br>废弃版本:N/A|类名:AbilitySubType<br>废弃版本:9<br>代替接口:N/A|@ohos.bundle.d.ts| +|废弃版本有变化|类名:DisplayOrientation<br>废弃版本:N/A|类名:DisplayOrientation<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager.DisplayOrientation |@ohos.bundle.d.ts| +|废弃版本有变化|类名:LaunchMode<br>废弃版本:N/A|类名:LaunchMode<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager.LaunchType |@ohos.bundle.d.ts| +|废弃版本有变化|类名:BundleOptions<br>废弃版本:N/A|类名:BundleOptions<br>废弃版本:9<br>代替接口:N/A|@ohos.bundle.d.ts| +|废弃版本有变化|类名:InstallErrorCode<br>废弃版本:N/A|类名:InstallErrorCode<br>废弃版本:9<br>代替接口:N/A|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function getBundleInfo(bundleName: string, bundleFlags: number, options: BundleOptions, callback: AsyncCallback\<BundleInfo>): void;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function getBundleInfo(bundleName: string, bundleFlags: number, options: BundleOptions, callback: AsyncCallback\<BundleInfo>): void;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback\<BundleInfo>): void;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback\<BundleInfo>): void;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function getBundleInfo(bundleName: string, bundleFlags: number, options?: BundleOptions): Promise\<BundleInfo>;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function getBundleInfo(bundleName: string, bundleFlags: number, options?: BundleOptions): Promise\<BundleInfo>;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function getBundleInstaller(callback: AsyncCallback\<BundleInstaller>): void;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function getBundleInstaller(callback: AsyncCallback\<BundleInstaller>): void;<br>废弃版本:9<br>代替接口:ohos.bundle.installer|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function getBundleInstaller(): Promise\<BundleInstaller>;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function getBundleInstaller(): Promise\<BundleInstaller>;<br>废弃版本:9<br>代替接口:ohos.bundle.installer|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function getAbilityInfo(bundleName: string, abilityName: string, callback: AsyncCallback\<AbilityInfo>): void;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function getAbilityInfo(bundleName: string, abilityName: string, callback: AsyncCallback\<AbilityInfo>): void;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function getAbilityInfo(bundleName: string, abilityName: string): Promise\<AbilityInfo>;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function getAbilityInfo(bundleName: string, abilityName: string): Promise\<AbilityInfo>;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function getApplicationInfo(bundleName: string, bundleFlags: number, userId: number, callback: AsyncCallback\<ApplicationInfo>) : void;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function getApplicationInfo(bundleName: string, bundleFlags: number, userId: number, callback: AsyncCallback\<ApplicationInfo>) : void;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function getApplicationInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback\<ApplicationInfo>) : void;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function getApplicationInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback\<ApplicationInfo>) : void;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function getApplicationInfo(bundleName: string, bundleFlags: number, userId?: number) : Promise\<ApplicationInfo>;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function getApplicationInfo(bundleName: string, bundleFlags: number, userId?: number) : Promise\<ApplicationInfo>;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function queryAbilityByWant(want: Want, bundleFlags: number, userId: number, callback: AsyncCallback\<Array\<AbilityInfo>>): void;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function queryAbilityByWant(want: Want, bundleFlags: number, userId: number, callback: AsyncCallback\<Array\<AbilityInfo>>): void;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback\<Array\<AbilityInfo>>): void;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function queryAbilityByWant(want: Want, bundleFlags: number, callback: AsyncCallback\<Array\<AbilityInfo>>): void;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function queryAbilityByWant(want: Want, bundleFlags: number, userId?:number): Promise\<Array\<AbilityInfo>>;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function queryAbilityByWant(want: Want, bundleFlags: number, userId?:number): Promise\<Array\<AbilityInfo>>;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback\<Array\<BundleInfo>>) : void;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback\<Array\<BundleInfo>>) : void;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback\<Array\<BundleInfo>>) : void;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback\<Array\<BundleInfo>>) : void;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function getAllBundleInfo(bundleFlag: BundleFlag, userId?: number) : Promise\<Array\<BundleInfo>>;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function getAllBundleInfo(bundleFlag: BundleFlag, userId?: number) : Promise\<Array\<BundleInfo>>;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback\<Array\<ApplicationInfo>>) : void;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallback\<Array\<ApplicationInfo>>) : void;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function getAllApplicationInfo(bundleFlags: number, callback: AsyncCallback\<Array\<ApplicationInfo>>) : void;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function getAllApplicationInfo(bundleFlags: number, callback: AsyncCallback\<Array\<ApplicationInfo>>) : void;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function getAllApplicationInfo(bundleFlags: number, userId?: number) : Promise\<Array\<ApplicationInfo>>;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function getAllApplicationInfo(bundleFlags: number, userId?: number) : Promise\<Array\<ApplicationInfo>>;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function getNameForUid(uid: number, callback: AsyncCallback\<string>) : void<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function getNameForUid(uid: number, callback: AsyncCallback\<string>) : void<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function getNameForUid(uid: number) : Promise\<string>;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function getNameForUid(uid: number) : Promise\<string>;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number, callback: AsyncCallback\<BundleInfo>) : void<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number, callback: AsyncCallback\<BundleInfo>) : void<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number) : Promise\<BundleInfo>;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function getBundleArchiveInfo(hapFilePath: string, bundleFlags: number) : Promise\<BundleInfo>;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function getLaunchWantForBundle(bundleName: string, callback: AsyncCallback\<Want>): void;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function getLaunchWantForBundle(bundleName: string, callback: AsyncCallback\<Want>): void;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function getLaunchWantForBundle(bundleName: string): Promise\<Want>;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function getLaunchWantForBundle(bundleName: string): Promise\<Want>;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function cleanBundleCacheFiles(bundleName: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function cleanBundleCacheFiles(bundleName: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function cleanBundleCacheFiles(bundleName: string): Promise\<void>;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function cleanBundleCacheFiles(bundleName: string): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function setApplicationEnabled(bundleName: string, isEnable: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function setApplicationEnabled(bundleName: string, isEnable: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function setApplicationEnabled(bundleName: string, isEnable: boolean): Promise\<void>;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function setApplicationEnabled(bundleName: string, isEnable: boolean): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function setAbilityEnabled(info: AbilityInfo, isEnable: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function setAbilityEnabled(info: AbilityInfo, isEnable: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function setAbilityEnabled(info: AbilityInfo, isEnable: boolean): Promise\<void>;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function setAbilityEnabled(info: AbilityInfo, isEnable: boolean): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function getPermissionDef(permissionName: string, callback: AsyncCallback\<PermissionDef>): void;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function getPermissionDef(permissionName: string, callback: AsyncCallback\<PermissionDef>): void;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function getPermissionDef(permissionName: string): Promise\<PermissionDef>;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function getPermissionDef(permissionName: string): Promise\<PermissionDef>;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function getAbilityLabel(bundleName: string, abilityName: string, callback: AsyncCallback\<string>): void;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function getAbilityLabel(bundleName: string, abilityName: string, callback: AsyncCallback\<string>): void;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function getAbilityLabel(bundleName: string, abilityName: string): Promise\<string>;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function getAbilityLabel(bundleName: string, abilityName: string): Promise\<string>;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function getAbilityIcon(bundleName: string, abilityName: string, callback: AsyncCallback\<image.PixelMap>): void;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function getAbilityIcon(bundleName: string, abilityName: string, callback: AsyncCallback\<image.PixelMap>): void;<br>废弃版本:9<br>代替接口:ohos.resourceManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function getAbilityIcon(bundleName: string, abilityName: string): Promise\<image.PixelMap>;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function getAbilityIcon(bundleName: string, abilityName: string): Promise\<image.PixelMap>;<br>废弃版本:9<br>代替接口:ohos.resourceManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function isAbilityEnabled(info: AbilityInfo, callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function isAbilityEnabled(info: AbilityInfo, callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function isAbilityEnabled(info: AbilityInfo): Promise\<boolean>;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function isAbilityEnabled(info: AbilityInfo): Promise\<boolean>;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function isApplicationEnabled(bundleName: string, callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function isApplicationEnabled(bundleName: string, callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:bundle<br>方法 or 属性:function isApplicationEnabled(bundleName: string): Promise\<boolean>;<br>废弃版本:N/A|类名:bundle<br>方法 or 属性:function isApplicationEnabled(bundleName: string): Promise\<boolean>;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager|@ohos.bundle.d.ts| +|废弃版本有变化|类名:innerBundleManager<br>废弃版本:N/A|类名:innerBundleManager<br>废弃版本:9<br>代替接口:ohos.bundle.launcherBundleManager |@ohos.bundle.innerBundleManager.d.ts| +|废弃版本有变化|类名:innerBundleManager<br>方法 or 属性:function getLauncherAbilityInfos(bundleName: string, userId: number, callback: AsyncCallback\<Array\<LauncherAbilityInfo>>) : void;<br>废弃版本:N/A|类名:innerBundleManager<br>方法 or 属性:function getLauncherAbilityInfos(bundleName: string, userId: number, callback: AsyncCallback\<Array\<LauncherAbilityInfo>>) : void;<br>废弃版本:9<br>代替接口:ohos.bundle.launcherBundleManager|@ohos.bundle.innerBundleManager.d.ts| +|废弃版本有变化|类名:innerBundleManager<br>方法 or 属性:function getLauncherAbilityInfos(bundleName: string, userId: number) : Promise\<Array\<LauncherAbilityInfo>>;<br>废弃版本:N/A|类名:innerBundleManager<br>方法 or 属性:function getLauncherAbilityInfos(bundleName: string, userId: number) : Promise\<Array\<LauncherAbilityInfo>>;<br>废弃版本:9<br>代替接口:ohos.bundle.launcherBundleManager|@ohos.bundle.innerBundleManager.d.ts| +|废弃版本有变化|类名:innerBundleManager<br>方法 or 属性:function on(type:"BundleStatusChange", bundleStatusCallback : BundleStatusCallback, callback: AsyncCallback\<string>) : void;<br>废弃版本:N/A|类名:innerBundleManager<br>方法 or 属性:function on(type:"BundleStatusChange", bundleStatusCallback : BundleStatusCallback, callback: AsyncCallback\<string>) : void;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleMonitor|@ohos.bundle.innerBundleManager.d.ts| +|废弃版本有变化|类名:innerBundleManager<br>方法 or 属性:function on(type:"BundleStatusChange", bundleStatusCallback : BundleStatusCallback): Promise\<string>;<br>废弃版本:N/A|类名:innerBundleManager<br>方法 or 属性:function on(type:"BundleStatusChange", bundleStatusCallback : BundleStatusCallback): Promise\<string>;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleMonitor|@ohos.bundle.innerBundleManager.d.ts| +|废弃版本有变化|类名:innerBundleManager<br>方法 or 属性:function off(type:"BundleStatusChange", callback: AsyncCallback\<string>) : void;<br>废弃版本:N/A|类名:innerBundleManager<br>方法 or 属性:function off(type:"BundleStatusChange", callback: AsyncCallback\<string>) : void;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleMonitor|@ohos.bundle.innerBundleManager.d.ts| +|废弃版本有变化|类名:innerBundleManager<br>方法 or 属性:function off(type:"BundleStatusChange"): Promise\<string>;<br>废弃版本:N/A|类名:innerBundleManager<br>方法 or 属性:function off(type:"BundleStatusChange"): Promise\<string>;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleMonitor|@ohos.bundle.innerBundleManager.d.ts| +|废弃版本有变化|类名:innerBundleManager<br>方法 or 属性:function getAllLauncherAbilityInfos(userId: number, callback: AsyncCallback\<Array\<LauncherAbilityInfo>>) : void;<br>废弃版本:N/A|类名:innerBundleManager<br>方法 or 属性:function getAllLauncherAbilityInfos(userId: number, callback: AsyncCallback\<Array\<LauncherAbilityInfo>>) : void;<br>废弃版本:9<br>代替接口:ohos.bundle.launcherBundleManager|@ohos.bundle.innerBundleManager.d.ts| +|废弃版本有变化|类名:innerBundleManager<br>方法 or 属性:function getAllLauncherAbilityInfos(userId: number) : Promise\<Array\<LauncherAbilityInfo>>;<br>废弃版本:N/A|类名:innerBundleManager<br>方法 or 属性:function getAllLauncherAbilityInfos(userId: number) : Promise\<Array\<LauncherAbilityInfo>>;<br>废弃版本:9<br>代替接口:ohos.bundle.launcherBundleManager|@ohos.bundle.innerBundleManager.d.ts| +|废弃版本有变化|类名:innerBundleManager<br>方法 or 属性:function getShortcutInfos(bundleName :string, callback: AsyncCallback\<Array\<ShortcutInfo>>) : void;<br>废弃版本:N/A|类名:innerBundleManager<br>方法 or 属性:function getShortcutInfos(bundleName :string, callback: AsyncCallback\<Array\<ShortcutInfo>>) : void;<br>废弃版本:9<br>代替接口:ohos.bundle.launcherBundleManager|@ohos.bundle.innerBundleManager.d.ts| +|废弃版本有变化|类名:innerBundleManager<br>方法 or 属性:function getShortcutInfos(bundleName : string) : Promise\<Array\<ShortcutInfo>>;<br>废弃版本:N/A|类名:innerBundleManager<br>方法 or 属性:function getShortcutInfos(bundleName : string) : Promise\<Array\<ShortcutInfo>>;<br>废弃版本:9<br>代替接口:ohos.bundle.launcherBundleManager|@ohos.bundle.innerBundleManager.d.ts| +|废弃版本有变化|类名:distributedBundle<br>废弃版本:N/A|类名:distributedBundle<br>废弃版本:9<br>代替接口:ohos.bundle.distributedBundleManager |@ohos.distributedBundle.d.ts| +|废弃版本有变化|类名:distributedBundle<br>方法 or 属性:function getRemoteAbilityInfo(elementName: ElementName, callback: AsyncCallback\<RemoteAbilityInfo>): void;<br>废弃版本:N/A|类名:distributedBundle<br>方法 or 属性:function getRemoteAbilityInfo(elementName: ElementName, callback: AsyncCallback\<RemoteAbilityInfo>): void;<br>废弃版本:9<br>代替接口:ohos.bundle.distributedBundleManager|@ohos.distributedBundle.d.ts| +|废弃版本有变化|类名:distributedBundle<br>方法 or 属性:function getRemoteAbilityInfo(elementName: ElementName): Promise\<RemoteAbilityInfo>;<br>废弃版本:N/A|类名:distributedBundle<br>方法 or 属性:function getRemoteAbilityInfo(elementName: ElementName): Promise\<RemoteAbilityInfo>;<br>废弃版本:9<br>代替接口:ohos.bundle.distributedBundleManager|@ohos.distributedBundle.d.ts| +|废弃版本有变化|类名:distributedBundle<br>方法 or 属性:function getRemoteAbilityInfos(elementNames: Array\<ElementName>, callback: AsyncCallback\<Array\<RemoteAbilityInfo>>): void;<br>废弃版本:N/A|类名:distributedBundle<br>方法 or 属性:function getRemoteAbilityInfos(elementNames: Array\<ElementName>, callback: AsyncCallback\<Array\<RemoteAbilityInfo>>): void;<br>废弃版本:9<br>代替接口:ohos.bundle.distributedBundleManager|@ohos.distributedBundle.d.ts| +|废弃版本有变化|类名:distributedBundle<br>方法 or 属性:function getRemoteAbilityInfos(elementNames: Array\<ElementName>): Promise\<Array\<RemoteAbilityInfo>>;<br>废弃版本:N/A|类名:distributedBundle<br>方法 or 属性:function getRemoteAbilityInfos(elementNames: Array\<ElementName>): Promise\<Array\<RemoteAbilityInfo>>;<br>废弃版本:9<br>代替接口:ohos.bundle.distributedBundleManager|@ohos.distributedBundle.d.ts| +|废弃版本有变化|类名:ErrorCode<br>废弃版本:N/A|类名:ErrorCode<br>废弃版本:9<br>代替接口:N/A|@ohos.zlib.d.ts| +|废弃版本有变化|类名:zlib<br>方法 or 属性:function zipFile(inFile:string, outFile:string, options: Options): Promise\<void>;<br>废弃版本:N/A|类名:zlib<br>方法 or 属性:function zipFile(inFile:string, outFile:string, options: Options): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.zlib|@ohos.zlib.d.ts| +|废弃版本有变化|类名:zlib<br>方法 or 属性:function unzipFile(inFile:string, outFile:string, options: Options): Promise\<void>;<br>废弃版本:N/A|类名:zlib<br>方法 or 属性:function unzipFile(inFile:string, outFile:string, options: Options): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.zlib|@ohos.zlib.d.ts| +|废弃版本有变化|类名:CheckPackageHasInstalledResponse<br>废弃版本:N/A|类名:CheckPackageHasInstalledResponse<br>废弃版本:9<br>代替接口:N/A|@system.package.d.ts| +|废弃版本有变化|类名:CheckPackageHasInstalledOptions<br>废弃版本:N/A|类名:CheckPackageHasInstalledOptions<br>废弃版本:9<br>代替接口:N/A|@system.package.d.ts| +|废弃版本有变化|类名:Package<br>废弃版本:N/A|类名:Package<br>废弃版本:9<br>代替接口:N/A|@system.package.d.ts| +|废弃版本有变化|类名:Package<br>方法 or 属性:static hasInstalled(options: CheckPackageHasInstalledOptions): void;<br>废弃版本:N/A|类名:Package<br>方法 or 属性:static hasInstalled(options: CheckPackageHasInstalledOptions): void;<br>废弃版本:9<br>代替接口:N/A|@system.package.d.ts| +|废弃版本有变化|类名:AbilityInfo<br>废弃版本:N/A|类名:AbilityInfo<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager.AbilityInfo |abilityInfo.d.ts| +|废弃版本有变化|类名:ApplicationInfo<br>废弃版本:N/A|类名:ApplicationInfo<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager.ApplicationInfo |applicationInfo.d.ts| +|废弃版本有变化|类名:ApplicationInfo<br>方法 or 属性:readonly labelId: string;<br>废弃版本:N/A|类名:ApplicationInfo<br>方法 or 属性:readonly labelId: string;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager.ApplicationInfo.labelIndex |applicationInfo.d.ts| +|废弃版本有变化|类名:ApplicationInfo<br>方法 or 属性:readonly iconId: string;<br>废弃版本:N/A|类名:ApplicationInfo<br>方法 or 属性:readonly iconId: string;<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager.ApplicationInfo.iconIndex |applicationInfo.d.ts| +|废弃版本有变化|类名:UsedScene<br>废弃版本:N/A|类名:UsedScene<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager.UsedScene |bundleInfo.d.ts| +|废弃版本有变化|类名:ReqPermissionDetail<br>废弃版本:N/A|类名:ReqPermissionDetail<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager.ReqPermissionDetail |bundleInfo.d.ts| +|废弃版本有变化|类名:BundleInfo<br>废弃版本:N/A|类名:BundleInfo<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager.BundleInfo |bundleInfo.d.ts| +|废弃版本有变化|类名:InstallParam<br>废弃版本:N/A|类名:InstallParam<br>废弃版本:9<br>代替接口:ohos.bundle.installer|bundleInstaller.d.ts| +|废弃版本有变化|类名:InstallParam<br>方法 or 属性:userId: number;<br>废弃版本:N/A|类名:InstallParam<br>方法 or 属性:userId: number;<br>废弃版本:9<br>代替接口:ohos.bundle.installer.InstallParam|bundleInstaller.d.ts| +|废弃版本有变化|类名:InstallParam<br>方法 or 属性:installFlag: number;<br>废弃版本:N/A|类名:InstallParam<br>方法 or 属性:installFlag: number;<br>废弃版本:9<br>代替接口:ohos.bundle.installer.InstallParam|bundleInstaller.d.ts| +|废弃版本有变化|类名:InstallParam<br>方法 or 属性:isKeepData: boolean;<br>废弃版本:N/A|类名:InstallParam<br>方法 or 属性:isKeepData: boolean;<br>废弃版本:9<br>代替接口:ohos.bundle.installer.InstallParam|bundleInstaller.d.ts| +|废弃版本有变化|类名:InstallStatus<br>废弃版本:N/A|类名:InstallStatus<br>废弃版本:9<br>代替接口:N/A|bundleInstaller.d.ts| +|废弃版本有变化|类名:InstallStatus<br>方法 or 属性:status: bundle.InstallErrorCode;<br>废弃版本:N/A|类名:InstallStatus<br>方法 or 属性:status: bundle.InstallErrorCode;<br>废弃版本:9<br>代替接口:N/A|bundleInstaller.d.ts| +|废弃版本有变化|类名:InstallStatus<br>方法 or 属性:statusMessage: string;<br>废弃版本:N/A|类名:InstallStatus<br>方法 or 属性:statusMessage: string;<br>废弃版本:9<br>代替接口:N/A|bundleInstaller.d.ts| +|废弃版本有变化|类名:BundleInstaller<br>废弃版本:N/A|类名:BundleInstaller<br>废弃版本:9<br>代替接口:ohos.bundle.installer|bundleInstaller.d.ts| +|废弃版本有变化|类名:BundleInstaller<br>方法 or 属性:install(bundleFilePaths: Array\<string>, param: InstallParam, callback: AsyncCallback\<InstallStatus>): void;<br>废弃版本:N/A|类名:BundleInstaller<br>方法 or 属性:install(bundleFilePaths: Array\<string>, param: InstallParam, callback: AsyncCallback\<InstallStatus>): void;<br>废弃版本:9<br>代替接口:ohos.bundle.installer.BundleInstaller|bundleInstaller.d.ts| +|废弃版本有变化|类名:BundleInstaller<br>方法 or 属性:uninstall(bundleName: string, param: InstallParam, callback: AsyncCallback\<InstallStatus>): void;<br>废弃版本:N/A|类名:BundleInstaller<br>方法 or 属性:uninstall(bundleName: string, param: InstallParam, callback: AsyncCallback\<InstallStatus>): void;<br>废弃版本:9<br>代替接口:ohos.bundle.installer.BundleInstaller|bundleInstaller.d.ts| +|废弃版本有变化|类名:BundleInstaller<br>方法 or 属性:recover(bundleName: string, param: InstallParam, callback: AsyncCallback\<InstallStatus>): void;<br>废弃版本:N/A|类名:BundleInstaller<br>方法 or 属性:recover(bundleName: string, param: InstallParam, callback: AsyncCallback\<InstallStatus>): void;<br>废弃版本:9<br>代替接口:ohos.bundle.installer.BundleInstaller|bundleInstaller.d.ts| +|废弃版本有变化|类名:BundleStatusCallback<br>废弃版本:N/A|类名:BundleStatusCallback<br>废弃版本:9<br>代替接口:N/A|bundleStatusCallback.d.ts| +|废弃版本有变化|类名:CustomizeData<br>废弃版本:N/A|类名:CustomizeData<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager.Metadata |customizeData.d.ts| +|废弃版本有变化|类名:ElementName<br>废弃版本:N/A|类名:ElementName<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager.ElementName |elementName.d.ts| +|废弃版本有变化|类名:HapModuleInfo<br>废弃版本:N/A|类名:HapModuleInfo<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager.HapModuleInfo |hapModuleInfo.d.ts| +|废弃版本有变化|类名:LauncherAbilityInfo<br>废弃版本:N/A|类名:LauncherAbilityInfo<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager.LauncherAbilityInfo |launcherAbilityInfo.d.ts| +|废弃版本有变化|类名:ModuleInfo<br>废弃版本:N/A|类名:ModuleInfo<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager.HapModuleInfo |moduleInfo.d.ts| +|废弃版本有变化|类名:PermissionDef<br>废弃版本:N/A|类名:PermissionDef<br>废弃版本:9<br>代替接口:ohos.bundle.bundleManager.PermissionDef |PermissionDef.d.ts| +|废弃版本有变化|类名:RemoteAbilityInfo<br>废弃版本:N/A|类名:RemoteAbilityInfo<br>废弃版本:9<br>代替接口:ohos.bundle.distributedBundleManager.RemoteAbilityInfo |remoteAbilityInfo.d.ts| +|废弃版本有变化|类名:ShortcutWant<br>废弃版本:N/A|类名:ShortcutWant<br>废弃版本:9<br>代替接口:ohos.bundle.launcherBundleManager.ShortcutWant |shortcutInfo.d.ts| +|废弃版本有变化|类名:ShortcutInfo<br>废弃版本:N/A|类名:ShortcutInfo<br>废弃版本:9<br>代替接口:ohos.bundle.launcherBundleManager.ShortcutInfo |shortcutInfo.d.ts| +|起始版本有变化|类名:LauncherAbilityInfo<br>起始版本:N/A|类名:LauncherAbilityInfo<br>起始版本:8|launcherAbilityInfo.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-communication.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-communication.md new file mode 100644 index 0000000000000000000000000000000000000000..7630596de7ce2aacbf1a34f1fb936bc1208caf19 --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-communication.md @@ -0,0 +1,1792 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function getState(): BluetoothState;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function getBtConnectionState(): ProfileConnectionState;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function pairDevice(deviceId: string): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function cancelPairedDevice(deviceId: string): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function getRemoteDeviceName(deviceId: string): string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function getRemoteDeviceClass(deviceId: string): DeviceClass;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function enableBluetooth(): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function disableBluetooth(): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function getLocalName(): string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function getPairedDevices(): Array\<string>;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function getProfileConnectionState(profileId: ProfileId): ProfileConnectionState;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function setDevicePairingConfirmation(device: string, accept: boolean): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function setLocalName(name: string): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function setBluetoothScanMode(mode: ScanMode, duration: number): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function getBluetoothScanMode(): ScanMode;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function startBluetoothDiscovery(): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function stopBluetoothDiscovery(): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function on(type: "bluetoothDeviceFind", callback: Callback\<Array\<string>>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function off(type: "bluetoothDeviceFind", callback?: Callback\<Array\<string>>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function on(type: "bondStateChange", callback: Callback\<BondStateParam>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function off(type: "bondStateChange", callback?: Callback\<BondStateParam>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function on(type: "pinRequired", callback: Callback\<PinRequiredParam>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function off(type: "pinRequired", callback?: Callback\<PinRequiredParam>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function on(type: "stateChange", callback: Callback\<BluetoothState>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function off(type: "stateChange", callback?: Callback\<BluetoothState>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function sppListen(name: string, option: SppOption, callback: AsyncCallback\<number>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function sppAccept(serverSocket: number, callback: AsyncCallback\<number>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function sppConnect(device: string, option: SppOption, callback: AsyncCallback\<number>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function sppCloseServerSocket(socket: number): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function sppCloseClientSocket(socket: number): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function sppWrite(clientSocket: number, data: ArrayBuffer): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function on(type: "sppRead", clientSocket: number, callback: Callback\<ArrayBuffer>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function off(type: "sppRead", clientSocket: number, callback?: Callback\<ArrayBuffer>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: bluetoothManager<br>方法 or 属性: function getProfileInstance(profileId: ProfileId): A2dpSourceProfile \| HandsFreeAudioGatewayProfile \| HidHostProfile \| PanProfile;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BaseProfile|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BaseProfile<br>方法 or 属性: getConnectionDevices(): Array\<string>;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BaseProfile<br>方法 or 属性: getDeviceState(device: string): ProfileConnectionState;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: A2dpSourceProfile|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: A2dpSourceProfile<br>方法 or 属性: connect(device: string): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: A2dpSourceProfile<br>方法 or 属性: disconnect(device: string): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: A2dpSourceProfile<br>方法 or 属性: on(type: "connectionStateChange", callback: Callback\<StateChangeParam>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: A2dpSourceProfile<br>方法 or 属性: off(type: "connectionStateChange", callback?: Callback\<StateChangeParam>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: A2dpSourceProfile<br>方法 or 属性: getPlayingState(device: string): PlayingState;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: HandsFreeAudioGatewayProfile|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: HandsFreeAudioGatewayProfile<br>方法 or 属性: connect(device: string): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: HandsFreeAudioGatewayProfile<br>方法 or 属性: disconnect(device: string): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: HandsFreeAudioGatewayProfile<br>方法 or 属性: on(type: "connectionStateChange", callback: Callback\<StateChangeParam>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: HandsFreeAudioGatewayProfile<br>方法 or 属性: off(type: "connectionStateChange", callback?: Callback\<StateChangeParam>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: HidHostProfile|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: HidHostProfile<br>方法 or 属性: connect(device: string): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: HidHostProfile<br>方法 or 属性: disconnect(device: string): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: HidHostProfile<br>方法 or 属性: on(type: "connectionStateChange", callback: Callback\<StateChangeParam>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: HidHostProfile<br>方法 or 属性: off(type: "connectionStateChange", callback?: Callback\<StateChangeParam>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: PanProfile|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: PanProfile<br>方法 or 属性: disconnect(device: string): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: PanProfile<br>方法 or 属性: on(type: "connectionStateChange", callback: Callback\<StateChangeParam>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: PanProfile<br>方法 or 属性: off(type: "connectionStateChange", callback?: Callback\<StateChangeParam>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: PanProfile<br>方法 or 属性: setTethering(enable: boolean): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: PanProfile<br>方法 or 属性: isTetheringOn(): boolean;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLE|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLE<br>方法 or 属性: function createGattServer(): GattServer;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLE<br>方法 or 属性: function createGattClientDevice(deviceId: string): GattClientDevice;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLE<br>方法 or 属性: function getConnectedBLEDevices(): Array\<string>;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLE<br>方法 or 属性: function startBLEScan(filters: Array\<ScanFilter>, options?: ScanOptions): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLE<br>方法 or 属性: function stopBLEScan(): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLE<br>方法 or 属性: function on(type: "BLEDeviceFind", callback: Callback\<Array\<ScanResult>>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLE<br>方法 or 属性: function off(type: "BLEDeviceFind", callback?: Callback\<Array\<ScanResult>>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: startAdvertising(setting: AdvertiseSetting, advData: AdvertiseData, advResponse?: AdvertiseData): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: stopAdvertising(): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: addService(service: GattService): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: removeService(serviceUuid: string): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: close(): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: notifyCharacteristicChanged(deviceId: string, notifyCharacteristic: NotifyCharacteristic): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: sendResponse(serverResponse: ServerResponse): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: on(type: "characteristicRead", callback: Callback\<CharacteristicReadRequest>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: off(type: "characteristicRead", callback?: Callback\<CharacteristicReadRequest>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: on(type: "characteristicWrite", callback: Callback\<CharacteristicWriteRequest>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: off(type: "characteristicWrite", callback?: Callback\<CharacteristicWriteRequest>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: on(type: "descriptorRead", callback: Callback\<DescriptorReadRequest>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: off(type: "descriptorRead", callback?: Callback\<DescriptorReadRequest>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: on(type: "descriptorWrite", callback: Callback\<DescriptorWriteRequest>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: off(type: "descriptorWrite", callback?: Callback\<DescriptorWriteRequest>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: on(type: "connectStateChange", callback: Callback\<BLEConnectChangedState>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattServer<br>方法 or 属性: off(type: "connectStateChange", callback?: Callback\<BLEConnectChangedState>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: connect(): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: disconnect(): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: close(): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: getDeviceName(callback: AsyncCallback\<string>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: getDeviceName(): Promise\<string>;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: getServices(callback: AsyncCallback\<Array\<GattService>>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: getServices(): Promise\<Array\<GattService>>;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: readCharacteristicValue(characteristic: BLECharacteristic, callback: AsyncCallback\<BLECharacteristic>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: readCharacteristicValue(characteristic: BLECharacteristic): Promise\<BLECharacteristic>;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: readDescriptorValue(descriptor: BLEDescriptor, callback: AsyncCallback\<BLEDescriptor>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: readDescriptorValue(descriptor: BLEDescriptor): Promise\<BLEDescriptor>;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: writeCharacteristicValue(characteristic: BLECharacteristic): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: writeDescriptorValue(descriptor: BLEDescriptor): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: getRssiValue(callback: AsyncCallback\<number>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: getRssiValue(): Promise\<number>;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: setBLEMtuSize(mtu: number): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: setNotifyCharacteristicChanged(characteristic: BLECharacteristic, enable: boolean): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: on(type: "BLECharacteristicChange", callback: Callback\<BLECharacteristic>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: off(type: "BLECharacteristicChange", callback?: Callback\<BLECharacteristic>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: on(type: "BLEConnectionStateChange", callback: Callback\<BLEConnectChangedState>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattClientDevice<br>方法 or 属性: off(type: "BLEConnectionStateChange", callback?: Callback\<BLEConnectChangedState>): void;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattService|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattService<br>方法 or 属性: serviceUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattService<br>方法 or 属性: isPrimary: boolean;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattService<br>方法 or 属性: characteristics: Array\<BLECharacteristic>;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: GattService<br>方法 or 属性: includeServices?: Array\<GattService>;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLECharacteristic|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLECharacteristic<br>方法 or 属性: serviceUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLECharacteristic<br>方法 or 属性: characteristicUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLECharacteristic<br>方法 or 属性: characteristicValue: ArrayBuffer;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLECharacteristic<br>方法 or 属性: descriptors: Array\<BLEDescriptor>;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLEDescriptor|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLEDescriptor<br>方法 or 属性: serviceUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLEDescriptor<br>方法 or 属性: characteristicUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLEDescriptor<br>方法 or 属性: descriptorUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLEDescriptor<br>方法 or 属性: descriptorValue: ArrayBuffer;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: NotifyCharacteristic|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: NotifyCharacteristic<br>方法 or 属性: serviceUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: NotifyCharacteristic<br>方法 or 属性: characteristicUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: NotifyCharacteristic<br>方法 or 属性: characteristicValue: ArrayBuffer;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: NotifyCharacteristic<br>方法 or 属性: confirm: boolean;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: CharacteristicReadRequest|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: CharacteristicReadRequest<br>方法 or 属性: deviceId: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: CharacteristicReadRequest<br>方法 or 属性: transId: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: CharacteristicReadRequest<br>方法 or 属性: offset: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: CharacteristicReadRequest<br>方法 or 属性: characteristicUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: CharacteristicReadRequest<br>方法 or 属性: serviceUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: CharacteristicWriteRequest|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: CharacteristicWriteRequest<br>方法 or 属性: deviceId: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: CharacteristicWriteRequest<br>方法 or 属性: transId: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: CharacteristicWriteRequest<br>方法 or 属性: offset: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: CharacteristicWriteRequest<br>方法 or 属性: isPrep: boolean;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: CharacteristicWriteRequest<br>方法 or 属性: needRsp: boolean;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: CharacteristicWriteRequest<br>方法 or 属性: value: ArrayBuffer;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: CharacteristicWriteRequest<br>方法 or 属性: characteristicUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: CharacteristicWriteRequest<br>方法 or 属性: serviceUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorReadRequest|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorReadRequest<br>方法 or 属性: deviceId: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorReadRequest<br>方法 or 属性: transId: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorReadRequest<br>方法 or 属性: offset: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorReadRequest<br>方法 or 属性: descriptorUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorReadRequest<br>方法 or 属性: characteristicUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorReadRequest<br>方法 or 属性: serviceUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorWriteRequest|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorWriteRequest<br>方法 or 属性: deviceId: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorWriteRequest<br>方法 or 属性: transId: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorWriteRequest<br>方法 or 属性: offset: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorWriteRequest<br>方法 or 属性: isPrep: boolean;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorWriteRequest<br>方法 or 属性: needRsp: boolean;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorWriteRequest<br>方法 or 属性: value: ArrayBuffer;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorWriteRequest<br>方法 or 属性: descriptorUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorWriteRequest<br>方法 or 属性: characteristicUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DescriptorWriteRequest<br>方法 or 属性: serviceUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ServerResponse|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ServerResponse<br>方法 or 属性: deviceId: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ServerResponse<br>方法 or 属性: transId: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ServerResponse<br>方法 or 属性: status: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ServerResponse<br>方法 or 属性: offset: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ServerResponse<br>方法 or 属性: value: ArrayBuffer;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLEConnectChangedState|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLEConnectChangedState<br>方法 or 属性: deviceId: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BLEConnectChangedState<br>方法 or 属性: state: ProfileConnectionState;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanResult|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanResult<br>方法 or 属性: deviceId: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanResult<br>方法 or 属性: rssi: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanResult<br>方法 or 属性: data: ArrayBuffer;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: AdvertiseSetting|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: AdvertiseSetting<br>方法 or 属性: interval?: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: AdvertiseSetting<br>方法 or 属性: txPower?: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: AdvertiseSetting<br>方法 or 属性: connectable?: boolean;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: AdvertiseData|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: AdvertiseData<br>方法 or 属性: serviceUuids: Array\<string>;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: AdvertiseData<br>方法 or 属性: manufactureData: Array\<ManufactureData>;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: AdvertiseData<br>方法 or 属性: serviceData: Array\<ServiceData>;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ManufactureData|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ManufactureData<br>方法 or 属性: manufactureId: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ManufactureData<br>方法 or 属性: manufactureValue: ArrayBuffer;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ServiceData|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ServiceData<br>方法 or 属性: serviceUuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ServiceData<br>方法 or 属性: serviceValue: ArrayBuffer;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanFilter|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanFilter<br>方法 or 属性: deviceId?: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanFilter<br>方法 or 属性: name?: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanFilter<br>方法 or 属性: serviceUuid?: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanFilter<br>方法 or 属性: serviceUuidMask?: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanFilter<br>方法 or 属性: serviceSolicitationUuid?: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanFilter<br>方法 or 属性: serviceSolicitationUuidMask?: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanFilter<br>方法 or 属性: serviceData?: ArrayBuffer;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanFilter<br>方法 or 属性: serviceDataMask?: ArrayBuffer;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanFilter<br>方法 or 属性: manufactureId?: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanFilter<br>方法 or 属性: manufactureData?: ArrayBuffer;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanFilter<br>方法 or 属性: manufactureDataMask?: ArrayBuffer;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanOptions|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanOptions<br>方法 or 属性: interval?: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanOptions<br>方法 or 属性: dutyMode?: ScanDuty;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanOptions<br>方法 or 属性: matchMode?: MatchMode;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: SppOption|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: SppOption<br>方法 or 属性: uuid: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: SppOption<br>方法 or 属性: secure: boolean;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: SppOption<br>方法 or 属性: type: SppType;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: PinRequiredParam|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: PinRequiredParam<br>方法 or 属性: deviceId: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: PinRequiredParam<br>方法 or 属性: pinCode: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DeviceClass|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DeviceClass<br>方法 or 属性: majorClass: MajorClass;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DeviceClass<br>方法 or 属性: majorMinorClass: MajorMinorClass;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: DeviceClass<br>方法 or 属性: classOfDevice: number;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BondStateParam|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BondStateParam<br>方法 or 属性: deviceId: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BondStateParam<br>方法 or 属性: state: BondState;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: StateChangeParam|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: StateChangeParam<br>方法 or 属性: deviceId: string;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: StateChangeParam<br>方法 or 属性: state: ProfileConnectionState;|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanDuty|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanDuty<br>方法 or 属性: SCAN_MODE_LOW_POWER = 0|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanDuty<br>方法 or 属性: SCAN_MODE_BALANCED = 1|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanDuty<br>方法 or 属性: SCAN_MODE_LOW_LATENCY = 2|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MatchMode|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MatchMode<br>方法 or 属性: MATCH_MODE_AGGRESSIVE = 1|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MatchMode<br>方法 or 属性: MATCH_MODE_STICKY = 2|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ProfileConnectionState|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ProfileConnectionState<br>方法 or 属性: STATE_DISCONNECTED = 0|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ProfileConnectionState<br>方法 or 属性: STATE_CONNECTING = 1|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ProfileConnectionState<br>方法 or 属性: STATE_CONNECTED = 2|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ProfileConnectionState<br>方法 or 属性: STATE_DISCONNECTING = 3|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BluetoothState|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BluetoothState<br>方法 or 属性: STATE_OFF = 0|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BluetoothState<br>方法 or 属性: STATE_TURNING_ON = 1|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BluetoothState<br>方法 or 属性: STATE_ON = 2|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BluetoothState<br>方法 or 属性: STATE_TURNING_OFF = 3|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BluetoothState<br>方法 or 属性: STATE_BLE_TURNING_ON = 4|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BluetoothState<br>方法 or 属性: STATE_BLE_ON = 5|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BluetoothState<br>方法 or 属性: STATE_BLE_TURNING_OFF = 6|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: SppType|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: SppType<br>方法 or 属性: SPP_RFCOMM|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanMode|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanMode<br>方法 or 属性: SCAN_MODE_NONE = 0|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanMode<br>方法 or 属性: SCAN_MODE_CONNECTABLE = 1|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanMode<br>方法 or 属性: SCAN_MODE_GENERAL_DISCOVERABLE = 2|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanMode<br>方法 or 属性: SCAN_MODE_LIMITED_DISCOVERABLE = 3|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanMode<br>方法 or 属性: SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE = 4|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ScanMode<br>方法 or 属性: SCAN_MODE_CONNECTABLE_LIMITED_DISCOVERABLE = 5|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BondState|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BondState<br>方法 or 属性: BOND_STATE_INVALID = 0|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BondState<br>方法 or 属性: BOND_STATE_BONDING = 1|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: BondState<br>方法 or 属性: BOND_STATE_BONDED = 2|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorClass|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorClass<br>方法 or 属性: MAJOR_MISC = 0x0000|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorClass<br>方法 or 属性: MAJOR_COMPUTER = 0x0100|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorClass<br>方法 or 属性: MAJOR_PHONE = 0x0200|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorClass<br>方法 or 属性: MAJOR_NETWORKING = 0x0300|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorClass<br>方法 or 属性: MAJOR_AUDIO_VIDEO = 0x0400|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorClass<br>方法 or 属性: MAJOR_PERIPHERAL = 0x0500|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorClass<br>方法 or 属性: MAJOR_IMAGING = 0x0600|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorClass<br>方法 or 属性: MAJOR_WEARABLE = 0x0700|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorClass<br>方法 or 属性: MAJOR_TOY = 0x0800|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorClass<br>方法 or 属性: MAJOR_HEALTH = 0x0900|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorClass<br>方法 or 属性: MAJOR_UNCATEGORIZED = 0x1F00|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: COMPUTER_UNCATEGORIZED = 0x0100|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: COMPUTER_DESKTOP = 0x0104|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: COMPUTER_SERVER = 0x0108|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: COMPUTER_LAPTOP = 0x010C|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: COMPUTER_HANDHELD_PC_PDA = 0x0110|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: COMPUTER_PALM_SIZE_PC_PDA = 0x0114|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: COMPUTER_WEARABLE = 0x0118|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: COMPUTER_TABLET = 0x011C|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PHONE_UNCATEGORIZED = 0x0200|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PHONE_CELLULAR = 0x0204|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PHONE_CORDLESS = 0x0208|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PHONE_SMART = 0x020C|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PHONE_MODEM_OR_GATEWAY = 0x0210|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PHONE_ISDN = 0x0214|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: NETWORK_FULLY_AVAILABLE = 0x0300|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: NETWORK_1_TO_17_UTILIZED = 0x0320|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: NETWORK_17_TO_33_UTILIZED = 0x0340|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: NETWORK_33_TO_50_UTILIZED = 0x0360|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: NETWORK_60_TO_67_UTILIZED = 0x0380|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: NETWORK_67_TO_83_UTILIZED = 0x03A0|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: NETWORK_83_TO_99_UTILIZED = 0x03C0|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: NETWORK_NO_SERVICE = 0x03E0|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_UNCATEGORIZED = 0x0400|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_WEARABLE_HEADSET = 0x0404|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_HANDSFREE = 0x0408|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_MICROPHONE = 0x0410|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_LOUDSPEAKER = 0x0414|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_HEADPHONES = 0x0418|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_PORTABLE_AUDIO = 0x041C|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_CAR_AUDIO = 0x0420|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_SET_TOP_BOX = 0x0424|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_HIFI_AUDIO = 0x0428|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_VCR = 0x042C|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_VIDEO_CAMERA = 0x0430|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_CAMCORDER = 0x0434|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_VIDEO_MONITOR = 0x0438|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER = 0x043C|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_VIDEO_CONFERENCING = 0x0440|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: AUDIO_VIDEO_VIDEO_GAMING_TOY = 0x0448|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PERIPHERAL_NON_KEYBOARD_NON_POINTING = 0x0500|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PERIPHERAL_KEYBOARD = 0x0540|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PERIPHERAL_POINTING_DEVICE = 0x0580|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PERIPHERAL_KEYBOARD_POINTING = 0x05C0|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PERIPHERAL_UNCATEGORIZED = 0x0500|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PERIPHERAL_JOYSTICK = 0x0504|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PERIPHERAL_GAMEPAD = 0x0508|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PERIPHERAL_REMOTE_CONTROL = 0x05C0|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PERIPHERAL_SENSING_DEVICE = 0x0510|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PERIPHERAL_DIGITIZER_TABLET = 0x0514|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PERIPHERAL_CARD_READER = 0x0518|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PERIPHERAL_DIGITAL_PEN = 0x051C|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PERIPHERAL_SCANNER_RFID = 0x0520|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: PERIPHERAL_GESTURAL_INPUT = 0x0522|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: IMAGING_UNCATEGORIZED = 0x0600|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: IMAGING_DISPLAY = 0x0610|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: IMAGING_CAMERA = 0x0620|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: IMAGING_SCANNER = 0x0640|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: IMAGING_PRINTER = 0x0680|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: WEARABLE_UNCATEGORIZED = 0x0700|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: WEARABLE_WRIST_WATCH = 0x0704|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: WEARABLE_PAGER = 0x0708|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: WEARABLE_JACKET = 0x070C|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: WEARABLE_HELMET = 0x0710|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: WEARABLE_GLASSES = 0x0714|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: TOY_UNCATEGORIZED = 0x0800|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: TOY_ROBOT = 0x0804|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: TOY_VEHICLE = 0x0808|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: TOY_DOLL_ACTION_FIGURE = 0x080C|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: TOY_CONTROLLER = 0x0810|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: TOY_GAME = 0x0814|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_UNCATEGORIZED = 0x0900|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_BLOOD_PRESSURE = 0x0904|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_THERMOMETER = 0x0908|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_WEIGHING = 0x090C|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_GLUCOSE = 0x0910|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_PULSE_OXIMETER = 0x0914|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_PULSE_RATE = 0x0918|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_DATA_DISPLAY = 0x091C|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_STEP_COUNTER = 0x0920|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_BODY_COMPOSITION_ANALYZER = 0x0924|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_PEAK_FLOW_MONITOR = 0x0928|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_MEDICATION_MONITOR = 0x092C|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_KNEE_PROSTHESIS = 0x0930|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_ANKLE_PROSTHESIS = 0x0934|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_GENERIC_HEALTH_MANAGER = 0x0938|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: MajorMinorClass<br>方法 or 属性: HEALTH_PERSONAL_MOBILITY_DEVICE = 0x093C|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: PlayingState|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: PlayingState<br>方法 or 属性: STATE_NOT_PLAYING|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: PlayingState<br>方法 or 属性: STATE_PLAYING|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ProfileId|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ProfileId<br>方法 or 属性: PROFILE_A2DP_SOURCE = 1|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ProfileId<br>方法 or 属性: PROFILE_HANDS_FREE_AUDIO_GATEWAY = 4|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ProfileId<br>方法 or 属性: PROFILE_HID_HOST = 6|@ohos.bluetoothManager.d.ts| +|新增|NA|模块名: ohos.bluetoothManager<br>类名: ProfileId<br>方法 or 属性: PROFILE_PAN_NETWORK = 7|@ohos.bluetoothManager.d.ts| +|新增|NA|类名:connectedTag<br>方法or属性:function initialize(): void;|@ohos.connectedTag.d.ts| +|新增|NA|类名:connectedTag<br>方法or属性:function uninitialize(): void;|@ohos.connectedTag.d.ts| +|新增|NA|类名:connectedTag<br>方法or属性:function read(): Promise\<number[]>;|@ohos.connectedTag.d.ts| +|新增|NA|类名:connectedTag<br>方法or属性:function read(callback: AsyncCallback\<number[]>): void;|@ohos.connectedTag.d.ts| +|新增|NA|类名:connectedTag<br>方法or属性:function write(data: number[]): Promise\<void>;|@ohos.connectedTag.d.ts| +|新增|NA|类名:connectedTag<br>方法or属性:function write(data: number[], callback: AsyncCallback\<void>): void;|@ohos.connectedTag.d.ts| +|新增|NA|类名:connection<br>方法or属性:function getDefaultNetSync(): NetHandle;|@ohos.net.connection.d.ts| +|新增|NA|类名:connection<br>方法or属性:function isDefaultNetMetered(callback: AsyncCallback\<boolean>): void;|@ohos.net.connection.d.ts| +|新增|NA|类名:connection<br>方法or属性:function isDefaultNetMetered(): Promise\<boolean>;|@ohos.net.connection.d.ts| +|新增|NA|类名:connection<br>方法or属性:function getAppNet(callback: AsyncCallback\<NetHandle>): void;|@ohos.net.connection.d.ts| +|新增|NA|类名:connection<br>方法or属性:function getAppNet(): Promise\<NetHandle>;|@ohos.net.connection.d.ts| +|新增|NA|类名:connection<br>方法or属性:function setAppNet(netHandle: NetHandle, callback: AsyncCallback\<void>): void;|@ohos.net.connection.d.ts| +|新增|NA|类名:connection<br>方法or属性:function setAppNet(netHandle: NetHandle): Promise\<void>;|@ohos.net.connection.d.ts| +|新增|NA|类名:NetHandle<br>方法or属性:bindSocket(socketParam: TCPSocket \| UDPSocket, callback: AsyncCallback\<void>): void;|@ohos.net.connection.d.ts| +|新增|NA|类名:NetHandle<br>方法or属性:bindSocket(socketParam: TCPSocket \| UDPSocket): Promise\<void>;|@ohos.net.connection.d.ts| +|新增|NA|模块名: ohos.net.ethernet<br>类名: ethernet|@ohos.net.ethernet.d.ts| +|新增|NA|模块名: ohos.net.ethernet<br>类名: ethernet<br>方法 or 属性: function getIfaceConfig(iface: string, callback: AsyncCallback\<InterfaceConfiguration>): void;|@ohos.net.ethernet.d.ts| +|新增|NA|模块名: ohos.net.ethernet<br>类名: ethernet<br>方法 or 属性: function getIfaceConfig(iface: string): Promise\<InterfaceConfiguration>;|@ohos.net.ethernet.d.ts| +|新增|NA|模块名: ohos.net.ethernet<br>类名: ethernet<br>方法 or 属性: function setIfaceConfig(iface: string, ic: InterfaceConfiguration, callback: AsyncCallback\<void>): void;|@ohos.net.ethernet.d.ts| +|新增|NA|模块名: ohos.net.ethernet<br>类名: ethernet<br>方法 or 属性: function setIfaceConfig(iface: string, ic: InterfaceConfiguration): Promise\<void>;|@ohos.net.ethernet.d.ts| +|新增|NA|模块名: ohos.net.ethernet<br>类名: ethernet<br>方法 or 属性: function isIfaceActive(iface: string, callback: AsyncCallback\<number>): void;|@ohos.net.ethernet.d.ts| +|新增|NA|模块名: ohos.net.ethernet<br>类名: ethernet<br>方法 or 属性: function isIfaceActive(iface: string): Promise\<number>;|@ohos.net.ethernet.d.ts| +|新增|NA|模块名: ohos.net.ethernet<br>类名: ethernet<br>方法 or 属性: function getAllActiveIfaces(callback: AsyncCallback\<Array\<string>>): void;|@ohos.net.ethernet.d.ts| +|新增|NA|模块名: ohos.net.ethernet<br>类名: ethernet<br>方法 or 属性: function getAllActiveIfaces(): Promise\<Array\<string>>;|@ohos.net.ethernet.d.ts| +|新增|NA|模块名: ohos.net.ethernet<br>类名: InterfaceConfiguration|@ohos.net.ethernet.d.ts| +|新增|NA|模块名: ohos.net.ethernet<br>类名: InterfaceConfiguration<br>方法 or 属性: mode: IPSetMode;|@ohos.net.ethernet.d.ts| +|新增|NA|模块名: ohos.net.ethernet<br>类名: InterfaceConfiguration<br>方法 or 属性: ipAddr: string;|@ohos.net.ethernet.d.ts| +|新增|NA|模块名: ohos.net.ethernet<br>类名: InterfaceConfiguration<br>方法 or 属性: route: string;|@ohos.net.ethernet.d.ts| +|新增|NA|模块名: ohos.net.ethernet<br>类名: InterfaceConfiguration<br>方法 or 属性: gateway: string;|@ohos.net.ethernet.d.ts| +|新增|NA|模块名: ohos.net.ethernet<br>类名: InterfaceConfiguration<br>方法 or 属性: netMask: string;|@ohos.net.ethernet.d.ts| +|新增|NA|模块名: ohos.net.ethernet<br>类名: InterfaceConfiguration<br>方法 or 属性: dnsServers: string;|@ohos.net.ethernet.d.ts| +|新增|NA|模块名: ohos.net.ethernet<br>类名: IPSetMode|@ohos.net.ethernet.d.ts| +|新增|NA|模块名: ohos.net.ethernet<br>类名: IPSetMode<br>方法 or 属性: STATIC = 0|@ohos.net.ethernet.d.ts| +|新增|NA|模块名: ohos.net.ethernet<br>类名: IPSetMode<br>方法 or 属性: DHCP = 1|@ohos.net.ethernet.d.ts| +|新增|NA|模块名: ohos.net.http<br>类名: HttpRequestOptions<br>方法 or 属性:expectDataType?: HttpDataType;|@ohos.net.http.d.ts| +|新增|NA|类名:HttpRequestOptions<br>方法or属性:expectDataType?: HttpDataType;|@ohos.net.http.d.ts| +|新增|NA|模块名: ohos.net.http<br>类名: HttpRequestOptions<br>方法 or 属性:usingCache?: boolean;|@ohos.net.http.d.ts| +|新增|NA|类名:HttpRequestOptions<br>方法or属性:usingCache?: boolean;|@ohos.net.http.d.ts| +|新增|NA|模块名: ohos.net.http<br>类名: HttpRequestOptions<br>方法 or 属性:priority?: number;|@ohos.net.http.d.ts| +|新增|NA|类名:HttpRequestOptions<br>方法or属性:priority?: number;|@ohos.net.http.d.ts| +|新增|NA|模块名: ohos.net.http<br>类名: HttpRequestOptions<br>方法 or 属性:usingProtocol?: HttpProtocol;|@ohos.net.http.d.ts| +|新增|NA|类名:HttpRequestOptions<br>方法or属性:usingProtocol?: HttpProtocol;|@ohos.net.http.d.ts| +|新增|NA|模块名: ohos.net.http<br>类名: HttpProtocol|@ohos.net.http.d.ts| +|新增|NA|类名:HttpProtocol<br>方法or属性:|@ohos.net.http.d.ts| +|新增|NA|模块名: ohos.net.http<br>类名: HttpProtocol<br>方法 or 属性:HTTP1_1|@ohos.net.http.d.ts| +|新增|NA|类名:HttpProtocol<br>方法or属性:HTTP1_1|@ohos.net.http.d.ts| +|新增|NA|模块名: ohos.net.http<br>类名: HttpProtocol<br>方法 or 属性:HTTP2|@ohos.net.http.d.ts| +|新增|NA|类名:HttpProtocol<br>方法or属性:HTTP2|@ohos.net.http.d.ts| +|新增|NA|模块名: ohos.net.http<br>类名: HttpDataType|@ohos.net.http.d.ts| +|新增|NA|类名:HttpDataType<br>方法or属性:|@ohos.net.http.d.ts| +|新增|NA|模块名: ohos.net.http<br>类名: HttpDataType<br>方法 or 属性:STRING|@ohos.net.http.d.ts| +|新增|NA|类名:HttpDataType<br>方法or属性:STRING|@ohos.net.http.d.ts| +|新增|NA|模块名: ohos.net.http<br>类名: HttpDataType<br>方法 or 属性:OBJECT = 1|@ohos.net.http.d.ts| +|新增|NA|类名:HttpDataType<br>方法or属性:OBJECT = 1|@ohos.net.http.d.ts| +|新增|NA|模块名: ohos.net.http<br>类名: HttpDataType<br>方法 or 属性:ARRAY_BUFFER = 2|@ohos.net.http.d.ts| +|新增|NA|类名:HttpDataType<br>方法or属性:ARRAY_BUFFER = 2|@ohos.net.http.d.ts| +|新增|NA|模块名: ohos.net.http<br>类名: HttpResponse<br>方法 or 属性:resultType: HttpDataType;|@ohos.net.http.d.ts| +|新增|NA|类名:HttpResponse<br>方法or属性:resultType: HttpDataType;|@ohos.net.http.d.ts| +|新增|NA|模块名: ohos.net.http<br>类名: http<br>方法 or 属性:function createHttpResponseCache(cacheSize?: number): HttpResponseCache;|@ohos.net.http.d.ts| +|新增|NA|类名:http<br>方法or属性:function createHttpResponseCache(cacheSize?: number): HttpResponseCache;|@ohos.net.http.d.ts| +|新增|NA|模块名: ohos.net.http<br>类名: HttpResponseCache|@ohos.net.http.d.ts| +|新增|NA|类名:HttpResponseCache<br>方法or属性:|@ohos.net.http.d.ts| +|新增|NA|模块名: ohos.net.http<br>类名: HttpResponseCache<br>方法 or 属性:flush(callback: AsyncCallback\<void>): void;|@ohos.net.http.d.ts| +|新增|NA|类名:HttpResponseCache<br>方法or属性:flush(callback: AsyncCallback\<void>): void;|@ohos.net.http.d.ts| +|新增|NA|模块名: ohos.net.http<br>类名: HttpResponseCache<br>方法 or 属性:flush(): Promise\<void>;|@ohos.net.http.d.ts| +|新增|NA|类名:HttpResponseCache<br>方法or属性:flush(): Promise\<void>;|@ohos.net.http.d.ts| +|新增|NA|模块名: ohos.net.http<br>类名: HttpResponseCache<br>方法 or 属性:delete(callback: AsyncCallback\<void>): void;|@ohos.net.http.d.ts| +|新增|NA|类名:HttpResponseCache<br>方法or属性:delete(callback: AsyncCallback\<void>): void;|@ohos.net.http.d.ts| +|新增|NA|模块名: ohos.net.http<br>类名: HttpResponseCache<br>方法 or 属性:delete(): Promise\<void>;|@ohos.net.http.d.ts| +|新增|NA|类名:HttpResponseCache<br>方法or属性:delete(): Promise\<void>;|@ohos.net.http.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: sharing|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: sharing<br>方法 or 属性: function isSharingSupported(callback: AsyncCallback\<boolean>): void;|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: sharing<br>方法 or 属性: function isSharingSupported(): Promise\<boolean>;|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: sharing<br>方法 or 属性: function isSharing(callback: AsyncCallback\<boolean>): void;|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: sharing<br>方法 or 属性: function isSharing(): Promise\<boolean>;|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: sharing<br>方法 or 属性: function startSharing(type: SharingIfaceType, callback: AsyncCallback\<void>): void;|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: sharing<br>方法 or 属性: function startSharing(type: SharingIfaceType): Promise\<void>;|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: sharing<br>方法 or 属性: function stopSharing(type: SharingIfaceType, callback: AsyncCallback\<void>): void;|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: sharing<br>方法 or 属性: function stopSharing(type: SharingIfaceType): Promise\<void>;|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: sharing<br>方法 or 属性: function getStatsRxBytes(callback: AsyncCallback\<number>): void;|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: sharing<br>方法 or 属性: function getStatsRxBytes(): Promise\<number>;|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: sharing<br>方法 or 属性: function getStatsTxBytes(callback: AsyncCallback\<number>): void;|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: sharing<br>方法 or 属性: function getStatsTxBytes(): Promise\<number>;|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: sharing<br>方法 or 属性: function getStatsTotalBytes(callback: AsyncCallback\<number>): void;|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: sharing<br>方法 or 属性: function getStatsTotalBytes(): Promise\<number>;|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: sharing<br>方法 or 属性: function getSharingIfaces(state: SharingIfaceState, callback: AsyncCallback\<Array\<string>>): void;|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: sharing<br>方法 or 属性: function getSharingIfaces(state: SharingIfaceState): Promise\<Array\<string>>;|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: sharing<br>方法 or 属性: function getSharingState(type: SharingIfaceType, callback: AsyncCallback\<SharingIfaceState>): void;|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: sharing<br>方法 or 属性: function getSharingState(type: SharingIfaceType): Promise\<SharingIfaceState>;|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: sharing<br>方法 or 属性: function getSharableRegexes(type: SharingIfaceType, callback: AsyncCallback\<Array\<string>>): void;|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: sharing<br>方法 or 属性: function getSharableRegexes(type: SharingIfaceType): Promise\<Array\<string>>;|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: sharing<br>方法 or 属性: function on(type: 'sharingStateChange', callback: Callback\<boolean>): void;|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: sharing<br>方法 or 属性: function off(type: 'sharingStateChange', callback?: Callback\<boolean>): void;|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: sharing<br>方法 or 属性: function on(type: 'interfaceSharingStateChange', callback: Callback\<{ type: SharingIfaceType, iface: string, state: SharingIfaceState }>): void;|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: sharing<br>方法 or 属性: function off(type: 'interfaceSharingStateChange', callback?: Callback\<{ type: SharingIfaceType, iface: string, state: SharingIfaceState }>): void;|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: sharing<br>方法 or 属性: function on(type: 'sharingUpstreamChange', callback: Callback\<NetHandle>): void;|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: sharing<br>方法 or 属性: function off(type: 'sharingUpstreamChange', callback?: Callback\<NetHandle>): void;|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: SharingIfaceState|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: SharingIfaceState<br>方法 or 属性: SHARING_NIC_SERVING = 1|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: SharingIfaceState<br>方法 or 属性: SHARING_NIC_CAN_SERVER = 2|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: SharingIfaceState<br>方法 or 属性: SHARING_NIC_ERROR = 3|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: SharingIfaceType|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: SharingIfaceType<br>方法 or 属性: SHARING_WIFI = 0|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: SharingIfaceType<br>方法 or 属性: SHARING_USB = 1|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.sharing<br>类名: SharingIfaceType<br>方法 or 属性: SHARING_BLUETOOTH = 2|@ohos.net.sharing.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: socket<br>方法 or 属性:function constructTLSSocketInstance(): TLSSocket;|@ohos.net.socket.d.ts| +|新增|NA|类名:socket<br>方法or属性:function constructTLSSocketInstance(): TLSSocket;|@ohos.net.socket.d.ts| +|新增|NA|类名:TCPExtraOptions<br>方法or属性:socketLinger?: {on: boolean, linger: number};|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:bind(address: NetAddress, callback: AsyncCallback\<void>): void;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:bind(address: NetAddress, callback: AsyncCallback\<void>): void;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:bind(address: NetAddress): Promise\<void>;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:bind(address: NetAddress): Promise\<void>;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:getRemoteAddress(callback: AsyncCallback\<NetAddress>): void;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:getRemoteAddress(callback: AsyncCallback\<NetAddress>): void;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:getRemoteAddress(): Promise\<NetAddress>;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:getRemoteAddress(): Promise\<NetAddress>;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:getState(callback: AsyncCallback\<SocketStateBase>): void;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:getState(callback: AsyncCallback\<SocketStateBase>): void;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:getState(): Promise\<SocketStateBase>;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:getState(): Promise\<SocketStateBase>;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:setExtraOptions(options: TCPExtraOptions, callback: AsyncCallback\<void>): void;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:setExtraOptions(options: TCPExtraOptions, callback: AsyncCallback\<void>): void;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:setExtraOptions(options: TCPExtraOptions): Promise\<void>;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:setExtraOptions(options: TCPExtraOptions): Promise\<void>;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:on(type: 'message', callback: Callback\<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}>): void;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:on(type: 'message', callback: Callback\<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}>): void;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:off(type: 'message', callback?: Callback\<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}>): void;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:off(type: 'message', callback?: Callback\<{message: ArrayBuffer, remoteInfo: SocketRemoteInfo}>): void;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:on(type: 'connect' \| 'close', callback: Callback\<void>): void;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:on(type: 'connect' \| 'close', callback: Callback\<void>): void;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:on(type: 'connect' \| 'close', callback: Callback\<void>): void;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:on(type: 'connect' \| 'close', callback: Callback\<void>): void;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:off(type: 'connect' \| 'close', callback?: Callback\<void>): void;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:off(type: 'connect' \| 'close', callback?: Callback\<void>): void;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:off(type: 'connect' \| 'close', callback?: Callback\<void>): void;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:off(type: 'connect' \| 'close', callback?: Callback\<void>): void;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:on(type: 'error', callback: ErrorCallback): void;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:on(type: 'error', callback: ErrorCallback): void;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:off(type: 'error', callback?: ErrorCallback): void;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:off(type: 'error', callback?: ErrorCallback): void;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:getCertificate(callback: AsyncCallback\<X509CertRawData>): void;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:getCertificate(callback: AsyncCallback\<X509CertRawData>): void;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:getCertificate(): Promise\<X509CertRawData>;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:getCertificate(): Promise\<X509CertRawData>;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:getRemoteCertificate(callback: AsyncCallback\<X509CertRawData>): void;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:getRemoteCertificate(callback: AsyncCallback\<X509CertRawData>): void;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:getRemoteCertificate(): Promise\<X509CertRawData>;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:getRemoteCertificate(): Promise\<X509CertRawData>;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:getProtocol(callback: AsyncCallback\<string>): void;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:getProtocol(callback: AsyncCallback\<string>): void;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:getProtocol(): Promise\<string>;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:getProtocol(): Promise\<string>;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:getCipherSuite(callback: AsyncCallback\<Array\<string>>): void;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:getCipherSuite(callback: AsyncCallback\<Array\<string>>): void;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:getCipherSuite(): Promise\<Array\<string>>;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:getCipherSuite(): Promise\<Array\<string>>;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:getSignatureAlgorithms(callback: AsyncCallback\<Array\<string>>): void;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:getSignatureAlgorithms(callback: AsyncCallback\<Array\<string>>): void;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:getSignatureAlgorithms(): Promise\<Array\<string>>;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:getSignatureAlgorithms(): Promise\<Array\<string>>;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:connect(options: TLSConnectOptions, callback: AsyncCallback\<void>): void;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:connect(options: TLSConnectOptions, callback: AsyncCallback\<void>): void;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:connect(options: TLSConnectOptions): Promise\<void>;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:connect(options: TLSConnectOptions): Promise\<void>;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:send(data: string, callback: AsyncCallback\<void>): void;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:send(data: string, callback: AsyncCallback\<void>): void;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:send(data: string): Promise\<void>;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:send(data: string): Promise\<void>;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:close(callback: AsyncCallback\<void>): void;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:close(callback: AsyncCallback\<void>): void;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSocket<br>方法 or 属性:close(): Promise\<void>;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSocket<br>方法or属性:close(): Promise\<void>;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSecureOptions|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSecureOptions<br>方法or属性:|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSecureOptions<br>方法 or 属性:ca: string \| Array\<string>;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSecureOptions<br>方法or属性:ca: string \| Array\<string>;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSecureOptions<br>方法 or 属性:cert?: string;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSecureOptions<br>方法or属性:cert?: string;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSecureOptions<br>方法 or 属性:key?: string;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSecureOptions<br>方法or属性:key?: string;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSecureOptions<br>方法 or 属性:password?: string;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSecureOptions<br>方法or属性:password?: string;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSecureOptions<br>方法 or 属性:protocols?: Protocol \| Array\<Protocol>;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSecureOptions<br>方法or属性:protocols?: Protocol \| Array\<Protocol>;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSecureOptions<br>方法 or 属性:useRemoteCipherPrefer?: boolean;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSecureOptions<br>方法or属性:useRemoteCipherPrefer?: boolean;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSecureOptions<br>方法 or 属性:signatureAlgorithms?: string;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSecureOptions<br>方法or属性:signatureAlgorithms?: string;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSSecureOptions<br>方法 or 属性:cipherSuite?: string;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSSecureOptions<br>方法or属性:cipherSuite?: string;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSConnectOptions|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSConnectOptions<br>方法or属性:|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSConnectOptions<br>方法 or 属性:address: NetAddress;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSConnectOptions<br>方法or属性:address: NetAddress;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSConnectOptions<br>方法 or 属性:secureOptions: TLSSecureOptions;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSConnectOptions<br>方法or属性:secureOptions: TLSSecureOptions;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: TLSConnectOptions<br>方法 or 属性:ALPNProtocols?: Array\<string>;|@ohos.net.socket.d.ts| +|新增|NA|类名:TLSConnectOptions<br>方法or属性:ALPNProtocols?: Array\<string>;|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: Protocol|@ohos.net.socket.d.ts| +|新增|NA|类名:Protocol<br>方法or属性:|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: Protocol<br>方法 or 属性:TLSv12 = "TLSv1.2"|@ohos.net.socket.d.ts| +|新增|NA|类名:Protocol<br>方法or属性:TLSv12 = "TLSv1.2"|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.net.socket<br>类名: Protocol<br>方法 or 属性:TLSv13 = "TLSv1.3"|@ohos.net.socket.d.ts| +|新增|NA|类名:Protocol<br>方法or属性:TLSv13 = "TLSv1.3"|@ohos.net.socket.d.ts| +|新增|NA|模块名: ohos.nfc.cardEmulation<br>类名: CardType|@ohos.nfc.cardEmulation.d.ts| +|新增|NA|类名:CardType<br>方法or属性:|@ohos.nfc.cardEmulation.d.ts| +|新增|NA|模块名: ohos.nfc.cardEmulation<br>类名: CardType<br>方法 or 属性:PAYMENT = "payment"|@ohos.nfc.cardEmulation.d.ts| +|新增|NA|类名:CardType<br>方法or属性:PAYMENT = "payment"|@ohos.nfc.cardEmulation.d.ts| +|新增|NA|模块名: ohos.nfc.cardEmulation<br>类名: CardType<br>方法 or 属性:OTHER = "other"|@ohos.nfc.cardEmulation.d.ts| +|新增|NA|类名:CardType<br>方法or属性:OTHER = "other"|@ohos.nfc.cardEmulation.d.ts| +|新增|NA|类名:cardEmulation<br>方法or属性:function hasHceCapability(): boolean;|@ohos.nfc.cardEmulation.d.ts| +|新增|NA|类名:cardEmulation<br>方法or属性:function isDefaultService(elementName: ElementName, type: CardType): boolean;|@ohos.nfc.cardEmulation.d.ts| +|新增|NA|类名:HceService<br>方法or属性:start(elementName: ElementName, aidList: string[]): void|@ohos.nfc.cardEmulation.d.ts| +|新增|NA|类名:HceService<br>方法or属性:stop(elementName: ElementName): void|@ohos.nfc.cardEmulation.d.ts| +|新增|NA|类名:HceService<br>方法or属性:transmit(response: number[]): Promise\<void>;|@ohos.nfc.cardEmulation.d.ts| +|新增|NA|类名:HceService<br>方法or属性:transmit(response: number[], callback: AsyncCallback\<void>): void;|@ohos.nfc.cardEmulation.d.ts| +|新增|NA|类名:nfcController<br>方法or属性:function enableNfc(): void|@ohos.nfc.controller.d.ts| +|新增|NA|类名:nfcController<br>方法or属性:function disableNfc(): void|@ohos.nfc.controller.d.ts| +|新增|NA|类名:tag<br>方法or属性:const NDEF_FORMATABLE = 7;|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: TnfType|@ohos.nfc.tag.d.ts| +|新增|NA|类名:TnfType<br>方法or属性:|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: TnfType<br>方法 or 属性:TNF_EMPTY = 0x0|@ohos.nfc.tag.d.ts| +|新增|NA|类名:TnfType<br>方法or属性:TNF_EMPTY = 0x0|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: TnfType<br>方法 or 属性:TNF_WELL_KNOWN = 0x1|@ohos.nfc.tag.d.ts| +|新增|NA|类名:TnfType<br>方法or属性:TNF_WELL_KNOWN = 0x1|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: TnfType<br>方法 or 属性:TNF_MEDIA = 0x2|@ohos.nfc.tag.d.ts| +|新增|NA|类名:TnfType<br>方法or属性:TNF_MEDIA = 0x2|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: TnfType<br>方法 or 属性:TNF_ABSOLUTE_URI = 0x3|@ohos.nfc.tag.d.ts| +|新增|NA|类名:TnfType<br>方法or属性:TNF_ABSOLUTE_URI = 0x3|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: TnfType<br>方法 or 属性:TNF_EXT_APP = 0x4|@ohos.nfc.tag.d.ts| +|新增|NA|类名:TnfType<br>方法or属性:TNF_EXT_APP = 0x4|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: TnfType<br>方法 or 属性:TNF_UNKNOWN = 0x5|@ohos.nfc.tag.d.ts| +|新增|NA|类名:TnfType<br>方法or属性:TNF_UNKNOWN = 0x5|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: TnfType<br>方法 or 属性:TNF_UNCHANGED = 0x6|@ohos.nfc.tag.d.ts| +|新增|NA|类名:TnfType<br>方法or属性:TNF_UNCHANGED = 0x6|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: NfcForumType|@ohos.nfc.tag.d.ts| +|新增|NA|类名:NfcForumType<br>方法or属性:|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: NfcForumType<br>方法 or 属性:NFC_FORUM_TYPE_1 = 1|@ohos.nfc.tag.d.ts| +|新增|NA|类名:NfcForumType<br>方法or属性:NFC_FORUM_TYPE_1 = 1|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: NfcForumType<br>方法 or 属性:NFC_FORUM_TYPE_2 = 2|@ohos.nfc.tag.d.ts| +|新增|NA|类名:NfcForumType<br>方法or属性:NFC_FORUM_TYPE_2 = 2|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: NfcForumType<br>方法 or 属性:NFC_FORUM_TYPE_3 = 3|@ohos.nfc.tag.d.ts| +|新增|NA|类名:NfcForumType<br>方法or属性:NFC_FORUM_TYPE_3 = 3|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: NfcForumType<br>方法 or 属性:NFC_FORUM_TYPE_4 = 4|@ohos.nfc.tag.d.ts| +|新增|NA|类名:NfcForumType<br>方法or属性:NFC_FORUM_TYPE_4 = 4|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: NfcForumType<br>方法 or 属性:MIFARE_CLASSIC = 101|@ohos.nfc.tag.d.ts| +|新增|NA|类名:NfcForumType<br>方法or属性:MIFARE_CLASSIC = 101|@ohos.nfc.tag.d.ts| +|新增|NA|类名:tag<br>方法or属性:const RTD_TEXT: number[];|@ohos.nfc.tag.d.ts| +|新增|NA|类名:tag<br>方法or属性:const RTD_URI: number[];|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: MifareClassicType|@ohos.nfc.tag.d.ts| +|新增|NA|类名:MifareClassicType<br>方法or属性:|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: MifareClassicType<br>方法 or 属性:TYPE_UNKNOWN = 0|@ohos.nfc.tag.d.ts| +|新增|NA|类名:MifareClassicType<br>方法or属性:TYPE_UNKNOWN = 0|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: MifareClassicType<br>方法 or 属性:TYPE_CLASSIC = 1|@ohos.nfc.tag.d.ts| +|新增|NA|类名:MifareClassicType<br>方法or属性:TYPE_CLASSIC = 1|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: MifareClassicType<br>方法 or 属性:TYPE_PLUS = 2|@ohos.nfc.tag.d.ts| +|新增|NA|类名:MifareClassicType<br>方法or属性:TYPE_PLUS = 2|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: MifareClassicType<br>方法 or 属性:TYPE_PRO = 3|@ohos.nfc.tag.d.ts| +|新增|NA|类名:MifareClassicType<br>方法or属性:TYPE_PRO = 3|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: MifareClassicSize|@ohos.nfc.tag.d.ts| +|新增|NA|类名:MifareClassicSize<br>方法or属性:|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: MifareClassicSize<br>方法 or 属性:MC_SIZE_MINI = 320|@ohos.nfc.tag.d.ts| +|新增|NA|类名:MifareClassicSize<br>方法or属性:MC_SIZE_MINI = 320|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: MifareClassicSize<br>方法 or 属性:MC_SIZE_1K = 1024|@ohos.nfc.tag.d.ts| +|新增|NA|类名:MifareClassicSize<br>方法or属性:MC_SIZE_1K = 1024|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: MifareClassicSize<br>方法 or 属性:MC_SIZE_2K = 2048|@ohos.nfc.tag.d.ts| +|新增|NA|类名:MifareClassicSize<br>方法or属性:MC_SIZE_2K = 2048|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: MifareClassicSize<br>方法 or 属性:MC_SIZE_4K = 4096|@ohos.nfc.tag.d.ts| +|新增|NA|类名:MifareClassicSize<br>方法or属性:MC_SIZE_4K = 4096|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: MifareUltralightType|@ohos.nfc.tag.d.ts| +|新增|NA|类名:MifareUltralightType<br>方法or属性:|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: MifareUltralightType<br>方法 or 属性:TYPE_UNKNOWN = 0|@ohos.nfc.tag.d.ts| +|新增|NA|类名:MifareUltralightType<br>方法or属性:TYPE_UNKNOWN = 0|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: MifareUltralightType<br>方法 or 属性:TYPE_ULTRALIGHT = 1|@ohos.nfc.tag.d.ts| +|新增|NA|类名:MifareUltralightType<br>方法or属性:TYPE_ULTRALIGHT = 1|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: MifareUltralightType<br>方法 or 属性:TYPE_ULTRALIGHT_C = 2|@ohos.nfc.tag.d.ts| +|新增|NA|类名:MifareUltralightType<br>方法or属性:TYPE_ULTRALIGHT_C = 2|@ohos.nfc.tag.d.ts| +|新增|NA|类名:tag<br>方法or属性:function getNfcA(tagInfo: TagInfo): NfcATag|@ohos.nfc.tag.d.ts| +|新增|NA|类名:tag<br>方法or属性:function getNfcB(tagInfo: TagInfo): NfcBTag|@ohos.nfc.tag.d.ts| +|新增|NA|类名:tag<br>方法or属性:function getNfcF(tagInfo: TagInfo): NfcFTag|@ohos.nfc.tag.d.ts| +|新增|NA|类名:tag<br>方法or属性:function getNfcV(tagInfo: TagInfo): NfcVTag|@ohos.nfc.tag.d.ts| +|新增|NA|类名:tag<br>方法or属性:function getIsoDep(tagInfo: TagInfo): IsoDepTag|@ohos.nfc.tag.d.ts| +|新增|NA|类名:tag<br>方法or属性:function getNdef(tagInfo: TagInfo): NdefTag|@ohos.nfc.tag.d.ts| +|新增|NA|类名:tag<br>方法or属性:function getMifareClassic(tagInfo: TagInfo): MifareClassicTag|@ohos.nfc.tag.d.ts| +|新增|NA|类名:tag<br>方法or属性:function getMifareUltralight(tagInfo: TagInfo): MifareUltralightTag|@ohos.nfc.tag.d.ts| +|新增|NA|类名:tag<br>方法or属性:function getNdefFormatable(tagInfo: TagInfo): NdefFormatableTag|@ohos.nfc.tag.d.ts| +|新增|NA|类名:tag<br>方法or属性:function getTagInfo(want: Want): TagInfo|@ohos.nfc.tag.d.ts| +|新增|NA|类名:TagInfo<br>方法or属性:uid: number[];|@ohos.nfc.tag.d.ts| +|新增|NA|类名:TagInfo<br>方法or属性:technology: number[];|@ohos.nfc.tag.d.ts| +|新增|NA|类名:TagInfo<br>方法or属性:extrasData: PacMap[];|@ohos.nfc.tag.d.ts| +|新增|NA|类名:TagInfo<br>方法or属性:tagRfDiscId: number;|@ohos.nfc.tag.d.ts| +|新增|NA|类名:TagInfo<br>方法or属性:remoteTagService: rpc.RemoteObject;|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: NdefRecord|@ohos.nfc.tag.d.ts| +|新增|NA|类名:NdefRecord<br>方法or属性:|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: NdefRecord<br>方法 or 属性:tnf: number;|@ohos.nfc.tag.d.ts| +|新增|NA|类名:NdefRecord<br>方法or属性:tnf: number;|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: NdefRecord<br>方法 or 属性:rtdType: number[];|@ohos.nfc.tag.d.ts| +|新增|NA|类名:NdefRecord<br>方法or属性:rtdType: number[];|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: NdefRecord<br>方法 or 属性:id: number[];|@ohos.nfc.tag.d.ts| +|新增|NA|类名:NdefRecord<br>方法or属性:id: number[];|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: NdefRecord<br>方法 or 属性:payload: number[];|@ohos.nfc.tag.d.ts| +|新增|NA|类名:NdefRecord<br>方法or属性:payload: number[];|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: ndef|@ohos.nfc.tag.d.ts| +|新增|NA|类名:ndef<br>方法or属性:|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: ndef<br>方法 or 属性:function makeUriRecord(uri: string): NdefRecord;|@ohos.nfc.tag.d.ts| +|新增|NA|类名:ndef<br>方法or属性:function makeUriRecord(uri: string): NdefRecord;|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: ndef<br>方法 or 属性:function makeTextRecord(text: string, locale: string): NdefRecord;|@ohos.nfc.tag.d.ts| +|新增|NA|类名:ndef<br>方法or属性:function makeTextRecord(text: string, locale: string): NdefRecord;|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: ndef<br>方法 or 属性:function makeMimeRecord(mimeType: string, mimeData: number[]): NdefRecord;|@ohos.nfc.tag.d.ts| +|新增|NA|类名:ndef<br>方法or属性:function makeMimeRecord(mimeType: string, mimeData: number[]): NdefRecord;|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: ndef<br>方法 or 属性:function makeExternalRecord(domainName: string, type: string, externalData: number[]): NdefRecord;|@ohos.nfc.tag.d.ts| +|新增|NA|类名:ndef<br>方法or属性:function makeExternalRecord(domainName: string, type: string, externalData: number[]): NdefRecord;|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: ndef<br>方法 or 属性:function createNdefMessage(data: number[]): NdefMessage;|@ohos.nfc.tag.d.ts| +|新增|NA|类名:ndef<br>方法or属性:function createNdefMessage(data: number[]): NdefMessage;|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: ndef<br>方法 or 属性:function createNdefMessage(ndefRecords: NdefRecord[]): NdefMessage;|@ohos.nfc.tag.d.ts| +|新增|NA|类名:ndef<br>方法or属性:function createNdefMessage(ndefRecords: NdefRecord[]): NdefMessage;|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.nfc.tag<br>类名: ndef<br>方法 or 属性:function messageToBytes(ndefMessage: NdefMessage): number[];|@ohos.nfc.tag.d.ts| +|新增|NA|类名:ndef<br>方法or属性:function messageToBytes(ndefMessage: NdefMessage): number[];|@ohos.nfc.tag.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: ErrorCode|@ohos.rpc.d.ts| +|新增|NA|类名:ErrorCode<br>方法or属性:|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: ErrorCode<br>方法 or 属性:CHECK_PARAM_ERROR = 401|@ohos.rpc.d.ts| +|新增|NA|类名:ErrorCode<br>方法or属性:CHECK_PARAM_ERROR = 401|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: ErrorCode<br>方法 or 属性:OS_MMAP_ERROR = 1900001|@ohos.rpc.d.ts| +|新增|NA|类名:ErrorCode<br>方法or属性:OS_MMAP_ERROR = 1900001|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: ErrorCode<br>方法 or 属性:OS_IOCTL_ERROR = 1900002|@ohos.rpc.d.ts| +|新增|NA|类名:ErrorCode<br>方法or属性:OS_IOCTL_ERROR = 1900002|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: ErrorCode<br>方法 or 属性:WRITE_TO_ASHMEM_ERROR = 1900003|@ohos.rpc.d.ts| +|新增|NA|类名:ErrorCode<br>方法or属性:WRITE_TO_ASHMEM_ERROR = 1900003|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: ErrorCode<br>方法 or 属性:READ_FROM_ASHMEM_ERROR = 1900004|@ohos.rpc.d.ts| +|新增|NA|类名:ErrorCode<br>方法or属性:READ_FROM_ASHMEM_ERROR = 1900004|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: ErrorCode<br>方法 or 属性:ONLY_PROXY_OBJECT_PERMITTED_ERROR = 1900005|@ohos.rpc.d.ts| +|新增|NA|类名:ErrorCode<br>方法or属性:ONLY_PROXY_OBJECT_PERMITTED_ERROR = 1900005|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: ErrorCode<br>方法 or 属性:ONLY_REMOTE_OBJECT_PERMITTED_ERROR = 1900006|@ohos.rpc.d.ts| +|新增|NA|类名:ErrorCode<br>方法or属性:ONLY_REMOTE_OBJECT_PERMITTED_ERROR = 1900006|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: ErrorCode<br>方法 or 属性:COMMUNICATION_ERROR = 1900007|@ohos.rpc.d.ts| +|新增|NA|类名:ErrorCode<br>方法or属性:COMMUNICATION_ERROR = 1900007|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: ErrorCode<br>方法 or 属性:PROXY_OR_REMOTE_OBJECT_INVALID_ERROR = 1900008|@ohos.rpc.d.ts| +|新增|NA|类名:ErrorCode<br>方法or属性:PROXY_OR_REMOTE_OBJECT_INVALID_ERROR = 1900008|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: ErrorCode<br>方法 or 属性:WRITE_DATA_TO_MESSAGE_SEQUENCE_ERROR = 1900009|@ohos.rpc.d.ts| +|新增|NA|类名:ErrorCode<br>方法or属性:WRITE_DATA_TO_MESSAGE_SEQUENCE_ERROR = 1900009|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: ErrorCode<br>方法 or 属性:READ_DATA_FROM_MESSAGE_SEQUENCE_ERROR = 1900010|@ohos.rpc.d.ts| +|新增|NA|类名:ErrorCode<br>方法or属性:READ_DATA_FROM_MESSAGE_SEQUENCE_ERROR = 1900010|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: ErrorCode<br>方法 or 属性:PARCEL_MEMORY_ALLOC_ERROR = 1900011|@ohos.rpc.d.ts| +|新增|NA|类名:ErrorCode<br>方法or属性:PARCEL_MEMORY_ALLOC_ERROR = 1900011|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: ErrorCode<br>方法 or 属性:CALL_JS_METHOD_ERROR = 1900012|@ohos.rpc.d.ts| +|新增|NA|类名:ErrorCode<br>方法or属性:CALL_JS_METHOD_ERROR = 1900012|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: ErrorCode<br>方法 or 属性:OS_DUP_ERROR = 1900013|@ohos.rpc.d.ts| +|新增|NA|类名:ErrorCode<br>方法or属性:OS_DUP_ERROR = 1900013|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:static create(): MessageSequence;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:static create(): MessageSequence;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:reclaim(): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:reclaim(): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:writeRemoteObject(object: IRemoteObject): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:writeRemoteObject(object: IRemoteObject): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readRemoteObject(): IRemoteObject;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readRemoteObject(): IRemoteObject;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:writeInterfaceToken(token: string): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:writeInterfaceToken(token: string): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readInterfaceToken(): string;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readInterfaceToken(): string;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:getSize(): number;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:getSize(): number;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:getCapacity(): number;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:getCapacity(): number;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:setSize(size: number): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:setSize(size: number): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:setCapacity(size: number): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:setCapacity(size: number): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:getWritableBytes(): number;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:getWritableBytes(): number;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:getReadableBytes(): number;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:getReadableBytes(): number;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:getReadPosition(): number;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:getReadPosition(): number;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:getWritePosition(): number;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:getWritePosition(): number;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:rewindRead(pos: number): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:rewindRead(pos: number): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:rewindWrite(pos: number): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:rewindWrite(pos: number): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:writeNoException(): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:writeNoException(): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readException(): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readException(): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:writeByte(val: number): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:writeByte(val: number): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:writeShort(val: number): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:writeShort(val: number): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:writeInt(val: number): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:writeInt(val: number): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:writeLong(val: number): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:writeLong(val: number): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:writeFloat(val: number): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:writeFloat(val: number): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:writeDouble(val: number): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:writeDouble(val: number): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:writeBoolean(val: boolean): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:writeBoolean(val: boolean): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:writeChar(val: number): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:writeChar(val: number): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:writeString(val: string): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:writeString(val: string): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:writeParcelable(val: Parcelable): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:writeParcelable(val: Parcelable): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:writeByteArray(byteArray: number[]): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:writeByteArray(byteArray: number[]): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:writeShortArray(shortArray: number[]): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:writeShortArray(shortArray: number[]): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:writeIntArray(intArray: number[]): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:writeIntArray(intArray: number[]): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:writeLongArray(longArray: number[]): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:writeLongArray(longArray: number[]): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:writeFloatArray(floatArray: number[]): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:writeFloatArray(floatArray: number[]): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:writeDoubleArray(doubleArray: number[]): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:writeDoubleArray(doubleArray: number[]): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:writeBooleanArray(booleanArray: boolean[]): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:writeBooleanArray(booleanArray: boolean[]): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:writeCharArray(charArray: number[]): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:writeCharArray(charArray: number[]): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:writeStringArray(stringArray: string[]): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:writeStringArray(stringArray: string[]): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:writeParcelableArray(parcelableArray: Parcelable[]): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:writeParcelableArray(parcelableArray: Parcelable[]): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:writeRemoteObjectArray(objectArray: IRemoteObject[]): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:writeRemoteObjectArray(objectArray: IRemoteObject[]): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readByte(): number;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readByte(): number;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readShort(): number;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readShort(): number;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readInt(): number;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readInt(): number;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readLong(): number;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readLong(): number;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readFloat(): number;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readFloat(): number;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readDouble(): number;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readDouble(): number;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readBoolean(): boolean;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readBoolean(): boolean;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readChar(): number;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readChar(): number;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readString(): string;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readString(): string;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readParcelable(dataIn: Parcelable) : void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readParcelable(dataIn: Parcelable) : void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readByteArray(dataIn: number[]) : void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readByteArray(dataIn: number[]) : void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readByteArray(): number[];|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readByteArray(): number[];|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readShortArray(dataIn: number[]) : void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readShortArray(dataIn: number[]) : void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readShortArray(): number[];|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readShortArray(): number[];|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readIntArray(dataIn: number[]) : void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readIntArray(dataIn: number[]) : void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readIntArray(): number[];|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readIntArray(): number[];|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readLongArray(dataIn: number[]) : void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readLongArray(dataIn: number[]) : void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readLongArray(): number[];|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readLongArray(): number[];|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readFloatArray(dataIn: number[]) : void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readFloatArray(dataIn: number[]) : void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readFloatArray(): number[];|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readFloatArray(): number[];|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readDoubleArray(dataIn: number[]) : void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readDoubleArray(dataIn: number[]) : void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readDoubleArray(): number[];|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readDoubleArray(): number[];|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readBooleanArray(dataIn: boolean[]) : void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readBooleanArray(dataIn: boolean[]) : void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readBooleanArray(): boolean[];|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readBooleanArray(): boolean[];|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readCharArray(dataIn: number[]) : void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readCharArray(dataIn: number[]) : void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readCharArray(): number[];|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readCharArray(): number[];|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readStringArray(dataIn: string[]) : void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readStringArray(dataIn: string[]) : void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readStringArray(): string[];|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readStringArray(): string[];|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readParcelableArray(parcelableArray: Parcelable[]): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readParcelableArray(parcelableArray: Parcelable[]): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readRemoteObjectArray(objects: IRemoteObject[]): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readRemoteObjectArray(objects: IRemoteObject[]): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readRemoteObjectArray(): IRemoteObject[];|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readRemoteObjectArray(): IRemoteObject[];|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:static closeFileDescriptor(fd: number): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:static closeFileDescriptor(fd: number): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:static dupFileDescriptor(fd: number) :number;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:static dupFileDescriptor(fd: number) :number;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:containFileDescriptors(): boolean;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:containFileDescriptors(): boolean;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:writeFileDescriptor(fd: number): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:writeFileDescriptor(fd: number): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readFileDescriptor(): number;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readFileDescriptor(): number;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:writeAshmem(ashmem: Ashmem): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:writeAshmem(ashmem: Ashmem): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readAshmem(): Ashmem;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readAshmem(): Ashmem;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:getRawDataCapacity(): number;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:getRawDataCapacity(): number;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:writeRawData(rawData: number[], size: number): void;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:writeRawData(rawData: number[], size: number): void;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: MessageSequence<br>方法 or 属性:readRawData(size: number): number[];|@ohos.rpc.d.ts| +|新增|NA|类名:MessageSequence<br>方法or属性:readRawData(size: number): number[];|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: Parcelable|@ohos.rpc.d.ts| +|新增|NA|类名:Parcelable<br>方法or属性:|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: Parcelable<br>方法 or 属性:marshalling(dataOut: MessageSequence): boolean;|@ohos.rpc.d.ts| +|新增|NA|类名:Parcelable<br>方法or属性:marshalling(dataOut: MessageSequence): boolean;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: Parcelable<br>方法 or 属性:unmarshalling(dataIn: MessageSequence) : boolean;|@ohos.rpc.d.ts| +|新增|NA|类名:Parcelable<br>方法or属性:unmarshalling(dataIn: MessageSequence) : boolean;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: RequestResult|@ohos.rpc.d.ts| +|新增|NA|类名:RequestResult<br>方法or属性:|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: RequestResult<br>方法 or 属性:errCode: number;|@ohos.rpc.d.ts| +|新增|NA|类名:RequestResult<br>方法or属性:errCode: number;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: RequestResult<br>方法 or 属性:code: number;|@ohos.rpc.d.ts| +|新增|NA|类名:RequestResult<br>方法or属性:code: number;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: RequestResult<br>方法 or 属性:data: MessageSequence;|@ohos.rpc.d.ts| +|新增|NA|类名:RequestResult<br>方法or属性:data: MessageSequence;|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.rpc<br>类名: RequestResult<br>方法 or 属性:reply: MessageSequence;|@ohos.rpc.d.ts| +|新增|NA|类名:RequestResult<br>方法or属性:reply: MessageSequence;|@ohos.rpc.d.ts| +|新增|NA|类名:IRemoteObject<br>方法or属性:getLocalInterface(descriptor: string): IRemoteBroker;|@ohos.rpc.d.ts| +|新增|NA|类名:IRemoteObject<br>方法or属性:sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption): Promise\<RequestResult>;|@ohos.rpc.d.ts| +|新增|NA|类名:IRemoteObject<br>方法or属性:sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption, callback: AsyncCallback\<RequestResult>): void;|@ohos.rpc.d.ts| +|新增|NA|类名:IRemoteObject<br>方法or属性:registerDeathRecipient(recipient: DeathRecipient, flags: number): void;|@ohos.rpc.d.ts| +|新增|NA|类名:IRemoteObject<br>方法or属性:unregisterDeathRecipient(recipient: DeathRecipient, flags: number): void;|@ohos.rpc.d.ts| +|新增|NA|类名:IRemoteObject<br>方法or属性:getDescriptor(): string;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageOption<br>方法or属性:TF_SYNC: number;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageOption<br>方法or属性:TF_ASYNC: number;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageOption<br>方法or属性:TF_ACCEPT_FDS: number;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageOption<br>方法or属性:TF_WAIT_TIME: number;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageOption<br>方法or属性:constructor(syncFlags?: number, waitTime?: number);|@ohos.rpc.d.ts| +|新增|NA|类名:MessageOption<br>方法or属性:constructor(async?: boolean);|@ohos.rpc.d.ts| +|新增|NA|类名:MessageOption<br>方法or属性:isAsync(): boolean;|@ohos.rpc.d.ts| +|新增|NA|类名:MessageOption<br>方法or属性:setAsync(async: boolean): void;|@ohos.rpc.d.ts| +|新增|NA|类名:RemoteObject<br>方法or属性:getLocalInterface(descriptor: string): IRemoteBroker;|@ohos.rpc.d.ts| +|新增|NA|类名:RemoteObject<br>方法or属性:getDescriptor(): string;|@ohos.rpc.d.ts| +|新增|NA|类名:RemoteObject<br>方法or属性:onRemoteMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption): boolean \| Promise\<boolean>;|@ohos.rpc.d.ts| +|新增|NA|类名:RemoteObject<br>方法or属性:sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption): Promise\<RequestResult>;|@ohos.rpc.d.ts| +|新增|NA|类名:RemoteObject<br>方法or属性:sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption, callback: AsyncCallback\<RequestResult>): void;|@ohos.rpc.d.ts| +|新增|NA|类名:RemoteObject<br>方法or属性:modifyLocalInterface(localInterface: IRemoteBroker, descriptor: string): void;|@ohos.rpc.d.ts| +|新增|NA|类名:RemoteProxy<br>方法or属性:PING_TRANSACTION: number;|@ohos.rpc.d.ts| +|新增|NA|类名:RemoteProxy<br>方法or属性:DUMP_TRANSACTION: number;|@ohos.rpc.d.ts| +|新增|NA|类名:RemoteProxy<br>方法or属性:INTERFACE_TRANSACTION: number;|@ohos.rpc.d.ts| +|新增|NA|类名:RemoteProxy<br>方法or属性:MIN_TRANSACTION_ID: number;|@ohos.rpc.d.ts| +|新增|NA|类名:RemoteProxy<br>方法or属性:MAX_TRANSACTION_ID: number;|@ohos.rpc.d.ts| +|新增|NA|类名:RemoteProxy<br>方法or属性:getLocalInterface(interface: string): IRemoteBroker;|@ohos.rpc.d.ts| +|新增|NA|类名:RemoteProxy<br>方法or属性:registerDeathRecipient(recipient: DeathRecipient, flags: number): void;|@ohos.rpc.d.ts| +|新增|NA|类名:RemoteProxy<br>方法or属性:unregisterDeathRecipient(recipient: DeathRecipient, flags: number): void;|@ohos.rpc.d.ts| +|新增|NA|类名:RemoteProxy<br>方法or属性:getDescriptor(): string;|@ohos.rpc.d.ts| +|新增|NA|类名:RemoteProxy<br>方法or属性:sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption): Promise\<RequestResult>;|@ohos.rpc.d.ts| +|新增|NA|类名:RemoteProxy<br>方法or属性:sendMessageRequest(code: number, data: MessageSequence, reply: MessageSequence, options: MessageOption, callback: AsyncCallback\<RequestResult>): void;|@ohos.rpc.d.ts| +|新增|NA|类名:IPCSkeleton<br>方法or属性:static flushCmdBuffer(object: IRemoteObject): void;|@ohos.rpc.d.ts| +|新增|NA|类名:IPCSkeleton<br>方法or属性:static restoreCallingIdentity(identity: string): void;|@ohos.rpc.d.ts| +|新增|NA|类名:Ashmem<br>方法or属性:PROT_EXEC: number;|@ohos.rpc.d.ts| +|新增|NA|类名:Ashmem<br>方法or属性:PROT_NONE: number;|@ohos.rpc.d.ts| +|新增|NA|类名:Ashmem<br>方法or属性:PROT_READ: number;|@ohos.rpc.d.ts| +|新增|NA|类名:Ashmem<br>方法or属性:PROT_WRITE: number;|@ohos.rpc.d.ts| +|新增|NA|类名:Ashmem<br>方法or属性:static create(name: string, size: number): Ashmem;|@ohos.rpc.d.ts| +|新增|NA|类名:Ashmem<br>方法or属性:static create(ashmem: Ashmem): Ashmem;|@ohos.rpc.d.ts| +|新增|NA|类名:Ashmem<br>方法or属性:mapTypedAshmem(mapType: number): void;|@ohos.rpc.d.ts| +|新增|NA|类名:Ashmem<br>方法or属性:mapReadWriteAshmem(): void;|@ohos.rpc.d.ts| +|新增|NA|类名:Ashmem<br>方法or属性:mapReadonlyAshmem(): void;|@ohos.rpc.d.ts| +|新增|NA|类名:Ashmem<br>方法or属性:setProtectionType(protectionType: number): void;|@ohos.rpc.d.ts| +|新增|NA|类名:Ashmem<br>方法or属性:writeAshmem(buf: number[], size: number, offset: number): void;|@ohos.rpc.d.ts| +|新增|NA|类名:Ashmem<br>方法or属性:readAshmem(size: number, offset: number): number[];|@ohos.rpc.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function enableWifi(): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function disableWifi(): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function isWifiActive(): boolean;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function scan(): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function getScanResults(): Promise\<Array\<WifiScanInfo>>;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function getScanResults(callback: AsyncCallback\<Array\<WifiScanInfo>>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function getScanResultsSync(): Array\<WifiScanInfo>;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function addDeviceConfig(config: WifiDeviceConfig): Promise\<number>;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function addDeviceConfig(config: WifiDeviceConfig, callback: AsyncCallback\<number>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function addCandidateConfig(config: WifiDeviceConfig): Promise\<number>;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function addCandidateConfig(config: WifiDeviceConfig, callback: AsyncCallback\<number>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function removeCandidateConfig(networkId: number): Promise\<void>;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function removeCandidateConfig(networkId: number, callback: AsyncCallback\<void>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function getCandidateConfigs(): Array\<WifiDeviceConfig>;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function connectToCandidateConfig(networkId: number): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function connectToNetwork(networkId: number): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function connectToDevice(config: WifiDeviceConfig): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function disconnect(): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function getSignalLevel(rssi: number, band: number): number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function getLinkedInfo(): Promise\<WifiLinkedInfo>;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function getLinkedInfo(callback: AsyncCallback\<WifiLinkedInfo>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function isConnected(): boolean;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function getSupportedFeatures(): number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function isFeatureSupported(featureId: number): boolean;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function getDeviceMacAddress(): string[];|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function getIpInfo(): IpInfo;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function getCountryCode(): string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function reassociate(): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function reconnect(): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function getDeviceConfigs(): Array\<WifiDeviceConfig>;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function updateNetwork(config: WifiDeviceConfig): number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function disableNetwork(netId: number): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function removeAllNetwork(): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function removeDevice(id: number): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function enableHotspot(): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function disableHotspot(): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function isHotspotDualBandSupported(): boolean;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function isHotspotActive(): boolean;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function setHotspotConfig(config: HotspotConfig): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function getHotspotConfig(): HotspotConfig;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function getStations(): Array\<StationInfo>;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function getP2pLinkedInfo(): Promise\<WifiP2pLinkedInfo>;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function getP2pLinkedInfo(callback: AsyncCallback\<WifiP2pLinkedInfo>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function getCurrentGroup(): Promise\<WifiP2pGroupInfo>;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function getCurrentGroup(callback: AsyncCallback\<WifiP2pGroupInfo>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function getP2pPeerDevices(): Promise\<WifiP2pDevice[]>;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function getP2pPeerDevices(callback: AsyncCallback\<WifiP2pDevice[]>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function getP2pLocalDevice(): Promise\<WifiP2pDevice>;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function getP2pLocalDevice(callback: AsyncCallback\<WifiP2pDevice>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function createGroup(config: WifiP2PConfig): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function removeGroup(): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function p2pConnect(config: WifiP2PConfig): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function p2pCancelConnect(): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function startDiscoverDevices(): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function stopDiscoverDevices(): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function deletePersistentGroup(netId: number): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function getP2pGroups(): Promise\<Array\<WifiP2pGroupInfo>>;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function getP2pGroups(callback: AsyncCallback\<Array\<WifiP2pGroupInfo>>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function setDeviceName(devName: string): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function on(type: "wifiStateChange", callback: Callback\<number>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function off(type: "wifiStateChange", callback?: Callback\<number>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function on(type: "wifiConnectionChange", callback: Callback\<number>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function off(type: "wifiConnectionChange", callback?: Callback\<number>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function on(type: "wifiScanStateChange", callback: Callback\<number>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function off(type: "wifiScanStateChange", callback?: Callback\<number>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function on(type: "wifiRssiChange", callback: Callback\<number>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function off(type: "wifiRssiChange", callback?: Callback\<number>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function on(type: "streamChange", callback: Callback\<number>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function off(type: "streamChange", callback?: Callback\<number>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function on(type: "deviceConfigChange", callback: Callback\<number>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function off(type: "deviceConfigChange", callback?: Callback\<number>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function on(type: "hotspotStateChange", callback: Callback\<number>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function off(type: "hotspotStateChange", callback?: Callback\<number>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function on(type: "hotspotStaJoin", callback: Callback\<StationInfo>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function off(type: "hotspotStaJoin", callback?: Callback\<StationInfo>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function on(type: "hotspotStaLeave", callback: Callback\<StationInfo>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function off(type: "hotspotStaLeave", callback?: Callback\<StationInfo>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function on(type: "p2pStateChange", callback: Callback\<number>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function off(type: "p2pStateChange", callback?: Callback\<number>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function on(type: "p2pConnectionChange", callback: Callback\<WifiP2pLinkedInfo>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function off(type: "p2pConnectionChange", callback?: Callback\<WifiP2pLinkedInfo>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function on(type: "p2pDeviceChange", callback: Callback\<WifiP2pDevice>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function off(type: "p2pDeviceChange", callback?: Callback\<WifiP2pDevice>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function on(type: "p2pPeerDeviceChange", callback: Callback\<WifiP2pDevice[]>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function off(type: "p2pPeerDeviceChange", callback?: Callback\<WifiP2pDevice[]>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function on(type: "p2pPersistentGroupChange", callback: Callback\<void>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function off(type: "p2pPersistentGroupChange", callback?: Callback\<void>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function on(type: "p2pDiscoveryChange", callback: Callback\<number>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: wifiManager<br>方法 or 属性: function off(type: "p2pDiscoveryChange", callback?: Callback\<number>): void;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: EapMethod|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: EapMethod<br>方法 or 属性: EAP_NONE|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: EapMethod<br>方法 or 属性: EAP_PEAP|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: EapMethod<br>方法 or 属性: EAP_TLS|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: EapMethod<br>方法 or 属性: EAP_TTLS|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: EapMethod<br>方法 or 属性: EAP_PWD|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: EapMethod<br>方法 or 属性: EAP_SIM|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: EapMethod<br>方法 or 属性: EAP_AKA|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: EapMethod<br>方法 or 属性: EAP_AKA_PRIME|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: EapMethod<br>方法 or 属性: EAP_UNAUTH_TLS|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: Phase2Method|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: Phase2Method<br>方法 or 属性: PHASE2_NONE|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: Phase2Method<br>方法 or 属性: PHASE2_PAP|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: Phase2Method<br>方法 or 属性: PHASE2_MSCHAP|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: Phase2Method<br>方法 or 属性: PHASE2_MSCHAPV2|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: Phase2Method<br>方法 or 属性: PHASE2_GTC|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: Phase2Method<br>方法 or 属性: PHASE2_SIM|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: Phase2Method<br>方法 or 属性: PHASE2_AKA|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: Phase2Method<br>方法 or 属性: PHASE2_AKA_PRIME|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiEapConfig|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiEapConfig<br>方法 or 属性: eapMethod: EapMethod;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiEapConfig<br>方法 or 属性: phase2Method: Phase2Method;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiEapConfig<br>方法 or 属性: identity: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiEapConfig<br>方法 or 属性: anonymousIdentity: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiEapConfig<br>方法 or 属性: password: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiEapConfig<br>方法 or 属性: caCertAliases: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiEapConfig<br>方法 or 属性: caPath: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiEapConfig<br>方法 or 属性: clientCertAliases: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiEapConfig<br>方法 or 属性: certEntry: Uint8Array;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiEapConfig<br>方法 or 属性: certPassword: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiEapConfig<br>方法 or 属性: altSubjectMatch: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiEapConfig<br>方法 or 属性: domainSuffixMatch: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiEapConfig<br>方法 or 属性: realm: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiEapConfig<br>方法 or 属性: plmn: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiEapConfig<br>方法 or 属性: eapSubId: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiDeviceConfig|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiDeviceConfig<br>方法 or 属性: ssid: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiDeviceConfig<br>方法 or 属性: bssid?: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiDeviceConfig<br>方法 or 属性: preSharedKey: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiDeviceConfig<br>方法 or 属性: isHiddenSsid?: boolean;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiDeviceConfig<br>方法 or 属性: securityType: WifiSecurityType;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiDeviceConfig<br>方法 or 属性: creatorUid?: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiDeviceConfig<br>方法 or 属性: disableReason?: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiDeviceConfig<br>方法 or 属性: netId?: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiDeviceConfig<br>方法 or 属性: randomMacType?: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiDeviceConfig<br>方法 or 属性: randomMacAddr?: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiDeviceConfig<br>方法 or 属性: ipType?: IpType;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiDeviceConfig<br>方法 or 属性: staticIp?: IpConfig;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiDeviceConfig<br>方法 or 属性: eapConfig?: WifiEapConfig;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: IpConfig|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: IpConfig<br>方法 or 属性: ipAddress: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: IpConfig<br>方法 or 属性: gateway: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: IpConfig<br>方法 or 属性: prefixLength: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: IpConfig<br>方法 or 属性: dnsServers: number[];|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: IpConfig<br>方法 or 属性: domains: Array\<string>;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiInfoElem|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiInfoElem<br>方法 or 属性: eid: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiInfoElem<br>方法 or 属性: content: Uint8Array;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiChannelWidth|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiChannelWidth<br>方法 or 属性: WIDTH_20MHZ = 0|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiChannelWidth<br>方法 or 属性: WIDTH_40MHZ = 1|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiChannelWidth<br>方法 or 属性: WIDTH_80MHZ = 2|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiChannelWidth<br>方法 or 属性: WIDTH_160MHZ = 3|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiChannelWidth<br>方法 or 属性: WIDTH_80MHZ_PLUS = 4|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiChannelWidth<br>方法 or 属性: WIDTH_INVALID|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiScanInfo|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiScanInfo<br>方法 or 属性: ssid: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiScanInfo<br>方法 or 属性: bssid: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiScanInfo<br>方法 or 属性: capabilities: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiScanInfo<br>方法 or 属性: securityType: WifiSecurityType;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiScanInfo<br>方法 or 属性: rssi: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiScanInfo<br>方法 or 属性: band: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiScanInfo<br>方法 or 属性: frequency: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiScanInfo<br>方法 or 属性: channelWidth: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiScanInfo<br>方法 or 属性: centerFrequency0: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiScanInfo<br>方法 or 属性: centerFrequency1: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiScanInfo<br>方法 or 属性: infoElems: Array\<WifiInfoElem>;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiScanInfo<br>方法 or 属性: timestamp: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiSecurityType|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiSecurityType<br>方法 or 属性: WIFI_SEC_TYPE_INVALID = 0|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiSecurityType<br>方法 or 属性: WIFI_SEC_TYPE_OPEN = 1|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiSecurityType<br>方法 or 属性: WIFI_SEC_TYPE_WEP = 2|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiSecurityType<br>方法 or 属性: WIFI_SEC_TYPE_PSK = 3|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiSecurityType<br>方法 or 属性: WIFI_SEC_TYPE_SAE = 4|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiSecurityType<br>方法 or 属性: WIFI_SEC_TYPE_EAP = 5|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiSecurityType<br>方法 or 属性: WIFI_SEC_TYPE_EAP_SUITE_B = 6|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiSecurityType<br>方法 or 属性: WIFI_SEC_TYPE_OWE = 7|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiSecurityType<br>方法 or 属性: WIFI_SEC_TYPE_WAPI_CERT = 8|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiSecurityType<br>方法 or 属性: WIFI_SEC_TYPE_WAPI_PSK = 9|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiLinkedInfo|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiLinkedInfo<br>方法 or 属性: ssid: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiLinkedInfo<br>方法 or 属性: bssid: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiLinkedInfo<br>方法 or 属性: networkId: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiLinkedInfo<br>方法 or 属性: rssi: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiLinkedInfo<br>方法 or 属性: band: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiLinkedInfo<br>方法 or 属性: linkSpeed: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiLinkedInfo<br>方法 or 属性: frequency: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiLinkedInfo<br>方法 or 属性: isHidden: boolean;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiLinkedInfo<br>方法 or 属性: isRestricted: boolean;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiLinkedInfo<br>方法 or 属性: chload: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiLinkedInfo<br>方法 or 属性: snr: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiLinkedInfo<br>方法 or 属性: macType: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiLinkedInfo<br>方法 or 属性: macAddress: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiLinkedInfo<br>方法 or 属性: ipAddress: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiLinkedInfo<br>方法 or 属性: suppState: SuppState;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiLinkedInfo<br>方法 or 属性: connState: ConnState;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: IpInfo|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: IpInfo<br>方法 or 属性: ipAddress: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: IpInfo<br>方法 or 属性: gateway: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: IpInfo<br>方法 or 属性: netmask: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: IpInfo<br>方法 or 属性: primaryDns: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: IpInfo<br>方法 or 属性: secondDns: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: IpInfo<br>方法 or 属性: serverIp: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: IpInfo<br>方法 or 属性: leaseDuration: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: HotspotConfig|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: HotspotConfig<br>方法 or 属性: ssid: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: HotspotConfig<br>方法 or 属性: securityType: WifiSecurityType;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: HotspotConfig<br>方法 or 属性: band: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: HotspotConfig<br>方法 or 属性: preSharedKey: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: HotspotConfig<br>方法 or 属性: maxConn: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: StationInfo|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: StationInfo<br>方法 or 属性: name: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: StationInfo<br>方法 or 属性: macAddress: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: StationInfo<br>方法 or 属性: ipAddress: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: IpType|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: IpType<br>方法 or 属性: STATIC|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: IpType<br>方法 or 属性: DHCP|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: IpType<br>方法 or 属性: UNKNOWN|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: SuppState|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: SuppState<br>方法 or 属性: DISCONNECTED|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: SuppState<br>方法 or 属性: INTERFACE_DISABLED|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: SuppState<br>方法 or 属性: INACTIVE|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: SuppState<br>方法 or 属性: SCANNING|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: SuppState<br>方法 or 属性: AUTHENTICATING|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: SuppState<br>方法 or 属性: ASSOCIATING|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: SuppState<br>方法 or 属性: ASSOCIATED|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: SuppState<br>方法 or 属性: FOUR_WAY_HANDSHAKE|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: SuppState<br>方法 or 属性: GROUP_HANDSHAKE|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: SuppState<br>方法 or 属性: COMPLETED|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: SuppState<br>方法 or 属性: UNINITIALIZED|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: SuppState<br>方法 or 属性: INVALID|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: ConnState|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: ConnState<br>方法 or 属性: SCANNING|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: ConnState<br>方法 or 属性: CONNECTING|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: ConnState<br>方法 or 属性: AUTHENTICATING|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: ConnState<br>方法 or 属性: OBTAINING_IPADDR|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: ConnState<br>方法 or 属性: CONNECTED|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: ConnState<br>方法 or 属性: DISCONNECTING|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: ConnState<br>方法 or 属性: DISCONNECTED|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: ConnState<br>方法 or 属性: UNKNOWN|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiP2pDevice|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiP2pDevice<br>方法 or 属性: deviceName: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiP2pDevice<br>方法 or 属性: deviceAddress: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiP2pDevice<br>方法 or 属性: primaryDeviceType: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiP2pDevice<br>方法 or 属性: deviceStatus: P2pDeviceStatus;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiP2pDevice<br>方法 or 属性: groupCapabilities: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiP2PConfig|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiP2PConfig<br>方法 or 属性: deviceAddress: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiP2PConfig<br>方法 or 属性: netId: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiP2PConfig<br>方法 or 属性: passphrase: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiP2PConfig<br>方法 or 属性: groupName: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiP2PConfig<br>方法 or 属性: goBand: GroupOwnerBand;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiP2pGroupInfo|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiP2pGroupInfo<br>方法 or 属性: isP2pGo: boolean;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiP2pGroupInfo<br>方法 or 属性: ownerInfo: WifiP2pDevice;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiP2pGroupInfo<br>方法 or 属性: passphrase: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiP2pGroupInfo<br>方法 or 属性: interface: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiP2pGroupInfo<br>方法 or 属性: groupName: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiP2pGroupInfo<br>方法 or 属性: networkId: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiP2pGroupInfo<br>方法 or 属性: frequency: number;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiP2pGroupInfo<br>方法 or 属性: clientDevices: WifiP2pDevice[];|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiP2pGroupInfo<br>方法 or 属性: goIpAddress: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: P2pConnectState|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: P2pConnectState<br>方法 or 属性: DISCONNECTED = 0|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: P2pConnectState<br>方法 or 属性: CONNECTED = 1|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiP2pLinkedInfo|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiP2pLinkedInfo<br>方法 or 属性: connectState: P2pConnectState;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiP2pLinkedInfo<br>方法 or 属性: isGroupOwner: boolean;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: WifiP2pLinkedInfo<br>方法 or 属性: groupOwnerAddr: string;|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: P2pDeviceStatus|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: P2pDeviceStatus<br>方法 or 属性: CONNECTED = 0|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: P2pDeviceStatus<br>方法 or 属性: INVITED = 1|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: P2pDeviceStatus<br>方法 or 属性: FAILED = 2|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: P2pDeviceStatus<br>方法 or 属性: AVAILABLE = 3|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: P2pDeviceStatus<br>方法 or 属性: UNAVAILABLE = 4|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: GroupOwnerBand|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: GroupOwnerBand<br>方法 or 属性: GO_BAND_AUTO = 0|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: GroupOwnerBand<br>方法 or 属性: GO_BAND_2GHZ = 1|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManager<br>类名: GroupOwnerBand<br>方法 or 属性: GO_BAND_5GHZ = 2|@ohos.wifiManager.d.ts| +|新增|NA|模块名: ohos.wifiManagerExt<br>类名: wifiManagerExt|@ohos.wifiManagerExt.d.ts| +|新增|NA|模块名: ohos.wifiManagerExt<br>类名: wifiManagerExt<br>方法 or 属性: function enableHotspot(): void;|@ohos.wifiManagerExt.d.ts| +|新增|NA|模块名: ohos.wifiManagerExt<br>类名: wifiManagerExt<br>方法 or 属性: function disableHotspot(): void;|@ohos.wifiManagerExt.d.ts| +|新增|NA|模块名: ohos.wifiManagerExt<br>类名: wifiManagerExt<br>方法 or 属性: function getSupportedPowerMode(): Promise\<Array\<PowerMode>>;|@ohos.wifiManagerExt.d.ts| +|新增|NA|模块名: ohos.wifiManagerExt<br>类名: wifiManagerExt<br>方法 or 属性: function getSupportedPowerMode(callback: AsyncCallback\<Array\<PowerMode>>): void;|@ohos.wifiManagerExt.d.ts| +|新增|NA|模块名: ohos.wifiManagerExt<br>类名: wifiManagerExt<br>方法 or 属性: function getPowerMode (): Promise\<PowerMode>;|@ohos.wifiManagerExt.d.ts| +|新增|NA|模块名: ohos.wifiManagerExt<br>类名: wifiManagerExt<br>方法 or 属性: function getPowerMode (callback: AsyncCallback\<PowerMode>): void;|@ohos.wifiManagerExt.d.ts| +|新增|NA|模块名: ohos.wifiManagerExt<br>类名: wifiManagerExt<br>方法 or 属性: function setPowerMode(mode: PowerMode) : void|@ohos.wifiManagerExt.d.ts| +|新增|NA|模块名: ohos.wifiManagerExt<br>类名: PowerMode|@ohos.wifiManagerExt.d.ts| +|新增|NA|模块名: ohos.wifiManagerExt<br>类名: PowerMode<br>方法 or 属性: SLEEPING = 0|@ohos.wifiManagerExt.d.ts| +|新增|NA|模块名: ohos.wifiManagerExt<br>类名: PowerMode<br>方法 or 属性: GENERAL = 1|@ohos.wifiManagerExt.d.ts| +|新增|NA|模块名: ohos.wifiManagerExt<br>类名: PowerMode<br>方法 or 属性: THROUGH_WALL = 2|@ohos.wifiManagerExt.d.ts| +|新增|NA|模块名: nfctech<br>类名: IsoDepTag|nfctech.d.ts| +|新增|NA|类名:IsoDepTag<br>方法or属性:|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: IsoDepTag<br>方法 or 属性:getHistoricalBytes(): number[];|nfctech.d.ts| +|新增|NA|类名:IsoDepTag<br>方法or属性:getHistoricalBytes(): number[];|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: IsoDepTag<br>方法 or 属性:getHiLayerResponse(): number[];|nfctech.d.ts| +|新增|NA|类名:IsoDepTag<br>方法or属性:getHiLayerResponse(): number[];|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: IsoDepTag<br>方法 or 属性:isExtendedApduSupported(): Promise\<boolean>;|nfctech.d.ts| +|新增|NA|类名:IsoDepTag<br>方法or属性:isExtendedApduSupported(): Promise\<boolean>;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: IsoDepTag<br>方法 or 属性:isExtendedApduSupported(callback: AsyncCallback\<boolean>): void;|nfctech.d.ts| +|新增|NA|类名:IsoDepTag<br>方法or属性:isExtendedApduSupported(callback: AsyncCallback\<boolean>): void;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: NdefMessage|nfctech.d.ts| +|新增|NA|类名:NdefMessage<br>方法or属性:|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: NdefMessage<br>方法 or 属性:getNdefRecords(): tag.NdefRecord[];|nfctech.d.ts| +|新增|NA|类名:NdefMessage<br>方法or属性:getNdefRecords(): tag.NdefRecord[];|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: NdefTag|nfctech.d.ts| +|新增|NA|类名:NdefTag<br>方法or属性:|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: NdefTag<br>方法 or 属性:getNdefTagType(): tag.NfcForumType;|nfctech.d.ts| +|新增|NA|类名:NdefTag<br>方法or属性:getNdefTagType(): tag.NfcForumType;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: NdefTag<br>方法 or 属性:getNdefMessage(): NdefMessage;|nfctech.d.ts| +|新增|NA|类名:NdefTag<br>方法or属性:getNdefMessage(): NdefMessage;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: NdefTag<br>方法 or 属性:isNdefWritable(): boolean;|nfctech.d.ts| +|新增|NA|类名:NdefTag<br>方法or属性:isNdefWritable(): boolean;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: NdefTag<br>方法 or 属性:readNdef(): Promise\<NdefMessage>;|nfctech.d.ts| +|新增|NA|类名:NdefTag<br>方法or属性:readNdef(): Promise\<NdefMessage>;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: NdefTag<br>方法 or 属性:readNdef(callback: AsyncCallback\<NdefMessage>): void;|nfctech.d.ts| +|新增|NA|类名:NdefTag<br>方法or属性:readNdef(callback: AsyncCallback\<NdefMessage>): void;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: NdefTag<br>方法 or 属性:writeNdef(msg: NdefMessage): Promise\<void>;|nfctech.d.ts| +|新增|NA|类名:NdefTag<br>方法or属性:writeNdef(msg: NdefMessage): Promise\<void>;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: NdefTag<br>方法 or 属性:writeNdef(msg: NdefMessage, callback: AsyncCallback\<void>): void;|nfctech.d.ts| +|新增|NA|类名:NdefTag<br>方法or属性:writeNdef(msg: NdefMessage, callback: AsyncCallback\<void>): void;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: NdefTag<br>方法 or 属性:canSetReadOnly(): boolean;|nfctech.d.ts| +|新增|NA|类名:NdefTag<br>方法or属性:canSetReadOnly(): boolean;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: NdefTag<br>方法 or 属性:setReadOnly(): Promise\<void>;|nfctech.d.ts| +|新增|NA|类名:NdefTag<br>方法or属性:setReadOnly(): Promise\<void>;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: NdefTag<br>方法 or 属性:setReadOnly(callback: AsyncCallback\<void>): void;|nfctech.d.ts| +|新增|NA|类名:NdefTag<br>方法or属性:setReadOnly(callback: AsyncCallback\<void>): void;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: NdefTag<br>方法 or 属性:getNdefTagTypeString(type: tag.NfcForumType): string;|nfctech.d.ts| +|新增|NA|类名:NdefTag<br>方法or属性:getNdefTagTypeString(type: tag.NfcForumType): string;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: MifareClassicTag|nfctech.d.ts| +|新增|NA|类名:MifareClassicTag<br>方法or属性:|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: MifareClassicTag<br>方法 or 属性:authenticateSector(sectorIndex: number, key: number[], isKeyA: boolean): Promise\<void>;|nfctech.d.ts| +|新增|NA|类名:MifareClassicTag<br>方法or属性:authenticateSector(sectorIndex: number, key: number[], isKeyA: boolean): Promise\<void>;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: MifareClassicTag<br>方法 or 属性:authenticateSector(sectorIndex: number, key: number[], isKeyA: boolean, callback: AsyncCallback\<void>): void;|nfctech.d.ts| +|新增|NA|类名:MifareClassicTag<br>方法or属性:authenticateSector(sectorIndex: number, key: number[], isKeyA: boolean, callback: AsyncCallback\<void>): void;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: MifareClassicTag<br>方法 or 属性:readSingleBlock(blockIndex: number): Promise\<number[]>;|nfctech.d.ts| +|新增|NA|类名:MifareClassicTag<br>方法or属性:readSingleBlock(blockIndex: number): Promise\<number[]>;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: MifareClassicTag<br>方法 or 属性:readSingleBlock(blockIndex: number, callback: AsyncCallback\<number[]>): void;|nfctech.d.ts| +|新增|NA|类名:MifareClassicTag<br>方法or属性:readSingleBlock(blockIndex: number, callback: AsyncCallback\<number[]>): void;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: MifareClassicTag<br>方法 or 属性:writeSingleBlock(blockIndex: number, data: number[]): Promise\<void>;|nfctech.d.ts| +|新增|NA|类名:MifareClassicTag<br>方法or属性:writeSingleBlock(blockIndex: number, data: number[]): Promise\<void>;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: MifareClassicTag<br>方法 or 属性:writeSingleBlock(blockIndex: number, data: number[], callback: AsyncCallback\<void>): void;|nfctech.d.ts| +|新增|NA|类名:MifareClassicTag<br>方法or属性:writeSingleBlock(blockIndex: number, data: number[], callback: AsyncCallback\<void>): void;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: MifareClassicTag<br>方法 or 属性:incrementBlock(blockIndex: number, value: number): Promise\<void>;|nfctech.d.ts| +|新增|NA|类名:MifareClassicTag<br>方法or属性:incrementBlock(blockIndex: number, value: number): Promise\<void>;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: MifareClassicTag<br>方法 or 属性:incrementBlock(blockIndex: number, value: number, callback: AsyncCallback\<void>): void;|nfctech.d.ts| +|新增|NA|类名:MifareClassicTag<br>方法or属性:incrementBlock(blockIndex: number, value: number, callback: AsyncCallback\<void>): void;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: MifareClassicTag<br>方法 or 属性:decrementBlock(blockIndex: number, value: number): Promise\<void>;|nfctech.d.ts| +|新增|NA|类名:MifareClassicTag<br>方法or属性:decrementBlock(blockIndex: number, value: number): Promise\<void>;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: MifareClassicTag<br>方法 or 属性:decrementBlock(blockIndex: number, value: number, callback: AsyncCallback\<void>): void;|nfctech.d.ts| +|新增|NA|类名:MifareClassicTag<br>方法or属性:decrementBlock(blockIndex: number, value: number, callback: AsyncCallback\<void>): void;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: MifareClassicTag<br>方法 or 属性:transferToBlock(blockIndex: number): Promise\<void>;|nfctech.d.ts| +|新增|NA|类名:MifareClassicTag<br>方法or属性:transferToBlock(blockIndex: number): Promise\<void>;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: MifareClassicTag<br>方法 or 属性:transferToBlock(blockIndex: number, callback: AsyncCallback\<void>): void;|nfctech.d.ts| +|新增|NA|类名:MifareClassicTag<br>方法or属性:transferToBlock(blockIndex: number, callback: AsyncCallback\<void>): void;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: MifareClassicTag<br>方法 or 属性:restoreFromBlock(blockIndex: number): Promise\<void>;|nfctech.d.ts| +|新增|NA|类名:MifareClassicTag<br>方法or属性:restoreFromBlock(blockIndex: number): Promise\<void>;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: MifareClassicTag<br>方法 or 属性:restoreFromBlock(blockIndex: number, callback: AsyncCallback\<void>): void;|nfctech.d.ts| +|新增|NA|类名:MifareClassicTag<br>方法or属性:restoreFromBlock(blockIndex: number, callback: AsyncCallback\<void>): void;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: MifareClassicTag<br>方法 or 属性:getSectorCount(): number;|nfctech.d.ts| +|新增|NA|类名:MifareClassicTag<br>方法or属性:getSectorCount(): number;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: MifareClassicTag<br>方法 or 属性:getBlockCountInSector(sectorIndex: number): number;|nfctech.d.ts| +|新增|NA|类名:MifareClassicTag<br>方法or属性:getBlockCountInSector(sectorIndex: number): number;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: MifareClassicTag<br>方法 or 属性:getType(): tag.MifareClassicType;|nfctech.d.ts| +|新增|NA|类名:MifareClassicTag<br>方法or属性:getType(): tag.MifareClassicType;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: MifareClassicTag<br>方法 or 属性:getTagSize(): number;|nfctech.d.ts| +|新增|NA|类名:MifareClassicTag<br>方法or属性:getTagSize(): number;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: MifareClassicTag<br>方法 or 属性:isEmulatedTag(): boolean;|nfctech.d.ts| +|新增|NA|类名:MifareClassicTag<br>方法or属性:isEmulatedTag(): boolean;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: MifareClassicTag<br>方法 or 属性:getBlockIndex(sectorIndex: number): number;|nfctech.d.ts| +|新增|NA|类名:MifareClassicTag<br>方法or属性:getBlockIndex(sectorIndex: number): number;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: MifareClassicTag<br>方法 or 属性:getSectorIndex(blockIndex: number): number;|nfctech.d.ts| +|新增|NA|类名:MifareClassicTag<br>方法or属性:getSectorIndex(blockIndex: number): number;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: MifareUltralightTag|nfctech.d.ts| +|新增|NA|类名:MifareUltralightTag<br>方法or属性:|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: MifareUltralightTag<br>方法 or 属性:readMultiplePages(pageIndex: number): Promise\<number[]>;|nfctech.d.ts| +|新增|NA|类名:MifareUltralightTag<br>方法or属性:readMultiplePages(pageIndex: number): Promise\<number[]>;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: MifareUltralightTag<br>方法 or 属性:readMultiplePages(pageIndex: number, callback: AsyncCallback\<number[]>): void;|nfctech.d.ts| +|新增|NA|类名:MifareUltralightTag<br>方法or属性:readMultiplePages(pageIndex: number, callback: AsyncCallback\<number[]>): void;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: MifareUltralightTag<br>方法 or 属性:writeSinglePage(pageIndex: number, data: number[]): Promise\<void>;|nfctech.d.ts| +|新增|NA|类名:MifareUltralightTag<br>方法or属性:writeSinglePage(pageIndex: number, data: number[]): Promise\<void>;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: MifareUltralightTag<br>方法 or 属性:writeSinglePage(pageIndex: number, data: number[], callback: AsyncCallback\<void>): void;|nfctech.d.ts| +|新增|NA|类名:MifareUltralightTag<br>方法or属性:writeSinglePage(pageIndex: number, data: number[], callback: AsyncCallback\<void>): void;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: MifareUltralightTag<br>方法 or 属性:getType(): tag.MifareUltralightType;|nfctech.d.ts| +|新增|NA|类名:MifareUltralightTag<br>方法or属性:getType(): tag.MifareUltralightType;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: NdefFormatableTag|nfctech.d.ts| +|新增|NA|类名:NdefFormatableTag<br>方法or属性:|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: NdefFormatableTag<br>方法 or 属性:format(message: NdefMessage): Promise\<void>;|nfctech.d.ts| +|新增|NA|类名:NdefFormatableTag<br>方法or属性:format(message: NdefMessage): Promise\<void>;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: NdefFormatableTag<br>方法 or 属性:format(message: NdefMessage, callback: AsyncCallback\<void>): void;|nfctech.d.ts| +|新增|NA|类名:NdefFormatableTag<br>方法or属性:format(message: NdefMessage, callback: AsyncCallback\<void>): void;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: NdefFormatableTag<br>方法 or 属性:formatReadOnly(message: NdefMessage): Promise\<void>;|nfctech.d.ts| +|新增|NA|类名:NdefFormatableTag<br>方法or属性:formatReadOnly(message: NdefMessage): Promise\<void>;|nfctech.d.ts| +|新增|NA|模块名: nfctech<br>类名: NdefFormatableTag<br>方法 or 属性:formatReadOnly(message: NdefMessage, callback: AsyncCallback\<void>): void;|nfctech.d.ts| +|新增|NA|类名:NdefFormatableTag<br>方法or属性:formatReadOnly(message: NdefMessage, callback: AsyncCallback\<void>): void;|nfctech.d.ts| +|新增|NA|类名:TagSession<br>方法or属性:connect(): void;|tagSession.d.ts| +|新增|NA|类名:TagSession<br>方法or属性:resetConnection(): void;|tagSession.d.ts| +|新增|NA|类名:TagSession<br>方法or属性:isConnected(): boolean;|tagSession.d.ts| +|新增|NA|类名:TagSession<br>方法or属性:setTimeout(timeout: number): void;|tagSession.d.ts| +|新增|NA|类名:TagSession<br>方法or属性:getTimeout(): number;|tagSession.d.ts| +|新增|NA|类名:TagSession<br>方法or属性:transmit(data: number[]): Promise\<number[]>;|tagSession.d.ts| +|新增|NA|类名:TagSession<br>方法or属性:transmit(data: number[], callback: AsyncCallback\<number[]>): void;|tagSession.d.ts| +|新增|NA|类名:TagSession<br>方法or属性:getMaxTransmitSize(): number;|tagSession.d.ts| +|删除|模块名:ohos.rpc<br>类名:IRemoteObject|NA|@ohos.rpc.d.ts| +|废弃版本有变化|类名:bluetooth<br>废弃版本:N/A|类名:bluetooth<br>废弃版本:9<br>代替接口:ohos.bluetoothManager |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function getState(): BluetoothState;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function getState(): BluetoothState;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.getState |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function getBtConnectionState(): ProfileConnectionState;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function getBtConnectionState(): ProfileConnectionState;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.getBtConnectionState |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function pairDevice(deviceId: string): boolean;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function pairDevice(deviceId: string): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.pairDevice |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function cancelPairedDevice(deviceId: string): boolean;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function cancelPairedDevice(deviceId: string): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.cancelPairedDevice |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function getRemoteDeviceName(deviceId: string): string;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function getRemoteDeviceName(deviceId: string): string;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.getRemoteDeviceName |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function getRemoteDeviceClass(deviceId: string): DeviceClass;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function getRemoteDeviceClass(deviceId: string): DeviceClass;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.getRemoteDeviceClass |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function enableBluetooth(): boolean;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function enableBluetooth(): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.enableBluetooth |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function disableBluetooth(): boolean;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function disableBluetooth(): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.disableBluetooth |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function getLocalName(): string;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function getLocalName(): string;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.getLocalName |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function getPairedDevices(): Array\<string>;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function getPairedDevices(): Array\<string>;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.getPairedDevices |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function getProfileConnState(profileId: ProfileId): ProfileConnectionState;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function getProfileConnState(profileId: ProfileId): ProfileConnectionState;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.getProfileConnectionState |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function setDevicePairingConfirmation(device: string, accept: boolean): boolean;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function setDevicePairingConfirmation(device: string, accept: boolean): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.setDevicePairingConfirmation |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function setLocalName(name: string): boolean;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function setLocalName(name: string): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.setLocalName |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function setBluetoothScanMode(mode: ScanMode, duration: number): boolean;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function setBluetoothScanMode(mode: ScanMode, duration: number): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.setBluetoothScanMode |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function getBluetoothScanMode(): ScanMode;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function getBluetoothScanMode(): ScanMode;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.getBluetoothScanMode |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function startBluetoothDiscovery(): boolean;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function startBluetoothDiscovery(): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.startBluetoothDiscovery |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function stopBluetoothDiscovery(): boolean;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function stopBluetoothDiscovery(): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.stopBluetoothDiscovery |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function on(type: "bluetoothDeviceFind", callback: Callback\<Array\<string>>): void;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function on(type: "bluetoothDeviceFind", callback: Callback\<Array\<string>>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.on|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function off(type: "bluetoothDeviceFind", callback?: Callback\<Array\<string>>): void;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function off(type: "bluetoothDeviceFind", callback?: Callback\<Array\<string>>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.off|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function on(type: "bondStateChange", callback: Callback\<BondStateParam>): void;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function on(type: "bondStateChange", callback: Callback\<BondStateParam>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.on|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function off(type: "bondStateChange", callback?: Callback\<BondStateParam>): void;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function off(type: "bondStateChange", callback?: Callback\<BondStateParam>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.off|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function on(type: "pinRequired", callback: Callback\<PinRequiredParam>): void;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function on(type: "pinRequired", callback: Callback\<PinRequiredParam>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.on|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function off(type: "pinRequired", callback?: Callback\<PinRequiredParam>): void;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function off(type: "pinRequired", callback?: Callback\<PinRequiredParam>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.off|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function on(type: "stateChange", callback: Callback\<BluetoothState>): void;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function on(type: "stateChange", callback: Callback\<BluetoothState>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.on|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function off(type: "stateChange", callback?: Callback\<BluetoothState>): void;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function off(type: "stateChange", callback?: Callback\<BluetoothState>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.off|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function sppListen(name: string, option: SppOption, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function sppListen(name: string, option: SppOption, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.sppListen |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function sppAccept(serverSocket: number, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function sppAccept(serverSocket: number, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.sppAccept |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function sppConnect(device: string, option: SppOption, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function sppConnect(device: string, option: SppOption, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.sppConnect |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function sppCloseServerSocket(socket: number): void;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function sppCloseServerSocket(socket: number): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.sppCloseServerSocket |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function sppCloseClientSocket(socket: number): void;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function sppCloseClientSocket(socket: number): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.sppCloseClientSocket |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function sppWrite(clientSocket: number, data: ArrayBuffer): boolean;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function sppWrite(clientSocket: number, data: ArrayBuffer): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.sppWrite |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function on(type: "sppRead", clientSocket: number, callback: Callback\<ArrayBuffer>): void;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function on(type: "sppRead", clientSocket: number, callback: Callback\<ArrayBuffer>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.on|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function off(type: "sppRead", clientSocket: number, callback?: Callback\<ArrayBuffer>): void;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function off(type: "sppRead", clientSocket: number, callback?: Callback\<ArrayBuffer>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.off|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:bluetooth<br>方法 or 属性:function getProfile(profileId: ProfileId): A2dpSourceProfile \| HandsFreeAudioGatewayProfile;<br>废弃版本:N/A|类名:bluetooth<br>方法 or 属性:function getProfile(profileId: ProfileId): A2dpSourceProfile \| HandsFreeAudioGatewayProfile;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.getProfileInstance |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BaseProfile<br>废弃版本:N/A|类名:BaseProfile<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BaseProfile |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BaseProfile<br>方法 or 属性:getConnectionDevices(): Array\<string>;<br>废弃版本:N/A|类名:BaseProfile<br>方法 or 属性:getConnectionDevices(): Array\<string>;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BaseProfile|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BaseProfile<br>方法 or 属性:getDeviceState(device: string): ProfileConnectionState;<br>废弃版本:N/A|类名:BaseProfile<br>方法 or 属性:getDeviceState(device: string): ProfileConnectionState;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BaseProfile|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:A2dpSourceProfile<br>废弃版本:N/A|类名:A2dpSourceProfile<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.A2dpSourceProfile |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:A2dpSourceProfile<br>方法 or 属性:connect(device: string): boolean;<br>废弃版本:N/A|类名:A2dpSourceProfile<br>方法 or 属性:connect(device: string): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.A2dpSourceProfile|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:A2dpSourceProfile<br>方法 or 属性:disconnect(device: string): boolean;<br>废弃版本:N/A|类名:A2dpSourceProfile<br>方法 or 属性:disconnect(device: string): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.A2dpSourceProfile|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:A2dpSourceProfile<br>方法 or 属性:on(type: "connectionStateChange", callback: Callback\<StateChangeParam>): void;<br>废弃版本:N/A|类名:A2dpSourceProfile<br>方法 or 属性:on(type: "connectionStateChange", callback: Callback\<StateChangeParam>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.A2dpSourceProfile.on|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:A2dpSourceProfile<br>方法 or 属性:off(type: "connectionStateChange", callback?: Callback\<StateChangeParam>): void;<br>废弃版本:N/A|类名:A2dpSourceProfile<br>方法 or 属性:off(type: "connectionStateChange", callback?: Callback\<StateChangeParam>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.A2dpSourceProfile.off|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:A2dpSourceProfile<br>方法 or 属性:getPlayingState(device: string): PlayingState;<br>废弃版本:N/A|类名:A2dpSourceProfile<br>方法 or 属性:getPlayingState(device: string): PlayingState;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.A2dpSourceProfile|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:HandsFreeAudioGatewayProfile<br>废弃版本:N/A|类名:HandsFreeAudioGatewayProfile<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.HandsFreeAudioGatewayProfile |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:HandsFreeAudioGatewayProfile<br>方法 or 属性:connect(device: string): boolean;<br>废弃版本:N/A|类名:HandsFreeAudioGatewayProfile<br>方法 or 属性:connect(device: string): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.HandsFreeAudioGatewayProfile|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:HandsFreeAudioGatewayProfile<br>方法 or 属性:disconnect(device: string): boolean;<br>废弃版本:N/A|类名:HandsFreeAudioGatewayProfile<br>方法 or 属性:disconnect(device: string): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.HandsFreeAudioGatewayProfile|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:HandsFreeAudioGatewayProfile<br>方法 or 属性:on(type: "connectionStateChange", callback: Callback\<StateChangeParam>): void;<br>废弃版本:N/A|类名:HandsFreeAudioGatewayProfile<br>方法 or 属性:on(type: "connectionStateChange", callback: Callback\<StateChangeParam>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.HandsFreeAudioGatewayProfile.on|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:HandsFreeAudioGatewayProfile<br>方法 or 属性:off(type: "connectionStateChange", callback?: Callback\<StateChangeParam>): void;<br>废弃版本:N/A|类名:HandsFreeAudioGatewayProfile<br>方法 or 属性:off(type: "connectionStateChange", callback?: Callback\<StateChangeParam>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.HandsFreeAudioGatewayProfile.off|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BLE<br>方法 or 属性:function createGattServer(): GattServer;<br>废弃版本:N/A|类名:BLE<br>方法 or 属性:function createGattServer(): GattServer;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BLE.createGattServer |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BLE<br>方法 or 属性:function createGattClientDevice(deviceId: string): GattClientDevice;<br>废弃版本:N/A|类名:BLE<br>方法 or 属性:function createGattClientDevice(deviceId: string): GattClientDevice;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BLE.createGattClientDevice |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BLE<br>方法 or 属性:function getConnectedBLEDevices(): Array\<string>;<br>废弃版本:N/A|类名:BLE<br>方法 or 属性:function getConnectedBLEDevices(): Array\<string>;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BLE.getConnectedBLEDevices |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BLE<br>方法 or 属性:function startBLEScan(filters: Array\<ScanFilter>, options?: ScanOptions): void;<br>废弃版本:N/A|类名:BLE<br>方法 or 属性:function startBLEScan(filters: Array\<ScanFilter>, options?: ScanOptions): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BLE.startBLEScan |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BLE<br>方法 or 属性:function stopBLEScan(): void;<br>废弃版本:N/A|类名:BLE<br>方法 or 属性:function stopBLEScan(): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BLE.stopBLEScan |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BLE<br>方法 or 属性:function on(type: "BLEDeviceFind", callback: Callback\<Array\<ScanResult>>): void;<br>废弃版本:N/A|类名:BLE<br>方法 or 属性:function on(type: "BLEDeviceFind", callback: Callback\<Array\<ScanResult>>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BLE.on|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BLE<br>方法 or 属性:function off(type: "BLEDeviceFind", callback?: Callback\<Array\<ScanResult>>): void;<br>废弃版本:N/A|类名:BLE<br>方法 or 属性:function off(type: "BLEDeviceFind", callback?: Callback\<Array\<ScanResult>>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BLE.off|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>废弃版本:N/A|类名:GattServer<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:startAdvertising(setting: AdvertiseSetting, advData: AdvertiseData, advResponse?: AdvertiseData): void;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:startAdvertising(setting: AdvertiseSetting, advData: AdvertiseData, advResponse?: AdvertiseData): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:stopAdvertising(): void;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:stopAdvertising(): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:addService(service: GattService): boolean;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:addService(service: GattService): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:removeService(serviceUuid: string): boolean;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:removeService(serviceUuid: string): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:close(): void;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:close(): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:notifyCharacteristicChanged(deviceId: string, notifyCharacteristic: NotifyCharacteristic): boolean;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:notifyCharacteristicChanged(deviceId: string, notifyCharacteristic: NotifyCharacteristic): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:sendResponse(serverResponse: ServerResponse): boolean;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:sendResponse(serverResponse: ServerResponse): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:on(type: "characteristicRead", callback: Callback\<CharacteristicReadReq>): void;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:on(type: "characteristicRead", callback: Callback\<CharacteristicReadReq>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:off(type: "characteristicRead", callback?: Callback\<CharacteristicReadReq>): void;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:off(type: "characteristicRead", callback?: Callback\<CharacteristicReadReq>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:on(type: "characteristicWrite", callback: Callback\<CharacteristicWriteReq>): void;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:on(type: "characteristicWrite", callback: Callback\<CharacteristicWriteReq>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:off(type: "characteristicWrite", callback?: Callback\<CharacteristicWriteReq>): void;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:off(type: "characteristicWrite", callback?: Callback\<CharacteristicWriteReq>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:on(type: "descriptorRead", callback: Callback\<DescriptorReadReq>): void;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:on(type: "descriptorRead", callback: Callback\<DescriptorReadReq>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:off(type: "descriptorRead", callback?: Callback\<DescriptorReadReq>): void;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:off(type: "descriptorRead", callback?: Callback\<DescriptorReadReq>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:on(type: "descriptorWrite", callback: Callback\<DescriptorWriteReq>): void;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:on(type: "descriptorWrite", callback: Callback\<DescriptorWriteReq>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:off(type: "descriptorWrite", callback?: Callback\<DescriptorWriteReq>): void;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:off(type: "descriptorWrite", callback?: Callback\<DescriptorWriteReq>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:on(type: "connectStateChange", callback: Callback\<BLEConnectChangedState>): void;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:on(type: "connectStateChange", callback: Callback\<BLEConnectChangedState>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattServer<br>方法 or 属性:off(type: "connectStateChange", callback?: Callback\<BLEConnectChangedState>): void;<br>废弃版本:N/A|类名:GattServer<br>方法 or 属性:off(type: "connectStateChange", callback?: Callback\<BLEConnectChangedState>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattServer|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>废弃版本:N/A|类名:GattClientDevice<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:connect(): boolean;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:connect(): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:disconnect(): boolean;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:disconnect(): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:close(): boolean;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:close(): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:getDeviceName(callback: AsyncCallback\<string>): void;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:getDeviceName(callback: AsyncCallback\<string>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:getDeviceName(): Promise\<string>;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:getDeviceName(): Promise\<string>;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:getServices(callback: AsyncCallback\<Array\<GattService>>): void;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:getServices(callback: AsyncCallback\<Array\<GattService>>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:getServices(): Promise\<Array\<GattService>>;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:getServices(): Promise\<Array\<GattService>>;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:readCharacteristicValue(characteristic: BLECharacteristic, callback: AsyncCallback\<BLECharacteristic>): void;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:readCharacteristicValue(characteristic: BLECharacteristic, callback: AsyncCallback\<BLECharacteristic>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:readCharacteristicValue(characteristic: BLECharacteristic): Promise\<BLECharacteristic>;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:readCharacteristicValue(characteristic: BLECharacteristic): Promise\<BLECharacteristic>;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:readDescriptorValue(descriptor: BLEDescriptor, callback: AsyncCallback\<BLEDescriptor>): void;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:readDescriptorValue(descriptor: BLEDescriptor, callback: AsyncCallback\<BLEDescriptor>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:readDescriptorValue(descriptor: BLEDescriptor): Promise\<BLEDescriptor>;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:readDescriptorValue(descriptor: BLEDescriptor): Promise\<BLEDescriptor>;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:writeCharacteristicValue(characteristic: BLECharacteristic): boolean;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:writeCharacteristicValue(characteristic: BLECharacteristic): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:writeDescriptorValue(descriptor: BLEDescriptor): boolean;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:writeDescriptorValue(descriptor: BLEDescriptor): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:getRssiValue(callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:getRssiValue(callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:getRssiValue(): Promise\<number>;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:getRssiValue(): Promise\<number>;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:setBLEMtuSize(mtu: number): boolean;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:setBLEMtuSize(mtu: number): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:setNotifyCharacteristicChanged(characteristic: BLECharacteristic, enable: boolean): boolean;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:setNotifyCharacteristicChanged(characteristic: BLECharacteristic, enable: boolean): boolean;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:on(type: "BLECharacteristicChange", callback: Callback\<BLECharacteristic>): void;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:on(type: "BLECharacteristicChange", callback: Callback\<BLECharacteristic>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:off(type: "BLECharacteristicChange", callback?: Callback\<BLECharacteristic>): void;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:off(type: "BLECharacteristicChange", callback?: Callback\<BLECharacteristic>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:on(type: "BLEConnectionStateChange", callback: Callback\<BLEConnectChangedState>): void;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:on(type: "BLEConnectionStateChange", callback: Callback\<BLEConnectChangedState>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattClientDevice<br>方法 or 属性:off(type: "BLEConnectionStateChange", callback?: Callback\<BLEConnectChangedState>): void;<br>废弃版本:N/A|类名:GattClientDevice<br>方法 or 属性:off(type: "BLEConnectionStateChange", callback?: Callback\<BLEConnectChangedState>): void;<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattClientDevice|@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:GattService<br>废弃版本:N/A|类名:GattService<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.GattService |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BLECharacteristic<br>废弃版本:N/A|类名:BLECharacteristic<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BLECharacteristic |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BLEDescriptor<br>废弃版本:N/A|类名:BLEDescriptor<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BLEDescriptor |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:NotifyCharacteristic<br>废弃版本:N/A|类名:NotifyCharacteristic<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.NotifyCharacteristic |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:CharacteristicReadReq<br>废弃版本:N/A|类名:CharacteristicReadReq<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.CharacteristicReadRequest |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:CharacteristicWriteReq<br>废弃版本:N/A|类名:CharacteristicWriteReq<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.CharacteristicWriteRequest |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:DescriptorReadReq<br>废弃版本:N/A|类名:DescriptorReadReq<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.DescriptorReadRequest |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:DescriptorWriteReq<br>废弃版本:N/A|类名:DescriptorWriteReq<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.DescriptorWriteRequest |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:ServerResponse<br>废弃版本:N/A|类名:ServerResponse<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.ServerResponse |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BLEConnectChangedState<br>废弃版本:N/A|类名:BLEConnectChangedState<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BLEConnectChangedState |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:ScanResult<br>废弃版本:N/A|类名:ScanResult<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.ScanResult |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:AdvertiseSetting<br>废弃版本:N/A|类名:AdvertiseSetting<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.AdvertiseSetting |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:AdvertiseData<br>废弃版本:N/A|类名:AdvertiseData<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.AdvertiseData |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:ManufactureData<br>废弃版本:N/A|类名:ManufactureData<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.ManufactureData |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:ServiceData<br>废弃版本:N/A|类名:ServiceData<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.ServiceData |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:ScanFilter<br>废弃版本:N/A|类名:ScanFilter<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.ScanFilter |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:ScanOptions<br>废弃版本:N/A|类名:ScanOptions<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.ScanOptions |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:SppOption<br>废弃版本:N/A|类名:SppOption<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.SppOption |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:PinRequiredParam<br>废弃版本:N/A|类名:PinRequiredParam<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.PinRequiredParam |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:DeviceClass<br>废弃版本:N/A|类名:DeviceClass<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.DeviceClass |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BondStateParam<br>废弃版本:N/A|类名:BondStateParam<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BondStateParam |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:ScanDuty<br>废弃版本:N/A|类名:ScanDuty<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.ScanDuty |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:MatchMode<br>废弃版本:N/A|类名:MatchMode<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.MatchMode |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:ProfileConnectionState<br>废弃版本:N/A|类名:ProfileConnectionState<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.ProfileConnectionState |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BluetoothState<br>废弃版本:N/A|类名:BluetoothState<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BluetoothState |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:SppType<br>废弃版本:N/A|类名:SppType<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.SppType |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:ScanMode<br>废弃版本:N/A|类名:ScanMode<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.ScanMode |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:BondState<br>废弃版本:N/A|类名:BondState<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.BondState |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:MajorClass<br>废弃版本:N/A|类名:MajorClass<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.MajorClass |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:MajorMinorClass<br>废弃版本:N/A|类名:MajorMinorClass<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.MajorMinorClass |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:StateChangeParam<br>废弃版本:N/A|类名:StateChangeParam<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.StateChangeParam |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:PlayingState<br>废弃版本:N/A|类名:PlayingState<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.PlayingState |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:ProfileId<br>废弃版本:N/A|类名:ProfileId<br>废弃版本:9<br>代替接口:ohos.bluetoothManager/bluetoothManager.ProfileId |@ohos.bluetooth.d.ts| +|废弃版本有变化|类名:connectedTag<br>方法 or 属性:function init(): boolean;<br>废弃版本:N/A|类名:connectedTag<br>方法 or 属性:function init(): boolean;<br>废弃版本:9<br>代替接口:ohos.connectedTag/connectedTag|@ohos.connectedTag.d.ts| +|废弃版本有变化|类名:connectedTag<br>方法 or 属性:function uninit(): boolean;<br>废弃版本:N/A|类名:connectedTag<br>方法 or 属性:function uninit(): boolean;<br>废弃版本:9<br>代替接口:ohos.connectedTag/connectedTag|@ohos.connectedTag.d.ts| +|废弃版本有变化|类名:connectedTag<br>方法 or 属性:function readNdefTag(): Promise\<string>;<br>废弃版本:N/A|类名:connectedTag<br>方法 or 属性:function readNdefTag(): Promise\<string>;<br>废弃版本:9<br>代替接口:ohos.connectedTag/connectedTag|@ohos.connectedTag.d.ts| +|废弃版本有变化|类名:connectedTag<br>方法 or 属性:function readNdefTag(callback: AsyncCallback\<string>): void;<br>废弃版本:N/A|类名:connectedTag<br>方法 or 属性:function readNdefTag(callback: AsyncCallback\<string>): void;<br>废弃版本:9<br>代替接口:ohos.connectedTag/connectedTag|@ohos.connectedTag.d.ts| +|废弃版本有变化|类名:connectedTag<br>方法 or 属性:function writeNdefTag(data: string): Promise\<void>;<br>废弃版本:N/A|类名:connectedTag<br>方法 or 属性:function writeNdefTag(data: string): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.connectedTag/connectedTag|@ohos.connectedTag.d.ts| +|废弃版本有变化|类名:connectedTag<br>方法 or 属性:function writeNdefTag(data: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:connectedTag<br>方法 or 属性:function writeNdefTag(data: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.connectedTag/connectedTag|@ohos.connectedTag.d.ts| +|废弃版本有变化|类名:FeatureType<br>废弃版本:N/A|类名:FeatureType<br>废弃版本:9<br>代替接口:ohos.nfc.cardEmulation/cardEmulation|@ohos.nfc.cardEmulation.d.ts| +|废弃版本有变化|类名:cardEmulation<br>方法 or 属性:function isSupported(feature: number): boolean;<br>废弃版本:N/A|类名:cardEmulation<br>方法 or 属性:function isSupported(feature: number): boolean;<br>废弃版本:9<br>代替接口:ohos.nfc.cardEmulation/cardEmulation|@ohos.nfc.cardEmulation.d.ts| +|废弃版本有变化|类名:HceService<br>方法 or 属性:startHCE(aidList: string[]): boolean;<br>废弃版本:N/A|类名:HceService<br>方法 or 属性:startHCE(aidList: string[]): boolean;<br>废弃版本:9<br>代替接口:ohos.nfc.cardEmulation/cardEmulation.HceService|@ohos.nfc.cardEmulation.d.ts| +|废弃版本有变化|类名:HceService<br>方法 or 属性:stopHCE(): boolean;<br>废弃版本:N/A|类名:HceService<br>方法 or 属性:stopHCE(): boolean;<br>废弃版本:9<br>代替接口:ohos.nfc.cardEmulation/cardEmulation.HceService|@ohos.nfc.cardEmulation.d.ts| +|废弃版本有变化|类名:HceService<br>方法 or 属性:sendResponse(responseApdu: number[]): void;<br>废弃版本:N/A|类名:HceService<br>方法 or 属性:sendResponse(responseApdu: number[]): void;<br>废弃版本:9<br>代替接口:ohos.nfc.cardEmulation/cardEmulation.HceService|@ohos.nfc.cardEmulation.d.ts| +|废弃版本有变化|类名:nfcController<br>方法 or 属性:function isNfcAvailable(): boolean<br>废弃版本:N/A|类名:nfcController<br>方法 or 属性:function isNfcAvailable(): boolean<br>废弃版本:9<br>代替接口:global|@ohos.nfc.controller.d.ts| +|废弃版本有变化|类名:nfcController<br>方法 or 属性:function openNfc(): boolean<br>废弃版本:N/A|类名:nfcController<br>方法 or 属性:function openNfc(): boolean<br>废弃版本:9<br>代替接口:@ohos.nfc.controller.nfcController|@ohos.nfc.controller.d.ts| +|废弃版本有变化|类名:nfcController<br>方法 or 属性:function closeNfc(): boolean<br>废弃版本:N/A|类名:nfcController<br>方法 or 属性:function closeNfc(): boolean<br>废弃版本:9<br>代替接口:@ohos.nfc.controller.nfcController|@ohos.nfc.controller.d.ts| +|废弃版本有变化|类名:tag<br>方法 or 属性:function getNfcATag(tagInfo: TagInfo): NfcATag<br>废弃版本:N/A|类名:tag<br>方法 or 属性:function getNfcATag(tagInfo: TagInfo): NfcATag<br>废弃版本:9<br>代替接口:ohos.nfc.tag/tag|@ohos.nfc.tag.d.ts| +|废弃版本有变化|类名:tag<br>方法 or 属性:function getNfcBTag(tagInfo: TagInfo): NfcBTag<br>废弃版本:N/A|类名:tag<br>方法 or 属性:function getNfcBTag(tagInfo: TagInfo): NfcBTag<br>废弃版本:9<br>代替接口:ohos.nfc.tag/tag|@ohos.nfc.tag.d.ts| +|废弃版本有变化|类名:tag<br>方法 or 属性:function getNfcFTag(tagInfo: TagInfo): NfcFTag<br>废弃版本:N/A|类名:tag<br>方法 or 属性:function getNfcFTag(tagInfo: TagInfo): NfcFTag<br>废弃版本:9<br>代替接口:ohos.nfc.tag/tag|@ohos.nfc.tag.d.ts| +|废弃版本有变化|类名:tag<br>方法 or 属性:function getNfcVTag(tagInfo: TagInfo): NfcVTag<br>废弃版本:N/A|类名:tag<br>方法 or 属性:function getNfcVTag(tagInfo: TagInfo): NfcVTag<br>废弃版本:9<br>代替接口:ohos.nfc.tag/tag|@ohos.nfc.tag.d.ts| +|废弃版本有变化|类名:TagInfo<br>方法 or 属性:supportedProfiles: number[];<br>废弃版本:N/A|类名:TagInfo<br>方法 or 属性:supportedProfiles: number[];<br>废弃版本:9<br>代替接口:ohos.nfc.tag/tag.TagInfo|@ohos.nfc.tag.d.ts| +|废弃版本有变化|类名:MessageParcel<br>废弃版本:N/A|类名:MessageParcel<br>废弃版本:9<br>代替接口:ohos.rpc.MessageSequence |@ohos.rpc.d.ts| +|废弃版本有变化|类名:Sequenceable<br>废弃版本:N/A|类名:Sequenceable<br>废弃版本:9<br>代替接口:ohos.rpc.Parcelable |@ohos.rpc.d.ts| +|废弃版本有变化|类名:SendRequestResult<br>废弃版本:N/A|类名:SendRequestResult<br>废弃版本:9<br>代替接口:ohos.rpc.RequestResult |@ohos.rpc.d.ts| +|废弃版本有变化|类名:IRemoteObject<br>方法 or 属性:queryLocalInterface(descriptor: string): IRemoteBroker;<br>废弃版本:N/A|类名:IRemoteObject<br>方法 or 属性:queryLocalInterface(descriptor: string): IRemoteBroker;<br>废弃版本:9<br>代替接口:ohos.rpc.IRemoteObject|@ohos.rpc.d.ts| +|废弃版本有变化|类名:IRemoteObject<br>方法 or 属性:sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): boolean;<br>废弃版本:8|类名:IRemoteObject<br>方法 or 属性:sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): boolean;<br>废弃版本:9<br>代替接口:N/A|@ohos.rpc.d.ts| +|废弃版本有变化|类名:IRemoteObject<br>方法 or 属性:sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): Promise\<SendRequestResult>;<br>废弃版本:N/A|类名:IRemoteObject<br>方法 or 属性:sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): Promise\<SendRequestResult>;<br>废弃版本:9<br>代替接口:ohos.rpc.IRemoteObject|@ohos.rpc.d.ts| +|废弃版本有变化|类名:IRemoteObject<br>方法 or 属性:sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption, callback: AsyncCallback\<SendRequestResult>): void;<br>废弃版本:N/A|类名:IRemoteObject<br>方法 or 属性:sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption, callback: AsyncCallback\<SendRequestResult>): void;<br>废弃版本:9<br>代替接口:ohos.rpc.IRemoteObject|@ohos.rpc.d.ts| +|废弃版本有变化|类名:IRemoteObject<br>方法 or 属性:addDeathRecipient(recipient: DeathRecipient, flags: number): boolean;<br>废弃版本:N/A|类名:IRemoteObject<br>方法 or 属性:addDeathRecipient(recipient: DeathRecipient, flags: number): boolean;<br>废弃版本:9<br>代替接口:ohos.rpc.IRemoteObject|@ohos.rpc.d.ts| +|废弃版本有变化|类名:IRemoteObject<br>方法 or 属性:removeDeathRecipient(recipient: DeathRecipient, flags: number): boolean;<br>废弃版本:N/A|类名:IRemoteObject<br>方法 or 属性:removeDeathRecipient(recipient: DeathRecipient, flags: number): boolean;<br>废弃版本:9<br>代替接口:ohos.rpc.IRemoteObject|@ohos.rpc.d.ts| +|废弃版本有变化|类名:IRemoteObject<br>方法 or 属性:getInterfaceDescriptor(): string;<br>废弃版本:N/A|类名:IRemoteObject<br>方法 or 属性:getInterfaceDescriptor(): string;<br>废弃版本:9<br>代替接口:ohos.rpc.IRemoteObject|@ohos.rpc.d.ts| +|废弃版本有变化|类名:RemoteObject<br>方法 or 属性:queryLocalInterface(descriptor: string): IRemoteBroker;<br>废弃版本:N/A|类名:RemoteObject<br>方法 or 属性:queryLocalInterface(descriptor: string): IRemoteBroker;<br>废弃版本:9<br>代替接口:ohos.rpc.RemoteObject|@ohos.rpc.d.ts| +|废弃版本有变化|类名:RemoteObject<br>方法 or 属性:getInterfaceDescriptor(): string;<br>废弃版本:N/A|类名:RemoteObject<br>方法 or 属性:getInterfaceDescriptor(): string;<br>废弃版本:9<br>代替接口:ohos.rpc.RemoteObject|@ohos.rpc.d.ts| +|废弃版本有变化|类名:RemoteObject<br>方法 or 属性:onRemoteRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): boolean;<br>废弃版本:N/A|类名:RemoteObject<br>方法 or 属性:onRemoteRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): boolean;<br>废弃版本:9<br>代替接口:ohos.rpc.RemoteObject|@ohos.rpc.d.ts| +|废弃版本有变化|类名:RemoteObject<br>方法 or 属性:sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): Promise\<SendRequestResult>;<br>废弃版本:N/A|类名:RemoteObject<br>方法 or 属性:sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): Promise\<SendRequestResult>;<br>废弃版本:9<br>代替接口:ohos.rpc.RemoteObject|@ohos.rpc.d.ts| +|废弃版本有变化|类名:RemoteObject<br>方法 or 属性:sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption, callback: AsyncCallback\<SendRequestResult>): void;<br>废弃版本:N/A|类名:RemoteObject<br>方法 or 属性:sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption, callback: AsyncCallback\<SendRequestResult>): void;<br>废弃版本:9<br>代替接口:ohos.rpc.RemoteObject|@ohos.rpc.d.ts| +|废弃版本有变化|类名:RemoteObject<br>方法 or 属性:attachLocalInterface(localInterface: IRemoteBroker, descriptor: string): void;<br>废弃版本:N/A|类名:RemoteObject<br>方法 or 属性:attachLocalInterface(localInterface: IRemoteBroker, descriptor: string): void;<br>废弃版本:9<br>代替接口:ohos.rpc.RemoteObject|@ohos.rpc.d.ts| +|废弃版本有变化|类名:RemoteProxy<br>方法 or 属性:queryLocalInterface(interface: string): IRemoteBroker;<br>废弃版本:N/A|类名:RemoteProxy<br>方法 or 属性:queryLocalInterface(interface: string): IRemoteBroker;<br>废弃版本:9<br>代替接口:ohos.rpc.RemoteProxy|@ohos.rpc.d.ts| +|废弃版本有变化|类名:RemoteProxy<br>方法 or 属性:addDeathRecipient(recipient: DeathRecipient, flags: number): boolean;<br>废弃版本:N/A|类名:RemoteProxy<br>方法 or 属性:addDeathRecipient(recipient: DeathRecipient, flags: number): boolean;<br>废弃版本:9<br>代替接口:ohos.rpc.RemoteProxy|@ohos.rpc.d.ts| +|废弃版本有变化|类名:RemoteProxy<br>方法 or 属性:removeDeathRecipient(recipient: DeathRecipient, flags: number): boolean;<br>废弃版本:N/A|类名:RemoteProxy<br>方法 or 属性:removeDeathRecipient(recipient: DeathRecipient, flags: number): boolean;<br>废弃版本:9<br>代替接口:ohos.rpc.RemoteProxy|@ohos.rpc.d.ts| +|废弃版本有变化|类名:RemoteProxy<br>方法 or 属性:getInterfaceDescriptor(): string;<br>废弃版本:N/A|类名:RemoteProxy<br>方法 or 属性:getInterfaceDescriptor(): string;<br>废弃版本:9<br>代替接口:ohos.rpc.RemoteProxy|@ohos.rpc.d.ts| +|废弃版本有变化|类名:RemoteProxy<br>方法 or 属性:sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): Promise\<SendRequestResult>;<br>废弃版本:N/A|类名:RemoteProxy<br>方法 or 属性:sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption): Promise\<SendRequestResult>;<br>废弃版本:9<br>代替接口:ohos.rpc.RemoteProxy|@ohos.rpc.d.ts| +|废弃版本有变化|类名:RemoteProxy<br>方法 or 属性:sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption, callback: AsyncCallback\<SendRequestResult>): void;<br>废弃版本:N/A|类名:RemoteProxy<br>方法 or 属性:sendRequest(code: number, data: MessageParcel, reply: MessageParcel, options: MessageOption, callback: AsyncCallback\<SendRequestResult>): void;<br>废弃版本:9<br>代替接口:ohos.rpc.RemoteProxy|@ohos.rpc.d.ts| +|废弃版本有变化|类名:IPCSkeleton<br>方法 or 属性:static flushCommands(object: IRemoteObject): number;<br>废弃版本:N/A|类名:IPCSkeleton<br>方法 or 属性:static flushCommands(object: IRemoteObject): number;<br>废弃版本:9<br>代替接口:ohos.rpc.IPCSkeleton|@ohos.rpc.d.ts| +|废弃版本有变化|类名:IPCSkeleton<br>方法 or 属性:static setCallingIdentity(identity: string): boolean;<br>废弃版本:N/A|类名:IPCSkeleton<br>方法 or 属性:static setCallingIdentity(identity: string): boolean;<br>废弃版本:9<br>代替接口:ohos.rpc.IPCSkeleton|@ohos.rpc.d.ts| +|废弃版本有变化|类名:Ashmem<br>方法 or 属性:static createAshmem(name: string, size: number): Ashmem;<br>废弃版本:N/A|类名:Ashmem<br>方法 or 属性:static createAshmem(name: string, size: number): Ashmem;<br>废弃版本:9<br>代替接口:ohos.rpc.Ashmem|@ohos.rpc.d.ts| +|废弃版本有变化|类名:Ashmem<br>方法 or 属性:static createAshmemFromExisting(ashmem: Ashmem): Ashmem;<br>废弃版本:N/A|类名:Ashmem<br>方法 or 属性:static createAshmemFromExisting(ashmem: Ashmem): Ashmem;<br>废弃版本:9<br>代替接口:ohos.rpc.Ashmem|@ohos.rpc.d.ts| +|废弃版本有变化|类名:Ashmem<br>方法 or 属性:mapAshmem(mapType: number): boolean;<br>废弃版本:N/A|类名:Ashmem<br>方法 or 属性:mapAshmem(mapType: number): boolean;<br>废弃版本:9<br>代替接口:ohos.rpc.Ashmem|@ohos.rpc.d.ts| +|废弃版本有变化|类名:Ashmem<br>方法 or 属性:mapReadAndWriteAshmem(): boolean;<br>废弃版本:N/A|类名:Ashmem<br>方法 or 属性:mapReadAndWriteAshmem(): boolean;<br>废弃版本:9<br>代替接口:ohos.rpc.Ashmem|@ohos.rpc.d.ts| +|废弃版本有变化|类名:Ashmem<br>方法 or 属性:mapReadOnlyAshmem(): boolean;<br>废弃版本:N/A|类名:Ashmem<br>方法 or 属性:mapReadOnlyAshmem(): boolean;<br>废弃版本:9<br>代替接口:ohos.rpc.Ashmem|@ohos.rpc.d.ts| +|废弃版本有变化|类名:Ashmem<br>方法 or 属性:setProtection(protectionType: number): boolean;<br>废弃版本:N/A|类名:Ashmem<br>方法 or 属性:setProtection(protectionType: number): boolean;<br>废弃版本:9<br>代替接口:ohos.rpc.Ashmem|@ohos.rpc.d.ts| +|废弃版本有变化|类名:Ashmem<br>方法 or 属性:writeToAshmem(buf: number[], size: number, offset: number): boolean;<br>废弃版本:N/A|类名:Ashmem<br>方法 or 属性:writeToAshmem(buf: number[], size: number, offset: number): boolean;<br>废弃版本:9<br>代替接口:ohos.rpc.Ashmem|@ohos.rpc.d.ts| +|废弃版本有变化|类名:Ashmem<br>方法 or 属性:readFromAshmem(size: number, offset: number): number[];<br>废弃版本:N/A|类名:Ashmem<br>方法 or 属性:readFromAshmem(size: number, offset: number): number[];<br>废弃版本:9<br>代替接口:ohos.rpc.Ashmem|@ohos.rpc.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function enableWifi(): boolean;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function enableWifi(): boolean;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.enableWifi |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function disableWifi(): boolean;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function disableWifi(): boolean;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.disableWifi |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function isWifiActive(): boolean;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function isWifiActive(): boolean;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.isWifiActive |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function scan(): boolean;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function scan(): boolean;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.scan |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function getScanInfos(): Promise\<Array\<WifiScanInfo>>;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function getScanInfos(): Promise\<Array\<WifiScanInfo>>;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.getScanResults |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function getScanInfos(callback: AsyncCallback\<Array\<WifiScanInfo>>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function getScanInfos(callback: AsyncCallback\<Array\<WifiScanInfo>>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.getScanResults |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function addDeviceConfig(config: WifiDeviceConfig): Promise\<number>;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function addDeviceConfig(config: WifiDeviceConfig): Promise\<number>;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.addDeviceConfig |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function addDeviceConfig(config: WifiDeviceConfig, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function addDeviceConfig(config: WifiDeviceConfig, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.addDeviceConfig |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function addUntrustedConfig(config: WifiDeviceConfig): Promise\<boolean>;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function addUntrustedConfig(config: WifiDeviceConfig): Promise\<boolean>;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.addCandidateConfig |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function addUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function addUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.addCandidateConfig |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function removeUntrustedConfig(config: WifiDeviceConfig): Promise\<boolean>;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function removeUntrustedConfig(config: WifiDeviceConfig): Promise\<boolean>;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.removeCandidateConfig |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function removeUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function removeUntrustedConfig(config: WifiDeviceConfig, callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.removeCandidateConfig |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function connectToNetwork(networkId: number): boolean;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function connectToNetwork(networkId: number): boolean;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.connectToNetwork |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function connectToDevice(config: WifiDeviceConfig): boolean;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function connectToDevice(config: WifiDeviceConfig): boolean;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.connectToDevice |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function disconnect(): boolean;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function disconnect(): boolean;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.disconnect |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function getSignalLevel(rssi: number, band: number): number;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function getSignalLevel(rssi: number, band: number): number;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.getSignalLevel |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function getLinkedInfo(): Promise\<WifiLinkedInfo>;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function getLinkedInfo(): Promise\<WifiLinkedInfo>;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.getLinkedInfo |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function getLinkedInfo(callback: AsyncCallback\<WifiLinkedInfo>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function getLinkedInfo(callback: AsyncCallback\<WifiLinkedInfo>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.getLinkedInfo |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function isConnected(): boolean;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function isConnected(): boolean;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.isConnected |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function getSupportedFeatures(): number;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function getSupportedFeatures(): number;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.getSupportedFeatures |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function isFeatureSupported(featureId: number): boolean;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function isFeatureSupported(featureId: number): boolean;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.isFeatureSupported |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function getDeviceMacAddress(): string[];<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function getDeviceMacAddress(): string[];<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.getDeviceMacAddress |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function getIpInfo(): IpInfo;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function getIpInfo(): IpInfo;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.getIpInfo |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function getCountryCode(): string;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function getCountryCode(): string;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.getCountryCode |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function reassociate(): boolean;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function reassociate(): boolean;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.reassociate |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function reconnect(): boolean;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function reconnect(): boolean;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.reconnect |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function getDeviceConfigs(): Array\<WifiDeviceConfig>;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function getDeviceConfigs(): Array\<WifiDeviceConfig>;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.getDeviceConfigs |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function updateNetwork(config: WifiDeviceConfig): number;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function updateNetwork(config: WifiDeviceConfig): number;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.updateNetwork |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function disableNetwork(netId: number): boolean;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function disableNetwork(netId: number): boolean;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.disableNetwork |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function removeAllNetwork(): boolean;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function removeAllNetwork(): boolean;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.removeAllNetwork |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function removeDevice(id: number): boolean;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function removeDevice(id: number): boolean;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.removeDevice |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function enableHotspot(): boolean;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function enableHotspot(): boolean;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.enableHotspot |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function disableHotspot(): boolean;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function disableHotspot(): boolean;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.disableHotspot |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function isHotspotDualBandSupported(): boolean;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function isHotspotDualBandSupported(): boolean;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.isHotspotDualBandSupported |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function isHotspotActive(): boolean;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function isHotspotActive(): boolean;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.isHotspotActive |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function setHotspotConfig(config: HotspotConfig): boolean;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function setHotspotConfig(config: HotspotConfig): boolean;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.setHotspotConfig |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function getHotspotConfig(): HotspotConfig;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function getHotspotConfig(): HotspotConfig;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.getHotspotConfig |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function getStations(): Array\<StationInfo>;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function getStations(): Array\<StationInfo>;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.getStations |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function getP2pLinkedInfo(): Promise\<WifiP2pLinkedInfo>;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function getP2pLinkedInfo(): Promise\<WifiP2pLinkedInfo>;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.getP2pLinkedInfo |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function getP2pLinkedInfo(callback: AsyncCallback\<WifiP2pLinkedInfo>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function getP2pLinkedInfo(callback: AsyncCallback\<WifiP2pLinkedInfo>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.getP2pLinkedInfo |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function getCurrentGroup(): Promise\<WifiP2pGroupInfo>;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function getCurrentGroup(): Promise\<WifiP2pGroupInfo>;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.getCurrentGroup |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function getCurrentGroup(callback: AsyncCallback\<WifiP2pGroupInfo>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function getCurrentGroup(callback: AsyncCallback\<WifiP2pGroupInfo>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.getCurrentGroup |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function getP2pPeerDevices(): Promise\<WifiP2pDevice[]>;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function getP2pPeerDevices(): Promise\<WifiP2pDevice[]>;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.getP2pPeerDevices |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function getP2pPeerDevices(callback: AsyncCallback\<WifiP2pDevice[]>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function getP2pPeerDevices(callback: AsyncCallback\<WifiP2pDevice[]>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.getP2pPeerDevices |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function createGroup(config: WifiP2PConfig): boolean;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function createGroup(config: WifiP2PConfig): boolean;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.createGroup |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function removeGroup(): boolean;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function removeGroup(): boolean;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.removeGroup |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function p2pConnect(config: WifiP2PConfig): boolean;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function p2pConnect(config: WifiP2PConfig): boolean;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.p2pConnect |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function p2pCancelConnect(): boolean;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function p2pCancelConnect(): boolean;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.p2pCancelConnect |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function startDiscoverDevices(): boolean;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function startDiscoverDevices(): boolean;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.startDiscoverDevices |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function stopDiscoverDevices(): boolean;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function stopDiscoverDevices(): boolean;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.stopDiscoverDevices |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function deletePersistentGroup(netId: number): boolean;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function deletePersistentGroup(netId: number): boolean;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.deletePersistentGroup |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function setDeviceName(devName: string): boolean;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function setDeviceName(devName: string): boolean;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.setDeviceName |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function on(type: "wifiStateChange", callback: Callback\<number>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function on(type: "wifiStateChange", callback: Callback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.on|@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function off(type: "wifiStateChange", callback?: Callback\<number>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function off(type: "wifiStateChange", callback?: Callback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.off|@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function on(type: "wifiConnectionChange", callback: Callback\<number>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function on(type: "wifiConnectionChange", callback: Callback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.on|@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function off(type: "wifiConnectionChange", callback?: Callback\<number>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function off(type: "wifiConnectionChange", callback?: Callback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.off|@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function on(type: "wifiScanStateChange", callback: Callback\<number>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function on(type: "wifiScanStateChange", callback: Callback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.on|@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function off(type: "wifiScanStateChange", callback?: Callback\<number>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function off(type: "wifiScanStateChange", callback?: Callback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.off|@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function on(type: "wifiRssiChange", callback: Callback\<number>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function on(type: "wifiRssiChange", callback: Callback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.on|@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function off(type: "wifiRssiChange", callback?: Callback\<number>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function off(type: "wifiRssiChange", callback?: Callback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.off|@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function on(type: "streamChange", callback: Callback\<number>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function on(type: "streamChange", callback: Callback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.on|@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function off(type: "streamChange", callback?: Callback\<number>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function off(type: "streamChange", callback?: Callback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.off|@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function on(type: "hotspotStateChange", callback: Callback\<number>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function on(type: "hotspotStateChange", callback: Callback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.on|@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function off(type: "hotspotStateChange", callback?: Callback\<number>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function off(type: "hotspotStateChange", callback?: Callback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.off|@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function on(type: "hotspotStaJoin", callback: Callback\<StationInfo>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function on(type: "hotspotStaJoin", callback: Callback\<StationInfo>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.on|@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function off(type: "hotspotStaJoin", callback?: Callback\<StationInfo>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function off(type: "hotspotStaJoin", callback?: Callback\<StationInfo>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.off|@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function on(type: "hotspotStaLeave", callback: Callback\<StationInfo>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function on(type: "hotspotStaLeave", callback: Callback\<StationInfo>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.on|@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function off(type: "hotspotStaLeave", callback?: Callback\<StationInfo>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function off(type: "hotspotStaLeave", callback?: Callback\<StationInfo>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.off|@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function on(type: "p2pStateChange", callback: Callback\<number>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function on(type: "p2pStateChange", callback: Callback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.on|@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function off(type: "p2pStateChange", callback?: Callback\<number>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function off(type: "p2pStateChange", callback?: Callback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.off|@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function on(type: "p2pConnectionChange", callback: Callback\<WifiP2pLinkedInfo>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function on(type: "p2pConnectionChange", callback: Callback\<WifiP2pLinkedInfo>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.on|@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function off(type: "p2pConnectionChange", callback?: Callback\<WifiP2pLinkedInfo>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function off(type: "p2pConnectionChange", callback?: Callback\<WifiP2pLinkedInfo>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.off|@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function on(type: "p2pDeviceChange", callback: Callback\<WifiP2pDevice>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function on(type: "p2pDeviceChange", callback: Callback\<WifiP2pDevice>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.on|@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function off(type: "p2pDeviceChange", callback?: Callback\<WifiP2pDevice>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function off(type: "p2pDeviceChange", callback?: Callback\<WifiP2pDevice>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.off|@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function on(type: "p2pPeerDeviceChange", callback: Callback\<WifiP2pDevice[]>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function on(type: "p2pPeerDeviceChange", callback: Callback\<WifiP2pDevice[]>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.on|@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function off(type: "p2pPeerDeviceChange", callback?: Callback\<WifiP2pDevice[]>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function off(type: "p2pPeerDeviceChange", callback?: Callback\<WifiP2pDevice[]>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.off|@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function on(type: "p2pPersistentGroupChange", callback: Callback\<void>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function on(type: "p2pPersistentGroupChange", callback: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.on|@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function off(type: "p2pPersistentGroupChange", callback?: Callback\<void>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function off(type: "p2pPersistentGroupChange", callback?: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.off|@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function on(type: "p2pDiscoveryChange", callback: Callback\<number>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function on(type: "p2pDiscoveryChange", callback: Callback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.on|@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifi<br>方法 or 属性:function off(type: "p2pDiscoveryChange", callback?: Callback\<number>): void;<br>废弃版本:N/A|类名:wifi<br>方法 or 属性:function off(type: "p2pDiscoveryChange", callback?: Callback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.off|@ohos.wifi.d.ts| +|废弃版本有变化|类名:WifiDeviceConfig<br>废弃版本:N/A|类名:WifiDeviceConfig<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.WifiDeviceConfig |@ohos.wifi.d.ts| +|废弃版本有变化|类名:IpConfig<br>废弃版本:N/A|类名:IpConfig<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.IpConfig |@ohos.wifi.d.ts| +|废弃版本有变化|类名:WifiScanInfo<br>废弃版本:N/A|类名:WifiScanInfo<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.WifiScanInfo |@ohos.wifi.d.ts| +|废弃版本有变化|类名:WifiSecurityType<br>废弃版本:N/A|类名:WifiSecurityType<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.WifiSecurityType |@ohos.wifi.d.ts| +|废弃版本有变化|类名:WifiLinkedInfo<br>废弃版本:N/A|类名:WifiLinkedInfo<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.WifiLinkedInfo |@ohos.wifi.d.ts| +|废弃版本有变化|类名:IpInfo<br>废弃版本:N/A|类名:IpInfo<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.IpInfo |@ohos.wifi.d.ts| +|废弃版本有变化|类名:HotspotConfig<br>废弃版本:N/A|类名:HotspotConfig<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.HotspotConfig |@ohos.wifi.d.ts| +|废弃版本有变化|类名:StationInfo<br>废弃版本:N/A|类名:StationInfo<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.StationInfo |@ohos.wifi.d.ts| +|废弃版本有变化|类名:IpType<br>废弃版本:N/A|类名:IpType<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.IpType |@ohos.wifi.d.ts| +|废弃版本有变化|类名:SuppState<br>废弃版本:N/A|类名:SuppState<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.SuppState |@ohos.wifi.d.ts| +|废弃版本有变化|类名:ConnState<br>废弃版本:N/A|类名:ConnState<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.ConnState |@ohos.wifi.d.ts| +|废弃版本有变化|类名:WifiP2pDevice<br>废弃版本:N/A|类名:WifiP2pDevice<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.WifiP2pDevice |@ohos.wifi.d.ts| +|废弃版本有变化|类名:WifiP2PConfig<br>废弃版本:N/A|类名:WifiP2PConfig<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.WifiP2PConfig |@ohos.wifi.d.ts| +|废弃版本有变化|类名:WifiP2pGroupInfo<br>废弃版本:N/A|类名:WifiP2pGroupInfo<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.WifiP2pGroupInfo |@ohos.wifi.d.ts| +|废弃版本有变化|类名:P2pConnectState<br>废弃版本:N/A|类名:P2pConnectState<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.P2pConnectState |@ohos.wifi.d.ts| +|废弃版本有变化|类名:WifiP2pLinkedInfo<br>废弃版本:N/A|类名:WifiP2pLinkedInfo<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.WifiP2pLinkedInfo |@ohos.wifi.d.ts| +|废弃版本有变化|类名:P2pDeviceStatus<br>废弃版本:N/A|类名:P2pDeviceStatus<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.P2pDeviceStatus |@ohos.wifi.d.ts| +|废弃版本有变化|类名:GroupOwnerBand<br>废弃版本:N/A|类名:GroupOwnerBand<br>废弃版本:9<br>代替接口:ohos.wifiManager/wifiManager.GroupOwnerBand |@ohos.wifi.d.ts| +|废弃版本有变化|类名:wifiext<br>方法 or 属性:function enableHotspot(): boolean;<br>废弃版本:N/A|类名:wifiext<br>方法 or 属性:function enableHotspot(): boolean;<br>废弃版本:9<br>代替接口:ohos.wifiManagerExt/wifiManagerExt.enableHotspot |@ohos.wifiext.d.ts| +|废弃版本有变化|类名:wifiext<br>方法 or 属性:function disableHotspot(): boolean;<br>废弃版本:N/A|类名:wifiext<br>方法 or 属性:function disableHotspot(): boolean;<br>废弃版本:9<br>代替接口:ohos.wifiManagerExt/wifiManagerExt.disableHotspot |@ohos.wifiext.d.ts| +|废弃版本有变化|类名:wifiext<br>方法 or 属性:function getSupportedPowerModel(): Promise\<Array\<PowerModel>>;<br>废弃版本:N/A|类名:wifiext<br>方法 or 属性:function getSupportedPowerModel(): Promise\<Array\<PowerModel>>;<br>废弃版本:9<br>代替接口:ohos.wifiManagerExt/wifiManagerExt.getSupportedPowerMode |@ohos.wifiext.d.ts| +|废弃版本有变化|类名:wifiext<br>方法 or 属性:function getSupportedPowerModel(callback: AsyncCallback\<Array\<PowerModel>>): void;<br>废弃版本:N/A|类名:wifiext<br>方法 or 属性:function getSupportedPowerModel(callback: AsyncCallback\<Array\<PowerModel>>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManagerExt/wifiManagerExt.getSupportedPowerMode |@ohos.wifiext.d.ts| +|废弃版本有变化|类名:wifiext<br>方法 or 属性:function getPowerModel (): Promise\<PowerModel>;<br>废弃版本:N/A|类名:wifiext<br>方法 or 属性:function getPowerModel (): Promise\<PowerModel>;<br>废弃版本:9<br>代替接口:ohos.wifiManagerExt/wifiManagerExt.getPowerMode |@ohos.wifiext.d.ts| +|废弃版本有变化|类名:wifiext<br>方法 or 属性:function getPowerModel (callback: AsyncCallback\<PowerModel>): void;<br>废弃版本:N/A|类名:wifiext<br>方法 or 属性:function getPowerModel (callback: AsyncCallback\<PowerModel>): void;<br>废弃版本:9<br>代替接口:ohos.wifiManagerExt/wifiManagerExt.getPowerMode |@ohos.wifiext.d.ts| +|废弃版本有变化|类名:wifiext<br>方法 or 属性:function setPowerModel(model: PowerModel) : boolean<br>废弃版本:N/A|类名:wifiext<br>方法 or 属性:function setPowerModel(model: PowerModel) : boolean<br>废弃版本:9<br>代替接口:ohos.wifiManagerExt/wifiManagerExt.setPowerMode |@ohos.wifiext.d.ts| +|废弃版本有变化|类名:PowerModel<br>废弃版本:N/A|类名:PowerModel<br>废弃版本:9<br>代替接口:ohos.wifiManagerExt/wifiManagerExt.PowerMode |@ohos.wifiext.d.ts| +|废弃版本有变化|类名:TagSession<br>方法 or 属性:getTagInfo(): tag.TagInfo;<br>废弃版本:N/A|类名:TagSession<br>方法 or 属性:getTagInfo(): tag.TagInfo;<br>废弃版本:9<br>代替接口:ohos.nfc.tag/tag|tagSession.d.ts| +|废弃版本有变化|类名:TagSession<br>方法 or 属性:connectTag(): boolean;<br>废弃版本:N/A|类名:TagSession<br>方法 or 属性:connectTag(): boolean;<br>废弃版本:9<br>代替接口:tagSession.TagSession|tagSession.d.ts| +|废弃版本有变化|类名:TagSession<br>方法 or 属性:reset(): void;<br>废弃版本:N/A|类名:TagSession<br>方法 or 属性:reset(): void;<br>废弃版本:9<br>代替接口:tagSession.TagSession|tagSession.d.ts| +|废弃版本有变化|类名:TagSession<br>方法 or 属性:isTagConnected(): boolean;<br>废弃版本:N/A|类名:TagSession<br>方法 or 属性:isTagConnected(): boolean;<br>废弃版本:9<br>代替接口:tagSession.TagSession|tagSession.d.ts| +|废弃版本有变化|类名:TagSession<br>方法 or 属性:setSendDataTimeout(timeout: number): boolean;<br>废弃版本:N/A|类名:TagSession<br>方法 or 属性:setSendDataTimeout(timeout: number): boolean;<br>废弃版本:9<br>代替接口:tagSession.TagSession|tagSession.d.ts| +|废弃版本有变化|类名:TagSession<br>方法 or 属性:getSendDataTimeout(): number;<br>废弃版本:N/A|类名:TagSession<br>方法 or 属性:getSendDataTimeout(): number;<br>废弃版本:9<br>代替接口:tagSession.TagSession|tagSession.d.ts| +|废弃版本有变化|类名:TagSession<br>方法 or 属性:sendData(data: number[]): Promise\<number[]>;<br>废弃版本:N/A|类名:TagSession<br>方法 or 属性:sendData(data: number[]): Promise\<number[]>;<br>废弃版本:9<br>代替接口:tagSession.TagSession|tagSession.d.ts| +|废弃版本有变化|类名:TagSession<br>方法 or 属性:sendData(data: number[], callback: AsyncCallback\<number[]>): void;<br>废弃版本:N/A|类名:TagSession<br>方法 or 属性:sendData(data: number[], callback: AsyncCallback\<number[]>): void;<br>废弃版本:9<br>代替接口:tagSession.TagSession|tagSession.d.ts| +|废弃版本有变化|类名:TagSession<br>方法 or 属性:getMaxSendLength(): number;<br>废弃版本:N/A|类名:TagSession<br>方法 or 属性:getMaxSendLength(): number;<br>废弃版本:9<br>代替接口:tagSession.TagSession|tagSession.d.ts| +|起始版本有变化|类名:A2dpSourceProfile<br>方法 or 属性:getPlayingState(device: string): PlayingState;<br>起始版本:N/A|类名:A2dpSourceProfile<br>方法 or 属性:getPlayingState(device: string): PlayingState;<br>起始版本:8|@ohos.bluetooth.d.ts| +|起始版本有变化|类名:ScanFilter<br>起始版本:7|类名:ScanFilter<br>起始版本:N/A|@ohos.bluetooth.d.ts| +|起始版本有变化|类名:ScanFilter<br>方法 or 属性:deviceId?: string;<br>起始版本:N/A|类名:ScanFilter<br>方法 or 属性:deviceId?: string;<br>起始版本:7|@ohos.bluetooth.d.ts| +|起始版本有变化|类名:ScanFilter<br>方法 or 属性:name?: string;<br>起始版本:N/A|类名:ScanFilter<br>方法 or 属性:name?: string;<br>起始版本:7|@ohos.bluetooth.d.ts| +|起始版本有变化|类名:ScanFilter<br>方法 or 属性:serviceUuid?: string;<br>起始版本:N/A|类名:ScanFilter<br>方法 or 属性:serviceUuid?: string;<br>起始版本:7|@ohos.bluetooth.d.ts| +|起始版本有变化|类名:ProfileId<br>起始版本:8|类名:ProfileId<br>起始版本:N/A|@ohos.bluetooth.d.ts| +|起始版本有变化|类名:ProfileId<br>方法 or 属性:PROFILE_A2DP_SOURCE = 1<br>起始版本:N/A|类名:ProfileId<br>方法 or 属性:PROFILE_A2DP_SOURCE = 1<br>起始版本:8|@ohos.bluetooth.d.ts| +|起始版本有变化|类名:ProfileId<br>方法 or 属性:PROFILE_HANDS_FREE_AUDIO_GATEWAY = 4<br>起始版本:N/A|类名:ProfileId<br>方法 or 属性:PROFILE_HANDS_FREE_AUDIO_GATEWAY = 4<br>起始版本:8|@ohos.bluetooth.d.ts| +|起始版本有变化|类名:FeatureType<br>起始版本:N/A|类名:FeatureType<br>起始版本:6|@ohos.nfc.cardEmulation.d.ts| +|起始版本有变化|类名:TagInfo<br>方法 or 属性:supportedProfiles: number[];<br>起始版本:N/A|类名:TagInfo<br>方法 or 属性:supportedProfiles: number[];<br>起始版本:7|@ohos.nfc.tag.d.ts| +|权限有变化|类名:bluetooth<br>方法 or 属性:function startBluetoothDiscovery(): boolean;<br>权限:ohos.permission.LOCATION|类名:bluetooth<br>方法 or 属性:function startBluetoothDiscovery(): boolean;<br>权限:ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.LOCATION|@ohos.bluetooth.d.ts| +|权限有变化|类名:A2dpSourceProfile<br>方法 or 属性:connect(device: string): boolean;<br>权限:permission ohos.permission.DISCOVER_BLUETOOTH|类名:A2dpSourceProfile<br>方法 or 属性:connect(device: string): boolean;<br>权限:ohos.permission.DISCOVER_BLUETOOTH|@ohos.bluetooth.d.ts| +|权限有变化|类名:A2dpSourceProfile<br>方法 or 属性:disconnect(device: string): boolean;<br>权限:permission ohos.permission.DISCOVER_BLUETOOTH|类名:A2dpSourceProfile<br>方法 or 属性:disconnect(device: string): boolean;<br>权限:ohos.permission.DISCOVER_BLUETOOTH|@ohos.bluetooth.d.ts| +|权限有变化|类名:HandsFreeAudioGatewayProfile<br>方法 or 属性:connect(device: string): boolean;<br>权限:permission ohos.permission.DISCOVER_BLUETOOTH|类名:HandsFreeAudioGatewayProfile<br>方法 or 属性:connect(device: string): boolean;<br>权限:ohos.permission.DISCOVER_BLUETOOTH|@ohos.bluetooth.d.ts| +|权限有变化|类名:HandsFreeAudioGatewayProfile<br>方法 or 属性:disconnect(device: string): boolean;<br>权限:permission ohos.permission.DISCOVER_BLUETOOTH|类名:HandsFreeAudioGatewayProfile<br>方法 or 属性:disconnect(device: string): boolean;<br>权限:ohos.permission.DISCOVER_BLUETOOTH|@ohos.bluetooth.d.ts| +|权限有变化|类名:BLE<br>方法 or 属性:function startBLEScan(filters: Array\<ScanFilter>, options?: ScanOptions): void;<br>权限:ohos.permission.LOCATION|类名:BLE<br>方法 or 属性:function startBLEScan(filters: Array\<ScanFilter>, options?: ScanOptions): void;<br>权限:ohos.permission.DISCOVER_BLUETOOTH and ohos.permission.MANAGE_BLUETOOTH and ohos.permission.LOCATION|@ohos.bluetooth.d.ts| +|权限有变化|类名:connectedTag<br>方法 or 属性:function init(): boolean;<br>权限:s ohos.permission.NFC_TAG|类名:connectedTag<br>方法 or 属性:function init(): boolean;<br>权限:ohos.permission.NFC_TAG|@ohos.connectedTag.d.ts| +|权限有变化|类名:connectedTag<br>方法 or 属性:function uninit(): boolean;<br>权限:s ohos.permission.NFC_TAG|类名:connectedTag<br>方法 or 属性:function uninit(): boolean;<br>权限:ohos.permission.NFC_TAG|@ohos.connectedTag.d.ts| +|权限有变化|类名:connectedTag<br>方法 or 属性:function readNdefTag(): Promise\<string>;<br>权限:s ohos.permission.NFC_TAG|类名:connectedTag<br>方法 or 属性:function readNdefTag(): Promise\<string>;<br>权限:ohos.permission.NFC_TAG|@ohos.connectedTag.d.ts| +|权限有变化|类名:connectedTag<br>方法 or 属性:function readNdefTag(callback: AsyncCallback\<string>): void;<br>权限:s ohos.permission.NFC_TAG|类名:connectedTag<br>方法 or 属性:function readNdefTag(callback: AsyncCallback\<string>): void;<br>权限:ohos.permission.NFC_TAG|@ohos.connectedTag.d.ts| +|权限有变化|类名:connectedTag<br>方法 or 属性:function writeNdefTag(data: string): Promise\<void>;<br>权限:s ohos.permission.NFC_TAG|类名:connectedTag<br>方法 or 属性:function writeNdefTag(data: string): Promise\<void>;<br>权限:ohos.permission.NFC_TAG|@ohos.connectedTag.d.ts| +|权限有变化|类名:connectedTag<br>方法 or 属性:function writeNdefTag(data: string, callback: AsyncCallback\<void>): void;<br>权限:s ohos.permission.NFC_TAG|类名:connectedTag<br>方法 or 属性:function writeNdefTag(data: string, callback: AsyncCallback\<void>): void;<br>权限:ohos.permission.NFC_TAG|@ohos.connectedTag.d.ts| +|权限有变化|类名:connectedTag<br>方法 or 属性:function on(type: "notify", callback: Callback\<number>): void;<br>权限:s ohos.permission.NFC_TAG|类名:connectedTag<br>方法 or 属性:function on(type: "notify", callback: Callback\<number>): void;<br>权限:ohos.permission.NFC_TAG|@ohos.connectedTag.d.ts| +|权限有变化|类名:connectedTag<br>方法 or 属性:function off(type: "notify", callback?:Callback\<number>): void;<br>权限:s ohos.permission.NFC_TAG|类名:connectedTag<br>方法 or 属性:function off(type: "notify", callback?:Callback\<number>): void;<br>权限:ohos.permission.NFC_TAG|@ohos.connectedTag.d.ts| +|权限有变化|类名:connection<br>方法 or 属性:function getAddressesByName(host: string, callback: AsyncCallback\<Array\<NetAddress>>): void;<br>权限:ohos.permission.GET_NETWORK_INFO|类名:connection<br>方法 or 属性:function getAddressesByName(host: string, callback: AsyncCallback\<Array\<NetAddress>>): void;<br>权限:ohos.permission.INTERNET|@ohos.net.connection.d.ts| +|权限有变化|类名:connection<br>方法 or 属性:function getAddressesByName(host: string): Promise\<Array\<NetAddress>>;<br>权限:ohos.permission.GET_NETWORK_INFO|类名:connection<br>方法 or 属性:function getAddressesByName(host: string): Promise\<Array\<NetAddress>>;<br>权限:ohos.permission.INTERNET|@ohos.net.connection.d.ts| +|权限有变化|类名:NetHandle<br>方法 or 属性:getAddressesByName(host: string, callback: AsyncCallback\<Array\<NetAddress>>): void;<br>权限:ohos.permission.GET_NETWORK_INFO|类名:NetHandle<br>方法 or 属性:getAddressesByName(host: string, callback: AsyncCallback\<Array\<NetAddress>>): void;<br>权限:ohos.permission.INTERNET|@ohos.net.connection.d.ts| +|权限有变化|类名:NetHandle<br>方法 or 属性:getAddressesByName(host: string): Promise\<Array\<NetAddress>>;<br>权限:ohos.permission.GET_NETWORK_INFO|类名:NetHandle<br>方法 or 属性:getAddressesByName(host: string): Promise\<Array\<NetAddress>>;<br>权限:ohos.permission.INTERNET|@ohos.net.connection.d.ts| +|权限有变化|类名:NetHandle<br>方法 or 属性:getAddressByName(host: string, callback: AsyncCallback\<NetAddress>): void;<br>权限:ohos.permission.GET_NETWORK_INFO|类名:NetHandle<br>方法 or 属性:getAddressByName(host: string, callback: AsyncCallback\<NetAddress>): void;<br>权限:ohos.permission.INTERNET|@ohos.net.connection.d.ts| +|权限有变化|类名:NetHandle<br>方法 or 属性:getAddressByName(host: string): Promise\<NetAddress>;<br>权限:ohos.permission.GET_NETWORK_INFO|类名:NetHandle<br>方法 or 属性:getAddressByName(host: string): Promise\<NetAddress>;<br>权限:ohos.permission.INTERNET|@ohos.net.connection.d.ts| +|删除(权限)|类名:tag<br>方法 or 属性:function getNfcATag(tagInfo: TagInfo): NfcATag<br>权限:ohos.permission.NFC_TAG|类名:tag<br>方法 or 属性:function getNfcATag(tagInfo: TagInfo): NfcATag<br>权限:N/A|@ohos.nfc.tag.d.ts| +|删除(权限)|类名:tag<br>方法 or 属性:function getNfcBTag(tagInfo: TagInfo): NfcBTag<br>权限:ohos.permission.NFC_TAG|类名:tag<br>方法 or 属性:function getNfcBTag(tagInfo: TagInfo): NfcBTag<br>权限:N/A|@ohos.nfc.tag.d.ts| +|删除(权限)|类名:tag<br>方法 or 属性:function getNfcFTag(tagInfo: TagInfo): NfcFTag<br>权限:ohos.permission.NFC_TAG|类名:tag<br>方法 or 属性:function getNfcFTag(tagInfo: TagInfo): NfcFTag<br>权限:N/A|@ohos.nfc.tag.d.ts| +|删除(权限)|类名:tag<br>方法 or 属性:function getNfcVTag(tagInfo: TagInfo): NfcVTag<br>权限:ohos.permission.NFC_TAG|类名:tag<br>方法 or 属性:function getNfcVTag(tagInfo: TagInfo): NfcVTag<br>权限:N/A|@ohos.nfc.tag.d.ts| +|删除(权限)|类名:NfcATag<br>方法 or 属性:getSak(): number;<br>权限:ohos.permission.NFC_TAG|类名:NfcATag<br>方法 or 属性:getSak(): number;<br>权限:N/A|nfctech.d.ts| +|删除(权限)|类名:NfcATag<br>方法 or 属性:getAtqa(): number[];<br>权限:ohos.permission.NFC_TAG|类名:NfcATag<br>方法 or 属性:getAtqa(): number[];<br>权限:N/A|nfctech.d.ts| +|删除(权限)|类名:NfcBTag<br>方法 or 属性:getRespAppData(): number[];<br>权限:ohos.permission.NFC_TAG|类名:NfcBTag<br>方法 or 属性:getRespAppData(): number[];<br>权限:N/A|nfctech.d.ts| +|删除(权限)|类名:NfcBTag<br>方法 or 属性:getRespProtocol(): number[];<br>权限:ohos.permission.NFC_TAG|类名:NfcBTag<br>方法 or 属性:getRespProtocol(): number[];<br>权限:N/A|nfctech.d.ts| +|删除(权限)|类名:NfcFTag<br>方法 or 属性:getSystemCode(): number[];<br>权限:ohos.permission.NFC_TAG|类名:NfcFTag<br>方法 or 属性:getSystemCode(): number[];<br>权限:N/A|nfctech.d.ts| +|删除(权限)|类名:NfcFTag<br>方法 or 属性:getPmm(): number[];<br>权限:ohos.permission.NFC_TAG|类名:NfcFTag<br>方法 or 属性:getPmm(): number[];<br>权限:N/A|nfctech.d.ts| +|删除(权限)|类名:NfcVTag<br>方法 or 属性:getResponseFlags(): number;<br>权限:ohos.permission.NFC_TAG|类名:NfcVTag<br>方法 or 属性:getResponseFlags(): number;<br>权限:N/A|nfctech.d.ts| +|删除(权限)|类名:NfcVTag<br>方法 or 属性:getDsfId(): number;<br>权限:ohos.permission.NFC_TAG|类名:NfcVTag<br>方法 or 属性:getDsfId(): number;<br>权限:N/A|nfctech.d.ts| +|删除(权限)|类名:TagSession<br>方法 or 属性:isTagConnected(): boolean;<br>权限:ohos.permission.NFC_TAG|类名:TagSession<br>方法 or 属性:isTagConnected(): boolean;<br>权限:N/A|tagSession.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function getDefaultNet(callback: AsyncCallback\<NetHandle>): void;<br>错误码内容: 201, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function getDefaultNet(): Promise\<NetHandle>;<br>错误码内容: 201, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function getAllNets(callback: AsyncCallback\<Array\<NetHandle>>): void;<br>错误码内容: 201, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function getAllNets(): Promise\<Array\<NetHandle>>;<br>错误码内容: 201, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function getConnectionProperties(netHandle: NetHandle, callback: AsyncCallback\<ConnectionProperties>): void;<br>错误码内容: 201, 401, 2100001, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function getConnectionProperties(netHandle: NetHandle): Promise\<ConnectionProperties>;<br>错误码内容: 201, 401, 2100001, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function getNetCapabilities(netHandle: NetHandle, callback: AsyncCallback\<NetCapabilities>): void;<br>错误码内容: 201, 401, 2100001, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function getNetCapabilities(netHandle: NetHandle): Promise\<NetCapabilities>;<br>错误码内容: 201, 401, 2100001, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function hasDefaultNet(callback: AsyncCallback\<boolean>): void;<br>错误码内容: 201, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function hasDefaultNet(): Promise\<boolean>;<br>错误码内容: 201, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function enableAirplaneMode(callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function enableAirplaneMode(): Promise\<void>;<br>错误码内容: 201, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function disableAirplaneMode(callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function disableAirplaneMode(): Promise\<void>;<br>错误码内容: 201, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function reportNetConnected(netHandle: NetHandle, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 2100001, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function reportNetConnected(netHandle: NetHandle): Promise\<void>;<br>错误码内容: 201, 401, 2100001, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function reportNetDisconnected(netHandle: NetHandle, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 2100001, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function reportNetDisconnected(netHandle: NetHandle): Promise\<void>;<br>错误码内容: 201, 401, 2100001, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function getAddressesByName(host: string, callback: AsyncCallback\<Array\<NetAddress>>): void;<br>错误码内容: 201, 401, 2100001, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:connection<br>方法 or 属性:function getAddressesByName(host: string): Promise\<Array\<NetAddress>>;<br>错误码内容: 201, 401, 2100001, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:NetConnection<br>方法 or 属性:register(callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 2100002, 2100003, 2101008, 2101022|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:NetConnection<br>方法 or 属性:unregister(callback: AsyncCallback\<void>): void;<br>错误码内容: 2100002, 2100003, 2101007|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:NetHandle<br>方法 or 属性:getAddressesByName(host: string, callback: AsyncCallback\<Array\<NetAddress>>): void;<br>错误码内容: 201, 401, 2100001, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:NetHandle<br>方法 or 属性:getAddressesByName(host: string): Promise\<Array\<NetAddress>>;<br>错误码内容: 201, 401, 2100001, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:NetHandle<br>方法 or 属性:getAddressByName(host: string, callback: AsyncCallback\<NetAddress>): void;<br>错误码内容: 201, 401, 2100001, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:NetHandle<br>方法 or 属性:getAddressByName(host: string): Promise\<NetAddress>;<br>错误码内容: 201, 401, 2100001, 2100002, 2100003|@ohos.net.connection.d.ts| +|新增(错误码)|NA|类名:HttpRequest<br>方法 or 属性:request(url: string, callback: AsyncCallback\<HttpResponse>): void;<br>错误码内容: 401, 201, 2300001, 2300003, 2300005, 2300006, 2300007, 2300008, 2300009, 2300016, 2300018, 2300023, 2300025, 2300026, 2300027, 2300028, 2300047, 2300052, 2300055, 2300056, 2300058, 2300059, 2300060, 2300061, 2300063, 2300070, 2300073, 2300077, 2300078, 2300094, 2300999|@ohos.net.http.d.ts| +|新增(错误码)|NA|类名:HttpRequest<br>方法 or 属性:request(url: string, options: HttpRequestOptions, callback: AsyncCallback\<HttpResponse>): void;<br>错误码内容: 401, 201, 2300001, 2300003, 2300005, 2300006, 2300007, 2300008, 2300009, 2300016, 2300018, 2300023, 2300025, 2300026, 2300027, 2300028, 2300047, 2300052, 2300055, 2300056, 2300058, 2300059, 2300060, 2300061, 2300063, 2300070, 2300073, 2300077, 2300078, 2300094, 2300999|@ohos.net.http.d.ts| +|新增(错误码)|NA|类名:HttpRequest<br>方法 or 属性:request(url: string, options?: HttpRequestOptions): Promise\<HttpResponse>;<br>错误码内容: 401, 201, 2300001, 2300003, 2300005, 2300006, 2300007, 2300008, 2300009, 2300016, 2300018, 2300023, 2300025, 2300026, 2300027, 2300028, 2300047, 2300052, 2300055, 2300056, 2300058, 2300059, 2300060, 2300061, 2300063, 2300070, 2300073, 2300077, 2300078, 2300094, 2300999|@ohos.net.http.d.ts| +|新增(错误码)|NA|类名:UDPSocket<br>方法 or 属性:bind(address: NetAddress, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:UDPSocket<br>方法 or 属性:bind(address: NetAddress): Promise\<void>;<br>错误码内容: 401, 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:UDPSocket<br>方法 or 属性:send(options: UDPSendOptions, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:UDPSocket<br>方法 or 属性:send(options: UDPSendOptions): Promise\<void>;<br>错误码内容: 401, 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:UDPSocket<br>方法 or 属性:close(callback: AsyncCallback\<void>): void;<br>错误码内容: 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:UDPSocket<br>方法 or 属性:close(): Promise\<void>;<br>错误码内容: 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:UDPSocket<br>方法 or 属性:getState(callback: AsyncCallback\<SocketStateBase>): void;<br>错误码内容: 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:UDPSocket<br>方法 or 属性:getState(): Promise\<SocketStateBase>;<br>错误码内容: 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:UDPSocket<br>方法 or 属性:setExtraOptions(options: UDPExtraOptions, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:UDPSocket<br>方法 or 属性:setExtraOptions(options: UDPExtraOptions): Promise\<void>;<br>错误码内容: 401, 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:TCPSocket<br>方法 or 属性:bind(address: NetAddress, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:TCPSocket<br>方法 or 属性:bind(address: NetAddress): Promise\<void>;<br>错误码内容: 401, 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:TCPSocket<br>方法 or 属性:connect(options: TCPConnectOptions, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:TCPSocket<br>方法 or 属性:connect(options: TCPConnectOptions): Promise\<void>;<br>错误码内容: 401, 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:TCPSocket<br>方法 or 属性:send(options: TCPSendOptions, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:TCPSocket<br>方法 or 属性:send(options: TCPSendOptions): Promise\<void>;<br>错误码内容: 401, 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:TCPSocket<br>方法 or 属性:close(callback: AsyncCallback\<void>): void;<br>错误码内容: 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:TCPSocket<br>方法 or 属性:close(): Promise\<void>;<br>错误码内容: 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:TCPSocket<br>方法 or 属性:getRemoteAddress(callback: AsyncCallback\<NetAddress>): void;<br>错误码内容: 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:TCPSocket<br>方法 or 属性:getRemoteAddress(): Promise\<NetAddress>;<br>错误码内容: 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:TCPSocket<br>方法 or 属性:getState(callback: AsyncCallback\<SocketStateBase>): void;<br>错误码内容: 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:TCPSocket<br>方法 or 属性:getState(): Promise\<SocketStateBase>;<br>错误码内容: 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:TCPSocket<br>方法 or 属性:setExtraOptions(options: TCPExtraOptions, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:TCPSocket<br>方法 or 属性:setExtraOptions(options: TCPExtraOptions): Promise\<void>;<br>错误码内容: 401, 201|@ohos.net.socket.d.ts| +|新增(错误码)|NA|类名:WebSocket<br>方法 or 属性:connect(url: string, callback: AsyncCallback\<boolean>): void;<br>错误码内容: 401, 201|@ohos.net.webSocket.d.ts| +|新增(错误码)|NA|类名:WebSocket<br>方法 or 属性:connect(url: string, options: WebSocketRequestOptions, callback: AsyncCallback\<boolean>): void;<br>错误码内容: 401, 201|@ohos.net.webSocket.d.ts| +|新增(错误码)|NA|类名:WebSocket<br>方法 or 属性:connect(url: string, options?: WebSocketRequestOptions): Promise\<boolean>;<br>错误码内容: 401, 201|@ohos.net.webSocket.d.ts| +|新增(错误码)|NA|类名:WebSocket<br>方法 or 属性:send(data: string \| ArrayBuffer, callback: AsyncCallback\<boolean>): void;<br>错误码内容: 401, 201|@ohos.net.webSocket.d.ts| +|新增(错误码)|NA|类名:WebSocket<br>方法 or 属性:send(data: string \| ArrayBuffer): Promise\<boolean>;<br>错误码内容: 401, 201|@ohos.net.webSocket.d.ts| +|新增(错误码)|NA|类名:WebSocket<br>方法 or 属性:close(callback: AsyncCallback\<boolean>): void;<br>错误码内容: 401, 201|@ohos.net.webSocket.d.ts| +|新增(错误码)|NA|类名:WebSocket<br>方法 or 属性:close(options: WebSocketCloseOptions, callback: AsyncCallback\<boolean>): void;<br>错误码内容: 401, 201|@ohos.net.webSocket.d.ts| +|新增(错误码)|NA|类名:WebSocket<br>方法 or 属性:close(options?: WebSocketCloseOptions): Promise\<boolean>;<br>错误码内容: 401, 201|@ohos.net.webSocket.d.ts| +|新增(权限)|类名:connection<br>方法 or 属性:function hasDefaultNet(callback: AsyncCallback\<boolean>): void;<br>权限:N/A|类名:connection<br>方法 or 属性:function hasDefaultNet(callback: AsyncCallback\<boolean>): void;<br>权限:ohos.permission.GET_NETWORK_INFO|@ohos.net.connection.d.ts| +|新增(权限)|类名:connection<br>方法 or 属性:function hasDefaultNet(): Promise\<boolean>;<br>权限:N/A|类名:connection<br>方法 or 属性:function hasDefaultNet(): Promise\<boolean>;<br>权限:ohos.permission.GET_NETWORK_INFO|@ohos.net.connection.d.ts| +|新增(权限)|类名:connection<br>方法 or 属性:function enableAirplaneMode(callback: AsyncCallback\<void>): void;<br>权限:N/A|类名:connection<br>方法 or 属性:function enableAirplaneMode(callback: AsyncCallback\<void>): void;<br>权限:ohos.permission.CONNECTIVITY_INTERNAL|@ohos.net.connection.d.ts| +|新增(权限)|类名:connection<br>方法 or 属性:function enableAirplaneMode(): Promise\<void>;<br>权限:N/A|类名:connection<br>方法 or 属性:function enableAirplaneMode(): Promise\<void>;<br>权限:ohos.permission.CONNECTIVITY_INTERNAL|@ohos.net.connection.d.ts| +|新增(权限)|类名:connection<br>方法 or 属性:function disableAirplaneMode(callback: AsyncCallback\<void>): void;<br>权限:N/A|类名:connection<br>方法 or 属性:function disableAirplaneMode(callback: AsyncCallback\<void>): void;<br>权限:ohos.permission.CONNECTIVITY_INTERNAL|@ohos.net.connection.d.ts| +|新增(权限)|类名:connection<br>方法 or 属性:function disableAirplaneMode(): Promise\<void>;<br>权限:N/A|类名:connection<br>方法 or 属性:function disableAirplaneMode(): Promise\<void>;<br>权限:ohos.permission.CONNECTIVITY_INTERNAL|@ohos.net.connection.d.ts| +|SysCap有变化|类名:cardEmulation<br>SysCap:SystemCapability.Communication.NFC.Core|类名:cardEmulation<br>SysCap:SystemCapability.Communication.NFC.CardEmulation|@ohos.nfc.cardEmulation.d.ts| +|SysCap有变化|类名:FeatureType<br>SysCap:SystemCapability.Communication.NFC.Core|类名:FeatureType<br>SysCap:SystemCapability.Communication.NFC.CardEmulation|@ohos.nfc.cardEmulation.d.ts| +|SysCap有变化|类名:FeatureType<br>方法 or 属性:HCE = 0<br>SysCap:SystemCapability.Communication.NFC.Core|类名:FeatureType<br>方法 or 属性:HCE = 0<br>SysCap:SystemCapability.Communication.NFC.CardEmulation|@ohos.nfc.cardEmulation.d.ts| +|SysCap有变化|类名:FeatureType<br>方法 or 属性:UICC = 1<br>SysCap:SystemCapability.Communication.NFC.Core|类名:FeatureType<br>方法 or 属性:UICC = 1<br>SysCap:SystemCapability.Communication.NFC.CardEmulation|@ohos.nfc.cardEmulation.d.ts| +|SysCap有变化|类名:FeatureType<br>方法 or 属性:ESE = 2<br>SysCap:SystemCapability.Communication.NFC.Core|类名:FeatureType<br>方法 or 属性:ESE = 2<br>SysCap:SystemCapability.Communication.NFC.CardEmulation|@ohos.nfc.cardEmulation.d.ts| +|SysCap有变化|类名:cardEmulation<br>方法 or 属性:function isSupported(feature: number): boolean;<br>SysCap:SystemCapability.Communication.NFC.Core|类名:cardEmulation<br>方法 or 属性:function isSupported(feature: number): boolean;<br>SysCap:SystemCapability.Communication.NFC.CardEmulation|@ohos.nfc.cardEmulation.d.ts| +|SysCap有变化|类名:HceService<br>SysCap:SystemCapability.Communication.NFC.Core|类名:HceService<br>SysCap:SystemCapability.Communication.NFC.CardEmulation|@ohos.nfc.cardEmulation.d.ts| +|SysCap有变化|类名:HceService<br>方法 or 属性:startHCE(aidList: string[]): boolean;<br>SysCap:SystemCapability.Communication.NFC.Core|类名:HceService<br>方法 or 属性:startHCE(aidList: string[]): boolean;<br>SysCap:SystemCapability.Communication.NFC.CardEmulation|@ohos.nfc.cardEmulation.d.ts| +|SysCap有变化|类名:HceService<br>方法 or 属性:stopHCE(): boolean;<br>SysCap:SystemCapability.Communication.NFC.Core|类名:HceService<br>方法 or 属性:stopHCE(): boolean;<br>SysCap:SystemCapability.Communication.NFC.CardEmulation|@ohos.nfc.cardEmulation.d.ts| +|SysCap有变化|类名:HceService<br>方法 or 属性:on(type: "hceCmd", callback: AsyncCallback\<number[]>): void;<br>SysCap:SystemCapability.Communication.NFC.Core|类名:HceService<br>方法 or 属性:on(type: "hceCmd", callback: AsyncCallback\<number[]>): void;<br>SysCap:SystemCapability.Communication.NFC.CardEmulation|@ohos.nfc.cardEmulation.d.ts| +|SysCap有变化|类名:HceService<br>方法 or 属性:sendResponse(responseApdu: number[]): void;<br>SysCap:SystemCapability.Communication.NFC.Core|类名:HceService<br>方法 or 属性:sendResponse(responseApdu: number[]): void;<br>SysCap:SystemCapability.Communication.NFC.CardEmulation|@ohos.nfc.cardEmulation.d.ts| +|SysCap有变化|类名:tag<br>SysCap:SystemCapability.Communication.NFC.Core|类名:tag<br>SysCap:SystemCapability.Communication.NFC.Tag|@ohos.nfc.tag.d.ts| +|SysCap有变化|类名:tag<br>方法 or 属性:const NFC_A = 1;<br>SysCap:SystemCapability.Communication.NFC.Core|类名:tag<br>方法 or 属性:const NFC_A = 1;<br>SysCap:SystemCapability.Communication.NFC.Tag|@ohos.nfc.tag.d.ts| +|SysCap有变化|类名:tag<br>方法 or 属性:const NFC_B = 2;<br>SysCap:SystemCapability.Communication.NFC.Core|类名:tag<br>方法 or 属性:const NFC_B = 2;<br>SysCap:SystemCapability.Communication.NFC.Tag|@ohos.nfc.tag.d.ts| +|SysCap有变化|类名:tag<br>方法 or 属性:const ISO_DEP = 3;<br>SysCap:SystemCapability.Communication.NFC.Core|类名:tag<br>方法 or 属性:const ISO_DEP = 3;<br>SysCap:SystemCapability.Communication.NFC.Tag|@ohos.nfc.tag.d.ts| +|SysCap有变化|类名:tag<br>方法 or 属性:const NFC_F = 4;<br>SysCap:SystemCapability.Communication.NFC.Core|类名:tag<br>方法 or 属性:const NFC_F = 4;<br>SysCap:SystemCapability.Communication.NFC.Tag|@ohos.nfc.tag.d.ts| +|SysCap有变化|类名:tag<br>方法 or 属性:const NFC_V = 5;<br>SysCap:SystemCapability.Communication.NFC.Core|类名:tag<br>方法 or 属性:const NFC_V = 5;<br>SysCap:SystemCapability.Communication.NFC.Tag|@ohos.nfc.tag.d.ts| +|SysCap有变化|类名:tag<br>方法 or 属性:const NDEF = 6;<br>SysCap:SystemCapability.Communication.NFC.Core|类名:tag<br>方法 or 属性:const NDEF = 6;<br>SysCap:SystemCapability.Communication.NFC.Tag|@ohos.nfc.tag.d.ts| +|SysCap有变化|类名:tag<br>方法 or 属性:const MIFARE_CLASSIC = 8;<br>SysCap:SystemCapability.Communication.NFC.Core|类名:tag<br>方法 or 属性:const MIFARE_CLASSIC = 8;<br>SysCap:SystemCapability.Communication.NFC.Tag|@ohos.nfc.tag.d.ts| +|SysCap有变化|类名:tag<br>方法 or 属性:const MIFARE_ULTRALIGHT = 9;<br>SysCap:SystemCapability.Communication.NFC.Core|类名:tag<br>方法 or 属性:const MIFARE_ULTRALIGHT = 9;<br>SysCap:SystemCapability.Communication.NFC.Tag|@ohos.nfc.tag.d.ts| +|SysCap有变化|类名:tag<br>方法 or 属性:function getNfcATag(tagInfo: TagInfo): NfcATag<br>SysCap:SystemCapability.Communication.NFC.Core|类名:tag<br>方法 or 属性:function getNfcATag(tagInfo: TagInfo): NfcATag<br>SysCap:SystemCapability.Communication.NFC.Tag|@ohos.nfc.tag.d.ts| +|SysCap有变化|类名:tag<br>方法 or 属性:function getNfcBTag(tagInfo: TagInfo): NfcBTag<br>SysCap:SystemCapability.Communication.NFC.Core|类名:tag<br>方法 or 属性:function getNfcBTag(tagInfo: TagInfo): NfcBTag<br>SysCap:SystemCapability.Communication.NFC.Tag|@ohos.nfc.tag.d.ts| +|SysCap有变化|类名:tag<br>方法 or 属性:function getNfcFTag(tagInfo: TagInfo): NfcFTag<br>SysCap:SystemCapability.Communication.NFC.Core|类名:tag<br>方法 or 属性:function getNfcFTag(tagInfo: TagInfo): NfcFTag<br>SysCap:SystemCapability.Communication.NFC.Tag|@ohos.nfc.tag.d.ts| +|SysCap有变化|类名:tag<br>方法 or 属性:function getNfcVTag(tagInfo: TagInfo): NfcVTag<br>SysCap:SystemCapability.Communication.NFC.Core|类名:tag<br>方法 or 属性:function getNfcVTag(tagInfo: TagInfo): NfcVTag<br>SysCap:SystemCapability.Communication.NFC.Tag|@ohos.nfc.tag.d.ts| +|SysCap有变化|类名:TagInfo<br>SysCap:SystemCapability.Communication.NFC.Core|类名:TagInfo<br>SysCap:SystemCapability.Communication.NFC.Tag|@ohos.nfc.tag.d.ts| +|SysCap有变化|类名:TagInfo<br>方法 or 属性:supportedProfiles: number[];<br>SysCap:SystemCapability.Communication.NFC.Core|类名:TagInfo<br>方法 or 属性:supportedProfiles: number[];<br>SysCap:SystemCapability.Communication.NFC.Tag|@ohos.nfc.tag.d.ts| +|SysCap有变化|类名:NfcATag<br>SysCap:SystemCapability.Communication.NFC.Core|类名:NfcATag<br>SysCap:SystemCapability.Communication.NFC.Tag|nfctech.d.ts| +|SysCap有变化|类名:NfcATag<br>方法 or 属性:getSak(): number;<br>SysCap:SystemCapability.Communication.NFC.Core|类名:NfcATag<br>方法 or 属性:getSak(): number;<br>SysCap:SystemCapability.Communication.NFC.Tag|nfctech.d.ts| +|SysCap有变化|类名:NfcATag<br>方法 or 属性:getAtqa(): number[];<br>SysCap:SystemCapability.Communication.NFC.Core|类名:NfcATag<br>方法 or 属性:getAtqa(): number[];<br>SysCap:SystemCapability.Communication.NFC.Tag|nfctech.d.ts| +|SysCap有变化|类名:NfcBTag<br>SysCap:SystemCapability.Communication.NFC.Core|类名:NfcBTag<br>SysCap:SystemCapability.Communication.NFC.Tag|nfctech.d.ts| +|SysCap有变化|类名:NfcBTag<br>方法 or 属性:getRespAppData(): number[];<br>SysCap:SystemCapability.Communication.NFC.Core|类名:NfcBTag<br>方法 or 属性:getRespAppData(): number[];<br>SysCap:SystemCapability.Communication.NFC.Tag|nfctech.d.ts| +|SysCap有变化|类名:NfcBTag<br>方法 or 属性:getRespProtocol(): number[];<br>SysCap:SystemCapability.Communication.NFC.Core|类名:NfcBTag<br>方法 or 属性:getRespProtocol(): number[];<br>SysCap:SystemCapability.Communication.NFC.Tag|nfctech.d.ts| +|SysCap有变化|类名:NfcFTag<br>SysCap:SystemCapability.Communication.NFC.Core|类名:NfcFTag<br>SysCap:SystemCapability.Communication.NFC.Tag|nfctech.d.ts| +|SysCap有变化|类名:NfcFTag<br>方法 or 属性:getSystemCode(): number[];<br>SysCap:SystemCapability.Communication.NFC.Core|类名:NfcFTag<br>方法 or 属性:getSystemCode(): number[];<br>SysCap:SystemCapability.Communication.NFC.Tag|nfctech.d.ts| +|SysCap有变化|类名:NfcFTag<br>方法 or 属性:getPmm(): number[];<br>SysCap:SystemCapability.Communication.NFC.Core|类名:NfcFTag<br>方法 or 属性:getPmm(): number[];<br>SysCap:SystemCapability.Communication.NFC.Tag|nfctech.d.ts| +|SysCap有变化|类名:NfcVTag<br>SysCap:SystemCapability.Communication.NFC.Core|类名:NfcVTag<br>SysCap:SystemCapability.Communication.NFC.Tag|nfctech.d.ts| +|SysCap有变化|类名:NfcVTag<br>方法 or 属性:getResponseFlags(): number;<br>SysCap:SystemCapability.Communication.NFC.Core|类名:NfcVTag<br>方法 or 属性:getResponseFlags(): number;<br>SysCap:SystemCapability.Communication.NFC.Tag|nfctech.d.ts| +|SysCap有变化|类名:NfcVTag<br>方法 or 属性:getDsfId(): number;<br>SysCap:SystemCapability.Communication.NFC.Core|类名:NfcVTag<br>方法 or 属性:getDsfId(): number;<br>SysCap:SystemCapability.Communication.NFC.Tag|nfctech.d.ts| +|SysCap有变化|类名:TagSession<br>SysCap:SystemCapability.Communication.NFC.Core|类名:TagSession<br>SysCap:SystemCapability.Communication.NFC.Tag|tagSession.d.ts| +|SysCap有变化|类名:TagSession<br>方法 or 属性:getTagInfo(): tag.TagInfo;<br>SysCap:SystemCapability.Communication.NFC.Core|类名:TagSession<br>方法 or 属性:getTagInfo(): tag.TagInfo;<br>SysCap:SystemCapability.Communication.NFC.Tag|tagSession.d.ts| +|SysCap有变化|类名:TagSession<br>方法 or 属性:connectTag(): boolean;<br>SysCap:SystemCapability.Communication.NFC.Core|类名:TagSession<br>方法 or 属性:connectTag(): boolean;<br>SysCap:SystemCapability.Communication.NFC.Tag|tagSession.d.ts| +|SysCap有变化|类名:TagSession<br>方法 or 属性:reset(): void;<br>SysCap:SystemCapability.Communication.NFC.Core|类名:TagSession<br>方法 or 属性:reset(): void;<br>SysCap:SystemCapability.Communication.NFC.Tag|tagSession.d.ts| +|SysCap有变化|类名:TagSession<br>方法 or 属性:isTagConnected(): boolean;<br>SysCap:SystemCapability.Communication.NFC.Core|类名:TagSession<br>方法 or 属性:isTagConnected(): boolean;<br>SysCap:SystemCapability.Communication.NFC.Tag|tagSession.d.ts| +|SysCap有变化|类名:TagSession<br>方法 or 属性:setSendDataTimeout(timeout: number): boolean;<br>SysCap:SystemCapability.Communication.NFC.Core|类名:TagSession<br>方法 or 属性:setSendDataTimeout(timeout: number): boolean;<br>SysCap:SystemCapability.Communication.NFC.Tag|tagSession.d.ts| +|SysCap有变化|类名:TagSession<br>方法 or 属性:getSendDataTimeout(): number;<br>SysCap:SystemCapability.Communication.NFC.Core|类名:TagSession<br>方法 or 属性:getSendDataTimeout(): number;<br>SysCap:SystemCapability.Communication.NFC.Tag|tagSession.d.ts| +|SysCap有变化|类名:TagSession<br>方法 or 属性:sendData(data: number[]): Promise\<number[]>;<br>SysCap:SystemCapability.Communication.NFC.Core|类名:TagSession<br>方法 or 属性:sendData(data: number[]): Promise\<number[]>;<br>SysCap:SystemCapability.Communication.NFC.Tag|tagSession.d.ts| +|SysCap有变化|类名:TagSession<br>方法 or 属性:sendData(data: number[], callback: AsyncCallback\<number[]>): void;<br>SysCap:SystemCapability.Communication.NFC.Core|类名:TagSession<br>方法 or 属性:sendData(data: number[], callback: AsyncCallback\<number[]>): void;<br>SysCap:SystemCapability.Communication.NFC.Tag|tagSession.d.ts| +|SysCap有变化|类名:TagSession<br>方法 or 属性:getMaxSendLength(): number;<br>SysCap:SystemCapability.Communication.NFC.Core|类名:TagSession<br>方法 or 属性:getMaxSendLength(): number;<br>SysCap:SystemCapability.Communication.NFC.Tag|tagSession.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-compiler-and-runtime.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-compiler-and-runtime.md new file mode 100644 index 0000000000000000000000000000000000000000..ebd772be20e903af8a607064de118792c07b61c1 --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-compiler-and-runtime.md @@ -0,0 +1,687 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.buffer<br>类名: buffer|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: BufferEncoding<br>方法 or 属性: type BufferEncoding = 'ascii' \| 'utf8' \| 'utf-8' \| 'utf16le' \| 'ucs2' \| 'ucs-2' \| 'base64' \| 'base64url' \| 'latin1' \| 'binary' \| 'hex';|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: BufferEncoding<br>方法 or 属性: type BufferEncoding = 'ascii' \| 'utf8' \| 'utf-8' \| 'utf16le' \| 'ucs2' \| 'ucs-2' \| 'base64' \| 'base64url' \| 'latin1' \| 'binary' \| 'hex';|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: BufferEncoding<br>方法 or 属性: type BufferEncoding = 'ascii' \| 'utf8' \| 'utf-8' \| 'utf16le' \| 'ucs2' \| 'ucs-2' \| 'base64' \| 'base64url' \| 'latin1' \| 'binary' \| 'hex';|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: BufferEncoding<br>方法 or 属性: type BufferEncoding = 'ascii' \| 'utf8' \| 'utf-8' \| 'utf16le' \| 'ucs2' \| 'ucs-2' \| 'base64' \| 'base64url' \| 'latin1' \| 'binary' \| 'hex';|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: BufferEncoding<br>方法 or 属性: type BufferEncoding = 'ascii' \| 'utf8' \| 'utf-8' \| 'utf16le' \| 'ucs2' \| 'ucs-2' \| 'base64' \| 'base64url' \| 'latin1' \| 'binary' \| 'hex';|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: BufferEncoding<br>方法 or 属性: type BufferEncoding = 'ascii' \| 'utf8' \| 'utf-8' \| 'utf16le' \| 'ucs2' \| 'ucs-2' \| 'base64' \| 'base64url' \| 'latin1' \| 'binary' \| 'hex';|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: BufferEncoding<br>方法 or 属性: type BufferEncoding = 'ascii' \| 'utf8' \| 'utf-8' \| 'utf16le' \| 'ucs2' \| 'ucs-2' \| 'base64' \| 'base64url' \| 'latin1' \| 'binary' \| 'hex';|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: BufferEncoding<br>方法 or 属性: type BufferEncoding = 'ascii' \| 'utf8' \| 'utf-8' \| 'utf16le' \| 'ucs2' \| 'ucs-2' \| 'base64' \| 'base64url' \| 'latin1' \| 'binary' \| 'hex';|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: BufferEncoding<br>方法 or 属性: type BufferEncoding = 'ascii' \| 'utf8' \| 'utf-8' \| 'utf16le' \| 'ucs2' \| 'ucs-2' \| 'base64' \| 'base64url' \| 'latin1' \| 'binary' \| 'hex';|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: BufferEncoding<br>方法 or 属性: type BufferEncoding = 'ascii' \| 'utf8' \| 'utf-8' \| 'utf16le' \| 'ucs2' \| 'ucs-2' \| 'base64' \| 'base64url' \| 'latin1' \| 'binary' \| 'hex';|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: BufferEncoding<br>方法 or 属性: type BufferEncoding = 'ascii' \| 'utf8' \| 'utf-8' \| 'utf16le' \| 'ucs2' \| 'ucs-2' \| 'base64' \| 'base64url' \| 'latin1' \| 'binary' \| 'hex';|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: TypedArray|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: buffer<br>方法 or 属性: function alloc(size: number, fill?: string \| Buffer \| number, encoding?: BufferEncoding): Buffer;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: buffer<br>方法 or 属性: function allocUninitializedFromPool(size: number): Buffer;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: buffer<br>方法 or 属性: function allocUninitialized(size: number): Buffer;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: buffer<br>方法 or 属性: function byteLength(string: string \| Buffer \| TypedArray \| DataView \| ArrayBuffer \| SharedArrayBuffer, encoding?: BufferEncoding): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: buffer<br>方法 or 属性: function concat(list: Buffer[] \| Uint8Array[], totalLength?: number): Buffer;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: buffer<br>方法 or 属性: function from(array: number[]): Buffer;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: buffer<br>方法 or 属性: function from(arrayBuffer: ArrayBuffer \| SharedArrayBuffer, byteOffset?: number, length?: number): Buffer;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: buffer<br>方法 or 属性: function from(buffer: Buffer \| Uint8Array): Buffer;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: buffer<br>方法 or 属性: function from(object: Object, offsetOrEncoding: number \| string, length: number): Buffer;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: buffer<br>方法 or 属性: function from(string: String, encoding?: BufferEncoding): Buffer;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: buffer<br>方法 or 属性: function isBuffer(obj: Object): boolean;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: buffer<br>方法 or 属性: function isEncoding(encoding: string):boolean;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: buffer<br>方法 or 属性: function compare(buf1: Buffer \| Uint8Array, buf2: Buffer \| Uint8Array): -1 \| 0 \| 1;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: buffer<br>方法 or 属性: function transcode(source: Buffer \| Uint8Array, fromEnc: string, toEnc: string): Buffer;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: length: number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: buffer: ArrayBuffer;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: byteOffset: number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: fill(value: string \| Buffer \| Uint8Array \| number, offset?: number, end?: number, encoding?: BufferEncoding): Buffer;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: compare(target: Buffer \| Uint8Array, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): -1 \| 0 \| 1;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: copy(target: Buffer \| Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: equals(otherBuffer: Uint8Array \| Buffer): boolean;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: includes(value: string \| number \| Buffer \| Uint8Array, byteOffset?: number, encoding?: BufferEncoding): boolean;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: indexOf(value: string \| number \| Buffer \| Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: keys(): IterableIterator\<number>;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: values(): IterableIterator\<number>;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: entries(): IterableIterator\<[number, number]>;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: lastIndexOf(value: string \| number \| Buffer \| Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: readBigInt64BE(offset?: number): bigint;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: readBigInt64LE(offset?: number): bigint;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: readBigUInt64BE(offset?: number): bigint;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: readBigUInt64LE(offset?: number): bigint;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: readDoubleBE(offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: readDoubleLE(offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: readFloatBE(offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: readFloatLE(offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: readInt8(offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: readInt16BE(offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: readInt16LE(offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: readInt32BE(offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: readInt32LE(offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: readIntBE(offset: number, byteLength: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: readIntLE(offset: number, byteLength: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: readUInt8(offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: readUInt16BE(offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: readUInt16LE(offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: readUInt32BE(offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: readUInt32LE(offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: readUIntBE(offset: number, byteLength: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: readUIntLE(offset: number, byteLength: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: subarray(start?: number, end?: number): Buffer;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: swap16(): Buffer;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: swap32(): Buffer;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: swap64(): Buffer;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: toJSON(): Object;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: toString(encoding?: string, start?: number, end?: number): string;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: write(str: string, offset?: number, length?: number, encoding?: string): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: writeBigInt64BE(value: bigint, offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: writeBigInt64LE(value: bigint, offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: writeBigUInt64BE(value: bigint, offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: writeBigUInt64LE(value: bigint, offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: writeDoubleBE(value: number, offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: writeDoubleLE(value: number, offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: writeFloatBE(value: number, offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: writeFloatLE(value: number, offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: writeInt8(value: number, offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: writeInt16BE(value: number, offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: writeInt16LE(value: number, offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: writeInt32BE(value: number, offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: writeInt32LE(value: number, offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: writeIntBE(value: number, offset: number, byteLength: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: writeIntLE(value : number, offset: number, byteLength: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: writeUInt8(value: number, offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: writeUInt16BE(value: number, offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: writeUInt16LE(value: number, offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: writeUInt32BE(value: number, offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: writeUInt32LE(value: number, offset?: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: writeUIntBE(value: number, offset: number, byteLength: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Buffer<br>方法 or 属性: writeUIntLE(value: number, offset: number, byteLength: number): number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Blob|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Blob<br>方法 or 属性: constructor(sources: string[] \| ArrayBuffer[] \| TypedArray[] \| DataView[] \| Blob[] , options?: Object);|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Blob<br>方法 or 属性: size: number;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Blob<br>方法 or 属性: type: string;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Blob<br>方法 or 属性: arrayBuffer(): Promise\<ArrayBuffer>;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Blob<br>方法 or 属性: slice(start?: number, end?: number, type?: string): Blob;|@ohos.buffer.d.ts| +|新增|NA|模块名: ohos.buffer<br>类名: Blob<br>方法 or 属性: text(): Promise\<string>;|@ohos.buffer.d.ts| +|新增|NA|类名:ConvertXML<br>方法or属性:convertToJSObject(xml: string, options?: ConvertOptions) : Object;|@ohos.convertxml.d.ts| +|新增|NA|模块名: ohos.process<br>类名: ProcessManager|@ohos.process.d.ts| +|新增|NA|类名:ProcessManager<br>方法or属性:|@ohos.process.d.ts| +|新增|NA|模块名: ohos.process<br>类名: ProcessManager<br>方法 or 属性:isAppUid(v: number): boolean;|@ohos.process.d.ts| +|新增|NA|类名:ProcessManager<br>方法or属性:isAppUid(v: number): boolean;|@ohos.process.d.ts| +|新增|NA|模块名: ohos.process<br>类名: ProcessManager<br>方法 or 属性:getUidForName(v: string): number;|@ohos.process.d.ts| +|新增|NA|类名:ProcessManager<br>方法or属性:getUidForName(v: string): number;|@ohos.process.d.ts| +|新增|NA|模块名: ohos.process<br>类名: ProcessManager<br>方法 or 属性:getThreadPriority(v: number): number;|@ohos.process.d.ts| +|新增|NA|类名:ProcessManager<br>方法or属性:getThreadPriority(v: number): number;|@ohos.process.d.ts| +|新增|NA|模块名: ohos.process<br>类名: ProcessManager<br>方法 or 属性:getSystemConfig(name: number): number;|@ohos.process.d.ts| +|新增|NA|类名:ProcessManager<br>方法or属性:getSystemConfig(name: number): number;|@ohos.process.d.ts| +|新增|NA|模块名: ohos.process<br>类名: ProcessManager<br>方法 or 属性:getEnvironmentVar(name: string): string;|@ohos.process.d.ts| +|新增|NA|类名:ProcessManager<br>方法or属性:getEnvironmentVar(name: string): string;|@ohos.process.d.ts| +|新增|NA|模块名: ohos.process<br>类名: ProcessManager<br>方法 or 属性:exit(code: number): void;|@ohos.process.d.ts| +|新增|NA|类名:ProcessManager<br>方法or属性:exit(code: number): void;|@ohos.process.d.ts| +|新增|NA|模块名: ohos.process<br>类名: ProcessManager<br>方法 or 属性:kill(signal: number, pid: number): boolean;|@ohos.process.d.ts| +|新增|NA|类名:ProcessManager<br>方法or属性:kill(signal: number, pid: number): boolean;|@ohos.process.d.ts| +|新增|NA|模块名: ohos.taskpool<br>类名: taskpool|@ohos.taskpool.d.ts| +|新增|NA|模块名: ohos.taskpool<br>类名: Priority|@ohos.taskpool.d.ts| +|新增|NA|模块名: ohos.taskpool<br>类名: Priority<br>方法 or 属性: HIGH|@ohos.taskpool.d.ts| +|新增|NA|模块名: ohos.taskpool<br>类名: Priority<br>方法 or 属性: MEDIUM|@ohos.taskpool.d.ts| +|新增|NA|模块名: ohos.taskpool<br>类名: Priority<br>方法 or 属性: LOW|@ohos.taskpool.d.ts| +|新增|NA|模块名: ohos.taskpool<br>类名: Task|@ohos.taskpool.d.ts| +|新增|NA|模块名: ohos.taskpool<br>类名: Task<br>方法 or 属性: constructor(func: Function, ...args: unknown[]);|@ohos.taskpool.d.ts| +|新增|NA|模块名: ohos.taskpool<br>类名: Task<br>方法 or 属性: function: Function;|@ohos.taskpool.d.ts| +|新增|NA|模块名: ohos.taskpool<br>类名: Task<br>方法 or 属性: arguments?: unknown[];|@ohos.taskpool.d.ts| +|新增|NA|模块名: ohos.taskpool<br>类名: taskpool<br>方法 or 属性: function execute(func: Function, ...args: unknown[]): Promise\<unknown>;|@ohos.taskpool.d.ts| +|新增|NA|模块名: ohos.taskpool<br>类名: taskpool<br>方法 or 属性: function execute(task: Task, priority?: Priority): Promise\<unknown>;|@ohos.taskpool.d.ts| +|新增|NA|模块名: ohos.taskpool<br>类名: taskpool<br>方法 or 属性: function cancel(task: Task): void;|@ohos.taskpool.d.ts| +|新增|NA|类名:URI<br>方法or属性:equalsTo(other: URI): boolean;|@ohos.uri.d.ts| +|新增|NA|模块名: ohos.url<br>类名: URLParams|@ohos.url.d.ts| +|新增|NA|类名:URLParams<br>方法or属性:|@ohos.url.d.ts| +|新增|NA|模块名: ohos.url<br>类名: URLParams<br>方法 or 属性:constructor(init?: string[][] \| Record\<string, string> \| string \| URLParams);|@ohos.url.d.ts| +|新增|NA|类名:URLParams<br>方法or属性:constructor(init?: string[][] \| Record\<string, string> \| string \| URLParams);|@ohos.url.d.ts| +|新增|NA|模块名: ohos.url<br>类名: URLParams<br>方法 or 属性:append(name: string, value: string): void;|@ohos.url.d.ts| +|新增|NA|类名:URLParams<br>方法or属性:append(name: string, value: string): void;|@ohos.url.d.ts| +|新增|NA|模块名: ohos.url<br>类名: URLParams<br>方法 or 属性:delete(name: string): void;|@ohos.url.d.ts| +|新增|NA|类名:URLParams<br>方法or属性:delete(name: string): void;|@ohos.url.d.ts| +|新增|NA|模块名: ohos.url<br>类名: URLParams<br>方法 or 属性:getAll(name: string): string[];|@ohos.url.d.ts| +|新增|NA|类名:URLParams<br>方法or属性:getAll(name: string): string[];|@ohos.url.d.ts| +|新增|NA|模块名: ohos.url<br>类名: URLParams<br>方法 or 属性:entries(): IterableIterator\<[string, string]>;|@ohos.url.d.ts| +|新增|NA|类名:URLParams<br>方法or属性:entries(): IterableIterator\<[string, string]>;|@ohos.url.d.ts| +|新增|NA|模块名: ohos.url<br>类名: URLParams<br>方法 or 属性:forEach(callbackFn: (value: string, key: string, searchParams: this) => void, thisArg?: Object): void;|@ohos.url.d.ts| +|新增|NA|模块名: ohos.url<br>类名: URLParams<br>方法 or 属性:get(name: string): string \| null;|@ohos.url.d.ts| +|新增|NA|类名:URLParams<br>方法or属性:get(name: string): string \| null;|@ohos.url.d.ts| +|新增|NA|模块名: ohos.url<br>类名: URLParams<br>方法 or 属性:has(name: string): boolean;|@ohos.url.d.ts| +|新增|NA|类名:URLParams<br>方法or属性:has(name: string): boolean;|@ohos.url.d.ts| +|新增|NA|模块名: ohos.url<br>类名: URLParams<br>方法 or 属性:set(name: string, value: string): void;|@ohos.url.d.ts| +|新增|NA|类名:URLParams<br>方法or属性:set(name: string, value: string): void;|@ohos.url.d.ts| +|新增|NA|模块名: ohos.url<br>类名: URLParams<br>方法 or 属性:sort(): void;|@ohos.url.d.ts| +|新增|NA|类名:URLParams<br>方法or属性:sort(): void;|@ohos.url.d.ts| +|新增|NA|模块名: ohos.url<br>类名: URLParams<br>方法 or 属性:keys(): IterableIterator\<string>;|@ohos.url.d.ts| +|新增|NA|类名:URLParams<br>方法or属性:keys(): IterableIterator\<string>;|@ohos.url.d.ts| +|新增|NA|模块名: ohos.url<br>类名: URLParams<br>方法 or 属性:values(): IterableIterator\<string>;|@ohos.url.d.ts| +|新增|NA|类名:URLParams<br>方法or属性:values(): IterableIterator\<string>;|@ohos.url.d.ts| +|新增|NA|模块名: ohos.url<br>类名: URLParams<br>方法 or 属性:[Symbol.iterator](): IterableIterator\<[string, string]>;|@ohos.url.d.ts| +|新增|NA|类名:URLParams<br>方法or属性:[Symbol.iterator](): IterableIterator\<[string, string]>;|@ohos.url.d.ts| +|新增|NA|模块名: ohos.url<br>类名: URLParams<br>方法 or 属性:toString(): string;|@ohos.url.d.ts| +|新增|NA|类名:URL<br>方法or属性:constructor();|@ohos.url.d.ts| +|新增|NA|类名:URL<br>方法or属性:static parseURL(url: string, base?: string \| URL): URL;|@ohos.url.d.ts| +|新增|NA|类名:URL<br>方法or属性:readonly params: URLParams;|@ohos.url.d.ts| +|新增|NA|类名:util<br>方法or属性:function format(format: string, ...args: Object[]): string;|@ohos.util.d.ts| +|新增|NA|类名:util<br>方法or属性:function errnoToString(errno: number): string;|@ohos.util.d.ts| +|新增|NA|类名:util<br>方法or属性:function promisify(original: (err: Object, value: Object) => void): Function;|@ohos.util.d.ts| +|新增|NA|类名:util<br>方法or属性:function generateRandomUUID(entropyCache?: boolean): string;|@ohos.util.d.ts| +|新增|NA|类名:util<br>方法or属性:function generateRandomBinaryUUID(entropyCache?: boolean): Uint8Array;|@ohos.util.d.ts| +|新增|NA|类名:util<br>方法or属性:function parseUUID(uuid: string): Uint8Array;|@ohos.util.d.ts| +|新增|NA|类名:TextDecoder<br>方法or属性:constructor();|@ohos.util.d.ts| +|新增|NA|类名:TextDecoder<br>方法or属性:static create(<br><br> encoding?: string,<br><br> options?: { fatal?: boolean; ignoreBOM?: boolean }<br><br> ): TextDecoder;|@ohos.util.d.ts| +|新增|NA|类名:TextDecoder<br>方法or属性:decodeWithStream(input: Uint8Array, options?: { stream?: boolean }): string;|@ohos.util.d.ts| +|新增|NA|类名:TextEncoder<br>方法or属性:constructor(encoding?: string);|@ohos.util.d.ts| +|新增|NA|类名:TextEncoder<br>方法or属性:encodeInto(input?: string): Uint8Array;|@ohos.util.d.ts| +|新增|NA|类名:TextEncoder<br>方法or属性:encodeIntoUint8Array(<br><br> input: string,<br><br> dest: Uint8Array,<br><br> ): { read: number; written: number };|@ohos.util.d.ts| +|新增|NA|类名:RationalNumber<br>方法or属性:constructor();|@ohos.util.d.ts| +|新增|NA|类名:RationalNumber<br>方法or属性:static parseRationalNumber(numerator: number, denominator: number): RationalNumber;|@ohos.util.d.ts| +|新增|NA|类名:RationalNumber<br>方法or属性:compare(another :RationalNumber): number;|@ohos.util.d.ts| +|新增|NA|类名:RationalNumber<br>方法or属性:static getCommonFactor(number1: number, number2: number): number;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: LRUCache|@ohos.util.d.ts| +|新增|NA|类名:LRUCache<br>方法or属性:|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: LRUCache<br>方法 or 属性:constructor(capacity?: number);|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: LRUCache<br>方法 or 属性:updateCapacity(newCapacity: number):void|@ohos.util.d.ts| +|新增|NA|类名:LRUCache<br>方法or属性:updateCapacity(newCapacity: number):void|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: LRUCache<br>方法 or 属性:toString(): string|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: LRUCache<br>方法 or 属性:length: number|@ohos.util.d.ts| +|新增|NA|类名:LRUCache<br>方法or属性:length: number|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: LRUCache<br>方法 or 属性:getCapacity(): number;|@ohos.util.d.ts| +|新增|NA|类名:LRUCache<br>方法or属性:getCapacity(): number;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: LRUCache<br>方法 or 属性:clear(): void;|@ohos.util.d.ts| +|新增|NA|类名:LRUCache<br>方法or属性:clear(): void;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: LRUCache<br>方法 or 属性:getCreateCount(): number;|@ohos.util.d.ts| +|新增|NA|类名:LRUCache<br>方法or属性:getCreateCount(): number;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: LRUCache<br>方法 or 属性:getMissCount(): number;|@ohos.util.d.ts| +|新增|NA|类名:LRUCache<br>方法or属性:getMissCount(): number;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: LRUCache<br>方法 or 属性:getRemovalCount(): number;|@ohos.util.d.ts| +|新增|NA|类名:LRUCache<br>方法or属性:getRemovalCount(): number;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: LRUCache<br>方法 or 属性:getMatchCount(): number;|@ohos.util.d.ts| +|新增|NA|类名:LRUCache<br>方法or属性:getMatchCount(): number;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: LRUCache<br>方法 or 属性:getPutCount(): number;|@ohos.util.d.ts| +|新增|NA|类名:LRUCache<br>方法or属性:getPutCount(): number;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: LRUCache<br>方法 or 属性:isEmpty(): boolean;|@ohos.util.d.ts| +|新增|NA|类名:LRUCache<br>方法or属性:isEmpty(): boolean;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: LRUCache<br>方法 or 属性:get(key: K): V \| undefined;|@ohos.util.d.ts| +|新增|NA|类名:LRUCache<br>方法or属性:get(key: K): V \| undefined;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: LRUCache<br>方法 or 属性:put(key: K, value: V): V;|@ohos.util.d.ts| +|新增|NA|类名:LRUCache<br>方法or属性:put(key: K, value: V): V;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: LRUCache<br>方法 or 属性:values(): V[];|@ohos.util.d.ts| +|新增|NA|类名:LRUCache<br>方法or属性:values(): V[];|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: LRUCache<br>方法 or 属性:keys(): K[];|@ohos.util.d.ts| +|新增|NA|类名:LRUCache<br>方法or属性:keys(): K[];|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: LRUCache<br>方法 or 属性:remove(key: K): V \| undefined;|@ohos.util.d.ts| +|新增|NA|类名:LRUCache<br>方法or属性:remove(key: K): V \| undefined;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: LRUCache<br>方法 or 属性:afterRemoval(isEvict: boolean, key: K, value: V, newValue: V): void;|@ohos.util.d.ts| +|新增|NA|类名:LRUCache<br>方法or属性:afterRemoval(isEvict: boolean, key: K, value: V, newValue: V): void;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: LRUCache<br>方法 or 属性:contains(key: K): boolean;|@ohos.util.d.ts| +|新增|NA|类名:LRUCache<br>方法or属性:contains(key: K): boolean;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: LRUCache<br>方法 or 属性:createDefault(key: K): V;|@ohos.util.d.ts| +|新增|NA|类名:LRUCache<br>方法or属性:createDefault(key: K): V;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: LRUCache<br>方法 or 属性:entries(): IterableIterator\<[K, V]>;|@ohos.util.d.ts| +|新增|NA|类名:LRUCache<br>方法or属性:entries(): IterableIterator\<[K, V]>;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: LRUCache<br>方法 or 属性:[Symbol.iterator](): IterableIterator\<[K, V]>;|@ohos.util.d.ts| +|新增|NA|类名:LRUCache<br>方法or属性:[Symbol.iterator](): IterableIterator\<[K, V]>;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: ScopeHelper|@ohos.util.d.ts| +|新增|NA|类名:ScopeHelper<br>方法or属性:|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: ScopeHelper<br>方法 or 属性:constructor(lowerObj: ScopeType, upperObj: ScopeType);|@ohos.util.d.ts| +|新增|NA|类名:ScopeHelper<br>方法or属性:constructor(lowerObj: ScopeType, upperObj: ScopeType);|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: ScopeHelper<br>方法 or 属性:toString(): string;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: ScopeHelper<br>方法 or 属性:intersect(range: ScopeHelper): ScopeHelper;|@ohos.util.d.ts| +|新增|NA|类名:ScopeHelper<br>方法or属性:intersect(range: ScopeHelper): ScopeHelper;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: ScopeHelper<br>方法 or 属性:intersect(lowerObj: ScopeType, upperObj: ScopeType): ScopeHelper;|@ohos.util.d.ts| +|新增|NA|类名:ScopeHelper<br>方法or属性:intersect(lowerObj: ScopeType, upperObj: ScopeType): ScopeHelper;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: ScopeHelper<br>方法 or 属性:getUpper(): ScopeType;|@ohos.util.d.ts| +|新增|NA|类名:ScopeHelper<br>方法or属性:getUpper(): ScopeType;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: ScopeHelper<br>方法 or 属性:getLower(): ScopeType;|@ohos.util.d.ts| +|新增|NA|类名:ScopeHelper<br>方法or属性:getLower(): ScopeType;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: ScopeHelper<br>方法 or 属性:expand(lowerObj: ScopeType, upperObj: ScopeType): ScopeHelper;|@ohos.util.d.ts| +|新增|NA|类名:ScopeHelper<br>方法or属性:expand(lowerObj: ScopeType, upperObj: ScopeType): ScopeHelper;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: ScopeHelper<br>方法 or 属性:expand(range: ScopeHelper): ScopeHelper;|@ohos.util.d.ts| +|新增|NA|类名:ScopeHelper<br>方法or属性:expand(range: ScopeHelper): ScopeHelper;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: ScopeHelper<br>方法 or 属性:expand(value: ScopeType): ScopeHelper;|@ohos.util.d.ts| +|新增|NA|类名:ScopeHelper<br>方法or属性:expand(value: ScopeType): ScopeHelper;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: ScopeHelper<br>方法 or 属性:contains(value: ScopeType): boolean;|@ohos.util.d.ts| +|新增|NA|类名:ScopeHelper<br>方法or属性:contains(value: ScopeType): boolean;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: ScopeHelper<br>方法 or 属性:contains(range: ScopeHelper): boolean;|@ohos.util.d.ts| +|新增|NA|类名:ScopeHelper<br>方法or属性:contains(range: ScopeHelper): boolean;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: ScopeHelper<br>方法 or 属性:clamp(value: ScopeType): ScopeType;|@ohos.util.d.ts| +|新增|NA|类名:ScopeHelper<br>方法or属性:clamp(value: ScopeType): ScopeType;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: Base64Helper|@ohos.util.d.ts| +|新增|NA|类名:Base64Helper<br>方法or属性:|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: Base64Helper<br>方法 or 属性:constructor();|@ohos.util.d.ts| +|新增|NA|类名:Base64Helper<br>方法or属性:constructor();|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: Base64Helper<br>方法 or 属性:encodeSync(src: Uint8Array): Uint8Array;|@ohos.util.d.ts| +|新增|NA|类名:Base64Helper<br>方法or属性:encodeSync(src: Uint8Array): Uint8Array;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: Base64Helper<br>方法 or 属性:encodeToStringSync(src: Uint8Array): string;|@ohos.util.d.ts| +|新增|NA|类名:Base64Helper<br>方法or属性:encodeToStringSync(src: Uint8Array): string;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: Base64Helper<br>方法 or 属性:decodeSync(src: Uint8Array \| string): Uint8Array;|@ohos.util.d.ts| +|新增|NA|类名:Base64Helper<br>方法or属性:decodeSync(src: Uint8Array \| string): Uint8Array;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: Base64Helper<br>方法 or 属性:encode(src: Uint8Array): Promise\<Uint8Array>;|@ohos.util.d.ts| +|新增|NA|类名:Base64Helper<br>方法or属性:encode(src: Uint8Array): Promise\<Uint8Array>;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: Base64Helper<br>方法 or 属性:encodeToString(src: Uint8Array): Promise\<string>;|@ohos.util.d.ts| +|新增|NA|类名:Base64Helper<br>方法or属性:encodeToString(src: Uint8Array): Promise\<string>;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.util<br>类名: Base64Helper<br>方法 or 属性:decode(src: Uint8Array \| string): Promise\<Uint8Array>;|@ohos.util.d.ts| +|新增|NA|类名:Base64Helper<br>方法or属性:decode(src: Uint8Array \| string): Promise\<Uint8Array>;|@ohos.util.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: MessageEvents|@ohos.worker.d.ts| +|新增|NA|类名:MessageEvents<br>方法or属性:|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: MessageEvents<br>方法 or 属性:readonly data;|@ohos.worker.d.ts| +|新增|NA|类名:MessageEvents<br>方法or属性:readonly data;|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: WorkerEventListener|@ohos.worker.d.ts| +|新增|NA|类名:WorkerEventListener<br>方法or属性:|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: WorkerEventListener<br>方法 or 属性:(event: Event): void \| Promise\<void>;|@ohos.worker.d.ts| +|新增|NA|类名:WorkerEventListener<br>方法or属性:(event: Event): void \| Promise\<void>;|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: WorkerEventTarget|@ohos.worker.d.ts| +|新增|NA|类名:WorkerEventTarget<br>方法or属性:|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: WorkerEventTarget<br>方法 or 属性:addEventListener(type: string, listener: WorkerEventListener): void;|@ohos.worker.d.ts| +|新增|NA|类名:WorkerEventTarget<br>方法or属性:addEventListener(type: string, listener: WorkerEventListener): void;|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: WorkerEventTarget<br>方法 or 属性:dispatchEvent(event: Event): boolean;|@ohos.worker.d.ts| +|新增|NA|类名:WorkerEventTarget<br>方法or属性:dispatchEvent(event: Event): boolean;|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: WorkerEventTarget<br>方法 or 属性:removeEventListener(type: string, callback?: WorkerEventListener): void;|@ohos.worker.d.ts| +|新增|NA|类名:WorkerEventTarget<br>方法or属性:removeEventListener(type: string, callback?: WorkerEventListener): void;|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: WorkerEventTarget<br>方法 or 属性:removeAllListener(): void;|@ohos.worker.d.ts| +|新增|NA|类名:WorkerEventTarget<br>方法or属性:removeAllListener(): void;|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: GlobalScope|@ohos.worker.d.ts| +|新增|NA|类名:GlobalScope<br>方法or属性:|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: GlobalScope<br>方法 or 属性:readonly name: string;|@ohos.worker.d.ts| +|新增|NA|类名:GlobalScope<br>方法or属性:readonly name: string;|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: GlobalScope<br>方法 or 属性:onerror?: (ev: ErrorEvent) => void;|@ohos.worker.d.ts| +|新增|NA|类名:GlobalScope<br>方法or属性:onerror?: (ev: ErrorEvent) => void;|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: GlobalScope<br>方法 or 属性:readonly self: GlobalScope & typeof globalThis;|@ohos.worker.d.ts| +|新增|NA|类名:GlobalScope<br>方法or属性:readonly self: GlobalScope & typeof globalThis;|@ohos.worker.d.ts| +|新增|NA|类名:DedicatedWorkerGlobalScope<br>方法or属性:postMessage(messageObject: Object, transfer: ArrayBuffer[]): void;|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: ThreadWorkerGlobalScope|@ohos.worker.d.ts| +|新增|NA|类名:ThreadWorkerGlobalScope<br>方法or属性:|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: ThreadWorkerGlobalScope<br>方法 or 属性:onmessage?: (this: ThreadWorkerGlobalScope, ev: MessageEvents) => void;|@ohos.worker.d.ts| +|新增|NA|类名:ThreadWorkerGlobalScope<br>方法or属性:onmessage?: (this: ThreadWorkerGlobalScope, ev: MessageEvents) => void;|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: ThreadWorkerGlobalScope<br>方法 or 属性:onmessageerror?: (this: ThreadWorkerGlobalScope, ev: MessageEvents) => void;|@ohos.worker.d.ts| +|新增|NA|类名:ThreadWorkerGlobalScope<br>方法or属性:onmessageerror?: (this: ThreadWorkerGlobalScope, ev: MessageEvents) => void;|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: ThreadWorkerGlobalScope<br>方法 or 属性:close(): void;|@ohos.worker.d.ts| +|新增|NA|类名:ThreadWorkerGlobalScope<br>方法or属性:close(): void;|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: ThreadWorkerGlobalScope<br>方法 or 属性:postMessage(messageObject: Object, transfer: ArrayBuffer[]): void;|@ohos.worker.d.ts| +|新增|NA|类名:ThreadWorkerGlobalScope<br>方法or属性:postMessage(messageObject: Object, transfer: ArrayBuffer[]): void;|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: ThreadWorkerGlobalScope<br>方法 or 属性:postMessage(messageObject: Object, options?: PostMessageOptions): void;|@ohos.worker.d.ts| +|新增|NA|类名:ThreadWorkerGlobalScope<br>方法or属性:postMessage(messageObject: Object, options?: PostMessageOptions): void;|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: ThreadWorker|@ohos.worker.d.ts| +|新增|NA|类名:ThreadWorker<br>方法or属性:|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: ThreadWorker<br>方法 or 属性:constructor(scriptURL: string, options?: WorkerOptions);|@ohos.worker.d.ts| +|新增|NA|类名:ThreadWorker<br>方法or属性:constructor(scriptURL: string, options?: WorkerOptions);|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: ThreadWorker<br>方法 or 属性:onexit?: (code: number) => void;|@ohos.worker.d.ts| +|新增|NA|类名:ThreadWorker<br>方法or属性:onexit?: (code: number) => void;|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: ThreadWorker<br>方法 or 属性:onerror?: (err: ErrorEvent) => void;|@ohos.worker.d.ts| +|新增|NA|类名:ThreadWorker<br>方法or属性:onerror?: (err: ErrorEvent) => void;|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: ThreadWorker<br>方法 or 属性:onmessage?: (event: MessageEvents) => void;|@ohos.worker.d.ts| +|新增|NA|类名:ThreadWorker<br>方法or属性:onmessage?: (event: MessageEvents) => void;|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: ThreadWorker<br>方法 or 属性:onmessageerror?: (event: MessageEvents) => void;|@ohos.worker.d.ts| +|新增|NA|类名:ThreadWorker<br>方法or属性:onmessageerror?: (event: MessageEvents) => void;|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: ThreadWorker<br>方法 or 属性:postMessage(message: Object, transfer: ArrayBuffer[]): void;|@ohos.worker.d.ts| +|新增|NA|类名:ThreadWorker<br>方法or属性:postMessage(message: Object, transfer: ArrayBuffer[]): void;|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: ThreadWorker<br>方法 or 属性:postMessage(message: Object, options?: PostMessageOptions): void;|@ohos.worker.d.ts| +|新增|NA|类名:ThreadWorker<br>方法or属性:postMessage(message: Object, options?: PostMessageOptions): void;|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: ThreadWorker<br>方法 or 属性:on(type: string, listener: WorkerEventListener): void;|@ohos.worker.d.ts| +|新增|NA|类名:ThreadWorker<br>方法or属性:on(type: string, listener: WorkerEventListener): void;|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: ThreadWorker<br>方法 or 属性:once(type: string, listener: WorkerEventListener): void;|@ohos.worker.d.ts| +|新增|NA|类名:ThreadWorker<br>方法or属性:once(type: string, listener: WorkerEventListener): void;|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: ThreadWorker<br>方法 or 属性:off(type: string, listener?: WorkerEventListener): void;|@ohos.worker.d.ts| +|新增|NA|类名:ThreadWorker<br>方法or属性:off(type: string, listener?: WorkerEventListener): void;|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: ThreadWorker<br>方法 or 属性:terminate(): void;|@ohos.worker.d.ts| +|新增|NA|类名:ThreadWorker<br>方法or属性:terminate(): void;|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: ThreadWorker<br>方法 or 属性:addEventListener(type: string, listener: WorkerEventListener): void;|@ohos.worker.d.ts| +|新增|NA|类名:ThreadWorker<br>方法or属性:addEventListener(type: string, listener: WorkerEventListener): void;|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: ThreadWorker<br>方法 or 属性:dispatchEvent(event: Event): boolean;|@ohos.worker.d.ts| +|新增|NA|类名:ThreadWorker<br>方法or属性:dispatchEvent(event: Event): boolean;|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: ThreadWorker<br>方法 or 属性:removeEventListener(type: string, callback?: WorkerEventListener): void;|@ohos.worker.d.ts| +|新增|NA|类名:ThreadWorker<br>方法or属性:removeEventListener(type: string, callback?: WorkerEventListener): void;|@ohos.worker.d.ts| +|新增|NA|模块名: ohos.worker<br>类名: ThreadWorker<br>方法 or 属性:removeAllListener(): void;|@ohos.worker.d.ts| +|新增|NA|类名:ThreadWorker<br>方法or属性:removeAllListener(): void;|@ohos.worker.d.ts| +|新增|NA|类名:worker<br>方法or属性:const workerPort: ThreadWorkerGlobalScope;|@ohos.worker.d.ts| +|访问级别有变化|类名:ChildProcess<br>访问级别:公开API|类名:ChildProcess<br>访问级别:系统API|@ohos.process.d.ts| +|废弃版本有变化|类名:ConvertXML<br>方法 or 属性:convert(xml: string, options?: ConvertOptions) : Object;<br>废弃版本:N/A|类名:ConvertXML<br>方法 or 属性:convert(xml: string, options?: ConvertOptions) : Object;<br>废弃版本:9<br>代替接口:ohos.convertxml.ConvertXML.convertToJSObject |@ohos.convertxml.d.ts| +|废弃版本有变化|类名:process<br>方法 or 属性:function isAppUid(v: number): boolean;<br>废弃版本:N/A|类名:process<br>方法 or 属性:function isAppUid(v: number): boolean;<br>废弃版本:9<br>代替接口:ohos.process.ProcessManager.isAppUid |@ohos.process.d.ts| +|废弃版本有变化|类名:process<br>方法 or 属性:function getUidForName(v: string): number;<br>废弃版本:N/A|类名:process<br>方法 or 属性:function getUidForName(v: string): number;<br>废弃版本:9<br>代替接口:ohos.process.ProcessManager.getUidForName |@ohos.process.d.ts| +|废弃版本有变化|类名:process<br>方法 or 属性:function getThreadPriority(v: number): number;<br>废弃版本:N/A|类名:process<br>方法 or 属性:function getThreadPriority(v: number): number;<br>废弃版本:9<br>代替接口:ohos.process.ProcessManager.getThreadPriority |@ohos.process.d.ts| +|废弃版本有变化|类名:process<br>方法 or 属性:function getSystemConfig(name: number): number;<br>废弃版本:N/A|类名:process<br>方法 or 属性:function getSystemConfig(name: number): number;<br>废弃版本:9<br>代替接口:ohos.process.ProcessManager.getSystemConfig |@ohos.process.d.ts| +|废弃版本有变化|类名:process<br>方法 or 属性:function getEnvironmentVar(name: string): string;<br>废弃版本:N/A|类名:process<br>方法 or 属性:function getEnvironmentVar(name: string): string;<br>废弃版本:9<br>代替接口:ohos.process.ProcessManager.getEnvironmentVar |@ohos.process.d.ts| +|废弃版本有变化|类名:process<br>方法 or 属性:function exit(code: number): void;<br>废弃版本:N/A|类名:process<br>方法 or 属性:function exit(code: number): void;<br>废弃版本:9<br>代替接口:ohos.process.ProcessManager.exit |@ohos.process.d.ts| +|废弃版本有变化|类名:process<br>方法 or 属性:function kill(signal: number, pid: number): boolean;<br>废弃版本:N/A|类名:process<br>方法 or 属性:function kill(signal: number, pid: number): boolean;<br>废弃版本:9<br>代替接口:ohos.process.ProcessManager.kill |@ohos.process.d.ts| +|废弃版本有变化|类名:URI<br>方法 or 属性:equals(other: URI): boolean;<br>废弃版本:N/A|类名:URI<br>方法 or 属性:equals(other: URI): boolean;<br>废弃版本:9<br>代替接口:ohos.uri.URI.equalsTo |@ohos.uri.d.ts| +|废弃版本有变化|类名:URLSearchParams<br>废弃版本:N/A|类名:URLSearchParams<br>废弃版本:9<br>代替接口:ohos.url.URLParams |@ohos.url.d.ts| +|废弃版本有变化|类名:URLSearchParams<br>方法 or 属性:constructor(init?: string[][] \| Record\<string, string> \| string \| URLSearchParams);<br>废弃版本:N/A|类名:URLSearchParams<br>方法 or 属性:constructor(init?: string[][] \| Record\<string, string> \| string \| URLSearchParams);<br>废弃版本:9<br>代替接口:ohos.url.URLParams.constructor |@ohos.url.d.ts| +|废弃版本有变化|类名:URLSearchParams<br>方法 or 属性:append(name: string, value: string): void;<br>废弃版本:N/A|类名:URLSearchParams<br>方法 or 属性:append(name: string, value: string): void;<br>废弃版本:9<br>代替接口:ohos.url.URLParams.append |@ohos.url.d.ts| +|废弃版本有变化|类名:URLSearchParams<br>方法 or 属性:delete(name: string): void;<br>废弃版本:N/A|类名:URLSearchParams<br>方法 or 属性:delete(name: string): void;<br>废弃版本:9<br>代替接口:ohos.url.URLParams.delete |@ohos.url.d.ts| +|废弃版本有变化|类名:URLSearchParams<br>方法 or 属性:getAll(name: string): string[];<br>废弃版本:N/A|类名:URLSearchParams<br>方法 or 属性:getAll(name: string): string[];<br>废弃版本:9<br>代替接口:ohos.url.URLParams.getAll |@ohos.url.d.ts| +|废弃版本有变化|类名:URLSearchParams<br>方法 or 属性:entries(): IterableIterator\<[string, string]>;<br>废弃版本:N/A|类名:URLSearchParams<br>方法 or 属性:entries(): IterableIterator\<[string, string]>;<br>废弃版本:9<br>代替接口:ohos.url.URLParams.entries |@ohos.url.d.ts| +|废弃版本有变化|类名:URLSearchParams<br>方法 or 属性:get(name: string): string \| null;<br>废弃版本:N/A|类名:URLSearchParams<br>方法 or 属性:get(name: string): string \| null;<br>废弃版本:9<br>代替接口:ohos.url.URLParams.get |@ohos.url.d.ts| +|废弃版本有变化|类名:URLSearchParams<br>方法 or 属性:has(name: string): boolean;<br>废弃版本:N/A|类名:URLSearchParams<br>方法 or 属性:has(name: string): boolean;<br>废弃版本:9<br>代替接口:ohos.url.URLParams.has |@ohos.url.d.ts| +|废弃版本有变化|类名:URLSearchParams<br>方法 or 属性:set(name: string, value: string): void;<br>废弃版本:N/A|类名:URLSearchParams<br>方法 or 属性:set(name: string, value: string): void;<br>废弃版本:9<br>代替接口:ohos.url.URLParams.set |@ohos.url.d.ts| +|废弃版本有变化|类名:URLSearchParams<br>方法 or 属性:sort(): void;<br>废弃版本:N/A|类名:URLSearchParams<br>方法 or 属性:sort(): void;<br>废弃版本:9<br>代替接口:ohos.url.URLParams.sort |@ohos.url.d.ts| +|废弃版本有变化|类名:URLSearchParams<br>方法 or 属性:keys(): IterableIterator\<string>;<br>废弃版本:N/A|类名:URLSearchParams<br>方法 or 属性:keys(): IterableIterator\<string>;<br>废弃版本:9<br>代替接口:ohos.url.URLParams.keys |@ohos.url.d.ts| +|废弃版本有变化|类名:URLSearchParams<br>方法 or 属性:values(): IterableIterator\<string>;<br>废弃版本:N/A|类名:URLSearchParams<br>方法 or 属性:values(): IterableIterator\<string>;<br>废弃版本:9<br>代替接口:ohos.url.URLParams.values |@ohos.url.d.ts| +|废弃版本有变化|类名:URLSearchParams<br>方法 or 属性:[Symbol.iterator](): IterableIterator\<[string, string]>;<br>废弃版本:N/A|类名:URLSearchParams<br>方法 or 属性:[Symbol.iterator](): IterableIterator\<[string, string]>;<br>废弃版本:9<br>代替接口:ohos.url.URLParams.|@ohos.url.d.ts| +|废弃版本有变化|类名:URLSearchParams<br>方法 or 属性:toString(): string;<br>废弃版本:N/A|类名:URLSearchParams<br>方法 or 属性:toString(): string;<br>废弃版本:9<br>代替接口:ohos.url.URLParams.toString |@ohos.url.d.ts| +|废弃版本有变化|类名:URL<br>方法 or 属性:constructor(url: string, base?: string \| URL);<br>废弃版本:N/A|类名:URL<br>方法 or 属性:constructor(url: string, base?: string \| URL);<br>废弃版本:9<br>代替接口:ohos.url.URL.parseURL |@ohos.url.d.ts| +|废弃版本有变化|类名:URL<br>方法 or 属性:readonly searchParams: URLSearchParams;<br>废弃版本:N/A|类名:URL<br>方法 or 属性:readonly searchParams: URLSearchParams;<br>废弃版本:9<br>代替接口:ohos.url.URL.params |@ohos.url.d.ts| +|废弃版本有变化|类名:util<br>方法 or 属性:function printf(format: string, ...args: Object[]): string;<br>废弃版本:N/A|类名:util<br>方法 or 属性:function printf(format: string, ...args: Object[]): string;<br>废弃版本:9<br>代替接口:ohos.util.format |@ohos.util.d.ts| +|废弃版本有变化|类名:util<br>方法 or 属性:function getErrorString(errno: number): string;<br>废弃版本:N/A|类名:util<br>方法 or 属性:function getErrorString(errno: number): string;<br>废弃版本:9<br>代替接口:ohos.util.errnoToString |@ohos.util.d.ts| +|废弃版本有变化|类名:util<br>方法 or 属性:function promiseWrapper(original: (err: Object, value: Object) => void): Object;<br>废弃版本:N/A|类名:util<br>方法 or 属性:function promiseWrapper(original: (err: Object, value: Object) => void): Object;<br>废弃版本:9<br>代替接口:ohos.util.promisify |@ohos.util.d.ts| +|废弃版本有变化|类名:TextDecoder<br>方法 or 属性:constructor(<br><br> encoding?: string,<br><br> options?: { fatal?: boolean; ignoreBOM?: boolean },<br><br> );<br>废弃版本:N/A|类名:TextDecoder<br>方法 or 属性:constructor(<br><br> encoding?: string,<br><br> options?: { fatal?: boolean; ignoreBOM?: boolean },<br><br> );<br>废弃版本:9<br>代替接口:ohos.util.TextDecoder.create |@ohos.util.d.ts| +|废弃版本有变化|类名:TextDecoder<br>方法 or 属性:decode(input: Uint8Array, options?: { stream?: false }): string;<br>废弃版本:N/A|类名:TextDecoder<br>方法 or 属性:decode(input: Uint8Array, options?: { stream?: false }): string;<br>废弃版本:9<br>代替接口:ohos.util.decodeWithStream |@ohos.util.d.ts| +|废弃版本有变化|类名:TextEncoder<br>方法 or 属性:encode(input?: string): Uint8Array;<br>废弃版本:N/A|类名:TextEncoder<br>方法 or 属性:encode(input?: string): Uint8Array;<br>废弃版本:9<br>代替接口:ohos.util.encodeInto |@ohos.util.d.ts| +|废弃版本有变化|类名:TextEncoder<br>方法 or 属性:encodeInto(<br><br> input: string,<br><br> dest: Uint8Array,<br><br> ): { read: number; written: number };<br>废弃版本:N/A|类名:TextEncoder<br>方法 or 属性:encodeInto(<br><br> input: string,<br><br> dest: Uint8Array,<br><br> ): { read: number; written: number };<br>废弃版本:9<br>代替接口:ohos.util.encodeIntoUint8Array |@ohos.util.d.ts| +|废弃版本有变化|类名:RationalNumber<br>方法 or 属性:constructor(numerator: number, denominator: number);<br>废弃版本:N/A|类名:RationalNumber<br>方法 or 属性:constructor(numerator: number, denominator: number);<br>废弃版本:9<br>代替接口:ohos.util.RationalNumber.parseRationalNumber |@ohos.util.d.ts| +|废弃版本有变化|类名:RationalNumber<br>方法 or 属性:compareTo(another :RationalNumber): number;<br>废弃版本:N/A|类名:RationalNumber<br>方法 or 属性:compareTo(another :RationalNumber): number;<br>废弃版本:9<br>代替接口:ohos.util.compare |@ohos.util.d.ts| +|废弃版本有变化|类名:RationalNumber<br>方法 or 属性:static getCommonDivisor(number1: number, number2: number): number;<br>废弃版本:N/A|类名:RationalNumber<br>方法 or 属性:static getCommonDivisor(number1: number, number2: number): number;<br>废弃版本:9<br>代替接口:ohos.util.getCommonFactor |@ohos.util.d.ts| +|废弃版本有变化|类名:LruBuffer<br>废弃版本:N/A|类名:LruBuffer<br>废弃版本:9<br>代替接口:ohos.util.LRUCache |@ohos.util.d.ts| +|废弃版本有变化|类名:LruBuffer<br>方法 or 属性:updateCapacity(newCapacity: number):void<br>废弃版本:N/A|类名:LruBuffer<br>方法 or 属性:updateCapacity(newCapacity: number):void<br>废弃版本:9<br>代替接口:ohos.util.LRUCache.updateCapacity |@ohos.util.d.ts| +|废弃版本有变化|类名:LruBuffer<br>方法 or 属性:getCapacity(): number;<br>废弃版本:N/A|类名:LruBuffer<br>方法 or 属性:getCapacity(): number;<br>废弃版本:9<br>代替接口:ohos.util.LRUCache.getCapacity |@ohos.util.d.ts| +|废弃版本有变化|类名:LruBuffer<br>方法 or 属性:clear(): void;<br>废弃版本:N/A|类名:LruBuffer<br>方法 or 属性:clear(): void;<br>废弃版本:9<br>代替接口:ohos.util.LRUCache.clear |@ohos.util.d.ts| +|废弃版本有变化|类名:LruBuffer<br>方法 or 属性:getCreateCount(): number;<br>废弃版本:N/A|类名:LruBuffer<br>方法 or 属性:getCreateCount(): number;<br>废弃版本:9<br>代替接口:ohos.util.LRUCache.getCreateCount |@ohos.util.d.ts| +|废弃版本有变化|类名:LruBuffer<br>方法 or 属性:getMissCount(): number;<br>废弃版本:N/A|类名:LruBuffer<br>方法 or 属性:getMissCount(): number;<br>废弃版本:9<br>代替接口:ohos.util.LRUCache.getMissCount |@ohos.util.d.ts| +|废弃版本有变化|类名:LruBuffer<br>方法 or 属性:getRemovalCount(): number;<br>废弃版本:N/A|类名:LruBuffer<br>方法 or 属性:getRemovalCount(): number;<br>废弃版本:9<br>代替接口:ohos.util.LRUCache.getRemovalCount |@ohos.util.d.ts| +|废弃版本有变化|类名:LruBuffer<br>方法 or 属性:getMatchCount(): number;<br>废弃版本:N/A|类名:LruBuffer<br>方法 or 属性:getMatchCount(): number;<br>废弃版本:9<br>代替接口:ohos.util.LRUCache.getMatchCount |@ohos.util.d.ts| +|废弃版本有变化|类名:LruBuffer<br>方法 or 属性:getPutCount(): number;<br>废弃版本:N/A|类名:LruBuffer<br>方法 or 属性:getPutCount(): number;<br>废弃版本:9<br>代替接口:ohos.util.LRUCache.getPutCount |@ohos.util.d.ts| +|废弃版本有变化|类名:LruBuffer<br>方法 or 属性:isEmpty(): boolean;<br>废弃版本:N/A|类名:LruBuffer<br>方法 or 属性:isEmpty(): boolean;<br>废弃版本:9<br>代替接口:ohos.util.LRUCache.isEmpty |@ohos.util.d.ts| +|废弃版本有变化|类名:LruBuffer<br>方法 or 属性:get(key: K): V \| undefined;<br>废弃版本:N/A|类名:LruBuffer<br>方法 or 属性:get(key: K): V \| undefined;<br>废弃版本:9<br>代替接口:ohos.util.LRUCache.get |@ohos.util.d.ts| +|废弃版本有变化|类名:LruBuffer<br>方法 or 属性:put(key: K, value: V): V;<br>废弃版本:N/A|类名:LruBuffer<br>方法 or 属性:put(key: K, value: V): V;<br>废弃版本:9<br>代替接口:ohos.util.LRUCache.put |@ohos.util.d.ts| +|废弃版本有变化|类名:LruBuffer<br>方法 or 属性:values(): V[];<br>废弃版本:N/A|类名:LruBuffer<br>方法 or 属性:values(): V[];<br>废弃版本:9<br>代替接口:ohos.util.LRUCache.values |@ohos.util.d.ts| +|废弃版本有变化|类名:LruBuffer<br>方法 or 属性:keys(): K[];<br>废弃版本:N/A|类名:LruBuffer<br>方法 or 属性:keys(): K[];<br>废弃版本:9<br>代替接口:ohos.util.LRUCache.keys |@ohos.util.d.ts| +|废弃版本有变化|类名:LruBuffer<br>方法 or 属性:remove(key: K): V \| undefined;<br>废弃版本:N/A|类名:LruBuffer<br>方法 or 属性:remove(key: K): V \| undefined;<br>废弃版本:9<br>代替接口:ohos.util.LRUCache.remove |@ohos.util.d.ts| +|废弃版本有变化|类名:LruBuffer<br>方法 or 属性:afterRemoval(isEvict: boolean, key: K, value: V, newValue: V): void;<br>废弃版本:N/A|类名:LruBuffer<br>方法 or 属性:afterRemoval(isEvict: boolean, key: K, value: V, newValue: V): void;<br>废弃版本:9<br>代替接口:ohos.util.LRUCache.afterRemoval |@ohos.util.d.ts| +|废弃版本有变化|类名:LruBuffer<br>方法 or 属性:contains(key: K): boolean;<br>废弃版本:N/A|类名:LruBuffer<br>方法 or 属性:contains(key: K): boolean;<br>废弃版本:9<br>代替接口:ohos.util.LRUCache.contains |@ohos.util.d.ts| +|废弃版本有变化|类名:LruBuffer<br>方法 or 属性:createDefault(key: K): V;<br>废弃版本:N/A|类名:LruBuffer<br>方法 or 属性:createDefault(key: K): V;<br>废弃版本:9<br>代替接口:ohos.util.LRUCache.createDefault |@ohos.util.d.ts| +|废弃版本有变化|类名:LruBuffer<br>方法 or 属性:entries(): IterableIterator\<[K, V]>;<br>废弃版本:N/A|类名:LruBuffer<br>方法 or 属性:entries(): IterableIterator\<[K, V]>;<br>废弃版本:9<br>代替接口:ohos.util.LRUCache.entries |@ohos.util.d.ts| +|废弃版本有变化|类名:LruBuffer<br>方法 or 属性:[Symbol.iterator](): IterableIterator\<[K, V]>;<br>废弃版本:N/A|类名:LruBuffer<br>方法 or 属性:[Symbol.iterator](): IterableIterator\<[K, V]>;<br>废弃版本:9<br>代替接口:ohos.util.LRUCache.|@ohos.util.d.ts| +|废弃版本有变化|类名:Scope<br>废弃版本:N/A|类名:Scope<br>废弃版本:9<br>代替接口:ohos.util.ScopeHelper |@ohos.util.d.ts| +|废弃版本有变化|类名:Scope<br>方法 or 属性:constructor(lowerObj: ScopeType, upperObj: ScopeType);<br>废弃版本:N/A|类名:Scope<br>方法 or 属性:constructor(lowerObj: ScopeType, upperObj: ScopeType);<br>废弃版本:9<br>代替接口:ohos.util.ScopeHelper.constructor |@ohos.util.d.ts| +|废弃版本有变化|类名:Scope<br>方法 or 属性:toString(): string;<br>废弃版本:N/A|类名:Scope<br>方法 or 属性:toString(): string;<br>废弃版本:9<br>代替接口:ohos.util.ScopeHelper.toString |@ohos.util.d.ts| +|废弃版本有变化|类名:Scope<br>方法 or 属性:intersect(range: Scope): Scope;<br>废弃版本:N/A|类名:Scope<br>方法 or 属性:intersect(range: Scope): Scope;<br>废弃版本:9<br>代替接口:ohos.util.ScopeHelper.intersect |@ohos.util.d.ts| +|废弃版本有变化|类名:Scope<br>方法 or 属性:intersect(lowerObj: ScopeType, upperObj: ScopeType): Scope;<br>废弃版本:N/A|类名:Scope<br>方法 or 属性:intersect(lowerObj: ScopeType, upperObj: ScopeType): Scope;<br>废弃版本:9<br>代替接口:ohos.util.ScopeHelper.intersect |@ohos.util.d.ts| +|废弃版本有变化|类名:Scope<br>方法 or 属性:getUpper(): ScopeType;<br>废弃版本:N/A|类名:Scope<br>方法 or 属性:getUpper(): ScopeType;<br>废弃版本:9<br>代替接口:ohos.util.ScopeHelper.getUpper |@ohos.util.d.ts| +|废弃版本有变化|类名:Scope<br>方法 or 属性:getLower(): ScopeType;<br>废弃版本:N/A|类名:Scope<br>方法 or 属性:getLower(): ScopeType;<br>废弃版本:9<br>代替接口:ohos.util.ScopeHelper.getLower |@ohos.util.d.ts| +|废弃版本有变化|类名:Scope<br>方法 or 属性:expand(lowerObj: ScopeType, upperObj: ScopeType): Scope;<br>废弃版本:N/A|类名:Scope<br>方法 or 属性:expand(lowerObj: ScopeType, upperObj: ScopeType): Scope;<br>废弃版本:9<br>代替接口:ohos.util.ScopeHelper.expand |@ohos.util.d.ts| +|废弃版本有变化|类名:Scope<br>方法 or 属性:expand(range: Scope): Scope;<br>废弃版本:N/A|类名:Scope<br>方法 or 属性:expand(range: Scope): Scope;<br>废弃版本:9<br>代替接口:ohos.util.ScopeHelper.expand |@ohos.util.d.ts| +|废弃版本有变化|类名:Scope<br>方法 or 属性:expand(value: ScopeType): Scope;<br>废弃版本:N/A|类名:Scope<br>方法 or 属性:expand(value: ScopeType): Scope;<br>废弃版本:9<br>代替接口:ohos.util.ScopeHelper.expand |@ohos.util.d.ts| +|废弃版本有变化|类名:Scope<br>方法 or 属性:contains(value: ScopeType): boolean;<br>废弃版本:N/A|类名:Scope<br>方法 or 属性:contains(value: ScopeType): boolean;<br>废弃版本:9<br>代替接口:ohos.util.ScopeHelper.contains |@ohos.util.d.ts| +|废弃版本有变化|类名:Scope<br>方法 or 属性:contains(range: Scope): boolean;<br>废弃版本:N/A|类名:Scope<br>方法 or 属性:contains(range: Scope): boolean;<br>废弃版本:9<br>代替接口:ohos.util.ScopeHelper.contains |@ohos.util.d.ts| +|废弃版本有变化|类名:Scope<br>方法 or 属性:clamp(value: ScopeType): ScopeType;<br>废弃版本:N/A|类名:Scope<br>方法 or 属性:clamp(value: ScopeType): ScopeType;<br>废弃版本:9<br>代替接口:ohos.util.ScopeHelper.clamp |@ohos.util.d.ts| +|废弃版本有变化|类名:Base64<br>废弃版本:N/A|类名:Base64<br>废弃版本:9<br>代替接口:ohos.util.Base64Helper |@ohos.util.d.ts| +|废弃版本有变化|类名:Base64<br>方法 or 属性:constructor();<br>废弃版本:N/A|类名:Base64<br>方法 or 属性:constructor();<br>废弃版本:9<br>代替接口:ohos.util.Base64Helper.constructor |@ohos.util.d.ts| +|废弃版本有变化|类名:Base64<br>方法 or 属性:encodeSync(src: Uint8Array): Uint8Array;<br>废弃版本:N/A|类名:Base64<br>方法 or 属性:encodeSync(src: Uint8Array): Uint8Array;<br>废弃版本:9<br>代替接口:ohos.util.Base64Helper.encodeSync |@ohos.util.d.ts| +|废弃版本有变化|类名:Base64<br>方法 or 属性:encodeToStringSync(src: Uint8Array): string;<br>废弃版本:N/A|类名:Base64<br>方法 or 属性:encodeToStringSync(src: Uint8Array): string;<br>废弃版本:9<br>代替接口:ohos.util.Base64Helper.encodeToStringSync |@ohos.util.d.ts| +|废弃版本有变化|类名:Base64<br>方法 or 属性:decodeSync(src: Uint8Array \| string): Uint8Array;<br>废弃版本:N/A|类名:Base64<br>方法 or 属性:decodeSync(src: Uint8Array \| string): Uint8Array;<br>废弃版本:9<br>代替接口:ohos.util.Base64Helper.decodeSync |@ohos.util.d.ts| +|废弃版本有变化|类名:Base64<br>方法 or 属性:encode(src: Uint8Array): Promise\<Uint8Array>;<br>废弃版本:N/A|类名:Base64<br>方法 or 属性:encode(src: Uint8Array): Promise\<Uint8Array>;<br>废弃版本:9<br>代替接口:ohos.util.Base64Helper.encode |@ohos.util.d.ts| +|废弃版本有变化|类名:Base64<br>方法 or 属性:encodeToString(src: Uint8Array): Promise\<string>;<br>废弃版本:N/A|类名:Base64<br>方法 or 属性:encodeToString(src: Uint8Array): Promise\<string>;<br>废弃版本:9<br>代替接口:ohos.util.Base64Helper.encodeToString |@ohos.util.d.ts| +|废弃版本有变化|类名:Base64<br>方法 or 属性:decode(src: Uint8Array \| string): Promise\<Uint8Array>;<br>废弃版本:N/A|类名:Base64<br>方法 or 属性:decode(src: Uint8Array \| string): Promise\<Uint8Array>;<br>废弃版本:9<br>代替接口:ohos.util.Base64Helper.decode |@ohos.util.d.ts| +|废弃版本有变化|类名:Vector<br>废弃版本:N/A|类名:Vector<br>废弃版本:9<br>代替接口:ohos.util.ArrayList |@ohos.util.Vector.d.ts| +|废弃版本有变化|类名:EventListener<br>废弃版本:N/A|类名:EventListener<br>废弃版本:9<br>代替接口:ohos.worker.WorkerEventListener |@ohos.worker.d.ts| +|废弃版本有变化|类名:EventListener<br>方法 or 属性:(evt: Event): void \| Promise\<void>;<br>废弃版本:N/A|类名:EventListener<br>方法 or 属性:(evt: Event): void \| Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.worker.WorkerEventListener.|@ohos.worker.d.ts| +|废弃版本有变化|类名:EventTarget<br>废弃版本:N/A|类名:EventTarget<br>废弃版本:9<br>代替接口:ohos.worker.WorkerEventTarget |@ohos.worker.d.ts| +|废弃版本有变化|类名:EventTarget<br>方法 or 属性:addEventListener(<br><br> type: string,<br><br> listener: EventListener<br><br> ): void;<br>废弃版本:N/A|类名:EventTarget<br>方法 or 属性:addEventListener(<br><br> type: string,<br><br> listener: EventListener<br><br> ): void;<br>废弃版本:9<br>代替接口:ohos.worker.WorkerEventTarget.addEventListener |@ohos.worker.d.ts| +|废弃版本有变化|类名:EventTarget<br>方法 or 属性:dispatchEvent(event: Event): boolean;<br>废弃版本:N/A|类名:EventTarget<br>方法 or 属性:dispatchEvent(event: Event): boolean;<br>废弃版本:9<br>代替接口:ohos.worker.WorkerEventTarget.dispatchEvent |@ohos.worker.d.ts| +|废弃版本有变化|类名:EventTarget<br>方法 or 属性:removeEventListener(<br><br> type: string,<br><br> callback?: EventListener<br><br> ): void;<br>废弃版本:N/A|类名:EventTarget<br>方法 or 属性:removeEventListener(<br><br> type: string,<br><br> callback?: EventListener<br><br> ): void;<br>废弃版本:9<br>代替接口:ohos.worker.WorkerEventTarget.removeEventListener |@ohos.worker.d.ts| +|废弃版本有变化|类名:EventTarget<br>方法 or 属性:removeAllListener(): void;<br>废弃版本:N/A|类名:EventTarget<br>方法 or 属性:removeAllListener(): void;<br>废弃版本:9<br>代替接口:ohos.worker.WorkerEventTarget.removeAllListener |@ohos.worker.d.ts| +|废弃版本有变化|类名:WorkerGlobalScope<br>废弃版本:N/A|类名:WorkerGlobalScope<br>废弃版本:9<br>代替接口:ohos.worker.GlobalScope |@ohos.worker.d.ts| +|废弃版本有变化|类名:WorkerGlobalScope<br>方法 or 属性:readonly name: string;<br>废弃版本:N/A|类名:WorkerGlobalScope<br>方法 or 属性:readonly name: string;<br>废弃版本:9<br>代替接口:ohos.worker.GlobalScope.name |@ohos.worker.d.ts| +|废弃版本有变化|类名:WorkerGlobalScope<br>方法 or 属性:onerror?: (ev: ErrorEvent) => void;<br>废弃版本:N/A|类名:WorkerGlobalScope<br>方法 or 属性:onerror?: (ev: ErrorEvent) => void;<br>废弃版本:9<br>代替接口:ohos.worker.GlobalScope.onerror |@ohos.worker.d.ts| +|废弃版本有变化|类名:DedicatedWorkerGlobalScope<br>废弃版本:N/A|类名:DedicatedWorkerGlobalScope<br>废弃版本:9<br>代替接口:ohos.worker.ThreadWorkerGlobalScope |@ohos.worker.d.ts| +|废弃版本有变化|类名:DedicatedWorkerGlobalScope<br>方法 or 属性:onmessage?: (this: DedicatedWorkerGlobalScope, ev: MessageEvent) => void;<br>废弃版本:N/A|类名:DedicatedWorkerGlobalScope<br>方法 or 属性:onmessage?: (this: DedicatedWorkerGlobalScope, ev: MessageEvent) => void;<br>废弃版本:9<br>代替接口:ohos.worker.ThreadWorkerGlobalScope.onmessage |@ohos.worker.d.ts| +|废弃版本有变化|类名:DedicatedWorkerGlobalScope<br>方法 or 属性:onmessageerror?: (this: DedicatedWorkerGlobalScope, ev: MessageEvent) => void;<br>废弃版本:N/A|类名:DedicatedWorkerGlobalScope<br>方法 or 属性:onmessageerror?: (this: DedicatedWorkerGlobalScope, ev: MessageEvent) => void;<br>废弃版本:9<br>代替接口:ohos.worker.ThreadWorkerGlobalScope.onmessageerror |@ohos.worker.d.ts| +|废弃版本有变化|类名:DedicatedWorkerGlobalScope<br>方法 or 属性:close(): void;<br>废弃版本:N/A|类名:DedicatedWorkerGlobalScope<br>方法 or 属性:close(): void;<br>废弃版本:9<br>代替接口:ohos.worker.ThreadWorkerGlobalScope.close |@ohos.worker.d.ts| +|废弃版本有变化|类名:DedicatedWorkerGlobalScope<br>方法 or 属性:postMessage(messageObject: Object, transfer: Transferable[]): void;<br>废弃版本:N/A|类名:DedicatedWorkerGlobalScope<br>方法 or 属性:postMessage(messageObject: Object, transfer: Transferable[]): void;<br>废弃版本:9<br>代替接口:ohos.worker.ThreadWorkerGlobalScope.postMessage |@ohos.worker.d.ts| +|废弃版本有变化|类名:DedicatedWorkerGlobalScope<br>方法 or 属性:postMessage(messageObject: Object, options?: PostMessageOptions): void;<br>废弃版本:N/A|类名:DedicatedWorkerGlobalScope<br>方法 or 属性:postMessage(messageObject: Object, options?: PostMessageOptions): void;<br>废弃版本:9<br>代替接口:ohos.worker.ThreadWorkerGlobalScope.postMessage |@ohos.worker.d.ts| +|废弃版本有变化|类名:Worker<br>废弃版本:N/A|类名:Worker<br>废弃版本:9<br>代替接口:ohos.worker.ThreadWorker |@ohos.worker.d.ts| +|废弃版本有变化|类名:Worker<br>方法 or 属性:constructor(scriptURL: string, options?: WorkerOptions);<br>废弃版本:N/A|类名:Worker<br>方法 or 属性:constructor(scriptURL: string, options?: WorkerOptions);<br>废弃版本:9<br>代替接口:ohos.worker.ThreadWorker.constructor |@ohos.worker.d.ts| +|废弃版本有变化|类名:Worker<br>方法 or 属性:onexit?: (code: number) => void;<br>废弃版本:N/A|类名:Worker<br>方法 or 属性:onexit?: (code: number) => void;<br>废弃版本:9<br>代替接口:ohos.worker.ThreadWorker.onexit |@ohos.worker.d.ts| +|废弃版本有变化|类名:Worker<br>方法 or 属性:onerror?: (err: ErrorEvent) => void;<br>废弃版本:N/A|类名:Worker<br>方法 or 属性:onerror?: (err: ErrorEvent) => void;<br>废弃版本:9<br>代替接口:ohos.worker.ThreadWorker.onerror |@ohos.worker.d.ts| +|废弃版本有变化|类名:Worker<br>方法 or 属性:onmessage?: (event: MessageEvent) => void;<br>废弃版本:N/A|类名:Worker<br>方法 or 属性:onmessage?: (event: MessageEvent) => void;<br>废弃版本:9<br>代替接口:ohos.worker.ThreadWorker.onmessage |@ohos.worker.d.ts| +|废弃版本有变化|类名:Worker<br>方法 or 属性:onmessageerror?: (event: MessageEvent) => void;<br>废弃版本:N/A|类名:Worker<br>方法 or 属性:onmessageerror?: (event: MessageEvent) => void;<br>废弃版本:9<br>代替接口:ohos.worker.ThreadWorker.onmessageerror |@ohos.worker.d.ts| +|废弃版本有变化|类名:Worker<br>方法 or 属性:postMessage(message: Object, transfer: ArrayBuffer[]): void;<br>废弃版本:N/A|类名:Worker<br>方法 or 属性:postMessage(message: Object, transfer: ArrayBuffer[]): void;<br>废弃版本:9<br>代替接口:ohos.worker.ThreadWorker.postMessage |@ohos.worker.d.ts| +|废弃版本有变化|类名:Worker<br>方法 or 属性:postMessage(message: Object, options?: PostMessageOptions): void;<br>废弃版本:N/A|类名:Worker<br>方法 or 属性:postMessage(message: Object, options?: PostMessageOptions): void;<br>废弃版本:9<br>代替接口:ohos.worker.ThreadWorker.postMessage |@ohos.worker.d.ts| +|废弃版本有变化|类名:Worker<br>方法 or 属性:on(type: string, listener: EventListener): void;<br>废弃版本:N/A|类名:Worker<br>方法 or 属性:on(type: string, listener: EventListener): void;<br>废弃版本:9<br>代替接口:ohos.worker.ThreadWorker.on |@ohos.worker.d.ts| +|废弃版本有变化|类名:Worker<br>方法 or 属性:once(type: string, listener: EventListener): void;<br>废弃版本:N/A|类名:Worker<br>方法 or 属性:once(type: string, listener: EventListener): void;<br>废弃版本:9<br>代替接口:ohos.worker.ThreadWorker.once |@ohos.worker.d.ts| +|废弃版本有变化|类名:Worker<br>方法 or 属性:off(type: string, listener?: EventListener): void;<br>废弃版本:N/A|类名:Worker<br>方法 or 属性:off(type: string, listener?: EventListener): void;<br>废弃版本:9<br>代替接口:ohos.worker.ThreadWorker.off |@ohos.worker.d.ts| +|废弃版本有变化|类名:Worker<br>方法 or 属性:terminate(): void;<br>废弃版本:N/A|类名:Worker<br>方法 or 属性:terminate(): void;<br>废弃版本:9<br>代替接口:ohos.worker.ThreadWorker.terminate |@ohos.worker.d.ts| +|废弃版本有变化|类名:worker<br>方法 or 属性:const parentPort: DedicatedWorkerGlobalScope;<br>废弃版本:N/A|类名:worker<br>方法 or 属性:const parentPort: DedicatedWorkerGlobalScope;<br>废弃版本:9<br>代替接口:ohos.worker.workerPort |@ohos.worker.d.ts| +|起始版本有变化|类名:ConvertXML<br>起始版本:N/A|类名:ConvertXML<br>起始版本:8|@ohos.convertxml.d.ts| +|起始版本有变化|类名:ChildProcess<br>起始版本:N/A|类名:ChildProcess<br>起始版本:7|@ohos.process.d.ts| +|起始版本有变化|类名:URI<br>起始版本:N/A|类名:URI<br>起始版本:8|@ohos.uri.d.ts| +|起始版本有变化|类名:URLSearchParams<br>起始版本:N/A|类名:URLSearchParams<br>起始版本:7|@ohos.url.d.ts| +|起始版本有变化|类名:URL<br>起始版本:N/A|类名:URL<br>起始版本:7|@ohos.url.d.ts| +|起始版本有变化|类名:URL<br>方法 or 属性:constructor(url: string, base?: string \| URL);<br>起始版本:N/A|类名:URL<br>方法 or 属性:constructor(url: string, base?: string \| URL);<br>起始版本:7|@ohos.url.d.ts| +|起始版本有变化|类名:TextDecoder<br>起始版本:N/A|类名:TextDecoder<br>起始版本:7|@ohos.util.d.ts| +|起始版本有变化|类名:TextDecoder<br>方法 or 属性:constructor(<br><br> encoding?: string,<br><br> options?: { fatal?: boolean; ignoreBOM?: boolean },<br><br> );<br>起始版本:N/A|类名:TextDecoder<br>方法 or 属性:constructor(<br><br> encoding?: string,<br><br> options?: { fatal?: boolean; ignoreBOM?: boolean },<br><br> );<br>起始版本:7|@ohos.util.d.ts| +|起始版本有变化|类名:TextEncoder<br>起始版本:N/A|类名:TextEncoder<br>起始版本:7|@ohos.util.d.ts| +|起始版本有变化|类名:RationalNumber<br>起始版本:N/A|类名:RationalNumber<br>起始版本:8|@ohos.util.d.ts| +|起始版本有变化|类名:LruBuffer<br>起始版本:N/A|类名:LruBuffer<br>起始版本:8|@ohos.util.d.ts| +|起始版本有变化|类名:Scope<br>起始版本:N/A|类名:Scope<br>起始版本:8|@ohos.util.d.ts| +|起始版本有变化|类名:Base64<br>起始版本:N/A|类名:Base64<br>起始版本:8|@ohos.util.d.ts| +|起始版本有变化|类名:types<br>起始版本:N/A|类名:types<br>起始版本:8|@ohos.util.d.ts| +|起始版本有变化|类名:Vector<br>起始版本:N/A|类名:Vector<br>起始版本:8|@ohos.util.Vector.d.ts| +|起始版本有变化|类名:Worker<br>起始版本:N/A|类名:Worker<br>起始版本:7|@ohos.worker.d.ts| +|起始版本有变化|类名:worker<br>方法 or 属性:const parentPort: DedicatedWorkerGlobalScope;<br>起始版本:N/A|类名:worker<br>方法 or 属性:const parentPort: DedicatedWorkerGlobalScope;<br>起始版本:7|@ohos.worker.d.ts| +|起始版本有变化|类名:XmlSerializer<br>起始版本:N/A|类名:XmlSerializer<br>起始版本:8|@ohos.xml.d.ts| +|起始版本有变化|类名:XmlPullParser<br>起始版本:N/A|类名:XmlPullParser<br>起始版本:8|@ohos.xml.d.ts| +|新增(错误码)|NA|类名:URI<br>方法 or 属性:constructor(uri: string);<br>错误码内容: 401, 10200002|@ohos.uri.d.ts| +|新增(错误码)|NA|类名:ArrayList<br>方法 or 属性:constructor();<br>错误码内容: 10200012|@ohos.util.ArrayList.d.ts| +|新增(错误码)|NA|类名:ArrayList<br>方法 or 属性:add(element: T): boolean;<br>错误码内容: 10200011|@ohos.util.ArrayList.d.ts| +|新增(错误码)|NA|类名:ArrayList<br>方法 or 属性:insert(element: T, index: number): void;<br>错误码内容: 10200001, 10200011, 401|@ohos.util.ArrayList.d.ts| +|新增(错误码)|NA|类名:ArrayList<br>方法 or 属性:has(element: T): boolean;<br>错误码内容: 10200011|@ohos.util.ArrayList.d.ts| +|新增(错误码)|NA|类名:ArrayList<br>方法 or 属性:getIndexOf(element: T): number;<br>错误码内容: 10200011|@ohos.util.ArrayList.d.ts| +|新增(错误码)|NA|类名:ArrayList<br>方法 or 属性:removeByIndex(index: number): T;<br>错误码内容: 10200001, 10200011, 401|@ohos.util.ArrayList.d.ts| +|新增(错误码)|NA|类名:ArrayList<br>方法 or 属性:remove(element: T): boolean;<br>错误码内容: 10200011|@ohos.util.ArrayList.d.ts| +|新增(错误码)|NA|类名:ArrayList<br>方法 or 属性:getLastIndexOf(element: T): number;<br>错误码内容: 10200011|@ohos.util.ArrayList.d.ts| +|新增(错误码)|NA|类名:ArrayList<br>方法 or 属性:removeByRange(fromIndex: number, toIndex: number): void;<br>错误码内容: 10200001, 10200011, 401|@ohos.util.ArrayList.d.ts| +|新增(错误码)|NA|类名:ArrayList<br>方法 or 属性:sort(comparator?: (firstValue: T, secondValue: T) => number): void;<br>错误码内容: 10200011, 401|@ohos.util.ArrayList.d.ts| +|新增(错误码)|NA|类名:ArrayList<br>方法 or 属性:subArrayList(fromIndex: number, toIndex: number): ArrayList\<T>;<br>错误码内容: 10200001, 10200011, 401|@ohos.util.ArrayList.d.ts| +|新增(错误码)|NA|类名:ArrayList<br>方法 or 属性:clear(): void;<br>错误码内容: 10200011|@ohos.util.ArrayList.d.ts| +|新增(错误码)|NA|类名:ArrayList<br>方法 or 属性:clone(): ArrayList\<T>;<br>错误码内容: 10200011|@ohos.util.ArrayList.d.ts| +|新增(错误码)|NA|类名:ArrayList<br>方法 or 属性:getCapacity(): number;<br>错误码内容: 10200011|@ohos.util.ArrayList.d.ts| +|新增(错误码)|NA|类名:ArrayList<br>方法 or 属性:convertToArray(): Array\<T>;<br>错误码内容: 10200011|@ohos.util.ArrayList.d.ts| +|新增(错误码)|NA|类名:ArrayList<br>方法 or 属性:isEmpty(): boolean;<br>错误码内容: 10200011|@ohos.util.ArrayList.d.ts| +|新增(错误码)|NA|类名:ArrayList<br>方法 or 属性:increaseCapacityTo(newCapacity: number): void;<br>错误码内容: 10200011, 401|@ohos.util.ArrayList.d.ts| +|新增(错误码)|NA|类名:ArrayList<br>方法 or 属性:trimToCurrentLength(): void;<br>错误码内容: 10200011|@ohos.util.ArrayList.d.ts| +|新增(错误码)|NA|类名:ArrayList<br>方法 or 属性:[Symbol.iterator](): IterableIterator\<T>;<br>错误码内容: 10200011|@ohos.util.ArrayList.d.ts| +|新增(错误码)|NA|类名:util<br>方法 or 属性:function callbackWrapper(original: Function): (err: Object, value: Object) => void;<br>错误码内容: 401|@ohos.util.d.ts| +|新增(错误码)|NA|类名:RationalNumber<br>方法 or 属性:static createRationalFromString(rationalString: string): RationalNumber​;<br>错误码内容: 401|@ohos.util.d.ts| +|新增(错误码)|NA|类名:Deque<br>方法 or 属性:constructor();<br>错误码内容: 10200012|@ohos.util.Deque.d.ts| +|新增(错误码)|NA|类名:Deque<br>方法 or 属性:insertFront(element: T): void;<br>错误码内容: 10200011|@ohos.util.Deque.d.ts| +|新增(错误码)|NA|类名:Deque<br>方法 or 属性:insertEnd(element: T): void;<br>错误码内容: 10200011|@ohos.util.Deque.d.ts| +|新增(错误码)|NA|类名:Deque<br>方法 or 属性:has(element: T): boolean;<br>错误码内容: 10200011|@ohos.util.Deque.d.ts| +|新增(错误码)|NA|类名:Deque<br>方法 or 属性:getFirst(): T;<br>错误码内容: 10200011|@ohos.util.Deque.d.ts| +|新增(错误码)|NA|类名:Deque<br>方法 or 属性:getLast(): T;<br>错误码内容: 10200011|@ohos.util.Deque.d.ts| +|新增(错误码)|NA|类名:Deque<br>方法 or 属性:popFirst(): T;<br>错误码内容: 10200011|@ohos.util.Deque.d.ts| +|新增(错误码)|NA|类名:Deque<br>方法 or 属性:popLast(): T;<br>错误码内容: 10200011|@ohos.util.Deque.d.ts| +|新增(错误码)|NA|类名:Deque<br>方法 or 属性:[Symbol.iterator](): IterableIterator\<T>;<br>错误码内容: 10200011|@ohos.util.Deque.d.ts| +|新增(错误码)|NA|类名:HashMap<br>方法 or 属性:constructor();<br>错误码内容: 10200012|@ohos.util.HashMap.d.ts| +|新增(错误码)|NA|类名:HashMap<br>方法 or 属性:isEmpty(): boolean;<br>错误码内容: 10200011|@ohos.util.HashMap.d.ts| +|新增(错误码)|NA|类名:HashMap<br>方法 or 属性:hasKey(key: K): boolean;<br>错误码内容: 10200011|@ohos.util.HashMap.d.ts| +|新增(错误码)|NA|类名:HashMap<br>方法 or 属性:hasValue(value: V): boolean;<br>错误码内容: 10200011|@ohos.util.HashMap.d.ts| +|新增(错误码)|NA|类名:HashMap<br>方法 or 属性:get(key: K): V;<br>错误码内容: 10200011|@ohos.util.HashMap.d.ts| +|新增(错误码)|NA|类名:HashMap<br>方法 or 属性:setAll(map: HashMap\<K, V>): void;<br>错误码内容: 10200011, 401|@ohos.util.HashMap.d.ts| +|新增(错误码)|NA|类名:HashMap<br>方法 or 属性:set(key: K, value: V): Object;<br>错误码内容: 10200011, 401|@ohos.util.HashMap.d.ts| +|新增(错误码)|NA|类名:HashMap<br>方法 or 属性:remove(key: K): V;<br>错误码内容: 10200011|@ohos.util.HashMap.d.ts| +|新增(错误码)|NA|类名:HashMap<br>方法 or 属性:clear(): void;<br>错误码内容: 10200011|@ohos.util.HashMap.d.ts| +|新增(错误码)|NA|类名:HashMap<br>方法 or 属性:keys(): IterableIterator\<K>;<br>错误码内容: 10200011|@ohos.util.HashMap.d.ts| +|新增(错误码)|NA|类名:HashMap<br>方法 or 属性:values(): IterableIterator\<V>;<br>错误码内容: 10200011|@ohos.util.HashMap.d.ts| +|新增(错误码)|NA|类名:HashMap<br>方法 or 属性:replace(key: K, newValue: V): boolean;<br>错误码内容: 10200011|@ohos.util.HashMap.d.ts| +|新增(错误码)|NA|类名:HashMap<br>方法 or 属性:entries(): IterableIterator\<[K, V]>;<br>错误码内容: 10200011|@ohos.util.HashMap.d.ts| +|新增(错误码)|NA|类名:HashMap<br>方法 or 属性:[Symbol.iterator](): IterableIterator\<[K, V]>;<br>错误码内容: 10200011|@ohos.util.HashMap.d.ts| +|新增(错误码)|NA|类名:HashSet<br>方法 or 属性:constructor();<br>错误码内容: 10200012|@ohos.util.HashSet.d.ts| +|新增(错误码)|NA|类名:HashSet<br>方法 or 属性:isEmpty(): boolean;<br>错误码内容: 10200011|@ohos.util.HashSet.d.ts| +|新增(错误码)|NA|类名:HashSet<br>方法 or 属性:has(value: T): boolean;<br>错误码内容: 10200011, 401|@ohos.util.HashSet.d.ts| +|新增(错误码)|NA|类名:HashSet<br>方法 or 属性:add(value: T): boolean;<br>错误码内容: 10200011, 401|@ohos.util.HashSet.d.ts| +|新增(错误码)|NA|类名:HashSet<br>方法 or 属性:remove(value: T): boolean;<br>错误码内容: 10200011, 401|@ohos.util.HashSet.d.ts| +|新增(错误码)|NA|类名:HashSet<br>方法 or 属性:clear(): void;<br>错误码内容: 10200011|@ohos.util.HashSet.d.ts| +|新增(错误码)|NA|类名:HashSet<br>方法 or 属性:values(): IterableIterator\<T>;<br>错误码内容: 10200011|@ohos.util.HashSet.d.ts| +|新增(错误码)|NA|类名:HashSet<br>方法 or 属性:entries(): IterableIterator\<[T, T]>;<br>错误码内容: 10200011|@ohos.util.HashSet.d.ts| +|新增(错误码)|NA|类名:HashSet<br>方法 or 属性:[Symbol.iterator](): IterableIterator\<T>;<br>错误码内容: 10200011|@ohos.util.HashSet.d.ts| +|新增(错误码)|NA|类名:LightWeightMap<br>方法 or 属性:constructor();<br>错误码内容: 10200012|@ohos.util.LightWeightMap.d.ts| +|新增(错误码)|NA|类名:LightWeightMap<br>方法 or 属性:hasAll(map: LightWeightMap\<K, V>): boolean;<br>错误码内容: 401, 10200011|@ohos.util.LightWeightMap.d.ts| +|新增(错误码)|NA|类名:LightWeightMap<br>方法 or 属性:hasKey(key: K): boolean;<br>错误码内容: 10200011|@ohos.util.LightWeightMap.d.ts| +|新增(错误码)|NA|类名:LightWeightMap<br>方法 or 属性:hasValue(value: V): boolean;<br>错误码内容: 10200011|@ohos.util.LightWeightMap.d.ts| +|新增(错误码)|NA|类名:LightWeightMap<br>方法 or 属性:increaseCapacityTo(minimumCapacity: number): void;<br>错误码内容: 10200011, 401|@ohos.util.LightWeightMap.d.ts| +|新增(错误码)|NA|类名:LightWeightMap<br>方法 or 属性:entries(): IterableIterator\<[K, V]>;<br>错误码内容: 10200011|@ohos.util.LightWeightMap.d.ts| +|新增(错误码)|NA|类名:LightWeightMap<br>方法 or 属性:get(key: K): V;<br>错误码内容: 10200011|@ohos.util.LightWeightMap.d.ts| +|新增(错误码)|NA|类名:LightWeightMap<br>方法 or 属性:getIndexOfKey(key: K): number;<br>错误码内容: 10200011|@ohos.util.LightWeightMap.d.ts| +|新增(错误码)|NA|类名:LightWeightMap<br>方法 or 属性:getIndexOfValue(value: V): number;<br>错误码内容: 10200011|@ohos.util.LightWeightMap.d.ts| +|新增(错误码)|NA|类名:LightWeightMap<br>方法 or 属性:isEmpty(): boolean;<br>错误码内容: 10200011|@ohos.util.LightWeightMap.d.ts| +|新增(错误码)|NA|类名:LightWeightMap<br>方法 or 属性:getKeyAt(index: number): K;<br>错误码内容: 10200011, 10200001, 401|@ohos.util.LightWeightMap.d.ts| +|新增(错误码)|NA|类名:LightWeightMap<br>方法 or 属性:keys(): IterableIterator\<K>;<br>错误码内容: 10200011|@ohos.util.LightWeightMap.d.ts| +|新增(错误码)|NA|类名:LightWeightMap<br>方法 or 属性:setAll(map: LightWeightMap\<K, V>): void;<br>错误码内容: 10200011, 401|@ohos.util.LightWeightMap.d.ts| +|新增(错误码)|NA|类名:LightWeightMap<br>方法 or 属性:set(key: K, value: V): Object;<br>错误码内容: 10200011|@ohos.util.LightWeightMap.d.ts| +|新增(错误码)|NA|类名:LightWeightMap<br>方法 or 属性:remove(key: K): V;<br>错误码内容: 10200011|@ohos.util.LightWeightMap.d.ts| +|新增(错误码)|NA|类名:LightWeightMap<br>方法 or 属性:removeAt(index: number): boolean;<br>错误码内容: 10200011, 401|@ohos.util.LightWeightMap.d.ts| +|新增(错误码)|NA|类名:LightWeightMap<br>方法 or 属性:clear(): void;<br>错误码内容: 10200011|@ohos.util.LightWeightMap.d.ts| +|新增(错误码)|NA|类名:LightWeightMap<br>方法 or 属性:setValueAt(index: number, newValue: V): boolean;<br>错误码内容: 10200011, 10200001, 401|@ohos.util.LightWeightMap.d.ts| +|新增(错误码)|NA|类名:LightWeightMap<br>方法 or 属性:[Symbol.iterator](): IterableIterator\<[K, V]>;<br>错误码内容: 10200011|@ohos.util.LightWeightMap.d.ts| +|新增(错误码)|NA|类名:LightWeightMap<br>方法 or 属性:toString(): String;<br>错误码内容: 10200011|@ohos.util.LightWeightMap.d.ts| +|新增(错误码)|NA|类名:LightWeightMap<br>方法 or 属性:getValueAt(index: number): V;<br>错误码内容: 10200011, 10200001, 401|@ohos.util.LightWeightMap.d.ts| +|新增(错误码)|NA|类名:LightWeightMap<br>方法 or 属性:values(): IterableIterator\<V>;<br>错误码内容: 10200011|@ohos.util.LightWeightMap.d.ts| +|新增(错误码)|NA|类名:LightWeightSet<br>方法 or 属性:constructor();<br>错误码内容: 10200012|@ohos.util.LightWeightSet.d.ts| +|新增(错误码)|NA|类名:LightWeightSet<br>方法 or 属性:add(obj: T): boolean;<br>错误码内容: 10200011|@ohos.util.LightWeightSet.d.ts| +|新增(错误码)|NA|类名:LightWeightSet<br>方法 or 属性:addAll(set: LightWeightSet\<T>): boolean;<br>错误码内容: 10200011, 401|@ohos.util.LightWeightSet.d.ts| +|新增(错误码)|NA|类名:LightWeightSet<br>方法 or 属性:hasAll(set: LightWeightSet\<T>): boolean;<br>错误码内容: 10200011, 401|@ohos.util.LightWeightSet.d.ts| +|新增(错误码)|NA|类名:LightWeightSet<br>方法 or 属性:has(key: T): boolean;<br>错误码内容: 10200011|@ohos.util.LightWeightSet.d.ts| +|新增(错误码)|NA|类名:LightWeightSet<br>方法 or 属性:equal(obj: Object): boolean;<br>错误码内容: 10200011|@ohos.util.LightWeightSet.d.ts| +|新增(错误码)|NA|类名:LightWeightSet<br>方法 or 属性:increaseCapacityTo(minimumCapacity: number): void;<br>错误码内容: 10200011, 401, 10200001|@ohos.util.LightWeightSet.d.ts| +|新增(错误码)|NA|类名:LightWeightSet<br>方法 or 属性:getIndexOf(key: T): number;<br>错误码内容: 10200011|@ohos.util.LightWeightSet.d.ts| +|新增(错误码)|NA|类名:LightWeightSet<br>方法 or 属性:remove(key: T): T;<br>错误码内容: 10200011|@ohos.util.LightWeightSet.d.ts| +|新增(错误码)|NA|类名:LightWeightSet<br>方法 or 属性:removeAt(index: number): boolean;<br>错误码内容: 10200011, 401|@ohos.util.LightWeightSet.d.ts| +|新增(错误码)|NA|类名:LightWeightSet<br>方法 or 属性:clear(): void;<br>错误码内容: 10200011|@ohos.util.LightWeightSet.d.ts| +|新增(错误码)|NA|类名:LightWeightSet<br>方法 or 属性:[Symbol.iterator](): IterableIterator\<T>;<br>错误码内容: 10200011|@ohos.util.LightWeightSet.d.ts| +|新增(错误码)|NA|类名:LightWeightSet<br>方法 or 属性:toArray(): Array\<T>;<br>错误码内容: 10200011|@ohos.util.LightWeightSet.d.ts| +|新增(错误码)|NA|类名:LightWeightSet<br>方法 or 属性:getValueAt(index: number): T;<br>错误码内容: 10200011, 401|@ohos.util.LightWeightSet.d.ts| +|新增(错误码)|NA|类名:LightWeightSet<br>方法 or 属性:values(): IterableIterator\<T>;<br>错误码内容: 10200011|@ohos.util.LightWeightSet.d.ts| +|新增(错误码)|NA|类名:LightWeightSet<br>方法 or 属性:entries(): IterableIterator\<[T, T]>;<br>错误码内容: 10200011|@ohos.util.LightWeightSet.d.ts| +|新增(错误码)|NA|类名:LightWeightSet<br>方法 or 属性:isEmpty(): boolean;<br>错误码内容: 10200011|@ohos.util.LightWeightSet.d.ts| +|新增(错误码)|NA|类名:LinkedList<br>方法 or 属性:constructor();<br>错误码内容: 10200012|@ohos.util.LinkedList.d.ts| +|新增(错误码)|NA|类名:LinkedList<br>方法 or 属性:add(element: T): boolean;<br>错误码内容: 10200011|@ohos.util.LinkedList.d.ts| +|新增(错误码)|NA|类名:LinkedList<br>方法 or 属性:insert(index: number, element: T): void;<br>错误码内容: 10200011, 401, 10200001|@ohos.util.LinkedList.d.ts| +|新增(错误码)|NA|类名:LinkedList<br>方法 or 属性:get(index: number): T;<br>错误码内容: 10200011, 401|@ohos.util.LinkedList.d.ts| +|新增(错误码)|NA|类名:LinkedList<br>方法 or 属性:addFirst(element: T): void;<br>错误码内容: 10200011|@ohos.util.LinkedList.d.ts| +|新增(错误码)|NA|类名:LinkedList<br>方法 or 属性:removeFirst(): T;<br>错误码内容: 10200011, 10200010|@ohos.util.LinkedList.d.ts| +|新增(错误码)|NA|类名:LinkedList<br>方法 or 属性:removeLast(): T;<br>错误码内容: 10200011, 10200010|@ohos.util.LinkedList.d.ts| +|新增(错误码)|NA|类名:LinkedList<br>方法 or 属性:has(element: T): boolean;<br>错误码内容: 10200011|@ohos.util.LinkedList.d.ts| +|新增(错误码)|NA|类名:LinkedList<br>方法 or 属性:getIndexOf(element: T): number;<br>错误码内容: 10200011|@ohos.util.LinkedList.d.ts| +|新增(错误码)|NA|类名:LinkedList<br>方法 or 属性:removeByIndex(index: number): T;<br>错误码内容: 10200011, 401, 10200001|@ohos.util.LinkedList.d.ts| +|新增(错误码)|NA|类名:LinkedList<br>方法 or 属性:remove(element: T): boolean;<br>错误码内容: 10200011|@ohos.util.LinkedList.d.ts| +|新增(错误码)|NA|类名:LinkedList<br>方法 or 属性:removeFirstFound(element: T): boolean;<br>错误码内容: 10200011, 10200010, 10200017|@ohos.util.LinkedList.d.ts| +|新增(错误码)|NA|类名:LinkedList<br>方法 or 属性:removeLastFound(element: T): boolean;<br>错误码内容: 10200011, 10200010, 10200017|@ohos.util.LinkedList.d.ts| +|新增(错误码)|NA|类名:LinkedList<br>方法 or 属性:getLastIndexOf(element: T): number;<br>错误码内容: 10200011|@ohos.util.LinkedList.d.ts| +|新增(错误码)|NA|类名:LinkedList<br>方法 or 属性:getFirst(): T;<br>错误码内容: 10200011|@ohos.util.LinkedList.d.ts| +|新增(错误码)|NA|类名:LinkedList<br>方法 or 属性:getLast(): T;<br>错误码内容: 10200011|@ohos.util.LinkedList.d.ts| +|新增(错误码)|NA|类名:LinkedList<br>方法 or 属性:set(index: number, element: T): T;<br>错误码内容: 10200011, 10200001, 401|@ohos.util.LinkedList.d.ts| +|新增(错误码)|NA|类名:LinkedList<br>方法 or 属性:clear(): void;<br>错误码内容: 10200011|@ohos.util.LinkedList.d.ts| +|新增(错误码)|NA|类名:LinkedList<br>方法 or 属性:clone(): LinkedList\<T>;<br>错误码内容: 10200011|@ohos.util.LinkedList.d.ts| +|新增(错误码)|NA|类名:LinkedList<br>方法 or 属性:convertToArray(): Array\<T>;<br>错误码内容: 10200011|@ohos.util.LinkedList.d.ts| +|新增(错误码)|NA|类名:LinkedList<br>方法 or 属性:[Symbol.iterator](): IterableIterator\<T>;<br>错误码内容: 10200011|@ohos.util.LinkedList.d.ts| +|新增(错误码)|NA|类名:List<br>方法 or 属性:constructor();<br>错误码内容: 10200012|@ohos.util.List.d.ts| +|新增(错误码)|NA|类名:List<br>方法 or 属性:add(element: T): boolean;<br>错误码内容: 10200011|@ohos.util.List.d.ts| +|新增(错误码)|NA|类名:List<br>方法 or 属性:insert(element: T, index: number): void;<br>错误码内容: 10200011, 10200001, 401|@ohos.util.List.d.ts| +|新增(错误码)|NA|类名:List<br>方法 or 属性:get(index: number): T;<br>错误码内容: 10200011, 401|@ohos.util.List.d.ts| +|新增(错误码)|NA|类名:List<br>方法 or 属性:has(element: T): boolean;<br>错误码内容: 10200011|@ohos.util.List.d.ts| +|新增(错误码)|NA|类名:List<br>方法 or 属性:getIndexOf(element: T): number;<br>错误码内容: 10200011|@ohos.util.List.d.ts| +|新增(错误码)|NA|类名:List<br>方法 or 属性:removeByIndex(index: number): T;<br>错误码内容: 10200011, 10200001, 401|@ohos.util.List.d.ts| +|新增(错误码)|NA|类名:List<br>方法 or 属性:remove(element: T): boolean;<br>错误码内容: 10200011|@ohos.util.List.d.ts| +|新增(错误码)|NA|类名:List<br>方法 or 属性:getLastIndexOf(element: T): number;<br>错误码内容: 10200011|@ohos.util.List.d.ts| +|新增(错误码)|NA|类名:List<br>方法 or 属性:getFirst(): T;<br>错误码内容: 10200011|@ohos.util.List.d.ts| +|新增(错误码)|NA|类名:List<br>方法 or 属性:getLast(): T;<br>错误码内容: 10200011|@ohos.util.List.d.ts| +|新增(错误码)|NA|类名:List<br>方法 or 属性:set(index: number, element: T): T;<br>错误码内容: 10200011, 10200001, 401|@ohos.util.List.d.ts| +|新增(错误码)|NA|类名:List<br>方法 or 属性:equal(obj: Object): boolean;<br>错误码内容: 10200011|@ohos.util.List.d.ts| +|新增(错误码)|NA|类名:List<br>方法 or 属性:sort(comparator: (firstValue: T, secondValue: T) => number): void;<br>错误码内容: 401, 10200011|@ohos.util.List.d.ts| +|新增(错误码)|NA|类名:List<br>方法 or 属性:clear(): void;<br>错误码内容: 10200011|@ohos.util.List.d.ts| +|新增(错误码)|NA|类名:List<br>方法 or 属性:getSubList(fromIndex: number, toIndex: number): List\<T>;<br>错误码内容: 10200011, 10200001, 401|@ohos.util.List.d.ts| +|新增(错误码)|NA|类名:List<br>方法 or 属性:convertToArray(): Array\<T>;<br>错误码内容: 10200011|@ohos.util.List.d.ts| +|新增(错误码)|NA|类名:List<br>方法 or 属性:isEmpty(): boolean;<br>错误码内容: 10200011|@ohos.util.List.d.ts| +|新增(错误码)|NA|类名:List<br>方法 or 属性:[Symbol.iterator](): IterableIterator\<T>;<br>错误码内容: 10200011|@ohos.util.List.d.ts| +|新增(错误码)|NA|类名:PlainArray<br>方法 or 属性:constructor();<br>错误码内容: 10200012|@ohos.util.PlainArray.d.ts| +|新增(错误码)|NA|类名:PlainArray<br>方法 or 属性:add(key: number, value: T): void;<br>错误码内容: 10200011, 401|@ohos.util.PlainArray.d.ts| +|新增(错误码)|NA|类名:PlainArray<br>方法 or 属性:clear(): void;<br>错误码内容: 10200011|@ohos.util.PlainArray.d.ts| +|新增(错误码)|NA|类名:PlainArray<br>方法 or 属性:clone(): PlainArray\<T>;<br>错误码内容: 10200011|@ohos.util.PlainArray.d.ts| +|新增(错误码)|NA|类名:PlainArray<br>方法 or 属性:has(key: number): boolean;<br>错误码内容: 10200011, 401|@ohos.util.PlainArray.d.ts| +|新增(错误码)|NA|类名:PlainArray<br>方法 or 属性:get(key: number): T;<br>错误码内容: 10200011, 401|@ohos.util.PlainArray.d.ts| +|新增(错误码)|NA|类名:PlainArray<br>方法 or 属性:getIndexOfKey(key: number): number;<br>错误码内容: 10200011, 401|@ohos.util.PlainArray.d.ts| +|新增(错误码)|NA|类名:PlainArray<br>方法 or 属性:getIndexOfValue(value: T): number;<br>错误码内容: 10200011|@ohos.util.PlainArray.d.ts| +|新增(错误码)|NA|类名:PlainArray<br>方法 or 属性:isEmpty(): boolean;<br>错误码内容: 10200011|@ohos.util.PlainArray.d.ts| +|新增(错误码)|NA|类名:PlainArray<br>方法 or 属性:getKeyAt(index: number): number;<br>错误码内容: 10200011, 401|@ohos.util.PlainArray.d.ts| +|新增(错误码)|NA|类名:PlainArray<br>方法 or 属性:remove(key: number): T;<br>错误码内容: 10200011, 401|@ohos.util.PlainArray.d.ts| +|新增(错误码)|NA|类名:PlainArray<br>方法 or 属性:removeAt(index: number): T;<br>错误码内容: 10200011, 401|@ohos.util.PlainArray.d.ts| +|新增(错误码)|NA|类名:PlainArray<br>方法 or 属性:removeRangeFrom(index: number, size: number): number;<br>错误码内容: 10200011, 10200001, 401|@ohos.util.PlainArray.d.ts| +|新增(错误码)|NA|类名:PlainArray<br>方法 or 属性:setValueAt(index: number, value: T): void;<br>错误码内容: 10200011, 10200001, 401|@ohos.util.PlainArray.d.ts| +|新增(错误码)|NA|类名:PlainArray<br>方法 or 属性:toString(): String;<br>错误码内容: 10200011|@ohos.util.PlainArray.d.ts| +|新增(错误码)|NA|类名:PlainArray<br>方法 or 属性:getValueAt(index: number): T;<br>错误码内容: 10200011, 10200001, 401|@ohos.util.PlainArray.d.ts| +|新增(错误码)|NA|类名:PlainArray<br>方法 or 属性:[Symbol.iterator](): IterableIterator\<[number, T]>;<br>错误码内容: 10200011|@ohos.util.PlainArray.d.ts| +|新增(错误码)|NA|类名:Queue<br>方法 or 属性:constructor();<br>错误码内容: 10200012|@ohos.util.Queue.d.ts| +|新增(错误码)|NA|类名:Queue<br>方法 or 属性:add(element: T): boolean;<br>错误码内容: 10200011|@ohos.util.Queue.d.ts| +|新增(错误码)|NA|类名:Queue<br>方法 or 属性:getFirst(): T;<br>错误码内容: 10200011|@ohos.util.Queue.d.ts| +|新增(错误码)|NA|类名:Queue<br>方法 or 属性:pop(): T;<br>错误码内容: 10200011|@ohos.util.Queue.d.ts| +|新增(错误码)|NA|类名:Queue<br>方法 or 属性:[Symbol.iterator](): IterableIterator\<T>;<br>错误码内容: 10200011|@ohos.util.Queue.d.ts| +|新增(错误码)|NA|类名:Stack<br>方法 or 属性:constructor();<br>错误码内容: 10200012|@ohos.util.Stack.d.ts| +|新增(错误码)|NA|类名:Stack<br>方法 or 属性:isEmpty(): boolean;<br>错误码内容: 10200011|@ohos.util.Stack.d.ts| +|新增(错误码)|NA|类名:Stack<br>方法 or 属性:peek(): T;<br>错误码内容: 10200011|@ohos.util.Stack.d.ts| +|新增(错误码)|NA|类名:Stack<br>方法 or 属性:pop(): T;<br>错误码内容: 10200011|@ohos.util.Stack.d.ts| +|新增(错误码)|NA|类名:Stack<br>方法 or 属性:push(item: T): T;<br>错误码内容: 10200011|@ohos.util.Stack.d.ts| +|新增(错误码)|NA|类名:Stack<br>方法 or 属性:locate(element: T): number;<br>错误码内容: 10200011|@ohos.util.Stack.d.ts| +|新增(错误码)|NA|类名:Stack<br>方法 or 属性:[Symbol.iterator](): IterableIterator\<T>;<br>错误码内容: 10200011|@ohos.util.Stack.d.ts| +|新增(错误码)|NA|类名:TreeMap<br>方法 or 属性:constructor(comparator?: (firstValue: K, secondValue: K) => boolean);<br>错误码内容: 10200012, 401|@ohos.util.TreeMap.d.ts| +|新增(错误码)|NA|类名:TreeMap<br>方法 or 属性:isEmpty(): boolean;<br>错误码内容: 10200011|@ohos.util.TreeMap.d.ts| +|新增(错误码)|NA|类名:TreeMap<br>方法 or 属性:hasKey(key: K): boolean;<br>错误码内容: 10200011|@ohos.util.TreeMap.d.ts| +|新增(错误码)|NA|类名:TreeMap<br>方法 or 属性:hasValue(value: V): boolean;<br>错误码内容: 10200011|@ohos.util.TreeMap.d.ts| +|新增(错误码)|NA|类名:TreeMap<br>方法 or 属性:get(key: K): V;<br>错误码内容: 10200011|@ohos.util.TreeMap.d.ts| +|新增(错误码)|NA|类名:TreeMap<br>方法 or 属性:getFirstKey(): K;<br>错误码内容: 10200011|@ohos.util.TreeMap.d.ts| +|新增(错误码)|NA|类名:TreeMap<br>方法 or 属性:getLastKey(): K;<br>错误码内容: 10200011|@ohos.util.TreeMap.d.ts| +|新增(错误码)|NA|类名:TreeMap<br>方法 or 属性:setAll(map: TreeMap\<K, V>): void;<br>错误码内容: 10200011, 401|@ohos.util.TreeMap.d.ts| +|新增(错误码)|NA|类名:TreeMap<br>方法 or 属性:set(key: K, value: V): Object;<br>错误码内容: 10200011, 401|@ohos.util.TreeMap.d.ts| +|新增(错误码)|NA|类名:TreeMap<br>方法 or 属性:remove(key: K): V;<br>错误码内容: 10200011|@ohos.util.TreeMap.d.ts| +|新增(错误码)|NA|类名:TreeMap<br>方法 or 属性:clear(): void;<br>错误码内容: 10200011|@ohos.util.TreeMap.d.ts| +|新增(错误码)|NA|类名:TreeMap<br>方法 or 属性:getLowerKey(key: K): K;<br>错误码内容: 10200011|@ohos.util.TreeMap.d.ts| +|新增(错误码)|NA|类名:TreeMap<br>方法 or 属性:getHigherKey(key: K): K;<br>错误码内容: 10200011|@ohos.util.TreeMap.d.ts| +|新增(错误码)|NA|类名:TreeMap<br>方法 or 属性:keys(): IterableIterator\<K>;<br>错误码内容: 10200011|@ohos.util.TreeMap.d.ts| +|新增(错误码)|NA|类名:TreeMap<br>方法 or 属性:values(): IterableIterator\<V>;<br>错误码内容: 10200011|@ohos.util.TreeMap.d.ts| +|新增(错误码)|NA|类名:TreeMap<br>方法 or 属性:replace(key: K, newValue: V): boolean;<br>错误码内容: 10200011|@ohos.util.TreeMap.d.ts| +|新增(错误码)|NA|类名:TreeMap<br>方法 or 属性:entries(): IterableIterator\<[K, V]>;<br>错误码内容: 10200011|@ohos.util.TreeMap.d.ts| +|新增(错误码)|NA|类名:TreeMap<br>方法 or 属性:[Symbol.iterator](): IterableIterator\<[K, V]>;<br>错误码内容: 10200011|@ohos.util.TreeMap.d.ts| +|新增(错误码)|NA|类名:TreeSet<br>方法 or 属性:constructor(comparator?: (firstValue: T, secondValue: T) => boolean)<br>错误码内容: 10200012, 401|@ohos.util.TreeSet.d.ts| +|新增(错误码)|NA|类名:TreeSet<br>方法 or 属性:isEmpty(): boolean;<br>错误码内容: 10200011|@ohos.util.TreeSet.d.ts| +|新增(错误码)|NA|类名:TreeSet<br>方法 or 属性:has(value: T): boolean;<br>错误码内容: 10200011|@ohos.util.TreeSet.d.ts| +|新增(错误码)|NA|类名:TreeSet<br>方法 or 属性:add(value: T): boolean;<br>错误码内容: 401, 10200011|@ohos.util.TreeSet.d.ts| +|新增(错误码)|NA|类名:TreeSet<br>方法 or 属性:remove(value: T): boolean;<br>错误码内容: 10200011|@ohos.util.TreeSet.d.ts| +|新增(错误码)|NA|类名:TreeSet<br>方法 or 属性:clear(): void;<br>错误码内容: 10200011|@ohos.util.TreeSet.d.ts| +|新增(错误码)|NA|类名:TreeSet<br>方法 or 属性:getFirstValue(): T;<br>错误码内容: 10200011|@ohos.util.TreeSet.d.ts| +|新增(错误码)|NA|类名:TreeSet<br>方法 or 属性:getLastValue(): T;<br>错误码内容: 10200011|@ohos.util.TreeSet.d.ts| +|新增(错误码)|NA|类名:TreeSet<br>方法 or 属性:getLowerValue(key: T): T;<br>错误码内容: 10200011, 401|@ohos.util.TreeSet.d.ts| +|新增(错误码)|NA|类名:TreeSet<br>方法 or 属性:getHigherValue(key: T): T;<br>错误码内容: 10200011, 401|@ohos.util.TreeSet.d.ts| +|新增(错误码)|NA|类名:TreeSet<br>方法 or 属性:popFirst(): T;<br>错误码内容: 10200011|@ohos.util.TreeSet.d.ts| +|新增(错误码)|NA|类名:TreeSet<br>方法 or 属性:popLast(): T;<br>错误码内容: 10200011|@ohos.util.TreeSet.d.ts| +|新增(错误码)|NA|类名:TreeSet<br>方法 or 属性:values(): IterableIterator\<T>;<br>错误码内容: 10200011|@ohos.util.TreeSet.d.ts| +|新增(错误码)|NA|类名:TreeSet<br>方法 or 属性:entries(): IterableIterator\<[T, T]>;<br>错误码内容: 10200011|@ohos.util.TreeSet.d.ts| +|新增(错误码)|NA|类名:TreeSet<br>方法 or 属性:[Symbol.iterator](): IterableIterator\<T>;<br>错误码内容: 10200011|@ohos.util.TreeSet.d.ts| +|新增(错误码)|NA|类名:XmlSerializer<br>方法 or 属性:constructor(buffer: ArrayBuffer \| DataView, encoding?: string);<br>错误码内容: 401|@ohos.xml.d.ts| +|新增(错误码)|NA|类名:XmlSerializer<br>方法 or 属性:setAttributes(name: string, value: string): void;<br>错误码内容: 401|@ohos.xml.d.ts| +|新增(错误码)|NA|类名:XmlSerializer<br>方法 or 属性:addEmptyElement(name: string): void;<br>错误码内容: 401|@ohos.xml.d.ts| +|新增(错误码)|NA|类名:XmlSerializer<br>方法 or 属性:startElement(name: string): void;<br>错误码内容: 401|@ohos.xml.d.ts| +|新增(错误码)|NA|类名:XmlSerializer<br>方法 or 属性:setNamespace(prefix: string, namespace: string): void;<br>错误码内容: 401|@ohos.xml.d.ts| +|新增(错误码)|NA|类名:XmlSerializer<br>方法 or 属性:setComment(text: string): void;<br>错误码内容: 401|@ohos.xml.d.ts| +|新增(错误码)|NA|类名:XmlSerializer<br>方法 or 属性:setCDATA(text: string): void;<br>错误码内容: 401|@ohos.xml.d.ts| +|新增(错误码)|NA|类名:XmlSerializer<br>方法 or 属性:setText(text: string): void;<br>错误码内容: 401|@ohos.xml.d.ts| +|新增(错误码)|NA|类名:XmlSerializer<br>方法 or 属性:setDocType(text: string): void;<br>错误码内容: 401|@ohos.xml.d.ts| +|新增(错误码)|NA|类名:XmlPullParser<br>方法 or 属性:constructor(buffer: ArrayBuffer \| DataView, encoding?: string);<br>错误码内容: 401|@ohos.xml.d.ts| +|新增(错误码)|NA|类名:XmlPullParser<br>方法 or 属性:parse(option: ParseOptions): void;<br>错误码内容: 401|@ohos.xml.d.ts| +|SysCap有变化|类名:Vector<br>SysCap:N/A|类名:Vector<br>SysCap:SystemCapability.Utils.Lang|@ohos.util.Vector.d.ts| +|函数有变化|类名:process<br>方法 or 属性:function runCmd(command: string,<br><br> options?: { timeout : number, killSignal : number \| string, maxBuffer : number }): ChildProcess;<br>|类名:process<br>方法 or 属性:function runCmd(command: string,<br><br> options?: { timeout?: number, killSignal?: number \| string, maxBuffer?: number }): ChildProcess;<br>|@ohos.process.d.ts| +|函数有变化|类名:URLSearchParams<br>方法 or 属性:forEach(callbackfn: (value: string, key: string, searchParams: this) => void, thisArg?: Object): void;<br>|类名:URLSearchParams<br>方法 or 属性:forEach(callbackFn: (value: string, key: string, searchParams: this) => void, thisArg?: Object): void;<br>|@ohos.url.d.ts| +|函数有变化|类名:ArrayList<br>方法 or 属性:replaceAllElements(callbackfn: (value: T, index?: number, arrlist?: ArrayList\<T>) => T,<br><br> thisArg?: Object): void;<br>|类名:ArrayList<br>方法 or 属性:replaceAllElements(callbackFn: (value: T, index?: number, arrlist?: ArrayList\<T>) => T,<br><br> thisArg?: Object): void;<br>|@ohos.util.ArrayList.d.ts| +|函数有变化|类名:ArrayList<br>方法 or 属性:forEach(callbackfn: (value: T, index?: number, arrlist?: ArrayList\<T>) => void,<br><br> thisArg?: Object): void;<br>|类名:ArrayList<br>方法 or 属性:forEach(callbackFn: (value: T, index?: number, arrlist?: ArrayList\<T>) => void,<br><br> thisArg?: Object): void;<br>|@ohos.util.ArrayList.d.ts| +|函数有变化|类名:Deque<br>方法 or 属性:forEach(callbackfn: (value: T, index?: number, deque?: Deque\<T>) => void,<br><br> thisArg?: Object): void;<br>|类名:Deque<br>方法 or 属性:forEach(callbackFn: (value: T, index?: number, deque?: Deque\<T>) => void,<br><br> thisArg?: Object): void;<br>|@ohos.util.Deque.d.ts| +|函数有变化|类名:HashMap<br>方法 or 属性:forEach(callbackfn: (value?: V, key?: K, map?: HashMap\<K, V>) => void,<br><br> thisArg?: Object): void;<br>|类名:HashMap<br>方法 or 属性:forEach(callbackFn: (value?: V, key?: K, map?: HashMap\<K, V>) => void,<br><br> thisArg?: Object): void;<br>|@ohos.util.HashMap.d.ts| +|函数有变化|类名:HashSet<br>方法 or 属性:forEach(callbackfn: (value?: T, key?: T, set?: HashSet\<T>) => void,<br><br> thisArg?: Object): void;<br>|类名:HashSet<br>方法 or 属性:forEach(callbackFn: (value?: T, key?: T, set?: HashSet\<T>) => void,<br><br> thisArg?: Object): void;<br>|@ohos.util.HashSet.d.ts| +|函数有变化|类名:LightWeightMap<br>方法 or 属性:forEach(callbackfn: (value?: V, key?: K, map?: LightWeightMap\<K, V>) => void,<br><br> thisArg?: Object): void;<br>|类名:LightWeightMap<br>方法 or 属性:forEach(callbackFn: (value?: V, key?: K, map?: LightWeightMap\<K, V>) => void,<br><br> thisArg?: Object): void;<br>|@ohos.util.LightWeightMap.d.ts| +|函数有变化|类名:LightWeightSet<br>方法 or 属性:forEach(callbackfn: (value?: T, key?: T, set?: LightWeightSet\<T>) => void,<br><br> thisArg?: Object): void;<br>|类名:LightWeightSet<br>方法 or 属性:forEach(callbackFn: (value?: T, key?: T, set?: LightWeightSet\<T>) => void,<br><br> thisArg?: Object): void;<br>|@ohos.util.LightWeightSet.d.ts| +|函数有变化|类名:LinkedList<br>方法 or 属性:forEach(callbackfn: (value: T, index?: number, LinkedList?: LinkedList\<T>) => void,<br><br> thisArg?: Object): void;<br>|类名:LinkedList<br>方法 or 属性:forEach(callbackFn: (value: T, index?: number, LinkedList?: LinkedList\<T>) => void,<br><br> thisArg?: Object): void;<br>|@ohos.util.LinkedList.d.ts| +|函数有变化|类名:List<br>方法 or 属性:forEach(callbackfn: (value: T, index?: number, List?: List\<T>) => void,<br><br> thisArg?: Object): void;<br>|类名:List<br>方法 or 属性:forEach(callbackFn: (value: T, index?: number, List?: List\<T>) => void,<br><br> thisArg?: Object): void;<br>|@ohos.util.List.d.ts| +|函数有变化|类名:List<br>方法 or 属性:replaceAllElements(callbackfn: (value: T, index?: number, list?: List\<T>) => T,<br><br> thisArg?: Object): void;<br>|类名:List<br>方法 or 属性:replaceAllElements(callbackFn: (value: T, index?: number, list?: List\<T>) => T,<br><br> thisArg?: Object): void;<br>|@ohos.util.List.d.ts| +|函数有变化|类名:PlainArray<br>方法 or 属性:forEach(callbackfn: (value: T, index?: number, PlainArray?: PlainArray\<T>) => void,<br><br> thisArg?: Object): void;<br>|类名:PlainArray<br>方法 or 属性:forEach(callbackFn: (value: T, index?: number, PlainArray?: PlainArray\<T>) => void,<br><br> thisArg?: Object): void;<br>|@ohos.util.PlainArray.d.ts| +|函数有变化|类名:Queue<br>方法 or 属性:forEach(callbackfn: (value: T, index?: number, Queue?: Queue\<T>) => void,<br><br> thisArg?: Object): void;<br>|类名:Queue<br>方法 or 属性:forEach(callbackFn: (value: T, index?: number, Queue?: Queue\<T>) => void,<br><br> thisArg?: Object): void;<br>|@ohos.util.Queue.d.ts| +|函数有变化|类名:Stack<br>方法 or 属性:forEach(callbackfn: (value: T, index?: number, stack?: Stack\<T>) => void,<br><br> thisArg?: Object): void;<br>|类名:Stack<br>方法 or 属性:forEach(callbackFn: (value: T, index?: number, stack?: Stack\<T>) => void,<br><br> thisArg?: Object): void;<br>|@ohos.util.Stack.d.ts| +|函数有变化|类名:TreeMap<br>方法 or 属性:forEach(callbackfn: (value?: V, key?: K, map?: TreeMap\<K, V>) => void,<br><br> thisArg?: Object): void;<br>|类名:TreeMap<br>方法 or 属性:forEach(callbackFn: (value?: V, key?: K, map?: TreeMap\<K, V>) => void,<br><br> thisArg?: Object): void;<br>|@ohos.util.TreeMap.d.ts| +|函数有变化|类名:TreeSet<br>方法 or 属性:forEach(callbackfn: (value?: T, key?: T, set?: TreeSet\<T>) => void,<br><br> thisArg?: Object): void;<br>|类名:TreeSet<br>方法 or 属性:forEach(callbackFn: (value?: T, key?: T, set?: TreeSet\<T>) => void,<br><br> thisArg?: Object): void;<br>|@ohos.util.TreeSet.d.ts| +|函数有变化|类名:Vector<br>方法 or 属性:replaceAllElements(callbackfn: (value: T, index?: number, vector?: Vector\<T>) => T,<br><br> thisArg?: Object): void;<br>|类名:Vector<br>方法 or 属性:replaceAllElements(callbackFn: (value: T, index?: number, vector?: Vector\<T>) => T,<br><br> thisArg?: Object): void;<br>|@ohos.util.Vector.d.ts| +|函数有变化|类名:Vector<br>方法 or 属性:forEach(callbackfn: (value: T, index?: number, vector?: Vector\<T>) => void,<br><br> thisArg?: Object): void;<br>|类名:Vector<br>方法 or 属性:forEach(callbackFn: (value: T, index?: number, vector?: Vector\<T>) => void,<br><br> thisArg?: Object): void;<br>|@ohos.util.Vector.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-customization.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-customization.md new file mode 100644 index 0000000000000000000000000000000000000000..20bcea9a0a54548c56e186753f9f7bb12a0c7731 --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-customization.md @@ -0,0 +1,48 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: adminManager|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: EnterpriseInfo|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: EnterpriseInfo<br>方法 or 属性: name: string;|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: EnterpriseInfo<br>方法 or 属性: description: string;|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: AdminType|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: AdminType<br>方法 or 属性: ADMIN_TYPE_NORMAL = 0x00|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: AdminType<br>方法 or 属性: ADMIN_TYPE_SUPER = 0x01|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: ManagedEvent|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: ManagedEvent<br>方法 or 属性: MANAGED_EVENT_BUNDLE_ADDED = 0|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: ManagedEvent<br>方法 or 属性: MANAGED_EVENT_BUNDLE_REMOVED = 1|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: adminManager<br>方法 or 属性: function enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, callback: AsyncCallback\<void>): void;|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: adminManager<br>方法 or 属性: function enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId: number, callback: AsyncCallback\<void>): void;|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: adminManager<br>方法 or 属性: function enableAdmin(admin: Want, enterpriseInfo: EnterpriseInfo, type: AdminType, userId?: number): Promise\<void>;|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: adminManager<br>方法 or 属性: function disableAdmin(admin: Want, callback: AsyncCallback\<void>): void;|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: adminManager<br>方法 or 属性: function disableAdmin(admin: Want, userId: number, callback: AsyncCallback\<void>): void;|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: adminManager<br>方法 or 属性: function disableAdmin(admin: Want, userId?: number): Promise\<void>;|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: adminManager<br>方法 or 属性: function disableSuperAdmin(bundleName: String, callback: AsyncCallback\<void>): void;|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: adminManager<br>方法 or 属性: function disableSuperAdmin(bundleName: String): Promise\<void>;|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: adminManager<br>方法 or 属性: function isAdminEnabled(admin: Want, callback: AsyncCallback\<boolean>): void;|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: adminManager<br>方法 or 属性: function isAdminEnabled(admin: Want, userId: number, callback: AsyncCallback\<boolean>): void;|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: adminManager<br>方法 or 属性: function isAdminEnabled(admin: Want, userId?: number): Promise\<boolean>;|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: adminManager<br>方法 or 属性: function getEnterpriseInfo(admin: Want, callback: AsyncCallback\<EnterpriseInfo>): void;|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: adminManager<br>方法 or 属性: function getEnterpriseInfo(admin: Want): Promise\<EnterpriseInfo>;|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: adminManager<br>方法 or 属性: function setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo, callback: AsyncCallback\<void>): void;|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: adminManager<br>方法 or 属性: function setEnterpriseInfo(admin: Want, enterpriseInfo: EnterpriseInfo): Promise\<void>;|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: adminManager<br>方法 or 属性: function isSuperAdmin(bundleName: String, callback: AsyncCallback\<boolean>): void;|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: adminManager<br>方法 or 属性: function isSuperAdmin(bundleName: String): Promise\<boolean>;|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: adminManager<br>方法 or 属性: function subscribeManagedEvent(admin: Want, managedEvents: Array\<ManagedEvent>, callback: AsyncCallback\<void>): void;|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: adminManager<br>方法 or 属性: function subscribeManagedEvent(admin: Want, managedEvents: Array\<ManagedEvent>): Promise\<void>;|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: adminManager<br>方法 or 属性: function unsubscribeManagedEvent(admin: Want, managedEvents: Array\<ManagedEvent>, callback: AsyncCallback\<void>): void;|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.adminManager<br>类名: adminManager<br>方法 or 属性: function unsubscribeManagedEvent(admin: Want, managedEvents: Array\<ManagedEvent>): Promise\<void>;|@ohos.enterprise.adminManager.d.ts| +|新增|NA|模块名: ohos.enterprise.dateTimeManager<br>类名: dateTimeManager|@ohos.enterprise.dateTimeManager.d.ts| +|新增|NA|模块名: ohos.enterprise.dateTimeManager<br>类名: dateTimeManager<br>方法 or 属性: function setDateTime(admin: Want, time: number, callback: AsyncCallback\<void>): void;|@ohos.enterprise.dateTimeManager.d.ts| +|新增|NA|模块名: ohos.enterprise.dateTimeManager<br>类名: dateTimeManager<br>方法 or 属性: function setDateTime(admin: Want, time: number): Promise\<void>;|@ohos.enterprise.dateTimeManager.d.ts| +|新增|NA|模块名: ohos.enterprise.EnterpriseAdminExtensionAbility<br>类名: EnterpriseAdminExtensionAbility|@ohos.enterprise.EnterpriseAdminExtensionAbility.d.ts| +|新增|NA|模块名: ohos.enterprise.EnterpriseAdminExtensionAbility<br>类名: EnterpriseAdminExtensionAbility<br>方法 or 属性: onAdminEnabled(): void;|@ohos.enterprise.EnterpriseAdminExtensionAbility.d.ts| +|新增|NA|模块名: ohos.enterprise.EnterpriseAdminExtensionAbility<br>类名: EnterpriseAdminExtensionAbility<br>方法 or 属性: onAdminDisabled(): void;|@ohos.enterprise.EnterpriseAdminExtensionAbility.d.ts| +|新增|NA|模块名: ohos.enterprise.EnterpriseAdminExtensionAbility<br>类名: EnterpriseAdminExtensionAbility<br>方法 or 属性: onBundleAdded(bundleName: string): void;|@ohos.enterprise.EnterpriseAdminExtensionAbility.d.ts| +|新增|NA|模块名: ohos.enterprise.EnterpriseAdminExtensionAbility<br>类名: EnterpriseAdminExtensionAbility<br>方法 or 属性: onBundleRemoved(bundleName: string): void;|@ohos.enterprise.EnterpriseAdminExtensionAbility.d.ts| +|访问级别有变化|类名:configPolicy<br>访问级别:公开API|类名:configPolicy<br>访问级别:系统API|@ohos.configPolicy.d.ts| +|新增(错误码)|NA|类名:configPolicy<br>方法 or 属性:function getOneCfgFile(relPath: string, callback: AsyncCallback\<string>);<br>错误码内容: 401|@ohos.configPolicy.d.ts| +|新增(错误码)|NA|类名:configPolicy<br>方法 or 属性:function getOneCfgFile(relPath: string): Promise\<string>;<br>错误码内容: 401|@ohos.configPolicy.d.ts| +|新增(错误码)|NA|类名:configPolicy<br>方法 or 属性:function getCfgFiles(relPath: string, callback: AsyncCallback\<Array\<string>>);<br>错误码内容: 401|@ohos.configPolicy.d.ts| +|新增(错误码)|NA|类名:configPolicy<br>方法 or 属性:function getCfgFiles(relPath: string): Promise\<Array\<string>>;<br>错误码内容: 401|@ohos.configPolicy.d.ts| +|新增(错误码)|NA|类名:configPolicy<br>方法 or 属性:function getCfgDirList(callback: AsyncCallback\<Array\<string>>);<br>错误码内容: 401|@ohos.configPolicy.d.ts| +|新增(错误码)|NA|类名:configPolicy<br>方法 or 属性:function getCfgDirList(): Promise\<Array\<string>>;<br>错误码内容: 401|@ohos.configPolicy.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-dfx.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-dfx.md new file mode 100644 index 0000000000000000000000000000000000000000..9e155464169d77a35e09280049cc58154c25a5ac --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-dfx.md @@ -0,0 +1,115 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|类名:FaultLogger<br>方法or属性:function query(faultType: FaultType, callback: AsyncCallback\<Array\<FaultLogInfo>>) : void;|@ohos.faultLogger.d.ts| +|新增|NA|类名:FaultLogger<br>方法or属性:function query(faultType: FaultType) : Promise\<Array\<FaultLogInfo>>;|@ohos.faultLogger.d.ts| +|新增|NA|类名:hichecker<br>方法or属性:function addCheckRule(rule: bigint) : void;|@ohos.hichecker.d.ts| +|新增|NA|类名:hichecker<br>方法or属性:function removeCheckRule(rule: bigint) : void;|@ohos.hichecker.d.ts| +|新增|NA|类名:hichecker<br>方法or属性:function containsCheckRule(rule: bigint) : boolean;|@ohos.hichecker.d.ts| +|新增|NA|类名:hidebug<br>方法or属性:function getPrivateDirty() : bigint;|@ohos.hidebug.d.ts| +|新增|NA|类名:hidebug<br>方法or属性:function getCpuUsage() : number;|@ohos.hidebug.d.ts| +|新增|NA|类名:hidebug<br>方法or属性:function startJsCpuProfiling(filename : string) : void;|@ohos.hidebug.d.ts| +|新增|NA|类名:hidebug<br>方法or属性:function stopJsCpuProfiling() : void;|@ohos.hidebug.d.ts| +|新增|NA|类名:hidebug<br>方法or属性:function dumpJsHeapData(filename : string) : void;|@ohos.hidebug.d.ts| +|新增|NA|类名:hidebug<br>方法or属性:function getServiceDump(serviceid : number, fd : number, args : Array\<string>) : void;|@ohos.hidebug.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: hiSysEvent|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: EventType|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: EventType<br>方法 or 属性: FAULT = 1|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: EventType<br>方法 or 属性: STATISTIC = 2|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: EventType<br>方法 or 属性: SECURITY = 3|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: EventType<br>方法 or 属性: BEHAVIOR = 4|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: SysEventInfo|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: SysEventInfo<br>方法 or 属性: domain: string;|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: SysEventInfo<br>方法 or 属性: name: string;|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: SysEventInfo<br>方法 or 属性: eventType: EventType;|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: SysEventInfo<br>方法 or 属性: params: object;|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: hiSysEvent<br>方法 or 属性: function write(info: SysEventInfo): Promise\<void>;|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: hiSysEvent<br>方法 or 属性: function write(info: SysEventInfo, callback: AsyncCallback\<void>): void;|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: RuleType|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: RuleType<br>方法 or 属性: WHOLE_WORD = 1|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: RuleType<br>方法 or 属性: PREFIX = 2|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: RuleType<br>方法 or 属性: REGULAR = 3|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: WatchRule|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: WatchRule<br>方法 or 属性: domain: string;|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: WatchRule<br>方法 or 属性: name: string;|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: WatchRule<br>方法 or 属性: tag: string;|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: WatchRule<br>方法 or 属性: ruleType: RuleType;|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: Watcher|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: Watcher<br>方法 or 属性: rules: WatchRule[];|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: Watcher<br>方法 or 属性: onEvent: (info: SysEventInfo) => void;|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: Watcher<br>方法 or 属性: onServiceDied: () => void;|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: QueryArg|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: QueryArg<br>方法 or 属性: beginTime: number;|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: QueryArg<br>方法 or 属性: endTime: number;|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: QueryArg<br>方法 or 属性: maxEvents: number;|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: QueryRule|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: QueryRule<br>方法 or 属性: domain: string;|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: QueryRule<br>方法 or 属性: names: string[];|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: Querier|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: Querier<br>方法 or 属性: onQuery: (infos: SysEventInfo[]) => void;|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: Querier<br>方法 or 属性: onComplete: (reason: number, total: number) => void;|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: hiSysEvent<br>方法 or 属性: function addWatcher(watcher: Watcher): void;|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: hiSysEvent<br>方法 or 属性: function removeWatcher(watcher: Watcher): void;|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiSysEvent<br>类名: hiSysEvent<br>方法 or 属性: function query(queryArg: QueryArg, rules: QueryRule[], querier: Querier): void;|@ohos.hiSysEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: hiAppEvent|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: EventType|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: EventType<br>方法 or 属性: FAULT = 1|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: EventType<br>方法 or 属性: STATISTIC = 2|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: EventType<br>方法 or 属性: SECURITY = 3|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: EventType<br>方法 or 属性: BEHAVIOR = 4|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: event|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: event<br>方法 or 属性: const USER_LOGIN: string;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: event<br>方法 or 属性: const USER_LOGOUT: string;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: event<br>方法 or 属性: const DISTRIBUTED_SERVICE_START: string;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: param|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: param<br>方法 or 属性: const USER_ID: string;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: param<br>方法 or 属性: const DISTRIBUTED_SERVICE_NAME: string;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: param<br>方法 or 属性: const DISTRIBUTED_SERVICE_INSTANCE_ID: string;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: hiAppEvent<br>方法 or 属性: function configure(config: ConfigOption): void;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: ConfigOption|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: ConfigOption<br>方法 or 属性: disable?: boolean;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: ConfigOption<br>方法 or 属性: maxStorage?: string;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: AppEventInfo|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: AppEventInfo<br>方法 or 属性: domain: string;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: AppEventInfo<br>方法 or 属性: name: string;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: AppEventInfo<br>方法 or 属性: eventType: EventType;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: AppEventInfo<br>方法 or 属性: params: object;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: hiAppEvent<br>方法 or 属性: function write(info: AppEventInfo): Promise\<void>;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: hiAppEvent<br>方法 or 属性: function write(info: AppEventInfo, callback: AsyncCallback\<void>): void;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: AppEventPackage|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: AppEventPackage<br>方法 or 属性: packageId: number;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: AppEventPackage<br>方法 or 属性: row: number;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: AppEventPackage<br>方法 or 属性: size: number;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: AppEventPackage<br>方法 or 属性: data: string[];|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: AppEventPackageHolder|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: AppEventPackageHolder<br>方法 or 属性: constructor(watcherName: string);|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: AppEventPackageHolder<br>方法 or 属性: setSize(size: number): void;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: AppEventPackageHolder<br>方法 or 属性: takeNext(): AppEventPackage;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: TriggerCondition|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: TriggerCondition<br>方法 or 属性: row?: number;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: TriggerCondition<br>方法 or 属性: size?: number;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: TriggerCondition<br>方法 or 属性: timeOut?: number;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: AppEventFilter|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: AppEventFilter<br>方法 or 属性: domain: string;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: AppEventFilter<br>方法 or 属性: eventTypes?: EventType[];|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: Watcher|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: Watcher<br>方法 or 属性: name: string;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: Watcher<br>方法 or 属性: triggerCondition?: TriggerCondition;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: Watcher<br>方法 or 属性: appEventFilters?: AppEventFilter[];|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: Watcher<br>方法 or 属性: onTrigger?: (curRow: number, curSize: number, holder: AppEventPackageHolder) => void;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: hiAppEvent<br>方法 or 属性: function addWatcher(watcher: Watcher): AppEventPackageHolder;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: hiAppEvent<br>方法 or 属性: function removeWatcher(watcher: Watcher): void;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|新增|NA|模块名: ohos.hiviewdfx.hiAppEvent<br>类名: hiAppEvent<br>方法 or 属性: function clearData(): void;|@ohos.hiviewdfx.hiAppEvent.d.ts| +|废弃版本有变化|类名:bytrace<br>废弃版本:N/A|类名:bytrace<br>废弃版本:8<br>代替接口:ohos.hiTraceMeter |@ohos.bytrace.d.ts| +|废弃版本有变化|类名:bytrace<br>方法 or 属性:function startTrace(name: string, taskId: number, expectedTime?: number): void;<br>废弃版本:N/A|类名:bytrace<br>方法 or 属性:function startTrace(name: string, taskId: number, expectedTime?: number): void;<br>废弃版本:8<br>代替接口:ohos.hiTraceMeter.startTrace |@ohos.bytrace.d.ts| +|废弃版本有变化|类名:bytrace<br>方法 or 属性:function finishTrace(name: string, taskId: number): void;<br>废弃版本:N/A|类名:bytrace<br>方法 or 属性:function finishTrace(name: string, taskId: number): void;<br>废弃版本:8<br>代替接口:ohos.hiTraceMeter.finishTrace |@ohos.bytrace.d.ts| +|废弃版本有变化|类名:bytrace<br>方法 or 属性:function traceByValue(name: string, count: number): void;<br>废弃版本:N/A|类名:bytrace<br>方法 or 属性:function traceByValue(name: string, count: number): void;<br>废弃版本:8<br>代替接口:ohos.hiTraceMeter.traceByValue |@ohos.bytrace.d.ts| +|废弃版本有变化|类名:FaultLogger<br>方法 or 属性:function querySelfFaultLog(faultType: FaultType, callback: AsyncCallback\<Array\<FaultLogInfo>>) : void;<br>废弃版本:N/A|类名:FaultLogger<br>方法 or 属性:function querySelfFaultLog(faultType: FaultType, callback: AsyncCallback\<Array\<FaultLogInfo>>) : void;<br>废弃版本:9<br>代替接口:ohos.faultlogger/FaultLogger|@ohos.faultLogger.d.ts| +|废弃版本有变化|类名:FaultLogger<br>方法 or 属性:function querySelfFaultLog(faultType: FaultType) : Promise\<Array\<FaultLogInfo>>;<br>废弃版本:N/A|类名:FaultLogger<br>方法 or 属性:function querySelfFaultLog(faultType: FaultType) : Promise\<Array\<FaultLogInfo>>;<br>废弃版本:9<br>代替接口:ohos.faultlogger/FaultLogger|@ohos.faultLogger.d.ts| +|废弃版本有变化|类名:hiAppEvent<br>废弃版本:N/A|类名:hiAppEvent<br>废弃版本:9<br>代替接口:ohos.hiviewdfx.hiAppEvent |@ohos.hiAppEvent.d.ts| +|废弃版本有变化|类名:hichecker<br>方法 or 属性:function addRule(rule: bigint) : void;<br>废弃版本:N/A|类名:hichecker<br>方法 or 属性:function addRule(rule: bigint) : void;<br>废弃版本:9<br>代替接口:ohos.hichecker/hichecker|@ohos.hichecker.d.ts| +|废弃版本有变化|类名:hichecker<br>方法 or 属性:function removeRule(rule: bigint) : void;<br>废弃版本:N/A|类名:hichecker<br>方法 or 属性:function removeRule(rule: bigint) : void;<br>废弃版本:9<br>代替接口:ohos.hichecker/hichecker|@ohos.hichecker.d.ts| +|废弃版本有变化|类名:hichecker<br>方法 or 属性:function contains(rule: bigint) : boolean;<br>废弃版本:N/A|类名:hichecker<br>方法 or 属性:function contains(rule: bigint) : boolean;<br>废弃版本:9<br>代替接口:ohos.hichecker/hichecker|@ohos.hichecker.d.ts| +|废弃版本有变化|类名:hidebug<br>方法 or 属性:function startProfiling(filename : string) : void;<br>废弃版本:N/A|类名:hidebug<br>方法 or 属性:function startProfiling(filename : string) : void;<br>废弃版本:9<br>代替接口:ohos.hidebug/hidebug.startJsCpuProfiling |@ohos.hidebug.d.ts| +|废弃版本有变化|类名:hidebug<br>方法 or 属性:function stopProfiling() : void;<br>废弃版本:N/A|类名:hidebug<br>方法 or 属性:function stopProfiling() : void;<br>废弃版本:9<br>代替接口:ohos.hidebug/hidebug.stopJsCpuProfiling |@ohos.hidebug.d.ts| +|废弃版本有变化|类名:hidebug<br>方法 or 属性:function dumpHeapData(filename : string) : void;<br>废弃版本:N/A|类名:hidebug<br>方法 or 属性:function dumpHeapData(filename : string) : void;<br>废弃版本:9<br>代替接口:ohos.hidebug/hidebug.dumpJsHeapData |@ohos.hidebug.d.ts| +|函数有变化|类名:hiTraceChain<br>方法 or 属性:function begin(name: string, flags: number = HiTraceFlag.DEFAULT): HiTraceId;<br>|类名:hiTraceChain<br>方法 or 属性:function begin(name: string, flags?: number): HiTraceId;<br>|@ohos.hiTraceChain.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-distributed-data.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-distributed-data.md new file mode 100644 index 0000000000000000000000000000000000000000..9f6b86c8b2e5cfcdc0d618994dbba570955de65a --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-distributed-data.md @@ -0,0 +1,826 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.application.DataShareExtensionAbility<br>类名: DataShareExtensionAbility|@ohos.application.DataShareExtensionAbility.d.ts| +|新增|NA|模块名: ohos.application.DataShareExtensionAbility<br>类名: DataShareExtensionAbility<br>方法 or 属性: context?: ExtensionContext;|@ohos.application.DataShareExtensionAbility.d.ts| +|新增|NA|模块名: ohos.application.DataShareExtensionAbility<br>类名: DataShareExtensionAbility<br>方法 or 属性: onCreate?(want: Want, callback: AsyncCallback\<void>): void;|@ohos.application.DataShareExtensionAbility.d.ts| +|新增|NA|模块名: ohos.application.DataShareExtensionAbility<br>类名: DataShareExtensionAbility<br>方法 or 属性: insert?(uri: string, valueBucket: ValuesBucket, callback: AsyncCallback\<number>): void;|@ohos.application.DataShareExtensionAbility.d.ts| +|新增|NA|模块名: ohos.application.DataShareExtensionAbility<br>类名: DataShareExtensionAbility<br>方法 or 属性: update?(uri: string, predicates: dataSharePredicates.DataSharePredicates, valueBucket: ValuesBucket,<br> callback: AsyncCallback\<number>): void;|@ohos.application.DataShareExtensionAbility.d.ts| +|新增|NA|模块名: ohos.application.DataShareExtensionAbility<br>类名: DataShareExtensionAbility<br>方法 or 属性: delete?(uri: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback\<number>): void;|@ohos.application.DataShareExtensionAbility.d.ts| +|新增|NA|模块名: ohos.application.DataShareExtensionAbility<br>类名: DataShareExtensionAbility<br>方法 or 属性: query?(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array\<string>,<br> callback: AsyncCallback\<Object>): void;|@ohos.application.DataShareExtensionAbility.d.ts| +|新增|NA|模块名: ohos.application.DataShareExtensionAbility<br>类名: DataShareExtensionAbility<br>方法 or 属性: batchInsert?(uri: string, valueBuckets: Array\<ValuesBucket>, callback: AsyncCallback\<number>): void;|@ohos.application.DataShareExtensionAbility.d.ts| +|新增|NA|模块名: ohos.application.DataShareExtensionAbility<br>类名: DataShareExtensionAbility<br>方法 or 属性: normalizeUri?(uri: string, callback: AsyncCallback\<string>): void;|@ohos.application.DataShareExtensionAbility.d.ts| +|新增|NA|模块名: ohos.application.DataShareExtensionAbility<br>类名: DataShareExtensionAbility<br>方法 or 属性: denormalizeUri?(uri: string, callback: AsyncCallback\<string>): void;|@ohos.application.DataShareExtensionAbility.d.ts| +|新增|NA|模块名: ohos.data.dataShare<br>类名: dataShare|@ohos.data.dataShare.d.ts| +|新增|NA|模块名: ohos.data.dataShare<br>类名: dataShare<br>方法 or 属性: function createDataShareHelper(context: Context, uri: string, callback: AsyncCallback\<DataShareHelper>): void;|@ohos.data.dataShare.d.ts| +|新增|NA|模块名: ohos.data.dataShare<br>类名: dataShare<br>方法 or 属性: function createDataShareHelper(context: Context, uri: string): Promise\<DataShareHelper>;|@ohos.data.dataShare.d.ts| +|新增|NA|模块名: ohos.data.dataShare<br>类名: DataShareHelper|@ohos.data.dataShare.d.ts| +|新增|NA|模块名: ohos.data.dataShare<br>类名: DataShareHelper<br>方法 or 属性: on(type: 'dataChange', uri: string, callback: AsyncCallback\<void>): void;|@ohos.data.dataShare.d.ts| +|新增|NA|模块名: ohos.data.dataShare<br>类名: DataShareHelper<br>方法 or 属性: off(type: 'dataChange', uri: string, callback?: AsyncCallback\<void>): void;|@ohos.data.dataShare.d.ts| +|新增|NA|模块名: ohos.data.dataShare<br>类名: DataShareHelper<br>方法 or 属性: insert(uri: string, value: ValuesBucket, callback: AsyncCallback\<number>): void;|@ohos.data.dataShare.d.ts| +|新增|NA|模块名: ohos.data.dataShare<br>类名: DataShareHelper<br>方法 or 属性: insert(uri: string, value: ValuesBucket): Promise\<number>;|@ohos.data.dataShare.d.ts| +|新增|NA|模块名: ohos.data.dataShare<br>类名: DataShareHelper<br>方法 or 属性: delete(uri: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback\<number>): void;|@ohos.data.dataShare.d.ts| +|新增|NA|模块名: ohos.data.dataShare<br>类名: DataShareHelper<br>方法 or 属性: delete(uri: string, predicates: dataSharePredicates.DataSharePredicates): Promise\<number>;|@ohos.data.dataShare.d.ts| +|新增|NA|模块名: ohos.data.dataShare<br>类名: DataShareHelper<br>方法 or 属性: query(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array\<string>,<br> callback: AsyncCallback\<DataShareResultSet>): void;|@ohos.data.dataShare.d.ts| +|新增|NA|模块名: ohos.data.dataShare<br>类名: DataShareHelper<br>方法 or 属性: query(uri: string, predicates: dataSharePredicates.DataSharePredicates,<br> columns: Array\<string>): Promise\<DataShareResultSet>;|@ohos.data.dataShare.d.ts| +|新增|NA|模块名: ohos.data.dataShare<br>类名: DataShareHelper<br>方法 or 属性: update(uri: string, predicates: dataSharePredicates.DataSharePredicates, value: ValuesBucket,<br> callback: AsyncCallback\<number>): void;|@ohos.data.dataShare.d.ts| +|新增|NA|模块名: ohos.data.dataShare<br>类名: DataShareHelper<br>方法 or 属性: update(uri: string, predicates: dataSharePredicates.DataSharePredicates, value: ValuesBucket): Promise\<number>;|@ohos.data.dataShare.d.ts| +|新增|NA|模块名: ohos.data.dataShare<br>类名: DataShareHelper<br>方法 or 属性: batchInsert(uri: string, values: Array\<ValuesBucket>, callback: AsyncCallback\<number>): void;|@ohos.data.dataShare.d.ts| +|新增|NA|模块名: ohos.data.dataShare<br>类名: DataShareHelper<br>方法 or 属性: batchInsert(uri: string, values: Array\<ValuesBucket>): Promise\<number>;|@ohos.data.dataShare.d.ts| +|新增|NA|模块名: ohos.data.dataShare<br>类名: DataShareHelper<br>方法 or 属性: normalizeUri(uri: string, callback: AsyncCallback\<string>): void;|@ohos.data.dataShare.d.ts| +|新增|NA|模块名: ohos.data.dataShare<br>类名: DataShareHelper<br>方法 or 属性: normalizeUri(uri: string): Promise\<string>;|@ohos.data.dataShare.d.ts| +|新增|NA|模块名: ohos.data.dataShare<br>类名: DataShareHelper<br>方法 or 属性: denormalizeUri(uri: string, callback: AsyncCallback\<string>): void;|@ohos.data.dataShare.d.ts| +|新增|NA|模块名: ohos.data.dataShare<br>类名: DataShareHelper<br>方法 or 属性: denormalizeUri(uri: string): Promise\<string>;|@ohos.data.dataShare.d.ts| +|新增|NA|模块名: ohos.data.dataShare<br>类名: DataShareHelper<br>方法 or 属性: notifyChange(uri: string, callback: AsyncCallback\<void>): void;|@ohos.data.dataShare.d.ts| +|新增|NA|模块名: ohos.data.dataShare<br>类名: DataShareHelper<br>方法 or 属性: notifyChange(uri: string): Promise\<void>;|@ohos.data.dataShare.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: dataSharePredicates|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates<br>方法 or 属性: equalTo(field: string, value: ValueType): DataSharePredicates;|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates<br>方法 or 属性: notEqualTo(field: string, value: ValueType): DataSharePredicates;|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates<br>方法 or 属性: beginWrap(): DataSharePredicates;|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates<br>方法 or 属性: endWrap(): DataSharePredicates;|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates<br>方法 or 属性: or(): DataSharePredicates;|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates<br>方法 or 属性: and(): DataSharePredicates;|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates<br>方法 or 属性: contains(field: string, value: string): DataSharePredicates;|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates<br>方法 or 属性: beginsWith(field: string, value: string): DataSharePredicates;|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates<br>方法 or 属性: endsWith(field: string, value: string): DataSharePredicates;|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates<br>方法 or 属性: isNull(field: string): DataSharePredicates;|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates<br>方法 or 属性: isNotNull(field: string): DataSharePredicates;|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates<br>方法 or 属性: like(field: string, value: string): DataSharePredicates;|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates<br>方法 or 属性: unlike(field: string, value: string): DataSharePredicates;|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates<br>方法 or 属性: glob(field: string, value: string): DataSharePredicates;|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates<br>方法 or 属性: between(field: string, low: ValueType, high: ValueType): DataSharePredicates;|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates<br>方法 or 属性: notBetween(field: string, low: ValueType, high: ValueType): DataSharePredicates;|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates<br>方法 or 属性: greaterThan(field: string, value: ValueType): DataSharePredicates;|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates<br>方法 or 属性: lessThan(field: string, value: ValueType): DataSharePredicates;|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates<br>方法 or 属性: greaterThanOrEqualTo(field: string, value: ValueType): DataSharePredicates;|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates<br>方法 or 属性: lessThanOrEqualTo(field: string, value: ValueType): DataSharePredicates;|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates<br>方法 or 属性: orderByAsc(field: string): DataSharePredicates;|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates<br>方法 or 属性: orderByDesc(field: string): DataSharePredicates;|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates<br>方法 or 属性: distinct(): DataSharePredicates;|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates<br>方法 or 属性: limit(total: number, offset: number): DataSharePredicates;|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates<br>方法 or 属性: groupBy(fields: Array\<string>): DataSharePredicates;|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates<br>方法 or 属性: indexedBy(field: string): DataSharePredicates;|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates<br>方法 or 属性: in(field: string, value: Array\<ValueType>): DataSharePredicates;|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates<br>方法 or 属性: notIn(field: string, value: Array\<ValueType>): DataSharePredicates;|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates<br>方法 or 属性: prefixKey(prefix: string): DataSharePredicates;|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.dataSharePredicates<br>类名: DataSharePredicates<br>方法 or 属性: inKeys(keys: Array\<string>): DataSharePredicates;|@ohos.data.dataSharePredicates.d.ts| +|新增|NA|模块名: ohos.data.DataShareResultSet<br>类名: DataType|@ohos.data.DataShareResultSet.d.ts| +|新增|NA|模块名: ohos.data.DataShareResultSet<br>类名: DataType<br>方法 or 属性: TYPE_NULL = 0|@ohos.data.DataShareResultSet.d.ts| +|新增|NA|模块名: ohos.data.DataShareResultSet<br>类名: DataType<br>方法 or 属性: TYPE_LONG = 1|@ohos.data.DataShareResultSet.d.ts| +|新增|NA|模块名: ohos.data.DataShareResultSet<br>类名: DataType<br>方法 or 属性: TYPE_DOUBLE = 2|@ohos.data.DataShareResultSet.d.ts| +|新增|NA|模块名: ohos.data.DataShareResultSet<br>类名: DataType<br>方法 or 属性: TYPE_STRING = 3|@ohos.data.DataShareResultSet.d.ts| +|新增|NA|模块名: ohos.data.DataShareResultSet<br>类名: DataType<br>方法 or 属性: TYPE_BLOB = 4|@ohos.data.DataShareResultSet.d.ts| +|新增|NA|模块名: ohos.data.DataShareResultSet<br>类名: DataShareResultSet|@ohos.data.DataShareResultSet.d.ts| +|新增|NA|模块名: ohos.data.DataShareResultSet<br>类名: DataShareResultSet<br>方法 or 属性: columnNames: Array\<string>;|@ohos.data.DataShareResultSet.d.ts| +|新增|NA|模块名: ohos.data.DataShareResultSet<br>类名: DataShareResultSet<br>方法 or 属性: columnCount: number;|@ohos.data.DataShareResultSet.d.ts| +|新增|NA|模块名: ohos.data.DataShareResultSet<br>类名: DataShareResultSet<br>方法 or 属性: rowCount: number;|@ohos.data.DataShareResultSet.d.ts| +|新增|NA|模块名: ohos.data.DataShareResultSet<br>类名: DataShareResultSet<br>方法 or 属性: isClosed: boolean;|@ohos.data.DataShareResultSet.d.ts| +|新增|NA|模块名: ohos.data.DataShareResultSet<br>类名: DataShareResultSet<br>方法 or 属性: goToFirstRow(): boolean;|@ohos.data.DataShareResultSet.d.ts| +|新增|NA|模块名: ohos.data.DataShareResultSet<br>类名: DataShareResultSet<br>方法 or 属性: goToLastRow(): boolean;|@ohos.data.DataShareResultSet.d.ts| +|新增|NA|模块名: ohos.data.DataShareResultSet<br>类名: DataShareResultSet<br>方法 or 属性: goToNextRow(): boolean;|@ohos.data.DataShareResultSet.d.ts| +|新增|NA|模块名: ohos.data.DataShareResultSet<br>类名: DataShareResultSet<br>方法 or 属性: goToPreviousRow(): boolean;|@ohos.data.DataShareResultSet.d.ts| +|新增|NA|模块名: ohos.data.DataShareResultSet<br>类名: DataShareResultSet<br>方法 or 属性: goTo(offset: number): boolean;|@ohos.data.DataShareResultSet.d.ts| +|新增|NA|模块名: ohos.data.DataShareResultSet<br>类名: DataShareResultSet<br>方法 or 属性: goToRow(position: number): boolean;|@ohos.data.DataShareResultSet.d.ts| +|新增|NA|模块名: ohos.data.DataShareResultSet<br>类名: DataShareResultSet<br>方法 or 属性: getBlob(columnIndex: number): Uint8Array;|@ohos.data.DataShareResultSet.d.ts| +|新增|NA|模块名: ohos.data.DataShareResultSet<br>类名: DataShareResultSet<br>方法 or 属性: getString(columnIndex: number): string;|@ohos.data.DataShareResultSet.d.ts| +|新增|NA|模块名: ohos.data.DataShareResultSet<br>类名: DataShareResultSet<br>方法 or 属性: getLong(columnIndex: number): number;|@ohos.data.DataShareResultSet.d.ts| +|新增|NA|模块名: ohos.data.DataShareResultSet<br>类名: DataShareResultSet<br>方法 or 属性: getDouble(columnIndex: number): number;|@ohos.data.DataShareResultSet.d.ts| +|新增|NA|模块名: ohos.data.DataShareResultSet<br>类名: DataShareResultSet<br>方法 or 属性: close(): void;|@ohos.data.DataShareResultSet.d.ts| +|新增|NA|模块名: ohos.data.DataShareResultSet<br>类名: DataShareResultSet<br>方法 or 属性: getColumnIndex(columnName: string): number;|@ohos.data.DataShareResultSet.d.ts| +|新增|NA|模块名: ohos.data.DataShareResultSet<br>类名: DataShareResultSet<br>方法 or 属性: getColumnName(columnIndex: number): string;|@ohos.data.DataShareResultSet.d.ts| +|新增|NA|模块名: ohos.data.DataShareResultSet<br>类名: DataShareResultSet<br>方法 or 属性: getDataType(columnIndex: number): DataType;|@ohos.data.DataShareResultSet.d.ts| +|新增|NA|类名:KVStore<br>方法or属性:off(event: 'syncComplete', syncCallback?: Callback\<Array\<[string, number]>>): void;|@ohos.data.distributedData.d.ts| +|新增|NA|类名:distributedDataObject<br>方法or属性:function create(context: Context, source: object): DataObject;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|模块名: ohos.data.distributedDataObject<br>类名: SaveSuccessResponse|@ohos.data.distributedDataObject.d.ts| +|新增|NA|类名:SaveSuccessResponse<br>方法or属性:|@ohos.data.distributedDataObject.d.ts| +|新增|NA|模块名: ohos.data.distributedDataObject<br>类名: SaveSuccessResponse<br>方法 or 属性:sessionId: string;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|类名:SaveSuccessResponse<br>方法or属性:sessionId: string;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|模块名: ohos.data.distributedDataObject<br>类名: SaveSuccessResponse<br>方法 or 属性:version: number;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|类名:SaveSuccessResponse<br>方法or属性:version: number;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|模块名: ohos.data.distributedDataObject<br>类名: SaveSuccessResponse<br>方法 or 属性:deviceId: string;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|类名:SaveSuccessResponse<br>方法or属性:deviceId: string;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|模块名: ohos.data.distributedDataObject<br>类名: RevokeSaveSuccessResponse|@ohos.data.distributedDataObject.d.ts| +|新增|NA|类名:RevokeSaveSuccessResponse<br>方法or属性:|@ohos.data.distributedDataObject.d.ts| +|新增|NA|模块名: ohos.data.distributedDataObject<br>类名: RevokeSaveSuccessResponse<br>方法 or 属性:sessionId: string;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|类名:RevokeSaveSuccessResponse<br>方法or属性:sessionId: string;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|模块名: ohos.data.distributedDataObject<br>类名: DataObject|@ohos.data.distributedDataObject.d.ts| +|新增|NA|类名:DataObject<br>方法or属性:|@ohos.data.distributedDataObject.d.ts| +|新增|NA|模块名: ohos.data.distributedDataObject<br>类名: DataObject<br>方法 or 属性:setSessionId(sessionId: string, callback: AsyncCallback\<void>): void;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|类名:DataObject<br>方法or属性:setSessionId(sessionId: string, callback: AsyncCallback\<void>): void;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|模块名: ohos.data.distributedDataObject<br>类名: DataObject<br>方法 or 属性:setSessionId(callback: AsyncCallback\<void>): void;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|类名:DataObject<br>方法or属性:setSessionId(callback: AsyncCallback\<void>): void;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|模块名: ohos.data.distributedDataObject<br>类名: DataObject<br>方法 or 属性:setSessionId(sessionId?: string): Promise\<void>;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|类名:DataObject<br>方法or属性:setSessionId(sessionId?: string): Promise\<void>;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|模块名: ohos.data.distributedDataObject<br>类名: DataObject<br>方法 or 属性:on(type: 'change', callback: Callback\<{ sessionId: string, fields: Array\<string> }>): void;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|类名:DataObject<br>方法or属性:on(type: 'change', callback: Callback\<{ sessionId: string, fields: Array\<string> }>): void;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|模块名: ohos.data.distributedDataObject<br>类名: DataObject<br>方法 or 属性:off(type: 'change', callback?: Callback\<{ sessionId: string, fields: Array\<string> }>): void;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|类名:DataObject<br>方法or属性:off(type: 'change', callback?: Callback\<{ sessionId: string, fields: Array\<string> }>): void;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|模块名: ohos.data.distributedDataObject<br>类名: DataObject<br>方法 or 属性:on(type: 'status',<br><br> callback: Callback\<{ sessionId: string, networkId: string, status: 'online' \| 'offline' }>): void;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|模块名: ohos.data.distributedDataObject<br>类名: DataObject<br>方法 or 属性:off(type: 'status',<br><br> callback?: Callback\<{ sessionId: string, deviceId: string, status: 'online' \| 'offline' }>): void;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|模块名: ohos.data.distributedDataObject<br>类名: DataObject<br>方法 or 属性:save(deviceId: string, callback: AsyncCallback\<SaveSuccessResponse>): void;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|类名:DataObject<br>方法or属性:save(deviceId: string, callback: AsyncCallback\<SaveSuccessResponse>): void;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|模块名: ohos.data.distributedDataObject<br>类名: DataObject<br>方法 or 属性:save(deviceId: string): Promise\<SaveSuccessResponse>;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|类名:DataObject<br>方法or属性:save(deviceId: string): Promise\<SaveSuccessResponse>;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|模块名: ohos.data.distributedDataObject<br>类名: DataObject<br>方法 or 属性:revokeSave(callback: AsyncCallback\<RevokeSaveSuccessResponse>): void;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|类名:DataObject<br>方法or属性:revokeSave(callback: AsyncCallback\<RevokeSaveSuccessResponse>): void;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|模块名: ohos.data.distributedDataObject<br>类名: DataObject<br>方法 or 属性:revokeSave(): Promise\<RevokeSaveSuccessResponse>;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|类名:DataObject<br>方法or属性:revokeSave(): Promise\<RevokeSaveSuccessResponse>;|@ohos.data.distributedDataObject.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: distributedKVStore|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVManagerConfig|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVManagerConfig<br>方法 or 属性: bundleName: string;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVManagerConfig<br>方法 or 属性: context: Context;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Constants|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Constants<br>方法 or 属性: readonly MAX_KEY_LENGTH: number;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Constants<br>方法 or 属性: readonly MAX_VALUE_LENGTH: number;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Constants<br>方法 or 属性: readonly MAX_KEY_LENGTH_DEVICE: number;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Constants<br>方法 or 属性: readonly MAX_STORE_ID_LENGTH: number;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Constants<br>方法 or 属性: readonly MAX_QUERY_LENGTH: number;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Constants<br>方法 or 属性: readonly MAX_BATCH_SIZE: number;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: ValueType|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: ValueType<br>方法 or 属性: STRING|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: ValueType<br>方法 or 属性: INTEGER|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: ValueType<br>方法 or 属性: FLOAT|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: ValueType<br>方法 or 属性: BYTE_ARRAY|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: ValueType<br>方法 or 属性: BOOLEAN|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: ValueType<br>方法 or 属性: DOUBLE|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Value|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Value<br>方法 or 属性: type: ValueType;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Value<br>方法 or 属性: value: Uint8Array \| string \| number \| boolean;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Entry|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Entry<br>方法 or 属性: key: string;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Entry<br>方法 or 属性: value: Value;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: ChangeNotification|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: ChangeNotification<br>方法 or 属性: insertEntries: Entry[];|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: ChangeNotification<br>方法 or 属性: updateEntries: Entry[];|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: ChangeNotification<br>方法 or 属性: deleteEntries: Entry[];|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: ChangeNotification<br>方法 or 属性: deviceId: string;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SyncMode|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SyncMode<br>方法 or 属性: PULL_ONLY|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SyncMode<br>方法 or 属性: PUSH_ONLY|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SyncMode<br>方法 or 属性: PUSH_PULL|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SubscribeType|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SubscribeType<br>方法 or 属性: SUBSCRIBE_TYPE_LOCAL|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SubscribeType<br>方法 or 属性: SUBSCRIBE_TYPE_REMOTE|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SubscribeType<br>方法 or 属性: SUBSCRIBE_TYPE_ALL|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVStoreType|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVStoreType<br>方法 or 属性: DEVICE_COLLABORATION|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVStoreType<br>方法 or 属性: SINGLE_VERSION|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SecurityLevel|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SecurityLevel<br>方法 or 属性: S1|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SecurityLevel<br>方法 or 属性: S2|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SecurityLevel<br>方法 or 属性: S3|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SecurityLevel<br>方法 or 属性: S4|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Options|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Options<br>方法 or 属性: createIfMissing?: boolean;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Options<br>方法 or 属性: encrypt?: boolean;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Options<br>方法 or 属性: backup?: boolean;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Options<br>方法 or 属性: autoSync?: boolean;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Options<br>方法 or 属性: kvStoreType?: KVStoreType;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Options<br>方法 or 属性: securityLevel: SecurityLevel;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Options<br>方法 or 属性: schema?: Schema;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Schema|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Schema<br>方法 or 属性: constructor()|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Schema<br>方法 or 属性: root: FieldNode;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Schema<br>方法 or 属性: indexes: Array\<string>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Schema<br>方法 or 属性: mode: number;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Schema<br>方法 or 属性: skip: number;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: FieldNode|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: FieldNode<br>方法 or 属性: constructor(name: string)|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: FieldNode<br>方法 or 属性: appendChild(child: FieldNode): boolean;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: FieldNode<br>方法 or 属性: default: string;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: FieldNode<br>方法 or 属性: nullable: boolean;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: FieldNode<br>方法 or 属性: type: number;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVStoreResultSet|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVStoreResultSet<br>方法 or 属性: getCount(): number;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVStoreResultSet<br>方法 or 属性: getPosition(): number;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVStoreResultSet<br>方法 or 属性: moveToFirst(): boolean;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVStoreResultSet<br>方法 or 属性: moveToLast(): boolean;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVStoreResultSet<br>方法 or 属性: moveToNext(): boolean;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVStoreResultSet<br>方法 or 属性: moveToPrevious(): boolean;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVStoreResultSet<br>方法 or 属性: move(offset: number): boolean;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVStoreResultSet<br>方法 or 属性: moveToPosition(position: number): boolean;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVStoreResultSet<br>方法 or 属性: isFirst(): boolean;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVStoreResultSet<br>方法 or 属性: isLast(): boolean;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVStoreResultSet<br>方法 or 属性: isBeforeFirst(): boolean;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVStoreResultSet<br>方法 or 属性: isAfterLast(): boolean;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVStoreResultSet<br>方法 or 属性: getEntry(): Entry;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Query|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Query<br>方法 or 属性: constructor()|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Query<br>方法 or 属性: reset(): Query;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Query<br>方法 or 属性: equalTo(field: string, value: number \| string \| boolean): Query;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Query<br>方法 or 属性: notEqualTo(field: string, value: number \| string \| boolean): Query;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Query<br>方法 or 属性: greaterThan(field: string, value: number \| string \| boolean): Query;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Query<br>方法 or 属性: lessThan(field: string, value: number \| string): Query;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Query<br>方法 or 属性: greaterThanOrEqualTo(field: string, value: number \| string): Query;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Query<br>方法 or 属性: lessThanOrEqualTo(field: string, value: number \| string): Query;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Query<br>方法 or 属性: isNull(field: string): Query;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Query<br>方法 or 属性: inNumber(field: string, valueList: number[]): Query;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Query<br>方法 or 属性: inString(field: string, valueList: string[]): Query;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Query<br>方法 or 属性: notInNumber(field: string, valueList: number[]): Query;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Query<br>方法 or 属性: notInString(field: string, valueList: string[]): Query;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Query<br>方法 or 属性: like(field: string, value: string): Query;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Query<br>方法 or 属性: unlike(field: string, value: string): Query;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Query<br>方法 or 属性: and(): Query;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Query<br>方法 or 属性: or(): Query;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Query<br>方法 or 属性: orderByAsc(field: string): Query;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Query<br>方法 or 属性: orderByDesc(field: string): Query;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Query<br>方法 or 属性: limit(total: number, offset: number): Query;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Query<br>方法 or 属性: isNotNull(field: string): Query;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Query<br>方法 or 属性: beginGroup(): Query;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Query<br>方法 or 属性: endGroup(): Query;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Query<br>方法 or 属性: prefixKey(prefix: string): Query;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Query<br>方法 or 属性: setSuggestIndex(index: string): Query;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Query<br>方法 or 属性: deviceId(deviceId: string): Query;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: Query<br>方法 or 属性: getSqlLike(): string;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: put(key: string, value: Uint8Array \| string \| number \| boolean, callback: AsyncCallback\<void>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: put(key: string, value: Uint8Array \| string \| number \| boolean): Promise\<void>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: putBatch(entries: Entry[], callback: AsyncCallback\<void>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: putBatch(entries: Entry[]): Promise\<void>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: putBatch(value: Array\<ValuesBucket>, callback: AsyncCallback\<void>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: putBatch(value: Array\<ValuesBucket>): Promise\<void>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: delete(key: string, callback: AsyncCallback\<void>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: delete(key: string): Promise\<void>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: delete(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback\<void>);|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: delete(predicates: dataSharePredicates.DataSharePredicates): Promise\<void>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: deleteBatch(keys: string[], callback: AsyncCallback\<void>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: deleteBatch(keys: string[]): Promise\<void>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: removeDeviceData(deviceId: string, callback: AsyncCallback\<void>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: removeDeviceData(deviceId: string): Promise\<void>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: get(key: string, callback: AsyncCallback\<boolean \| string \| number \| Uint8Array>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: get(key: string): Promise\<boolean \| string \| number \| Uint8Array>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: getEntries(keyPrefix: string, callback: AsyncCallback\<Entry[]>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: getEntries(keyPrefix: string): Promise\<Entry[]>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: getEntries(query: Query, callback: AsyncCallback\<Entry[]>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: getEntries(query: Query): Promise\<Entry[]>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: getResultSet(keyPrefix: string, callback: AsyncCallback\<KVStoreResultSet>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: getResultSet(keyPrefix: string): Promise\<KVStoreResultSet>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: getResultSet(query: Query, callback: AsyncCallback\<KVStoreResultSet>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: getResultSet(query: Query): Promise\<KVStoreResultSet>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback\<KVStoreResultSet>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise\<KVStoreResultSet>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: closeResultSet(resultSet: KVStoreResultSet, callback: AsyncCallback\<void>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: closeResultSet(resultSet: KVStoreResultSet): Promise\<void>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: getResultSize(query: Query, callback: AsyncCallback\<number>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: getResultSize(query: Query): Promise\<number>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: backup(file: string, callback: AsyncCallback\<void>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: backup(file: string): Promise\<void>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: restore(file: string, callback: AsyncCallback\<void>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: restore(file: string): Promise\<void>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: deleteBackup(files: Array\<string>, callback: AsyncCallback\<Array\<[string, number]>>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: deleteBackup(files: Array\<string>): Promise\<Array\<[string, number]>>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: startTransaction(callback: AsyncCallback\<void>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: startTransaction(): Promise\<void>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: commit(callback: AsyncCallback\<void>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: commit(): Promise\<void>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: rollback(callback: AsyncCallback\<void>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: rollback(): Promise\<void>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: enableSync(enabled: boolean, callback: AsyncCallback\<void>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: enableSync(enabled: boolean): Promise\<void>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback\<void>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise\<void>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback\<void>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: setSyncParam(defaultAllowedDelayMs: number): Promise\<void>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: sync(deviceIds: string[], query: Query, mode: SyncMode, delayMs?: number): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: on(event: 'dataChange', type: SubscribeType, listener: Callback\<ChangeNotification>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: on(event: 'syncComplete', syncCallback: Callback\<Array\<[string, number]>>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: off(event: 'dataChange', listener?: Callback\<ChangeNotification>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: off(event: 'syncComplete', syncCallback?: Callback\<Array\<[string, number]>>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: getSecurityLevel(callback: AsyncCallback\<SecurityLevel>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: SingleKVStore<br>方法 or 属性: getSecurityLevel(): Promise\<SecurityLevel>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: DeviceKVStore|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: DeviceKVStore<br>方法 or 属性: get(key: string, callback: AsyncCallback\<boolean \| string \| number \| Uint8Array>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: DeviceKVStore<br>方法 or 属性: get(key: string): Promise\<boolean \| string \| number \| Uint8Array>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: DeviceKVStore<br>方法 or 属性: get(deviceId: string, key: string, callback: AsyncCallback\<boolean \| string \| number \| Uint8Array>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: DeviceKVStore<br>方法 or 属性: get(deviceId: string, key: string): Promise\<boolean \| string \| number \| Uint8Array>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: DeviceKVStore<br>方法 or 属性: getEntries(keyPrefix: string, callback: AsyncCallback\<Entry[]>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: DeviceKVStore<br>方法 or 属性: getEntries(keyPrefix: string): Promise\<Entry[]>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: DeviceKVStore<br>方法 or 属性: getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback\<Entry[]>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: DeviceKVStore<br>方法 or 属性: getEntries(deviceId: string, keyPrefix: string): Promise\<Entry[]>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: DeviceKVStore<br>方法 or 属性: getEntries(query: Query, callback: AsyncCallback\<Entry[]>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: DeviceKVStore<br>方法 or 属性: getEntries(query: Query): Promise\<Entry[]>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: DeviceKVStore<br>方法 or 属性: getEntries(deviceId: string, query: Query, callback: AsyncCallback\<Entry[]>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: DeviceKVStore<br>方法 or 属性: getEntries(deviceId: string, query: Query): Promise\<Entry[]>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: DeviceKVStore<br>方法 or 属性: getResultSet(keyPrefix: string, callback: AsyncCallback\<KVStoreResultSet>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: DeviceKVStore<br>方法 or 属性: getResultSet(keyPrefix: string): Promise\<KVStoreResultSet>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: DeviceKVStore<br>方法 or 属性: getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback\<KVStoreResultSet>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: DeviceKVStore<br>方法 or 属性: getResultSet(deviceId: string, keyPrefix: string): Promise\<KVStoreResultSet>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: DeviceKVStore<br>方法 or 属性: getResultSet(query: Query, callback: AsyncCallback\<KVStoreResultSet>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: DeviceKVStore<br>方法 or 属性: getResultSet(query: Query): Promise\<KVStoreResultSet>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: DeviceKVStore<br>方法 or 属性: getResultSet(deviceId: string, query: Query, callback: AsyncCallback\<KVStoreResultSet>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: DeviceKVStore<br>方法 or 属性: getResultSet(deviceId: string, query: Query): Promise\<KVStoreResultSet>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: DeviceKVStore<br>方法 or 属性: getResultSet(predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback\<KVStoreResultSet>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: DeviceKVStore<br>方法 or 属性: getResultSet(predicates: dataSharePredicates.DataSharePredicates): Promise\<KVStoreResultSet>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: DeviceKVStore<br>方法 or 属性: getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback\<KVStoreResultSet>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: DeviceKVStore<br>方法 or 属性: getResultSet(deviceId: string, predicates: dataSharePredicates.DataSharePredicates): Promise\<KVStoreResultSet>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: DeviceKVStore<br>方法 or 属性: getResultSize(query: Query, callback: AsyncCallback\<number>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: DeviceKVStore<br>方法 or 属性: getResultSize(query: Query): Promise\<number>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: DeviceKVStore<br>方法 or 属性: getResultSize(deviceId: string, query: Query, callback: AsyncCallback\<number>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: DeviceKVStore<br>方法 or 属性: getResultSize(deviceId: string, query: Query): Promise\<number>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: distributedKVStore<br>方法 or 属性: function createKVManager(config: KVManagerConfig): KVManager;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVManager|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVManager<br>方法 or 属性: getKVStore\<T>(storeId: string, options: Options, callback: AsyncCallback\<T>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVManager<br>方法 or 属性: getKVStore\<T>(storeId: string, options: Options): Promise\<T>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVManager<br>方法 or 属性: closeKVStore(appId: string, storeId: string, callback: AsyncCallback\<void>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVManager<br>方法 or 属性: closeKVStore(appId: string, storeId: string): Promise\<void>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVManager<br>方法 or 属性: deleteKVStore(appId: string, storeId: string, callback: AsyncCallback\<void>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVManager<br>方法 or 属性: deleteKVStore(appId: string, storeId: string): Promise\<void>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVManager<br>方法 or 属性: getAllKVStoreId(appId: string, callback: AsyncCallback\<string[]>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVManager<br>方法 or 属性: getAllKVStoreId(appId: string): Promise\<string[]>;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVManager<br>方法 or 属性: on(event: 'distributedDataServiceDie', deathCallback: Callback\<void>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.distributedKVStore<br>类名: KVManager<br>方法 or 属性: off(event: 'distributedDataServiceDie', deathCallback?: Callback\<void>): void;|@ohos.data.distributedKVStore.d.ts| +|新增|NA|模块名: ohos.data.preferences<br>类名: preferences|@ohos.data.preferences.d.ts| +|新增|NA|模块名: ohos.data.preferences<br>类名: preferences<br>方法 or 属性: function getPreferences(context: Context, name: string, callback: AsyncCallback\<Preferences>): void;|@ohos.data.preferences.d.ts| +|新增|NA|模块名: ohos.data.preferences<br>类名: preferences<br>方法 or 属性: function getPreferences(context: Context, name: string): Promise\<Preferences>;|@ohos.data.preferences.d.ts| +|新增|NA|模块名: ohos.data.preferences<br>类名: preferences<br>方法 or 属性: function deletePreferences(context: Context, name: string, callback: AsyncCallback\<void>): void;|@ohos.data.preferences.d.ts| +|新增|NA|模块名: ohos.data.preferences<br>类名: preferences<br>方法 or 属性: function deletePreferences(context: Context, name: string): Promise\<void>;|@ohos.data.preferences.d.ts| +|新增|NA|模块名: ohos.data.preferences<br>类名: preferences<br>方法 or 属性: function removePreferencesFromCache(context: Context, name: string, callback: AsyncCallback\<void>): void;|@ohos.data.preferences.d.ts| +|新增|NA|模块名: ohos.data.preferences<br>类名: preferences<br>方法 or 属性: function removePreferencesFromCache(context: Context, name: string): Promise\<void>;|@ohos.data.preferences.d.ts| +|新增|NA|模块名: ohos.data.preferences<br>类名: Preferences|@ohos.data.preferences.d.ts| +|新增|NA|模块名: ohos.data.preferences<br>类名: Preferences<br>方法 or 属性: get(key: string, defValue: ValueType, callback: AsyncCallback\<ValueType>): void;|@ohos.data.preferences.d.ts| +|新增|NA|模块名: ohos.data.preferences<br>类名: Preferences<br>方法 or 属性: get(key: string, defValue: ValueType): Promise\<ValueType>;|@ohos.data.preferences.d.ts| +|新增|NA|模块名: ohos.data.preferences<br>类名: Preferences<br>方法 or 属性: getAll(callback: AsyncCallback\<Object>): void;|@ohos.data.preferences.d.ts| +|新增|NA|模块名: ohos.data.preferences<br>类名: Preferences<br>方法 or 属性: getAll(): Promise\<Object>;|@ohos.data.preferences.d.ts| +|新增|NA|模块名: ohos.data.preferences<br>类名: Preferences<br>方法 or 属性: has(key: string, callback: AsyncCallback\<boolean>): void;|@ohos.data.preferences.d.ts| +|新增|NA|模块名: ohos.data.preferences<br>类名: Preferences<br>方法 or 属性: has(key: string): Promise\<boolean>;|@ohos.data.preferences.d.ts| +|新增|NA|模块名: ohos.data.preferences<br>类名: Preferences<br>方法 or 属性: put(key: string, value: ValueType, callback: AsyncCallback\<void>): void;|@ohos.data.preferences.d.ts| +|新增|NA|模块名: ohos.data.preferences<br>类名: Preferences<br>方法 or 属性: put(key: string, value: ValueType): Promise\<void>;|@ohos.data.preferences.d.ts| +|新增|NA|模块名: ohos.data.preferences<br>类名: Preferences<br>方法 or 属性: delete(key: string, callback: AsyncCallback\<void>): void;|@ohos.data.preferences.d.ts| +|新增|NA|模块名: ohos.data.preferences<br>类名: Preferences<br>方法 or 属性: delete(key: string): Promise\<void>;|@ohos.data.preferences.d.ts| +|新增|NA|模块名: ohos.data.preferences<br>类名: Preferences<br>方法 or 属性: clear(callback: AsyncCallback\<void>): void;|@ohos.data.preferences.d.ts| +|新增|NA|模块名: ohos.data.preferences<br>类名: Preferences<br>方法 or 属性: clear(): Promise\<void>;|@ohos.data.preferences.d.ts| +|新增|NA|模块名: ohos.data.preferences<br>类名: Preferences<br>方法 or 属性: flush(callback: AsyncCallback\<void>): void;|@ohos.data.preferences.d.ts| +|新增|NA|模块名: ohos.data.preferences<br>类名: Preferences<br>方法 or 属性: flush(): Promise\<void>;|@ohos.data.preferences.d.ts| +|新增|NA|模块名: ohos.data.preferences<br>类名: Preferences<br>方法 or 属性: on(type: 'change', callback: Callback\<{ key: string }>): void;|@ohos.data.preferences.d.ts| +|新增|NA|模块名: ohos.data.preferences<br>类名: Preferences<br>方法 or 属性: off(type: 'change', callback?: Callback\<{ key: string }>): void;|@ohos.data.preferences.d.ts| +|新增|NA|模块名: ohos.data.preferences<br>类名: preferences<br>方法 or 属性: const MAX_KEY_LENGTH: 80;|@ohos.data.preferences.d.ts| +|新增|NA|模块名: ohos.data.preferences<br>类名: preferences<br>方法 or 属性: const MAX_VALUE_LENGTH: 8192;|@ohos.data.preferences.d.ts| +|新增|NA|类名:RdbStore<br>方法or属性:batchInsert(table: string, values: Array\<ValuesBucket>, callback: AsyncCallback\<number>): void;|@ohos.data.rdb.d.ts| +|新增|NA|类名:RdbStore<br>方法or属性:batchInsert(table: string, values: Array\<ValuesBucket>): Promise\<number>;|@ohos.data.rdb.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: relationalStore|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: relationalStore<br>方法 or 属性: type ValuesBucket = { [key:string]: ValueType \| Uint8Array \| null;}|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: relationalStore<br>方法 or 属性: function getRdbStore(context: Context, config: StoreConfig, callback: AsyncCallback\<RdbStore>): void;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: relationalStore<br>方法 or 属性: function getRdbStore(context: Context, config: StoreConfig): Promise\<RdbStore>;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: relationalStore<br>方法 or 属性: function deleteRdbStore(context: Context, name: string, callback: AsyncCallback\<void>): void;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: relationalStore<br>方法 or 属性: function deleteRdbStore(context: Context, name: string): Promise\<void>;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: StoreConfig|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: StoreConfig<br>方法 or 属性: name: string;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: StoreConfig<br>方法 or 属性: securityLevel: SecurityLevel;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: StoreConfig<br>方法 or 属性: encrypt ?: boolean;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: SecurityLevel|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: SecurityLevel<br>方法 or 属性: S1 = 1|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: SecurityLevel<br>方法 or 属性: S2 = 2|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: SecurityLevel<br>方法 or 属性: S3 = 3|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: SecurityLevel<br>方法 or 属性: S4 = 4|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: SyncMode|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: SyncMode<br>方法 or 属性: SYNC_MODE_PUSH = 0|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: SyncMode<br>方法 or 属性: SYNC_MODE_PULL = 1|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: SubscribeType|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: SubscribeType<br>方法 or 属性: SUBSCRIBE_TYPE_REMOTE = 0|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: insert(table: string, values: ValuesBucket, callback: AsyncCallback\<number>): void;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: insert(table: string, values: ValuesBucket): Promise\<number>;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: batchInsert(table: string, values: Array\<ValuesBucket>, callback: AsyncCallback\<number>): void;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: batchInsert(table: string, values: Array\<ValuesBucket>): Promise\<number>;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: update(values: ValuesBucket, predicates: RdbPredicates, callback: AsyncCallback\<number>): void;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: update(values: ValuesBucket, predicates: RdbPredicates): Promise\<number>;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback\<number>): void;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates): Promise\<number>;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: delete(predicates: RdbPredicates, callback: AsyncCallback\<number>): void;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: delete(predicates: RdbPredicates): Promise\<number>;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: delete(table: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback\<number>): void;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: delete(table: string, predicates: dataSharePredicates.DataSharePredicates): Promise\<number>;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: query(predicates: RdbPredicates, columns: Array\<string>, callback: AsyncCallback\<ResultSet>): void;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: query(predicates: RdbPredicates, columns ?: Array\<string>): Promise\<ResultSet>;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array\<string>, callback: AsyncCallback\<ResultSet>): void;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns ?: Array\<string>): Promise\<ResultSet>;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: querySql(sql: string, bindArgs: Array\<ValueType>, callback: AsyncCallback\<ResultSet>): void;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: querySql(sql: string, bindArgs ?: Array\<ValueType>): Promise\<ResultSet>;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: executeSql(sql: string, bindArgs: Array\<ValueType>, callback: AsyncCallback\<void>): void;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: executeSql(sql: string, bindArgs ?: Array\<ValueType>): Promise\<void>;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: beginTransaction(): void;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: commit(): void;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: rollBack(): void;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: backup(destName: string, callback: AsyncCallback\<void>): void;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: backup(destName: string): Promise\<void>;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: restore(srcName: string, callback: AsyncCallback\<void>): void;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: restore(srcName: string): Promise\<void>;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: setDistributedTables(tables: Array\<string>, callback: AsyncCallback\<void>): void;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: setDistributedTables(tables: Array\<string>): Promise\<void>;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: obtainDistributedTableName(device: string, table: string, callback: AsyncCallback\<string>): void;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: obtainDistributedTableName(device: string, table: string): Promise\<string>;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: sync(mode: SyncMode, predicates: RdbPredicates, callback: AsyncCallback\<Array\<[ string, number ]>>): void;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: sync(mode: SyncMode, predicates: RdbPredicates): Promise\<Array\<[ string, number ]>>;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: Array\<string>, callback: AsyncCallback\<ResultSet>): void;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: remoteQuery(device: string, table: string, predicates: RdbPredicates, columns: Array\<string>): Promise\<ResultSet>;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: on(event: 'dataChange', type: SubscribeType, observer: Callback\<Array\<string>>): void;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbStore<br>方法 or 属性: off(event: 'dataChange', type: SubscribeType, observer: Callback\<Array\<string>>): void;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: constructor(name: string)|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: inDevices(devices: Array\<string>): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: inAllDevices(): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: equalTo(field: string, value: ValueType): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: notEqualTo(field: string, value: ValueType): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: beginWrap(): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: endWrap(): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: or(): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: and(): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: contains(field: string, value: string): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: beginsWith(field: string, value: string): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: endsWith(field: string, value: string): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: isNull(field: string): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: isNotNull(field: string): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: like(field: string, value: string): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: glob(field: string, value: string): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: between(field: string, low: ValueType, high: ValueType): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: notBetween(field: string, low: ValueType, high: ValueType): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: greaterThan(field: string, value: ValueType): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: lessThan(field: string, value: ValueType): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: greaterThanOrEqualTo(field: string, value: ValueType): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: lessThanOrEqualTo(field: string, value: ValueType): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: orderByAsc(field: string): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: orderByDesc(field: string): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: distinct(): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: limitAs(value: number): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: offsetAs(rowOffset: number): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: groupBy(fields: Array\<string>): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: indexedBy(field: string): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: in(field: string, value: Array\<ValueType>): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: RdbPredicates<br>方法 or 属性: notIn(field: string, value: Array\<ValueType>): RdbPredicates;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: ResultSet|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: ResultSet<br>方法 or 属性: columnNames: Array\<string>;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: ResultSet<br>方法 or 属性: columnCount: number;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: ResultSet<br>方法 or 属性: rowCount: number;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: ResultSet<br>方法 or 属性: rowIndex: number;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: ResultSet<br>方法 or 属性: isAtFirstRow: boolean;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: ResultSet<br>方法 or 属性: isAtLastRow: boolean;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: ResultSet<br>方法 or 属性: isEnded: boolean;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: ResultSet<br>方法 or 属性: isStarted: boolean;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: ResultSet<br>方法 or 属性: isClosed: boolean;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: ResultSet<br>方法 or 属性: getColumnIndex(columnName: string): number;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: ResultSet<br>方法 or 属性: getColumnName(columnIndex: number): string;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: ResultSet<br>方法 or 属性: goTo(offset: number): boolean;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: ResultSet<br>方法 or 属性: goToRow(position: number): boolean;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: ResultSet<br>方法 or 属性: goToFirstRow(): boolean;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: ResultSet<br>方法 or 属性: goToLastRow(): boolean;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: ResultSet<br>方法 or 属性: goToNextRow(): boolean;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: ResultSet<br>方法 or 属性: goToPreviousRow(): boolean;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: ResultSet<br>方法 or 属性: getBlob(columnIndex: number): Uint8Array;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: ResultSet<br>方法 or 属性: getString(columnIndex: number): string;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: ResultSet<br>方法 or 属性: getLong(columnIndex: number): number;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: ResultSet<br>方法 or 属性: getDouble(columnIndex: number): number;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: ResultSet<br>方法 or 属性: isColumnNull(columnIndex: number): boolean;|@ohos.data.relationalStore.d.ts| +|新增|NA|模块名: ohos.data.relationalStore<br>类名: ResultSet<br>方法 or 属性: close(): void;|@ohos.data.relationalStore.d.ts| +|model有变化|类名:GetStorageOptions<br>model:N/A|类名:GetStorageOptions<br>model:@FAModelOnly|@system.storage.d.ts| +|model有变化|类名:GetStorageOptions<br>方法 or 属性:key: string;<br>model:N/A|类名:GetStorageOptions<br>方法 or 属性:key: string;<br>model:@FAModelOnly|@system.storage.d.ts| +|model有变化|类名:GetStorageOptions<br>方法 or 属性:default?: string;<br>model:N/A|类名:GetStorageOptions<br>方法 or 属性:default?: string;<br>model:@FAModelOnly|@system.storage.d.ts| +|model有变化|类名:GetStorageOptions<br>方法 or 属性:success?: (data: any) => void;<br>model:N/A|类名:GetStorageOptions<br>方法 or 属性:success?: (data: any) => void;<br>model:@FAModelOnly|@system.storage.d.ts| +|model有变化|类名:GetStorageOptions<br>方法 or 属性:fail?: (data: string, code: number) => void;<br>model:N/A|类名:GetStorageOptions<br>方法 or 属性:fail?: (data: string, code: number) => void;<br>model:@FAModelOnly|@system.storage.d.ts| +|model有变化|类名:GetStorageOptions<br>方法 or 属性:complete?: () => void;<br>model:N/A|类名:GetStorageOptions<br>方法 or 属性:complete?: () => void;<br>model:@FAModelOnly|@system.storage.d.ts| +|model有变化|类名:SetStorageOptions<br>model:N/A|类名:SetStorageOptions<br>model:@FAModelOnly|@system.storage.d.ts| +|model有变化|类名:SetStorageOptions<br>方法 or 属性:key: string;<br>model:N/A|类名:SetStorageOptions<br>方法 or 属性:key: string;<br>model:@FAModelOnly|@system.storage.d.ts| +|model有变化|类名:SetStorageOptions<br>方法 or 属性:value: string;<br>model:N/A|类名:SetStorageOptions<br>方法 or 属性:value: string;<br>model:@FAModelOnly|@system.storage.d.ts| +|model有变化|类名:SetStorageOptions<br>方法 or 属性:success?: () => void;<br>model:N/A|类名:SetStorageOptions<br>方法 or 属性:success?: () => void;<br>model:@FAModelOnly|@system.storage.d.ts| +|model有变化|类名:SetStorageOptions<br>方法 or 属性:fail?: (data: string, code: number) => void;<br>model:N/A|类名:SetStorageOptions<br>方法 or 属性:fail?: (data: string, code: number) => void;<br>model:@FAModelOnly|@system.storage.d.ts| +|model有变化|类名:SetStorageOptions<br>方法 or 属性:complete?: () => void;<br>model:N/A|类名:SetStorageOptions<br>方法 or 属性:complete?: () => void;<br>model:@FAModelOnly|@system.storage.d.ts| +|model有变化|类名:ClearStorageOptions<br>model:N/A|类名:ClearStorageOptions<br>model:@FAModelOnly|@system.storage.d.ts| +|model有变化|类名:ClearStorageOptions<br>方法 or 属性:success?: () => void;<br>model:N/A|类名:ClearStorageOptions<br>方法 or 属性:success?: () => void;<br>model:@FAModelOnly|@system.storage.d.ts| +|model有变化|类名:ClearStorageOptions<br>方法 or 属性:fail?: (data: string, code: number) => void;<br>model:N/A|类名:ClearStorageOptions<br>方法 or 属性:fail?: (data: string, code: number) => void;<br>model:@FAModelOnly|@system.storage.d.ts| +|model有变化|类名:ClearStorageOptions<br>方法 or 属性:complete?: () => void;<br>model:N/A|类名:ClearStorageOptions<br>方法 or 属性:complete?: () => void;<br>model:@FAModelOnly|@system.storage.d.ts| +|model有变化|类名:DeleteStorageOptions<br>model:N/A|类名:DeleteStorageOptions<br>model:@FAModelOnly|@system.storage.d.ts| +|model有变化|类名:DeleteStorageOptions<br>方法 or 属性:key: string;<br>model:N/A|类名:DeleteStorageOptions<br>方法 or 属性:key: string;<br>model:@FAModelOnly|@system.storage.d.ts| +|model有变化|类名:DeleteStorageOptions<br>方法 or 属性:success?: () => void;<br>model:N/A|类名:DeleteStorageOptions<br>方法 or 属性:success?: () => void;<br>model:@FAModelOnly|@system.storage.d.ts| +|model有变化|类名:DeleteStorageOptions<br>方法 or 属性:fail?: (data: string, code: number) => void;<br>model:N/A|类名:DeleteStorageOptions<br>方法 or 属性:fail?: (data: string, code: number) => void;<br>model:@FAModelOnly|@system.storage.d.ts| +|model有变化|类名:DeleteStorageOptions<br>方法 or 属性:complete?: () => void;<br>model:N/A|类名:DeleteStorageOptions<br>方法 or 属性:complete?: () => void;<br>model:@FAModelOnly|@system.storage.d.ts| +|model有变化|类名:Storage<br>model:N/A|类名:Storage<br>model:@FAModelOnly|@system.storage.d.ts| +|model有变化|类名:Storage<br>方法 or 属性:static get(options: GetStorageOptions): void;<br>model:N/A|类名:Storage<br>方法 or 属性:static get(options: GetStorageOptions): void;<br>model:@FAModelOnly|@system.storage.d.ts| +|model有变化|类名:Storage<br>方法 or 属性:static set(options: SetStorageOptions): void;<br>model:N/A|类名:Storage<br>方法 or 属性:static set(options: SetStorageOptions): void;<br>model:@FAModelOnly|@system.storage.d.ts| +|model有变化|类名:Storage<br>方法 or 属性:static clear(options?: ClearStorageOptions): void;<br>model:N/A|类名:Storage<br>方法 or 属性:static clear(options?: ClearStorageOptions): void;<br>model:@FAModelOnly|@system.storage.d.ts| +|model有变化|类名:Storage<br>方法 or 属性:static delete(options: DeleteStorageOptions): void;<br>model:N/A|类名:Storage<br>方法 or 属性:static delete(options: DeleteStorageOptions): void;<br>model:@FAModelOnly|@system.storage.d.ts| +|废弃版本有变化|类名:distributedData<br>废弃版本:N/A|类名:distributedData<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore |@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVManagerConfig<br>废弃版本:N/A|类名:KVManagerConfig<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.KVManagerConfig |@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVManagerConfig<br>方法 or 属性:userInfo: UserInfo;<br>废弃版本:N/A|类名:KVManagerConfig<br>方法 or 属性:userInfo: UserInfo;<br>废弃版本:9<br>代替接口:N/A|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVManagerConfig<br>方法 or 属性:bundleName: string;<br>废弃版本:N/A|类名:KVManagerConfig<br>方法 or 属性:bundleName: string;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.KVManagerConfig|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:UserInfo<br>废弃版本:N/A|类名:UserInfo<br>废弃版本:9<br>代替接口:N/A|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:UserInfo<br>方法 or 属性:userId?: string;<br>废弃版本:N/A|类名:UserInfo<br>方法 or 属性:userId?: string;<br>废弃版本:9<br>代替接口:N/A|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:UserInfo<br>方法 or 属性:userType?: UserType;<br>废弃版本:N/A|类名:UserInfo<br>方法 or 属性:userType?: UserType;<br>废弃版本:9<br>代替接口:N/A|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:UserType<br>废弃版本:N/A|类名:UserType<br>废弃版本:9<br>代替接口:N/A|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:UserType<br>方法 or 属性:SAME_USER_ID = 0<br>废弃版本:N/A|类名:UserType<br>方法 or 属性:SAME_USER_ID = 0<br>废弃版本:9<br>代替接口:N/A|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Constants<br>废弃版本:N/A|类名:Constants<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Constants |@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Constants<br>方法 or 属性:const MAX_KEY_LENGTH = 1024;<br>废弃版本:N/A|类名:Constants<br>方法 or 属性:const MAX_KEY_LENGTH = 1024;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Constants|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Constants<br>方法 or 属性:const MAX_VALUE_LENGTH = 4194303;<br>废弃版本:N/A|类名:Constants<br>方法 or 属性:const MAX_VALUE_LENGTH = 4194303;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Constants|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Constants<br>方法 or 属性:const MAX_KEY_LENGTH_DEVICE = 896;<br>废弃版本:N/A|类名:Constants<br>方法 or 属性:const MAX_KEY_LENGTH_DEVICE = 896;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Constants|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Constants<br>方法 or 属性:const MAX_STORE_ID_LENGTH = 128;<br>废弃版本:N/A|类名:Constants<br>方法 or 属性:const MAX_STORE_ID_LENGTH = 128;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Constants|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Constants<br>方法 or 属性:const MAX_QUERY_LENGTH = 512000;<br>废弃版本:N/A|类名:Constants<br>方法 or 属性:const MAX_QUERY_LENGTH = 512000;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Constants|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Constants<br>方法 or 属性:const MAX_BATCH_SIZE = 128;<br>废弃版本:N/A|类名:Constants<br>方法 or 属性:const MAX_BATCH_SIZE = 128;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Constants|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:ValueType<br>废弃版本:N/A|类名:ValueType<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.ValueType |@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:ValueType<br>方法 or 属性:STRING = 0<br>废弃版本:N/A|类名:ValueType<br>方法 or 属性:STRING = 0<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.ValueType|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:ValueType<br>方法 or 属性:INTEGER = 1<br>废弃版本:N/A|类名:ValueType<br>方法 or 属性:INTEGER = 1<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.ValueType|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:ValueType<br>方法 or 属性:FLOAT = 2<br>废弃版本:N/A|类名:ValueType<br>方法 or 属性:FLOAT = 2<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.ValueType|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:ValueType<br>方法 or 属性:BYTE_ARRAY = 3<br>废弃版本:N/A|类名:ValueType<br>方法 or 属性:BYTE_ARRAY = 3<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.ValueType|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:ValueType<br>方法 or 属性:BOOLEAN = 4<br>废弃版本:N/A|类名:ValueType<br>方法 or 属性:BOOLEAN = 4<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.ValueType|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:ValueType<br>方法 or 属性:DOUBLE = 5<br>废弃版本:N/A|类名:ValueType<br>方法 or 属性:DOUBLE = 5<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.ValueType|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Value<br>废弃版本:N/A|类名:Value<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Value |@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Value<br>方法 or 属性:type: ValueType;<br>废弃版本:N/A|类名:Value<br>方法 or 属性:type: ValueType;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Value|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Value<br>方法 or 属性:value: Uint8Array \| string \| number \| boolean;<br>废弃版本:N/A|类名:Value<br>方法 or 属性:value: Uint8Array \| string \| number \| boolean;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Value|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Entry<br>废弃版本:N/A|类名:Entry<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Entry |@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Entry<br>方法 or 属性:key: string;<br>废弃版本:N/A|类名:Entry<br>方法 or 属性:key: string;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Entry|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Entry<br>方法 or 属性:value: Value;<br>废弃版本:N/A|类名:Entry<br>方法 or 属性:value: Value;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Entry|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:ChangeNotification<br>废弃版本:N/A|类名:ChangeNotification<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.ChangeNotification |@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:ChangeNotification<br>方法 or 属性:insertEntries: Entry[];<br>废弃版本:N/A|类名:ChangeNotification<br>方法 or 属性:insertEntries: Entry[];<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.ChangeNotification|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:ChangeNotification<br>方法 or 属性:updateEntries: Entry[];<br>废弃版本:N/A|类名:ChangeNotification<br>方法 or 属性:updateEntries: Entry[];<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.ChangeNotification|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:ChangeNotification<br>方法 or 属性:deleteEntries: Entry[];<br>废弃版本:N/A|类名:ChangeNotification<br>方法 or 属性:deleteEntries: Entry[];<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.ChangeNotification|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:ChangeNotification<br>方法 or 属性:deviceId: string;<br>废弃版本:N/A|类名:ChangeNotification<br>方法 or 属性:deviceId: string;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.ChangeNotification|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SyncMode<br>废弃版本:N/A|类名:SyncMode<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SyncMode |@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SyncMode<br>方法 or 属性:PULL_ONLY = 0<br>废弃版本:N/A|类名:SyncMode<br>方法 or 属性:PULL_ONLY = 0<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SyncMode|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SyncMode<br>方法 or 属性:PUSH_ONLY = 1<br>废弃版本:N/A|类名:SyncMode<br>方法 or 属性:PUSH_ONLY = 1<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SyncMode|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SyncMode<br>方法 or 属性:PUSH_PULL = 2<br>废弃版本:N/A|类名:SyncMode<br>方法 or 属性:PUSH_PULL = 2<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SyncMode|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SubscribeType<br>废弃版本:N/A|类名:SubscribeType<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SubscribeType |@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SubscribeType<br>方法 or 属性:SUBSCRIBE_TYPE_LOCAL = 0<br>废弃版本:N/A|类名:SubscribeType<br>方法 or 属性:SUBSCRIBE_TYPE_LOCAL = 0<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SubscribeType|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SubscribeType<br>方法 or 属性:SUBSCRIBE_TYPE_REMOTE = 1<br>废弃版本:N/A|类名:SubscribeType<br>方法 or 属性:SUBSCRIBE_TYPE_REMOTE = 1<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SubscribeType|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SubscribeType<br>方法 or 属性:SUBSCRIBE_TYPE_ALL = 2<br>废弃版本:N/A|类名:SubscribeType<br>方法 or 属性:SUBSCRIBE_TYPE_ALL = 2<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SubscribeType|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVStoreType<br>废弃版本:N/A|类名:KVStoreType<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.KVStoreType |@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVStoreType<br>方法 or 属性:DEVICE_COLLABORATION = 0<br>废弃版本:N/A|类名:KVStoreType<br>方法 or 属性:DEVICE_COLLABORATION = 0<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.KVStoreType|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVStoreType<br>方法 or 属性:SINGLE_VERSION = 1<br>废弃版本:N/A|类名:KVStoreType<br>方法 or 属性:SINGLE_VERSION = 1<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.KVStoreType|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVStoreType<br>方法 or 属性:MULTI_VERSION = 2<br>废弃版本:N/A|类名:KVStoreType<br>方法 or 属性:MULTI_VERSION = 2<br>废弃版本:9<br>代替接口:N/A|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SecurityLevel<br>废弃版本:N/A|类名:SecurityLevel<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SecurityLevel |@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SecurityLevel<br>方法 or 属性:NO_LEVEL = 0<br>废弃版本:N/A|类名:SecurityLevel<br>方法 or 属性:NO_LEVEL = 0<br>废弃版本:9<br>代替接口:N/A|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SecurityLevel<br>方法 or 属性:S0 = 1<br>废弃版本:N/A|类名:SecurityLevel<br>方法 or 属性:S0 = 1<br>废弃版本:9<br>代替接口:N/A|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SecurityLevel<br>方法 or 属性:S1 = 2<br>废弃版本:N/A|类名:SecurityLevel<br>方法 or 属性:S1 = 2<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SecurityLevel|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SecurityLevel<br>方法 or 属性:S2 = 3<br>废弃版本:N/A|类名:SecurityLevel<br>方法 or 属性:S2 = 3<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SecurityLevel|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SecurityLevel<br>方法 or 属性:S3 = 5<br>废弃版本:N/A|类名:SecurityLevel<br>方法 or 属性:S3 = 5<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SecurityLevel|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SecurityLevel<br>方法 or 属性:S4 = 6<br>废弃版本:N/A|类名:SecurityLevel<br>方法 or 属性:S4 = 6<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SecurityLevel|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Options<br>废弃版本:N/A|类名:Options<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Options |@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Options<br>方法 or 属性:createIfMissing?: boolean;<br>废弃版本:N/A|类名:Options<br>方法 or 属性:createIfMissing?: boolean;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Options|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Options<br>方法 or 属性:encrypt?: boolean;<br>废弃版本:N/A|类名:Options<br>方法 or 属性:encrypt?: boolean;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Options|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Options<br>方法 or 属性:backup?: boolean;<br>废弃版本:N/A|类名:Options<br>方法 or 属性:backup?: boolean;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Options|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Options<br>方法 or 属性:autoSync?: boolean;<br>废弃版本:N/A|类名:Options<br>方法 or 属性:autoSync?: boolean;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Options|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Options<br>方法 or 属性:kvStoreType?: KVStoreType;<br>废弃版本:N/A|类名:Options<br>方法 or 属性:kvStoreType?: KVStoreType;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Options|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Options<br>方法 or 属性:securityLevel?: SecurityLevel;<br>废弃版本:N/A|类名:Options<br>方法 or 属性:securityLevel?: SecurityLevel;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Options|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Options<br>方法 or 属性:schema?: Schema;<br>废弃版本:N/A|类名:Options<br>方法 or 属性:schema?: Schema;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Options|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Schema<br>废弃版本:N/A|类名:Schema<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Schema |@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Schema<br>方法 or 属性:constructor()<br>废弃版本:N/A|类名:Schema<br>方法 or 属性:constructor()<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Schema|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Schema<br>方法 or 属性:root: FieldNode;<br>废弃版本:N/A|类名:Schema<br>方法 or 属性:root: FieldNode;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Schema|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Schema<br>方法 or 属性:indexes: Array\<string>;<br>废弃版本:N/A|类名:Schema<br>方法 or 属性:indexes: Array\<string>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Schema|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Schema<br>方法 or 属性:mode: number;<br>废弃版本:N/A|类名:Schema<br>方法 or 属性:mode: number;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Schema|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Schema<br>方法 or 属性:skip: number;<br>废弃版本:N/A|类名:Schema<br>方法 or 属性:skip: number;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Schema|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:FieldNode<br>废弃版本:N/A|类名:FieldNode<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.FieldNode |@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:FieldNode<br>方法 or 属性:constructor(name: string)<br>废弃版本:N/A|类名:FieldNode<br>方法 or 属性:constructor(name: string)<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.FieldNode|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:FieldNode<br>方法 or 属性:appendChild(child: FieldNode): boolean;<br>废弃版本:N/A|类名:FieldNode<br>方法 or 属性:appendChild(child: FieldNode): boolean;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.FieldNode|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:FieldNode<br>方法 or 属性:default: string;<br>废弃版本:N/A|类名:FieldNode<br>方法 or 属性:default: string;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.FieldNode|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:FieldNode<br>方法 or 属性:nullable: boolean;<br>废弃版本:N/A|类名:FieldNode<br>方法 or 属性:nullable: boolean;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.FieldNode|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:FieldNode<br>方法 or 属性:type: number;<br>废弃版本:N/A|类名:FieldNode<br>方法 or 属性:type: number;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.FieldNode|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KvStoreResultSet<br>废弃版本:N/A|类名:KvStoreResultSet<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.KVStoreResultSet |@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KvStoreResultSet<br>方法 or 属性:getCount(): number;<br>废弃版本:N/A|类名:KvStoreResultSet<br>方法 or 属性:getCount(): number;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.KVStoreResultSet|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KvStoreResultSet<br>方法 or 属性:getPosition(): number;<br>废弃版本:N/A|类名:KvStoreResultSet<br>方法 or 属性:getPosition(): number;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.KVStoreResultSet|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KvStoreResultSet<br>方法 or 属性:moveToFirst(): boolean;<br>废弃版本:N/A|类名:KvStoreResultSet<br>方法 or 属性:moveToFirst(): boolean;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.KVStoreResultSet|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KvStoreResultSet<br>方法 or 属性:moveToLast(): boolean;<br>废弃版本:N/A|类名:KvStoreResultSet<br>方法 or 属性:moveToLast(): boolean;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.KVStoreResultSet|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KvStoreResultSet<br>方法 or 属性:moveToNext(): boolean;<br>废弃版本:N/A|类名:KvStoreResultSet<br>方法 or 属性:moveToNext(): boolean;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.KVStoreResultSet|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KvStoreResultSet<br>方法 or 属性:moveToPrevious(): boolean;<br>废弃版本:N/A|类名:KvStoreResultSet<br>方法 or 属性:moveToPrevious(): boolean;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.KVStoreResultSet|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KvStoreResultSet<br>方法 or 属性:move(offset: number): boolean;<br>废弃版本:N/A|类名:KvStoreResultSet<br>方法 or 属性:move(offset: number): boolean;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.KVStoreResultSet|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KvStoreResultSet<br>方法 or 属性:moveToPosition(position: number): boolean;<br>废弃版本:N/A|类名:KvStoreResultSet<br>方法 or 属性:moveToPosition(position: number): boolean;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.KVStoreResultSet|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KvStoreResultSet<br>方法 or 属性:isFirst(): boolean;<br>废弃版本:N/A|类名:KvStoreResultSet<br>方法 or 属性:isFirst(): boolean;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.KVStoreResultSet|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KvStoreResultSet<br>方法 or 属性:isLast(): boolean;<br>废弃版本:N/A|类名:KvStoreResultSet<br>方法 or 属性:isLast(): boolean;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.KVStoreResultSet|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KvStoreResultSet<br>方法 or 属性:isBeforeFirst(): boolean;<br>废弃版本:N/A|类名:KvStoreResultSet<br>方法 or 属性:isBeforeFirst(): boolean;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.KVStoreResultSet|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KvStoreResultSet<br>方法 or 属性:isAfterLast(): boolean;<br>废弃版本:N/A|类名:KvStoreResultSet<br>方法 or 属性:isAfterLast(): boolean;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.KVStoreResultSet|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KvStoreResultSet<br>方法 or 属性:getEntry(): Entry;<br>废弃版本:N/A|类名:KvStoreResultSet<br>方法 or 属性:getEntry(): Entry;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.KVStoreResultSet|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Query<br>废弃版本:N/A|类名:Query<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Query |@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Query<br>方法 or 属性:constructor()<br>废弃版本:N/A|类名:Query<br>方法 or 属性:constructor()<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Query|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Query<br>方法 or 属性:reset(): Query;<br>废弃版本:N/A|类名:Query<br>方法 or 属性:reset(): Query;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Query|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Query<br>方法 or 属性:isNull(field: string): Query;<br>废弃版本:N/A|类名:Query<br>方法 or 属性:isNull(field: string): Query;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Query|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Query<br>方法 or 属性:inNumber(field: string, valueList: number[]): Query;<br>废弃版本:N/A|类名:Query<br>方法 or 属性:inNumber(field: string, valueList: number[]): Query;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Query|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Query<br>方法 or 属性:inString(field: string, valueList: string[]): Query;<br>废弃版本:N/A|类名:Query<br>方法 or 属性:inString(field: string, valueList: string[]): Query;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Query|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Query<br>方法 or 属性:notInNumber(field: string, valueList: number[]): Query;<br>废弃版本:N/A|类名:Query<br>方法 or 属性:notInNumber(field: string, valueList: number[]): Query;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Query|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Query<br>方法 or 属性:notInString(field: string, valueList: string[]): Query;<br>废弃版本:N/A|类名:Query<br>方法 or 属性:notInString(field: string, valueList: string[]): Query;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Query|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Query<br>方法 or 属性:like(field: string, value: string): Query;<br>废弃版本:N/A|类名:Query<br>方法 or 属性:like(field: string, value: string): Query;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Query|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Query<br>方法 or 属性:unlike(field: string, value: string): Query;<br>废弃版本:N/A|类名:Query<br>方法 or 属性:unlike(field: string, value: string): Query;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Query|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Query<br>方法 or 属性:and(): Query;<br>废弃版本:N/A|类名:Query<br>方法 or 属性:and(): Query;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Query|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Query<br>方法 or 属性:or(): Query;<br>废弃版本:N/A|类名:Query<br>方法 or 属性:or(): Query;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Query|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Query<br>方法 or 属性:orderByAsc(field: string): Query;<br>废弃版本:N/A|类名:Query<br>方法 or 属性:orderByAsc(field: string): Query;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Query|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Query<br>方法 or 属性:orderByDesc(field: string): Query;<br>废弃版本:N/A|类名:Query<br>方法 or 属性:orderByDesc(field: string): Query;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Query|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Query<br>方法 or 属性:limit(total: number, offset: number): Query;<br>废弃版本:N/A|类名:Query<br>方法 or 属性:limit(total: number, offset: number): Query;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Query|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Query<br>方法 or 属性:isNotNull(field: string): Query;<br>废弃版本:N/A|类名:Query<br>方法 or 属性:isNotNull(field: string): Query;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Query|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Query<br>方法 or 属性:beginGroup(): Query;<br>废弃版本:N/A|类名:Query<br>方法 or 属性:beginGroup(): Query;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Query|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Query<br>方法 or 属性:endGroup(): Query;<br>废弃版本:N/A|类名:Query<br>方法 or 属性:endGroup(): Query;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Query|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Query<br>方法 or 属性:prefixKey(prefix: string): Query;<br>废弃版本:N/A|类名:Query<br>方法 or 属性:prefixKey(prefix: string): Query;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Query|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:Query<br>方法 or 属性:setSuggestIndex(index: string): Query;<br>废弃版本:N/A|类名:Query<br>方法 or 属性:setSuggestIndex(index: string): Query;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.Query|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVStore<br>废弃版本:N/A|类名:KVStore<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore |@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVStore<br>方法 or 属性:put(key: string, value: Uint8Array \| string \| number \| boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:KVStore<br>方法 or 属性:put(key: string, value: Uint8Array \| string \| number \| boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVStore<br>方法 or 属性:put(key: string, value: Uint8Array \| string \| number \| boolean): Promise\<void>;<br>废弃版本:N/A|类名:KVStore<br>方法 or 属性:put(key: string, value: Uint8Array \| string \| number \| boolean): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVStore<br>方法 or 属性:delete(key: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:KVStore<br>方法 or 属性:delete(key: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVStore<br>方法 or 属性:delete(key: string): Promise\<void>;<br>废弃版本:N/A|类名:KVStore<br>方法 or 属性:delete(key: string): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVStore<br>方法 or 属性:on(event: 'syncComplete', syncCallback: Callback\<Array\<[string, number]>>): void;<br>废弃版本:N/A|类名:KVStore<br>方法 or 属性:on(event: 'syncComplete', syncCallback: Callback\<Array\<[string, number]>>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVStore<br>方法 or 属性:putBatch(entries: Entry[], callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:KVStore<br>方法 or 属性:putBatch(entries: Entry[], callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVStore<br>方法 or 属性:putBatch(entries: Entry[]): Promise\<void>;<br>废弃版本:N/A|类名:KVStore<br>方法 or 属性:putBatch(entries: Entry[]): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVStore<br>方法 or 属性:deleteBatch(keys: string[], callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:KVStore<br>方法 or 属性:deleteBatch(keys: string[], callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVStore<br>方法 or 属性:deleteBatch(keys: string[]): Promise\<void>;<br>废弃版本:N/A|类名:KVStore<br>方法 or 属性:deleteBatch(keys: string[]): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVStore<br>方法 or 属性:startTransaction(callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:KVStore<br>方法 or 属性:startTransaction(callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVStore<br>方法 or 属性:startTransaction(): Promise\<void>;<br>废弃版本:N/A|类名:KVStore<br>方法 or 属性:startTransaction(): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVStore<br>方法 or 属性:commit(callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:KVStore<br>方法 or 属性:commit(callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVStore<br>方法 or 属性:commit(): Promise\<void>;<br>废弃版本:N/A|类名:KVStore<br>方法 or 属性:commit(): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVStore<br>方法 or 属性:rollback(callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:KVStore<br>方法 or 属性:rollback(callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVStore<br>方法 or 属性:rollback(): Promise\<void>;<br>废弃版本:N/A|类名:KVStore<br>方法 or 属性:rollback(): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVStore<br>方法 or 属性:enableSync(enabled: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:KVStore<br>方法 or 属性:enableSync(enabled: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVStore<br>方法 or 属性:enableSync(enabled: boolean): Promise\<void>;<br>废弃版本:N/A|类名:KVStore<br>方法 or 属性:enableSync(enabled: boolean): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVStore<br>方法 or 属性:setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:KVStore<br>方法 or 属性:setSyncRange(localLabels: string[], remoteSupportLabels: string[], callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVStore<br>方法 or 属性:setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise\<void>;<br>废弃版本:N/A|类名:KVStore<br>方法 or 属性:setSyncRange(localLabels: string[], remoteSupportLabels: string[]): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SingleKVStore<br>废弃版本:N/A|类名:SingleKVStore<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore |@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SingleKVStore<br>方法 or 属性:get(key: string, callback: AsyncCallback\<Uint8Array \| string \| boolean \| number>): void;<br>废弃版本:N/A|类名:SingleKVStore<br>方法 or 属性:get(key: string, callback: AsyncCallback\<Uint8Array \| string \| boolean \| number>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SingleKVStore<br>方法 or 属性:get(key: string): Promise\<Uint8Array \| string \| boolean \| number>;<br>废弃版本:N/A|类名:SingleKVStore<br>方法 or 属性:get(key: string): Promise\<Uint8Array \| string \| boolean \| number>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SingleKVStore<br>方法 or 属性:getEntries(keyPrefix: string, callback: AsyncCallback\<Entry[]>): void;<br>废弃版本:N/A|类名:SingleKVStore<br>方法 or 属性:getEntries(keyPrefix: string, callback: AsyncCallback\<Entry[]>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SingleKVStore<br>方法 or 属性:getEntries(keyPrefix: string): Promise\<Entry[]>;<br>废弃版本:N/A|类名:SingleKVStore<br>方法 or 属性:getEntries(keyPrefix: string): Promise\<Entry[]>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SingleKVStore<br>方法 or 属性:getEntries(query: Query, callback: AsyncCallback\<Entry[]>): void;<br>废弃版本:N/A|类名:SingleKVStore<br>方法 or 属性:getEntries(query: Query, callback: AsyncCallback\<Entry[]>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SingleKVStore<br>方法 or 属性:getEntries(query: Query): Promise\<Entry[]>;<br>废弃版本:N/A|类名:SingleKVStore<br>方法 or 属性:getEntries(query: Query): Promise\<Entry[]>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SingleKVStore<br>方法 or 属性:getResultSet(keyPrefix: string, callback: AsyncCallback\<KvStoreResultSet>): void;<br>废弃版本:N/A|类名:SingleKVStore<br>方法 or 属性:getResultSet(keyPrefix: string, callback: AsyncCallback\<KvStoreResultSet>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SingleKVStore<br>方法 or 属性:getResultSet(keyPrefix: string): Promise\<KvStoreResultSet>;<br>废弃版本:N/A|类名:SingleKVStore<br>方法 or 属性:getResultSet(keyPrefix: string): Promise\<KvStoreResultSet>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SingleKVStore<br>方法 or 属性:getResultSet(query: Query, callback: AsyncCallback\<KvStoreResultSet>): void;<br>废弃版本:N/A|类名:SingleKVStore<br>方法 or 属性:getResultSet(query: Query, callback: AsyncCallback\<KvStoreResultSet>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SingleKVStore<br>方法 or 属性:getResultSet(query: Query): Promise\<KvStoreResultSet>;<br>废弃版本:N/A|类名:SingleKVStore<br>方法 or 属性:getResultSet(query: Query): Promise\<KvStoreResultSet>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SingleKVStore<br>方法 or 属性:closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:SingleKVStore<br>方法 or 属性:closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SingleKVStore<br>方法 or 属性:closeResultSet(resultSet: KvStoreResultSet): Promise\<void>;<br>废弃版本:N/A|类名:SingleKVStore<br>方法 or 属性:closeResultSet(resultSet: KvStoreResultSet): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SingleKVStore<br>方法 or 属性:getResultSize(query: Query, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:SingleKVStore<br>方法 or 属性:getResultSize(query: Query, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SingleKVStore<br>方法 or 属性:getResultSize(query: Query): Promise\<number>;<br>废弃版本:N/A|类名:SingleKVStore<br>方法 or 属性:getResultSize(query: Query): Promise\<number>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SingleKVStore<br>方法 or 属性:removeDeviceData(deviceId: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:SingleKVStore<br>方法 or 属性:removeDeviceData(deviceId: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SingleKVStore<br>方法 or 属性:removeDeviceData(deviceId: string): Promise\<void>;<br>废弃版本:N/A|类名:SingleKVStore<br>方法 or 属性:removeDeviceData(deviceId: string): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SingleKVStore<br>方法 or 属性:on(event: 'syncComplete', syncCallback: Callback\<Array\<[string, number]>>): void;<br>废弃版本:N/A|类名:SingleKVStore<br>方法 or 属性:on(event: 'syncComplete', syncCallback: Callback\<Array\<[string, number]>>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SingleKVStore<br>方法 or 属性:off(event: 'syncComplete', syncCallback?: Callback\<Array\<[string, number]>>): void;<br>废弃版本:N/A|类名:SingleKVStore<br>方法 or 属性:off(event: 'syncComplete', syncCallback?: Callback\<Array\<[string, number]>>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SingleKVStore<br>方法 or 属性:setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:SingleKVStore<br>方法 or 属性:setSyncParam(defaultAllowedDelayMs: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SingleKVStore<br>方法 or 属性:setSyncParam(defaultAllowedDelayMs: number): Promise\<void>;<br>废弃版本:N/A|类名:SingleKVStore<br>方法 or 属性:setSyncParam(defaultAllowedDelayMs: number): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SingleKVStore<br>方法 or 属性:getSecurityLevel(callback: AsyncCallback\<SecurityLevel>): void;<br>废弃版本:N/A|类名:SingleKVStore<br>方法 or 属性:getSecurityLevel(callback: AsyncCallback\<SecurityLevel>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:SingleKVStore<br>方法 or 属性:getSecurityLevel(): Promise\<SecurityLevel>;<br>废弃版本:N/A|类名:SingleKVStore<br>方法 or 属性:getSecurityLevel(): Promise\<SecurityLevel>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.SingleKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:DeviceKVStore<br>废弃版本:N/A|类名:DeviceKVStore<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.DeviceKVStore |@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:DeviceKVStore<br>方法 or 属性:getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback\<Entry[]>): void;<br>废弃版本:N/A|类名:DeviceKVStore<br>方法 or 属性:getEntries(deviceId: string, keyPrefix: string, callback: AsyncCallback\<Entry[]>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.DeviceKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:DeviceKVStore<br>方法 or 属性:getEntries(deviceId: string, keyPrefix: string): Promise\<Entry[]>;<br>废弃版本:N/A|类名:DeviceKVStore<br>方法 or 属性:getEntries(deviceId: string, keyPrefix: string): Promise\<Entry[]>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.DeviceKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:DeviceKVStore<br>方法 or 属性:getEntries(query: Query, callback: AsyncCallback\<Entry[]>): void;<br>废弃版本:N/A|类名:DeviceKVStore<br>方法 or 属性:getEntries(query: Query, callback: AsyncCallback\<Entry[]>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.DeviceKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:DeviceKVStore<br>方法 or 属性:getEntries(query: Query): Promise\<Entry[]>;<br>废弃版本:N/A|类名:DeviceKVStore<br>方法 or 属性:getEntries(query: Query): Promise\<Entry[]>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.DeviceKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:DeviceKVStore<br>方法 or 属性:getEntries(deviceId: string, query: Query, callback: AsyncCallback\<Entry[]>): void;<br>废弃版本:N/A|类名:DeviceKVStore<br>方法 or 属性:getEntries(deviceId: string, query: Query, callback: AsyncCallback\<Entry[]>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.DeviceKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:DeviceKVStore<br>方法 or 属性:getEntries(deviceId: string, query: Query): Promise\<Entry[]>;<br>废弃版本:N/A|类名:DeviceKVStore<br>方法 or 属性:getEntries(deviceId: string, query: Query): Promise\<Entry[]>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.DeviceKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:DeviceKVStore<br>方法 or 属性:getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback\<KvStoreResultSet>): void;<br>废弃版本:N/A|类名:DeviceKVStore<br>方法 or 属性:getResultSet(deviceId: string, keyPrefix: string, callback: AsyncCallback\<KvStoreResultSet>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.DeviceKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:DeviceKVStore<br>方法 or 属性:getResultSet(deviceId: string, keyPrefix: string): Promise\<KvStoreResultSet>;<br>废弃版本:N/A|类名:DeviceKVStore<br>方法 or 属性:getResultSet(deviceId: string, keyPrefix: string): Promise\<KvStoreResultSet>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.DeviceKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:DeviceKVStore<br>方法 or 属性:getResultSet(query: Query, callback: AsyncCallback\<KvStoreResultSet>): void;<br>废弃版本:N/A|类名:DeviceKVStore<br>方法 or 属性:getResultSet(query: Query, callback: AsyncCallback\<KvStoreResultSet>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.DeviceKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:DeviceKVStore<br>方法 or 属性:getResultSet(query: Query): Promise\<KvStoreResultSet>;<br>废弃版本:N/A|类名:DeviceKVStore<br>方法 or 属性:getResultSet(query: Query): Promise\<KvStoreResultSet>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.DeviceKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:DeviceKVStore<br>方法 or 属性:getResultSet(deviceId: string, query: Query, callback: AsyncCallback\<KvStoreResultSet>): void;<br>废弃版本:N/A|类名:DeviceKVStore<br>方法 or 属性:getResultSet(deviceId: string, query: Query, callback: AsyncCallback\<KvStoreResultSet>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.DeviceKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:DeviceKVStore<br>方法 or 属性:getResultSet(deviceId: string, query: Query): Promise\<KvStoreResultSet>;<br>废弃版本:N/A|类名:DeviceKVStore<br>方法 or 属性:getResultSet(deviceId: string, query: Query): Promise\<KvStoreResultSet>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.DeviceKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:DeviceKVStore<br>方法 or 属性:closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:DeviceKVStore<br>方法 or 属性:closeResultSet(resultSet: KvStoreResultSet, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.DeviceKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:DeviceKVStore<br>方法 or 属性:closeResultSet(resultSet: KvStoreResultSet): Promise\<void>;<br>废弃版本:N/A|类名:DeviceKVStore<br>方法 or 属性:closeResultSet(resultSet: KvStoreResultSet): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.DeviceKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:DeviceKVStore<br>方法 or 属性:getResultSize(query: Query, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:DeviceKVStore<br>方法 or 属性:getResultSize(query: Query, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.DeviceKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:DeviceKVStore<br>方法 or 属性:getResultSize(query: Query): Promise\<number>;<br>废弃版本:N/A|类名:DeviceKVStore<br>方法 or 属性:getResultSize(query: Query): Promise\<number>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.DeviceKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:DeviceKVStore<br>方法 or 属性:getResultSize(deviceId: string, query: Query, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:DeviceKVStore<br>方法 or 属性:getResultSize(deviceId: string, query: Query, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.DeviceKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:DeviceKVStore<br>方法 or 属性:getResultSize(deviceId: string, query: Query): Promise\<number>;<br>废弃版本:N/A|类名:DeviceKVStore<br>方法 or 属性:getResultSize(deviceId: string, query: Query): Promise\<number>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.DeviceKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:DeviceKVStore<br>方法 or 属性:removeDeviceData(deviceId: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:DeviceKVStore<br>方法 or 属性:removeDeviceData(deviceId: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.DeviceKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:DeviceKVStore<br>方法 or 属性:removeDeviceData(deviceId: string): Promise\<void>;<br>废弃版本:N/A|类名:DeviceKVStore<br>方法 or 属性:removeDeviceData(deviceId: string): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.DeviceKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:DeviceKVStore<br>方法 or 属性:on(event: 'syncComplete', syncCallback: Callback\<Array\<[string, number]>>): void;<br>废弃版本:N/A|类名:DeviceKVStore<br>方法 or 属性:on(event: 'syncComplete', syncCallback: Callback\<Array\<[string, number]>>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.DeviceKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:DeviceKVStore<br>方法 or 属性:off(event: 'syncComplete', syncCallback?: Callback\<Array\<[string, number]>>): void;<br>废弃版本:N/A|类名:DeviceKVStore<br>方法 or 属性:off(event: 'syncComplete', syncCallback?: Callback\<Array\<[string, number]>>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.DeviceKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:distributedData<br>方法 or 属性:function createKVManager(config: KVManagerConfig, callback: AsyncCallback\<KVManager>): void;<br>废弃版本:N/A|类名:distributedData<br>方法 or 属性:function createKVManager(config: KVManagerConfig, callback: AsyncCallback\<KVManager>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:distributedData<br>方法 or 属性:function createKVManager(config: KVManagerConfig): Promise\<KVManager>;<br>废弃版本:N/A|类名:distributedData<br>方法 or 属性:function createKVManager(config: KVManagerConfig): Promise\<KVManager>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVManager<br>废弃版本:N/A|类名:KVManager<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.KVManager |@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVManager<br>方法 or 属性:getKVStore\<T extends KVStore>(storeId: string, options: Options): Promise\<T>;<br>废弃版本:N/A|类名:KVManager<br>方法 or 属性:getKVStore\<T extends KVStore>(storeId: string, options: Options): Promise\<T>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.KVManager|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVManager<br>方法 or 属性:getKVStore\<T extends KVStore>(storeId: string, options: Options, callback: AsyncCallback\<T>): void;<br>废弃版本:N/A|类名:KVManager<br>方法 or 属性:getKVStore\<T extends KVStore>(storeId: string, options: Options, callback: AsyncCallback\<T>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.KVManager|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVManager<br>方法 or 属性:closeKVStore(appId: string, storeId: string, kvStore: KVStore, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:KVManager<br>方法 or 属性:closeKVStore(appId: string, storeId: string, kvStore: KVStore, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.KVManager|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVManager<br>方法 or 属性:closeKVStore(appId: string, storeId: string, kvStore: KVStore): Promise\<void>;<br>废弃版本:N/A|类名:KVManager<br>方法 or 属性:closeKVStore(appId: string, storeId: string, kvStore: KVStore): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.KVManager|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVManager<br>方法 or 属性:deleteKVStore(appId: string, storeId: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:KVManager<br>方法 or 属性:deleteKVStore(appId: string, storeId: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.KVManager|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVManager<br>方法 or 属性:deleteKVStore(appId: string, storeId: string): Promise\<void>;<br>废弃版本:N/A|类名:KVManager<br>方法 or 属性:deleteKVStore(appId: string, storeId: string): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.KVManager|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVManager<br>方法 or 属性:getAllKVStoreId(appId: string, callback: AsyncCallback\<string[]>): void;<br>废弃版本:N/A|类名:KVManager<br>方法 or 属性:getAllKVStoreId(appId: string, callback: AsyncCallback\<string[]>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.KVManager|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVManager<br>方法 or 属性:getAllKVStoreId(appId: string): Promise\<string[]>;<br>废弃版本:N/A|类名:KVManager<br>方法 or 属性:getAllKVStoreId(appId: string): Promise\<string[]>;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.KVManager|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVManager<br>方法 or 属性:on(event: 'distributedDataServiceDie', deathCallback: Callback\<void>): void;<br>废弃版本:N/A|类名:KVManager<br>方法 or 属性:on(event: 'distributedDataServiceDie', deathCallback: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.KVManager|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:KVManager<br>方法 or 属性:off(event: 'distributedDataServiceDie', deathCallback?: Callback\<void>): void;<br>废弃版本:N/A|类名:KVManager<br>方法 or 属性:off(event: 'distributedDataServiceDie', deathCallback?: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.data.distributedKVStore.KVManager|@ohos.data.distributedData.d.ts| +|废弃版本有变化|类名:distributedDataObject<br>方法 or 属性:function createDistributedObject(source: object): DistributedObject;<br>废弃版本:N/A|类名:distributedDataObject<br>方法 or 属性:function createDistributedObject(source: object): DistributedObject;<br>废弃版本:9<br>代替接口:ohos.distributedDataObject.create |@ohos.data.distributedDataObject.d.ts| +|废弃版本有变化|类名:DistributedObject<br>废弃版本:N/A|类名:DistributedObject<br>废弃版本:9<br>代替接口:ohos.distributedDataObject.DataObject |@ohos.data.distributedDataObject.d.ts| +|废弃版本有变化|类名:DistributedObject<br>方法 or 属性:setSessionId(sessionId?: string): boolean;<br>废弃版本:N/A|类名:DistributedObject<br>方法 or 属性:setSessionId(sessionId?: string): boolean;<br>废弃版本:9<br>代替接口:ohos.distributedDataObject.DataObject.setSessionId |@ohos.data.distributedDataObject.d.ts| +|废弃版本有变化|类名:DistributedObject<br>方法 or 属性:on(type: 'change', callback: Callback\<{ sessionId: string, fields: Array\<string> }>): void;<br>废弃版本:N/A|类名:DistributedObject<br>方法 or 属性:on(type: 'change', callback: Callback\<{ sessionId: string, fields: Array\<string> }>): void;<br>废弃版本:9<br>代替接口:ohos.distributedDataObject.DataObject.on |@ohos.data.distributedDataObject.d.ts| +|废弃版本有变化|类名:DistributedObject<br>方法 or 属性:off(type: 'change', callback?: Callback\<{ sessionId: string, fields: Array\<string> }>): void;<br>废弃版本:N/A|类名:DistributedObject<br>方法 or 属性:off(type: 'change', callback?: Callback\<{ sessionId: string, fields: Array\<string> }>): void;<br>废弃版本:9<br>代替接口:ohos.distributedDataObject.DataObject.off |@ohos.data.distributedDataObject.d.ts| +|废弃版本有变化|类名:rdb<br>废弃版本:N/A|类名:rdb<br>废弃版本:9<br>代替接口:ohos.data.relationalStore |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:rdb<br>方法 or 属性:function getRdbStore(context: Context, config: StoreConfig, version: number, callback: AsyncCallback\<RdbStore>): void;<br>废弃版本:N/A|类名:rdb<br>方法 or 属性:function getRdbStore(context: Context, config: StoreConfig, version: number, callback: AsyncCallback\<RdbStore>): void;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.getRdbStore |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:rdb<br>方法 or 属性:function getRdbStore(context: Context, config: StoreConfig, version: number): Promise\<RdbStore>;<br>废弃版本:N/A|类名:rdb<br>方法 or 属性:function getRdbStore(context: Context, config: StoreConfig, version: number): Promise\<RdbStore>;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.getRdbStore |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:rdb<br>方法 or 属性:function deleteRdbStore(context: Context, name: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:rdb<br>方法 or 属性:function deleteRdbStore(context: Context, name: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.deleteRdbStore |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:rdb<br>方法 or 属性:function deleteRdbStore(context: Context, name: string): Promise\<void>;<br>废弃版本:N/A|类名:rdb<br>方法 or 属性:function deleteRdbStore(context: Context, name: string): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.deleteRdbStore |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:SyncMode<br>废弃版本:N/A|类名:SyncMode<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.SyncMode |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:SyncMode<br>方法 or 属性:SYNC_MODE_PUSH = 0<br>废弃版本:N/A|类名:SyncMode<br>方法 or 属性:SYNC_MODE_PUSH = 0<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.SyncMode.SYNC_MODE_PUSH |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:SyncMode<br>方法 or 属性:SYNC_MODE_PULL = 1<br>废弃版本:N/A|类名:SyncMode<br>方法 or 属性:SYNC_MODE_PULL = 1<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.SyncMode.SYNC_MODE_PULL |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:SubscribeType<br>废弃版本:N/A|类名:SubscribeType<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.SubscribeType |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:SubscribeType<br>方法 or 属性:SUBSCRIBE_TYPE_REMOTE = 0<br>废弃版本:N/A|类名:SubscribeType<br>方法 or 属性:SUBSCRIBE_TYPE_REMOTE = 0<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.SubscribeType.SUBSCRIBE_TYPE_REMOTE |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbStore<br>废弃版本:N/A|类名:RdbStore<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbStore |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbStore<br>方法 or 属性:querySql(sql: string, bindArgs: Array\<ValueType>, callback: AsyncCallback\<ResultSet>): void;<br>废弃版本:N/A|类名:RdbStore<br>方法 or 属性:querySql(sql: string, bindArgs: Array\<ValueType>, callback: AsyncCallback\<ResultSet>): void;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbStore.querySql |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbStore<br>方法 or 属性:executeSql(sql: string, bindArgs: Array\<ValueType>, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:RdbStore<br>方法 or 属性:executeSql(sql: string, bindArgs: Array\<ValueType>, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbStore.executeSql |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbStore<br>方法 or 属性:setDistributedTables(tables: Array\<string>, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:RdbStore<br>方法 or 属性:setDistributedTables(tables: Array\<string>, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbStore.setDistributedTables |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbStore<br>方法 or 属性:setDistributedTables(tables: Array\<string>): Promise\<void>;<br>废弃版本:N/A|类名:RdbStore<br>方法 or 属性:setDistributedTables(tables: Array\<string>): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbStore.setDistributedTables |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbStore<br>方法 or 属性:obtainDistributedTableName(device: string, table: string, callback: AsyncCallback\<string>): void;<br>废弃版本:N/A|类名:RdbStore<br>方法 or 属性:obtainDistributedTableName(device: string, table: string, callback: AsyncCallback\<string>): void;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbStore.obtainDistributedTableName |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbStore<br>方法 or 属性:obtainDistributedTableName(device: string, table: string): Promise\<string>;<br>废弃版本:N/A|类名:RdbStore<br>方法 or 属性:obtainDistributedTableName(device: string, table: string): Promise\<string>;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbStore.obtainDistributedTableName |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbStore<br>方法 or 属性:on(event: 'dataChange', type: SubscribeType, observer: Callback\<Array\<string>>): void;<br>废弃版本:N/A|类名:RdbStore<br>方法 or 属性:on(event: 'dataChange', type: SubscribeType, observer: Callback\<Array\<string>>): void;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbStore.on |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:StoreConfig<br>废弃版本:N/A|类名:StoreConfig<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.StoreConfig |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>废弃版本:N/A|类名:RdbPredicates<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:constructor(name: string)<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:constructor(name: string)<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.constructor |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:inDevices(devices: Array\<string>): RdbPredicates;<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:inDevices(devices: Array\<string>): RdbPredicates;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.inDevices |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:inAllDevices(): RdbPredicates;<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:inAllDevices(): RdbPredicates;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.inAllDevices |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:equalTo(field: string, value: ValueType): RdbPredicates;<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:equalTo(field: string, value: ValueType): RdbPredicates;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.equalTo |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:notEqualTo(field: string, value: ValueType): RdbPredicates;<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:notEqualTo(field: string, value: ValueType): RdbPredicates;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.notEqualTo |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:beginWrap(): RdbPredicates;<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:beginWrap(): RdbPredicates;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.beginWrap |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:endWrap(): RdbPredicates;<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:endWrap(): RdbPredicates;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.endWrap |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:or(): RdbPredicates;<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:or(): RdbPredicates;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.or |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:and(): RdbPredicates;<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:and(): RdbPredicates;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.and |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:contains(field: string, value: string): RdbPredicates;<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:contains(field: string, value: string): RdbPredicates;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.contains |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:beginsWith(field: string, value: string): RdbPredicates;<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:beginsWith(field: string, value: string): RdbPredicates;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.beginsWith |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:endsWith(field: string, value: string): RdbPredicates;<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:endsWith(field: string, value: string): RdbPredicates;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.endsWith |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:isNull(field: string): RdbPredicates;<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:isNull(field: string): RdbPredicates;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.isNull |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:isNotNull(field: string): RdbPredicates;<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:isNotNull(field: string): RdbPredicates;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.isNotNull |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:like(field: string, value: string): RdbPredicates;<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:like(field: string, value: string): RdbPredicates;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.like |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:glob(field: string, value: string): RdbPredicates;<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:glob(field: string, value: string): RdbPredicates;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.glob |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:between(field: string, low: ValueType, high: ValueType): RdbPredicates;<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:between(field: string, low: ValueType, high: ValueType): RdbPredicates;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.between |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:notBetween(field: string, low: ValueType, high: ValueType): RdbPredicates;<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:notBetween(field: string, low: ValueType, high: ValueType): RdbPredicates;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.notBetween |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:greaterThan(field: string, value: ValueType): RdbPredicates;<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:greaterThan(field: string, value: ValueType): RdbPredicates;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.greaterThan |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:lessThan(field: string, value: ValueType): RdbPredicates;<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:lessThan(field: string, value: ValueType): RdbPredicates;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.lessThan |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:greaterThanOrEqualTo(field: string, value: ValueType): RdbPredicates;<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:greaterThanOrEqualTo(field: string, value: ValueType): RdbPredicates;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.greaterThanOrEqualTo |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:lessThanOrEqualTo(field: string, value: ValueType): RdbPredicates;<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:lessThanOrEqualTo(field: string, value: ValueType): RdbPredicates;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.lessThanOrEqualTo |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:orderByAsc(field: string): RdbPredicates;<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:orderByAsc(field: string): RdbPredicates;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.orderByAsc |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:orderByDesc(field: string): RdbPredicates;<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:orderByDesc(field: string): RdbPredicates;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.orderByDesc |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:distinct(): RdbPredicates;<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:distinct(): RdbPredicates;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.distinct |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:limitAs(value: number): RdbPredicates;<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:limitAs(value: number): RdbPredicates;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.limitAs |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:offsetAs(rowOffset: number): RdbPredicates;<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:offsetAs(rowOffset: number): RdbPredicates;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.offsetAs |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:groupBy(fields: Array\<string>): RdbPredicates;<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:groupBy(fields: Array\<string>): RdbPredicates;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.groupBy |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:indexedBy(field: string): RdbPredicates;<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:indexedBy(field: string): RdbPredicates;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.indexedBy |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:in(field: string, value: Array\<ValueType>): RdbPredicates;<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:in(field: string, value: Array\<ValueType>): RdbPredicates;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.in |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:RdbPredicates<br>方法 or 属性:notIn(field: string, value: Array\<ValueType>): RdbPredicates;<br>废弃版本:N/A|类名:RdbPredicates<br>方法 or 属性:notIn(field: string, value: Array\<ValueType>): RdbPredicates;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.RdbPredicates.notIn |@ohos.data.rdb.d.ts| +|废弃版本有变化|类名:storage<br>废弃版本:N/A|类名:storage<br>废弃版本:9<br>代替接口:ohos.preferences.preferences |@ohos.data.storage.d.ts| +|废弃版本有变化|类名:storage<br>方法 or 属性:function getStorageSync(path: string): Storage;<br>废弃版本:N/A|类名:storage<br>方法 or 属性:function getStorageSync(path: string): Storage;<br>废弃版本:9<br>代替接口:ohos.preferences.preferences.getPreferences |@ohos.data.storage.d.ts| +|废弃版本有变化|类名:storage<br>方法 or 属性:function deleteStorageSync(path: string): void;<br>废弃版本:N/A|类名:storage<br>方法 or 属性:function deleteStorageSync(path: string): void;<br>废弃版本:9<br>代替接口:ohos.preferences.preferences.deletePreferences |@ohos.data.storage.d.ts| +|废弃版本有变化|类名:storage<br>方法 or 属性:function removeStorageFromCacheSync(path: string): void;<br>废弃版本:N/A|类名:storage<br>方法 or 属性:function removeStorageFromCacheSync(path: string): void;<br>废弃版本:9<br>代替接口:ohos.preferences.preferences.removePreferencesFromCache |@ohos.data.storage.d.ts| +|废弃版本有变化|类名:Storage<br>废弃版本:N/A|类名:Storage<br>废弃版本:9<br>代替接口:ohos.preferences.preferences |@ohos.data.storage.d.ts| +|废弃版本有变化|类名:Storage<br>方法 or 属性:getSync(key: string, defValue: ValueType): ValueType;<br>废弃版本:N/A|类名:Storage<br>方法 or 属性:getSync(key: string, defValue: ValueType): ValueType;<br>废弃版本:9<br>代替接口:ohos.preferences.preferences.get |@ohos.data.storage.d.ts| +|废弃版本有变化|类名:Storage<br>方法 or 属性:hasSync(key: string): boolean;<br>废弃版本:N/A|类名:Storage<br>方法 or 属性:hasSync(key: string): boolean;<br>废弃版本:9<br>代替接口:ohos.preferences.preferences.has |@ohos.data.storage.d.ts| +|废弃版本有变化|类名:Storage<br>方法 or 属性:putSync(key: string, value: ValueType): void;<br>废弃版本:N/A|类名:Storage<br>方法 or 属性:putSync(key: string, value: ValueType): void;<br>废弃版本:9<br>代替接口:ohos.preferences.preferences.put |@ohos.data.storage.d.ts| +|废弃版本有变化|类名:Storage<br>方法 or 属性:deleteSync(key: string): void;<br>废弃版本:N/A|类名:Storage<br>方法 or 属性:deleteSync(key: string): void;<br>废弃版本:9<br>代替接口:ohos.preferences.preferences.delete |@ohos.data.storage.d.ts| +|废弃版本有变化|类名:Storage<br>方法 or 属性:clearSync(): void;<br>废弃版本:N/A|类名:Storage<br>方法 or 属性:clearSync(): void;<br>废弃版本:9<br>代替接口:ohos.preferences.preferences.clear |@ohos.data.storage.d.ts| +|废弃版本有变化|类名:Storage<br>方法 or 属性:flushSync(): void;<br>废弃版本:N/A|类名:Storage<br>方法 or 属性:flushSync(): void;<br>废弃版本:9<br>代替接口:ohos.preferences.preferences.flush |@ohos.data.storage.d.ts| +|废弃版本有变化|类名:Storage<br>方法 or 属性:on(type: 'change', callback: Callback\<StorageObserver>): void;<br>废弃版本:N/A|类名:Storage<br>方法 or 属性:on(type: 'change', callback: Callback\<StorageObserver>): void;<br>废弃版本:9<br>代替接口:ohos.preferences.preferences.on |@ohos.data.storage.d.ts| +|废弃版本有变化|类名:Storage<br>方法 or 属性:off(type: 'change', callback: Callback\<StorageObserver>): void;<br>废弃版本:N/A|类名:Storage<br>方法 or 属性:off(type: 'change', callback: Callback\<StorageObserver>): void;<br>废弃版本:9<br>代替接口:ohos.preferences.preferences.off |@ohos.data.storage.d.ts| +|废弃版本有变化|类名:StorageObserver<br>废弃版本:N/A|类名:StorageObserver<br>废弃版本:9<br>代替接口:N/A|@ohos.data.storage.d.ts| +|废弃版本有变化|类名:GetStorageOptions<br>废弃版本:N/A|类名:GetStorageOptions<br>废弃版本:6<br>代替接口:N/A|@system.storage.d.ts| +|废弃版本有变化|类名:GetStorageOptions<br>方法 or 属性:key: string;<br>废弃版本:N/A|类名:GetStorageOptions<br>方法 or 属性:key: string;<br>废弃版本:6<br>代替接口:N/A|@system.storage.d.ts| +|废弃版本有变化|类名:GetStorageOptions<br>方法 or 属性:default?: string;<br>废弃版本:N/A|类名:GetStorageOptions<br>方法 or 属性:default?: string;<br>废弃版本:6<br>代替接口:N/A|@system.storage.d.ts| +|废弃版本有变化|类名:GetStorageOptions<br>方法 or 属性:success?: (data: any) => void;<br>废弃版本:N/A|类名:GetStorageOptions<br>方法 or 属性:success?: (data: any) => void;<br>废弃版本:6<br>代替接口:N/A|@system.storage.d.ts| +|废弃版本有变化|类名:GetStorageOptions<br>方法 or 属性:fail?: (data: string, code: number) => void;<br>废弃版本:N/A|类名:GetStorageOptions<br>方法 or 属性:fail?: (data: string, code: number) => void;<br>废弃版本:6<br>代替接口:N/A|@system.storage.d.ts| +|废弃版本有变化|类名:GetStorageOptions<br>方法 or 属性:complete?: () => void;<br>废弃版本:N/A|类名:GetStorageOptions<br>方法 or 属性:complete?: () => void;<br>废弃版本:6<br>代替接口:N/A|@system.storage.d.ts| +|废弃版本有变化|类名:SetStorageOptions<br>废弃版本:N/A|类名:SetStorageOptions<br>废弃版本:6<br>代替接口:N/A|@system.storage.d.ts| +|废弃版本有变化|类名:SetStorageOptions<br>方法 or 属性:key: string;<br>废弃版本:N/A|类名:SetStorageOptions<br>方法 or 属性:key: string;<br>废弃版本:6<br>代替接口:N/A|@system.storage.d.ts| +|废弃版本有变化|类名:SetStorageOptions<br>方法 or 属性:value: string;<br>废弃版本:N/A|类名:SetStorageOptions<br>方法 or 属性:value: string;<br>废弃版本:6<br>代替接口:N/A|@system.storage.d.ts| +|废弃版本有变化|类名:SetStorageOptions<br>方法 or 属性:success?: () => void;<br>废弃版本:N/A|类名:SetStorageOptions<br>方法 or 属性:success?: () => void;<br>废弃版本:6<br>代替接口:N/A|@system.storage.d.ts| +|废弃版本有变化|类名:SetStorageOptions<br>方法 or 属性:fail?: (data: string, code: number) => void;<br>废弃版本:N/A|类名:SetStorageOptions<br>方法 or 属性:fail?: (data: string, code: number) => void;<br>废弃版本:6<br>代替接口:N/A|@system.storage.d.ts| +|废弃版本有变化|类名:SetStorageOptions<br>方法 or 属性:complete?: () => void;<br>废弃版本:N/A|类名:SetStorageOptions<br>方法 or 属性:complete?: () => void;<br>废弃版本:6<br>代替接口:N/A|@system.storage.d.ts| +|废弃版本有变化|类名:ClearStorageOptions<br>废弃版本:N/A|类名:ClearStorageOptions<br>废弃版本:6<br>代替接口:N/A|@system.storage.d.ts| +|废弃版本有变化|类名:ClearStorageOptions<br>方法 or 属性:success?: () => void;<br>废弃版本:N/A|类名:ClearStorageOptions<br>方法 or 属性:success?: () => void;<br>废弃版本:6<br>代替接口:N/A|@system.storage.d.ts| +|废弃版本有变化|类名:ClearStorageOptions<br>方法 or 属性:fail?: (data: string, code: number) => void;<br>废弃版本:N/A|类名:ClearStorageOptions<br>方法 or 属性:fail?: (data: string, code: number) => void;<br>废弃版本:6<br>代替接口:N/A|@system.storage.d.ts| +|废弃版本有变化|类名:ClearStorageOptions<br>方法 or 属性:complete?: () => void;<br>废弃版本:N/A|类名:ClearStorageOptions<br>方法 or 属性:complete?: () => void;<br>废弃版本:6<br>代替接口:N/A|@system.storage.d.ts| +|废弃版本有变化|类名:DeleteStorageOptions<br>废弃版本:N/A|类名:DeleteStorageOptions<br>废弃版本:6<br>代替接口:N/A|@system.storage.d.ts| +|废弃版本有变化|类名:DeleteStorageOptions<br>方法 or 属性:key: string;<br>废弃版本:N/A|类名:DeleteStorageOptions<br>方法 or 属性:key: string;<br>废弃版本:6<br>代替接口:N/A|@system.storage.d.ts| +|废弃版本有变化|类名:DeleteStorageOptions<br>方法 or 属性:success?: () => void;<br>废弃版本:N/A|类名:DeleteStorageOptions<br>方法 or 属性:success?: () => void;<br>废弃版本:6<br>代替接口:N/A|@system.storage.d.ts| +|废弃版本有变化|类名:DeleteStorageOptions<br>方法 or 属性:fail?: (data: string, code: number) => void;<br>废弃版本:N/A|类名:DeleteStorageOptions<br>方法 or 属性:fail?: (data: string, code: number) => void;<br>废弃版本:6<br>代替接口:N/A|@system.storage.d.ts| +|废弃版本有变化|类名:DeleteStorageOptions<br>方法 or 属性:complete?: () => void;<br>废弃版本:N/A|类名:DeleteStorageOptions<br>方法 or 属性:complete?: () => void;<br>废弃版本:6<br>代替接口:N/A|@system.storage.d.ts| +|废弃版本有变化|类名:Storage<br>废弃版本:N/A|类名:Storage<br>废弃版本:6<br>代替接口:N/A|@system.storage.d.ts| +|废弃版本有变化|类名:Storage<br>方法 or 属性:static get(options: GetStorageOptions): void;<br>废弃版本:N/A|类名:Storage<br>方法 or 属性:static get(options: GetStorageOptions): void;<br>废弃版本:6<br>代替接口:ohos.preferences.preferences.get |@system.storage.d.ts| +|废弃版本有变化|类名:Storage<br>方法 or 属性:static set(options: SetStorageOptions): void;<br>废弃版本:N/A|类名:Storage<br>方法 or 属性:static set(options: SetStorageOptions): void;<br>废弃版本:6<br>代替接口:N/A|@system.storage.d.ts| +|废弃版本有变化|类名:Storage<br>方法 or 属性:static clear(options?: ClearStorageOptions): void;<br>废弃版本:N/A|类名:Storage<br>方法 or 属性:static clear(options?: ClearStorageOptions): void;<br>废弃版本:6<br>代替接口:ohos.preferences.preferences.clear |@system.storage.d.ts| +|废弃版本有变化|类名:Storage<br>方法 or 属性:static delete(options: DeleteStorageOptions): void;<br>废弃版本:N/A|类名:Storage<br>方法 or 属性:static delete(options: DeleteStorageOptions): void;<br>废弃版本:6<br>代替接口:ohos.preferences.preferences.delete |@system.storage.d.ts| +|废弃版本有变化|类名:ResultSet<br>废弃版本:N/A|类名:ResultSet<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.ResultSet |resultSet.d.ts| +|废弃版本有变化|类名:ResultSet<br>方法 or 属性:columnNames: Array\<string>;<br>废弃版本:N/A|类名:ResultSet<br>方法 or 属性:columnNames: Array\<string>;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.ResultSet.columnNames |resultSet.d.ts| +|废弃版本有变化|类名:ResultSet<br>方法 or 属性:columnCount: number;<br>废弃版本:N/A|类名:ResultSet<br>方法 or 属性:columnCount: number;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.ResultSet.columnCount |resultSet.d.ts| +|废弃版本有变化|类名:ResultSet<br>方法 or 属性:rowCount: number;<br>废弃版本:N/A|类名:ResultSet<br>方法 or 属性:rowCount: number;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.ResultSet.rowCount |resultSet.d.ts| +|废弃版本有变化|类名:ResultSet<br>方法 or 属性:rowIndex: number;<br>废弃版本:N/A|类名:ResultSet<br>方法 or 属性:rowIndex: number;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.ResultSet.rowIndex |resultSet.d.ts| +|废弃版本有变化|类名:ResultSet<br>方法 or 属性:isAtFirstRow: boolean;<br>废弃版本:N/A|类名:ResultSet<br>方法 or 属性:isAtFirstRow: boolean;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.ResultSet.isAtFirstRow |resultSet.d.ts| +|废弃版本有变化|类名:ResultSet<br>方法 or 属性:isAtLastRow: boolean;<br>废弃版本:N/A|类名:ResultSet<br>方法 or 属性:isAtLastRow: boolean;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.ResultSet.isAtLastRow |resultSet.d.ts| +|废弃版本有变化|类名:ResultSet<br>方法 or 属性:isEnded: boolean;<br>废弃版本:N/A|类名:ResultSet<br>方法 or 属性:isEnded: boolean;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.ResultSet.isEnded |resultSet.d.ts| +|废弃版本有变化|类名:ResultSet<br>方法 or 属性:isStarted: boolean;<br>废弃版本:N/A|类名:ResultSet<br>方法 or 属性:isStarted: boolean;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.ResultSet.isStarted |resultSet.d.ts| +|废弃版本有变化|类名:ResultSet<br>方法 or 属性:isClosed: boolean;<br>废弃版本:N/A|类名:ResultSet<br>方法 or 属性:isClosed: boolean;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.ResultSet.isClosed |resultSet.d.ts| +|废弃版本有变化|类名:ResultSet<br>方法 or 属性:getColumnIndex(columnName: string): number;<br>废弃版本:N/A|类名:ResultSet<br>方法 or 属性:getColumnIndex(columnName: string): number;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.ResultSet.getColumnIndex |resultSet.d.ts| +|废弃版本有变化|类名:ResultSet<br>方法 or 属性:getColumnName(columnIndex: number): string;<br>废弃版本:N/A|类名:ResultSet<br>方法 or 属性:getColumnName(columnIndex: number): string;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.ResultSet.getColumnName |resultSet.d.ts| +|废弃版本有变化|类名:ResultSet<br>方法 or 属性:goTo(offset: number): boolean;<br>废弃版本:N/A|类名:ResultSet<br>方法 or 属性:goTo(offset: number): boolean;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.ResultSet.goTo |resultSet.d.ts| +|废弃版本有变化|类名:ResultSet<br>方法 or 属性:goToRow(position: number): boolean;<br>废弃版本:N/A|类名:ResultSet<br>方法 or 属性:goToRow(position: number): boolean;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.ResultSet.goToRow |resultSet.d.ts| +|废弃版本有变化|类名:ResultSet<br>方法 or 属性:goToFirstRow(): boolean;<br>废弃版本:N/A|类名:ResultSet<br>方法 or 属性:goToFirstRow(): boolean;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.ResultSet.goToFirstRow |resultSet.d.ts| +|废弃版本有变化|类名:ResultSet<br>方法 or 属性:goToLastRow(): boolean;<br>废弃版本:N/A|类名:ResultSet<br>方法 or 属性:goToLastRow(): boolean;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.ResultSet.goToLastRow |resultSet.d.ts| +|废弃版本有变化|类名:ResultSet<br>方法 or 属性:goToNextRow(): boolean;<br>废弃版本:N/A|类名:ResultSet<br>方法 or 属性:goToNextRow(): boolean;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.ResultSet.goToNextRow |resultSet.d.ts| +|废弃版本有变化|类名:ResultSet<br>方法 or 属性:goToPreviousRow(): boolean;<br>废弃版本:N/A|类名:ResultSet<br>方法 or 属性:goToPreviousRow(): boolean;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.ResultSet.goToPreviousRow |resultSet.d.ts| +|废弃版本有变化|类名:ResultSet<br>方法 or 属性:getBlob(columnIndex: number): Uint8Array;<br>废弃版本:N/A|类名:ResultSet<br>方法 or 属性:getBlob(columnIndex: number): Uint8Array;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.ResultSet.getBlob |resultSet.d.ts| +|废弃版本有变化|类名:ResultSet<br>方法 or 属性:getString(columnIndex: number): string;<br>废弃版本:N/A|类名:ResultSet<br>方法 or 属性:getString(columnIndex: number): string;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.ResultSet.getString |resultSet.d.ts| +|废弃版本有变化|类名:ResultSet<br>方法 or 属性:getLong(columnIndex: number): number;<br>废弃版本:N/A|类名:ResultSet<br>方法 or 属性:getLong(columnIndex: number): number;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.ResultSet.getLong |resultSet.d.ts| +|废弃版本有变化|类名:ResultSet<br>方法 or 属性:getDouble(columnIndex: number): number;<br>废弃版本:N/A|类名:ResultSet<br>方法 or 属性:getDouble(columnIndex: number): number;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.ResultSet.getDouble |resultSet.d.ts| +|废弃版本有变化|类名:ResultSet<br>方法 or 属性:isColumnNull(columnIndex: number): boolean;<br>废弃版本:N/A|类名:ResultSet<br>方法 or 属性:isColumnNull(columnIndex: number): boolean;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.ResultSet.isColumnNull |resultSet.d.ts| +|废弃版本有变化|类名:ResultSet<br>方法 or 属性:close(): void;<br>废弃版本:N/A|类名:ResultSet<br>方法 or 属性:close(): void;<br>废弃版本:9<br>代替接口:ohos.data.relationalStore.ResultSet.close |resultSet.d.ts| +|起始版本有变化|类名:RdbStore<br>方法 or 属性:executeSql(sql: string, bindArgs: Array\<ValueType>, callback: AsyncCallback\<void>): void;<br>起始版本:7|类名:RdbStore<br>方法 or 属性:executeSql(sql: string, bindArgs: Array\<ValueType>, callback: AsyncCallback\<void>): void;<br>起始版本:8|@ohos.data.rdb.d.ts| +|新增(错误码)|NA|类名:RdbPredicates<br>方法 or 属性:isNotNull(field: string): RdbPredicates;<br>错误码内容: 401|@ohos.data.rdb.d.ts| +|新增(权限)|类名:DistributedObject<br>方法 or 属性:setSessionId(sessionId?: string): boolean;<br>权限:N/A|类名:DistributedObject<br>方法 or 属性:setSessionId(sessionId?: string): boolean;<br>权限:ohos.permission.DISTRIBUTED_DATASYNC|@ohos.data.distributedDataObject.d.ts| +|新增(权限)|类名:SubscribeType<br>权限:N/A|类名:SubscribeType<br>权限:ohos.permission.DISTRIBUTED_DATASYNC|@ohos.data.rdb.d.ts| +|新增(权限)|类名:RdbStore<br>方法 or 属性:setDistributedTables(tables: Array\<string>, callback: AsyncCallback\<void>): void;<br>权限:N/A|类名:RdbStore<br>方法 or 属性:setDistributedTables(tables: Array\<string>, callback: AsyncCallback\<void>): void;<br>权限:ohos.permission.DISTRIBUTED_DATASYNC|@ohos.data.rdb.d.ts| +|新增(权限)|类名:RdbStore<br>方法 or 属性:setDistributedTables(tables: Array\<string>): Promise\<void>;<br>权限:N/A|类名:RdbStore<br>方法 or 属性:setDistributedTables(tables: Array\<string>): Promise\<void>;<br>权限:ohos.permission.DISTRIBUTED_DATASYNC|@ohos.data.rdb.d.ts| +|新增(权限)|类名:RdbStore<br>方法 or 属性:obtainDistributedTableName(device: string, table: string, callback: AsyncCallback\<string>): void;<br>权限:N/A|类名:RdbStore<br>方法 or 属性:obtainDistributedTableName(device: string, table: string, callback: AsyncCallback\<string>): void;<br>权限:ohos.permission.DISTRIBUTED_DATASYNC|@ohos.data.rdb.d.ts| +|新增(权限)|类名:RdbStore<br>方法 or 属性:obtainDistributedTableName(device: string, table: string): Promise\<string>;<br>权限:N/A|类名:RdbStore<br>方法 or 属性:obtainDistributedTableName(device: string, table: string): Promise\<string>;<br>权限:ohos.permission.DISTRIBUTED_DATASYNC|@ohos.data.rdb.d.ts| +|函数有变化|类名:KVStore<br>方法 or 属性:on(event: 'dataChange', type: SubscribeType, observer: Callback\<ChangeNotification>): void;<br>|类名:KVStore<br>方法 or 属性:on(event: 'dataChange', type: SubscribeType, listener: Callback\<ChangeNotification>): void;<br>|@ohos.data.distributedData.d.ts| +|函数有变化|类名:KVStore<br>方法 or 属性:off(event:'dataChange', observer?: Callback\<ChangeNotification>): void;<br>|类名:KVStore<br>方法 or 属性:off(event: 'dataChange', listener?: Callback\<ChangeNotification>): void;<br>|@ohos.data.distributedData.d.ts| +|函数有变化|类名:SingleKVStore<br>方法 or 属性:sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void;<br>|类名:SingleKVStore<br>方法 or 属性:sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void;<br>|@ohos.data.distributedData.d.ts| +|函数有变化|类名:DeviceKVStore<br>方法 or 属性:sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void;<br>|类名:DeviceKVStore<br>方法 or 属性:sync(deviceIds: string[], mode: SyncMode, delayMs?: number): void;<br>|@ohos.data.distributedData.d.ts| +|函数有变化|类名:RdbStore<br>方法 or 属性:insert(name: string, values: ValuesBucket, callback: AsyncCallback\<number>): void;<br>|类名:RdbStore<br>方法 or 属性:insert(table: string, values: ValuesBucket, callback: AsyncCallback\<number>): void;<br>|@ohos.data.rdb.d.ts| +|函数有变化|类名:RdbStore<br>方法 or 属性:insert(name: string, values: ValuesBucket): Promise\<number>;<br>|类名:RdbStore<br>方法 or 属性:insert(table: string, values: ValuesBucket): Promise\<number>;<br>|@ohos.data.rdb.d.ts| +|函数有变化|类名:RdbStore<br>方法 or 属性:update(values: ValuesBucket, rdbPredicates: RdbPredicates, callback: AsyncCallback\<number>): void;<br>|类名:RdbStore<br>方法 or 属性:update(values: ValuesBucket, predicates: RdbPredicates, callback: AsyncCallback\<number>): void;<br>|@ohos.data.rdb.d.ts| +|函数有变化|类名:RdbStore<br>方法 or 属性:update(values: ValuesBucket, rdbPredicates: RdbPredicates): Promise\<number>;<br>|类名:RdbStore<br>方法 or 属性:update(values: ValuesBucket, predicates: RdbPredicates): Promise\<number>;<br>|@ohos.data.rdb.d.ts| +|函数有变化|类名:RdbStore<br>方法 or 属性:delete(rdbPredicates: RdbPredicates, callback: AsyncCallback\<number>): void;<br>|类名:RdbStore<br>方法 or 属性:delete(predicates: RdbPredicates, callback: AsyncCallback\<number>): void;<br>|@ohos.data.rdb.d.ts| +|函数有变化|类名:RdbStore<br>方法 or 属性:delete(rdbPredicates: RdbPredicates): Promise\<number>;<br>|类名:RdbStore<br>方法 or 属性:delete(predicates: RdbPredicates): Promise\<number>;<br>|@ohos.data.rdb.d.ts| +|函数有变化|类名:RdbStore<br>方法 or 属性:query(rdbPredicates: RdbPredicates, columns: Array\<string>, callback: AsyncCallback\<ResultSet>): void;<br>|类名:RdbStore<br>方法 or 属性:query(predicates: RdbPredicates, columns: Array\<string>, callback: AsyncCallback\<ResultSet>): void;<br>|@ohos.data.rdb.d.ts| +|函数有变化|类名:RdbStore<br>方法 or 属性:query(rdbPredicates: RdbPredicates, columns?: Array\<string>): Promise\<ResultSet>;<br>|类名:RdbStore<br>方法 or 属性:query(predicates: RdbPredicates, columns ?: Array\<string>): Promise\<ResultSet>;<br>|@ohos.data.rdb.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-distributed-hardware.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-distributed-hardware.md new file mode 100644 index 0000000000000000000000000000000000000000..e56e7b0c8a589159dc450691fe49f6eb3ea91f8e --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-distributed-hardware.md @@ -0,0 +1,47 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.distributedHardware.deviceManager<br>类名: DeviceInfo<br>方法 or 属性:range: number;|@ohos.distributedHardware.deviceManager.d.ts| +|新增|NA|类名:DeviceInfo<br>方法or属性:range: number;|@ohos.distributedHardware.deviceManager.d.ts| +|新增|NA|模块名: ohos.distributedHardware.deviceManager<br>类名: PublishInfo|@ohos.distributedHardware.deviceManager.d.ts| +|新增|NA|类名:PublishInfo<br>方法or属性:|@ohos.distributedHardware.deviceManager.d.ts| +|新增|NA|模块名: ohos.distributedHardware.deviceManager<br>类名: PublishInfo<br>方法 or 属性:publishId: number;|@ohos.distributedHardware.deviceManager.d.ts| +|新增|NA|类名:PublishInfo<br>方法or属性:publishId: number;|@ohos.distributedHardware.deviceManager.d.ts| +|新增|NA|模块名: ohos.distributedHardware.deviceManager<br>类名: PublishInfo<br>方法 or 属性:mode: DiscoverMode;|@ohos.distributedHardware.deviceManager.d.ts| +|新增|NA|类名:PublishInfo<br>方法or属性:mode: DiscoverMode;|@ohos.distributedHardware.deviceManager.d.ts| +|新增|NA|模块名: ohos.distributedHardware.deviceManager<br>类名: PublishInfo<br>方法 or 属性:freq: ExchangeFreq;|@ohos.distributedHardware.deviceManager.d.ts| +|新增|NA|类名:PublishInfo<br>方法or属性:freq: ExchangeFreq;|@ohos.distributedHardware.deviceManager.d.ts| +|新增|NA|模块名: ohos.distributedHardware.deviceManager<br>类名: PublishInfo<br>方法 or 属性:ranging : boolean;|@ohos.distributedHardware.deviceManager.d.ts| +|新增|NA|类名:PublishInfo<br>方法or属性:ranging : boolean;|@ohos.distributedHardware.deviceManager.d.ts| +|新增|NA|类名:DeviceManager<br>方法or属性:startDeviceDiscovery(subscribeInfo: SubscribeInfo, filterOptions?: string): void;|@ohos.distributedHardware.deviceManager.d.ts| +|新增|NA|类名:DeviceManager<br>方法or属性:publishDeviceDiscovery(publishInfo: PublishInfo): void;|@ohos.distributedHardware.deviceManager.d.ts| +|新增|NA|类名:DeviceManager<br>方法or属性:unPublishDeviceDiscovery(publishId: number): void;|@ohos.distributedHardware.deviceManager.d.ts| +|新增|NA|类名:DeviceManager<br>方法or属性:setUserOperation(operateAction: number, params: string): void;|@ohos.distributedHardware.deviceManager.d.ts| +|新增|NA|类名:DeviceManager<br>方法or属性:on(type: 'uiStateChange', callback: Callback\<{ param: string}>): void;|@ohos.distributedHardware.deviceManager.d.ts| +|新增|NA|类名:DeviceManager<br>方法or属性:off(type: 'uiStateChange', callback?: Callback\<{ param: string}>): void;|@ohos.distributedHardware.deviceManager.d.ts| +|新增|NA|类名:DeviceManager<br>方法or属性:on(type: 'publishSuccess', callback: Callback\<{ publishId: number }>): void;|@ohos.distributedHardware.deviceManager.d.ts| +|新增|NA|类名:DeviceManager<br>方法or属性:off(type: 'publishSuccess', callback?: Callback\<{ publishId: number }>): void;|@ohos.distributedHardware.deviceManager.d.ts| +|新增|NA|类名:DeviceManager<br>方法or属性:on(type: 'publishFail', callback: Callback\<{ publishId: number, reason: number }>): void;|@ohos.distributedHardware.deviceManager.d.ts| +|新增|NA|类名:DeviceManager<br>方法or属性:off(type: 'publishFail', callback?: Callback\<{ publishId: number, reason: number }>): void;|@ohos.distributedHardware.deviceManager.d.ts| +|访问级别有变化|类名:DeviceType<br>访问级别:公开API|类名:DeviceType<br>访问级别:系统API|@ohos.distributedHardware.deviceManager.d.ts| +|起始版本有变化|类名:DeviceManager<br>方法 or 属性:startDeviceDiscovery(subscribeInfo: SubscribeInfo): void;<br>起始版本:N/A|类名:DeviceManager<br>方法 or 属性:startDeviceDiscovery(subscribeInfo: SubscribeInfo): void;<br>起始版本:8|@ohos.distributedHardware.deviceManager.d.ts| +|新增(错误码)|NA|类名:deviceManager<br>方法 or 属性:function createDeviceManager(bundleName: string, callback: AsyncCallback\<DeviceManager>): void;<br>错误码内容: 401|@ohos.distributedHardware.deviceManager.d.ts| +|新增(错误码)|NA|类名:DeviceManager<br>方法 or 属性:release(): void;<br>错误码内容: 11600101|@ohos.distributedHardware.deviceManager.d.ts| +|新增(错误码)|NA|类名:DeviceManager<br>方法 or 属性:getTrustedDeviceListSync(): Array\<DeviceInfo>;<br>错误码内容: 401, 11600101|@ohos.distributedHardware.deviceManager.d.ts| +|新增(错误码)|NA|类名:DeviceManager<br>方法 or 属性:getTrustedDeviceList(callback:AsyncCallback\<Array\<DeviceInfo>>): void;<br>错误码内容: 401|@ohos.distributedHardware.deviceManager.d.ts| +|新增(错误码)|NA|类名:DeviceManager<br>方法 or 属性:getTrustedDeviceList(): Promise\<Array\<DeviceInfo>>;<br>错误码内容: 401|@ohos.distributedHardware.deviceManager.d.ts| +|新增(错误码)|NA|类名:DeviceManager<br>方法 or 属性:getLocalDeviceInfoSync(): DeviceInfo;<br>错误码内容: 401, 11600101|@ohos.distributedHardware.deviceManager.d.ts| +|新增(错误码)|NA|类名:DeviceManager<br>方法 or 属性:getLocalDeviceInfo(callback:AsyncCallback\<DeviceInfo>): void;<br>错误码内容: 401|@ohos.distributedHardware.deviceManager.d.ts| +|新增(错误码)|NA|类名:DeviceManager<br>方法 or 属性:getLocalDeviceInfo(): Promise\<DeviceInfo>;<br>错误码内容: 401|@ohos.distributedHardware.deviceManager.d.ts| +|新增(错误码)|NA|类名:DeviceManager<br>方法 or 属性:startDeviceDiscovery(subscribeInfo: SubscribeInfo): void;<br>错误码内容: 401, 201, 11600104, 11600101|@ohos.distributedHardware.deviceManager.d.ts| +|新增(错误码)|NA|类名:DeviceManager<br>方法 or 属性:stopDeviceDiscovery(subscribeId: number): void;<br>错误码内容: 401, 201, 11600101|@ohos.distributedHardware.deviceManager.d.ts| +|新增(错误码)|NA|类名:DeviceManager<br>方法 or 属性:unAuthenticateDevice(deviceInfo: DeviceInfo): void<br>错误码内容: 401, 201, 11600101|@ohos.distributedHardware.deviceManager.d.ts| +|新增(错误码)|NA|类名:DeviceManager<br>方法 or 属性:verifyAuthInfo(authInfo: AuthInfo, callback: AsyncCallback\<{deviceId: string, level: number}>): void;<br>错误码内容: 401|@ohos.distributedHardware.deviceManager.d.ts| +|新增(错误码)|NA|类名:DeviceManager<br>方法 or 属性:on(type: 'deviceStateChange', callback: Callback\<{ action: DeviceStateChangeAction, device: DeviceInfo }>): void;<br>错误码内容: 401|@ohos.distributedHardware.deviceManager.d.ts| +|新增(错误码)|NA|类名:DeviceManager<br>方法 or 属性:off(type: 'deviceStateChange', callback?: Callback\<{ action: DeviceStateChangeAction, device: DeviceInfo }>): void;<br>错误码内容: 401|@ohos.distributedHardware.deviceManager.d.ts| +|新增(错误码)|NA|类名:DeviceManager<br>方法 or 属性:on(type: 'deviceFound', callback: Callback\<{ subscribeId: number, device: DeviceInfo }>): void;<br>错误码内容: 401|@ohos.distributedHardware.deviceManager.d.ts| +|新增(错误码)|NA|类名:DeviceManager<br>方法 or 属性:off(type: 'deviceFound', callback?: Callback\<{ subscribeId: number, device: DeviceInfo }>): void;<br>错误码内容: 401|@ohos.distributedHardware.deviceManager.d.ts| +|新增(错误码)|NA|类名:DeviceManager<br>方法 or 属性:on(type: 'discoverFail', callback: Callback\<{ subscribeId: number, reason: number }>): void;<br>错误码内容: 401|@ohos.distributedHardware.deviceManager.d.ts| +|新增(错误码)|NA|类名:DeviceManager<br>方法 or 属性:off(type: 'discoverFail', callback?: Callback\<{ subscribeId: number, reason: number }>): void;<br>错误码内容: 401|@ohos.distributedHardware.deviceManager.d.ts| +|新增(错误码)|NA|类名:DeviceManager<br>方法 or 属性:on(type: 'serviceDie', callback: () => void): void;<br>错误码内容: 401|@ohos.distributedHardware.deviceManager.d.ts| +|新增(错误码)|NA|类名:DeviceManager<br>方法 or 属性:off(type: 'serviceDie', callback?: () => void): void;<br>错误码内容: 401|@ohos.distributedHardware.deviceManager.d.ts| +|函数有变化|类名:DeviceManager<br>方法 or 属性:authenticateDevice(deviceInfo: DeviceInfo, authParam: AuthParam, callback: AsyncCallback\<{deviceId: string, pinTone ?: number}>): void;<br>|类名:DeviceManager<br>方法 or 属性:authenticateDevice(deviceInfo: DeviceInfo, authParam: AuthParam, callback: AsyncCallback\<{deviceId: string, pinToken ?: number}>): void;<br>|@ohos.distributedHardware.deviceManager.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-file-management.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-file-management.md new file mode 100644 index 0000000000000000000000000000000000000000..0818a0f93bf368f73b2cf23c0072425f8b9de551 --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-file-management.md @@ -0,0 +1,577 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.file.environment<br>类名: Environment|@ohos.file.environment.d.ts| +|新增|NA|模块名: ohos.file.environment<br>类名: Environment<br>方法 or 属性: function getStorageDataDir(): Promise\<string>;|@ohos.file.environment.d.ts| +|新增|NA|模块名: ohos.file.environment<br>类名: Environment<br>方法 or 属性: function getStorageDataDir(callback: AsyncCallback\<string>): void;|@ohos.file.environment.d.ts| +|新增|NA|模块名: ohos.file.environment<br>类名: Environment<br>方法 or 属性: function getUserDataDir(): Promise\<string>;|@ohos.file.environment.d.ts| +|新增|NA|模块名: ohos.file.environment<br>类名: Environment<br>方法 or 属性: function getUserDataDir(callback: AsyncCallback\<string>): void;|@ohos.file.environment.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: fileAccess|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: fileAccess<br>方法 or 属性: function getFileAccessAbilityInfo(callback: AsyncCallback\<Array\<Want>>): void;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: fileAccess<br>方法 or 属性: function getFileAccessAbilityInfo(): Promise\<Array\<Want>>;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: fileAccess<br>方法 or 属性: function createFileAccessHelper(context: Context): FileAccessHelper;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: fileAccess<br>方法 or 属性: function createFileAccessHelper(context: Context, wants: Array\<Want>): FileAccessHelper;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: FileInfo|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: FileInfo<br>方法 or 属性: uri: string;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: FileInfo<br>方法 or 属性: fileName: string;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: FileInfo<br>方法 or 属性: mode: number;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: FileInfo<br>方法 or 属性: size: number;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: FileInfo<br>方法 or 属性: mtime: number;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: FileInfo<br>方法 or 属性: mimeType: string;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: FileInfo<br>方法 or 属性: listFile(filter?: Filter): FileIterator;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: FileInfo<br>方法 or 属性: scanFile(filter?: Filter): FileIterator;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: FileIterator|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: FileIterator<br>方法 or 属性: next(): {value: FileInfo, done: boolean}|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: RootInfo|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: RootInfo<br>方法 or 属性: deviceType: number;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: RootInfo<br>方法 or 属性: uri: string;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: RootInfo<br>方法 or 属性: displayName: string;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: RootInfo<br>方法 or 属性: deviceFlags: number;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: RootInfo<br>方法 or 属性: listFile(filter?: Filter): FileIterator;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: RootInfo<br>方法 or 属性: scanFile(filter?: Filter): FileIterator;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: RootIterator|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: RootIterator<br>方法 or 属性: next(): {value: RootInfo, done: boolean}|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: OPENFLAGS|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: OPENFLAGS<br>方法 or 属性: READ = 0o0|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: OPENFLAGS<br>方法 or 属性: WRITE = 0o1|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: OPENFLAGS<br>方法 or 属性: WRITE_READ = 0o2|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: FileAccessHelper|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: FileAccessHelper<br>方法 or 属性: openFile(uri: string, flags: OPENFLAGS) : Promise\<number>;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: FileAccessHelper<br>方法 or 属性: openFile(uri: string, flags: OPENFLAGS, callback: AsyncCallback\<number>) : void;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: FileAccessHelper<br>方法 or 属性: createFile(uri: string, displayName: string) : Promise\<string>;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: FileAccessHelper<br>方法 or 属性: createFile(uri: string, displayName: string, callback: AsyncCallback\<string>) : void;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: FileAccessHelper<br>方法 or 属性: mkDir(parentUri: string, displayName: string) : Promise\<string>;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: FileAccessHelper<br>方法 or 属性: mkDir(parentUri: string, displayName: string, callback: AsyncCallback\<string>) : void;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: FileAccessHelper<br>方法 or 属性: delete(uri: string) : Promise\<number>;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: FileAccessHelper<br>方法 or 属性: delete(uri: string, callback: AsyncCallback\<number>) : void;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: FileAccessHelper<br>方法 or 属性: move(sourceFile: string, destFile: string) : Promise\<string>;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: FileAccessHelper<br>方法 or 属性: move(sourceFile: string, destFile: string, callback: AsyncCallback\<string>) : void;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: FileAccessHelper<br>方法 or 属性: rename(uri: string, displayName: string) : Promise\<string>;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: FileAccessHelper<br>方法 or 属性: rename(uri: string, displayName: string, callback: AsyncCallback\<string>) : void;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: FileAccessHelper<br>方法 or 属性: access(sourceFileUri: string) : Promise\<boolean>;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: FileAccessHelper<br>方法 or 属性: access(sourceFileUri: string, callback: AsyncCallback\<boolean>) : void;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: FileAccessHelper<br>方法 or 属性: getRoots(): Promise\<RootIterator>;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileAccess<br>类名: FileAccessHelper<br>方法 or 属性: getRoots(callback:AsyncCallback\<RootIterator>) : void;|@ohos.file.fileAccess.d.ts| +|新增|NA|模块名: ohos.file.fileExtensionInfo<br>类名: fileExtensionInfo|@ohos.file.fileExtensionInfo.d.ts| +|新增|NA|模块名: ohos.file.fileExtensionInfo<br>类名: DeviceType|@ohos.file.fileExtensionInfo.d.ts| +|新增|NA|模块名: ohos.file.fileExtensionInfo<br>类名: DeviceType<br>方法 or 属性: DEVICE_LOCAL_DISK = 1|@ohos.file.fileExtensionInfo.d.ts| +|新增|NA|模块名: ohos.file.fileExtensionInfo<br>类名: DeviceType<br>方法 or 属性: DEVICE_SHARED_DISK|@ohos.file.fileExtensionInfo.d.ts| +|新增|NA|模块名: ohos.file.fileExtensionInfo<br>类名: DeviceType<br>方法 or 属性: DEVICE_SHARED_TERMINAL|@ohos.file.fileExtensionInfo.d.ts| +|新增|NA|模块名: ohos.file.fileExtensionInfo<br>类名: DeviceType<br>方法 or 属性: DEVICE_NETWORK_NEIGHBORHOODS|@ohos.file.fileExtensionInfo.d.ts| +|新增|NA|模块名: ohos.file.fileExtensionInfo<br>类名: DeviceType<br>方法 or 属性: DEVICE_EXTERNAL_MTP|@ohos.file.fileExtensionInfo.d.ts| +|新增|NA|模块名: ohos.file.fileExtensionInfo<br>类名: DeviceType<br>方法 or 属性: DEVICE_EXTERNAL_USB|@ohos.file.fileExtensionInfo.d.ts| +|新增|NA|模块名: ohos.file.fileExtensionInfo<br>类名: DeviceType<br>方法 or 属性: DEVICE_EXTERNAL_CLOUD|@ohos.file.fileExtensionInfo.d.ts| +|新增|NA|模块名: ohos.file.fileExtensionInfo<br>类名: DeviceFlag|@ohos.file.fileExtensionInfo.d.ts| +|新增|NA|模块名: ohos.file.fileExtensionInfo<br>类名: DeviceFlag<br>方法 or 属性: const SUPPORTS_READ = 0b1;|@ohos.file.fileExtensionInfo.d.ts| +|新增|NA|模块名: ohos.file.fileExtensionInfo<br>类名: DeviceFlag<br>方法 or 属性: const SUPPORTS_WRITE = 0b10;|@ohos.file.fileExtensionInfo.d.ts| +|新增|NA|模块名: ohos.file.fileExtensionInfo<br>类名: DocumentFlag|@ohos.file.fileExtensionInfo.d.ts| +|新增|NA|模块名: ohos.file.fileExtensionInfo<br>类名: DocumentFlag<br>方法 or 属性: const REPRESENTS_FILE = 0b1;|@ohos.file.fileExtensionInfo.d.ts| +|新增|NA|模块名: ohos.file.fileExtensionInfo<br>类名: DocumentFlag<br>方法 or 属性: const REPRESENTS_DIR = 0b10;|@ohos.file.fileExtensionInfo.d.ts| +|新增|NA|模块名: ohos.file.fileExtensionInfo<br>类名: DocumentFlag<br>方法 or 属性: const SUPPORTS_READ = 0b100;|@ohos.file.fileExtensionInfo.d.ts| +|新增|NA|模块名: ohos.file.fileExtensionInfo<br>类名: DocumentFlag<br>方法 or 属性: const SUPPORTS_WRITE = 0b1000;|@ohos.file.fileExtensionInfo.d.ts| +|新增|NA|模块名: ohos.file.fileuri<br>类名: fileUri|@ohos.file.fileuri.d.ts| +|新增|NA|模块名: ohos.file.fileuri<br>类名: fileUri<br>方法 or 属性: function getUriFromPath(path: string): string;|@ohos.file.fileuri.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: OpenMode|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: OpenMode<br>方法 or 属性: const READ_ONLY = 0o0;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: OpenMode<br>方法 or 属性: const WRITE_ONLY = 0o1;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: OpenMode<br>方法 or 属性: const READ_WRITE = 0o2;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: OpenMode<br>方法 or 属性: const CREATE = 0o100;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: OpenMode<br>方法 or 属性: const TRUNC = 0o1000;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: OpenMode<br>方法 or 属性: const APPEND = 0o2000;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: OpenMode<br>方法 or 属性: const NONBLOCK = 0o4000;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: OpenMode<br>方法 or 属性: const DIR = 0o200000;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: OpenMode<br>方法 or 属性: const NOFOLLOW = 0o400000;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: OpenMode<br>方法 or 属性: const SYNC = 0o4010000;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function access(path: string): Promise\<boolean>;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function access(path: string, callback: AsyncCallback\<boolean>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function accessSync(path: string): boolean;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function close(file: number \| File): Promise\<void>;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function close(file: number \| File, callback: AsyncCallback\<void>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function closeSync(fd: number \| File): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function copyFile(src: string \| number, dest: string \| number, mode?: number): Promise\<void>;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function copyFile(src: string \| number, dest: string \| number, callback: AsyncCallback\<void>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function copyFile(src: string \| number, dest: string \| number, mode: number, callback: AsyncCallback\<void>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function copyFileSync(src: string \| number, dest: string \| number, mode?: number): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function createStream(path: string, mode: string): Promise\<Stream>;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function createStream(path: string, mode: string, callback: AsyncCallback\<Stream>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function createStreamSync(path: string, mode: string): Stream;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function fdatasync(fd: number): Promise\<void>;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function fdatasync(fd: number, callback: AsyncCallback\<void>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function fdatasyncSync(fd: number): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function fdopenStream(fd: number, mode: string): Promise\<Stream>;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function fdopenStream(fd: number, mode: string, callback: AsyncCallback\<Stream>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function fdopenStreamSync(fd: number, mode: string): Stream;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function fsync(fd: number): Promise\<void>;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function fsync(fd: number, callback: AsyncCallback\<void>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function fsyncSync(fd: number): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function listFile(path: string, options?: {<br> recursion?: boolean;<br> listNum?: number;<br> filter?: Filter;<br>}): Promise\<string[]>;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function listFile(path: string, callback: AsyncCallback\<string[]>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function listFile(path: string, options: {<br> recursion?: boolean;<br> listNum?: number;<br> filter?: Filter;<br>}, callback: AsyncCallback\<string[]>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function listFileSync(path: string, options?: {<br> recursion?: boolean;<br> listNum?: number;<br> filter?: Filter;<br>}): string[];|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function lstat(path: string): Promise\<Stat>;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function lstat(path: string, callback: AsyncCallback\<Stat>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function lstatSync(path: string): Stat;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function mkdir(path: string): Promise\<void>;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function mkdir(path: string, callback: AsyncCallback\<void>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function mkdirSync(path: string): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function mkdtemp(prefix: string): Promise\<string>;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function mkdtemp(prefix: string, callback: AsyncCallback\<string>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function mkdtempSync(prefix: string): string;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function moveFile(src: string, dest: string, mode?: number): Promise\<void>;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function moveFile(src: string, dest: string, callback: AsyncCallback\<void>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function moveFile(src: string, dest: string, mode: number, callback: AsyncCallback\<void>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function moveFileSync(src: string, dest: string, mode?: number): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function open(path: string, mode?: number): Promise\<File>;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function open(path: string, callback: AsyncCallback\<File>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function open(path: string, mode: number, callback: AsyncCallback\<File>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function openSync(path: string, mode?: number): File;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function read(fd: number, buffer: ArrayBuffer, options?: {<br> offset?: number;<br> length?: number;<br>}): Promise\<number>;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function read(fd: number, buffer: ArrayBuffer, callback: AsyncCallback\<number>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function read(fd: number, buffer: ArrayBuffer, options: {<br> offset?: number;<br> length?: number;<br>}, callback: AsyncCallback\<number>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function readSync(fd: number, buffer: ArrayBuffer, options?: {<br> offset?: number;<br> length?: number;<br>}): number;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function readText(filePath: string, options?: {<br> offset?: number;<br> length?: number;<br> encoding?: string;<br>}): Promise\<string>;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function readText(filePath: string, callback: AsyncCallback\<string>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function readText(filePath: string, options: {<br> offset?: number;<br> length?: number;<br> encoding?: string;<br>}, callback: AsyncCallback\<string>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function readTextSync(filePath: string, options?: {<br> offset?: number;<br> length?: number;<br> encoding?: string;<br>}): string;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function rename(oldPath: string, newPath: string): Promise\<void>;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function rename(oldPath: string, newPath: string, callback: AsyncCallback\<void>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function renameSync(oldPath: string, newPath: string): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function rmdir(path: string): Promise\<void>;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function rmdir(path: string, callback: AsyncCallback\<void>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function rmdirSync(path: string): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function stat(file: string \| number): Promise\<Stat>;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function stat(file: string \| number, callback: AsyncCallback\<Stat>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function statSync(file: string \| number): Stat;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function symlink(target: string, srcPath: string): Promise\<void>;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function symlink(target: string, srcPath: string, callback: AsyncCallback\<void>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function symlinkSync(target: string, srcPath: string): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function truncate(file: string \| number, len?: number): Promise\<void>;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function truncate(file: string \| number, callback: AsyncCallback\<void>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function truncate(file: string \| number, len: number, callback: AsyncCallback\<void>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function truncateSync(file: string \| number, len?: number): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function unlink(path: string): Promise\<void>;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function unlink(path: string, callback: AsyncCallback\<void>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function unlinkSync(path: string): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function write(fd: number, buffer: ArrayBuffer \| string, options?: {<br> offset?: number;<br> length?: number;<br> encoding?: string;<br>}): Promise\<number>;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function write(fd: number, buffer: ArrayBuffer \| string, callback: AsyncCallback\<number>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function write(fd: number, buffer: ArrayBuffer \| string, options: {<br> offset?: number;<br> length?: number;<br> encoding?: string;<br>}, callback: AsyncCallback\<number>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: fileIo<br>方法 or 属性: function writeSync(fd: number, buffer: ArrayBuffer \| string, options?: {<br> offset?: number;<br> length?: number;<br> encoding?: string;<br>}): number;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: File|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: File<br>方法 or 属性: readonly fd: number;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: File<br>方法 or 属性: lock(exclusive?: boolean): Promise\<void>;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: File<br>方法 or 属性: lock(callback: AsyncCallback\<void>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: File<br>方法 or 属性: lock(exclusive: boolean, callback: AsyncCallback\<void>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: File<br>方法 or 属性: tryLock(exclusive?: boolean): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: File<br>方法 or 属性: unlock(): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stat|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stat<br>方法 or 属性: readonly ino: bigint;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stat<br>方法 or 属性: readonly mode: number;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stat<br>方法 or 属性: readonly uid: number;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stat<br>方法 or 属性: readonly gid: number;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stat<br>方法 or 属性: readonly size: number;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stat<br>方法 or 属性: readonly atime: number;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stat<br>方法 or 属性: readonly mtime: number;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stat<br>方法 or 属性: readonly ctime: number;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stat<br>方法 or 属性: isBlockDevice(): boolean;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stat<br>方法 or 属性: isCharacterDevice(): boolean;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stat<br>方法 or 属性: isDirectory(): boolean;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stat<br>方法 or 属性: isFIFO(): boolean;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stat<br>方法 or 属性: isFile(): boolean;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stat<br>方法 or 属性: isSocket(): boolean;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stat<br>方法 or 属性: isSymbolicLink(): boolean;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stream|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stream<br>方法 or 属性: close(): Promise\<void>;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stream<br>方法 or 属性: close(callback: AsyncCallback\<void>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stream<br>方法 or 属性: closeSync(): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stream<br>方法 or 属性: flush(): Promise\<void>;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stream<br>方法 or 属性: flush(callback: AsyncCallback\<void>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stream<br>方法 or 属性: flushSync(): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stream<br>方法 or 属性: write(buffer: ArrayBuffer \| string, options?: {<br> offset?: number;<br> length?: number;<br> encoding?: string;<br> }): Promise\<number>;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stream<br>方法 or 属性: write(buffer: ArrayBuffer \| string, callback: AsyncCallback\<number>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stream<br>方法 or 属性: write(buffer: ArrayBuffer \| string, options: {<br> offset?: number;<br> length?: number;<br> encoding?: string;<br> }, callback: AsyncCallback\<number>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stream<br>方法 or 属性: writeSync(buffer: ArrayBuffer \| string, options?: {<br> offset?: number;<br> length?: number;<br> encoding?: string;<br> }): number;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stream<br>方法 or 属性: read(buffer: ArrayBuffer, options?: {<br> offset?: number;<br> length?: number;<br> }): Promise\<number>;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stream<br>方法 or 属性: read(buffer: ArrayBuffer, callback: AsyncCallback\<number>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stream<br>方法 or 属性: read(buffer: ArrayBuffer, options: {<br> offset?: number;<br> length?: number;<br> }, callback: AsyncCallback\<number>): void;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.fs<br>类名: Stream<br>方法 or 属性: readSync(buffer: ArrayBuffer, options?: {<br> offset?: number;<br> length?: number;<br> }): number;|@ohos.file.fs.d.ts| +|新增|NA|模块名: ohos.file.hash<br>类名: hash|@ohos.file.hash.d.ts| +|新增|NA|模块名: ohos.file.hash<br>类名: hash<br>方法 or 属性: function hash(path: string, algorithm: string): Promise\<string>;|@ohos.file.hash.d.ts| +|新增|NA|模块名: ohos.file.hash<br>类名: hash<br>方法 or 属性: function hash(path: string, algorithm: string, callback: AsyncCallback\<string>): void;|@ohos.file.hash.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: picker|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoViewMIMETypes|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoViewMIMETypes<br>方法 or 属性: IMAGE_TYPE = "image/*"|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoViewMIMETypes<br>方法 or 属性: VIDEO_TYPE = "video/*"|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoViewMIMETypes<br>方法 or 属性: IMAGE_VIDEO_TYPE = "*/*"|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoSelectOptions|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoSelectOptions<br>方法 or 属性: MIMEType?: PhotoViewMIMETypes;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoSelectOptions<br>方法 or 属性: maxSelectNumber?: number;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoSelectResult|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoSelectResult<br>方法 or 属性: photoUris: Array\<string>;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoSelectResult<br>方法 or 属性: isOriginalPhoto: boolean;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoSaveOptions|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoSaveOptions<br>方法 or 属性: newFileNames?: Array\<string>;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoViewPicker|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoViewPicker<br>方法 or 属性: select(option?: PhotoSelectOptions) : Promise\<PhotoSelectResult>;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoViewPicker<br>方法 or 属性: select(option: PhotoSelectOptions, callback: AsyncCallback\<PhotoSelectResult>) : void;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoViewPicker<br>方法 or 属性: select(callback: AsyncCallback\<PhotoSelectResult>) : void;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoViewPicker<br>方法 or 属性: save(option?: PhotoSaveOptions) : Promise\<Array\<string>>;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoViewPicker<br>方法 or 属性: save(option: PhotoSaveOptions, callback: AsyncCallback\<Array\<string>>) : void;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: PhotoViewPicker<br>方法 or 属性: save(callback: AsyncCallback\<Array\<string>>) : void;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: DocumentSelectOptions|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: DocumentSaveOptions|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: DocumentSaveOptions<br>方法 or 属性: newFileNames?: Array\<string>;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: DocumentViewPicker|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: DocumentViewPicker<br>方法 or 属性: select(option?: DocumentSelectOptions) : Promise\<Array\<string>>;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: DocumentViewPicker<br>方法 or 属性: select(option: DocumentSelectOptions, callback: AsyncCallback\<Array\<string>>) : void;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: DocumentViewPicker<br>方法 or 属性: select(callback: AsyncCallback\<Array\<string>>) : void;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: DocumentViewPicker<br>方法 or 属性: save(option?: DocumentSaveOptions) : Promise\<Array\<string>>;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: DocumentViewPicker<br>方法 or 属性: save(option: DocumentSaveOptions, callback: AsyncCallback\<Array\<string>>) : void;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: DocumentViewPicker<br>方法 or 属性: save(callback: AsyncCallback\<Array\<string>>) : void;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: AudioSelectOptions|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: AudioSaveOptions|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: AudioSaveOptions<br>方法 or 属性: newFileNames?: Array\<string>;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: AudioViewPicker|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: AudioViewPicker<br>方法 or 属性: select(option?: AudioSelectOptions) : Promise\<Array\<string>>;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: AudioViewPicker<br>方法 or 属性: select(option: AudioSelectOptions, callback: AsyncCallback\<Array\<string>>) : void;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: AudioViewPicker<br>方法 or 属性: select(callback: AsyncCallback\<Array\<string>>) : void;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: AudioViewPicker<br>方法 or 属性: save(option?: AudioSaveOptions) : Promise\<Array\<string>>;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: AudioViewPicker<br>方法 or 属性: save(option: AudioSaveOptions, callback: AsyncCallback\<Array\<string>>) : void;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.picker<br>类名: AudioViewPicker<br>方法 or 属性: save(callback: AsyncCallback\<Array\<string>>) : void;|@ohos.file.picker.d.ts| +|新增|NA|模块名: ohos.file.securityLabel<br>类名: securityLabel|@ohos.file.securityLabel.d.ts| +|新增|NA|模块名: ohos.file.securityLabel<br>类名: DataLevel<br>方法 or 属性: type DataLevel = 's0'\|'s1'\|'s2'\|'s3'\|'s4';|@ohos.file.securityLabel.d.ts| +|新增|NA|模块名: ohos.file.securityLabel<br>类名: DataLevel<br>方法 or 属性: type DataLevel = 's0'\|'s1'\|'s2'\|'s3'\|'s4';|@ohos.file.securityLabel.d.ts| +|新增|NA|模块名: ohos.file.securityLabel<br>类名: DataLevel<br>方法 or 属性: type DataLevel = 's0'\|'s1'\|'s2'\|'s3'\|'s4';|@ohos.file.securityLabel.d.ts| +|新增|NA|模块名: ohos.file.securityLabel<br>类名: DataLevel<br>方法 or 属性: type DataLevel = 's0'\|'s1'\|'s2'\|'s3'\|'s4';|@ohos.file.securityLabel.d.ts| +|新增|NA|模块名: ohos.file.securityLabel<br>类名: DataLevel<br>方法 or 属性: type DataLevel = 's0'\|'s1'\|'s2'\|'s3'\|'s4';|@ohos.file.securityLabel.d.ts| +|新增|NA|模块名: ohos.file.securityLabel<br>类名: securityLabel<br>方法 or 属性: function setSecurityLabel(path: string, type: DataLevel): Promise\<void>;|@ohos.file.securityLabel.d.ts| +|新增|NA|模块名: ohos.file.securityLabel<br>类名: securityLabel<br>方法 or 属性: function setSecurityLabel(path: string, type: DataLevel, callback: AsyncCallback\<void>): void;|@ohos.file.securityLabel.d.ts| +|新增|NA|模块名: ohos.file.securityLabel<br>类名: securityLabel<br>方法 or 属性: function setSecurityLabelSync(path: string, type: DataLevel): void;|@ohos.file.securityLabel.d.ts| +|新增|NA|模块名: ohos.file.securityLabel<br>类名: securityLabel<br>方法 or 属性: function getSecurityLabel(path: string): Promise\<string>;|@ohos.file.securityLabel.d.ts| +|新增|NA|模块名: ohos.file.securityLabel<br>类名: securityLabel<br>方法 or 属性: function getSecurityLabel(path: string, callback: AsyncCallback\<string>): void;|@ohos.file.securityLabel.d.ts| +|新增|NA|模块名: ohos.file.securityLabel<br>类名: securityLabel<br>方法 or 属性: function getSecurityLabelSync(path: string): string;|@ohos.file.securityLabel.d.ts| +|新增|NA|模块名: ohos.file.statvfs<br>类名: statfs|@ohos.file.statvfs.d.ts| +|新增|NA|模块名: ohos.file.statvfs<br>类名: statfs<br>方法 or 属性: function getFreeSize(path: string): Promise\<number>;|@ohos.file.statvfs.d.ts| +|新增|NA|模块名: ohos.file.statvfs<br>类名: statfs<br>方法 or 属性: function getFreeSize(path: string, callback: AsyncCallback\<number>): void;|@ohos.file.statvfs.d.ts| +|新增|NA|模块名: ohos.file.statvfs<br>类名: statfs<br>方法 or 属性: function getTotalSize(path: string): Promise\<number>;|@ohos.file.statvfs.d.ts| +|新增|NA|模块名: ohos.file.statvfs<br>类名: statfs<br>方法 or 属性: function getTotalSize(path: string, callback: AsyncCallback\<number>): void;|@ohos.file.statvfs.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getTotalSizeOfVolume(volumeUuid: string, callback: AsyncCallback\<number>): void;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getTotalSizeOfVolume(volumeUuid: string): Promise\<number>;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getFreeSizeOfVolume(volumeUuid: string, callback: AsyncCallback\<number>): void;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getFreeSizeOfVolume(volumeUuid: string): Promise\<number>;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: BundleStats|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: BundleStats<br>方法 or 属性: appSize: number;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: BundleStats<br>方法 or 属性: cacheSize: number;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: BundleStats<br>方法 or 属性: dataSize: number;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getBundleStats(packageName: string, callback: AsyncCallback\<BundleStats>): void;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getBundleStats(packageName: string): Promise\<BundleStats>;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getCurrentBundleStats(callback: AsyncCallback\<BundleStats>): void;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getCurrentBundleStats(): Promise\<BundleStats>;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getSystemSize(callback: AsyncCallback\<number>): void;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getSystemSize(): Promise\<number>;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: StorageStats|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: StorageStats<br>方法 or 属性: total: number;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: StorageStats<br>方法 or 属性: audio: number;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: StorageStats<br>方法 or 属性: video: number;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: StorageStats<br>方法 or 属性: image: number;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: StorageStats<br>方法 or 属性: file: number;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: StorageStats<br>方法 or 属性: app: number;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getUserStorageStats(): Promise\<StorageStats>;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getUserStorageStats(callback: AsyncCallback\<StorageStats>): void;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getUserStorageStats(userId: number): Promise\<StorageStats>;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getUserStorageStats(userId: number, callback: AsyncCallback\<StorageStats>): void;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getTotalSize(callback: AsyncCallback\<number>): void;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getTotalSize(): Promise\<number>;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getFreeSize(callback: AsyncCallback\<number>): void;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.storageStatistics<br>类名: storageStatistics<br>方法 or 属性: function getFreeSize(): Promise\<number>;|@ohos.file.storageStatistics.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: Volume|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: Volume<br>方法 or 属性: id: string;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: Volume<br>方法 or 属性: uuid: string;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: Volume<br>方法 or 属性: diskId: string;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: Volume<br>方法 or 属性: description: string;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: Volume<br>方法 or 属性: removable: boolean;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: Volume<br>方法 or 属性: state: number;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: Volume<br>方法 or 属性: path: string;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function getAllVolumes(callback: AsyncCallback\<Array\<Volume>>): void;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function getAllVolumes(): Promise\<Array\<Volume>>;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function mount(volumeId: string, callback: AsyncCallback\<void>): void;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function mount(volumeId: string): Promise\<void>;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function unmount(volumeId: string, callback: AsyncCallback\<void>): void;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function unmount(volumeId: string): Promise\<void>;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function getVolumeByUuid(uuid: string, callback: AsyncCallback\<Volume>): void;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function getVolumeByUuid(uuid: string): Promise\<Volume>;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function getVolumeById(volumeId: string, callback: AsyncCallback\<Volume>): void;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function getVolumeById(volumeId: string): Promise\<Volume>;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function setVolumeDescription(uuid: string, description: string, callback: AsyncCallback\<void>): void;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function setVolumeDescription(uuid: string, description: string): Promise\<void>;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function format(volumeId: string, fsType: string, callback: AsyncCallback\<void>): void;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function format(volumeId: string, fsType: string): Promise\<void>;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function partition(diskId: string, type: number, callback: AsyncCallback\<void>): void;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.file.volumeManager<br>类名: volumeManager<br>方法 or 属性: function partition(diskId: string, type: number): Promise\<void>;|@ohos.file.volumeManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: userFileManager|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: ChangeEvent<br>方法 or 属性: type ChangeEvent = 'deviceChange' \| 'albumChange' \| 'imageChange' \| 'audioChange' \| 'videoChange' \| 'remoteFileChange';|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: ChangeEvent<br>方法 or 属性: type ChangeEvent = 'deviceChange' \| 'albumChange' \| 'imageChange' \| 'audioChange' \| 'videoChange' \| 'remoteFileChange';|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: ChangeEvent<br>方法 or 属性: type ChangeEvent = 'deviceChange' \| 'albumChange' \| 'imageChange' \| 'audioChange' \| 'videoChange' \| 'remoteFileChange';|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: ChangeEvent<br>方法 or 属性: type ChangeEvent = 'deviceChange' \| 'albumChange' \| 'imageChange' \| 'audioChange' \| 'videoChange' \| 'remoteFileChange';|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: ChangeEvent<br>方法 or 属性: type ChangeEvent = 'deviceChange' \| 'albumChange' \| 'imageChange' \| 'audioChange' \| 'videoChange' \| 'remoteFileChange';|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: ChangeEvent<br>方法 or 属性: type ChangeEvent = 'deviceChange' \| 'albumChange' \| 'imageChange' \| 'audioChange' \| 'videoChange' \| 'remoteFileChange';|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: userFileManager<br>方法 or 属性: function getUserFileMgr(context: Context): UserFileManager;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FileType|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FileType<br>方法 or 属性: IMAGE = 1|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FileType<br>方法 or 属性: VIDEO|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FileType<br>方法 or 属性: AUDIO|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FileAsset|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FileAsset<br>方法 or 属性: readonly uri: string;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FileAsset<br>方法 or 属性: readonly fileType: FileType;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FileAsset<br>方法 or 属性: displayName: string;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FileAsset<br>方法 or 属性: get(member: string): MemberType;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FileAsset<br>方法 or 属性: set(member: string, value: string): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FileAsset<br>方法 or 属性: commitModify(callback: AsyncCallback\<void>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FileAsset<br>方法 or 属性: commitModify(): Promise\<void>;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FileAsset<br>方法 or 属性: open(mode: string, callback: AsyncCallback\<number>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FileAsset<br>方法 or 属性: open(mode: string): Promise\<number>;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FileAsset<br>方法 or 属性: close(fd: number, callback: AsyncCallback\<void>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FileAsset<br>方法 or 属性: close(fd: number): Promise\<void>;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FileAsset<br>方法 or 属性: getThumbnail(callback: AsyncCallback\<image.PixelMap>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FileAsset<br>方法 or 属性: getThumbnail(size: image.Size, callback: AsyncCallback\<image.PixelMap>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FileAsset<br>方法 or 属性: getThumbnail(size?: image.Size): Promise\<image.PixelMap>;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FileAsset<br>方法 or 属性: favorite(isFavorite: boolean, callback: AsyncCallback\<void>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FileAsset<br>方法 or 属性: favorite(isFavorite: boolean): Promise\<void>;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: AudioKey|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: AudioKey<br>方法 or 属性: URI|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: AudioKey<br>方法 or 属性: DISPLAY_NAME|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: AudioKey<br>方法 or 属性: DATE_ADDED|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: AudioKey<br>方法 or 属性: DATE_MODIFIED|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: AudioKey<br>方法 or 属性: TITLE|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: AudioKey<br>方法 or 属性: ARTIST|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: AudioKey<br>方法 or 属性: AUDIOALBUM|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: AudioKey<br>方法 or 属性: DURATION|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: AudioKey<br>方法 or 属性: FAVORITE|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: ImageVideoKey|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: ImageVideoKey<br>方法 or 属性: URI|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: ImageVideoKey<br>方法 or 属性: FILE_TYPE|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: ImageVideoKey<br>方法 or 属性: DISPLAY_NAME|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: ImageVideoKey<br>方法 or 属性: DATE_ADDED|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: ImageVideoKey<br>方法 or 属性: DATE_MODIFIED|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: ImageVideoKey<br>方法 or 属性: TITLE|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: ImageVideoKey<br>方法 or 属性: DURATION|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: ImageVideoKey<br>方法 or 属性: WIDTH|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: ImageVideoKey<br>方法 or 属性: HEIGHT|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: ImageVideoKey<br>方法 or 属性: DATE_TAKEN|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: ImageVideoKey<br>方法 or 属性: ORIENTATION|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: ImageVideoKey<br>方法 or 属性: FAVORITE|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: AlbumKey|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: AlbumKey<br>方法 or 属性: URI|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: AlbumKey<br>方法 or 属性: FILE_TYPE|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: AlbumKey<br>方法 or 属性: ALBUM_NAME|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: AlbumKey<br>方法 or 属性: DATE_ADDED|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: AlbumKey<br>方法 or 属性: DATE_MODIFIED|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FetchOptions|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FetchOptions<br>方法 or 属性: fetchColumns: Array\<string>;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FetchOptions<br>方法 or 属性: predicates: dataSharePredicates.DataSharePredicates;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: AlbumFetchOptions|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: AlbumFetchOptions<br>方法 or 属性: predicates: dataSharePredicates.DataSharePredicates;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FetchResult|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FetchResult<br>方法 or 属性: getCount(): number;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FetchResult<br>方法 or 属性: isAfterLast(): boolean;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FetchResult<br>方法 or 属性: close(): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FetchResult<br>方法 or 属性: getFirstObject(callback: AsyncCallback\<T>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FetchResult<br>方法 or 属性: getFirstObject(): Promise\<T>;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FetchResult<br>方法 or 属性: getNextObject(callback: AsyncCallback\<T>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FetchResult<br>方法 or 属性: getNextObject(): Promise\<T>;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FetchResult<br>方法 or 属性: getLastObject(callback: AsyncCallback\<T>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FetchResult<br>方法 or 属性: getLastObject(): Promise\<T>;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FetchResult<br>方法 or 属性: getPositionObject(index: number, callback: AsyncCallback\<T>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: FetchResult<br>方法 or 属性: getPositionObject(index: number): Promise\<T>;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: AbsAlbum|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: AbsAlbum<br>方法 or 属性: albumName: string;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: AbsAlbum<br>方法 or 属性: readonly albumUri: string;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: AbsAlbum<br>方法 or 属性: readonly dateModified: number;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: AbsAlbum<br>方法 or 属性: readonly count: number;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: AbsAlbum<br>方法 or 属性: readonly coverUri: string;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: AbsAlbum<br>方法 or 属性: getPhotoAssets(options: FetchOptions, callback: AsyncCallback\<FetchResult\<FileAsset>>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: AbsAlbum<br>方法 or 属性: getPhotoAssets(options: FetchOptions): Promise\<FetchResult\<FileAsset>>;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: Album|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: Album<br>方法 or 属性: commitModify(callback: AsyncCallback\<void>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: Album<br>方法 or 属性: commitModify(): Promise\<void>;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: getPhotoAssets(options: FetchOptions, callback: AsyncCallback\<FetchResult\<FileAsset>>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: getPhotoAssets(options: FetchOptions): Promise\<FetchResult\<FileAsset>>;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: createPhotoAsset(displayName: string, albumUri: string, callback: AsyncCallback\<FileAsset>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: createPhotoAsset(displayName: string, callback: AsyncCallback\<FileAsset>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: createPhotoAsset(displayName: string, albumUri?: string): Promise\<FileAsset>;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: getPhotoAlbums(options: AlbumFetchOptions, callback: AsyncCallback\<FetchResult\<Album>>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: getPhotoAlbums(options: AlbumFetchOptions): Promise\<FetchResult\<Album>>;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: getPrivateAlbum(type: PrivateAlbumType, callback: AsyncCallback\<FetchResult\<PrivateAlbum>>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: getPrivateAlbum(type: PrivateAlbumType): Promise\<FetchResult\<PrivateAlbum>>;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: getAudioAssets(options: FetchOptions, callback: AsyncCallback\<FetchResult\<FileAsset>>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: getAudioAssets(options: FetchOptions): Promise\<FetchResult\<FileAsset>>;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: delete(uri: string, callback: AsyncCallback\<void>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: delete(uri: string): Promise\<void>;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: on(type: ChangeEvent, callback: Callback\<void>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: on(type: ChangeEvent, callback: Callback\<void>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: on(type: ChangeEvent, callback: Callback\<void>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: on(type: ChangeEvent, callback: Callback\<void>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: on(type: ChangeEvent, callback: Callback\<void>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: on(type: ChangeEvent, callback: Callback\<void>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: off(type: ChangeEvent, callback?: Callback\<void>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: off(type: ChangeEvent, callback?: Callback\<void>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: off(type: ChangeEvent, callback?: Callback\<void>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: off(type: ChangeEvent, callback?: Callback\<void>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: off(type: ChangeEvent, callback?: Callback\<void>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: off(type: ChangeEvent, callback?: Callback\<void>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: getActivePeers(callback: AsyncCallback\<Array\<PeerInfo>>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: getActivePeers(): Promise\<Array\<PeerInfo>>;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: getAllPeers(callback: AsyncCallback\<Array\<PeerInfo>>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: getAllPeers(): Promise\<Array\<PeerInfo>>;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: release(callback: AsyncCallback\<void>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: UserFileManager<br>方法 or 属性: release(): Promise\<void>;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: PeerInfo|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: PeerInfo<br>方法 or 属性: readonly deviceName: string;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: PeerInfo<br>方法 or 属性: readonly networkId: string;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: PeerInfo<br>方法 or 属性: readonly isOnline: boolean;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: PrivateAlbumType|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: PrivateAlbumType<br>方法 or 属性: TYPE_FAVORITE|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: PrivateAlbumType<br>方法 or 属性: TYPE_TRASH|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: PrivateAlbum|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: PrivateAlbum<br>方法 or 属性: delete(uri: string, callback: AsyncCallback\<void>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: PrivateAlbum<br>方法 or 属性: delete(uri: string): Promise\<void>;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: PrivateAlbum<br>方法 or 属性: recover(uri: string, callback: AsyncCallback\<void>): void;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.filemanagement.userFileManager<br>类名: PrivateAlbum<br>方法 or 属性: recover(uri: string): Promise\<void>;|@ohos.filemanagement.userFileManager.d.ts| +|新增|NA|模块名: ohos.fileshare<br>类名: fileShare|@ohos.fileshare.d.ts| +|新增|NA|模块名: ohos.fileshare<br>类名: fileShare<br>方法 or 属性: function grantUriPermission(uri: string, bundleName: string, flag: wantConstant.Flags, callback: AsyncCallback\<void>): void;|@ohos.fileshare.d.ts| +|新增|NA|模块名: ohos.fileshare<br>类名: fileShare<br>方法 or 属性: function grantUriPermission(uri: string, bundleName: string, flag: wantConstant.Flags): Promise\<void>;|@ohos.fileshare.d.ts| +|删除|模块名: ohos.environment<br>类名: Environment|NA|@ohos.environment.d.ts| +|删除|模块名: ohos.environment<br>类名: Environment<br>方法 or 属性:function getStorageDataDir(callback: AsyncCallback\<string>): void;|NA|@ohos.environment.d.ts| +|删除|模块名: ohos.environment<br>类名: Environment<br>方法 or 属性:function getStorageDataDir(): Promise\<string>;|NA|@ohos.environment.d.ts| +|删除|模块名: ohos.environment<br>类名: Environment<br>方法 or 属性:function getUserDataDir(callback: AsyncCallback\<string>): void;|NA|@ohos.environment.d.ts| +|删除|模块名: ohos.environment<br>类名: Environment<br>方法 or 属性:function getUserDataDir(): Promise\<string>;|NA|@ohos.environment.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: storageStatistics|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: storageStatistics<br>方法 or 属性:function getTotalSizeOfVolume(volumeUuid: string, callback: AsyncCallback\<number>): void;|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: storageStatistics<br>方法 or 属性:function getTotalSizeOfVolume(volumeUuid: string): Promise\<number>;|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: storageStatistics<br>方法 or 属性:function getFreeSizeOfVolume(volumeUuid: string, callback: AsyncCallback\<number>): void;|NA|@ohos.storageStatistics.d.ts| +|删除|模块名: ohos.storageStatistics<br>类名: storageStatistics<br>方法 or 属性:function getFreeSizeOfVolume(volumeUuid: string): Promise\<number>;|NA|@ohos.storageStatistics.d.ts| +|废弃版本有变化|类名:document<br>方法 or 属性:function choose(types?: string[]): Promise\<string>;<br>废弃版本:N/A|类名:document<br>方法 or 属性:function choose(types?: string[]): Promise\<string>;<br>废弃版本:9<br>代替接口:N/A|@ohos.document.d.ts| +|废弃版本有变化|类名:document<br>方法 or 属性:function choose(callback: AsyncCallback\<string>): void;<br>废弃版本:N/A|类名:document<br>方法 or 属性:function choose(callback: AsyncCallback\<string>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.document.d.ts| +|废弃版本有变化|类名:document<br>方法 or 属性:function choose(types: string[], callback: AsyncCallback\<string>): void;<br>废弃版本:N/A|类名:document<br>方法 or 属性:function choose(types: string[], callback: AsyncCallback\<string>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.document.d.ts| +|废弃版本有变化|类名:document<br>方法 or 属性:function show(uri: string, type: string): Promise\<void>;<br>废弃版本:N/A|类名:document<br>方法 or 属性:function show(uri: string, type: string): Promise\<void>;<br>废弃版本:9<br>代替接口:N/A|@ohos.document.d.ts| +|废弃版本有变化|类名:document<br>方法 or 属性:function show(uri: string, type: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:document<br>方法 or 属性:function show(uri: string, type: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.document.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function access(path: string, mode?: number): Promise\<void>;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function access(path: string, mode?: number): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.file.fs.access |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function access(path: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function access(path: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.access |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function access(path: string, mode: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function access(path: string, mode: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.access |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function accessSync(path: string, mode?: number): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function accessSync(path: string, mode?: number): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.accessSync |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function close(fd: number): Promise\<void>;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function close(fd: number): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.file.fs.close |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function close(fd: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function close(fd: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.close |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function closeSync(fd: number): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function closeSync(fd: number): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.closeSync |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function copyFile(src: string \| number, dest: string \| number, mode?: number): Promise\<void>;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function copyFile(src: string \| number, dest: string \| number, mode?: number): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.file.fs.copyFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function copyFile(src: string \| number, dest: string \| number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function copyFile(src: string \| number, dest: string \| number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.copyFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function copyFile(src: string \| number, dest: string \| number, mode: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function copyFile(src: string \| number, dest: string \| number, mode: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.copyFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function copyFileSync(src: string \| number, dest: string \| number, mode?: number): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function copyFileSync(src: string \| number, dest: string \| number, mode?: number): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.copyFileSync |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function createStream(path: string, mode: string): Promise\<Stream>;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function createStream(path: string, mode: string): Promise\<Stream>;<br>废弃版本:9<br>代替接口:ohos.file.fs.createStream |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function createStream(path: string, mode: string, callback: AsyncCallback\<Stream>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function createStream(path: string, mode: string, callback: AsyncCallback\<Stream>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.createStream |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function createStreamSync(path: string, mode: string): Stream;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function createStreamSync(path: string, mode: string): Stream;<br>废弃版本:9<br>代替接口:ohos.file.fs.createStreamSync |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function chown(path: string, uid: number, gid: number): Promise\<void>;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function chown(path: string, uid: number, gid: number): Promise\<void>;<br>废弃版本:9<br>代替接口:N/A|@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function chown(path: string, uid: number, gid: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function chown(path: string, uid: number, gid: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function chownSync(path: string, uid: number, gid: number): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function chownSync(path: string, uid: number, gid: number): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function chmod(path: string, mode: number): Promise\<void>;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function chmod(path: string, mode: number): Promise\<void>;<br>废弃版本:9<br>代替接口:N/A|@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function chmod(path: string, mode: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function chmod(path: string, mode: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function chmodSync(path: string, mode: number): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function chmodSync(path: string, mode: number): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function ftruncate(fd: number, len?: number): Promise\<void>;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function ftruncate(fd: number, len?: number): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.file.fs.truncate |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function ftruncate(fd: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function ftruncate(fd: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.truncate |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function ftruncate(fd: number, len: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function ftruncate(fd: number, len: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.truncate |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function ftruncateSync(fd: number, len?: number): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function ftruncateSync(fd: number, len?: number): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.truncateSync |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function fsync(fd: number): Promise\<void>;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function fsync(fd: number): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.file.fs.fsync |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function fsync(fd: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function fsync(fd: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.fsync |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function fsyncSync(fd: number): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function fsyncSync(fd: number): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.fsyncSync |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function fstat(fd: number): Promise\<Stat>;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function fstat(fd: number): Promise\<Stat>;<br>废弃版本:9<br>代替接口:ohos.file.fs.stat |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function fstat(fd: number, callback: AsyncCallback\<Stat>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function fstat(fd: number, callback: AsyncCallback\<Stat>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.stat |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function fstatSync(fd: number): Stat;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function fstatSync(fd: number): Stat;<br>废弃版本:9<br>代替接口:ohos.file.fs.statSync |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function fdatasync(fd: number): Promise\<void>;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function fdatasync(fd: number): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.file.fs.fdatasync |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function fdatasync(fd: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function fdatasync(fd: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.fdatasync |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function fdatasyncSync(fd: number): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function fdatasyncSync(fd: number): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.fdatasyncSync |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function fchown(fd: number, uid: number, gid: number): Promise\<void>;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function fchown(fd: number, uid: number, gid: number): Promise\<void>;<br>废弃版本:9<br>代替接口:N/A|@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function fchown(fd: number, uid: number, gid: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function fchown(fd: number, uid: number, gid: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function fchownSync(fd: number, uid: number, gid: number): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function fchownSync(fd: number, uid: number, gid: number): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function fchmod(fd: number, mode: number): Promise\<void>;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function fchmod(fd: number, mode: number): Promise\<void>;<br>废弃版本:9<br>代替接口:N/A|@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function fchmod(fd: number, mode: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function fchmod(fd: number, mode: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function fchmodSync(fd: number, mode: number): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function fchmodSync(fd: number, mode: number): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function fdopenStream(fd: number, mode: string): Promise\<Stream>;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function fdopenStream(fd: number, mode: string): Promise\<Stream>;<br>废弃版本:9<br>代替接口:ohos.file.fs.fdopenStream |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function fdopenStream(fd: number, mode: string, callback: AsyncCallback\<Stream>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function fdopenStream(fd: number, mode: string, callback: AsyncCallback\<Stream>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.fdopenStream |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function fdopenStreamSync(fd: number, mode: string): Stream;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function fdopenStreamSync(fd: number, mode: string): Stream;<br>废弃版本:9<br>代替接口:ohos.file.fs.fdopenStreamSync |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function hash(path: string, algorithm: string): Promise\<string>;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function hash(path: string, algorithm: string): Promise\<string>;<br>废弃版本:9<br>代替接口:ohos.file.hash.hash |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function hash(path: string, algorithm: string, callback: AsyncCallback\<string>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function hash(path: string, algorithm: string, callback: AsyncCallback\<string>): void;<br>废弃版本:9<br>代替接口:ohos.file.hash.hash |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function lchown(path: string, uid: number, gid: number): Promise\<void>;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function lchown(path: string, uid: number, gid: number): Promise\<void>;<br>废弃版本:9<br>代替接口:N/A|@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function lchown(path: string, uid: number, gid: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function lchown(path: string, uid: number, gid: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function lchownSync(path: string, uid: number, gid: number): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function lchownSync(path: string, uid: number, gid: number): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function lstat(path: string): Promise\<Stat>;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function lstat(path: string): Promise\<Stat>;<br>废弃版本:9<br>代替接口:ohos.file.fs.lstat |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function lstat(path: string, callback: AsyncCallback\<Stat>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function lstat(path: string, callback: AsyncCallback\<Stat>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.lstat |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function lstatSync(path: string): Stat;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function lstatSync(path: string): Stat;<br>废弃版本:9<br>代替接口:ohos.file.fs.lstatSync |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function mkdir(path: string, mode?: number): Promise\<void>;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function mkdir(path: string, mode?: number): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.file.fs.mkdir |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function mkdir(path: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function mkdir(path: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.mkdir |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function mkdir(path: string, mode: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function mkdir(path: string, mode: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.mkdir |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function mkdirSync(path: string, mode?: number): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function mkdirSync(path: string, mode?: number): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.mkdirSync |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function mkdtemp(prefix: string): Promise\<string>;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function mkdtemp(prefix: string): Promise\<string>;<br>废弃版本:9<br>代替接口:ohos.file.fs.mkdtemp |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function mkdtemp(prefix: string, callback: AsyncCallback\<string>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function mkdtemp(prefix: string, callback: AsyncCallback\<string>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.mkdtemp |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function mkdtempSync(prefix: string): string;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function mkdtempSync(prefix: string): string;<br>废弃版本:9<br>代替接口:ohos.file.fs.mkdtempSync |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function open(path: string, flags?: number, mode?: number): Promise\<number>;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function open(path: string, flags?: number, mode?: number): Promise\<number>;<br>废弃版本:9<br>代替接口:ohos.file.fs.open |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function open(path: string, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function open(path: string, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.open |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function open(path: string, flags: number, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function open(path: string, flags: number, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.open |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function open(path: string, flags: number, mode: number, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function open(path: string, flags: number, mode: number, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.open |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function openSync(path: string, flags?: number, mode?: number): number;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function openSync(path: string, flags?: number, mode?: number): number;<br>废弃版本:9<br>代替接口:ohos.file.fs.openSync |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function opendir(path: string): Promise\<Dir>;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function opendir(path: string): Promise\<Dir>;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function opendir(path: string, callback: AsyncCallback\<Dir>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function opendir(path: string, callback: AsyncCallback\<Dir>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function opendirSync(path: string): Dir;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function opendirSync(path: string): Dir;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function readText(filePath: string, options?: {<br> position?: number;<br> length?: number;<br> encoding?: string;<br>}): Promise\<string>;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function readText(filePath: string, options?: {<br> position?: number;<br> length?: number;<br> encoding?: string;<br>}): Promise\<string>;<br>废弃版本:9<br>代替接口:ohos.file.fs.readText |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function readText(filePath: string, options: {<br> position?: number;<br> length?: number;<br> encoding?: string;<br>}, callback: AsyncCallback\<string>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function readText(filePath: string, options: {<br> position?: number;<br> length?: number;<br> encoding?: string;<br>}, callback: AsyncCallback\<string>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.readText |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function readTextSync(filePath: string, options?: {<br> position?: number;<br> length?: number;<br> encoding?: string;<br>}): string;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function readTextSync(filePath: string, options?: {<br> position?: number;<br> length?: number;<br> encoding?: string;<br>}): string;<br>废弃版本:9<br>代替接口:ohos.file.fs.readTextSync |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function read(fd: number, buffer: ArrayBuffer, options?: {<br> offset?: number;<br> length?: number;<br> position?: number;<br>}): Promise\<ReadOut><br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function read(fd: number, buffer: ArrayBuffer, options?: {<br> offset?: number;<br> length?: number;<br> position?: number;<br>}): Promise\<ReadOut><br>废弃版本:9<br>代替接口:ohos.file.fs.read |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function read(fd: number, buffer: ArrayBuffer, callback: AsyncCallback\<ReadOut>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function read(fd: number, buffer: ArrayBuffer, callback: AsyncCallback\<ReadOut>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.read |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function read(fd: number, buffer: ArrayBuffer, options: {<br> offset?: number;<br> length?: number;<br> position?: number;<br>}, callback: AsyncCallback\<ReadOut>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function read(fd: number, buffer: ArrayBuffer, options: {<br> offset?: number;<br> length?: number;<br> position?: number;<br>}, callback: AsyncCallback\<ReadOut>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.read |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function readSync(fd: number, buffer: ArrayBuffer, options?: {<br> offset?: number;<br> length?: number;<br> position?: number;<br>}): number;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function readSync(fd: number, buffer: ArrayBuffer, options?: {<br> offset?: number;<br> length?: number;<br> position?: number;<br>}): number;<br>废弃版本:9<br>代替接口:ohos.file.fs.readSync |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function rename(oldPath: string, newPath: string): Promise\<void>;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function rename(oldPath: string, newPath: string): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.file.fs.rename |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function rename(oldPath: string, newPath: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function rename(oldPath: string, newPath: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.rename |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function renameSync(oldPath: string, newPath: string): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function renameSync(oldPath: string, newPath: string): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.renameSync |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function rmdir(path: string): Promise\<void>;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function rmdir(path: string): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.file.fs.rmdir |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function rmdir(path: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function rmdir(path: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.rmdir |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function rmdirSync(path: string): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function rmdirSync(path: string): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.rmdirSync |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function stat(path: string): Promise\<Stat>;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function stat(path: string): Promise\<Stat>;<br>废弃版本:9<br>代替接口:ohos.file.fs.stat |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function stat(path: string, callback: AsyncCallback\<Stat>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function stat(path: string, callback: AsyncCallback\<Stat>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.stat |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function statSync(path: string): Stat;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function statSync(path: string): Stat;<br>废弃版本:9<br>代替接口:ohos.file.fs.statSync |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function symlink(target: string, srcPath: string): Promise\<void>;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function symlink(target: string, srcPath: string): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.file.fs.symlink |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function symlink(target: string, srcPath: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function symlink(target: string, srcPath: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.symlink |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function symlinkSync(target: string, srcPath: string): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function symlinkSync(target: string, srcPath: string): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.symlinkSync |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function truncate(path: string, len?: number): Promise\<void>;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function truncate(path: string, len?: number): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.file.fs.truncate |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function truncate(path: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function truncate(path: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.truncate |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function truncate(path: string, len: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function truncate(path: string, len: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.truncate |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function truncateSync(path: string, len?: number): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function truncateSync(path: string, len?: number): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.truncateSync |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function unlink(path: string): Promise\<void>;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function unlink(path: string): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.file.fs.unlink |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function unlink(path: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function unlink(path: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.unlink |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function unlinkSync(path: string): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function unlinkSync(path: string): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.unlinkSync |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function write(fd: number, buffer: ArrayBuffer \| string, options?: {<br> offset?: number;<br> length?: number;<br> position?: number;<br> encoding?: string;<br>}): Promise\<number>;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function write(fd: number, buffer: ArrayBuffer \| string, options?: {<br> offset?: number;<br> length?: number;<br> position?: number;<br> encoding?: string;<br>}): Promise\<number>;<br>废弃版本:9<br>代替接口:ohos.file.fs.write |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function write(fd: number, buffer: ArrayBuffer \| string, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function write(fd: number, buffer: ArrayBuffer \| string, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.write |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function write(fd: number, buffer: ArrayBuffer \| string, options: {<br> offset?: number;<br> length?: number;<br> position?: number;<br> encoding?: string;<br>}, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function write(fd: number, buffer: ArrayBuffer \| string, options: {<br> offset?: number;<br> length?: number;<br> position?: number;<br> encoding?: string;<br>}, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.write |@ohos.fileio.d.ts| +|废弃版本有变化|类名:fileIO<br>方法 or 属性:function writeSync(fd: number, buffer: ArrayBuffer \| string, options?: {<br> offset?: number;<br> length?: number;<br> position?: number;<br> encoding?: string;<br>}): number;<br>废弃版本:N/A|类名:fileIO<br>方法 or 属性:function writeSync(fd: number, buffer: ArrayBuffer \| string, options?: {<br> offset?: number;<br> length?: number;<br> position?: number;<br> encoding?: string;<br>}): number;<br>废弃版本:9<br>代替接口:ohos.file.fs.writeSync |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Dir<br>方法 or 属性:read(): Promise\<Dirent>;<br>废弃版本:N/A|类名:Dir<br>方法 or 属性:read(): Promise\<Dirent>;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Dir<br>方法 or 属性:read(callback: AsyncCallback\<Dirent>): void;<br>废弃版本:N/A|类名:Dir<br>方法 or 属性:read(callback: AsyncCallback\<Dirent>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Dir<br>方法 or 属性:readSync(): Dirent;<br>废弃版本:N/A|类名:Dir<br>方法 or 属性:readSync(): Dirent;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Dir<br>方法 or 属性:close(): Promise\<void>;<br>废弃版本:N/A|类名:Dir<br>方法 or 属性:close(): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Dir<br>方法 or 属性:close(callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:Dir<br>方法 or 属性:close(callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Dir<br>方法 or 属性:closeSync(): void;<br>废弃版本:N/A|类名:Dir<br>方法 or 属性:closeSync(): void;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Dirent<br>废弃版本:N/A|类名:Dirent<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Dirent<br>方法 or 属性:readonly name: string;<br>废弃版本:N/A|类名:Dirent<br>方法 or 属性:readonly name: string;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Dirent<br>方法 or 属性:isBlockDevice(): boolean;<br>废弃版本:N/A|类名:Dirent<br>方法 or 属性:isBlockDevice(): boolean;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Dirent<br>方法 or 属性:isCharacterDevice(): boolean;<br>废弃版本:N/A|类名:Dirent<br>方法 or 属性:isCharacterDevice(): boolean;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Dirent<br>方法 or 属性:isDirectory(): boolean;<br>废弃版本:N/A|类名:Dirent<br>方法 or 属性:isDirectory(): boolean;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Dirent<br>方法 or 属性:isFIFO(): boolean;<br>废弃版本:N/A|类名:Dirent<br>方法 or 属性:isFIFO(): boolean;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Dirent<br>方法 or 属性:isFile(): boolean;<br>废弃版本:N/A|类名:Dirent<br>方法 or 属性:isFile(): boolean;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Dirent<br>方法 or 属性:isSocket(): boolean;<br>废弃版本:N/A|类名:Dirent<br>方法 or 属性:isSocket(): boolean;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Dirent<br>方法 or 属性:isSymbolicLink(): boolean;<br>废弃版本:N/A|类名:Dirent<br>方法 or 属性:isSymbolicLink(): boolean;<br>废弃版本:9<br>代替接口:ohos.file.fs.listFile |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Stat<br>废弃版本:N/A|类名:Stat<br>废弃版本:9<br>代替接口:ohos.file.fs.Stat |@ohos.fileio.d.ts| +|废弃版本有变化|类名:Stream<br>废弃版本:N/A|类名:Stream<br>废弃版本:9<br>代替接口:ohos.file.fs.Stream |@ohos.fileio.d.ts| +|废弃版本有变化|类名:ReadOut<br>废弃版本:N/A|类名:ReadOut<br>废弃版本:9<br>代替接口:N/A|@ohos.fileio.d.ts| +|废弃版本有变化|类名:Statfs<br>方法 or 属性:function getFreeBytes(path: string, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:Statfs<br>方法 or 属性:function getFreeBytes(path: string, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.file.statvfs.getFreeSize |@ohos.statfs.d.ts| +|废弃版本有变化|类名:Statfs<br>方法 or 属性:function getFreeBytes(path: string): Promise\<number>;<br>废弃版本:N/A|类名:Statfs<br>方法 or 属性:function getFreeBytes(path: string): Promise\<number>;<br>废弃版本:9<br>代替接口:ohos.file.statvfs.getFreeSize |@ohos.statfs.d.ts| +|废弃版本有变化|类名:Statfs<br>方法 or 属性:function getTotalBytes(path: string, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:Statfs<br>方法 or 属性:function getTotalBytes(path: string, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.file.statvfs.getTotalSize |@ohos.statfs.d.ts| +|废弃版本有变化|类名:Statfs<br>方法 or 属性:function getTotalBytes(path: string): Promise\<number>;<br>废弃版本:N/A|类名:Statfs<br>方法 or 属性:function getTotalBytes(path: string): Promise\<number>;<br>废弃版本:9<br>代替接口:ohos.file.statvfs.getTotalSize |@ohos.statfs.d.ts| +|起始版本有变化|类名:fileIO<br>方法 or 属性:function opendirSync(path: string): Dir;<br>起始版本:N/A|类名:fileIO<br>方法 or 属性:function opendirSync(path: string): Dir;<br>起始版本:6|@ohos.fileio.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-geolocation.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-geolocation.md new file mode 100644 index 0000000000000000000000000000000000000000..ea3497d974ea2b040e2251cc3b5b53a66555cdad --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-geolocation.md @@ -0,0 +1,223 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|类名:GeoLocationErrorCode<br>方法or属性:INPUT_PARAMS_ERROR|@ohos.geolocation.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function on(type: 'locationChange', request: LocationRequest, callback: Callback\<Location>): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function off(type: 'locationChange', callback?: Callback\<Location>): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function on(type: 'locationEnabledChange', callback: Callback\<boolean>): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function off(type: 'locationEnabledChange', callback?: Callback\<boolean>): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function on(type: 'cachedGnssLocationsChange', request: CachedGnssLocationsRequest, callback: Callback\<Array\<Location>>): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function off(type: 'cachedGnssLocationsChange', callback?: Callback\<Array\<Location>>): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function on(type: 'satelliteStatusChange', callback: Callback\<SatelliteStatusInfo>): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function off(type: 'satelliteStatusChange', callback?: Callback\<SatelliteStatusInfo>): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function on(type: 'nmeaMessage', callback: Callback\<string>): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function off(type: 'nmeaMessage', callback?: Callback\<string>): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function on(type: 'gnssFenceStatusChange', request: GeofenceRequest, want: WantAgent): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function off(type: 'gnssFenceStatusChange', request: GeofenceRequest, want: WantAgent): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function on(type: 'countryCodeChange', callback: Callback\<CountryCode>): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function off(type: 'countryCodeChange', callback?: Callback\<CountryCode>): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback\<Location>): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function getCurrentLocation(callback: AsyncCallback\<Location>): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function getCurrentLocation(request?: CurrentLocationRequest): Promise\<Location>;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function getLastLocation(): Location;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function isLocationEnabled(): boolean;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function enableLocation(callback: AsyncCallback\<void>): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function enableLocation(): Promise\<void>;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function disableLocation(): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback\<Array\<GeoAddress>>): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function getAddressesFromLocation(request: ReverseGeoCodeRequest): Promise\<Array\<GeoAddress>>;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback\<Array\<GeoAddress>>): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function getAddressesFromLocationName(request: GeoCodeRequest): Promise\<Array\<GeoAddress>>;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function isGeocoderAvailable(): boolean;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function getCachedGnssLocationsSize(callback: AsyncCallback\<number>): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function getCachedGnssLocationsSize(): Promise\<number>;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function flushCachedGnssLocations(callback: AsyncCallback\<void>): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function flushCachedGnssLocations(): Promise\<void>;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function sendCommand(command: LocationCommand, callback: AsyncCallback\<void>): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function sendCommand(command: LocationCommand): Promise\<void>;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function getCountryCode(callback: AsyncCallback\<CountryCode>): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function getCountryCode(): Promise\<CountryCode>;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function enableLocationMock(): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function disableLocationMock(): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function setMockedLocations(config: LocationMockConfig): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function enableReverseGeocodingMock(): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function disableReverseGeocodingMock(): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function setReverseGeocodingMockInfo(mockInfos: Array\<ReverseGeocodingMockInfo>): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function isLocationPrivacyConfirmed(type: LocationPrivacyType): boolean;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: geoLocationManager<br>方法 or 属性: function setLocationPrivacyConfirmStatus(type: LocationPrivacyType, isConfirmed: boolean): void;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: ReverseGeocodingMockInfo|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: ReverseGeocodingMockInfo<br>方法 or 属性: location: ReverseGeoCodeRequest;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: ReverseGeocodingMockInfo<br>方法 or 属性: geoAddress: GeoAddress;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: LocationMockConfig|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: LocationMockConfig<br>方法 or 属性: timeInterval: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: LocationMockConfig<br>方法 or 属性: locations: Array\<Location>;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: SatelliteStatusInfo|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: SatelliteStatusInfo<br>方法 or 属性: satellitesNumber: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: SatelliteStatusInfo<br>方法 or 属性: satelliteIds: Array\<number>;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: SatelliteStatusInfo<br>方法 or 属性: carrierToNoiseDensitys: Array\<number>;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: SatelliteStatusInfo<br>方法 or 属性: altitudes: Array\<number>;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: SatelliteStatusInfo<br>方法 or 属性: azimuths: Array\<number>;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: SatelliteStatusInfo<br>方法 or 属性: carrierFrequencies: Array\<number>;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: CachedGnssLocationsRequest|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: CachedGnssLocationsRequest<br>方法 or 属性: reportingPeriodSec: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: CachedGnssLocationsRequest<br>方法 or 属性: wakeUpCacheQueueFull: boolean;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeofenceRequest|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeofenceRequest<br>方法 or 属性: scenario: LocationRequestScenario;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeofenceRequest<br>方法 or 属性: geofence: Geofence;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: Geofence|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: Geofence<br>方法 or 属性: latitude: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: Geofence<br>方法 or 属性: longitude: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: Geofence<br>方法 or 属性: radius: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: Geofence<br>方法 or 属性: expiration: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: ReverseGeoCodeRequest|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: ReverseGeoCodeRequest<br>方法 or 属性: locale?: string;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: ReverseGeoCodeRequest<br>方法 or 属性: latitude: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: ReverseGeoCodeRequest<br>方法 or 属性: longitude: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: ReverseGeoCodeRequest<br>方法 or 属性: maxItems?: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeoCodeRequest|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeoCodeRequest<br>方法 or 属性: locale?: string;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeoCodeRequest<br>方法 or 属性: description: string;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeoCodeRequest<br>方法 or 属性: maxItems?: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeoCodeRequest<br>方法 or 属性: minLatitude?: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeoCodeRequest<br>方法 or 属性: minLongitude?: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeoCodeRequest<br>方法 or 属性: maxLatitude?: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeoCodeRequest<br>方法 or 属性: maxLongitude?: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeoAddress|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeoAddress<br>方法 or 属性: latitude?: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeoAddress<br>方法 or 属性: longitude?: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeoAddress<br>方法 or 属性: locale?: string;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeoAddress<br>方法 or 属性: placeName?: string;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeoAddress<br>方法 or 属性: countryCode?: string;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeoAddress<br>方法 or 属性: countryName?: string;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeoAddress<br>方法 or 属性: administrativeArea?: string;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeoAddress<br>方法 or 属性: subAdministrativeArea?: string;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeoAddress<br>方法 or 属性: locality?: string;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeoAddress<br>方法 or 属性: subLocality?: string;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeoAddress<br>方法 or 属性: roadName?: string;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeoAddress<br>方法 or 属性: subRoadName?: string;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeoAddress<br>方法 or 属性: premises?: string;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeoAddress<br>方法 or 属性: postalCode?: string;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeoAddress<br>方法 or 属性: phoneNumber?: string;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeoAddress<br>方法 or 属性: addressUrl?: string;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeoAddress<br>方法 or 属性: descriptions?: Array\<string>;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeoAddress<br>方法 or 属性: descriptionsSize?: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: GeoAddress<br>方法 or 属性: isFromMock?: Boolean;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: LocationRequest|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: LocationRequest<br>方法 or 属性: priority?: LocationRequestPriority;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: LocationRequest<br>方法 or 属性: scenario?: LocationRequestScenario;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: LocationRequest<br>方法 or 属性: timeInterval?: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: LocationRequest<br>方法 or 属性: distanceInterval?: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: LocationRequest<br>方法 or 属性: maxAccuracy?: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: CurrentLocationRequest|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: CurrentLocationRequest<br>方法 or 属性: priority?: LocationRequestPriority;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: CurrentLocationRequest<br>方法 or 属性: scenario?: LocationRequestScenario;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: CurrentLocationRequest<br>方法 or 属性: maxAccuracy?: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: CurrentLocationRequest<br>方法 or 属性: timeoutMs?: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: Location|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: Location<br>方法 or 属性: latitude: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: Location<br>方法 or 属性: longitude: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: Location<br>方法 or 属性: altitude: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: Location<br>方法 or 属性: accuracy: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: Location<br>方法 or 属性: speed: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: Location<br>方法 or 属性: timeStamp: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: Location<br>方法 or 属性: direction: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: Location<br>方法 or 属性: timeSinceBoot: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: Location<br>方法 or 属性: additions?: Array\<string>;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: Location<br>方法 or 属性: additionSize?: number;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: Location<br>方法 or 属性: isFromMock?: Boolean;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: LocationRequestPriority|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: LocationRequestPriority<br>方法 or 属性: UNSET = 0x200|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: LocationRequestPriority<br>方法 or 属性: ACCURACY|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: LocationRequestPriority<br>方法 or 属性: LOW_POWER|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: LocationRequestPriority<br>方法 or 属性: FIRST_FIX|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: LocationRequestScenario|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: LocationRequestScenario<br>方法 or 属性: UNSET = 0x300|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: LocationRequestScenario<br>方法 or 属性: NAVIGATION|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: LocationRequestScenario<br>方法 or 属性: TRAJECTORY_TRACKING|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: LocationRequestScenario<br>方法 or 属性: CAR_HAILING|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: LocationRequestScenario<br>方法 or 属性: DAILY_LIFE_SERVICE|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: LocationRequestScenario<br>方法 or 属性: NO_POWER|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: LocationPrivacyType|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: LocationPrivacyType<br>方法 or 属性: OTHERS = 0|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: LocationPrivacyType<br>方法 or 属性: STARTUP|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: LocationPrivacyType<br>方法 or 属性: CORE_LOCATION|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: LocationCommand|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: LocationCommand<br>方法 or 属性: scenario: LocationRequestScenario;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: LocationCommand<br>方法 or 属性: command: string;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: CountryCode|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: CountryCode<br>方法 or 属性: country: string;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: CountryCode<br>方法 or 属性: type: CountryCodeType;|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: CountryCodeType|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: CountryCodeType<br>方法 or 属性: COUNTRY_CODE_FROM_LOCALE = 1|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: CountryCodeType<br>方法 or 属性: COUNTRY_CODE_FROM_SIM|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: CountryCodeType<br>方法 or 属性: COUNTRY_CODE_FROM_LOCATION|@ohos.geoLocationManager.d.ts| +|新增|NA|模块名: ohos.geoLocationManager<br>类名: CountryCodeType<br>方法 or 属性: COUNTRY_CODE_FROM_NETWORK|@ohos.geoLocationManager.d.ts| +|删除|模块名:ohos.geolocation<br>类名:geolocation<br>方法 or 属性:function enableLocation(callback: AsyncCallback\<boolean>) : void;|NA|@ohos.geolocation.d.ts| +|删除|模块名:ohos.geolocation<br>类名:geolocation<br>方法 or 属性:function enableLocation() : Promise\<boolean>;|NA|@ohos.geolocation.d.ts| +|删除|模块名:ohos.geolocation<br>类名:geolocation<br>方法 or 属性:function disableLocation(callback: AsyncCallback\<boolean>) : void;|NA|@ohos.geolocation.d.ts| +|删除|模块名:ohos.geolocation<br>类名:geolocation<br>方法 or 属性:function disableLocation() : Promise\<boolean>;|NA|@ohos.geolocation.d.ts| +|删除|模块名:ohos.geolocation<br>类名:geolocation<br>方法 or 属性:function isLocationPrivacyConfirmed(type : LocationPrivacyType, callback: AsyncCallback\<boolean>) : void;|NA|@ohos.geolocation.d.ts| +|删除|模块名:ohos.geolocation<br>类名:geolocation<br>方法 or 属性:function isLocationPrivacyConfirmed(type : LocationPrivacyType,) : Promise\<boolean>;|NA|@ohos.geolocation.d.ts| +|删除|模块名:ohos.geolocation<br>类名:geolocation<br>方法 or 属性:function setLocationPrivacyConfirmStatus(type : LocationPrivacyType, isConfirmed : boolean, callback: AsyncCallback\<boolean>) : void;|NA|@ohos.geolocation.d.ts| +|删除|模块名:ohos.geolocation<br>类名:geolocation<br>方法 or 属性:function setLocationPrivacyConfirmStatus(type : LocationPrivacyType, isConfirmed : boolean) : Promise\<boolean>;|NA|@ohos.geolocation.d.ts| +|废弃版本有变化|类名:geolocation<br>废弃版本:N/A|类名:geolocation<br>废弃版本:9<br>代替接口:N/A|@ohos.geolocation.d.ts| +|废弃版本有变化|类名:SatelliteStatusInfo<br>废弃版本:N/A|类名:SatelliteStatusInfo<br>废弃版本:9<br>代替接口:ohos.geoLocationManager/geoLocationManager.SatelliteStatusInfo |@ohos.geolocation.d.ts| +|废弃版本有变化|类名:CachedGnssLocationsRequest<br>废弃版本:N/A|类名:CachedGnssLocationsRequest<br>废弃版本:9<br>代替接口:ohos.geoLocationManager/geoLocationManager.CachedGnssLocationsRequest |@ohos.geolocation.d.ts| +|废弃版本有变化|类名:GeofenceRequest<br>废弃版本:N/A|类名:GeofenceRequest<br>废弃版本:9<br>代替接口:ohos.geoLocationManager/geoLocationManager.GeofenceRequest |@ohos.geolocation.d.ts| +|废弃版本有变化|类名:Geofence<br>废弃版本:N/A|类名:Geofence<br>废弃版本:9<br>代替接口:ohos.geoLocationManager/geoLocationManager.Geofence |@ohos.geolocation.d.ts| +|废弃版本有变化|类名:ReverseGeoCodeRequest<br>废弃版本:N/A|类名:ReverseGeoCodeRequest<br>废弃版本:9<br>代替接口:ohos.geoLocationManager/geoLocationManager.ReverseGeoCodeRequest |@ohos.geolocation.d.ts| +|废弃版本有变化|类名:GeoCodeRequest<br>废弃版本:N/A|类名:GeoCodeRequest<br>废弃版本:9<br>代替接口:ohos.geoLocationManager/geoLocationManager.GeoCodeRequest |@ohos.geolocation.d.ts| +|废弃版本有变化|类名:GeoAddress<br>废弃版本:N/A|类名:GeoAddress<br>废弃版本:9<br>代替接口:ohos.geoLocationManager/geoLocationManager.GeoAddress |@ohos.geolocation.d.ts| +|废弃版本有变化|类名:LocationRequest<br>废弃版本:N/A|类名:LocationRequest<br>废弃版本:9<br>代替接口:ohos.geoLocationManager/geoLocationManager.LocationRequest |@ohos.geolocation.d.ts| +|废弃版本有变化|类名:CurrentLocationRequest<br>废弃版本:N/A|类名:CurrentLocationRequest<br>废弃版本:9<br>代替接口:ohos.geoLocationManager/geoLocationManager.CurrentLocationRequest |@ohos.geolocation.d.ts| +|废弃版本有变化|类名:Location<br>废弃版本:N/A|类名:Location<br>废弃版本:9<br>代替接口:ohos.geoLocationManager/geoLocationManager.Location |@ohos.geolocation.d.ts| +|废弃版本有变化|类名:LocationRequestPriority<br>废弃版本:N/A|类名:LocationRequestPriority<br>废弃版本:9<br>代替接口:ohos.geoLocationManager/geoLocationManager.LocationRequestPriority |@ohos.geolocation.d.ts| +|废弃版本有变化|类名:LocationRequestScenario<br>废弃版本:N/A|类名:LocationRequestScenario<br>废弃版本:9<br>代替接口:ohos.geoLocationManager/geoLocationManager.LocationRequestScenario |@ohos.geolocation.d.ts| +|废弃版本有变化|类名:GeoLocationErrorCode<br>废弃版本:N/A|类名:GeoLocationErrorCode<br>废弃版本:9<br>代替接口:N/A|@ohos.geolocation.d.ts| +|废弃版本有变化|类名:LocationPrivacyType<br>废弃版本:N/A|类名:LocationPrivacyType<br>废弃版本:9<br>代替接口:ohos.geoLocationManager/geoLocationManager.LocationPrivacyType |@ohos.geolocation.d.ts| +|废弃版本有变化|类名:LocationCommand<br>废弃版本:N/A|类名:LocationCommand<br>废弃版本:9<br>代替接口:ohos.geoLocationManager/geoLocationManager.LocationCommand |@ohos.geolocation.d.ts| +|废弃版本有变化|类名:GeolocationResponse<br>废弃版本:N/A|类名:GeolocationResponse<br>废弃版本:9<br>代替接口:ohos.geoLocationManager/geoLocationManager.Location |@system.geolocation.d.ts| +|废弃版本有变化|类名:GetLocationOption<br>废弃版本:N/A|类名:GetLocationOption<br>废弃版本:9<br>代替接口:ohos.geoLocationManager/geoLocationManager.CurrentLocationRequest |@system.geolocation.d.ts| +|废弃版本有变化|类名:GetLocationTypeResponse<br>废弃版本:N/A|类名:GetLocationTypeResponse<br>废弃版本:9<br>代替接口:N/A|@system.geolocation.d.ts| +|废弃版本有变化|类名:GetLocationTypeOption<br>废弃版本:N/A|类名:GetLocationTypeOption<br>废弃版本:9<br>代替接口:N/A|@system.geolocation.d.ts| +|废弃版本有变化|类名:SubscribeLocationOption<br>废弃版本:N/A|类名:SubscribeLocationOption<br>废弃版本:9<br>代替接口:ohos.geoLocationManager/geoLocationManager.LocationRequest |@system.geolocation.d.ts| +|废弃版本有变化|类名:Geolocation<br>废弃版本:N/A|类名:Geolocation<br>废弃版本:9<br>代替接口:ohos.geoLocationManager/geoLocationManager |@system.geolocation.d.ts| +|废弃版本有变化|类名:Geolocation<br>方法 or 属性:static getLocation(options?: GetLocationOption): void;<br>废弃版本:N/A|类名:Geolocation<br>方法 or 属性:static getLocation(options?: GetLocationOption): void;<br>废弃版本:9<br>代替接口:ohos.geoLocationManager/geoLocationManager.getCurrentLocation |@system.geolocation.d.ts| +|废弃版本有变化|类名:Geolocation<br>方法 or 属性:static getLocationType(options?: GetLocationTypeOption): void;<br>废弃版本:N/A|类名:Geolocation<br>方法 or 属性:static getLocationType(options?: GetLocationTypeOption): void;<br>废弃版本:9<br>代替接口:N/A|@system.geolocation.d.ts| +|废弃版本有变化|类名:Geolocation<br>方法 or 属性:static subscribe(options: SubscribeLocationOption): void;<br>废弃版本:N/A|类名:Geolocation<br>方法 or 属性:static subscribe(options: SubscribeLocationOption): void;<br>废弃版本:9<br>代替接口:ohos.geoLocationManager/geoLocationManager.on|@system.geolocation.d.ts| +|废弃版本有变化|类名:Geolocation<br>方法 or 属性:static unsubscribe(): void;<br>废弃版本:N/A|类名:Geolocation<br>方法 or 属性:static unsubscribe(): void;<br>废弃版本:9<br>代替接口:ohos.geoLocationManager/geoLocationManager.off|@system.geolocation.d.ts| +|废弃版本有变化|类名:Geolocation<br>方法 or 属性:static getSupportedCoordTypes(): Array\<string>;<br>废弃版本:N/A|类名:Geolocation<br>方法 or 属性:static getSupportedCoordTypes(): Array\<string>;<br>废弃版本:9<br>代替接口:N/A|@system.geolocation.d.ts| +|起始版本有变化|类名:GeoAddress<br>方法 or 属性:latitude?: number;<br>起始版本:N/A|类名:GeoAddress<br>方法 or 属性:latitude?: number;<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:GeoAddress<br>方法 or 属性:longitude?: number;<br>起始版本:N/A|类名:GeoAddress<br>方法 or 属性:longitude?: number;<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:GeoAddress<br>方法 or 属性:locale?: string;<br>起始版本:N/A|类名:GeoAddress<br>方法 or 属性:locale?: string;<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:GeoAddress<br>方法 or 属性:placeName?: string;<br>起始版本:N/A|类名:GeoAddress<br>方法 or 属性:placeName?: string;<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:GeoAddress<br>方法 or 属性:countryCode?: string;<br>起始版本:N/A|类名:GeoAddress<br>方法 or 属性:countryCode?: string;<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:GeoAddress<br>方法 or 属性:countryName?: string;<br>起始版本:N/A|类名:GeoAddress<br>方法 or 属性:countryName?: string;<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:GeoAddress<br>方法 or 属性:administrativeArea?: string;<br>起始版本:N/A|类名:GeoAddress<br>方法 or 属性:administrativeArea?: string;<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:GeoAddress<br>方法 or 属性:subAdministrativeArea?: string;<br>起始版本:N/A|类名:GeoAddress<br>方法 or 属性:subAdministrativeArea?: string;<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:GeoAddress<br>方法 or 属性:locality?: string;<br>起始版本:N/A|类名:GeoAddress<br>方法 or 属性:locality?: string;<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:GeoAddress<br>方法 or 属性:subLocality?: string;<br>起始版本:N/A|类名:GeoAddress<br>方法 or 属性:subLocality?: string;<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:GeoAddress<br>方法 or 属性:roadName?: string;<br>起始版本:N/A|类名:GeoAddress<br>方法 or 属性:roadName?: string;<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:GeoAddress<br>方法 or 属性:subRoadName?: string;<br>起始版本:N/A|类名:GeoAddress<br>方法 or 属性:subRoadName?: string;<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:GeoAddress<br>方法 or 属性:premises?: string;<br>起始版本:N/A|类名:GeoAddress<br>方法 or 属性:premises?: string;<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:GeoAddress<br>方法 or 属性:postalCode?: string;<br>起始版本:N/A|类名:GeoAddress<br>方法 or 属性:postalCode?: string;<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:GeoAddress<br>方法 or 属性:phoneNumber?: string;<br>起始版本:N/A|类名:GeoAddress<br>方法 or 属性:phoneNumber?: string;<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:GeoAddress<br>方法 or 属性:addressUrl?: string;<br>起始版本:N/A|类名:GeoAddress<br>方法 or 属性:addressUrl?: string;<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:GeoAddress<br>方法 or 属性:descriptions?: Array\<string>;<br>起始版本:N/A|类名:GeoAddress<br>方法 or 属性:descriptions?: Array\<string>;<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:GeoAddress<br>方法 or 属性:descriptionsSize?: number;<br>起始版本:N/A|类名:GeoAddress<br>方法 or 属性:descriptionsSize?: number;<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:Location<br>方法 or 属性:latitude: number;<br>起始版本:N/A|类名:Location<br>方法 or 属性:latitude: number;<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:Location<br>方法 or 属性:longitude: number;<br>起始版本:N/A|类名:Location<br>方法 or 属性:longitude: number;<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:Location<br>方法 or 属性:altitude: number;<br>起始版本:N/A|类名:Location<br>方法 or 属性:altitude: number;<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:Location<br>方法 or 属性:accuracy: number;<br>起始版本:N/A|类名:Location<br>方法 or 属性:accuracy: number;<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:Location<br>方法 or 属性:speed: number;<br>起始版本:N/A|类名:Location<br>方法 or 属性:speed: number;<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:Location<br>方法 or 属性:timeStamp: number;<br>起始版本:N/A|类名:Location<br>方法 or 属性:timeStamp: number;<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:Location<br>方法 or 属性:direction: number;<br>起始版本:N/A|类名:Location<br>方法 or 属性:direction: number;<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:Location<br>方法 or 属性:timeSinceBoot: number;<br>起始版本:N/A|类名:Location<br>方法 or 属性:timeSinceBoot: number;<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:Location<br>方法 or 属性:additions?: Array\<string>;<br>起始版本:N/A|类名:Location<br>方法 or 属性:additions?: Array\<string>;<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:Location<br>方法 or 属性:additionSize?: number;<br>起始版本:N/A|类名:Location<br>方法 or 属性:additionSize?: number;<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:GeoLocationErrorCode<br>方法 or 属性:REVERSE_GEOCODE_ERROR<br>起始版本:N/A|类名:GeoLocationErrorCode<br>方法 or 属性:REVERSE_GEOCODE_ERROR<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:GeoLocationErrorCode<br>方法 or 属性:GEOCODE_ERROR<br>起始版本:N/A|类名:GeoLocationErrorCode<br>方法 or 属性:GEOCODE_ERROR<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:GeoLocationErrorCode<br>方法 or 属性:LOCATOR_ERROR<br>起始版本:N/A|类名:GeoLocationErrorCode<br>方法 or 属性:LOCATOR_ERROR<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:GeoLocationErrorCode<br>方法 or 属性:LOCATION_SWITCH_ERROR<br>起始版本:N/A|类名:GeoLocationErrorCode<br>方法 or 属性:LOCATION_SWITCH_ERROR<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:GeoLocationErrorCode<br>方法 or 属性:LAST_KNOWN_LOCATION_ERROR<br>起始版本:N/A|类名:GeoLocationErrorCode<br>方法 or 属性:LAST_KNOWN_LOCATION_ERROR<br>起始版本:7|@ohos.geolocation.d.ts| +|起始版本有变化|类名:GeoLocationErrorCode<br>方法 or 属性:LOCATION_REQUEST_TIMEOUT_ERROR<br>起始版本:N/A|类名:GeoLocationErrorCode<br>方法 or 属性:LOCATION_REQUEST_TIMEOUT_ERROR<br>起始版本:7|@ohos.geolocation.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-global.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-global.md new file mode 100644 index 0000000000000000000000000000000000000000..09e4a9a1aa618d81a2592c1f3e23af5dabac0603 --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-global.md @@ -0,0 +1,256 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.i18n<br>类名: System|@ohos.i18n.d.ts| +|新增|NA|类名:System<br>方法or属性:|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: System<br>方法 or 属性:static getDisplayCountry(country: string, locale: string, sentenceCase?: boolean): string;|@ohos.i18n.d.ts| +|新增|NA|类名:System<br>方法or属性:static getDisplayCountry(country: string, locale: string, sentenceCase?: boolean): string;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: System<br>方法 or 属性:static getDisplayLanguage(language: string, locale: string, sentenceCase?: boolean): string;|@ohos.i18n.d.ts| +|新增|NA|类名:System<br>方法or属性:static getDisplayLanguage(language: string, locale: string, sentenceCase?: boolean): string;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: System<br>方法 or 属性:static getSystemLanguages(): Array\<string>;|@ohos.i18n.d.ts| +|新增|NA|类名:System<br>方法or属性:static getSystemLanguages(): Array\<string>;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: System<br>方法 or 属性:static getSystemCountries(language: string): Array\<string>;|@ohos.i18n.d.ts| +|新增|NA|类名:System<br>方法or属性:static getSystemCountries(language: string): Array\<string>;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: System<br>方法 or 属性:static isSuggested(language: string, region?: string): boolean;|@ohos.i18n.d.ts| +|新增|NA|类名:System<br>方法or属性:static isSuggested(language: string, region?: string): boolean;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: System<br>方法 or 属性:static getSystemLanguage(): string;|@ohos.i18n.d.ts| +|新增|NA|类名:System<br>方法or属性:static getSystemLanguage(): string;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: System<br>方法 or 属性:static setSystemLanguage(language: string): void;|@ohos.i18n.d.ts| +|新增|NA|类名:System<br>方法or属性:static setSystemLanguage(language: string): void;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: System<br>方法 or 属性:static getSystemRegion(): string;|@ohos.i18n.d.ts| +|新增|NA|类名:System<br>方法or属性:static getSystemRegion(): string;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: System<br>方法 or 属性:static setSystemRegion(region: string): void;|@ohos.i18n.d.ts| +|新增|NA|类名:System<br>方法or属性:static setSystemRegion(region: string): void;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: System<br>方法 or 属性:static getSystemLocale(): string;|@ohos.i18n.d.ts| +|新增|NA|类名:System<br>方法or属性:static getSystemLocale(): string;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: System<br>方法 or 属性:static setSystemLocale(locale: string): void;|@ohos.i18n.d.ts| +|新增|NA|类名:System<br>方法or属性:static setSystemLocale(locale: string): void;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: System<br>方法 or 属性:static is24HourClock(): boolean;|@ohos.i18n.d.ts| +|新增|NA|类名:System<br>方法or属性:static is24HourClock(): boolean;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: System<br>方法 or 属性:static set24HourClock(option: boolean): void;|@ohos.i18n.d.ts| +|新增|NA|类名:System<br>方法or属性:static set24HourClock(option: boolean): void;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: System<br>方法 or 属性:static addPreferredLanguage(language: string, index?: number): void;|@ohos.i18n.d.ts| +|新增|NA|类名:System<br>方法or属性:static addPreferredLanguage(language: string, index?: number): void;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: System<br>方法 or 属性:static removePreferredLanguage(index: number): void;|@ohos.i18n.d.ts| +|新增|NA|类名:System<br>方法or属性:static removePreferredLanguage(index: number): void;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: System<br>方法 or 属性:static getPreferredLanguageList(): Array\<string>;|@ohos.i18n.d.ts| +|新增|NA|类名:System<br>方法or属性:static getPreferredLanguageList(): Array\<string>;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: System<br>方法 or 属性:static getFirstPreferredLanguage(): string;|@ohos.i18n.d.ts| +|新增|NA|类名:System<br>方法or属性:static getFirstPreferredLanguage(): string;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: System<br>方法 or 属性:static getAppPreferredLanguage(): string;|@ohos.i18n.d.ts| +|新增|NA|类名:System<br>方法or属性:static getAppPreferredLanguage(): string;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: System<br>方法 or 属性:static setUsingLocalDigit(flag: boolean): void;|@ohos.i18n.d.ts| +|新增|NA|类名:System<br>方法or属性:static setUsingLocalDigit(flag: boolean): void;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: System<br>方法 or 属性:static getUsingLocalDigit(): boolean;|@ohos.i18n.d.ts| +|新增|NA|类名:System<br>方法or属性:static getUsingLocalDigit(): boolean;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: I18NUtil|@ohos.i18n.d.ts| +|新增|NA|类名:I18NUtil<br>方法or属性:|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: I18NUtil<br>方法 or 属性:static unitConvert(fromUnit: UnitInfo, toUnit: UnitInfo, value: number, locale: string, style?: string): string;|@ohos.i18n.d.ts| +|新增|NA|类名:I18NUtil<br>方法or属性:static unitConvert(fromUnit: UnitInfo, toUnit: UnitInfo, value: number, locale: string, style?: string): string;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: I18NUtil<br>方法 or 属性:static getDateOrder(locale: string): string;|@ohos.i18n.d.ts| +|新增|NA|类名:I18NUtil<br>方法or属性:static getDateOrder(locale: string): string;|@ohos.i18n.d.ts| +|新增|NA|类名:PhoneNumberFormatOptions<br>方法or属性:type?: string;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: PhoneNumberFormat<br>方法 or 属性:getLocationName(number: string, locale: string): string;|@ohos.i18n.d.ts| +|新增|NA|类名:PhoneNumberFormat<br>方法or属性:getLocationName(number: string, locale: string): string;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: Unicode|@ohos.i18n.d.ts| +|新增|NA|类名:Unicode<br>方法or属性:|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: Unicode<br>方法 or 属性:static isDigit(char: string): boolean;|@ohos.i18n.d.ts| +|新增|NA|类名:Unicode<br>方法or属性:static isDigit(char: string): boolean;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: Unicode<br>方法 or 属性:static isSpaceChar(char: string): boolean;|@ohos.i18n.d.ts| +|新增|NA|类名:Unicode<br>方法or属性:static isSpaceChar(char: string): boolean;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: Unicode<br>方法 or 属性:static isWhitespace(char: string): boolean;|@ohos.i18n.d.ts| +|新增|NA|类名:Unicode<br>方法or属性:static isWhitespace(char: string): boolean;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: Unicode<br>方法 or 属性:static isRTL(char: string): boolean;|@ohos.i18n.d.ts| +|新增|NA|类名:Unicode<br>方法or属性:static isRTL(char: string): boolean;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: Unicode<br>方法 or 属性:static isIdeograph(char: string): boolean;|@ohos.i18n.d.ts| +|新增|NA|类名:Unicode<br>方法or属性:static isIdeograph(char: string): boolean;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: Unicode<br>方法 or 属性:static isLetter(char: string): boolean;|@ohos.i18n.d.ts| +|新增|NA|类名:Unicode<br>方法or属性:static isLetter(char: string): boolean;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: Unicode<br>方法 or 属性:static isLowerCase(char: string): boolean;|@ohos.i18n.d.ts| +|新增|NA|类名:Unicode<br>方法or属性:static isLowerCase(char: string): boolean;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: Unicode<br>方法 or 属性:static isUpperCase(char: string): boolean;|@ohos.i18n.d.ts| +|新增|NA|类名:Unicode<br>方法or属性:static isUpperCase(char: string): boolean;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: Unicode<br>方法 or 属性:static getType(char: string): string;|@ohos.i18n.d.ts| +|新增|NA|类名:Unicode<br>方法or属性:static getType(char: string): string;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: TimeZone<br>方法 or 属性:static getAvailableIDs(): Array\<string>;|@ohos.i18n.d.ts| +|新增|NA|类名:TimeZone<br>方法or属性:static getAvailableIDs(): Array\<string>;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: TimeZone<br>方法 or 属性:static getAvailableZoneCityIDs(): Array\<string>;|@ohos.i18n.d.ts| +|新增|NA|类名:TimeZone<br>方法or属性:static getAvailableZoneCityIDs(): Array\<string>;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: TimeZone<br>方法 or 属性:static getCityDisplayName(cityID: string, locale: string): string;|@ohos.i18n.d.ts| +|新增|NA|类名:TimeZone<br>方法or属性:static getCityDisplayName(cityID: string, locale: string): string;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: TimeZone<br>方法 or 属性:static getTimezoneFromCity(cityID: string): TimeZone;|@ohos.i18n.d.ts| +|新增|NA|类名:TimeZone<br>方法or属性:static getTimezoneFromCity(cityID: string): TimeZone;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: Transliterator|@ohos.i18n.d.ts| +|新增|NA|类名:Transliterator<br>方法or属性:|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: Transliterator<br>方法 or 属性:static getAvailableIDs(): string[];|@ohos.i18n.d.ts| +|新增|NA|类名:Transliterator<br>方法or属性:static getAvailableIDs(): string[];|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: Transliterator<br>方法 or 属性:static getInstance(id: string): Transliterator;|@ohos.i18n.d.ts| +|新增|NA|类名:Transliterator<br>方法or属性:static getInstance(id: string): Transliterator;|@ohos.i18n.d.ts| +|新增|NA|模块名: ohos.i18n<br>类名: Transliterator<br>方法 or 属性:transform(text: string): string;|@ohos.i18n.d.ts| +|新增|NA|类名:Transliterator<br>方法or属性:transform(text: string): string;|@ohos.i18n.d.ts| +|新增|NA|类名:LocaleOptions<br>方法or属性:calendar?: string;|@ohos.intl.d.ts| +|新增|NA|类名:LocaleOptions<br>方法or属性:collation?: string;|@ohos.intl.d.ts| +|新增|NA|类名:LocaleOptions<br>方法or属性:hourCycle?: string;|@ohos.intl.d.ts| +|新增|NA|类名:LocaleOptions<br>方法or属性:numberingSystem?: string;|@ohos.intl.d.ts| +|新增|NA|类名:LocaleOptions<br>方法or属性:numeric?: boolean;|@ohos.intl.d.ts| +|新增|NA|类名:LocaleOptions<br>方法or属性:caseFirst?: string;|@ohos.intl.d.ts| +|新增|NA|类名:DateTimeOptions<br>方法or属性:locale?: string|@ohos.intl.d.ts| +|新增|NA|类名:DateTimeOptions<br>方法or属性:dateStyle?: string|@ohos.intl.d.ts| +|新增|NA|类名:DateTimeOptions<br>方法or属性:timeStyle?: string|@ohos.intl.d.ts| +|新增|NA|类名:DateTimeOptions<br>方法or属性:hourCycle?: string|@ohos.intl.d.ts| +|新增|NA|类名:DateTimeOptions<br>方法or属性:timeZone?: string|@ohos.intl.d.ts| +|新增|NA|类名:DateTimeOptions<br>方法or属性:numberingSystem?: string|@ohos.intl.d.ts| +|新增|NA|类名:DateTimeOptions<br>方法or属性:hour12?: boolean|@ohos.intl.d.ts| +|新增|NA|类名:DateTimeOptions<br>方法or属性:weekday?: string|@ohos.intl.d.ts| +|新增|NA|类名:DateTimeOptions<br>方法or属性:era?: string|@ohos.intl.d.ts| +|新增|NA|类名:DateTimeOptions<br>方法or属性:year?: string|@ohos.intl.d.ts| +|新增|NA|类名:DateTimeOptions<br>方法or属性:month?: string|@ohos.intl.d.ts| +|新增|NA|类名:DateTimeOptions<br>方法or属性:day?: string|@ohos.intl.d.ts| +|新增|NA|类名:DateTimeOptions<br>方法or属性:hour?: string|@ohos.intl.d.ts| +|新增|NA|类名:DateTimeOptions<br>方法or属性:minute?: string|@ohos.intl.d.ts| +|新增|NA|类名:DateTimeOptions<br>方法or属性:second?: string|@ohos.intl.d.ts| +|新增|NA|类名:DateTimeOptions<br>方法or属性:timeZoneName?: string|@ohos.intl.d.ts| +|新增|NA|类名:DateTimeOptions<br>方法or属性:dayPeriod?: string|@ohos.intl.d.ts| +|新增|NA|类名:DateTimeOptions<br>方法or属性:localeMatcher?: string|@ohos.intl.d.ts| +|新增|NA|类名:DateTimeOptions<br>方法or属性:formatMatcher?: string|@ohos.intl.d.ts| +|新增|NA|类名:NumberOptions<br>方法or属性:locale?: string|@ohos.intl.d.ts| +|新增|NA|类名:NumberOptions<br>方法or属性:currency?: string|@ohos.intl.d.ts| +|新增|NA|类名:NumberOptions<br>方法or属性:currencySign?: string|@ohos.intl.d.ts| +|新增|NA|类名:NumberOptions<br>方法or属性:currencyDisplay?: string|@ohos.intl.d.ts| +|新增|NA|类名:NumberOptions<br>方法or属性:unit?: string|@ohos.intl.d.ts| +|新增|NA|类名:NumberOptions<br>方法or属性:unitDisplay?: string|@ohos.intl.d.ts| +|新增|NA|类名:NumberOptions<br>方法or属性:unitUsage?: string|@ohos.intl.d.ts| +|新增|NA|类名:NumberOptions<br>方法or属性:signDisplay?: string|@ohos.intl.d.ts| +|新增|NA|类名:NumberOptions<br>方法or属性:compactDisplay?: string|@ohos.intl.d.ts| +|新增|NA|类名:NumberOptions<br>方法or属性:notation?: string|@ohos.intl.d.ts| +|新增|NA|类名:NumberOptions<br>方法or属性:localeMatcher?: string|@ohos.intl.d.ts| +|新增|NA|类名:NumberOptions<br>方法or属性:style?: string|@ohos.intl.d.ts| +|新增|NA|类名:NumberOptions<br>方法or属性:numberingSystem?: string|@ohos.intl.d.ts| +|新增|NA|类名:NumberOptions<br>方法or属性:useGrouping?: boolean|@ohos.intl.d.ts| +|新增|NA|类名:NumberOptions<br>方法or属性:minimumIntegerDigits?: number|@ohos.intl.d.ts| +|新增|NA|类名:NumberOptions<br>方法or属性:minimumFractionDigits?: number|@ohos.intl.d.ts| +|新增|NA|类名:NumberOptions<br>方法or属性:maximumFractionDigits?: number|@ohos.intl.d.ts| +|新增|NA|类名:NumberOptions<br>方法or属性:minimumSignificantDigits?: number|@ohos.intl.d.ts| +|新增|NA|类名:NumberOptions<br>方法or属性:maximumSignificantDigits?: number|@ohos.intl.d.ts| +|新增|NA|类名:CollatorOptions<br>方法or属性:localeMatcher?: string;|@ohos.intl.d.ts| +|新增|NA|类名:CollatorOptions<br>方法or属性:usage?: string;|@ohos.intl.d.ts| +|新增|NA|类名:CollatorOptions<br>方法or属性:sensitivity?: string;|@ohos.intl.d.ts| +|新增|NA|类名:CollatorOptions<br>方法or属性:ignorePunctuation?: boolean;|@ohos.intl.d.ts| +|新增|NA|类名:CollatorOptions<br>方法or属性:collation?: string;|@ohos.intl.d.ts| +|新增|NA|类名:CollatorOptions<br>方法or属性:numeric?: boolean;|@ohos.intl.d.ts| +|新增|NA|类名:CollatorOptions<br>方法or属性:caseFirst?: string;|@ohos.intl.d.ts| +|新增|NA|类名:PluralRulesOptions<br>方法or属性:localeMatcher?: string;|@ohos.intl.d.ts| +|新增|NA|类名:PluralRulesOptions<br>方法or属性:type?: string;|@ohos.intl.d.ts| +|新增|NA|类名:PluralRulesOptions<br>方法or属性:minimumIntegerDigits?: number;|@ohos.intl.d.ts| +|新增|NA|类名:PluralRulesOptions<br>方法or属性:minimumFractionDigits?: number;|@ohos.intl.d.ts| +|新增|NA|类名:PluralRulesOptions<br>方法or属性:maximumFractionDigits?: number;|@ohos.intl.d.ts| +|新增|NA|类名:PluralRulesOptions<br>方法or属性:minimumSignificantDigits?: number;|@ohos.intl.d.ts| +|新增|NA|类名:PluralRulesOptions<br>方法or属性:maximumSignificantDigits?: number;|@ohos.intl.d.ts| +|新增|NA|类名:RelativeTimeFormatInputOptions<br>方法or属性:localeMatcher?: string;|@ohos.intl.d.ts| +|新增|NA|类名:RelativeTimeFormatInputOptions<br>方法or属性:numeric?: string;|@ohos.intl.d.ts| +|新增|NA|类名:RelativeTimeFormatInputOptions<br>方法or属性:style?: string;|@ohos.intl.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getStringValue(resource: Resource, callback: _AsyncCallback\<string>): void;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getStringValue(resource: Resource): Promise\<string>;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getStringArrayValue(resource: Resource, callback: _AsyncCallback\<Array\<string>>): void;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getStringArrayValue(resource: Resource): Promise\<Array\<string>>;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getMediaContent(resource: Resource, callback: _AsyncCallback\<Uint8Array>): void;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getMediaContent(resource: Resource): Promise\<Uint8Array>;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getMediaContentBase64(resource: Resource, callback: _AsyncCallback\<string>): void;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getMediaContentBase64(resource: Resource): Promise\<string>;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getPluralStringValue(resource: Resource, num: number, callback: _AsyncCallback\<string>): void;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getPluralStringValue(resource: Resource, num: number): Promise\<string>;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getStringByName(resName: string, callback: _AsyncCallback\<string>): void;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getStringByName(resName: string): Promise\<string>;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getStringArrayByName(resName: string, callback: _AsyncCallback\<Array\<string>>): void;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getStringArrayByName(resName: string): Promise\<Array\<string>>;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getMediaByName(resName: string, callback: _AsyncCallback\<Uint8Array>): void;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getMediaByName(resName: string): Promise\<Uint8Array>;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getMediaBase64ByName(resName: string, callback: _AsyncCallback\<string>): void;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getMediaBase64ByName(resName: string): Promise\<string>;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getPluralStringByName(resName: string, num: number, callback: _AsyncCallback\<string>): void;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getPluralStringByName(resName: string, num: number): Promise\<string>;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getStringSync(resId: number): string;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getStringSync(resource: Resource): string;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getStringByNameSync(resName: string): string;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getBoolean(resId: number): boolean;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getBoolean(resource: Resource): boolean;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getBooleanByName(resName: string): boolean;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getNumber(resId: number): number;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getNumber(resource: Resource): number;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getNumberByName(resName: string): number;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getStringValue(resId: number, callback: _AsyncCallback\<string>): void;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getStringValue(resId: number): Promise\<string>;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getStringArrayValue(resId: number, callback: _AsyncCallback\<Array\<string>>): void;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getStringArrayValue(resId: number): Promise\<Array\<string>>;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getPluralStringValue(resId: number, num: number, callback: _AsyncCallback\<string>): void;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getPluralStringValue(resId: number, num: number): Promise\<string>;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getMediaContent(resId: number, callback: _AsyncCallback\<Uint8Array>): void;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getMediaContent(resId: number): Promise\<Uint8Array>;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getMediaContentBase64(resId: number, callback: _AsyncCallback\<string>): void;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getMediaContentBase64(resId: number): Promise\<string>;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getRawFileContent(path: string, callback: _AsyncCallback\<Uint8Array>): void;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getRawFileContent(path: string): Promise\<Uint8Array>;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getRawFd(path: string, callback: _AsyncCallback\<RawFileDescriptor>): void;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:getRawFd(path: string): Promise\<RawFileDescriptor>;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:closeRawFd(path: string, callback: _AsyncCallback\<void>): void;|@ohos.resourceManager.d.ts| +|新增|NA|类名:ResourceManager<br>方法or属性:closeRawFd(path: string): Promise\<void>;|@ohos.resourceManager.d.ts| +|新增|NA|模块名: resource<br>类名: Resource|resource.d.ts| +|新增|NA|模块名: resource<br>类名: Resource<br>方法 or 属性: bundleName: string;|resource.d.ts| +|新增|NA|模块名: resource<br>类名: Resource<br>方法 or 属性: moduleName: string;|resource.d.ts| +|新增|NA|模块名: resource<br>类名: Resource<br>方法 or 属性: id: number;|resource.d.ts| +|删除|模块名:ohos.i18n<br>类名:i18n<br>方法 or 属性:function getSystemLanguages(): Array\<string>;|NA|@ohos.i18n.d.ts| +|删除|模块名:ohos.i18n<br>类名:i18n<br>方法 or 属性:function getSystemCountries(language: string): Array\<string>;|NA|@ohos.i18n.d.ts| +|删除|模块名:ohos.i18n<br>类名:i18n<br>方法 or 属性:function isSuggested(language: string, region?: string): boolean;|NA|@ohos.i18n.d.ts| +|删除|模块名:ohos.i18n<br>类名:i18n<br>方法 or 属性:function setSystemLanguage(language: string): boolean;|NA|@ohos.i18n.d.ts| +|删除|模块名:ohos.i18n<br>类名:i18n<br>方法 or 属性:function setSystemRegion(region: string): boolean;|NA|@ohos.i18n.d.ts| +|删除|模块名:ohos.i18n<br>类名:i18n<br>方法 or 属性:function setSystemLocale(locale: string): boolean;|NA|@ohos.i18n.d.ts| +|废弃版本有变化|类名:i18n<br>方法 or 属性:function getDisplayCountry(country: string, locale: string, sentenceCase?: boolean): string;<br>废弃版本:N/A|类名:i18n<br>方法 or 属性:function getDisplayCountry(country: string, locale: string, sentenceCase?: boolean): string;<br>废弃版本:9<br>代替接口:ohos.System.getDisplayCountry |@ohos.i18n.d.ts| +|废弃版本有变化|类名:i18n<br>方法 or 属性:function getDisplayLanguage(language: string, locale: string, sentenceCase?: boolean): string;<br>废弃版本:N/A|类名:i18n<br>方法 or 属性:function getDisplayLanguage(language: string, locale: string, sentenceCase?: boolean): string;<br>废弃版本:9<br>代替接口:ohos.System.getDisplayLanguage |@ohos.i18n.d.ts| +|废弃版本有变化|类名:i18n<br>方法 or 属性:function getSystemLanguage(): string;<br>废弃版本:N/A|类名:i18n<br>方法 or 属性:function getSystemLanguage(): string;<br>废弃版本:9<br>代替接口:ohos.System.getSystemLanguage |@ohos.i18n.d.ts| +|废弃版本有变化|类名:i18n<br>方法 or 属性:function getSystemRegion(): string;<br>废弃版本:N/A|类名:i18n<br>方法 or 属性:function getSystemRegion(): string;<br>废弃版本:9<br>代替接口:ohos.System.getSystemRegion |@ohos.i18n.d.ts| +|废弃版本有变化|类名:i18n<br>方法 or 属性:function getSystemLocale(): string;<br>废弃版本:N/A|类名:i18n<br>方法 or 属性:function getSystemLocale(): string;<br>废弃版本:9<br>代替接口:ohos.System.getSystemLocale |@ohos.i18n.d.ts| +|废弃版本有变化|类名:Util<br>废弃版本:N/A|类名:Util<br>废弃版本:9<br>代替接口:I18NUtil |@ohos.i18n.d.ts| +|废弃版本有变化|类名:Util<br>方法 or 属性:unitConvert(fromUnit: UnitInfo, toUnit: UnitInfo, value: number, locale: string, style?: string): string;<br>废弃版本:N/A|类名:Util<br>方法 or 属性:unitConvert(fromUnit: UnitInfo, toUnit: UnitInfo, value: number, locale: string, style?: string): string;<br>废弃版本:9<br>代替接口:I18NUtil.unitConvert |@ohos.i18n.d.ts| +|废弃版本有变化|类名:Character<br>废弃版本:N/A|类名:Character<br>废弃版本:9<br>代替接口:Unicode |@ohos.i18n.d.ts| +|废弃版本有变化|类名:Character<br>方法 or 属性:isDigit(char: string): boolean;<br>废弃版本:N/A|类名:Character<br>方法 or 属性:isDigit(char: string): boolean;<br>废弃版本:9<br>代替接口:Unicode.isDigit |@ohos.i18n.d.ts| +|废弃版本有变化|类名:Character<br>方法 or 属性:isSpaceChar(char: string): boolean;<br>废弃版本:N/A|类名:Character<br>方法 or 属性:isSpaceChar(char: string): boolean;<br>废弃版本:9<br>代替接口:Unicode.isSpaceChar |@ohos.i18n.d.ts| +|废弃版本有变化|类名:Character<br>方法 or 属性:isWhitespace(char: string): boolean;<br>废弃版本:N/A|类名:Character<br>方法 or 属性:isWhitespace(char: string): boolean;<br>废弃版本:9<br>代替接口:Unicode.isWhitespace |@ohos.i18n.d.ts| +|废弃版本有变化|类名:Character<br>方法 or 属性:isRTL(char: string): boolean;<br>废弃版本:N/A|类名:Character<br>方法 or 属性:isRTL(char: string): boolean;<br>废弃版本:9<br>代替接口:Unicode.isRTL |@ohos.i18n.d.ts| +|废弃版本有变化|类名:Character<br>方法 or 属性:isIdeograph(char: string): boolean;<br>废弃版本:N/A|类名:Character<br>方法 or 属性:isIdeograph(char: string): boolean;<br>废弃版本:9<br>代替接口:Unicode.isIdeograph |@ohos.i18n.d.ts| +|废弃版本有变化|类名:Character<br>方法 or 属性:isLetter(char: string): boolean;<br>废弃版本:N/A|类名:Character<br>方法 or 属性:isLetter(char: string): boolean;<br>废弃版本:9<br>代替接口:Unicode.isLetter |@ohos.i18n.d.ts| +|废弃版本有变化|类名:Character<br>方法 or 属性:isLowerCase(char: string): boolean;<br>废弃版本:N/A|类名:Character<br>方法 or 属性:isLowerCase(char: string): boolean;<br>废弃版本:9<br>代替接口:Unicode.isLowerCase |@ohos.i18n.d.ts| +|废弃版本有变化|类名:Character<br>方法 or 属性:isUpperCase(char: string): boolean;<br>废弃版本:N/A|类名:Character<br>方法 or 属性:isUpperCase(char: string): boolean;<br>废弃版本:9<br>代替接口:Unicode.isUpperCase |@ohos.i18n.d.ts| +|废弃版本有变化|类名:Character<br>方法 or 属性:getType(char: string): string;<br>废弃版本:N/A|类名:Character<br>方法 or 属性:getType(char: string): string;<br>废弃版本:9<br>代替接口:Unicode.getType |@ohos.i18n.d.ts| +|废弃版本有变化|类名:i18n<br>方法 or 属性:function is24HourClock(): boolean;<br>废弃版本:N/A|类名:i18n<br>方法 or 属性:function is24HourClock(): boolean;<br>废弃版本:9<br>代替接口:ohos.System.is24HourClock |@ohos.i18n.d.ts| +|废弃版本有变化|类名:i18n<br>方法 or 属性:function set24HourClock(option: boolean): boolean;<br>废弃版本:N/A|类名:i18n<br>方法 or 属性:function set24HourClock(option: boolean): boolean;<br>废弃版本:9<br>代替接口:ohos.System.set24HourClock |@ohos.i18n.d.ts| +|废弃版本有变化|类名:i18n<br>方法 or 属性:function addPreferredLanguage(language: string, index?: number): boolean;<br>废弃版本:N/A|类名:i18n<br>方法 or 属性:function addPreferredLanguage(language: string, index?: number): boolean;<br>废弃版本:9<br>代替接口:ohos.System.addPreferredLanguage |@ohos.i18n.d.ts| +|废弃版本有变化|类名:i18n<br>方法 or 属性:function removePreferredLanguage(index: number): boolean;<br>废弃版本:N/A|类名:i18n<br>方法 or 属性:function removePreferredLanguage(index: number): boolean;<br>废弃版本:9<br>代替接口:ohos.System.removePreferredLanguage |@ohos.i18n.d.ts| +|废弃版本有变化|类名:i18n<br>方法 or 属性:function getPreferredLanguageList(): Array\<string>;<br>废弃版本:N/A|类名:i18n<br>方法 or 属性:function getPreferredLanguageList(): Array\<string>;<br>废弃版本:9<br>代替接口:ohos.System.getPreferredLanguageList |@ohos.i18n.d.ts| +|废弃版本有变化|类名:i18n<br>方法 or 属性:function getFirstPreferredLanguage(): string;<br>废弃版本:N/A|类名:i18n<br>方法 or 属性:function getFirstPreferredLanguage(): string;<br>废弃版本:9<br>代替接口:ohos.System.getFirstPreferredLanguage |@ohos.i18n.d.ts| +|废弃版本有变化|类名:AsyncCallback<br>废弃版本:N/A|类名:AsyncCallback<br>废弃版本:9<br>代替接口:N/A|@ohos.resourceManager.d.ts| +|废弃版本有变化|类名:ResourceManager<br>方法 or 属性:getString(resId: number, callback: AsyncCallback\<string>): void;<br>废弃版本:N/A|类名:ResourceManager<br>方法 or 属性:getString(resId: number, callback: AsyncCallback\<string>): void;<br>废弃版本:9<br>代替接口:ohos.resourceManager.getStringValue |@ohos.resourceManager.d.ts| +|废弃版本有变化|类名:ResourceManager<br>方法 or 属性:getString(resId: number): Promise\<string>;<br>废弃版本:N/A|类名:ResourceManager<br>方法 or 属性:getString(resId: number): Promise\<string>;<br>废弃版本:9<br>代替接口:ohos.resourceManager.getStringValue |@ohos.resourceManager.d.ts| +|废弃版本有变化|类名:ResourceManager<br>方法 or 属性:getStringArray(resId: number, callback: AsyncCallback\<Array\<string>>): void;<br>废弃版本:N/A|类名:ResourceManager<br>方法 or 属性:getStringArray(resId: number, callback: AsyncCallback\<Array\<string>>): void;<br>废弃版本:9<br>代替接口:ohos.resourceManager.getStringArrayValue |@ohos.resourceManager.d.ts| +|废弃版本有变化|类名:ResourceManager<br>方法 or 属性:getStringArray(resId: number): Promise\<Array\<string>>;<br>废弃版本:N/A|类名:ResourceManager<br>方法 or 属性:getStringArray(resId: number): Promise\<Array\<string>>;<br>废弃版本:9<br>代替接口:ohos.resourceManager.getStringArrayValue |@ohos.resourceManager.d.ts| +|废弃版本有变化|类名:ResourceManager<br>方法 or 属性:getMedia(resId: number, callback: AsyncCallback\<Uint8Array>): void;<br>废弃版本:N/A|类名:ResourceManager<br>方法 or 属性:getMedia(resId: number, callback: AsyncCallback\<Uint8Array>): void;<br>废弃版本:9<br>代替接口:ohos.resourceManager.getMediaContent |@ohos.resourceManager.d.ts| +|废弃版本有变化|类名:ResourceManager<br>方法 or 属性:getMedia(resId: number): Promise\<Uint8Array>;<br>废弃版本:N/A|类名:ResourceManager<br>方法 or 属性:getMedia(resId: number): Promise\<Uint8Array>;<br>废弃版本:9<br>代替接口:ohos.resourceManager.getMediaContent |@ohos.resourceManager.d.ts| +|废弃版本有变化|类名:ResourceManager<br>方法 or 属性:getMediaBase64(resId: number, callback: AsyncCallback\<string>): void;<br>废弃版本:N/A|类名:ResourceManager<br>方法 or 属性:getMediaBase64(resId: number, callback: AsyncCallback\<string>): void;<br>废弃版本:9<br>代替接口:ohos.resourceManager.getMediaContentBase64 |@ohos.resourceManager.d.ts| +|废弃版本有变化|类名:ResourceManager<br>方法 or 属性:getMediaBase64(resId: number): Promise\<string>;<br>废弃版本:N/A|类名:ResourceManager<br>方法 or 属性:getMediaBase64(resId: number): Promise\<string>;<br>废弃版本:9<br>代替接口:ohos.resourceManager.getMediaContentBase64 |@ohos.resourceManager.d.ts| +|废弃版本有变化|类名:ResourceManager<br>方法 or 属性:getPluralString(resId: number, num: number, callback: AsyncCallback\<string>): void;<br>废弃版本:N/A|类名:ResourceManager<br>方法 or 属性:getPluralString(resId: number, num: number, callback: AsyncCallback\<string>): void;<br>废弃版本:9<br>代替接口:ohos.resourceManager.getPluralStringValue |@ohos.resourceManager.d.ts| +|废弃版本有变化|类名:ResourceManager<br>方法 or 属性:getPluralString(resId: number, num: number): Promise\<string>;<br>废弃版本:N/A|类名:ResourceManager<br>方法 or 属性:getPluralString(resId: number, num: number): Promise\<string>;<br>废弃版本:9<br>代替接口:ohos.resourceManager.getPluralStringValue |@ohos.resourceManager.d.ts| +|废弃版本有变化|类名:ResourceManager<br>方法 or 属性:getRawFile(path: string, callback: AsyncCallback\<Uint8Array>): void;<br>废弃版本:N/A|类名:ResourceManager<br>方法 or 属性:getRawFile(path: string, callback: AsyncCallback\<Uint8Array>): void;<br>废弃版本:9<br>代替接口:ohos.resourceManager.getRawFileContent |@ohos.resourceManager.d.ts| +|废弃版本有变化|类名:ResourceManager<br>方法 or 属性:getRawFile(path: string): Promise\<Uint8Array>;<br>废弃版本:N/A|类名:ResourceManager<br>方法 or 属性:getRawFile(path: string): Promise\<Uint8Array>;<br>废弃版本:9<br>代替接口:ohos.resourceManager.getRawFileContent |@ohos.resourceManager.d.ts| +|废弃版本有变化|类名:ResourceManager<br>方法 or 属性:getRawFileDescriptor(path: string, callback: AsyncCallback\<RawFileDescriptor>): void;<br>废弃版本:N/A|类名:ResourceManager<br>方法 or 属性:getRawFileDescriptor(path: string, callback: AsyncCallback\<RawFileDescriptor>): void;<br>废弃版本:9<br>代替接口:ohos.resourceManager.getRawFd |@ohos.resourceManager.d.ts| +|废弃版本有变化|类名:ResourceManager<br>方法 or 属性:getRawFileDescriptor(path: string): Promise\<RawFileDescriptor>;<br>废弃版本:N/A|类名:ResourceManager<br>方法 or 属性:getRawFileDescriptor(path: string): Promise\<RawFileDescriptor>;<br>废弃版本:9<br>代替接口:ohos.resourceManager.getRawFd |@ohos.resourceManager.d.ts| +|废弃版本有变化|类名:ResourceManager<br>方法 or 属性:closeRawFileDescriptor(path: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:ResourceManager<br>方法 or 属性:closeRawFileDescriptor(path: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.resourceManager.closeRawFd |@ohos.resourceManager.d.ts| +|废弃版本有变化|类名:ResourceManager<br>方法 or 属性:closeRawFileDescriptor(path: string): Promise\<void>;<br>废弃版本:N/A|类名:ResourceManager<br>方法 or 属性:closeRawFileDescriptor(path: string): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.resourceManager.closeRawFd |@ohos.resourceManager.d.ts| +|起始版本有变化|类名:Character<br>方法 or 属性:isDigit(char: string): boolean;<br>起始版本:N/A|类名:Character<br>方法 or 属性:isDigit(char: string): boolean;<br>起始版本:8|@ohos.i18n.d.ts| +|起始版本有变化|类名:Character<br>方法 or 属性:isSpaceChar(char: string): boolean;<br>起始版本:N/A|类名:Character<br>方法 or 属性:isSpaceChar(char: string): boolean;<br>起始版本:8|@ohos.i18n.d.ts| +|起始版本有变化|类名:Character<br>方法 or 属性:isWhitespace(char: string): boolean;<br>起始版本:N/A|类名:Character<br>方法 or 属性:isWhitespace(char: string): boolean;<br>起始版本:8|@ohos.i18n.d.ts| +|起始版本有变化|类名:Character<br>方法 or 属性:isRTL(char: string): boolean;<br>起始版本:N/A|类名:Character<br>方法 or 属性:isRTL(char: string): boolean;<br>起始版本:8|@ohos.i18n.d.ts| +|起始版本有变化|类名:Character<br>方法 or 属性:isIdeograph(char: string): boolean;<br>起始版本:N/A|类名:Character<br>方法 or 属性:isIdeograph(char: string): boolean;<br>起始版本:8|@ohos.i18n.d.ts| +|起始版本有变化|类名:Character<br>方法 or 属性:isLetter(char: string): boolean;<br>起始版本:N/A|类名:Character<br>方法 or 属性:isLetter(char: string): boolean;<br>起始版本:8|@ohos.i18n.d.ts| +|起始版本有变化|类名:Character<br>方法 or 属性:isLowerCase(char: string): boolean;<br>起始版本:N/A|类名:Character<br>方法 or 属性:isLowerCase(char: string): boolean;<br>起始版本:8|@ohos.i18n.d.ts| +|起始版本有变化|类名:Character<br>方法 or 属性:isUpperCase(char: string): boolean;<br>起始版本:N/A|类名:Character<br>方法 or 属性:isUpperCase(char: string): boolean;<br>起始版本:8|@ohos.i18n.d.ts| +|起始版本有变化|类名:Character<br>方法 or 属性:getType(char: string): string;<br>起始版本:N/A|类名:Character<br>方法 or 属性:getType(char: string): string;<br>起始版本:8|@ohos.i18n.d.ts| +|函数有变化|类名:ResourceManager<br>方法 or 属性:getDeviceCapability(callback: AsyncCallback\<DeviceCapability>): void;<br>|类名:ResourceManager<br>方法 or 属性:getDeviceCapability(callback: _AsyncCallback\<DeviceCapability>): void;<br>|@ohos.resourceManager.d.ts| +|函数有变化|类名:ResourceManager<br>方法 or 属性:getConfiguration(callback: AsyncCallback\<Configuration>): void;<br>|类名:ResourceManager<br>方法 or 属性:getConfiguration(callback: _AsyncCallback\<Configuration>): void;<br>|@ohos.resourceManager.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-graphic.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-graphic.md new file mode 100644 index 0000000000000000000000000000000000000000..f5c37b3baf8de599b41a131a45adbff4b01fd8cf --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-graphic.md @@ -0,0 +1,402 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.graphics.colorSpaceManager<br>类名: colorSpaceManager|@ohos.graphics.colorSpaceManager.d.ts| +|新增|NA|模块名: ohos.graphics.colorSpaceManager<br>类名: ColorSpace|@ohos.graphics.colorSpaceManager.d.ts| +|新增|NA|模块名: ohos.graphics.colorSpaceManager<br>类名: ColorSpace<br>方法 or 属性: UNKNOWN = 0|@ohos.graphics.colorSpaceManager.d.ts| +|新增|NA|模块名: ohos.graphics.colorSpaceManager<br>类名: ColorSpace<br>方法 or 属性: ADOBE_RGB_1998 = 1|@ohos.graphics.colorSpaceManager.d.ts| +|新增|NA|模块名: ohos.graphics.colorSpaceManager<br>类名: ColorSpace<br>方法 or 属性: DCI_P3 = 2|@ohos.graphics.colorSpaceManager.d.ts| +|新增|NA|模块名: ohos.graphics.colorSpaceManager<br>类名: ColorSpace<br>方法 or 属性: DISPLAY_P3 = 3|@ohos.graphics.colorSpaceManager.d.ts| +|新增|NA|模块名: ohos.graphics.colorSpaceManager<br>类名: ColorSpace<br>方法 or 属性: SRGB = 4|@ohos.graphics.colorSpaceManager.d.ts| +|新增|NA|模块名: ohos.graphics.colorSpaceManager<br>类名: ColorSpace<br>方法 or 属性: CUSTOM = 5|@ohos.graphics.colorSpaceManager.d.ts| +|新增|NA|模块名: ohos.graphics.colorSpaceManager<br>类名: ColorSpacePrimaries|@ohos.graphics.colorSpaceManager.d.ts| +|新增|NA|模块名: ohos.graphics.colorSpaceManager<br>类名: ColorSpacePrimaries<br>方法 or 属性: redX: number;|@ohos.graphics.colorSpaceManager.d.ts| +|新增|NA|模块名: ohos.graphics.colorSpaceManager<br>类名: ColorSpacePrimaries<br>方法 or 属性: redY: number;|@ohos.graphics.colorSpaceManager.d.ts| +|新增|NA|模块名: ohos.graphics.colorSpaceManager<br>类名: ColorSpacePrimaries<br>方法 or 属性: greenX: number;|@ohos.graphics.colorSpaceManager.d.ts| +|新增|NA|模块名: ohos.graphics.colorSpaceManager<br>类名: ColorSpacePrimaries<br>方法 or 属性: greenY: number;|@ohos.graphics.colorSpaceManager.d.ts| +|新增|NA|模块名: ohos.graphics.colorSpaceManager<br>类名: ColorSpacePrimaries<br>方法 or 属性: blueX: number;|@ohos.graphics.colorSpaceManager.d.ts| +|新增|NA|模块名: ohos.graphics.colorSpaceManager<br>类名: ColorSpacePrimaries<br>方法 or 属性: blueY: number;|@ohos.graphics.colorSpaceManager.d.ts| +|新增|NA|模块名: ohos.graphics.colorSpaceManager<br>类名: ColorSpacePrimaries<br>方法 or 属性: whitePointX: number;|@ohos.graphics.colorSpaceManager.d.ts| +|新增|NA|模块名: ohos.graphics.colorSpaceManager<br>类名: ColorSpacePrimaries<br>方法 or 属性: whitePointY: number;|@ohos.graphics.colorSpaceManager.d.ts| +|新增|NA|模块名: ohos.graphics.colorSpaceManager<br>类名: ColorSpaceManager|@ohos.graphics.colorSpaceManager.d.ts| +|新增|NA|模块名: ohos.graphics.colorSpaceManager<br>类名: ColorSpaceManager<br>方法 or 属性: getColorSpaceName(): ColorSpace;|@ohos.graphics.colorSpaceManager.d.ts| +|新增|NA|模块名: ohos.graphics.colorSpaceManager<br>类名: ColorSpaceManager<br>方法 or 属性: getWhitePoint(): Array\<number>;|@ohos.graphics.colorSpaceManager.d.ts| +|新增|NA|模块名: ohos.graphics.colorSpaceManager<br>类名: ColorSpaceManager<br>方法 or 属性: getGamma(): number;|@ohos.graphics.colorSpaceManager.d.ts| +|新增|NA|模块名: ohos.graphics.colorSpaceManager<br>类名: colorSpaceManager<br>方法 or 属性: function create(colorSpaceName: ColorSpace): ColorSpaceManager;|@ohos.graphics.colorSpaceManager.d.ts| +|新增|NA|模块名: ohos.graphics.colorSpaceManager<br>类名: colorSpaceManager<br>方法 or 属性: function create(primaries: ColorSpacePrimaries, gamma: number): ColorSpaceManager;|@ohos.graphics.colorSpaceManager.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly READ_BUFFER: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNPACK_ROW_LENGTH: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNPACK_SKIP_ROWS: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNPACK_SKIP_PIXELS: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly PACK_ROW_LENGTH: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly PACK_SKIP_ROWS: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly PACK_SKIP_PIXELS: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly COLOR: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly DEPTH: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly STENCIL: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RED: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RGB8: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RGBA8: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RGB10_A2: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly TEXTURE_BINDING_3D: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNPACK_SKIP_IMAGES: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNPACK_IMAGE_HEIGHT: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly TEXTURE_3D: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly TEXTURE_WRAP_R: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly MAX_3D_TEXTURE_SIZE: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNSIGNED_INT_2_10_10_10_REV: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly MAX_ELEMENTS_VERTICES: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly MAX_ELEMENTS_INDICES: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly TEXTURE_MIN_LOD: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly TEXTURE_MAX_LOD: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly TEXTURE_BASE_LEVEL: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly TEXTURE_MAX_LEVEL: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly MIN: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly MAX: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly DEPTH_COMPONENT24: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly MAX_TEXTURE_LOD_BIAS: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly TEXTURE_COMPARE_MODE: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly TEXTURE_COMPARE_FUNC: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly CURRENT_QUERY: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly QUERY_RESULT: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly QUERY_RESULT_AVAILABLE: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly STREAM_READ: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly STREAM_COPY: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly STATIC_READ: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly STATIC_COPY: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly DYNAMIC_READ: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly DYNAMIC_COPY: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly MAX_DRAW_BUFFERS: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly DRAW_BUFFER0: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly DRAW_BUFFER1: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly DRAW_BUFFER2: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly DRAW_BUFFER3: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly DRAW_BUFFER4: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly DRAW_BUFFER5: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly DRAW_BUFFER6: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly DRAW_BUFFER7: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly DRAW_BUFFER8: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly DRAW_BUFFER9: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly DRAW_BUFFER10: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly DRAW_BUFFER11: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly DRAW_BUFFER12: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly DRAW_BUFFER13: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly DRAW_BUFFER14: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly DRAW_BUFFER15: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly MAX_FRAGMENT_UNIFORM_COMPONENTS: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly MAX_VERTEX_UNIFORM_COMPONENTS: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly SAMPLER_3D: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly SAMPLER_2D_SHADOW: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly FRAGMENT_SHADER_DERIVATIVE_HINT: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly PIXEL_PACK_BUFFER: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly PIXEL_UNPACK_BUFFER: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly PIXEL_PACK_BUFFER_BINDING: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly PIXEL_UNPACK_BUFFER_BINDING: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly FLOAT_MAT2x3: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly FLOAT_MAT2x4: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly FLOAT_MAT3x2: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly FLOAT_MAT3x4: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly FLOAT_MAT4x2: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly FLOAT_MAT4x3: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly SRGB: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly SRGB8: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly SRGB8_ALPHA8: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly COMPARE_REF_TO_TEXTURE: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RGBA32F: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RGB32F: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RGBA16F: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RGB16F: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly VERTEX_ATTRIB_ARRAY_INTEGER: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly MAX_ARRAY_TEXTURE_LAYERS: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly MIN_PROGRAM_TEXEL_OFFSET: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly MAX_PROGRAM_TEXEL_OFFSET: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly MAX_VARYING_COMPONENTS: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly TEXTURE_2D_ARRAY: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly TEXTURE_BINDING_2D_ARRAY: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly R11F_G11F_B10F: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNSIGNED_INT_10F_11F_11F_REV: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RGB9_E5: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNSIGNED_INT_5_9_9_9_REV: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly TRANSFORM_FEEDBACK_BUFFER_MODE: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly TRANSFORM_FEEDBACK_VARYINGS: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly TRANSFORM_FEEDBACK_BUFFER_START: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly TRANSFORM_FEEDBACK_BUFFER_SIZE: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RASTERIZER_DISCARD: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly INTERLEAVED_ATTRIBS: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly SEPARATE_ATTRIBS: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly TRANSFORM_FEEDBACK_BUFFER: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly TRANSFORM_FEEDBACK_BUFFER_BINDING: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RGBA32UI: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RGB32UI: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RGBA16UI: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RGB16UI: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RGBA8UI: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RGB8UI: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RGBA32I: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RGB32I: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RGBA16I: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RGB16I: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RGBA8I: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RGB8I: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RED_INTEGER: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RGB_INTEGER: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RGBA_INTEGER: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly SAMPLER_2D_ARRAY: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly SAMPLER_2D_ARRAY_SHADOW: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly SAMPLER_CUBE_SHADOW: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNSIGNED_INT_VEC2: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNSIGNED_INT_VEC3: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNSIGNED_INT_VEC4: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly INT_SAMPLER_2D: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly INT_SAMPLER_3D: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly INT_SAMPLER_CUBE: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly INT_SAMPLER_2D_ARRAY: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNSIGNED_INT_SAMPLER_2D: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNSIGNED_INT_SAMPLER_3D: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNSIGNED_INT_SAMPLER_CUBE: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNSIGNED_INT_SAMPLER_2D_ARRAY: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly DEPTH_COMPONENT32F: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly DEPTH32F_STENCIL8: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly FLOAT_32_UNSIGNED_INT_24_8_REV: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly FRAMEBUFFER_ATTACHMENT_RED_SIZE: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly FRAMEBUFFER_ATTACHMENT_GREEN_SIZE: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly FRAMEBUFFER_ATTACHMENT_BLUE_SIZE: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly FRAMEBUFFER_DEFAULT: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNSIGNED_INT_24_8: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly DEPTH24_STENCIL8: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNSIGNED_NORMALIZED: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly DRAW_FRAMEBUFFER_BINDING: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly READ_FRAMEBUFFER: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly DRAW_FRAMEBUFFER: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly READ_FRAMEBUFFER_BINDING: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RENDERBUFFER_SAMPLES: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly MAX_COLOR_ATTACHMENTS: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly COLOR_ATTACHMENT1: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly COLOR_ATTACHMENT2: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly COLOR_ATTACHMENT3: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly COLOR_ATTACHMENT4: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly COLOR_ATTACHMENT5: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly COLOR_ATTACHMENT6: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly COLOR_ATTACHMENT7: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly COLOR_ATTACHMENT8: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly COLOR_ATTACHMENT9: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly COLOR_ATTACHMENT10: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly COLOR_ATTACHMENT11: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly COLOR_ATTACHMENT12: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly COLOR_ATTACHMENT13: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly COLOR_ATTACHMENT14: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly COLOR_ATTACHMENT15: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly FRAMEBUFFER_INCOMPLETE_MULTISAMPLE: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly MAX_SAMPLES: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly HALF_FLOAT: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RG: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RG_INTEGER: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly R8: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RG8: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly R16F: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly R32F: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RG16F: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RG32F: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly R8I: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly R8UI: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly R16I: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly R16UI: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly R32I: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly R32UI: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RG8I: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RG8UI: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RG16I: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RG16UI: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RG32I: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RG32UI: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly VERTEX_ARRAY_BINDING: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly R8_SNORM: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RG8_SNORM: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RGB8_SNORM: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RGBA8_SNORM: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly SIGNED_NORMALIZED: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly COPY_READ_BUFFER: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly COPY_WRITE_BUFFER: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly COPY_READ_BUFFER_BINDING: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly COPY_WRITE_BUFFER_BINDING: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNIFORM_BUFFER: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNIFORM_BUFFER_BINDING: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNIFORM_BUFFER_START: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNIFORM_BUFFER_SIZE: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly MAX_VERTEX_UNIFORM_BLOCKS: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly MAX_FRAGMENT_UNIFORM_BLOCKS: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly MAX_COMBINED_UNIFORM_BLOCKS: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly MAX_UNIFORM_BUFFER_BINDINGS: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly MAX_UNIFORM_BLOCK_SIZE: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNIFORM_BUFFER_OFFSET_ALIGNMENT: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly ACTIVE_UNIFORM_BLOCKS: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNIFORM_TYPE: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNIFORM_SIZE: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNIFORM_BLOCK_INDEX: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNIFORM_OFFSET: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNIFORM_ARRAY_STRIDE: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNIFORM_MATRIX_STRIDE: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNIFORM_IS_ROW_MAJOR: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNIFORM_BLOCK_BINDING: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNIFORM_BLOCK_DATA_SIZE: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNIFORM_BLOCK_ACTIVE_UNIFORMS: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly INVALID_INDEX: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly MAX_VERTEX_OUTPUT_COMPONENTS: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly MAX_FRAGMENT_INPUT_COMPONENTS: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly MAX_SERVER_WAIT_TIMEOUT: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly OBJECT_TYPE: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly SYNC_CONDITION: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly SYNC_STATUS: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly SYNC_FLAGS: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly SYNC_FENCE: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly SYNC_GPU_COMMANDS_COMPLETE: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly UNSIGNALED: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly SIGNALED: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly ALREADY_SIGNALED: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly TIMEOUT_EXPIRED: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly CONDITION_SATISFIED: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly WAIT_FAILED: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly SYNC_FLUSH_COMMANDS_BIT: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly VERTEX_ATTRIB_ARRAY_DIVISOR: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly ANY_SAMPLES_PASSED: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly ANY_SAMPLES_PASSED_CONSERVATIVE: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly SAMPLER_BINDING: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly RGB10_A2UI: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly INT_2_10_10_10_REV: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly TRANSFORM_FEEDBACK: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly TRANSFORM_FEEDBACK_PAUSED: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly TRANSFORM_FEEDBACK_ACTIVE: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly TRANSFORM_FEEDBACK_BINDING: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly TEXTURE_IMMUTABLE_FORMAT: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly MAX_ELEMENT_INDEX: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly TEXTURE_IMMUTABLE_LEVELS: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:readonly MAX_CLIENT_WAIT_TIMEOUT_WEBGL: webgl.GLenum;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:texImage3D(target: webgl.GLenum, level: webgl.GLint, internalformat: webgl.GLint, width: webgl.GLsizei, height: webgl.GLsizei, depth: webgl.GLsizei, border: webgl.GLint, format: webgl.GLenum, type: webgl.GLenum, pboOffset: webgl.GLintptr): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:texImage3D(target: webgl.GLenum, level: webgl.GLint, internalformat: webgl.GLint, width: webgl.GLsizei, height: webgl.GLsizei, depth: webgl.GLsizei, border: webgl.GLint, format: webgl.GLenum, type: webgl.GLenum, source: webgl.TexImageSource): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:texImage3D(target: webgl.GLenum, level: webgl.GLint, internalformat: webgl.GLint, width: webgl.GLsizei, height: webgl.GLsizei, depth: webgl.GLsizei, border: webgl.GLint, format: webgl.GLenum, type: webgl.GLenum, srcData: ArrayBufferView \| null): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:texImage3D(target: webgl.GLenum, level: webgl.GLint, internalformat: webgl.GLint, width: webgl.GLsizei, height: webgl.GLsizei, depth: webgl.GLsizei, border: webgl.GLint, format: webgl.GLenum, type: webgl.GLenum, srcData: ArrayBufferView, srcOffset: webgl.GLuint): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:texSubImage3D(target: webgl.GLenum, level: webgl.GLint, xoffset: webgl.GLint, yoffset: webgl.GLint, zoffset: webgl.GLint, width: webgl.GLsizei, height: webgl.GLsizei, depth: webgl.GLsizei, format: webgl.GLenum, type: webgl.GLenum, pboOffset: webgl.GLintptr): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:texSubImage3D(target: webgl.GLenum, level: webgl.GLint, xoffset: webgl.GLint, yoffset: webgl.GLint, zoffset: webgl.GLint, width: webgl.GLsizei, height: webgl.GLsizei, depth: webgl.GLsizei, format: webgl.GLenum, type: webgl.GLenum, source: webgl.TexImageSource): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:texSubImage3D(target: webgl.GLenum, level: webgl.GLint, xoffset: webgl.GLint, yoffset: webgl.GLint, zoffset: webgl.GLint, width: webgl.GLsizei, height: webgl.GLsizei, depth: webgl.GLsizei, format: webgl.GLenum, type: webgl.GLenum, srcData: ArrayBufferView \| null, srcOffset?: webgl.GLuint): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:compressedTexImage3D(target: webgl.GLenum, level: webgl.GLint, internalformat: webgl.GLenum, width: webgl.GLsizei, height: webgl.GLsizei, depth: webgl.GLsizei, border: webgl.GLint, imageSize: webgl.GLsizei, offset: webgl.GLintptr): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:compressedTexImage3D(target: webgl.GLenum, level: webgl.GLint, internalformat: webgl.GLenum, width: webgl.GLsizei, height: webgl.GLsizei, depth: webgl.GLsizei, border: webgl.GLint, srcData: ArrayBufferView, srcOffset?: webgl.GLuint, srcLengthOverride?: webgl.GLuint): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:compressedTexSubImage3D(target: webgl.GLenum, level: webgl.GLint, xoffset: webgl.GLint, yoffset: webgl.GLint, zoffset: webgl.GLint, width: webgl.GLsizei, height: webgl.GLsizei, depth: webgl.GLsizei, format: webgl.GLenum, imageSize: webgl.GLsizei, offset: webgl.GLintptr): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextBase<br>方法or属性:compressedTexSubImage3D(target: webgl.GLenum, level: webgl.GLint, xoffset: webgl.GLint, yoffset: webgl.GLint, zoffset: webgl.GLint, width: webgl.GLsizei, height: webgl.GLsizei, depth: webgl.GLsizei, format: webgl.GLenum, srcData: ArrayBufferView, srcOffset?: webgl.GLuint, srcLengthOverride?: webgl.GLuint): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextOverloads<br>方法or属性:bufferData(target: webgl.GLenum, size: webgl.GLsizeiptr, usage: webgl.GLenum): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextOverloads<br>方法or属性:bufferData(target: webgl.GLenum, srcData: BufferSource \| null, usage: webgl.GLenum): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextOverloads<br>方法or属性:bufferSubData(target: webgl.GLenum, dstByteOffset: webgl.GLintptr, srcData: BufferSource): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextOverloads<br>方法or属性:bufferData(target: webgl.GLenum, srcData: ArrayBufferView, usage: webgl.GLenum, srcOffset: webgl.GLuint, length?: webgl.GLuint): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextOverloads<br>方法or属性:bufferSubData(target: webgl.GLenum, dstByteOffset: webgl.GLintptr, srcData: ArrayBufferView, srcOffset: webgl.GLuint, length?: webgl.GLuint): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextOverloads<br>方法or属性:texImage2D(target: webgl.GLenum, level: webgl.GLint, internalformat: webgl.GLint, width: webgl.GLsizei, height: webgl.GLsizei, border: webgl.GLint, format: webgl.GLenum, type: webgl.GLenum, pixels: ArrayBufferView \| null): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextOverloads<br>方法or属性:texImage2D(target: webgl.GLenum, level: webgl.GLint, internalformat: webgl.GLint, format: webgl.GLenum, type: webgl.GLenum, source: webgl.TexImageSource): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextOverloads<br>方法or属性:texSubImage2D(target: webgl.GLenum, level: webgl.GLint, xoffset: webgl.GLint, yoffset: webgl.GLint, width: webgl.GLsizei, height: webgl.GLsizei, format: webgl.GLenum, type: webgl.GLenum, pixels: ArrayBufferView \| null): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextOverloads<br>方法or属性:texSubImage2D(target: webgl.GLenum, level: webgl.GLint, xoffset: webgl.GLint, yoffset: webgl.GLint, format: webgl.GLenum, type: webgl.GLenum, source: webgl.TexImageSource): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextOverloads<br>方法or属性:texImage2D(target: webgl.GLenum, level: webgl.GLint, internalformat: webgl.GLint, width: webgl.GLsizei, height: webgl.GLsizei, border: webgl.GLint, format: webgl.GLenum, type: webgl.GLenum, pboOffset: webgl.GLintptr): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextOverloads<br>方法or属性:texImage2D(target: webgl.GLenum, level: webgl.GLint, internalformat: webgl.GLint, width: webgl.GLsizei, height: webgl.GLsizei, border: webgl.GLint, format: webgl.GLenum, type: webgl.GLenum, source: webgl.TexImageSource): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextOverloads<br>方法or属性:texImage2D(target: webgl.GLenum, level: webgl.GLint, internalformat: webgl.GLint, width: webgl.GLsizei, height: webgl.GLsizei, border: webgl.GLint, format: webgl.GLenum, type: webgl.GLenum, srcData: ArrayBufferView, srcOffset: webgl.GLuint): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextOverloads<br>方法or属性:texSubImage2D(target: webgl.GLenum, level: webgl.GLint, xoffset: webgl.GLint, yoffset: webgl.GLint, width: webgl.GLsizei, height: webgl.GLsizei, format: webgl.GLenum, type: webgl.GLenum, pboOffset: webgl.GLintptr): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextOverloads<br>方法or属性:texSubImage2D(target: webgl.GLenum, level: webgl.GLint, xoffset: webgl.GLint, yoffset: webgl.GLint, width: webgl.GLsizei, height: webgl.GLsizei, format: webgl.GLenum, type: webgl.GLenum, source: webgl.TexImageSource): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextOverloads<br>方法or属性:texSubImage2D(target: webgl.GLenum, level: webgl.GLint, xoffset: webgl.GLint, yoffset: webgl.GLint, width: webgl.GLsizei, height: webgl.GLsizei, format: webgl.GLenum, type: webgl.GLenum, srcData: ArrayBufferView, srcOffset: webgl.GLuint): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextOverloads<br>方法or属性:compressedTexImage2D(target: webgl.GLenum, level: webgl.GLint, internalformat: webgl.GLenum, width: webgl.GLsizei, height: webgl.GLsizei, border: webgl.GLint, imageSize: webgl.GLsizei, offset: webgl.GLintptr): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextOverloads<br>方法or属性:compressedTexImage2D(target: webgl.GLenum, level: webgl.GLint, internalformat: webgl.GLenum, width: webgl.GLsizei, height: webgl.GLsizei, border: webgl.GLint, srcData: ArrayBufferView, srcOffset?: webgl.GLuint, srcLengthOverride?: webgl.GLuint): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextOverloads<br>方法or属性:compressedTexSubImage2D(target: webgl.GLenum, level: webgl.GLint, xoffset: webgl.GLint, yoffset: webgl.GLint, width: webgl.GLsizei, height: webgl.GLsizei, format: webgl.GLenum, imageSize: webgl.GLsizei, offset: webgl.GLintptr): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextOverloads<br>方法or属性:compressedTexSubImage2D(target: webgl.GLenum, level: webgl.GLint, xoffset: webgl.GLint, yoffset: webgl.GLint, width: webgl.GLsizei, height: webgl.GLsizei, format: webgl.GLenum, srcData: ArrayBufferView, srcOffset?: webgl.GLuint, srcLengthOverride?: webgl.GLuint): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextOverloads<br>方法or属性:readPixels(x: webgl.GLint, y: webgl.GLint, width: webgl.GLsizei, height: webgl.GLsizei, format: webgl.GLenum, type: webgl.GLenum, dstData: ArrayBufferView \| null): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextOverloads<br>方法or属性:readPixels(x: webgl.GLint, y: webgl.GLint, width: webgl.GLsizei, height: webgl.GLsizei, format: webgl.GLenum, type: webgl.GLenum, offset: webgl.GLintptr): void;|webgl2.d.ts| +|新增|NA|类名:WebGL2RenderingContextOverloads<br>方法or属性:readPixels(x: webgl.GLint, y: webgl.GLint, width: webgl.GLsizei, height: webgl.GLsizei, format: webgl.GLenum, type: webgl.GLenum, dstData: ArrayBufferView, dstOffset: webgl.GLuint): void;|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:copyBufferSubData(readTarget: GLenum, writeTarget: GLenum, readOffset: GLintptr, writeOffset: GLintptr, size: GLsizeiptr): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:copyBufferSubData(readTarget: webgl.GLenum, writeTarget: webgl.GLenum, readOffset: webgl.GLintptr, writeOffset: webgl.GLintptr, size: webgl.GLsizeiptr): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:getBufferSubData(target: GLenum, srcByteOffset: GLintptr, dstBuffer: ArrayBufferView, dstOffset?: GLuint, length?: GLuint): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:getBufferSubData(target: webgl.GLenum, srcByteOffset: webgl.GLintptr, dstBuffer: ArrayBufferView, dstOffset?: webgl.GLuint, length?: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:blitFramebuffer(srcX0: GLint, srcY0: GLint, srcX1: GLint, srcY1: GLint, dstX0: GLint, dstY0: GLint, dstX1: GLint, dstY1: GLint, mask: GLbitfield, filter: GLenum): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:blitFramebuffer(srcX0: webgl.GLint, srcY0: webgl.GLint, srcX1: webgl.GLint, srcY1: webgl.GLint, dstX0: webgl.GLint, dstY0: webgl.GLint, dstX1: webgl.GLint, dstY1: webgl.GLint, mask: webgl.GLbitfield, filter: webgl.GLenum): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:framebufferTextureLayer(target: GLenum, attachment: GLenum, texture: WebGLTexture \| null, level: GLint, layer: GLint): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:framebufferTextureLayer(target: webgl.GLenum, attachment: webgl.GLenum, texture: webgl.WebGLTexture \| null, level: webgl.GLint, layer: webgl.GLint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:invalidateFramebuffer(target: GLenum, attachments: GLenum[]): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:invalidateFramebuffer(target: webgl.GLenum, attachments: webgl.GLenum[]): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:invalidateSubFramebuffer(target: GLenum, attachments: GLenum[], x: GLint, y: GLint, width: GLsizei, height: GLsizei): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:invalidateSubFramebuffer(target: webgl.GLenum, attachments: webgl.GLenum[], x: webgl.GLint, y: webgl.GLint, width: webgl.GLsizei, height: webgl.GLsizei): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:readBuffer(src: GLenum): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:readBuffer(src: webgl.GLenum): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:getInternalformatParameter(target: GLenum, internalformat: GLenum, pname: GLenum): any;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:getInternalformatParameter(target: webgl.GLenum, internalformat: webgl.GLenum, pname: webgl.GLenum): any;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:renderbufferStorageMultisample(target: GLenum, samples: GLsizei, internalformat: GLenum, width: GLsizei, height: GLsizei): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:renderbufferStorageMultisample(target: webgl.GLenum, samples: webgl.GLsizei, internalformat: webgl.GLenum, width: webgl.GLsizei, height: webgl.GLsizei): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:texStorage2D(target: GLenum, levels: GLsizei, internalformat: GLenum, width: GLsizei, height: GLsizei): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:texStorage2D(target: webgl.GLenum, levels: webgl.GLsizei, internalformat: webgl.GLenum, width: webgl.GLsizei, height: webgl.GLsizei): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:texStorage3D(target: GLenum, levels: GLsizei, internalformat: GLenum, width: GLsizei, height: GLsizei, depth: GLsizei): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:texStorage3D(target: webgl.GLenum, levels: webgl.GLsizei, internalformat: webgl.GLenum, width: webgl.GLsizei, height: webgl.GLsizei, depth: webgl.GLsizei): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:copyTexSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, x: GLint, y: GLint, width: GLsizei, height: GLsizei): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:copyTexSubImage3D(target: webgl.GLenum, level: webgl.GLint, xoffset: webgl.GLint, yoffset: webgl.GLint, zoffset: webgl.GLint, x: webgl.GLint, y: webgl.GLint, width: webgl.GLsizei, height: webgl.GLsizei): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:getFragDataLocation(program: WebGLProgram, name: string): GLint;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:getFragDataLocation(program: webgl.WebGLProgram, name: string): webgl.GLint;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:uniform1ui(location: WebGLUniformLocation \| null, v0: GLuint): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:uniform1ui(location: webgl.WebGLUniformLocation \| null, v0: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:uniform2ui(location: WebGLUniformLocation \| null, v0: GLuint, v1: GLuint): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:uniform2ui(location: webgl.WebGLUniformLocation \| null, v0: webgl.GLuint, v1: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:uniform3ui(location: WebGLUniformLocation \| null, v0: GLuint, v1: GLuint, v2: GLuint): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:uniform3ui(location: webgl.WebGLUniformLocation \| null, v0: webgl.GLuint, v1: webgl.GLuint, v2: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:uniform4ui(location: WebGLUniformLocation \| null, v0: GLuint, v1: GLuint, v2: GLuint, v3: GLuint): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:uniform4ui(location: webgl.WebGLUniformLocation \| null, v0: webgl.GLuint, v1: webgl.GLuint, v2: webgl.GLuint, v3: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:uniform1uiv(location: WebGLUniformLocation \| null, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:uniform1uiv(location: webgl.WebGLUniformLocation \| null, data: Uint32List, srcOffset?: webgl.GLuint, srcLength?: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:uniform2uiv(location: WebGLUniformLocation \| null, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:uniform2uiv(location: webgl.WebGLUniformLocation \| null, data: Uint32List, srcOffset?: webgl.GLuint, srcLength?: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:uniform3uiv(location: WebGLUniformLocation \| null, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:uniform3uiv(location: webgl.WebGLUniformLocation \| null, data: Uint32List, srcOffset?: webgl.GLuint, srcLength?: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:uniform4uiv(location: WebGLUniformLocation \| null, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:uniform4uiv(location: webgl.WebGLUniformLocation \| null, data: Uint32List, srcOffset?: webgl.GLuint, srcLength?: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:uniformMatrix3x2fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:uniformMatrix3x2fv(location: webgl.WebGLUniformLocation \| null, transpose: webgl.GLboolean, data: webgl.Float32List, srcOffset?: webgl.GLuint, srcLength?: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:uniformMatrix4x2fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:uniformMatrix4x2fv(location: webgl.WebGLUniformLocation \| null, transpose: webgl.GLboolean, data: webgl.Float32List, srcOffset?: webgl.GLuint, srcLength?: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:uniformMatrix2x3fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:uniformMatrix2x3fv(location: webgl.WebGLUniformLocation \| null, transpose: webgl.GLboolean, data: webgl.Float32List, srcOffset?: webgl.GLuint, srcLength?: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:uniformMatrix4x3fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:uniformMatrix4x3fv(location: webgl.WebGLUniformLocation \| null, transpose: webgl.GLboolean, data: webgl.Float32List, srcOffset?: webgl.GLuint, srcLength?: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:uniformMatrix2x4fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:uniformMatrix2x4fv(location: webgl.WebGLUniformLocation \| null, transpose: webgl.GLboolean, data: webgl.Float32List, srcOffset?: webgl.GLuint, srcLength?: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:uniformMatrix3x4fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:uniformMatrix3x4fv(location: webgl.WebGLUniformLocation \| null, transpose: webgl.GLboolean, data: webgl.Float32List, srcOffset?: webgl.GLuint, srcLength?: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:vertexAttribI4i(index: GLuint, x: GLint, y: GLint, z: GLint, w: GLint): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:vertexAttribI4i(index: webgl.GLuint, x: webgl.GLint, y: webgl.GLint, z: webgl.GLint, w: webgl.GLint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:vertexAttribI4iv(index: GLuint, values: Int32List): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:vertexAttribI4iv(index: webgl.GLuint, values: webgl.Int32List): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:vertexAttribI4ui(index: GLuint, x: GLuint, y: GLuint, z: GLuint, w: GLuint): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:vertexAttribI4ui(index: webgl.GLuint, x: webgl.GLuint, y: webgl.GLuint, z: webgl.GLuint, w: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:vertexAttribI4uiv(index: GLuint, values: Uint32List): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:vertexAttribI4uiv(index: webgl.GLuint, values: Uint32List): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:vertexAttribIPointer(index: GLuint, size: GLint, type: GLenum, stride: GLsizei, offset: GLintptr): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:vertexAttribIPointer(index: webgl.GLuint, size: webgl.GLint, type: webgl.GLenum, stride: webgl.GLsizei, offset: webgl.GLintptr): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:vertexAttribDivisor(index: GLuint, divisor: GLuint): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:vertexAttribDivisor(index: webgl.GLuint, divisor: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:drawArraysInstanced(mode: GLenum, first: GLint, count: GLsizei, instanceCount: GLsizei): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:drawArraysInstanced(mode: webgl.GLenum, first: webgl.GLint, count: webgl.GLsizei, instanceCount: webgl.GLsizei): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:drawElementsInstanced(mode: GLenum, count: GLsizei, type: GLenum, offset: GLintptr, instanceCount: GLsizei): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:drawElementsInstanced(mode: webgl.GLenum, count: webgl.GLsizei, type: webgl.GLenum, offset: webgl.GLintptr, instanceCount: webgl.GLsizei): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:drawRangeElements(mode: GLenum, start: GLuint, end: GLuint, count: GLsizei, type: GLenum, offset: GLintptr): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:drawRangeElements(mode: webgl.GLenum, start: webgl.GLuint, end: webgl.GLuint, count: webgl.GLsizei, type: webgl.GLenum, offset: webgl.GLintptr): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:drawBuffers(buffers: GLenum[]): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:drawBuffers(buffers: webgl.GLenum[]): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:clearBufferfv(buffer: GLenum, drawbuffer: GLint, values: Float32List, srcOffset?: GLuint): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:clearBufferfv(buffer: webgl.GLenum, drawbuffer: webgl.GLint, values: webgl.Float32List, srcOffset?: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:clearBufferiv(buffer: GLenum, drawbuffer: GLint, values: Int32List, srcOffset?: GLuint): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:clearBufferiv(buffer: webgl.GLenum, drawbuffer: webgl.GLint, values: webgl.Int32List, srcOffset?: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:clearBufferuiv(buffer: GLenum, drawbuffer: GLint, values: Uint32List, srcOffset?: GLuint): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:clearBufferuiv(buffer: webgl.GLenum, drawbuffer: webgl.GLint, values: Uint32List, srcOffset?: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:clearBufferfi(buffer: GLenum, drawbuffer: GLint, depth: GLfloat, stencil: GLint): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:clearBufferfi(buffer: webgl.GLenum, drawbuffer: webgl.GLint, depth: webgl.GLfloat, stencil: webgl.GLint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:isQuery(query: WebGLQuery \| null): GLboolean;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:isQuery(query: WebGLQuery \| null): webgl.GLboolean;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:beginQuery(target: GLenum, query: WebGLQuery): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:beginQuery(target: webgl.GLenum, query: WebGLQuery): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:endQuery(target: GLenum): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:endQuery(target: webgl.GLenum): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:getQuery(target: GLenum, pname: GLenum): WebGLQuery \| null;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:getQuery(target: webgl.GLenum, pname: webgl.GLenum): WebGLQuery \| null;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:getQueryParameter(query: WebGLQuery, pname: GLenum): any;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:getQueryParameter(query: WebGLQuery, pname: webgl.GLenum): any;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:isSampler(sampler: WebGLSampler \| null): GLboolean;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:isSampler(sampler: WebGLSampler \| null): webgl.GLboolean;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:bindSampler(unit: GLuint, sampler: WebGLSampler \| null): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:bindSampler(unit: webgl.GLuint, sampler: WebGLSampler \| null): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:samplerParameteri(sampler: WebGLSampler, pname: GLenum, param: GLint): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:samplerParameteri(sampler: WebGLSampler, pname: webgl.GLenum, param: webgl.GLint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:samplerParameterf(sampler: WebGLSampler, pname: GLenum, param: GLfloat): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:samplerParameterf(sampler: WebGLSampler, pname: webgl.GLenum, param: webgl.GLfloat): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:getSamplerParameter(sampler: WebGLSampler, pname: GLenum): any;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:getSamplerParameter(sampler: WebGLSampler, pname: webgl.GLenum): any;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:fenceSync(condition: GLenum, flags: GLbitfield): WebGLSync \| null;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:fenceSync(condition: webgl.GLenum, flags: webgl.GLbitfield): WebGLSync \| null;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:isSync(sync: WebGLSync \| null): GLboolean;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:isSync(sync: WebGLSync \| null): webgl.GLboolean;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:clientWaitSync(sync: WebGLSync, flags: GLbitfield, timeout: GLuint64): GLenum;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:clientWaitSync(sync: WebGLSync, flags: webgl.GLbitfield, timeout: GLuint64 ): webgl.GLenum;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:waitSync(sync: WebGLSync, flags: GLbitfield, timeout: GLint64): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:waitSync(sync: WebGLSync, flags: webgl.GLbitfield, timeout: GLint64): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:getSyncParameter(sync: WebGLSync, pname: GLenum): any;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:getSyncParameter(sync: WebGLSync, pname: webgl.GLenum): any;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:isTransformFeedback(tf: WebGLTransformFeedback \| null): GLboolean;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:isTransformFeedback(tf: WebGLTransformFeedback \| null): webgl.GLboolean;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:bindTransformFeedback(target: GLenum, tf: WebGLTransformFeedback \| null): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:bindTransformFeedback(target: webgl.GLenum, tf: WebGLTransformFeedback \| null): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:beginTransformFeedback(primitiveMode: GLenum): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:beginTransformFeedback(primitiveMode: webgl.GLenum): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:transformFeedbackVaryings(program: WebGLProgram, varyings: string[], bufferMode: GLenum): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:transformFeedbackVaryings(program: webgl.WebGLProgram, varyings: string[], bufferMode: webgl.GLenum): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:getTransformFeedbackVarying(program: WebGLProgram, index: GLuint): WebGLActiveInfo \| null;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:getTransformFeedbackVarying(program: webgl.WebGLProgram, index: webgl.GLuint): webgl.WebGLActiveInfo \| null;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:bindBufferBase(target: GLenum, index: GLuint, buffer: WebGLBuffer \| null): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:bindBufferBase(target: webgl.GLenum, index: webgl.GLuint, buffer: webgl.WebGLBuffer \| null): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:bindBufferRange(target: GLenum, index: GLuint, buffer: WebGLBuffer \| null, offset: GLintptr, size: GLsizeiptr): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:bindBufferRange(target: webgl.GLenum, index: webgl.GLuint, buffer: webgl.WebGLBuffer \| null, offset: webgl.GLintptr, size: webgl.GLsizeiptr): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:getIndexedParameter(target: GLenum, index: GLuint): any;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:getIndexedParameter(target: webgl.GLenum, index: webgl.GLuint): any;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:getUniformIndices(program: WebGLProgram, uniformNames: string[]): GLuint[] \| null;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:getUniformIndices(program: webgl.WebGLProgram, uniformNames: string[]): webgl.GLuint[] \| null;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:getActiveUniforms(program: WebGLProgram, uniformIndices: GLuint[], pname: GLenum): any;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:getActiveUniforms(program: webgl.WebGLProgram, uniformIndices: webgl.GLuint[], pname: webgl.GLenum): any;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:getUniformBlockIndex(program: WebGLProgram, uniformBlockName: string): GLuint;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:getUniformBlockIndex(program: webgl.WebGLProgram, uniformBlockName: string): webgl.GLuint;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:getActiveUniformBlockParameter(program: WebGLProgram, uniformBlockIndex: GLuint, pname: GLenum): any;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:getActiveUniformBlockParameter(program: webgl.WebGLProgram, uniformBlockIndex: webgl.GLuint, pname: webgl.GLenum): any;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:getActiveUniformBlockName(program: WebGLProgram, uniformBlockIndex: GLuint): string \| null;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:getActiveUniformBlockName(program: webgl.WebGLProgram, uniformBlockIndex: webgl.GLuint): string \| null;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:uniformBlockBinding(program: WebGLProgram, uniformBlockIndex: GLuint, uniformBlockBinding: GLuint): void;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:uniformBlockBinding(program: webgl.WebGLProgram, uniformBlockIndex: webgl.GLuint, uniformBlockBinding: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextBase<br>方法 or 属性:isVertexArray(vertexArray: WebGLVertexArrayObject \| null): GLboolean;<br>|类名:WebGL2RenderingContextBase<br>方法 or 属性:isVertexArray(vertexArray: WebGLVertexArrayObject \| null): webgl.GLboolean;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextOverloads<br>方法 or 属性:uniform1fv(location: WebGLUniformLocation \| null, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint): void;<br>|类名:WebGL2RenderingContextOverloads<br>方法 or 属性:uniform1fv(location: webgl.WebGLUniformLocation \| null, data: webgl.Float32List, srcOffset?: webgl.GLuint, srcLength?: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextOverloads<br>方法 or 属性:uniform2fv(location: WebGLUniformLocation \| null, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint): void;<br>|类名:WebGL2RenderingContextOverloads<br>方法 or 属性:uniform2fv(location: webgl.WebGLUniformLocation \| null, data: webgl.Float32List, srcOffset?: webgl.GLuint, srcLength?: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextOverloads<br>方法 or 属性:uniform3fv(location: WebGLUniformLocation \| null, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint): void;<br>|类名:WebGL2RenderingContextOverloads<br>方法 or 属性:uniform3fv(location: webgl.WebGLUniformLocation \| null, data: webgl.Float32List, srcOffset?: webgl.GLuint, srcLength?: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextOverloads<br>方法 or 属性:uniform4fv(location: WebGLUniformLocation \| null, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint): void;<br>|类名:WebGL2RenderingContextOverloads<br>方法 or 属性:uniform4fv(location: webgl.WebGLUniformLocation \| null, data: webgl.Float32List, srcOffset?: webgl.GLuint, srcLength?: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextOverloads<br>方法 or 属性:uniform1iv(location: WebGLUniformLocation \| null, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint): void;<br>|类名:WebGL2RenderingContextOverloads<br>方法 or 属性:uniform1iv(location: webgl.WebGLUniformLocation \| null, data: webgl.Int32List, srcOffset?: webgl.GLuint, srcLength?: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextOverloads<br>方法 or 属性:uniform2iv(location: WebGLUniformLocation \| null, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint): void;<br>|类名:WebGL2RenderingContextOverloads<br>方法 or 属性:uniform2iv(location: webgl.WebGLUniformLocation \| null, data: webgl.Int32List, srcOffset?: webgl.GLuint, srcLength?: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextOverloads<br>方法 or 属性:uniform3iv(location: WebGLUniformLocation \| null, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint): void;<br>|类名:WebGL2RenderingContextOverloads<br>方法 or 属性:uniform3iv(location: webgl.WebGLUniformLocation \| null, data: webgl.Int32List, srcOffset?: webgl.GLuint, srcLength?: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextOverloads<br>方法 or 属性:uniform4iv(location: WebGLUniformLocation \| null, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint): void;<br>|类名:WebGL2RenderingContextOverloads<br>方法 or 属性:uniform4iv(location: webgl.WebGLUniformLocation \| null, data: webgl.Int32List, srcOffset?: webgl.GLuint, srcLength?: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextOverloads<br>方法 or 属性:uniformMatrix2fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint): void;<br>|类名:WebGL2RenderingContextOverloads<br>方法 or 属性:uniformMatrix2fv(location: webgl.WebGLUniformLocation \| null, transpose: webgl.GLboolean, data: webgl.Float32List, srcOffset?: webgl.GLuint, srcLength?: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextOverloads<br>方法 or 属性:uniformMatrix3fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint): void;<br>|类名:WebGL2RenderingContextOverloads<br>方法 or 属性:uniformMatrix3fv(location: webgl.WebGLUniformLocation \| null, transpose: webgl.GLboolean, data: webgl.Float32List, srcOffset?: webgl.GLuint, srcLength?: webgl.GLuint): void;<br>|webgl2.d.ts| +|函数有变化|类名:WebGL2RenderingContextOverloads<br>方法 or 属性:uniformMatrix4fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint): void;<br>|类名:WebGL2RenderingContextOverloads<br>方法 or 属性:uniformMatrix4fv(location: webgl.WebGLUniformLocation \| null, transpose: webgl.GLboolean, data: webgl.Float32List, srcOffset?: webgl.GLuint, srcLength?: webgl.GLuint): void;<br>|webgl2.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-misc.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-misc.md new file mode 100644 index 0000000000000000000000000000000000000000..8fe5ac12d6d69f227f9ce9387b2a91c1f56ff291 --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-misc.md @@ -0,0 +1,622 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.inputMethod<br>类名: inputMethod|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: inputMethod<br>方法 or 属性: const MAX_TYPE_NUM: number|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: inputMethod<br>方法 or 属性: function getInputMethodSetting(): InputMethodSetting;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: inputMethod<br>方法 or 属性: function getInputMethodController(): InputMethodController;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: inputMethod<br>方法 or 属性: function getSetting(): InputMethodSetting;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: inputMethod<br>方法 or 属性: function getController(): InputMethodController;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: inputMethod<br>方法 or 属性: function switchInputMethod(target: InputMethodProperty, callback: AsyncCallback\<boolean>): void;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: inputMethod<br>方法 or 属性: function switchInputMethod(target: InputMethodProperty): Promise\<boolean>;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: inputMethod<br>方法 or 属性: function getCurrentInputMethod(): InputMethodProperty;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: inputMethod<br>方法 or 属性: function switchCurrentInputMethodSubtype(target: InputMethodSubtype, callback: AsyncCallback\<boolean>): void;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: inputMethod<br>方法 or 属性: function switchCurrentInputMethodSubtype(target: InputMethodSubtype): Promise\<boolean>;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: inputMethod<br>方法 or 属性: function getCurrentInputMethodSubtype(): InputMethodSubtype;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: inputMethod<br>方法 or 属性: function switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype, callback: AsyncCallback\<boolean>): void;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: inputMethod<br>方法 or 属性: function switchCurrentInputMethodAndSubtype(inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype): Promise\<boolean>;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodSetting|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodSetting<br>方法 or 属性: on(type: 'imeChange', callback: (inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype) => void): void;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodSetting<br>方法 or 属性: off(type: 'imeChange', callback?: (inputMethodProperty: InputMethodProperty, inputMethodSubtype: InputMethodSubtype) => void): void;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodSetting<br>方法 or 属性: listInputMethodSubtype(inputMethodProperty: InputMethodProperty, callback: AsyncCallback\<Array\<InputMethodSubtype>>): void;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodSetting<br>方法 or 属性: listInputMethodSubtype(inputMethodProperty: InputMethodProperty): Promise\<Array\<InputMethodSubtype>>;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodSetting<br>方法 or 属性: listCurrentInputMethodSubtype(callback: AsyncCallback\<Array\<InputMethodSubtype>>): void;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodSetting<br>方法 or 属性: listCurrentInputMethodSubtype(): Promise\<Array\<InputMethodSubtype>>;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodSetting<br>方法 or 属性: getInputMethods(enable: boolean, callback: AsyncCallback\<Array\<InputMethodProperty>>): void;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodSetting<br>方法 or 属性: getInputMethods(enable: boolean): Promise\<Array\<InputMethodProperty>>;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodSetting<br>方法 or 属性: listInputMethod(callback: AsyncCallback\<Array\<InputMethodProperty>>): void;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodSetting<br>方法 or 属性: listInputMethod(): Promise\<Array\<InputMethodProperty>>;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodSetting<br>方法 or 属性: showOptionalInputMethods(callback: AsyncCallback\<boolean>): void;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodSetting<br>方法 or 属性: showOptionalInputMethods(): Promise\<boolean>;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodSetting<br>方法 or 属性: displayOptionalInputMethod(callback: AsyncCallback\<void>): void;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodSetting<br>方法 or 属性: displayOptionalInputMethod(): Promise\<void>;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodController|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodController<br>方法 or 属性: stopInputSession(callback: AsyncCallback\<boolean>): void;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodController<br>方法 or 属性: stopInputSession(): Promise\<boolean>;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodController<br>方法 or 属性: stopInput(callback: AsyncCallback\<boolean>): void;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodController<br>方法 or 属性: stopInput(): Promise\<boolean>;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodController<br>方法 or 属性: showSoftKeyboard(callback: AsyncCallback\<void>): void;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodController<br>方法 or 属性: showSoftKeyboard():Promise\<void>;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodController<br>方法 or 属性: hideSoftKeyboard(callback: AsyncCallback\<void>): void;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodController<br>方法 or 属性: hideSoftKeyboard():Promise\<void>;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodProperty|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodProperty<br>方法 or 属性: readonly packageName: string;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodProperty<br>方法 or 属性: readonly methodId: string;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodProperty<br>方法 or 属性: readonly name: string;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodProperty<br>方法 or 属性: readonly id: string;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodProperty<br>方法 or 属性: readonly label?: string;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodProperty<br>方法 or 属性: readonly icon?: string;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodProperty<br>方法 or 属性: readonly iconId?: number;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethod<br>类名: InputMethodProperty<br>方法 or 属性: extra: object;|@ohos.inputMethod.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const ENTER_KEY_TYPE_UNSPECIFIED: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const ENTER_KEY_TYPE_GO: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const ENTER_KEY_TYPE_SEARCH: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const ENTER_KEY_TYPE_SEND: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const ENTER_KEY_TYPE_NEXT: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const ENTER_KEY_TYPE_DONE: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const ENTER_KEY_TYPE_PREVIOUS: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const PATTERN_NULL: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const PATTERN_TEXT: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const PATTERN_NUMBER: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const PATTERN_PHONE: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const PATTERN_DATETIME: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const PATTERN_EMAIL: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const PATTERN_URI: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const PATTERN_PASSWORD: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const FLAG_SELECTING: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const FLAG_SINGLE_LINE: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const DISPLAY_MODE_PART: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const DISPLAY_MODE_FULL: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const OPTION_ASCII: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const OPTION_NONE: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const OPTION_AUTO_CAP_CHARACTERS: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const OPTION_AUTO_CAP_SENTENCES: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const OPTION_AUTO_WORDS: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const OPTION_MULTI_LINE: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const OPTION_NO_FULLSCREEN: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const CURSOR_UP: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const CURSOR_DOWN: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const CURSOR_LEFT: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const CURSOR_RIGHT: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: const WINDOW_TYPE_INPUT_METHOD_FLOAT: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: function getInputMethodAbility(): InputMethodAbility;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: function getInputMethodEngine(): InputMethodEngine;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: function getKeyboardDelegate(): KeyboardDelegate;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: inputMethodEngine<br>方法 or 属性: function createKeyboardDelegate(): KeyboardDelegate;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: KeyboardController|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: KeyboardController<br>方法 or 属性: hide(callback: AsyncCallback\<void>): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: KeyboardController<br>方法 or 属性: hide(): Promise\<void>;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: KeyboardController<br>方法 or 属性: hideKeyboard(callback: AsyncCallback\<void>): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: KeyboardController<br>方法 or 属性: hideKeyboard(): Promise\<void>;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputMethodEngine|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputMethodEngine<br>方法 or 属性: on(type: 'inputStart', callback: (kbController: KeyboardController, textInputClient: TextInputClient) => void): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputMethodEngine<br>方法 or 属性: off(type: 'inputStart', callback?: (kbController: KeyboardController, textInputClient: TextInputClient) => void): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputMethodEngine<br>方法 or 属性: on(type: 'keyboardShow'\|'keyboardHide', callback: () => void): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputMethodEngine<br>方法 or 属性: on(type: 'keyboardShow'\|'keyboardHide', callback: () => void): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputMethodEngine<br>方法 or 属性: off(type: 'keyboardShow'\|'keyboardHide', callback?: () => void): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputMethodEngine<br>方法 or 属性: off(type: 'keyboardShow'\|'keyboardHide', callback?: () => void): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputMethodAbility|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputMethodAbility<br>方法 or 属性: on(type: 'inputStart', callback: (kbController: KeyboardController, inputClient: InputClient) => void): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputMethodAbility<br>方法 or 属性: off(type: 'inputStart', callback?: (kbController: KeyboardController, inputClient: InputClient) => void): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputMethodAbility<br>方法 or 属性: on(type: 'inputStop', callback: () => void): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputMethodAbility<br>方法 or 属性: off(type: 'inputStop', callback: () => void): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputMethodAbility<br>方法 or 属性: on(type: 'setCallingWindow', callback: (wid:number) => void): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputMethodAbility<br>方法 or 属性: off(type: 'setCallingWindow', callback: (wid:number) => void): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputMethodAbility<br>方法 or 属性: on(type: 'keyboardShow'\|'keyboardHide', callback: () => void): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputMethodAbility<br>方法 or 属性: on(type: 'keyboardShow'\|'keyboardHide', callback: () => void): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputMethodAbility<br>方法 or 属性: off(type: 'keyboardShow'\|'keyboardHide', callback?: () => void): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputMethodAbility<br>方法 or 属性: off(type: 'keyboardShow'\|'keyboardHide', callback?: () => void): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputMethodAbility<br>方法 or 属性: on(type: 'setSubtype', callback: (inputMethodSubtype: InputMethodSubtype) => void): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputMethodAbility<br>方法 or 属性: off(type: 'setSubtype', callback?: (inputMethodSubtype: InputMethodSubtype) => void): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: TextInputClient|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: TextInputClient<br>方法 or 属性: sendKeyFunction(action: number, callback: AsyncCallback\<boolean>): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: TextInputClient<br>方法 or 属性: sendKeyFunction(action: number): Promise\<boolean>;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: TextInputClient<br>方法 or 属性: deleteForward(length: number, callback: AsyncCallback\<boolean>): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: TextInputClient<br>方法 or 属性: deleteForward(length: number): Promise\<boolean>;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: TextInputClient<br>方法 or 属性: deleteBackward(length: number, callback: AsyncCallback\<boolean>): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: TextInputClient<br>方法 or 属性: deleteBackward(length: number): Promise\<boolean>;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: TextInputClient<br>方法 or 属性: insertText(text: string, callback: AsyncCallback\<boolean>): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: TextInputClient<br>方法 or 属性: insertText(text: string): Promise\<boolean>;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: TextInputClient<br>方法 or 属性: getForward(length: number, callback: AsyncCallback\<string>): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: TextInputClient<br>方法 or 属性: getForward(length: number): Promise\<string>;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: TextInputClient<br>方法 or 属性: getBackward(length: number, callback: AsyncCallback\<string>): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: TextInputClient<br>方法 or 属性: getBackward(length: number): Promise\<string>;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: TextInputClient<br>方法 or 属性: getEditorAttribute(callback: AsyncCallback\<EditorAttribute>): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: TextInputClient<br>方法 or 属性: getEditorAttribute(): Promise\<EditorAttribute>;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputClient|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputClient<br>方法 or 属性: sendKeyFunction(action: number, callback: AsyncCallback\<boolean>): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputClient<br>方法 or 属性: sendKeyFunction(action: number): Promise\<boolean>;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputClient<br>方法 or 属性: deleteForward(length: number, callback: AsyncCallback\<boolean>): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputClient<br>方法 or 属性: deleteForward(length: number): Promise\<boolean>;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputClient<br>方法 or 属性: deleteBackward(length: number, callback: AsyncCallback\<boolean>): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputClient<br>方法 or 属性: deleteBackward(length: number): Promise\<boolean>;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputClient<br>方法 or 属性: insertText(text: string, callback: AsyncCallback\<boolean>): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputClient<br>方法 or 属性: insertText(text: string): Promise\<boolean>;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputClient<br>方法 or 属性: getForward(length: number, callback: AsyncCallback\<string>): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputClient<br>方法 or 属性: getForward(length: number): Promise\<string>;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputClient<br>方法 or 属性: getBackward(length: number, callback: AsyncCallback\<string>): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputClient<br>方法 or 属性: getBackward(length: number): Promise\<string>;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputClient<br>方法 or 属性: getEditorAttribute(callback: AsyncCallback\<EditorAttribute>): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputClient<br>方法 or 属性: getEditorAttribute(): Promise\<EditorAttribute>;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputClient<br>方法 or 属性: moveCursor(direction: number, callback: AsyncCallback\<void>): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: InputClient<br>方法 or 属性: moveCursor(direction: number): Promise\<void>;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: KeyboardDelegate|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: KeyboardDelegate<br>方法 or 属性: on(type: 'keyDown'\|'keyUp', callback: (event: KeyEvent) => boolean): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: KeyboardDelegate<br>方法 or 属性: on(type: 'keyDown'\|'keyUp', callback: (event: KeyEvent) => boolean): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: KeyboardDelegate<br>方法 or 属性: off(type: 'keyDown'\|'keyUp', callback?: (event: KeyEvent) => boolean): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: KeyboardDelegate<br>方法 or 属性: off(type: 'keyDown'\|'keyUp', callback?: (event: KeyEvent) => boolean): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: KeyboardDelegate<br>方法 or 属性: on(type: 'cursorContextChange', callback: (x: number, y: number, height: number) => void): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: KeyboardDelegate<br>方法 or 属性: off(type: 'cursorContextChange', callback?: (x: number, y: number, height: number) => void): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: KeyboardDelegate<br>方法 or 属性: on(type: 'selectionChange', callback: (oldBegin: number, oldEnd: number, newBegin: number, newEnd: number) => void): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: KeyboardDelegate<br>方法 or 属性: off(type: 'selectionChange', callback?: (oldBegin: number, oldEnd: number, newBegin: number, newEnd: number) => void): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: KeyboardDelegate<br>方法 or 属性: on(type: 'textChange', callback: (text: string) => void): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: KeyboardDelegate<br>方法 or 属性: off(type: 'textChange', callback?: (text: string) => void): void;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: EditorAttribute|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: EditorAttribute<br>方法 or 属性: readonly inputPattern: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: EditorAttribute<br>方法 or 属性: readonly enterKeyType: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: KeyEvent|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: KeyEvent<br>方法 or 属性: readonly keyCode: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.inputMethodEngine<br>类名: KeyEvent<br>方法 or 属性: readonly keyAction: number;|@ohos.inputMethodEngine.d.ts| +|新增|NA|模块名: ohos.InputMethodExtensionAbility<br>类名: InputMethodExtensionAbility|@ohos.InputMethodExtensionAbility.d.ts| +|新增|NA|模块名: ohos.InputMethodExtensionAbility<br>类名: InputMethodExtensionAbility<br>方法 or 属性: context: InputMethodExtensionContext;|@ohos.InputMethodExtensionAbility.d.ts| +|新增|NA|模块名: ohos.InputMethodExtensionAbility<br>类名: InputMethodExtensionAbility<br>方法 or 属性: onCreate(want: Want): void;|@ohos.InputMethodExtensionAbility.d.ts| +|新增|NA|模块名: ohos.InputMethodExtensionAbility<br>类名: InputMethodExtensionAbility<br>方法 or 属性: onDestroy(): void;|@ohos.InputMethodExtensionAbility.d.ts| +|新增|NA|模块名: ohos.InputMethodExtensionContext<br>类名: InputMethodExtensionContext|@ohos.InputMethodExtensionContext.d.ts| +|新增|NA|模块名: ohos.InputMethodExtensionContext<br>类名: InputMethodExtensionContext<br>方法 or 属性: destroy(callback: AsyncCallback\<void>): void;|@ohos.InputMethodExtensionContext.d.ts| +|新增|NA|模块名: ohos.InputMethodExtensionContext<br>类名: InputMethodExtensionContext<br>方法 or 属性: destroy(): Promise\<void>;|@ohos.InputMethodExtensionContext.d.ts| +|新增|NA|模块名: ohos.InputMethodSubtype<br>类名: InputMethodSubtype|@ohos.InputMethodSubtype.d.ts| +|新增|NA|模块名: ohos.InputMethodSubtype<br>类名: InputMethodSubtype<br>方法 or 属性: readonly label?: string;|@ohos.InputMethodSubtype.d.ts| +|新增|NA|模块名: ohos.InputMethodSubtype<br>类名: InputMethodSubtype<br>方法 or 属性: readonly name: string;|@ohos.InputMethodSubtype.d.ts| +|新增|NA|模块名: ohos.InputMethodSubtype<br>类名: InputMethodSubtype<br>方法 or 属性: readonly id: string;|@ohos.InputMethodSubtype.d.ts| +|新增|NA|模块名: ohos.InputMethodSubtype<br>类名: InputMethodSubtype<br>方法 or 属性: readonly mode?: 'upper'\|'lower';|@ohos.InputMethodSubtype.d.ts| +|新增|NA|模块名: ohos.InputMethodSubtype<br>类名: InputMethodSubtype<br>方法 or 属性: readonly locale: string;|@ohos.InputMethodSubtype.d.ts| +|新增|NA|模块名: ohos.InputMethodSubtype<br>类名: InputMethodSubtype<br>方法 or 属性: readonly language: string;|@ohos.InputMethodSubtype.d.ts| +|新增|NA|模块名: ohos.InputMethodSubtype<br>类名: InputMethodSubtype<br>方法 or 属性: readonly icon?: string;|@ohos.InputMethodSubtype.d.ts| +|新增|NA|模块名: ohos.InputMethodSubtype<br>类名: InputMethodSubtype<br>方法 or 属性: readonly iconId?: number;|@ohos.InputMethodSubtype.d.ts| +|新增|NA|模块名: ohos.InputMethodSubtype<br>类名: InputMethodSubtype<br>方法 or 属性: extra: object;|@ohos.InputMethodSubtype.d.ts| +|新增|NA|类名:pasteboard<br>方法or属性:const MIMETYPE_PIXELMAP: string;|@ohos.pasteboard.d.ts| +|新增|NA|类名:pasteboard<br>方法or属性:function createData(mimeType: string, value: ValueType): PasteData;|@ohos.pasteboard.d.ts| +|新增|NA|类名:pasteboard<br>方法or属性:function createRecord(mimeType: string, value: ValueType): PasteDataRecord;|@ohos.pasteboard.d.ts| +|新增|NA|模块名: ohos.pasteboard<br>类名: ShareOption|@ohos.pasteboard.d.ts| +|新增|NA|类名:ShareOption<br>方法or属性:|@ohos.pasteboard.d.ts| +|新增|NA|模块名: ohos.pasteboard<br>类名: ShareOption<br>方法 or 属性:INAPP|@ohos.pasteboard.d.ts| +|新增|NA|类名:ShareOption<br>方法or属性:INAPP|@ohos.pasteboard.d.ts| +|新增|NA|模块名: ohos.pasteboard<br>类名: ShareOption<br>方法 or 属性:LOCALDEVICE|@ohos.pasteboard.d.ts| +|新增|NA|类名:ShareOption<br>方法or属性:LOCALDEVICE|@ohos.pasteboard.d.ts| +|新增|NA|模块名: ohos.pasteboard<br>类名: ShareOption<br>方法 or 属性:CROSSDEVICE|@ohos.pasteboard.d.ts| +|新增|NA|类名:ShareOption<br>方法or属性:CROSSDEVICE|@ohos.pasteboard.d.ts| +|新增|NA|模块名: ohos.pasteboard<br>类名: PasteDataProperty<br>方法 or 属性:shareOption: ShareOption;|@ohos.pasteboard.d.ts| +|新增|NA|类名:PasteDataProperty<br>方法or属性:shareOption: ShareOption;|@ohos.pasteboard.d.ts| +|新增|NA|类名:PasteDataRecord<br>方法or属性:pixelMap: image.PixelMap;|@ohos.pasteboard.d.ts| +|新增|NA|类名:PasteDataRecord<br>方法or属性:data: {<br><br> [mimeType: string]: ArrayBuffer<br><br> }|@ohos.pasteboard.d.ts| +|新增|NA|类名:PasteDataRecord<br>方法or属性:toPlainText(): string;|@ohos.pasteboard.d.ts| +|新增|NA|类名:PasteData<br>方法or属性:addRecord(mimeType: string, value: ValueType): void;|@ohos.pasteboard.d.ts| +|新增|NA|类名:PasteData<br>方法or属性:getPrimaryPixelMap(): image.PixelMap;|@ohos.pasteboard.d.ts| +|新增|NA|类名:PasteData<br>方法or属性:setProperty(property: PasteDataProperty): void;|@ohos.pasteboard.d.ts| +|新增|NA|类名:PasteData<br>方法or属性:getRecord(index: number): PasteDataRecord;|@ohos.pasteboard.d.ts| +|新增|NA|类名:PasteData<br>方法or属性:hasType(mimeType: string): boolean;|@ohos.pasteboard.d.ts| +|新增|NA|类名:PasteData<br>方法or属性:removeRecord(index: number): void;|@ohos.pasteboard.d.ts| +|新增|NA|类名:PasteData<br>方法or属性:replaceRecord(index: number, record: PasteDataRecord): void;|@ohos.pasteboard.d.ts| +|新增|NA|类名:SystemPasteboard<br>方法or属性:clearData(callback: AsyncCallback\<void>): void;|@ohos.pasteboard.d.ts| +|新增|NA|类名:SystemPasteboard<br>方法or属性:clearData(): Promise\<void>;|@ohos.pasteboard.d.ts| +|新增|NA|类名:SystemPasteboard<br>方法or属性:getData(callback: AsyncCallback\<PasteData>): void;|@ohos.pasteboard.d.ts| +|新增|NA|类名:SystemPasteboard<br>方法or属性:getData(): Promise\<PasteData>;|@ohos.pasteboard.d.ts| +|新增|NA|类名:SystemPasteboard<br>方法or属性:hasData(callback: AsyncCallback\<boolean>): void;|@ohos.pasteboard.d.ts| +|新增|NA|类名:SystemPasteboard<br>方法or属性:hasData(): Promise\<boolean>;|@ohos.pasteboard.d.ts| +|新增|NA|类名:SystemPasteboard<br>方法or属性:setData(data: PasteData, callback: AsyncCallback\<void>): void;|@ohos.pasteboard.d.ts| +|新增|NA|类名:SystemPasteboard<br>方法or属性:setData(data: PasteData): Promise\<void>;|@ohos.pasteboard.d.ts| +|新增|NA|类名:request<br>方法or属性:const EXCEPTION_PERMISSION: number;|@ohos.request.d.ts| +|新增|NA|类名:request<br>方法or属性:const EXCEPTION_PARAMCHECK: number;|@ohos.request.d.ts| +|新增|NA|类名:request<br>方法or属性:const EXCEPTION_UNSUPPORTED: number;|@ohos.request.d.ts| +|新增|NA|类名:request<br>方法or属性:const EXCEPTION_FILEIO: number;|@ohos.request.d.ts| +|新增|NA|类名:request<br>方法or属性:const EXCEPTION_FILEPATH: number;|@ohos.request.d.ts| +|新增|NA|类名:request<br>方法or属性:const EXCEPTION_SERVICE: number;|@ohos.request.d.ts| +|新增|NA|类名:request<br>方法or属性:const EXCEPTION_OTHERS: number;|@ohos.request.d.ts| +|新增|NA|类名:request<br>方法or属性:const ERROR_OFFLINE: number;|@ohos.request.d.ts| +|新增|NA|类名:request<br>方法or属性:const ERROR_UNSUPPORTED_NETWORK_TYPE: number;|@ohos.request.d.ts| +|新增|NA|类名:request<br>方法or属性:const PAUSED_BY_USER: number;|@ohos.request.d.ts| +|新增|NA|类名:request<br>方法or属性:function downloadFile(context: BaseContext, config: DownloadConfig, callback: AsyncCallback\<DownloadTask>): void;|@ohos.request.d.ts| +|新增|NA|类名:request<br>方法or属性:function downloadFile(context: BaseContext, config: DownloadConfig): Promise\<DownloadTask>;|@ohos.request.d.ts| +|新增|NA|类名:request<br>方法or属性:function uploadFile(context: BaseContext, config: UploadConfig, callback: AsyncCallback\<UploadTask>): void;|@ohos.request.d.ts| +|新增|NA|类名:request<br>方法or属性:function uploadFile(context: BaseContext, config: UploadConfig): Promise\<UploadTask>;|@ohos.request.d.ts| +|新增|NA|模块名: ohos.request<br>类名: DownloadConfig<br>方法 or 属性:background?: boolean;|@ohos.request.d.ts| +|新增|NA|类名:DownloadConfig<br>方法or属性:background?: boolean;|@ohos.request.d.ts| +|新增|NA|类名:DownloadTask<br>方法or属性:delete(callback: AsyncCallback\<boolean>): void;|@ohos.request.d.ts| +|新增|NA|类名:DownloadTask<br>方法or属性:delete(): Promise\<boolean>;|@ohos.request.d.ts| +|新增|NA|类名:DownloadTask<br>方法or属性:suspend(callback: AsyncCallback\<boolean>): void;|@ohos.request.d.ts| +|新增|NA|类名:DownloadTask<br>方法or属性:suspend(): Promise\<boolean>;|@ohos.request.d.ts| +|新增|NA|类名:DownloadTask<br>方法or属性:restore(callback: AsyncCallback\<boolean>): void;|@ohos.request.d.ts| +|新增|NA|类名:DownloadTask<br>方法or属性:restore(): Promise\<boolean>;|@ohos.request.d.ts| +|新增|NA|类名:DownloadTask<br>方法or属性:getTaskInfo(callback: AsyncCallback\<DownloadInfo>): void;|@ohos.request.d.ts| +|新增|NA|类名:DownloadTask<br>方法or属性:getTaskInfo(): Promise\<DownloadInfo>;|@ohos.request.d.ts| +|新增|NA|类名:DownloadTask<br>方法or属性:getTaskMimeType(callback: AsyncCallback\<string>): void;|@ohos.request.d.ts| +|新增|NA|类名:DownloadTask<br>方法or属性:getTaskMimeType(): Promise\<string>;|@ohos.request.d.ts| +|新增|NA|模块名: ohos.request<br>类名: TaskState|@ohos.request.d.ts| +|新增|NA|类名:TaskState<br>方法or属性:|@ohos.request.d.ts| +|新增|NA|模块名: ohos.request<br>类名: TaskState<br>方法 or 属性:path: string;|@ohos.request.d.ts| +|新增|NA|类名:TaskState<br>方法or属性:path: string;|@ohos.request.d.ts| +|新增|NA|模块名: ohos.request<br>类名: TaskState<br>方法 or 属性:responseCode: number;|@ohos.request.d.ts| +|新增|NA|类名:TaskState<br>方法or属性:responseCode: number;|@ohos.request.d.ts| +|新增|NA|模块名: ohos.request<br>类名: TaskState<br>方法 or 属性:message: string;|@ohos.request.d.ts| +|新增|NA|类名:TaskState<br>方法or属性:message: string;|@ohos.request.d.ts| +|新增|NA|类名:UploadTask<br>方法or属性:on(type:'complete' \| 'fail', callback: Callback\<Array\<TaskState>>): void;|@ohos.request.d.ts| +|新增|NA|类名:UploadTask<br>方法or属性:on(type:'complete' \| 'fail', callback: Callback\<Array\<TaskState>>): void;|@ohos.request.d.ts| +|新增|NA|类名:UploadTask<br>方法or属性:off(type:'complete' \| 'fail', callback?: Callback\<Array\<TaskState>>): void;|@ohos.request.d.ts| +|新增|NA|类名:UploadTask<br>方法or属性:off(type:'complete' \| 'fail', callback?: Callback\<Array\<TaskState>>): void;|@ohos.request.d.ts| +|新增|NA|类名:UploadTask<br>方法or属性:delete(callback: AsyncCallback\<boolean>): void;|@ohos.request.d.ts| +|新增|NA|类名:UploadTask<br>方法or属性:delete(): Promise\<boolean>;|@ohos.request.d.ts| +|新增|NA|模块名: ohos.screenLock<br>类名: EventType<br>方法 or 属性:type EventType =<br><br> 'beginWakeUp'<br><br> \| 'endWakeUp'<br><br> \| 'beginScreenOn'<br><br> \| 'endScreenOn'<br><br> \| 'beginScreenOff'<br><br> \| 'endScreenOff'<br><br> \| 'unlockScreen'<br><br> \| 'lockScreen'<br><br> \| 'beginExitAnimation'<br><br> \| 'beginSleep'<br><br> \| 'endSleep'<br><br> \| 'changeUser'<br><br> \| 'screenlockEnabled'<br><br> \| 'serviceRestart'|@ohos.screenLock.d.ts| +|新增|NA|类名:EventType<br>方法or属性:type EventType =<br><br> 'beginWakeUp'<br><br> \| 'endWakeUp'<br><br> \| 'beginScreenOn'<br><br> \| 'endScreenOn'<br><br> \| 'beginScreenOff'<br><br> \| 'endScreenOff'<br><br> \| 'unlockScreen'<br><br> \| 'lockScreen'<br><br> \| 'beginExitAnimation'<br><br> \| 'beginSleep'<br><br> \| 'endSleep'<br><br> \| 'changeUser'<br><br> \| 'screenlockEnabled'<br><br> \| 'serviceRestart'|@ohos.screenLock.d.ts| +|新增|NA|模块名: ohos.screenLock<br>类名: EventType<br>方法 or 属性:type EventType =<br><br> 'beginWakeUp'<br><br> \| 'endWakeUp'<br><br> \| 'beginScreenOn'<br><br> \| 'endScreenOn'<br><br> \| 'beginScreenOff'<br><br> \| 'endScreenOff'<br><br> \| 'unlockScreen'<br><br> \| 'lockScreen'<br><br> \| 'beginExitAnimation'<br><br> \| 'beginSleep'<br><br> \| 'endSleep'<br><br> \| 'changeUser'<br><br> \| 'screenlockEnabled'<br><br> \| 'serviceRestart'|@ohos.screenLock.d.ts| +|新增|NA|类名:EventType<br>方法or属性:type EventType =<br><br> 'beginWakeUp'<br><br> \| 'endWakeUp'<br><br> \| 'beginScreenOn'<br><br> \| 'endScreenOn'<br><br> \| 'beginScreenOff'<br><br> \| 'endScreenOff'<br><br> \| 'unlockScreen'<br><br> \| 'lockScreen'<br><br> \| 'beginExitAnimation'<br><br> \| 'beginSleep'<br><br> \| 'endSleep'<br><br> \| 'changeUser'<br><br> \| 'screenlockEnabled'<br><br> \| 'serviceRestart'|@ohos.screenLock.d.ts| +|新增|NA|模块名: ohos.screenLock<br>类名: EventType<br>方法 or 属性:type EventType =<br><br> 'beginWakeUp'<br><br> \| 'endWakeUp'<br><br> \| 'beginScreenOn'<br><br> \| 'endScreenOn'<br><br> \| 'beginScreenOff'<br><br> \| 'endScreenOff'<br><br> \| 'unlockScreen'<br><br> \| 'lockScreen'<br><br> \| 'beginExitAnimation'<br><br> \| 'beginSleep'<br><br> \| 'endSleep'<br><br> \| 'changeUser'<br><br> \| 'screenlockEnabled'<br><br> \| 'serviceRestart'|@ohos.screenLock.d.ts| +|新增|NA|类名:EventType<br>方法or属性:type EventType =<br><br> 'beginWakeUp'<br><br> \| 'endWakeUp'<br><br> \| 'beginScreenOn'<br><br> \| 'endScreenOn'<br><br> \| 'beginScreenOff'<br><br> \| 'endScreenOff'<br><br> \| 'unlockScreen'<br><br> \| 'lockScreen'<br><br> \| 'beginExitAnimation'<br><br> \| 'beginSleep'<br><br> \| 'endSleep'<br><br> \| 'changeUser'<br><br> \| 'screenlockEnabled'<br><br> \| 'serviceRestart'|@ohos.screenLock.d.ts| +|新增|NA|模块名: ohos.screenLock<br>类名: EventType<br>方法 or 属性:type EventType =<br><br> 'beginWakeUp'<br><br> \| 'endWakeUp'<br><br> \| 'beginScreenOn'<br><br> \| 'endScreenOn'<br><br> \| 'beginScreenOff'<br><br> \| 'endScreenOff'<br><br> \| 'unlockScreen'<br><br> \| 'lockScreen'<br><br> \| 'beginExitAnimation'<br><br> \| 'beginSleep'<br><br> \| 'endSleep'<br><br> \| 'changeUser'<br><br> \| 'screenlockEnabled'<br><br> \| 'serviceRestart'|@ohos.screenLock.d.ts| +|新增|NA|类名:EventType<br>方法or属性:type EventType =<br><br> 'beginWakeUp'<br><br> \| 'endWakeUp'<br><br> \| 'beginScreenOn'<br><br> \| 'endScreenOn'<br><br> \| 'beginScreenOff'<br><br> \| 'endScreenOff'<br><br> \| 'unlockScreen'<br><br> \| 'lockScreen'<br><br> \| 'beginExitAnimation'<br><br> \| 'beginSleep'<br><br> \| 'endSleep'<br><br> \| 'changeUser'<br><br> \| 'screenlockEnabled'<br><br> \| 'serviceRestart'|@ohos.screenLock.d.ts| +|新增|NA|模块名: ohos.screenLock<br>类名: EventType<br>方法 or 属性:type EventType =<br><br> 'beginWakeUp'<br><br> \| 'endWakeUp'<br><br> \| 'beginScreenOn'<br><br> \| 'endScreenOn'<br><br> \| 'beginScreenOff'<br><br> \| 'endScreenOff'<br><br> \| 'unlockScreen'<br><br> \| 'lockScreen'<br><br> \| 'beginExitAnimation'<br><br> \| 'beginSleep'<br><br> \| 'endSleep'<br><br> \| 'changeUser'<br><br> \| 'screenlockEnabled'<br><br> \| 'serviceRestart'|@ohos.screenLock.d.ts| +|新增|NA|类名:EventType<br>方法or属性:type EventType =<br><br> 'beginWakeUp'<br><br> \| 'endWakeUp'<br><br> \| 'beginScreenOn'<br><br> \| 'endScreenOn'<br><br> \| 'beginScreenOff'<br><br> \| 'endScreenOff'<br><br> \| 'unlockScreen'<br><br> \| 'lockScreen'<br><br> \| 'beginExitAnimation'<br><br> \| 'beginSleep'<br><br> \| 'endSleep'<br><br> \| 'changeUser'<br><br> \| 'screenlockEnabled'<br><br> \| 'serviceRestart'|@ohos.screenLock.d.ts| +|新增|NA|模块名: ohos.screenLock<br>类名: EventType<br>方法 or 属性:type EventType =<br><br> 'beginWakeUp'<br><br> \| 'endWakeUp'<br><br> \| 'beginScreenOn'<br><br> \| 'endScreenOn'<br><br> \| 'beginScreenOff'<br><br> \| 'endScreenOff'<br><br> \| 'unlockScreen'<br><br> \| 'lockScreen'<br><br> \| 'beginExitAnimation'<br><br> \| 'beginSleep'<br><br> \| 'endSleep'<br><br> \| 'changeUser'<br><br> \| 'screenlockEnabled'<br><br> \| 'serviceRestart'|@ohos.screenLock.d.ts| +|新增|NA|类名:EventType<br>方法or属性:type EventType =<br><br> 'beginWakeUp'<br><br> \| 'endWakeUp'<br><br> \| 'beginScreenOn'<br><br> \| 'endScreenOn'<br><br> \| 'beginScreenOff'<br><br> \| 'endScreenOff'<br><br> \| 'unlockScreen'<br><br> \| 'lockScreen'<br><br> \| 'beginExitAnimation'<br><br> \| 'beginSleep'<br><br> \| 'endSleep'<br><br> \| 'changeUser'<br><br> \| 'screenlockEnabled'<br><br> \| 'serviceRestart'|@ohos.screenLock.d.ts| +|新增|NA|模块名: ohos.screenLock<br>类名: EventType<br>方法 or 属性:type EventType =<br><br> 'beginWakeUp'<br><br> \| 'endWakeUp'<br><br> \| 'beginScreenOn'<br><br> \| 'endScreenOn'<br><br> \| 'beginScreenOff'<br><br> \| 'endScreenOff'<br><br> \| 'unlockScreen'<br><br> \| 'lockScreen'<br><br> \| 'beginExitAnimation'<br><br> \| 'beginSleep'<br><br> \| 'endSleep'<br><br> \| 'changeUser'<br><br> \| 'screenlockEnabled'<br><br> \| 'serviceRestart'|@ohos.screenLock.d.ts| +|新增|NA|类名:EventType<br>方法or属性:type EventType =<br><br> 'beginWakeUp'<br><br> \| 'endWakeUp'<br><br> \| 'beginScreenOn'<br><br> \| 'endScreenOn'<br><br> \| 'beginScreenOff'<br><br> \| 'endScreenOff'<br><br> \| 'unlockScreen'<br><br> \| 'lockScreen'<br><br> \| 'beginExitAnimation'<br><br> \| 'beginSleep'<br><br> \| 'endSleep'<br><br> \| 'changeUser'<br><br> \| 'screenlockEnabled'<br><br> \| 'serviceRestart'|@ohos.screenLock.d.ts| +|新增|NA|模块名: ohos.screenLock<br>类名: EventType<br>方法 or 属性:type EventType =<br><br> 'beginWakeUp'<br><br> \| 'endWakeUp'<br><br> \| 'beginScreenOn'<br><br> \| 'endScreenOn'<br><br> \| 'beginScreenOff'<br><br> \| 'endScreenOff'<br><br> \| 'unlockScreen'<br><br> \| 'lockScreen'<br><br> \| 'beginExitAnimation'<br><br> \| 'beginSleep'<br><br> \| 'endSleep'<br><br> \| 'changeUser'<br><br> \| 'screenlockEnabled'<br><br> \| 'serviceRestart'|@ohos.screenLock.d.ts| +|新增|NA|类名:EventType<br>方法or属性:type EventType =<br><br> 'beginWakeUp'<br><br> \| 'endWakeUp'<br><br> \| 'beginScreenOn'<br><br> \| 'endScreenOn'<br><br> \| 'beginScreenOff'<br><br> \| 'endScreenOff'<br><br> \| 'unlockScreen'<br><br> \| 'lockScreen'<br><br> \| 'beginExitAnimation'<br><br> \| 'beginSleep'<br><br> \| 'endSleep'<br><br> \| 'changeUser'<br><br> \| 'screenlockEnabled'<br><br> \| 'serviceRestart'|@ohos.screenLock.d.ts| +|新增|NA|模块名: ohos.screenLock<br>类名: EventType<br>方法 or 属性:type EventType =<br><br> 'beginWakeUp'<br><br> \| 'endWakeUp'<br><br> \| 'beginScreenOn'<br><br> \| 'endScreenOn'<br><br> \| 'beginScreenOff'<br><br> \| 'endScreenOff'<br><br> \| 'unlockScreen'<br><br> \| 'lockScreen'<br><br> \| 'beginExitAnimation'<br><br> \| 'beginSleep'<br><br> \| 'endSleep'<br><br> \| 'changeUser'<br><br> \| 'screenlockEnabled'<br><br> \| 'serviceRestart'|@ohos.screenLock.d.ts| +|新增|NA|类名:EventType<br>方法or属性:type EventType =<br><br> 'beginWakeUp'<br><br> \| 'endWakeUp'<br><br> \| 'beginScreenOn'<br><br> \| 'endScreenOn'<br><br> \| 'beginScreenOff'<br><br> \| 'endScreenOff'<br><br> \| 'unlockScreen'<br><br> \| 'lockScreen'<br><br> \| 'beginExitAnimation'<br><br> \| 'beginSleep'<br><br> \| 'endSleep'<br><br> \| 'changeUser'<br><br> \| 'screenlockEnabled'<br><br> \| 'serviceRestart'|@ohos.screenLock.d.ts| +|新增|NA|模块名: ohos.screenLock<br>类名: EventType<br>方法 or 属性:type EventType =<br><br> 'beginWakeUp'<br><br> \| 'endWakeUp'<br><br> \| 'beginScreenOn'<br><br> \| 'endScreenOn'<br><br> \| 'beginScreenOff'<br><br> \| 'endScreenOff'<br><br> \| 'unlockScreen'<br><br> \| 'lockScreen'<br><br> \| 'beginExitAnimation'<br><br> \| 'beginSleep'<br><br> \| 'endSleep'<br><br> \| 'changeUser'<br><br> \| 'screenlockEnabled'<br><br> \| 'serviceRestart'|@ohos.screenLock.d.ts| +|新增|NA|类名:EventType<br>方法or属性:type EventType =<br><br> 'beginWakeUp'<br><br> \| 'endWakeUp'<br><br> \| 'beginScreenOn'<br><br> \| 'endScreenOn'<br><br> \| 'beginScreenOff'<br><br> \| 'endScreenOff'<br><br> \| 'unlockScreen'<br><br> \| 'lockScreen'<br><br> \| 'beginExitAnimation'<br><br> \| 'beginSleep'<br><br> \| 'endSleep'<br><br> \| 'changeUser'<br><br> \| 'screenlockEnabled'<br><br> \| 'serviceRestart'|@ohos.screenLock.d.ts| +|新增|NA|模块名: ohos.screenLock<br>类名: EventType<br>方法 or 属性:type EventType =<br><br> 'beginWakeUp'<br><br> \| 'endWakeUp'<br><br> \| 'beginScreenOn'<br><br> \| 'endScreenOn'<br><br> \| 'beginScreenOff'<br><br> \| 'endScreenOff'<br><br> \| 'unlockScreen'<br><br> \| 'lockScreen'<br><br> \| 'beginExitAnimation'<br><br> \| 'beginSleep'<br><br> \| 'endSleep'<br><br> \| 'changeUser'<br><br> \| 'screenlockEnabled'<br><br> \| 'serviceRestart'|@ohos.screenLock.d.ts| +|新增|NA|类名:EventType<br>方法or属性:type EventType =<br><br> 'beginWakeUp'<br><br> \| 'endWakeUp'<br><br> \| 'beginScreenOn'<br><br> \| 'endScreenOn'<br><br> \| 'beginScreenOff'<br><br> \| 'endScreenOff'<br><br> \| 'unlockScreen'<br><br> \| 'lockScreen'<br><br> \| 'beginExitAnimation'<br><br> \| 'beginSleep'<br><br> \| 'endSleep'<br><br> \| 'changeUser'<br><br> \| 'screenlockEnabled'<br><br> \| 'serviceRestart'|@ohos.screenLock.d.ts| +|新增|NA|模块名: ohos.screenLock<br>类名: EventType<br>方法 or 属性:type EventType =<br><br> 'beginWakeUp'<br><br> \| 'endWakeUp'<br><br> \| 'beginScreenOn'<br><br> \| 'endScreenOn'<br><br> \| 'beginScreenOff'<br><br> \| 'endScreenOff'<br><br> \| 'unlockScreen'<br><br> \| 'lockScreen'<br><br> \| 'beginExitAnimation'<br><br> \| 'beginSleep'<br><br> \| 'endSleep'<br><br> \| 'changeUser'<br><br> \| 'screenlockEnabled'<br><br> \| 'serviceRestart'|@ohos.screenLock.d.ts| +|新增|NA|类名:EventType<br>方法or属性:type EventType =<br><br> 'beginWakeUp'<br><br> \| 'endWakeUp'<br><br> \| 'beginScreenOn'<br><br> \| 'endScreenOn'<br><br> \| 'beginScreenOff'<br><br> \| 'endScreenOff'<br><br> \| 'unlockScreen'<br><br> \| 'lockScreen'<br><br> \| 'beginExitAnimation'<br><br> \| 'beginSleep'<br><br> \| 'endSleep'<br><br> \| 'changeUser'<br><br> \| 'screenlockEnabled'<br><br> \| 'serviceRestart'|@ohos.screenLock.d.ts| +|新增|NA|模块名: ohos.screenLock<br>类名: EventType<br>方法 or 属性:type EventType =<br><br> 'beginWakeUp'<br><br> \| 'endWakeUp'<br><br> \| 'beginScreenOn'<br><br> \| 'endScreenOn'<br><br> \| 'beginScreenOff'<br><br> \| 'endScreenOff'<br><br> \| 'unlockScreen'<br><br> \| 'lockScreen'<br><br> \| 'beginExitAnimation'<br><br> \| 'beginSleep'<br><br> \| 'endSleep'<br><br> \| 'changeUser'<br><br> \| 'screenlockEnabled'<br><br> \| 'serviceRestart'|@ohos.screenLock.d.ts| +|新增|NA|类名:EventType<br>方法or属性:type EventType =<br><br> 'beginWakeUp'<br><br> \| 'endWakeUp'<br><br> \| 'beginScreenOn'<br><br> \| 'endScreenOn'<br><br> \| 'beginScreenOff'<br><br> \| 'endScreenOff'<br><br> \| 'unlockScreen'<br><br> \| 'lockScreen'<br><br> \| 'beginExitAnimation'<br><br> \| 'beginSleep'<br><br> \| 'endSleep'<br><br> \| 'changeUser'<br><br> \| 'screenlockEnabled'<br><br> \| 'serviceRestart'|@ohos.screenLock.d.ts| +|新增|NA|模块名: ohos.screenLock<br>类名: EventType<br>方法 or 属性:type EventType =<br><br> 'beginWakeUp'<br><br> \| 'endWakeUp'<br><br> \| 'beginScreenOn'<br><br> \| 'endScreenOn'<br><br> \| 'beginScreenOff'<br><br> \| 'endScreenOff'<br><br> \| 'unlockScreen'<br><br> \| 'lockScreen'<br><br> \| 'beginExitAnimation'<br><br> \| 'beginSleep'<br><br> \| 'endSleep'<br><br> \| 'changeUser'<br><br> \| 'screenlockEnabled'<br><br> \| 'serviceRestart'|@ohos.screenLock.d.ts| +|新增|NA|类名:EventType<br>方法or属性:type EventType =<br><br> 'beginWakeUp'<br><br> \| 'endWakeUp'<br><br> \| 'beginScreenOn'<br><br> \| 'endScreenOn'<br><br> \| 'beginScreenOff'<br><br> \| 'endScreenOff'<br><br> \| 'unlockScreen'<br><br> \| 'lockScreen'<br><br> \| 'beginExitAnimation'<br><br> \| 'beginSleep'<br><br> \| 'endSleep'<br><br> \| 'changeUser'<br><br> \| 'screenlockEnabled'<br><br> \| 'serviceRestart'|@ohos.screenLock.d.ts| +|新增|NA|类名:screenLock<br>方法or属性:function isLocked(): boolean;|@ohos.screenLock.d.ts| +|新增|NA|类名:screenLock<br>方法or属性:function unlock(callback: AsyncCallback\<boolean>): void;|@ohos.screenLock.d.ts| +|新增|NA|类名:screenLock<br>方法or属性:function unlock():Promise\<boolean>;|@ohos.screenLock.d.ts| +|新增|NA|类名:screenLock<br>方法or属性:function lock(callback: AsyncCallback\<boolean>): void;|@ohos.screenLock.d.ts| +|新增|NA|类名:screenLock<br>方法or属性:function lock():Promise\<boolean>;|@ohos.screenLock.d.ts| +|新增|NA|模块名: ohos.screenLock<br>类名: SystemEvent|@ohos.screenLock.d.ts| +|新增|NA|类名:SystemEvent<br>方法or属性:|@ohos.screenLock.d.ts| +|新增|NA|模块名: ohos.screenLock<br>类名: SystemEvent<br>方法 or 属性:eventType: EventType,|@ohos.screenLock.d.ts| +|新增|NA|类名:SystemEvent<br>方法or属性:eventType: EventType,|@ohos.screenLock.d.ts| +|新增|NA|模块名: ohos.screenLock<br>类名: SystemEvent<br>方法 or 属性:params: string|@ohos.screenLock.d.ts| +|新增|NA|类名:SystemEvent<br>方法or属性:params: string|@ohos.screenLock.d.ts| +|新增|NA|类名:screenLock<br>方法or属性:function onSystemEvent(callback: Callback\<SystemEvent>): boolean;|@ohos.screenLock.d.ts| +|新增|NA|类名:screenLock<br>方法or属性:function sendScreenLockEvent(event: String, parameter: number, callback: AsyncCallback\<boolean>): void;|@ohos.screenLock.d.ts| +|新增|NA|类名:screenLock<br>方法or属性:function sendScreenLockEvent(event: String, parameter: number): Promise\<boolean>;|@ohos.screenLock.d.ts| +|新增|NA|模块名: ohos.systemDateTime<br>类名: systemDateTime|@ohos.systemDateTime.d.ts| +|新增|NA|模块名: ohos.systemDateTime<br>类名: systemDateTime<br>方法 or 属性: function setTime(time : number, callback : AsyncCallback\<void>) : void;|@ohos.systemDateTime.d.ts| +|新增|NA|模块名: ohos.systemDateTime<br>类名: systemDateTime<br>方法 or 属性: function setTime(time : number) : Promise\<void>;|@ohos.systemDateTime.d.ts| +|新增|NA|模块名: ohos.systemDateTime<br>类名: systemDateTime<br>方法 or 属性: function getCurrentTime(isNano: boolean, callback: AsyncCallback\<number>): void;|@ohos.systemDateTime.d.ts| +|新增|NA|模块名: ohos.systemDateTime<br>类名: systemDateTime<br>方法 or 属性: function getCurrentTime(callback: AsyncCallback\<number>): void;|@ohos.systemDateTime.d.ts| +|新增|NA|模块名: ohos.systemDateTime<br>类名: systemDateTime<br>方法 or 属性: function getCurrentTime(isNano?: boolean): Promise\<number>;|@ohos.systemDateTime.d.ts| +|新增|NA|模块名: ohos.systemDateTime<br>类名: systemDateTime<br>方法 or 属性: function getRealActiveTime(isNano: boolean, callback: AsyncCallback\<number>): void;|@ohos.systemDateTime.d.ts| +|新增|NA|模块名: ohos.systemDateTime<br>类名: systemDateTime<br>方法 or 属性: function getRealActiveTime(callback: AsyncCallback\<number>): void;|@ohos.systemDateTime.d.ts| +|新增|NA|模块名: ohos.systemDateTime<br>类名: systemDateTime<br>方法 or 属性: function getRealActiveTime(isNano?: boolean): Promise\<number>;|@ohos.systemDateTime.d.ts| +|新增|NA|模块名: ohos.systemDateTime<br>类名: systemDateTime<br>方法 or 属性: function getRealTime(isNano: boolean, callback: AsyncCallback\<number>): void;|@ohos.systemDateTime.d.ts| +|新增|NA|模块名: ohos.systemDateTime<br>类名: systemDateTime<br>方法 or 属性: function getRealTime(callback: AsyncCallback\<number>): void;|@ohos.systemDateTime.d.ts| +|新增|NA|模块名: ohos.systemDateTime<br>类名: systemDateTime<br>方法 or 属性: function getRealTime(isNano?: boolean): Promise\<number>;|@ohos.systemDateTime.d.ts| +|新增|NA|模块名: ohos.systemDateTime<br>类名: systemDateTime<br>方法 or 属性: function setDate(date: Date, callback: AsyncCallback\<void>): void;|@ohos.systemDateTime.d.ts| +|新增|NA|模块名: ohos.systemDateTime<br>类名: systemDateTime<br>方法 or 属性: function setDate(date: Date): Promise\<void>;|@ohos.systemDateTime.d.ts| +|新增|NA|模块名: ohos.systemDateTime<br>类名: systemDateTime<br>方法 or 属性: function getDate(callback: AsyncCallback\<Date>): void;|@ohos.systemDateTime.d.ts| +|新增|NA|模块名: ohos.systemDateTime<br>类名: systemDateTime<br>方法 or 属性: function getDate(): Promise\<Date>;|@ohos.systemDateTime.d.ts| +|新增|NA|模块名: ohos.systemDateTime<br>类名: systemDateTime<br>方法 or 属性: function setTimezone(timezone: string, callback: AsyncCallback\<void>): void;|@ohos.systemDateTime.d.ts| +|新增|NA|模块名: ohos.systemDateTime<br>类名: systemDateTime<br>方法 or 属性: function setTimezone(timezone: string): Promise\<void>;|@ohos.systemDateTime.d.ts| +|新增|NA|模块名: ohos.systemDateTime<br>类名: systemDateTime<br>方法 or 属性: function getTimezone(callback: AsyncCallback\<string>): void;|@ohos.systemDateTime.d.ts| +|新增|NA|模块名: ohos.systemDateTime<br>类名: systemDateTime<br>方法 or 属性: function getTimezone(): Promise\<string>;|@ohos.systemDateTime.d.ts| +|新增|NA|类名:wallpaper<br>方法or属性:function getColorsSync(wallpaperType: WallpaperType): Array\<RgbaColor>;|@ohos.wallpaper.d.ts| +|新增|NA|类名:wallpaper<br>方法or属性:function getMinHeightSync(): number;|@ohos.wallpaper.d.ts| +|新增|NA|类名:wallpaper<br>方法or属性:function getMinWidthSync(): number;|@ohos.wallpaper.d.ts| +|新增|NA|类名:wallpaper<br>方法or属性:function restore(wallpaperType: WallpaperType, callback: AsyncCallback\<void>): void;|@ohos.wallpaper.d.ts| +|新增|NA|类名:wallpaper<br>方法or属性:function restore(wallpaperType: WallpaperType): Promise\<void>;|@ohos.wallpaper.d.ts| +|新增|NA|类名:wallpaper<br>方法or属性:function setImage(source: string \| image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback\<void>): void;|@ohos.wallpaper.d.ts| +|新增|NA|类名:wallpaper<br>方法or属性:function setImage(source: string \| image.PixelMap, wallpaperType: WallpaperType): Promise\<void>;|@ohos.wallpaper.d.ts| +|新增|NA|类名:wallpaper<br>方法or属性:function getImage(wallpaperType: WallpaperType, callback: AsyncCallback\<image.PixelMap>): void;|@ohos.wallpaper.d.ts| +|新增|NA|类名:wallpaper<br>方法or属性:function getImage(wallpaperType: WallpaperType): Promise\<image.PixelMap>;|@ohos.wallpaper.d.ts| +|删除|模块名: ohos.inputmethod<br>类名: inputMethod|NA|@ohos.inputmethod.d.ts| +|删除|模块名: ohos.inputmethod<br>类名: inputMethod<br>方法 or 属性:const MAX_TYPE_NUM: number|NA|@ohos.inputmethod.d.ts| +|删除|模块名: ohos.inputmethod<br>类名: inputMethod<br>方法 or 属性:function getInputMethodSetting(): InputMethodSetting;|NA|@ohos.inputmethod.d.ts| +|删除|模块名: ohos.inputmethod<br>类名: inputMethod<br>方法 or 属性:function getInputMethodController(): InputMethodController;|NA|@ohos.inputmethod.d.ts| +|删除|模块名: ohos.inputmethod<br>类名: InputMethodSetting|NA|@ohos.inputmethod.d.ts| +|删除|模块名: ohos.inputmethod<br>类名: InputMethodSetting<br>方法 or 属性:listInputMethod(callback: AsyncCallback\<Array\<InputMethodProperty>>): void;|NA|@ohos.inputmethod.d.ts| +|删除|模块名: ohos.inputmethod<br>类名: InputMethodSetting<br>方法 or 属性:listInputMethod(): Promise\<Array\<InputMethodProperty>>;|NA|@ohos.inputmethod.d.ts| +|删除|模块名: ohos.inputmethod<br>类名: InputMethodSetting<br>方法 or 属性:displayOptionalInputMethod(callback: AsyncCallback\<void>): void;|NA|@ohos.inputmethod.d.ts| +|删除|模块名: ohos.inputmethod<br>类名: InputMethodSetting<br>方法 or 属性:displayOptionalInputMethod(): Promise\<void>;|NA|@ohos.inputmethod.d.ts| +|删除|模块名: ohos.inputmethod<br>类名: InputMethodController|NA|@ohos.inputmethod.d.ts| +|删除|模块名: ohos.inputmethod<br>类名: InputMethodController<br>方法 or 属性:stopInput(callback: AsyncCallback\<boolean>): void;|NA|@ohos.inputmethod.d.ts| +|删除|模块名: ohos.inputmethod<br>类名: InputMethodController<br>方法 or 属性:stopInput(): Promise\<boolean>;|NA|@ohos.inputmethod.d.ts| +|删除|模块名: ohos.inputmethod<br>类名: InputMethodProperty|NA|@ohos.inputmethod.d.ts| +|删除|模块名: ohos.inputmethod<br>类名: InputMethodProperty<br>方法 or 属性:readonly packageName: string;|NA|@ohos.inputmethod.d.ts| +|删除|模块名: ohos.inputmethod<br>类名: InputMethodProperty<br>方法 or 属性:readonly methodId: string;|NA|@ohos.inputmethod.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: inputMethodEngine|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: inputMethodEngine<br>方法 or 属性:const ENTER_KEY_TYPE_UNSPECIFIED: number;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: inputMethodEngine<br>方法 or 属性:const ENTER_KEY_TYPE_GO: number;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: inputMethodEngine<br>方法 or 属性:const ENTER_KEY_TYPE_SEARCH: number;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: inputMethodEngine<br>方法 or 属性:const ENTER_KEY_TYPE_SEND: number;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: inputMethodEngine<br>方法 or 属性:const ENTER_KEY_TYPE_NEXT: number;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: inputMethodEngine<br>方法 or 属性:const ENTER_KEY_TYPE_DONE: number;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: inputMethodEngine<br>方法 or 属性:const ENTER_KEY_TYPE_PREVIOUS: number;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: inputMethodEngine<br>方法 or 属性:const PATTERN_NULL: number;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: inputMethodEngine<br>方法 or 属性:const PATTERN_TEXT: number;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: inputMethodEngine<br>方法 or 属性:const PATTERN_NUMBER: number;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: inputMethodEngine<br>方法 or 属性:const PATTERN_PHONE: number;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: inputMethodEngine<br>方法 or 属性:const PATTERN_DATETIME: number;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: inputMethodEngine<br>方法 or 属性:const PATTERN_EMAIL: number;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: inputMethodEngine<br>方法 or 属性:const PATTERN_URI: number;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: inputMethodEngine<br>方法 or 属性:const PATTERN_PASSWORD: number;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: inputMethodEngine<br>方法 or 属性:const FLAG_SELECTING: number;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: inputMethodEngine<br>方法 or 属性:const FLAG_SINGLE_LINE: number;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: inputMethodEngine<br>方法 or 属性:const DISPLAY_MODE_PART: number;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: inputMethodEngine<br>方法 or 属性:const DISPLAY_MODE_FULL: number;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: inputMethodEngine<br>方法 or 属性:const OPTION_ASCII: number;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: inputMethodEngine<br>方法 or 属性:const OPTION_NONE: number;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: inputMethodEngine<br>方法 or 属性:const OPTION_AUTO_CAP_CHARACTERS: number;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: inputMethodEngine<br>方法 or 属性:const OPTION_AUTO_CAP_SENTENCES: number;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: inputMethodEngine<br>方法 or 属性:const OPTION_AUTO_WORDS: number;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: inputMethodEngine<br>方法 or 属性:const OPTION_MULTI_LINE: number;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: inputMethodEngine<br>方法 or 属性:const OPTION_NO_FULLSCREEN: number;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: inputMethodEngine<br>方法 or 属性:function getInputMethodEngine(): InputMethodEngine;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: inputMethodEngine<br>方法 or 属性:function createKeyboardDelegate(): KeyboardDelegate;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: KeyboardController|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: KeyboardController<br>方法 or 属性:hideKeyboard(callback: AsyncCallback\<void>): void;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: KeyboardController<br>方法 or 属性:hideKeyboard(): Promise\<void>;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: InputMethodEngine|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: InputMethodEngine<br>方法 or 属性:on(type: 'inputStart', callback: (kbController: KeyboardController, textInputClient: TextInputClient) => void): void;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: InputMethodEngine<br>方法 or 属性:off(type: 'inputStart', callback?: (kbController: KeyboardController, textInputClient: TextInputClient) => void): void;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: InputMethodEngine<br>方法 or 属性:on(type: 'keyboardShow'\|'keyboardHide', callback: () => void): void;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: InputMethodEngine<br>方法 or 属性:on(type: 'keyboardShow'\|'keyboardHide', callback: () => void): void;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: InputMethodEngine<br>方法 or 属性:off(type: 'keyboardShow'\|'keyboardHide', callback?: () => void): void;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: InputMethodEngine<br>方法 or 属性:off(type: 'keyboardShow'\|'keyboardHide', callback?: () => void): void;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: TextInputClient|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: TextInputClient<br>方法 or 属性:sendKeyFunction(action: number, callback: AsyncCallback\<boolean>): void;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: TextInputClient<br>方法 or 属性:sendKeyFunction(action: number): Promise\<boolean>;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: TextInputClient<br>方法 or 属性:deleteForward(length: number, callback: AsyncCallback\<boolean>): void;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: TextInputClient<br>方法 or 属性:deleteForward(length: number): Promise\<boolean>;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: TextInputClient<br>方法 or 属性:deleteBackward(length: number, callback: AsyncCallback\<boolean>): void;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: TextInputClient<br>方法 or 属性:deleteBackward(length: number): Promise\<boolean>;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: TextInputClient<br>方法 or 属性:insertText(text: string, callback: AsyncCallback\<boolean>): void;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: TextInputClient<br>方法 or 属性:insertText(text: string): Promise\<boolean>;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: TextInputClient<br>方法 or 属性:getForward(length: number, callback: AsyncCallback\<string>): void;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: TextInputClient<br>方法 or 属性:getForward(length: number): Promise\<string>;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: TextInputClient<br>方法 or 属性:getBackward(length: number, callback: AsyncCallback\<string>): void;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: TextInputClient<br>方法 or 属性:getBackward(length: number): Promise\<string>;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: TextInputClient<br>方法 or 属性:getEditorAttribute(callback: AsyncCallback\<EditorAttribute>): void;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: TextInputClient<br>方法 or 属性:getEditorAttribute(): Promise\<EditorAttribute>;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: KeyboardDelegate|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: KeyboardDelegate<br>方法 or 属性:on(type: 'keyDown'\|'keyUp', callback: (event: KeyEvent) => boolean): void;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: KeyboardDelegate<br>方法 or 属性:on(type: 'keyDown'\|'keyUp', callback: (event: KeyEvent) => boolean): void;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: KeyboardDelegate<br>方法 or 属性:off(type: 'keyDown'\|'keyUp', callback?: (event: KeyEvent) => boolean): void;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: KeyboardDelegate<br>方法 or 属性:off(type: 'keyDown'\|'keyUp', callback?: (event: KeyEvent) => boolean): void;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: KeyboardDelegate<br>方法 or 属性:on(type: 'cursorContextChange', callback: (x: number, y: number, height: number) => void): void;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: KeyboardDelegate<br>方法 or 属性:off(type: 'cursorContextChange', callback?: (x: number, y: number, height: number) => void): void;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: KeyboardDelegate<br>方法 or 属性:on(type: 'selectionChange', callback: (oldBegin: number, oldEnd: number, newBegin: number, newEnd: number) => void): void;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: KeyboardDelegate<br>方法 or 属性:off(type: 'selectionChange', callback?: (oldBegin: number, oldEnd: number, newBegin: number, newEnd: number) => void): void;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: KeyboardDelegate<br>方法 or 属性:on(type: 'textChange', callback: (text: string) => void): void;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: KeyboardDelegate<br>方法 or 属性:off(type: 'textChange', callback?: (text: string) => void): void;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: EditorAttribute|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: EditorAttribute<br>方法 or 属性:readonly inputPattern: number;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: EditorAttribute<br>方法 or 属性:readonly enterKeyType: number;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: KeyEvent|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: KeyEvent<br>方法 or 属性:readonly keyCode: number;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名: ohos.inputmethodengine<br>类名: KeyEvent<br>方法 or 属性:readonly keyAction: number;|NA|@ohos.inputmethodengine.d.ts| +|删除|模块名:ohos.wallpaper<br>类名:wallpaper<br>方法 or 属性:function screenshotLiveWallpaper(scale: number, pixelFormat: image.PixelMapFormat, callback: AsyncCallback\<image.PixelMap>): void;|NA|@ohos.wallpaper.d.ts| +|删除|模块名:ohos.wallpaper<br>类名:wallpaper<br>方法 or 属性:function screenshotLiveWallpaper(scale: number, pixelFormat: image.PixelMapFormat): Promise\<image.PixelMap>;|NA|@ohos.wallpaper.d.ts| +|model有变化|类名:request<br>方法 or 属性:function download(config: DownloadConfig, callback: AsyncCallback\<DownloadTask>): void;<br>model:N/A|类名:request<br>方法 or 属性:function download(config: DownloadConfig, callback: AsyncCallback\<DownloadTask>): void;<br>model:@FAModelOnly|@ohos.request.d.ts| +|model有变化|类名:request<br>方法 or 属性:function download(config: DownloadConfig): Promise\<DownloadTask>;<br>model:N/A|类名:request<br>方法 or 属性:function download(config: DownloadConfig): Promise\<DownloadTask>;<br>model:@FAModelOnly|@ohos.request.d.ts| +|model有变化|类名:request<br>方法 or 属性:function upload(config: UploadConfig, callback: AsyncCallback\<UploadTask>): void;<br>model:N/A|类名:request<br>方法 or 属性:function upload(config: UploadConfig, callback: AsyncCallback\<UploadTask>): void;<br>model:@FAModelOnly|@ohos.request.d.ts| +|model有变化|类名:request<br>方法 or 属性:function upload(config: UploadConfig): Promise\<UploadTask>;<br>model:N/A|类名:request<br>方法 or 属性:function upload(config: UploadConfig): Promise\<UploadTask>;<br>model:@FAModelOnly|@ohos.request.d.ts| +|访问级别有变化|类名:systemTimer<br>方法 or 属性:const TIMER_TYPE_REALTIME: number;<br>访问级别:公开API|类名:systemTimer<br>方法 or 属性:const TIMER_TYPE_REALTIME: number;<br>访问级别:系统API|@ohos.systemTimer.d.ts| +|访问级别有变化|类名:systemTimer<br>方法 or 属性:const TIMER_TYPE_WAKEUP: number;<br>访问级别:公开API|类名:systemTimer<br>方法 or 属性:const TIMER_TYPE_WAKEUP: number;<br>访问级别:系统API|@ohos.systemTimer.d.ts| +|访问级别有变化|类名:systemTimer<br>方法 or 属性:const TIMER_TYPE_EXACT: number;<br>访问级别:公开API|类名:systemTimer<br>方法 or 属性:const TIMER_TYPE_EXACT: number;<br>访问级别:系统API|@ohos.systemTimer.d.ts| +|访问级别有变化|类名:systemTimer<br>方法 or 属性:const TIMER_TYPE_IDLE: number;<br>访问级别:公开API|类名:systemTimer<br>方法 or 属性:const TIMER_TYPE_IDLE: number;<br>访问级别:系统API|@ohos.systemTimer.d.ts| +|访问级别有变化|类名:systemTimer<br>方法 or 属性:function createTimer(options: TimerOptions, callback: AsyncCallback\<number>): void;<br>访问级别:公开API|类名:systemTimer<br>方法 or 属性:function createTimer(options: TimerOptions, callback: AsyncCallback\<number>): void;<br>访问级别:系统API|@ohos.systemTimer.d.ts| +|访问级别有变化|类名:systemTimer<br>方法 or 属性:function createTimer(options: TimerOptions): Promise\<number>;<br>访问级别:公开API|类名:systemTimer<br>方法 or 属性:function createTimer(options: TimerOptions): Promise\<number>;<br>访问级别:系统API|@ohos.systemTimer.d.ts| +|访问级别有变化|类名:systemTimer<br>方法 or 属性:function startTimer(timer: number, triggerTime: number, callback: AsyncCallback\<void>): void;<br>访问级别:公开API|类名:systemTimer<br>方法 or 属性:function startTimer(timer: number, triggerTime: number, callback: AsyncCallback\<void>): void;<br>访问级别:系统API|@ohos.systemTimer.d.ts| +|访问级别有变化|类名:systemTimer<br>方法 or 属性:function startTimer(timer: number, triggerTime: number): Promise\<void>;<br>访问级别:公开API|类名:systemTimer<br>方法 or 属性:function startTimer(timer: number, triggerTime: number): Promise\<void>;<br>访问级别:系统API|@ohos.systemTimer.d.ts| +|访问级别有变化|类名:systemTimer<br>方法 or 属性:function stopTimer(timer: number, callback: AsyncCallback\<void>): void;<br>访问级别:公开API|类名:systemTimer<br>方法 or 属性:function stopTimer(timer: number, callback: AsyncCallback\<void>): void;<br>访问级别:系统API|@ohos.systemTimer.d.ts| +|访问级别有变化|类名:systemTimer<br>方法 or 属性:function stopTimer(timer: number): Promise\<void>;<br>访问级别:公开API|类名:systemTimer<br>方法 or 属性:function stopTimer(timer: number): Promise\<void>;<br>访问级别:系统API|@ohos.systemTimer.d.ts| +|访问级别有变化|类名:systemTimer<br>方法 or 属性:function destroyTimer(timer: number, callback: AsyncCallback\<void>): void;<br>访问级别:公开API|类名:systemTimer<br>方法 or 属性:function destroyTimer(timer: number, callback: AsyncCallback\<void>): void;<br>访问级别:系统API|@ohos.systemTimer.d.ts| +|访问级别有变化|类名:systemTimer<br>方法 or 属性:function destroyTimer(timer: number): Promise\<void>;<br>访问级别:公开API|类名:systemTimer<br>方法 or 属性:function destroyTimer(timer: number): Promise\<void>;<br>访问级别:系统API|@ohos.systemTimer.d.ts| +|访问级别有变化|类名:TimerOptions<br>访问级别:公开API|类名:TimerOptions<br>访问级别:系统API|@ohos.systemTimer.d.ts| +|访问级别有变化|类名:TimerOptions<br>方法 or 属性:type: number;<br>访问级别:公开API|类名:TimerOptions<br>方法 or 属性:type: number;<br>访问级别:系统API|@ohos.systemTimer.d.ts| +|访问级别有变化|类名:TimerOptions<br>方法 or 属性:repeat: boolean;<br>访问级别:公开API|类名:TimerOptions<br>方法 or 属性:repeat: boolean;<br>访问级别:系统API|@ohos.systemTimer.d.ts| +|访问级别有变化|类名:TimerOptions<br>方法 or 属性:interval?: number;<br>访问级别:公开API|类名:TimerOptions<br>方法 or 属性:interval?: number;<br>访问级别:系统API|@ohos.systemTimer.d.ts| +|访问级别有变化|类名:TimerOptions<br>方法 or 属性:wantAgent?: WantAgent;<br>访问级别:公开API|类名:TimerOptions<br>方法 or 属性:wantAgent?: WantAgent;<br>访问级别:系统API|@ohos.systemTimer.d.ts| +|访问级别有变化|类名:TimerOptions<br>方法 or 属性:callback?: () => void;<br>访问级别:公开API|类名:TimerOptions<br>方法 or 属性:callback?: () => void;<br>访问级别:系统API|@ohos.systemTimer.d.ts| +|废弃版本有变化|类名:pasteboard<br>方法 or 属性:function createHtmlData(htmlText: string): PasteData;<br>废弃版本:N/A|类名:pasteboard<br>方法 or 属性:function createHtmlData(htmlText: string): PasteData;<br>废弃版本:9<br>代替接口:ohos.pasteboard.pasteboard|@ohos.pasteboard.d.ts| +|废弃版本有变化|类名:pasteboard<br>方法 or 属性:function createWantData(want: Want): PasteData;<br>废弃版本:N/A|类名:pasteboard<br>方法 or 属性:function createWantData(want: Want): PasteData;<br>废弃版本:9<br>代替接口:ohos.pasteboard.pasteboard|@ohos.pasteboard.d.ts| +|废弃版本有变化|类名:pasteboard<br>方法 or 属性:function createPlainTextData(text: string): PasteData;<br>废弃版本:N/A|类名:pasteboard<br>方法 or 属性:function createPlainTextData(text: string): PasteData;<br>废弃版本:9<br>代替接口:ohos.pasteboard.pasteboard|@ohos.pasteboard.d.ts| +|废弃版本有变化|类名:pasteboard<br>方法 or 属性:function createUriData(uri: string): PasteData;<br>废弃版本:N/A|类名:pasteboard<br>方法 or 属性:function createUriData(uri: string): PasteData;<br>废弃版本:9<br>代替接口:ohos.pasteboard.pasteboard|@ohos.pasteboard.d.ts| +|废弃版本有变化|类名:pasteboard<br>方法 or 属性:function createHtmlTextRecord(htmlText: string): PasteDataRecord;<br>废弃版本:N/A|类名:pasteboard<br>方法 or 属性:function createHtmlTextRecord(htmlText: string): PasteDataRecord;<br>废弃版本:9<br>代替接口:ohos.pasteboard.pasteboard|@ohos.pasteboard.d.ts| +|废弃版本有变化|类名:pasteboard<br>方法 or 属性:function createWantRecord(want: Want): PasteDataRecord;<br>废弃版本:N/A|类名:pasteboard<br>方法 or 属性:function createWantRecord(want: Want): PasteDataRecord;<br>废弃版本:9<br>代替接口:ohos.pasteboard.pasteboard|@ohos.pasteboard.d.ts| +|废弃版本有变化|类名:pasteboard<br>方法 or 属性:function createPlainTextRecord(text: string): PasteDataRecord;<br>废弃版本:N/A|类名:pasteboard<br>方法 or 属性:function createPlainTextRecord(text: string): PasteDataRecord;<br>废弃版本:9<br>代替接口:ohos.pasteboard.pasteboard|@ohos.pasteboard.d.ts| +|废弃版本有变化|类名:pasteboard<br>方法 or 属性:function createUriRecord(uri: string): PasteDataRecord;<br>废弃版本:N/A|类名:pasteboard<br>方法 or 属性:function createUriRecord(uri: string): PasteDataRecord;<br>废弃版本:9<br>代替接口:ohos.pasteboard.pasteboard|@ohos.pasteboard.d.ts| +|废弃版本有变化|类名:PasteDataRecord<br>方法 or 属性:convertToText(callback: AsyncCallback\<string>): void;<br>废弃版本:N/A|类名:PasteDataRecord<br>方法 or 属性:convertToText(callback: AsyncCallback\<string>): void;<br>废弃版本:9<br>代替接口:ohos.pasteboard.pasteboard|@ohos.pasteboard.d.ts| +|废弃版本有变化|类名:PasteDataRecord<br>方法 or 属性:convertToText(): Promise\<string>;<br>废弃版本:N/A|类名:PasteDataRecord<br>方法 or 属性:convertToText(): Promise\<string>;<br>废弃版本:9<br>代替接口:ohos.pasteboard.pasteboard|@ohos.pasteboard.d.ts| +|废弃版本有变化|类名:PasteData<br>方法 or 属性:addHtmlRecord(htmlText: string): void;<br>废弃版本:N/A|类名:PasteData<br>方法 or 属性:addHtmlRecord(htmlText: string): void;<br>废弃版本:9<br>代替接口:ohos.pasteboard.pasteboard|@ohos.pasteboard.d.ts| +|废弃版本有变化|类名:PasteData<br>方法 or 属性:addWantRecord(want: Want): void;<br>废弃版本:N/A|类名:PasteData<br>方法 or 属性:addWantRecord(want: Want): void;<br>废弃版本:9<br>代替接口:ohos.pasteboard.pasteboard|@ohos.pasteboard.d.ts| +|废弃版本有变化|类名:PasteData<br>方法 or 属性:addTextRecord(text: string): void;<br>废弃版本:N/A|类名:PasteData<br>方法 or 属性:addTextRecord(text: string): void;<br>废弃版本:9<br>代替接口:ohos.pasteboard.pasteboard|@ohos.pasteboard.d.ts| +|废弃版本有变化|类名:PasteData<br>方法 or 属性:addUriRecord(uri: string): void;<br>废弃版本:N/A|类名:PasteData<br>方法 or 属性:addUriRecord(uri: string): void;<br>废弃版本:9<br>代替接口:ohos.pasteboard.pasteboard|@ohos.pasteboard.d.ts| +|废弃版本有变化|类名:PasteData<br>方法 or 属性:getRecordAt(index: number): PasteDataRecord;<br>废弃版本:N/A|类名:PasteData<br>方法 or 属性:getRecordAt(index: number): PasteDataRecord;<br>废弃版本:9<br>代替接口:ohos.pasteboard.pasteboard|@ohos.pasteboard.d.ts| +|废弃版本有变化|类名:PasteData<br>方法 or 属性:hasMimeType(mimeType: string): boolean;<br>废弃版本:N/A|类名:PasteData<br>方法 or 属性:hasMimeType(mimeType: string): boolean;<br>废弃版本:9<br>代替接口:ohos.pasteboard.pasteboard|@ohos.pasteboard.d.ts| +|废弃版本有变化|类名:PasteData<br>方法 or 属性:removeRecordAt(index: number): boolean;<br>废弃版本:N/A|类名:PasteData<br>方法 or 属性:removeRecordAt(index: number): boolean;<br>废弃版本:9<br>代替接口:ohos.pasteboard.pasteboard|@ohos.pasteboard.d.ts| +|废弃版本有变化|类名:PasteData<br>方法 or 属性:replaceRecordAt(index: number, record: PasteDataRecord): boolean;<br>废弃版本:N/A|类名:PasteData<br>方法 or 属性:replaceRecordAt(index: number, record: PasteDataRecord): boolean;<br>废弃版本:9<br>代替接口:ohos.pasteboard.pasteboard|@ohos.pasteboard.d.ts| +|废弃版本有变化|类名:SystemPasteboard<br>方法 or 属性:clear(callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:SystemPasteboard<br>方法 or 属性:clear(callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.pasteboard.pasteboard|@ohos.pasteboard.d.ts| +|废弃版本有变化|类名:SystemPasteboard<br>方法 or 属性:clear(): Promise\<void>;<br>废弃版本:N/A|类名:SystemPasteboard<br>方法 or 属性:clear(): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.pasteboard.pasteboard|@ohos.pasteboard.d.ts| +|废弃版本有变化|类名:SystemPasteboard<br>方法 or 属性:getPasteData(callback: AsyncCallback\<PasteData>): void;<br>废弃版本:N/A|类名:SystemPasteboard<br>方法 or 属性:getPasteData(callback: AsyncCallback\<PasteData>): void;<br>废弃版本:9<br>代替接口:ohos.pasteboard.pasteboard|@ohos.pasteboard.d.ts| +|废弃版本有变化|类名:SystemPasteboard<br>方法 or 属性:getPasteData(): Promise\<PasteData>;<br>废弃版本:N/A|类名:SystemPasteboard<br>方法 or 属性:getPasteData(): Promise\<PasteData>;<br>废弃版本:9<br>代替接口:ohos.pasteboard.pasteboard|@ohos.pasteboard.d.ts| +|废弃版本有变化|类名:SystemPasteboard<br>方法 or 属性:hasPasteData(callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:SystemPasteboard<br>方法 or 属性:hasPasteData(callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:ohos.pasteboard.pasteboard|@ohos.pasteboard.d.ts| +|废弃版本有变化|类名:SystemPasteboard<br>方法 or 属性:hasPasteData(): Promise\<boolean>;<br>废弃版本:N/A|类名:SystemPasteboard<br>方法 or 属性:hasPasteData(): Promise\<boolean>;<br>废弃版本:9<br>代替接口:ohos.pasteboard.pasteboard|@ohos.pasteboard.d.ts| +|废弃版本有变化|类名:SystemPasteboard<br>方法 or 属性:setPasteData(data: PasteData, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:SystemPasteboard<br>方法 or 属性:setPasteData(data: PasteData, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.pasteboard.pasteboard|@ohos.pasteboard.d.ts| +|废弃版本有变化|类名:SystemPasteboard<br>方法 or 属性:setPasteData(data: PasteData): Promise\<void>;<br>废弃版本:N/A|类名:SystemPasteboard<br>方法 or 属性:setPasteData(data: PasteData): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.pasteboard.pasteboard|@ohos.pasteboard.d.ts| +|废弃版本有变化|类名:request<br>方法 or 属性:function download(config: DownloadConfig, callback: AsyncCallback\<DownloadTask>): void;<br>废弃版本:N/A|类名:request<br>方法 or 属性:function download(config: DownloadConfig, callback: AsyncCallback\<DownloadTask>): void;<br>废弃版本:9<br>代替接口:ohos.request.downloadFile |@ohos.request.d.ts| +|废弃版本有变化|类名:request<br>方法 or 属性:function download(config: DownloadConfig): Promise\<DownloadTask>;<br>废弃版本:N/A|类名:request<br>方法 or 属性:function download(config: DownloadConfig): Promise\<DownloadTask>;<br>废弃版本:9<br>代替接口:ohos.request.downloadFile |@ohos.request.d.ts| +|废弃版本有变化|类名:request<br>方法 or 属性:function upload(config: UploadConfig, callback: AsyncCallback\<UploadTask>): void;<br>废弃版本:N/A|类名:request<br>方法 or 属性:function upload(config: UploadConfig, callback: AsyncCallback\<UploadTask>): void;<br>废弃版本:9<br>代替接口:ohos.request.uploadFile |@ohos.request.d.ts| +|废弃版本有变化|类名:request<br>方法 or 属性:function upload(config: UploadConfig): Promise\<UploadTask>;<br>废弃版本:N/A|类名:request<br>方法 or 属性:function upload(config: UploadConfig): Promise\<UploadTask>;<br>废弃版本:9<br>代替接口:ohos.request.uploadFile |@ohos.request.d.ts| +|废弃版本有变化|类名:DownloadTask<br>方法 or 属性:remove(callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:DownloadTask<br>方法 or 属性:remove(callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:ohos.request.delete |@ohos.request.d.ts| +|废弃版本有变化|类名:DownloadTask<br>方法 or 属性:remove(): Promise\<boolean>;<br>废弃版本:N/A|类名:DownloadTask<br>方法 or 属性:remove(): Promise\<boolean>;<br>废弃版本:9<br>代替接口:ohos.request.delete |@ohos.request.d.ts| +|废弃版本有变化|类名:DownloadTask<br>方法 or 属性:pause(callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:DownloadTask<br>方法 or 属性:pause(callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.request.suspend |@ohos.request.d.ts| +|废弃版本有变化|类名:DownloadTask<br>方法 or 属性:pause(): Promise\<void>;<br>废弃版本:N/A|类名:DownloadTask<br>方法 or 属性:pause(): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.request.suspend |@ohos.request.d.ts| +|废弃版本有变化|类名:DownloadTask<br>方法 or 属性:resume(callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:DownloadTask<br>方法 or 属性:resume(callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.request.restore |@ohos.request.d.ts| +|废弃版本有变化|类名:DownloadTask<br>方法 or 属性:resume(): Promise\<void>;<br>废弃版本:N/A|类名:DownloadTask<br>方法 or 属性:resume(): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.request.restore |@ohos.request.d.ts| +|废弃版本有变化|类名:DownloadTask<br>方法 or 属性:query(callback: AsyncCallback\<DownloadInfo>): void;<br>废弃版本:N/A|类名:DownloadTask<br>方法 or 属性:query(callback: AsyncCallback\<DownloadInfo>): void;<br>废弃版本:9<br>代替接口:ohos.request.getTaskInfo |@ohos.request.d.ts| +|废弃版本有变化|类名:DownloadTask<br>方法 or 属性:query(): Promise\<DownloadInfo>;<br>废弃版本:N/A|类名:DownloadTask<br>方法 or 属性:query(): Promise\<DownloadInfo>;<br>废弃版本:9<br>代替接口:ohos.request.getTaskInfo |@ohos.request.d.ts| +|废弃版本有变化|类名:DownloadTask<br>方法 or 属性:queryMimeType(callback: AsyncCallback\<string>): void;<br>废弃版本:N/A|类名:DownloadTask<br>方法 or 属性:queryMimeType(callback: AsyncCallback\<string>): void;<br>废弃版本:9<br>代替接口:ohos.request.getTaskMimeType |@ohos.request.d.ts| +|废弃版本有变化|类名:DownloadTask<br>方法 or 属性:queryMimeType(): Promise\<string>;<br>废弃版本:N/A|类名:DownloadTask<br>方法 or 属性:queryMimeType(): Promise\<string>;<br>废弃版本:9<br>代替接口:ohos.request.getTaskMimeType |@ohos.request.d.ts| +|废弃版本有变化|类名:UploadTask<br>方法 or 属性:remove(callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:UploadTask<br>方法 or 属性:remove(callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:ohos.request.delete |@ohos.request.d.ts| +|废弃版本有变化|类名:UploadTask<br>方法 or 属性:remove(): Promise\<boolean>;<br>废弃版本:N/A|类名:UploadTask<br>方法 or 属性:remove(): Promise\<boolean>;<br>废弃版本:9<br>代替接口:ohos.request.delete |@ohos.request.d.ts| +|废弃版本有变化|类名:screenLock<br>方法 or 属性:function isScreenLocked(callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:screenLock<br>方法 or 属性:function isScreenLocked(callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.screenLock.d.ts| +|废弃版本有变化|类名:screenLock<br>方法 or 属性:function isScreenLocked(): Promise\<boolean>;<br>废弃版本:N/A|类名:screenLock<br>方法 or 属性:function isScreenLocked(): Promise\<boolean>;<br>废弃版本:9<br>代替接口:N/A|@ohos.screenLock.d.ts| +|废弃版本有变化|类名:screenLock<br>方法 or 属性:function isSecureMode(callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:screenLock<br>方法 or 属性:function isSecureMode(callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.screenLock.d.ts| +|废弃版本有变化|类名:screenLock<br>方法 or 属性:function isSecureMode(): Promise\<boolean>;<br>废弃版本:N/A|类名:screenLock<br>方法 or 属性:function isSecureMode(): Promise\<boolean>;<br>废弃版本:9<br>代替接口:N/A|@ohos.screenLock.d.ts| +|废弃版本有变化|类名:screenLock<br>方法 or 属性:function unlockScreen(callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:screenLock<br>方法 or 属性:function unlockScreen(callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.screenLock.d.ts| +|废弃版本有变化|类名:screenLock<br>方法 or 属性:function unlockScreen():Promise\<void>;<br>废弃版本:N/A|类名:screenLock<br>方法 or 属性:function unlockScreen():Promise\<void>;<br>废弃版本:9<br>代替接口:N/A|@ohos.screenLock.d.ts| +|废弃版本有变化|类名:systemTime<br>废弃版本:N/A|类名:systemTime<br>废弃版本:9<br>代替接口:ohos.systemDateTime |@ohos.systemTime.d.ts| +|废弃版本有变化|类名:systemTime<br>方法 or 属性:function setTime(time : number, callback : AsyncCallback\<void>) : void;<br>废弃版本:N/A|类名:systemTime<br>方法 or 属性:function setTime(time : number, callback : AsyncCallback\<void>) : void;<br>废弃版本:9<br>代替接口:N/A|@ohos.systemTime.d.ts| +|废弃版本有变化|类名:systemTime<br>方法 or 属性:function setTime(time : number) : Promise\<void>;<br>废弃版本:N/A|类名:systemTime<br>方法 or 属性:function setTime(time : number) : Promise\<void>;<br>废弃版本:9<br>代替接口:N/A|@ohos.systemTime.d.ts| +|废弃版本有变化|类名:systemTime<br>方法 or 属性:function getCurrentTime(isNano?: boolean): Promise\<number>;<br>废弃版本:N/A|类名:systemTime<br>方法 or 属性:function getCurrentTime(isNano?: boolean): Promise\<number>;<br>废弃版本:9<br>代替接口:ohos.systemDateTime/systemDateTime.getCurrentTime |@ohos.systemTime.d.ts| +|废弃版本有变化|类名:systemTime<br>方法 or 属性:function getRealActiveTime(isNano?: boolean): Promise\<number>;<br>废弃版本:N/A|类名:systemTime<br>方法 or 属性:function getRealActiveTime(isNano?: boolean): Promise\<number>;<br>废弃版本:9<br>代替接口:ohos.systemDateTime/systemDateTime.getRealActiveTime |@ohos.systemTime.d.ts| +|废弃版本有变化|类名:systemTime<br>方法 or 属性:function getRealTime(isNano?: boolean): Promise\<number>;<br>废弃版本:N/A|类名:systemTime<br>方法 or 属性:function getRealTime(isNano?: boolean): Promise\<number>;<br>废弃版本:9<br>代替接口:ohos.systemDateTime/systemDateTime.getRealTime |@ohos.systemTime.d.ts| +|废弃版本有变化|类名:systemTime<br>方法 or 属性:function setDate(date: Date, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:systemTime<br>方法 or 属性:function setDate(date: Date, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.systemTime.d.ts| +|废弃版本有变化|类名:systemTime<br>方法 or 属性:function setDate(date: Date): Promise\<void>;<br>废弃版本:N/A|类名:systemTime<br>方法 or 属性:function setDate(date: Date): Promise\<void>;<br>废弃版本:9<br>代替接口:N/A|@ohos.systemTime.d.ts| +|废弃版本有变化|类名:systemTime<br>方法 or 属性:function getDate(callback: AsyncCallback\<Date>): void;<br>废弃版本:N/A|类名:systemTime<br>方法 or 属性:function getDate(callback: AsyncCallback\<Date>): void;<br>废弃版本:9<br>代替接口:ohos.systemDateTime/systemDateTime.getDate |@ohos.systemTime.d.ts| +|废弃版本有变化|类名:systemTime<br>方法 or 属性:function getDate(): Promise\<Date>;<br>废弃版本:N/A|类名:systemTime<br>方法 or 属性:function getDate(): Promise\<Date>;<br>废弃版本:9<br>代替接口:ohos.systemDateTime/systemDateTime.getDate |@ohos.systemTime.d.ts| +|废弃版本有变化|类名:systemTime<br>方法 or 属性:function setTimezone(timezone: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:systemTime<br>方法 or 属性:function setTimezone(timezone: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.systemTime.d.ts| +|废弃版本有变化|类名:systemTime<br>方法 or 属性:function setTimezone(timezone: string): Promise\<void>;<br>废弃版本:N/A|类名:systemTime<br>方法 or 属性:function setTimezone(timezone: string): Promise\<void>;<br>废弃版本:9<br>代替接口:N/A|@ohos.systemTime.d.ts| +|废弃版本有变化|类名:systemTime<br>方法 or 属性:function getTimezone(callback: AsyncCallback\<string>): void;<br>废弃版本:N/A|类名:systemTime<br>方法 or 属性:function getTimezone(callback: AsyncCallback\<string>): void;<br>废弃版本:9<br>代替接口:ohos.systemDateTime/systemDateTime.getTimezone |@ohos.systemTime.d.ts| +|废弃版本有变化|类名:systemTime<br>方法 or 属性:function getTimezone(): Promise\<string>;<br>废弃版本:N/A|类名:systemTime<br>方法 or 属性:function getTimezone(): Promise\<string>;<br>废弃版本:9<br>代替接口:ohos.systemDateTime/systemDateTime.getTimezone |@ohos.systemTime.d.ts| +|废弃版本有变化|类名:RgbaColor<br>废弃版本:N/A|类名:RgbaColor<br>废弃版本:9<br>代替接口:N/A|@ohos.wallpaper.d.ts| +|废弃版本有变化|类名:wallpaper<br>方法 or 属性:function getColors(wallpaperType: WallpaperType, callback: AsyncCallback\<Array\<RgbaColor>>): void;<br>废弃版本:N/A|类名:wallpaper<br>方法 or 属性:function getColors(wallpaperType: WallpaperType, callback: AsyncCallback\<Array\<RgbaColor>>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.wallpaper.d.ts| +|废弃版本有变化|类名:wallpaper<br>方法 or 属性:function getColors(wallpaperType: WallpaperType): Promise\<Array\<RgbaColor>>;<br>废弃版本:N/A|类名:wallpaper<br>方法 or 属性:function getColors(wallpaperType: WallpaperType): Promise\<Array\<RgbaColor>>;<br>废弃版本:9<br>代替接口:N/A|@ohos.wallpaper.d.ts| +|废弃版本有变化|类名:wallpaper<br>方法 or 属性:function getId(wallpaperType: WallpaperType, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:wallpaper<br>方法 or 属性:function getId(wallpaperType: WallpaperType, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.wallpaper.d.ts| +|废弃版本有变化|类名:wallpaper<br>方法 or 属性:function getId(wallpaperType: WallpaperType): Promise\<number>;<br>废弃版本:N/A|类名:wallpaper<br>方法 or 属性:function getId(wallpaperType: WallpaperType): Promise\<number>;<br>废弃版本:9<br>代替接口:N/A|@ohos.wallpaper.d.ts| +|废弃版本有变化|类名:wallpaper<br>方法 or 属性:function getFile(wallpaperType: WallpaperType, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:wallpaper<br>方法 or 属性:function getFile(wallpaperType: WallpaperType, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.wallpaper.d.ts| +|废弃版本有变化|类名:wallpaper<br>方法 or 属性:function getFile(wallpaperType: WallpaperType): Promise\<number>;<br>废弃版本:N/A|类名:wallpaper<br>方法 or 属性:function getFile(wallpaperType: WallpaperType): Promise\<number>;<br>废弃版本:9<br>代替接口:N/A|@ohos.wallpaper.d.ts| +|废弃版本有变化|类名:wallpaper<br>方法 or 属性:function getMinHeight(callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:wallpaper<br>方法 or 属性:function getMinHeight(callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.wallpaper.d.ts| +|废弃版本有变化|类名:wallpaper<br>方法 or 属性:function getMinHeight(): Promise\<number>;<br>废弃版本:N/A|类名:wallpaper<br>方法 or 属性:function getMinHeight(): Promise\<number>;<br>废弃版本:9<br>代替接口:N/A|@ohos.wallpaper.d.ts| +|废弃版本有变化|类名:wallpaper<br>方法 or 属性:function getMinWidth(callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:wallpaper<br>方法 or 属性:function getMinWidth(callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.wallpaper.d.ts| +|废弃版本有变化|类名:wallpaper<br>方法 or 属性:function getMinWidth(): Promise\<number>;<br>废弃版本:N/A|类名:wallpaper<br>方法 or 属性:function getMinWidth(): Promise\<number>;<br>废弃版本:9<br>代替接口:N/A|@ohos.wallpaper.d.ts| +|废弃版本有变化|类名:wallpaper<br>方法 or 属性:function isChangePermitted(callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:wallpaper<br>方法 or 属性:function isChangePermitted(callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.wallpaper.d.ts| +|废弃版本有变化|类名:wallpaper<br>方法 or 属性:function isChangePermitted(): Promise\<boolean>;<br>废弃版本:N/A|类名:wallpaper<br>方法 or 属性:function isChangePermitted(): Promise\<boolean>;<br>废弃版本:9<br>代替接口:N/A|@ohos.wallpaper.d.ts| +|废弃版本有变化|类名:wallpaper<br>方法 or 属性:function isOperationAllowed(callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:wallpaper<br>方法 or 属性:function isOperationAllowed(callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.wallpaper.d.ts| +|废弃版本有变化|类名:wallpaper<br>方法 or 属性:function isOperationAllowed(): Promise\<boolean>;<br>废弃版本:N/A|类名:wallpaper<br>方法 or 属性:function isOperationAllowed(): Promise\<boolean>;<br>废弃版本:9<br>代替接口:N/A|@ohos.wallpaper.d.ts| +|废弃版本有变化|类名:wallpaper<br>方法 or 属性:function reset(wallpaperType: WallpaperType, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:wallpaper<br>方法 or 属性:function reset(wallpaperType: WallpaperType, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.wallpaper.d.ts| +|废弃版本有变化|类名:wallpaper<br>方法 or 属性:function reset(wallpaperType: WallpaperType): Promise\<void>;<br>废弃版本:N/A|类名:wallpaper<br>方法 or 属性:function reset(wallpaperType: WallpaperType): Promise\<void>;<br>废弃版本:9<br>代替接口:N/A|@ohos.wallpaper.d.ts| +|废弃版本有变化|类名:wallpaper<br>方法 or 属性:function setWallpaper(source: string \| image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:wallpaper<br>方法 or 属性:function setWallpaper(source: string \| image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.wallpaper.d.ts| +|废弃版本有变化|类名:wallpaper<br>方法 or 属性:function setWallpaper(source: string \| image.PixelMap, wallpaperType: WallpaperType): Promise\<void>;<br>废弃版本:N/A|类名:wallpaper<br>方法 or 属性:function setWallpaper(source: string \| image.PixelMap, wallpaperType: WallpaperType): Promise\<void>;<br>废弃版本:9<br>代替接口:N/A|@ohos.wallpaper.d.ts| +|废弃版本有变化|类名:wallpaper<br>方法 or 属性:function getPixelMap(wallpaperType: WallpaperType, callback: AsyncCallback\<image.PixelMap>): void;<br>废弃版本:N/A|类名:wallpaper<br>方法 or 属性:function getPixelMap(wallpaperType: WallpaperType, callback: AsyncCallback\<image.PixelMap>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.wallpaper.d.ts| +|废弃版本有变化|类名:wallpaper<br>方法 or 属性:function getPixelMap(wallpaperType: WallpaperType): Promise\<image.PixelMap>;<br>废弃版本:N/A|类名:wallpaper<br>方法 or 属性:function getPixelMap(wallpaperType: WallpaperType): Promise\<image.PixelMap>;<br>废弃版本:9<br>代替接口:N/A|@ohos.wallpaper.d.ts| +|废弃版本有变化|类名:wallpaper<br>方法 or 属性:function on(type: 'colorChange', callback: (colors: Array\<RgbaColor>, wallpaperType: WallpaperType) => void): void;<br>废弃版本:N/A|类名:wallpaper<br>方法 or 属性:function on(type: 'colorChange', callback: (colors: Array\<RgbaColor>, wallpaperType: WallpaperType) => void): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.wallpaper.d.ts| +|废弃版本有变化|类名:wallpaper<br>方法 or 属性:function off(type: 'colorChange', callback?: (colors: Array\<RgbaColor>, wallpaperType: WallpaperType) => void): void;<br>废弃版本:N/A|类名:wallpaper<br>方法 or 属性:function off(type: 'colorChange', callback?: (colors: Array\<RgbaColor>, wallpaperType: WallpaperType) => void): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.wallpaper.d.ts| +|废弃版本有变化|类名:UploadResponse<br>废弃版本:N/A|类名:UploadResponse<br>废弃版本:9<br>代替接口:ohos.request |@system.request.d.ts| +|废弃版本有变化|类名:UploadResponse<br>方法 or 属性:code: number;<br>废弃版本:N/A|类名:UploadResponse<br>方法 or 属性:code: number;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:UploadResponse<br>方法 or 属性:data: string;<br>废弃版本:N/A|类名:UploadResponse<br>方法 or 属性:data: string;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:UploadResponse<br>方法 or 属性:headers: Object;<br>废弃版本:N/A|类名:UploadResponse<br>方法 or 属性:headers: Object;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:DownloadResponse<br>废弃版本:N/A|类名:DownloadResponse<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:DownloadResponse<br>方法 or 属性:token: string;<br>废弃版本:N/A|类名:DownloadResponse<br>方法 or 属性:token: string;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:OnDownloadCompleteResponse<br>废弃版本:N/A|类名:OnDownloadCompleteResponse<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:OnDownloadCompleteResponse<br>方法 or 属性:uri: string;<br>废弃版本:N/A|类名:OnDownloadCompleteResponse<br>方法 or 属性:uri: string;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:RequestFile<br>废弃版本:N/A|类名:RequestFile<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:RequestFile<br>方法 or 属性:filename?: string;<br>废弃版本:N/A|类名:RequestFile<br>方法 or 属性:filename?: string;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:RequestFile<br>方法 or 属性:name?: string;<br>废弃版本:N/A|类名:RequestFile<br>方法 or 属性:name?: string;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:RequestFile<br>方法 or 属性:uri: string;<br>废弃版本:N/A|类名:RequestFile<br>方法 or 属性:uri: string;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:RequestFile<br>方法 or 属性:type?: string;<br>废弃版本:N/A|类名:RequestFile<br>方法 or 属性:type?: string;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:RequestData<br>废弃版本:N/A|类名:RequestData<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:RequestData<br>方法 or 属性:name: string;<br>废弃版本:N/A|类名:RequestData<br>方法 or 属性:name: string;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:RequestData<br>方法 or 属性:value: string;<br>废弃版本:N/A|类名:RequestData<br>方法 or 属性:value: string;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:UploadRequestOptions<br>废弃版本:N/A|类名:UploadRequestOptions<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:UploadRequestOptions<br>方法 or 属性:url: string;<br>废弃版本:N/A|类名:UploadRequestOptions<br>方法 or 属性:url: string;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:UploadRequestOptions<br>方法 or 属性:data?: Array\<RequestData>;<br>废弃版本:N/A|类名:UploadRequestOptions<br>方法 or 属性:data?: Array\<RequestData>;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:UploadRequestOptions<br>方法 or 属性:files: Array\<RequestFile>;<br>废弃版本:N/A|类名:UploadRequestOptions<br>方法 or 属性:files: Array\<RequestFile>;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:UploadRequestOptions<br>方法 or 属性:header?: Object;<br>废弃版本:N/A|类名:UploadRequestOptions<br>方法 or 属性:header?: Object;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:UploadRequestOptions<br>方法 or 属性:method?: string;<br>废弃版本:N/A|类名:UploadRequestOptions<br>方法 or 属性:method?: string;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:UploadRequestOptions<br>方法 or 属性:success?: (data: UploadResponse) => void;<br>废弃版本:N/A|类名:UploadRequestOptions<br>方法 or 属性:success?: (data: UploadResponse) => void;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:UploadRequestOptions<br>方法 or 属性:fail?: (data: any, code: number) => void;<br>废弃版本:N/A|类名:UploadRequestOptions<br>方法 or 属性:fail?: (data: any, code: number) => void;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:UploadRequestOptions<br>方法 or 属性:complete?: () => void;<br>废弃版本:N/A|类名:UploadRequestOptions<br>方法 or 属性:complete?: () => void;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:DownloadRequestOptions<br>废弃版本:N/A|类名:DownloadRequestOptions<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:DownloadRequestOptions<br>方法 or 属性:url: string;<br>废弃版本:N/A|类名:DownloadRequestOptions<br>方法 or 属性:url: string;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:DownloadRequestOptions<br>方法 or 属性:filename?: string;<br>废弃版本:N/A|类名:DownloadRequestOptions<br>方法 or 属性:filename?: string;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:DownloadRequestOptions<br>方法 or 属性:header?: string;<br>废弃版本:N/A|类名:DownloadRequestOptions<br>方法 or 属性:header?: string;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:DownloadRequestOptions<br>方法 or 属性:description?: string;<br>废弃版本:N/A|类名:DownloadRequestOptions<br>方法 or 属性:description?: string;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:DownloadRequestOptions<br>方法 or 属性:success?: (data: DownloadResponse) => void;<br>废弃版本:N/A|类名:DownloadRequestOptions<br>方法 or 属性:success?: (data: DownloadResponse) => void;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:DownloadRequestOptions<br>方法 or 属性:fail?: (data: any, code: number) => void;<br>废弃版本:N/A|类名:DownloadRequestOptions<br>方法 or 属性:fail?: (data: any, code: number) => void;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:DownloadRequestOptions<br>方法 or 属性:complete?: () => void;<br>废弃版本:N/A|类名:DownloadRequestOptions<br>方法 or 属性:complete?: () => void;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:OnDownloadCompleteOptions<br>废弃版本:N/A|类名:OnDownloadCompleteOptions<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:OnDownloadCompleteOptions<br>方法 or 属性:token: string;<br>废弃版本:N/A|类名:OnDownloadCompleteOptions<br>方法 or 属性:token: string;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:OnDownloadCompleteOptions<br>方法 or 属性:success?: (data: OnDownloadCompleteResponse) => void;<br>废弃版本:N/A|类名:OnDownloadCompleteOptions<br>方法 or 属性:success?: (data: OnDownloadCompleteResponse) => void;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:OnDownloadCompleteOptions<br>方法 or 属性:fail?: (data: any, code: number) => void;<br>废弃版本:N/A|类名:OnDownloadCompleteOptions<br>方法 or 属性:fail?: (data: any, code: number) => void;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:OnDownloadCompleteOptions<br>方法 or 属性:complete?: () => void;<br>废弃版本:N/A|类名:OnDownloadCompleteOptions<br>方法 or 属性:complete?: () => void;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:Request<br>废弃版本:N/A|类名:Request<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:Request<br>方法 or 属性:static upload(options: UploadRequestOptions): void;<br>废弃版本:N/A|类名:Request<br>方法 or 属性:static upload(options: UploadRequestOptions): void;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:Request<br>方法 or 属性:static download(options: DownloadRequestOptions): void;<br>废弃版本:N/A|类名:Request<br>方法 or 属性:static download(options: DownloadRequestOptions): void;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|废弃版本有变化|类名:Request<br>方法 or 属性:static onDownloadComplete(options: OnDownloadCompleteOptions): void;<br>废弃版本:N/A|类名:Request<br>方法 or 属性:static onDownloadComplete(options: OnDownloadCompleteOptions): void;<br>废弃版本:9<br>代替接口:N/A|@system.request.d.ts| +|起始版本有变化|类名:DownloadTask<br>起始版本:N/A|类名:DownloadTask<br>起始版本:6|@ohos.request.d.ts| +|起始版本有变化|类名:UploadTask<br>起始版本:N/A|类名:UploadTask<br>起始版本:6|@ohos.request.d.ts| +|起始版本有变化|类名:systemTimer<br>方法 or 属性:const TIMER_TYPE_REALTIME: number;<br>起始版本:N/A|类名:systemTimer<br>方法 or 属性:const TIMER_TYPE_REALTIME: number;<br>起始版本:7|@ohos.systemTimer.d.ts| +|起始版本有变化|类名:systemTimer<br>方法 or 属性:const TIMER_TYPE_WAKEUP: number;<br>起始版本:N/A|类名:systemTimer<br>方法 or 属性:const TIMER_TYPE_WAKEUP: number;<br>起始版本:7|@ohos.systemTimer.d.ts| +|起始版本有变化|类名:systemTimer<br>方法 or 属性:const TIMER_TYPE_EXACT: number;<br>起始版本:N/A|类名:systemTimer<br>方法 or 属性:const TIMER_TYPE_EXACT: number;<br>起始版本:7|@ohos.systemTimer.d.ts| +|起始版本有变化|类名:systemTimer<br>方法 or 属性:const TIMER_TYPE_IDLE: number;<br>起始版本:N/A|类名:systemTimer<br>方法 or 属性:const TIMER_TYPE_IDLE: number;<br>起始版本:7|@ohos.systemTimer.d.ts| +|起始版本有变化|类名:systemTimer<br>方法 or 属性:function createTimer(options: TimerOptions, callback: AsyncCallback\<number>): void;<br>起始版本:N/A|类名:systemTimer<br>方法 or 属性:function createTimer(options: TimerOptions, callback: AsyncCallback\<number>): void;<br>起始版本:7|@ohos.systemTimer.d.ts| +|起始版本有变化|类名:systemTimer<br>方法 or 属性:function createTimer(options: TimerOptions): Promise\<number>;<br>起始版本:N/A|类名:systemTimer<br>方法 or 属性:function createTimer(options: TimerOptions): Promise\<number>;<br>起始版本:7|@ohos.systemTimer.d.ts| +|起始版本有变化|类名:systemTimer<br>方法 or 属性:function startTimer(timer: number, triggerTime: number, callback: AsyncCallback\<void>): void;<br>起始版本:N/A|类名:systemTimer<br>方法 or 属性:function startTimer(timer: number, triggerTime: number, callback: AsyncCallback\<void>): void;<br>起始版本:7|@ohos.systemTimer.d.ts| +|起始版本有变化|类名:systemTimer<br>方法 or 属性:function startTimer(timer: number, triggerTime: number): Promise\<void>;<br>起始版本:N/A|类名:systemTimer<br>方法 or 属性:function startTimer(timer: number, triggerTime: number): Promise\<void>;<br>起始版本:7|@ohos.systemTimer.d.ts| +|起始版本有变化|类名:systemTimer<br>方法 or 属性:function stopTimer(timer: number, callback: AsyncCallback\<void>): void;<br>起始版本:N/A|类名:systemTimer<br>方法 or 属性:function stopTimer(timer: number, callback: AsyncCallback\<void>): void;<br>起始版本:7|@ohos.systemTimer.d.ts| +|起始版本有变化|类名:systemTimer<br>方法 or 属性:function stopTimer(timer: number): Promise\<void>;<br>起始版本:N/A|类名:systemTimer<br>方法 or 属性:function stopTimer(timer: number): Promise\<void>;<br>起始版本:7|@ohos.systemTimer.d.ts| +|起始版本有变化|类名:systemTimer<br>方法 or 属性:function destroyTimer(timer: number, callback: AsyncCallback\<void>): void;<br>起始版本:N/A|类名:systemTimer<br>方法 or 属性:function destroyTimer(timer: number, callback: AsyncCallback\<void>): void;<br>起始版本:7|@ohos.systemTimer.d.ts| +|起始版本有变化|类名:systemTimer<br>方法 or 属性:function destroyTimer(timer: number): Promise\<void>;<br>起始版本:N/A|类名:systemTimer<br>方法 or 属性:function destroyTimer(timer: number): Promise\<void>;<br>起始版本:7|@ohos.systemTimer.d.ts| +|起始版本有变化|类名:TimerOptions<br>起始版本:N/A|类名:TimerOptions<br>起始版本:7|@ohos.systemTimer.d.ts| +|起始版本有变化|类名:TimerOptions<br>方法 or 属性:type: number;<br>起始版本:N/A|类名:TimerOptions<br>方法 or 属性:type: number;<br>起始版本:7|@ohos.systemTimer.d.ts| +|起始版本有变化|类名:TimerOptions<br>方法 or 属性:repeat: boolean;<br>起始版本:N/A|类名:TimerOptions<br>方法 or 属性:repeat: boolean;<br>起始版本:7|@ohos.systemTimer.d.ts| +|起始版本有变化|类名:TimerOptions<br>方法 or 属性:interval?: number;<br>起始版本:N/A|类名:TimerOptions<br>方法 or 属性:interval?: number;<br>起始版本:7|@ohos.systemTimer.d.ts| +|起始版本有变化|类名:TimerOptions<br>方法 or 属性:wantAgent?: WantAgent;<br>起始版本:N/A|类名:TimerOptions<br>方法 or 属性:wantAgent?: WantAgent;<br>起始版本:7|@ohos.systemTimer.d.ts| +|起始版本有变化|类名:TimerOptions<br>方法 or 属性:callback?: () => void;<br>起始版本:N/A|类名:TimerOptions<br>方法 or 属性:callback?: () => void;<br>起始版本:7|@ohos.systemTimer.d.ts| +|起始版本有变化|类名:RgbaColor<br>起始版本:N/A|类名:RgbaColor<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:WallpaperType<br>起始版本:N/A|类名:WallpaperType<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function getColors(wallpaperType: WallpaperType, callback: AsyncCallback\<Array\<RgbaColor>>): void;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function getColors(wallpaperType: WallpaperType, callback: AsyncCallback\<Array\<RgbaColor>>): void;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function getColors(wallpaperType: WallpaperType): Promise\<Array\<RgbaColor>>;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function getColors(wallpaperType: WallpaperType): Promise\<Array\<RgbaColor>>;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function getId(wallpaperType: WallpaperType, callback: AsyncCallback\<number>): void;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function getId(wallpaperType: WallpaperType, callback: AsyncCallback\<number>): void;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function getId(wallpaperType: WallpaperType): Promise\<number>;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function getId(wallpaperType: WallpaperType): Promise\<number>;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function getMinHeight(callback: AsyncCallback\<number>): void;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function getMinHeight(callback: AsyncCallback\<number>): void;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function getMinHeight(): Promise\<number>;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function getMinHeight(): Promise\<number>;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function getMinWidth(callback: AsyncCallback\<number>): void;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function getMinWidth(callback: AsyncCallback\<number>): void;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function getMinWidth(): Promise\<number>;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function getMinWidth(): Promise\<number>;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function isChangePermitted(callback: AsyncCallback\<boolean>): void;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function isChangePermitted(callback: AsyncCallback\<boolean>): void;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function isChangePermitted(): Promise\<boolean>;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function isChangePermitted(): Promise\<boolean>;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function isOperationAllowed(callback: AsyncCallback\<boolean>): void;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function isOperationAllowed(callback: AsyncCallback\<boolean>): void;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function isOperationAllowed(): Promise\<boolean>;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function isOperationAllowed(): Promise\<boolean>;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function reset(wallpaperType: WallpaperType, callback: AsyncCallback\<void>): void;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function reset(wallpaperType: WallpaperType, callback: AsyncCallback\<void>): void;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function reset(wallpaperType: WallpaperType): Promise\<void>;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function reset(wallpaperType: WallpaperType): Promise\<void>;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function setWallpaper(source: string \| image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback\<void>): void;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function setWallpaper(source: string \| image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback\<void>): void;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function setWallpaper(source: string \| image.PixelMap, wallpaperType: WallpaperType): Promise\<void>;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function setWallpaper(source: string \| image.PixelMap, wallpaperType: WallpaperType): Promise\<void>;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function getPixelMap(wallpaperType: WallpaperType, callback: AsyncCallback\<image.PixelMap>): void;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function getPixelMap(wallpaperType: WallpaperType, callback: AsyncCallback\<image.PixelMap>): void;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function getPixelMap(wallpaperType: WallpaperType): Promise\<image.PixelMap>;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function getPixelMap(wallpaperType: WallpaperType): Promise\<image.PixelMap>;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function on(type: 'colorChange', callback: (colors: Array\<RgbaColor>, wallpaperType: WallpaperType) => void): void;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function on(type: 'colorChange', callback: (colors: Array\<RgbaColor>, wallpaperType: WallpaperType) => void): void;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:wallpaper<br>方法 or 属性:function off(type: 'colorChange', callback?: (colors: Array\<RgbaColor>, wallpaperType: WallpaperType) => void): void;<br>起始版本:N/A|类名:wallpaper<br>方法 or 属性:function off(type: 'colorChange', callback?: (colors: Array\<RgbaColor>, wallpaperType: WallpaperType) => void): void;<br>起始版本:7|@ohos.wallpaper.d.ts| +|起始版本有变化|类名:Request<br>方法 or 属性:static upload(options: UploadRequestOptions): void;<br>起始版本:N/A|类名:Request<br>方法 or 属性:static upload(options: UploadRequestOptions): void;<br>起始版本:3|@system.request.d.ts| +|起始版本有变化|类名:Request<br>方法 or 属性:static download(options: DownloadRequestOptions): void;<br>起始版本:N/A|类名:Request<br>方法 or 属性:static download(options: DownloadRequestOptions): void;<br>起始版本:3|@system.request.d.ts| +|起始版本有变化|类名:Request<br>方法 or 属性:static onDownloadComplete(options: OnDownloadCompleteOptions): void;<br>起始版本:N/A|类名:Request<br>方法 or 属性:static onDownloadComplete(options: OnDownloadCompleteOptions): void;<br>起始版本:3|@system.request.d.ts| +|权限有变化|类名:wallpaper<br>方法 or 属性:function getPixelMap(wallpaperType: WallpaperType, callback: AsyncCallback\<image.PixelMap>): void;<br>权限:ohos.permission.READ_USER_STORAGE|类名:wallpaper<br>方法 or 属性:function getPixelMap(wallpaperType: WallpaperType, callback: AsyncCallback\<image.PixelMap>): void;<br>权限:ohos.permission.GET_WALLPAPER|@ohos.wallpaper.d.ts| +|权限有变化|类名:wallpaper<br>方法 or 属性:function getPixelMap(wallpaperType: WallpaperType): Promise\<image.PixelMap>;<br>权限:ohos.permission.READ_USER_STORAGE|类名:wallpaper<br>方法 or 属性:function getPixelMap(wallpaperType: WallpaperType): Promise\<image.PixelMap>;<br>权限:ohos.permission.GET_WALLPAPER|@ohos.wallpaper.d.ts| +|新增(错误码)|NA|类名:SystemPasteboard<br>方法 or 属性:on(type: 'update', callback: () => void): void;<br>错误码内容: 401|@ohos.pasteboard.d.ts| +|新增(错误码)|NA|类名:SystemPasteboard<br>方法 or 属性:off(type: 'update', callback?: () => void): void;<br>错误码内容: 401|@ohos.pasteboard.d.ts| +|新增(错误码)|NA|类名:systemTimer<br>方法 or 属性:function createTimer(options: TimerOptions, callback: AsyncCallback\<number>): void;<br>错误码内容: 202, 401|@ohos.systemTimer.d.ts| +|新增(错误码)|NA|类名:systemTimer<br>方法 or 属性:function createTimer(options: TimerOptions): Promise\<number>;<br>错误码内容: 202, 401|@ohos.systemTimer.d.ts| +|新增(错误码)|NA|类名:systemTimer<br>方法 or 属性:function startTimer(timer: number, triggerTime: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 202, 401|@ohos.systemTimer.d.ts| +|新增(错误码)|NA|类名:systemTimer<br>方法 or 属性:function startTimer(timer: number, triggerTime: number): Promise\<void>;<br>错误码内容: 202, 401|@ohos.systemTimer.d.ts| +|新增(错误码)|NA|类名:systemTimer<br>方法 or 属性:function stopTimer(timer: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 202, 401|@ohos.systemTimer.d.ts| +|新增(错误码)|NA|类名:systemTimer<br>方法 or 属性:function stopTimer(timer: number): Promise\<void>;<br>错误码内容: 202, 401|@ohos.systemTimer.d.ts| +|新增(错误码)|NA|类名:systemTimer<br>方法 or 属性:function destroyTimer(timer: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 202, 401|@ohos.systemTimer.d.ts| +|新增(错误码)|NA|类名:systemTimer<br>方法 or 属性:function destroyTimer(timer: number): Promise\<void>;<br>错误码内容: 202, 401|@ohos.systemTimer.d.ts| +|新增(权限)|类名:DownloadTask<br>权限:N/A|类名:DownloadTask<br>权限:ohos.permission.INTERNET|@ohos.request.d.ts| +|新增(权限)|类名:UploadTask<br>权限:N/A|类名:UploadTask<br>权限:ohos.permission.INTERNET|@ohos.request.d.ts| +|SysCap有变化|类名:DownloadTask<br>SysCap:N/A|类名:DownloadTask<br>SysCap:SystemCapability.MiscServices.Download|@ohos.request.d.ts| +|SysCap有变化|类名:UploadTask<br>SysCap:N/A|类名:UploadTask<br>SysCap:SystemCapability.MiscServices.Download|@ohos.request.d.ts| +|函数有变化|类名:systemTime<br>方法 or 属性:function getCurrentTime(isNano?: boolean, callback: AsyncCallback\<number>): void;<br>|类名:systemTime<br>方法 or 属性:function getCurrentTime(isNano: boolean, callback: AsyncCallback\<number>): void;<br>|@ohos.systemTime.d.ts| +|函数有变化|类名:systemTime<br>方法 or 属性:function getCurrentTime(isNano?: boolean, callback: AsyncCallback\<number>): void;<br>|类名:systemTime<br>方法 or 属性:function getCurrentTime(callback: AsyncCallback\<number>): void;<br>|@ohos.systemTime.d.ts| +|函数有变化|类名:systemTime<br>方法 or 属性:function getRealActiveTime(isNano?: boolean, callback: AsyncCallback\<number>): void;<br>|类名:systemTime<br>方法 or 属性:function getRealActiveTime(isNano: boolean, callback: AsyncCallback\<number>): void;<br>|@ohos.systemTime.d.ts| +|函数有变化|类名:systemTime<br>方法 or 属性:function getRealActiveTime(isNano?: boolean, callback: AsyncCallback\<number>): void;<br>|类名:systemTime<br>方法 or 属性:function getRealActiveTime(callback: AsyncCallback\<number>): void;<br>|@ohos.systemTime.d.ts| +|函数有变化|类名:systemTime<br>方法 or 属性:function getRealTime(isNano?: boolean, callback: AsyncCallback\<number>): void;<br>|类名:systemTime<br>方法 or 属性:function getRealTime(isNano: boolean, callback: AsyncCallback\<number>): void;<br>|@ohos.systemTime.d.ts| +|函数有变化|类名:systemTime<br>方法 or 属性:function getRealTime(isNano?: boolean, callback: AsyncCallback\<number>): void;<br>|类名:systemTime<br>方法 or 属性:function getRealTime(callback: AsyncCallback\<number>): void;<br>|@ohos.systemTime.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-msdp.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-msdp.md new file mode 100644 index 0000000000000000000000000000000000000000..b3d4c74b87764202a15d060ff82550b8a0190f8c --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-msdp.md @@ -0,0 +1,17 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.stationary<br>类名: stationary|@ohos.stationary.d.ts| +|新增|NA|模块名: ohos.stationary<br>类名: ActivityType<br>方法 or 属性: type ActivityType = 'still' \| 'relativeStill';|@ohos.stationary.d.ts| +|新增|NA|模块名: ohos.stationary<br>类名: ActivityType<br>方法 or 属性: type ActivityType = 'still' \| 'relativeStill';|@ohos.stationary.d.ts| +|新增|NA|模块名: ohos.stationary<br>类名: ActivityResponse|@ohos.stationary.d.ts| +|新增|NA|模块名: ohos.stationary<br>类名: ActivityResponse<br>方法 or 属性: state: ActivityState;|@ohos.stationary.d.ts| +|新增|NA|模块名: ohos.stationary<br>类名: ActivityEvent|@ohos.stationary.d.ts| +|新增|NA|模块名: ohos.stationary<br>类名: ActivityEvent<br>方法 or 属性: ENTER = 1|@ohos.stationary.d.ts| +|新增|NA|模块名: ohos.stationary<br>类名: ActivityEvent<br>方法 or 属性: EXIT = 2|@ohos.stationary.d.ts| +|新增|NA|模块名: ohos.stationary<br>类名: ActivityEvent<br>方法 or 属性: ENTER_EXIT = 3|@ohos.stationary.d.ts| +|新增|NA|模块名: ohos.stationary<br>类名: ActivityState|@ohos.stationary.d.ts| +|新增|NA|模块名: ohos.stationary<br>类名: ActivityState<br>方法 or 属性: ENTER = 1|@ohos.stationary.d.ts| +|新增|NA|模块名: ohos.stationary<br>类名: ActivityState<br>方法 or 属性: EXIT = 2|@ohos.stationary.d.ts| +|新增|NA|模块名: ohos.stationary<br>类名: stationary<br>方法 or 属性: function on(activity: ActivityType, event: ActivityEvent, reportLatencyNs: number, callback: Callback\<ActivityResponse>): void;|@ohos.stationary.d.ts| +|新增|NA|模块名: ohos.stationary<br>类名: stationary<br>方法 or 属性: function once(activity: ActivityType, callback: Callback\<ActivityResponse>): void;|@ohos.stationary.d.ts| +|新增|NA|模块名: ohos.stationary<br>类名: stationary<br>方法 or 属性: function off(activity: ActivityType, event: ActivityEvent, callback?: Callback\<ActivityResponse>): void;|@ohos.stationary.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-multi-modal-input.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-multi-modal-input.md new file mode 100644 index 0000000000000000000000000000000000000000..6fece4a2ece02cb53e2bc67ad079b74991979d3d --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-multi-modal-input.md @@ -0,0 +1,601 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.multimodalInput.inputDevice<br>类名: ChangedType<br>方法 or 属性:type ChangedType = 'add' \| 'remove';|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:ChangedType<br>方法or属性:type ChangedType = 'add' \| 'remove';|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDevice<br>类名: ChangedType<br>方法 or 属性:type ChangedType = 'add' \| 'remove';|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:ChangedType<br>方法or属性:type ChangedType = 'add' \| 'remove';|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDevice<br>类名: AxisType<br>方法 or 属性:type AxisType = 'touchMajor' \| 'touchMinor' \| 'orientation' \| 'x' \| 'y' \| 'pressure' \| 'toolMinor' \| 'toolMajor' \| 'NULL';|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:AxisType<br>方法or属性:type AxisType = 'touchMajor' \| 'touchMinor' \| 'orientation' \| 'x' \| 'y' \| 'pressure' \| 'toolMinor' \| 'toolMajor' \| 'NULL';|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDevice<br>类名: AxisType<br>方法 or 属性:type AxisType = 'touchMajor' \| 'touchMinor' \| 'orientation' \| 'x' \| 'y' \| 'pressure' \| 'toolMinor' \| 'toolMajor' \| 'NULL';|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:AxisType<br>方法or属性:type AxisType = 'touchMajor' \| 'touchMinor' \| 'orientation' \| 'x' \| 'y' \| 'pressure' \| 'toolMinor' \| 'toolMajor' \| 'NULL';|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDevice<br>类名: AxisType<br>方法 or 属性:type AxisType = 'touchMajor' \| 'touchMinor' \| 'orientation' \| 'x' \| 'y' \| 'pressure' \| 'toolMinor' \| 'toolMajor' \| 'NULL';|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:AxisType<br>方法or属性:type AxisType = 'touchMajor' \| 'touchMinor' \| 'orientation' \| 'x' \| 'y' \| 'pressure' \| 'toolMinor' \| 'toolMajor' \| 'NULL';|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDevice<br>类名: AxisType<br>方法 or 属性:type AxisType = 'touchMajor' \| 'touchMinor' \| 'orientation' \| 'x' \| 'y' \| 'pressure' \| 'toolMinor' \| 'toolMajor' \| 'NULL';|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:AxisType<br>方法or属性:type AxisType = 'touchMajor' \| 'touchMinor' \| 'orientation' \| 'x' \| 'y' \| 'pressure' \| 'toolMinor' \| 'toolMajor' \| 'NULL';|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDevice<br>类名: AxisType<br>方法 or 属性:type AxisType = 'touchMajor' \| 'touchMinor' \| 'orientation' \| 'x' \| 'y' \| 'pressure' \| 'toolMinor' \| 'toolMajor' \| 'NULL';|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:AxisType<br>方法or属性:type AxisType = 'touchMajor' \| 'touchMinor' \| 'orientation' \| 'x' \| 'y' \| 'pressure' \| 'toolMinor' \| 'toolMajor' \| 'NULL';|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDevice<br>类名: AxisType<br>方法 or 属性:type AxisType = 'touchMajor' \| 'touchMinor' \| 'orientation' \| 'x' \| 'y' \| 'pressure' \| 'toolMinor' \| 'toolMajor' \| 'NULL';|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:AxisType<br>方法or属性:type AxisType = 'touchMajor' \| 'touchMinor' \| 'orientation' \| 'x' \| 'y' \| 'pressure' \| 'toolMinor' \| 'toolMajor' \| 'NULL';|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDevice<br>类名: AxisType<br>方法 or 属性:type AxisType = 'touchMajor' \| 'touchMinor' \| 'orientation' \| 'x' \| 'y' \| 'pressure' \| 'toolMinor' \| 'toolMajor' \| 'NULL';|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:AxisType<br>方法or属性:type AxisType = 'touchMajor' \| 'touchMinor' \| 'orientation' \| 'x' \| 'y' \| 'pressure' \| 'toolMinor' \| 'toolMajor' \| 'NULL';|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDevice<br>类名: AxisType<br>方法 or 属性:type AxisType = 'touchMajor' \| 'touchMinor' \| 'orientation' \| 'x' \| 'y' \| 'pressure' \| 'toolMinor' \| 'toolMajor' \| 'NULL';|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:AxisType<br>方法or属性:type AxisType = 'touchMajor' \| 'touchMinor' \| 'orientation' \| 'x' \| 'y' \| 'pressure' \| 'toolMinor' \| 'toolMajor' \| 'NULL';|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDevice<br>类名: AxisType<br>方法 or 属性:type AxisType = 'touchMajor' \| 'touchMinor' \| 'orientation' \| 'x' \| 'y' \| 'pressure' \| 'toolMinor' \| 'toolMajor' \| 'NULL';|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:AxisType<br>方法or属性:type AxisType = 'touchMajor' \| 'touchMinor' \| 'orientation' \| 'x' \| 'y' \| 'pressure' \| 'toolMinor' \| 'toolMajor' \| 'NULL';|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDevice<br>类名: KeyboardType|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:KeyboardType<br>方法or属性:|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDevice<br>类名: KeyboardType<br>方法 or 属性:NONE = 0|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:KeyboardType<br>方法or属性:NONE = 0|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDevice<br>类名: KeyboardType<br>方法 or 属性:UNKNOWN = 1|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:KeyboardType<br>方法or属性:UNKNOWN = 1|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDevice<br>类名: KeyboardType<br>方法 or 属性:ALPHABETIC_KEYBOARD = 2|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:KeyboardType<br>方法or属性:ALPHABETIC_KEYBOARD = 2|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDevice<br>类名: KeyboardType<br>方法 or 属性:DIGITAL_KEYBOARD = 3|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:KeyboardType<br>方法or属性:DIGITAL_KEYBOARD = 3|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDevice<br>类名: KeyboardType<br>方法 or 属性:HANDWRITING_PEN = 4|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:KeyboardType<br>方法or属性:HANDWRITING_PEN = 4|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDevice<br>类名: KeyboardType<br>方法 or 属性:REMOTE_CONTROL = 5|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:KeyboardType<br>方法or属性:REMOTE_CONTROL = 5|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDevice<br>类名: DeviceListener|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:DeviceListener<br>方法or属性:|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDevice<br>类名: DeviceListener<br>方法 or 属性:type: ChangedType;|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:DeviceListener<br>方法or属性:type: ChangedType;|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDevice<br>类名: DeviceListener<br>方法 or 属性:deviceId: number;|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:DeviceListener<br>方法or属性:deviceId: number;|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:inputDevice<br>方法or属性:function on(type: "change", listener: Callback\<DeviceListener>): void;|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:inputDevice<br>方法or属性:function off(type: "change", listener?: Callback\<DeviceListener>): void;|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:AxisRange<br>方法or属性:fuzz: number;|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:AxisRange<br>方法or属性:flat: number;|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:AxisRange<br>方法or属性:resolution: number;|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:InputDeviceData<br>方法or属性:bus: number;|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:InputDeviceData<br>方法or属性:product: number;|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:InputDeviceData<br>方法or属性:vendor: number;|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:InputDeviceData<br>方法or属性:version: number;|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:InputDeviceData<br>方法or属性:phys: string;|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:InputDeviceData<br>方法or属性:uniq: string;|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:inputDevice<br>方法or属性:function getDeviceList(callback: AsyncCallback\<Array\<number>>): void;|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:inputDevice<br>方法or属性:function getDeviceList(): Promise\<Array\<number>>;|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:inputDevice<br>方法or属性:function getDeviceInfo(deviceId: number, callback: AsyncCallback\<InputDeviceData>): void;|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:inputDevice<br>方法or属性:function getDeviceInfo(deviceId: number): Promise\<InputDeviceData>;|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:inputDevice<br>方法or属性:function supportKeys(deviceId: number, keys: Array\<KeyCode>, callback: AsyncCallback\<Array\<boolean>>): void;|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:inputDevice<br>方法or属性:function supportKeys(deviceId: number, keys: Array\<KeyCode>): Promise\<Array\<boolean>>;|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:inputDevice<br>方法or属性:function getKeyboardType(deviceId: number, callback: AsyncCallback\<KeyboardType>): void;|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|类名:inputDevice<br>方法or属性:function getKeyboardType(deviceId: number): Promise\<KeyboardType>;|@ohos.multimodalInput.inputDevice.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDeviceCooperate<br>类名: inputDeviceCooperate|@ohos.multimodalInput.inputDeviceCooperate.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDeviceCooperate<br>类名: EventMsg|@ohos.multimodalInput.inputDeviceCooperate.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDeviceCooperate<br>类名: EventMsg<br>方法 or 属性: MSG_COOPERATE_INFO_START = 200|@ohos.multimodalInput.inputDeviceCooperate.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDeviceCooperate<br>类名: EventMsg<br>方法 or 属性: MSG_COOPERATE_INFO_SUCCESS = 201|@ohos.multimodalInput.inputDeviceCooperate.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDeviceCooperate<br>类名: EventMsg<br>方法 or 属性: MSG_COOPERATE_INFO_FAIL = 202|@ohos.multimodalInput.inputDeviceCooperate.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDeviceCooperate<br>类名: EventMsg<br>方法 or 属性: MSG_COOPERATE_STATE_ON = 500|@ohos.multimodalInput.inputDeviceCooperate.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDeviceCooperate<br>类名: EventMsg<br>方法 or 属性: MSG_COOPERATE_STATE_OFF = 501|@ohos.multimodalInput.inputDeviceCooperate.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDeviceCooperate<br>类名: inputDeviceCooperate<br>方法 or 属性: function enable(enable: boolean, callback: AsyncCallback\<void>): void;|@ohos.multimodalInput.inputDeviceCooperate.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDeviceCooperate<br>类名: inputDeviceCooperate<br>方法 or 属性: function enable(enable: boolean): Promise\<void>;|@ohos.multimodalInput.inputDeviceCooperate.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDeviceCooperate<br>类名: inputDeviceCooperate<br>方法 or 属性: function start(sinkDeviceDescriptor: string, srcInputDeviceId: number, callback: AsyncCallback\<void>): void;|@ohos.multimodalInput.inputDeviceCooperate.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDeviceCooperate<br>类名: inputDeviceCooperate<br>方法 or 属性: function start(sinkDeviceDescriptor: string, srcInputDeviceId: number): Promise\<void>;|@ohos.multimodalInput.inputDeviceCooperate.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDeviceCooperate<br>类名: inputDeviceCooperate<br>方法 or 属性: function stop(callback: AsyncCallback\<void>): void;|@ohos.multimodalInput.inputDeviceCooperate.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDeviceCooperate<br>类名: inputDeviceCooperate<br>方法 or 属性: function stop(): Promise\<void>;|@ohos.multimodalInput.inputDeviceCooperate.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDeviceCooperate<br>类名: inputDeviceCooperate<br>方法 or 属性: function getState(deviceDescriptor: string, callback: AsyncCallback\<{ state: boolean }>): void;|@ohos.multimodalInput.inputDeviceCooperate.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDeviceCooperate<br>类名: inputDeviceCooperate<br>方法 or 属性: function getState(deviceDescriptor: string): Promise\<{ state: boolean }>;|@ohos.multimodalInput.inputDeviceCooperate.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDeviceCooperate<br>类名: inputDeviceCooperate<br>方法 or 属性: function on(type: 'cooperation', callback: AsyncCallback\<{ deviceDescriptor: string, eventMsg: EventMsg }>): void;|@ohos.multimodalInput.inputDeviceCooperate.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputDeviceCooperate<br>类名: inputDeviceCooperate<br>方法 or 属性: function off(type: 'cooperation', callback?: AsyncCallback\<void>): void;|@ohos.multimodalInput.inputDeviceCooperate.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputEvent<br>类名: InputEvent|@ohos.multimodalInput.inputEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputEvent<br>类名: InputEvent<br>方法 or 属性: id: number;|@ohos.multimodalInput.inputEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputEvent<br>类名: InputEvent<br>方法 or 属性: deviceId: number;|@ohos.multimodalInput.inputEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputEvent<br>类名: InputEvent<br>方法 or 属性: actionTime: number;|@ohos.multimodalInput.inputEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputEvent<br>类名: InputEvent<br>方法 or 属性: screenId: number;|@ohos.multimodalInput.inputEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.inputEvent<br>类名: InputEvent<br>方法 or 属性: windowId: number;|@ohos.multimodalInput.inputEvent.d.ts| +|新增|NA|类名:inputMonitor<br>方法or属性:function on(type:"mouse", receiver:Callback\<MouseEvent>):void;|@ohos.multimodalInput.inputMonitor.d.ts| +|新增|NA|类名:inputMonitor<br>方法or属性:function off(type:"mouse", receiver?:Callback\<MouseEvent>):void;|@ohos.multimodalInput.inputMonitor.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_FN = 0|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_UNKNOWN = -1|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_HOME = 1|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_BACK = 2|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_MEDIA_PLAY_PAUSE = 10|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_MEDIA_STOP = 11|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_MEDIA_NEXT = 12|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_MEDIA_PREVIOUS = 13|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_MEDIA_REWIND = 14|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_MEDIA_FAST_FORWARD = 15|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_VOLUME_UP = 16|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_VOLUME_DOWN = 17|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_POWER = 18|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_CAMERA = 19|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_VOLUME_MUTE = 22|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_MUTE = 23|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_BRIGHTNESS_UP = 40|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_BRIGHTNESS_DOWN = 41|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_0 = 2000|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_1 = 2001|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_2 = 2002|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_3 = 2003|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_4 = 2004|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_5 = 2005|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_6 = 2006|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_7 = 2007|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_8 = 2008|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_9 = 2009|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_STAR = 2010|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_POUND = 2011|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_DPAD_UP = 2012|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_DPAD_DOWN = 2013|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_DPAD_LEFT = 2014|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_DPAD_RIGHT = 2015|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_DPAD_CENTER = 2016|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_A = 2017|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_B = 2018|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_C = 2019|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_D = 2020|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_E = 2021|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_F = 2022|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_G = 2023|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_H = 2024|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_I = 2025|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_J = 2026|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_K = 2027|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_L = 2028|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_M = 2029|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_N = 2030|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_O = 2031|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_P = 2032|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_Q = 2033|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_R = 2034|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_S = 2035|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_T = 2036|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_U = 2037|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_V = 2038|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_W = 2039|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_X = 2040|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_Y = 2041|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_Z = 2042|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_COMMA = 2043|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_PERIOD = 2044|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_ALT_LEFT = 2045|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_ALT_RIGHT = 2046|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_SHIFT_LEFT = 2047|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_SHIFT_RIGHT = 2048|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_TAB = 2049|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_SPACE = 2050|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_SYM = 2051|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_EXPLORER = 2052|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_ENVELOPE = 2053|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_ENTER = 2054|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_DEL = 2055|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_GRAVE = 2056|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_MINUS = 2057|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_EQUALS = 2058|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_LEFT_BRACKET = 2059|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_RIGHT_BRACKET = 2060|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_BACKSLASH = 2061|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_SEMICOLON = 2062|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_APOSTROPHE = 2063|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_SLASH = 2064|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_AT = 2065|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_PLUS = 2066|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_MENU = 2067|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_PAGE_UP = 2068|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_PAGE_DOWN = 2069|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_ESCAPE = 2070|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_FORWARD_DEL = 2071|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_CTRL_LEFT = 2072|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_CTRL_RIGHT = 2073|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_CAPS_LOCK = 2074|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_SCROLL_LOCK = 2075|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_META_LEFT = 2076|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_META_RIGHT = 2077|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_FUNCTION = 2078|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_SYSRQ = 2079|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_BREAK = 2080|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_MOVE_HOME = 2081|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_MOVE_END = 2082|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_INSERT = 2083|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_FORWARD = 2084|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_MEDIA_PLAY = 2085|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_MEDIA_PAUSE = 2086|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_MEDIA_CLOSE = 2087|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_MEDIA_EJECT = 2088|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_MEDIA_RECORD = 2089|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_F1 = 2090|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_F2 = 2091|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_F3 = 2092|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_F4 = 2093|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_F5 = 2094|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_F6 = 2095|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_F7 = 2096|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_F8 = 2097|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_F9 = 2098|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_F10 = 2099|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_F11 = 2100|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_F12 = 2101|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_NUM_LOCK = 2102|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_NUMPAD_0 = 2103|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_NUMPAD_1 = 2104|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_NUMPAD_2 = 2105|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_NUMPAD_3 = 2106|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_NUMPAD_4 = 2107|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_NUMPAD_5 = 2108|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_NUMPAD_6 = 2109|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_NUMPAD_7 = 2110|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_NUMPAD_8 = 2111|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_NUMPAD_9 = 2112|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_NUMPAD_DIVIDE = 2113|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_NUMPAD_MULTIPLY = 2114|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_NUMPAD_SUBTRACT = 2115|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_NUMPAD_ADD = 2116|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_NUMPAD_DOT = 2117|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_NUMPAD_COMMA = 2118|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_NUMPAD_ENTER = 2119|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_NUMPAD_EQUALS = 2120|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_NUMPAD_LEFT_PAREN = 2121|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_NUMPAD_RIGHT_PAREN = 2122|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_VIRTUAL_MULTITASK = 2210|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_SLEEP = 2600|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_ZENKAKU_HANKAKU = 2601|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_102ND = 2602|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_RO = 2603|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_KATAKANA = 2604|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_HIRAGANA = 2605|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_HENKAN = 2606|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_KATAKANA_HIRAGANA = 2607|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_MUHENKAN = 2608|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_LINEFEED = 2609|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_MACRO = 2610|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_NUMPAD_PLUSMINUS = 2611|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_SCALE = 2612|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_HANGUEL = 2613|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_HANJA = 2614|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_YEN = 2615|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_STOP = 2616|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_AGAIN = 2617|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_PROPS = 2618|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_UNDO = 2619|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_COPY = 2620|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_OPEN = 2621|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_PASTE = 2622|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_FIND = 2623|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_CUT = 2624|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_HELP = 2625|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_CALC = 2626|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_FILE = 2627|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_BOOKMARKS = 2628|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_NEXT = 2629|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_PLAYPAUSE = 2630|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_PREVIOUS = 2631|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_STOPCD = 2632|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_CONFIG = 2634|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_REFRESH = 2635|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_EXIT = 2636|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_EDIT = 2637|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_SCROLLUP = 2638|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_SCROLLDOWN = 2639|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_NEW = 2640|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_REDO = 2641|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_CLOSE = 2642|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_PLAY = 2643|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_BASSBOOST = 2644|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_PRINT = 2645|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_CHAT = 2646|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_FINANCE = 2647|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_CANCEL = 2648|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_KBDILLUM_TOGGLE = 2649|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_KBDILLUM_DOWN = 2650|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_KBDILLUM_UP = 2651|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_SEND = 2652|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_REPLY = 2653|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_FORWARDMAIL = 2654|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_SAVE = 2655|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_DOCUMENTS = 2656|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_VIDEO_NEXT = 2657|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_VIDEO_PREV = 2658|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_BRIGHTNESS_CYCLE = 2659|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_BRIGHTNESS_ZERO = 2660|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_DISPLAY_OFF = 2661|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_BTN_MISC = 2662|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_GOTO = 2663|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_INFO = 2664|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_PROGRAM = 2665|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_PVR = 2666|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_SUBTITLE = 2667|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_FULL_SCREEN = 2668|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_KEYBOARD = 2669|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_ASPECT_RATIO = 2670|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_PC = 2671|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_TV = 2672|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_TV2 = 2673|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_VCR = 2674|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_VCR2 = 2675|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_SAT = 2676|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_CD = 2677|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_TAPE = 2678|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_TUNER = 2679|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_PLAYER = 2680|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_DVD = 2681|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_AUDIO = 2682|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_VIDEO = 2683|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_MEMO = 2684|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_CALENDAR = 2685|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_RED = 2686|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_GREEN = 2687|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_YELLOW = 2688|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_BLUE = 2689|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_CHANNELUP = 2690|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_CHANNELDOWN = 2691|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_LAST = 2692|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_RESTART = 2693|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_SLOW = 2694|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_SHUFFLE = 2695|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_VIDEOPHONE = 2696|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_GAMES = 2697|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_ZOOMIN = 2698|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_ZOOMOUT = 2699|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_ZOOMRESET = 2700|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_WORDPROCESSOR = 2701|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_EDITOR = 2702|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_SPREADSHEET = 2703|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_GRAPHICSEDITOR = 2704|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_PRESENTATION = 2705|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_DATABASE = 2706|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_NEWS = 2707|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_VOICEMAIL = 2708|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_ADDRESSBOOK = 2709|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_MESSENGER = 2710|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_BRIGHTNESS_TOGGLE = 2711|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_SPELLCHECK = 2712|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_COFFEE = 2713|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_MEDIA_REPEAT = 2714|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_IMAGES = 2715|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_BUTTONCONFIG = 2716|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_TASKMANAGER = 2717|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_JOURNAL = 2718|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_CONTROLPANEL = 2719|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_APPSELECT = 2720|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_SCREENSAVER = 2721|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_ASSISTANT = 2722|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_KBD_LAYOUT_NEXT = 2723|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_BRIGHTNESS_MIN = 2724|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_BRIGHTNESS_MAX = 2725|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_KBDINPUTASSIST_PREV = 2726|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_KBDINPUTASSIST_NEXT = 2727|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_KBDINPUTASSIST_PREVGROUP = 2728|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_KBDINPUTASSIST_NEXTGROUP = 2729|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_KBDINPUTASSIST_ACCEPT = 2730|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_KBDINPUTASSIST_CANCEL = 2731|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_FRONT = 2800|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_SETUP = 2801|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_WAKEUP = 2802|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_SENDFILE = 2803|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_DELETEFILE = 2804|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_XFER = 2805|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_PROG1 = 2806|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_PROG2 = 2807|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_MSDOS = 2808|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_SCREENLOCK = 2809|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_DIRECTION_ROTATE_DISPLAY = 2810|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_CYCLEWINDOWS = 2811|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_COMPUTER = 2812|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_EJECTCLOSECD = 2813|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_ISO = 2814|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_MOVE = 2815|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_F13 = 2816|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_F14 = 2817|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_F15 = 2818|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_F16 = 2819|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_F17 = 2820|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_F18 = 2821|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_F19 = 2822|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_F20 = 2823|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_F21 = 2824|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_F22 = 2825|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_F23 = 2826|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_F24 = 2827|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_PROG3 = 2828|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_PROG4 = 2829|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_DASHBOARD = 2830|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_SUSPEND = 2831|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_HP = 2832|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_SOUND = 2833|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_QUESTION = 2834|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_CONNECT = 2836|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_SPORT = 2837|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_SHOP = 2838|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_ALTERASE = 2839|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_SWITCHVIDEOMODE = 2841|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_BATTERY = 2842|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_BLUETOOTH = 2843|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_WLAN = 2844|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_UWB = 2845|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_WWAN_WIMAX = 2846|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_RFKILL = 2847|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_CHANNEL = 3001|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_BTN_0 = 3100|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_BTN_1 = 3101|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_BTN_2 = 3102|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_BTN_3 = 3103|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_BTN_4 = 3104|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_BTN_5 = 3105|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_BTN_6 = 3106|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_BTN_7 = 3107|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_BTN_8 = 3108|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyCode<br>类名: KeyCode<br>方法 or 属性: KEYCODE_BTN_9 = 3109|@ohos.multimodalInput.keyCode.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyEvent<br>类名: Action|@ohos.multimodalInput.keyEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyEvent<br>类名: Action<br>方法 or 属性: CANCEL = 0|@ohos.multimodalInput.keyEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyEvent<br>类名: Action<br>方法 or 属性: DOWN = 1|@ohos.multimodalInput.keyEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyEvent<br>类名: Action<br>方法 or 属性: UP = 2|@ohos.multimodalInput.keyEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyEvent<br>类名: Key|@ohos.multimodalInput.keyEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyEvent<br>类名: Key<br>方法 or 属性: code: KeyCode;|@ohos.multimodalInput.keyEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyEvent<br>类名: Key<br>方法 or 属性: pressedTime: number;|@ohos.multimodalInput.keyEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyEvent<br>类名: Key<br>方法 or 属性: deviceId: number;|@ohos.multimodalInput.keyEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyEvent<br>类名: KeyEvent|@ohos.multimodalInput.keyEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyEvent<br>类名: KeyEvent<br>方法 or 属性: action: Action;|@ohos.multimodalInput.keyEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyEvent<br>类名: KeyEvent<br>方法 or 属性: key: Key;|@ohos.multimodalInput.keyEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyEvent<br>类名: KeyEvent<br>方法 or 属性: unicodeChar: number;|@ohos.multimodalInput.keyEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyEvent<br>类名: KeyEvent<br>方法 or 属性: keys: Key[];|@ohos.multimodalInput.keyEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyEvent<br>类名: KeyEvent<br>方法 or 属性: ctrlKey: boolean;|@ohos.multimodalInput.keyEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyEvent<br>类名: KeyEvent<br>方法 or 属性: altKey: boolean;|@ohos.multimodalInput.keyEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyEvent<br>类名: KeyEvent<br>方法 or 属性: shiftKey: boolean;|@ohos.multimodalInput.keyEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyEvent<br>类名: KeyEvent<br>方法 or 属性: logoKey: boolean;|@ohos.multimodalInput.keyEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyEvent<br>类名: KeyEvent<br>方法 or 属性: fnKey: boolean;|@ohos.multimodalInput.keyEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyEvent<br>类名: KeyEvent<br>方法 or 属性: capsLock: boolean;|@ohos.multimodalInput.keyEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyEvent<br>类名: KeyEvent<br>方法 or 属性: numLock: boolean;|@ohos.multimodalInput.keyEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.keyEvent<br>类名: KeyEvent<br>方法 or 属性: scrollLock: boolean;|@ohos.multimodalInput.keyEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: Action|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: Action<br>方法 or 属性: CANCEL = 0|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: Action<br>方法 or 属性: MOVE = 1|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: Action<br>方法 or 属性: BUTTON_DOWN = 2|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: Action<br>方法 or 属性: BUTTON_UP = 3|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: Action<br>方法 or 属性: AXIS_BEGIN = 4|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: Action<br>方法 or 属性: AXIS_UPDATE = 5|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: Action<br>方法 or 属性: AXIS_END = 6|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: Button|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: Button<br>方法 or 属性: LEFT = 0|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: Button<br>方法 or 属性: MIDDLE = 1|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: Button<br>方法 or 属性: RIGHT = 2|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: Button<br>方法 or 属性: SIDE = 3|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: Button<br>方法 or 属性: EXTRA = 4|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: Button<br>方法 or 属性: FORWARD = 5|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: Button<br>方法 or 属性: BACK = 6|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: Button<br>方法 or 属性: TASK = 7|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: Axis|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: Axis<br>方法 or 属性: SCROLL_VERTICAL = 0|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: Axis<br>方法 or 属性: SCROLL_HORIZONTAL = 1|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: Axis<br>方法 or 属性: PINCH = 2|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: AxisValue|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: AxisValue<br>方法 or 属性: axis: Axis;|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: AxisValue<br>方法 or 属性: value: number|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: MouseEvent|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: MouseEvent<br>方法 or 属性: action: Action;|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: MouseEvent<br>方法 or 属性: screenX: number;|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: MouseEvent<br>方法 or 属性: screenY: number;|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: MouseEvent<br>方法 or 属性: windowX: number;|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: MouseEvent<br>方法 or 属性: windowY: number;|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: MouseEvent<br>方法 or 属性: rawDeltaX: number;|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: MouseEvent<br>方法 or 属性: rawDeltaY: number;|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: MouseEvent<br>方法 or 属性: button: Button;|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: MouseEvent<br>方法 or 属性: pressedButtons: Button[];|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: MouseEvent<br>方法 or 属性: axes: AxisValue[];|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: MouseEvent<br>方法 or 属性: pressedKeys: KeyCode[];|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: MouseEvent<br>方法 or 属性: ctrlKey: boolean;|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: MouseEvent<br>方法 or 属性: altKey: boolean;|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: MouseEvent<br>方法 or 属性: shiftKey: boolean;|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: MouseEvent<br>方法 or 属性: logoKey: boolean;|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: MouseEvent<br>方法 or 属性: fnKey:boolean|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: MouseEvent<br>方法 or 属性: capsLock:boolean|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: MouseEvent<br>方法 or 属性: numLock:boolean|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.mouseEvent<br>类名: MouseEvent<br>方法 or 属性: scrollLock:boolean|@ohos.multimodalInput.mouseEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: pointer|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: DEFAULT|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: EAST|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: WEST|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: SOUTH|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: NORTH|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: WEST_EAST|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: NORTH_SOUTH|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: NORTH_EAST|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: NORTH_WEST|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: SOUTH_EAST|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: SOUTH_WEST|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: NORTH_EAST_SOUTH_WEST|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: NORTH_WEST_SOUTH_EAST|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: CROSS|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: CURSOR_COPY|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: CURSOR_FORBID|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: COLOR_SUCKER|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: HAND_GRABBING|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: HAND_OPEN|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: HAND_POINTING|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: HELP|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: MOVE|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: RESIZE_LEFT_RIGHT|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: RESIZE_UP_DOWN|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: SCREENSHOT_CHOOSE|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: SCREENSHOT_CURSOR|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: TEXT_CURSOR|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: ZOOM_IN|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: ZOOM_OUT|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: MIDDLE_BTN_EAST|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: MIDDLE_BTN_WEST|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: MIDDLE_BTN_SOUTH|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: MIDDLE_BTN_NORTH|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: MIDDLE_BTN_NORTH_SOUTH|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: MIDDLE_BTN_NORTH_EAST|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: MIDDLE_BTN_NORTH_WEST|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: MIDDLE_BTN_SOUTH_EAST|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: MIDDLE_BTN_SOUTH_WEST|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: PointerStyle<br>方法 or 属性: MIDDLE_BTN_NORTH_SOUTH_WEST_EAST|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: pointer<br>方法 or 属性: function setPointerSpeed(speed: number, callback: AsyncCallback\<void>): void;|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: pointer<br>方法 or 属性: function setPointerSpeed(speed: number): Promise\<void>;|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: pointer<br>方法 or 属性: function getPointerSpeed(callback: AsyncCallback\<number>): void;|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: pointer<br>方法 or 属性: function getPointerSpeed(): Promise\<number>;|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: pointer<br>方法 or 属性: function setPointerStyle(windowId: number, pointerStyle: PointerStyle, callback: AsyncCallback\<void>): void;|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: pointer<br>方法 or 属性: function setPointerStyle(windowId: number, pointerStyle: PointerStyle): Promise\<void>;|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: pointer<br>方法 or 属性: function getPointerStyle(windowId: number, callback: AsyncCallback\<PointerStyle>): void;|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: pointer<br>方法 or 属性: function getPointerStyle(windowId: number): Promise\<PointerStyle>;|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: pointer<br>方法 or 属性: function setPointerVisible(visible: boolean, callback: AsyncCallback\<void>): void;|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: pointer<br>方法 or 属性: function setPointerVisible(visible: boolean): Promise\<void>;|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: pointer<br>方法 or 属性: function isPointerVisible(callback: AsyncCallback\<boolean>): void;|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.pointer<br>类名: pointer<br>方法 or 属性: function isPointerVisible(): Promise\<boolean>;|@ohos.multimodalInput.pointer.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: Action|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: Action<br>方法 or 属性: CANCEL = 0|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: Action<br>方法 or 属性: DOWN = 1|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: Action<br>方法 or 属性: MOVE = 2|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: Action<br>方法 or 属性: UP = 3|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: ToolType|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: ToolType<br>方法 or 属性: FINGER = 0|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: ToolType<br>方法 or 属性: PEN = 1|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: ToolType<br>方法 or 属性: RUBBER = 2|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: ToolType<br>方法 or 属性: BRUSH = 3|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: ToolType<br>方法 or 属性: PENCIL = 4|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: ToolType<br>方法 or 属性: AIRBRUSH = 5|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: ToolType<br>方法 or 属性: MOUSE = 6|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: ToolType<br>方法 or 属性: LENS = 7|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: SourceType|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: SourceType<br>方法 or 属性: TOUCH_SCREEN = 0|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: SourceType<br>方法 or 属性: PEN = 1|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: SourceType<br>方法 or 属性: TOUCH_PAD = 2|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: Touch|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: Touch<br>方法 or 属性: id: number;|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: Touch<br>方法 or 属性: pressedTime: number;|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: Touch<br>方法 or 属性: screenX: number;|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: Touch<br>方法 or 属性: screenY: number;|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: Touch<br>方法 or 属性: windowX: number;|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: Touch<br>方法 or 属性: windowY: number;|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: Touch<br>方法 or 属性: pressure: number;|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: Touch<br>方法 or 属性: width: number;|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: Touch<br>方法 or 属性: height: number;|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: Touch<br>方法 or 属性: tiltX: number;|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: Touch<br>方法 or 属性: tiltY: number;|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: Touch<br>方法 or 属性: toolX: number;|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: Touch<br>方法 or 属性: toolY: number;|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: Touch<br>方法 or 属性: toolWidth: number;|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: Touch<br>方法 or 属性: toolHeight: number;|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: Touch<br>方法 or 属性: rawX: number;|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: Touch<br>方法 or 属性: rawY: number;|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: Touch<br>方法 or 属性: toolType: ToolType;|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: TouchEvent|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: TouchEvent<br>方法 or 属性: action: Action;|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: TouchEvent<br>方法 or 属性: touch: Touch;|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: TouchEvent<br>方法 or 属性: touches: Touch[];|@ohos.multimodalInput.touchEvent.d.ts| +|新增|NA|模块名: ohos.multimodalInput.touchEvent<br>类名: TouchEvent<br>方法 or 属性: sourceType: SourceType;|@ohos.multimodalInput.touchEvent.d.ts| +|废弃版本有变化|类名:inputDevice<br>方法 or 属性:function getDeviceIds(callback: AsyncCallback\<Array\<number>>): void;<br>废弃版本:N/A|类名:inputDevice<br>方法 or 属性:function getDeviceIds(callback: AsyncCallback\<Array\<number>>): void;<br>废弃版本:9<br>代替接口:ohos.multimodalInput.inputDevice|@ohos.multimodalInput.inputDevice.d.ts| +|废弃版本有变化|类名:inputDevice<br>方法 or 属性:function getDeviceIds(): Promise\<Array\<number>>;<br>废弃版本:N/A|类名:inputDevice<br>方法 or 属性:function getDeviceIds(): Promise\<Array\<number>>;<br>废弃版本:9<br>代替接口:ohos.multimodalInput.inputDevice|@ohos.multimodalInput.inputDevice.d.ts| +|废弃版本有变化|类名:inputDevice<br>方法 or 属性:function getDevice(deviceId: number, callback: AsyncCallback\<InputDeviceData>): void;<br>废弃版本:N/A|类名:inputDevice<br>方法 or 属性:function getDevice(deviceId: number, callback: AsyncCallback\<InputDeviceData>): void;<br>废弃版本:9<br>代替接口:ohos.multimodalInput.inputDevice|@ohos.multimodalInput.inputDevice.d.ts| +|废弃版本有变化|类名:inputDevice<br>方法 or 属性:function getDevice(deviceId: number): Promise\<InputDeviceData>;<br>废弃版本:N/A|类名:inputDevice<br>方法 or 属性:function getDevice(deviceId: number): Promise\<InputDeviceData>;<br>废弃版本:9<br>代替接口:ohos.multimodalInput.inputDevice|@ohos.multimodalInput.inputDevice.d.ts| +|起始版本有变化|类名:SourceType<br>方法 or 属性:type SourceType = 'keyboard' \| 'mouse' \| 'touchpad' \| 'touchscreen' \| 'joystick' \| 'trackball';<br>起始版本:N/A|类名:SourceType<br>方法 or 属性:type SourceType = 'keyboard' \| 'mouse' \| 'touchpad' \| 'touchscreen' \| 'joystick' \| 'trackball';<br>起始版本:9|@ohos.multimodalInput.inputDevice.d.ts| +|起始版本有变化|类名:SourceType<br>方法 or 属性:type SourceType = 'keyboard' \| 'mouse' \| 'touchpad' \| 'touchscreen' \| 'joystick' \| 'trackball';<br>起始版本:N/A|类名:SourceType<br>方法 or 属性:type SourceType = 'keyboard' \| 'mouse' \| 'touchpad' \| 'touchscreen' \| 'joystick' \| 'trackball';<br>起始版本:9|@ohos.multimodalInput.inputDevice.d.ts| +|起始版本有变化|类名:SourceType<br>方法 or 属性:type SourceType = 'keyboard' \| 'mouse' \| 'touchpad' \| 'touchscreen' \| 'joystick' \| 'trackball';<br>起始版本:N/A|类名:SourceType<br>方法 or 属性:type SourceType = 'keyboard' \| 'mouse' \| 'touchpad' \| 'touchscreen' \| 'joystick' \| 'trackball';<br>起始版本:9|@ohos.multimodalInput.inputDevice.d.ts| +|起始版本有变化|类名:SourceType<br>方法 or 属性:type SourceType = 'keyboard' \| 'mouse' \| 'touchpad' \| 'touchscreen' \| 'joystick' \| 'trackball';<br>起始版本:N/A|类名:SourceType<br>方法 or 属性:type SourceType = 'keyboard' \| 'mouse' \| 'touchpad' \| 'touchscreen' \| 'joystick' \| 'trackball';<br>起始版本:9|@ohos.multimodalInput.inputDevice.d.ts| +|起始版本有变化|类名:SourceType<br>方法 or 属性:type SourceType = 'keyboard' \| 'mouse' \| 'touchpad' \| 'touchscreen' \| 'joystick' \| 'trackball';<br>起始版本:N/A|类名:SourceType<br>方法 or 属性:type SourceType = 'keyboard' \| 'mouse' \| 'touchpad' \| 'touchscreen' \| 'joystick' \| 'trackball';<br>起始版本:9|@ohos.multimodalInput.inputDevice.d.ts| +|起始版本有变化|类名:SourceType<br>方法 or 属性:type SourceType = 'keyboard' \| 'mouse' \| 'touchpad' \| 'touchscreen' \| 'joystick' \| 'trackball';<br>起始版本:N/A|类名:SourceType<br>方法 or 属性:type SourceType = 'keyboard' \| 'mouse' \| 'touchpad' \| 'touchscreen' \| 'joystick' \| 'trackball';<br>起始版本:9|@ohos.multimodalInput.inputDevice.d.ts| +|起始版本有变化|类名:AxisRange<br>起始版本:N/A|类名:AxisRange<br>起始版本:8|@ohos.multimodalInput.inputDevice.d.ts| +|起始版本有变化|类名:AxisRange<br>方法 or 属性:source: SourceType;<br>起始版本:N/A|类名:AxisRange<br>方法 or 属性:source: SourceType;<br>起始版本:8|@ohos.multimodalInput.inputDevice.d.ts| +|起始版本有变化|类名:AxisRange<br>方法 or 属性:min: number;<br>起始版本:N/A|类名:AxisRange<br>方法 or 属性:min: number;<br>起始版本:8|@ohos.multimodalInput.inputDevice.d.ts| +|起始版本有变化|类名:InputDeviceData<br>起始版本:N/A|类名:InputDeviceData<br>起始版本:8|@ohos.multimodalInput.inputDevice.d.ts| +|起始版本有变化|类名:InputDeviceData<br>方法 or 属性:id: number;<br>起始版本:N/A|类名:InputDeviceData<br>方法 or 属性:id: number;<br>起始版本:8|@ohos.multimodalInput.inputDevice.d.ts| +|起始版本有变化|类名:InputDeviceData<br>方法 or 属性:name: string;<br>起始版本:N/A|类名:InputDeviceData<br>方法 or 属性:name: string;<br>起始版本:8|@ohos.multimodalInput.inputDevice.d.ts| +|起始版本有变化|类名:KeyEvent<br>起始版本:N/A|类名:KeyEvent<br>起始版本:8|@ohos.multimodalInput.inputEventClient.d.ts| +|新增(错误码)|NA|类名:inputConsumer<br>方法 or 属性:function on(type: "key", keyOptions: KeyOptions, callback: Callback\<KeyOptions>): void;<br>错误码内容: 401|@ohos.multimodalInput.inputConsumer.d.ts| +|新增(错误码)|NA|类名:inputConsumer<br>方法 or 属性:function off(type: "key", keyOptions: KeyOptions, callback?: Callback\<KeyOptions>): void;<br>错误码内容: 401|@ohos.multimodalInput.inputConsumer.d.ts| +|新增(错误码)|NA|类名:inputEventClient<br>方法 or 属性:function injectEvent({KeyEvent: KeyEvent}): void;<br>错误码内容: 401|@ohos.multimodalInput.inputEventClient.d.ts| +|新增(错误码)|NA|类名:inputMonitor<br>方法 or 属性:function on(type:"touch", receiver:TouchEventReceiver):void;<br>错误码内容: 401, 201|@ohos.multimodalInput.inputMonitor.d.ts| +|新增(错误码)|NA|类名:inputMonitor<br>方法 or 属性:function off(type:"touch", receiver?:TouchEventReceiver):void;<br>错误码内容: 401, 201|@ohos.multimodalInput.inputMonitor.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-multimedia.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-multimedia.md new file mode 100644 index 0000000000000000000000000000000000000000..66cd73a47249a4dc47fdf9083babb51306be474d --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-multimedia.md @@ -0,0 +1,1682 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.effectKit<br>类名: effectKit|@ohos.effectKit.d.ts| +|新增|NA|模块名: ohos.effectKit<br>类名: Filter|@ohos.effectKit.d.ts| +|新增|NA|模块名: ohos.effectKit<br>类名: Filter<br>方法 or 属性: blur(radius:number): Filter;|@ohos.effectKit.d.ts| +|新增|NA|模块名: ohos.effectKit<br>类名: Filter<br>方法 or 属性: brightness(bright:number): Filter;|@ohos.effectKit.d.ts| +|新增|NA|模块名: ohos.effectKit<br>类名: Filter<br>方法 or 属性: grayscale(): Filter;|@ohos.effectKit.d.ts| +|新增|NA|模块名: ohos.effectKit<br>类名: Filter<br>方法 or 属性: getPixelMap(): image.PixelMap;|@ohos.effectKit.d.ts| +|新增|NA|模块名: ohos.effectKit<br>类名: ColorPicker|@ohos.effectKit.d.ts| +|新增|NA|模块名: ohos.effectKit<br>类名: ColorPicker<br>方法 or 属性: getMainColor(): Promise\<Color>;|@ohos.effectKit.d.ts| +|新增|NA|模块名: ohos.effectKit<br>类名: ColorPicker<br>方法 or 属性: getMainColorSync(): Color;|@ohos.effectKit.d.ts| +|新增|NA|模块名: ohos.effectKit<br>类名: Color|@ohos.effectKit.d.ts| +|新增|NA|模块名: ohos.effectKit<br>类名: Color<br>方法 or 属性: red: number;|@ohos.effectKit.d.ts| +|新增|NA|模块名: ohos.effectKit<br>类名: Color<br>方法 or 属性: green: number;|@ohos.effectKit.d.ts| +|新增|NA|模块名: ohos.effectKit<br>类名: Color<br>方法 or 属性: blue: number;|@ohos.effectKit.d.ts| +|新增|NA|模块名: ohos.effectKit<br>类名: Color<br>方法 or 属性: alpha: number;|@ohos.effectKit.d.ts| +|新增|NA|模块名: ohos.effectKit<br>类名: effectKit<br>方法 or 属性: function createEffect(source: image.PixelMap): Filter;|@ohos.effectKit.d.ts| +|新增|NA|模块名: ohos.effectKit<br>类名: effectKit<br>方法 or 属性: function createColorPicker(source: image.PixelMap): Promise\<ColorPicker>;|@ohos.effectKit.d.ts| +|新增|NA|模块名: ohos.effectKit<br>类名: effectKit<br>方法 or 属性: function createColorPicker(source: image.PixelMap, callback: AsyncCallback\<ColorPicker>): void;|@ohos.effectKit.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioErrors|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioErrors<br>方法or属性:|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioErrors<br>方法 or 属性:ERROR_INVALID_PARAM = 6800101|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioErrors<br>方法or属性:ERROR_INVALID_PARAM = 6800101|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioErrors<br>方法 or 属性:ERROR_NO_MEMORY = 6800102|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioErrors<br>方法or属性:ERROR_NO_MEMORY = 6800102|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioErrors<br>方法 or 属性:ERROR_ILLEGAL_STATE = 6800103|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioErrors<br>方法or属性:ERROR_ILLEGAL_STATE = 6800103|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioErrors<br>方法 or 属性:ERROR_UNSUPPORTED = 6800104|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioErrors<br>方法or属性:ERROR_UNSUPPORTED = 6800104|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioErrors<br>方法 or 属性:ERROR_TIMEOUT = 6800105|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioErrors<br>方法or属性:ERROR_TIMEOUT = 6800105|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioErrors<br>方法 or 属性:ERROR_STREAM_LIMIT = 6800201|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioErrors<br>方法or属性:ERROR_STREAM_LIMIT = 6800201|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioErrors<br>方法 or 属性:ERROR_SYSTEM = 6800301|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioErrors<br>方法or属性:ERROR_SYSTEM = 6800301|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: audio<br>方法 or 属性:const LOCAL_NETWORK_ID: string;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:audio<br>方法or属性:const LOCAL_NETWORK_ID: string;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: audio<br>方法 or 属性:const DEFAULT_VOLUME_GROUP_ID: number;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:audio<br>方法or属性:const DEFAULT_VOLUME_GROUP_ID: number;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: audio<br>方法 or 属性:const DEFAULT_INTERRUPT_GROUP_ID: number;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:audio<br>方法or属性:const DEFAULT_INTERRUPT_GROUP_ID: number;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: audio<br>方法 or 属性:function createTonePlayer(options: AudioRendererInfo, callback: AsyncCallback\<TonePlayer>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:audio<br>方法or属性:function createTonePlayer(options: AudioRendererInfo, callback: AsyncCallback\<TonePlayer>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: audio<br>方法 or 属性:function createTonePlayer(options: AudioRendererInfo): Promise\<TonePlayer>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:audio<br>方法or属性:function createTonePlayer(options: AudioRendererInfo): Promise\<TonePlayer>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioState<br>方法or属性:STATE_NEW = 0|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioState<br>方法or属性:STATE_PREPARED = 1|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioState<br>方法or属性:STATE_RUNNING = 2|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioState<br>方法or属性:STATE_STOPPED = 3|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioState<br>方法or属性:STATE_RELEASED = 4|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioState<br>方法or属性:STATE_PAUSED = 5|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioVolumeType<br>方法 or 属性:ALL = 100|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioVolumeType<br>方法or属性:ALL = 100|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: DeviceFlag<br>方法 or 属性:NONE_DEVICES_FLAG = 0|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:DeviceFlag<br>方法or属性:NONE_DEVICES_FLAG = 0|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: DeviceFlag<br>方法 or 属性:DISTRIBUTED_OUTPUT_DEVICES_FLAG = 4|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:DeviceFlag<br>方法or属性:DISTRIBUTED_OUTPUT_DEVICES_FLAG = 4|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: DeviceFlag<br>方法 or 属性:DISTRIBUTED_INPUT_DEVICES_FLAG = 8|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:DeviceFlag<br>方法or属性:DISTRIBUTED_INPUT_DEVICES_FLAG = 8|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: DeviceFlag<br>方法 or 属性:ALL_DISTRIBUTED_DEVICES_FLAG = 12|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:DeviceFlag<br>方法or属性:ALL_DISTRIBUTED_DEVICES_FLAG = 12|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: DeviceType<br>方法 or 属性:DEFAULT = 1000|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:DeviceType<br>方法or属性:DEFAULT = 1000|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: CommunicationDeviceType|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:CommunicationDeviceType<br>方法or属性:|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: CommunicationDeviceType<br>方法 or 属性:SPEAKER = 2|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:CommunicationDeviceType<br>方法or属性:SPEAKER = 2|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioSampleFormat<br>方法 or 属性:SAMPLE_FORMAT_F32LE = 4|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioSampleFormat<br>方法or属性:SAMPLE_FORMAT_F32LE = 4|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: StreamUsage<br>方法 or 属性:STREAM_USAGE_VOICE_ASSISTANT = 3|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:StreamUsage<br>方法or属性:STREAM_USAGE_VOICE_ASSISTANT = 3|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: InterruptRequestType|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:InterruptRequestType<br>方法or属性:|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: InterruptRequestType<br>方法 or 属性:INTERRUPT_REQUEST_TYPE_DEFAULT = 0|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:InterruptRequestType<br>方法or属性:INTERRUPT_REQUEST_TYPE_DEFAULT = 0|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioRendererFilter|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRendererFilter<br>方法or属性:|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioRendererFilter<br>方法 or 属性:uid: number;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRendererFilter<br>方法or属性:uid: number;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioRendererFilter<br>方法 or 属性:rendererInfo?: AudioRendererInfo;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRendererFilter<br>方法or属性:rendererInfo?: AudioRendererInfo;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioRendererFilter<br>方法 or 属性:rendererId?: number;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRendererFilter<br>方法or属性:rendererId?: number;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: InterruptMode|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:InterruptMode<br>方法or属性:|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: InterruptMode<br>方法 or 属性:SHARE_MODE = 0|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:InterruptMode<br>方法or属性:SHARE_MODE = 0|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: InterruptMode<br>方法 or 属性:INDEPENDENT_MODE = 1|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:InterruptMode<br>方法or属性:INDEPENDENT_MODE = 1|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: InterruptForceType|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:InterruptForceType<br>方法or属性:|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: InterruptForceType<br>方法 or 属性:INTERRUPT_FORCE = 0|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:InterruptForceType<br>方法or属性:INTERRUPT_FORCE = 0|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: InterruptForceType<br>方法 or 属性:INTERRUPT_SHARE = 1|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:InterruptForceType<br>方法or属性:INTERRUPT_SHARE = 1|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: InterruptEvent|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:InterruptEvent<br>方法or属性:|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: InterruptEvent<br>方法 or 属性:eventType: InterruptType;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:InterruptEvent<br>方法or属性:eventType: InterruptType;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: InterruptEvent<br>方法 or 属性:forceType: InterruptForceType;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:InterruptEvent<br>方法or属性:forceType: InterruptForceType;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: InterruptEvent<br>方法 or 属性:hintType: InterruptHint;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:InterruptEvent<br>方法or属性:hintType: InterruptHint;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioScene<br>方法or属性:AUDIO_SCENE_RINGING = 1|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioScene<br>方法or属性:AUDIO_SCENE_PHONE_CALL = 2|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioScene<br>方法or属性:AUDIO_SCENE_VOICE_CHAT = 3|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioManager<br>方法or属性:getVolumeManager(): AudioVolumeManager;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioManager<br>方法or属性:getStreamManager(): AudioStreamManager;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioManager<br>方法or属性:getRoutingManager(): AudioRoutingManager;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: InterruptRequestResultType|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:InterruptRequestResultType<br>方法or属性:|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: InterruptRequestResultType<br>方法 or 属性:INTERRUPT_REQUEST_GRANT = 0|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:InterruptRequestResultType<br>方法or属性:INTERRUPT_REQUEST_GRANT = 0|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: InterruptRequestResultType<br>方法 or 属性:INTERRUPT_REQUEST_REJECT = 1|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:InterruptRequestResultType<br>方法or属性:INTERRUPT_REQUEST_REJECT = 1|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: InterruptResult|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:InterruptResult<br>方法or属性:|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: InterruptResult<br>方法 or 属性:requestResult: InterruptRequestResultType;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:InterruptResult<br>方法or属性:requestResult: InterruptRequestResultType;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: InterruptResult<br>方法 or 属性:interruptNode: number;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:InterruptResult<br>方法or属性:interruptNode: number;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioRoutingManager|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRoutingManager<br>方法or属性:|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioRoutingManager<br>方法 or 属性:getDevices(deviceFlag: DeviceFlag, callback: AsyncCallback\<AudioDeviceDescriptors>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRoutingManager<br>方法or属性:getDevices(deviceFlag: DeviceFlag, callback: AsyncCallback\<AudioDeviceDescriptors>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioRoutingManager<br>方法 or 属性:getDevices(deviceFlag: DeviceFlag): Promise\<AudioDeviceDescriptors>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRoutingManager<br>方法or属性:getDevices(deviceFlag: DeviceFlag): Promise\<AudioDeviceDescriptors>;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioRoutingManager<br>方法 or 属性:on(type: 'deviceChange', deviceFlag: DeviceFlag, callback: Callback\<DeviceChangeAction>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRoutingManager<br>方法or属性:on(type: 'deviceChange', deviceFlag: DeviceFlag, callback: Callback\<DeviceChangeAction>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioRoutingManager<br>方法 or 属性:off(type: 'deviceChange', callback?: Callback\<DeviceChangeAction>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRoutingManager<br>方法or属性:off(type: 'deviceChange', callback?: Callback\<DeviceChangeAction>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioRoutingManager<br>方法 or 属性:setCommunicationDevice(deviceType: CommunicationDeviceType, active: boolean, callback: AsyncCallback\<void>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRoutingManager<br>方法or属性:setCommunicationDevice(deviceType: CommunicationDeviceType, active: boolean, callback: AsyncCallback\<void>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioRoutingManager<br>方法 or 属性:setCommunicationDevice(deviceType: CommunicationDeviceType, active: boolean): Promise\<void>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRoutingManager<br>方法or属性:setCommunicationDevice(deviceType: CommunicationDeviceType, active: boolean): Promise\<void>;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioRoutingManager<br>方法 or 属性:isCommunicationDeviceActive(deviceType: CommunicationDeviceType, callback: AsyncCallback\<boolean>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRoutingManager<br>方法or属性:isCommunicationDeviceActive(deviceType: CommunicationDeviceType, callback: AsyncCallback\<boolean>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioRoutingManager<br>方法 or 属性:isCommunicationDeviceActive(deviceType: CommunicationDeviceType): Promise\<boolean>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRoutingManager<br>方法or属性:isCommunicationDeviceActive(deviceType: CommunicationDeviceType): Promise\<boolean>;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioRoutingManager<br>方法 or 属性:selectOutputDevice(outputAudioDevices: AudioDeviceDescriptors, callback: AsyncCallback\<void>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRoutingManager<br>方法or属性:selectOutputDevice(outputAudioDevices: AudioDeviceDescriptors, callback: AsyncCallback\<void>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioRoutingManager<br>方法 or 属性:selectOutputDevice(outputAudioDevices: AudioDeviceDescriptors): Promise\<void>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRoutingManager<br>方法or属性:selectOutputDevice(outputAudioDevices: AudioDeviceDescriptors): Promise\<void>;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioRoutingManager<br>方法 or 属性:selectOutputDeviceByFilter(filter: AudioRendererFilter, outputAudioDevices: AudioDeviceDescriptors, callback: AsyncCallback\<void>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRoutingManager<br>方法or属性:selectOutputDeviceByFilter(filter: AudioRendererFilter, outputAudioDevices: AudioDeviceDescriptors, callback: AsyncCallback\<void>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioRoutingManager<br>方法 or 属性:selectOutputDeviceByFilter(filter: AudioRendererFilter, outputAudioDevices: AudioDeviceDescriptors): Promise\<void>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRoutingManager<br>方法or属性:selectOutputDeviceByFilter(filter: AudioRendererFilter, outputAudioDevices: AudioDeviceDescriptors): Promise\<void>;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioRoutingManager<br>方法 or 属性:selectInputDevice(inputAudioDevices: AudioDeviceDescriptors, callback: AsyncCallback\<void>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRoutingManager<br>方法or属性:selectInputDevice(inputAudioDevices: AudioDeviceDescriptors, callback: AsyncCallback\<void>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioRoutingManager<br>方法 or 属性:selectInputDevice(inputAudioDevices: AudioDeviceDescriptors): Promise\<void>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRoutingManager<br>方法or属性:selectInputDevice(inputAudioDevices: AudioDeviceDescriptors): Promise\<void>;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioStreamManager|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioStreamManager<br>方法or属性:|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioStreamManager<br>方法 or 属性:getCurrentAudioRendererInfoArray(callback: AsyncCallback\<AudioRendererChangeInfoArray>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioStreamManager<br>方法or属性:getCurrentAudioRendererInfoArray(callback: AsyncCallback\<AudioRendererChangeInfoArray>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioStreamManager<br>方法 or 属性:getCurrentAudioRendererInfoArray(): Promise\<AudioRendererChangeInfoArray>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioStreamManager<br>方法or属性:getCurrentAudioRendererInfoArray(): Promise\<AudioRendererChangeInfoArray>;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioStreamManager<br>方法 or 属性:getCurrentAudioCapturerInfoArray(callback: AsyncCallback\<AudioCapturerChangeInfoArray>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioStreamManager<br>方法or属性:getCurrentAudioCapturerInfoArray(callback: AsyncCallback\<AudioCapturerChangeInfoArray>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioStreamManager<br>方法 or 属性:getCurrentAudioCapturerInfoArray(): Promise\<AudioCapturerChangeInfoArray>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioStreamManager<br>方法or属性:getCurrentAudioCapturerInfoArray(): Promise\<AudioCapturerChangeInfoArray>;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioStreamManager<br>方法 or 属性:on(type: "audioRendererChange", callback: Callback\<AudioRendererChangeInfoArray>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioStreamManager<br>方法or属性:on(type: "audioRendererChange", callback: Callback\<AudioRendererChangeInfoArray>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioStreamManager<br>方法 or 属性:off(type: "audioRendererChange"): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioStreamManager<br>方法or属性:off(type: "audioRendererChange"): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioStreamManager<br>方法 or 属性:on(type: "audioCapturerChange", callback: Callback\<AudioCapturerChangeInfoArray>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioStreamManager<br>方法or属性:on(type: "audioCapturerChange", callback: Callback\<AudioCapturerChangeInfoArray>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioStreamManager<br>方法 or 属性:off(type: "audioCapturerChange"): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioStreamManager<br>方法or属性:off(type: "audioCapturerChange"): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioStreamManager<br>方法 or 属性:isActive(volumeType: AudioVolumeType, callback: AsyncCallback\<boolean>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioStreamManager<br>方法or属性:isActive(volumeType: AudioVolumeType, callback: AsyncCallback\<boolean>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioStreamManager<br>方法 or 属性:isActive(volumeType: AudioVolumeType): Promise\<boolean>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioStreamManager<br>方法or属性:isActive(volumeType: AudioVolumeType): Promise\<boolean>;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioVolumeManager|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioVolumeManager<br>方法or属性:|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioVolumeManager<br>方法 or 属性:getVolumeGroupInfos(networkId: string, callback: AsyncCallback\<VolumeGroupInfos>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioVolumeManager<br>方法or属性:getVolumeGroupInfos(networkId: string, callback: AsyncCallback\<VolumeGroupInfos>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioVolumeManager<br>方法 or 属性:getVolumeGroupInfos(networkId: string): Promise\<VolumeGroupInfos>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioVolumeManager<br>方法or属性:getVolumeGroupInfos(networkId: string): Promise\<VolumeGroupInfos>;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioVolumeManager<br>方法 or 属性:getVolumeGroupManager(groupId: number, callback: AsyncCallback\<AudioVolumeGroupManager>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioVolumeManager<br>方法or属性:getVolumeGroupManager(groupId: number, callback: AsyncCallback\<AudioVolumeGroupManager>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioVolumeManager<br>方法 or 属性:getVolumeGroupManager(groupId: number): Promise\<AudioVolumeGroupManager>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioVolumeManager<br>方法or属性:getVolumeGroupManager(groupId: number): Promise\<AudioVolumeGroupManager>;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioVolumeManager<br>方法 or 属性:on(type: 'volumeChange', callback: Callback\<VolumeEvent>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioVolumeManager<br>方法or属性:on(type: 'volumeChange', callback: Callback\<VolumeEvent>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioVolumeGroupManager|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioVolumeGroupManager<br>方法or属性:|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioVolumeGroupManager<br>方法 or 属性:setVolume(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback\<void>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioVolumeGroupManager<br>方法or属性:setVolume(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback\<void>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioVolumeGroupManager<br>方法 or 属性:setVolume(volumeType: AudioVolumeType, volume: number): Promise\<void>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioVolumeGroupManager<br>方法or属性:setVolume(volumeType: AudioVolumeType, volume: number): Promise\<void>;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioVolumeGroupManager<br>方法 or 属性:getVolume(volumeType: AudioVolumeType, callback: AsyncCallback\<number>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioVolumeGroupManager<br>方法or属性:getVolume(volumeType: AudioVolumeType, callback: AsyncCallback\<number>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioVolumeGroupManager<br>方法 or 属性:getVolume(volumeType: AudioVolumeType): Promise\<number>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioVolumeGroupManager<br>方法or属性:getVolume(volumeType: AudioVolumeType): Promise\<number>;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioVolumeGroupManager<br>方法 or 属性:getMinVolume(volumeType: AudioVolumeType, callback: AsyncCallback\<number>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioVolumeGroupManager<br>方法or属性:getMinVolume(volumeType: AudioVolumeType, callback: AsyncCallback\<number>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioVolumeGroupManager<br>方法 or 属性:getMinVolume(volumeType: AudioVolumeType): Promise\<number>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioVolumeGroupManager<br>方法or属性:getMinVolume(volumeType: AudioVolumeType): Promise\<number>;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioVolumeGroupManager<br>方法 or 属性:getMaxVolume(volumeType: AudioVolumeType, callback: AsyncCallback\<number>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioVolumeGroupManager<br>方法or属性:getMaxVolume(volumeType: AudioVolumeType, callback: AsyncCallback\<number>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioVolumeGroupManager<br>方法 or 属性:getMaxVolume(volumeType: AudioVolumeType): Promise\<number>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioVolumeGroupManager<br>方法or属性:getMaxVolume(volumeType: AudioVolumeType): Promise\<number>;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioVolumeGroupManager<br>方法 or 属性:mute(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback\<void>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioVolumeGroupManager<br>方法or属性:mute(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback\<void>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioVolumeGroupManager<br>方法 or 属性:mute(volumeType: AudioVolumeType, mute: boolean): Promise\<void>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioVolumeGroupManager<br>方法or属性:mute(volumeType: AudioVolumeType, mute: boolean): Promise\<void>;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioVolumeGroupManager<br>方法 or 属性:isMute(volumeType: AudioVolumeType, callback: AsyncCallback\<boolean>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioVolumeGroupManager<br>方法or属性:isMute(volumeType: AudioVolumeType, callback: AsyncCallback\<boolean>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioVolumeGroupManager<br>方法 or 属性:isMute(volumeType: AudioVolumeType): Promise\<boolean>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioVolumeGroupManager<br>方法or属性:isMute(volumeType: AudioVolumeType): Promise\<boolean>;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioVolumeGroupManager<br>方法 or 属性:setRingerMode(mode: AudioRingMode, callback: AsyncCallback\<void>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioVolumeGroupManager<br>方法or属性:setRingerMode(mode: AudioRingMode, callback: AsyncCallback\<void>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioVolumeGroupManager<br>方法 or 属性:setRingerMode(mode: AudioRingMode): Promise\<void>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioVolumeGroupManager<br>方法or属性:setRingerMode(mode: AudioRingMode): Promise\<void>;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioVolumeGroupManager<br>方法 or 属性:getRingerMode(callback: AsyncCallback\<AudioRingMode>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioVolumeGroupManager<br>方法or属性:getRingerMode(callback: AsyncCallback\<AudioRingMode>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioVolumeGroupManager<br>方法 or 属性:getRingerMode(): Promise\<AudioRingMode>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioVolumeGroupManager<br>方法or属性:getRingerMode(): Promise\<AudioRingMode>;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioVolumeGroupManager<br>方法 or 属性:on(type: 'ringerModeChange', callback: Callback\<AudioRingMode>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioVolumeGroupManager<br>方法or属性:on(type: 'ringerModeChange', callback: Callback\<AudioRingMode>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioVolumeGroupManager<br>方法 or 属性:setMicrophoneMute(mute: boolean, callback: AsyncCallback\<void>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioVolumeGroupManager<br>方法or属性:setMicrophoneMute(mute: boolean, callback: AsyncCallback\<void>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioVolumeGroupManager<br>方法 or 属性:setMicrophoneMute(mute: boolean): Promise\<void>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioVolumeGroupManager<br>方法or属性:setMicrophoneMute(mute: boolean): Promise\<void>;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioVolumeGroupManager<br>方法 or 属性:isMicrophoneMute(callback: AsyncCallback\<boolean>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioVolumeGroupManager<br>方法or属性:isMicrophoneMute(callback: AsyncCallback\<boolean>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioVolumeGroupManager<br>方法 or 属性:isMicrophoneMute(): Promise\<boolean>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioVolumeGroupManager<br>方法or属性:isMicrophoneMute(): Promise\<boolean>;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioVolumeGroupManager<br>方法 or 属性:on(type: 'micStateChange', callback: Callback\<MicStateChangeEvent>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioVolumeGroupManager<br>方法or属性:on(type: 'micStateChange', callback: Callback\<MicStateChangeEvent>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ConnectType|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ConnectType<br>方法or属性:|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ConnectType<br>方法 or 属性:CONNECT_TYPE_LOCAL = 1|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ConnectType<br>方法or属性:CONNECT_TYPE_LOCAL = 1|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ConnectType<br>方法 or 属性:CONNECT_TYPE_DISTRIBUTED = 2|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ConnectType<br>方法or属性:CONNECT_TYPE_DISTRIBUTED = 2|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: VolumeGroupInfo|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:VolumeGroupInfo<br>方法or属性:|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: VolumeGroupInfo<br>方法 or 属性:readonly networkId: string;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:VolumeGroupInfo<br>方法or属性:readonly networkId: string;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: VolumeGroupInfo<br>方法 or 属性:readonly groupId: number;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:VolumeGroupInfo<br>方法or属性:readonly groupId: number;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: VolumeGroupInfo<br>方法 or 属性:readonly mappingId: number;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:VolumeGroupInfo<br>方法or属性:readonly mappingId: number;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: VolumeGroupInfo<br>方法 or 属性:readonly groupName: string;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:VolumeGroupInfo<br>方法or属性:readonly groupName: string;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: VolumeGroupInfo<br>方法 or 属性:readonly type: ConnectType;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:VolumeGroupInfo<br>方法or属性:readonly type: ConnectType;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioRendererChangeInfo|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRendererChangeInfo<br>方法or属性:|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioRendererChangeInfo<br>方法 or 属性:readonly streamId: number;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRendererChangeInfo<br>方法or属性:readonly streamId: number;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioRendererChangeInfo<br>方法 or 属性:readonly clientUid: number;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRendererChangeInfo<br>方法or属性:readonly clientUid: number;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioRendererChangeInfo<br>方法 or 属性:readonly rendererInfo: AudioRendererInfo;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRendererChangeInfo<br>方法or属性:readonly rendererInfo: AudioRendererInfo;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioRendererChangeInfo<br>方法 or 属性:readonly rendererState: AudioState;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRendererChangeInfo<br>方法or属性:readonly rendererState: AudioState;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioRendererChangeInfo<br>方法 or 属性:readonly deviceDescriptors: AudioDeviceDescriptors;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRendererChangeInfo<br>方法or属性:readonly deviceDescriptors: AudioDeviceDescriptors;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioCapturerChangeInfo|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioCapturerChangeInfo<br>方法or属性:|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioCapturerChangeInfo<br>方法 or 属性:readonly streamId: number;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioCapturerChangeInfo<br>方法or属性:readonly streamId: number;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioCapturerChangeInfo<br>方法 or 属性:readonly clientUid: number;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioCapturerChangeInfo<br>方法or属性:readonly clientUid: number;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioCapturerChangeInfo<br>方法 or 属性:readonly capturerInfo: AudioCapturerInfo;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioCapturerChangeInfo<br>方法or属性:readonly capturerInfo: AudioCapturerInfo;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioCapturerChangeInfo<br>方法 or 属性:readonly capturerState: AudioState;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioCapturerChangeInfo<br>方法or属性:readonly capturerState: AudioState;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioCapturerChangeInfo<br>方法 or 属性:readonly deviceDescriptors: AudioDeviceDescriptors;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioCapturerChangeInfo<br>方法or属性:readonly deviceDescriptors: AudioDeviceDescriptors;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioDeviceDescriptor<br>方法 or 属性:readonly id: number;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioDeviceDescriptor<br>方法or属性:readonly id: number;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioDeviceDescriptor<br>方法 or 属性:readonly name: string;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioDeviceDescriptor<br>方法or属性:readonly name: string;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioDeviceDescriptor<br>方法 or 属性:readonly address: string;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioDeviceDescriptor<br>方法or属性:readonly address: string;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioDeviceDescriptor<br>方法 or 属性:readonly sampleRates: Array\<number>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioDeviceDescriptor<br>方法or属性:readonly sampleRates: Array\<number>;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioDeviceDescriptor<br>方法 or 属性:readonly channelCounts: Array\<number>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioDeviceDescriptor<br>方法or属性:readonly channelCounts: Array\<number>;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioDeviceDescriptor<br>方法 or 属性:readonly channelMasks: Array\<number>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioDeviceDescriptor<br>方法or属性:readonly channelMasks: Array\<number>;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioDeviceDescriptor<br>方法 or 属性:readonly networkId: string;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioDeviceDescriptor<br>方法or属性:readonly networkId: string;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioDeviceDescriptor<br>方法 or 属性:readonly interruptGroupId: number;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioDeviceDescriptor<br>方法or属性:readonly interruptGroupId: number;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: AudioDeviceDescriptor<br>方法 or 属性:readonly volumeGroupId: number;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioDeviceDescriptor<br>方法or属性:readonly volumeGroupId: number;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:VolumeEvent<br>方法or属性:volumeGroupId: number;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:VolumeEvent<br>方法or属性:networkId: string;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: MicStateChangeEvent|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:MicStateChangeEvent<br>方法or属性:|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: MicStateChangeEvent<br>方法 or 属性:mute: boolean;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:MicStateChangeEvent<br>方法or属性:mute: boolean;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRenderer<br>方法or属性:getAudioStreamId(callback: AsyncCallback\<number>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRenderer<br>方法or属性:getAudioStreamId(): Promise\<number>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRenderer<br>方法or属性:setInterruptMode(mode: InterruptMode, callback: AsyncCallback\<void>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRenderer<br>方法or属性:setInterruptMode(mode: InterruptMode): Promise\<void>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRenderer<br>方法or属性:setVolume(volume: number, callback: AsyncCallback\<void>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRenderer<br>方法or属性:setVolume(volume: number): Promise\<void>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioRenderer<br>方法or属性:on(type: 'audioInterrupt', callback: Callback\<InterruptEvent>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: SourceType<br>方法 or 属性:SOURCE_TYPE_VOICE_RECOGNITION = 1|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:SourceType<br>方法or属性:SOURCE_TYPE_VOICE_RECOGNITION = 1|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioCapturer<br>方法or属性:getAudioStreamId(callback: AsyncCallback\<number>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:AudioCapturer<br>方法or属性:getAudioStreamId(): Promise\<number>;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ToneType|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ToneType<br>方法or属性:|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ToneType<br>方法 or 属性:TONE_TYPE_DIAL_0 = 0|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ToneType<br>方法or属性:TONE_TYPE_DIAL_0 = 0|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ToneType<br>方法 or 属性:TONE_TYPE_DIAL_1 = 1|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ToneType<br>方法or属性:TONE_TYPE_DIAL_1 = 1|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ToneType<br>方法 or 属性:TONE_TYPE_DIAL_2 = 2|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ToneType<br>方法or属性:TONE_TYPE_DIAL_2 = 2|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ToneType<br>方法 or 属性:TONE_TYPE_DIAL_3 = 3|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ToneType<br>方法or属性:TONE_TYPE_DIAL_3 = 3|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ToneType<br>方法 or 属性:TONE_TYPE_DIAL_4 = 4|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ToneType<br>方法or属性:TONE_TYPE_DIAL_4 = 4|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ToneType<br>方法 or 属性:TONE_TYPE_DIAL_5 = 5|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ToneType<br>方法or属性:TONE_TYPE_DIAL_5 = 5|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ToneType<br>方法 or 属性:TONE_TYPE_DIAL_6 = 6|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ToneType<br>方法or属性:TONE_TYPE_DIAL_6 = 6|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ToneType<br>方法 or 属性:TONE_TYPE_DIAL_7 = 7|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ToneType<br>方法or属性:TONE_TYPE_DIAL_7 = 7|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ToneType<br>方法 or 属性:TONE_TYPE_DIAL_8 = 8|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ToneType<br>方法or属性:TONE_TYPE_DIAL_8 = 8|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ToneType<br>方法 or 属性:TONE_TYPE_DIAL_9 = 9|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ToneType<br>方法or属性:TONE_TYPE_DIAL_9 = 9|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ToneType<br>方法 or 属性:TONE_TYPE_DIAL_S = 10|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ToneType<br>方法or属性:TONE_TYPE_DIAL_S = 10|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ToneType<br>方法 or 属性:TONE_TYPE_DIAL_P = 11|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ToneType<br>方法or属性:TONE_TYPE_DIAL_P = 11|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ToneType<br>方法 or 属性:TONE_TYPE_DIAL_A = 12|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ToneType<br>方法or属性:TONE_TYPE_DIAL_A = 12|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ToneType<br>方法 or 属性:TONE_TYPE_DIAL_B = 13|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ToneType<br>方法or属性:TONE_TYPE_DIAL_B = 13|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ToneType<br>方法 or 属性:TONE_TYPE_DIAL_C = 14|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ToneType<br>方法or属性:TONE_TYPE_DIAL_C = 14|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ToneType<br>方法 or 属性:TONE_TYPE_DIAL_D = 15|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ToneType<br>方法or属性:TONE_TYPE_DIAL_D = 15|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ToneType<br>方法 or 属性:TONE_TYPE_COMMON_SUPERVISORY_DIAL = 100|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ToneType<br>方法or属性:TONE_TYPE_COMMON_SUPERVISORY_DIAL = 100|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ToneType<br>方法 or 属性:TONE_TYPE_COMMON_SUPERVISORY_BUSY = 101|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ToneType<br>方法or属性:TONE_TYPE_COMMON_SUPERVISORY_BUSY = 101|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ToneType<br>方法 or 属性:TONE_TYPE_COMMON_SUPERVISORY_CONGESTION = 102|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ToneType<br>方法or属性:TONE_TYPE_COMMON_SUPERVISORY_CONGESTION = 102|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ToneType<br>方法 or 属性:TONE_TYPE_COMMON_SUPERVISORY_RADIO_ACK = 103|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ToneType<br>方法or属性:TONE_TYPE_COMMON_SUPERVISORY_RADIO_ACK = 103|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ToneType<br>方法 or 属性:TONE_TYPE_COMMON_SUPERVISORY_RADIO_NOT_AVAILABLE = 104|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ToneType<br>方法or属性:TONE_TYPE_COMMON_SUPERVISORY_RADIO_NOT_AVAILABLE = 104|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ToneType<br>方法 or 属性:TONE_TYPE_COMMON_SUPERVISORY_CALL_WAITING = 106|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ToneType<br>方法or属性:TONE_TYPE_COMMON_SUPERVISORY_CALL_WAITING = 106|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ToneType<br>方法 or 属性:TONE_TYPE_COMMON_SUPERVISORY_RINGTONE = 107|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ToneType<br>方法or属性:TONE_TYPE_COMMON_SUPERVISORY_RINGTONE = 107|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ToneType<br>方法 or 属性:TONE_TYPE_COMMON_PROPRIETARY_BEEP = 200|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ToneType<br>方法or属性:TONE_TYPE_COMMON_PROPRIETARY_BEEP = 200|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ToneType<br>方法 or 属性:TONE_TYPE_COMMON_PROPRIETARY_ACK = 201|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ToneType<br>方法or属性:TONE_TYPE_COMMON_PROPRIETARY_ACK = 201|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ToneType<br>方法 or 属性:TONE_TYPE_COMMON_PROPRIETARY_PROMPT = 203|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ToneType<br>方法or属性:TONE_TYPE_COMMON_PROPRIETARY_PROMPT = 203|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: ToneType<br>方法 or 属性:TONE_TYPE_COMMON_PROPRIETARY_DOUBLE_BEEP = 204|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:ToneType<br>方法or属性:TONE_TYPE_COMMON_PROPRIETARY_DOUBLE_BEEP = 204|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: TonePlayer|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:TonePlayer<br>方法or属性:|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: TonePlayer<br>方法 or 属性:load(type: ToneType, callback: AsyncCallback\<void>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:TonePlayer<br>方法or属性:load(type: ToneType, callback: AsyncCallback\<void>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: TonePlayer<br>方法 or 属性:load(type: ToneType): Promise\<void>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:TonePlayer<br>方法or属性:load(type: ToneType): Promise\<void>;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: TonePlayer<br>方法 or 属性:start(callback: AsyncCallback\<void>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:TonePlayer<br>方法or属性:start(callback: AsyncCallback\<void>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: TonePlayer<br>方法 or 属性:start(): Promise\<void>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:TonePlayer<br>方法or属性:start(): Promise\<void>;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: TonePlayer<br>方法 or 属性:stop(callback: AsyncCallback\<void>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:TonePlayer<br>方法or属性:stop(callback: AsyncCallback\<void>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: TonePlayer<br>方法 or 属性:stop(): Promise\<void>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:TonePlayer<br>方法or属性:stop(): Promise\<void>;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: TonePlayer<br>方法 or 属性:release(callback: AsyncCallback\<void>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:TonePlayer<br>方法or属性:release(callback: AsyncCallback\<void>): void;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.audio<br>类名: TonePlayer<br>方法 or 属性:release(): Promise\<void>;|@ohos.multimedia.audio.d.ts| +|新增|NA|类名:TonePlayer<br>方法or属性:release(): Promise\<void>;|@ohos.multimedia.audio.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: avSession|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionType<br>方法 or 属性: type AVSessionType = 'audio' \| 'video';|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionType<br>方法 or 属性: type AVSessionType = 'audio' \| 'video';|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVControlCommandType<br>方法 or 属性: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|<br> 'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVControlCommandType<br>方法 or 属性: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|<br> 'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVControlCommandType<br>方法 or 属性: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|<br> 'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVControlCommandType<br>方法 or 属性: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|<br> 'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVControlCommandType<br>方法 or 属性: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|<br> 'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVControlCommandType<br>方法 or 属性: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|<br> 'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVControlCommandType<br>方法 or 属性: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|<br> 'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVControlCommandType<br>方法 or 属性: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|<br> 'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVControlCommandType<br>方法 or 属性: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|<br> 'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVControlCommandType<br>方法 or 属性: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|<br> 'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVControlCommandType<br>方法 or 属性: type AVControlCommandType = 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind' \|<br> 'seek' \| 'setSpeed' \| 'setLoopMode' \| 'toggleFavorite';|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: avSession<br>方法 or 属性: function createAVSession(context: Context, tag: string, type: AVSessionType, callback: AsyncCallback\<AVSession>): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: avSession<br>方法 or 属性: function createAVSession(context: Context, tag: string, type: AVSessionType): Promise\<AVSession>;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: avSession<br>方法 or 属性: function getAllSessionDescriptors(callback: AsyncCallback\<Array\<Readonly\<AVSessionDescriptor>>>): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: avSession<br>方法 or 属性: function getAllSessionDescriptors(): Promise\<Array\<Readonly\<AVSessionDescriptor>>>;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: avSession<br>方法 or 属性: function createController(sessionId: string, callback: AsyncCallback\<AVSessionController>): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: avSession<br>方法 or 属性: function createController(sessionId: string): Promise\<AVSessionController>;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: avSession<br>方法 or 属性: function castAudio(session: SessionToken \| 'all', audioDevices: Array\<audio.AudioDeviceDescriptor>, callback: AsyncCallback\<void>): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: avSession<br>方法 or 属性: function castAudio(session: SessionToken \| 'all', audioDevices: Array\<audio.AudioDeviceDescriptor>): Promise\<void>;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: SessionToken|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: SessionToken<br>方法 or 属性: sessionId: string;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: SessionToken<br>方法 or 属性: pid: number;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: SessionToken<br>方法 or 属性: uid: number;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: avSession<br>方法 or 属性: function on(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback: (session: AVSessionDescriptor) => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: avSession<br>方法 or 属性: function on(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback: (session: AVSessionDescriptor) => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: avSession<br>方法 or 属性: function on(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback: (session: AVSessionDescriptor) => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: avSession<br>方法 or 属性: function off(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: avSession<br>方法 or 属性: function off(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: avSession<br>方法 or 属性: function off(type: 'sessionCreate' \| 'sessionDestroy' \| 'topSessionChange', callback?: (session: AVSessionDescriptor) => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: avSession<br>方法 or 属性: function on(type: 'sessionServiceDie', callback: () => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: avSession<br>方法 or 属性: function off(type: 'sessionServiceDie', callback?: () => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: avSession<br>方法 or 属性: function sendSystemAVKeyEvent(event: KeyEvent, callback: AsyncCallback\<void>): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: avSession<br>方法 or 属性: function sendSystemAVKeyEvent(event: KeyEvent): Promise\<void>;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: avSession<br>方法 or 属性: function sendSystemControlCommand(command: AVControlCommand, callback: AsyncCallback\<void>): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: avSession<br>方法 or 属性: function sendSystemControlCommand(command: AVControlCommand): Promise\<void>;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: readonly sessionId: string;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: setAVMetadata(data: AVMetadata, callback: AsyncCallback\<void>): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: setAVMetadata(data: AVMetadata): Promise\<void>;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: setAVPlaybackState(state: AVPlaybackState, callback: AsyncCallback\<void>): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: setAVPlaybackState(state: AVPlaybackState): Promise\<void>;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: setLaunchAbility(ability: WantAgent, callback: AsyncCallback\<void>): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: setLaunchAbility(ability: WantAgent): Promise\<void>;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: getController(callback: AsyncCallback\<AVSessionController>): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: getController(): Promise\<AVSessionController>;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: getOutputDevice(callback: AsyncCallback\<OutputDeviceInfo>): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: getOutputDevice(): Promise\<OutputDeviceInfo>;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: on(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback: () => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: off(type: 'play' \| 'pause' \| 'stop' \| 'playNext' \| 'playPrevious' \| 'fastForward' \| 'rewind', callback?: () => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: on(type: 'seek', callback: (time: number) => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: off(type: 'seek', callback?: (time: number) => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: on(type: 'setSpeed', callback: (speed: number) => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: off(type: 'setSpeed', callback?: (speed: number) => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: on(type: 'setLoopMode', callback: (mode: LoopMode) => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: off(type: 'setLoopMode', callback?: (mode: LoopMode) => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: on(type: 'toggleFavorite', callback: (assetId: string) => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: off(type: 'toggleFavorite', callback?: (assetId: string) => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: on(type: 'handleKeyEvent', callback: (event: KeyEvent) => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: off(type: 'handleKeyEvent', callback?: (event: KeyEvent) => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: on(type: 'outputDeviceChange', callback: (device: OutputDeviceInfo) => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: off(type: 'outputDeviceChange', callback?: (device: OutputDeviceInfo) => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: activate(callback: AsyncCallback\<void>): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: activate(): Promise\<void>;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: deactivate(callback: AsyncCallback\<void>): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: deactivate(): Promise\<void>;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: destroy(callback: AsyncCallback\<void>): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSession<br>方法 or 属性: destroy(): Promise\<void>;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVMetadata|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVMetadata<br>方法 or 属性: assetId: string;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVMetadata<br>方法 or 属性: title?: string;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVMetadata<br>方法 or 属性: artist?: string;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVMetadata<br>方法 or 属性: author?: string;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVMetadata<br>方法 or 属性: album?: string;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVMetadata<br>方法 or 属性: writer?: string;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVMetadata<br>方法 or 属性: composer?: string;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVMetadata<br>方法 or 属性: duration?: number;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVMetadata<br>方法 or 属性: mediaImage?: image.PixelMap \| string;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVMetadata<br>方法 or 属性: publishDate?: Date;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVMetadata<br>方法 or 属性: subtitle?: string;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVMetadata<br>方法 or 属性: description?: string;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVMetadata<br>方法 or 属性: lyric?: string;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVMetadata<br>方法 or 属性: previousAssetId?: string;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVMetadata<br>方法 or 属性: nextAssetId?: string;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVPlaybackState|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVPlaybackState<br>方法 or 属性: state?: PlaybackState;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVPlaybackState<br>方法 or 属性: speed?: number;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVPlaybackState<br>方法 or 属性: position?: PlaybackPosition;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVPlaybackState<br>方法 or 属性: bufferedTime?: number;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVPlaybackState<br>方法 or 属性: loopMode?: LoopMode;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVPlaybackState<br>方法 or 属性: isFavorite?: boolean;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: PlaybackPosition|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: PlaybackPosition<br>方法 or 属性: elapsedTime: number;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: PlaybackPosition<br>方法 or 属性: updateTime: number;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: OutputDeviceInfo|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: OutputDeviceInfo<br>方法 or 属性: isRemote: boolean;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: OutputDeviceInfo<br>方法 or 属性: audioDeviceId: Array\<number>;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: OutputDeviceInfo<br>方法 or 属性: deviceName: Array\<string>;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: LoopMode|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: LoopMode<br>方法 or 属性: LOOP_MODE_SEQUENCE = 0|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: LoopMode<br>方法 or 属性: LOOP_MODE_SINGLE = 1|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: LoopMode<br>方法 or 属性: LOOP_MODE_LIST = 2|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: LoopMode<br>方法 or 属性: LOOP_MODE_SHUFFLE = 3|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: PlaybackState|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: PlaybackState<br>方法 or 属性: PLAYBACK_STATE_INITIAL = 0|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: PlaybackState<br>方法 or 属性: PLAYBACK_STATE_PREPARE = 1|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: PlaybackState<br>方法 or 属性: PLAYBACK_STATE_PLAY = 2|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: PlaybackState<br>方法 or 属性: PLAYBACK_STATE_PAUSE = 3|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: PlaybackState<br>方法 or 属性: PLAYBACK_STATE_FAST_FORWARD = 4|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: PlaybackState<br>方法 or 属性: PLAYBACK_STATE_REWIND = 5|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: PlaybackState<br>方法 or 属性: PLAYBACK_STATE_STOP = 6|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionDescriptor|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionDescriptor<br>方法 or 属性: sessionId: string;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionDescriptor<br>方法 or 属性: type: AVSessionType;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionDescriptor<br>方法 or 属性: sessionTag: string;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionDescriptor<br>方法 or 属性: elementName: ElementName;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionDescriptor<br>方法 or 属性: isActive: boolean;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionDescriptor<br>方法 or 属性: isTopSession: boolean;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionDescriptor<br>方法 or 属性: outputDevice: OutputDeviceInfo;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: readonly sessionId: string;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: getAVPlaybackState(callback: AsyncCallback\<AVPlaybackState>): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: getAVPlaybackState(): Promise\<AVPlaybackState>;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: getAVMetadata(callback: AsyncCallback\<AVMetadata>): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: getAVMetadata(): Promise\<AVMetadata>;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: getOutputDevice(callback: AsyncCallback\<OutputDeviceInfo>): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: getOutputDevice(): Promise\<OutputDeviceInfo>;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback\<void>): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: sendAVKeyEvent(event: KeyEvent): Promise\<void>;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: getLaunchAbility(callback: AsyncCallback\<WantAgent>): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: getLaunchAbility(): Promise\<WantAgent>;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: getRealPlaybackPositionSync(): number;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: isActive(callback: AsyncCallback\<boolean>): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: isActive(): Promise\<boolean>;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: destroy(callback: AsyncCallback\<void>): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: destroy(): Promise\<void>;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: getValidCommands(callback: AsyncCallback\<Array\<AVControlCommandType>>): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: getValidCommands(): Promise\<Array\<AVControlCommandType>>;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: sendControlCommand(command: AVControlCommand, callback: AsyncCallback\<void>): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: sendControlCommand(command: AVControlCommand): Promise\<void>;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: on(type: 'metadataChange', filter: Array\<keyof AVMetadata> \| 'all', callback: (data: AVMetadata) => void);|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: off(type: 'metadataChange', callback?: (data: AVMetadata) => void);|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: on(type: 'playbackStateChange', filter: Array\<keyof AVPlaybackState> \| 'all', callback: (state: AVPlaybackState) => void);|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: off(type: 'playbackStateChange', callback?: (state: AVPlaybackState) => void);|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: on(type: 'sessionDestroy', callback: () => void);|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: off(type: 'sessionDestroy', callback?: () => void);|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: on(type: 'activeStateChange', callback: (isActive: boolean) => void);|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: off(type: 'activeStateChange', callback?: (isActive: boolean) => void);|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: on(type: 'validCommandChange', callback: (commands: Array\<AVControlCommandType>) => void);|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: off(type: 'validCommandChange', callback?: (commands: Array\<AVControlCommandType>) => void);|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: on(type: 'outputDeviceChange', callback: (device: OutputDeviceInfo) => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionController<br>方法 or 属性: off(type: 'outputDeviceChange', callback?: (device: OutputDeviceInfo) => void): void;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVControlCommand|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVControlCommand<br>方法 or 属性: command: AVControlCommandType;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVControlCommand<br>方法 or 属性: parameter?: LoopMode \| string \| number;|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionErrorCode|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionErrorCode<br>方法 or 属性: ERR_CODE_SERVICE_EXCEPTION = 6600101|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionErrorCode<br>方法 or 属性: ERR_CODE_SESSION_NOT_EXIST = 6600102|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionErrorCode<br>方法 or 属性: ERR_CODE_CONTROLLER_NOT_EXIST = 6600103|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionErrorCode<br>方法 or 属性: ERR_CODE_REMOTE_CONNECTION_ERR = 6600104|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionErrorCode<br>方法 or 属性: ERR_CODE_COMMAND_INVALID = 6600105|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionErrorCode<br>方法 or 属性: ERR_CODE_SESSION_INACTIVE = 6600106|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.avsession<br>类名: AVSessionErrorCode<br>方法 or 属性: ERR_CODE_MESSAGE_OVERLOAD = 6600107|@ohos.multimedia.avsession.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: camera|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: camera<br>方法 or 属性: function getCameraManager(context: Context): CameraManager;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraStatus|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraStatus<br>方法 or 属性: CAMERA_STATUS_APPEAR = 0|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraStatus<br>方法 or 属性: CAMERA_STATUS_DISAPPEAR = 1|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraStatus<br>方法 or 属性: CAMERA_STATUS_AVAILABLE = 2|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraStatus<br>方法 or 属性: CAMERA_STATUS_UNAVAILABLE = 3|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: Profile|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: Profile<br>方法 or 属性: readonly format: CameraFormat;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: Profile<br>方法 or 属性: readonly size: Size;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: FrameRateRange|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: FrameRateRange<br>方法 or 属性: readonly min: number;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: FrameRateRange<br>方法 or 属性: readonly max: number;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: VideoProfile|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: VideoProfile<br>方法 or 属性: readonly frameRateRange: FrameRateRange;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraOutputCapability|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraOutputCapability<br>方法 or 属性: readonly previewProfiles: Array\<Profile>;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraOutputCapability<br>方法 or 属性: readonly photoProfiles: Array\<Profile>;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraOutputCapability<br>方法 or 属性: readonly videoProfiles: Array\<VideoProfile>;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraOutputCapability<br>方法 or 属性: readonly supportedMetadataObjectTypes: Array\<MetadataObjectType>;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraErrorCode|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraErrorCode<br>方法 or 属性: INVALID_ARGUMENT = 7400101|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraErrorCode<br>方法 or 属性: OPERATION_NOT_ALLOWED = 7400102|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraErrorCode<br>方法 or 属性: SESSION_NOT_CONFIG = 7400103|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraErrorCode<br>方法 or 属性: SESSION_NOT_RUNNING = 7400104|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraErrorCode<br>方法 or 属性: SESSION_CONFIG_LOCKED = 7400105|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraErrorCode<br>方法 or 属性: DEVICE_SETTING_LOCKED = 7400106|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraErrorCode<br>方法 or 属性: CONFILICT_CAMERA = 7400107|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraErrorCode<br>方法 or 属性: DEVICE_DISABLED = 7400108|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraErrorCode<br>方法 or 属性: SERVICE_FATAL_ERROR = 7400201|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraManager|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraManager<br>方法 or 属性: getSupportedCameras(): Array\<CameraDevice>;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraManager<br>方法 or 属性: getSupportedOutputCapability(camera: CameraDevice): CameraOutputCapability;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraManager<br>方法 or 属性: isCameraMuted(): boolean;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraManager<br>方法 or 属性: isCameraMuteSupported(): boolean;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraManager<br>方法 or 属性: muteCamera(mute: boolean): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraManager<br>方法 or 属性: createCameraInput(camera: CameraDevice): CameraInput;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraManager<br>方法 or 属性: createCameraInput(position: CameraPosition, type: CameraType): CameraInput;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraManager<br>方法 or 属性: createPreviewOutput(profile: Profile, surfaceId: string): PreviewOutput;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraManager<br>方法 or 属性: createPhotoOutput(profile: Profile, surfaceId: string): PhotoOutput;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraManager<br>方法 or 属性: createVideoOutput(profile: VideoProfile, surfaceId: string): VideoOutput;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraManager<br>方法 or 属性: createMetadataOutput(metadataObjectTypes: Array\<MetadataObjectType>): MetadataOutput;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraManager<br>方法 or 属性: createCaptureSession(): CaptureSession;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraManager<br>方法 or 属性: on(type: 'cameraStatus', callback: AsyncCallback\<CameraStatusInfo>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraManager<br>方法 or 属性: on(type: 'cameraMute', callback: AsyncCallback\<boolean>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraStatusInfo|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraStatusInfo<br>方法 or 属性: camera: CameraDevice;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraStatusInfo<br>方法 or 属性: status: CameraStatus;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraPosition|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraPosition<br>方法 or 属性: CAMERA_POSITION_UNSPECIFIED = 0|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraPosition<br>方法 or 属性: CAMERA_POSITION_BACK = 1|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraPosition<br>方法 or 属性: CAMERA_POSITION_FRONT = 2|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraType|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraType<br>方法 or 属性: CAMERA_TYPE_DEFAULT = 0|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraType<br>方法 or 属性: CAMERA_TYPE_WIDE_ANGLE = 1|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraType<br>方法 or 属性: CAMERA_TYPE_ULTRA_WIDE = 2|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraType<br>方法 or 属性: CAMERA_TYPE_TELEPHOTO = 3|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraType<br>方法 or 属性: CAMERA_TYPE_TRUE_DEPTH = 4|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: ConnectionType|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: ConnectionType<br>方法 or 属性: CAMERA_CONNECTION_BUILT_IN = 0|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: ConnectionType<br>方法 or 属性: CAMERA_CONNECTION_USB_PLUGIN = 1|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: ConnectionType<br>方法 or 属性: CAMERA_CONNECTION_REMOTE = 2|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraDevice|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraDevice<br>方法 or 属性: readonly cameraId: string;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraDevice<br>方法 or 属性: readonly cameraPosition: CameraPosition;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraDevice<br>方法 or 属性: readonly cameraType: CameraType;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraDevice<br>方法 or 属性: readonly connectionType: ConnectionType;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: Size|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: Size<br>方法 or 属性: height: number;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: Size<br>方法 or 属性: width: number;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: Point|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: Point<br>方法 or 属性: x: number;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: Point<br>方法 or 属性: y: number;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraInput|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraInput<br>方法 or 属性: open(callback: AsyncCallback\<void>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraInput<br>方法 or 属性: open(): Promise\<void>;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraInput<br>方法 or 属性: close(callback: AsyncCallback\<void>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraInput<br>方法 or 属性: close(): Promise\<void>;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraInput<br>方法 or 属性: on(type: 'error', camera: CameraDevice, callback: ErrorCallback\<BusinessError>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraFormat|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraFormat<br>方法 or 属性: CAMERA_FORMAT_RGBA_8888 = 3|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraFormat<br>方法 or 属性: CAMERA_FORMAT_YUV_420_SP = 1003|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraFormat<br>方法 or 属性: CAMERA_FORMAT_JPEG = 2000|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: FlashMode|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: FlashMode<br>方法 or 属性: FLASH_MODE_CLOSE = 0|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: FlashMode<br>方法 or 属性: FLASH_MODE_OPEN = 1|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: FlashMode<br>方法 or 属性: FLASH_MODE_AUTO = 2|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: FlashMode<br>方法 or 属性: FLASH_MODE_ALWAYS_OPEN = 3|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: ExposureMode|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: ExposureMode<br>方法 or 属性: EXPOSURE_MODE_LOCKED = 0|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: ExposureMode<br>方法 or 属性: EXPOSURE_MODE_AUTO = 1|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: ExposureMode<br>方法 or 属性: EXPOSURE_MODE_CONTINUOUS_AUTO = 2|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: FocusMode|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: FocusMode<br>方法 or 属性: FOCUS_MODE_MANUAL = 0|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: FocusMode<br>方法 or 属性: FOCUS_MODE_CONTINUOUS_AUTO = 1|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: FocusMode<br>方法 or 属性: FOCUS_MODE_AUTO = 2|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: FocusMode<br>方法 or 属性: FOCUS_MODE_LOCKED = 3|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: FocusState|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: FocusState<br>方法 or 属性: FOCUS_STATE_SCAN = 0|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: FocusState<br>方法 or 属性: FOCUS_STATE_FOCUSED = 1|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: FocusState<br>方法 or 属性: FOCUS_STATE_UNFOCUSED = 2|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: VideoStabilizationMode|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: VideoStabilizationMode<br>方法 or 属性: OFF = 0|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: VideoStabilizationMode<br>方法 or 属性: LOW = 1|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: VideoStabilizationMode<br>方法 or 属性: MIDDLE = 2|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: VideoStabilizationMode<br>方法 or 属性: HIGH = 3|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: VideoStabilizationMode<br>方法 or 属性: AUTO = 4|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: beginConfig(): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: commitConfig(callback: AsyncCallback\<void>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: commitConfig(): Promise\<void>;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: addInput(cameraInput: CameraInput): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: removeInput(cameraInput: CameraInput): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: addOutput(cameraOutput: CameraOutput): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: removeOutput(cameraOutput: CameraOutput): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: start(callback: AsyncCallback\<void>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: start(): Promise\<void>;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: stop(callback: AsyncCallback\<void>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: stop(): Promise\<void>;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: release(callback: AsyncCallback\<void>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: release(): Promise\<void>;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: hasFlash(): boolean;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: isFlashModeSupported(flashMode: FlashMode): boolean;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: getFlashMode(): FlashMode;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: setFlashMode(flashMode: FlashMode): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: isExposureModeSupported(aeMode: ExposureMode): boolean;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: getExposureMode(): ExposureMode;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: setExposureMode(aeMode: ExposureMode): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: getMeteringPoint(): Point;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: setMeteringPoint(point: Point): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: getExposureBiasRange(): Array\<number>;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: setExposureBias(exposureBias: number): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: getExposureValue(): number;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: isFocusModeSupported(afMode: FocusMode): boolean;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: getFocusMode(): FocusMode;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: setFocusMode(afMode: FocusMode): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: setFocusPoint(point: Point): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: getFocusPoint(): Point;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: getFocalLength(): number;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: getZoomRatioRange(): Array\<number>;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: getZoomRatio(): number;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: setZoomRatio(zoomRatio: number): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: isVideoStabilizationModeSupported(vsMode: VideoStabilizationMode): boolean;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: getActiveVideoStabilizationMode(): VideoStabilizationMode;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: setVideoStabilizationMode(mode: VideoStabilizationMode): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: on(type: 'focusStateChange', callback: AsyncCallback\<FocusState>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureSession<br>方法 or 属性: on(type: 'error', callback: ErrorCallback\<BusinessError>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraOutput|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraOutput<br>方法 or 属性: release(callback: AsyncCallback\<void>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CameraOutput<br>方法 or 属性: release(): Promise\<void>;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: PreviewOutput|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: PreviewOutput<br>方法 or 属性: start(callback: AsyncCallback\<void>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: PreviewOutput<br>方法 or 属性: start(): Promise\<void>;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: PreviewOutput<br>方法 or 属性: stop(callback: AsyncCallback\<void>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: PreviewOutput<br>方法 or 属性: stop(): Promise\<void>;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: PreviewOutput<br>方法 or 属性: on(type: 'frameStart', callback: AsyncCallback\<void>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: PreviewOutput<br>方法 or 属性: on(type: 'frameEnd', callback: AsyncCallback\<void>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: PreviewOutput<br>方法 or 属性: on(type: 'error', callback: ErrorCallback\<BusinessError>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: ImageRotation|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: ImageRotation<br>方法 or 属性: ROTATION_0 = 0|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: ImageRotation<br>方法 or 属性: ROTATION_90 = 90|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: ImageRotation<br>方法 or 属性: ROTATION_180 = 180|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: ImageRotation<br>方法 or 属性: ROTATION_270 = 270|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: Location|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: Location<br>方法 or 属性: latitude: number;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: Location<br>方法 or 属性: longitude: number;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: Location<br>方法 or 属性: altitude: number;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: QualityLevel|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: QualityLevel<br>方法 or 属性: QUALITY_LEVEL_HIGH = 0|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: QualityLevel<br>方法 or 属性: QUALITY_LEVEL_MEDIUM = 1|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: QualityLevel<br>方法 or 属性: QUALITY_LEVEL_LOW = 2|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: PhotoCaptureSetting|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: PhotoCaptureSetting<br>方法 or 属性: quality?: QualityLevel;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: PhotoCaptureSetting<br>方法 or 属性: rotation?: ImageRotation;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: PhotoCaptureSetting<br>方法 or 属性: location?: Location;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: PhotoCaptureSetting<br>方法 or 属性: mirror?: boolean;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: PhotoOutput|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: PhotoOutput<br>方法 or 属性: capture(callback: AsyncCallback\<void>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: PhotoOutput<br>方法 or 属性: capture(): Promise\<void>;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: PhotoOutput<br>方法 or 属性: capture(setting: PhotoCaptureSetting, callback: AsyncCallback\<void>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: PhotoOutput<br>方法 or 属性: capture(setting?: PhotoCaptureSetting): Promise\<void>;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: PhotoOutput<br>方法 or 属性: isMirrorSupported(): boolean;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: PhotoOutput<br>方法 or 属性: on(type: 'captureStart', callback: AsyncCallback\<number>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: PhotoOutput<br>方法 or 属性: on(type: 'frameShutter', callback: AsyncCallback\<FrameShutterInfo>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: PhotoOutput<br>方法 or 属性: on(type: 'captureEnd', callback: AsyncCallback\<CaptureEndInfo>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: PhotoOutput<br>方法 or 属性: on(type: 'error', callback: ErrorCallback\<BusinessError>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: FrameShutterInfo|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: FrameShutterInfo<br>方法 or 属性: captureId: number;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: FrameShutterInfo<br>方法 or 属性: timestamp: number;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureEndInfo|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureEndInfo<br>方法 or 属性: captureId: number;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: CaptureEndInfo<br>方法 or 属性: frameCount: number;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: VideoOutput|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: VideoOutput<br>方法 or 属性: start(callback: AsyncCallback\<void>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: VideoOutput<br>方法 or 属性: start(): Promise\<void>;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: VideoOutput<br>方法 or 属性: stop(callback: AsyncCallback\<void>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: VideoOutput<br>方法 or 属性: stop(): Promise\<void>;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: VideoOutput<br>方法 or 属性: on(type: 'frameStart', callback: AsyncCallback\<void>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: VideoOutput<br>方法 or 属性: on(type: 'frameEnd', callback: AsyncCallback\<void>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: VideoOutput<br>方法 or 属性: on(type: 'error', callback: ErrorCallback\<BusinessError>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: MetadataObjectType|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: MetadataObjectType<br>方法 or 属性: FACE_DETECTION = 0|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: Rect|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: Rect<br>方法 or 属性: topLeftX: number;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: Rect<br>方法 or 属性: topLeftY: number;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: Rect<br>方法 or 属性: width: number;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: Rect<br>方法 or 属性: height: number;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: MetadataObject|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: MetadataObject<br>方法 or 属性: readonly type: MetadataObjectType;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: MetadataObject<br>方法 or 属性: readonly timestamp: number;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: MetadataObject<br>方法 or 属性: readonly boundingBox: Rect;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: MetadataOutput|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: MetadataOutput<br>方法 or 属性: start(callback: AsyncCallback\<void>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: MetadataOutput<br>方法 or 属性: start(): Promise\<void>;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: MetadataOutput<br>方法 or 属性: stop(callback: AsyncCallback\<void>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: MetadataOutput<br>方法 or 属性: stop(): Promise\<void>;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: MetadataOutput<br>方法 or 属性: on(type: 'metadataObjectsAvailable', callback: AsyncCallback\<Array\<MetadataObject>>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.camera<br>类名: MetadataOutput<br>方法 or 属性: on(type: 'error', callback: ErrorCallback\<BusinessError>): void;|@ohos.multimedia.camera.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: PixelMapFormat<br>方法 or 属性:BGRA_8888 = 4|@ohos.multimedia.image.d.ts| +|新增|NA|类名:PixelMapFormat<br>方法or属性:BGRA_8888 = 4|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: PixelMapFormat<br>方法 or 属性:RGB_888 = 5|@ohos.multimedia.image.d.ts| +|新增|NA|类名:PixelMapFormat<br>方法or属性:RGB_888 = 5|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: PixelMapFormat<br>方法 or 属性:ALPHA_8 = 6|@ohos.multimedia.image.d.ts| +|新增|NA|类名:PixelMapFormat<br>方法or属性:ALPHA_8 = 6|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: PixelMapFormat<br>方法 or 属性:RGBA_F16 = 7|@ohos.multimedia.image.d.ts| +|新增|NA|类名:PixelMapFormat<br>方法or属性:RGBA_F16 = 7|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: PixelMapFormat<br>方法 or 属性:NV21 = 8|@ohos.multimedia.image.d.ts| +|新增|NA|类名:PixelMapFormat<br>方法or属性:NV21 = 8|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: PixelMapFormat<br>方法 or 属性:NV12 = 9|@ohos.multimedia.image.d.ts| +|新增|NA|类名:PixelMapFormat<br>方法or属性:NV12 = 9|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: PropertyKey<br>方法 or 属性:DATE_TIME_ORIGINAL = "DateTimeOriginal"|@ohos.multimedia.image.d.ts| +|新增|NA|类名:PropertyKey<br>方法or属性:DATE_TIME_ORIGINAL = "DateTimeOriginal"|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: PropertyKey<br>方法 or 属性:EXPOSURE_TIME = "ExposureTime"|@ohos.multimedia.image.d.ts| +|新增|NA|类名:PropertyKey<br>方法or属性:EXPOSURE_TIME = "ExposureTime"|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: PropertyKey<br>方法 or 属性:SCENE_TYPE = "SceneType"|@ohos.multimedia.image.d.ts| +|新增|NA|类名:PropertyKey<br>方法or属性:SCENE_TYPE = "SceneType"|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: PropertyKey<br>方法 or 属性:ISO_SPEED_RATINGS = "ISOSpeedRatings"|@ohos.multimedia.image.d.ts| +|新增|NA|类名:PropertyKey<br>方法or属性:ISO_SPEED_RATINGS = "ISOSpeedRatings"|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: PropertyKey<br>方法 or 属性:F_NUMBER = "FNumber"|@ohos.multimedia.image.d.ts| +|新增|NA|类名:PropertyKey<br>方法or属性:F_NUMBER = "FNumber"|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ImageFormat|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageFormat<br>方法or属性:|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ImageFormat<br>方法 or 属性:YCBCR_422_SP = 1000|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageFormat<br>方法or属性:YCBCR_422_SP = 1000|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ImageFormat<br>方法 or 属性:JPEG = 2000|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageFormat<br>方法or属性:JPEG = 2000|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: AlphaType|@ohos.multimedia.image.d.ts| +|新增|NA|类名:AlphaType<br>方法or属性:|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: AlphaType<br>方法 or 属性:UNKNOWN = 0|@ohos.multimedia.image.d.ts| +|新增|NA|类名:AlphaType<br>方法or属性:UNKNOWN = 0|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: AlphaType<br>方法 or 属性:OPAQUE = 1|@ohos.multimedia.image.d.ts| +|新增|NA|类名:AlphaType<br>方法or属性:OPAQUE = 1|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: AlphaType<br>方法 or 属性:PREMUL = 2|@ohos.multimedia.image.d.ts| +|新增|NA|类名:AlphaType<br>方法or属性:PREMUL = 2|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: AlphaType<br>方法 or 属性:UNPREMUL = 3|@ohos.multimedia.image.d.ts| +|新增|NA|类名:AlphaType<br>方法or属性:UNPREMUL = 3|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ScaleMode|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ScaleMode<br>方法or属性:|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ScaleMode<br>方法 or 属性:FIT_TARGET_SIZE = 0|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ScaleMode<br>方法or属性:FIT_TARGET_SIZE = 0|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ScaleMode<br>方法 or 属性:CENTER_CROP = 1|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ScaleMode<br>方法or属性:CENTER_CROP = 1|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ComponentType|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ComponentType<br>方法or属性:|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ComponentType<br>方法 or 属性:YUV_Y = 1|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ComponentType<br>方法or属性:YUV_Y = 1|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ComponentType<br>方法 or 属性:YUV_U = 2|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ComponentType<br>方法or属性:YUV_U = 2|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ComponentType<br>方法 or 属性:YUV_V = 3|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ComponentType<br>方法or属性:YUV_V = 3|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ComponentType<br>方法 or 属性:JPEG = 4|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ComponentType<br>方法or属性:JPEG = 4|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ImageInfo<br>方法 or 属性:density: number;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageInfo<br>方法or属性:density: number;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: PackingOption<br>方法 or 属性:bufferSize?: number;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:PackingOption<br>方法or属性:bufferSize?: number;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: DecodingOptions<br>方法 or 属性:fitDensity?: number;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:DecodingOptions<br>方法or属性:fitDensity?: number;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: Component|@ohos.multimedia.image.d.ts| +|新增|NA|类名:Component<br>方法or属性:|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: Component<br>方法 or 属性:readonly componentType: ComponentType;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:Component<br>方法or属性:readonly componentType: ComponentType;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: Component<br>方法 or 属性:readonly rowStride: number;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:Component<br>方法or属性:readonly rowStride: number;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: Component<br>方法 or 属性:readonly pixelStride: number;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:Component<br>方法or属性:readonly pixelStride: number;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: Component<br>方法 or 属性:readonly byteBuffer: ArrayBuffer;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:Component<br>方法or属性:readonly byteBuffer: ArrayBuffer;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: InitializationOptions<br>方法 or 属性:alphaType?: AlphaType;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:InitializationOptions<br>方法or属性:alphaType?: AlphaType;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: InitializationOptions<br>方法 or 属性:scaleMode?: ScaleMode;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:InitializationOptions<br>方法or属性:scaleMode?: ScaleMode;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: SourceOptions|@ohos.multimedia.image.d.ts| +|新增|NA|类名:SourceOptions<br>方法or属性:|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: SourceOptions<br>方法 or 属性:sourceDensity: number;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:SourceOptions<br>方法or属性:sourceDensity: number;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: SourceOptions<br>方法 or 属性:sourcePixelFormat?: PixelMapFormat;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:SourceOptions<br>方法or属性:sourcePixelFormat?: PixelMapFormat;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: SourceOptions<br>方法 or 属性:sourceSize?: Size;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:SourceOptions<br>方法or属性:sourceSize?: Size;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: image<br>方法 or 属性:function createImageSource(uri: string, options: SourceOptions): ImageSource;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:image<br>方法or属性:function createImageSource(uri: string, options: SourceOptions): ImageSource;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: image<br>方法 or 属性:function createImageSource(fd: number, options: SourceOptions): ImageSource;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:image<br>方法or属性:function createImageSource(fd: number, options: SourceOptions): ImageSource;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: image<br>方法 or 属性:function createImageSource(buf: ArrayBuffer): ImageSource;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:image<br>方法or属性:function createImageSource(buf: ArrayBuffer): ImageSource;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: image<br>方法 or 属性:function createImageSource(buf: ArrayBuffer, options: SourceOptions): ImageSource;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:image<br>方法or属性:function createImageSource(buf: ArrayBuffer, options: SourceOptions): ImageSource;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: image<br>方法 or 属性:function CreateIncrementalSource(buf: ArrayBuffer): ImageSource;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:image<br>方法or属性:function CreateIncrementalSource(buf: ArrayBuffer): ImageSource;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: image<br>方法 or 属性:function CreateIncrementalSource(buf: ArrayBuffer, options?: SourceOptions): ImageSource;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:image<br>方法or属性:function CreateIncrementalSource(buf: ArrayBuffer, options?: SourceOptions): ImageSource;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: image<br>方法 or 属性:function createImageReceiver(width: number, height: number, format: number, capacity: number): ImageReceiver;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:image<br>方法or属性:function createImageReceiver(width: number, height: number, format: number, capacity: number): ImageReceiver;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: image<br>方法 or 属性:function createImageCreator(width: number, height: number, format: number, capacity: number): ImageCreator;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:image<br>方法or属性:function createImageCreator(width: number, height: number, format: number, capacity: number): ImageCreator;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: PixelMap<br>方法 or 属性:getDensity():number;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:PixelMap<br>方法or属性:getDensity():number;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: PixelMap<br>方法 or 属性:opacity(rate: number, callback: AsyncCallback\<void>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:PixelMap<br>方法or属性:opacity(rate: number, callback: AsyncCallback\<void>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: PixelMap<br>方法 or 属性:opacity(rate: number): Promise\<void>;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:PixelMap<br>方法or属性:opacity(rate: number): Promise\<void>;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: PixelMap<br>方法 or 属性:createAlphaPixelmap(): Promise\<PixelMap>;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:PixelMap<br>方法or属性:createAlphaPixelmap(): Promise\<PixelMap>;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: PixelMap<br>方法 or 属性:createAlphaPixelmap(callback: AsyncCallback\<PixelMap>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:PixelMap<br>方法or属性:createAlphaPixelmap(callback: AsyncCallback\<PixelMap>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: PixelMap<br>方法 or 属性:scale(x: number, y: number, callback: AsyncCallback\<void>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:PixelMap<br>方法or属性:scale(x: number, y: number, callback: AsyncCallback\<void>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: PixelMap<br>方法 or 属性:scale(x: number, y: number): Promise\<void>;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:PixelMap<br>方法or属性:scale(x: number, y: number): Promise\<void>;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: PixelMap<br>方法 or 属性:translate(x: number, y: number, callback: AsyncCallback\<void>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:PixelMap<br>方法or属性:translate(x: number, y: number, callback: AsyncCallback\<void>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: PixelMap<br>方法 or 属性:translate(x: number, y: number): Promise\<void>;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:PixelMap<br>方法or属性:translate(x: number, y: number): Promise\<void>;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: PixelMap<br>方法 or 属性:rotate(angle: number, callback: AsyncCallback\<void>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:PixelMap<br>方法or属性:rotate(angle: number, callback: AsyncCallback\<void>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: PixelMap<br>方法 or 属性:rotate(angle: number): Promise\<void>;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:PixelMap<br>方法or属性:rotate(angle: number): Promise\<void>;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: PixelMap<br>方法 or 属性:flip(horizontal: boolean, vertical: boolean, callback: AsyncCallback\<void>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:PixelMap<br>方法or属性:flip(horizontal: boolean, vertical: boolean, callback: AsyncCallback\<void>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: PixelMap<br>方法 or 属性:flip(horizontal: boolean, vertical: boolean): Promise\<void>;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:PixelMap<br>方法or属性:flip(horizontal: boolean, vertical: boolean): Promise\<void>;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: PixelMap<br>方法 or 属性:crop(region: Region, callback: AsyncCallback\<void>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:PixelMap<br>方法or属性:crop(region: Region, callback: AsyncCallback\<void>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: PixelMap<br>方法 or 属性:crop(region: Region): Promise\<void>;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:PixelMap<br>方法or属性:crop(region: Region): Promise\<void>;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageSource<br>方法or属性:modifyImageProperty(key: string, value: string): Promise\<void>;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageSource<br>方法or属性:modifyImageProperty(key: string, value: string, callback: AsyncCallback\<void>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageSource<br>方法or属性:updateData(buf: ArrayBuffer, isFinished: boolean, value: number, length: number): Promise\<void>;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageSource<br>方法or属性:updateData(buf: ArrayBuffer, isFinished: boolean, value: number, length: number, callback: AsyncCallback\<void>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: Image|@ohos.multimedia.image.d.ts| +|新增|NA|类名:Image<br>方法or属性:|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: Image<br>方法 or 属性:clipRect: Region;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:Image<br>方法or属性:clipRect: Region;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: Image<br>方法 or 属性:readonly size: Size;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:Image<br>方法or属性:readonly size: Size;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: Image<br>方法 or 属性:readonly format: number;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:Image<br>方法or属性:readonly format: number;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: Image<br>方法 or 属性:getComponent(componentType: ComponentType, callback: AsyncCallback\<Component>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:Image<br>方法or属性:getComponent(componentType: ComponentType, callback: AsyncCallback\<Component>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: Image<br>方法 or 属性:getComponent(componentType: ComponentType): Promise\<Component>;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:Image<br>方法or属性:getComponent(componentType: ComponentType): Promise\<Component>;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: Image<br>方法 or 属性:release(callback: AsyncCallback\<void>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:Image<br>方法or属性:release(callback: AsyncCallback\<void>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: Image<br>方法 or 属性:release(): Promise\<void>;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:Image<br>方法or属性:release(): Promise\<void>;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ImageReceiver|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageReceiver<br>方法or属性:|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ImageReceiver<br>方法 or 属性:readonly size: Size;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageReceiver<br>方法or属性:readonly size: Size;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ImageReceiver<br>方法 or 属性:readonly capacity: number;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageReceiver<br>方法or属性:readonly capacity: number;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ImageReceiver<br>方法 or 属性:readonly format: ImageFormat;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageReceiver<br>方法or属性:readonly format: ImageFormat;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ImageReceiver<br>方法 or 属性:getReceivingSurfaceId(callback: AsyncCallback\<string>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageReceiver<br>方法or属性:getReceivingSurfaceId(callback: AsyncCallback\<string>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ImageReceiver<br>方法 or 属性:getReceivingSurfaceId(): Promise\<string>;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageReceiver<br>方法or属性:getReceivingSurfaceId(): Promise\<string>;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ImageReceiver<br>方法 or 属性:readLatestImage(callback: AsyncCallback\<Image>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageReceiver<br>方法or属性:readLatestImage(callback: AsyncCallback\<Image>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ImageReceiver<br>方法 or 属性:readLatestImage(): Promise\<Image>;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageReceiver<br>方法or属性:readLatestImage(): Promise\<Image>;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ImageReceiver<br>方法 or 属性:readNextImage(callback: AsyncCallback\<Image>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageReceiver<br>方法or属性:readNextImage(callback: AsyncCallback\<Image>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ImageReceiver<br>方法 or 属性:readNextImage(): Promise\<Image>;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageReceiver<br>方法or属性:readNextImage(): Promise\<Image>;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ImageReceiver<br>方法 or 属性:on(type: 'imageArrival', callback: AsyncCallback\<void>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageReceiver<br>方法or属性:on(type: 'imageArrival', callback: AsyncCallback\<void>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ImageReceiver<br>方法 or 属性:release(callback: AsyncCallback\<void>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageReceiver<br>方法or属性:release(callback: AsyncCallback\<void>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ImageReceiver<br>方法 or 属性:release(): Promise\<void>;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageReceiver<br>方法or属性:release(): Promise\<void>;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ImageCreator|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageCreator<br>方法or属性:|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ImageCreator<br>方法 or 属性:readonly capacity: number;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageCreator<br>方法or属性:readonly capacity: number;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ImageCreator<br>方法 or 属性:readonly format: ImageFormat;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageCreator<br>方法or属性:readonly format: ImageFormat;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ImageCreator<br>方法 or 属性:dequeueImage(callback: AsyncCallback\<Image>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageCreator<br>方法or属性:dequeueImage(callback: AsyncCallback\<Image>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ImageCreator<br>方法 or 属性:dequeueImage(): Promise\<Image>;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageCreator<br>方法or属性:dequeueImage(): Promise\<Image>;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ImageCreator<br>方法 or 属性:queueImage(interface: Image, callback: AsyncCallback\<void>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageCreator<br>方法or属性:queueImage(interface: Image, callback: AsyncCallback\<void>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ImageCreator<br>方法 or 属性:queueImage(interface: Image): Promise\<void>;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageCreator<br>方法or属性:queueImage(interface: Image): Promise\<void>;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ImageCreator<br>方法 or 属性:on(type: 'imageRelease', callback: AsyncCallback\<void>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageCreator<br>方法or属性:on(type: 'imageRelease', callback: AsyncCallback\<void>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ImageCreator<br>方法 or 属性:release(callback: AsyncCallback\<void>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageCreator<br>方法or属性:release(callback: AsyncCallback\<void>): void;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.image<br>类名: ImageCreator<br>方法 or 属性:release(): Promise\<void>;|@ohos.multimedia.image.d.ts| +|新增|NA|类名:ImageCreator<br>方法or属性:release(): Promise\<void>;|@ohos.multimedia.image.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayerState<br>方法 or 属性:type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayerState<br>方法or属性:type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayerState<br>方法 or 属性:type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayerState<br>方法or属性:type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayerState<br>方法 or 属性:type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayerState<br>方法or属性:type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayerState<br>方法 or 属性:type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayerState<br>方法or属性:type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayerState<br>方法 or 属性:type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayerState<br>方法or属性:type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayerState<br>方法 or 属性:type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayerState<br>方法or属性:type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayerState<br>方法 or 属性:type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayerState<br>方法or属性:type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayerState<br>方法 or 属性:type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayerState<br>方法or属性:type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayerState<br>方法 or 属性:type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayerState<br>方法or属性:type AVPlayerState = 'idle' \| 'initialized' \| 'prepared' \| 'playing' \| 'paused' \| 'completed' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorderState<br>方法 or 属性:type AVRecorderState = 'idle' \| 'prepared' \| 'started' \| 'paused' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorderState<br>方法or属性:type AVRecorderState = 'idle' \| 'prepared' \| 'started' \| 'paused' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorderState<br>方法 or 属性:type AVRecorderState = 'idle' \| 'prepared' \| 'started' \| 'paused' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorderState<br>方法or属性:type AVRecorderState = 'idle' \| 'prepared' \| 'started' \| 'paused' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorderState<br>方法 or 属性:type AVRecorderState = 'idle' \| 'prepared' \| 'started' \| 'paused' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorderState<br>方法or属性:type AVRecorderState = 'idle' \| 'prepared' \| 'started' \| 'paused' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorderState<br>方法 or 属性:type AVRecorderState = 'idle' \| 'prepared' \| 'started' \| 'paused' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorderState<br>方法or属性:type AVRecorderState = 'idle' \| 'prepared' \| 'started' \| 'paused' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorderState<br>方法 or 属性:type AVRecorderState = 'idle' \| 'prepared' \| 'started' \| 'paused' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorderState<br>方法or属性:type AVRecorderState = 'idle' \| 'prepared' \| 'started' \| 'paused' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorderState<br>方法 or 属性:type AVRecorderState = 'idle' \| 'prepared' \| 'started' \| 'paused' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorderState<br>方法or属性:type AVRecorderState = 'idle' \| 'prepared' \| 'started' \| 'paused' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorderState<br>方法 or 属性:type AVRecorderState = 'idle' \| 'prepared' \| 'started' \| 'paused' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorderState<br>方法or属性:type AVRecorderState = 'idle' \| 'prepared' \| 'started' \| 'paused' \| 'stopped' \| 'released' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecordState<br>方法 or 属性:type VideoRecordState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecordState<br>方法or属性:type VideoRecordState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecordState<br>方法 or 属性:type VideoRecordState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecordState<br>方法or属性:type VideoRecordState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecordState<br>方法 or 属性:type VideoRecordState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecordState<br>方法or属性:type VideoRecordState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecordState<br>方法 or 属性:type VideoRecordState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecordState<br>方法or属性:type VideoRecordState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecordState<br>方法 or 属性:type VideoRecordState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecordState<br>方法or属性:type VideoRecordState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecordState<br>方法 or 属性:type VideoRecordState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecordState<br>方法or属性:type VideoRecordState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';|@ohos.multimedia.media.d.ts| +|新增|NA|类名:media<br>方法or属性:function createAVPlayer(callback: AsyncCallback\<AVPlayer>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:media<br>方法or属性:function createAVPlayer() : Promise\<AVPlayer>;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:media<br>方法or属性:function createAVRecorder(callback: AsyncCallback\<AVRecorder>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:media<br>方法or属性:function createAVRecorder() : Promise\<AVRecorder>;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:media<br>方法or属性:function createVideoRecorder(callback: AsyncCallback\<VideoRecorder>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:media<br>方法or属性:function createVideoRecorder(): Promise\<VideoRecorder>;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: StateChangeReason|@ohos.multimedia.media.d.ts| +|新增|NA|类名:StateChangeReason<br>方法or属性:|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: StateChangeReason<br>方法 or 属性:USER = 1|@ohos.multimedia.media.d.ts| +|新增|NA|类名:StateChangeReason<br>方法or属性:USER = 1|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: StateChangeReason<br>方法 or 属性:BACKGROUND = 2|@ohos.multimedia.media.d.ts| +|新增|NA|类名:StateChangeReason<br>方法or属性:BACKGROUND = 2|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVErrorCode|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVErrorCode<br>方法or属性:|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVErrorCode<br>方法 or 属性:AVERR_OK = 0|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVErrorCode<br>方法or属性:AVERR_OK = 0|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVErrorCode<br>方法 or 属性:AVERR_NO_PERMISSION = 201|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVErrorCode<br>方法or属性:AVERR_NO_PERMISSION = 201|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVErrorCode<br>方法 or 属性:AVERR_INVALID_PARAMETER = 401|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVErrorCode<br>方法or属性:AVERR_INVALID_PARAMETER = 401|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVErrorCode<br>方法 or 属性:AVERR_UNSUPPORT_CAPABILITY = 801|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVErrorCode<br>方法or属性:AVERR_UNSUPPORT_CAPABILITY = 801|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVErrorCode<br>方法 or 属性:AVERR_NO_MEMORY = 5400101|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVErrorCode<br>方法or属性:AVERR_NO_MEMORY = 5400101|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVErrorCode<br>方法 or 属性:AVERR_OPERATE_NOT_PERMIT = 5400102|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVErrorCode<br>方法or属性:AVERR_OPERATE_NOT_PERMIT = 5400102|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVErrorCode<br>方法 or 属性:AVERR_IO = 5400103|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVErrorCode<br>方法or属性:AVERR_IO = 5400103|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVErrorCode<br>方法 or 属性:AVERR_TIMEOUT = 5400104|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVErrorCode<br>方法or属性:AVERR_TIMEOUT = 5400104|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVErrorCode<br>方法 or 属性:AVERR_SERVICE_DIED = 5400105|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVErrorCode<br>方法or属性:AVERR_SERVICE_DIED = 5400105|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVErrorCode<br>方法 or 属性:AVERR_UNSUPPORT_FORMAT = 5400106|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVErrorCode<br>方法or属性:AVERR_UNSUPPORT_FORMAT = 5400106|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:prepare(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:prepare(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:prepare(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:prepare(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:play(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:play(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:play(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:play(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:pause(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:pause(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:pause(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:pause(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:stop(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:stop(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:stop(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:stop(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:reset(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:reset(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:reset(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:reset(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:release(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:release(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:release(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:release(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:seek(timeMs: number, mode?:SeekMode): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:seek(timeMs: number, mode?:SeekMode): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:setVolume(volume: number): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:setVolume(volume: number): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:getTrackDescription(callback: AsyncCallback\<Array\<MediaDescription>>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:getTrackDescription(callback: AsyncCallback\<Array\<MediaDescription>>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:getTrackDescription() : Promise\<Array\<MediaDescription>>;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:getTrackDescription() : Promise\<Array\<MediaDescription>>;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:url ?: string;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:url ?: string;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:fdSrc ?: AVFileDescriptor;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:fdSrc ?: AVFileDescriptor;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:loop: boolean;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:loop: boolean;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:audioInterruptMode ?: audio.InterruptMode;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:audioInterruptMode ?: audio.InterruptMode;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:readonly currentTime: number;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:readonly currentTime: number;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:readonly duration: number;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:readonly duration: number;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:readonly state: AVPlayerState;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:readonly state: AVPlayerState;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:surfaceId ?: string;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:surfaceId ?: string;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:readonly width: number;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:readonly width: number;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:readonly height: number;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:readonly height: number;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:videoScaleType ?: VideoScaleType;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:videoScaleType ?: VideoScaleType;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:setSpeed(speed: PlaybackSpeed): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:setSpeed(speed: PlaybackSpeed): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:setBitrate(bitrate: number): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:setBitrate(bitrate: number): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:on(type: 'stateChange', callback: (state: AVPlayerState, reason: StateChangeReason) => void): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:on(type: 'stateChange', callback: (state: AVPlayerState, reason: StateChangeReason) => void): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:off(type: 'stateChange'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:off(type: 'stateChange'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:on(type: 'volumeChange', callback: Callback\<number>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:on(type: 'volumeChange', callback: Callback\<number>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:off(type: 'volumeChange'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:off(type: 'volumeChange'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:on(type: 'endOfStream', callback: Callback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:on(type: 'endOfStream', callback: Callback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:off(type: 'endOfStream'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:off(type: 'endOfStream'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:on(type: 'seekDone', callback: Callback\<number>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:on(type: 'seekDone', callback: Callback\<number>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:off(type: 'seekDone'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:off(type: 'seekDone'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:on(type: 'speedDone', callback: Callback\<number>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:on(type: 'speedDone', callback: Callback\<number>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:off(type: 'speedDone'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:off(type: 'speedDone'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:on(type: 'bitrateDone', callback: Callback\<number>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:on(type: 'bitrateDone', callback: Callback\<number>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:off(type: 'bitrateDone'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:off(type: 'bitrateDone'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:on(type: 'timeUpdate', callback: Callback\<number>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:on(type: 'timeUpdate', callback: Callback\<number>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:off(type: 'timeUpdate'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:off(type: 'timeUpdate'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:on(type: 'durationUpdate', callback: Callback\<number>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:on(type: 'durationUpdate', callback: Callback\<number>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:off(type: 'durationUpdate'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:off(type: 'durationUpdate'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:off(type: 'bufferingUpdate'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:off(type: 'bufferingUpdate'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:on(type: 'startRenderFrame', callback: Callback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:on(type: 'startRenderFrame', callback: Callback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:off(type: 'startRenderFrame'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:off(type: 'startRenderFrame'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:on(type: 'videoSizeChange', callback: (width: number, height: number) => void): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:on(type: 'videoSizeChange', callback: (width: number, height: number) => void): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:off(type: 'videoSizeChange'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:off(type: 'videoSizeChange'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:off(type: 'audioInterrupt'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:off(type: 'audioInterrupt'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:on(type: 'availableBitrates', callback: (bitrates: Array\<number>) => void): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:on(type: 'availableBitrates', callback: (bitrates: Array\<number>) => void): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:off(type: 'availableBitrates'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:off(type: 'availableBitrates'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:on(type: 'error', callback: ErrorCallback): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:on(type: 'error', callback: ErrorCallback): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVPlayer<br>方法 or 属性:off(type: 'error'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVPlayer<br>方法or属性:off(type: 'error'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVFileDescriptor|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVFileDescriptor<br>方法or属性:|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVFileDescriptor<br>方法 or 属性:fd: number|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVFileDescriptor<br>方法or属性:fd: number|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVFileDescriptor<br>方法 or 属性:offset?: number|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVFileDescriptor<br>方法or属性:offset?: number|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVFileDescriptor<br>方法 or 属性:length?: number|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVFileDescriptor<br>方法or属性:length?: number|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AudioPlayer<br>方法or属性:fdSrc: AVFileDescriptor;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AudioPlayer<br>方法or属性:audioInterruptMode ?: audio.InterruptMode;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AudioPlayer<br>方法or属性:on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorder|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorder<br>方法or属性:|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorder<br>方法 or 属性:prepare(config: AVRecorderConfig, callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorder<br>方法or属性:prepare(config: AVRecorderConfig, callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorder<br>方法 or 属性:prepare(config: AVRecorderConfig): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorder<br>方法or属性:prepare(config: AVRecorderConfig): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorder<br>方法 or 属性:getInputSurface(callback: AsyncCallback\<string>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorder<br>方法or属性:getInputSurface(callback: AsyncCallback\<string>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorder<br>方法 or 属性:getInputSurface(): Promise\<string>;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorder<br>方法or属性:getInputSurface(): Promise\<string>;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorder<br>方法 or 属性:start(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorder<br>方法or属性:start(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorder<br>方法 or 属性:start(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorder<br>方法or属性:start(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorder<br>方法 or 属性:pause(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorder<br>方法or属性:pause(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorder<br>方法 or 属性:pause(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorder<br>方法or属性:pause(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorder<br>方法 or 属性:resume(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorder<br>方法or属性:resume(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorder<br>方法 or 属性:resume(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorder<br>方法or属性:resume(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorder<br>方法 or 属性:stop(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorder<br>方法or属性:stop(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorder<br>方法 or 属性:stop(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorder<br>方法or属性:stop(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorder<br>方法 or 属性:reset(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorder<br>方法or属性:reset(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorder<br>方法 or 属性:reset(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorder<br>方法or属性:reset(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorder<br>方法 or 属性:release(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorder<br>方法or属性:release(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorder<br>方法 or 属性:release(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorder<br>方法or属性:release(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorder<br>方法 or 属性:readonly state: AVRecorderState;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorder<br>方法or属性:readonly state: AVRecorderState;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorder<br>方法 or 属性:on(type: 'stateChange', callback: (state: AVRecorderState, reason: StateChangeReason) => void): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorder<br>方法or属性:on(type: 'stateChange', callback: (state: AVRecorderState, reason: StateChangeReason) => void): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorder<br>方法 or 属性:on(type: 'error', callback: ErrorCallback): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorder<br>方法or属性:on(type: 'error', callback: ErrorCallback): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorder<br>方法 or 属性:off(type: 'stateChange'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorder<br>方法or属性:off(type: 'stateChange'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorder<br>方法 or 属性:off(type: 'error'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorder<br>方法or属性:off(type: 'error'): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorder|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorder<br>方法or属性:|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorder<br>方法 or 属性:prepare(config: VideoRecorderConfig, callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorder<br>方法or属性:prepare(config: VideoRecorderConfig, callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorder<br>方法 or 属性:prepare(config: VideoRecorderConfig): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorder<br>方法or属性:prepare(config: VideoRecorderConfig): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorder<br>方法 or 属性:getInputSurface(callback: AsyncCallback\<string>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorder<br>方法or属性:getInputSurface(callback: AsyncCallback\<string>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorder<br>方法 or 属性:getInputSurface(): Promise\<string>;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorder<br>方法or属性:getInputSurface(): Promise\<string>;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorder<br>方法 or 属性:start(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorder<br>方法or属性:start(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorder<br>方法 or 属性:start(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorder<br>方法or属性:start(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorder<br>方法 or 属性:pause(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorder<br>方法or属性:pause(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorder<br>方法 or 属性:pause(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorder<br>方法or属性:pause(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorder<br>方法 or 属性:resume(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorder<br>方法or属性:resume(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorder<br>方法 or 属性:resume(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorder<br>方法or属性:resume(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorder<br>方法 or 属性:stop(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorder<br>方法or属性:stop(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorder<br>方法 or 属性:stop(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorder<br>方法or属性:stop(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorder<br>方法 or 属性:release(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorder<br>方法or属性:release(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorder<br>方法 or 属性:release(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorder<br>方法or属性:release(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorder<br>方法 or 属性:reset(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorder<br>方法or属性:reset(callback: AsyncCallback\<void>): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorder<br>方法 or 属性:reset(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorder<br>方法or属性:reset(): Promise\<void>;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorder<br>方法 or 属性:on(type: 'error', callback: ErrorCallback): void;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorder<br>方法or属性:on(type: 'error', callback: ErrorCallback): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorder<br>方法 or 属性:readonly state: VideoRecordState;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorder<br>方法or属性:readonly state: VideoRecordState;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoPlayer<br>方法or属性:fdSrc: AVFileDescriptor;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoPlayer<br>方法or属性:audioInterruptMode ?: audio.InterruptMode;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoPlayer<br>方法or属性:videoScaleType ?: VideoScaleType;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoPlayer<br>方法or属性:on(type: 'audioInterrupt', callback: (info: audio.InterruptEvent) => void): void;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoScaleType|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoScaleType<br>方法or属性:|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoScaleType<br>方法 or 属性:VIDEO_SCALE_TYPE_FIT = 0|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoScaleType<br>方法or属性:VIDEO_SCALE_TYPE_FIT = 0|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoScaleType<br>方法 or 属性:VIDEO_SCALE_TYPE_FIT_CROP = 1|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoScaleType<br>方法or属性:VIDEO_SCALE_TYPE_FIT_CROP = 1|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorderProfile|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorderProfile<br>方法or属性:|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorderProfile<br>方法 or 属性:readonly audioBitrate: number;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorderProfile<br>方法or属性:readonly audioBitrate: number;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorderProfile<br>方法 or 属性:readonly audioChannels: number;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorderProfile<br>方法or属性:readonly audioChannels: number;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorderProfile<br>方法 or 属性:readonly audioCodec: CodecMimeType;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorderProfile<br>方法or属性:readonly audioCodec: CodecMimeType;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorderProfile<br>方法 or 属性:readonly audioSampleRate: number;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorderProfile<br>方法or属性:readonly audioSampleRate: number;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorderProfile<br>方法 or 属性:readonly fileFormat: ContainerFormatType;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorderProfile<br>方法or属性:readonly fileFormat: ContainerFormatType;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorderProfile<br>方法 or 属性:readonly videoBitrate: number;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorderProfile<br>方法or属性:readonly videoBitrate: number;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorderProfile<br>方法 or 属性:readonly videoCodec: CodecMimeType;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorderProfile<br>方法or属性:readonly videoCodec: CodecMimeType;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorderProfile<br>方法 or 属性:readonly videoFrameWidth: number;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorderProfile<br>方法or属性:readonly videoFrameWidth: number;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorderProfile<br>方法 or 属性:readonly videoFrameHeight: number;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorderProfile<br>方法or属性:readonly videoFrameHeight: number;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorderProfile<br>方法 or 属性:readonly videoFrameRate: number;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorderProfile<br>方法or属性:readonly videoFrameRate: number;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AudioSourceType|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AudioSourceType<br>方法or属性:|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AudioSourceType<br>方法 or 属性:AUDIO_SOURCE_TYPE_DEFAULT = 0|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AudioSourceType<br>方法or属性:AUDIO_SOURCE_TYPE_DEFAULT = 0|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AudioSourceType<br>方法 or 属性:AUDIO_SOURCE_TYPE_MIC = 1|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AudioSourceType<br>方法or属性:AUDIO_SOURCE_TYPE_MIC = 1|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoSourceType|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoSourceType<br>方法or属性:|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoSourceType<br>方法 or 属性:VIDEO_SOURCE_TYPE_SURFACE_YUV = 0|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoSourceType<br>方法or属性:VIDEO_SOURCE_TYPE_SURFACE_YUV = 0|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoSourceType<br>方法 or 属性:VIDEO_SOURCE_TYPE_SURFACE_ES = 1|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoSourceType<br>方法or属性:VIDEO_SOURCE_TYPE_SURFACE_ES = 1|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorderConfig|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorderConfig<br>方法or属性:|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorderConfig<br>方法 or 属性:audioSourceType?: AudioSourceType;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorderConfig<br>方法or属性:audioSourceType?: AudioSourceType;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorderConfig<br>方法 or 属性:videoSourceType: VideoSourceType;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorderConfig<br>方法or属性:videoSourceType: VideoSourceType;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorderConfig<br>方法 or 属性:profile: VideoRecorderProfile;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorderConfig<br>方法or属性:profile: VideoRecorderProfile;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorderConfig<br>方法 or 属性:url: string;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorderConfig<br>方法or属性:url: string;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorderConfig<br>方法 or 属性:rotation?: number;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorderConfig<br>方法or属性:rotation?: number;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: VideoRecorderConfig<br>方法 or 属性:location?: Location;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:VideoRecorderConfig<br>方法or属性:location?: Location;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorderProfile|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorderProfile<br>方法or属性:|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorderProfile<br>方法 or 属性:audioBitrate?: number;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorderProfile<br>方法or属性:audioBitrate?: number;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorderProfile<br>方法 or 属性:audioChannels?: number;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorderProfile<br>方法or属性:audioChannels?: number;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorderProfile<br>方法 or 属性:audioCodec?: CodecMimeType;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorderProfile<br>方法or属性:audioCodec?: CodecMimeType;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorderProfile<br>方法 or 属性:audioSampleRate?: number;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorderProfile<br>方法or属性:audioSampleRate?: number;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorderProfile<br>方法 or 属性:fileFormat: ContainerFormatType;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorderProfile<br>方法or属性:fileFormat: ContainerFormatType;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorderProfile<br>方法 or 属性:videoBitrate?: number;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorderProfile<br>方法or属性:videoBitrate?: number;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorderProfile<br>方法 or 属性:videoCodec?: CodecMimeType;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorderProfile<br>方法or属性:videoCodec?: CodecMimeType;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorderProfile<br>方法 or 属性:videoFrameWidth?: number;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorderProfile<br>方法or属性:videoFrameWidth?: number;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorderProfile<br>方法 or 属性:videoFrameHeight?: number;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorderProfile<br>方法or属性:videoFrameHeight?: number;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorderProfile<br>方法 or 属性:videoFrameRate?: number;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorderProfile<br>方法or属性:videoFrameRate?: number;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorderConfig|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorderConfig<br>方法or属性:|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorderConfig<br>方法 or 属性:audioSourceType?: AudioSourceType;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorderConfig<br>方法or属性:audioSourceType?: AudioSourceType;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorderConfig<br>方法 or 属性:videoSourceType?: VideoSourceType;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorderConfig<br>方法or属性:videoSourceType?: VideoSourceType;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorderConfig<br>方法 or 属性:profile: AVRecorderProfile;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorderConfig<br>方法or属性:profile: AVRecorderProfile;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorderConfig<br>方法 or 属性:url: string;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorderConfig<br>方法or属性:url: string;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorderConfig<br>方法 or 属性:rotation?: number;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorderConfig<br>方法or属性:rotation?: number;|@ohos.multimedia.media.d.ts| +|新增|NA|模块名: ohos.multimedia.media<br>类名: AVRecorderConfig<br>方法 or 属性:location?: Location;|@ohos.multimedia.media.d.ts| +|新增|NA|类名:AVRecorderConfig<br>方法or属性:location?: Location;|@ohos.multimedia.media.d.ts| +|访问级别有变化|类名:VolumeEvent<br>访问级别:系统API|类名:VolumeEvent<br>访问级别:公开API|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:ActiveDeviceType<br>废弃版本:N/A|类名:ActiveDeviceType<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.CommunicationDeviceType |@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:ActiveDeviceType<br>方法 or 属性:SPEAKER = 2<br>废弃版本:N/A|类名:ActiveDeviceType<br>方法 or 属性:SPEAKER = 2<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.CommunicationDeviceType.SPEAKER |@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:ActiveDeviceType<br>方法 or 属性:BLUETOOTH_SCO = 7<br>废弃版本:N/A|类名:ActiveDeviceType<br>方法 or 属性:BLUETOOTH_SCO = 7<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:InterruptActionType<br>废弃版本:N/A|类名:InterruptActionType<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:InterruptActionType<br>方法 or 属性:TYPE_ACTIVATED = 0<br>废弃版本:N/A|类名:InterruptActionType<br>方法 or 属性:TYPE_ACTIVATED = 0<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:InterruptActionType<br>方法 or 属性:TYPE_INTERRUPT = 1<br>废弃版本:N/A|类名:InterruptActionType<br>方法 or 属性:TYPE_INTERRUPT = 1<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:setVolume(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:setVolume(volumeType: AudioVolumeType, volume: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioVolumeGroupManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:setVolume(volumeType: AudioVolumeType, volume: number): Promise\<void>;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:setVolume(volumeType: AudioVolumeType, volume: number): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioVolumeGroupManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:getVolume(volumeType: AudioVolumeType, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:getVolume(volumeType: AudioVolumeType, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioVolumeGroupManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:getVolume(volumeType: AudioVolumeType): Promise\<number>;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:getVolume(volumeType: AudioVolumeType): Promise\<number>;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioVolumeGroupManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:getMinVolume(volumeType: AudioVolumeType, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:getMinVolume(volumeType: AudioVolumeType, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioVolumeGroupManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:getMinVolume(volumeType: AudioVolumeType): Promise\<number>;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:getMinVolume(volumeType: AudioVolumeType): Promise\<number>;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioVolumeGroupManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:getMaxVolume(volumeType: AudioVolumeType, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:getMaxVolume(volumeType: AudioVolumeType, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioVolumeGroupManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:getMaxVolume(volumeType: AudioVolumeType): Promise\<number>;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:getMaxVolume(volumeType: AudioVolumeType): Promise\<number>;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioVolumeGroupManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:getDevices(deviceFlag: DeviceFlag, callback: AsyncCallback\<AudioDeviceDescriptors>): void;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:getDevices(deviceFlag: DeviceFlag, callback: AsyncCallback\<AudioDeviceDescriptors>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioRoutingManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:getDevices(deviceFlag: DeviceFlag): Promise\<AudioDeviceDescriptors>;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:getDevices(deviceFlag: DeviceFlag): Promise\<AudioDeviceDescriptors>;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioRoutingManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:mute(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:mute(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioVolumeGroupManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:mute(volumeType: AudioVolumeType, mute: boolean): Promise\<void>;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:mute(volumeType: AudioVolumeType, mute: boolean): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioVolumeGroupManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:isMute(volumeType: AudioVolumeType, callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:isMute(volumeType: AudioVolumeType, callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioVolumeGroupManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:isMute(volumeType: AudioVolumeType): Promise\<boolean>;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:isMute(volumeType: AudioVolumeType): Promise\<boolean>;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioVolumeGroupManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:isActive(volumeType: AudioVolumeType, callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:isActive(volumeType: AudioVolumeType, callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioStreamManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:isActive(volumeType: AudioVolumeType): Promise\<boolean>;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:isActive(volumeType: AudioVolumeType): Promise\<boolean>;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioStreamManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:setMicrophoneMute(mute: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:setMicrophoneMute(mute: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioVolumeGroupManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:setMicrophoneMute(mute: boolean): Promise\<void>;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:setMicrophoneMute(mute: boolean): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioVolumeGroupManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:isMicrophoneMute(callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:isMicrophoneMute(callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioVolumeGroupManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:isMicrophoneMute(): Promise\<boolean>;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:isMicrophoneMute(): Promise\<boolean>;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioVolumeGroupManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:setRingerMode(mode: AudioRingMode, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:setRingerMode(mode: AudioRingMode, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioVolumeGroupManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:setRingerMode(mode: AudioRingMode): Promise\<void>;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:setRingerMode(mode: AudioRingMode): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioVolumeGroupManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:getRingerMode(callback: AsyncCallback\<AudioRingMode>): void;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:getRingerMode(callback: AsyncCallback\<AudioRingMode>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioVolumeGroupManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:getRingerMode(): Promise\<AudioRingMode>;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:getRingerMode(): Promise\<AudioRingMode>;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioVolumeGroupManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:setDeviceActive(deviceType: ActiveDeviceType, active: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:setDeviceActive(deviceType: ActiveDeviceType, active: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioRoutingManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:setDeviceActive(deviceType: ActiveDeviceType, active: boolean): Promise\<void>;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:setDeviceActive(deviceType: ActiveDeviceType, active: boolean): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioRoutingManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:isDeviceActive(deviceType: ActiveDeviceType, callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:isDeviceActive(deviceType: ActiveDeviceType, callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioRoutingManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:isDeviceActive(deviceType: ActiveDeviceType): Promise\<boolean>;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:isDeviceActive(deviceType: ActiveDeviceType): Promise\<boolean>;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioRoutingManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:on(type: 'ringerModeChange', callback: Callback\<AudioRingMode>): void;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:on(type: 'ringerModeChange', callback: Callback\<AudioRingMode>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioVolumeGroupManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:on(type: 'deviceChange', callback: Callback\<DeviceChangeAction>): void;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:on(type: 'deviceChange', callback: Callback\<DeviceChangeAction>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioRoutingManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioManager<br>方法 or 属性:off(type: 'deviceChange', callback?: Callback\<DeviceChangeAction>): void;<br>废弃版本:N/A|类名:AudioManager<br>方法 or 属性:off(type: 'deviceChange', callback?: Callback\<DeviceChangeAction>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.AudioRoutingManager|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:InterruptAction<br>废弃版本:N/A|类名:InterruptAction<br>废弃版本:9<br>代替接口:ohos.multimedia.audio.InterruptEvent |@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:InterruptAction<br>方法 or 属性:actionType: InterruptActionType;<br>废弃版本:N/A|类名:InterruptAction<br>方法 or 属性:actionType: InterruptActionType;<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:InterruptAction<br>方法 or 属性:type?: InterruptType;<br>废弃版本:N/A|类名:InterruptAction<br>方法 or 属性:type?: InterruptType;<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:InterruptAction<br>方法 or 属性:hint?: InterruptHint;<br>废弃版本:N/A|类名:InterruptAction<br>方法 or 属性:hint?: InterruptHint;<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:InterruptAction<br>方法 or 属性:activated?: boolean;<br>废弃版本:N/A|类名:InterruptAction<br>方法 or 属性:activated?: boolean;<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioInterrupt<br>废弃版本:N/A|类名:AudioInterrupt<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioInterrupt<br>方法 or 属性:streamUsage: StreamUsage;<br>废弃版本:N/A|类名:AudioInterrupt<br>方法 or 属性:streamUsage: StreamUsage;<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioInterrupt<br>方法 or 属性:contentType: ContentType;<br>废弃版本:N/A|类名:AudioInterrupt<br>方法 or 属性:contentType: ContentType;<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioInterrupt<br>方法 or 属性:pauseWhenDucked: boolean;<br>废弃版本:N/A|类名:AudioInterrupt<br>方法 or 属性:pauseWhenDucked: boolean;<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.audio.d.ts| +|废弃版本有变化|类名:AudioState<br>方法 or 属性:type AudioState = 'idle' \| 'playing' \| 'paused' \| 'stopped' \| 'error';<br>废弃版本:N/A|类名:AudioState<br>方法 or 属性:type AudioState = 'idle' \| 'playing' \| 'paused' \| 'stopped' \| 'error';<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayerState |@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioState<br>方法 or 属性:type AudioState = 'idle' \| 'playing' \| 'paused' \| 'stopped' \| 'error';<br>废弃版本:N/A|类名:AudioState<br>方法 or 属性:type AudioState = 'idle' \| 'playing' \| 'paused' \| 'stopped' \| 'error';<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayerState |@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioState<br>方法 or 属性:type AudioState = 'idle' \| 'playing' \| 'paused' \| 'stopped' \| 'error';<br>废弃版本:N/A|类名:AudioState<br>方法 or 属性:type AudioState = 'idle' \| 'playing' \| 'paused' \| 'stopped' \| 'error';<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayerState |@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioState<br>方法 or 属性:type AudioState = 'idle' \| 'playing' \| 'paused' \| 'stopped' \| 'error';<br>废弃版本:N/A|类名:AudioState<br>方法 or 属性:type AudioState = 'idle' \| 'playing' \| 'paused' \| 'stopped' \| 'error';<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayerState |@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioState<br>方法 or 属性:type AudioState = 'idle' \| 'playing' \| 'paused' \| 'stopped' \| 'error';<br>废弃版本:N/A|类名:AudioState<br>方法 or 属性:type AudioState = 'idle' \| 'playing' \| 'paused' \| 'stopped' \| 'error';<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayerState |@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayState<br>方法 or 属性:type VideoPlayState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';<br>废弃版本:N/A|类名:VideoPlayState<br>方法 or 属性:type VideoPlayState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayerState |@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayState<br>方法 or 属性:type VideoPlayState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';<br>废弃版本:N/A|类名:VideoPlayState<br>方法 or 属性:type VideoPlayState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayerState |@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayState<br>方法 or 属性:type VideoPlayState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';<br>废弃版本:N/A|类名:VideoPlayState<br>方法 or 属性:type VideoPlayState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayerState |@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayState<br>方法 or 属性:type VideoPlayState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';<br>废弃版本:N/A|类名:VideoPlayState<br>方法 or 属性:type VideoPlayState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayerState |@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayState<br>方法 or 属性:type VideoPlayState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';<br>废弃版本:N/A|类名:VideoPlayState<br>方法 or 属性:type VideoPlayState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayerState |@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayState<br>方法 or 属性:type VideoPlayState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';<br>废弃版本:N/A|类名:VideoPlayState<br>方法 or 属性:type VideoPlayState = 'idle' \| 'prepared' \| 'playing' \| 'paused' \| 'stopped' \| 'error';<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayerState |@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:media<br>方法 or 属性:function createAudioPlayer(): AudioPlayer;<br>废弃版本:N/A|类名:media<br>方法 or 属性:function createAudioPlayer(): AudioPlayer;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:media<br>方法 or 属性:function createAudioRecorder(): AudioRecorder;<br>废弃版本:N/A|类名:media<br>方法 or 属性:function createAudioRecorder(): AudioRecorder;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:media<br>方法 or 属性:function createVideoPlayer(callback: AsyncCallback\<VideoPlayer>): void;<br>废弃版本:N/A|类名:media<br>方法 or 属性:function createVideoPlayer(callback: AsyncCallback\<VideoPlayer>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:media<br>方法 or 属性:function createVideoPlayer() : Promise\<VideoPlayer>;<br>废弃版本:N/A|类名:media<br>方法 or 属性:function createVideoPlayer() : Promise\<VideoPlayer>;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioPlayer<br>废弃版本:N/A|类名:AudioPlayer<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer |@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioPlayer<br>方法 or 属性:play(): void;<br>废弃版本:N/A|类名:AudioPlayer<br>方法 or 属性:play(): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioPlayer<br>方法 or 属性:pause(): void;<br>废弃版本:N/A|类名:AudioPlayer<br>方法 or 属性:pause(): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioPlayer<br>方法 or 属性:stop(): void;<br>废弃版本:N/A|类名:AudioPlayer<br>方法 or 属性:stop(): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioPlayer<br>方法 or 属性:reset(): void;<br>废弃版本:N/A|类名:AudioPlayer<br>方法 or 属性:reset(): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioPlayer<br>方法 or 属性:seek(timeMs: number): void;<br>废弃版本:N/A|类名:AudioPlayer<br>方法 or 属性:seek(timeMs: number): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioPlayer<br>方法 or 属性:setVolume(vol: number): void;<br>废弃版本:N/A|类名:AudioPlayer<br>方法 or 属性:setVolume(vol: number): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioPlayer<br>方法 or 属性:release(): void;<br>废弃版本:N/A|类名:AudioPlayer<br>方法 or 属性:release(): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioPlayer<br>方法 or 属性:getTrackDescription(callback: AsyncCallback\<Array\<MediaDescription>>): void;<br>废弃版本:N/A|类名:AudioPlayer<br>方法 or 属性:getTrackDescription(callback: AsyncCallback\<Array\<MediaDescription>>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioPlayer<br>方法 or 属性:getTrackDescription() : Promise\<Array\<MediaDescription>>;<br>废弃版本:N/A|类名:AudioPlayer<br>方法 or 属性:getTrackDescription() : Promise\<Array\<MediaDescription>>;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioPlayer<br>方法 or 属性:on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void;<br>废弃版本:N/A|类名:AudioPlayer<br>方法 or 属性:on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioPlayer<br>方法 or 属性:src: string;<br>废弃版本:N/A|类名:AudioPlayer<br>方法 or 属性:src: string;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioPlayer<br>方法 or 属性:loop: boolean;<br>废弃版本:N/A|类名:AudioPlayer<br>方法 or 属性:loop: boolean;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioPlayer<br>方法 or 属性:readonly currentTime: number;<br>废弃版本:N/A|类名:AudioPlayer<br>方法 or 属性:readonly currentTime: number;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioPlayer<br>方法 or 属性:readonly duration: number;<br>废弃版本:N/A|类名:AudioPlayer<br>方法 or 属性:readonly duration: number;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioPlayer<br>方法 or 属性:readonly state: AudioState;<br>废弃版本:N/A|类名:AudioPlayer<br>方法 or 属性:readonly state: AudioState;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioPlayer<br>方法 or 属性:on(type: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange', callback: () => void): void;<br>废弃版本:N/A|类名:AudioPlayer<br>方法 or 属性:on(type: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange', callback: () => void): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioPlayer<br>方法 or 属性:on(type: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange', callback: () => void): void;<br>废弃版本:N/A|类名:AudioPlayer<br>方法 or 属性:on(type: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange', callback: () => void): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioPlayer<br>方法 or 属性:on(type: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange', callback: () => void): void;<br>废弃版本:N/A|类名:AudioPlayer<br>方法 or 属性:on(type: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange', callback: () => void): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioPlayer<br>方法 or 属性:on(type: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange', callback: () => void): void;<br>废弃版本:N/A|类名:AudioPlayer<br>方法 or 属性:on(type: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange', callback: () => void): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioPlayer<br>方法 or 属性:on(type: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange', callback: () => void): void;<br>废弃版本:N/A|类名:AudioPlayer<br>方法 or 属性:on(type: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange', callback: () => void): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioPlayer<br>方法 or 属性:on(type: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange', callback: () => void): void;<br>废弃版本:N/A|类名:AudioPlayer<br>方法 or 属性:on(type: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange', callback: () => void): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioPlayer<br>方法 or 属性:on(type: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange', callback: () => void): void;<br>废弃版本:N/A|类名:AudioPlayer<br>方法 or 属性:on(type: 'play' \| 'pause' \| 'stop' \| 'reset' \| 'dataLoad' \| 'finish' \| 'volumeChange', callback: () => void): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioPlayer<br>方法 or 属性:on(type: 'timeUpdate', callback: Callback\<number>): void;<br>废弃版本:N/A|类名:AudioPlayer<br>方法 or 属性:on(type: 'timeUpdate', callback: Callback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioPlayer<br>方法 or 属性:on(type: 'error', callback: ErrorCallback): void;<br>废弃版本:N/A|类名:AudioPlayer<br>方法 or 属性:on(type: 'error', callback: ErrorCallback): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioRecorderConfig<br>废弃版本:N/A|类名:AudioRecorderConfig<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVRecorderConfig |@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioRecorderConfig<br>方法 or 属性:audioEncodeBitRate?: number;<br>废弃版本:N/A|类名:AudioRecorderConfig<br>方法 or 属性:audioEncodeBitRate?: number;<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioRecorderConfig<br>方法 or 属性:audioSampleRate?: number;<br>废弃版本:N/A|类名:AudioRecorderConfig<br>方法 or 属性:audioSampleRate?: number;<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioRecorderConfig<br>方法 or 属性:numberOfChannels?: number;<br>废弃版本:N/A|类名:AudioRecorderConfig<br>方法 or 属性:numberOfChannels?: number;<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioRecorderConfig<br>方法 or 属性:uri: string;<br>废弃版本:N/A|类名:AudioRecorderConfig<br>方法 or 属性:uri: string;<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioRecorderConfig<br>方法 or 属性:location?: Location;<br>废弃版本:N/A|类名:AudioRecorderConfig<br>方法 or 属性:location?: Location;<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioRecorderConfig<br>方法 or 属性:audioEncoderMime?: CodecMimeType;<br>废弃版本:N/A|类名:AudioRecorderConfig<br>方法 or 属性:audioEncoderMime?: CodecMimeType;<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioRecorderConfig<br>方法 or 属性:fileFormat?: ContainerFormatType;<br>废弃版本:N/A|类名:AudioRecorderConfig<br>方法 or 属性:fileFormat?: ContainerFormatType;<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioRecorder<br>废弃版本:N/A|类名:AudioRecorder<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVRecorder |@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioRecorder<br>方法 or 属性:prepare(config: AudioRecorderConfig): void;<br>废弃版本:N/A|类名:AudioRecorder<br>方法 or 属性:prepare(config: AudioRecorderConfig): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVRecorder|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioRecorder<br>方法 or 属性:start(): void;<br>废弃版本:N/A|类名:AudioRecorder<br>方法 or 属性:start(): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVRecorder|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioRecorder<br>方法 or 属性:pause(): void;<br>废弃版本:N/A|类名:AudioRecorder<br>方法 or 属性:pause(): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVRecorder|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioRecorder<br>方法 or 属性:resume(): void;<br>废弃版本:N/A|类名:AudioRecorder<br>方法 or 属性:resume(): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVRecorder|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioRecorder<br>方法 or 属性:stop(): void;<br>废弃版本:N/A|类名:AudioRecorder<br>方法 or 属性:stop(): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVRecorder|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioRecorder<br>方法 or 属性:release(): void;<br>废弃版本:N/A|类名:AudioRecorder<br>方法 or 属性:release(): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVRecorder|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioRecorder<br>方法 or 属性:reset(): void;<br>废弃版本:N/A|类名:AudioRecorder<br>方法 or 属性:reset(): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVRecorder|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioRecorder<br>方法 or 属性:on(type: 'prepare' \| 'start' \| 'pause' \| 'resume' \| 'stop' \| 'release' \| 'reset', callback: () => void): void;<br>废弃版本:N/A|类名:AudioRecorder<br>方法 or 属性:on(type: 'prepare' \| 'start' \| 'pause' \| 'resume' \| 'stop' \| 'release' \| 'reset', callback: () => void): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVRecorder|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioRecorder<br>方法 or 属性:on(type: 'prepare' \| 'start' \| 'pause' \| 'resume' \| 'stop' \| 'release' \| 'reset', callback: () => void): void;<br>废弃版本:N/A|类名:AudioRecorder<br>方法 or 属性:on(type: 'prepare' \| 'start' \| 'pause' \| 'resume' \| 'stop' \| 'release' \| 'reset', callback: () => void): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVRecorder|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioRecorder<br>方法 or 属性:on(type: 'prepare' \| 'start' \| 'pause' \| 'resume' \| 'stop' \| 'release' \| 'reset', callback: () => void): void;<br>废弃版本:N/A|类名:AudioRecorder<br>方法 or 属性:on(type: 'prepare' \| 'start' \| 'pause' \| 'resume' \| 'stop' \| 'release' \| 'reset', callback: () => void): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVRecorder|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioRecorder<br>方法 or 属性:on(type: 'prepare' \| 'start' \| 'pause' \| 'resume' \| 'stop' \| 'release' \| 'reset', callback: () => void): void;<br>废弃版本:N/A|类名:AudioRecorder<br>方法 or 属性:on(type: 'prepare' \| 'start' \| 'pause' \| 'resume' \| 'stop' \| 'release' \| 'reset', callback: () => void): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVRecorder|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioRecorder<br>方法 or 属性:on(type: 'prepare' \| 'start' \| 'pause' \| 'resume' \| 'stop' \| 'release' \| 'reset', callback: () => void): void;<br>废弃版本:N/A|类名:AudioRecorder<br>方法 or 属性:on(type: 'prepare' \| 'start' \| 'pause' \| 'resume' \| 'stop' \| 'release' \| 'reset', callback: () => void): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVRecorder|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioRecorder<br>方法 or 属性:on(type: 'prepare' \| 'start' \| 'pause' \| 'resume' \| 'stop' \| 'release' \| 'reset', callback: () => void): void;<br>废弃版本:N/A|类名:AudioRecorder<br>方法 or 属性:on(type: 'prepare' \| 'start' \| 'pause' \| 'resume' \| 'stop' \| 'release' \| 'reset', callback: () => void): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVRecorder|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioRecorder<br>方法 or 属性:on(type: 'prepare' \| 'start' \| 'pause' \| 'resume' \| 'stop' \| 'release' \| 'reset', callback: () => void): void;<br>废弃版本:N/A|类名:AudioRecorder<br>方法 or 属性:on(type: 'prepare' \| 'start' \| 'pause' \| 'resume' \| 'stop' \| 'release' \| 'reset', callback: () => void): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVRecorder|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:AudioRecorder<br>方法 or 属性:on(type: 'error', callback: ErrorCallback): void;<br>废弃版本:N/A|类名:AudioRecorder<br>方法 or 属性:on(type: 'error', callback: ErrorCallback): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVRecorder|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>废弃版本:N/A|类名:VideoPlayer<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer |@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:setDisplaySurface(surfaceId: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:setDisplaySurface(surfaceId: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:setDisplaySurface(surfaceId: string): Promise\<void>;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:setDisplaySurface(surfaceId: string): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:prepare(callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:prepare(callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:prepare(): Promise\<void>;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:prepare(): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:play(callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:play(callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:play(): Promise\<void>;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:play(): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:pause(callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:pause(callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:pause(): Promise\<void>;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:pause(): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:stop(callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:stop(callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:stop(): Promise\<void>;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:stop(): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:reset(callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:reset(callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:reset(): Promise\<void>;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:reset(): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:seek(timeMs: number, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:seek(timeMs: number, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:seek(timeMs: number, mode:SeekMode, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:seek(timeMs: number, mode:SeekMode, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:seek(timeMs: number, mode?:SeekMode): Promise\<number>;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:seek(timeMs: number, mode?:SeekMode): Promise\<number>;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:setVolume(vol: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:setVolume(vol: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:setVolume(vol: number): Promise\<void>;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:setVolume(vol: number): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:release(callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:release(callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:release(): Promise\<void>;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:release(): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:getTrackDescription(callback: AsyncCallback\<Array\<MediaDescription>>): void;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:getTrackDescription(callback: AsyncCallback\<Array\<MediaDescription>>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:getTrackDescription() : Promise\<Array\<MediaDescription>>;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:getTrackDescription() : Promise\<Array\<MediaDescription>>;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:url: string;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:url: string;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:loop: boolean;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:loop: boolean;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:readonly currentTime: number;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:readonly currentTime: number;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:readonly duration: number;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:readonly duration: number;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:readonly state: VideoPlayState;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:readonly state: VideoPlayState;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:readonly width: number;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:readonly width: number;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:readonly height: number;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:readonly height: number;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:setSpeed(speed:number, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:setSpeed(speed:number, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:setSpeed(speed:number): Promise\<number>;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:setSpeed(speed:number): Promise\<number>;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:on(type: 'playbackCompleted', callback: Callback\<void>): void;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:on(type: 'playbackCompleted', callback: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:on(type: 'bufferingUpdate', callback: (infoType: BufferingInfoType, value: number) => void): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:on(type: 'startRenderFrame', callback: Callback\<void>): void;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:on(type: 'startRenderFrame', callback: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:on(type: 'videoSizeChanged', callback: (width: number, height: number) => void): void;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:on(type: 'videoSizeChanged', callback: (width: number, height: number) => void): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:VideoPlayer<br>方法 or 属性:on(type: 'error', callback: ErrorCallback): void;<br>废弃版本:N/A|类名:VideoPlayer<br>方法 or 属性:on(type: 'error', callback: ErrorCallback): void;<br>废弃版本:9<br>代替接口:ohos.multimedia.media/media.AVPlayer|@ohos.multimedia.media.d.ts| +|废弃版本有变化|类名:mediaLibrary<br>废弃版本:N/A|类名:mediaLibrary<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:mediaLibrary<br>方法 or 属性:function getMediaLibrary(): MediaLibrary;<br>废弃版本:N/A|类名:mediaLibrary<br>方法 or 属性:function getMediaLibrary(): MediaLibrary;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:mediaLibrary<br>方法 or 属性:function getMediaLibrary(context: Context): MediaLibrary;<br>废弃版本:N/A|类名:mediaLibrary<br>方法 or 属性:function getMediaLibrary(context: Context): MediaLibrary;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaType<br>废弃版本:N/A|类名:MediaType<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaType<br>方法 or 属性:FILE = 0<br>废弃版本:N/A|类名:MediaType<br>方法 or 属性:FILE = 0<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaType<br>方法 or 属性:IMAGE<br>废弃版本:N/A|类名:MediaType<br>方法 or 属性:IMAGE<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaType<br>方法 or 属性:VIDEO<br>废弃版本:N/A|类名:MediaType<br>方法 or 属性:VIDEO<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaType<br>方法 or 属性:AUDIO<br>废弃版本:N/A|类名:MediaType<br>方法 or 属性:AUDIO<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaAssetOption<br>废弃版本:N/A|类名:MediaAssetOption<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaAssetOption<br>方法 or 属性:src: string;<br>废弃版本:N/A|类名:MediaAssetOption<br>方法 or 属性:src: string;<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaAssetOption<br>方法 or 属性:mimeType: string;<br>废弃版本:N/A|类名:MediaAssetOption<br>方法 or 属性:mimeType: string;<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaAssetOption<br>方法 or 属性:relativePath?: string;<br>废弃版本:N/A|类名:MediaAssetOption<br>方法 or 属性:relativePath?: string;<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaSelectOption<br>废弃版本:N/A|类名:MediaSelectOption<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaSelectOption<br>方法 or 属性:type: 'image' \| 'video' \| 'media';<br>废弃版本:N/A|类名:MediaSelectOption<br>方法 or 属性:type: 'image' \| 'video' \| 'media';<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaSelectOption<br>方法 or 属性:count: number;<br>废弃版本:N/A|类名:MediaSelectOption<br>方法 or 属性:count: number;<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>废弃版本:N/A|类名:FileAsset<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly id: number;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly id: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly uri: string;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly uri: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly mimeType: string;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly mimeType: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly mediaType: MediaType;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly mediaType: MediaType;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:displayName: string;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:displayName: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:title: string;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:title: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:relativePath: string;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:relativePath: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly parent: number;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly parent: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly size: number;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly size: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly dateAdded: number;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly dateAdded: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly dateModified: number;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly dateModified: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly dateTaken: number;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly dateTaken: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly artist: string;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly artist: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly audioAlbum: string;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly audioAlbum: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly width: number;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly width: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly height: number;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly height: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:orientation: number;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:orientation: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly duration: number;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly duration: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly albumId: number;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly albumId: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly albumUri: string;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly albumUri: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:readonly albumName: string;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:readonly albumName: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:isDirectory(callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:isDirectory(callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:isDirectory():Promise\<boolean>;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:isDirectory():Promise\<boolean>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:commitModify(callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:commitModify(callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:commitModify(): Promise\<void>;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:commitModify(): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:open(mode: string, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:open(mode: string, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:open(mode: string): Promise\<number>;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:open(mode: string): Promise\<number>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:close(fd: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:close(fd: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:close(fd: number): Promise\<void>;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:close(fd: number): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:getThumbnail(callback: AsyncCallback\<image.PixelMap>): void;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:getThumbnail(callback: AsyncCallback\<image.PixelMap>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:getThumbnail(size: Size, callback: AsyncCallback\<image.PixelMap>): void;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:getThumbnail(size: Size, callback: AsyncCallback\<image.PixelMap>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:getThumbnail(size?: Size): Promise\<image.PixelMap>;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:getThumbnail(size?: Size): Promise\<image.PixelMap>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:favorite(isFavorite: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:favorite(isFavorite: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:favorite(isFavorite: boolean): Promise\<void>;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:favorite(isFavorite: boolean): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:isFavorite(callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:isFavorite(callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:isFavorite():Promise\<boolean>;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:isFavorite():Promise\<boolean>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:trash(isTrash: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:trash(isTrash: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:trash(isTrash: boolean): Promise\<void>;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:trash(isTrash: boolean): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:isTrash(callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:isTrash(callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileAsset<br>方法 or 属性:isTrash():Promise\<boolean>;<br>废弃版本:N/A|类名:FileAsset<br>方法 or 属性:isTrash():Promise\<boolean>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>废弃版本:N/A|类名:FileKey<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:ID = "file_id"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:ID = "file_id"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:RELATIVE_PATH = "relative_path"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:RELATIVE_PATH = "relative_path"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:DISPLAY_NAME = "display_name"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:DISPLAY_NAME = "display_name"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:PARENT = "parent"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:PARENT = "parent"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:MIME_TYPE = "mime_type"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:MIME_TYPE = "mime_type"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:MEDIA_TYPE = "media_type"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:MEDIA_TYPE = "media_type"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:SIZE = "size"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:SIZE = "size"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:DATE_ADDED = "date_added"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:DATE_ADDED = "date_added"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:DATE_MODIFIED = "date_modified"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:DATE_MODIFIED = "date_modified"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:DATE_TAKEN = "date_taken"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:DATE_TAKEN = "date_taken"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:TITLE = "title"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:TITLE = "title"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:ARTIST = "artist"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:ARTIST = "artist"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:AUDIOALBUM = "audio_album"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:AUDIOALBUM = "audio_album"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:DURATION = "duration"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:DURATION = "duration"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:WIDTH = "width"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:WIDTH = "width"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:HEIGHT = "height"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:HEIGHT = "height"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:ORIENTATION = "orientation"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:ORIENTATION = "orientation"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:ALBUM_ID = "bucket_id"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:ALBUM_ID = "bucket_id"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FileKey<br>方法 or 属性:ALBUM_NAME = "bucket_display_name"<br>废弃版本:N/A|类名:FileKey<br>方法 or 属性:ALBUM_NAME = "bucket_display_name"<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaFetchOptions<br>废弃版本:N/A|类名:MediaFetchOptions<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaFetchOptions<br>方法 or 属性:selections: string;<br>废弃版本:N/A|类名:MediaFetchOptions<br>方法 or 属性:selections: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaFetchOptions<br>方法 or 属性:selectionArgs: Array\<string>;<br>废弃版本:N/A|类名:MediaFetchOptions<br>方法 or 属性:selectionArgs: Array\<string>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaFetchOptions<br>方法 or 属性:order?: string;<br>废弃版本:N/A|类名:MediaFetchOptions<br>方法 or 属性:order?: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaFetchOptions<br>方法 or 属性:uri?: string;<br>废弃版本:N/A|类名:MediaFetchOptions<br>方法 or 属性:uri?: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaFetchOptions<br>方法 or 属性:networkId?: string;<br>废弃版本:N/A|类名:MediaFetchOptions<br>方法 or 属性:networkId?: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaFetchOptions<br>方法 or 属性:extendArgs?: string;<br>废弃版本:N/A|类名:MediaFetchOptions<br>方法 or 属性:extendArgs?: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FetchFileResult<br>废弃版本:N/A|类名:FetchFileResult<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FetchFileResult<br>方法 or 属性:getCount(): number;<br>废弃版本:N/A|类名:FetchFileResult<br>方法 or 属性:getCount(): number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FetchFileResult<br>方法 or 属性:isAfterLast(): boolean;<br>废弃版本:N/A|类名:FetchFileResult<br>方法 or 属性:isAfterLast(): boolean;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FetchFileResult<br>方法 or 属性:close(): void;<br>废弃版本:N/A|类名:FetchFileResult<br>方法 or 属性:close(): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FetchFileResult<br>方法 or 属性:getFirstObject(callback: AsyncCallback\<FileAsset>): void;<br>废弃版本:N/A|类名:FetchFileResult<br>方法 or 属性:getFirstObject(callback: AsyncCallback\<FileAsset>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FetchFileResult<br>方法 or 属性:getFirstObject(): Promise\<FileAsset>;<br>废弃版本:N/A|类名:FetchFileResult<br>方法 or 属性:getFirstObject(): Promise\<FileAsset>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FetchFileResult<br>方法 or 属性:getNextObject(callback: AsyncCallback\<FileAsset>): void;<br>废弃版本:N/A|类名:FetchFileResult<br>方法 or 属性:getNextObject(callback: AsyncCallback\<FileAsset>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FetchFileResult<br>方法 or 属性:getNextObject(): Promise\<FileAsset>;<br>废弃版本:N/A|类名:FetchFileResult<br>方法 or 属性:getNextObject(): Promise\<FileAsset>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FetchFileResult<br>方法 or 属性:getLastObject(callback: AsyncCallback\<FileAsset>): void;<br>废弃版本:N/A|类名:FetchFileResult<br>方法 or 属性:getLastObject(callback: AsyncCallback\<FileAsset>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FetchFileResult<br>方法 or 属性:getLastObject(): Promise\<FileAsset>;<br>废弃版本:N/A|类名:FetchFileResult<br>方法 or 属性:getLastObject(): Promise\<FileAsset>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FetchFileResult<br>方法 or 属性:getPositionObject(index: number, callback: AsyncCallback\<FileAsset>): void;<br>废弃版本:N/A|类名:FetchFileResult<br>方法 or 属性:getPositionObject(index: number, callback: AsyncCallback\<FileAsset>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FetchFileResult<br>方法 or 属性:getPositionObject(index: number): Promise\<FileAsset>;<br>废弃版本:N/A|类名:FetchFileResult<br>方法 or 属性:getPositionObject(index: number): Promise\<FileAsset>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FetchFileResult<br>方法 or 属性:getAllObject(callback: AsyncCallback\<Array\<FileAsset>>): void;<br>废弃版本:N/A|类名:FetchFileResult<br>方法 or 属性:getAllObject(callback: AsyncCallback\<Array\<FileAsset>>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:FetchFileResult<br>方法 or 属性:getAllObject(): Promise\<Array\<FileAsset>>;<br>废弃版本:N/A|类名:FetchFileResult<br>方法 or 属性:getAllObject(): Promise\<Array\<FileAsset>>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Album<br>废弃版本:N/A|类名:Album<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Album<br>方法 or 属性:readonly albumId: number;<br>废弃版本:N/A|类名:Album<br>方法 or 属性:readonly albumId: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Album<br>方法 or 属性:albumName: string;<br>废弃版本:N/A|类名:Album<br>方法 or 属性:albumName: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Album<br>方法 or 属性:readonly albumUri: string;<br>废弃版本:N/A|类名:Album<br>方法 or 属性:readonly albumUri: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Album<br>方法 or 属性:readonly dateModified: number;<br>废弃版本:N/A|类名:Album<br>方法 or 属性:readonly dateModified: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Album<br>方法 or 属性:readonly count: number;<br>废弃版本:N/A|类名:Album<br>方法 or 属性:readonly count: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Album<br>方法 or 属性:readonly relativePath: string;<br>废弃版本:N/A|类名:Album<br>方法 or 属性:readonly relativePath: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Album<br>方法 or 属性:readonly coverUri: string;<br>废弃版本:N/A|类名:Album<br>方法 or 属性:readonly coverUri: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Album<br>方法 or 属性:commitModify(callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:Album<br>方法 or 属性:commitModify(callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Album<br>方法 or 属性:commitModify(): Promise\<void>;<br>废弃版本:N/A|类名:Album<br>方法 or 属性:commitModify(): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Album<br>方法 or 属性:getFileAssets(callback: AsyncCallback\<FetchFileResult>): void;<br>废弃版本:N/A|类名:Album<br>方法 or 属性:getFileAssets(callback: AsyncCallback\<FetchFileResult>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Album<br>方法 or 属性:getFileAssets(options: MediaFetchOptions, callback: AsyncCallback\<FetchFileResult>): void;<br>废弃版本:N/A|类名:Album<br>方法 or 属性:getFileAssets(options: MediaFetchOptions, callback: AsyncCallback\<FetchFileResult>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Album<br>方法 or 属性:getFileAssets(options?: MediaFetchOptions): Promise\<FetchFileResult>;<br>废弃版本:N/A|类名:Album<br>方法 or 属性:getFileAssets(options?: MediaFetchOptions): Promise\<FetchFileResult>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:DirectoryType<br>废弃版本:N/A|类名:DirectoryType<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:DirectoryType<br>方法 or 属性:DIR_CAMERA = 0<br>废弃版本:N/A|类名:DirectoryType<br>方法 or 属性:DIR_CAMERA = 0<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:DirectoryType<br>方法 or 属性:DIR_VIDEO<br>废弃版本:N/A|类名:DirectoryType<br>方法 or 属性:DIR_VIDEO<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:DirectoryType<br>方法 or 属性:DIR_IMAGE<br>废弃版本:N/A|类名:DirectoryType<br>方法 or 属性:DIR_IMAGE<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:DirectoryType<br>方法 or 属性:DIR_AUDIO<br>废弃版本:N/A|类名:DirectoryType<br>方法 or 属性:DIR_AUDIO<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:DirectoryType<br>方法 or 属性:DIR_DOCUMENTS<br>废弃版本:N/A|类名:DirectoryType<br>方法 or 属性:DIR_DOCUMENTS<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:DirectoryType<br>方法 or 属性:DIR_DOWNLOAD<br>废弃版本:N/A|类名:DirectoryType<br>方法 or 属性:DIR_DOWNLOAD<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>废弃版本:N/A|类名:MediaLibrary<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:getPublicDirectory(type: DirectoryType, callback: AsyncCallback\<string>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:getPublicDirectory(type: DirectoryType, callback: AsyncCallback\<string>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:getPublicDirectory(type: DirectoryType): Promise\<string>;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:getPublicDirectory(type: DirectoryType): Promise\<string>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:getFileAssets(options: MediaFetchOptions, callback: AsyncCallback\<FetchFileResult>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:getFileAssets(options: MediaFetchOptions, callback: AsyncCallback\<FetchFileResult>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:getFileAssets(options: MediaFetchOptions): Promise\<FetchFileResult>;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:getFileAssets(options: MediaFetchOptions): Promise\<FetchFileResult>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:on(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:off(type: 'deviceChange'\|'albumChange'\|'imageChange'\|'audioChange'\|'videoChange'\|'fileChange'\|'remoteFileChange', callback?: Callback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:createAsset(mediaType: MediaType, displayName: string, relativePath: string, callback: AsyncCallback\<FileAsset>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:createAsset(mediaType: MediaType, displayName: string, relativePath: string, callback: AsyncCallback\<FileAsset>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:createAsset(mediaType: MediaType, displayName: string, relativePath: string): Promise\<FileAsset>;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:createAsset(mediaType: MediaType, displayName: string, relativePath: string): Promise\<FileAsset>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:deleteAsset(uri: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:deleteAsset(uri: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:deleteAsset(uri: string): Promise\<void>;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:deleteAsset(uri: string): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:getAlbums(options: MediaFetchOptions, callback: AsyncCallback\<Array\<Album>>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:getAlbums(options: MediaFetchOptions, callback: AsyncCallback\<Array\<Album>>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:getAlbums(options: MediaFetchOptions): Promise\<Array\<Album>>;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:getAlbums(options: MediaFetchOptions): Promise\<Array\<Album>>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:storeMediaAsset(option: MediaAssetOption, callback: AsyncCallback\<string>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:storeMediaAsset(option: MediaAssetOption, callback: AsyncCallback\<string>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:storeMediaAsset(option: MediaAssetOption): Promise\<string>;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:storeMediaAsset(option: MediaAssetOption): Promise\<string>;<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:startImagePreview(images: Array\<string>, index: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:startImagePreview(images: Array\<string>, index: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:startImagePreview(images: Array\<string>, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:startImagePreview(images: Array\<string>, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:startImagePreview(images: Array\<string>, index?: number): Promise\<void>;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:startImagePreview(images: Array\<string>, index?: number): Promise\<void>;<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:startMediaSelect(option: MediaSelectOption, callback: AsyncCallback\<Array\<string>>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:startMediaSelect(option: MediaSelectOption, callback: AsyncCallback\<Array\<string>>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:startMediaSelect(option: MediaSelectOption): Promise\<Array\<string>>;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:startMediaSelect(option: MediaSelectOption): Promise\<Array\<string>>;<br>废弃版本:9<br>代替接口:N/A|@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:getActivePeers(callback: AsyncCallback\<Array\<PeerInfo>>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:getActivePeers(callback: AsyncCallback\<Array\<PeerInfo>>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:getActivePeers(): Promise\<Array\<PeerInfo>>;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:getActivePeers(): Promise\<Array\<PeerInfo>>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:getAllPeers(callback: AsyncCallback\<Array\<PeerInfo>>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:getAllPeers(callback: AsyncCallback\<Array\<PeerInfo>>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:getAllPeers(): Promise\<Array\<PeerInfo>>;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:getAllPeers(): Promise\<Array\<PeerInfo>>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:release(callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:release(callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:MediaLibrary<br>方法 or 属性:release(): Promise\<void>;<br>废弃版本:N/A|类名:MediaLibrary<br>方法 or 属性:release(): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Size<br>废弃版本:N/A|类名:Size<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Size<br>方法 or 属性:width: number;<br>废弃版本:N/A|类名:Size<br>方法 or 属性:width: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:Size<br>方法 or 属性:height: number;<br>废弃版本:N/A|类名:Size<br>方法 or 属性:height: number;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:PeerInfo<br>废弃版本:N/A|类名:PeerInfo<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:PeerInfo<br>方法 or 属性:readonly deviceName: string;<br>废弃版本:N/A|类名:PeerInfo<br>方法 or 属性:readonly deviceName: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:PeerInfo<br>方法 or 属性:readonly networkId: string;<br>废弃版本:N/A|类名:PeerInfo<br>方法 or 属性:readonly networkId: string;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:PeerInfo<br>方法 or 属性:readonly deviceType: DeviceType;<br>废弃版本:N/A|类名:PeerInfo<br>方法 or 属性:readonly deviceType: DeviceType;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:PeerInfo<br>方法 or 属性:readonly isOnline: boolean;<br>废弃版本:N/A|类名:PeerInfo<br>方法 or 属性:readonly isOnline: boolean;<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:DeviceType<br>废弃版本:N/A|类名:DeviceType<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:DeviceType<br>方法 or 属性:TYPE_UNKNOWN = 0<br>废弃版本:N/A|类名:DeviceType<br>方法 or 属性:TYPE_UNKNOWN = 0<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:DeviceType<br>方法 or 属性:TYPE_LAPTOP<br>废弃版本:N/A|类名:DeviceType<br>方法 or 属性:TYPE_LAPTOP<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:DeviceType<br>方法 or 属性:TYPE_PHONE<br>废弃版本:N/A|类名:DeviceType<br>方法 or 属性:TYPE_PHONE<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:DeviceType<br>方法 or 属性:TYPE_TABLET<br>废弃版本:N/A|类名:DeviceType<br>方法 or 属性:TYPE_TABLET<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:DeviceType<br>方法 or 属性:TYPE_WATCH<br>废弃版本:N/A|类名:DeviceType<br>方法 or 属性:TYPE_WATCH<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:DeviceType<br>方法 or 属性:TYPE_CAR<br>废弃版本:N/A|类名:DeviceType<br>方法 or 属性:TYPE_CAR<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|废弃版本有变化|类名:DeviceType<br>方法 or 属性:TYPE_TV<br>废弃版本:N/A|类名:DeviceType<br>方法 or 属性:TYPE_TV<br>废弃版本:9<br>代替接口:ohos.file.picker |@ohos.multimedia.mediaLibrary.d.ts| +|起始版本有变化|类名:AudioManager<br>方法 or 属性:on(type: 'volumeChange', callback: Callback\<VolumeEvent>): void;<br>起始版本:8|类名:AudioManager<br>方法 or 属性:on(type: 'volumeChange', callback: Callback\<VolumeEvent>): void;<br>起始版本:9|@ohos.multimedia.audio.d.ts| +|起始版本有变化|类名:VolumeEvent<br>起始版本:8|类名:VolumeEvent<br>起始版本:9|@ohos.multimedia.audio.d.ts| +|起始版本有变化|类名:VolumeEvent<br>方法 or 属性:volumeType: AudioVolumeType;<br>起始版本:8|类名:VolumeEvent<br>方法 or 属性:volumeType: AudioVolumeType;<br>起始版本:9|@ohos.multimedia.audio.d.ts| +|起始版本有变化|类名:VolumeEvent<br>方法 or 属性:volume: number;<br>起始版本:8|类名:VolumeEvent<br>方法 or 属性:volume: number;<br>起始版本:9|@ohos.multimedia.audio.d.ts| +|起始版本有变化|类名:VolumeEvent<br>方法 or 属性:updateUi: boolean;<br>起始版本:8|类名:VolumeEvent<br>方法 or 属性:updateUi: boolean;<br>起始版本:9|@ohos.multimedia.audio.d.ts| +|权限有变化|类名:AudioPlayer<br>方法 or 属性:src: string;<br>权限:ohos.permission.READ_MEDIA|类名:AudioPlayer<br>方法 or 属性:src: string;<br>权限:ohos.permission.READ_MEDIA or ohos.permission.INTERNET|@ohos.multimedia.media.d.ts| +|删除(权限)|类名:VideoPlayer<br>方法 or 属性:prepare(callback: AsyncCallback\<void>): void;<br>权限:ohos.permission.MICROPHONE|类名:VideoPlayer<br>方法 or 属性:prepare(callback: AsyncCallback\<void>): void;<br>权限:N/A|@ohos.multimedia.media.d.ts| +|删除(权限)|类名:VideoPlayer<br>方法 or 属性:prepare(): Promise\<void>;<br>权限:ohos.permission.MICROPHONE|类名:VideoPlayer<br>方法 or 属性:prepare(): Promise\<void>;<br>权限:N/A|@ohos.multimedia.media.d.ts| +|函数有变化|类名:AudioRenderer<br>方法 or 属性:on(type: "markReach", frame: number, callback: (position: number) => {}): void;<br>|类名:AudioRenderer<br>方法 or 属性:on(type: "markReach", frame: number, callback: Callback\<number>): void;<br>|@ohos.multimedia.audio.d.ts| +|函数有变化|类名:AudioRenderer<br>方法 or 属性:on(type: "periodReach", frame: number, callback: (position: number) => {}): void;<br>|类名:AudioRenderer<br>方法 or 属性:on(type: "periodReach", frame: number, callback: Callback\<number>): void;<br>|@ohos.multimedia.audio.d.ts| +|函数有变化|类名:AudioCapturer<br>方法 or 属性:on(type: "markReach", frame: number, callback: (position: number) => {}): void;<br>|类名:AudioCapturer<br>方法 or 属性:on(type: "markReach", frame: number, callback: Callback\<number>): void;<br>|@ohos.multimedia.audio.d.ts| +|函数有变化|类名:AudioCapturer<br>方法 or 属性:on(type: "periodReach", frame: number, callback: (position: number) => {}): void;<br>|类名:AudioCapturer<br>方法 or 属性:on(type: "periodReach", frame: number, callback: Callback\<number>): void;<br>|@ohos.multimedia.audio.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-notification.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-notification.md new file mode 100644 index 0000000000000000000000000000000000000000..8ca083cc1efa12eed738f96ab538ee814f9dcfab --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-notification.md @@ -0,0 +1,559 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.commonEventManager<br>类名: commonEventManager|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: commonEventManager<br>方法 or 属性: function publish(event: string, callback: AsyncCallback\<void>): void;|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: commonEventManager<br>方法 or 属性: function publish(event: string, options: CommonEventPublishData, callback: AsyncCallback\<void>): void;|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: commonEventManager<br>方法 or 属性: function publishAsUser(event: string, userId: number, callback: AsyncCallback\<void>): void;|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: commonEventManager<br>方法 or 属性: function publishAsUser(event: string, userId: number, options: CommonEventPublishData, callback: AsyncCallback\<void>): void;|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: commonEventManager<br>方法 or 属性: function createSubscriber(subscribeInfo: CommonEventSubscribeInfo, callback: AsyncCallback\<CommonEventSubscriber>): void;|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: commonEventManager<br>方法 or 属性: function createSubscriber(subscribeInfo: CommonEventSubscribeInfo): Promise\<CommonEventSubscriber>;|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: commonEventManager<br>方法 or 属性: function subscribe(subscriber: CommonEventSubscriber, callback: AsyncCallback\<CommonEventData>): void;|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: commonEventManager<br>方法 or 属性: function unsubscribe(subscriber: CommonEventSubscriber, callback?: AsyncCallback\<void>): void;|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BOOT_COMPLETED = "usual.event.BOOT_COMPLETED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_LOCKED_BOOT_COMPLETED = "usual.event.LOCKED_BOOT_COMPLETED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_SHUTDOWN = "usual.event.SHUTDOWN"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BATTERY_CHANGED = "usual.event.BATTERY_CHANGED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BATTERY_LOW = "usual.event.BATTERY_LOW"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BATTERY_OKAY = "usual.event.BATTERY_OKAY"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_POWER_CONNECTED = "usual.event.POWER_CONNECTED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_POWER_DISCONNECTED = "usual.event.POWER_DISCONNECTED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_SCREEN_OFF = "usual.event.SCREEN_OFF"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_SCREEN_ON = "usual.event.SCREEN_ON"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_THERMAL_LEVEL_CHANGED = "usual.event.THERMAL_LEVEL_CHANGED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_USER_PRESENT = "usual.event.USER_PRESENT"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_TIME_TICK = "usual.event.TIME_TICK"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_TIME_CHANGED = "usual.event.TIME_CHANGED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_DATE_CHANGED = "usual.event.DATE_CHANGED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_TIMEZONE_CHANGED = "usual.event.TIMEZONE_CHANGED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_CLOSE_SYSTEM_DIALOGS = "usual.event.CLOSE_SYSTEM_DIALOGS"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_PACKAGE_ADDED = "usual.event.PACKAGE_ADDED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_PACKAGE_REPLACED = "usual.event.PACKAGE_REPLACED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_MY_PACKAGE_REPLACED = "usual.event.MY_PACKAGE_REPLACED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_PACKAGE_REMOVED = "usual.event.PACKAGE_REMOVED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BUNDLE_REMOVED = "usual.event.BUNDLE_REMOVED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_PACKAGE_FULLY_REMOVED = "usual.event.PACKAGE_FULLY_REMOVED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_PACKAGE_CHANGED = "usual.event.PACKAGE_CHANGED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_PACKAGE_RESTARTED = "usual.event.PACKAGE_RESTARTED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_PACKAGE_DATA_CLEARED = "usual.event.PACKAGE_DATA_CLEARED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_PACKAGE_CACHE_CLEARED = "usual.event.PACKAGE_CACHE_CLEARED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_PACKAGES_SUSPENDED = "usual.event.PACKAGES_SUSPENDED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_PACKAGES_UNSUSPENDED = "usual.event.PACKAGES_UNSUSPENDED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_MY_PACKAGE_SUSPENDED = "usual.event.MY_PACKAGE_SUSPENDED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_MY_PACKAGE_UNSUSPENDED = "usual.event.MY_PACKAGE_UNSUSPENDED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_UID_REMOVED = "usual.event.UID_REMOVED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_PACKAGE_FIRST_LAUNCH = "usual.event.PACKAGE_FIRST_LAUNCH"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_PACKAGE_NEEDS_VERIFICATION =<br> "usual.event.PACKAGE_NEEDS_VERIFICATION"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_PACKAGE_VERIFIED = "usual.event.PACKAGE_VERIFIED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_EXTERNAL_APPLICATIONS_AVAILABLE =<br> "usual.event.EXTERNAL_APPLICATIONS_AVAILABLE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_EXTERNAL_APPLICATIONS_UNAVAILABLE =<br> "usual.event.EXTERNAL_APPLICATIONS_UNAVAILABLE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_CONFIGURATION_CHANGED = "usual.event.CONFIGURATION_CHANGED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_LOCALE_CHANGED = "usual.event.LOCALE_CHANGED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_MANAGE_PACKAGE_STORAGE = "usual.event.MANAGE_PACKAGE_STORAGE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_DRIVE_MODE = "common.event.DRIVE_MODE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_HOME_MODE = "common.event.HOME_MODE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_OFFICE_MODE = "common.event.OFFICE_MODE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_USER_STARTED = "usual.event.USER_STARTED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_USER_BACKGROUND = "usual.event.USER_BACKGROUND"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_USER_FOREGROUND = "usual.event.USER_FOREGROUND"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_USER_SWITCHED = "usual.event.USER_SWITCHED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_USER_STARTING = "usual.event.USER_STARTING"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_USER_UNLOCKED = "usual.event.USER_UNLOCKED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_USER_STOPPING = "usual.event.USER_STOPPING"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_USER_STOPPED = "usual.event.USER_STOPPED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_DISTRIBUTED_ACCOUNT_LOGIN = "common.event.DISTRIBUTED_ACCOUNT_LOGIN"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_DISTRIBUTED_ACCOUNT_LOGOUT = "common.event.DISTRIBUTED_ACCOUNT_LOGOUT"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_DISTRIBUTED_ACCOUNT_TOKEN_INVALID = "common.event.DISTRIBUTED_ACCOUNT_TOKEN_INVALID"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_DISTRIBUTED_ACCOUNT_LOGOFF = "common.event.DISTRIBUTED_ACCOUNT_LOGOFF"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_WIFI_POWER_STATE = "usual.event.wifi.POWER_STATE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_WIFI_SCAN_FINISHED = "usual.event.wifi.SCAN_FINISHED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_WIFI_RSSI_VALUE = "usual.event.wifi.RSSI_VALUE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_WIFI_CONN_STATE = "usual.event.wifi.CONN_STATE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_WIFI_HOTSPOT_STATE = "usual.event.wifi.HOTSPOT_STATE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_WIFI_AP_STA_JOIN = "usual.event.wifi.WIFI_HS_STA_JOIN"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_WIFI_AP_STA_LEAVE = "usual.event.wifi.WIFI_HS_STA_LEAVE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_WIFI_MPLINK_STATE_CHANGE = "usual.event.wifi.mplink.STATE_CHANGE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_WIFI_P2P_CONN_STATE = "usual.event.wifi.p2p.CONN_STATE_CHANGE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_WIFI_P2P_STATE_CHANGED = "usual.event.wifi.p2p.STATE_CHANGE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_WIFI_P2P_PEERS_STATE_CHANGED =<br> "usual.event.wifi.p2p.DEVICES_CHANGE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_WIFI_P2P_PEERS_DISCOVERY_STATE_CHANGED =<br> "usual.event.wifi.p2p.PEER_DISCOVERY_STATE_CHANGE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_WIFI_P2P_CURRENT_DEVICE_STATE_CHANGED =<br> "usual.event.wifi.p2p.CURRENT_DEVICE_CHANGE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_WIFI_P2P_GROUP_STATE_CHANGED =<br> "usual.event.wifi.p2p.GROUP_STATE_CHANGED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_CONNECT_STATE_UPDATE =<br> "usual.event.bluetooth.handsfree.ag.CONNECT_STATE_UPDATE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_CURRENT_DEVICE_UPDATE =<br> "usual.event.bluetooth.handsfree.ag.CURRENT_DEVICE_UPDATE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_HANDSFREE_AG_AUDIO_STATE_UPDATE =<br> "usual.event.bluetooth.handsfree.ag.AUDIO_STATE_UPDATE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CONNECT_STATE_UPDATE =<br> "usual.event.bluetooth.a2dpsource.CONNECT_STATE_UPDATE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CURRENT_DEVICE_UPDATE =<br> "usual.event.bluetooth.a2dpsource.CURRENT_DEVICE_UPDATE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_A2DPSOURCE_PLAYING_STATE_UPDATE =<br> "usual.event.bluetooth.a2dpsource.PLAYING_STATE_UPDATE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_A2DPSOURCE_AVRCP_CONNECT_STATE_UPDATE =<br> "usual.event.bluetooth.a2dpsource.AVRCP_CONNECT_STATE_UPDATE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_A2DPSOURCE_CODEC_VALUE_UPDATE =<br> "usual.event.bluetooth.a2dpsource.CODEC_VALUE_UPDATE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_DISCOVERED =<br> "usual.event.bluetooth.remotedevice.DISCOVERED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CLASS_VALUE_UPDATE =<br> "usual.event.bluetooth.remotedevice.CLASS_VALUE_UPDATE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_CONNECTED =<br> "usual.event.bluetooth.remotedevice.ACL_CONNECTED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_ACL_DISCONNECTED =<br> "usual.event.bluetooth.remotedevice.ACL_DISCONNECTED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_NAME_UPDATE =<br> "usual.event.bluetooth.remotedevice.NAME_UPDATE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIR_STATE =<br> "usual.event.bluetooth.remotedevice.PAIR_STATE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_BATTERY_VALUE_UPDATE =<br> "usual.event.bluetooth.remotedevice.BATTERY_VALUE_UPDATE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_SDP_RESULT =<br> "usual.event.bluetooth.remotedevice.SDP_RESULT"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_UUID_VALUE =<br> "usual.event.bluetooth.remotedevice.UUID_VALUE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIRING_REQ =<br> "usual.event.bluetooth.remotedevice.PAIRING_REQ"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_PAIRING_CANCEL =<br> "usual.event.bluetooth.remotedevice.PAIRING_CANCEL"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_REQ =<br> "usual.event.bluetooth.remotedevice.CONNECT_REQ"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_REPLY =<br> "usual.event.bluetooth.remotedevice.CONNECT_REPLY"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_REMOTEDEVICE_CONNECT_CANCEL =<br> "usual.event.bluetooth.remotedevice.CONNECT_CANCEL"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_CONNECT_STATE_UPDATE =<br> "usual.event.bluetooth.handsfreeunit.CONNECT_STATE_UPDATE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AUDIO_STATE_UPDATE =<br> "usual.event.bluetooth.handsfreeunit.AUDIO_STATE_UPDATE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AG_COMMON_EVENT =<br> "usual.event.bluetooth.handsfreeunit.AG_COMMON_EVENT"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_HANDSFREEUNIT_AG_CALL_STATE_UPDATE =<br> "usual.event.bluetooth.handsfreeunit.AG_CALL_STATE_UPDATE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_HOST_STATE_UPDATE =<br> "usual.event.bluetooth.host.STATE_UPDATE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_HOST_REQ_DISCOVERABLE =<br> "usual.event.bluetooth.host.REQ_DISCOVERABLE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_HOST_REQ_ENABLE = "usual.event.bluetooth.host.REQ_ENABLE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_HOST_REQ_DISABLE =<br> "usual.event.bluetooth.host.REQ_DISABLE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_HOST_SCAN_MODE_UPDATE =<br> "usual.event.bluetooth.host.SCAN_MODE_UPDATE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_HOST_DISCOVERY_STARTED =<br> "usual.event.bluetooth.host.DISCOVERY_STARTED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_HOST_DISCOVERY_FINISHED =<br> "usual.event.bluetooth.host.DISCOVERY_FINISHED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_HOST_NAME_UPDATE =<br> "usual.event.bluetooth.host.NAME_UPDATE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_A2DPSINK_CONNECT_STATE_UPDATE =<br> "usual.event.bluetooth.a2dpsink.CONNECT_STATE_UPDATE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_A2DPSINK_PLAYING_STATE_UPDATE =<br> "usual.event.bluetooth.a2dpsink.PLAYING_STATE_UPDATE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_BLUETOOTH_A2DPSINK_AUDIO_STATE_UPDATE =<br> "usual.event.bluetooth.a2dpsink.AUDIO_STATE_UPDATE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_NFC_ACTION_ADAPTER_STATE_CHANGED =<br> "usual.event.nfc.action.ADAPTER_STATE_CHANGED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_NFC_ACTION_RF_FIELD_ON_DETECTED =<br> "usual.event.nfc.action.RF_FIELD_ON_DETECTED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_NFC_ACTION_RF_FIELD_OFF_DETECTED =<br> "usual.event.nfc.action.RF_FIELD_OFF_DETECTED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_DISCHARGING = "usual.event.DISCHARGING"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_CHARGING = "usual.event.CHARGING"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_DEVICE_IDLE_MODE_CHANGED = "usual.event.DEVICE_IDLE_MODE_CHANGED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_POWER_SAVE_MODE_CHANGED = "usual.event.POWER_SAVE_MODE_CHANGED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_USER_ADDED = "usual.event.USER_ADDED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_USER_REMOVED = "usual.event.USER_REMOVED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_ABILITY_ADDED = "common.event.ABILITY_ADDED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_ABILITY_REMOVED = "common.event.ABILITY_REMOVED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_ABILITY_UPDATED = "common.event.ABILITY_UPDATED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_LOCATION_MODE_STATE_CHANGED =<br> "usual.event.location.MODE_STATE_CHANGED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_IVI_SLEEP = "common.event.IVI_SLEEP"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_IVI_PAUSE = "common.event.IVI_PAUSE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_IVI_STANDBY = "common.event.IVI_STANDBY"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_IVI_LASTMODE_SAVE = "common.event.IVI_LASTMODE_SAVE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_IVI_VOLTAGE_ABNORMAL = "common.event.IVI_VOLTAGE_ABNORMAL"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_IVI_HIGH_TEMPERATURE = "common.event.IVI_HIGH_TEMPERATURE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_IVI_EXTREME_TEMPERATURE = "common.event.IVI_EXTREME_TEMPERATURE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_IVI_TEMPERATURE_ABNORMAL = "common.event.IVI_TEMPERATURE_ABNORMAL"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_IVI_VOLTAGE_RECOVERY = "common.event.IVI_VOLTAGE_RECOVERY"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_IVI_TEMPERATURE_RECOVERY = "common.event.IVI_TEMPERATURE_RECOVERY"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_IVI_ACTIVE = "common.event.IVI_ACTIVE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_USB_STATE = "usual.event.hardware.usb.action.USB_STATE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_USB_PORT_CHANGED = "usual.event.hardware.usb.action.USB_PORT_CHANGED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_USB_DEVICE_ATTACHED =<br> "usual.event.hardware.usb.action.USB_DEVICE_ATTACHED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_USB_DEVICE_DETACHED =<br> "usual.event.hardware.usb.action.USB_DEVICE_DETACHED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_USB_ACCESSORY_ATTACHED =<br> "usual.event.hardware.usb.action.USB_ACCESSORY_ATTACHED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_USB_ACCESSORY_DETACHED =<br> "usual.event.hardware.usb.action.USB_ACCESSORY_DETACHED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_DISK_REMOVED = "usual.event.data.DISK_REMOVED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_DISK_UNMOUNTED = "usual.event.data.DISK_UNMOUNTED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_DISK_MOUNTED = "usual.event.data.DISK_MOUNTED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_DISK_BAD_REMOVAL = "usual.event.data.DISK_BAD_REMOVAL"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_DISK_UNMOUNTABLE = "usual.event.data.DISK_UNMOUNTABLE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_DISK_EJECT = "usual.event.data.DISK_EJECT"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_VOLUME_REMOVED = "usual.event.data.VOLUME_REMOVED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_VOLUME_UNMOUNTED = "usual.event.data.VOLUME_UNMOUNTED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_VOLUME_MOUNTED = "usual.event.data.VOLUME_MOUNTED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_VOLUME_BAD_REMOVAL = "usual.event.data.VOLUME_BAD_REMOVAL"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_VOLUME_EJECT = "usual.event.data.VOLUME_EJECT"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_VISIBLE_ACCOUNTS_UPDATED =<br> "usual.event.data.VISIBLE_ACCOUNTS_UPDATED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_ACCOUNT_DELETED = "usual.event.data.ACCOUNT_DELETED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_FOUNDATION_READY = "common.event.FOUNDATION_READY"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_AIRPLANE_MODE_CHANGED = "usual.event.AIRPLANE_MODE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_SPLIT_SCREEN = "common.event.SPLIT_SCREEN"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_SLOT_CHANGE = "usual.event.SLOT_CHANGE"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_SPN_INFO_CHANGED = "usual.event.SPN_INFO_CHANGED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_QUICK_FIX_APPLY_RESULT = "usual.event.QUICK_FIX_APPLY_RESULT"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.commonEventManager<br>类名: Support<br>方法 or 属性: COMMON_EVENT_USER_INFO_UPDATED = "usual.event.USER_INFO_UPDATED"|@ohos.commonEventManager.d.ts| +|新增|NA|模块名: ohos.notification<br>类名: RemoveReason|@ohos.notification.d.ts| +|新增|NA|类名:RemoveReason<br>方法or属性:|@ohos.notification.d.ts| +|新增|NA|模块名: ohos.notification<br>类名: RemoveReason<br>方法 or 属性:CLICK_REASON_REMOVE = 1|@ohos.notification.d.ts| +|新增|NA|类名:RemoveReason<br>方法or属性:CLICK_REASON_REMOVE = 1|@ohos.notification.d.ts| +|新增|NA|模块名: ohos.notification<br>类名: RemoveReason<br>方法 or 属性:CANCEL_REASON_REMOVE = 2|@ohos.notification.d.ts| +|新增|NA|类名:RemoveReason<br>方法or属性:CANCEL_REASON_REMOVE = 2|@ohos.notification.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function publish(request: NotificationRequest, callback: AsyncCallback\<void>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function publish(request: NotificationRequest): Promise\<void>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function publish(request: NotificationRequest, userId: number, callback: AsyncCallback\<void>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function publish(request: NotificationRequest, userId: number): Promise\<void>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function publishAsBundle(request: NotificationRequest, representativeBundle: string, userId: number, callback: AsyncCallback\<void>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function publishAsBundle(request: NotificationRequest, representativeBundle: string, userId: number): Promise\<void>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function cancel(id: number, callback: AsyncCallback\<void>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function cancel(id: number, label: string, callback: AsyncCallback\<void>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function cancel(id: number, label?: string): Promise\<void>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function cancelAsBundle(id: number, representativeBundle: string, userId: number, callback: AsyncCallback\<void>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function cancelAsBundle(id: number, representativeBundle: string, userId: number): Promise\<void>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function cancelAll(callback: AsyncCallback\<void>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function cancelAll(): Promise\<void>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function addSlot(slot: NotificationSlot, callback: AsyncCallback\<void>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function addSlot(slot: NotificationSlot): Promise\<void>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function addSlot(type: SlotType, callback: AsyncCallback\<void>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function addSlot(type: SlotType): Promise\<void>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function addSlots(slots: Array\<NotificationSlot>, callback: AsyncCallback\<void>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function addSlots(slots: Array\<NotificationSlot>): Promise\<void>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function getSlot(slotType: SlotType, callback: AsyncCallback\<NotificationSlot>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function getSlot(slotType: SlotType): Promise\<NotificationSlot>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function getSlots(callback: AsyncCallback\<Array\<NotificationSlot>>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function getSlots(): Promise\<Array\<NotificationSlot>>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function removeSlot(slotType: SlotType, callback: AsyncCallback\<void>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function removeSlot(slotType: SlotType): Promise\<void>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function removeAllSlots(callback: AsyncCallback\<void>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function removeAllSlots(): Promise\<void>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function setNotificationEnable(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<void>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function setNotificationEnable(bundle: BundleOption, enable: boolean): Promise\<void>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback\<boolean>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function isNotificationEnabled(bundle: BundleOption): Promise\<boolean>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function isNotificationEnabled(callback: AsyncCallback\<boolean>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function isNotificationEnabled(): Promise\<boolean>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function isNotificationEnabled(userId: number, callback: AsyncCallback\<boolean>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function isNotificationEnabled(userId: number): Promise\<boolean>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<void>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function displayBadge(bundle: BundleOption, enable: boolean): Promise\<void>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback\<boolean>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function isBadgeDisplayed(bundle: BundleOption): Promise\<boolean>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCallback\<void>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise\<void>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback\<Array\<NotificationSlot>>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function getSlotsByBundle(bundle: BundleOption): Promise\<Array\<NotificationSlot>>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback\<number>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function getSlotNumByBundle(bundle: BundleOption): Promise\<number>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function getAllActiveNotifications(callback: AsyncCallback\<Array\<NotificationRequest>>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function getAllActiveNotifications(): Promise\<Array\<NotificationRequest>>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function getActiveNotificationCount(callback: AsyncCallback\<number>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function getActiveNotificationCount(): Promise\<number>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function getActiveNotifications(callback: AsyncCallback\<Array\<NotificationRequest>>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function getActiveNotifications(): Promise\<Array\<NotificationRequest>>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function cancelGroup(groupName: string, callback: AsyncCallback\<void>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function cancelGroup(groupName: string): Promise\<void>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCallback\<void>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function removeGroupByBundle(bundle: BundleOption, groupName: string): Promise\<void>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function setDoNotDisturbDate(date: DoNotDisturbDate, callback: AsyncCallback\<void>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function setDoNotDisturbDate(date: DoNotDisturbDate): Promise\<void>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function setDoNotDisturbDate(date: DoNotDisturbDate, userId: number, callback: AsyncCallback\<void>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function setDoNotDisturbDate(date: DoNotDisturbDate, userId: number): Promise\<void>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function getDoNotDisturbDate(callback: AsyncCallback\<DoNotDisturbDate>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function getDoNotDisturbDate(): Promise\<DoNotDisturbDate>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function getDoNotDisturbDate(userId: number, callback: AsyncCallback\<DoNotDisturbDate>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function getDoNotDisturbDate(userId: number): Promise\<DoNotDisturbDate>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function isSupportDoNotDisturbMode(callback: AsyncCallback\<boolean>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function isSupportDoNotDisturbMode(): Promise\<boolean>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function isSupportTemplate(templateName: string, callback: AsyncCallback\<boolean>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function isSupportTemplate(templateName: string): Promise\<boolean>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function requestEnableNotification(callback: AsyncCallback\<void>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function requestEnableNotification(): Promise\<void>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function setDistributedEnable(enable: boolean, callback: AsyncCallback\<void>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function setDistributedEnable(enable: boolean): Promise\<void>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function isDistributedEnabled(callback: AsyncCallback\<boolean>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function isDistributedEnabled(): Promise\<boolean>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function setDistributedEnableByBundle(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<void>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function setDistributedEnableByBundle(bundle: BundleOption, enable: boolean): Promise\<void>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function isDistributedEnabledByBundle(bundle: BundleOption, callback: AsyncCallback\<boolean>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function isDistributedEnabledByBundle(bundle: BundleOption): Promise\<boolean>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function getDeviceRemindType(callback: AsyncCallback\<DeviceRemindType>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function getDeviceRemindType(): Promise\<DeviceRemindType>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean, callback: AsyncCallback\<void>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function setNotificationEnableSlot(bundle: BundleOption, type: SlotType, enable: boolean): Promise\<void>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function isNotificationSlotEnabled(bundle: BundleOption, type: SlotType, callback: AsyncCallback\<boolean>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function isNotificationSlotEnabled(bundle: BundleOption, type: SlotType): Promise\<boolean>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function setSyncNotificationEnabledWithoutApp(userId: number, enable: boolean, callback: AsyncCallback\<void>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function setSyncNotificationEnabledWithoutApp(userId: number, enable: boolean): Promise\<void>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function getSyncNotificationEnabledWithoutApp(userId: number, callback: AsyncCallback\<boolean>): void;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: notificationManager<br>方法 or 属性: function getSyncNotificationEnabledWithoutApp(userId: number): Promise\<boolean>;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: SlotType|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: SlotType<br>方法 or 属性: UNKNOWN_TYPE = 0|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: SlotType<br>方法 or 属性: SOCIAL_COMMUNICATION = 1|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: SlotType<br>方法 or 属性: SERVICE_INFORMATION = 2|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: SlotType<br>方法 or 属性: CONTENT_INFORMATION = 3|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: SlotType<br>方法 or 属性: OTHER_TYPES = 0xFFFF|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: ContentType|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: ContentType<br>方法 or 属性: NOTIFICATION_CONTENT_BASIC_TEXT|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: ContentType<br>方法 or 属性: NOTIFICATION_CONTENT_LONG_TEXT|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: ContentType<br>方法 or 属性: NOTIFICATION_CONTENT_PICTURE|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: ContentType<br>方法 or 属性: NOTIFICATION_CONTENT_CONVERSATION|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: ContentType<br>方法 or 属性: NOTIFICATION_CONTENT_MULTILINE|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: SlotLevel|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: SlotLevel<br>方法 or 属性: LEVEL_NONE = 0|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: SlotLevel<br>方法 or 属性: LEVEL_MIN = 1|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: SlotLevel<br>方法 or 属性: LEVEL_LOW = 2|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: SlotLevel<br>方法 or 属性: LEVEL_DEFAULT = 3|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: SlotLevel<br>方法 or 属性: LEVEL_HIGH = 4|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: DoNotDisturbType|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: DoNotDisturbType<br>方法 or 属性: TYPE_NONE = 0|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: DoNotDisturbType<br>方法 or 属性: TYPE_ONCE = 1|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: DoNotDisturbType<br>方法 or 属性: TYPE_DAILY = 2|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: DoNotDisturbType<br>方法 or 属性: TYPE_CLEARLY = 3|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: DoNotDisturbDate|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: DoNotDisturbDate<br>方法 or 属性: type: DoNotDisturbType;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: DoNotDisturbDate<br>方法 or 属性: begin: Date;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: DoNotDisturbDate<br>方法 or 属性: end: Date;|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: DeviceRemindType|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: DeviceRemindType<br>方法 or 属性: IDLE_DONOT_REMIND = 0|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: DeviceRemindType<br>方法 or 属性: IDLE_REMIND = 1|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: DeviceRemindType<br>方法 or 属性: ACTIVE_DONOT_REMIND = 2|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: DeviceRemindType<br>方法 or 属性: ACTIVE_REMIND = 3|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: SourceType|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: SourceType<br>方法 or 属性: TYPE_NORMAL = 0|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: SourceType<br>方法 or 属性: TYPE_CONTINUOUS = 1|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationManager<br>类名: SourceType<br>方法 or 属性: TYPE_TIMER = 2|@ohos.notificationManager.d.ts| +|新增|NA|模块名: ohos.notificationSubscribe<br>类名: notificationSubscribe|@ohos.notificationSubscribe.d.ts| +|新增|NA|模块名: ohos.notificationSubscribe<br>类名: NotificationKey|@ohos.notificationSubscribe.d.ts| +|新增|NA|模块名: ohos.notificationSubscribe<br>类名: NotificationKey<br>方法 or 属性: id: number;|@ohos.notificationSubscribe.d.ts| +|新增|NA|模块名: ohos.notificationSubscribe<br>类名: NotificationKey<br>方法 or 属性: label?: string;|@ohos.notificationSubscribe.d.ts| +|新增|NA|模块名: ohos.notificationSubscribe<br>类名: RemoveReason|@ohos.notificationSubscribe.d.ts| +|新增|NA|模块名: ohos.notificationSubscribe<br>类名: RemoveReason<br>方法 or 属性: CLICK_REASON_REMOVE = 1|@ohos.notificationSubscribe.d.ts| +|新增|NA|模块名: ohos.notificationSubscribe<br>类名: RemoveReason<br>方法 or 属性: CANCEL_REASON_REMOVE = 2|@ohos.notificationSubscribe.d.ts| +|新增|NA|模块名: ohos.notificationSubscribe<br>类名: notificationSubscribe<br>方法 or 属性: function subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\<void>): void;|@ohos.notificationSubscribe.d.ts| +|新增|NA|模块名: ohos.notificationSubscribe<br>类名: notificationSubscribe<br>方法 or 属性: function subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, callback: AsyncCallback\<void>): void;|@ohos.notificationSubscribe.d.ts| +|新增|NA|模块名: ohos.notificationSubscribe<br>类名: notificationSubscribe<br>方法 or 属性: function subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo): Promise\<void>;|@ohos.notificationSubscribe.d.ts| +|新增|NA|模块名: ohos.notificationSubscribe<br>类名: notificationSubscribe<br>方法 or 属性: function unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\<void>): void;|@ohos.notificationSubscribe.d.ts| +|新增|NA|模块名: ohos.notificationSubscribe<br>类名: notificationSubscribe<br>方法 or 属性: function unsubscribe(subscriber: NotificationSubscriber): Promise\<void>;|@ohos.notificationSubscribe.d.ts| +|新增|NA|模块名: ohos.notificationSubscribe<br>类名: notificationSubscribe<br>方法 or 属性: function remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveReason, callback: AsyncCallback\<void>): void;|@ohos.notificationSubscribe.d.ts| +|新增|NA|模块名: ohos.notificationSubscribe<br>类名: notificationSubscribe<br>方法 or 属性: function remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveReason): Promise\<void>;|@ohos.notificationSubscribe.d.ts| +|新增|NA|模块名: ohos.notificationSubscribe<br>类名: notificationSubscribe<br>方法 or 属性: function remove(hashCode: string, reason: RemoveReason, callback: AsyncCallback\<void>): void;|@ohos.notificationSubscribe.d.ts| +|新增|NA|模块名: ohos.notificationSubscribe<br>类名: notificationSubscribe<br>方法 or 属性: function remove(hashCode: string, reason: RemoveReason): Promise\<void>;|@ohos.notificationSubscribe.d.ts| +|新增|NA|模块名: ohos.notificationSubscribe<br>类名: notificationSubscribe<br>方法 or 属性: function removeAll(bundle: BundleOption, callback: AsyncCallback\<void>): void;|@ohos.notificationSubscribe.d.ts| +|新增|NA|模块名: ohos.notificationSubscribe<br>类名: notificationSubscribe<br>方法 or 属性: function removeAll(callback: AsyncCallback\<void>): void;|@ohos.notificationSubscribe.d.ts| +|新增|NA|模块名: ohos.notificationSubscribe<br>类名: notificationSubscribe<br>方法 or 属性: function removeAll(userId: number, callback: AsyncCallback\<void>): void;|@ohos.notificationSubscribe.d.ts| +|新增|NA|模块名: ohos.notificationSubscribe<br>类名: notificationSubscribe<br>方法 or 属性: function removeAll(userId: number): Promise\<void>;|@ohos.notificationSubscribe.d.ts| +|新增|NA|模块名: ohos.notificationSubscribe<br>类名: notificationSubscribe<br>方法 or 属性: function removeAll(bundle?: BundleOption): Promise\<void>;|@ohos.notificationSubscribe.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: reminderAgentManager|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: reminderAgentManager<br>方法 or 属性: function publishReminder(reminderReq: ReminderRequest, callback: AsyncCallback\<number>): void;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: reminderAgentManager<br>方法 or 属性: function publishReminder(reminderReq: ReminderRequest): Promise\<number>;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: reminderAgentManager<br>方法 or 属性: function cancelReminder(reminderId: number, callback: AsyncCallback\<void>): void;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: reminderAgentManager<br>方法 or 属性: function cancelReminder(reminderId: number): Promise\<void>;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: reminderAgentManager<br>方法 or 属性: function getValidReminders(callback: AsyncCallback\<Array\<ReminderRequest>>): void;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: reminderAgentManager<br>方法 or 属性: function getValidReminders(): Promise\<Array\<ReminderRequest>>;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: reminderAgentManager<br>方法 or 属性: function cancelAllReminders(callback: AsyncCallback\<void>): void;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: reminderAgentManager<br>方法 or 属性: function cancelAllReminders(): Promise\<void>;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: reminderAgentManager<br>方法 or 属性: function addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback\<void>): void;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: reminderAgentManager<br>方法 or 属性: function addNotificationSlot(slot: NotificationSlot): Promise\<void>;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: reminderAgentManager<br>方法 or 属性: function removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback\<void>): void;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: reminderAgentManager<br>方法 or 属性: function removeNotificationSlot(slotType: notification.SlotType): Promise\<void>;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ActionButtonType|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ActionButtonType<br>方法 or 属性: ACTION_BUTTON_TYPE_CLOSE = 0|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ActionButtonType<br>方法 or 属性: ACTION_BUTTON_TYPE_SNOOZE = 1|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ReminderType|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ReminderType<br>方法 or 属性: REMINDER_TYPE_TIMER = 0|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ReminderType<br>方法 or 属性: REMINDER_TYPE_CALENDAR = 1|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ReminderType<br>方法 or 属性: REMINDER_TYPE_ALARM = 2|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ActionButton|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ActionButton<br>方法 or 属性: title: string;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ActionButton<br>方法 or 属性: type: ActionButtonType;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: WantAgent|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: WantAgent<br>方法 or 属性: pkgName: string;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: WantAgent<br>方法 or 属性: abilityName: string;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: MaxScreenWantAgent|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: MaxScreenWantAgent<br>方法 or 属性: pkgName: string;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: MaxScreenWantAgent<br>方法 or 属性: abilityName: string;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ReminderRequest|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ReminderRequest<br>方法 or 属性: reminderType: ReminderType;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ReminderRequest<br>方法 or 属性: actionButton?: [ActionButton?, ActionButton?];|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ReminderRequest<br>方法 or 属性: wantAgent?: WantAgent;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ReminderRequest<br>方法 or 属性: maxScreenWantAgent?: MaxScreenWantAgent;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ReminderRequest<br>方法 or 属性: ringDuration?: number;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ReminderRequest<br>方法 or 属性: snoozeTimes?: number;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ReminderRequest<br>方法 or 属性: timeInterval?: number;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ReminderRequest<br>方法 or 属性: title?: string;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ReminderRequest<br>方法 or 属性: content?: string;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ReminderRequest<br>方法 or 属性: expiredContent?: string;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ReminderRequest<br>方法 or 属性: snoozeContent?: string;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ReminderRequest<br>方法 or 属性: notificationId?: number;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ReminderRequest<br>方法 or 属性: slotType?: notification.SlotType;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ReminderRequestCalendar|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ReminderRequestCalendar<br>方法 or 属性: dateTime: LocalDateTime;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ReminderRequestCalendar<br>方法 or 属性: repeatMonths?: Array\<number>;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ReminderRequestCalendar<br>方法 or 属性: repeatDays?: Array\<number>;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ReminderRequestAlarm|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ReminderRequestAlarm<br>方法 or 属性: hour: number;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ReminderRequestAlarm<br>方法 or 属性: minute: number;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ReminderRequestAlarm<br>方法 or 属性: daysOfWeek?: Array\<number>;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ReminderRequestTimer|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: ReminderRequestTimer<br>方法 or 属性: triggerTimeInSeconds: number;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: LocalDateTime|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: LocalDateTime<br>方法 or 属性: year: number;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: LocalDateTime<br>方法 or 属性: month: number;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: LocalDateTime<br>方法 or 属性: day: number;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: LocalDateTime<br>方法 or 属性: hour: number;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: LocalDateTime<br>方法 or 属性: minute: number;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: ohos.reminderAgentManager<br>类名: LocalDateTime<br>方法 or 属性: second?: number;|@ohos.reminderAgentManager.d.ts| +|新增|NA|模块名: commonEventSubscriber<br>类名: CommonEventSubscriber<br>方法 or 属性: finishCommonEvent(callback: AsyncCallback\<void>): void;|commonEventSubscriber.d.ts| +|新增|NA|模块名: commonEventSubscriber<br>类名: CommonEventSubscriber<br>方法 or 属性: finishCommonEvent(): Promise\<void>;|commonEventSubscriber.d.ts| +|新增|NA|模块名: NotificationCommonDef<br>类名: BundleOption|NotificationCommonDef.d.ts| +|新增|NA|模块名: NotificationCommonDef<br>类名: BundleOption<br>方法 or 属性: bundle: string;|NotificationCommonDef.d.ts| +|新增|NA|模块名: NotificationCommonDef<br>类名: BundleOption<br>方法 or 属性: uid?: number;|NotificationCommonDef.d.ts| +|新增|NA|模块名: notificationRequest<br>类名: NotificationRequest<br>方法 or 属性: removalWantAgent?: WantAgent;|notificationRequest.d.ts| +|新增|NA|模块名: notificationRequest<br>类名: NotificationRequest<br>方法 or 属性: badgeNumber?: number;|notificationRequest.d.ts| +|新增|NA|模块名: notificationSlot<br>类名: NotificationSlot<br>方法 or 属性: readonly enabled?: boolean;|notificationSlot.d.ts| +|废弃版本有变化|类名:commonEvent<br>废弃版本:N/A|类名:commonEvent<br>废弃版本:9<br>代替接口:ohos.commonEventManager |@ohos.commonEvent.d.ts| +|废弃版本有变化|类名:commonEvent<br>方法 or 属性:function publish(event: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:commonEvent<br>方法 or 属性:function publish(event: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.commonEventManager.publish |@ohos.commonEvent.d.ts| +|废弃版本有变化|类名:commonEvent<br>方法 or 属性:function publish(event: string, options: CommonEventPublishData, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:commonEvent<br>方法 or 属性:function publish(event: string, options: CommonEventPublishData, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.commonEventManager.publish |@ohos.commonEvent.d.ts| +|废弃版本有变化|类名:commonEvent<br>方法 or 属性:function publishAsUser(event: string, userId: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:commonEvent<br>方法 or 属性:function publishAsUser(event: string, userId: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.commonEventManager.publishAsUser |@ohos.commonEvent.d.ts| +|废弃版本有变化|类名:commonEvent<br>方法 or 属性:function publishAsUser(event: string, userId: number, options: CommonEventPublishData, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:commonEvent<br>方法 or 属性:function publishAsUser(event: string, userId: number, options: CommonEventPublishData, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.commonEventManager.publishAsUser |@ohos.commonEvent.d.ts| +|废弃版本有变化|类名:commonEvent<br>方法 or 属性:function createSubscriber(subscribeInfo: CommonEventSubscribeInfo, callback: AsyncCallback\<CommonEventSubscriber>): void;<br>废弃版本:N/A|类名:commonEvent<br>方法 or 属性:function createSubscriber(subscribeInfo: CommonEventSubscribeInfo, callback: AsyncCallback\<CommonEventSubscriber>): void;<br>废弃版本:9<br>代替接口:ohos.commonEventManager.createSubscriber |@ohos.commonEvent.d.ts| +|废弃版本有变化|类名:commonEvent<br>方法 or 属性:function createSubscriber(subscribeInfo: CommonEventSubscribeInfo): Promise\<CommonEventSubscriber>;<br>废弃版本:N/A|类名:commonEvent<br>方法 or 属性:function createSubscriber(subscribeInfo: CommonEventSubscribeInfo): Promise\<CommonEventSubscriber>;<br>废弃版本:9<br>代替接口:ohos.commonEventManager.createSubscriber |@ohos.commonEvent.d.ts| +|废弃版本有变化|类名:commonEvent<br>方法 or 属性:function subscribe(subscriber: CommonEventSubscriber, callback: AsyncCallback\<CommonEventData>): void;<br>废弃版本:N/A|类名:commonEvent<br>方法 or 属性:function subscribe(subscriber: CommonEventSubscriber, callback: AsyncCallback\<CommonEventData>): void;<br>废弃版本:9<br>代替接口:ohos.commonEventManager.subscribe |@ohos.commonEvent.d.ts| +|废弃版本有变化|类名:commonEvent<br>方法 or 属性:function unsubscribe(subscriber: CommonEventSubscriber, callback?: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:commonEvent<br>方法 or 属性:function unsubscribe(subscriber: CommonEventSubscriber, callback?: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.commonEventManager.unsubscribe |@ohos.commonEvent.d.ts| +|废弃版本有变化|类名:Support<br>废弃版本:N/A|类名:Support<br>废弃版本:9<br>代替接口:ohos.commonEventManager.Support |@ohos.commonEvent.d.ts| +|废弃版本有变化|类名:notification<br>废弃版本:N/A|类名:notification<br>废弃版本:9<br>代替接口:ohos.notificationManager and ohos.notificationSubscribe |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function publish(request: NotificationRequest, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function publish(request: NotificationRequest, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.publish |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function publish(request: NotificationRequest): Promise\<void>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function publish(request: NotificationRequest): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.publish |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function publish(request: NotificationRequest, userId: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function publish(request: NotificationRequest, userId: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.publish |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function publish(request: NotificationRequest, userId: number): Promise\<void>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function publish(request: NotificationRequest, userId: number): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.publish |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function cancel(id: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function cancel(id: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.cancel |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function cancel(id: number, label: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function cancel(id: number, label: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.cancel |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function cancel(id: number, label?: string): Promise\<void>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function cancel(id: number, label?: string): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.cancel |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function cancelAll(callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function cancelAll(callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.cancelAll |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function cancelAll(): Promise\<void>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function cancelAll(): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.cancelAll |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function addSlot(slot: NotificationSlot, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function addSlot(slot: NotificationSlot, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.addSlot |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function addSlot(slot: NotificationSlot): Promise\<void>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function addSlot(slot: NotificationSlot): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.addSlot |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function addSlot(type: SlotType, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function addSlot(type: SlotType, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.addSlot |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function addSlot(type: SlotType): Promise\<void>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function addSlot(type: SlotType): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.addSlot |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function addSlots(slots: Array\<NotificationSlot>, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function addSlots(slots: Array\<NotificationSlot>, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.addSlots |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function addSlots(slots: Array\<NotificationSlot>): Promise\<void>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function addSlots(slots: Array\<NotificationSlot>): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.addSlots |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function getSlot(slotType: SlotType, callback: AsyncCallback\<NotificationSlot>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function getSlot(slotType: SlotType, callback: AsyncCallback\<NotificationSlot>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.getSlot |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function getSlot(slotType: SlotType): Promise\<NotificationSlot>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function getSlot(slotType: SlotType): Promise\<NotificationSlot>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.getSlot |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function getSlots(callback: AsyncCallback\<Array\<NotificationSlot>>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function getSlots(callback: AsyncCallback\<Array\<NotificationSlot>>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.getSlots |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function getSlots(): Promise\<Array\<NotificationSlot>>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function getSlots(): Promise\<Array\<NotificationSlot>>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.getSlots |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function removeSlot(slotType: SlotType, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function removeSlot(slotType: SlotType, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.removeSlot |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function removeSlot(slotType: SlotType): Promise\<void>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function removeSlot(slotType: SlotType): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.removeSlot |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function removeAllSlots(callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function removeAllSlots(callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.removeAllSlots |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function removeAllSlots(): Promise\<void>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function removeAllSlots(): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.removeAllSlots |@ohos.notification.d.ts| +|废弃版本有变化|类名:SlotType<br>废弃版本:N/A|类名:SlotType<br>废弃版本:9<br>代替接口:ohos.notificationManager.SlotType |@ohos.notification.d.ts| +|废弃版本有变化|类名:ContentType<br>废弃版本:N/A|类名:ContentType<br>废弃版本:9<br>代替接口:ohos.notificationManager.ContentType |@ohos.notification.d.ts| +|废弃版本有变化|类名:SlotLevel<br>废弃版本:N/A|类名:SlotLevel<br>废弃版本:9<br>代替接口:ohos.notificationManager.SlotLevel |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function subscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.notificationSubscribe.subscribe |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function subscribe(subscriber: NotificationSubscriber, info: NotificationSubscribeInfo, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.notificationSubscribe.subscribe |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo): Promise\<void>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function subscribe(subscriber: NotificationSubscriber, info?: NotificationSubscribeInfo): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.notificationSubscribe.subscribe |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function unsubscribe(subscriber: NotificationSubscriber, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.notificationSubscribe.unsubscribe |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function unsubscribe(subscriber: NotificationSubscriber): Promise\<void>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function unsubscribe(subscriber: NotificationSubscriber): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.notificationSubscribe.unsubscribe |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function enableNotification(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function enableNotification(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.setNotificationEnable |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function enableNotification(bundle: BundleOption, enable: boolean): Promise\<void>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function enableNotification(bundle: BundleOption, enable: boolean): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.setNotificationEnable |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.isNotificationEnabled |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function isNotificationEnabled(bundle: BundleOption): Promise\<boolean>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function isNotificationEnabled(bundle: BundleOption): Promise\<boolean>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.isNotificationEnabled |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function isNotificationEnabled(callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function isNotificationEnabled(callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.isNotificationEnabled |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function isNotificationEnabled(): Promise\<boolean>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function isNotificationEnabled(): Promise\<boolean>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.isNotificationEnabled |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function isNotificationEnabled(userId: number, callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function isNotificationEnabled(userId: number, callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.isNotificationEnabled |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function isNotificationEnabled(userId: number): Promise\<boolean>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function isNotificationEnabled(userId: number): Promise\<boolean>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.isNotificationEnabled |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.displayBadge |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function displayBadge(bundle: BundleOption, enable: boolean): Promise\<void>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function displayBadge(bundle: BundleOption, enable: boolean): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.displayBadge |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.isBadgeDisplayed |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function isBadgeDisplayed(bundle: BundleOption): Promise\<boolean>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function isBadgeDisplayed(bundle: BundleOption): Promise\<boolean>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.isBadgeDisplayed |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.setSlotByBundle |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise\<void>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.setSlotByBundle |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback\<Array\<NotificationSlot>>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback\<Array\<NotificationSlot>>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.getSlotsByBundle |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function getSlotsByBundle(bundle: BundleOption): Promise\<Array\<NotificationSlot>>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function getSlotsByBundle(bundle: BundleOption): Promise\<Array\<NotificationSlot>>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.getSlotsByBundle |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.getSlotNumByBundle |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function getSlotNumByBundle(bundle: BundleOption): Promise\<number>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function getSlotNumByBundle(bundle: BundleOption): Promise\<number>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.getSlotNumByBundle |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function removeAll(bundle: BundleOption, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function removeAll(bundle: BundleOption, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.notificationSubscribe.removeAll |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function removeAll(callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function removeAll(callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.notificationSubscribe.removeAll |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function removeAll(userId: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function removeAll(userId: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.notificationSubscribe.removeAll |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function removeAll(userId: number): Promise\<void>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function removeAll(userId: number): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.notificationSubscribe.removeAll |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function removeAll(bundle?: BundleOption): Promise\<void>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function removeAll(bundle?: BundleOption): Promise\<void>;<br>废弃版本:9<br>代替接口:notificationSubscribe.removeAll |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function getAllActiveNotifications(callback: AsyncCallback\<Array\<NotificationRequest>>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function getAllActiveNotifications(callback: AsyncCallback\<Array\<NotificationRequest>>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.getAllActiveNotifications |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function getAllActiveNotifications(): Promise\<Array\<NotificationRequest>>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function getAllActiveNotifications(): Promise\<Array\<NotificationRequest>>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.getAllActiveNotifications |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function getActiveNotificationCount(callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function getActiveNotificationCount(callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.getActiveNotificationCount |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function getActiveNotificationCount(): Promise\<number>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function getActiveNotificationCount(): Promise\<number>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.getActiveNotificationCount |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function getActiveNotifications(callback: AsyncCallback\<Array\<NotificationRequest>>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function getActiveNotifications(callback: AsyncCallback\<Array\<NotificationRequest>>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.cancelGroup |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function getActiveNotifications(): Promise\<Array\<NotificationRequest>>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function getActiveNotifications(): Promise\<Array\<NotificationRequest>>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.cancelGroup |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function cancelGroup(groupName: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function cancelGroup(groupName: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.cancelGroup |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function cancelGroup(groupName: string): Promise\<void>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function cancelGroup(groupName: string): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.cancelGroup |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.removeGroupByBundle |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function removeGroupByBundle(bundle: BundleOption, groupName: string): Promise\<void>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function removeGroupByBundle(bundle: BundleOption, groupName: string): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.removeGroupByBundle |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function setDoNotDisturbDate(date: DoNotDisturbDate, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function setDoNotDisturbDate(date: DoNotDisturbDate, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.setDoNotDisturbDate |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function setDoNotDisturbDate(date: DoNotDisturbDate): Promise\<void>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function setDoNotDisturbDate(date: DoNotDisturbDate): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.setDoNotDisturbDate |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function setDoNotDisturbDate(date: DoNotDisturbDate, userId: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function setDoNotDisturbDate(date: DoNotDisturbDate, userId: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.setDoNotDisturbDate |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function setDoNotDisturbDate(date: DoNotDisturbDate, userId: number): Promise\<void>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function setDoNotDisturbDate(date: DoNotDisturbDate, userId: number): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.setDoNotDisturbDate |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function getDoNotDisturbDate(callback: AsyncCallback\<DoNotDisturbDate>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function getDoNotDisturbDate(callback: AsyncCallback\<DoNotDisturbDate>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.getDoNotDisturbDate |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function getDoNotDisturbDate(): Promise\<DoNotDisturbDate>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function getDoNotDisturbDate(): Promise\<DoNotDisturbDate>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.getDoNotDisturbDate |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function getDoNotDisturbDate(userId: number, callback: AsyncCallback\<DoNotDisturbDate>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function getDoNotDisturbDate(userId: number, callback: AsyncCallback\<DoNotDisturbDate>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.getDoNotDisturbDate |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function getDoNotDisturbDate(userId: number): Promise\<DoNotDisturbDate>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function getDoNotDisturbDate(userId: number): Promise\<DoNotDisturbDate>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.getDoNotDisturbDate |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function supportDoNotDisturbMode(callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function supportDoNotDisturbMode(callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.isSupportDoNotDisturbMode |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function supportDoNotDisturbMode(): Promise\<boolean>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function supportDoNotDisturbMode(): Promise\<boolean>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.isSupportDoNotDisturbMode |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function isSupportTemplate(templateName: string, callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function isSupportTemplate(templateName: string, callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.isSupportTemplate |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function isSupportTemplate(templateName: string): Promise\<boolean>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function isSupportTemplate(templateName: string): Promise\<boolean>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.isSupportTemplate |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function requestEnableNotification(callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function requestEnableNotification(callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.requestEnableNotification |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function requestEnableNotification(): Promise\<void>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function requestEnableNotification(): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.requestEnableNotification |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function enableDistributed(enable: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function enableDistributed(enable: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.setDistributedEnable |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function enableDistributed(enable: boolean): Promise\<void>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function enableDistributed(enable: boolean): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.setDistributedEnable |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function isDistributedEnabled(callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function isDistributedEnabled(callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.isDistributedEnabled |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function isDistributedEnabled(): Promise\<boolean>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function isDistributedEnabled(): Promise\<boolean>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.isDistributedEnabled |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function enableDistributedByBundle(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function enableDistributedByBundle(bundle: BundleOption, enable: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.setDistributedEnableByBundle |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function enableDistributedByBundle(bundle: BundleOption, enable: boolean): Promise\<void>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function enableDistributedByBundle(bundle: BundleOption, enable: boolean): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.setDistributedEnableByBundle |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function isDistributedEnabledByBundle(bundle: BundleOption, callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function isDistributedEnabledByBundle(bundle: BundleOption, callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.isDistributedEnabledByBundle |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function isDistributedEnabledByBundle(bundle: BundleOption): Promise\<boolean>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function isDistributedEnabledByBundle(bundle: BundleOption): Promise\<boolean>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.isDistributedEnabledByBundle |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function getDeviceRemindType(callback: AsyncCallback\<DeviceRemindType>): void;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function getDeviceRemindType(callback: AsyncCallback\<DeviceRemindType>): void;<br>废弃版本:9<br>代替接口:ohos.notificationManager.getDeviceRemindType |@ohos.notification.d.ts| +|废弃版本有变化|类名:notification<br>方法 or 属性:function getDeviceRemindType(): Promise\<DeviceRemindType>;<br>废弃版本:N/A|类名:notification<br>方法 or 属性:function getDeviceRemindType(): Promise\<DeviceRemindType>;<br>废弃版本:9<br>代替接口:ohos.notificationManager.getDeviceRemindType |@ohos.notification.d.ts| +|废弃版本有变化|类名:BundleOption<br>废弃版本:N/A|类名:BundleOption<br>废弃版本:9<br>代替接口:ohos.notificationManager.BundleOption |@ohos.notification.d.ts| +|废弃版本有变化|类名:NotificationKey<br>废弃版本:N/A|类名:NotificationKey<br>废弃版本:9<br>代替接口:ohos.notificationManager.NotificationKey |@ohos.notification.d.ts| +|废弃版本有变化|类名:DoNotDisturbType<br>废弃版本:N/A|类名:DoNotDisturbType<br>废弃版本:9<br>代替接口:ohos.notificationManager.DoNotDisturbType |@ohos.notification.d.ts| +|废弃版本有变化|类名:DoNotDisturbDate<br>废弃版本:N/A|类名:DoNotDisturbDate<br>废弃版本:9<br>代替接口:ohos.notificationManager.DoNotDisturbDate |@ohos.notification.d.ts| +|废弃版本有变化|类名:DeviceRemindType<br>废弃版本:N/A|类名:DeviceRemindType<br>废弃版本:9<br>代替接口:ohos.notificationManager.DeviceRemindType |@ohos.notification.d.ts| +|废弃版本有变化|类名:SourceType<br>废弃版本:N/A|类名:SourceType<br>废弃版本:9<br>代替接口:ohos.notificationManager.SourceType |@ohos.notification.d.ts| +|废弃版本有变化|类名:reminderAgent<br>废弃版本:N/A|类名:reminderAgent<br>废弃版本:9<br>代替接口:reminderAgentManager |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:reminderAgent<br>方法 or 属性:function publishReminder(reminderReq: ReminderRequest, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:reminderAgent<br>方法 or 属性:function publishReminder(reminderReq: ReminderRequest, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:reminderAgentManager.publishReminder |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:reminderAgent<br>方法 or 属性:function publishReminder(reminderReq: ReminderRequest): Promise\<number>;<br>废弃版本:N/A|类名:reminderAgent<br>方法 or 属性:function publishReminder(reminderReq: ReminderRequest): Promise\<number>;<br>废弃版本:9<br>代替接口:reminderAgentManager.publishReminder |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:reminderAgent<br>方法 or 属性:function cancelReminder(reminderId: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:reminderAgent<br>方法 or 属性:function cancelReminder(reminderId: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:reminderAgentManager.cancelReminder |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:reminderAgent<br>方法 or 属性:function cancelReminder(reminderId: number): Promise\<void>;<br>废弃版本:N/A|类名:reminderAgent<br>方法 or 属性:function cancelReminder(reminderId: number): Promise\<void>;<br>废弃版本:9<br>代替接口:reminderAgentManager.cancelReminder |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:reminderAgent<br>方法 or 属性:function getValidReminders(callback: AsyncCallback\<Array\<ReminderRequest>>): void;<br>废弃版本:N/A|类名:reminderAgent<br>方法 or 属性:function getValidReminders(callback: AsyncCallback\<Array\<ReminderRequest>>): void;<br>废弃版本:9<br>代替接口:reminderAgentManager.getValidReminders |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:reminderAgent<br>方法 or 属性:function getValidReminders(): Promise\<Array\<ReminderRequest>>;<br>废弃版本:N/A|类名:reminderAgent<br>方法 or 属性:function getValidReminders(): Promise\<Array\<ReminderRequest>>;<br>废弃版本:9<br>代替接口:reminderAgentManager.getValidReminders |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:reminderAgent<br>方法 or 属性:function cancelAllReminders(callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:reminderAgent<br>方法 or 属性:function cancelAllReminders(callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:reminderAgentManager.cancelAllReminders |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:reminderAgent<br>方法 or 属性:function cancelAllReminders(): Promise\<void>;<br>废弃版本:N/A|类名:reminderAgent<br>方法 or 属性:function cancelAllReminders(): Promise\<void>;<br>废弃版本:9<br>代替接口:reminderAgentManager.cancelAllReminders |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:reminderAgent<br>方法 or 属性:function addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:reminderAgent<br>方法 or 属性:function addNotificationSlot(slot: NotificationSlot, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:reminderAgentManager.addNotificationSlot |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:reminderAgent<br>方法 or 属性:function addNotificationSlot(slot: NotificationSlot): Promise\<void>;<br>废弃版本:N/A|类名:reminderAgent<br>方法 or 属性:function addNotificationSlot(slot: NotificationSlot): Promise\<void>;<br>废弃版本:9<br>代替接口:reminderAgentManager.addNotificationSlot |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:reminderAgent<br>方法 or 属性:function removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:reminderAgent<br>方法 or 属性:function removeNotificationSlot(slotType: notification.SlotType, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:reminderAgentManager.removeNotificationSlot |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:reminderAgent<br>方法 or 属性:function removeNotificationSlot(slotType: notification.SlotType): Promise\<void>;<br>废弃版本:N/A|类名:reminderAgent<br>方法 or 属性:function removeNotificationSlot(slotType: notification.SlotType): Promise\<void>;<br>废弃版本:9<br>代替接口:reminderAgentManager.removeNotificationSlot |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ActionButtonType<br>废弃版本:N/A|类名:ActionButtonType<br>废弃版本:9<br>代替接口:reminderAgentManager.ActionButtonType |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ActionButtonType<br>方法 or 属性:ACTION_BUTTON_TYPE_CLOSE = 0<br>废弃版本:N/A|类名:ActionButtonType<br>方法 or 属性:ACTION_BUTTON_TYPE_CLOSE = 0<br>废弃版本:9<br>代替接口:reminderAgentManager.ActionButtonType.ACTION_BUTTON_TYPE_CLOSE |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ActionButtonType<br>方法 or 属性:ACTION_BUTTON_TYPE_SNOOZE = 1<br>废弃版本:N/A|类名:ActionButtonType<br>方法 or 属性:ACTION_BUTTON_TYPE_SNOOZE = 1<br>废弃版本:9<br>代替接口:reminderAgentManager.ActionButtonType.ACTION_BUTTON_TYPE_SNOOZE |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ReminderType<br>废弃版本:N/A|类名:ReminderType<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderType |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ReminderType<br>方法 or 属性:REMINDER_TYPE_TIMER = 0<br>废弃版本:N/A|类名:ReminderType<br>方法 or 属性:REMINDER_TYPE_TIMER = 0<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderType.REMINDER_TYPE_TIMER |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ReminderType<br>方法 or 属性:REMINDER_TYPE_CALENDAR = 1<br>废弃版本:N/A|类名:ReminderType<br>方法 or 属性:REMINDER_TYPE_CALENDAR = 1<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderType.REMINDER_TYPE_CALENDAR |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ReminderType<br>方法 or 属性:REMINDER_TYPE_ALARM = 2<br>废弃版本:N/A|类名:ReminderType<br>方法 or 属性:REMINDER_TYPE_ALARM = 2<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderType.REMINDER_TYPE_ALARM |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ActionButton<br>废弃版本:N/A|类名:ActionButton<br>废弃版本:9<br>代替接口:reminderAgentManager.ActionButton |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ActionButton<br>方法 or 属性:title: string;<br>废弃版本:N/A|类名:ActionButton<br>方法 or 属性:title: string;<br>废弃版本:9<br>代替接口:reminderAgentManager.ActionButton.title |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ActionButton<br>方法 or 属性:type: ActionButtonType;<br>废弃版本:N/A|类名:ActionButton<br>方法 or 属性:type: ActionButtonType;<br>废弃版本:9<br>代替接口:reminderAgentManager.ActionButton.type |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:WantAgent<br>废弃版本:N/A|类名:WantAgent<br>废弃版本:9<br>代替接口:reminderAgentManager.WantAgent |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:WantAgent<br>方法 or 属性:pkgName: string;<br>废弃版本:N/A|类名:WantAgent<br>方法 or 属性:pkgName: string;<br>废弃版本:9<br>代替接口:reminderAgentManager.WantAgent.pkgName |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:WantAgent<br>方法 or 属性:abilityName: string;<br>废弃版本:N/A|类名:WantAgent<br>方法 or 属性:abilityName: string;<br>废弃版本:9<br>代替接口:reminderAgentManager.WantAgent.abilityName |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:MaxScreenWantAgent<br>废弃版本:N/A|类名:MaxScreenWantAgent<br>废弃版本:9<br>代替接口:reminderAgentManager.MaxScreenWantAgent |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:MaxScreenWantAgent<br>方法 or 属性:pkgName: string;<br>废弃版本:N/A|类名:MaxScreenWantAgent<br>方法 or 属性:pkgName: string;<br>废弃版本:9<br>代替接口:reminderAgentManager.MaxScreenWantAgent.pkgName |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:MaxScreenWantAgent<br>方法 or 属性:abilityName: string;<br>废弃版本:N/A|类名:MaxScreenWantAgent<br>方法 or 属性:abilityName: string;<br>废弃版本:9<br>代替接口:reminderAgentManager.MaxScreenWantAgent.abilityName |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ReminderRequest<br>废弃版本:N/A|类名:ReminderRequest<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderRequest |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ReminderRequest<br>方法 or 属性:reminderType: ReminderType;<br>废弃版本:N/A|类名:ReminderRequest<br>方法 or 属性:reminderType: ReminderType;<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderRequest.reminderType |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ReminderRequest<br>方法 or 属性:actionButton?: [ActionButton?, ActionButton?];<br>废弃版本:N/A|类名:ReminderRequest<br>方法 or 属性:actionButton?: [ActionButton?, ActionButton?];<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderRequest.actionButton |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ReminderRequest<br>方法 or 属性:wantAgent?: WantAgent;<br>废弃版本:N/A|类名:ReminderRequest<br>方法 or 属性:wantAgent?: WantAgent;<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderRequest.wantAgent |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ReminderRequest<br>方法 or 属性:maxScreenWantAgent?: MaxScreenWantAgent;<br>废弃版本:N/A|类名:ReminderRequest<br>方法 or 属性:maxScreenWantAgent?: MaxScreenWantAgent;<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderRequest.maxScreenWantAgent |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ReminderRequest<br>方法 or 属性:ringDuration?: number;<br>废弃版本:N/A|类名:ReminderRequest<br>方法 or 属性:ringDuration?: number;<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderRequest.ringDuration |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ReminderRequest<br>方法 or 属性:snoozeTimes?: number;<br>废弃版本:N/A|类名:ReminderRequest<br>方法 or 属性:snoozeTimes?: number;<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderRequest.snoozeTimes |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ReminderRequest<br>方法 or 属性:timeInterval?: number;<br>废弃版本:N/A|类名:ReminderRequest<br>方法 or 属性:timeInterval?: number;<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderRequest.timeInterval |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ReminderRequest<br>方法 or 属性:title?: string;<br>废弃版本:N/A|类名:ReminderRequest<br>方法 or 属性:title?: string;<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderRequest.title |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ReminderRequest<br>方法 or 属性:content?: string;<br>废弃版本:N/A|类名:ReminderRequest<br>方法 or 属性:content?: string;<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderRequest.content |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ReminderRequest<br>方法 or 属性:expiredContent?: string;<br>废弃版本:N/A|类名:ReminderRequest<br>方法 or 属性:expiredContent?: string;<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderRequest.expiredContent |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ReminderRequest<br>方法 or 属性:snoozeContent?: string;<br>废弃版本:N/A|类名:ReminderRequest<br>方法 or 属性:snoozeContent?: string;<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderRequest.snoozeContent |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ReminderRequest<br>方法 or 属性:notificationId?: number;<br>废弃版本:N/A|类名:ReminderRequest<br>方法 or 属性:notificationId?: number;<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderRequest.notificationId |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ReminderRequest<br>方法 or 属性:slotType?: notification.SlotType;<br>废弃版本:N/A|类名:ReminderRequest<br>方法 or 属性:slotType?: notification.SlotType;<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderRequest.slotType |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ReminderRequestCalendar<br>废弃版本:N/A|类名:ReminderRequestCalendar<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderRequestCalendar |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ReminderRequestCalendar<br>方法 or 属性:dateTime: LocalDateTime;<br>废弃版本:N/A|类名:ReminderRequestCalendar<br>方法 or 属性:dateTime: LocalDateTime;<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderRequestCalendar.dateTime |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ReminderRequestCalendar<br>方法 or 属性:repeatMonths?: Array\<number>;<br>废弃版本:N/A|类名:ReminderRequestCalendar<br>方法 or 属性:repeatMonths?: Array\<number>;<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderRequestCalendar.repeatMonths |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ReminderRequestCalendar<br>方法 or 属性:repeatDays?: Array\<number>;<br>废弃版本:N/A|类名:ReminderRequestCalendar<br>方法 or 属性:repeatDays?: Array\<number>;<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderRequestCalendar.repeatDays |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ReminderRequestAlarm<br>废弃版本:N/A|类名:ReminderRequestAlarm<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderRequestAlarm |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ReminderRequestAlarm<br>方法 or 属性:hour: number;<br>废弃版本:N/A|类名:ReminderRequestAlarm<br>方法 or 属性:hour: number;<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderRequestAlarm.hour |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ReminderRequestAlarm<br>方法 or 属性:minute: number;<br>废弃版本:N/A|类名:ReminderRequestAlarm<br>方法 or 属性:minute: number;<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderRequestAlarm.minute |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ReminderRequestAlarm<br>方法 or 属性:daysOfWeek?: Array\<number>;<br>废弃版本:N/A|类名:ReminderRequestAlarm<br>方法 or 属性:daysOfWeek?: Array\<number>;<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderRequestAlarm.daysOfWeek |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:ReminderRequestTimer<br>废弃版本:N/A|类名:ReminderRequestTimer<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderRequestTimer |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:LocalDateTime<br>方法 or 属性:year: number;<br>废弃版本:N/A|类名:LocalDateTime<br>方法 or 属性:year: number;<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderRequestTimer.year |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:LocalDateTime<br>方法 or 属性:month: number;<br>废弃版本:N/A|类名:LocalDateTime<br>方法 or 属性:month: number;<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderRequestTimer.month |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:LocalDateTime<br>方法 or 属性:day: number;<br>废弃版本:N/A|类名:LocalDateTime<br>方法 or 属性:day: number;<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderRequestTimer.day |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:LocalDateTime<br>方法 or 属性:hour: number;<br>废弃版本:N/A|类名:LocalDateTime<br>方法 or 属性:hour: number;<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderRequestTimer.hour |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:LocalDateTime<br>方法 or 属性:minute: number;<br>废弃版本:N/A|类名:LocalDateTime<br>方法 or 属性:minute: number;<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderRequestTimer.minute |@ohos.reminderAgent.d.ts| +|废弃版本有变化|类名:LocalDateTime<br>方法 or 属性:second?: number;<br>废弃版本:N/A|类名:LocalDateTime<br>方法 or 属性:second?: number;<br>废弃版本:9<br>代替接口:reminderAgentManager.ReminderRequestTimer.second |@ohos.reminderAgent.d.ts| +|SysCap有变化|类名:ReminderRequestAlarm<br>SysCap:Define alarm reminder object.|类名:ReminderRequestAlarm<br>SysCap:SystemCapability.Notification.ReminderAgent|@ohos.reminderAgent.d.ts| +|函数有变化|类名:notification<br>方法 or 属性:function remove(bundle: BundleOption, notificationKey: NotificationKey, callback: AsyncCallback\<void>): void;<br>|类名:notification<br>方法 or 属性:function remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveReason, callback: AsyncCallback\<void>): void;<br>|@ohos.notification.d.ts| +|函数有变化|类名:notification<br>方法 or 属性:function remove(hashCode: string, callback: AsyncCallback\<void>): void;<br>|类名:notification<br>方法 or 属性:function remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveReason, callback: AsyncCallback\<void>): void;<br>|@ohos.notification.d.ts| +|函数有变化|类名:notification<br>方法 or 属性:function remove(bundle: BundleOption, notificationKey: NotificationKey): Promise\<void>;<br>|类名:notification<br>方法 or 属性:function remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveReason): Promise\<void>;<br>|@ohos.notification.d.ts| +|函数有变化|类名:notification<br>方法 or 属性:function remove(hashCode: string): Promise\<void>;<br>|类名:notification<br>方法 or 属性:function remove(bundle: BundleOption, notificationKey: NotificationKey, reason: RemoveReason): Promise\<void>;<br>|@ohos.notification.d.ts| +|函数有变化|类名:notification<br>方法 or 属性:function remove(bundle: BundleOption, notificationKey: NotificationKey, callback: AsyncCallback\<void>): void;<br>|类名:notification<br>方法 or 属性:function remove(hashCode: string, reason: RemoveReason, callback: AsyncCallback\<void>): void;<br>|@ohos.notification.d.ts| +|函数有变化|类名:notification<br>方法 or 属性:function remove(hashCode: string, callback: AsyncCallback\<void>): void;<br>|类名:notification<br>方法 or 属性:function remove(hashCode: string, reason: RemoveReason, callback: AsyncCallback\<void>): void;<br>|@ohos.notification.d.ts| +|函数有变化|类名:notification<br>方法 or 属性:function remove(bundle: BundleOption, notificationKey: NotificationKey): Promise\<void>;<br>|类名:notification<br>方法 or 属性:function remove(hashCode: string, reason: RemoveReason): Promise\<void>;<br>|@ohos.notification.d.ts| +|函数有变化|类名:notification<br>方法 or 属性:function remove(hashCode: string): Promise\<void>;<br>|类名:notification<br>方法 or 属性:function remove(hashCode: string, reason: RemoveReason): Promise\<void>;<br>|@ohos.notification.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-resource-scheduler.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-resource-scheduler.md new file mode 100644 index 0000000000000000000000000000000000000000..ea654bf00e7c052462e4c1905711ca9ad9f0d314 --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-resource-scheduler.md @@ -0,0 +1,215 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: backgroundTaskManager|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: DelaySuspendInfo|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: DelaySuspendInfo<br>方法 or 属性: requestId: number;|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: DelaySuspendInfo<br>方法 or 属性: actualDelayTime: number;|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: backgroundTaskManager<br>方法 or 属性: function cancelSuspendDelay(requestId: number): void;|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: backgroundTaskManager<br>方法 or 属性: function getRemainingDelayTime(requestId: number, callback: AsyncCallback\<number>): void;|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: backgroundTaskManager<br>方法 or 属性: function getRemainingDelayTime(requestId: number): Promise\<number>;|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: backgroundTaskManager<br>方法 or 属性: function requestSuspendDelay(reason: string, callback: Callback\<void>): DelaySuspendInfo;|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: backgroundTaskManager<br>方法 or 属性: function startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent, callback: AsyncCallback\<void>): void;|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: backgroundTaskManager<br>方法 or 属性: function startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent): Promise\<void>;|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: backgroundTaskManager<br>方法 or 属性: function stopBackgroundRunning(context: Context, callback: AsyncCallback\<void>): void;|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: backgroundTaskManager<br>方法 or 属性: function stopBackgroundRunning(context: Context): Promise\<void>;|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: backgroundTaskManager<br>方法 or 属性: function applyEfficiencyResources(request: EfficiencyResourcesRequest): void;|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: backgroundTaskManager<br>方法 or 属性: function resetAllEfficiencyResources(): void;|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: BackgroundMode|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: BackgroundMode<br>方法 or 属性: DATA_TRANSFER = 1|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: BackgroundMode<br>方法 or 属性: AUDIO_PLAYBACK = 2|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: BackgroundMode<br>方法 or 属性: AUDIO_RECORDING = 3|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: BackgroundMode<br>方法 or 属性: LOCATION = 4|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: BackgroundMode<br>方法 or 属性: BLUETOOTH_INTERACTION = 5|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: BackgroundMode<br>方法 or 属性: MULTI_DEVICE_CONNECTION = 6|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: BackgroundMode<br>方法 or 属性: WIFI_INTERACTION = 7|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: BackgroundMode<br>方法 or 属性: VOIP = 8|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: BackgroundMode<br>方法 or 属性: TASK_KEEPING = 9|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: ResourceType|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: ResourceType<br>方法 or 属性: CPU = 1|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: ResourceType<br>方法 or 属性: COMMON_EVENT = 1 \<\< 1|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: ResourceType<br>方法 or 属性: TIMER = 1 \<\< 2|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: ResourceType<br>方法 or 属性: WORK_SCHEDULER = 1 \<\< 3|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: ResourceType<br>方法 or 属性: BLUETOOTH = 1 \<\< 4|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: ResourceType<br>方法 or 属性: GPS = 1 \<\< 5|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: ResourceType<br>方法 or 属性: AUDIO = 1 \<\< 6|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: EfficiencyResourcesRequest|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: EfficiencyResourcesRequest<br>方法 or 属性: resourceTypes: number;|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: EfficiencyResourcesRequest<br>方法 or 属性: isApply: boolean;|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: EfficiencyResourcesRequest<br>方法 or 属性: timeOut: number;|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: EfficiencyResourcesRequest<br>方法 or 属性: isPersist?: boolean;|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: EfficiencyResourcesRequest<br>方法 or 属性: isProcess?: boolean;|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.backgroundTaskManager<br>类名: EfficiencyResourcesRequest<br>方法 or 属性: reason: string;|@ohos.resourceschedule.backgroundTaskManager.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: usageStatistics|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: BundleStatsInfo|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: BundleStatsInfo<br>方法 or 属性: id: number;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: BundleStatsInfo<br>方法 or 属性: abilityInFgTotalTime?: number;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: BundleStatsInfo<br>方法 or 属性: abilityPrevAccessTime?: number;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: BundleStatsInfo<br>方法 or 属性: abilityPrevSeenTime?: number;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: BundleStatsInfo<br>方法 or 属性: abilitySeenTotalTime?: number;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: BundleStatsInfo<br>方法 or 属性: bundleName?: string;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: BundleStatsInfo<br>方法 or 属性: fgAbilityAccessTotalTime?: number;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: BundleStatsInfo<br>方法 or 属性: fgAbilityPrevAccessTime?: number;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: BundleStatsInfo<br>方法 or 属性: infosBeginTime?: number;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: BundleStatsInfo<br>方法 or 属性: infosEndTime?: number;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: HapFormInfo|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: HapFormInfo<br>方法 or 属性: formName: string;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: HapFormInfo<br>方法 or 属性: formDimension: number;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: HapFormInfo<br>方法 or 属性: formId: number;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: HapFormInfo<br>方法 or 属性: formLastUsedTime: number;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: HapFormInfo<br>方法 or 属性: count: number;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: HapModuleInfo|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: HapModuleInfo<br>方法 or 属性: deviceId?: string;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: HapModuleInfo<br>方法 or 属性: bundleName: string;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: HapModuleInfo<br>方法 or 属性: moduleName: string;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: HapModuleInfo<br>方法 or 属性: abilityName?: string;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: HapModuleInfo<br>方法 or 属性: appLabelId?: number;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: HapModuleInfo<br>方法 or 属性: labelId?: number;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: HapModuleInfo<br>方法 or 属性: descriptionId?: number;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: HapModuleInfo<br>方法 or 属性: abilityLableId?: number;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: HapModuleInfo<br>方法 or 属性: abilityDescriptionId?: number;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: HapModuleInfo<br>方法 or 属性: abilityIconId?: number;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: HapModuleInfo<br>方法 or 属性: launchedCount: number;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: HapModuleInfo<br>方法 or 属性: lastModuleUsedTime: number;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: HapModuleInfo<br>方法 or 属性: formRecords: Array\<HapFormInfo>;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: DeviceEventStats|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: DeviceEventStats<br>方法 or 属性: name: string;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: DeviceEventStats<br>方法 or 属性: eventId: number;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: DeviceEventStats<br>方法 or 属性: count: number;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: BundleEvents|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: BundleEvents<br>方法 or 属性: appGroup?: number;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: BundleEvents<br>方法 or 属性: bundleName?: string;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: BundleEvents<br>方法 or 属性: indexOfLink?: string;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: BundleEvents<br>方法 or 属性: nameOfClass?: string;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: BundleEvents<br>方法 or 属性: eventOccurredTime?: number;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: BundleEvents<br>方法 or 属性: eventId?: number;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: AppGroupCallbackInfo|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: AppGroupCallbackInfo<br>方法 or 属性: appOldGroup: number;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: AppGroupCallbackInfo<br>方法 or 属性: appNewGroup: number;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: AppGroupCallbackInfo<br>方法 or 属性: userId: number;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: AppGroupCallbackInfo<br>方法 or 属性: changeReason: number;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: AppGroupCallbackInfo<br>方法 or 属性: bundleName: string;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: usageStatistics<br>方法 or 属性: function isIdleState(bundleName: string, callback: AsyncCallback\<boolean>): void;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: usageStatistics<br>方法 or 属性: function isIdleState(bundleName: string): Promise\<boolean>;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: usageStatistics<br>方法 or 属性: function queryAppGroup(callback: AsyncCallback\<number>): void;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: usageStatistics<br>方法 or 属性: function queryAppGroup(): Promise\<number>;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: usageStatistics<br>方法 or 属性: function queryAppGroup(bundleName : string, callback: AsyncCallback\<number>): void;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: usageStatistics<br>方法 or 属性: function queryAppGroup(bundleName : string): Promise\<number>;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: BundleStatsMap|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: BundleStatsMap<br>方法 or 属性: [key: string]: BundleStatsInfo;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: usageStatistics<br>方法 or 属性: function queryBundleStatsInfos(begin: number, end: number, callback: AsyncCallback\<BundleStatsMap>): void;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: usageStatistics<br>方法 or 属性: function queryBundleStatsInfos(begin: number, end: number): Promise\<BundleStatsMap>;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: IntervalType|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: IntervalType<br>方法 or 属性: BY_OPTIMIZED = 0|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: IntervalType<br>方法 or 属性: BY_DAILY = 1|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: IntervalType<br>方法 or 属性: BY_WEEKLY = 2|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: IntervalType<br>方法 or 属性: BY_MONTHLY = 3|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: IntervalType<br>方法 or 属性: BY_ANNUALLY = 4|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: usageStatistics<br>方法 or 属性: function queryBundleStatsInfoByInterval(byInterval: IntervalType, begin: number, end: number, callback: AsyncCallback\<Array\<BundleStatsInfo>>): void;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: usageStatistics<br>方法 or 属性: function queryBundleStatsInfoByInterval(byInterval: IntervalType, begin: number, end: number): Promise\<Array\<BundleStatsInfo>>;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: usageStatistics<br>方法 or 属性: function queryBundleEvents(begin: number, end: number, callback: AsyncCallback\<Array\<BundleEvents>>): void;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: usageStatistics<br>方法 or 属性: function queryBundleEvents(begin: number, end: number): Promise\<Array\<BundleEvents>>;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: usageStatistics<br>方法 or 属性: function queryCurrentBundleEvents(begin: number, end: number, callback: AsyncCallback\<Array\<BundleEvents>>): void;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: usageStatistics<br>方法 or 属性: function queryCurrentBundleEvents(begin: number, end: number): Promise\<Array\<BundleEvents>>;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: usageStatistics<br>方法 or 属性: function queryModuleUsageRecords(maxNum: number, callback: AsyncCallback\<Array\<HapModuleInfo>>): void;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: usageStatistics<br>方法 or 属性: function queryModuleUsageRecords(maxNum: number): Promise\<Array\<HapModuleInfo>>;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: usageStatistics<br>方法 or 属性: function queryModuleUsageRecords(callback: AsyncCallback\<Array\<HapModuleInfo>>): void;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: usageStatistics<br>方法 or 属性: function queryModuleUsageRecords(): Promise\<Array\<HapModuleInfo>>;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: GroupType|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: GroupType<br>方法 or 属性: ALIVE_GROUP = 10|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: GroupType<br>方法 or 属性: DAILY_GROUP = 20|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: GroupType<br>方法 or 属性: FIXED_GROUP = 30|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: GroupType<br>方法 or 属性: RARE_GROUP = 40|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: GroupType<br>方法 or 属性: LIMITED_GROUP = 50|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: GroupType<br>方法 or 属性: NEVER_GROUP = 60|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: usageStatistics<br>方法 or 属性: function setAppGroup(bundleName: string, newGroup: GroupType, callback: AsyncCallback\<void>): void;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: usageStatistics<br>方法 or 属性: function setAppGroup(bundleName: string, newGroup: GroupType): Promise\<void>;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: usageStatistics<br>方法 or 属性: function registerAppGroupCallBack(groupCallback: Callback\<AppGroupCallbackInfo>, callback: AsyncCallback\<void>): void;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: usageStatistics<br>方法 or 属性: function registerAppGroupCallBack(groupCallback: Callback\<AppGroupCallbackInfo>): Promise\<void>;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: usageStatistics<br>方法 or 属性: function unregisterAppGroupCallBack(callback: AsyncCallback\<void>): void;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: usageStatistics<br>方法 or 属性: function unregisterAppGroupCallBack(): Promise\<void>;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: usageStatistics<br>方法 or 属性: function queryDeviceEventStats(begin: number, end: number, callback: AsyncCallback\<Array\<DeviceEventStats>>): void;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: usageStatistics<br>方法 or 属性: function queryDeviceEventStats(begin: number, end: number): Promise\<Array\<DeviceEventStats>>;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: usageStatistics<br>方法 or 属性: function queryNotificationEventStats(begin: number, end: number, callback: AsyncCallback\<Array\<DeviceEventStats>>): void;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.usageStatistics<br>类名: usageStatistics<br>方法 or 属性: function queryNotificationEventStats(begin: number, end: number): Promise\<Array\<DeviceEventStats>>;|@ohos.resourceschedule.usageStatistics.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: workScheduler|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: WorkInfo|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: WorkInfo<br>方法 or 属性: workId: number;|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: WorkInfo<br>方法 or 属性: bundleName: string;|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: WorkInfo<br>方法 or 属性: abilityName: string;|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: WorkInfo<br>方法 or 属性: isPersisted?: boolean;|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: WorkInfo<br>方法 or 属性: networkType?: NetworkType;|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: WorkInfo<br>方法 or 属性: isCharging?: boolean;|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: WorkInfo<br>方法 or 属性: chargerType?: ChargingType;|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: WorkInfo<br>方法 or 属性: batteryLevel?: number;|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: WorkInfo<br>方法 or 属性: batteryStatus?: BatteryStatus;|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: WorkInfo<br>方法 or 属性: storageRequest?: StorageRequest;|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: WorkInfo<br>方法 or 属性: repeatCycleTime?: number;|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: WorkInfo<br>方法 or 属性: isRepeat?: boolean;|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: WorkInfo<br>方法 or 属性: repeatCount?: number;|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: WorkInfo<br>方法 or 属性: isDeepIdle?: boolean;|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: WorkInfo<br>方法 or 属性: idleWaitTime?: number;|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: WorkInfo<br>方法 or 属性: parameters?: {[key: string]: number \| string \| boolean};|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: workScheduler<br>方法 or 属性: function startWork(work: WorkInfo): void;|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: workScheduler<br>方法 or 属性: function stopWork(work: WorkInfo, needCancel?: boolean): void;|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: workScheduler<br>方法 or 属性: function getWorkStatus(workId: number, callback: AsyncCallback\<WorkInfo>): void;|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: workScheduler<br>方法 or 属性: function getWorkStatus(workId: number): Promise\<WorkInfo>;|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: workScheduler<br>方法 or 属性: function obtainAllWorks(callback: AsyncCallback\<void>): Array\<WorkInfo>;|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: workScheduler<br>方法 or 属性: function obtainAllWorks(): Promise\<Array\<WorkInfo>>;|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: workScheduler<br>方法 or 属性: function stopAndClearWorks(): void;|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: workScheduler<br>方法 or 属性: function isLastWorkTimeOut(workId: number, callback: AsyncCallback\<void>): boolean;|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: workScheduler<br>方法 or 属性: function isLastWorkTimeOut(workId: number): Promise\<boolean>;|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: NetworkType|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: NetworkType<br>方法 or 属性: NETWORK_TYPE_ANY = 0|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: NetworkType<br>方法 or 属性: NETWORK_TYPE_MOBILE|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: NetworkType<br>方法 or 属性: NETWORK_TYPE_WIFI|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: NetworkType<br>方法 or 属性: NETWORK_TYPE_BLUETOOTH|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: NetworkType<br>方法 or 属性: NETWORK_TYPE_WIFI_P2P|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: NetworkType<br>方法 or 属性: NETWORK_TYPE_ETHERNET|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: ChargingType|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: ChargingType<br>方法 or 属性: CHARGING_PLUGGED_ANY = 0|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: ChargingType<br>方法 or 属性: CHARGING_PLUGGED_AC|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: ChargingType<br>方法 or 属性: CHARGING_PLUGGED_USB|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: ChargingType<br>方法 or 属性: CHARGING_PLUGGED_WIRELESS|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: BatteryStatus|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: BatteryStatus<br>方法 or 属性: BATTERY_STATUS_LOW = 0|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: BatteryStatus<br>方法 or 属性: BATTERY_STATUS_OKAY|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: BatteryStatus<br>方法 or 属性: BATTERY_STATUS_LOW_OR_OKAY|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: StorageRequest|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: StorageRequest<br>方法 or 属性: STORAGE_LEVEL_LOW = 0|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: StorageRequest<br>方法 or 属性: STORAGE_LEVEL_OKAY|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.resourceschedule.workScheduler<br>类名: StorageRequest<br>方法 or 属性: STORAGE_LEVEL_LOW_OR_OKAY|@ohos.resourceschedule.workScheduler.d.ts| +|新增|NA|模块名: ohos.WorkSchedulerExtensionAbility<br>类名: WorkSchedulerExtensionAbility|@ohos.WorkSchedulerExtensionAbility.d.ts| +|新增|NA|模块名: ohos.WorkSchedulerExtensionAbility<br>类名: WorkSchedulerExtensionAbility<br>方法 or 属性: onWorkStart(work: workScheduler.WorkInfo): void;|@ohos.WorkSchedulerExtensionAbility.d.ts| +|新增|NA|模块名: ohos.WorkSchedulerExtensionAbility<br>类名: WorkSchedulerExtensionAbility<br>方法 or 属性: onWorkStop(work: workScheduler.WorkInfo): void;|@ohos.WorkSchedulerExtensionAbility.d.ts| +|废弃版本有变化|类名:particleAbility<br>方法 or 属性:function startBackgroundRunning(id: number, request: NotificationRequest, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:particleAbility<br>方法 or 属性:function startBackgroundRunning(id: number, request: NotificationRequest, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.resourceschedule.backgroundTaskManager.startBackgroundRunning |@ohos.ability.particleAbility.d.ts| +|废弃版本有变化|类名:particleAbility<br>方法 or 属性:function startBackgroundRunning(id: number, request: NotificationRequest): Promise\<void>;<br>废弃版本:N/A|类名:particleAbility<br>方法 or 属性:function startBackgroundRunning(id: number, request: NotificationRequest): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.resourceschedule.backgroundTaskManager.startBackgroundRunning |@ohos.ability.particleAbility.d.ts| +|废弃版本有变化|类名:particleAbility<br>方法 or 属性:function cancelBackgroundRunning(callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:particleAbility<br>方法 or 属性:function cancelBackgroundRunning(callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.resourceschedule.backgroundTaskManager.stopBackgroundRunning |@ohos.ability.particleAbility.d.ts| +|废弃版本有变化|类名:particleAbility<br>方法 or 属性:function cancelBackgroundRunning(): Promise\<void>;<br>废弃版本:N/A|类名:particleAbility<br>方法 or 属性:function cancelBackgroundRunning(): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.resourceschedule.backgroundTaskManager.stopBackgroundRunning |@ohos.ability.particleAbility.d.ts| +|废弃版本有变化|类名:backgroundTaskManager<br>废弃版本:N/A|类名:backgroundTaskManager<br>废弃版本:9<br>代替接口:ohos.resourceschedule.backgroundTaskManager |@ohos.backgroundTaskManager.d.ts| +|废弃版本有变化|类名:DelaySuspendInfo<br>废弃版本:N/A|类名:DelaySuspendInfo<br>废弃版本:9<br>代替接口:ohos.resourceschedule.backgroundTaskManager.DelaySuspendInfo |@ohos.backgroundTaskManager.d.ts| +|废弃版本有变化|类名:backgroundTaskManager<br>方法 or 属性:function cancelSuspendDelay(requestId: number): void;<br>废弃版本:N/A|类名:backgroundTaskManager<br>方法 or 属性:function cancelSuspendDelay(requestId: number): void;<br>废弃版本:9<br>代替接口:ohos.resourceschedule.backgroundTaskManager.cancelSuspendDelay |@ohos.backgroundTaskManager.d.ts| +|废弃版本有变化|类名:backgroundTaskManager<br>方法 or 属性:function getRemainingDelayTime(requestId: number, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:backgroundTaskManager<br>方法 or 属性:function getRemainingDelayTime(requestId: number, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.resourceschedule.backgroundTaskManager.getRemainingDelayTime |@ohos.backgroundTaskManager.d.ts| +|废弃版本有变化|类名:backgroundTaskManager<br>方法 or 属性:function getRemainingDelayTime(requestId: number): Promise\<number>;<br>废弃版本:N/A|类名:backgroundTaskManager<br>方法 or 属性:function getRemainingDelayTime(requestId: number): Promise\<number>;<br>废弃版本:9<br>代替接口:ohos.resourceschedule.backgroundTaskManager.getRemainingDelayTime |@ohos.backgroundTaskManager.d.ts| +|废弃版本有变化|类名:backgroundTaskManager<br>方法 or 属性:function requestSuspendDelay(reason: string, callback: Callback\<void>): DelaySuspendInfo;<br>废弃版本:N/A|类名:backgroundTaskManager<br>方法 or 属性:function requestSuspendDelay(reason: string, callback: Callback\<void>): DelaySuspendInfo;<br>废弃版本:9<br>代替接口:ohos.resourceschedule.backgroundTaskManager.requestSuspendDelay |@ohos.backgroundTaskManager.d.ts| +|废弃版本有变化|类名:backgroundTaskManager<br>方法 or 属性:function startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:backgroundTaskManager<br>方法 or 属性:function startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.resourceschedule.backgroundTaskManager.startBackgroundRunning |@ohos.backgroundTaskManager.d.ts| +|废弃版本有变化|类名:backgroundTaskManager<br>方法 or 属性:function startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent): Promise\<void>;<br>废弃版本:N/A|类名:backgroundTaskManager<br>方法 or 属性:function startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.resourceschedule.backgroundTaskManager.startBackgroundRunning |@ohos.backgroundTaskManager.d.ts| +|废弃版本有变化|类名:backgroundTaskManager<br>方法 or 属性:function stopBackgroundRunning(context: Context, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:backgroundTaskManager<br>方法 or 属性:function stopBackgroundRunning(context: Context, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.resourceschedule.backgroundTaskManager.stopBackgroundRunning |@ohos.backgroundTaskManager.d.ts| +|废弃版本有变化|类名:backgroundTaskManager<br>方法 or 属性:function stopBackgroundRunning(context: Context): Promise\<void>;<br>废弃版本:N/A|类名:backgroundTaskManager<br>方法 or 属性:function stopBackgroundRunning(context: Context): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.resourceschedule.backgroundTaskManager.stopBackgroundRunning |@ohos.backgroundTaskManager.d.ts| +|废弃版本有变化|类名:BackgroundMode<br>废弃版本:N/A|类名:BackgroundMode<br>废弃版本:9<br>代替接口:ohos.resourceschedule.backgroundTaskManager.BackgroundMode |@ohos.backgroundTaskManager.d.ts| +|废弃版本有变化|类名:bundleState<br>废弃版本:N/A|类名:bundleState<br>废弃版本:9<br>代替接口:ohos.resourceschedule.usageStatistics |@ohos.bundleState.d.ts| +|废弃版本有变化|类名:BundleStateInfo<br>废弃版本:N/A|类名:BundleStateInfo<br>废弃版本:9<br>代替接口:ohos.resourceschedule.usageStatistics.BundleStatsInfo |@ohos.bundleState.d.ts| +|废弃版本有变化|类名:BundleActiveState<br>废弃版本:N/A|类名:BundleActiveState<br>废弃版本:9<br>代替接口:ohos.resourceschedule.usageStatistics.BundleEvents |@ohos.bundleState.d.ts| +|废弃版本有变化|类名:bundleState<br>方法 or 属性:function isIdleState(bundleName: string, callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:bundleState<br>方法 or 属性:function isIdleState(bundleName: string, callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:ohos.resourceschedule.usageStatistics.isIdleState |@ohos.bundleState.d.ts| +|废弃版本有变化|类名:bundleState<br>方法 or 属性:function isIdleState(bundleName: string): Promise\<boolean>;<br>废弃版本:N/A|类名:bundleState<br>方法 or 属性:function isIdleState(bundleName: string): Promise\<boolean>;<br>废弃版本:9<br>代替接口:ohos.resourceschedule.usageStatistics.isIdleState |@ohos.bundleState.d.ts| +|废弃版本有变化|类名:bundleState<br>方法 or 属性:function queryAppUsagePriorityGroup(callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:bundleState<br>方法 or 属性:function queryAppUsagePriorityGroup(callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:ohos.resourceschedule.usageStatistics.queryAppGroup |@ohos.bundleState.d.ts| +|废弃版本有变化|类名:bundleState<br>方法 or 属性:function queryAppUsagePriorityGroup(): Promise\<number>;<br>废弃版本:N/A|类名:bundleState<br>方法 or 属性:function queryAppUsagePriorityGroup(): Promise\<number>;<br>废弃版本:9<br>代替接口:ohos.resourceschedule.usageStatistics.queryAppGroup |@ohos.bundleState.d.ts| +|废弃版本有变化|类名:BundleActiveInfoResponse<br>废弃版本:N/A|类名:BundleActiveInfoResponse<br>废弃版本:9<br>代替接口:ohos.resourceschedule.usageStatistics.BundleStatsMap |@ohos.bundleState.d.ts| +|废弃版本有变化|类名:bundleState<br>方法 or 属性:function queryBundleStateInfos(begin: number, end: number, callback: AsyncCallback\<BundleActiveInfoResponse>): void;<br>废弃版本:N/A|类名:bundleState<br>方法 or 属性:function queryBundleStateInfos(begin: number, end: number, callback: AsyncCallback\<BundleActiveInfoResponse>): void;<br>废弃版本:9<br>代替接口:ohos.resourceschedule.usageStatistics.queryBundleStatsInfos |@ohos.bundleState.d.ts| +|废弃版本有变化|类名:bundleState<br>方法 or 属性:function queryBundleStateInfos(begin: number, end: number): Promise\<BundleActiveInfoResponse>;<br>废弃版本:N/A|类名:bundleState<br>方法 or 属性:function queryBundleStateInfos(begin: number, end: number): Promise\<BundleActiveInfoResponse>;<br>废弃版本:9<br>代替接口:ohos.resourceschedule.usageStatistics.queryBundleStatsInfos |@ohos.bundleState.d.ts| +|废弃版本有变化|类名:IntervalType<br>废弃版本:N/A|类名:IntervalType<br>废弃版本:9<br>代替接口:ohos.resourceschedule.usageStatistics.IntervalType |@ohos.bundleState.d.ts| +|废弃版本有变化|类名:bundleState<br>方法 or 属性:function queryBundleStateInfoByInterval(byInterval: IntervalType, begin: number, end: number, callback: AsyncCallback\<Array\<BundleStateInfo>>): void;<br>废弃版本:N/A|类名:bundleState<br>方法 or 属性:function queryBundleStateInfoByInterval(byInterval: IntervalType, begin: number, end: number, callback: AsyncCallback\<Array\<BundleStateInfo>>): void;<br>废弃版本:9<br>代替接口:ohos.resourceschedule.usageStatistics.queryBundleStatsInfoByInterval |@ohos.bundleState.d.ts| +|废弃版本有变化|类名:bundleState<br>方法 or 属性:function queryBundleStateInfoByInterval(byInterval: IntervalType, begin: number, end: number): Promise\<Array\<BundleStateInfo>>;<br>废弃版本:N/A|类名:bundleState<br>方法 or 属性:function queryBundleStateInfoByInterval(byInterval: IntervalType, begin: number, end: number): Promise\<Array\<BundleStateInfo>>;<br>废弃版本:9<br>代替接口:ohos.resourceschedule.usageStatistics.queryBundleStatsInfoByInterval |@ohos.bundleState.d.ts| +|废弃版本有变化|类名:bundleState<br>方法 or 属性:function queryBundleActiveStates(begin: number, end: number, callback: AsyncCallback\<Array\<BundleActiveState>>): void;<br>废弃版本:N/A|类名:bundleState<br>方法 or 属性:function queryBundleActiveStates(begin: number, end: number, callback: AsyncCallback\<Array\<BundleActiveState>>): void;<br>废弃版本:9<br>代替接口:ohos.resourceschedule.usageStatistics.queryBundleEvents |@ohos.bundleState.d.ts| +|废弃版本有变化|类名:bundleState<br>方法 or 属性:function queryBundleActiveStates(begin: number, end: number): Promise\<Array\<BundleActiveState>>;<br>废弃版本:N/A|类名:bundleState<br>方法 or 属性:function queryBundleActiveStates(begin: number, end: number): Promise\<Array\<BundleActiveState>>;<br>废弃版本:9<br>代替接口:ohos.resourceschedule.usageStatistics.queryBundleEvents |@ohos.bundleState.d.ts| +|废弃版本有变化|类名:bundleState<br>方法 or 属性:function queryCurrentBundleActiveStates(begin: number, end: number, callback: AsyncCallback\<Array\<BundleActiveState>>): void;<br>废弃版本:N/A|类名:bundleState<br>方法 or 属性:function queryCurrentBundleActiveStates(begin: number, end: number, callback: AsyncCallback\<Array\<BundleActiveState>>): void;<br>废弃版本:9<br>代替接口:ohos.resourceschedule.usageStatistics.queryCurrentBundleEvents |@ohos.bundleState.d.ts| +|废弃版本有变化|类名:bundleState<br>方法 or 属性:function queryCurrentBundleActiveStates(begin: number, end: number): Promise\<Array\<BundleActiveState>>;<br>废弃版本:N/A|类名:bundleState<br>方法 or 属性:function queryCurrentBundleActiveStates(begin: number, end: number): Promise\<Array\<BundleActiveState>>;<br>废弃版本:9<br>代替接口:ohos.resourceschedule.usageStatistics.queryCurrentBundleEvents |@ohos.bundleState.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-security.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-security.md new file mode 100644 index 0000000000000000000000000000000000000000..10c57766cee349b5e2f36229a038dd0d67c500d4 --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-security.md @@ -0,0 +1,512 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|类名:AtManager<br>方法or属性:verifyAccessTokenSync(tokenID: number, permissionName: Permissions): GrantStatus;|@ohos.abilityAccessCtrl.d.ts| +|新增|NA|类名:AtManager<br>方法or属性:checkAccessToken(tokenID: number, permissionName: Permissions): Promise\<GrantStatus>;|@ohos.abilityAccessCtrl.d.ts| +|新增|NA|类名:AtManager<br>方法or属性:requestPermissionsFromUser(context: Context, permissionList: Array\<Permissions>, requestCallback: AsyncCallback\<PermissionRequestResult>) : void;|@ohos.abilityAccessCtrl.d.ts| +|新增|NA|类名:AtManager<br>方法or属性:requestPermissionsFromUser(context: Context, permissionList: Array\<Permissions>) : Promise\<PermissionRequestResult>;|@ohos.abilityAccessCtrl.d.ts| +|新增|NA|类名:AtManager<br>方法or属性:getVersion(): Promise\<number>;|@ohos.abilityAccessCtrl.d.ts| +|新增|NA|类名:AtManager<br>方法or属性:on(type: 'permissionStateChange', tokenIDList: Array\<number>, permissionList: Array\<Permissions>, callback: Callback\<PermissionStateChangeInfo>): void;|@ohos.abilityAccessCtrl.d.ts| +|新增|NA|类名:AtManager<br>方法or属性:off(type: 'permissionStateChange', tokenIDList: Array\<number>, permissionList: Array\<Permissions>, callback?: Callback\<PermissionStateChangeInfo>): void;|@ohos.abilityAccessCtrl.d.ts| +|新增|NA|模块名: ohos.abilityAccessCtrl<br>类名: PermissionStateChangeType|@ohos.abilityAccessCtrl.d.ts| +|新增|NA|类名:PermissionStateChangeType<br>方法or属性:|@ohos.abilityAccessCtrl.d.ts| +|新增|NA|模块名: ohos.abilityAccessCtrl<br>类名: PermissionStateChangeType<br>方法 or 属性:PERMISSION_REVOKED_OPER = 0|@ohos.abilityAccessCtrl.d.ts| +|新增|NA|类名:PermissionStateChangeType<br>方法or属性:PERMISSION_REVOKED_OPER = 0|@ohos.abilityAccessCtrl.d.ts| +|新增|NA|模块名: ohos.abilityAccessCtrl<br>类名: PermissionStateChangeType<br>方法 or 属性:PERMISSION_GRANTED_OPER = 1|@ohos.abilityAccessCtrl.d.ts| +|新增|NA|类名:PermissionStateChangeType<br>方法or属性:PERMISSION_GRANTED_OPER = 1|@ohos.abilityAccessCtrl.d.ts| +|新增|NA|模块名: ohos.abilityAccessCtrl<br>类名: PermissionStateChangeInfo|@ohos.abilityAccessCtrl.d.ts| +|新增|NA|类名:PermissionStateChangeInfo<br>方法or属性:|@ohos.abilityAccessCtrl.d.ts| +|新增|NA|模块名: ohos.abilityAccessCtrl<br>类名: PermissionStateChangeInfo<br>方法 or 属性:change: PermissionStateChangeType;|@ohos.abilityAccessCtrl.d.ts| +|新增|NA|类名:PermissionStateChangeInfo<br>方法or属性:change: PermissionStateChangeType;|@ohos.abilityAccessCtrl.d.ts| +|新增|NA|模块名: ohos.abilityAccessCtrl<br>类名: PermissionStateChangeInfo<br>方法 or 属性:tokenID: number;|@ohos.abilityAccessCtrl.d.ts| +|新增|NA|类名:PermissionStateChangeInfo<br>方法or属性:tokenID: number;|@ohos.abilityAccessCtrl.d.ts| +|新增|NA|模块名: ohos.abilityAccessCtrl<br>类名: PermissionStateChangeInfo<br>方法 or 属性:permissionName: Permissions;|@ohos.abilityAccessCtrl.d.ts| +|新增|NA|类名:PermissionStateChangeInfo<br>方法or属性:permissionName: Permissions;|@ohos.abilityAccessCtrl.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: privacyManager|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: privacyManager<br>方法 or 属性: function addPermissionUsedRecord(tokenID: number, permissionName: Permissions, successCount: number, failCount: number): Promise\<void>;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: privacyManager<br>方法 or 属性: function addPermissionUsedRecord(tokenID: number, permissionName: Permissions, successCount: number, failCount: number, callback: AsyncCallback\<void>): void;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: privacyManager<br>方法 or 属性: function getPermissionUsedRecord(request: PermissionUsedRequest): Promise\<PermissionUsedResponse>;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: privacyManager<br>方法 or 属性: function getPermissionUsedRecord(request: PermissionUsedRequest, callback: AsyncCallback\<PermissionUsedResponse>): void;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: privacyManager<br>方法 or 属性: function startUsingPermission(tokenID: number, permissionName: Permissions): Promise\<void>;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: privacyManager<br>方法 or 属性: function startUsingPermission(tokenID: number, permissionName: Permissions, callback: AsyncCallback\<void>): void;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: privacyManager<br>方法 or 属性: function stopUsingPermission(tokenID: number, permissionName: Permissions): Promise\<void>;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: privacyManager<br>方法 or 属性: function stopUsingPermission(tokenID: number, permissionName: Permissions, callback: AsyncCallback\<void>): void;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: privacyManager<br>方法 or 属性: function on(type: 'activeStateChange', permissionList: Array\<Permissions>, callback: Callback\<ActiveChangeResponse>): void;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: privacyManager<br>方法 or 属性: function off(type: 'activeStateChange', permissionList: Array\<Permissions>, callback?: Callback\<ActiveChangeResponse>): void;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: PermissionActiveStatus|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: PermissionActiveStatus<br>方法 or 属性: PERM_INACTIVE = 0|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: PermissionActiveStatus<br>方法 or 属性: PERM_ACTIVE_IN_FOREGROUND = 1|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: PermissionActiveStatus<br>方法 or 属性: PERM_ACTIVE_IN_BACKGROUND = 2|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: ActiveChangeResponse|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: ActiveChangeResponse<br>方法 or 属性: tokenId: number;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: ActiveChangeResponse<br>方法 or 属性: permissionName: Permissions;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: ActiveChangeResponse<br>方法 or 属性: deviceId: string;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: ActiveChangeResponse<br>方法 or 属性: activeStatus: PermissionActiveStatus;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: PermissionUsageFlag|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: PermissionUsageFlag<br>方法 or 属性: FLAG_PERMISSION_USAGE_SUMMARY = 0|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: PermissionUsageFlag<br>方法 or 属性: FLAG_PERMISSION_USAGE_DETAIL = 1|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: PermissionUsedRequest|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: PermissionUsedRequest<br>方法 or 属性: tokenId: number;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: PermissionUsedRequest<br>方法 or 属性: isRemote: boolean;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: PermissionUsedRequest<br>方法 or 属性: deviceId: string;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: PermissionUsedRequest<br>方法 or 属性: bundleName: string;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: PermissionUsedRequest<br>方法 or 属性: permissionNames: Array\<Permissions>;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: PermissionUsedRequest<br>方法 or 属性: beginTime: number;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: PermissionUsedRequest<br>方法 or 属性: endTime: number;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: PermissionUsedRequest<br>方法 or 属性: flag: PermissionUsageFlag;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: PermissionUsedResponse|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: PermissionUsedResponse<br>方法 or 属性: beginTime: number;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: PermissionUsedResponse<br>方法 or 属性: endTime: number;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: PermissionUsedResponse<br>方法 or 属性: bundleRecords: Array\<BundleUsedRecord>;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: BundleUsedRecord|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: BundleUsedRecord<br>方法 or 属性: tokenId: number;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: BundleUsedRecord<br>方法 or 属性: isRemote: boolean;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: BundleUsedRecord<br>方法 or 属性: deviceId: string;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: BundleUsedRecord<br>方法 or 属性: bundleName: string;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: BundleUsedRecord<br>方法 or 属性: permissionRecords: Array\<PermissionUsedRecord>;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: PermissionUsedRecord|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: PermissionUsedRecord<br>方法 or 属性: permissionName: Permissions;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: PermissionUsedRecord<br>方法 or 属性: accessCount: number;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: PermissionUsedRecord<br>方法 or 属性: rejectCount: number;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: PermissionUsedRecord<br>方法 or 属性: lastAccessTime: number;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: PermissionUsedRecord<br>方法 or 属性: lastRejectTime: number;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: PermissionUsedRecord<br>方法 or 属性: lastAccessDuration: number;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: PermissionUsedRecord<br>方法 or 属性: accessRecords: Array\<UsedRecordDetail>;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: PermissionUsedRecord<br>方法 or 属性: rejectRecords: Array\<UsedRecordDetail>;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: UsedRecordDetail|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: UsedRecordDetail<br>方法 or 属性: status: number;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: UsedRecordDetail<br>方法 or 属性: timestamp: number;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.privacyManager<br>类名: UsedRecordDetail<br>方法 or 属性: accessDuration: number;|@ohos.privacyManager.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: cert|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: CertResult|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: CertResult<br>方法 or 属性: INVALID_PARAMS = 401|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: CertResult<br>方法 or 属性: NOT_SUPPORT = 801|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: CertResult<br>方法 or 属性: ERR_OUT_OF_MEMORY = 19020001|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: CertResult<br>方法 or 属性: ERR_RUNTIME_ERROR = 19020002|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: CertResult<br>方法 or 属性: ERR_CRYPTO_OPERATION = 19030001|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: CertResult<br>方法 or 属性: ERR_CERT_SIGNATURE_FAILURE = 19030002|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: CertResult<br>方法 or 属性: ERR_CERT_NOT_YET_VALID = 19030003|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: CertResult<br>方法 or 属性: ERR_CERT_HAS_EXPIRED = 19030004|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: CertResult<br>方法 or 属性: ERR_UNABLE_TO_GET_ISSUER_CERT_LOCALLY = 19030005|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: CertResult<br>方法 or 属性: ERR_KEYUSAGE_NO_CERTSIGN = 19030006|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: CertResult<br>方法 or 属性: ERR_KEYUSAGE_NO_DIGITAL_SIGNATURE = 19030007|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: DataBlob|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: DataBlob<br>方法 or 属性: data : Uint8Array;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: DataArray|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: DataArray<br>方法 or 属性: data : Array\<Uint8Array>;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: EncodingFormat|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: EncodingFormat<br>方法 or 属性: FORMAT_DER = 0|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: EncodingFormat<br>方法 or 属性: FORMAT_PEM = 1|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: EncodingBlob|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: EncodingBlob<br>方法 or 属性: data : Uint8Array;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: EncodingBlob<br>方法 or 属性: encodingFormat : EncodingFormat;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: CertChainData|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: CertChainData<br>方法 or 属性: data: Uint8Array;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: CertChainData<br>方法 or 属性: count : number;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: CertChainData<br>方法 or 属性: encodingFormat: EncodingFormat;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Cert|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Cert<br>方法 or 属性: verify(key : cryptoFramework.PubKey, callback : AsyncCallback\<void>) : void;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Cert<br>方法 or 属性: verify(key : cryptoFramework.PubKey) : Promise\<void>;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Cert<br>方法 or 属性: getEncoded(callback : AsyncCallback\<EncodingBlob>) : void;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Cert<br>方法 or 属性: getEncoded() : Promise\<EncodingBlob>;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Cert<br>方法 or 属性: getPublicKey() : cryptoFramework.PubKey;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Cert<br>方法 or 属性: checkValidityWithDate(date: string) : void;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Cert<br>方法 or 属性: getVersion() : number;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Cert<br>方法 or 属性: getSerialNumber() : number;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Cert<br>方法 or 属性: getIssuerName() : DataBlob;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Cert<br>方法 or 属性: getSubjectName() : DataBlob;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Cert<br>方法 or 属性: getNotBeforeTime() : string;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Cert<br>方法 or 属性: getNotAfterTime() : string;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Cert<br>方法 or 属性: getSignature() : DataBlob;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Cert<br>方法 or 属性: getSignatureAlgName() : string;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Cert<br>方法 or 属性: getSignatureAlgOid() : string;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Cert<br>方法 or 属性: getSignatureAlgParams() : DataBlob;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Cert<br>方法 or 属性: getKeyUsage() : DataBlob;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Cert<br>方法 or 属性: getExtKeyUsage() : DataArray;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Cert<br>方法 or 属性: getBasicConstraints() : number;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Cert<br>方法 or 属性: getSubjectAltNames() : DataArray;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Cert<br>方法 or 属性: getIssuerAltNames() : DataArray;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: cert<br>方法 or 属性: function createX509Cert(inStream : EncodingBlob, callback : AsyncCallback\<X509Cert>) : void;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: cert<br>方法 or 属性: function createX509Cert(inStream : EncodingBlob) : Promise\<X509Cert>;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509CrlEntry|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509CrlEntry<br>方法 or 属性: getEncoded(callback : AsyncCallback\<EncodingBlob>) : void;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509CrlEntry<br>方法 or 属性: getEncoded() : Promise\<EncodingBlob>;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509CrlEntry<br>方法 or 属性: getSerialNumber() : number;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509CrlEntry<br>方法 or 属性: getCertIssuer() : DataBlob;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509CrlEntry<br>方法 or 属性: getRevocationDate() : string;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Crl|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Crl<br>方法 or 属性: isRevoked(cert : X509Cert) : boolean;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Crl<br>方法 or 属性: getType() : string;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Crl<br>方法 or 属性: getEncoded(callback : AsyncCallback\<EncodingBlob>) : void;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Crl<br>方法 or 属性: getEncoded() : Promise\<EncodingBlob>;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Crl<br>方法 or 属性: verify(key : cryptoFramework.PubKey, callback : AsyncCallback\<void>) : void;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Crl<br>方法 or 属性: verify(key : cryptoFramework.PubKey) : Promise\<void>;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Crl<br>方法 or 属性: getVersion() : number;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Crl<br>方法 or 属性: getIssuerName() : DataBlob;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Crl<br>方法 or 属性: getLastUpdate() : string;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Crl<br>方法 or 属性: getNextUpdate() : string;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Crl<br>方法 or 属性: getRevokedCert(serialNumber : number) : X509CrlEntry;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Crl<br>方法 or 属性: getRevokedCertWithCert(cert : X509Cert) : X509CrlEntry;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Crl<br>方法 or 属性: getRevokedCerts(callback : AsyncCallback\<Array\<X509CrlEntry>>) : void;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Crl<br>方法 or 属性: getRevokedCerts() : Promise\<Array\<X509CrlEntry>>;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Crl<br>方法 or 属性: getTbsInfo() : DataBlob;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Crl<br>方法 or 属性: getSignature() : DataBlob;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Crl<br>方法 or 属性: getSignatureAlgName() : string;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Crl<br>方法 or 属性: getSignatureAlgOid() : string;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: X509Crl<br>方法 or 属性: getSignatureAlgParams() : DataBlob;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: cert<br>方法 or 属性: function createX509Crl(inStream : EncodingBlob, callback : AsyncCallback\<X509Crl>) : void;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: cert<br>方法 or 属性: function createX509Crl(inStream : EncodingBlob) : Promise\<X509Crl>;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: CertChainValidator|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: CertChainValidator<br>方法 or 属性: validate(certChain : CertChainData, callback : AsyncCallback\<void>) : void;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: CertChainValidator<br>方法 or 属性: validate(certChain : CertChainData) : Promise\<void>;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: CertChainValidator<br>方法 or 属性: readonly algorithm : string;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cert<br>类名: cert<br>方法 or 属性: function createCertChainValidator(algorithm :string) : CertChainValidator;|@ohos.security.cert.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: cryptoFramework|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Result|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Result<br>方法 or 属性: INVALID_PARAMS = 401|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Result<br>方法 or 属性: NOT_SUPPORT = 801|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Result<br>方法 or 属性: ERR_OUT_OF_MEMORY = 17620001|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Result<br>方法 or 属性: ERR_RUNTIME_ERROR = 17620002|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Result<br>方法 or 属性: ERR_CRYPTO_OPERATION = 17630001|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: DataBlob|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: DataBlob<br>方法 or 属性: data : Uint8Array;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: ParamsSpec|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: ParamsSpec<br>方法 or 属性: algName : string;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: IvParamsSpec|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: IvParamsSpec<br>方法 or 属性: iv : DataBlob;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: GcmParamsSpec|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: GcmParamsSpec<br>方法 or 属性: iv : DataBlob;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: GcmParamsSpec<br>方法 or 属性: aad : DataBlob;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: GcmParamsSpec<br>方法 or 属性: authTag : DataBlob;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: CcmParamsSpec|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: CcmParamsSpec<br>方法 or 属性: iv : DataBlob;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: CcmParamsSpec<br>方法 or 属性: aad : DataBlob;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: CcmParamsSpec<br>方法 or 属性: authTag : DataBlob;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: CryptoMode|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: CryptoMode<br>方法 or 属性: ENCRYPT_MODE = 0|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: CryptoMode<br>方法 or 属性: DECRYPT_MODE = 1|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Key|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Key<br>方法 or 属性: getEncoded() : DataBlob;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Key<br>方法 or 属性: readonly format : string;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Key<br>方法 or 属性: readonly algName : string;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: SymKey|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: SymKey<br>方法 or 属性: clearMem() : void;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: PriKey|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: PriKey<br>方法 or 属性: clearMem() : void;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: PubKey|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: KeyPair|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: KeyPair<br>方法 or 属性: readonly priKey : PriKey;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: KeyPair<br>方法 or 属性: readonly pubKey : PubKey;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Random|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Random<br>方法 or 属性: generateRandom(len : number, callback: AsyncCallback\<DataBlob>) : void;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Random<br>方法 or 属性: generateRandom(len : number) : Promise\<DataBlob>;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Random<br>方法 or 属性: setSeed(seed : DataBlob) : void;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: cryptoFramework<br>方法 or 属性: function createRandom() : Random;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: AsyKeyGenerator|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: AsyKeyGenerator<br>方法 or 属性: generateKeyPair(callback : AsyncCallback\<KeyPair>) : void;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: AsyKeyGenerator<br>方法 or 属性: generateKeyPair() : Promise\<KeyPair>;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: AsyKeyGenerator<br>方法 or 属性: convertKey(pubKey : DataBlob, priKey : DataBlob, callback : AsyncCallback\<KeyPair>) : void;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: AsyKeyGenerator<br>方法 or 属性: convertKey(pubKey : DataBlob, priKey : DataBlob) : Promise\<KeyPair>;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: AsyKeyGenerator<br>方法 or 属性: readonly algName : string;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: SymKeyGenerator|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: SymKeyGenerator<br>方法 or 属性: generateSymKey(callback : AsyncCallback\<SymKey>) : void;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: SymKeyGenerator<br>方法 or 属性: generateSymKey() : Promise\<SymKey>;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: SymKeyGenerator<br>方法 or 属性: convertKey(key : DataBlob, callback : AsyncCallback\<SymKey>) : void;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: SymKeyGenerator<br>方法 or 属性: convertKey(key : DataBlob) : Promise\<SymKey>;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: SymKeyGenerator<br>方法 or 属性: readonly algName : string;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: cryptoFramework<br>方法 or 属性: function createAsyKeyGenerator(algName : string) : AsyKeyGenerator;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: cryptoFramework<br>方法 or 属性: function createSymKeyGenerator(algName : string) : SymKeyGenerator;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Mac|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Mac<br>方法 or 属性: init(key : SymKey, callback : AsyncCallback\<void>) : void;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Mac<br>方法 or 属性: init(key : SymKey) : Promise\<void>;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Mac<br>方法 or 属性: update(input : DataBlob, callback : AsyncCallback\<void>) : void;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Mac<br>方法 or 属性: update(input : DataBlob) : Promise\<void>;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Mac<br>方法 or 属性: doFinal(callback : AsyncCallback\<DataBlob>) : void;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Mac<br>方法 or 属性: doFinal() : Promise\<DataBlob>;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Mac<br>方法 or 属性: getMacLength() : number;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Mac<br>方法 or 属性: readonly algName : string;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: cryptoFramework<br>方法 or 属性: function createMac(algName : string) : Mac;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Md|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Md<br>方法 or 属性: update(input : DataBlob, callback : AsyncCallback\<void>) : void;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Md<br>方法 or 属性: update(input : DataBlob) : Promise\<void>;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Md<br>方法 or 属性: digest(callback : AsyncCallback\<DataBlob>) : void;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Md<br>方法 or 属性: digest() : Promise\<DataBlob>;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Md<br>方法 or 属性: getMdLength() : number;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Md<br>方法 or 属性: readonly algName : string;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: cryptoFramework<br>方法 or 属性: function createMd(algName : string) : Md;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Cipher|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Cipher<br>方法 or 属性: init(opMode : CryptoMode, key : Key, params : ParamsSpec, callback : AsyncCallback\<void>) : void;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Cipher<br>方法 or 属性: init(opMode : CryptoMode, key : Key, params : ParamsSpec) : Promise\<void>;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Cipher<br>方法 or 属性: update(data : DataBlob, callback : AsyncCallback\<DataBlob>) : void;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Cipher<br>方法 or 属性: update(data : DataBlob) : Promise\<DataBlob>;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Cipher<br>方法 or 属性: doFinal(data : DataBlob, callback : AsyncCallback\<DataBlob>) : void;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Cipher<br>方法 or 属性: doFinal(data : DataBlob) : Promise\<DataBlob>;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Cipher<br>方法 or 属性: readonly algName : string;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: cryptoFramework<br>方法 or 属性: function createCipher(transformation : string) : Cipher;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Sign|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Sign<br>方法 or 属性: init(priKey : PriKey, callback : AsyncCallback\<void>) : void;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Sign<br>方法 or 属性: init(priKey : PriKey) : Promise\<void>;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Sign<br>方法 or 属性: update(data : DataBlob, callback : AsyncCallback\<void>) : void;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Sign<br>方法 or 属性: update(data : DataBlob) : Promise\<void>;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Sign<br>方法 or 属性: sign(data : DataBlob, callback : AsyncCallback\<DataBlob>) : void;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Sign<br>方法 or 属性: sign(data : DataBlob) : Promise\<DataBlob>;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Sign<br>方法 or 属性: readonly algName : string;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Verify|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Verify<br>方法 or 属性: init(pubKey : PubKey, callback : AsyncCallback\<void>) : void;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Verify<br>方法 or 属性: init(pubKey : PubKey) : Promise\<void>;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Verify<br>方法 or 属性: update(data : DataBlob, callback : AsyncCallback\<void>) : void;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Verify<br>方法 or 属性: update(data : DataBlob) : Promise\<void>;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Verify<br>方法 or 属性: verify(data : DataBlob, signatureData : DataBlob, callback : AsyncCallback\<boolean>) : void;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Verify<br>方法 or 属性: verify(data : DataBlob, signatureData : DataBlob) : Promise\<boolean>;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: Verify<br>方法 or 属性: readonly algName : string;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: cryptoFramework<br>方法 or 属性: function createSign(algName : string) : Sign;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: cryptoFramework<br>方法 or 属性: function createVerify(algName : string) : Verify;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: KeyAgreement|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: KeyAgreement<br>方法 or 属性: generateSecret(priKey : PriKey, pubKey : PubKey, callback : AsyncCallback\<DataBlob>) : void;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: KeyAgreement<br>方法 or 属性: generateSecret(priKey : PriKey, pubKey : PubKey) : Promise\<DataBlob>;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: KeyAgreement<br>方法 or 属性: readonly algName : string;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|模块名: ohos.security.cryptoFramework<br>类名: cryptoFramework<br>方法 or 属性: function createKeyAgreement(algName : string) : KeyAgreement;|@ohos.security.cryptoFramework.d.ts| +|新增|NA|类名:huks<br>方法or属性:function generateKeyItem(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<void>) : void;|@ohos.security.huks.d.ts| +|新增|NA|类名:huks<br>方法or属性:function generateKeyItem(keyAlias: string, options: HuksOptions) : Promise\<void>;|@ohos.security.huks.d.ts| +|新增|NA|类名:huks<br>方法or属性:function deleteKeyItem(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<void>) : void;|@ohos.security.huks.d.ts| +|新增|NA|类名:huks<br>方法or属性:function deleteKeyItem(keyAlias: string, options: HuksOptions) : Promise\<void>;|@ohos.security.huks.d.ts| +|新增|NA|类名:huks<br>方法or属性:function importKeyItem(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<void>) : void;|@ohos.security.huks.d.ts| +|新增|NA|类名:huks<br>方法or属性:function importKeyItem(keyAlias: string, options: HuksOptions) : Promise\<void>;|@ohos.security.huks.d.ts| +|新增|NA|类名:huks<br>方法or属性:function importWrappedKeyItem(keyAlias: string, wrappingKeyAlias: string, options: HuksOptions, callback: AsyncCallback\<void>) : void;|@ohos.security.huks.d.ts| +|新增|NA|类名:huks<br>方法or属性:function importWrappedKeyItem(keyAlias: string, wrappingKeyAlias: string, options: HuksOptions) : Promise\<void>;|@ohos.security.huks.d.ts| +|新增|NA|类名:huks<br>方法or属性:function exportKeyItem(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<HuksReturnResult>) : void;|@ohos.security.huks.d.ts| +|新增|NA|类名:huks<br>方法or属性:function exportKeyItem(keyAlias: string, options: HuksOptions) : Promise\<HuksReturnResult>;|@ohos.security.huks.d.ts| +|新增|NA|类名:huks<br>方法or属性:function getKeyItemProperties(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<HuksReturnResult>) : void;|@ohos.security.huks.d.ts| +|新增|NA|类名:huks<br>方法or属性:function getKeyItemProperties(keyAlias: string, options: HuksOptions) : Promise\<HuksReturnResult>;|@ohos.security.huks.d.ts| +|新增|NA|类名:huks<br>方法or属性:function isKeyItemExist(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<boolean>) : void;|@ohos.security.huks.d.ts| +|新增|NA|类名:huks<br>方法or属性:function isKeyItemExist(keyAlias: string, options: HuksOptions) : Promise\<boolean>;|@ohos.security.huks.d.ts| +|新增|NA|类名:huks<br>方法or属性:function initSession(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<HuksSessionHandle>) : void;|@ohos.security.huks.d.ts| +|新增|NA|类名:huks<br>方法or属性:function initSession(keyAlias: string, options: HuksOptions) : Promise\<HuksSessionHandle>;|@ohos.security.huks.d.ts| +|新增|NA|类名:huks<br>方法or属性:function updateSession(handle: number, options: HuksOptions, callback: AsyncCallback\<HuksReturnResult>) : void;|@ohos.security.huks.d.ts| +|新增|NA|类名:huks<br>方法or属性:function updateSession(handle: number, options: HuksOptions, token: Uint8Array, callback: AsyncCallback\<HuksReturnResult>) : void;|@ohos.security.huks.d.ts| +|新增|NA|类名:huks<br>方法or属性:function updateSession(handle: number, options: HuksOptions, token?: Uint8Array) : Promise\<HuksReturnResult>;|@ohos.security.huks.d.ts| +|新增|NA|类名:huks<br>方法or属性:function finishSession(handle: number, options: HuksOptions, callback: AsyncCallback\<HuksReturnResult>) : void;|@ohos.security.huks.d.ts| +|新增|NA|类名:huks<br>方法or属性:function finishSession(handle: number, options: HuksOptions, token: Uint8Array, callback: AsyncCallback\<HuksReturnResult>) : void;|@ohos.security.huks.d.ts| +|新增|NA|类名:huks<br>方法or属性:function finishSession(handle: number, options: HuksOptions, token?: Uint8Array) : Promise\<HuksReturnResult>;|@ohos.security.huks.d.ts| +|新增|NA|类名:huks<br>方法or属性:function abortSession(handle: number, options: HuksOptions, callback: AsyncCallback\<void>) : void;|@ohos.security.huks.d.ts| +|新增|NA|类名:huks<br>方法or属性:function abortSession(handle: number, options: HuksOptions) : Promise\<void>;|@ohos.security.huks.d.ts| +|新增|NA|类名:huks<br>方法or属性:function attestKeyItem(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<HuksReturnResult>) : void;|@ohos.security.huks.d.ts| +|新增|NA|类名:huks<br>方法or属性:function attestKeyItem(keyAlias: string, options: HuksOptions) : Promise\<HuksReturnResult>;|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksSessionHandle|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksSessionHandle<br>方法or属性:|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksSessionHandle<br>方法 or 属性:handle: number;|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksSessionHandle<br>方法or属性:handle: number;|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksSessionHandle<br>方法 or 属性:challenge?: Uint8Array;|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksSessionHandle<br>方法or属性:challenge?: Uint8Array;|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksReturnResult|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksReturnResult<br>方法or属性:|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksReturnResult<br>方法 or 属性:outData?: Uint8Array;|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksReturnResult<br>方法or属性:outData?: Uint8Array;|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksReturnResult<br>方法 or 属性:properties?: Array\<HuksParam>;|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksReturnResult<br>方法or属性:properties?: Array\<HuksParam>;|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksReturnResult<br>方法 or 属性:certChains?: Array\<string>;|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksReturnResult<br>方法or属性:certChains?: Array\<string>;|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksExceptionErrCode|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksExceptionErrCode<br>方法or属性:|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksExceptionErrCode<br>方法 or 属性:HUKS_ERR_CODE_PERMISSION_FAIL = 201|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksExceptionErrCode<br>方法or属性:HUKS_ERR_CODE_PERMISSION_FAIL = 201|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksExceptionErrCode<br>方法 or 属性:HUKS_ERR_CODE_ILLEGAL_ARGUMENT = 401|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksExceptionErrCode<br>方法or属性:HUKS_ERR_CODE_ILLEGAL_ARGUMENT = 401|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksExceptionErrCode<br>方法 or 属性:HUKS_ERR_CODE_NOT_SUPPORTED_API = 801|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksExceptionErrCode<br>方法or属性:HUKS_ERR_CODE_NOT_SUPPORTED_API = 801|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksExceptionErrCode<br>方法 or 属性:HUKS_ERR_CODE_FEATURE_NOT_SUPPORTED = 12000001|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksExceptionErrCode<br>方法or属性:HUKS_ERR_CODE_FEATURE_NOT_SUPPORTED = 12000001|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksExceptionErrCode<br>方法 or 属性:HUKS_ERR_CODE_MISSING_CRYPTO_ALG_ARGUMENT = 12000002|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksExceptionErrCode<br>方法or属性:HUKS_ERR_CODE_MISSING_CRYPTO_ALG_ARGUMENT = 12000002|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksExceptionErrCode<br>方法 or 属性:HUKS_ERR_CODE_INVALID_CRYPTO_ALG_ARGUMENT = 12000003|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksExceptionErrCode<br>方法or属性:HUKS_ERR_CODE_INVALID_CRYPTO_ALG_ARGUMENT = 12000003|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksExceptionErrCode<br>方法 or 属性:HUKS_ERR_CODE_FILE_OPERATION_FAIL = 12000004|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksExceptionErrCode<br>方法or属性:HUKS_ERR_CODE_FILE_OPERATION_FAIL = 12000004|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksExceptionErrCode<br>方法 or 属性:HUKS_ERR_CODE_COMMUNICATION_FAIL = 12000005|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksExceptionErrCode<br>方法or属性:HUKS_ERR_CODE_COMMUNICATION_FAIL = 12000005|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksExceptionErrCode<br>方法 or 属性:HUKS_ERR_CODE_CRYPTO_FAIL = 12000006|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksExceptionErrCode<br>方法or属性:HUKS_ERR_CODE_CRYPTO_FAIL = 12000006|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksExceptionErrCode<br>方法 or 属性:HUKS_ERR_CODE_KEY_AUTH_PERMANENTLY_INVALIDATED = 12000007|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksExceptionErrCode<br>方法or属性:HUKS_ERR_CODE_KEY_AUTH_PERMANENTLY_INVALIDATED = 12000007|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksExceptionErrCode<br>方法 or 属性:HUKS_ERR_CODE_KEY_AUTH_VERIFY_FAILED = 12000008|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksExceptionErrCode<br>方法or属性:HUKS_ERR_CODE_KEY_AUTH_VERIFY_FAILED = 12000008|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksExceptionErrCode<br>方法 or 属性:HUKS_ERR_CODE_KEY_AUTH_TIME_OUT = 12000009|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksExceptionErrCode<br>方法or属性:HUKS_ERR_CODE_KEY_AUTH_TIME_OUT = 12000009|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksExceptionErrCode<br>方法 or 属性:HUKS_ERR_CODE_SESSION_LIMIT = 12000010|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksExceptionErrCode<br>方法or属性:HUKS_ERR_CODE_SESSION_LIMIT = 12000010|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksExceptionErrCode<br>方法 or 属性:HUKS_ERR_CODE_ITEM_NOT_EXIST = 12000011|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksExceptionErrCode<br>方法or属性:HUKS_ERR_CODE_ITEM_NOT_EXIST = 12000011|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksExceptionErrCode<br>方法 or 属性:HUKS_ERR_CODE_EXTERNAL_ERROR = 12000012|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksExceptionErrCode<br>方法or属性:HUKS_ERR_CODE_EXTERNAL_ERROR = 12000012|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksExceptionErrCode<br>方法 or 属性:HUKS_ERR_CODE_CREDENTIAL_NOT_EXIST = 12000013|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksExceptionErrCode<br>方法or属性:HUKS_ERR_CODE_CREDENTIAL_NOT_EXIST = 12000013|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksExceptionErrCode<br>方法 or 属性:HUKS_ERR_CODE_INSUFFICIENT_MEMORY = 12000014|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksExceptionErrCode<br>方法or属性:HUKS_ERR_CODE_INSUFFICIENT_MEMORY = 12000014|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksExceptionErrCode<br>方法 or 属性:HUKS_ERR_CODE_CALL_SERVICE_FAILED = 12000015|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksExceptionErrCode<br>方法or属性:HUKS_ERR_CODE_CALL_SERVICE_FAILED = 12000015|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksKeyDigest<br>方法 or 属性:HUKS_DIGEST_SM3 = 2|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksKeyDigest<br>方法or属性:HUKS_DIGEST_SM3 = 2|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksKeySize<br>方法 or 属性:HUKS_SM2_KEY_SIZE_256 = 256|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksKeySize<br>方法or属性:HUKS_SM2_KEY_SIZE_256 = 256|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksKeySize<br>方法 or 属性:HUKS_SM4_KEY_SIZE_128 = 128|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksKeySize<br>方法or属性:HUKS_SM4_KEY_SIZE_128 = 128|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksKeyAlg<br>方法 or 属性:HUKS_ALG_SM2 = 150|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksKeyAlg<br>方法or属性:HUKS_ALG_SM2 = 150|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksKeyAlg<br>方法 or 属性:HUKS_ALG_SM3 = 151|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksKeyAlg<br>方法or属性:HUKS_ALG_SM3 = 151|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksKeyAlg<br>方法 or 属性:HUKS_ALG_SM4 = 152|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksKeyAlg<br>方法or属性:HUKS_ALG_SM4 = 152|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksUnwrapSuite|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksUnwrapSuite<br>方法or属性:|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksUnwrapSuite<br>方法 or 属性:HUKS_UNWRAP_SUITE_X25519_AES_256_GCM_NOPADDING = 1|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksUnwrapSuite<br>方法or属性:HUKS_UNWRAP_SUITE_X25519_AES_256_GCM_NOPADDING = 1|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksUnwrapSuite<br>方法 or 属性:HUKS_UNWRAP_SUITE_ECDH_AES_256_GCM_NOPADDING = 2|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksUnwrapSuite<br>方法or属性:HUKS_UNWRAP_SUITE_ECDH_AES_256_GCM_NOPADDING = 2|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksImportKeyType|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksImportKeyType<br>方法or属性:|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksImportKeyType<br>方法 or 属性:HUKS_KEY_TYPE_PUBLIC_KEY = 0|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksImportKeyType<br>方法or属性:HUKS_KEY_TYPE_PUBLIC_KEY = 0|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksImportKeyType<br>方法 or 属性:HUKS_KEY_TYPE_PRIVATE_KEY = 1|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksImportKeyType<br>方法or属性:HUKS_KEY_TYPE_PRIVATE_KEY = 1|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksImportKeyType<br>方法 or 属性:HUKS_KEY_TYPE_KEY_PAIR = 2|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksImportKeyType<br>方法or属性:HUKS_KEY_TYPE_KEY_PAIR = 2|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksUserAuthType|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksUserAuthType<br>方法or属性:|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksUserAuthType<br>方法 or 属性:HUKS_USER_AUTH_TYPE_FINGERPRINT = 1 \<\< 0|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksUserAuthType<br>方法or属性:HUKS_USER_AUTH_TYPE_FINGERPRINT = 1 \<\< 0|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksUserAuthType<br>方法 or 属性:HUKS_USER_AUTH_TYPE_FACE = 1 \<\< 1|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksUserAuthType<br>方法or属性:HUKS_USER_AUTH_TYPE_FACE = 1 \<\< 1|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksUserAuthType<br>方法 or 属性:HUKS_USER_AUTH_TYPE_PIN = 1 \<\< 2|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksUserAuthType<br>方法or属性:HUKS_USER_AUTH_TYPE_PIN = 1 \<\< 2|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksAuthAccessType|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksAuthAccessType<br>方法or属性:|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksAuthAccessType<br>方法 or 属性:HUKS_AUTH_ACCESS_INVALID_CLEAR_PASSWORD = 1 \<\< 0|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksAuthAccessType<br>方法or属性:HUKS_AUTH_ACCESS_INVALID_CLEAR_PASSWORD = 1 \<\< 0|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksAuthAccessType<br>方法 or 属性:HUKS_AUTH_ACCESS_INVALID_NEW_BIO_ENROLL = 1 \<\< 1|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksAuthAccessType<br>方法or属性:HUKS_AUTH_ACCESS_INVALID_NEW_BIO_ENROLL = 1 \<\< 1|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksChallengeType|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksChallengeType<br>方法or属性:|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksChallengeType<br>方法 or 属性:HUKS_CHALLENGE_TYPE_NORMAL = 0|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksChallengeType<br>方法or属性:HUKS_CHALLENGE_TYPE_NORMAL = 0|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksChallengeType<br>方法 or 属性:HUKS_CHALLENGE_TYPE_CUSTOM = 1|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksChallengeType<br>方法or属性:HUKS_CHALLENGE_TYPE_CUSTOM = 1|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksChallengeType<br>方法 or 属性:HUKS_CHALLENGE_TYPE_NONE = 2|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksChallengeType<br>方法or属性:HUKS_CHALLENGE_TYPE_NONE = 2|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksChallengePosition|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksChallengePosition<br>方法or属性:|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksChallengePosition<br>方法 or 属性:HUKS_CHALLENGE_POS_0 = 0|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksChallengePosition<br>方法or属性:HUKS_CHALLENGE_POS_0 = 0|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksChallengePosition<br>方法 or 属性:HUKS_CHALLENGE_POS_1|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksChallengePosition<br>方法or属性:HUKS_CHALLENGE_POS_1|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksChallengePosition<br>方法 or 属性:HUKS_CHALLENGE_POS_2|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksChallengePosition<br>方法or属性:HUKS_CHALLENGE_POS_2|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksChallengePosition<br>方法 or 属性:HUKS_CHALLENGE_POS_3|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksChallengePosition<br>方法or属性:HUKS_CHALLENGE_POS_3|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksSecureSignType|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksSecureSignType<br>方法or属性:|@ohos.security.huks.d.ts| +|新增|NA|模块名: ohos.security.huks<br>类名: HuksSecureSignType<br>方法 or 属性:HUKS_SECURE_SIGN_WITH_AUTHINFO = 1|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksSecureSignType<br>方法or属性:HUKS_SECURE_SIGN_WITH_AUTHINFO = 1|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksTag<br>方法or属性:HUKS_TAG_IMPORT_KEY_TYPE = HuksTagType.HUKS_TAG_TYPE_UINT \| 25|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksTag<br>方法or属性:HUKS_TAG_UNWRAP_ALGORITHM_SUITE = HuksTagType.HUKS_TAG_TYPE_UINT \| 26|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksTag<br>方法or属性:HUKS_TAG_KEY_AUTH_ACCESS_TYPE = HuksTagType.HUKS_TAG_TYPE_UINT \| 307|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksTag<br>方法or属性:HUKS_TAG_KEY_SECURE_SIGN_TYPE = HuksTagType.HUKS_TAG_TYPE_UINT \| 308|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksTag<br>方法or属性:HUKS_TAG_CHALLENGE_TYPE = HuksTagType.HUKS_TAG_TYPE_UINT \| 309|@ohos.security.huks.d.ts| +|新增|NA|类名:HuksTag<br>方法or属性:HUKS_TAG_CHALLENGE_POS = HuksTagType.HUKS_TAG_TYPE_UINT \| 310|@ohos.security.huks.d.ts| +|新增|NA|模块名: PermissionRequestResult<br>类名: PermissionRequestResult|PermissionRequestResult.d.ts| +|新增|NA|模块名: PermissionRequestResult<br>类名: PermissionRequestResult<br>方法 or 属性: permissions: Array\<string>;|PermissionRequestResult.d.ts| +|新增|NA|模块名: PermissionRequestResult<br>类名: PermissionRequestResult<br>方法 or 属性: authResults: Array\<number>;|PermissionRequestResult.d.ts| +|废弃版本有变化|类名:AtManager<br>方法 or 属性:verifyAccessToken(tokenID: number, permissionName: string): Promise\<GrantStatus>;<br>废弃版本:N/A|类名:AtManager<br>方法 or 属性:verifyAccessToken(tokenID: number, permissionName: string): Promise\<GrantStatus>;<br>废弃版本:9<br>代替接口:ohos.abilityAccessCtrl.AtManager|@ohos.abilityAccessCtrl.d.ts| +|废弃版本有变化|类名:huks<br>方法 or 属性:function generateKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<HuksResult>) : void;<br>废弃版本:N/A|类名:huks<br>方法 or 属性:function generateKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<HuksResult>) : void;<br>废弃版本:9<br>代替接口:ohos.security.huks.generateKeyItem |@ohos.security.huks.d.ts| +|废弃版本有变化|类名:huks<br>方法 or 属性:function generateKey(keyAlias: string, options: HuksOptions) : Promise\<HuksResult>;<br>废弃版本:N/A|类名:huks<br>方法 or 属性:function generateKey(keyAlias: string, options: HuksOptions) : Promise\<HuksResult>;<br>废弃版本:9<br>代替接口:ohos.security.huks.generateKeyItem |@ohos.security.huks.d.ts| +|废弃版本有变化|类名:huks<br>方法 or 属性:function deleteKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<HuksResult>) : void;<br>废弃版本:N/A|类名:huks<br>方法 or 属性:function deleteKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<HuksResult>) : void;<br>废弃版本:9<br>代替接口:ohos.security.huks.deleteKeyItem |@ohos.security.huks.d.ts| +|废弃版本有变化|类名:huks<br>方法 or 属性:function deleteKey(keyAlias: string, options: HuksOptions) : Promise\<HuksResult>;<br>废弃版本:N/A|类名:huks<br>方法 or 属性:function deleteKey(keyAlias: string, options: HuksOptions) : Promise\<HuksResult>;<br>废弃版本:9<br>代替接口:ohos.security.huks.deleteKeyItem |@ohos.security.huks.d.ts| +|废弃版本有变化|类名:huks<br>方法 or 属性:function importKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<HuksResult>) : void;<br>废弃版本:N/A|类名:huks<br>方法 or 属性:function importKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<HuksResult>) : void;<br>废弃版本:9<br>代替接口:ohos.security.huks.importKeyItem |@ohos.security.huks.d.ts| +|废弃版本有变化|类名:huks<br>方法 or 属性:function importKey(keyAlias: string, options: HuksOptions) : Promise\<HuksResult>;<br>废弃版本:N/A|类名:huks<br>方法 or 属性:function importKey(keyAlias: string, options: HuksOptions) : Promise\<HuksResult>;<br>废弃版本:9<br>代替接口:ohos.security.huks.importKeyItem |@ohos.security.huks.d.ts| +|废弃版本有变化|类名:huks<br>方法 or 属性:function exportKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<HuksResult>) : void;<br>废弃版本:N/A|类名:huks<br>方法 or 属性:function exportKey(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<HuksResult>) : void;<br>废弃版本:9<br>代替接口:ohos.security.huks.exportKeyItem |@ohos.security.huks.d.ts| +|废弃版本有变化|类名:huks<br>方法 or 属性:function exportKey(keyAlias: string, options: HuksOptions) : Promise\<HuksResult>;<br>废弃版本:N/A|类名:huks<br>方法 or 属性:function exportKey(keyAlias: string, options: HuksOptions) : Promise\<HuksResult>;<br>废弃版本:9<br>代替接口:ohos.security.huks.exportKeyItem |@ohos.security.huks.d.ts| +|废弃版本有变化|类名:huks<br>方法 or 属性:function getKeyProperties(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<HuksResult>) : void;<br>废弃版本:N/A|类名:huks<br>方法 or 属性:function getKeyProperties(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<HuksResult>) : void;<br>废弃版本:9<br>代替接口:ohos.security.huks.getKeyItemProperties |@ohos.security.huks.d.ts| +|废弃版本有变化|类名:huks<br>方法 or 属性:function getKeyProperties(keyAlias: string, options: HuksOptions) : Promise\<HuksResult>;<br>废弃版本:N/A|类名:huks<br>方法 or 属性:function getKeyProperties(keyAlias: string, options: HuksOptions) : Promise\<HuksResult>;<br>废弃版本:9<br>代替接口:ohos.security.huks.getKeyItemProperties |@ohos.security.huks.d.ts| +|废弃版本有变化|类名:huks<br>方法 or 属性:function isKeyExist(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<boolean>) : void;<br>废弃版本:N/A|类名:huks<br>方法 or 属性:function isKeyExist(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<boolean>) : void;<br>废弃版本:9<br>代替接口:ohos.security.huks.isKeyItemExist |@ohos.security.huks.d.ts| +|废弃版本有变化|类名:huks<br>方法 or 属性:function isKeyExist(keyAlias: string, options: HuksOptions) : Promise\<boolean>;<br>废弃版本:N/A|类名:huks<br>方法 or 属性:function isKeyExist(keyAlias: string, options: HuksOptions) : Promise\<boolean>;<br>废弃版本:9<br>代替接口:ohos.security.huks.isKeyItemExist |@ohos.security.huks.d.ts| +|废弃版本有变化|类名:huks<br>方法 or 属性:function init(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<HuksHandle>) : void;<br>废弃版本:N/A|类名:huks<br>方法 or 属性:function init(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<HuksHandle>) : void;<br>废弃版本:9<br>代替接口:ohos.security.huks.initSession |@ohos.security.huks.d.ts| +|废弃版本有变化|类名:huks<br>方法 or 属性:function init(keyAlias: string, options: HuksOptions) : Promise\<HuksHandle>;<br>废弃版本:N/A|类名:huks<br>方法 or 属性:function init(keyAlias: string, options: HuksOptions) : Promise\<HuksHandle>;<br>废弃版本:9<br>代替接口:ohos.security.huks.initSession |@ohos.security.huks.d.ts| +|废弃版本有变化|类名:huks<br>方法 or 属性:function update(handle: number, token?: Uint8Array, options: HuksOptions, callback: AsyncCallback\<HuksResult>) : void;<br>废弃版本:N/A|类名:huks<br>方法 or 属性:function update(handle: number, token?: Uint8Array, options: HuksOptions, callback: AsyncCallback\<HuksResult>) : void;<br>废弃版本:9<br>代替接口:ohos.security.huks.updateSession |@ohos.security.huks.d.ts| +|废弃版本有变化|类名:huks<br>方法 or 属性:function update(handle: number, token?: Uint8Array, options: HuksOptions) : Promise\<HuksResult>;<br>废弃版本:N/A|类名:huks<br>方法 or 属性:function update(handle: number, token?: Uint8Array, options: HuksOptions) : Promise\<HuksResult>;<br>废弃版本:9<br>代替接口:ohos.security.huks.updateSession |@ohos.security.huks.d.ts| +|废弃版本有变化|类名:huks<br>方法 or 属性:function finish(handle: number, options: HuksOptions, callback: AsyncCallback\<HuksResult>) : void;<br>废弃版本:N/A|类名:huks<br>方法 or 属性:function finish(handle: number, options: HuksOptions, callback: AsyncCallback\<HuksResult>) : void;<br>废弃版本:9<br>代替接口:ohos.security.huks.finishSession |@ohos.security.huks.d.ts| +|废弃版本有变化|类名:huks<br>方法 or 属性:function finish(handle: number, options: HuksOptions) : Promise\<HuksResult>;<br>废弃版本:N/A|类名:huks<br>方法 or 属性:function finish(handle: number, options: HuksOptions) : Promise\<HuksResult>;<br>废弃版本:9<br>代替接口:ohos.security.huks.finishSession |@ohos.security.huks.d.ts| +|废弃版本有变化|类名:huks<br>方法 or 属性:function abort(handle: number, options: HuksOptions, callback: AsyncCallback\<HuksResult>) : void;<br>废弃版本:N/A|类名:huks<br>方法 or 属性:function abort(handle: number, options: HuksOptions, callback: AsyncCallback\<HuksResult>) : void;<br>废弃版本:9<br>代替接口:ohos.security.huks.abortSession |@ohos.security.huks.d.ts| +|废弃版本有变化|类名:huks<br>方法 or 属性:function abort(handle: number, options: HuksOptions) : Promise\<HuksResult>;<br>废弃版本:N/A|类名:huks<br>方法 or 属性:function abort(handle: number, options: HuksOptions) : Promise\<HuksResult>;<br>废弃版本:9<br>代替接口:ohos.security.huks.abortSession |@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksHandle<br>废弃版本:N/A|类名:HuksHandle<br>废弃版本:9<br>代替接口:ohos.security.huks.HuksSessionHandle |@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksResult<br>废弃版本:N/A|类名:HuksResult<br>废弃版本:9<br>代替接口:ohos.security.huks.HuksReturnResult |@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksErrorCode<br>废弃版本:N/A|类名:HuksErrorCode<br>废弃版本:9<br>代替接口:ohos.security.huks.HuksExceptionErrCode |@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_INVALID = HuksTagType.HUKS_TAG_TYPE_INVALID \| 0<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_INVALID = HuksTagType.HUKS_TAG_TYPE_INVALID \| 0<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_PWD = HuksTagType.HUKS_TAG_TYPE_BYTES \| 13<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_PWD = HuksTagType.HUKS_TAG_TYPE_BYTES \| 13<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_DERIVE_MAIN_KEY = HuksTagType.HUKS_TAG_TYPE_BYTES \| 16<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_DERIVE_MAIN_KEY = HuksTagType.HUKS_TAG_TYPE_BYTES \| 16<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_DERIVE_FACTOR = HuksTagType.HUKS_TAG_TYPE_BYTES \| 17<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_DERIVE_FACTOR = HuksTagType.HUKS_TAG_TYPE_BYTES \| 17<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_DERIVE_ALG = HuksTagType.HUKS_TAG_TYPE_UINT \| 18<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_DERIVE_ALG = HuksTagType.HUKS_TAG_TYPE_UINT \| 18<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ACTIVE_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 201<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ACTIVE_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 201<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ORIGINATION_EXPIRE_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 202<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ORIGINATION_EXPIRE_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 202<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_USAGE_EXPIRE_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 203<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_USAGE_EXPIRE_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 203<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_CREATION_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 204<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_CREATION_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 204<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_BRAND = HuksTagType.HUKS_TAG_TYPE_BYTES \| 503<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_BRAND = HuksTagType.HUKS_TAG_TYPE_BYTES \| 503<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_DEVICE = HuksTagType.HUKS_TAG_TYPE_BYTES \| 504<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_DEVICE = HuksTagType.HUKS_TAG_TYPE_BYTES \| 504<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_PRODUCT = HuksTagType.HUKS_TAG_TYPE_BYTES \| 505<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_PRODUCT = HuksTagType.HUKS_TAG_TYPE_BYTES \| 505<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_SERIAL = HuksTagType.HUKS_TAG_TYPE_BYTES \| 506<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_SERIAL = HuksTagType.HUKS_TAG_TYPE_BYTES \| 506<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_IMEI = HuksTagType.HUKS_TAG_TYPE_BYTES \| 507<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_IMEI = HuksTagType.HUKS_TAG_TYPE_BYTES \| 507<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_MEID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 508<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_MEID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 508<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_MANUFACTURER = HuksTagType.HUKS_TAG_TYPE_BYTES \| 509<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_MANUFACTURER = HuksTagType.HUKS_TAG_TYPE_BYTES \| 509<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_MODEL = HuksTagType.HUKS_TAG_TYPE_BYTES \| 510<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_MODEL = HuksTagType.HUKS_TAG_TYPE_BYTES \| 510<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_SOCID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 512<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_SOCID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 512<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_UDID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 513<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_UDID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 513<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_SECURE_KEY_ALIAS = HuksTagType.HUKS_TAG_TYPE_BOOL \| 1009<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_SECURE_KEY_ALIAS = HuksTagType.HUKS_TAG_TYPE_BOOL \| 1009<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_SECURE_KEY_UUID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 1010<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_SECURE_KEY_UUID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 1010<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_PROCESS_NAME = HuksTagType.HUKS_TAG_TYPE_BYTES \| 10001<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_PROCESS_NAME = HuksTagType.HUKS_TAG_TYPE_BYTES \| 10001<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_PACKAGE_NAME = HuksTagType.HUKS_TAG_TYPE_BYTES \| 10002<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_PACKAGE_NAME = HuksTagType.HUKS_TAG_TYPE_BYTES \| 10002<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ACCESS_TIME = HuksTagType.HUKS_TAG_TYPE_UINT \| 10003<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ACCESS_TIME = HuksTagType.HUKS_TAG_TYPE_UINT \| 10003<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_USES_TIME = HuksTagType.HUKS_TAG_TYPE_UINT \| 10004<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_USES_TIME = HuksTagType.HUKS_TAG_TYPE_UINT \| 10004<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_CRYPTO_CTX = HuksTagType.HUKS_TAG_TYPE_ULONG \| 10005<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_CRYPTO_CTX = HuksTagType.HUKS_TAG_TYPE_ULONG \| 10005<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_KEY_VERSION = HuksTagType.HUKS_TAG_TYPE_UINT \| 10007<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_KEY_VERSION = HuksTagType.HUKS_TAG_TYPE_UINT \| 10007<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_PAYLOAD_LEN = HuksTagType.HUKS_TAG_TYPE_UINT \| 10008<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_PAYLOAD_LEN = HuksTagType.HUKS_TAG_TYPE_UINT \| 10008<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_IS_KEY_HANDLE = HuksTagType.HUKS_TAG_TYPE_ULONG \| 10010<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_IS_KEY_HANDLE = HuksTagType.HUKS_TAG_TYPE_ULONG \| 10010<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_OS_VERSION = HuksTagType.HUKS_TAG_TYPE_UINT \| 10101<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_OS_VERSION = HuksTagType.HUKS_TAG_TYPE_UINT \| 10101<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_OS_PATCHLEVEL = HuksTagType.HUKS_TAG_TYPE_UINT \| 10102<br>废弃版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_OS_PATCHLEVEL = HuksTagType.HUKS_TAG_TYPE_UINT \| 10102<br>废弃版本:9<br>代替接口:N/A|@ohos.security.huks.d.ts| +|废弃版本有变化|类名:Cipher<br>废弃版本:N/A|类名:Cipher<br>废弃版本:9<br>代替接口:ohos.security.cryptoFramework.Cipher |@system.cipher.d.ts| +|废弃版本有变化|类名:Cipher<br>方法 or 属性:static rsa(options: CipherRsaOptions): void;<br>废弃版本:N/A|类名:Cipher<br>方法 or 属性:static rsa(options: CipherRsaOptions): void;<br>废弃版本:9<br>代替接口:N/A|@system.cipher.d.ts| +|废弃版本有变化|类名:Cipher<br>方法 or 属性:static aes(options: CipherAesOptions): void;<br>废弃版本:N/A|类名:Cipher<br>方法 or 属性:static aes(options: CipherAesOptions): void;<br>废弃版本:9<br>代替接口:N/A|@system.cipher.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_INVALID = HuksTagType.HUKS_TAG_TYPE_INVALID \| 0<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_INVALID = HuksTagType.HUKS_TAG_TYPE_INVALID \| 0<br>起始版本:8|@ohos.security.huks.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_PWD = HuksTagType.HUKS_TAG_TYPE_BYTES \| 13<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_PWD = HuksTagType.HUKS_TAG_TYPE_BYTES \| 13<br>起始版本:8|@ohos.security.huks.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_DERIVE_MAIN_KEY = HuksTagType.HUKS_TAG_TYPE_BYTES \| 16<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_DERIVE_MAIN_KEY = HuksTagType.HUKS_TAG_TYPE_BYTES \| 16<br>起始版本:8|@ohos.security.huks.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_DERIVE_FACTOR = HuksTagType.HUKS_TAG_TYPE_BYTES \| 17<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_DERIVE_FACTOR = HuksTagType.HUKS_TAG_TYPE_BYTES \| 17<br>起始版本:8|@ohos.security.huks.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_DERIVE_ALG = HuksTagType.HUKS_TAG_TYPE_UINT \| 18<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_DERIVE_ALG = HuksTagType.HUKS_TAG_TYPE_UINT \| 18<br>起始版本:8|@ohos.security.huks.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ACTIVE_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 201<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ACTIVE_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 201<br>起始版本:8|@ohos.security.huks.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ORIGINATION_EXPIRE_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 202<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ORIGINATION_EXPIRE_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 202<br>起始版本:8|@ohos.security.huks.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_USAGE_EXPIRE_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 203<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_USAGE_EXPIRE_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 203<br>起始版本:8|@ohos.security.huks.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_CREATION_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 204<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_CREATION_DATETIME = HuksTagType.HUKS_TAG_TYPE_ULONG \| 204<br>起始版本:8|@ohos.security.huks.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_BRAND = HuksTagType.HUKS_TAG_TYPE_BYTES \| 503<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_BRAND = HuksTagType.HUKS_TAG_TYPE_BYTES \| 503<br>起始版本:8|@ohos.security.huks.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_DEVICE = HuksTagType.HUKS_TAG_TYPE_BYTES \| 504<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_DEVICE = HuksTagType.HUKS_TAG_TYPE_BYTES \| 504<br>起始版本:8|@ohos.security.huks.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_PRODUCT = HuksTagType.HUKS_TAG_TYPE_BYTES \| 505<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_PRODUCT = HuksTagType.HUKS_TAG_TYPE_BYTES \| 505<br>起始版本:8|@ohos.security.huks.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_SERIAL = HuksTagType.HUKS_TAG_TYPE_BYTES \| 506<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_SERIAL = HuksTagType.HUKS_TAG_TYPE_BYTES \| 506<br>起始版本:8|@ohos.security.huks.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_IMEI = HuksTagType.HUKS_TAG_TYPE_BYTES \| 507<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_IMEI = HuksTagType.HUKS_TAG_TYPE_BYTES \| 507<br>起始版本:8|@ohos.security.huks.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_MEID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 508<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_MEID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 508<br>起始版本:8|@ohos.security.huks.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_MANUFACTURER = HuksTagType.HUKS_TAG_TYPE_BYTES \| 509<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_MANUFACTURER = HuksTagType.HUKS_TAG_TYPE_BYTES \| 509<br>起始版本:8|@ohos.security.huks.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_MODEL = HuksTagType.HUKS_TAG_TYPE_BYTES \| 510<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_MODEL = HuksTagType.HUKS_TAG_TYPE_BYTES \| 510<br>起始版本:8|@ohos.security.huks.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_SOCID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 512<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_SOCID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 512<br>起始版本:8|@ohos.security.huks.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_UDID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 513<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ATTESTATION_ID_UDID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 513<br>起始版本:8|@ohos.security.huks.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_SECURE_KEY_ALIAS = HuksTagType.HUKS_TAG_TYPE_BOOL \| 1009<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_SECURE_KEY_ALIAS = HuksTagType.HUKS_TAG_TYPE_BOOL \| 1009<br>起始版本:8|@ohos.security.huks.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_SECURE_KEY_UUID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 1010<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_SECURE_KEY_UUID = HuksTagType.HUKS_TAG_TYPE_BYTES \| 1010<br>起始版本:8|@ohos.security.huks.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_PROCESS_NAME = HuksTagType.HUKS_TAG_TYPE_BYTES \| 10001<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_PROCESS_NAME = HuksTagType.HUKS_TAG_TYPE_BYTES \| 10001<br>起始版本:8|@ohos.security.huks.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_PACKAGE_NAME = HuksTagType.HUKS_TAG_TYPE_BYTES \| 10002<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_PACKAGE_NAME = HuksTagType.HUKS_TAG_TYPE_BYTES \| 10002<br>起始版本:8|@ohos.security.huks.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ACCESS_TIME = HuksTagType.HUKS_TAG_TYPE_UINT \| 10003<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_ACCESS_TIME = HuksTagType.HUKS_TAG_TYPE_UINT \| 10003<br>起始版本:8|@ohos.security.huks.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_USES_TIME = HuksTagType.HUKS_TAG_TYPE_UINT \| 10004<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_USES_TIME = HuksTagType.HUKS_TAG_TYPE_UINT \| 10004<br>起始版本:8|@ohos.security.huks.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_CRYPTO_CTX = HuksTagType.HUKS_TAG_TYPE_ULONG \| 10005<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_CRYPTO_CTX = HuksTagType.HUKS_TAG_TYPE_ULONG \| 10005<br>起始版本:8|@ohos.security.huks.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_KEY_VERSION = HuksTagType.HUKS_TAG_TYPE_UINT \| 10007<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_KEY_VERSION = HuksTagType.HUKS_TAG_TYPE_UINT \| 10007<br>起始版本:8|@ohos.security.huks.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_PAYLOAD_LEN = HuksTagType.HUKS_TAG_TYPE_UINT \| 10008<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_PAYLOAD_LEN = HuksTagType.HUKS_TAG_TYPE_UINT \| 10008<br>起始版本:8|@ohos.security.huks.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_IS_KEY_HANDLE = HuksTagType.HUKS_TAG_TYPE_ULONG \| 10010<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_IS_KEY_HANDLE = HuksTagType.HUKS_TAG_TYPE_ULONG \| 10010<br>起始版本:8|@ohos.security.huks.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_OS_VERSION = HuksTagType.HUKS_TAG_TYPE_UINT \| 10101<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_OS_VERSION = HuksTagType.HUKS_TAG_TYPE_UINT \| 10101<br>起始版本:8|@ohos.security.huks.d.ts| +|起始版本有变化|类名:HuksTag<br>方法 or 属性:HUKS_TAG_OS_PATCHLEVEL = HuksTagType.HUKS_TAG_TYPE_UINT \| 10102<br>起始版本:N/A|类名:HuksTag<br>方法 or 属性:HUKS_TAG_OS_PATCHLEVEL = HuksTagType.HUKS_TAG_TYPE_UINT \| 10102<br>起始版本:8|@ohos.security.huks.d.ts| +|函数有变化|类名:AtManager<br>方法 or 属性:verifyAccessToken(tokenID: number, permissionName: string): Promise\<GrantStatus>;<br>|类名:AtManager<br>方法 or 属性:verifyAccessToken(tokenID: number, permissionName: string): Promise\<GrantStatus>;<br>|@ohos.abilityAccessCtrl.d.ts| +|函数有变化|类名:AtManager<br>方法 or 属性:verifyAccessToken(tokenID: number, permissionName: string): Promise\<GrantStatus>;<br>|类名:AtManager<br>方法 or 属性:verifyAccessToken(tokenID: number, permissionName: Permissions): Promise\<GrantStatus>;<br>|@ohos.abilityAccessCtrl.d.ts| +|函数有变化|类名:AtManager<br>方法 or 属性:grantUserGrantedPermission(tokenID: number, permissionName: string, permissionFlag: number): Promise\<number>;<br>|类名:AtManager<br>方法 or 属性:grantUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlags: number): Promise\<void>;<br>|@ohos.abilityAccessCtrl.d.ts| +|函数有变化|类名:AtManager<br>方法 or 属性:grantUserGrantedPermission(tokenID: number, permissionName: string, permissionFlag: number, callback: AsyncCallback\<number>): void;<br>|类名:AtManager<br>方法 or 属性:grantUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlags: number, callback: AsyncCallback\<void>): void;<br>|@ohos.abilityAccessCtrl.d.ts| +|函数有变化|类名:AtManager<br>方法 or 属性:revokeUserGrantedPermission(tokenID: number, permissionName: string, permissionFlag: number): Promise\<number>;<br>|类名:AtManager<br>方法 or 属性:revokeUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlags: number): Promise\<void>;<br>|@ohos.abilityAccessCtrl.d.ts| +|函数有变化|类名:AtManager<br>方法 or 属性:revokeUserGrantedPermission(tokenID: number, permissionName: string, permissionFlag: number, callback: AsyncCallback\<number>): void;<br>|类名:AtManager<br>方法 or 属性:revokeUserGrantedPermission(tokenID: number, permissionName: Permissions, permissionFlags: number, callback: AsyncCallback\<void>): void;<br>|@ohos.abilityAccessCtrl.d.ts| +|函数有变化|类名:AtManager<br>方法 or 属性:getPermissionFlags(tokenID: number, permissionName: string): Promise\<number>;<br>|类名:AtManager<br>方法 or 属性:getPermissionFlags(tokenID: number, permissionName: Permissions): Promise\<number>;<br>|@ohos.abilityAccessCtrl.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-sensor.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-sensor.md new file mode 100644 index 0000000000000000000000000000000000000000..ed5d5fc70248e17e006a9971e00d261f9b38be38 --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-sensor.md @@ -0,0 +1,1149 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.sensor<br>类名: SensorId|@ohos.sensor.d.ts| +|新增|NA|类名:SensorId<br>方法or属性:|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: SensorId<br>方法 or 属性:ACCELEROMETER = 1|@ohos.sensor.d.ts| +|新增|NA|类名:SensorId<br>方法or属性:ACCELEROMETER = 1|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: SensorId<br>方法 or 属性:GYROSCOPE = 2|@ohos.sensor.d.ts| +|新增|NA|类名:SensorId<br>方法or属性:GYROSCOPE = 2|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: SensorId<br>方法 or 属性:AMBIENT_LIGHT = 5|@ohos.sensor.d.ts| +|新增|NA|类名:SensorId<br>方法or属性:AMBIENT_LIGHT = 5|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: SensorId<br>方法 or 属性:MAGNETIC_FIELD = 6|@ohos.sensor.d.ts| +|新增|NA|类名:SensorId<br>方法or属性:MAGNETIC_FIELD = 6|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: SensorId<br>方法 or 属性:BAROMETER = 8|@ohos.sensor.d.ts| +|新增|NA|类名:SensorId<br>方法or属性:BAROMETER = 8|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: SensorId<br>方法 or 属性:HALL = 10|@ohos.sensor.d.ts| +|新增|NA|类名:SensorId<br>方法or属性:HALL = 10|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: SensorId<br>方法 or 属性:PROXIMITY = 12|@ohos.sensor.d.ts| +|新增|NA|类名:SensorId<br>方法or属性:PROXIMITY = 12|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: SensorId<br>方法 or 属性:HUMIDITY = 13|@ohos.sensor.d.ts| +|新增|NA|类名:SensorId<br>方法or属性:HUMIDITY = 13|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: SensorId<br>方法 or 属性:ORIENTATION = 256|@ohos.sensor.d.ts| +|新增|NA|类名:SensorId<br>方法or属性:ORIENTATION = 256|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: SensorId<br>方法 or 属性:GRAVITY = 257|@ohos.sensor.d.ts| +|新增|NA|类名:SensorId<br>方法or属性:GRAVITY = 257|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: SensorId<br>方法 or 属性:LINEAR_ACCELEROMETER = 258|@ohos.sensor.d.ts| +|新增|NA|类名:SensorId<br>方法or属性:LINEAR_ACCELEROMETER = 258|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: SensorId<br>方法 or 属性:ROTATION_VECTOR = 259|@ohos.sensor.d.ts| +|新增|NA|类名:SensorId<br>方法or属性:ROTATION_VECTOR = 259|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: SensorId<br>方法 or 属性:AMBIENT_TEMPERATURE = 260|@ohos.sensor.d.ts| +|新增|NA|类名:SensorId<br>方法or属性:AMBIENT_TEMPERATURE = 260|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: SensorId<br>方法 or 属性:MAGNETIC_FIELD_UNCALIBRATED = 261|@ohos.sensor.d.ts| +|新增|NA|类名:SensorId<br>方法or属性:MAGNETIC_FIELD_UNCALIBRATED = 261|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: SensorId<br>方法 or 属性:GYROSCOPE_UNCALIBRATED = 263|@ohos.sensor.d.ts| +|新增|NA|类名:SensorId<br>方法or属性:GYROSCOPE_UNCALIBRATED = 263|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: SensorId<br>方法 or 属性:SIGNIFICANT_MOTION = 264|@ohos.sensor.d.ts| +|新增|NA|类名:SensorId<br>方法or属性:SIGNIFICANT_MOTION = 264|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: SensorId<br>方法 or 属性:PEDOMETER_DETECTION = 265|@ohos.sensor.d.ts| +|新增|NA|类名:SensorId<br>方法or属性:PEDOMETER_DETECTION = 265|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: SensorId<br>方法 or 属性:PEDOMETER = 266|@ohos.sensor.d.ts| +|新增|NA|类名:SensorId<br>方法or属性:PEDOMETER = 266|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: SensorId<br>方法 or 属性:HEART_RATE = 278|@ohos.sensor.d.ts| +|新增|NA|类名:SensorId<br>方法or属性:HEART_RATE = 278|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: SensorId<br>方法 or 属性:WEAR_DETECTION = 280|@ohos.sensor.d.ts| +|新增|NA|类名:SensorId<br>方法or属性:WEAR_DETECTION = 280|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: SensorId<br>方法 or 属性:ACCELEROMETER_UNCALIBRATED = 281|@ohos.sensor.d.ts| +|新增|NA|类名:SensorId<br>方法or属性:ACCELEROMETER_UNCALIBRATED = 281|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function on(type: SensorId.ACCELEROMETER, callback: Callback\<AccelerometerResponse>,<br><br> options?: Options): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function on(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>,<br><br> options?: Options): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function on(type: SensorId.AMBIENT_LIGHT, callback: Callback\<LightResponse>, options?: Options): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function on(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>,<br><br> options?: Options): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function on(type: SensorId.BAROMETER, callback: Callback\<BarometerResponse>, options?: Options): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function on(type: SensorId.GRAVITY, callback: Callback\<GravityResponse>,<br><br> options?: Options): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function on(type: SensorId.GYROSCOPE, callback: Callback\<GyroscopeResponse>,<br><br> options?: Options): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function on(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>,<br><br> options?: Options): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function on(type: SensorId.HALL, callback: Callback\<HallResponse>, options?: Options): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function on(type: SensorId.HEART_RATE, callback: Callback\<HeartRateResponse>,<br><br> options?: Options): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function on(type: SensorId.HUMIDITY, callback: Callback\<HumidityResponse>,<br><br> options?: Options): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function on(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback\<LinearAccelerometerResponse>,<br><br> options?: Options): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function on(type: SensorId.MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>,<br><br> options?: Options): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function on(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>,<br><br> options?: Options): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function on(type: SensorId.ORIENTATION, callback: Callback\<OrientationResponse>,<br><br> options?: Options): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function on(type: SensorId.PEDOMETER, callback: Callback\<PedometerResponse>, options?: Options): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function on(type: SensorId.PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>,<br><br> options?: Options): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function on(type: SensorId.PROXIMITY, callback: Callback\<ProximityResponse>, options?: Options): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function on(type: SensorId.ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>,<br><br> options?: Options): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function on(type: SensorId.SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>,<br><br> options?: Options): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function on(type: SensorId.WEAR_DETECTION, callback: Callback\<WearDetectionResponse>,<br><br> options?: Options): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function off(type: SensorId.ACCELEROMETER, callback?: Callback\<AccelerometerResponse>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function off(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback?: Callback\<AccelerometerUncalibratedResponse>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function off(type: SensorId.AMBIENT_LIGHT, callback?: Callback\<LightResponse>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function off(type: SensorId.AMBIENT_TEMPERATURE, callback?: Callback\<AmbientTemperatureResponse>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function off(type: SensorId.BAROMETER, callback?: Callback\<BarometerResponse>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function off(type: SensorId.GRAVITY, callback?: Callback\<GravityResponse>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function off(type: SensorId.GYROSCOPE, callback?: Callback\<GyroscopeResponse>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function off(type: SensorId.GYROSCOPE_UNCALIBRATED, callback?: Callback\<GyroscopeUncalibratedResponse>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function off(type: SensorId.HALL, callback?: Callback\<HallResponse>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function off(type: SensorId.HEART_RATE, callback?: Callback\<HeartRateResponse>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function off(type: SensorId.HUMIDITY, callback?: Callback\<HumidityResponse>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function off(type: SensorId.LINEAR_ACCELEROMETER, callback?: Callback\<LinearAccelerometerResponse>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function off(type: SensorId.MAGNETIC_FIELD, callback?: Callback\<MagneticFieldResponse>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function off(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback?: Callback\<MagneticFieldUncalibratedResponse>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function off(type: SensorId.ORIENTATION, callback?: Callback\<OrientationResponse>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function off(type: SensorId.PEDOMETER, callback?: Callback\<PedometerResponse>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function off(type: SensorId.PEDOMETER_DETECTION, callback?: Callback\<PedometerDetectionResponse>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function off(type: SensorId.PROXIMITY, callback?: Callback\<ProximityResponse>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function off(type: SensorId.ROTATION_VECTOR, callback?: Callback\<RotationVectorResponse>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function off(type: SensorId.SIGNIFICANT_MOTION, callback?: Callback\<SignificantMotionResponse>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function off(type: SensorId.WEAR_DETECTION, callback?: Callback\<WearDetectionResponse>): void;|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: Sensor|@ohos.sensor.d.ts| +|新增|NA|类名:Sensor<br>方法or属性:|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: Sensor<br>方法 or 属性:sensorName:string;|@ohos.sensor.d.ts| +|新增|NA|类名:Sensor<br>方法or属性:sensorName:string;|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: Sensor<br>方法 or 属性:vendorName:string;|@ohos.sensor.d.ts| +|新增|NA|类名:Sensor<br>方法or属性:vendorName:string;|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: Sensor<br>方法 or 属性:firmwareVersion:string;|@ohos.sensor.d.ts| +|新增|NA|类名:Sensor<br>方法or属性:firmwareVersion:string;|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: Sensor<br>方法 or 属性:hardwareVersion:string;|@ohos.sensor.d.ts| +|新增|NA|类名:Sensor<br>方法or属性:hardwareVersion:string;|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: Sensor<br>方法 or 属性:sensorId:number;|@ohos.sensor.d.ts| +|新增|NA|类名:Sensor<br>方法or属性:sensorId:number;|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: Sensor<br>方法 or 属性:maxRange:number;|@ohos.sensor.d.ts| +|新增|NA|类名:Sensor<br>方法or属性:maxRange:number;|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: Sensor<br>方法 or 属性:minSamplePeriod:number;|@ohos.sensor.d.ts| +|新增|NA|类名:Sensor<br>方法or属性:minSamplePeriod:number;|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: Sensor<br>方法 or 属性:maxSamplePeriod:number;|@ohos.sensor.d.ts| +|新增|NA|类名:Sensor<br>方法or属性:maxSamplePeriod:number;|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: Sensor<br>方法 or 属性:precision:number;|@ohos.sensor.d.ts| +|新增|NA|类名:Sensor<br>方法or属性:precision:number;|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.sensor<br>类名: Sensor<br>方法 or 属性:power:number;|@ohos.sensor.d.ts| +|新增|NA|类名:Sensor<br>方法or属性:power:number;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function getSingleSensor(type: SensorId, callback: AsyncCallback\<Sensor>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function getSingleSensor(type: SensorId): Promise\<Sensor>;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function getSensorList(callback: AsyncCallback\<Array\<Sensor>>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function getSensorList(): Promise\<Array\<Sensor>>;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function getGeomagneticInfo(locationOptions: LocationOptions, timeMillis: number, callback: AsyncCallback\<GeomagneticResponse>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function getGeomagneticInfo(locationOptions: LocationOptions, timeMillis: number): Promise\<GeomagneticResponse>;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function getDeviceAltitude(seaPressure: number, currentPressure: number, callback: AsyncCallback\<number>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function getDeviceAltitude(seaPressure: number, currentPressure: number): Promise\<number>;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function getInclination(inclinationMatrix: Array\<number>, callback: AsyncCallback\<number>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function getInclination(inclinationMatrix: Array\<number>): Promise\<number>;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function getAngleVariation(currentRotationMatrix: Array\<number>, preRotationMatrix: Array\<number>,<br><br> callback: AsyncCallback\<Array\<number>>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function getAngleVariation(currentRotationMatrix: Array\<number>, preRotationMatrix: Array\<number>): Promise\<Array\<number>>;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function getRotationMatrix(rotationVector: Array\<number>, callback: AsyncCallback\<Array\<number>>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function getRotationMatrix(rotationVector: Array\<number>): Promise\<Array\<number>>;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function transformRotationMatrix(inRotationVector: Array\<number>, coordinates: CoordinatesOptions,<br><br> callback: AsyncCallback\<Array\<number>>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function transformRotationMatrix(inRotationVector: Array\<number>, coordinates: CoordinatesOptions): Promise\<Array\<number>>;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function getQuaternion(rotationVector: Array\<number>, callback: AsyncCallback\<Array\<number>>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function getQuaternion(rotationVector: Array\<number>): Promise\<Array\<number>>;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function getOrientation(rotationMatrix: Array\<number>, callback: AsyncCallback\<Array\<number>>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function getOrientation(rotationMatrix: Array\<number>): Promise\<Array\<number>>;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function getRotationMatrix(gravity: Array\<number>, geomagnetic: Array\<number>, callback: AsyncCallback\<RotationMatrixResponse>): void;|@ohos.sensor.d.ts| +|新增|NA|类名:sensor<br>方法or属性:function getRotationMatrix(gravity: Array\<number>, geomagnetic: Array\<number>): Promise\<RotationMatrixResponse>;|@ohos.sensor.d.ts| +|新增|NA|模块名: ohos.vibrator<br>类名: Usage<br>方法 or 属性:type Usage = "unknown" \| "alarm" \| "ring" \| "notification" \| "communication" \|<br><br> "touch" \| "media" \| "physicalFeedback" \| "simulateReality";|@ohos.vibrator.d.ts| +|新增|NA|类名:Usage<br>方法or属性:type Usage = "unknown" \| "alarm" \| "ring" \| "notification" \| "communication" \|<br><br> "touch" \| "media" \| "physicalFeedback" \| "simulateReality";|@ohos.vibrator.d.ts| +|新增|NA|模块名: ohos.vibrator<br>类名: Usage<br>方法 or 属性:type Usage = "unknown" \| "alarm" \| "ring" \| "notification" \| "communication" \|<br><br> "touch" \| "media" \| "physicalFeedback" \| "simulateReality";|@ohos.vibrator.d.ts| +|新增|NA|类名:Usage<br>方法or属性:type Usage = "unknown" \| "alarm" \| "ring" \| "notification" \| "communication" \|<br><br> "touch" \| "media" \| "physicalFeedback" \| "simulateReality";|@ohos.vibrator.d.ts| +|新增|NA|模块名: ohos.vibrator<br>类名: Usage<br>方法 or 属性:type Usage = "unknown" \| "alarm" \| "ring" \| "notification" \| "communication" \|<br><br> "touch" \| "media" \| "physicalFeedback" \| "simulateReality";|@ohos.vibrator.d.ts| +|新增|NA|类名:Usage<br>方法or属性:type Usage = "unknown" \| "alarm" \| "ring" \| "notification" \| "communication" \|<br><br> "touch" \| "media" \| "physicalFeedback" \| "simulateReality";|@ohos.vibrator.d.ts| +|新增|NA|模块名: ohos.vibrator<br>类名: Usage<br>方法 or 属性:type Usage = "unknown" \| "alarm" \| "ring" \| "notification" \| "communication" \|<br><br> "touch" \| "media" \| "physicalFeedback" \| "simulateReality";|@ohos.vibrator.d.ts| +|新增|NA|类名:Usage<br>方法or属性:type Usage = "unknown" \| "alarm" \| "ring" \| "notification" \| "communication" \|<br><br> "touch" \| "media" \| "physicalFeedback" \| "simulateReality";|@ohos.vibrator.d.ts| +|新增|NA|模块名: ohos.vibrator<br>类名: Usage<br>方法 or 属性:type Usage = "unknown" \| "alarm" \| "ring" \| "notification" \| "communication" \|<br><br> "touch" \| "media" \| "physicalFeedback" \| "simulateReality";|@ohos.vibrator.d.ts| +|新增|NA|类名:Usage<br>方法or属性:type Usage = "unknown" \| "alarm" \| "ring" \| "notification" \| "communication" \|<br><br> "touch" \| "media" \| "physicalFeedback" \| "simulateReality";|@ohos.vibrator.d.ts| +|新增|NA|模块名: ohos.vibrator<br>类名: Usage<br>方法 or 属性:type Usage = "unknown" \| "alarm" \| "ring" \| "notification" \| "communication" \|<br><br> "touch" \| "media" \| "physicalFeedback" \| "simulateReality";|@ohos.vibrator.d.ts| +|新增|NA|类名:Usage<br>方法or属性:type Usage = "unknown" \| "alarm" \| "ring" \| "notification" \| "communication" \|<br><br> "touch" \| "media" \| "physicalFeedback" \| "simulateReality";|@ohos.vibrator.d.ts| +|新增|NA|模块名: ohos.vibrator<br>类名: Usage<br>方法 or 属性:type Usage = "unknown" \| "alarm" \| "ring" \| "notification" \| "communication" \|<br><br> "touch" \| "media" \| "physicalFeedback" \| "simulateReality";|@ohos.vibrator.d.ts| +|新增|NA|类名:Usage<br>方法or属性:type Usage = "unknown" \| "alarm" \| "ring" \| "notification" \| "communication" \|<br><br> "touch" \| "media" \| "physicalFeedback" \| "simulateReality";|@ohos.vibrator.d.ts| +|新增|NA|模块名: ohos.vibrator<br>类名: Usage<br>方法 or 属性:type Usage = "unknown" \| "alarm" \| "ring" \| "notification" \| "communication" \|<br><br> "touch" \| "media" \| "physicalFeedback" \| "simulateReality";|@ohos.vibrator.d.ts| +|新增|NA|类名:Usage<br>方法or属性:type Usage = "unknown" \| "alarm" \| "ring" \| "notification" \| "communication" \|<br><br> "touch" \| "media" \| "physicalFeedback" \| "simulateReality";|@ohos.vibrator.d.ts| +|新增|NA|模块名: ohos.vibrator<br>类名: Usage<br>方法 or 属性:type Usage = "unknown" \| "alarm" \| "ring" \| "notification" \| "communication" \|<br><br> "touch" \| "media" \| "physicalFeedback" \| "simulateReality";|@ohos.vibrator.d.ts| +|新增|NA|类名:Usage<br>方法or属性:type Usage = "unknown" \| "alarm" \| "ring" \| "notification" \| "communication" \|<br><br> "touch" \| "media" \| "physicalFeedback" \| "simulateReality";|@ohos.vibrator.d.ts| +|新增|NA|类名:vibrator<br>方法or属性:function startVibration(effect: VibrateEffect, attribute: VibrateAttribute, callback: AsyncCallback\<void>): void;|@ohos.vibrator.d.ts| +|新增|NA|类名:vibrator<br>方法or属性:function startVibration(effect: VibrateEffect, attribute: VibrateAttribute): Promise\<void>;|@ohos.vibrator.d.ts| +|新增|NA|类名:vibrator<br>方法or属性:function stopVibration(stopMode: VibratorStopMode): Promise\<void>;|@ohos.vibrator.d.ts| +|新增|NA|类名:vibrator<br>方法or属性:function stopVibration(stopMode: VibratorStopMode, callback: AsyncCallback\<void>): void;|@ohos.vibrator.d.ts| +|新增|NA|模块名: ohos.vibrator<br>类名: VibrateAttribute|@ohos.vibrator.d.ts| +|新增|NA|类名:VibrateAttribute<br>方法or属性:|@ohos.vibrator.d.ts| +|新增|NA|模块名: ohos.vibrator<br>类名: VibrateAttribute<br>方法 or 属性:id?: number,|@ohos.vibrator.d.ts| +|新增|NA|类名:VibrateAttribute<br>方法or属性:id?: number,|@ohos.vibrator.d.ts| +|新增|NA|模块名: ohos.vibrator<br>类名: VibrateAttribute<br>方法 or 属性:usage: Usage,|@ohos.vibrator.d.ts| +|新增|NA|类名:VibrateAttribute<br>方法or属性:usage: Usage,|@ohos.vibrator.d.ts| +|新增|NA|模块名: ohos.vibrator<br>类名: VibrateTime|@ohos.vibrator.d.ts| +|新增|NA|类名:VibrateTime<br>方法or属性:|@ohos.vibrator.d.ts| +|新增|NA|模块名: ohos.vibrator<br>类名: VibrateTime<br>方法 or 属性:type: "time";|@ohos.vibrator.d.ts| +|新增|NA|类名:VibrateTime<br>方法or属性:type: "time";|@ohos.vibrator.d.ts| +|新增|NA|模块名: ohos.vibrator<br>类名: VibrateTime<br>方法 or 属性:duration: number;|@ohos.vibrator.d.ts| +|新增|NA|类名:VibrateTime<br>方法or属性:duration: number;|@ohos.vibrator.d.ts| +|新增|NA|模块名: ohos.vibrator<br>类名: VibratePreset|@ohos.vibrator.d.ts| +|新增|NA|类名:VibratePreset<br>方法or属性:|@ohos.vibrator.d.ts| +|新增|NA|模块名: ohos.vibrator<br>类名: VibratePreset<br>方法 or 属性:type: "preset";|@ohos.vibrator.d.ts| +|新增|NA|类名:VibratePreset<br>方法or属性:type: "preset";|@ohos.vibrator.d.ts| +|新增|NA|模块名: ohos.vibrator<br>类名: VibratePreset<br>方法 or 属性:effectId: string;|@ohos.vibrator.d.ts| +|新增|NA|类名:VibratePreset<br>方法or属性:effectId: string;|@ohos.vibrator.d.ts| +|新增|NA|模块名: ohos.vibrator<br>类名: VibratePreset<br>方法 or 属性:count: number;|@ohos.vibrator.d.ts| +|新增|NA|类名:VibratePreset<br>方法or属性:count: number;|@ohos.vibrator.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>,<br><br> options?: Options): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>,<br><br> options?: Options): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>,<br><br> options?: Options): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>,<br><br> options?: Options): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>,<br><br> options?: Options): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>,<br><br> options?: Options): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>,<br><br> options?: Options): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>,<br><br> options?: Options): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>,<br><br> options?: Options): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>,<br><br> options?: Options): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>,<br><br> options?: Options): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>,<br><br> options?: Options): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>,<br><br> options?: Options): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>,<br><br> options?: Options): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>,<br><br> options?: Options): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>,<br><br> options?: Options): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>,<br><br> options?: Options): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>,<br><br> options?: Options): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>,<br><br> options?: Options): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>,<br><br> options?: Options): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>,<br><br> options?: Options): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>,<br><br> options?: Options): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>,<br><br> options?: Options): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>,<br><br> options?: Options): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>,<br><br> options?: Options): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>,<br><br> options?: Options): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>,<br><br> options?: Options): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>,<br><br> options?: Options): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>,<br><br> options?: Options): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>,<br><br> options?: Options): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>,<br><br> options?: Options): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>,<br><br> options?: Options): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>,<br><br> options?: Options): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>,<br><br> options?: Options): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>,<br><br> options?: Options): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>,<br><br> options?: Options): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>,<br><br> options?: Options): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>,<br><br> options?: Options): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>,<br><br> options?: Options): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>,<br><br> options?: Options): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>,<br><br> options?: Options): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>,<br><br> options?: Options): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback?: Callback\<AccelerometerResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback?: Callback\<AccelerometerResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED,<br><br> callback?: Callback\<AccelerometerUncalibratedResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED,<br><br> callback?: Callback\<AccelerometerUncalibratedResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback?: Callback\<LightResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback?: Callback\<LightResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback?: Callback\<AmbientTemperatureResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback?: Callback\<AmbientTemperatureResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback?: Callback\<BarometerResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback?: Callback\<BarometerResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback?: Callback\<GravityResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback?: Callback\<GravityResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback?: Callback\<GyroscopeResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback?: Callback\<GyroscopeResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback?: Callback\<GyroscopeUncalibratedResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback?: Callback\<GyroscopeUncalibratedResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_HALL, callback?: Callback\<HallResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_HALL, callback?: Callback\<HallResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback?: Callback\<HeartRateResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback?: Callback\<HeartRateResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback?: Callback\<HumidityResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback?: Callback\<HumidityResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback?: Callback\<LinearAccelerometerResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback?: Callback\<LinearAccelerometerResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback?: Callback\<MagneticFieldResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback?: Callback\<MagneticFieldResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback?: Callback\<MagneticFieldUncalibratedResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback?: Callback\<MagneticFieldUncalibratedResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback?: Callback\<OrientationResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback?: Callback\<OrientationResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback?: Callback\<PedometerResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback?: Callback\<PedometerResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback?: Callback\<PedometerDetectionResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback?: Callback\<PedometerDetectionResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback?: Callback\<ProximityResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback?: Callback\<ProximityResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback?: Callback\<RotationVectorResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback?: Callback\<RotationVectorResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback?: Callback\<SignificantMotionResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback?: Callback\<SignificantMotionResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback?: Callback\<WearDetectionResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback?: Callback\<WearDetectionResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function getGeomagneticField(locationOptions: LocationOptions, timeMillis: number, callback: AsyncCallback\<GeomagneticResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function getGeomagneticField(locationOptions: LocationOptions, timeMillis: number, callback: AsyncCallback\<GeomagneticResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function getGeomagneticField(locationOptions: LocationOptions, timeMillis: number): Promise\<GeomagneticResponse>;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function getGeomagneticField(locationOptions: LocationOptions, timeMillis: number): Promise\<GeomagneticResponse>;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function getAltitude(seaPressure: number, currentPressure: number, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function getAltitude(seaPressure: number, currentPressure: number, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function getAltitude(seaPressure: number, currentPressure: number): Promise\<number>;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function getAltitude(seaPressure: number, currentPressure: number): Promise\<number>;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function getGeomagneticDip(inclinationMatrix: Array\<number>, callback: AsyncCallback\<number>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function getGeomagneticDip(inclinationMatrix: Array\<number>, callback: AsyncCallback\<number>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function getGeomagneticDip(inclinationMatrix: Array\<number>): Promise\<number>;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function getGeomagneticDip(inclinationMatrix: Array\<number>): Promise\<number>;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function getAngleModify(currentRotationMatrix: Array\<number>, preRotationMatrix: Array\<number>,<br><br> callback: AsyncCallback\<Array\<number>>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function getAngleModify(currentRotationMatrix: Array\<number>, preRotationMatrix: Array\<number>,<br><br> callback: AsyncCallback\<Array\<number>>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function getAngleModify(currentRotationMatrix: Array\<number>, preRotationMatrix: Array\<number>): Promise\<Array\<number>>;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function getAngleModify(currentRotationMatrix: Array\<number>, preRotationMatrix: Array\<number>): Promise\<Array\<number>>;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function createRotationMatrix(rotationVector: Array\<number>, callback: AsyncCallback\<Array\<number>>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function createRotationMatrix(rotationVector: Array\<number>, callback: AsyncCallback\<Array\<number>>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function createRotationMatrix(rotationVector: Array\<number>): Promise\<Array\<number>>;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function createRotationMatrix(rotationVector: Array\<number>): Promise\<Array\<number>>;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function transformCoordinateSystem(inRotationVector: Array\<number>, coordinates: CoordinatesOptions,<br><br> callback: AsyncCallback\<Array\<number>>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function transformCoordinateSystem(inRotationVector: Array\<number>, coordinates: CoordinatesOptions,<br><br> callback: AsyncCallback\<Array\<number>>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function transformCoordinateSystem(inRotationVector: Array\<number>, coordinates: CoordinatesOptions): Promise\<Array\<number>>;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function transformCoordinateSystem(inRotationVector: Array\<number>, coordinates: CoordinatesOptions): Promise\<Array\<number>>;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function createQuaternion(rotationVector: Array\<number>, callback: AsyncCallback\<Array\<number>>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function createQuaternion(rotationVector: Array\<number>, callback: AsyncCallback\<Array\<number>>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function createQuaternion(rotationVector: Array\<number>): Promise\<Array\<number>>;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function createQuaternion(rotationVector: Array\<number>): Promise\<Array\<number>>;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function getDirection(rotationMatrix: Array\<number>, callback: AsyncCallback\<Array\<number>>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function getDirection(rotationMatrix: Array\<number>, callback: AsyncCallback\<Array\<number>>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function getDirection(rotationMatrix: Array\<number>): Promise\<Array\<number>>;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function getDirection(rotationMatrix: Array\<number>): Promise\<Array\<number>>;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function createRotationMatrix(gravity: Array\<number>, geomagnetic: Array\<number>, callback: AsyncCallback\<RotationMatrixResponse>): void;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function createRotationMatrix(gravity: Array\<number>, geomagnetic: Array\<number>, callback: AsyncCallback\<RotationMatrixResponse>): void;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:sensor<br>方法 or 属性:function createRotationMatrix(gravity: Array\<number>, geomagnetic: Array\<number>,): Promise\<RotationMatrixResponse>;<br>废弃版本:N/A|类名:sensor<br>方法 or 属性:function createRotationMatrix(gravity: Array\<number>, geomagnetic: Array\<number>,): Promise\<RotationMatrixResponse>;<br>废弃版本:9<br>代替接口:sensor|@ohos.sensor.d.ts| +|废弃版本有变化|类名:SensorType<br>废弃版本:N/A|类名:SensorType<br>废弃版本:9<br>代替接口:sensor.SensorId |@ohos.sensor.d.ts| +|废弃版本有变化|类名:vibrator<br>方法 or 属性:function vibrate(duration: number, callback?: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:vibrator<br>方法 or 属性:function vibrate(duration: number, callback?: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:vibrator|@ohos.vibrator.d.ts| +|废弃版本有变化|类名:vibrator<br>方法 or 属性:function vibrate(duration: number): Promise\<void>;<br>废弃版本:N/A|类名:vibrator<br>方法 or 属性:function vibrate(duration: number): Promise\<void>;<br>废弃版本:9<br>代替接口:vibrator|@ohos.vibrator.d.ts| +|废弃版本有变化|类名:vibrator<br>方法 or 属性:function vibrate(effectId: EffectId): Promise\<void>;<br>废弃版本:N/A|类名:vibrator<br>方法 or 属性:function vibrate(effectId: EffectId): Promise\<void>;<br>废弃版本:9<br>代替接口:vibrator|@ohos.vibrator.d.ts| +|废弃版本有变化|类名:vibrator<br>方法 or 属性:function vibrate(effectId: EffectId, callback?: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:vibrator<br>方法 or 属性:function vibrate(effectId: EffectId, callback?: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:vibrator|@ohos.vibrator.d.ts| +|废弃版本有变化|类名:vibrator<br>方法 or 属性:function stop(stopMode: VibratorStopMode): Promise\<void>;<br>废弃版本:N/A|类名:vibrator<br>方法 or 属性:function stop(stopMode: VibratorStopMode): Promise\<void>;<br>废弃版本:9<br>代替接口:vibrator|@ohos.vibrator.d.ts| +|废弃版本有变化|类名:vibrator<br>方法 or 属性:function stop(stopMode: VibratorStopMode, callback?: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:vibrator<br>方法 or 属性:function stop(stopMode: VibratorStopMode, callback?: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:vibrator|@ohos.vibrator.d.ts| +|权限有变化|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>,<br><br> options?: Options): void;<br>权限:ohos.permission.READ_HEALTH_DATA|类名:sensor<br>方法 or 属性:function on(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>,<br><br> options?: Options): void;<br>权限:ohos.permission.HEALTH_DATA|@ohos.sensor.d.ts| +|权限有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>权限:ohos.permission.READ_HEALTH_DATA|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>权限:ohos.permission.HEART_RATE|@ohos.sensor.d.ts| +|权限有变化|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback?: Callback\<HeartRateResponse>): void;<br>权限:ohos.permission.READ_HEALTH_DATA|类名:sensor<br>方法 or 属性:function off(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback?: Callback\<HeartRateResponse>): void;<br>权限:ohos.permission.HEALTH_DATA|@ohos.sensor.d.ts| +|删除(权限)|类名:sensor<br>权限:ohos.permission.ACCELEROMETER|类名:sensor<br>权限:N/A|@ohos.sensor.d.ts| +|删除(权限)|类名:vibrator<br>权限:ohos.permission.VIBRATE|类名:vibrator<br>权限:N/A|@ohos.vibrator.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.LINEAR_ACCELEROMETER, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorId.WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER, callback: Callback\<AccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ACCELEROMETER_UNCALIBRATED, callback: Callback\<AccelerometerUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_LIGHT, callback: Callback\<LightResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_AMBIENT_TEMPERATURE, callback: Callback\<AmbientTemperatureResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_BAROMETER, callback: Callback\<BarometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GRAVITY, callback: Callback\<GravityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE, callback: Callback\<GyroscopeResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_GYROSCOPE_UNCALIBRATED, callback: Callback\<GyroscopeUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HALL, callback: Callback\<HallResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HEART_RATE, callback: Callback\<HeartRateResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_HUMIDITY, callback: Callback\<HumidityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_LINEAR_ACCELERATION, callback: Callback\<LinearAccelerometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD, callback: Callback\<MagneticFieldResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_MAGNETIC_FIELD_UNCALIBRATED, callback: Callback\<MagneticFieldUncalibratedResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ORIENTATION, callback: Callback\<OrientationResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER, callback: Callback\<PedometerResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PEDOMETER_DETECTION, callback: Callback\<PedometerDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_PROXIMITY, callback: Callback\<ProximityResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_ROTATION_VECTOR, callback: Callback\<RotationVectorResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_SIGNIFICANT_MOTION, callback: Callback\<SignificantMotionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| +|函数有变化|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|类名:sensor<br>方法 or 属性:function once(type: SensorType.SENSOR_TYPE_ID_WEAR_DETECTION, callback: Callback\<WearDetectionResponse>): void;<br>|@ohos.sensor.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-start-up.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-start-up.md new file mode 100644 index 0000000000000000000000000000000000000000..51574345fb635a9331694dc9317d5bee09dc4a21 --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-start-up.md @@ -0,0 +1,14 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.systemParameterEnhance<br>类名: systemParameterEnhance|@ohos.systemParameterEnhance.d.ts| +|新增|NA|模块名: ohos.systemParameterEnhance<br>类名: systemParameterEnhance<br>方法 or 属性: function getSync(key: string, def?: string): string;|@ohos.systemParameterEnhance.d.ts| +|新增|NA|模块名: ohos.systemParameterEnhance<br>类名: systemParameterEnhance<br>方法 or 属性: function get(key: string, callback: AsyncCallback\<string>): void;|@ohos.systemParameterEnhance.d.ts| +|新增|NA|模块名: ohos.systemParameterEnhance<br>类名: systemParameterEnhance<br>方法 or 属性: function get(key: string, def: string, callback: AsyncCallback\<string>): void;|@ohos.systemParameterEnhance.d.ts| +|新增|NA|模块名: ohos.systemParameterEnhance<br>类名: systemParameterEnhance<br>方法 or 属性: function get(key: string, def?: string): Promise\<string>;|@ohos.systemParameterEnhance.d.ts| +|新增|NA|模块名: ohos.systemParameterEnhance<br>类名: systemParameterEnhance<br>方法 or 属性: function setSync(key: string, value: string): void;|@ohos.systemParameterEnhance.d.ts| +|新增|NA|模块名: ohos.systemParameterEnhance<br>类名: systemParameterEnhance<br>方法 or 属性: function set(key: string, value: string, callback: AsyncCallback\<void>): void;|@ohos.systemParameterEnhance.d.ts| +|新增|NA|模块名: ohos.systemParameterEnhance<br>类名: systemParameterEnhance<br>方法 or 属性: function set(key: string, value: string): Promise\<void>;|@ohos.systemParameterEnhance.d.ts| +|废弃版本有变化|类名:deviceInfo<br>方法 or 属性:const hardwareProfile: string;<br>废弃版本:N/A|类名:deviceInfo<br>方法 or 属性:const hardwareProfile: string;<br>废弃版本:9<br>代替接口:N/A|@ohos.deviceInfo.d.ts| +|废弃版本有变化|类名:Device<br>方法 or 属性:static getInfo(options?: GetDeviceOptions): void;<br>废弃版本:N/A|类名:Device<br>方法 or 属性:static getInfo(options?: GetDeviceOptions): void;<br>废弃版本:6<br>代替接口:N/A|@system.device.d.ts| +|新增(权限)|类名:deviceInfo<br>方法 or 属性:const serial: string;<br>权限:N/A|类名:deviceInfo<br>方法 or 属性:const serial: string;<br>权限:ohos.permission.sec.ACCESS_UDID|@ohos.deviceInfo.d.ts| +|新增(权限)|类名:deviceInfo<br>方法 or 属性:const udid: string;<br>权限:N/A|类名:deviceInfo<br>方法 or 属性:const udid: string;<br>权限:ohos.permission.sec.ACCESS_UDID|@ohos.deviceInfo.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-telephony.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-telephony.md new file mode 100644 index 0000000000000000000000000000000000000000..ad4b4769bd4e4ec4a6575a4bf5e84fdd20d126a0 --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-telephony.md @@ -0,0 +1,656 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|类名:call<br>方法or属性:function dialCall(phoneNumber: string, callback: AsyncCallback\<void>): void;|@ohos.telephony.call.d.ts| +|新增|NA|类名:call<br>方法or属性:function dialCall(phoneNumber: string, options: DialCallOptions, callback: AsyncCallback\<void>): void;|@ohos.telephony.call.d.ts| +|新增|NA|类名:call<br>方法or属性:function dialCall(phoneNumber: string, options?: DialCallOptions): Promise\<void>;|@ohos.telephony.call.d.ts| +|新增|NA|类名:call<br>方法or属性:function answerCall(callId: number, callback: AsyncCallback\<void>): void;|@ohos.telephony.call.d.ts| +|新增|NA|类名:call<br>方法or属性:function answerCall(callId?: number): Promise\<void>;|@ohos.telephony.call.d.ts| +|新增|NA|类名:call<br>方法or属性:function answerCall(callback: AsyncCallback\<void>): void;|@ohos.telephony.call.d.ts| +|新增|NA|类名:call<br>方法or属性:function hangUpCall(callId: number, callback: AsyncCallback\<void>): void;|@ohos.telephony.call.d.ts| +|新增|NA|类名:call<br>方法or属性:function hangUpCall(callId?: number): Promise\<void>;|@ohos.telephony.call.d.ts| +|新增|NA|类名:call<br>方法or属性:function hangUpCall(callback: AsyncCallback\<void>): void;|@ohos.telephony.call.d.ts| +|新增|NA|类名:call<br>方法or属性:function rejectCall(callId: number, callback: AsyncCallback\<void>): void;|@ohos.telephony.call.d.ts| +|新增|NA|类名:call<br>方法or属性:function rejectCall(callId: number, options: RejectMessageOptions, callback: AsyncCallback\<void>): void;|@ohos.telephony.call.d.ts| +|新增|NA|类名:call<br>方法or属性:function rejectCall(callId?: number, options?: RejectMessageOptions): Promise\<void>;|@ohos.telephony.call.d.ts| +|新增|NA|类名:call<br>方法or属性:function rejectCall(callback: AsyncCallback\<void>): void;|@ohos.telephony.call.d.ts| +|新增|NA|类名:call<br>方法or属性:function rejectCall(options: RejectMessageOptions, callback: AsyncCallback\<void>): void;|@ohos.telephony.call.d.ts| +|新增|NA|类名:call<br>方法or属性:function on(type: 'mmiCodeResult', callback: Callback\<MmiCodeResults>): void;|@ohos.telephony.call.d.ts| +|新增|NA|类名:call<br>方法or属性:function off(type: 'mmiCodeResult', callback?: Callback\<MmiCodeResults>): void;|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: AudioDevice<br>方法 or 属性:DEVICE_EARPIECE|@ohos.telephony.call.d.ts| +|新增|NA|类名:AudioDevice<br>方法or属性:DEVICE_EARPIECE|@ohos.telephony.call.d.ts| +|新增|NA|类名:CallTransferInfo<br>方法or属性:startHour?: number;|@ohos.telephony.call.d.ts| +|新增|NA|类名:CallTransferInfo<br>方法or属性:startMinute?: number;|@ohos.telephony.call.d.ts| +|新增|NA|类名:CallTransferInfo<br>方法or属性:endHour?: number;|@ohos.telephony.call.d.ts| +|新增|NA|类名:CallTransferInfo<br>方法or属性:endMinute?: number;|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DialCallOptions|@ohos.telephony.call.d.ts| +|新增|NA|类名:DialCallOptions<br>方法or属性:|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DialCallOptions<br>方法 or 属性:accountId?: number;|@ohos.telephony.call.d.ts| +|新增|NA|类名:DialCallOptions<br>方法or属性:accountId?: number;|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DialCallOptions<br>方法 or 属性:videoState?: VideoStateType;|@ohos.telephony.call.d.ts| +|新增|NA|类名:DialCallOptions<br>方法or属性:videoState?: VideoStateType;|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DialCallOptions<br>方法 or 属性:dialScene?: DialScene;|@ohos.telephony.call.d.ts| +|新增|NA|类名:DialCallOptions<br>方法or属性:dialScene?: DialScene;|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DialCallOptions<br>方法 or 属性:dialType?: DialType;|@ohos.telephony.call.d.ts| +|新增|NA|类名:DialCallOptions<br>方法or属性:dialType?: DialType;|@ohos.telephony.call.d.ts| +|新增|NA|类名:CallTransferResult<br>方法or属性:startHour: number;|@ohos.telephony.call.d.ts| +|新增|NA|类名:CallTransferResult<br>方法or属性:startMinute: number;|@ohos.telephony.call.d.ts| +|新增|NA|类名:CallTransferResult<br>方法or属性:endHour: number;|@ohos.telephony.call.d.ts| +|新增|NA|类名:CallTransferResult<br>方法or属性:endMinute: number;|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: AudioDeviceOptions|@ohos.telephony.call.d.ts| +|新增|NA|类名:AudioDeviceOptions<br>方法or属性:|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: AudioDeviceOptions<br>方法 or 属性:bluetoothAddress?: string;|@ohos.telephony.call.d.ts| +|新增|NA|类名:AudioDeviceOptions<br>方法or属性:bluetoothAddress?: string;|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: MmiCodeResults|@ohos.telephony.call.d.ts| +|新增|NA|类名:MmiCodeResults<br>方法or属性:|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: MmiCodeResults<br>方法 or 属性:result: MmiCodeResult;|@ohos.telephony.call.d.ts| +|新增|NA|类名:MmiCodeResults<br>方法or属性:result: MmiCodeResult;|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: MmiCodeResults<br>方法 or 属性:message: string;|@ohos.telephony.call.d.ts| +|新增|NA|类名:MmiCodeResults<br>方法or属性:message: string;|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: MmiCodeResult|@ohos.telephony.call.d.ts| +|新增|NA|类名:MmiCodeResult<br>方法or属性:|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: MmiCodeResult<br>方法 or 属性:MMI_CODE_SUCCESS = 0|@ohos.telephony.call.d.ts| +|新增|NA|类名:MmiCodeResult<br>方法or属性:MMI_CODE_SUCCESS = 0|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: MmiCodeResult<br>方法 or 属性:MMI_CODE_FAILED = 1|@ohos.telephony.call.d.ts| +|新增|NA|类名:MmiCodeResult<br>方法or属性:MMI_CODE_FAILED = 1|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:UNASSIGNED_NUMBER = 1|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:UNASSIGNED_NUMBER = 1|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:NO_ROUTE_TO_DESTINATION = 3|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:NO_ROUTE_TO_DESTINATION = 3|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:CHANNEL_UNACCEPTABLE = 6|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:CHANNEL_UNACCEPTABLE = 6|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:OPERATOR_DETERMINED_BARRING = 8|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:OPERATOR_DETERMINED_BARRING = 8|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:CALL_COMPLETED_ELSEWHERE = 13|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:CALL_COMPLETED_ELSEWHERE = 13|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:NORMAL_CALL_CLEARING = 16|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:NORMAL_CALL_CLEARING = 16|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:USER_BUSY = 17|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:USER_BUSY = 17|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:NO_USER_RESPONDING = 18|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:NO_USER_RESPONDING = 18|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:USER_ALERTING_NO_ANSWER = 19|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:USER_ALERTING_NO_ANSWER = 19|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:CALL_REJECTED = 21|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:CALL_REJECTED = 21|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:NUMBER_CHANGED = 22|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:NUMBER_CHANGED = 22|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:CALL_REJECTED_DUE_TO_FEATURE_AT_THE_DESTINATION = 24|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:CALL_REJECTED_DUE_TO_FEATURE_AT_THE_DESTINATION = 24|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:FAILED_PRE_EMPTION = 25|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:FAILED_PRE_EMPTION = 25|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:NON_SELECTED_USER_CLEARING = 26|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:NON_SELECTED_USER_CLEARING = 26|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:DESTINATION_OUT_OF_ORDER = 27|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:DESTINATION_OUT_OF_ORDER = 27|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:INVALID_NUMBER_FORMAT = 28|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:INVALID_NUMBER_FORMAT = 28|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:FACILITY_REJECTED = 29|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:FACILITY_REJECTED = 29|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:RESPONSE_TO_STATUS_ENQUIRY = 30|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:RESPONSE_TO_STATUS_ENQUIRY = 30|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:NORMAL_UNSPECIFIED = 31|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:NORMAL_UNSPECIFIED = 31|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:NO_CIRCUIT_CHANNEL_AVAILABLE = 34|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:NO_CIRCUIT_CHANNEL_AVAILABLE = 34|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:NETWORK_OUT_OF_ORDER = 38|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:NETWORK_OUT_OF_ORDER = 38|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:TEMPORARY_FAILURE = 41|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:TEMPORARY_FAILURE = 41|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:SWITCHING_EQUIPMENT_CONGESTION = 42|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:SWITCHING_EQUIPMENT_CONGESTION = 42|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:ACCESS_INFORMATION_DISCARDED = 43|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:ACCESS_INFORMATION_DISCARDED = 43|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:REQUEST_CIRCUIT_CHANNEL_NOT_AVAILABLE = 44|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:REQUEST_CIRCUIT_CHANNEL_NOT_AVAILABLE = 44|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:RESOURCES_UNAVAILABLE_UNSPECIFIED = 47|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:RESOURCES_UNAVAILABLE_UNSPECIFIED = 47|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:QUALITY_OF_SERVICE_UNAVAILABLE = 49|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:QUALITY_OF_SERVICE_UNAVAILABLE = 49|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:REQUESTED_FACILITY_NOT_SUBSCRIBED = 50|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:REQUESTED_FACILITY_NOT_SUBSCRIBED = 50|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:INCOMING_CALLS_BARRED_WITHIN_THE_CUG = 55|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:INCOMING_CALLS_BARRED_WITHIN_THE_CUG = 55|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:BEARER_CAPABILITY_NOT_AUTHORIZED = 57|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:BEARER_CAPABILITY_NOT_AUTHORIZED = 57|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:BEARER_CAPABILITY_NOT_PRESENTLY_AVAILABLE = 58|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:BEARER_CAPABILITY_NOT_PRESENTLY_AVAILABLE = 58|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:SERVICE_OR_OPTION_NOT_AVAILABLE_UNSPECIFIED = 63|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:SERVICE_OR_OPTION_NOT_AVAILABLE_UNSPECIFIED = 63|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:BEARER_SERVICE_NOT_IMPLEMENTED = 65|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:BEARER_SERVICE_NOT_IMPLEMENTED = 65|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:ACM_EQUALTO_OR_GREATER_THAN_THE_MAXIMUM_VALUE = 68|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:ACM_EQUALTO_OR_GREATER_THAN_THE_MAXIMUM_VALUE = 68|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:REQUESTED_FACILITY_NOT_IMPLEMENTED = 69|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:REQUESTED_FACILITY_NOT_IMPLEMENTED = 69|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:ONLY_RESTRICTED_DIGITAL_INFO_BEARER_CAPABILITY_IS_AVAILABLE = 70|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:ONLY_RESTRICTED_DIGITAL_INFO_BEARER_CAPABILITY_IS_AVAILABLE = 70|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:SERVICE_OR_OPTION_NOT_IMPLEMENTED_UNSPECIFIED = 79|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:SERVICE_OR_OPTION_NOT_IMPLEMENTED_UNSPECIFIED = 79|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:INVALID_TRANSACTION_IDENTIFIER_VALUE = 81|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:INVALID_TRANSACTION_IDENTIFIER_VALUE = 81|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:USER_NOT_MEMBER_OF_CUG = 87|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:USER_NOT_MEMBER_OF_CUG = 87|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:INCOMPATIBLE_DESTINATION = 88|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:INCOMPATIBLE_DESTINATION = 88|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:INVALID_TRANSIT_NETWORK_SELECTION = 91|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:INVALID_TRANSIT_NETWORK_SELECTION = 91|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:SEMANTICALLY_INCORRECT_MESSAGE = 95|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:SEMANTICALLY_INCORRECT_MESSAGE = 95|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:INVALID_MANDATORY_INFORMATION = 96|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:INVALID_MANDATORY_INFORMATION = 96|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED = 97|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED = 97|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 98|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:MESSAGE_TYPE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 98|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:INFORMATION_ELEMENT_NON_EXISTENT_OR_NOT_IMPLEMENTED = 99|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:INFORMATION_ELEMENT_NON_EXISTENT_OR_NOT_IMPLEMENTED = 99|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:CONDITIONAL_IE_ERROR = 100|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:CONDITIONAL_IE_ERROR = 100|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 101|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:MESSAGE_NOT_COMPATIBLE_WITH_PROTOCOL_STATE = 101|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:RECOVERY_ON_TIMER_EXPIRED = 102|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:RECOVERY_ON_TIMER_EXPIRED = 102|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:PROTOCOL_ERROR_UNSPECIFIED = 111|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:PROTOCOL_ERROR_UNSPECIFIED = 111|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:INTERWORKING_UNSPECIFIED = 127|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:INTERWORKING_UNSPECIFIED = 127|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:CALL_BARRED = 240|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:CALL_BARRED = 240|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:FDN_BLOCKED = 241|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:FDN_BLOCKED = 241|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:IMSI_UNKNOWN_IN_VLR = 242|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:IMSI_UNKNOWN_IN_VLR = 242|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:IMEI_NOT_ACCEPTED = 243|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:IMEI_NOT_ACCEPTED = 243|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:DIAL_MODIFIED_TO_USSD = 244|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:DIAL_MODIFIED_TO_USSD = 244|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:DIAL_MODIFIED_TO_SS = 245|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:DIAL_MODIFIED_TO_SS = 245|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:DIAL_MODIFIED_TO_DIAL = 246|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:DIAL_MODIFIED_TO_DIAL = 246|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:RADIO_OFF = 247|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:RADIO_OFF = 247|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:OUT_OF_SERVICE = 248|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:OUT_OF_SERVICE = 248|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:NO_VALID_SIM = 249|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:NO_VALID_SIM = 249|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:RADIO_INTERNAL_ERROR = 250|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:RADIO_INTERNAL_ERROR = 250|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:NETWORK_RESP_TIMEOUT = 251|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:NETWORK_RESP_TIMEOUT = 251|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:NETWORK_REJECT = 252|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:NETWORK_REJECT = 252|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:RADIO_ACCESS_FAILURE = 253|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:RADIO_ACCESS_FAILURE = 253|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:RADIO_LINK_FAILURE = 254|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:RADIO_LINK_FAILURE = 254|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:RADIO_LINK_LOST = 255|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:RADIO_LINK_LOST = 255|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:RADIO_UPLINK_FAILURE = 256|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:RADIO_UPLINK_FAILURE = 256|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:RADIO_SETUP_FAILURE = 257|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:RADIO_SETUP_FAILURE = 257|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:RADIO_RELEASE_NORMAL = 258|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:RADIO_RELEASE_NORMAL = 258|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:RADIO_RELEASE_ABNORMAL = 259|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:RADIO_RELEASE_ABNORMAL = 259|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:ACCESS_CLASS_BLOCKED = 260|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:ACCESS_CLASS_BLOCKED = 260|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:NETWORK_DETACH = 261|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:NETWORK_DETACH = 261|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:INVALID_PARAMETER = 1025|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:INVALID_PARAMETER = 1025|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:SIM_NOT_EXIT = 1026|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:SIM_NOT_EXIT = 1026|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:SIM_PIN_NEED = 1027|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:SIM_PIN_NEED = 1027|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:CALL_NOT_ALLOW = 1029|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:CALL_NOT_ALLOW = 1029|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:SIM_INVALID = 1045|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:SIM_INVALID = 1045|@ohos.telephony.call.d.ts| +|新增|NA|模块名: ohos.telephony.call<br>类名: DisconnectedReason<br>方法 or 属性:UNKNOWN = 1279|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedReason<br>方法or属性:UNKNOWN = 1279|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedDetails<br>方法or属性:reason: DisconnectedReason;|@ohos.telephony.call.d.ts| +|新增|NA|类名:DisconnectedDetails<br>方法or属性:message: string;|@ohos.telephony.call.d.ts| +|新增|NA|类名:data<br>方法or属性:function getDefaultCellularDataSlotIdSync(): number;|@ohos.telephony.data.d.ts| +|新增|NA|类名:radio<br>方法or属性:function isNRSupported(): boolean;|@ohos.telephony.radio.d.ts| +|新增|NA|类名:radio<br>方法or属性:function isNRSupported(slotId: number): boolean;|@ohos.telephony.radio.d.ts| +|新增|NA|类名:radio<br>方法or属性:function getImsRegInfo(slotId: number, imsType: ImsServiceType, callback: AsyncCallback\<ImsRegInfo>): void;|@ohos.telephony.radio.d.ts| +|新增|NA|类名:radio<br>方法or属性:function getImsRegInfo(slotId: number, imsType: ImsServiceType): Promise\<ImsRegInfo>;|@ohos.telephony.radio.d.ts| +|新增|NA|类名:radio<br>方法or属性:function on(type: 'imsRegStateChange', slotId: number, imsType: ImsServiceType, callback: Callback\<ImsRegInfo>): void;|@ohos.telephony.radio.d.ts| +|新增|NA|类名:radio<br>方法or属性:function off(type: 'imsRegStateChange', slotId: number, imsType: ImsServiceType, callback?: Callback\<ImsRegInfo>): void;|@ohos.telephony.radio.d.ts| +|新增|NA|模块名: ohos.telephony.radio<br>类名: SignalInformation<br>方法 or 属性:dBm: number;|@ohos.telephony.radio.d.ts| +|新增|NA|类名:SignalInformation<br>方法or属性:dBm: number;|@ohos.telephony.radio.d.ts| +|新增|NA|模块名: ohos.telephony.radio<br>类名: ImsRegState|@ohos.telephony.radio.d.ts| +|新增|NA|类名:ImsRegState<br>方法or属性:|@ohos.telephony.radio.d.ts| +|新增|NA|模块名: ohos.telephony.radio<br>类名: ImsRegState<br>方法 or 属性:IMS_UNREGISTERED|@ohos.telephony.radio.d.ts| +|新增|NA|类名:ImsRegState<br>方法or属性:IMS_UNREGISTERED|@ohos.telephony.radio.d.ts| +|新增|NA|模块名: ohos.telephony.radio<br>类名: ImsRegState<br>方法 or 属性:IMS_REGISTERED|@ohos.telephony.radio.d.ts| +|新增|NA|类名:ImsRegState<br>方法or属性:IMS_REGISTERED|@ohos.telephony.radio.d.ts| +|新增|NA|模块名: ohos.telephony.radio<br>类名: ImsRegTech|@ohos.telephony.radio.d.ts| +|新增|NA|类名:ImsRegTech<br>方法or属性:|@ohos.telephony.radio.d.ts| +|新增|NA|模块名: ohos.telephony.radio<br>类名: ImsRegTech<br>方法 or 属性:REGISTRATION_TECH_NONE|@ohos.telephony.radio.d.ts| +|新增|NA|类名:ImsRegTech<br>方法or属性:REGISTRATION_TECH_NONE|@ohos.telephony.radio.d.ts| +|新增|NA|模块名: ohos.telephony.radio<br>类名: ImsRegTech<br>方法 or 属性:REGISTRATION_TECH_LTE|@ohos.telephony.radio.d.ts| +|新增|NA|类名:ImsRegTech<br>方法or属性:REGISTRATION_TECH_LTE|@ohos.telephony.radio.d.ts| +|新增|NA|模块名: ohos.telephony.radio<br>类名: ImsRegTech<br>方法 or 属性:REGISTRATION_TECH_IWLAN|@ohos.telephony.radio.d.ts| +|新增|NA|类名:ImsRegTech<br>方法or属性:REGISTRATION_TECH_IWLAN|@ohos.telephony.radio.d.ts| +|新增|NA|模块名: ohos.telephony.radio<br>类名: ImsRegTech<br>方法 or 属性:REGISTRATION_TECH_NR|@ohos.telephony.radio.d.ts| +|新增|NA|类名:ImsRegTech<br>方法or属性:REGISTRATION_TECH_NR|@ohos.telephony.radio.d.ts| +|新增|NA|模块名: ohos.telephony.radio<br>类名: ImsRegInfo|@ohos.telephony.radio.d.ts| +|新增|NA|类名:ImsRegInfo<br>方法or属性:|@ohos.telephony.radio.d.ts| +|新增|NA|模块名: ohos.telephony.radio<br>类名: ImsRegInfo<br>方法 or 属性:imsRegState: ImsRegState;|@ohos.telephony.radio.d.ts| +|新增|NA|类名:ImsRegInfo<br>方法or属性:imsRegState: ImsRegState;|@ohos.telephony.radio.d.ts| +|新增|NA|模块名: ohos.telephony.radio<br>类名: ImsRegInfo<br>方法 or 属性:imsRegTech: ImsRegTech;|@ohos.telephony.radio.d.ts| +|新增|NA|类名:ImsRegInfo<br>方法or属性:imsRegTech: ImsRegTech;|@ohos.telephony.radio.d.ts| +|新增|NA|模块名: ohos.telephony.radio<br>类名: ImsServiceType|@ohos.telephony.radio.d.ts| +|新增|NA|类名:ImsServiceType<br>方法or属性:|@ohos.telephony.radio.d.ts| +|新增|NA|模块名: ohos.telephony.radio<br>类名: ImsServiceType<br>方法 or 属性:TYPE_VOICE|@ohos.telephony.radio.d.ts| +|新增|NA|类名:ImsServiceType<br>方法or属性:TYPE_VOICE|@ohos.telephony.radio.d.ts| +|新增|NA|模块名: ohos.telephony.radio<br>类名: ImsServiceType<br>方法 or 属性:TYPE_VIDEO|@ohos.telephony.radio.d.ts| +|新增|NA|类名:ImsServiceType<br>方法or属性:TYPE_VIDEO|@ohos.telephony.radio.d.ts| +|新增|NA|模块名: ohos.telephony.radio<br>类名: ImsServiceType<br>方法 or 属性:TYPE_UT|@ohos.telephony.radio.d.ts| +|新增|NA|类名:ImsServiceType<br>方法or属性:TYPE_UT|@ohos.telephony.radio.d.ts| +|新增|NA|模块名: ohos.telephony.radio<br>类名: ImsServiceType<br>方法 or 属性:TYPE_SMS|@ohos.telephony.radio.d.ts| +|新增|NA|类名:ImsServiceType<br>方法or属性:TYPE_SMS|@ohos.telephony.radio.d.ts| +|新增|NA|类名:sim<br>方法or属性:function getOpKey(slotId: number, callback: AsyncCallback\<string>): void;|@ohos.telephony.sim.d.ts| +|新增|NA|类名:sim<br>方法or属性:function getOpKey(slotId: number): Promise\<string>;|@ohos.telephony.sim.d.ts| +|新增|NA|类名:sim<br>方法or属性:function getOpName(slotId: number, callback: AsyncCallback\<string>): void;|@ohos.telephony.sim.d.ts| +|新增|NA|类名:sim<br>方法or属性:function getOpName(slotId: number): Promise\<string>;|@ohos.telephony.sim.d.ts| +|新增|NA|模块名: ohos.telephony.sim<br>类名: OperatorConfigKey|@ohos.telephony.sim.d.ts| +|新增|NA|类名:OperatorConfigKey<br>方法or属性:|@ohos.telephony.sim.d.ts| +|新增|NA|模块名: ohos.telephony.sim<br>类名: OperatorConfigKey<br>方法 or 属性:KEY_VOICE_MAIL_NUMBER_STRING = "voice_mail_number_string"|@ohos.telephony.sim.d.ts| +|新增|NA|类名:OperatorConfigKey<br>方法or属性:KEY_VOICE_MAIL_NUMBER_STRING = "voice_mail_number_string"|@ohos.telephony.sim.d.ts| +|新增|NA|模块名: ohos.telephony.sim<br>类名: OperatorConfigKey<br>方法 or 属性:KEY_IMS_SWITCH_ON_BY_DEFAULT_BOOL = "ims_switch_on_by_default_bool"|@ohos.telephony.sim.d.ts| +|新增|NA|类名:OperatorConfigKey<br>方法or属性:KEY_IMS_SWITCH_ON_BY_DEFAULT_BOOL = "ims_switch_on_by_default_bool"|@ohos.telephony.sim.d.ts| +|新增|NA|模块名: ohos.telephony.sim<br>类名: OperatorConfigKey<br>方法 or 属性:KEY_HIDE_IMS_SWITCH_BOOL = "hide_ims_switch_bool"|@ohos.telephony.sim.d.ts| +|新增|NA|类名:OperatorConfigKey<br>方法or属性:KEY_HIDE_IMS_SWITCH_BOOL = "hide_ims_switch_bool"|@ohos.telephony.sim.d.ts| +|新增|NA|模块名: ohos.telephony.sim<br>类名: OperatorConfigKey<br>方法 or 属性:KEY_VOLTE_SUPPORTED_BOOL = "volte_supported_bool"|@ohos.telephony.sim.d.ts| +|新增|NA|类名:OperatorConfigKey<br>方法or属性:KEY_VOLTE_SUPPORTED_BOOL = "volte_supported_bool"|@ohos.telephony.sim.d.ts| +|新增|NA|模块名: ohos.telephony.sim<br>类名: OperatorConfigKey<br>方法 or 属性:KEY_NR_MODE_SUPPORTED_LIST_INT_ARRAY = "nr_mode_supported_list_int_array"|@ohos.telephony.sim.d.ts| +|新增|NA|类名:OperatorConfigKey<br>方法or属性:KEY_NR_MODE_SUPPORTED_LIST_INT_ARRAY = "nr_mode_supported_list_int_array"|@ohos.telephony.sim.d.ts| +|新增|NA|模块名: ohos.telephony.sim<br>类名: OperatorConfigKey<br>方法 or 属性:KEY_VOLTE_PROVISIONING_SUPPORTED_BOOL = "volte_provisioning_supported_bool"|@ohos.telephony.sim.d.ts| +|新增|NA|类名:OperatorConfigKey<br>方法or属性:KEY_VOLTE_PROVISIONING_SUPPORTED_BOOL = "volte_provisioning_supported_bool"|@ohos.telephony.sim.d.ts| +|新增|NA|模块名: ohos.telephony.sim<br>类名: OperatorConfigKey<br>方法 or 属性:KEY_SS_OVER_UT_SUPPORTED_BOOL = "ss_over_ut_supported_bool"|@ohos.telephony.sim.d.ts| +|新增|NA|类名:OperatorConfigKey<br>方法or属性:KEY_SS_OVER_UT_SUPPORTED_BOOL = "ss_over_ut_supported_bool"|@ohos.telephony.sim.d.ts| +|新增|NA|模块名: ohos.telephony.sim<br>类名: OperatorConfigKey<br>方法 or 属性:KEY_IMS_GBA_REQUIRED_BOOL = "ims_gba_required_bool"|@ohos.telephony.sim.d.ts| +|新增|NA|类名:OperatorConfigKey<br>方法or属性:KEY_IMS_GBA_REQUIRED_BOOL = "ims_gba_required_bool"|@ohos.telephony.sim.d.ts| +|新增|NA|模块名: ohos.telephony.sim<br>类名: OperatorConfigKey<br>方法 or 属性:KEY_UT_PROVISIONING_SUPPORTED_BOOL = "ut_provisioning_supported_bool"|@ohos.telephony.sim.d.ts| +|新增|NA|类名:OperatorConfigKey<br>方法or属性:KEY_UT_PROVISIONING_SUPPORTED_BOOL = "ut_provisioning_supported_bool"|@ohos.telephony.sim.d.ts| +|新增|NA|模块名: ohos.telephony.sim<br>类名: OperatorConfigKey<br>方法 or 属性:KEY_IMS_PREFER_FOR_EMERGENCY_BOOL = "ims_prefer_for_emergency_bool"|@ohos.telephony.sim.d.ts| +|新增|NA|类名:OperatorConfigKey<br>方法or属性:KEY_IMS_PREFER_FOR_EMERGENCY_BOOL = "ims_prefer_for_emergency_bool"|@ohos.telephony.sim.d.ts| +|新增|NA|模块名: ohos.telephony.sim<br>类名: OperatorConfigKey<br>方法 or 属性:KEY_CALL_WAITING_SERVICE_CLASS_INT = "call_waiting_service_class_int"|@ohos.telephony.sim.d.ts| +|新增|NA|类名:OperatorConfigKey<br>方法or属性:KEY_CALL_WAITING_SERVICE_CLASS_INT = "call_waiting_service_class_int"|@ohos.telephony.sim.d.ts| +|新增|NA|模块名: ohos.telephony.sim<br>类名: OperatorConfigKey<br>方法 or 属性:KEY_CALL_TRANSFER_VISIBILITY_BOOL = "call_transfer_visibility_bool"|@ohos.telephony.sim.d.ts| +|新增|NA|类名:OperatorConfigKey<br>方法or属性:KEY_CALL_TRANSFER_VISIBILITY_BOOL = "call_transfer_visibility_bool"|@ohos.telephony.sim.d.ts| +|新增|NA|模块名: ohos.telephony.sim<br>类名: OperatorConfigKey<br>方法 or 属性:KEY_IMS_CALL_DISCONNECT_REASON_INFO_MAPPING_STRING_ARRAY = "ims_call_disconnect_reason_info_mapping_string_array"|@ohos.telephony.sim.d.ts| +|新增|NA|类名:OperatorConfigKey<br>方法or属性:KEY_IMS_CALL_DISCONNECT_REASON_INFO_MAPPING_STRING_ARRAY = "ims_call_disconnect_reason_info_mapping_string_array"|@ohos.telephony.sim.d.ts| +|新增|NA|模块名: ohos.telephony.sim<br>类名: OperatorConfigKey<br>方法 or 属性:KEY_FORCE_VOLTE_SWITCH_ON_BOOL = "force_volte_switch_on_bool"|@ohos.telephony.sim.d.ts| +|新增|NA|类名:OperatorConfigKey<br>方法or属性:KEY_FORCE_VOLTE_SWITCH_ON_BOOL = "force_volte_switch_on_bool"|@ohos.telephony.sim.d.ts| +|新增|NA|模块名: ohos.telephony.sim<br>类名: OperatorConfigKey<br>方法 or 属性:KEY_ENABLE_OPERATOR_NAME_CUST_BOOL = "enable_operator_name_cust_bool"|@ohos.telephony.sim.d.ts| +|新增|NA|类名:OperatorConfigKey<br>方法or属性:KEY_ENABLE_OPERATOR_NAME_CUST_BOOL = "enable_operator_name_cust_bool"|@ohos.telephony.sim.d.ts| +|新增|NA|模块名: ohos.telephony.sim<br>类名: OperatorConfigKey<br>方法 or 属性:KEY_OPERATOR_NAME_CUST_STRING = "operator_name_cust_string"|@ohos.telephony.sim.d.ts| +|新增|NA|类名:OperatorConfigKey<br>方法or属性:KEY_OPERATOR_NAME_CUST_STRING = "operator_name_cust_string"|@ohos.telephony.sim.d.ts| +|新增|NA|模块名: ohos.telephony.sim<br>类名: OperatorConfigKey<br>方法 or 属性:KEY_SPN_DISPLAY_CONDITION_CUST_INT = "spn_display_condition_cust_int"|@ohos.telephony.sim.d.ts| +|新增|NA|类名:OperatorConfigKey<br>方法or属性:KEY_SPN_DISPLAY_CONDITION_CUST_INT = "spn_display_condition_cust_int"|@ohos.telephony.sim.d.ts| +|新增|NA|模块名: ohos.telephony.sim<br>类名: OperatorConfigKey<br>方法 or 属性:KEY_PNN_CUST_STRING_ARRAY = "pnn_cust_string_array"|@ohos.telephony.sim.d.ts| +|新增|NA|类名:OperatorConfigKey<br>方法or属性:KEY_PNN_CUST_STRING_ARRAY = "pnn_cust_string_array"|@ohos.telephony.sim.d.ts| +|新增|NA|模块名: ohos.telephony.sim<br>类名: OperatorConfigKey<br>方法 or 属性:KEY_OPL_CUST_STRING_ARRAY = "opl_cust_string_array"|@ohos.telephony.sim.d.ts| +|新增|NA|类名:OperatorConfigKey<br>方法or属性:KEY_OPL_CUST_STRING_ARRAY = "opl_cust_string_array"|@ohos.telephony.sim.d.ts| +|新增|NA|模块名: ohos.telephony.sim<br>类名: OperatorConfigKey<br>方法 or 属性:KEY_EMERGENCY_CALL_STRING_ARRAY = "emergency_call_string_array"|@ohos.telephony.sim.d.ts| +|新增|NA|类名:OperatorConfigKey<br>方法or属性:KEY_EMERGENCY_CALL_STRING_ARRAY = "emergency_call_string_array"|@ohos.telephony.sim.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:call<br>方法 or 属性:function answer(callId: number, callback: AsyncCallback\<void>): void;|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:call<br>方法 or 属性:function answer(callId: number): Promise\<void>;|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:call<br>方法 or 属性:function hangup(callId: number, callback: AsyncCallback\<void>): void;|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:call<br>方法 or 属性:function hangup(callId: number): Promise\<void>;|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:call<br>方法 or 属性:function reject(callId: number, callback: AsyncCallback\<void>): void;|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:call<br>方法 or 属性:function reject(callId: number, options: RejectMessageOptions, callback: AsyncCallback\<void>): void;|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:call<br>方法 or 属性:function reject(callId: number, options?: RejectMessageOptions): Promise\<void>;|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:DisconnectedDetails|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:DisconnectedDetails<br>方法 or 属性:UNASSIGNED_NUMBER = 1|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:DisconnectedDetails<br>方法 or 属性:NO_ROUTE_TO_DESTINATION = 3|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:DisconnectedDetails<br>方法 or 属性:CHANNEL_UNACCEPTABLE = 6|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:DisconnectedDetails<br>方法 or 属性:OPERATOR_DETERMINED_BARRING = 8|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:DisconnectedDetails<br>方法 or 属性:NORMAL_CALL_CLEARING = 16|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:DisconnectedDetails<br>方法 or 属性:USER_BUSY = 17|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:DisconnectedDetails<br>方法 or 属性:NO_USER_RESPONDING = 18|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:DisconnectedDetails<br>方法 or 属性:USER_ALERTING_NO_ANSWER = 19|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:DisconnectedDetails<br>方法 or 属性:CALL_REJECTED = 21|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:DisconnectedDetails<br>方法 or 属性:NUMBER_CHANGED = 22|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:DisconnectedDetails<br>方法 or 属性:DESTINATION_OUT_OF_ORDER = 27|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:DisconnectedDetails<br>方法 or 属性:INVALID_NUMBER_FORMAT = 28|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:DisconnectedDetails<br>方法 or 属性:NETWORK_OUT_OF_ORDER = 38|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:DisconnectedDetails<br>方法 or 属性:TEMPORARY_FAILURE = 41|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:DisconnectedDetails<br>方法 or 属性:INVALID_PARAMETER = 1025|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:DisconnectedDetails<br>方法 or 属性:SIM_NOT_EXIT = 1026|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:DisconnectedDetails<br>方法 or 属性:SIM_PIN_NEED = 1027|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:DisconnectedDetails<br>方法 or 属性:CALL_NOT_ALLOW = 1029|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:DisconnectedDetails<br>方法 or 属性:SIM_INVALID = 1045|NA|@ohos.telephony.call.d.ts| +|删除|模块名:ohos.telephony.call<br>类名:DisconnectedDetails<br>方法 or 属性:UNKNOWN = 1279|NA|@ohos.telephony.call.d.ts| +|废弃版本有变化|类名:call<br>方法 or 属性:function dial(phoneNumber: string, callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:call<br>方法 or 属性:function dial(phoneNumber: string, callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:telephony.call|@ohos.telephony.call.d.ts| +|废弃版本有变化|类名:call<br>方法 or 属性:function dial(phoneNumber: string, options: DialOptions, callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:call<br>方法 or 属性:function dial(phoneNumber: string, options: DialOptions, callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:telephony.call|@ohos.telephony.call.d.ts| +|废弃版本有变化|类名:call<br>方法 or 属性:function dial(phoneNumber: string, options?: DialOptions): Promise\<boolean>;<br>废弃版本:N/A|类名:call<br>方法 or 属性:function dial(phoneNumber: string, options?: DialOptions): Promise\<boolean>;<br>废弃版本:9<br>代替接口:telephony.call|@ohos.telephony.call.d.ts| +|废弃版本有变化|类名:radio<br>方法 or 属性:function isNrSupported(): boolean;<br>废弃版本:N/A|类名:radio<br>方法 or 属性:function isNrSupported(): boolean;<br>废弃版本:9<br>代替接口:telephony.radio|@ohos.telephony.radio.d.ts| +|废弃版本有变化|类名:radio<br>方法 or 属性:function isNrSupported(slotId: number): boolean;<br>废弃版本:N/A|类名:radio<br>方法 or 属性:function isNrSupported(slotId: number): boolean;<br>废弃版本:9<br>代替接口:telephony.radio|@ohos.telephony.radio.d.ts| +|起始版本有变化|类名:CallTransferInfo<br>方法 or 属性:transferNum: string;<br>起始版本:N/A|类名:CallTransferInfo<br>方法 or 属性:transferNum: string;<br>起始版本:8|@ohos.telephony.call.d.ts| +|起始版本有变化|类名:CallTransferInfo<br>方法 or 属性:type: CallTransferType;<br>起始版本:N/A|类名:CallTransferInfo<br>方法 or 属性:type: CallTransferType;<br>起始版本:8|@ohos.telephony.call.d.ts| +|起始版本有变化|类名:CallTransferInfo<br>方法 or 属性:settingType: CallTransferSettingType;<br>起始版本:N/A|类名:CallTransferInfo<br>方法 or 属性:settingType: CallTransferSettingType;<br>起始版本:8|@ohos.telephony.call.d.ts| +|起始版本有变化|类名:CallTransferResult<br>方法 or 属性:status: TransferStatus;<br>起始版本:N/A|类名:CallTransferResult<br>方法 or 属性:status: TransferStatus;<br>起始版本:8|@ohos.telephony.call.d.ts| +|起始版本有变化|类名:CallTransferResult<br>方法 or 属性:number: string;<br>起始版本:N/A|类名:CallTransferResult<br>方法 or 属性:number: string;<br>起始版本:8|@ohos.telephony.call.d.ts| +|起始版本有变化|类名:CallWaitingStatus<br>方法 or 属性:CALL_WAITING_DISABLE = 0<br>起始版本:N/A|类名:CallWaitingStatus<br>方法 or 属性:CALL_WAITING_DISABLE = 0<br>起始版本:7|@ohos.telephony.call.d.ts| +|起始版本有变化|类名:CallWaitingStatus<br>方法 or 属性:CALL_WAITING_ENABLE = 1<br>起始版本:N/A|类名:CallWaitingStatus<br>方法 or 属性:CALL_WAITING_ENABLE = 1<br>起始版本:7|@ohos.telephony.call.d.ts| +|起始版本有变化|类名:RestrictionStatus<br>方法 or 属性:RESTRICTION_DISABLE = 0<br>起始版本:N/A|类名:RestrictionStatus<br>方法 or 属性:RESTRICTION_DISABLE = 0<br>起始版本:8|@ohos.telephony.call.d.ts| +|起始版本有变化|类名:RestrictionStatus<br>方法 or 属性:RESTRICTION_ENABLE = 1<br>起始版本:N/A|类名:RestrictionStatus<br>方法 or 属性:RESTRICTION_ENABLE = 1<br>起始版本:8|@ohos.telephony.call.d.ts| +|起始版本有变化|类名:TransferStatus<br>方法 or 属性:TRANSFER_DISABLE = 0<br>起始版本:N/A|类名:TransferStatus<br>方法 or 属性:TRANSFER_DISABLE = 0<br>起始版本:8|@ohos.telephony.call.d.ts| +|起始版本有变化|类名:TransferStatus<br>方法 or 属性:TRANSFER_ENABLE = 1<br>起始版本:N/A|类名:TransferStatus<br>方法 or 属性:TRANSFER_ENABLE = 1<br>起始版本:8|@ohos.telephony.call.d.ts| +|起始版本有变化|类名:EmergencyNumberOptions<br>方法 or 属性:slotId?: number;<br>起始版本:N/A|类名:EmergencyNumberOptions<br>方法 or 属性:slotId?: number;<br>起始版本:7|@ohos.telephony.call.d.ts| +|起始版本有变化|类名:NumberFormatOptions<br>方法 or 属性:countryCode?: string;<br>起始版本:N/A|类名:NumberFormatOptions<br>方法 or 属性:countryCode?: string;<br>起始版本:7|@ohos.telephony.call.d.ts| +|权限有变化|类名:observer<br>方法 or 属性:function on(type: 'cellInfoChange', callback: Callback\<Array\<CellInformation>>): void;<br>权限:ohos.permission.LOCATION|类名:observer<br>方法 or 属性:function on(type: 'cellInfoChange', callback: Callback\<Array\<CellInformation>>): void;<br>权限:ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION|@ohos.telephony.observer.d.ts| +|权限有变化|类名:observer<br>方法 or 属性:function on(type: 'cellInfoChange', options: { slotId: number },<br> callback: Callback\<Array\<CellInformation>>): void;<br>权限:ohos.permission.LOCATION|类名:observer<br>方法 or 属性:function on(type: 'cellInfoChange', options: { slotId: number },<br> callback: Callback\<Array\<CellInformation>>): void;<br>权限:ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION|@ohos.telephony.observer.d.ts| +|权限有变化|类名:radio<br>方法 or 属性:function getCellInformation(callback: AsyncCallback\<Array\<CellInformation>>): void;<br>权限:ohos.permission.LOCATION|类名:radio<br>方法 or 属性:function getCellInformation(callback: AsyncCallback\<Array\<CellInformation>>): void;<br>权限:ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION|@ohos.telephony.radio.d.ts| +|权限有变化|类名:radio<br>方法 or 属性:function getCellInformation(slotId: number, callback: AsyncCallback\<Array\<CellInformation>>): void;<br>权限:ohos.permission.LOCATION|类名:radio<br>方法 or 属性:function getCellInformation(slotId: number, callback: AsyncCallback\<Array\<CellInformation>>): void;<br>权限:ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION|@ohos.telephony.radio.d.ts| +|权限有变化|类名:radio<br>方法 or 属性:function getCellInformation(slotId?: number): Promise\<Array\<CellInformation>>;<br>权限:ohos.permission.LOCATION|类名:radio<br>方法 or 属性:function getCellInformation(slotId?: number): Promise\<Array\<CellInformation>>;<br>权限:ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION|@ohos.telephony.radio.d.ts| +|删除(权限)|类名:data<br>方法 or 属性:function getDefaultCellularDataSlotId(callback: AsyncCallback\<number>): void;<br>权限:ohos.permission.GET_NETWORK_INFO|类名:data<br>方法 or 属性:function getDefaultCellularDataSlotId(callback: AsyncCallback\<number>): void;<br>权限:N/A|@ohos.telephony.data.d.ts| +|删除(权限)|类名:data<br>方法 or 属性:function getDefaultCellularDataSlotId(): Promise\<number>;<br>权限:ohos.permission.GET_NETWORK_INFO|类名:data<br>方法 or 属性:function getDefaultCellularDataSlotId(): Promise\<number>;<br>权限:N/A|@ohos.telephony.data.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function muteRinger(callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function muteRinger(): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function isEmergencyPhoneNumber(phoneNumber: string, callback: AsyncCallback\<boolean>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function isEmergencyPhoneNumber(phoneNumber: string, options: EmergencyNumberOptions, callback: AsyncCallback\<boolean>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function isEmergencyPhoneNumber(phoneNumber: string, options?: EmergencyNumberOptions): Promise\<boolean>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function formatPhoneNumber(phoneNumber: string, callback: AsyncCallback\<string>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function formatPhoneNumber(phoneNumber: string, options: NumberFormatOptions, callback: AsyncCallback\<string>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function formatPhoneNumber(phoneNumber: string, options?: NumberFormatOptions): Promise\<string>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function formatPhoneNumberToE164(phoneNumber: string, countryCode: string, callback: AsyncCallback\<string>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function formatPhoneNumberToE164(phoneNumber: string, countryCode: string): Promise\<string>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function holdCall(callId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function holdCall(callId: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function unHoldCall(callId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function unHoldCall(callId: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function switchCall(callId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function switchCall(callId: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function combineConference(callId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function combineConference(callId: number): Promise\<void>;<br>错误码内容: 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function getMainCallId(callId: number, callback: AsyncCallback\<number>): void;<br>错误码内容: 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function getMainCallId(callId: number): Promise\<number>;<br>错误码内容: 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function getSubCallIdList(callId: number, callback: AsyncCallback\<Array\<string>>): void;<br>错误码内容: 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function getSubCallIdList(callId: number): Promise\<Array\<string>>;<br>错误码内容: 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function getCallIdListForConference(callId: number, callback: AsyncCallback\<Array\<string>>): void;<br>错误码内容: 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function getCallIdListForConference(callId: number): Promise\<Array\<string>>;<br>错误码内容: 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function getCallWaitingStatus(slotId: number, callback: AsyncCallback\<CallWaitingStatus>): void;<br>错误码内容: 201, 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function getCallWaitingStatus(slotId: number): Promise\<CallWaitingStatus>;<br>错误码内容: 201, 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function setCallWaiting(slotId: number, activate: boolean, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function setCallWaiting(slotId: number, activate: boolean): Promise\<void>;<br>错误码内容: 201, 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function startDTMF(callId: number, character: string, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function startDTMF(callId: number, character: string): Promise\<void>;<br>错误码内容: 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function stopDTMF(callId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function stopDTMF(callId: number): Promise\<void>;<br>错误码内容: 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function isInEmergencyCall(callback: AsyncCallback\<boolean>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function isInEmergencyCall(): Promise\<boolean>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function on(type: 'callDetailsChange', callback: Callback\<CallAttributeOptions>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function off(type: 'callDetailsChange', callback?: Callback\<CallAttributeOptions>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function on(type: 'callEventChange', callback: Callback\<CallEventOptions>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function off(type: 'callEventChange', callback?: Callback\<CallEventOptions>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function on(type: 'callDisconnectedCause', callback: Callback\<DisconnectedDetails>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function off(type: 'callDisconnectedCause', callback?: Callback\<DisconnectedDetails>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function isNewCallAllowed(callback: AsyncCallback\<boolean>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function isNewCallAllowed(): Promise\<boolean>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function separateConference(callId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function separateConference(callId: number): Promise\<void>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function getCallRestrictionStatus(slotId: number, type: CallRestrictionType, callback: AsyncCallback\<RestrictionStatus>): void;<br>错误码内容: 201, 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function getCallRestrictionStatus(slotId: number, type: CallRestrictionType): Promise\<RestrictionStatus>;<br>错误码内容: 201, 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function setCallRestriction(slotId: number, info: CallRestrictionInfo, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function setCallRestriction(slotId: number, info: CallRestrictionInfo): Promise\<void>;<br>错误码内容: 201, 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function getCallTransferInfo(slotId: number, type: CallTransferType, callback: AsyncCallback\<CallTransferResult>): void;<br>错误码内容: 201, 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function getCallTransferInfo(slotId: number, type: CallTransferType): Promise\<CallTransferResult>;<br>错误码内容: 201, 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function setCallTransfer(slotId: number, info: CallTransferInfo, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function setCallTransfer(slotId: number, info: CallTransferInfo): Promise\<void>;<br>错误码内容: 201, 401, 801, 8300001, 8300002, 8300003|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function isRinging(callback: AsyncCallback\<boolean>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function isRinging(): Promise\<boolean>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function setMuted(callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function setMuted(): Promise\<void>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function cancelMuted(callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function cancelMuted(): Promise\<void>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function setAudioDevice(device: AudioDevice, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function joinConference(mainCallId: number, callNumberList: Array\<string>, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function joinConference(mainCallId: number, callNumberList: Array\<string>): Promise\<void>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function updateImsCallMode(callId: number, mode: ImsCallMode, callback: AsyncCallback\<void>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function updateImsCallMode(callId: number, mode: ImsCallMode): Promise\<void>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function enableImsSwitch(slotId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function enableImsSwitch(slotId: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function disableImsSwitch(slotId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function disableImsSwitch(slotId: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function isImsSwitchEnabled(slotId: number, callback: AsyncCallback\<boolean>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:call<br>方法 or 属性:function isImsSwitchEnabled(slotId: number): Promise\<boolean>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.call.d.ts| +|新增(错误码)|NA|类名:data<br>方法 or 属性:function setDefaultCellularDataSlotId(slotId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301001|@ohos.telephony.data.d.ts| +|新增(错误码)|NA|类名:data<br>方法 or 属性:function setDefaultCellularDataSlotId(slotId: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301001|@ohos.telephony.data.d.ts| +|新增(错误码)|NA|类名:data<br>方法 or 属性:function isCellularDataEnabled(callback: AsyncCallback\<boolean>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.data.d.ts| +|新增(错误码)|NA|类名:data<br>方法 or 属性:function isCellularDataEnabled(): Promise\<boolean>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.data.d.ts| +|新增(错误码)|NA|类名:data<br>方法 or 属性:function enableCellularData(callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.data.d.ts| +|新增(错误码)|NA|类名:data<br>方法 or 属性:function enableCellularData(): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.data.d.ts| +|新增(错误码)|NA|类名:data<br>方法 or 属性:function disableCellularData(callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.data.d.ts| +|新增(错误码)|NA|类名:data<br>方法 or 属性:function disableCellularData(): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.data.d.ts| +|新增(错误码)|NA|类名:data<br>方法 or 属性:function isCellularDataRoamingEnabled(slotId: number, callback: AsyncCallback\<boolean>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.data.d.ts| +|新增(错误码)|NA|类名:data<br>方法 or 属性:function isCellularDataRoamingEnabled(slotId: number): Promise\<boolean>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.data.d.ts| +|新增(错误码)|NA|类名:data<br>方法 or 属性:function enableCellularDataRoaming(slotId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.data.d.ts| +|新增(错误码)|NA|类名:data<br>方法 or 属性:function enableCellularDataRoaming(slotId: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.data.d.ts| +|新增(错误码)|NA|类名:data<br>方法 or 属性:function disableCellularDataRoaming(slotId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.data.d.ts| +|新增(错误码)|NA|类名:data<br>方法 or 属性:function disableCellularDataRoaming(slotId: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.data.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function on(type: 'networkStateChange', callback: Callback\<NetworkState>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function on(type: 'networkStateChange', options: { slotId: number }, callback: Callback\<NetworkState>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function off(type: 'networkStateChange', callback?: Callback\<NetworkState>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function on(type: 'signalInfoChange', callback: Callback\<Array\<SignalInformation>>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function on(type: 'signalInfoChange', options: { slotId: number },<br> callback: Callback\<Array\<SignalInformation>>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function off(type: 'signalInfoChange', callback?: Callback\<Array\<SignalInformation>>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function on(type: 'cellInfoChange', callback: Callback\<Array\<CellInformation>>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function on(type: 'cellInfoChange', options: { slotId: number },<br> callback: Callback\<Array\<CellInformation>>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function off(type: 'cellInfoChange', callback?: Callback\<Array\<CellInformation>>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function on(type: 'cellularDataConnectionStateChange',<br> callback: Callback\<{ state: DataConnectState, network: RatType }>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function on(type: 'cellularDataConnectionStateChange', options: { slotId: number },<br> callback: Callback\<{ state: DataConnectState, network: RatType }>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function off(type: 'cellularDataConnectionStateChange',<br> callback?: Callback\<{ state: DataConnectState, network: RatType }>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function on(type: 'cellularDataFlowChange', callback: Callback\<DataFlowType>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function on(type: 'cellularDataFlowChange', options: { slotId: number },<br> callback: Callback\<DataFlowType>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function off(type: 'cellularDataFlowChange', callback?: Callback\<DataFlowType>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function on(type: 'callStateChange', callback: Callback\<{ state: CallState, number: string }>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function on(type: 'callStateChange', options: { slotId: number },<br> callback: Callback\<{ state: CallState, number: string }>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function off(type: 'callStateChange', callback?: Callback\<{ state: CallState, number: string }>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function on(type: 'simStateChange', callback: Callback\<SimStateData>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function on(type: 'simStateChange', options: { slotId: number }, callback: Callback\<SimStateData>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:observer<br>方法 or 属性:function off(type: 'simStateChange', callback?: Callback\<SimStateData>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.observer.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getRadioTech(slotId: number,<br> callback: AsyncCallback\<{psRadioTech: RadioTechnology, csRadioTech: RadioTechnology}>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getRadioTech(slotId: number): Promise\<{psRadioTech: RadioTechnology, csRadioTech: RadioTechnology}>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getNetworkState(callback: AsyncCallback\<NetworkState>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getNetworkState(slotId: number, callback: AsyncCallback\<NetworkState>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getNetworkState(slotId?: number): Promise\<NetworkState>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function sendUpdateCellLocationRequest(callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getCellInformation(callback: AsyncCallback\<Array\<CellInformation>>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getCellInformation(slotId: number, callback: AsyncCallback\<Array\<CellInformation>>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getCellInformation(slotId?: number): Promise\<Array\<CellInformation>>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getNetworkSelectionMode(slotId: number, callback: AsyncCallback\<NetworkSelectionMode>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getNetworkSelectionMode(slotId: number): Promise\<NetworkSelectionMode>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function setNetworkSelectionMode(options: NetworkSelectionModeOptions, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function setNetworkSelectionMode(options: NetworkSelectionModeOptions): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getNetworkSearchInformation(slotId: number, callback: AsyncCallback\<NetworkSearchResult>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getNetworkSearchInformation(slotId: number): Promise\<NetworkSearchResult>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getISOCountryCodeForNetwork(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getISOCountryCodeForNetwork(slotId: number): Promise\<string>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getNrOptionMode(callback: AsyncCallback\<NrOptionMode>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getNrOptionMode(slotId: number, callback: AsyncCallback\<NrOptionMode>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getNrOptionMode(slotId?: number): Promise\<NrOptionMode>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getIMEI(callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getIMEI(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getIMEI(slotId?: number): Promise\<string>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getMEID(callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getMEID(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getMEID(slotId?: number): Promise\<string>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getUniqueDeviceId(callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getUniqueDeviceId(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getUniqueDeviceId(slotId?: number): Promise\<string>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getPrimarySlotId(callback: AsyncCallback\<number>): void;<br>错误码内容: 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getPrimarySlotId(): Promise\<number>;<br>错误码内容: 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function setPrimarySlotId(slotId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function setPrimarySlotId(slotId: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getSignalInformation(slotId: number, callback: AsyncCallback\<Array\<SignalInformation>>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getSignalInformation(slotId: number): Promise\<Array\<SignalInformation>>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function isRadioOn(callback: AsyncCallback\<boolean>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function isRadioOn(slotId: number, callback: AsyncCallback\<boolean>): void<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function isRadioOn(slotId?: number): Promise\<boolean>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function turnOnRadio(callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function turnOnRadio(slotId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function turnOnRadio(slotId?: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function turnOffRadio(callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function turnOffRadio(slotId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function turnOffRadio(slotId?: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getOperatorName(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getOperatorName(slotId: number): Promise\<string>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function setPreferredNetwork(slotId: number, networkMode: PreferredNetworkMode, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function setPreferredNetwork(slotId: number, networkMode: PreferredNetworkMode): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getPreferredNetwork(slotId: number, callback: AsyncCallback\<PreferredNetworkMode>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:radio<br>方法 or 属性:function getPreferredNetwork(slotId: number): Promise\<PreferredNetworkMode>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.radio.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function hasOperatorPrivileges(slotId: number, callback: AsyncCallback\<boolean>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function hasOperatorPrivileges(slotId: number): Promise\<boolean>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getISOCountryCodeForSim(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getISOCountryCodeForSim(slotId: number): Promise\<string>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getSimOperatorNumeric(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getSimOperatorNumeric(slotId: number): Promise\<string>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getSimSpn(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getSimSpn(slotId: number): Promise\<string>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getSimState(slotId: number, callback: AsyncCallback\<SimState>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getSimState(slotId: number): Promise\<SimState>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getCardType(slotId: number, callback: AsyncCallback\<CardType>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getCardType(slotId: number): Promise\<CardType>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getSimIccId(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getSimIccId(slotId: number): Promise\<string>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getVoiceMailIdentifier(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getVoiceMailIdentifier(slotId: number): Promise\<string>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getVoiceMailNumber(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getVoiceMailNumber(slotId: number): Promise\<string>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function setVoiceMailInfo(slotId: number, mailName: string, mailNumber: string, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function setVoiceMailInfo(slotId: number, mailName: string, mailNumber: string): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getSimTelephoneNumber(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getSimTelephoneNumber(slotId: number): Promise\<string>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getSimGid1(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getSimGid1(slotId: number): Promise\<string>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getIMSI(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getIMSI(slotId: number): Promise\<string>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function hasSimCard(slotId: number, callback: AsyncCallback\<boolean>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function hasSimCard(slotId: number): Promise\<boolean>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getSimAccountInfo(slotId: number, callback: AsyncCallback\<IccAccountInfo>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getSimAccountInfo(slotId: number): Promise\<IccAccountInfo>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getActiveSimAccountInfoList(callback: AsyncCallback\<Array\<IccAccountInfo>>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getActiveSimAccountInfoList(): Promise\<Array\<IccAccountInfo>>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function setDefaultVoiceSlotId(slotId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301001|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function setDefaultVoiceSlotId(slotId: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301001|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function activateSim(slotId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function activateSim(slotId: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function deactivateSim(slotId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function deactivateSim(slotId: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function setShowName(slotId: number, name: string, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function setShowName(slotId: number, name: string): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getShowName(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getShowName(slotId: number): Promise\<string>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function setShowNumber(slotId: number, number: string, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function setShowNumber(slotId: number, number: string): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getShowNumber(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getShowNumber(slotId: number): Promise\<string>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getOperatorConfigs(slotId: number, callback: AsyncCallback\<Array\<OperatorConfig>>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getOperatorConfigs(slotId: number): Promise\<Array\<OperatorConfig>>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function unlockPin(slotId: number, pin: string, callback: AsyncCallback\<LockStatusResponse>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function unlockPin(slotId: number, pin: string): Promise\<LockStatusResponse>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function unlockPuk(slotId: number, newPin: string, puk: string, callback: AsyncCallback\<LockStatusResponse>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function unlockPuk(slotId: number, newPin: string, puk: string): Promise\<LockStatusResponse>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function alterPin(slotId: number, newPin: string, oldPin: string, callback: AsyncCallback\<LockStatusResponse>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function alterPin(slotId: number, newPin: string, oldPin: string): Promise\<LockStatusResponse>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function setLockState(slotId: number, options: LockInfo, callback: AsyncCallback\<LockStatusResponse>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function setLockState(slotId: number, options: LockInfo): Promise\<LockStatusResponse>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function unlockPin2(slotId: number, pin2: string, callback: AsyncCallback\<LockStatusResponse>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function unlockPin2(slotId: number, pin2: string): Promise\<LockStatusResponse>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function unlockPuk2(slotId: number, newPin2: string, puk2: string, callback: AsyncCallback\<LockStatusResponse>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function unlockPuk2(slotId: number, newPin2: string, puk2: string): Promise\<LockStatusResponse>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function alterPin2(slotId: number, newPin2: string, oldPin2: string, callback: AsyncCallback\<LockStatusResponse>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function alterPin2(slotId: number, newPin2: string, oldPin2: string): Promise\<LockStatusResponse>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function queryIccDiallingNumbers(slotId: number, type: ContactType, callback: AsyncCallback\<Array\<DiallingNumbersInfo>>): void<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function queryIccDiallingNumbers(slotId: number, type: ContactType): Promise\<Array\<DiallingNumbersInfo>>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function addIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function addIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function delIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function delIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function updateIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function updateIccDiallingNumbers(slotId: number, type: ContactType, diallingNumbers: DiallingNumbersInfo): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getLockState(slotId: number, lockType: LockType, callback: AsyncCallback\<LockState>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function getLockState(slotId: number, lockType: LockType): Promise\<LockState>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function sendEnvelopeCmd(slotId: number, cmd: string, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function sendEnvelopeCmd(slotId: number, cmd: string): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function sendTerminalResponseCmd(slotId: number, cmd: string, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function sendTerminalResponseCmd(slotId: number, cmd: string): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function unlockSimLock(slotId: number, lockInfo: PersoLockInfo, callback: AsyncCallback\<LockStatusResponse>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sim<br>方法 or 属性:function unlockSimLock(slotId: number, lockInfo: PersoLockInfo): Promise\<LockStatusResponse>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999, 8301002|@ohos.telephony.sim.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function splitMessage(content: string, callback: AsyncCallback\<Array\<string>>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function splitMessage(content: string): Promise\<Array\<string>>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function createMessage(pdu: Array\<number>, specification: string, callback: AsyncCallback\<ShortMessage>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function createMessage(pdu: Array\<number>, specification: string): Promise\<ShortMessage>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function sendMessage(options: SendMessageOptions): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function setDefaultSmsSlotId(slotId: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function setDefaultSmsSlotId(slotId: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300004, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function setSmscAddr(slotId: number, smscAddr: string, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function setSmscAddr(slotId: number, smscAddr: string): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function getSmscAddr(slotId: number, callback: AsyncCallback\<string>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function getSmscAddr(slotId: number): Promise\<string>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function addSimMessage(options: SimMessageOptions, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function addSimMessage(options: SimMessageOptions): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function delSimMessage(slotId: number, msgIndex: number, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function delSimMessage(slotId: number, msgIndex: number): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function updateSimMessage(options: UpdateSimMessageOptions, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function updateSimMessage(options: UpdateSimMessageOptions): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function getAllSimMessages(slotId: number, callback: AsyncCallback\<Array\<SimShortMessage>>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function getAllSimMessages(slotId: number): Promise\<Array\<SimShortMessage>>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function setCBConfig(options: CBConfigOptions, callback: AsyncCallback\<void>): void;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function setCBConfig(options: CBConfigOptions): Promise\<void>;<br>错误码内容: 201, 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function getSmsSegmentsInfo(slotId: number, message: string, force7bit: boolean, callback: AsyncCallback\<SmsSegmentsInfo>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function getSmsSegmentsInfo(slotId: number, message: string, force7bit: boolean): Promise\<SmsSegmentsInfo>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function getImsShortMessageFormat(callback: AsyncCallback\<string>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function getImsShortMessageFormat(): Promise\<string>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function decodeMms(mmsFilePathName: string \| Array\<number>, callback: AsyncCallback\<MmsInformation>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function decodeMms(mmsFilePathName: string \| Array\<number>): Promise\<MmsInformation>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function encodeMms(mms: MmsInformation, callback: AsyncCallback\<Array\<number>>): void;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(错误码)|NA|类名:sms<br>方法 or 属性:function encodeMms(mms: MmsInformation): Promise\<Array\<number>>;<br>错误码内容: 401, 8300001, 8300002, 8300003, 8300999|@ohos.telephony.sms.d.ts| +|新增(权限)|类名:call<br>方法 or 属性:function holdCall(callId: number, callback: AsyncCallback\<void>): void;<br>权限:N/A|类名:call<br>方法 or 属性:function holdCall(callId: number, callback: AsyncCallback\<void>): void;<br>权限:ohos.permission.ANSWER_CALL|@ohos.telephony.call.d.ts| +|新增(权限)|类名:call<br>方法 or 属性:function holdCall(callId: number): Promise\<void>;<br>权限:N/A|类名:call<br>方法 or 属性:function holdCall(callId: number): Promise\<void>;<br>权限:ohos.permission.ANSWER_CALL|@ohos.telephony.call.d.ts| +|新增(权限)|类名:call<br>方法 or 属性:function unHoldCall(callId: number, callback: AsyncCallback\<void>): void;<br>权限:N/A|类名:call<br>方法 or 属性:function unHoldCall(callId: number, callback: AsyncCallback\<void>): void;<br>权限:ohos.permission.ANSWER_CALL|@ohos.telephony.call.d.ts| +|新增(权限)|类名:call<br>方法 or 属性:function unHoldCall(callId: number): Promise\<void>;<br>权限:N/A|类名:call<br>方法 or 属性:function unHoldCall(callId: number): Promise\<void>;<br>权限:ohos.permission.ANSWER_CALL|@ohos.telephony.call.d.ts| +|新增(权限)|类名:call<br>方法 or 属性:function switchCall(callId: number, callback: AsyncCallback\<void>): void;<br>权限:N/A|类名:call<br>方法 or 属性:function switchCall(callId: number, callback: AsyncCallback\<void>): void;<br>权限:ohos.permission.ANSWER_CALL|@ohos.telephony.call.d.ts| +|新增(权限)|类名:call<br>方法 or 属性:function switchCall(callId: number): Promise\<void>;<br>权限:N/A|类名:call<br>方法 or 属性:function switchCall(callId: number): Promise\<void>;<br>权限:ohos.permission.ANSWER_CALL|@ohos.telephony.call.d.ts| +|新增(权限)|类名:call<br>方法 or 属性:function getCallWaitingStatus(slotId: number, callback: AsyncCallback\<CallWaitingStatus>): void;<br>权限:N/A|类名:call<br>方法 or 属性:function getCallWaitingStatus(slotId: number, callback: AsyncCallback\<CallWaitingStatus>): void;<br>权限:ohos.permission.GET_TELEPHONY_STATE|@ohos.telephony.call.d.ts| +|新增(权限)|类名:call<br>方法 or 属性:function getCallWaitingStatus(slotId: number): Promise\<CallWaitingStatus>;<br>权限:N/A|类名:call<br>方法 or 属性:function getCallWaitingStatus(slotId: number): Promise\<CallWaitingStatus>;<br>权限:ohos.permission.GET_TELEPHONY_STATE|@ohos.telephony.call.d.ts| +|新增(权限)|类名:call<br>方法 or 属性:function setCallWaiting(slotId: number, activate: boolean, callback: AsyncCallback\<void>): void;<br>权限:N/A|类名:call<br>方法 or 属性:function setCallWaiting(slotId: number, activate: boolean, callback: AsyncCallback\<void>): void;<br>权限:ohos.permission.SET_TELEPHONY_STATE|@ohos.telephony.call.d.ts| +|新增(权限)|类名:call<br>方法 or 属性:function setCallWaiting(slotId: number, activate: boolean): Promise\<void>;<br>权限:N/A|类名:call<br>方法 or 属性:function setCallWaiting(slotId: number, activate: boolean): Promise\<void>;<br>权限:ohos.permission.SET_TELEPHONY_STATE|@ohos.telephony.call.d.ts| +|新增(权限)|类名:call<br>方法 or 属性:function on(type: 'callDetailsChange', callback: Callback\<CallAttributeOptions>): void;<br>权限:N/A|类名:call<br>方法 or 属性:function on(type: 'callDetailsChange', callback: Callback\<CallAttributeOptions>): void;<br>权限:ohos.permission.SET_TELEPHONY_STATE|@ohos.telephony.call.d.ts| +|新增(权限)|类名:call<br>方法 or 属性:function off(type: 'callDetailsChange', callback?: Callback\<CallAttributeOptions>): void;<br>权限:N/A|类名:call<br>方法 or 属性:function off(type: 'callDetailsChange', callback?: Callback\<CallAttributeOptions>): void;<br>权限:ohos.permission.SET_TELEPHONY_STATE|@ohos.telephony.call.d.ts| +|新增(权限)|类名:call<br>方法 or 属性:function on(type: 'callEventChange', callback: Callback\<CallEventOptions>): void;<br>权限:N/A|类名:call<br>方法 or 属性:function on(type: 'callEventChange', callback: Callback\<CallEventOptions>): void;<br>权限:ohos.permission.SET_TELEPHONY_STATE|@ohos.telephony.call.d.ts| +|新增(权限)|类名:call<br>方法 or 属性:function off(type: 'callEventChange', callback?: Callback\<CallEventOptions>): void;<br>权限:N/A|类名:call<br>方法 or 属性:function off(type: 'callEventChange', callback?: Callback\<CallEventOptions>): void;<br>权限:ohos.permission.SET_TELEPHONY_STATE|@ohos.telephony.call.d.ts| +|新增(权限)|类名:call<br>方法 or 属性:function on(type: 'callDisconnectedCause', callback: Callback\<DisconnectedDetails>): void;<br>权限:N/A|类名:call<br>方法 or 属性:function on(type: 'callDisconnectedCause', callback: Callback\<DisconnectedDetails>): void;<br>权限:ohos.permission.SET_TELEPHONY_STATE|@ohos.telephony.call.d.ts| +|新增(权限)|类名:call<br>方法 or 属性:function off(type: 'callDisconnectedCause', callback?: Callback\<DisconnectedDetails>): void;<br>权限:N/A|类名:call<br>方法 or 属性:function off(type: 'callDisconnectedCause', callback?: Callback\<DisconnectedDetails>): void;<br>权限:ohos.permission.SET_TELEPHONY_STATE|@ohos.telephony.call.d.ts| +|新增(权限)|类名:call<br>方法 or 属性:function getCallRestrictionStatus(slotId: number, type: CallRestrictionType, callback: AsyncCallback\<RestrictionStatus>): void;<br>权限:N/A|类名:call<br>方法 or 属性:function getCallRestrictionStatus(slotId: number, type: CallRestrictionType, callback: AsyncCallback\<RestrictionStatus>): void;<br>权限:ohos.permission.GET_TELEPHONY_STATE|@ohos.telephony.call.d.ts| +|新增(权限)|类名:call<br>方法 or 属性:function getCallRestrictionStatus(slotId: number, type: CallRestrictionType): Promise\<RestrictionStatus>;<br>权限:N/A|类名:call<br>方法 or 属性:function getCallRestrictionStatus(slotId: number, type: CallRestrictionType): Promise\<RestrictionStatus>;<br>权限:ohos.permission.GET_TELEPHONY_STATE|@ohos.telephony.call.d.ts| +|新增(权限)|类名:call<br>方法 or 属性:function setCallRestriction(slotId: number, info: CallRestrictionInfo, callback: AsyncCallback\<void>): void;<br>权限:N/A|类名:call<br>方法 or 属性:function setCallRestriction(slotId: number, info: CallRestrictionInfo, callback: AsyncCallback\<void>): void;<br>权限:ohos.permission.SET_TELEPHONY_STATE|@ohos.telephony.call.d.ts| +|新增(权限)|类名:call<br>方法 or 属性:function setCallRestriction(slotId: number, info: CallRestrictionInfo): Promise\<void>;<br>权限:N/A|类名:call<br>方法 or 属性:function setCallRestriction(slotId: number, info: CallRestrictionInfo): Promise\<void>;<br>权限:ohos.permission.SET_TELEPHONY_STATE|@ohos.telephony.call.d.ts| +|新增(权限)|类名:call<br>方法 or 属性:function getCallTransferInfo(slotId: number, type: CallTransferType, callback: AsyncCallback\<CallTransferResult>): void;<br>权限:N/A|类名:call<br>方法 or 属性:function getCallTransferInfo(slotId: number, type: CallTransferType, callback: AsyncCallback\<CallTransferResult>): void;<br>权限:ohos.permission.GET_TELEPHONY_STATE|@ohos.telephony.call.d.ts| +|新增(权限)|类名:call<br>方法 or 属性:function getCallTransferInfo(slotId: number, type: CallTransferType): Promise\<CallTransferResult>;<br>权限:N/A|类名:call<br>方法 or 属性:function getCallTransferInfo(slotId: number, type: CallTransferType): Promise\<CallTransferResult>;<br>权限:ohos.permission.GET_TELEPHONY_STATE|@ohos.telephony.call.d.ts| +|新增(权限)|类名:call<br>方法 or 属性:function setCallTransfer(slotId: number, info: CallTransferInfo, callback: AsyncCallback\<void>): void;<br>权限:N/A|类名:call<br>方法 or 属性:function setCallTransfer(slotId: number, info: CallTransferInfo, callback: AsyncCallback\<void>): void;<br>权限:ohos.permission.SET_TELEPHONY_STATE|@ohos.telephony.call.d.ts| +|新增(权限)|类名:call<br>方法 or 属性:function setCallTransfer(slotId: number, info: CallTransferInfo): Promise\<void>;<br>权限:N/A|类名:call<br>方法 or 属性:function setCallTransfer(slotId: number, info: CallTransferInfo): Promise\<void>;<br>权限:ohos.permission.SET_TELEPHONY_STATE|@ohos.telephony.call.d.ts| +|新增(权限)|类名:call<br>方法 or 属性:function enableImsSwitch(slotId: number, callback: AsyncCallback\<void>): void;<br>权限:N/A|类名:call<br>方法 or 属性:function enableImsSwitch(slotId: number, callback: AsyncCallback\<void>): void;<br>权限:ohos.permission.SET_TELEPHONY_STATE|@ohos.telephony.call.d.ts| +|新增(权限)|类名:call<br>方法 or 属性:function enableImsSwitch(slotId: number): Promise\<void>;<br>权限:N/A|类名:call<br>方法 or 属性:function enableImsSwitch(slotId: number): Promise\<void>;<br>权限:ohos.permission.SET_TELEPHONY_STATE|@ohos.telephony.call.d.ts| +|新增(权限)|类名:call<br>方法 or 属性:function disableImsSwitch(slotId: number, callback: AsyncCallback\<void>): void;<br>权限:N/A|类名:call<br>方法 or 属性:function disableImsSwitch(slotId: number, callback: AsyncCallback\<void>): void;<br>权限:ohos.permission.SET_TELEPHONY_STATE|@ohos.telephony.call.d.ts| +|新增(权限)|类名:call<br>方法 or 属性:function disableImsSwitch(slotId: number): Promise\<void>;<br>权限:N/A|类名:call<br>方法 or 属性:function disableImsSwitch(slotId: number): Promise\<void>;<br>权限:ohos.permission.SET_TELEPHONY_STATE|@ohos.telephony.call.d.ts| +|新增(权限)|类名:radio<br>方法 or 属性:function sendUpdateCellLocationRequest(callback: AsyncCallback\<void>): void;<br>权限:N/A|类名:radio<br>方法 or 属性:function sendUpdateCellLocationRequest(callback: AsyncCallback\<void>): void;<br>权限:ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION|@ohos.telephony.radio.d.ts| +|新增(权限)|类名:sim<br>方法 or 属性:function getLockState(slotId: number, lockType: LockType, callback: AsyncCallback\<LockState>): void;<br>权限:N/A|类名:sim<br>方法 or 属性:function getLockState(slotId: number, lockType: LockType, callback: AsyncCallback\<LockState>): void;<br>权限:ohos.permission.GET_TELEPHONY_STATE|@ohos.telephony.sim.d.ts| +|新增(权限)|类名:sim<br>方法 or 属性:function getLockState(slotId: number, lockType: LockType): Promise\<LockState>;<br>权限:N/A|类名:sim<br>方法 or 属性:function getLockState(slotId: number, lockType: LockType): Promise\<LockState>;<br>权限:ohos.permission.GET_TELEPHONY_STATE|@ohos.telephony.sim.d.ts| +|函数有变化|类名:call<br>方法 or 属性:function setAudioDevice(device: AudioDevice, callback: AsyncCallback\<void>): void;<br>|类名:call<br>方法 or 属性:function setAudioDevice(device: AudioDevice, callback: AsyncCallback\<void>): void;<br>|@ohos.telephony.call.d.ts| +|函数有变化|类名:call<br>方法 or 属性:function setAudioDevice(device: AudioDevice, callback: AsyncCallback\<void>): void;<br>|类名:call<br>方法 or 属性:function setAudioDevice(device: AudioDevice, options: AudioDeviceOptions, callback: AsyncCallback\<void>): void;<br>|@ohos.telephony.call.d.ts| +|函数有变化|类名:call<br>方法 or 属性:function setAudioDevice(device: AudioDevice): Promise\<void>;<br>|类名:call<br>方法 or 属性:function setAudioDevice(device: AudioDevice, options?: AudioDeviceOptions): Promise\<void>;<br>|@ohos.telephony.call.d.ts| +|函数有变化|类名:radio<br>方法 or 属性:function sendUpdateCellLocationRequest(callback: AsyncCallback\<void>): void;<br>|类名:radio<br>方法 or 属性:function sendUpdateCellLocationRequest(callback: AsyncCallback\<void>): void;<br>|@ohos.telephony.radio.d.ts| +|函数有变化|类名:radio<br>方法 or 属性:function sendUpdateCellLocationRequest(callback: AsyncCallback\<void>): void;<br>|类名:radio<br>方法 or 属性:function sendUpdateCellLocationRequest(slotId: number, callback: AsyncCallback\<void>): void;<br>|@ohos.telephony.radio.d.ts| +|函数有变化|类名:radio<br>方法 or 属性:function sendUpdateCellLocationRequest(): Promise\<void>;<br>|类名:radio<br>方法 or 属性:function sendUpdateCellLocationRequest(slotId?: number): Promise\<void>;<br>|@ohos.telephony.radio.d.ts| +|函数有变化|类名:sms<br>方法 or 属性:function isImsSmsSupported(callback: AsyncCallback\<boolean>): void;<br>|类名:sms<br>方法 or 属性:function isImsSmsSupported(slotId: number, callback: AsyncCallback\<boolean>): void;<br>|@ohos.telephony.sms.d.ts| +|函数有变化|类名:sms<br>方法 or 属性:function isImsSmsSupported(): Promise\<boolean>;<br>|类名:sms<br>方法 or 属性:function isImsSmsSupported(slotId: number): Promise\<boolean>;<br>|@ohos.telephony.sms.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-unitest.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-unitest.md new file mode 100644 index 0000000000000000000000000000000000000000..a0681e6ca9e1c783e6fcb6dc6d73d469f07ef243 --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-unitest.md @@ -0,0 +1,211 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.UiTest<br>类名: MatchPattern|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: MatchPattern<br>方法 or 属性: EQUALS = 0|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: MatchPattern<br>方法 or 属性: CONTAINS = 1|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: MatchPattern<br>方法 or 属性: STARTS_WITH = 2|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: MatchPattern<br>方法 or 属性: ENDS_WITH = 3|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: By|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: By<br>方法 or 属性: text(txt: string, pattern?: MatchPattern): By;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: By<br>方法 or 属性: key(key: string): By;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: By<br>方法 or 属性: id(id: number): By;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: By<br>方法 or 属性: type(tp: string): By;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: By<br>方法 or 属性: clickable(b?: boolean): By;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: By<br>方法 or 属性: scrollable(b?: boolean): By;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: By<br>方法 or 属性: enabled(b?: boolean): By;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: By<br>方法 or 属性: focused(b?: boolean): By;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: By<br>方法 or 属性: selected(b?: boolean): By;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: By<br>方法 or 属性: isBefore(by: By): By;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: By<br>方法 or 属性: isAfter(by: By): By;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiComponent|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiComponent<br>方法 or 属性: click(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiComponent<br>方法 or 属性: doubleClick(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiComponent<br>方法 or 属性: longClick(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiComponent<br>方法 or 属性: getId(): Promise\<number>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiComponent<br>方法 or 属性: getKey(): Promise\<string>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiComponent<br>方法 or 属性: getText(): Promise\<string>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiComponent<br>方法 or 属性: getType(): Promise\<string>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiComponent<br>方法 or 属性: isClickable(): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiComponent<br>方法 or 属性: isScrollable(): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiComponent<br>方法 or 属性: isEnabled(): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiComponent<br>方法 or 属性: isFocused(): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiComponent<br>方法 or 属性: isSelected(): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiComponent<br>方法 or 属性: inputText(text: string): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiComponent<br>方法 or 属性: scrollSearch(by: By): Promise\<UiComponent>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiDriver|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiDriver<br>方法 or 属性: static create(): UiDriver;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiDriver<br>方法 or 属性: delayMs(duration: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiDriver<br>方法 or 属性: findComponent(by: By): Promise\<UiComponent>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiDriver<br>方法 or 属性: findComponents(by: By): Promise\<Array\<UiComponent>>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiDriver<br>方法 or 属性: assertComponentExist(by: By): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiDriver<br>方法 or 属性: pressBack(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiDriver<br>方法 or 属性: triggerKey(keyCode: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiDriver<br>方法 or 属性: click(x: number, y: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiDriver<br>方法 or 属性: doubleClick(x: number, y: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiDriver<br>方法 or 属性: longClick(x: number, y: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiDriver<br>方法 or 属性: swipe(startx: number, starty: number, endx: number, endy: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiDriver<br>方法 or 属性: screenCap(savePath: string): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: WindowMode|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: WindowMode<br>方法 or 属性: FULLSCREEN = 0|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: WindowMode<br>方法 or 属性: PRIMARY = 1|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: WindowMode<br>方法 or 属性: SECONDARY = 2|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: WindowMode<br>方法 or 属性: FLOATING = 3|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: ResizeDirection|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: ResizeDirection<br>方法 or 属性: LEFT = 0|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: ResizeDirection<br>方法 or 属性: RIGHT = 1|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: ResizeDirection<br>方法 or 属性: UP = 2|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: ResizeDirection<br>方法 or 属性: DOWN = 3|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: ResizeDirection<br>方法 or 属性: LEFT_UP = 4|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: ResizeDirection<br>方法 or 属性: LEFT_DOWN = 5|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: ResizeDirection<br>方法 or 属性: RIGHT_UP = 6|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: ResizeDirection<br>方法 or 属性: RIGHT_DOWN = 7|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: DisplayRotation|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: DisplayRotation<br>方法 or 属性: ROTATION_0 = 0|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: DisplayRotation<br>方法 or 属性: ROTATION_90 = 1|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: DisplayRotation<br>方法 or 属性: ROTATION_180 = 2|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: DisplayRotation<br>方法 or 属性: ROTATION_270 = 3|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Point|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Point<br>方法 or 属性: readonly x: number;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Point<br>方法 or 属性: readonly y: number;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Rect|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Rect<br>方法 or 属性: readonly left: number;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Rect<br>方法 or 属性: readonly top: number;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Rect<br>方法 or 属性: readonly right: number;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Rect<br>方法 or 属性: readonly bottom: number;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: WindowFilter|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: WindowFilter<br>方法 or 属性: bundleName?: string;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: WindowFilter<br>方法 or 属性: title?: string;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: WindowFilter<br>方法 or 属性: focused?: boolean;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: WindowFilter<br>方法 or 属性: actived?: boolean;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: On|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: On<br>方法 or 属性: text(txt: string, pattern?: MatchPattern): On;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: On<br>方法 or 属性: id(id: string): On;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: On<br>方法 or 属性: type(tp: string): On;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: On<br>方法 or 属性: clickable(b?: boolean): On;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: On<br>方法 or 属性: longClickable(b?: boolean): On;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: On<br>方法 or 属性: scrollable(b?: boolean): On;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: On<br>方法 or 属性: enabled(b?: boolean): On;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: On<br>方法 or 属性: focused(b?: boolean): On;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: On<br>方法 or 属性: selected(b?: boolean): On;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: On<br>方法 or 属性: checked(b?: boolean): On;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: On<br>方法 or 属性: checkable(b?: boolean): On;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: On<br>方法 or 属性: isBefore(on: On): On;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: On<br>方法 or 属性: isAfter(on: On): On;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: click(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: doubleClick(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: longClick(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: getId(): Promise\<string>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: getText(): Promise\<string>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: getType(): Promise\<string>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: isClickable(): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: isLongClickable(): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: isScrollable(): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: isEnabled(): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: isFocused(): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: isSelected(): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: isChecked(): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: isCheckable(): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: inputText(text: string): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: clearText(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: scrollToTop(speed?: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: scrollToBottom(speed?: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: scrollSearch(on: On): Promise\<Component>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: getBounds(): Promise\<Rect>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: getBoundsCenter(): Promise\<Point>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: dragTo(target: Component): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: pinchOut(scale: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Component<br>方法 or 属性: pinchIn(scale: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: static create(): Driver;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: delayMs(duration: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: findComponent(on: On): Promise\<Component>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: findWindow(filter: WindowFilter): Promise\<UiWindow>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: waitForComponent(on: On, time: number): Promise\<Component>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: findComponents(on: On): Promise\<Array\<Component>>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: assertComponentExist(on: On): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: pressBack(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: triggerKey(keyCode: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: triggerCombineKeys(key0: number, key1: number, key2?: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: click(x: number, y: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: doubleClick(x: number, y: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: longClick(x: number, y: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: swipe(startx: number, starty: number, endx: number, endy: number, speed?: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: drag(startx: number, starty: number, endx: number, endy: number, speed?: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: screenCap(savePath: string): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: setDisplayRotation(rotation: DisplayRotation): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: getDisplayRotation(): Promise\<DisplayRotation>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: setDisplayRotationEnabled(enabled: boolean): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: getDisplaySize(): Promise\<Point>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: getDisplayDensity(): Promise\<Point>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: wakeUpDisplay(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: pressHome(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: waitForIdle(idleTime: number, timeout: number): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: fling(from: Point, to: Point, stepLen: number, speed: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: Driver<br>方法 or 属性: injectMultiPointerAction(pointers: PointerMatrix, speed?: number): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiWindow|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiWindow<br>方法 or 属性: getBundleName(): Promise\<string>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiWindow<br>方法 or 属性: getBounds(): Promise\<Rect>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiWindow<br>方法 or 属性: getTitle(): Promise\<string>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiWindow<br>方法 or 属性: getWindowMode(): Promise\<WindowMode>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiWindow<br>方法 or 属性: isFocused(): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiWindow<br>方法 or 属性: isActived(): Promise\<boolean>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiWindow<br>方法 or 属性: focus(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiWindow<br>方法 or 属性: moveTo(x: number, y: number): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiWindow<br>方法 or 属性: resize(wide: number, height: number, direction: ResizeDirection): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiWindow<br>方法 or 属性: split(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiWindow<br>方法 or 属性: maximize(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiWindow<br>方法 or 属性: minimize(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiWindow<br>方法 or 属性: resume(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: UiWindow<br>方法 or 属性: close(): Promise\<void>;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: PointerMatrix|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: PointerMatrix<br>方法 or 属性: static create(fingers: number, steps: number): PointerMatrix;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: PointerMatrix<br>方法 or 属性: setPoint(finger: number, step: number, point: Point): void;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: global<br>方法 or 属性: declare const BY: By;|@ohos.UiTest.d.ts| +|新增|NA|模块名: ohos.UiTest<br>类名: global<br>方法 or 属性: declare const ON: On;|@ohos.UiTest.d.ts| +|删除|模块名: ohos.uitest<br>类名: MatchPattern|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: MatchPattern<br>方法 or 属性:EQUALS = 0|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: MatchPattern<br>方法 or 属性:CONTAINS = 1|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: MatchPattern<br>方法 or 属性:STARTS_WITH = 2|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: MatchPattern<br>方法 or 属性:ENDS_WITH = 3|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: By|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: By<br>方法 or 属性:text(txt:string,pattern?:MatchPattern):By;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: By<br>方法 or 属性:key(key:string):By;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: By<br>方法 or 属性:id(id:number):By;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: By<br>方法 or 属性:type(tp:string):By;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: By<br>方法 or 属性:clickable(b?:bool):By;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: By<br>方法 or 属性:scrollable(b?:bool):By;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: By<br>方法 or 属性:enabled(b?:bool):By;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: By<br>方法 or 属性:focused(b?:bool):By;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: By<br>方法 or 属性:selected(b?:bool):By;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: By<br>方法 or 属性:isBefore(by:By):By;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: By<br>方法 or 属性:isAfter(by:By):By;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiComponent|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiComponent<br>方法 or 属性:click():Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiComponent<br>方法 or 属性:doubleClick():Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiComponent<br>方法 or 属性:longClick():Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiComponent<br>方法 or 属性:getId():Promise\<number>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiComponent<br>方法 or 属性:getKey():Promise\<string>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiComponent<br>方法 or 属性:getText():Promise\<string>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiComponent<br>方法 or 属性:getType():Promise\<string>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiComponent<br>方法 or 属性:isClickable():Promise\<bool>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiComponent<br>方法 or 属性:isScrollable():Promise\<bool>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiComponent<br>方法 or 属性:isEnabled():Promise\<bool>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiComponent<br>方法 or 属性:isFocused():Promise\<bool>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiComponent<br>方法 or 属性:isSelected():Promise\<bool>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiComponent<br>方法 or 属性:inputText(text: string):Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiComponent<br>方法 or 属性:scrollSearch(by:By):Promise\<UiComponent>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiDriver|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiDriver<br>方法 or 属性:static create():UiDriver;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiDriver<br>方法 or 属性:delayMs(duration:number):Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiDriver<br>方法 or 属性:findComponent(by:By):Promise\<UiComponent>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiDriver<br>方法 or 属性:findComponents(by:By):Promise\<Array\<UiComponent>>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiDriver<br>方法 or 属性:assertComponentExist(by:By):Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiDriver<br>方法 or 属性:pressBack():Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiDriver<br>方法 or 属性:triggerKey(keyCode:number):Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiDriver<br>方法 or 属性:click(x:number,y:number):Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiDriver<br>方法 or 属性:doubleClick(x:number,y:number):Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiDriver<br>方法 or 属性:longClick(x:number,y:number):Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiDriver<br>方法 or 属性:swipe(startx:number,starty:number,endx:number,endy:number):Promise\<void>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: UiDriver<br>方法 or 属性:screenCap(savePath:string):Promise\<bool>;|NA|@ohos.uitest.d.ts| +|删除|模块名: ohos.uitest<br>类名: global<br>方法 or 属性:const BY:By;|NA|@ohos.uitest.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-update.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-update.md new file mode 100644 index 0000000000000000000000000000000000000000..505689bae3886c1dfac105e2450052aa774463d8 --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-update.md @@ -0,0 +1,417 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|类名:update<br>方法or属性:function getOnlineUpdater(upgradeInfo: UpgradeInfo): Updater;|@ohos.update.d.ts| +|新增|NA|类名:update<br>方法or属性:function getRestorer(): Restorer;|@ohos.update.d.ts| +|新增|NA|类名:update<br>方法or属性:function getLocalUpdater(): LocalUpdater;|@ohos.update.d.ts| +|新增|NA|类名:Updater<br>方法or属性:getNewVersionDescription(versionDigestInfo: VersionDigestInfo, descriptionOptions: DescriptionOptions, callback: AsyncCallback\<Array\<ComponentDescription>>): void;|@ohos.update.d.ts| +|新增|NA|类名:Updater<br>方法or属性:getNewVersionDescription(versionDigestInfo: VersionDigestInfo, descriptionOptions: DescriptionOptions): Promise\<Array\<ComponentDescription>>;|@ohos.update.d.ts| +|新增|NA|类名:Updater<br>方法or属性:getCurrentVersionInfo(callback: AsyncCallback\<CurrentVersionInfo>): void;|@ohos.update.d.ts| +|新增|NA|类名:Updater<br>方法or属性:getCurrentVersionInfo(): Promise\<CurrentVersionInfo>;|@ohos.update.d.ts| +|新增|NA|类名:Updater<br>方法or属性:getCurrentVersionDescription(descriptionOptions: DescriptionOptions, callback: AsyncCallback\<Array\<ComponentDescription>>): void;|@ohos.update.d.ts| +|新增|NA|类名:Updater<br>方法or属性:getCurrentVersionDescription(descriptionOptions: DescriptionOptions): Promise\<Array\<ComponentDescription>>;|@ohos.update.d.ts| +|新增|NA|类名:Updater<br>方法or属性:getTaskInfo(callback: AsyncCallback\<TaskInfo>): void;|@ohos.update.d.ts| +|新增|NA|类名:Updater<br>方法or属性:getTaskInfo(): Promise\<TaskInfo>;|@ohos.update.d.ts| +|新增|NA|类名:Updater<br>方法or属性:download(versionDigestInfo: VersionDigestInfo, downloadOptions: DownloadOptions, callback: AsyncCallback\<void>): void;|@ohos.update.d.ts| +|新增|NA|类名:Updater<br>方法or属性:download(versionDigestInfo: VersionDigestInfo, downloadOptions: DownloadOptions): Promise\<void>;|@ohos.update.d.ts| +|新增|NA|类名:Updater<br>方法or属性:resumeDownload(versionDigestInfo: VersionDigestInfo, resumeDownloadOptions: ResumeDownloadOptions, callback: AsyncCallback\<void>): void;|@ohos.update.d.ts| +|新增|NA|类名:Updater<br>方法or属性:resumeDownload(versionDigestInfo: VersionDigestInfo, resumeDownloadOptions: ResumeDownloadOptions): Promise\<void>;|@ohos.update.d.ts| +|新增|NA|类名:Updater<br>方法or属性:pauseDownload(versionDigestInfo: VersionDigestInfo, pauseDownloadOptions: PauseDownloadOptions, callback: AsyncCallback\<void>): void;|@ohos.update.d.ts| +|新增|NA|类名:Updater<br>方法or属性:pauseDownload(versionDigestInfo: VersionDigestInfo, pauseDownloadOptions: PauseDownloadOptions): Promise\<void>;|@ohos.update.d.ts| +|新增|NA|类名:Updater<br>方法or属性:upgrade(versionDigestInfo: VersionDigestInfo, upgradeOptions: UpgradeOptions, callback: AsyncCallback\<void>): void;|@ohos.update.d.ts| +|新增|NA|类名:Updater<br>方法or属性:upgrade(versionDigestInfo: VersionDigestInfo, upgradeOptions: UpgradeOptions): Promise\<void>;|@ohos.update.d.ts| +|新增|NA|类名:Updater<br>方法or属性:clearError(versionDigestInfo: VersionDigestInfo, clearOptions: ClearOptions, callback: AsyncCallback\<void>): void;|@ohos.update.d.ts| +|新增|NA|类名:Updater<br>方法or属性:clearError(versionDigestInfo: VersionDigestInfo, clearOptions: ClearOptions): Promise\<void>;|@ohos.update.d.ts| +|新增|NA|类名:Updater<br>方法or属性:getUpgradePolicy(callback: AsyncCallback\<UpgradePolicy>): void;|@ohos.update.d.ts| +|新增|NA|类名:Updater<br>方法or属性:getUpgradePolicy(): Promise\<UpgradePolicy>;|@ohos.update.d.ts| +|新增|NA|类名:Updater<br>方法or属性:setUpgradePolicy(policy: UpgradePolicy, callback: AsyncCallback\<void>): void;|@ohos.update.d.ts| +|新增|NA|类名:Updater<br>方法or属性:setUpgradePolicy(policy: UpgradePolicy): Promise\<void>;|@ohos.update.d.ts| +|新增|NA|类名:Updater<br>方法or属性:terminateUpgrade(callback: AsyncCallback\<void>): void;|@ohos.update.d.ts| +|新增|NA|类名:Updater<br>方法or属性:terminateUpgrade(): Promise\<void>;|@ohos.update.d.ts| +|新增|NA|类名:Updater<br>方法or属性:on(eventClassifyInfo: EventClassifyInfo, taskCallback: UpgradeTaskCallback): void;|@ohos.update.d.ts| +|新增|NA|类名:Updater<br>方法or属性:off(eventClassifyInfo: EventClassifyInfo, taskCallback?: UpgradeTaskCallback): void;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: Restorer|@ohos.update.d.ts| +|新增|NA|类名:Restorer<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: Restorer<br>方法 or 属性:factoryReset(callback: AsyncCallback\<void>): void;|@ohos.update.d.ts| +|新增|NA|类名:Restorer<br>方法or属性:factoryReset(callback: AsyncCallback\<void>): void;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: Restorer<br>方法 or 属性:factoryReset(): Promise\<void>;|@ohos.update.d.ts| +|新增|NA|类名:Restorer<br>方法or属性:factoryReset(): Promise\<void>;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: LocalUpdater|@ohos.update.d.ts| +|新增|NA|类名:LocalUpdater<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: LocalUpdater<br>方法 or 属性:verifyUpgradePackage(upgradeFile: UpgradeFile, certsFile: string, callback: AsyncCallback\<void>): void;|@ohos.update.d.ts| +|新增|NA|类名:LocalUpdater<br>方法or属性:verifyUpgradePackage(upgradeFile: UpgradeFile, certsFile: string, callback: AsyncCallback\<void>): void;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: LocalUpdater<br>方法 or 属性:verifyUpgradePackage(upgradeFile: UpgradeFile, certsFile: string): Promise\<void>;|@ohos.update.d.ts| +|新增|NA|类名:LocalUpdater<br>方法or属性:verifyUpgradePackage(upgradeFile: UpgradeFile, certsFile: string): Promise\<void>;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: LocalUpdater<br>方法 or 属性:applyNewVersion(upgradeFiles: Array\<UpgradeFile>, callback: AsyncCallback\<void>): void;|@ohos.update.d.ts| +|新增|NA|类名:LocalUpdater<br>方法or属性:applyNewVersion(upgradeFiles: Array\<UpgradeFile>, callback: AsyncCallback\<void>): void;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: LocalUpdater<br>方法 or 属性:applyNewVersion(upgradeFiles: Array\<UpgradeFile>): Promise\<void>;|@ohos.update.d.ts| +|新增|NA|类名:LocalUpdater<br>方法or属性:applyNewVersion(upgradeFiles: Array\<UpgradeFile>): Promise\<void>;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: LocalUpdater<br>方法 or 属性:on(eventClassifyInfo: EventClassifyInfo, taskCallback: UpgradeTaskCallback): void;|@ohos.update.d.ts| +|新增|NA|类名:LocalUpdater<br>方法or属性:on(eventClassifyInfo: EventClassifyInfo, taskCallback: UpgradeTaskCallback): void;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: LocalUpdater<br>方法 or 属性:off(eventClassifyInfo: EventClassifyInfo, taskCallback?: UpgradeTaskCallback): void;|@ohos.update.d.ts| +|新增|NA|类名:LocalUpdater<br>方法or属性:off(eventClassifyInfo: EventClassifyInfo, taskCallback?: UpgradeTaskCallback): void;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradeInfo|@ohos.update.d.ts| +|新增|NA|类名:UpgradeInfo<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradeInfo<br>方法 or 属性:upgradeApp: string;|@ohos.update.d.ts| +|新增|NA|类名:UpgradeInfo<br>方法or属性:upgradeApp: string;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradeInfo<br>方法 or 属性:businessType: BusinessType;|@ohos.update.d.ts| +|新增|NA|类名:UpgradeInfo<br>方法or属性:businessType: BusinessType;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: BusinessType|@ohos.update.d.ts| +|新增|NA|类名:BusinessType<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: BusinessType<br>方法 or 属性:vendor: BusinessVendor;|@ohos.update.d.ts| +|新增|NA|类名:BusinessType<br>方法or属性:vendor: BusinessVendor;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: BusinessType<br>方法 or 属性:subType: BusinessSubType;|@ohos.update.d.ts| +|新增|NA|类名:BusinessType<br>方法or属性:subType: BusinessSubType;|@ohos.update.d.ts| +|新增|NA|类名:CheckResult<br>方法or属性:isExistNewVersion: boolean;|@ohos.update.d.ts| +|新增|NA|类名:CheckResult<br>方法or属性:newVersionInfo: NewVersionInfo;|@ohos.update.d.ts| +|新增|NA|类名:NewVersionInfo<br>方法or属性:versionDigestInfo: VersionDigestInfo;|@ohos.update.d.ts| +|新增|NA|类名:NewVersionInfo<br>方法or属性:versionComponents: Array\<VersionComponent>;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: VersionDigestInfo|@ohos.update.d.ts| +|新增|NA|类名:VersionDigestInfo<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: VersionDigestInfo<br>方法 or 属性:versionDigest: string;|@ohos.update.d.ts| +|新增|NA|类名:VersionDigestInfo<br>方法or属性:versionDigest: string;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: VersionComponent|@ohos.update.d.ts| +|新增|NA|类名:VersionComponent<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: VersionComponent<br>方法 or 属性:componentId: string;|@ohos.update.d.ts| +|新增|NA|类名:VersionComponent<br>方法or属性:componentId: string;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: VersionComponent<br>方法 or 属性:componentType: ComponentType;|@ohos.update.d.ts| +|新增|NA|类名:VersionComponent<br>方法or属性:componentType: ComponentType;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: VersionComponent<br>方法 or 属性:upgradeAction: UpgradeAction;|@ohos.update.d.ts| +|新增|NA|类名:VersionComponent<br>方法or属性:upgradeAction: UpgradeAction;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: VersionComponent<br>方法 or 属性:displayVersion: string;|@ohos.update.d.ts| +|新增|NA|类名:VersionComponent<br>方法or属性:displayVersion: string;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: VersionComponent<br>方法 or 属性:innerVersion: string;|@ohos.update.d.ts| +|新增|NA|类名:VersionComponent<br>方法or属性:innerVersion: string;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: VersionComponent<br>方法 or 属性:size: number;|@ohos.update.d.ts| +|新增|NA|类名:VersionComponent<br>方法or属性:size: number;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: VersionComponent<br>方法 or 属性:effectiveMode: EffectiveMode;|@ohos.update.d.ts| +|新增|NA|类名:VersionComponent<br>方法or属性:effectiveMode: EffectiveMode;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: VersionComponent<br>方法 or 属性:descriptionInfo: DescriptionInfo;|@ohos.update.d.ts| +|新增|NA|类名:VersionComponent<br>方法or属性:descriptionInfo: DescriptionInfo;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: DescriptionOptions|@ohos.update.d.ts| +|新增|NA|类名:DescriptionOptions<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: DescriptionOptions<br>方法 or 属性:format: DescriptionFormat;|@ohos.update.d.ts| +|新增|NA|类名:DescriptionOptions<br>方法or属性:format: DescriptionFormat;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: DescriptionOptions<br>方法 or 属性:language: string;|@ohos.update.d.ts| +|新增|NA|类名:DescriptionOptions<br>方法or属性:language: string;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: ComponentDescription|@ohos.update.d.ts| +|新增|NA|类名:ComponentDescription<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: ComponentDescription<br>方法 or 属性:componentId: string;|@ohos.update.d.ts| +|新增|NA|类名:ComponentDescription<br>方法or属性:componentId: string;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: ComponentDescription<br>方法 or 属性:descriptionInfo: DescriptionInfo;|@ohos.update.d.ts| +|新增|NA|类名:ComponentDescription<br>方法or属性:descriptionInfo: DescriptionInfo;|@ohos.update.d.ts| +|新增|NA|类名:DescriptionInfo<br>方法or属性:descriptionType: DescriptionType;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: CurrentVersionInfo|@ohos.update.d.ts| +|新增|NA|类名:CurrentVersionInfo<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: CurrentVersionInfo<br>方法 or 属性:osVersion: string;|@ohos.update.d.ts| +|新增|NA|类名:CurrentVersionInfo<br>方法or属性:osVersion: string;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: CurrentVersionInfo<br>方法 or 属性:deviceName: string;|@ohos.update.d.ts| +|新增|NA|类名:CurrentVersionInfo<br>方法or属性:deviceName: string;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: CurrentVersionInfo<br>方法 or 属性:versionComponents: Array\<VersionComponent>;|@ohos.update.d.ts| +|新增|NA|类名:CurrentVersionInfo<br>方法or属性:versionComponents: Array\<VersionComponent>;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: DownloadOptions|@ohos.update.d.ts| +|新增|NA|类名:DownloadOptions<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: DownloadOptions<br>方法 or 属性:allowNetwork: NetType;|@ohos.update.d.ts| +|新增|NA|类名:DownloadOptions<br>方法or属性:allowNetwork: NetType;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: DownloadOptions<br>方法 or 属性:order: Order;|@ohos.update.d.ts| +|新增|NA|类名:DownloadOptions<br>方法or属性:order: Order;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: ResumeDownloadOptions|@ohos.update.d.ts| +|新增|NA|类名:ResumeDownloadOptions<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: ResumeDownloadOptions<br>方法 or 属性:allowNetwork: NetType;|@ohos.update.d.ts| +|新增|NA|类名:ResumeDownloadOptions<br>方法or属性:allowNetwork: NetType;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: PauseDownloadOptions|@ohos.update.d.ts| +|新增|NA|类名:PauseDownloadOptions<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: PauseDownloadOptions<br>方法 or 属性:isAllowAutoResume: boolean;|@ohos.update.d.ts| +|新增|NA|类名:PauseDownloadOptions<br>方法or属性:isAllowAutoResume: boolean;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradeOptions|@ohos.update.d.ts| +|新增|NA|类名:UpgradeOptions<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradeOptions<br>方法 or 属性:order: Order;|@ohos.update.d.ts| +|新增|NA|类名:UpgradeOptions<br>方法or属性:order: Order;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: ClearOptions|@ohos.update.d.ts| +|新增|NA|类名:ClearOptions<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: ClearOptions<br>方法 or 属性:status: UpgradeStatus;|@ohos.update.d.ts| +|新增|NA|类名:ClearOptions<br>方法or属性:status: UpgradeStatus;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradePolicy|@ohos.update.d.ts| +|新增|NA|类名:UpgradePolicy<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradePolicy<br>方法 or 属性:downloadStrategy: boolean;|@ohos.update.d.ts| +|新增|NA|类名:UpgradePolicy<br>方法or属性:downloadStrategy: boolean;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradePolicy<br>方法 or 属性:autoUpgradeStrategy: boolean;|@ohos.update.d.ts| +|新增|NA|类名:UpgradePolicy<br>方法or属性:autoUpgradeStrategy: boolean;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradePolicy<br>方法 or 属性:autoUpgradePeriods: Array\<UpgradePeriod>;|@ohos.update.d.ts| +|新增|NA|类名:UpgradePolicy<br>方法or属性:autoUpgradePeriods: Array\<UpgradePeriod>;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradePeriod|@ohos.update.d.ts| +|新增|NA|类名:UpgradePeriod<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradePeriod<br>方法 or 属性:start: number;|@ohos.update.d.ts| +|新增|NA|类名:UpgradePeriod<br>方法or属性:start: number;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradePeriod<br>方法 or 属性:end: number;|@ohos.update.d.ts| +|新增|NA|类名:UpgradePeriod<br>方法or属性:end: number;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: TaskInfo|@ohos.update.d.ts| +|新增|NA|类名:TaskInfo<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: TaskInfo<br>方法 or 属性:existTask: boolean;|@ohos.update.d.ts| +|新增|NA|类名:TaskInfo<br>方法or属性:existTask: boolean;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: TaskInfo<br>方法 or 属性:taskBody: TaskBody;|@ohos.update.d.ts| +|新增|NA|类名:TaskInfo<br>方法or属性:taskBody: TaskBody;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: EventInfo|@ohos.update.d.ts| +|新增|NA|类名:EventInfo<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: EventInfo<br>方法 or 属性:eventId: EventId;|@ohos.update.d.ts| +|新增|NA|类名:EventInfo<br>方法or属性:eventId: EventId;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: EventInfo<br>方法 or 属性:taskBody: TaskBody;|@ohos.update.d.ts| +|新增|NA|类名:EventInfo<br>方法or属性:taskBody: TaskBody;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: TaskBody|@ohos.update.d.ts| +|新增|NA|类名:TaskBody<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: TaskBody<br>方法 or 属性:versionDigestInfo: VersionDigestInfo;|@ohos.update.d.ts| +|新增|NA|类名:TaskBody<br>方法or属性:versionDigestInfo: VersionDigestInfo;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: TaskBody<br>方法 or 属性:status: UpgradeStatus;|@ohos.update.d.ts| +|新增|NA|类名:TaskBody<br>方法or属性:status: UpgradeStatus;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: TaskBody<br>方法 or 属性:subStatus: number;|@ohos.update.d.ts| +|新增|NA|类名:TaskBody<br>方法or属性:subStatus: number;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: TaskBody<br>方法 or 属性:progress: number;|@ohos.update.d.ts| +|新增|NA|类名:TaskBody<br>方法or属性:progress: number;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: TaskBody<br>方法 or 属性:installMode: number;|@ohos.update.d.ts| +|新增|NA|类名:TaskBody<br>方法or属性:installMode: number;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: TaskBody<br>方法 or 属性:errorMessages: Array\<ErrorMessage>;|@ohos.update.d.ts| +|新增|NA|类名:TaskBody<br>方法or属性:errorMessages: Array\<ErrorMessage>;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: TaskBody<br>方法 or 属性:versionComponents: Array\<VersionComponent>;|@ohos.update.d.ts| +|新增|NA|类名:TaskBody<br>方法or属性:versionComponents: Array\<VersionComponent>;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: ErrorMessage|@ohos.update.d.ts| +|新增|NA|类名:ErrorMessage<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: ErrorMessage<br>方法 or 属性:errorCode: number;|@ohos.update.d.ts| +|新增|NA|类名:ErrorMessage<br>方法or属性:errorCode: number;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: ErrorMessage<br>方法 or 属性:errorMessage: string;|@ohos.update.d.ts| +|新增|NA|类名:ErrorMessage<br>方法or属性:errorMessage: string;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: EventClassifyInfo|@ohos.update.d.ts| +|新增|NA|类名:EventClassifyInfo<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: EventClassifyInfo<br>方法 or 属性:eventClassify: EventClassify;|@ohos.update.d.ts| +|新增|NA|类名:EventClassifyInfo<br>方法or属性:eventClassify: EventClassify;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: EventClassifyInfo<br>方法 or 属性:extraInfo: string;|@ohos.update.d.ts| +|新增|NA|类名:EventClassifyInfo<br>方法or属性:extraInfo: string;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradeFile|@ohos.update.d.ts| +|新增|NA|类名:UpgradeFile<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradeFile<br>方法 or 属性:fileType: ComponentType;|@ohos.update.d.ts| +|新增|NA|类名:UpgradeFile<br>方法or属性:fileType: ComponentType;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradeFile<br>方法 or 属性:filePath: string;|@ohos.update.d.ts| +|新增|NA|类名:UpgradeFile<br>方法or属性:filePath: string;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradeTaskCallback|@ohos.update.d.ts| +|新增|NA|类名:UpgradeTaskCallback<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradeTaskCallback<br>方法 or 属性:(eventInfo: EventInfo): void;|@ohos.update.d.ts| +|新增|NA|类名:UpgradeTaskCallback<br>方法or属性:(eventInfo: EventInfo): void;|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: BusinessVendor|@ohos.update.d.ts| +|新增|NA|类名:BusinessVendor<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: BusinessVendor<br>方法 or 属性:PUBLIC = "public"|@ohos.update.d.ts| +|新增|NA|类名:BusinessVendor<br>方法or属性:PUBLIC = "public"|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: BusinessSubType|@ohos.update.d.ts| +|新增|NA|类名:BusinessSubType<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: BusinessSubType<br>方法 or 属性:FIRMWARE = 1|@ohos.update.d.ts| +|新增|NA|类名:BusinessSubType<br>方法or属性:FIRMWARE = 1|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: ComponentType|@ohos.update.d.ts| +|新增|NA|类名:ComponentType<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: ComponentType<br>方法 or 属性:OTA = 1|@ohos.update.d.ts| +|新增|NA|类名:ComponentType<br>方法or属性:OTA = 1|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradeAction|@ohos.update.d.ts| +|新增|NA|类名:UpgradeAction<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradeAction<br>方法 or 属性:UPGRADE = "upgrade"|@ohos.update.d.ts| +|新增|NA|类名:UpgradeAction<br>方法or属性:UPGRADE = "upgrade"|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradeAction<br>方法 or 属性:RECOVERY = "recovery"|@ohos.update.d.ts| +|新增|NA|类名:UpgradeAction<br>方法or属性:RECOVERY = "recovery"|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: EffectiveMode|@ohos.update.d.ts| +|新增|NA|类名:EffectiveMode<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: EffectiveMode<br>方法 or 属性:COLD = 1|@ohos.update.d.ts| +|新增|NA|类名:EffectiveMode<br>方法or属性:COLD = 1|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: EffectiveMode<br>方法 or 属性:LIVE = 2|@ohos.update.d.ts| +|新增|NA|类名:EffectiveMode<br>方法or属性:LIVE = 2|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: EffectiveMode<br>方法 or 属性:LIVE_AND_COLD = 3|@ohos.update.d.ts| +|新增|NA|类名:EffectiveMode<br>方法or属性:LIVE_AND_COLD = 3|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: DescriptionType|@ohos.update.d.ts| +|新增|NA|类名:DescriptionType<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: DescriptionType<br>方法 or 属性:CONTENT = 0|@ohos.update.d.ts| +|新增|NA|类名:DescriptionType<br>方法or属性:CONTENT = 0|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: DescriptionType<br>方法 or 属性:URI = 1|@ohos.update.d.ts| +|新增|NA|类名:DescriptionType<br>方法or属性:URI = 1|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: DescriptionFormat|@ohos.update.d.ts| +|新增|NA|类名:DescriptionFormat<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: DescriptionFormat<br>方法 or 属性:STANDARD = 0|@ohos.update.d.ts| +|新增|NA|类名:DescriptionFormat<br>方法or属性:STANDARD = 0|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: DescriptionFormat<br>方法 or 属性:SIMPLIFIED = 1|@ohos.update.d.ts| +|新增|NA|类名:DescriptionFormat<br>方法or属性:SIMPLIFIED = 1|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: NetType|@ohos.update.d.ts| +|新增|NA|类名:NetType<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: NetType<br>方法 or 属性:CELLULAR = 1|@ohos.update.d.ts| +|新增|NA|类名:NetType<br>方法or属性:CELLULAR = 1|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: NetType<br>方法 or 属性:METERED_WIFI = 2|@ohos.update.d.ts| +|新增|NA|类名:NetType<br>方法or属性:METERED_WIFI = 2|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: NetType<br>方法 or 属性:NOT_METERED_WIFI = 4|@ohos.update.d.ts| +|新增|NA|类名:NetType<br>方法or属性:NOT_METERED_WIFI = 4|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: NetType<br>方法 or 属性:WIFI = 6|@ohos.update.d.ts| +|新增|NA|类名:NetType<br>方法or属性:WIFI = 6|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: NetType<br>方法 or 属性:CELLULAR_AND_WIFI = 7|@ohos.update.d.ts| +|新增|NA|类名:NetType<br>方法or属性:CELLULAR_AND_WIFI = 7|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: Order|@ohos.update.d.ts| +|新增|NA|类名:Order<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: Order<br>方法 or 属性:DOWNLOAD = 1|@ohos.update.d.ts| +|新增|NA|类名:Order<br>方法or属性:DOWNLOAD = 1|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: Order<br>方法 or 属性:INSTALL = 2|@ohos.update.d.ts| +|新增|NA|类名:Order<br>方法or属性:INSTALL = 2|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: Order<br>方法 or 属性:DOWNLOAD_AND_INSTALL = 3|@ohos.update.d.ts| +|新增|NA|类名:Order<br>方法or属性:DOWNLOAD_AND_INSTALL = 3|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: Order<br>方法 or 属性:APPLY = 4|@ohos.update.d.ts| +|新增|NA|类名:Order<br>方法or属性:APPLY = 4|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: Order<br>方法 or 属性:INSTALL_AND_APPLY = 6|@ohos.update.d.ts| +|新增|NA|类名:Order<br>方法or属性:INSTALL_AND_APPLY = 6|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradeStatus|@ohos.update.d.ts| +|新增|NA|类名:UpgradeStatus<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradeStatus<br>方法 or 属性:WAITING_DOWNLOAD = 20|@ohos.update.d.ts| +|新增|NA|类名:UpgradeStatus<br>方法or属性:WAITING_DOWNLOAD = 20|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradeStatus<br>方法 or 属性:DOWNLOADING = 21|@ohos.update.d.ts| +|新增|NA|类名:UpgradeStatus<br>方法or属性:DOWNLOADING = 21|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradeStatus<br>方法 or 属性:DOWNLOAD_PAUSED = 22|@ohos.update.d.ts| +|新增|NA|类名:UpgradeStatus<br>方法or属性:DOWNLOAD_PAUSED = 22|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradeStatus<br>方法 or 属性:DOWNLOAD_FAIL = 23|@ohos.update.d.ts| +|新增|NA|类名:UpgradeStatus<br>方法or属性:DOWNLOAD_FAIL = 23|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradeStatus<br>方法 or 属性:WAITING_INSTALL = 30|@ohos.update.d.ts| +|新增|NA|类名:UpgradeStatus<br>方法or属性:WAITING_INSTALL = 30|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradeStatus<br>方法 or 属性:UPDATING = 31|@ohos.update.d.ts| +|新增|NA|类名:UpgradeStatus<br>方法or属性:UPDATING = 31|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradeStatus<br>方法 or 属性:WAITING_APPLY = 40|@ohos.update.d.ts| +|新增|NA|类名:UpgradeStatus<br>方法or属性:WAITING_APPLY = 40|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradeStatus<br>方法 or 属性:APPLYING = 41|@ohos.update.d.ts| +|新增|NA|类名:UpgradeStatus<br>方法or属性:APPLYING = 41|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradeStatus<br>方法 or 属性:UPGRADE_SUCCESS = 50|@ohos.update.d.ts| +|新增|NA|类名:UpgradeStatus<br>方法or属性:UPGRADE_SUCCESS = 50|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: UpgradeStatus<br>方法 or 属性:UPGRADE_FAIL = 51|@ohos.update.d.ts| +|新增|NA|类名:UpgradeStatus<br>方法or属性:UPGRADE_FAIL = 51|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: EventClassify|@ohos.update.d.ts| +|新增|NA|类名:EventClassify<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: EventClassify<br>方法 or 属性:TASK = 0x01000000|@ohos.update.d.ts| +|新增|NA|类名:EventClassify<br>方法or属性:TASK = 0x01000000|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: EventId|@ohos.update.d.ts| +|新增|NA|类名:EventId<br>方法or属性:|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: EventId<br>方法 or 属性:EVENT_TASK_BASE = EventClassify.TASK|@ohos.update.d.ts| +|新增|NA|类名:EventId<br>方法or属性:EVENT_TASK_BASE = EventClassify.TASK|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: EventId<br>方法 or 属性:EVENT_TASK_RECEIVE|@ohos.update.d.ts| +|新增|NA|类名:EventId<br>方法or属性:EVENT_TASK_RECEIVE|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: EventId<br>方法 or 属性:EVENT_TASK_CANCEL|@ohos.update.d.ts| +|新增|NA|类名:EventId<br>方法or属性:EVENT_TASK_CANCEL|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: EventId<br>方法 or 属性:EVENT_DOWNLOAD_WAIT|@ohos.update.d.ts| +|新增|NA|类名:EventId<br>方法or属性:EVENT_DOWNLOAD_WAIT|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: EventId<br>方法 or 属性:EVENT_DOWNLOAD_START|@ohos.update.d.ts| +|新增|NA|类名:EventId<br>方法or属性:EVENT_DOWNLOAD_START|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: EventId<br>方法 or 属性:EVENT_DOWNLOAD_UPDATE|@ohos.update.d.ts| +|新增|NA|类名:EventId<br>方法or属性:EVENT_DOWNLOAD_UPDATE|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: EventId<br>方法 or 属性:EVENT_DOWNLOAD_PAUSE|@ohos.update.d.ts| +|新增|NA|类名:EventId<br>方法or属性:EVENT_DOWNLOAD_PAUSE|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: EventId<br>方法 or 属性:EVENT_DOWNLOAD_RESUME|@ohos.update.d.ts| +|新增|NA|类名:EventId<br>方法or属性:EVENT_DOWNLOAD_RESUME|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: EventId<br>方法 or 属性:EVENT_DOWNLOAD_SUCCESS|@ohos.update.d.ts| +|新增|NA|类名:EventId<br>方法or属性:EVENT_DOWNLOAD_SUCCESS|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: EventId<br>方法 or 属性:EVENT_DOWNLOAD_FAIL|@ohos.update.d.ts| +|新增|NA|类名:EventId<br>方法or属性:EVENT_DOWNLOAD_FAIL|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: EventId<br>方法 or 属性:EVENT_UPGRADE_WAIT|@ohos.update.d.ts| +|新增|NA|类名:EventId<br>方法or属性:EVENT_UPGRADE_WAIT|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: EventId<br>方法 or 属性:EVENT_UPGRADE_START|@ohos.update.d.ts| +|新增|NA|类名:EventId<br>方法or属性:EVENT_UPGRADE_START|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: EventId<br>方法 or 属性:EVENT_UPGRADE_UPDATE|@ohos.update.d.ts| +|新增|NA|类名:EventId<br>方法or属性:EVENT_UPGRADE_UPDATE|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: EventId<br>方法 or 属性:EVENT_APPLY_WAIT|@ohos.update.d.ts| +|新增|NA|类名:EventId<br>方法or属性:EVENT_APPLY_WAIT|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: EventId<br>方法 or 属性:EVENT_APPLY_START|@ohos.update.d.ts| +|新增|NA|类名:EventId<br>方法or属性:EVENT_APPLY_START|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: EventId<br>方法 or 属性:EVENT_UPGRADE_SUCCESS|@ohos.update.d.ts| +|新增|NA|类名:EventId<br>方法or属性:EVENT_UPGRADE_SUCCESS|@ohos.update.d.ts| +|新增|NA|模块名: ohos.update<br>类名: EventId<br>方法 or 属性:EVENT_UPGRADE_FAIL|@ohos.update.d.ts| +|新增|NA|类名:EventId<br>方法or属性:EVENT_UPGRADE_FAIL|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: UpdateTypes<br>方法 or 属性:type UpdateTypes =<br> 'OTA' \|<br> 'patch';|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: UpdateTypes<br>方法 or 属性:type UpdateTypes =<br> 'OTA' \|<br> 'patch';|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: PackageTypes|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: PackageTypes<br>方法 or 属性:PACKAGE_TYPE_NORMAL = 1|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: PackageTypes<br>方法 or 属性:PACKAGE_TYPE_BASE = 2|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: PackageTypes<br>方法 or 属性:PACKAGE_TYPE_CUST = 3|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: PackageTypes<br>方法 or 属性:PACKAGE_TYPE_PRELOAD = 4|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: PackageTypes<br>方法 or 属性:PACKAGE_TYPE_COTA = 5|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: PackageTypes<br>方法 or 属性:PACKAGE_TYPE_VERSION = 6|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: PackageTypes<br>方法 or 属性:PACKAGE_TYPE_PATCH = 7|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:CheckResult<br>方法 or 属性:versionName: number;|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:CheckResult<br>方法 or 属性:versionCode: string;|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:CheckResult<br>方法 or 属性:size: number;|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:CheckResult<br>方法 or 属性:verifyInfo: string;|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:CheckResult<br>方法 or 属性:packageType: PackageTypes;|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:CheckResult<br>方法 or 属性:descriptionId: string;|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:DescriptionInfo<br>方法 or 属性:descriptionId: string;|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: NewVersionStatus|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: NewVersionStatus<br>方法 or 属性:VERSION_STATUS_ERR = -1|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: NewVersionStatus<br>方法 or 属性:VERSION_STATUS_NEW = 0|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: NewVersionStatus<br>方法 or 属性:VERSION_STATUS_NONE = 1|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: NewVersionStatus<br>方法 or 属性:VERSION_STATUS_BUSY = 2|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:NewVersionInfo<br>方法 or 属性:status: NewVersionStatus;|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:NewVersionInfo<br>方法 or 属性:errMsg: string;|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:NewVersionInfo<br>方法 or 属性:checkResults: Array\<CheckResult>;|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:NewVersionInfo<br>方法 or 属性:descriptionInfo: Array\<DescriptionInfo>;|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: UpdateState|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: UpdateState<br>方法 or 属性:UPDATE_STATE_INIT = 0|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: UpdateState<br>方法 or 属性:UPDATE_STATE_CHECK_VERSION_ON = 10|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: UpdateState<br>方法 or 属性:UPDATE_STATE_CHECK_VERSION_FAIL|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: UpdateState<br>方法 or 属性:UPDATE_STATE_CHECK_VERSION_SUCCESS|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: UpdateState<br>方法 or 属性:UPDATE_STATE_DOWNLOAD_ON = 20|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: UpdateState<br>方法 or 属性:UPDATE_STATE_DOWNLOAD_PAUSE|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: UpdateState<br>方法 or 属性:UPDATE_STATE_DOWNLOAD_CANCEL|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: UpdateState<br>方法 or 属性:UPDATE_STATE_DOWNLOAD_FAIL|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: UpdateState<br>方法 or 属性:UPDATE_STATE_DOWNLOAD_SUCCESS|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: UpdateState<br>方法 or 属性:UPDATE_STATE_VERIFY_ON = 30|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: UpdateState<br>方法 or 属性:UPDATE_STATE_VERIFY_FAIL|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: UpdateState<br>方法 or 属性:UPDATE_STATE_VERIFY_SUCCESS|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: UpdateState<br>方法 or 属性:UPDATE_STATE_PACKAGE_TRANS_ON = 70|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: UpdateState<br>方法 or 属性:UPDATE_STATE_PACKAGE_TRANS_FAIL|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: UpdateState<br>方法 or 属性:UPDATE_STATE_PACKAGE_TRANS_SUCCESS|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: UpdateState<br>方法 or 属性:UPDATE_STATE_INSTALL_ON = 80|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: UpdateState<br>方法 or 属性:UPDATE_STATE_INSTALL_FAIL|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: UpdateState<br>方法 or 属性:UPDATE_STATE_INSTALL_SUCCESS|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: UpdateState<br>方法 or 属性:UPDATE_STATE_UPDATE_ON = 90|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: UpdateState<br>方法 or 属性:UPDATE_STATE_UPDATE_FAIL|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: UpdateState<br>方法 or 属性:UPDATE_STATE_UPDATE_SUCCESS|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: Progress|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: Progress<br>方法 or 属性:percent: number;|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: Progress<br>方法 or 属性:status: UpdateState;|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: Progress<br>方法 or 属性:endReason: string;|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: InstallMode|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: InstallMode<br>方法 or 属性:INSTALL_MODE_NORMAL|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: InstallMode<br>方法 or 属性:INSTALL_MODE_NIGHT|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: InstallMode<br>方法 or 属性:INSTALL_MODE_AUTO|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: UpdatePolicy|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: UpdatePolicy<br>方法 or 属性:autoDownload: boolean;|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: UpdatePolicy<br>方法 or 属性:installMode: INSTALL_MODE;|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: UpdatePolicy<br>方法 or 属性:autoUpgradeInterval: Array\<number>;|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: UpdateProgressCallback|NA|@ohos.update.d.ts| +|删除|模块名: ohos.update<br>类名: UpdateProgressCallback<br>方法 or 属性:(progress: Progress): void;|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:Updater<br>方法 or 属性:getUpdatePolicy(callback: AsyncCallback\<UpdatePolicy>): void;|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:Updater<br>方法 or 属性:getUpdatePolicy(): Promise\<UpdatePolicy>;|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:Updater<br>方法 or 属性:setUpdatePolicy(policy: UpdatePolicy, callback: AsyncCallback\<number>): void;|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:Updater<br>方法 or 属性:setUpdatePolicy(policy: UpdatePolicy): Promise\<number>;|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:Updater<br>方法 or 属性:applyNewVersion(callback: AsyncCallback\<number>): void;|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:Updater<br>方法 or 属性:applyNewVersion(): Promise\<number>;|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:Updater<br>方法 or 属性:rebootAndCleanCache(callback: AsyncCallback\<number>): void;|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:Updater<br>方法 or 属性:rebootAndCleanCache(): Promise\<number>;|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:Updater<br>方法 or 属性:rebootAndCleanUserData(callback: AsyncCallback\<number>): void;|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:Updater<br>方法 or 属性:rebootAndCleanUserData(): Promise\<number>;|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:Updater<br>方法 or 属性:verifyUpdatePackage(upgradeFile: string, certsFile: string): void;|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:Updater<br>方法 or 属性:on(eventType: 'downloadProgress', callback: UpdateProgressCallback): void;|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:Updater<br>方法 or 属性:on(eventType: 'upgradeProgress', callback: UpdateProgressCallback): void;|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:Updater<br>方法 or 属性:on(eventType: 'verifyProgress', callback: UpdateProgressCallback): void;|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:Updater<br>方法 or 属性:off(eventType: 'downloadProgress', callback?: UpdateProgressCallback): void;|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:Updater<br>方法 or 属性:off(eventType: 'upgradeProgress', callback?: UpdateProgressCallback): void;|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:Updater<br>方法 or 属性:off(eventType: 'verifyProgress', callback?: UpdateProgressCallback): void;|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:Updater<br>方法 or 属性:cancel(): void;|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:update<br>方法 or 属性:function getUpdater(upgradeFile: string, updateType?: UpdateTypes): Updater;|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:update<br>方法 or 属性:function getUpdaterForOther(upgradeFile: string, device: string, updateType?: UpdateTypes): Updater;|NA|@ohos.update.d.ts| +|删除|模块名:ohos.update<br>类名:update<br>方法 or 属性:function getUpdaterFromOther(upgradeFile: string, device: string, updateType?: UpdateTypes): Updater;|NA|@ohos.update.d.ts| +|起始版本有变化|类名:update<br>起始版本:6|类名:update<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:Updater<br>起始版本:6|类名:Updater<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:Updater<br>方法 or 属性:getNewVersionInfo(callback: AsyncCallback\<NewVersionInfo>): void;<br>起始版本:6|类名:Updater<br>方法 or 属性:getNewVersionInfo(callback: AsyncCallback\<NewVersionInfo>): void;<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:Updater<br>方法 or 属性:getNewVersionInfo(): Promise\<NewVersionInfo>;<br>起始版本:6|类名:Updater<br>方法 or 属性:getNewVersionInfo(): Promise\<NewVersionInfo>;<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:CheckResult<br>起始版本:6|类名:CheckResult<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:NewVersionInfo<br>起始版本:6|类名:NewVersionInfo<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:DescriptionInfo<br>起始版本:6|类名:DescriptionInfo<br>起始版本:9|@ohos.update.d.ts| +|起始版本有变化|类名:DescriptionInfo<br>方法 or 属性:content: string;<br>起始版本:6|类名:DescriptionInfo<br>方法 or 属性:content: string;<br>起始版本:9|@ohos.update.d.ts| +|新增(错误码)|NA|类名:Updater<br>方法 or 属性:getNewVersionInfo(callback: AsyncCallback\<NewVersionInfo>): void;<br>错误码内容: 201, 11500104|@ohos.update.d.ts| +|新增(错误码)|NA|类名:Updater<br>方法 or 属性:getNewVersionInfo(): Promise\<NewVersionInfo>;<br>错误码内容: 201, 11500104|@ohos.update.d.ts| +|新增(权限)|类名:Updater<br>方法 or 属性:getNewVersionInfo(callback: AsyncCallback\<NewVersionInfo>): void;<br>权限:N/A|类名:Updater<br>方法 or 属性:getNewVersionInfo(callback: AsyncCallback\<NewVersionInfo>): void;<br>权限:ohos.permission.UPDATE_SYSTEM|@ohos.update.d.ts| +|新增(权限)|类名:Updater<br>方法 or 属性:getNewVersionInfo(): Promise\<NewVersionInfo>;<br>权限:N/A|类名:Updater<br>方法 or 属性:getNewVersionInfo(): Promise\<NewVersionInfo>;<br>权限:ohos.permission.UPDATE_SYSTEM|@ohos.update.d.ts| +|函数有变化|类名:Updater<br>方法 or 属性:checkNewVersion(callback: AsyncCallback\<NewVersionInfo>): void;<br>|类名:Updater<br>方法 or 属性:checkNewVersion(callback: AsyncCallback\<CheckResult>): void;<br>|@ohos.update.d.ts| +|函数有变化|类名:Updater<br>方法 or 属性:checkNewVersion(): Promise\<NewVersionInfo>;<br>|类名:Updater<br>方法 or 属性:checkNewVersion(): Promise\<CheckResult>;<br>|@ohos.update.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-usb.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-usb.md new file mode 100644 index 0000000000000000000000000000000000000000..ede50e45521ee4e1cccd9c9f7d32506ab5d6f2a0 --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-usb.md @@ -0,0 +1,199 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|类名:usb<br>方法or属性:function usbFunctionsFromString(funcs: string): number;|@ohos.usb.d.ts| +|新增|NA|类名:usb<br>方法or属性:function usbFunctionsToString(funcs: FunctionType): string;|@ohos.usb.d.ts| +|新增|NA|类名:usb<br>方法or属性:function setCurrentFunctions(funcs: FunctionType): Promise\<boolean>;|@ohos.usb.d.ts| +|新增|NA|类名:usb<br>方法or属性:function getCurrentFunctions(): FunctionType;|@ohos.usb.d.ts| +|新增|NA|类名:usb<br>方法or属性:function getPorts(): Array\<USBPort>;|@ohos.usb.d.ts| +|新增|NA|类名:usb<br>方法or属性:function getSupportedModes(portId: number): PortModeType;|@ohos.usb.d.ts| +|新增|NA|类名:usb<br>方法or属性:function setPortRoles(portId: number, powerRole: PowerRoleType, dataRole: DataRoleType): Promise\<boolean>;|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: PowerRoleType|@ohos.usb.d.ts| +|新增|NA|类名:PowerRoleType<br>方法or属性:|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: PowerRoleType<br>方法 or 属性:NONE = 0|@ohos.usb.d.ts| +|新增|NA|类名:PowerRoleType<br>方法or属性:NONE = 0|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: PowerRoleType<br>方法 or 属性:SOURCE = 1|@ohos.usb.d.ts| +|新增|NA|类名:PowerRoleType<br>方法or属性:SOURCE = 1|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: PowerRoleType<br>方法 or 属性:SINK = 2|@ohos.usb.d.ts| +|新增|NA|类名:PowerRoleType<br>方法or属性:SINK = 2|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: DataRoleType|@ohos.usb.d.ts| +|新增|NA|类名:DataRoleType<br>方法or属性:|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: DataRoleType<br>方法 or 属性:NONE = 0|@ohos.usb.d.ts| +|新增|NA|类名:DataRoleType<br>方法or属性:NONE = 0|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: DataRoleType<br>方法 or 属性:HOST = 1|@ohos.usb.d.ts| +|新增|NA|类名:DataRoleType<br>方法or属性:HOST = 1|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: DataRoleType<br>方法 or 属性:DEVICE = 2|@ohos.usb.d.ts| +|新增|NA|类名:DataRoleType<br>方法or属性:DEVICE = 2|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: PortModeType|@ohos.usb.d.ts| +|新增|NA|类名:PortModeType<br>方法or属性:|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: PortModeType<br>方法 or 属性:NONE = 0|@ohos.usb.d.ts| +|新增|NA|类名:PortModeType<br>方法or属性:NONE = 0|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: PortModeType<br>方法 or 属性:UFP = 1|@ohos.usb.d.ts| +|新增|NA|类名:PortModeType<br>方法or属性:UFP = 1|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: PortModeType<br>方法 or 属性:DFP = 2|@ohos.usb.d.ts| +|新增|NA|类名:PortModeType<br>方法or属性:DFP = 2|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: PortModeType<br>方法 or 属性:DRP = 3|@ohos.usb.d.ts| +|新增|NA|类名:PortModeType<br>方法or属性:DRP = 3|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: PortModeType<br>方法 or 属性:NUM_MODES = 4|@ohos.usb.d.ts| +|新增|NA|类名:PortModeType<br>方法or属性:NUM_MODES = 4|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: USBPortStatus|@ohos.usb.d.ts| +|新增|NA|类名:USBPortStatus<br>方法or属性:|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: USBPortStatus<br>方法 or 属性:currentMode: number;|@ohos.usb.d.ts| +|新增|NA|类名:USBPortStatus<br>方法or属性:currentMode: number;|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: USBPortStatus<br>方法 or 属性:currentPowerRole: number;|@ohos.usb.d.ts| +|新增|NA|类名:USBPortStatus<br>方法or属性:currentPowerRole: number;|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: USBPortStatus<br>方法 or 属性:currentDataRole: number;|@ohos.usb.d.ts| +|新增|NA|类名:USBPortStatus<br>方法or属性:currentDataRole: number;|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: USBPort|@ohos.usb.d.ts| +|新增|NA|类名:USBPort<br>方法or属性:|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: USBPort<br>方法 or 属性:id: number;|@ohos.usb.d.ts| +|新增|NA|类名:USBPort<br>方法or属性:id: number;|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: USBPort<br>方法 or 属性:supportedModes: PortModeType;|@ohos.usb.d.ts| +|新增|NA|类名:USBPort<br>方法or属性:supportedModes: PortModeType;|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: USBPort<br>方法 or 属性:status: USBPortStatus;|@ohos.usb.d.ts| +|新增|NA|类名:USBPort<br>方法or属性:status: USBPortStatus;|@ohos.usb.d.ts| +|新增|NA|类名:USBRequestTargetType<br>方法or属性:USB_REQUEST_TARGET_INTERFACE = 1|@ohos.usb.d.ts| +|新增|NA|类名:USBRequestTargetType<br>方法or属性:USB_REQUEST_TARGET_ENDPOINT = 2|@ohos.usb.d.ts| +|新增|NA|类名:USBRequestTargetType<br>方法or属性:USB_REQUEST_TARGET_OTHER = 3|@ohos.usb.d.ts| +|新增|NA|类名:USBControlRequestType<br>方法or属性:USB_REQUEST_TYPE_CLASS = 1|@ohos.usb.d.ts| +|新增|NA|类名:USBControlRequestType<br>方法or属性:USB_REQUEST_TYPE_VENDOR = 2|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: FunctionType|@ohos.usb.d.ts| +|新增|NA|类名:FunctionType<br>方法or属性:|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: FunctionType<br>方法 or 属性:NONE = 0|@ohos.usb.d.ts| +|新增|NA|类名:FunctionType<br>方法or属性:NONE = 0|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: FunctionType<br>方法 or 属性:ACM = 1|@ohos.usb.d.ts| +|新增|NA|类名:FunctionType<br>方法or属性:ACM = 1|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: FunctionType<br>方法 or 属性:ECM = 2|@ohos.usb.d.ts| +|新增|NA|类名:FunctionType<br>方法or属性:ECM = 2|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: FunctionType<br>方法 or 属性:HDC = 4|@ohos.usb.d.ts| +|新增|NA|类名:FunctionType<br>方法or属性:HDC = 4|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: FunctionType<br>方法 or 属性:MTP = 8|@ohos.usb.d.ts| +|新增|NA|类名:FunctionType<br>方法or属性:MTP = 8|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: FunctionType<br>方法 or 属性:PTP = 16|@ohos.usb.d.ts| +|新增|NA|类名:FunctionType<br>方法or属性:PTP = 16|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: FunctionType<br>方法 or 属性:RNDIS = 32|@ohos.usb.d.ts| +|新增|NA|类名:FunctionType<br>方法or属性:RNDIS = 32|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: FunctionType<br>方法 or 属性:MIDI = 64|@ohos.usb.d.ts| +|新增|NA|类名:FunctionType<br>方法or属性:MIDI = 64|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: FunctionType<br>方法 or 属性:AUDIO_SOURCE = 128|@ohos.usb.d.ts| +|新增|NA|类名:FunctionType<br>方法or属性:AUDIO_SOURCE = 128|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usb<br>类名: FunctionType<br>方法 or 属性:NCM = 256|@ohos.usb.d.ts| +|新增|NA|类名:FunctionType<br>方法or属性:NCM = 256|@ohos.usb.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function getDevices(): Array\<Readonly\<USBDevice>>;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function connectDevice(device: USBDevice): Readonly\<USBDevicePipe>;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function hasRight(deviceName: string): boolean;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function requestRight(deviceName: string): Promise\<boolean>;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function removeRight(deviceName: string): boolean;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function addRight(bundleName: string, deviceName: string): boolean;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function usbFunctionsFromString(funcs: string): number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function usbFunctionsToString(funcs: FunctionType): string;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function setCurrentFunctions(funcs: FunctionType): Promise\<void>;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function getCurrentFunctions(): FunctionType;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function getPorts(): Array\<USBPort>;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function getSupportedModes(portId: number): PortModeType;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function setPortRoles(portId: number, powerRole: PowerRoleType, dataRole: DataRoleType): Promise\<void>;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function claimInterface(pipe: USBDevicePipe, iface: USBInterface, force?: boolean): number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function releaseInterface(pipe: USBDevicePipe, iface: USBInterface): number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function setConfiguration(pipe: USBDevicePipe, config: USBConfiguration): number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function setInterface(pipe: USBDevicePipe, iface: USBInterface): number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function getRawDescriptor(pipe: USBDevicePipe): Uint8Array;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function getFileDescriptor(pipe: USBDevicePipe): number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function controlTransfer(pipe: USBDevicePipe, controlparam: USBControlParams, timeout?: number): Promise\<number>;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function bulkTransfer(pipe: USBDevicePipe, endpoint: USBEndpoint, buffer: Uint8Array,<br><br> timeout?: number): Promise\<number>;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: usbManager<br>方法 or 属性: function closePipe(pipe: USBDevicePipe): number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBEndpoint|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBEndpoint<br>方法 or 属性: address: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBEndpoint<br>方法 or 属性: attributes: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBEndpoint<br>方法 or 属性: interval: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBEndpoint<br>方法 or 属性: maxPacketSize: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBEndpoint<br>方法 or 属性: direction: USBRequestDirection;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBEndpoint<br>方法 or 属性: number: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBEndpoint<br>方法 or 属性: type: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBEndpoint<br>方法 or 属性: interfaceId: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBInterface|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBInterface<br>方法 or 属性: id: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBInterface<br>方法 or 属性: protocol: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBInterface<br>方法 or 属性: clazz: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBInterface<br>方法 or 属性: subClass: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBInterface<br>方法 or 属性: alternateSetting: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBInterface<br>方法 or 属性: name: string;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBInterface<br>方法 or 属性: endpoints: Array\<USBEndpoint>;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBConfiguration|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBConfiguration<br>方法 or 属性: id: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBConfiguration<br>方法 or 属性: attributes: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBConfiguration<br>方法 or 属性: maxPower: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBConfiguration<br>方法 or 属性: name: string;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBConfiguration<br>方法 or 属性: isRemoteWakeup: boolean;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBConfiguration<br>方法 or 属性: isSelfPowered: boolean;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBConfiguration<br>方法 or 属性: interfaces: Array\<USBInterface>;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevice|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevice<br>方法 or 属性: busNum: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevice<br>方法 or 属性: devAddress: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevice<br>方法 or 属性: serial: string;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevice<br>方法 or 属性: name: string;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevice<br>方法 or 属性: manufacturerName: string;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevice<br>方法 or 属性: productName: string;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevice<br>方法 or 属性: version: string;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevice<br>方法 or 属性: vendorId: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevice<br>方法 or 属性: productId: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevice<br>方法 or 属性: clazz: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevice<br>方法 or 属性: subClass: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevice<br>方法 or 属性: protocol: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevice<br>方法 or 属性: configs: Array\<USBConfiguration>;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevicePipe|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevicePipe<br>方法 or 属性: busNum: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBDevicePipe<br>方法 or 属性: devAddress: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: PowerRoleType|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: PowerRoleType<br>方法 or 属性: NONE = 0|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: PowerRoleType<br>方法 or 属性: SOURCE = 1|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: PowerRoleType<br>方法 or 属性: SINK = 2|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: DataRoleType|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: DataRoleType<br>方法 or 属性: NONE = 0|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: DataRoleType<br>方法 or 属性: HOST = 1|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: DataRoleType<br>方法 or 属性: DEVICE = 2|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: PortModeType|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: PortModeType<br>方法 or 属性: NONE = 0|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: PortModeType<br>方法 or 属性: UFP = 1|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: PortModeType<br>方法 or 属性: DFP = 2|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: PortModeType<br>方法 or 属性: DRP = 3|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: PortModeType<br>方法 or 属性: NUM_MODES = 4|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBPortStatus|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBPortStatus<br>方法 or 属性: currentMode: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBPortStatus<br>方法 or 属性: currentPowerRole: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBPortStatus<br>方法 or 属性: currentDataRole: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBPort|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBPort<br>方法 or 属性: id: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBPort<br>方法 or 属性: supportedModes: PortModeType;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBPort<br>方法 or 属性: status: USBPortStatus;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBControlParams|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBControlParams<br>方法 or 属性: request: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBControlParams<br>方法 or 属性: target: USBRequestTargetType;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBControlParams<br>方法 or 属性: reqType: USBControlRequestType;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBControlParams<br>方法 or 属性: value: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBControlParams<br>方法 or 属性: index: number;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBControlParams<br>方法 or 属性: data: Uint8Array;|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBRequestTargetType|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBRequestTargetType<br>方法 or 属性: USB_REQUEST_TARGET_DEVICE = 0|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBRequestTargetType<br>方法 or 属性: USB_REQUEST_TARGET_INTERFACE = 1|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBRequestTargetType<br>方法 or 属性: USB_REQUEST_TARGET_ENDPOINT = 2|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBRequestTargetType<br>方法 or 属性: USB_REQUEST_TARGET_OTHER = 3|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBControlRequestType|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBControlRequestType<br>方法 or 属性: USB_REQUEST_TYPE_STANDARD = 0|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBControlRequestType<br>方法 or 属性: USB_REQUEST_TYPE_CLASS = 1|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBControlRequestType<br>方法 or 属性: USB_REQUEST_TYPE_VENDOR = 2|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBRequestDirection|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBRequestDirection<br>方法 or 属性: USB_REQUEST_DIR_TO_DEVICE = 0|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: USBRequestDirection<br>方法 or 属性: USB_REQUEST_DIR_FROM_DEVICE = 0x80|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: FunctionType|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: FunctionType<br>方法 or 属性: NONE = 0|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: FunctionType<br>方法 or 属性: ACM = 1|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: FunctionType<br>方法 or 属性: ECM = 2|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: FunctionType<br>方法 or 属性: HDC = 4|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: FunctionType<br>方法 or 属性: MTP = 8|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: FunctionType<br>方法 or 属性: PTP = 16|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: FunctionType<br>方法 or 属性: RNDIS = 32|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: FunctionType<br>方法 or 属性: MIDI = 64|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: FunctionType<br>方法 or 属性: AUDIO_SOURCE = 128|@ohos.usbManager.d.ts| +|新增|NA|模块名: ohos.usbManager<br>类名: FunctionType<br>方法 or 属性: NCM = 256|@ohos.usbManager.d.ts| +|废弃版本有变化|类名:usb<br>废弃版本:N/A|类名:usb<br>废弃版本:9<br>代替接口:ohos.usbManager |@ohos.usb.d.ts| +|函数有变化|类名:usb<br>方法 or 属性:function controlTransfer(pipe: USBDevicePipe, contrlparam: USBControlParams, timeout?: number): Promise\<number>;<br>|类名:usb<br>方法 or 属性:function controlTransfer(pipe: USBDevicePipe, controlparam: USBControlParams, timeout?: number): Promise\<number>;<br>|@ohos.usb.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-user-iam.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-user-iam.md new file mode 100644 index 0000000000000000000000000000000000000000..55ee09c63abf59cfb58f53aa4a58a78cee7ff584 --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-user-iam.md @@ -0,0 +1,111 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.userIAM.faceAuth<br>类名: faceAuth|@ohos.userIAM.faceAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.faceAuth<br>类名: FaceAuthManager|@ohos.userIAM.faceAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.faceAuth<br>类名: FaceAuthManager<br>方法 or 属性: constructor();|@ohos.userIAM.faceAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.faceAuth<br>类名: FaceAuthManager<br>方法 or 属性: setSurfaceId(surfaceId: string): void;|@ohos.userIAM.faceAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.userAuth<br>类名: AuthEventKey<br>方法 or 属性:type AuthEventKey = "result" \| "tip";|@ohos.userIAM.userAuth.d.ts| +|新增|NA|类名:AuthEventKey<br>方法or属性:type AuthEventKey = "result" \| "tip";|@ohos.userIAM.userAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.userAuth<br>类名: AuthEventKey<br>方法 or 属性:type AuthEventKey = "result" \| "tip";|@ohos.userIAM.userAuth.d.ts| +|新增|NA|类名:AuthEventKey<br>方法or属性:type AuthEventKey = "result" \| "tip";|@ohos.userIAM.userAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.userAuth<br>类名: AuthEvent|@ohos.userIAM.userAuth.d.ts| +|新增|NA|类名:AuthEvent<br>方法or属性:|@ohos.userIAM.userAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.userAuth<br>类名: AuthEvent<br>方法 or 属性:callback(result: EventInfo): void;|@ohos.userIAM.userAuth.d.ts| +|新增|NA|类名:AuthEvent<br>方法or属性:callback(result: EventInfo): void;|@ohos.userIAM.userAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.userAuth<br>类名: AuthResultInfo|@ohos.userIAM.userAuth.d.ts| +|新增|NA|类名:AuthResultInfo<br>方法or属性:|@ohos.userIAM.userAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.userAuth<br>类名: AuthResultInfo<br>方法 or 属性:result: number;|@ohos.userIAM.userAuth.d.ts| +|新增|NA|类名:AuthResultInfo<br>方法or属性:result: number;|@ohos.userIAM.userAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.userAuth<br>类名: AuthResultInfo<br>方法 or 属性:token ?: Uint8Array;|@ohos.userIAM.userAuth.d.ts| +|新增|NA|类名:AuthResultInfo<br>方法or属性:token ?: Uint8Array;|@ohos.userIAM.userAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.userAuth<br>类名: AuthResultInfo<br>方法 or 属性:remainAttempts ?: number;|@ohos.userIAM.userAuth.d.ts| +|新增|NA|类名:AuthResultInfo<br>方法or属性:remainAttempts ?: number;|@ohos.userIAM.userAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.userAuth<br>类名: AuthResultInfo<br>方法 or 属性:lockoutDuration ?: number;|@ohos.userIAM.userAuth.d.ts| +|新增|NA|类名:AuthResultInfo<br>方法or属性:lockoutDuration ?: number;|@ohos.userIAM.userAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.userAuth<br>类名: TipInfo|@ohos.userIAM.userAuth.d.ts| +|新增|NA|类名:TipInfo<br>方法or属性:|@ohos.userIAM.userAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.userAuth<br>类名: TipInfo<br>方法 or 属性:module: number;|@ohos.userIAM.userAuth.d.ts| +|新增|NA|类名:TipInfo<br>方法or属性:module: number;|@ohos.userIAM.userAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.userAuth<br>类名: TipInfo<br>方法 or 属性:tip: number;|@ohos.userIAM.userAuth.d.ts| +|新增|NA|类名:TipInfo<br>方法or属性:tip: number;|@ohos.userIAM.userAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.userAuth<br>类名: AuthInstance|@ohos.userIAM.userAuth.d.ts| +|新增|NA|类名:AuthInstance<br>方法or属性:|@ohos.userIAM.userAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.userAuth<br>类名: AuthInstance<br>方法 or 属性:on: (name: AuthEventKey, callback: AuthEvent) => void;|@ohos.userIAM.userAuth.d.ts| +|新增|NA|类名:AuthInstance<br>方法or属性:on: (name: AuthEventKey, callback: AuthEvent) => void;|@ohos.userIAM.userAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.userAuth<br>类名: AuthInstance<br>方法 or 属性:off: (name: AuthEventKey) => void;|@ohos.userIAM.userAuth.d.ts| +|新增|NA|类名:AuthInstance<br>方法or属性:off: (name: AuthEventKey) => void;|@ohos.userIAM.userAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.userAuth<br>类名: AuthInstance<br>方法 or 属性:start: () => void;|@ohos.userIAM.userAuth.d.ts| +|新增|NA|类名:AuthInstance<br>方法or属性:start: () => void;|@ohos.userIAM.userAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.userAuth<br>类名: AuthInstance<br>方法 or 属性:cancel: () => void;|@ohos.userIAM.userAuth.d.ts| +|新增|NA|类名:AuthInstance<br>方法or属性:cancel: () => void;|@ohos.userIAM.userAuth.d.ts| +|新增|NA|类名:userAuth<br>方法or属性:function getAvailableStatus(authType: UserAuthType, authTrustLevel: AuthTrustLevel): void;|@ohos.userIAM.userAuth.d.ts| +|新增|NA|类名:userAuth<br>方法or属性:function getAuthInstance(challenge: Uint8Array, authType: UserAuthType, authTrustLevel: AuthTrustLevel): AuthInstance;|@ohos.userIAM.userAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.userAuth<br>类名: UserAuthResultCode|@ohos.userIAM.userAuth.d.ts| +|新增|NA|类名:UserAuthResultCode<br>方法or属性:|@ohos.userIAM.userAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.userAuth<br>类名: UserAuthResultCode<br>方法 or 属性:SUCCESS = 12500000|@ohos.userIAM.userAuth.d.ts| +|新增|NA|类名:UserAuthResultCode<br>方法or属性:SUCCESS = 12500000|@ohos.userIAM.userAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.userAuth<br>类名: UserAuthResultCode<br>方法 or 属性:FAIL = 12500001|@ohos.userIAM.userAuth.d.ts| +|新增|NA|类名:UserAuthResultCode<br>方法or属性:FAIL = 12500001|@ohos.userIAM.userAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.userAuth<br>类名: UserAuthResultCode<br>方法 or 属性:GENERAL_ERROR = 12500002|@ohos.userIAM.userAuth.d.ts| +|新增|NA|类名:UserAuthResultCode<br>方法or属性:GENERAL_ERROR = 12500002|@ohos.userIAM.userAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.userAuth<br>类名: UserAuthResultCode<br>方法 or 属性:CANCELED = 12500003|@ohos.userIAM.userAuth.d.ts| +|新增|NA|类名:UserAuthResultCode<br>方法or属性:CANCELED = 12500003|@ohos.userIAM.userAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.userAuth<br>类名: UserAuthResultCode<br>方法 or 属性:TIMEOUT = 12500004|@ohos.userIAM.userAuth.d.ts| +|新增|NA|类名:UserAuthResultCode<br>方法or属性:TIMEOUT = 12500004|@ohos.userIAM.userAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.userAuth<br>类名: UserAuthResultCode<br>方法 or 属性:TYPE_NOT_SUPPORT = 12500005|@ohos.userIAM.userAuth.d.ts| +|新增|NA|类名:UserAuthResultCode<br>方法or属性:TYPE_NOT_SUPPORT = 12500005|@ohos.userIAM.userAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.userAuth<br>类名: UserAuthResultCode<br>方法 or 属性:TRUST_LEVEL_NOT_SUPPORT = 12500006|@ohos.userIAM.userAuth.d.ts| +|新增|NA|类名:UserAuthResultCode<br>方法or属性:TRUST_LEVEL_NOT_SUPPORT = 12500006|@ohos.userIAM.userAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.userAuth<br>类名: UserAuthResultCode<br>方法 or 属性:BUSY = 12500007|@ohos.userIAM.userAuth.d.ts| +|新增|NA|类名:UserAuthResultCode<br>方法or属性:BUSY = 12500007|@ohos.userIAM.userAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.userAuth<br>类名: UserAuthResultCode<br>方法 or 属性:LOCKED = 12500009|@ohos.userIAM.userAuth.d.ts| +|新增|NA|类名:UserAuthResultCode<br>方法or属性:LOCKED = 12500009|@ohos.userIAM.userAuth.d.ts| +|新增|NA|模块名: ohos.userIAM.userAuth<br>类名: UserAuthResultCode<br>方法 or 属性:NOT_ENROLLED = 12500010|@ohos.userIAM.userAuth.d.ts| +|新增|NA|类名:UserAuthResultCode<br>方法or属性:NOT_ENROLLED = 12500010|@ohos.userIAM.userAuth.d.ts| +|废弃版本有变化|类名:AuthenticationResult<br>废弃版本:N/A|类名:AuthenticationResult<br>废弃版本:8<br>代替接口:ohos.userIAM.userAuth.ResultCode |@ohos.userIAM.userAuth.d.ts| +|废弃版本有变化|类名:Authenticator<br>废弃版本:N/A|类名:Authenticator<br>废弃版本:8<br>代替接口:N/A|@ohos.userIAM.userAuth.d.ts| +|废弃版本有变化|类名:UserAuth<br>废弃版本:N/A|类名:UserAuth<br>废弃版本:9<br>代替接口:ohos.userIAM.userAuth.AuthInstance |@ohos.userIAM.userAuth.d.ts| +|废弃版本有变化|类名:UserAuth<br>方法 or 属性:constructor();<br>废弃版本:N/A|类名:UserAuth<br>方法 or 属性:constructor();<br>废弃版本:9<br>代替接口:ohos.userIAM.userAuth.getAuthInstance |@ohos.userIAM.userAuth.d.ts| +|废弃版本有变化|类名:UserAuth<br>方法 or 属性:auth(challenge: Uint8Array, authType: UserAuthType, authTrustLevel: AuthTrustLevel, callback: IUserAuthCallback): Uint8Array;<br>废弃版本:N/A|类名:UserAuth<br>方法 or 属性:auth(challenge: Uint8Array, authType: UserAuthType, authTrustLevel: AuthTrustLevel, callback: IUserAuthCallback): Uint8Array;<br>废弃版本:9<br>代替接口:ohos.userIAM.userAuth.AuthInstance.start |@ohos.userIAM.userAuth.d.ts| +|废弃版本有变化|类名:IUserAuthCallback<br>废弃版本:N/A|类名:IUserAuthCallback<br>废弃版本:9<br>代替接口:ohos.userIAM.userAuth.AuthEvent |@ohos.userIAM.userAuth.d.ts| +|废弃版本有变化|类名:AuthResult<br>废弃版本:N/A|类名:AuthResult<br>废弃版本:9<br>代替接口:ohos.userIAM.userAuth.AuthResultInfo |@ohos.userIAM.userAuth.d.ts| +|废弃版本有变化|类名:ResultCode<br>废弃版本:N/A|类名:ResultCode<br>废弃版本:9<br>代替接口:ohos.userIAM.userAuth.UserAuthResultCode |@ohos.userIAM.userAuth.d.ts| +|废弃版本有变化|类名:ResultCode<br>方法 or 属性:SUCCESS = 0<br>废弃版本:N/A|类名:ResultCode<br>方法 or 属性:SUCCESS = 0<br>废弃版本:9<br>代替接口:N/A|@ohos.userIAM.userAuth.d.ts| +|废弃版本有变化|类名:ResultCode<br>方法 or 属性:FAIL = 1<br>废弃版本:N/A|类名:ResultCode<br>方法 or 属性:FAIL = 1<br>废弃版本:9<br>代替接口:N/A|@ohos.userIAM.userAuth.d.ts| +|废弃版本有变化|类名:ResultCode<br>方法 or 属性:GENERAL_ERROR = 2<br>废弃版本:N/A|类名:ResultCode<br>方法 or 属性:GENERAL_ERROR = 2<br>废弃版本:9<br>代替接口:N/A|@ohos.userIAM.userAuth.d.ts| +|废弃版本有变化|类名:ResultCode<br>方法 or 属性:CANCELED = 3<br>废弃版本:N/A|类名:ResultCode<br>方法 or 属性:CANCELED = 3<br>废弃版本:9<br>代替接口:N/A|@ohos.userIAM.userAuth.d.ts| +|废弃版本有变化|类名:ResultCode<br>方法 or 属性:TIMEOUT = 4<br>废弃版本:N/A|类名:ResultCode<br>方法 or 属性:TIMEOUT = 4<br>废弃版本:9<br>代替接口:N/A|@ohos.userIAM.userAuth.d.ts| +|废弃版本有变化|类名:ResultCode<br>方法 or 属性:TYPE_NOT_SUPPORT = 5<br>废弃版本:N/A|类名:ResultCode<br>方法 or 属性:TYPE_NOT_SUPPORT = 5<br>废弃版本:9<br>代替接口:N/A|@ohos.userIAM.userAuth.d.ts| +|废弃版本有变化|类名:ResultCode<br>方法 or 属性:TRUST_LEVEL_NOT_SUPPORT = 6<br>废弃版本:N/A|类名:ResultCode<br>方法 or 属性:TRUST_LEVEL_NOT_SUPPORT = 6<br>废弃版本:9<br>代替接口:N/A|@ohos.userIAM.userAuth.d.ts| +|废弃版本有变化|类名:ResultCode<br>方法 or 属性:BUSY = 7<br>废弃版本:N/A|类名:ResultCode<br>方法 or 属性:BUSY = 7<br>废弃版本:9<br>代替接口:N/A|@ohos.userIAM.userAuth.d.ts| +|废弃版本有变化|类名:ResultCode<br>方法 or 属性:INVALID_PARAMETERS = 8<br>废弃版本:N/A|类名:ResultCode<br>方法 or 属性:INVALID_PARAMETERS = 8<br>废弃版本:9<br>代替接口:N/A|@ohos.userIAM.userAuth.d.ts| +|废弃版本有变化|类名:ResultCode<br>方法 or 属性:LOCKED = 9<br>废弃版本:N/A|类名:ResultCode<br>方法 or 属性:LOCKED = 9<br>废弃版本:9<br>代替接口:N/A|@ohos.userIAM.userAuth.d.ts| +|废弃版本有变化|类名:ResultCode<br>方法 or 属性:NOT_ENROLLED = 10<br>废弃版本:N/A|类名:ResultCode<br>方法 or 属性:NOT_ENROLLED = 10<br>废弃版本:9<br>代替接口:N/A|@ohos.userIAM.userAuth.d.ts| +|起始版本有变化|类名:AuthType<br>方法 or 属性:type AuthType = "ALL" \| "FACE_ONLY";<br>起始版本:N/A|类名:AuthType<br>方法 or 属性:type AuthType = "ALL" \| "FACE_ONLY";<br>起始版本:6|@ohos.userIAM.userAuth.d.ts| +|起始版本有变化|类名:AuthType<br>方法 or 属性:type AuthType = "ALL" \| "FACE_ONLY";<br>起始版本:N/A|类名:AuthType<br>方法 or 属性:type AuthType = "ALL" \| "FACE_ONLY";<br>起始版本:6|@ohos.userIAM.userAuth.d.ts| +|起始版本有变化|类名:SecureLevel<br>方法 or 属性:type SecureLevel = "S1" \| "S2" \| "S3" \| "S4";<br>起始版本:N/A|类名:SecureLevel<br>方法 or 属性:type SecureLevel = "S1" \| "S2" \| "S3" \| "S4";<br>起始版本:6|@ohos.userIAM.userAuth.d.ts| +|起始版本有变化|类名:SecureLevel<br>方法 or 属性:type SecureLevel = "S1" \| "S2" \| "S3" \| "S4";<br>起始版本:N/A|类名:SecureLevel<br>方法 or 属性:type SecureLevel = "S1" \| "S2" \| "S3" \| "S4";<br>起始版本:6|@ohos.userIAM.userAuth.d.ts| +|起始版本有变化|类名:SecureLevel<br>方法 or 属性:type SecureLevel = "S1" \| "S2" \| "S3" \| "S4";<br>起始版本:N/A|类名:SecureLevel<br>方法 or 属性:type SecureLevel = "S1" \| "S2" \| "S3" \| "S4";<br>起始版本:6|@ohos.userIAM.userAuth.d.ts| +|起始版本有变化|类名:SecureLevel<br>方法 or 属性:type SecureLevel = "S1" \| "S2" \| "S3" \| "S4";<br>起始版本:N/A|类名:SecureLevel<br>方法 or 属性:type SecureLevel = "S1" \| "S2" \| "S3" \| "S4";<br>起始版本:6|@ohos.userIAM.userAuth.d.ts| +|起始版本有变化|类名:AuthenticationResult<br>起始版本:N/A|类名:AuthenticationResult<br>起始版本:6|@ohos.userIAM.userAuth.d.ts| +|起始版本有变化|类名:AuthenticationResult<br>方法 or 属性:NO_SUPPORT = -1<br>起始版本:N/A|类名:AuthenticationResult<br>方法 or 属性:NO_SUPPORT = -1<br>起始版本:6|@ohos.userIAM.userAuth.d.ts| +|起始版本有变化|类名:AuthenticationResult<br>方法 or 属性:SUCCESS = 0<br>起始版本:N/A|类名:AuthenticationResult<br>方法 or 属性:SUCCESS = 0<br>起始版本:6|@ohos.userIAM.userAuth.d.ts| +|起始版本有变化|类名:AuthenticationResult<br>方法 or 属性:COMPARE_FAILURE = 1<br>起始版本:N/A|类名:AuthenticationResult<br>方法 or 属性:COMPARE_FAILURE = 1<br>起始版本:6|@ohos.userIAM.userAuth.d.ts| +|起始版本有变化|类名:AuthenticationResult<br>方法 or 属性:CANCELED = 2<br>起始版本:N/A|类名:AuthenticationResult<br>方法 or 属性:CANCELED = 2<br>起始版本:6|@ohos.userIAM.userAuth.d.ts| +|起始版本有变化|类名:AuthenticationResult<br>方法 or 属性:TIMEOUT = 3<br>起始版本:N/A|类名:AuthenticationResult<br>方法 or 属性:TIMEOUT = 3<br>起始版本:6|@ohos.userIAM.userAuth.d.ts| +|起始版本有变化|类名:AuthenticationResult<br>方法 or 属性:CAMERA_FAIL = 4<br>起始版本:N/A|类名:AuthenticationResult<br>方法 or 属性:CAMERA_FAIL = 4<br>起始版本:6|@ohos.userIAM.userAuth.d.ts| +|起始版本有变化|类名:AuthenticationResult<br>方法 or 属性:BUSY = 5<br>起始版本:N/A|类名:AuthenticationResult<br>方法 or 属性:BUSY = 5<br>起始版本:6|@ohos.userIAM.userAuth.d.ts| +|起始版本有变化|类名:AuthenticationResult<br>方法 or 属性:INVALID_PARAMETERS = 6<br>起始版本:N/A|类名:AuthenticationResult<br>方法 or 属性:INVALID_PARAMETERS = 6<br>起始版本:6|@ohos.userIAM.userAuth.d.ts| +|起始版本有变化|类名:AuthenticationResult<br>方法 or 属性:LOCKED = 7<br>起始版本:N/A|类名:AuthenticationResult<br>方法 or 属性:LOCKED = 7<br>起始版本:6|@ohos.userIAM.userAuth.d.ts| +|起始版本有变化|类名:AuthenticationResult<br>方法 or 属性:NOT_ENROLLED = 8<br>起始版本:N/A|类名:AuthenticationResult<br>方法 or 属性:NOT_ENROLLED = 8<br>起始版本:6|@ohos.userIAM.userAuth.d.ts| +|起始版本有变化|类名:AuthenticationResult<br>方法 or 属性:GENERAL_ERROR = 100<br>起始版本:N/A|类名:AuthenticationResult<br>方法 or 属性:GENERAL_ERROR = 100<br>起始版本:6|@ohos.userIAM.userAuth.d.ts| +|起始版本有变化|类名:Authenticator<br>起始版本:N/A|类名:Authenticator<br>起始版本:6|@ohos.userIAM.userAuth.d.ts| +|起始版本有变化|类名:Authenticator<br>方法 or 属性:execute(type: AuthType, level: SecureLevel, callback: AsyncCallback\<number>): void;<br>起始版本:N/A|类名:Authenticator<br>方法 or 属性:execute(type: AuthType, level: SecureLevel, callback: AsyncCallback\<number>): void;<br>起始版本:6|@ohos.userIAM.userAuth.d.ts| +|起始版本有变化|类名:Authenticator<br>方法 or 属性:execute(type: AuthType, level: SecureLevel): Promise\<number>;<br>起始版本:N/A|类名:Authenticator<br>方法 or 属性:execute(type: AuthType, level: SecureLevel): Promise\<number>;<br>起始版本:6|@ohos.userIAM.userAuth.d.ts| +|起始版本有变化|类名:IUserAuthCallback<br>起始版本:N/A|类名:IUserAuthCallback<br>起始版本:8|@ohos.userIAM.userAuth.d.ts| +|起始版本有变化|类名:AuthResult<br>方法 or 属性:token ?: Uint8Array;<br>起始版本:N/A|类名:AuthResult<br>方法 or 属性:token ?: Uint8Array;<br>起始版本:8|@ohos.userIAM.userAuth.d.ts| +|起始版本有变化|类名:AuthResult<br>方法 or 属性:remainTimes ?: number;<br>起始版本:N/A|类名:AuthResult<br>方法 or 属性:remainTimes ?: number;<br>起始版本:8|@ohos.userIAM.userAuth.d.ts| +|起始版本有变化|类名:AuthResult<br>方法 or 属性:freezingTime ?: number;<br>起始版本:N/A|类名:AuthResult<br>方法 or 属性:freezingTime ?: number;<br>起始版本:8|@ohos.userIAM.userAuth.d.ts| +|删除(权限)|类名:userAuth<br>权限:ohos.permission.ACCESS_BIOMETRIC|类名:userAuth<br>权限:N/A|@ohos.userIAM.userAuth.d.ts| +|新增(权限)|类名:Authenticator<br>方法 or 属性:execute(type: AuthType, level: SecureLevel, callback: AsyncCallback\<number>): void;<br>权限:N/A|类名:Authenticator<br>方法 or 属性:execute(type: AuthType, level: SecureLevel, callback: AsyncCallback\<number>): void;<br>权限:ohos.permission.ACCESS_BIOMETRIC|@ohos.userIAM.userAuth.d.ts| +|新增(权限)|类名:Authenticator<br>方法 or 属性:execute(type: AuthType, level: SecureLevel): Promise\<number>;<br>权限:N/A|类名:Authenticator<br>方法 or 属性:execute(type: AuthType, level: SecureLevel): Promise\<number>;<br>权限:ohos.permission.ACCESS_BIOMETRIC|@ohos.userIAM.userAuth.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-web.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-web.md new file mode 100644 index 0000000000000000000000000000000000000000..7ef0432efae5aa71e6e2be92d26612a3a63cb668 --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-web.md @@ -0,0 +1,129 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.web.webview<br>类名: webview|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebHeader|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebHeader<br>方法 or 属性: headerKey: string;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebHeader<br>方法 or 属性: headerValue: string;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebHitTestType|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebHitTestType<br>方法 or 属性: EditText|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebHitTestType<br>方法 or 属性: Email|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebHitTestType<br>方法 or 属性: HttpAnchor|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebHitTestType<br>方法 or 属性: HttpAnchorImg|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebHitTestType<br>方法 or 属性: Img|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebHitTestType<br>方法 or 属性: Map|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebHitTestType<br>方法 or 属性: Phone|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebHitTestType<br>方法 or 属性: Unknown|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: HitTestValue|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: HitTestValue<br>方法 or 属性: type: WebHitTestType;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: HitTestValue<br>方法 or 属性: extra: string;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebCustomScheme|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebCustomScheme<br>方法 or 属性: schemeName: string;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebCustomScheme<br>方法 or 属性: isSupportCORS: boolean;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebCustomScheme<br>方法 or 属性: isSupportFetch: boolean;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebStorageOrigin|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebStorageOrigin<br>方法 or 属性: origin: string;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebStorageOrigin<br>方法 or 属性: usage: number;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebStorageOrigin<br>方法 or 属性: quota: number;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: webview<br>方法 or 属性: function once(type: string, callback: Callback\<void>): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebStorage|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebStorage<br>方法 or 属性: static deleteAllData(): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebStorage<br>方法 or 属性: static deleteOrigin(origin: string): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebStorage<br>方法 or 属性: static getOrigins(): Promise\<Array\<WebStorageOrigin>>;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebStorage<br>方法 or 属性: static getOrigins(callback: AsyncCallback\<Array\<WebStorageOrigin>>): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebStorage<br>方法 or 属性: static getOriginQuota(origin: string): Promise\<number>;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebStorage<br>方法 or 属性: static getOriginQuota(origin: string, callback: AsyncCallback\<number>): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebStorage<br>方法 or 属性: static getOriginUsage(origin: string): Promise\<number> ;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebStorage<br>方法 or 属性: static getOriginUsage(origin: string, callback: AsyncCallback\<number>): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebDataBase|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebDataBase<br>方法 or 属性: static existHttpAuthCredentials(): boolean;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebDataBase<br>方法 or 属性: static deleteHttpAuthCredentials(): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebDataBase<br>方法 or 属性: static getHttpAuthCredentials(host: string, realm: string): Array\<string>;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebDataBase<br>方法 or 属性: static saveHttpAuthCredentials(host: string, realm: string, username: string, password: string): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: GeolocationPermissions|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: GeolocationPermissions<br>方法 or 属性: static allowGeolocation(origin: string): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: GeolocationPermissions<br>方法 or 属性: static deleteGeolocation(origin: string): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: GeolocationPermissions<br>方法 or 属性: static deleteAllGeolocation(): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: GeolocationPermissions<br>方法 or 属性: static getAccessibleGeolocation(origin: string): Promise\<boolean>;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: GeolocationPermissions<br>方法 or 属性: static getAccessibleGeolocation(origin: string, callback: AsyncCallback\<boolean>): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: GeolocationPermissions<br>方法 or 属性: static getStoredGeolocation(): Promise\<Array\<string>>;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: GeolocationPermissions<br>方法 or 属性: static getStoredGeolocation(callback: AsyncCallback\<Array\<string>>): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebCookieManager|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebCookieManager<br>方法 or 属性: static getCookie(url: string): string;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebCookieManager<br>方法 or 属性: static setCookie(url: string, value: string): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebCookieManager<br>方法 or 属性: static saveCookieAsync(): Promise\<void>;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebCookieManager<br>方法 or 属性: static saveCookieAsync(callback: AsyncCallback\<void>): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebCookieManager<br>方法 or 属性: static isCookieAllowed(): boolean;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebCookieManager<br>方法 or 属性: static putAcceptCookieEnabled(accept: boolean): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebCookieManager<br>方法 or 属性: static isThirdPartyCookieAllowed(): boolean;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebCookieManager<br>方法 or 属性: static putAcceptThirdPartyCookieEnabled(accept: boolean): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebCookieManager<br>方法 or 属性: static existCookie(): boolean;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebCookieManager<br>方法 or 属性: static deleteEntireCookie(): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebCookieManager<br>方法 or 属性: static deleteSessionCookie(): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebMessagePort|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebMessagePort<br>方法 or 属性: close(): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebMessagePort<br>方法 or 属性: postMessageEvent(message: WebMessage): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebMessagePort<br>方法 or 属性: onMessageEvent(callback: (result: WebMessage) => void): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: HistoryItem|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: HistoryItem<br>方法 or 属性: icon: image.PixelMap;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: HistoryItem<br>方法 or 属性: historyUrl: string;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: HistoryItem<br>方法 or 属性: historyRawUrl: string;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: HistoryItem<br>方法 or 属性: title: string;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: BackForwardList|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: BackForwardList<br>方法 or 属性: currentIndex: number;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: BackForwardList<br>方法 or 属性: size: number;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: BackForwardList<br>方法 or 属性: getItemAtIndex(index: number): HistoryItem;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: static initializeWebEngine(): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: static setWebDebuggingAccess(webDebuggingAccess: boolean): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: accessForward(): boolean;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: accessBackward(): boolean;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: accessStep(step: number): boolean;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: forward(): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: backward(): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: clearHistory(): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: onActive(): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: onInactive(): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: refresh(): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: loadData(data: string, mimeType: string, encoding: string, baseUrl?: string, historyUrl?: string): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: loadUrl(url: string \| Resource, headers?: Array\<WebHeader>): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: getHitTest(): WebHitTestType;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: storeWebArchive(baseName: string, autoName: boolean): Promise\<string>;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: storeWebArchive(baseName: string, autoName: boolean, callback: AsyncCallback\<string>): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: zoom(factor: number): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: zoomIn(): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: zoomOut(): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: getHitTestValue(): HitTestValue;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: getWebId(): number;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: getUserAgent(): string;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: getTitle(): string;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: getPageHeight(): number;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: backOrForward(step: number): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: requestFocus(): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: createWebMessagePorts(): Array\<WebMessagePort>;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: postMessage(name: string, ports: Array\<WebMessagePort>, uri: string): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: stop(): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: registerJavaScriptProxy(object: object, name: string, methodList: Array\<string>): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: deleteJavaScriptRegister(name: string): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: searchAllAsync(searchString: string): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: clearMatches(): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: searchNext(forward: boolean): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: clearSslCache(): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: clearClientAuthenticationCache(): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: runJavaScript(script: string): Promise\<string>;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: runJavaScript(script: string, callback: AsyncCallback\<string>): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: getUrl(): string;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: pageUp(top:boolean): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: pageDown(bottom:boolean): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: getOriginalUrl(): string;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: getFavicon(): image.PixelMap;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: setNetworkAvailable(enable: boolean): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: hasImage(): Promise\<boolean>;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: hasImage(callback: AsyncCallback\<boolean>): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: getBackForwardEntries(): BackForwardList;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: removeCache(clearRom: boolean): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: scrollTo(x:number, y:number): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: scrollBy(deltaX:number, deltaY:number): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: slideScroll(vx:number, vy:number): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: serializeWebState(): Uint8Array;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: restoreWebState(state: Uint8Array): void;|@ohos.web.webview.d.ts| +|新增|NA|模块名: ohos.web.webview<br>类名: WebviewController<br>方法 or 属性: static customizeSchemes(schemes: Array\<WebCustomScheme>): void;|@ohos.web.webview.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-window.md b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-window.md new file mode 100644 index 0000000000000000000000000000000000000000..f1dd5ca853ec7c41c8668426834eaec0a5fddd7c --- /dev/null +++ b/zh-cn/release-notes/api-diff/v3.2-Release/js-apidiff-window.md @@ -0,0 +1,467 @@ +| 操作 | 旧版本 | 新版本 | d.ts文件 | +| ---- | ------ | ------ | -------- | +|新增|NA|模块名: ohos.animation.windowAnimationManager<br>类名: windowAnimationManager|@ohos.animation.windowAnimationManager.d.ts| +|新增|NA|模块名: ohos.animation.windowAnimationManager<br>类名: windowAnimationManager<br>方法 or 属性: function setController(controller: WindowAnimationController): void;|@ohos.animation.windowAnimationManager.d.ts| +|新增|NA|模块名: ohos.animation.windowAnimationManager<br>类名: windowAnimationManager<br>方法 or 属性: function minimizeWindowWithAnimation(windowTarget: WindowAnimationTarget,<br> callback: AsyncCallback\<WindowAnimationFinishedCallback>): void;|@ohos.animation.windowAnimationManager.d.ts| +|新增|NA|模块名: ohos.animation.windowAnimationManager<br>类名: windowAnimationManager<br>方法 or 属性: function minimizeWindowWithAnimation(windowTarget: WindowAnimationTarget): Promise\<WindowAnimationFinishedCallback>;|@ohos.animation.windowAnimationManager.d.ts| +|新增|NA|模块名: ohos.animation.windowAnimationManager<br>类名: RRect|@ohos.animation.windowAnimationManager.d.ts| +|新增|NA|模块名: ohos.animation.windowAnimationManager<br>类名: RRect<br>方法 or 属性: left: number;|@ohos.animation.windowAnimationManager.d.ts| +|新增|NA|模块名: ohos.animation.windowAnimationManager<br>类名: RRect<br>方法 or 属性: top: number;|@ohos.animation.windowAnimationManager.d.ts| +|新增|NA|模块名: ohos.animation.windowAnimationManager<br>类名: RRect<br>方法 or 属性: width: number;|@ohos.animation.windowAnimationManager.d.ts| +|新增|NA|模块名: ohos.animation.windowAnimationManager<br>类名: RRect<br>方法 or 属性: height: number;|@ohos.animation.windowAnimationManager.d.ts| +|新增|NA|模块名: ohos.animation.windowAnimationManager<br>类名: RRect<br>方法 or 属性: radius: number;|@ohos.animation.windowAnimationManager.d.ts| +|新增|NA|模块名: ohos.animation.windowAnimationManager<br>类名: WindowAnimationTarget|@ohos.animation.windowAnimationManager.d.ts| +|新增|NA|模块名: ohos.animation.windowAnimationManager<br>类名: WindowAnimationTarget<br>方法 or 属性: readonly bundleName: string;|@ohos.animation.windowAnimationManager.d.ts| +|新增|NA|模块名: ohos.animation.windowAnimationManager<br>类名: WindowAnimationTarget<br>方法 or 属性: readonly abilityName: string;|@ohos.animation.windowAnimationManager.d.ts| +|新增|NA|模块名: ohos.animation.windowAnimationManager<br>类名: WindowAnimationTarget<br>方法 or 属性: readonly windowBounds: RRect;|@ohos.animation.windowAnimationManager.d.ts| +|新增|NA|模块名: ohos.animation.windowAnimationManager<br>类名: WindowAnimationTarget<br>方法 or 属性: readonly missionId: number;|@ohos.animation.windowAnimationManager.d.ts| +|新增|NA|模块名: ohos.animation.windowAnimationManager<br>类名: WindowAnimationFinishedCallback|@ohos.animation.windowAnimationManager.d.ts| +|新增|NA|模块名: ohos.animation.windowAnimationManager<br>类名: WindowAnimationFinishedCallback<br>方法 or 属性: onAnimationFinish(): void;|@ohos.animation.windowAnimationManager.d.ts| +|新增|NA|模块名: ohos.animation.windowAnimationManager<br>类名: WindowAnimationController|@ohos.animation.windowAnimationManager.d.ts| +|新增|NA|模块名: ohos.animation.windowAnimationManager<br>类名: WindowAnimationController<br>方法 or 属性: onStartAppFromLauncher(startingWindowTarget: WindowAnimationTarget,<br> finishCallback: WindowAnimationFinishedCallback): void;|@ohos.animation.windowAnimationManager.d.ts| +|新增|NA|模块名: ohos.animation.windowAnimationManager<br>类名: WindowAnimationController<br>方法 or 属性: onStartAppFromRecent(startingWindowTarget: WindowAnimationTarget,<br> finishCallback: WindowAnimationFinishedCallback): void;|@ohos.animation.windowAnimationManager.d.ts| +|新增|NA|模块名: ohos.animation.windowAnimationManager<br>类名: WindowAnimationController<br>方法 or 属性: onStartAppFromOther(startingWindowTarget: WindowAnimationTarget,<br> finishCallback: WindowAnimationFinishedCallback): void;|@ohos.animation.windowAnimationManager.d.ts| +|新增|NA|模块名: ohos.animation.windowAnimationManager<br>类名: WindowAnimationController<br>方法 or 属性: onAppTransition(fromWindowTarget: WindowAnimationTarget, toWindowTarget: WindowAnimationTarget,<br> finishCallback: WindowAnimationFinishedCallback): void;|@ohos.animation.windowAnimationManager.d.ts| +|新增|NA|模块名: ohos.animation.windowAnimationManager<br>类名: WindowAnimationController<br>方法 or 属性: onMinimizeWindow(minimizingWindowTarget: WindowAnimationTarget,<br> finishCallback: WindowAnimationFinishedCallback): void;|@ohos.animation.windowAnimationManager.d.ts| +|新增|NA|模块名: ohos.animation.windowAnimationManager<br>类名: WindowAnimationController<br>方法 or 属性: onCloseWindow(closingWindowTarget: WindowAnimationTarget, finishCallback: WindowAnimationFinishedCallback): void;|@ohos.animation.windowAnimationManager.d.ts| +|新增|NA|模块名: ohos.animation.windowAnimationManager<br>类名: WindowAnimationController<br>方法 or 属性: onScreenUnlock(finishCallback: WindowAnimationFinishedCallback): void;|@ohos.animation.windowAnimationManager.d.ts| +|新增|NA|模块名: ohos.animation.windowAnimationManager<br>类名: WindowAnimationController<br>方法 or 属性: onWindowAnimationTargetsUpdate(fullScreenWindowTarget: WindowAnimationTarget,<br> floatingWindowTargets: Array\<WindowAnimationTarget>): void;|@ohos.animation.windowAnimationManager.d.ts| +|新增|NA|模块名: ohos.application.WindowExtensionAbility<br>类名: WindowExtensionAbility|@ohos.application.WindowExtensionAbility.d.ts| +|新增|NA|模块名: ohos.application.WindowExtensionAbility<br>类名: WindowExtensionAbility<br>方法 or 属性: context: WindowExtensionContext;|@ohos.application.WindowExtensionAbility.d.ts| +|新增|NA|模块名: ohos.application.WindowExtensionAbility<br>类名: WindowExtensionAbility<br>方法 or 属性: onConnect(want: Want): void;|@ohos.application.WindowExtensionAbility.d.ts| +|新增|NA|模块名: ohos.application.WindowExtensionAbility<br>类名: WindowExtensionAbility<br>方法 or 属性: onDisconnect(want: Want): void;|@ohos.application.WindowExtensionAbility.d.ts| +|新增|NA|模块名: ohos.application.WindowExtensionAbility<br>类名: WindowExtensionAbility<br>方法 or 属性: onWindowReady(window: window.Window): void;|@ohos.application.WindowExtensionAbility.d.ts| +|新增|NA|类名:display<br>方法or属性:function getDefaultDisplaySync(): Display;|@ohos.display.d.ts| +|新增|NA|类名:display<br>方法or属性:function getAllDisplays(callback: AsyncCallback\<Array\<Display>>): void;|@ohos.display.d.ts| +|新增|NA|类名:display<br>方法or属性:function getAllDisplays(): Promise\<Array\<Display>>;|@ohos.display.d.ts| +|新增|NA|类名:display<br>方法or属性:function hasPrivateWindow(displayId: number): boolean;|@ohos.display.d.ts| +|新增|NA|模块名: ohos.display<br>类名: Rect|@ohos.display.d.ts| +|新增|NA|类名:Rect<br>方法or属性:|@ohos.display.d.ts| +|新增|NA|模块名: ohos.display<br>类名: Rect<br>方法 or 属性:left: number;|@ohos.display.d.ts| +|新增|NA|类名:Rect<br>方法or属性:left: number;|@ohos.display.d.ts| +|新增|NA|模块名: ohos.display<br>类名: Rect<br>方法 or 属性:top: number;|@ohos.display.d.ts| +|新增|NA|类名:Rect<br>方法or属性:top: number;|@ohos.display.d.ts| +|新增|NA|模块名: ohos.display<br>类名: Rect<br>方法 or 属性:width: number;|@ohos.display.d.ts| +|新增|NA|类名:Rect<br>方法or属性:width: number;|@ohos.display.d.ts| +|新增|NA|模块名: ohos.display<br>类名: Rect<br>方法 or 属性:height: number;|@ohos.display.d.ts| +|新增|NA|类名:Rect<br>方法or属性:height: number;|@ohos.display.d.ts| +|新增|NA|模块名: ohos.display<br>类名: WaterfallDisplayAreaRects|@ohos.display.d.ts| +|新增|NA|类名:WaterfallDisplayAreaRects<br>方法or属性:|@ohos.display.d.ts| +|新增|NA|模块名: ohos.display<br>类名: WaterfallDisplayAreaRects<br>方法 or 属性:readonly left: Rect;|@ohos.display.d.ts| +|新增|NA|类名:WaterfallDisplayAreaRects<br>方法or属性:readonly left: Rect;|@ohos.display.d.ts| +|新增|NA|模块名: ohos.display<br>类名: WaterfallDisplayAreaRects<br>方法 or 属性:readonly right: Rect;|@ohos.display.d.ts| +|新增|NA|类名:WaterfallDisplayAreaRects<br>方法or属性:readonly right: Rect;|@ohos.display.d.ts| +|新增|NA|模块名: ohos.display<br>类名: WaterfallDisplayAreaRects<br>方法 or 属性:readonly top: Rect;|@ohos.display.d.ts| +|新增|NA|类名:WaterfallDisplayAreaRects<br>方法or属性:readonly top: Rect;|@ohos.display.d.ts| +|新增|NA|模块名: ohos.display<br>类名: WaterfallDisplayAreaRects<br>方法 or 属性:readonly bottom: Rect;|@ohos.display.d.ts| +|新增|NA|类名:WaterfallDisplayAreaRects<br>方法or属性:readonly bottom: Rect;|@ohos.display.d.ts| +|新增|NA|模块名: ohos.display<br>类名: CutoutInfo|@ohos.display.d.ts| +|新增|NA|类名:CutoutInfo<br>方法or属性:|@ohos.display.d.ts| +|新增|NA|模块名: ohos.display<br>类名: CutoutInfo<br>方法 or 属性:readonly boundingRects: Array\<Rect>;|@ohos.display.d.ts| +|新增|NA|类名:CutoutInfo<br>方法or属性:readonly boundingRects: Array\<Rect>;|@ohos.display.d.ts| +|新增|NA|模块名: ohos.display<br>类名: CutoutInfo<br>方法 or 属性:readonly waterfallDisplayAreaRects: WaterfallDisplayAreaRects;|@ohos.display.d.ts| +|新增|NA|类名:CutoutInfo<br>方法or属性:readonly waterfallDisplayAreaRects: WaterfallDisplayAreaRects;|@ohos.display.d.ts| +|新增|NA|模块名: ohos.display<br>类名: Display<br>方法 or 属性:getCutoutInfo(callback: AsyncCallback\<CutoutInfo>): void;|@ohos.display.d.ts| +|新增|NA|类名:Display<br>方法or属性:getCutoutInfo(callback: AsyncCallback\<CutoutInfo>): void;|@ohos.display.d.ts| +|新增|NA|模块名: ohos.display<br>类名: Display<br>方法 or 属性:getCutoutInfo(): Promise\<CutoutInfo>;|@ohos.display.d.ts| +|新增|NA|类名:Display<br>方法or属性:getCutoutInfo(): Promise\<CutoutInfo>;|@ohos.display.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: screen|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: screen<br>方法 or 属性: function getAllScreens(callback: AsyncCallback\<Array\<Screen>>): void;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: screen<br>方法 or 属性: function getAllScreens(): Promise\<Array\<Screen>>;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: screen<br>方法 or 属性: function on(eventType: 'connect' \| 'disconnect' \| 'change', callback: Callback\<number>): void;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: screen<br>方法 or 属性: function on(eventType: 'connect' \| 'disconnect' \| 'change', callback: Callback\<number>): void;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: screen<br>方法 or 属性: function on(eventType: 'connect' \| 'disconnect' \| 'change', callback: Callback\<number>): void;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: screen<br>方法 or 属性: function off(eventType: 'connect' \| 'disconnect' \| 'change', callback?: Callback\<number>): void;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: screen<br>方法 or 属性: function off(eventType: 'connect' \| 'disconnect' \| 'change', callback?: Callback\<number>): void;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: screen<br>方法 or 属性: function off(eventType: 'connect' \| 'disconnect' \| 'change', callback?: Callback\<number>): void;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: screen<br>方法 or 属性: function makeExpand(options:Array\<ExpandOption>, callback: AsyncCallback\<number>): void;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: screen<br>方法 or 属性: function makeExpand(options:Array\<ExpandOption>): Promise\<number>;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: screen<br>方法 or 属性: function makeMirror(mainScreen:number, mirrorScreen:Array\<number>, callback: AsyncCallback\<number>): void;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: screen<br>方法 or 属性: function makeMirror(mainScreen:number, mirrorScreen:Array\<number>): Promise\<number>;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: screen<br>方法 or 属性: function createVirtualScreen(options:VirtualScreenOption, callback: AsyncCallback\<Screen>): void;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: screen<br>方法 or 属性: function createVirtualScreen(options:VirtualScreenOption): Promise\<Screen>;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: screen<br>方法 or 属性: function destroyVirtualScreen(screenId:number, callback: AsyncCallback\<void>): void;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: screen<br>方法 or 属性: function destroyVirtualScreen(screenId:number): Promise\<void>;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: screen<br>方法 or 属性: function setVirtualScreenSurface(screenId:number, surfaceId: string, callback: AsyncCallback\<void>): void;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: screen<br>方法 or 属性: function setVirtualScreenSurface(screenId:number, surfaceId: string): Promise\<void>;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: screen<br>方法 or 属性: function isScreenRotationLocked(callback: AsyncCallback\<boolean>): void;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: screen<br>方法 or 属性: function isScreenRotationLocked(): Promise\<boolean>;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: screen<br>方法 or 属性: function setScreenRotationLocked(isLocked:boolean, callback: AsyncCallback\<void>): void;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: screen<br>方法 or 属性: function setScreenRotationLocked(isLocked:boolean): Promise\<void>;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: ExpandOption|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: ExpandOption<br>方法 or 属性: screenId: number;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: ExpandOption<br>方法 or 属性: startX: number;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: ExpandOption<br>方法 or 属性: startY: number;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: VirtualScreenOption|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: VirtualScreenOption<br>方法 or 属性: name: string|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: VirtualScreenOption<br>方法 or 属性: width: number|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: VirtualScreenOption<br>方法 or 属性: height: number|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: VirtualScreenOption<br>方法 or 属性: density: number|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: VirtualScreenOption<br>方法 or 属性: surfaceId: string|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: Screen|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: Screen<br>方法 or 属性: readonly id: number;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: Screen<br>方法 or 属性: readonly parent: number;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: Screen<br>方法 or 属性: readonly supportedModeInfo: Array\<ScreenModeInfo>;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: Screen<br>方法 or 属性: readonly activeModeIndex: number;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: Screen<br>方法 or 属性: readonly orientation: Orientation;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: Screen<br>方法 or 属性: setOrientation(orientation: Orientation, callback: AsyncCallback\<void>): void;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: Screen<br>方法 or 属性: setOrientation(orientation: Orientation): Promise\<void>;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: Screen<br>方法 or 属性: setScreenActiveMode(modeIndex: number, callback: AsyncCallback\<void>): void;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: Screen<br>方法 or 属性: setScreenActiveMode(modeIndex: number): Promise\<void>;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: Screen<br>方法 or 属性: setDensityDpi(densityDpi: number, callback: AsyncCallback\<void>): void;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: Screen<br>方法 or 属性: setDensityDpi(densityDpi: number): Promise\<void>;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: Orientation|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: Orientation<br>方法 or 属性: UNSPECIFIED = 0|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: Orientation<br>方法 or 属性: VERTICAL = 1|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: Orientation<br>方法 or 属性: HORIZONTAL = 2|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: Orientation<br>方法 or 属性: REVERSE_VERTICAL = 3|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: Orientation<br>方法 or 属性: REVERSE_HORIZONTAL = 4|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: ScreenModeInfo|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: ScreenModeInfo<br>方法 or 属性: id: number;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: ScreenModeInfo<br>方法 or 属性: width: number;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: ScreenModeInfo<br>方法 or 属性: height: number;|@ohos.screen.d.ts| +|新增|NA|模块名: ohos.screen<br>类名: ScreenModeInfo<br>方法 or 属性: refreshRate: number;|@ohos.screen.d.ts| +|新增|NA|类名:WindowType<br>方法or属性:TYPE_INPUT_METHOD|@ohos.window.d.ts| +|新增|NA|类名:WindowType<br>方法or属性:TYPE_STATUS_BAR|@ohos.window.d.ts| +|新增|NA|类名:WindowType<br>方法or属性:TYPE_PANEL|@ohos.window.d.ts| +|新增|NA|类名:WindowType<br>方法or属性:TYPE_KEYGUARD|@ohos.window.d.ts| +|新增|NA|类名:WindowType<br>方法or属性:TYPE_VOLUME_OVERLAY|@ohos.window.d.ts| +|新增|NA|类名:WindowType<br>方法or属性:TYPE_NAVIGATION_BAR|@ohos.window.d.ts| +|新增|NA|类名:WindowType<br>方法or属性:TYPE_FLOAT|@ohos.window.d.ts| +|新增|NA|类名:WindowType<br>方法or属性:TYPE_WALLPAPER|@ohos.window.d.ts| +|新增|NA|类名:WindowType<br>方法or属性:TYPE_DESKTOP|@ohos.window.d.ts| +|新增|NA|类名:WindowType<br>方法or属性:TYPE_LAUNCHER_RECENT|@ohos.window.d.ts| +|新增|NA|类名:WindowType<br>方法or属性:TYPE_LAUNCHER_DOCK|@ohos.window.d.ts| +|新增|NA|类名:WindowType<br>方法or属性:TYPE_VOICE_INTERACTION|@ohos.window.d.ts| +|新增|NA|类名:WindowType<br>方法or属性:TYPE_POINTER|@ohos.window.d.ts| +|新增|NA|类名:WindowType<br>方法or属性:TYPE_FLOAT_CAMERA|@ohos.window.d.ts| +|新增|NA|类名:WindowType<br>方法or属性:TYPE_DIALOG|@ohos.window.d.ts| +|新增|NA|类名:WindowType<br>方法or属性:TYPE_SCREENSHOT|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: AvoidAreaType<br>方法 or 属性:TYPE_SYSTEM_GESTURE|@ohos.window.d.ts| +|新增|NA|类名:AvoidAreaType<br>方法or属性:TYPE_SYSTEM_GESTURE|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: AvoidAreaType<br>方法 or 属性:TYPE_KEYBOARD|@ohos.window.d.ts| +|新增|NA|类名:AvoidAreaType<br>方法or属性:TYPE_KEYBOARD|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: WindowLayoutMode|@ohos.window.d.ts| +|新增|NA|类名:WindowLayoutMode<br>方法or属性:|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: WindowLayoutMode<br>方法 or 属性:WINDOW_LAYOUT_MODE_CASCADE|@ohos.window.d.ts| +|新增|NA|类名:WindowLayoutMode<br>方法or属性:WINDOW_LAYOUT_MODE_CASCADE|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: WindowLayoutMode<br>方法 or 属性:WINDOW_LAYOUT_MODE_TILE|@ohos.window.d.ts| +|新增|NA|类名:WindowLayoutMode<br>方法or属性:WINDOW_LAYOUT_MODE_TILE|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: AvoidArea<br>方法 or 属性:visible: boolean;|@ohos.window.d.ts| +|新增|NA|类名:AvoidArea<br>方法or属性:visible: boolean;|@ohos.window.d.ts| +|新增|NA|类名:WindowProperties<br>方法or属性:id: number|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: ScaleOptions|@ohos.window.d.ts| +|新增|NA|类名:ScaleOptions<br>方法or属性:|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: ScaleOptions<br>方法 or 属性:x?: number;|@ohos.window.d.ts| +|新增|NA|类名:ScaleOptions<br>方法or属性:x?: number;|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: ScaleOptions<br>方法 or 属性:y?: number;|@ohos.window.d.ts| +|新增|NA|类名:ScaleOptions<br>方法or属性:y?: number;|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: ScaleOptions<br>方法 or 属性:pivotX?: number;|@ohos.window.d.ts| +|新增|NA|类名:ScaleOptions<br>方法or属性:pivotX?: number;|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: ScaleOptions<br>方法 or 属性:pivotY?: number;|@ohos.window.d.ts| +|新增|NA|类名:ScaleOptions<br>方法or属性:pivotY?: number;|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: RotateOptions|@ohos.window.d.ts| +|新增|NA|类名:RotateOptions<br>方法or属性:|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: RotateOptions<br>方法 or 属性:x?: number;|@ohos.window.d.ts| +|新增|NA|类名:RotateOptions<br>方法or属性:x?: number;|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: RotateOptions<br>方法 or 属性:y?: number;|@ohos.window.d.ts| +|新增|NA|类名:RotateOptions<br>方法or属性:y?: number;|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: RotateOptions<br>方法 or 属性:z?: number;|@ohos.window.d.ts| +|新增|NA|类名:RotateOptions<br>方法or属性:z?: number;|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: RotateOptions<br>方法 or 属性:pivotX?: number;|@ohos.window.d.ts| +|新增|NA|类名:RotateOptions<br>方法or属性:pivotX?: number;|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: RotateOptions<br>方法 or 属性:pivotY?: number;|@ohos.window.d.ts| +|新增|NA|类名:RotateOptions<br>方法or属性:pivotY?: number;|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: TranslateOptions|@ohos.window.d.ts| +|新增|NA|类名:TranslateOptions<br>方法or属性:|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: TranslateOptions<br>方法 or 属性:x?: number;|@ohos.window.d.ts| +|新增|NA|类名:TranslateOptions<br>方法or属性:x?: number;|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: TranslateOptions<br>方法 or 属性:y?: number;|@ohos.window.d.ts| +|新增|NA|类名:TranslateOptions<br>方法or属性:y?: number;|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: TranslateOptions<br>方法 or 属性:z?: number;|@ohos.window.d.ts| +|新增|NA|类名:TranslateOptions<br>方法or属性:z?: number;|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: TransitionContext|@ohos.window.d.ts| +|新增|NA|类名:TransitionContext<br>方法or属性:|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: TransitionContext<br>方法 or 属性:toWindow: Window|@ohos.window.d.ts| +|新增|NA|类名:TransitionContext<br>方法or属性:toWindow: Window|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: TransitionContext<br>方法 or 属性:completeTransition(isCompleted: boolean): void;|@ohos.window.d.ts| +|新增|NA|类名:TransitionContext<br>方法or属性:completeTransition(isCompleted: boolean): void;|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: TransitionController|@ohos.window.d.ts| +|新增|NA|类名:TransitionController<br>方法or属性:|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: TransitionController<br>方法 or 属性:animationForShown(context: TransitionContext): void;|@ohos.window.d.ts| +|新增|NA|类名:TransitionController<br>方法or属性:animationForShown(context: TransitionContext): void;|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: TransitionController<br>方法 or 属性:animationForHidden(context: TransitionContext): void;|@ohos.window.d.ts| +|新增|NA|类名:TransitionController<br>方法or属性:animationForHidden(context: TransitionContext): void;|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: Configuration|@ohos.window.d.ts| +|新增|NA|类名:Configuration<br>方法or属性:|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: Configuration<br>方法 or 属性:name: string|@ohos.window.d.ts| +|新增|NA|类名:Configuration<br>方法or属性:name: string|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: Configuration<br>方法 or 属性:windowType: WindowType|@ohos.window.d.ts| +|新增|NA|类名:Configuration<br>方法or属性:windowType: WindowType|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: Configuration<br>方法 or 属性:ctx?: BaseContext|@ohos.window.d.ts| +|新增|NA|类名:Configuration<br>方法or属性:ctx?: BaseContext|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: Configuration<br>方法 or 属性:displayId?: number|@ohos.window.d.ts| +|新增|NA|类名:Configuration<br>方法or属性:displayId?: number|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: Configuration<br>方法 or 属性:parentId?: number|@ohos.window.d.ts| +|新增|NA|类名:Configuration<br>方法or属性:parentId?: number|@ohos.window.d.ts| +|新增|NA|类名:window<br>方法or属性:function createWindow(config: Configuration, callback: AsyncCallback\<Window>): void;|@ohos.window.d.ts| +|新增|NA|类名:window<br>方法or属性:function createWindow(config: Configuration): Promise\<Window>;|@ohos.window.d.ts| +|新增|NA|类名:window<br>方法or属性:function findWindow(name: string): Window;|@ohos.window.d.ts| +|新增|NA|类名:window<br>方法or属性:function getLastWindow(ctx: BaseContext, callback: AsyncCallback\<Window>): void;|@ohos.window.d.ts| +|新增|NA|类名:window<br>方法or属性:function getLastWindow(ctx: BaseContext): Promise\<Window>;|@ohos.window.d.ts| +|新增|NA|类名:window<br>方法or属性:function minimizeAll(id: number, callback: AsyncCallback\<void>): void;|@ohos.window.d.ts| +|新增|NA|类名:window<br>方法or属性:function minimizeAll(id: number): Promise\<void>;|@ohos.window.d.ts| +|新增|NA|类名:window<br>方法or属性:function toggleShownStateForAllAppWindows(callback: AsyncCallback\<void>): void;|@ohos.window.d.ts| +|新增|NA|类名:window<br>方法or属性:function toggleShownStateForAllAppWindows(): Promise\<void>;|@ohos.window.d.ts| +|新增|NA|类名:window<br>方法or属性:function setWindowLayoutMode(mode: WindowLayoutMode, callback: AsyncCallback\<void>): void;|@ohos.window.d.ts| +|新增|NA|类名:window<br>方法or属性:function setWindowLayoutMode(mode: WindowLayoutMode): Promise\<void>;|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: Orientation|@ohos.window.d.ts| +|新增|NA|类名:Orientation<br>方法or属性:|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: Orientation<br>方法 or 属性:UNSPECIFIED = 0|@ohos.window.d.ts| +|新增|NA|类名:Orientation<br>方法or属性:UNSPECIFIED = 0|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: Orientation<br>方法 or 属性:PORTRAIT = 1|@ohos.window.d.ts| +|新增|NA|类名:Orientation<br>方法or属性:PORTRAIT = 1|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: Orientation<br>方法 or 属性:LANDSCAPE = 2|@ohos.window.d.ts| +|新增|NA|类名:Orientation<br>方法or属性:LANDSCAPE = 2|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: Orientation<br>方法 or 属性:PORTRAIT_INVERTED = 3|@ohos.window.d.ts| +|新增|NA|类名:Orientation<br>方法or属性:PORTRAIT_INVERTED = 3|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: Orientation<br>方法 or 属性:LANDSCAPE_INVERTED = 4|@ohos.window.d.ts| +|新增|NA|类名:Orientation<br>方法or属性:LANDSCAPE_INVERTED = 4|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: Orientation<br>方法 or 属性:AUTO_ROTATION = 5|@ohos.window.d.ts| +|新增|NA|类名:Orientation<br>方法or属性:AUTO_ROTATION = 5|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: Orientation<br>方法 or 属性:AUTO_ROTATION_PORTRAIT = 6|@ohos.window.d.ts| +|新增|NA|类名:Orientation<br>方法or属性:AUTO_ROTATION_PORTRAIT = 6|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: Orientation<br>方法 or 属性:AUTO_ROTATION_LANDSCAPE = 7|@ohos.window.d.ts| +|新增|NA|类名:Orientation<br>方法or属性:AUTO_ROTATION_LANDSCAPE = 7|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: Orientation<br>方法 or 属性:AUTO_ROTATION_RESTRICTED = 8|@ohos.window.d.ts| +|新增|NA|类名:Orientation<br>方法or属性:AUTO_ROTATION_RESTRICTED = 8|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: Orientation<br>方法 or 属性:AUTO_ROTATION_PORTRAIT_RESTRICTED = 9|@ohos.window.d.ts| +|新增|NA|类名:Orientation<br>方法or属性:AUTO_ROTATION_PORTRAIT_RESTRICTED = 9|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: Orientation<br>方法 or 属性:AUTO_ROTATION_LANDSCAPE_RESTRICTED = 10|@ohos.window.d.ts| +|新增|NA|类名:Orientation<br>方法or属性:AUTO_ROTATION_LANDSCAPE_RESTRICTED = 10|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: Orientation<br>方法 or 属性:LOCKED = 11|@ohos.window.d.ts| +|新增|NA|类名:Orientation<br>方法or属性:LOCKED = 11|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: BlurStyle|@ohos.window.d.ts| +|新增|NA|类名:BlurStyle<br>方法or属性:|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: BlurStyle<br>方法 or 属性:OFF|@ohos.window.d.ts| +|新增|NA|类名:BlurStyle<br>方法or属性:OFF|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: BlurStyle<br>方法 or 属性:THIN|@ohos.window.d.ts| +|新增|NA|类名:BlurStyle<br>方法or属性:THIN|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: BlurStyle<br>方法 or 属性:REGULAR|@ohos.window.d.ts| +|新增|NA|类名:BlurStyle<br>方法or属性:REGULAR|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: BlurStyle<br>方法 or 属性:THICK|@ohos.window.d.ts| +|新增|NA|类名:BlurStyle<br>方法or属性:THICK|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:hideWithAnimation(callback: AsyncCallback\<void>): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:hideWithAnimation(): Promise\<void>;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:showWindow(callback: AsyncCallback\<void>): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:showWindow(): Promise\<void>;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:showWithAnimation(callback: AsyncCallback\<void>): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:showWithAnimation(): Promise\<void>;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:destroyWindow(callback: AsyncCallback\<void>): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:destroyWindow(): Promise\<void>;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:moveWindowTo(x: number, y: number): Promise\<void>;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:moveWindowTo(x: number, y: number, callback: AsyncCallback\<void>): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:resize(width: number, height: number): Promise\<void>;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:resize(width: number, height: number, callback: AsyncCallback\<void>): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setWindowMode(mode: WindowMode): Promise\<void>;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setWindowMode(mode: WindowMode, callback: AsyncCallback\<void>): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:getWindowProperties(): WindowProperties;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:getWindowAvoidArea(type: AvoidAreaType): AvoidArea;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setWindowLayoutFullScreen(isLayoutFullScreen: boolean, callback: AsyncCallback\<void>): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setWindowLayoutFullScreen(isLayoutFullScreen: boolean): Promise\<void>;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setWindowSystemBarEnable(names: Array\<'status'\|'navigation'>, callback: AsyncCallback\<void>): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setWindowSystemBarEnable(names: Array\<'status'\|'navigation'>): Promise\<void>;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setWindowSystemBarProperties(systemBarProperties: SystemBarProperties, callback: AsyncCallback\<void>): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setWindowSystemBarProperties(systemBarProperties: SystemBarProperties): Promise\<void>;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setPreferredOrientation(orientation: Orientation): Promise\<void>;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setPreferredOrientation(orientation: Orientation, callback: AsyncCallback\<void>): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setUIContent(path: string, callback: AsyncCallback\<void>): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setUIContent(path: string): Promise\<void>;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:isWindowShowing(): boolean;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:on(type: 'avoidAreaChange', callback: Callback\<{ type: AvoidAreaType, area: AvoidArea }>): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:off(type: 'avoidAreaChange', callback?: Callback\<{ type: AvoidAreaType, area: AvoidArea }>): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:on(type: 'touchOutside', callback: Callback\<void>): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:off(type: 'touchOutside', callback?: Callback\<void>): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:on(type: 'screenshot', callback: Callback\<void>): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:off(type: 'screenshot', callback?: Callback\<void>): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:bindDialogTarget(token: rpc.RemoteObject, deathCallback: Callback\<void>): Promise\<void>;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:bindDialogTarget(token: rpc.RemoteObject, deathCallback: Callback\<void>, callback: AsyncCallback\<void>): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:bindDialogTarget(requestInfo: dialogRequest.RequestInfo, deathCallback: Callback\<void>): Promise\<void>;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:bindDialogTarget(requestInfo: dialogRequest.RequestInfo, deathCallback: Callback\<void>, callback: AsyncCallback\<void>): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:isWindowSupportWideGamut(): Promise\<boolean>;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:isWindowSupportWideGamut(callback: AsyncCallback\<boolean>): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setWindowColorSpace(colorSpace:ColorSpace): Promise\<void>;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setWindowColorSpace(colorSpace:ColorSpace, callback: AsyncCallback\<void>): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:getWindowColorSpace(): ColorSpace;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setWindowBackgroundColor(color: string): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setWindowBrightness(brightness: number): Promise\<void>;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setWindowBrightness(brightness: number, callback: AsyncCallback\<void>): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setWindowFocusable(isFocusable: boolean): Promise\<void>;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setWindowFocusable(isFocusable: boolean, callback: AsyncCallback\<void>): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setWindowKeepScreenOn(isKeepScreenOn: boolean): Promise\<void>;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setWindowKeepScreenOn(isKeepScreenOn: boolean, callback: AsyncCallback\<void>): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setWakeUpScreen(wakeUp: boolean): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setWindowPrivacyMode(isPrivacyMode: boolean): Promise\<void>;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setWindowPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback\<void>): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setSnapshotSkip(isSkip: boolean): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setWindowTouchable(isTouchable: boolean): Promise\<void>;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setWindowTouchable(isTouchable: boolean, callback: AsyncCallback\<void>): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setForbidSplitMove(isForbidSplitMove: boolean, callback: AsyncCallback\<void>): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setForbidSplitMove(isForbidSplitMove: boolean): Promise\<void>;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:snapshot(callback: AsyncCallback\<image.PixelMap>): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:snapshot(): Promise\<image.PixelMap>;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:opacity(opacity: number): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:scale(scaleOptions: ScaleOptions): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:rotate(rotateOptions: RotateOptions): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:translate(translateOptions: TranslateOptions): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:getTransitionController(): TransitionController;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setBlur(radius: number): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setBackdropBlur(radius: number): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setBackdropBlurStyle(blurStyle: BlurStyle): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setShadow(radius: number, color?: string, offsetX?: number, offsetY?: number): void;|@ohos.window.d.ts| +|新增|NA|类名:Window<br>方法or属性:setCornerRadius(cornerRadius: number): void;|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: WindowStageEventType|@ohos.window.d.ts| +|新增|NA|类名:WindowStageEventType<br>方法or属性:|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: WindowStageEventType<br>方法 or 属性:SHOWN = 1|@ohos.window.d.ts| +|新增|NA|类名:WindowStageEventType<br>方法or属性:SHOWN = 1|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: WindowStageEventType<br>方法 or 属性:ACTIVE|@ohos.window.d.ts| +|新增|NA|类名:WindowStageEventType<br>方法or属性:ACTIVE|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: WindowStageEventType<br>方法 or 属性:INACTIVE|@ohos.window.d.ts| +|新增|NA|类名:WindowStageEventType<br>方法or属性:INACTIVE|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: WindowStageEventType<br>方法 or 属性:HIDDEN|@ohos.window.d.ts| +|新增|NA|类名:WindowStageEventType<br>方法or属性:HIDDEN|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: WindowStage|@ohos.window.d.ts| +|新增|NA|类名:WindowStage<br>方法or属性:|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: WindowStage<br>方法 or 属性:getMainWindow(): Promise\<Window>;|@ohos.window.d.ts| +|新增|NA|类名:WindowStage<br>方法or属性:getMainWindow(): Promise\<Window>;|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: WindowStage<br>方法 or 属性:getMainWindow(callback: AsyncCallback\<Window>): void;|@ohos.window.d.ts| +|新增|NA|类名:WindowStage<br>方法or属性:getMainWindow(callback: AsyncCallback\<Window>): void;|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: WindowStage<br>方法 or 属性:getMainWindowSync(): Window;|@ohos.window.d.ts| +|新增|NA|类名:WindowStage<br>方法or属性:getMainWindowSync(): Window;|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: WindowStage<br>方法 or 属性:createSubWindow(name: string): Promise\<Window>;|@ohos.window.d.ts| +|新增|NA|类名:WindowStage<br>方法or属性:createSubWindow(name: string): Promise\<Window>;|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: WindowStage<br>方法 or 属性:createSubWindow(name: string, callback: AsyncCallback\<Window>): void;|@ohos.window.d.ts| +|新增|NA|类名:WindowStage<br>方法or属性:createSubWindow(name: string, callback: AsyncCallback\<Window>): void;|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: WindowStage<br>方法 or 属性:getSubWindow(): Promise\<Array\<Window>>;|@ohos.window.d.ts| +|新增|NA|类名:WindowStage<br>方法or属性:getSubWindow(): Promise\<Array\<Window>>;|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: WindowStage<br>方法 or 属性:getSubWindow(callback: AsyncCallback\<Array\<Window>>): void;|@ohos.window.d.ts| +|新增|NA|类名:WindowStage<br>方法or属性:getSubWindow(callback: AsyncCallback\<Array\<Window>>): void;|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: WindowStage<br>方法 or 属性:loadContent(path: string, storage: LocalStorage, callback: AsyncCallback\<void>): void;|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: WindowStage<br>方法 or 属性:loadContent(path: string, storage?: LocalStorage): Promise\<void>;|@ohos.window.d.ts| +|新增|NA|类名:WindowStage<br>方法or属性:loadContent(path: string, storage?: LocalStorage): Promise\<void>;|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: WindowStage<br>方法 or 属性:loadContent(path: string, callback: AsyncCallback\<void>): void;|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: WindowStage<br>方法 or 属性:on(eventType: 'windowStageEvent', callback: Callback\<WindowStageEventType>): void;|@ohos.window.d.ts| +|新增|NA|类名:WindowStage<br>方法or属性:on(eventType: 'windowStageEvent', callback: Callback\<WindowStageEventType>): void;|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: WindowStage<br>方法 or 属性:off(eventType: 'windowStageEvent', callback?: Callback\<WindowStageEventType>): void;|@ohos.window.d.ts| +|新增|NA|类名:WindowStage<br>方法or属性:off(eventType: 'windowStageEvent', callback?: Callback\<WindowStageEventType>): void;|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: WindowStage<br>方法 or 属性:disableWindowDecor(): void;|@ohos.window.d.ts| +|新增|NA|类名:WindowStage<br>方法or属性:disableWindowDecor(): void;|@ohos.window.d.ts| +|新增|NA|模块名: ohos.window<br>类名: WindowStage<br>方法 or 属性:setShowOnLockScreen(showOnLockScreen: boolean): void;|@ohos.window.d.ts| +|新增|NA|类名:WindowStage<br>方法or属性:setShowOnLockScreen(showOnLockScreen: boolean): void;|@ohos.window.d.ts| +|新增|NA|模块名: WindowExtensionContext<br>类名: WindowExtensionContext|WindowExtensionContext.d.ts| +|新增|NA|模块名: WindowExtensionContext<br>类名: WindowExtensionContext<br>方法 or 属性: startAbility(want: Want, options: StartOptions, callback: AsyncCallback\<void>): void;|WindowExtensionContext.d.ts| +|新增|NA|模块名: WindowExtensionContext<br>类名: WindowExtensionContext<br>方法 or 属性: startAbility(want: Want, options?: StartOptions): Promise\<void>;|WindowExtensionContext.d.ts| +|model有变化|类名:WindowType<br>方法 or 属性:TYPE_APP<br>model:N/A|类名:WindowType<br>方法 or 属性:TYPE_APP<br>model:@FAModelOnly|@ohos.window.d.ts| +|model有变化|类名:window<br>方法 or 属性:function create(id: string, type: WindowType, callback: AsyncCallback\<Window>): void;<br>model:N/A|类名:window<br>方法 or 属性:function create(id: string, type: WindowType, callback: AsyncCallback\<Window>): void;<br>model:@FAModelOnly|@ohos.window.d.ts| +|model有变化|类名:window<br>方法 or 属性:function create(id: string, type: WindowType): Promise\<Window>;<br>model:N/A|类名:window<br>方法 or 属性:function create(id: string, type: WindowType): Promise\<Window>;<br>model:@FAModelOnly|@ohos.window.d.ts| +|model有变化|类名:window<br>方法 or 属性:function getTopWindow(callback: AsyncCallback\<Window>): void;<br>model:N/A|类名:window<br>方法 or 属性:function getTopWindow(callback: AsyncCallback\<Window>): void;<br>model:@FAModelOnly|@ohos.window.d.ts| +|model有变化|类名:window<br>方法 or 属性:function getTopWindow(): Promise\<Window>;<br>model:N/A|类名:window<br>方法 or 属性:function getTopWindow(): Promise\<Window>;<br>model:@FAModelOnly|@ohos.window.d.ts| +|废弃版本有变化|类名:display<br>方法 or 属性:function getDefaultDisplay(callback: AsyncCallback\<Display>): void;<br>废弃版本:N/A|类名:display<br>方法 or 属性:function getDefaultDisplay(callback: AsyncCallback\<Display>): void;<br>废弃版本:9<br>代替接口:ohos.display|@ohos.display.d.ts| +|废弃版本有变化|类名:display<br>方法 or 属性:function getDefaultDisplay(): Promise\<Display>;<br>废弃版本:N/A|类名:display<br>方法 or 属性:function getDefaultDisplay(): Promise\<Display>;<br>废弃版本:9<br>代替接口:ohos.display|@ohos.display.d.ts| +|废弃版本有变化|类名:display<br>方法 or 属性:function getAllDisplay(callback: AsyncCallback\<Array\<Display>>): void;<br>废弃版本:N/A|类名:display<br>方法 or 属性:function getAllDisplay(callback: AsyncCallback\<Array\<Display>>): void;<br>废弃版本:9<br>代替接口:ohos.display|@ohos.display.d.ts| +|废弃版本有变化|类名:display<br>方法 or 属性:function getAllDisplay(): Promise\<Array\<Display>>;<br>废弃版本:N/A|类名:display<br>方法 or 属性:function getAllDisplay(): Promise\<Array\<Display>>;<br>废弃版本:9<br>代替接口:ohos.display|@ohos.display.d.ts| +|废弃版本有变化|类名:WindowProperties<br>方法 or 属性:dimBehindValue: number<br>废弃版本:N/A|类名:WindowProperties<br>方法 or 属性:dimBehindValue: number<br>废弃版本:9<br>代替接口:N/A|@ohos.window.d.ts| +|废弃版本有变化|类名:WindowProperties<br>方法 or 属性:isRoundCorner: boolean<br>废弃版本:N/A|类名:WindowProperties<br>方法 or 属性:isRoundCorner: boolean<br>废弃版本:9<br>代替接口:N/A|@ohos.window.d.ts| +|废弃版本有变化|类名:window<br>方法 or 属性:function create(id: string, type: WindowType, callback: AsyncCallback\<Window>): void;<br>废弃版本:N/A|类名:window<br>方法 or 属性:function create(id: string, type: WindowType, callback: AsyncCallback\<Window>): void;<br>废弃版本:9<br>代替接口:ohos.window|@ohos.window.d.ts| +|废弃版本有变化|类名:window<br>方法 or 属性:function create(id: string, type: WindowType): Promise\<Window>;<br>废弃版本:N/A|类名:window<br>方法 or 属性:function create(id: string, type: WindowType): Promise\<Window>;<br>废弃版本:9<br>代替接口:ohos.window|@ohos.window.d.ts| +|废弃版本有变化|类名:window<br>方法 or 属性:function find(id: string, callback: AsyncCallback\<Window>): void;<br>废弃版本:N/A|类名:window<br>方法 or 属性:function find(id: string, callback: AsyncCallback\<Window>): void;<br>废弃版本:9<br>代替接口:ohos.window|@ohos.window.d.ts| +|废弃版本有变化|类名:window<br>方法 or 属性:function find(id: string): Promise\<Window>;<br>废弃版本:N/A|类名:window<br>方法 or 属性:function find(id: string): Promise\<Window>;<br>废弃版本:9<br>代替接口:ohos.window|@ohos.window.d.ts| +|废弃版本有变化|类名:window<br>方法 or 属性:function getTopWindow(callback: AsyncCallback\<Window>): void;<br>废弃版本:N/A|类名:window<br>方法 or 属性:function getTopWindow(callback: AsyncCallback\<Window>): void;<br>废弃版本:9<br>代替接口:ohos.window|@ohos.window.d.ts| +|废弃版本有变化|类名:window<br>方法 or 属性:function getTopWindow(): Promise\<Window>;<br>废弃版本:N/A|类名:window<br>方法 or 属性:function getTopWindow(): Promise\<Window>;<br>废弃版本:9<br>代替接口:ohos.window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:show(callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:show(callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:show(): Promise\<void>;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:show(): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:destroy(callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:destroy(callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:destroy(): Promise\<void>;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:destroy(): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:moveTo(x: number, y: number): Promise\<void>;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:moveTo(x: number, y: number): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:moveTo(x: number, y: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:moveTo(x: number, y: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:resetSize(width: number, height: number): Promise\<void>;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:resetSize(width: number, height: number): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:resetSize(width: number, height: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:resetSize(width: number, height: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:setWindowType(type: WindowType): Promise\<void>;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:setWindowType(type: WindowType): Promise\<void>;<br>废弃版本:9<br>代替接口:N/A|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:setWindowType(type: WindowType, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:setWindowType(type: WindowType, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:getProperties(callback: AsyncCallback\<WindowProperties>): void;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:getProperties(callback: AsyncCallback\<WindowProperties>): void;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:getProperties(): Promise\<WindowProperties>;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:getProperties(): Promise\<WindowProperties>;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:getAvoidArea(type: AvoidAreaType, callback: AsyncCallback\<AvoidArea>): void;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:getAvoidArea(type: AvoidAreaType, callback: AsyncCallback\<AvoidArea>): void;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:getAvoidArea(type: AvoidAreaType): Promise\<AvoidArea>;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:getAvoidArea(type: AvoidAreaType): Promise\<AvoidArea>;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:setFullScreen(isFullScreen: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:setFullScreen(isFullScreen: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:setFullScreen(isFullScreen: boolean): Promise\<void>;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:setFullScreen(isFullScreen: boolean): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:setLayoutFullScreen(isLayoutFullScreen: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:setLayoutFullScreen(isLayoutFullScreen: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:setLayoutFullScreen(isLayoutFullScreen: boolean): Promise\<void>;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:setLayoutFullScreen(isLayoutFullScreen: boolean): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:setSystemBarEnable(names: Array\<'status'\|'navigation'>, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:setSystemBarEnable(names: Array\<'status'\|'navigation'>, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:setSystemBarEnable(names: Array\<'status'\|'navigation'>): Promise\<void>;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:setSystemBarEnable(names: Array\<'status'\|'navigation'>): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:setSystemBarProperties(systemBarProperties: SystemBarProperties, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:setSystemBarProperties(systemBarProperties: SystemBarProperties, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:setSystemBarProperties(systemBarProperties: SystemBarProperties): Promise\<void>;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:setSystemBarProperties(systemBarProperties: SystemBarProperties): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:loadContent(path: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:loadContent(path: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:loadContent(path: string): Promise\<void>;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:loadContent(path: string): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:isShowing(callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:isShowing(callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:isShowing(): Promise\<boolean>;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:isShowing(): Promise\<boolean>;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:on(type: 'systemAvoidAreaChange', callback: Callback\<AvoidArea>): void;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:on(type: 'systemAvoidAreaChange', callback: Callback\<AvoidArea>): void;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:off(type: 'systemAvoidAreaChange', callback?: Callback\<AvoidArea>): void;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:off(type: 'systemAvoidAreaChange', callback?: Callback\<AvoidArea>): void;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:isSupportWideGamut(): Promise\<boolean>;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:isSupportWideGamut(): Promise\<boolean>;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:isSupportWideGamut(callback: AsyncCallback\<boolean>): void;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:isSupportWideGamut(callback: AsyncCallback\<boolean>): void;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:setColorSpace(colorSpace:ColorSpace): Promise\<void>;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:setColorSpace(colorSpace:ColorSpace): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:setColorSpace(colorSpace:ColorSpace, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:setColorSpace(colorSpace:ColorSpace, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:getColorSpace(): Promise\<ColorSpace>;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:getColorSpace(): Promise\<ColorSpace>;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:getColorSpace(callback: AsyncCallback\<ColorSpace>): void;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:getColorSpace(callback: AsyncCallback\<ColorSpace>): void;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:setBackgroundColor(color: string): Promise\<void>;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:setBackgroundColor(color: string): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:setBackgroundColor(color: string, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:setBackgroundColor(color: string, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:setBrightness(brightness: number): Promise\<void>;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:setBrightness(brightness: number): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:setBrightness(brightness: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:setBrightness(brightness: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:setDimBehind(dimBehindValue: number, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:setDimBehind(dimBehindValue: number, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:setDimBehind(dimBehindValue: number): Promise\<void>;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:setDimBehind(dimBehindValue: number): Promise\<void>;<br>废弃版本:9<br>代替接口:N/A|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:setFocusable(isFocusable: boolean): Promise\<void>;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:setFocusable(isFocusable: boolean): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:setFocusable(isFocusable: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:setFocusable(isFocusable: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:setKeepScreenOn(isKeepScreenOn: boolean): Promise\<void>;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:setKeepScreenOn(isKeepScreenOn: boolean): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:setKeepScreenOn(isKeepScreenOn: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:setKeepScreenOn(isKeepScreenOn: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:setOutsideTouchable(touchable: boolean): Promise\<void>;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:setOutsideTouchable(touchable: boolean): Promise\<void>;<br>废弃版本:9<br>代替接口:N/A|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:setOutsideTouchable(touchable: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:setOutsideTouchable(touchable: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:N/A|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:setPrivacyMode(isPrivacyMode: boolean): Promise\<void>;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:setPrivacyMode(isPrivacyMode: boolean): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:setPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:setPrivacyMode(isPrivacyMode: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:setTouchable(isTouchable: boolean): Promise\<void>;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:setTouchable(isTouchable: boolean): Promise\<void>;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|废弃版本有变化|类名:Window<br>方法 or 属性:setTouchable(isTouchable: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:N/A|类名:Window<br>方法 or 属性:setTouchable(isTouchable: boolean, callback: AsyncCallback\<void>): void;<br>废弃版本:9<br>代替接口:ohos.window.Window|@ohos.window.d.ts| +|新增(错误码)|NA|类名:display<br>方法 or 属性:function on(type: 'add' \| 'remove' \| 'change', callback: Callback\<number>): void;<br>错误码内容: 401|@ohos.display.d.ts| +|新增(错误码)|NA|类名:display<br>方法 or 属性:function on(type: 'add' \| 'remove' \| 'change', callback: Callback\<number>): void;<br>错误码内容: 401|@ohos.display.d.ts| +|新增(错误码)|NA|类名:display<br>方法 or 属性:function on(type: 'add' \| 'remove' \| 'change', callback: Callback\<number>): void;<br>错误码内容: 401|@ohos.display.d.ts| +|新增(错误码)|NA|类名:display<br>方法 or 属性:function off(type: 'add' \| 'remove' \| 'change', callback?: Callback\<number>): void;<br>错误码内容: 401|@ohos.display.d.ts| +|新增(错误码)|NA|类名:display<br>方法 or 属性:function off(type: 'add' \| 'remove' \| 'change', callback?: Callback\<number>): void;<br>错误码内容: 401|@ohos.display.d.ts| +|新增(错误码)|NA|类名:display<br>方法 or 属性:function off(type: 'add' \| 'remove' \| 'change', callback?: Callback\<number>): void;<br>错误码内容: 401|@ohos.display.d.ts| +|新增(错误码)|NA|类名:screenshot<br>方法 or 属性:function save(options?: ScreenshotOptions): Promise\<image.PixelMap>;<br>错误码内容: 201, 401|@ohos.screenshot.d.ts| +|新增(错误码)|NA|类名:window<br>方法 or 属性:function on(type: 'systemBarTintChange', callback: Callback\<SystemBarTintState>): void;<br>错误码内容: 401|@ohos.window.d.ts| +|新增(错误码)|NA|类名:window<br>方法 or 属性:function off(type: 'systemBarTintChange', callback?: Callback\<SystemBarTintState>): void;<br>错误码内容: 401|@ohos.window.d.ts| +|新增(错误码)|NA|类名:Window<br>方法 or 属性:hide (callback: AsyncCallback\<void>): void;<br>错误码内容: 1300002|@ohos.window.d.ts| +|新增(错误码)|NA|类名:Window<br>方法 or 属性:hide(): Promise\<void>;<br>错误码内容: 1300002|@ohos.window.d.ts| +|新增(错误码)|NA|类名:Window<br>方法 or 属性:on(type: 'windowSizeChange', callback: Callback\<Size>): void;<br>错误码内容: 401|@ohos.window.d.ts| +|新增(错误码)|NA|类名:Window<br>方法 or 属性:off(type: 'windowSizeChange', callback?: Callback\<Size>): void;<br>错误码内容: 401|@ohos.window.d.ts| +|新增(错误码)|NA|类名:Window<br>方法 or 属性:on(type: 'keyboardHeightChange', callback: Callback\<number>): void;<br>错误码内容: 401|@ohos.window.d.ts| +|新增(错误码)|NA|类名:Window<br>方法 or 属性:off(type: 'keyboardHeightChange', callback?: Callback\<number>): void;<br>错误码内容: 401|@ohos.window.d.ts| +|函数有变化|类名:screenshot<br>方法 or 属性:function save(options?: ScreenshotOptions, callback: AsyncCallback\<image.PixelMap>): void;<br>|类名:screenshot<br>方法 or 属性:function save(options: ScreenshotOptions, callback: AsyncCallback\<image.PixelMap>): void;<br>|@ohos.screenshot.d.ts| +|函数有变化|类名:screenshot<br>方法 or 属性:function save(options?: ScreenshotOptions, callback: AsyncCallback\<image.PixelMap>): void;<br>|类名:screenshot<br>方法 or 属性:function save(callback: AsyncCallback\<image.PixelMap>): void;<br>|@ohos.screenshot.d.ts| +|函数有变化|类名:window<br>方法 or 属性:function create(id: string, type: WindowType, callback: AsyncCallback\<Window>): void;<br>|类名:window<br>方法 or 属性:function create(id: string, type: WindowType, callback: AsyncCallback\<Window>): void;<br>|@ohos.window.d.ts| +|函数有变化|类名:window<br>方法 or 属性:function create(ctx: Context, id: string, type: WindowType, callback: AsyncCallback\<Window>): void;<br>|类名:window<br>方法 or 属性:function create(id: string, type: WindowType, callback: AsyncCallback\<Window>): void;<br>|@ohos.window.d.ts| +|函数有变化|类名:window<br>方法 or 属性:function create(id: string, type: WindowType): Promise\<Window>;<br>|类名:window<br>方法 or 属性:function create(id: string, type: WindowType): Promise\<Window>;<br>|@ohos.window.d.ts| +|函数有变化|类名:window<br>方法 or 属性:function create(ctx: Context, id: string, type: WindowType): Promise\<Window>;<br>|类名:window<br>方法 or 属性:function create(id: string, type: WindowType): Promise\<Window>;<br>|@ohos.window.d.ts| +|函数有变化|类名:window<br>方法 or 属性:function create(id: string, type: WindowType): Promise\<Window>;<br>|类名:window<br>方法 or 属性:function create(ctx: BaseContext, id: string, type: WindowType): Promise\<Window>;<br>|@ohos.window.d.ts| +|函数有变化|类名:window<br>方法 or 属性:function create(ctx: Context, id: string, type: WindowType): Promise\<Window>;<br>|类名:window<br>方法 or 属性:function create(ctx: BaseContext, id: string, type: WindowType): Promise\<Window>;<br>|@ohos.window.d.ts| +|函数有变化|类名:window<br>方法 or 属性:function create(id: string, type: WindowType, callback: AsyncCallback\<Window>): void;<br>|类名:window<br>方法 or 属性:function create(ctx: BaseContext, id: string, type: WindowType, callback: AsyncCallback\<Window>): void;<br>|@ohos.window.d.ts| +|函数有变化|类名:window<br>方法 or 属性:function create(ctx: Context, id: string, type: WindowType, callback: AsyncCallback\<Window>): void;<br>|类名:window<br>方法 or 属性:function create(ctx: BaseContext, id: string, type: WindowType, callback: AsyncCallback\<Window>): void;<br>|@ohos.window.d.ts| +|函数有变化|类名:window<br>方法 or 属性:function getTopWindow(callback: AsyncCallback\<Window>): void;<br>|类名:window<br>方法 or 属性:function getTopWindow(callback: AsyncCallback\<Window>): void;<br>|@ohos.window.d.ts| +|函数有变化|类名:window<br>方法 or 属性:function getTopWindow(ctx: Context, callback: AsyncCallback\<Window>): void;<br>|类名:window<br>方法 or 属性:function getTopWindow(callback: AsyncCallback\<Window>): void;<br>|@ohos.window.d.ts| +|函数有变化|类名:window<br>方法 or 属性:function getTopWindow(): Promise\<Window>;<br>|类名:window<br>方法 or 属性:function getTopWindow(): Promise\<Window>;<br>|@ohos.window.d.ts| +|函数有变化|类名:window<br>方法 or 属性:function getTopWindow(ctx: Context): Promise\<Window>;<br>|类名:window<br>方法 or 属性:function getTopWindow(): Promise\<Window>;<br>|@ohos.window.d.ts| +|函数有变化|类名:window<br>方法 or 属性:function getTopWindow(): Promise\<Window>;<br>|类名:window<br>方法 or 属性:function getTopWindow(ctx: BaseContext): Promise\<Window>;<br>|@ohos.window.d.ts| +|函数有变化|类名:window<br>方法 or 属性:function getTopWindow(ctx: Context): Promise\<Window>;<br>|类名:window<br>方法 or 属性:function getTopWindow(ctx: BaseContext): Promise\<Window>;<br>|@ohos.window.d.ts| +|函数有变化|类名:window<br>方法 or 属性:function getTopWindow(callback: AsyncCallback\<Window>): void;<br>|类名:window<br>方法 or 属性:function getTopWindow(ctx: BaseContext, callback: AsyncCallback\<Window>): void;<br>|@ohos.window.d.ts| +|函数有变化|类名:window<br>方法 or 属性:function getTopWindow(ctx: Context, callback: AsyncCallback\<Window>): void;<br>|类名:window<br>方法 or 属性:function getTopWindow(ctx: BaseContext, callback: AsyncCallback\<Window>): void;<br>|@ohos.window.d.ts| +|函数有变化|类名:Window<br>方法 or 属性:loadContent(path: string, callback: AsyncCallback\<void>): void;<br>|类名:Window<br>方法 or 属性:loadContent(path: string, storage: LocalStorage, callback: AsyncCallback\<void>): void;<br>|@ohos.window.d.ts| +|函数有变化|类名:Window<br>方法 or 属性:loadContent(path: string): Promise\<void>;<br>|类名:Window<br>方法 or 属性:loadContent(path: string, storage: LocalStorage): Promise\<void>;<br>|@ohos.window.d.ts| +|函数有变化|类名:Window<br>方法 or 属性:loadContent(path: string, callback: AsyncCallback\<void>): void;<br>|类名:Window<br>方法 or 属性:loadContent(path: string, callback: AsyncCallback\<void>): void;<br>|@ohos.window.d.ts| +|函数有变化|类名:Window<br>方法 or 属性:loadContent(path: string): Promise\<void>;<br>|类名:Window<br>方法 or 属性:loadContent(path: string): Promise\<void>;<br>|@ohos.window.d.ts| diff --git a/zh-cn/release-notes/api-diff/v3.2-beta4/Readme-CN.md b/zh-cn/release-notes/api-diff/v3.2-beta4/Readme-CN.md index c4b1f401195907c84263b2e9f9b7a3bfb8adfd4c..24cc56054cffad3e26d1e76843d0900b30441360 100644 --- a/zh-cn/release-notes/api-diff/v3.2-beta4/Readme-CN.md +++ b/zh-cn/release-notes/api-diff/v3.2-beta4/Readme-CN.md @@ -1,35 +1,34 @@ -# Readme +# JS API差异报告 -* JS API接口变更清单 - - [元能力](js-apidiff-ability.md) - - [无障碍](js-apidiff-accessibility.md) - - [帐号](js-apidiff-account.md) - - [应用](js-apidiff-application.md) - - [ArkUI](js-apidiff-arkui.md) - - [电源服务](js-apidiff-battery.md) - - [包管理](js-apidiff-bundle.md) - - [网络及通信](js-apidiff-communication.md) - - [语言编译器运行时](js-apidiff-compiler-and-runtime.md) - - [定制](js-apidiff-customization.md) - - [DFX](js-apidiff-dfx.md) - - [分布式数据](js-apidiff-distributed-data.md) - - [分布式硬件](js-apidiff-distributed-hardware.md) - - [文件管理](js-apidiff-file-management.md) - - [位置服务](js-apidiff-geolocation.md) - - [全球化](js-apidiff-global.md) - - [Misc软件](js-apidiff-misc.md) - - [MSDP](js-apidiff-msdp.md) - - [多模输入](js-apidiff-multi-modal-input.md) - - [媒体服务](js-apidiff-multimedia.md) - - [事件与通知](js-apidiff-notification.md) - - [资源调度](js-apidiff-resource-scheduler.md) - - [安全](js-apidiff-security.md) - - [泛Sensor](js-apidiff-sensor.md) - - [启动](js-apidiff-start-up.md) - - [电话服务](js-apidiff-telephony.md) - - [测试服务](js-apidiff-unitest.md) - - [升级](js-apidiff-update.md) - - [USB服务](js-apidiff-usb.md) - - [用户IAM](js-apidiff-user-iam.md) - - [Web](js-apidiff-web.md) - - [窗口](js-apidiff-window.md) \ No newline at end of file +- [元能力](js-apidiff-ability.md) +- [无障碍](js-apidiff-accessibility.md) +- [帐号](js-apidiff-account.md) +- [应用](js-apidiff-application.md) +- [ArkUI](js-apidiff-arkui.md) +- [电源服务](js-apidiff-battery.md) +- [包管理](js-apidiff-bundle.md) +- [网络及通信](js-apidiff-communication.md) +- [语言编译器运行时](js-apidiff-compiler-and-runtime.md) +- [定制](js-apidiff-customization.md) +- [DFX](js-apidiff-dfx.md) +- [分布式数据](js-apidiff-distributed-data.md) +- [分布式硬件](js-apidiff-distributed-hardware.md) +- [文件管理](js-apidiff-file-management.md) +- [位置服务](js-apidiff-geolocation.md) +- [全球化](js-apidiff-global.md) +- [Misc软件](js-apidiff-misc.md) +- [MSDP](js-apidiff-msdp.md) +- [多模输入](js-apidiff-multi-modal-input.md) +- [媒体服务](js-apidiff-multimedia.md) +- [事件与通知](js-apidiff-notification.md) +- [资源调度](js-apidiff-resource-scheduler.md) +- [安全](js-apidiff-security.md) +- [泛Sensor](js-apidiff-sensor.md) +- [启动](js-apidiff-start-up.md) +- [电话服务](js-apidiff-telephony.md) +- [测试服务](js-apidiff-unitest.md) +- [升级](js-apidiff-update.md) +- [USB服务](js-apidiff-usb.md) +- [用户IAM](js-apidiff-user-iam.md) +- [Web](js-apidiff-web.md) +- [窗口](js-apidiff-window.md) diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.12/changelog-bundlemanager.md b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.12/changelog-bundlemanager.md new file mode 100644 index 0000000000000000000000000000000000000000..8cb911d0fe15bf51e1a612d63010d50849b2ffc5 --- /dev/null +++ b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.12/changelog-bundlemanager.md @@ -0,0 +1,60 @@ +# 包管理子系统ChangeLog + +## cl.bundlemanager.1 app.json配置文件删除atomicService标签 +删除配置文件app.json中atomicService标签 + +**变更影响**<br> +删除配置文件app.json中atomicService标签,IDE中不再支持配置该标签,使用该标签会导致IDE编译报错 + +**适配指导**<br> +删除atomicService标签 + +## cl.bundlemanager.2 app.json配置文件新增bundleType标签 +配置文件app.json中新增bundleType标签 + +**变更影响**<br> +现存的元服务([installationFree](../../../application-dev/quick-start/module-configuration-file.md)为true),必须在app.json中指定bundleType为atomicService,否则打包失败。 + +**适配指导**<br> +新增[bundleType](../../../application-dev/quick-start/app-configuration-file.md)标签。该标签为可缺省(缺省值为app)。该标签需要和module.json中[installationFree](../../../application-dev/quick-start/module-configuration-file.md)字段保持一一对应,其相应规则为: +- 当bundleType为app时,installationFree必须为false。 +- 当bundleType为atomicService时,installationFree必须为true。 + +## cl.bundlemanager.3 包管理ApplicationInfo结构体中删除split字段。 + +包管理[ApplicationInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/ApplicationInfo.d.ts)结构体中删除split字段。 + +**变更影响**<br> +使用之前已发布的API 9各beta版本且使用到了split的,会编译失败。 + +**关键的接口/组件变更**<br> +包管理[ApplicationInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/ApplicationInfo.d.ts)结构体中删除split字段。 + +**适配指导**<br> +删除ApplicationInfo结构体中的split字段。目前元服务中stage模型强制分包,不支持不分包。 + +## cl.bundlemanager.4 包管理HapModuleInfo结构体中删除atomicServiceModuleType字段。 + +包管理[HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts)结构体中删除atomicServiceModuleType字段。 + +**变更影响**<br> +使用之前已发布的API 9各beta版本且使用到了atomicServiceModuleType的,会编译失败。 + +**关键的接口/组件变更**<br> +包管理[HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts)结构体中删除atomicServiceModuleType字段。 + +**适配指导**<br> +删除[HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts)结构体中的atomicServiceModuleType字段。判断atomicServiceModuleType字段的部分,用[HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts)结构体中的moduleType代替。 + +## cl.bundlemanager.5 包管理删除AtomicServiceModuleType枚举值。 + +包管理[HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts)结构体中删除atomicServiceModuleType字段。 + +**变更影响**<br> +使用之前已发布的API 9各beta版本且使用到了atomicServiceModuleType的,会编译失败。 + +**关键的接口/组件变更**<br> +包管理[HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts)结构体中删除atomicServiceModuleType字段。 + +**适配指导**<br> +删除[HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts)结构体中的atomicServiceModuleType字段。判断atomicServiceModuleType字段的部分,用[HapModuleInfo](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts)结构体中的moduleType代替。 \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.12/changelog-imf.md b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.12/changelog-imf.md new file mode 100644 index 0000000000000000000000000000000000000000..a6cdab6b8d7e7fc6a97698ce9b2e2a84ba32076a --- /dev/null +++ b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.12/changelog-imf.md @@ -0,0 +1,21 @@ +# 输入法框架子系统-输入法框架服务ChangeLog + + +## @ohos.InputMethodSubtype 中输入法子类型中name、label、id属性值变更 +从API9开始,变更如上三个属性值 + +开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +此三个属性的取值发生变化,需要开发者进行适配更新 + +| 名称 | 变更前 | 变更后 | +| -------- | -------- | -------- | +| label | (1)取值:输入法子类型的id。| (1)取值:输入法子类型的标签。| +| name | (1)说明:输入法子类型的名字;(2)取值:输入法子类型的标签。| (1)说明:输入法应用的包名;(2)取值:输入法应用的包名。| +| id | (1)取值:输入法应用的包名。| (1)取值:输入法子类型的id。| + +**适配指导** + +请按上述取值变更结果适配更新。 diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.12/changelog-screenlock.md b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.12/changelog-screenlock.md new file mode 100644 index 0000000000000000000000000000000000000000..8e5a2fab3671eb32db8accb72d764a1194f26ff1 --- /dev/null +++ b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.12/changelog-screenlock.md @@ -0,0 +1,155 @@ +# 主题框架子系统-锁屏管理服务ChangeLog + + +## cl.screenlock.1 isLocked、unlock接口使用权限变更 +从API9开始,变更为systemapi,停止对三方应用开放。 + +开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +基于此前版本开发的应用,需适配变更的js接口,变更前的接口已经不能正常使用了,否则会影响原有功能。 + +- 涉及接口 + +```js + function isLocked(): boolean; + function unlock(callback: AsyncCallback<boolean>): void; + function unlock():Promise<boolean>; +``` + +- 变更前: + +```js + * Checks whether the screen is currently locked. + * + * @returns Returns {@code true} if the screen is currently locked; returns {@code false} otherwise. + * @syscap SystemCapability.MiscServices.ScreenLock + * @since 9 + */ + function isLocked(): boolean; + + /** + * Unlock the screen. + * + * @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @throws {BusinessError} 13200002 - the screenlock management service is abnormal. + * @syscap SystemCapability.MiscServices.ScreenLock + * @systemapi Hide this for inner system use. + * @since 9 + */ + function unlock(callback: AsyncCallback<boolean>): void; + + /** + * Unlock the screen. + * + * @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @throws {BusinessError} 13200002 - the screenlock management service is abnormal. + * @syscap SystemCapability.MiscServices.ScreenLock + * @systemapi Hide this for inner system use. + * @since 9 + */ + function unlock():Promise<boolean>; +``` + +- 变更后: + +```js + * Checks whether the screen is currently locked. + * + * @returns Returns {@code true} if the screen is currently locked; returns {@code false} otherwise. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @syscap SystemCapability.MiscServices.ScreenLock + * @systemapi Hide this for inner system use. + * @since 9 + */ + function isLocked(): boolean; + + /** + * Unlock the screen. + * + * @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 13200002 - the screenlock management service is abnormal. + * @syscap SystemCapability.MiscServices.ScreenLock + * @since 9 + */ + function unlock(callback: AsyncCallback<boolean>): void; + + /** + * Unlock the screen. + * + * @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise. + * @throws {BusinessError} 13200002 - the screenlock management service is abnormal. + * @syscap SystemCapability.MiscServices.ScreenLock + * @since 9 + */ + function unlock():Promise<boolean>; +``` + + +**适配指导** + +该接口变更为系统应用后,三方应用已无法使用。 +系统应用可正常使用。 +示例代码如下: + +```js + try { + let ret = screenLock.isLocked(); + console.error(`Obtain whether the screen is locked successfully , ret is: ${ret}`); + } catch (error) { + console.error(`Failed to obtain whether the screen is locked, error is : ${error.code}, ${error.message}`); + } +``` + +```js + screenlock.unlock((err, data) => { + if (err) { + console.error(`Failed to unlock the screen, because: ${err.message}`); + return; + } + console.info(`unlock the screen successfully. result: ${data}`); + }); +``` + +```js + screenlock.unlock().then((data) => { + console.info(`unlock the screen successfully. result: ${data}`); + }).catch((err) => { + console.error(`Failed to unlock the screen, because: ${err.message}`); + }); +``` + + +## cl.screenlock.2 isSecure接口废弃变更 +从API9开始,废弃此接口。 + +开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +该接口删除无法再使用,请使用进行更新使用,否则会影响原有功能。 + +- 涉及接口 + +```js + function isSecure(): boolean; +``` + +- 变更前: + +```js + function isSecure(): boolean; +``` + +- 变更后:删除接口,停止对外开放。 + + +**适配指导** + +该接口删除后无法再使用,请适配更新。 diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.12/changelog-wallpaper.md b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.12/changelog-wallpaper.md new file mode 100644 index 0000000000000000000000000000000000000000..13baab45851959398ccf4689543f91c5e1aa1d68 --- /dev/null +++ b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.12/changelog-wallpaper.md @@ -0,0 +1,304 @@ +# 主题框架子系统-壁纸管理服务ChangeLog + + +## cl.wallpaper.1 getColorsSync、getMinHeightSync、getMinWidthSync、restore、setImage接口使用权限变更 +从API9开始,变更为systemapi,停止对三方应用开放。 + +开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +基于此前版本开发的应用,需适配变更的js接口,变更前的接口已经不能正常使用了,否则会影响原有功能。 + +- 涉及接口 + +```js + function getColorsSync(wallpaperType: WallpaperType): Array<RgbaColor>; + function getMinHeightSync(): number; + function getMinWidthSync(): number; + function restore(wallpaperType: WallpaperType, callback: AsyncCallback<void>): void; + function restore(wallpaperType: WallpaperType): Promise<void>; + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback<void>): void; + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise<void>; +``` + +- 变更前: + +```js + /** + * Obtains the wallpaper colors for the wallpaper of the specified type. Returns rgbaColor type of array callback function. + * @param wallpaperType Indicates the wallpaper type. + * @returns { Array<RgbaColor> } the Array<RgbaColor> returned by the function. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function getColorsSync(wallpaperType: WallpaperType): Array<RgbaColor>; + + /** + * Obtains the minimum height of the wallpaper. in pixels. returns 0 if no wallpaper has been set. + * @returns { number } the number returned by the function. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function getMinHeightSync(): number; + + /** + * Obtains the minimum width of the wallpaper. in pixels. returns 0 if no wallpaper has been set. + * @returns { number } the number returned by the function. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function getMinWidthSync(): number; + + /** + * Removes a wallpaper of the specified type and restores the default one. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function restore(wallpaperType: WallpaperType, callback: AsyncCallback<void>): void; + + /** + * Removes a wallpaper of the specified type and restores the default one. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function restore(wallpaperType: WallpaperType): Promise<void>; + + /** + * Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file. + * @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback<void>): void; + + /** + * Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file. + * @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise<void>; +``` + +- 变更后: + +```js + /** + * Obtains the wallpaper colors for the wallpaper of the specified type. Returns rgbaColor type of array callback function. + * @param wallpaperType Indicates the wallpaper type. + * @returns { Array<RgbaColor> } the Array<RgbaColor> returned by the function. + * @throws {BusinessError} 401 - parameter error. + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function getColorsSync(wallpaperType: WallpaperType): Array<RgbaColor>; + + /** + * Obtains the minimum height of the wallpaper. in pixels. returns 0 if no wallpaper has been set. + * @returns { number } the number returned by the function. + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function getMinHeightSync(): number; + + /** + * Obtains the minimum width of the wallpaper. in pixels. returns 0 if no wallpaper has been set. + * @returns { number } the number returned by the function. + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function getMinWidthSync(): number; + + /** + * Removes a wallpaper of the specified type and restores the default one. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function restore(wallpaperType: WallpaperType, callback: AsyncCallback<void>): void; + + /** + * Removes a wallpaper of the specified type and restores the default one. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function restore(wallpaperType: WallpaperType): Promise<void>; + + /** + * Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file. + * @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback<void>): void; + + /** + * Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file. + * @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise<void>; +``` + + +**适配指导** + +该接口变更为系统应用后,三方应用已无法使用。 +系统应用可正常使用。 +示例代码如下: + +```js + try { + let colors = wallpaper.getColorsSync(wallpaper.WallpaperType.WALLPAPER_SYSTEM); + console.log(`success to getColorsSync: ${JSON.stringify(colors)}`); + } catch (error) { + console.error(`failed to getColorsSync because: ${JSON.stringify(error)}`); + } +``` + +```js + let minHeight = wallpaper.getMinHeightSync(); +``` + +```js + let minWidth = wallpaper.getMinWidthSync(); +``` + +```js + wallpaper.restore(wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error) => { + if (error) { + console.error(`failed to restore because: ${JSON.stringify(error)}`); + return; + } + console.log(`success to restore.`); + }); +``` + +```js + wallpaper.restore(wallpaper.WallpaperType.WALLPAPER_SYSTEM).then(() => { + console.log(`success to restore.`); + }).catch((error) => { + console.error(`failed to restore because: ${JSON.stringify(error)}`); + }); +``` + +```js + // source类型为string + let wallpaperPath = "/data/data/ohos.acts.aafwk.plrdtest.form/files/Cup_ic.jpg"; + wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error) => { + if (error) { + console.error(`failed to setImage because: ${JSON.stringify(error)}`); + return; + } + console.log(`success to setImage.`); + }); +``` + +```js + // source类型为string + let wallpaperPath = "/data/data/ohos.acts.aafwk.plrdtest.form/files/Cup_ic.jpg"; + wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM).then(() => { + console.log(`success to setImage.`); + }).catch((error) => { + console.error(`failed to setImage because: ${JSON.stringify(error)}`); + }); +``` + + +## cl.wallpaper.2 getIdSync、getFileSync、isChangeAllowed、isUserChangeAllowed、on、off、RgbaColor接口废弃变更 +从API9开始,废弃此接口。 + +开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +该接口删除无法再使用,请使用进行更新使用,否则会影响原有功能。 + +- 涉及接口 + +```js + function getIdSync(wallpaperType: WallpaperType): number; + function getFileSync(wallpaperType: WallpaperType): number; + function isChangeAllowed(): boolean; + function isUserChangeAllowed(): boolean; + function on(type: 'colorChange', callback: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void; + function off(type: 'colorChange', callback?: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void; + interface RgbaColor { + red: number; + green: number; + blue: number; + alpha: number; + } +``` + +- 变更前: + +```js + function getIdSync(wallpaperType: WallpaperType): number; + function getFileSync(wallpaperType: WallpaperType): number; + function isChangeAllowed(): boolean; + function isUserChangeAllowed(): boolean; + function on(type: 'colorChange', callback: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void; + function off(type: 'colorChange', callback?: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void; + interface RgbaColor { + red: number; + green: number; + blue: number; + alpha: number; + } +``` + +- 变更后:删除接口,停止对外开放。 + + +**适配指导** + +该接口删除后无法再使用,请适配更新。 diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.5/changelogs-arkui.md b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.5/changelogs-arkui.md index 13fa31a833204a222885c0d68481903bae13e33d..52c24e47eaedad02b86e5e90ef3e9df8acb3b28c 100644 --- a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.5/changelogs-arkui.md +++ b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.5/changelogs-arkui.md @@ -116,24 +116,24 @@ 通过构造函数方法初始化成员变量,需要遵循如下规则: | **从父组件中的变量(右)到子组件中的变量(下)** | **regular** | **@State** | **@Link** | **@Prop** | **@Provide** | **@Consume** | **@ObjectLink** | -|---------------------------------|----------------------------|------------|-----------|-----------|--------------|--------------|------------------| -| **regular** | 支持 | 支持 | 支持 | 支持 | 不支持 | 不支持 | 支持 | -| **@State** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | -| **@Link** | 不支持 | 支持(1) | 支持(1) | 支持(1) | 支持(1) | 支持(1) | 支持(1) | -| **@Prop** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | -| **@Provide** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | -| **@Consume** | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | -| **@ObjectLink** | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | +| -------------------------- | ----------- | ---------- | --------- | --------- | ------------ | ------------ | --------------- | +| **regular** | 支持 | 支持 | 支持 | 支持 | 不支持 | 不支持 | 支持 | +| **@State** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | +| **@Link** | 不支持 | 支持(1) | 支持(1) | 支持(1) | 支持(1) | 支持(1) | 支持(1) | +| **@Prop** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | +| **@Provide** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | +| **@Consume** | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | +| **@ObjectLink** | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | | **从父组件中的变量(右)到子组件中的变量(下)** | **@StorageLink** | **@StorageProp** | **@LocalStorageLink** | **@LocalStorageProp** | -|------------------|------------------|------------------|-----------------------|------------------------| -| **regular** | 支持 | 不支持 | 不支持 | 不支持 | -| **@State** | 支持 | 支持 | 支持 | 支持 | -| **@Link** | 支持(1) | 支持(1) | 支持(1) | 支持(1) | -| **@Prop** | 支持 | 支持 | 支持 | 支持 | -| **@Provide** | 支持 | 支持 | 支持 | 支持 | -| **@Consume** | 不支持 | 不支持 | 不支持 | 不支持 | -| **@ObjectLink** | 不支持 | 不支持 | 不支持 | 不支持 | +| -------------------------- | ---------------- | ---------------- | --------------------- | --------------------- | +| **regular** | 支持 | 不支持 | 不支持 | 不支持 | +| **@State** | 支持 | 支持 | 支持 | 支持 | +| **@Link** | 支持(1) | 支持(1) | 支持(1) | 支持(1) | +| **@Prop** | 支持 | 支持 | 支持 | 支持 | +| **@Provide** | 支持 | 支持 | 支持 | 支持 | +| **@Consume** | 不支持 | 不支持 | 不支持 | 不支持 | +| **@ObjectLink** | 不支持 | 不支持 | 不支持 | 不支持 | > **说明** > @@ -211,5 +211,5 @@ **适配指导** 1. 构造子组件时,不对子组件的`@LocalStorageLink`, `@LocalStorageProp`修饰的变量进行。 -如果需要在父组件中修改子组件的`@LocalStorageLink`, `@LocalStorageProp`修饰的变量,则使用LocalStorage提供的API接口方法(比如set方法)赋值。 -2. @ObjectLink的使用指导请参考文档[@ObjectLink使用指导](../../../application-dev/quick-start/arkts-state-mgmt-page-level.md)。 + 如果需要在父组件中修改子组件的`@LocalStorageLink`, `@LocalStorageProp`修饰的变量,则使用LocalStorage提供的API接口方法(比如set方法)赋值。 +2. @ObjectLink的使用指导请参考文档[@ObjectLink使用指导](../../../application-dev/quick-start/arkts-observed-and-objectlink.md)。 diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.5/changelogs-filemanagement.md b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.5/changelogs-filemanagement.md index 6d04fd1b5c9263d0e91ba8d83ccc3bc536acf640..50cb351de5032d8c5023804fb79314fc030f8157 100644 --- a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.5/changelogs-filemanagement.md +++ b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.5/changelogs-filemanagement.md @@ -143,3 +143,46 @@ import volumeManager from '@ohos.volumeManager'; ```js import volumeManager from '@ohos.file.volumeManager'; ``` + +## cl.filemanagement.8 fileio相关接口异常处理方式变更 + +file_api部件fileio接口返回值不包含错误码error.code,现进行错误码整改,废弃原有相关接口,新增相关接口。 + +**变更影响** + +基于此前版本开发的应用,需注意废弃接口的迭代更新。新接口在接口规格上进行了微调,需注意新接口使用方法。 + +**关键接口/组件变更** + +为适配统一的API异常处理方式,对fileio相关接口进行废弃,并新增对应接口,原接口位于@ohos.fileio,新接口位于@ohos.file.fs。新增接口支持统一的错误码异常处理规范,功能上与原接口保持一致,参数上有微调,以下为规格调整的接口列表。 + +| 模块名 | 方法/属性/枚举/常量 | 变更类型 | +| ------------------------- | ------------------------------------------------------------ | -------- | +| @ohos.fileio | **function** access(path: string, mode?: number, callback?: AsyncCallback<void>): void \| Promise<void> | 废弃 | +| @ohos.fileio | **function** accessSync(path: string, mode?: number): void | 废弃 | +| @ohos.file.fs | **function** access(path: string, callback?: AsyncCallback<boolean>): void \| Promise<boolean> | 新增 | +| @ohos.file.fs | **function** accessSync(path: string): boolean | 新增 | +| @ohos.fileio | **function** close(fd: number, callback?: AsyncCallback<void>): void \| Promise<void> | 废弃 | +| @ohos.fileio | **function** closeSync(fd: number): void | 废弃 | +| @ohos.file.fs | **function** close(file: File \| number, callback?: AsyncCallback<void>): void \| Promise<void> | 新增 | +| @ohos.file.fs | **function** closeSync(file: File \| number): void | 新增 | +| @ohos.fileio | **function** mkdir(path: string, mode?: number, callback?: AsyncCallback<void>): void \| Promise<void> | 废弃 | +| @ohos.fileio | **function** mkdirSync(path: string, mode?: number): void | 废弃 | +| @ohos.file.fs | **function** mkdir(path: string, callback?: AsyncCallback<void>): void \| Promise<void> | 新增 | +| @ohos.file.fs | **function** mkdirSync(path: string): void | 新增 | +| @ohos.fileio | **function** readText(filePath: string, options?: { position?: number; length?: number; encoding?: string; }, callback?: AsyncCallback<string>): void \| Promise<string> | 废弃 | +| @ohos.fileio | **function** readTextSync(filePath: string, options?: { position?: number; length?: number; encoding?: string; }): string | 废弃 | +| @ohos.file.fs | **function** readText(filePath: string, options?: { offset?: number; length?: number; encoding?: string; }, callback?: AsyncCallback<string>): void \| Promise<string> | 新增 | +| @ohos.file.fs | **function** readTextSync(filePath: string, options?: { offset?: number; length?: number; encoding?: string; }): string | 新增 | +| @ohos.fileio | **function** Stream.read(buffer: ArrayBuffer, options?: { offset?: number; length?: number; position?: number; }, callback?: AsyncCallback<ReadOut>): void \| Promise<ReadOut> | 废弃 | +| @ohos.fileio | **function** Stream.readSync(buffer: ArrayBuffer, options?: { offset?: number; length?: number; position?: number; }): number | 废弃 | +| @ohos.file.fs | **function** Stream.read(fd: number, buffer: ArrayBuffer, options?: { offset?: number; length?: number; }, callback?: AsyncCallback<number>): void \| Promise<number> | 新增 | +| @ohos.file.fs | **function** Stream.readSync(fd: number, buffer: ArrayBuffer, options?: { offset?: number; length?: number; }): number | 新增 | +| @ohos.fileio | **function** Stream.write(buffer: ArrayBuffer \| string, options?: { offset?: number; length?: number; position?: number; encoding?: string; }, callback?: AsyncCallback<number>): void \| Promise<void> | 废弃 | +| @ohos.fileio | **function** Stream.writeSync(buffer: ArrayBuffer \| string, options?: { offset?: number; length?: number; position?: number; encoding?: string; }): number | 废弃 | +| @ohos.file.fs | **function** Stream.write(buffer: ArrayBuffer \| string, options?: { offset?: number; length?: number; encoding?: string; }, callback?: AsyncCallback<number>): void \| Promise<void> | 新增 | +| @ohos.file.fs | **function** Stream.writeSync(buffer: ArrayBuffer \| string, options?: { offset?: number; length?: number; encoding?: string; }): number | 新增 | + +**适配指导** + +@ohos.file.fs新增统一的API异常处理方式,可参考错误码[适配指导](../../../application-dev/reference/errorcodes/errorcode-filemanagement.md#错误码适配指导)。 diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.7/changelogs-ability.md b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.7/changelogs-ability.md index 5740c1bc54aa92cc3e32843d28ad907d7ad39e21..b5289610acebcfd24695f527efc2ae51f2198da1 100644 --- a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.7/changelogs-ability.md +++ b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.7/changelogs-ability.md @@ -107,3 +107,185 @@ let appContext = context.getApplicationContext(); appContext.getRunningProcessInformation() ``` + + +## cl.ability.4 WantConstant.Flags接口变更 +WantConstant.Flags接口有多个无效Flag定义,删除掉无效的Flag。 + +**变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_FORWARD_RESULT | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_CONTINUATION | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_NOT_OHOS_COMPONENT | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_FORM_ENABLED | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_AUTH_PERSISTABLE_URI_PERMISSION | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_AUTH_PREFIX_URI_PERMISSION | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITYSLICE_MULTI_DEVICE | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_START_FOREGROUND_ABILITY | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_CONTINUATION_REVERSIBLE | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_INSTALL_WITH_BACKGROUND_MODE | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_CLEAR_MISSION | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_NEW_MISSION | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Flags | FLAG_ABILITY_MISSION_TOP | 删除 | + + + +## cl.ability.5 WantConstant.Action接口变更 +WantConstant.Action接口有多个无效Action定义,删除掉无效的Action。 + +**变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | ACTION_APP_ACCOUNT_AUTH | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | ACTION_MARKET_DOWNLOAD | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | ACTION_MARKET_CROWDTEST | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | DLP_PARAMS_SANDBOX | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | DLP_PARAMS_BUNDLE_NAME | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | DLP_PARAMS_MODULE_NAME | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Action | DLP_PARAMS_ABILITY_NAME | 删除 | + + + +## cl.ability.6 Caller相关接口变更 +Caller相关接口使用RPC废弃的Sequenceable和MessageParcel对象,使用RPC在API9提供的Parcelable和MessageSequence对象替代。 + +**变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ------------------------- | ------------------- | ------------------------------------------------------------ | -------- | +| api/@ohos.app.ability.UIAbility.d.ts | CalleeCallback | (indata: rpc.MessageParcel): rpc.Sequenceable; | 变更,修改为 (indata: rpc.MessageSequence): rpc.Parcelable; | +| api/@ohos.app.ability.UIAbility.d.ts | Caller | call(method: string, data: rpc.Sequenceable): Promise<void>; | 变更,修改为 call(method: string, data: rpc.Parcelable): Promise<void>; | +| api/@ohos.app.ability.UIAbility.d.ts | Caller | callWithResult(method: string, data: rpc.Sequenceable): Promise<rpc.MessageParcel>; | 变更,修改为 callWithResult(method: string, data: rpc.Parcelable): Promise<rpc.MessageSequence>; | + +**适配指导** + +应用中调用Caller相关接口可参考下列代码 + +变更前代码: + +```ts + class MyMessageAble{ + name:"" + str:"" + num: 1 + constructor(name, str) { + this.name = name; + this.str = str; + } + marshalling(messageParcel) { + messageParcel.writeInt(this.num); + messageParcel.writeString(this.str); + console.log('MyMessageAble marshalling num[' + this.num + '] str[' + this.str + ']'); + return true; + } + unmarshalling(messageParcel) { + this.num = messageParcel.readInt(); + this.str = messageParcel.readString(); + console.log('MyMessageAble unmarshalling num[' + this.num + '] str[' + this.str + ']'); + return true; + } + }; + let method = 'call_Function'; + function funcCallBack(pdata) { + console.log('Callee funcCallBack is called ' + pdata); + let msg = new MyMessageAble("test", ""); + pdata.readSequenceable(msg); + return new MyMessageAble("test1", "Callee test"); + } + export default class MainUIAbility extends UIAbility { + onCreate(want, launchParam) { + console.log('Callee onCreate is called'); + try { + this.callee.on(method, funcCallBack); + } catch (error) { + console.log('Callee.on catch error, error.code: ' + error.code + + ' error.message: ' + error.message); + } + } + } +``` + +变更后代码: + +```ts + class MyMessageAble{ + name:"" + str:"" + num: 1 + constructor(name, str) { + this.name = name; + this.str = str; + } + marshalling(messageSequence) { + messageSequence.writeInt(this.num); + messageSequence.writeString(this.str); + console.log('MyMessageAble marshalling num[' + this.num + '] str[' + this.str + ']'); + return true; + } + unmarshalling(messageSequence) { + this.num = messageSequence.readInt(); + this.str = messageSequence.readString(); + console.log('MyMessageAble unmarshalling num[' + this.num + '] str[' + this.str + ']'); + return true; + } + }; + let method = 'call_Function'; + function funcCallBack(pdata) { + console.log('Callee funcCallBack is called ' + pdata); + let msg = new MyMessageAble("test", ""); + pdata.readParcelable(msg); + return new MyMessageAble("test1", "Callee test"); + } + export default class MainUIAbility extends UIAbility { + onCreate(want, launchParam) { + console.log('Callee onCreate is called'); + try { + this.callee.on(method, funcCallBack); + } catch (error) { + console.log('Callee.on catch error, error.code: ' + error.code + + ' error.message: ' + error.message); + } + } + } +``` + + + +## cl.ability.7 WantConstant.Flags接口变更 + +wantConstant接口有两个类似的枚举,合并成一个。 + +**变更影响** + +影响API9版本的JS接口,应用需要进行适配才可以在新版本SDK环境正常实现功能。 + +**关键的接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ----------------------------------- | ---------------------- | ----------------------------------- | -------- | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Parameter | ABILITY_BACK_TO_OTHER_MISSION_STACK | 删除 | +| @ohos.app.ability.wantConstant.d.ts | wantConstant.Params | ABILITY_BACK_TO_OTHER_MISSION_STACK | 新增 | + +**适配指导** + +使用@ohos.app.ability.wantConstant.d.ts中的ABILITY_BACK_TO_OTHER_MISSION_STACK + +```ts +import wantConstant from '@ohos.app.ability.wantConstant'; +let backToOtherMissionStack: wantConstant.Params = wantParam.Params.ABILITY_BACK_TO_OTHER_MISSION_STACK; +``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.7/changelogs-bundlemanager.md b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.7/changelogs-bundlemanager.md index ee19ef727948307f189f19ef2857e3f02eb64c70..15accb04095bb7f3fb478b01b702d4e58c6e46ad 100644 --- a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.7/changelogs-bundlemanager.md +++ b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.10.7/changelogs-bundlemanager.md @@ -230,4 +230,16 @@ module.json配置文件中的ability的[name](../../../application-dev/quick-sta 删除配置文件module.json[distroFilter](../../../application-dev/quick-start/module-configuration-file.md)标签,IDE中不再支持配置该标签,使用该标签会导致IDE编译报错 **适配指导**<br> -删除module.json中[distroFilter](../../../application-dev/quick-start/module-configuration-file.md)标签,使用distributionFilter替代 \ No newline at end of file +删除module.json中[distroFilter](../../../application-dev/quick-start/module-configuration-file.md)标签,使用distributionFilter替代 + +## cl.bundlemanager.20 module.json配置文件中launchType的标签standard模式修改为multiton +删除module.json中[launchType](../../../application-dev/quick-start/module-configuration-file.md)标签的standard模式修改为multiton + +**适配指导**<br> +删除module.json中[launchType](../../../application-dev/quick-start/module-configuration-file.md)标签的standard模式,使用multiton替代 + +## cl.bundlemanager.21 module.json配置文件中abilities的标签visible修改为exported +module.json中[abilities](../../../application-dev/quick-start/module-configuration-file.md)的标签visible修改为exported,表示当前ability是否支持导出,被其他的ability使用。 + +**适配指导**<br> +删除module.json中[abilities](../../../application-dev/quick-start/module-configuration-file.md)的visible标签,使用exported标签替代 \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.8.1/changelogs-account_os_account.md b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.8.1/changelogs-account_os_account.md index 845e56f08f38e4cdf38b9755442f88e870f42cc3..7aa6bffc9cf3c8423ba8b552ae9046fbd4aa7494 100644 --- a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.8.1/changelogs-account_os_account.md +++ b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.8.1/changelogs-account_os_account.md @@ -6,7 +6,7 @@ - 新增统一的错误码定义: - [帐号公共错误码](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/errorcodes/errorcode-account.md) - - [应用帐号错误码](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/errorcodes/errorcode-app-account.md) + - [应用帐号错误码](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/errorcodes/errorcode-account.md) - 按以下方式返回错误码: - 异步接口:错误信息通过AsyncCallback或Promise的error对象返回。其中,参数类型和数量错误信息,通过抛出异常的方式返回。 diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.8.2/changelog-bundlemanager.md b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.8.2/changelog-bundlemanager.md index ceea34cf904a6158f5aa98ac8b76ef44ee80f6d9..277221beff721cadf9e7e02d223a65d6afca87b0 100644 --- a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.8.2/changelog-bundlemanager.md +++ b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.8.2/changelog-bundlemanager.md @@ -21,7 +21,7 @@ | @ohos.bundle.innerBundleManager.d.ts | [@ohos.bundle.launcherBundleManager.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.launcherBundleManager.d.ts) | | @ohos.bundle.innerBundleManager.d.ts | [@ohos.bundle.bundleMonitor.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.bundleMonitor.d.ts) | | @ohos.bundle.defaultAppManager.d.ts | [@ohos.bundle.defaultAppManager.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.defaultAppManager.d.ts) | -| @ohos.distributedBundle.d.ts | [@ohos.bundle.distributedBundle.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.distributedBundle.d.ts) | +| @ohos.distributedBundle.d.ts | [@ohos.bundle.distributedBundleManager.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.distributedBundleManager.d.ts) | | 无 | [@ohos.bundle.appControl.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.appControl.d.ts) | | @system.package.d.ts | 无 | @@ -65,23 +65,22 @@ import distributedBundle form '@ohos.bundle.distributedBundle' 新增结构体对原有的API8及之前的结构体进行梳理,将原有API8及之前的结构体全部废弃,新增新的API9结构体,变更前后的对比如下表所示,部分结构体进行了合并,例如moduleInfo.d.ts替换为hapModuleInfo.d.ts,customizeData.d.ts替换为metadata.d.ts。结构体功能上与原结构体保持一致。部分功能有变更或者新增的结构体属性会单独列出。 | 原结构体(废弃) | 新结构体(新增) | | ------ | ------ | -| bundle/abilityInfo.d.ts | [bundleManager/abilityInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/abilityInfo.d.ts) | -| bundle/applicationInfo.d.ts | [bundleManager/applicationInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/applicationInfo.d.ts) | -| bundle/bundleInfo.d.ts | [bundleManager/bundleInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/bundleInfo.d.ts) | -| bundle/bundleInstaller.d.ts | [@ohos.bundle.installer.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.installer.d.ts) | -| bundle/bundleStatusCallback.d.ts | [@ohos.bundle.bundleMonitor.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.bundleMonitor.d.ts) | -| bundle/customizeData.d.ts | [bundleManager/metadata.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/metadata.d.ts) | -| bundle/dispatchInfo.d.ts | [bundleManager/dispatchInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/dispatchInfo.d.ts) | -| bundle/elementName.d.ts | [bundleManager/elementName.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/elementName.d.ts) | -| bundle/extensionAbilityInfo.d.ts | [bundleManager/extensionAbilityInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/extensionAbilityInfo.d.ts) | -| bundle/hapModuleInfo.d.ts | [bundleManager/hapModuleInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/hapModuleInfo.d.ts) | -| bundle/launcherAbilityInfo.d.ts | [bundleManager/launcherAbilityInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/launcherAbilityInfo.d.ts) | -| bundle/metadata.d.ts | [bundleManager/metadata.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/metadata.d.ts) | -| bundle/moduleInfo.d.ts | [bundleManager/hapModuleInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/hapModuleInfo.d.ts) | -| bundle/packInfo.d.ts | [bundleManager/packInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/packInfo.d.ts) | -| bundle/PermissionDef.d.ts | [bundleManager/permissionDef.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/permissionDef.d.ts) | -| bundle/remoteAbilityInfo.d.ts | [bundleManager/remoteAbilityInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/remoteAbilityInfo.d.ts) | -| bundle/shortcutInfo.d.ts | [bundleManager/shortcutInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/shortcutInfo.d.ts) | +| bundle/abilityInfo.d.ts | [bundleManager/abilityInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/AbilityInfo.d.ts) | +| bundle/applicationInfo.d.ts | [bundleManager/applicationInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/ApplicationInfo.d.ts) | +| bundle/bundleInfo.d.ts | [bundleManager/bundleInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/BundleInfo.d.ts) | +| bundle/bundleInstaller.d.ts | [@ohos.bundle.installer.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.installer.d.ts) | +| bundle/bundleStatusCallback.d.ts | [@ohos.bundle.bundleMonitor.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.bundleMonitor.d.ts) | +| bundle/customizeData.d.ts | [bundleManager/metadata.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/Metadata.d.ts) | +| bundle/dispatchInfo.d.ts | [bundleManager/dispatchInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/DispatchInfo.d.ts) | +| bundle/elementName.d.ts | [bundleManager/elementName.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/ElementName.d.ts) | +| bundle/extensionAbilityInfo.d.ts | [bundleManager/extensionAbilityInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/ExtensionAbilityInfo.d.ts) | +| bundle/hapModuleInfo.d.ts | [bundleManager/hapModuleInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts) | +| bundle/launcherAbilityInfo.d.ts | [bundleManager/launcherAbilityInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/LauncherAbilityInfo.d.ts) | +| bundle/metadata.d.ts | [bundleManager/metadata.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/Metadata.d.ts) | +| bundle/moduleInfo.d.ts | [bundleManager/hapModuleInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts) | +| bundle/PermissionDef.d.ts | [bundleManager/permissionDef.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/PermissionDef.d.ts) | +| bundle/remoteAbilityInfo.d.ts | [bundleManager/remoteAbilityInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/RemoteAbilityInfo.d.ts) | +| bundle/shortcutInfo.d.ts | [bundleManager/shortcutInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/ShortcutInfo.d.ts) | **适配指导**<br> 1. 使用原有结构体的代码需要修改为新结构体。 @@ -168,7 +167,7 @@ import appControl form '@ohos.bundle.appControl' ## cl.bundlemanager.4 BundleInfo结构体变更,包管理原有bundle/bundleInfo.d.ts字段全部废弃变更为bundleManager/bundleInfo.d.ts,涉及字段属性变化。 -包管理原有bundle/bundleInfo.d.ts字段全部废弃。由老的[bundle/bundleInfo.d.ts]((https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundle/bundleInfo.d.ts))变更为[bundleManager/bundleInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/bundleInfo.d.ts),涉及字段属性变化。 +包管理原有bundle/bundleInfo.d.ts字段全部废弃。由老的[bundle/bundleInfo.d.ts]((https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundle/bundleInfo.d.ts))变更为[bundleManager/bundleInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/BundleInfo.d.ts),涉及字段属性变化。 **变更影响**<br> @@ -176,7 +175,7 @@ import appControl form '@ohos.bundle.appControl' **关键的接口/组件变更**<br> -BundleInfo结构体发生变化的字段内容如下表所示。其余字段在bundle/bundleInfo.d.ts中废弃后,在新的[bundleManager/bundleInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/bundleInfo.d.ts)中均有对应值。没有对应字段,则表明该字段已经在API9上废弃。 +BundleInfo结构体发生变化的字段内容如下表所示。其余字段在bundle/bundleInfo.d.ts中废弃后,在新的[bundleManager/bundleInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/BundleInfo.d.ts)中均有对应值。没有对应字段,则表明该字段已经在API9上废弃。 | 已废弃 | API9新增或变更 | 类型 | | --- | --- | --- | @@ -217,7 +216,7 @@ ApplicationInfo结构体变更,包管理原有bundle/applicationInfo.d.ts字 对原有使用API version 9之前的应用无影响,使用API version 9的应用需要适配新模块和新接口。使用二级模块导出ApplicationInfo时,需要导入@ohos.bundle.bundleManager模块。 **关键的接口/组件变更**<br> -ApplicationInfo结构体发生变化的字段内容如下表所示。其余字段在bundle/applicationInfo.d.ts中废弃后,在新的[bundleManager/applicationInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/applicationInfo.d.ts)中均有对应值。没有对应字段,则表明该字段已经在API9上废弃。 +ApplicationInfo结构体发生变化的字段内容如下表所示。其余字段在bundle/applicationInfo.d.ts中废弃后,在新的[bundleManager/applicationInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/ApplicationInfo.d.ts)中均有对应值。没有对应字段,则表明该字段已经在API9上废弃。 | 废弃 | API9新增或变更 | 类型 | | --- | --- | --- | @@ -240,7 +239,7 @@ ApplicationInfo结构体发生变化的字段内容如下表所示。其余字 ## cl.bundlemanager.6 HapModuleInfo结构体字段变更,包管理原有bundle/hapModuleInfo.d.ts 和 moduleInfo.d.ts字段全部废弃,变更为bundleManager/hapModuleInfo.d.ts,涉及字段属性变化。 -HapModuleInfo结构体字段变更,包管理原有bundle/hapModuleInfo.d.ts 和 moduleInfo.d.ts字段全部废弃,变更为[bundleManager/hapModuleInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/hapModuleInfo.d.ts),涉及字段属性变化。 +HapModuleInfo结构体字段变更,包管理原有bundle/hapModuleInfo.d.ts 和 moduleInfo.d.ts字段全部废弃,变更为[bundleManager/hapModuleInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts),涉及字段属性变化。 **变更影响**<br> 对原有使用API version 9之前的应用无影响,使用API version 9的应用需要适配新模块和新接口。使用二级模块导出HapModuleInfo时,需要导入@ohos.bundle.bundleManager模块。 @@ -263,8 +262,8 @@ HapModuleInfo结构体发生变化的字段内容如下表所示。其余字段 ## cl.bundlemanager.7 ModuleInfo结构体废弃,使用bundleManager/hapModuleInfo.d.ts中的HapModuleInfo代替。 -包管理原有bundle/hapModuleInfo.d.ts 和 moduleInfo.d.ts字段全部废弃,变更为[bundleManager/hapModuleInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/hapModuleInfo.d.ts),涉及字段属性变化。 -ModuleInfo结构体废弃,使用[bundleManager/hapModuleInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/hapModuleInfo.d.ts)中的HapModuleInfo代替。 +包管理原有bundle/hapModuleInfo.d.ts 和 moduleInfo.d.ts字段全部废弃,变更为[bundleManager/hapModuleInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts),涉及字段属性变化。 +ModuleInfo结构体废弃,使用[bundleManager/hapModuleInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/HapModuleInfo.d.ts)中的HapModuleInfo代替。 **变更影响**<br> 对原有使用API version 9之前的应用无影响,使用API version 9的应用需要适配新模块和新接口。ModuleInfo被废弃,使用HapModuleInfo代替。 @@ -394,7 +393,7 @@ import defaultApp form '@ohos.bundle.defaultAppManager' ``` ## cl.bundlemanager.11 分布式包管理模块变更,原@ohos.distributedBundle.d.ts接口全部废弃,变更为@ohos.bundle.distributedBundle.d.ts,涉及接口变更。 -API异常错误整改,分布式包管理模块变更,原@ohos.distributedBundle.d.ts接口全部废弃,变更为[@ohos.bundle.distributedBundle.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.distributedBundle.d.ts)。涉及接口getRemoteAbilityInfos,变更为getRemoteAbilityInfo。相关结构体RemoteAbilityInfo的二级模块导出功能也需要导入新模块才可以继续使用。 +API异常错误整改,分布式包管理模块变更,原@ohos.distributedBundle.d.ts接口全部废弃,变更为[@ohos.bundle.distributedBundleManager.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/@ohos.bundle.distributedBundleManager.d.ts)。涉及接口getRemoteAbilityInfos,变更为getRemoteAbilityInfo。相关结构体RemoteAbilityInfo的二级模块导出功能也需要导入新模块才可以继续使用。 **变更影响**<br> 对API version 9之前的应用无影响。分布式模块和getRemoteAbilityInfos名称变更,会导致原有API version 9应用使用新的sdk编译失败。 @@ -437,7 +436,7 @@ import freeInstall from '@ohos.bundle.freeInstall' ## cl.bundlemanager.13 免安装相关结构体DisPatchInfo、AbilityFormInfo、ModuleDistroInfo和ModuleConfigInfo发生字段变更 免安装相关结构体DisPatchInfo、AbilityFormInfo、ModuleDistroInfo和ModuleConfigInfo发生字段变更: -1. DispatchInfo中字段dispatchAPI名称修改为[dispatchAPIVersion](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/dispatchInfo.d.ts),属性不变,为string。表示免安装接口的版本信息,含义不变。 +1. DispatchInfo中字段dispatchAPI名称修改为[dispatchAPIVersion](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/DispatchInfo.d.ts),属性不变,为string。表示免安装接口的版本信息,含义不变。 2. AbilityFormInfo结构体字段属性变更,原有字段supportDimensions属性由Array\<number>修改为Array\<string>; 3. AbilityFormInfo结构体字段属性变更,原有字段defaultDimension属性由number修改为string。 4. ModuleDistroInfo结构体废弃mainAbility字段,移至ModuleConfigInfo结构体中。 @@ -498,7 +497,7 @@ import freeInstall from '@ohos.bundle.freeInstall' import bundle form '@ohos.bundle.bundleManager' ``` ## cl.bundlemanager.15 包管理ShortcutInfo结构体字段变更 -包管理ShortcutInfo结构体字段变更,原有bundle/shortcutInfo.d.ts字段全部废弃,变更为[bundleManager/shortcutInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/shortcutInfo.d.ts)。ShortcutInfo和ShortWant结构体全部为systemapi。 +包管理ShortcutInfo结构体字段变更,原有bundle/shortcutInfo.d.ts字段全部废弃,变更为[bundleManager/shortcutInfo.d.ts](https://gitee.com/openharmony/interface_sdk-js/blob/master/api/bundleManager/ShortcutInfo.d.ts)。ShortcutInfo和ShortWant结构体全部为systemapi。 **变更影响**<br> 对API version 9之前的应用无影响。结构体名称字段属性变更,会导致原有API9应用使用新的sdk编译失败。 diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.9.1/changelogs-wantAgent.md b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.9.1/changelogs-wantAgent.md index 468cdd16e5e625acc563890bea2ddf380245ba4e..cc403f2572f2c267f01450cf85126e183e1bce96 100644 --- a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.9.1/changelogs-wantAgent.md +++ b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.9.1/changelogs-wantAgent.md @@ -71,7 +71,7 @@ function getWantAgentCallback(err, data) { //getUid回调 function triggerCallback(err, data) { if(err) { - console.info('getUid failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + console.info('getUid failed!' + err.code + err.message); } else { console.info('getUid ok!' + JSON.stringify(data)); } @@ -79,12 +79,12 @@ function getWantAgentCallback(err, data) { try { WantAgent.trigger(wantAgent, triggerInfo, triggerCallback); } catch(err) { - console.info('getUid failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + console.info('getUid failed!' + err.code + err.message); } } try{ WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback); } catch(err){ - console.info('getWantAgent failed!' + JSON.stringify(err.code) + JSON.stringify(err.message)); + console.info('getWantAgent failed!' + err.code + err.message); } ``` diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_3.2.9.3/changelogs-useriam.md b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.9.3/changelogs-useriam.md new file mode 100644 index 0000000000000000000000000000000000000000..e781172a332f8bc19c89d43cfa72c29eb8df44d3 --- /dev/null +++ b/zh-cn/release-notes/changelogs/OpenHarmony_3.2.9.3/changelogs-useriam.md @@ -0,0 +1,39 @@ +# 用户IAM子系统Changelog + +## cl.useriam.1 API9 GetVesion接口删除 + +为优化用户IAM接口,从当前版本开始做如下变更: + +用户IAM删除GetVersion(API 9)接口。 + +**变更影响** + +对用户IAM GetVersion(API 9)接口的使用有影响,需删除对此接口的调用,否则会调用失败。 + +**关键接口/组件变更** + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| ---------------------- | ------------------- | ------------------------- | ------------------------ | +| ohos.userIAM.userAuth | function | getVersion() : number | 删除 | + +**适配指导** + +需删除对用户IAM GetVersion(API 9)接口的调用。 + +## cl.useriam.2 API8 GetVesion接口返回值变更 + +为统一用户IAM GetVersion(API 8)接口的返回值。从当前版本开始做如下变更: + +用户IAM GetVersion(API 8)接口的返回值由0变更为1。 + +**变更影响** + +对用户IAM GetVersion(API 8)接口的使用有影响,如应用校验了此接口的返回值,修改后校验不通过。 + +**关键接口/组件变更** + +用户IAM GetVersion(API 8)接口的返回值由0变更为1。 + +**适配指导** + +此接口已废弃,需删除对用户IAM GetVersion(API 8)接口的使用。 diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_4.0.2.1/changelogs-usb.md b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.2.1/changelogs-usb.md index e6f0ac779385ce65a679d6f5840d80004f124bab..a491f5b1cdd1578c3616e80733f3e84be5553c30 100755 --- a/zh-cn/release-notes/changelogs/OpenHarmony_4.0.2.1/changelogs-usb.md +++ b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.2.1/changelogs-usb.md @@ -1,4 +1,4 @@ -USB管理 changeLog +# USB服务子系统ChangeLog ## cl.usb_manager.1 系统接口变更 @@ -13,6 +13,16 @@ USB系统API运行时鉴权,异步接口以Promise reject形式抛出错误码 | ohos.usbV9.d.ts | function setCurrentFunctions(funcs: FunctionType): Promise<boolean>; | function setCurrentFunctions(funcs: FunctionType): Promise<void>; | | ohos.usbV9.d.ts | function setPortRoles(portId: number, powerRole: PowerRoleType, dataRole: DataRoleType): Promise<boolean>; | function setPortRoles(portId: number, powerRole: PowerRoleType, dataRole: DataRoleType): Promise<void>; | +## cl.usb_manager.2 sdk接口删除 + +继OpenHarmony 4.0.5.5版本3.30之后,@ohos.usbV9.d.ts文件已删除。 + +后续需要import @ohos.usbManager才能使用USB服务的接口: + + ```ts + import usbManager from '@ohos.usbManager'; + ``` + **适配指导** -请参考各接口的[API参考](../../../application-dev/reference/errorcodes/errorcode-universal.md) \ No newline at end of file +请参考各接口的[API文档](../../../application-dev/reference/apis/js-apis-usbManager.md) diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_4.0.2.3/changelogs-arkui.md b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.2.3/changelogs-arkui.md index 27ad666dc2f9091b7dcb93341c7e7a88d92b9dce..b183f8f79f680d28e87866fb8916c36e3f2115b2 100644 --- a/zh-cn/release-notes/changelogs/OpenHarmony_4.0.2.3/changelogs-arkui.md +++ b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.2.3/changelogs-arkui.md @@ -116,24 +116,24 @@ 通过构造函数方法初始化成员变量,需要遵循如下规则: | **从父组件中的变量(右)到子组件中的变量(下)** | **regular** | **@State** | **@Link** | **@Prop** | **@Provide** | **@Consume** | **@ObjectLink** | -|---------------------------------|----------------------------|------------|-----------|-----------|--------------|--------------|------------------| -| **regular** | 支持 | 支持 | 支持 | 支持 | 不支持 | 不支持 | 支持 | -| **@State** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | -| **@Link** | 不支持 | 支持(1) | 支持(1) | 支持(1) | 支持(1) | 支持(1) | 支持(1) | -| **@Prop** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | -| **@Provide** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | -| **@Consume** | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | -| **@ObjectLink** | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | +| -------------------------- | ----------- | ---------- | --------- | --------- | ------------ | ------------ | --------------- | +| **regular** | 支持 | 支持 | 支持 | 支持 | 不支持 | 不支持 | 支持 | +| **@State** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | +| **@Link** | 不支持 | 支持(1) | 支持(1) | 支持(1) | 支持(1) | 支持(1) | 支持(1) | +| **@Prop** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | +| **@Provide** | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | 支持 | +| **@Consume** | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | +| **@ObjectLink** | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | 不支持 | | **从父组件中的变量(右)到子组件中的变量(下)** | **@StorageLink** | **@StorageProp** | **@LocalStorageLink** | **@LocalStorageProp** | -|------------------|------------------|------------------|-----------------------|------------------------| -| **regular** | 支持 | 不支持 | 不支持 | 不支持 | -| **@State** | 支持 | 支持 | 支持 | 支持 | -| **@Link** | 支持(1) | 支持(1) | 支持(1) | 支持(1) | -| **@Prop** | 支持 | 支持 | 支持 | 支持 | -| **@Provide** | 支持 | 支持 | 支持 | 支持 | -| **@Consume** | 不支持 | 不支持 | 不支持 | 不支持 | -| **@ObjectLink** | 不支持 | 不支持 | 不支持 | 不支持 | +| -------------------------- | ---------------- | ---------------- | --------------------- | --------------------- | +| **regular** | 支持 | 不支持 | 不支持 | 不支持 | +| **@State** | 支持 | 支持 | 支持 | 支持 | +| **@Link** | 支持(1) | 支持(1) | 支持(1) | 支持(1) | +| **@Prop** | 支持 | 支持 | 支持 | 支持 | +| **@Provide** | 支持 | 支持 | 支持 | 支持 | +| **@Consume** | 不支持 | 不支持 | 不支持 | 不支持 | +| **@ObjectLink** | 不支持 | 不支持 | 不支持 | 不支持 | > **说明** > @@ -211,8 +211,8 @@ **适配指导** 1. 构造子组件时,不对子组件的`@LocalStorageLink`, `@LocalStorageProp`修饰的变量进行。 -如果需要在父组件中修改子组件的`@LocalStorageLink`, `@LocalStorageProp`修饰的变量,则使用LocalStorage提供的API接口方法(比如set方法)赋值。 -2. @ObjectLink的使用指导请参考文档[@ObjectLink使用指导](../../../application-dev/quick-start/arkts-state-mgmt-page-level.md)。 + 如果需要在父组件中修改子组件的`@LocalStorageLink`, `@LocalStorageProp`修饰的变量,则使用LocalStorage提供的API接口方法(比如set方法)赋值。 +2. @ObjectLink的使用指导请参考文档[@ObjectLink使用指导](../../../application-dev/quick-start/arkts-observed-and-objectlink.md)。 ## cl.arkui.3 List组件和Scroll组件onScrollBegin事件变更 @@ -224,13 +224,13 @@ onScrollBegin事件不能再使用,需要使用onScrollFrameBegin事件。 **关键接口/组件变更** -| 旧事件定义 | 新事件定义 | -|------------------ | ------------------- | +| 旧事件定义 | 新事件定义 | +| ---------------------------------------- | ---------------------------------------- | | onScrollBegin(event: (dx: number, dy: number) => { dxRemain: number, dyRemain: number }) | onScrollFrameBegin(event: (offset: number, state: ScrollState) => { offsetRemain: number }) | onScrollFrameBegin事件说明参考API接口文档: -- [Scroll组件事件](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/arkui-ts/ts-container-scroll.md#%E4%BA%8B%E4%BB%B6) -- [List组件事件](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/arkui-ts/ts-container-list.md#%E4%BA%8B%E4%BB%B6) +- [Scroll组件事件](../../../application-dev/reference/arkui-ts/ts-container-scroll.md#事件) +- [List组件事件](../../../application-dev/reference/arkui-ts/ts-container-list.md#事件) **适配指导** diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_4.0.5.2/changelogs-ability.md b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.5.2/changelogs-ability.md new file mode 100644 index 0000000000000000000000000000000000000000..ba5ef87f8bb33c7ffb56cba4e92e711f07248c79 --- /dev/null +++ b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.5.2/changelogs-ability.md @@ -0,0 +1,64 @@ +# 元能力子系统ChangeLog + +## cl.ability.appRecovery新增saveAppState接口 + +新增接口saveAppState(context?: UIAbilityContext): boolean; + +**变更影响** + +基于OpenHarmony4.0.5.2及之后的SDK版本开发的应用,可以使用saveAppState接口传入指定Ability Context,实现主动保存指定的Ability状态。 + +**关键接口/组件变更** + +@ohos.app.ability.appRecovery.d.ts中新增saveAppState接口。 + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| -- | -- | -- | -- | +| @ohos.app.ability.appRecovery.d.ts | appRecovery | saveAppState(context?: UIAbilityContext): boolean; | 新增 | + +**适配指导** + +通过调用saveAppState传入UIAbility Context参数主动保存此指定的Ability的状态。 + +```ts +import appRecovery from '@ohos.app.ability.appRecovery'; +onBackground() { + hilog.info(0x0000, '[demo]', '%{public}s', 'EntryAbility onBackground'); + appRecovery.saveAppState(this.context) +} +``` +## cl.ability.appRecovery新增setRestartWant接口 + +新增接口setRestartWant(want: Want): void; + +**变更影响** + +基于OpenHarmony4.0.5.2及之后的SDK版本开发的应用,可以使用setRestartWant接口设置下次由恢复主动拉起场景下的Ability。 + +**关键接口/组件变更** + +@ohos.app.ability.appRecovery.d.ts中新增setRestartWant接口。 + +| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 | +| -- | -- | -- | -- | +| @ohos.app.ability.appRecovery.d.ts | appRecovery | setRestartWant(want: Want): void; | 新增 | + +**适配指导** + +通过调用setRestartWant设置下次恢复到的指定Ability。 + +```ts +import appRecovery from '@ohos.app.ability.appRecovery'; +Button("启动到恢复Ability") + .fontSize(40) + .fontWeight(FontWeight.Bold) + .onClick(()=> { + // set restart want + let want = { + bundleName: "ohos.samples.recovery", + abilityName: "RecoveryAbility" + }; + + appRecovery.setRestartWant(want); + }) +``` \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_4.0.5.3/changelog-imf.md b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.5.3/changelog-imf.md new file mode 100644 index 0000000000000000000000000000000000000000..a6cdab6b8d7e7fc6a97698ce9b2e2a84ba32076a --- /dev/null +++ b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.5.3/changelog-imf.md @@ -0,0 +1,21 @@ +# 输入法框架子系统-输入法框架服务ChangeLog + + +## @ohos.InputMethodSubtype 中输入法子类型中name、label、id属性值变更 +从API9开始,变更如上三个属性值 + +开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +此三个属性的取值发生变化,需要开发者进行适配更新 + +| 名称 | 变更前 | 变更后 | +| -------- | -------- | -------- | +| label | (1)取值:输入法子类型的id。| (1)取值:输入法子类型的标签。| +| name | (1)说明:输入法子类型的名字;(2)取值:输入法子类型的标签。| (1)说明:输入法应用的包名;(2)取值:输入法应用的包名。| +| id | (1)取值:输入法应用的包名。| (1)取值:输入法子类型的id。| + +**适配指导** + +请按上述取值变更结果适配更新。 diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_4.0.5.3/changelog-screenlock.md b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.5.3/changelog-screenlock.md new file mode 100644 index 0000000000000000000000000000000000000000..8e5a2fab3671eb32db8accb72d764a1194f26ff1 --- /dev/null +++ b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.5.3/changelog-screenlock.md @@ -0,0 +1,155 @@ +# 主题框架子系统-锁屏管理服务ChangeLog + + +## cl.screenlock.1 isLocked、unlock接口使用权限变更 +从API9开始,变更为systemapi,停止对三方应用开放。 + +开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +基于此前版本开发的应用,需适配变更的js接口,变更前的接口已经不能正常使用了,否则会影响原有功能。 + +- 涉及接口 + +```js + function isLocked(): boolean; + function unlock(callback: AsyncCallback<boolean>): void; + function unlock():Promise<boolean>; +``` + +- 变更前: + +```js + * Checks whether the screen is currently locked. + * + * @returns Returns {@code true} if the screen is currently locked; returns {@code false} otherwise. + * @syscap SystemCapability.MiscServices.ScreenLock + * @since 9 + */ + function isLocked(): boolean; + + /** + * Unlock the screen. + * + * @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @throws {BusinessError} 13200002 - the screenlock management service is abnormal. + * @syscap SystemCapability.MiscServices.ScreenLock + * @systemapi Hide this for inner system use. + * @since 9 + */ + function unlock(callback: AsyncCallback<boolean>): void; + + /** + * Unlock the screen. + * + * @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @throws {BusinessError} 13200002 - the screenlock management service is abnormal. + * @syscap SystemCapability.MiscServices.ScreenLock + * @systemapi Hide this for inner system use. + * @since 9 + */ + function unlock():Promise<boolean>; +``` + +- 变更后: + +```js + * Checks whether the screen is currently locked. + * + * @returns Returns {@code true} if the screen is currently locked; returns {@code false} otherwise. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @syscap SystemCapability.MiscServices.ScreenLock + * @systemapi Hide this for inner system use. + * @since 9 + */ + function isLocked(): boolean; + + /** + * Unlock the screen. + * + * @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 13200002 - the screenlock management service is abnormal. + * @syscap SystemCapability.MiscServices.ScreenLock + * @since 9 + */ + function unlock(callback: AsyncCallback<boolean>): void; + + /** + * Unlock the screen. + * + * @returns Returns {@code true} if the screen is unlocked successfully; returns {@code false} otherwise. + * @throws {BusinessError} 13200002 - the screenlock management service is abnormal. + * @syscap SystemCapability.MiscServices.ScreenLock + * @since 9 + */ + function unlock():Promise<boolean>; +``` + + +**适配指导** + +该接口变更为系统应用后,三方应用已无法使用。 +系统应用可正常使用。 +示例代码如下: + +```js + try { + let ret = screenLock.isLocked(); + console.error(`Obtain whether the screen is locked successfully , ret is: ${ret}`); + } catch (error) { + console.error(`Failed to obtain whether the screen is locked, error is : ${error.code}, ${error.message}`); + } +``` + +```js + screenlock.unlock((err, data) => { + if (err) { + console.error(`Failed to unlock the screen, because: ${err.message}`); + return; + } + console.info(`unlock the screen successfully. result: ${data}`); + }); +``` + +```js + screenlock.unlock().then((data) => { + console.info(`unlock the screen successfully. result: ${data}`); + }).catch((err) => { + console.error(`Failed to unlock the screen, because: ${err.message}`); + }); +``` + + +## cl.screenlock.2 isSecure接口废弃变更 +从API9开始,废弃此接口。 + +开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +该接口删除无法再使用,请使用进行更新使用,否则会影响原有功能。 + +- 涉及接口 + +```js + function isSecure(): boolean; +``` + +- 变更前: + +```js + function isSecure(): boolean; +``` + +- 变更后:删除接口,停止对外开放。 + + +**适配指导** + +该接口删除后无法再使用,请适配更新。 diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_4.0.5.3/changelog-wallpaper.md b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.5.3/changelog-wallpaper.md new file mode 100644 index 0000000000000000000000000000000000000000..13baab45851959398ccf4689543f91c5e1aa1d68 --- /dev/null +++ b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.5.3/changelog-wallpaper.md @@ -0,0 +1,304 @@ +# 主题框架子系统-壁纸管理服务ChangeLog + + +## cl.wallpaper.1 getColorsSync、getMinHeightSync、getMinWidthSync、restore、setImage接口使用权限变更 +从API9开始,变更为systemapi,停止对三方应用开放。 + +开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +基于此前版本开发的应用,需适配变更的js接口,变更前的接口已经不能正常使用了,否则会影响原有功能。 + +- 涉及接口 + +```js + function getColorsSync(wallpaperType: WallpaperType): Array<RgbaColor>; + function getMinHeightSync(): number; + function getMinWidthSync(): number; + function restore(wallpaperType: WallpaperType, callback: AsyncCallback<void>): void; + function restore(wallpaperType: WallpaperType): Promise<void>; + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback<void>): void; + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise<void>; +``` + +- 变更前: + +```js + /** + * Obtains the wallpaper colors for the wallpaper of the specified type. Returns rgbaColor type of array callback function. + * @param wallpaperType Indicates the wallpaper type. + * @returns { Array<RgbaColor> } the Array<RgbaColor> returned by the function. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function getColorsSync(wallpaperType: WallpaperType): Array<RgbaColor>; + + /** + * Obtains the minimum height of the wallpaper. in pixels. returns 0 if no wallpaper has been set. + * @returns { number } the number returned by the function. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function getMinHeightSync(): number; + + /** + * Obtains the minimum width of the wallpaper. in pixels. returns 0 if no wallpaper has been set. + * @returns { number } the number returned by the function. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function getMinWidthSync(): number; + + /** + * Removes a wallpaper of the specified type and restores the default one. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function restore(wallpaperType: WallpaperType, callback: AsyncCallback<void>): void; + + /** + * Removes a wallpaper of the specified type and restores the default one. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function restore(wallpaperType: WallpaperType): Promise<void>; + + /** + * Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file. + * @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback<void>): void; + + /** + * Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file. + * @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @throws {BusinessError} 202 - permission verification failed, application which is not a system application uses system API. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @systemapi Hide this for inner system use. + * @since 9 + */ + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise<void>; +``` + +- 变更后: + +```js + /** + * Obtains the wallpaper colors for the wallpaper of the specified type. Returns rgbaColor type of array callback function. + * @param wallpaperType Indicates the wallpaper type. + * @returns { Array<RgbaColor> } the Array<RgbaColor> returned by the function. + * @throws {BusinessError} 401 - parameter error. + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function getColorsSync(wallpaperType: WallpaperType): Array<RgbaColor>; + + /** + * Obtains the minimum height of the wallpaper. in pixels. returns 0 if no wallpaper has been set. + * @returns { number } the number returned by the function. + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function getMinHeightSync(): number; + + /** + * Obtains the minimum width of the wallpaper. in pixels. returns 0 if no wallpaper has been set. + * @returns { number } the number returned by the function. + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function getMinWidthSync(): number; + + /** + * Removes a wallpaper of the specified type and restores the default one. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function restore(wallpaperType: WallpaperType, callback: AsyncCallback<void>): void; + + /** + * Removes a wallpaper of the specified type and restores the default one. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function restore(wallpaperType: WallpaperType): Promise<void>; + + /** + * Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file. + * @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType, callback: AsyncCallback<void>): void; + + /** + * Sets a wallpaper of the specified type based on the uri path from a JPEG or PNG file or the pixel map of a PNG file. + * @param source Indicates the uri path from a JPEG or PNG file or the pixel map of the PNG file. + * @param wallpaperType Indicates the wallpaper type. + * @throws {BusinessError} 401 - parameter error. + * @throws {BusinessError} 201 - permission denied. + * @permission ohos.permission.SET_WALLPAPER + * @syscap SystemCapability.MiscServices.Wallpaper + * @since 9 + */ + function setImage(source: string | image.PixelMap, wallpaperType: WallpaperType): Promise<void>; +``` + + +**适配指导** + +该接口变更为系统应用后,三方应用已无法使用。 +系统应用可正常使用。 +示例代码如下: + +```js + try { + let colors = wallpaper.getColorsSync(wallpaper.WallpaperType.WALLPAPER_SYSTEM); + console.log(`success to getColorsSync: ${JSON.stringify(colors)}`); + } catch (error) { + console.error(`failed to getColorsSync because: ${JSON.stringify(error)}`); + } +``` + +```js + let minHeight = wallpaper.getMinHeightSync(); +``` + +```js + let minWidth = wallpaper.getMinWidthSync(); +``` + +```js + wallpaper.restore(wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error) => { + if (error) { + console.error(`failed to restore because: ${JSON.stringify(error)}`); + return; + } + console.log(`success to restore.`); + }); +``` + +```js + wallpaper.restore(wallpaper.WallpaperType.WALLPAPER_SYSTEM).then(() => { + console.log(`success to restore.`); + }).catch((error) => { + console.error(`failed to restore because: ${JSON.stringify(error)}`); + }); +``` + +```js + // source类型为string + let wallpaperPath = "/data/data/ohos.acts.aafwk.plrdtest.form/files/Cup_ic.jpg"; + wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM, (error) => { + if (error) { + console.error(`failed to setImage because: ${JSON.stringify(error)}`); + return; + } + console.log(`success to setImage.`); + }); +``` + +```js + // source类型为string + let wallpaperPath = "/data/data/ohos.acts.aafwk.plrdtest.form/files/Cup_ic.jpg"; + wallpaper.setImage(wallpaperPath, wallpaper.WallpaperType.WALLPAPER_SYSTEM).then(() => { + console.log(`success to setImage.`); + }).catch((error) => { + console.error(`failed to setImage because: ${JSON.stringify(error)}`); + }); +``` + + +## cl.wallpaper.2 getIdSync、getFileSync、isChangeAllowed、isUserChangeAllowed、on、off、RgbaColor接口废弃变更 +从API9开始,废弃此接口。 + +开发者需要根据以下说明对应用进行适配。 + +**变更影响** + +该接口删除无法再使用,请使用进行更新使用,否则会影响原有功能。 + +- 涉及接口 + +```js + function getIdSync(wallpaperType: WallpaperType): number; + function getFileSync(wallpaperType: WallpaperType): number; + function isChangeAllowed(): boolean; + function isUserChangeAllowed(): boolean; + function on(type: 'colorChange', callback: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void; + function off(type: 'colorChange', callback?: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void; + interface RgbaColor { + red: number; + green: number; + blue: number; + alpha: number; + } +``` + +- 变更前: + +```js + function getIdSync(wallpaperType: WallpaperType): number; + function getFileSync(wallpaperType: WallpaperType): number; + function isChangeAllowed(): boolean; + function isUserChangeAllowed(): boolean; + function on(type: 'colorChange', callback: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void; + function off(type: 'colorChange', callback?: (colors: Array<RgbaColor>, wallpaperType: WallpaperType) => void): void; + interface RgbaColor { + red: number; + green: number; + blue: number; + alpha: number; + } +``` + +- 变更后:删除接口,停止对外开放。 + + +**适配指导** + +该接口删除后无法再使用,请适配更新。 diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_4.0.6.1/changelog-huks.md b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.6.1/changelog-huks.md new file mode 100755 index 0000000000000000000000000000000000000000..465a3ce6bff579a359dc5a46534d2e915b1d7d4b --- /dev/null +++ b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.6.1/changelog-huks.md @@ -0,0 +1,31 @@ +# HUKS子系统ChangeLog + +OpenHarmony 4.0.6.1 版本相较于OpenHarmony 之前的版本,HUKS的API使用权限变更如下。 + +## cl.huks.1 attestKeyItem接口使用权限变更 + +attestKeyItem是基于设备证书链封装业务公钥对用户指定的密钥进行证明,如果设备证书随意导出涉及用户隐私风险,所以此接口需要增加系统权限管控。 + +**变更影响** + +对于不具备system权限或者ohos.permission.ACCESS_IDS权限的应用,无法正常使用attestKeyItem接口。 + +**关键的接口/组件变更** + +- 涉及接口 + + attestKeyItem(keyAlias: string, options: HuksOptions, callback: AsyncCallback\<HuksReturnResult\>): void; + attestKeyItem(keyAlias: string, options: HuksOptions): Promise\<HuksReturnResult\>; + +- 变更前: + + 只针对传入ATTESTATION_ID相关TAG的应用校验AccessToken权限,其它情况无接口权限的限制。 + + +- 变更后: + + 只有具备system权限的系统应用或者申请了ohos.permission.ACCESS_IDS权限的普通应用才能正常使用attestKeyItem接口。 + +**适配指导** + +已经具备system权限的应用则可以正常使用attestKeyItem接口,其余普通应用需申请ohos.permission.ACCESS_IDS权限即可,申请方法参考[ACL权限配置说明](https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/security/accesstoken-overview.md#%E8%AE%BF%E9%97%AE%E6%8E%A7%E5%88%B6%E5%88%97%E8%A1%A8acl%E8%AF%B4%E6%98%8E)。 \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_4.0.6.1/changelog-web.md b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.6.1/changelog-web.md new file mode 100644 index 0000000000000000000000000000000000000000..a60d12ad2408ed795dcd9cbb7fe8f2e0d5191e16 --- /dev/null +++ b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.6.1/changelog-web.md @@ -0,0 +1,33 @@ +# web子系统ChangeLog + +OpenHarmony 4.0.6.1 版本相较于OpenHarmony 之前的版本,web的API变更如下。 + +## cl.web.1 createWebMessagePorts接口参数 + +由于WebMessagePort需要新增支持更多数据类型,因此在该接口增加一个可选参数来区分新老接口。 + +**变更影响** + +无,可选参数,可前向兼容。 + +**关键的接口/组件变更** + +- 涉及接口 + + createWebMessagePorts(): Array<WebMessagePort>; + +- 变更前: + + ```ts + createWebMessagePorts(): Array<WebMessagePort>; + ``` + +- 变更后: + + ```ts + createWebMessagePorts(isExtentionType?: boolean): Array<WebMessagePort>; + ``` + +**适配指导** + +已有应用无需适配。 \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_4.0.6.1/changelogs-usb.md b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.6.1/changelogs-usb.md new file mode 100644 index 0000000000000000000000000000000000000000..3c0d57d8b3cd957505d66711214181788a6e22c0 --- /dev/null +++ b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.6.1/changelogs-usb.md @@ -0,0 +1,23 @@ +# USB服务子系统ChangeLog + +## cl.usb_manager.1 sdk接口删除 + +基于此前版本开发的应用,需修改导入的包名,否则会影响原有业务逻辑。 + +**关键接口/组件变更** + +@ohos.usbV9.d.ts文件已删除,由@ohos.usbManager.d.ts替代。 + +| 新包名 | 旧包名 | 已删除包名 | +| -------------------- | ------------- | --------------- | +| ohos.usbManager.d.ts | ohos.usb.d.ts | ohos.usbV9.d.ts | + +后续需要import @ohos.usbManager才能使用USB服务的接口: + + ```ts + import usbManager from '@ohos.usbManager'; + ``` + +**适配指导** + +请参考各接口的[API文档](../../../application-dev/reference/apis/js-apis-usbManager.md) diff --git a/zh-cn/release-notes/changelogs/OpenHarmony_4.0.6.2/changelogs-global.md b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.6.2/changelogs-global.md new file mode 100755 index 0000000000000000000000000000000000000000..f5f49c7e88c44af1f4875a5dcf82a136527be45c --- /dev/null +++ b/zh-cn/release-notes/changelogs/OpenHarmony_4.0.6.2/changelogs-global.md @@ -0,0 +1,46 @@ +# 全球化子系统ChangeLog + +## cl.resourceManager.1 getStringSync、getStringByNameSync新增接口 + +相较于之前的版本,在4.0.6.2 版本中,为扩展getStringSync、getStringByNameSync接口字符串匹配功能,新增了接口以及相应的错误码。 + +| 包名 | 新增接口 | +| --------------- | ---------------------------------------------------- | +| ohos.resourceManager.d.ts | getStringSync(resId: number, ...args: Array<string \| number>): string; | +| ohos.resourceManager.d.ts | getStringSync(resource: Resource, ...args: Array<string \| number>): string; | +| ohos.resourceManager.d.ts | getStringByNameSync(resName: string, ...args: Array<string \| number>): string; | + +**变更影响** + +之前只能直接获取resources中的string资源的value值,在4.0.6.2 及以上版本中可用通过参数格式化string资源的value值,扩展了格式化字符串的查询能力。 + +新增错误码: + +9001007 根据当前id获取的资源格式化失败 + +9001008 根据当前名称获取的资源格式化失败 + +**示例代码** + +以调用接口getStringSync为例,变更前只支持示例1,变更后示例1、示例2都支持。 +``` +示例1: +try { + this.context.resourceManager.getStringSync($r('app.string.test').id); +} catch (error) { + console.error(`getStringSync failed, error code: ${error.code}, message: ${error.message}.`) +} +示例2: +try { + this.context.resourceManager.getStringSync($r('app.string.test').id, "format string", 787, 98.78); +} catch (error) { + console.error(`getStringSync failed, error code: ${error.code}, message: ${error.message}.`) +} +``` + +**适配指导** +请参考接口说明: + +[新增接口参考](../../../application-dev/reference/apis/js-apis-resource-manager.md) + +[新增错误码参考](../../../application-dev/reference/errorcodes/errorcode-resource-manager.md) \ No newline at end of file diff --git a/zh-cn/release-notes/changelogs/v3.2-Release/changelogs-account_os_account.md b/zh-cn/release-notes/changelogs/v3.2-Release/changelogs-account_os_account.md new file mode 100644 index 0000000000000000000000000000000000000000..310b4e1338e302bb4fe1aff913b74e1ece3e12a5 --- /dev/null +++ b/zh-cn/release-notes/changelogs/v3.2-Release/changelogs-account_os_account.md @@ -0,0 +1,22 @@ +# 帐号子系统changeLog + +## cl.account_os_account.1 应用帐号取消帐号名中空格字符限制 + +变更前,应用帐号接口传入包含空格字符的帐号名时,返回无效参数错误;变更后,不报错。 + +**变更影响** + +基于此前版本开发的应用不受变更影响; +基于此后版本开发的应用,调用API 9以及之后版本的应用帐号相关接口,帐号名不再做空格字符限制。 + +**关键接口/组件变更** + +涉及的接口: +- AppAccountManager + - createAccount(name: string, callback: AsyncCallback<void>): void; + - auth(name: string, owner: string, authType: string, callback: AuthCallback): void; + - setAppAccess(name: string, bundleName: string, isAccessible: boolean, callback: AsyncCallback<void>): void; + - setCredential(name: string, credentialType: string, credential: string, callback: AsyncCallback<void>): void; + - setCustomData(name: string, key: string, value: string, callback: AsyncCallback<void>): void; + - setAuthToken(name: string, authType: string, token: string, callback: AsyncCallback<void>): void; + - setAuthTokenVisibility(name: string, authType: string, bundleName: string, isVisible: boolean, callback: AsyncCallback<void>): void; diff --git a/zh-cn/release-notes/changelogs/v3.2-beta2/application-sandbox-adaptation-guide.md b/zh-cn/release-notes/changelogs/v3.2-beta2/application-sandbox-adaptation-guide.md index 7e7f81e258da29f05da52b4d9f61f855ad40269b..f690a09096af95d4b9cc8982c21e81e1fc321a2f 100644 --- a/zh-cn/release-notes/changelogs/v3.2-beta2/application-sandbox-adaptation-guide.md +++ b/zh-cn/release-notes/changelogs/v3.2-beta2/application-sandbox-adaptation-guide.md @@ -14,9 +14,7 @@ 1. 定位出app异常的问题点之后,识别该问题是否是app源代码访问路径出错导致的,是否是访问有效文件可以通过下一章节的[沙箱文件访问规格清单](#沙箱文件访问规格清单)自查。 2. 如果是app源码访问无效路径,则可以通过调整访问路径的策略,将原来访问/data目录从绝对路径访问方式调整为使用context接口进行访问,具体请见context接口使用说明: - https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/ability/context-userguide.md - https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-ability-context.md - https://gitee.com/OpenHarmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-Context.md + https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/application-models/application-context-stage.md 3. 如果是app调用三方模块,异常调用栈出现在三方模块中,而app源码没有使用绝对路径去访问文件,则适配过程如下: - 通知三方模块,让其访问文件路径通过context接口进行访问而非使用绝对路径的方式。 - 如果三方模块是个公共模块,除了给appspawn孵化的进程使用之外还给native进程使用,则可以将三方模块抽象成一个服务,应用通过ipc的方式去访问服务。 diff --git a/zh-cn/release-notes/figures/release.png b/zh-cn/release-notes/figures/release.png new file mode 100644 index 0000000000000000000000000000000000000000..f4bb63ef5b79798fe7c6c0cfc6ccd1ed35504aa4 Binary files /dev/null and b/zh-cn/release-notes/figures/release.png differ diff --git a/zh-cn/release-notes/release-definitions/Release-version-definitions.md b/zh-cn/release-notes/release-definitions/Release-version-definitions.md old mode 100644 new mode 100755 index e17d819f8bb9cfb840b5268474c8490e96bef8ee..7a4f97ed628e69b48113fc3b52d32aa4fbbee13c --- a/zh-cn/release-notes/release-definitions/Release-version-definitions.md +++ b/zh-cn/release-notes/release-definitions/Release-version-definitions.md @@ -25,49 +25,31 @@ OpenHarmony社区Beta分支是在社区开发和演进过程中不定期从Maste OpenHarmony社区基于LTS/Release分支以patch形式合入少量补丁代码,用于解决单点bug、安全漏洞、以及其他必须的适配修改,经过集成验证之后发布的稳定可靠的标签版本。 -### 维护分支下载命令 +社区版本发布在:https://gitee.com/openharmony/docs/tree/master/zh-cn/release-notes -| 分支 | 下载命令(repo + https) | 下载命令(repo + ssh) | -| ------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | -| 1.0.1-Release | repo init -u https://gitee.com/openharmony/manifest -b OpenHarmony_1.0.1_release -m default.xml --no-repo-verify<br/>repo sync -c<br/>repo forall -c 'git lfs pull' | repo init -u git@gitee.com:openharmony/manifest.git -b OpenHarmony-3.1-Release -m default.xml --no-repo-verify<br/>repo sync -c<br/>repo forall -c 'git lfs pull' | -| 3.0-LTS | repo init -u https://gitee.com/openharmony/manifest.git -b OpenHarmony-3.0-LTS --no-repo-verify<br/>repo sync -c<br/>repo forall -c 'git lfs pull' | repo init -u git@gitee.com:openharmony/manifest.git -b OpenHarmony-3.0-LTS --no-repo-verify<br/>repo sync -c<br/>repo forall -c 'git lfs pull' | -| 3.1-Release | repo init -u git@gitee.com:openharmony/manifest.git -b OpenHarmony-3.1-Release -m default.xml --no-repo-verify<br/>repo sync -c<br/>repo forall -c 'git lfs pull' | repo init -u git@gitee.com:openharmony/manifest.git -b OpenHarmony-3.1-Release -m default.xml --no-repo-verify<br/>repo sync -c<br/>repo forall -c 'git lfs pull' | - - - -## 维护策略 - -### 生命周期策略 - -OpenHarmony对已发布的LTS和Release分支提供生命周期管理服务,分为两个部分: - -#### 发布->停止主动维护: - -​ Release sig团队会定期规划维护标签版本计划,用于解决单点bug、安全漏洞、以及其他必须的修改,以此确保分支持续处于稳定可用状态。 +## 生命周期策略 -#### 停止主动维护->停止维护: +OpenHarmony社区依据《OpenHarmony版本生命周期管理》对Release和LTS分支提供维护和技术支持。 -​ Release sig团队不再主动规划和发布标签版本,仅对社区安全漏洞和严重缺陷在对应分支进行修复。 - -### LTS/Release分支维护策略 - -LTS分支:分支发布之日起,提供两年主动维护,并提供1.5年被动维护。 +### 维护时间表 -Release分支:分支发布之日起,提供一年主动维护,并提供一年被动维护。 +OpenHarmony目前已发布的LTS/Release分支的维护时间表如下: -### 分支合入管控策略 +| 分支名 | 分支类型 | 发布时间 | 停止主动维护 | 停止维护 | +| ------------- | -------- | --------- | ------------ | --------- | +| 1.0.1-Release | Release | 2021-3-30 | 2022-3-30 | 2023-3-30 | +| 3.0-LTS | LTS | 2021-9-30 | 2023-9-30 | 2025-3-30 | +| 3.1-Release | Release | 2022-3-30 | 2023-3-30 | 2024-3-30 | -LTS/Release分支发布后,Release sig团队负责其生命周期管理,在维护周期内,我们只接受安全问题、acts套件问题以及其他重大问题的修复及合入,对应分支的合入会严格管控。目前分支合入管控策略已生效,合入请求需要在committer审查通过后联系对应[owner](https://gitee.com/openharmony/community/blob/master/zh/BRANCHOWNER)评论approve后合入。 +分支下载命令如下: -### 维护时间表 +| 分支 | 下载命令(repo + https) | 下载命令(repo + ssh) | +| ------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | +| 1.0.1-Release | repo init -u https://gitee.com/openharmony/manifest -b OpenHarmony_1.0.1_release -m default.xml --no-repo-verify<br/>repo sync -c<br/>repo forall -c 'git lfs pull' | repo init -u git@gitee.com:openharmony/manifest.git -b OpenHarmony-3.1-Release -m default.xml --no-repo-verify<br/>repo sync -c<br/>repo forall -c 'git lfs pull' | +| 3.0-LTS | repo init -u https://gitee.com/openharmony/manifest.git -b OpenHarmony-3.0-LTS --no-repo-verify<br/>repo sync -c<br/>repo forall -c 'git lfs pull' | repo init -u git@gitee.com:openharmony/manifest.git -b OpenHarmony-3.0-LTS --no-repo-verify<br/>repo sync -c<br/>repo forall -c 'git lfs pull' | +| 3.1-Release | repo init -u git@gitee.com:openharmony/manifest.git -b OpenHarmony-3.1-Release -m default.xml --no-repo-verify<br/>repo sync -c<br/>repo forall -c 'git lfs pull' | repo init -u git@gitee.com:openharmony/manifest.git -b OpenHarmony-3.1-Release -m default.xml --no-repo-verify<br/>repo sync -c<br/>repo forall -c 'git lfs pull' | -OpenHarmony目前已发布的LTS/Release分支的维护时间表如下: -| NO. | 分支名 | 分支类型 | 发布时间 | 停止主动维护 | 停止维护 | -| :--- | ------------- | :------- | :-------- | :----------- | :-------- | -| 1 | 1.0.1-Release | Release | 2021-3-30 | 2022-3-30 | 2023-3-30 | -| 2 | 3.0-LTS | LTS | 2021-9-30 | 2023-9-30 | 2025-3-30 | -| 3 | 3.1-Release | Release | 2022-3-30 | 2023-3-30 | 2024-3-30 | ### 版本计划 diff --git a/zh-cn/third-party-components/npm-third-party-guide.md b/zh-cn/third-party-components/npm-third-party-guide.md deleted file mode 100644 index 60222a480c852f19216688d99dda1dd9822005cc..0000000000000000000000000000000000000000 --- a/zh-cn/third-party-components/npm-third-party-guide.md +++ /dev/null @@ -1,51 +0,0 @@ -# OpenHarmony JS和TS三方组件使用指导 -## OpenHarmony JS和TS三方组件介绍 - -OpenHarmony JS和TS三方组件是以OpenHarmony npm包的形式,在传统的npm三方组件的基础上,定义了OpenHarmony npm共享包特定的工程结构和配置文件,支持OpenHarmony页面组件相关API、资源的调用。通过OpenHarmony npm包,可以实现多个模块或者多个工程共享OpenHarmony页面、资源等相关代码。前往[npm官方文档](https://docs.npmjs.com/about-npm),可以了解和掌握npm的基础功能和机制。 - - - -## 查找OpenHarmony JS和TS三方组件 - -1. 关注Gitee官网OpenHarmony-TPC[三方组件资源汇总](https://gitee.com/openharmony-tpc/tpc_resource)项目,根据目录索引即可找到对应分类下的具体组件。 - - - -2. 访问[OpenHarmony官网](https://www.openharmony.cn/mainPlay/tpc),通过类型,分类,以及关键字搜索需要的三方组件。 - ![official-website.png](official-website.png) - - - -## 安装并使用OpenHarmony JS和TS语言的三方组件 - -在应用开发的过程中,JS和TS语言的三方组件,通常以源码或OpenHarmony npm包的方式被引入使用。按照以下步骤即可将OpenHarmony npm包引入应用并使用,源码的具体引入及使用请参考各三方组件README.md指导介绍。 - -1. 配置OpenHarmony npm环境,详情请参考安装教程 [如何安装OpenHarmony npm包](https://gitee.com/openharmony-tpc/docs/blob/master/OpenHarmony_npm_usage.md)。 - -2. 在Terminal项目终端中,进入entry目录,并执行目标组件命令进行安装。具体的下载命令详见OpenHarmony官网该三方组件的“下载安装“模块。 - - 以安装[vcard三方组件](https://growing.openharmony.cn/mainPlay/libraryMaps/vcard_595)为例,找到“下载安装”模块获取其安装命令,并执行该命令安装: - - ![npm-usage1.png](npm-usage1.png) - - ![npm-usage2.png](npm-usage2.png) - -3. 下载完成后在项目文件下自动生成node_modules文件,下载的三方库即node_modules目录下的@ohos\VCard。 - - ![npm-usage3.png](npm-usage3.png) - -4. 在package.json中会自动添加如下依赖: - - ``` - "dependencies": { - "@ohos/vcard": "^2.0.5" - } - ``` - -5. 在需要使用该组件的文件中导入组件。 - - ![npm-usage4.png](npm-usage4.png) - -6. 导入组件后直接使用方法即可。 - - ![npm-usage5.png](npm-usage5.png) \ No newline at end of file diff --git a/zh-cn/third-party-components/npm-usage1.png b/zh-cn/third-party-components/npm-usage1.png deleted file mode 100644 index 9dc9a72717182136e77d620c90e45669c4059043..0000000000000000000000000000000000000000 Binary files a/zh-cn/third-party-components/npm-usage1.png and /dev/null differ diff --git a/zh-cn/third-party-components/npm-usage2.png b/zh-cn/third-party-components/npm-usage2.png deleted file mode 100644 index ce9e34ec18125ff473ad48667808081adc1a95d7..0000000000000000000000000000000000000000 Binary files a/zh-cn/third-party-components/npm-usage2.png and /dev/null differ diff --git a/zh-cn/third-party-components/npm-usage3.png b/zh-cn/third-party-components/npm-usage3.png deleted file mode 100644 index 66b6a14069cec3caaa42c0007f7b12ff09773f6f..0000000000000000000000000000000000000000 Binary files a/zh-cn/third-party-components/npm-usage3.png and /dev/null differ diff --git a/zh-cn/third-party-components/npm-usage4.png b/zh-cn/third-party-components/npm-usage4.png deleted file mode 100644 index 8cd881a7ddf90aed5570411c943794829c2fa24d..0000000000000000000000000000000000000000 Binary files a/zh-cn/third-party-components/npm-usage4.png and /dev/null differ diff --git a/zh-cn/third-party-components/npm-usage5.png b/zh-cn/third-party-components/npm-usage5.png deleted file mode 100644 index ec7f772f86dad4deb5f061f6e7cf6ac41748a225..0000000000000000000000000000000000000000 Binary files a/zh-cn/third-party-components/npm-usage5.png and /dev/null differ diff --git a/zh-cn/third-party-components/ohpm-third-party-guide.md b/zh-cn/third-party-components/ohpm-third-party-guide.md new file mode 100644 index 0000000000000000000000000000000000000000..310aaf4dbb4f8f99112c77da0501549e65e66de9 --- /dev/null +++ b/zh-cn/third-party-components/ohpm-third-party-guide.md @@ -0,0 +1,174 @@ +# OpenHarmony JS和TS三方组件使用指导 +## OpenHarmony JS和TS三方组件介绍 + +OpenHarmony JS和TS三方组件使用的是OpenHarmony静态共享包,即HAR(Harmony Archive),可以包含js/ts代码、c++库、资源和配置文件。通过HAR,可以实现多个模块或者多个工程共享ArkUI组件、资源等相关代码。HAR不同于HAP,不能独立安装运行在设备上,只能作为应用模块的依赖项被引用。 + + + +## 查找OpenHarmony JS和TS三方组件 + +1. 关注Gitee官网OpenHarmony-TPC[三方组件资源汇总](https://gitee.com/openharmony-tpc/tpc_resource)项目,根据目录索引即可找到对应分类下的具体组件。 + + + +2. 访问[OpenHarmony官网](https://growing.openharmony.cn/mainPlay/tpc),通过类型,分类,以及关键字搜索需要的三方组件。 + ![official-website.png](official-website.png) + + + +## 安装并使用OpenHarmony JS和TS语言的三方组件 + +引用三方HAR,包括从仓库进行安装和从本地库模块中进行安装两种方式。 + +**引用仓库安装的HAR** + +引用ohpm仓中的HAR,首先需要设置三方HAR的仓库信息,DevEco Studio默认仓库地址是"https://repo.harmonyos.com/ohpm/",如果您想设置自定义仓库,请在DevEco Studio的Terminal窗口执行如下命令进行设置(执行命令前,请确保将DevEco Studio中ohpm安装地址配置在“环境变量-系统变量-PATH”中): +``` +ohpm config set registry=your_registry1,your_registry2 +``` +说明:ohpm支持多个仓库地址,采用英文逗号分隔。 +然后通过如下两种方式设置三方包依赖信息: + - 方式一:在Terminal窗口中,执行如下命令安装三方包,DevEco Studio会自动在工程的oh-package.json5中自动添加三方包依赖。 +``` +ohpm install @ohos/lottie +``` + - 方式二:在工程的oh-package.json5中设置三方包依赖,配置示例如下: +``` +"dependencies": { "@ohos/lottie": "^2.0.0"} +``` +依赖设置完成后,需要执行ohpm install命令安装依赖包,依赖包会存储在工程的oh_modules目录下。 +``` +ohpm install +``` + +**引用本地库模块的文件和资源** + +- 方式一:在Terminal窗口中,执行如下命令进行安装,并会在oh-package5.json中自动添加依赖。 +``` +ohpm install ../library +``` +- 方式二:在工程的oh-package.json5中设置三方包依赖,配置示例如下: +``` +"dependencies": { + "@ohos/library": "file:../library" +} +``` +依赖设置完成后,需要执行ohpm install命令安装依赖包,依赖包会存储在工程的oh_modules目录下。 +``` +ohpm install +``` + +> **说明:** +> +> 在引用OpenHarmony HAR时,请注意以下事项 +>- 当前只支持在模块和工程下的oh-package.json5文件中声明dependencies依赖,才会被当做OpenHarmony依赖使用,并在编译构建过程中进行相应的处理。 +>- 引用的模块的compileSdkVersion不能低于其依赖的OpenHarmony ohpm三方包(可在oh_modules目录下,找到引用的ohpm包的src > main > module.json5 中查看)。 + + + +### 引用OpenHarmony HAR hml页面 +在JS工程范式中,组件功能由hml承载,开发者可以在JS工程的hml页面通过<element>标签来引入OpenHarmony HAR中的共享hml页面,示例如下: +``` +<element name="comp" src="@ohos/library/src/main/js/components/index/index.hml"></element> +``` +其中,@ohos/library为OpenHarmony HAR的包名,hml页面的路径为OpenHarmony HAR中的相对路径。 +随后便可以通过设置的name来使用该element元素,以引用OpenHarmony HAR中的hml页面,示例如下: +```typescript +<element name="comp" src="@ohos/library/src/main/js/components/index/index.hml"></element> + +<div class="container"> + <comp></comp> + <text class="title"> + {{ $t('strings.hello') }} {{ title }} + </text> +</div> +``` +### 引用OpenHarmony HAR ArkTS页面 +ArkTS是TypeScript的扩展,因此导出和引入的语法与TypeScript一致。在OpenHarmony ohpm模块中,可以通过export导出ArkTS页面,示例如下: +```typescript +// library/src/main/ets/components/MainPage/MainPage.ets +@Entry +@Component +export struct MainPage { + @State message: string = 'Hello World' + build() { + Row() { + Column() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } .height('100%') + } +} +``` +然后在其它模块中通过import引入导出的ArkTS页面,示例如下所示: +```typescript +// entry/MainAbility/pages/index.ets + +import { MainPage } from "@ohos/library" +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + build() { + Column() { + MainPage() + Row() { + Text(this.message) + .fontSize(50) + .fontWeight(FontWeight.Bold) + } + .width('100%') + } + .height('10%') + } +} +``` +引用OpenHarmony HAR内ts/js方法ts/js方法的导出和引用,与ArkTS页面的引用相同,即在OpenHarmony ohpm模块中,可以通过export导出ts/js方法,示例如下所示: +```typescript +// library/index.js +export function func() { + return "[ohpm] func1"; +} +``` +然后在其它的ts/js页面中,通过import引入导出的ts/js方法,示例如下所示: +```typescript +// entry/src/main/js/MainAbility/pages/index/index.js +import {func} from "@ohos/library" +export default { + data: { + title: "" + }, + onInit() { + this.title = func(); + } +} +``` +引用OpenHarmony HAR内资源支持在OpenHarmony ohpm模块和依赖OpenHarmony ohpm的模块中引用OpenHarmony ohpm模块内的资源。例如在OpenHarmony ohpm模块的scr/main/resources里添加字符串资源(在string.json中定义,name:hello_ohpm)和图片资源(icon_ohpm.png)。然后在Entry模块中引用该字符串资源和图片资源的示例如下: +当前暂不支持类Web范式引用i18n文件中的国际化资源。 +```typescript +// entry/src/main/ets/MainAbility/pages/index.ets +@Entry +@Component +struct Index { + @State message: string = 'Hello World' + build() { + Column() { + Row() { + Text($r("app.string.hello_ohpm")) // 字符串资源 + .fontSize(40) + .fontWeight(FontWeight.Bold) + } + .width('50%') + Image($r("app.media.icon_ohpm")) // 图片资源 + } + .height('100%') + } +} +``` +在编译构建HAP中,DevEco Studio会从HAP模块及依赖的模块中收集资源文件,如果不同模块的相同限定词目录下的资源文件出现重名冲突时,DevEco Studio会按照以下优先级进行覆盖(优先级由高到低): +- AppScope(仅API 9的Stage模型支持) +- HAP包自身模块 +- 依赖的OpenHarmonyHarmony ohpm模块 \ No newline at end of file diff --git a/zh-cn/third-party-components/third-party-components-introduction.md b/zh-cn/third-party-components/third-party-components-introduction.md index 31f1ab1bfd795ff7b8154455a16d59ca234cd494..aaa89c4fac1bb47e7689a963c46e8c62cc81e18a 100644 --- a/zh-cn/third-party-components/third-party-components-introduction.md +++ b/zh-cn/third-party-components/third-party-components-introduction.md @@ -1,6 +1,6 @@ # OpenHarmony三方组件 -OpenHarmony三方组件,是经过验证可在OpenHarmony系统上可重复使用的软件组件,可帮助开发者快速开发OpenHarmony系统或应用。根据其开发语言分为了2种,一种是使用JavaScript和TypeScript语言的三方组件,通常以源码或OpenHarmony npm包的方式引入,在应用开发中使用。另一种是C和C++语言的三方组件,通常以源码或OpenHarmony hpm包的方式引入,在应用开发中以NAPI的方式使用,或直接编译在OpenHarmony操作系统镜像中。 +OpenHarmony三方组件,是经过验证可在OpenHarmony系统上可重复使用的软件组件,可帮助开发者快速开发OpenHarmony系统或应用。根据其开发语言分为了2种,一种是使用JavaScript和TypeScript语言的三方组件,通常以源码或OpenHarmony HAR的方式引入,在应用开发中使用。另一种是C和C++语言的三方组件,通常以源码或OpenHarmony hpm包的方式引入,在应用开发中以NAPI的方式使用,或直接编译在OpenHarmony操作系统镜像中。 diff --git a/zh-cn/website.md b/zh-cn/website.md index 6fa4303f428e661c368ca9a1bf9a7a9b99f6705a..cee2cd8aa0534eb9e2c3802e1f31fc0714060a88 100644 --- a/zh-cn/website.md +++ b/zh-cn/website.md @@ -205,7 +205,7 @@ - OpenHarmony三方组件 - [OpenHarmony三方组件简介](third-party-components/third-party-components-introduction.md) - - [OpenHarmony JS/TS三方组件使用指导](third-party-components/npm-third-party-guide.md) + - [OpenHarmony JS/TS三方组件使用指导](third-party-components/ohpm-third-party-guide.md) - 贡献 - [参与贡献](contribute/参与贡献.md)